From 56f46f630aadba74717740c2509cee25fc17cde6 Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Tue, 12 Oct 2021 14:37:06 +0200 Subject: [PATCH] Built motion from commit 5413e8d1.|2.5.36 --- 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/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 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.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 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.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/safe-template.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 +- 1152 files changed, 1152 insertions(+), 1152 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ca5b127..657b39b 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-10-12T12:14:56.060Z", + "time": "2021-10-12T12:28:36.910Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 75d8673..5908c1d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-12T12:14:56.060Z", + "time": "2021-10-12T12:28:36.910Z", "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 bb7de6a..ae532db 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 _0xf353=['getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL'];(function(_0x2cd96f,_0x42c74a){var _0x54a083=function(_0x3461ce){while(--_0x3461ce){_0x2cd96f['push'](_0x2cd96f['shift']());}};_0x54a083(++_0x42c74a);}(_0xf353,0x13d));var _0x3f35=function(_0x73b80e,_0x4daa4a){_0x73b80e=_0x73b80e-0x0;var _0x4c31cd=_0xf353[_0x73b80e];return _0x4c31cd;};'use strict';var Sequelize=require(_0x3f35('0x0'));module[_0x3f35('0x1')]={'name':{'type':Sequelize[_0x3f35('0x2')],'get':function(_0x40e648){return this[_0x3f35('0x3')]('action');}},'action':{'type':Sequelize[_0x3f35('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3f35('0x5'),_0x3f35('0x6'),_0x3f35('0x7'),_0x3f35('0x8'),_0x3f35('0x9'),_0x3f35('0xa'),_0x3f35('0xb'),'script']],'msg':_0x3f35('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3f35('0x4')](0x1000),'comment':_0x3f35('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3f35('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3f35('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x3f35('0x10')},'data5':{'type':Sequelize[_0x3f35('0x4')](0x1000),'comments':_0x3f35('0x11')},'data6':{'type':Sequelize[_0x3f35('0x4')],'comments':_0x3f35('0x12')},'data7':{'type':Sequelize[_0x3f35('0x13')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x4dba=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','integration','motionbar','urlForward','browser','bot'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4dba,0x15f));var _0xa4db=function(_0x9c5aae,_0x29f57b){_0x9c5aae=_0x9c5aae-0x0;var _0x4fa511=_0x4dba[_0x9c5aae];return _0x4fa511;};'use strict';var Sequelize=require(_0xa4db('0x0'));module[_0xa4db('0x1')]={'name':{'type':Sequelize[_0xa4db('0x2')],'get':function(_0x5b2ed3){return this[_0xa4db('0x3')](_0xa4db('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xa4db('0x5'),_0xa4db('0x6'),'jscripty',_0xa4db('0x7'),_0xa4db('0x8'),_0xa4db('0x9'),'script']],'msg':_0xa4db('0xa')}},'comment':_0xa4db('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xa4db('0xb')},'data2':{'type':Sequelize[_0xa4db('0xc')](0x1000),'comment':_0xa4db('0xd')},'data3':{'type':Sequelize[_0xa4db('0xc')](0x1000),'comment':_0xa4db('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xa4db('0xf')},'data5':{'type':Sequelize[_0xa4db('0xc')](0x1000),'comments':_0xa4db('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0xa4db('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0xa4db('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b9dc45e..51174f3 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 _0x40a1=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x5a381c,_0x5b7cd9){var _0x4c219e=function(_0x11241d){while(--_0x11241d){_0x5a381c['push'](_0x5a381c['shift']());}};_0x4c219e(++_0x5b7cd9);}(_0x40a1,0x8a));var _0x140a=function(_0x203155,_0x3a1bbd){_0x203155=_0x203155-0x0;var _0x244039=_0x40a1[_0x203155];return _0x244039;};'use strict';var emlformat=require(_0x140a('0x0'));var rimraf=require(_0x140a('0x1'));var zipdir=require(_0x140a('0x2'));var jsonpatch=require(_0x140a('0x3'));var rp=require(_0x140a('0x4'));var moment=require(_0x140a('0x5'));var BPromise=require(_0x140a('0x6'));var Mustache=require(_0x140a('0x7'));var util=require('util');var path=require(_0x140a('0x8'));var sox=require(_0x140a('0x9'));var csv=require(_0x140a('0xa'));var ejs=require(_0x140a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x140a('0xc'));var squel=require(_0x140a('0xd'));var crypto=require(_0x140a('0xe'));var jsforce=require(_0x140a('0xf'));var deskjs=require(_0x140a('0x10'));var toCsv=require(_0x140a('0xa'));var querystring=require('querystring');var Papa=require(_0x140a('0x11'));var Redis=require(_0x140a('0x12'));var authService=require(_0x140a('0x13'));var qs=require(_0x140a('0x14'));var as=require(_0x140a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x140a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x140a('0x17'));var licenseUtil=require(_0x140a('0x18'));var db=require(_0x140a('0x19'))['db'];function respondWithStatusCode(_0xe38ab0,_0x1cf102){_0x1cf102=_0x1cf102||0xcc;return function(_0x5cd9f9){if(_0x5cd9f9){return _0xe38ab0[_0x140a('0x1a')](_0x1cf102);}return _0xe38ab0[_0x140a('0x1b')](_0x1cf102)['end']();};}function respondWithResult(_0x260235,_0x35bd94){_0x35bd94=_0x35bd94||0xc8;return function(_0x250e12){if(_0x250e12){return _0x260235[_0x140a('0x1b')](_0x35bd94)[_0x140a('0x1c')](_0x250e12);}};}function respondWithFilteredResult(_0x5f2c0f,_0x297fb8){return function(_0x21fb88){if(_0x21fb88){var _0x440276=typeof _0x297fb8[_0x140a('0x1d')]===_0x140a('0x1e')&&typeof _0x297fb8[_0x140a('0x1f')]===_0x140a('0x1e');var _0x5179e0=_0x21fb88['count'];var _0xcb7e19=_0x440276?0x0:_0x297fb8['offset'];var _0x18abd3=_0x440276?_0x21fb88[_0x140a('0x20')]:_0x297fb8[_0x140a('0x1d')]+_0x297fb8[_0x140a('0x1f')];var _0x5197e8;if(_0x18abd3>=_0x5179e0){_0x18abd3=_0x5179e0;_0x5197e8=0xc8;}else{_0x5197e8=0xce;}_0x5f2c0f[_0x140a('0x1b')](_0x5197e8);return _0x5f2c0f[_0x140a('0x21')](_0x140a('0x22'),_0xcb7e19+'-'+_0x18abd3+'/'+_0x5179e0)['json'](_0x21fb88);}return null;};}function patchUpdates(_0x317dbe){return function(_0x1367ff){try{jsonpatch[_0x140a('0x23')](_0x1367ff,_0x317dbe,!![]);}catch(_0x4253b8){return BPromise[_0x140a('0x24')](_0x4253b8);}return _0x1367ff[_0x140a('0x25')]();};}function saveUpdates(_0x102245,_0xbd192c){return function(_0x49bf3a){if(_0x49bf3a){return _0x49bf3a['update'](_0x102245)[_0x140a('0x26')](function(_0x9ff99f){return _0x9ff99f;});}return null;};}function removeEntity(_0x3eb869,_0x26c4e7){return function(_0x527766){if(_0x527766){return _0x527766['destroy']()[_0x140a('0x26')](function(){_0x3eb869[_0x140a('0x1b')](0xcc)[_0x140a('0x27')]();});}};}function handleEntityNotFound(_0x36b6af,_0x47e276){return function(_0x277963){if(!_0x277963){_0x36b6af[_0x140a('0x1a')](0x194);}return _0x277963;};}function handleError(_0x22d5d4,_0x1fe5a3){_0x1fe5a3=_0x1fe5a3||0x1f4;return function(_0x58a392){logger['error'](_0x58a392[_0x140a('0x28')]);if(_0x58a392['name']){delete _0x58a392[_0x140a('0x29')];}_0x22d5d4[_0x140a('0x1b')](_0x1fe5a3)[_0x140a('0x2a')](_0x58a392);};}exports[_0x140a('0x2b')]=function(_0xa75a9d,_0x3a8ccd){if(_0xa75a9d[_0x140a('0x2c')]['id']){delete _0xa75a9d[_0x140a('0x2c')]['id'];}return db[_0x140a('0x2d')][_0x140a('0x2e')]({'where':{'id':_0xa75a9d[_0x140a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3a8ccd,null))['then'](saveUpdates(_0xa75a9d['body'],null))['then'](respondWithResult(_0x3a8ccd,null))[_0x140a('0x30')](handleError(_0x3a8ccd,null));};exports['destroy']=function(_0x2038de,_0x2fe9de){return db[_0x140a('0x2d')]['find']({'where':{'id':_0x2038de[_0x140a('0x2f')]['id']}})[_0x140a('0x26')](handleEntityNotFound(_0x2fe9de,null))[_0x140a('0x26')](removeEntity(_0x2fe9de,null))[_0x140a('0x30')](handleError(_0x2fe9de,null));}; \ No newline at end of file +var _0x6aae=['../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','body','Action','params','catch','find','eml-format','rimraf','request-promise','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'];(function(_0x5e00dd,_0x468cfd){var _0x30998c=function(_0x5ec0b8){while(--_0x5ec0b8){_0x5e00dd['push'](_0x5e00dd['shift']());}};_0x30998c(++_0x468cfd);}(_0x6aae,0x139));var _0xe6aa=function(_0x298c5c,_0x24092f){_0x298c5c=_0x298c5c-0x0;var _0x1f0500=_0x6aae[_0x298c5c];return _0x1f0500;};'use strict';var emlformat=require(_0xe6aa('0x0'));var rimraf=require(_0xe6aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe6aa('0x2'));var moment=require(_0xe6aa('0x3'));var BPromise=require(_0xe6aa('0x4'));var Mustache=require(_0xe6aa('0x5'));var util=require(_0xe6aa('0x6'));var path=require(_0xe6aa('0x7'));var sox=require(_0xe6aa('0x8'));var csv=require(_0xe6aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6aa('0xa'));var squel=require(_0xe6aa('0xb'));var crypto=require(_0xe6aa('0xc'));var jsforce=require(_0xe6aa('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6aa('0xe'));var Papa=require(_0xe6aa('0xf'));var Redis=require(_0xe6aa('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe6aa('0x11'));var hardwareService=require(_0xe6aa('0x12'));var logger=require(_0xe6aa('0x13'))(_0xe6aa('0x14'));var utils=require(_0xe6aa('0x15'));var config=require(_0xe6aa('0x16'));var licenseUtil=require(_0xe6aa('0x17'));var db=require(_0xe6aa('0x18'))['db'];function respondWithStatusCode(_0x17dd81,_0x1b6b97){_0x1b6b97=_0x1b6b97||0xcc;return function(_0x84bcc6){if(_0x84bcc6){return _0x17dd81['sendStatus'](_0x1b6b97);}return _0x17dd81[_0xe6aa('0x19')](_0x1b6b97)['end']();};}function respondWithResult(_0x15c4ed,_0x46d592){_0x46d592=_0x46d592||0xc8;return function(_0x102e44){if(_0x102e44){return _0x15c4ed[_0xe6aa('0x19')](_0x46d592)[_0xe6aa('0x1a')](_0x102e44);}};}function respondWithFilteredResult(_0x1bc5e1,_0x1f8ff1){return function(_0x1f224e){if(_0x1f224e){var _0x5bd3db=typeof _0x1f8ff1['offset']===_0xe6aa('0x1b')&&typeof _0x1f8ff1[_0xe6aa('0x1c')]===_0xe6aa('0x1b');var _0x125f12=_0x1f224e[_0xe6aa('0x1d')];var _0x3a14a5=_0x5bd3db?0x0:_0x1f8ff1[_0xe6aa('0x1e')];var _0x31b6af=_0x5bd3db?_0x1f224e[_0xe6aa('0x1d')]:_0x1f8ff1[_0xe6aa('0x1e')]+_0x1f8ff1['limit'];var _0x50b25a;if(_0x31b6af>=_0x125f12){_0x31b6af=_0x125f12;_0x50b25a=0xc8;}else{_0x50b25a=0xce;}_0x1bc5e1[_0xe6aa('0x19')](_0x50b25a);return _0x1bc5e1[_0xe6aa('0x1f')]('Content-Range',_0x3a14a5+'-'+_0x31b6af+'/'+_0x125f12)[_0xe6aa('0x1a')](_0x1f224e);}return null;};}function patchUpdates(_0x4316e1){return function(_0x462693){try{jsonpatch[_0xe6aa('0x20')](_0x462693,_0x4316e1,!![]);}catch(_0x5e5ded){return BPromise[_0xe6aa('0x21')](_0x5e5ded);}return _0x462693[_0xe6aa('0x22')]();};}function saveUpdates(_0x22259e,_0x12a855){return function(_0x58390f){if(_0x58390f){return _0x58390f[_0xe6aa('0x23')](_0x22259e)['then'](function(_0x538db7){return _0x538db7;});}return null;};}function removeEntity(_0x152580,_0x5dd397){return function(_0x4be44){if(_0x4be44){return _0x4be44[_0xe6aa('0x24')]()[_0xe6aa('0x25')](function(){_0x152580[_0xe6aa('0x19')](0xcc)[_0xe6aa('0x26')]();});}};}function handleEntityNotFound(_0x31a1d8,_0xd35628){return function(_0x41e771){if(!_0x41e771){_0x31a1d8['sendStatus'](0x194);}return _0x41e771;};}function handleError(_0x57afb2,_0xfd43b0){_0xfd43b0=_0xfd43b0||0x1f4;return function(_0x301ac2){logger[_0xe6aa('0x27')](_0x301ac2[_0xe6aa('0x28')]);if(_0x301ac2[_0xe6aa('0x29')]){delete _0x301ac2[_0xe6aa('0x29')];}_0x57afb2[_0xe6aa('0x19')](_0xfd43b0)[_0xe6aa('0x2a')](_0x301ac2);};}exports[_0xe6aa('0x23')]=function(_0x3695b5,_0x38c092){if(_0x3695b5[_0xe6aa('0x2b')]['id']){delete _0x3695b5[_0xe6aa('0x2b')]['id'];}return db[_0xe6aa('0x2c')]['find']({'where':{'id':_0x3695b5[_0xe6aa('0x2d')]['id']}})[_0xe6aa('0x25')](handleEntityNotFound(_0x38c092,null))[_0xe6aa('0x25')](saveUpdates(_0x3695b5['body'],null))[_0xe6aa('0x25')](respondWithResult(_0x38c092,null))[_0xe6aa('0x2e')](handleError(_0x38c092,null));};exports[_0xe6aa('0x24')]=function(_0x36148e,_0x1b71c1){return db[_0xe6aa('0x2c')][_0xe6aa('0x2f')]({'where':{'id':_0x36148e[_0xe6aa('0x2d')]['id']}})[_0xe6aa('0x25')](handleEntityNotFound(_0x1b71c1,null))[_0xe6aa('0x25')](removeEntity(_0x1b71c1,null))[_0xe6aa('0x2e')](handleError(_0x1b71c1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7076ad9..136442e 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 _0xb071=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x420f5e,_0x1c2810){var _0x18d1c7=function(_0x17e73b){while(--_0x17e73b){_0x420f5e['push'](_0x420f5e['shift']());}};_0x18d1c7(++_0x1c2810);}(_0xb071,0xa3));var _0x1b07=function(_0x5bffd7,_0x1ac4f4){_0x5bffd7=_0x5bffd7-0x0;var _0x48e5dd=_0xb071[_0x5bffd7];return _0x48e5dd;};'use strict';var _=require('lodash');var util=require(_0x1b07('0x0'));var logger=require(_0x1b07('0x1'))(_0x1b07('0x2'));var moment=require(_0x1b07('0x3'));var BPromise=require(_0x1b07('0x4'));var rp=require(_0x1b07('0x5'));var fs=require('fs');var path=require(_0x1b07('0x6'));var rimraf=require(_0x1b07('0x7'));var config=require(_0x1b07('0x8'));var attributes=require(_0x1b07('0x9'));module[_0x1b07('0xa')]=function(_0x170a99,_0x3eac2d){return _0x170a99[_0x1b07('0xb')]('Action',attributes,{'tableName':_0x1b07('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x112a=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b54e2,_0x4a376f){var _0x56d58e=function(_0x32e629){while(--_0x32e629){_0x2b54e2['push'](_0x2b54e2['shift']());}};_0x56d58e(++_0x4a376f);}(_0x112a,0x115));var _0xa112=function(_0x565e2b,_0x399119){_0x565e2b=_0x565e2b-0x0;var _0x5b10e8=_0x112a[_0x565e2b];return _0x5b10e8;};'use strict';var _=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var logger=require(_0xa112('0x2'))(_0xa112('0x3'));var moment=require(_0xa112('0x4'));var BPromise=require(_0xa112('0x5'));var rp=require(_0xa112('0x6'));var fs=require('fs');var path=require(_0xa112('0x7'));var rimraf=require(_0xa112('0x8'));var config=require(_0xa112('0x9'));var attributes=require(_0xa112('0xa'));module[_0xa112('0xb')]=function(_0x41ca4c,_0x350cc4){return _0x41ca4c[_0xa112('0xc')](_0xa112('0xd'),attributes,{'tableName':_0xa112('0xe'),'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 d18b825..19f2eb3 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(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3a701d,_0x50f1bb){var _0x5ed6a9=function(_0x2efc79){while(--_0x2efc79){_0x3a701d['push'](_0x3a701d['shift']());}};_0x5ed6a9(++_0x50f1bb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index 08625c2..b9da893 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 _0x7cdf=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util'];(function(_0x29e61b,_0x357690){var _0x215f06=function(_0x5cec8b){while(--_0x5cec8b){_0x29e61b['push'](_0x29e61b['shift']());}};_0x215f06(++_0x357690);}(_0x7cdf,0x8e));var _0xf7cd=function(_0x3e7a25,_0x415cfd){_0x3e7a25=_0x3e7a25-0x0;var _0x58aa6b=_0x7cdf[_0x3e7a25];return _0x58aa6b;};'use strict';var multer=require(_0xf7cd('0x0'));var util=require(_0xf7cd('0x1'));var path=require(_0xf7cd('0x2'));var timeout=require(_0xf7cd('0x3'));var express=require(_0xf7cd('0x4'));var router=express[_0xf7cd('0x5')]();var fs_extra=require(_0xf7cd('0x6'));var auth=require(_0xf7cd('0x7'));var interaction=require(_0xf7cd('0x8'));var config=require(_0xf7cd('0x9'));var controller=require(_0xf7cd('0xa'));router[_0xf7cd('0xb')]('/:id',auth[_0xf7cd('0xc')](),controller[_0xf7cd('0xd')]);router[_0xf7cd('0xe')](_0xf7cd('0xf'),auth[_0xf7cd('0xc')](),controller[_0xf7cd('0x10')]);module[_0xf7cd('0x11')]=router; \ No newline at end of file +var _0xb85a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','update','delete','isAuthenticated','util','path'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xb85a,0xa3));var _0xab85=function(_0x2ba67d,_0x342b60){_0x2ba67d=_0x2ba67d-0x0;var _0x3b34d3=_0xb85a[_0x2ba67d];return _0x3b34d3;};'use strict';var multer=require('multer');var util=require(_0xab85('0x0'));var path=require(_0xab85('0x1'));var timeout=require('connect-timeout');var express=require(_0xab85('0x2'));var router=express[_0xab85('0x3')]();var fs_extra=require(_0xab85('0x4'));var auth=require(_0xab85('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xab85('0x6'));var controller=require('./action.controller');router['put'](_0xab85('0x7'),auth['isAuthenticated'](),controller[_0xab85('0x8')]);router[_0xab85('0x9')](_0xab85('0x7'),auth[_0xab85('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d1d1f1b..e87609c 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2a5595,_0x2601bd){_0x2a5595=_0x2a5595-0x0;var _0x4edd89=_0xb4c7[_0x2a5595];return _0x4edd89;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6d2a0b0..4ee2096 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 _0xdcde=['save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','findAll','params','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','options','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','parentKey','clone','web','fullPath','%s-%s.%s','randomstring','generate','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x183142,_0xa33f3f){var _0x4e0cfc=function(_0x27f92b){while(--_0x27f92b){_0x183142['push'](_0x183142['shift']());}};_0x4e0cfc(++_0xa33f3f);}(_0xdcde,0x1d0));var _0xedcd=function(_0x123a6a,_0x27ee43){_0x123a6a=_0x123a6a-0x0;var _0x611849=_0xdcde[_0x123a6a];return _0x611849;};'use strict';var emlformat=require(_0xedcd('0x0'));var rimraf=require(_0xedcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedcd('0x2'));var rp=require(_0xedcd('0x3'));var moment=require(_0xedcd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xedcd('0x5'));var sox=require(_0xedcd('0x6'));var csv=require(_0xedcd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedcd('0x8'));var _=require(_0xedcd('0x9'));var squel=require(_0xedcd('0xa'));var crypto=require(_0xedcd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xedcd('0xc'));var toCsv=require(_0xedcd('0x7'));var querystring=require(_0xedcd('0xd'));var Papa=require(_0xedcd('0xe'));var Redis=require(_0xedcd('0xf'));var authService=require(_0xedcd('0x10'));var qs=require(_0xedcd('0x11'));var as=require(_0xedcd('0x12'));var hardwareService=require(_0xedcd('0x13'));var logger=require(_0xedcd('0x14'))(_0xedcd('0x15'));var utils=require(_0xedcd('0x16'));var config=require(_0xedcd('0x17'));var licenseUtil=require(_0xedcd('0x18'));var db=require(_0xedcd('0x19'))['db'];var dbH=require(_0xedcd('0x19'))['dbH'];function respondWithStatusCode(_0x219b4a,_0x2f521a){_0x2f521a=_0x2f521a||0xcc;return function(_0x590620){if(_0x590620){return _0x219b4a[_0xedcd('0x1a')](_0x2f521a);}return _0x219b4a[_0xedcd('0x1b')](_0x2f521a)['end']();};}function respondWithResult(_0x4a9390,_0x3fb712){_0x3fb712=_0x3fb712||0xc8;return function(_0x599981){if(_0x599981){return _0x4a9390['status'](_0x3fb712)[_0xedcd('0x1c')](_0x599981);}};}function respondWithFilteredResult(_0x39a87a,_0x48a5f7){return function(_0x543628){if(_0x543628){var _0x981b01=typeof _0x48a5f7[_0xedcd('0x1d')]==='undefined'&&typeof _0x48a5f7[_0xedcd('0x1e')]===_0xedcd('0x1f');var _0x2e0095=_0x543628[_0xedcd('0x20')];var _0x4b7365=_0x981b01?0x0:_0x48a5f7['offset'];var _0x329f94=_0x981b01?_0x543628[_0xedcd('0x20')]:_0x48a5f7[_0xedcd('0x1d')]+_0x48a5f7[_0xedcd('0x1e')];var _0x5b33d8;if(_0x329f94>=_0x2e0095){_0x329f94=_0x2e0095;_0x5b33d8=0xc8;}else{_0x5b33d8=0xce;}_0x39a87a[_0xedcd('0x1b')](_0x5b33d8);return _0x39a87a[_0xedcd('0x21')](_0xedcd('0x22'),_0x4b7365+'-'+_0x329f94+'/'+_0x2e0095)['json'](_0x543628);}return null;};}function patchUpdates(_0x3e84d5){return function(_0x506c11){try{jsonpatch[_0xedcd('0x23')](_0x506c11,_0x3e84d5,!![]);}catch(_0x251b49){return BPromise[_0xedcd('0x24')](_0x251b49);}return _0x506c11[_0xedcd('0x25')]();};}function saveUpdates(_0x3267ba,_0x5aba2b){return function(_0x4e7360){if(_0x4e7360){return _0x4e7360[_0xedcd('0x26')](_0x3267ba)[_0xedcd('0x27')](function(_0x1b51d9){return _0x1b51d9;});}return null;};}function removeEntity(_0x4b3e3d,_0xd70440){return function(_0x516c49){if(_0x516c49){return _0x516c49[_0xedcd('0x28')]()[_0xedcd('0x27')](function(){var _0xa7558e=_0x516c49[_0xedcd('0x29')]({'plain':!![]});var _0xdbd925='CustomReports';return db[_0xedcd('0x2a')]['destroy']({'where':{'type':_0xdbd925,'resourceId':_0xa7558e['id']}})[_0xedcd('0x27')](function(){return _0x516c49;});})[_0xedcd('0x27')](function(){_0x4b3e3d[_0xedcd('0x1b')](0xcc)[_0xedcd('0x2b')]();});}};}function handleEntityNotFound(_0x379f6f,_0x202068){return function(_0x3e6aab){if(!_0x3e6aab){_0x379f6f[_0xedcd('0x1a')](0x194);}return _0x3e6aab;};}function handleError(_0x46110e,_0x359e1b){_0x359e1b=_0x359e1b||0x1f4;return function(_0x7d81f8){logger['error'](_0x7d81f8[_0xedcd('0x2c')]);if(_0x7d81f8[_0xedcd('0x2d')]){delete _0x7d81f8[_0xedcd('0x2d')];}_0x46110e['status'](_0x359e1b)[_0xedcd('0x2e')](_0x7d81f8);};}exports[_0xedcd('0x2f')]=function(_0x16554e,_0x5d93ad){var _0x39e327={},_0x4d86a3={},_0x4251fe={'count':0x0,'rows':[]};var _0xb2e186=_[_0xedcd('0x30')](db[_0xedcd('0x31')][_0xedcd('0x32')],function(_0x16c9c0){return{'name':_0x16c9c0['fieldName'],'type':_0x16c9c0[_0xedcd('0x33')][_0xedcd('0x34')]};});_0x4d86a3[_0xedcd('0x35')]=_[_0xedcd('0x30')](_0xb2e186,_0xedcd('0x2d'));_0x4d86a3['query']=_['keys'](_0x16554e[_0xedcd('0x36')]);_0x4d86a3[_0xedcd('0x37')]=_[_0xedcd('0x38')](_0x4d86a3[_0xedcd('0x35')],_0x4d86a3[_0xedcd('0x36')]);_0x39e327[_0xedcd('0x39')]=_[_0xedcd('0x38')](_0x4d86a3['model'],qs[_0xedcd('0x3a')](_0x16554e[_0xedcd('0x36')]['fields']));_0x39e327[_0xedcd('0x39')]=_0x39e327[_0xedcd('0x39')][_0xedcd('0x3b')]?_0x39e327[_0xedcd('0x39')]:_0x4d86a3[_0xedcd('0x35')];if(!_0x16554e[_0xedcd('0x36')][_0xedcd('0x3c')](_0xedcd('0x3d'))){_0x39e327['limit']=qs['limit'](_0x16554e[_0xedcd('0x36')][_0xedcd('0x1e')]);_0x39e327[_0xedcd('0x1d')]=qs['offset'](_0x16554e[_0xedcd('0x36')]['offset']);}_0x39e327[_0xedcd('0x3e')]=qs[_0xedcd('0x3f')](_0x16554e[_0xedcd('0x36')]['sort']);_0x39e327[_0xedcd('0x40')]=qs[_0xedcd('0x37')](_[_0xedcd('0x41')](_0x16554e[_0xedcd('0x36')],_0x4d86a3[_0xedcd('0x37')]),_0xb2e186);if(_0x16554e[_0xedcd('0x36')][_0xedcd('0x42')]){_0x39e327[_0xedcd('0x40')]=_['merge'](_0x39e327[_0xedcd('0x40')],{'$or':_[_0xedcd('0x30')](_0xb2e186,function(_0x32506c){if(_0x32506c['type']!=='VIRTUAL'){var _0x40a8bc={};_0x40a8bc[_0x32506c['name']]={'$like':'%'+_0x16554e[_0xedcd('0x36')][_0xedcd('0x42')]+'%'};return _0x40a8bc;}})});}_0x39e327=_['merge']({},_0x39e327,_0x16554e['options']);var _0x202258={'where':_0x39e327[_0xedcd('0x40')]};return db[_0xedcd('0x31')][_0xedcd('0x20')](_0x202258)[_0xedcd('0x27')](function(_0xf78174){_0x4251fe[_0xedcd('0x20')]=_0xf78174;if(_0x16554e[_0xedcd('0x36')]['includeAll']){_0x39e327[_0xedcd('0x43')]=[{'all':!![]}];}return db[_0xedcd('0x31')][_0xedcd('0x44')](_0x39e327);})[_0xedcd('0x27')](function(_0xfc44b1){_0x4251fe['rows']=_0xfc44b1;return _0x4251fe;})[_0xedcd('0x27')](respondWithFilteredResult(_0x5d93ad,_0x39e327))['catch'](handleError(_0x5d93ad,null));};exports['show']=function(_0x3dd8b3,_0x4a5aa7){var _0x580568={'raw':![],'where':{'id':_0x3dd8b3[_0xedcd('0x45')]['id']}},_0x5d4744={};_0x5d4744['model']=_['keys'](db[_0xedcd('0x31')][_0xedcd('0x32')]);_0x5d4744[_0xedcd('0x36')]=_['keys'](_0x3dd8b3[_0xedcd('0x36')]);_0x5d4744[_0xedcd('0x37')]=_[_0xedcd('0x38')](_0x5d4744[_0xedcd('0x35')],_0x5d4744['query']);_0x580568[_0xedcd('0x39')]=_[_0xedcd('0x38')](_0x5d4744['model'],qs[_0xedcd('0x3a')](_0x3dd8b3[_0xedcd('0x36')][_0xedcd('0x3a')]));_0x580568[_0xedcd('0x39')]=_0x580568[_0xedcd('0x39')][_0xedcd('0x3b')]?_0x580568[_0xedcd('0x39')]:_0x5d4744[_0xedcd('0x35')];if(_0x3dd8b3['query'][_0xedcd('0x46')]){_0x580568['include']=[{'all':!![]}];}_0x580568=_['merge']({},_0x580568,_0x3dd8b3['options']);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x580568)[_0xedcd('0x27')](handleEntityNotFound(_0x4a5aa7,null))[_0xedcd('0x27')](respondWithResult(_0x4a5aa7,null))[_0xedcd('0x48')](handleError(_0x4a5aa7,null));};exports[_0xedcd('0x49')]=function(_0x5755ed,_0x29647d){return db[_0xedcd('0x31')][_0xedcd('0x49')](_0x5755ed[_0xedcd('0x4a')],{})[_0xedcd('0x27')](function(_0x79890f){var _0x443e4e=_0x5755ed[_0xedcd('0x4b')][_0xedcd('0x29')]({'plain':!![]});if(!_0x443e4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x443e4e[_0xedcd('0x4c')]===_0xedcd('0x4b')){var _0xdc975a=_0x79890f[_0xedcd('0x29')]({'plain':!![]});var _0x1e67a0='Reports';return db[_0xedcd('0x4d')][_0xedcd('0x47')]({'where':{'name':_0x1e67a0,'userProfileId':_0x443e4e[_0xedcd('0x4e')]},'raw':!![]})['then'](function(_0x1072f6){if(_0x1072f6&&_0x1072f6[_0xedcd('0x4f')]===0x0){return db['UserProfileResource'][_0xedcd('0x49')]({'name':_0xdc975a['name'],'resourceId':_0xdc975a['id'],'type':_0xedcd('0x50'),'sectionId':_0x1072f6['id']},{})['then'](function(){return _0x79890f;});}else{return _0x79890f;}})['catch'](function(_0x307d8b){logger[_0xedcd('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x307d8b);throw _0x307d8b;});}return _0x79890f;})[_0xedcd('0x27')](respondWithResult(_0x29647d,0xc9))[_0xedcd('0x48')](handleError(_0x29647d,null));};exports[_0xedcd('0x26')]=function(_0x12dafb,_0x407dad){if(_0x12dafb[_0xedcd('0x4a')]['id']){delete _0x12dafb['body']['id'];}return db[_0xedcd('0x31')][_0xedcd('0x47')]({'where':{'id':_0x12dafb['params']['id']}})[_0xedcd('0x27')](handleEntityNotFound(_0x407dad,null))[_0xedcd('0x27')](saveUpdates(_0x12dafb['body'],null))[_0xedcd('0x27')](respondWithResult(_0x407dad,null))['catch'](handleError(_0x407dad,null));};exports[_0xedcd('0x28')]=function(_0x3551b9,_0x2ab786){return db[_0xedcd('0x31')][_0xedcd('0x47')]({'where':{'id':_0x3551b9['params']['id']}})[_0xedcd('0x27')](handleEntityNotFound(_0x2ab786,null))['then'](removeEntity(_0x2ab786,null))[_0xedcd('0x48')](handleError(_0x2ab786,null));};exports[_0xedcd('0x52')]=function(_0x5ca493,_0x2540a3){var _0x279185=0xa;var _0x2a3358=[_0xedcd('0x53'),_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x5af447={'SUM':_0xedcd('0x57'),'COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xedcd('0x5b')};var _0x2e02c7={'SEC_TO_TIME':_0xedcd('0x5c'),'DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':_0xedcd('0x60')};var _0x305e6f=function(_0x5e05f2){return!_[_0xedcd('0x61')]([_0xedcd('0x62'),_0xedcd('0x63'),_0xedcd('0x64'),_0xedcd('0x65')],_0x5e05f2);};var _0x4ee1be=function(_0x4ebb41){if(!_0x4ebb41||!_0x4ebb41[_0xedcd('0x66')]['length']){return'';}for(var _0x4d0305='(',_0x50ea42=0x0;_0x50ea42<_0x4ebb41['rules']['length'];_0x50ea42+=0x1){_0x50ea42>0x0&&(_0x4d0305+='\x20'+_0x4ebb41[_0xedcd('0x67')]+'\x20');_0x4d0305+=_0x4ebb41['rules'][_0x50ea42][_0xedcd('0x68')]?_0x4ee1be(_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x68')]):_0x4ebb41['rules'][_0x50ea42][_0xedcd('0x69')]+'\x20'+_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x6a')]+(_0x305e6f(_0x4ebb41[_0xedcd('0x66')][_0x50ea42]['condition'])?'\x20'+_0x4ebb41[_0xedcd('0x66')][_0x50ea42][_0xedcd('0x6b')]:'');}return _0x4d0305+')';};var _0x2ec2db={'where':{'id':_0x5ca493['params']['id']}},_0x177bbf,_0x274de0,_0x1a11d2,_0x52a901,_0x10b757;_0x2ec2db=_[_0xedcd('0x6c')]({},_0x2ec2db,_0x5ca493[_0xedcd('0x6d')]);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x2ec2db)['then'](function(_0x4eff26){if(_0x4eff26){_0x177bbf=_0x4eff26;return _0x4eff26['getFields']();}return null;})[_0xedcd('0x27')](function(_0x58fd12){if(_0x58fd12){if(!_0x58fd12[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))][(_0xedcd('0x6f'))](_0xedcd('0x70'),0x193);}_0x274de0=_0x58fd12;return db[_0xedcd('0x71')][_0xedcd('0x44')]({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0x1bff43){if(_0x1bff43){_0x1a11d2=_[_0xedcd('0x72')](_0x1bff43,'id');var _0x5de8fa;var _0x3bd228=squel[_0xedcd('0x73')]();_0x3bd228[_0xedcd('0x74')](_0x177bbf[_0xedcd('0x75')]);for(var _0xa51eca=0x0;_0xa51eca<_0x274de0[_0xedcd('0x3b')];_0xa51eca+=0x1){_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x76')]?_0x1a11d2[_0x274de0[_0xa51eca]['MetricId']]['metric']:_0x274de0[_0xa51eca][_0xedcd('0x69')];_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x5af447[_0x274de0[_0xa51eca][_0xedcd('0x77')]],'%s',_0x5de8fa):_0x5de8fa;_0x5de8fa=_0x274de0[_0xa51eca][_0xedcd('0x79')]?_[_0xedcd('0x78')](_0x2e02c7[_0x274de0[_0xa51eca][_0xedcd('0x79')]],'%s',_0x5de8fa):_0x5de8fa;if(_0x274de0[_0xa51eca][_0xedcd('0x7a')]){_0x3bd228[_0xedcd('0x68')](_0x5de8fa);}_0x274de0[_0xa51eca][_0xedcd('0x7b')]&&_0x3bd228[_0xedcd('0x3e')](_0x5de8fa,_0x274de0[_0xa51eca][_0xedcd('0x7b')]===_0xedcd('0x7c')?![]:!![]);_0x3bd228[_0xedcd('0x69')](_0x5de8fa,_0x274de0[_0xa51eca][_0xedcd('0x7d')]||_0x5de8fa);}if(_0x177bbf[_0xedcd('0x7e')]){_0x177bbf[_0xedcd('0x7e')]=JSON[_0xedcd('0x7f')](_0x177bbf[_0xedcd('0x7e')]);for(var _0x26239b=0x0;_0x26239b<_0x177bbf[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x26239b+=0x1){if(_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')]&&_[_0xedcd('0x61')](_0x2a3358,_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')])&&_0x177bbf['joins'][_0x26239b]['parentKey']&&_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')]&&_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x81')]){_0x3bd228[_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x33')]](_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x177bbf[_0xedcd('0x75')],_0x177bbf[_0xedcd('0x7e')][_0x26239b]['parentKey'],_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x80')],_0x177bbf[_0xedcd('0x7e')][_0x26239b][_0xedcd('0x81')]));}}}if(_0x177bbf[_0xedcd('0x83')]){_0x177bbf[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x177bbf['conditions']);_0x3bd228[_0xedcd('0x40')](_0x4ee1be(_0x177bbf[_0xedcd('0x83')][_0xedcd('0x68')]));}_0x10b757=_0x3bd228['clone']();_0x3bd228[_0xedcd('0x1e')](_0x279185);_0x3bd228[_0xedcd('0x1d')](0x0);logger[_0xedcd('0x84')](_0xedcd('0x85'),_0x3bd228[_0xedcd('0x86')]());return dbH[_0xedcd('0x87')][_0xedcd('0x36')](_0x3bd228['toString'](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')][_0xedcd('0x89')]});}})[_0xedcd('0x27')](respondWithResult(_0x2540a3,null))['catch'](handleError(_0x2540a3,null));};function runReport(_0x124a23,_0x249b9f,_0x8963ea){var _0x14113a=_0x249b9f['name'];var _0x5f4a84=0xa;var _0x441917=[_0xedcd('0x53'),_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x2dbdb4={'SUM':_0xedcd('0x57'),'COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':_0xedcd('0x8a'),'AVG':_0xedcd('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xedcd('0x8c'),'GROUP_CONCAT DESC':_0xedcd('0x5b')};var _0xa0034b={'SEC_TO_TIME':_0xedcd('0x5c'),'DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3fcc70=function(_0xcf840d){return!_['includes'](['IS\x20NULL',_0xedcd('0x63'),_0xedcd('0x64'),_0xedcd('0x65')],_0xcf840d);};var _0x50dcb5=function(_0x3425db){if(!_0x3425db||!_0x3425db[_0xedcd('0x66')][_0xedcd('0x3b')]){return'';}for(var _0x5aa4f1='(',_0x3c65f6=0x0;_0x3c65f6<_0x3425db[_0xedcd('0x66')][_0xedcd('0x3b')];_0x3c65f6+=0x1){_0x3c65f6>0x0&&(_0x5aa4f1+='\x20'+_0x3425db[_0xedcd('0x67')]+'\x20');_0x5aa4f1+=_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x68')]?_0x50dcb5(_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x68')]):_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x69')]+'\x20'+_0x3425db['rules'][_0x3c65f6][_0xedcd('0x6a')]+(_0x3fcc70(_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x6a')])?'\x20'+_0x3425db[_0xedcd('0x66')][_0x3c65f6][_0xedcd('0x6b')]:'');}return _0x5aa4f1+')';};var _0x5ab59a={'where':{'id':_0x124a23['id']}},_0x19185c,_0x42f1af,_0x147b86,_0x457e5a,_0x20f54c;_0x5ab59a=_[_0xedcd('0x6c')]({},_0x5ab59a,_0x8963ea);return db[_0xedcd('0x31')][_0xedcd('0x47')](_0x5ab59a)['then'](function(_0x3894a8){if(_0x3894a8){_0x19185c=_0x3894a8;return _0x3894a8[_0xedcd('0x8d')]();}return null;})[_0xedcd('0x27')](function(_0x3769cf){if(_0x3769cf){if(!_0x3769cf[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))]['ValidationErrorItem'](_0xedcd('0x70'),0x193);}_0x42f1af=_0x3769cf;return db[_0xedcd('0x71')][_0xedcd('0x44')]({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0x485513){if(_0x485513){_0x147b86=_['keyBy'](_0x485513,'id');var _0x53f476;var _0x6de9af=squel['select']();_0x6de9af[_0xedcd('0x74')](_0x19185c[_0xedcd('0x75')]);for(var _0x992ba3=0x0;_0x992ba3<_0x42f1af[_0xedcd('0x3b')];_0x992ba3+=0x1){_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x76')]?_0x147b86[_0x42f1af[_0x992ba3][_0xedcd('0x76')]]['metric']:_0x42f1af[_0x992ba3][_0xedcd('0x69')];_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x2dbdb4[_0x42f1af[_0x992ba3][_0xedcd('0x77')]],'%s',_0x53f476):_0x53f476;_0x53f476=_0x42f1af[_0x992ba3][_0xedcd('0x79')]?_['replace'](_0xa0034b[_0x42f1af[_0x992ba3]['format']],'%s',_0x53f476):_0x53f476;if(_0x42f1af[_0x992ba3][_0xedcd('0x7a')]){_0x6de9af[_0xedcd('0x68')](_0x53f476);}_0x42f1af[_0x992ba3][_0xedcd('0x7b')]&&_0x6de9af[_0xedcd('0x3e')](_0x53f476,_0x42f1af[_0x992ba3][_0xedcd('0x7b')]==='DESC'?![]:!![]);_0x6de9af[_0xedcd('0x69')](_0x53f476,_0x42f1af[_0x992ba3]['alias']||_0x53f476);}if(_0x19185c[_0xedcd('0x7e')]){_0x19185c[_0xedcd('0x7e')]=JSON[_0xedcd('0x7f')](_0x19185c[_0xedcd('0x7e')]);for(var _0x1cecaa=0x0;_0x1cecaa<_0x19185c[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x1cecaa+=0x1){if(_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x33')]&&_[_0xedcd('0x61')](_0x441917,_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x33')])&&_0x19185c[_0xedcd('0x7e')][_0x1cecaa]['parentKey']&&_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')]&&_0x19185c['joins'][_0x1cecaa][_0xedcd('0x81')]){_0x6de9af[_0x19185c['joins'][_0x1cecaa]['type']](_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x19185c[_0xedcd('0x75')],_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x8e')],_0x19185c[_0xedcd('0x7e')][_0x1cecaa][_0xedcd('0x80')],_0x19185c['joins'][_0x1cecaa][_0xedcd('0x81')]));}}}if(_0x19185c[_0xedcd('0x83')]){_0x19185c[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x19185c['conditions']);_0x6de9af['where'](_0x50dcb5(_0x19185c[_0xedcd('0x83')][_0xedcd('0x68')]));}_0x20f54c=_0x6de9af[_0xedcd('0x8f')]();_0x6de9af[_0xedcd('0x1e')](_0x5f4a84);_0x6de9af['offset'](0x0);return;}})['then'](function(){if(_0x249b9f['output']===_0xedcd('0x90')){return null;}var _0xdf23=_['merge'](_0x249b9f,{'name':_0x249b9f[_0xedcd('0x91')]||_0x249b9f[_0xedcd('0x2d')]||_0x19185c['name'],'basename':_0x14113a,'savename':util[_0xedcd('0x79')](_0xedcd('0x92'),_0x249b9f[_0xedcd('0x2d')]||_0x19185c[_0xedcd('0x2d')],require(_0xedcd('0x93'))[_0xedcd('0x94')](0x4),_0x249b9f[_0xedcd('0x95')]||'csv'),'reportId':_0x19185c['id'],'reportType':_0xedcd('0x96')});return db[_0xedcd('0x97')][_0xedcd('0x49')](_0xdf23,{'raw':!![]});})[_0xedcd('0x27')](function(_0x74ba12){if(_0x19185c[_0xedcd('0x75')]===_0xedcd('0x98')){_0x20f54c['where'](_0x19185c[_0xedcd('0x75')]+_0xedcd('0x99'),_0x249b9f[_0xedcd('0x9a')],_0x249b9f[_0xedcd('0x9b')]);}else{_0x20f54c[_0xedcd('0x40')](_0x19185c[_0xedcd('0x75')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x249b9f[_0xedcd('0x9a')],_0x249b9f[_0xedcd('0x9b')]);}if(_0x74ba12){logger[_0xedcd('0x9c')](_0xedcd('0x9d'),_0x20f54c[_0xedcd('0x86')]());require(_0xedcd('0x9e'))[_0xedcd('0x9f')](path[_0xedcd('0x53')](__dirname,'../../components/export/',_0x74ba12['output']),[_0x74ba12['id'],_0x20f54c[_0xedcd('0x86')](),path[_0xedcd('0x53')](__dirname,_0xedcd('0xa0'),_0x74ba12[_0xedcd('0xa1')]),_0x14113a]);return _0x74ba12;}else{var _0x11e3bc=squel[_0xedcd('0x73')]();_0x11e3bc[_0xedcd('0x74')]('('+_0x20f54c[_0xedcd('0x86')]()+')',_0xedcd('0xa2'));_0x11e3bc['field'](_0xedcd('0xa3'),_0xedcd('0x20'));_0x20f54c[_0xedcd('0x1e')](_0x249b9f['limit']||_0x5f4a84);_0x20f54c[_0xedcd('0x1d')](_0x249b9f[_0xedcd('0x1d')]||0x0);return dbH[_0xedcd('0x87')]['query'](_0x11e3bc['toString'](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')][_0xedcd('0x89')]})[_0xedcd('0x27')](function(_0x4e67ab){if(!_0x4e67ab[_0xedcd('0x3b')]){_0x457e5a=0x0;}else{_0x457e5a=_0x4e67ab[0x0]['count']||0x0;}return dbH[_0xedcd('0x87')][_0xedcd('0x36')](_0x20f54c[_0xedcd('0x86')](),{'type':dbH[_0xedcd('0x87')][_0xedcd('0x88')]['SELECT']});})[_0xedcd('0x27')](function(_0x3a9c48){return{'rows':_0x3a9c48||[],'count':_0x457e5a};});}});}exports[_0xedcd('0xa4')]=function(_0x15624b,_0x50d069){return runReport(_0x15624b['params'],_0x15624b['query'],_0x15624b['options'])[_0xedcd('0x27')](respondWithResult(_0x50d069,null))[_0xedcd('0x48')](handleError(_0x50d069,null));};exports[_0xedcd('0xa5')]=runReport;exports['query']=function(_0x272cc3,_0x482663){var _0x214efe=0xa;var _0x51a69a=['join',_0xedcd('0x54'),_0xedcd('0x55'),_0xedcd('0x56')];var _0x2ea0a2={'SUM':'SUM(%s)','COUNT':_0xedcd('0x58'),'COUNT DISTINCT':_0xedcd('0x59'),'MAX':_0xedcd('0x5a'),'MIN':_0xedcd('0x8a'),'AVG':_0xedcd('0x8b'),'GROUP_CONCAT':_0xedcd('0xa6'),'GROUP_CONCAT ASC':_0xedcd('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x8aaf73={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xedcd('0x5d'),'HOUR':_0xedcd('0x5e'),'ROUND':_0xedcd('0x5f'),'UNIX_TIMESTAMP':_0xedcd('0x60')};var _0x408f54=function(_0x150802){return!_[_0xedcd('0x61')]([_0xedcd('0x62'),'IS\x20NOT\x20NULL',_0xedcd('0x64'),_0xedcd('0x65')],_0x150802);};var _0x12355e=function(_0x1275bd){if(!_0x1275bd||!_0x1275bd[_0xedcd('0x66')][_0xedcd('0x3b')]){return'';}for(var _0x5ae020='(',_0x29a1a2=0x0;_0x29a1a2<_0x1275bd[_0xedcd('0x66')]['length'];_0x29a1a2+=0x1){_0x29a1a2>0x0&&(_0x5ae020+='\x20'+_0x1275bd[_0xedcd('0x67')]+'\x20');_0x5ae020+=_0x1275bd['rules'][_0x29a1a2][_0xedcd('0x68')]?_0x12355e(_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x68')]):_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x69')]+'\x20'+_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x6a')]+(_0x408f54(_0x1275bd[_0xedcd('0x66')][_0x29a1a2]['condition'])?'\x20'+_0x1275bd[_0xedcd('0x66')][_0x29a1a2][_0xedcd('0x6b')]:'');}return _0x5ae020+')';};var _0x358e11={'where':{'id':_0x272cc3[_0xedcd('0x45')]['id']}},_0x139fbf,_0x4c902e,_0x7019c5,_0x18df84,_0x2cc929;_0x358e11=_[_0xedcd('0x6c')]({},_0x358e11,_0x272cc3[_0xedcd('0x6d')]);return db[_0xedcd('0x31')]['find'](_0x358e11)['then'](function(_0x4c51fd){if(_0x4c51fd){_0x139fbf=_0x4c51fd;return _0x4c51fd[_0xedcd('0x8d')]();}return null;})[_0xedcd('0x27')](function(_0xca8b18){if(_0xca8b18){if(!_0xca8b18[_0xedcd('0x3b')]){throw new db[(_0xedcd('0x6e'))][(_0xedcd('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4c902e=_0xca8b18;return db[_0xedcd('0x71')]['findAll']({'raw':!![]});}return null;})[_0xedcd('0x27')](function(_0xac03f7){if(_0xac03f7){_0x7019c5=_['keyBy'](_0xac03f7,'id');var _0x31234f;var _0x1e4301=squel[_0xedcd('0x73')]();_0x1e4301[_0xedcd('0x74')](_0x139fbf['table']);for(var _0x2662b4=0x0;_0x2662b4<_0x4c902e[_0xedcd('0x3b')];_0x2662b4+=0x1){_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x76')]?_0x7019c5[_0x4c902e[_0x2662b4]['MetricId']]['metric']:_0x4c902e[_0x2662b4]['field'];_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x77')]?_[_0xedcd('0x78')](_0x2ea0a2[_0x4c902e[_0x2662b4][_0xedcd('0x77')]],'%s',_0x31234f):_0x31234f;_0x31234f=_0x4c902e[_0x2662b4][_0xedcd('0x79')]?_['replace'](_0x8aaf73[_0x4c902e[_0x2662b4][_0xedcd('0x79')]],'%s',_0x31234f):_0x31234f;if(_0x4c902e[_0x2662b4][_0xedcd('0x7a')]){_0x1e4301[_0xedcd('0x68')](_0x31234f);}_0x4c902e[_0x2662b4]['orderBy']&&_0x1e4301[_0xedcd('0x3e')](_0x31234f,_0x4c902e[_0x2662b4][_0xedcd('0x7b')]==='DESC'?![]:!![]);_0x1e4301[_0xedcd('0x69')](_0x31234f,_0x4c902e[_0x2662b4][_0xedcd('0x7d')]||_0x31234f);}if(_0x139fbf[_0xedcd('0x7e')]){_0x139fbf['joins']=JSON[_0xedcd('0x7f')](_0x139fbf[_0xedcd('0x7e')]);for(var _0x210532=0x0;_0x210532<_0x139fbf[_0xedcd('0x7e')][_0xedcd('0x3b')];_0x210532+=0x1){if(_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x33')]&&_['includes'](_0x51a69a,_0x139fbf['joins'][_0x210532]['type'])&&_0x139fbf['joins'][_0x210532][_0xedcd('0x8e')]&&_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')]&&_0x139fbf['joins'][_0x210532]['foreignKey']){_0x1e4301[_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x33')]](_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')],null,util[_0xedcd('0x79')](_0xedcd('0x82'),_0x139fbf[_0xedcd('0x75')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x8e')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x80')],_0x139fbf[_0xedcd('0x7e')][_0x210532][_0xedcd('0x81')]));}}}if(_0x139fbf[_0xedcd('0x83')]){_0x139fbf[_0xedcd('0x83')]=JSON[_0xedcd('0x7f')](_0x139fbf[_0xedcd('0x83')]);_0x1e4301['where'](_0x12355e(_0x139fbf['conditions'][_0xedcd('0x68')]));}_0x2cc929=_0x1e4301[_0xedcd('0x8f')]();_0x1e4301[_0xedcd('0x1e')](_0x214efe);_0x1e4301[_0xedcd('0x1d')](0x0);logger[_0xedcd('0x84')](_0xedcd('0x85'),_0x1e4301[_0xedcd('0x86')]());return dbH[_0xedcd('0x87')]['query'](_0x1e4301['toString'](),{'type':dbH[_0xedcd('0x87')]['QueryTypes']['SELECT']});}})[_0xedcd('0x27')](function(){return{'sql':_0x2cc929[_0xedcd('0x86')]()};})['then'](respondWithResult(_0x482663,null))[_0xedcd('0x48')](handleError(_0x482663,null));}; \ No newline at end of file +var _0x0c11=['SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','Sequelize','ValidationErrorItem','function','DESC','%s.%s\x20=\x20%s.%s','table','fullPath','%s-%s.%s','generate','output','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','AnalyticCustomReport','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','rows','show','params','includeAll','include','options','catch','create','body','user','get','role','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','replace','format','groupBy','orderBy','order','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','sequelize','QueryTypes','cross_join','MAX(%s)','GROUP_CONCAT(%s)'];(function(_0x43a61c,_0x366b11){var _0x3d42ad=function(_0x3aad3c){while(--_0x3aad3c){_0x43a61c['push'](_0x43a61c['shift']());}};_0x3d42ad(++_0x366b11);}(_0x0c11,0x179));var _0x10c1=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x0c11[_0xb725be];return _0x2f2424;};'use strict';var emlformat=require(_0x10c1('0x0'));var rimraf=require(_0x10c1('0x1'));var zipdir=require(_0x10c1('0x2'));var jsonpatch=require(_0x10c1('0x3'));var rp=require(_0x10c1('0x4'));var moment=require(_0x10c1('0x5'));var BPromise=require(_0x10c1('0x6'));var Mustache=require(_0x10c1('0x7'));var util=require(_0x10c1('0x8'));var path=require(_0x10c1('0x9'));var sox=require(_0x10c1('0xa'));var csv=require(_0x10c1('0xb'));var ejs=require(_0x10c1('0xc'));var fs=require('fs');var fs_extra=require(_0x10c1('0xd'));var _=require(_0x10c1('0xe'));var squel=require(_0x10c1('0xf'));var crypto=require(_0x10c1('0x10'));var jsforce=require(_0x10c1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x10c1('0xb'));var querystring=require(_0x10c1('0x12'));var Papa=require(_0x10c1('0x13'));var Redis=require(_0x10c1('0x14'));var authService=require(_0x10c1('0x15'));var qs=require(_0x10c1('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10c1('0x17'));var logger=require(_0x10c1('0x18'))(_0x10c1('0x19'));var utils=require(_0x10c1('0x1a'));var config=require(_0x10c1('0x1b'));var licenseUtil=require(_0x10c1('0x1c'));var db=require('../../mysqldb')['db'];var dbH=require(_0x10c1('0x1d'))[_0x10c1('0x1e')];function respondWithStatusCode(_0x4ec6e2,_0x3ff6ab){_0x3ff6ab=_0x3ff6ab||0xcc;return function(_0x2bf9d4){if(_0x2bf9d4){return _0x4ec6e2[_0x10c1('0x1f')](_0x3ff6ab);}return _0x4ec6e2[_0x10c1('0x20')](_0x3ff6ab)[_0x10c1('0x21')]();};}function respondWithResult(_0x1e8629,_0x23fe8c){_0x23fe8c=_0x23fe8c||0xc8;return function(_0x1db6f7){if(_0x1db6f7){return _0x1e8629[_0x10c1('0x20')](_0x23fe8c)[_0x10c1('0x22')](_0x1db6f7);}};}function respondWithFilteredResult(_0x5a8ef7,_0x1bee8d){return function(_0x2f346a){if(_0x2f346a){var _0xff1312=typeof _0x1bee8d[_0x10c1('0x23')]===_0x10c1('0x24')&&typeof _0x1bee8d[_0x10c1('0x25')]===_0x10c1('0x24');var _0x17a8ac=_0x2f346a[_0x10c1('0x26')];var _0x3e09a9=_0xff1312?0x0:_0x1bee8d[_0x10c1('0x23')];var _0x53c39d=_0xff1312?_0x2f346a[_0x10c1('0x26')]:_0x1bee8d[_0x10c1('0x23')]+_0x1bee8d[_0x10c1('0x25')];var _0x2cd2d3;if(_0x53c39d>=_0x17a8ac){_0x53c39d=_0x17a8ac;_0x2cd2d3=0xc8;}else{_0x2cd2d3=0xce;}_0x5a8ef7['status'](_0x2cd2d3);return _0x5a8ef7[_0x10c1('0x27')](_0x10c1('0x28'),_0x3e09a9+'-'+_0x53c39d+'/'+_0x17a8ac)[_0x10c1('0x22')](_0x2f346a);}return null;};}function patchUpdates(_0x31d130){return function(_0xed19d8){try{jsonpatch['apply'](_0xed19d8,_0x31d130,!![]);}catch(_0x9f4441){return BPromise[_0x10c1('0x29')](_0x9f4441);}return _0xed19d8[_0x10c1('0x2a')]();};}function saveUpdates(_0x51e2de,_0x33be3a){return function(_0x41bbe7){if(_0x41bbe7){return _0x41bbe7[_0x10c1('0x2b')](_0x51e2de)[_0x10c1('0x2c')](function(_0x386d07){return _0x386d07;});}return null;};}function removeEntity(_0x4bf67e,_0x1886b5){return function(_0xa0e422){if(_0xa0e422){return _0xa0e422['destroy']()['then'](function(){var _0x3aafec=_0xa0e422['get']({'plain':!![]});var _0x18c9f0='CustomReports';return db[_0x10c1('0x2d')][_0x10c1('0x2e')]({'where':{'type':_0x18c9f0,'resourceId':_0x3aafec['id']}})[_0x10c1('0x2c')](function(){return _0xa0e422;});})[_0x10c1('0x2c')](function(){_0x4bf67e[_0x10c1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bde8f,_0x3507e1){return function(_0x585ba6){if(!_0x585ba6){_0x2bde8f[_0x10c1('0x1f')](0x194);}return _0x585ba6;};}function handleError(_0x183274,_0x4a5c14){_0x4a5c14=_0x4a5c14||0x1f4;return function(_0x4baa65){logger[_0x10c1('0x2f')](_0x4baa65[_0x10c1('0x30')]);if(_0x4baa65['name']){delete _0x4baa65[_0x10c1('0x31')];}_0x183274['status'](_0x4a5c14)[_0x10c1('0x32')](_0x4baa65);};}exports[_0x10c1('0x33')]=function(_0x21d6ca,_0x23b25e){var _0x3b7d55={},_0x14780e={},_0x22dece={'count':0x0,'rows':[]};var _0x3218d1=_['map'](db[_0x10c1('0x34')]['rawAttributes'],function(_0x1c05f2){return{'name':_0x1c05f2[_0x10c1('0x35')],'type':_0x1c05f2[_0x10c1('0x36')]['key']};});_0x14780e[_0x10c1('0x37')]=_[_0x10c1('0x38')](_0x3218d1,_0x10c1('0x31'));_0x14780e[_0x10c1('0x39')]=_[_0x10c1('0x3a')](_0x21d6ca['query']);_0x14780e[_0x10c1('0x3b')]=_[_0x10c1('0x3c')](_0x14780e[_0x10c1('0x37')],_0x14780e[_0x10c1('0x39')]);_0x3b7d55['attributes']=_['intersection'](_0x14780e[_0x10c1('0x37')],qs[_0x10c1('0x3d')](_0x21d6ca[_0x10c1('0x39')]['fields']));_0x3b7d55[_0x10c1('0x3e')]=_0x3b7d55[_0x10c1('0x3e')][_0x10c1('0x3f')]?_0x3b7d55['attributes']:_0x14780e['model'];if(!_0x21d6ca[_0x10c1('0x39')][_0x10c1('0x40')](_0x10c1('0x41'))){_0x3b7d55[_0x10c1('0x25')]=qs[_0x10c1('0x25')](_0x21d6ca[_0x10c1('0x39')]['limit']);_0x3b7d55['offset']=qs['offset'](_0x21d6ca['query'][_0x10c1('0x23')]);}_0x3b7d55['order']=qs[_0x10c1('0x42')](_0x21d6ca[_0x10c1('0x39')][_0x10c1('0x42')]);_0x3b7d55[_0x10c1('0x43')]=qs[_0x10c1('0x3b')](_[_0x10c1('0x44')](_0x21d6ca[_0x10c1('0x39')],_0x14780e[_0x10c1('0x3b')]),_0x3218d1);if(_0x21d6ca[_0x10c1('0x39')][_0x10c1('0x45')]){_0x3b7d55[_0x10c1('0x43')]=_[_0x10c1('0x46')](_0x3b7d55[_0x10c1('0x43')],{'$or':_[_0x10c1('0x38')](_0x3218d1,function(_0x53076f){if(_0x53076f[_0x10c1('0x36')]!==_0x10c1('0x47')){var _0x442dc8={};_0x442dc8[_0x53076f[_0x10c1('0x31')]]={'$like':'%'+_0x21d6ca[_0x10c1('0x39')][_0x10c1('0x45')]+'%'};return _0x442dc8;}})});}_0x3b7d55=_['merge']({},_0x3b7d55,_0x21d6ca['options']);var _0x3614c6={'where':_0x3b7d55[_0x10c1('0x43')]};return db[_0x10c1('0x34')][_0x10c1('0x26')](_0x3614c6)[_0x10c1('0x2c')](function(_0x264915){_0x22dece[_0x10c1('0x26')]=_0x264915;if(_0x21d6ca[_0x10c1('0x39')]['includeAll']){_0x3b7d55['include']=[{'all':!![]}];}return db[_0x10c1('0x34')]['findAll'](_0x3b7d55);})[_0x10c1('0x2c')](function(_0x2127c2){_0x22dece[_0x10c1('0x48')]=_0x2127c2;return _0x22dece;})[_0x10c1('0x2c')](respondWithFilteredResult(_0x23b25e,_0x3b7d55))['catch'](handleError(_0x23b25e,null));};exports[_0x10c1('0x49')]=function(_0x4e7f82,_0x1afb68){var _0x77b84b={'raw':![],'where':{'id':_0x4e7f82[_0x10c1('0x4a')]['id']}},_0x3f0dab={};_0x3f0dab[_0x10c1('0x37')]=_[_0x10c1('0x3a')](db['AnalyticCustomReport']['rawAttributes']);_0x3f0dab[_0x10c1('0x39')]=_[_0x10c1('0x3a')](_0x4e7f82[_0x10c1('0x39')]);_0x3f0dab[_0x10c1('0x3b')]=_['intersection'](_0x3f0dab['model'],_0x3f0dab[_0x10c1('0x39')]);_0x77b84b['attributes']=_[_0x10c1('0x3c')](_0x3f0dab['model'],qs['fields'](_0x4e7f82['query'][_0x10c1('0x3d')]));_0x77b84b['attributes']=_0x77b84b['attributes'][_0x10c1('0x3f')]?_0x77b84b[_0x10c1('0x3e')]:_0x3f0dab[_0x10c1('0x37')];if(_0x4e7f82[_0x10c1('0x39')][_0x10c1('0x4b')]){_0x77b84b[_0x10c1('0x4c')]=[{'all':!![]}];}_0x77b84b=_[_0x10c1('0x46')]({},_0x77b84b,_0x4e7f82[_0x10c1('0x4d')]);return db[_0x10c1('0x34')]['find'](_0x77b84b)[_0x10c1('0x2c')](handleEntityNotFound(_0x1afb68,null))['then'](respondWithResult(_0x1afb68,null))[_0x10c1('0x4e')](handleError(_0x1afb68,null));};exports[_0x10c1('0x4f')]=function(_0x401576,_0x563837){return db[_0x10c1('0x34')][_0x10c1('0x4f')](_0x401576[_0x10c1('0x50')],{})[_0x10c1('0x2c')](function(_0x5ebff7){var _0x4790d5=_0x401576[_0x10c1('0x51')][_0x10c1('0x52')]({'plain':!![]});if(!_0x4790d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4790d5[_0x10c1('0x53')]===_0x10c1('0x51')){var _0x175523=_0x5ebff7[_0x10c1('0x52')]({'plain':!![]});var _0x261f41=_0x10c1('0x54');return db[_0x10c1('0x55')][_0x10c1('0x56')]({'where':{'name':_0x261f41,'userProfileId':_0x4790d5[_0x10c1('0x57')]},'raw':!![]})['then'](function(_0x3e7e4b){if(_0x3e7e4b&&_0x3e7e4b['autoAssociation']===0x0){return db[_0x10c1('0x2d')][_0x10c1('0x4f')]({'name':_0x175523[_0x10c1('0x31')],'resourceId':_0x175523['id'],'type':'CustomReports','sectionId':_0x3e7e4b['id']},{})[_0x10c1('0x2c')](function(){return _0x5ebff7;});}else{return _0x5ebff7;}})[_0x10c1('0x4e')](function(_0x12a28c){logger[_0x10c1('0x2f')](_0x10c1('0x58'),_0x12a28c);throw _0x12a28c;});}return _0x5ebff7;})['then'](respondWithResult(_0x563837,0xc9))[_0x10c1('0x4e')](handleError(_0x563837,null));};exports[_0x10c1('0x2b')]=function(_0x1aa137,_0x5d4761){if(_0x1aa137[_0x10c1('0x50')]['id']){delete _0x1aa137[_0x10c1('0x50')]['id'];}return db['AnalyticCustomReport'][_0x10c1('0x56')]({'where':{'id':_0x1aa137['params']['id']}})[_0x10c1('0x2c')](handleEntityNotFound(_0x5d4761,null))[_0x10c1('0x2c')](saveUpdates(_0x1aa137['body'],null))[_0x10c1('0x2c')](respondWithResult(_0x5d4761,null))['catch'](handleError(_0x5d4761,null));};exports['destroy']=function(_0x530f9a,_0x472623){return db['AnalyticCustomReport']['find']({'where':{'id':_0x530f9a['params']['id']}})[_0x10c1('0x2c')](handleEntityNotFound(_0x472623,null))[_0x10c1('0x2c')](removeEntity(_0x472623,null))[_0x10c1('0x4e')](handleError(_0x472623,null));};exports[_0x10c1('0x59')]=function(_0x5eb930,_0x452e0e){var _0x545a94=0xa;var _0x49e52c=[_0x10c1('0x5a'),_0x10c1('0x5b'),_0x10c1('0x5c'),'cross_join'];var _0x143e9c={'SUM':_0x10c1('0x5d'),'COUNT':_0x10c1('0x5e'),'COUNT DISTINCT':_0x10c1('0x5f'),'MAX':'MAX(%s)','MIN':_0x10c1('0x60'),'AVG':_0x10c1('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x10c1('0x62'),'GROUP_CONCAT DESC':_0x10c1('0x63')};var _0x3fe57b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x10c1('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x10c1('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x334eeb=function(_0x28cbd6){return!_[_0x10c1('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x10c1('0x67')],_0x28cbd6);};var _0x4dff1e=function(_0x358259){if(!_0x358259||!_0x358259[_0x10c1('0x68')][_0x10c1('0x3f')]){return'';}for(var _0x19a756='(',_0x42bb4c=0x0;_0x42bb4c<_0x358259[_0x10c1('0x68')][_0x10c1('0x3f')];_0x42bb4c+=0x1){_0x42bb4c>0x0&&(_0x19a756+='\x20'+_0x358259[_0x10c1('0x69')]+'\x20');_0x19a756+=_0x358259[_0x10c1('0x68')][_0x42bb4c][_0x10c1('0x6a')]?_0x4dff1e(_0x358259['rules'][_0x42bb4c][_0x10c1('0x6a')]):_0x358259[_0x10c1('0x68')][_0x42bb4c]['field']+'\x20'+_0x358259[_0x10c1('0x68')][_0x42bb4c][_0x10c1('0x6b')]+(_0x334eeb(_0x358259['rules'][_0x42bb4c][_0x10c1('0x6b')])?'\x20'+_0x358259['rules'][_0x42bb4c][_0x10c1('0x6c')]:'');}return _0x19a756+')';};var _0x34e789={'where':{'id':_0x5eb930[_0x10c1('0x4a')]['id']}},_0x237e5c,_0x2fe3a2,_0x3b3580,_0x3b97d7,_0x158838;_0x34e789=_[_0x10c1('0x46')]({},_0x34e789,_0x5eb930[_0x10c1('0x4d')]);return db[_0x10c1('0x34')][_0x10c1('0x56')](_0x34e789)[_0x10c1('0x2c')](function(_0x46a0e1){if(_0x46a0e1){_0x237e5c=_0x46a0e1;return _0x46a0e1[_0x10c1('0x6d')]();}return null;})[_0x10c1('0x2c')](function(_0xe2fd5e){if(_0xe2fd5e){if(!_0xe2fd5e[_0x10c1('0x3f')]){throw new db['Sequelize']['ValidationErrorItem'](_0x10c1('0x6e'),0x193);}_0x2fe3a2=_0xe2fd5e;return db[_0x10c1('0x6f')][_0x10c1('0x70')]({'raw':!![]});}return null;})[_0x10c1('0x2c')](function(_0x1178ec){if(_0x1178ec){_0x3b3580=_[_0x10c1('0x71')](_0x1178ec,'id');var _0x261827;var _0x1ae2ef=squel[_0x10c1('0x72')]();_0x1ae2ef[_0x10c1('0x73')](_0x237e5c['table']);for(var _0xbbc745=0x0;_0xbbc745<_0x2fe3a2[_0x10c1('0x3f')];_0xbbc745+=0x1){_0x261827=_0x2fe3a2[_0xbbc745][_0x10c1('0x74')]?_0x3b3580[_0x2fe3a2[_0xbbc745][_0x10c1('0x74')]][_0x10c1('0x75')]:_0x2fe3a2[_0xbbc745][_0x10c1('0x76')];_0x261827=_0x2fe3a2[_0xbbc745]['function']?_[_0x10c1('0x77')](_0x143e9c[_0x2fe3a2[_0xbbc745]['function']],'%s',_0x261827):_0x261827;_0x261827=_0x2fe3a2[_0xbbc745][_0x10c1('0x78')]?_[_0x10c1('0x77')](_0x3fe57b[_0x2fe3a2[_0xbbc745][_0x10c1('0x78')]],'%s',_0x261827):_0x261827;if(_0x2fe3a2[_0xbbc745][_0x10c1('0x79')]){_0x1ae2ef['group'](_0x261827);}_0x2fe3a2[_0xbbc745][_0x10c1('0x7a')]&&_0x1ae2ef[_0x10c1('0x7b')](_0x261827,_0x2fe3a2[_0xbbc745][_0x10c1('0x7a')]==='DESC'?![]:!![]);_0x1ae2ef[_0x10c1('0x76')](_0x261827,_0x2fe3a2[_0xbbc745]['alias']||_0x261827);}if(_0x237e5c[_0x10c1('0x7c')]){_0x237e5c['joins']=JSON[_0x10c1('0x7d')](_0x237e5c['joins']);for(var _0xa8b163=0x0;_0xa8b163<_0x237e5c[_0x10c1('0x7c')][_0x10c1('0x3f')];_0xa8b163+=0x1){if(_0x237e5c[_0x10c1('0x7c')][_0xa8b163][_0x10c1('0x36')]&&_[_0x10c1('0x66')](_0x49e52c,_0x237e5c['joins'][_0xa8b163][_0x10c1('0x36')])&&_0x237e5c[_0x10c1('0x7c')][_0xa8b163][_0x10c1('0x7e')]&&_0x237e5c['joins'][_0xa8b163]['foreignTable']&&_0x237e5c[_0x10c1('0x7c')][_0xa8b163][_0x10c1('0x7f')]){_0x1ae2ef[_0x237e5c[_0x10c1('0x7c')][_0xa8b163][_0x10c1('0x36')]](_0x237e5c['joins'][_0xa8b163]['foreignTable'],null,util[_0x10c1('0x78')]('%s.%s\x20=\x20%s.%s',_0x237e5c['table'],_0x237e5c['joins'][_0xa8b163]['parentKey'],_0x237e5c[_0x10c1('0x7c')][_0xa8b163][_0x10c1('0x80')],_0x237e5c[_0x10c1('0x7c')][_0xa8b163]['foreignKey']));}}}if(_0x237e5c[_0x10c1('0x81')]){_0x237e5c['conditions']=JSON[_0x10c1('0x7d')](_0x237e5c[_0x10c1('0x81')]);_0x1ae2ef['where'](_0x4dff1e(_0x237e5c[_0x10c1('0x81')][_0x10c1('0x6a')]));}_0x158838=_0x1ae2ef[_0x10c1('0x82')]();_0x1ae2ef[_0x10c1('0x25')](_0x545a94);_0x1ae2ef[_0x10c1('0x23')](0x0);logger['debug']('Limited\x20Query:',_0x1ae2ef['toString']());return dbH[_0x10c1('0x83')][_0x10c1('0x39')](_0x1ae2ef['toString'](),{'type':dbH['sequelize'][_0x10c1('0x84')]['SELECT']});}})[_0x10c1('0x2c')](respondWithResult(_0x452e0e,null))['catch'](handleError(_0x452e0e,null));};function runReport(_0x36feff,_0x2e8f21,_0x3b227a){var _0x281905=_0x2e8f21['name'];var _0x1b01c0=0xa;var _0x46a8c8=['join',_0x10c1('0x5b'),'right_join',_0x10c1('0x85')];var _0x1a56b1={'SUM':_0x10c1('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x10c1('0x86'),'MIN':_0x10c1('0x60'),'AVG':_0x10c1('0x61'),'GROUP_CONCAT':_0x10c1('0x87'),'GROUP_CONCAT ASC':_0x10c1('0x62'),'GROUP_CONCAT DESC':_0x10c1('0x63')};var _0x56324d={'SEC_TO_TIME':_0x10c1('0x88'),'DATE':_0x10c1('0x64'),'HOUR':_0x10c1('0x89'),'ROUND':_0x10c1('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2fc067=function(_0x2d8f03){return!_[_0x10c1('0x66')]([_0x10c1('0x8a'),'IS\x20NOT\x20NULL',_0x10c1('0x8b'),'IS\x20NOT\x20EMPTY'],_0x2d8f03);};var _0x1d02ec=function(_0x386225){if(!_0x386225||!_0x386225['rules'][_0x10c1('0x3f')]){return'';}for(var _0x519118='(',_0x43bd79=0x0;_0x43bd79<_0x386225[_0x10c1('0x68')]['length'];_0x43bd79+=0x1){_0x43bd79>0x0&&(_0x519118+='\x20'+_0x386225[_0x10c1('0x69')]+'\x20');_0x519118+=_0x386225[_0x10c1('0x68')][_0x43bd79][_0x10c1('0x6a')]?_0x1d02ec(_0x386225[_0x10c1('0x68')][_0x43bd79]['group']):_0x386225['rules'][_0x43bd79]['field']+'\x20'+_0x386225[_0x10c1('0x68')][_0x43bd79][_0x10c1('0x6b')]+(_0x2fc067(_0x386225[_0x10c1('0x68')][_0x43bd79]['condition'])?'\x20'+_0x386225[_0x10c1('0x68')][_0x43bd79][_0x10c1('0x6c')]:'');}return _0x519118+')';};var _0x28d2ef={'where':{'id':_0x36feff['id']}},_0x1b463c,_0x41c46c,_0x562b31,_0x3a4dae,_0x8b3846;_0x28d2ef=_[_0x10c1('0x46')]({},_0x28d2ef,_0x3b227a);return db[_0x10c1('0x34')][_0x10c1('0x56')](_0x28d2ef)[_0x10c1('0x2c')](function(_0x567734){if(_0x567734){_0x1b463c=_0x567734;return _0x567734['getFields']();}return null;})[_0x10c1('0x2c')](function(_0x140bdb){if(_0x140bdb){if(!_0x140bdb[_0x10c1('0x3f')]){throw new db[(_0x10c1('0x8c'))][(_0x10c1('0x8d'))](_0x10c1('0x6e'),0x193);}_0x41c46c=_0x140bdb;return db[_0x10c1('0x6f')][_0x10c1('0x70')]({'raw':!![]});}return null;})[_0x10c1('0x2c')](function(_0x18e47e){if(_0x18e47e){_0x562b31=_[_0x10c1('0x71')](_0x18e47e,'id');var _0x100eb8;var _0x20bfea=squel[_0x10c1('0x72')]();_0x20bfea[_0x10c1('0x73')](_0x1b463c['table']);for(var _0x307d3b=0x0;_0x307d3b<_0x41c46c[_0x10c1('0x3f')];_0x307d3b+=0x1){_0x100eb8=_0x41c46c[_0x307d3b][_0x10c1('0x74')]?_0x562b31[_0x41c46c[_0x307d3b][_0x10c1('0x74')]][_0x10c1('0x75')]:_0x41c46c[_0x307d3b][_0x10c1('0x76')];_0x100eb8=_0x41c46c[_0x307d3b]['function']?_[_0x10c1('0x77')](_0x1a56b1[_0x41c46c[_0x307d3b][_0x10c1('0x8e')]],'%s',_0x100eb8):_0x100eb8;_0x100eb8=_0x41c46c[_0x307d3b][_0x10c1('0x78')]?_[_0x10c1('0x77')](_0x56324d[_0x41c46c[_0x307d3b][_0x10c1('0x78')]],'%s',_0x100eb8):_0x100eb8;if(_0x41c46c[_0x307d3b][_0x10c1('0x79')]){_0x20bfea['group'](_0x100eb8);}_0x41c46c[_0x307d3b]['orderBy']&&_0x20bfea[_0x10c1('0x7b')](_0x100eb8,_0x41c46c[_0x307d3b][_0x10c1('0x7a')]===_0x10c1('0x8f')?![]:!![]);_0x20bfea['field'](_0x100eb8,_0x41c46c[_0x307d3b]['alias']||_0x100eb8);}if(_0x1b463c[_0x10c1('0x7c')]){_0x1b463c['joins']=JSON[_0x10c1('0x7d')](_0x1b463c['joins']);for(var _0x23b28e=0x0;_0x23b28e<_0x1b463c[_0x10c1('0x7c')][_0x10c1('0x3f')];_0x23b28e+=0x1){if(_0x1b463c[_0x10c1('0x7c')][_0x23b28e][_0x10c1('0x36')]&&_['includes'](_0x46a8c8,_0x1b463c['joins'][_0x23b28e][_0x10c1('0x36')])&&_0x1b463c[_0x10c1('0x7c')][_0x23b28e][_0x10c1('0x7e')]&&_0x1b463c[_0x10c1('0x7c')][_0x23b28e]['foreignTable']&&_0x1b463c[_0x10c1('0x7c')][_0x23b28e][_0x10c1('0x7f')]){_0x20bfea[_0x1b463c['joins'][_0x23b28e][_0x10c1('0x36')]](_0x1b463c['joins'][_0x23b28e]['foreignTable'],null,util[_0x10c1('0x78')](_0x10c1('0x90'),_0x1b463c[_0x10c1('0x91')],_0x1b463c[_0x10c1('0x7c')][_0x23b28e][_0x10c1('0x7e')],_0x1b463c[_0x10c1('0x7c')][_0x23b28e][_0x10c1('0x80')],_0x1b463c['joins'][_0x23b28e]['foreignKey']));}}}if(_0x1b463c[_0x10c1('0x81')]){_0x1b463c['conditions']=JSON[_0x10c1('0x7d')](_0x1b463c[_0x10c1('0x81')]);_0x20bfea['where'](_0x1d02ec(_0x1b463c['conditions']['group']));}_0x8b3846=_0x20bfea['clone']();_0x20bfea[_0x10c1('0x25')](_0x1b01c0);_0x20bfea[_0x10c1('0x23')](0x0);return;}})['then'](function(){if(_0x2e8f21['output']==='web'){return null;}var _0x28689f=_[_0x10c1('0x46')](_0x2e8f21,{'name':_0x2e8f21[_0x10c1('0x92')]||_0x2e8f21['name']||_0x1b463c[_0x10c1('0x31')],'basename':_0x281905,'savename':util[_0x10c1('0x78')](_0x10c1('0x93'),_0x2e8f21[_0x10c1('0x31')]||_0x1b463c[_0x10c1('0x31')],require('randomstring')[_0x10c1('0x94')](0x4),_0x2e8f21[_0x10c1('0x95')]||_0x10c1('0x96')),'reportId':_0x1b463c['id'],'reportType':_0x10c1('0x97')});return db['AnalyticExtractedReport'][_0x10c1('0x4f')](_0x28689f,{'raw':!![]});})['then'](function(_0x5dba2b){if(_0x1b463c[_0x10c1('0x91')]==='cdr'){_0x8b3846[_0x10c1('0x43')](_0x1b463c[_0x10c1('0x91')]+_0x10c1('0x98'),_0x2e8f21[_0x10c1('0x99')],_0x2e8f21[_0x10c1('0x9a')]);}else{_0x8b3846['where'](_0x1b463c[_0x10c1('0x91')]+_0x10c1('0x9b'),_0x2e8f21[_0x10c1('0x99')],_0x2e8f21[_0x10c1('0x9a')]);}if(_0x5dba2b){logger[_0x10c1('0x9c')](_0x10c1('0x9d'),_0x8b3846[_0x10c1('0x9e')]());require(_0x10c1('0x9f'))['fork'](path[_0x10c1('0x5a')](__dirname,_0x10c1('0xa0'),_0x5dba2b[_0x10c1('0x95')]),[_0x5dba2b['id'],_0x8b3846[_0x10c1('0x9e')](),path[_0x10c1('0x5a')](__dirname,_0x10c1('0xa1'),_0x5dba2b[_0x10c1('0xa2')]),_0x281905]);return _0x5dba2b;}else{var _0x4679e3=squel['select']();_0x4679e3[_0x10c1('0x73')]('('+_0x8b3846[_0x10c1('0x9e')]()+')','countTable');_0x4679e3['field'](_0x10c1('0xa3'),_0x10c1('0x26'));_0x8b3846[_0x10c1('0x25')](_0x2e8f21[_0x10c1('0x25')]||_0x1b01c0);_0x8b3846[_0x10c1('0x23')](_0x2e8f21[_0x10c1('0x23')]||0x0);return dbH[_0x10c1('0x83')]['query'](_0x4679e3['toString'](),{'type':dbH[_0x10c1('0x83')]['QueryTypes'][_0x10c1('0xa4')]})[_0x10c1('0x2c')](function(_0x14a3c9){if(!_0x14a3c9[_0x10c1('0x3f')]){_0x3a4dae=0x0;}else{_0x3a4dae=_0x14a3c9[0x0]['count']||0x0;}return dbH['sequelize'][_0x10c1('0x39')](_0x8b3846['toString'](),{'type':dbH[_0x10c1('0x83')][_0x10c1('0x84')][_0x10c1('0xa4')]});})[_0x10c1('0x2c')](function(_0x46c42e){return{'rows':_0x46c42e||[],'count':_0x3a4dae};});}});}exports[_0x10c1('0xa5')]=function(_0x1106e6,_0x562262){return runReport(_0x1106e6[_0x10c1('0x4a')],_0x1106e6[_0x10c1('0x39')],_0x1106e6[_0x10c1('0x4d')])['then'](respondWithResult(_0x562262,null))['catch'](handleError(_0x562262,null));};exports[_0x10c1('0xa6')]=runReport;exports[_0x10c1('0x39')]=function(_0x585d6f,_0x1977b1){var _0x6b1366=0xa;var _0x268f3d=['join',_0x10c1('0x5b'),'right_join','cross_join'];var _0x277ff0={'SUM':'SUM(%s)','COUNT':_0x10c1('0x5e'),'COUNT DISTINCT':_0x10c1('0x5f'),'MAX':_0x10c1('0x86'),'MIN':_0x10c1('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x10c1('0x87'),'GROUP_CONCAT ASC':_0x10c1('0x62'),'GROUP_CONCAT DESC':_0x10c1('0x63')};var _0x1939ea={'SEC_TO_TIME':_0x10c1('0x88'),'DATE':_0x10c1('0x64'),'HOUR':_0x10c1('0x89'),'ROUND':_0x10c1('0x65'),'UNIX_TIMESTAMP':_0x10c1('0xa7')};var _0x4051a0=function(_0x2757b0){return!_[_0x10c1('0x66')]([_0x10c1('0x8a'),_0x10c1('0xa8'),_0x10c1('0x8b'),_0x10c1('0x67')],_0x2757b0);};var _0x30abad=function(_0x186969){if(!_0x186969||!_0x186969['rules']['length']){return'';}for(var _0xaec656='(',_0x16bd93=0x0;_0x16bd93<_0x186969[_0x10c1('0x68')][_0x10c1('0x3f')];_0x16bd93+=0x1){_0x16bd93>0x0&&(_0xaec656+='\x20'+_0x186969['operator']+'\x20');_0xaec656+=_0x186969['rules'][_0x16bd93][_0x10c1('0x6a')]?_0x30abad(_0x186969[_0x10c1('0x68')][_0x16bd93]['group']):_0x186969[_0x10c1('0x68')][_0x16bd93][_0x10c1('0x76')]+'\x20'+_0x186969[_0x10c1('0x68')][_0x16bd93][_0x10c1('0x6b')]+(_0x4051a0(_0x186969[_0x10c1('0x68')][_0x16bd93][_0x10c1('0x6b')])?'\x20'+_0x186969[_0x10c1('0x68')][_0x16bd93][_0x10c1('0x6c')]:'');}return _0xaec656+')';};var _0x53c24b={'where':{'id':_0x585d6f[_0x10c1('0x4a')]['id']}},_0x2cef0b,_0x42649f,_0xccc50b,_0x5d309b,_0x56d795;_0x53c24b=_['merge']({},_0x53c24b,_0x585d6f[_0x10c1('0x4d')]);return db[_0x10c1('0x34')]['find'](_0x53c24b)[_0x10c1('0x2c')](function(_0x17a1ca){if(_0x17a1ca){_0x2cef0b=_0x17a1ca;return _0x17a1ca['getFields']();}return null;})[_0x10c1('0x2c')](function(_0x503eea){if(_0x503eea){if(!_0x503eea[_0x10c1('0x3f')]){throw new db['Sequelize'][(_0x10c1('0x8d'))](_0x10c1('0x6e'),0x193);}_0x42649f=_0x503eea;return db[_0x10c1('0x6f')][_0x10c1('0x70')]({'raw':!![]});}return null;})[_0x10c1('0x2c')](function(_0x1e4f8d){if(_0x1e4f8d){_0xccc50b=_['keyBy'](_0x1e4f8d,'id');var _0x463ad7;var _0x14a5a5=squel[_0x10c1('0x72')]();_0x14a5a5[_0x10c1('0x73')](_0x2cef0b[_0x10c1('0x91')]);for(var _0x2aeb53=0x0;_0x2aeb53<_0x42649f[_0x10c1('0x3f')];_0x2aeb53+=0x1){_0x463ad7=_0x42649f[_0x2aeb53][_0x10c1('0x74')]?_0xccc50b[_0x42649f[_0x2aeb53][_0x10c1('0x74')]][_0x10c1('0x75')]:_0x42649f[_0x2aeb53][_0x10c1('0x76')];_0x463ad7=_0x42649f[_0x2aeb53][_0x10c1('0x8e')]?_[_0x10c1('0x77')](_0x277ff0[_0x42649f[_0x2aeb53][_0x10c1('0x8e')]],'%s',_0x463ad7):_0x463ad7;_0x463ad7=_0x42649f[_0x2aeb53][_0x10c1('0x78')]?_['replace'](_0x1939ea[_0x42649f[_0x2aeb53][_0x10c1('0x78')]],'%s',_0x463ad7):_0x463ad7;if(_0x42649f[_0x2aeb53][_0x10c1('0x79')]){_0x14a5a5[_0x10c1('0x6a')](_0x463ad7);}_0x42649f[_0x2aeb53]['orderBy']&&_0x14a5a5[_0x10c1('0x7b')](_0x463ad7,_0x42649f[_0x2aeb53][_0x10c1('0x7a')]===_0x10c1('0x8f')?![]:!![]);_0x14a5a5['field'](_0x463ad7,_0x42649f[_0x2aeb53]['alias']||_0x463ad7);}if(_0x2cef0b[_0x10c1('0x7c')]){_0x2cef0b[_0x10c1('0x7c')]=JSON[_0x10c1('0x7d')](_0x2cef0b[_0x10c1('0x7c')]);for(var _0x4eb43d=0x0;_0x4eb43d<_0x2cef0b['joins']['length'];_0x4eb43d+=0x1){if(_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d]['type']&&_[_0x10c1('0x66')](_0x268f3d,_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x36')])&&_0x2cef0b['joins'][_0x4eb43d]['parentKey']&&_0x2cef0b['joins'][_0x4eb43d]['foreignTable']&&_0x2cef0b['joins'][_0x4eb43d][_0x10c1('0x7f')]){_0x14a5a5[_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x36')]](_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x80')],null,util['format'](_0x10c1('0x90'),_0x2cef0b[_0x10c1('0x91')],_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x7e')],_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x80')],_0x2cef0b[_0x10c1('0x7c')][_0x4eb43d][_0x10c1('0x7f')]));}}}if(_0x2cef0b[_0x10c1('0x81')]){_0x2cef0b[_0x10c1('0x81')]=JSON['parse'](_0x2cef0b[_0x10c1('0x81')]);_0x14a5a5['where'](_0x30abad(_0x2cef0b[_0x10c1('0x81')][_0x10c1('0x6a')]));}_0x56d795=_0x14a5a5[_0x10c1('0x82')]();_0x14a5a5[_0x10c1('0x25')](_0x6b1366);_0x14a5a5[_0x10c1('0x23')](0x0);logger[_0x10c1('0xa9')](_0x10c1('0xaa'),_0x14a5a5[_0x10c1('0x9e')]());return dbH[_0x10c1('0x83')]['query'](_0x14a5a5['toString'](),{'type':dbH[_0x10c1('0x83')][_0x10c1('0x84')][_0x10c1('0xa4')]});}})['then'](function(){return{'sql':_0x56d795[_0x10c1('0x9e')]()};})[_0x10c1('0x2c')](respondWithResult(_0x1977b1,null))[_0x10c1('0x4e')](handleError(_0x1977b1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e70371d..4c3ac90 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 _0xf506=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x64352c,_0x44d6df){var _0x4b1506=function(_0x4e0545){while(--_0x4e0545){_0x64352c['push'](_0x64352c['shift']());}};_0x4b1506(++_0x44d6df);}(_0xf506,0x188));var _0x6f50=function(_0x44a5ff,_0x4d4fd2){_0x44a5ff=_0x44a5ff-0x0;var _0x5d5a9c=_0xf506[_0x44a5ff];return _0x5d5a9c;};'use strict';var _=require('lodash');var util=require(_0x6f50('0x0'));var logger=require(_0x6f50('0x1'))(_0x6f50('0x2'));var moment=require(_0x6f50('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f50('0x4'));var fs=require('fs');var path=require(_0x6f50('0x5'));var rimraf=require(_0x6f50('0x6'));var config=require(_0x6f50('0x7'));var attributes=require(_0x6f50('0x8'));module[_0x6f50('0x9')]=function(_0x59a63f,_0x2bde31){return _0x59a63f[_0x6f50('0xa')](_0x6f50('0xb'),attributes,{'tableName':_0x6f50('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e37=['path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x122828,_0x2823a0){var _0x321e2d=function(_0x3bd793){while(--_0x3bd793){_0x122828['push'](_0x122828['shift']());}};_0x321e2d(++_0x2823a0);}(_0x2e37,0x133));var _0x72e3=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x2e37[_0x5ad220];return _0xdec77d;};'use strict';var _=require('lodash');var util=require(_0x72e3('0x0'));var logger=require(_0x72e3('0x1'))(_0x72e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x72e3('0x3'));var rimraf=require(_0x72e3('0x4'));var config=require('../../config/environment');var attributes=require(_0x72e3('0x5'));module[_0x72e3('0x6')]=function(_0x5d303f,_0x5ba9c5){return _0x5d303f[_0x72e3('0x7')](_0x72e3('0x8'),attributes,{'tableName':_0x72e3('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 01e0643..485b52a 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 _0x31cc=['request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5b7b78,_0x5b288c){var _0x193929=function(_0x1e31ec){while(--_0x1e31ec){_0x5b7b78['push'](_0x5b7b78['shift']());}};_0x193929(++_0x5b288c);}(_0x31cc,0x144));var _0xc31c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x31cc[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xc31c('0x0'));var moment=require(_0xc31c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc31c('0x2'));var fs=require('fs');var Redis=require(_0xc31c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc31c('0x4'))(_0xc31c('0x5'));var config=require(_0xc31c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc31c('0x7')][_0xc31c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x532837,_0x2e6254,_0x2193f8){return new BPromise(function(_0x22f1c5,_0x277db3){return client[_0xc31c('0x9')](_0x532837,_0x2193f8)[_0xc31c('0xa')](function(_0x12b321){logger[_0xc31c('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2e6254,_0xc31c('0xc'));logger[_0xc31c('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2e6254,_0xc31c('0xc'),JSON[_0xc31c('0xe')](_0x12b321));if(_0x12b321['error']){if(_0x12b321[_0xc31c('0xf')][_0xc31c('0x10')]===0x1f4){logger[_0xc31c('0xf')](_0xc31c('0x11'),_0x2e6254,_0x12b321['error']['message']);return _0x277db3(_0x12b321[_0xc31c('0xf')][_0xc31c('0x12')]);}logger[_0xc31c('0xf')](_0xc31c('0x11'),_0x2e6254,_0x12b321[_0xc31c('0xf')][_0xc31c('0x12')]);return _0x22f1c5(_0x12b321['error'][_0xc31c('0x12')]);}else{logger[_0xc31c('0xb')](_0xc31c('0x11'),_0x2e6254,_0xc31c('0xc'));_0x22f1c5(_0x12b321[_0xc31c('0x13')]['message']);}})[_0xc31c('0x14')](function(_0x4b14c0){logger[_0xc31c('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2e6254,_0x4b14c0);_0x277db3(_0x4b14c0);});});} \ No newline at end of file +var _0x4159=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','AnalyticCustomReport,\x20%s,\x20%s','error','message','result','util','moment','bluebird'];(function(_0x33954c,_0x23dd23){var _0x144cbb=function(_0x28f678){while(--_0x28f678){_0x33954c['push'](_0x33954c['shift']());}};_0x144cbb(++_0x23dd23);}(_0x4159,0x166));var _0x9415=function(_0x21dc45,_0x12c9b3){_0x21dc45=_0x21dc45-0x0;var _0xd88d5e=_0x4159[_0x21dc45];return _0xd88d5e;};'use strict';var _=require('lodash');var util=require(_0x9415('0x0'));var moment=require(_0x9415('0x1'));var BPromise=require(_0x9415('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9415('0x3'));var db=require(_0x9415('0x4'))['db'];var utils=require(_0x9415('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9415('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9415('0x7')][_0x9415('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf02002,_0x32e050,_0x49f6ed){return new BPromise(function(_0x701eb7,_0x2c4746){return client['request'](_0xf02002,_0x49f6ed)['then'](function(_0x5c5210){logger[_0x9415('0x9')]('AnalyticCustomReport,\x20%s,\x20%s',_0x32e050,_0x9415('0xa'));logger[_0x9415('0xb')](_0x9415('0xc'),_0x32e050,_0x9415('0xa'),JSON[_0x9415('0xd')](_0x5c5210));if(_0x5c5210['error']){if(_0x5c5210['error'][_0x9415('0xe')]===0x1f4){logger['error'](_0x9415('0xf'),_0x32e050,_0x5c5210[_0x9415('0x10')][_0x9415('0x11')]);return _0x2c4746(_0x5c5210[_0x9415('0x10')][_0x9415('0x11')]);}logger[_0x9415('0x10')](_0x9415('0xf'),_0x32e050,_0x5c5210[_0x9415('0x10')][_0x9415('0x11')]);return _0x701eb7(_0x5c5210[_0x9415('0x10')][_0x9415('0x11')]);}else{logger[_0x9415('0x9')](_0x9415('0xf'),_0x32e050,'request\x20sent');_0x701eb7(_0x5c5210[_0x9415('0x12')][_0x9415('0x11')]);}})['catch'](function(_0xaa49e8){logger[_0x9415('0x10')](_0x9415('0xf'),_0x32e050,_0xaa49e8);_0x2c4746(_0xaa49e8);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 51c9822..8ea604b 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 _0xa62d=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa62d,0x16b));var _0xda62=function(_0x258d7a,_0x2a8065){_0x258d7a=_0x258d7a-0x0;var _0x53511a=_0xa62d[_0x258d7a];return _0x53511a;};'use strict';var multer=require(_0xda62('0x0'));var util=require('util');var path=require(_0xda62('0x1'));var timeout=require(_0xda62('0x2'));var express=require('express');var router=express[_0xda62('0x3')]();var fs_extra=require(_0xda62('0x4'));var auth=require(_0xda62('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda62('0x6'));var controller=require(_0xda62('0x7'));router['get']('/',auth[_0xda62('0x8')](),controller[_0xda62('0x9')]);router[_0xda62('0xa')](_0xda62('0xb'),auth[_0xda62('0x8')](),controller[_0xda62('0xc')]);router[_0xda62('0xa')](_0xda62('0xd'),auth['isAuthenticated'](),controller[_0xda62('0xe')]);router[_0xda62('0xa')](_0xda62('0xf'),auth['isAuthenticated'](),controller[_0xda62('0x10')]);router[_0xda62('0xa')]('/:id/query',auth[_0xda62('0x8')](),controller[_0xda62('0x11')]);router[_0xda62('0x12')]('/',auth[_0xda62('0x8')](),controller[_0xda62('0x13')]);router['put'](_0xda62('0xb'),auth['isAuthenticated'](),controller[_0xda62('0x14')]);router[_0xda62('0x15')](_0xda62('0xb'),auth['isAuthenticated'](),controller[_0xda62('0x16')]);module[_0xda62('0x17')]=router; \ No newline at end of file +var _0x8e72=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x8e72,0xdd));var _0x28e7=function(_0x3b856e,_0x4b558a){_0x3b856e=_0x3b856e-0x0;var _0x63012d=_0x8e72[_0x3b856e];return _0x63012d;};'use strict';var multer=require(_0x28e7('0x0'));var util=require(_0x28e7('0x1'));var path=require(_0x28e7('0x2'));var timeout=require(_0x28e7('0x3'));var express=require(_0x28e7('0x4'));var router=express[_0x28e7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x28e7('0x6'));var config=require(_0x28e7('0x7'));var controller=require(_0x28e7('0x8'));router[_0x28e7('0x9')]('/',auth[_0x28e7('0xa')](),controller[_0x28e7('0xb')]);router[_0x28e7('0x9')](_0x28e7('0xc'),auth[_0x28e7('0xa')](),controller['show']);router['get'](_0x28e7('0xd'),auth['isAuthenticated'](),controller[_0x28e7('0xe')]);router['get'](_0x28e7('0xf'),auth[_0x28e7('0xa')](),controller[_0x28e7('0x10')]);router[_0x28e7('0x9')](_0x28e7('0x11'),auth[_0x28e7('0xa')](),controller['query']);router[_0x28e7('0x12')]('/',auth[_0x28e7('0xa')](),controller[_0x28e7('0x13')]);router['put'](_0x28e7('0xc'),auth[_0x28e7('0xa')](),controller[_0x28e7('0x14')]);router[_0x28e7('0x15')](_0x28e7('0xc'),auth[_0x28e7('0xa')](),controller[_0x28e7('0x16')]);module[_0x28e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 2e349d6..31148f8 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 _0xee14=['STRING','TEXT'];(function(_0x192a5a,_0x352d13){var _0x565bfa=function(_0x47d027){while(--_0x47d027){_0x192a5a['push'](_0x192a5a['shift']());}};_0x565bfa(++_0x352d13);}(_0xee14,0x13a));var _0x4ee1=function(_0x5718ff,_0x1e283e){_0x5718ff=_0x5718ff-0x0;var _0x3b492b=_0xee14[_0x5718ff];return _0x3b492b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file +var _0x7c09=['exports','STRING','TEXT'];(function(_0x5df8f2,_0x9b6c5d){var _0x5b05ee=function(_0x1565cf){while(--_0x1565cf){_0x5df8f2['push'](_0x5df8f2['shift']());}};_0x5b05ee(++_0x9b6c5d);}(_0x7c09,0x102));var _0x97c0=function(_0x10d806,_0x45c562){_0x10d806=_0x10d806-0x0;var _0x1d5e8d=_0x7c09[_0x10d806];return _0x1d5e8d;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5962330..66a1e87 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 _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','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)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x45b776,_0x4f8cea){var _0x4a87a7=function(_0x101d68){while(--_0x101d68){_0x45b776['push'](_0x45b776['shift']());}};_0x4a87a7(++_0x4f8cea);}(_0x1261,0x144));var _0x1126=function(_0x595b9b,_0xa58ff){_0x595b9b=_0x595b9b-0x0;var _0x3be4c6=_0x1261[_0x595b9b];return _0x3be4c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x4570a3,_0x4f8d6e){var _0x1ddbd3=function(_0xff53fd){while(--_0xff53fd){_0x4570a3['push'](_0x4570a3['shift']());}};_0x1ddbd3(++_0x4f8d6e);}(_0xba34,0x119));var _0x4ba3=function(_0x43eb62,_0xab8ed3){_0x43eb62=_0x43eb62-0x0;var _0x2830eb=_0xba34[_0x43eb62];return _0x2830eb;};'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'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 40d31a7..9534049 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 _0x5717=['exports','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x233c9c,_0x2cbce1){var _0x245a8a=function(_0x20df5d){while(--_0x20df5d){_0x233c9c['push'](_0x233c9c['shift']());}};_0x245a8a(++_0x2cbce1);}(_0x5717,0x160));var _0x7571=function(_0x4c0cec,_0x404e21){_0x4c0cec=_0x4c0cec-0x0;var _0x2b92bd=_0x5717[_0x4c0cec];return _0x2b92bd;};'use strict';var _=require(_0x7571('0x0'));var util=require(_0x7571('0x1'));var logger=require('../../config/logger')(_0x7571('0x2'));var moment=require(_0x7571('0x3'));var BPromise=require(_0x7571('0x4'));var rp=require(_0x7571('0x5'));var fs=require('fs');var path=require(_0x7571('0x6'));var rimraf=require(_0x7571('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x7571('0x8')]=function(_0x5dd980,_0x509e44){return _0x5dd980['define']('AnalyticDefaultReport',attributes,{'tableName':_0x7571('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3356=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x2b54bb,_0x36db1b){var _0x21b7e2=function(_0x3f3f87){while(--_0x3f3f87){_0x2b54bb['push'](_0x2b54bb['shift']());}};_0x21b7e2(++_0x36db1b);}(_0x3356,0x8c));var _0x6335=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3356[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6335('0x0'));var util=require(_0x6335('0x1'));var logger=require(_0x6335('0x2'))(_0x6335('0x3'));var moment=require('moment');var BPromise=require(_0x6335('0x4'));var rp=require(_0x6335('0x5'));var fs=require('fs');var path=require(_0x6335('0x6'));var rimraf=require(_0x6335('0x7'));var config=require(_0x6335('0x8'));var attributes=require(_0x6335('0x9'));module[_0x6335('0xa')]=function(_0xa6b48b,_0x55c014){return _0xa6b48b['define'](_0x6335('0xb'),attributes,{'tableName':_0x6335('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6707020..33ba60e 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 _0x06ac=['jayson/promise','client','http','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x3afe30,_0x12424d){var _0x43fcfd=function(_0x2605e5){while(--_0x2605e5){_0x3afe30['push'](_0x3afe30['shift']());}};_0x43fcfd(++_0x12424d);}(_0x06ac,0x145));var _0xc06a=function(_0x4ccbcb,_0x37136f){_0x4ccbcb=_0x4ccbcb-0x0;var _0x563fbc=_0x06ac[_0x4ccbcb];return _0x563fbc;};'use strict';var _=require(_0xc06a('0x0'));var util=require('util');var moment=require(_0xc06a('0x1'));var BPromise=require(_0xc06a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc06a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc06a('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc06a('0x5'));var client=jayson[_0xc06a('0x6')][_0xc06a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x184e6b,_0x2b6857,_0x1d8782){return new BPromise(function(_0x38e736,_0x49da0d){return client['request'](_0x184e6b,_0x1d8782)['then'](function(_0x238ee2){logger['info'](_0xc06a('0x8'),_0x2b6857,_0xc06a('0x9'));logger[_0xc06a('0xa')](_0xc06a('0xb'),_0x2b6857,_0xc06a('0x9'),JSON['stringify'](_0x238ee2));if(_0x238ee2[_0xc06a('0xc')]){if(_0x238ee2[_0xc06a('0xc')][_0xc06a('0xd')]===0x1f4){logger['error'](_0xc06a('0x8'),_0x2b6857,_0x238ee2['error'][_0xc06a('0xe')]);return _0x49da0d(_0x238ee2[_0xc06a('0xc')]['message']);}logger[_0xc06a('0xc')](_0xc06a('0x8'),_0x2b6857,_0x238ee2[_0xc06a('0xc')][_0xc06a('0xe')]);return _0x38e736(_0x238ee2[_0xc06a('0xc')][_0xc06a('0xe')]);}else{logger['info'](_0xc06a('0x8'),_0x2b6857,_0xc06a('0x9'));_0x38e736(_0x238ee2['result'][_0xc06a('0xe')]);}})['catch'](function(_0x1082b2){logger[_0xc06a('0xc')](_0xc06a('0x8'),_0x2b6857,_0x1082b2);_0x49da0d(_0x1082b2);});});} \ No newline at end of file +var _0xac16=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x354a96,_0x9a966e){var _0x3f2fa1=function(_0x5510db){while(--_0x5510db){_0x354a96['push'](_0x354a96['shift']());}};_0x3f2fa1(++_0x9a966e);}(_0xac16,0xc0));var _0x6ac1=function(_0x5c8a4d,_0x327b17){_0x5c8a4d=_0x5c8a4d-0x0;var _0x1f0d0a=_0xac16[_0x5c8a4d];return _0x1f0d0a;};'use strict';var _=require(_0x6ac1('0x0'));var util=require(_0x6ac1('0x1'));var moment=require(_0x6ac1('0x2'));var BPromise=require(_0x6ac1('0x3'));var rs=require(_0x6ac1('0x4'));var fs=require('fs');var Redis=require(_0x6ac1('0x5'));var db=require(_0x6ac1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6ac1('0x7'));var jayson=require(_0x6ac1('0x8'));var client=jayson[_0x6ac1('0x9')][_0x6ac1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26af4a,_0x34e7cb,_0x149cb0){return new BPromise(function(_0x18a19a,_0x1e965b){return client[_0x6ac1('0xb')](_0x26af4a,_0x149cb0)['then'](function(_0x5ca77a){logger[_0x6ac1('0xc')](_0x6ac1('0xd'),_0x34e7cb,_0x6ac1('0xe'));logger[_0x6ac1('0xf')](_0x6ac1('0x10'),_0x34e7cb,'request\x20sent',JSON[_0x6ac1('0x11')](_0x5ca77a));if(_0x5ca77a[_0x6ac1('0x12')]){if(_0x5ca77a[_0x6ac1('0x12')][_0x6ac1('0x13')]===0x1f4){logger[_0x6ac1('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x34e7cb,_0x5ca77a[_0x6ac1('0x12')][_0x6ac1('0x14')]);return _0x1e965b(_0x5ca77a[_0x6ac1('0x12')][_0x6ac1('0x14')]);}logger[_0x6ac1('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x34e7cb,_0x5ca77a[_0x6ac1('0x12')][_0x6ac1('0x14')]);return _0x18a19a(_0x5ca77a[_0x6ac1('0x12')][_0x6ac1('0x14')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x34e7cb,_0x6ac1('0xe'));_0x18a19a(_0x5ca77a[_0x6ac1('0x15')][_0x6ac1('0x14')]);}})[_0x6ac1('0x16')](function(_0x22d2dc){logger[_0x6ac1('0x12')](_0x6ac1('0xd'),_0x34e7cb,_0x22d2dc);_0x1e965b(_0x22d2dc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b5e694f..92ee90a 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 _0x885a=['query','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x3ba54c,_0x223514){var _0x16f32c=function(_0x35dc2d){while(--_0x35dc2d){_0x3ba54c['push'](_0x3ba54c['shift']());}};_0x16f32c(++_0x223514);}(_0x885a,0x1ce));var _0xa885=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x885a[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xa885('0x0'));var util=require(_0xa885('0x1'));var path=require(_0xa885('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa885('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa885('0x4'));var interaction=require(_0xa885('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xa885('0x6')]('/',auth[_0xa885('0x7')](),controller['index']);router[_0xa885('0x6')](_0xa885('0x8'),auth[_0xa885('0x7')](),controller[_0xa885('0x9')]);router[_0xa885('0x6')](_0xa885('0xa'),auth[_0xa885('0x7')](),controller[_0xa885('0xb')]);router[_0xa885('0x6')](_0xa885('0xc'),auth['isAuthenticated'](),controller['run']);router['get']('/:id/query',auth[_0xa885('0x7')](),controller[_0xa885('0xd')]);router[_0xa885('0xe')]('/',auth[_0xa885('0x7')](),controller[_0xa885('0xf')]);router[_0xa885('0x10')](_0xa885('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xa885('0x11')](_0xa885('0x8'),auth[_0xa885('0x7')](),controller[_0xa885('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9a37=['../../config/environment','get','index','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55f10e,_0x3f312f){var _0x13c376=function(_0x5bf5b9){while(--_0x5bf5b9){_0x55f10e['push'](_0x55f10e['shift']());}};_0x13c376(++_0x3f312f);}(_0x9a37,0x17d));var _0x79a3=function(_0xaa9204,_0x163a47){_0xaa9204=_0xaa9204-0x0;var _0x1e39f8=_0x9a37[_0xaa9204];return _0x1e39f8;};'use strict';var multer=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var path=require(_0x79a3('0x2'));var timeout=require(_0x79a3('0x3'));var express=require(_0x79a3('0x4'));var router=express[_0x79a3('0x5')]();var fs_extra=require(_0x79a3('0x6'));var auth=require(_0x79a3('0x7'));var interaction=require(_0x79a3('0x8'));var config=require(_0x79a3('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0x79a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x79a3('0xb')]);router[_0x79a3('0xa')]('/:id',auth[_0x79a3('0xc')](),controller[_0x79a3('0xd')]);router[_0x79a3('0xa')](_0x79a3('0xe'),auth[_0x79a3('0xc')](),controller[_0x79a3('0xf')]);router[_0x79a3('0xa')](_0x79a3('0x10'),auth['isAuthenticated'](),controller[_0x79a3('0x11')]);router[_0x79a3('0xa')](_0x79a3('0x12'),auth[_0x79a3('0xc')](),controller[_0x79a3('0x13')]);router[_0x79a3('0x14')]('/',auth[_0x79a3('0xc')](),controller['create']);router[_0x79a3('0x15')]('/:id',auth[_0x79a3('0xc')](),controller[_0x79a3('0x16')]);router['delete'](_0x79a3('0x17'),auth['isAuthenticated'](),controller[_0x79a3('0x18')]);module[_0x79a3('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 82f20ea..22c76e7 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 _0x8b47=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','DATE','Loading','manual','scheduled'];(function(_0x2a26b7,_0x3eb7f8){var _0x4caf66=function(_0xa0a378){while(--_0xa0a378){_0x2a26b7['push'](_0x2a26b7['shift']());}};_0x4caf66(++_0x3eb7f8);}(_0x8b47,0x1f0));var _0x78b4=function(_0x573a36,_0x64e44f){_0x573a36=_0x573a36-0x0;var _0xd92bbb=_0x8b47[_0x573a36];return _0xd92bbb;};'use strict';var Sequelize=require(_0x78b4('0x0'));var moment=require(_0x78b4('0x1'));module[_0x78b4('0x2')]={'name':{'type':Sequelize[_0x78b4('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x78b4('0x4')](_0x78b4('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x78b4('0x5')},'savename':{'type':Sequelize[_0x78b4('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x78b4('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x78b4('0x7')},'type':{'type':Sequelize[_0x78b4('0x4')](_0x78b4('0x8'),_0x78b4('0x9')),'allowNull':![],'defaultValue':_0x78b4('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x78b4('0xa')]},'reportType':{'type':Sequelize[_0x78b4('0x3')]}}; \ No newline at end of file +var _0x92a9=['sequelize','moment','exports','ENUM','csv','xlsx','STRING','DATE','manual','scheduled','INTEGER'];(function(_0x20e38f,_0x2cf551){var _0x475449=function(_0x1cbf8b){while(--_0x1cbf8b){_0x20e38f['push'](_0x20e38f['shift']());}};_0x475449(++_0x2cf551);}(_0x92a9,0x6e));var _0x992a=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x92a9[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x992a('0x0'));var moment=require(_0x992a('0x1'));module[_0x992a('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x992a('0x3')](_0x992a('0x4'),'pdf',_0x992a('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x992a('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0x992a('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x992a('0x6')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x992a('0x3')](_0x992a('0x8'),_0x992a('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x992a('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4d571f5..21859b7 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 _0x4793=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','apply','reject','save','update','then','destroy','get','ExtractedReports','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','server/files/reports','format','%s.%s','zip-dir','fast-json-patch'];(function(_0x17c9e6,_0x4179ab){var _0x46c273=function(_0x30c227){while(--_0x30c227){_0x17c9e6['push'](_0x17c9e6['shift']());}};_0x46c273(++_0x4179ab);}(_0x4793,0x17a));var _0x3479=function(_0x56fedd,_0x376499){_0x56fedd=_0x56fedd-0x0;var _0x426e8c=_0x4793[_0x56fedd];return _0x426e8c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3479('0x0'));var jsonpatch=require(_0x3479('0x1'));var rp=require(_0x3479('0x2'));var moment=require(_0x3479('0x3'));var BPromise=require(_0x3479('0x4'));var Mustache=require(_0x3479('0x5'));var util=require(_0x3479('0x6'));var path=require(_0x3479('0x7'));var sox=require(_0x3479('0x8'));var csv=require(_0x3479('0x9'));var ejs=require(_0x3479('0xa'));var fs=require('fs');var fs_extra=require(_0x3479('0xb'));var _=require(_0x3479('0xc'));var squel=require(_0x3479('0xd'));var crypto=require(_0x3479('0xe'));var jsforce=require(_0x3479('0xf'));var deskjs=require(_0x3479('0x10'));var toCsv=require(_0x3479('0x9'));var querystring=require(_0x3479('0x11'));var Papa=require(_0x3479('0x12'));var Redis=require(_0x3479('0x13'));var authService=require(_0x3479('0x14'));var qs=require(_0x3479('0x15'));var as=require(_0x3479('0x16'));var hardwareService=require(_0x3479('0x17'));var logger=require(_0x3479('0x18'))(_0x3479('0x19'));var utils=require(_0x3479('0x1a'));var config=require(_0x3479('0x1b'));var licenseUtil=require(_0x3479('0x1c'));var db=require(_0x3479('0x1d'))['db'];function respondWithStatusCode(_0x44504a,_0xff613){_0xff613=_0xff613||0xcc;return function(_0x12b054){if(_0x12b054){return _0x44504a[_0x3479('0x1e')](_0xff613);}return _0x44504a['status'](_0xff613)['end']();};}function respondWithResult(_0x161584,_0xdf9ee3){_0xdf9ee3=_0xdf9ee3||0xc8;return function(_0x443da9){if(_0x443da9){return _0x161584[_0x3479('0x1f')](_0xdf9ee3)[_0x3479('0x20')](_0x443da9);}};}function respondWithFilteredResult(_0x59351a,_0x31a59c){return function(_0x51df7d){if(_0x51df7d){var _0x48c3bc=typeof _0x31a59c[_0x3479('0x21')]===_0x3479('0x22')&&typeof _0x31a59c[_0x3479('0x23')]===_0x3479('0x22');var _0x4aeadc=_0x51df7d[_0x3479('0x24')];var _0x568477=_0x48c3bc?0x0:_0x31a59c['offset'];var _0x1532d2=_0x48c3bc?_0x51df7d['count']:_0x31a59c[_0x3479('0x21')]+_0x31a59c[_0x3479('0x23')];var _0x3b9c35;if(_0x1532d2>=_0x4aeadc){_0x1532d2=_0x4aeadc;_0x3b9c35=0xc8;}else{_0x3b9c35=0xce;}_0x59351a[_0x3479('0x1f')](_0x3b9c35);return _0x59351a[_0x3479('0x25')]('Content-Range',_0x568477+'-'+_0x1532d2+'/'+_0x4aeadc)[_0x3479('0x20')](_0x51df7d);}return null;};}function patchUpdates(_0x197e48){return function(_0x180b5a){try{jsonpatch[_0x3479('0x26')](_0x180b5a,_0x197e48,!![]);}catch(_0x3a3cdb){return BPromise[_0x3479('0x27')](_0x3a3cdb);}return _0x180b5a[_0x3479('0x28')]();};}function saveUpdates(_0x4fd7b7,_0x10c632){return function(_0x4adefa){if(_0x4adefa){return _0x4adefa[_0x3479('0x29')](_0x4fd7b7)[_0x3479('0x2a')](function(_0x20519a){return _0x20519a;});}return null;};}function removeEntity(_0x5938ca,_0x8513c8){return function(_0x4e48b0){if(_0x4e48b0){return _0x4e48b0[_0x3479('0x2b')]()['then'](function(){var _0x25a6cd=_0x4e48b0[_0x3479('0x2c')]({'plain':!![]});var _0x36c2d1=_0x3479('0x2d');return db['UserProfileResource'][_0x3479('0x2b')]({'where':{'type':_0x36c2d1,'resourceId':_0x25a6cd['id']}})[_0x3479('0x2a')](function(){return _0x4e48b0;});})[_0x3479('0x2a')](function(){_0x5938ca[_0x3479('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x862d02,_0x210e08){return function(_0x57126f){if(!_0x57126f){_0x862d02['sendStatus'](0x194);}return _0x57126f;};}function handleError(_0x68afdd,_0x4db3c5){_0x4db3c5=_0x4db3c5||0x1f4;return function(_0x2be817){logger[_0x3479('0x2e')](_0x2be817['stack']);if(_0x2be817['name']){delete _0x2be817[_0x3479('0x2f')];}_0x68afdd[_0x3479('0x1f')](_0x4db3c5)[_0x3479('0x30')](_0x2be817);};}exports[_0x3479('0x31')]=function(_0x2fa598,_0x1496ee){var _0x1d1bfa={},_0x464943={},_0x10b9dd={'count':0x0,'rows':[]};var _0x5f5864=_[_0x3479('0x32')](db[_0x3479('0x33')][_0x3479('0x34')],function(_0xd69cd3){return{'name':_0xd69cd3[_0x3479('0x35')],'type':_0xd69cd3[_0x3479('0x36')]['key']};});_0x464943[_0x3479('0x37')]=_[_0x3479('0x32')](_0x5f5864,_0x3479('0x2f'));_0x464943[_0x3479('0x38')]=_[_0x3479('0x39')](_0x2fa598[_0x3479('0x38')]);_0x464943[_0x3479('0x3a')]=_[_0x3479('0x3b')](_0x464943['model'],_0x464943[_0x3479('0x38')]);_0x1d1bfa[_0x3479('0x3c')]=_[_0x3479('0x3b')](_0x464943[_0x3479('0x37')],qs['fields'](_0x2fa598[_0x3479('0x38')][_0x3479('0x3d')]));_0x1d1bfa[_0x3479('0x3c')]=_0x1d1bfa[_0x3479('0x3c')]['length']?_0x1d1bfa['attributes']:_0x464943[_0x3479('0x37')];if(!_0x2fa598['query'][_0x3479('0x3e')]('nolimit')){_0x1d1bfa[_0x3479('0x23')]=qs['limit'](_0x2fa598['query'][_0x3479('0x23')]);_0x1d1bfa[_0x3479('0x21')]=qs[_0x3479('0x21')](_0x2fa598[_0x3479('0x38')][_0x3479('0x21')]);}_0x1d1bfa[_0x3479('0x3f')]=qs[_0x3479('0x40')](_0x2fa598['query']['sort']);_0x1d1bfa[_0x3479('0x41')]=qs[_0x3479('0x3a')](_[_0x3479('0x42')](_0x2fa598[_0x3479('0x38')],_0x464943[_0x3479('0x3a')]),_0x5f5864);if(_0x2fa598[_0x3479('0x38')][_0x3479('0x43')]){_0x1d1bfa[_0x3479('0x41')]=_[_0x3479('0x44')](_0x1d1bfa[_0x3479('0x41')],{'$or':_[_0x3479('0x32')](_0x5f5864,function(_0xec4c60){if(_0xec4c60['type']!=='VIRTUAL'){var _0x309b9e={};_0x309b9e[_0xec4c60['name']]={'$like':'%'+_0x2fa598[_0x3479('0x38')][_0x3479('0x43')]+'%'};return _0x309b9e;}})});}_0x1d1bfa=_[_0x3479('0x44')]({},_0x1d1bfa,_0x2fa598[_0x3479('0x45')]);var _0x1ab8a6={'where':_0x1d1bfa[_0x3479('0x41')]};return db[_0x3479('0x33')][_0x3479('0x24')](_0x1ab8a6)[_0x3479('0x2a')](function(_0x11154b){_0x10b9dd[_0x3479('0x24')]=_0x11154b;if(_0x2fa598[_0x3479('0x38')][_0x3479('0x46')]){_0x1d1bfa[_0x3479('0x47')]=[{'all':!![]}];}return db[_0x3479('0x33')]['findAll'](_0x1d1bfa);})[_0x3479('0x2a')](function(_0x4e5b2a){_0x10b9dd[_0x3479('0x48')]=_0x4e5b2a;return _0x10b9dd;})['then'](respondWithFilteredResult(_0x1496ee,_0x1d1bfa))[_0x3479('0x49')](handleError(_0x1496ee,null));};exports[_0x3479('0x4a')]=function(_0x51e13d,_0x2c4822){var _0x342dd0={'raw':!![],'where':{'id':_0x51e13d[_0x3479('0x4b')]['id']}},_0x1d5086={};_0x1d5086[_0x3479('0x37')]=_[_0x3479('0x39')](db[_0x3479('0x33')][_0x3479('0x34')]);_0x1d5086[_0x3479('0x38')]=_[_0x3479('0x39')](_0x51e13d[_0x3479('0x38')]);_0x1d5086['filters']=_[_0x3479('0x3b')](_0x1d5086[_0x3479('0x37')],_0x1d5086[_0x3479('0x38')]);_0x342dd0[_0x3479('0x3c')]=_[_0x3479('0x3b')](_0x1d5086[_0x3479('0x37')],qs[_0x3479('0x3d')](_0x51e13d[_0x3479('0x38')][_0x3479('0x3d')]));_0x342dd0['attributes']=_0x342dd0[_0x3479('0x3c')][_0x3479('0x4c')]?_0x342dd0['attributes']:_0x1d5086['model'];if(_0x51e13d[_0x3479('0x38')][_0x3479('0x46')]){_0x342dd0[_0x3479('0x47')]=[{'all':!![]}];}_0x342dd0=_[_0x3479('0x44')]({},_0x342dd0,_0x51e13d[_0x3479('0x45')]);return db['AnalyticExtractedReport'][_0x3479('0x4d')](_0x342dd0)['then'](handleEntityNotFound(_0x2c4822,null))['then'](respondWithResult(_0x2c4822,null))[_0x3479('0x49')](handleError(_0x2c4822,null));};exports[_0x3479('0x4e')]=function(_0x27a268,_0x347a05){return db['AnalyticExtractedReport'][_0x3479('0x4e')](_0x27a268[_0x3479('0x4f')],{})[_0x3479('0x2a')](function(_0x55c689){var _0x5a2f5a=_0x27a268[_0x3479('0x50')]['get']({'plain':!![]});if(!_0x5a2f5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2f5a[_0x3479('0x51')]===_0x3479('0x50')){var _0x3cc1b0=_0x55c689[_0x3479('0x2c')]({'plain':!![]});var _0x13530e=_0x3479('0x2d');return db[_0x3479('0x52')][_0x3479('0x4d')]({'where':{'name':_0x13530e,'userProfileId':_0x5a2f5a[_0x3479('0x53')]},'raw':!![]})['then'](function(_0x5c3046){if(_0x5c3046&&_0x5c3046[_0x3479('0x54')]===0x0){return db['UserProfileResource'][_0x3479('0x4e')]({'name':_0x3cc1b0[_0x3479('0x2f')],'resourceId':_0x3cc1b0['id'],'type':_0x5c3046['name'],'sectionId':_0x5c3046['id']},{})['then'](function(){return _0x55c689;});}else{return _0x55c689;}})[_0x3479('0x49')](function(_0x100cc6){logger['error'](_0x3479('0x55'),_0x100cc6);throw _0x100cc6;});}return _0x55c689;})[_0x3479('0x2a')](respondWithResult(_0x347a05,0xc9))['catch'](handleError(_0x347a05,null));};exports[_0x3479('0x29')]=function(_0x4a10c0,_0x4c0852){if(_0x4a10c0[_0x3479('0x4f')]['id']){delete _0x4a10c0[_0x3479('0x4f')]['id'];}return db[_0x3479('0x33')][_0x3479('0x4d')]({'where':{'id':_0x4a10c0[_0x3479('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c0852,null))[_0x3479('0x2a')](saveUpdates(_0x4a10c0[_0x3479('0x4f')],null))[_0x3479('0x2a')](respondWithResult(_0x4c0852,null))[_0x3479('0x49')](handleError(_0x4c0852,null));};exports[_0x3479('0x2b')]=function(_0x3ad455,_0xeb33bb){return db[_0x3479('0x33')][_0x3479('0x4d')]({'where':{'id':_0x3ad455[_0x3479('0x4b')]['id']}})['then'](handleEntityNotFound(_0xeb33bb,null))[_0x3479('0x2a')](removeEntity(_0xeb33bb,null))['catch'](handleError(_0xeb33bb,null));};exports['download']=function(_0x9bfad3,_0x213871,_0x39354a){return db[_0x3479('0x33')][_0x3479('0x4d')]({'where':{'id':_0x9bfad3[_0x3479('0x4b')]['id']},'attributes':[_0x3479('0x2f'),_0x3479('0x56'),_0x3479('0x57'),_0x3479('0x58')],'raw':!![]})[_0x3479('0x2a')](handleEntityNotFound(_0x213871,null))[_0x3479('0x2a')](function(_0x2ed782){if(_0x2ed782){if(!fs[_0x3479('0x59')](path[_0x3479('0x5a')](config[_0x3479('0x5b')],_0x3479('0x5c'),_0x2ed782[_0x3479('0x57')]))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x9bfad3[_0x3479('0x38')]['exists']){return _0x213871['sendStatus'](0xc8);}return _0x213871['download'](path[_0x3479('0x5a')](config[_0x3479('0x5b')],_0x3479('0x5c'),_0x2ed782[_0x3479('0x57')]),util[_0x3479('0x5d')](_0x3479('0x5e'),_0x2ed782[_0x3479('0x56')]||_0x2ed782[_0x3479('0x2f')],_0x2ed782[_0x3479('0x58')]['toLowerCase']()));}})[_0x3479('0x49')](handleError(_0x213871,null));}; \ No newline at end of file +var _0xd31e=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','body','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','exists','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd31e,0x194));var _0xed31=function(_0x3ccd91,_0x2cb22f){_0x3ccd91=_0x3ccd91-0x0;var _0x2caca1=_0xd31e[_0x3ccd91];return _0x2caca1;};'use strict';var emlformat=require(_0xed31('0x0'));var rimraf=require(_0xed31('0x1'));var zipdir=require(_0xed31('0x2'));var jsonpatch=require(_0xed31('0x3'));var rp=require(_0xed31('0x4'));var moment=require('moment');var BPromise=require(_0xed31('0x5'));var Mustache=require(_0xed31('0x6'));var util=require(_0xed31('0x7'));var path=require(_0xed31('0x8'));var sox=require(_0xed31('0x9'));var csv=require(_0xed31('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed31('0xb'));var _=require(_0xed31('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed31('0xd'));var toCsv=require('to-csv');var querystring=require(_0xed31('0xe'));var Papa=require(_0xed31('0xf'));var Redis=require(_0xed31('0x10'));var authService=require(_0xed31('0x11'));var qs=require(_0xed31('0x12'));var as=require(_0xed31('0x13'));var hardwareService=require(_0xed31('0x14'));var logger=require('../../config/logger')(_0xed31('0x15'));var utils=require(_0xed31('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xed31('0x17'));var db=require(_0xed31('0x18'))['db'];function respondWithStatusCode(_0x2e0880,_0x3c19da){_0x3c19da=_0x3c19da||0xcc;return function(_0x20c2e9){if(_0x20c2e9){return _0x2e0880[_0xed31('0x19')](_0x3c19da);}return _0x2e0880[_0xed31('0x1a')](_0x3c19da)[_0xed31('0x1b')]();};}function respondWithResult(_0x5aa62f,_0x433e4e){_0x433e4e=_0x433e4e||0xc8;return function(_0x5bfeed){if(_0x5bfeed){return _0x5aa62f[_0xed31('0x1a')](_0x433e4e)[_0xed31('0x1c')](_0x5bfeed);}};}function respondWithFilteredResult(_0x256ba1,_0x874825){return function(_0x281775){if(_0x281775){var _0x5d0e16=typeof _0x874825[_0xed31('0x1d')]===_0xed31('0x1e')&&typeof _0x874825[_0xed31('0x1f')]===_0xed31('0x1e');var _0x2fbce7=_0x281775[_0xed31('0x20')];var _0x44a240=_0x5d0e16?0x0:_0x874825[_0xed31('0x1d')];var _0x3a5c75=_0x5d0e16?_0x281775[_0xed31('0x20')]:_0x874825[_0xed31('0x1d')]+_0x874825[_0xed31('0x1f')];var _0x4dfd8c;if(_0x3a5c75>=_0x2fbce7){_0x3a5c75=_0x2fbce7;_0x4dfd8c=0xc8;}else{_0x4dfd8c=0xce;}_0x256ba1[_0xed31('0x1a')](_0x4dfd8c);return _0x256ba1[_0xed31('0x21')](_0xed31('0x22'),_0x44a240+'-'+_0x3a5c75+'/'+_0x2fbce7)[_0xed31('0x1c')](_0x281775);}return null;};}function patchUpdates(_0x189d5a){return function(_0x400b54){try{jsonpatch[_0xed31('0x23')](_0x400b54,_0x189d5a,!![]);}catch(_0x1ad12a){return BPromise[_0xed31('0x24')](_0x1ad12a);}return _0x400b54[_0xed31('0x25')]();};}function saveUpdates(_0x33659f,_0x4edada){return function(_0x12acf4){if(_0x12acf4){return _0x12acf4[_0xed31('0x26')](_0x33659f)[_0xed31('0x27')](function(_0x526544){return _0x526544;});}return null;};}function removeEntity(_0x16014a,_0x422a8e){return function(_0x37b0ea){if(_0x37b0ea){return _0x37b0ea[_0xed31('0x28')]()[_0xed31('0x27')](function(){var _0x479aa1=_0x37b0ea[_0xed31('0x29')]({'plain':!![]});var _0x3e35a2=_0xed31('0x2a');return db[_0xed31('0x2b')][_0xed31('0x28')]({'where':{'type':_0x3e35a2,'resourceId':_0x479aa1['id']}})[_0xed31('0x27')](function(){return _0x37b0ea;});})[_0xed31('0x27')](function(){_0x16014a[_0xed31('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d460c,_0xe29d72){return function(_0x53fb95){if(!_0x53fb95){_0x4d460c[_0xed31('0x19')](0x194);}return _0x53fb95;};}function handleError(_0x17c3f4,_0x34d667){_0x34d667=_0x34d667||0x1f4;return function(_0x459c46){logger['error'](_0x459c46[_0xed31('0x2c')]);if(_0x459c46[_0xed31('0x2d')]){delete _0x459c46[_0xed31('0x2d')];}_0x17c3f4[_0xed31('0x1a')](_0x34d667)[_0xed31('0x2e')](_0x459c46);};}exports['index']=function(_0xa4a30,_0xe968e4){var _0x8bb899={},_0x2ac643={},_0x354f92={'count':0x0,'rows':[]};var _0x36411e=_[_0xed31('0x2f')](db[_0xed31('0x30')][_0xed31('0x31')],function(_0x51bbb0){return{'name':_0x51bbb0['fieldName'],'type':_0x51bbb0[_0xed31('0x32')][_0xed31('0x33')]};});_0x2ac643['model']=_[_0xed31('0x2f')](_0x36411e,_0xed31('0x2d'));_0x2ac643[_0xed31('0x34')]=_[_0xed31('0x35')](_0xa4a30[_0xed31('0x34')]);_0x2ac643['filters']=_[_0xed31('0x36')](_0x2ac643[_0xed31('0x37')],_0x2ac643['query']);_0x8bb899[_0xed31('0x38')]=_[_0xed31('0x36')](_0x2ac643[_0xed31('0x37')],qs[_0xed31('0x39')](_0xa4a30[_0xed31('0x34')][_0xed31('0x39')]));_0x8bb899[_0xed31('0x38')]=_0x8bb899[_0xed31('0x38')][_0xed31('0x3a')]?_0x8bb899[_0xed31('0x38')]:_0x2ac643[_0xed31('0x37')];if(!_0xa4a30[_0xed31('0x34')][_0xed31('0x3b')](_0xed31('0x3c'))){_0x8bb899[_0xed31('0x1f')]=qs[_0xed31('0x1f')](_0xa4a30[_0xed31('0x34')][_0xed31('0x1f')]);_0x8bb899[_0xed31('0x1d')]=qs[_0xed31('0x1d')](_0xa4a30[_0xed31('0x34')]['offset']);}_0x8bb899[_0xed31('0x3d')]=qs[_0xed31('0x3e')](_0xa4a30[_0xed31('0x34')][_0xed31('0x3e')]);_0x8bb899[_0xed31('0x3f')]=qs['filters'](_[_0xed31('0x40')](_0xa4a30['query'],_0x2ac643[_0xed31('0x41')]),_0x36411e);if(_0xa4a30[_0xed31('0x34')][_0xed31('0x42')]){_0x8bb899[_0xed31('0x3f')]=_[_0xed31('0x43')](_0x8bb899[_0xed31('0x3f')],{'$or':_[_0xed31('0x2f')](_0x36411e,function(_0x2f3305){if(_0x2f3305['type']!==_0xed31('0x44')){var _0x360f42={};_0x360f42[_0x2f3305[_0xed31('0x2d')]]={'$like':'%'+_0xa4a30[_0xed31('0x34')]['filter']+'%'};return _0x360f42;}})});}_0x8bb899=_[_0xed31('0x43')]({},_0x8bb899,_0xa4a30[_0xed31('0x45')]);var _0x2f2f2e={'where':_0x8bb899[_0xed31('0x3f')]};return db['AnalyticExtractedReport'][_0xed31('0x20')](_0x2f2f2e)[_0xed31('0x27')](function(_0x4eef7e){_0x354f92['count']=_0x4eef7e;if(_0xa4a30[_0xed31('0x34')]['includeAll']){_0x8bb899[_0xed31('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x8bb899);})[_0xed31('0x27')](function(_0x2f19ff){_0x354f92['rows']=_0x2f19ff;return _0x354f92;})[_0xed31('0x27')](respondWithFilteredResult(_0xe968e4,_0x8bb899))[_0xed31('0x47')](handleError(_0xe968e4,null));};exports[_0xed31('0x48')]=function(_0x4f561c,_0x4698e1){var _0x5b2683={'raw':!![],'where':{'id':_0x4f561c[_0xed31('0x49')]['id']}},_0x2a799e={};_0x2a799e[_0xed31('0x37')]=_['keys'](db['AnalyticExtractedReport'][_0xed31('0x31')]);_0x2a799e['query']=_[_0xed31('0x35')](_0x4f561c[_0xed31('0x34')]);_0x2a799e[_0xed31('0x41')]=_['intersection'](_0x2a799e['model'],_0x2a799e[_0xed31('0x34')]);_0x5b2683[_0xed31('0x38')]=_[_0xed31('0x36')](_0x2a799e[_0xed31('0x37')],qs['fields'](_0x4f561c[_0xed31('0x34')][_0xed31('0x39')]));_0x5b2683[_0xed31('0x38')]=_0x5b2683[_0xed31('0x38')][_0xed31('0x3a')]?_0x5b2683[_0xed31('0x38')]:_0x2a799e[_0xed31('0x37')];if(_0x4f561c[_0xed31('0x34')][_0xed31('0x4a')]){_0x5b2683['include']=[{'all':!![]}];}_0x5b2683=_[_0xed31('0x43')]({},_0x5b2683,_0x4f561c['options']);return db['AnalyticExtractedReport'][_0xed31('0x4b')](_0x5b2683)[_0xed31('0x27')](handleEntityNotFound(_0x4698e1,null))[_0xed31('0x27')](respondWithResult(_0x4698e1,null))[_0xed31('0x47')](handleError(_0x4698e1,null));};exports['create']=function(_0x256d73,_0x57cc67){return db[_0xed31('0x30')]['create'](_0x256d73['body'],{})['then'](function(_0x5bcdd1){var _0x4e35e9=_0x256d73[_0xed31('0x4c')]['get']({'plain':!![]});if(!_0x4e35e9)throw new Error(_0xed31('0x4d'));if(_0x4e35e9[_0xed31('0x4e')]==='user'){var _0x44f72e=_0x5bcdd1['get']({'plain':!![]});var _0x8e2c50=_0xed31('0x2a');return db[_0xed31('0x4f')][_0xed31('0x4b')]({'where':{'name':_0x8e2c50,'userProfileId':_0x4e35e9[_0xed31('0x50')]},'raw':!![]})[_0xed31('0x27')](function(_0x5d1dff){if(_0x5d1dff&&_0x5d1dff[_0xed31('0x51')]===0x0){return db[_0xed31('0x2b')][_0xed31('0x52')]({'name':_0x44f72e[_0xed31('0x2d')],'resourceId':_0x44f72e['id'],'type':_0x5d1dff[_0xed31('0x2d')],'sectionId':_0x5d1dff['id']},{})[_0xed31('0x27')](function(){return _0x5bcdd1;});}else{return _0x5bcdd1;}})[_0xed31('0x47')](function(_0x501c55){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501c55);throw _0x501c55;});}return _0x5bcdd1;})['then'](respondWithResult(_0x57cc67,0xc9))[_0xed31('0x47')](handleError(_0x57cc67,null));};exports['update']=function(_0x3d82b6,_0x48c933){if(_0x3d82b6[_0xed31('0x53')]['id']){delete _0x3d82b6[_0xed31('0x53')]['id'];}return db[_0xed31('0x30')][_0xed31('0x4b')]({'where':{'id':_0x3d82b6[_0xed31('0x49')]['id']}})['then'](handleEntityNotFound(_0x48c933,null))[_0xed31('0x27')](saveUpdates(_0x3d82b6['body'],null))[_0xed31('0x27')](respondWithResult(_0x48c933,null))['catch'](handleError(_0x48c933,null));};exports['destroy']=function(_0x581195,_0x3e6f2b){return db[_0xed31('0x30')][_0xed31('0x4b')]({'where':{'id':_0x581195[_0xed31('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e6f2b,null))[_0xed31('0x27')](removeEntity(_0x3e6f2b,null))[_0xed31('0x47')](handleError(_0x3e6f2b,null));};exports[_0xed31('0x54')]=function(_0x354d4f,_0x18572d,_0x59d1bc){return db[_0xed31('0x30')][_0xed31('0x4b')]({'where':{'id':_0x354d4f[_0xed31('0x49')]['id']},'attributes':[_0xed31('0x2d'),_0xed31('0x55'),_0xed31('0x56'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x18572d,null))[_0xed31('0x27')](function(_0x1f350a){if(_0x1f350a){if(!fs[_0xed31('0x57')](path[_0xed31('0x58')](config[_0xed31('0x59')],'server/files/reports',_0x1f350a['savename']))){throw new db[(_0xed31('0x5a'))][(_0xed31('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x354d4f['query'][_0xed31('0x5c')]){return _0x18572d['sendStatus'](0xc8);}return _0x18572d['download'](path[_0xed31('0x58')](config[_0xed31('0x59')],'server/files/reports',_0x1f350a[_0xed31('0x56')]),util['format'](_0xed31('0x5d'),_0x1f350a[_0xed31('0x55')]||_0x1f350a[_0xed31('0x2d')],_0x1f350a[_0xed31('0x5e')][_0xed31('0x5f')]()));}})[_0xed31('0x47')](handleError(_0x18572d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index aaa7c77..ff86692 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 _0xf7b1=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37e46f,_0xb22914){var _0x311af2=function(_0x46a674){while(--_0x46a674){_0x37e46f['push'](_0x37e46f['shift']());}};_0x311af2(++_0xb22914);}(_0xf7b1,0xae));var _0x1f7b=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xf7b1[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require(_0x1f7b('0x0'));var logger=require(_0x1f7b('0x1'))(_0x1f7b('0x2'));var moment=require(_0x1f7b('0x3'));var BPromise=require(_0x1f7b('0x4'));var rp=require(_0x1f7b('0x5'));var fs=require('fs');var path=require(_0x1f7b('0x6'));var rimraf=require(_0x1f7b('0x7'));var config=require(_0x1f7b('0x8'));var attributes=require(_0x1f7b('0x9'));module[_0x1f7b('0xa')]=function(_0x1c3b3e,_0xa7986c){return _0x1c3b3e[_0x1f7b('0xb')](_0x1f7b('0xc'),attributes,{'tableName':_0x1f7b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac7e=['exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes'];(function(_0x115683,_0x4a1c36){var _0x5715b0=function(_0x17a343){while(--_0x17a343){_0x115683['push'](_0x115683['shift']());}};_0x5715b0(++_0x4a1c36);}(_0xac7e,0x14d));var _0xeac7=function(_0x20eff5,_0x459af0){_0x20eff5=_0x20eff5-0x0;var _0x59141f=_0xac7e[_0x20eff5];return _0x59141f;};'use strict';var _=require(_0xeac7('0x0'));var util=require(_0xeac7('0x1'));var logger=require(_0xeac7('0x2'))(_0xeac7('0x3'));var moment=require(_0xeac7('0x4'));var BPromise=require(_0xeac7('0x5'));var rp=require(_0xeac7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeac7('0x7'));module[_0xeac7('0x8')]=function(_0x54f4f0,_0xd5f9c){return _0x54f4f0[_0xeac7('0x9')](_0xeac7('0xa'),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 73823ea..b6ac36e 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 _0x4e3e=['../../config/environment','jayson/promise','client','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x3325b6,_0xc8b55a){var _0xe8641=function(_0x3925dc){while(--_0x3925dc){_0x3325b6['push'](_0x3325b6['shift']());}};_0xe8641(++_0xc8b55a);}(_0x4e3e,0x1e1));var _0xe4e3=function(_0x54a11f,_0x19d779){_0x54a11f=_0x54a11f-0x0;var _0x3fa817=_0x4e3e[_0x54a11f];return _0x3fa817;};'use strict';var _=require(_0xe4e3('0x0'));var util=require(_0xe4e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4e3('0x2'));var db=require(_0xe4e3('0x3'))['db'];var utils=require(_0xe4e3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe4e3('0x5'));var jayson=require(_0xe4e3('0x6'));var client=jayson[_0xe4e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x967b1c,_0x58dc93,_0x3e5b7f){return new BPromise(function(_0xbfa247,_0x377785){return client[_0xe4e3('0x8')](_0x967b1c,_0x3e5b7f)['then'](function(_0xffeee4){logger['info'](_0xe4e3('0x9'),_0x58dc93,_0xe4e3('0xa'));logger['debug'](_0xe4e3('0xb'),_0x58dc93,'request\x20sent',JSON[_0xe4e3('0xc')](_0xffeee4));if(_0xffeee4['error']){if(_0xffeee4[_0xe4e3('0xd')][_0xe4e3('0xe')]===0x1f4){logger[_0xe4e3('0xd')](_0xe4e3('0x9'),_0x58dc93,_0xffeee4[_0xe4e3('0xd')][_0xe4e3('0xf')]);return _0x377785(_0xffeee4[_0xe4e3('0xd')][_0xe4e3('0xf')]);}logger[_0xe4e3('0xd')](_0xe4e3('0x9'),_0x58dc93,_0xffeee4[_0xe4e3('0xd')]['message']);return _0xbfa247(_0xffeee4[_0xe4e3('0xd')][_0xe4e3('0xf')]);}else{logger['info'](_0xe4e3('0x9'),_0x58dc93,_0xe4e3('0xa'));_0xbfa247(_0xffeee4[_0xe4e3('0x10')]['message']);}})[_0xe4e3('0x11')](function(_0x2cfde0){logger['error'](_0xe4e3('0x9'),_0x58dc93,_0x2cfde0);_0x377785(_0x2cfde0);});});} \ No newline at end of file +var _0x2ab7=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3d123f,_0x24db7f){var _0x1fcc10=function(_0x324b0d){while(--_0x324b0d){_0x3d123f['push'](_0x3d123f['shift']());}};_0x1fcc10(++_0x24db7f);}(_0x2ab7,0xe7));var _0x72ab=function(_0x2c70a9,_0x4e7a6d){_0x2c70a9=_0x2c70a9-0x0;var _0x50f468=_0x2ab7[_0x2c70a9];return _0x50f468;};'use strict';var _=require(_0x72ab('0x0'));var util=require(_0x72ab('0x1'));var moment=require(_0x72ab('0x2'));var BPromise=require(_0x72ab('0x3'));var rs=require(_0x72ab('0x4'));var fs=require('fs');var Redis=require(_0x72ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x72ab('0x6'));var logger=require(_0x72ab('0x7'))(_0x72ab('0x8'));var config=require(_0x72ab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72ab('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54caaf,_0x188caa,_0x2ed3b1){return new BPromise(function(_0xbd73df,_0x4dd1fe){return client['request'](_0x54caaf,_0x2ed3b1)[_0x72ab('0xb')](function(_0x4819ef){logger[_0x72ab('0xc')](_0x72ab('0xd'),_0x188caa,'request\x20sent');logger[_0x72ab('0xe')](_0x72ab('0xf'),_0x188caa,_0x72ab('0x10'),JSON[_0x72ab('0x11')](_0x4819ef));if(_0x4819ef[_0x72ab('0x12')]){if(_0x4819ef[_0x72ab('0x12')][_0x72ab('0x13')]===0x1f4){logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x4819ef[_0x72ab('0x12')]['message']);return _0x4dd1fe(_0x4819ef['error'][_0x72ab('0x14')]);}logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x4819ef['error']['message']);return _0xbd73df(_0x4819ef[_0x72ab('0x12')][_0x72ab('0x14')]);}else{logger[_0x72ab('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x188caa,_0x72ab('0x10'));_0xbd73df(_0x4819ef['result'][_0x72ab('0x14')]);}})[_0x72ab('0x15')](function(_0x337218){logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x337218);_0x4dd1fe(_0x337218);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 928c7e3..682eb02 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 _0x121e=['./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x121e,0x115));var _0xe121=function(_0x1a091e,_0x13c1cb){_0x1a091e=_0x1a091e-0x0;var _0x545d2e=_0x121e[_0x1a091e];return _0x545d2e;};'use strict';var multer=require('multer');var util=require(_0xe121('0x0'));var path=require(_0xe121('0x1'));var timeout=require(_0xe121('0x2'));var express=require(_0xe121('0x3'));var router=express[_0xe121('0x4')]();var fs_extra=require(_0xe121('0x5'));var auth=require(_0xe121('0x6'));var interaction=require(_0xe121('0x7'));var config=require(_0xe121('0x8'));var controller=require(_0xe121('0x9'));router[_0xe121('0xa')]('/',auth[_0xe121('0xb')](),controller[_0xe121('0xc')]);router[_0xe121('0xa')]('/:id',auth[_0xe121('0xb')](),controller[_0xe121('0xd')]);router['get']('/:id/download',auth[_0xe121('0xb')](),controller[_0xe121('0xe')]);router[_0xe121('0xf')]('/',auth[_0xe121('0xb')](),controller[_0xe121('0x10')]);router['put'](_0xe121('0x11'),auth['isAuthenticated'](),controller[_0xe121('0x12')]);router[_0xe121('0x13')](_0xe121('0x11'),auth[_0xe121('0xb')](),controller[_0xe121('0x14')]);module[_0xe121('0x15')]=router; \ No newline at end of file +var _0x5069=['isAuthenticated','/:id','show','/:id/download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x5d9a3d,_0x2ce39f){var _0x2a2d9c=function(_0x1fcee6){while(--_0x1fcee6){_0x5d9a3d['push'](_0x5d9a3d['shift']());}};_0x2a2d9c(++_0x2ce39f);}(_0x5069,0x96));var _0x9506=function(_0x5026ab,_0x25bd8b){_0x5026ab=_0x5026ab-0x0;var _0x55f39a=_0x5069[_0x5026ab];return _0x55f39a;};'use strict';var multer=require(_0x9506('0x0'));var util=require(_0x9506('0x1'));var path=require(_0x9506('0x2'));var timeout=require('connect-timeout');var express=require(_0x9506('0x3'));var router=express[_0x9506('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9506('0x5'));var interaction=require(_0x9506('0x6'));var config=require(_0x9506('0x7'));var controller=require(_0x9506('0x8'));router[_0x9506('0x9')]('/',auth[_0x9506('0xa')](),controller['index']);router['get'](_0x9506('0xb'),auth[_0x9506('0xa')](),controller[_0x9506('0xc')]);router[_0x9506('0x9')](_0x9506('0xd'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x9506('0xa')](),controller[_0x9506('0xe')]);router[_0x9506('0xf')](_0x9506('0xb'),auth[_0x9506('0xa')](),controller[_0x9506('0x10')]);router[_0x9506('0x11')](_0x9506('0xb'),auth[_0x9506('0xa')](),controller[_0x9506('0x12')]);module[_0x9506('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ed835b9..3272386 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 _0x068c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x33cf30,_0x2406b7){var _0x5e9a07=function(_0x291bb5){while(--_0x291bb5){_0x33cf30['push'](_0x33cf30['shift']());}};_0x5e9a07(++_0x2406b7);}(_0x068c,0x18a));var _0xc068=function(_0x1b619f,_0x4dbcf5){_0x1b619f=_0x1b619f-0x0;var _0x4ca041=_0x068c[_0x1b619f];return _0x4ca041;};'use strict';var Sequelize=require(_0xc068('0x0'));module[_0xc068('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xc068('0x2')]},'function':{'type':Sequelize[_0xc068('0x2')]},'format':{'type':Sequelize[_0xc068('0x2')]},'groupBy':{'type':Sequelize[_0xc068('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc068('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd46c=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xd46c,0xb4));var _0xcd46=function(_0x29ee16,_0x329748){_0x29ee16=_0x29ee16-0x0;var _0x3814c3=_0xd46c[_0x29ee16];return _0x3814c3;};'use strict';var Sequelize=require(_0xcd46('0x0'));module[_0xcd46('0x1')]={'field':{'type':Sequelize[_0xcd46('0x2')]},'alias':{'type':Sequelize[_0xcd46('0x3')]},'function':{'type':Sequelize[_0xcd46('0x3')]},'format':{'type':Sequelize[_0xcd46('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xcd46('0x3')]},'custom':{'type':Sequelize[_0xcd46('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 7348220..9659390 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 _0x188d=['key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','fields','merge','find','create','body','catch','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x257d95,_0x22e18c){var _0x2e40b9=function(_0x446a80){while(--_0x446a80){_0x257d95['push'](_0x257d95['shift']());}};_0x2e40b9(++_0x22e18c);}(_0x188d,0x171));var _0xd188=function(_0x47677f,_0x28c987){_0x47677f=_0x47677f-0x0;var _0xde4698=_0x188d[_0x47677f];return _0xde4698;};'use strict';var emlformat=require(_0xd188('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd188('0x1'));var jsonpatch=require(_0xd188('0x2'));var rp=require(_0xd188('0x3'));var moment=require(_0xd188('0x4'));var BPromise=require(_0xd188('0x5'));var Mustache=require(_0xd188('0x6'));var util=require(_0xd188('0x7'));var path=require('path');var sox=require(_0xd188('0x8'));var csv=require(_0xd188('0x9'));var ejs=require(_0xd188('0xa'));var fs=require('fs');var fs_extra=require(_0xd188('0xb'));var _=require('lodash');var squel=require(_0xd188('0xc'));var crypto=require(_0xd188('0xd'));var jsforce=require(_0xd188('0xe'));var deskjs=require(_0xd188('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd188('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd188('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd188('0x12'))(_0xd188('0x13'));var utils=require(_0xd188('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd188('0x15'));var db=require(_0xd188('0x16'))['db'];function respondWithStatusCode(_0x96f2e9,_0x2bd272){_0x2bd272=_0x2bd272||0xcc;return function(_0x5c6587){if(_0x5c6587){return _0x96f2e9[_0xd188('0x17')](_0x2bd272);}return _0x96f2e9['status'](_0x2bd272)[_0xd188('0x18')]();};}function respondWithResult(_0x14732e,_0x3c7f19){_0x3c7f19=_0x3c7f19||0xc8;return function(_0x4a13df){if(_0x4a13df){return _0x14732e[_0xd188('0x19')](_0x3c7f19)['json'](_0x4a13df);}};}function respondWithFilteredResult(_0x1a4e67,_0x19dc82){return function(_0x58333d){if(_0x58333d){var _0x55b98e=typeof _0x19dc82[_0xd188('0x1a')]===_0xd188('0x1b')&&typeof _0x19dc82[_0xd188('0x1c')]===_0xd188('0x1b');var _0x2fa3d6=_0x58333d['count'];var _0x59cd36=_0x55b98e?0x0:_0x19dc82[_0xd188('0x1a')];var _0x5efdd2=_0x55b98e?_0x58333d[_0xd188('0x1d')]:_0x19dc82[_0xd188('0x1a')]+_0x19dc82['limit'];var _0x1748f5;if(_0x5efdd2>=_0x2fa3d6){_0x5efdd2=_0x2fa3d6;_0x1748f5=0xc8;}else{_0x1748f5=0xce;}_0x1a4e67['status'](_0x1748f5);return _0x1a4e67[_0xd188('0x1e')](_0xd188('0x1f'),_0x59cd36+'-'+_0x5efdd2+'/'+_0x2fa3d6)['json'](_0x58333d);}return null;};}function patchUpdates(_0x500135){return function(_0x4e64eb){try{jsonpatch[_0xd188('0x20')](_0x4e64eb,_0x500135,!![]);}catch(_0x529b2e){return BPromise[_0xd188('0x21')](_0x529b2e);}return _0x4e64eb[_0xd188('0x22')]();};}function saveUpdates(_0x127a09,_0xf583e3){return function(_0x14043e){if(_0x14043e){return _0x14043e['update'](_0x127a09)['then'](function(_0x3bf16c){return _0x3bf16c;});}return null;};}function removeEntity(_0x18baa9,_0x5b4d9c){return function(_0x3f00c2){if(_0x3f00c2){return _0x3f00c2[_0xd188('0x23')]()[_0xd188('0x24')](function(){_0x18baa9['status'](0xcc)[_0xd188('0x18')]();});}};}function handleEntityNotFound(_0x1f5d2d,_0x5d3b2e){return function(_0xe17213){if(!_0xe17213){_0x1f5d2d[_0xd188('0x17')](0x194);}return _0xe17213;};}function handleError(_0x530718,_0x3ca635){_0x3ca635=_0x3ca635||0x1f4;return function(_0x4a4e55){logger[_0xd188('0x25')](_0x4a4e55[_0xd188('0x26')]);if(_0x4a4e55['name']){delete _0x4a4e55[_0xd188('0x27')];}_0x530718['status'](_0x3ca635)[_0xd188('0x28')](_0x4a4e55);};}exports['index']=function(_0xbe709,_0x4c0dcb){var _0x3a3d3d={},_0x15fe04={},_0x2c105e={'count':0x0,'rows':[]};var _0x3bc2e2=_[_0xd188('0x29')](db[_0xd188('0x2a')][_0xd188('0x2b')],function(_0x2e5203){return{'name':_0x2e5203[_0xd188('0x2c')],'type':_0x2e5203[_0xd188('0x2d')][_0xd188('0x2e')]};});_0x15fe04[_0xd188('0x2f')]=_['map'](_0x3bc2e2,_0xd188('0x27'));_0x15fe04[_0xd188('0x30')]=_[_0xd188('0x31')](_0xbe709[_0xd188('0x30')]);_0x15fe04['filters']=_[_0xd188('0x32')](_0x15fe04['model'],_0x15fe04[_0xd188('0x30')]);_0x3a3d3d[_0xd188('0x33')]=_[_0xd188('0x32')](_0x15fe04['model'],qs['fields'](_0xbe709[_0xd188('0x30')]['fields']));_0x3a3d3d['attributes']=_0x3a3d3d[_0xd188('0x33')][_0xd188('0x34')]?_0x3a3d3d[_0xd188('0x33')]:_0x15fe04[_0xd188('0x2f')];if(!_0xbe709[_0xd188('0x30')][_0xd188('0x35')](_0xd188('0x36'))){_0x3a3d3d[_0xd188('0x1c')]=qs[_0xd188('0x1c')](_0xbe709[_0xd188('0x30')][_0xd188('0x1c')]);_0x3a3d3d[_0xd188('0x1a')]=qs['offset'](_0xbe709[_0xd188('0x30')][_0xd188('0x1a')]);}_0x3a3d3d[_0xd188('0x37')]=qs[_0xd188('0x38')](_0xbe709[_0xd188('0x30')][_0xd188('0x38')]);_0x3a3d3d[_0xd188('0x39')]=qs[_0xd188('0x3a')](_[_0xd188('0x3b')](_0xbe709[_0xd188('0x30')],_0x15fe04[_0xd188('0x3a')]),_0x3bc2e2);if(_0xbe709[_0xd188('0x30')][_0xd188('0x3c')]){_0x3a3d3d[_0xd188('0x39')]=_['merge'](_0x3a3d3d[_0xd188('0x39')],{'$or':_[_0xd188('0x29')](_0x3bc2e2,function(_0xa6feea){if(_0xa6feea['type']!==_0xd188('0x3d')){var _0x22bf83={};_0x22bf83[_0xa6feea['name']]={'$like':'%'+_0xbe709[_0xd188('0x30')][_0xd188('0x3c')]+'%'};return _0x22bf83;}})});}_0x3a3d3d=_['merge']({},_0x3a3d3d,_0xbe709[_0xd188('0x3e')]);var _0xee7d45={'where':_0x3a3d3d[_0xd188('0x39')]};return db['AnalyticFieldReport'][_0xd188('0x1d')](_0xee7d45)[_0xd188('0x24')](function(_0x45eb71){_0x2c105e[_0xd188('0x1d')]=_0x45eb71;if(_0xbe709[_0xd188('0x30')][_0xd188('0x3f')]){_0x3a3d3d[_0xd188('0x40')]=[{'all':!![]}];}return db[_0xd188('0x2a')][_0xd188('0x41')](_0x3a3d3d);})[_0xd188('0x24')](function(_0xd80462){_0x2c105e['rows']=_0xd80462;return _0x2c105e;})[_0xd188('0x24')](respondWithFilteredResult(_0x4c0dcb,_0x3a3d3d))['catch'](handleError(_0x4c0dcb,null));};exports[_0xd188('0x42')]=function(_0x56698d,_0x29ad52){var _0x2c0e06={'raw':![],'where':{'id':_0x56698d[_0xd188('0x43')]['id']}},_0x11661d={};_0x11661d[_0xd188('0x2f')]=_[_0xd188('0x31')](db[_0xd188('0x2a')][_0xd188('0x2b')]);_0x11661d['query']=_[_0xd188('0x31')](_0x56698d[_0xd188('0x30')]);_0x11661d[_0xd188('0x3a')]=_[_0xd188('0x32')](_0x11661d['model'],_0x11661d['query']);_0x2c0e06[_0xd188('0x33')]=_[_0xd188('0x32')](_0x11661d['model'],qs[_0xd188('0x44')](_0x56698d[_0xd188('0x30')][_0xd188('0x44')]));_0x2c0e06['attributes']=_0x2c0e06[_0xd188('0x33')][_0xd188('0x34')]?_0x2c0e06[_0xd188('0x33')]:_0x11661d[_0xd188('0x2f')];if(_0x56698d[_0xd188('0x30')][_0xd188('0x3f')]){_0x2c0e06['include']=[{'all':!![]}];}_0x2c0e06=_[_0xd188('0x45')]({},_0x2c0e06,_0x56698d[_0xd188('0x3e')]);return db[_0xd188('0x2a')][_0xd188('0x46')](_0x2c0e06)['then'](handleEntityNotFound(_0x29ad52,null))[_0xd188('0x24')](respondWithResult(_0x29ad52,null))['catch'](handleError(_0x29ad52,null));};exports[_0xd188('0x47')]=function(_0x5ac519,_0x4d1b5f){return db['AnalyticFieldReport'][_0xd188('0x47')](_0x5ac519[_0xd188('0x48')],{})[_0xd188('0x24')](respondWithResult(_0x4d1b5f,0xc9))[_0xd188('0x49')](handleError(_0x4d1b5f,null));};exports[_0xd188('0x4a')]=function(_0x45f3ee,_0x52bf7a){return db[_0xd188('0x2a')][_0xd188('0x4a')](_0x45f3ee[_0xd188('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x52bf7a,0xc9))['catch'](handleError(_0x52bf7a,null));};exports[_0xd188('0x4b')]=function(_0x58512c,_0x48401d){if(_0x58512c[_0xd188('0x48')]['id']){delete _0x58512c['body']['id'];}return db[_0xd188('0x2a')][_0xd188('0x46')]({'where':{'id':_0x58512c[_0xd188('0x43')]['id']}})['then'](handleEntityNotFound(_0x48401d,null))[_0xd188('0x24')](saveUpdates(_0x58512c[_0xd188('0x48')],null))[_0xd188('0x24')](respondWithResult(_0x48401d,null))[_0xd188('0x49')](handleError(_0x48401d,null));};exports[_0xd188('0x23')]=function(_0xad29ef,_0x157e43){return db[_0xd188('0x2a')]['find']({'where':{'id':_0xad29ef['params']['id']}})[_0xd188('0x24')](handleEntityNotFound(_0x157e43,null))[_0xd188('0x24')](removeEntity(_0x157e43,null))[_0xd188('0x49')](handleError(_0x157e43,null));};exports[_0xd188('0x4c')]=function(_0x3e73e0,_0x97b4ef){return db[_0xd188('0x2a')][_0xd188('0x23')]({'where':{'id':_0x3e73e0['query'][_0xd188('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xd188('0x24')](respondWithResult(_0x97b4ef,0xcc))[_0xd188('0x49')](handleError(_0x97b4ef,null));};exports[_0xd188('0x4e')]=function(_0x49d08e,_0x2bd68f,_0x53e254){return db[_0xd188('0x4f')]['findOne']({'where':{'id':_0x49d08e[_0xd188('0x43')]['id']}})[_0xd188('0x24')](handleEntityNotFound(_0x2bd68f,null))[_0xd188('0x24')](function(_0x37704f){if(_0x37704f){return db[_0xd188('0x50')][_0xd188('0x51')](function(_0x3fb246){return db[_0xd188('0x2a')][_0xd188('0x23')]({'where':{'CustomReportId':_0x49d08e[_0xd188('0x43')]['id']},'transaction':_0x3fb246})[_0xd188('0x24')](function(_0x474c02){var _0x58fe7d=_['map'](_0x49d08e[_0xd188('0x48')],function(_0x94a860){delete _0x94a860['id'];_0x94a860[_0xd188('0x52')]=_0x49d08e[_0xd188('0x43')]['id'];return _0x94a860;});return db[_0xd188('0x2a')][_0xd188('0x4a')](_0x58fe7d,{'transaction':_0x3fb246});});})[_0xd188('0x24')](function(){return db['AnalyticFieldReport'][_0xd188('0x41')]({'where':{'CustomReportId':_0x49d08e[_0xd188('0x43')]['id']}});});}})[_0xd188('0x24')](respondWithResult(_0x2bd68f,null))[_0xd188('0x49')](handleError(_0x2bd68f,null));}; \ No newline at end of file +var _0x1738=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x1738,0x13f));var _0x8173=function(_0x3da312,_0x391ccd){_0x3da312=_0x3da312-0x0;var _0x28fb08=_0x1738[_0x3da312];return _0x28fb08;};'use strict';var emlformat=require(_0x8173('0x0'));var rimraf=require(_0x8173('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8173('0x2'));var rp=require(_0x8173('0x3'));var moment=require(_0x8173('0x4'));var BPromise=require(_0x8173('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8173('0x6'));var sox=require(_0x8173('0x7'));var csv=require(_0x8173('0x8'));var ejs=require(_0x8173('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8173('0xa'));var squel=require(_0x8173('0xb'));var crypto=require(_0x8173('0xc'));var jsforce=require(_0x8173('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8173('0xe'));var Papa=require('papaparse');var Redis=require(_0x8173('0xf'));var authService=require(_0x8173('0x10'));var qs=require(_0x8173('0x11'));var as=require(_0x8173('0x12'));var hardwareService=require(_0x8173('0x13'));var logger=require(_0x8173('0x14'))(_0x8173('0x15'));var utils=require(_0x8173('0x16'));var config=require(_0x8173('0x17'));var licenseUtil=require(_0x8173('0x18'));var db=require(_0x8173('0x19'))['db'];function respondWithStatusCode(_0x1a3dc4,_0x2a6aad){_0x2a6aad=_0x2a6aad||0xcc;return function(_0x299ae9){if(_0x299ae9){return _0x1a3dc4['sendStatus'](_0x2a6aad);}return _0x1a3dc4[_0x8173('0x1a')](_0x2a6aad)[_0x8173('0x1b')]();};}function respondWithResult(_0x167b0e,_0xcea595){_0xcea595=_0xcea595||0xc8;return function(_0xfbbd7b){if(_0xfbbd7b){return _0x167b0e[_0x8173('0x1a')](_0xcea595)[_0x8173('0x1c')](_0xfbbd7b);}};}function respondWithFilteredResult(_0x373d7a,_0x5ac311){return function(_0x1c9a4f){if(_0x1c9a4f){var _0x1351c9=typeof _0x5ac311['offset']===_0x8173('0x1d')&&typeof _0x5ac311[_0x8173('0x1e')]===_0x8173('0x1d');var _0x20d32a=_0x1c9a4f[_0x8173('0x1f')];var _0x348199=_0x1351c9?0x0:_0x5ac311[_0x8173('0x20')];var _0xd74139=_0x1351c9?_0x1c9a4f['count']:_0x5ac311[_0x8173('0x20')]+_0x5ac311[_0x8173('0x1e')];var _0x19bd09;if(_0xd74139>=_0x20d32a){_0xd74139=_0x20d32a;_0x19bd09=0xc8;}else{_0x19bd09=0xce;}_0x373d7a['status'](_0x19bd09);return _0x373d7a['set'](_0x8173('0x21'),_0x348199+'-'+_0xd74139+'/'+_0x20d32a)[_0x8173('0x1c')](_0x1c9a4f);}return null;};}function patchUpdates(_0x3c5980){return function(_0x493b64){try{jsonpatch['apply'](_0x493b64,_0x3c5980,!![]);}catch(_0xb5a67){return BPromise[_0x8173('0x22')](_0xb5a67);}return _0x493b64[_0x8173('0x23')]();};}function saveUpdates(_0x413897,_0x4550d8){return function(_0x26041b){if(_0x26041b){return _0x26041b[_0x8173('0x24')](_0x413897)['then'](function(_0x15dfbe){return _0x15dfbe;});}return null;};}function removeEntity(_0x1abfc0,_0x37afa6){return function(_0xa1177){if(_0xa1177){return _0xa1177[_0x8173('0x25')]()[_0x8173('0x26')](function(){_0x1abfc0[_0x8173('0x1a')](0xcc)[_0x8173('0x1b')]();});}};}function handleEntityNotFound(_0x4ea030,_0x2a262f){return function(_0x6790d8){if(!_0x6790d8){_0x4ea030[_0x8173('0x27')](0x194);}return _0x6790d8;};}function handleError(_0xd2c7bf,_0x1d4d5a){_0x1d4d5a=_0x1d4d5a||0x1f4;return function(_0x4ec437){logger[_0x8173('0x28')](_0x4ec437[_0x8173('0x29')]);if(_0x4ec437[_0x8173('0x2a')]){delete _0x4ec437['name'];}_0xd2c7bf[_0x8173('0x1a')](_0x1d4d5a)[_0x8173('0x2b')](_0x4ec437);};}exports[_0x8173('0x2c')]=function(_0x3f4b,_0x2a9cab){var _0x4992ce={},_0xb067af={},_0x3d53ee={'count':0x0,'rows':[]};var _0x215ed5=_[_0x8173('0x2d')](db[_0x8173('0x2e')]['rawAttributes'],function(_0x2ff16f){return{'name':_0x2ff16f['fieldName'],'type':_0x2ff16f[_0x8173('0x2f')][_0x8173('0x30')]};});_0xb067af[_0x8173('0x31')]=_[_0x8173('0x2d')](_0x215ed5,'name');_0xb067af['query']=_[_0x8173('0x32')](_0x3f4b[_0x8173('0x33')]);_0xb067af[_0x8173('0x34')]=_['intersection'](_0xb067af[_0x8173('0x31')],_0xb067af[_0x8173('0x33')]);_0x4992ce[_0x8173('0x35')]=_['intersection'](_0xb067af['model'],qs[_0x8173('0x36')](_0x3f4b[_0x8173('0x33')][_0x8173('0x36')]));_0x4992ce['attributes']=_0x4992ce[_0x8173('0x35')][_0x8173('0x37')]?_0x4992ce[_0x8173('0x35')]:_0xb067af[_0x8173('0x31')];if(!_0x3f4b[_0x8173('0x33')][_0x8173('0x38')](_0x8173('0x39'))){_0x4992ce[_0x8173('0x1e')]=qs[_0x8173('0x1e')](_0x3f4b[_0x8173('0x33')]['limit']);_0x4992ce['offset']=qs[_0x8173('0x20')](_0x3f4b[_0x8173('0x33')]['offset']);}_0x4992ce[_0x8173('0x3a')]=qs['sort'](_0x3f4b['query'][_0x8173('0x3b')]);_0x4992ce[_0x8173('0x3c')]=qs[_0x8173('0x34')](_[_0x8173('0x3d')](_0x3f4b[_0x8173('0x33')],_0xb067af[_0x8173('0x34')]),_0x215ed5);if(_0x3f4b[_0x8173('0x33')]['filter']){_0x4992ce[_0x8173('0x3c')]=_['merge'](_0x4992ce['where'],{'$or':_[_0x8173('0x2d')](_0x215ed5,function(_0x51ae28){if(_0x51ae28[_0x8173('0x2f')]!==_0x8173('0x3e')){var _0x4454fa={};_0x4454fa[_0x51ae28[_0x8173('0x2a')]]={'$like':'%'+_0x3f4b[_0x8173('0x33')][_0x8173('0x3f')]+'%'};return _0x4454fa;}})});}_0x4992ce=_[_0x8173('0x40')]({},_0x4992ce,_0x3f4b[_0x8173('0x41')]);var _0x37e095={'where':_0x4992ce[_0x8173('0x3c')]};return db[_0x8173('0x2e')][_0x8173('0x1f')](_0x37e095)[_0x8173('0x26')](function(_0x38291f){_0x3d53ee[_0x8173('0x1f')]=_0x38291f;if(_0x3f4b[_0x8173('0x33')][_0x8173('0x42')]){_0x4992ce[_0x8173('0x43')]=[{'all':!![]}];}return db[_0x8173('0x2e')]['findAll'](_0x4992ce);})[_0x8173('0x26')](function(_0x43e27b){_0x3d53ee[_0x8173('0x44')]=_0x43e27b;return _0x3d53ee;})[_0x8173('0x26')](respondWithFilteredResult(_0x2a9cab,_0x4992ce))[_0x8173('0x45')](handleError(_0x2a9cab,null));};exports[_0x8173('0x46')]=function(_0x336a84,_0x5963eb){var _0x23d3b6={'raw':![],'where':{'id':_0x336a84[_0x8173('0x47')]['id']}},_0x472ffe={};_0x472ffe[_0x8173('0x31')]=_['keys'](db[_0x8173('0x2e')]['rawAttributes']);_0x472ffe[_0x8173('0x33')]=_[_0x8173('0x32')](_0x336a84[_0x8173('0x33')]);_0x472ffe['filters']=_[_0x8173('0x48')](_0x472ffe[_0x8173('0x31')],_0x472ffe[_0x8173('0x33')]);_0x23d3b6[_0x8173('0x35')]=_[_0x8173('0x48')](_0x472ffe['model'],qs[_0x8173('0x36')](_0x336a84[_0x8173('0x33')][_0x8173('0x36')]));_0x23d3b6['attributes']=_0x23d3b6[_0x8173('0x35')][_0x8173('0x37')]?_0x23d3b6['attributes']:_0x472ffe[_0x8173('0x31')];if(_0x336a84[_0x8173('0x33')][_0x8173('0x42')]){_0x23d3b6[_0x8173('0x43')]=[{'all':!![]}];}_0x23d3b6=_[_0x8173('0x40')]({},_0x23d3b6,_0x336a84[_0x8173('0x41')]);return db['AnalyticFieldReport'][_0x8173('0x49')](_0x23d3b6)[_0x8173('0x26')](handleEntityNotFound(_0x5963eb,null))[_0x8173('0x26')](respondWithResult(_0x5963eb,null))[_0x8173('0x45')](handleError(_0x5963eb,null));};exports['create']=function(_0x410134,_0xaeeb57){return db[_0x8173('0x2e')][_0x8173('0x4a')](_0x410134[_0x8173('0x4b')],{})[_0x8173('0x26')](respondWithResult(_0xaeeb57,0xc9))['catch'](handleError(_0xaeeb57,null));};exports[_0x8173('0x4c')]=function(_0x247a68,_0x2678bf){return db[_0x8173('0x2e')]['bulkCreate'](_0x247a68[_0x8173('0x4b')],{'raw':![],'individualHooks':!![]})[_0x8173('0x26')](respondWithResult(_0x2678bf,0xc9))[_0x8173('0x45')](handleError(_0x2678bf,null));};exports['update']=function(_0x2421d7,_0x549495){if(_0x2421d7[_0x8173('0x4b')]['id']){delete _0x2421d7[_0x8173('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x8173('0x49')]({'where':{'id':_0x2421d7[_0x8173('0x47')]['id']}})[_0x8173('0x26')](handleEntityNotFound(_0x549495,null))[_0x8173('0x26')](saveUpdates(_0x2421d7[_0x8173('0x4b')],null))['then'](respondWithResult(_0x549495,null))[_0x8173('0x45')](handleError(_0x549495,null));};exports[_0x8173('0x25')]=function(_0x4eda67,_0x482848){return db['AnalyticFieldReport'][_0x8173('0x49')]({'where':{'id':_0x4eda67[_0x8173('0x47')]['id']}})[_0x8173('0x26')](handleEntityNotFound(_0x482848,null))[_0x8173('0x26')](removeEntity(_0x482848,null))[_0x8173('0x45')](handleError(_0x482848,null));};exports[_0x8173('0x4d')]=function(_0x583933,_0x5edbea){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x583933['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8173('0x26')](respondWithResult(_0x5edbea,0xcc))['catch'](handleError(_0x5edbea,null));};exports[_0x8173('0x4e')]=function(_0x461550,_0x7a5f0e,_0x4ae7a9){return db[_0x8173('0x4f')]['findOne']({'where':{'id':_0x461550[_0x8173('0x47')]['id']}})['then'](handleEntityNotFound(_0x7a5f0e,null))[_0x8173('0x26')](function(_0x3beb5d){if(_0x3beb5d){return db[_0x8173('0x50')][_0x8173('0x51')](function(_0x21236a){return db[_0x8173('0x2e')]['destroy']({'where':{'CustomReportId':_0x461550[_0x8173('0x47')]['id']},'transaction':_0x21236a})[_0x8173('0x26')](function(_0x5eb432){var _0x577027=_[_0x8173('0x2d')](_0x461550[_0x8173('0x4b')],function(_0x4e0a6f){delete _0x4e0a6f['id'];_0x4e0a6f['CustomReportId']=_0x461550[_0x8173('0x47')]['id'];return _0x4e0a6f;});return db[_0x8173('0x2e')][_0x8173('0x4c')](_0x577027,{'transaction':_0x21236a});});})[_0x8173('0x26')](function(){return db[_0x8173('0x2e')][_0x8173('0x52')]({'where':{'CustomReportId':_0x461550[_0x8173('0x47')]['id']}});});}})[_0x8173('0x26')](respondWithResult(_0x7a5f0e,null))[_0x8173('0x45')](handleError(_0x7a5f0e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2d46b66..f43c6de 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 _0xd29a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x164cf2,_0x4fb3e0){var _0x50dfa1=function(_0x26ed61){while(--_0x26ed61){_0x164cf2['push'](_0x164cf2['shift']());}};_0x50dfa1(++_0x4fb3e0);}(_0xd29a,0xd0));var _0xad29=function(_0x4752d5,_0x272151){_0x4752d5=_0x4752d5-0x0;var _0x1979df=_0xd29a[_0x4752d5];return _0x1979df;};'use strict';var _=require(_0xad29('0x0'));var util=require('util');var logger=require(_0xad29('0x1'))(_0xad29('0x2'));var moment=require(_0xad29('0x3'));var BPromise=require(_0xad29('0x4'));var rp=require(_0xad29('0x5'));var fs=require('fs');var path=require(_0xad29('0x6'));var rimraf=require(_0xad29('0x7'));var config=require(_0xad29('0x8'));var attributes=require(_0xad29('0x9'));module[_0xad29('0xa')]=function(_0x11aa25,_0x387d30){return _0x11aa25[_0xad29('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0xad29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3566=['define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x3d79c1,_0x3e22b3){var _0x247907=function(_0x1630d1){while(--_0x1630d1){_0x3d79c1['push'](_0x3d79c1['shift']());}};_0x247907(++_0x3e22b3);}(_0x3566,0x13a));var _0x6356=function(_0x117460,_0x1445c1){_0x117460=_0x117460-0x0;var _0x7131ea=_0x3566[_0x117460];return _0x7131ea;};'use strict';var _=require(_0x6356('0x0'));var util=require(_0x6356('0x1'));var logger=require(_0x6356('0x2'))(_0x6356('0x3'));var moment=require(_0x6356('0x4'));var BPromise=require(_0x6356('0x5'));var rp=require(_0x6356('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6356('0x7'));var config=require(_0x6356('0x8'));var attributes=require(_0x6356('0x9'));module['exports']=function(_0x2c4859,_0x3d11c3){return _0x2c4859[_0x6356('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x6356('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 0359d51..acac290 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 _0x896b=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1b59ae,_0x427ceb){var _0x1c318b=function(_0x12b866){while(--_0x12b866){_0x1b59ae['push'](_0x1b59ae['shift']());}};_0x1c318b(++_0x427ceb);}(_0x896b,0xc4));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb896('0x0'));var moment=require('moment');var BPromise=require(_0xb896('0x1'));var rs=require(_0xb896('0x2'));var fs=require('fs');var Redis=require(_0xb896('0x3'));var db=require(_0xb896('0x4'))['db'];var utils=require(_0xb896('0x5'));var logger=require(_0xb896('0x6'))(_0xb896('0x7'));var config=require(_0xb896('0x8'));var jayson=require(_0xb896('0x9'));var client=jayson[_0xb896('0xa')][_0xb896('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x496650,_0x3ab5f3,_0x4d1c6d){return new BPromise(function(_0x1b141c,_0x202cfc){return client[_0xb896('0xc')](_0x496650,_0x4d1c6d)['then'](function(_0x28e3de){logger[_0xb896('0xd')](_0xb896('0xe'),_0x3ab5f3,_0xb896('0xf'));logger[_0xb896('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3ab5f3,_0xb896('0xf'),JSON['stringify'](_0x28e3de));if(_0x28e3de['error']){if(_0x28e3de[_0xb896('0x11')]['code']===0x1f4){logger[_0xb896('0x11')](_0xb896('0xe'),_0x3ab5f3,_0x28e3de[_0xb896('0x11')][_0xb896('0x12')]);return _0x202cfc(_0x28e3de['error'][_0xb896('0x12')]);}logger[_0xb896('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3ab5f3,_0x28e3de[_0xb896('0x11')][_0xb896('0x12')]);return _0x1b141c(_0x28e3de[_0xb896('0x11')][_0xb896('0x12')]);}else{logger[_0xb896('0xd')](_0xb896('0xe'),_0x3ab5f3,'request\x20sent');_0x1b141c(_0x28e3de['result']['message']);}})['catch'](function(_0x24571b){logger[_0xb896('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3ab5f3,_0x24571b);_0x202cfc(_0x24571b);});});} \ No newline at end of file +var _0x3889=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27a750,_0x36ba51){var _0x2f137c=function(_0x1708c6){while(--_0x1708c6){_0x27a750['push'](_0x27a750['shift']());}};_0x2f137c(++_0x36ba51);}(_0x3889,0x1dd));var _0x9388=function(_0x4f40e1,_0xa22f94){_0x4f40e1=_0x4f40e1-0x0;var _0x2e323d=_0x3889[_0x4f40e1];return _0x2e323d;};'use strict';var _=require('lodash');var util=require(_0x9388('0x0'));var moment=require(_0x9388('0x1'));var BPromise=require('bluebird');var rs=require(_0x9388('0x2'));var fs=require('fs');var Redis=require(_0x9388('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9388('0x4'));var logger=require(_0x9388('0x5'))(_0x9388('0x6'));var config=require(_0x9388('0x7'));var jayson=require(_0x9388('0x8'));var client=jayson['client'][_0x9388('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35030,_0x27f117,_0x41e856){return new BPromise(function(_0x895ec9,_0x1d5bb0){return client[_0x9388('0xa')](_0x35030,_0x41e856)[_0x9388('0xb')](function(_0x257c7b){logger[_0x9388('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x27f117,_0x9388('0xd'));logger[_0x9388('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x27f117,_0x9388('0xd'),JSON[_0x9388('0xf')](_0x257c7b));if(_0x257c7b[_0x9388('0x10')]){if(_0x257c7b[_0x9388('0x10')][_0x9388('0x11')]===0x1f4){logger[_0x9388('0x10')](_0x9388('0x12'),_0x27f117,_0x257c7b[_0x9388('0x10')]['message']);return _0x1d5bb0(_0x257c7b[_0x9388('0x10')][_0x9388('0x13')]);}logger[_0x9388('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x27f117,_0x257c7b[_0x9388('0x10')]['message']);return _0x895ec9(_0x257c7b[_0x9388('0x10')][_0x9388('0x13')]);}else{logger[_0x9388('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x27f117,_0x9388('0xd'));_0x895ec9(_0x257c7b[_0x9388('0x14')][_0x9388('0x13')]);}})[_0x9388('0x15')](function(_0x40855d){logger[_0x9388('0x10')](_0x9388('0x12'),_0x27f117,_0x40855d);_0x1d5bb0(_0x40855d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e033779..e1709dc 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(_0x3d4c6a,_0x4818b0){var _0x798173=function(_0x1a0f6c){while(--_0x1a0f6c){_0x3d4c6a['push'](_0x3d4c6a['shift']());}};_0x798173(++_0x4818b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x399d79,_0x11a3dc){var _0x37ee0d=function(_0xf52d2a){while(--_0xf52d2a){_0x399d79['push'](_0x399d79['shift']());}};_0x37ee0d(++_0x11a3dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 5ac0450..d285e4c 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 _0x8278=['STRING','name','sequelize','exports'];(function(_0xf9daca,_0x4a2fbd){var _0x2472de=function(_0xa90a99){while(--_0xa90a99){_0xf9daca['push'](_0xf9daca['shift']());}};_0x2472de(++_0x4a2fbd);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8827('0x0'));module[_0x8827('0x1')]={'name':{'type':Sequelize[_0x8827('0x2')],'allowNull':![],'unique':_0x8827('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x8827('0x2')]}}; \ No newline at end of file +var _0x5bc5=['STRING','name','TEXT','sequelize','exports'];(function(_0x736eb,_0x345088){var _0x30ea13=function(_0xbdab7c){while(--_0xbdab7c){_0x736eb['push'](_0x736eb['shift']());}};_0x30ea13(++_0x345088);}(_0x5bc5,0xb2));var _0x55bc=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x5bc5[_0x128450];return _0x4d80ed;};'use strict';var Sequelize=require(_0x55bc('0x0'));module[_0x55bc('0x1')]={'name':{'type':Sequelize[_0x55bc('0x2')],'allowNull':![],'unique':_0x55bc('0x3')},'table':{'type':Sequelize[_0x55bc('0x2')]},'metric':{'type':Sequelize[_0x55bc('0x4')]},'description':{'type':Sequelize[_0x55bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 43e496c..94a7dae 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 _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','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','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'];(function(_0x808374,_0x17d548){var _0x4e09ad=function(_0xbd0aee){while(--_0xbd0aee){_0x808374['push'](_0x808374['shift']());}};_0x4e09ad(++_0x17d548);}(_0x55ca,0x126));var _0xa55c=function(_0x24487f,_0x9b3ea0){_0x24487f=_0x24487f-0x0;var _0x456456=_0x55ca[_0x24487f];return _0x456456;};'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(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x63a32e,_0x37ab4e){var _0x152a74=function(_0x5911a1){while(--_0x5911a1){_0x63a32e['push'](_0x63a32e['shift']());}};_0x152a74(++_0x37ab4e);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 70ed35f..edb4197 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 _0x102b=['AnalyticMetric','analytics_metrics','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x102b,0x1be));var _0xb102=function(_0x585f24,_0x556130){_0x585f24=_0x585f24-0x0;var _0x345c12=_0x102b[_0x585f24];return _0x345c12;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var logger=require('../../config/logger')(_0xb102('0x1'));var moment=require(_0xb102('0x2'));var BPromise=require(_0xb102('0x3'));var rp=require(_0xb102('0x4'));var fs=require('fs');var path=require(_0xb102('0x5'));var rimraf=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var attributes=require(_0xb102('0x8'));module['exports']=function(_0x3325b7,_0x370baa){return _0x3325b7[_0xb102('0x9')](_0xb102('0xa'),attributes,{'tableName':_0xb102('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6075=['path','rimraf','../../config/environment','exports','analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x6075,0x191));var _0x5607=function(_0x184abd,_0x49b194){_0x184abd=_0x184abd-0x0;var _0x524c6d=_0x6075[_0x184abd];return _0x524c6d;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var logger=require(_0x5607('0x1'))(_0x5607('0x2'));var moment=require(_0x5607('0x3'));var BPromise=require(_0x5607('0x4'));var rp=require(_0x5607('0x5'));var fs=require('fs');var path=require(_0x5607('0x6'));var rimraf=require(_0x5607('0x7'));var config=require(_0x5607('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x5607('0x9')]=function(_0xabf691,_0x14b9f4){return _0xabf691['define']('AnalyticMetric',attributes,{'tableName':_0x5607('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 06ca073..e4d42b1 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 _0x9d22=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','AnalyticMetric,\x20%s,\x20%s','lodash','moment'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x9d22,0x18e));var _0x29d2=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0x9d22[_0x1dc01f];return _0x298041;};'use strict';var _=require(_0x29d2('0x0'));var util=require('util');var moment=require(_0x29d2('0x1'));var BPromise=require(_0x29d2('0x2'));var rs=require(_0x29d2('0x3'));var fs=require('fs');var Redis=require(_0x29d2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29d2('0x5'));var logger=require(_0x29d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x29d2('0x7'));var client=jayson['client'][_0x29d2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19bbd2,_0x6c8360,_0x478c9e){return new BPromise(function(_0x102669,_0x4ecf82){return client['request'](_0x19bbd2,_0x478c9e)[_0x29d2('0x9')](function(_0x4a20d3){logger[_0x29d2('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x6c8360,_0x29d2('0xb'));logger[_0x29d2('0xc')](_0x29d2('0xd'),_0x6c8360,_0x29d2('0xb'),JSON[_0x29d2('0xe')](_0x4a20d3));if(_0x4a20d3[_0x29d2('0xf')]){if(_0x4a20d3[_0x29d2('0xf')]['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x6c8360,_0x4a20d3[_0x29d2('0xf')][_0x29d2('0x10')]);return _0x4ecf82(_0x4a20d3[_0x29d2('0xf')]['message']);}logger[_0x29d2('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x6c8360,_0x4a20d3[_0x29d2('0xf')][_0x29d2('0x10')]);return _0x102669(_0x4a20d3[_0x29d2('0xf')][_0x29d2('0x10')]);}else{logger[_0x29d2('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x6c8360,_0x29d2('0xb'));_0x102669(_0x4a20d3[_0x29d2('0x11')][_0x29d2('0x10')]);}})[_0x29d2('0x12')](function(_0x45bba2){logger[_0x29d2('0xf')](_0x29d2('0x13'),_0x6c8360,_0x45bba2);_0x4ecf82(_0x45bba2);});});} \ No newline at end of file +var _0x7f87=['../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7f87,0x65));var _0x77f8=function(_0x43821a,_0x549fde){_0x43821a=_0x43821a-0x0;var _0x126d3e=_0x7f87[_0x43821a];return _0x126d3e;};'use strict';var _=require(_0x77f8('0x0'));var util=require(_0x77f8('0x1'));var moment=require(_0x77f8('0x2'));var BPromise=require(_0x77f8('0x3'));var rs=require(_0x77f8('0x4'));var fs=require('fs');var Redis=require(_0x77f8('0x5'));var db=require(_0x77f8('0x6'))['db'];var utils=require(_0x77f8('0x7'));var logger=require(_0x77f8('0x8'))('rpc');var config=require(_0x77f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x77f8('0xa')][_0x77f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44b59e,_0x316eea,_0x31ea4f){return new BPromise(function(_0x15098b,_0x22b3c9){return client[_0x77f8('0xc')](_0x44b59e,_0x31ea4f)[_0x77f8('0xd')](function(_0x5211a6){logger['info'](_0x77f8('0xe'),_0x316eea,_0x77f8('0xf'));logger['debug'](_0x77f8('0x10'),_0x316eea,'request\x20sent',JSON['stringify'](_0x5211a6));if(_0x5211a6[_0x77f8('0x11')]){if(_0x5211a6[_0x77f8('0x11')][_0x77f8('0x12')]===0x1f4){logger['error'](_0x77f8('0xe'),_0x316eea,_0x5211a6['error'][_0x77f8('0x13')]);return _0x22b3c9(_0x5211a6[_0x77f8('0x11')][_0x77f8('0x13')]);}logger[_0x77f8('0x11')](_0x77f8('0xe'),_0x316eea,_0x5211a6[_0x77f8('0x11')]['message']);return _0x15098b(_0x5211a6[_0x77f8('0x11')]['message']);}else{logger[_0x77f8('0x14')](_0x77f8('0xe'),_0x316eea,_0x77f8('0xf'));_0x15098b(_0x5211a6['result'][_0x77f8('0x13')]);}})[_0x77f8('0x15')](function(_0x51a469){logger[_0x77f8('0x11')](_0x77f8('0xe'),_0x316eea,_0x51a469);_0x22b3c9(_0x51a469);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2cc9dc6..fe9a8eb 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 _0xac9d=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xac9d,0x14d));var _0xdac9=function(_0x157a8a,_0x34d072){_0x157a8a=_0x157a8a-0x0;var _0x5bf33f=_0xac9d[_0x157a8a];return _0x5bf33f;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./analyticMetric.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['show']);router[_0xdac9('0xd')]('/',auth['isAuthenticated'](),controller[_0xdac9('0xe')]);router[_0xdac9('0xf')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x10')]);router[_0xdac9('0x11')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);module['exports']=router; \ No newline at end of file +var _0x455d=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x5866a9,_0x8e6869){var _0x4ca549=function(_0x10969d){while(--_0x10969d){_0x5866a9['push'](_0x5866a9['shift']());}};_0x4ca549(++_0x8e6869);}(_0x455d,0x190));var _0xd455=function(_0x4cccd7,_0x317cfd){_0x4cccd7=_0x4cccd7-0x0;var _0x118dcf=_0x455d[_0x4cccd7];return _0x118dcf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd455('0x0'));var timeout=require(_0xd455('0x1'));var express=require(_0xd455('0x2'));var router=express['Router']();var fs_extra=require(_0xd455('0x3'));var auth=require(_0xd455('0x4'));var interaction=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var controller=require(_0xd455('0x7'));router[_0xd455('0x8')]('/',auth[_0xd455('0x9')](),controller[_0xd455('0xa')]);router[_0xd455('0x8')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0xb')]);router['post']('/',auth[_0xd455('0x9')](),controller[_0xd455('0xc')]);router[_0xd455('0xd')](_0xd455('0xe'),auth['isAuthenticated'](),controller[_0xd455('0xf')]);router[_0xd455('0x10')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0x11')]);module[_0xd455('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d2fcc30..9deb262 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 _0xdbd8=['exports','TEXT','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdbd8,0x16a));var _0x8dbd=function(_0x5ed9db,_0x34bac8){_0x5ed9db=_0x5ed9db-0x0;var _0x2b2d23=_0xdbd8[_0x5ed9db];return _0x2b2d23;};'use strict';var Sequelize=require(_0x8dbd('0x0'));module[_0x8dbd('0x1')]={'tree':{'type':Sequelize[_0x8dbd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdfba=['exports','TEXT','sequelize'];(function(_0x14e239,_0x129be9){var _0x154c94=function(_0x4ea187){while(--_0x4ea187){_0x14e239['push'](_0x14e239['shift']());}};_0x154c94(++_0x129be9);}(_0xdfba,0x1cd));var _0xadfb=function(_0x422045,_0x3e8d52){_0x422045=_0x422045-0x0;var _0x44e444=_0xdfba[_0x422045];return _0x44e444;};'use strict';var Sequelize=require(_0xadfb('0x0'));module[_0xadfb('0x1')]={'tree':{'type':Sequelize[_0xadfb('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 b4fc5c4..5fac497 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 _0xc832=['status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','merge','VIRTUAL','options','where','include','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x21cf31,_0x12f02d){var _0xff513c=function(_0x1896f4){while(--_0x1896f4){_0x21cf31['push'](_0x21cf31['shift']());}};_0xff513c(++_0x12f02d);}(_0xc832,0x19d));var _0x2c83=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xc832[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require(_0x2c83('0x0'));var rimraf=require(_0x2c83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c83('0x2'));var rp=require(_0x2c83('0x3'));var moment=require('moment');var BPromise=require(_0x2c83('0x4'));var Mustache=require(_0x2c83('0x5'));var util=require(_0x2c83('0x6'));var path=require(_0x2c83('0x7'));var sox=require(_0x2c83('0x8'));var csv=require(_0x2c83('0x9'));var ejs=require(_0x2c83('0xa'));var fs=require('fs');var fs_extra=require(_0x2c83('0xb'));var _=require(_0x2c83('0xc'));var squel=require(_0x2c83('0xd'));var crypto=require(_0x2c83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2c83('0xf'));var toCsv=require(_0x2c83('0x9'));var querystring=require(_0x2c83('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c83('0x11'));var authService=require(_0x2c83('0x12'));var qs=require(_0x2c83('0x13'));var as=require(_0x2c83('0x14'));var hardwareService=require(_0x2c83('0x15'));var logger=require('../../config/logger')(_0x2c83('0x16'));var utils=require('../../config/utils');var config=require(_0x2c83('0x17'));var licenseUtil=require(_0x2c83('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d3eb,_0x4cab5a){_0x4cab5a=_0x4cab5a||0xcc;return function(_0x1d6e06){if(_0x1d6e06){return _0x48d3eb['sendStatus'](_0x4cab5a);}return _0x48d3eb[_0x2c83('0x19')](_0x4cab5a)[_0x2c83('0x1a')]();};}function respondWithResult(_0x23ad21,_0x2adc28){_0x2adc28=_0x2adc28||0xc8;return function(_0x2b7479){if(_0x2b7479){return _0x23ad21[_0x2c83('0x19')](_0x2adc28)[_0x2c83('0x1b')](_0x2b7479);}};}function respondWithFilteredResult(_0x5ee9ef,_0x2f6326){return function(_0x4bc4b8){if(_0x4bc4b8){var _0x37e58b=typeof _0x2f6326[_0x2c83('0x1c')]==='undefined'&&typeof _0x2f6326[_0x2c83('0x1d')]===_0x2c83('0x1e');var _0x1f25c5=_0x4bc4b8[_0x2c83('0x1f')];var _0x2b2b70=_0x37e58b?0x0:_0x2f6326[_0x2c83('0x1c')];var _0x23f42b=_0x37e58b?_0x4bc4b8[_0x2c83('0x1f')]:_0x2f6326[_0x2c83('0x1c')]+_0x2f6326[_0x2c83('0x1d')];var _0x294d26;if(_0x23f42b>=_0x1f25c5){_0x23f42b=_0x1f25c5;_0x294d26=0xc8;}else{_0x294d26=0xce;}_0x5ee9ef[_0x2c83('0x19')](_0x294d26);return _0x5ee9ef[_0x2c83('0x20')]('Content-Range',_0x2b2b70+'-'+_0x23f42b+'/'+_0x1f25c5)[_0x2c83('0x1b')](_0x4bc4b8);}return null;};}function patchUpdates(_0x979fa8){return function(_0x122cd4){try{jsonpatch['apply'](_0x122cd4,_0x979fa8,!![]);}catch(_0x811ed1){return BPromise[_0x2c83('0x21')](_0x811ed1);}return _0x122cd4[_0x2c83('0x22')]();};}function saveUpdates(_0x5a5503,_0x1c0081){return function(_0x3868cf){if(_0x3868cf){return _0x3868cf[_0x2c83('0x23')](_0x5a5503)[_0x2c83('0x24')](function(_0x4a03b5){return _0x4a03b5;});}return null;};}function removeEntity(_0xa97b4c,_0x4595fa){return function(_0x48059e){if(_0x48059e){return _0x48059e[_0x2c83('0x25')]()[_0x2c83('0x24')](function(){_0xa97b4c[_0x2c83('0x19')](0xcc)[_0x2c83('0x1a')]();});}};}function handleEntityNotFound(_0x2efafc,_0x5f89ab){return function(_0x349254){if(!_0x349254){_0x2efafc[_0x2c83('0x26')](0x194);}return _0x349254;};}function handleError(_0x203d8e,_0x2b08eb){_0x2b08eb=_0x2b08eb||0x1f4;return function(_0x428512){logger['error'](_0x428512[_0x2c83('0x27')]);if(_0x428512[_0x2c83('0x28')]){delete _0x428512['name'];}_0x203d8e[_0x2c83('0x19')](_0x2b08eb)[_0x2c83('0x29')](_0x428512);};}exports[_0x2c83('0x2a')]=function(_0xdbf804,_0x534910){var _0x4b0c46={},_0x1d1081={},_0x455242={'count':0x0,'rows':[]};var _0x5d88c0=_[_0x2c83('0x2b')](db[_0x2c83('0x2c')][_0x2c83('0x2d')],function(_0x5801a8){return{'name':_0x5801a8[_0x2c83('0x2e')],'type':_0x5801a8[_0x2c83('0x2f')]['key']};});_0x1d1081[_0x2c83('0x30')]=_[_0x2c83('0x2b')](_0x5d88c0,_0x2c83('0x28'));_0x1d1081[_0x2c83('0x31')]=_[_0x2c83('0x32')](_0xdbf804[_0x2c83('0x31')]);_0x1d1081[_0x2c83('0x33')]=_['intersection'](_0x1d1081[_0x2c83('0x30')],_0x1d1081[_0x2c83('0x31')]);_0x4b0c46[_0x2c83('0x34')]=_[_0x2c83('0x35')](_0x1d1081[_0x2c83('0x30')],qs[_0x2c83('0x36')](_0xdbf804[_0x2c83('0x31')][_0x2c83('0x36')]));_0x4b0c46[_0x2c83('0x34')]=_0x4b0c46[_0x2c83('0x34')][_0x2c83('0x37')]?_0x4b0c46['attributes']:_0x1d1081[_0x2c83('0x30')];if(!_0xdbf804[_0x2c83('0x31')]['hasOwnProperty']('nolimit')){_0x4b0c46[_0x2c83('0x1d')]=qs[_0x2c83('0x1d')](_0xdbf804[_0x2c83('0x31')][_0x2c83('0x1d')]);_0x4b0c46[_0x2c83('0x1c')]=qs[_0x2c83('0x1c')](_0xdbf804[_0x2c83('0x31')][_0x2c83('0x1c')]);}_0x4b0c46[_0x2c83('0x38')]=qs[_0x2c83('0x39')](_0xdbf804[_0x2c83('0x31')]['sort']);_0x4b0c46['where']=qs['filters'](_[_0x2c83('0x3a')](_0xdbf804['query'],_0x1d1081['filters']),_0x5d88c0);if(_0xdbf804['query'][_0x2c83('0x3b')]){_0x4b0c46['where']=_[_0x2c83('0x3c')](_0x4b0c46['where'],{'$or':_[_0x2c83('0x2b')](_0x5d88c0,function(_0x176d1e){if(_0x176d1e[_0x2c83('0x2f')]!==_0x2c83('0x3d')){var _0x50b7d3={};_0x50b7d3[_0x176d1e[_0x2c83('0x28')]]={'$like':'%'+_0xdbf804[_0x2c83('0x31')][_0x2c83('0x3b')]+'%'};return _0x50b7d3;}})});}_0x4b0c46=_[_0x2c83('0x3c')]({},_0x4b0c46,_0xdbf804[_0x2c83('0x3e')]);var _0x20ec65={'where':_0x4b0c46[_0x2c83('0x3f')]};return db[_0x2c83('0x2c')][_0x2c83('0x1f')](_0x20ec65)['then'](function(_0x1593c5){_0x455242[_0x2c83('0x1f')]=_0x1593c5;if(_0xdbf804[_0x2c83('0x31')]['includeAll']){_0x4b0c46[_0x2c83('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x4b0c46);})[_0x2c83('0x24')](function(_0x49edfc){_0x455242[_0x2c83('0x41')]=_0x49edfc;return _0x455242;})[_0x2c83('0x24')](respondWithFilteredResult(_0x534910,_0x4b0c46))[_0x2c83('0x42')](handleError(_0x534910,null));};exports[_0x2c83('0x43')]=function(_0x450b6b,_0x4c3365){var _0xdaca4d={'raw':!![],'where':{'id':_0x450b6b['params']['id']}},_0x47539b={};_0x47539b['model']=_[_0x2c83('0x32')](db['AnalyticTreeReport'][_0x2c83('0x2d')]);_0x47539b[_0x2c83('0x31')]=_[_0x2c83('0x32')](_0x450b6b['query']);_0x47539b[_0x2c83('0x33')]=_[_0x2c83('0x35')](_0x47539b[_0x2c83('0x30')],_0x47539b[_0x2c83('0x31')]);_0xdaca4d[_0x2c83('0x34')]=_[_0x2c83('0x35')](_0x47539b['model'],qs[_0x2c83('0x36')](_0x450b6b[_0x2c83('0x31')][_0x2c83('0x36')]));_0xdaca4d['attributes']=_0xdaca4d['attributes'][_0x2c83('0x37')]?_0xdaca4d[_0x2c83('0x34')]:_0x47539b[_0x2c83('0x30')];if(_0x450b6b['query'][_0x2c83('0x44')]){_0xdaca4d[_0x2c83('0x40')]=[{'all':!![]}];}_0xdaca4d=_[_0x2c83('0x3c')]({},_0xdaca4d,_0x450b6b[_0x2c83('0x3e')]);return db[_0x2c83('0x2c')][_0x2c83('0x45')](_0xdaca4d)[_0x2c83('0x24')](handleEntityNotFound(_0x4c3365,null))[_0x2c83('0x24')](respondWithResult(_0x4c3365,null))[_0x2c83('0x42')](handleError(_0x4c3365,null));};exports[_0x2c83('0x46')]=function(_0xdc439a,_0x5e5541){return db[_0x2c83('0x2c')]['create'](_0xdc439a[_0x2c83('0x47')],{})[_0x2c83('0x24')](respondWithResult(_0x5e5541,0xc9))[_0x2c83('0x42')](handleError(_0x5e5541,null));};exports[_0x2c83('0x23')]=function(_0x116fa0,_0x417617){if(_0x116fa0[_0x2c83('0x47')]['id']){delete _0x116fa0[_0x2c83('0x47')]['id'];}return db[_0x2c83('0x2c')][_0x2c83('0x45')]({'where':{'id':_0x116fa0[_0x2c83('0x48')]['id']}})['then'](handleEntityNotFound(_0x417617,null))[_0x2c83('0x24')](saveUpdates(_0x116fa0[_0x2c83('0x47')],null))[_0x2c83('0x24')](respondWithResult(_0x417617,null))[_0x2c83('0x42')](handleError(_0x417617,null));};exports[_0x2c83('0x25')]=function(_0x251494,_0x56cc2b){return db['AnalyticTreeReport'][_0x2c83('0x45')]({'where':{'id':_0x251494[_0x2c83('0x48')]['id']}})[_0x2c83('0x24')](handleEntityNotFound(_0x56cc2b,null))['then'](removeEntity(_0x56cc2b,null))[_0x2c83('0x42')](handleError(_0x56cc2b,null));}; \ No newline at end of file +var _0xaf54=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','key','keys'];(function(_0x2efa93,_0x4e18c4){var _0x42c19d=function(_0x4837d2){while(--_0x4837d2){_0x2efa93['push'](_0x2efa93['shift']());}};_0x42c19d(++_0x4e18c4);}(_0xaf54,0x191));var _0x4af5=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xaf54[_0x15fc7a];return _0x3aa9f4;};'use strict';var emlformat=require(_0x4af5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4af5('0x1'));var jsonpatch=require(_0x4af5('0x2'));var rp=require('request-promise');var moment=require(_0x4af5('0x3'));var BPromise=require(_0x4af5('0x4'));var Mustache=require(_0x4af5('0x5'));var util=require(_0x4af5('0x6'));var path=require(_0x4af5('0x7'));var sox=require('sox');var csv=require(_0x4af5('0x8'));var ejs=require(_0x4af5('0x9'));var fs=require('fs');var fs_extra=require(_0x4af5('0xa'));var _=require(_0x4af5('0xb'));var squel=require('squel');var crypto=require(_0x4af5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4af5('0xd'));var toCsv=require(_0x4af5('0x8'));var querystring=require(_0x4af5('0xe'));var Papa=require(_0x4af5('0xf'));var Redis=require(_0x4af5('0x10'));var authService=require(_0x4af5('0x11'));var qs=require(_0x4af5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4af5('0x13'));var logger=require('../../config/logger')(_0x4af5('0x14'));var utils=require(_0x4af5('0x15'));var config=require(_0x4af5('0x16'));var licenseUtil=require(_0x4af5('0x17'));var db=require(_0x4af5('0x18'))['db'];function respondWithStatusCode(_0x446799,_0x51a5fb){_0x51a5fb=_0x51a5fb||0xcc;return function(_0x3f12a0){if(_0x3f12a0){return _0x446799[_0x4af5('0x19')](_0x51a5fb);}return _0x446799[_0x4af5('0x1a')](_0x51a5fb)[_0x4af5('0x1b')]();};}function respondWithResult(_0x30fdaf,_0x18c9d7){_0x18c9d7=_0x18c9d7||0xc8;return function(_0x33fc4d){if(_0x33fc4d){return _0x30fdaf[_0x4af5('0x1a')](_0x18c9d7)[_0x4af5('0x1c')](_0x33fc4d);}};}function respondWithFilteredResult(_0x1c8c56,_0x1c4931){return function(_0x374980){if(_0x374980){var _0x177e67=typeof _0x1c4931[_0x4af5('0x1d')]==='undefined'&&typeof _0x1c4931[_0x4af5('0x1e')]===_0x4af5('0x1f');var _0x2b8e50=_0x374980[_0x4af5('0x20')];var _0x73e3f=_0x177e67?0x0:_0x1c4931[_0x4af5('0x1d')];var _0x212526=_0x177e67?_0x374980[_0x4af5('0x20')]:_0x1c4931['offset']+_0x1c4931[_0x4af5('0x1e')];var _0x2e41f7;if(_0x212526>=_0x2b8e50){_0x212526=_0x2b8e50;_0x2e41f7=0xc8;}else{_0x2e41f7=0xce;}_0x1c8c56[_0x4af5('0x1a')](_0x2e41f7);return _0x1c8c56[_0x4af5('0x21')](_0x4af5('0x22'),_0x73e3f+'-'+_0x212526+'/'+_0x2b8e50)[_0x4af5('0x1c')](_0x374980);}return null;};}function patchUpdates(_0x4e1142){return function(_0x28b15f){try{jsonpatch[_0x4af5('0x23')](_0x28b15f,_0x4e1142,!![]);}catch(_0x34e703){return BPromise['reject'](_0x34e703);}return _0x28b15f['save']();};}function saveUpdates(_0x1e9dca,_0x28ece3){return function(_0x492763){if(_0x492763){return _0x492763[_0x4af5('0x24')](_0x1e9dca)[_0x4af5('0x25')](function(_0x47a328){return _0x47a328;});}return null;};}function removeEntity(_0x11372c,_0x8f9ac9){return function(_0x246d9c){if(_0x246d9c){return _0x246d9c[_0x4af5('0x26')]()[_0x4af5('0x25')](function(){_0x11372c['status'](0xcc)[_0x4af5('0x1b')]();});}};}function handleEntityNotFound(_0x5359c8,_0x10b699){return function(_0x415ab2){if(!_0x415ab2){_0x5359c8['sendStatus'](0x194);}return _0x415ab2;};}function handleError(_0x1b4310,_0xc5d7a){_0xc5d7a=_0xc5d7a||0x1f4;return function(_0x505b1a){logger[_0x4af5('0x27')](_0x505b1a[_0x4af5('0x28')]);if(_0x505b1a[_0x4af5('0x29')]){delete _0x505b1a[_0x4af5('0x29')];}_0x1b4310[_0x4af5('0x1a')](_0xc5d7a)[_0x4af5('0x2a')](_0x505b1a);};}exports[_0x4af5('0x2b')]=function(_0x455aec,_0x14a86f){var _0x3bfd3f={},_0x501a9b={},_0x37d6f3={'count':0x0,'rows':[]};var _0x225ba6=_[_0x4af5('0x2c')](db[_0x4af5('0x2d')][_0x4af5('0x2e')],function(_0x5187dc){return{'name':_0x5187dc['fieldName'],'type':_0x5187dc['type'][_0x4af5('0x2f')]};});_0x501a9b['model']=_[_0x4af5('0x2c')](_0x225ba6,'name');_0x501a9b['query']=_[_0x4af5('0x30')](_0x455aec[_0x4af5('0x31')]);_0x501a9b[_0x4af5('0x32')]=_[_0x4af5('0x33')](_0x501a9b[_0x4af5('0x34')],_0x501a9b['query']);_0x3bfd3f[_0x4af5('0x35')]=_['intersection'](_0x501a9b[_0x4af5('0x34')],qs[_0x4af5('0x36')](_0x455aec[_0x4af5('0x31')]['fields']));_0x3bfd3f[_0x4af5('0x35')]=_0x3bfd3f['attributes'][_0x4af5('0x37')]?_0x3bfd3f['attributes']:_0x501a9b[_0x4af5('0x34')];if(!_0x455aec[_0x4af5('0x31')][_0x4af5('0x38')](_0x4af5('0x39'))){_0x3bfd3f['limit']=qs[_0x4af5('0x1e')](_0x455aec[_0x4af5('0x31')][_0x4af5('0x1e')]);_0x3bfd3f[_0x4af5('0x1d')]=qs['offset'](_0x455aec[_0x4af5('0x31')]['offset']);}_0x3bfd3f[_0x4af5('0x3a')]=qs['sort'](_0x455aec['query'][_0x4af5('0x3b')]);_0x3bfd3f[_0x4af5('0x3c')]=qs[_0x4af5('0x32')](_[_0x4af5('0x3d')](_0x455aec[_0x4af5('0x31')],_0x501a9b['filters']),_0x225ba6);if(_0x455aec[_0x4af5('0x31')][_0x4af5('0x3e')]){_0x3bfd3f[_0x4af5('0x3c')]=_[_0x4af5('0x3f')](_0x3bfd3f[_0x4af5('0x3c')],{'$or':_['map'](_0x225ba6,function(_0xddd75e){if(_0xddd75e[_0x4af5('0x40')]!==_0x4af5('0x41')){var _0x5b138c={};_0x5b138c[_0xddd75e[_0x4af5('0x29')]]={'$like':'%'+_0x455aec['query'][_0x4af5('0x3e')]+'%'};return _0x5b138c;}})});}_0x3bfd3f=_[_0x4af5('0x3f')]({},_0x3bfd3f,_0x455aec[_0x4af5('0x42')]);var _0x130fa8={'where':_0x3bfd3f[_0x4af5('0x3c')]};return db[_0x4af5('0x2d')][_0x4af5('0x20')](_0x130fa8)[_0x4af5('0x25')](function(_0xda7007){_0x37d6f3[_0x4af5('0x20')]=_0xda7007;if(_0x455aec[_0x4af5('0x31')]['includeAll']){_0x3bfd3f[_0x4af5('0x43')]=[{'all':!![]}];}return db[_0x4af5('0x2d')][_0x4af5('0x44')](_0x3bfd3f);})['then'](function(_0x526620){_0x37d6f3['rows']=_0x526620;return _0x37d6f3;})['then'](respondWithFilteredResult(_0x14a86f,_0x3bfd3f))[_0x4af5('0x45')](handleError(_0x14a86f,null));};exports[_0x4af5('0x46')]=function(_0x2b0d21,_0x4966d1){var _0x5834b3={'raw':!![],'where':{'id':_0x2b0d21['params']['id']}},_0x35bc85={};_0x35bc85[_0x4af5('0x34')]=_[_0x4af5('0x30')](db['AnalyticTreeReport'][_0x4af5('0x2e')]);_0x35bc85[_0x4af5('0x31')]=_[_0x4af5('0x30')](_0x2b0d21[_0x4af5('0x31')]);_0x35bc85[_0x4af5('0x32')]=_[_0x4af5('0x33')](_0x35bc85[_0x4af5('0x34')],_0x35bc85[_0x4af5('0x31')]);_0x5834b3[_0x4af5('0x35')]=_[_0x4af5('0x33')](_0x35bc85['model'],qs[_0x4af5('0x36')](_0x2b0d21[_0x4af5('0x31')][_0x4af5('0x36')]));_0x5834b3['attributes']=_0x5834b3['attributes']['length']?_0x5834b3[_0x4af5('0x35')]:_0x35bc85[_0x4af5('0x34')];if(_0x2b0d21[_0x4af5('0x31')]['includeAll']){_0x5834b3[_0x4af5('0x43')]=[{'all':!![]}];}_0x5834b3=_[_0x4af5('0x3f')]({},_0x5834b3,_0x2b0d21['options']);return db[_0x4af5('0x2d')][_0x4af5('0x47')](_0x5834b3)['then'](handleEntityNotFound(_0x4966d1,null))[_0x4af5('0x25')](respondWithResult(_0x4966d1,null))['catch'](handleError(_0x4966d1,null));};exports[_0x4af5('0x48')]=function(_0x160f42,_0x51d25f){return db[_0x4af5('0x2d')][_0x4af5('0x48')](_0x160f42[_0x4af5('0x49')],{})[_0x4af5('0x25')](respondWithResult(_0x51d25f,0xc9))[_0x4af5('0x45')](handleError(_0x51d25f,null));};exports[_0x4af5('0x24')]=function(_0x262939,_0x4f9931){if(_0x262939['body']['id']){delete _0x262939['body']['id'];}return db[_0x4af5('0x2d')][_0x4af5('0x47')]({'where':{'id':_0x262939[_0x4af5('0x4a')]['id']}})[_0x4af5('0x25')](handleEntityNotFound(_0x4f9931,null))[_0x4af5('0x25')](saveUpdates(_0x262939['body'],null))[_0x4af5('0x25')](respondWithResult(_0x4f9931,null))['catch'](handleError(_0x4f9931,null));};exports[_0x4af5('0x26')]=function(_0x56d08f,_0x57036a){return db['AnalyticTreeReport'][_0x4af5('0x47')]({'where':{'id':_0x56d08f[_0x4af5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57036a,null))[_0x4af5('0x25')](removeEntity(_0x57036a,null))[_0x4af5('0x45')](handleError(_0x57036a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f6d253b..790a5d2 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 _0x0d8f=['rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird','path'];(function(_0x4663ac,_0x2e190b){var _0x101ee6=function(_0x1dfd01){while(--_0x1dfd01){_0x4663ac['push'](_0x4663ac['shift']());}};_0x101ee6(++_0x2e190b);}(_0x0d8f,0x119));var _0xf0d8=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x0d8f[_0x2dc7c9];return _0x3e6536;};'use strict';var _=require(_0xf0d8('0x0'));var util=require(_0xf0d8('0x1'));var logger=require(_0xf0d8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf0d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d8('0x4'));var rimraf=require(_0xf0d8('0x5'));var config=require('../../config/environment');var attributes=require(_0xf0d8('0x6'));module[_0xf0d8('0x7')]=function(_0x3746ea,_0x3d31ce){return _0x3746ea[_0xf0d8('0x8')](_0xf0d8('0x9'),attributes,{'tableName':_0xf0d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9566=['analytics_report_trees','lodash','util','api','request-promise','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9566,0x1f0));var _0x6956=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9566[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6956('0x0'));var util=require(_0x6956('0x1'));var logger=require('../../config/logger')(_0x6956('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6956('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6956('0x4'));module[_0x6956('0x5')]=function(_0x1e61d9,_0x26be16){return _0x1e61d9[_0x6956('0x6')](_0x6956('0x7'),attributes,{'tableName':_0x6956('0x8'),'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 d91aa6a..88a3153 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x95e21d,_0x36861e){var _0x3fd266=function(_0x4857bb){while(--_0x4857bb){_0x95e21d['push'](_0x95e21d['shift']());}};_0x3fd266(++_0x36861e);}(_0xadb5,0xad));var _0x5adb=function(_0x126eef,_0x49e6f8){_0x126eef=_0x126eef-0x0;var _0x48c08d=_0xadb5[_0x126eef];return _0x48c08d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4b17bd,_0x36025c){var _0x521516=function(_0x12f4f){while(--_0x12f4f){_0x4b17bd['push'](_0x4b17bd['shift']());}};_0x521516(++_0x36025c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52bf5a,_0x47bb35){_0x52bf5a=_0x52bf5a-0x0;var _0xd5b6e8=_0x5f2f[_0x52bf5a];return _0xd5b6e8;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 87811eb..e84f507 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 _0x22d6=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x5c8280,_0x3e020c){var _0xec4820=function(_0x193173){while(--_0x193173){_0x5c8280['push'](_0x5c8280['shift']());}};_0xec4820(++_0x3e020c);}(_0x22d6,0x182));var _0x622d=function(_0x203cf5,_0x8421e0){_0x203cf5=_0x203cf5-0x0;var _0x17a51d=_0x22d6[_0x203cf5];return _0x17a51d;};'use strict';var multer=require(_0x622d('0x0'));var util=require(_0x622d('0x1'));var path=require('path');var timeout=require(_0x622d('0x2'));var express=require(_0x622d('0x3'));var router=express['Router']();var fs_extra=require(_0x622d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x622d('0x5'));var config=require(_0x622d('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x622d('0x7')]('/',auth[_0x622d('0x8')](),controller[_0x622d('0x9')]);router['get'](_0x622d('0xa'),auth[_0x622d('0x8')](),controller[_0x622d('0xb')]);router['post']('/',auth[_0x622d('0x8')](),controller[_0x622d('0xc')]);router[_0x622d('0xd')](_0x622d('0xa'),auth['isAuthenticated'](),controller[_0x622d('0xe')]);router[_0x622d('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x622d('0x10')]=router; \ No newline at end of file +var _0x0365=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','put','update','delete','/:id','multer','util','path','express'];(function(_0x428c2f,_0x1ca58d){var _0x57a1d1=function(_0x1114b8){while(--_0x1114b8){_0x428c2f['push'](_0x428c2f['shift']());}};_0x57a1d1(++_0x1ca58d);}(_0x0365,0x12c));var _0x5036=function(_0x12baa8,_0x43ce92){_0x12baa8=_0x12baa8-0x0;var _0x49e7b7=_0x0365[_0x12baa8];return _0x49e7b7;};'use strict';var multer=require(_0x5036('0x0'));var util=require(_0x5036('0x1'));var path=require(_0x5036('0x2'));var timeout=require('connect-timeout');var express=require(_0x5036('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5036('0x4'));var interaction=require(_0x5036('0x5'));var config=require(_0x5036('0x6'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x5036('0x7')](),controller[_0x5036('0x8')]);router[_0x5036('0x9')]('/:id',auth[_0x5036('0x7')](),controller[_0x5036('0xa')]);router[_0x5036('0xb')]('/',auth[_0x5036('0x7')](),controller['create']);router[_0x5036('0xc')]('/:id',auth[_0x5036('0x7')](),controller[_0x5036('0xd')]);router[_0x5036('0xe')](_0x5036('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9b00c1d..c046b57 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 _0x758e=['STRING','sequelize'];(function(_0x53a167,_0x4bf6c7){var _0x150263=function(_0x422191){while(--_0x422191){_0x53a167['push'](_0x53a167['shift']());}};_0x150263(++_0x4bf6c7);}(_0x758e,0x1af));var _0xe758=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x758e[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xe758('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe758('0x1')]},'type':{'type':Sequelize[_0xe758('0x1')]}}; \ No newline at end of file +var _0x616c=['exports','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x616c,0x1b6));var _0xc616=function(_0x42177a,_0x488f2f){_0x42177a=_0x42177a-0x0;var _0x43aeac=_0x616c[_0x42177a];return _0x43aeac;};'use strict';var Sequelize=require('sequelize');module[_0xc616('0x0')]={'name':{'type':Sequelize[_0xc616('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc616('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e79af8f..c9dfac0 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 _0xa7f8=['params','fields','find','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x5b2914,_0x2c4bb9){var _0x4fd96b=function(_0x347b7b){while(--_0x347b7b){_0x5b2914['push'](_0x5b2914['shift']());}};_0x4fd96b(++_0x2c4bb9);}(_0xa7f8,0xc4));var _0x8a7f=function(_0x14b268,_0xc29a1a){_0x14b268=_0x14b268-0x0;var _0x58fd2a=_0xa7f8[_0x14b268];return _0x58fd2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a7f('0x0'));var zipdir=require(_0x8a7f('0x1'));var jsonpatch=require(_0x8a7f('0x2'));var rp=require(_0x8a7f('0x3'));var moment=require(_0x8a7f('0x4'));var BPromise=require(_0x8a7f('0x5'));var Mustache=require(_0x8a7f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8a7f('0x7'));var csv=require(_0x8a7f('0x8'));var ejs=require(_0x8a7f('0x9'));var fs=require('fs');var fs_extra=require(_0x8a7f('0xa'));var _=require(_0x8a7f('0xb'));var squel=require(_0x8a7f('0xc'));var crypto=require(_0x8a7f('0xd'));var jsforce=require(_0x8a7f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8a7f('0x8'));var querystring=require(_0x8a7f('0xf'));var Papa=require(_0x8a7f('0x10'));var Redis=require(_0x8a7f('0x11'));var authService=require(_0x8a7f('0x12'));var qs=require(_0x8a7f('0x13'));var as=require(_0x8a7f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a7f('0x15'))('api');var utils=require(_0x8a7f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8a7f('0x17'));var db=require(_0x8a7f('0x18'))['db'];function respondWithStatusCode(_0x883208,_0x500f8a){_0x500f8a=_0x500f8a||0xcc;return function(_0x14e036){if(_0x14e036){return _0x883208[_0x8a7f('0x19')](_0x500f8a);}return _0x883208[_0x8a7f('0x1a')](_0x500f8a)[_0x8a7f('0x1b')]();};}function respondWithResult(_0x4e23bc,_0x29ef6e){_0x29ef6e=_0x29ef6e||0xc8;return function(_0x3c7c70){if(_0x3c7c70){return _0x4e23bc[_0x8a7f('0x1a')](_0x29ef6e)[_0x8a7f('0x1c')](_0x3c7c70);}};}function respondWithFilteredResult(_0x2aba3c,_0x1f4a74){return function(_0x14eac0){if(_0x14eac0){var _0x3436bc=typeof _0x1f4a74[_0x8a7f('0x1d')]===_0x8a7f('0x1e')&&typeof _0x1f4a74[_0x8a7f('0x1f')]===_0x8a7f('0x1e');var _0x1130ec=_0x14eac0[_0x8a7f('0x20')];var _0x18cf62=_0x3436bc?0x0:_0x1f4a74[_0x8a7f('0x1d')];var _0x2c3f8c=_0x3436bc?_0x14eac0[_0x8a7f('0x20')]:_0x1f4a74[_0x8a7f('0x1d')]+_0x1f4a74[_0x8a7f('0x1f')];var _0x1f0991;if(_0x2c3f8c>=_0x1130ec){_0x2c3f8c=_0x1130ec;_0x1f0991=0xc8;}else{_0x1f0991=0xce;}_0x2aba3c[_0x8a7f('0x1a')](_0x1f0991);return _0x2aba3c[_0x8a7f('0x21')](_0x8a7f('0x22'),_0x18cf62+'-'+_0x2c3f8c+'/'+_0x1130ec)[_0x8a7f('0x1c')](_0x14eac0);}return null;};}function patchUpdates(_0x5ac459){return function(_0x924724){try{jsonpatch[_0x8a7f('0x23')](_0x924724,_0x5ac459,!![]);}catch(_0x2d01ba){return BPromise['reject'](_0x2d01ba);}return _0x924724[_0x8a7f('0x24')]();};}function saveUpdates(_0xb3a1c7,_0x49d3bd){return function(_0x301f31){if(_0x301f31){return _0x301f31[_0x8a7f('0x25')](_0xb3a1c7)[_0x8a7f('0x26')](function(_0xe83399){return _0xe83399;});}return null;};}function removeEntity(_0x2c83ae,_0x8c00aa){return function(_0x2d5cbe){if(_0x2d5cbe){return _0x2d5cbe[_0x8a7f('0x27')]()[_0x8a7f('0x26')](function(){_0x2c83ae[_0x8a7f('0x1a')](0xcc)[_0x8a7f('0x1b')]();});}};}function handleEntityNotFound(_0x11eb1f,_0x2f1f78){return function(_0x444b7c){if(!_0x444b7c){_0x11eb1f[_0x8a7f('0x19')](0x194);}return _0x444b7c;};}function handleError(_0x34d4d6,_0x119ae4){_0x119ae4=_0x119ae4||0x1f4;return function(_0x39038b){logger[_0x8a7f('0x28')](_0x39038b['stack']);if(_0x39038b[_0x8a7f('0x29')]){delete _0x39038b[_0x8a7f('0x29')];}_0x34d4d6[_0x8a7f('0x1a')](_0x119ae4)[_0x8a7f('0x2a')](_0x39038b);};}exports['index']=function(_0x4c8c8f,_0x17eeb1){var _0x3a3a85={},_0x40ef13={},_0x4060c6={'count':0x0,'rows':[]};var _0x2329bd=_['map'](db[_0x8a7f('0x2b')][_0x8a7f('0x2c')],function(_0x14f848){return{'name':_0x14f848[_0x8a7f('0x2d')],'type':_0x14f848[_0x8a7f('0x2e')][_0x8a7f('0x2f')]};});_0x40ef13['model']=_['map'](_0x2329bd,'name');_0x40ef13[_0x8a7f('0x30')]=_[_0x8a7f('0x31')](_0x4c8c8f[_0x8a7f('0x30')]);_0x40ef13[_0x8a7f('0x32')]=_[_0x8a7f('0x33')](_0x40ef13[_0x8a7f('0x34')],_0x40ef13['query']);_0x3a3a85[_0x8a7f('0x35')]=_[_0x8a7f('0x33')](_0x40ef13[_0x8a7f('0x34')],qs['fields'](_0x4c8c8f[_0x8a7f('0x30')]['fields']));_0x3a3a85[_0x8a7f('0x35')]=_0x3a3a85[_0x8a7f('0x35')][_0x8a7f('0x36')]?_0x3a3a85[_0x8a7f('0x35')]:_0x40ef13[_0x8a7f('0x34')];if(!_0x4c8c8f[_0x8a7f('0x30')][_0x8a7f('0x37')]('nolimit')){_0x3a3a85[_0x8a7f('0x1f')]=qs[_0x8a7f('0x1f')](_0x4c8c8f['query']['limit']);_0x3a3a85[_0x8a7f('0x1d')]=qs[_0x8a7f('0x1d')](_0x4c8c8f[_0x8a7f('0x30')][_0x8a7f('0x1d')]);}_0x3a3a85[_0x8a7f('0x38')]=qs[_0x8a7f('0x39')](_0x4c8c8f[_0x8a7f('0x30')][_0x8a7f('0x39')]);_0x3a3a85[_0x8a7f('0x3a')]=qs[_0x8a7f('0x32')](_[_0x8a7f('0x3b')](_0x4c8c8f[_0x8a7f('0x30')],_0x40ef13[_0x8a7f('0x32')]),_0x2329bd);if(_0x4c8c8f[_0x8a7f('0x30')][_0x8a7f('0x3c')]){_0x3a3a85[_0x8a7f('0x3a')]=_[_0x8a7f('0x3d')](_0x3a3a85[_0x8a7f('0x3a')],{'$or':_[_0x8a7f('0x3e')](_0x2329bd,function(_0x323bad){if(_0x323bad['type']!==_0x8a7f('0x3f')){var _0xcf2d1d={};_0xcf2d1d[_0x323bad[_0x8a7f('0x29')]]={'$like':'%'+_0x4c8c8f[_0x8a7f('0x30')]['filter']+'%'};return _0xcf2d1d;}})});}_0x3a3a85=_[_0x8a7f('0x3d')]({},_0x3a3a85,_0x4c8c8f[_0x8a7f('0x40')]);var _0x631b22={'where':_0x3a3a85[_0x8a7f('0x3a')]};return db['Attachment']['count'](_0x631b22)[_0x8a7f('0x26')](function(_0x1d0669){_0x4060c6['count']=_0x1d0669;if(_0x4c8c8f['query'][_0x8a7f('0x41')]){_0x3a3a85[_0x8a7f('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x8a7f('0x43')](_0x3a3a85);})['then'](function(_0x3639de){_0x4060c6[_0x8a7f('0x44')]=_0x3639de;return _0x4060c6;})[_0x8a7f('0x26')](respondWithFilteredResult(_0x17eeb1,_0x3a3a85))[_0x8a7f('0x45')](handleError(_0x17eeb1,null));};exports[_0x8a7f('0x46')]=function(_0x3547e9,_0x18aa32){var _0x3d979f={'raw':!![],'where':{'id':_0x3547e9[_0x8a7f('0x47')]['id']}},_0xa21efb={};_0xa21efb['model']=_[_0x8a7f('0x31')](db['Attachment']['rawAttributes']);_0xa21efb[_0x8a7f('0x30')]=_['keys'](_0x3547e9[_0x8a7f('0x30')]);_0xa21efb['filters']=_[_0x8a7f('0x33')](_0xa21efb[_0x8a7f('0x34')],_0xa21efb['query']);_0x3d979f[_0x8a7f('0x35')]=_[_0x8a7f('0x33')](_0xa21efb[_0x8a7f('0x34')],qs[_0x8a7f('0x48')](_0x3547e9[_0x8a7f('0x30')][_0x8a7f('0x48')]));_0x3d979f[_0x8a7f('0x35')]=_0x3d979f[_0x8a7f('0x35')][_0x8a7f('0x36')]?_0x3d979f[_0x8a7f('0x35')]:_0xa21efb[_0x8a7f('0x34')];if(_0x3547e9[_0x8a7f('0x30')][_0x8a7f('0x41')]){_0x3d979f[_0x8a7f('0x42')]=[{'all':!![]}];}_0x3d979f=_['merge']({},_0x3d979f,_0x3547e9[_0x8a7f('0x40')]);return db[_0x8a7f('0x2b')][_0x8a7f('0x49')](_0x3d979f)['then'](handleEntityNotFound(_0x18aa32,null))[_0x8a7f('0x26')](respondWithResult(_0x18aa32,null))[_0x8a7f('0x45')](handleError(_0x18aa32,null));};exports['clone']=function(_0x5854f4,_0x3a2223){var _0x2e5efb={'where':{'id':_0x5854f4[_0x8a7f('0x47')]['id']}},_0x1725d6={};_0x1725d6[_0x8a7f('0x34')]=_[_0x8a7f('0x31')](db[_0x8a7f('0x2b')][_0x8a7f('0x2c')]);_0x2e5efb['attributes']=_[_0x8a7f('0x33')](_0x1725d6[_0x8a7f('0x34')],qs[_0x8a7f('0x48')](_0x5854f4[_0x8a7f('0x30')][_0x8a7f('0x48')]));_0x2e5efb[_0x8a7f('0x35')]=_0x2e5efb[_0x8a7f('0x35')][_0x8a7f('0x36')]?_0x2e5efb[_0x8a7f('0x35')]:_0x1725d6[_0x8a7f('0x34')];if(_0x5854f4[_0x8a7f('0x30')][_0x8a7f('0x41')]){_0x2e5efb['include']=[{'all':!![]}];}_0x2e5efb=_[_0x8a7f('0x3d')]({},_0x2e5efb,_0x5854f4['options']);return db[_0x8a7f('0x2b')]['find'](_0x2e5efb)[_0x8a7f('0x26')](handleEntityNotFound(_0x3a2223,null))[_0x8a7f('0x26')](function(_0x1fc9f9){if(_0x1fc9f9){var _0x5675e4=_0x1fc9f9['get']({'plain':!![]});_0x5675e4=qs[_0x8a7f('0x4a')](_0x5675e4,['id',_0x8a7f('0x4b'),'updatedAt']);_0x5854f4['body']=_[_0x8a7f('0x4a')](_0x5854f4[_0x8a7f('0x4c')],['id','createdAt',_0x8a7f('0x4d')]);return db[_0x8a7f('0x2b')][_0x8a7f('0x4e')](_[_0x8a7f('0x3d')](_0x5675e4,_0x5854f4[_0x8a7f('0x4c')]),{'include':_0x5854f4[_0x8a7f('0x30')][_0x8a7f('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3a2223,0xc9))[_0x8a7f('0x45')](handleError(_0x3a2223,null));};exports[_0x8a7f('0x25')]=function(_0x27ac55,_0x3911f7){if(_0x27ac55['body']['id']){delete _0x27ac55[_0x8a7f('0x4c')]['id'];}return db[_0x8a7f('0x2b')][_0x8a7f('0x49')]({'where':{'id':_0x27ac55[_0x8a7f('0x47')]['id']}})[_0x8a7f('0x26')](handleEntityNotFound(_0x3911f7,null))['then'](saveUpdates(_0x27ac55[_0x8a7f('0x4c')],null))[_0x8a7f('0x26')](respondWithResult(_0x3911f7,null))['catch'](handleError(_0x3911f7,null));};exports[_0x8a7f('0x27')]=function(_0x55164f,_0x4d98cb){return db[_0x8a7f('0x2b')][_0x8a7f('0x49')]({'where':{'id':_0x55164f[_0x8a7f('0x47')]['id']}})[_0x8a7f('0x26')](handleEntityNotFound(_0x4d98cb,null))[_0x8a7f('0x26')](removeEntity(_0x4d98cb,null))[_0x8a7f('0x45')](handleError(_0x4d98cb,null));};exports[_0x8a7f('0x4e')]=function(_0xbd3329,_0x15005d,_0x4722b6){_0xbd3329[_0x8a7f('0x4c')][_0x8a7f('0x29')]=_0xbd3329[_0x8a7f('0x4f')][_0x8a7f('0x50')];_0xbd3329[_0x8a7f('0x4c')][_0x8a7f('0x51')]=_0xbd3329[_0x8a7f('0x4f')][_0x8a7f('0x52')];_0xbd3329[_0x8a7f('0x4c')]['type']=_0xbd3329[_0x8a7f('0x4f')][_0x8a7f('0x53')];return db[_0x8a7f('0x2b')][_0x8a7f('0x4e')](_0xbd3329[_0x8a7f('0x4c')])[_0x8a7f('0x26')](respondWithResult(_0x15005d,0xc9))[_0x8a7f('0x45')](handleError(_0x15005d,null));};exports[_0x8a7f('0x54')]=function(_0x3c1a8a,_0x1975ad,_0xdc72bd){return db['Attachment']['findOne']({'where':{'id':_0x3c1a8a[_0x8a7f('0x47')]['id']},'raw':!![]})[_0x8a7f('0x26')](handleEntityNotFound(_0x1975ad,null))[_0x8a7f('0x26')](function(_0x53c55d){if(_0x53c55d){var _0x2ffa58=_0x53c55d[_0x8a7f('0x55')]!==null;var _0x2fc96a=path[_0x8a7f('0x56')](config[_0x8a7f('0x57')],'server/files/attachments/');if(_0x2ffa58){_0x2fc96a=path[_0x8a7f('0x56')](_0x2fc96a,_0x8a7f('0x58'));}var _0x439786=path[_0x8a7f('0x56')](_0x2fc96a,_0x53c55d[_0x8a7f('0x51')]);return _0x1975ad[_0x8a7f('0x54')](_0x439786);}})[_0x8a7f('0x45')](handleError(_0x1975ad,null));}; \ No newline at end of file +var _0x85ad=['ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','update','then','destroy','name','send','index','map','Attachment','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','filter','where','merge','options','includeAll','include','findAll','show','find','catch','clone','params','get','omit','createdAt','body','updatedAt','create','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0xe79d9f,_0x15231d){var _0x5c77fa=function(_0x40a65a){while(--_0x40a65a){_0xe79d9f['push'](_0xe79d9f['shift']());}};_0x5c77fa(++_0x15231d);}(_0x85ad,0x1a0));var _0xd85a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x85ad[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xd85a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd85a('0x1'));var jsonpatch=require(_0xd85a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd85a('0x3'));var Mustache=require(_0xd85a('0x4'));var util=require(_0xd85a('0x5'));var path=require(_0xd85a('0x6'));var sox=require(_0xd85a('0x7'));var csv=require(_0xd85a('0x8'));var ejs=require(_0xd85a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd85a('0xa'));var crypto=require(_0xd85a('0xb'));var jsforce=require(_0xd85a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd85a('0xd'));var Papa=require(_0xd85a('0xe'));var Redis=require(_0xd85a('0xf'));var authService=require(_0xd85a('0x10'));var qs=require(_0xd85a('0x11'));var as=require(_0xd85a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd85a('0x13'))(_0xd85a('0x14'));var utils=require(_0xd85a('0x15'));var config=require(_0xd85a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd85a('0x17'))['db'];function respondWithStatusCode(_0x469a42,_0x106b27){_0x106b27=_0x106b27||0xcc;return function(_0x182d8d){if(_0x182d8d){return _0x469a42[_0xd85a('0x18')](_0x106b27);}return _0x469a42[_0xd85a('0x19')](_0x106b27)[_0xd85a('0x1a')]();};}function respondWithResult(_0x38b57f,_0x422903){_0x422903=_0x422903||0xc8;return function(_0x2db068){if(_0x2db068){return _0x38b57f[_0xd85a('0x19')](_0x422903)['json'](_0x2db068);}};}function respondWithFilteredResult(_0x348199,_0x485b3e){return function(_0x3cf445){if(_0x3cf445){var _0x377b7d=typeof _0x485b3e['offset']==='undefined'&&typeof _0x485b3e[_0xd85a('0x1b')]===_0xd85a('0x1c');var _0x5d6755=_0x3cf445[_0xd85a('0x1d')];var _0x160b72=_0x377b7d?0x0:_0x485b3e[_0xd85a('0x1e')];var _0x229922=_0x377b7d?_0x3cf445[_0xd85a('0x1d')]:_0x485b3e[_0xd85a('0x1e')]+_0x485b3e[_0xd85a('0x1b')];var _0x1e0194;if(_0x229922>=_0x5d6755){_0x229922=_0x5d6755;_0x1e0194=0xc8;}else{_0x1e0194=0xce;}_0x348199[_0xd85a('0x19')](_0x1e0194);return _0x348199[_0xd85a('0x1f')](_0xd85a('0x20'),_0x160b72+'-'+_0x229922+'/'+_0x5d6755)[_0xd85a('0x21')](_0x3cf445);}return null;};}function patchUpdates(_0x2c7768){return function(_0x4a7ebf){try{jsonpatch[_0xd85a('0x22')](_0x4a7ebf,_0x2c7768,!![]);}catch(_0x3ba962){return BPromise['reject'](_0x3ba962);}return _0x4a7ebf['save']();};}function saveUpdates(_0x482d15,_0x1ec06d){return function(_0x377e2d){if(_0x377e2d){return _0x377e2d[_0xd85a('0x23')](_0x482d15)[_0xd85a('0x24')](function(_0x29ad27){return _0x29ad27;});}return null;};}function removeEntity(_0xddf5c8,_0x3e3b52){return function(_0x1dc89a){if(_0x1dc89a){return _0x1dc89a[_0xd85a('0x25')]()[_0xd85a('0x24')](function(){_0xddf5c8[_0xd85a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4392b2,_0x3a1d0c){return function(_0xe5ae6d){if(!_0xe5ae6d){_0x4392b2['sendStatus'](0x194);}return _0xe5ae6d;};}function handleError(_0x5e0ddc,_0x1736ff){_0x1736ff=_0x1736ff||0x1f4;return function(_0x3114b3){logger['error'](_0x3114b3['stack']);if(_0x3114b3['name']){delete _0x3114b3[_0xd85a('0x26')];}_0x5e0ddc[_0xd85a('0x19')](_0x1736ff)[_0xd85a('0x27')](_0x3114b3);};}exports[_0xd85a('0x28')]=function(_0x288a6b,_0x160257){var _0x344095={},_0x111d32={},_0x191303={'count':0x0,'rows':[]};var _0x4adc45=_[_0xd85a('0x29')](db[_0xd85a('0x2a')][_0xd85a('0x2b')],function(_0x53963b){return{'name':_0x53963b[_0xd85a('0x2c')],'type':_0x53963b[_0xd85a('0x2d')]['key']};});_0x111d32['model']=_['map'](_0x4adc45,'name');_0x111d32[_0xd85a('0x2e')]=_[_0xd85a('0x2f')](_0x288a6b[_0xd85a('0x2e')]);_0x111d32['filters']=_['intersection'](_0x111d32[_0xd85a('0x30')],_0x111d32[_0xd85a('0x2e')]);_0x344095[_0xd85a('0x31')]=_[_0xd85a('0x32')](_0x111d32[_0xd85a('0x30')],qs[_0xd85a('0x33')](_0x288a6b[_0xd85a('0x2e')][_0xd85a('0x33')]));_0x344095['attributes']=_0x344095[_0xd85a('0x31')][_0xd85a('0x34')]?_0x344095[_0xd85a('0x31')]:_0x111d32[_0xd85a('0x30')];if(!_0x288a6b[_0xd85a('0x2e')][_0xd85a('0x35')]('nolimit')){_0x344095[_0xd85a('0x1b')]=qs['limit'](_0x288a6b[_0xd85a('0x2e')][_0xd85a('0x1b')]);_0x344095[_0xd85a('0x1e')]=qs['offset'](_0x288a6b['query'][_0xd85a('0x1e')]);}_0x344095['order']=qs[_0xd85a('0x36')](_0x288a6b[_0xd85a('0x2e')]['sort']);_0x344095['where']=qs[_0xd85a('0x37')](_['pick'](_0x288a6b[_0xd85a('0x2e')],_0x111d32[_0xd85a('0x37')]),_0x4adc45);if(_0x288a6b[_0xd85a('0x2e')][_0xd85a('0x38')]){_0x344095[_0xd85a('0x39')]=_[_0xd85a('0x3a')](_0x344095[_0xd85a('0x39')],{'$or':_[_0xd85a('0x29')](_0x4adc45,function(_0x2d13d2){if(_0x2d13d2[_0xd85a('0x2d')]!=='VIRTUAL'){var _0x3e6322={};_0x3e6322[_0x2d13d2[_0xd85a('0x26')]]={'$like':'%'+_0x288a6b['query']['filter']+'%'};return _0x3e6322;}})});}_0x344095=_[_0xd85a('0x3a')]({},_0x344095,_0x288a6b[_0xd85a('0x3b')]);var _0x143116={'where':_0x344095['where']};return db[_0xd85a('0x2a')][_0xd85a('0x1d')](_0x143116)[_0xd85a('0x24')](function(_0xf3d512){_0x191303['count']=_0xf3d512;if(_0x288a6b[_0xd85a('0x2e')][_0xd85a('0x3c')]){_0x344095[_0xd85a('0x3d')]=[{'all':!![]}];}return db[_0xd85a('0x2a')][_0xd85a('0x3e')](_0x344095);})[_0xd85a('0x24')](function(_0x2ba88d){_0x191303['rows']=_0x2ba88d;return _0x191303;})[_0xd85a('0x24')](respondWithFilteredResult(_0x160257,_0x344095))['catch'](handleError(_0x160257,null));};exports[_0xd85a('0x3f')]=function(_0x5f0b39,_0x4d0434){var _0x3f94cf={'raw':!![],'where':{'id':_0x5f0b39['params']['id']}},_0x2a3dec={};_0x2a3dec[_0xd85a('0x30')]=_[_0xd85a('0x2f')](db['Attachment'][_0xd85a('0x2b')]);_0x2a3dec[_0xd85a('0x2e')]=_['keys'](_0x5f0b39[_0xd85a('0x2e')]);_0x2a3dec[_0xd85a('0x37')]=_[_0xd85a('0x32')](_0x2a3dec[_0xd85a('0x30')],_0x2a3dec[_0xd85a('0x2e')]);_0x3f94cf[_0xd85a('0x31')]=_[_0xd85a('0x32')](_0x2a3dec[_0xd85a('0x30')],qs[_0xd85a('0x33')](_0x5f0b39[_0xd85a('0x2e')][_0xd85a('0x33')]));_0x3f94cf[_0xd85a('0x31')]=_0x3f94cf[_0xd85a('0x31')][_0xd85a('0x34')]?_0x3f94cf[_0xd85a('0x31')]:_0x2a3dec[_0xd85a('0x30')];if(_0x5f0b39['query'][_0xd85a('0x3c')]){_0x3f94cf[_0xd85a('0x3d')]=[{'all':!![]}];}_0x3f94cf=_[_0xd85a('0x3a')]({},_0x3f94cf,_0x5f0b39[_0xd85a('0x3b')]);return db[_0xd85a('0x2a')][_0xd85a('0x40')](_0x3f94cf)['then'](handleEntityNotFound(_0x4d0434,null))[_0xd85a('0x24')](respondWithResult(_0x4d0434,null))[_0xd85a('0x41')](handleError(_0x4d0434,null));};exports[_0xd85a('0x42')]=function(_0x1409d4,_0x294ee1){var _0x1c119c={'where':{'id':_0x1409d4[_0xd85a('0x43')]['id']}},_0x358f26={};_0x358f26[_0xd85a('0x30')]=_['keys'](db[_0xd85a('0x2a')]['rawAttributes']);_0x1c119c[_0xd85a('0x31')]=_[_0xd85a('0x32')](_0x358f26[_0xd85a('0x30')],qs[_0xd85a('0x33')](_0x1409d4[_0xd85a('0x2e')][_0xd85a('0x33')]));_0x1c119c[_0xd85a('0x31')]=_0x1c119c[_0xd85a('0x31')]['length']?_0x1c119c[_0xd85a('0x31')]:_0x358f26['model'];if(_0x1409d4[_0xd85a('0x2e')][_0xd85a('0x3c')]){_0x1c119c['include']=[{'all':!![]}];}_0x1c119c=_[_0xd85a('0x3a')]({},_0x1c119c,_0x1409d4[_0xd85a('0x3b')]);return db[_0xd85a('0x2a')][_0xd85a('0x40')](_0x1c119c)[_0xd85a('0x24')](handleEntityNotFound(_0x294ee1,null))[_0xd85a('0x24')](function(_0xeb768e){if(_0xeb768e){var _0x5287fa=_0xeb768e[_0xd85a('0x44')]({'plain':!![]});_0x5287fa=qs[_0xd85a('0x45')](_0x5287fa,['id',_0xd85a('0x46'),'updatedAt']);_0x1409d4[_0xd85a('0x47')]=_['omit'](_0x1409d4[_0xd85a('0x47')],['id',_0xd85a('0x46'),_0xd85a('0x48')]);return db[_0xd85a('0x2a')]['create'](_[_0xd85a('0x3a')](_0x5287fa,_0x1409d4[_0xd85a('0x47')]),{'include':_0x1409d4['query'][_0xd85a('0x3c')]?[{'all':!![]}]:undefined});}})[_0xd85a('0x24')](respondWithResult(_0x294ee1,0xc9))['catch'](handleError(_0x294ee1,null));};exports[_0xd85a('0x23')]=function(_0x4c18eb,_0x6cfc8f){if(_0x4c18eb[_0xd85a('0x47')]['id']){delete _0x4c18eb[_0xd85a('0x47')]['id'];}return db['Attachment'][_0xd85a('0x40')]({'where':{'id':_0x4c18eb[_0xd85a('0x43')]['id']}})['then'](handleEntityNotFound(_0x6cfc8f,null))[_0xd85a('0x24')](saveUpdates(_0x4c18eb[_0xd85a('0x47')],null))[_0xd85a('0x24')](respondWithResult(_0x6cfc8f,null))[_0xd85a('0x41')](handleError(_0x6cfc8f,null));};exports[_0xd85a('0x25')]=function(_0x21ee2b,_0x31efce){return db[_0xd85a('0x2a')][_0xd85a('0x40')]({'where':{'id':_0x21ee2b[_0xd85a('0x43')]['id']}})[_0xd85a('0x24')](handleEntityNotFound(_0x31efce,null))['then'](removeEntity(_0x31efce,null))[_0xd85a('0x41')](handleError(_0x31efce,null));};exports[_0xd85a('0x49')]=function(_0x483da7,_0x432f2d,_0x3af43e){_0x483da7['body'][_0xd85a('0x26')]=_0x483da7[_0xd85a('0x4a')]['originalname'];_0x483da7['body'][_0xd85a('0x4b')]=_0x483da7['file'][_0xd85a('0x4c')];_0x483da7[_0xd85a('0x47')][_0xd85a('0x2d')]=_0x483da7[_0xd85a('0x4a')][_0xd85a('0x4d')];return db[_0xd85a('0x2a')]['create'](_0x483da7[_0xd85a('0x47')])['then'](respondWithResult(_0x432f2d,0xc9))[_0xd85a('0x41')](handleError(_0x432f2d,null));};exports[_0xd85a('0x4e')]=function(_0x258ac1,_0x3ef2ab,_0xc76968){return db['Attachment'][_0xd85a('0x4f')]({'where':{'id':_0x258ac1[_0xd85a('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3ef2ab,null))['then'](function(_0x2f0b1c){if(_0x2f0b1c){var _0x31576a=_0x2f0b1c[_0xd85a('0x50')]!==null;var _0x10ff68=path[_0xd85a('0x51')](config[_0xd85a('0x52')],_0xd85a('0x53'));if(_0x31576a){_0x10ff68=path[_0xd85a('0x51')](_0x10ff68,_0xd85a('0x54'));}var _0x3d0448=path['join'](_0x10ff68,_0x2f0b1c[_0xd85a('0x4b')]);return _0x3ef2ab[_0xd85a('0x4e')](_0x3d0448);}})[_0xd85a('0x41')](handleError(_0x3ef2ab,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d89ed65..7f35681 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 _0xb6e3=['exports','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes'];(function(_0x5bd70b,_0x4ea5c0){var _0x594fd2=function(_0xab1bfc){while(--_0xab1bfc){_0x5bd70b['push'](_0x5bd70b['shift']());}};_0x594fd2(++_0x4ea5c0);}(_0xb6e3,0x19b));var _0x3b6e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb6e3[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x3b6e('0x0'));var util=require(_0x3b6e('0x1'));var logger=require(_0x3b6e('0x2'))(_0x3b6e('0x3'));var moment=require('moment');var BPromise=require(_0x3b6e('0x4'));var rp=require(_0x3b6e('0x5'));var fs=require('fs');var path=require(_0x3b6e('0x6'));var rimraf=require(_0x3b6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b6e('0x8'));module[_0x3b6e('0x9')]=function(_0x47c77e,_0x407ab7){return _0x47c77e['define'](_0x3b6e('0xa'),attributes,{'tableName':_0x3b6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61db=['request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment'];(function(_0x29b7a6,_0x71a735){var _0x1add01=function(_0x508c0a){while(--_0x508c0a){_0x29b7a6['push'](_0x29b7a6['shift']());}};_0x1add01(++_0x71a735);}(_0x61db,0x126));var _0xb61d=function(_0xe5a380,_0xa6112e){_0xe5a380=_0xe5a380-0x0;var _0x344347=_0x61db[_0xe5a380];return _0x344347;};'use strict';var _=require(_0xb61d('0x0'));var util=require(_0xb61d('0x1'));var logger=require(_0xb61d('0x2'))(_0xb61d('0x3'));var moment=require(_0xb61d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb61d('0x5'));var fs=require('fs');var path=require(_0xb61d('0x6'));var rimraf=require(_0xb61d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb61d('0x8'));module[_0xb61d('0x9')]=function(_0x4a0f1f,_0x459b15){return _0x4a0f1f[_0xb61d('0xa')](_0xb61d('0xb'),attributes,{'tableName':_0xb61d('0xc'),'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 08802c1..a79e979 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d9e=['CreateAttachment','Attachment','create','body','options','raw','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','catch'];(function(_0x84714,_0x48c897){var _0x16e254=function(_0x19181f){while(--_0x19181f){_0x84714['push'](_0x84714['shift']());}};_0x16e254(++_0x48c897);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2b51e7,_0x56f3d4){_0x2b51e7=_0x2b51e7-0x0;var _0x582016=_0x4d9e[_0x2b51e7];return _0x582016;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('Attachment,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('Attachment,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});}exports[_0xe4d9('0x14')]=function(_0x112315){var _0x5ab3d1=this;return new Promise(function(_0x2e1490,_0x4f8dba){return db[_0xe4d9('0x15')][_0xe4d9('0x16')](_0x112315[_0xe4d9('0x17')],{'raw':_0x112315[_0xe4d9('0x18')]?_0x112315['options'][_0xe4d9('0x19')]===undefined?!![]:![]:!![]})[_0xe4d9('0xa')](function(_0x151220){logger[_0xe4d9('0xb')](_0xe4d9('0x14'),_0x112315);logger[_0xe4d9('0xd')](_0xe4d9('0x14'),_0x112315,JSON[_0xe4d9('0xf')](_0x151220));_0x2e1490(_0x151220);})[_0xe4d9('0x13')](function(_0x4fed7f){logger[_0xe4d9('0x10')](_0xe4d9('0x14'),_0x4fed7f['message'],_0x112315);_0x4f8dba(_0x5ab3d1[_0xe4d9('0x10')](0x1f4,_0x4fed7f['message']));});});}; \ No newline at end of file +var _0xa5ca=['rpc','../../config/environment','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55e00b,_0x3f1949){var _0x5c7f41=function(_0x51236a){while(--_0x51236a){_0x55e00b['push'](_0x55e00b['shift']());}};_0x5c7f41(++_0x3f1949);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xa5ca[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var moment=require(_0xaa5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa5c('0x3'));var db=require(_0xaa5c('0x4'))['db'];var utils=require(_0xaa5c('0x5'));var logger=require(_0xaa5c('0x6'))(_0xaa5c('0x7'));var config=require(_0xaa5c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41b86b,_0x10bee5,_0x283bc5){return new BPromise(function(_0x5b39a7,_0x496243){return client[_0xaa5c('0x9')](_0x41b86b,_0x283bc5)[_0xaa5c('0xa')](function(_0x170d3b){logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));logger[_0xaa5c('0xd')](_0xaa5c('0xe'),_0x10bee5,_0xaa5c('0xc'),JSON[_0xaa5c('0xf')](_0x170d3b));if(_0x170d3b[_0xaa5c('0x10')]){if(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x11')]===0x1f4){logger[_0xaa5c('0x10')](_0xaa5c('0xb'),_0x10bee5,_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);return _0x496243(_0x170d3b['error'][_0xaa5c('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x10bee5,_0x170d3b['error'][_0xaa5c('0x12')]);return _0x5b39a7(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);}else{logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));_0x5b39a7(_0x170d3b[_0xaa5c('0x13')][_0xaa5c('0x12')]);}})[_0xaa5c('0x14')](function(_0x272d06){logger['error']('Attachment,\x20%s,\x20%s',_0x10bee5,_0x272d06);_0x496243(_0x272d06);});});}exports[_0xaa5c('0x15')]=function(_0x5ebbf0){var _0x43990d=this;return new Promise(function(_0xa016ba,_0x4f5038){return db['Attachment']['create'](_0x5ebbf0['body'],{'raw':_0x5ebbf0[_0xaa5c('0x16')]?_0x5ebbf0[_0xaa5c('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xaa5c('0xa')](function(_0x114363){logger['info']('CreateAttachment',_0x5ebbf0);logger[_0xaa5c('0xd')](_0xaa5c('0x15'),_0x5ebbf0,JSON[_0xaa5c('0xf')](_0x114363));_0xa016ba(_0x114363);})[_0xaa5c('0x14')](function(_0xa280bc){logger[_0xaa5c('0x10')]('CreateAttachment',_0xa280bc[_0xaa5c('0x12')],_0x5ebbf0);_0x4f5038(_0x43990d[_0xaa5c('0x10')](0x1f4,_0xa280bc['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 16c2259..cdf1078 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 67d7274..a71529f 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 _0xf759=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','lodash','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','/login','profile','email','google','use','clientID','clientSecret','secret','Setting','findOne','blockDuration','User','find','map','emails','admin','agent','then'];(function(_0x3ee244,_0x2e67db){var _0x2e75ee=function(_0x532687){while(--_0x532687){_0x3ee244['push'](_0x3ee244['shift']());}};_0x2e75ee(++_0x2e67db);}(_0xf759,0x106));var _0x9f75=function(_0x45632f,_0x1f01ec){_0x45632f=_0x45632f-0x0;var _0xe91bed=_0xf759[_0x45632f];return _0xe91bed;};'use strict';var _=require(_0x9f75('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x9f75('0x1'));var db=require(_0x9f75('0x2'))['db'];var config=require(_0x9f75('0x3'));var signToken=require(_0x9f75('0x4'))[_0x9f75('0x5')];var utils=require(_0x9f75('0x6'));exports['login']=passport[_0x9f75('0x7')]('google',{'failureRedirect':_0x9f75('0x8'),'scope':[_0x9f75('0x9'),_0x9f75('0xa')],'session':![]});exports['callback']=passport[_0x9f75('0x7')](_0x9f75('0xb'),{'failureRedirect':_0x9f75('0x8'),'session':![]});passport[_0x9f75('0xc')](new GoogleStrategy({'clientID':config[_0x9f75('0xb')]?config[_0x9f75('0xb')][_0x9f75('0xd')]:'id','clientSecret':config['google']?config[_0x9f75('0xb')][_0x9f75('0xe')]:_0x9f75('0xf'),'callbackURL':config[_0x9f75('0xb')]?config[_0x9f75('0xb')]['callbackURL']:''},function(_0x19c770,_0x213e67,_0x21d9bd,_0x59d7f8){var _0x1fdf81,_0x228040;return db[_0x9f75('0x10')][_0x9f75('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9f75('0x12')],'raw':!![]})['then'](function(_0x34e8e2){_0x1fdf81=_0x34e8e2;return db[_0x9f75('0x13')][_0x9f75('0x14')]({'where':{'email':_[_0x9f75('0x15')](_0x21d9bd[_0x9f75('0x16')],'value'),'role':{'$or':[_0x9f75('0x17'),'user',_0x9f75('0x18')]}}});})[_0x9f75('0x19')](function(_0x4437af){_0x228040=_0x4437af;if(_0x228040){if(_0x228040['disabled']){return _0x59d7f8(_0x9f75('0x1a'));}else if(_0x1fdf81[_0x9f75('0x12')]>0x0){if(_0x228040[_0x9f75('0x1b')]){if(moment(_0x228040['blockedAt'])['add'](_0x1fdf81[_0x9f75('0x12')],_0x9f75('0x1c'))>moment()){return _0x59d7f8(_0x9f75('0x1a'));}else{return utils[_0x9f75('0x1d')](_0x228040,0x0,![],null)[_0x9f75('0x19')](function(){return utils[_0x9f75('0x1e')](_0x228040);})[_0x9f75('0x19')](function(){return _0x59d7f8(null,_0x228040);});}}else{return utils[_0x9f75('0x1e')](_0x228040)[_0x9f75('0x19')](function(){return _0x59d7f8(null,_0x228040);});}}else{return utils[_0x9f75('0x1e')](_0x228040)[_0x9f75('0x19')](function(){return _0x59d7f8(null,_0x228040);});}}return _0x59d7f8(_0x9f75('0x1a'));})[_0x9f75('0x1f')](function(_0x5ec37b){_0x59d7f8(_0x5ec37b);});})); \ No newline at end of file +var _0xda42=['then','find','emails','user','agent','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x51bd72,_0x1bf44b){var _0x46c7cb=function(_0x4b3269){while(--_0x4b3269){_0x51bd72['push'](_0x51bd72['shift']());}};_0x46c7cb(++_0x1bf44b);}(_0xda42,0x111));var _0x2da4=function(_0x46fb2b,_0x4e8f99){_0x46fb2b=_0x46fb2b-0x0;var _0x5c59a8=_0xda42[_0x46fb2b];return _0x5c59a8;};'use strict';var _=require(_0x2da4('0x0'));var passport=require(_0x2da4('0x1'));var GoogleStrategy=require(_0x2da4('0x2'))[_0x2da4('0x3')];var moment=require(_0x2da4('0x4'));var db=require(_0x2da4('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0x2da4('0x6'))[_0x2da4('0x7')];var utils=require(_0x2da4('0x8'));exports[_0x2da4('0x9')]=passport[_0x2da4('0xa')](_0x2da4('0xb'),{'failureRedirect':_0x2da4('0xc'),'scope':[_0x2da4('0xd'),_0x2da4('0xe')],'session':![]});exports[_0x2da4('0xf')]=passport[_0x2da4('0xa')](_0x2da4('0xb'),{'failureRedirect':'/login','session':![]});passport[_0x2da4('0x10')](new GoogleStrategy({'clientID':config[_0x2da4('0xb')]?config['google'][_0x2da4('0x11')]:'id','clientSecret':config[_0x2da4('0xb')]?config['google']['clientSecret']:'secret','callbackURL':config[_0x2da4('0xb')]?config[_0x2da4('0xb')][_0x2da4('0x12')]:''},function(_0x33342e,_0x383586,_0x1579df,_0x45f240){var _0x338ded,_0x55f52d;return db[_0x2da4('0x13')][_0x2da4('0x14')]({'where':{'id':0x1},'attributes':[_0x2da4('0x15'),_0x2da4('0x16')],'raw':!![]})[_0x2da4('0x17')](function(_0xc77fd1){_0x338ded=_0xc77fd1;return db['User'][_0x2da4('0x18')]({'where':{'email':_['map'](_0x1579df[_0x2da4('0x19')],'value'),'role':{'$or':['admin',_0x2da4('0x1a'),_0x2da4('0x1b')]}}});})[_0x2da4('0x17')](function(_0x23110a){_0x55f52d=_0x23110a;if(_0x55f52d){if(_0x55f52d[_0x2da4('0x1c')]){return _0x45f240('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x338ded[_0x2da4('0x16')]>0x0){if(_0x55f52d[_0x2da4('0x1d')]){if(moment(_0x55f52d[_0x2da4('0x1e')])[_0x2da4('0x1f')](_0x338ded[_0x2da4('0x16')],_0x2da4('0x20'))>moment()){return _0x45f240(_0x2da4('0x21'));}else{return utils[_0x2da4('0x22')](_0x55f52d,0x0,![],null)[_0x2da4('0x17')](function(){return utils['getLicense'](_0x55f52d);})[_0x2da4('0x17')](function(){return _0x45f240(null,_0x55f52d);});}}else{return utils['getLicense'](_0x55f52d)[_0x2da4('0x17')](function(){return _0x45f240(null,_0x55f52d);});}}else{return utils[_0x2da4('0x23')](_0x55f52d)[_0x2da4('0x17')](function(){return _0x45f240(null,_0x55f52d);});}}return _0x45f240(_0x2da4('0x21'));})[_0x2da4('0x24')](function(_0x2694b4){_0x45f240(_0x2694b4);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 984bcf7..3e725cc 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 _0xd9f7=['/callback','callback','exports','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xd9f7,0x1eb));var _0x7d9f=function(_0x3242bb,_0x4b0b32){_0x3242bb=_0x3242bb-0x0;var _0xa9a93d=_0xd9f7[_0x3242bb];return _0xa9a93d;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x7d9f('0x0')]();var controller=require(_0x7d9f('0x1'));var userController=require(_0x7d9f('0x2'));var authService=require(_0x7d9f('0x3'));router['get']('/',controller[_0x7d9f('0x4')]);router['get'](_0x7d9f('0x5'),controller[_0x7d9f('0x6')],authService['isMiddleware'],userController[_0x7d9f('0x4')],authService['setTokenCookie']);module[_0x7d9f('0x7')]=router; \ No newline at end of file +var _0x31b2=['../../components/auth/service','login','/callback','callback','exports','express','Router','./authGoogle.controller'];(function(_0x5b8608,_0x527731){var _0x3f8d3d=function(_0x131b70){while(--_0x131b70){_0x5b8608['push'](_0x5b8608['shift']());}};_0x3f8d3d(++_0x527731);}(_0x31b2,0xc5));var _0x231b=function(_0x2ae22a,_0x4fe753){_0x2ae22a=_0x2ae22a-0x0;var _0x286a82=_0x31b2[_0x2ae22a];return _0x286a82;};'use strict';var express=require(_0x231b('0x0'));var passport=require('passport');var router=express[_0x231b('0x1')]();var controller=require(_0x231b('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x231b('0x3'));router['get']('/',controller[_0x231b('0x4')]);router['get'](_0x231b('0x5'),controller[_0x231b('0x6')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x231b('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f86c285..d716ee3 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 _0xdf64=['service','Smtp','host','port','secure','authentication','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdf64,0x1da));var _0x4df6=function(_0x350cfc,_0x576744){_0x350cfc=_0x350cfc-0x0;var _0x4f3b45=_0xdf64[_0x350cfc];return _0x4f3b45;};'use strict';var util=require(_0x4df6('0x0'));var passport=require(_0x4df6('0x1'));var LocalStrategy=require(_0x4df6('0x2'))[_0x4df6('0x3')];var jayson=require(_0x4df6('0x4'));var _=require(_0x4df6('0x5'));var rs=require(_0x4df6('0x6'));var moment=require(_0x4df6('0x7'));var db=require(_0x4df6('0x8'))['db'];var authService=require(_0x4df6('0x9'));var utils=require('../../config/utils');var client=jayson[_0x4df6('0xa')][_0x4df6('0xb')]({'port':0x232b});function localAuthenticate(_0x4d72ed,_0x192858,_0x3a16dd,_0x9401c2){var _0x5f283e,_0x2588b1;return db['Setting'][_0x4df6('0xc')]({'where':{'id':0x1},'attributes':[_0x4df6('0xd'),_0x4df6('0xe')],'raw':!![]})[_0x4df6('0xf')](function(_0x50c802){_0x5f283e=_0x50c802;return _0x4d72ed[_0x4df6('0xc')]({'attributes':['id',_0x4df6('0x10'),_0x4df6('0x11'),_0x4df6('0x12'),_0x4df6('0x13'),_0x4df6('0x14'),_0x4df6('0x15'),_0x4df6('0x16'),_0x4df6('0x17')],'where':{'name':_0x192858,'role':{'$or':[_0x4df6('0x18'),_0x4df6('0x19'),_0x4df6('0x1a')]}}});})[_0x4df6('0xf')](function(_0x4e55b0){if(!_0x4e55b0||_0x4e55b0&&_0x4e55b0['name']!==_0x192858){throw new Error(_0x4df6('0x1b'));}else{_0x2588b1=_0x4e55b0;return _0x2588b1;}})[_0x4df6('0xf')](function(){_0x2588b1[_0x4df6('0x1c')](_0x3a16dd,function(_0x4e49c6,_0x1a98ff){var _0x1b9463=_0x2588b1[_0x4df6('0x17')]+0x1;if(_0x4e49c6){return _0x9401c2(_0x4e49c6);}else if(!_0x1a98ff){if(_0x2588b1[_0x4df6('0x14')]){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}else if(_0x5f283e[_0x4df6('0xd')]>0x0){if(_0x2588b1[_0x4df6('0x15')]){if(_0x5f283e[_0x4df6('0xe')]>0x0){if(moment(_0x2588b1['blockedAt'])['add'](_0x5f283e[_0x4df6('0xe')],'minutes')>moment()){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}else{return utils['clearBlockUser'](_0x2588b1,_0x1b9463,![],null)['then'](function(){return _0x9401c2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x9401c2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1b9463>=_0x5f283e['allowedLoginAttempts']){return utils[_0x4df6('0x1d')](_0x2588b1,0x0,!![],moment())[_0x4df6('0xf')](function(){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});});}else{return utils[_0x4df6('0x1d')](_0x2588b1,_0x1b9463,![],null)['then'](function(){return _0x9401c2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}}else{if(_0x2588b1[_0x4df6('0x14')]){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}else if(_0x5f283e['allowedLoginAttempts']>0x0){if(_0x2588b1[_0x4df6('0x15')]){if(_0x5f283e[_0x4df6('0xe')]>0x0){if(moment(_0x2588b1[_0x4df6('0x16')])[_0x4df6('0x1e')](_0x5f283e['blockDuration'],'minutes')>moment()){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}else{return utils[_0x4df6('0x1d')](_0x2588b1,0x0,![],null)[_0x4df6('0xf')](function(){return utils[_0x4df6('0x1f')](_0x2588b1);})['then'](function(){return _0x9401c2(null,_0x2588b1);});}}else{return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}}else{return utils[_0x4df6('0x1d')](_0x2588b1,0x0,![],null)[_0x4df6('0xf')](function(){return utils['getLicense'](_0x2588b1);})[_0x4df6('0xf')](function(){return _0x9401c2(null,_0x2588b1);})[_0x4df6('0x20')](function(_0x2cab85){return _0x9401c2(null,![],_0x2cab85);});}}else{if(_0x2588b1[_0x4df6('0x15')]){return _0x9401c2(null,![],{'message':_0x4df6('0x1b')});}else{return utils[_0x4df6('0x1f')](_0x2588b1)[_0x4df6('0xf')](function(){return _0x9401c2(null,_0x2588b1);});}}}});})[_0x4df6('0x20')](function(_0x2f7c55){return _0x9401c2(null,![],_0x2f7c55);});}function sendServiceMail(_0x113b1b){return db[_0x4df6('0x21')][_0x4df6('0x22')]({'where':{'service':!![]},'attributes':['id',_0x4df6('0x10'),'email'],'include':[{'model':db[_0x4df6('0x23')],'as':'Smtp'}]})[_0x4df6('0xf')](function(_0x1e6a70){if(!_0x1e6a70){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x24f1d8={'tls':{'rejectUnauthorized':![]}};if(_0x1e6a70['Smtp'][_0x4df6('0x24')]){_0x24f1d8[_0x4df6('0x24')]=_0x1e6a70[_0x4df6('0x25')][_0x4df6('0x24')];}else{_0x24f1d8[_0x4df6('0x26')]=_0x1e6a70[_0x4df6('0x25')][_0x4df6('0x26')];_0x24f1d8['port']=_0x1e6a70['Smtp'][_0x4df6('0x27')];_0x24f1d8[_0x4df6('0x28')]=_0x1e6a70[_0x4df6('0x25')]['secure'];}if(_0x1e6a70['Smtp'][_0x4df6('0x29')]){_0x24f1d8['auth']={'user':_0x1e6a70['Smtp']['user'],'pass':_0x1e6a70[_0x4df6('0x25')]['pass']};}var _0x2086c1={'account':_0x24f1d8,'message':_[_0x4df6('0x2a')]({'from':util[_0x4df6('0x2b')](_0x4df6('0x2c'),_0x1e6a70[_0x4df6('0x10')],_0x1e6a70[_0x4df6('0x2d')]||_0x1e6a70[_0x4df6('0x25')][_0x4df6('0x19')])},_0x113b1b)};return client[_0x4df6('0x2e')](_0x4df6('0x2f'),_0x2086c1);})[_0x4df6('0xf')](function(_0x4d3fdc){if(_0x4d3fdc['error']){throw new Error(util[_0x4df6('0x2b')](_0x4df6('0x30'),_0x4d3fdc[_0x4df6('0x31')][_0x4df6('0x32')]||JSON[_0x4df6('0x33')](_0x4d3fdc[_0x4df6('0x31')])));}return!![];});}function handleError(_0x58740d,_0x2a4f52,_0x354969){return _0x58740d[_0x4df6('0x34')](_0x2a4f52||0x1f4)[_0x4df6('0x35')]({'message':_0x354969?_0x354969[_0x4df6('0x32')]||_0x354969:''});}exports[_0x4df6('0x36')]=function(_0x35ac36,_0x2b76d8,_0x2c13f7){passport['authenticate']('local',function(_0x13d929,_0xb8a099,_0x242e03){var _0x26c784=_0x13d929||_0x242e03;if(_0x26c784){return handleError(_0x2b76d8,0x191,_0x26c784);}if(!_0xb8a099){return handleError(_0x2b76d8,0x194,{'message':_0x4df6('0x37')});}else{var _0x583cb4={'payload':{'id':_0xb8a099['id'],'role':_0xb8a099['role']},'options':{'expiresIn':0x15180}};return authService[_0x4df6('0x38')](_0x583cb4)[_0x4df6('0xf')](function(_0x4bbeea){_0x2b76d8['json']({'id':_0xb8a099['id'],'token':_0x4bbeea,'statusCall':'','isAlreadyLogged':_0xb8a099[_0x4df6('0x39')]});});}})(_0x35ac36,_0x2b76d8,_0x2c13f7);};exports[_0x4df6('0x3a')]=function(_0x428b08,_0x37c4b,_0x127155){if(!_0x428b08['body'][_0x4df6('0x2d')]){return handleError(_0x37c4b,0x1f4,{'message':_0x4df6('0x3b')});}var _0x108ac1=rs[_0x4df6('0x3c')]();_0x428b08['body'][_0x4df6('0x2d')]=_0x428b08[_0x4df6('0x3d')][_0x4df6('0x2d')][_0x4df6('0x3e')]()[_0x4df6('0x3f')]();var _0x24a867;return db[_0x4df6('0x40')][_0x4df6('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4df6('0xe')],'raw':!![]})[_0x4df6('0xf')](function(_0x72b8b7){_0x24a867=_0x72b8b7;return db['User'][_0x4df6('0x22')]({'where':{'email':_0x428b08[_0x4df6('0x3d')][_0x4df6('0x2d')]}});})[_0x4df6('0xf')](function(_0x268b5f){if(!_0x268b5f){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x268b5f[_0x4df6('0x14')]){throw new Error(_0x4df6('0x41'));}if(_0x268b5f['blocked']){if(moment(_0x268b5f[_0x4df6('0x16')])[_0x4df6('0x1e')](_0x24a867['blockDuration'],_0x4df6('0x42'))>moment()){throw new Error(_0x4df6('0x43'));}else{_0x268b5f[_0x4df6('0x15')]=![];_0x268b5f[_0x4df6('0x16')]=null;}}_0x268b5f['resetPasswordToken']=_0x108ac1;_0x268b5f[_0x4df6('0x44')]=Date['now']()+0x36ee80;return _0x268b5f[_0x4df6('0x45')]();})['then'](function(){return sendServiceMail({'to':_0x428b08[_0x4df6('0x3d')][_0x4df6('0x2d')],'subject':_0x4df6('0x46'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x4df6('0x47')+_0x428b08[_0x4df6('0x48')][_0x4df6('0x26')]+'/reset/'+_0x108ac1+'\x0a\x0a'+_0x4df6('0x49')});})[_0x4df6('0xf')](function(){_0x37c4b[_0x4df6('0x34')](0xc8)[_0x4df6('0x35')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x4c4e14){return handleError(_0x37c4b,0x1f4,_0x4c4e14);});};exports['reset']=function(_0x26d4e3,_0xc715e8,_0x257ea3){return db[_0x4df6('0x4a')][_0x4df6('0x22')]({'where':{'resetPasswordToken':_0x26d4e3[_0x4df6('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x4df6('0xf')](function(_0x50a871){if(!_0x50a871){throw new Error(_0x4df6('0x4c'));}return db[_0x4df6('0x40')][_0x4df6('0xc')]({'attributes':['id',_0x4df6('0x4d'),'enforcePasswordHistory',_0x4df6('0x4e')]})['then'](function(_0x227a12){if(_0x227a12[_0x4df6('0x4d')])authService['validatePasswordPattern'](_0x26d4e3[_0x4df6('0x3d')][_0x4df6('0x11')]);if(!_0x227a12[_0x4df6('0x4f')]||!_0x50a871[_0x4df6('0x50')])return _0x50a871;authService[_0x4df6('0x51')](_0x26d4e3[_0x4df6('0x3d')][_0x4df6('0x11')],_0x50a871[_0x4df6('0x50')],_0x227a12[_0x4df6('0x4e')]);return _0x50a871;})['then'](function(){_0x50a871[_0x4df6('0x11')]=_0x26d4e3['body'][_0x4df6('0x11')];_0x50a871[_0x4df6('0x52')]=null;_0x50a871[_0x4df6('0x44')]=null;return _0x50a871[_0x4df6('0x45')]();});})[_0x4df6('0xf')](function(){_0xc715e8[_0x4df6('0x34')](0xc8)['send']({'message':_0x4df6('0x53')});})[_0x4df6('0x20')](function(_0x4aa611){return handleError(_0xc715e8,0x1f4,_0x4aa611);});};passport[_0x4df6('0x54')](new LocalStrategy({'usernameField':'name','passwordField':_0x4df6('0x11')},function(_0x2cd9c3,_0xfa886,_0x38e9d1){return localAuthenticate(db[_0x4df6('0x4a')],_0x2cd9c3,_0xfa886,_0x38e9d1);})); \ No newline at end of file +var _0x17b6=['salt','disabled','blocked','loginAttempts','admin','user','agent','authenticate','blockedAt','add','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','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','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','headers','/reset/','status','send','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','randomstring','moment','../../mysqldb','../../config/utils','client','findOne','allowedLoginAttempts','blockDuration','then'];(function(_0x4a352c,_0x1844ac){var _0x488000=function(_0x161bbc){while(--_0x161bbc){_0x4a352c['push'](_0x4a352c['shift']());}};_0x488000(++_0x1844ac);}(_0x17b6,0xf7));var _0x617b=function(_0x7e9407,_0x3fac7f){_0x7e9407=_0x7e9407-0x0;var _0xa94290=_0x17b6[_0x7e9407];return _0xa94290;};'use strict';var util=require(_0x617b('0x0'));var passport=require(_0x617b('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x617b('0x2'));var moment=require(_0x617b('0x3'));var db=require(_0x617b('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x617b('0x5'));var client=jayson[_0x617b('0x6')]['http']({'port':0x232b});function localAuthenticate(_0x3088f3,_0x2ca647,_0x502d56,_0x4ddd96){var _0x3e9f8c,_0x19729e;return db['Setting'][_0x617b('0x7')]({'where':{'id':0x1},'attributes':[_0x617b('0x8'),_0x617b('0x9')],'raw':!![]})[_0x617b('0xa')](function(_0x2bac6d){_0x3e9f8c=_0x2bac6d;return _0x3088f3[_0x617b('0x7')]({'attributes':['id','name','password',_0x617b('0xb'),'role',_0x617b('0xc'),_0x617b('0xd'),'blockedAt',_0x617b('0xe')],'where':{'name':_0x2ca647,'role':{'$or':[_0x617b('0xf'),_0x617b('0x10'),_0x617b('0x11')]}}});})[_0x617b('0xa')](function(_0x35b8a7){if(!_0x35b8a7||_0x35b8a7&&_0x35b8a7['name']!==_0x2ca647){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x19729e=_0x35b8a7;return _0x19729e;}})[_0x617b('0xa')](function(){_0x19729e[_0x617b('0x12')](_0x502d56,function(_0xbc1203,_0x3eda14){var _0xfc8565=_0x19729e[_0x617b('0xe')]+0x1;if(_0xbc1203){return _0x4ddd96(_0xbc1203);}else if(!_0x3eda14){if(_0x19729e[_0x617b('0xc')]){return _0x4ddd96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3e9f8c[_0x617b('0x8')]>0x0){if(_0x19729e['blocked']){if(_0x3e9f8c[_0x617b('0x9')]>0x0){if(moment(_0x19729e[_0x617b('0x13')])[_0x617b('0x14')](_0x3e9f8c[_0x617b('0x9')],_0x617b('0x15'))>moment()){return _0x4ddd96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x617b('0x16')](_0x19729e,_0xfc8565,![],null)[_0x617b('0xa')](function(){return _0x4ddd96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}}else{if(_0xfc8565>=_0x3e9f8c[_0x617b('0x8')]){return utils[_0x617b('0x16')](_0x19729e,0x0,!![],moment())['then'](function(){return _0x4ddd96(null,![],{'message':_0x617b('0x17')});});}else{return utils[_0x617b('0x16')](_0x19729e,_0xfc8565,![],null)[_0x617b('0xa')](function(){return _0x4ddd96(null,![],{'message':_0x617b('0x17')});});}}}else{return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}}else{if(_0x19729e[_0x617b('0xc')]){return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}else if(_0x3e9f8c[_0x617b('0x8')]>0x0){if(_0x19729e[_0x617b('0xd')]){if(_0x3e9f8c['blockDuration']>0x0){if(moment(_0x19729e[_0x617b('0x13')])[_0x617b('0x14')](_0x3e9f8c[_0x617b('0x9')],_0x617b('0x15'))>moment()){return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}else{return utils[_0x617b('0x16')](_0x19729e,0x0,![],null)[_0x617b('0xa')](function(){return utils['getLicense'](_0x19729e);})[_0x617b('0xa')](function(){return _0x4ddd96(null,_0x19729e);});}}else{return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}}else{return utils[_0x617b('0x16')](_0x19729e,0x0,![],null)[_0x617b('0xa')](function(){return utils[_0x617b('0x18')](_0x19729e);})['then'](function(){return _0x4ddd96(null,_0x19729e);})['catch'](function(_0x54ce87){return _0x4ddd96(null,![],_0x54ce87);});}}else{if(_0x19729e[_0x617b('0xd')]){return _0x4ddd96(null,![],{'message':_0x617b('0x17')});}else{return utils['getLicense'](_0x19729e)[_0x617b('0xa')](function(){return _0x4ddd96(null,_0x19729e);});}}}});})[_0x617b('0x19')](function(_0x5f0503){return _0x4ddd96(null,![],_0x5f0503);});}function sendServiceMail(_0x23c14b){return db['MailAccount'][_0x617b('0x1a')]({'where':{'service':!![]},'attributes':['id',_0x617b('0x1b'),_0x617b('0x1c')],'include':[{'model':db[_0x617b('0x1d')],'as':_0x617b('0x1e')}]})[_0x617b('0xa')](function(_0x37d7b1){if(!_0x37d7b1){throw new Error(_0x617b('0x1f'));}var _0x4b078c={'tls':{'rejectUnauthorized':![]}};if(_0x37d7b1[_0x617b('0x1e')][_0x617b('0x20')]){_0x4b078c[_0x617b('0x20')]=_0x37d7b1[_0x617b('0x1e')][_0x617b('0x20')];}else{_0x4b078c[_0x617b('0x21')]=_0x37d7b1[_0x617b('0x1e')][_0x617b('0x21')];_0x4b078c[_0x617b('0x22')]=_0x37d7b1[_0x617b('0x1e')][_0x617b('0x22')];_0x4b078c[_0x617b('0x23')]=_0x37d7b1[_0x617b('0x1e')][_0x617b('0x23')];}if(_0x37d7b1[_0x617b('0x1e')][_0x617b('0x24')]){_0x4b078c[_0x617b('0x25')]={'user':_0x37d7b1[_0x617b('0x1e')][_0x617b('0x10')],'pass':_0x37d7b1[_0x617b('0x1e')][_0x617b('0x26')]};}var _0x58fc0b={'account':_0x4b078c,'message':_[_0x617b('0x27')]({'from':util[_0x617b('0x28')]('\x22%s\x22\x20<%s>',_0x37d7b1[_0x617b('0x1b')],_0x37d7b1[_0x617b('0x1c')]||_0x37d7b1[_0x617b('0x1e')][_0x617b('0x10')])},_0x23c14b)};return client[_0x617b('0x29')](_0x617b('0x2a'),_0x58fc0b);})[_0x617b('0xa')](function(_0x41b456){if(_0x41b456[_0x617b('0x2b')]){throw new Error(util[_0x617b('0x28')](_0x617b('0x2c'),_0x41b456[_0x617b('0x2b')][_0x617b('0x2d')]||JSON[_0x617b('0x2e')](_0x41b456[_0x617b('0x2b')])));}return!![];});}function handleError(_0x20d5fd,_0x19ef5e,_0x22a183){return _0x20d5fd['status'](_0x19ef5e||0x1f4)['send']({'message':_0x22a183?_0x22a183[_0x617b('0x2d')]||_0x22a183:''});}exports['login']=function(_0x33ff86,_0x29952d,_0x1156e1){passport[_0x617b('0x12')](_0x617b('0x2f'),function(_0x94c3d5,_0x3b6415,_0xd1fc86){var _0x1ef69d=_0x94c3d5||_0xd1fc86;if(_0x1ef69d){return handleError(_0x29952d,0x191,_0x1ef69d);}if(!_0x3b6415){return handleError(_0x29952d,0x194,{'message':_0x617b('0x30')});}else{var _0x3f8efa={'payload':{'id':_0x3b6415['id'],'role':_0x3b6415[_0x617b('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x617b('0x32')](_0x3f8efa)[_0x617b('0xa')](function(_0x432e35){_0x29952d[_0x617b('0x33')]({'id':_0x3b6415['id'],'token':_0x432e35,'statusCall':'','isAlreadyLogged':_0x3b6415[_0x617b('0x34')]});});}})(_0x33ff86,_0x29952d,_0x1156e1);};exports[_0x617b('0x35')]=function(_0x3c170d,_0x4b3bfa,_0x12fe8b){if(!_0x3c170d['body'][_0x617b('0x1c')]){return handleError(_0x4b3bfa,0x1f4,{'message':_0x617b('0x36')});}var _0x500dc6=rs[_0x617b('0x37')]();_0x3c170d['body'][_0x617b('0x1c')]=_0x3c170d[_0x617b('0x38')][_0x617b('0x1c')][_0x617b('0x39')]()[_0x617b('0x3a')]();var _0x2b6ecf;return db[_0x617b('0x3b')][_0x617b('0x7')]({'where':{'id':0x1},'attributes':[_0x617b('0x8'),_0x617b('0x9')],'raw':!![]})['then'](function(_0x4f4b8a){_0x2b6ecf=_0x4f4b8a;return db[_0x617b('0x3c')]['find']({'where':{'email':_0x3c170d[_0x617b('0x38')][_0x617b('0x1c')]}});})[_0x617b('0xa')](function(_0x408e19){if(!_0x408e19){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x408e19[_0x617b('0xc')]){throw new Error(_0x617b('0x3d'));}if(_0x408e19['blocked']){if(moment(_0x408e19[_0x617b('0x13')])[_0x617b('0x14')](_0x2b6ecf[_0x617b('0x9')],_0x617b('0x15'))>moment()){throw new Error(_0x617b('0x3e'));}else{_0x408e19[_0x617b('0xd')]=![];_0x408e19[_0x617b('0x13')]=null;}}_0x408e19[_0x617b('0x3f')]=_0x500dc6;_0x408e19['resetPasswordExpires']=Date[_0x617b('0x40')]()+0x36ee80;return _0x408e19[_0x617b('0x41')]();})[_0x617b('0xa')](function(){return sendServiceMail({'to':_0x3c170d[_0x617b('0x38')][_0x617b('0x1c')],'subject':_0x617b('0x42'),'text':_0x617b('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x3c170d[_0x617b('0x44')]['host']+_0x617b('0x45')+_0x500dc6+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x617b('0xa')](function(){_0x4b3bfa[_0x617b('0x46')](0xc8)[_0x617b('0x47')]({'message':_0x617b('0x48')});})[_0x617b('0x19')](function(_0x4d3360){return handleError(_0x4b3bfa,0x1f4,_0x4d3360);});};exports['reset']=function(_0x151eb8,_0x5c7713,_0x323cf7){return db[_0x617b('0x3c')][_0x617b('0x1a')]({'where':{'resetPasswordToken':_0x151eb8[_0x617b('0x49')][_0x617b('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x617b('0xa')](function(_0x585f59){if(!_0x585f59){throw new Error(_0x617b('0x4b'));}return db[_0x617b('0x3b')][_0x617b('0x7')]({'attributes':['id','securePassword',_0x617b('0x4c'),_0x617b('0x4d')]})[_0x617b('0xa')](function(_0x4bcd64){if(_0x4bcd64[_0x617b('0x4e')])authService[_0x617b('0x4f')](_0x151eb8['body'][_0x617b('0x50')]);if(!_0x4bcd64[_0x617b('0x4c')]||!_0x585f59[_0x617b('0x51')])return _0x585f59;authService[_0x617b('0x52')](_0x151eb8['body']['password'],_0x585f59[_0x617b('0x51')],_0x4bcd64['passwordHistoryLimit']);return _0x585f59;})['then'](function(){_0x585f59[_0x617b('0x50')]=_0x151eb8['body'][_0x617b('0x50')];_0x585f59[_0x617b('0x3f')]=null;_0x585f59[_0x617b('0x53')]=null;return _0x585f59[_0x617b('0x41')]();});})['then'](function(){_0x5c7713[_0x617b('0x46')](0xc8)[_0x617b('0x47')]({'message':_0x617b('0x54')});})['catch'](function(_0x28842c){return handleError(_0x5c7713,0x1f4,_0x28842c);});};passport[_0x617b('0x55')](new LocalStrategy({'usernameField':_0x617b('0x1b'),'passwordField':_0x617b('0x50')},function(_0x5f49dd,_0x5265c2,_0x243911){return localAuthenticate(db[_0x617b('0x3c')],_0x5f49dd,_0x5265c2,_0x243911);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 13b5348..8f24b85 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 _0x9f1d=['post','login','/forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x4cd4a9,_0x1e9e08){var _0x3d9036=function(_0x10adbf){while(--_0x10adbf){_0x4cd4a9['push'](_0x4cd4a9['shift']());}};_0x3d9036(++_0x1e9e08);}(_0x9f1d,0x1da));var _0xd9f1=function(_0x4059a6,_0x5a681f){_0x4059a6=_0x4059a6-0x0;var _0x3a9d08=_0x9f1d[_0x4059a6];return _0x3a9d08;};'use strict';var express=require(_0xd9f1('0x0'));var router=express[_0xd9f1('0x1')]();var controller=require(_0xd9f1('0x2'));router[_0xd9f1('0x3')]('/',controller[_0xd9f1('0x4')]);router['post'](_0xd9f1('0x5'),controller['forgot']);router[_0xd9f1('0x3')](_0xd9f1('0x6'),controller[_0xd9f1('0x7')]);module[_0xd9f1('0x8')]=router; \ No newline at end of file +var _0xb7f5=['express','Router','post','login','/forgot','forgot','reset','exports'];(function(_0x2a5ccb,_0x206fa6){var _0x35e0b0=function(_0x22dd28){while(--_0x22dd28){_0x2a5ccb['push'](_0x2a5ccb['shift']());}};_0x35e0b0(++_0x206fa6);}(_0xb7f5,0xa8));var _0x5b7f=function(_0xa7c6dc,_0x395fe5){_0xa7c6dc=_0xa7c6dc-0x0;var _0x291f0c=_0xb7f5[_0xa7c6dc];return _0x291f0c;};'use strict';var express=require(_0x5b7f('0x0'));var router=express[_0x5b7f('0x1')]();var controller=require('./authLocal.controller');router[_0x5b7f('0x2')]('/',controller[_0x5b7f('0x3')]);router['post'](_0x5b7f('0x4'),controller[_0x5b7f('0x5')]);router[_0x5b7f('0x2')]('/reset/:token',controller[_0x5b7f('0x6')]);module[_0x5b7f('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2cf824f..2811d40 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 _0xaf7d=['INTEGER','STRING','BOOLEAN'];(function(_0x13f752,_0x221be5){var _0xff8a32=function(_0x475f59){while(--_0x475f59){_0x13f752['push'](_0x13f752['shift']());}};_0xff8a32(++_0x221be5);}(_0xaf7d,0x18d));var _0xdaf7=function(_0x5879ac,_0x53fb1b){_0x5879ac=_0x5879ac-0x0;var _0x540cab=_0xaf7d[_0x5879ac];return _0x540cab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdaf7('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xdaf7('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xdaf7('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdaf7('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2c65=['BOOLEAN','sequelize','exports','STRING'];(function(_0x11f85b,_0x1c368d){var _0x573270=function(_0x590e74){while(--_0x590e74){_0x11f85b['push'](_0x11f85b['shift']());}};_0x573270(++_0x1c368d);}(_0x2c65,0x13d));var _0x52c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c65[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x52c6('0x0'));module[_0x52c6('0x1')]={'name':{'type':Sequelize[_0x52c6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x52c6('0x2')]},'description':{'type':Sequelize[_0x52c6('0x2')]},'status':{'type':Sequelize[_0x52c6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9c3d002..b3307b2 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 _0x60dd=['pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','addConditions','ids','omit','Condition','hasOwnProperty','getConditions','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x414da5,_0x2db1df){var _0x35bd91=function(_0x413217){while(--_0x413217){_0x414da5['push'](_0x414da5['shift']());}};_0x35bd91(++_0x2db1df);}(_0x60dd,0x15f));var _0xd60d=function(_0xe8b2d3,_0x4f3992){_0xe8b2d3=_0xe8b2d3-0x0;var _0x32814f=_0x60dd[_0xe8b2d3];return _0x32814f;};'use strict';var emlformat=require(_0xd60d('0x0'));var rimraf=require(_0xd60d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd60d('0x2'));var rp=require(_0xd60d('0x3'));var moment=require(_0xd60d('0x4'));var BPromise=require(_0xd60d('0x5'));var Mustache=require('mustache');var util=require(_0xd60d('0x6'));var path=require(_0xd60d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd60d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd60d('0x9'));var squel=require('squel');var crypto=require(_0xd60d('0xa'));var jsforce=require(_0xd60d('0xb'));var deskjs=require(_0xd60d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd60d('0xd'));var Redis=require(_0xd60d('0xe'));var authService=require(_0xd60d('0xf'));var qs=require(_0xd60d('0x10'));var as=require(_0xd60d('0x11'));var hardwareService=require(_0xd60d('0x12'));var logger=require(_0xd60d('0x13'))(_0xd60d('0x14'));var utils=require(_0xd60d('0x15'));var config=require(_0xd60d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbc893a,_0x25a626){_0x25a626=_0x25a626||0xcc;return function(_0x309351){if(_0x309351){return _0xbc893a[_0xd60d('0x17')](_0x25a626);}return _0xbc893a[_0xd60d('0x18')](_0x25a626)['end']();};}function respondWithResult(_0xe9fae4,_0x142ce9){_0x142ce9=_0x142ce9||0xc8;return function(_0x2dcafc){if(_0x2dcafc){return _0xe9fae4[_0xd60d('0x18')](_0x142ce9)[_0xd60d('0x19')](_0x2dcafc);}};}function respondWithFilteredResult(_0x16ec6e,_0x3ed314){return function(_0x213c24){if(_0x213c24){var _0x59b7ec=typeof _0x3ed314[_0xd60d('0x1a')]===_0xd60d('0x1b')&&typeof _0x3ed314[_0xd60d('0x1c')]==='undefined';var _0x4b3376=_0x213c24[_0xd60d('0x1d')];var _0x491dcd=_0x59b7ec?0x0:_0x3ed314[_0xd60d('0x1a')];var _0xf78c8c=_0x59b7ec?_0x213c24[_0xd60d('0x1d')]:_0x3ed314['offset']+_0x3ed314[_0xd60d('0x1c')];var _0x349774;if(_0xf78c8c>=_0x4b3376){_0xf78c8c=_0x4b3376;_0x349774=0xc8;}else{_0x349774=0xce;}_0x16ec6e['status'](_0x349774);return _0x16ec6e['set'](_0xd60d('0x1e'),_0x491dcd+'-'+_0xf78c8c+'/'+_0x4b3376)[_0xd60d('0x19')](_0x213c24);}return null;};}function patchUpdates(_0x30e302){return function(_0x19d51a){try{jsonpatch[_0xd60d('0x1f')](_0x19d51a,_0x30e302,!![]);}catch(_0x2ce9e7){return BPromise[_0xd60d('0x20')](_0x2ce9e7);}return _0x19d51a[_0xd60d('0x21')]();};}function saveUpdates(_0xecf0ca,_0xc248d0){return function(_0x1836c8){if(_0x1836c8){return _0x1836c8[_0xd60d('0x22')](_0xecf0ca)[_0xd60d('0x23')](function(_0x13b11d){return _0x13b11d;});}return null;};}function removeEntity(_0x20e8fa,_0x5219c7){return function(_0x1bbb80){if(_0x1bbb80){return _0x1bbb80[_0xd60d('0x24')]()[_0xd60d('0x23')](function(){_0x20e8fa[_0xd60d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf68d,_0x492278){return function(_0x55f3a6){if(!_0x55f3a6){_0x3cf68d[_0xd60d('0x17')](0x194);}return _0x55f3a6;};}function handleError(_0xde0609,_0x346443){_0x346443=_0x346443||0x1f4;return function(_0x2ace6b){logger[_0xd60d('0x25')](_0x2ace6b[_0xd60d('0x26')]);if(_0x2ace6b['name']){delete _0x2ace6b[_0xd60d('0x27')];}_0xde0609[_0xd60d('0x18')](_0x346443)[_0xd60d('0x28')](_0x2ace6b);};}exports[_0xd60d('0x29')]=function(_0x59fbd8,_0x42cb78){var _0x26b36d={},_0x4ed826={},_0x62db48={'count':0x0,'rows':[]};var _0xbc0034=_[_0xd60d('0x2a')](db[_0xd60d('0x2b')][_0xd60d('0x2c')],function(_0x21e8a4){return{'name':_0x21e8a4[_0xd60d('0x2d')],'type':_0x21e8a4[_0xd60d('0x2e')]['key']};});_0x4ed826[_0xd60d('0x2f')]=_[_0xd60d('0x2a')](_0xbc0034,_0xd60d('0x27'));_0x4ed826[_0xd60d('0x30')]=_[_0xd60d('0x31')](_0x59fbd8['query']);_0x4ed826[_0xd60d('0x32')]=_[_0xd60d('0x33')](_0x4ed826[_0xd60d('0x2f')],_0x4ed826['query']);_0x26b36d[_0xd60d('0x34')]=_[_0xd60d('0x33')](_0x4ed826['model'],qs['fields'](_0x59fbd8['query'][_0xd60d('0x35')]));_0x26b36d[_0xd60d('0x34')]=_0x26b36d[_0xd60d('0x34')][_0xd60d('0x36')]?_0x26b36d['attributes']:_0x4ed826[_0xd60d('0x2f')];if(!_0x59fbd8[_0xd60d('0x30')]['hasOwnProperty'](_0xd60d('0x37'))){_0x26b36d[_0xd60d('0x1c')]=qs['limit'](_0x59fbd8[_0xd60d('0x30')]['limit']);_0x26b36d[_0xd60d('0x1a')]=qs[_0xd60d('0x1a')](_0x59fbd8['query'][_0xd60d('0x1a')]);}_0x26b36d[_0xd60d('0x38')]=qs[_0xd60d('0x39')](_0x59fbd8[_0xd60d('0x30')][_0xd60d('0x39')]);_0x26b36d[_0xd60d('0x3a')]=qs['filters'](_[_0xd60d('0x3b')](_0x59fbd8[_0xd60d('0x30')],_0x4ed826[_0xd60d('0x32')]),_0xbc0034);if(_0x59fbd8[_0xd60d('0x30')][_0xd60d('0x3c')]){_0x26b36d['where']=_['merge'](_0x26b36d[_0xd60d('0x3a')],{'$or':_[_0xd60d('0x2a')](_0xbc0034,function(_0x24f595){if(_0x24f595[_0xd60d('0x2e')]!==_0xd60d('0x3d')){var _0x373b4d={};_0x373b4d[_0x24f595[_0xd60d('0x27')]]={'$like':'%'+_0x59fbd8['query'][_0xd60d('0x3c')]+'%'};return _0x373b4d;}})});}_0x26b36d=_[_0xd60d('0x3e')]({},_0x26b36d,_0x59fbd8[_0xd60d('0x3f')]);var _0xe54485={'where':_0x26b36d[_0xd60d('0x3a')]};return db[_0xd60d('0x2b')][_0xd60d('0x1d')](_0xe54485)[_0xd60d('0x23')](function(_0x4c3492){_0x62db48[_0xd60d('0x1d')]=_0x4c3492;if(_0x59fbd8[_0xd60d('0x30')][_0xd60d('0x40')]){_0x26b36d[_0xd60d('0x41')]=[{'all':!![]}];}return db[_0xd60d('0x2b')][_0xd60d('0x42')](_0x26b36d);})['then'](function(_0x463384){_0x62db48[_0xd60d('0x43')]=_0x463384;return _0x62db48;})[_0xd60d('0x23')](respondWithFilteredResult(_0x42cb78,_0x26b36d))[_0xd60d('0x44')](handleError(_0x42cb78,null));};exports['show']=function(_0x2c7bda,_0x16481c){var _0x3e8061={'raw':![],'where':{'id':_0x2c7bda['params']['id']}},_0x2f0eae={};_0x2f0eae[_0xd60d('0x2f')]=_['keys'](db[_0xd60d('0x2b')][_0xd60d('0x2c')]);_0x2f0eae['query']=_['keys'](_0x2c7bda['query']);_0x2f0eae[_0xd60d('0x32')]=_[_0xd60d('0x33')](_0x2f0eae[_0xd60d('0x2f')],_0x2f0eae[_0xd60d('0x30')]);_0x3e8061[_0xd60d('0x34')]=_[_0xd60d('0x33')](_0x2f0eae[_0xd60d('0x2f')],qs['fields'](_0x2c7bda['query'][_0xd60d('0x35')]));_0x3e8061['attributes']=_0x3e8061[_0xd60d('0x34')][_0xd60d('0x36')]?_0x3e8061[_0xd60d('0x34')]:_0x2f0eae['model'];if(_0x2c7bda['query']['includeAll']){_0x3e8061[_0xd60d('0x41')]=[{'all':!![]}];}_0x3e8061=_[_0xd60d('0x3e')]({},_0x3e8061,_0x2c7bda[_0xd60d('0x3f')]);return db['Automation'][_0xd60d('0x45')](_0x3e8061)[_0xd60d('0x23')](handleEntityNotFound(_0x16481c,null))[_0xd60d('0x23')](respondWithResult(_0x16481c,null))[_0xd60d('0x44')](handleError(_0x16481c,null));};exports[_0xd60d('0x46')]=function(_0x286a2c,_0x3b8a80){return db[_0xd60d('0x2b')][_0xd60d('0x46')](_0x286a2c[_0xd60d('0x47')],{})[_0xd60d('0x23')](respondWithResult(_0x3b8a80,0xc9))['catch'](handleError(_0x3b8a80,null));};exports[_0xd60d('0x22')]=function(_0x59ccc6,_0x150585){if(_0x59ccc6['body']['id']){delete _0x59ccc6[_0xd60d('0x47')]['id'];}return db[_0xd60d('0x2b')]['find']({'where':{'id':_0x59ccc6[_0xd60d('0x48')]['id']}})[_0xd60d('0x23')](handleEntityNotFound(_0x150585,null))['then'](saveUpdates(_0x59ccc6[_0xd60d('0x47')],null))[_0xd60d('0x23')](respondWithResult(_0x150585,null))[_0xd60d('0x44')](handleError(_0x150585,null));};exports[_0xd60d('0x24')]=function(_0x302a35,_0x2731e3){return db[_0xd60d('0x2b')]['find']({'where':{'id':_0x302a35[_0xd60d('0x48')]['id']}})[_0xd60d('0x23')](handleEntityNotFound(_0x2731e3,null))[_0xd60d('0x23')](removeEntity(_0x2731e3,null))[_0xd60d('0x44')](handleError(_0x2731e3,null));};exports[_0xd60d('0x49')]=function(_0x1c6b96,_0x4552c3,_0x26452d){return db['Condition']['find']({'where':{'id':_0x1c6b96[_0xd60d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4552c3,null))[_0xd60d('0x23')](function(_0x2d7925){if(_0x2d7925){return _0x2d7925[_0xd60d('0x49')](_0x1c6b96['body'][_0xd60d('0x4a')],_[_0xd60d('0x4b')](_0x1c6b96['body'],['ids','id'])||{});}})[_0xd60d('0x23')](respondWithResult(_0x4552c3,null))[_0xd60d('0x44')](handleError(_0x4552c3,null));};exports['getConditions']=function(_0x1f2905,_0xc916cf,_0x3bfe04){var _0x2cb2d0={};var _0x5add0f={};var _0x1d41f5;var _0x25e255;return db['Automation']['findOne']({'where':{'id':_0x1f2905[_0xd60d('0x48')]['id']}})[_0xd60d('0x23')](handleEntityNotFound(_0xc916cf,null))[_0xd60d('0x23')](function(_0x34457f){if(_0x34457f){_0x1d41f5=_0x34457f;_0x5add0f[_0xd60d('0x2f')]=_['keys'](db[_0xd60d('0x4c')][_0xd60d('0x2c')]);_0x5add0f[_0xd60d('0x30')]=_['keys'](_0x1f2905[_0xd60d('0x30')]);_0x5add0f[_0xd60d('0x32')]=_[_0xd60d('0x33')](_0x5add0f['model'],_0x5add0f[_0xd60d('0x30')]);_0x2cb2d0['attributes']=_[_0xd60d('0x33')](_0x5add0f[_0xd60d('0x2f')],qs[_0xd60d('0x35')](_0x1f2905[_0xd60d('0x30')][_0xd60d('0x35')]));_0x2cb2d0[_0xd60d('0x34')]=_0x2cb2d0[_0xd60d('0x34')][_0xd60d('0x36')]?_0x2cb2d0[_0xd60d('0x34')]:_0x5add0f[_0xd60d('0x2f')];_0x2cb2d0['order']=qs[_0xd60d('0x39')](_0x1f2905[_0xd60d('0x30')][_0xd60d('0x39')]);_0x2cb2d0[_0xd60d('0x3a')]=qs[_0xd60d('0x32')](_[_0xd60d('0x3b')](_0x1f2905[_0xd60d('0x30')],_0x5add0f[_0xd60d('0x32')]));if(_0x1f2905['query']['filter']){_0x2cb2d0[_0xd60d('0x3a')]=_[_0xd60d('0x3e')](_0x2cb2d0[_0xd60d('0x3a')],{'$or':_[_0xd60d('0x2a')](_0x2cb2d0['attributes'],function(_0x636271){var _0x807cdd={};_0x807cdd[_0x636271]={'$like':'%'+_0x1f2905[_0xd60d('0x30')][_0xd60d('0x3c')]+'%'};return _0x807cdd;})});}_0x2cb2d0=_[_0xd60d('0x3e')]({},_0x2cb2d0,_0x1f2905[_0xd60d('0x3f')]);return _0x1d41f5['getConditions'](_0x2cb2d0);}})[_0xd60d('0x23')](function(_0x456ad8){if(_0x456ad8){_0x25e255=_0x456ad8[_0xd60d('0x36')];if(!_0x1f2905[_0xd60d('0x30')][_0xd60d('0x4d')](_0xd60d('0x37'))){_0x2cb2d0['limit']=qs[_0xd60d('0x1c')](_0x1f2905['query']['limit']);_0x2cb2d0['offset']=qs[_0xd60d('0x1a')](_0x1f2905[_0xd60d('0x30')][_0xd60d('0x1a')]);}return _0x1d41f5[_0xd60d('0x4e')](_0x2cb2d0);}})['then'](function(_0x204bf2){if(_0x204bf2){return _0x204bf2?{'count':_0x25e255,'rows':_0x204bf2}:null;}})[_0xd60d('0x23')](respondWithResult(_0xc916cf,null))[_0xd60d('0x44')](handleError(_0xc916cf,null));};exports[_0xd60d('0x4f')]=function(_0xf35b2,_0x990463,_0x54c7d3){return db[_0xd60d('0x50')]['find']({'where':{'id':_0xf35b2[_0xd60d('0x48')]['id']}})['then'](handleEntityNotFound(_0x990463,null))[_0xd60d('0x23')](function(_0x2f883e){if(_0x2f883e){return _0x2f883e['addActions'](_0xf35b2[_0xd60d('0x47')]['ids'],_[_0xd60d('0x4b')](_0xf35b2['body'],[_0xd60d('0x4a'),'id'])||{});}})[_0xd60d('0x23')](respondWithResult(_0x990463,null))[_0xd60d('0x44')](handleError(_0x990463,null));};exports[_0xd60d('0x51')]=function(_0x4f5892,_0x163aec,_0x274bac){var _0x4a7a68={};var _0x4d9ee7={};var _0x30df30;var _0x1b020d;return db[_0xd60d('0x2b')]['findOne']({'where':{'id':_0x4f5892[_0xd60d('0x48')]['id']}})[_0xd60d('0x23')](handleEntityNotFound(_0x163aec,null))[_0xd60d('0x23')](function(_0x4ae0cf){if(_0x4ae0cf){_0x30df30=_0x4ae0cf;_0x4d9ee7[_0xd60d('0x2f')]=_['keys'](db[_0xd60d('0x50')][_0xd60d('0x2c')]);_0x4d9ee7['query']=_['keys'](_0x4f5892[_0xd60d('0x30')]);_0x4d9ee7[_0xd60d('0x32')]=_['intersection'](_0x4d9ee7[_0xd60d('0x2f')],_0x4d9ee7[_0xd60d('0x30')]);_0x4a7a68['attributes']=_[_0xd60d('0x33')](_0x4d9ee7['model'],qs[_0xd60d('0x35')](_0x4f5892[_0xd60d('0x30')]['fields']));_0x4a7a68[_0xd60d('0x34')]=_0x4a7a68['attributes'][_0xd60d('0x36')]?_0x4a7a68[_0xd60d('0x34')]:_0x4d9ee7[_0xd60d('0x2f')];_0x4a7a68['order']=qs[_0xd60d('0x39')](_0x4f5892[_0xd60d('0x30')][_0xd60d('0x39')]);_0x4a7a68[_0xd60d('0x3a')]=qs['filters'](_['pick'](_0x4f5892[_0xd60d('0x30')],_0x4d9ee7[_0xd60d('0x32')]));if(_0x4f5892[_0xd60d('0x30')]['filter']){_0x4a7a68[_0xd60d('0x3a')]=_[_0xd60d('0x3e')](_0x4a7a68['where'],{'$or':_['map'](_0x4a7a68[_0xd60d('0x34')],function(_0x30f6be){var _0x1fc01d={};_0x1fc01d[_0x30f6be]={'$like':'%'+_0x4f5892[_0xd60d('0x30')][_0xd60d('0x3c')]+'%'};return _0x1fc01d;})});}_0x4a7a68=_[_0xd60d('0x3e')]({},_0x4a7a68,_0x4f5892[_0xd60d('0x3f')]);return _0x30df30[_0xd60d('0x51')](_0x4a7a68);}})['then'](function(_0x148e11){if(_0x148e11){_0x1b020d=_0x148e11['length'];if(!_0x4f5892[_0xd60d('0x30')][_0xd60d('0x4d')]('nolimit')){_0x4a7a68[_0xd60d('0x1c')]=qs[_0xd60d('0x1c')](_0x4f5892[_0xd60d('0x30')]['limit']);_0x4a7a68[_0xd60d('0x1a')]=qs[_0xd60d('0x1a')](_0x4f5892[_0xd60d('0x30')][_0xd60d('0x1a')]);}return _0x30df30[_0xd60d('0x51')](_0x4a7a68);}})['then'](function(_0x37f39d){if(_0x37f39d){return _0x37f39d?{'count':_0x1b020d,'rows':_0x37f39d}:null;}})['then'](respondWithResult(_0x163aec,null))[_0xd60d('0x44')](handleError(_0x163aec,null));}; \ No newline at end of file +var _0xbd51=['undefined','count','set','Content-Range','reject','update','then','destroy','error','name','Automation','model','map','query','keys','filters','attributes','intersection','fields','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','length','find','create','body','params','Condition','addConditions','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','hasOwnProperty','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x1a013b,_0x11ee01){var _0x2941e2=function(_0x53f388){while(--_0x53f388){_0x1a013b['push'](_0x1a013b['shift']());}};_0x2941e2(++_0x11ee01);}(_0xbd51,0xd2));var _0x1bd5=function(_0xf0a090,_0x3b9ed2){_0xf0a090=_0xf0a090-0x0;var _0x507cea=_0xbd51[_0xf0a090];return _0x507cea;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1bd5('0x1'));var rp=require(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var Mustache=require(_0x1bd5('0x5'));var util=require(_0x1bd5('0x6'));var path=require(_0x1bd5('0x7'));var sox=require(_0x1bd5('0x8'));var csv=require(_0x1bd5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bd5('0xa'));var _=require(_0x1bd5('0xb'));var squel=require(_0x1bd5('0xc'));var crypto=require(_0x1bd5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1bd5('0xe'));var toCsv=require(_0x1bd5('0x9'));var querystring=require(_0x1bd5('0xf'));var Papa=require(_0x1bd5('0x10'));var Redis=require('ioredis');var authService=require(_0x1bd5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1bd5('0x12'));var hardwareService=require(_0x1bd5('0x13'));var logger=require(_0x1bd5('0x14'))('api');var utils=require(_0x1bd5('0x15'));var config=require(_0x1bd5('0x16'));var licenseUtil=require(_0x1bd5('0x17'));var db=require(_0x1bd5('0x18'))['db'];function respondWithStatusCode(_0x2df3ae,_0xc2b022){_0xc2b022=_0xc2b022||0xcc;return function(_0x3f1b37){if(_0x3f1b37){return _0x2df3ae[_0x1bd5('0x19')](_0xc2b022);}return _0x2df3ae['status'](_0xc2b022)[_0x1bd5('0x1a')]();};}function respondWithResult(_0x1f5e92,_0x428ef0){_0x428ef0=_0x428ef0||0xc8;return function(_0xd75756){if(_0xd75756){return _0x1f5e92[_0x1bd5('0x1b')](_0x428ef0)[_0x1bd5('0x1c')](_0xd75756);}};}function respondWithFilteredResult(_0x4deaee,_0x193508){return function(_0x1a3eb9){if(_0x1a3eb9){var _0x36e84e=typeof _0x193508[_0x1bd5('0x1d')]==='undefined'&&typeof _0x193508['limit']===_0x1bd5('0x1e');var _0x37841f=_0x1a3eb9[_0x1bd5('0x1f')];var _0x5cf9ae=_0x36e84e?0x0:_0x193508[_0x1bd5('0x1d')];var _0x15e159=_0x36e84e?_0x1a3eb9[_0x1bd5('0x1f')]:_0x193508[_0x1bd5('0x1d')]+_0x193508['limit'];var _0x32b4a9;if(_0x15e159>=_0x37841f){_0x15e159=_0x37841f;_0x32b4a9=0xc8;}else{_0x32b4a9=0xce;}_0x4deaee[_0x1bd5('0x1b')](_0x32b4a9);return _0x4deaee[_0x1bd5('0x20')](_0x1bd5('0x21'),_0x5cf9ae+'-'+_0x15e159+'/'+_0x37841f)[_0x1bd5('0x1c')](_0x1a3eb9);}return null;};}function patchUpdates(_0xf4e7c9){return function(_0x5a1860){try{jsonpatch['apply'](_0x5a1860,_0xf4e7c9,!![]);}catch(_0x3e7fa2){return BPromise[_0x1bd5('0x22')](_0x3e7fa2);}return _0x5a1860['save']();};}function saveUpdates(_0x28be6d,_0x5baa97){return function(_0x2057b9){if(_0x2057b9){return _0x2057b9[_0x1bd5('0x23')](_0x28be6d)[_0x1bd5('0x24')](function(_0x53bb79){return _0x53bb79;});}return null;};}function removeEntity(_0x270695,_0x528a1c){return function(_0x3c8320){if(_0x3c8320){return _0x3c8320[_0x1bd5('0x25')]()[_0x1bd5('0x24')](function(){_0x270695[_0x1bd5('0x1b')](0xcc)[_0x1bd5('0x1a')]();});}};}function handleEntityNotFound(_0x455fad,_0x3057d4){return function(_0x5f52c7){if(!_0x5f52c7){_0x455fad[_0x1bd5('0x19')](0x194);}return _0x5f52c7;};}function handleError(_0x26352a,_0x14aec4){_0x14aec4=_0x14aec4||0x1f4;return function(_0x425b90){logger[_0x1bd5('0x26')](_0x425b90['stack']);if(_0x425b90['name']){delete _0x425b90[_0x1bd5('0x27')];}_0x26352a[_0x1bd5('0x1b')](_0x14aec4)['send'](_0x425b90);};}exports['index']=function(_0x8dc53,_0x1c20f8){var _0x4f3b02={},_0x487048={},_0x407d42={'count':0x0,'rows':[]};var _0x4e8745=_['map'](db[_0x1bd5('0x28')]['rawAttributes'],function(_0x476900){return{'name':_0x476900['fieldName'],'type':_0x476900['type']['key']};});_0x487048[_0x1bd5('0x29')]=_[_0x1bd5('0x2a')](_0x4e8745,_0x1bd5('0x27'));_0x487048[_0x1bd5('0x2b')]=_[_0x1bd5('0x2c')](_0x8dc53[_0x1bd5('0x2b')]);_0x487048[_0x1bd5('0x2d')]=_['intersection'](_0x487048[_0x1bd5('0x29')],_0x487048['query']);_0x4f3b02[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x487048[_0x1bd5('0x29')],qs['fields'](_0x8dc53[_0x1bd5('0x2b')][_0x1bd5('0x30')]));_0x4f3b02[_0x1bd5('0x2e')]=_0x4f3b02[_0x1bd5('0x2e')]['length']?_0x4f3b02[_0x1bd5('0x2e')]:_0x487048[_0x1bd5('0x29')];if(!_0x8dc53[_0x1bd5('0x2b')]['hasOwnProperty']('nolimit')){_0x4f3b02[_0x1bd5('0x31')]=qs[_0x1bd5('0x31')](_0x8dc53[_0x1bd5('0x2b')][_0x1bd5('0x31')]);_0x4f3b02[_0x1bd5('0x1d')]=qs[_0x1bd5('0x1d')](_0x8dc53['query'][_0x1bd5('0x1d')]);}_0x4f3b02[_0x1bd5('0x32')]=qs[_0x1bd5('0x33')](_0x8dc53[_0x1bd5('0x2b')][_0x1bd5('0x33')]);_0x4f3b02[_0x1bd5('0x34')]=qs['filters'](_[_0x1bd5('0x35')](_0x8dc53['query'],_0x487048['filters']),_0x4e8745);if(_0x8dc53['query'][_0x1bd5('0x36')]){_0x4f3b02[_0x1bd5('0x34')]=_[_0x1bd5('0x37')](_0x4f3b02[_0x1bd5('0x34')],{'$or':_[_0x1bd5('0x2a')](_0x4e8745,function(_0x34328b){if(_0x34328b[_0x1bd5('0x38')]!==_0x1bd5('0x39')){var _0x313f12={};_0x313f12[_0x34328b['name']]={'$like':'%'+_0x8dc53[_0x1bd5('0x2b')][_0x1bd5('0x36')]+'%'};return _0x313f12;}})});}_0x4f3b02=_[_0x1bd5('0x37')]({},_0x4f3b02,_0x8dc53[_0x1bd5('0x3a')]);var _0x18c9b3={'where':_0x4f3b02[_0x1bd5('0x34')]};return db['Automation'][_0x1bd5('0x1f')](_0x18c9b3)[_0x1bd5('0x24')](function(_0xe2bb4f){_0x407d42['count']=_0xe2bb4f;if(_0x8dc53['query'][_0x1bd5('0x3b')]){_0x4f3b02[_0x1bd5('0x3c')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x4f3b02);})[_0x1bd5('0x24')](function(_0x1e6141){_0x407d42['rows']=_0x1e6141;return _0x407d42;})['then'](respondWithFilteredResult(_0x1c20f8,_0x4f3b02))[_0x1bd5('0x3d')](handleError(_0x1c20f8,null));};exports[_0x1bd5('0x3e')]=function(_0x1b741c,_0x30d24b){var _0x27b857={'raw':![],'where':{'id':_0x1b741c['params']['id']}},_0x4fa9c9={};_0x4fa9c9[_0x1bd5('0x29')]=_['keys'](db[_0x1bd5('0x28')][_0x1bd5('0x3f')]);_0x4fa9c9[_0x1bd5('0x2b')]=_[_0x1bd5('0x2c')](_0x1b741c['query']);_0x4fa9c9[_0x1bd5('0x2d')]=_[_0x1bd5('0x2f')](_0x4fa9c9[_0x1bd5('0x29')],_0x4fa9c9[_0x1bd5('0x2b')]);_0x27b857[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x4fa9c9[_0x1bd5('0x29')],qs[_0x1bd5('0x30')](_0x1b741c[_0x1bd5('0x2b')][_0x1bd5('0x30')]));_0x27b857[_0x1bd5('0x2e')]=_0x27b857['attributes'][_0x1bd5('0x40')]?_0x27b857['attributes']:_0x4fa9c9[_0x1bd5('0x29')];if(_0x1b741c[_0x1bd5('0x2b')][_0x1bd5('0x3b')]){_0x27b857['include']=[{'all':!![]}];}_0x27b857=_[_0x1bd5('0x37')]({},_0x27b857,_0x1b741c[_0x1bd5('0x3a')]);return db[_0x1bd5('0x28')][_0x1bd5('0x41')](_0x27b857)[_0x1bd5('0x24')](handleEntityNotFound(_0x30d24b,null))[_0x1bd5('0x24')](respondWithResult(_0x30d24b,null))[_0x1bd5('0x3d')](handleError(_0x30d24b,null));};exports[_0x1bd5('0x42')]=function(_0x1f0a79,_0x4c9c23){return db[_0x1bd5('0x28')][_0x1bd5('0x42')](_0x1f0a79['body'],{})['then'](respondWithResult(_0x4c9c23,0xc9))[_0x1bd5('0x3d')](handleError(_0x4c9c23,null));};exports['update']=function(_0x1490c8,_0x2cb73a){if(_0x1490c8[_0x1bd5('0x43')]['id']){delete _0x1490c8[_0x1bd5('0x43')]['id'];}return db[_0x1bd5('0x28')][_0x1bd5('0x41')]({'where':{'id':_0x1490c8[_0x1bd5('0x44')]['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x2cb73a,null))[_0x1bd5('0x24')](saveUpdates(_0x1490c8[_0x1bd5('0x43')],null))[_0x1bd5('0x24')](respondWithResult(_0x2cb73a,null))[_0x1bd5('0x3d')](handleError(_0x2cb73a,null));};exports['destroy']=function(_0x460670,_0x149462){return db['Automation']['find']({'where':{'id':_0x460670[_0x1bd5('0x44')]['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x149462,null))[_0x1bd5('0x24')](removeEntity(_0x149462,null))[_0x1bd5('0x3d')](handleError(_0x149462,null));};exports['addConditions']=function(_0x4df15f,_0x29fab9,_0x4490cf){return db[_0x1bd5('0x45')][_0x1bd5('0x41')]({'where':{'id':_0x4df15f[_0x1bd5('0x44')]['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x29fab9,null))[_0x1bd5('0x24')](function(_0x1ce427){if(_0x1ce427){return _0x1ce427[_0x1bd5('0x46')](_0x4df15f[_0x1bd5('0x43')][_0x1bd5('0x47')],_[_0x1bd5('0x48')](_0x4df15f[_0x1bd5('0x43')],[_0x1bd5('0x47'),'id'])||{});}})[_0x1bd5('0x24')](respondWithResult(_0x29fab9,null))[_0x1bd5('0x3d')](handleError(_0x29fab9,null));};exports[_0x1bd5('0x49')]=function(_0x1456ad,_0x231975,_0x2be565){var _0xdc90eb={};var _0x3d2339={};var _0x505f23;var _0x42fc75;return db[_0x1bd5('0x28')][_0x1bd5('0x4a')]({'where':{'id':_0x1456ad[_0x1bd5('0x44')]['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x231975,null))[_0x1bd5('0x24')](function(_0x412e18){if(_0x412e18){_0x505f23=_0x412e18;_0x3d2339[_0x1bd5('0x29')]=_['keys'](db[_0x1bd5('0x45')][_0x1bd5('0x3f')]);_0x3d2339[_0x1bd5('0x2b')]=_[_0x1bd5('0x2c')](_0x1456ad[_0x1bd5('0x2b')]);_0x3d2339[_0x1bd5('0x2d')]=_[_0x1bd5('0x2f')](_0x3d2339[_0x1bd5('0x29')],_0x3d2339[_0x1bd5('0x2b')]);_0xdc90eb['attributes']=_[_0x1bd5('0x2f')](_0x3d2339[_0x1bd5('0x29')],qs[_0x1bd5('0x30')](_0x1456ad[_0x1bd5('0x2b')][_0x1bd5('0x30')]));_0xdc90eb[_0x1bd5('0x2e')]=_0xdc90eb[_0x1bd5('0x2e')][_0x1bd5('0x40')]?_0xdc90eb[_0x1bd5('0x2e')]:_0x3d2339[_0x1bd5('0x29')];_0xdc90eb[_0x1bd5('0x32')]=qs['sort'](_0x1456ad[_0x1bd5('0x2b')]['sort']);_0xdc90eb[_0x1bd5('0x34')]=qs[_0x1bd5('0x2d')](_[_0x1bd5('0x35')](_0x1456ad[_0x1bd5('0x2b')],_0x3d2339[_0x1bd5('0x2d')]));if(_0x1456ad['query'][_0x1bd5('0x36')]){_0xdc90eb[_0x1bd5('0x34')]=_[_0x1bd5('0x37')](_0xdc90eb[_0x1bd5('0x34')],{'$or':_[_0x1bd5('0x2a')](_0xdc90eb['attributes'],function(_0x2fd93d){var _0x56879b={};_0x56879b[_0x2fd93d]={'$like':'%'+_0x1456ad[_0x1bd5('0x2b')]['filter']+'%'};return _0x56879b;})});}_0xdc90eb=_[_0x1bd5('0x37')]({},_0xdc90eb,_0x1456ad[_0x1bd5('0x3a')]);return _0x505f23[_0x1bd5('0x49')](_0xdc90eb);}})[_0x1bd5('0x24')](function(_0x40219a){if(_0x40219a){_0x42fc75=_0x40219a[_0x1bd5('0x40')];if(!_0x1456ad[_0x1bd5('0x2b')]['hasOwnProperty'](_0x1bd5('0x4b'))){_0xdc90eb[_0x1bd5('0x31')]=qs['limit'](_0x1456ad['query']['limit']);_0xdc90eb[_0x1bd5('0x1d')]=qs[_0x1bd5('0x1d')](_0x1456ad[_0x1bd5('0x2b')]['offset']);}return _0x505f23[_0x1bd5('0x49')](_0xdc90eb);}})[_0x1bd5('0x24')](function(_0x1b0920){if(_0x1b0920){return _0x1b0920?{'count':_0x42fc75,'rows':_0x1b0920}:null;}})[_0x1bd5('0x24')](respondWithResult(_0x231975,null))[_0x1bd5('0x3d')](handleError(_0x231975,null));};exports[_0x1bd5('0x4c')]=function(_0x360728,_0x1d034f,_0x2e86a8){return db[_0x1bd5('0x4d')][_0x1bd5('0x41')]({'where':{'id':_0x360728['params']['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x1d034f,null))['then'](function(_0x18921c){if(_0x18921c){return _0x18921c[_0x1bd5('0x4c')](_0x360728[_0x1bd5('0x43')][_0x1bd5('0x47')],_['omit'](_0x360728[_0x1bd5('0x43')],[_0x1bd5('0x47'),'id'])||{});}})['then'](respondWithResult(_0x1d034f,null))[_0x1bd5('0x3d')](handleError(_0x1d034f,null));};exports[_0x1bd5('0x4e')]=function(_0x23f2d3,_0x2a906e,_0x55e125){var _0xf5b94c={};var _0x2b2198={};var _0x467b84;var _0x1e689b;return db[_0x1bd5('0x28')][_0x1bd5('0x4a')]({'where':{'id':_0x23f2d3[_0x1bd5('0x44')]['id']}})[_0x1bd5('0x24')](handleEntityNotFound(_0x2a906e,null))[_0x1bd5('0x24')](function(_0x1d73dc){if(_0x1d73dc){_0x467b84=_0x1d73dc;_0x2b2198[_0x1bd5('0x29')]=_[_0x1bd5('0x2c')](db[_0x1bd5('0x4d')][_0x1bd5('0x3f')]);_0x2b2198[_0x1bd5('0x2b')]=_[_0x1bd5('0x2c')](_0x23f2d3[_0x1bd5('0x2b')]);_0x2b2198[_0x1bd5('0x2d')]=_['intersection'](_0x2b2198['model'],_0x2b2198[_0x1bd5('0x2b')]);_0xf5b94c[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x2b2198[_0x1bd5('0x29')],qs[_0x1bd5('0x30')](_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x30')]));_0xf5b94c[_0x1bd5('0x2e')]=_0xf5b94c['attributes'][_0x1bd5('0x40')]?_0xf5b94c[_0x1bd5('0x2e')]:_0x2b2198[_0x1bd5('0x29')];_0xf5b94c['order']=qs[_0x1bd5('0x33')](_0x23f2d3[_0x1bd5('0x2b')]['sort']);_0xf5b94c['where']=qs[_0x1bd5('0x2d')](_[_0x1bd5('0x35')](_0x23f2d3[_0x1bd5('0x2b')],_0x2b2198['filters']));if(_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x36')]){_0xf5b94c['where']=_['merge'](_0xf5b94c['where'],{'$or':_[_0x1bd5('0x2a')](_0xf5b94c['attributes'],function(_0x48a095){var _0x26fe36={};_0x26fe36[_0x48a095]={'$like':'%'+_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x36')]+'%'};return _0x26fe36;})});}_0xf5b94c=_[_0x1bd5('0x37')]({},_0xf5b94c,_0x23f2d3['options']);return _0x467b84[_0x1bd5('0x4e')](_0xf5b94c);}})[_0x1bd5('0x24')](function(_0x357c89){if(_0x357c89){_0x1e689b=_0x357c89[_0x1bd5('0x40')];if(!_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x4f')](_0x1bd5('0x4b'))){_0xf5b94c[_0x1bd5('0x31')]=qs['limit'](_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x31')]);_0xf5b94c[_0x1bd5('0x1d')]=qs[_0x1bd5('0x1d')](_0x23f2d3[_0x1bd5('0x2b')][_0x1bd5('0x1d')]);}return _0x467b84[_0x1bd5('0x4e')](_0xf5b94c);}})[_0x1bd5('0x24')](function(_0x1264c5){if(_0x1264c5){return _0x1264c5?{'count':_0x1e689b,'rows':_0x1264c5}:null;}})[_0x1bd5('0x24')](respondWithResult(_0x2a906e,null))[_0x1bd5('0x3d')](handleError(_0x2a906e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 4c45f13..3ec4bb9 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 _0x5e65=['../../config/logger','api','moment','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util'];(function(_0x22aad9,_0x52dc57){var _0x4f1b18=function(_0x32ebf8){while(--_0x32ebf8){_0x22aad9['push'](_0x22aad9['shift']());}};_0x4f1b18(++_0x52dc57);}(_0x5e65,0xc1));var _0x55e6=function(_0x549682,_0x1a20c0){_0x549682=_0x549682-0x0;var _0x1c58f8=_0x5e65[_0x549682];return _0x1c58f8;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var logger=require(_0x55e6('0x2'))(_0x55e6('0x3'));var moment=require(_0x55e6('0x4'));var BPromise=require('bluebird');var rp=require(_0x55e6('0x5'));var fs=require('fs');var path=require(_0x55e6('0x6'));var rimraf=require('rimraf');var config=require(_0x55e6('0x7'));var attributes=require(_0x55e6('0x8'));module[_0x55e6('0x9')]=function(_0x2f53f9,_0x1207ea){return _0x2f53f9[_0x55e6('0xa')](_0x55e6('0xb'),attributes,{'tableName':_0x55e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2974=['./automation.attributes','Automation','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xbe7a41,_0x2173a7){var _0x933130=function(_0x1821b8){while(--_0x1821b8){_0xbe7a41['push'](_0xbe7a41['shift']());}};_0x933130(++_0x2173a7);}(_0x2974,0xfc));var _0x4297=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x2974[_0x3c6ae2];return _0x4edda;};'use strict';var _=require(_0x4297('0x0'));var util=require(_0x4297('0x1'));var logger=require('../../config/logger')(_0x4297('0x2'));var moment=require(_0x4297('0x3'));var BPromise=require('bluebird');var rp=require(_0x4297('0x4'));var fs=require('fs');var path=require(_0x4297('0x5'));var rimraf=require(_0x4297('0x6'));var config=require(_0x4297('0x7'));var attributes=require(_0x4297('0x8'));module['exports']=function(_0x4f1eb3,_0x58167d){return _0x4f1eb3['define'](_0x4297('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 2b0199f..8e18522 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 _0x2dd8=['Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x57f921,_0x4fc8bb){var _0x2660ef=function(_0x45ba84){while(--_0x45ba84){_0x57f921['push'](_0x57f921['shift']());}};_0x2660ef(++_0x4fc8bb);}(_0x2dd8,0x143));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x82dd('0x2'));var fs=require('fs');var Redis=require(_0x82dd('0x3'));var db=require(_0x82dd('0x4'))['db'];var utils=require(_0x82dd('0x5'));var logger=require(_0x82dd('0x6'))(_0x82dd('0x7'));var config=require(_0x82dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x82dd('0x9')][_0x82dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x416be0,_0x2e9d89,_0x54fb28){return new BPromise(function(_0x21ebb8,_0x3e8516){return client[_0x82dd('0xb')](_0x416be0,_0x54fb28)[_0x82dd('0xc')](function(_0x488126){logger['info'](_0x82dd('0xd'),_0x2e9d89,'request\x20sent');logger[_0x82dd('0xe')](_0x82dd('0xf'),_0x2e9d89,_0x82dd('0x10'),JSON[_0x82dd('0x11')](_0x488126));if(_0x488126[_0x82dd('0x12')]){if(_0x488126['error'][_0x82dd('0x13')]===0x1f4){logger[_0x82dd('0x12')](_0x82dd('0xd'),_0x2e9d89,_0x488126[_0x82dd('0x12')][_0x82dd('0x14')]);return _0x3e8516(_0x488126['error']['message']);}logger[_0x82dd('0x12')](_0x82dd('0xd'),_0x2e9d89,_0x488126[_0x82dd('0x12')][_0x82dd('0x14')]);return _0x21ebb8(_0x488126[_0x82dd('0x12')][_0x82dd('0x14')]);}else{logger[_0x82dd('0x15')](_0x82dd('0xd'),_0x2e9d89,_0x82dd('0x10'));_0x21ebb8(_0x488126[_0x82dd('0x16')][_0x82dd('0x14')]);}})[_0x82dd('0x17')](function(_0x1bdd14){logger['error'](_0x82dd('0xd'),_0x2e9d89,_0x1bdd14);_0x3e8516(_0x1bdd14);});});} \ No newline at end of file +var _0xbc95=['stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','http','request','then','info','Automation,\x20%s,\x20%s','debug'];(function(_0x4c0efa,_0x43bc32){var _0x5d0e53=function(_0xfa2a3e){while(--_0xfa2a3e){_0x4c0efa['push'](_0x4c0efa['shift']());}};_0x5d0e53(++_0x43bc32);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x32dc62,_0xb7f67c){_0x32dc62=_0x32dc62-0x0;var _0x307f88=_0xbc95[_0x32dc62];return _0x307f88;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var moment=require(_0x5bc9('0x2'));var BPromise=require(_0x5bc9('0x3'));var rs=require(_0x5bc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bc9('0x5'))(_0x5bc9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5bc9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c02e9,_0x2fb0a2,_0x4bdc20){return new BPromise(function(_0x49ab1a,_0x6cc9f1){return client[_0x5bc9('0x8')](_0x5c02e9,_0x4bdc20)[_0x5bc9('0x9')](function(_0x357d27){logger[_0x5bc9('0xa')](_0x5bc9('0xb'),_0x2fb0a2,'request\x20sent');logger[_0x5bc9('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2fb0a2,'request\x20sent',JSON[_0x5bc9('0xd')](_0x357d27));if(_0x357d27['error']){if(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0xf')]===0x1f4){logger[_0x5bc9('0xe')](_0x5bc9('0xb'),_0x2fb0a2,_0x357d27[_0x5bc9('0xe')]['message']);return _0x6cc9f1(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0x10')]);}logger['error'](_0x5bc9('0xb'),_0x2fb0a2,_0x357d27['error']['message']);return _0x49ab1a(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0x10')]);}else{logger[_0x5bc9('0xa')](_0x5bc9('0xb'),_0x2fb0a2,_0x5bc9('0x11'));_0x49ab1a(_0x357d27[_0x5bc9('0x12')]['message']);}})['catch'](function(_0x617dad){logger[_0x5bc9('0xe')]('Automation,\x20%s,\x20%s',_0x2fb0a2,_0x617dad);_0x6cc9f1(_0x617dad);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 66bcbac..ce02337 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 _0x925e=['post','create','addConditions','addActions','put','/:id','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x925e,0x199));var _0xe925=function(_0x8000fc,_0x212d6e){_0x8000fc=_0x8000fc-0x0;var _0x3329b1=_0x925e[_0x8000fc];return _0x3329b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe925('0x0'));var timeout=require(_0xe925('0x1'));var express=require(_0xe925('0x2'));var router=express['Router']();var fs_extra=require(_0xe925('0x3'));var auth=require(_0xe925('0x4'));var interaction=require(_0xe925('0x5'));var config=require(_0xe925('0x6'));var controller=require(_0xe925('0x7'));router[_0xe925('0x8')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe925('0xb')]);router['get'](_0xe925('0xc'),auth['isAuthenticated'](),controller[_0xe925('0xd')]);router[_0xe925('0x8')](_0xe925('0xe'),auth[_0xe925('0x9')](),controller[_0xe925('0xf')]);router[_0xe925('0x10')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0x11')]);router[_0xe925('0x10')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xe925('0x12')]);router[_0xe925('0x10')]('/:id/actions',auth[_0xe925('0x9')](),controller[_0xe925('0x13')]);router[_0xe925('0x14')](_0xe925('0x15'),auth[_0xe925('0x9')](),controller['update']);router[_0xe925('0x16')](_0xe925('0x15'),auth[_0xe925('0x9')](),controller[_0xe925('0x17')]);module[_0xe925('0x18')]=router; \ No newline at end of file +var _0x5640=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','/:id','update','delete','exports','multer','path'];(function(_0x479307,_0x1ae280){var _0x46e8f8=function(_0x1dcea8){while(--_0x1dcea8){_0x479307['push'](_0x479307['shift']());}};_0x46e8f8(++_0x1ae280);}(_0x5640,0x111));var _0x0564=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5640[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0564('0x0'));var util=require('util');var path=require(_0x0564('0x1'));var timeout=require(_0x0564('0x2'));var express=require(_0x0564('0x3'));var router=express[_0x0564('0x4')]();var fs_extra=require(_0x0564('0x5'));var auth=require(_0x0564('0x6'));var interaction=require(_0x0564('0x7'));var config=require(_0x0564('0x8'));var controller=require(_0x0564('0x9'));router[_0x0564('0xa')]('/',auth[_0x0564('0xb')](),controller[_0x0564('0xc')]);router[_0x0564('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0564('0xd')]);router[_0x0564('0xa')](_0x0564('0xe'),auth[_0x0564('0xb')](),controller['getConditions']);router[_0x0564('0xa')](_0x0564('0xf'),auth['isAuthenticated'](),controller[_0x0564('0x10')]);router[_0x0564('0x11')]('/',auth['isAuthenticated'](),controller[_0x0564('0x12')]);router[_0x0564('0x11')](_0x0564('0xe'),auth['isAuthenticated'](),controller['addConditions']);router[_0x0564('0x11')]('/:id/actions',auth[_0x0564('0xb')](),controller[_0x0564('0x13')]);router[_0x0564('0x14')](_0x0564('0x15'),auth[_0x0564('0xb')](),controller[_0x0564('0x16')]);router[_0x0564('0x17')](_0x0564('0x15'),auth[_0x0564('0xb')](),controller['destroy']);module[_0x0564('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4a216f3..871678d 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 _0x87e5=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x87e5,0xc1));var _0x587e=function(_0x37cd56,_0x49d747){_0x37cd56=_0x37cd56-0x0;var _0x497e08=_0x87e5[_0x37cd56];return _0x497e08;};'use strict';var Sequelize=require(_0x587e('0x0'));module[_0x587e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x587e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x587e('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x587e('0x4')},'description':{'type':Sequelize[_0x587e('0x5')]},'active':{'type':Sequelize[_0x587e('0x6')],'defaultValue':0x0,'comment':_0x587e('0x7')},'limitCalls':{'type':Sequelize[_0x587e('0x8')](0x4)[_0x587e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x587e('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x587e('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x587e('0x8')](0x5)[_0x587e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'comment':_0x587e('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x587e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x587e('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x587e('0x5')],'defaultValue':_0x587e('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x587e('0x3')](_0x587e('0x12'),'never','onlyIfOpen'),'defaultValue':_0x587e('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x587e('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x587e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x587e('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x587e('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x587e('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x587e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x587e('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x587e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x587e('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x587e('0x8')](0x9)[_0x587e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x587e('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x587e('0x3')](_0x587e('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x587e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x587e('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x587e('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x587e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x587e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x587e('0x8')](0x5)[_0x587e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x587e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x587e('0x8')](0x3)[_0x587e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x587e('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x587e('0x8')](0x5)[_0x587e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x587e('0x24')}}; \ No newline at end of file +var _0xe721=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0xe721,0x138));var _0x1e72=function(_0x5b5784,_0x103fef){_0x5b5784=_0x5b5784-0x0;var _0x5a7b69=_0xe721[_0x5b5784];return _0x5a7b69;};'use strict';var Sequelize=require(_0x1e72('0x0'));module[_0x1e72('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e72('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1e72('0x5')]},'active':{'type':Sequelize[_0x1e72('0x6')],'defaultValue':0x0,'comment':_0x1e72('0x7')},'limitCalls':{'type':Sequelize[_0x1e72('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1e72('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1e72('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1e72('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1e72('0x11')},'dialTimezone':{'type':Sequelize[_0x1e72('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1e72('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x13'),_0x1e72('0x14'),_0x1e72('0x15')),'defaultValue':_0x1e72('0x13')},'dialAMDActive':{'type':Sequelize[_0x1e72('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1e72('0x8')](0x9)[_0x1e72('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1e72('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x1e72('0x8')](0x9)[_0x1e72('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1e72('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1e72('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1e72('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1e72('0x8')](0x9)[_0x1e72('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e72('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x1e72('0x8')](0x9)[_0x1e72('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1e72('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1e72('0x8')](0x9)[_0x1e72('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1e72('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1e72('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1e72('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1e72('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1e72('0x1e'),_0x1e72('0x1f')),'defaultValue':_0x1e72('0x1e')},'dialPrefix':{'type':Sequelize[_0x1e72('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1e72('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e72('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x22')},'dialDropMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1e72('0x8')](0x3)[_0x1e72('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e72('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1e72('0x8')](0x5)[_0x1e72('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e72('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 91017ff..06224ec 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 _0xb6bc=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','merge','omit','body','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','phone','scheduledAt','ContactId','select','field','CmListId','ListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','cm_hopper','onlyIfOpen','insert','into','fromQuery','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x442bea,_0x381cdf){var _0x2609cc=function(_0x2b04b5){while(--_0x2b04b5){_0x442bea['push'](_0x442bea['shift']());}};_0x2609cc(++_0x381cdf);}(_0xb6bc,0x15a));var _0xcb6b=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xb6bc[_0x245afe];return _0x4eefde;};'use strict';var emlformat=require(_0xcb6b('0x0'));var rimraf=require(_0xcb6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb6b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb6b('0x3'));var util=require(_0xcb6b('0x4'));var path=require(_0xcb6b('0x5'));var sox=require(_0xcb6b('0x6'));var csv=require(_0xcb6b('0x7'));var ejs=require(_0xcb6b('0x8'));var fs=require('fs');var fs_extra=require(_0xcb6b('0x9'));var _=require(_0xcb6b('0xa'));var squel=require('squel');var crypto=require(_0xcb6b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcb6b('0xc'));var toCsv=require(_0xcb6b('0x7'));var querystring=require(_0xcb6b('0xd'));var Papa=require(_0xcb6b('0xe'));var Redis=require('ioredis');var authService=require(_0xcb6b('0xf'));var qs=require(_0xcb6b('0x10'));var as=require(_0xcb6b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb6b('0x12'))(_0xcb6b('0x13'));var utils=require('../../config/utils');var config=require(_0xcb6b('0x14'));var licenseUtil=require(_0xcb6b('0x15'));var db=require(_0xcb6b('0x16'))['db'];function respondWithStatusCode(_0x50a7b4,_0x59cdcb){_0x59cdcb=_0x59cdcb||0xcc;return function(_0x427c79){if(_0x427c79){return _0x50a7b4[_0xcb6b('0x17')](_0x59cdcb);}return _0x50a7b4['status'](_0x59cdcb)[_0xcb6b('0x18')]();};}function respondWithResult(_0x3db288,_0x1d1a25){_0x1d1a25=_0x1d1a25||0xc8;return function(_0x142e67){if(_0x142e67){return _0x3db288[_0xcb6b('0x19')](_0x1d1a25)[_0xcb6b('0x1a')](_0x142e67);}};}function respondWithFilteredResult(_0x14b59f,_0x504e8f){return function(_0x2e1756){if(_0x2e1756){var _0x803d8b=typeof _0x504e8f[_0xcb6b('0x1b')]===_0xcb6b('0x1c')&&typeof _0x504e8f[_0xcb6b('0x1d')]==='undefined';var _0x272711=_0x2e1756[_0xcb6b('0x1e')];var _0xd5b35b=_0x803d8b?0x0:_0x504e8f[_0xcb6b('0x1b')];var _0x5d8839=_0x803d8b?_0x2e1756[_0xcb6b('0x1e')]:_0x504e8f[_0xcb6b('0x1b')]+_0x504e8f[_0xcb6b('0x1d')];var _0x38ed74;if(_0x5d8839>=_0x272711){_0x5d8839=_0x272711;_0x38ed74=0xc8;}else{_0x38ed74=0xce;}_0x14b59f['status'](_0x38ed74);return _0x14b59f[_0xcb6b('0x1f')]('Content-Range',_0xd5b35b+'-'+_0x5d8839+'/'+_0x272711)[_0xcb6b('0x1a')](_0x2e1756);}return null;};}function patchUpdates(_0xc53a12){return function(_0x34fdba){try{jsonpatch[_0xcb6b('0x20')](_0x34fdba,_0xc53a12,!![]);}catch(_0xc680ca){return BPromise[_0xcb6b('0x21')](_0xc680ca);}return _0x34fdba[_0xcb6b('0x22')]();};}function saveUpdates(_0x325c1f,_0xd0602f){return function(_0xc4f302){if(_0xc4f302){return _0xc4f302[_0xcb6b('0x23')](_0x325c1f)[_0xcb6b('0x24')](function(_0x52fa33){return _0x52fa33;});}return null;};}function removeEntity(_0x40df61,_0x5a835e){return function(_0x4d6927){if(_0x4d6927){return _0x4d6927['destroy']()[_0xcb6b('0x24')](function(){var _0x27aed8=_0x4d6927[_0xcb6b('0x25')]({'plain':!![]});var _0x160ae7=_0xcb6b('0x26');return db[_0xcb6b('0x27')][_0xcb6b('0x28')]({'where':{'type':_0x160ae7,'resourceId':_0x27aed8['id']}})[_0xcb6b('0x24')](function(){return _0x4d6927;});})[_0xcb6b('0x24')](function(){_0x40df61[_0xcb6b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83d91f,_0x3389ea){return function(_0xaee693){if(!_0xaee693){_0x83d91f[_0xcb6b('0x17')](0x194);}return _0xaee693;};}function handleError(_0x131895,_0x12b8e5){_0x12b8e5=_0x12b8e5||0x1f4;return function(_0x4d7419){logger[_0xcb6b('0x29')](_0x4d7419[_0xcb6b('0x2a')]);if(_0x4d7419[_0xcb6b('0x2b')]){delete _0x4d7419[_0xcb6b('0x2b')];}_0x131895[_0xcb6b('0x19')](_0x12b8e5)[_0xcb6b('0x2c')](_0x4d7419);};}exports[_0xcb6b('0x2d')]=function(_0xba4a34,_0x24b6b7){var _0x45e62d={},_0x3416e4={},_0x2bfa70={'count':0x0,'rows':[]};var _0x5995e9=_[_0xcb6b('0x2e')](db[_0xcb6b('0x2f')][_0xcb6b('0x30')],function(_0xc89816){return{'name':_0xc89816[_0xcb6b('0x31')],'type':_0xc89816[_0xcb6b('0x32')]['key']};});_0x3416e4[_0xcb6b('0x33')]=_[_0xcb6b('0x2e')](_0x5995e9,_0xcb6b('0x2b'));_0x3416e4[_0xcb6b('0x34')]=_[_0xcb6b('0x35')](_0xba4a34['query']);_0x3416e4[_0xcb6b('0x36')]=_['intersection'](_0x3416e4[_0xcb6b('0x33')],_0x3416e4['query']);_0x45e62d['attributes']=_[_0xcb6b('0x37')](_0x3416e4[_0xcb6b('0x33')],qs[_0xcb6b('0x38')](_0xba4a34[_0xcb6b('0x34')]['fields']));_0x45e62d[_0xcb6b('0x39')]=_0x45e62d[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x45e62d[_0xcb6b('0x39')]:_0x3416e4['model'];if(!_0xba4a34['query']['hasOwnProperty'](_0xcb6b('0x3b'))){_0x45e62d[_0xcb6b('0x1d')]=qs[_0xcb6b('0x1d')](_0xba4a34[_0xcb6b('0x34')][_0xcb6b('0x1d')]);_0x45e62d[_0xcb6b('0x1b')]=qs[_0xcb6b('0x1b')](_0xba4a34[_0xcb6b('0x34')][_0xcb6b('0x1b')]);}_0x45e62d[_0xcb6b('0x3c')]=qs[_0xcb6b('0x3d')](_0xba4a34['query']['sort']);_0x45e62d[_0xcb6b('0x3e')]=qs[_0xcb6b('0x36')](_[_0xcb6b('0x3f')](_0xba4a34[_0xcb6b('0x34')],_0x3416e4['filters']),_0x5995e9);if(_0xba4a34[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x45e62d[_0xcb6b('0x3e')]=_['merge'](_0x45e62d['where'],{'$or':_[_0xcb6b('0x2e')](_0x5995e9,function(_0x51f6ab){if(_0x51f6ab['type']!==_0xcb6b('0x41')){var _0x12e5e4={};_0x12e5e4[_0x51f6ab[_0xcb6b('0x2b')]]={'$like':'%'+_0xba4a34[_0xcb6b('0x34')][_0xcb6b('0x40')]+'%'};return _0x12e5e4;}})});}_0x45e62d=_['merge']({},_0x45e62d,_0xba4a34[_0xcb6b('0x42')]);var _0xfe74df={'where':_0x45e62d['where']};return db[_0xcb6b('0x2f')][_0xcb6b('0x1e')](_0xfe74df)[_0xcb6b('0x24')](function(_0x393bdb){_0x2bfa70['count']=_0x393bdb;if(_0xba4a34[_0xcb6b('0x34')][_0xcb6b('0x43')]){_0x45e62d['include']=[{'all':!![]}];}return db['Campaign'][_0xcb6b('0x44')](_0x45e62d);})[_0xcb6b('0x24')](function(_0x2d5259){_0x2bfa70[_0xcb6b('0x45')]=_0x2d5259;return _0x2bfa70;})[_0xcb6b('0x24')](respondWithFilteredResult(_0x24b6b7,_0x45e62d))[_0xcb6b('0x46')](handleError(_0x24b6b7,null));};exports[_0xcb6b('0x47')]=function(_0x2c9aab,_0x4f228e){var _0x3510ca={'raw':![],'where':{'id':_0x2c9aab['params']['id']}},_0x4e71e7={};_0x4e71e7[_0xcb6b('0x33')]=_['keys'](db[_0xcb6b('0x2f')][_0xcb6b('0x30')]);_0x4e71e7['query']=_['keys'](_0x2c9aab[_0xcb6b('0x34')]);_0x4e71e7[_0xcb6b('0x36')]=_[_0xcb6b('0x37')](_0x4e71e7[_0xcb6b('0x33')],_0x4e71e7[_0xcb6b('0x34')]);_0x3510ca[_0xcb6b('0x39')]=_[_0xcb6b('0x37')](_0x4e71e7[_0xcb6b('0x33')],qs['fields'](_0x2c9aab[_0xcb6b('0x34')]['fields']));_0x3510ca[_0xcb6b('0x39')]=_0x3510ca[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x3510ca['attributes']:_0x4e71e7[_0xcb6b('0x33')];if(_0x2c9aab[_0xcb6b('0x34')][_0xcb6b('0x43')]){_0x3510ca[_0xcb6b('0x48')]=[{'all':!![]}];}_0x3510ca=_['merge']({},_0x3510ca,_0x2c9aab['options']);return db[_0xcb6b('0x2f')]['find'](_0x3510ca)[_0xcb6b('0x24')](handleEntityNotFound(_0x4f228e,null))[_0xcb6b('0x24')](respondWithResult(_0x4f228e,null))['catch'](handleError(_0x4f228e,null));};exports[_0xcb6b('0x49')]=function(_0x353545,_0x2ac7c4){return db['Campaign'][_0xcb6b('0x49')](_0x353545['body'],{})[_0xcb6b('0x24')](function(_0x3ff6c3){var _0x503fc6=_0x353545[_0xcb6b('0x4a')][_0xcb6b('0x25')]({'plain':!![]});if(!_0x503fc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x503fc6[_0xcb6b('0x4b')]===_0xcb6b('0x4a')){var _0x5e89e9=_0x3ff6c3[_0xcb6b('0x25')]({'plain':!![]});var _0xdcdd33=_0xcb6b('0x26');return db['UserProfileSection'][_0xcb6b('0x4c')]({'where':{'name':_0xdcdd33,'userProfileId':_0x503fc6[_0xcb6b('0x4d')]},'raw':!![]})[_0xcb6b('0x24')](function(_0x3a59e4){if(_0x3a59e4&&_0x3a59e4[_0xcb6b('0x4e')]===0x0){return db[_0xcb6b('0x27')][_0xcb6b('0x49')]({'name':_0x5e89e9['name'],'resourceId':_0x5e89e9['id'],'type':_0x3a59e4[_0xcb6b('0x2b')],'sectionId':_0x3a59e4['id']},{})[_0xcb6b('0x24')](function(){return _0x3ff6c3;});}else{return _0x3ff6c3;}})[_0xcb6b('0x46')](function(_0x1ec5b6){logger[_0xcb6b('0x29')](_0xcb6b('0x4f'),_0x1ec5b6);throw _0x1ec5b6;});}return _0x3ff6c3;})[_0xcb6b('0x24')](respondWithResult(_0x2ac7c4,0xc9))['catch'](handleError(_0x2ac7c4,null));};exports[_0xcb6b('0x50')]=function(_0x23f407,_0x5d6810){var _0x195e4c={'where':{'id':_0x23f407[_0xcb6b('0x51')]['id']}},_0x16fd07={};_0x16fd07['model']=_['keys'](db[_0xcb6b('0x2f')][_0xcb6b('0x30')]);_0x195e4c[_0xcb6b('0x39')]=_[_0xcb6b('0x37')](_0x16fd07[_0xcb6b('0x33')],qs['fields'](_0x23f407[_0xcb6b('0x34')][_0xcb6b('0x38')]));_0x195e4c['attributes']=_0x195e4c[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x195e4c[_0xcb6b('0x39')]:_0x16fd07[_0xcb6b('0x33')];if(_0x23f407[_0xcb6b('0x34')]['includeAll']){_0x195e4c[_0xcb6b('0x48')]=[{'all':!![]}];}_0x195e4c=_[_0xcb6b('0x52')]({},_0x195e4c,_0x23f407[_0xcb6b('0x42')]);return db[_0xcb6b('0x2f')][_0xcb6b('0x4c')](_0x195e4c)[_0xcb6b('0x24')](handleEntityNotFound(_0x5d6810,null))['then'](function(_0x2121cc){if(_0x2121cc){var _0x58ec66=_0x2121cc[_0xcb6b('0x25')]({'plain':!![]});_0x58ec66=qs[_0xcb6b('0x53')](_0x58ec66,['id','createdAt','updatedAt']);_0x23f407[_0xcb6b('0x54')]=_[_0xcb6b('0x53')](_0x23f407[_0xcb6b('0x54')],['id',_0xcb6b('0x55'),_0xcb6b('0x56')]);return db[_0xcb6b('0x2f')][_0xcb6b('0x49')](_[_0xcb6b('0x52')](_0x58ec66,_0x23f407[_0xcb6b('0x54')]),{'include':_0x23f407[_0xcb6b('0x34')][_0xcb6b('0x43')]?[{'all':!![]}]:undefined})[_0xcb6b('0x24')](function(_0x30f18a){var _0x2790e0=_0x23f407[_0xcb6b('0x4a')][_0xcb6b('0x25')]({'plain':!![]});if(!_0x2790e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2790e0[_0xcb6b('0x4b')]===_0xcb6b('0x4a')){var _0xa31033=_0x30f18a[_0xcb6b('0x25')]({'plain':!![]});var _0x32d405='IvrCampaigns';return db[_0xcb6b('0x57')][_0xcb6b('0x4c')]({'where':{'name':_0x32d405,'userProfileId':_0x2790e0['userProfileId']},'raw':!![]})[_0xcb6b('0x24')](function(_0x33ccd3){if(_0x33ccd3&&_0x33ccd3[_0xcb6b('0x4e')]===0x0){return db[_0xcb6b('0x27')][_0xcb6b('0x49')]({'name':_0xa31033['name'],'resourceId':_0xa31033['id'],'type':_0x33ccd3[_0xcb6b('0x2b')],'sectionId':_0x33ccd3['id']},{})[_0xcb6b('0x24')](function(){return _0x30f18a;});}else{return _0x30f18a;}})[_0xcb6b('0x46')](function(_0x4c9940){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c9940);throw _0x4c9940;});}return _0x30f18a;});}})[_0xcb6b('0x24')](respondWithResult(_0x5d6810,0xc9))['catch'](handleError(_0x5d6810,null));};exports[_0xcb6b('0x23')]=function(_0x3fdf93,_0x2f6f23){if(_0x3fdf93[_0xcb6b('0x54')]['id']){delete _0x3fdf93[_0xcb6b('0x54')]['id'];}return db['Campaign']['find']({'where':{'id':_0x3fdf93['params']['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x2f6f23,null))[_0xcb6b('0x24')](saveUpdates(_0x3fdf93['body'],null))[_0xcb6b('0x24')](respondWithResult(_0x2f6f23,null))[_0xcb6b('0x46')](handleError(_0x2f6f23,null));};exports[_0xcb6b('0x28')]=function(_0x559a48,_0x5a8bad){return db['Campaign']['find']({'where':{'id':_0x559a48[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x5a8bad,null))[_0xcb6b('0x24')](removeEntity(_0x5a8bad,null))['catch'](handleError(_0x5a8bad,null));};exports[_0xcb6b('0x58')]=function(_0x54cc77,_0x5dce82,_0x34b785){var _0x4be9d9={'raw':!![],'where':{}};var _0x3f2f07={};var _0x4bd096={'count':0x0,'rows':[]};return db[_0xcb6b('0x2f')][_0xcb6b('0x59')]({'where':{'id':_0x54cc77[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x5dce82,null))['then'](function(_0x46a0cc){if(_0x46a0cc){_0x3f2f07[_0xcb6b('0x33')]=_[_0xcb6b('0x35')](db[_0xcb6b('0x5a')]['rawAttributes']);_0x3f2f07[_0xcb6b('0x34')]=_['keys'](_0x54cc77['query']);_0x3f2f07[_0xcb6b('0x36')]=_[_0xcb6b('0x37')](_0x3f2f07[_0xcb6b('0x33')],_0x3f2f07[_0xcb6b('0x34')]);_0x4be9d9[_0xcb6b('0x39')]=_[_0xcb6b('0x37')](_0x3f2f07[_0xcb6b('0x33')],qs[_0xcb6b('0x38')](_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x38')]));_0x4be9d9[_0xcb6b('0x39')]=_0x4be9d9[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x4be9d9[_0xcb6b('0x39')]:_0x3f2f07[_0xcb6b('0x33')];if(!_0x54cc77['query'][_0xcb6b('0x5b')]('nolimit')){_0x4be9d9['limit']=qs[_0xcb6b('0x1d')](_0x54cc77['query']['limit']);_0x4be9d9['offset']=qs[_0xcb6b('0x1b')](_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x1b')]);}_0x4be9d9[_0xcb6b('0x3c')]=qs[_0xcb6b('0x3d')](_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x3d')]);_0x4be9d9['where']=qs[_0xcb6b('0x36')](_[_0xcb6b('0x3f')](_0x54cc77[_0xcb6b('0x34')],_0x3f2f07[_0xcb6b('0x36')]));_0x4be9d9[_0xcb6b('0x3e')][_0xcb6b('0x5c')]=_0x46a0cc['id'];if(_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x4be9d9['where']=_[_0xcb6b('0x52')](_0x4be9d9[_0xcb6b('0x3e')],{'$or':_['map'](_0x4be9d9[_0xcb6b('0x39')],function(_0x251826){var _0x1603eb={};_0x1603eb[_0x251826]={'$like':'%'+_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x40')]+'%'};return _0x1603eb;})});}_0x4be9d9=_['merge']({},_0x4be9d9,_0x54cc77['options']);return db['CmHopper'][_0xcb6b('0x1e')]({'where':_0x4be9d9[_0xcb6b('0x3e')]})[_0xcb6b('0x24')](function(_0x5a6fa6){_0x4bd096[_0xcb6b('0x1e')]=_0x5a6fa6;if(_0x54cc77[_0xcb6b('0x34')][_0xcb6b('0x43')]){_0x4be9d9[_0xcb6b('0x48')]=[{'all':!![]}];}return db[_0xcb6b('0x5a')]['findAll'](_0x4be9d9);})[_0xcb6b('0x24')](function(_0x5622b5){_0x4bd096[_0xcb6b('0x45')]=_0x5622b5;return _0x4bd096;});}})[_0xcb6b('0x24')](respondWithFilteredResult(_0x5dce82,_0x4be9d9))[_0xcb6b('0x46')](handleError(_0x5dce82,null));};exports[_0xcb6b('0x5d')]=function(_0x5b23f2,_0x1c1add,_0x3b75f3){var _0x265d80={'raw':!![],'where':{}};var _0x222540={};var _0x2b357a={'count':0x0,'rows':[]};return db[_0xcb6b('0x2f')][_0xcb6b('0x59')]({'where':{'id':_0x5b23f2['params']['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x1c1add,null))[_0xcb6b('0x24')](function(_0x41b193){if(_0x41b193){_0x222540[_0xcb6b('0x33')]=_['keys'](db[_0xcb6b('0x5e')]['rawAttributes']);_0x222540[_0xcb6b('0x34')]=_[_0xcb6b('0x35')](_0x5b23f2[_0xcb6b('0x34')]);_0x222540[_0xcb6b('0x36')]=_[_0xcb6b('0x37')](_0x222540[_0xcb6b('0x33')],_0x222540[_0xcb6b('0x34')]);_0x265d80[_0xcb6b('0x39')]=_[_0xcb6b('0x37')](_0x222540['model'],qs[_0xcb6b('0x38')](_0x5b23f2['query'][_0xcb6b('0x38')]));_0x265d80[_0xcb6b('0x39')]=_0x265d80[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x265d80['attributes']:_0x222540[_0xcb6b('0x33')];if(!_0x5b23f2[_0xcb6b('0x34')]['hasOwnProperty'](_0xcb6b('0x3b'))){_0x265d80[_0xcb6b('0x1d')]=qs['limit'](_0x5b23f2['query']['limit']);_0x265d80['offset']=qs['offset'](_0x5b23f2[_0xcb6b('0x34')][_0xcb6b('0x1b')]);}_0x265d80['order']=qs[_0xcb6b('0x3d')](_0x5b23f2[_0xcb6b('0x34')][_0xcb6b('0x3d')]);_0x265d80[_0xcb6b('0x3e')]=qs['filters'](_['pick'](_0x5b23f2[_0xcb6b('0x34')],_0x222540[_0xcb6b('0x36')]));_0x265d80[_0xcb6b('0x3e')][_0xcb6b('0x5c')]=_0x41b193['id'];if(_0x5b23f2[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x265d80[_0xcb6b('0x3e')]=_[_0xcb6b('0x52')](_0x265d80[_0xcb6b('0x3e')],{'$or':_[_0xcb6b('0x2e')](_0x265d80[_0xcb6b('0x39')],function(_0xaf5566){var _0x35df5b={};_0x35df5b[_0xaf5566]={'$like':'%'+_0x5b23f2[_0xcb6b('0x34')]['filter']+'%'};return _0x35df5b;})});}_0x265d80=_[_0xcb6b('0x52')]({},_0x265d80,_0x5b23f2[_0xcb6b('0x42')]);return db[_0xcb6b('0x5e')][_0xcb6b('0x1e')]({'where':_0x265d80[_0xcb6b('0x3e')]})['then'](function(_0x1105b8){_0x2b357a['count']=_0x1105b8;if(_0x5b23f2['query'][_0xcb6b('0x43')]){_0x265d80['include']=[{'all':!![]}];}return db[_0xcb6b('0x5e')][_0xcb6b('0x44')](_0x265d80);})[_0xcb6b('0x24')](function(_0x314569){_0x2b357a[_0xcb6b('0x45')]=_0x314569;return _0x2b357a;});}})[_0xcb6b('0x24')](respondWithFilteredResult(_0x1c1add,_0x265d80))[_0xcb6b('0x46')](handleError(_0x1c1add,null));};exports['getHopperFinals']=function(_0xa328f1,_0xc1fa0f,_0x568955){var _0x3914a1={'raw':!![],'where':{}};var _0x38d7e1={};var _0x2b1cca={'count':0x0,'rows':[]};return db[_0xcb6b('0x2f')][_0xcb6b('0x59')]({'where':{'id':_0xa328f1[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0xc1fa0f,null))['then'](function(_0x4747f8){if(_0x4747f8){_0x38d7e1['model']=_[_0xcb6b('0x35')](db[_0xcb6b('0x5f')]['rawAttributes']);_0x38d7e1['query']=_[_0xcb6b('0x35')](_0xa328f1[_0xcb6b('0x34')]);_0x38d7e1[_0xcb6b('0x36')]=_['intersection'](_0x38d7e1[_0xcb6b('0x33')],_0x38d7e1[_0xcb6b('0x34')]);_0x3914a1['attributes']=_[_0xcb6b('0x37')](_0x38d7e1[_0xcb6b('0x33')],qs['fields'](_0xa328f1[_0xcb6b('0x34')][_0xcb6b('0x38')]));_0x3914a1[_0xcb6b('0x39')]=_0x3914a1['attributes'][_0xcb6b('0x3a')]?_0x3914a1['attributes']:_0x38d7e1[_0xcb6b('0x33')];if(!_0xa328f1[_0xcb6b('0x34')][_0xcb6b('0x5b')](_0xcb6b('0x3b'))){_0x3914a1[_0xcb6b('0x1d')]=qs[_0xcb6b('0x1d')](_0xa328f1[_0xcb6b('0x34')][_0xcb6b('0x1d')]);_0x3914a1[_0xcb6b('0x1b')]=qs[_0xcb6b('0x1b')](_0xa328f1[_0xcb6b('0x34')]['offset']);}_0x3914a1[_0xcb6b('0x3c')]=qs[_0xcb6b('0x3d')](_0xa328f1[_0xcb6b('0x34')]['sort']);_0x3914a1[_0xcb6b('0x3e')]=qs['filters'](_[_0xcb6b('0x3f')](_0xa328f1['query'],_0x38d7e1[_0xcb6b('0x36')]));_0x3914a1[_0xcb6b('0x3e')]['CampaignId']=_0x4747f8['id'];if(_0xa328f1[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x3914a1[_0xcb6b('0x3e')]=_[_0xcb6b('0x52')](_0x3914a1[_0xcb6b('0x3e')],{'$or':_[_0xcb6b('0x2e')](_0x3914a1[_0xcb6b('0x39')],function(_0x38a327){var _0x3a645c={};_0x3a645c[_0x38a327]={'$like':'%'+_0xa328f1['query'][_0xcb6b('0x40')]+'%'};return _0x3a645c;})});}_0x3914a1=_[_0xcb6b('0x52')]({},_0x3914a1,_0xa328f1[_0xcb6b('0x42')]);return db[_0xcb6b('0x5f')][_0xcb6b('0x1e')]({'where':_0x3914a1['where']})[_0xcb6b('0x24')](function(_0x116666){_0x2b1cca[_0xcb6b('0x1e')]=_0x116666;if(_0xa328f1[_0xcb6b('0x34')]['includeAll']){_0x3914a1['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcb6b('0x44')](_0x3914a1);})[_0xcb6b('0x24')](function(_0x7eb1a8){_0x2b1cca['rows']=_0x7eb1a8;return _0x2b1cca;});}})[_0xcb6b('0x24')](respondWithFilteredResult(_0xc1fa0f,_0x3914a1))[_0xcb6b('0x46')](handleError(_0xc1fa0f,null));};exports['getHopperBlacks']=function(_0x220456,_0x409034,_0x1d8010){var _0x47e401={'raw':!![],'where':{}};var _0x1b00a3={};var _0x218bf4={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x220456[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x409034,null))[_0xcb6b('0x24')](function(_0x5b0a54){if(_0x5b0a54){_0x1b00a3[_0xcb6b('0x33')]=_['keys'](db[_0xcb6b('0x60')]['rawAttributes']);_0x1b00a3[_0xcb6b('0x34')]=_[_0xcb6b('0x35')](_0x220456[_0xcb6b('0x34')]);_0x1b00a3[_0xcb6b('0x36')]=_[_0xcb6b('0x37')](_0x1b00a3[_0xcb6b('0x33')],_0x1b00a3[_0xcb6b('0x34')]);_0x47e401[_0xcb6b('0x39')]=_['intersection'](_0x1b00a3[_0xcb6b('0x33')],qs[_0xcb6b('0x38')](_0x220456[_0xcb6b('0x34')][_0xcb6b('0x38')]));_0x47e401[_0xcb6b('0x39')]=_0x47e401[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x47e401['attributes']:_0x1b00a3[_0xcb6b('0x33')];if(!_0x220456['query'][_0xcb6b('0x5b')](_0xcb6b('0x3b'))){_0x47e401['limit']=qs['limit'](_0x220456[_0xcb6b('0x34')][_0xcb6b('0x1d')]);_0x47e401[_0xcb6b('0x1b')]=qs['offset'](_0x220456[_0xcb6b('0x34')][_0xcb6b('0x1b')]);}_0x47e401[_0xcb6b('0x3c')]=qs[_0xcb6b('0x3d')](_0x220456[_0xcb6b('0x34')][_0xcb6b('0x3d')]);_0x47e401[_0xcb6b('0x3e')]=qs['filters'](_[_0xcb6b('0x3f')](_0x220456[_0xcb6b('0x34')],_0x1b00a3[_0xcb6b('0x36')]));_0x47e401['where'][_0xcb6b('0x5c')]=_0x5b0a54['id'];if(_0x220456[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x47e401['where']=_[_0xcb6b('0x52')](_0x47e401['where'],{'$or':_[_0xcb6b('0x2e')](_0x47e401[_0xcb6b('0x39')],function(_0x453370){var _0x3834f3={};_0x3834f3[_0x453370]={'$like':'%'+_0x220456[_0xcb6b('0x34')][_0xcb6b('0x40')]+'%'};return _0x3834f3;})});}_0x47e401=_[_0xcb6b('0x52')]({},_0x47e401,_0x220456[_0xcb6b('0x42')]);return db['CmHopperBlack'][_0xcb6b('0x1e')]({'where':_0x47e401[_0xcb6b('0x3e')]})['then'](function(_0x13f544){_0x218bf4[_0xcb6b('0x1e')]=_0x13f544;if(_0x220456[_0xcb6b('0x34')][_0xcb6b('0x43')]){_0x47e401[_0xcb6b('0x48')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xcb6b('0x44')](_0x47e401);})[_0xcb6b('0x24')](function(_0x1a4e4f){_0x218bf4[_0xcb6b('0x45')]=_0x1a4e4f;return _0x218bf4;});}})[_0xcb6b('0x24')](respondWithFilteredResult(_0x409034,_0x47e401))[_0xcb6b('0x46')](handleError(_0x409034,null));};exports[_0xcb6b('0x61')]=function(_0x51cf88,_0x416aeb,_0x2bd8ed){var _0x2add60={};var _0x366df5={};var _0x227afa;var _0xec04ff;return db[_0xcb6b('0x2f')][_0xcb6b('0x59')]({'where':{'id':_0x51cf88[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x416aeb,null))[_0xcb6b('0x24')](function(_0x1785e8){if(_0x1785e8){_0x227afa=_0x1785e8;_0x366df5[_0xcb6b('0x33')]=_[_0xcb6b('0x35')](db['CmList'][_0xcb6b('0x30')]);_0x366df5[_0xcb6b('0x34')]=_[_0xcb6b('0x35')](_0x51cf88[_0xcb6b('0x34')]);_0x366df5[_0xcb6b('0x36')]=_['intersection'](_0x366df5[_0xcb6b('0x33')],_0x366df5[_0xcb6b('0x34')]);_0x2add60[_0xcb6b('0x39')]=_['intersection'](_0x366df5[_0xcb6b('0x33')],qs[_0xcb6b('0x38')](_0x51cf88[_0xcb6b('0x34')][_0xcb6b('0x38')]));_0x2add60[_0xcb6b('0x39')]=_0x2add60[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x2add60[_0xcb6b('0x39')]:_0x366df5[_0xcb6b('0x33')];_0x2add60[_0xcb6b('0x3c')]=qs[_0xcb6b('0x3d')](_0x51cf88[_0xcb6b('0x34')][_0xcb6b('0x3d')]);_0x2add60[_0xcb6b('0x3e')]=qs[_0xcb6b('0x36')](_['pick'](_0x51cf88[_0xcb6b('0x34')],_0x366df5[_0xcb6b('0x36')]));if(_0x51cf88[_0xcb6b('0x34')][_0xcb6b('0x40')]){_0x2add60[_0xcb6b('0x3e')]=_[_0xcb6b('0x52')](_0x2add60['where'],{'$or':_[_0xcb6b('0x2e')](_0x2add60[_0xcb6b('0x39')],function(_0x59ad4b){var _0x2abe36={};_0x2abe36[_0x59ad4b]={'$like':'%'+_0x51cf88['query'][_0xcb6b('0x40')]+'%'};return _0x2abe36;})});}_0x2add60=_[_0xcb6b('0x52')]({},_0x2add60,_0x51cf88[_0xcb6b('0x42')]);return _0x227afa[_0xcb6b('0x61')](_0x2add60);}})['then'](function(_0x2616c6){if(_0x2616c6){_0xec04ff=_0x2616c6[_0xcb6b('0x3a')];if(!_0x51cf88['query'][_0xcb6b('0x5b')](_0xcb6b('0x3b'))){_0x2add60[_0xcb6b('0x1d')]=qs[_0xcb6b('0x1d')](_0x51cf88[_0xcb6b('0x34')][_0xcb6b('0x1d')]);_0x2add60['offset']=qs[_0xcb6b('0x1b')](_0x51cf88['query'][_0xcb6b('0x1b')]);}return _0x227afa[_0xcb6b('0x61')](_0x2add60);}})[_0xcb6b('0x24')](function(_0x4db806){if(_0x4db806){return _0x4db806?{'count':_0xec04ff,'rows':_0x4db806}:null;}})['then'](respondWithResult(_0x416aeb,null))['catch'](handleError(_0x416aeb,null));};exports[_0xcb6b('0x62')]=function(_0x4986df,_0x442753,_0x134efd){var _0x2d698d,_0x3aa117;return db[_0xcb6b('0x2f')][_0xcb6b('0x4c')]({'where':{'id':_0x4986df['params']['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x442753,null))[_0xcb6b('0x24')](function(_0x536861){if(_0x536861){_0x3aa117=_0x536861;return _0x536861[_0xcb6b('0x62')](_0x4986df[_0xcb6b('0x54')][_0xcb6b('0x63')],_[_0xcb6b('0x53')](_0x4986df[_0xcb6b('0x54')],[_0xcb6b('0x63'),'id'])||{});}return null;})['spread'](function(_0x2559bf){var _0x40f5cb;_0x2d698d=_0x2559bf||[];var _0x537d44=[];if(_0x2559bf){for(var _0x1dd36c=0x0;_0x1dd36c<_0x2559bf[_0xcb6b('0x3a')];_0x1dd36c+=0x1){var _0x3b8ce1=_0x2559bf[_0x1dd36c]['get']({'plain':!![]});_0x3aa117['dialCheckDuplicateType']=_0x4986df['body'][_0xcb6b('0x64')]?_0x4986df[_0xcb6b('0x54')][_0xcb6b('0x64')]:_0x3aa117[_0xcb6b('0x64')];switch(_0x3aa117[_0xcb6b('0x64')]){case _0xcb6b('0x65'):_0x40f5cb=squel['insert']()['into']('cm_hopper')['fromQuery']([_0xcb6b('0x66'),_0xcb6b('0x67'),_0xcb6b('0x68'),'ListId','CampaignId',_0xcb6b('0x55'),_0xcb6b('0x56')],squel[_0xcb6b('0x69')]()[_0xcb6b('0x6a')](_0xcb6b('0x66'),'phone')[_0xcb6b('0x6a')]('NOW()',_0xcb6b('0x67'))[_0xcb6b('0x6a')]('id',_0xcb6b('0x68'))[_0xcb6b('0x6a')](_0x3b8ce1[_0xcb6b('0x6b')]['toString'](),_0xcb6b('0x6c'))[_0xcb6b('0x6a')](_0x4986df[_0xcb6b('0x51')]['id'][_0xcb6b('0x6d')](),_0xcb6b('0x5c'))['field']('NOW()',_0xcb6b('0x55'))['field'](_0xcb6b('0x6e'),_0xcb6b('0x56'))['from'](_0xcb6b('0x6f'))['where'](_0xcb6b('0x70'))[_0xcb6b('0x3e')](_0xcb6b('0x71'),_0x3b8ce1['CmListId'][_0xcb6b('0x6d')]())['where'](_0xcb6b('0x72'))['where'](_0xcb6b('0x73'),squel['select']()[_0xcb6b('0x6a')](_0xcb6b('0x74'))['from'](_0xcb6b('0x75'))[_0xcb6b('0x3e')](_0xcb6b('0x76'),_0x4986df[_0xcb6b('0x51')]['id']['toString']()))[_0xcb6b('0x3e')](_0xcb6b('0x73'),squel[_0xcb6b('0x69')]()[_0xcb6b('0x6a')](_0xcb6b('0x77'))[_0xcb6b('0x78')](_0xcb6b('0x79'))[_0xcb6b('0x3e')]('CampaignId\x20=\x20?',_0x4986df[_0xcb6b('0x51')]['id']['toString']())))[_0xcb6b('0x6d')]();break;case _0xcb6b('0x7a'):_0x40f5cb=squel[_0xcb6b('0x7b')]()[_0xcb6b('0x7c')](_0xcb6b('0x79'))['fromQuery']([_0xcb6b('0x66'),_0xcb6b('0x67'),_0xcb6b('0x68'),'ListId',_0xcb6b('0x5c'),_0xcb6b('0x55'),'updatedAt'],squel[_0xcb6b('0x69')]()[_0xcb6b('0x6a')](_0xcb6b('0x66'),_0xcb6b('0x66'))['field'](_0xcb6b('0x6e'),_0xcb6b('0x67'))[_0xcb6b('0x6a')]('id','ContactId')['field'](_0x3b8ce1['CmListId'][_0xcb6b('0x6d')](),_0xcb6b('0x6c'))['field'](_0x4986df[_0xcb6b('0x51')]['id'][_0xcb6b('0x6d')](),_0xcb6b('0x5c'))[_0xcb6b('0x6a')](_0xcb6b('0x6e'),_0xcb6b('0x55'))[_0xcb6b('0x6a')](_0xcb6b('0x6e'),_0xcb6b('0x56'))[_0xcb6b('0x78')](_0xcb6b('0x6f'))[_0xcb6b('0x3e')](_0xcb6b('0x70'))[_0xcb6b('0x3e')]('ListId\x20=\x20?',_0x3b8ce1[_0xcb6b('0x6b')][_0xcb6b('0x6d')]())['where'](_0xcb6b('0x72'))[_0xcb6b('0x3e')](_0xcb6b('0x73'),squel[_0xcb6b('0x69')]()[_0xcb6b('0x6a')]('COALESCE(phone,\x27\x27)')[_0xcb6b('0x78')](_0xcb6b('0x79'))['where'](_0xcb6b('0x76'),_0x4986df[_0xcb6b('0x51')]['id']['toString']())))['toString']();break;default:_0x40f5cb=squel['insert']()[_0xcb6b('0x7c')](_0xcb6b('0x79'))[_0xcb6b('0x7d')]([_0xcb6b('0x66'),_0xcb6b('0x67'),_0xcb6b('0x68'),_0xcb6b('0x6c'),_0xcb6b('0x5c'),_0xcb6b('0x55'),'updatedAt'],squel[_0xcb6b('0x69')]()[_0xcb6b('0x6a')]('phone','phone')[_0xcb6b('0x6a')]('NOW()',_0xcb6b('0x67'))[_0xcb6b('0x6a')]('id',_0xcb6b('0x68'))[_0xcb6b('0x6a')](_0x3b8ce1[_0xcb6b('0x6b')]['toString'](),_0xcb6b('0x6c'))[_0xcb6b('0x6a')](_0x4986df[_0xcb6b('0x51')]['id'][_0xcb6b('0x6d')](),_0xcb6b('0x5c'))[_0xcb6b('0x6a')]('NOW()',_0xcb6b('0x55'))[_0xcb6b('0x6a')](_0xcb6b('0x6e'),'updatedAt')[_0xcb6b('0x78')](_0xcb6b('0x6f'))[_0xcb6b('0x3e')](_0xcb6b('0x70'))[_0xcb6b('0x3e')](_0xcb6b('0x71'),_0x3b8ce1[_0xcb6b('0x6b')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xcb6b('0x6d')]();}_0x537d44[_0xcb6b('0x7e')](db[_0xcb6b('0x7f')]['query'](_0x40f5cb));}return BPromise['all'](_0x537d44);}})[_0xcb6b('0x24')](function(){return _0x2d698d;})['then'](respondWithResult(_0x442753,null))['catch'](handleError(_0x442753,null));};exports[_0xcb6b('0x80')]=function(_0x41c270,_0x26bb28,_0x1c7226){return db[_0xcb6b('0x2f')][_0xcb6b('0x4c')]({'where':{'id':_0x41c270['params']['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x26bb28,null))[_0xcb6b('0x24')](function(_0x1d2b3e){if(_0x1d2b3e){return _0x1d2b3e[_0xcb6b('0x80')](_0x41c270[_0xcb6b('0x34')][_0xcb6b('0x63')]);}})[_0xcb6b('0x24')](function(_0x52fde5){if(_0x52fde5){return db[_0xcb6b('0x5a')][_0xcb6b('0x28')]({'where':{'ListId':_0x41c270['query'][_0xcb6b('0x63')],'CampaignId':_0x41c270[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](function(){return _0x52fde5;});}})['then'](respondWithStatusCode(_0x26bb28,null))[_0xcb6b('0x46')](handleError(_0x26bb28,null));};exports[_0xcb6b('0x81')]=function(_0x47e662,_0x823f19,_0x53ea58){var _0x38b9f3={};var _0x468695={};var _0x51c58c;var _0x2683f4;return db[_0xcb6b('0x2f')][_0xcb6b('0x59')]({'where':{'id':_0x47e662[_0xcb6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x823f19,null))[_0xcb6b('0x24')](function(_0xea0a50){if(_0xea0a50){_0x51c58c=_0xea0a50;_0x468695[_0xcb6b('0x33')]=_['keys'](db[_0xcb6b('0x82')][_0xcb6b('0x30')]);_0x468695[_0xcb6b('0x34')]=_[_0xcb6b('0x35')](_0x47e662[_0xcb6b('0x34')]);_0x468695[_0xcb6b('0x36')]=_[_0xcb6b('0x37')](_0x468695[_0xcb6b('0x33')],_0x468695['query']);_0x38b9f3[_0xcb6b('0x39')]=_[_0xcb6b('0x37')](_0x468695['model'],qs[_0xcb6b('0x38')](_0x47e662['query'][_0xcb6b('0x38')]));_0x38b9f3[_0xcb6b('0x39')]=_0x38b9f3[_0xcb6b('0x39')][_0xcb6b('0x3a')]?_0x38b9f3[_0xcb6b('0x39')]:_0x468695[_0xcb6b('0x33')];_0x38b9f3['order']=qs[_0xcb6b('0x3d')](_0x47e662[_0xcb6b('0x34')][_0xcb6b('0x3d')]);_0x38b9f3[_0xcb6b('0x3e')]=qs[_0xcb6b('0x36')](_[_0xcb6b('0x3f')](_0x47e662[_0xcb6b('0x34')],_0x468695[_0xcb6b('0x36')]));if(_0x47e662['query'][_0xcb6b('0x40')]){_0x38b9f3[_0xcb6b('0x3e')]=_[_0xcb6b('0x52')](_0x38b9f3['where'],{'$or':_[_0xcb6b('0x2e')](_0x38b9f3[_0xcb6b('0x39')],function(_0xda8eb){var _0x2f2ed0={};_0x2f2ed0[_0xda8eb]={'$like':'%'+_0x47e662[_0xcb6b('0x34')][_0xcb6b('0x40')]+'%'};return _0x2f2ed0;})});}_0x38b9f3=_[_0xcb6b('0x52')]({},_0x38b9f3,_0x47e662[_0xcb6b('0x42')]);return _0x51c58c[_0xcb6b('0x81')](_0x38b9f3);}})[_0xcb6b('0x24')](function(_0x3b7d1c){if(_0x3b7d1c){_0x2683f4=_0x3b7d1c[_0xcb6b('0x3a')];if(!_0x47e662[_0xcb6b('0x34')][_0xcb6b('0x5b')](_0xcb6b('0x3b'))){_0x38b9f3[_0xcb6b('0x1d')]=qs[_0xcb6b('0x1d')](_0x47e662[_0xcb6b('0x34')]['limit']);_0x38b9f3[_0xcb6b('0x1b')]=qs[_0xcb6b('0x1b')](_0x47e662[_0xcb6b('0x34')]['offset']);}return _0x51c58c[_0xcb6b('0x81')](_0x38b9f3);}})['then'](function(_0x231f79){if(_0x231f79){return _0x231f79?{'count':_0x2683f4,'rows':_0x231f79}:null;}})[_0xcb6b('0x24')](respondWithResult(_0x823f19,null))[_0xcb6b('0x46')](handleError(_0x823f19,null));};exports['addBlackLists']=function(_0x46dea,_0x235676,_0x32eab5){var _0x531b0a,_0x52ace7;return db['Campaign']['find']({'where':{'id':_0x46dea[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](handleEntityNotFound(_0x235676,null))[_0xcb6b('0x24')](function(_0x211e33){if(_0x211e33){_0x52ace7=_0x211e33;return _0x211e33[_0xcb6b('0x83')](_0x46dea[_0xcb6b('0x54')][_0xcb6b('0x63')],_['omit'](_0x46dea[_0xcb6b('0x54')],[_0xcb6b('0x63'),'id'])||{});}return null;})['spread'](function(_0x53224e){var _0x4a51ef;_0x531b0a=_0x53224e||[];var _0x52af3c=[];if(_0x53224e){for(var _0x3fbcb3=0x0;_0x3fbcb3<_0x53224e[_0xcb6b('0x3a')];_0x3fbcb3+=0x1){var _0x5247f3=_0x53224e[_0x3fbcb3][_0xcb6b('0x25')]({'plain':!![]});_0x4a51ef=squel[_0xcb6b('0x7b')]()['into'](_0xcb6b('0x84'))['fromQuery']([_0xcb6b('0x66'),'ContactId','ListId',_0xcb6b('0x5c'),_0xcb6b('0x55'),_0xcb6b('0x56')],squel['select']()[_0xcb6b('0x6a')](_0xcb6b('0x66'),_0xcb6b('0x66'))[_0xcb6b('0x6a')]('id','ContactId')[_0xcb6b('0x6a')](_0x5247f3[_0xcb6b('0x6b')][_0xcb6b('0x6d')](),_0xcb6b('0x6c'))[_0xcb6b('0x6a')](_0x46dea[_0xcb6b('0x51')]['id'][_0xcb6b('0x6d')](),_0xcb6b('0x5c'))[_0xcb6b('0x6a')](_0xcb6b('0x6e'),'createdAt')[_0xcb6b('0x6a')](_0xcb6b('0x6e'),'updatedAt')[_0xcb6b('0x78')](_0xcb6b('0x6f'))[_0xcb6b('0x3e')](_0xcb6b('0x70'))['where'](_0xcb6b('0x71'),_0x5247f3[_0xcb6b('0x6b')][_0xcb6b('0x6d')]())[_0xcb6b('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xcb6b('0x6d')]();_0x52af3c[_0xcb6b('0x7e')](db[_0xcb6b('0x7f')][_0xcb6b('0x34')](_0x4a51ef));}return BPromise[_0xcb6b('0x85')](_0x52af3c);}})['then'](function(){return _0x531b0a;})[_0xcb6b('0x24')](respondWithResult(_0x235676,null))[_0xcb6b('0x46')](handleError(_0x235676,null));};exports[_0xcb6b('0x86')]=function(_0x184eee,_0x3d7d41,_0x419187){return db[_0xcb6b('0x2f')][_0xcb6b('0x4c')]({'where':{'id':_0x184eee[_0xcb6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d7d41,null))['then'](function(_0xe59123){if(_0xe59123){return _0xe59123['removeBlackLists'](_0x184eee[_0xcb6b('0x34')][_0xcb6b('0x63')]);}})[_0xcb6b('0x24')](function(_0x544fcf){if(_0x544fcf){return db[_0xcb6b('0x60')][_0xcb6b('0x28')]({'where':{'ListId':_0x184eee[_0xcb6b('0x34')]['ids'],'CampaignId':_0x184eee[_0xcb6b('0x51')]['id']}})[_0xcb6b('0x24')](function(){return _0x544fcf;});}})['then'](respondWithStatusCode(_0x3d7d41,null))[_0xcb6b('0x46')](handleError(_0x3d7d41,null));}; \ No newline at end of file +var _0x5d63=['into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','rimraf','moment','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/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','include','rows','catch','keys','intersection','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getHoppers','findOne','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert'];(function(_0x43f294,_0x254515){var _0x343113=function(_0x52fcf1){while(--_0x52fcf1){_0x43f294['push'](_0x43f294['shift']());}};_0x343113(++_0x254515);}(_0x5d63,0x12c));var _0x35d6=function(_0xbf1747,_0x43b06c){_0xbf1747=_0xbf1747-0x0;var _0x3b7657=_0x5d63[_0xbf1747];return _0x3b7657;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x35d6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x35d6('0x2'));var util=require(_0x35d6('0x3'));var path=require(_0x35d6('0x4'));var sox=require(_0x35d6('0x5'));var csv=require(_0x35d6('0x6'));var ejs=require(_0x35d6('0x7'));var fs=require('fs');var fs_extra=require(_0x35d6('0x8'));var _=require(_0x35d6('0x9'));var squel=require(_0x35d6('0xa'));var crypto=require(_0x35d6('0xb'));var jsforce=require(_0x35d6('0xc'));var deskjs=require(_0x35d6('0xd'));var toCsv=require(_0x35d6('0x6'));var querystring=require(_0x35d6('0xe'));var Papa=require(_0x35d6('0xf'));var Redis=require('ioredis');var authService=require(_0x35d6('0x10'));var qs=require(_0x35d6('0x11'));var as=require(_0x35d6('0x12'));var hardwareService=require(_0x35d6('0x13'));var logger=require(_0x35d6('0x14'))('api');var utils=require(_0x35d6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x35d6('0x16'));var db=require(_0x35d6('0x17'))['db'];function respondWithStatusCode(_0x242dff,_0x3a9f66){_0x3a9f66=_0x3a9f66||0xcc;return function(_0x548ca5){if(_0x548ca5){return _0x242dff['sendStatus'](_0x3a9f66);}return _0x242dff[_0x35d6('0x18')](_0x3a9f66)[_0x35d6('0x19')]();};}function respondWithResult(_0x2a4c58,_0x4499dd){_0x4499dd=_0x4499dd||0xc8;return function(_0x2c128c){if(_0x2c128c){return _0x2a4c58['status'](_0x4499dd)[_0x35d6('0x1a')](_0x2c128c);}};}function respondWithFilteredResult(_0x1eb536,_0x1a30d9){return function(_0x2b13b7){if(_0x2b13b7){var _0x4a16a5=typeof _0x1a30d9[_0x35d6('0x1b')]==='undefined'&&typeof _0x1a30d9[_0x35d6('0x1c')]==='undefined';var _0x37ef38=_0x2b13b7['count'];var _0x600b91=_0x4a16a5?0x0:_0x1a30d9['offset'];var _0x129e73=_0x4a16a5?_0x2b13b7[_0x35d6('0x1d')]:_0x1a30d9['offset']+_0x1a30d9[_0x35d6('0x1c')];var _0x432a01;if(_0x129e73>=_0x37ef38){_0x129e73=_0x37ef38;_0x432a01=0xc8;}else{_0x432a01=0xce;}_0x1eb536[_0x35d6('0x18')](_0x432a01);return _0x1eb536[_0x35d6('0x1e')](_0x35d6('0x1f'),_0x600b91+'-'+_0x129e73+'/'+_0x37ef38)[_0x35d6('0x1a')](_0x2b13b7);}return null;};}function patchUpdates(_0x388e0c){return function(_0x25fe58){try{jsonpatch[_0x35d6('0x20')](_0x25fe58,_0x388e0c,!![]);}catch(_0x2e63ee){return BPromise[_0x35d6('0x21')](_0x2e63ee);}return _0x25fe58[_0x35d6('0x22')]();};}function saveUpdates(_0x44cbdb,_0x5de8a0){return function(_0xbe348e){if(_0xbe348e){return _0xbe348e[_0x35d6('0x23')](_0x44cbdb)[_0x35d6('0x24')](function(_0x5c50dd){return _0x5c50dd;});}return null;};}function removeEntity(_0x59372d,_0x47574e){return function(_0xe0699a){if(_0xe0699a){return _0xe0699a[_0x35d6('0x25')]()['then'](function(){var _0xc93c44=_0xe0699a[_0x35d6('0x26')]({'plain':!![]});var _0x54e067=_0x35d6('0x27');return db[_0x35d6('0x28')]['destroy']({'where':{'type':_0x54e067,'resourceId':_0xc93c44['id']}})['then'](function(){return _0xe0699a;});})[_0x35d6('0x24')](function(){_0x59372d[_0x35d6('0x18')](0xcc)[_0x35d6('0x19')]();});}};}function handleEntityNotFound(_0x3931bb,_0x520921){return function(_0x132e94){if(!_0x132e94){_0x3931bb[_0x35d6('0x29')](0x194);}return _0x132e94;};}function handleError(_0x19760b,_0xa48bcd){_0xa48bcd=_0xa48bcd||0x1f4;return function(_0x53a3f2){logger[_0x35d6('0x2a')](_0x53a3f2[_0x35d6('0x2b')]);if(_0x53a3f2[_0x35d6('0x2c')]){delete _0x53a3f2[_0x35d6('0x2c')];}_0x19760b[_0x35d6('0x18')](_0xa48bcd)[_0x35d6('0x2d')](_0x53a3f2);};}exports[_0x35d6('0x2e')]=function(_0x40ad5d,_0x4f2ecb){var _0x558f5c={},_0x10cd9a={},_0x6232b3={'count':0x0,'rows':[]};var _0x4916ea=_[_0x35d6('0x2f')](db[_0x35d6('0x30')][_0x35d6('0x31')],function(_0x1d7cd2){return{'name':_0x1d7cd2['fieldName'],'type':_0x1d7cd2[_0x35d6('0x32')][_0x35d6('0x33')]};});_0x10cd9a['model']=_['map'](_0x4916ea,_0x35d6('0x2c'));_0x10cd9a[_0x35d6('0x34')]=_['keys'](_0x40ad5d[_0x35d6('0x34')]);_0x10cd9a[_0x35d6('0x35')]=_['intersection'](_0x10cd9a[_0x35d6('0x36')],_0x10cd9a['query']);_0x558f5c[_0x35d6('0x37')]=_['intersection'](_0x10cd9a[_0x35d6('0x36')],qs[_0x35d6('0x38')](_0x40ad5d[_0x35d6('0x34')]['fields']));_0x558f5c[_0x35d6('0x37')]=_0x558f5c[_0x35d6('0x37')][_0x35d6('0x39')]?_0x558f5c['attributes']:_0x10cd9a['model'];if(!_0x40ad5d[_0x35d6('0x34')][_0x35d6('0x3a')](_0x35d6('0x3b'))){_0x558f5c[_0x35d6('0x1c')]=qs[_0x35d6('0x1c')](_0x40ad5d['query'][_0x35d6('0x1c')]);_0x558f5c[_0x35d6('0x1b')]=qs[_0x35d6('0x1b')](_0x40ad5d[_0x35d6('0x34')][_0x35d6('0x1b')]);}_0x558f5c[_0x35d6('0x3c')]=qs[_0x35d6('0x3d')](_0x40ad5d['query'][_0x35d6('0x3d')]);_0x558f5c['where']=qs[_0x35d6('0x35')](_[_0x35d6('0x3e')](_0x40ad5d[_0x35d6('0x34')],_0x10cd9a[_0x35d6('0x35')]),_0x4916ea);if(_0x40ad5d[_0x35d6('0x34')]['filter']){_0x558f5c['where']=_['merge'](_0x558f5c[_0x35d6('0x3f')],{'$or':_[_0x35d6('0x2f')](_0x4916ea,function(_0x571e75){if(_0x571e75[_0x35d6('0x32')]!==_0x35d6('0x40')){var _0x3a79fc={};_0x3a79fc[_0x571e75[_0x35d6('0x2c')]]={'$like':'%'+_0x40ad5d[_0x35d6('0x34')][_0x35d6('0x41')]+'%'};return _0x3a79fc;}})});}_0x558f5c=_['merge']({},_0x558f5c,_0x40ad5d['options']);var _0x38d72e={'where':_0x558f5c[_0x35d6('0x3f')]};return db['Campaign'][_0x35d6('0x1d')](_0x38d72e)[_0x35d6('0x24')](function(_0x16abe2){_0x6232b3['count']=_0x16abe2;if(_0x40ad5d['query'][_0x35d6('0x42')]){_0x558f5c[_0x35d6('0x43')]=[{'all':!![]}];}return db[_0x35d6('0x30')]['findAll'](_0x558f5c);})[_0x35d6('0x24')](function(_0x593c77){_0x6232b3[_0x35d6('0x44')]=_0x593c77;return _0x6232b3;})[_0x35d6('0x24')](respondWithFilteredResult(_0x4f2ecb,_0x558f5c))[_0x35d6('0x45')](handleError(_0x4f2ecb,null));};exports['show']=function(_0x1aa8b7,_0x174e96){var _0x4cdee6={'raw':![],'where':{'id':_0x1aa8b7['params']['id']}},_0x2aabbb={};_0x2aabbb[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x30')][_0x35d6('0x31')]);_0x2aabbb[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x1aa8b7[_0x35d6('0x34')]);_0x2aabbb[_0x35d6('0x35')]=_[_0x35d6('0x47')](_0x2aabbb['model'],_0x2aabbb[_0x35d6('0x34')]);_0x4cdee6[_0x35d6('0x37')]=_[_0x35d6('0x47')](_0x2aabbb[_0x35d6('0x36')],qs['fields'](_0x1aa8b7['query'][_0x35d6('0x38')]));_0x4cdee6[_0x35d6('0x37')]=_0x4cdee6[_0x35d6('0x37')]['length']?_0x4cdee6[_0x35d6('0x37')]:_0x2aabbb['model'];if(_0x1aa8b7[_0x35d6('0x34')]['includeAll']){_0x4cdee6[_0x35d6('0x43')]=[{'all':!![]}];}_0x4cdee6=_[_0x35d6('0x48')]({},_0x4cdee6,_0x1aa8b7[_0x35d6('0x49')]);return db[_0x35d6('0x30')][_0x35d6('0x4a')](_0x4cdee6)[_0x35d6('0x24')](handleEntityNotFound(_0x174e96,null))[_0x35d6('0x24')](respondWithResult(_0x174e96,null))[_0x35d6('0x45')](handleError(_0x174e96,null));};exports[_0x35d6('0x4b')]=function(_0x1e6e8b,_0x40a2d0){return db[_0x35d6('0x30')][_0x35d6('0x4b')](_0x1e6e8b[_0x35d6('0x4c')],{})[_0x35d6('0x24')](function(_0x4f7ac1){var _0x33fe7f=_0x1e6e8b[_0x35d6('0x4d')]['get']({'plain':!![]});if(!_0x33fe7f)throw new Error(_0x35d6('0x4e'));if(_0x33fe7f[_0x35d6('0x4f')]===_0x35d6('0x4d')){var _0x22f712=_0x4f7ac1[_0x35d6('0x26')]({'plain':!![]});var _0x365bb1=_0x35d6('0x27');return db[_0x35d6('0x50')][_0x35d6('0x4a')]({'where':{'name':_0x365bb1,'userProfileId':_0x33fe7f[_0x35d6('0x51')]},'raw':!![]})[_0x35d6('0x24')](function(_0x3d93de){if(_0x3d93de&&_0x3d93de[_0x35d6('0x52')]===0x0){return db[_0x35d6('0x28')][_0x35d6('0x4b')]({'name':_0x22f712[_0x35d6('0x2c')],'resourceId':_0x22f712['id'],'type':_0x3d93de[_0x35d6('0x2c')],'sectionId':_0x3d93de['id']},{})[_0x35d6('0x24')](function(){return _0x4f7ac1;});}else{return _0x4f7ac1;}})['catch'](function(_0x5d0ce4){logger[_0x35d6('0x2a')](_0x35d6('0x53'),_0x5d0ce4);throw _0x5d0ce4;});}return _0x4f7ac1;})['then'](respondWithResult(_0x40a2d0,0xc9))[_0x35d6('0x45')](handleError(_0x40a2d0,null));};exports[_0x35d6('0x54')]=function(_0x483836,_0x4c475c){var _0x8d193a={'where':{'id':_0x483836[_0x35d6('0x55')]['id']}},_0x5160e8={};_0x5160e8[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x30')][_0x35d6('0x31')]);_0x8d193a['attributes']=_[_0x35d6('0x47')](_0x5160e8[_0x35d6('0x36')],qs['fields'](_0x483836['query'][_0x35d6('0x38')]));_0x8d193a[_0x35d6('0x37')]=_0x8d193a[_0x35d6('0x37')][_0x35d6('0x39')]?_0x8d193a[_0x35d6('0x37')]:_0x5160e8[_0x35d6('0x36')];if(_0x483836[_0x35d6('0x34')][_0x35d6('0x42')]){_0x8d193a[_0x35d6('0x43')]=[{'all':!![]}];}_0x8d193a=_[_0x35d6('0x48')]({},_0x8d193a,_0x483836[_0x35d6('0x49')]);return db['Campaign'][_0x35d6('0x4a')](_0x8d193a)[_0x35d6('0x24')](handleEntityNotFound(_0x4c475c,null))[_0x35d6('0x24')](function(_0xa85577){if(_0xa85577){var _0x45e808=_0xa85577['get']({'plain':!![]});_0x45e808=qs[_0x35d6('0x56')](_0x45e808,['id',_0x35d6('0x57'),_0x35d6('0x58')]);_0x483836[_0x35d6('0x4c')]=_[_0x35d6('0x56')](_0x483836[_0x35d6('0x4c')],['id','createdAt',_0x35d6('0x58')]);return db[_0x35d6('0x30')][_0x35d6('0x4b')](_[_0x35d6('0x48')](_0x45e808,_0x483836[_0x35d6('0x4c')]),{'include':_0x483836[_0x35d6('0x34')][_0x35d6('0x42')]?[{'all':!![]}]:undefined})[_0x35d6('0x24')](function(_0x415ff2){var _0xd42544=_0x483836[_0x35d6('0x4d')]['get']({'plain':!![]});if(!_0xd42544)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd42544[_0x35d6('0x4f')]===_0x35d6('0x4d')){var _0x3561d8=_0x415ff2[_0x35d6('0x26')]({'plain':!![]});var _0x784f7=_0x35d6('0x27');return db[_0x35d6('0x50')]['find']({'where':{'name':_0x784f7,'userProfileId':_0xd42544['userProfileId']},'raw':!![]})['then'](function(_0x11081e){if(_0x11081e&&_0x11081e[_0x35d6('0x52')]===0x0){return db['UserProfileResource'][_0x35d6('0x4b')]({'name':_0x3561d8[_0x35d6('0x2c')],'resourceId':_0x3561d8['id'],'type':_0x11081e[_0x35d6('0x2c')],'sectionId':_0x11081e['id']},{})['then'](function(){return _0x415ff2;});}else{return _0x415ff2;}})[_0x35d6('0x45')](function(_0x39f528){logger[_0x35d6('0x2a')](_0x35d6('0x53'),_0x39f528);throw _0x39f528;});}return _0x415ff2;});}})[_0x35d6('0x24')](respondWithResult(_0x4c475c,0xc9))[_0x35d6('0x45')](handleError(_0x4c475c,null));};exports[_0x35d6('0x23')]=function(_0x464fb3,_0x4fd8ff){if(_0x464fb3['body']['id']){delete _0x464fb3[_0x35d6('0x4c')]['id'];}return db['Campaign'][_0x35d6('0x4a')]({'where':{'id':_0x464fb3[_0x35d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x4fd8ff,null))['then'](saveUpdates(_0x464fb3[_0x35d6('0x4c')],null))[_0x35d6('0x24')](respondWithResult(_0x4fd8ff,null))[_0x35d6('0x45')](handleError(_0x4fd8ff,null));};exports[_0x35d6('0x25')]=function(_0x2d0bb4,_0x1fb158){return db[_0x35d6('0x30')]['find']({'where':{'id':_0x2d0bb4[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x1fb158,null))[_0x35d6('0x24')](removeEntity(_0x1fb158,null))[_0x35d6('0x45')](handleError(_0x1fb158,null));};exports[_0x35d6('0x59')]=function(_0x1952c5,_0xf4d675,_0x5be9ea){var _0x558e3b={'raw':!![],'where':{}};var _0x567485={};var _0x59e69e={'count':0x0,'rows':[]};return db[_0x35d6('0x30')][_0x35d6('0x5a')]({'where':{'id':_0x1952c5[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0xf4d675,null))['then'](function(_0x276ce4){if(_0x276ce4){_0x567485[_0x35d6('0x36')]=_[_0x35d6('0x46')](db['CmHopper'][_0x35d6('0x31')]);_0x567485[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x1952c5[_0x35d6('0x34')]);_0x567485[_0x35d6('0x35')]=_[_0x35d6('0x47')](_0x567485[_0x35d6('0x36')],_0x567485['query']);_0x558e3b['attributes']=_[_0x35d6('0x47')](_0x567485[_0x35d6('0x36')],qs[_0x35d6('0x38')](_0x1952c5['query'][_0x35d6('0x38')]));_0x558e3b['attributes']=_0x558e3b[_0x35d6('0x37')][_0x35d6('0x39')]?_0x558e3b[_0x35d6('0x37')]:_0x567485[_0x35d6('0x36')];if(!_0x1952c5[_0x35d6('0x34')]['hasOwnProperty'](_0x35d6('0x3b'))){_0x558e3b[_0x35d6('0x1c')]=qs['limit'](_0x1952c5[_0x35d6('0x34')][_0x35d6('0x1c')]);_0x558e3b[_0x35d6('0x1b')]=qs['offset'](_0x1952c5[_0x35d6('0x34')]['offset']);}_0x558e3b[_0x35d6('0x3c')]=qs[_0x35d6('0x3d')](_0x1952c5[_0x35d6('0x34')][_0x35d6('0x3d')]);_0x558e3b['where']=qs['filters'](_[_0x35d6('0x3e')](_0x1952c5[_0x35d6('0x34')],_0x567485[_0x35d6('0x35')]));_0x558e3b[_0x35d6('0x3f')][_0x35d6('0x5b')]=_0x276ce4['id'];if(_0x1952c5['query'][_0x35d6('0x41')]){_0x558e3b['where']=_[_0x35d6('0x48')](_0x558e3b[_0x35d6('0x3f')],{'$or':_[_0x35d6('0x2f')](_0x558e3b[_0x35d6('0x37')],function(_0x103e23){var _0x265816={};_0x265816[_0x103e23]={'$like':'%'+_0x1952c5['query']['filter']+'%'};return _0x265816;})});}_0x558e3b=_[_0x35d6('0x48')]({},_0x558e3b,_0x1952c5[_0x35d6('0x49')]);return db[_0x35d6('0x5c')]['count']({'where':_0x558e3b[_0x35d6('0x3f')]})[_0x35d6('0x24')](function(_0x5668fc){_0x59e69e[_0x35d6('0x1d')]=_0x5668fc;if(_0x1952c5['query'][_0x35d6('0x42')]){_0x558e3b['include']=[{'all':!![]}];}return db[_0x35d6('0x5c')][_0x35d6('0x5d')](_0x558e3b);})['then'](function(_0x26f6db){_0x59e69e[_0x35d6('0x44')]=_0x26f6db;return _0x59e69e;});}})['then'](respondWithFilteredResult(_0xf4d675,_0x558e3b))[_0x35d6('0x45')](handleError(_0xf4d675,null));};exports[_0x35d6('0x5e')]=function(_0x1763dc,_0x1726c2,_0x4a7680){var _0x3e8119={'raw':!![],'where':{}};var _0x9c0c18={};var _0x448c54={'count':0x0,'rows':[]};return db[_0x35d6('0x30')]['findOne']({'where':{'id':_0x1763dc[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x1726c2,null))[_0x35d6('0x24')](function(_0x58bef0){if(_0x58bef0){_0x9c0c18[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x5f')][_0x35d6('0x31')]);_0x9c0c18[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x1763dc['query']);_0x9c0c18[_0x35d6('0x35')]=_[_0x35d6('0x47')](_0x9c0c18[_0x35d6('0x36')],_0x9c0c18['query']);_0x3e8119[_0x35d6('0x37')]=_[_0x35d6('0x47')](_0x9c0c18[_0x35d6('0x36')],qs['fields'](_0x1763dc[_0x35d6('0x34')][_0x35d6('0x38')]));_0x3e8119[_0x35d6('0x37')]=_0x3e8119[_0x35d6('0x37')]['length']?_0x3e8119[_0x35d6('0x37')]:_0x9c0c18[_0x35d6('0x36')];if(!_0x1763dc[_0x35d6('0x34')]['hasOwnProperty'](_0x35d6('0x3b'))){_0x3e8119['limit']=qs[_0x35d6('0x1c')](_0x1763dc[_0x35d6('0x34')][_0x35d6('0x1c')]);_0x3e8119[_0x35d6('0x1b')]=qs[_0x35d6('0x1b')](_0x1763dc['query'][_0x35d6('0x1b')]);}_0x3e8119[_0x35d6('0x3c')]=qs[_0x35d6('0x3d')](_0x1763dc['query'][_0x35d6('0x3d')]);_0x3e8119[_0x35d6('0x3f')]=qs[_0x35d6('0x35')](_[_0x35d6('0x3e')](_0x1763dc[_0x35d6('0x34')],_0x9c0c18[_0x35d6('0x35')]));_0x3e8119[_0x35d6('0x3f')]['CampaignId']=_0x58bef0['id'];if(_0x1763dc['query']['filter']){_0x3e8119[_0x35d6('0x3f')]=_[_0x35d6('0x48')](_0x3e8119['where'],{'$or':_[_0x35d6('0x2f')](_0x3e8119[_0x35d6('0x37')],function(_0x59f5db){var _0x12e119={};_0x12e119[_0x59f5db]={'$like':'%'+_0x1763dc[_0x35d6('0x34')]['filter']+'%'};return _0x12e119;})});}_0x3e8119=_['merge']({},_0x3e8119,_0x1763dc[_0x35d6('0x49')]);return db[_0x35d6('0x5f')]['count']({'where':_0x3e8119[_0x35d6('0x3f')]})[_0x35d6('0x24')](function(_0xa1b67f){_0x448c54[_0x35d6('0x1d')]=_0xa1b67f;if(_0x1763dc[_0x35d6('0x34')][_0x35d6('0x42')]){_0x3e8119['include']=[{'all':!![]}];}return db[_0x35d6('0x5f')][_0x35d6('0x5d')](_0x3e8119);})['then'](function(_0x13f519){_0x448c54[_0x35d6('0x44')]=_0x13f519;return _0x448c54;});}})[_0x35d6('0x24')](respondWithFilteredResult(_0x1726c2,_0x3e8119))[_0x35d6('0x45')](handleError(_0x1726c2,null));};exports[_0x35d6('0x60')]=function(_0x1d241b,_0x4abb2c,_0x5a660e){var _0xe700d={'raw':!![],'where':{}};var _0x1aa915={};var _0x57a371={'count':0x0,'rows':[]};return db[_0x35d6('0x30')][_0x35d6('0x5a')]({'where':{'id':_0x1d241b[_0x35d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x4abb2c,null))[_0x35d6('0x24')](function(_0x453bf5){if(_0x453bf5){_0x1aa915[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x61')][_0x35d6('0x31')]);_0x1aa915[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x1d241b[_0x35d6('0x34')]);_0x1aa915[_0x35d6('0x35')]=_[_0x35d6('0x47')](_0x1aa915['model'],_0x1aa915[_0x35d6('0x34')]);_0xe700d['attributes']=_['intersection'](_0x1aa915[_0x35d6('0x36')],qs['fields'](_0x1d241b['query']['fields']));_0xe700d[_0x35d6('0x37')]=_0xe700d['attributes']['length']?_0xe700d[_0x35d6('0x37')]:_0x1aa915['model'];if(!_0x1d241b[_0x35d6('0x34')][_0x35d6('0x3a')](_0x35d6('0x3b'))){_0xe700d[_0x35d6('0x1c')]=qs[_0x35d6('0x1c')](_0x1d241b['query'][_0x35d6('0x1c')]);_0xe700d[_0x35d6('0x1b')]=qs[_0x35d6('0x1b')](_0x1d241b[_0x35d6('0x34')][_0x35d6('0x1b')]);}_0xe700d[_0x35d6('0x3c')]=qs['sort'](_0x1d241b[_0x35d6('0x34')][_0x35d6('0x3d')]);_0xe700d[_0x35d6('0x3f')]=qs[_0x35d6('0x35')](_['pick'](_0x1d241b[_0x35d6('0x34')],_0x1aa915[_0x35d6('0x35')]));_0xe700d[_0x35d6('0x3f')][_0x35d6('0x5b')]=_0x453bf5['id'];if(_0x1d241b[_0x35d6('0x34')]['filter']){_0xe700d['where']=_[_0x35d6('0x48')](_0xe700d['where'],{'$or':_['map'](_0xe700d[_0x35d6('0x37')],function(_0x1cd774){var _0x3c9b5b={};_0x3c9b5b[_0x1cd774]={'$like':'%'+_0x1d241b[_0x35d6('0x34')][_0x35d6('0x41')]+'%'};return _0x3c9b5b;})});}_0xe700d=_[_0x35d6('0x48')]({},_0xe700d,_0x1d241b[_0x35d6('0x49')]);return db['CmHopperFinal'][_0x35d6('0x1d')]({'where':_0xe700d[_0x35d6('0x3f')]})[_0x35d6('0x24')](function(_0xa48642){_0x57a371[_0x35d6('0x1d')]=_0xa48642;if(_0x1d241b[_0x35d6('0x34')]['includeAll']){_0xe700d['include']=[{'all':!![]}];}return db[_0x35d6('0x61')]['findAll'](_0xe700d);})[_0x35d6('0x24')](function(_0x47a905){_0x57a371['rows']=_0x47a905;return _0x57a371;});}})['then'](respondWithFilteredResult(_0x4abb2c,_0xe700d))[_0x35d6('0x45')](handleError(_0x4abb2c,null));};exports[_0x35d6('0x62')]=function(_0x57092f,_0x10bc22,_0x37ae9d){var _0x3557e2={'raw':!![],'where':{}};var _0x120de9={};var _0x3cf5f5={'count':0x0,'rows':[]};return db[_0x35d6('0x30')]['findOne']({'where':{'id':_0x57092f[_0x35d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x10bc22,null))['then'](function(_0x3a9a99){if(_0x3a9a99){_0x120de9[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x63')][_0x35d6('0x31')]);_0x120de9[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x57092f[_0x35d6('0x34')]);_0x120de9[_0x35d6('0x35')]=_['intersection'](_0x120de9[_0x35d6('0x36')],_0x120de9[_0x35d6('0x34')]);_0x3557e2[_0x35d6('0x37')]=_[_0x35d6('0x47')](_0x120de9['model'],qs['fields'](_0x57092f['query'][_0x35d6('0x38')]));_0x3557e2['attributes']=_0x3557e2[_0x35d6('0x37')][_0x35d6('0x39')]?_0x3557e2[_0x35d6('0x37')]:_0x120de9[_0x35d6('0x36')];if(!_0x57092f['query'][_0x35d6('0x3a')](_0x35d6('0x3b'))){_0x3557e2[_0x35d6('0x1c')]=qs[_0x35d6('0x1c')](_0x57092f[_0x35d6('0x34')]['limit']);_0x3557e2[_0x35d6('0x1b')]=qs[_0x35d6('0x1b')](_0x57092f[_0x35d6('0x34')][_0x35d6('0x1b')]);}_0x3557e2[_0x35d6('0x3c')]=qs[_0x35d6('0x3d')](_0x57092f[_0x35d6('0x34')]['sort']);_0x3557e2[_0x35d6('0x3f')]=qs['filters'](_[_0x35d6('0x3e')](_0x57092f[_0x35d6('0x34')],_0x120de9[_0x35d6('0x35')]));_0x3557e2[_0x35d6('0x3f')]['CampaignId']=_0x3a9a99['id'];if(_0x57092f[_0x35d6('0x34')][_0x35d6('0x41')]){_0x3557e2['where']=_['merge'](_0x3557e2[_0x35d6('0x3f')],{'$or':_[_0x35d6('0x2f')](_0x3557e2[_0x35d6('0x37')],function(_0x45fddd){var _0x3e83c3={};_0x3e83c3[_0x45fddd]={'$like':'%'+_0x57092f[_0x35d6('0x34')][_0x35d6('0x41')]+'%'};return _0x3e83c3;})});}_0x3557e2=_[_0x35d6('0x48')]({},_0x3557e2,_0x57092f[_0x35d6('0x49')]);return db['CmHopperBlack'][_0x35d6('0x1d')]({'where':_0x3557e2[_0x35d6('0x3f')]})['then'](function(_0x3389a3){_0x3cf5f5[_0x35d6('0x1d')]=_0x3389a3;if(_0x57092f['query']['includeAll']){_0x3557e2[_0x35d6('0x43')]=[{'all':!![]}];}return db[_0x35d6('0x63')][_0x35d6('0x5d')](_0x3557e2);})[_0x35d6('0x24')](function(_0x206a44){_0x3cf5f5[_0x35d6('0x44')]=_0x206a44;return _0x3cf5f5;});}})[_0x35d6('0x24')](respondWithFilteredResult(_0x10bc22,_0x3557e2))['catch'](handleError(_0x10bc22,null));};exports['getLists']=function(_0x10d529,_0x49c7f6,_0x4fb153){var _0x128cfc={};var _0x236e19={};var _0x2c54f9;var _0x4f11ce;return db[_0x35d6('0x30')][_0x35d6('0x5a')]({'where':{'id':_0x10d529['params']['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x49c7f6,null))['then'](function(_0x4113d5){if(_0x4113d5){_0x2c54f9=_0x4113d5;_0x236e19[_0x35d6('0x36')]=_[_0x35d6('0x46')](db[_0x35d6('0x64')]['rawAttributes']);_0x236e19[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x10d529[_0x35d6('0x34')]);_0x236e19['filters']=_[_0x35d6('0x47')](_0x236e19[_0x35d6('0x36')],_0x236e19[_0x35d6('0x34')]);_0x128cfc[_0x35d6('0x37')]=_['intersection'](_0x236e19[_0x35d6('0x36')],qs[_0x35d6('0x38')](_0x10d529[_0x35d6('0x34')]['fields']));_0x128cfc[_0x35d6('0x37')]=_0x128cfc[_0x35d6('0x37')][_0x35d6('0x39')]?_0x128cfc[_0x35d6('0x37')]:_0x236e19['model'];_0x128cfc[_0x35d6('0x3c')]=qs[_0x35d6('0x3d')](_0x10d529[_0x35d6('0x34')][_0x35d6('0x3d')]);_0x128cfc[_0x35d6('0x3f')]=qs['filters'](_[_0x35d6('0x3e')](_0x10d529[_0x35d6('0x34')],_0x236e19[_0x35d6('0x35')]));if(_0x10d529[_0x35d6('0x34')][_0x35d6('0x41')]){_0x128cfc[_0x35d6('0x3f')]=_[_0x35d6('0x48')](_0x128cfc[_0x35d6('0x3f')],{'$or':_[_0x35d6('0x2f')](_0x128cfc['attributes'],function(_0x2fd0c5){var _0x55be29={};_0x55be29[_0x2fd0c5]={'$like':'%'+_0x10d529[_0x35d6('0x34')][_0x35d6('0x41')]+'%'};return _0x55be29;})});}_0x128cfc=_[_0x35d6('0x48')]({},_0x128cfc,_0x10d529[_0x35d6('0x49')]);return _0x2c54f9[_0x35d6('0x65')](_0x128cfc);}})[_0x35d6('0x24')](function(_0x26c8e9){if(_0x26c8e9){_0x4f11ce=_0x26c8e9[_0x35d6('0x39')];if(!_0x10d529[_0x35d6('0x34')][_0x35d6('0x3a')](_0x35d6('0x3b'))){_0x128cfc[_0x35d6('0x1c')]=qs['limit'](_0x10d529['query'][_0x35d6('0x1c')]);_0x128cfc[_0x35d6('0x1b')]=qs['offset'](_0x10d529[_0x35d6('0x34')][_0x35d6('0x1b')]);}return _0x2c54f9['getLists'](_0x128cfc);}})[_0x35d6('0x24')](function(_0x46f86a){if(_0x46f86a){return _0x46f86a?{'count':_0x4f11ce,'rows':_0x46f86a}:null;}})['then'](respondWithResult(_0x49c7f6,null))['catch'](handleError(_0x49c7f6,null));};exports[_0x35d6('0x66')]=function(_0x5c7e85,_0x4b78ab,_0x191383){var _0x421a35,_0x175ce8;return db[_0x35d6('0x30')][_0x35d6('0x4a')]({'where':{'id':_0x5c7e85[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x4b78ab,null))[_0x35d6('0x24')](function(_0x4082a7){if(_0x4082a7){_0x175ce8=_0x4082a7;return _0x4082a7[_0x35d6('0x66')](_0x5c7e85[_0x35d6('0x4c')][_0x35d6('0x67')],_[_0x35d6('0x56')](_0x5c7e85[_0x35d6('0x4c')],[_0x35d6('0x67'),'id'])||{});}return null;})[_0x35d6('0x68')](function(_0x27892e){var _0x18b14a;_0x421a35=_0x27892e||[];var _0x4687fd=[];if(_0x27892e){for(var _0x5346f1=0x0;_0x5346f1<_0x27892e['length'];_0x5346f1+=0x1){var _0x575fbc=_0x27892e[_0x5346f1][_0x35d6('0x26')]({'plain':!![]});_0x175ce8[_0x35d6('0x69')]=_0x5c7e85[_0x35d6('0x4c')][_0x35d6('0x69')]?_0x5c7e85[_0x35d6('0x4c')][_0x35d6('0x69')]:_0x175ce8[_0x35d6('0x69')];switch(_0x175ce8['dialCheckDuplicateType']){case _0x35d6('0x6a'):_0x18b14a=squel[_0x35d6('0x6b')]()[_0x35d6('0x6c')](_0x35d6('0x6d'))['fromQuery']([_0x35d6('0x6e'),_0x35d6('0x6f'),_0x35d6('0x70'),_0x35d6('0x71'),_0x35d6('0x5b'),'createdAt',_0x35d6('0x58')],squel[_0x35d6('0x72')]()[_0x35d6('0x73')]('phone','phone')[_0x35d6('0x73')](_0x35d6('0x74'),_0x35d6('0x6f'))['field']('id','ContactId')[_0x35d6('0x73')](_0x575fbc[_0x35d6('0x75')][_0x35d6('0x76')](),'ListId')[_0x35d6('0x73')](_0x5c7e85['params']['id']['toString'](),_0x35d6('0x5b'))['field'](_0x35d6('0x74'),_0x35d6('0x57'))['field']('NOW()',_0x35d6('0x58'))[_0x35d6('0x77')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x35d6('0x3f')]('ListId\x20=\x20?',_0x575fbc[_0x35d6('0x75')][_0x35d6('0x76')]())[_0x35d6('0x3f')](_0x35d6('0x78'))[_0x35d6('0x3f')](_0x35d6('0x79'),squel[_0x35d6('0x72')]()[_0x35d6('0x73')](_0x35d6('0x7a'))[_0x35d6('0x77')](_0x35d6('0x7b'))[_0x35d6('0x3f')]('CampaignId\x20=\x20?',_0x5c7e85[_0x35d6('0x55')]['id'][_0x35d6('0x76')]()))[_0x35d6('0x3f')](_0x35d6('0x79'),squel[_0x35d6('0x72')]()[_0x35d6('0x73')](_0x35d6('0x7c'))[_0x35d6('0x77')](_0x35d6('0x6d'))[_0x35d6('0x3f')](_0x35d6('0x7d'),_0x5c7e85[_0x35d6('0x55')]['id'][_0x35d6('0x76')]())))[_0x35d6('0x76')]();break;case'onlyIfOpen':_0x18b14a=squel[_0x35d6('0x6b')]()[_0x35d6('0x6c')]('cm_hopper')[_0x35d6('0x7e')]([_0x35d6('0x6e'),_0x35d6('0x6f'),_0x35d6('0x70'),_0x35d6('0x71'),'CampaignId',_0x35d6('0x57'),'updatedAt'],squel[_0x35d6('0x72')]()[_0x35d6('0x73')](_0x35d6('0x6e'),_0x35d6('0x6e'))['field']('NOW()',_0x35d6('0x6f'))[_0x35d6('0x73')]('id','ContactId')[_0x35d6('0x73')](_0x575fbc[_0x35d6('0x75')][_0x35d6('0x76')](),_0x35d6('0x71'))[_0x35d6('0x73')](_0x5c7e85[_0x35d6('0x55')]['id'][_0x35d6('0x76')](),_0x35d6('0x5b'))[_0x35d6('0x73')](_0x35d6('0x74'),_0x35d6('0x57'))['field']('NOW()','updatedAt')['from'](_0x35d6('0x7f'))[_0x35d6('0x3f')](_0x35d6('0x80'))[_0x35d6('0x3f')](_0x35d6('0x81'),_0x575fbc[_0x35d6('0x75')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x35d6('0x72')]()[_0x35d6('0x73')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x35d6('0x3f')](_0x35d6('0x7d'),_0x5c7e85[_0x35d6('0x55')]['id'][_0x35d6('0x76')]())))[_0x35d6('0x76')]();break;default:_0x18b14a=squel['insert']()[_0x35d6('0x6c')](_0x35d6('0x6d'))[_0x35d6('0x7e')]([_0x35d6('0x6e'),_0x35d6('0x6f'),_0x35d6('0x70'),_0x35d6('0x71'),_0x35d6('0x5b'),_0x35d6('0x57'),_0x35d6('0x58')],squel[_0x35d6('0x72')]()[_0x35d6('0x73')](_0x35d6('0x6e'),_0x35d6('0x6e'))['field'](_0x35d6('0x74'),_0x35d6('0x6f'))[_0x35d6('0x73')]('id',_0x35d6('0x70'))[_0x35d6('0x73')](_0x575fbc[_0x35d6('0x75')][_0x35d6('0x76')](),_0x35d6('0x71'))[_0x35d6('0x73')](_0x5c7e85[_0x35d6('0x55')]['id'][_0x35d6('0x76')](),_0x35d6('0x5b'))['field'](_0x35d6('0x74'),'createdAt')[_0x35d6('0x73')](_0x35d6('0x74'),_0x35d6('0x58'))[_0x35d6('0x77')](_0x35d6('0x7f'))[_0x35d6('0x3f')](_0x35d6('0x80'))[_0x35d6('0x3f')]('ListId\x20=\x20?',_0x575fbc[_0x35d6('0x75')][_0x35d6('0x76')]())[_0x35d6('0x3f')](_0x35d6('0x78')))['toString']();}_0x4687fd['push'](db[_0x35d6('0x82')]['query'](_0x18b14a));}return BPromise['all'](_0x4687fd);}})[_0x35d6('0x24')](function(){return _0x421a35;})[_0x35d6('0x24')](respondWithResult(_0x4b78ab,null))[_0x35d6('0x45')](handleError(_0x4b78ab,null));};exports[_0x35d6('0x83')]=function(_0x1defda,_0x28d411,_0x346f80){return db['Campaign']['find']({'where':{'id':_0x1defda[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x28d411,null))[_0x35d6('0x24')](function(_0x2ed7d){if(_0x2ed7d){return _0x2ed7d[_0x35d6('0x83')](_0x1defda[_0x35d6('0x34')][_0x35d6('0x67')]);}})['then'](function(_0x1c975d){if(_0x1c975d){return db[_0x35d6('0x5c')]['destroy']({'where':{'ListId':_0x1defda[_0x35d6('0x34')][_0x35d6('0x67')],'CampaignId':_0x1defda[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](function(){return _0x1c975d;});}})[_0x35d6('0x24')](respondWithStatusCode(_0x28d411,null))[_0x35d6('0x45')](handleError(_0x28d411,null));};exports['getBlackLists']=function(_0x16dd4f,_0x3eb1a5,_0xbff1b5){var _0x4aa8a5={};var _0x167371={};var _0x1edb07;var _0x400539;return db[_0x35d6('0x30')][_0x35d6('0x5a')]({'where':{'id':_0x16dd4f[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x3eb1a5,null))['then'](function(_0xef905f){if(_0xef905f){_0x1edb07=_0xef905f;_0x167371['model']=_['keys'](db[_0x35d6('0x64')]['rawAttributes']);_0x167371[_0x35d6('0x34')]=_[_0x35d6('0x46')](_0x16dd4f[_0x35d6('0x34')]);_0x167371[_0x35d6('0x35')]=_[_0x35d6('0x47')](_0x167371[_0x35d6('0x36')],_0x167371[_0x35d6('0x34')]);_0x4aa8a5['attributes']=_['intersection'](_0x167371[_0x35d6('0x36')],qs[_0x35d6('0x38')](_0x16dd4f[_0x35d6('0x34')]['fields']));_0x4aa8a5[_0x35d6('0x37')]=_0x4aa8a5[_0x35d6('0x37')]['length']?_0x4aa8a5[_0x35d6('0x37')]:_0x167371[_0x35d6('0x36')];_0x4aa8a5['order']=qs[_0x35d6('0x3d')](_0x16dd4f[_0x35d6('0x34')][_0x35d6('0x3d')]);_0x4aa8a5['where']=qs['filters'](_[_0x35d6('0x3e')](_0x16dd4f['query'],_0x167371[_0x35d6('0x35')]));if(_0x16dd4f[_0x35d6('0x34')][_0x35d6('0x41')]){_0x4aa8a5[_0x35d6('0x3f')]=_[_0x35d6('0x48')](_0x4aa8a5['where'],{'$or':_[_0x35d6('0x2f')](_0x4aa8a5[_0x35d6('0x37')],function(_0x4a852b){var _0x2fdacb={};_0x2fdacb[_0x4a852b]={'$like':'%'+_0x16dd4f['query'][_0x35d6('0x41')]+'%'};return _0x2fdacb;})});}_0x4aa8a5=_[_0x35d6('0x48')]({},_0x4aa8a5,_0x16dd4f[_0x35d6('0x49')]);return _0x1edb07[_0x35d6('0x84')](_0x4aa8a5);}})[_0x35d6('0x24')](function(_0xa1fa70){if(_0xa1fa70){_0x400539=_0xa1fa70['length'];if(!_0x16dd4f[_0x35d6('0x34')][_0x35d6('0x3a')](_0x35d6('0x3b'))){_0x4aa8a5['limit']=qs['limit'](_0x16dd4f[_0x35d6('0x34')]['limit']);_0x4aa8a5['offset']=qs[_0x35d6('0x1b')](_0x16dd4f[_0x35d6('0x34')][_0x35d6('0x1b')]);}return _0x1edb07[_0x35d6('0x84')](_0x4aa8a5);}})[_0x35d6('0x24')](function(_0x300b87){if(_0x300b87){return _0x300b87?{'count':_0x400539,'rows':_0x300b87}:null;}})[_0x35d6('0x24')](respondWithResult(_0x3eb1a5,null))[_0x35d6('0x45')](handleError(_0x3eb1a5,null));};exports[_0x35d6('0x85')]=function(_0x1fd317,_0x2faaf1,_0x219d68){var _0x50d4ac,_0x3f4f40;return db[_0x35d6('0x30')]['find']({'where':{'id':_0x1fd317[_0x35d6('0x55')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x2faaf1,null))[_0x35d6('0x24')](function(_0x5127df){if(_0x5127df){_0x3f4f40=_0x5127df;return _0x5127df[_0x35d6('0x85')](_0x1fd317[_0x35d6('0x4c')][_0x35d6('0x67')],_[_0x35d6('0x56')](_0x1fd317['body'],['ids','id'])||{});}return null;})['spread'](function(_0x4664d1){var _0x4cab66;_0x50d4ac=_0x4664d1||[];var _0x11c489=[];if(_0x4664d1){for(var _0x2e02c7=0x0;_0x2e02c7<_0x4664d1['length'];_0x2e02c7+=0x1){var _0x22ce1f=_0x4664d1[_0x2e02c7][_0x35d6('0x26')]({'plain':!![]});_0x4cab66=squel['insert']()[_0x35d6('0x6c')](_0x35d6('0x86'))['fromQuery'](['phone',_0x35d6('0x70'),_0x35d6('0x71'),_0x35d6('0x5b'),_0x35d6('0x57'),_0x35d6('0x58')],squel[_0x35d6('0x72')]()[_0x35d6('0x73')]('phone','phone')[_0x35d6('0x73')]('id',_0x35d6('0x70'))[_0x35d6('0x73')](_0x22ce1f[_0x35d6('0x75')][_0x35d6('0x76')](),_0x35d6('0x71'))['field'](_0x1fd317[_0x35d6('0x55')]['id'][_0x35d6('0x76')](),_0x35d6('0x5b'))[_0x35d6('0x73')](_0x35d6('0x74'),_0x35d6('0x57'))[_0x35d6('0x73')](_0x35d6('0x74'),_0x35d6('0x58'))[_0x35d6('0x77')](_0x35d6('0x7f'))[_0x35d6('0x3f')](_0x35d6('0x80'))[_0x35d6('0x3f')](_0x35d6('0x81'),_0x22ce1f['CmListId']['toString']())['where'](_0x35d6('0x78')))[_0x35d6('0x76')]();_0x11c489['push'](db[_0x35d6('0x82')]['query'](_0x4cab66));}return BPromise[_0x35d6('0x87')](_0x11c489);}})[_0x35d6('0x24')](function(){return _0x50d4ac;})['then'](respondWithResult(_0x2faaf1,null))[_0x35d6('0x45')](handleError(_0x2faaf1,null));};exports['removeBlackLists']=function(_0x373749,_0x57b975,_0x16edf2){return db[_0x35d6('0x30')][_0x35d6('0x4a')]({'where':{'id':_0x373749[_0x35d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x57b975,null))['then'](function(_0x3a34c9){if(_0x3a34c9){return _0x3a34c9['removeBlackLists'](_0x373749[_0x35d6('0x34')]['ids']);}})[_0x35d6('0x24')](function(_0x5f0f1d){if(_0x5f0f1d){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x373749['query'][_0x35d6('0x67')],'CampaignId':_0x373749['params']['id']}})[_0x35d6('0x24')](function(){return _0x5f0f1d;});}})[_0x35d6('0x24')](respondWithStatusCode(_0x57b975,null))[_0x35d6('0x45')](handleError(_0x57b975,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b9c0e8a..6e56022 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(_0x1f0d02,_0x544507){var _0x7cb25=function(_0x12d57b){while(--_0x12d57b){_0x1f0d02['push'](_0x1f0d02['shift']());}};_0x7cb25(++_0x544507);}(_0x7a54,0x106));var _0x47a5=function(_0x353c5c,_0x9a71d4){_0x353c5c=_0x353c5c-0x0;var _0x41ac6a=_0x7a54[_0x353c5c];return _0x41ac6a;};'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(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 578c728..be9b40a 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 _0x38c3=['findAll','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetCampaign','Campaign'];(function(_0x3a9b50,_0x3d01d4){var _0x554a4b=function(_0x15cc2c){while(--_0x15cc2c){_0x3a9b50['push'](_0x3a9b50['shift']());}};_0x554a4b(++_0x3d01d4);}(_0x38c3,0x13d));var _0x338c=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0x38c3[_0x331298];return _0x3824bc;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var moment=require('moment');var BPromise=require(_0x338c('0x2'));var rs=require(_0x338c('0x3'));var fs=require('fs');var Redis=require(_0x338c('0x4'));var db=require(_0x338c('0x5'))['db'];var utils=require(_0x338c('0x6'));var logger=require(_0x338c('0x7'))('rpc');var config=require(_0x338c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x338c('0x9')][_0x338c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c021d,_0x39dacd,_0x2864c3){return new BPromise(function(_0x46286d,_0x5f285b){return client[_0x338c('0xb')](_0x4c021d,_0x2864c3)[_0x338c('0xc')](function(_0x212690){logger[_0x338c('0xd')](_0x338c('0xe'),_0x39dacd,_0x338c('0xf'));logger[_0x338c('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x39dacd,_0x338c('0xf'),JSON[_0x338c('0x11')](_0x212690));if(_0x212690['error']){if(_0x212690[_0x338c('0x12')]['code']===0x1f4){logger[_0x338c('0x12')](_0x338c('0xe'),_0x39dacd,_0x212690['error'][_0x338c('0x13')]);return _0x5f285b(_0x212690[_0x338c('0x12')][_0x338c('0x13')]);}logger[_0x338c('0x12')](_0x338c('0xe'),_0x39dacd,_0x212690[_0x338c('0x12')][_0x338c('0x13')]);return _0x46286d(_0x212690[_0x338c('0x12')][_0x338c('0x13')]);}else{logger[_0x338c('0xd')]('Campaign,\x20%s,\x20%s',_0x39dacd,'request\x20sent');_0x46286d(_0x212690[_0x338c('0x14')][_0x338c('0x13')]);}})[_0x338c('0x15')](function(_0x21cbd4){logger['error'](_0x338c('0xe'),_0x39dacd,_0x21cbd4);_0x5f285b(_0x21cbd4);});});}exports[_0x338c('0x16')]=function(_0x3a0784){var _0x307f7b=this;return new Promise(function(_0x190919,_0x3c988a){return db[_0x338c('0x17')][_0x338c('0x18')]({'raw':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')][_0x338c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')]['where']||null:null,'attributes':_0x3a0784['options']?_0x3a0784[_0x338c('0x19')][_0x338c('0x1b')]||null:null,'limit':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')]['limit']||null:null,'include':_0x3a0784[_0x338c('0x19')]?_0x3a0784['options'][_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x3a0784['options'][_0x338c('0x1c')],function(_0x144db9){return{'model':db[_0x144db9['model']],'as':_0x144db9['as'],'attributes':_0x144db9[_0x338c('0x1b')],'include':_0x144db9[_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x144db9[_0x338c('0x1c')],function(_0x26013d){return{'model':db[_0x26013d[_0x338c('0x1e')]],'as':_0x26013d['as'],'attributes':_0x26013d[_0x338c('0x1b')],'include':_0x26013d[_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x26013d['include'],function(_0x30edb0){return{'model':db[_0x30edb0[_0x338c('0x1e')]],'as':_0x30edb0['as'],'attributes':_0x30edb0[_0x338c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae957){logger[_0x338c('0xd')]('GetCampaign',_0x3a0784);logger[_0x338c('0x10')](_0x338c('0x16'),_0x3a0784,JSON[_0x338c('0x11')](_0x3ae957));_0x190919(_0x3ae957);})[_0x338c('0x15')](function(_0x1b7339){logger[_0x338c('0x12')]('GetCampaign',_0x1b7339['message'],_0x3a0784);_0x3c988a(_0x307f7b[_0x338c('0x12')](0x1f4,_0x1b7339[_0x338c('0x13')]));});});}; \ No newline at end of file +var _0xbe02=['then','stringify','error','code','Campaign,\x20%s,\x20%s','message','request\x20sent','catch','GetCampaign','Campaign','findAll','options','raw','limit','include','map','model','attributes','info','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x43ff6a,_0x47f558){var _0x2781b6=function(_0x48081f){while(--_0x48081f){_0x43ff6a['push'](_0x43ff6a['shift']());}};_0x2781b6(++_0x47f558);}(_0xbe02,0x146));var _0x2be0=function(_0x5d0f69,_0xf4a45){_0x5d0f69=_0x5d0f69-0x0;var _0x8a6beb=_0xbe02[_0x5d0f69];return _0x8a6beb;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var moment=require(_0x2be0('0x2'));var BPromise=require(_0x2be0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be0('0x4'));var db=require(_0x2be0('0x5'))['db'];var utils=require(_0x2be0('0x6'));var logger=require(_0x2be0('0x7'))(_0x2be0('0x8'));var config=require(_0x2be0('0x9'));var jayson=require(_0x2be0('0xa'));var client=jayson[_0x2be0('0xb')][_0x2be0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e872c,_0x4ca22f,_0x176f12){return new BPromise(function(_0xdfef68,_0x1ac0a3){return client[_0x2be0('0xd')](_0x4e872c,_0x176f12)[_0x2be0('0xe')](function(_0x45d9f5){logger['info']('Campaign,\x20%s,\x20%s',_0x4ca22f,'request\x20sent');logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x4ca22f,'request\x20sent',JSON[_0x2be0('0xf')](_0x45d9f5));if(_0x45d9f5[_0x2be0('0x10')]){if(_0x45d9f5['error'][_0x2be0('0x11')]===0x1f4){logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);return _0x1ac0a3(_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);}logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x45d9f5[_0x2be0('0x10')]['message']);return _0xdfef68(_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);}else{logger['info'](_0x2be0('0x12'),_0x4ca22f,_0x2be0('0x14'));_0xdfef68(_0x45d9f5['result'][_0x2be0('0x13')]);}})[_0x2be0('0x15')](function(_0x137ce9){logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x137ce9);_0x1ac0a3(_0x137ce9);});});}exports[_0x2be0('0x16')]=function(_0x48d386){var _0x415894=this;return new Promise(function(_0x3f8dba,_0x35da90){return db[_0x2be0('0x17')][_0x2be0('0x18')]({'raw':_0x48d386[_0x2be0('0x19')]?_0x48d386[_0x2be0('0x19')][_0x2be0('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d386[_0x2be0('0x19')]?_0x48d386[_0x2be0('0x19')]['where']||null:null,'attributes':_0x48d386['options']?_0x48d386[_0x2be0('0x19')]['attributes']||null:null,'limit':_0x48d386['options']?_0x48d386[_0x2be0('0x19')][_0x2be0('0x1b')]||null:null,'include':_0x48d386[_0x2be0('0x19')]?_0x48d386[_0x2be0('0x19')][_0x2be0('0x1c')]?_[_0x2be0('0x1d')](_0x48d386[_0x2be0('0x19')][_0x2be0('0x1c')],function(_0x494fb4){return{'model':db[_0x494fb4[_0x2be0('0x1e')]],'as':_0x494fb4['as'],'attributes':_0x494fb4['attributes'],'include':_0x494fb4['include']?_[_0x2be0('0x1d')](_0x494fb4[_0x2be0('0x1c')],function(_0x166aa1){return{'model':db[_0x166aa1[_0x2be0('0x1e')]],'as':_0x166aa1['as'],'attributes':_0x166aa1[_0x2be0('0x1f')],'include':_0x166aa1[_0x2be0('0x1c')]?_[_0x2be0('0x1d')](_0x166aa1['include'],function(_0x1c24be){return{'model':db[_0x1c24be[_0x2be0('0x1e')]],'as':_0x1c24be['as'],'attributes':_0x1c24be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fd3eb){logger[_0x2be0('0x20')]('GetCampaign',_0x48d386);logger[_0x2be0('0x21')](_0x2be0('0x16'),_0x48d386,JSON[_0x2be0('0xf')](_0x1fd3eb));_0x3f8dba(_0x1fd3eb);})[_0x2be0('0x15')](function(_0x3b97c0){logger[_0x2be0('0x10')](_0x2be0('0x16'),_0x3b97c0['message'],_0x48d386);_0x35da90(_0x415894[_0x2be0('0x10')](0x1f4,_0x3b97c0['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2f1861b..bd863ed 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 _0x3738=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','update','delete','destroy','/:id/lists','removeBlackLists','exports','util','path','connect-timeout','express','Router'];(function(_0x46f0f5,_0x200c55){var _0x2cef6a=function(_0x5d3dea){while(--_0x5d3dea){_0x46f0f5['push'](_0x46f0f5['shift']());}};_0x2cef6a(++_0x200c55);}(_0x3738,0x1e5));var _0x8373=function(_0x1646cf,_0x124e18){_0x1646cf=_0x1646cf-0x0;var _0x9a2ca1=_0x3738[_0x1646cf];return _0x9a2ca1;};'use strict';var multer=require('multer');var util=require(_0x8373('0x0'));var path=require(_0x8373('0x1'));var timeout=require(_0x8373('0x2'));var express=require(_0x8373('0x3'));var router=express[_0x8373('0x4')]();var fs_extra=require(_0x8373('0x5'));var auth=require(_0x8373('0x6'));var interaction=require(_0x8373('0x7'));var config=require(_0x8373('0x8'));var controller=require(_0x8373('0x9'));router[_0x8373('0xa')]('/',auth[_0x8373('0xb')](),controller['index']);router[_0x8373('0xa')](_0x8373('0xc'),auth[_0x8373('0xb')](),controller[_0x8373('0xd')]);router[_0x8373('0xa')]('/:id/hoppers',auth[_0x8373('0xb')](),controller[_0x8373('0xe')]);router[_0x8373('0xa')](_0x8373('0xf'),auth[_0x8373('0xb')](),controller[_0x8373('0x10')]);router[_0x8373('0xa')](_0x8373('0x11'),auth['isAuthenticated'](),controller[_0x8373('0x12')]);router['get'](_0x8373('0x13'),auth['isAuthenticated'](),controller[_0x8373('0x14')]);router[_0x8373('0xa')]('/:id/lists',auth[_0x8373('0xb')](),controller[_0x8373('0x15')]);router[_0x8373('0xa')](_0x8373('0x16'),auth['isAuthenticated'](),controller[_0x8373('0x17')]);router[_0x8373('0x18')]('/',auth[_0x8373('0xb')](),controller['create']);router[_0x8373('0x18')](_0x8373('0x19'),auth[_0x8373('0xb')](),controller[_0x8373('0x1a')]);router[_0x8373('0x18')]('/:id/lists',auth[_0x8373('0xb')](),controller[_0x8373('0x1b')]);router[_0x8373('0x18')](_0x8373('0x16'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x8373('0x1c')]('/:id',auth[_0x8373('0xb')](),controller[_0x8373('0x1d')]);router[_0x8373('0x1e')](_0x8373('0xc'),auth['isAuthenticated'](),controller[_0x8373('0x1f')]);router[_0x8373('0x1e')](_0x8373('0x20'),auth[_0x8373('0xb')](),controller['removeLists']);router['delete'](_0x8373('0x16'),auth['isAuthenticated'](),controller[_0x8373('0x21')]);module[_0x8373('0x22')]=router; \ No newline at end of file +var _0xb708=['index','/:id','show','get','getHoppers','/:id/hopper_histories','getHopperFinals','getHopperBlacks','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','destroy','delete','/:id/lists','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated'];(function(_0x52000f,_0x5f5df7){var _0x326981=function(_0x226579){while(--_0x226579){_0x52000f['push'](_0x52000f['shift']());}};_0x326981(++_0x5f5df7);}(_0xb708,0xe7));var _0x8b70=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xb708[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require(_0x8b70('0x0'));var util=require('util');var path=require(_0x8b70('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b70('0x2'));var router=express[_0x8b70('0x3')]();var fs_extra=require(_0x8b70('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b70('0x5'));var config=require(_0x8b70('0x6'));var controller=require(_0x8b70('0x7'));router['get']('/',auth[_0x8b70('0x8')](),controller[_0x8b70('0x9')]);router['get'](_0x8b70('0xa'),auth[_0x8b70('0x8')](),controller[_0x8b70('0xb')]);router[_0x8b70('0xc')]('/:id/hoppers',auth[_0x8b70('0x8')](),controller[_0x8b70('0xd')]);router['get'](_0x8b70('0xe'),auth[_0x8b70('0x8')](),controller['getHopperHistories']);router[_0x8b70('0xc')]('/:id/hopper_finals',auth[_0x8b70('0x8')](),controller[_0x8b70('0xf')]);router[_0x8b70('0xc')]('/:id/hopper_black',auth[_0x8b70('0x8')](),controller[_0x8b70('0x10')]);router['get']('/:id/lists',auth[_0x8b70('0x8')](),controller['getLists']);router[_0x8b70('0xc')](_0x8b70('0x11'),auth['isAuthenticated'](),controller[_0x8b70('0x12')]);router[_0x8b70('0x13')]('/',auth[_0x8b70('0x8')](),controller['create']);router['post'](_0x8b70('0x14'),auth['isAuthenticated'](),controller[_0x8b70('0x15')]);router[_0x8b70('0x13')]('/:id/lists',auth[_0x8b70('0x8')](),controller[_0x8b70('0x16')]);router[_0x8b70('0x13')](_0x8b70('0x11'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x8b70('0x17')](_0x8b70('0xa'),auth[_0x8b70('0x8')](),controller['update']);router['delete'](_0x8b70('0xa'),auth[_0x8b70('0x8')](),controller[_0x8b70('0x18')]);router[_0x8b70('0x19')](_0x8b70('0x1a'),auth[_0x8b70('0x8')](),controller[_0x8b70('0x1b')]);router[_0x8b70('0x19')](_0x8b70('0x11'),auth[_0x8b70('0x8')](),controller[_0x8b70('0x1c')]);module[_0x8b70('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 173081e..a26faa7 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 _0xcba9=['getDataValue','key','sequelize','exports','TEXT','STRING'];(function(_0x35c6df,_0x53ddc5){var _0x4ceda3=function(_0x33b932){while(--_0x33b932){_0x35c6df['push'](_0x35c6df['shift']());}};_0x4ceda3(++_0x53ddc5);}(_0xcba9,0x6e));var _0x9cba=function(_0x1ad0b1,_0x1fb76e){_0x1ad0b1=_0x1ad0b1-0x0;var _0x32811c=_0xcba9[_0x1ad0b1];return _0x32811c;};'use strict';var Sequelize=require(_0x9cba('0x0'));module[_0x9cba('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9cba('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9cba('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9cba('0x4')](_0x9cba('0x5'));}}}; \ No newline at end of file +var _0x08d6=['sequelize','exports','STRING','TEXT','key'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x08d6,0x154));var _0x608d=function(_0x1a069c,_0x49521a){_0x1a069c=_0x1a069c-0x0;var _0x4475d9=_0x08d6[_0x1a069c];return _0x4475d9;};'use strict';var Sequelize=require(_0x608d('0x0'));module[_0x608d('0x1')]={'key':{'type':Sequelize[_0x608d('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x608d('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x608d('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x608d('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2d7760f..4460f62 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 _0x3c01=['find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','CannedAnswer','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','count','include','findAll','rows','catch','show','params','includeAll','body'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0x3c01,0x6b));var _0x13c0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3c01[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x13c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x13c0('0x1'));var rp=require(_0x13c0('0x2'));var moment=require('moment');var BPromise=require(_0x13c0('0x3'));var Mustache=require(_0x13c0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x13c0('0x5'));var csv=require(_0x13c0('0x6'));var ejs=require(_0x13c0('0x7'));var fs=require('fs');var fs_extra=require(_0x13c0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13c0('0x9'));var jsforce=require(_0x13c0('0xa'));var deskjs=require(_0x13c0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x13c0('0xc'));var authService=require(_0x13c0('0xd'));var qs=require(_0x13c0('0xe'));var as=require(_0x13c0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13c0('0x10'))(_0x13c0('0x11'));var utils=require(_0x13c0('0x12'));var config=require(_0x13c0('0x13'));var licenseUtil=require(_0x13c0('0x14'));var db=require(_0x13c0('0x15'))['db'];function respondWithStatusCode(_0x43781a,_0x52b13b){_0x52b13b=_0x52b13b||0xcc;return function(_0x211769){if(_0x211769){return _0x43781a[_0x13c0('0x16')](_0x52b13b);}return _0x43781a[_0x13c0('0x17')](_0x52b13b)[_0x13c0('0x18')]();};}function respondWithResult(_0x1f5df5,_0x5c8336){_0x5c8336=_0x5c8336||0xc8;return function(_0x3560bd){if(_0x3560bd){return _0x1f5df5['status'](_0x5c8336)[_0x13c0('0x19')](_0x3560bd);}};}function respondWithFilteredResult(_0xbde249,_0x469247){return function(_0x1054d3){if(_0x1054d3){var _0x1ec921=typeof _0x469247[_0x13c0('0x1a')]==='undefined'&&typeof _0x469247['limit']===_0x13c0('0x1b');var _0x3ff027=_0x1054d3['count'];var _0x47d422=_0x1ec921?0x0:_0x469247[_0x13c0('0x1a')];var _0x484b46=_0x1ec921?_0x1054d3['count']:_0x469247[_0x13c0('0x1a')]+_0x469247[_0x13c0('0x1c')];var _0x1f8584;if(_0x484b46>=_0x3ff027){_0x484b46=_0x3ff027;_0x1f8584=0xc8;}else{_0x1f8584=0xce;}_0xbde249[_0x13c0('0x17')](_0x1f8584);return _0xbde249[_0x13c0('0x1d')](_0x13c0('0x1e'),_0x47d422+'-'+_0x484b46+'/'+_0x3ff027)[_0x13c0('0x19')](_0x1054d3);}return null;};}function patchUpdates(_0x14bfdc){return function(_0x37d5b7){try{jsonpatch[_0x13c0('0x1f')](_0x37d5b7,_0x14bfdc,!![]);}catch(_0x5bb32a){return BPromise[_0x13c0('0x20')](_0x5bb32a);}return _0x37d5b7[_0x13c0('0x21')]();};}function saveUpdates(_0x54b056,_0x4d1b41){return function(_0x154191){if(_0x154191){return _0x154191[_0x13c0('0x22')](_0x54b056)[_0x13c0('0x23')](function(_0x47f482){return _0x47f482;});}return null;};}function removeEntity(_0xa649cd,_0x5dfb7a){return function(_0x52c378){if(_0x52c378){return _0x52c378[_0x13c0('0x24')]()[_0x13c0('0x23')](function(){var _0x3c25ff=_0x52c378[_0x13c0('0x25')]({'plain':!![]});var _0x212ff4='CannedAnswers';return db[_0x13c0('0x26')][_0x13c0('0x24')]({'where':{'type':_0x212ff4,'resourceId':_0x3c25ff['id']}})['then'](function(){return _0x52c378;});})[_0x13c0('0x23')](function(){_0xa649cd[_0x13c0('0x17')](0xcc)[_0x13c0('0x18')]();});}};}function handleEntityNotFound(_0x299ec0,_0x2420dc){return function(_0x18434d){if(!_0x18434d){_0x299ec0[_0x13c0('0x16')](0x194);}return _0x18434d;};}function handleError(_0x26b2ee,_0xb1ea6c){_0xb1ea6c=_0xb1ea6c||0x1f4;return function(_0x153e08){logger[_0x13c0('0x27')](_0x153e08[_0x13c0('0x28')]);if(_0x153e08[_0x13c0('0x29')]){delete _0x153e08[_0x13c0('0x29')];}_0x26b2ee[_0x13c0('0x17')](_0xb1ea6c)[_0x13c0('0x2a')](_0x153e08);};}exports['index']=function(_0x1413b3,_0x2c0f34){var _0x38736e={},_0x5c4199={},_0x545aa6={'count':0x0,'rows':[]};var _0x5ce55c=_[_0x13c0('0x2b')](db[_0x13c0('0x2c')]['rawAttributes'],function(_0x235042){return{'name':_0x235042['fieldName'],'type':_0x235042['type']['key']};});_0x5c4199[_0x13c0('0x2d')]=_[_0x13c0('0x2b')](_0x5ce55c,_0x13c0('0x29'));_0x5c4199['query']=_[_0x13c0('0x2e')](_0x1413b3[_0x13c0('0x2f')]);_0x5c4199[_0x13c0('0x30')]=_[_0x13c0('0x31')](_0x5c4199[_0x13c0('0x2d')],_0x5c4199['query']);_0x38736e[_0x13c0('0x32')]=_[_0x13c0('0x31')](_0x5c4199[_0x13c0('0x2d')],qs['fields'](_0x1413b3[_0x13c0('0x2f')][_0x13c0('0x33')]));_0x38736e[_0x13c0('0x32')]=_0x38736e[_0x13c0('0x32')][_0x13c0('0x34')]?_0x38736e[_0x13c0('0x32')]:_0x5c4199[_0x13c0('0x2d')];if(!_0x1413b3[_0x13c0('0x2f')][_0x13c0('0x35')](_0x13c0('0x36'))){_0x38736e[_0x13c0('0x1c')]=qs[_0x13c0('0x1c')](_0x1413b3['query'][_0x13c0('0x1c')]);_0x38736e[_0x13c0('0x1a')]=qs[_0x13c0('0x1a')](_0x1413b3[_0x13c0('0x2f')][_0x13c0('0x1a')]);}_0x38736e[_0x13c0('0x37')]=qs[_0x13c0('0x38')](_0x1413b3[_0x13c0('0x2f')]['sort']);_0x38736e['where']=qs[_0x13c0('0x30')](_[_0x13c0('0x39')](_0x1413b3[_0x13c0('0x2f')],_0x5c4199[_0x13c0('0x30')]),_0x5ce55c);if(_0x1413b3['query'][_0x13c0('0x3a')]){_0x38736e['where']=_['merge'](_0x38736e['where'],{'$or':[{'key':{'$like':'%'+_0x1413b3['query'][_0x13c0('0x3a')]+'%'}},{'value':{'$like':'%'+_0x1413b3[_0x13c0('0x2f')][_0x13c0('0x3a')]+'%'}}]});}_0x38736e=_[_0x13c0('0x3b')]({},_0x38736e,_0x1413b3[_0x13c0('0x3c')]);var _0x506488={'where':_0x38736e[_0x13c0('0x3d')]};return db['CannedAnswer']['count'](_0x506488)[_0x13c0('0x23')](function(_0x3d75d4){_0x545aa6[_0x13c0('0x3e')]=_0x3d75d4;if(_0x1413b3[_0x13c0('0x2f')]['includeAll']){_0x38736e[_0x13c0('0x3f')]=[{'all':!![]}];}return db[_0x13c0('0x2c')][_0x13c0('0x40')](_0x38736e);})[_0x13c0('0x23')](function(_0x2f0de8){_0x545aa6[_0x13c0('0x41')]=_0x2f0de8;return _0x545aa6;})[_0x13c0('0x23')](respondWithFilteredResult(_0x2c0f34,_0x38736e))[_0x13c0('0x42')](handleError(_0x2c0f34,null));};exports[_0x13c0('0x43')]=function(_0x33cdb5,_0x76d5e2){var _0x2e155e={'raw':!![],'where':{'id':_0x33cdb5[_0x13c0('0x44')]['id']}},_0x421ecf={};_0x421ecf[_0x13c0('0x2d')]=_[_0x13c0('0x2e')](db[_0x13c0('0x2c')]['rawAttributes']);_0x421ecf[_0x13c0('0x2f')]=_[_0x13c0('0x2e')](_0x33cdb5['query']);_0x421ecf[_0x13c0('0x30')]=_[_0x13c0('0x31')](_0x421ecf[_0x13c0('0x2d')],_0x421ecf['query']);_0x2e155e[_0x13c0('0x32')]=_[_0x13c0('0x31')](_0x421ecf['model'],qs[_0x13c0('0x33')](_0x33cdb5[_0x13c0('0x2f')][_0x13c0('0x33')]));_0x2e155e[_0x13c0('0x32')]=_0x2e155e[_0x13c0('0x32')][_0x13c0('0x34')]?_0x2e155e[_0x13c0('0x32')]:_0x421ecf[_0x13c0('0x2d')];if(_0x33cdb5[_0x13c0('0x2f')][_0x13c0('0x45')]){_0x2e155e[_0x13c0('0x3f')]=[{'all':!![]}];}_0x2e155e=_['merge']({},_0x2e155e,_0x33cdb5[_0x13c0('0x3c')]);return db['CannedAnswer']['find'](_0x2e155e)[_0x13c0('0x23')](handleEntityNotFound(_0x76d5e2,null))[_0x13c0('0x23')](respondWithResult(_0x76d5e2,null))[_0x13c0('0x42')](handleError(_0x76d5e2,null));};exports[_0x13c0('0x22')]=function(_0x13da48,_0x5bea04){if(_0x13da48[_0x13c0('0x46')]['id']){delete _0x13da48[_0x13c0('0x46')]['id'];}return db[_0x13c0('0x2c')][_0x13c0('0x47')]({'where':{'id':_0x13da48[_0x13c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bea04,null))[_0x13c0('0x23')](saveUpdates(_0x13da48[_0x13c0('0x46')],null))[_0x13c0('0x23')](respondWithResult(_0x5bea04,null))[_0x13c0('0x42')](handleError(_0x5bea04,null));};exports['destroy']=function(_0x4bd76a,_0x3cc600){return db[_0x13c0('0x2c')][_0x13c0('0x47')]({'where':{'id':_0x4bd76a[_0x13c0('0x44')]['id']}})[_0x13c0('0x23')](handleEntityNotFound(_0x3cc600,null))[_0x13c0('0x23')](removeEntity(_0x3cc600,null))[_0x13c0('0x42')](handleError(_0x3cc600,null));};exports[_0x13c0('0x48')]=function(_0x407ef4,_0x315130){var _0x23948d={'key':_0x407ef4['body'][_0x13c0('0x49')]};if(_0x407ef4[_0x13c0('0x46')][_0x13c0('0x4a')]){_0x23948d[_0x13c0('0x4a')]=_0x407ef4['body']['MailAccountId'];}else if(_0x407ef4['body'][_0x13c0('0x4b')]){_0x23948d[_0x13c0('0x4b')]=_0x407ef4[_0x13c0('0x46')][_0x13c0('0x4b')];}else if(_0x407ef4['body'][_0x13c0('0x4c')]){_0x23948d['OpenchannelAccountId']=_0x407ef4['body'][_0x13c0('0x4c')];}else if(_0x407ef4[_0x13c0('0x46')][_0x13c0('0x4d')]){_0x23948d[_0x13c0('0x4d')]=_0x407ef4['body'][_0x13c0('0x4d')];}return db[_0x13c0('0x2c')][_0x13c0('0x47')]({'where':_0x23948d})[_0x13c0('0x23')](function(_0x1acddc){if(_0x1acddc){throw new db[(_0x13c0('0x4e'))][(_0x13c0('0x4f'))](_0x13c0('0x50'));}return db['CannedAnswer'][_0x13c0('0x48')](_0x407ef4[_0x13c0('0x46')]);})[_0x13c0('0x23')](function(_0x1cf6ad){var _0x594780=_0x407ef4[_0x13c0('0x51')][_0x13c0('0x25')]({'plain':!![]});if(!_0x594780)throw new Error(_0x13c0('0x52'));if(_0x594780[_0x13c0('0x53')]==='user'){var _0x3ad9c2=_0x1cf6ad[_0x13c0('0x25')]({'plain':!![]});return db[_0x13c0('0x54')][_0x13c0('0x47')]({'where':{'name':_0x13c0('0x55'),'userProfileId':_0x594780[_0x13c0('0x56')]},'raw':!![]})[_0x13c0('0x23')](function(_0xc723c9){if(_0xc723c9&&_0xc723c9[_0x13c0('0x57')]===0x0){return db[_0x13c0('0x26')]['create']({'name':_0x3ad9c2['name'],'resourceId':_0x3ad9c2['id'],'type':_0xc723c9[_0x13c0('0x29')],'sectionId':_0xc723c9['id']},{})[_0x13c0('0x23')](function(){return _0x1cf6ad;});}else{return _0x1cf6ad;}})[_0x13c0('0x42')](function(_0x3a251b){logger[_0x13c0('0x27')](_0x13c0('0x58'),_0x3a251b);throw _0x3a251b;});}return _0x1cf6ad;})[_0x13c0('0x23')](respondWithResult(_0x315130,0xc9))[_0x13c0('0x42')](handleError(_0x315130,null));}; \ No newline at end of file +var _0xd523=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','name','eml-format','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','get','error','stack','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','params','keys','filters','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user'];(function(_0x5c6c2e,_0x86e980){var _0xd262ac=function(_0x2469a1){while(--_0x2469a1){_0x5c6c2e['push'](_0x5c6c2e['shift']());}};_0xd262ac(++_0x86e980);}(_0xd523,0xa0));var _0x3d52=function(_0xfb093c,_0x399b44){_0xfb093c=_0xfb093c-0x0;var _0x5556c4=_0xd523[_0xfb093c];return _0x5556c4;};'use strict';var emlformat=require(_0x3d52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d52('0x1'));var rp=require(_0x3d52('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3d52('0x3'));var sox=require(_0x3d52('0x4'));var csv=require(_0x3d52('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d52('0x6'));var _=require(_0x3d52('0x7'));var squel=require('squel');var crypto=require(_0x3d52('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3d52('0x9'));var toCsv=require(_0x3d52('0x5'));var querystring=require(_0x3d52('0xa'));var Papa=require(_0x3d52('0xb'));var Redis=require(_0x3d52('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3d52('0xd'));var as=require(_0x3d52('0xe'));var hardwareService=require(_0x3d52('0xf'));var logger=require(_0x3d52('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3d52('0x11'));var licenseUtil=require(_0x3d52('0x12'));var db=require(_0x3d52('0x13'))['db'];function respondWithStatusCode(_0x15fcb0,_0x8e4834){_0x8e4834=_0x8e4834||0xcc;return function(_0x581d16){if(_0x581d16){return _0x15fcb0[_0x3d52('0x14')](_0x8e4834);}return _0x15fcb0['status'](_0x8e4834)[_0x3d52('0x15')]();};}function respondWithResult(_0xd7cd15,_0x3704b0){_0x3704b0=_0x3704b0||0xc8;return function(_0x51bda2){if(_0x51bda2){return _0xd7cd15['status'](_0x3704b0)[_0x3d52('0x16')](_0x51bda2);}};}function respondWithFilteredResult(_0x3d3930,_0x660a62){return function(_0x3c8c1a){if(_0x3c8c1a){var _0x5bf803=typeof _0x660a62[_0x3d52('0x17')]===_0x3d52('0x18')&&typeof _0x660a62[_0x3d52('0x19')]==='undefined';var _0x25c281=_0x3c8c1a[_0x3d52('0x1a')];var _0x90ded2=_0x5bf803?0x0:_0x660a62[_0x3d52('0x17')];var _0x37fc49=_0x5bf803?_0x3c8c1a['count']:_0x660a62[_0x3d52('0x17')]+_0x660a62[_0x3d52('0x19')];var _0x261947;if(_0x37fc49>=_0x25c281){_0x37fc49=_0x25c281;_0x261947=0xc8;}else{_0x261947=0xce;}_0x3d3930[_0x3d52('0x1b')](_0x261947);return _0x3d3930['set'](_0x3d52('0x1c'),_0x90ded2+'-'+_0x37fc49+'/'+_0x25c281)[_0x3d52('0x16')](_0x3c8c1a);}return null;};}function patchUpdates(_0xce9b97){return function(_0x5d1e74){try{jsonpatch[_0x3d52('0x1d')](_0x5d1e74,_0xce9b97,!![]);}catch(_0x5d07cc){return BPromise['reject'](_0x5d07cc);}return _0x5d1e74[_0x3d52('0x1e')]();};}function saveUpdates(_0x5f22b3,_0x19c005){return function(_0x5b00b2){if(_0x5b00b2){return _0x5b00b2[_0x3d52('0x1f')](_0x5f22b3)[_0x3d52('0x20')](function(_0x415574){return _0x415574;});}return null;};}function removeEntity(_0x13a714,_0x26cc88){return function(_0xde81da){if(_0xde81da){return _0xde81da[_0x3d52('0x21')]()[_0x3d52('0x20')](function(){var _0x3bdc8e=_0xde81da[_0x3d52('0x22')]({'plain':!![]});var _0x132c87='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x132c87,'resourceId':_0x3bdc8e['id']}})[_0x3d52('0x20')](function(){return _0xde81da;});})['then'](function(){_0x13a714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x606100,_0x1141df){return function(_0x5a900a){if(!_0x5a900a){_0x606100[_0x3d52('0x14')](0x194);}return _0x5a900a;};}function handleError(_0x44d1ac,_0x587881){_0x587881=_0x587881||0x1f4;return function(_0x452658){logger[_0x3d52('0x23')](_0x452658[_0x3d52('0x24')]);if(_0x452658['name']){delete _0x452658['name'];}_0x44d1ac[_0x3d52('0x1b')](_0x587881)['send'](_0x452658);};}exports[_0x3d52('0x25')]=function(_0x30827b,_0x3b4b1f){var _0x10dc9e={},_0x5e4b1d={},_0x160d31={'count':0x0,'rows':[]};var _0x55f23f=_[_0x3d52('0x26')](db[_0x3d52('0x27')][_0x3d52('0x28')],function(_0x4bf25c){return{'name':_0x4bf25c[_0x3d52('0x29')],'type':_0x4bf25c[_0x3d52('0x2a')][_0x3d52('0x2b')]};});_0x5e4b1d[_0x3d52('0x2c')]=_[_0x3d52('0x26')](_0x55f23f,'name');_0x5e4b1d['query']=_['keys'](_0x30827b[_0x3d52('0x2d')]);_0x5e4b1d['filters']=_[_0x3d52('0x2e')](_0x5e4b1d[_0x3d52('0x2c')],_0x5e4b1d[_0x3d52('0x2d')]);_0x10dc9e[_0x3d52('0x2f')]=_[_0x3d52('0x2e')](_0x5e4b1d[_0x3d52('0x2c')],qs[_0x3d52('0x30')](_0x30827b[_0x3d52('0x2d')][_0x3d52('0x30')]));_0x10dc9e[_0x3d52('0x2f')]=_0x10dc9e[_0x3d52('0x2f')][_0x3d52('0x31')]?_0x10dc9e[_0x3d52('0x2f')]:_0x5e4b1d[_0x3d52('0x2c')];if(!_0x30827b[_0x3d52('0x2d')]['hasOwnProperty'](_0x3d52('0x32'))){_0x10dc9e[_0x3d52('0x19')]=qs['limit'](_0x30827b[_0x3d52('0x2d')]['limit']);_0x10dc9e[_0x3d52('0x17')]=qs['offset'](_0x30827b[_0x3d52('0x2d')][_0x3d52('0x17')]);}_0x10dc9e[_0x3d52('0x33')]=qs[_0x3d52('0x34')](_0x30827b[_0x3d52('0x2d')][_0x3d52('0x34')]);_0x10dc9e[_0x3d52('0x35')]=qs['filters'](_[_0x3d52('0x36')](_0x30827b[_0x3d52('0x2d')],_0x5e4b1d['filters']),_0x55f23f);if(_0x30827b[_0x3d52('0x2d')]['filter']){_0x10dc9e[_0x3d52('0x35')]=_[_0x3d52('0x37')](_0x10dc9e[_0x3d52('0x35')],{'$or':[{'key':{'$like':'%'+_0x30827b[_0x3d52('0x2d')]['filter']+'%'}},{'value':{'$like':'%'+_0x30827b[_0x3d52('0x2d')][_0x3d52('0x38')]+'%'}}]});}_0x10dc9e=_[_0x3d52('0x37')]({},_0x10dc9e,_0x30827b['options']);var _0x39293e={'where':_0x10dc9e[_0x3d52('0x35')]};return db[_0x3d52('0x27')][_0x3d52('0x1a')](_0x39293e)[_0x3d52('0x20')](function(_0x5f29ec){_0x160d31[_0x3d52('0x1a')]=_0x5f29ec;if(_0x30827b['query'][_0x3d52('0x39')]){_0x10dc9e[_0x3d52('0x3a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3d52('0x3b')](_0x10dc9e);})[_0x3d52('0x20')](function(_0x36638d){_0x160d31['rows']=_0x36638d;return _0x160d31;})[_0x3d52('0x20')](respondWithFilteredResult(_0x3b4b1f,_0x10dc9e))[_0x3d52('0x3c')](handleError(_0x3b4b1f,null));};exports['show']=function(_0x286ffd,_0x201f05){var _0x4b6c5d={'raw':!![],'where':{'id':_0x286ffd[_0x3d52('0x3d')]['id']}},_0x16a53f={};_0x16a53f[_0x3d52('0x2c')]=_[_0x3d52('0x3e')](db[_0x3d52('0x27')][_0x3d52('0x28')]);_0x16a53f['query']=_[_0x3d52('0x3e')](_0x286ffd['query']);_0x16a53f[_0x3d52('0x3f')]=_[_0x3d52('0x2e')](_0x16a53f[_0x3d52('0x2c')],_0x16a53f[_0x3d52('0x2d')]);_0x4b6c5d[_0x3d52('0x2f')]=_[_0x3d52('0x2e')](_0x16a53f[_0x3d52('0x2c')],qs['fields'](_0x286ffd['query']['fields']));_0x4b6c5d[_0x3d52('0x2f')]=_0x4b6c5d[_0x3d52('0x2f')]['length']?_0x4b6c5d[_0x3d52('0x2f')]:_0x16a53f[_0x3d52('0x2c')];if(_0x286ffd[_0x3d52('0x2d')][_0x3d52('0x39')]){_0x4b6c5d[_0x3d52('0x3a')]=[{'all':!![]}];}_0x4b6c5d=_[_0x3d52('0x37')]({},_0x4b6c5d,_0x286ffd[_0x3d52('0x40')]);return db[_0x3d52('0x27')][_0x3d52('0x41')](_0x4b6c5d)[_0x3d52('0x20')](handleEntityNotFound(_0x201f05,null))[_0x3d52('0x20')](respondWithResult(_0x201f05,null))[_0x3d52('0x3c')](handleError(_0x201f05,null));};exports[_0x3d52('0x1f')]=function(_0x51983e,_0x3bf800){if(_0x51983e['body']['id']){delete _0x51983e[_0x3d52('0x42')]['id'];}return db[_0x3d52('0x27')][_0x3d52('0x41')]({'where':{'id':_0x51983e[_0x3d52('0x3d')]['id']}})[_0x3d52('0x20')](handleEntityNotFound(_0x3bf800,null))[_0x3d52('0x20')](saveUpdates(_0x51983e[_0x3d52('0x42')],null))[_0x3d52('0x20')](respondWithResult(_0x3bf800,null))[_0x3d52('0x3c')](handleError(_0x3bf800,null));};exports['destroy']=function(_0x1d0c91,_0x3bf95f){return db['CannedAnswer'][_0x3d52('0x41')]({'where':{'id':_0x1d0c91['params']['id']}})[_0x3d52('0x20')](handleEntityNotFound(_0x3bf95f,null))[_0x3d52('0x20')](removeEntity(_0x3bf95f,null))[_0x3d52('0x3c')](handleError(_0x3bf95f,null));};exports[_0x3d52('0x43')]=function(_0xd97d18,_0x4f9a90){var _0x53f0f2={'key':_0xd97d18[_0x3d52('0x42')][_0x3d52('0x2b')]};if(_0xd97d18[_0x3d52('0x42')][_0x3d52('0x44')]){_0x53f0f2[_0x3d52('0x44')]=_0xd97d18[_0x3d52('0x42')][_0x3d52('0x44')];}else if(_0xd97d18['body'][_0x3d52('0x45')]){_0x53f0f2[_0x3d52('0x45')]=_0xd97d18['body'][_0x3d52('0x45')];}else if(_0xd97d18[_0x3d52('0x42')][_0x3d52('0x46')]){_0x53f0f2['OpenchannelAccountId']=_0xd97d18[_0x3d52('0x42')]['OpenchannelAccountId'];}else if(_0xd97d18[_0x3d52('0x42')][_0x3d52('0x47')]){_0x53f0f2[_0x3d52('0x47')]=_0xd97d18[_0x3d52('0x42')][_0x3d52('0x47')];}return db[_0x3d52('0x27')][_0x3d52('0x41')]({'where':_0x53f0f2})[_0x3d52('0x20')](function(_0x142d5b){if(_0x142d5b){throw new db['Sequelize']['ValidationError'](_0x3d52('0x48'));}return db[_0x3d52('0x27')][_0x3d52('0x43')](_0xd97d18[_0x3d52('0x42')]);})['then'](function(_0x1951a1){var _0x2dd3fc=_0xd97d18[_0x3d52('0x49')][_0x3d52('0x22')]({'plain':!![]});if(!_0x2dd3fc)throw new Error(_0x3d52('0x4a'));if(_0x2dd3fc['role']===_0x3d52('0x49')){var _0x656e2a=_0x1951a1[_0x3d52('0x22')]({'plain':!![]});return db[_0x3d52('0x4b')][_0x3d52('0x41')]({'where':{'name':'CannedAnswers','userProfileId':_0x2dd3fc['userProfileId']},'raw':!![]})[_0x3d52('0x20')](function(_0x17964f){if(_0x17964f&&_0x17964f['autoAssociation']===0x0){return db[_0x3d52('0x4c')][_0x3d52('0x43')]({'name':_0x656e2a[_0x3d52('0x4d')],'resourceId':_0x656e2a['id'],'type':_0x17964f[_0x3d52('0x4d')],'sectionId':_0x17964f['id']},{})['then'](function(){return _0x1951a1;});}else{return _0x1951a1;}})[_0x3d52('0x3c')](function(_0x3058e9){logger[_0x3d52('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3058e9);throw _0x3058e9;});}return _0x1951a1;})[_0x3d52('0x20')](respondWithResult(_0x4f9a90,0xc9))['catch'](handleError(_0x4f9a90,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f5450a4..74a2372 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 _0x0179=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x4b6b90,_0x239588){var _0xbf7e58=function(_0x4c1ea7){while(--_0x4c1ea7){_0x4b6b90['push'](_0x4b6b90['shift']());}};_0xbf7e58(++_0x239588);}(_0x0179,0x1f1));var _0x9017=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0179[_0x166d93];return _0xba708;};'use strict';var _=require(_0x9017('0x0'));var util=require(_0x9017('0x1'));var logger=require(_0x9017('0x2'))(_0x9017('0x3'));var moment=require(_0x9017('0x4'));var BPromise=require(_0x9017('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9017('0x6'));var attributes=require(_0x9017('0x7'));module[_0x9017('0x8')]=function(_0x33a6eb,_0x1167a6){return _0x33a6eb['define'](_0x9017('0x9'),attributes,{'tableName':_0x9017('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9017('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xce8d=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x195f76,_0xececaf){var _0x1b06dc=function(_0xcd8e7d){while(--_0xcd8e7d){_0x195f76['push'](_0x195f76['shift']());}};_0x1b06dc(++_0xececaf);}(_0xce8d,0x9b));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdce8('0x0'));var logger=require(_0xdce8('0x1'))(_0xdce8('0x2'));var moment=require(_0xdce8('0x3'));var BPromise=require(_0xdce8('0x4'));var rp=require(_0xdce8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdce8('0x6'));var config=require(_0xdce8('0x7'));var attributes=require(_0xdce8('0x8'));module['exports']=function(_0x3f387b,_0x382ffc){return _0x3f387b[_0xdce8('0x9')](_0xdce8('0xa'),attributes,{'tableName':_0xdce8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdce8('0xc'),'collate':_0xdce8('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1ebe1e7..51d8b10 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(_0x3e3426,_0x303c1b){var _0x4c17b4=function(_0x29ccbc){while(--_0x29ccbc){_0x3e3426['push'](_0x3e3426['shift']());}};_0x4c17b4(++_0x303c1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x48999e,_0xa058c5){var _0x557293=function(_0x41ec26){while(--_0x41ec26){_0x48999e['push'](_0x48999e['shift']());}};_0x557293(++_0xa058c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 1a9d2d9..cd57480 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 _0xf840=['isAuthenticated','post','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x21c2da,_0xda7036){var _0x2bad83=function(_0x3921c1){while(--_0x3921c1){_0x21c2da['push'](_0x21c2da['shift']());}};_0x2bad83(++_0xda7036);}(_0xf840,0x16b));var _0x0f84=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0xf840[_0x450076];return _0x2029cc;};'use strict';var multer=require(_0x0f84('0x0'));var util=require(_0x0f84('0x1'));var path=require(_0x0f84('0x2'));var timeout=require(_0x0f84('0x3'));var express=require(_0x0f84('0x4'));var router=express[_0x0f84('0x5')]();var fs_extra=require(_0x0f84('0x6'));var auth=require(_0x0f84('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0f84('0x8'));var controller=require(_0x0f84('0x9'));router[_0x0f84('0xa')]('/',auth[_0x0f84('0xb')](),controller['index']);router[_0x0f84('0xa')]('/:id',auth[_0x0f84('0xb')](),controller['show']);router[_0x0f84('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0f84('0xd'),auth[_0x0f84('0xb')](),controller[_0x0f84('0xe')]);router[_0x0f84('0xf')](_0x0f84('0xd'),auth[_0x0f84('0xb')](),controller[_0x0f84('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3735=['index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x190161,_0x802569){var _0x5868fe=function(_0x429231){while(--_0x429231){_0x190161['push'](_0x190161['shift']());}};_0x5868fe(++_0x802569);}(_0x3735,0x15f));var _0x5373=function(_0x1b81b9,_0x1d314a){_0x1b81b9=_0x1b81b9-0x0;var _0x27a94d=_0x3735[_0x1b81b9];return _0x27a94d;};'use strict';var multer=require(_0x5373('0x0'));var util=require(_0x5373('0x1'));var path=require('path');var timeout=require(_0x5373('0x2'));var express=require(_0x5373('0x3'));var router=express[_0x5373('0x4')]();var fs_extra=require(_0x5373('0x5'));var auth=require(_0x5373('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5373('0x7'));var controller=require('./cannedAnswer.controller');router[_0x5373('0x8')]('/',auth[_0x5373('0x9')](),controller[_0x5373('0xa')]);router[_0x5373('0x8')](_0x5373('0xb'),auth[_0x5373('0x9')](),controller[_0x5373('0xc')]);router[_0x5373('0xd')]('/',auth[_0x5373('0x9')](),controller[_0x5373('0xe')]);router['put'](_0x5373('0xb'),auth[_0x5373('0x9')](),controller[_0x5373('0xf')]);router[_0x5373('0x10')](_0x5373('0xb'),auth[_0x5373('0x9')](),controller[_0x5373('0x11')]);module[_0x5373('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e90e281..b2ea0d2 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 _0xd624=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xd624,0x124));var _0x4d62=function(_0x15e4ee,_0x25383){_0x15e4ee=_0x15e4ee-0x0;var _0x4a0ef0=_0xd624[_0x15e4ee];return _0x4a0ef0;};'use strict';var Sequelize=require(_0x4d62('0x0'));module[_0x4d62('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4d62('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x4d62('0x3')]},'channel':{'type':Sequelize[_0x4d62('0x3')]},'dstchannel':{'type':Sequelize[_0x4d62('0x3')]},'lastapp':{'type':Sequelize[_0x4d62('0x3')]},'lastdata':{'type':Sequelize[_0x4d62('0x3')]},'duration':{'type':Sequelize[_0x4d62('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4d62('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4d62('0x3')]},'userfield':{'type':Sequelize[_0x4d62('0x3')]},'uniqueid':{'type':Sequelize[_0x4d62('0x3')]},'linkedid':{'type':Sequelize[_0x4d62('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4d62('0x3')]},'type':{'type':Sequelize[_0x4d62('0x3')]},'tag':{'type':Sequelize[_0x4d62('0x3')]}}; \ No newline at end of file +var _0x008d=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2eaedf,_0x481885){var _0x4b0bf8=function(_0x1feb83){while(--_0x1feb83){_0x2eaedf['push'](_0x2eaedf['shift']());}};_0x4b0bf8(++_0x481885);}(_0x008d,0x9b));var _0xd008=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x008d[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xd008('0x0'));module[_0xd008('0x1')]={'calldate':{'type':Sequelize[_0xd008('0x2')],'allowNull':![],'defaultValue':_0xd008('0x3')},'clid':{'type':Sequelize[_0xd008('0x4')]},'src':{'type':Sequelize[_0xd008('0x4')]},'dst':{'type':Sequelize[_0xd008('0x4')]},'dcontext':{'type':Sequelize[_0xd008('0x4')]},'channel':{'type':Sequelize[_0xd008('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xd008('0x4')]},'lastdata':{'type':Sequelize[_0xd008('0x4')]},'duration':{'type':Sequelize[_0xd008('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd008('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd008('0x4')]},'amaflags':{'type':Sequelize[_0xd008('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd008('0x4')]},'userfield':{'type':Sequelize[_0xd008('0x4')]},'uniqueid':{'type':Sequelize[_0xd008('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd008('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd008('0x4')]},'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 11469ca..782652f 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 _0x723e=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Cdr','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x44a7ba,_0x105f15){var _0x724580=function(_0x511587){while(--_0x511587){_0x44a7ba['push'](_0x44a7ba['shift']());}};_0x724580(++_0x105f15);}(_0x723e,0x179));var _0xe723=function(_0x4d3d33,_0x450541){_0x4d3d33=_0x4d3d33-0x0;var _0x386f63=_0x723e[_0x4d3d33];return _0x386f63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe723('0x0'));var zipdir=require(_0xe723('0x1'));var jsonpatch=require(_0xe723('0x2'));var rp=require(_0xe723('0x3'));var moment=require(_0xe723('0x4'));var BPromise=require(_0xe723('0x5'));var Mustache=require(_0xe723('0x6'));var util=require(_0xe723('0x7'));var path=require(_0xe723('0x8'));var sox=require(_0xe723('0x9'));var csv=require('to-csv');var ejs=require(_0xe723('0xa'));var fs=require('fs');var fs_extra=require(_0xe723('0xb'));var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0x11'));var querystring=require('querystring');var Papa=require(_0xe723('0x12'));var Redis=require(_0xe723('0x13'));var authService=require(_0xe723('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x15'));var hardwareService=require(_0xe723('0x16'));var logger=require(_0xe723('0x17'))('api');var utils=require(_0xe723('0x18'));var config=require(_0xe723('0x19'));var licenseUtil=require(_0xe723('0x1a'));var db=require(_0xe723('0x1b'))['db'];function respondWithStatusCode(_0x236b69,_0x5c066c){_0x5c066c=_0x5c066c||0xcc;return function(_0x29a1e){if(_0x29a1e){return _0x236b69['sendStatus'](_0x5c066c);}return _0x236b69['status'](_0x5c066c)['end']();};}function respondWithResult(_0x57bc0e,_0x75c12c){_0x75c12c=_0x75c12c||0xc8;return function(_0x30b2ba){if(_0x30b2ba){return _0x57bc0e[_0xe723('0x1c')](_0x75c12c)[_0xe723('0x1d')](_0x30b2ba);}};}function respondWithFilteredResult(_0xf29a39,_0x5aec97){return function(_0x23d0b2){if(_0x23d0b2){var _0xbf5ca3=typeof _0x5aec97[_0xe723('0x1e')]===_0xe723('0x1f')&&typeof _0x5aec97[_0xe723('0x20')]===_0xe723('0x1f');var _0x2cd7ca=_0x23d0b2[_0xe723('0x21')];var _0x17e2c1=_0xbf5ca3?0x0:_0x5aec97[_0xe723('0x1e')];var _0x2057d7=_0xbf5ca3?_0x23d0b2[_0xe723('0x21')]:_0x5aec97[_0xe723('0x1e')]+_0x5aec97[_0xe723('0x20')];var _0x5e8a90;if(_0x2057d7>=_0x2cd7ca){_0x2057d7=_0x2cd7ca;_0x5e8a90=0xc8;}else{_0x5e8a90=0xce;}_0xf29a39['status'](_0x5e8a90);return _0xf29a39[_0xe723('0x22')](_0xe723('0x23'),_0x17e2c1+'-'+_0x2057d7+'/'+_0x2cd7ca)['json'](_0x23d0b2);}return null;};}function patchUpdates(_0x28caca){return function(_0x2762e2){try{jsonpatch['apply'](_0x2762e2,_0x28caca,!![]);}catch(_0x472502){return BPromise['reject'](_0x472502);}return _0x2762e2[_0xe723('0x24')]();};}function saveUpdates(_0x43ccfc,_0x3b82b2){return function(_0x1fe43d){if(_0x1fe43d){return _0x1fe43d[_0xe723('0x25')](_0x43ccfc)[_0xe723('0x26')](function(_0x25f7d2){return _0x25f7d2;});}return null;};}function removeEntity(_0x15196c,_0x1228f2){return function(_0x19bd0c){if(_0x19bd0c){return _0x19bd0c[_0xe723('0x27')]()[_0xe723('0x26')](function(){_0x15196c['status'](0xcc)[_0xe723('0x28')]();});}};}function handleEntityNotFound(_0x59f095,_0xa258f3){return function(_0x3ffa15){if(!_0x3ffa15){_0x59f095[_0xe723('0x29')](0x194);}return _0x3ffa15;};}function handleError(_0xe7e271,_0x1f81ec){_0x1f81ec=_0x1f81ec||0x1f4;return function(_0x598f15){logger[_0xe723('0x2a')](_0x598f15['stack']);if(_0x598f15['name']){delete _0x598f15[_0xe723('0x2b')];}_0xe7e271['status'](_0x1f81ec)[_0xe723('0x2c')](_0x598f15);};}exports[_0xe723('0x2d')]=function(_0x335c66,_0x4d55cc){var _0x1edbb2={},_0x45e162={},_0x48a97a={'count':0x0,'rows':[]};var _0x3c8c56=_['map'](db['Cdr'][_0xe723('0x2e')],function(_0x2c2240){return{'name':_0x2c2240[_0xe723('0x2f')],'type':_0x2c2240[_0xe723('0x30')]['key']};});_0x45e162['model']=_[_0xe723('0x31')](_0x3c8c56,'name');_0x45e162[_0xe723('0x32')]=_[_0xe723('0x33')](_0x335c66[_0xe723('0x32')]);_0x45e162[_0xe723('0x34')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],_0x45e162[_0xe723('0x32')]);_0x1edbb2[_0xe723('0x37')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],qs[_0xe723('0x38')](_0x335c66[_0xe723('0x32')][_0xe723('0x38')]));_0x1edbb2[_0xe723('0x37')]=_0x1edbb2['attributes'][_0xe723('0x39')]?_0x1edbb2['attributes']:_0x45e162[_0xe723('0x36')];if(!_0x335c66[_0xe723('0x32')]['hasOwnProperty']('nolimit')){_0x1edbb2[_0xe723('0x20')]=qs[_0xe723('0x20')](_0x335c66[_0xe723('0x32')][_0xe723('0x20')]);_0x1edbb2[_0xe723('0x1e')]=qs[_0xe723('0x1e')](_0x335c66['query'][_0xe723('0x1e')]);}_0x1edbb2[_0xe723('0x3a')]=qs[_0xe723('0x3b')](_0x335c66[_0xe723('0x32')][_0xe723('0x3b')]);_0x1edbb2[_0xe723('0x3c')]=qs[_0xe723('0x34')](_[_0xe723('0x3d')](_0x335c66[_0xe723('0x32')],_0x45e162[_0xe723('0x34')]),_0x3c8c56);if(_0x335c66[_0xe723('0x32')][_0xe723('0x3e')]){_0x1edbb2[_0xe723('0x3c')]=_[_0xe723('0x3f')](_0x1edbb2[_0xe723('0x3c')],{'$or':_[_0xe723('0x31')](_0x3c8c56,function(_0x5c5027){if(_0x5c5027[_0xe723('0x30')]!==_0xe723('0x40')){var _0x68eda5={};_0x68eda5[_0x5c5027[_0xe723('0x2b')]]={'$like':'%'+_0x335c66['query']['filter']+'%'};return _0x68eda5;}})});}_0x1edbb2=_[_0xe723('0x3f')]({},_0x1edbb2,_0x335c66[_0xe723('0x41')]);var _0xc0c2c7={'where':_0x1edbb2[_0xe723('0x3c')]};return db['Cdr']['count'](_0xc0c2c7)[_0xe723('0x26')](function(_0x2f1618){_0x48a97a[_0xe723('0x21')]=_0x2f1618;if(_0x335c66[_0xe723('0x32')][_0xe723('0x42')]){_0x1edbb2[_0xe723('0x43')]=[{'all':!![]}];}return db[_0xe723('0x44')][_0xe723('0x45')](_0x1edbb2);})[_0xe723('0x26')](function(_0x5b0c89){_0x48a97a['rows']=_0x5b0c89;return _0x48a97a;})[_0xe723('0x26')](respondWithFilteredResult(_0x4d55cc,_0x1edbb2))['catch'](handleError(_0x4d55cc,null));};exports['show']=function(_0x18f4a1,_0x55530b){var _0x36272={'raw':!![],'where':{'id':_0x18f4a1[_0xe723('0x46')]['id']}},_0x42bd2f={};_0x42bd2f[_0xe723('0x36')]=_[_0xe723('0x33')](db[_0xe723('0x44')][_0xe723('0x2e')]);_0x42bd2f['query']=_['keys'](_0x18f4a1[_0xe723('0x32')]);_0x42bd2f['filters']=_[_0xe723('0x35')](_0x42bd2f['model'],_0x42bd2f[_0xe723('0x32')]);_0x36272[_0xe723('0x37')]=_[_0xe723('0x35')](_0x42bd2f[_0xe723('0x36')],qs[_0xe723('0x38')](_0x18f4a1[_0xe723('0x32')][_0xe723('0x38')]));_0x36272[_0xe723('0x37')]=_0x36272[_0xe723('0x37')]['length']?_0x36272['attributes']:_0x42bd2f[_0xe723('0x36')];if(_0x18f4a1[_0xe723('0x32')][_0xe723('0x42')]){_0x36272['include']=[{'all':!![]}];}_0x36272=_['merge']({},_0x36272,_0x18f4a1['options']);return db[_0xe723('0x44')][_0xe723('0x47')](_0x36272)[_0xe723('0x26')](handleEntityNotFound(_0x55530b,null))['then'](respondWithResult(_0x55530b,null))[_0xe723('0x48')](handleError(_0x55530b,null));};exports[_0xe723('0x49')]=function(_0x1cb2b2,_0x38bd1a){return db[_0xe723('0x44')]['create'](_0x1cb2b2[_0xe723('0x4a')],{})['then'](respondWithResult(_0x38bd1a,0xc9))[_0xe723('0x48')](handleError(_0x38bd1a,null));};exports['update']=function(_0x52f42e,_0x1590fe){if(_0x52f42e[_0xe723('0x4a')]['id']){delete _0x52f42e[_0xe723('0x4a')]['id'];}return db['Cdr'][_0xe723('0x47')]({'where':{'id':_0x52f42e['params']['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x1590fe,null))[_0xe723('0x26')](saveUpdates(_0x52f42e[_0xe723('0x4a')],null))[_0xe723('0x26')](respondWithResult(_0x1590fe,null))[_0xe723('0x48')](handleError(_0x1590fe,null));};exports[_0xe723('0x27')]=function(_0x41e1c4,_0x16cb50){return db[_0xe723('0x44')]['find']({'where':{'id':_0x41e1c4[_0xe723('0x46')]['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x16cb50,null))['then'](removeEntity(_0x16cb50,null))[_0xe723('0x48')](handleError(_0x16cb50,null));};exports[_0xe723('0x4b')]=function(_0x56e92a,_0x126ca5){return db['Cdr']['describe']()[_0xe723('0x26')](respondWithResult(_0x126ca5,null))[_0xe723('0x48')](handleError(_0x126ca5,null));}; \ No newline at end of file +var _0x8ef6=['includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','count'];(function(_0x597d1e,_0x339556){var _0x45e34d=function(_0x4133ff){while(--_0x4133ff){_0x597d1e['push'](_0x597d1e['shift']());}};_0x45e34d(++_0x339556);}(_0x8ef6,0xf2));var _0x68ef=function(_0x22b203,_0x468393){_0x22b203=_0x22b203-0x0;var _0x43d162=_0x8ef6[_0x22b203];return _0x43d162;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x13280b,_0x5e4dbe){return function(_0x178460){if(!_0x178460){_0x13280b['sendStatus'](0x194);}return _0x178460;};}function handleError(_0x599243,_0x55d8b0){_0x55d8b0=_0x55d8b0||0x1f4;return function(_0x1a7ce1){logger[_0x68ef('0x29')](_0x1a7ce1[_0x68ef('0x2a')]);if(_0x1a7ce1[_0x68ef('0x2b')]){delete _0x1a7ce1['name'];}_0x599243['status'](_0x55d8b0)[_0x68ef('0x2c')](_0x1a7ce1);};}exports[_0x68ef('0x2d')]=function(_0x7bf96,_0x263b30){var _0x22ef25={},_0x201884={},_0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x2e')][_0x68ef('0x2f')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x30')]['key']};});_0x201884[_0x68ef('0x31')]=_[_0x68ef('0x32')](_0x4579cb,'name');_0x201884['query']=_[_0x68ef('0x33')](_0x7bf96[_0x68ef('0x34')]);_0x201884['filters']=_[_0x68ef('0x35')](_0x201884[_0x68ef('0x31')],_0x201884[_0x68ef('0x34')]);_0x22ef25[_0x68ef('0x36')]=_['intersection'](_0x201884[_0x68ef('0x31')],qs[_0x68ef('0x37')](_0x7bf96['query'][_0x68ef('0x37')]));_0x22ef25['attributes']=_0x22ef25[_0x68ef('0x36')][_0x68ef('0x38')]?_0x22ef25['attributes']:_0x201884[_0x68ef('0x31')];if(!_0x7bf96['query'][_0x68ef('0x39')]('nolimit')){_0x22ef25[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x7bf96[_0x68ef('0x34')]['limit']);_0x22ef25[_0x68ef('0x1f')]=qs['offset'](_0x7bf96[_0x68ef('0x34')]['offset']);}_0x22ef25[_0x68ef('0x3a')]=qs[_0x68ef('0x3b')](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3b')]);_0x22ef25[_0x68ef('0x3c')]=qs[_0x68ef('0x3d')](_['pick'](_0x7bf96[_0x68ef('0x34')],_0x201884[_0x68ef('0x3d')]),_0x4579cb);if(_0x7bf96[_0x68ef('0x34')]['filter']){_0x22ef25[_0x68ef('0x3c')]=_[_0x68ef('0x3e')](_0x22ef25[_0x68ef('0x3c')],{'$or':_['map'](_0x4579cb,function(_0x49f260){if(_0x49f260[_0x68ef('0x30')]!==_0x68ef('0x3f')){var _0x36213a={};_0x36213a[_0x49f260[_0x68ef('0x2b')]]={'$like':'%'+_0x7bf96[_0x68ef('0x34')][_0x68ef('0x40')]+'%'};return _0x36213a;}})});}_0x22ef25=_[_0x68ef('0x3e')]({},_0x22ef25,_0x7bf96['options']);var _0xaf7df1={'where':_0x22ef25[_0x68ef('0x3c')]};return db[_0x68ef('0x2e')][_0x68ef('0x41')](_0xaf7df1)['then'](function(_0x3cb156){_0x26288a[_0x68ef('0x41')]=_0x3cb156;if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x42')]){_0x22ef25[_0x68ef('0x43')]=[{'all':!![]}];}return db[_0x68ef('0x2e')]['findAll'](_0x22ef25);})[_0x68ef('0x27')](function(_0x3f7699){_0x26288a[_0x68ef('0x44')]=_0x3f7699;return _0x26288a;})[_0x68ef('0x27')](respondWithFilteredResult(_0x263b30,_0x22ef25))[_0x68ef('0x45')](handleError(_0x263b30,null));};exports[_0x68ef('0x46')]=function(_0x13ee90,_0xd6a0b5){var _0xc687ab={'raw':!![],'where':{'id':_0x13ee90[_0x68ef('0x47')]['id']}},_0x531096={};_0x531096[_0x68ef('0x31')]=_[_0x68ef('0x33')](db[_0x68ef('0x2e')][_0x68ef('0x2f')]);_0x531096[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x13ee90['query']);_0x531096[_0x68ef('0x3d')]=_['intersection'](_0x531096[_0x68ef('0x31')],_0x531096[_0x68ef('0x34')]);_0xc687ab[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x531096['model'],qs[_0x68ef('0x37')](_0x13ee90['query'][_0x68ef('0x37')]));_0xc687ab['attributes']=_0xc687ab[_0x68ef('0x36')][_0x68ef('0x38')]?_0xc687ab[_0x68ef('0x36')]:_0x531096['model'];if(_0x13ee90['query'][_0x68ef('0x42')]){_0xc687ab[_0x68ef('0x43')]=[{'all':!![]}];}_0xc687ab=_['merge']({},_0xc687ab,_0x13ee90['options']);return db['Cdr'][_0x68ef('0x48')](_0xc687ab)[_0x68ef('0x27')](handleEntityNotFound(_0xd6a0b5,null))[_0x68ef('0x27')](respondWithResult(_0xd6a0b5,null))[_0x68ef('0x45')](handleError(_0xd6a0b5,null));};exports[_0x68ef('0x49')]=function(_0x583566,_0x55f385){return db[_0x68ef('0x2e')][_0x68ef('0x49')](_0x583566[_0x68ef('0x4a')],{})[_0x68ef('0x27')](respondWithResult(_0x55f385,0xc9))['catch'](handleError(_0x55f385,null));};exports[_0x68ef('0x4b')]=function(_0x474e5a,_0x1c9b6f){if(_0x474e5a[_0x68ef('0x4a')]['id']){delete _0x474e5a['body']['id'];}return db['Cdr'][_0x68ef('0x48')]({'where':{'id':_0x474e5a[_0x68ef('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c9b6f,null))[_0x68ef('0x27')](saveUpdates(_0x474e5a[_0x68ef('0x4a')],null))[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,null))[_0x68ef('0x45')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x28')]=function(_0x4f0f77,_0x35d6bd){return db[_0x68ef('0x2e')][_0x68ef('0x48')]({'where':{'id':_0x4f0f77['params']['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x35d6bd,null))[_0x68ef('0x27')](removeEntity(_0x35d6bd,null))[_0x68ef('0x45')](handleError(_0x35d6bd,null));};exports['describe']=function(_0x7dce90,_0x59e8ee){return db['Cdr'][_0x68ef('0x4c')]()['then'](respondWithResult(_0x59e8ee,null))[_0x68ef('0x45')](handleError(_0x59e8ee,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a877116..ed2c22f 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(_0x58c40c,_0x35f0a0){var _0x2ffe0e=function(_0x5c1d22){while(--_0x5c1d22){_0x58c40c['push'](_0x58c40c['shift']());}};_0x2ffe0e(++_0x35f0a0);}(_0x7a54,0x106));var _0x47a5=function(_0x2c133f,_0x3ed415){_0x2c133f=_0x2c133f-0x0;var _0x42f65d=_0x7a54[_0x2c133f];return _0x42f65d;};'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(_0x1c42db,_0xda1099){var _0x6428ba=function(_0x152981){while(--_0x152981){_0x1c42db['push'](_0x1c42db['shift']());}};_0x6428ba(++_0xda1099);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 00c7fa7..541b100 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 _0xf392=['then','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x519380,_0x7f196){var _0x60ba2c=function(_0x5b2110){while(--_0x5b2110){_0x519380['push'](_0x519380['shift']());}};_0x60ba2c(++_0x7f196);}(_0xf392,0x1d1));var _0x2f39=function(_0x7e402a,_0x3198cf){_0x7e402a=_0x7e402a-0x0;var _0x26f4a5=_0xf392[_0x7e402a];return _0x26f4a5;};'use strict';var _=require(_0x2f39('0x0'));var util=require(_0x2f39('0x1'));var moment=require(_0x2f39('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f39('0x3'));var logger=require(_0x2f39('0x4'))(_0x2f39('0x5'));var config=require(_0x2f39('0x6'));var jayson=require(_0x2f39('0x7'));var client=jayson[_0x2f39('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45356e,_0x37953c,_0x1f170f){return new BPromise(function(_0x227967,_0x53425a){return client[_0x2f39('0x9')](_0x45356e,_0x1f170f)[_0x2f39('0xa')](function(_0x51bc50){logger[_0x2f39('0xb')](_0x2f39('0xc'),_0x37953c,'request\x20sent');logger[_0x2f39('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x37953c,_0x2f39('0xe'),JSON['stringify'](_0x51bc50));if(_0x51bc50[_0x2f39('0xf')]){if(_0x51bc50[_0x2f39('0xf')][_0x2f39('0x10')]===0x1f4){logger[_0x2f39('0xf')](_0x2f39('0xc'),_0x37953c,_0x51bc50[_0x2f39('0xf')][_0x2f39('0x11')]);return _0x53425a(_0x51bc50[_0x2f39('0xf')]['message']);}logger[_0x2f39('0xf')](_0x2f39('0xc'),_0x37953c,_0x51bc50['error']['message']);return _0x227967(_0x51bc50[_0x2f39('0xf')][_0x2f39('0x11')]);}else{logger[_0x2f39('0xb')](_0x2f39('0xc'),_0x37953c,'request\x20sent');_0x227967(_0x51bc50['result'][_0x2f39('0x11')]);}})[_0x2f39('0x12')](function(_0x303f6d){logger[_0x2f39('0xf')](_0x2f39('0xc'),_0x37953c,_0x303f6d);_0x53425a(_0x303f6d);});});} \ No newline at end of file +var _0x558b=['info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x558b,0x17b));var _0xb558=function(_0x1194f5,_0x4dc01b){_0x1194f5=_0x1194f5-0x0;var _0x3ed851=_0x558b[_0x1194f5];return _0x3ed851;};'use strict';var _=require(_0xb558('0x0'));var util=require(_0xb558('0x1'));var moment=require(_0xb558('0x2'));var BPromise=require('bluebird');var rs=require(_0xb558('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb558('0x4'))['db'];var utils=require(_0xb558('0x5'));var logger=require(_0xb558('0x6'))(_0xb558('0x7'));var config=require('../../config/environment');var jayson=require(_0xb558('0x8'));var client=jayson[_0xb558('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e8cd,_0x2b8035,_0x722b3a){return new BPromise(function(_0x2c5ac6,_0x919728){return client[_0xb558('0xa')](_0x46e8cd,_0x722b3a)[_0xb558('0xb')](function(_0x4214e8){logger[_0xb558('0xc')]('Cdr,\x20%s,\x20%s',_0x2b8035,_0xb558('0xd'));logger[_0xb558('0xe')](_0xb558('0xf'),_0x2b8035,_0xb558('0xd'),JSON[_0xb558('0x10')](_0x4214e8));if(_0x4214e8[_0xb558('0x11')]){if(_0x4214e8[_0xb558('0x11')][_0xb558('0x12')]===0x1f4){logger[_0xb558('0x11')](_0xb558('0x13'),_0x2b8035,_0x4214e8[_0xb558('0x11')][_0xb558('0x14')]);return _0x919728(_0x4214e8[_0xb558('0x11')][_0xb558('0x14')]);}logger[_0xb558('0x11')](_0xb558('0x13'),_0x2b8035,_0x4214e8[_0xb558('0x11')][_0xb558('0x14')]);return _0x2c5ac6(_0x4214e8[_0xb558('0x11')][_0xb558('0x14')]);}else{logger[_0xb558('0xc')](_0xb558('0x13'),_0x2b8035,_0xb558('0xd'));_0x2c5ac6(_0x4214e8[_0xb558('0x15')][_0xb558('0x14')]);}})[_0xb558('0x16')](function(_0x3ad399){logger['error'](_0xb558('0x13'),_0x2b8035,_0x3ad399);_0x919728(_0x3ad399);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 1dee0ed..44bbb5d 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1016ad,_0x4e75b8){var _0x1419d4=function(_0x545d71){while(--_0x545d71){_0x1016ad['push'](_0x1016ad['shift']());}};_0x1419d4(++_0x4e75b8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x72cd0f,_0x18f4e6){var _0x3f5d2c=function(_0x162491){while(--_0x162491){_0x72cd0f['push'](_0x72cd0f['shift']());}};_0x3f5d2c(++_0x18f4e6);}(_0xb10b,0x12a));var _0xbb10=function(_0xa9c870,_0x111b20){_0xa9c870=_0xa9c870-0x0;var _0x2d13a3=_0xb10b[_0xa9c870];return _0x2d13a3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 abbcd8c..6a71051 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 _0xeb2c=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x57122c,_0x357cbd){var _0x17bb8e=function(_0x25585b){while(--_0x25585b){_0x57122c['push'](_0x57122c['shift']());}};_0x17bb8e(++_0x357cbd);}(_0xeb2c,0xb2));var _0xceb2=function(_0x175d1d,_0x568006){_0x175d1d=_0x175d1d-0x0;var _0x33324a=_0xeb2c[_0x175d1d];return _0x33324a;};'use strict';var Sequelize=require('sequelize');module[_0xceb2('0x0')]={'priority':{'type':Sequelize[_0xceb2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xceb2('0x2')],'allowNull':![],'defaultValue':_0xceb2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xceb2('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xceb2('0x4')}}; \ No newline at end of file +var _0xea41=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xea41,0x14f));var _0x1ea4=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xea41[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x1ea4('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1ea4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1ea4('0x2')],'allowNull':![],'defaultValue':_0x1ea4('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1ea4('0x2')]},'interval':{'type':Sequelize[_0x1ea4('0x2')],'defaultValue':_0x1ea4('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7269675..fd486f0 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 _0x5d70=['then','destroy','error','stack','name','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','include','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x5d70,0x8d));var _0x05d7=function(_0x31708e,_0x4fbc6c){_0x31708e=_0x31708e-0x0;var _0x548e0a=_0x5d70[_0x31708e];return _0x548e0a;};'use strict';var emlformat=require(_0x05d7('0x0'));var rimraf=require(_0x05d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05d7('0x2'));var rp=require(_0x05d7('0x3'));var moment=require(_0x05d7('0x4'));var BPromise=require(_0x05d7('0x5'));var Mustache=require(_0x05d7('0x6'));var util=require(_0x05d7('0x7'));var path=require('path');var sox=require(_0x05d7('0x8'));var csv=require(_0x05d7('0x9'));var ejs=require(_0x05d7('0xa'));var fs=require('fs');var fs_extra=require(_0x05d7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x05d7('0xc'));var jsforce=require(_0x05d7('0xd'));var deskjs=require(_0x05d7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x05d7('0xf'));var Redis=require(_0x05d7('0x10'));var authService=require(_0x05d7('0x11'));var qs=require(_0x05d7('0x12'));var as=require(_0x05d7('0x13'));var hardwareService=require(_0x05d7('0x14'));var logger=require(_0x05d7('0x15'))(_0x05d7('0x16'));var utils=require(_0x05d7('0x17'));var config=require(_0x05d7('0x18'));var licenseUtil=require(_0x05d7('0x19'));var db=require(_0x05d7('0x1a'))['db'];function respondWithStatusCode(_0x3d4825,_0x2e2bab){_0x2e2bab=_0x2e2bab||0xcc;return function(_0x1f0ccb){if(_0x1f0ccb){return _0x3d4825[_0x05d7('0x1b')](_0x2e2bab);}return _0x3d4825[_0x05d7('0x1c')](_0x2e2bab)[_0x05d7('0x1d')]();};}function respondWithResult(_0x171746,_0x34cd5b){_0x34cd5b=_0x34cd5b||0xc8;return function(_0x231f62){if(_0x231f62){return _0x171746[_0x05d7('0x1c')](_0x34cd5b)[_0x05d7('0x1e')](_0x231f62);}};}function respondWithFilteredResult(_0x586306,_0x38b3c7){return function(_0x5ba163){if(_0x5ba163){var _0x42c95f=typeof _0x38b3c7[_0x05d7('0x1f')]==='undefined'&&typeof _0x38b3c7['limit']==='undefined';var _0x55b9d3=_0x5ba163['count'];var _0x3e364b=_0x42c95f?0x0:_0x38b3c7[_0x05d7('0x1f')];var _0x292d48=_0x42c95f?_0x5ba163[_0x05d7('0x20')]:_0x38b3c7[_0x05d7('0x1f')]+_0x38b3c7[_0x05d7('0x21')];var _0xad9c4;if(_0x292d48>=_0x55b9d3){_0x292d48=_0x55b9d3;_0xad9c4=0xc8;}else{_0xad9c4=0xce;}_0x586306[_0x05d7('0x1c')](_0xad9c4);return _0x586306[_0x05d7('0x22')](_0x05d7('0x23'),_0x3e364b+'-'+_0x292d48+'/'+_0x55b9d3)[_0x05d7('0x1e')](_0x5ba163);}return null;};}function patchUpdates(_0x31199b){return function(_0x4e182f){try{jsonpatch[_0x05d7('0x24')](_0x4e182f,_0x31199b,!![]);}catch(_0x47d3ca){return BPromise['reject'](_0x47d3ca);}return _0x4e182f[_0x05d7('0x25')]();};}function saveUpdates(_0x356fe7,_0xd1e51b){return function(_0x10fde1){if(_0x10fde1){return _0x10fde1[_0x05d7('0x26')](_0x356fe7)[_0x05d7('0x27')](function(_0x34aaad){return _0x34aaad;});}return null;};}function removeEntity(_0x1d0bee,_0x31081f){return function(_0x81dab7){if(_0x81dab7){return _0x81dab7[_0x05d7('0x28')]()[_0x05d7('0x27')](function(){_0x1d0bee[_0x05d7('0x1c')](0xcc)[_0x05d7('0x1d')]();});}};}function handleEntityNotFound(_0x32e802,_0x2083d5){return function(_0x4e33bb){if(!_0x4e33bb){_0x32e802['sendStatus'](0x194);}return _0x4e33bb;};}function handleError(_0x5d3bad,_0xefd156){_0xefd156=_0xefd156||0x1f4;return function(_0x2b2e93){logger[_0x05d7('0x29')](_0x2b2e93[_0x05d7('0x2a')]);if(_0x2b2e93[_0x05d7('0x2b')]){delete _0x2b2e93[_0x05d7('0x2b')];}_0x5d3bad[_0x05d7('0x1c')](_0xefd156)['send'](_0x2b2e93);};}exports[_0x05d7('0x2c')]=function(_0x355d2b,_0x24c125){var _0x232238={'raw':!![],'where':{'id':_0x355d2b[_0x05d7('0x2d')]['id']}},_0x3cf995={};_0x3cf995[_0x05d7('0x2e')]=_[_0x05d7('0x2f')](db[_0x05d7('0x30')]['rawAttributes']);_0x3cf995[_0x05d7('0x31')]=_[_0x05d7('0x2f')](_0x355d2b[_0x05d7('0x31')]);_0x3cf995[_0x05d7('0x32')]=_[_0x05d7('0x33')](_0x3cf995[_0x05d7('0x2e')],_0x3cf995['query']);_0x232238[_0x05d7('0x34')]=_[_0x05d7('0x33')](_0x3cf995[_0x05d7('0x2e')],qs['fields'](_0x355d2b[_0x05d7('0x31')][_0x05d7('0x35')]));_0x232238[_0x05d7('0x34')]=_0x232238['attributes']['length']?_0x232238[_0x05d7('0x34')]:_0x3cf995[_0x05d7('0x2e')];if(_0x355d2b[_0x05d7('0x31')][_0x05d7('0x36')]){_0x232238[_0x05d7('0x37')]=[{'all':!![]}];}_0x232238=_['merge']({},_0x232238,_0x355d2b[_0x05d7('0x38')]);return db['ChatApplication'][_0x05d7('0x39')](_0x232238)[_0x05d7('0x27')](handleEntityNotFound(_0x24c125,null))[_0x05d7('0x27')](respondWithResult(_0x24c125,null))[_0x05d7('0x3a')](handleError(_0x24c125,null));};exports[_0x05d7('0x26')]=function(_0x821d1f,_0x57667e){if(_0x821d1f['body']['id']){delete _0x821d1f[_0x05d7('0x3b')]['id'];}return db['ChatApplication'][_0x05d7('0x39')]({'where':{'id':_0x821d1f[_0x05d7('0x2d')]['id']}})[_0x05d7('0x27')](handleEntityNotFound(_0x57667e,null))[_0x05d7('0x27')](saveUpdates(_0x821d1f[_0x05d7('0x3b')],null))[_0x05d7('0x27')](respondWithResult(_0x57667e,null))[_0x05d7('0x3a')](handleError(_0x57667e,null));};exports['destroy']=function(_0x256f0c,_0x5259fa){return db[_0x05d7('0x30')][_0x05d7('0x39')]({'where':{'id':_0x256f0c[_0x05d7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5259fa,null))[_0x05d7('0x27')](removeEntity(_0x5259fa,null))[_0x05d7('0x3a')](handleError(_0x5259fa,null));}; \ No newline at end of file +var _0x1120=['offset','undefined','limit','count','status','set','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatApplication','query','filters','intersection','attributes','length','includeAll','merge','catch','body','find','params','eml-format','rimraf','zip-dir','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','sendStatus','json'];(function(_0xd7e034,_0x2e5f38){var _0x5acdb7=function(_0x5c00f2){while(--_0x5c00f2){_0xd7e034['push'](_0xd7e034['shift']());}};_0x5acdb7(++_0x2e5f38);}(_0x1120,0x140));var _0x0112=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x1120[_0x34bf97];return _0x292719;};'use strict';var emlformat=require(_0x0112('0x0'));var rimraf=require(_0x0112('0x1'));var zipdir=require(_0x0112('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0112('0x3'));var util=require(_0x0112('0x4'));var path=require(_0x0112('0x5'));var sox=require(_0x0112('0x6'));var csv=require(_0x0112('0x7'));var ejs=require(_0x0112('0x8'));var fs=require('fs');var fs_extra=require(_0x0112('0x9'));var _=require(_0x0112('0xa'));var squel=require(_0x0112('0xb'));var crypto=require(_0x0112('0xc'));var jsforce=require(_0x0112('0xd'));var deskjs=require(_0x0112('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0112('0xf'));var Papa=require(_0x0112('0x10'));var Redis=require(_0x0112('0x11'));var authService=require(_0x0112('0x12'));var qs=require(_0x0112('0x13'));var as=require(_0x0112('0x14'));var hardwareService=require(_0x0112('0x15'));var logger=require('../../config/logger')(_0x0112('0x16'));var utils=require(_0x0112('0x17'));var config=require(_0x0112('0x18'));var licenseUtil=require(_0x0112('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x95d441,_0x394926){_0x394926=_0x394926||0xcc;return function(_0xb58a0b){if(_0xb58a0b){return _0x95d441[_0x0112('0x1a')](_0x394926);}return _0x95d441['status'](_0x394926)['end']();};}function respondWithResult(_0x44d646,_0x4d591e){_0x4d591e=_0x4d591e||0xc8;return function(_0x19dd06){if(_0x19dd06){return _0x44d646['status'](_0x4d591e)[_0x0112('0x1b')](_0x19dd06);}};}function respondWithFilteredResult(_0x1e273d,_0xe2ec19){return function(_0x1a2549){if(_0x1a2549){var _0x54269a=typeof _0xe2ec19[_0x0112('0x1c')]===_0x0112('0x1d')&&typeof _0xe2ec19[_0x0112('0x1e')]==='undefined';var _0x58aa63=_0x1a2549[_0x0112('0x1f')];var _0x58f0ed=_0x54269a?0x0:_0xe2ec19[_0x0112('0x1c')];var _0x4e34c1=_0x54269a?_0x1a2549[_0x0112('0x1f')]:_0xe2ec19[_0x0112('0x1c')]+_0xe2ec19['limit'];var _0x590c3e;if(_0x4e34c1>=_0x58aa63){_0x4e34c1=_0x58aa63;_0x590c3e=0xc8;}else{_0x590c3e=0xce;}_0x1e273d[_0x0112('0x20')](_0x590c3e);return _0x1e273d[_0x0112('0x21')]('Content-Range',_0x58f0ed+'-'+_0x4e34c1+'/'+_0x58aa63)[_0x0112('0x1b')](_0x1a2549);}return null;};}function patchUpdates(_0x548681){return function(_0x51ac2d){try{jsonpatch['apply'](_0x51ac2d,_0x548681,!![]);}catch(_0x2ce17a){return BPromise[_0x0112('0x22')](_0x2ce17a);}return _0x51ac2d[_0x0112('0x23')]();};}function saveUpdates(_0x53f19c,_0x3dd2aa){return function(_0xf92cb4){if(_0xf92cb4){return _0xf92cb4[_0x0112('0x24')](_0x53f19c)[_0x0112('0x25')](function(_0x57bd39){return _0x57bd39;});}return null;};}function removeEntity(_0x33cb56,_0x408bb8){return function(_0x2d99c1){if(_0x2d99c1){return _0x2d99c1[_0x0112('0x26')]()['then'](function(){_0x33cb56[_0x0112('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58ea13,_0x27252e){return function(_0x4a583e){if(!_0x4a583e){_0x58ea13[_0x0112('0x1a')](0x194);}return _0x4a583e;};}function handleError(_0x5bce7b,_0x32035e){_0x32035e=_0x32035e||0x1f4;return function(_0x58e5){logger[_0x0112('0x27')](_0x58e5[_0x0112('0x28')]);if(_0x58e5[_0x0112('0x29')]){delete _0x58e5[_0x0112('0x29')];}_0x5bce7b[_0x0112('0x20')](_0x32035e)[_0x0112('0x2a')](_0x58e5);};}exports[_0x0112('0x2b')]=function(_0x29c9d0,_0x36669c){var _0x52aabd={'raw':!![],'where':{'id':_0x29c9d0['params']['id']}},_0x6d44bb={};_0x6d44bb[_0x0112('0x2c')]=_[_0x0112('0x2d')](db[_0x0112('0x2e')]['rawAttributes']);_0x6d44bb[_0x0112('0x2f')]=_['keys'](_0x29c9d0[_0x0112('0x2f')]);_0x6d44bb[_0x0112('0x30')]=_[_0x0112('0x31')](_0x6d44bb['model'],_0x6d44bb['query']);_0x52aabd['attributes']=_[_0x0112('0x31')](_0x6d44bb['model'],qs['fields'](_0x29c9d0['query']['fields']));_0x52aabd['attributes']=_0x52aabd[_0x0112('0x32')][_0x0112('0x33')]?_0x52aabd[_0x0112('0x32')]:_0x6d44bb['model'];if(_0x29c9d0[_0x0112('0x2f')][_0x0112('0x34')]){_0x52aabd['include']=[{'all':!![]}];}_0x52aabd=_[_0x0112('0x35')]({},_0x52aabd,_0x29c9d0['options']);return db[_0x0112('0x2e')]['find'](_0x52aabd)[_0x0112('0x25')](handleEntityNotFound(_0x36669c,null))[_0x0112('0x25')](respondWithResult(_0x36669c,null))[_0x0112('0x36')](handleError(_0x36669c,null));};exports['update']=function(_0x4d5ac4,_0x5a0e37){if(_0x4d5ac4['body']['id']){delete _0x4d5ac4[_0x0112('0x37')]['id'];}return db[_0x0112('0x2e')][_0x0112('0x38')]({'where':{'id':_0x4d5ac4[_0x0112('0x39')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x5a0e37,null))[_0x0112('0x25')](saveUpdates(_0x4d5ac4[_0x0112('0x37')],null))[_0x0112('0x25')](respondWithResult(_0x5a0e37,null))[_0x0112('0x36')](handleError(_0x5a0e37,null));};exports[_0x0112('0x26')]=function(_0xf2573c,_0x18bbfc){return db[_0x0112('0x2e')][_0x0112('0x38')]({'where':{'id':_0xf2573c['params']['id']}})['then'](handleEntityNotFound(_0x18bbfc,null))['then'](removeEntity(_0x18bbfc,null))['catch'](handleError(_0x18bbfc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a576d3c..0a924c0 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 _0x8ebc=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x588648,_0xc4b577){var _0x225bef=function(_0x453895){while(--_0x453895){_0x588648['push'](_0x588648['shift']());}};_0x225bef(++_0xc4b577);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x5e8935,_0x3d1365){_0x5e8935=_0x5e8935-0x0;var _0x417bc8=_0x8ebc[_0x5e8935];return _0x417bc8;};'use strict';var _=require(_0xc8eb('0x0'));var util=require('util');var logger=require(_0xc8eb('0x1'))(_0xc8eb('0x2'));var moment=require('moment');var BPromise=require(_0xc8eb('0x3'));var rp=require(_0xc8eb('0x4'));var fs=require('fs');var path=require(_0xc8eb('0x5'));var rimraf=require(_0xc8eb('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8eb('0x7'));module['exports']=function(_0x34aeaf,_0x3061ec){return _0x34aeaf['define'](_0xc8eb('0x8'),attributes,{'tableName':_0xc8eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8eb('0xa'),'collate':_0xc8eb('0xb')});}; \ No newline at end of file +var _0x4e92=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x4c4e44,_0x22d77c){var _0x57ed07=function(_0x58cc2c){while(--_0x58cc2c){_0x4c4e44['push'](_0x4c4e44['shift']());}};_0x57ed07(++_0x22d77c);}(_0x4e92,0xed));var _0x24e9=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0x4e92[_0x361422];return _0x2daa43;};'use strict';var _=require(_0x24e9('0x0'));var util=require(_0x24e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x24e9('0x2'));var BPromise=require(_0x24e9('0x3'));var rp=require(_0x24e9('0x4'));var fs=require('fs');var path=require(_0x24e9('0x5'));var rimraf=require('rimraf');var config=require(_0x24e9('0x6'));var attributes=require(_0x24e9('0x7'));module['exports']=function(_0x588c95,_0x39ac4b){return _0x588c95[_0x24e9('0x8')](_0x24e9('0x9'),attributes,{'tableName':_0x24e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x24e9('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 12f1ac3..04c9bfe 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 _0xe624=['request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe624,0xf5));var _0x4e62=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0xe624[_0x1f6691];return _0xf786b6;};'use strict';var _=require(_0x4e62('0x0'));var util=require('util');var moment=require(_0x4e62('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e62('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e62('0x3'));var logger=require(_0x4e62('0x4'))(_0x4e62('0x5'));var config=require('../../config/environment');var jayson=require(_0x4e62('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x130819,_0x1caecd,_0x55710d){return new BPromise(function(_0x1f1da5,_0xd15e7f){return client[_0x4e62('0x7')](_0x130819,_0x55710d)[_0x4e62('0x8')](function(_0x1f0723){logger[_0x4e62('0x9')]('ChatApplication,\x20%s,\x20%s',_0x1caecd,'request\x20sent');logger['debug'](_0x4e62('0xa'),_0x1caecd,_0x4e62('0xb'),JSON[_0x4e62('0xc')](_0x1f0723));if(_0x1f0723[_0x4e62('0xd')]){if(_0x1f0723[_0x4e62('0xd')]['code']===0x1f4){logger[_0x4e62('0xd')](_0x4e62('0xe'),_0x1caecd,_0x1f0723[_0x4e62('0xd')]['message']);return _0xd15e7f(_0x1f0723['error'][_0x4e62('0xf')]);}logger['error'](_0x4e62('0xe'),_0x1caecd,_0x1f0723[_0x4e62('0xd')][_0x4e62('0xf')]);return _0x1f1da5(_0x1f0723[_0x4e62('0xd')]['message']);}else{logger['info'](_0x4e62('0xe'),_0x1caecd,_0x4e62('0xb'));_0x1f1da5(_0x1f0723[_0x4e62('0x10')]['message']);}})[_0x4e62('0x11')](function(_0x157ef7){logger['error'](_0x4e62('0xe'),_0x1caecd,_0x157ef7);_0xd15e7f(_0x157ef7);});});} \ No newline at end of file +var _0x3fa4=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird'];(function(_0x4f0db5,_0x18e951){var _0x18b226=function(_0x43072b){while(--_0x43072b){_0x4f0db5['push'](_0x4f0db5['shift']());}};_0x18b226(++_0x18e951);}(_0x3fa4,0x164));var _0x43fa=function(_0x12d5c1,_0x2e6cc7){_0x12d5c1=_0x12d5c1-0x0;var _0x17b70e=_0x3fa4[_0x12d5c1];return _0x17b70e;};'use strict';var _=require(_0x43fa('0x0'));var util=require(_0x43fa('0x1'));var moment=require(_0x43fa('0x2'));var BPromise=require(_0x43fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43fa('0x4'))['db'];var utils=require(_0x43fa('0x5'));var logger=require(_0x43fa('0x6'))('rpc');var config=require(_0x43fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43fa('0x8')][_0x43fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f93c7,_0x1b65df,_0x25a62d){return new BPromise(function(_0x5e51b5,_0x24b12b){return client['request'](_0x2f93c7,_0x25a62d)[_0x43fa('0xa')](function(_0x2de891){logger['info']('ChatApplication,\x20%s,\x20%s',_0x1b65df,'request\x20sent');logger[_0x43fa('0xb')](_0x43fa('0xc'),_0x1b65df,_0x43fa('0xd'),JSON[_0x43fa('0xe')](_0x2de891));if(_0x2de891['error']){if(_0x2de891['error']['code']===0x1f4){logger[_0x43fa('0xf')](_0x43fa('0x10'),_0x1b65df,_0x2de891[_0x43fa('0xf')]['message']);return _0x24b12b(_0x2de891['error'][_0x43fa('0x11')]);}logger['error'](_0x43fa('0x10'),_0x1b65df,_0x2de891[_0x43fa('0xf')]['message']);return _0x5e51b5(_0x2de891[_0x43fa('0xf')][_0x43fa('0x11')]);}else{logger[_0x43fa('0x12')](_0x43fa('0x10'),_0x1b65df,_0x43fa('0xd'));_0x5e51b5(_0x2de891['result'][_0x43fa('0x11')]);}})[_0x43fa('0x13')](function(_0x3327ed){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1b65df,_0x3327ed);_0x24b12b(_0x3327ed);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 08bc6da..8d09a7d 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 _0x1238=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','put','isAuthenticated','update','delete','destroy'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x1238,0x81));var _0x8123=function(_0x36b261,_0x504c02){_0x36b261=_0x36b261-0x0;var _0x2cf069=_0x1238[_0x36b261];return _0x2cf069;};'use strict';var multer=require(_0x8123('0x0'));var util=require(_0x8123('0x1'));var path=require(_0x8123('0x2'));var timeout=require('connect-timeout');var express=require(_0x8123('0x3'));var router=express[_0x8123('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8123('0x5'));var interaction=require(_0x8123('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x8123('0x7')](_0x8123('0x8'),auth['isAuthenticated'](),controller[_0x8123('0x9')]);router[_0x8123('0xa')](_0x8123('0x8'),auth[_0x8123('0xb')](),controller[_0x8123('0xc')]);router[_0x8123('0xd')](_0x8123('0x8'),auth[_0x8123('0xb')](),controller[_0x8123('0xe')]);module[_0x8123('0xf')]=router; \ No newline at end of file +var _0x20f8=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatApplication.controller','get'];(function(_0xcd4c5b,_0x2152b6){var _0x17d55e=function(_0x4ec8db){while(--_0x4ec8db){_0xcd4c5b['push'](_0xcd4c5b['shift']());}};_0x17d55e(++_0x2152b6);}(_0x20f8,0x7f));var _0x820f=function(_0x5272fd,_0x46d398){_0x5272fd=_0x5272fd-0x0;var _0x6b5ca6=_0x20f8[_0x5272fd];return _0x6b5ca6;};'use strict';var multer=require(_0x820f('0x0'));var util=require(_0x820f('0x1'));var path=require(_0x820f('0x2'));var timeout=require('connect-timeout');var express=require(_0x820f('0x3'));var router=express[_0x820f('0x4')]();var fs_extra=require(_0x820f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x820f('0x6'));var controller=require(_0x820f('0x7'));router[_0x820f('0x8')](_0x820f('0x9'),auth[_0x820f('0xa')](),controller[_0x820f('0xb')]);router[_0x820f('0xc')](_0x820f('0x9'),auth['isAuthenticated'](),controller[_0x820f('0xd')]);router[_0x820f('0xe')](_0x820f('0x9'),auth[_0x820f('0xa')](),controller[_0x820f('0xf')]);module[_0x820f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 026bcdb..c4abeb1 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 _0xeb1c=['STRING','sequelize'];(function(_0x7a5bb2,_0x550ebe){var _0x3b2c3f=function(_0x4477af){while(--_0x4477af){_0x7a5bb2['push'](_0x7a5bb2['shift']());}};_0x3b2c3f(++_0x550ebe);}(_0xeb1c,0x119));var _0xceb1=function(_0x494b04,_0x5881a4){_0x494b04=_0x494b04-0x0;var _0x1a6271=_0xeb1c[_0x494b04];return _0x1a6271;};'use strict';var Sequelize=require(_0xceb1('0x0'));module['exports']={'name':{'type':Sequelize[_0xceb1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xceb1('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0599=['STRING','BOOLEAN'];(function(_0x579e23,_0x4d36e0){var _0x212c64=function(_0x2d5faf){while(--_0x2d5faf){_0x579e23['push'](_0x579e23['shift']());}};_0x212c64(++_0x4d36e0);}(_0x0599,0x120));var _0x9059=function(_0x2f9fe8,_0x51b63c){_0x2f9fe8=_0x2f9fe8-0x0;var _0x217a81=_0x0599[_0x2f9fe8];return _0x217a81;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9059('0x0')]},'write':{'type':Sequelize[_0x9059('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4757b80..cac5a18 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 _0x02af=['limit','count','set','Content-Range','apply','reject','save','update','then','end','error','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','addMembers','ids','findOne','keys','User','pick','getMembers','removeMembers','addMessage','getMessages','order','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined'];(function(_0x308ddd,_0x3a8401){var _0x3224c3=function(_0x230424){while(--_0x230424){_0x308ddd['push'](_0x308ddd['shift']());}};_0x3224c3(++_0x3a8401);}(_0x02af,0x157));var _0xf02a=function(_0x2a30aa,_0x3e564e){_0x2a30aa=_0x2a30aa-0x0;var _0x2f357e=_0x02af[_0x2a30aa];return _0x2f357e;};'use strict';var emlformat=require(_0xf02a('0x0'));var rimraf=require(_0xf02a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf02a('0x2'));var rp=require(_0xf02a('0x3'));var moment=require('moment');var BPromise=require(_0xf02a('0x4'));var Mustache=require(_0xf02a('0x5'));var util=require(_0xf02a('0x6'));var path=require(_0xf02a('0x7'));var sox=require(_0xf02a('0x8'));var csv=require(_0xf02a('0x9'));var ejs=require(_0xf02a('0xa'));var fs=require('fs');var fs_extra=require(_0xf02a('0xb'));var _=require(_0xf02a('0xc'));var squel=require(_0xf02a('0xd'));var crypto=require(_0xf02a('0xe'));var jsforce=require(_0xf02a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf02a('0x9'));var querystring=require(_0xf02a('0x10'));var Papa=require('papaparse');var Redis=require(_0xf02a('0x11'));var authService=require(_0xf02a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf02a('0x13'))(_0xf02a('0x14'));var utils=require('../../config/utils');var config=require(_0xf02a('0x15'));var licenseUtil=require(_0xf02a('0x16'));var db=require(_0xf02a('0x17'))['db'];config[_0xf02a('0x18')]=_[_0xf02a('0x19')](config[_0xf02a('0x18')],{'host':_0xf02a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf02a('0x18')]));require('./chatGroup.socket')[_0xf02a('0x1b')](socket);function respondWithStatusCode(_0xf2d5a1,_0x3b8fd5){_0x3b8fd5=_0x3b8fd5||0xcc;return function(_0xa98b98){if(_0xa98b98){return _0xf2d5a1[_0xf02a('0x1c')](_0x3b8fd5);}return _0xf2d5a1['status'](_0x3b8fd5)['end']();};}function respondWithResult(_0x120070,_0x3d2bfb){_0x3d2bfb=_0x3d2bfb||0xc8;return function(_0x13e15d){if(_0x13e15d){return _0x120070[_0xf02a('0x1d')](_0x3d2bfb)[_0xf02a('0x1e')](_0x13e15d);}};}function respondWithFilteredResult(_0x2d644c,_0x272313){return function(_0x563c23){if(_0x563c23){var _0x52faa5=typeof _0x272313[_0xf02a('0x1f')]===_0xf02a('0x20')&&typeof _0x272313[_0xf02a('0x21')]===_0xf02a('0x20');var _0x1c3735=_0x563c23[_0xf02a('0x22')];var _0x3b8f00=_0x52faa5?0x0:_0x272313[_0xf02a('0x1f')];var _0x16eb41=_0x52faa5?_0x563c23[_0xf02a('0x22')]:_0x272313[_0xf02a('0x1f')]+_0x272313['limit'];var _0x5902cf;if(_0x16eb41>=_0x1c3735){_0x16eb41=_0x1c3735;_0x5902cf=0xc8;}else{_0x5902cf=0xce;}_0x2d644c[_0xf02a('0x1d')](_0x5902cf);return _0x2d644c[_0xf02a('0x23')](_0xf02a('0x24'),_0x3b8f00+'-'+_0x16eb41+'/'+_0x1c3735)[_0xf02a('0x1e')](_0x563c23);}return null;};}function patchUpdates(_0xa7a42d){return function(_0x53a243){try{jsonpatch[_0xf02a('0x25')](_0x53a243,_0xa7a42d,!![]);}catch(_0x4af190){return BPromise[_0xf02a('0x26')](_0x4af190);}return _0x53a243[_0xf02a('0x27')]();};}function saveUpdates(_0x5613d7,_0x5b2793){return function(_0x2b9464){if(_0x2b9464){return _0x2b9464[_0xf02a('0x28')](_0x5613d7)[_0xf02a('0x29')](function(_0x5cf598){return _0x5cf598;});}return null;};}function removeEntity(_0x5ea831,_0x397353){return function(_0x2705fe){if(_0x2705fe){return _0x2705fe['destroy']()[_0xf02a('0x29')](function(){_0x5ea831[_0xf02a('0x1d')](0xcc)[_0xf02a('0x2a')]();});}};}function handleEntityNotFound(_0x3a8aa3,_0x4c4e62){return function(_0x39cbbd){if(!_0x39cbbd){_0x3a8aa3[_0xf02a('0x1c')](0x194);}return _0x39cbbd;};}function handleError(_0x5e75d8,_0x2c6bba){_0x2c6bba=_0x2c6bba||0x1f4;return function(_0x31adce){logger[_0xf02a('0x2b')](_0x31adce['stack']);if(_0x31adce['name']){delete _0x31adce['name'];}_0x5e75d8[_0xf02a('0x1d')](_0x2c6bba)[_0xf02a('0x2c')](_0x31adce);};}exports['index']=function(_0x5ec755,_0x129183){var _0x570287={},_0x371614={},_0x5aa0e1={'count':0x0,'rows':[]};var _0x433a4=_[_0xf02a('0x2d')](db[_0xf02a('0x2e')][_0xf02a('0x2f')],function(_0x193c40){return{'name':_0x193c40[_0xf02a('0x30')],'type':_0x193c40[_0xf02a('0x31')][_0xf02a('0x32')]};});_0x371614[_0xf02a('0x33')]=_['map'](_0x433a4,_0xf02a('0x34'));_0x371614[_0xf02a('0x35')]=_['keys'](_0x5ec755['query']);_0x371614[_0xf02a('0x36')]=_[_0xf02a('0x37')](_0x371614[_0xf02a('0x33')],_0x371614[_0xf02a('0x35')]);_0x570287[_0xf02a('0x38')]=_[_0xf02a('0x37')](_0x371614['model'],qs[_0xf02a('0x39')](_0x5ec755[_0xf02a('0x35')]['fields']));_0x570287[_0xf02a('0x38')]=_0x570287['attributes'][_0xf02a('0x3a')]?_0x570287[_0xf02a('0x38')]:_0x371614[_0xf02a('0x33')];if(!_0x5ec755[_0xf02a('0x35')][_0xf02a('0x3b')](_0xf02a('0x3c'))){_0x570287[_0xf02a('0x21')]=qs[_0xf02a('0x21')](_0x5ec755[_0xf02a('0x35')][_0xf02a('0x21')]);_0x570287[_0xf02a('0x1f')]=qs[_0xf02a('0x1f')](_0x5ec755['query'][_0xf02a('0x1f')]);}_0x570287['order']=qs[_0xf02a('0x3d')](_0x5ec755['query'][_0xf02a('0x3d')]);_0x570287[_0xf02a('0x3e')]=qs['filters'](_['pick'](_0x5ec755['query'],_0x371614[_0xf02a('0x36')]),_0x433a4);if(_0x5ec755[_0xf02a('0x35')][_0xf02a('0x3f')]){_0x570287[_0xf02a('0x3e')]=_[_0xf02a('0x40')](_0x570287['where'],{'$or':_[_0xf02a('0x2d')](_0x433a4,function(_0x1ada4f){if(_0x1ada4f['type']!==_0xf02a('0x41')){var _0xc5eee1={};_0xc5eee1[_0x1ada4f[_0xf02a('0x34')]]={'$like':'%'+_0x5ec755['query'][_0xf02a('0x3f')]+'%'};return _0xc5eee1;}})});}_0x570287=_['merge']({},_0x570287,_0x5ec755[_0xf02a('0x42')]);var _0x2c02cf={'where':_0x570287[_0xf02a('0x3e')]};return db[_0xf02a('0x2e')]['count'](_0x2c02cf)['then'](function(_0x59178c){_0x5aa0e1[_0xf02a('0x22')]=_0x59178c;if(_0x5ec755[_0xf02a('0x35')][_0xf02a('0x43')]){_0x570287[_0xf02a('0x44')]=[{'all':!![]}];}return db[_0xf02a('0x2e')][_0xf02a('0x45')](_0x570287);})[_0xf02a('0x29')](function(_0x4fbc67){_0x5aa0e1[_0xf02a('0x46')]=_0x4fbc67;return _0x5aa0e1;})['then'](respondWithFilteredResult(_0x129183,_0x570287))['catch'](handleError(_0x129183,null));};exports['show']=function(_0x573d01,_0x2e5afb){var _0x2d2343={'raw':!![],'where':{'id':_0x573d01[_0xf02a('0x47')]['id']}},_0x46c749={};_0x46c749['model']=_['keys'](db[_0xf02a('0x2e')][_0xf02a('0x2f')]);_0x46c749['query']=_['keys'](_0x573d01[_0xf02a('0x35')]);_0x46c749['filters']=_[_0xf02a('0x37')](_0x46c749['model'],_0x46c749[_0xf02a('0x35')]);_0x2d2343[_0xf02a('0x38')]=_['intersection'](_0x46c749[_0xf02a('0x33')],qs['fields'](_0x573d01[_0xf02a('0x35')][_0xf02a('0x39')]));_0x2d2343['attributes']=_0x2d2343['attributes']['length']?_0x2d2343['attributes']:_0x46c749[_0xf02a('0x33')];if(_0x573d01['query'][_0xf02a('0x43')]){_0x2d2343['include']=[{'all':!![]}];}_0x2d2343=_[_0xf02a('0x40')]({},_0x2d2343,_0x573d01[_0xf02a('0x42')]);return db[_0xf02a('0x2e')]['find'](_0x2d2343)[_0xf02a('0x29')](handleEntityNotFound(_0x2e5afb,null))[_0xf02a('0x29')](respondWithResult(_0x2e5afb,null))[_0xf02a('0x48')](handleError(_0x2e5afb,null));};exports['create']=function(_0x3450e3,_0x2ede6d){return db['ChatGroup'][_0xf02a('0x49')](_0x3450e3['body'],{})[_0xf02a('0x29')](respondWithResult(_0x2ede6d,0xc9))[_0xf02a('0x48')](handleError(_0x2ede6d,null));};exports['update']=function(_0x20a75f,_0x106c0f){if(_0x20a75f[_0xf02a('0x4a')]['id']){delete _0x20a75f[_0xf02a('0x4a')]['id'];}return db[_0xf02a('0x2e')][_0xf02a('0x4b')]({'where':{'id':_0x20a75f[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x106c0f,null))['then'](saveUpdates(_0x20a75f[_0xf02a('0x4a')],null))[_0xf02a('0x29')](respondWithResult(_0x106c0f,null))[_0xf02a('0x48')](handleError(_0x106c0f,null));};exports[_0xf02a('0x4c')]=function(_0x545269,_0x4e41c1){return db[_0xf02a('0x2e')]['find']({'where':{'id':_0x545269[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x4e41c1,null))['then'](removeEntity(_0x4e41c1,null))[_0xf02a('0x48')](handleError(_0x4e41c1,null));};exports['describe']=function(_0x41cc8b,_0x24027c){return db[_0xf02a('0x2e')][_0xf02a('0x4d')]()[_0xf02a('0x29')](respondWithResult(_0x24027c,null))[_0xf02a('0x48')](handleError(_0x24027c,null));};exports[_0xf02a('0x4e')]=function(_0x61bb5,_0x4a1b7a,_0x2b859b){return db[_0xf02a('0x4f')][_0xf02a('0x22')]({'where':{'ChatGroupId':_0x61bb5['params']['id'],'ToId':_0x61bb5[_0xf02a('0x50')]['id'],'read':![]}})['then'](function(_0x19277b){return{'id':_['toInteger'](_0x61bb5[_0xf02a('0x47')]['id']),'count':_0x19277b};})['then'](respondWithResult(_0x4a1b7a,null))['catch'](handleError(_0x4a1b7a,null));};exports[_0xf02a('0x51')]=function(_0x106345,_0x1c2a3e,_0x3c9f9b){return db[_0xf02a('0x2e')][_0xf02a('0x4b')]({'where':{'id':_0x106345[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x1c2a3e,null))[_0xf02a('0x29')](function(_0x5811c7){if(_0x5811c7){return _0x5811c7[_0xf02a('0x51')](_0x106345[_0xf02a('0x4a')]['ids'],_['omit'](_0x106345[_0xf02a('0x4a')],[_0xf02a('0x52'),'id'])||{});}})[_0xf02a('0x29')](respondWithResult(_0x1c2a3e,null))[_0xf02a('0x48')](handleError(_0x1c2a3e,null));};exports['getMembers']=function(_0x4ec886,_0x502008,_0x33bee3){var _0x5b53a7={};var _0x5f3174={};var _0x47deaf;var _0x2bbfa3;return db[_0xf02a('0x2e')][_0xf02a('0x53')]({'where':{'id':_0x4ec886[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x502008,null))[_0xf02a('0x29')](function(_0x184f3f){if(_0x184f3f){_0x47deaf=_0x184f3f;_0x5f3174[_0xf02a('0x33')]=_[_0xf02a('0x54')](db[_0xf02a('0x55')][_0xf02a('0x2f')]);_0x5f3174[_0xf02a('0x35')]=_[_0xf02a('0x54')](_0x4ec886[_0xf02a('0x35')]);_0x5f3174['filters']=_[_0xf02a('0x37')](_0x5f3174[_0xf02a('0x33')],_0x5f3174[_0xf02a('0x35')]);_0x5b53a7[_0xf02a('0x38')]=_[_0xf02a('0x37')](_0x5f3174[_0xf02a('0x33')],qs[_0xf02a('0x39')](_0x4ec886[_0xf02a('0x35')][_0xf02a('0x39')]));_0x5b53a7[_0xf02a('0x38')]=_0x5b53a7[_0xf02a('0x38')][_0xf02a('0x3a')]?_0x5b53a7[_0xf02a('0x38')]:_0x5f3174[_0xf02a('0x33')];_0x5b53a7['order']=qs[_0xf02a('0x3d')](_0x4ec886[_0xf02a('0x35')]['sort']);_0x5b53a7[_0xf02a('0x3e')]=qs[_0xf02a('0x36')](_[_0xf02a('0x56')](_0x4ec886[_0xf02a('0x35')],_0x5f3174['filters']));if(_0x4ec886[_0xf02a('0x35')][_0xf02a('0x3f')]){_0x5b53a7[_0xf02a('0x3e')]=_[_0xf02a('0x40')](_0x5b53a7['where'],{'$or':_[_0xf02a('0x2d')](_0x5b53a7[_0xf02a('0x38')],function(_0x13da73){var _0x5b4b5e={};_0x5b4b5e[_0x13da73]={'$like':'%'+_0x4ec886['query'][_0xf02a('0x3f')]+'%'};return _0x5b4b5e;})});}_0x5b53a7=_[_0xf02a('0x40')]({},_0x5b53a7,_0x4ec886['options']);return _0x47deaf[_0xf02a('0x57')](_0x5b53a7);}})[_0xf02a('0x29')](function(_0x55616e){if(_0x55616e){_0x2bbfa3=_0x55616e[_0xf02a('0x3a')];if(!_0x4ec886[_0xf02a('0x35')][_0xf02a('0x3b')](_0xf02a('0x3c'))){_0x5b53a7['limit']=qs['limit'](_0x4ec886[_0xf02a('0x35')]['limit']);_0x5b53a7[_0xf02a('0x1f')]=qs[_0xf02a('0x1f')](_0x4ec886['query'][_0xf02a('0x1f')]);}return _0x47deaf[_0xf02a('0x57')](_0x5b53a7);}})['then'](function(_0x109728){if(_0x109728){return _0x109728?{'count':_0x2bbfa3,'rows':_0x109728}:null;}})[_0xf02a('0x29')](respondWithResult(_0x502008,null))['catch'](handleError(_0x502008,null));};exports[_0xf02a('0x58')]=function(_0x5a31c9,_0x16827b,_0x4dc0a4){return db['ChatGroup']['find']({'where':{'id':_0x5a31c9[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x16827b,null))[_0xf02a('0x29')](function(_0x55b43e){if(_0x55b43e){return _0x55b43e[_0xf02a('0x58')](_0x5a31c9[_0xf02a('0x35')][_0xf02a('0x52')]);}})[_0xf02a('0x29')](respondWithStatusCode(_0x16827b,null))['catch'](handleError(_0x16827b,null));};exports[_0xf02a('0x59')]=function(_0x109f9b,_0x47cc10,_0x2dc83a){if(_0x109f9b[_0xf02a('0x4a')]['id']){delete _0x109f9b[_0xf02a('0x4a')]['id'];}return db[_0xf02a('0x2e')][_0xf02a('0x4b')]({'where':{'id':_0x109f9b['params']['id']}})['then'](handleEntityNotFound(_0x47cc10,null))['then'](function(_0xc03cdd){if(_0xc03cdd){_0x109f9b['body']['ChatGroupId']=_0xc03cdd['id'];return db[_0xf02a('0x4f')]['create'](_0x109f9b[_0xf02a('0x4a')]);}})[_0xf02a('0x29')](respondWithResult(_0x47cc10,null))[_0xf02a('0x48')](handleError(_0x47cc10,null));};exports[_0xf02a('0x5a')]=function(_0x5a6384,_0x315b5a,_0xd624c7){var _0x254010={};var _0x335c68={};var _0x29202c;var _0x1e8e32;return db['ChatGroup'][_0xf02a('0x53')]({'where':{'id':_0x5a6384[_0xf02a('0x47')]['id']}})[_0xf02a('0x29')](handleEntityNotFound(_0x315b5a,null))['then'](function(_0x318253){if(_0x318253){_0x29202c=_0x318253;_0x335c68[_0xf02a('0x33')]=_[_0xf02a('0x54')](db[_0xf02a('0x4f')][_0xf02a('0x2f')]);_0x335c68['query']=_[_0xf02a('0x54')](_0x5a6384[_0xf02a('0x35')]);_0x335c68['filters']=_[_0xf02a('0x37')](_0x335c68[_0xf02a('0x33')],_0x335c68[_0xf02a('0x35')]);_0x254010[_0xf02a('0x38')]=_['intersection'](_0x335c68['model'],qs['fields'](_0x5a6384['query'][_0xf02a('0x39')]));_0x254010[_0xf02a('0x38')]=_0x254010[_0xf02a('0x38')][_0xf02a('0x3a')]?_0x254010['attributes']:_0x335c68[_0xf02a('0x33')];_0x254010[_0xf02a('0x5b')]=qs[_0xf02a('0x3d')](_0x5a6384[_0xf02a('0x35')][_0xf02a('0x3d')]);_0x254010[_0xf02a('0x3e')]=qs[_0xf02a('0x36')](_['pick'](_0x5a6384['query'],_0x335c68[_0xf02a('0x36')]));if(_0x5a6384['query']['filter']){_0x254010[_0xf02a('0x3e')]=_[_0xf02a('0x40')](_0x254010[_0xf02a('0x3e')],{'$or':_['map'](_0x254010[_0xf02a('0x38')],function(_0x4d867d){var _0x5c01ee={};_0x5c01ee[_0x4d867d]={'$like':'%'+_0x5a6384[_0xf02a('0x35')][_0xf02a('0x3f')]+'%'};return _0x5c01ee;})});}if(_0x5a6384[_0xf02a('0x35')][_0xf02a('0x5c')]){var _0x1e16cc=_0x5a6384['query']['$gte']['split'](',');var _0x5a2d9a={};_0x5a2d9a[_0x1e16cc[0x0]]={'$gte':moment(_0x1e16cc[0x1])['format'](_0xf02a('0x5d'))};_0x254010['where']=_[_0xf02a('0x40')](_0x254010[_0xf02a('0x3e')],_0x5a2d9a);}_0x254010=_[_0xf02a('0x40')]({},_0x254010,_0x5a6384[_0xf02a('0x42')]);return _0x29202c[_0xf02a('0x5a')](_0x254010);}})[_0xf02a('0x29')](function(_0x43472c){if(_0x43472c){_0x1e8e32=_0x43472c['length'];if(!_0x5a6384['query'][_0xf02a('0x3b')](_0xf02a('0x3c'))){_0x254010[_0xf02a('0x21')]=qs[_0xf02a('0x21')](_0x5a6384[_0xf02a('0x35')][_0xf02a('0x21')]);_0x254010['offset']=qs['offset'](_0x5a6384[_0xf02a('0x35')][_0xf02a('0x1f')]);}return _0x29202c[_0xf02a('0x5a')](_0x254010);}})[_0xf02a('0x29')](function(_0x3d889b){if(_0x3d889b){return _0x3d889b?{'count':_0x1e8e32,'rows':_0x3d889b}:null;}})[_0xf02a('0x29')](respondWithResult(_0x315b5a,null))[_0xf02a('0x48')](handleError(_0x315b5a,null));}; \ No newline at end of file +var _0xe8c0=['addMessage','ChatGroupId','getMessages','findOne','pick','$gte','eml-format','rimraf','request-promise','moment','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','removeMembers'];(function(_0x7f424b,_0x31b67f){var _0x379dd0=function(_0x1facbc){while(--_0x1facbc){_0x7f424b['push'](_0x7f424b['shift']());}};_0x379dd0(++_0x31b67f);}(_0xe8c0,0x18a));var _0x0e8c=function(_0x374554,_0x195ff4){_0x374554=_0x374554-0x0;var _0x3e7d05=_0xe8c0[_0x374554];return _0x3e7d05;};'use strict';var emlformat=require(_0x0e8c('0x0'));var rimraf=require(_0x0e8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e8c('0x2'));var moment=require(_0x0e8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e8c('0x4'));var util=require(_0x0e8c('0x5'));var path=require(_0x0e8c('0x6'));var sox=require(_0x0e8c('0x7'));var csv=require(_0x0e8c('0x8'));var ejs=require(_0x0e8c('0x9'));var fs=require('fs');var fs_extra=require(_0x0e8c('0xa'));var _=require('lodash');var squel=require(_0x0e8c('0xb'));var crypto=require(_0x0e8c('0xc'));var jsforce=require(_0x0e8c('0xd'));var deskjs=require(_0x0e8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0e8c('0xf'));var Papa=require(_0x0e8c('0x10'));var Redis=require('ioredis');var authService=require(_0x0e8c('0x11'));var qs=require(_0x0e8c('0x12'));var as=require(_0x0e8c('0x13'));var hardwareService=require(_0x0e8c('0x14'));var logger=require(_0x0e8c('0x15'))(_0x0e8c('0x16'));var utils=require(_0x0e8c('0x17'));var config=require(_0x0e8c('0x18'));var licenseUtil=require(_0x0e8c('0x19'));var db=require(_0x0e8c('0x1a'))['db'];config['redis']=_['defaults'](config[_0x0e8c('0x1b')],{'host':_0x0e8c('0x1c'),'port':0x18eb});var socket=require(_0x0e8c('0x1d'))(new Redis(config[_0x0e8c('0x1b')]));require(_0x0e8c('0x1e'))['register'](socket);function respondWithStatusCode(_0x101b2f,_0x14eaf8){_0x14eaf8=_0x14eaf8||0xcc;return function(_0x3f82e6){if(_0x3f82e6){return _0x101b2f[_0x0e8c('0x1f')](_0x14eaf8);}return _0x101b2f[_0x0e8c('0x20')](_0x14eaf8)[_0x0e8c('0x21')]();};}function respondWithResult(_0x2b89c3,_0x5ede4e){_0x5ede4e=_0x5ede4e||0xc8;return function(_0x4c9025){if(_0x4c9025){return _0x2b89c3[_0x0e8c('0x20')](_0x5ede4e)[_0x0e8c('0x22')](_0x4c9025);}};}function respondWithFilteredResult(_0x514b48,_0x33cd99){return function(_0x3a3ee6){if(_0x3a3ee6){var _0x5f383d=typeof _0x33cd99['offset']===_0x0e8c('0x23')&&typeof _0x33cd99[_0x0e8c('0x24')]===_0x0e8c('0x23');var _0x27411e=_0x3a3ee6[_0x0e8c('0x25')];var _0x5c7f9e=_0x5f383d?0x0:_0x33cd99[_0x0e8c('0x26')];var _0x7e6090=_0x5f383d?_0x3a3ee6['count']:_0x33cd99[_0x0e8c('0x26')]+_0x33cd99['limit'];var _0x1ef15b;if(_0x7e6090>=_0x27411e){_0x7e6090=_0x27411e;_0x1ef15b=0xc8;}else{_0x1ef15b=0xce;}_0x514b48[_0x0e8c('0x20')](_0x1ef15b);return _0x514b48['set'](_0x0e8c('0x27'),_0x5c7f9e+'-'+_0x7e6090+'/'+_0x27411e)[_0x0e8c('0x22')](_0x3a3ee6);}return null;};}function patchUpdates(_0xe83a90){return function(_0x216fb4){try{jsonpatch[_0x0e8c('0x28')](_0x216fb4,_0xe83a90,!![]);}catch(_0xe34721){return BPromise[_0x0e8c('0x29')](_0xe34721);}return _0x216fb4[_0x0e8c('0x2a')]();};}function saveUpdates(_0x8a212a,_0xb69dad){return function(_0x25a138){if(_0x25a138){return _0x25a138[_0x0e8c('0x2b')](_0x8a212a)[_0x0e8c('0x2c')](function(_0x41e149){return _0x41e149;});}return null;};}function removeEntity(_0xd3b6cd,_0x44df95){return function(_0x2dd8d8){if(_0x2dd8d8){return _0x2dd8d8[_0x0e8c('0x2d')]()[_0x0e8c('0x2c')](function(){_0xd3b6cd['status'](0xcc)[_0x0e8c('0x21')]();});}};}function handleEntityNotFound(_0x44619f,_0x13def7){return function(_0x1158bd){if(!_0x1158bd){_0x44619f['sendStatus'](0x194);}return _0x1158bd;};}function handleError(_0x358b3c,_0x4d7ea9){_0x4d7ea9=_0x4d7ea9||0x1f4;return function(_0x413d4b){logger[_0x0e8c('0x2e')](_0x413d4b[_0x0e8c('0x2f')]);if(_0x413d4b['name']){delete _0x413d4b[_0x0e8c('0x30')];}_0x358b3c['status'](_0x4d7ea9)[_0x0e8c('0x31')](_0x413d4b);};}exports[_0x0e8c('0x32')]=function(_0x257588,_0x2eba7e){var _0xa1de8c={},_0x4824e4={},_0x19a275={'count':0x0,'rows':[]};var _0x5b3519=_[_0x0e8c('0x33')](db[_0x0e8c('0x34')][_0x0e8c('0x35')],function(_0x5ad707){return{'name':_0x5ad707[_0x0e8c('0x36')],'type':_0x5ad707[_0x0e8c('0x37')]['key']};});_0x4824e4[_0x0e8c('0x38')]=_[_0x0e8c('0x33')](_0x5b3519,'name');_0x4824e4[_0x0e8c('0x39')]=_[_0x0e8c('0x3a')](_0x257588['query']);_0x4824e4[_0x0e8c('0x3b')]=_[_0x0e8c('0x3c')](_0x4824e4['model'],_0x4824e4[_0x0e8c('0x39')]);_0xa1de8c[_0x0e8c('0x3d')]=_[_0x0e8c('0x3c')](_0x4824e4[_0x0e8c('0x38')],qs[_0x0e8c('0x3e')](_0x257588['query'][_0x0e8c('0x3e')]));_0xa1de8c[_0x0e8c('0x3d')]=_0xa1de8c[_0x0e8c('0x3d')][_0x0e8c('0x3f')]?_0xa1de8c[_0x0e8c('0x3d')]:_0x4824e4[_0x0e8c('0x38')];if(!_0x257588['query'][_0x0e8c('0x40')](_0x0e8c('0x41'))){_0xa1de8c[_0x0e8c('0x24')]=qs[_0x0e8c('0x24')](_0x257588[_0x0e8c('0x39')][_0x0e8c('0x24')]);_0xa1de8c['offset']=qs['offset'](_0x257588[_0x0e8c('0x39')][_0x0e8c('0x26')]);}_0xa1de8c[_0x0e8c('0x42')]=qs['sort'](_0x257588[_0x0e8c('0x39')][_0x0e8c('0x43')]);_0xa1de8c[_0x0e8c('0x44')]=qs['filters'](_['pick'](_0x257588['query'],_0x4824e4[_0x0e8c('0x3b')]),_0x5b3519);if(_0x257588['query'][_0x0e8c('0x45')]){_0xa1de8c['where']=_[_0x0e8c('0x46')](_0xa1de8c[_0x0e8c('0x44')],{'$or':_[_0x0e8c('0x33')](_0x5b3519,function(_0x5e3ec3){if(_0x5e3ec3[_0x0e8c('0x37')]!=='VIRTUAL'){var _0x2866ef={};_0x2866ef[_0x5e3ec3[_0x0e8c('0x30')]]={'$like':'%'+_0x257588[_0x0e8c('0x39')][_0x0e8c('0x45')]+'%'};return _0x2866ef;}})});}_0xa1de8c=_[_0x0e8c('0x46')]({},_0xa1de8c,_0x257588[_0x0e8c('0x47')]);var _0x5aa54e={'where':_0xa1de8c[_0x0e8c('0x44')]};return db[_0x0e8c('0x34')][_0x0e8c('0x25')](_0x5aa54e)[_0x0e8c('0x2c')](function(_0x2eddf4){_0x19a275[_0x0e8c('0x25')]=_0x2eddf4;if(_0x257588[_0x0e8c('0x39')][_0x0e8c('0x48')]){_0xa1de8c[_0x0e8c('0x49')]=[{'all':!![]}];}return db[_0x0e8c('0x34')][_0x0e8c('0x4a')](_0xa1de8c);})['then'](function(_0x11afe3){_0x19a275[_0x0e8c('0x4b')]=_0x11afe3;return _0x19a275;})[_0x0e8c('0x2c')](respondWithFilteredResult(_0x2eba7e,_0xa1de8c))[_0x0e8c('0x4c')](handleError(_0x2eba7e,null));};exports[_0x0e8c('0x4d')]=function(_0x39883a,_0x1d2fa2){var _0x445edb={'raw':!![],'where':{'id':_0x39883a[_0x0e8c('0x4e')]['id']}},_0x2e4dbe={};_0x2e4dbe[_0x0e8c('0x38')]=_['keys'](db[_0x0e8c('0x34')][_0x0e8c('0x35')]);_0x2e4dbe[_0x0e8c('0x39')]=_[_0x0e8c('0x3a')](_0x39883a['query']);_0x2e4dbe['filters']=_[_0x0e8c('0x3c')](_0x2e4dbe[_0x0e8c('0x38')],_0x2e4dbe[_0x0e8c('0x39')]);_0x445edb['attributes']=_[_0x0e8c('0x3c')](_0x2e4dbe[_0x0e8c('0x38')],qs[_0x0e8c('0x3e')](_0x39883a[_0x0e8c('0x39')][_0x0e8c('0x3e')]));_0x445edb[_0x0e8c('0x3d')]=_0x445edb[_0x0e8c('0x3d')][_0x0e8c('0x3f')]?_0x445edb[_0x0e8c('0x3d')]:_0x2e4dbe[_0x0e8c('0x38')];if(_0x39883a[_0x0e8c('0x39')]['includeAll']){_0x445edb[_0x0e8c('0x49')]=[{'all':!![]}];}_0x445edb=_['merge']({},_0x445edb,_0x39883a['options']);return db[_0x0e8c('0x34')][_0x0e8c('0x4f')](_0x445edb)[_0x0e8c('0x2c')](handleEntityNotFound(_0x1d2fa2,null))[_0x0e8c('0x2c')](respondWithResult(_0x1d2fa2,null))[_0x0e8c('0x4c')](handleError(_0x1d2fa2,null));};exports['create']=function(_0xa17061,_0x2aca6e){return db[_0x0e8c('0x34')][_0x0e8c('0x50')](_0xa17061[_0x0e8c('0x51')],{})[_0x0e8c('0x2c')](respondWithResult(_0x2aca6e,0xc9))[_0x0e8c('0x4c')](handleError(_0x2aca6e,null));};exports[_0x0e8c('0x2b')]=function(_0x393b8f,_0x5eb9f8){if(_0x393b8f[_0x0e8c('0x51')]['id']){delete _0x393b8f['body']['id'];}return db[_0x0e8c('0x34')]['find']({'where':{'id':_0x393b8f[_0x0e8c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5eb9f8,null))[_0x0e8c('0x2c')](saveUpdates(_0x393b8f['body'],null))[_0x0e8c('0x2c')](respondWithResult(_0x5eb9f8,null))[_0x0e8c('0x4c')](handleError(_0x5eb9f8,null));};exports[_0x0e8c('0x2d')]=function(_0x531720,_0x139f11){return db[_0x0e8c('0x34')][_0x0e8c('0x4f')]({'where':{'id':_0x531720[_0x0e8c('0x4e')]['id']}})[_0x0e8c('0x2c')](handleEntityNotFound(_0x139f11,null))[_0x0e8c('0x2c')](removeEntity(_0x139f11,null))[_0x0e8c('0x4c')](handleError(_0x139f11,null));};exports[_0x0e8c('0x52')]=function(_0x2094b2,_0x36c3f3){return db[_0x0e8c('0x34')][_0x0e8c('0x52')]()[_0x0e8c('0x2c')](respondWithResult(_0x36c3f3,null))[_0x0e8c('0x4c')](handleError(_0x36c3f3,null));};exports[_0x0e8c('0x53')]=function(_0x421ee9,_0x3065b6,_0x273092){return db[_0x0e8c('0x54')]['count']({'where':{'ChatGroupId':_0x421ee9[_0x0e8c('0x4e')]['id'],'ToId':_0x421ee9['user']['id'],'read':![]}})['then'](function(_0x559f35){return{'id':_[_0x0e8c('0x55')](_0x421ee9[_0x0e8c('0x4e')]['id']),'count':_0x559f35};})[_0x0e8c('0x2c')](respondWithResult(_0x3065b6,null))[_0x0e8c('0x4c')](handleError(_0x3065b6,null));};exports['addMembers']=function(_0x3c63b8,_0x57a5b2,_0xfe89b5){return db[_0x0e8c('0x34')][_0x0e8c('0x4f')]({'where':{'id':_0x3c63b8[_0x0e8c('0x4e')]['id']}})[_0x0e8c('0x2c')](handleEntityNotFound(_0x57a5b2,null))[_0x0e8c('0x2c')](function(_0x2743b9){if(_0x2743b9){return _0x2743b9[_0x0e8c('0x56')](_0x3c63b8[_0x0e8c('0x51')][_0x0e8c('0x57')],_[_0x0e8c('0x58')](_0x3c63b8[_0x0e8c('0x51')],[_0x0e8c('0x57'),'id'])||{});}})[_0x0e8c('0x2c')](respondWithResult(_0x57a5b2,null))[_0x0e8c('0x4c')](handleError(_0x57a5b2,null));};exports[_0x0e8c('0x59')]=function(_0x18b2f5,_0x57855c,_0x5d36b6){var _0xc1bda={};var _0x149f80={};var _0x3aa6a4;var _0x424b70;return db[_0x0e8c('0x34')]['findOne']({'where':{'id':_0x18b2f5[_0x0e8c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57855c,null))[_0x0e8c('0x2c')](function(_0x45d0a6){if(_0x45d0a6){_0x3aa6a4=_0x45d0a6;_0x149f80[_0x0e8c('0x38')]=_[_0x0e8c('0x3a')](db['User'][_0x0e8c('0x35')]);_0x149f80[_0x0e8c('0x39')]=_[_0x0e8c('0x3a')](_0x18b2f5[_0x0e8c('0x39')]);_0x149f80[_0x0e8c('0x3b')]=_['intersection'](_0x149f80[_0x0e8c('0x38')],_0x149f80[_0x0e8c('0x39')]);_0xc1bda['attributes']=_['intersection'](_0x149f80[_0x0e8c('0x38')],qs['fields'](_0x18b2f5['query']['fields']));_0xc1bda[_0x0e8c('0x3d')]=_0xc1bda[_0x0e8c('0x3d')][_0x0e8c('0x3f')]?_0xc1bda[_0x0e8c('0x3d')]:_0x149f80[_0x0e8c('0x38')];_0xc1bda[_0x0e8c('0x42')]=qs[_0x0e8c('0x43')](_0x18b2f5[_0x0e8c('0x39')]['sort']);_0xc1bda[_0x0e8c('0x44')]=qs[_0x0e8c('0x3b')](_['pick'](_0x18b2f5['query'],_0x149f80['filters']));if(_0x18b2f5[_0x0e8c('0x39')][_0x0e8c('0x45')]){_0xc1bda[_0x0e8c('0x44')]=_[_0x0e8c('0x46')](_0xc1bda[_0x0e8c('0x44')],{'$or':_[_0x0e8c('0x33')](_0xc1bda[_0x0e8c('0x3d')],function(_0x4a908e){var _0x26ba71={};_0x26ba71[_0x4a908e]={'$like':'%'+_0x18b2f5[_0x0e8c('0x39')][_0x0e8c('0x45')]+'%'};return _0x26ba71;})});}_0xc1bda=_['merge']({},_0xc1bda,_0x18b2f5['options']);return _0x3aa6a4['getMembers'](_0xc1bda);}})[_0x0e8c('0x2c')](function(_0x5056c9){if(_0x5056c9){_0x424b70=_0x5056c9['length'];if(!_0x18b2f5[_0x0e8c('0x39')][_0x0e8c('0x40')](_0x0e8c('0x41'))){_0xc1bda['limit']=qs['limit'](_0x18b2f5[_0x0e8c('0x39')][_0x0e8c('0x24')]);_0xc1bda[_0x0e8c('0x26')]=qs['offset'](_0x18b2f5[_0x0e8c('0x39')][_0x0e8c('0x26')]);}return _0x3aa6a4[_0x0e8c('0x59')](_0xc1bda);}})['then'](function(_0x824273){if(_0x824273){return _0x824273?{'count':_0x424b70,'rows':_0x824273}:null;}})['then'](respondWithResult(_0x57855c,null))[_0x0e8c('0x4c')](handleError(_0x57855c,null));};exports[_0x0e8c('0x5a')]=function(_0x1ec04a,_0x203535,_0x113b5b){return db[_0x0e8c('0x34')][_0x0e8c('0x4f')]({'where':{'id':_0x1ec04a[_0x0e8c('0x4e')]['id']}})[_0x0e8c('0x2c')](handleEntityNotFound(_0x203535,null))[_0x0e8c('0x2c')](function(_0x553825){if(_0x553825){return _0x553825[_0x0e8c('0x5a')](_0x1ec04a[_0x0e8c('0x39')][_0x0e8c('0x57')]);}})['then'](respondWithStatusCode(_0x203535,null))['catch'](handleError(_0x203535,null));};exports[_0x0e8c('0x5b')]=function(_0xe512a1,_0x201f9b,_0x4964a1){if(_0xe512a1['body']['id']){delete _0xe512a1['body']['id'];}return db[_0x0e8c('0x34')]['find']({'where':{'id':_0xe512a1[_0x0e8c('0x4e')]['id']}})[_0x0e8c('0x2c')](handleEntityNotFound(_0x201f9b,null))[_0x0e8c('0x2c')](function(_0x4f316){if(_0x4f316){_0xe512a1['body'][_0x0e8c('0x5c')]=_0x4f316['id'];return db[_0x0e8c('0x54')][_0x0e8c('0x50')](_0xe512a1[_0x0e8c('0x51')]);}})[_0x0e8c('0x2c')](respondWithResult(_0x201f9b,null))[_0x0e8c('0x4c')](handleError(_0x201f9b,null));};exports[_0x0e8c('0x5d')]=function(_0x17ae6f,_0x1f6ca5,_0x1084ac){var _0x1cf7a5={};var _0x323a17={};var _0x1908f3;var _0xf7dadf;return db[_0x0e8c('0x34')][_0x0e8c('0x5e')]({'where':{'id':_0x17ae6f['params']['id']}})[_0x0e8c('0x2c')](handleEntityNotFound(_0x1f6ca5,null))['then'](function(_0x5c53c7){if(_0x5c53c7){_0x1908f3=_0x5c53c7;_0x323a17['model']=_[_0x0e8c('0x3a')](db[_0x0e8c('0x54')][_0x0e8c('0x35')]);_0x323a17[_0x0e8c('0x39')]=_[_0x0e8c('0x3a')](_0x17ae6f['query']);_0x323a17[_0x0e8c('0x3b')]=_['intersection'](_0x323a17['model'],_0x323a17[_0x0e8c('0x39')]);_0x1cf7a5[_0x0e8c('0x3d')]=_['intersection'](_0x323a17[_0x0e8c('0x38')],qs[_0x0e8c('0x3e')](_0x17ae6f[_0x0e8c('0x39')][_0x0e8c('0x3e')]));_0x1cf7a5[_0x0e8c('0x3d')]=_0x1cf7a5[_0x0e8c('0x3d')][_0x0e8c('0x3f')]?_0x1cf7a5['attributes']:_0x323a17['model'];_0x1cf7a5['order']=qs[_0x0e8c('0x43')](_0x17ae6f[_0x0e8c('0x39')]['sort']);_0x1cf7a5[_0x0e8c('0x44')]=qs['filters'](_[_0x0e8c('0x5f')](_0x17ae6f[_0x0e8c('0x39')],_0x323a17[_0x0e8c('0x3b')]));if(_0x17ae6f[_0x0e8c('0x39')][_0x0e8c('0x45')]){_0x1cf7a5[_0x0e8c('0x44')]=_[_0x0e8c('0x46')](_0x1cf7a5[_0x0e8c('0x44')],{'$or':_[_0x0e8c('0x33')](_0x1cf7a5['attributes'],function(_0x1b0ec4){var _0x3cb8e6={};_0x3cb8e6[_0x1b0ec4]={'$like':'%'+_0x17ae6f[_0x0e8c('0x39')]['filter']+'%'};return _0x3cb8e6;})});}if(_0x17ae6f['query'][_0x0e8c('0x60')]){var _0x16261f=_0x17ae6f[_0x0e8c('0x39')]['$gte']['split'](',');var _0x1e4ca2={};_0x1e4ca2[_0x16261f[0x0]]={'$gte':moment(_0x16261f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1cf7a5['where']=_[_0x0e8c('0x46')](_0x1cf7a5[_0x0e8c('0x44')],_0x1e4ca2);}_0x1cf7a5=_[_0x0e8c('0x46')]({},_0x1cf7a5,_0x17ae6f[_0x0e8c('0x47')]);return _0x1908f3['getMessages'](_0x1cf7a5);}})['then'](function(_0x3adb92){if(_0x3adb92){_0xf7dadf=_0x3adb92[_0x0e8c('0x3f')];if(!_0x17ae6f['query'][_0x0e8c('0x40')](_0x0e8c('0x41'))){_0x1cf7a5[_0x0e8c('0x24')]=qs[_0x0e8c('0x24')](_0x17ae6f[_0x0e8c('0x39')][_0x0e8c('0x24')]);_0x1cf7a5[_0x0e8c('0x26')]=qs['offset'](_0x17ae6f[_0x0e8c('0x39')][_0x0e8c('0x26')]);}return _0x1908f3[_0x0e8c('0x5d')](_0x1cf7a5);}})[_0x0e8c('0x2c')](function(_0x3088c8){if(_0x3088c8){return _0x3088c8?{'count':_0xf7dadf,'rows':_0x3088c8}:null;}})['then'](respondWithResult(_0x1f6ca5,null))['catch'](handleError(_0x1f6ca5,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4f8f1aa..6830d6e 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 _0xf2ee=['emit','hasOwnProperty','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xf2ee,0x110));var _0xef2e=function(_0x441cb3,_0x40c468){_0x441cb3=_0x441cb3-0x0;var _0x55ef54=_0xf2ee[_0x441cb3];return _0x55ef54;};'use strict';var EventEmitter=require(_0xef2e('0x0'));var ChatGroup=require(_0xef2e('0x1'))['db'][_0xef2e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xef2e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc8cad1){return function(_0x5671eb,_0x31a28f,_0x3d19c5){ChatGroupEvents[_0xef2e('0x4')](_0xc8cad1+':'+_0x5671eb['id'],_0x5671eb);ChatGroupEvents[_0xef2e('0x4')](_0xc8cad1,_0x5671eb);_0x3d19c5(null);};}for(var e in events){if(events[_0xef2e('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x720f=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0x1da7b,_0x3ce5ec){var _0x4bf8e3=function(_0x21bed2){while(--_0x21bed2){_0x1da7b['push'](_0x1da7b['shift']());}};_0x4bf8e3(++_0x3ce5ec);}(_0x720f,0x80));var _0xf720=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x720f[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xf720('0x0'))['db'][_0xf720('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf720('0x2')](0x0);var events={'afterCreate':_0xf720('0x3'),'afterUpdate':_0xf720('0x4'),'afterDestroy':_0xf720('0x5')};function emitEvent(_0x5b4c09){return function(_0x2e722c,_0x57bb58,_0x54ac80){ChatGroupEvents['emit'](_0x5b4c09+':'+_0x2e722c['id'],_0x2e722c);ChatGroupEvents['emit'](_0x5b4c09,_0x2e722c);_0x54ac80(null);};}for(var e in events){if(events[_0xf720('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xf720('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7f33164..a3c868f 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 _0x0777=['bluebird','path','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0777,0xf6));var _0x7077=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0777[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x7077('0x0'));var util=require(_0x7077('0x1'));var logger=require(_0x7077('0x2'))(_0x7077('0x3'));var moment=require('moment');var BPromise=require(_0x7077('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7077('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7077('0x6'));module[_0x7077('0x7')]=function(_0x4e512f,_0x244ccf){return _0x4e512f[_0x7077('0x8')](_0x7077('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api'];(function(_0xf2d1bf,_0x19c53a){var _0x388d2c=function(_0x217e55){while(--_0x217e55){_0xf2d1bf['push'](_0xf2d1bf['shift']());}};_0x388d2c(++_0x19c53a);}(_0x2eb1,0xda));var _0x12eb=function(_0x2d4d28,_0x52e3db){_0x2d4d28=_0x2d4d28-0x0;var _0x3043fd=_0x2eb1[_0x2d4d28];return _0x3043fd;};'use strict';var _=require(_0x12eb('0x0'));var util=require('util');var logger=require(_0x12eb('0x1'))(_0x12eb('0x2'));var moment=require(_0x12eb('0x3'));var BPromise=require(_0x12eb('0x4'));var rp=require(_0x12eb('0x5'));var fs=require('fs');var path=require(_0x12eb('0x6'));var rimraf=require(_0x12eb('0x7'));var config=require(_0x12eb('0x8'));var attributes=require('./chatGroup.attributes');module[_0x12eb('0x9')]=function(_0x801152,_0x35f031){return _0x801152[_0x12eb('0xa')](_0x12eb('0xb'),attributes,{'tableName':_0x12eb('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 abee577..542bcd5 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 _0xd449=['http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x399719,_0x232b0f){var _0x1bd3e9=function(_0x2fad56){while(--_0x2fad56){_0x399719['push'](_0x399719['shift']());}};_0x1bd3e9(++_0x232b0f);}(_0xd449,0x153));var _0x9d44=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xd449[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0x9d44('0x0'));var util=require('util');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(_0x9d44('0x1'));var logger=require(_0x9d44('0x2'))(_0x9d44('0x3'));var config=require(_0x9d44('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9d44('0x5')][_0x9d44('0x6')]({'port':0x232a});config[_0x9d44('0x7')]=_[_0x9d44('0x8')](config[_0x9d44('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d44('0x9'))(new Redis(config[_0x9d44('0x7')]));require(_0x9d44('0xa'))[_0x9d44('0xb')](socket);function respondWithRpcPromise(_0x273a90,_0x5a00b3,_0x15a123){return new BPromise(function(_0x5d9ca7,_0xf9e3b0){return client['request'](_0x273a90,_0x15a123)[_0x9d44('0xc')](function(_0x363b8e){logger[_0x9d44('0xd')](_0x9d44('0xe'),_0x5a00b3,_0x9d44('0xf'));logger[_0x9d44('0x10')](_0x9d44('0x11'),_0x5a00b3,_0x9d44('0xf'),JSON[_0x9d44('0x12')](_0x363b8e));if(_0x363b8e['error']){if(_0x363b8e[_0x9d44('0x13')][_0x9d44('0x14')]===0x1f4){logger[_0x9d44('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5a00b3,_0x363b8e[_0x9d44('0x13')][_0x9d44('0x15')]);return _0xf9e3b0(_0x363b8e['error'][_0x9d44('0x15')]);}logger[_0x9d44('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5a00b3,_0x363b8e[_0x9d44('0x13')][_0x9d44('0x15')]);return _0x5d9ca7(_0x363b8e[_0x9d44('0x13')][_0x9d44('0x15')]);}else{logger[_0x9d44('0xd')](_0x9d44('0xe'),_0x5a00b3,_0x9d44('0xf'));_0x5d9ca7(_0x363b8e[_0x9d44('0x16')]['message']);}})['catch'](function(_0x2e6ba0){logger[_0x9d44('0x13')](_0x9d44('0xe'),_0x5a00b3,_0x2e6ba0);_0xf9e3b0(_0x2e6ba0);});});} \ No newline at end of file +var _0x5977=['socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x3f67ea,_0x2c70e5){var _0x573b10=function(_0x5ac259){while(--_0x5ac259){_0x3f67ea['push'](_0x3f67ea['shift']());}};_0x573b10(++_0x2c70e5);}(_0x5977,0xe1));var _0x7597=function(_0x562d57,_0x2dce57){_0x562d57=_0x562d57-0x0;var _0x15a781=_0x5977[_0x562d57];return _0x15a781;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var moment=require(_0x7597('0x2'));var BPromise=require(_0x7597('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7597('0x4'));var db=require(_0x7597('0x5'))['db'];var utils=require(_0x7597('0x6'));var logger=require('../../config/logger')(_0x7597('0x7'));var config=require(_0x7597('0x8'));var jayson=require(_0x7597('0x9'));var client=jayson[_0x7597('0xa')][_0x7597('0xb')]({'port':0x232a});config[_0x7597('0xc')]=_[_0x7597('0xd')](config[_0x7597('0xc')],{'host':_0x7597('0xe'),'port':0x18eb});var socket=require(_0x7597('0xf'))(new Redis(config[_0x7597('0xc')]));require('./chatGroup.socket')[_0x7597('0x10')](socket);function respondWithRpcPromise(_0x41e623,_0x1cae93,_0x180d34){return new BPromise(function(_0x1a1872,_0x3bc316){return client[_0x7597('0x11')](_0x41e623,_0x180d34)[_0x7597('0x12')](function(_0x147925){logger[_0x7597('0x13')](_0x7597('0x14'),_0x1cae93,'request\x20sent');logger[_0x7597('0x15')](_0x7597('0x16'),_0x1cae93,_0x7597('0x17'),JSON[_0x7597('0x18')](_0x147925));if(_0x147925[_0x7597('0x19')]){if(_0x147925['error'][_0x7597('0x1a')]===0x1f4){logger[_0x7597('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1cae93,_0x147925[_0x7597('0x19')][_0x7597('0x1b')]);return _0x3bc316(_0x147925[_0x7597('0x19')][_0x7597('0x1b')]);}logger[_0x7597('0x19')](_0x7597('0x14'),_0x1cae93,_0x147925[_0x7597('0x19')][_0x7597('0x1b')]);return _0x1a1872(_0x147925['error']['message']);}else{logger[_0x7597('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1cae93,_0x7597('0x17'));_0x1a1872(_0x147925[_0x7597('0x1c')][_0x7597('0x1b')]);}})[_0x7597('0x1d')](function(_0x4751f2){logger['error'](_0x7597('0x14'),_0x1cae93,_0x4751f2);_0x3bc316(_0x4751f2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5ae17ff..30e5129 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 _0xc280=['save','update','emit','removeListener','register','length','chatGroup:'];(function(_0x523e93,_0x31200b){var _0x13413a=function(_0x5d5199){while(--_0x5d5199){_0x523e93['push'](_0x523e93['shift']());}};_0x13413a(++_0x31200b);}(_0xc280,0x1b9));var _0x0c28=function(_0x476258,_0xc680e2){_0x476258=_0x476258-0x0;var _0x4e1549=_0xc280[_0x476258];return _0x4e1549;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0c28('0x0'),'remove',_0x0c28('0x1')];function createListener(_0x542711,_0x70a02a){return function(_0x47ab44){_0x70a02a[_0x0c28('0x2')](_0x542711,_0x47ab44);};}function removeListener(_0x4166f1,_0x161350){return function(){ChatGroupEvents[_0x0c28('0x3')](_0x4166f1,_0x161350);};}exports[_0x0c28('0x4')]=function(_0x3218a4){for(var _0x6c05d8=0x0,_0x4e5c8c=events[_0x0c28('0x5')];_0x6c05d8<_0x4e5c8c;_0x6c05d8++){var _0x1ce313=events[_0x6c05d8];var _0x190a97=createListener(_0x0c28('0x6')+_0x1ce313,_0x3218a4);ChatGroupEvents['on'](_0x1ce313,_0x190a97);}}; \ No newline at end of file +var _0xdf18=['save','remove','update','length','chatGroup:','./chatGroup.events'];(function(_0x98d5f5,_0x12ea21){var _0x2826d3=function(_0x2e16b3){while(--_0x2e16b3){_0x98d5f5['push'](_0x98d5f5['shift']());}};_0x2826d3(++_0x12ea21);}(_0xdf18,0x12b));var _0x8df1=function(_0x5be7ff,_0x1c701b){_0x5be7ff=_0x5be7ff-0x0;var _0x5e851d=_0xdf18[_0x5be7ff];return _0x5e851d;};'use strict';var ChatGroupEvents=require(_0x8df1('0x0'));var events=[_0x8df1('0x1'),_0x8df1('0x2'),_0x8df1('0x3')];function createListener(_0x3c7d11,_0x5bce0f){return function(_0x165a73){_0x5bce0f['emit'](_0x3c7d11,_0x165a73);};}function removeListener(_0x3a685b,_0x2e916d){return function(){ChatGroupEvents['removeListener'](_0x3a685b,_0x2e916d);};}exports['register']=function(_0x2cb5fa){for(var _0x31d17e=0x0,_0x260c8d=events[_0x8df1('0x4')];_0x31d17e<_0x260c8d;_0x31d17e++){var _0x36ac9b=events[_0x31d17e];var _0x35f276=createListener(_0x8df1('0x5')+_0x36ac9b,_0x2cb5fa);ChatGroupEvents['on'](_0x36ac9b,_0x35f276);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3cc9246..768d74f 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 _0xaa78=['express','Router','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','create','post','addMessage','put','update','destroy','delete','removeMembers','exports'];(function(_0x2fc087,_0x72b243){var _0x37bfeb=function(_0x3980fa){while(--_0x3980fa){_0x2fc087['push'](_0x2fc087['shift']());}};_0x37bfeb(++_0x72b243);}(_0xaa78,0xc0));var _0x8aa7=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0xaa78[_0xe480f0];return _0x57b198;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8aa7('0x0'));var router=express[_0x8aa7('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8aa7('0x2'));var config=require('../../config/environment');var controller=require(_0x8aa7('0x3'));router[_0x8aa7('0x4')]('/',auth['isAuthenticated'](),controller[_0x8aa7('0x5')]);router['get'](_0x8aa7('0x6'),auth[_0x8aa7('0x7')](),controller['describe']);router['get'](_0x8aa7('0x8'),auth['isAuthenticated'](),controller[_0x8aa7('0x9')]);router[_0x8aa7('0x4')](_0x8aa7('0xa'),auth['isAuthenticated'](),controller[_0x8aa7('0xb')]);router[_0x8aa7('0x4')](_0x8aa7('0xc'),auth[_0x8aa7('0x7')](),controller[_0x8aa7('0xd')]);router[_0x8aa7('0x4')]('/:id/messages',auth[_0x8aa7('0x7')](),controller[_0x8aa7('0xe')]);router['post']('/',auth[_0x8aa7('0x7')](),controller[_0x8aa7('0xf')]);router[_0x8aa7('0x10')]('/:id/members',auth[_0x8aa7('0x7')](),controller['addMembers']);router[_0x8aa7('0x10')]('/:id/messages',auth[_0x8aa7('0x7')](),controller[_0x8aa7('0x11')]);router[_0x8aa7('0x12')](_0x8aa7('0x8'),auth[_0x8aa7('0x7')](),controller[_0x8aa7('0x13')]);router['delete'](_0x8aa7('0x8'),auth[_0x8aa7('0x7')](),controller[_0x8aa7('0x14')]);router[_0x8aa7('0x15')](_0x8aa7('0xc'),auth[_0x8aa7('0x7')](),controller[_0x8aa7('0x16')]);module[_0x8aa7('0x17')]=router; \ No newline at end of file +var _0xd63d=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show'];(function(_0x4f8919,_0x24be23){var _0x44d54a=function(_0x44518e){while(--_0x44518e){_0x4f8919['push'](_0x4f8919['shift']());}};_0x44d54a(++_0x24be23);}(_0xd63d,0x8f));var _0xdd63=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xd63d[_0x4347ec];return _0x4c8314;};'use strict';var multer=require(_0xdd63('0x0'));var util=require('util');var path=require(_0xdd63('0x1'));var timeout=require(_0xdd63('0x2'));var express=require(_0xdd63('0x3'));var router=express[_0xdd63('0x4')]();var fs_extra=require(_0xdd63('0x5'));var auth=require(_0xdd63('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdd63('0x7'));var controller=require('./chatGroup.controller');router[_0xdd63('0x8')]('/',auth[_0xdd63('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdd63('0xa')]);router[_0xdd63('0x8')](_0xdd63('0xb'),auth[_0xdd63('0x9')](),controller[_0xdd63('0xc')]);router[_0xdd63('0x8')]('/:id/unread',auth['isAuthenticated'](),controller['getUnread']);router[_0xdd63('0x8')](_0xdd63('0xd'),auth[_0xdd63('0x9')](),controller[_0xdd63('0xe')]);router[_0xdd63('0x8')](_0xdd63('0xf'),auth[_0xdd63('0x9')](),controller[_0xdd63('0x10')]);router[_0xdd63('0x11')]('/',auth['isAuthenticated'](),controller[_0xdd63('0x12')]);router[_0xdd63('0x11')](_0xdd63('0xd'),auth[_0xdd63('0x9')](),controller[_0xdd63('0x13')]);router[_0xdd63('0x11')]('/:id/messages',auth[_0xdd63('0x9')](),controller['addMessage']);router[_0xdd63('0x14')](_0xdd63('0xb'),auth['isAuthenticated'](),controller[_0xdd63('0x15')]);router[_0xdd63('0x16')]('/:id',auth[_0xdd63('0x9')](),controller[_0xdd63('0x17')]);router[_0xdd63('0x16')]('/:id/members',auth[_0xdd63('0x9')](),controller[_0xdd63('0x18')]);module[_0xdd63('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4882100..3ddc332 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 _0xb78e=['BOOLEAN','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x44e487,_0x457420){_0x44e487=_0x44e487-0x0;var _0x347512=_0xb78e[_0x44e487];return _0x347512;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xeb78('0x2')]},'ratingType':{'type':Sequelize[_0xeb78('0x3')](_0xeb78('0x4'),_0xeb78('0x5')),'defaultValue':_0xeb78('0x4')},'ratingMessage':{'type':Sequelize[_0xeb78('0x6')]},'pathTranscript':{'type':Sequelize[_0xeb78('0x6')]},'mailTranscript':{'type':Sequelize[_0xeb78('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xeb78('0x7')]},'secondDisposition':{'type':Sequelize[_0xeb78('0x7')]},'thirdDisposition':{'type':Sequelize[_0xeb78('0x7')]},'note':{'type':Sequelize[_0xeb78('0x7')]},'browserName':{'type':Sequelize[_0xeb78('0x7')]},'browserVersion':{'type':Sequelize[_0xeb78('0x7')]},'osName':{'type':Sequelize[_0xeb78('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xeb78('0x7')]},'deviceVendor':{'type':Sequelize[_0xeb78('0x7')]},'deviceType':{'type':Sequelize[_0xeb78('0x7')]},'referer':{'type':Sequelize[_0xeb78('0x6')]},'customerIp':{'type':Sequelize[_0xeb78('0x7')]},'formData':{'type':Sequelize[_0xeb78('0x6')](_0xeb78('0x8'))},'read1stAt':{'type':Sequelize[_0xeb78('0x9')]},'lastMsgAt':{'type':Sequelize[_0xeb78('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb78('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xeb78('0x7')]},'customerPort':{'type':Sequelize[_0xeb78('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xeb78('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xeb78('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x6c50=['STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','star','TEXT'];(function(_0x3bcbc6,_0x303850){var _0x3a6389=function(_0x599abe){while(--_0x599abe){_0x3bcbc6['push'](_0x3bcbc6['shift']());}};_0x3a6389(++_0x303850);}(_0x6c50,0xa4));var _0x06c5=function(_0x54c414,_0x51b0a2){_0x54c414=_0x54c414-0x0;var _0x5befc1=_0x6c50[_0x54c414];return _0x5befc1;};'use strict';var Sequelize=require(_0x06c5('0x0'));module[_0x06c5('0x1')]={'closed':{'type':Sequelize[_0x06c5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x06c5('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x06c5('0x4'),'thumb'),'defaultValue':_0x06c5('0x4')},'ratingMessage':{'type':Sequelize[_0x06c5('0x5')]},'pathTranscript':{'type':Sequelize[_0x06c5('0x5')]},'mailTranscript':{'type':Sequelize[_0x06c5('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x06c5('0x7')]},'disposition':{'type':Sequelize[_0x06c5('0x6')]},'secondDisposition':{'type':Sequelize[_0x06c5('0x6')]},'thirdDisposition':{'type':Sequelize[_0x06c5('0x6')]},'note':{'type':Sequelize[_0x06c5('0x6')]},'browserName':{'type':Sequelize[_0x06c5('0x6')]},'browserVersion':{'type':Sequelize[_0x06c5('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x06c5('0x6')]},'deviceModel':{'type':Sequelize[_0x06c5('0x6')]},'deviceVendor':{'type':Sequelize[_0x06c5('0x6')]},'deviceType':{'type':Sequelize[_0x06c5('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x06c5('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x06c5('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x06c5('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x06c5('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x06c5('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 d5a84f9..1894025 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 _0x5f2f=['vidaooMetadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','pick','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','status','end','limit','undefined','count','set','Content-Range','json','apply','save','update','name','merge','body','contact','account','Users','map','fullname','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','union','User','UserId','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','include','options','create','destroy','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a8f7b,_0x4af4db){_0x1a8f7b=_0x1a8f7b-0x0;var _0x1b3eef=_0x5f2f[_0x1a8f7b];return _0x1b3eef;};'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 pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x14'))(_0xf5f2('0x15'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x16'));var licenseUtil=require(_0xf5f2('0x17'));var db=require(_0xf5f2('0x18'))['db'];config[_0xf5f2('0x19')]=_[_0xf5f2('0x1a')](config[_0xf5f2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5f2('0x1b'))(new Redis(config[_0xf5f2('0x19')]));require(_0xf5f2('0x1c'))[_0xf5f2('0x1d')](socket);var jayson=require(_0xf5f2('0x1e'));var client=jayson['client'][_0xf5f2('0x1f')]({'port':0x232b});var client9004=jayson[_0xf5f2('0x20')][_0xf5f2('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1b6dd2,_0x23e23a,_0x3a9dbb,_0xdb61b3){return new BPromise(function(_0x395a5a,_0x11f702){var _0x228ace=_0xdb61b3||client;return _0x228ace[_0xf5f2('0x21')](_0x1b6dd2,_0x3a9dbb)[_0xf5f2('0x22')](function(_0x4ff59b){logger[_0xf5f2('0x23')](_0xf5f2('0x24'),_0x23e23a,_0xf5f2('0x25'));logger[_0xf5f2('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x23e23a,_0xf5f2('0x25'),JSON[_0xf5f2('0x27')](_0x4ff59b));if(_0x4ff59b['error']){if(_0x4ff59b['error'][_0xf5f2('0x28')]===0x1f4){logger[_0xf5f2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);return _0x11f702(_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);}logger[_0xf5f2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);return _0x395a5a(_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);}else{logger[_0xf5f2('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,'request\x20sent');_0x395a5a(_0x4ff59b[_0xf5f2('0x2b')][_0xf5f2('0x2a')]);}})[_0xf5f2('0x2c')](function(_0x1a5bb3){logger[_0xf5f2('0x29')](_0xf5f2('0x24'),_0x23e23a,_0x1a5bb3);_0x11f702(_0x1a5bb3);});});}function respondWithStatusCode(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0xcc;return function(_0x294414){if(_0x294414){return _0x13a3be['sendStatus'](_0x281ec8);}return _0x13a3be[_0xf5f2('0x2d')](_0x281ec8)[_0xf5f2('0x2e')]();};}function respondWithResult(_0x375ca8,_0x31bfcb){_0x31bfcb=_0x31bfcb||0xc8;return function(_0x198c73){if(_0x198c73){return _0x375ca8[_0xf5f2('0x2d')](_0x31bfcb)['json'](_0x198c73);}};}function respondWithFilteredResult(_0x53cb96,_0x22c826){return function(_0x14c829){if(_0x14c829){var _0x11c771=typeof _0x22c826['offset']==='undefined'&&typeof _0x22c826[_0xf5f2('0x2f')]===_0xf5f2('0x30');var _0x17394a=_0x14c829[_0xf5f2('0x31')];var _0x1b381e=_0x11c771?0x0:_0x22c826['offset'];var _0x52e959=_0x11c771?_0x14c829[_0xf5f2('0x31')]:_0x22c826['offset']+_0x22c826[_0xf5f2('0x2f')];var _0x58a4df;if(_0x52e959>=_0x17394a){_0x52e959=_0x17394a;_0x58a4df=0xc8;}else{_0x58a4df=0xce;}_0x53cb96[_0xf5f2('0x2d')](_0x58a4df);return _0x53cb96[_0xf5f2('0x32')](_0xf5f2('0x33'),_0x1b381e+'-'+_0x52e959+'/'+_0x17394a)[_0xf5f2('0x34')](_0x14c829);}return null;};}function patchUpdates(_0x256bd9){return function(_0x277eee){try{jsonpatch[_0xf5f2('0x35')](_0x277eee,_0x256bd9,!![]);}catch(_0x2c0e05){return BPromise['reject'](_0x2c0e05);}return _0x277eee[_0xf5f2('0x36')]();};}function saveUpdates(_0x43e4ff,_0x4590ec){return function(_0x43c77d){if(_0x43c77d){return _0x43c77d[_0xf5f2('0x37')](_0x43e4ff)[_0xf5f2('0x22')](function(_0x297c0c){return _0x297c0c;});}return null;};}function removeEntity(_0x48d64d,_0x144646){return function(_0xf503e8){if(_0xf503e8){return _0xf503e8['destroy']()[_0xf5f2('0x22')](function(){_0x48d64d['status'](0xcc)[_0xf5f2('0x2e')]();});}};}function handleEntityNotFound(_0x3930fb,_0x2a2c31){return function(_0x2e3cca){if(!_0x2e3cca){_0x3930fb['sendStatus'](0x194);}return _0x2e3cca;};}function handleError(_0x5a98d7,_0x41088b){_0x41088b=_0x41088b||0x1f4;return function(_0x46ad4a){logger[_0xf5f2('0x29')](_0x46ad4a['stack']);if(_0x46ad4a[_0xf5f2('0x38')]){delete _0x46ad4a['name'];}_0x5a98d7[_0xf5f2('0x2d')](_0x41088b)['send'](_0x46ad4a);};}function getMustacheRender(_0x46f464,_0x456764){return Mustache['render'](_0x46f464,_[_0xf5f2('0x39')](_0x456764[_0xf5f2('0x3a')],{'contact':_0x456764[_0xf5f2('0x3b')],'message':_0x456764[_0xf5f2('0x2a')],'agent':_0x456764['agent'],'interaction':_0x456764['interaction'],'account':_0x456764[_0xf5f2('0x3c')]}))||'';}function getInteractionUsers(_0x140a11,_0x22b20c){return new BPromise(function(_0x2d4400,_0x2c7f65){try{if(_0x22b20c[_0x140a11['id']]){_0x140a11[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x22b20c[_0x140a11['id']],function(_0x4c0ac7){return{'id':_0x4c0ac7['id'],'fullname':_0x4c0ac7[_0xf5f2('0x3f')]};});}}catch(_0x3b4ea6){_0x2c7f65(_0x3b4ea6);}_0x2d4400(_0x140a11);});}function getInteractionTags(_0x536501,_0xc6a1ae){return new BPromise(function(_0x3f3895,_0x71b0e7){try{if(_0x536501[_0xf5f2('0x40')]){_0x536501[_0xf5f2('0x41')]=[];_0x536501[_0xf5f2('0x40')][_0xf5f2('0x42')](',')[_0xf5f2('0x43')](function(_0x574f24){_0x536501[_0xf5f2('0x41')][_0xf5f2('0x44')](_0xc6a1ae[_0x574f24]);});}delete _0x536501[_0xf5f2('0x40')];}catch(_0x4a8e39){_0x71b0e7(_0x4a8e39);}_0x3f3895(_0x536501);});}function updateChatInteraction(_0x509dbc,_0x59eb00,_0x76d21b){return new BPromise(function(_0x2ad13c,_0x4c8d8e){return getInteractionUsers(_0x509dbc,_0x76d21b)[_0xf5f2('0x22')](function(_0xeed03d){return getInteractionTags(_0xeed03d,_0x59eb00);})[_0xf5f2('0x22')](function(_0x31f86c){_0x2ad13c(_0x31f86c);})[_0xf5f2('0x2c')](function(_0x2b3b1c){_0x4c8d8e(_0x2b3b1c);});});}exports[_0xf5f2('0x45')]=function(_0x212e90,_0x40c322){var _0x106062={},_0x444317={},_0x4773cd={'count':0x0,'rows':[]};var _0x4252a3=_[_0xf5f2('0x3e')](db['ChatInteraction'][_0xf5f2('0x46')],function(_0x578c93){return{'name':_0x578c93[_0xf5f2('0x47')],'type':_0x578c93[_0xf5f2('0x48')][_0xf5f2('0x49')]};});_0x444317[_0xf5f2('0x4a')]=_[_0xf5f2('0x3e')](_0x4252a3,_0xf5f2('0x38'));_0x444317['query']=_[_0xf5f2('0x4b')](_0x212e90[_0xf5f2('0x4c')]);_0x444317[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x444317[_0xf5f2('0x4a')],_0x444317[_0xf5f2('0x4c')]);_0x106062[_0xf5f2('0x4f')]=_[_0xf5f2('0x4e')](_0x444317['model'],qs[_0xf5f2('0x50')](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x106062['attributes']=_0x106062[_0xf5f2('0x4f')][_0xf5f2('0x51')]?_0x106062[_0xf5f2('0x4f')]:_0x444317['model'];if(!_0x212e90['query'][_0xf5f2('0x52')](_0xf5f2('0x53'))){_0x106062['limit']=qs[_0xf5f2('0x2f')](_0x212e90['query'][_0xf5f2('0x2f')]);_0x106062['offset']=qs[_0xf5f2('0x54')](_0x212e90['query'][_0xf5f2('0x54')]);}_0x106062[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x212e90[_0xf5f2('0x4c')]['sort']);_0x106062[_0xf5f2('0x57')]=qs[_0xf5f2('0x4d')](_['pick'](_0x212e90['query'],_0x444317[_0xf5f2('0x4d')]),_0x4252a3);var _0x3dc0c4=[];var _0x57782c=squel[_0xf5f2('0x58')]()[_0xf5f2('0x59')]('id')[_0xf5f2('0x59')](_0xf5f2('0x38'))['field']('color')[_0xf5f2('0x5a')](_0xf5f2('0x5b'));var _0x4b62fc=squel[_0xf5f2('0x58')]()[_0xf5f2('0x59')](_0xf5f2('0x5c'))[_0xf5f2('0x59')](_0xf5f2('0x5d'))[_0xf5f2('0x59')](_0xf5f2('0x5e'))['from']('user_has_chat_interactions','ui')[_0xf5f2('0x5f')](_0xf5f2('0x60'),'u',_0xf5f2('0x61'));var _0x46a905=squel[_0xf5f2('0x58')]()['from'](_0xf5f2('0x62'),'i')[_0xf5f2('0x5f')](_0xf5f2('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf5f2('0x5f')]('users','o',_0xf5f2('0x64'))[_0xf5f2('0x5f')](_0xf5f2('0x65'),'a',_0xf5f2('0x66'))['left_join']('chat_messages','me',_0xf5f2('0x67'))['left_join'](_0xf5f2('0x68'),'it',_0xf5f2('0x69'))['left_join'](_0xf5f2('0x5b'),'t',_0xf5f2('0x6a'));var _0x2a8f6d=squel['expr']();var _0x397b99=[];var _0xcf7a50=squel[_0xf5f2('0x6b')]();var _0x4579f4;if(_0x212e90['query'][_0xf5f2('0x6c')]){_0x4579f4=as['parseSearch'](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x6c')]);var _0x2e6f5d=_0x4579f4[_0xf5f2('0x6d')];for(var _0x9f210e=0x0;_0x9f210e<_0x4579f4['conditions'][_0xf5f2('0x51')];_0x9f210e++){var _0xacd80=_0x4579f4[_0xf5f2('0x6e')][_0x9f210e];var _0x212639='i';var _0x2c5733=_['find'](_0x4252a3,[_0xf5f2('0x38'),_0xacd80['field']]);if(!_0x2c5733){switch(_0xacd80['field']){case _0xf5f2('0x6f'):if(_0xacd80['value']==0x1){_0x46a905[_0xf5f2('0x70')]('`'+_0xacd80[_0xf5f2('0x59')]+_0xf5f2('0x71'));}else{_0x46a905[_0xf5f2('0x70')]('`'+_0xacd80['field']+_0xf5f2('0x72'));}break;case _0xf5f2('0x73'):if(_0xacd80[_0xf5f2('0x74')]===_0xf5f2('0x75')){if(_0xacd80[_0xf5f2('0x76')][_0xf5f2('0x42')]('\x20')[_0xf5f2('0x51')]>0x1){_0x2a8f6d[_0x2e6f5d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf5f2('0x77')](_0xacd80[_0xf5f2('0x76')]),null);}else{var _0xb39a6e='%'+_0xacd80[_0xf5f2('0x76')]+'%';_0x2a8f6d[_0x2e6f5d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xb39a6e,_0xb39a6e,_0xb39a6e);}}else{_0x2c5733=_[_0xf5f2('0x78')](_0x4252a3,['name',_0xf5f2('0x79')]);_0xacd80[_0xf5f2('0x59')]='ContactId';_0x5a143f=as[_0xf5f2('0x7a')](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value'][_0xf5f2('0x2e')]);}break;case _0xf5f2('0x7d'):var _0x3a0e75=_0xacd80[_0xf5f2('0x76')][_0xf5f2('0x42')](',')[_0xf5f2('0x3e')](function(_0x53284f){return Number(_0x53284f);});_0x3a0e75[_0xf5f2('0x43')](function(_0x3f475e){_0xcf7a50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f475e+',%');});_0x397b99=_[_0xf5f2('0x7e')](_0x397b99,_0x3a0e75);break;case _0xf5f2('0x7f'):if(_0xacd80[_0xf5f2('0x74')]==='$substring'){_0x2a8f6d[_0x2e6f5d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xacd80['value']+'%',null);}else{_0x2c5733=_[_0xf5f2('0x78')](_0x4252a3,[_0xf5f2('0x38'),_0xf5f2('0x80')]);_0xacd80[_0xf5f2('0x59')]=_0xf5f2('0x80');_0x5a143f=as['buildExpression'](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x2e')]);}break;case _0xf5f2('0x3a'):_0x5a143f=as[_0xf5f2('0x7a')]('me',null,_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value']['end']);break;}}else{var _0x5a143f=as[_0xf5f2('0x7a')](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value'][_0xf5f2('0x2e')]);}}}else{var _0x43c732=_(_0x212e90[_0xf5f2('0x4c')])[_0xf5f2('0x4b')]()[_0xf5f2('0x3e')](function(_0x55748d){return _[_0xf5f2('0x81')](_0x4252a3,[_0xf5f2('0x38'),_0x55748d])?_0x55748d:undefined;})['compact']()[_0xf5f2('0x76')]();if(!_[_0xf5f2('0x82')](_0x43c732)){_0x43c732[_0xf5f2('0x43')](function(_0x30ac41){if(_0x30ac41==='ChatWebsiteId'){_0x46a905[_0xf5f2('0x57')](_0xf5f2('0x83'),[][_0xf5f2('0x84')](_0x212e90[_0xf5f2('0x4c')][_0x30ac41]));}else if(_0x30ac41===_0xf5f2('0x85')){var _0x4f47e1=JSON['parse'](_0x212e90[_0xf5f2('0x4c')][_0x30ac41])[_0xf5f2('0x86')];var _0x17eb69=JSON[_0xf5f2('0x87')](_0x212e90['query'][_0x30ac41])['$lte'];_0x46a905[_0xf5f2('0x57')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f47e1,_0x17eb69);}else{if(_0x212e90['query'][_0x30ac41]==='null'){_0x46a905['where']('i.'+_0x30ac41+_0xf5f2('0x88'));}else{_0x46a905[_0xf5f2('0x57')]('i.'+_0x30ac41+_0xf5f2('0x89'),_0x212e90[_0xf5f2('0x4c')][_0x30ac41]);}}});}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8a')]){if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8a')]==0x1){_0x46a905[_0xf5f2('0x70')](_0xf5f2('0x8b'));}else{_0x46a905[_0xf5f2('0x70')](_0xf5f2('0x8c'));}}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')]){_0x397b99=_[_0xf5f2('0x8e')](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')])?_0x212e90[_0xf5f2('0x4c')]['tag']:new Array(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')]);_0x397b99[_0xf5f2('0x43')](function(_0x2811ad){_0xcf7a50['or'](_0xf5f2('0x8f'),'%,'+_0x2811ad+',%');});}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x90')]){var _0xcf48eb=_0x212e90['query'][_0xf5f2('0x90')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0xcf48eb)){_0x2a8f6d['or']('i.id\x20LIKE\x20?',_0xcf48eb+'%');}else{_0x2a8f6d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xcf48eb))['or'](_0xf5f2('0x91'),_0xcf48eb+'%');}}}_0x46a905[_0xf5f2('0x57')](_0x2a8f6d);_0x46a905[_0xf5f2('0x92')](_0xf5f2('0x93'));var _0x145d4d={'type':db[_0xf5f2('0x94')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2fb1a6=_0x46a905['clone']();_0x2fb1a6[_0xf5f2('0x59')](_0xf5f2('0x93'));_0x2fb1a6['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf5f2('0x6f'));if(_0x106062[_0xf5f2('0x55')]){_0x106062['order'][_0xf5f2('0x43')](function(_0x388b32){var _0x49e363=_0x388b32[0x0]===_0xf5f2('0x95')?_0x388b32[0x0]:'i.'+_0x388b32[0x0];_0x46a905[_0xf5f2('0x55')](_0x49e363,_0x388b32[0x1]===_0xf5f2('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x397b99)){_0x46a905[_0xf5f2('0x70')](_0xcf7a50);_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x97'),_0x397b99);}BPromise[_0xf5f2('0x98')]()[_0xf5f2('0x22')](function(){if(!_0x4579f4){if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x99')])return;_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x9a'));_0x46a905[_0xf5f2('0x57')](_0xf5f2('0x9a'));return;}if(_0x212e90[_0xf5f2('0x9b')][_0xf5f2('0x9c')]!==_0xf5f2('0x9d'))return;return _0x212e90[_0xf5f2('0x9b')][_0xf5f2('0x9e')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x22')](function(_0x29a9d4){if(_[_0xf5f2('0x82')](_0x29a9d4)){_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x9f'));_0x46a905['where'](_0xf5f2('0x9f'));}else{_0x2fb1a6[_0xf5f2('0x57')]('i.ChatWebsiteId\x20IN\x20?',_[_0xf5f2('0x3e')](_0x29a9d4,'id'));_0x46a905[_0xf5f2('0x57')]('i.ChatWebsiteId\x20IN\x20?',_[_0xf5f2('0x3e')](_0x29a9d4,'id'));}});})[_0xf5f2('0x22')](function(){if(_0x212e90[_0xf5f2('0x9b')]['role']==='agent'&&!_0x4579f4&&!_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x99')])return[];return db[_0xf5f2('0xa0')]['query'](_0x2fb1a6['toString'](),_0x145d4d);})[_0xf5f2('0x22')](function(_0xcdc6fd){_0x4773cd[_0xf5f2('0x31')]=_0xcdc6fd['length'];if(_0x4773cd['count']===0x0)return[];return db['sequelize']['query'](_0x57782c['toString'](),_0x145d4d)[_0xf5f2('0x22')](function(_0x561bab){_0x3dc0c4=_[_0xf5f2('0xa1')](_0x561bab,'id');_0x145d4d=_[_0xf5f2('0x39')](_0x145d4d,{'model':db[_0xf5f2('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x50')]){_0x106062[_0xf5f2('0x4f')][_0xf5f2('0x43')](function(_0x40e921){_0x46a905[_0xf5f2('0x59')]('i.'+_0x40e921);});}else{_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xa3'),_0xf5f2('0x6f'));_0x46a905[_0xf5f2('0x59')]('a.key',_0xf5f2('0xa4'));_0x46a905[_0xf5f2('0x59')]('a.mandatoryDisposition',_0xf5f2('0xa5'));_0x46a905[_0xf5f2('0x59')]('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',_0xf5f2('0x95'));_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xa6'));_0x46a905['field'](_0xf5f2('0xa7'),_0xf5f2('0xa8'));_0x46a905['field'](_0xf5f2('0xa9'),_0xf5f2('0xaa'));_0x46a905[_0xf5f2('0x59')]('c.email',_0xf5f2('0xab'));_0x46a905['field'](_0xf5f2('0xac'),'Contact.phone');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xad'),_0xf5f2('0xae'));_0x46a905[_0xf5f2('0x59')]('c.fax',_0xf5f2('0xaf'));_0x46a905['field']('o.fullname','Owner.fullname');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xb0'),'Owner.internal');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xb1'),_0xf5f2('0x40'));}if(_0x106062[_0xf5f2('0x2f')])_0x46a905[_0xf5f2('0x2f')](_0x106062[_0xf5f2('0x2f')]);if(_0x106062['offset'])_0x46a905[_0xf5f2('0x54')](_0x106062[_0xf5f2('0x54')]);return db['sequelize'][_0xf5f2('0x4c')](_0x46a905[_0xf5f2('0xb2')](),_0x145d4d);})['then'](function(_0x32301a){if(_0x32301a[_0xf5f2('0x51')]>0x0)_0x4b62fc[_0xf5f2('0x57')](_0xf5f2('0xb3'),_[_0xf5f2('0x3e')](_0x32301a,'id'));return db[_0xf5f2('0xa0')]['query'](_0x4b62fc[_0xf5f2('0xb2')](),_0x145d4d)[_0xf5f2('0x22')](function(_0x13fcb0){var _0x792c75=_[_0xf5f2('0xb4')](_0x13fcb0,_0xf5f2('0xb5'));var _0x162c13=[];_0x32301a[_0xf5f2('0x43')](function(_0x3e4e40){_0x162c13['push'](updateChatInteraction(_0x3e4e40,_0x3dc0c4,_0x792c75));});return BPromise[_0xf5f2('0xb6')](_0x162c13);});});})[_0xf5f2('0x22')](function(_0xdbb2cd){_0x4773cd[_0xf5f2('0xb7')]=_0xdbb2cd;return _0x4773cd;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x40c322,_0x106062))[_0xf5f2('0x2c')](handleError(_0x40c322,null));};exports[_0xf5f2('0xb8')]=function(_0x56f4b4,_0x33cfe7){var _0x40d0eb={'raw':![],'where':{'id':_0x56f4b4['params']['id']}},_0x4c138c={};_0x4c138c[_0xf5f2('0x4a')]=_[_0xf5f2('0x4b')](db[_0xf5f2('0xa2')][_0xf5f2('0x46')]);_0x4c138c['query']=_[_0xf5f2('0x4b')](_0x56f4b4[_0xf5f2('0x4c')]);_0x4c138c[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x4c138c[_0xf5f2('0x4a')],_0x4c138c['query']);_0x40d0eb[_0xf5f2('0x4f')]=_[_0xf5f2('0x4e')](_0x4c138c['model'],qs[_0xf5f2('0x50')](_0x56f4b4[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x40d0eb[_0xf5f2('0x4f')]=_0x40d0eb['attributes'][_0xf5f2('0x51')]?_0x40d0eb[_0xf5f2('0x4f')]:_0x4c138c[_0xf5f2('0x4a')];if(_0x56f4b4['query']['includeAll']){_0x40d0eb[_0xf5f2('0xb9')]=[{'all':!![]}];}_0x40d0eb=_[_0xf5f2('0x39')]({},_0x40d0eb,_0x56f4b4[_0xf5f2('0xba')]);return db[_0xf5f2('0xa2')][_0xf5f2('0x78')](_0x40d0eb)[_0xf5f2('0x22')](handleEntityNotFound(_0x33cfe7,null))['then'](respondWithResult(_0x33cfe7,null))[_0xf5f2('0x2c')](handleError(_0x33cfe7,null));};exports['create']=function(_0x151f13,_0x1624a4){return db[_0xf5f2('0xa2')][_0xf5f2('0xbb')](_0x151f13[_0xf5f2('0x3a')],{})[_0xf5f2('0x22')](respondWithResult(_0x1624a4,0xc9))['catch'](handleError(_0x1624a4,null));};exports[_0xf5f2('0x37')]=function(_0x409ed1,_0x457b53){if(_0x409ed1[_0xf5f2('0x3a')]['id']){delete _0x409ed1[_0xf5f2('0x3a')]['id'];}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x409ed1['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x457b53,null))['then'](saveUpdates(_0x409ed1['body'],null))['then'](respondWithResult(_0x457b53,null))[_0xf5f2('0x2c')](handleError(_0x457b53,null));};exports[_0xf5f2('0xbc')]=function(_0x568806,_0x3487df){return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x568806[_0xf5f2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3487df,null))[_0xf5f2('0x22')](removeEntity(_0x3487df,null))[_0xf5f2('0x2c')](handleError(_0x3487df,null));};exports[_0xf5f2('0xbe')]=function(_0x5d3ca7,_0x29f7bd){return db[_0xf5f2('0xa2')]['describe']()[_0xf5f2('0x22')](respondWithResult(_0x29f7bd,null))[_0xf5f2('0x2c')](handleError(_0x29f7bd,null));};exports[_0xf5f2('0xbf')]=function(_0x1583bb,_0x176974){var _0x8b591c=_0x1583bb[_0xf5f2('0xbd')]['id'];var _0x2c242b;var _0x155007;var _0x4782da;return db[_0xf5f2('0xa2')]['findOne']({'where':{'id':_0x8b591c}})[_0xf5f2('0x22')](function(_0x31dbfa){_0x2c242b=_0x31dbfa;return db['ChatWebsite'][_0xf5f2('0xc0')]({'where':{'id':_0x31dbfa['ChatWebsiteId']},'attributes':['id',_0xf5f2('0xc1'),_0xf5f2('0xc2'),_0xf5f2('0xc3'),_0xf5f2('0xc4'),'vidaooMetadata'],'raw':!![]});})[_0xf5f2('0x22')](function(_0x5a104b){if(_0x5a104b&&_0x5a104b[_0xf5f2('0xc1')]&&_0x5a104b['vidaooEscalation']){_0x155007=_0x5a104b;var _0x3310cb={'interaction':{'id':_0x8b591c},'agent':{'id':_0x1583bb[_0xf5f2('0x9b')]['id'],'name':_0x1583bb['user'][_0xf5f2('0x38')],'fullname':_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0x3f')],'email':_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0xc5')]},'contact':_0x1583bb[_0xf5f2('0x3a')]['contact'],'account':_0x1583bb['body'][_0xf5f2('0x3c')]};var _0x17e1eb={'rejectUnauthorized':![],'method':'POST','url':_0xf5f2('0xc6'),'headers':{'X-APIKEY':_0x5a104b[_0xf5f2('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0xc5')]],'buttons':null,'topic':_0x155007[_0xf5f2('0xc3')],'note':_[_0xf5f2('0xc7')](_0x155007[_0xf5f2('0xc4')])?null:getMustacheRender(_0x155007['vidaooNote'],_0x3310cb),'metadata':null},'redirect':_0xf5f2('0xc8'),'json':!![]};try{if(!_['isNull'](_0x155007[_0xf5f2('0xc9')])){var _0x5ec0f3=getMustacheRender(_0x155007[_0xf5f2('0xc9')],_0x3310cb);var _0x4f2531=JSON[_0xf5f2('0x87')](_0x5ec0f3);_0x17e1eb['body']['metadata']=_0x4f2531;}}catch(_0x2c285c){throw new db[(_0xf5f2('0x94'))]['ValidationError'](_0xf5f2('0xca'));}return rp(_0x17e1eb);}else{throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xcc'));}})[_0xf5f2('0x22')](function(_0x25af1e){_0x4782da=_0x25af1e;if(_0x4782da['id']){var _0xd0b5d={'body':_0x4782da[_0xf5f2('0xcd')],'ChatWebsiteId':_0x155007['id'],'ChatInteractionId':_0x2c242b['id'],'direction':'out','UserId':_0x1583bb['user']['id']};return db[_0xf5f2('0xce')]['create'](_0xd0b5d,{});}else{throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xcf'));}})[_0xf5f2('0x22')](function(){return _0x2c242b[_0xf5f2('0xd0')]({'vidaooSessionId':_0x4782da['id']});})[_0xf5f2('0x22')](respondWithResult(_0x176974,null))[_0xf5f2('0x2c')](handleError(_0x176974,null));};exports[_0xf5f2('0xd1')]=function(_0x28f65b,_0x16cbd3){if(_0x28f65b[_0xf5f2('0x3a')]['id']){delete _0x28f65b[_0xf5f2('0x3a')]['id'];}return db['ChatInteraction'][_0xf5f2('0x78')]({'where':{'id':_0x28f65b['params']['id']},'include':[{'model':db[_0xf5f2('0xd2')],'as':_0xf5f2('0x73')}]})[_0xf5f2('0x22')](handleEntityNotFound(_0x16cbd3,null))[_0xf5f2('0x22')](saveUpdates(_0x28f65b[_0xf5f2('0x3a')],null))[_0xf5f2('0x22')](respondWithResult(_0x16cbd3,null))[_0xf5f2('0x2c')](handleError(_0x16cbd3,null));};exports[_0xf5f2('0xd3')]=function(_0x29db4f,_0x377c68,_0xe0f288){if(_0x29db4f['body']['id']){delete _0x29db4f[_0xf5f2('0x3a')]['id'];}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x29db4f[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](function(_0x3f8794){if(!_0x3f8794){logger[_0xf5f2('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf5f2('0xd3'),0x194,_0xf5f2('0xd4'));_0x377c68[_0xf5f2('0xd5')](0x194);}else{if(_0x3f8794[_0xf5f2('0x80')]){throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xd6'));}}return _0x3f8794;})[_0xf5f2('0x22')](function(_0x356155){if(_0x356155){return _0x356155[_0xf5f2('0x37')]({'closed':_0x29db4f[_0xf5f2('0x3a')][_0xf5f2('0xd7')],'disposition':_0x29db4f[_0xf5f2('0x3a')][_0xf5f2('0xd8')]})[_0xf5f2('0x22')](function(_0x654b1b){return _0x654b1b;});}})['then'](function(_0x25566a){return respondWithRpcPromise(_0xf5f2('0xd9'),'abandon',_0x29db4f['body'],client9004);})[_0xf5f2('0x22')](respondWithResult(_0x377c68,null))[_0xf5f2('0x2c')](handleError(_0x377c68,null));};exports[_0xf5f2('0xda')]=function(_0x2c8f4c,_0x529d6f,_0x28cc){_0x2c8f4c[_0xf5f2('0x3a')][_0xf5f2('0x38')]=_0x2c8f4c[_0xf5f2('0xdb')][_0xf5f2('0xdc')];_0x2c8f4c[_0xf5f2('0x3a')]['basename']=_0x2c8f4c[_0xf5f2('0xdb')]['filename'];_0x2c8f4c['body'][_0xf5f2('0x48')]=_0x2c8f4c[_0xf5f2('0xdb')][_0xf5f2('0xdd')];return db[_0xf5f2('0xde')][_0xf5f2('0xbb')](_0x2c8f4c[_0xf5f2('0x3a')])[_0xf5f2('0x22')](respondWithResult(_0x529d6f,0xc9))['catch'](handleError(_0x529d6f,null));};exports[_0xf5f2('0xdf')]=function(_0x3a2862,_0x2c1160,_0x5e6c83){return db[_0xf5f2('0xa2')]['findOne']({'where':{'id':_0x3a2862['params']['id']},'raw':!![]})[_0xf5f2('0x22')](handleEntityNotFound(_0x2c1160,null))['then'](function(_0x2389b7){if(_0x2389b7){if(_0x2389b7[_0xf5f2('0xd7')]){return _0x2c1160['status'](0x193)[_0xf5f2('0x34')]({'status':0x193,'message':_0xf5f2('0xe0')});}return db['Attachment'][_0xf5f2('0xc0')]({'where':{'id':_0x3a2862[_0xf5f2('0x4c')][_0xf5f2('0xe1')]},'raw':!![]})[_0xf5f2('0x22')](handleEntityNotFound(_0x2c1160,null));}})[_0xf5f2('0x22')](function(_0x47a28a){if(_0x47a28a){var _0x182fa7=_0x47a28a[_0xf5f2('0xe2')]!==null;var _0x4d9048=path['join'](config[_0xf5f2('0xe3')],_0xf5f2('0xe4'));if(_0x182fa7){_0x4d9048=path[_0xf5f2('0xe5')](_0x4d9048,_0xf5f2('0xe6'));}var _0x1f51d8=path[_0xf5f2('0xe5')](_0x4d9048,_0x47a28a[_0xf5f2('0xe7')]);return _0x2c1160[_0xf5f2('0xe8')](_0x1f51d8);}})['catch'](handleError(_0x2c1160,null));};exports['close']=function(_0xc86ed5,_0x5be398){var _0x34abb6=null;var _0x235c30=null;var _0x15b060=null;var _0x422e88=null;if(_0xc86ed5['body']['id']){delete _0xc86ed5[_0xf5f2('0x3a')]['id'];}if(_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xe9')]){_0x422e88=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],'server/files/chat/upload/',util[_0xf5f2('0xea')](_0xf5f2('0xeb'),Date[_0xf5f2('0xec')]()));_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xed')]=_0x422e88;}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0xc86ed5[_0xf5f2('0xbd')]['id']},'include':[{'model':db[_0xf5f2('0xce')],'as':_0xf5f2('0xee'),'include':[{'model':db[_0xf5f2('0x7f')],'as':_0xf5f2('0x7f')}]}]})['then'](handleEntityNotFound(_0x5be398,null))[_0xf5f2('0x22')](saveUpdates(_0xc86ed5['body'],null))[_0xf5f2('0x22')](function(_0x349efe){if(_0x349efe){_0x34abb6=_0x349efe;return db[_0xf5f2('0xef')][_0xf5f2('0x78')]({'where':{'id':_0x34abb6[_0xf5f2('0x99')]}});}})[_0xf5f2('0x22')](function(_0x2cd0b7){if(_0x2cd0b7){_0x15b060=_0x2cd0b7;return db[_0xf5f2('0xd2')][_0xf5f2('0x78')]({'where':{'id':_0x34abb6[_0xf5f2('0x79')]}});}})[_0xf5f2('0x22')](function(_0x2b6f46){if(_0x2b6f46){_0x235c30=_0x2b6f46;if(_0x422e88){var _0xf53f16=null;for(var _0xd45a63=0x1;_0xd45a63<_0x34abb6[_0xf5f2('0xee')][_0xf5f2('0x51')];++_0xd45a63){_0xf53f16=_0x34abb6[_0xf5f2('0xee')][_0xd45a63];var _0x33f987=_0xf53f16['UserId']?util[_0xf5f2('0xea')]('%s%d',_0x15b060['agentAlias'],_0xf53f16[_0xf5f2('0x80')]):_0xf5f2('0xf0');var _0x53e85c=_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xf1')]||util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0xf5f2('0xf3'),_0xf53f16[_0xf5f2('0x79')]);switch(_0x15b060[_0xf5f2('0xf4')]){case _0xf5f2('0xf5'):_0x33f987=_0xf53f16['UserId']?util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0x15b060[_0xf5f2('0xf6')],_0xf53f16['UserId']):_0xf5f2('0xf0');break;case _0xf5f2('0xf7'):_0x33f987=_0xf53f16[_0xf5f2('0x80')]?_0xf53f16[_0xf5f2('0x7f')]['alias']||_0xf53f16['User'][_0xf5f2('0x3f')]:_0xf5f2('0xf0');break;case _0xf5f2('0xf8'):_0x33f987=_0xf53f16[_0xf5f2('0x80')]?_0xf53f16[_0xf5f2('0x7f')][_0xf5f2('0x3f')]:_0xf5f2('0xf0');break;default:_0x33f987=_0xf53f16[_0xf5f2('0x80')]?util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0x15b060['agentAlias'],_0xf53f16[_0xf5f2('0x80')]):_0xf5f2('0xf0');}var _0x3881cd=util['format'](_0xf5f2('0xf9'),moment(_0xf53f16[_0xf5f2('0x85')])['format'](_0xf5f2('0xfa')),_0xf53f16['direction']==='in'?_0x53e85c:_0x33f987,_0xf53f16[_0xf5f2('0x3a')]);if(!_0xf53f16[_0xf5f2('0xfb')]){fs['appendFileSync'](_0x422e88,_0x3881cd);}}return db[_0xf5f2('0xfc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf5f2('0xfd')],'as':_0xf5f2('0xfe'),'raw':!![]}]});}}})['then'](function(_0x3971ee){if(_0x3971ee&&_0x3971ee[_0xf5f2('0xfe')]&&_0xc86ed5[_0xf5f2('0x3a')]){var _0xfeccdd={'tls':{'rejectUnauthorized':![]}};if(_0x3971ee[_0xf5f2('0xfe')]['service']){_0xfeccdd[_0xf5f2('0xff')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0xff')];}else{_0xfeccdd[_0xf5f2('0x100')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x100')];_0xfeccdd[_0xf5f2('0x101')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x101')];_0xfeccdd['secure']=_0x3971ee[_0xf5f2('0xfe')]['secure'];}if(_0x3971ee['Smtp'][_0xf5f2('0x102')]){_0xfeccdd[_0xf5f2('0x103')]={'user':_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x9b')],'pass':_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x104')]};}return respondWithRpcPromise(_0xf5f2('0x105'),_0xf5f2('0x106'),{'account':_0xfeccdd,'message':{'from':util[_0xf5f2('0xea')](_0xf5f2('0x107'),_0x3971ee['name'],_0x3971ee['email']||_0x3971ee['Smtp'][_0xf5f2('0x9b')]),'to':_0xc86ed5['body'][_0xf5f2('0xe9')],'subject':_0xf5f2('0x108'),'text':util[_0xf5f2('0xea')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xe9')]),'attachments':[{'path':_0x422e88}]}})['then'](function(){return _0x34abb6;})['catch'](function(_0x4d0709){console[_0xf5f2('0x29')](_0x4d0709);});}else{return _0x34abb6;}})[_0xf5f2('0x22')](respondWithStatusCode(_0x5be398,0xc8))[_0xf5f2('0x2c')](handleError(_0x5be398,null));};exports['addMessage']=function(_0x2cfa84,_0x4a22fb,_0x7cf1b6){return db[_0xf5f2('0xce')][_0xf5f2('0x78')]({'where':{'id':_0x2cfa84['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x4a22fb,null))['then'](function(_0x1b88b5){if(_0x1b88b5){return _0x1b88b5[_0xf5f2('0x109')](_0x2cfa84[_0xf5f2('0x3a')]['ids'],_[_0xf5f2('0x10a')](_0x2cfa84[_0xf5f2('0x3a')],['ids','id'])||{});}})[_0xf5f2('0x22')](respondWithResult(_0x4a22fb,null))[_0xf5f2('0x2c')](handleError(_0x4a22fb,null));};exports[_0xf5f2('0x10b')]=function(_0x29526c,_0x2a52e3,_0x439c9f){var _0x44adaa={'raw':![],'where':{}};var _0x3c7058={};var _0x3bcb44={'count':0x0,'rows':[]};return db[_0xf5f2('0xa2')][_0xf5f2('0xc0')]({'where':{'id':_0x29526c[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x2a52e3,null))[_0xf5f2('0x22')](function(_0x23675a){if(_0x23675a){_0x3c7058[_0xf5f2('0x4a')]=_[_0xf5f2('0x4b')](db[_0xf5f2('0xce')][_0xf5f2('0x46')]);_0x3c7058[_0xf5f2('0x4c')]=_[_0xf5f2('0x4b')](_0x29526c[_0xf5f2('0x4c')]);_0x3c7058['filters']=_[_0xf5f2('0x4e')](_0x3c7058[_0xf5f2('0x4a')],_0x3c7058[_0xf5f2('0x4c')]);_0x44adaa[_0xf5f2('0x4f')]=_['intersection'](_0x3c7058[_0xf5f2('0x4a')],qs['fields'](_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x44adaa[_0xf5f2('0x4f')]=_0x44adaa[_0xf5f2('0x4f')][_0xf5f2('0x51')]?_0x44adaa[_0xf5f2('0x4f')]:_0x3c7058[_0xf5f2('0x4a')];if(!_0x29526c['query']['hasOwnProperty'](_0xf5f2('0x53'))){_0x44adaa[_0xf5f2('0x2f')]=qs[_0xf5f2('0x2f')](_0x29526c[_0xf5f2('0x4c')]['limit']);_0x44adaa[_0xf5f2('0x54')]=qs[_0xf5f2('0x54')](_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x54')]);}_0x44adaa[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x29526c['query']['sort']);_0x44adaa['where']=qs[_0xf5f2('0x4d')](_[_0xf5f2('0x10c')](_0x29526c[_0xf5f2('0x4c')],_0x3c7058['filters']));_0x44adaa[_0xf5f2('0x57')]['ChatInteractionId']=_0x23675a['id'];if(_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x90')]){_0x44adaa[_0xf5f2('0x57')]=_[_0xf5f2('0x39')](_0x44adaa[_0xf5f2('0x57')],{'$or':_[_0xf5f2('0x3e')](_0x44adaa[_0xf5f2('0x4f')],function(_0xece862){var _0x3b4121={};_0x3b4121[_0xece862]={'$like':'%'+_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x90')]+'%'};return _0x3b4121;})});}if(_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x86')]){var _0x2fa70d=_0x29526c['query'][_0xf5f2('0x86')][_0xf5f2('0x42')](',');var _0x31f018={};_0x31f018[_0x2fa70d[0x0]]={'$gte':moment(_0x2fa70d[0x1])[_0xf5f2('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x44adaa[_0xf5f2('0x57')]=_[_0xf5f2('0x39')](_0x44adaa[_0xf5f2('0x57')],_0x31f018);}_0x44adaa=_[_0xf5f2('0x39')]({},_0x44adaa,_0x29526c['options']);return db[_0xf5f2('0xce')]['count']({'where':_0x44adaa[_0xf5f2('0x57')]})[_0xf5f2('0x22')](function(_0x20bb46){_0x3bcb44[_0xf5f2('0x31')]=_0x20bb46;if(_0x29526c['query'][_0xf5f2('0x10d')]){_0x44adaa[_0xf5f2('0xb9')]=[{'all':!![]}];}return db[_0xf5f2('0xce')][_0xf5f2('0x10e')](_0x44adaa);})[_0xf5f2('0x22')](function(_0x889f0e){_0x3bcb44['rows']=_0x889f0e;return _0x3bcb44;});}})[_0xf5f2('0x22')](respondWithFilteredResult(_0x2a52e3,_0x44adaa))[_0xf5f2('0x2c')](handleError(_0x2a52e3,null));};exports[_0xf5f2('0x10f')]=function(_0x3dcf4e,_0x4212d4,_0x2ebe4f){var _0x34fc35={'where':{}},_0x29c1ca={},_0x2cf93e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf5f2('0xc0')]({'where':{'id':_0x3dcf4e[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x4212d4,null))[_0xf5f2('0x22')](function(_0x544db3){if(_0x544db3){_0x29c1ca['model']=_[_0xf5f2('0x4b')](db[_0xf5f2('0xce')][_0xf5f2('0x46')]);_0x29c1ca['query']=_['keys'](_0x3dcf4e[_0xf5f2('0x4c')]);_0x29c1ca[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x29c1ca[_0xf5f2('0x4a')],_0x29c1ca[_0xf5f2('0x4c')]);_0x34fc35[_0xf5f2('0x4f')]=_['intersection'](_0x29c1ca[_0xf5f2('0x4a')],qs[_0xf5f2('0x50')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x34fc35['attributes']=_0x34fc35['attributes'][_0xf5f2('0x51')]?_0x34fc35['attributes']:_0x29c1ca[_0xf5f2('0x4a')];if(!_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x52')](_0xf5f2('0x53'))){_0x34fc35[_0xf5f2('0x2f')]=qs[_0xf5f2('0x2f')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x2f')]);_0x34fc35[_0xf5f2('0x54')]=qs[_0xf5f2('0x54')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x54')]);}_0x34fc35[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x3dcf4e['query'][_0xf5f2('0x56')]);_0x34fc35[_0xf5f2('0x57')]=qs[_0xf5f2('0x4d')](_[_0xf5f2('0x10c')](_0x3dcf4e[_0xf5f2('0x4c')],_0x29c1ca['filters']));_0x34fc35[_0xf5f2('0x57')][_0xf5f2('0xb5')]=_0x544db3['id'];if(_0x3dcf4e['query'][_0xf5f2('0x90')]){_0x34fc35[_0xf5f2('0x57')]=_['merge'](_0x34fc35['where'],{'$or':_[_0xf5f2('0x3e')](_0x34fc35[_0xf5f2('0x4f')],function(_0x3e7f54){var _0x5e165c={};_0x5e165c[_0x3e7f54]={'$like':'%'+_0x3dcf4e['query'][_0xf5f2('0x90')]+'%'};return _0x5e165c;})});}_0x34fc35[_0xf5f2('0x57')][_0xf5f2('0xfb')]=![];if(_0x3dcf4e[_0xf5f2('0x4c')]['id']){_0x34fc35[_0xf5f2('0x57')]['id']={'$gt':_0x3dcf4e[_0xf5f2('0x4c')]['id']};}_0x34fc35=_[_0xf5f2('0x39')]({},_0x34fc35,_0x3dcf4e[_0xf5f2('0xba')]);return db[_0xf5f2('0xce')][_0xf5f2('0x31')]({'where':_0x34fc35['where']})[_0xf5f2('0x22')](function(_0x1c2842){_0x2cf93e['count']=_0x1c2842;_0x34fc35[_0xf5f2('0xb9')]=[];if(_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x110')]){_0x34fc35[_0xf5f2('0xb9')][_0xf5f2('0x44')]({'model':db['User'],'as':'User','attributes':['id',_0xf5f2('0x3f'),_0xf5f2('0x111')]});}if(_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x10d')]){_0x34fc35['include']=[{'all':!![]}];}return db[_0xf5f2('0xce')][_0xf5f2('0x10e')](_0x34fc35);})[_0xf5f2('0x22')](function(_0x3518f9){_0x2cf93e['rows']=_0x3518f9;return _0x2cf93e;});}})['then'](respondWithFilteredResult(_0x4212d4,_0x34fc35))['catch'](handleError(_0x4212d4,null));};exports['addTags']=function(_0x2e9d3b,_0x496802,_0x5be074){return db['ChatInteraction']['find']({'where':{'id':_0x2e9d3b[_0xf5f2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x496802,null))['then'](function(_0x43150f){if(_0x43150f){return _0x43150f[_0xf5f2('0x112')](_0x2e9d3b[_0xf5f2('0x3a')][_0xf5f2('0x113')],_['omit'](_0x2e9d3b[_0xf5f2('0x3a')],[_0xf5f2('0x113'),'id'])||{})[_0xf5f2('0x114')](function(){return db[_0xf5f2('0x7d')][_0xf5f2('0x10e')]({'attributes':['id',_0xf5f2('0x38'),_0xf5f2('0x115')],'where':{'id':_0x2e9d3b['body'][_0xf5f2('0x113')]}});})[_0xf5f2('0x22')](function(_0x4f4af9){socket[_0xf5f2('0x116')](_0xf5f2('0x117'),{'id':Number(_0x2e9d3b[_0xf5f2('0xbd')]['id']),'tags':_0x4f4af9||[]});return{'id':Number(_0x2e9d3b[_0xf5f2('0xbd')]['id']),'tags':_0x4f4af9||[]};});}})[_0xf5f2('0x22')](respondWithResult(_0x496802,null))['catch'](handleError(_0x496802,null));};exports[_0xf5f2('0x118')]=function(_0x5f470f,_0x1f0a64,_0x2bbc23){return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x5f470f['params']['id']}})['then'](handleEntityNotFound(_0x1f0a64,null))[_0xf5f2('0x22')](function(_0x179901){if(_0x179901){return _0x179901[_0xf5f2('0x118')](_0x5f470f[_0xf5f2('0x4c')][_0xf5f2('0x113')]);}})[_0xf5f2('0x22')](respondWithStatusCode(_0x1f0a64,null))[_0xf5f2('0x2c')](handleError(_0x1f0a64,null));};exports[_0xf5f2('0xe8')]=function(_0x5d8c6a,_0x4f777b){var _0x26dc8c=moment()[_0xf5f2('0x119')]()['toString']();var _0xb8bcf3=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],_0xf5f2('0x11a'),_0xf5f2('0x11b'),_0xf5f2('0x11c'));var _0x2bc493=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],_0xf5f2('0x11a'),_0xf5f2('0x11b'),_0xf5f2('0x11d'));var _0x212d97=path[_0xf5f2('0xe5')](_0xb8bcf3,_0x26dc8c);var _0x8ee5fd=util[_0xf5f2('0xea')](_0xf5f2('0x11e'),_0x5d8c6a['params']['id'],_0x26dc8c);var _0x3712e3=path['join'](_0xb8bcf3,_0x8ee5fd);var _0x56a1c3=[];_0x56a1c3['push']({'model':db['User'],'as':_0xf5f2('0x7f'),'attributes':['id',_0xf5f2('0x3f')],'raw':!![]});_0x56a1c3[_0xf5f2('0x44')]({'model':db[_0xf5f2('0xd2')],'as':'Contact','attributes':['id',_0xf5f2('0x11f'),_0xf5f2('0x120')],'raw':!![]});if(_0x5d8c6a['query']['attachments']){_0x56a1c3['push']({'model':db[_0xf5f2('0xde')],'as':_0xf5f2('0xde'),'raw':!![]});}var _0x5a6da7=[{'model':db[_0xf5f2('0xce')],'as':_0xf5f2('0xee'),'attributes':['id',_0xf5f2('0x3a'),'createdAt',_0xf5f2('0x121'),_0xf5f2('0xfb'),_0xf5f2('0x8a')],'include':_0x56a1c3}];_0x5a6da7[_0xf5f2('0x44')]({'model':db[_0xf5f2('0xef')],'as':_0xf5f2('0x122'),'attributes':['id','name']});_0x5a6da7['push']({'model':db[_0xf5f2('0x7f')],'as':_0xf5f2('0x123'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xf5f2('0x78')]({'where':{'id':_0x5d8c6a['params']['id']},'include':_0x5a6da7})[_0xf5f2('0x22')](handleEntityNotFound(_0x4f777b,null))[_0xf5f2('0x22')](function(_0x2ee55f){if(_0x2ee55f){var _0x43ca34=_0x2ee55f[_0xf5f2('0x124')]({'plain':!![]});fs[_0xf5f2('0x125')](_0x212d97);var _0x220300={'channel':_0xf5f2('0x126'),'account':_0x43ca34[_0xf5f2('0x122')][_0xf5f2('0x38')],'agent':_0x43ca34['Owner']?_0x43ca34[_0xf5f2('0x123')][_0xf5f2('0x3f')]:_0xf5f2('0x127'),'createdAt':moment(_0x43ca34[_0xf5f2('0x85')])['format'](_0xf5f2('0x128'))[_0xf5f2('0xb2')](),'closedAt':_0x43ca34['closed']?moment(_0x43ca34[_0xf5f2('0x129')])['format'](_0xf5f2('0x128'))[_0xf5f2('0xb2')]():'','disposition':_0x43ca34['disposition'],'chatInfo':{'browser':_0x43ca34[_0xf5f2('0x12a')],'os':_0x43ca34[_0xf5f2('0x12b')],'referer':_0x43ca34[_0xf5f2('0x12c')],'customerIp':_0x43ca34[_0xf5f2('0x12d')],'customerPort':_0x43ca34['customerPort']?_0x43ca34[_0xf5f2('0x12e')]:_0xf5f2('0x127')},'messages':_(_0x43ca34[_0xf5f2('0xee')])['tail']()[_0xf5f2('0x90')]({'secret':![]})[_0xf5f2('0x3e')](function(_0x5981bb){if(_0x5981bb[_0xf5f2('0xde')]){var _0x4586b5=path[_0xf5f2('0xe5')](_0x2bc493,_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')]);if(fs[_0xf5f2('0x12f')](_0x4586b5)){fs[_0xf5f2('0x130')](_0x4586b5)[_0xf5f2('0x131')](fs[_0xf5f2('0x132')](path['join'](_0x212d97,_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')])));}}return{'date':moment(_0x5981bb[_0xf5f2('0x85')])[_0xf5f2('0xea')](_0xf5f2('0x128'))[_0xf5f2('0xb2')](),'sender':_0x5981bb[_0xf5f2('0x121')]===_0xf5f2('0x133')?_0x5981bb[_0xf5f2('0x7f')]?_0x5981bb[_0xf5f2('0x7f')][_0xf5f2('0x3f')]:'System':_0x5981bb['Contact']['firstName']+(_0x5981bb[_0xf5f2('0x73')][_0xf5f2('0x120')]?'\x20'+_0x5981bb[_0xf5f2('0x73')]['lastName']:''),'body':_0x5981bb[_0xf5f2('0xde')]?_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')]:_0x5981bb['body'],'direction':_0x5981bb[_0xf5f2('0x121')]===_0xf5f2('0x133')?'A':'C','secret':_0x5981bb[_0xf5f2('0xfb')],'read':_0x5981bb[_0xf5f2('0x8a')],'attachment':_0x5981bb[_0xf5f2('0xde')]};})[_0xf5f2('0x76')]()};return ejs[_0xf5f2('0x134')](path[_0xf5f2('0xe5')](config['root'],_0xf5f2('0x11a'),_0xf5f2('0x135'),_0xf5f2('0x136')),{'interaction':_0x220300})[_0xf5f2('0x22')](function(_0x510f56){var _0x319b39=path[_0xf5f2('0xe5')](_0x212d97,_0xf5f2('0x137')+_0x43ca34['id']+'-'+_0x26dc8c+'.pdf');var _0x346a95={'path':_0x319b39,'channel':_0xf5f2('0x126'),'interactionId':_0x43ca34['id']};return pdf[_0xf5f2('0x138')](_0x510f56,_0x346a95);})[_0xf5f2('0x22')](function(){return new BPromise(function(_0x249e9b,_0x56ab93){zipdir(_0x212d97,{'saveTo':_0x3712e3},function(_0x21fce7,_0x38a5e3){if(_0x21fce7)return _0x56ab93(_0x21fce7);return _0x249e9b(_0x38a5e3);});})[_0xf5f2('0x22')](function(){return new BPromise(function(_0x4d8a71,_0x1ca92b){rimraf(_0x212d97,function(_0x486c5e){if(_0x486c5e)_0x1ca92b(_0x486c5e);return _0x4d8a71();});});})[_0xf5f2('0x22')](function(){return _0x4f777b[_0xf5f2('0xe8')](_0x3712e3,_0x8ee5fd,function(_0x5089c1){if(_0x5089c1){console[_0xf5f2('0x139')](_0xf5f2('0x13a'),_0x5089c1);}else{fs[_0xf5f2('0x13b')](_0x3712e3);}});});});}else{return _0x4f777b['sendStatus'](0xc8);}})[_0xf5f2('0x2c')](handleError(_0x4f777b,null));}; \ No newline at end of file +var _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','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','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./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','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x129db3,_0x4c7c55){var _0x13d665=function(_0x5cb77c){while(--_0x5cb77c){_0x129db3['push'](_0x129db3['shift']());}};_0x13d665(++_0x4c7c55);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 401b293..29070be 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 _0xe358=['then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','ChatMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x315bb8,_0xd9dae){var _0x58beaa=function(_0x32fe6f){while(--_0x32fe6f){_0x315bb8['push'](_0x315bb8['shift']());}};_0x58beaa(++_0xd9dae);}(_0xe358,0x71));var _0x8e35=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xe358[_0xe4d6c6];return _0x3a8935;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x8e35('0x0')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8e35('0x1')](0x0);var events={'afterCreate':_0x8e35('0x2'),'afterUpdate':_0x8e35('0x3'),'afterDestroy':_0x8e35('0x4')};function emitEvent(_0x31f82c){return function(_0x32acaa,_0x565960,_0x10f506){_0x32acaa[_0x8e35('0x5')]({'attributes':['id'],'raw':!![]})[_0x8e35('0x6')](function(_0x2a1531){_0x32acaa[_0x8e35('0x7')](_0x8e35('0x8'),_0x2a1531[_0x8e35('0x9')](function(_0x339e2b){return{'id':_0x339e2b['id']};}));return ChatMessage[_0x8e35('0xa')]({'where':{'ChatInteractionId':_0x32acaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8e35('0x6')](function(_0x347c02){_0x32acaa['setDataValue'](_0x8e35('0xb'),_0x347c02['length']);ChatInteractionEvents[_0x8e35('0xc')](_0x31f82c+':'+_0x32acaa['id'],_0x32acaa);ChatInteractionEvents[_0x8e35('0xc')](_0x31f82c,_0x32acaa);_0x10f506(null);})[_0x8e35('0xd')](_0x10f506(null));};}for(var e in events){if(events[_0x8e35('0xe')](e)){var event=events[e];ChatInteraction[_0x8e35('0xf')](e,emitEvent(event));}}module[_0x8e35('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x8781=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x1780b8,_0x24ed2e){var _0x14147a=function(_0x2f4172){while(--_0x2f4172){_0x1780b8['push'](_0x1780b8['shift']());}};_0x14147a(++_0x24ed2e);}(_0x8781,0x7b));var _0x1878=function(_0x2ac152,_0x583280){_0x2ac152=_0x2ac152-0x0;var _0x4a6970=_0x8781[_0x2ac152];return _0x4a6970;};'use strict';var EventEmitter=require(_0x1878('0x0'));var ChatInteraction=require(_0x1878('0x1'))['db'][_0x1878('0x2')];var ChatMessage=require(_0x1878('0x1'))['db'][_0x1878('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1878('0x4')](0x0);var events={'afterCreate':_0x1878('0x5'),'afterUpdate':_0x1878('0x6'),'afterDestroy':'remove'};function emitEvent(_0x473703){return function(_0x5a1088,_0x3df251,_0x3d2ade){_0x5a1088[_0x1878('0x7')]({'attributes':['id'],'raw':!![]})[_0x1878('0x8')](function(_0xc11c53){_0x5a1088[_0x1878('0x9')](_0x1878('0xa'),_0xc11c53[_0x1878('0xb')](function(_0x57c850){return{'id':_0x57c850['id']};}));return ChatMessage[_0x1878('0xc')]({'where':{'ChatInteractionId':_0x5a1088['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1878('0x8')](function(_0x27fa75){_0x5a1088[_0x1878('0x9')](_0x1878('0xd'),_0x27fa75[_0x1878('0xe')]);ChatInteractionEvents[_0x1878('0xf')](_0x473703+':'+_0x5a1088['id'],_0x5a1088);ChatInteractionEvents[_0x1878('0xf')](_0x473703,_0x5a1088);_0x3d2ade(null);})[_0x1878('0x10')](_0x3d2ade(null));};}for(var e in events){if(events[_0x1878('0x11')](e)){var event=events[e];ChatInteraction[_0x1878('0x12')](e,emitEvent(event));}}module[_0x1878('0x13')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e01f1f4..bf10f49 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 _0x8457=['chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x272bb7,_0x455fb9){var _0x13bfaf=function(_0x8c7985){while(--_0x8c7985){_0x272bb7['push'](_0x272bb7['shift']());}};_0x13bfaf(++_0x455fb9);}(_0x8457,0x1a9));var _0x7845=function(_0x494be2,_0x1d9b68){_0x494be2=_0x494be2-0x0;var _0x29d1b3=_0x8457[_0x494be2];return _0x29d1b3;};'use strict';var _=require(_0x7845('0x0'));var util=require(_0x7845('0x1'));var logger=require(_0x7845('0x2'))(_0x7845('0x3'));var moment=require(_0x7845('0x4'));var BPromise=require('bluebird');var rp=require(_0x7845('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7845('0x6'));var config=require(_0x7845('0x7'));var attributes=require(_0x7845('0x8'));module[_0x7845('0x9')]=function(_0x1a3c1c,_0x3c9a1e){return _0x1a3c1c[_0x7845('0xa')](_0x7845('0xb'),attributes,{'tableName':_0x7845('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40d699,_0x5b61d0,_0x403f58){if(_0x40d699[_0x7845('0xd')](_0x7845('0xe'))){_0x40d699[_0x7845('0xf')]=moment()[_0x7845('0x10')](_0x7845('0x11'));}_0x403f58(null,_0x40d699);}},'charset':_0x7845('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ba7=['format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','changed','closed'];(function(_0xb95dfb,_0xa089c9){var _0x8742e8=function(_0x146dca){while(--_0x146dca){_0xb95dfb['push'](_0xb95dfb['shift']());}};_0x8742e8(++_0xa089c9);}(_0x8ba7,0x1a3));var _0x78ba=function(_0x1f2d06,_0x38d815){_0x1f2d06=_0x1f2d06-0x0;var _0x17667c=_0x8ba7[_0x1f2d06];return _0x17667c;};'use strict';var _=require(_0x78ba('0x0'));var util=require(_0x78ba('0x1'));var logger=require(_0x78ba('0x2'))('api');var moment=require(_0x78ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x78ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78ba('0x5'));var config=require(_0x78ba('0x6'));var attributes=require(_0x78ba('0x7'));module['exports']=function(_0x467bd4,_0xf45041){return _0x467bd4['define']('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2db54e,_0x19ce38,_0x5caf62){if(_0x2db54e[_0x78ba('0x8')](_0x78ba('0x9'))){_0x2db54e['closedAt']=moment()[_0x78ba('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5caf62(null,_0x2db54e);}},'charset':_0x78ba('0xb'),'collate':_0x78ba('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9d65c1b..4f6e90e 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 _0x15f9=['result','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','limit','then','stringify','catch','AddTagsToChatInteraction','find','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x5299e,_0x42e503){var _0x1118da=function(_0x5c27d0){while(--_0x5c27d0){_0x5299e['push'](_0x5299e['shift']());}};_0x1118da(++_0x42e503);}(_0x15f9,0x14c));var _0x915f=function(_0x4fbe58,_0x1f59fe){_0x4fbe58=_0x4fbe58-0x0;var _0x2dfd7f=_0x15f9[_0x4fbe58];return _0x2dfd7f;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var moment=require('moment');var BPromise=require(_0x915f('0x2'));var rs=require(_0x915f('0x3'));var fs=require('fs');var Redis=require(_0x915f('0x4'));var db=require(_0x915f('0x5'))['db'];var utils=require(_0x915f('0x6'));var logger=require(_0x915f('0x7'))(_0x915f('0x8'));var config=require(_0x915f('0x9'));var jayson=require(_0x915f('0xa'));var client=jayson[_0x915f('0xb')][_0x915f('0xc')]({'port':0x232a});config[_0x915f('0xd')]=_[_0x915f('0xe')](config[_0x915f('0xd')],{'host':_0x915f('0xf'),'port':0x18eb});var socket=require(_0x915f('0x10'))(new Redis(config['redis']));require(_0x915f('0x11'))[_0x915f('0x12')](socket);function respondWithRpcPromise(_0x2a9e18,_0x5e5b20,_0x31f710){return new BPromise(function(_0x10ba29,_0x2961d5){return client[_0x915f('0x13')](_0x2a9e18,_0x31f710)['then'](function(_0x3f9e48){logger[_0x915f('0x14')](_0x915f('0x15'),_0x5e5b20,_0x915f('0x16'));logger[_0x915f('0x17')](_0x915f('0x18'),_0x5e5b20,_0x915f('0x16'),JSON['stringify'](_0x3f9e48));if(_0x3f9e48['error']){if(_0x3f9e48['error'][_0x915f('0x19')]===0x1f4){logger[_0x915f('0x1a')](_0x915f('0x15'),_0x5e5b20,_0x3f9e48['error'][_0x915f('0x1b')]);return _0x2961d5(_0x3f9e48[_0x915f('0x1a')]['message']);}logger[_0x915f('0x1a')](_0x915f('0x15'),_0x5e5b20,_0x3f9e48['error']['message']);return _0x10ba29(_0x3f9e48[_0x915f('0x1a')]['message']);}else{logger[_0x915f('0x14')](_0x915f('0x15'),_0x5e5b20,_0x915f('0x16'));_0x10ba29(_0x3f9e48[_0x915f('0x1c')]['message']);}})['catch'](function(_0x5c5fff){logger[_0x915f('0x1a')](_0x915f('0x15'),_0x5e5b20,_0x5c5fff);_0x2961d5(_0x5c5fff);});});}exports[_0x915f('0x1d')]=function(_0x250618){var _0x30b32b=this;return new Promise(function(_0x2cee13,_0x1e20a1){return db[_0x915f('0x1e')][_0x915f('0x1f')](_0x250618['body'],{'raw':_0x250618[_0x915f('0x20')]?_0x250618['options'][_0x915f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x250618[_0x915f('0x20')]?_0x250618[_0x915f('0x20')]['where']||null:null,'attributes':_0x250618[_0x915f('0x20')]?_0x250618['options'][_0x915f('0x22')]||null:null,'limit':_0x250618['options']?_0x250618[_0x915f('0x20')][_0x915f('0x23')]||null:null})[_0x915f('0x24')](function(_0x139d75){logger[_0x915f('0x14')](_0x915f('0x1d'),_0x250618);logger[_0x915f('0x17')](_0x915f('0x1d'),_0x250618,JSON[_0x915f('0x25')](_0x139d75));_0x2cee13(_0x139d75);})[_0x915f('0x26')](function(_0x52f991){logger[_0x915f('0x1a')](_0x915f('0x1d'),_0x52f991[_0x915f('0x1b')],_0x250618);_0x1e20a1(_0x30b32b[_0x915f('0x1a')](0x1f4,_0x52f991[_0x915f('0x1b')]));});});};exports[_0x915f('0x27')]=function(_0x4fd531){return new Promise(function(_0x2b1875,_0x268820){return db[_0x915f('0x1e')][_0x915f('0x28')]({'where':_0x4fd531[_0x915f('0x20')]?_0x4fd531[_0x915f('0x20')]['where']||null:null})[_0x915f('0x24')](function(_0x16fa5b){if(_0x16fa5b){return _0x16fa5b['addTags'](_0x4fd531[_0x915f('0x29')][_0x915f('0x2a')],_['omit'](_0x4fd531[_0x915f('0x29')],[_0x915f('0x2a'),'id'])||{});}})[_0x915f('0x2b')](function(_0x50d827){logger[_0x915f('0x14')]('AddTags',_0x4fd531);logger[_0x915f('0x17')]('AddTags',_0x4fd531,JSON['stringify'](_0x50d827));_0x2b1875(_0x50d827);})[_0x915f('0x26')](function(_0x3205ad){logger[_0x915f('0x1a')](_0x915f('0x2c'),_0x3205ad[_0x915f('0x1b')],_0x4fd531);_0x268820(_this[_0x915f('0x1a')](0x1f4,_0x3205ad[_0x915f('0x1b')]));});});}; \ No newline at end of file +var _0x5f07=['UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','then','stringify','catch','AddTagsToChatInteraction','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result'];(function(_0x18ac2f,_0x402911){var _0x18a5ab=function(_0x40a002){while(--_0x40a002){_0x18ac2f['push'](_0x18ac2f['shift']());}};_0x18a5ab(++_0x402911);}(_0x5f07,0x84));var _0x75f0=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x5f07[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x75f0('0x0'));var util=require(_0x75f0('0x1'));var moment=require('moment');var BPromise=require(_0x75f0('0x2'));var rs=require(_0x75f0('0x3'));var fs=require('fs');var Redis=require(_0x75f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75f0('0x5'));var logger=require('../../config/logger')(_0x75f0('0x6'));var config=require(_0x75f0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x75f0('0x8')]({'port':0x232a});config[_0x75f0('0x9')]=_[_0x75f0('0xa')](config[_0x75f0('0x9')],{'host':_0x75f0('0xb'),'port':0x18eb});var socket=require(_0x75f0('0xc'))(new Redis(config[_0x75f0('0x9')]));require(_0x75f0('0xd'))[_0x75f0('0xe')](socket);function respondWithRpcPromise(_0x49f591,_0x412d60,_0x17e172){return new BPromise(function(_0x461d5c,_0x3acf79){return client[_0x75f0('0xf')](_0x49f591,_0x17e172)['then'](function(_0x3b3027){logger['info'](_0x75f0('0x10'),_0x412d60,'request\x20sent');logger[_0x75f0('0x11')](_0x75f0('0x12'),_0x412d60,_0x75f0('0x13'),JSON['stringify'](_0x3b3027));if(_0x3b3027[_0x75f0('0x14')]){if(_0x3b3027['error']['code']===0x1f4){logger[_0x75f0('0x14')](_0x75f0('0x10'),_0x412d60,_0x3b3027[_0x75f0('0x14')][_0x75f0('0x15')]);return _0x3acf79(_0x3b3027[_0x75f0('0x14')][_0x75f0('0x15')]);}logger[_0x75f0('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x412d60,_0x3b3027['error'][_0x75f0('0x15')]);return _0x461d5c(_0x3b3027[_0x75f0('0x14')][_0x75f0('0x15')]);}else{logger[_0x75f0('0x16')](_0x75f0('0x10'),_0x412d60,_0x75f0('0x13'));_0x461d5c(_0x3b3027[_0x75f0('0x17')]['message']);}})['catch'](function(_0x576fa6){logger[_0x75f0('0x14')](_0x75f0('0x10'),_0x412d60,_0x576fa6);_0x3acf79(_0x576fa6);});});}exports[_0x75f0('0x18')]=function(_0xf28c82){var _0x35c356=this;return new Promise(function(_0x400f9a,_0x3d5b51){return db[_0x75f0('0x19')][_0x75f0('0x1a')](_0xf28c82[_0x75f0('0x1b')],{'raw':_0xf28c82[_0x75f0('0x1c')]?_0xf28c82[_0x75f0('0x1c')][_0x75f0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf28c82[_0x75f0('0x1c')]?_0xf28c82[_0x75f0('0x1c')]['where']||null:null,'attributes':_0xf28c82[_0x75f0('0x1c')]?_0xf28c82[_0x75f0('0x1c')][_0x75f0('0x1e')]||null:null,'limit':_0xf28c82[_0x75f0('0x1c')]?_0xf28c82[_0x75f0('0x1c')][_0x75f0('0x1f')]||null:null})[_0x75f0('0x20')](function(_0x1fe1b6){logger[_0x75f0('0x16')](_0x75f0('0x18'),_0xf28c82);logger[_0x75f0('0x11')](_0x75f0('0x18'),_0xf28c82,JSON[_0x75f0('0x21')](_0x1fe1b6));_0x400f9a(_0x1fe1b6);})[_0x75f0('0x22')](function(_0x382125){logger[_0x75f0('0x14')](_0x75f0('0x18'),_0x382125[_0x75f0('0x15')],_0xf28c82);_0x3d5b51(_0x35c356[_0x75f0('0x14')](0x1f4,_0x382125[_0x75f0('0x15')]));});});};exports[_0x75f0('0x23')]=function(_0xe3516e){return new Promise(function(_0x4a8b79,_0x5e200a){return db[_0x75f0('0x19')]['find']({'where':_0xe3516e[_0x75f0('0x1c')]?_0xe3516e[_0x75f0('0x1c')]['where']||null:null})[_0x75f0('0x20')](function(_0x330404){if(_0x330404){return _0x330404['addTags'](_0xe3516e[_0x75f0('0x1b')]['ids'],_['omit'](_0xe3516e[_0x75f0('0x1b')],[_0x75f0('0x24'),'id'])||{});}})[_0x75f0('0x25')](function(_0x950915){logger[_0x75f0('0x16')](_0x75f0('0x26'),_0xe3516e);logger[_0x75f0('0x11')](_0x75f0('0x26'),_0xe3516e,JSON[_0x75f0('0x21')](_0x950915));_0x4a8b79(_0x950915);})[_0x75f0('0x22')](function(_0x4d873f){logger[_0x75f0('0x14')](_0x75f0('0x26'),_0x4d873f[_0x75f0('0x15')],_0xe3516e);_0x5e200a(_this[_0x75f0('0x14')](0x1f4,_0x4d873f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c749e40..8e4ed68 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 _0xb467=['update','emit','removeListener','./chatInteraction.events','save'];(function(_0x5a4e9e,_0x5ca47f){var _0x2b160d=function(_0x171da1){while(--_0x171da1){_0x5a4e9e['push'](_0x5a4e9e['shift']());}};_0x2b160d(++_0x5ca47f);}(_0xb467,0x111));var _0x7b46=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xb467[_0x4bcf38];return _0x4a89be;};'use strict';var ChatInteractionEvents=require(_0x7b46('0x0'));var events=[_0x7b46('0x1'),'remove',_0x7b46('0x2')];function createListener(_0x2dec36,_0x48325c){return function(_0x7d4910){_0x48325c[_0x7b46('0x3')](_0x2dec36,_0x7d4910);};}function removeListener(_0x5065a3,_0x1b531b){return function(){ChatInteractionEvents[_0x7b46('0x4')](_0x5065a3,_0x1b531b);};}exports['register']=function(_0x4dea35){for(var _0x2d3bd6=0x0,_0x4f7100=events['length'];_0x2d3bd6<_0x4f7100;_0x2d3bd6++){var _0x5deb79=events[_0x2d3bd6];var _0xdba96e=createListener('chatInteraction:'+_0x5deb79,_0x4dea35);ChatInteractionEvents['on'](_0x5deb79,_0xdba96e);}}; \ No newline at end of file +var _0xf53f=['update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x41ce4d,_0x275a09){var _0x41fa90=function(_0x2d5da0){while(--_0x2d5da0){_0x41ce4d['push'](_0x41ce4d['shift']());}};_0x41fa90(++_0x275a09);}(_0xf53f,0x8d));var _0xff53=function(_0x3608b5,_0x4d3561){_0x3608b5=_0x3608b5-0x0;var _0x30adb7=_0xf53f[_0x3608b5];return _0x30adb7;};'use strict';var ChatInteractionEvents=require(_0xff53('0x0'));var events=[_0xff53('0x1'),_0xff53('0x2'),_0xff53('0x3')];function createListener(_0x3b48fc,_0x4afcd){return function(_0x492e12){_0x4afcd[_0xff53('0x4')](_0x3b48fc,_0x492e12);};}function removeListener(_0x18b504,_0x2077b9){return function(){ChatInteractionEvents[_0xff53('0x5')](_0x18b504,_0x2077b9);};}exports[_0xff53('0x6')]=function(_0x54d39c){for(var _0x54e637=0x0,_0x27b397=events['length'];_0x54e637<_0x27b397;_0x54e637++){var _0x1c27bb=events[_0x54e637];var _0x122746=createListener(_0xff53('0x7')+_0x1c27bb,_0x54d39c);ChatInteractionEvents['on'](_0x1c27bb,_0x122746);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 83e6233..ea05fdb 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 _0xd624=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','post','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','/:id/custom_update','/:id/abandon','abandon','close','chatinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show'];(function(_0x13674a,_0x2cfe71){var _0x437059=function(_0x52155c){while(--_0x52155c){_0x13674a['push'](_0x13674a['shift']());}};_0x437059(++_0x2cfe71);}(_0xd624,0x1e6));var _0x4d62=function(_0x2f6541,_0x31692f){_0x2f6541=_0x2f6541-0x0;var _0x34fb4f=_0xd624[_0x2f6541];return _0x34fb4f;};'use strict';var multer=require(_0x4d62('0x0'));var util=require(_0x4d62('0x1'));var path=require(_0x4d62('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d62('0x3')]();var fs_extra=require(_0x4d62('0x4'));var auth=require(_0x4d62('0x5'));var interaction=require(_0x4d62('0x6'));var config=require(_0x4d62('0x7'));var controller=require('./chatInteraction.controller');router[_0x4d62('0x8')]('/',auth[_0x4d62('0x9')](),controller[_0x4d62('0xa')]);router['get']('/describe',auth[_0x4d62('0x9')](),controller['describe']);router['get'](_0x4d62('0xb'),auth[_0x4d62('0xc')](),controller[_0x4d62('0xd')]);router['get'](_0x4d62('0xe'),auth[_0x4d62('0xc')](),controller[_0x4d62('0xf')]);router[_0x4d62('0x8')](_0x4d62('0x10'),auth['isAuthenticated'](),controller[_0x4d62('0x11')]);router[_0x4d62('0x8')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x4d62('0x12')]);router[_0x4d62('0x8')](_0x4d62('0x13'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x4d62('0x14')]);router['post'](_0x4d62('0x15'),auth[_0x4d62('0x9')](),controller[_0x4d62('0x16')]);var upload=multer({'storage':multer[_0x4d62('0x17')]({'destination':function(_0x179aca,_0x3ae548,_0x460fb5){_0x460fb5(null,path[_0x4d62('0x18')](config[_0x4d62('0x19')],_0x4d62('0x1a')));},'filename':function(_0x2b3792,_0x1f504c,_0x3d3d1a){_0x3d3d1a(null,util[_0x4d62('0x1b')](_0x4d62('0x1c'),Date[_0x4d62('0x1d')](),_0x1f504c['originalname'][_0x4d62('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4d62('0x1f')](_0x4d62('0x20'),upload[_0x4d62('0x21')](_0x4d62('0x22')),controller[_0x4d62('0x23')]);router[_0x4d62('0x1f')](_0x4d62('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x4d62('0x24')]);router[_0x4d62('0x1f')](_0x4d62('0x25'),auth[_0x4d62('0x9')](),interaction[_0x4d62('0x26')](_0x4d62('0x27'),_0x4d62('0x28')),controller['addTags']);router[_0x4d62('0x29')](_0x4d62('0xb'),auth[_0x4d62('0x9')](),interaction[_0x4d62('0x26')]('chat','chatinteraction:update'),controller['update']);router[_0x4d62('0x29')](_0x4d62('0x2a'),controller['customUpdate']);router[_0x4d62('0x29')](_0x4d62('0x2b'),auth[_0x4d62('0xc')](),controller[_0x4d62('0x2c')]);router[_0x4d62('0x29')]('/:id/close',controller[_0x4d62('0x2d')]);router['delete'](_0x4d62('0xb'),auth[_0x4d62('0x9')](),interaction[_0x4d62('0x26')](_0x4d62('0x27'),_0x4d62('0x2e')),controller[_0x4d62('0x2f')]);router[_0x4d62('0x30')](_0x4d62('0x25'),auth['isAuthenticated'](),controller['removeTags']);module[_0x4d62('0x31')]=router; \ No newline at end of file +var _0x3c57=['isChatInteractionAuthorized','show','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0x3c57,0x14f));var _0x73c5=function(_0x182e16,_0x3214b3){_0x182e16=_0x182e16-0x0;var _0x56035a=_0x3c57[_0x182e16];return _0x56035a;};'use strict';var multer=require(_0x73c5('0x0'));var util=require('util');var path=require(_0x73c5('0x1'));var timeout=require(_0x73c5('0x2'));var express=require(_0x73c5('0x3'));var router=express[_0x73c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73c5('0x5'));var interaction=require(_0x73c5('0x6'));var config=require(_0x73c5('0x7'));var controller=require(_0x73c5('0x8'));router[_0x73c5('0x9')]('/',auth[_0x73c5('0xa')](),controller[_0x73c5('0xb')]);router['get'](_0x73c5('0xc'),auth[_0x73c5('0xa')](),controller[_0x73c5('0xd')]);router[_0x73c5('0x9')](_0x73c5('0xe'),auth[_0x73c5('0xf')](),controller[_0x73c5('0x10')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x73c5('0x9')]('/:id/messages',auth[_0x73c5('0xa')](),controller[_0x73c5('0x11')]);router[_0x73c5('0x9')](_0x73c5('0x12'),auth[_0x73c5('0xf')](),controller[_0x73c5('0x13')]);router['get']('/:id/download',auth[_0x73c5('0xa')](),controller[_0x73c5('0x14')]);router['post']('/',auth[_0x73c5('0xa')](),controller['create']);router[_0x73c5('0x15')](_0x73c5('0x16'),auth[_0x73c5('0xa')](),controller[_0x73c5('0x17')]);var upload=multer({'storage':multer[_0x73c5('0x18')]({'destination':function(_0x4ca7aa,_0x24d0de,_0x5c43cf){_0x5c43cf(null,path['join'](config[_0x73c5('0x19')],'server/files/attachments/'));},'filename':function(_0x29e896,_0x5ca30a,_0x59c7eb){_0x59c7eb(null,util[_0x73c5('0x1a')]('%s-%s',Date[_0x73c5('0x1b')](),_0x5ca30a[_0x73c5('0x1c')][_0x73c5('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x73c5('0x15')](_0x73c5('0x1e'),upload[_0x73c5('0x1f')](_0x73c5('0x20')),controller[_0x73c5('0x21')]);router[_0x73c5('0x15')]('/:id/messages',auth[_0x73c5('0xf')](),controller[_0x73c5('0x22')]);router[_0x73c5('0x15')](_0x73c5('0x23'),auth[_0x73c5('0xa')](),interaction[_0x73c5('0x24')]('chat','chatinteraction:addtags'),controller[_0x73c5('0x25')]);router[_0x73c5('0x26')](_0x73c5('0xe'),auth[_0x73c5('0xa')](),interaction[_0x73c5('0x24')](_0x73c5('0x27'),_0x73c5('0x28')),controller[_0x73c5('0x29')]);router[_0x73c5('0x26')](_0x73c5('0x2a'),controller['customUpdate']);router[_0x73c5('0x26')](_0x73c5('0x2b'),auth[_0x73c5('0xf')](),controller['abandon']);router['put'](_0x73c5('0x2c'),controller[_0x73c5('0x2d')]);router[_0x73c5('0x2e')]('/:id',auth[_0x73c5('0xa')](),interaction['tracked'](_0x73c5('0x27'),_0x73c5('0x2f')),controller['destroy']);router[_0x73c5('0x2e')](_0x73c5('0x23'),auth[_0x73c5('0xa')](),controller[_0x73c5('0x30')]);module[_0x73c5('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 71fce6d..9606395 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 _0xfb66=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x45d7d3,_0x1b3ffa){var _0x1fee81=function(_0x9df275){while(--_0x9df275){_0x45d7d3['push'](_0x45d7d3['shift']());}};_0x1fee81(++_0x1b3ffa);}(_0xfb66,0xee));var _0x6fb6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfb66[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x6fb6('0x0'));module[_0x6fb6('0x1')]={'body':{'type':Sequelize[_0x6fb6('0x2')](_0x6fb6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6fb6('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6fb6('0x5')]}}; \ No newline at end of file +var _0x301f=['INTEGER','sequelize','exports','TEXT','medium'];(function(_0x93ee5d,_0x1cb13a){var _0x15e735=function(_0x3587e7){while(--_0x3587e7){_0x93ee5d['push'](_0x93ee5d['shift']());}};_0x15e735(++_0x1cb13a);}(_0x301f,0x1eb));var _0xf301=function(_0x8d0102,_0x2b5fb1){_0x8d0102=_0x8d0102-0x0;var _0x57e9e0=_0x301f[_0x8d0102];return _0x57e9e0;};'use strict';var Sequelize=require(_0xf301('0x0'));module[_0xf301('0x1')]={'body':{'type':Sequelize[_0xf301('0x2')](_0xf301('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf301('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 67c54a8..079cbe3 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 _0x76b4=['attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','ChatInternalMessage','include','findAll','catch','show','rawAttributes','includeAll','body','find','params','describe','createdAt','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','UserProfileResource','isEmpty','push','messages','FromId','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x1ccb5d,_0x341da9){var _0x1fe071=function(_0x12433e){while(--_0x12433e){_0x1ccb5d['push'](_0x1ccb5d['shift']());}};_0x1fe071(++_0x341da9);}(_0x76b4,0x15e));var _0x476b=function(_0x295577,_0x14287b){_0x295577=_0x295577-0x0;var _0x106af4=_0x76b4[_0x295577];return _0x106af4;};'use strict';var emlformat=require(_0x476b('0x0'));var rimraf=require(_0x476b('0x1'));var zipdir=require(_0x476b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x476b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x476b('0x4'));var sox=require(_0x476b('0x5'));var csv=require(_0x476b('0x6'));var ejs=require(_0x476b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x476b('0x8'));var crypto=require(_0x476b('0x9'));var jsforce=require(_0x476b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x476b('0x6'));var querystring=require(_0x476b('0xb'));var Papa=require(_0x476b('0xc'));var Redis=require('ioredis');var authService=require(_0x476b('0xd'));var qs=require(_0x476b('0xe'));var as=require(_0x476b('0xf'));var hardwareService=require(_0x476b('0x10'));var logger=require('../../config/logger')(_0x476b('0x11'));var utils=require(_0x476b('0x12'));var config=require(_0x476b('0x13'));var licenseUtil=require(_0x476b('0x14'));var db=require(_0x476b('0x15'))['db'];config[_0x476b('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x476b('0x17'))(new Redis(config[_0x476b('0x16')]));require(_0x476b('0x18'))[_0x476b('0x19')](socket);function respondWithStatusCode(_0x481e00,_0x1d895f){_0x1d895f=_0x1d895f||0xcc;return function(_0x17ae16){if(_0x17ae16){return _0x481e00[_0x476b('0x1a')](_0x1d895f);}return _0x481e00['status'](_0x1d895f)[_0x476b('0x1b')]();};}function respondWithResult(_0x4defce,_0x558508){_0x558508=_0x558508||0xc8;return function(_0x5729e7){if(_0x5729e7){return _0x4defce[_0x476b('0x1c')](_0x558508)[_0x476b('0x1d')](_0x5729e7);}};}function respondWithFilteredResult(_0x5756e0,_0x281bc2){return function(_0x16638c){if(_0x16638c){var _0x5296f2=typeof _0x281bc2[_0x476b('0x1e')]===_0x476b('0x1f')&&typeof _0x281bc2[_0x476b('0x20')]===_0x476b('0x1f');var _0x4468cc=_0x16638c[_0x476b('0x21')];var _0x5cbacb=_0x5296f2?0x0:_0x281bc2[_0x476b('0x1e')];var _0xb7028=_0x5296f2?_0x16638c[_0x476b('0x21')]:_0x281bc2['offset']+_0x281bc2[_0x476b('0x20')];var _0x4b5180;if(_0xb7028>=_0x4468cc){_0xb7028=_0x4468cc;_0x4b5180=0xc8;}else{_0x4b5180=0xce;}_0x5756e0[_0x476b('0x1c')](_0x4b5180);return _0x5756e0[_0x476b('0x22')](_0x476b('0x23'),_0x5cbacb+'-'+_0xb7028+'/'+_0x4468cc)[_0x476b('0x1d')](_0x16638c);}return null;};}function patchUpdates(_0x22347d){return function(_0x5f8254){try{jsonpatch['apply'](_0x5f8254,_0x22347d,!![]);}catch(_0x25ec7a){return BPromise[_0x476b('0x24')](_0x25ec7a);}return _0x5f8254['save']();};}function saveUpdates(_0x2d5853,_0x507cf9){return function(_0x1cfb10){if(_0x1cfb10){return _0x1cfb10[_0x476b('0x25')](_0x2d5853)['then'](function(_0x475003){return _0x475003;});}return null;};}function removeEntity(_0x42f8c0,_0x235f74){return function(_0x44151a){if(_0x44151a){return _0x44151a[_0x476b('0x26')]()[_0x476b('0x27')](function(){_0x42f8c0[_0x476b('0x1c')](0xcc)[_0x476b('0x1b')]();});}};}function handleEntityNotFound(_0x5a5b5c,_0x34f3f7){return function(_0x84d3d7){if(!_0x84d3d7){_0x5a5b5c[_0x476b('0x1a')](0x194);}return _0x84d3d7;};}function handleError(_0x28afe7,_0x31c744){_0x31c744=_0x31c744||0x1f4;return function(_0x2e01d5){logger[_0x476b('0x28')](_0x2e01d5[_0x476b('0x29')]);if(_0x2e01d5[_0x476b('0x2a')]){delete _0x2e01d5[_0x476b('0x2a')];}_0x28afe7[_0x476b('0x1c')](_0x31c744)[_0x476b('0x2b')](_0x2e01d5);};}exports[_0x476b('0x2c')]=function(_0x116ad6,_0x94d077){var _0x38a081={},_0x1ab445={},_0x3598f6={'count':0x0,'rows':[]};var _0xb0ca7a=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x4e94c9){return{'name':_0x4e94c9[_0x476b('0x2d')],'type':_0x4e94c9[_0x476b('0x2e')][_0x476b('0x2f')]};});_0x1ab445[_0x476b('0x30')]=_[_0x476b('0x31')](_0xb0ca7a,'name');_0x1ab445[_0x476b('0x32')]=_[_0x476b('0x33')](_0x116ad6['query']);_0x1ab445[_0x476b('0x34')]=_[_0x476b('0x35')](_0x1ab445['model'],_0x1ab445['query']);_0x38a081[_0x476b('0x36')]=_[_0x476b('0x35')](_0x1ab445[_0x476b('0x30')],qs['fields'](_0x116ad6[_0x476b('0x32')][_0x476b('0x37')]));_0x38a081[_0x476b('0x36')]=_0x38a081[_0x476b('0x36')][_0x476b('0x38')]?_0x38a081['attributes']:_0x1ab445[_0x476b('0x30')];if(!_0x116ad6[_0x476b('0x32')][_0x476b('0x39')](_0x476b('0x3a'))){_0x38a081['limit']=qs[_0x476b('0x20')](_0x116ad6[_0x476b('0x32')][_0x476b('0x20')]);_0x38a081[_0x476b('0x1e')]=qs[_0x476b('0x1e')](_0x116ad6[_0x476b('0x32')][_0x476b('0x1e')]);}_0x38a081['order']=qs[_0x476b('0x3b')](_0x116ad6['query']['sort']);_0x38a081['where']=qs[_0x476b('0x34')](_[_0x476b('0x3c')](_0x116ad6[_0x476b('0x32')],_0x1ab445['filters']),_0xb0ca7a);if(_0x116ad6[_0x476b('0x32')]['filter']){_0x38a081[_0x476b('0x3d')]=_[_0x476b('0x3e')](_0x38a081[_0x476b('0x3d')],{'$or':_[_0x476b('0x31')](_0xb0ca7a,function(_0x4e5888){if(_0x4e5888[_0x476b('0x2e')]!==_0x476b('0x3f')){var _0x2f6e29={};_0x2f6e29[_0x4e5888[_0x476b('0x2a')]]={'$like':'%'+_0x116ad6[_0x476b('0x32')][_0x476b('0x40')]+'%'};return _0x2f6e29;}})});}_0x38a081=_[_0x476b('0x3e')]({},_0x38a081,_0x116ad6[_0x476b('0x41')]);var _0x3e37f9={'where':_0x38a081[_0x476b('0x3d')]};return db[_0x476b('0x42')][_0x476b('0x21')](_0x3e37f9)[_0x476b('0x27')](function(_0x477ee6){_0x3598f6[_0x476b('0x21')]=_0x477ee6;if(_0x116ad6['query']['includeAll']){_0x38a081[_0x476b('0x43')]=[{'all':!![]}];}return db[_0x476b('0x42')][_0x476b('0x44')](_0x38a081);})[_0x476b('0x27')](function(_0x36c388){_0x3598f6['rows']=_0x36c388;return _0x3598f6;})[_0x476b('0x27')](respondWithFilteredResult(_0x94d077,_0x38a081))[_0x476b('0x45')](handleError(_0x94d077,null));};exports[_0x476b('0x46')]=function(_0x49cec3,_0x4044b1){var _0x35542b={'raw':!![],'where':{'id':_0x49cec3['params']['id']}},_0x2ecaff={};_0x2ecaff['model']=_['keys'](db[_0x476b('0x42')][_0x476b('0x47')]);_0x2ecaff['query']=_[_0x476b('0x33')](_0x49cec3[_0x476b('0x32')]);_0x2ecaff[_0x476b('0x34')]=_[_0x476b('0x35')](_0x2ecaff['model'],_0x2ecaff[_0x476b('0x32')]);_0x35542b[_0x476b('0x36')]=_[_0x476b('0x35')](_0x2ecaff['model'],qs[_0x476b('0x37')](_0x49cec3['query'][_0x476b('0x37')]));_0x35542b[_0x476b('0x36')]=_0x35542b[_0x476b('0x36')]['length']?_0x35542b[_0x476b('0x36')]:_0x2ecaff[_0x476b('0x30')];if(_0x49cec3[_0x476b('0x32')][_0x476b('0x48')]){_0x35542b[_0x476b('0x43')]=[{'all':!![]}];}_0x35542b=_['merge']({},_0x35542b,_0x49cec3[_0x476b('0x41')]);return db[_0x476b('0x42')]['find'](_0x35542b)[_0x476b('0x27')](handleEntityNotFound(_0x4044b1,null))[_0x476b('0x27')](respondWithResult(_0x4044b1,null))[_0x476b('0x45')](handleError(_0x4044b1,null));};exports['create']=function(_0x2aea89,_0x2d3ba1){return db[_0x476b('0x42')]['create'](_0x2aea89[_0x476b('0x49')],{})[_0x476b('0x27')](respondWithResult(_0x2d3ba1,0xc9))['catch'](handleError(_0x2d3ba1,null));};exports['update']=function(_0x215664,_0x54e8f3){if(_0x215664[_0x476b('0x49')]['id']){delete _0x215664['body']['id'];}return db[_0x476b('0x42')][_0x476b('0x4a')]({'where':{'id':_0x215664[_0x476b('0x4b')]['id']}})[_0x476b('0x27')](handleEntityNotFound(_0x54e8f3,null))[_0x476b('0x27')](saveUpdates(_0x215664[_0x476b('0x49')],null))[_0x476b('0x27')](respondWithResult(_0x54e8f3,null))[_0x476b('0x45')](handleError(_0x54e8f3,null));};exports['destroy']=function(_0x39dc03,_0x1cccac){return db[_0x476b('0x42')]['find']({'where':{'id':_0x39dc03[_0x476b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cccac,null))[_0x476b('0x27')](removeEntity(_0x1cccac,null))['catch'](handleError(_0x1cccac,null));};exports[_0x476b('0x4c')]=function(_0x5a3949,_0x1041fb){return db[_0x476b('0x42')][_0x476b('0x4c')]()['then'](respondWithResult(_0x1041fb,null))[_0x476b('0x45')](handleError(_0x1041fb,null));};function wrapUser(_0xa93311){return function(_0x218a63){var _0x46d57b=_0xa93311['get']({'plain':!![]});_0x46d57b['messages']=[];if(_0x218a63){_0x46d57b['lastMessageAt']=_0x218a63[_0x476b('0x4d')];_0x46d57b[_0x476b('0x4e')]=_0x218a63;}else{_0x46d57b[_0x476b('0x4f')]=moment(0x0)[_0x476b('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x46d57b[_0x476b('0x4e')]={};}return _0x46d57b;};}exports[_0x476b('0x51')]=function(_0x21c95d,_0x5a7680,_0x18f9b3){var _0x3ff404=[];return db[_0x476b('0x52')]['findAll']({'where':{'role':[_0x476b('0x53'),_0x476b('0x54'),_0x476b('0x55')]},'attributes':['id',_0x476b('0x56'),'name','role',_0x476b('0x57'),_0x476b('0x58'),_0x476b('0x59'),_0x476b('0x5a'),'allowmessenger','showWebBar'],'order':qs[_0x476b('0x3b')](_0x476b('0x5b')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0x476b('0x2e')],'through':{'attributes':[]}}]})[_0x476b('0x27')](function(_0x4de040){if(_0x4de040){var _0x111e2f=_0x21c95d[_0x476b('0x55')]['get']({'plain':!![]});if(!_0x111e2f)throw new Error(_0x476b('0x5c'));if(_0x111e2f[_0x476b('0x5d')]===_0x476b('0x55')){return db[_0x476b('0x5e')][_0x476b('0x4a')]({'where':{'name':_0x476b('0x5f'),'userProfileId':_0x111e2f['userProfileId']},'raw':!![]})[_0x476b('0x27')](function(_0x45a02f){if(_0x45a02f){if(_0x45a02f['autoAssociation']===0x0){return db[_0x476b('0x60')][_0x476b('0x44')]({'where':{'sectionId':_0x45a02f['id']},'raw':!![]})[_0x476b('0x27')](function(_0x171cc4){var _0x7b059b=[];if(_[_0x476b('0x61')](_0x171cc4)){_0x7b059b=_[_0x476b('0x40')](_0x4de040,function(_0x34a9ec){if(_0x34a9ec[_0x476b('0x5d')]!==_0x476b('0x53')){return _0x34a9ec;}});return _0x7b059b;}else{for(var _0x311151=0x0;_0x311151<_0x4de040['length'];_0x311151++){var _0x1f5bc2=_0x4de040[_0x311151];if(_0x1f5bc2['role']===_0x476b('0x53')){var _0x3630d8=_[_0x476b('0x4a')](_0x171cc4,function(_0x345564){return _0x345564['resourceId']===_0x1f5bc2['id'];});if(_0x3630d8)_0x7b059b[_0x476b('0x62')](_0x1f5bc2);}else{_0x7b059b[_0x476b('0x62')](_0x1f5bc2);}}return _0x7b059b;}});}else{return _0x4de040;}}else{var _0x13b94e=_[_0x476b('0x40')](_0x4de040,function(_0x345756){if(_0x345756[_0x476b('0x5d')]!==_0x476b('0x53')){return _0x345756;}});return _0x13b94e;}});}else{return _0x4de040;}}})['then'](function(_0x38ccd0){var _0x10065a=[];if(_0x38ccd0){_0x3ff404=_0x38ccd0;for(var _0x579dc3=0x0;_0x579dc3<_0x38ccd0[_0x476b('0x38')];_0x579dc3+=0x1){_0x3ff404[_0x579dc3][_0x476b('0x63')]=[];_0x10065a['push'](db[_0x476b('0x42')][_0x476b('0x4a')]({'where':{'FromId':[_0x21c95d[_0x476b('0x55')]['id'],_0x38ccd0[_0x579dc3]['id']],'ToId':[_0x21c95d[_0x476b('0x55')]['id'],_0x38ccd0[_0x579dc3]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x476b('0x64'),'ToId','read',_0x476b('0x49')],'order':qs[_0x476b('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x476b('0x27')](wrapUser(_0x38ccd0[_0x579dc3])));}return BPromise['all'](_0x10065a);}return[];})[_0x476b('0x27')](function(_0x5a9ebf){return{'rows':_0x5a9ebf,'count':_0x5a9ebf['length']};})[_0x476b('0x27')](respondWithResult(_0x5a7680,null))[_0x476b('0x45')](handleError(_0x5a7680,null));}; \ No newline at end of file +var _0x45eb=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','error','stack','name','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','fullname','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x567077,_0x375bc2){var _0x4d15b8=function(_0x166312){while(--_0x166312){_0x567077['push'](_0x567077['shift']());}};_0x4d15b8(++_0x375bc2);}(_0x45eb,0x140));var _0xb45e=function(_0x35f1ab,_0x427d19){_0x35f1ab=_0x35f1ab-0x0;var _0x53fa2a=_0x45eb[_0x35f1ab];return _0x53fa2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb45e('0x0'));var zipdir=require(_0xb45e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb45e('0x2'));var moment=require('moment');var BPromise=require(_0xb45e('0x3'));var Mustache=require(_0xb45e('0x4'));var util=require(_0xb45e('0x5'));var path=require(_0xb45e('0x6'));var sox=require(_0xb45e('0x7'));var csv=require('to-csv');var ejs=require(_0xb45e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb45e('0x9'));var squel=require('squel');var crypto=require(_0xb45e('0xa'));var jsforce=require(_0xb45e('0xb'));var deskjs=require(_0xb45e('0xc'));var toCsv=require(_0xb45e('0xd'));var querystring=require(_0xb45e('0xe'));var Papa=require(_0xb45e('0xf'));var Redis=require('ioredis');var authService=require(_0xb45e('0x10'));var qs=require(_0xb45e('0x11'));var as=require(_0xb45e('0x12'));var hardwareService=require(_0xb45e('0x13'));var logger=require(_0xb45e('0x14'))('api');var utils=require(_0xb45e('0x15'));var config=require(_0xb45e('0x16'));var licenseUtil=require(_0xb45e('0x17'));var db=require(_0xb45e('0x18'))['db'];config['redis']=_[_0xb45e('0x19')](config[_0xb45e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb45e('0x1b'))(new Redis(config[_0xb45e('0x1a')]));require(_0xb45e('0x1c'))[_0xb45e('0x1d')](socket);function respondWithStatusCode(_0x5a86e5,_0x41a02b){_0x41a02b=_0x41a02b||0xcc;return function(_0x195702){if(_0x195702){return _0x5a86e5[_0xb45e('0x1e')](_0x41a02b);}return _0x5a86e5['status'](_0x41a02b)[_0xb45e('0x1f')]();};}function respondWithResult(_0x13a1a8,_0xf581c5){_0xf581c5=_0xf581c5||0xc8;return function(_0x1c6933){if(_0x1c6933){return _0x13a1a8['status'](_0xf581c5)[_0xb45e('0x20')](_0x1c6933);}};}function respondWithFilteredResult(_0x517adb,_0x22433e){return function(_0x1cfc48){if(_0x1cfc48){var _0x5c924f=typeof _0x22433e[_0xb45e('0x21')]===_0xb45e('0x22')&&typeof _0x22433e[_0xb45e('0x23')]===_0xb45e('0x22');var _0x262d31=_0x1cfc48[_0xb45e('0x24')];var _0x2a5a70=_0x5c924f?0x0:_0x22433e[_0xb45e('0x21')];var _0x2a0985=_0x5c924f?_0x1cfc48['count']:_0x22433e[_0xb45e('0x21')]+_0x22433e[_0xb45e('0x23')];var _0x5be604;if(_0x2a0985>=_0x262d31){_0x2a0985=_0x262d31;_0x5be604=0xc8;}else{_0x5be604=0xce;}_0x517adb[_0xb45e('0x25')](_0x5be604);return _0x517adb[_0xb45e('0x26')]('Content-Range',_0x2a5a70+'-'+_0x2a0985+'/'+_0x262d31)[_0xb45e('0x20')](_0x1cfc48);}return null;};}function patchUpdates(_0x3aadeb){return function(_0xc8bcac){try{jsonpatch[_0xb45e('0x27')](_0xc8bcac,_0x3aadeb,!![]);}catch(_0x65513e){return BPromise['reject'](_0x65513e);}return _0xc8bcac[_0xb45e('0x28')]();};}function saveUpdates(_0x2a9dfb,_0x509280){return function(_0x10362c){if(_0x10362c){return _0x10362c[_0xb45e('0x29')](_0x2a9dfb)[_0xb45e('0x2a')](function(_0x1e03d2){return _0x1e03d2;});}return null;};}function removeEntity(_0x505383,_0x501399){return function(_0x34ad50){if(_0x34ad50){return _0x34ad50[_0xb45e('0x2b')]()[_0xb45e('0x2a')](function(){_0x505383['status'](0xcc)[_0xb45e('0x1f')]();});}};}function handleEntityNotFound(_0xcc95c5,_0x47c930){return function(_0x26b2a8){if(!_0x26b2a8){_0xcc95c5['sendStatus'](0x194);}return _0x26b2a8;};}function handleError(_0x10c16c,_0x365acc){_0x365acc=_0x365acc||0x1f4;return function(_0x32f0a6){logger[_0xb45e('0x2c')](_0x32f0a6[_0xb45e('0x2d')]);if(_0x32f0a6[_0xb45e('0x2e')]){delete _0x32f0a6[_0xb45e('0x2e')];}_0x10c16c[_0xb45e('0x25')](_0x365acc)['send'](_0x32f0a6);};}exports['index']=function(_0x30b023,_0x1f228b){var _0x5660fe={},_0x4e0af2={},_0x70745a={'count':0x0,'rows':[]};var _0x36274b=_[_0xb45e('0x2f')](db[_0xb45e('0x30')][_0xb45e('0x31')],function(_0x15c411){return{'name':_0x15c411[_0xb45e('0x32')],'type':_0x15c411[_0xb45e('0x33')]['key']};});_0x4e0af2[_0xb45e('0x34')]=_['map'](_0x36274b,'name');_0x4e0af2[_0xb45e('0x35')]=_[_0xb45e('0x36')](_0x30b023['query']);_0x4e0af2['filters']=_[_0xb45e('0x37')](_0x4e0af2[_0xb45e('0x34')],_0x4e0af2[_0xb45e('0x35')]);_0x5660fe[_0xb45e('0x38')]=_['intersection'](_0x4e0af2[_0xb45e('0x34')],qs[_0xb45e('0x39')](_0x30b023[_0xb45e('0x35')][_0xb45e('0x39')]));_0x5660fe[_0xb45e('0x38')]=_0x5660fe[_0xb45e('0x38')]['length']?_0x5660fe[_0xb45e('0x38')]:_0x4e0af2[_0xb45e('0x34')];if(!_0x30b023[_0xb45e('0x35')][_0xb45e('0x3a')](_0xb45e('0x3b'))){_0x5660fe['limit']=qs['limit'](_0x30b023[_0xb45e('0x35')][_0xb45e('0x23')]);_0x5660fe['offset']=qs[_0xb45e('0x21')](_0x30b023[_0xb45e('0x35')][_0xb45e('0x21')]);}_0x5660fe['order']=qs[_0xb45e('0x3c')](_0x30b023[_0xb45e('0x35')][_0xb45e('0x3c')]);_0x5660fe['where']=qs[_0xb45e('0x3d')](_['pick'](_0x30b023[_0xb45e('0x35')],_0x4e0af2[_0xb45e('0x3d')]),_0x36274b);if(_0x30b023[_0xb45e('0x35')][_0xb45e('0x3e')]){_0x5660fe[_0xb45e('0x3f')]=_[_0xb45e('0x40')](_0x5660fe[_0xb45e('0x3f')],{'$or':_[_0xb45e('0x2f')](_0x36274b,function(_0x37d2a0){if(_0x37d2a0['type']!==_0xb45e('0x41')){var _0x571569={};_0x571569[_0x37d2a0[_0xb45e('0x2e')]]={'$like':'%'+_0x30b023[_0xb45e('0x35')][_0xb45e('0x3e')]+'%'};return _0x571569;}})});}_0x5660fe=_[_0xb45e('0x40')]({},_0x5660fe,_0x30b023['options']);var _0x1b9d6e={'where':_0x5660fe['where']};return db[_0xb45e('0x30')][_0xb45e('0x24')](_0x1b9d6e)[_0xb45e('0x2a')](function(_0x1f2bab){_0x70745a[_0xb45e('0x24')]=_0x1f2bab;if(_0x30b023[_0xb45e('0x35')][_0xb45e('0x42')]){_0x5660fe[_0xb45e('0x43')]=[{'all':!![]}];}return db[_0xb45e('0x30')][_0xb45e('0x44')](_0x5660fe);})[_0xb45e('0x2a')](function(_0x4e5b4f){_0x70745a[_0xb45e('0x45')]=_0x4e5b4f;return _0x70745a;})['then'](respondWithFilteredResult(_0x1f228b,_0x5660fe))[_0xb45e('0x46')](handleError(_0x1f228b,null));};exports[_0xb45e('0x47')]=function(_0x3af22c,_0xc86e4b){var _0x360658={'raw':!![],'where':{'id':_0x3af22c['params']['id']}},_0x4d01bf={};_0x4d01bf[_0xb45e('0x34')]=_[_0xb45e('0x36')](db[_0xb45e('0x30')][_0xb45e('0x31')]);_0x4d01bf[_0xb45e('0x35')]=_[_0xb45e('0x36')](_0x3af22c[_0xb45e('0x35')]);_0x4d01bf[_0xb45e('0x3d')]=_[_0xb45e('0x37')](_0x4d01bf[_0xb45e('0x34')],_0x4d01bf[_0xb45e('0x35')]);_0x360658[_0xb45e('0x38')]=_[_0xb45e('0x37')](_0x4d01bf[_0xb45e('0x34')],qs[_0xb45e('0x39')](_0x3af22c['query']['fields']));_0x360658[_0xb45e('0x38')]=_0x360658[_0xb45e('0x38')][_0xb45e('0x48')]?_0x360658['attributes']:_0x4d01bf[_0xb45e('0x34')];if(_0x3af22c[_0xb45e('0x35')][_0xb45e('0x42')]){_0x360658['include']=[{'all':!![]}];}_0x360658=_[_0xb45e('0x40')]({},_0x360658,_0x3af22c[_0xb45e('0x49')]);return db[_0xb45e('0x30')][_0xb45e('0x4a')](_0x360658)[_0xb45e('0x2a')](handleEntityNotFound(_0xc86e4b,null))[_0xb45e('0x2a')](respondWithResult(_0xc86e4b,null))[_0xb45e('0x46')](handleError(_0xc86e4b,null));};exports[_0xb45e('0x4b')]=function(_0x76c541,_0x1958b0){return db[_0xb45e('0x30')][_0xb45e('0x4b')](_0x76c541[_0xb45e('0x4c')],{})[_0xb45e('0x2a')](respondWithResult(_0x1958b0,0xc9))[_0xb45e('0x46')](handleError(_0x1958b0,null));};exports[_0xb45e('0x29')]=function(_0x4bbbb2,_0xde6b60){if(_0x4bbbb2['body']['id']){delete _0x4bbbb2['body']['id'];}return db['ChatInternalMessage'][_0xb45e('0x4a')]({'where':{'id':_0x4bbbb2[_0xb45e('0x4d')]['id']}})[_0xb45e('0x2a')](handleEntityNotFound(_0xde6b60,null))['then'](saveUpdates(_0x4bbbb2[_0xb45e('0x4c')],null))['then'](respondWithResult(_0xde6b60,null))[_0xb45e('0x46')](handleError(_0xde6b60,null));};exports[_0xb45e('0x2b')]=function(_0x19b592,_0x410a56){return db[_0xb45e('0x30')][_0xb45e('0x4a')]({'where':{'id':_0x19b592[_0xb45e('0x4d')]['id']}})[_0xb45e('0x2a')](handleEntityNotFound(_0x410a56,null))[_0xb45e('0x2a')](removeEntity(_0x410a56,null))[_0xb45e('0x46')](handleError(_0x410a56,null));};exports[_0xb45e('0x4e')]=function(_0x45226d,_0x3f5695){return db[_0xb45e('0x30')][_0xb45e('0x4e')]()[_0xb45e('0x2a')](respondWithResult(_0x3f5695,null))[_0xb45e('0x46')](handleError(_0x3f5695,null));};function wrapUser(_0x520227){return function(_0x141529){var _0xe4900e=_0x520227[_0xb45e('0x4f')]({'plain':!![]});_0xe4900e[_0xb45e('0x50')]=[];if(_0x141529){_0xe4900e['lastMessageAt']=_0x141529[_0xb45e('0x51')];_0xe4900e[_0xb45e('0x52')]=_0x141529;}else{_0xe4900e[_0xb45e('0x53')]=moment(0x0)[_0xb45e('0x54')](_0xb45e('0x55'));_0xe4900e[_0xb45e('0x52')]={};}return _0xe4900e;};}exports[_0xb45e('0x56')]=function(_0x52313d,_0x1aef2f,_0x193fc0){var _0x23d595=[];return db[_0xb45e('0x57')]['findAll']({'where':{'role':['agent','admin',_0xb45e('0x58')]},'attributes':['id',_0xb45e('0x59'),_0xb45e('0x2e'),'role',_0xb45e('0x5a'),_0xb45e('0x5b'),_0xb45e('0x5c'),'lastLoginAt',_0xb45e('0x5d'),_0xb45e('0x5e')],'order':qs['sort'](_0xb45e('0x5f')),'include':[{'model':db[_0xb45e('0x60')],'as':_0xb45e('0x61'),'attributes':['id','name',_0xb45e('0x33')],'through':{'attributes':[]}}]})['then'](function(_0x5b0a53){if(_0x5b0a53){var _0x29f5ab=_0x52313d[_0xb45e('0x58')][_0xb45e('0x4f')]({'plain':!![]});if(!_0x29f5ab)throw new Error(_0xb45e('0x62'));if(_0x29f5ab[_0xb45e('0x63')]===_0xb45e('0x58')){return db[_0xb45e('0x64')]['find']({'where':{'name':_0xb45e('0x65'),'userProfileId':_0x29f5ab['userProfileId']},'raw':!![]})[_0xb45e('0x2a')](function(_0x23385c){if(_0x23385c){if(_0x23385c['autoAssociation']===0x0){return db[_0xb45e('0x66')][_0xb45e('0x44')]({'where':{'sectionId':_0x23385c['id']},'raw':!![]})['then'](function(_0x1c978b){var _0x946cba=[];if(_['isEmpty'](_0x1c978b)){_0x946cba=_[_0xb45e('0x3e')](_0x5b0a53,function(_0x4619ad){if(_0x4619ad[_0xb45e('0x63')]!=='agent'){return _0x4619ad;}});return _0x946cba;}else{for(var _0x4f96ee=0x0;_0x4f96ee<_0x5b0a53['length'];_0x4f96ee++){var _0x1dcd0d=_0x5b0a53[_0x4f96ee];if(_0x1dcd0d[_0xb45e('0x63')]===_0xb45e('0x67')){var _0x1c31d2=_[_0xb45e('0x4a')](_0x1c978b,function(_0x4fde7d){return _0x4fde7d[_0xb45e('0x68')]===_0x1dcd0d['id'];});if(_0x1c31d2)_0x946cba[_0xb45e('0x69')](_0x1dcd0d);}else{_0x946cba['push'](_0x1dcd0d);}}return _0x946cba;}});}else{return _0x5b0a53;}}else{var _0xda5571=_[_0xb45e('0x3e')](_0x5b0a53,function(_0x382bb4){if(_0x382bb4[_0xb45e('0x63')]!==_0xb45e('0x67')){return _0x382bb4;}});return _0xda5571;}});}else{return _0x5b0a53;}}})[_0xb45e('0x2a')](function(_0x470ca0){var _0x32f9a5=[];if(_0x470ca0){_0x23d595=_0x470ca0;for(var _0x29c2b4=0x0;_0x29c2b4<_0x470ca0[_0xb45e('0x48')];_0x29c2b4+=0x1){_0x23d595[_0x29c2b4][_0xb45e('0x50')]=[];_0x32f9a5[_0xb45e('0x69')](db[_0xb45e('0x30')][_0xb45e('0x4a')]({'where':{'FromId':[_0x52313d[_0xb45e('0x58')]['id'],_0x470ca0[_0x29c2b4]['id']],'ToId':[_0x52313d[_0xb45e('0x58')]['id'],_0x470ca0[_0x29c2b4]['id']],'ChatGroupId':null},'attributes':['id',_0xb45e('0x51'),_0xb45e('0x6a'),_0xb45e('0x6b'),_0xb45e('0x6c'),'body'],'order':qs['sort'](_0xb45e('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb45e('0x2a')](wrapUser(_0x470ca0[_0x29c2b4])));}return BPromise['all'](_0x32f9a5);}return[];})['then'](function(_0x35c996){return{'rows':_0x35c996,'count':_0x35c996[_0xb45e('0x48')]};})[_0xb45e('0x2a')](respondWithResult(_0x1aef2f,null))['catch'](handleError(_0x1aef2f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 52c7939..07f6941 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 _0x2dff=['../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2dff,0x86));var _0xf2df=function(_0x5b6eb0,_0x11fe92){_0x5b6eb0=_0x5b6eb0-0x0;var _0x44e043=_0x2dff[_0x5b6eb0];return _0x44e043;};'use strict';var EventEmitter=require(_0xf2df('0x0'));var ChatInternalMessage=require(_0xf2df('0x1'))['db'][_0xf2df('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf2df('0x3'),'afterUpdate':_0xf2df('0x4'),'afterDestroy':_0xf2df('0x5')};function emitEvent(_0x2d16fd){return function(_0x105dcc,_0x5d670a,_0x400d91){ChatInternalMessageEvents[_0xf2df('0x6')](_0x2d16fd+':'+_0x105dcc['id'],_0x105dcc);ChatInternalMessageEvents[_0xf2df('0x6')](_0x2d16fd,_0x105dcc);_0x400d91(null);};}for(var e in events){if(events[_0xf2df('0x7')](e)){var event=events[e];ChatInternalMessage[_0xf2df('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x445e=['emit','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x333752,_0x11b776){var _0x2c3de5=function(_0x2cc0fb){while(--_0x2cc0fb){_0x333752['push'](_0x333752['shift']());}};_0x2c3de5(++_0x11b776);}(_0x445e,0x1d1));var _0xe445=function(_0x441dd4,_0x582db9){_0x441dd4=_0x441dd4-0x0;var _0x54ea8b=_0x445e[_0x441dd4];return _0x54ea8b;};'use strict';var EventEmitter=require(_0xe445('0x0'));var ChatInternalMessage=require(_0xe445('0x1'))['db'][_0xe445('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe445('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11a226){return function(_0x5d46f4,_0x4071a9,_0x45418c){ChatInternalMessageEvents[_0xe445('0x4')](_0x11a226+':'+_0x5d46f4['id'],_0x5d46f4);ChatInternalMessageEvents[_0xe445('0x4')](_0x11a226,_0x5d46f4);_0x45418c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xe445('0x5')](e,emitEvent(event));}}module[_0xe445('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index faf61a7..8fb7e21 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 _0x5c52=['path','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x503973,_0x1d66a1){var _0x8b0684=function(_0x633669){while(--_0x633669){_0x503973['push'](_0x503973['shift']());}};_0x8b0684(++_0x1d66a1);}(_0x5c52,0x1d0));var _0x25c5=function(_0x15de45,_0x3def6a){_0x15de45=_0x15de45-0x0;var _0x1514a4=_0x5c52[_0x15de45];return _0x1514a4;};'use strict';var _=require(_0x25c5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25c5('0x1'));var moment=require(_0x25c5('0x2'));var BPromise=require(_0x25c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c5('0x4'));var rimraf=require('rimraf');var config=require(_0x25c5('0x5'));var attributes=require(_0x25c5('0x6'));module[_0x25c5('0x7')]=function(_0x57eb72,_0x4b4a9d){return _0x57eb72['define'](_0x25c5('0x8'),attributes,{'tableName':_0x25c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25c5('0xa'),'collate':_0x25c5('0xb')});}; \ No newline at end of file +var _0x5850=['bluebird','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5850,0x14e));var _0x0585=function(_0x5ce0c5,_0x31c821){_0x5ce0c5=_0x5ce0c5-0x0;var _0x2ef5c0=_0x5850[_0x5ce0c5];return _0x2ef5c0;};'use strict';var _=require(_0x0585('0x0'));var util=require(_0x0585('0x1'));var logger=require(_0x0585('0x2'))('api');var moment=require(_0x0585('0x3'));var BPromise=require(_0x0585('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0585('0x5'));var rimraf=require(_0x0585('0x6'));var config=require('../../config/environment');var attributes=require(_0x0585('0x7'));module[_0x0585('0x8')]=function(_0x52be25,_0xcb7420){return _0x52be25[_0x0585('0x9')](_0x0585('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0585('0xb'),'collate':_0x0585('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index da64ca0..24dcb25 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 _0xb905=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xb905,0xa7));var _0x5b90=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb905[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x5b90('0x0'));var util=require('util');var moment=require(_0x5b90('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b90('0x2'));var fs=require('fs');var Redis=require(_0x5b90('0x3'));var db=require(_0x5b90('0x4'))['db'];var utils=require(_0x5b90('0x5'));var logger=require(_0x5b90('0x6'))(_0x5b90('0x7'));var config=require(_0x5b90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b90('0x9')]['http']({'port':0x232a});config[_0x5b90('0xa')]=_[_0x5b90('0xb')](config['redis'],{'host':_0x5b90('0xc'),'port':0x18eb});var socket=require(_0x5b90('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5b90('0xe')](socket);function respondWithRpcPromise(_0xb237d0,_0x1ff893,_0x2a7532){return new BPromise(function(_0x73a586,_0x22f563){return client[_0x5b90('0xf')](_0xb237d0,_0x2a7532)[_0x5b90('0x10')](function(_0x117c4a){logger[_0x5b90('0x11')](_0x5b90('0x12'),_0x1ff893,_0x5b90('0x13'));logger['debug'](_0x5b90('0x14'),_0x1ff893,_0x5b90('0x13'),JSON[_0x5b90('0x15')](_0x117c4a));if(_0x117c4a[_0x5b90('0x16')]){if(_0x117c4a['error'][_0x5b90('0x17')]===0x1f4){logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);return _0x22f563(_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);}logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);return _0x73a586(_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);}else{logger[_0x5b90('0x11')](_0x5b90('0x12'),_0x1ff893,'request\x20sent');_0x73a586(_0x117c4a[_0x5b90('0x19')]['message']);}})[_0x5b90('0x1a')](function(_0x57c742){logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x57c742);_0x22f563(_0x57c742);});});} \ No newline at end of file +var _0x899a=['error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e8a6c,_0x57aaea){var _0x4ee7f9=function(_0x16e499){while(--_0x16e499){_0x4e8a6c['push'](_0x4e8a6c['shift']());}};_0x4ee7f9(++_0x57aaea);}(_0x899a,0x1b6));var _0xa899=function(_0xd1effc,_0x2b719f){_0xd1effc=_0xd1effc-0x0;var _0x13935a=_0x899a[_0xd1effc];return _0x13935a;};'use strict';var _=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var moment=require('moment');var BPromise=require(_0xa899('0x2'));var rs=require(_0xa899('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa899('0x4'))['db'];var utils=require(_0xa899('0x5'));var logger=require(_0xa899('0x6'))(_0xa899('0x7'));var config=require('../../config/environment');var jayson=require(_0xa899('0x8'));var client=jayson[_0xa899('0x9')][_0xa899('0xa')]({'port':0x232a});config[_0xa899('0xb')]=_['defaults'](config[_0xa899('0xb')],{'host':_0xa899('0xc'),'port':0x18eb});var socket=require(_0xa899('0xd'))(new Redis(config[_0xa899('0xb')]));require(_0xa899('0xe'))[_0xa899('0xf')](socket);function respondWithRpcPromise(_0x30954d,_0x184920,_0x1fbfa6){return new BPromise(function(_0x34282a,_0x5a6582){return client[_0xa899('0x10')](_0x30954d,_0x1fbfa6)['then'](function(_0x4eb704){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x184920,_0xa899('0x11'));logger[_0xa899('0x12')](_0xa899('0x13'),_0x184920,'request\x20sent',JSON[_0xa899('0x14')](_0x4eb704));if(_0x4eb704[_0xa899('0x15')]){if(_0x4eb704['error'][_0xa899('0x16')]===0x1f4){logger[_0xa899('0x15')](_0xa899('0x17'),_0x184920,_0x4eb704[_0xa899('0x15')]['message']);return _0x5a6582(_0x4eb704[_0xa899('0x15')][_0xa899('0x18')]);}logger['error'](_0xa899('0x17'),_0x184920,_0x4eb704[_0xa899('0x15')][_0xa899('0x18')]);return _0x34282a(_0x4eb704['error']['message']);}else{logger[_0xa899('0x19')](_0xa899('0x17'),_0x184920,_0xa899('0x11'));_0x34282a(_0x4eb704[_0xa899('0x1a')][_0xa899('0x18')]);}})['catch'](function(_0x332ced){logger['error'](_0xa899('0x17'),_0x184920,_0x332ced);_0x5a6582(_0x332ced);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1cf92a6..823b022 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 _0x25ca=['register','length','chatInternalMessage:','./chatInternalMessage.events','update','emit','removeListener'];(function(_0x16158a,_0xe26d9b){var _0x159b87=function(_0x45a741){while(--_0x45a741){_0x16158a['push'](_0x16158a['shift']());}};_0x159b87(++_0xe26d9b);}(_0x25ca,0x184));var _0xa25c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x25ca[_0x1deb03];return _0x189fe7;};'use strict';var ChatInternalMessageEvents=require(_0xa25c('0x0'));var events=['save','remove',_0xa25c('0x1')];function createListener(_0x297541,_0x4fbca6){return function(_0x5590b0){_0x4fbca6[_0xa25c('0x2')](_0x297541,_0x5590b0);};}function removeListener(_0x4893b6,_0x18cbcc){return function(){ChatInternalMessageEvents[_0xa25c('0x3')](_0x4893b6,_0x18cbcc);};}exports[_0xa25c('0x4')]=function(_0x3f48b0){for(var _0x2011a5=0x0,_0x66f543=events[_0xa25c('0x5')];_0x2011a5<_0x66f543;_0x2011a5++){var _0x5cb35f=events[_0x2011a5];var _0x4aa405=createListener(_0xa25c('0x6')+_0x5cb35f,_0x3f48b0);ChatInternalMessageEvents['on'](_0x5cb35f,_0x4aa405);}}; \ No newline at end of file +var _0x0a2e=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x0a2e,0x174));var _0xe0a2=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x0a2e[_0x23ec06];return _0x2831d4;};'use strict';var ChatInternalMessageEvents=require(_0xe0a2('0x0'));var events=[_0xe0a2('0x1'),_0xe0a2('0x2'),_0xe0a2('0x3')];function createListener(_0x147566,_0x46de12){return function(_0x3bc5fa){_0x46de12[_0xe0a2('0x4')](_0x147566,_0x3bc5fa);};}function removeListener(_0x564b80,_0x25d7b9){return function(){ChatInternalMessageEvents['removeListener'](_0x564b80,_0x25d7b9);};}exports[_0xe0a2('0x5')]=function(_0x3a3cd7){for(var _0x248133=0x0,_0x17515f=events[_0xe0a2('0x6')];_0x248133<_0x17515f;_0x248133++){var _0x4913ae=events[_0x248133];var _0xc7a496=createListener(_0xe0a2('0x7')+_0x4913ae,_0x3a3cd7);ChatInternalMessageEvents['on'](_0x4913ae,_0xc7a496);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7f88a04..18934d3 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 _0xaadf=['/describe','describe','/users','getUsers','show','post','create','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get'];(function(_0x47cf35,_0x364f9d){var _0x208e09=function(_0x356262){while(--_0x356262){_0x47cf35['push'](_0x47cf35['shift']());}};_0x208e09(++_0x364f9d);}(_0xaadf,0x114));var _0xfaad=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xaadf[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xfaad('0x0'));var util=require(_0xfaad('0x1'));var path=require(_0xfaad('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaad('0x3'));var router=express['Router']();var fs_extra=require(_0xfaad('0x4'));var auth=require(_0xfaad('0x5'));var interaction=require(_0xfaad('0x6'));var config=require(_0xfaad('0x7'));var controller=require(_0xfaad('0x8'));router['get']('/',auth[_0xfaad('0x9')](),controller[_0xfaad('0xa')]);router[_0xfaad('0xb')](_0xfaad('0xc'),auth[_0xfaad('0x9')](),controller[_0xfaad('0xd')]);router[_0xfaad('0xb')](_0xfaad('0xe'),auth[_0xfaad('0x9')](),controller[_0xfaad('0xf')]);router[_0xfaad('0xb')]('/:id',auth[_0xfaad('0x9')](),controller[_0xfaad('0x10')]);router[_0xfaad('0x11')]('/',auth[_0xfaad('0x9')](),controller[_0xfaad('0x12')]);router[_0xfaad('0x13')](_0xfaad('0x14'),controller[_0xfaad('0x15')]);router[_0xfaad('0x16')](_0xfaad('0x14'),auth[_0xfaad('0x9')](),controller['destroy']);module[_0xfaad('0x17')]=router; \ No newline at end of file +var _0xa40c=['put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','get','index','isAuthenticated','describe','/users','/:id','show'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa40c,0x1f1));var _0xca40=function(_0x1e3b2c,_0x446d83){_0x1e3b2c=_0x1e3b2c-0x0;var _0x561c3a=_0xa40c[_0x1e3b2c];return _0x561c3a;};'use strict';var multer=require(_0xca40('0x0'));var util=require(_0xca40('0x1'));var path=require(_0xca40('0x2'));var timeout=require('connect-timeout');var express=require(_0xca40('0x3'));var router=express[_0xca40('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xca40('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0xca40('0x6')]('/',auth['isAuthenticated'](),controller[_0xca40('0x7')]);router[_0xca40('0x6')]('/describe',auth[_0xca40('0x8')](),controller[_0xca40('0x9')]);router['get'](_0xca40('0xa'),auth[_0xca40('0x8')](),controller['getUsers']);router['get'](_0xca40('0xb'),auth[_0xca40('0x8')](),controller[_0xca40('0xc')]);router['post']('/',auth[_0xca40('0x8')](),controller['create']);router[_0xca40('0xd')](_0xca40('0xb'),controller[_0xca40('0xe')]);router[_0xca40('0xf')](_0xca40('0xb'),auth[_0xca40('0x8')](),controller['destroy']);module[_0xca40('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 299e4f6..074b670 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 _0x69d4=['DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','out'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x69d4,0x83));var _0x469d=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x69d4[_0x2aee2f];return _0x19337f;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x469d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x469d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x469d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x469d('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x469d('0x5')]},'providerName':{'type':Sequelize[_0x469d('0x6')]},'providerResponse':{'type':Sequelize[_0x469d('0x7')]}}; \ No newline at end of file +var _0x9ffd=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x298d38,_0x2805b5){_0x298d38=_0x298d38-0x0;var _0x18be54=_0x9ffd[_0x298d38];return _0x18be54;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'body':{'type':Sequelize[_0xd9ff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9ff('0x4')]('in',_0xd9ff('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xd9ff('0x6')]},'providerName':{'type':Sequelize[_0xd9ff('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bf87a3d..d78cc2a 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 _0xf49d=['readAt','format','UserId','user','get','ChatInteraction','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','reject','ChatInteractionId','rejectMessage','agent','fullname','interface','rejectmessage','formData','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','name','map','ChatMessage','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','update','destroy','params','describe','../../config/logger','chat-interactions','accept','chat','read'];(function(_0x444bc8,_0x16c462){var _0x881def=function(_0xe97706){while(--_0xe97706){_0x444bc8['push'](_0x444bc8['shift']());}};_0x881def(++_0x16c462);}(_0xf49d,0x1a0));var _0xdf49=function(_0x79f7c9,_0x35fa6a){_0x79f7c9=_0x79f7c9-0x0;var _0x44ebae=_0xf49d[_0x79f7c9];return _0x44ebae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf49('0x0'));var zipdir=require(_0xdf49('0x1'));var jsonpatch=require(_0xdf49('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf49('0x3'));var util=require(_0xdf49('0x4'));var path=require(_0xdf49('0x5'));var sox=require(_0xdf49('0x6'));var csv=require(_0xdf49('0x7'));var ejs=require(_0xdf49('0x8'));var fs=require('fs');var fs_extra=require(_0xdf49('0x9'));var _=require(_0xdf49('0xa'));var squel=require(_0xdf49('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf49('0xc'));var toCsv=require(_0xdf49('0x7'));var querystring=require(_0xdf49('0xd'));var Papa=require(_0xdf49('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf49('0xf'));var as=require(_0xdf49('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf49('0x11'));var utils=require(_0xdf49('0x12'));var config=require(_0xdf49('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf49('0x14'))['db'];config[_0xdf49('0x15')]=_[_0xdf49('0x16')](config[_0xdf49('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf49('0x17'))(new Redis(config[_0xdf49('0x15')]));require(_0xdf49('0x18'))[_0xdf49('0x19')](socket);var jayson=require(_0xdf49('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xdf49('0x1b')][_0xdf49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x579656,_0x222490,_0x5c31bc,_0x121a62){return new BPromise(function(_0xfc7993,_0x3bb364){var _0x143b42=_0x121a62||client;return _0x143b42[_0xdf49('0x1d')](_0x579656,_0x5c31bc)['then'](function(_0x1e92ef){logger[_0xdf49('0x1e')](_0xdf49('0x1f'),_0x222490,_0xdf49('0x20'));logger[_0xdf49('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x222490,_0xdf49('0x20'),JSON['stringify'](_0x1e92ef));if(_0x1e92ef[_0xdf49('0x22')]){if(_0x1e92ef[_0xdf49('0x22')][_0xdf49('0x23')]===0x1f4){logger['error'](_0xdf49('0x1f'),_0x222490,_0x1e92ef['error'][_0xdf49('0x24')]);return _0x3bb364(_0x1e92ef[_0xdf49('0x22')][_0xdf49('0x24')]);}logger[_0xdf49('0x22')](_0xdf49('0x1f'),_0x222490,_0x1e92ef[_0xdf49('0x22')][_0xdf49('0x24')]);return _0xfc7993(_0x1e92ef[_0xdf49('0x22')]['message']);}else{logger[_0xdf49('0x1e')](_0xdf49('0x1f'),_0x222490,'request\x20sent');_0xfc7993(_0x1e92ef['result'][_0xdf49('0x24')]);}})[_0xdf49('0x25')](function(_0x3e8ea2){logger[_0xdf49('0x22')]('ChatMessage,\x20%s,\x20%s',_0x222490,_0x3e8ea2);_0x3bb364(_0x3e8ea2);});});}function respondWithStatusCode(_0x33be8d,_0x501597){_0x501597=_0x501597||0xcc;return function(_0x50370){if(_0x50370){return _0x33be8d[_0xdf49('0x26')](_0x501597);}return _0x33be8d[_0xdf49('0x27')](_0x501597)[_0xdf49('0x28')]();};}function respondWithResult(_0x456a75,_0x368be0){_0x368be0=_0x368be0||0xc8;return function(_0x148d45){if(_0x148d45){return _0x456a75[_0xdf49('0x27')](_0x368be0)['json'](_0x148d45);}};}function respondWithFilteredResult(_0x512f13,_0x34c769){return function(_0x4eec9b){if(_0x4eec9b){var _0x427e75=typeof _0x34c769[_0xdf49('0x29')]===_0xdf49('0x2a')&&typeof _0x34c769[_0xdf49('0x2b')]===_0xdf49('0x2a');var _0x27f612=_0x4eec9b[_0xdf49('0x2c')];var _0x5e2088=_0x427e75?0x0:_0x34c769['offset'];var _0x53e6af=_0x427e75?_0x4eec9b[_0xdf49('0x2c')]:_0x34c769[_0xdf49('0x29')]+_0x34c769[_0xdf49('0x2b')];var _0x4fc636;if(_0x53e6af>=_0x27f612){_0x53e6af=_0x27f612;_0x4fc636=0xc8;}else{_0x4fc636=0xce;}_0x512f13[_0xdf49('0x27')](_0x4fc636);return _0x512f13[_0xdf49('0x2d')](_0xdf49('0x2e'),_0x5e2088+'-'+_0x53e6af+'/'+_0x27f612)[_0xdf49('0x2f')](_0x4eec9b);}return null;};}function patchUpdates(_0x413967){return function(_0x2bb078){try{jsonpatch['apply'](_0x2bb078,_0x413967,!![]);}catch(_0x2418d8){return BPromise['reject'](_0x2418d8);}return _0x2bb078[_0xdf49('0x30')]();};}function saveUpdates(_0x291b16,_0x5b542e){return function(_0x17d48d){if(_0x17d48d){return _0x17d48d['update'](_0x291b16)[_0xdf49('0x31')](function(_0x3dc4bc){return _0x3dc4bc;});}return null;};}function removeEntity(_0x1de5e1,_0x1b1a19){return function(_0x48dd64){if(_0x48dd64){return _0x48dd64['destroy']()[_0xdf49('0x31')](function(){_0x1de5e1[_0xdf49('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x532267,_0x1fe770){return function(_0x37ba6c){if(!_0x37ba6c){_0x532267[_0xdf49('0x26')](0x194);}return _0x37ba6c;};}function handleError(_0x3d9d0e,_0x4c1554){_0x4c1554=_0x4c1554||0x1f4;return function(_0x2d878c){logger['error'](_0x2d878c['stack']);if(_0x2d878c[_0xdf49('0x32')]){delete _0x2d878c['name'];}_0x3d9d0e[_0xdf49('0x27')](_0x4c1554)['send'](_0x2d878c);};}exports['index']=function(_0x9c80a8,_0x2ffbd2){var _0x234cab={},_0x3f1837={},_0x5cfa9c={'count':0x0,'rows':[]};var _0x50791d=_[_0xdf49('0x33')](db[_0xdf49('0x34')]['rawAttributes'],function(_0x212a69){return{'name':_0x212a69['fieldName'],'type':_0x212a69['type'][_0xdf49('0x35')]};});_0x3f1837['model']=_[_0xdf49('0x33')](_0x50791d,_0xdf49('0x32'));_0x3f1837[_0xdf49('0x36')]=_['keys'](_0x9c80a8[_0xdf49('0x36')]);_0x3f1837[_0xdf49('0x37')]=_['intersection'](_0x3f1837[_0xdf49('0x38')],_0x3f1837['query']);_0x234cab[_0xdf49('0x39')]=_[_0xdf49('0x3a')](_0x3f1837[_0xdf49('0x38')],qs[_0xdf49('0x3b')](_0x9c80a8[_0xdf49('0x36')][_0xdf49('0x3b')]));_0x234cab['attributes']=_0x234cab['attributes'][_0xdf49('0x3c')]?_0x234cab['attributes']:_0x3f1837[_0xdf49('0x38')];if(!_0x9c80a8['query'][_0xdf49('0x3d')]('nolimit')){_0x234cab[_0xdf49('0x2b')]=qs[_0xdf49('0x2b')](_0x9c80a8['query']['limit']);_0x234cab[_0xdf49('0x29')]=qs[_0xdf49('0x29')](_0x9c80a8[_0xdf49('0x36')][_0xdf49('0x29')]);}_0x234cab[_0xdf49('0x3e')]=qs[_0xdf49('0x3f')](_0x9c80a8[_0xdf49('0x36')]['sort']);_0x234cab[_0xdf49('0x40')]=qs[_0xdf49('0x37')](_['pick'](_0x9c80a8['query'],_0x3f1837[_0xdf49('0x37')]),_0x50791d);if(_0x9c80a8[_0xdf49('0x36')][_0xdf49('0x41')]){_0x234cab[_0xdf49('0x40')]=_[_0xdf49('0x42')](_0x234cab[_0xdf49('0x40')],{'$or':_[_0xdf49('0x33')](_0x50791d,function(_0x229870){if(_0x229870[_0xdf49('0x43')]!==_0xdf49('0x44')){var _0x54a776={};_0x54a776[_0x229870[_0xdf49('0x32')]]={'$like':'%'+_0x9c80a8['query'][_0xdf49('0x41')]+'%'};return _0x54a776;}})});}_0x234cab=_[_0xdf49('0x42')]({},_0x234cab,_0x9c80a8[_0xdf49('0x45')]);var _0x504b04={'where':_0x234cab[_0xdf49('0x40')]};return db[_0xdf49('0x34')][_0xdf49('0x2c')](_0x504b04)[_0xdf49('0x31')](function(_0x572bb3){_0x5cfa9c[_0xdf49('0x2c')]=_0x572bb3;if(_0x9c80a8[_0xdf49('0x36')][_0xdf49('0x46')]){_0x234cab[_0xdf49('0x47')]=[{'all':!![]}];}return db[_0xdf49('0x34')][_0xdf49('0x48')](_0x234cab);})[_0xdf49('0x31')](function(_0x27aea1){_0x5cfa9c[_0xdf49('0x49')]=_0x27aea1;return _0x5cfa9c;})[_0xdf49('0x31')](respondWithFilteredResult(_0x2ffbd2,_0x234cab))[_0xdf49('0x25')](handleError(_0x2ffbd2,null));};exports[_0xdf49('0x4a')]=function(_0x1c4ed3,_0x342a01){var _0x50ed5d={'raw':!![],'where':{'id':_0x1c4ed3['params']['id']}},_0x1c8fe5={};_0x1c8fe5[_0xdf49('0x38')]=_[_0xdf49('0x4b')](db[_0xdf49('0x34')]['rawAttributes']);_0x1c8fe5[_0xdf49('0x36')]=_[_0xdf49('0x4b')](_0x1c4ed3[_0xdf49('0x36')]);_0x1c8fe5[_0xdf49('0x37')]=_[_0xdf49('0x3a')](_0x1c8fe5[_0xdf49('0x38')],_0x1c8fe5[_0xdf49('0x36')]);_0x50ed5d[_0xdf49('0x39')]=_[_0xdf49('0x3a')](_0x1c8fe5[_0xdf49('0x38')],qs[_0xdf49('0x3b')](_0x1c4ed3[_0xdf49('0x36')][_0xdf49('0x3b')]));_0x50ed5d[_0xdf49('0x39')]=_0x50ed5d[_0xdf49('0x39')][_0xdf49('0x3c')]?_0x50ed5d['attributes']:_0x1c8fe5[_0xdf49('0x38')];if(_0x1c4ed3[_0xdf49('0x36')][_0xdf49('0x46')]){_0x50ed5d[_0xdf49('0x47')]=[{'all':!![]}];}_0x50ed5d=_['merge']({},_0x50ed5d,_0x1c4ed3[_0xdf49('0x45')]);return db[_0xdf49('0x34')][_0xdf49('0x4c')](_0x50ed5d)[_0xdf49('0x31')](handleEntityNotFound(_0x342a01,null))[_0xdf49('0x31')](respondWithResult(_0x342a01,null))[_0xdf49('0x25')](handleError(_0x342a01,null));};exports[_0xdf49('0x4d')]=function(_0x30c74f,_0x4f6745){return db[_0xdf49('0x34')][_0xdf49('0x4d')](_0x30c74f[_0xdf49('0x4e')],{})[_0xdf49('0x31')](respondWithResult(_0x4f6745,0xc9))['catch'](handleError(_0x4f6745,null));};exports[_0xdf49('0x4f')]=function(_0x54d670,_0x31be48){if(_0x54d670[_0xdf49('0x4e')]['id']){delete _0x54d670[_0xdf49('0x4e')]['id'];}return db[_0xdf49('0x34')]['find']({'where':{'id':_0x54d670['params']['id']}})[_0xdf49('0x31')](handleEntityNotFound(_0x31be48,null))[_0xdf49('0x31')](saveUpdates(_0x54d670['body'],null))['then'](respondWithResult(_0x31be48,null))[_0xdf49('0x25')](handleError(_0x31be48,null));};exports[_0xdf49('0x50')]=function(_0x4bad0d,_0x4ff648){return db[_0xdf49('0x34')][_0xdf49('0x4c')]({'where':{'id':_0x4bad0d[_0xdf49('0x51')]['id']}})[_0xdf49('0x31')](handleEntityNotFound(_0x4ff648,null))[_0xdf49('0x31')](removeEntity(_0x4ff648,null))[_0xdf49('0x25')](handleError(_0x4ff648,null));};exports[_0xdf49('0x52')]=function(_0x5cc7de,_0x3bb9a7){return db[_0xdf49('0x34')][_0xdf49('0x52')]()['then'](respondWithResult(_0x3bb9a7,null))['catch'](handleError(_0x3bb9a7,null));};var interaction_log=require(_0xdf49('0x53'))(_0xdf49('0x54'));exports[_0xdf49('0x55')]=function(_0x139e4a,_0x5436b8,_0x53cc1f){var _0x5c9c34={'agent':{},'channel':_0xdf49('0x56')};if(_0x139e4a[_0xdf49('0x4e')]['id']){delete _0x139e4a[_0xdf49('0x4e')]['id'];}_0x139e4a[_0xdf49('0x4e')][_0xdf49('0x57')]=!![];_0x139e4a['body'][_0xdf49('0x58')]=moment()[_0xdf49('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x139e4a[_0xdf49('0x4e')]['UserId']=_0x139e4a[_0xdf49('0x4e')][_0xdf49('0x5a')]||_0x139e4a[_0xdf49('0x5b')]['id'];_0x5c9c34['agent']['id']=_0x139e4a[_0xdf49('0x4e')][_0xdf49('0x5a')];return db['ChatMessage']['find']({'where':{'id':_0x139e4a[_0xdf49('0x51')]['id'],'UserId':null}})[_0xdf49('0x31')](handleEntityNotFound(_0x5436b8,null))[_0xdf49('0x31')](saveUpdates(_0x139e4a[_0xdf49('0x4e')],null))[_0xdf49('0x31')](function(_0x36cdc6){if(_0x36cdc6){_0x5c9c34[_0xdf49('0x24')]=_0x36cdc6[_0xdf49('0x5c')]({'plain':!![]});return db[_0xdf49('0x5d')][_0xdf49('0x4c')]({'where':{'id':_0x36cdc6['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5436b8,null))[_0xdf49('0x31')](function(_0x5e54f5){if(_0x5e54f5){return _0x5e54f5[_0xdf49('0x4f')]({'UserId':_0x139e4a[_0xdf49('0x4e')][_0xdf49('0x5a')],'read1stAt':_[_0xdf49('0x5e')](_0x5e54f5['read1stAt'])?moment()[_0xdf49('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdf49('0x31')](function(_0x23b8c8){if(_0x23b8c8){_0x5c9c34[_0xdf49('0x5f')]=_0x23b8c8[_0xdf49('0x5c')]({'plain':!![]});interaction_log['info'](_0xdf49('0x60'),_0x139e4a[_0xdf49('0x5b')]['id'],_0x139e4a[_0xdf49('0x5b')][_0xdf49('0x32')],_0x139e4a[_0xdf49('0x5b')][_0xdf49('0x61')],_0x5c9c34[_0xdf49('0x5f')]['id'],_0x139e4a['body']?JSON[_0xdf49('0x62')](_0x139e4a['body']):_0xdf49('0x63'));return respondWithRpcPromise(_0xdf49('0x64'),_0xdf49('0x65'),_0x5c9c34);}return null;})['then'](function(_0x301f6a){var _0x35c03c=_0xdf49('0x66')+_0x301f6a[_0xdf49('0x24')]['ContactId'];return db[_0xdf49('0x67')]['query'](_0x35c03c,{'type':db[_0xdf49('0x68')][_0xdf49('0x69')][_0xdf49('0x6a')],'raw':!![]})[_0xdf49('0x31')](function(_0x1c85de){return _0x1c85de;});})[_0xdf49('0x31')](function(_0x29789e){if(_0x29789e){_0x5c9c34[_0xdf49('0x24')][_0xdf49('0x6b')]=_0x29789e[0x0];if(!_0x139e4a['body'][_0xdf49('0x5a')])return;return db[_0xdf49('0x6c')][_0xdf49('0x4c')]({'where':{'id':_0x139e4a[_0xdf49('0x4e')][_0xdf49('0x5a')],'role':'agent'},'attributes':['id',_0xdf49('0x32'),'fullname',_0xdf49('0x6d'),_0xdf49('0x6e')],'raw':!![]});}return null;})[_0xdf49('0x31')](function(_0x5b90e3){if(!_0x5b90e3)return null;_0x5c9c34['message']['agent']=_0x5b90e3;return _0x5c9c34;})['then'](function(_0x2e1d5f){if(_0x2e1d5f){if(_0x139e4a['body'][_0xdf49('0x6f')]){_0x5c9c34['message']['interface']=util['format'](_0xdf49('0x70'),_0x139e4a['user']['name']);_0x5c9c34[_0xdf49('0x24')][_0xdf49('0x71')]=_0x5c9c34[_0xdf49('0x71')];_0x5c9c34[_0xdf49('0x24')][_0xdf49('0x72')]=_0x5c9c34[_0xdf49('0x71')];_0x5c9c34[_0xdf49('0x24')]['event']=_0xdf49('0x55');return respondWithRpcPromise('EventManager',_0xdf49('0x73'),{'event':_0xdf49('0x74'),'message':_[_0xdf49('0x42')](_0x5c9c34[_0xdf49('0x24')],JSON[_0xdf49('0x75')](_0x5c9c34[_0xdf49('0x5f')]['formData']))},client9002)[_0xdf49('0x31')](function(){return _0x5c9c34;});}return _0x5c9c34;}return null;})['then'](respondWithResult(_0x5436b8,null))[_0xdf49('0x25')](handleError(_0x5436b8,null));};var interaction_log=require(_0xdf49('0x53'))(_0xdf49('0x54'));exports[_0xdf49('0x76')]=function(_0x3789a4,_0x4526d5,_0x31b78a){var _0x393bba={'agent':{},'channel':'chat'};if(_0x3789a4[_0xdf49('0x4e')]['id']){delete _0x3789a4[_0xdf49('0x4e')]['id'];}_0x3789a4[_0xdf49('0x4e')][_0xdf49('0x5a')]=_0x3789a4[_0xdf49('0x4e')][_0xdf49('0x5a')]||_0x3789a4[_0xdf49('0x5b')]['id'];_0x393bba['agent']['id']=_0x3789a4['body'][_0xdf49('0x5a')];return db[_0xdf49('0x34')][_0xdf49('0x4c')]({'where':{'id':_0x3789a4['params']['id'],'UserId':null}})[_0xdf49('0x31')](handleEntityNotFound(_0x4526d5,null))['then'](function(_0x102bee){if(_0x102bee){_0x393bba[_0xdf49('0x24')]=_0x102bee['get']({'plain':!![]});return db[_0xdf49('0x5d')][_0xdf49('0x4c')]({'where':{'id':_0x102bee[_0xdf49('0x77')]}});}return null;})[_0xdf49('0x31')](handleEntityNotFound(_0x4526d5,null))[_0xdf49('0x31')](function(_0x4705ac){if(_0x4705ac){_0x393bba['interaction']=_0x4705ac[_0xdf49('0x5c')]({'plain':!![]});interaction_log[_0xdf49('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3789a4[_0xdf49('0x5b')]['id'],_0x3789a4[_0xdf49('0x5b')][_0xdf49('0x32')],_0x3789a4[_0xdf49('0x5b')][_0xdf49('0x61')],_0x393bba[_0xdf49('0x5f')]['id'],_0x3789a4[_0xdf49('0x4e')]?JSON[_0xdf49('0x62')](_0x3789a4[_0xdf49('0x4e')]):_0xdf49('0x63'));return respondWithRpcPromise('RejectMessage',_0xdf49('0x78'),_0x393bba);}return null;})['then'](function(_0x39f1ae){var _0x36fbaa=_0xdf49('0x66')+_0x39f1ae[_0xdf49('0x24')]['ContactId'];return db['sequelize'][_0xdf49('0x36')](_0x36fbaa,{'type':db[_0xdf49('0x68')][_0xdf49('0x69')]['SELECT'],'raw':!![]})[_0xdf49('0x31')](function(_0x5004eb){return _0x5004eb;});})['then'](function(_0x4d9ae1){if(_0x4d9ae1){_0x393bba[_0xdf49('0x24')][_0xdf49('0x6b')]=_0x4d9ae1[0x0];if(!_0x3789a4[_0xdf49('0x4e')][_0xdf49('0x5a')])return;return db[_0xdf49('0x6c')]['find']({'where':{'id':_0x3789a4[_0xdf49('0x4e')][_0xdf49('0x5a')],'role':_0xdf49('0x79')},'attributes':['id',_0xdf49('0x32'),_0xdf49('0x7a'),_0xdf49('0x6d'),_0xdf49('0x6e')],'raw':!![]});}return null;})[_0xdf49('0x31')](function(_0x2621ab){if(!_0x2621ab)return null;_0x393bba[_0xdf49('0x24')][_0xdf49('0x79')]=_0x2621ab;return _0x393bba;})[_0xdf49('0x31')](function(_0x590462){if(_0x590462){_0x590462['message'][_0xdf49('0x7b')]=util[_0xdf49('0x59')](_0xdf49('0x70'),_0x3789a4[_0xdf49('0x5b')][_0xdf49('0x32')]);_0x590462[_0xdf49('0x24')][_0xdf49('0x71')]=_0x393bba[_0xdf49('0x71')];_0x590462[_0xdf49('0x24')]['motionChannel']=_0x393bba[_0xdf49('0x71')];_0x590462[_0xdf49('0x24')]['event']=_0xdf49('0x76');respondWithRpcPromise(_0xdf49('0x73'),'EventManager',{'event':_0xdf49('0x7c'),'message':_[_0xdf49('0x42')](_0x393bba[_0xdf49('0x24')],JSON[_0xdf49('0x75')](_0x393bba[_0xdf49('0x5f')][_0xdf49('0x7d')]))},client9002);return _0x393bba;}return null;})['then'](respondWithResult(_0x4526d5,null))['catch'](handleError(_0x4526d5,null));}; \ No newline at end of file +var _0xf04e=['lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','ChatMessage','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','include','findAll','rows','rawAttributes','includeAll','find','create','params','body','describe','../../config/logger','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','parse','formData','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x1cd320,_0x5247bd){var _0x491f85=function(_0x196c20){while(--_0x196c20){_0x1cd320['push'](_0x1cd320['shift']());}};_0x491f85(++_0x5247bd);}(_0xf04e,0x17c));var _0xef04=function(_0xc4f350,_0x42f971){_0xc4f350=_0xc4f350-0x0;var _0x292196=_0xf04e[_0xc4f350];return _0x292196;};'use strict';var emlformat=require(_0xef04('0x0'));var rimraf=require(_0xef04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef04('0x2'));var rp=require('request-promise');var moment=require(_0xef04('0x3'));var BPromise=require(_0xef04('0x4'));var Mustache=require(_0xef04('0x5'));var util=require(_0xef04('0x6'));var path=require('path');var sox=require(_0xef04('0x7'));var csv=require(_0xef04('0x8'));var ejs=require(_0xef04('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef04('0xa'));var squel=require(_0xef04('0xb'));var crypto=require(_0xef04('0xc'));var jsforce=require(_0xef04('0xd'));var deskjs=require(_0xef04('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef04('0xf'));var qs=require(_0xef04('0x10'));var as=require(_0xef04('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef04('0x12'));var utils=require(_0xef04('0x13'));var config=require(_0xef04('0x14'));var licenseUtil=require(_0xef04('0x15'));var db=require('../../mysqldb')['db'];config[_0xef04('0x16')]=_['defaults'](config['redis'],{'host':_0xef04('0x17'),'port':0x18eb});var socket=require(_0xef04('0x18'))(new Redis(config['redis']));require(_0xef04('0x19'))['register'](socket);var jayson=require(_0xef04('0x1a'));var client=jayson[_0xef04('0x1b')][_0xef04('0x1c')]({'port':0x232c});var client9002=jayson[_0xef04('0x1b')][_0xef04('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5e06a5,_0x274974,_0xee319b,_0x35cdff){return new BPromise(function(_0x196fc4,_0x5c85c6){var _0x356c0e=_0x35cdff||client;return _0x356c0e[_0xef04('0x1d')](_0x5e06a5,_0xee319b)[_0xef04('0x1e')](function(_0x2a54c3){logger['info'](_0xef04('0x1f'),_0x274974,'request\x20sent');logger[_0xef04('0x20')](_0xef04('0x21'),_0x274974,_0xef04('0x22'),JSON[_0xef04('0x23')](_0x2a54c3));if(_0x2a54c3[_0xef04('0x24')]){if(_0x2a54c3[_0xef04('0x24')][_0xef04('0x25')]===0x1f4){logger[_0xef04('0x24')](_0xef04('0x1f'),_0x274974,_0x2a54c3[_0xef04('0x24')][_0xef04('0x26')]);return _0x5c85c6(_0x2a54c3[_0xef04('0x24')]['message']);}logger[_0xef04('0x24')]('ChatMessage,\x20%s,\x20%s',_0x274974,_0x2a54c3[_0xef04('0x24')][_0xef04('0x26')]);return _0x196fc4(_0x2a54c3[_0xef04('0x24')]['message']);}else{logger[_0xef04('0x27')](_0xef04('0x1f'),_0x274974,_0xef04('0x22'));_0x196fc4(_0x2a54c3[_0xef04('0x28')]['message']);}})[_0xef04('0x29')](function(_0x1eca0e){logger[_0xef04('0x24')](_0xef04('0x1f'),_0x274974,_0x1eca0e);_0x5c85c6(_0x1eca0e);});});}function respondWithStatusCode(_0x344643,_0x4b17c6){_0x4b17c6=_0x4b17c6||0xcc;return function(_0x238f69){if(_0x238f69){return _0x344643[_0xef04('0x2a')](_0x4b17c6);}return _0x344643[_0xef04('0x2b')](_0x4b17c6)['end']();};}function respondWithResult(_0x5fe9ad,_0x1046fa){_0x1046fa=_0x1046fa||0xc8;return function(_0xf90ad5){if(_0xf90ad5){return _0x5fe9ad[_0xef04('0x2b')](_0x1046fa)['json'](_0xf90ad5);}};}function respondWithFilteredResult(_0x36fa36,_0x2e2ca2){return function(_0x4d7ed9){if(_0x4d7ed9){var _0x5182b1=typeof _0x2e2ca2['offset']===_0xef04('0x2c')&&typeof _0x2e2ca2[_0xef04('0x2d')]===_0xef04('0x2c');var _0x2c920b=_0x4d7ed9[_0xef04('0x2e')];var _0x30f378=_0x5182b1?0x0:_0x2e2ca2['offset'];var _0x4c12aa=_0x5182b1?_0x4d7ed9['count']:_0x2e2ca2[_0xef04('0x2f')]+_0x2e2ca2[_0xef04('0x2d')];var _0x2cd82b;if(_0x4c12aa>=_0x2c920b){_0x4c12aa=_0x2c920b;_0x2cd82b=0xc8;}else{_0x2cd82b=0xce;}_0x36fa36[_0xef04('0x2b')](_0x2cd82b);return _0x36fa36[_0xef04('0x30')](_0xef04('0x31'),_0x30f378+'-'+_0x4c12aa+'/'+_0x2c920b)['json'](_0x4d7ed9);}return null;};}function patchUpdates(_0x26c6a2){return function(_0x542327){try{jsonpatch[_0xef04('0x32')](_0x542327,_0x26c6a2,!![]);}catch(_0x3bd1ba){return BPromise[_0xef04('0x33')](_0x3bd1ba);}return _0x542327[_0xef04('0x34')]();};}function saveUpdates(_0x1d6903,_0x1d88e5){return function(_0x34a54b){if(_0x34a54b){return _0x34a54b[_0xef04('0x35')](_0x1d6903)[_0xef04('0x1e')](function(_0x5a33a5){return _0x5a33a5;});}return null;};}function removeEntity(_0x547a59,_0x3ee907){return function(_0x38f020){if(_0x38f020){return _0x38f020['destroy']()[_0xef04('0x1e')](function(){_0x547a59[_0xef04('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3581e3,_0x3d36d5){return function(_0x45e29c){if(!_0x45e29c){_0x3581e3[_0xef04('0x2a')](0x194);}return _0x45e29c;};}function handleError(_0x16562b,_0x169c85){_0x169c85=_0x169c85||0x1f4;return function(_0x458773){logger[_0xef04('0x24')](_0x458773[_0xef04('0x36')]);if(_0x458773[_0xef04('0x37')]){delete _0x458773['name'];}_0x16562b[_0xef04('0x2b')](_0x169c85)[_0xef04('0x38')](_0x458773);};}exports['index']=function(_0x17151b,_0x1921ed){var _0x441737={},_0x3d7c35={},_0x566a5d={'count':0x0,'rows':[]};var _0x2444c2=_[_0xef04('0x39')](db[_0xef04('0x3a')]['rawAttributes'],function(_0x1677fd){return{'name':_0x1677fd['fieldName'],'type':_0x1677fd[_0xef04('0x3b')][_0xef04('0x3c')]};});_0x3d7c35['model']=_[_0xef04('0x39')](_0x2444c2,_0xef04('0x37'));_0x3d7c35['query']=_[_0xef04('0x3d')](_0x17151b[_0xef04('0x3e')]);_0x3d7c35['filters']=_[_0xef04('0x3f')](_0x3d7c35[_0xef04('0x40')],_0x3d7c35['query']);_0x441737['attributes']=_['intersection'](_0x3d7c35[_0xef04('0x40')],qs[_0xef04('0x41')](_0x17151b['query'][_0xef04('0x41')]));_0x441737[_0xef04('0x42')]=_0x441737[_0xef04('0x42')][_0xef04('0x43')]?_0x441737['attributes']:_0x3d7c35[_0xef04('0x40')];if(!_0x17151b['query'][_0xef04('0x44')](_0xef04('0x45'))){_0x441737[_0xef04('0x2d')]=qs[_0xef04('0x2d')](_0x17151b[_0xef04('0x3e')][_0xef04('0x2d')]);_0x441737[_0xef04('0x2f')]=qs['offset'](_0x17151b[_0xef04('0x3e')][_0xef04('0x2f')]);}_0x441737['order']=qs[_0xef04('0x46')](_0x17151b[_0xef04('0x3e')][_0xef04('0x46')]);_0x441737[_0xef04('0x47')]=qs[_0xef04('0x48')](_[_0xef04('0x49')](_0x17151b[_0xef04('0x3e')],_0x3d7c35['filters']),_0x2444c2);if(_0x17151b[_0xef04('0x3e')]['filter']){_0x441737[_0xef04('0x47')]=_[_0xef04('0x4a')](_0x441737[_0xef04('0x47')],{'$or':_[_0xef04('0x39')](_0x2444c2,function(_0x4b1241){if(_0x4b1241[_0xef04('0x3b')]!=='VIRTUAL'){var _0x52ca9f={};_0x52ca9f[_0x4b1241[_0xef04('0x37')]]={'$like':'%'+_0x17151b[_0xef04('0x3e')][_0xef04('0x4b')]+'%'};return _0x52ca9f;}})});}_0x441737=_[_0xef04('0x4a')]({},_0x441737,_0x17151b[_0xef04('0x4c')]);var _0x4fbc2e={'where':_0x441737['where']};return db[_0xef04('0x3a')][_0xef04('0x2e')](_0x4fbc2e)[_0xef04('0x1e')](function(_0xf8cd3f){_0x566a5d[_0xef04('0x2e')]=_0xf8cd3f;if(_0x17151b[_0xef04('0x3e')]['includeAll']){_0x441737[_0xef04('0x4d')]=[{'all':!![]}];}return db[_0xef04('0x3a')][_0xef04('0x4e')](_0x441737);})[_0xef04('0x1e')](function(_0x2dc931){_0x566a5d[_0xef04('0x4f')]=_0x2dc931;return _0x566a5d;})[_0xef04('0x1e')](respondWithFilteredResult(_0x1921ed,_0x441737))[_0xef04('0x29')](handleError(_0x1921ed,null));};exports['show']=function(_0x5770fc,_0x1cbacf){var _0x585768={'raw':!![],'where':{'id':_0x5770fc['params']['id']}},_0x3ae263={};_0x3ae263[_0xef04('0x40')]=_[_0xef04('0x3d')](db['ChatMessage'][_0xef04('0x50')]);_0x3ae263['query']=_[_0xef04('0x3d')](_0x5770fc[_0xef04('0x3e')]);_0x3ae263[_0xef04('0x48')]=_[_0xef04('0x3f')](_0x3ae263[_0xef04('0x40')],_0x3ae263[_0xef04('0x3e')]);_0x585768[_0xef04('0x42')]=_[_0xef04('0x3f')](_0x3ae263['model'],qs['fields'](_0x5770fc[_0xef04('0x3e')][_0xef04('0x41')]));_0x585768['attributes']=_0x585768[_0xef04('0x42')][_0xef04('0x43')]?_0x585768[_0xef04('0x42')]:_0x3ae263[_0xef04('0x40')];if(_0x5770fc[_0xef04('0x3e')][_0xef04('0x51')]){_0x585768[_0xef04('0x4d')]=[{'all':!![]}];}_0x585768=_[_0xef04('0x4a')]({},_0x585768,_0x5770fc[_0xef04('0x4c')]);return db[_0xef04('0x3a')][_0xef04('0x52')](_0x585768)[_0xef04('0x1e')](handleEntityNotFound(_0x1cbacf,null))[_0xef04('0x1e')](respondWithResult(_0x1cbacf,null))[_0xef04('0x29')](handleError(_0x1cbacf,null));};exports[_0xef04('0x53')]=function(_0x2573b8,_0x44e83d){return db['ChatMessage'][_0xef04('0x53')](_0x2573b8['body'],{})[_0xef04('0x1e')](respondWithResult(_0x44e83d,0xc9))[_0xef04('0x29')](handleError(_0x44e83d,null));};exports[_0xef04('0x35')]=function(_0x3733c7,_0x4d943f){if(_0x3733c7['body']['id']){delete _0x3733c7['body']['id'];}return db[_0xef04('0x3a')][_0xef04('0x52')]({'where':{'id':_0x3733c7[_0xef04('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d943f,null))['then'](saveUpdates(_0x3733c7[_0xef04('0x55')],null))[_0xef04('0x1e')](respondWithResult(_0x4d943f,null))['catch'](handleError(_0x4d943f,null));};exports['destroy']=function(_0x874fb4,_0x310622){return db[_0xef04('0x3a')][_0xef04('0x52')]({'where':{'id':_0x874fb4[_0xef04('0x54')]['id']}})['then'](handleEntityNotFound(_0x310622,null))[_0xef04('0x1e')](removeEntity(_0x310622,null))[_0xef04('0x29')](handleError(_0x310622,null));};exports[_0xef04('0x56')]=function(_0x3e891d,_0x11e6d0){return db['ChatMessage'][_0xef04('0x56')]()[_0xef04('0x1e')](respondWithResult(_0x11e6d0,null))[_0xef04('0x29')](handleError(_0x11e6d0,null));};var interaction_log=require(_0xef04('0x57'))(_0xef04('0x58'));exports[_0xef04('0x59')]=function(_0x3a65a9,_0xc6a4ff,_0x1d25be){var _0xbbe568={'agent':{},'channel':'chat'};if(_0x3a65a9[_0xef04('0x55')]['id']){delete _0x3a65a9['body']['id'];}_0x3a65a9['body'][_0xef04('0x5a')]=!![];_0x3a65a9[_0xef04('0x55')]['readAt']=moment()[_0xef04('0x5b')](_0xef04('0x5c'));_0x3a65a9['body'][_0xef04('0x5d')]=_0x3a65a9['body'][_0xef04('0x5d')]||_0x3a65a9[_0xef04('0x5e')]['id'];_0xbbe568[_0xef04('0x5f')]['id']=_0x3a65a9[_0xef04('0x55')][_0xef04('0x5d')];return db['ChatMessage'][_0xef04('0x52')]({'where':{'id':_0x3a65a9[_0xef04('0x54')]['id'],'UserId':null}})[_0xef04('0x1e')](handleEntityNotFound(_0xc6a4ff,null))[_0xef04('0x1e')](saveUpdates(_0x3a65a9[_0xef04('0x55')],null))[_0xef04('0x1e')](function(_0x143037){if(_0x143037){_0xbbe568[_0xef04('0x26')]=_0x143037['get']({'plain':!![]});return db['ChatInteraction'][_0xef04('0x52')]({'where':{'id':_0x143037[_0xef04('0x60')]}});}return null;})[_0xef04('0x1e')](handleEntityNotFound(_0xc6a4ff,null))['then'](function(_0x313ddc){if(_0x313ddc){return _0x313ddc[_0xef04('0x35')]({'UserId':_0x3a65a9['body'][_0xef04('0x5d')],'read1stAt':_[_0xef04('0x61')](_0x313ddc[_0xef04('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xef04('0x1e')](function(_0x1a9359){if(_0x1a9359){_0xbbe568['interaction']=_0x1a9359['get']({'plain':!![]});interaction_log[_0xef04('0x27')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a65a9[_0xef04('0x5e')]['id'],_0x3a65a9['user'][_0xef04('0x37')],_0x3a65a9['user'][_0xef04('0x63')],_0xbbe568[_0xef04('0x64')]['id'],_0x3a65a9[_0xef04('0x55')]?JSON['stringify'](_0x3a65a9['body']):_0xef04('0x65'));return respondWithRpcPromise(_0xef04('0x66'),_0xef04('0x67'),_0xbbe568);}return null;})[_0xef04('0x1e')](function(_0x3dd1d8){var _0x50a0e6=_0xef04('0x68')+_0x3dd1d8['message'][_0xef04('0x69')];return db['sequelize']['query'](_0x50a0e6,{'type':db[_0xef04('0x6a')][_0xef04('0x6b')][_0xef04('0x6c')],'raw':!![]})['then'](function(_0x473746){return _0x473746;});})[_0xef04('0x1e')](function(_0x10885f){if(_0x10885f){_0xbbe568[_0xef04('0x26')][_0xef04('0x6d')]=_0x10885f[0x0];if(!_0x3a65a9[_0xef04('0x55')][_0xef04('0x5d')])return;return db[_0xef04('0x6e')][_0xef04('0x52')]({'where':{'id':_0x3a65a9[_0xef04('0x55')][_0xef04('0x5d')],'role':_0xef04('0x5f')},'attributes':['id',_0xef04('0x37'),_0xef04('0x6f'),_0xef04('0x70'),_0xef04('0x71')],'raw':!![]});}return null;})[_0xef04('0x1e')](function(_0x3bad5e){if(!_0x3bad5e)return null;_0xbbe568[_0xef04('0x26')]['agent']=_0x3bad5e;return _0xbbe568;})[_0xef04('0x1e')](function(_0x13dd6a){if(_0x13dd6a){if(_0x3a65a9[_0xef04('0x55')][_0xef04('0x72')]){_0xbbe568[_0xef04('0x26')][_0xef04('0x73')]=util['format'](_0xef04('0x74'),_0x3a65a9[_0xef04('0x5e')][_0xef04('0x37')]);_0xbbe568[_0xef04('0x26')]['channel']=_0xbbe568['channel'];_0xbbe568[_0xef04('0x26')][_0xef04('0x75')]=_0xbbe568[_0xef04('0x76')];_0xbbe568[_0xef04('0x26')][_0xef04('0x77')]='accept';return respondWithRpcPromise('EventManager',_0xef04('0x78'),{'event':_0xef04('0x79'),'message':_['merge'](_0xbbe568[_0xef04('0x26')],JSON[_0xef04('0x7a')](_0xbbe568['interaction'][_0xef04('0x7b')]))},client9002)['then'](function(){return _0xbbe568;});}return _0xbbe568;}return null;})[_0xef04('0x1e')](respondWithResult(_0xc6a4ff,null))['catch'](handleError(_0xc6a4ff,null));};var interaction_log=require(_0xef04('0x57'))(_0xef04('0x58'));exports[_0xef04('0x33')]=function(_0x493795,_0x42f84e,_0x58f1b0){var _0x2d7f54={'agent':{},'channel':'chat'};if(_0x493795[_0xef04('0x55')]['id']){delete _0x493795[_0xef04('0x55')]['id'];}_0x493795[_0xef04('0x55')]['UserId']=_0x493795['body'][_0xef04('0x5d')]||_0x493795['user']['id'];_0x2d7f54[_0xef04('0x5f')]['id']=_0x493795[_0xef04('0x55')][_0xef04('0x5d')];return db['ChatMessage'][_0xef04('0x52')]({'where':{'id':_0x493795[_0xef04('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x42f84e,null))[_0xef04('0x1e')](function(_0x100742){if(_0x100742){_0x2d7f54[_0xef04('0x26')]=_0x100742[_0xef04('0x7c')]({'plain':!![]});return db[_0xef04('0x7d')][_0xef04('0x52')]({'where':{'id':_0x100742['ChatInteractionId']}});}return null;})[_0xef04('0x1e')](handleEntityNotFound(_0x42f84e,null))[_0xef04('0x1e')](function(_0x7b75c8){if(_0x7b75c8){_0x2d7f54[_0xef04('0x64')]=_0x7b75c8[_0xef04('0x7c')]({'plain':!![]});interaction_log[_0xef04('0x27')](_0xef04('0x7e'),_0x493795[_0xef04('0x5e')]['id'],_0x493795['user'][_0xef04('0x37')],_0x493795[_0xef04('0x5e')][_0xef04('0x63')],_0x2d7f54[_0xef04('0x64')]['id'],_0x493795['body']?JSON[_0xef04('0x23')](_0x493795[_0xef04('0x55')]):_0xef04('0x65'));return respondWithRpcPromise(_0xef04('0x7f'),_0xef04('0x80'),_0x2d7f54);}return null;})['then'](function(_0x2d2b08){var _0x44d70e=_0xef04('0x68')+_0x2d2b08[_0xef04('0x26')]['ContactId'];return db['sequelize'][_0xef04('0x3e')](_0x44d70e,{'type':db[_0xef04('0x6a')][_0xef04('0x6b')][_0xef04('0x6c')],'raw':!![]})[_0xef04('0x1e')](function(_0x1d9507){return _0x1d9507;});})[_0xef04('0x1e')](function(_0x19e417){if(_0x19e417){_0x2d7f54[_0xef04('0x26')][_0xef04('0x6d')]=_0x19e417[0x0];if(!_0x493795[_0xef04('0x55')]['UserId'])return;return db[_0xef04('0x6e')][_0xef04('0x52')]({'where':{'id':_0x493795[_0xef04('0x55')]['UserId'],'role':_0xef04('0x5f')},'attributes':['id','name',_0xef04('0x6f'),'email',_0xef04('0x71')],'raw':!![]});}return null;})['then'](function(_0x1cd087){if(!_0x1cd087)return null;_0x2d7f54[_0xef04('0x26')]['agent']=_0x1cd087;return _0x2d7f54;})[_0xef04('0x1e')](function(_0x10877b){if(_0x10877b){_0x10877b[_0xef04('0x26')][_0xef04('0x73')]=util[_0xef04('0x5b')](_0xef04('0x74'),_0x493795[_0xef04('0x5e')][_0xef04('0x37')]);_0x10877b[_0xef04('0x26')][_0xef04('0x76')]=_0x2d7f54[_0xef04('0x76')];_0x10877b[_0xef04('0x26')]['motionChannel']=_0x2d7f54[_0xef04('0x76')];_0x10877b[_0xef04('0x26')][_0xef04('0x77')]=_0xef04('0x33');respondWithRpcPromise('EventManager',_0xef04('0x78'),{'event':_0xef04('0x81'),'message':_[_0xef04('0x4a')](_0x2d7f54['message'],JSON[_0xef04('0x7a')](_0x2d7f54['interaction'][_0xef04('0x7b')]))},client9002);return _0x2d7f54;}return null;})[_0xef04('0x1e')](respondWithResult(_0x42f84e,null))[_0xef04('0x29')](handleError(_0x42f84e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0138a2d..dfe9b62 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 _0xdbcd=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x53678a,_0x54e8dc){var _0x33a549=function(_0x4cda47){while(--_0x4cda47){_0x53678a['push'](_0x53678a['shift']());}};_0x33a549(++_0x54e8dc);}(_0xdbcd,0x66));var _0xddbc=function(_0x2cdf5b,_0xd7fc9e){_0x2cdf5b=_0x2cdf5b-0x0;var _0x393369=_0xdbcd[_0x2cdf5b];return _0x393369;};'use strict';var EventEmitter=require(_0xddbc('0x0'));var ChatMessage=require(_0xddbc('0x1'))['db'][_0xddbc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xddbc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddbc('0x4'),'afterDestroy':_0xddbc('0x5')};function emitEvent(_0x4be2f5){return function(_0xe352b9,_0x436cc0,_0x37902b){ChatMessageEvents['emit'](_0x4be2f5+':'+_0xe352b9['id'],_0xe352b9);ChatMessageEvents[_0xddbc('0x6')](_0x4be2f5,_0xe352b9);_0x37902b(null);};}for(var e in events){if(events[_0xddbc('0x7')](e)){var event=events[e];ChatMessage[_0xddbc('0x8')](e,emitEvent(event));}}module[_0xddbc('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x7bbf=['update','remove','emit','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x48be24,_0xf4cba){var _0x445643=function(_0x3f7119){while(--_0x3f7119){_0x48be24['push'](_0x48be24['shift']());}};_0x445643(++_0xf4cba);}(_0x7bbf,0x16c));var _0xf7bb=function(_0x253383,_0x26abe7){_0x253383=_0x253383-0x0;var _0x1dcb3d=_0x7bbf[_0x253383];return _0x1dcb3d;};'use strict';var EventEmitter=require(_0xf7bb('0x0'));var ChatMessage=require(_0xf7bb('0x1'))['db'][_0xf7bb('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf7bb('0x3')](0x0);var events={'afterCreate':_0xf7bb('0x4'),'afterUpdate':_0xf7bb('0x5'),'afterDestroy':_0xf7bb('0x6')};function emitEvent(_0x56f21e){return function(_0x49abb5,_0x41cae0,_0x3c0c15){ChatMessageEvents[_0xf7bb('0x7')](_0x56f21e+':'+_0x49abb5['id'],_0x49abb5);ChatMessageEvents[_0xf7bb('0x7')](_0x56f21e,_0x49abb5);_0x3c0c15(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xf7bb('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 b33bf7a..1839a71 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 _0xed27=['UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','isNil'];(function(_0x323995,_0x54f800){var _0x4826b4=function(_0x348b33){while(--_0x348b33){_0x323995['push'](_0x323995['shift']());}};_0x4826b4(++_0x54f800);}(_0xed27,0x1ab));var _0x7ed2=function(_0x24e815,_0x8d11c0){_0x24e815=_0x24e815-0x0;var _0x5e6ab9=_0xed27[_0x24e815];return _0x5e6ab9;};'use strict';var _=require(_0x7ed2('0x0'));var util=require(_0x7ed2('0x1'));var logger=require(_0x7ed2('0x2'))(_0x7ed2('0x3'));var moment=require(_0x7ed2('0x4'));var BPromise=require(_0x7ed2('0x5'));var rp=require(_0x7ed2('0x6'));var fs=require('fs');var path=require(_0x7ed2('0x7'));var rimraf=require(_0x7ed2('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ed2('0x9'));module[_0x7ed2('0xa')]=function(_0x341e85,_0x317930){return _0x341e85['define'](_0x7ed2('0xb'),attributes,{'tableName':_0x7ed2('0xc'),'paranoid':![],'indexes':[{'name':_0x7ed2('0xd'),'fields':[_0x7ed2('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x350fc6,_0x5a3bb6,_0x307238){var _0x309932=_0x341e85[_0x7ed2('0xf')];var _0xced22a=_0x350fc6[_0x7ed2('0x10')]({'plain':!![]});if(_0xced22a[_0x7ed2('0x11')]['toLowerCase']()==='in'||_0xced22a[_0x7ed2('0x11')][_0x7ed2('0x12')]()===_0x7ed2('0x13')&&!_0xced22a['secret']&&!_[_0x7ed2('0x14')](_0xced22a[_0x7ed2('0x15')])){_0x309932[_0x7ed2('0x16')][_0x7ed2('0x17')]({'where':{'id':_0xced22a[_0x7ed2('0x18')]}})[_0x7ed2('0x19')](function(_0x122648){if(_0x122648){_0x122648[_0x7ed2('0x1a')]({'lastMsgAt':_0xced22a[_0x7ed2('0x1b')],'lastMsgDirection':_0xced22a[_0x7ed2('0x11')][_0x7ed2('0x12')]()});}})[_0x7ed2('0x1c')](function(_0x26fbce){console[_0x7ed2('0x1d')](_0x26fbce);});}_0x307238();}},'charset':_0x7ed2('0x1e'),'collate':_0x7ed2('0x1f')});}; \ No newline at end of file +var _0x539b=['ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne'];(function(_0x6465b0,_0x45653a){var _0x4884fe=function(_0x427085){while(--_0x427085){_0x6465b0['push'](_0x6465b0['shift']());}};_0x4884fe(++_0x45653a);}(_0x539b,0x1ac));var _0xb539=function(_0x4f1f20,_0x14d272){_0x4f1f20=_0x4f1f20-0x0;var _0x5d8085=_0x539b[_0x4f1f20];return _0x5d8085;};'use strict';var _=require(_0xb539('0x0'));var util=require(_0xb539('0x1'));var logger=require('../../config/logger')(_0xb539('0x2'));var moment=require(_0xb539('0x3'));var BPromise=require('bluebird');var rp=require(_0xb539('0x4'));var fs=require('fs');var path=require(_0xb539('0x5'));var rimraf=require(_0xb539('0x6'));var config=require(_0xb539('0x7'));var attributes=require(_0xb539('0x8'));module['exports']=function(_0x1a55e3,_0x22ed09){return _0x1a55e3[_0xb539('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xb539('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1dc659,_0x5c751b,_0x135304){var _0xecfc4d=_0x1a55e3[_0xb539('0xb')];var _0x10c699=_0x1dc659[_0xb539('0xc')]({'plain':!![]});if(_0x10c699[_0xb539('0xd')][_0xb539('0xe')]()==='in'||_0x10c699['direction'][_0xb539('0xe')]()===_0xb539('0xf')&&!_0x10c699['secret']&&!_[_0xb539('0x10')](_0x10c699[_0xb539('0x11')])){_0xecfc4d[_0xb539('0x12')][_0xb539('0x13')]({'where':{'id':_0x10c699[_0xb539('0x14')]}})[_0xb539('0x15')](function(_0x185cfd){if(_0x185cfd){_0x185cfd[_0xb539('0x16')]({'lastMsgAt':_0x10c699[_0xb539('0x17')],'lastMsgDirection':_0x10c699['direction'][_0xb539('0xe')]()});}})[_0xb539('0x18')](function(_0x40fa35){console[_0xb539('0x19')](_0x40fa35);});}_0x135304();}},'charset':_0xb539('0x1a'),'collate':_0xb539('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 09c530a..719a7f1 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 _0x5e04=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x5e04,0x130));var _0x45e0=function(_0x506138,_0x1282b1){_0x506138=_0x506138-0x0;var _0x33cb5a=_0x5e04[_0x506138];return _0x33cb5a;};'use strict';var _=require(_0x45e0('0x0'));var util=require(_0x45e0('0x1'));var moment=require('moment');var BPromise=require(_0x45e0('0x2'));var rs=require(_0x45e0('0x3'));var fs=require('fs');var Redis=require(_0x45e0('0x4'));var db=require(_0x45e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x45e0('0x6'))(_0x45e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x45e0('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x45e0('0x9')](config[_0x45e0('0xa')],{'host':_0x45e0('0xb'),'port':0x18eb});var socket=require(_0x45e0('0xc'))(new Redis(config['redis']));require(_0x45e0('0xd'))[_0x45e0('0xe')](socket);function respondWithRpcPromise(_0x365d73,_0x33ce96,_0x1895eb){return new BPromise(function(_0x2fd440,_0x361c56){return client[_0x45e0('0xf')](_0x365d73,_0x1895eb)[_0x45e0('0x10')](function(_0x39bfd5){logger[_0x45e0('0x11')](_0x45e0('0x12'),_0x33ce96,_0x45e0('0x13'));logger[_0x45e0('0x14')](_0x45e0('0x15'),_0x33ce96,_0x45e0('0x13'),JSON[_0x45e0('0x16')](_0x39bfd5));if(_0x39bfd5[_0x45e0('0x17')]){if(_0x39bfd5[_0x45e0('0x17')][_0x45e0('0x18')]===0x1f4){logger[_0x45e0('0x17')](_0x45e0('0x12'),_0x33ce96,_0x39bfd5[_0x45e0('0x17')][_0x45e0('0x19')]);return _0x361c56(_0x39bfd5[_0x45e0('0x17')][_0x45e0('0x19')]);}logger[_0x45e0('0x17')](_0x45e0('0x12'),_0x33ce96,_0x39bfd5[_0x45e0('0x17')]['message']);return _0x2fd440(_0x39bfd5[_0x45e0('0x17')]['message']);}else{logger[_0x45e0('0x11')](_0x45e0('0x12'),_0x33ce96,'request\x20sent');_0x2fd440(_0x39bfd5[_0x45e0('0x1a')][_0x45e0('0x19')]);}})[_0x45e0('0x1b')](function(_0x4cbb28){logger[_0x45e0('0x17')](_0x45e0('0x12'),_0x33ce96,_0x4cbb28);_0x361c56(_0x4cbb28);});});}exports['CreateChatMessage']=function(_0xc35a3){var _0x54b2f0=this;return new Promise(function(_0x1d1b53,_0x2954cc){return db[_0x45e0('0x1c')][_0x45e0('0x1d')](_0xc35a3[_0x45e0('0x1e')],{'raw':_0xc35a3[_0x45e0('0x1f')]?_0xc35a3[_0x45e0('0x1f')][_0x45e0('0x20')]===undefined?!![]:![]:!![]})[_0x45e0('0x10')](function(_0xf6fd76){logger['info'](_0x45e0('0x21'),_0xc35a3);logger[_0x45e0('0x14')](_0x45e0('0x21'),_0xc35a3,JSON[_0x45e0('0x16')](_0xf6fd76));_0x1d1b53(_0xf6fd76);})['catch'](function(_0x463a19){logger[_0x45e0('0x17')]('CreateChatMessage',_0x463a19[_0x45e0('0x19')],_0xc35a3);_0x2954cc(_0x54b2f0[_0x45e0('0x17')](0x1f4,_0x463a19[_0x45e0('0x19')]));});});}; \ No newline at end of file +var _0xdb4d=['redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','defaults'];(function(_0x374359,_0x35adb6){var _0x4a8449=function(_0x232382){while(--_0x232382){_0x374359['push'](_0x374359['shift']());}};_0x4a8449(++_0x35adb6);}(_0xdb4d,0x77));var _0xddb4=function(_0x316903,_0x17cf64){_0x316903=_0x316903-0x0;var _0xbdecaf=_0xdb4d[_0x316903];return _0xbdecaf;};'use strict';var _=require(_0xddb4('0x0'));var util=require('util');var moment=require(_0xddb4('0x1'));var BPromise=require('bluebird');var rs=require(_0xddb4('0x2'));var fs=require('fs');var Redis=require(_0xddb4('0x3'));var db=require(_0xddb4('0x4'))['db'];var utils=require(_0xddb4('0x5'));var logger=require(_0xddb4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddb4('0x7')]['http']({'port':0x232a});config['redis']=_[_0xddb4('0x8')](config[_0xddb4('0x9')],{'host':_0xddb4('0xa'),'port':0x18eb});var socket=require(_0xddb4('0xb'))(new Redis(config[_0xddb4('0x9')]));require(_0xddb4('0xc'))[_0xddb4('0xd')](socket);function respondWithRpcPromise(_0x8e32ca,_0xc367ff,_0xe111f7){return new BPromise(function(_0x4170e7,_0x3bc514){return client[_0xddb4('0xe')](_0x8e32ca,_0xe111f7)[_0xddb4('0xf')](function(_0x33e085){logger[_0xddb4('0x10')](_0xddb4('0x11'),_0xc367ff,_0xddb4('0x12'));logger['debug'](_0xddb4('0x13'),_0xc367ff,'request\x20sent',JSON[_0xddb4('0x14')](_0x33e085));if(_0x33e085[_0xddb4('0x15')]){if(_0x33e085[_0xddb4('0x15')]['code']===0x1f4){logger[_0xddb4('0x15')](_0xddb4('0x11'),_0xc367ff,_0x33e085[_0xddb4('0x15')]['message']);return _0x3bc514(_0x33e085[_0xddb4('0x15')][_0xddb4('0x16')]);}logger[_0xddb4('0x15')](_0xddb4('0x11'),_0xc367ff,_0x33e085[_0xddb4('0x15')][_0xddb4('0x16')]);return _0x4170e7(_0x33e085[_0xddb4('0x15')][_0xddb4('0x16')]);}else{logger[_0xddb4('0x10')]('ChatMessage,\x20%s,\x20%s',_0xc367ff,'request\x20sent');_0x4170e7(_0x33e085[_0xddb4('0x17')][_0xddb4('0x16')]);}})[_0xddb4('0x18')](function(_0x49e8ec){logger[_0xddb4('0x15')]('ChatMessage,\x20%s,\x20%s',_0xc367ff,_0x49e8ec);_0x3bc514(_0x49e8ec);});});}exports[_0xddb4('0x19')]=function(_0x20943e){var _0x10263a=this;return new Promise(function(_0x2e6b34,_0x454813){return db[_0xddb4('0x1a')][_0xddb4('0x1b')](_0x20943e[_0xddb4('0x1c')],{'raw':_0x20943e['options']?_0x20943e[_0xddb4('0x1d')][_0xddb4('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x14871b){logger[_0xddb4('0x10')](_0xddb4('0x19'),_0x20943e);logger[_0xddb4('0x1f')]('CreateChatMessage',_0x20943e,JSON[_0xddb4('0x14')](_0x14871b));_0x2e6b34(_0x14871b);})[_0xddb4('0x18')](function(_0x1ba86c){logger['error'](_0xddb4('0x19'),_0x1ba86c[_0xddb4('0x16')],_0x20943e);_0x454813(_0x10263a[_0xddb4('0x15')](0x1f4,_0x1ba86c[_0xddb4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 681329f..2e30df6 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 _0x291c=['save','remove','update','emit','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x291c,0x137));var _0xc291=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x291c[_0x122ef9];return _0x42fba0;};'use strict';var ChatMessageEvents=require(_0xc291('0x0'));var events=[_0xc291('0x1'),_0xc291('0x2'),_0xc291('0x3')];function createListener(_0xfdfc37,_0x253ebb){return function(_0xc32916){_0x253ebb[_0xc291('0x4')](_0xfdfc37,_0xc32916);};}function removeListener(_0xafdfee,_0x118ddf){return function(){ChatMessageEvents[_0xc291('0x5')](_0xafdfee,_0x118ddf);};}exports['register']=function(_0x2c96a8){for(var _0x5f2563=0x0,_0x5a7459=events[_0xc291('0x6')];_0x5f2563<_0x5a7459;_0x5f2563++){var _0x2d3526=events[_0x5f2563];var _0x42a6ac=createListener(_0xc291('0x7')+_0x2d3526,_0x2c96a8);ChatMessageEvents['on'](_0x2d3526,_0x42a6ac);}}; \ No newline at end of file +var _0x17c4=['save','remove','update','emit','removeListener','length','./chatMessage.events'];(function(_0x1754e1,_0x333501){var _0x327090=function(_0x2f5014){while(--_0x2f5014){_0x1754e1['push'](_0x1754e1['shift']());}};_0x327090(++_0x333501);}(_0x17c4,0x102));var _0x417c=function(_0x51069d,_0x51ce9d){_0x51069d=_0x51069d-0x0;var _0x3d9440=_0x17c4[_0x51069d];return _0x3d9440;};'use strict';var ChatMessageEvents=require(_0x417c('0x0'));var events=[_0x417c('0x1'),_0x417c('0x2'),_0x417c('0x3')];function createListener(_0x2f1975,_0x2e9ccf){return function(_0x6579e5){_0x2e9ccf[_0x417c('0x4')](_0x2f1975,_0x6579e5);};}function removeListener(_0x212ac0,_0x413ee5){return function(){ChatMessageEvents[_0x417c('0x5')](_0x212ac0,_0x413ee5);};}exports['register']=function(_0x24e681){for(var _0x117c5d=0x0,_0x340095=events[_0x417c('0x6')];_0x117c5d<_0x340095;_0x117c5d++){var _0x1106df=events[_0x117c5d];var _0x4c6534=createListener('chatMessage:'+_0x1106df,_0x24e681);ChatMessageEvents['on'](_0x1106df,_0x4c6534);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b761021..76fb696 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 _0xd59a=['chatmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','describe','show','post','chat'];(function(_0x3d790f,_0x3bbb4b){var _0x1a1e0c=function(_0x49db8b){while(--_0x49db8b){_0x3d790f['push'](_0x3d790f['shift']());}};_0x1a1e0c(++_0x3bbb4b);}(_0xd59a,0x168));var _0xad59=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd59a[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xad59('0x0'));var util=require(_0xad59('0x1'));var path=require(_0xad59('0x2'));var timeout=require(_0xad59('0x3'));var express=require(_0xad59('0x4'));var router=express[_0xad59('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xad59('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad59('0x7'));router[_0xad59('0x8')]('/',auth[_0xad59('0x9')](),controller[_0xad59('0xa')]);router['get']('/describe',auth[_0xad59('0x9')](),controller[_0xad59('0xb')]);router[_0xad59('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xad59('0xc')]);router[_0xad59('0xd')]('/',auth[_0xad59('0x9')](),interaction['tracked'](_0xad59('0xe'),_0xad59('0xf')),controller['create']);router[_0xad59('0x10')](_0xad59('0x11'),controller[_0xad59('0x12')]);router[_0xad59('0x10')](_0xad59('0x13'),auth[_0xad59('0x9')](),controller[_0xad59('0x14')]);router[_0xad59('0x10')](_0xad59('0x15'),auth[_0xad59('0x9')](),controller['reject']);router[_0xad59('0x16')]('/:id',auth[_0xad59('0x9')](),controller[_0xad59('0x17')]);module[_0xad59('0x18')]=router; \ No newline at end of file +var _0x6581=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','show','post','chat','chatmessage:create','create','put','/:id','update','accept','/:id/reject','destroy'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6581,0x190));var _0x1658=function(_0x1ea110,_0x42b99d){_0x1ea110=_0x1ea110-0x0;var _0x5749af=_0x6581[_0x1ea110];return _0x5749af;};'use strict';var multer=require('multer');var util=require(_0x1658('0x0'));var path=require(_0x1658('0x1'));var timeout=require(_0x1658('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1658('0x3'));var auth=require(_0x1658('0x4'));var interaction=require(_0x1658('0x5'));var config=require('../../config/environment');var controller=require(_0x1658('0x6'));router[_0x1658('0x7')]('/',auth[_0x1658('0x8')](),controller['index']);router[_0x1658('0x7')]('/describe',auth[_0x1658('0x8')](),controller['describe']);router['get']('/:id',auth[_0x1658('0x8')](),controller[_0x1658('0x9')]);router[_0x1658('0xa')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x1658('0xb'),_0x1658('0xc')),controller[_0x1658('0xd')]);router[_0x1658('0xe')](_0x1658('0xf'),controller[_0x1658('0x10')]);router[_0x1658('0xe')]('/:id/accept',auth[_0x1658('0x8')](),controller[_0x1658('0x11')]);router['put'](_0x1658('0x12'),auth[_0x1658('0x8')](),controller['reject']);router['delete'](_0x1658('0xf'),auth[_0x1658('0x8')](),controller[_0x1658('0x13')]);module[_0x1658('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b340610..3c9d9f4 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 _0xe52a=['sequelize','medium'];(function(_0x5225c2,_0x3999c2){var _0x5a98f2=function(_0x3ccf65){while(--_0x3ccf65){_0x5225c2['push'](_0x5225c2['shift']());}};_0x5a98f2(++_0x3999c2);}(_0xe52a,0x128));var _0xae52=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe52a[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xae52('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xae52('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x60c9=['TEXT','medium','sequelize','exports'];(function(_0x57f4b2,_0xf506cd){var _0x242289=function(_0x2d3133){while(--_0x2d3133){_0x57f4b2['push'](_0x57f4b2['shift']());}};_0x242289(++_0xf506cd);}(_0x60c9,0x116));var _0x960c=function(_0x245166,_0x30c8d7){_0x245166=_0x245166-0x0;var _0x294561=_0x60c9[_0x245166];return _0x294561;};'use strict';var Sequelize=require(_0x960c('0x0'));module[_0x960c('0x1')]={'body':{'type':Sequelize[_0x960c('0x2')](_0x960c('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 68569ab..b39d06c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x4c412f,_0x1a9527){_0x4c412f=_0x4c412f-0x0;var _0x14815f=_0x7a54[_0x4c412f];return _0x14815f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4ef41b,_0x176e87){var _0x1c0549=function(_0x3adcb5){while(--_0x3adcb5){_0x4ef41b['push'](_0x4ef41b['shift']());}};_0x1c0549(++_0x176e87);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e089734..24fb5be 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 _0xeb05=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0xeb05,0x15c));var _0x5eb0=function(_0x37e5b1,_0xfce6b7){_0x37e5b1=_0x37e5b1-0x0;var _0x5b5dd9=_0xeb05[_0x37e5b1];return _0x5b5dd9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5eb0('0x0'))(_0x5eb0('0x1'));var moment=require(_0x5eb0('0x2'));var BPromise=require(_0x5eb0('0x3'));var rp=require(_0x5eb0('0x4'));var fs=require('fs');var path=require(_0x5eb0('0x5'));var rimraf=require(_0x5eb0('0x6'));var config=require(_0x5eb0('0x7'));var attributes=require(_0x5eb0('0x8'));module['exports']=function(_0x57d058,_0x566082){return _0x57d058[_0x5eb0('0x9')](_0x5eb0('0xa'),attributes,{'tableName':_0x5eb0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5eb0('0xc'),'collate':_0x5eb0('0xd')});}; \ No newline at end of file +var _0xf864=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1bd679,_0xa9ef66){var _0x5d7eab=function(_0x3fb440){while(--_0x3fb440){_0x1bd679['push'](_0x1bd679['shift']());}};_0x5d7eab(++_0xa9ef66);}(_0xf864,0x16c));var _0x4f86=function(_0x30edc8,_0x32f580){_0x30edc8=_0x30edc8-0x0;var _0x23005b=_0xf864[_0x30edc8];return _0x23005b;};'use strict';var _=require(_0x4f86('0x0'));var util=require(_0x4f86('0x1'));var logger=require(_0x4f86('0x2'))(_0x4f86('0x3'));var moment=require(_0x4f86('0x4'));var BPromise=require(_0x4f86('0x5'));var rp=require(_0x4f86('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f86('0x7'));var config=require(_0x4f86('0x8'));var attributes=require(_0x4f86('0x9'));module[_0x4f86('0xa')]=function(_0x16ec82,_0x15205a){return _0x16ec82[_0x4f86('0xb')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f86('0xc'),'collate':_0x4f86('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4f72cf3..6300d15 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 _0x7627=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7627,0x172));var _0x7762=function(_0x55a0ad,_0xa5fe4a){_0x55a0ad=_0x55a0ad-0x0;var _0x180a67=_0x7627[_0x55a0ad];return _0x180a67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7762('0x0'));var BPromise=require(_0x7762('0x1'));var rs=require(_0x7762('0x2'));var fs=require('fs');var Redis=require(_0x7762('0x3'));var db=require(_0x7762('0x4'))['db'];var utils=require(_0x7762('0x5'));var logger=require(_0x7762('0x6'))(_0x7762('0x7'));var config=require(_0x7762('0x8'));var jayson=require(_0x7762('0x9'));var client=jayson[_0x7762('0xa')][_0x7762('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205d72,_0x2ab89f,_0x4c49bf){return new BPromise(function(_0x2cc2d8,_0xa0392){return client['request'](_0x205d72,_0x4c49bf)[_0x7762('0xc')](function(_0xa2813b){logger['info'](_0x7762('0xd'),_0x2ab89f,'request\x20sent');logger[_0x7762('0xe')](_0x7762('0xf'),_0x2ab89f,'request\x20sent',JSON[_0x7762('0x10')](_0xa2813b));if(_0xa2813b[_0x7762('0x11')]){if(_0xa2813b[_0x7762('0x11')][_0x7762('0x12')]===0x1f4){logger['error'](_0x7762('0xd'),_0x2ab89f,_0xa2813b['error']['message']);return _0xa0392(_0xa2813b[_0x7762('0x11')][_0x7762('0x13')]);}logger[_0x7762('0x11')](_0x7762('0xd'),_0x2ab89f,_0xa2813b['error']['message']);return _0x2cc2d8(_0xa2813b[_0x7762('0x11')]['message']);}else{logger[_0x7762('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ab89f,_0x7762('0x15'));_0x2cc2d8(_0xa2813b[_0x7762('0x16')][_0x7762('0x13')]);}})[_0x7762('0x17')](function(_0x1756ef){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2ab89f,_0x1756ef);_0xa0392(_0x1756ef);});});} \ No newline at end of file +var _0x9a02=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','message','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info'];(function(_0x2eb828,_0x5b4396){var _0xdb47b7=function(_0x5797cb){while(--_0x5797cb){_0x2eb828['push'](_0x2eb828['shift']());}};_0xdb47b7(++_0x5b4396);}(_0x9a02,0x1a4));var _0x29a0=function(_0x561eec,_0x4aa701){_0x561eec=_0x561eec-0x0;var _0x3a3401=_0x9a02[_0x561eec];return _0x3a3401;};'use strict';var _=require(_0x29a0('0x0'));var util=require('util');var moment=require(_0x29a0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29a0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x29a0('0x3'));var logger=require(_0x29a0('0x4'))('rpc');var config=require(_0x29a0('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1dc3,_0x1389bb,_0x285d78){return new BPromise(function(_0x1d646d,_0x142e18){return client[_0x29a0('0x6')](_0x1f1dc3,_0x285d78)[_0x29a0('0x7')](function(_0x398088){logger[_0x29a0('0x8')](_0x29a0('0x9'),_0x1389bb,_0x29a0('0xa'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1389bb,_0x29a0('0xa'),JSON['stringify'](_0x398088));if(_0x398088[_0x29a0('0xb')]){if(_0x398088['error']['code']===0x1f4){logger[_0x29a0('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1389bb,_0x398088[_0x29a0('0xb')][_0x29a0('0xc')]);return _0x142e18(_0x398088['error']['message']);}logger[_0x29a0('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1389bb,_0x398088[_0x29a0('0xb')][_0x29a0('0xc')]);return _0x1d646d(_0x398088[_0x29a0('0xb')][_0x29a0('0xc')]);}else{logger[_0x29a0('0x8')](_0x29a0('0x9'),_0x1389bb,_0x29a0('0xa'));_0x1d646d(_0x398088['result'][_0x29a0('0xc')]);}})['catch'](function(_0x2ab555){logger['error'](_0x29a0('0x9'),_0x1389bb,_0x2ab555);_0x142e18(_0x2ab555);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 50f8a79..fa58460 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 _0x281d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','multer','util','path'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x281d,0x18d));var _0xd281=function(_0x3d0514,_0xe2cd21){_0x3d0514=_0x3d0514-0x0;var _0x17e84b=_0x281d[_0x3d0514];return _0x17e84b;};'use strict';var multer=require(_0xd281('0x0'));var util=require(_0xd281('0x1'));var path=require(_0xd281('0x2'));var timeout=require(_0xd281('0x3'));var express=require(_0xd281('0x4'));var router=express[_0xd281('0x5')]();var fs_extra=require(_0xd281('0x6'));var auth=require(_0xd281('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd281('0x8'));router[_0xd281('0x9')]('/',auth[_0xd281('0xa')](),controller[_0xd281('0xb')]);router[_0xd281('0x9')](_0xd281('0xc'),auth[_0xd281('0xa')](),controller[_0xd281('0xd')]);router[_0xd281('0x9')](_0xd281('0xe'),auth['isAuthenticated'](),controller[_0xd281('0xf')]);router[_0xd281('0x10')]('/',auth['isAuthenticated'](),controller[_0xd281('0x11')]);router['put'](_0xd281('0xe'),auth[_0xd281('0xa')](),controller[_0xd281('0x12')]);router['delete'](_0xd281('0xe'),auth[_0xd281('0xa')](),controller[_0xd281('0x13')]);module['exports']=router; \ No newline at end of file +var _0xaf47=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe','get','post','create','/:id','update','delete','destroy','exports','util'];(function(_0x42e06a,_0x2f5fd1){var _0x3d3c90=function(_0xbd9403){while(--_0xbd9403){_0x42e06a['push'](_0x42e06a['shift']());}};_0x3d3c90(++_0x2f5fd1);}(_0xaf47,0x1b8));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7af4('0x0'));var path=require(_0x7af4('0x1'));var timeout=require(_0x7af4('0x2'));var express=require(_0x7af4('0x3'));var router=express['Router']();var fs_extra=require(_0x7af4('0x4'));var auth=require(_0x7af4('0x5'));var interaction=require(_0x7af4('0x6'));var config=require(_0x7af4('0x7'));var controller=require(_0x7af4('0x8'));router['get']('/',auth[_0x7af4('0x9')](),controller[_0x7af4('0xa')]);router['get'](_0x7af4('0xb'),auth[_0x7af4('0x9')](),controller[_0x7af4('0xc')]);router[_0x7af4('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7af4('0xe')]('/',auth[_0x7af4('0x9')](),controller[_0x7af4('0xf')]);router['put'](_0x7af4('0x10'),auth['isAuthenticated'](),controller[_0x7af4('0x11')]);router[_0x7af4('0x12')](_0x7af4('0x10'),auth[_0x7af4('0x9')](),controller[_0x7af4('0x13')]);module[_0x7af4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 96f09ae..8a17609 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 _0x23ca=['exports','STRING','ENUM','timeout','mouseOver','sequelize'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x23ca,0x185));var _0xa23c=function(_0x24c2c9,_0x4d16d7){_0x24c2c9=_0x24c2c9-0x0;var _0x26273a=_0x23ca[_0x24c2c9];return _0x26273a;};'use strict';var Sequelize=require(_0xa23c('0x0'));module[_0xa23c('0x1')]={'name':{'type':Sequelize[_0xa23c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa23c('0x3')]('mouseOver',_0xa23c('0x4')),'defaultValue':_0xa23c('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6443=['ENUM','timeout','mouseOver','exports','STRING'];(function(_0x573b40,_0x35df55){var _0x2532a4=function(_0x2e1d99){while(--_0x2e1d99){_0x573b40['push'](_0x573b40['shift']());}};_0x2532a4(++_0x35df55);}(_0x6443,0xf8));var _0x3644=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x6443[_0x39a2d6];return _0x23af66;};'use strict';var Sequelize=require('sequelize');module[_0x3644('0x0')]={'name':{'type':Sequelize[_0x3644('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3644('0x2')]('mouseOver',_0x3644('0x3')),'defaultValue':_0x3644('0x4')},'selector':{'type':Sequelize[_0x3644('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 b1de71a..95ad438 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 _0xdd0c=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','include','merge','find','then','create','body','catch','rimraf','zip-dir','fast-json-patch'];(function(_0x2069bd,_0x5c90e6){var _0xe9d8b1=function(_0x1460fa){while(--_0x1460fa){_0x2069bd['push'](_0x2069bd['shift']());}};_0xe9d8b1(++_0x5c90e6);}(_0xdd0c,0x165));var _0xcdd0=function(_0x5ef75e,_0x345c73){_0x5ef75e=_0x5ef75e-0x0;var _0x1b039b=_0xdd0c[_0x5ef75e];return _0x1b039b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={'raw':!![],'where':{'id':_0x4074e0[_0xcdd0('0x2a')]['id']}},_0xd6d64f={};_0xd6d64f['model']=_[_0xcdd0('0x2b')](db[_0xcdd0('0x2c')][_0xcdd0('0x2d')]);_0xd6d64f[_0xcdd0('0x2e')]=_[_0xcdd0('0x2b')](_0x4074e0['query']);_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],_0xd6d64f['query']);_0x28084c['attributes']=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],qs[_0xcdd0('0x32')](_0x4074e0['query'][_0xcdd0('0x32')]));_0x28084c[_0xcdd0('0x33')]=_0x28084c['attributes'][_0xcdd0('0x34')]?_0x28084c[_0xcdd0('0x33')]:_0xd6d64f[_0xcdd0('0x31')];if(_0x4074e0[_0xcdd0('0x2e')]['includeAll']){_0x28084c[_0xcdd0('0x35')]=[{'all':!![]}];}_0x28084c=_[_0xcdd0('0x36')]({},_0x28084c,_0x4074e0['options']);return db[_0xcdd0('0x2c')][_0xcdd0('0x37')](_0x28084c)[_0xcdd0('0x38')](handleEntityNotFound(_0x49cfe0,null))[_0xcdd0('0x38')](respondWithResult(_0x49cfe0,null))['catch'](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x39')]=function(_0x358139,_0x95d87f){return db[_0xcdd0('0x2c')][_0xcdd0('0x39')](_0x358139['body'],{})[_0xcdd0('0x38')](respondWithResult(_0x95d87f,0xc9))['catch'](handleError(_0x95d87f,null));};exports['update']=function(_0x4fd705,_0x407725){if(_0x4fd705[_0xcdd0('0x3a')]['id']){delete _0x4fd705[_0xcdd0('0x3a')]['id'];}return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4fd705[_0xcdd0('0x2a')]['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x407725,null))['then'](saveUpdates(_0x4fd705[_0xcdd0('0x3a')],null))[_0xcdd0('0x38')](respondWithResult(_0x407725,null))[_0xcdd0('0x3b')](handleError(_0x407725,null));};exports[_0xcdd0('0x24')]=function(_0x4e6d31,_0x4934a5){return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4e6d31['params']['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x4934a5,null))[_0xcdd0('0x38')](removeEntity(_0x4934a5,null))['catch'](handleError(_0x4934a5,null));}; \ No newline at end of file +var _0xcee8=['include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','length','includeAll'];(function(_0x38f91c,_0x25a21d){var _0x1fc0e5=function(_0x34f04f){while(--_0x34f04f){_0x38f91c['push'](_0x38f91c['shift']());}};_0x1fc0e5(++_0x25a21d);}(_0xcee8,0xb1));var _0x8cee=function(_0x4644a2,_0x1601a5){_0x4644a2=_0x4644a2-0x0;var _0x460618=_0xcee8[_0x4644a2];return _0x460618;};'use strict';var emlformat=require(_0x8cee('0x0'));var rimraf=require(_0x8cee('0x1'));var zipdir=require(_0x8cee('0x2'));var jsonpatch=require(_0x8cee('0x3'));var rp=require(_0x8cee('0x4'));var moment=require(_0x8cee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8cee('0x6'));var util=require(_0x8cee('0x7'));var path=require(_0x8cee('0x8'));var sox=require(_0x8cee('0x9'));var csv=require('to-csv');var ejs=require(_0x8cee('0xa'));var fs=require('fs');var fs_extra=require(_0x8cee('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8cee('0xd'));var toCsv=require(_0x8cee('0xe'));var querystring=require(_0x8cee('0xf'));var Papa=require(_0x8cee('0x10'));var Redis=require('ioredis');var authService=require(_0x8cee('0x11'));var qs=require(_0x8cee('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cee('0x13'));var logger=require(_0x8cee('0x14'))('api');var utils=require(_0x8cee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8cee('0x16'));var db=require(_0x8cee('0x17'))['db'];function respondWithStatusCode(_0x404578,_0x28bd09){_0x28bd09=_0x28bd09||0xcc;return function(_0x4e1f09){if(_0x4e1f09){return _0x404578['sendStatus'](_0x28bd09);}return _0x404578[_0x8cee('0x18')](_0x28bd09)[_0x8cee('0x19')]();};}function respondWithResult(_0x10d74f,_0x227762){_0x227762=_0x227762||0xc8;return function(_0xedc808){if(_0xedc808){return _0x10d74f[_0x8cee('0x18')](_0x227762)[_0x8cee('0x1a')](_0xedc808);}};}function respondWithFilteredResult(_0x3c3694,_0x237248){return function(_0x487241){if(_0x487241){var _0x33b07e=typeof _0x237248[_0x8cee('0x1b')]===_0x8cee('0x1c')&&typeof _0x237248[_0x8cee('0x1d')]===_0x8cee('0x1c');var _0x5f53e3=_0x487241[_0x8cee('0x1e')];var _0x581ce9=_0x33b07e?0x0:_0x237248['offset'];var _0x8e242b=_0x33b07e?_0x487241[_0x8cee('0x1e')]:_0x237248[_0x8cee('0x1b')]+_0x237248[_0x8cee('0x1d')];var _0x42d863;if(_0x8e242b>=_0x5f53e3){_0x8e242b=_0x5f53e3;_0x42d863=0xc8;}else{_0x42d863=0xce;}_0x3c3694['status'](_0x42d863);return _0x3c3694[_0x8cee('0x1f')](_0x8cee('0x20'),_0x581ce9+'-'+_0x8e242b+'/'+_0x5f53e3)[_0x8cee('0x1a')](_0x487241);}return null;};}function patchUpdates(_0x5d1a1d){return function(_0x31dbd5){try{jsonpatch[_0x8cee('0x21')](_0x31dbd5,_0x5d1a1d,!![]);}catch(_0x52262a){return BPromise['reject'](_0x52262a);}return _0x31dbd5[_0x8cee('0x22')]();};}function saveUpdates(_0x47b3c0,_0x54539b){return function(_0x51a93f){if(_0x51a93f){return _0x51a93f['update'](_0x47b3c0)[_0x8cee('0x23')](function(_0x5109df){return _0x5109df;});}return null;};}function removeEntity(_0x117bc6,_0x5e231e){return function(_0x2ea47b){if(_0x2ea47b){return _0x2ea47b[_0x8cee('0x24')]()[_0x8cee('0x23')](function(){_0x117bc6[_0x8cee('0x18')](0xcc)[_0x8cee('0x19')]();});}};}function handleEntityNotFound(_0x51f79f,_0x89974f){return function(_0x415f47){if(!_0x415f47){_0x51f79f['sendStatus'](0x194);}return _0x415f47;};}function handleError(_0x307de3,_0xc2ad7f){_0xc2ad7f=_0xc2ad7f||0x1f4;return function(_0x5df746){logger['error'](_0x5df746[_0x8cee('0x25')]);if(_0x5df746[_0x8cee('0x26')]){delete _0x5df746[_0x8cee('0x26')];}_0x307de3[_0x8cee('0x18')](_0xc2ad7f)[_0x8cee('0x27')](_0x5df746);};}exports[_0x8cee('0x28')]=function(_0x51003d,_0x1572d5){var _0x4a7781={'raw':!![],'where':{'id':_0x51003d[_0x8cee('0x29')]['id']}},_0x75f082={};_0x75f082[_0x8cee('0x2a')]=_[_0x8cee('0x2b')](db[_0x8cee('0x2c')]['rawAttributes']);_0x75f082[_0x8cee('0x2d')]=_['keys'](_0x51003d[_0x8cee('0x2d')]);_0x75f082[_0x8cee('0x2e')]=_[_0x8cee('0x2f')](_0x75f082[_0x8cee('0x2a')],_0x75f082['query']);_0x4a7781[_0x8cee('0x30')]=_['intersection'](_0x75f082[_0x8cee('0x2a')],qs['fields'](_0x51003d[_0x8cee('0x2d')]['fields']));_0x4a7781['attributes']=_0x4a7781[_0x8cee('0x30')][_0x8cee('0x31')]?_0x4a7781[_0x8cee('0x30')]:_0x75f082[_0x8cee('0x2a')];if(_0x51003d[_0x8cee('0x2d')][_0x8cee('0x32')]){_0x4a7781[_0x8cee('0x33')]=[{'all':!![]}];}_0x4a7781=_[_0x8cee('0x34')]({},_0x4a7781,_0x51003d['options']);return db['ChatProactiveAction'][_0x8cee('0x35')](_0x4a7781)[_0x8cee('0x23')](handleEntityNotFound(_0x1572d5,null))[_0x8cee('0x23')](respondWithResult(_0x1572d5,null))[_0x8cee('0x36')](handleError(_0x1572d5,null));};exports[_0x8cee('0x37')]=function(_0x1ba01a,_0x4a47e3){return db[_0x8cee('0x2c')][_0x8cee('0x37')](_0x1ba01a[_0x8cee('0x38')],{})[_0x8cee('0x23')](respondWithResult(_0x4a47e3,0xc9))['catch'](handleError(_0x4a47e3,null));};exports['update']=function(_0x537cb4,_0x4c79ef){if(_0x537cb4[_0x8cee('0x38')]['id']){delete _0x537cb4['body']['id'];}return db['ChatProactiveAction'][_0x8cee('0x35')]({'where':{'id':_0x537cb4[_0x8cee('0x29')]['id']}})[_0x8cee('0x23')](handleEntityNotFound(_0x4c79ef,null))[_0x8cee('0x23')](saveUpdates(_0x537cb4[_0x8cee('0x38')],null))[_0x8cee('0x23')](respondWithResult(_0x4c79ef,null))['catch'](handleError(_0x4c79ef,null));};exports['destroy']=function(_0x49cd85,_0x1f1cd8){return db[_0x8cee('0x2c')][_0x8cee('0x35')]({'where':{'id':_0x49cd85[_0x8cee('0x29')]['id']}})[_0x8cee('0x23')](handleEntityNotFound(_0x1f1cd8,null))[_0x8cee('0x23')](removeEntity(_0x1f1cd8,null))[_0x8cee('0x36')](handleError(_0x1f1cd8,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 311e0ff..f9ebeb7 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 _0x21dd=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21dd,0x66));var _0xd21d=function(_0x5ca89a,_0x3a3d18){_0x5ca89a=_0x5ca89a-0x0;var _0x57da9f=_0x21dd[_0x5ca89a];return _0x57da9f;};'use strict';var _=require(_0xd21d('0x0'));var util=require('util');var logger=require(_0xd21d('0x1'))('api');var moment=require(_0xd21d('0x2'));var BPromise=require(_0xd21d('0x3'));var rp=require(_0xd21d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd21d('0x5'));var config=require(_0xd21d('0x6'));var attributes=require(_0xd21d('0x7'));module[_0xd21d('0x8')]=function(_0x190b3e,_0x39d5e4){return _0x190b3e[_0xd21d('0x9')](_0xd21d('0xa'),attributes,{'tableName':_0xd21d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c54=['exports','define','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x56d78c,_0x2b65d6){var _0x9a8155=function(_0x3cb3ad){while(--_0x3cb3ad){_0x56d78c['push'](_0x56d78c['shift']());}};_0x9a8155(++_0x2b65d6);}(_0x3c54,0x16f));var _0x43c5=function(_0xfdb271,_0x550ca1){_0xfdb271=_0xfdb271-0x0;var _0x54c007=_0x3c54[_0xfdb271];return _0x54c007;};'use strict';var _=require(_0x43c5('0x0'));var util=require('util');var logger=require(_0x43c5('0x1'))(_0x43c5('0x2'));var moment=require(_0x43c5('0x3'));var BPromise=require(_0x43c5('0x4'));var rp=require(_0x43c5('0x5'));var fs=require('fs');var path=require(_0x43c5('0x6'));var rimraf=require(_0x43c5('0x7'));var config=require(_0x43c5('0x8'));var attributes=require(_0x43c5('0x9'));module[_0x43c5('0xa')]=function(_0x548d43,_0x5de9dd){return _0x548d43[_0x43c5('0xb')]('ChatProactiveAction',attributes,{'tableName':_0x43c5('0xc'),'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 34c4ddc..a950aa6 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 _0x9d7c=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36d270,_0x26bd6b){var _0x251e66=function(_0x1b8934){while(--_0x1b8934){_0x36d270['push'](_0x36d270['shift']());}};_0x251e66(++_0x26bd6b);}(_0x9d7c,0x1b8));var _0xc9d7=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0x9d7c[_0x41582d];return _0x59c504;};'use strict';var _=require(_0xc9d7('0x0'));var util=require(_0xc9d7('0x1'));var moment=require(_0xc9d7('0x2'));var BPromise=require(_0xc9d7('0x3'));var rs=require(_0xc9d7('0x4'));var fs=require('fs');var Redis=require(_0xc9d7('0x5'));var db=require(_0xc9d7('0x6'))['db'];var utils=require(_0xc9d7('0x7'));var logger=require(_0xc9d7('0x8'))(_0xc9d7('0x9'));var config=require(_0xc9d7('0xa'));var jayson=require(_0xc9d7('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x599074,_0x169326,_0x5b5c42){return new BPromise(function(_0x32ca1a,_0x27ce72){return client[_0xc9d7('0xc')](_0x599074,_0x5b5c42)[_0xc9d7('0xd')](function(_0x45cc87){logger[_0xc9d7('0xe')](_0xc9d7('0xf'),_0x169326,_0xc9d7('0x10'));logger['debug'](_0xc9d7('0x11'),_0x169326,_0xc9d7('0x10'),JSON[_0xc9d7('0x12')](_0x45cc87));if(_0x45cc87[_0xc9d7('0x13')]){if(_0x45cc87['error'][_0xc9d7('0x14')]===0x1f4){logger[_0xc9d7('0x13')](_0xc9d7('0xf'),_0x169326,_0x45cc87[_0xc9d7('0x13')]['message']);return _0x27ce72(_0x45cc87[_0xc9d7('0x13')][_0xc9d7('0x15')]);}logger['error'](_0xc9d7('0xf'),_0x169326,_0x45cc87[_0xc9d7('0x13')][_0xc9d7('0x15')]);return _0x32ca1a(_0x45cc87[_0xc9d7('0x13')][_0xc9d7('0x15')]);}else{logger['info'](_0xc9d7('0xf'),_0x169326,_0xc9d7('0x10'));_0x32ca1a(_0x45cc87[_0xc9d7('0x16')][_0xc9d7('0x15')]);}})['catch'](function(_0x52c9f1){logger[_0xc9d7('0x13')](_0xc9d7('0xf'),_0x169326,_0x52c9f1);_0x27ce72(_0x52c9f1);});});} \ No newline at end of file +var _0xb400=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb400,0x159));var _0x0b40=function(_0x563304,_0x707858){_0x563304=_0x563304-0x0;var _0x3a6502=_0xb400[_0x563304];return _0x3a6502;};'use strict';var _=require(_0x0b40('0x0'));var util=require(_0x0b40('0x1'));var moment=require(_0x0b40('0x2'));var BPromise=require(_0x0b40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b40('0x4'));var db=require(_0x0b40('0x5'))['db'];var utils=require(_0x0b40('0x6'));var logger=require(_0x0b40('0x7'))(_0x0b40('0x8'));var config=require(_0x0b40('0x9'));var jayson=require(_0x0b40('0xa'));var client=jayson[_0x0b40('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x263e76,_0xa4d12f,_0x179fc9){return new BPromise(function(_0x55187b,_0x1531c0){return client[_0x0b40('0xc')](_0x263e76,_0x179fc9)[_0x0b40('0xd')](function(_0x2444e7){logger[_0x0b40('0xe')](_0x0b40('0xf'),_0xa4d12f,_0x0b40('0x10'));logger['debug'](_0x0b40('0x11'),_0xa4d12f,_0x0b40('0x10'),JSON['stringify'](_0x2444e7));if(_0x2444e7[_0x0b40('0x12')]){if(_0x2444e7[_0x0b40('0x12')][_0x0b40('0x13')]===0x1f4){logger[_0x0b40('0x12')](_0x0b40('0xf'),_0xa4d12f,_0x2444e7[_0x0b40('0x12')][_0x0b40('0x14')]);return _0x1531c0(_0x2444e7[_0x0b40('0x12')]['message']);}logger[_0x0b40('0x12')](_0x0b40('0xf'),_0xa4d12f,_0x2444e7[_0x0b40('0x12')]['message']);return _0x55187b(_0x2444e7[_0x0b40('0x12')]['message']);}else{logger[_0x0b40('0xe')](_0x0b40('0xf'),_0xa4d12f,_0x0b40('0x10'));_0x55187b(_0x2444e7[_0x0b40('0x15')][_0x0b40('0x14')]);}})[_0x0b40('0x16')](function(_0x5ec6b7){logger[_0x0b40('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xa4d12f,_0x5ec6b7);_0x1531c0(_0x5ec6b7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2bcf2ba..6d85f68 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xabce,0x103));var _0xeabc=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xabce[_0x31cb5f];return _0x586042;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21f074,_0x3c7959){var _0x1521b1=function(_0x4796f9){while(--_0x4796f9){_0x21f074['push'](_0x21f074['shift']());}};_0x1521b1(++_0x3c7959);}(_0x326f,0xd1));var _0xf326=function(_0x199542,_0x50b180){_0x199542=_0x199542-0x0;var _0x4a434a=_0x326f[_0x199542];return _0x4a434a;};'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')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a711f8d..80e7ac5 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 _0xdf15=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x14c04f,_0x30f54f){var _0x40fa2e=function(_0x2b629a){while(--_0x2b629a){_0x14c04f['push'](_0x14c04f['shift']());}};_0x40fa2e(++_0x30f54f);}(_0xdf15,0xe1));var _0x5df1=function(_0x21290e,_0x53a329){_0x21290e=_0x21290e-0x0;var _0x5a734b=_0xdf15[_0x21290e];return _0x5a734b;};'use strict';var Sequelize=require(_0x5df1('0x0'));module[_0x5df1('0x1')]={'name':{'type':Sequelize[_0x5df1('0x2')],'unique':_0x5df1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5df1('0x2')]},'timeout':{'type':Sequelize[_0x5df1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5df1('0x5')](_0x5df1('0x6'),'beepall',_0x5df1('0x7'))}}; \ No newline at end of file +var _0xa1c5=['beepall','roundrobin','exports','STRING','ENUM'];(function(_0x9ab349,_0x48e3d9){var _0x5a2923=function(_0x2e3fa4){while(--_0x2e3fa4){_0x9ab349['push'](_0x9ab349['shift']());}};_0x5a2923(++_0x48e3d9);}(_0xa1c5,0x1d8));var _0x5a1c=function(_0x2dfa64,_0x21c355){_0x2dfa64=_0x2dfa64-0x0;var _0xa28511=_0xa1c5[_0x2dfa64];return _0xa28511;};'use strict';var Sequelize=require('sequelize');module[_0x5a1c('0x0')]={'name':{'type':Sequelize[_0x5a1c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5a1c('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5a1c('0x2')]('rrmemory',_0x5a1c('0x3'),_0x5a1c('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 420ed6b..3eb2627 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 _0x3ebc=['eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','name','send','index','map','ChatQueue','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserChatQueue','hasOwnProperty','User','findAndCountAll','UserId','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ebc,0x96));var _0xc3eb=function(_0x5f15d2,_0x54e5f1){_0x5f15d2=_0x5f15d2-0x0;var _0x31c30c=_0x3ebc[_0x5f15d2];return _0x31c30c;};'use strict';var emlformat=require(_0xc3eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc3eb('0x2'));var BPromise=require(_0xc3eb('0x3'));var Mustache=require('mustache');var util=require(_0xc3eb('0x4'));var path=require(_0xc3eb('0x5'));var sox=require(_0xc3eb('0x6'));var csv=require(_0xc3eb('0x7'));var ejs=require(_0xc3eb('0x8'));var fs=require('fs');var fs_extra=require(_0xc3eb('0x9'));var _=require(_0xc3eb('0xa'));var squel=require(_0xc3eb('0xb'));var crypto=require(_0xc3eb('0xc'));var jsforce=require(_0xc3eb('0xd'));var deskjs=require(_0xc3eb('0xe'));var toCsv=require(_0xc3eb('0x7'));var querystring=require(_0xc3eb('0xf'));var Papa=require(_0xc3eb('0x10'));var Redis=require('ioredis');var authService=require(_0xc3eb('0x11'));var qs=require(_0xc3eb('0x12'));var as=require(_0xc3eb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3eb('0x14'))(_0xc3eb('0x15'));var utils=require(_0xc3eb('0x16'));var config=require(_0xc3eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3eb('0x18'))['db'];config[_0xc3eb('0x19')]=_[_0xc3eb('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc3eb('0x1b'))(new Redis(config['redis']));require(_0xc3eb('0x1c'))[_0xc3eb('0x1d')](socket);var jayson=require(_0xc3eb('0x1e'));var client=jayson['client'][_0xc3eb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x261e90,_0x29c945,_0x11810e,_0x6a121e){return new BPromise(function(_0x2fd037,_0x254dc7){var _0xe3b800=_0x6a121e||client;return _0xe3b800[_0xc3eb('0x20')](_0x261e90,_0x11810e)[_0xc3eb('0x21')](function(_0x2bec43){logger[_0xc3eb('0x22')](_0xc3eb('0x23'),_0x29c945,_0xc3eb('0x24'));logger['debug'](_0xc3eb('0x25'),_0x29c945,_0xc3eb('0x24'),JSON['stringify'](_0x2bec43));if(_0x2bec43[_0xc3eb('0x26')]){if(_0x2bec43[_0xc3eb('0x26')][_0xc3eb('0x27')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x29c945,_0x2bec43[_0xc3eb('0x26')][_0xc3eb('0x28')]);return _0x254dc7(_0x2bec43['error'][_0xc3eb('0x28')]);}logger[_0xc3eb('0x26')](_0xc3eb('0x23'),_0x29c945,_0x2bec43['error'][_0xc3eb('0x28')]);return _0x2fd037(_0x2bec43['error'][_0xc3eb('0x28')]);}else{logger['info'](_0xc3eb('0x23'),_0x29c945,_0xc3eb('0x24'));_0x2fd037(_0x2bec43['result'][_0xc3eb('0x28')]);}})[_0xc3eb('0x29')](function(_0x2fe36c){logger[_0xc3eb('0x26')](_0xc3eb('0x23'),_0x29c945,_0x2fe36c);_0x254dc7(_0x2fe36c);});});}function respondWithStatusCode(_0x32b8a5,_0x434fb1){_0x434fb1=_0x434fb1||0xcc;return function(_0xc51d9c){if(_0xc51d9c){return _0x32b8a5[_0xc3eb('0x2a')](_0x434fb1);}return _0x32b8a5[_0xc3eb('0x2b')](_0x434fb1)[_0xc3eb('0x2c')]();};}function respondWithResult(_0x453f73,_0x3470e5){_0x3470e5=_0x3470e5||0xc8;return function(_0x46193f){if(_0x46193f){return _0x453f73['status'](_0x3470e5)[_0xc3eb('0x2d')](_0x46193f);}};}function respondWithFilteredResult(_0xf96223,_0x6d0c38){return function(_0x29d413){if(_0x29d413){var _0x56abe4=typeof _0x6d0c38[_0xc3eb('0x2e')]==='undefined'&&typeof _0x6d0c38[_0xc3eb('0x2f')]===_0xc3eb('0x30');var _0x475543=_0x29d413['count'];var _0x143264=_0x56abe4?0x0:_0x6d0c38[_0xc3eb('0x2e')];var _0x2a9b04=_0x56abe4?_0x29d413[_0xc3eb('0x31')]:_0x6d0c38[_0xc3eb('0x2e')]+_0x6d0c38[_0xc3eb('0x2f')];var _0x45edbc;if(_0x2a9b04>=_0x475543){_0x2a9b04=_0x475543;_0x45edbc=0xc8;}else{_0x45edbc=0xce;}_0xf96223['status'](_0x45edbc);return _0xf96223[_0xc3eb('0x32')](_0xc3eb('0x33'),_0x143264+'-'+_0x2a9b04+'/'+_0x475543)[_0xc3eb('0x2d')](_0x29d413);}return null;};}function patchUpdates(_0x3d55b4){return function(_0x2ca409){try{jsonpatch[_0xc3eb('0x34')](_0x2ca409,_0x3d55b4,!![]);}catch(_0x4e3520){return BPromise[_0xc3eb('0x35')](_0x4e3520);}return _0x2ca409[_0xc3eb('0x36')]();};}function saveUpdates(_0x3969e1,_0x2c051f){return function(_0xa8ff3a){if(_0xa8ff3a){return _0xa8ff3a[_0xc3eb('0x37')](_0x3969e1)[_0xc3eb('0x21')](function(_0x1ee018){return _0x1ee018;});}return null;};}function removeEntity(_0x2e5757,_0x46c8ce){return function(_0x16a41d){if(_0x16a41d){return _0x16a41d[_0xc3eb('0x38')]()[_0xc3eb('0x21')](function(){var _0x5c3c6b=_0x16a41d[_0xc3eb('0x39')]({'plain':!![]});var _0x24850d='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x24850d,'resourceId':_0x5c3c6b['id']}})[_0xc3eb('0x21')](function(){return _0x16a41d;});})[_0xc3eb('0x21')](function(){_0x2e5757[_0xc3eb('0x2b')](0xcc)[_0xc3eb('0x2c')]();});}};}function handleEntityNotFound(_0x1d094a,_0x2f1884){return function(_0x3e540e){if(!_0x3e540e){_0x1d094a[_0xc3eb('0x2a')](0x194);}return _0x3e540e;};}function handleError(_0x2b72a4,_0x187115){_0x187115=_0x187115||0x1f4;return function(_0x57bd7b){logger[_0xc3eb('0x26')](_0x57bd7b['stack']);if(_0x57bd7b[_0xc3eb('0x3a')]){delete _0x57bd7b[_0xc3eb('0x3a')];}_0x2b72a4[_0xc3eb('0x2b')](_0x187115)[_0xc3eb('0x3b')](_0x57bd7b);};}exports[_0xc3eb('0x3c')]=function(_0x1e026f,_0x217fb1){var _0x3f2ec4={},_0x41b156={},_0x2f3550={'count':0x0,'rows':[]};var _0x506b9f=_[_0xc3eb('0x3d')](db[_0xc3eb('0x3e')]['rawAttributes'],function(_0x1eb0e3){return{'name':_0x1eb0e3['fieldName'],'type':_0x1eb0e3[_0xc3eb('0x3f')]['key']};});_0x41b156['model']=_[_0xc3eb('0x3d')](_0x506b9f,_0xc3eb('0x3a'));_0x41b156[_0xc3eb('0x40')]=_[_0xc3eb('0x41')](_0x1e026f[_0xc3eb('0x40')]);_0x41b156[_0xc3eb('0x42')]=_[_0xc3eb('0x43')](_0x41b156[_0xc3eb('0x44')],_0x41b156[_0xc3eb('0x40')]);_0x3f2ec4[_0xc3eb('0x45')]=_[_0xc3eb('0x43')](_0x41b156['model'],qs[_0xc3eb('0x46')](_0x1e026f[_0xc3eb('0x40')]['fields']));_0x3f2ec4['attributes']=_0x3f2ec4[_0xc3eb('0x45')][_0xc3eb('0x47')]?_0x3f2ec4[_0xc3eb('0x45')]:_0x41b156[_0xc3eb('0x44')];if(!_0x1e026f['query']['hasOwnProperty'](_0xc3eb('0x48'))){_0x3f2ec4[_0xc3eb('0x2f')]=qs[_0xc3eb('0x2f')](_0x1e026f[_0xc3eb('0x40')][_0xc3eb('0x2f')]);_0x3f2ec4[_0xc3eb('0x2e')]=qs[_0xc3eb('0x2e')](_0x1e026f[_0xc3eb('0x40')][_0xc3eb('0x2e')]);}_0x3f2ec4[_0xc3eb('0x49')]=qs[_0xc3eb('0x4a')](_0x1e026f[_0xc3eb('0x40')]['sort']);_0x3f2ec4[_0xc3eb('0x4b')]=qs[_0xc3eb('0x42')](_['pick'](_0x1e026f[_0xc3eb('0x40')],_0x41b156[_0xc3eb('0x42')]),_0x506b9f);if(_0x1e026f[_0xc3eb('0x40')][_0xc3eb('0x4c')]){_0x3f2ec4[_0xc3eb('0x4b')]=_[_0xc3eb('0x4d')](_0x3f2ec4[_0xc3eb('0x4b')],{'$or':_[_0xc3eb('0x3d')](_0x506b9f,function(_0x4c5c1b){if(_0x4c5c1b[_0xc3eb('0x3f')]!==_0xc3eb('0x4e')){var _0x8a21de={};_0x8a21de[_0x4c5c1b[_0xc3eb('0x3a')]]={'$like':'%'+_0x1e026f[_0xc3eb('0x40')]['filter']+'%'};return _0x8a21de;}})});}_0x3f2ec4=_[_0xc3eb('0x4d')]({},_0x3f2ec4,_0x1e026f[_0xc3eb('0x4f')]);var _0x384d5f={'where':_0x3f2ec4['where']};return db[_0xc3eb('0x3e')][_0xc3eb('0x31')](_0x384d5f)[_0xc3eb('0x21')](function(_0x3f0db9){_0x2f3550[_0xc3eb('0x31')]=_0x3f0db9;if(_0x1e026f[_0xc3eb('0x40')][_0xc3eb('0x50')]){_0x3f2ec4['include']=[{'all':!![]}];}return db[_0xc3eb('0x3e')][_0xc3eb('0x51')](_0x3f2ec4);})[_0xc3eb('0x21')](function(_0x31eb7f){_0x2f3550[_0xc3eb('0x52')]=_0x31eb7f;return _0x2f3550;})['then'](respondWithFilteredResult(_0x217fb1,_0x3f2ec4))[_0xc3eb('0x29')](handleError(_0x217fb1,null));};exports['show']=function(_0x5c0c7c,_0x273d2e){var _0x300282={'raw':!![],'where':{'id':_0x5c0c7c['params']['id']}},_0x23962d={};_0x23962d[_0xc3eb('0x44')]=_[_0xc3eb('0x41')](db['ChatQueue'][_0xc3eb('0x53')]);_0x23962d[_0xc3eb('0x40')]=_[_0xc3eb('0x41')](_0x5c0c7c[_0xc3eb('0x40')]);_0x23962d[_0xc3eb('0x42')]=_['intersection'](_0x23962d[_0xc3eb('0x44')],_0x23962d['query']);_0x300282[_0xc3eb('0x45')]=_['intersection'](_0x23962d[_0xc3eb('0x44')],qs['fields'](_0x5c0c7c[_0xc3eb('0x40')][_0xc3eb('0x46')]));_0x300282['attributes']=_0x300282[_0xc3eb('0x45')][_0xc3eb('0x47')]?_0x300282[_0xc3eb('0x45')]:_0x23962d[_0xc3eb('0x44')];if(_0x5c0c7c[_0xc3eb('0x40')][_0xc3eb('0x50')]){_0x300282[_0xc3eb('0x54')]=[{'all':!![]}];}_0x300282=_['merge']({},_0x300282,_0x5c0c7c[_0xc3eb('0x4f')]);return db[_0xc3eb('0x3e')][_0xc3eb('0x55')](_0x300282)[_0xc3eb('0x21')](handleEntityNotFound(_0x273d2e,null))[_0xc3eb('0x21')](respondWithResult(_0x273d2e,null))[_0xc3eb('0x29')](handleError(_0x273d2e,null));};exports[_0xc3eb('0x56')]=function(_0x5ebd87,_0x2cd606){return db[_0xc3eb('0x3e')]['create'](_0x5ebd87['body'],{})[_0xc3eb('0x21')](function(_0x120853){var _0x291438=_0x5ebd87['user'][_0xc3eb('0x39')]({'plain':!![]});if(!_0x291438)throw new Error(_0xc3eb('0x57'));if(_0x291438[_0xc3eb('0x58')]===_0xc3eb('0x59')){var _0x1b189e=_0x120853[_0xc3eb('0x39')]({'plain':!![]});var _0x484fb1=_0xc3eb('0x5a');return db['UserProfileSection'][_0xc3eb('0x55')]({'where':{'name':_0x484fb1,'userProfileId':_0x291438['userProfileId']},'raw':!![]})[_0xc3eb('0x21')](function(_0xc05ff0){if(_0xc05ff0&&_0xc05ff0[_0xc3eb('0x5b')]===0x0){return db[_0xc3eb('0x5c')]['create']({'name':_0x1b189e[_0xc3eb('0x3a')],'resourceId':_0x1b189e['id'],'type':_0xc05ff0[_0xc3eb('0x3a')],'sectionId':_0xc05ff0['id']},{})[_0xc3eb('0x21')](function(){return _0x120853;});}else{return _0x120853;}})['catch'](function(_0x22641c){logger[_0xc3eb('0x26')](_0xc3eb('0x5d'),_0x22641c);throw _0x22641c;});}return _0x120853;})[_0xc3eb('0x21')](respondWithResult(_0x2cd606,0xc9))[_0xc3eb('0x29')](handleError(_0x2cd606,null));};exports[_0xc3eb('0x37')]=function(_0x25d0d1,_0x37ae7d){if(_0x25d0d1[_0xc3eb('0x5e')]['id']){delete _0x25d0d1[_0xc3eb('0x5e')]['id'];}return db[_0xc3eb('0x3e')]['find']({'where':{'id':_0x25d0d1[_0xc3eb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x37ae7d,null))[_0xc3eb('0x21')](saveUpdates(_0x25d0d1['body'],null))['then'](respondWithResult(_0x37ae7d,null))[_0xc3eb('0x29')](handleError(_0x37ae7d,null));};exports['destroy']=function(_0x323f00,_0x110239){return db[_0xc3eb('0x3e')][_0xc3eb('0x55')]({'where':{'id':_0x323f00[_0xc3eb('0x5f')]['id']}})[_0xc3eb('0x21')](handleEntityNotFound(_0x110239,null))[_0xc3eb('0x21')](removeEntity(_0x110239,null))[_0xc3eb('0x29')](handleError(_0x110239,null));};exports[_0xc3eb('0x60')]=function(_0x4d4802,_0x17b99c){return db[_0xc3eb('0x3e')][_0xc3eb('0x60')]()[_0xc3eb('0x21')](respondWithResult(_0x17b99c,null))[_0xc3eb('0x29')](handleError(_0x17b99c,null));};exports[_0xc3eb('0x61')]=function(_0x543516,_0x2f5262,_0x3fd390){var _0x598141={'raw':!![],'where':{}},_0x5f1b9a={},_0x246556;return db[_0xc3eb('0x3e')]['findOne']({'where':{'id':_0x543516[_0xc3eb('0x5f')]['id']}})[_0xc3eb('0x21')](handleEntityNotFound(_0x2f5262,null))[_0xc3eb('0x21')](function(_0x1ac092){if(_0x1ac092){_0x246556=_0x1ac092[_0xc3eb('0x39')]({'plain':!![]});_0x5f1b9a[_0xc3eb('0x44')]=_[_0xc3eb('0x41')](db[_0xc3eb('0x62')]['rawAttributes']);_0x5f1b9a[_0xc3eb('0x40')]=_[_0xc3eb('0x41')](_0x543516[_0xc3eb('0x40')]);_0x5f1b9a['filters']=_[_0xc3eb('0x43')](_0x5f1b9a['model'],_0x5f1b9a['query']);_0x598141[_0xc3eb('0x45')]=_[_0xc3eb('0x43')](_0x5f1b9a[_0xc3eb('0x44')],qs[_0xc3eb('0x46')](_0x543516['query'][_0xc3eb('0x46')]));_0x598141[_0xc3eb('0x45')]=_0x598141[_0xc3eb('0x45')]['length']?_0x598141[_0xc3eb('0x45')]:_0x5f1b9a[_0xc3eb('0x44')];if(!_0x543516[_0xc3eb('0x40')][_0xc3eb('0x63')]('nolimit')){_0x598141[_0xc3eb('0x2f')]=qs[_0xc3eb('0x2f')](_0x543516[_0xc3eb('0x40')]['limit']);_0x598141[_0xc3eb('0x2e')]=qs[_0xc3eb('0x2e')](_0x543516['query'][_0xc3eb('0x2e')]);}_0x598141[_0xc3eb('0x49')]=qs[_0xc3eb('0x4a')](_0x543516[_0xc3eb('0x40')][_0xc3eb('0x4a')]);_0x598141[_0xc3eb('0x4b')]=qs[_0xc3eb('0x42')](_['pick'](_0x543516['query'],_0x5f1b9a[_0xc3eb('0x42')]));_0x598141[_0xc3eb('0x4b')]['ChatQueueId']=_0x1ac092['id'];if(_0x543516['query'][_0xc3eb('0x4c')]){_0x598141['where']=_['merge'](_0x598141['where'],{'$or':_[_0xc3eb('0x3d')](_0x598141[_0xc3eb('0x45')],function(_0x30c70f){var _0x5eaa70={};_0x5eaa70[_0x30c70f]={'$like':'%'+_0x543516['query'][_0xc3eb('0x4c')]+'%'};return _0x5eaa70;})});}_0x598141=_['merge']({},_0x598141,_0x543516['options']);return db[_0xc3eb('0x62')][_0xc3eb('0x51')](_0x598141);}})['then'](function(_0x37fd0c){if(_0x37fd0c){return db[_0xc3eb('0x64')][_0xc3eb('0x65')]({'where':{'id':_[_0xc3eb('0x3d')](_0x37fd0c,_0xc3eb('0x66')),'role':'agent'},'attributes':['id',_0xc3eb('0x3a'),'chatPause','updatedAt',_0xc3eb('0x67')]});}})[_0xc3eb('0x21')](function(_0x4e4c2c){if(_0x4e4c2c){return{'count':_0x4e4c2c['count'],'rows':_[_0xc3eb('0x3d')](_0x4e4c2c[_0xc3eb('0x52')],function(_0x3e4fe7){return{'membername':_0x3e4fe7[_0xc3eb('0x3a')],'UserId':_0x3e4fe7['id'],'queue_name':_0x246556[_0xc3eb('0x3a')],'ChatQueueId':_0x246556['id'],'interface':util[_0xc3eb('0x68')](_0xc3eb('0x69'),_0xc3eb('0x6a'),_0x3e4fe7[_0xc3eb('0x3a')]),'penalty':0x0,'paused':_0x3e4fe7['chatPause'],'createdAt':_0x3e4fe7[_0xc3eb('0x67')],'updatedAt':_0x3e4fe7[_0xc3eb('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3eb('0x21')](respondWithFilteredResult(_0x2f5262,_0x598141))[_0xc3eb('0x29')](handleError(_0x2f5262,null));};exports[_0xc3eb('0x6c')]=function(_0x10e9c9,_0x54ec73,_0x47430e){var _0x58947a={};var _0x53e070={};var _0x40807c;var _0x252a80;return db['ChatQueue'][_0xc3eb('0x6d')]({'where':{'id':_0x10e9c9['params']['id']}})['then'](handleEntityNotFound(_0x54ec73,null))[_0xc3eb('0x21')](function(_0x21e17f){if(_0x21e17f){_0x40807c=_0x21e17f;_0x53e070[_0xc3eb('0x44')]=_[_0xc3eb('0x41')](db[_0xc3eb('0x6e')]['rawAttributes']);_0x53e070[_0xc3eb('0x40')]=_['keys'](_0x10e9c9[_0xc3eb('0x40')]);_0x53e070[_0xc3eb('0x42')]=_['intersection'](_0x53e070[_0xc3eb('0x44')],_0x53e070[_0xc3eb('0x40')]);_0x58947a['attributes']=_[_0xc3eb('0x43')](_0x53e070[_0xc3eb('0x44')],qs[_0xc3eb('0x46')](_0x10e9c9['query'][_0xc3eb('0x46')]));_0x58947a[_0xc3eb('0x45')]=_0x58947a[_0xc3eb('0x45')]['length']?_0x58947a['attributes']:_0x53e070[_0xc3eb('0x44')];_0x58947a[_0xc3eb('0x49')]=qs['sort'](_0x10e9c9[_0xc3eb('0x40')][_0xc3eb('0x4a')]);_0x58947a[_0xc3eb('0x4b')]=qs[_0xc3eb('0x42')](_['pick'](_0x10e9c9['query'],_0x53e070[_0xc3eb('0x42')]));if(_0x10e9c9['query'][_0xc3eb('0x4c')]){_0x58947a[_0xc3eb('0x4b')]=_[_0xc3eb('0x4d')](_0x58947a[_0xc3eb('0x4b')],{'$or':_['map'](_0x58947a[_0xc3eb('0x45')],function(_0x524c1a){var _0x598fb2={};_0x598fb2[_0x524c1a]={'$like':'%'+_0x10e9c9[_0xc3eb('0x40')][_0xc3eb('0x4c')]+'%'};return _0x598fb2;})});}_0x58947a=_['merge']({},_0x58947a,_0x10e9c9[_0xc3eb('0x4f')]);return _0x40807c[_0xc3eb('0x6c')](_0x58947a);}})['then'](function(_0x107a7a){if(_0x107a7a){_0x252a80=_0x107a7a[_0xc3eb('0x47')];if(!_0x10e9c9[_0xc3eb('0x40')][_0xc3eb('0x63')]('nolimit')){_0x58947a[_0xc3eb('0x2f')]=qs[_0xc3eb('0x2f')](_0x10e9c9[_0xc3eb('0x40')][_0xc3eb('0x2f')]);_0x58947a[_0xc3eb('0x2e')]=qs[_0xc3eb('0x2e')](_0x10e9c9['query'][_0xc3eb('0x2e')]);}return _0x40807c[_0xc3eb('0x6c')](_0x58947a);}})[_0xc3eb('0x21')](function(_0x545ebf){if(_0x545ebf){return _0x545ebf?{'count':_0x252a80,'rows':_0x545ebf}:null;}})[_0xc3eb('0x21')](respondWithResult(_0x54ec73,null))[_0xc3eb('0x29')](handleError(_0x54ec73,null));};exports['addTeams']=function(_0x1fc471,_0x2a76ad,_0xd3d207){var _0x2a003a=_0x1fc471[_0xc3eb('0x5e')][_0xc3eb('0x6f')];return db['Team'][_0xc3eb('0x51')]({'where':{'id':_0x2a003a},'attributes':['id'],'include':[{'model':db[_0xc3eb('0x64')],'as':_0xc3eb('0x70'),'attributes':['id',_0xc3eb('0x3a'),_0xc3eb('0x71'),_0xc3eb('0x72'),_0xc3eb('0x73')],'raw':!![]}]})['then'](function(_0x5ec5c8){if(_0x5ec5c8){var _0x185bec=_['flatMap'](_0x5ec5c8,function(_0x3b0515){var _0x29bb82=_0x3b0515['get']({'plain':!![]});return _0x29bb82[_0xc3eb('0x70')];});return db['ChatQueue'][_0xc3eb('0x55')]({'where':{'id':_0x1fc471[_0xc3eb('0x5f')]['id']}})[_0xc3eb('0x21')](function(_0x2bddf1){return db[_0xc3eb('0x74')][_0xc3eb('0x75')](function(_0x27adf9){return _0x2bddf1[_0xc3eb('0x76')](_0x2a003a,{'transaction':_0x27adf9})['then'](function(){return BPromise['each'](_0x185bec,function(_0x5b7ae4){return db[_0xc3eb('0x62')][_0xc3eb('0x77')]({'where':{'UserId':_0x5b7ae4['id'],'ChatQueueId':_0x1fc471['params']['id']},'transaction':_0x27adf9});});})[_0xc3eb('0x21')](function(){_0x185bec[_0xc3eb('0x78')](function(_0x400f8e){socket[_0xc3eb('0x79')](_0xc3eb('0x7a'),{'UserId':_0x400f8e['id'],'ChatQueueId':_0x2bddf1['id']});});});});});}})[_0xc3eb('0x21')](respondWithStatusCode(_0x2a76ad,null))[_0xc3eb('0x29')](handleError(_0x2a76ad,null));};exports[_0xc3eb('0x7b')]=function(_0xc66c8d,_0x12feeb,_0x30b513){return db[_0xc3eb('0x6e')][_0xc3eb('0x51')]({'where':{'id':_0xc66c8d['query'][_0xc3eb('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xc3eb('0x64')],'as':_0xc3eb('0x70'),'attributes':['id'],'raw':!![]}]})[_0xc3eb('0x21')](handleEntityNotFound(_0x12feeb,null))[_0xc3eb('0x21')](function(_0x144215){var _0x44dccb=_[_0xc3eb('0x3d')](_0x144215,'id');var _0x452050=[];var _0x462ea8=[];var _0x31215a=squel[_0xc3eb('0x7c')]();_0x31215a[_0xc3eb('0x7d')]('tq.TeamId')[_0xc3eb('0x7e')](_0xc3eb('0x7f'),'tq')[_0xc3eb('0x80')](_0xc3eb('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc3eb('0x4b')](_0xc3eb('0x82'),_0xc66c8d[_0xc3eb('0x5f')]['id']);for(var _0x4a127a=0x0;_0x4a127a<_0x144215['length'];_0x4a127a+=0x1){let _0x2749b6=_0x144215[_0x4a127a];for(var _0x559d84=0x0;_0x559d84<_0x2749b6[_0xc3eb('0x70')][_0xc3eb('0x47')];_0x559d84+=0x1){let _0x5db92d=_0x2749b6['Agents'][_0x559d84];var _0x21b3a2=_0x31215a[_0xc3eb('0x83')]();_0x21b3a2['where'](_0xc3eb('0x84'),_0x5db92d['id']);_0x462ea8[_0xc3eb('0x85')](db[_0xc3eb('0x74')][_0xc3eb('0x40')](_0x21b3a2[_0xc3eb('0x86')](),{'type':db[_0xc3eb('0x74')][_0xc3eb('0x87')][_0xc3eb('0x88')]})[_0xc3eb('0x21')](function(_0x512423){if(_0x512423['length']===0x1){return _0x5db92d['id'];}else{var _0x424418=_[_0xc3eb('0x89')](_['map'](_0x512423,_0xc3eb('0x8a')),function(_0x315578){return _['includes'](_0x44dccb,_0x315578);});if(_0x424418){return _0x5db92d['id'];}}}));}}return BPromise[_0xc3eb('0x8b')](_0x462ea8)[_0xc3eb('0x21')](function(_0x95ab01){_0x452050=_(_0x452050)['union'](_0x95ab01)[_0xc3eb('0x8c')]()[_0xc3eb('0x8d')]();return db[_0xc3eb('0x3e')]['find']({'where':{'id':_0xc66c8d[_0xc3eb('0x5f')]['id']}})[_0xc3eb('0x21')](function(_0x224baf){return db[_0xc3eb('0x74')]['transaction'](function(_0x1273fd){return _0x224baf['removeTeams'](_0xc66c8d['query'][_0xc3eb('0x6f')],{'transaction':_0x1273fd})[_0xc3eb('0x21')](function(){if(!_['isEmpty'](_0x452050)){return _0x224baf[_0xc3eb('0x8e')](_0x452050,{'transaction':_0x1273fd});}})[_0xc3eb('0x21')](function(){_0x452050[_0xc3eb('0x78')](function(_0x1f98c6){socket['emit'](_0xc3eb('0x8f'),{'UserId':_0x1f98c6,'ChatQueueId':_0x224baf['id']});});});});});});})['then'](respondWithStatusCode(_0x12feeb,null))[_0xc3eb('0x29')](handleError(_0x12feeb,null));};exports[_0xc3eb('0x90')]=function(_0x185015,_0x13e5f3,_0x237d10){return db[_0xc3eb('0x3e')][_0xc3eb('0x55')]({'where':{'id':_0x185015[_0xc3eb('0x5f')]['id']}})[_0xc3eb('0x21')](handleEntityNotFound(_0x13e5f3,null))['then'](function(_0x179813){if(_0x179813){return _0x179813['addAgents'](_0x185015[_0xc3eb('0x5e')][_0xc3eb('0x6f')],_[_0xc3eb('0x91')](_0x185015[_0xc3eb('0x5e')],[_0xc3eb('0x6f'),'id'])||{})[_0xc3eb('0x92')](function(_0xd2b79b){for(var _0x4a9c1e=0x0;_0x4a9c1e<_0x185015[_0xc3eb('0x5e')][_0xc3eb('0x6f')][_0xc3eb('0x47')];_0x4a9c1e+=0x1){socket[_0xc3eb('0x79')]('userChatQueue:save',{'UserId':Number(_0x185015[_0xc3eb('0x5e')][_0xc3eb('0x6f')][_0x4a9c1e]),'ChatQueueId':Number(_0x185015[_0xc3eb('0x5f')]['id'])});}return _0xd2b79b;});}})[_0xc3eb('0x21')](respondWithResult(_0x13e5f3,null))[_0xc3eb('0x29')](handleError(_0x13e5f3,null));};exports[_0xc3eb('0x8e')]=function(_0x3b5071,_0x1bd45b,_0x33ee99){return db[_0xc3eb('0x3e')]['find']({'where':{'id':_0x3b5071['params']['id']}})['then'](handleEntityNotFound(_0x1bd45b,null))[_0xc3eb('0x21')](function(_0x40793a){if(_0x40793a){return _0x40793a[_0xc3eb('0x8e')](_0x3b5071[_0xc3eb('0x40')][_0xc3eb('0x6f')])[_0xc3eb('0x21')](function(){if(_[_0xc3eb('0x93')](_0x3b5071[_0xc3eb('0x40')]['ids'])){for(var _0x14de0d=0x0;_0x14de0d<_0x3b5071[_0xc3eb('0x40')]['ids'][_0xc3eb('0x47')];_0x14de0d+=0x1){socket[_0xc3eb('0x79')]('userChatQueue:remove',{'UserId':Number(_0x3b5071[_0xc3eb('0x40')][_0xc3eb('0x6f')][_0x14de0d]),'ChatQueueId':Number(_0x3b5071[_0xc3eb('0x5f')]['id'])});}}else{socket[_0xc3eb('0x79')]('userChatQueue:remove',{'UserId':Number(_0x3b5071[_0xc3eb('0x40')][_0xc3eb('0x6f')]),'ChatQueueId':Number(_0x3b5071[_0xc3eb('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1bd45b,null))[_0xc3eb('0x29')](handleError(_0x1bd45b,null));};exports[_0xc3eb('0x94')]=function(_0x56d734,_0x303c6d,_0x143008){var _0x27de2f={};var _0x55a057={};var _0x4be850;var _0x19f624;return db[_0xc3eb('0x3e')][_0xc3eb('0x6d')]({'where':{'id':_0x56d734['params']['id']}})[_0xc3eb('0x21')](handleEntityNotFound(_0x303c6d,null))[_0xc3eb('0x21')](function(_0x3862a4){if(_0x3862a4){_0x4be850=_0x3862a4;_0x55a057[_0xc3eb('0x44')]=_['keys'](db[_0xc3eb('0x64')]['rawAttributes']);_0x55a057['query']=_[_0xc3eb('0x41')](_0x56d734[_0xc3eb('0x40')]);_0x55a057[_0xc3eb('0x42')]=_[_0xc3eb('0x43')](_0x55a057['model'],_0x55a057[_0xc3eb('0x40')]);_0x27de2f[_0xc3eb('0x45')]=_[_0xc3eb('0x43')](_0x55a057[_0xc3eb('0x44')],qs[_0xc3eb('0x46')](_0x56d734[_0xc3eb('0x40')][_0xc3eb('0x46')]));_0x27de2f[_0xc3eb('0x45')]=_0x27de2f[_0xc3eb('0x45')][_0xc3eb('0x47')]?_0x27de2f[_0xc3eb('0x45')]:_0x55a057[_0xc3eb('0x44')];_0x27de2f[_0xc3eb('0x49')]=qs[_0xc3eb('0x4a')](_0x56d734[_0xc3eb('0x40')]['sort']);_0x27de2f[_0xc3eb('0x4b')]=qs[_0xc3eb('0x42')](_[_0xc3eb('0x95')](_0x56d734[_0xc3eb('0x40')],_0x55a057['filters']));if(_0x56d734[_0xc3eb('0x40')][_0xc3eb('0x4c')]){_0x27de2f[_0xc3eb('0x4b')]=_['merge'](_0x27de2f[_0xc3eb('0x4b')],{'$or':_[_0xc3eb('0x3d')](_0x27de2f['attributes'],function(_0x1f03fd){var _0x5b61c6={};_0x5b61c6[_0x1f03fd]={'$like':'%'+_0x56d734['query']['filter']+'%'};return _0x5b61c6;})});}_0x27de2f=_['merge']({},_0x27de2f,_0x56d734[_0xc3eb('0x4f')]);return _0x4be850['getAgents'](_0x27de2f);}})[_0xc3eb('0x21')](function(_0x415755){if(_0x415755){_0x19f624=_0x415755[_0xc3eb('0x47')];if(!_0x56d734['query'][_0xc3eb('0x63')](_0xc3eb('0x48'))){_0x27de2f['limit']=qs['limit'](_0x56d734[_0xc3eb('0x40')]['limit']);_0x27de2f[_0xc3eb('0x2e')]=qs[_0xc3eb('0x2e')](_0x56d734[_0xc3eb('0x40')][_0xc3eb('0x2e')]);}return _0x4be850[_0xc3eb('0x94')](_0x27de2f);}})[_0xc3eb('0x21')](function(_0x1bbb8a){if(_0x1bbb8a){return _0x1bbb8a?{'count':_0x19f624,'rows':_0x1bbb8a}:null;}})[_0xc3eb('0x21')](respondWithResult(_0x303c6d,null))['catch'](handleError(_0x303c6d,null));}; \ No newline at end of file +var _0x69f0=['key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','includeAll','rows','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','ChatQueueId','filter','options','UserChatQueue','User','findAndCountAll','UserId','chatPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','ids','Agents','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x69f0,0xf5));var _0x069f=function(_0x499e05,_0x34f10b){_0x499e05=_0x499e05-0x0;var _0x5abbb9=_0x69f0[_0x499e05];return _0x5abbb9;};'use strict';var emlformat=require(_0x069f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x069f('0x1'));var rp=require(_0x069f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x069f('0x3'));var util=require('util');var path=require(_0x069f('0x4'));var sox=require(_0x069f('0x5'));var csv=require(_0x069f('0x6'));var ejs=require(_0x069f('0x7'));var fs=require('fs');var fs_extra=require(_0x069f('0x8'));var _=require(_0x069f('0x9'));var squel=require('squel');var crypto=require(_0x069f('0xa'));var jsforce=require(_0x069f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x069f('0x6'));var querystring=require(_0x069f('0xc'));var Papa=require('papaparse');var Redis=require(_0x069f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x069f('0xe'));var as=require(_0x069f('0xf'));var hardwareService=require(_0x069f('0x10'));var logger=require(_0x069f('0x11'))(_0x069f('0x12'));var utils=require(_0x069f('0x13'));var config=require(_0x069f('0x14'));var licenseUtil=require(_0x069f('0x15'));var db=require(_0x069f('0x16'))['db'];config[_0x069f('0x17')]=_[_0x069f('0x18')](config['redis'],{'host':_0x069f('0x19'),'port':0x18eb});var socket=require(_0x069f('0x1a'))(new Redis(config[_0x069f('0x17')]));require(_0x069f('0x1b'))[_0x069f('0x1c')](socket);var jayson=require(_0x069f('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c69e0,_0x1d274b,_0x1db3ba,_0x203027){return new BPromise(function(_0x2b1aaa,_0x586e52){var _0x2ad9ca=_0x203027||client;return _0x2ad9ca['request'](_0x3c69e0,_0x1db3ba)[_0x069f('0x1e')](function(_0x35bb98){logger[_0x069f('0x1f')](_0x069f('0x20'),_0x1d274b,_0x069f('0x21'));logger[_0x069f('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1d274b,'request\x20sent',JSON[_0x069f('0x23')](_0x35bb98));if(_0x35bb98[_0x069f('0x24')]){if(_0x35bb98[_0x069f('0x24')][_0x069f('0x25')]===0x1f4){logger['error'](_0x069f('0x20'),_0x1d274b,_0x35bb98[_0x069f('0x24')][_0x069f('0x26')]);return _0x586e52(_0x35bb98[_0x069f('0x24')][_0x069f('0x26')]);}logger['error'](_0x069f('0x20'),_0x1d274b,_0x35bb98[_0x069f('0x24')]['message']);return _0x2b1aaa(_0x35bb98[_0x069f('0x24')][_0x069f('0x26')]);}else{logger[_0x069f('0x1f')](_0x069f('0x20'),_0x1d274b,'request\x20sent');_0x2b1aaa(_0x35bb98[_0x069f('0x27')][_0x069f('0x26')]);}})[_0x069f('0x28')](function(_0x2e5083){logger[_0x069f('0x24')](_0x069f('0x20'),_0x1d274b,_0x2e5083);_0x586e52(_0x2e5083);});});}function respondWithStatusCode(_0x56b775,_0x7adbb7){_0x7adbb7=_0x7adbb7||0xcc;return function(_0x132f32){if(_0x132f32){return _0x56b775[_0x069f('0x29')](_0x7adbb7);}return _0x56b775['status'](_0x7adbb7)[_0x069f('0x2a')]();};}function respondWithResult(_0x245d07,_0x50a4fe){_0x50a4fe=_0x50a4fe||0xc8;return function(_0xb0e971){if(_0xb0e971){return _0x245d07[_0x069f('0x2b')](_0x50a4fe)[_0x069f('0x2c')](_0xb0e971);}};}function respondWithFilteredResult(_0x4e3dda,_0x1b91f4){return function(_0x11be86){if(_0x11be86){var _0x3ef767=typeof _0x1b91f4[_0x069f('0x2d')]==='undefined'&&typeof _0x1b91f4[_0x069f('0x2e')]===_0x069f('0x2f');var _0x3767f4=_0x11be86[_0x069f('0x30')];var _0x1c5a80=_0x3ef767?0x0:_0x1b91f4[_0x069f('0x2d')];var _0x3afb6d=_0x3ef767?_0x11be86['count']:_0x1b91f4[_0x069f('0x2d')]+_0x1b91f4[_0x069f('0x2e')];var _0x2ccd04;if(_0x3afb6d>=_0x3767f4){_0x3afb6d=_0x3767f4;_0x2ccd04=0xc8;}else{_0x2ccd04=0xce;}_0x4e3dda[_0x069f('0x2b')](_0x2ccd04);return _0x4e3dda[_0x069f('0x31')](_0x069f('0x32'),_0x1c5a80+'-'+_0x3afb6d+'/'+_0x3767f4)[_0x069f('0x2c')](_0x11be86);}return null;};}function patchUpdates(_0x36221a){return function(_0x3c0c20){try{jsonpatch[_0x069f('0x33')](_0x3c0c20,_0x36221a,!![]);}catch(_0x466136){return BPromise['reject'](_0x466136);}return _0x3c0c20[_0x069f('0x34')]();};}function saveUpdates(_0x44b02b,_0x54fa07){return function(_0x223f23){if(_0x223f23){return _0x223f23[_0x069f('0x35')](_0x44b02b)['then'](function(_0xe069da){return _0xe069da;});}return null;};}function removeEntity(_0x55b56b,_0x3b65b9){return function(_0x22e359){if(_0x22e359){return _0x22e359['destroy']()[_0x069f('0x1e')](function(){var _0x2f19db=_0x22e359[_0x069f('0x36')]({'plain':!![]});var _0x574bd5=_0x069f('0x37');return db[_0x069f('0x38')]['destroy']({'where':{'type':_0x574bd5,'resourceId':_0x2f19db['id']}})[_0x069f('0x1e')](function(){return _0x22e359;});})[_0x069f('0x1e')](function(){_0x55b56b[_0x069f('0x2b')](0xcc)[_0x069f('0x2a')]();});}};}function handleEntityNotFound(_0x274db5,_0x585488){return function(_0x47d57e){if(!_0x47d57e){_0x274db5[_0x069f('0x29')](0x194);}return _0x47d57e;};}function handleError(_0x2380a9,_0xa0bfbe){_0xa0bfbe=_0xa0bfbe||0x1f4;return function(_0x77151){logger['error'](_0x77151[_0x069f('0x39')]);if(_0x77151['name']){delete _0x77151['name'];}_0x2380a9[_0x069f('0x2b')](_0xa0bfbe)[_0x069f('0x3a')](_0x77151);};}exports[_0x069f('0x3b')]=function(_0x5029a7,_0x31427e){var _0x255e4a={},_0x325b28={},_0x22e167={'count':0x0,'rows':[]};var _0x1e6def=_[_0x069f('0x3c')](db[_0x069f('0x3d')][_0x069f('0x3e')],function(_0x4f2421){return{'name':_0x4f2421[_0x069f('0x3f')],'type':_0x4f2421[_0x069f('0x40')][_0x069f('0x41')]};});_0x325b28['model']=_[_0x069f('0x3c')](_0x1e6def,_0x069f('0x42'));_0x325b28[_0x069f('0x43')]=_[_0x069f('0x44')](_0x5029a7['query']);_0x325b28[_0x069f('0x45')]=_[_0x069f('0x46')](_0x325b28[_0x069f('0x47')],_0x325b28[_0x069f('0x43')]);_0x255e4a[_0x069f('0x48')]=_['intersection'](_0x325b28[_0x069f('0x47')],qs[_0x069f('0x49')](_0x5029a7[_0x069f('0x43')][_0x069f('0x49')]));_0x255e4a[_0x069f('0x48')]=_0x255e4a[_0x069f('0x48')][_0x069f('0x4a')]?_0x255e4a[_0x069f('0x48')]:_0x325b28[_0x069f('0x47')];if(!_0x5029a7['query'][_0x069f('0x4b')](_0x069f('0x4c'))){_0x255e4a[_0x069f('0x2e')]=qs['limit'](_0x5029a7[_0x069f('0x43')][_0x069f('0x2e')]);_0x255e4a[_0x069f('0x2d')]=qs[_0x069f('0x2d')](_0x5029a7[_0x069f('0x43')][_0x069f('0x2d')]);}_0x255e4a[_0x069f('0x4d')]=qs[_0x069f('0x4e')](_0x5029a7[_0x069f('0x43')]['sort']);_0x255e4a['where']=qs[_0x069f('0x45')](_[_0x069f('0x4f')](_0x5029a7[_0x069f('0x43')],_0x325b28[_0x069f('0x45')]),_0x1e6def);if(_0x5029a7[_0x069f('0x43')]['filter']){_0x255e4a[_0x069f('0x50')]=_[_0x069f('0x51')](_0x255e4a['where'],{'$or':_[_0x069f('0x3c')](_0x1e6def,function(_0x2edd07){if(_0x2edd07['type']!==_0x069f('0x52')){var _0x8a4b0a={};_0x8a4b0a[_0x2edd07[_0x069f('0x42')]]={'$like':'%'+_0x5029a7[_0x069f('0x43')]['filter']+'%'};return _0x8a4b0a;}})});}_0x255e4a=_[_0x069f('0x51')]({},_0x255e4a,_0x5029a7['options']);var _0x5b4df2={'where':_0x255e4a[_0x069f('0x50')]};return db['ChatQueue'][_0x069f('0x30')](_0x5b4df2)['then'](function(_0x278035){_0x22e167['count']=_0x278035;if(_0x5029a7[_0x069f('0x43')][_0x069f('0x53')]){_0x255e4a['include']=[{'all':!![]}];}return db[_0x069f('0x3d')]['findAll'](_0x255e4a);})[_0x069f('0x1e')](function(_0x407171){_0x22e167[_0x069f('0x54')]=_0x407171;return _0x22e167;})[_0x069f('0x1e')](respondWithFilteredResult(_0x31427e,_0x255e4a))[_0x069f('0x28')](handleError(_0x31427e,null));};exports[_0x069f('0x55')]=function(_0x1520d8,_0x44d31b){var _0x144513={'raw':!![],'where':{'id':_0x1520d8[_0x069f('0x56')]['id']}},_0x581fa3={};_0x581fa3[_0x069f('0x47')]=_[_0x069f('0x44')](db[_0x069f('0x3d')]['rawAttributes']);_0x581fa3[_0x069f('0x43')]=_[_0x069f('0x44')](_0x1520d8['query']);_0x581fa3[_0x069f('0x45')]=_[_0x069f('0x46')](_0x581fa3[_0x069f('0x47')],_0x581fa3[_0x069f('0x43')]);_0x144513[_0x069f('0x48')]=_[_0x069f('0x46')](_0x581fa3[_0x069f('0x47')],qs[_0x069f('0x49')](_0x1520d8[_0x069f('0x43')][_0x069f('0x49')]));_0x144513[_0x069f('0x48')]=_0x144513['attributes'][_0x069f('0x4a')]?_0x144513[_0x069f('0x48')]:_0x581fa3[_0x069f('0x47')];if(_0x1520d8[_0x069f('0x43')][_0x069f('0x53')]){_0x144513[_0x069f('0x57')]=[{'all':!![]}];}_0x144513=_['merge']({},_0x144513,_0x1520d8['options']);return db[_0x069f('0x3d')][_0x069f('0x58')](_0x144513)[_0x069f('0x1e')](handleEntityNotFound(_0x44d31b,null))['then'](respondWithResult(_0x44d31b,null))['catch'](handleError(_0x44d31b,null));};exports[_0x069f('0x59')]=function(_0x47c151,_0x4ce0f2){return db[_0x069f('0x3d')][_0x069f('0x59')](_0x47c151[_0x069f('0x5a')],{})['then'](function(_0x3fccb9){var _0x1e3312=_0x47c151[_0x069f('0x5b')][_0x069f('0x36')]({'plain':!![]});if(!_0x1e3312)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e3312[_0x069f('0x5c')]===_0x069f('0x5b')){var _0x1000f7=_0x3fccb9[_0x069f('0x36')]({'plain':!![]});var _0x27269a=_0x069f('0x37');return db[_0x069f('0x5d')][_0x069f('0x58')]({'where':{'name':_0x27269a,'userProfileId':_0x1e3312[_0x069f('0x5e')]},'raw':!![]})[_0x069f('0x1e')](function(_0x307bb4){if(_0x307bb4&&_0x307bb4[_0x069f('0x5f')]===0x0){return db[_0x069f('0x38')][_0x069f('0x59')]({'name':_0x1000f7[_0x069f('0x42')],'resourceId':_0x1000f7['id'],'type':_0x307bb4[_0x069f('0x42')],'sectionId':_0x307bb4['id']},{})[_0x069f('0x1e')](function(){return _0x3fccb9;});}else{return _0x3fccb9;}})['catch'](function(_0x261e89){logger[_0x069f('0x24')](_0x069f('0x60'),_0x261e89);throw _0x261e89;});}return _0x3fccb9;})['then'](respondWithResult(_0x4ce0f2,0xc9))[_0x069f('0x28')](handleError(_0x4ce0f2,null));};exports[_0x069f('0x35')]=function(_0x2eaf41,_0x1407d1){if(_0x2eaf41[_0x069f('0x5a')]['id']){delete _0x2eaf41[_0x069f('0x5a')]['id'];}return db[_0x069f('0x3d')][_0x069f('0x58')]({'where':{'id':_0x2eaf41[_0x069f('0x56')]['id']}})['then'](handleEntityNotFound(_0x1407d1,null))[_0x069f('0x1e')](saveUpdates(_0x2eaf41[_0x069f('0x5a')],null))[_0x069f('0x1e')](respondWithResult(_0x1407d1,null))[_0x069f('0x28')](handleError(_0x1407d1,null));};exports[_0x069f('0x61')]=function(_0x2157a1,_0x32d889){return db['ChatQueue'][_0x069f('0x58')]({'where':{'id':_0x2157a1[_0x069f('0x56')]['id']}})[_0x069f('0x1e')](handleEntityNotFound(_0x32d889,null))[_0x069f('0x1e')](removeEntity(_0x32d889,null))[_0x069f('0x28')](handleError(_0x32d889,null));};exports['describe']=function(_0x106d87,_0x36085d){return db[_0x069f('0x3d')][_0x069f('0x62')]()['then'](respondWithResult(_0x36085d,null))[_0x069f('0x28')](handleError(_0x36085d,null));};exports[_0x069f('0x63')]=function(_0x2eb974,_0x40d9df,_0x10f618){var _0x3ca035={'raw':!![],'where':{}},_0x4cf3bb={},_0x1e7cc6;return db[_0x069f('0x3d')]['findOne']({'where':{'id':_0x2eb974[_0x069f('0x56')]['id']}})[_0x069f('0x1e')](handleEntityNotFound(_0x40d9df,null))['then'](function(_0x3ed2e0){if(_0x3ed2e0){_0x1e7cc6=_0x3ed2e0[_0x069f('0x36')]({'plain':!![]});_0x4cf3bb[_0x069f('0x47')]=_[_0x069f('0x44')](db['UserChatQueue']['rawAttributes']);_0x4cf3bb[_0x069f('0x43')]=_['keys'](_0x2eb974[_0x069f('0x43')]);_0x4cf3bb[_0x069f('0x45')]=_[_0x069f('0x46')](_0x4cf3bb['model'],_0x4cf3bb[_0x069f('0x43')]);_0x3ca035[_0x069f('0x48')]=_[_0x069f('0x46')](_0x4cf3bb[_0x069f('0x47')],qs['fields'](_0x2eb974[_0x069f('0x43')][_0x069f('0x49')]));_0x3ca035[_0x069f('0x48')]=_0x3ca035[_0x069f('0x48')][_0x069f('0x4a')]?_0x3ca035['attributes']:_0x4cf3bb[_0x069f('0x47')];if(!_0x2eb974[_0x069f('0x43')][_0x069f('0x4b')](_0x069f('0x4c'))){_0x3ca035[_0x069f('0x2e')]=qs[_0x069f('0x2e')](_0x2eb974['query'][_0x069f('0x2e')]);_0x3ca035[_0x069f('0x2d')]=qs[_0x069f('0x2d')](_0x2eb974[_0x069f('0x43')]['offset']);}_0x3ca035['order']=qs[_0x069f('0x4e')](_0x2eb974[_0x069f('0x43')][_0x069f('0x4e')]);_0x3ca035['where']=qs['filters'](_[_0x069f('0x4f')](_0x2eb974[_0x069f('0x43')],_0x4cf3bb[_0x069f('0x45')]));_0x3ca035['where'][_0x069f('0x64')]=_0x3ed2e0['id'];if(_0x2eb974[_0x069f('0x43')][_0x069f('0x65')]){_0x3ca035[_0x069f('0x50')]=_[_0x069f('0x51')](_0x3ca035['where'],{'$or':_[_0x069f('0x3c')](_0x3ca035[_0x069f('0x48')],function(_0x3186){var _0x90ab76={};_0x90ab76[_0x3186]={'$like':'%'+_0x2eb974['query']['filter']+'%'};return _0x90ab76;})});}_0x3ca035=_[_0x069f('0x51')]({},_0x3ca035,_0x2eb974[_0x069f('0x66')]);return db[_0x069f('0x67')]['findAll'](_0x3ca035);}})['then'](function(_0x46a309){if(_0x46a309){return db[_0x069f('0x68')][_0x069f('0x69')]({'where':{'id':_[_0x069f('0x3c')](_0x46a309,_0x069f('0x6a')),'role':'agent'},'attributes':['id',_0x069f('0x42'),_0x069f('0x6b'),'updatedAt',_0x069f('0x6c')]});}})[_0x069f('0x1e')](function(_0xeb552d){if(_0xeb552d){return{'count':_0xeb552d[_0x069f('0x30')],'rows':_[_0x069f('0x3c')](_0xeb552d[_0x069f('0x54')],function(_0x21c38f){return{'membername':_0x21c38f[_0x069f('0x42')],'UserId':_0x21c38f['id'],'queue_name':_0x1e7cc6[_0x069f('0x42')],'ChatQueueId':_0x1e7cc6['id'],'interface':util[_0x069f('0x6d')](_0x069f('0x6e'),_0x069f('0x6f'),_0x21c38f[_0x069f('0x42')]),'penalty':0x0,'paused':_0x21c38f[_0x069f('0x6b')],'createdAt':_0x21c38f[_0x069f('0x6c')],'updatedAt':_0x21c38f[_0x069f('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40d9df,_0x3ca035))[_0x069f('0x28')](handleError(_0x40d9df,null));};exports['getTeams']=function(_0x362b23,_0x3039e4,_0x2feaa7){var _0x3c61f8={};var _0x305262={};var _0x554095;var _0x156843;return db[_0x069f('0x3d')][_0x069f('0x71')]({'where':{'id':_0x362b23[_0x069f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3039e4,null))[_0x069f('0x1e')](function(_0x4f1341){if(_0x4f1341){_0x554095=_0x4f1341;_0x305262[_0x069f('0x47')]=_[_0x069f('0x44')](db[_0x069f('0x72')][_0x069f('0x3e')]);_0x305262[_0x069f('0x43')]=_['keys'](_0x362b23['query']);_0x305262[_0x069f('0x45')]=_['intersection'](_0x305262['model'],_0x305262[_0x069f('0x43')]);_0x3c61f8[_0x069f('0x48')]=_[_0x069f('0x46')](_0x305262[_0x069f('0x47')],qs[_0x069f('0x49')](_0x362b23[_0x069f('0x43')][_0x069f('0x49')]));_0x3c61f8[_0x069f('0x48')]=_0x3c61f8['attributes'][_0x069f('0x4a')]?_0x3c61f8[_0x069f('0x48')]:_0x305262[_0x069f('0x47')];_0x3c61f8[_0x069f('0x4d')]=qs['sort'](_0x362b23[_0x069f('0x43')][_0x069f('0x4e')]);_0x3c61f8['where']=qs['filters'](_[_0x069f('0x4f')](_0x362b23['query'],_0x305262[_0x069f('0x45')]));if(_0x362b23[_0x069f('0x43')]['filter']){_0x3c61f8[_0x069f('0x50')]=_[_0x069f('0x51')](_0x3c61f8['where'],{'$or':_[_0x069f('0x3c')](_0x3c61f8['attributes'],function(_0x22592b){var _0x3dad59={};_0x3dad59[_0x22592b]={'$like':'%'+_0x362b23[_0x069f('0x43')][_0x069f('0x65')]+'%'};return _0x3dad59;})});}_0x3c61f8=_[_0x069f('0x51')]({},_0x3c61f8,_0x362b23[_0x069f('0x66')]);return _0x554095[_0x069f('0x73')](_0x3c61f8);}})['then'](function(_0x4d8155){if(_0x4d8155){_0x156843=_0x4d8155[_0x069f('0x4a')];if(!_0x362b23[_0x069f('0x43')][_0x069f('0x4b')]('nolimit')){_0x3c61f8[_0x069f('0x2e')]=qs[_0x069f('0x2e')](_0x362b23[_0x069f('0x43')][_0x069f('0x2e')]);_0x3c61f8[_0x069f('0x2d')]=qs['offset'](_0x362b23[_0x069f('0x43')][_0x069f('0x2d')]);}return _0x554095[_0x069f('0x73')](_0x3c61f8);}})['then'](function(_0x5798f0){if(_0x5798f0){return _0x5798f0?{'count':_0x156843,'rows':_0x5798f0}:null;}})[_0x069f('0x1e')](respondWithResult(_0x3039e4,null))[_0x069f('0x28')](handleError(_0x3039e4,null));};exports['addTeams']=function(_0x12e51d,_0xe26f66,_0x849994){var _0x31cb03=_0x12e51d[_0x069f('0x5a')][_0x069f('0x74')];return db['Team']['findAll']({'where':{'id':_0x31cb03},'attributes':['id'],'include':[{'model':db['User'],'as':_0x069f('0x75'),'attributes':['id',_0x069f('0x42'),'online',_0x069f('0x76'),_0x069f('0x77')],'raw':!![]}]})['then'](function(_0x34f9af){if(_0x34f9af){var _0x56d94f=_[_0x069f('0x78')](_0x34f9af,function(_0x41cd7f){var _0x54dd9=_0x41cd7f['get']({'plain':!![]});return _0x54dd9['Agents'];});return db[_0x069f('0x3d')][_0x069f('0x58')]({'where':{'id':_0x12e51d[_0x069f('0x56')]['id']}})[_0x069f('0x1e')](function(_0x5e4ecb){return db['sequelize']['transaction'](function(_0x206aa8){return _0x5e4ecb[_0x069f('0x79')](_0x31cb03,{'transaction':_0x206aa8})[_0x069f('0x1e')](function(){return BPromise[_0x069f('0x7a')](_0x56d94f,function(_0x27997f){return db[_0x069f('0x67')][_0x069f('0x7b')]({'where':{'UserId':_0x27997f['id'],'ChatQueueId':_0x12e51d[_0x069f('0x56')]['id']},'transaction':_0x206aa8});});})[_0x069f('0x1e')](function(){_0x56d94f[_0x069f('0x7c')](function(_0x2aa88e){socket[_0x069f('0x7d')](_0x069f('0x7e'),{'UserId':_0x2aa88e['id'],'ChatQueueId':_0x5e4ecb['id']});});});});});}})[_0x069f('0x1e')](respondWithStatusCode(_0xe26f66,null))[_0x069f('0x28')](handleError(_0xe26f66,null));};exports[_0x069f('0x7f')]=function(_0x125967,_0x282195,_0x5c7211){return db[_0x069f('0x72')]['findAll']({'where':{'id':_0x125967[_0x069f('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x069f('0x68')],'as':_0x069f('0x75'),'attributes':['id'],'raw':!![]}]})[_0x069f('0x1e')](handleEntityNotFound(_0x282195,null))['then'](function(_0x2924b3){var _0x42fe5b=_['map'](_0x2924b3,'id');var _0x29bd53=[];var _0x4101d7=[];var _0x39dbff=squel['select']();_0x39dbff[_0x069f('0x80')](_0x069f('0x81'))[_0x069f('0x82')](_0x069f('0x83'),'tq')[_0x069f('0x84')](_0x069f('0x85'),'ut',_0x069f('0x86'))[_0x069f('0x50')](_0x069f('0x87'),_0x125967['params']['id']);for(var _0x281073=0x0;_0x281073<_0x2924b3[_0x069f('0x4a')];_0x281073+=0x1){let _0x1899fc=_0x2924b3[_0x281073];for(var _0x2493b5=0x0;_0x2493b5<_0x1899fc[_0x069f('0x75')][_0x069f('0x4a')];_0x2493b5+=0x1){let _0xb31608=_0x1899fc['Agents'][_0x2493b5];var _0x558322=_0x39dbff[_0x069f('0x88')]();_0x558322[_0x069f('0x50')](_0x069f('0x89'),_0xb31608['id']);_0x4101d7[_0x069f('0x8a')](db[_0x069f('0x8b')]['query'](_0x558322[_0x069f('0x8c')](),{'type':db[_0x069f('0x8b')][_0x069f('0x8d')]['SELECT']})['then'](function(_0x5a4bda){if(_0x5a4bda[_0x069f('0x4a')]===0x1){return _0xb31608['id'];}else{var _0xe67d25=_[_0x069f('0x8e')](_['map'](_0x5a4bda,_0x069f('0x8f')),function(_0x393dc7){return _['includes'](_0x42fe5b,_0x393dc7);});if(_0xe67d25){return _0xb31608['id'];}}}));}}return BPromise[_0x069f('0x90')](_0x4101d7)[_0x069f('0x1e')](function(_0x37bd30){_0x29bd53=_(_0x29bd53)[_0x069f('0x91')](_0x37bd30)[_0x069f('0x92')]()[_0x069f('0x93')]();return db[_0x069f('0x3d')]['find']({'where':{'id':_0x125967['params']['id']}})[_0x069f('0x1e')](function(_0x2f9a54){return db[_0x069f('0x8b')]['transaction'](function(_0x1c25ca){return _0x2f9a54[_0x069f('0x7f')](_0x125967[_0x069f('0x43')][_0x069f('0x74')],{'transaction':_0x1c25ca})[_0x069f('0x1e')](function(){if(!_[_0x069f('0x94')](_0x29bd53)){return _0x2f9a54[_0x069f('0x95')](_0x29bd53,{'transaction':_0x1c25ca});}})[_0x069f('0x1e')](function(){_0x29bd53[_0x069f('0x7c')](function(_0x4179a0){socket[_0x069f('0x7d')]('userChatQueue:remove',{'UserId':_0x4179a0,'ChatQueueId':_0x2f9a54['id']});});});});});});})[_0x069f('0x1e')](respondWithStatusCode(_0x282195,null))['catch'](handleError(_0x282195,null));};exports['addAgents']=function(_0x461006,_0x43a626,_0x1d8e7a){return db['ChatQueue'][_0x069f('0x58')]({'where':{'id':_0x461006[_0x069f('0x56')]['id']}})[_0x069f('0x1e')](handleEntityNotFound(_0x43a626,null))['then'](function(_0x12a950){if(_0x12a950){return _0x12a950[_0x069f('0x96')](_0x461006['body'][_0x069f('0x74')],_[_0x069f('0x97')](_0x461006[_0x069f('0x5a')],[_0x069f('0x74'),'id'])||{})[_0x069f('0x98')](function(_0x517d82){for(var _0x2a830f=0x0;_0x2a830f<_0x461006[_0x069f('0x5a')]['ids'][_0x069f('0x4a')];_0x2a830f+=0x1){socket[_0x069f('0x7d')]('userChatQueue:save',{'UserId':Number(_0x461006[_0x069f('0x5a')][_0x069f('0x74')][_0x2a830f]),'ChatQueueId':Number(_0x461006[_0x069f('0x56')]['id'])});}return _0x517d82;});}})[_0x069f('0x1e')](respondWithResult(_0x43a626,null))[_0x069f('0x28')](handleError(_0x43a626,null));};exports['removeAgents']=function(_0x89466a,_0xabc1f9,_0x46ce79){return db[_0x069f('0x3d')][_0x069f('0x58')]({'where':{'id':_0x89466a[_0x069f('0x56')]['id']}})[_0x069f('0x1e')](handleEntityNotFound(_0xabc1f9,null))[_0x069f('0x1e')](function(_0x584d41){if(_0x584d41){return _0x584d41[_0x069f('0x95')](_0x89466a[_0x069f('0x43')][_0x069f('0x74')])['then'](function(){if(_['isArray'](_0x89466a[_0x069f('0x43')][_0x069f('0x74')])){for(var _0x55e87c=0x0;_0x55e87c<_0x89466a[_0x069f('0x43')][_0x069f('0x74')][_0x069f('0x4a')];_0x55e87c+=0x1){socket[_0x069f('0x7d')](_0x069f('0x99'),{'UserId':Number(_0x89466a['query'][_0x069f('0x74')][_0x55e87c]),'ChatQueueId':Number(_0x89466a[_0x069f('0x56')]['id'])});}}else{socket['emit'](_0x069f('0x99'),{'UserId':Number(_0x89466a[_0x069f('0x43')][_0x069f('0x74')]),'ChatQueueId':Number(_0x89466a['params']['id'])});}});}})['then'](respondWithStatusCode(_0xabc1f9,null))['catch'](handleError(_0xabc1f9,null));};exports[_0x069f('0x9a')]=function(_0x1a49c1,_0x3e3701,_0x401841){var _0x1036ec={};var _0x155bfc={};var _0x4e0d2e;var _0xfae515;return db[_0x069f('0x3d')][_0x069f('0x71')]({'where':{'id':_0x1a49c1[_0x069f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e3701,null))[_0x069f('0x1e')](function(_0x58f140){if(_0x58f140){_0x4e0d2e=_0x58f140;_0x155bfc['model']=_[_0x069f('0x44')](db[_0x069f('0x68')][_0x069f('0x3e')]);_0x155bfc[_0x069f('0x43')]=_[_0x069f('0x44')](_0x1a49c1['query']);_0x155bfc[_0x069f('0x45')]=_[_0x069f('0x46')](_0x155bfc[_0x069f('0x47')],_0x155bfc[_0x069f('0x43')]);_0x1036ec[_0x069f('0x48')]=_[_0x069f('0x46')](_0x155bfc[_0x069f('0x47')],qs[_0x069f('0x49')](_0x1a49c1[_0x069f('0x43')][_0x069f('0x49')]));_0x1036ec[_0x069f('0x48')]=_0x1036ec[_0x069f('0x48')]['length']?_0x1036ec[_0x069f('0x48')]:_0x155bfc[_0x069f('0x47')];_0x1036ec['order']=qs[_0x069f('0x4e')](_0x1a49c1['query'][_0x069f('0x4e')]);_0x1036ec[_0x069f('0x50')]=qs[_0x069f('0x45')](_[_0x069f('0x4f')](_0x1a49c1[_0x069f('0x43')],_0x155bfc[_0x069f('0x45')]));if(_0x1a49c1[_0x069f('0x43')]['filter']){_0x1036ec[_0x069f('0x50')]=_['merge'](_0x1036ec[_0x069f('0x50')],{'$or':_[_0x069f('0x3c')](_0x1036ec[_0x069f('0x48')],function(_0x2884a1){var _0x40c66a={};_0x40c66a[_0x2884a1]={'$like':'%'+_0x1a49c1[_0x069f('0x43')][_0x069f('0x65')]+'%'};return _0x40c66a;})});}_0x1036ec=_[_0x069f('0x51')]({},_0x1036ec,_0x1a49c1[_0x069f('0x66')]);return _0x4e0d2e[_0x069f('0x9a')](_0x1036ec);}})[_0x069f('0x1e')](function(_0x4b6ae9){if(_0x4b6ae9){_0xfae515=_0x4b6ae9[_0x069f('0x4a')];if(!_0x1a49c1[_0x069f('0x43')]['hasOwnProperty'](_0x069f('0x4c'))){_0x1036ec[_0x069f('0x2e')]=qs['limit'](_0x1a49c1[_0x069f('0x43')]['limit']);_0x1036ec['offset']=qs[_0x069f('0x2d')](_0x1a49c1['query']['offset']);}return _0x4e0d2e['getAgents'](_0x1036ec);}})['then'](function(_0xff17f8){if(_0xff17f8){return _0xff17f8?{'count':_0xfae515,'rows':_0xff17f8}:null;}})[_0x069f('0x1e')](respondWithResult(_0x3e3701,null))[_0x069f('0x28')](handleError(_0x3e3701,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e2b5f9c..461dbb9 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 _0x8043=['setMaxListeners','save','remove','hook','exports','events','../../mysqldb'];(function(_0x5c5e92,_0x1e3133){var _0x266316=function(_0x3aa06e){while(--_0x3aa06e){_0x5c5e92['push'](_0x5c5e92['shift']());}};_0x266316(++_0x1e3133);}(_0x8043,0xc9));var _0x3804=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x8043[_0x5f309e];return _0x487b5e;};'use strict';var EventEmitter=require(_0x3804('0x0'));var ChatQueue=require(_0x3804('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3804('0x2')](0x0);var events={'afterCreate':_0x3804('0x3'),'afterUpdate':'update','afterDestroy':_0x3804('0x4')};function emitEvent(_0x42b062){return function(_0xa932cf,_0x36cab1,_0xf15002){ChatQueueEvents['emit'](_0x42b062+':'+_0xa932cf['id'],_0xa932cf);ChatQueueEvents['emit'](_0x42b062,_0xa932cf);_0xf15002(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x3804('0x5')](e,emitEvent(event));}}module[_0x3804('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xaa77=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x481c6d,_0x4d4274){var _0x6f073c=function(_0x3197ac){while(--_0x3197ac){_0x481c6d['push'](_0x481c6d['shift']());}};_0x6f073c(++_0x4d4274);}(_0xaa77,0xb0));var _0x7aa7=function(_0x10f889,_0x25caff){_0x10f889=_0x10f889-0x0;var _0x2b28cb=_0xaa77[_0x10f889];return _0x2b28cb;};'use strict';var EventEmitter=require(_0x7aa7('0x0'));var ChatQueue=require(_0x7aa7('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7aa7('0x2')](0x0);var events={'afterCreate':_0x7aa7('0x3'),'afterUpdate':_0x7aa7('0x4'),'afterDestroy':_0x7aa7('0x5')};function emitEvent(_0xbd0589){return function(_0x3b9f51,_0x4b6f76,_0x44773d){ChatQueueEvents['emit'](_0xbd0589+':'+_0x3b9f51['id'],_0x3b9f51);ChatQueueEvents[_0x7aa7('0x6')](_0xbd0589,_0x3b9f51);_0x44773d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7aa7('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 34178e1..0e6a3c8 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 _0x0224=['moment','path','rimraf','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','api'];(function(_0x137f8d,_0xcae17b){var _0x2e7e6f=function(_0x2ff1a4){while(--_0x2ff1a4){_0x137f8d['push'](_0x137f8d['shift']());}};_0x2e7e6f(++_0xcae17b);}(_0x0224,0x96));var _0x4022=function(_0x418ad2,_0xeae93b){_0x418ad2=_0x418ad2-0x0;var _0x4f4fe5=_0x0224[_0x418ad2];return _0x4f4fe5;};'use strict';var _=require(_0x4022('0x0'));var util=require(_0x4022('0x1'));var logger=require('../../config/logger')(_0x4022('0x2'));var moment=require(_0x4022('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4022('0x4'));var rimraf=require(_0x4022('0x5'));var config=require('../../config/environment');var attributes=require(_0x4022('0x6'));module['exports']=function(_0x100403,_0x14cf52){return _0x100403['define'](_0x4022('0x7'),attributes,{'tableName':_0x4022('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d38=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e6aca,_0x5a1d15){var _0x14ae1b=function(_0x2f46a3){while(--_0x2f46a3){_0x4e6aca['push'](_0x4e6aca['shift']());}};_0x14ae1b(++_0x5a1d15);}(_0x1d38,0x8f));var _0x81d3=function(_0x12a365,_0x44252a){_0x12a365=_0x12a365-0x0;var _0x2f10f0=_0x1d38[_0x12a365];return _0x2f10f0;};'use strict';var _=require(_0x81d3('0x0'));var util=require(_0x81d3('0x1'));var logger=require(_0x81d3('0x2'))(_0x81d3('0x3'));var moment=require(_0x81d3('0x4'));var BPromise=require(_0x81d3('0x5'));var rp=require(_0x81d3('0x6'));var fs=require('fs');var path=require(_0x81d3('0x7'));var rimraf=require(_0x81d3('0x8'));var config=require(_0x81d3('0x9'));var attributes=require(_0x81d3('0xa'));module[_0x81d3('0xb')]=function(_0x2fe372,_0x16b94c){return _0x2fe372[_0x81d3('0xc')](_0x81d3('0xd'),attributes,{'tableName':_0x81d3('0xe'),'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 14e56ca..945f532 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 _0x6b1e=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','ChatQueue','findAll','options','where','attributes','limit','include','map','model','GetChatQueue','catch','ShowChatQueue'];(function(_0x5e24d3,_0x235cd4){var _0x2ec83f=function(_0x571832){while(--_0x571832){_0x5e24d3['push'](_0x5e24d3['shift']());}};_0x2ec83f(++_0x235cd4);}(_0x6b1e,0xd3));var _0xe6b1=function(_0x531186,_0x5b22ef){_0x531186=_0x531186-0x0;var _0x5b0865=_0x6b1e[_0x531186];return _0x5b0865;};'use strict';var _=require(_0xe6b1('0x0'));var util=require(_0xe6b1('0x1'));var moment=require(_0xe6b1('0x2'));var BPromise=require(_0xe6b1('0x3'));var rs=require(_0xe6b1('0x4'));var fs=require('fs');var Redis=require(_0xe6b1('0x5'));var db=require(_0xe6b1('0x6'))['db'];var utils=require(_0xe6b1('0x7'));var logger=require(_0xe6b1('0x8'))(_0xe6b1('0x9'));var config=require(_0xe6b1('0xa'));var jayson=require(_0xe6b1('0xb'));var client=jayson[_0xe6b1('0xc')][_0xe6b1('0xd')]({'port':0x232a});config[_0xe6b1('0xe')]=_['defaults'](config[_0xe6b1('0xe')],{'host':_0xe6b1('0xf'),'port':0x18eb});var socket=require(_0xe6b1('0x10'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xe6b1('0x11')](socket);function respondWithRpcPromise(_0x3ccea8,_0x301cf2,_0x565b78){return new BPromise(function(_0x568c80,_0x43bbc5){return client[_0xe6b1('0x12')](_0x3ccea8,_0x565b78)[_0xe6b1('0x13')](function(_0x12ebe8){logger[_0xe6b1('0x14')]('ChatQueue,\x20%s,\x20%s',_0x301cf2,_0xe6b1('0x15'));logger[_0xe6b1('0x16')](_0xe6b1('0x17'),_0x301cf2,_0xe6b1('0x15'),JSON[_0xe6b1('0x18')](_0x12ebe8));if(_0x12ebe8[_0xe6b1('0x19')]){if(_0x12ebe8[_0xe6b1('0x19')][_0xe6b1('0x1a')]===0x1f4){logger[_0xe6b1('0x19')](_0xe6b1('0x1b'),_0x301cf2,_0x12ebe8[_0xe6b1('0x19')][_0xe6b1('0x1c')]);return _0x43bbc5(_0x12ebe8['error']['message']);}logger['error'](_0xe6b1('0x1b'),_0x301cf2,_0x12ebe8[_0xe6b1('0x19')]['message']);return _0x568c80(_0x12ebe8[_0xe6b1('0x19')]['message']);}else{logger[_0xe6b1('0x14')](_0xe6b1('0x1b'),_0x301cf2,_0xe6b1('0x15'));_0x568c80(_0x12ebe8['result'][_0xe6b1('0x1c')]);}})['catch'](function(_0x35891c){logger[_0xe6b1('0x19')](_0xe6b1('0x1b'),_0x301cf2,_0x35891c);_0x43bbc5(_0x35891c);});});}exports['GetChatQueue']=function(_0x5bbee7){var _0x57cc76=this;return new Promise(function(_0x5d7813,_0xe853c){return db[_0xe6b1('0x1d')][_0xe6b1('0x1e')]({'raw':_0x5bbee7[_0xe6b1('0x1f')]?_0x5bbee7[_0xe6b1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5bbee7[_0xe6b1('0x1f')]?_0x5bbee7['options'][_0xe6b1('0x20')]||null:null,'attributes':_0x5bbee7[_0xe6b1('0x1f')]?_0x5bbee7['options'][_0xe6b1('0x21')]||null:null,'limit':_0x5bbee7['options']?_0x5bbee7[_0xe6b1('0x1f')][_0xe6b1('0x22')]||null:null,'include':_0x5bbee7[_0xe6b1('0x1f')]?_0x5bbee7['options'][_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x5bbee7[_0xe6b1('0x1f')][_0xe6b1('0x23')],function(_0x280848){return{'model':db[_0x280848[_0xe6b1('0x25')]],'as':_0x280848['as'],'attributes':_0x280848['attributes'],'include':_0x280848[_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x280848[_0xe6b1('0x23')],function(_0x4ac1e3){return{'model':db[_0x4ac1e3[_0xe6b1('0x25')]],'as':_0x4ac1e3['as'],'attributes':_0x4ac1e3[_0xe6b1('0x21')],'include':_0x4ac1e3[_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x4ac1e3[_0xe6b1('0x23')],function(_0x3dd04a){return{'model':db[_0x3dd04a['model']],'as':_0x3dd04a['as'],'attributes':_0x3dd04a[_0xe6b1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe6b1('0x13')](function(_0xab7a40){logger[_0xe6b1('0x14')](_0xe6b1('0x26'),_0x5bbee7);logger[_0xe6b1('0x16')](_0xe6b1('0x26'),_0x5bbee7,JSON[_0xe6b1('0x18')](_0xab7a40));_0x5d7813(_0xab7a40);})[_0xe6b1('0x27')](function(_0x2352f6){logger[_0xe6b1('0x19')]('GetChatQueue',_0x2352f6[_0xe6b1('0x1c')],_0x5bbee7);_0xe853c(_0x57cc76[_0xe6b1('0x19')](0x1f4,_0x2352f6[_0xe6b1('0x1c')]));});});};exports[_0xe6b1('0x28')]=function(_0x2cfce4){var _0x18650e=this;return new Promise(function(_0x1bbfe8,_0x105e2a){return db[_0xe6b1('0x1d')][_0xe6b1('0x29')]({'raw':_0x2cfce4[_0xe6b1('0x1f')]?_0x2cfce4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2cfce4['options']?_0x2cfce4[_0xe6b1('0x1f')]['where']||null:null,'attributes':_0x2cfce4[_0xe6b1('0x1f')]?_0x2cfce4[_0xe6b1('0x1f')][_0xe6b1('0x21')]||null:null,'include':_0x2cfce4[_0xe6b1('0x1f')]?_0x2cfce4[_0xe6b1('0x1f')][_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x2cfce4[_0xe6b1('0x1f')][_0xe6b1('0x23')],function(_0x240f93){return{'model':db[_0x240f93[_0xe6b1('0x25')]],'as':_0x240f93['as'],'attributes':_0x240f93[_0xe6b1('0x21')],'include':_0x240f93[_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x240f93[_0xe6b1('0x23')],function(_0x6ce4f7){return{'model':db[_0x6ce4f7[_0xe6b1('0x25')]],'as':_0x6ce4f7['as'],'attributes':_0x6ce4f7['attributes'],'include':_0x6ce4f7[_0xe6b1('0x23')]?_[_0xe6b1('0x24')](_0x6ce4f7[_0xe6b1('0x23')],function(_0xc2106b){return{'model':db[_0xc2106b['model']],'as':_0xc2106b['as'],'attributes':_0xc2106b[_0xe6b1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe6b1('0x13')](function(_0x30b1d1){logger[_0xe6b1('0x14')]('ShowChatQueue',_0x2cfce4);logger[_0xe6b1('0x16')](_0xe6b1('0x28'),_0x2cfce4,JSON['stringify'](_0x30b1d1));_0x1bbfe8(_0x30b1d1);})[_0xe6b1('0x27')](function(_0x26ebc1){logger[_0xe6b1('0x19')](_0xe6b1('0x28'),_0x26ebc1['message'],_0x2cfce4);_0x105e2a(_0x18650e[_0xe6b1('0x19')](0x1f4,_0x26ebc1[_0xe6b1('0x1c')]));});});}; \ No newline at end of file +var _0x6df4=['socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','limit','include','map','model','attributes','then','raw','where','ShowChatQueue','lodash','moment','bluebird','../../config/utils','jayson/promise','http','redis','localhost'];(function(_0x10fe3f,_0x10363b){var _0x12b968=function(_0x3b44e9){while(--_0x3b44e9){_0x10fe3f['push'](_0x10fe3f['shift']());}};_0x12b968(++_0x10363b);}(_0x6df4,0x78));var _0x46df=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x6df4[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x46df('0x0'));var util=require('util');var moment=require(_0x46df('0x1'));var BPromise=require(_0x46df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46df('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x46df('0x4'));var client=jayson['client'][_0x46df('0x5')]({'port':0x232a});config[_0x46df('0x6')]=_['defaults'](config[_0x46df('0x6')],{'host':_0x46df('0x7'),'port':0x18eb});var socket=require(_0x46df('0x8'))(new Redis(config[_0x46df('0x6')]));require(_0x46df('0x9'))['register'](socket);function respondWithRpcPromise(_0x147f22,_0x4e0844,_0x432f39){return new BPromise(function(_0x32b48d,_0x1d491e){return client[_0x46df('0xa')](_0x147f22,_0x432f39)['then'](function(_0x1c33a2){logger[_0x46df('0xb')](_0x46df('0xc'),_0x4e0844,_0x46df('0xd'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4e0844,_0x46df('0xd'),JSON[_0x46df('0xe')](_0x1c33a2));if(_0x1c33a2['error']){if(_0x1c33a2['error']['code']===0x1f4){logger['error'](_0x46df('0xc'),_0x4e0844,_0x1c33a2[_0x46df('0xf')][_0x46df('0x10')]);return _0x1d491e(_0x1c33a2[_0x46df('0xf')][_0x46df('0x10')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x4e0844,_0x1c33a2[_0x46df('0xf')]['message']);return _0x32b48d(_0x1c33a2[_0x46df('0xf')][_0x46df('0x10')]);}else{logger[_0x46df('0xb')](_0x46df('0xc'),_0x4e0844,'request\x20sent');_0x32b48d(_0x1c33a2[_0x46df('0x11')]['message']);}})[_0x46df('0x12')](function(_0x161d5a){logger[_0x46df('0xf')]('ChatQueue,\x20%s,\x20%s',_0x4e0844,_0x161d5a);_0x1d491e(_0x161d5a);});});}exports[_0x46df('0x13')]=function(_0x155704){var _0x51d6b6=this;return new Promise(function(_0x15956f,_0xc654f){return db[_0x46df('0x14')][_0x46df('0x15')]({'raw':_0x155704[_0x46df('0x16')]?_0x155704[_0x46df('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x155704[_0x46df('0x16')]?_0x155704[_0x46df('0x16')]['where']||null:null,'attributes':_0x155704[_0x46df('0x16')]?_0x155704[_0x46df('0x16')]['attributes']||null:null,'limit':_0x155704['options']?_0x155704[_0x46df('0x16')][_0x46df('0x17')]||null:null,'include':_0x155704[_0x46df('0x16')]?_0x155704[_0x46df('0x16')][_0x46df('0x18')]?_[_0x46df('0x19')](_0x155704['options'][_0x46df('0x18')],function(_0x18abb5){return{'model':db[_0x18abb5[_0x46df('0x1a')]],'as':_0x18abb5['as'],'attributes':_0x18abb5[_0x46df('0x1b')],'include':_0x18abb5['include']?_['map'](_0x18abb5[_0x46df('0x18')],function(_0xfa8cdf){return{'model':db[_0xfa8cdf['model']],'as':_0xfa8cdf['as'],'attributes':_0xfa8cdf['attributes'],'include':_0xfa8cdf['include']?_[_0x46df('0x19')](_0xfa8cdf[_0x46df('0x18')],function(_0x5a6c75){return{'model':db[_0x5a6c75[_0x46df('0x1a')]],'as':_0x5a6c75['as'],'attributes':_0x5a6c75['attributes']};}):[]};}):[]};}):[]:[]})[_0x46df('0x1c')](function(_0x52bed8){logger[_0x46df('0xb')]('GetChatQueue',_0x155704);logger['debug'](_0x46df('0x13'),_0x155704,JSON['stringify'](_0x52bed8));_0x15956f(_0x52bed8);})['catch'](function(_0x70b16a){logger[_0x46df('0xf')](_0x46df('0x13'),_0x70b16a[_0x46df('0x10')],_0x155704);_0xc654f(_0x51d6b6['error'](0x1f4,_0x70b16a[_0x46df('0x10')]));});});};exports['ShowChatQueue']=function(_0x161928){var _0x34f6b0=this;return new Promise(function(_0x4de7da,_0x54ffff){return db[_0x46df('0x14')]['find']({'raw':_0x161928[_0x46df('0x16')]?_0x161928[_0x46df('0x16')][_0x46df('0x1d')]===undefined?!![]:![]:!![],'where':_0x161928['options']?_0x161928[_0x46df('0x16')][_0x46df('0x1e')]||null:null,'attributes':_0x161928['options']?_0x161928[_0x46df('0x16')][_0x46df('0x1b')]||null:null,'include':_0x161928[_0x46df('0x16')]?_0x161928[_0x46df('0x16')]['include']?_[_0x46df('0x19')](_0x161928[_0x46df('0x16')][_0x46df('0x18')],function(_0x5bcf2b){return{'model':db[_0x5bcf2b[_0x46df('0x1a')]],'as':_0x5bcf2b['as'],'attributes':_0x5bcf2b[_0x46df('0x1b')],'include':_0x5bcf2b[_0x46df('0x18')]?_[_0x46df('0x19')](_0x5bcf2b[_0x46df('0x18')],function(_0x582c2b){return{'model':db[_0x582c2b['model']],'as':_0x582c2b['as'],'attributes':_0x582c2b['attributes'],'include':_0x582c2b['include']?_[_0x46df('0x19')](_0x582c2b[_0x46df('0x18')],function(_0x1a32eb){return{'model':db[_0x1a32eb['model']],'as':_0x1a32eb['as'],'attributes':_0x1a32eb[_0x46df('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x46df('0x1c')](function(_0x4cee23){logger[_0x46df('0xb')](_0x46df('0x1f'),_0x161928);logger['debug'](_0x46df('0x1f'),_0x161928,JSON[_0x46df('0xe')](_0x4cee23));_0x4de7da(_0x4cee23);})['catch'](function(_0x1dd351){logger[_0x46df('0xf')](_0x46df('0x1f'),_0x1dd351[_0x46df('0x10')],_0x161928);_0x54ffff(_0x34f6b0[_0x46df('0xf')](0x1f4,_0x1dd351[_0x46df('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9355841..b0fcbd6 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 _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x2b9628,_0xa46d82){var _0x5644ac=function(_0x1b3083){while(--_0x1b3083){_0x2b9628['push'](_0x2b9628['shift']());}};_0x5644ac(++_0xa46d82);}(_0x5636,0x102));var _0x6563=function(_0x1a7277,_0x324513){_0x1a7277=_0x1a7277-0x0;var _0x343bbc=_0x5636[_0x1a7277];return _0x343bbc;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}}; \ No newline at end of file +var _0x22fb=['remove','emit','removeListener','register','length','chatQueue:'];(function(_0x9d69c8,_0x128291){var _0x53181a=function(_0x4e0f10){while(--_0x4e0f10){_0x9d69c8['push'](_0x9d69c8['shift']());}};_0x53181a(++_0x128291);}(_0x22fb,0x192));var _0xb22f=function(_0x1ef4b2,_0x930e58){_0x1ef4b2=_0x1ef4b2-0x0;var _0x624415=_0x22fb[_0x1ef4b2];return _0x624415;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xb22f('0x0'),'update'];function createListener(_0x3f643d,_0x306b6e){return function(_0x2221f1){_0x306b6e[_0xb22f('0x1')](_0x3f643d,_0x2221f1);};}function removeListener(_0x201512,_0x50cdab){return function(){ChatQueueEvents[_0xb22f('0x2')](_0x201512,_0x50cdab);};}exports[_0xb22f('0x3')]=function(_0x2d1fb3){for(var _0xc3ffcc=0x0,_0x412a95=events[_0xb22f('0x4')];_0xc3ffcc<_0x412a95;_0xc3ffcc++){var _0x47f61a=events[_0xc3ffcc];var _0x34433b=createListener(_0xb22f('0x5')+_0x47f61a,_0x2d1fb3);ChatQueueEvents['on'](_0x47f61a,_0x34433b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a580f0f..4a849b9 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x28c480,_0x45467f){var _0x125586=function(_0x18e13c){while(--_0x18e13c){_0x28c480['push'](_0x28c480['shift']());}};_0x125586(++_0x45467f);}(_0xe14b,0x93));var _0xbe14=function(_0x542241,_0x1daa8f){_0x542241=_0x542241-0x0;var _0x35fc8e=_0xe14b[_0x542241];return _0x35fc8e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c85bb,_0x22e053){var _0x5666d5=function(_0xf06350){while(--_0xf06350){_0x4c85bb['push'](_0x4c85bb['shift']());}};_0x5666d5(++_0x22e053);}(_0x008c,0x188));var _0xc008=function(_0x2ea9bb,_0x41a73f){_0x2ea9bb=_0x2ea9bb-0x0;var _0x3f0084=_0x008c[_0x2ea9bb];return _0x3f0084;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7e8ae81..ed8227e 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 _0x639d=['STRING','DATE','moment','sequelize','exports'];(function(_0x2e5684,_0x4da87c){var _0x503984=function(_0x54c8a9){while(--_0x54c8a9){_0x2e5684['push'](_0x2e5684['shift']());}};_0x503984(++_0x4da87c);}(_0x639d,0xbb));var _0xd639=function(_0x2bf7be,_0x259e50){_0x2bf7be=_0x2bf7be-0x0;var _0x4db841=_0x639d[_0x2bf7be];return _0x4db841;};'use strict';var moment=require(_0xd639('0x0'));var Sequelize=require(_0xd639('0x1'));module[_0xd639('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd639('0x3')]},'joinAt':{'type':Sequelize[_0xd639('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd639('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd639('0x3')]}}; \ No newline at end of file +var _0x6c03=['STRING','DATE','moment','sequelize','exports'];(function(_0x5cd394,_0x2c362c){var _0xb48c29=function(_0x26c210){while(--_0x26c210){_0x5cd394['push'](_0x5cd394['shift']());}};_0xb48c29(++_0x2c362c);}(_0x6c03,0xca));var _0x36c0=function(_0x360c64,_0x1c239a){_0x360c64=_0x360c64-0x0;var _0x4e0332=_0x6c03[_0x360c64];return _0x4e0332;};'use strict';var moment=require(_0x36c0('0x0'));var Sequelize=require(_0x36c0('0x1'));module[_0x36c0('0x2')]={'uniqueid':{'type':Sequelize[_0x36c0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x36c0('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x36c0('0x4')]},'exitAt':{'type':Sequelize[_0x36c0('0x4')]},'reason':{'type':Sequelize[_0x36c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f05b1a7..c94ee5a 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 _0x869e=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueueReport','includeAll','findAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x869e,0x15c));var _0xe869=function(_0x1d078b,_0x29425e){_0x1d078b=_0x1d078b-0x0;var _0xac3d0d=_0x869e[_0x1d078b];return _0xac3d0d;};'use strict';var emlformat=require(_0xe869('0x0'));var rimraf=require(_0xe869('0x1'));var zipdir=require(_0xe869('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe869('0x3'));var moment=require(_0xe869('0x4'));var BPromise=require(_0xe869('0x5'));var Mustache=require(_0xe869('0x6'));var util=require(_0xe869('0x7'));var path=require('path');var sox=require(_0xe869('0x8'));var csv=require(_0xe869('0x9'));var ejs=require(_0xe869('0xa'));var fs=require('fs');var fs_extra=require(_0xe869('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe869('0xc'));var jsforce=require(_0xe869('0xd'));var deskjs=require(_0xe869('0xe'));var toCsv=require(_0xe869('0x9'));var querystring=require(_0xe869('0xf'));var Papa=require(_0xe869('0x10'));var Redis=require(_0xe869('0x11'));var authService=require(_0xe869('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe869('0x13'));var logger=require(_0xe869('0x14'))(_0xe869('0x15'));var utils=require(_0xe869('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe869('0x17'))['db'];function respondWithStatusCode(_0x5a5197,_0x907d3f){_0x907d3f=_0x907d3f||0xcc;return function(_0x412429){if(_0x412429){return _0x5a5197['sendStatus'](_0x907d3f);}return _0x5a5197[_0xe869('0x18')](_0x907d3f)[_0xe869('0x19')]();};}function respondWithResult(_0x3239d1,_0x17ee8f){_0x17ee8f=_0x17ee8f||0xc8;return function(_0x4046e4){if(_0x4046e4){return _0x3239d1['status'](_0x17ee8f)['json'](_0x4046e4);}};}function respondWithFilteredResult(_0x52fd40,_0x262f2f){return function(_0x4ed173){if(_0x4ed173){var _0x201091=typeof _0x262f2f[_0xe869('0x1a')]===_0xe869('0x1b')&&typeof _0x262f2f['limit']===_0xe869('0x1b');var _0x10f5e1=_0x4ed173['count'];var _0x33f5a7=_0x201091?0x0:_0x262f2f['offset'];var _0x26c67c=_0x201091?_0x4ed173[_0xe869('0x1c')]:_0x262f2f['offset']+_0x262f2f['limit'];var _0x40692c;if(_0x26c67c>=_0x10f5e1){_0x26c67c=_0x10f5e1;_0x40692c=0xc8;}else{_0x40692c=0xce;}_0x52fd40['status'](_0x40692c);return _0x52fd40[_0xe869('0x1d')](_0xe869('0x1e'),_0x33f5a7+'-'+_0x26c67c+'/'+_0x10f5e1)[_0xe869('0x1f')](_0x4ed173);}return null;};}function patchUpdates(_0x3e8c47){return function(_0x171c18){try{jsonpatch[_0xe869('0x20')](_0x171c18,_0x3e8c47,!![]);}catch(_0xa13c53){return BPromise[_0xe869('0x21')](_0xa13c53);}return _0x171c18[_0xe869('0x22')]();};}function saveUpdates(_0x10de1e,_0x59e73f){return function(_0x1a30e8){if(_0x1a30e8){return _0x1a30e8[_0xe869('0x23')](_0x10de1e)[_0xe869('0x24')](function(_0x342640){return _0x342640;});}return null;};}function removeEntity(_0x9c22cd,_0x4ddc31){return function(_0x429301){if(_0x429301){return _0x429301[_0xe869('0x25')]()[_0xe869('0x24')](function(){_0x9c22cd[_0xe869('0x18')](0xcc)[_0xe869('0x19')]();});}};}function handleEntityNotFound(_0x42320b,_0x311be8){return function(_0x44efa3){if(!_0x44efa3){_0x42320b[_0xe869('0x26')](0x194);}return _0x44efa3;};}function handleError(_0x30df68,_0x2775bc){_0x2775bc=_0x2775bc||0x1f4;return function(_0x31fec7){logger[_0xe869('0x27')](_0x31fec7['stack']);if(_0x31fec7[_0xe869('0x28')]){delete _0x31fec7[_0xe869('0x28')];}_0x30df68[_0xe869('0x18')](_0x2775bc)[_0xe869('0x29')](_0x31fec7);};}exports[_0xe869('0x2a')]=function(_0x22a823,_0x4f0e7f){var _0x367969={},_0x3f3574={},_0x57e22c={'count':0x0,'rows':[]};var _0x558c32=_[_0xe869('0x2b')](db['ChatQueueReport'][_0xe869('0x2c')],function(_0x4ed370){return{'name':_0x4ed370['fieldName'],'type':_0x4ed370[_0xe869('0x2d')][_0xe869('0x2e')]};});_0x3f3574[_0xe869('0x2f')]=_['map'](_0x558c32,_0xe869('0x28'));_0x3f3574['query']=_[_0xe869('0x30')](_0x22a823[_0xe869('0x31')]);_0x3f3574[_0xe869('0x32')]=_[_0xe869('0x33')](_0x3f3574[_0xe869('0x2f')],_0x3f3574[_0xe869('0x31')]);_0x367969[_0xe869('0x34')]=_['intersection'](_0x3f3574[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x22a823[_0xe869('0x31')]['fields']));_0x367969['attributes']=_0x367969[_0xe869('0x34')]['length']?_0x367969['attributes']:_0x3f3574[_0xe869('0x2f')];if(!_0x22a823[_0xe869('0x31')]['hasOwnProperty'](_0xe869('0x36'))){_0x367969[_0xe869('0x37')]=qs[_0xe869('0x37')](_0x22a823[_0xe869('0x31')]['limit']);_0x367969[_0xe869('0x1a')]=qs[_0xe869('0x1a')](_0x22a823[_0xe869('0x31')]['offset']);}_0x367969[_0xe869('0x38')]=qs[_0xe869('0x39')](_0x22a823['query'][_0xe869('0x39')]);_0x367969[_0xe869('0x3a')]=qs['filters'](_[_0xe869('0x3b')](_0x22a823['query'],_0x3f3574[_0xe869('0x32')]),_0x558c32);if(_0x22a823[_0xe869('0x31')]['filter']){_0x367969[_0xe869('0x3a')]=_[_0xe869('0x3c')](_0x367969[_0xe869('0x3a')],{'$or':_[_0xe869('0x2b')](_0x558c32,function(_0x15502e){if(_0x15502e['type']!==_0xe869('0x3d')){var _0xee8898={};_0xee8898[_0x15502e[_0xe869('0x28')]]={'$like':'%'+_0x22a823['query'][_0xe869('0x3e')]+'%'};return _0xee8898;}})});}_0x367969=_[_0xe869('0x3c')]({},_0x367969,_0x22a823[_0xe869('0x3f')]);var _0x3bf052={'where':_0x367969[_0xe869('0x3a')]};return db[_0xe869('0x40')]['count'](_0x3bf052)[_0xe869('0x24')](function(_0x3352a7){_0x57e22c[_0xe869('0x1c')]=_0x3352a7;if(_0x22a823['query'][_0xe869('0x41')]){_0x367969['include']=[{'all':!![]}];}return db[_0xe869('0x40')][_0xe869('0x42')](_0x367969);})[_0xe869('0x24')](function(_0x14398a){_0x57e22c['rows']=_0x14398a;return _0x57e22c;})[_0xe869('0x24')](respondWithFilteredResult(_0x4f0e7f,_0x367969))[_0xe869('0x43')](handleError(_0x4f0e7f,null));};exports['show']=function(_0x1e550e,_0x3d55df){var _0x26ebd8={'raw':!![],'where':{'id':_0x1e550e[_0xe869('0x44')]['id']}},_0x4130a6={};_0x4130a6[_0xe869('0x2f')]=_['keys'](db[_0xe869('0x40')]['rawAttributes']);_0x4130a6[_0xe869('0x31')]=_[_0xe869('0x30')](_0x1e550e[_0xe869('0x31')]);_0x4130a6[_0xe869('0x32')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],_0x4130a6[_0xe869('0x31')]);_0x26ebd8[_0xe869('0x34')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x1e550e[_0xe869('0x31')][_0xe869('0x35')]));_0x26ebd8[_0xe869('0x34')]=_0x26ebd8['attributes'][_0xe869('0x45')]?_0x26ebd8[_0xe869('0x34')]:_0x4130a6['model'];if(_0x1e550e[_0xe869('0x31')]['includeAll']){_0x26ebd8[_0xe869('0x46')]=[{'all':!![]}];}_0x26ebd8=_[_0xe869('0x3c')]({},_0x26ebd8,_0x1e550e[_0xe869('0x3f')]);return db[_0xe869('0x40')][_0xe869('0x47')](_0x26ebd8)[_0xe869('0x24')](handleEntityNotFound(_0x3d55df,null))[_0xe869('0x24')](respondWithResult(_0x3d55df,null))[_0xe869('0x43')](handleError(_0x3d55df,null));};exports[_0xe869('0x48')]=function(_0x39e5e9,_0x5d5349){return db[_0xe869('0x40')][_0xe869('0x48')](_0x39e5e9[_0xe869('0x49')],{})[_0xe869('0x24')](respondWithResult(_0x5d5349,0xc9))[_0xe869('0x43')](handleError(_0x5d5349,null));};exports[_0xe869('0x23')]=function(_0x5aa2b5,_0x1976c0){if(_0x5aa2b5['body']['id']){delete _0x5aa2b5[_0xe869('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5aa2b5[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x1976c0,null))['then'](saveUpdates(_0x5aa2b5[_0xe869('0x49')],null))[_0xe869('0x24')](respondWithResult(_0x1976c0,null))[_0xe869('0x43')](handleError(_0x1976c0,null));};exports[_0xe869('0x25')]=function(_0x2acfee,_0x59bae1){return db['ChatQueueReport']['find']({'where':{'id':_0x2acfee[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x59bae1,null))[_0xe869('0x24')](removeEntity(_0x59bae1,null))[_0xe869('0x43')](handleError(_0x59bae1,null));};exports['describe']=function(_0x98ee8f,_0x5ec184){return db[_0xe869('0x40')][_0xe869('0x4a')]()[_0xe869('0x24')](respondWithResult(_0x5ec184,null))[_0xe869('0x43')](handleError(_0x5ec184,null));}; \ No newline at end of file +var _0x0eb2=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','error','stack','name','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','find','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs'];(function(_0x23a971,_0x70b461){var _0x36c6d3=function(_0x3ccc4e){while(--_0x3ccc4e){_0x23a971['push'](_0x23a971['shift']());}};_0x36c6d3(++_0x70b461);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3957a6,_0x338f80){_0x3957a6=_0x3957a6-0x0;var _0x56525c=_0x0eb2[_0x3957a6];return _0x56525c;};'use strict';var emlformat=require(_0x20eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20eb('0x1'));var jsonpatch=require(_0x20eb('0x2'));var rp=require(_0x20eb('0x3'));var moment=require(_0x20eb('0x4'));var BPromise=require(_0x20eb('0x5'));var Mustache=require('mustache');var util=require(_0x20eb('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20eb('0x7'));var fs=require('fs');var fs_extra=require(_0x20eb('0x8'));var _=require(_0x20eb('0x9'));var squel=require('squel');var crypto=require(_0x20eb('0xa'));var jsforce=require(_0x20eb('0xb'));var deskjs=require(_0x20eb('0xc'));var toCsv=require(_0x20eb('0xd'));var querystring=require(_0x20eb('0xe'));var Papa=require(_0x20eb('0xf'));var Redis=require(_0x20eb('0x10'));var authService=require(_0x20eb('0x11'));var qs=require(_0x20eb('0x12'));var as=require(_0x20eb('0x13'));var hardwareService=require(_0x20eb('0x14'));var logger=require(_0x20eb('0x15'))(_0x20eb('0x16'));var utils=require(_0x20eb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x20eb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120651,_0x5371a8){_0x5371a8=_0x5371a8||0xcc;return function(_0x2ffef9){if(_0x2ffef9){return _0x120651[_0x20eb('0x19')](_0x5371a8);}return _0x120651[_0x20eb('0x1a')](_0x5371a8)[_0x20eb('0x1b')]();};}function respondWithResult(_0xfee98d,_0xa548eb){_0xa548eb=_0xa548eb||0xc8;return function(_0x4160b2){if(_0x4160b2){return _0xfee98d[_0x20eb('0x1a')](_0xa548eb)[_0x20eb('0x1c')](_0x4160b2);}};}function respondWithFilteredResult(_0x45473f,_0x155545){return function(_0x11b1cc){if(_0x11b1cc){var _0x150704=typeof _0x155545[_0x20eb('0x1d')]===_0x20eb('0x1e')&&typeof _0x155545['limit']===_0x20eb('0x1e');var _0x579270=_0x11b1cc[_0x20eb('0x1f')];var _0x21765e=_0x150704?0x0:_0x155545[_0x20eb('0x1d')];var _0x3c083a=_0x150704?_0x11b1cc[_0x20eb('0x1f')]:_0x155545[_0x20eb('0x1d')]+_0x155545[_0x20eb('0x20')];var _0x51eb8d;if(_0x3c083a>=_0x579270){_0x3c083a=_0x579270;_0x51eb8d=0xc8;}else{_0x51eb8d=0xce;}_0x45473f[_0x20eb('0x1a')](_0x51eb8d);return _0x45473f[_0x20eb('0x21')]('Content-Range',_0x21765e+'-'+_0x3c083a+'/'+_0x579270)[_0x20eb('0x1c')](_0x11b1cc);}return null;};}function patchUpdates(_0x3eb2be){return function(_0x5d5d8d){try{jsonpatch[_0x20eb('0x22')](_0x5d5d8d,_0x3eb2be,!![]);}catch(_0x1c7853){return BPromise[_0x20eb('0x23')](_0x1c7853);}return _0x5d5d8d['save']();};}function saveUpdates(_0x989b4,_0x258a64){return function(_0x431f82){if(_0x431f82){return _0x431f82['update'](_0x989b4)[_0x20eb('0x24')](function(_0x15bac3){return _0x15bac3;});}return null;};}function removeEntity(_0x22350d,_0x5dc978){return function(_0x2a1b56){if(_0x2a1b56){return _0x2a1b56['destroy']()[_0x20eb('0x24')](function(){_0x22350d[_0x20eb('0x1a')](0xcc)[_0x20eb('0x1b')]();});}};}function handleEntityNotFound(_0x3b88b3,_0x2e88d6){return function(_0x391739){if(!_0x391739){_0x3b88b3[_0x20eb('0x19')](0x194);}return _0x391739;};}function handleError(_0x1adb65,_0x4256ca){_0x4256ca=_0x4256ca||0x1f4;return function(_0x58b8c3){logger[_0x20eb('0x25')](_0x58b8c3[_0x20eb('0x26')]);if(_0x58b8c3[_0x20eb('0x27')]){delete _0x58b8c3['name'];}_0x1adb65['status'](_0x4256ca)['send'](_0x58b8c3);};}exports['index']=function(_0x42455f,_0xd3592a){var _0x53c0f0={},_0x155752={},_0x50b08d={'count':0x0,'rows':[]};var _0x4547d6=_['map'](db['ChatQueueReport'][_0x20eb('0x28')],function(_0x3999ec){return{'name':_0x3999ec['fieldName'],'type':_0x3999ec['type'][_0x20eb('0x29')]};});_0x155752[_0x20eb('0x2a')]=_['map'](_0x4547d6,_0x20eb('0x27'));_0x155752[_0x20eb('0x2b')]=_['keys'](_0x42455f[_0x20eb('0x2b')]);_0x155752[_0x20eb('0x2c')]=_['intersection'](_0x155752[_0x20eb('0x2a')],_0x155752['query']);_0x53c0f0[_0x20eb('0x2d')]=_[_0x20eb('0x2e')](_0x155752[_0x20eb('0x2a')],qs['fields'](_0x42455f[_0x20eb('0x2b')][_0x20eb('0x2f')]));_0x53c0f0[_0x20eb('0x2d')]=_0x53c0f0[_0x20eb('0x2d')]['length']?_0x53c0f0[_0x20eb('0x2d')]:_0x155752[_0x20eb('0x2a')];if(!_0x42455f[_0x20eb('0x2b')][_0x20eb('0x30')](_0x20eb('0x31'))){_0x53c0f0[_0x20eb('0x20')]=qs[_0x20eb('0x20')](_0x42455f[_0x20eb('0x2b')][_0x20eb('0x20')]);_0x53c0f0[_0x20eb('0x1d')]=qs[_0x20eb('0x1d')](_0x42455f['query'][_0x20eb('0x1d')]);}_0x53c0f0[_0x20eb('0x32')]=qs[_0x20eb('0x33')](_0x42455f[_0x20eb('0x2b')]['sort']);_0x53c0f0[_0x20eb('0x34')]=qs[_0x20eb('0x2c')](_[_0x20eb('0x35')](_0x42455f['query'],_0x155752[_0x20eb('0x2c')]),_0x4547d6);if(_0x42455f[_0x20eb('0x2b')][_0x20eb('0x36')]){_0x53c0f0[_0x20eb('0x34')]=_[_0x20eb('0x37')](_0x53c0f0[_0x20eb('0x34')],{'$or':_[_0x20eb('0x38')](_0x4547d6,function(_0x44eb8b){if(_0x44eb8b[_0x20eb('0x39')]!==_0x20eb('0x3a')){var _0x588837={};_0x588837[_0x44eb8b[_0x20eb('0x27')]]={'$like':'%'+_0x42455f['query'][_0x20eb('0x36')]+'%'};return _0x588837;}})});}_0x53c0f0=_[_0x20eb('0x37')]({},_0x53c0f0,_0x42455f[_0x20eb('0x3b')]);var _0x341f62={'where':_0x53c0f0[_0x20eb('0x34')]};return db[_0x20eb('0x3c')][_0x20eb('0x1f')](_0x341f62)[_0x20eb('0x24')](function(_0x1dc004){_0x50b08d['count']=_0x1dc004;if(_0x42455f[_0x20eb('0x2b')]['includeAll']){_0x53c0f0[_0x20eb('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x20eb('0x3e')](_0x53c0f0);})[_0x20eb('0x24')](function(_0x565f6b){_0x50b08d[_0x20eb('0x3f')]=_0x565f6b;return _0x50b08d;})[_0x20eb('0x24')](respondWithFilteredResult(_0xd3592a,_0x53c0f0))[_0x20eb('0x40')](handleError(_0xd3592a,null));};exports[_0x20eb('0x41')]=function(_0x363138,_0xb9b902){var _0x3c9020={'raw':!![],'where':{'id':_0x363138[_0x20eb('0x42')]['id']}},_0x8fb3af={};_0x8fb3af[_0x20eb('0x2a')]=_[_0x20eb('0x43')](db[_0x20eb('0x3c')][_0x20eb('0x28')]);_0x8fb3af[_0x20eb('0x2b')]=_[_0x20eb('0x43')](_0x363138[_0x20eb('0x2b')]);_0x8fb3af[_0x20eb('0x2c')]=_[_0x20eb('0x2e')](_0x8fb3af[_0x20eb('0x2a')],_0x8fb3af['query']);_0x3c9020[_0x20eb('0x2d')]=_[_0x20eb('0x2e')](_0x8fb3af[_0x20eb('0x2a')],qs[_0x20eb('0x2f')](_0x363138[_0x20eb('0x2b')]['fields']));_0x3c9020[_0x20eb('0x2d')]=_0x3c9020[_0x20eb('0x2d')]['length']?_0x3c9020[_0x20eb('0x2d')]:_0x8fb3af['model'];if(_0x363138[_0x20eb('0x2b')][_0x20eb('0x44')]){_0x3c9020[_0x20eb('0x3d')]=[{'all':!![]}];}_0x3c9020=_[_0x20eb('0x37')]({},_0x3c9020,_0x363138['options']);return db[_0x20eb('0x3c')][_0x20eb('0x45')](_0x3c9020)[_0x20eb('0x24')](handleEntityNotFound(_0xb9b902,null))['then'](respondWithResult(_0xb9b902,null))[_0x20eb('0x40')](handleError(_0xb9b902,null));};exports['create']=function(_0x27bd65,_0xeb35d9){return db[_0x20eb('0x3c')]['create'](_0x27bd65[_0x20eb('0x46')],{})[_0x20eb('0x24')](respondWithResult(_0xeb35d9,0xc9))[_0x20eb('0x40')](handleError(_0xeb35d9,null));};exports[_0x20eb('0x47')]=function(_0x4aa040,_0xcd25ff){if(_0x4aa040[_0x20eb('0x46')]['id']){delete _0x4aa040[_0x20eb('0x46')]['id'];}return db[_0x20eb('0x3c')][_0x20eb('0x45')]({'where':{'id':_0x4aa040['params']['id']}})[_0x20eb('0x24')](handleEntityNotFound(_0xcd25ff,null))[_0x20eb('0x24')](saveUpdates(_0x4aa040[_0x20eb('0x46')],null))[_0x20eb('0x24')](respondWithResult(_0xcd25ff,null))[_0x20eb('0x40')](handleError(_0xcd25ff,null));};exports['destroy']=function(_0x1ffce3,_0x3faa09){return db[_0x20eb('0x3c')]['find']({'where':{'id':_0x1ffce3[_0x20eb('0x42')]['id']}})[_0x20eb('0x24')](handleEntityNotFound(_0x3faa09,null))[_0x20eb('0x24')](removeEntity(_0x3faa09,null))[_0x20eb('0x40')](handleError(_0x3faa09,null));};exports[_0x20eb('0x48')]=function(_0x3ac919,_0x5bf350){return db[_0x20eb('0x3c')][_0x20eb('0x48')]()['then'](respondWithResult(_0x5bf350,null))[_0x20eb('0x40')](handleError(_0x5bf350,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c5ca20c..2c2d44d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x78a615,_0x5aabaa){var _0x1743bb=function(_0x4b03c6){while(--_0x4b03c6){_0x78a615['push'](_0x78a615['shift']());}};_0x1743bb(++_0x5aabaa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x84b55a,_0x29154a){var _0x47c6ac=function(_0x1312d5){while(--_0x1312d5){_0x84b55a['push'](_0x84b55a['shift']());}};_0x47c6ac(++_0x29154a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb7e7[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5361a58..b45cbcf 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 _0xd908=['code','message','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5c6762,_0x40003d){var _0x120869=function(_0x5bf9c0){while(--_0x5bf9c0){_0x5c6762['push'](_0x5c6762['shift']());}};_0x120869(++_0x40003d);}(_0xd908,0xd4));var _0x8d90=function(_0xc05b2,_0x54fc9c){_0xc05b2=_0xc05b2-0x0;var _0x336ce3=_0xd908[_0xc05b2];return _0x336ce3;};'use strict';var _=require(_0x8d90('0x0'));var util=require(_0x8d90('0x1'));var moment=require(_0x8d90('0x2'));var BPromise=require(_0x8d90('0x3'));var rs=require(_0x8d90('0x4'));var fs=require('fs');var Redis=require(_0x8d90('0x5'));var db=require(_0x8d90('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d90('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d90('0x8')][_0x8d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38f228,_0x2748ae,_0xa74112){return new BPromise(function(_0x469137,_0x162499){return client[_0x8d90('0xa')](_0x38f228,_0xa74112)[_0x8d90('0xb')](function(_0x4dc929){logger[_0x8d90('0xc')](_0x8d90('0xd'),_0x2748ae,'request\x20sent');logger[_0x8d90('0xe')](_0x8d90('0xf'),_0x2748ae,_0x8d90('0x10'),JSON[_0x8d90('0x11')](_0x4dc929));if(_0x4dc929[_0x8d90('0x12')]){if(_0x4dc929[_0x8d90('0x12')][_0x8d90('0x13')]===0x1f4){logger[_0x8d90('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2748ae,_0x4dc929[_0x8d90('0x12')][_0x8d90('0x14')]);return _0x162499(_0x4dc929[_0x8d90('0x12')][_0x8d90('0x14')]);}logger[_0x8d90('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2748ae,_0x4dc929[_0x8d90('0x12')][_0x8d90('0x14')]);return _0x469137(_0x4dc929[_0x8d90('0x12')][_0x8d90('0x14')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x2748ae,_0x8d90('0x10'));_0x469137(_0x4dc929[_0x8d90('0x15')][_0x8d90('0x14')]);}})[_0x8d90('0x16')](function(_0x3ab16d){logger[_0x8d90('0x12')](_0x8d90('0xd'),_0x2748ae,_0x3ab16d);_0x162499(_0x3ab16d);});});}exports[_0x8d90('0x17')]=function(_0x4380c7){var _0x324ccc=this;return new Promise(function(_0x205fb2,_0x23eca9){return db['ChatQueueReport']['create'](_0x4380c7[_0x8d90('0x18')],{'raw':_0x4380c7[_0x8d90('0x19')]?_0x4380c7['options'][_0x8d90('0x1a')]===undefined?!![]:![]:!![]})[_0x8d90('0xb')](function(_0x563bcc){logger[_0x8d90('0xc')]('CreateChatQueueReport',_0x4380c7);logger[_0x8d90('0xe')](_0x8d90('0x17'),_0x4380c7,JSON[_0x8d90('0x11')](_0x563bcc));_0x205fb2(_0x563bcc);})[_0x8d90('0x16')](function(_0x3f1e82){logger[_0x8d90('0x12')](_0x8d90('0x17'),_0x3f1e82[_0x8d90('0x14')],_0x4380c7);_0x23eca9(_0x324ccc[_0x8d90('0x12')](0x1f4,_0x3f1e82[_0x8d90('0x14')]));});});};exports[_0x8d90('0x1b')]=function(_0x39c23d){var _0x336c23=this;return new Promise(function(_0x1d7caa,_0x32dc6d){return db[_0x8d90('0x1c')][_0x8d90('0x1d')](_0x39c23d['body'],{'raw':_0x39c23d[_0x8d90('0x19')]?_0x39c23d[_0x8d90('0x19')][_0x8d90('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39c23d[_0x8d90('0x19')]?_0x39c23d[_0x8d90('0x19')][_0x8d90('0x1e')]||null:null,'attributes':_0x39c23d[_0x8d90('0x19')]?_0x39c23d[_0x8d90('0x19')][_0x8d90('0x1f')]||null:null,'limit':_0x39c23d[_0x8d90('0x19')]?_0x39c23d[_0x8d90('0x19')][_0x8d90('0x20')]||null:null})[_0x8d90('0xb')](function(_0x442c24){logger[_0x8d90('0xc')](_0x8d90('0x1b'),_0x39c23d);logger['debug']('UpdateChatQueueReport',_0x39c23d,JSON[_0x8d90('0x11')](_0x442c24));_0x1d7caa(_0x442c24);})[_0x8d90('0x16')](function(_0x425577){logger[_0x8d90('0x12')](_0x8d90('0x1b'),_0x425577['message'],_0x39c23d);_0x32dc6d(_0x336c23[_0x8d90('0x12')](0x1f4,_0x425577[_0x8d90('0x14')]));});});}; \ No newline at end of file +var _0x4f0c=['CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0x4f0c,0x117));var _0xc4f0=function(_0xb52378,_0x3c30bb){_0xb52378=_0xb52378-0x0;var _0x14082e=_0x4f0c[_0xb52378];return _0x14082e;};'use strict';var _=require(_0xc4f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4f0('0x1'));var rs=require(_0xc4f0('0x2'));var fs=require('fs');var Redis=require(_0xc4f0('0x3'));var db=require(_0xc4f0('0x4'))['db'];var utils=require(_0xc4f0('0x5'));var logger=require(_0xc4f0('0x6'))(_0xc4f0('0x7'));var config=require(_0xc4f0('0x8'));var jayson=require(_0xc4f0('0x9'));var client=jayson[_0xc4f0('0xa')][_0xc4f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x73c546,_0x4eedbf,_0x4a0a2a){return new BPromise(function(_0x37405f,_0x3fa153){return client['request'](_0x73c546,_0x4a0a2a)[_0xc4f0('0xc')](function(_0x20aba0){logger[_0xc4f0('0xd')](_0xc4f0('0xe'),_0x4eedbf,_0xc4f0('0xf'));logger[_0xc4f0('0x10')](_0xc4f0('0x11'),_0x4eedbf,_0xc4f0('0xf'),JSON[_0xc4f0('0x12')](_0x20aba0));if(_0x20aba0[_0xc4f0('0x13')]){if(_0x20aba0[_0xc4f0('0x13')][_0xc4f0('0x14')]===0x1f4){logger[_0xc4f0('0x13')](_0xc4f0('0xe'),_0x4eedbf,_0x20aba0['error']['message']);return _0x3fa153(_0x20aba0[_0xc4f0('0x13')][_0xc4f0('0x15')]);}logger['error'](_0xc4f0('0xe'),_0x4eedbf,_0x20aba0['error'][_0xc4f0('0x15')]);return _0x37405f(_0x20aba0[_0xc4f0('0x13')][_0xc4f0('0x15')]);}else{logger[_0xc4f0('0xd')](_0xc4f0('0xe'),_0x4eedbf,_0xc4f0('0xf'));_0x37405f(_0x20aba0[_0xc4f0('0x16')][_0xc4f0('0x15')]);}})[_0xc4f0('0x17')](function(_0x4fb778){logger[_0xc4f0('0x13')](_0xc4f0('0xe'),_0x4eedbf,_0x4fb778);_0x3fa153(_0x4fb778);});});}exports['CreateChatQueueReport']=function(_0x54782b){var _0x255f27=this;return new Promise(function(_0x4812d9,_0x90869c){return db['ChatQueueReport'][_0xc4f0('0x18')](_0x54782b[_0xc4f0('0x19')],{'raw':_0x54782b[_0xc4f0('0x1a')]?_0x54782b[_0xc4f0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc4f0('0xc')](function(_0xd6004f){logger[_0xc4f0('0xd')](_0xc4f0('0x1b'),_0x54782b);logger[_0xc4f0('0x10')]('CreateChatQueueReport',_0x54782b,JSON[_0xc4f0('0x12')](_0xd6004f));_0x4812d9(_0xd6004f);})[_0xc4f0('0x17')](function(_0x11d201){logger[_0xc4f0('0x13')](_0xc4f0('0x1b'),_0x11d201[_0xc4f0('0x15')],_0x54782b);_0x90869c(_0x255f27['error'](0x1f4,_0x11d201[_0xc4f0('0x15')]));});});};exports[_0xc4f0('0x1c')]=function(_0x3d1ad1){var _0x59733c=this;return new Promise(function(_0x2815be,_0x2a89df){return db[_0xc4f0('0x1d')][_0xc4f0('0x1e')](_0x3d1ad1['body'],{'raw':_0x3d1ad1['options']?_0x3d1ad1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d1ad1[_0xc4f0('0x1a')]?_0x3d1ad1[_0xc4f0('0x1a')][_0xc4f0('0x1f')]||null:null,'attributes':_0x3d1ad1[_0xc4f0('0x1a')]?_0x3d1ad1['options'][_0xc4f0('0x20')]||null:null,'limit':_0x3d1ad1[_0xc4f0('0x1a')]?_0x3d1ad1['options'][_0xc4f0('0x21')]||null:null})[_0xc4f0('0xc')](function(_0xf7d22a){logger[_0xc4f0('0xd')](_0xc4f0('0x1c'),_0x3d1ad1);logger[_0xc4f0('0x10')]('UpdateChatQueueReport',_0x3d1ad1,JSON[_0xc4f0('0x12')](_0xf7d22a));_0x2815be(_0xf7d22a);})[_0xc4f0('0x17')](function(_0x44098c){logger[_0xc4f0('0x13')](_0xc4f0('0x1c'),_0x44098c[_0xc4f0('0x15')],_0x3d1ad1);_0x2a89df(_0x59733c[_0xc4f0('0x13')](0x1f4,_0x44098c[_0xc4f0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 52f59e0..fcb2476 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 _0xe91c=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe91c,0x1e8));var _0xce91=function(_0x135be7,_0x84b39f){_0x135be7=_0x135be7-0x0;var _0x1f5010=_0xe91c[_0x135be7];return _0x1f5010;};'use strict';var multer=require(_0xce91('0x0'));var util=require(_0xce91('0x1'));var path=require('path');var timeout=require(_0xce91('0x2'));var express=require('express');var router=express[_0xce91('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce91('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce91('0x5'));var controller=require(_0xce91('0x6'));router[_0xce91('0x7')]('/',auth[_0xce91('0x8')](),controller[_0xce91('0x9')]);router[_0xce91('0x7')](_0xce91('0xa'),auth[_0xce91('0x8')](),controller[_0xce91('0xb')]);router[_0xce91('0x7')]('/:id',auth[_0xce91('0x8')](),controller[_0xce91('0xc')]);router[_0xce91('0xd')]('/',auth[_0xce91('0x8')](),controller['create']);router['put'](_0xce91('0xe'),auth[_0xce91('0x8')](),controller[_0xce91('0xf')]);router[_0xce91('0x10')](_0xce91('0xe'),auth['isAuthenticated'](),controller[_0xce91('0x11')]);module[_0xce91('0x12')]=router; \ No newline at end of file +var _0x49c4=['isAuthenticated','show','create','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','describe','/:id'];(function(_0x57a2a6,_0x3d21b2){var _0x74724a=function(_0x5918cc){while(--_0x5918cc){_0x57a2a6['push'](_0x57a2a6['shift']());}};_0x74724a(++_0x3d21b2);}(_0x49c4,0xaf));var _0x449c=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x49c4[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0x449c('0x0'));var util=require(_0x449c('0x1'));var path=require(_0x449c('0x2'));var timeout=require(_0x449c('0x3'));var express=require(_0x449c('0x4'));var router=express[_0x449c('0x5')]();var fs_extra=require(_0x449c('0x6'));var auth=require(_0x449c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x449c('0x8'));var controller=require(_0x449c('0x9'));router[_0x449c('0xa')]('/',auth['isAuthenticated'](),controller[_0x449c('0xb')]);router[_0x449c('0xa')](_0x449c('0xc'),auth['isAuthenticated'](),controller[_0x449c('0xd')]);router[_0x449c('0xa')](_0x449c('0xe'),auth[_0x449c('0xf')](),controller[_0x449c('0x10')]);router['post']('/',auth[_0x449c('0xf')](),controller[_0x449c('0x11')]);router['put'](_0x449c('0xe'),auth[_0x449c('0xf')](),controller['update']);router[_0x449c('0x12')](_0x449c('0xe'),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 c801ea4..6de6ab2 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5301fc,_0x23f122){var _0x16ea0d=function(_0x28a0c5){while(--_0x28a0c5){_0x5301fc['push'](_0x5301fc['shift']());}};_0x16ea0d(++_0x23f122);}(_0xedd9,0xfc));var _0x9edd=function(_0x184e9a,_0x5e1e34){_0x184e9a=_0x184e9a-0x0;var _0x3af201=_0xedd9[_0x184e9a];return _0x3af201;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x6408f,_0x4e07f4){var _0x4601a9=function(_0x595f6c){while(--_0x595f6c){_0x6408f['push'](_0x6408f['shift']());}};_0x4601a9(++_0x4e07f4);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xf3cd[_0x511bd1];return _0x4c48ec;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 3ebba36..c50d49e 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 _0xa866=['destroy','then','stack','name','send','map','ChatTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','where','merge','count','include','findAll','rows','catch','show','params','length','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','update'];(function(_0x824b1,_0x2c635b){var _0x51d3b8=function(_0x2aa673){while(--_0x2aa673){_0x824b1['push'](_0x824b1['shift']());}};_0x51d3b8(++_0x2c635b);}(_0xa866,0x6a));var _0x6a86=function(_0x11e0d9,_0x1ad835){_0x11e0d9=_0x11e0d9-0x0;var _0x478d68=_0xa866[_0x11e0d9];return _0x478d68;};'use strict';var emlformat=require(_0x6a86('0x0'));var rimraf=require(_0x6a86('0x1'));var zipdir=require(_0x6a86('0x2'));var jsonpatch=require(_0x6a86('0x3'));var rp=require(_0x6a86('0x4'));var moment=require('moment');var BPromise=require(_0x6a86('0x5'));var Mustache=require(_0x6a86('0x6'));var util=require(_0x6a86('0x7'));var path=require('path');var sox=require(_0x6a86('0x8'));var csv=require(_0x6a86('0x9'));var ejs=require(_0x6a86('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a86('0xb'));var squel=require(_0x6a86('0xc'));var crypto=require(_0x6a86('0xd'));var jsforce=require(_0x6a86('0xe'));var deskjs=require(_0x6a86('0xf'));var toCsv=require(_0x6a86('0x9'));var querystring=require(_0x6a86('0x10'));var Papa=require(_0x6a86('0x11'));var Redis=require(_0x6a86('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6a86('0x13'));var as=require(_0x6a86('0x14'));var hardwareService=require(_0x6a86('0x15'));var logger=require('../../config/logger')(_0x6a86('0x16'));var utils=require(_0x6a86('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a86('0x18'))['db'];function respondWithStatusCode(_0x3c4753,_0x32f657){_0x32f657=_0x32f657||0xcc;return function(_0x3961f6){if(_0x3961f6){return _0x3c4753[_0x6a86('0x19')](_0x32f657);}return _0x3c4753[_0x6a86('0x1a')](_0x32f657)[_0x6a86('0x1b')]();};}function respondWithResult(_0xa6b07a,_0x5025ff){_0x5025ff=_0x5025ff||0xc8;return function(_0x1e9ba4){if(_0x1e9ba4){return _0xa6b07a[_0x6a86('0x1a')](_0x5025ff)['json'](_0x1e9ba4);}};}function respondWithFilteredResult(_0x2f084b,_0x41e4c8){return function(_0x3fe00a){if(_0x3fe00a){var _0x353004=typeof _0x41e4c8[_0x6a86('0x1c')]===_0x6a86('0x1d')&&typeof _0x41e4c8['limit']===_0x6a86('0x1d');var _0xe24416=_0x3fe00a['count'];var _0x50024d=_0x353004?0x0:_0x41e4c8[_0x6a86('0x1c')];var _0x535fd9=_0x353004?_0x3fe00a['count']:_0x41e4c8[_0x6a86('0x1c')]+_0x41e4c8[_0x6a86('0x1e')];var _0x3cbb30;if(_0x535fd9>=_0xe24416){_0x535fd9=_0xe24416;_0x3cbb30=0xc8;}else{_0x3cbb30=0xce;}_0x2f084b['status'](_0x3cbb30);return _0x2f084b[_0x6a86('0x1f')](_0x6a86('0x20'),_0x50024d+'-'+_0x535fd9+'/'+_0xe24416)[_0x6a86('0x21')](_0x3fe00a);}return null;};}function patchUpdates(_0x262bf5){return function(_0x42c7bd){try{jsonpatch[_0x6a86('0x22')](_0x42c7bd,_0x262bf5,!![]);}catch(_0x53e2b6){return BPromise['reject'](_0x53e2b6);}return _0x42c7bd['save']();};}function saveUpdates(_0x1ae50f,_0x2007c7){return function(_0x3d5d26){if(_0x3d5d26){return _0x3d5d26[_0x6a86('0x23')](_0x1ae50f)['then'](function(_0x27a003){return _0x27a003;});}return null;};}function removeEntity(_0x166192,_0x366f4a){return function(_0x3f2b70){if(_0x3f2b70){return _0x3f2b70[_0x6a86('0x24')]()[_0x6a86('0x25')](function(){_0x166192[_0x6a86('0x1a')](0xcc)[_0x6a86('0x1b')]();});}};}function handleEntityNotFound(_0x40e616,_0x5c66bd){return function(_0x5190c9){if(!_0x5190c9){_0x40e616[_0x6a86('0x19')](0x194);}return _0x5190c9;};}function handleError(_0x5afd97,_0x5415e9){_0x5415e9=_0x5415e9||0x1f4;return function(_0x1ff9c8){logger['error'](_0x1ff9c8[_0x6a86('0x26')]);if(_0x1ff9c8[_0x6a86('0x27')]){delete _0x1ff9c8[_0x6a86('0x27')];}_0x5afd97['status'](_0x5415e9)[_0x6a86('0x28')](_0x1ff9c8);};}exports['index']=function(_0x5a77e6,_0x4d8bf0){var _0xeefb79={},_0xab04e4={},_0x14359b={'count':0x0,'rows':[]};var _0x50c746=_[_0x6a86('0x29')](db[_0x6a86('0x2a')][_0x6a86('0x2b')],function(_0x372512){return{'name':_0x372512['fieldName'],'type':_0x372512[_0x6a86('0x2c')]['key']};});_0xab04e4[_0x6a86('0x2d')]=_[_0x6a86('0x29')](_0x50c746,_0x6a86('0x27'));_0xab04e4[_0x6a86('0x2e')]=_[_0x6a86('0x2f')](_0x5a77e6['query']);_0xab04e4[_0x6a86('0x30')]=_[_0x6a86('0x31')](_0xab04e4['model'],_0xab04e4[_0x6a86('0x2e')]);_0xeefb79[_0x6a86('0x32')]=_['intersection'](_0xab04e4[_0x6a86('0x2d')],qs[_0x6a86('0x33')](_0x5a77e6['query']['fields']));_0xeefb79[_0x6a86('0x32')]=_0xeefb79[_0x6a86('0x32')]['length']?_0xeefb79['attributes']:_0xab04e4[_0x6a86('0x2d')];if(!_0x5a77e6['query'][_0x6a86('0x34')]('nolimit')){_0xeefb79[_0x6a86('0x1e')]=qs['limit'](_0x5a77e6[_0x6a86('0x2e')]['limit']);_0xeefb79[_0x6a86('0x1c')]=qs[_0x6a86('0x1c')](_0x5a77e6[_0x6a86('0x2e')][_0x6a86('0x1c')]);}_0xeefb79['order']=qs[_0x6a86('0x35')](_0x5a77e6[_0x6a86('0x2e')][_0x6a86('0x35')]);_0xeefb79['where']=qs[_0x6a86('0x30')](_[_0x6a86('0x36')](_0x5a77e6['query'],_0xab04e4[_0x6a86('0x30')]),_0x50c746);if(_0x5a77e6[_0x6a86('0x2e')]['filter']){_0xeefb79[_0x6a86('0x37')]=_['merge'](_0xeefb79['where'],{'$or':_[_0x6a86('0x29')](_0x50c746,function(_0x5c270b){if(_0x5c270b['type']!=='VIRTUAL'){var _0x1d65d9={};_0x1d65d9[_0x5c270b[_0x6a86('0x27')]]={'$like':'%'+_0x5a77e6['query']['filter']+'%'};return _0x1d65d9;}})});}_0xeefb79=_[_0x6a86('0x38')]({},_0xeefb79,_0x5a77e6['options']);var _0x39b5a1={'where':_0xeefb79['where']};return db[_0x6a86('0x2a')][_0x6a86('0x39')](_0x39b5a1)['then'](function(_0x552be5){_0x14359b['count']=_0x552be5;if(_0x5a77e6[_0x6a86('0x2e')]['includeAll']){_0xeefb79[_0x6a86('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x6a86('0x3b')](_0xeefb79);})[_0x6a86('0x25')](function(_0x414b5b){_0x14359b[_0x6a86('0x3c')]=_0x414b5b;return _0x14359b;})['then'](respondWithFilteredResult(_0x4d8bf0,_0xeefb79))[_0x6a86('0x3d')](handleError(_0x4d8bf0,null));};exports[_0x6a86('0x3e')]=function(_0x4bc4f5,_0x117e6f){var _0x2e2d75={'raw':!![],'where':{'id':_0x4bc4f5[_0x6a86('0x3f')]['id']}},_0x219b10={};_0x219b10[_0x6a86('0x2d')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x219b10['query']=_[_0x6a86('0x2f')](_0x4bc4f5['query']);_0x219b10[_0x6a86('0x30')]=_['intersection'](_0x219b10[_0x6a86('0x2d')],_0x219b10[_0x6a86('0x2e')]);_0x2e2d75[_0x6a86('0x32')]=_[_0x6a86('0x31')](_0x219b10[_0x6a86('0x2d')],qs['fields'](_0x4bc4f5[_0x6a86('0x2e')][_0x6a86('0x33')]));_0x2e2d75['attributes']=_0x2e2d75['attributes'][_0x6a86('0x40')]?_0x2e2d75[_0x6a86('0x32')]:_0x219b10[_0x6a86('0x2d')];if(_0x4bc4f5[_0x6a86('0x2e')][_0x6a86('0x41')]){_0x2e2d75[_0x6a86('0x3a')]=[{'all':!![]}];}_0x2e2d75=_[_0x6a86('0x38')]({},_0x2e2d75,_0x4bc4f5[_0x6a86('0x42')]);return db['ChatTransferReport']['find'](_0x2e2d75)['then'](handleEntityNotFound(_0x117e6f,null))[_0x6a86('0x25')](respondWithResult(_0x117e6f,null))[_0x6a86('0x3d')](handleError(_0x117e6f,null));};exports[_0x6a86('0x43')]=function(_0x173f03,_0x33785c){return db[_0x6a86('0x2a')][_0x6a86('0x43')](_0x173f03[_0x6a86('0x44')],{})[_0x6a86('0x25')](respondWithResult(_0x33785c,0xc9))[_0x6a86('0x3d')](handleError(_0x33785c,null));};exports[_0x6a86('0x23')]=function(_0x3eab11,_0x4a40ed){if(_0x3eab11[_0x6a86('0x44')]['id']){delete _0x3eab11[_0x6a86('0x44')]['id'];}return db[_0x6a86('0x2a')][_0x6a86('0x45')]({'where':{'id':_0x3eab11[_0x6a86('0x3f')]['id']}})[_0x6a86('0x25')](handleEntityNotFound(_0x4a40ed,null))[_0x6a86('0x25')](saveUpdates(_0x3eab11[_0x6a86('0x44')],null))[_0x6a86('0x25')](respondWithResult(_0x4a40ed,null))[_0x6a86('0x3d')](handleError(_0x4a40ed,null));};exports['destroy']=function(_0x2d12a9,_0x58ce40){return db[_0x6a86('0x2a')][_0x6a86('0x45')]({'where':{'id':_0x2d12a9[_0x6a86('0x3f')]['id']}})[_0x6a86('0x25')](handleEntityNotFound(_0x58ce40,null))[_0x6a86('0x25')](removeEntity(_0x58ce40,null))[_0x6a86('0x3d')](handleError(_0x58ce40,null));};exports[_0x6a86('0x46')]=function(_0x435322,_0x154420){return db[_0x6a86('0x2a')][_0x6a86('0x46')]()[_0x6a86('0x25')](respondWithResult(_0x154420,null))['catch'](handleError(_0x154420,null));}; \ No newline at end of file +var _0x120a=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','status','end','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','ChatTransferReport','rawAttributes','find','create','body','describe','eml-format','rimraf'];(function(_0x3cc1d5,_0x2f5bda){var _0x488fcd=function(_0x30a173){while(--_0x30a173){_0x3cc1d5['push'](_0x3cc1d5['shift']());}};_0x488fcd(++_0x2f5bda);}(_0x120a,0x16b));var _0xa120=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0x120a[_0x53f37f];return _0x2fe5f8;};'use strict';var emlformat=require(_0xa120('0x0'));var rimraf=require(_0xa120('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa120('0x2'));var rp=require(_0xa120('0x3'));var moment=require('moment');var BPromise=require(_0xa120('0x4'));var Mustache=require(_0xa120('0x5'));var util=require(_0xa120('0x6'));var path=require('path');var sox=require(_0xa120('0x7'));var csv=require(_0xa120('0x8'));var ejs=require(_0xa120('0x9'));var fs=require('fs');var fs_extra=require(_0xa120('0xa'));var _=require(_0xa120('0xb'));var squel=require('squel');var crypto=require(_0xa120('0xc'));var jsforce=require(_0xa120('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa120('0x8'));var querystring=require(_0xa120('0xe'));var Papa=require('papaparse');var Redis=require(_0xa120('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa120('0x10'));var as=require(_0xa120('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa120('0x12'))(_0xa120('0x13'));var utils=require(_0xa120('0x14'));var config=require(_0xa120('0x15'));var licenseUtil=require(_0xa120('0x16'));var db=require(_0xa120('0x17'))['db'];function respondWithStatusCode(_0x396c20,_0x5cbd8b){_0x5cbd8b=_0x5cbd8b||0xcc;return function(_0x10b832){if(_0x10b832){return _0x396c20[_0xa120('0x18')](_0x5cbd8b);}return _0x396c20['status'](_0x5cbd8b)['end']();};}function respondWithResult(_0xdd35a5,_0x5eef28){_0x5eef28=_0x5eef28||0xc8;return function(_0x44fdaf){if(_0x44fdaf){return _0xdd35a5['status'](_0x5eef28)[_0xa120('0x19')](_0x44fdaf);}};}function respondWithFilteredResult(_0x2d443b,_0x229db5){return function(_0x4d6aee){if(_0x4d6aee){var _0x2c4213=typeof _0x229db5['offset']===_0xa120('0x1a')&&typeof _0x229db5['limit']==='undefined';var _0x42d345=_0x4d6aee[_0xa120('0x1b')];var _0x51c0df=_0x2c4213?0x0:_0x229db5[_0xa120('0x1c')];var _0x20b5ef=_0x2c4213?_0x4d6aee[_0xa120('0x1b')]:_0x229db5[_0xa120('0x1c')]+_0x229db5[_0xa120('0x1d')];var _0x1710a3;if(_0x20b5ef>=_0x42d345){_0x20b5ef=_0x42d345;_0x1710a3=0xc8;}else{_0x1710a3=0xce;}_0x2d443b['status'](_0x1710a3);return _0x2d443b['set'](_0xa120('0x1e'),_0x51c0df+'-'+_0x20b5ef+'/'+_0x42d345)['json'](_0x4d6aee);}return null;};}function patchUpdates(_0x5ea11b){return function(_0x1b9a57){try{jsonpatch[_0xa120('0x1f')](_0x1b9a57,_0x5ea11b,!![]);}catch(_0x48fd0f){return BPromise['reject'](_0x48fd0f);}return _0x1b9a57[_0xa120('0x20')]();};}function saveUpdates(_0x17edac,_0x557914){return function(_0x1fa5ae){if(_0x1fa5ae){return _0x1fa5ae[_0xa120('0x21')](_0x17edac)['then'](function(_0x1e1511){return _0x1e1511;});}return null;};}function removeEntity(_0x3624f8,_0x2e4dff){return function(_0x47b49c){if(_0x47b49c){return _0x47b49c[_0xa120('0x22')]()[_0xa120('0x23')](function(){_0x3624f8[_0xa120('0x24')](0xcc)[_0xa120('0x25')]();});}};}function handleEntityNotFound(_0x5f210f,_0xdd5f0c){return function(_0x1f7aad){if(!_0x1f7aad){_0x5f210f[_0xa120('0x18')](0x194);}return _0x1f7aad;};}function handleError(_0x292aac,_0x31acd1){_0x31acd1=_0x31acd1||0x1f4;return function(_0x18b273){logger['error'](_0x18b273[_0xa120('0x26')]);if(_0x18b273[_0xa120('0x27')]){delete _0x18b273['name'];}_0x292aac[_0xa120('0x24')](_0x31acd1)[_0xa120('0x28')](_0x18b273);};}exports['index']=function(_0x33da46,_0x8ebf08){var _0x3bbba4={},_0x57a3f3={},_0xea5568={'count':0x0,'rows':[]};var _0x4e8243=_[_0xa120('0x29')](db['ChatTransferReport']['rawAttributes'],function(_0x6063e6){return{'name':_0x6063e6[_0xa120('0x2a')],'type':_0x6063e6[_0xa120('0x2b')][_0xa120('0x2c')]};});_0x57a3f3[_0xa120('0x2d')]=_[_0xa120('0x29')](_0x4e8243,'name');_0x57a3f3['query']=_[_0xa120('0x2e')](_0x33da46[_0xa120('0x2f')]);_0x57a3f3[_0xa120('0x30')]=_[_0xa120('0x31')](_0x57a3f3[_0xa120('0x2d')],_0x57a3f3[_0xa120('0x2f')]);_0x3bbba4[_0xa120('0x32')]=_[_0xa120('0x31')](_0x57a3f3[_0xa120('0x2d')],qs[_0xa120('0x33')](_0x33da46[_0xa120('0x2f')]['fields']));_0x3bbba4[_0xa120('0x32')]=_0x3bbba4['attributes'][_0xa120('0x34')]?_0x3bbba4['attributes']:_0x57a3f3[_0xa120('0x2d')];if(!_0x33da46['query'][_0xa120('0x35')](_0xa120('0x36'))){_0x3bbba4[_0xa120('0x1d')]=qs[_0xa120('0x1d')](_0x33da46[_0xa120('0x2f')][_0xa120('0x1d')]);_0x3bbba4[_0xa120('0x1c')]=qs[_0xa120('0x1c')](_0x33da46[_0xa120('0x2f')][_0xa120('0x1c')]);}_0x3bbba4['order']=qs[_0xa120('0x37')](_0x33da46[_0xa120('0x2f')][_0xa120('0x37')]);_0x3bbba4[_0xa120('0x38')]=qs[_0xa120('0x30')](_[_0xa120('0x39')](_0x33da46[_0xa120('0x2f')],_0x57a3f3[_0xa120('0x30')]),_0x4e8243);if(_0x33da46[_0xa120('0x2f')][_0xa120('0x3a')]){_0x3bbba4[_0xa120('0x38')]=_[_0xa120('0x3b')](_0x3bbba4[_0xa120('0x38')],{'$or':_[_0xa120('0x29')](_0x4e8243,function(_0x597800){if(_0x597800[_0xa120('0x2b')]!=='VIRTUAL'){var _0x130b04={};_0x130b04[_0x597800['name']]={'$like':'%'+_0x33da46['query'][_0xa120('0x3a')]+'%'};return _0x130b04;}})});}_0x3bbba4=_['merge']({},_0x3bbba4,_0x33da46[_0xa120('0x3c')]);var _0x4bd6e8={'where':_0x3bbba4[_0xa120('0x38')]};return db['ChatTransferReport'][_0xa120('0x1b')](_0x4bd6e8)['then'](function(_0x4ad27b){_0xea5568[_0xa120('0x1b')]=_0x4ad27b;if(_0x33da46[_0xa120('0x2f')][_0xa120('0x3d')]){_0x3bbba4[_0xa120('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa120('0x3f')](_0x3bbba4);})[_0xa120('0x23')](function(_0x16a249){_0xea5568['rows']=_0x16a249;return _0xea5568;})[_0xa120('0x23')](respondWithFilteredResult(_0x8ebf08,_0x3bbba4))[_0xa120('0x40')](handleError(_0x8ebf08,null));};exports[_0xa120('0x41')]=function(_0x3262bc,_0x4d6492){var _0x1d40ce={'raw':!![],'where':{'id':_0x3262bc[_0xa120('0x42')]['id']}},_0x22be03={};_0x22be03[_0xa120('0x2d')]=_['keys'](db[_0xa120('0x43')][_0xa120('0x44')]);_0x22be03[_0xa120('0x2f')]=_[_0xa120('0x2e')](_0x3262bc['query']);_0x22be03[_0xa120('0x30')]=_[_0xa120('0x31')](_0x22be03[_0xa120('0x2d')],_0x22be03[_0xa120('0x2f')]);_0x1d40ce['attributes']=_[_0xa120('0x31')](_0x22be03[_0xa120('0x2d')],qs[_0xa120('0x33')](_0x3262bc['query']['fields']));_0x1d40ce[_0xa120('0x32')]=_0x1d40ce[_0xa120('0x32')][_0xa120('0x34')]?_0x1d40ce[_0xa120('0x32')]:_0x22be03['model'];if(_0x3262bc[_0xa120('0x2f')]['includeAll']){_0x1d40ce[_0xa120('0x3e')]=[{'all':!![]}];}_0x1d40ce=_[_0xa120('0x3b')]({},_0x1d40ce,_0x3262bc[_0xa120('0x3c')]);return db[_0xa120('0x43')][_0xa120('0x45')](_0x1d40ce)[_0xa120('0x23')](handleEntityNotFound(_0x4d6492,null))[_0xa120('0x23')](respondWithResult(_0x4d6492,null))['catch'](handleError(_0x4d6492,null));};exports[_0xa120('0x46')]=function(_0x2ae177,_0x1a84ee){return db[_0xa120('0x43')][_0xa120('0x46')](_0x2ae177['body'],{})['then'](respondWithResult(_0x1a84ee,0xc9))[_0xa120('0x40')](handleError(_0x1a84ee,null));};exports[_0xa120('0x21')]=function(_0x3162e4,_0x1c0663){if(_0x3162e4[_0xa120('0x47')]['id']){delete _0x3162e4[_0xa120('0x47')]['id'];}return db[_0xa120('0x43')][_0xa120('0x45')]({'where':{'id':_0x3162e4['params']['id']}})['then'](handleEntityNotFound(_0x1c0663,null))[_0xa120('0x23')](saveUpdates(_0x3162e4['body'],null))[_0xa120('0x23')](respondWithResult(_0x1c0663,null))[_0xa120('0x40')](handleError(_0x1c0663,null));};exports['destroy']=function(_0x85d176,_0x31686b){return db['ChatTransferReport'][_0xa120('0x45')]({'where':{'id':_0x85d176[_0xa120('0x42')]['id']}})['then'](handleEntityNotFound(_0x31686b,null))[_0xa120('0x23')](removeEntity(_0x31686b,null))[_0xa120('0x40')](handleError(_0x31686b,null));};exports[_0xa120('0x48')]=function(_0xc716c1,_0x2f3ae5){return db[_0xa120('0x43')][_0xa120('0x48')]()['then'](respondWithResult(_0x2f3ae5,null))[_0xa120('0x40')](handleError(_0x2f3ae5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a623a99..23cd180 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 _0xc475=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x5c89ef,_0x296c7e){var _0x517710=function(_0x4fd0e7){while(--_0x4fd0e7){_0x5c89ef['push'](_0x5c89ef['shift']());}};_0x517710(++_0x296c7e);}(_0xc475,0xe1));var _0x5c47=function(_0x431dc5,_0x489b6d){_0x431dc5=_0x431dc5-0x0;var _0x5f3265=_0xc475[_0x431dc5];return _0x5f3265;};'use strict';var _=require(_0x5c47('0x0'));var util=require(_0x5c47('0x1'));var logger=require(_0x5c47('0x2'))('api');var moment=require(_0x5c47('0x3'));var BPromise=require(_0x5c47('0x4'));var rp=require(_0x5c47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c47('0x6'));var config=require(_0x5c47('0x7'));var attributes=require(_0x5c47('0x8'));module[_0x5c47('0x9')]=function(_0x54e63c,_0x17489d){return _0x54e63c['define'](_0x5c47('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5c47('0xb'),'fields':[_0x5c47('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4113=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x171997,_0x3b890f){var _0x228060=function(_0x5ce335){while(--_0x5ce335){_0x171997['push'](_0x171997['shift']());}};_0x228060(++_0x3b890f);}(_0x4113,0x1c5));var _0x3411=function(_0x8ad570,_0x486faf){_0x8ad570=_0x8ad570-0x0;var _0x454fbb=_0x4113[_0x8ad570];return _0x454fbb;};'use strict';var _=require(_0x3411('0x0'));var util=require(_0x3411('0x1'));var logger=require('../../config/logger')(_0x3411('0x2'));var moment=require('moment');var BPromise=require(_0x3411('0x3'));var rp=require(_0x3411('0x4'));var fs=require('fs');var path=require(_0x3411('0x5'));var rimraf=require(_0x3411('0x6'));var config=require(_0x3411('0x7'));var attributes=require(_0x3411('0x8'));module[_0x3411('0x9')]=function(_0x4575d2,_0x2b0370){return _0x4575d2[_0x3411('0xa')](_0x3411('0xb'),attributes,{'tableName':_0x3411('0xc'),'paranoid':![],'indexes':[{'name':_0x3411('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e431f81..911bc95 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 _0xf258=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/environment','request'];(function(_0x5a922d,_0x22e79f){var _0xa60b33=function(_0x230137){while(--_0x230137){_0x5a922d['push'](_0x5a922d['shift']());}};_0xa60b33(++_0x22e79f);}(_0xf258,0x179));var _0x8f25=function(_0x26bfce,_0xfa6c9d){_0x26bfce=_0x26bfce-0x0;var _0x30e698=_0xf258[_0x26bfce];return _0x30e698;};'use strict';var _=require(_0x8f25('0x0'));var util=require(_0x8f25('0x1'));var moment=require(_0x8f25('0x2'));var BPromise=require(_0x8f25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f25('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8f25('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa4acfe,_0x34900e,_0x39c428){return new BPromise(function(_0x293450,_0x13b036){return client[_0x8f25('0x6')](_0xa4acfe,_0x39c428)[_0x8f25('0x7')](function(_0x46c767){logger[_0x8f25('0x8')](_0x8f25('0x9'),_0x34900e,_0x8f25('0xa'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x34900e,'request\x20sent',JSON[_0x8f25('0xb')](_0x46c767));if(_0x46c767[_0x8f25('0xc')]){if(_0x46c767['error'][_0x8f25('0xd')]===0x1f4){logger[_0x8f25('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x34900e,_0x46c767[_0x8f25('0xc')][_0x8f25('0xe')]);return _0x13b036(_0x46c767['error']['message']);}logger[_0x8f25('0xc')](_0x8f25('0x9'),_0x34900e,_0x46c767[_0x8f25('0xc')][_0x8f25('0xe')]);return _0x293450(_0x46c767[_0x8f25('0xc')][_0x8f25('0xe')]);}else{logger[_0x8f25('0x8')](_0x8f25('0x9'),_0x34900e,_0x8f25('0xa'));_0x293450(_0x46c767['result'][_0x8f25('0xe')]);}})[_0x8f25('0xf')](function(_0x45fcaf){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x34900e,_0x45fcaf);_0x13b036(_0x45fcaf);});});} \ No newline at end of file +var _0xcf88=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x59c142,_0x236d2e){var _0x2a28a6=function(_0x5d366f){while(--_0x5d366f){_0x59c142['push'](_0x59c142['shift']());}};_0x2a28a6(++_0x236d2e);}(_0xcf88,0x136));var _0x8cf8=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcf88[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x8cf8('0x0'));var util=require(_0x8cf8('0x1'));var moment=require(_0x8cf8('0x2'));var BPromise=require(_0x8cf8('0x3'));var rs=require(_0x8cf8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf8('0x5'))['db'];var utils=require(_0x8cf8('0x6'));var logger=require(_0x8cf8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8cf8('0x8'));var client=jayson[_0x8cf8('0x9')][_0x8cf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9f0f,_0xc9e60f,_0x411713){return new BPromise(function(_0x4f5f7e,_0x1243f8){return client[_0x8cf8('0xb')](_0x3f9f0f,_0x411713)['then'](function(_0x185b97){logger[_0x8cf8('0xc')](_0x8cf8('0xd'),_0xc9e60f,_0x8cf8('0xe'));logger[_0x8cf8('0xf')](_0x8cf8('0x10'),_0xc9e60f,'request\x20sent',JSON[_0x8cf8('0x11')](_0x185b97));if(_0x185b97[_0x8cf8('0x12')]){if(_0x185b97['error'][_0x8cf8('0x13')]===0x1f4){logger[_0x8cf8('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0xc9e60f,_0x185b97[_0x8cf8('0x12')][_0x8cf8('0x14')]);return _0x1243f8(_0x185b97[_0x8cf8('0x12')][_0x8cf8('0x14')]);}logger[_0x8cf8('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0xc9e60f,_0x185b97[_0x8cf8('0x12')][_0x8cf8('0x14')]);return _0x4f5f7e(_0x185b97[_0x8cf8('0x12')][_0x8cf8('0x14')]);}else{logger[_0x8cf8('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0xc9e60f,'request\x20sent');_0x4f5f7e(_0x185b97[_0x8cf8('0x15')][_0x8cf8('0x14')]);}})[_0x8cf8('0x16')](function(_0x268a21){logger[_0x8cf8('0x12')](_0x8cf8('0xd'),_0xc9e60f,_0x268a21);_0x1243f8(_0x268a21);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7d7d07b..d345ec8 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 _0xd068=['/describe','describe','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x3a9481,_0x30c7d4){var _0x16e6c3=function(_0x123182){while(--_0x123182){_0x3a9481['push'](_0x3a9481['shift']());}};_0x16e6c3(++_0x30c7d4);}(_0xd068,0xce));var _0x8d06=function(_0x53d0a3,_0x5db7ac){_0x53d0a3=_0x53d0a3-0x0;var _0x225fbd=_0xd068[_0x53d0a3];return _0x225fbd;};'use strict';var multer=require(_0x8d06('0x0'));var util=require(_0x8d06('0x1'));var path=require(_0x8d06('0x2'));var timeout=require(_0x8d06('0x3'));var express=require(_0x8d06('0x4'));var router=express[_0x8d06('0x5')]();var fs_extra=require(_0x8d06('0x6'));var auth=require(_0x8d06('0x7'));var interaction=require(_0x8d06('0x8'));var config=require(_0x8d06('0x9'));var controller=require(_0x8d06('0xa'));router[_0x8d06('0xb')]('/',auth[_0x8d06('0xc')](),controller[_0x8d06('0xd')]);router[_0x8d06('0xb')](_0x8d06('0xe'),auth[_0x8d06('0xc')](),controller[_0x8d06('0xf')]);router['get'](_0x8d06('0x10'),auth['isAuthenticated'](),controller[_0x8d06('0x11')]);router[_0x8d06('0x12')]('/',auth['isAuthenticated'](),controller[_0x8d06('0x13')]);router['put'](_0x8d06('0x10'),auth[_0x8d06('0xc')](),controller['update']);router['delete']('/:id',auth[_0x8d06('0xc')](),controller[_0x8d06('0x14')]);module[_0x8d06('0x15')]=router; \ No newline at end of file +var _0xadec=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x217d51,_0x34ad3f){var _0x26dbcd=function(_0x4ecc26){while(--_0x4ecc26){_0x217d51['push'](_0x217d51['shift']());}};_0x26dbcd(++_0x34ad3f);}(_0xadec,0xd5));var _0xcade=function(_0x11f248,_0x2c19d7){_0x11f248=_0x11f248-0x0;var _0x4cd82e=_0xadec[_0x11f248];return _0x4cd82e;};'use strict';var multer=require(_0xcade('0x0'));var util=require(_0xcade('0x1'));var path=require(_0xcade('0x2'));var timeout=require(_0xcade('0x3'));var express=require(_0xcade('0x4'));var router=express[_0xcade('0x5')]();var fs_extra=require(_0xcade('0x6'));var auth=require(_0xcade('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcade('0x8'));var controller=require(_0xcade('0x9'));router[_0xcade('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcade('0xb'),auth[_0xcade('0xc')](),controller['describe']);router[_0xcade('0xa')]('/:id',auth[_0xcade('0xc')](),controller[_0xcade('0xd')]);router[_0xcade('0xe')]('/',auth[_0xcade('0xc')](),controller[_0xcade('0xf')]);router[_0xcade('0x10')]('/:id',auth[_0xcade('0xc')](),controller[_0xcade('0x11')]);router['delete']('/:id',auth[_0xcade('0xc')](),controller[_0xcade('0x12')]);module[_0xcade('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 95666d4..51a782a 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 _0x978b=['Agent','#011F6A','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','New\x20offline\x20message\x20from\x20websiteName','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x978b,0x11c));var _0xb978=function(_0xa6f743,_0x3615ee){_0xa6f743=_0xa6f743-0x0;var _0x2a4a80=_0x978b[_0xa6f743];return _0x2a4a80;};'use strict';var Sequelize=require(_0xb978('0x0'));var rs=require(_0xb978('0x1'));module['exports']={'name':{'type':Sequelize[_0xb978('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb978('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x4')},'customerAlias':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb978('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb978('0x2')],'allowNull':![],'defaultValue':_0xb978('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb978('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb978('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb978('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb978('0x7')](_0xb978('0x8'),_0xb978('0x9')),'defaultValue':_0xb978('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0xb')},'offline_chat_button':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0xc')},'header_offline':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb978('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xb978('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb978('0xf')]},'closingQuestion':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x12')},'noteTitle':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x13')},'placeholderMessage':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x14')},'closingMessageButton':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0xc')},'skipMessageButton':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x16')},'ratingType':{'type':Sequelize[_0xb978('0x7')](_0xb978('0x17'),_0xb978('0x18')),'defaultValue':_0xb978('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb978('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb978('0x19')]({'items':[{'type':_0xb978('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0xb978('0x1b'),'required':!![]},'props':{'title':_0xb978('0x1c'),'helpText':''}},{'type':_0xb978('0x1a'),'props':{'title':_0xb978('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb978('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb978('0x1d')](_0xb978('0x1e'))?JSON[_0xb978('0x1f')](this[_0xb978('0x1d')](_0xb978('0x1e'))):{};},'set':function(_0x53739d){return this['setDataValue'](_0xb978('0x1e'),JSON[_0xb978('0x19')](_0x53739d));}},'offlineForm':{'type':Sequelize[_0xb978('0xf')],'defaultValue':function(){return JSON[_0xb978('0x19')]({'items':[{'type':_0xb978('0x1a'),'props':{'title':_0xb978('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb978('0x3'),'type':_0xb978('0x3')},'variable':null},{'type':_0xb978('0x20'),'config':{'placeholder':_0xb978('0x21')},'props':{'title':_0xb978('0x21'),'helpText':_0xb978('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xb978('0x1d')](_0xb978('0x23'))?JSON['parse'](this[_0xb978('0x1d')](_0xb978('0x23'))):{};},'set':function(_0x12f70b){return this['setDataValue'](_0xb978('0x23'),JSON[_0xb978('0x19')](_0x12f70b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb978('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x24')},'offlineMessageBody':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xb978('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb978('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0x15')},'sendUnmanaged':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb978('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb978('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb978('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb978('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0x26')},'verticalAlignment':{'type':Sequelize[_0xb978('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb978('0x2')],'defaultValue':_0xb978('0x27')},'defaultTitle':{'type':Sequelize[_0xb978('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb978('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb978('0x2')],'allowNull':![],'defaultValue':_0xb978('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb978('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb978('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb978('0x29')},'systemAvatar':{'type':Sequelize[_0xb978('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb978('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb978('0x2b'),'set':function(_0x23f7bc){if(!_0x23f7bc)this[_0xb978('0x2c')](_0xb978('0x2d'),null);this[_0xb978('0x2c')]('mandatoryDisposition',_0x23f7bc);}},'vidaooEscalation':{'type':Sequelize[_0xb978('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xb978('0x2')],'allowNull':![],'defaultValue':_0xb978('0x2e')},'vidaooNote':{'type':Sequelize[_0xb978('0x2')],'defaultValue':function(){return _0xb978('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb978('0xf')]}}; \ No newline at end of file +var _0xa60c=['sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','thumb','TEXT','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}'];(function(_0x55b633,_0x321e5a){var _0x24c8a2=function(_0xab5c90){while(--_0xab5c90){_0x55b633['push'](_0x55b633['shift']());}};_0x24c8a2(++_0x321e5a);}(_0xa60c,0xa2));var _0xca60=function(_0x5df229,_0x2b7647){_0x5df229=_0x5df229-0x0;var _0x316cdd=_0xa60c[_0x5df229];return _0x316cdd;};'use strict';var Sequelize=require(_0xca60('0x0'));var rs=require(_0xca60('0x1'));module[_0xca60('0x2')]={'name':{'type':Sequelize[_0xca60('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xca60('0x3')],'allowNull':![],'unique':_0xca60('0x4')},'description':{'type':Sequelize[_0xca60('0x3')]},'mapKey':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x5')},'mapKeyOffline':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x5')},'key':{'type':Sequelize[_0xca60('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xca60('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xca60('0x3')],'allowNull':![],'defaultValue':_0xca60('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xca60('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xca60('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xca60('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xca60('0x3')]},'animation':{'type':Sequelize[_0xca60('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xca60('0xa')](_0xca60('0xb'),_0xca60('0xc')),'defaultValue':_0xca60('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xca60('0xd')},'start_chat_button':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0xe')},'offline_chat_button':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0xf')},'header_offline':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x10')},'download_transcript':{'type':Sequelize[_0xca60('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xca60('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x14')},'noteTitle':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x15')},'placeholderMessage':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0xf')},'skipMessageButton':{'type':Sequelize[_0xca60('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x17')},'ratingType':{'type':Sequelize[_0xca60('0xa')](_0xca60('0x18'),_0xca60('0x19')),'defaultValue':_0xca60('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xca60('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xca60('0x1a')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xca60('0x1b'),'variable':null,'config':{'placeholder':_0xca60('0x1c'),'type':_0xca60('0x1d'),'required':!![]},'props':{'title':_0xca60('0x1c'),'helpText':''}},{'type':_0xca60('0x1b'),'props':{'title':_0xca60('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xca60('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xca60('0x1e')](_0xca60('0x1f'))?JSON[_0xca60('0x20')](this['getDataValue'](_0xca60('0x1f'))):{};},'set':function(_0x55e272){return this[_0xca60('0x21')](_0xca60('0x1f'),JSON['stringify'](_0x55e272));}},'offlineForm':{'type':Sequelize[_0xca60('0x1a')],'defaultValue':function(){return JSON[_0xca60('0x22')]({'items':[{'type':_0xca60('0x1b'),'props':{'title':_0xca60('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xca60('0x5'),'type':_0xca60('0x5')},'variable':null},{'type':_0xca60('0x23'),'config':{'placeholder':_0xca60('0x24')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xca60('0x1e')](_0xca60('0x25'))?JSON[_0xca60('0x20')](this[_0xca60('0x1e')](_0xca60('0x25'))):{};},'set':function(_0x1fddc5){return this['setDataValue'](_0xca60('0x25'),JSON['stringify'](_0x1fddc5));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xca60('0x26')]();}},'autoclose':{'type':Sequelize[_0xca60('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xca60('0x3')]},'waitingTitle':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x27')},'waitingMessage':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xca60('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xca60('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xca60('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x2a')},'sendUnmanaged':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xca60('0x1a')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xca60('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0xca60('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xca60('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x2c')},'verticalAlignment':{'type':Sequelize[_0xca60('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x2d')},'defaultTitle':{'type':Sequelize[_0xca60('0x3')]},'customerAvatar':{'type':Sequelize[_0xca60('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xca60('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xca60('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca60('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca60('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xca60('0x3')],'defaultValue':_0xca60('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca60('0x8')],'comment':_0xca60('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xca60('0x31'),'set':function(_0xf05693){if(!_0xf05693)this[_0xca60('0x21')](_0xca60('0x32'),null);this['setDataValue'](_0xca60('0x33'),_0xf05693);}},'vidaooEscalation':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xca60('0x3')]},'vidaooTopic':{'type':Sequelize[_0xca60('0x3')],'allowNull':![],'defaultValue':_0xca60('0x34')},'vidaooNote':{'type':Sequelize[_0xca60('0x3')],'defaultValue':function(){return _0xca60('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xca60('0x1a')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xca60('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xca60('0x1a')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a3573de..b127302 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 _0x846c=['custom','License','increment','chatLicenseExceeded','Interval','push','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','virtual','replace','alignment','color_button','addApplications','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','end','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','findOne','Disposition','intersection','hasOwnProperty','order','removeDispositions','ids','CannedAnswer','getAnswers','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','account','applications','priority','asc','Applications','from','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','version','browser','unknown','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','ChatMessage','AttachmentId','UserId','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Intervals','getProactiveActions'];(function(_0x4ff759,_0x1008f7){var _0x3921f5=function(_0x2180d3){while(--_0x2180d3){_0x4ff759['push'](_0x4ff759['shift']());}};_0x3921f5(++_0x1008f7);}(_0x846c,0x15c));var _0xc846=function(_0x5323d0,_0x423229){_0x5323d0=_0x5323d0-0x0;var _0x485a6a=_0x846c[_0x5323d0];return _0x485a6a;};'use strict';var emlformat=require(_0xc846('0x0'));var rimraf=require(_0xc846('0x1'));var zipdir=require(_0xc846('0x2'));var jsonpatch=require(_0xc846('0x3'));var rp=require(_0xc846('0x4'));var moment=require(_0xc846('0x5'));var BPromise=require(_0xc846('0x6'));var Mustache=require(_0xc846('0x7'));var util=require(_0xc846('0x8'));var path=require(_0xc846('0x9'));var sox=require(_0xc846('0xa'));var csv=require(_0xc846('0xb'));var ejs=require(_0xc846('0xc'));var fs=require('fs');var fs_extra=require(_0xc846('0xd'));var _=require(_0xc846('0xe'));var squel=require('squel');var crypto=require(_0xc846('0xf'));var jsforce=require(_0xc846('0x10'));var deskjs=require(_0xc846('0x11'));var toCsv=require(_0xc846('0xb'));var querystring=require('querystring');var Papa=require(_0xc846('0x12'));var Redis=require(_0xc846('0x13'));var authService=require(_0xc846('0x14'));var qs=require(_0xc846('0x15'));var as=require(_0xc846('0x16'));var hardwareService=require(_0xc846('0x17'));var logger=require(_0xc846('0x18'))(_0xc846('0x19'));var utils=require('../../config/utils');var config=require(_0xc846('0x1a'));var licenseUtil=require(_0xc846('0x1b'));var db=require(_0xc846('0x1c'))['db'];config[_0xc846('0x1d')]=_[_0xc846('0x1e')](config[_0xc846('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xc846('0x1f'))(new Redis(config[_0xc846('0x1d')]));require(_0xc846('0x20'))[_0xc846('0x21')](socket);var jayson=require(_0xc846('0x22'));var client=jayson[_0xc846('0x23')][_0xc846('0x24')]({'port':0x232c});var client9002=jayson[_0xc846('0x23')][_0xc846('0x24')]({'port':0x232a});var client9003=jayson[_0xc846('0x23')]['http']({'port':0x232b});var client9001=jayson[_0xc846('0x23')]['http']({'port':0x2329});function respondWithRpcPromise(_0x4c1001,_0x183433,_0x1bbfb1,_0x4e2872){return new BPromise(function(_0x5325cc,_0x55c410){var _0x2a851e=_0x4e2872||client;return _0x2a851e['request'](_0x4c1001,_0x1bbfb1)[_0xc846('0x25')](function(_0xbc6c3e){logger[_0xc846('0x26')](_0xc846('0x27'),_0x183433,'request\x20sent');logger[_0xc846('0x28')](_0xc846('0x29'),_0x183433,_0xc846('0x2a'),JSON[_0xc846('0x2b')](_0xbc6c3e));if(_0xbc6c3e[_0xc846('0x2c')]){if(_0xbc6c3e['error'][_0xc846('0x2d')]===0x1f4){logger['error'](_0xc846('0x27'),_0x183433,_0xbc6c3e[_0xc846('0x2c')][_0xc846('0x2e')]);return _0x55c410(_0xbc6c3e[_0xc846('0x2c')]['message']);}logger[_0xc846('0x2c')](_0xc846('0x27'),_0x183433,_0xbc6c3e[_0xc846('0x2c')]['message']);return _0x5325cc(_0xbc6c3e[_0xc846('0x2c')]['message']);}else{logger[_0xc846('0x26')](_0xc846('0x27'),_0x183433,_0xc846('0x2a'));_0x5325cc(_0xbc6c3e[_0xc846('0x2f')]['message']);}})[_0xc846('0x30')](function(_0x1d11d5){logger[_0xc846('0x2c')](_0xc846('0x27'),_0x183433,_0x1d11d5);_0x55c410(_0x1d11d5);});});}function respondWithStatusCode(_0x5f508b,_0x598757){_0x598757=_0x598757||0xcc;return function(_0x53469a){if(_0x53469a){return _0x5f508b[_0xc846('0x31')](_0x598757);}return _0x5f508b[_0xc846('0x32')](_0x598757)['end']();};}function respondWithResult(_0x33bbed,_0x32e882){_0x32e882=_0x32e882||0xc8;return function(_0x30385e){if(_0x30385e){return _0x33bbed[_0xc846('0x32')](_0x32e882)[_0xc846('0x33')](_0x30385e);}};}function respondWithFilteredResult(_0x4c6e2c,_0x7d68ce){return function(_0x31300f){if(_0x31300f){var _0x317eb9=typeof _0x7d68ce[_0xc846('0x34')]===_0xc846('0x35')&&typeof _0x7d68ce['limit']===_0xc846('0x35');var _0x26be51=_0x31300f[_0xc846('0x36')];var _0x5dbabd=_0x317eb9?0x0:_0x7d68ce[_0xc846('0x34')];var _0x5e0143=_0x317eb9?_0x31300f[_0xc846('0x36')]:_0x7d68ce[_0xc846('0x34')]+_0x7d68ce[_0xc846('0x37')];var _0x219f1c;if(_0x5e0143>=_0x26be51){_0x5e0143=_0x26be51;_0x219f1c=0xc8;}else{_0x219f1c=0xce;}_0x4c6e2c['status'](_0x219f1c);return _0x4c6e2c['set'](_0xc846('0x38'),_0x5dbabd+'-'+_0x5e0143+'/'+_0x26be51)[_0xc846('0x33')](_0x31300f);}return null;};}function patchUpdates(_0x3fbe8d){return function(_0x5e9a5e){try{jsonpatch[_0xc846('0x39')](_0x5e9a5e,_0x3fbe8d,!![]);}catch(_0x8dc99){return BPromise[_0xc846('0x3a')](_0x8dc99);}return _0x5e9a5e['save']();};}function saveUpdates(_0x20c324,_0x41ca06){return function(_0x4b3813){if(_0x4b3813){return _0x4b3813[_0xc846('0x3b')](_0x20c324)['then'](function(_0x45af6e){return _0x45af6e;});}return null;};}function removeEntity(_0x1db951,_0x4ee6c3){return function(_0x584a2d){if(_0x584a2d){return _0x584a2d[_0xc846('0x3c')]()['then'](function(){var _0x5dcb9b=_0x584a2d[_0xc846('0x3d')]({'plain':!![]});var _0x2e1878='ChatWebsites';return db['UserProfileResource'][_0xc846('0x3c')]({'where':{'type':_0x2e1878,'resourceId':_0x5dcb9b['id']}})['then'](function(){return _0x584a2d;});})['then'](function(){_0x1db951[_0xc846('0x32')](0xcc)[_0xc846('0x3e')]();});}};}function handleEntityNotFound(_0x35dce5,_0x5140f8){return function(_0x11690c){if(!_0x11690c){_0x35dce5[_0xc846('0x31')](0x194);}return _0x11690c;};}function handleError(_0x50b0e0,_0x5777d8){_0x5777d8=_0x5777d8||0x1f4;return function(_0x2d9676){logger['error'](_0x2d9676['stack']);if(_0x2d9676[_0xc846('0x3f')]){delete _0x2d9676[_0xc846('0x3f')];}_0x50b0e0[_0xc846('0x32')](_0x5777d8)['send'](_0x2d9676);};}exports[_0xc846('0x40')]=function(_0x3fa7e8,_0x580066){var _0x10bc34={'include':[{'model':db[_0xc846('0x41')],'as':'mandatoryDispositionPause'}]},_0x352198={},_0x587e52={'count':0x0,'rows':[]};var _0x38cccf=_[_0xc846('0x42')](db[_0xc846('0x43')][_0xc846('0x44')],function(_0x29b109){return{'name':_0x29b109[_0xc846('0x45')],'type':_0x29b109[_0xc846('0x46')][_0xc846('0x47')]};});_0x352198[_0xc846('0x48')]=_[_0xc846('0x42')](_0x38cccf,_0xc846('0x3f'));_0x352198[_0xc846('0x49')]=_[_0xc846('0x4a')](_0x3fa7e8[_0xc846('0x49')]);_0x352198[_0xc846('0x4b')]=_['intersection'](_0x352198[_0xc846('0x48')],_0x352198[_0xc846('0x49')]);_0x10bc34[_0xc846('0x4c')]=_['intersection'](_0x352198[_0xc846('0x48')],qs['fields'](_0x3fa7e8['query'][_0xc846('0x4d')]));_0x10bc34[_0xc846('0x4c')]=_0x10bc34[_0xc846('0x4c')][_0xc846('0x4e')]?_0x10bc34[_0xc846('0x4c')]:_0x352198[_0xc846('0x48')];if(!_0x3fa7e8['query']['hasOwnProperty'](_0xc846('0x4f'))){_0x10bc34[_0xc846('0x37')]=qs['limit'](_0x3fa7e8['query'][_0xc846('0x37')]);_0x10bc34[_0xc846('0x34')]=qs[_0xc846('0x34')](_0x3fa7e8[_0xc846('0x49')][_0xc846('0x34')]);}_0x10bc34['order']=qs[_0xc846('0x50')](_0x3fa7e8['query'][_0xc846('0x50')]);_0x10bc34['where']=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x3fa7e8[_0xc846('0x49')],_0x352198[_0xc846('0x4b')]),_0x38cccf);if(_0x3fa7e8[_0xc846('0x49')][_0xc846('0x52')]){_0x10bc34['where']=_[_0xc846('0x53')](_0x10bc34[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x38cccf,function(_0x2f405e){if(_0x2f405e[_0xc846('0x46')]!==_0xc846('0x55')){var _0x21f5c8={};_0x21f5c8[_0x2f405e[_0xc846('0x3f')]]={'$like':'%'+_0x3fa7e8[_0xc846('0x49')]['filter']+'%'};return _0x21f5c8;}})});}_0x10bc34=_[_0xc846('0x53')]({},_0x10bc34,_0x3fa7e8[_0xc846('0x56')]);var _0x110255={'where':_0x10bc34[_0xc846('0x54')]};return db[_0xc846('0x43')]['count'](_0x110255)[_0xc846('0x25')](function(_0x44c2f9){_0x587e52['count']=_0x44c2f9;if(_0x3fa7e8[_0xc846('0x49')][_0xc846('0x57')]){_0x10bc34[_0xc846('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0xc846('0x59')](_0x10bc34);})['then'](function(_0x2c101a){_0x587e52[_0xc846('0x5a')]=_0x2c101a;return _0x587e52;})[_0xc846('0x25')](respondWithFilteredResult(_0x580066,_0x10bc34))['catch'](handleError(_0x580066,null));};exports['show']=function(_0x22bdda,_0x26a2b6){var _0x663292={'raw':![],'where':{'id':_0x22bdda[_0xc846('0x5b')]['id']},'include':[{'model':db[_0xc846('0x41')],'as':'mandatoryDispositionPause'}]},_0x3e85fe={};_0x3e85fe['model']=_[_0xc846('0x4a')](db[_0xc846('0x43')][_0xc846('0x44')]);_0x3e85fe[_0xc846('0x49')]=_['keys'](_0x22bdda[_0xc846('0x49')]);_0x3e85fe[_0xc846('0x4b')]=_['intersection'](_0x3e85fe[_0xc846('0x48')],_0x3e85fe[_0xc846('0x49')]);_0x663292['attributes']=_['intersection'](_0x3e85fe[_0xc846('0x48')],qs['fields'](_0x22bdda[_0xc846('0x49')]['fields']));_0x663292[_0xc846('0x4c')]=_0x663292[_0xc846('0x4c')][_0xc846('0x4e')]?_0x663292[_0xc846('0x4c')]:_0x3e85fe[_0xc846('0x48')];if(_0x22bdda['query'][_0xc846('0x57')]){_0x663292[_0xc846('0x58')]=[{'all':!![]}];}_0x663292=_['merge']({},_0x663292,_0x22bdda['options']);return db[_0xc846('0x43')][_0xc846('0x5c')](_0x663292)['then'](handleEntityNotFound(_0x26a2b6,null))[_0xc846('0x25')](respondWithResult(_0x26a2b6,null))[_0xc846('0x30')](handleError(_0x26a2b6,null));};exports[_0xc846('0x5d')]=function(_0x52842f,_0x2f8676){return db[_0xc846('0x43')]['create'](_0x52842f['body'],{})[_0xc846('0x25')](function(_0x1d0c03){var _0x28992c=_0x52842f['user'][_0xc846('0x3d')]({'plain':!![]});if(!_0x28992c)throw new Error(_0xc846('0x5e'));if(_0x28992c[_0xc846('0x5f')]===_0xc846('0x60')){var _0x3d847b=_0x1d0c03['get']({'plain':!![]});var _0x5be21b='ChatWebsites';return db['UserProfileSection'][_0xc846('0x5c')]({'where':{'name':_0x5be21b,'userProfileId':_0x28992c[_0xc846('0x61')]},'raw':!![]})[_0xc846('0x25')](function(_0x29c9e7){if(_0x29c9e7&&_0x29c9e7[_0xc846('0x62')]===0x0){return db[_0xc846('0x63')][_0xc846('0x5d')]({'name':_0x3d847b[_0xc846('0x3f')],'resourceId':_0x3d847b['id'],'type':_0x29c9e7['name'],'sectionId':_0x29c9e7['id']},{})[_0xc846('0x25')](function(){return _0x1d0c03;});}else{return _0x1d0c03;}})[_0xc846('0x30')](function(_0x1ae65a){logger['error'](_0xc846('0x64'),_0x1ae65a);throw _0x1ae65a;});}return _0x1d0c03;})[_0xc846('0x25')](respondWithResult(_0x2f8676,0xc9))[_0xc846('0x30')](handleError(_0x2f8676,null));};exports['update']=function(_0x9452a1,_0x4e73fb){if(_0x9452a1[_0xc846('0x65')]['id']){delete _0x9452a1[_0xc846('0x65')]['id'];}return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x9452a1[_0xc846('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xc846('0x66')}]})[_0xc846('0x25')](handleEntityNotFound(_0x4e73fb,null))[_0xc846('0x25')](saveUpdates(_0x9452a1[_0xc846('0x65')],null))[_0xc846('0x25')](respondWithResult(_0x4e73fb,null))['catch'](handleError(_0x4e73fb,null));};exports[_0xc846('0x3c')]=function(_0x21bc18,_0x217e70){return db[_0xc846('0x43')]['find']({'where':{'id':_0x21bc18[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x217e70,null))[_0xc846('0x25')](removeEntity(_0x217e70,null))[_0xc846('0x30')](handleError(_0x217e70,null));};exports[_0xc846('0x67')]=function(_0x3f1ebc,_0x2f6e0b){return db[_0xc846('0x43')][_0xc846('0x67')]()[_0xc846('0x25')](respondWithResult(_0x2f6e0b,null))[_0xc846('0x30')](handleError(_0x2f6e0b,null));};exports[_0xc846('0x68')]=function(_0x1a3768,_0x4e10b4,_0x244a41){if(_0x1a3768[_0xc846('0x65')]['id']){delete _0x1a3768['body']['id'];}return db[_0xc846('0x43')]['find']({'where':{'id':_0x1a3768[_0xc846('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e10b4,null))[_0xc846('0x25')](function(_0x1ea062){if(_0x1ea062){_0x1a3768[_0xc846('0x65')][_0xc846('0x69')]=_0x1ea062['id'];return db['Disposition'][_0xc846('0x5d')](_0x1a3768[_0xc846('0x65')]);}})[_0xc846('0x25')](respondWithResult(_0x4e10b4,null))[_0xc846('0x30')](handleError(_0x4e10b4,null));};exports['getDispositions']=function(_0x156417,_0x3fb221,_0xf7d600){var _0x17656b={'raw':![],'where':{}};var _0xe35e1e={};var _0x4ceb73={'count':0x0,'rows':[]};return db[_0xc846('0x43')][_0xc846('0x6a')]({'where':{'id':_0x156417[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x3fb221,null))['then'](function(_0x5e20b6){if(_0x5e20b6){_0xe35e1e['model']=_['keys'](db[_0xc846('0x6b')][_0xc846('0x44')]);_0xe35e1e[_0xc846('0x49')]=_['keys'](_0x156417[_0xc846('0x49')]);_0xe35e1e[_0xc846('0x4b')]=_[_0xc846('0x6c')](_0xe35e1e['model'],_0xe35e1e[_0xc846('0x49')]);_0x17656b[_0xc846('0x4c')]=_[_0xc846('0x6c')](_0xe35e1e[_0xc846('0x48')],qs[_0xc846('0x4d')](_0x156417[_0xc846('0x49')][_0xc846('0x4d')]));_0x17656b[_0xc846('0x4c')]=_0x17656b['attributes'][_0xc846('0x4e')]?_0x17656b[_0xc846('0x4c')]:_0xe35e1e['model'];if(!_0x156417[_0xc846('0x49')][_0xc846('0x6d')](_0xc846('0x4f'))){_0x17656b[_0xc846('0x37')]=qs[_0xc846('0x37')](_0x156417[_0xc846('0x49')][_0xc846('0x37')]);_0x17656b[_0xc846('0x34')]=qs[_0xc846('0x34')](_0x156417[_0xc846('0x49')][_0xc846('0x34')]);}_0x17656b[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x156417['query'][_0xc846('0x50')]);_0x17656b[_0xc846('0x54')]=qs[_0xc846('0x4b')](_['pick'](_0x156417[_0xc846('0x49')],_0xe35e1e[_0xc846('0x4b')]));_0x17656b[_0xc846('0x54')]['ChatWebsiteId']=_0x5e20b6['id'];if(_0x156417[_0xc846('0x49')]['filter']){_0x17656b[_0xc846('0x54')]=_['merge'](_0x17656b[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x17656b[_0xc846('0x4c')],function(_0xeb8cb3){var _0xacc402={};_0xacc402[_0xeb8cb3]={'$like':'%'+_0x156417[_0xc846('0x49')]['filter']+'%'};return _0xacc402;})});}_0x17656b=_[_0xc846('0x53')]({},_0x17656b,_0x156417[_0xc846('0x56')]);return db['Disposition'][_0xc846('0x36')]({'where':_0x17656b['where']})[_0xc846('0x25')](function(_0x4be71e){_0x4ceb73[_0xc846('0x36')]=_0x4be71e;if(_0x156417[_0xc846('0x49')][_0xc846('0x57')]){_0x17656b[_0xc846('0x58')]=[{'all':!![]}];}return db[_0xc846('0x6b')]['findAll'](_0x17656b);})['then'](function(_0x544ef7){_0x4ceb73[_0xc846('0x5a')]=_0x544ef7;return _0x4ceb73;});}})['then'](respondWithFilteredResult(_0x3fb221,_0x17656b))[_0xc846('0x30')](handleError(_0x3fb221,null));};exports[_0xc846('0x6f')]=function(_0x385970,_0x20106a,_0x20776e){return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x385970[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x20106a,null))[_0xc846('0x25')](function(_0x72f25c){if(_0x72f25c){return _0x72f25c[_0xc846('0x6f')](_0x385970[_0xc846('0x49')][_0xc846('0x70')]);}})[_0xc846('0x25')](respondWithStatusCode(_0x20106a,null))['catch'](handleError(_0x20106a,null));};exports['addAnswer']=function(_0x46e04b,_0xc0f3d6,_0x5ef65e){if(_0x46e04b['body']['id']){delete _0x46e04b['body']['id'];}return db[_0xc846('0x43')]['find']({'where':{'id':_0x46e04b['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0xc0f3d6,null))[_0xc846('0x25')](function(_0x46b97f){if(_0x46b97f){_0x46e04b['body'][_0xc846('0x69')]=_0x46b97f['id'];return db[_0xc846('0x71')][_0xc846('0x5d')](_0x46e04b[_0xc846('0x65')]);}})[_0xc846('0x25')](respondWithResult(_0xc0f3d6,null))[_0xc846('0x30')](handleError(_0xc0f3d6,null));};exports[_0xc846('0x72')]=function(_0x367275,_0xfa3a84,_0x2f7111){var _0x1d49fc={'raw':![],'where':{}};var _0x1e18ba={};var _0x1174d0={'count':0x0,'rows':[]};return db[_0xc846('0x43')][_0xc846('0x6a')]({'where':{'id':_0x367275[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0xfa3a84,null))[_0xc846('0x25')](function(_0x336fb6){if(_0x336fb6){_0x1e18ba[_0xc846('0x48')]=_['keys'](db['CannedAnswer'][_0xc846('0x44')]);_0x1e18ba['query']=_[_0xc846('0x4a')](_0x367275[_0xc846('0x49')]);_0x1e18ba['filters']=_[_0xc846('0x6c')](_0x1e18ba['model'],_0x1e18ba[_0xc846('0x49')]);_0x1d49fc[_0xc846('0x4c')]=_[_0xc846('0x6c')](_0x1e18ba[_0xc846('0x48')],qs[_0xc846('0x4d')](_0x367275[_0xc846('0x49')][_0xc846('0x4d')]));_0x1d49fc[_0xc846('0x4c')]=_0x1d49fc[_0xc846('0x4c')][_0xc846('0x4e')]?_0x1d49fc[_0xc846('0x4c')]:_0x1e18ba['model'];if(!_0x367275['query'][_0xc846('0x6d')](_0xc846('0x4f'))){_0x1d49fc['limit']=qs[_0xc846('0x37')](_0x367275['query'][_0xc846('0x37')]);_0x1d49fc[_0xc846('0x34')]=qs[_0xc846('0x34')](_0x367275[_0xc846('0x49')][_0xc846('0x34')]);}_0x1d49fc[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x367275[_0xc846('0x49')][_0xc846('0x50')]);_0x1d49fc[_0xc846('0x54')]=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x367275[_0xc846('0x49')],_0x1e18ba[_0xc846('0x4b')]));_0x1d49fc['where']['ChatWebsiteId']=_0x336fb6['id'];if(_0x367275[_0xc846('0x49')][_0xc846('0x52')]){_0x1d49fc[_0xc846('0x54')]=_[_0xc846('0x53')](_0x1d49fc[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x1d49fc[_0xc846('0x4c')],function(_0x22fac1){var _0x54432d={};_0x54432d[_0x22fac1]={'$like':'%'+_0x367275[_0xc846('0x49')][_0xc846('0x52')]+'%'};return _0x54432d;})});}_0x1d49fc=_[_0xc846('0x53')]({},_0x1d49fc,_0x367275[_0xc846('0x56')]);return db[_0xc846('0x71')][_0xc846('0x36')]({'where':_0x1d49fc[_0xc846('0x54')]})['then'](function(_0x5814ac){_0x1174d0['count']=_0x5814ac;if(_0x367275[_0xc846('0x49')]['includeAll']){_0x1d49fc[_0xc846('0x58')]=[{'all':!![]}];}return db[_0xc846('0x71')]['findAll'](_0x1d49fc);})[_0xc846('0x25')](function(_0x536e00){_0x1174d0[_0xc846('0x5a')]=_0x536e00;return _0x1174d0;});}})[_0xc846('0x25')](respondWithFilteredResult(_0xfa3a84,_0x1d49fc))['catch'](handleError(_0xfa3a84,null));};exports['removeAnswers']=function(_0x450084,_0x287eab,_0x42ed1b){return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x450084['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x287eab,null))[_0xc846('0x25')](function(_0x2fbeca){if(_0x2fbeca){return _0x2fbeca['removeAnswers'](_0x450084[_0xc846('0x49')][_0xc846('0x70')]);}})['then'](respondWithStatusCode(_0x287eab,null))[_0xc846('0x30')](handleError(_0x287eab,null));};exports['addLogo']=function(_0x32532e,_0x1da8ff,_0x4232a1){_0x32532e[_0xc846('0x65')]['sitepic']=_0x32532e[_0xc846('0x73')][_0xc846('0x74')];return db[_0xc846('0x43')][_0xc846('0x5c')]({'where':{'id':_0x32532e[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x1da8ff,null))[_0xc846('0x25')](saveUpdates(_0x32532e[_0xc846('0x65')],null))[_0xc846('0x25')](respondWithResult(_0x1da8ff,null))[_0xc846('0x30')](handleError(_0x1da8ff,null));};exports[_0xc846('0x75')]=function(_0x5a8b50,_0x299d8c,_0x2ff8ad){_0x5a8b50[_0xc846('0x65')][_0xc846('0x76')]=_0x5a8b50[_0xc846('0x73')]['filename'];return db[_0xc846('0x43')][_0xc846('0x5c')]({'where':{'id':_0x5a8b50['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x299d8c,null))[_0xc846('0x25')](saveUpdates(_0x5a8b50[_0xc846('0x65')],null))[_0xc846('0x25')](respondWithResult(_0x299d8c,null))[_0xc846('0x30')](handleError(_0x299d8c,null));};exports['addCustomerAvatar']=function(_0x3cd58a,_0x10bf5d,_0x5572c2){_0x3cd58a['body']['customerAvatar']=_0x3cd58a[_0xc846('0x73')]['filename'];return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x3cd58a[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x10bf5d,null))[_0xc846('0x25')](saveUpdates(_0x3cd58a[_0xc846('0x65')],null))['then'](respondWithResult(_0x10bf5d,null))[_0xc846('0x30')](handleError(_0x10bf5d,null));};exports[_0xc846('0x77')]=function(_0x385593,_0x34a575,_0xc9c578){_0x385593[_0xc846('0x65')][_0xc846('0x78')]=_0x385593[_0xc846('0x73')][_0xc846('0x74')];return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x385593[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x34a575,null))[_0xc846('0x25')](saveUpdates(_0x385593[_0xc846('0x65')],null))[_0xc846('0x25')](respondWithResult(_0x34a575,null))[_0xc846('0x30')](handleError(_0x34a575,null));};exports[_0xc846('0x79')]=function(_0x581b98,_0x5b88a1,_0x1bfb09){var _0xc1358=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x7c'));var _0x2ae7eb={'where':{'id':_0x581b98[_0xc846('0x5b')]['id']},'attributes':['id',_0xc846('0x7d')],'raw':!![]};var _0x8ce439=![];return require(_0xc846('0x1b'))[_0xc846('0x7e')]()[_0xc846('0x25')](function(_0x485d41){if(_0x485d41){_0x8ce439=_0x485d41['custom'];}})[_0xc846('0x25')](function(){return db[_0xc846('0x43')][_0xc846('0x5c')](_0x2ae7eb);})['then'](handleEntityNotFound(_0x5b88a1,null))['then'](function(_0x5475bd){if(_0x5475bd){if(!_[_0xc846('0x7f')](_0x5475bd[_0xc846('0x7d')])){if(fs['existsSync'](path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x80'),_0x5475bd[_0xc846('0x7d')]))&&_0x8ce439){_0xc1358=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x80'),_0x5475bd['sitepic']);}}return _0x5b88a1[_0xc846('0x81')](_0xc1358);}})[_0xc846('0x30')](handleError(_0x5b88a1,null));};exports[_0xc846('0x82')]=function(_0x13f3c4,_0x58caf9,_0x160324){var _0x1bbff2=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x83'));var _0x283ba0={'where':{'id':_0x13f3c4[_0xc846('0x5b')]['id']},'attributes':['id',_0xc846('0x76')],'raw':!![]};return db[_0xc846('0x43')]['find'](_0x283ba0)['then'](handleEntityNotFound(_0x58caf9,null))[_0xc846('0x25')](function(_0x51b521){if(_0x51b521){if(!_[_0xc846('0x7f')](_0x51b521[_0xc846('0x76')])){if(fs[_0xc846('0x84')](path[_0xc846('0x7a')](config['root'],'server/files/images/avatars/',_0x51b521[_0xc846('0x76')]))){_0x1bbff2=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x85'),_0x51b521['agentAvatar']);}}return _0x58caf9[_0xc846('0x81')](_0x1bbff2);}})[_0xc846('0x30')](handleError(_0x58caf9,null));};exports['getCustomerAvatar']=function(_0x527bf5,_0x616049,_0x3073e6){var _0x39252c=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x86'));var _0x214452={'where':{'id':_0x527bf5[_0xc846('0x5b')]['id']},'attributes':['id',_0xc846('0x87'),_0xc846('0x88')],'raw':!![]};return db[_0xc846('0x43')][_0xc846('0x5c')](_0x214452)[_0xc846('0x25')](handleEntityNotFound(_0x616049,null))[_0xc846('0x25')](function(_0x402799){if(_0x402799){if(!_['isNil'](_0x402799[_0xc846('0x87')])){if(fs[_0xc846('0x84')](path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x85'),_0x402799[_0xc846('0x87')]))&&_0x402799[_0xc846('0x88')]){_0x39252c=path['join'](config['root'],_0xc846('0x85'),_0x402799['customerAvatar']);}}return _0x616049[_0xc846('0x81')](_0x39252c);}})[_0xc846('0x30')](handleError(_0x616049,null));};exports[_0xc846('0x89')]=function(_0x3ce9c4,_0x4b06fb,_0x5d1add){var _0x37d59e=path['join'](config[_0xc846('0x7b')],'server/files/images/avatars/system_avatar.png');var _0x42fa49={'where':{'id':_0x3ce9c4[_0xc846('0x5b')]['id']},'attributes':['id',_0xc846('0x78')],'raw':!![]};return db['ChatWebsite'][_0xc846('0x5c')](_0x42fa49)['then'](handleEntityNotFound(_0x4b06fb,null))[_0xc846('0x25')](function(_0x8201e1){if(_0x8201e1){if(!_[_0xc846('0x7f')](_0x8201e1[_0xc846('0x78')])){if(fs[_0xc846('0x84')](path['join'](config[_0xc846('0x7b')],_0xc846('0x85'),_0x8201e1[_0xc846('0x78')]))){_0x37d59e=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x85'),_0x8201e1[_0xc846('0x78')]);}}return _0x4b06fb[_0xc846('0x81')](_0x37d59e);}})[_0xc846('0x30')](handleError(_0x4b06fb,null));};exports['notify']=function(_0x1e6ad6,_0xc0278e,_0x3b6b65){var _0x46a09e=require(_0xc846('0x8a'));var _0x3ad572=new _0x46a09e();var _0xafe2a7=_0x3ad572[_0xc846('0x8b')](_0x1e6ad6[_0xc846('0x8c')][_0xc846('0x8d')])[_0xc846('0x8e')]();var _0x2bde44={'body':_0x1e6ad6[_0xc846('0x65')],'channel':_0xc846('0x8f')};var _0x24d7c9=[];var _0xc554a4=[];var _0x3a32bb={};var _0x479c2b=![];return db[_0xc846('0x90')][_0xc846('0x67')]()[_0xc846('0x25')](function(_0xe6f2bb){if(!_0xe6f2bb){throw new db[(_0xc846('0x91'))][(_0xc846('0x92'))](_0xc846('0x93'));}_0x24d7c9=_[_0xc846('0x94')](_[_0xc846('0x4a')](_0xe6f2bb),[_0xc846('0x95'),_0xc846('0x96')]);_0xc554a4=_['difference'](_[_0xc846('0x4a')](_0xe6f2bb),[_0xc846('0x95'),'updatedAt',_0xc846('0x97'),_0xc846('0x98')]);if(_0x1e6ad6[_0xc846('0x65')]['id']){delete _0x1e6ad6[_0xc846('0x65')]['id'];}if(_[_0xc846('0x7f')](_0x1e6ad6[_0xc846('0x65')]['from'])){throw new db['Sequelize'][(_0xc846('0x92'))](_0xc846('0x99'));}if(_[_0xc846('0x7f')](_0x1e6ad6[_0xc846('0x65')][_0xc846('0x65')])||_0x1e6ad6[_0xc846('0x65')]['body']===''){throw new db[(_0xc846('0x91'))][(_0xc846('0x92'))](_0xc846('0x9a'));}if(_[_0xc846('0x7f')](_0x1e6ad6[_0xc846('0x65')][_0xc846('0x9b')])){throw new db[(_0xc846('0x91'))][(_0xc846('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xc554a4);}if(!_[_0xc846('0x9c')](_0xc554a4,_0x1e6ad6[_0xc846('0x65')]['mapKey'])){throw new db[(_0xc846('0x91'))][(_0xc846('0x92'))](_0xc846('0x9d')+_0xc554a4);}_0x3a32bb[_0x1e6ad6[_0xc846('0x65')][_0xc846('0x9b')]]=_0x1e6ad6[_0xc846('0x65')]['from'];})[_0xc846('0x25')](function(){return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0x1e6ad6[_0xc846('0x5b')]['id']},'include':[{'model':db[_0xc846('0x9e')],'as':_0xc846('0x9f'),'include':[{'model':db[_0xc846('0x90')],'as':_0xc846('0xa0'),'where':_0x3a32bb,'limit':0x1,'order':[[_0xc846('0x96'),_0xc846('0xa1')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xc0278e,null))[_0xc846('0x25')](function(_0x58f059){if(_0x58f059&&_0x58f059[_0xc846('0x9f')]){_0x2bde44[_0xc846('0xa2')]=_0x58f059;_0x2bde44[_0xc846('0xa3')]=_0x58f059['Applications'];_0x2bde44['list']=_0x58f059[_0xc846('0x9f')];_0x2bde44['applications']=_['orderBy'](_0x2bde44[_0xc846('0xa3')],[_0xc846('0xa4')],[_0xc846('0xa5')]);if(_0x2bde44['account'][_0xc846('0xa6')]){delete _0x2bde44['account'][_0xc846('0xa6')];}if(_0x2bde44[_0xc846('0xa2')][_0xc846('0x9f')]&&_0x2bde44[_0xc846('0xa2')][_0xc846('0x9f')]['Contacts'][_0xc846('0x4e')]){return _0x2bde44[_0xc846('0xa2')]['List'][_0xc846('0xa0')][0x0];}var _0xcd8df=_['defaults'](_0x1e6ad6[_0xc846('0x65')],{'firstName':_0x1e6ad6[_0xc846('0x65')][_0xc846('0xa7')],'ListId':_0x58f059[_0xc846('0x98')]});_0xcd8df[_0x1e6ad6[_0xc846('0x65')]['mapKey']]=_0x1e6ad6[_0xc846('0x65')]['from'];return db[_0xc846('0x90')][_0xc846('0x5d')](_0xcd8df,{'fields':_0x24d7c9,'raw':!![]});}})[_0xc846('0x25')](handleEntityNotFound(_0xc0278e,null))['then'](function(_0x14bcf6){_0x2bde44[_0xc846('0xa8')]=_0x14bcf6;var _0x1d71bb=_0x1e6ad6['body'][_0xc846('0xa9')];if(_0x1e6ad6[_0xc846('0x8c')]['cf-connecting-ip']){_0x1d71bb=_0x1e6ad6['headers'][_0xc846('0xaa')];}else if(_0x1e6ad6['headers'][_0xc846('0xab')]){_0x1d71bb=_['first'](_0x1e6ad6[_0xc846('0x8c')][_0xc846('0xab')][_0xc846('0xac')](','));}if(_0x14bcf6){var _0x3839e3={'ContactId':_0x14bcf6['id'],'ChatWebsiteId':_0x1e6ad6['params']['id'],'from':(_0x14bcf6[_0xc846('0xad')]||'')+'\x20'+(_0x14bcf6[_0xc846('0xae')]||''),'customerIp':_0x1d71bb,'customerPort':_0x1e6ad6[_0xc846('0x8c')][_0xc846('0xaf')]?_0x1e6ad6['headers'][_0xc846('0xaf')]:null,'referer':_0x1e6ad6[_0xc846('0x65')][_0xc846('0xb0')],'browserName':_0xafe2a7['browser'][_0xc846('0x3f')]&&_0xafe2a7['browser'][_0xc846('0xb1')]?util['format']('%s\x20%s',_0xafe2a7[_0xc846('0xb2')][_0xc846('0x3f')],_0xafe2a7[_0xc846('0xb2')][_0xc846('0xb1')]):_0xc846('0xb3'),'browserVersion':_0xafe2a7['browser'][_0xc846('0xb1')]||_0xc846('0xb3'),'osName':util[_0xc846('0xb4')](_0xc846('0xb5'),_0xafe2a7['os'][_0xc846('0x3f')],_0xafe2a7['os'][_0xc846('0xb1')]),'osVersion':_0xafe2a7['os']['version'],'deviceModel':_0xafe2a7[_0xc846('0xb6')][_0xc846('0x48')]&&_0xafe2a7[_0xc846('0xb6')][_0xc846('0xb7')]?util[_0xc846('0xb4')](_0xc846('0xb8'),_0xafe2a7[_0xc846('0xb6')]['model'],_0xafe2a7[_0xc846('0xb6')][_0xc846('0xb7')],_0xafe2a7[_0xc846('0xb6')][_0xc846('0x46')]):null,'deviceVendor':_0xafe2a7[_0xc846('0xb6')][_0xc846('0xb7')],'deviceType':_0xafe2a7[_0xc846('0xb6')]['type'],'formData':JSON[_0xc846('0x2b')](_0x1e6ad6[_0xc846('0x65')])};var _0x239437={'ChatWebsiteId':_0x1e6ad6[_0xc846('0x5b')]['id'],'closed':![]};if(_0x1e6ad6[_0xc846('0x65')][_0xc846('0xb9')]){_0x239437[_0xc846('0xb9')]=_0x1e6ad6['body'][_0xc846('0xb9')];return db[_0xc846('0xba')][_0xc846('0x5c')]({'where':_0x239437})['then'](function(_0x10d585){if(_0x10d585){return[_0x10d585,![]];}_0x3839e3['threadId']=_0x1e6ad6[_0xc846('0x65')]['threadId'];_0x3839e3[_0xc846('0xbb')]=_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbb')];return db[_0xc846('0xba')][_0xc846('0x5d')](_0x3839e3)[_0xc846('0x25')](function(_0xc4b653){return[_0xc4b653,!![]];});});}_0x239437[_0xc846('0xbc')]=_0x14bcf6['id'];if(_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbd')]&&_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbd')]['id']){_0x239437['id']=_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbd')]['id'];return db['ChatInteraction']['find']({'where':_0x239437})[_0xc846('0x25')](function(_0x2a6bd9){if(_0x2a6bd9){return[_0x2a6bd9,![]];}return db[_0xc846('0xba')][_0xc846('0x5d')](_0x3839e3)[_0xc846('0x25')](function(_0xe6b23f){return[_0xe6b23f,!![]];});});}return db[_0xc846('0xba')][_0xc846('0x5d')](_0x3839e3)[_0xc846('0x25')](function(_0x3173e1){return[_0x3173e1,!![]];});}})[_0xc846('0xbe')](function(_0x26dfff,_0x529f11){if(_0x26dfff){_0x479c2b=_0x529f11;if(!_0x529f11){var _0x2cc820={'from':(_0x2bde44[_0xc846('0xa8')][_0xc846('0xad')]||'')+'\x20'+(_0x2bde44[_0xc846('0xa8')][_0xc846('0xae')]||'')};if(_0x1e6ad6['body'][_0xc846('0xb9')]&&_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbf')]&&_0x1e6ad6['body'][_0xc846('0xb9')]!=_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbf')]){_0x2cc820[_0xc846('0xb9')]=_0x1e6ad6[_0xc846('0x65')][_0xc846('0xbf')];}return _0x26dfff[_0xc846('0x3b')](_0x2cc820);}else{return _0x26dfff;}}})[_0xc846('0x25')](function(_0x1cdab5){_0x2bde44[_0xc846('0xbd')]=_0x1cdab5[_0xc846('0x3d')]({'plain':!![]});_0x2bde44['interaction'][_0xc846('0xc0')]=_0x479c2b;if(_0x2bde44['interaction']['created']){if(_0x2bde44[_0xc846('0xa2')][_0xc846('0xc1')]){_0x2bde44[_0xc846('0xa3')]['push']({'id':0x0,'priority':_0x2bde44[_0xc846('0xa3')]['length']+0x1,'app':_0xc846('0xc2'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xc846('0xc3')][_0xc846('0x5d')]({'body':_0x1e6ad6[_0xc846('0x65')]['body'],'ChatWebsiteId':_0x1e6ad6[_0xc846('0x5b')]['id'],'ChatInteractionId':_0x1cdab5['id'],'direction':'in','ContactId':_0x2bde44[_0xc846('0xa8')]['id'],'AttachmentId':_0x1e6ad6[_0xc846('0x65')][_0xc846('0xc4')]});})['then'](function(_0x335408){_0x2bde44[_0xc846('0x2e')]=_0x335408;if(_0x2bde44[_0xc846('0xbd')][_0xc846('0xc5')]){return db['User'][_0xc846('0x5c')]({'attributes':['id','name'],'where':{'id':_0x2bde44[_0xc846('0xbd')][_0xc846('0xc5')]}})[_0xc846('0x25')](function(_0x3c158c){if(_0x3c158c){_0x2bde44[_0xc846('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3c158c[_0xc846('0x3f')]+','+(_0x2bde44[_0xc846('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0xc846('0xc6')});_0x2bde44[_0xc846('0xc7')]=!![];}return respondWithRpcPromise(_0xc846('0xc8'),_0xc846('0xc9'),_0x2bde44);});}return respondWithRpcPromise(_0xc846('0xc8'),'startRouting',_0x2bde44);})[_0xc846('0x25')](function(_0x2eb268){respondWithRpcPromise(_0xc846('0xca'),'EventManager',{'event':_0xc846('0xcb'),'message':_0x2eb268},client9002);return _0x2eb268;})[_0xc846('0x25')](respondWithResult(_0xc0278e,null))[_0xc846('0x30')](handleError(_0xc0278e,null));};exports[_0xc846('0xcc')]=function(_0xa5f2ec,_0x5606ce,_0x2ccf36){var _0xb28d8a,_0x5b8244,_0x1f793d;var _0x3c7454=[];var _0x47d806=[];var _0x291133={};var _0x26861d=_0xa5f2ec[_0xc846('0xcd')]||[];var _0x58d1d7=[];var _0x2fa7fc;return db[_0xc846('0x90')][_0xc846('0x67')]()[_0xc846('0x25')](function(_0x34f871){if(!_0x34f871){throw new db['Sequelize'][(_0xc846('0x92'))](_0xc846('0x93'));}_0x47d806=_[_0xc846('0x94')](_['keys'](_0x34f871),[_0xc846('0x95'),'updatedAt']);_0x3c7454=_['difference'](_['keys'](_0x34f871),['createdAt',_0xc846('0x96'),_0xc846('0x97'),'ListId']);if(_0xa5f2ec[_0xc846('0x65')]['id']){delete _0xa5f2ec[_0xc846('0x65')]['id'];}if(_[_0xc846('0x7f')](_0xa5f2ec[_0xc846('0x65')][_0xc846('0xa7')])){throw _0x5606ce[_0xc846('0x32')](0x1f4)['send'](new db[(_0xc846('0x91'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xc846('0x7f')](_0xa5f2ec[_0xc846('0x65')][_0xc846('0x65')])||_0xa5f2ec[_0xc846('0x65')][_0xc846('0x65')]===''){throw _0x5606ce[_0xc846('0x32')](0x1f4)['send'](new db[(_0xc846('0x91'))][(_0xc846('0x92'))](_0xc846('0x9a')));}if(_['isNil'](_0xa5f2ec['body']['mapKeyOffline'])){throw _0x5606ce[_0xc846('0x32')](0x1f4)[_0xc846('0xce')](new db['Sequelize'][(_0xc846('0x92'))](_0xc846('0xcf')+_0x3c7454));}if(!_[_0xc846('0x9c')](_0x3c7454,_0xa5f2ec[_0xc846('0x65')][_0xc846('0xd0')])){throw _0x5606ce[_0xc846('0x32')](0x1f4)[_0xc846('0xce')](new db[(_0xc846('0x91'))][(_0xc846('0x92'))](_0xc846('0xd1')+_0x3c7454));}_0x291133[_0xa5f2ec[_0xc846('0x65')][_0xc846('0xd0')]]=_0xa5f2ec['body']['from'];})[_0xc846('0x25')](function(){return db[_0xc846('0x43')]['find']({'where':{'id':_0xa5f2ec[_0xc846('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xc846('0x9f')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x5606ce,null))[_0xc846('0x25')](function(_0xf69c2c){if(_0xf69c2c&&_0xf69c2c[_0xc846('0x9f')]){_0x5b8244=_0xf69c2c;var _0x463816=_[_0xc846('0x1e')](_0xa5f2ec[_0xc846('0x65')],{'firstName':_0xa5f2ec['body'][_0xc846('0xa7')],'phone':_0xa5f2ec[_0xc846('0x65')]['from'],'ListId':_0xf69c2c[_0xc846('0x98')]});_0x463816[_0xa5f2ec['body']['mapKeyOffline']]=_0xa5f2ec[_0xc846('0x65')][_0xc846('0xa7')];return db[_0xc846('0x90')]['findOrCreate']({'where':_0x291133,'defaults':_0x463816});}})['spread'](function(_0x10dff8){if(_0x10dff8){_0x1f793d=_0x10dff8;var _0x476fba=fs[_0xc846('0xd2')](path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0xd3')),_0xc846('0xd4'));var _0x9250d5=ejs[_0xc846('0xd5')](_0x476fba,{'body':_[_0xc846('0xd6')](_0xa5f2ec[_0xc846('0x65')][_0xc846('0x65')]),'bodyTitle':_0x5b8244[_0xc846('0xd7')]});return db[_0xc846('0xd8')]['create']({'body':_0x9250d5,'ContactId':_0x10dff8['id'],'ChatWebsiteId':_0x5b8244['id']});}})[_0xc846('0x25')](function(_0x575e03){_0x2fa7fc=_0x575e03;if(_0x26861d[_0xc846('0x4e')]){var _0x143eb0=_0x26861d['map'](function(_0x518912){return{'name':_0x518912[_0xc846('0xd9')],'basename':_0x518912[_0xc846('0x74')],'type':_0x518912['mimetype'],'ChatOfflineMessageId':_0x575e03['id']};});_0x58d1d7=_0x143eb0['map'](_0x5adc93=>{var _0x499cd9={'filename':_0x5adc93[_0xc846('0x3f')],'path':path[_0xc846('0x7a')](config['root'],_0xc846('0xda'),_0xc846('0xcd'),_0xc846('0xdb'),_0xc846('0xdc'),_0x5adc93['basename'])};return _0x499cd9;});if(!_0x5b8244['openNewInteraction']){return db[_0xc846('0xdd')][_0xc846('0xde')](function(_0x5915d6){return db[_0xc846('0xdf')][_0xc846('0xe0')](_0x143eb0,{'transaction':_0x5915d6});});}}})[_0xc846('0x25')](function(){if(_0x2fa7fc){_0xb28d8a=_0x2fa7fc;return db[_0xc846('0xe1')][_0xc846('0x6a')]({'where':{'active':!![]},'include':[{'model':db[_0xc846('0xe2')],'as':_0xc846('0xe3'),'raw':!![]}]});}})[_0xc846('0x25')](function(_0x281b3a){if(_0x281b3a&&_0x281b3a[_0xc846('0xe3')]&&_0x5b8244[_0xc846('0xe4')]&&_0x5b8244[_0xc846('0xe5')]){var _0xefb26a={'tls':{'rejectUnauthorized':![]}};if(_0x281b3a[_0xc846('0xe3')][_0xc846('0xe6')]){_0xefb26a[_0xc846('0xe6')]=_0x281b3a[_0xc846('0xe3')][_0xc846('0xe6')];}else{_0xefb26a[_0xc846('0xe7')]=_0x281b3a[_0xc846('0xe3')]['host'];_0xefb26a['port']=_0x281b3a['Smtp'][_0xc846('0xe8')];_0xefb26a[_0xc846('0xe9')]=_0x281b3a[_0xc846('0xe3')]['secure'];}if(_0x281b3a[_0xc846('0xe3')][_0xc846('0xea')]){_0xefb26a[_0xc846('0xeb')]={'user':_0x281b3a[_0xc846('0xe3')][_0xc846('0x60')],'pass':_0x281b3a[_0xc846('0xe3')][_0xc846('0xec')]};}return respondWithRpcPromise(_0xc846('0xed'),'sendMail',{'account':_0xefb26a,'message':{'from':util['format'](_0xc846('0xee'),_0x281b3a['name'],_0x281b3a[_0xc846('0xef')]||_0x281b3a['Smtp'][_0xc846('0x60')]),'to':_0x5b8244[_0xc846('0xe5')],'subject':_0x5b8244[_0xc846('0xf0')],'html':_0xb28d8a[_0xc846('0x65')],'attachments':_0x58d1d7}},client9003)[_0xc846('0x25')](function(){return _0xb28d8a;})[_0xc846('0x30')](function(_0x2577ff){console[_0xc846('0x2c')](_0x2577ff);});}})[_0xc846('0x25')](function(){if(_0x5b8244&&_0x5b8244[_0xc846('0xf1')]&&_0x5b8244[_0xc846('0xf2')]){var _0x4e191e=[];if(_0x26861d[_0xc846('0x4e')]){_0x4e191e=_0x26861d[_0xc846('0x42')](function(_0x3557a2){return{'name':_0x3557a2[_0xc846('0xd9')],'basename':_0x3557a2[_0xc846('0x74')],'type':_0x3557a2[_0xc846('0xf3')],'ChatOfflineMessageId':_0x2fa7fc['id']};});}var _0x11521b;if(!_['isNil'](_0x5b8244[_0xc846('0xf4')])){var _0x46cbc9=_[_0xc846('0x42')](_0xa5f2ec[_0xc846('0x65')],function(_0x5c4501){return _0x5c4501;});var _0x4015af=_[_0xc846('0xf5')](_0x46cbc9)[0x0];var _0x5909f5=_[_0xc846('0xf6')](_0x4015af,function(_0x1b725a){return _0x1b725a;});_0x11521b=_0x5909f5[0x1][_0x5b8244[_0xc846('0xf4')]];}var _0x5cf2d0={'from':_0x1f793d[_0xc846('0xef')],'firstName':_0x1f793d['firstName'],'lastName':_0x1f793d[_0xc846('0xae')],'mapKey':_0xc846('0xef'),'message':{'from':_0x1f793d['email'],'to':_0x5b8244[_0xc846('0xe1')][_0xc846('0xef')],'cc':'','subject':_[_0xc846('0x7f')](_0x11521b)?_0x5b8244[_0xc846('0xf0')]:_0x11521b,'messageId':'','sentAt':new Date(),'attach':_0x4e191e[_0xc846('0x4e')],'attachments':_0x4e191e,'originChannel':'Chat','ChatWebsiteId':_0x5b8244['id'],'ChatOfflineMessageId':_0xb28d8a['id'],'originTo':_0x5b8244[_0xc846('0xe1')][_0xc846('0xef')]},'body':_0xb28d8a[_0xc846('0x65')]};var _0x42a24d={'account':{'id':_0x5b8244[_0xc846('0xf2')]},'body':_0x5cf2d0,'log':_0xc846('0xf7')};return respondWithRpcPromise('NotifyMailAccount',_0xc846('0xf8'),_0x42a24d,client9001)[_0xc846('0x25')](function(){return _0xb28d8a;})['catch'](function(_0x1c8e65){console[_0xc846('0x2c')](_0x1c8e65);});}return;})[_0xc846('0x25')](function(){if(_0xb28d8a){return _0xb28d8a;}})[_0xc846('0x25')](respondWithResult(_0x5606ce,null))['catch'](function(_0xb35c6){console[_0xc846('0x2c')]('catch',_0xb35c6);for(var _0x1880fb of _0x26861d){var _0x3aa4bd=path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0xda'),_0xc846('0xcd'),_0xc846('0xdb'),_0xc846('0xdc'),_0x1880fb[_0xc846('0x74')]);fs_extra[_0xc846('0xf9')](_0x3aa4bd)[_0xc846('0x30')](function(_0x18a8c9){console[_0xc846('0x2c')]('Could\x20not\x20remove\x20attachment\x20file',_0x3aa4bd,_0x18a8c9);});}});};exports['addInteraction']=function(_0x5cf978,_0x914c2d,_0x55c40b){return db['ChatInteraction'][_0xc846('0x5c')]({'where':{'id':_0x5cf978['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x914c2d,null))['then'](function(_0x258af8){if(_0x258af8){return _0x258af8[_0xc846('0xfa')](_0x5cf978[_0xc846('0x65')][_0xc846('0x70')],_[_0xc846('0xfb')](_0x5cf978['body'],['ids','id'])||{});}})[_0xc846('0x25')](respondWithResult(_0x914c2d,null))['catch'](handleError(_0x914c2d,null));};exports[_0xc846('0xfc')]=function(_0x318cad,_0x5bb3c4,_0x41ddeb){var _0x4c34f6={'raw':![],'where':{}};var _0x2be326={};var _0x37d69c={'count':0x0,'rows':[]};return db[_0xc846('0x43')][_0xc846('0x6a')]({'where':{'id':_0x318cad[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x5bb3c4,null))[_0xc846('0x25')](function(_0x144c25){if(_0x144c25){_0x2be326[_0xc846('0x48')]=_[_0xc846('0x4a')](db[_0xc846('0xba')]['rawAttributes']);_0x2be326[_0xc846('0x49')]=_['keys'](_0x318cad[_0xc846('0x49')]);_0x2be326[_0xc846('0x4b')]=_[_0xc846('0x6c')](_0x2be326[_0xc846('0x48')],_0x2be326[_0xc846('0x49')]);_0x4c34f6[_0xc846('0x4c')]=_[_0xc846('0x6c')](_0x2be326['model'],qs[_0xc846('0x4d')](_0x318cad[_0xc846('0x49')][_0xc846('0x4d')]));_0x4c34f6[_0xc846('0x4c')]=_0x4c34f6[_0xc846('0x4c')][_0xc846('0x4e')]?_0x4c34f6['attributes']:_0x2be326[_0xc846('0x48')];if(!_0x318cad['query'][_0xc846('0x6d')](_0xc846('0x4f'))){_0x4c34f6[_0xc846('0x37')]=qs[_0xc846('0x37')](_0x318cad['query'][_0xc846('0x37')]);_0x4c34f6['offset']=qs['offset'](_0x318cad[_0xc846('0x49')][_0xc846('0x34')]);}_0x4c34f6[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x318cad[_0xc846('0x49')][_0xc846('0x50')]);_0x4c34f6[_0xc846('0x54')]=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x318cad[_0xc846('0x49')],_0x2be326[_0xc846('0x4b')]));_0x4c34f6[_0xc846('0x54')][_0xc846('0x69')]=_0x144c25['id'];if(_0x318cad['query'][_0xc846('0x52')]){_0x4c34f6[_0xc846('0x54')]=_[_0xc846('0x53')](_0x4c34f6[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x4c34f6[_0xc846('0x4c')],function(_0x535db0){var _0x3f7d75={};_0x3f7d75[_0x535db0]={'$like':'%'+_0x318cad[_0xc846('0x49')][_0xc846('0x52')]+'%'};return _0x3f7d75;})});}_0x4c34f6=_['merge']({},_0x4c34f6,_0x318cad[_0xc846('0x56')]);return db[_0xc846('0xba')]['count']({'where':_0x4c34f6[_0xc846('0x54')]})['then'](function(_0x552225){_0x37d69c[_0xc846('0x36')]=_0x552225;if(_0x318cad['query']['includeAll']){_0x4c34f6[_0xc846('0x58')]=[{'model':db['CmContact'],'as':_0xc846('0xfd'),'required':![]},{'model':db[_0xc846('0xfe')],'as':_0xc846('0xff'),'attributes':[_0xc846('0x3f'),'fullname',_0xc846('0x100')],'required':![]},{'model':db['Tag'],'as':_0xc846('0x101'),'attributes':['id',_0xc846('0x3f'),_0xc846('0x102')],'where':_0x318cad['query']['tag']?{'id':_0x318cad[_0xc846('0x49')][_0xc846('0x103')]}:undefined,'required':_0x318cad[_0xc846('0x49')][_0xc846('0x103')]?!![]:![]}];}return db[_0xc846('0xba')][_0xc846('0x59')](_0x4c34f6);})[_0xc846('0x25')](function(_0x212692){_0x37d69c['rows']=_0x212692;return _0x37d69c;});}})['then'](respondWithFilteredResult(_0x5bb3c4,_0x4c34f6))[_0xc846('0x30')](handleError(_0x5bb3c4,null));};function iftimePromise(_0x41fbb5,_0x462dca){return respondWithRpcPromise(_0xc846('0x104'),_0xc846('0x105'),{'command':_0x462dca[_0xc846('0x106')]?util[_0xc846('0xb4')](_0xc846('0x107'),_0x41fbb5[_0xc846('0x108')],_0x462dca['timezone']):util[_0xc846('0xb4')](_0xc846('0x109'),_0x41fbb5[_0xc846('0x108')])},client9002)[_0xc846('0x25')](function(_0x5e55f8){var _0x204981=_0x5e55f8&&_0x5e55f8['indexOf'](_0xc846('0x10a'))>=0x0?!![]:![];logger[_0xc846('0x26')](_0xc846('0x10b'),_0x462dca['id'],_0x41fbb5['id'],_0x41fbb5[_0xc846('0x108')],_0x204981?'ONLINE':_0xc846('0x10c'),_0x462dca[_0xc846('0x106')]?_0x462dca['timezone']:'No\x20timezone');return _0x204981;})[_0xc846('0x30')](function(_0x49af0e){logger[_0xc846('0x2c')](_0xc846('0x10b'),_0x462dca['id'],_0x41fbb5['id'],_0x41fbb5['interval'],util[_0xc846('0x10d')](_0x49af0e,{'showHidden':![],'depth':null}),_0x462dca[_0xc846('0x106')]?_0x462dca['timezone']:'No\x20timezone');return![];});}exports[_0xc846('0x105')]=function(_0x515796,_0x3f4526,_0x512726){var _0x56b03d=0x0;var _0xd53cd7=0x0;var _0x30ec09=![];var _0x40496e;var _0x4696ce;return db[_0xc846('0x43')]['find']({'where':{'id':_0x515796[_0xc846('0x5b')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0xc846('0x10e'),'attributes':['id',_0xc846('0x108')],'raw':!![]}]}]})[_0xc846('0x25')](handleEntityNotFound(_0x3f4526,null))[_0xc846('0x25')](function(_0x5ce31d){if(_0x5ce31d){_0x40496e=_0x5ce31d;return _0x5ce31d[_0xc846('0x10f')]({'raw':!![]});}})[_0xc846('0x25')](function(_0x45ced6){if(_0x40496e){if(_0x45ced6){_0x4696ce=_0x45ced6;}}return require('../../config/license/util')[_0xc846('0x7e')]();})[_0xc846('0x25')](function(_0xf2ef34){if(_0xf2ef34){_0xd53cd7=_0xf2ef34['virtual'];_0x30ec09=_0xf2ef34[_0xc846('0x110')];}})[_0xc846('0x25')](function(){return db[_0xc846('0xba')][_0xc846('0x36')]({'where':{'closed':![]}});})[_0xc846('0x25')](function(_0x5865a6){_0x56b03d=_0x5865a6;if(_0xd53cd7&&_0x5865a6>_0xd53cd7){return db[_0xc846('0x111')][_0xc846('0x6a')]({'where':{'id':0x1}})[_0xc846('0x25')](function(_0x389ae0){if(_0x389ae0){_0x389ae0[_0xc846('0x112')](_0xc846('0x113'));}});}})[_0xc846('0x25')](function(){if(_0x40496e[_0xc846('0x114')]&&_0x40496e[_0xc846('0x114')]['Intervals']){var _0x4770cb=[];for(var _0x4ed7f2=0x0;_0x4ed7f2<_0x40496e[_0xc846('0x114')][_0xc846('0x10e')][_0xc846('0x4e')];_0x4ed7f2++){var _0x274f4d=_0x40496e[_0xc846('0x114')]['Intervals'][_0x4ed7f2]['get']({'plain':!![]});_0x4770cb[_0xc846('0x115')](iftimePromise(_0x274f4d,_0x40496e));}return BPromise[_0xc846('0x116')](_0x4770cb)[_0xc846('0x25')](function(_0x1d7c85){return _[_0xc846('0x117')](_0x1d7c85);});}else{return!![];}})['then'](function(_0x21877f){var _0x2d8bbc=fs[_0xc846('0xd2')](path[_0xc846('0x7a')](config[_0xc846('0x7b')],_0xc846('0x118')),_0xc846('0xd4'));var _0x1826de={'remote':_0x40496e[_0xc846('0x119')],'query':querystring[_0xc846('0x2b')](_[_0xc846('0x53')](_0x40496e['get']({'plain':!![]}),{'customerIp':_0x515796['headers']['x-forwarded-for']||_0x515796[_0xc846('0x8c')]['x-real-ip']||_0x515796[_0xc846('0x11a')][_0xc846('0x11b')]||_0x515796['ip'],'referer':_0x515796['headers']['referer'],'openedInteractions':_0x56b03d,'maxInteractions':_0xd53cd7,'virtual':_0x30ec09[_0xc846('0x11c')],'online':_0x21877f,'custom':_0x30ec09}))[_0xc846('0x11d')](/'/g,'\x5c\x27')};_0x3f4526['send'](ejs['render'](Mustache[_0xc846('0xd5')](_0x2d8bbc,_0x1826de),{'proactiveActions':_0x4696ce,'alignment':_0x40496e[_0xc846('0x11e')],'verticalAlignment':_0x40496e['verticalAlignment'],'div_color':_0x40496e['color'],'text_color':_0x40496e['textColor'],'button_color':_0x40496e[_0xc846('0x11f')],'background_color':_0x40496e['backgroundColor']}));})[_0xc846('0x30')](handleError(_0x3f4526,null));};exports[_0xc846('0x120')]=function(_0x557546,_0xd47a6f,_0x48bdce){return db[_0xc846('0x43')][_0xc846('0x6a')]({'where':{'id':_0x557546['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0xd47a6f,null))[_0xc846('0x25')](function(_0x592466){if(_0x592466){return db[_0xc846('0xdd')]['transaction'](function(_0x1b2c4d){return db[_0xc846('0x121')][_0xc846('0x3c')]({'where':{'ChatWebsiteId':_0x557546[_0xc846('0x5b')]['id']},'transaction':_0x1b2c4d})[_0xc846('0x25')](function(_0xfdcf40){var _0xd47ab9=_[_0xc846('0x42')](_0x557546[_0xc846('0x65')],function(_0x2e394f){_0x2e394f[_0xc846('0x69')]=_0x557546[_0xc846('0x5b')]['id'];return _0x2e394f;});return db[_0xc846('0x121')][_0xc846('0xe0')](_0xd47ab9,{'transaction':_0x1b2c4d});});})[_0xc846('0x25')](function(){return db['ChatApplication'][_0xc846('0x122')]({'where':{'ChatWebsiteId':_0x557546['params']['id']},'order':_0xc846('0xa4')});});}})[_0xc846('0x25')](respondWithResult(_0xd47a6f,null))[_0xc846('0x30')](handleError(_0xd47a6f,null));};exports[_0xc846('0x123')]=function(_0x1df88b,_0x13d816,_0x449178){var _0x45b86f={};var _0x4cc798={};var _0x3da5b8;var _0x1735f3;return db[_0xc846('0x43')]['findOne']({'where':{'id':_0x1df88b[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x13d816,null))[_0xc846('0x25')](function(_0x349f8e){if(_0x349f8e){_0x3da5b8=_0x349f8e;_0x4cc798['model']=_[_0xc846('0x4a')](db[_0xc846('0x121')][_0xc846('0x44')]);_0x4cc798[_0xc846('0x49')]=_[_0xc846('0x4a')](_0x1df88b['query']);_0x4cc798[_0xc846('0x4b')]=_[_0xc846('0x6c')](_0x4cc798[_0xc846('0x48')],_0x4cc798[_0xc846('0x49')]);_0x45b86f[_0xc846('0x4c')]=_[_0xc846('0x6c')](_0x4cc798[_0xc846('0x48')],qs['fields'](_0x1df88b[_0xc846('0x49')][_0xc846('0x4d')]));_0x45b86f[_0xc846('0x4c')]=_0x45b86f[_0xc846('0x4c')][_0xc846('0x4e')]?_0x45b86f[_0xc846('0x4c')]:_0x4cc798[_0xc846('0x48')];_0x45b86f[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x1df88b[_0xc846('0x49')][_0xc846('0x50')]);_0x45b86f[_0xc846('0x54')]=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x1df88b[_0xc846('0x49')],_0x4cc798['filters']));if(_0x1df88b['query'][_0xc846('0x52')]){_0x45b86f['where']=_[_0xc846('0x53')](_0x45b86f[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x45b86f[_0xc846('0x4c')],function(_0x5461a9){var _0x554b5f={};_0x554b5f[_0x5461a9]={'$like':'%'+_0x1df88b[_0xc846('0x49')][_0xc846('0x52')]+'%'};return _0x554b5f;})});}_0x45b86f=_[_0xc846('0x53')]({},_0x45b86f,_0x1df88b['options']);return _0x3da5b8[_0xc846('0x123')](_0x45b86f);}})[_0xc846('0x25')](function(_0x1dc0f4){if(_0x1dc0f4){_0x1735f3=_0x1dc0f4[_0xc846('0x4e')];if(!_0x1df88b['query']['hasOwnProperty']('nolimit')){_0x45b86f[_0xc846('0x37')]=qs[_0xc846('0x37')](_0x1df88b[_0xc846('0x49')][_0xc846('0x37')]);_0x45b86f[_0xc846('0x34')]=qs['offset'](_0x1df88b[_0xc846('0x49')][_0xc846('0x34')]);}return _0x3da5b8[_0xc846('0x123')](_0x45b86f);}})[_0xc846('0x25')](function(_0x534780){if(_0x534780){return _0x534780?{'count':_0x1735f3,'rows':_0x534780}:null;}})[_0xc846('0x25')](respondWithResult(_0x13d816,null))[_0xc846('0x30')](handleError(_0x13d816,null));};exports[_0xc846('0x124')]=function(_0x23621b,_0x1bafaf,_0x52334d){return db[_0xc846('0x125')][_0xc846('0x5c')]({'where':{'id':_0x23621b[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x1bafaf,null))['then'](function(_0x49e620){if(_0x49e620){return _0x49e620[_0xc846('0x124')](_0x23621b['body'][_0xc846('0x70')],_[_0xc846('0xfb')](_0x23621b[_0xc846('0x65')],[_0xc846('0x70'),'id'])||{});}})[_0xc846('0x25')](respondWithResult(_0x1bafaf,null))[_0xc846('0x30')](handleError(_0x1bafaf,null));};exports[_0xc846('0x10f')]=function(_0xb6dab8,_0x2df87a,_0x2c4fb2){var _0x25a94f={};var _0x42d47e={};var _0x4c5885;var _0x462d28;return db[_0xc846('0x43')]['findOne']({'where':{'id':_0xb6dab8['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x2df87a,null))[_0xc846('0x25')](function(_0x4f928b){if(_0x4f928b){_0x4c5885=_0x4f928b;_0x42d47e[_0xc846('0x48')]=_['keys'](db[_0xc846('0x126')]['rawAttributes']);_0x42d47e[_0xc846('0x49')]=_[_0xc846('0x4a')](_0xb6dab8[_0xc846('0x49')]);_0x42d47e[_0xc846('0x4b')]=_['intersection'](_0x42d47e[_0xc846('0x48')],_0x42d47e[_0xc846('0x49')]);_0x25a94f[_0xc846('0x4c')]=_[_0xc846('0x6c')](_0x42d47e['model'],qs['fields'](_0xb6dab8['query']['fields']));_0x25a94f[_0xc846('0x4c')]=_0x25a94f[_0xc846('0x4c')][_0xc846('0x4e')]?_0x25a94f['attributes']:_0x42d47e[_0xc846('0x48')];_0x25a94f['order']=qs[_0xc846('0x50')](_0xb6dab8[_0xc846('0x49')]['sort']);_0x25a94f['where']=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0xb6dab8['query'],_0x42d47e[_0xc846('0x4b')]));if(_0xb6dab8['query'][_0xc846('0x52')]){_0x25a94f[_0xc846('0x54')]=_[_0xc846('0x53')](_0x25a94f['where'],{'$or':_['map'](_0x25a94f[_0xc846('0x4c')],function(_0x481112){var _0xf0f439={};_0xf0f439[_0x481112]={'$like':'%'+_0xb6dab8[_0xc846('0x49')][_0xc846('0x52')]+'%'};return _0xf0f439;})});}_0x25a94f=_[_0xc846('0x53')]({},_0x25a94f,_0xb6dab8[_0xc846('0x56')]);return _0x4c5885[_0xc846('0x10f')](_0x25a94f);}})[_0xc846('0x25')](function(_0x249659){if(_0x249659){_0x462d28=_0x249659['length'];if(!_0xb6dab8[_0xc846('0x49')][_0xc846('0x6d')](_0xc846('0x4f'))){_0x25a94f[_0xc846('0x37')]=qs[_0xc846('0x37')](_0xb6dab8['query'][_0xc846('0x37')]);_0x25a94f[_0xc846('0x34')]=qs[_0xc846('0x34')](_0xb6dab8[_0xc846('0x49')]['offset']);}return _0x4c5885[_0xc846('0x10f')](_0x25a94f);}})[_0xc846('0x25')](function(_0x1a7d42){if(_0x1a7d42){return _0x1a7d42?{'count':_0x462d28,'rows':_0x1a7d42}:null;}})['then'](respondWithResult(_0x2df87a,null))[_0xc846('0x30')](handleError(_0x2df87a,null));};exports[_0xc846('0x127')]=function(_0x41e94,_0x2572bb,_0x2c30bf){var _0x379ee4=_0x41e94['query'][_0xc846('0x128')]==='false'?_0xc846('0x129'):_0xc846('0x12a');return db[_0xc846('0x43')]['find']({'attributes':['id',_0x379ee4],'where':{'id':_0x41e94[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x2572bb,null))[_0xc846('0x25')](function(_0x2a409e){if(_0x2a409e){var _0x479727=_0x2a409e[_0x379ee4];var _0x507913=_0x479727&&_0x479727[_0xc846('0x12b')]?_0x479727[_0xc846('0x12b')]:[];_0x2572bb[_0xc846('0xce')]({'fromKey':_[_0xc846('0x7f')](_0x479727[_0xc846('0x12c')])?undefined:_0x479727[_0xc846('0x12c')],'count':_0x507913['length'],'rows':_0x507913});}})[_0xc846('0x30')](handleError(_0x2572bb,null));};exports[_0xc846('0x12d')]=function(_0x2a09b4,_0x126064,_0x4f6ed9){var _0x102c76={'raw':![],'where':{}};var _0x2555ad={};var _0xa6447b={'count':0x0,'rows':[]};return db[_0xc846('0x43')]['findOne']({'where':{'id':_0x2a09b4[_0xc846('0x5b')]['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x126064,null))[_0xc846('0x25')](function(_0x1f9d15){if(_0x1f9d15){_0x2555ad[_0xc846('0x48')]=_[_0xc846('0x4a')](db[_0xc846('0xd8')][_0xc846('0x44')]);_0x2555ad['query']=_[_0xc846('0x4a')](_0x2a09b4[_0xc846('0x49')]);_0x2555ad[_0xc846('0x4b')]=_[_0xc846('0x6c')](_0x2555ad[_0xc846('0x48')],_0x2555ad['query']);_0x102c76[_0xc846('0x4c')]=_['intersection'](_0x2555ad[_0xc846('0x48')],qs[_0xc846('0x4d')](_0x2a09b4[_0xc846('0x49')][_0xc846('0x4d')]));_0x102c76[_0xc846('0x4c')]=_0x102c76['attributes'][_0xc846('0x4e')]?_0x102c76[_0xc846('0x4c')]:_0x2555ad['model'];if(!_0x2a09b4[_0xc846('0x49')][_0xc846('0x6d')]('nolimit')){_0x102c76[_0xc846('0x37')]=qs[_0xc846('0x37')](_0x2a09b4['query'][_0xc846('0x37')]);_0x102c76[_0xc846('0x34')]=qs[_0xc846('0x34')](_0x2a09b4[_0xc846('0x49')][_0xc846('0x34')]);}_0x102c76[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x2a09b4['query']['sort']);_0x102c76['where']=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x2a09b4[_0xc846('0x49')],_0x2555ad[_0xc846('0x4b')]));_0x102c76['where']['ChatWebsiteId']=_0x1f9d15['id'];if(_0x2a09b4[_0xc846('0x49')][_0xc846('0x52')]){_0x102c76['where']=_[_0xc846('0x53')](_0x102c76[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x102c76[_0xc846('0x4c')],function(_0x4739ee){var _0x547e3a={};_0x547e3a[_0x4739ee]={'$like':'%'+_0x2a09b4['query'][_0xc846('0x52')]+'%'};return _0x547e3a;})});}_0x102c76=_['merge']({},_0x102c76,_0x2a09b4[_0xc846('0x56')]);return db[_0xc846('0xd8')][_0xc846('0x36')]({'where':_0x102c76['where']})[_0xc846('0x25')](function(_0x172af5){_0xa6447b[_0xc846('0x36')]=_0x172af5;if(_0x2a09b4[_0xc846('0x49')]['includeAll']){_0x102c76['include']=[{'all':!![]}];}else{_0x102c76[_0xc846('0x58')]=[{'model':db[_0xc846('0x90')],'as':_0xc846('0xfd'),'required':![]},{'model':db['Attachment'],'as':_0xc846('0x12e'),'required':![]}];}return db['ChatOfflineMessage'][_0xc846('0x59')](_0x102c76);})[_0xc846('0x25')](function(_0x181609){_0xa6447b[_0xc846('0x5a')]=_0x181609;return _0xa6447b;});}})[_0xc846('0x25')](respondWithFilteredResult(_0x126064,_0x102c76))[_0xc846('0x30')](handleError(_0x126064,null));};exports[_0xc846('0x12f')]=function(_0xd6628,_0x2e91b7,_0x5b35cc){return db['ChatWebsite'][_0xc846('0x5c')]({'where':{'id':_0xd6628['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x2e91b7,null))['then'](function(_0x50a2b9){if(_0x50a2b9){return _0x50a2b9[_0xc846('0x12f')](_0xd6628['body'][_0xc846('0x70')],_[_0xc846('0xfb')](_0xd6628[_0xc846('0x65')],[_0xc846('0x70'),'id'])||{})[_0xc846('0xbe')](function(_0x50e95c){for(var _0x108b3e=0x0;_0x108b3e<_0xd6628[_0xc846('0x65')][_0xc846('0x70')][_0xc846('0x4e')];_0x108b3e+=0x1){socket[_0xc846('0x130')](_0xc846('0x131'),{'UserId':Number(_0xd6628[_0xc846('0x65')][_0xc846('0x70')][_0x108b3e]),'ChatWebsiteId':Number(_0xd6628[_0xc846('0x5b')]['id'])});}return _0x50e95c;});}})['then'](respondWithResult(_0x2e91b7,null))[_0xc846('0x30')](handleError(_0x2e91b7,null));};exports[_0xc846('0x132')]=function(_0xe66915,_0x17c147,_0x35e4a7){return db[_0xc846('0x43')][_0xc846('0x5c')]({'where':{'id':_0xe66915['params']['id']}})['then'](handleEntityNotFound(_0x17c147,null))[_0xc846('0x25')](function(_0x57882a){if(_0x57882a){return _0x57882a['removeAgents'](_0xe66915[_0xc846('0x49')][_0xc846('0x70')])[_0xc846('0x25')](function(){if(_[_0xc846('0x133')](_0xe66915[_0xc846('0x49')][_0xc846('0x70')])){for(var _0x3e67d9=0x0;_0x3e67d9<_0xe66915[_0xc846('0x49')]['ids'][_0xc846('0x4e')];_0x3e67d9+=0x1){socket[_0xc846('0x130')](_0xc846('0x134'),{'UserId':Number(_0xe66915['query'][_0xc846('0x70')][_0x3e67d9]),'ChatWebsiteId':Number(_0xe66915[_0xc846('0x5b')]['id'])});}}else{socket[_0xc846('0x130')]('userChatWebsite:remove',{'UserId':Number(_0xe66915[_0xc846('0x49')][_0xc846('0x70')]),'ChatWebsiteId':Number(_0xe66915[_0xc846('0x5b')]['id'])});}});}})[_0xc846('0x25')](respondWithStatusCode(_0x17c147,null))[_0xc846('0x30')](handleError(_0x17c147,null));};exports[_0xc846('0x135')]=function(_0x307951,_0x436858,_0x134a15){var _0x43a9a8={};var _0x111173={};var _0x44157e;var _0x19e7d7;return db[_0xc846('0x43')]['findOne']({'where':{'id':_0x307951['params']['id']}})[_0xc846('0x25')](handleEntityNotFound(_0x436858,null))['then'](function(_0x3d720e){if(_0x3d720e){_0x44157e=_0x3d720e;_0x111173['model']=_[_0xc846('0x4a')](db[_0xc846('0xfe')][_0xc846('0x44')]);_0x111173[_0xc846('0x49')]=_['keys'](_0x307951[_0xc846('0x49')]);_0x111173[_0xc846('0x4b')]=_[_0xc846('0x6c')](_0x111173[_0xc846('0x48')],_0x111173[_0xc846('0x49')]);_0x43a9a8[_0xc846('0x4c')]=_['intersection'](_0x111173[_0xc846('0x48')],qs[_0xc846('0x4d')](_0x307951[_0xc846('0x49')][_0xc846('0x4d')]));_0x43a9a8[_0xc846('0x4c')]=_0x43a9a8[_0xc846('0x4c')][_0xc846('0x4e')]?_0x43a9a8[_0xc846('0x4c')]:_0x111173[_0xc846('0x48')];_0x43a9a8[_0xc846('0x6e')]=qs[_0xc846('0x50')](_0x307951[_0xc846('0x49')][_0xc846('0x50')]);_0x43a9a8[_0xc846('0x54')]=qs[_0xc846('0x4b')](_[_0xc846('0x51')](_0x307951[_0xc846('0x49')],_0x111173[_0xc846('0x4b')]));if(_0x307951[_0xc846('0x49')][_0xc846('0x52')]){_0x43a9a8[_0xc846('0x54')]=_[_0xc846('0x53')](_0x43a9a8[_0xc846('0x54')],{'$or':_[_0xc846('0x42')](_0x43a9a8[_0xc846('0x4c')],function(_0x27ec5a){var _0x102197={};_0x102197[_0x27ec5a]={'$like':'%'+_0x307951['query'][_0xc846('0x52')]+'%'};return _0x102197;})});}_0x43a9a8=_['merge']({},_0x43a9a8,_0x307951['options']);return _0x44157e[_0xc846('0x135')](_0x43a9a8);}})[_0xc846('0x25')](function(_0x56fac6){if(_0x56fac6){_0x19e7d7=_0x56fac6['length'];if(!_0x307951[_0xc846('0x49')][_0xc846('0x6d')](_0xc846('0x4f'))){_0x43a9a8['limit']=qs[_0xc846('0x37')](_0x307951['query'][_0xc846('0x37')]);_0x43a9a8[_0xc846('0x34')]=qs[_0xc846('0x34')](_0x307951[_0xc846('0x49')]['offset']);}return _0x44157e['getAgents'](_0x43a9a8);}})[_0xc846('0x25')](function(_0xe02db9){if(_0xe02db9){return _0xe02db9?{'count':_0x19e7d7,'rows':_0xe02db9}:null;}})['then'](respondWithResult(_0x436858,null))[_0xc846('0x30')](handleError(_0x436858,null));}; \ No newline at end of file +var _0xfca8=['from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','asc','defaults','ListId','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','get','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','CmContact','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','utf8','toPairs','ChatOfflineMessage','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','fullname','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','save','update','destroy','ChatWebsites','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','pick','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','notify','user-agent-parser','setUA','user-agent','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x27a0a9,_0x1e7dd1){var _0x11cb3b=function(_0x5a9aa3){while(--_0x5a9aa3){_0x27a0a9['push'](_0x27a0a9['shift']());}};_0x11cb3b(++_0x1e7dd1);}(_0xfca8,0x9f));var _0x8fca=function(_0x50ed26,_0x35e931){_0x50ed26=_0x50ed26-0x0;var _0x11d383=_0xfca8[_0x50ed26];return _0x11d383;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fca('0x0'));var zipdir=require(_0x8fca('0x1'));var jsonpatch=require(_0x8fca('0x2'));var rp=require(_0x8fca('0x3'));var moment=require(_0x8fca('0x4'));var BPromise=require(_0x8fca('0x5'));var Mustache=require(_0x8fca('0x6'));var util=require(_0x8fca('0x7'));var path=require(_0x8fca('0x8'));var sox=require(_0x8fca('0x9'));var csv=require(_0x8fca('0xa'));var ejs=require(_0x8fca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fca('0xc'));var squel=require(_0x8fca('0xd'));var crypto=require(_0x8fca('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8fca('0xa'));var querystring=require(_0x8fca('0xf'));var Papa=require(_0x8fca('0x10'));var Redis=require(_0x8fca('0x11'));var authService=require(_0x8fca('0x12'));var qs=require(_0x8fca('0x13'));var as=require(_0x8fca('0x14'));var hardwareService=require(_0x8fca('0x15'));var logger=require(_0x8fca('0x16'))(_0x8fca('0x17'));var utils=require('../../config/utils');var config=require(_0x8fca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fca('0x19'))['db'];config[_0x8fca('0x1a')]=_['defaults'](config['redis'],{'host':_0x8fca('0x1b'),'port':0x18eb});var socket=require(_0x8fca('0x1c'))(new Redis(config[_0x8fca('0x1a')]));require('./chatWebsite.socket')[_0x8fca('0x1d')](socket);var jayson=require(_0x8fca('0x1e'));var client=jayson[_0x8fca('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x8fca('0x1f')][_0x8fca('0x20')]({'port':0x232a});var client9003=jayson[_0x8fca('0x1f')][_0x8fca('0x20')]({'port':0x232b});var client9001=jayson[_0x8fca('0x1f')][_0x8fca('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x5f13f8,_0x32073f,_0x8db5f7,_0x2d82dd){return new BPromise(function(_0x489db9,_0x30c8fc){var _0x4070ff=_0x2d82dd||client;return _0x4070ff[_0x8fca('0x21')](_0x5f13f8,_0x8db5f7)[_0x8fca('0x22')](function(_0x4f3a5e){logger['info'](_0x8fca('0x23'),_0x32073f,_0x8fca('0x24'));logger[_0x8fca('0x25')](_0x8fca('0x26'),_0x32073f,_0x8fca('0x24'),JSON['stringify'](_0x4f3a5e));if(_0x4f3a5e[_0x8fca('0x27')]){if(_0x4f3a5e[_0x8fca('0x27')][_0x8fca('0x28')]===0x1f4){logger[_0x8fca('0x27')](_0x8fca('0x23'),_0x32073f,_0x4f3a5e[_0x8fca('0x27')][_0x8fca('0x29')]);return _0x30c8fc(_0x4f3a5e[_0x8fca('0x27')][_0x8fca('0x29')]);}logger[_0x8fca('0x27')](_0x8fca('0x23'),_0x32073f,_0x4f3a5e[_0x8fca('0x27')][_0x8fca('0x29')]);return _0x489db9(_0x4f3a5e[_0x8fca('0x27')][_0x8fca('0x29')]);}else{logger[_0x8fca('0x2a')](_0x8fca('0x23'),_0x32073f,_0x8fca('0x24'));_0x489db9(_0x4f3a5e[_0x8fca('0x2b')][_0x8fca('0x29')]);}})['catch'](function(_0x3d6f9c){logger[_0x8fca('0x27')](_0x8fca('0x23'),_0x32073f,_0x3d6f9c);_0x30c8fc(_0x3d6f9c);});});}function respondWithStatusCode(_0x54abe8,_0x25c5f1){_0x25c5f1=_0x25c5f1||0xcc;return function(_0x1fc4b5){if(_0x1fc4b5){return _0x54abe8[_0x8fca('0x2c')](_0x25c5f1);}return _0x54abe8[_0x8fca('0x2d')](_0x25c5f1)[_0x8fca('0x2e')]();};}function respondWithResult(_0x1cdc23,_0x41953d){_0x41953d=_0x41953d||0xc8;return function(_0x2c912c){if(_0x2c912c){return _0x1cdc23[_0x8fca('0x2d')](_0x41953d)['json'](_0x2c912c);}};}function respondWithFilteredResult(_0x5bee76,_0x2de026){return function(_0x3f4241){if(_0x3f4241){var _0x4cdae5=typeof _0x2de026[_0x8fca('0x2f')]===_0x8fca('0x30')&&typeof _0x2de026['limit']==='undefined';var _0x3703bc=_0x3f4241[_0x8fca('0x31')];var _0x4b4c0f=_0x4cdae5?0x0:_0x2de026['offset'];var _0x5f1fcf=_0x4cdae5?_0x3f4241[_0x8fca('0x31')]:_0x2de026[_0x8fca('0x2f')]+_0x2de026[_0x8fca('0x32')];var _0x583d28;if(_0x5f1fcf>=_0x3703bc){_0x5f1fcf=_0x3703bc;_0x583d28=0xc8;}else{_0x583d28=0xce;}_0x5bee76['status'](_0x583d28);return _0x5bee76['set']('Content-Range',_0x4b4c0f+'-'+_0x5f1fcf+'/'+_0x3703bc)['json'](_0x3f4241);}return null;};}function patchUpdates(_0x25498f){return function(_0x4569fb){try{jsonpatch['apply'](_0x4569fb,_0x25498f,!![]);}catch(_0x55c565){return BPromise['reject'](_0x55c565);}return _0x4569fb[_0x8fca('0x33')]();};}function saveUpdates(_0x1948a7,_0x4140c4){return function(_0x44fff1){if(_0x44fff1){return _0x44fff1[_0x8fca('0x34')](_0x1948a7)[_0x8fca('0x22')](function(_0x507b0a){return _0x507b0a;});}return null;};}function removeEntity(_0x37c80b,_0x2c0985){return function(_0x705769){if(_0x705769){return _0x705769[_0x8fca('0x35')]()['then'](function(){var _0x14caba=_0x705769['get']({'plain':!![]});var _0x1a89e8=_0x8fca('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a89e8,'resourceId':_0x14caba['id']}})[_0x8fca('0x22')](function(){return _0x705769;});})['then'](function(){_0x37c80b[_0x8fca('0x2d')](0xcc)[_0x8fca('0x2e')]();});}};}function handleEntityNotFound(_0x34851b,_0x4fe063){return function(_0x35c1ed){if(!_0x35c1ed){_0x34851b[_0x8fca('0x2c')](0x194);}return _0x35c1ed;};}function handleError(_0x524615,_0x322c2f){_0x322c2f=_0x322c2f||0x1f4;return function(_0x3364be){logger[_0x8fca('0x27')](_0x3364be[_0x8fca('0x37')]);if(_0x3364be[_0x8fca('0x38')]){delete _0x3364be[_0x8fca('0x38')];}_0x524615[_0x8fca('0x2d')](_0x322c2f)[_0x8fca('0x39')](_0x3364be);};}exports[_0x8fca('0x3a')]=function(_0x3d50b1,_0x32c84f){var _0x4a2a60={'include':[{'model':db['Pause'],'as':_0x8fca('0x3b')}]},_0x54f4ff={},_0x33b894={'count':0x0,'rows':[]};var _0x3169e6=_[_0x8fca('0x3c')](db[_0x8fca('0x3d')][_0x8fca('0x3e')],function(_0x2fba36){return{'name':_0x2fba36['fieldName'],'type':_0x2fba36[_0x8fca('0x3f')][_0x8fca('0x40')]};});_0x54f4ff[_0x8fca('0x41')]=_[_0x8fca('0x3c')](_0x3169e6,_0x8fca('0x38'));_0x54f4ff[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x3d50b1[_0x8fca('0x42')]);_0x54f4ff[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x54f4ff[_0x8fca('0x41')],_0x54f4ff[_0x8fca('0x42')]);_0x4a2a60[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x54f4ff[_0x8fca('0x41')],qs['fields'](_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x47')]));_0x4a2a60[_0x8fca('0x46')]=_0x4a2a60['attributes'][_0x8fca('0x48')]?_0x4a2a60[_0x8fca('0x46')]:_0x54f4ff[_0x8fca('0x41')];if(!_0x3d50b1[_0x8fca('0x42')]['hasOwnProperty'](_0x8fca('0x49'))){_0x4a2a60[_0x8fca('0x32')]=qs[_0x8fca('0x32')](_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x32')]);_0x4a2a60[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x2f')]);}_0x4a2a60[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x4b')]);_0x4a2a60['where']=qs[_0x8fca('0x44')](_['pick'](_0x3d50b1[_0x8fca('0x42')],_0x54f4ff[_0x8fca('0x44')]),_0x3169e6);if(_0x3d50b1[_0x8fca('0x42')]['filter']){_0x4a2a60[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0x4a2a60[_0x8fca('0x4c')],{'$or':_['map'](_0x3169e6,function(_0x139c3e){if(_0x139c3e[_0x8fca('0x3f')]!==_0x8fca('0x4e')){var _0x1c70fc={};_0x1c70fc[_0x139c3e[_0x8fca('0x38')]]={'$like':'%'+_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x4f')]+'%'};return _0x1c70fc;}})});}_0x4a2a60=_[_0x8fca('0x4d')]({},_0x4a2a60,_0x3d50b1[_0x8fca('0x50')]);var _0x43f225={'where':_0x4a2a60[_0x8fca('0x4c')]};return db[_0x8fca('0x3d')][_0x8fca('0x31')](_0x43f225)['then'](function(_0x122f0c){_0x33b894['count']=_0x122f0c;if(_0x3d50b1[_0x8fca('0x42')][_0x8fca('0x51')]){_0x4a2a60['include']=[{'all':!![]}];}return db[_0x8fca('0x3d')][_0x8fca('0x52')](_0x4a2a60);})[_0x8fca('0x22')](function(_0x1f40a3){_0x33b894[_0x8fca('0x53')]=_0x1f40a3;return _0x33b894;})[_0x8fca('0x22')](respondWithFilteredResult(_0x32c84f,_0x4a2a60))[_0x8fca('0x54')](handleError(_0x32c84f,null));};exports[_0x8fca('0x55')]=function(_0x566780,_0x106dce){var _0x55951a={'raw':![],'where':{'id':_0x566780['params']['id']},'include':[{'model':db[_0x8fca('0x56')],'as':_0x8fca('0x3b')}]},_0x36f331={};_0x36f331[_0x8fca('0x41')]=_['keys'](db[_0x8fca('0x3d')][_0x8fca('0x3e')]);_0x36f331['query']=_[_0x8fca('0x43')](_0x566780['query']);_0x36f331['filters']=_['intersection'](_0x36f331[_0x8fca('0x41')],_0x36f331[_0x8fca('0x42')]);_0x55951a['attributes']=_[_0x8fca('0x45')](_0x36f331['model'],qs[_0x8fca('0x47')](_0x566780[_0x8fca('0x42')]['fields']));_0x55951a[_0x8fca('0x46')]=_0x55951a[_0x8fca('0x46')][_0x8fca('0x48')]?_0x55951a[_0x8fca('0x46')]:_0x36f331[_0x8fca('0x41')];if(_0x566780[_0x8fca('0x42')][_0x8fca('0x51')]){_0x55951a[_0x8fca('0x57')]=[{'all':!![]}];}_0x55951a=_[_0x8fca('0x4d')]({},_0x55951a,_0x566780[_0x8fca('0x50')]);return db['ChatWebsite'][_0x8fca('0x58')](_0x55951a)[_0x8fca('0x22')](handleEntityNotFound(_0x106dce,null))[_0x8fca('0x22')](respondWithResult(_0x106dce,null))[_0x8fca('0x54')](handleError(_0x106dce,null));};exports[_0x8fca('0x59')]=function(_0x2d2073,_0x17f0ae){return db[_0x8fca('0x3d')][_0x8fca('0x59')](_0x2d2073[_0x8fca('0x5a')],{})[_0x8fca('0x22')](function(_0x4a709b){var _0x2fc552=_0x2d2073[_0x8fca('0x5b')]['get']({'plain':!![]});if(!_0x2fc552)throw new Error(_0x8fca('0x5c'));if(_0x2fc552['role']===_0x8fca('0x5b')){var _0x4b376d=_0x4a709b['get']({'plain':!![]});var _0x1f376a='ChatWebsites';return db[_0x8fca('0x5d')][_0x8fca('0x58')]({'where':{'name':_0x1f376a,'userProfileId':_0x2fc552[_0x8fca('0x5e')]},'raw':!![]})[_0x8fca('0x22')](function(_0x5dcbd5){if(_0x5dcbd5&&_0x5dcbd5[_0x8fca('0x5f')]===0x0){return db['UserProfileResource'][_0x8fca('0x59')]({'name':_0x4b376d[_0x8fca('0x38')],'resourceId':_0x4b376d['id'],'type':_0x5dcbd5[_0x8fca('0x38')],'sectionId':_0x5dcbd5['id']},{})[_0x8fca('0x22')](function(){return _0x4a709b;});}else{return _0x4a709b;}})[_0x8fca('0x54')](function(_0xb78a75){logger[_0x8fca('0x27')](_0x8fca('0x60'),_0xb78a75);throw _0xb78a75;});}return _0x4a709b;})[_0x8fca('0x22')](respondWithResult(_0x17f0ae,0xc9))[_0x8fca('0x54')](handleError(_0x17f0ae,null));};exports[_0x8fca('0x34')]=function(_0x36a53f,_0x1d7cc0){if(_0x36a53f['body']['id']){delete _0x36a53f[_0x8fca('0x5a')]['id'];}return db[_0x8fca('0x3d')]['find']({'where':{'id':_0x36a53f[_0x8fca('0x61')]['id']},'include':[{'model':db[_0x8fca('0x56')],'as':_0x8fca('0x3b')}]})['then'](handleEntityNotFound(_0x1d7cc0,null))[_0x8fca('0x22')](saveUpdates(_0x36a53f[_0x8fca('0x5a')],null))[_0x8fca('0x22')](respondWithResult(_0x1d7cc0,null))['catch'](handleError(_0x1d7cc0,null));};exports[_0x8fca('0x35')]=function(_0xf97f05,_0x4e5456){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0xf97f05[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x4e5456,null))[_0x8fca('0x22')](removeEntity(_0x4e5456,null))[_0x8fca('0x54')](handleError(_0x4e5456,null));};exports[_0x8fca('0x62')]=function(_0x4dffcc,_0x570056){return db[_0x8fca('0x3d')][_0x8fca('0x62')]()['then'](respondWithResult(_0x570056,null))['catch'](handleError(_0x570056,null));};exports[_0x8fca('0x63')]=function(_0x2be17f,_0x58e1df,_0x9c5104){if(_0x2be17f['body']['id']){delete _0x2be17f[_0x8fca('0x5a')]['id'];}return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x2be17f['params']['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x58e1df,null))['then'](function(_0x356435){if(_0x356435){_0x2be17f[_0x8fca('0x5a')][_0x8fca('0x64')]=_0x356435['id'];return db[_0x8fca('0x65')]['create'](_0x2be17f[_0x8fca('0x5a')]);}})['then'](respondWithResult(_0x58e1df,null))['catch'](handleError(_0x58e1df,null));};exports[_0x8fca('0x66')]=function(_0x13a9b4,_0x5ba6a7,_0x1ae7e1){var _0x540c5a={'raw':![],'where':{}};var _0x3b1487={};var _0x905d46={'count':0x0,'rows':[]};return db[_0x8fca('0x3d')]['findOne']({'where':{'id':_0x13a9b4[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x5ba6a7,null))['then'](function(_0x38fab6){if(_0x38fab6){_0x3b1487['model']=_[_0x8fca('0x43')](db['Disposition'][_0x8fca('0x3e')]);_0x3b1487['query']=_[_0x8fca('0x43')](_0x13a9b4[_0x8fca('0x42')]);_0x3b1487[_0x8fca('0x44')]=_['intersection'](_0x3b1487['model'],_0x3b1487[_0x8fca('0x42')]);_0x540c5a[_0x8fca('0x46')]=_['intersection'](_0x3b1487[_0x8fca('0x41')],qs[_0x8fca('0x47')](_0x13a9b4[_0x8fca('0x42')]['fields']));_0x540c5a['attributes']=_0x540c5a['attributes'][_0x8fca('0x48')]?_0x540c5a[_0x8fca('0x46')]:_0x3b1487[_0x8fca('0x41')];if(!_0x13a9b4['query'][_0x8fca('0x67')](_0x8fca('0x49'))){_0x540c5a[_0x8fca('0x32')]=qs['limit'](_0x13a9b4[_0x8fca('0x42')][_0x8fca('0x32')]);_0x540c5a[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x13a9b4['query'][_0x8fca('0x2f')]);}_0x540c5a[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x13a9b4[_0x8fca('0x42')]['sort']);_0x540c5a[_0x8fca('0x4c')]=qs['filters'](_[_0x8fca('0x68')](_0x13a9b4['query'],_0x3b1487['filters']));_0x540c5a[_0x8fca('0x4c')][_0x8fca('0x64')]=_0x38fab6['id'];if(_0x13a9b4[_0x8fca('0x42')][_0x8fca('0x4f')]){_0x540c5a[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0x540c5a['where'],{'$or':_[_0x8fca('0x3c')](_0x540c5a[_0x8fca('0x46')],function(_0xa5be01){var _0x14e2c8={};_0x14e2c8[_0xa5be01]={'$like':'%'+_0x13a9b4[_0x8fca('0x42')]['filter']+'%'};return _0x14e2c8;})});}_0x540c5a=_[_0x8fca('0x4d')]({},_0x540c5a,_0x13a9b4[_0x8fca('0x50')]);return db[_0x8fca('0x65')]['count']({'where':_0x540c5a[_0x8fca('0x4c')]})[_0x8fca('0x22')](function(_0x581a79){_0x905d46[_0x8fca('0x31')]=_0x581a79;if(_0x13a9b4['query'][_0x8fca('0x51')]){_0x540c5a[_0x8fca('0x57')]=[{'all':!![]}];}return db[_0x8fca('0x65')][_0x8fca('0x52')](_0x540c5a);})[_0x8fca('0x22')](function(_0x25b04d){_0x905d46[_0x8fca('0x53')]=_0x25b04d;return _0x905d46;});}})['then'](respondWithFilteredResult(_0x5ba6a7,_0x540c5a))[_0x8fca('0x54')](handleError(_0x5ba6a7,null));};exports[_0x8fca('0x69')]=function(_0x577ae2,_0x143e30,_0x3a8c8c){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x577ae2['params']['id']}})['then'](handleEntityNotFound(_0x143e30,null))['then'](function(_0x3ba9ec){if(_0x3ba9ec){return _0x3ba9ec[_0x8fca('0x69')](_0x577ae2[_0x8fca('0x42')][_0x8fca('0x6a')]);}})[_0x8fca('0x22')](respondWithStatusCode(_0x143e30,null))['catch'](handleError(_0x143e30,null));};exports['addAnswer']=function(_0x4374c5,_0x1d7cb4,_0x326c49){if(_0x4374c5[_0x8fca('0x5a')]['id']){delete _0x4374c5['body']['id'];}return db['ChatWebsite'][_0x8fca('0x58')]({'where':{'id':_0x4374c5[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0x1d7cb4,null))['then'](function(_0x2dbcda){if(_0x2dbcda){_0x4374c5[_0x8fca('0x5a')]['ChatWebsiteId']=_0x2dbcda['id'];return db[_0x8fca('0x6b')]['create'](_0x4374c5[_0x8fca('0x5a')]);}})[_0x8fca('0x22')](respondWithResult(_0x1d7cb4,null))['catch'](handleError(_0x1d7cb4,null));};exports['getAnswers']=function(_0x1b6d9a,_0x1ffd42,_0x230e0d){var _0x4679d8={'raw':![],'where':{}};var _0x59c332={};var _0x5255be={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8fca('0x6c')]({'where':{'id':_0x1b6d9a['params']['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x1ffd42,null))[_0x8fca('0x22')](function(_0x58ab3d){if(_0x58ab3d){_0x59c332[_0x8fca('0x41')]=_['keys'](db[_0x8fca('0x6b')][_0x8fca('0x3e')]);_0x59c332[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x1b6d9a['query']);_0x59c332['filters']=_[_0x8fca('0x45')](_0x59c332[_0x8fca('0x41')],_0x59c332['query']);_0x4679d8[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x59c332[_0x8fca('0x41')],qs[_0x8fca('0x47')](_0x1b6d9a[_0x8fca('0x42')][_0x8fca('0x47')]));_0x4679d8['attributes']=_0x4679d8[_0x8fca('0x46')]['length']?_0x4679d8[_0x8fca('0x46')]:_0x59c332[_0x8fca('0x41')];if(!_0x1b6d9a[_0x8fca('0x42')]['hasOwnProperty']('nolimit')){_0x4679d8['limit']=qs[_0x8fca('0x32')](_0x1b6d9a[_0x8fca('0x42')]['limit']);_0x4679d8[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x1b6d9a[_0x8fca('0x42')][_0x8fca('0x2f')]);}_0x4679d8[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x1b6d9a[_0x8fca('0x42')][_0x8fca('0x4b')]);_0x4679d8['where']=qs['filters'](_[_0x8fca('0x68')](_0x1b6d9a[_0x8fca('0x42')],_0x59c332[_0x8fca('0x44')]));_0x4679d8[_0x8fca('0x4c')][_0x8fca('0x64')]=_0x58ab3d['id'];if(_0x1b6d9a[_0x8fca('0x42')][_0x8fca('0x4f')]){_0x4679d8[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0x4679d8[_0x8fca('0x4c')],{'$or':_['map'](_0x4679d8[_0x8fca('0x46')],function(_0x5b982){var _0x5b1e65={};_0x5b1e65[_0x5b982]={'$like':'%'+_0x1b6d9a['query']['filter']+'%'};return _0x5b1e65;})});}_0x4679d8=_[_0x8fca('0x4d')]({},_0x4679d8,_0x1b6d9a[_0x8fca('0x50')]);return db[_0x8fca('0x6b')][_0x8fca('0x31')]({'where':_0x4679d8[_0x8fca('0x4c')]})[_0x8fca('0x22')](function(_0x363bb9){_0x5255be['count']=_0x363bb9;if(_0x1b6d9a['query'][_0x8fca('0x51')]){_0x4679d8[_0x8fca('0x57')]=[{'all':!![]}];}return db[_0x8fca('0x6b')][_0x8fca('0x52')](_0x4679d8);})[_0x8fca('0x22')](function(_0x32c225){_0x5255be[_0x8fca('0x53')]=_0x32c225;return _0x5255be;});}})[_0x8fca('0x22')](respondWithFilteredResult(_0x1ffd42,_0x4679d8))[_0x8fca('0x54')](handleError(_0x1ffd42,null));};exports[_0x8fca('0x6d')]=function(_0x541060,_0x4d59e3,_0x44e70e){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x541060[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x4d59e3,null))[_0x8fca('0x22')](function(_0x48866c){if(_0x48866c){return _0x48866c['removeAnswers'](_0x541060[_0x8fca('0x42')][_0x8fca('0x6a')]);}})[_0x8fca('0x22')](respondWithStatusCode(_0x4d59e3,null))[_0x8fca('0x54')](handleError(_0x4d59e3,null));};exports[_0x8fca('0x6e')]=function(_0x25ba1d,_0x5bfd75,_0x566745){_0x25ba1d[_0x8fca('0x5a')][_0x8fca('0x6f')]=_0x25ba1d[_0x8fca('0x70')][_0x8fca('0x71')];return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x25ba1d['params']['id']}})['then'](handleEntityNotFound(_0x5bfd75,null))[_0x8fca('0x22')](saveUpdates(_0x25ba1d[_0x8fca('0x5a')],null))[_0x8fca('0x22')](respondWithResult(_0x5bfd75,null))[_0x8fca('0x54')](handleError(_0x5bfd75,null));};exports[_0x8fca('0x72')]=function(_0x57ee11,_0x29532b,_0x38daa5){_0x57ee11[_0x8fca('0x5a')][_0x8fca('0x73')]=_0x57ee11[_0x8fca('0x70')][_0x8fca('0x71')];return db[_0x8fca('0x3d')]['find']({'where':{'id':_0x57ee11[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x29532b,null))['then'](saveUpdates(_0x57ee11['body'],null))[_0x8fca('0x22')](respondWithResult(_0x29532b,null))[_0x8fca('0x54')](handleError(_0x29532b,null));};exports[_0x8fca('0x74')]=function(_0x25d551,_0x1e8a43,_0x1fddd7){_0x25d551[_0x8fca('0x5a')][_0x8fca('0x75')]=_0x25d551[_0x8fca('0x70')][_0x8fca('0x71')];return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x25d551['params']['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x1e8a43,null))[_0x8fca('0x22')](saveUpdates(_0x25d551[_0x8fca('0x5a')],null))[_0x8fca('0x22')](respondWithResult(_0x1e8a43,null))[_0x8fca('0x54')](handleError(_0x1e8a43,null));};exports[_0x8fca('0x76')]=function(_0x3d1182,_0x4dfc1a,_0xa84d0e){_0x3d1182[_0x8fca('0x5a')][_0x8fca('0x77')]=_0x3d1182[_0x8fca('0x70')][_0x8fca('0x71')];return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x3d1182[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x4dfc1a,null))[_0x8fca('0x22')](saveUpdates(_0x3d1182['body'],null))['then'](respondWithResult(_0x4dfc1a,null))['catch'](handleError(_0x4dfc1a,null));};exports[_0x8fca('0x78')]=function(_0xedd25a,_0x3d86b4,_0x2709de){var _0x4f5589=path[_0x8fca('0x79')](config[_0x8fca('0x7a')],'server/files/images/logos/default_logo.svg');var _0x34b5e2={'where':{'id':_0xedd25a['params']['id']},'attributes':['id',_0x8fca('0x6f')],'raw':!![]};var _0x110f09=![];return require(_0x8fca('0x7b'))[_0x8fca('0x7c')]()[_0x8fca('0x22')](function(_0x5004ef){if(_0x5004ef){_0x110f09=_0x5004ef[_0x8fca('0x7d')];}})[_0x8fca('0x22')](function(){return db[_0x8fca('0x3d')][_0x8fca('0x58')](_0x34b5e2);})[_0x8fca('0x22')](handleEntityNotFound(_0x3d86b4,null))['then'](function(_0x595924){if(_0x595924){if(!_[_0x8fca('0x7e')](_0x595924[_0x8fca('0x6f')])){if(fs[_0x8fca('0x7f')](path[_0x8fca('0x79')](config[_0x8fca('0x7a')],'server/files/images/logos/',_0x595924[_0x8fca('0x6f')]))&&_0x110f09){_0x4f5589=path[_0x8fca('0x79')](config[_0x8fca('0x7a')],'server/files/images/logos/',_0x595924[_0x8fca('0x6f')]);}}return _0x3d86b4[_0x8fca('0x80')](_0x4f5589);}})[_0x8fca('0x54')](handleError(_0x3d86b4,null));};exports[_0x8fca('0x81')]=function(_0xb96316,_0xf30f08,_0x5b401d){var _0x41de6a=path[_0x8fca('0x79')](config[_0x8fca('0x7a')],_0x8fca('0x82'));var _0x42bfd9={'where':{'id':_0xb96316[_0x8fca('0x61')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x8fca('0x3d')]['find'](_0x42bfd9)[_0x8fca('0x22')](handleEntityNotFound(_0xf30f08,null))['then'](function(_0x38b9aa){if(_0x38b9aa){if(!_[_0x8fca('0x7e')](_0x38b9aa[_0x8fca('0x73')])){if(fs[_0x8fca('0x7f')](path['join'](config[_0x8fca('0x7a')],_0x8fca('0x83'),_0x38b9aa[_0x8fca('0x73')]))){_0x41de6a=path['join'](config[_0x8fca('0x7a')],_0x8fca('0x83'),_0x38b9aa[_0x8fca('0x73')]);}}return _0xf30f08[_0x8fca('0x80')](_0x41de6a);}})['catch'](handleError(_0xf30f08,null));};exports[_0x8fca('0x84')]=function(_0x8e493d,_0x5a53b7,_0xa690ff){var _0x3754aa=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x425664={'where':{'id':_0x8e493d['params']['id']},'attributes':['id','customerAvatar',_0x8fca('0x85')],'raw':!![]};return db[_0x8fca('0x3d')][_0x8fca('0x58')](_0x425664)[_0x8fca('0x22')](handleEntityNotFound(_0x5a53b7,null))[_0x8fca('0x22')](function(_0x3cd67d){if(_0x3cd67d){if(!_['isNil'](_0x3cd67d[_0x8fca('0x75')])){if(fs[_0x8fca('0x7f')](path[_0x8fca('0x79')](config['root'],_0x8fca('0x83'),_0x3cd67d[_0x8fca('0x75')]))&&_0x3cd67d[_0x8fca('0x85')]){_0x3754aa=path[_0x8fca('0x79')](config['root'],_0x8fca('0x83'),_0x3cd67d[_0x8fca('0x75')]);}}return _0x5a53b7[_0x8fca('0x80')](_0x3754aa);}})['catch'](handleError(_0x5a53b7,null));};exports['getSystemAvatar']=function(_0x1eecac,_0x5a0d7a,_0x43502a){var _0x3a69c2=path['join'](config[_0x8fca('0x7a')],'server/files/images/avatars/system_avatar.png');var _0x4a1530={'where':{'id':_0x1eecac[_0x8fca('0x61')]['id']},'attributes':['id',_0x8fca('0x77')],'raw':!![]};return db[_0x8fca('0x3d')][_0x8fca('0x58')](_0x4a1530)[_0x8fca('0x22')](handleEntityNotFound(_0x5a0d7a,null))[_0x8fca('0x22')](function(_0x55a10e){if(_0x55a10e){if(!_['isNil'](_0x55a10e[_0x8fca('0x77')])){if(fs[_0x8fca('0x7f')](path[_0x8fca('0x79')](config['root'],_0x8fca('0x83'),_0x55a10e[_0x8fca('0x77')]))){_0x3a69c2=path[_0x8fca('0x79')](config[_0x8fca('0x7a')],'server/files/images/avatars/',_0x55a10e[_0x8fca('0x77')]);}}return _0x5a0d7a[_0x8fca('0x80')](_0x3a69c2);}})[_0x8fca('0x54')](handleError(_0x5a0d7a,null));};exports[_0x8fca('0x86')]=function(_0xd97ea,_0x193e1c,_0x41dd30){var _0x24f386=require(_0x8fca('0x87'));var _0x5bba46=new _0x24f386();var _0x17dbc8=_0x5bba46[_0x8fca('0x88')](_0xd97ea['headers'][_0x8fca('0x89')])['getResult']();var _0x29f558={'body':_0xd97ea[_0x8fca('0x5a')],'channel':_0x8fca('0x8a')};var _0x11a9e0=[];var _0x290377=[];var _0x7dcdc5={};var _0x185929=![];return db['CmContact']['describe']()[_0x8fca('0x22')](function(_0x1fbb58){if(!_0x1fbb58){throw new db[(_0x8fca('0x8b'))][(_0x8fca('0x8c'))](_0x8fca('0x8d'));}_0x11a9e0=_[_0x8fca('0x8e')](_[_0x8fca('0x43')](_0x1fbb58),[_0x8fca('0x8f'),_0x8fca('0x90')]);_0x290377=_[_0x8fca('0x8e')](_[_0x8fca('0x43')](_0x1fbb58),[_0x8fca('0x8f'),_0x8fca('0x90'),_0x8fca('0x91'),'ListId']);if(_0xd97ea['body']['id']){delete _0xd97ea['body']['id'];}if(_[_0x8fca('0x7e')](_0xd97ea['body'][_0x8fca('0x92')])){throw new db['Sequelize'][(_0x8fca('0x8c'))](_0x8fca('0x93'));}if(_[_0x8fca('0x7e')](_0xd97ea['body'][_0x8fca('0x5a')])||_0xd97ea[_0x8fca('0x5a')]['body']===''){throw new db[(_0x8fca('0x8b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8fca('0x7e')](_0xd97ea[_0x8fca('0x5a')]['mapKey'])){throw new db[(_0x8fca('0x8b'))][(_0x8fca('0x8c'))](_0x8fca('0x94')+_0x290377);}if(!_[_0x8fca('0x95')](_0x290377,_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x96')])){throw new db['Sequelize'][(_0x8fca('0x8c'))](_0x8fca('0x97')+_0x290377);}_0x7dcdc5[_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x96')]]=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x92')];})['then'](function(){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0xd97ea[_0x8fca('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x8fca('0x98'),'include':[{'model':db['CmContact'],'as':_0x8fca('0x99'),'where':_0x7dcdc5,'limit':0x1,'order':[[_0x8fca('0x90'),_0x8fca('0x9a')]]}]},{'model':db[_0x8fca('0x9b')],'as':_0x8fca('0x9c')}]});})[_0x8fca('0x22')](handleEntityNotFound(_0x193e1c,null))['then'](function(_0x50ad47){if(_0x50ad47&&_0x50ad47[_0x8fca('0x98')]){_0x29f558[_0x8fca('0x9d')]=_0x50ad47;_0x29f558[_0x8fca('0x9e')]=_0x50ad47[_0x8fca('0x9c')];_0x29f558[_0x8fca('0x9f')]=_0x50ad47[_0x8fca('0x98')];_0x29f558[_0x8fca('0x9e')]=_[_0x8fca('0xa0')](_0x29f558[_0x8fca('0x9e')],['priority'],[_0x8fca('0xa1')]);if(_0x29f558[_0x8fca('0x9d')][_0x8fca('0x9c')]){delete _0x29f558['account'][_0x8fca('0x9c')];}if(_0x29f558['account'][_0x8fca('0x98')]&&_0x29f558['account'][_0x8fca('0x98')]['Contacts'][_0x8fca('0x48')]){return _0x29f558['account'][_0x8fca('0x98')]['Contacts'][0x0];}var _0x2d85b8=_[_0x8fca('0xa2')](_0xd97ea[_0x8fca('0x5a')],{'firstName':_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x92')],'ListId':_0x50ad47[_0x8fca('0xa3')]});_0x2d85b8[_0xd97ea['body']['mapKey']]=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x92')];return db['CmContact'][_0x8fca('0x59')](_0x2d85b8,{'fields':_0x11a9e0,'raw':!![]});}})[_0x8fca('0x22')](handleEntityNotFound(_0x193e1c,null))['then'](function(_0x546f26){_0x29f558[_0x8fca('0xa4')]=_0x546f26;var _0x3c97f9=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xa5')];if(_0xd97ea['headers'][_0x8fca('0xa6')]){_0x3c97f9=_0xd97ea[_0x8fca('0xa7')][_0x8fca('0xa6')];}else if(_0xd97ea[_0x8fca('0xa7')][_0x8fca('0xa8')]){_0x3c97f9=_[_0x8fca('0xa9')](_0xd97ea['headers'][_0x8fca('0xa8')]['split'](','));}if(_0x546f26){var _0x52d1a6={'ContactId':_0x546f26['id'],'ChatWebsiteId':_0xd97ea[_0x8fca('0x61')]['id'],'from':(_0x546f26[_0x8fca('0xaa')]||'')+'\x20'+(_0x546f26[_0x8fca('0xab')]||''),'customerIp':_0x3c97f9,'customerPort':_0xd97ea[_0x8fca('0xa7')]['x-real-port']?_0xd97ea[_0x8fca('0xa7')][_0x8fca('0xac')]:null,'referer':_0xd97ea['body'][_0x8fca('0xad')],'browserName':_0x17dbc8[_0x8fca('0xae')][_0x8fca('0x38')]&&_0x17dbc8[_0x8fca('0xae')][_0x8fca('0xaf')]?util['format'](_0x8fca('0xb0'),_0x17dbc8[_0x8fca('0xae')][_0x8fca('0x38')],_0x17dbc8[_0x8fca('0xae')]['version']):_0x8fca('0xb1'),'browserVersion':_0x17dbc8[_0x8fca('0xae')][_0x8fca('0xaf')]||_0x8fca('0xb1'),'osName':util[_0x8fca('0xb2')](_0x8fca('0xb0'),_0x17dbc8['os']['name'],_0x17dbc8['os'][_0x8fca('0xaf')]),'osVersion':_0x17dbc8['os'][_0x8fca('0xaf')],'deviceModel':_0x17dbc8[_0x8fca('0xb3')][_0x8fca('0x41')]&&_0x17dbc8[_0x8fca('0xb3')][_0x8fca('0xb4')]?util[_0x8fca('0xb2')](_0x8fca('0xb5'),_0x17dbc8[_0x8fca('0xb3')][_0x8fca('0x41')],_0x17dbc8[_0x8fca('0xb3')][_0x8fca('0xb4')],_0x17dbc8[_0x8fca('0xb3')]['type']):null,'deviceVendor':_0x17dbc8['device'][_0x8fca('0xb4')],'deviceType':_0x17dbc8[_0x8fca('0xb3')][_0x8fca('0x3f')],'formData':JSON[_0x8fca('0xb6')](_0xd97ea['body'])};var _0x5183c1={'ChatWebsiteId':_0xd97ea[_0x8fca('0x61')]['id'],'closed':![]};if(_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xb7')]){_0x5183c1[_0x8fca('0xb7')]=_0xd97ea[_0x8fca('0x5a')]['threadId'];return db[_0x8fca('0xb8')][_0x8fca('0x58')]({'where':_0x5183c1})['then'](function(_0x213e50){if(_0x213e50){return[_0x213e50,![]];}_0x52d1a6[_0x8fca('0xb7')]=_0xd97ea['body'][_0x8fca('0xb7')];_0x52d1a6[_0x8fca('0xb9')]=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xb9')];return db[_0x8fca('0xb8')]['create'](_0x52d1a6)[_0x8fca('0x22')](function(_0x4f55a9){return[_0x4f55a9,!![]];});});}_0x5183c1[_0x8fca('0xba')]=_0x546f26['id'];if(_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xbb')]&&_0xd97ea['body'][_0x8fca('0xbb')]['id']){_0x5183c1['id']=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xbb')]['id'];return db[_0x8fca('0xb8')][_0x8fca('0x58')]({'where':_0x5183c1})['then'](function(_0x513a03){if(_0x513a03){return[_0x513a03,![]];}return db['ChatInteraction'][_0x8fca('0x59')](_0x52d1a6)[_0x8fca('0x22')](function(_0x24df9a){return[_0x24df9a,!![]];});});}return db[_0x8fca('0xb8')][_0x8fca('0x59')](_0x52d1a6)[_0x8fca('0x22')](function(_0x37f826){return[_0x37f826,!![]];});}})[_0x8fca('0xbc')](function(_0x3f6925,_0x287f31){if(_0x3f6925){_0x185929=_0x287f31;if(!_0x287f31){var _0xcb36d0={'from':(_0x29f558[_0x8fca('0xa4')][_0x8fca('0xaa')]||'')+'\x20'+(_0x29f558[_0x8fca('0xa4')][_0x8fca('0xab')]||'')};if(_0xd97ea[_0x8fca('0x5a')]['threadId']&&_0xd97ea['body'][_0x8fca('0xbd')]&&_0xd97ea['body'][_0x8fca('0xb7')]!=_0xd97ea[_0x8fca('0x5a')]['messageId']){_0xcb36d0[_0x8fca('0xb7')]=_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xbd')];}return _0x3f6925['update'](_0xcb36d0);}else{return _0x3f6925;}}})[_0x8fca('0x22')](function(_0x25bd02){_0x29f558['interaction']=_0x25bd02[_0x8fca('0xbe')]({'plain':!![]});_0x29f558[_0x8fca('0xbb')][_0x8fca('0xbf')]=_0x185929;if(_0x29f558[_0x8fca('0xbb')][_0x8fca('0xbf')]){if(_0x29f558[_0x8fca('0x9d')][_0x8fca('0xc0')]){_0x29f558[_0x8fca('0x9e')][_0x8fca('0xc1')]({'id':0x0,'priority':_0x29f558['applications'][_0x8fca('0x48')]+0x1,'app':_0x8fca('0xc2'),'appdata':_0x8fca('0xc3'),'interval':_0x8fca('0xc4')});}}return db['ChatMessage'][_0x8fca('0x59')]({'body':_0xd97ea[_0x8fca('0x5a')][_0x8fca('0x5a')],'ChatWebsiteId':_0xd97ea['params']['id'],'ChatInteractionId':_0x25bd02['id'],'direction':'in','ContactId':_0x29f558[_0x8fca('0xa4')]['id'],'AttachmentId':_0xd97ea[_0x8fca('0x5a')][_0x8fca('0xc5')]});})[_0x8fca('0x22')](function(_0x53fc4d){_0x29f558[_0x8fca('0x29')]=_0x53fc4d;if(_0x29f558['interaction']['UserId']){return db[_0x8fca('0xc6')][_0x8fca('0x58')]({'attributes':['id',_0x8fca('0x38')],'where':{'id':_0x29f558[_0x8fca('0xbb')][_0x8fca('0xc7')]}})[_0x8fca('0x22')](function(_0x41cb00){if(_0x41cb00){_0x29f558[_0x8fca('0x9e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8fca('0xc8'),'appdata':_0x41cb00[_0x8fca('0x38')]+','+(_0x29f558[_0x8fca('0x9d')][_0x8fca('0xc9')]||0xa),'interval':_0x8fca('0xc4')});_0x29f558[_0x8fca('0xca')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x29f558);});}return respondWithRpcPromise(_0x8fca('0xcb'),_0x8fca('0xcc'),_0x29f558);})[_0x8fca('0x22')](function(_0x3b3b17){respondWithRpcPromise(_0x8fca('0xcd'),_0x8fca('0xcd'),{'event':_0x8fca('0x86'),'message':_0x3b3b17},client9002);return _0x3b3b17;})[_0x8fca('0x22')](respondWithResult(_0x193e1c,null))['catch'](handleError(_0x193e1c,null));};exports['offline']=function(_0x19a829,_0x4ce959,_0x38f2a4){var _0x50495a,_0x3edbaf,_0x46d3d6;var _0x17be23=[];var _0x4ffd88=[];var _0x17cae6={};var _0xb8334a=_0x19a829['files']||[];var _0x3fc75c=[];var _0xc0a1c0;return db[_0x8fca('0xce')][_0x8fca('0x62')]()['then'](function(_0x1886c2){if(!_0x1886c2){throw new db['Sequelize'][(_0x8fca('0x8c'))](_0x8fca('0x8d'));}_0x4ffd88=_['difference'](_[_0x8fca('0x43')](_0x1886c2),[_0x8fca('0x8f'),_0x8fca('0x90')]);_0x17be23=_['difference'](_[_0x8fca('0x43')](_0x1886c2),[_0x8fca('0x8f'),_0x8fca('0x90'),_0x8fca('0x91'),_0x8fca('0xa3')]);if(_0x19a829[_0x8fca('0x5a')]['id']){delete _0x19a829['body']['id'];}if(_[_0x8fca('0x7e')](_0x19a829[_0x8fca('0x5a')][_0x8fca('0x92')])){throw _0x4ce959[_0x8fca('0x2d')](0x1f4)[_0x8fca('0x39')](new db[(_0x8fca('0x8b'))]['ValidationError'](_0x8fca('0x93')));}if(_['isNil'](_0x19a829['body'][_0x8fca('0x5a')])||_0x19a829['body']['body']===''){throw _0x4ce959[_0x8fca('0x2d')](0x1f4)['send'](new db[(_0x8fca('0x8b'))]['ValidationError'](_0x8fca('0xcf')));}if(_[_0x8fca('0x7e')](_0x19a829[_0x8fca('0x5a')][_0x8fca('0xd0')])){throw _0x4ce959['status'](0x1f4)[_0x8fca('0x39')](new db[(_0x8fca('0x8b'))]['ValidationError'](_0x8fca('0xd1')+_0x17be23));}if(!_[_0x8fca('0x95')](_0x17be23,_0x19a829['body']['mapKeyOffline'])){throw _0x4ce959[_0x8fca('0x2d')](0x1f4)[_0x8fca('0x39')](new db['Sequelize'][(_0x8fca('0x8c'))](_0x8fca('0xd2')+_0x17be23));}_0x17cae6[_0x19a829['body']['mapKeyOffline']]=_0x19a829[_0x8fca('0x5a')]['from'];})[_0x8fca('0x22')](function(){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x19a829[_0x8fca('0x61')]['id']},'include':[{'model':db[_0x8fca('0xd3')],'as':'List'},{'model':db['MailAccount'],'as':_0x8fca('0xd4')}]});})[_0x8fca('0x22')](handleEntityNotFound(_0x4ce959,null))['then'](function(_0x2bcc63){if(_0x2bcc63&&_0x2bcc63['List']){_0x3edbaf=_0x2bcc63;var _0x2fdfd9=_[_0x8fca('0xa2')](_0x19a829[_0x8fca('0x5a')],{'firstName':_0x19a829[_0x8fca('0x5a')][_0x8fca('0x92')],'phone':_0x19a829[_0x8fca('0x5a')][_0x8fca('0x92')],'ListId':_0x2bcc63[_0x8fca('0xa3')]});_0x2fdfd9[_0x19a829[_0x8fca('0x5a')][_0x8fca('0xd0')]]=_0x19a829[_0x8fca('0x5a')][_0x8fca('0x92')];return db[_0x8fca('0xce')][_0x8fca('0xd5')]({'where':_0x17cae6,'defaults':_0x2fdfd9});}})[_0x8fca('0xbc')](function(_0x38852d){if(_0x38852d){_0x46d3d6=_0x38852d;var _0x40ec26=fs[_0x8fca('0xd6')](path[_0x8fca('0x79')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x8fca('0xd7'));var _0x1a91ae=ejs['render'](_0x40ec26,{'body':_[_0x8fca('0xd8')](_0x19a829[_0x8fca('0x5a')][_0x8fca('0x5a')]),'bodyTitle':_0x3edbaf['offlineMessageBody']});return db[_0x8fca('0xd9')][_0x8fca('0x59')]({'body':_0x1a91ae,'ContactId':_0x38852d['id'],'ChatWebsiteId':_0x3edbaf['id']});}})['then'](function(_0x4fce80){_0xc0a1c0=_0x4fce80;if(_0xb8334a[_0x8fca('0x48')]){var _0x5c186f=_0xb8334a['map'](function(_0x1c6a1c){return{'name':_0x1c6a1c[_0x8fca('0xda')],'basename':_0x1c6a1c[_0x8fca('0x71')],'type':_0x1c6a1c['mimetype'],'ChatOfflineMessageId':_0x4fce80['id']};});_0x3fc75c=_0x5c186f['map'](_0x40ccbb=>{var _0x4a8dec={'filename':_0x40ccbb[_0x8fca('0x38')],'path':path['join'](config[_0x8fca('0x7a')],_0x8fca('0xdb'),_0x8fca('0xdc'),_0x8fca('0xdd'),_0x8fca('0xde'),_0x40ccbb[_0x8fca('0xdf')])};return _0x4a8dec;});if(!_0x3edbaf[_0x8fca('0xe0')]){return db['sequelize'][_0x8fca('0xe1')](function(_0x275cdb){return db[_0x8fca('0xe2')][_0x8fca('0xe3')](_0x5c186f,{'transaction':_0x275cdb});});}}})[_0x8fca('0x22')](function(){if(_0xc0a1c0){_0x50495a=_0xc0a1c0;return db['MailAccount'][_0x8fca('0x6c')]({'where':{'active':!![]},'include':[{'model':db[_0x8fca('0xe4')],'as':_0x8fca('0xe5'),'raw':!![]}]});}})[_0x8fca('0x22')](function(_0x5db5cb){if(_0x5db5cb&&_0x5db5cb['Smtp']&&_0x3edbaf[_0x8fca('0xe6')]&&_0x3edbaf[_0x8fca('0xe7')]){var _0x49fb30={'tls':{'rejectUnauthorized':![]}};if(_0x5db5cb[_0x8fca('0xe5')][_0x8fca('0xe8')]){_0x49fb30['service']=_0x5db5cb['Smtp'][_0x8fca('0xe8')];}else{_0x49fb30['host']=_0x5db5cb[_0x8fca('0xe5')]['host'];_0x49fb30[_0x8fca('0xe9')]=_0x5db5cb['Smtp'][_0x8fca('0xe9')];_0x49fb30[_0x8fca('0xea')]=_0x5db5cb[_0x8fca('0xe5')][_0x8fca('0xea')];}if(_0x5db5cb[_0x8fca('0xe5')]['authentication']){_0x49fb30[_0x8fca('0xeb')]={'user':_0x5db5cb['Smtp'][_0x8fca('0x5b')],'pass':_0x5db5cb[_0x8fca('0xe5')][_0x8fca('0xec')]};}return respondWithRpcPromise(_0x8fca('0xed'),'sendMail',{'account':_0x49fb30,'message':{'from':util[_0x8fca('0xb2')](_0x8fca('0xee'),_0x5db5cb['name'],_0x5db5cb[_0x8fca('0xef')]||_0x5db5cb[_0x8fca('0xe5')][_0x8fca('0x5b')]),'to':_0x3edbaf[_0x8fca('0xe7')],'subject':_0x3edbaf[_0x8fca('0xf0')],'html':_0x50495a[_0x8fca('0x5a')],'attachments':_0x3fc75c}},client9003)['then'](function(){return _0x50495a;})[_0x8fca('0x54')](function(_0x1aaabc){console[_0x8fca('0x27')](_0x1aaabc);});}})[_0x8fca('0x22')](function(){if(_0x3edbaf&&_0x3edbaf['openNewInteraction']&&_0x3edbaf[_0x8fca('0xf1')]){var _0x1b6f81=[];if(_0xb8334a[_0x8fca('0x48')]){_0x1b6f81=_0xb8334a['map'](function(_0x1d3958){return{'name':_0x1d3958[_0x8fca('0xda')],'basename':_0x1d3958[_0x8fca('0x71')],'type':_0x1d3958[_0x8fca('0xf2')],'ChatOfflineMessageId':_0xc0a1c0['id']};});}var _0x53fdf2;if(!_[_0x8fca('0x7e')](_0x3edbaf[_0x8fca('0xf3')])){var _0x7a7dae=_[_0x8fca('0x3c')](_0x19a829['body'],function(_0x43004f){return _0x43004f;});var _0x18e6d7=_['toPairsIn'](_0x7a7dae)[0x0];var _0xc6964a=_[_0x8fca('0xf4')](_0x18e6d7,function(_0x1fc75f){return _0x1fc75f;});_0x53fdf2=_0xc6964a[0x1][_0x3edbaf[_0x8fca('0xf3')]];}var _0x2a9bbd={'from':_0x46d3d6[_0x8fca('0xef')],'firstName':_0x46d3d6[_0x8fca('0xaa')],'lastName':_0x46d3d6['lastName'],'mapKey':_0x8fca('0xef'),'message':{'from':_0x46d3d6[_0x8fca('0xef')],'to':_0x3edbaf[_0x8fca('0xd4')]['email'],'cc':'','subject':_[_0x8fca('0x7e')](_0x53fdf2)?_0x3edbaf['offlineMessageSubject']:_0x53fdf2,'messageId':'','sentAt':new Date(),'attach':_0x1b6f81[_0x8fca('0x48')],'attachments':_0x1b6f81,'originChannel':'Chat','ChatWebsiteId':_0x3edbaf['id'],'ChatOfflineMessageId':_0x50495a['id'],'originTo':_0x3edbaf[_0x8fca('0xd4')][_0x8fca('0xef')]},'body':_0x50495a['body']};var _0x5d9e2d={'account':{'id':_0x3edbaf['MailAccountId']},'body':_0x2a9bbd,'log':_0x8fca('0xf5')};return respondWithRpcPromise(_0x8fca('0xf5'),_0x8fca('0xf6'),_0x5d9e2d,client9001)[_0x8fca('0x22')](function(){return _0x50495a;})[_0x8fca('0x54')](function(_0x8c05b7){console[_0x8fca('0x27')](_0x8c05b7);});}return;})[_0x8fca('0x22')](function(){if(_0x50495a){return _0x50495a;}})['then'](respondWithResult(_0x4ce959,null))[_0x8fca('0x54')](function(_0x32092a){console[_0x8fca('0x27')](_0x8fca('0x54'),_0x32092a);for(var _0x51086e of _0xb8334a){var _0x457b2e=path[_0x8fca('0x79')](config['root'],_0x8fca('0xdb'),_0x8fca('0xdc'),'attachments',_0x8fca('0xde'),_0x51086e[_0x8fca('0x71')]);fs_extra[_0x8fca('0xf7')](_0x457b2e)[_0x8fca('0x54')](function(_0x4b248f){console['error'](_0x8fca('0xf8'),_0x457b2e,_0x4b248f);});}});};exports[_0x8fca('0xf9')]=function(_0x4ec5c4,_0x251de6,_0x479327){return db[_0x8fca('0xb8')][_0x8fca('0x58')]({'where':{'id':_0x4ec5c4[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x251de6,null))[_0x8fca('0x22')](function(_0x43cdf7){if(_0x43cdf7){return _0x43cdf7[_0x8fca('0xf9')](_0x4ec5c4['body']['ids'],_[_0x8fca('0xfa')](_0x4ec5c4[_0x8fca('0x5a')],[_0x8fca('0x6a'),'id'])||{});}})[_0x8fca('0x22')](respondWithResult(_0x251de6,null))[_0x8fca('0x54')](handleError(_0x251de6,null));};exports['getInteractions']=function(_0x4de386,_0x1a713b,_0xff20bd){var _0xce0cc={'raw':![],'where':{}};var _0x5093c6={};var _0x32d13b={'count':0x0,'rows':[]};return db[_0x8fca('0x3d')][_0x8fca('0x6c')]({'where':{'id':_0x4de386[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0x1a713b,null))[_0x8fca('0x22')](function(_0x3b3775){if(_0x3b3775){_0x5093c6[_0x8fca('0x41')]=_[_0x8fca('0x43')](db[_0x8fca('0xb8')][_0x8fca('0x3e')]);_0x5093c6[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x4de386[_0x8fca('0x42')]);_0x5093c6[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x5093c6[_0x8fca('0x41')],_0x5093c6[_0x8fca('0x42')]);_0xce0cc['attributes']=_[_0x8fca('0x45')](_0x5093c6[_0x8fca('0x41')],qs['fields'](_0x4de386['query'][_0x8fca('0x47')]));_0xce0cc[_0x8fca('0x46')]=_0xce0cc[_0x8fca('0x46')][_0x8fca('0x48')]?_0xce0cc[_0x8fca('0x46')]:_0x5093c6[_0x8fca('0x41')];if(!_0x4de386[_0x8fca('0x42')][_0x8fca('0x67')](_0x8fca('0x49'))){_0xce0cc[_0x8fca('0x32')]=qs[_0x8fca('0x32')](_0x4de386[_0x8fca('0x42')]['limit']);_0xce0cc[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x4de386['query'][_0x8fca('0x2f')]);}_0xce0cc[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x4de386['query'][_0x8fca('0x4b')]);_0xce0cc[_0x8fca('0x4c')]=qs[_0x8fca('0x44')](_['pick'](_0x4de386[_0x8fca('0x42')],_0x5093c6['filters']));_0xce0cc[_0x8fca('0x4c')][_0x8fca('0x64')]=_0x3b3775['id'];if(_0x4de386[_0x8fca('0x42')][_0x8fca('0x4f')]){_0xce0cc[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0xce0cc[_0x8fca('0x4c')],{'$or':_[_0x8fca('0x3c')](_0xce0cc['attributes'],function(_0x2a6102){var _0x9091d1={};_0x9091d1[_0x2a6102]={'$like':'%'+_0x4de386[_0x8fca('0x42')][_0x8fca('0x4f')]+'%'};return _0x9091d1;})});}_0xce0cc=_['merge']({},_0xce0cc,_0x4de386['options']);return db[_0x8fca('0xb8')]['count']({'where':_0xce0cc[_0x8fca('0x4c')]})[_0x8fca('0x22')](function(_0x206618){_0x32d13b[_0x8fca('0x31')]=_0x206618;if(_0x4de386['query']['includeAll']){_0xce0cc[_0x8fca('0x57')]=[{'model':db[_0x8fca('0xce')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8fca('0x38'),_0x8fca('0xfb'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8fca('0xfc'),'attributes':['id',_0x8fca('0x38'),_0x8fca('0xfd')],'where':_0x4de386[_0x8fca('0x42')][_0x8fca('0xfe')]?{'id':_0x4de386['query']['tag']}:undefined,'required':_0x4de386[_0x8fca('0x42')]['tag']?!![]:![]}];}return db[_0x8fca('0xb8')][_0x8fca('0x52')](_0xce0cc);})['then'](function(_0x4fb2e7){_0x32d13b['rows']=_0x4fb2e7;return _0x32d13b;});}})[_0x8fca('0x22')](respondWithFilteredResult(_0x1a713b,_0xce0cc))['catch'](handleError(_0x1a713b,null));};function iftimePromise(_0x54d508,_0xfa2e1f){return respondWithRpcPromise(_0x8fca('0xff'),_0x8fca('0x100'),{'command':_0xfa2e1f[_0x8fca('0x101')]?util[_0x8fca('0xb2')](_0x8fca('0x102'),_0x54d508['interval'],_0xfa2e1f['timezone']):util[_0x8fca('0xb2')]('iftime\x20%s',_0x54d508[_0x8fca('0x103')])},client9002)[_0x8fca('0x22')](function(_0x5c4b0e){var _0xf8bd05=_0x5c4b0e&&_0x5c4b0e['indexOf'](_0x8fca('0x104'))>=0x0?!![]:![];logger[_0x8fca('0x2a')](_0x8fca('0x105'),_0xfa2e1f['id'],_0x54d508['id'],_0x54d508[_0x8fca('0x103')],_0xf8bd05?_0x8fca('0x106'):_0x8fca('0x107'),_0xfa2e1f[_0x8fca('0x101')]?_0xfa2e1f[_0x8fca('0x101')]:_0x8fca('0x108'));return _0xf8bd05;})[_0x8fca('0x54')](function(_0x228f32){logger[_0x8fca('0x27')](_0x8fca('0x105'),_0xfa2e1f['id'],_0x54d508['id'],_0x54d508[_0x8fca('0x103')],util[_0x8fca('0x109')](_0x228f32,{'showHidden':![],'depth':null}),_0xfa2e1f[_0x8fca('0x101')]?_0xfa2e1f[_0x8fca('0x101')]:_0x8fca('0x108'));return![];});}exports[_0x8fca('0x100')]=function(_0x3b5e2c,_0x59a7a1,_0x41f764){var _0x141812=0x0;var _0x4cdd80=0x0;var _0x32159e=![];var _0x30d5e1;var _0x3292ba;return db[_0x8fca('0x3d')]['find']({'where':{'id':_0x3b5e2c['params']['id']},'include':[{'model':db[_0x8fca('0x10a')],'as':_0x8fca('0x10a'),'include':[{'model':db[_0x8fca('0x10a')],'as':'Intervals','attributes':['id',_0x8fca('0x103')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x59a7a1,null))[_0x8fca('0x22')](function(_0x33d390){if(_0x33d390){_0x30d5e1=_0x33d390;return _0x33d390[_0x8fca('0x10b')]({'raw':!![]});}})['then'](function(_0x162b92){if(_0x30d5e1){if(_0x162b92){_0x3292ba=_0x162b92;}}return require(_0x8fca('0x7b'))['getLicense']();})[_0x8fca('0x22')](function(_0x3116ab){if(_0x3116ab){_0x4cdd80=_0x3116ab[_0x8fca('0x10c')];_0x32159e=_0x3116ab[_0x8fca('0x7d')];}})[_0x8fca('0x22')](function(){return db['ChatInteraction'][_0x8fca('0x31')]({'where':{'closed':![]}});})['then'](function(_0x55065c){_0x141812=_0x55065c;if(_0x4cdd80&&_0x55065c>_0x4cdd80){return db[_0x8fca('0x10d')]['findOne']({'where':{'id':0x1}})['then'](function(_0x2cea53){if(_0x2cea53){_0x2cea53[_0x8fca('0x10e')](_0x8fca('0x10f'));}});}})[_0x8fca('0x22')](function(){if(_0x30d5e1[_0x8fca('0x10a')]&&_0x30d5e1[_0x8fca('0x10a')][_0x8fca('0x110')]){var _0x7760fd=[];for(var _0xbec647=0x0;_0xbec647<_0x30d5e1[_0x8fca('0x10a')]['Intervals'][_0x8fca('0x48')];_0xbec647++){var _0x31ee5a=_0x30d5e1[_0x8fca('0x10a')][_0x8fca('0x110')][_0xbec647]['get']({'plain':!![]});_0x7760fd[_0x8fca('0xc1')](iftimePromise(_0x31ee5a,_0x30d5e1));}return BPromise['all'](_0x7760fd)['then'](function(_0xb8a989){return _[_0x8fca('0x111')](_0xb8a989);});}else{return!![];}})[_0x8fca('0x22')](function(_0x2ba269){var _0x3762d0=fs['readFileSync'](path[_0x8fca('0x79')](config[_0x8fca('0x7a')],_0x8fca('0x112')),_0x8fca('0xd7'));var _0x1ce248={'remote':_0x30d5e1[_0x8fca('0x113')],'query':querystring['stringify'](_[_0x8fca('0x4d')](_0x30d5e1['get']({'plain':!![]}),{'customerIp':_0x3b5e2c['headers'][_0x8fca('0xa8')]||_0x3b5e2c[_0x8fca('0xa7')][_0x8fca('0x114')]||_0x3b5e2c[_0x8fca('0x115')][_0x8fca('0x116')]||_0x3b5e2c['ip'],'referer':_0x3b5e2c[_0x8fca('0xa7')][_0x8fca('0xad')],'openedInteractions':_0x141812,'maxInteractions':_0x4cdd80,'virtual':_0x32159e[_0x8fca('0x10c')],'online':_0x2ba269,'custom':_0x32159e}))[_0x8fca('0x117')](/'/g,'\x5c\x27')};_0x59a7a1[_0x8fca('0x39')](ejs[_0x8fca('0x118')](Mustache['render'](_0x3762d0,_0x1ce248),{'proactiveActions':_0x3292ba,'alignment':_0x30d5e1[_0x8fca('0x119')],'verticalAlignment':_0x30d5e1['verticalAlignment'],'div_color':_0x30d5e1[_0x8fca('0xfd')],'text_color':_0x30d5e1[_0x8fca('0x11a')],'button_color':_0x30d5e1[_0x8fca('0x11b')],'background_color':_0x30d5e1[_0x8fca('0x11c')]}));})[_0x8fca('0x54')](handleError(_0x59a7a1,null));};exports[_0x8fca('0x11d')]=function(_0xaf693a,_0x2aa705,_0x1a105d){return db['ChatWebsite'][_0x8fca('0x6c')]({'where':{'id':_0xaf693a[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x2aa705,null))[_0x8fca('0x22')](function(_0x205f3b){if(_0x205f3b){return db['sequelize'][_0x8fca('0xe1')](function(_0x25b37e){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0xaf693a[_0x8fca('0x61')]['id']},'transaction':_0x25b37e})[_0x8fca('0x22')](function(_0x4a8614){var _0x6c821c=_[_0x8fca('0x3c')](_0xaf693a['body'],function(_0x286a5d){_0x286a5d[_0x8fca('0x64')]=_0xaf693a[_0x8fca('0x61')]['id'];return _0x286a5d;});return db[_0x8fca('0x9b')][_0x8fca('0xe3')](_0x6c821c,{'transaction':_0x25b37e});});})[_0x8fca('0x22')](function(){return db[_0x8fca('0x9b')][_0x8fca('0x11e')]({'where':{'ChatWebsiteId':_0xaf693a[_0x8fca('0x61')]['id']},'order':_0x8fca('0x11f')});});}})[_0x8fca('0x22')](respondWithResult(_0x2aa705,null))['catch'](handleError(_0x2aa705,null));};exports[_0x8fca('0x120')]=function(_0x1bf767,_0xfd094f,_0x2be677){var _0x4ebfae={};var _0x5e70d8={};var _0x3ddaa3;var _0x4b9b8d;return db[_0x8fca('0x3d')][_0x8fca('0x6c')]({'where':{'id':_0x1bf767[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0xfd094f,null))[_0x8fca('0x22')](function(_0x12700c){if(_0x12700c){_0x3ddaa3=_0x12700c;_0x5e70d8['model']=_[_0x8fca('0x43')](db[_0x8fca('0x9b')][_0x8fca('0x3e')]);_0x5e70d8[_0x8fca('0x42')]=_['keys'](_0x1bf767['query']);_0x5e70d8[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x5e70d8['model'],_0x5e70d8[_0x8fca('0x42')]);_0x4ebfae[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x5e70d8[_0x8fca('0x41')],qs[_0x8fca('0x47')](_0x1bf767[_0x8fca('0x42')][_0x8fca('0x47')]));_0x4ebfae[_0x8fca('0x46')]=_0x4ebfae['attributes'][_0x8fca('0x48')]?_0x4ebfae[_0x8fca('0x46')]:_0x5e70d8[_0x8fca('0x41')];_0x4ebfae[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x1bf767[_0x8fca('0x42')][_0x8fca('0x4b')]);_0x4ebfae[_0x8fca('0x4c')]=qs[_0x8fca('0x44')](_[_0x8fca('0x68')](_0x1bf767['query'],_0x5e70d8[_0x8fca('0x44')]));if(_0x1bf767[_0x8fca('0x42')][_0x8fca('0x4f')]){_0x4ebfae[_0x8fca('0x4c')]=_['merge'](_0x4ebfae[_0x8fca('0x4c')],{'$or':_['map'](_0x4ebfae[_0x8fca('0x46')],function(_0xd8f9da){var _0x19493d={};_0x19493d[_0xd8f9da]={'$like':'%'+_0x1bf767[_0x8fca('0x42')][_0x8fca('0x4f')]+'%'};return _0x19493d;})});}_0x4ebfae=_['merge']({},_0x4ebfae,_0x1bf767[_0x8fca('0x50')]);return _0x3ddaa3[_0x8fca('0x120')](_0x4ebfae);}})[_0x8fca('0x22')](function(_0x2d6485){if(_0x2d6485){_0x4b9b8d=_0x2d6485[_0x8fca('0x48')];if(!_0x1bf767[_0x8fca('0x42')][_0x8fca('0x67')](_0x8fca('0x49'))){_0x4ebfae['limit']=qs['limit'](_0x1bf767['query'][_0x8fca('0x32')]);_0x4ebfae['offset']=qs[_0x8fca('0x2f')](_0x1bf767[_0x8fca('0x42')]['offset']);}return _0x3ddaa3[_0x8fca('0x120')](_0x4ebfae);}})[_0x8fca('0x22')](function(_0x2c376c){if(_0x2c376c){return _0x2c376c?{'count':_0x4b9b8d,'rows':_0x2c376c}:null;}})[_0x8fca('0x22')](respondWithResult(_0xfd094f,null))['catch'](handleError(_0xfd094f,null));};exports[_0x8fca('0x121')]=function(_0x2b1634,_0x1539bd,_0x20c4ee){return db[_0x8fca('0x122')][_0x8fca('0x58')]({'where':{'id':_0x2b1634[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0x1539bd,null))['then'](function(_0x19db73){if(_0x19db73){return _0x19db73[_0x8fca('0x121')](_0x2b1634['body'][_0x8fca('0x6a')],_[_0x8fca('0xfa')](_0x2b1634[_0x8fca('0x5a')],['ids','id'])||{});}})[_0x8fca('0x22')](respondWithResult(_0x1539bd,null))[_0x8fca('0x54')](handleError(_0x1539bd,null));};exports[_0x8fca('0x10b')]=function(_0x31f40e,_0x56deb3,_0x22bb79){var _0x7e1851={};var _0x2e2fcf={};var _0x1b21a2;var _0x5543a2;return db[_0x8fca('0x3d')][_0x8fca('0x6c')]({'where':{'id':_0x31f40e[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x56deb3,null))[_0x8fca('0x22')](function(_0x47ec36){if(_0x47ec36){_0x1b21a2=_0x47ec36;_0x2e2fcf[_0x8fca('0x41')]=_[_0x8fca('0x43')](db[_0x8fca('0x123')]['rawAttributes']);_0x2e2fcf[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x31f40e['query']);_0x2e2fcf[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x2e2fcf[_0x8fca('0x41')],_0x2e2fcf[_0x8fca('0x42')]);_0x7e1851[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x2e2fcf[_0x8fca('0x41')],qs[_0x8fca('0x47')](_0x31f40e[_0x8fca('0x42')]['fields']));_0x7e1851[_0x8fca('0x46')]=_0x7e1851[_0x8fca('0x46')][_0x8fca('0x48')]?_0x7e1851[_0x8fca('0x46')]:_0x2e2fcf[_0x8fca('0x41')];_0x7e1851['order']=qs[_0x8fca('0x4b')](_0x31f40e[_0x8fca('0x42')]['sort']);_0x7e1851[_0x8fca('0x4c')]=qs[_0x8fca('0x44')](_[_0x8fca('0x68')](_0x31f40e[_0x8fca('0x42')],_0x2e2fcf[_0x8fca('0x44')]));if(_0x31f40e['query'][_0x8fca('0x4f')]){_0x7e1851[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0x7e1851[_0x8fca('0x4c')],{'$or':_[_0x8fca('0x3c')](_0x7e1851[_0x8fca('0x46')],function(_0x334d31){var _0x2964b4={};_0x2964b4[_0x334d31]={'$like':'%'+_0x31f40e[_0x8fca('0x42')][_0x8fca('0x4f')]+'%'};return _0x2964b4;})});}_0x7e1851=_[_0x8fca('0x4d')]({},_0x7e1851,_0x31f40e[_0x8fca('0x50')]);return _0x1b21a2['getProactiveActions'](_0x7e1851);}})[_0x8fca('0x22')](function(_0x4c6da6){if(_0x4c6da6){_0x5543a2=_0x4c6da6[_0x8fca('0x48')];if(!_0x31f40e['query']['hasOwnProperty'](_0x8fca('0x49'))){_0x7e1851[_0x8fca('0x32')]=qs[_0x8fca('0x32')](_0x31f40e[_0x8fca('0x42')][_0x8fca('0x32')]);_0x7e1851[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x31f40e['query'][_0x8fca('0x2f')]);}return _0x1b21a2[_0x8fca('0x10b')](_0x7e1851);}})[_0x8fca('0x22')](function(_0x3620d6){if(_0x3620d6){return _0x3620d6?{'count':_0x5543a2,'rows':_0x3620d6}:null;}})[_0x8fca('0x22')](respondWithResult(_0x56deb3,null))['catch'](handleError(_0x56deb3,null));};exports[_0x8fca('0x124')]=function(_0x464ad9,_0x47aea7,_0x36aa12){var _0xddd151=_0x464ad9[_0x8fca('0x42')]['online']===_0x8fca('0x125')?_0x8fca('0x126'):_0x8fca('0x127');return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'attributes':['id',_0xddd151],'where':{'id':_0x464ad9[_0x8fca('0x61')]['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x47aea7,null))[_0x8fca('0x22')](function(_0x1637c6){if(_0x1637c6){var _0x56c625=_0x1637c6[_0xddd151];var _0x29005d=_0x56c625&&_0x56c625[_0x8fca('0x128')]?_0x56c625['items']:[];_0x47aea7[_0x8fca('0x39')]({'fromKey':_[_0x8fca('0x7e')](_0x56c625[_0x8fca('0x129')])?undefined:_0x56c625[_0x8fca('0x129')],'count':_0x29005d[_0x8fca('0x48')],'rows':_0x29005d});}})[_0x8fca('0x54')](handleError(_0x47aea7,null));};exports[_0x8fca('0x12a')]=function(_0x2c03c3,_0x1b7337,_0x1f32d6){var _0x26667b={'raw':![],'where':{}};var _0x57bd50={};var _0xeb5c01={'count':0x0,'rows':[]};return db[_0x8fca('0x3d')][_0x8fca('0x6c')]({'where':{'id':_0x2c03c3[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0x1b7337,null))[_0x8fca('0x22')](function(_0x3f27ef){if(_0x3f27ef){_0x57bd50[_0x8fca('0x41')]=_[_0x8fca('0x43')](db[_0x8fca('0xd9')][_0x8fca('0x3e')]);_0x57bd50[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x2c03c3[_0x8fca('0x42')]);_0x57bd50[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x57bd50['model'],_0x57bd50[_0x8fca('0x42')]);_0x26667b[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x57bd50[_0x8fca('0x41')],qs['fields'](_0x2c03c3[_0x8fca('0x42')]['fields']));_0x26667b['attributes']=_0x26667b[_0x8fca('0x46')][_0x8fca('0x48')]?_0x26667b[_0x8fca('0x46')]:_0x57bd50[_0x8fca('0x41')];if(!_0x2c03c3[_0x8fca('0x42')][_0x8fca('0x67')]('nolimit')){_0x26667b['limit']=qs[_0x8fca('0x32')](_0x2c03c3[_0x8fca('0x42')]['limit']);_0x26667b[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x2c03c3[_0x8fca('0x42')][_0x8fca('0x2f')]);}_0x26667b[_0x8fca('0x4a')]=qs[_0x8fca('0x4b')](_0x2c03c3[_0x8fca('0x42')]['sort']);_0x26667b['where']=qs['filters'](_['pick'](_0x2c03c3[_0x8fca('0x42')],_0x57bd50[_0x8fca('0x44')]));_0x26667b[_0x8fca('0x4c')]['ChatWebsiteId']=_0x3f27ef['id'];if(_0x2c03c3['query'][_0x8fca('0x4f')]){_0x26667b[_0x8fca('0x4c')]=_[_0x8fca('0x4d')](_0x26667b[_0x8fca('0x4c')],{'$or':_['map'](_0x26667b['attributes'],function(_0x192ad1){var _0x2bb75b={};_0x2bb75b[_0x192ad1]={'$like':'%'+_0x2c03c3[_0x8fca('0x42')]['filter']+'%'};return _0x2bb75b;})});}_0x26667b=_[_0x8fca('0x4d')]({},_0x26667b,_0x2c03c3[_0x8fca('0x50')]);return db[_0x8fca('0xd9')]['count']({'where':_0x26667b[_0x8fca('0x4c')]})['then'](function(_0x49ccd1){_0xeb5c01[_0x8fca('0x31')]=_0x49ccd1;if(_0x2c03c3[_0x8fca('0x42')][_0x8fca('0x51')]){_0x26667b[_0x8fca('0x57')]=[{'all':!![]}];}else{_0x26667b['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8fca('0xe2')],'as':'Attachments','required':![]}];}return db[_0x8fca('0xd9')][_0x8fca('0x52')](_0x26667b);})[_0x8fca('0x22')](function(_0x280345){_0xeb5c01[_0x8fca('0x53')]=_0x280345;return _0xeb5c01;});}})['then'](respondWithFilteredResult(_0x1b7337,_0x26667b))[_0x8fca('0x54')](handleError(_0x1b7337,null));};exports[_0x8fca('0x12b')]=function(_0x50a017,_0x5118cd,_0x46e19f){return db[_0x8fca('0x3d')][_0x8fca('0x58')]({'where':{'id':_0x50a017['params']['id']}})[_0x8fca('0x22')](handleEntityNotFound(_0x5118cd,null))['then'](function(_0x1d8314){if(_0x1d8314){return _0x1d8314[_0x8fca('0x12b')](_0x50a017[_0x8fca('0x5a')][_0x8fca('0x6a')],_['omit'](_0x50a017['body'],[_0x8fca('0x6a'),'id'])||{})[_0x8fca('0xbc')](function(_0x379334){for(var _0x155f2a=0x0;_0x155f2a<_0x50a017[_0x8fca('0x5a')][_0x8fca('0x6a')]['length'];_0x155f2a+=0x1){socket[_0x8fca('0x12c')]('userChatWebsite:save',{'UserId':Number(_0x50a017[_0x8fca('0x5a')]['ids'][_0x155f2a]),'ChatWebsiteId':Number(_0x50a017['params']['id'])});}return _0x379334;});}})[_0x8fca('0x22')](respondWithResult(_0x5118cd,null))['catch'](handleError(_0x5118cd,null));};exports[_0x8fca('0x12d')]=function(_0x9bda9f,_0x494ea3,_0x500849){return db[_0x8fca('0x3d')]['find']({'where':{'id':_0x9bda9f[_0x8fca('0x61')]['id']}})['then'](handleEntityNotFound(_0x494ea3,null))[_0x8fca('0x22')](function(_0x39ba4e){if(_0x39ba4e){return _0x39ba4e[_0x8fca('0x12d')](_0x9bda9f['query'][_0x8fca('0x6a')])[_0x8fca('0x22')](function(){if(_[_0x8fca('0x12e')](_0x9bda9f[_0x8fca('0x42')][_0x8fca('0x6a')])){for(var _0x9b4f7=0x0;_0x9b4f7<_0x9bda9f['query'][_0x8fca('0x6a')][_0x8fca('0x48')];_0x9b4f7+=0x1){socket[_0x8fca('0x12c')]('userChatWebsite:remove',{'UserId':Number(_0x9bda9f['query'][_0x8fca('0x6a')][_0x9b4f7]),'ChatWebsiteId':Number(_0x9bda9f[_0x8fca('0x61')]['id'])});}}else{socket[_0x8fca('0x12c')](_0x8fca('0x12f'),{'UserId':Number(_0x9bda9f['query'][_0x8fca('0x6a')]),'ChatWebsiteId':Number(_0x9bda9f['params']['id'])});}});}})[_0x8fca('0x22')](respondWithStatusCode(_0x494ea3,null))[_0x8fca('0x54')](handleError(_0x494ea3,null));};exports[_0x8fca('0x130')]=function(_0x537f92,_0x4b2ef7,_0x4c7479){var _0x3a4262={};var _0x164128={};var _0x2cbde0;var _0x5d3c35;return db['ChatWebsite'][_0x8fca('0x6c')]({'where':{'id':_0x537f92['params']['id']}})['then'](handleEntityNotFound(_0x4b2ef7,null))[_0x8fca('0x22')](function(_0x39ae51){if(_0x39ae51){_0x2cbde0=_0x39ae51;_0x164128[_0x8fca('0x41')]=_[_0x8fca('0x43')](db[_0x8fca('0xc6')][_0x8fca('0x3e')]);_0x164128[_0x8fca('0x42')]=_[_0x8fca('0x43')](_0x537f92[_0x8fca('0x42')]);_0x164128[_0x8fca('0x44')]=_[_0x8fca('0x45')](_0x164128[_0x8fca('0x41')],_0x164128[_0x8fca('0x42')]);_0x3a4262[_0x8fca('0x46')]=_[_0x8fca('0x45')](_0x164128[_0x8fca('0x41')],qs[_0x8fca('0x47')](_0x537f92[_0x8fca('0x42')][_0x8fca('0x47')]));_0x3a4262['attributes']=_0x3a4262[_0x8fca('0x46')]['length']?_0x3a4262[_0x8fca('0x46')]:_0x164128[_0x8fca('0x41')];_0x3a4262['order']=qs[_0x8fca('0x4b')](_0x537f92['query'][_0x8fca('0x4b')]);_0x3a4262['where']=qs[_0x8fca('0x44')](_[_0x8fca('0x68')](_0x537f92['query'],_0x164128[_0x8fca('0x44')]));if(_0x537f92[_0x8fca('0x42')][_0x8fca('0x4f')]){_0x3a4262['where']=_['merge'](_0x3a4262[_0x8fca('0x4c')],{'$or':_['map'](_0x3a4262[_0x8fca('0x46')],function(_0x5e71d9){var _0x2fed2b={};_0x2fed2b[_0x5e71d9]={'$like':'%'+_0x537f92[_0x8fca('0x42')]['filter']+'%'};return _0x2fed2b;})});}_0x3a4262=_[_0x8fca('0x4d')]({},_0x3a4262,_0x537f92[_0x8fca('0x50')]);return _0x2cbde0[_0x8fca('0x130')](_0x3a4262);}})[_0x8fca('0x22')](function(_0x344b17){if(_0x344b17){_0x5d3c35=_0x344b17[_0x8fca('0x48')];if(!_0x537f92[_0x8fca('0x42')]['hasOwnProperty'](_0x8fca('0x49'))){_0x3a4262[_0x8fca('0x32')]=qs[_0x8fca('0x32')](_0x537f92[_0x8fca('0x42')][_0x8fca('0x32')]);_0x3a4262[_0x8fca('0x2f')]=qs[_0x8fca('0x2f')](_0x537f92['query'][_0x8fca('0x2f')]);}return _0x2cbde0['getAgents'](_0x3a4262);}})[_0x8fca('0x22')](function(_0x40ae7d){if(_0x40ae7d){return _0x40ae7d?{'count':_0x5d3c35,'rows':_0x40ae7d}:null;}})[_0x8fca('0x22')](respondWithResult(_0x4b2ef7,null))[_0x8fca('0x54')](handleError(_0x4b2ef7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 98b5642..0ca2a51 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 _0xab86=['ChatWebsite','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1d84a1,_0x3ab940){var _0x3ec418=function(_0x1a29b6){while(--_0x1a29b6){_0x1d84a1['push'](_0x1d84a1['shift']());}};_0x3ec418(++_0x3ab940);}(_0xab86,0x13e));var _0x6ab8=function(_0x382a03,_0x1b43f1){_0x382a03=_0x382a03-0x0;var _0x1794e0=_0xab86[_0x382a03];return _0x1794e0;};'use strict';var EventEmitter=require(_0x6ab8('0x0'));var ChatWebsite=require(_0x6ab8('0x1'))['db'][_0x6ab8('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ab8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1193a1){return function(_0x48cb6a,_0xf27ba7,_0x40e2ad){ChatWebsiteEvents[_0x6ab8('0x4')](_0x1193a1+':'+_0x48cb6a['id'],_0x48cb6a);ChatWebsiteEvents[_0x6ab8('0x4')](_0x1193a1,_0x48cb6a);_0x40e2ad(null);};}for(var e in events){if(events[_0x6ab8('0x5')](e)){var event=events[e];ChatWebsite[_0x6ab8('0x6')](e,emitEvent(event));}}module[_0x6ab8('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7bae=['ChatWebsite','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0xf2a52b,_0x149ae2){var _0x5f2e44=function(_0x13f749){while(--_0x13f749){_0xf2a52b['push'](_0xf2a52b['shift']());}};_0x5f2e44(++_0x149ae2);}(_0x7bae,0x13b));var _0xe7ba=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7bae[_0x55e08b];return _0xd1a7ff;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xe7ba('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe7ba('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7ba('0x2'),'afterDestroy':'remove'};function emitEvent(_0x120efa){return function(_0x10908b,_0x166acb,_0x2276df){ChatWebsiteEvents[_0xe7ba('0x3')](_0x120efa+':'+_0x10908b['id'],_0x10908b);ChatWebsiteEvents[_0xe7ba('0x3')](_0x120efa,_0x10908b);_0x2276df(null);};}for(var e in events){if(events[_0xe7ba('0x4')](e)){var event=events[e];ChatWebsite[_0xe7ba('0x5')](e,emitEvent(event));}}module[_0xe7ba('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 3bacb5c..7d88536 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 _0x85a1=['request-promise','path','rimraf','../../config/environment','define','ChatWebsite','chat_websites','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85a1,0x151));var _0x185a=function(_0x3937e9,_0x5101bb){_0x3937e9=_0x3937e9-0x0;var _0x16dc36=_0x85a1[_0x3937e9];return _0x16dc36;};'use strict';var _=require('lodash');var util=require(_0x185a('0x0'));var logger=require('../../config/logger')(_0x185a('0x1'));var moment=require('moment');var BPromise=require(_0x185a('0x2'));var rp=require(_0x185a('0x3'));var fs=require('fs');var path=require(_0x185a('0x4'));var rimraf=require(_0x185a('0x5'));var config=require(_0x185a('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x4fd4b7,_0x9ca1de){return _0x4fd4b7[_0x185a('0x7')](_0x185a('0x8'),attributes,{'tableName':_0x185a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b3=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites','util','../../config/logger','api','moment','bluebird'];(function(_0x39f470,_0x30a1bc){var _0x3ea2a5=function(_0x495464){while(--_0x495464){_0x39f470['push'](_0x39f470['shift']());}};_0x3ea2a5(++_0x30a1bc);}(_0xc2b3,0x157));var _0x3c2b=function(_0x5218b1,_0x1adbe3){_0x5218b1=_0x5218b1-0x0;var _0x2013e9=_0xc2b3[_0x5218b1];return _0x2013e9;};'use strict';var _=require('lodash');var util=require(_0x3c2b('0x0'));var logger=require(_0x3c2b('0x1'))(_0x3c2b('0x2'));var moment=require(_0x3c2b('0x3'));var BPromise=require(_0x3c2b('0x4'));var rp=require(_0x3c2b('0x5'));var fs=require('fs');var path=require(_0x3c2b('0x6'));var rimraf=require(_0x3c2b('0x7'));var config=require(_0x3c2b('0x8'));var attributes=require(_0x3c2b('0x9'));module[_0x3c2b('0xa')]=function(_0x59dbdd,_0x41fac0){return _0x59dbdd['define']('ChatWebsite',attributes,{'tableName':_0x3c2b('0xb'),'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 55e4550..432ec77 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 _0x6087=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x6b53dd,_0x35f27f){var _0x4af653=function(_0x509261){while(--_0x509261){_0x6b53dd['push'](_0x6b53dd['shift']());}};_0x4af653(++_0x35f27f);}(_0x6087,0x1db));var _0x7608=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6087[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7608('0x0'));var util=require(_0x7608('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7608('0x2'));var fs=require('fs');var Redis=require(_0x7608('0x3'));var db=require(_0x7608('0x4'))['db'];var utils=require(_0x7608('0x5'));var logger=require('../../config/logger')(_0x7608('0x6'));var config=require(_0x7608('0x7'));var jayson=require(_0x7608('0x8'));var client=jayson[_0x7608('0x9')][_0x7608('0xa')]({'port':0x232a});config[_0x7608('0xb')]=_['defaults'](config[_0x7608('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7608('0xb')]));require(_0x7608('0xc'))[_0x7608('0xd')](socket);function respondWithRpcPromise(_0x3a684c,_0xded955,_0x13439b){return new BPromise(function(_0x20e2bc,_0x34777c){return client[_0x7608('0xe')](_0x3a684c,_0x13439b)['then'](function(_0x44b5b2){logger[_0x7608('0xf')]('ChatWebsite,\x20%s,\x20%s',_0xded955,_0x7608('0x10'));logger[_0x7608('0x11')](_0x7608('0x12'),_0xded955,_0x7608('0x10'),JSON[_0x7608('0x13')](_0x44b5b2));if(_0x44b5b2['error']){if(_0x44b5b2[_0x7608('0x14')][_0x7608('0x15')]===0x1f4){logger['error'](_0x7608('0x16'),_0xded955,_0x44b5b2[_0x7608('0x14')]['message']);return _0x34777c(_0x44b5b2[_0x7608('0x14')][_0x7608('0x17')]);}logger[_0x7608('0x14')](_0x7608('0x16'),_0xded955,_0x44b5b2[_0x7608('0x14')][_0x7608('0x17')]);return _0x20e2bc(_0x44b5b2[_0x7608('0x14')][_0x7608('0x17')]);}else{logger[_0x7608('0xf')](_0x7608('0x16'),_0xded955,_0x7608('0x10'));_0x20e2bc(_0x44b5b2[_0x7608('0x18')][_0x7608('0x17')]);}})[_0x7608('0x19')](function(_0x6574ee){logger[_0x7608('0x14')](_0x7608('0x16'),_0xded955,_0x6574ee);_0x34777c(_0x6574ee);});});} \ No newline at end of file +var _0x9c9a=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52fb31,_0x8af16b){var _0x1139ec=function(_0x2130eb){while(--_0x2130eb){_0x52fb31['push'](_0x52fb31['shift']());}};_0x1139ec(++_0x8af16b);}(_0x9c9a,0xe8));var _0xa9c9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9c9a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa9c9('0x0'));var util=require(_0xa9c9('0x1'));var moment=require(_0xa9c9('0x2'));var BPromise=require(_0xa9c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9c9('0x4'));var db=require(_0xa9c9('0x5'))['db'];var utils=require(_0xa9c9('0x6'));var logger=require(_0xa9c9('0x7'))(_0xa9c9('0x8'));var config=require(_0xa9c9('0x9'));var jayson=require(_0xa9c9('0xa'));var client=jayson[_0xa9c9('0xb')][_0xa9c9('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa9c9('0xd')],{'host':_0xa9c9('0xe'),'port':0x18eb});var socket=require(_0xa9c9('0xf'))(new Redis(config[_0xa9c9('0xd')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x96e73b,_0xee5faa,_0x5c0af7){return new BPromise(function(_0x458e22,_0x568604){return client['request'](_0x96e73b,_0x5c0af7)['then'](function(_0x2f09a6){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xee5faa,_0xa9c9('0x10'));logger['debug'](_0xa9c9('0x11'),_0xee5faa,_0xa9c9('0x10'),JSON[_0xa9c9('0x12')](_0x2f09a6));if(_0x2f09a6[_0xa9c9('0x13')]){if(_0x2f09a6[_0xa9c9('0x13')][_0xa9c9('0x14')]===0x1f4){logger[_0xa9c9('0x13')](_0xa9c9('0x15'),_0xee5faa,_0x2f09a6[_0xa9c9('0x13')][_0xa9c9('0x16')]);return _0x568604(_0x2f09a6[_0xa9c9('0x13')]['message']);}logger[_0xa9c9('0x13')](_0xa9c9('0x15'),_0xee5faa,_0x2f09a6[_0xa9c9('0x13')][_0xa9c9('0x16')]);return _0x458e22(_0x2f09a6['error'][_0xa9c9('0x16')]);}else{logger['info'](_0xa9c9('0x15'),_0xee5faa,_0xa9c9('0x10'));_0x458e22(_0x2f09a6['result']['message']);}})[_0xa9c9('0x17')](function(_0x1269bb){logger[_0xa9c9('0x13')]('ChatWebsite,\x20%s,\x20%s',_0xee5faa,_0x1269bb);_0x568604(_0x1269bb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d33b636..94a638f 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 _0xe554=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x3c3dbe,_0x4461ac){var _0x25ea89=function(_0x4e9993){while(--_0x4e9993){_0x3c3dbe['push'](_0x3c3dbe['shift']());}};_0x25ea89(++_0x4461ac);}(_0xe554,0x85));var _0x4e55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe554[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x4e55('0x0'));var events=[_0x4e55('0x1'),_0x4e55('0x2'),'update'];function createListener(_0x353eb8,_0x2649f){return function(_0x276e0f){_0x2649f[_0x4e55('0x3')](_0x353eb8,_0x276e0f);};}function removeListener(_0x2dbf99,_0x1f840f){return function(){ChatWebsiteEvents[_0x4e55('0x4')](_0x2dbf99,_0x1f840f);};}exports[_0x4e55('0x5')]=function(_0x2f5293){for(var _0x6f4d2f=0x0,_0x2bd80e=events[_0x4e55('0x6')];_0x6f4d2f<_0x2bd80e;_0x6f4d2f++){var _0x4a16e4=events[_0x6f4d2f];var _0x513608=createListener(_0x4e55('0x7')+_0x4a16e4,_0x2f5293);ChatWebsiteEvents['on'](_0x4a16e4,_0x513608);}}; \ No newline at end of file +var _0xb94a=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xb94a,0x1a8));var _0xab94=function(_0x5d4f0f,_0xd564f1){_0x5d4f0f=_0x5d4f0f-0x0;var _0x558fe2=_0xb94a[_0x5d4f0f];return _0x558fe2;};'use strict';var ChatWebsiteEvents=require(_0xab94('0x0'));var events=[_0xab94('0x1'),_0xab94('0x2'),'update'];function createListener(_0x4850ac,_0x563d2e){return function(_0x186813){_0x563d2e['emit'](_0x4850ac,_0x186813);};}function removeListener(_0x215e56,_0x32a228){return function(){ChatWebsiteEvents[_0xab94('0x3')](_0x215e56,_0x32a228);};}exports[_0xab94('0x4')]=function(_0x4a8de5){for(var _0x299cf5=0x0,_0x31cf12=events[_0xab94('0x5')];_0x299cf5<_0x31cf12;_0x299cf5++){var _0x46787f=events[_0x299cf5];var _0x4176c4=createListener(_0xab94('0x6')+_0x46787f,_0x4a8de5);ChatWebsiteEvents['on'](_0x46787f,_0x4176c4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 01b3603..a069693 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 _0xf08f=['post','addAnswer','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addCustomerAvatar','diskStorage','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','/:id/applications','addProactiveActions','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create','/:id/dispositions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf08f,0xb4));var _0xff08=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0xf08f[_0x1a0600];return _0x734670;};'use strict';var multer=require('multer');var util=require(_0xff08('0x0'));var path=require(_0xff08('0x1'));var timeout=require(_0xff08('0x2'));var express=require(_0xff08('0x3'));var router=express[_0xff08('0x4')]();var fs_extra=require(_0xff08('0x5'));var auth=require(_0xff08('0x6'));var interaction=require(_0xff08('0x7'));var config=require(_0xff08('0x8'));var controller=require(_0xff08('0x9'));router[_0xff08('0xa')]('/',auth[_0xff08('0xb')](),controller['index']);router[_0xff08('0xa')](_0xff08('0xc'),auth['isAuthenticated'](),controller[_0xff08('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff08('0xe')]);router[_0xff08('0xa')]('/:id/dispositions',auth[_0xff08('0xb')](),controller[_0xff08('0xf')]);router[_0xff08('0xa')](_0xff08('0x10'),auth[_0xff08('0xb')](),controller['getAnswers']);router[_0xff08('0xa')](_0xff08('0x11'),controller[_0xff08('0x12')]);router[_0xff08('0xa')]('/:id/avatar',controller[_0xff08('0x13')]);router[_0xff08('0xa')](_0xff08('0x14'),controller[_0xff08('0x15')]);router[_0xff08('0xa')](_0xff08('0x16'),controller[_0xff08('0x17')]);router[_0xff08('0xa')](_0xff08('0x18'),auth[_0xff08('0xb')](),controller[_0xff08('0x19')]);router[_0xff08('0xa')](_0xff08('0x1a'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xff08('0xb')](),controller['getApplications']);router[_0xff08('0xa')](_0xff08('0x1b'),auth['isAuthenticated'](),controller[_0xff08('0x1c')]);router[_0xff08('0xa')](_0xff08('0x1d'),controller[_0xff08('0x1e')]);router[_0xff08('0xa')](_0xff08('0x1f'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xff08('0xa')](_0xff08('0x20'),auth[_0xff08('0xb')](),controller[_0xff08('0x21')]);router['post']('/',auth[_0xff08('0xb')](),controller[_0xff08('0x22')]);router['post'](_0xff08('0x23'),auth[_0xff08('0xb')](),controller['addDisposition']);router[_0xff08('0x24')](_0xff08('0x10'),auth[_0xff08('0xb')](),controller[_0xff08('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5efac3,_0x1c2364,_0x320e74){_0x320e74(null,path[_0xff08('0x26')](config[_0xff08('0x27')],'server/files/images/logos/'));},'filename':function(_0x2630d3,_0xb55c13,_0x4ec90a){_0x4ec90a(null,util[_0xff08('0x28')](_0xff08('0x29'),Date[_0xff08('0x2a')](),_0xb55c13[_0xff08('0x2b')]));}})});router['post'](_0xff08('0x11'),upload[_0xff08('0x2c')](_0xff08('0x2d')),controller[_0xff08('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1975ff,_0xe0f44f,_0x59818c){_0x59818c(null,path[_0xff08('0x26')](config[_0xff08('0x27')],_0xff08('0x2f')));},'filename':function(_0x473dd7,_0x523d45,_0x28d8d2){_0x28d8d2(null,util[_0xff08('0x28')](_0xff08('0x29'),Date[_0xff08('0x2a')](),_0x523d45[_0xff08('0x2b')]));}})});router[_0xff08('0x24')](_0xff08('0x30'),upload[_0xff08('0x2c')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x236e50,_0x4e773a,_0x57c1db){_0x57c1db(null,path[_0xff08('0x26')](config[_0xff08('0x27')],_0xff08('0x2f')));},'filename':function(_0x27fc7b,_0x1a9ff4,_0x3eac5f){_0x3eac5f(null,util[_0xff08('0x28')](_0xff08('0x29'),Date[_0xff08('0x2a')](),_0x1a9ff4[_0xff08('0x2b')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0xff08('0x2d')),controller[_0xff08('0x31')]);var upload=multer({'storage':multer[_0xff08('0x32')]({'destination':function(_0x4ea58c,_0xb86772,_0x534eee){_0x534eee(null,path[_0xff08('0x26')](config[_0xff08('0x27')],_0xff08('0x2f')));},'filename':function(_0x4938ca,_0x2e490c,_0x1c6a1d){_0x1c6a1d(null,util[_0xff08('0x28')](_0xff08('0x29'),Date['now'](),_0x2e490c[_0xff08('0x2b')]));}})});router[_0xff08('0x24')](_0xff08('0x16'),upload['single'](_0xff08('0x2d')),controller[_0xff08('0x33')]);router[_0xff08('0x24')](_0xff08('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xff08('0x32')]({'destination':function(_0x351725,_0x3eba6f,_0x446562){const _0x30f073=path[_0xff08('0x26')](config['root'],_0xff08('0x35'),_0xff08('0x36'),_0xff08('0x37'));fs_extra['ensureDir'](_0x30f073,function(){_0x446562(null,_0x30f073);});},'filename':function(_0x1f80ee,_0x2a69ab,_0x403ca0){const _0x2742e6=_0x2a69ab[_0xff08('0x2b')][_0xff08('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xb72d3f=path[_0xff08('0x39')](_0x2742e6);const _0x3d2f57=Date[_0xff08('0x2a')]()+'-'+_0x2742e6['replace'](_0xb72d3f,'')+_0xb72d3f;_0x403ca0(null,_0x3d2f57);}})});router[_0xff08('0x24')](_0xff08('0x3a'),offlineUploadMulter['any'](),controller[_0xff08('0x3b')]);router[_0xff08('0x24')](_0xff08('0x18'),auth[_0xff08('0xb')](),controller['addInteraction']);router[_0xff08('0x24')](_0xff08('0x3c'),auth[_0xff08('0xb')](),controller['addApplications']);router[_0xff08('0x24')](_0xff08('0x1b'),auth[_0xff08('0xb')](),controller[_0xff08('0x3d')]);router[_0xff08('0x24')](_0xff08('0x20'),auth[_0xff08('0xb')](),controller[_0xff08('0x3e')]);router[_0xff08('0x3f')]('/:id',auth[_0xff08('0xb')](),controller[_0xff08('0x40')]);router[_0xff08('0x41')](_0xff08('0x42'),auth['isAuthenticated'](),controller[_0xff08('0x43')]);router[_0xff08('0x41')](_0xff08('0x23'),auth['isAuthenticated'](),controller[_0xff08('0x44')]);router[_0xff08('0x41')](_0xff08('0x10'),auth['isAuthenticated'](),controller[_0xff08('0x45')]);router['delete'](_0xff08('0x20'),auth[_0xff08('0xb')](),controller[_0xff08('0x46')]);module[_0xff08('0x47')]=router; \ No newline at end of file +var _0xd05b=['server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','format','%s-%s','now','single','file','addLogo','root'];(function(_0x57dc91,_0x267319){var _0x1aa47b=function(_0x22f0da){while(--_0x22f0da){_0x57dc91['push'](_0x57dc91['shift']());}};_0x1aa47b(++_0x267319);}(_0xd05b,0xa3));var _0xbd05=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd05b[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xbd05('0x0'));var util=require(_0xbd05('0x1'));var path=require(_0xbd05('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd05('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd05('0x4'));var interaction=require(_0xbd05('0x5'));var config=require(_0xbd05('0x6'));var controller=require(_0xbd05('0x7'));router['get']('/',auth[_0xbd05('0x8')](),controller[_0xbd05('0x9')]);router[_0xbd05('0xa')](_0xbd05('0xb'),auth[_0xbd05('0x8')](),controller[_0xbd05('0xc')]);router[_0xbd05('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbd05('0xd')]);router[_0xbd05('0xa')](_0xbd05('0xe'),auth[_0xbd05('0x8')](),controller[_0xbd05('0xf')]);router[_0xbd05('0xa')](_0xbd05('0x10'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x11')]);router[_0xbd05('0xa')](_0xbd05('0x12'),controller[_0xbd05('0x13')]);router[_0xbd05('0xa')](_0xbd05('0x14'),controller['getAvatar']);router[_0xbd05('0xa')](_0xbd05('0x15'),controller[_0xbd05('0x16')]);router[_0xbd05('0xa')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xbd05('0xa')]('/:id/interactions',auth[_0xbd05('0x8')](),controller[_0xbd05('0x17')]);router[_0xbd05('0xa')]('/:id/snippet',controller[_0xbd05('0x18')]);router['get'](_0xbd05('0x19'),auth[_0xbd05('0x8')](),controller['getApplications']);router[_0xbd05('0xa')](_0xbd05('0x1a'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x1b')]);router[_0xbd05('0xa')]('/:id/fields',controller[_0xbd05('0x1c')]);router[_0xbd05('0xa')](_0xbd05('0x1d'),auth[_0xbd05('0x8')](),controller['getOfflineMessages']);router['get'](_0xbd05('0x1e'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x1f')]);router[_0xbd05('0x20')]('/',auth[_0xbd05('0x8')](),controller[_0xbd05('0x21')]);router[_0xbd05('0x20')](_0xbd05('0xe'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x22')]);router['post'](_0xbd05('0x10'),auth[_0xbd05('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xbd05('0x23')]({'destination':function(_0x3ad091,_0x28ba48,_0x5c9f85){_0x5c9f85(null,path[_0xbd05('0x24')](config['root'],'server/files/images/logos/'));},'filename':function(_0x364be8,_0x236b21,_0x1257f7){_0x1257f7(null,util[_0xbd05('0x25')](_0xbd05('0x26'),Date[_0xbd05('0x27')](),_0x236b21['originalname']));}})});router['post'](_0xbd05('0x12'),upload[_0xbd05('0x28')](_0xbd05('0x29')),controller[_0xbd05('0x2a')]);var upload=multer({'storage':multer[_0xbd05('0x23')]({'destination':function(_0x57d838,_0x18e748,_0xfc2669){_0xfc2669(null,path[_0xbd05('0x24')](config[_0xbd05('0x2b')],_0xbd05('0x2c')));},'filename':function(_0xc9664,_0x20c01e,_0x47b059){_0x47b059(null,util['format'](_0xbd05('0x26'),Date['now'](),_0x20c01e[_0xbd05('0x2d')]));}})});router['post'](_0xbd05('0x14'),upload[_0xbd05('0x28')](_0xbd05('0x29')),controller[_0xbd05('0x2e')]);var upload=multer({'storage':multer[_0xbd05('0x23')]({'destination':function(_0x57d315,_0x2fe339,_0x4fb650){_0x4fb650(null,path['join'](config['root'],_0xbd05('0x2c')));},'filename':function(_0x26b8a1,_0x47c08d,_0x42f0f8){_0x42f0f8(null,util[_0xbd05('0x25')](_0xbd05('0x26'),Date['now'](),_0x47c08d[_0xbd05('0x2d')]));}})});router[_0xbd05('0x20')](_0xbd05('0x15'),upload[_0xbd05('0x28')](_0xbd05('0x29')),controller[_0xbd05('0x2f')]);var upload=multer({'storage':multer[_0xbd05('0x23')]({'destination':function(_0x524d55,_0x27519a,_0x30023b){_0x30023b(null,path['join'](config[_0xbd05('0x2b')],_0xbd05('0x2c')));},'filename':function(_0x43d891,_0x364bcb,_0x54ed5c){_0x54ed5c(null,util[_0xbd05('0x25')](_0xbd05('0x26'),Date[_0xbd05('0x27')](),_0x364bcb['originalname']));}})});router[_0xbd05('0x20')](_0xbd05('0x30'),upload['single'](_0xbd05('0x29')),controller[_0xbd05('0x31')]);router[_0xbd05('0x20')](_0xbd05('0x32'),controller[_0xbd05('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xbd05('0x23')]({'destination':function(_0x3a30cc,_0x3b18b8,_0x484307){const _0x4cd89b=path[_0xbd05('0x24')](config[_0xbd05('0x2b')],_0xbd05('0x34'),'attachments','offline-chat');fs_extra[_0xbd05('0x35')](_0x4cd89b,function(){_0x484307(null,_0x4cd89b);});},'filename':function(_0x1e59de,_0x283668,_0x5460b8){const _0x50b41f=_0x283668['originalname'][_0xbd05('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x42a027=path[_0xbd05('0x37')](_0x50b41f);const _0x1e15bf=Date['now']()+'-'+_0x50b41f[_0xbd05('0x36')](_0x42a027,'')+_0x42a027;_0x5460b8(null,_0x1e15bf);}})});router[_0xbd05('0x20')]('/:id/offline',offlineUploadMulter[_0xbd05('0x38')](),controller[_0xbd05('0x39')]);router[_0xbd05('0x20')](_0xbd05('0x3a'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x3b')]);router[_0xbd05('0x20')](_0xbd05('0x19'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x3c')]);router[_0xbd05('0x20')](_0xbd05('0x1a'),auth['isAuthenticated'](),controller[_0xbd05('0x3d')]);router[_0xbd05('0x20')](_0xbd05('0x1e'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x3e')]);router['put'](_0xbd05('0x3f'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x40')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xbd05('0xe'),auth[_0xbd05('0x8')](),controller['removeDispositions']);router[_0xbd05('0x41')](_0xbd05('0x10'),auth[_0xbd05('0x8')](),controller[_0xbd05('0x42')]);router[_0xbd05('0x41')]('/:id/users',auth[_0xbd05('0x8')](),controller[_0xbd05('0x43')]);module[_0xbd05('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 386eaf8..1714401 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 _0xdbcd=['Google','STRING','sequelize','exports','AmazonAWS'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x5116a3,_0x1054c0){_0x5116a3=_0x5116a3-0x0;var _0x4f3d35=_0xdbcd[_0x5116a3];return _0x4f3d35;};'use strict';var Sequelize=require(_0xddbc('0x0'));module[_0xddbc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xddbc('0x2'),_0xddbc('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xddbc('0x4')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad78=['STRING','sequelize','ENUM','AmazonAWS'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0xad78,0x149));var _0x8ad7=function(_0x4b8d1e,_0x2f42e8){_0x4b8d1e=_0x4b8d1e-0x0;var _0x573b97=_0xad78[_0x4b8d1e];return _0x573b97;};'use strict';var Sequelize=require(_0x8ad7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8ad7('0x1')](_0x8ad7('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8ad7('0x3')]},'data2':{'type':Sequelize[_0x8ad7('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 06cec4f..8592bea 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 _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x51e422,_0x2b8fc6){var _0x22b3fd=function(_0x3bc5c4){while(--_0x3bc5c4){_0x51e422['push'](_0x51e422['shift']());}};_0x22b3fd(++_0x2b8fc6);}(_0xdb28,0x106));var _0x8db2=function(_0x296d71,_0x18654f){_0x296d71=_0x296d71-0x0;var _0x5d3a1b=_0xdb28[_0x296d71];return _0x5d3a1b;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x584382,_0x31d0a9){var _0x572477=function(_0x264f89){while(--_0x264f89){_0x584382['push'](_0x584382['shift']());}};_0x572477(++_0x31d0a9);}(_0x7a54,0x106));var _0x47a5=function(_0x551914,_0x3f5778){_0x551914=_0x551914-0x0;var _0x383967=_0x7a54[_0x551914];return _0x383967;};'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['CloudProvider'][_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['CloudProvider']['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['CloudProvider']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4e058f9..8f54e8c 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 _0x21d8=['api','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x3a5db4,_0x45eecf){var _0x111f12=function(_0x726c8a){while(--_0x726c8a){_0x3a5db4['push'](_0x3a5db4['shift']());}};_0x111f12(++_0x45eecf);}(_0x21d8,0x7f));var _0x821d=function(_0x2080f5,_0x54e556){_0x2080f5=_0x2080f5-0x0;var _0x560366=_0x21d8[_0x2080f5];return _0x560366;};'use strict';var _=require(_0x821d('0x0'));var util=require(_0x821d('0x1'));var logger=require(_0x821d('0x2'))(_0x821d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x821d('0x4'));var fs=require('fs');var path=require(_0x821d('0x5'));var rimraf=require(_0x821d('0x6'));var config=require(_0x821d('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x821d('0x8')]=function(_0x56b347,_0x2a7158){return _0x56b347[_0x821d('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1da=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','api','bluebird'];(function(_0x30c798,_0x5089df){var _0x448801=function(_0x206de2){while(--_0x206de2){_0x30c798['push'](_0x30c798['shift']());}};_0x448801(++_0x5089df);}(_0xb1da,0x1a0));var _0xab1d=function(_0x5298f3,_0x521486){_0x5298f3=_0x5298f3-0x0;var _0x42dca6=_0xb1da[_0x5298f3];return _0x42dca6;};'use strict';var _=require(_0xab1d('0x0'));var util=require(_0xab1d('0x1'));var logger=require('../../config/logger')(_0xab1d('0x2'));var moment=require('moment');var BPromise=require(_0xab1d('0x3'));var rp=require(_0xab1d('0x4'));var fs=require('fs');var path=require(_0xab1d('0x5'));var rimraf=require(_0xab1d('0x6'));var config=require(_0xab1d('0x7'));var attributes=require(_0xab1d('0x8'));module[_0xab1d('0x9')]=function(_0x25a65b,_0x5371b1){return _0x25a65b['define'](_0xab1d('0xa'),attributes,{'tableName':_0xab1d('0xb'),'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 7b5253e..71ff349 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 _0x4325=['http','request','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x3d88b1,_0x211d5a){var _0x503cf0=function(_0x3409de){while(--_0x3409de){_0x3d88b1['push'](_0x3d88b1['shift']());}};_0x503cf0(++_0x211d5a);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('CloudProvider,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file +var _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3f4f17,_0x344491){var _0x5ac8af=function(_0x48dee2){while(--_0x48dee2){_0x3f4f17['push'](_0x3f4f17['shift']());}};_0x5ac8af(++_0x344491);}(_0xd786,0x1dc));var _0x6d78=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd786[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2f90f21..26db7d9 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 _0x2431=['./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4a5d01,_0x1e923e){var _0xd23107=function(_0x5a4e00){while(--_0x5a4e00){_0x4a5d01['push'](_0x4a5d01['shift']());}};_0xd23107(++_0x1e923e);}(_0x2431,0xc9));var _0x1243=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2431[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x1243('0x0'));var util=require(_0x1243('0x1'));var path=require('path');var timeout=require(_0x1243('0x2'));var express=require(_0x1243('0x3'));var router=express['Router']();var fs_extra=require(_0x1243('0x4'));var auth=require(_0x1243('0x5'));var interaction=require(_0x1243('0x6'));var config=require(_0x1243('0x7'));var controller=require(_0x1243('0x8'));router[_0x1243('0x9')]('/',auth[_0x1243('0xa')](),controller[_0x1243('0xb')]);router[_0x1243('0x9')](_0x1243('0xc'),auth[_0x1243('0xa')](),controller[_0x1243('0xd')]);router[_0x1243('0xe')]('/',auth[_0x1243('0xa')](),controller['create']);router[_0x1243('0xf')](_0x1243('0xc'),auth[_0x1243('0xa')](),controller['update']);router[_0x1243('0x10')](_0x1243('0xc'),auth[_0x1243('0xa')](),controller[_0x1243('0x11')]);module[_0x1243('0x12')]=router; \ No newline at end of file +var _0x8323=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x4e545c,_0x46707f){var _0x23695d=function(_0x2d3ee4){while(--_0x2d3ee4){_0x4e545c['push'](_0x4e545c['shift']());}};_0x23695d(++_0x46707f);}(_0x8323,0x1d2));var _0x3832=function(_0x56fed6,_0x13af3c){_0x56fed6=_0x56fed6-0x0;var _0x48f3b3=_0x8323[_0x56fed6];return _0x48f3b3;};'use strict';var multer=require(_0x3832('0x0'));var util=require(_0x3832('0x1'));var path=require(_0x3832('0x2'));var timeout=require(_0x3832('0x3'));var express=require(_0x3832('0x4'));var router=express[_0x3832('0x5')]();var fs_extra=require(_0x3832('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3832('0x7'));var config=require(_0x3832('0x8'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x3832('0x9')](),controller[_0x3832('0xa')]);router[_0x3832('0xb')](_0x3832('0xc'),auth['isAuthenticated'](),controller[_0x3832('0xd')]);router[_0x3832('0xe')]('/',auth[_0x3832('0x9')](),controller[_0x3832('0xf')]);router[_0x3832('0x10')](_0x3832('0xc'),auth['isAuthenticated'](),controller[_0x3832('0x11')]);router['delete'](_0x3832('0xc'),auth[_0x3832('0x9')](),controller[_0x3832('0x12')]);module[_0x3832('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c764405..0163d5a 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 _0x0061=['name','sequelize','STRING'];(function(_0x31c4ef,_0x3ac2d8){var _0x2eb5f5=function(_0x3b81e1){while(--_0x3b81e1){_0x31c4ef['push'](_0x31c4ef['shift']());}};_0x2eb5f5(++_0x3ac2d8);}(_0x0061,0x91));var _0x1006=function(_0x4fc54c,_0x55e7f8){_0x4fc54c=_0x4fc54c-0x0;var _0xd71ebc=_0x0061[_0x4fc54c];return _0xd71ebc;};'use strict';var Sequelize=require(_0x1006('0x0'));module['exports']={'name':{'type':Sequelize[_0x1006('0x1')],'unique':_0x1006('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1006('0x1')]},'companyId':{'type':Sequelize[_0x1006('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1006('0x1')]},'fax':{'type':Sequelize[_0x1006('0x1')]},'type':{'type':Sequelize[_0x1006('0x1')]},'street':{'type':Sequelize[_0x1006('0x1')]},'postalCode':{'type':Sequelize[_0x1006('0x1')]},'city':{'type':Sequelize[_0x1006('0x1')]},'country':{'type':Sequelize[_0x1006('0x1')]},'email':{'type':Sequelize[_0x1006('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1006('0x1')]},'sStreet':{'type':Sequelize[_0x1006('0x1')]},'sPostalCode':{'type':Sequelize[_0x1006('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x1006('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x214b=['STRING','sequelize','exports'];(function(_0xb2356a,_0x3e6312){var _0x32ac51=function(_0x29bfd0){while(--_0x29bfd0){_0xb2356a['push'](_0xb2356a['shift']());}};_0x32ac51(++_0x3e6312);}(_0x214b,0x1e4));var _0xb214=function(_0x581846,_0x2ae4eb){_0x581846=_0x581846-0x0;var _0x28b956=_0x214b[_0x581846];return _0x28b956;};'use strict';var Sequelize=require(_0xb214('0x0'));module[_0xb214('0x1')]={'name':{'type':Sequelize[_0xb214('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb214('0x2')]},'companyId':{'type':Sequelize[_0xb214('0x2')]},'website':{'type':Sequelize[_0xb214('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb214('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb214('0x2')]},'country':{'type':Sequelize[_0xb214('0x2')]},'email':{'type':Sequelize[_0xb214('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb214('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb214('0x2')]},'sCity':{'type':Sequelize[_0xb214('0x2')]},'sCountry':{'type':Sequelize[_0xb214('0x2')]},'description':{'type':Sequelize[_0xb214('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d9eb5e1..fff0226 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 _0xe9c8=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','omit','ids','getContacts','rawAttributes','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xe9c8,0x1b0));var _0x8e9c=function(_0x3722d2,_0x206336){_0x3722d2=_0x3722d2-0x0;var _0x15ae66=_0xe9c8[_0x3722d2];return _0x15ae66;};'use strict';var emlformat=require(_0x8e9c('0x0'));var rimraf=require(_0x8e9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e9c('0x2'));var rp=require('request-promise');var moment=require(_0x8e9c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e9c('0x4'));var path=require(_0x8e9c('0x5'));var sox=require(_0x8e9c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e9c('0x7'));var _=require(_0x8e9c('0x8'));var squel=require(_0x8e9c('0x9'));var crypto=require('crypto');var jsforce=require(_0x8e9c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8e9c('0xb'));var querystring=require(_0x8e9c('0xc'));var Papa=require(_0x8e9c('0xd'));var Redis=require(_0x8e9c('0xe'));var authService=require(_0x8e9c('0xf'));var qs=require(_0x8e9c('0x10'));var as=require(_0x8e9c('0x11'));var hardwareService=require(_0x8e9c('0x12'));var logger=require(_0x8e9c('0x13'))(_0x8e9c('0x14'));var utils=require(_0x8e9c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8e9c('0x16'));var db=require(_0x8e9c('0x17'))['db'];function respondWithStatusCode(_0x530ed4,_0x6eb984){_0x6eb984=_0x6eb984||0xcc;return function(_0x574f4e){if(_0x574f4e){return _0x530ed4[_0x8e9c('0x18')](_0x6eb984);}return _0x530ed4[_0x8e9c('0x19')](_0x6eb984)[_0x8e9c('0x1a')]();};}function respondWithResult(_0xefab40,_0x19f7db){_0x19f7db=_0x19f7db||0xc8;return function(_0x1cac43){if(_0x1cac43){return _0xefab40['status'](_0x19f7db)['json'](_0x1cac43);}};}function respondWithFilteredResult(_0x1cd966,_0xfb4cd9){return function(_0x2fc239){if(_0x2fc239){var _0x6c2935=typeof _0xfb4cd9[_0x8e9c('0x1b')]==='undefined'&&typeof _0xfb4cd9[_0x8e9c('0x1c')]===_0x8e9c('0x1d');var _0x35b5d=_0x2fc239[_0x8e9c('0x1e')];var _0x30024e=_0x6c2935?0x0:_0xfb4cd9[_0x8e9c('0x1b')];var _0x24f97c=_0x6c2935?_0x2fc239[_0x8e9c('0x1e')]:_0xfb4cd9['offset']+_0xfb4cd9[_0x8e9c('0x1c')];var _0x3d3728;if(_0x24f97c>=_0x35b5d){_0x24f97c=_0x35b5d;_0x3d3728=0xc8;}else{_0x3d3728=0xce;}_0x1cd966[_0x8e9c('0x19')](_0x3d3728);return _0x1cd966[_0x8e9c('0x1f')](_0x8e9c('0x20'),_0x30024e+'-'+_0x24f97c+'/'+_0x35b5d)['json'](_0x2fc239);}return null;};}function patchUpdates(_0x35ee9b){return function(_0x5db2b3){try{jsonpatch[_0x8e9c('0x21')](_0x5db2b3,_0x35ee9b,!![]);}catch(_0x279908){return BPromise[_0x8e9c('0x22')](_0x279908);}return _0x5db2b3[_0x8e9c('0x23')]();};}function saveUpdates(_0x1c7168,_0x2a62b2){return function(_0x3bfa6b){if(_0x3bfa6b){return _0x3bfa6b[_0x8e9c('0x24')](_0x1c7168)['then'](function(_0x302d23){return _0x302d23;});}return null;};}function removeEntity(_0x78f52d,_0xbfd6d){return function(_0x57d954){if(_0x57d954){return _0x57d954['destroy']()[_0x8e9c('0x25')](function(){var _0x2d7c9d=_0x57d954[_0x8e9c('0x26')]({'plain':!![]});var _0x5ba089=_0x8e9c('0x27');return db[_0x8e9c('0x28')][_0x8e9c('0x29')]({'where':{'type':_0x5ba089,'resourceId':_0x2d7c9d['id']}})[_0x8e9c('0x25')](function(){return _0x57d954;});})[_0x8e9c('0x25')](function(){_0x78f52d[_0x8e9c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267d48,_0x40a3f1){return function(_0x100075){if(!_0x100075){_0x267d48[_0x8e9c('0x18')](0x194);}return _0x100075;};}function handleError(_0x5f0260,_0x9eeed4){_0x9eeed4=_0x9eeed4||0x1f4;return function(_0x13c0e1){logger[_0x8e9c('0x2a')](_0x13c0e1[_0x8e9c('0x2b')]);if(_0x13c0e1[_0x8e9c('0x2c')]){delete _0x13c0e1[_0x8e9c('0x2c')];}_0x5f0260[_0x8e9c('0x19')](_0x9eeed4)[_0x8e9c('0x2d')](_0x13c0e1);};}exports[_0x8e9c('0x2e')]=function(_0x4c2a20,_0x35028b){var _0x5a865b={},_0x45d717={},_0x4e085c={'count':0x0,'rows':[]};return db[_0x8e9c('0x2f')][_0x8e9c('0x30')]()[_0x8e9c('0x25')](function(_0x2c8f32){_0x45d717[_0x8e9c('0x31')]=_['keys'](_0x2c8f32);_0x45d717[_0x8e9c('0x32')]=_[_0x8e9c('0x33')](_0x4c2a20[_0x8e9c('0x32')]);_0x45d717[_0x8e9c('0x34')]=_[_0x8e9c('0x35')](_0x45d717[_0x8e9c('0x31')],_0x45d717[_0x8e9c('0x32')]);_0x5a865b[_0x8e9c('0x36')]=_[_0x8e9c('0x35')](_0x45d717[_0x8e9c('0x31')],qs[_0x8e9c('0x37')](_0x4c2a20[_0x8e9c('0x32')][_0x8e9c('0x37')]));_0x5a865b[_0x8e9c('0x36')]=_0x5a865b[_0x8e9c('0x36')][_0x8e9c('0x38')]?_0x5a865b[_0x8e9c('0x36')]:_0x45d717['model'];if(!_0x4c2a20[_0x8e9c('0x32')]['hasOwnProperty'](_0x8e9c('0x39'))){_0x5a865b[_0x8e9c('0x1c')]=qs[_0x8e9c('0x1c')](_0x4c2a20[_0x8e9c('0x32')][_0x8e9c('0x1c')]);_0x5a865b['offset']=qs[_0x8e9c('0x1b')](_0x4c2a20[_0x8e9c('0x32')][_0x8e9c('0x1b')]);}_0x5a865b[_0x8e9c('0x3a')]=qs[_0x8e9c('0x3b')](_0x4c2a20[_0x8e9c('0x32')]['sort']);_0x5a865b[_0x8e9c('0x3c')]=qs[_0x8e9c('0x34')](_[_0x8e9c('0x3d')](_0x4c2a20[_0x8e9c('0x32')],_0x45d717[_0x8e9c('0x34')]),_0x2c8f32);if(_0x4c2a20[_0x8e9c('0x32')][_0x8e9c('0x3e')]){_0x5a865b[_0x8e9c('0x3c')]=_[_0x8e9c('0x3f')](_0x5a865b[_0x8e9c('0x3c')],{'$or':_[_0x8e9c('0x40')](_0x5a865b[_0x8e9c('0x36')],function(_0x11baed){var _0x16730a={};_0x16730a[_0x11baed]={'$like':'%'+_0x4c2a20[_0x8e9c('0x32')][_0x8e9c('0x3e')]+'%'};return _0x16730a;})});}_0x5a865b=_[_0x8e9c('0x3f')]({},_0x5a865b,_0x4c2a20['options']);var _0x594e59={'where':_0x5a865b['where']};return db[_0x8e9c('0x2f')]['count'](_0x594e59)['then'](function(_0x313be4){_0x4e085c['count']=_0x313be4;if(_0x4c2a20['query'][_0x8e9c('0x41')]){_0x5a865b[_0x8e9c('0x42')]=[{'all':!![]}];}return db[_0x8e9c('0x2f')][_0x8e9c('0x43')](_0x5a865b);})[_0x8e9c('0x25')](function(_0x2e4811){_0x4e085c[_0x8e9c('0x44')]=_0x2e4811;return _0x4e085c;})[_0x8e9c('0x25')](respondWithFilteredResult(_0x35028b,_0x5a865b))['catch'](handleError(_0x35028b,null));})[_0x8e9c('0x45')](handleError(_0x35028b,null));};exports[_0x8e9c('0x46')]=function(_0x54d182,_0x30a62f){var _0x441a98={'raw':![],'where':{'id':_0x54d182['params']['id']}},_0x5e8f52={};_0x5e8f52[_0x8e9c('0x31')]=_[_0x8e9c('0x33')](db[_0x8e9c('0x2f')]['rawAttributes']);_0x5e8f52[_0x8e9c('0x32')]=_[_0x8e9c('0x33')](_0x54d182[_0x8e9c('0x32')]);_0x5e8f52[_0x8e9c('0x34')]=_[_0x8e9c('0x35')](_0x5e8f52[_0x8e9c('0x31')],_0x5e8f52[_0x8e9c('0x32')]);_0x441a98[_0x8e9c('0x36')]=_['intersection'](_0x5e8f52['model'],qs[_0x8e9c('0x37')](_0x54d182[_0x8e9c('0x32')][_0x8e9c('0x37')]));_0x441a98[_0x8e9c('0x36')]=_0x441a98[_0x8e9c('0x36')][_0x8e9c('0x38')]?_0x441a98[_0x8e9c('0x36')]:_0x5e8f52[_0x8e9c('0x31')];if(_0x54d182[_0x8e9c('0x32')]['includeAll']){_0x441a98['include']=[{'all':!![]}];}_0x441a98=_[_0x8e9c('0x3f')]({},_0x441a98,_0x54d182[_0x8e9c('0x47')]);return db['CmCompany'][_0x8e9c('0x48')](_0x441a98)['then'](handleEntityNotFound(_0x30a62f,null))[_0x8e9c('0x25')](respondWithResult(_0x30a62f,null))['catch'](handleError(_0x30a62f,null));};exports[_0x8e9c('0x49')]=function(_0x14343f,_0x1c0aa9){return db[_0x8e9c('0x2f')][_0x8e9c('0x49')](_0x14343f[_0x8e9c('0x4a')],{})['then'](function(_0x4263eb){var _0x439233=_0x14343f[_0x8e9c('0x4b')][_0x8e9c('0x26')]({'plain':!![]});if(!_0x439233)throw new Error(_0x8e9c('0x4c'));if(_0x439233[_0x8e9c('0x4d')]===_0x8e9c('0x4b')){var _0x45a408=_0x4263eb[_0x8e9c('0x26')]({'plain':!![]});var _0x201c63=_0x8e9c('0x27');return db[_0x8e9c('0x4e')][_0x8e9c('0x48')]({'where':{'name':_0x201c63,'userProfileId':_0x439233[_0x8e9c('0x4f')]},'raw':!![]})[_0x8e9c('0x25')](function(_0x720bd3){if(_0x720bd3&&_0x720bd3[_0x8e9c('0x50')]===0x0){return db['UserProfileResource'][_0x8e9c('0x49')]({'name':_0x45a408[_0x8e9c('0x2c')],'resourceId':_0x45a408['id'],'type':_0x720bd3[_0x8e9c('0x2c')],'sectionId':_0x720bd3['id']},{})[_0x8e9c('0x25')](function(){return _0x4263eb;});}else{return _0x4263eb;}})[_0x8e9c('0x45')](function(_0x120f8f){logger['error'](_0x8e9c('0x51'),_0x120f8f);throw _0x120f8f;});}return _0x4263eb;})['then'](respondWithResult(_0x1c0aa9,0xc9))[_0x8e9c('0x45')](handleError(_0x1c0aa9,null));};exports[_0x8e9c('0x24')]=function(_0x33dd78,_0x202c9d){if(_0x33dd78[_0x8e9c('0x4a')]['id']){delete _0x33dd78[_0x8e9c('0x4a')]['id'];}return db[_0x8e9c('0x2f')][_0x8e9c('0x48')]({'where':{'id':_0x33dd78[_0x8e9c('0x52')]['id']}})[_0x8e9c('0x25')](handleEntityNotFound(_0x202c9d,null))[_0x8e9c('0x25')](saveUpdates(_0x33dd78[_0x8e9c('0x4a')],null))[_0x8e9c('0x25')](respondWithResult(_0x202c9d,null))['catch'](handleError(_0x202c9d,null));};exports[_0x8e9c('0x29')]=function(_0x4e8024,_0x10b567){return db['CmCompany'][_0x8e9c('0x48')]({'where':{'id':_0x4e8024[_0x8e9c('0x52')]['id']}})[_0x8e9c('0x25')](handleEntityNotFound(_0x10b567,null))[_0x8e9c('0x25')](removeEntity(_0x10b567,null))[_0x8e9c('0x45')](handleError(_0x10b567,null));};exports['describe']=function(_0x3b16be,_0x372359){return db[_0x8e9c('0x2f')][_0x8e9c('0x30')]()[_0x8e9c('0x25')](respondWithResult(_0x372359,null))[_0x8e9c('0x45')](handleError(_0x372359,null));};exports[_0x8e9c('0x53')]=function(_0x3f3829,_0x3491e5,_0x2c571e){return db[_0x8e9c('0x54')][_0x8e9c('0x48')]({'where':{'id':_0x3f3829[_0x8e9c('0x52')]['id']}})[_0x8e9c('0x25')](handleEntityNotFound(_0x3491e5,null))['then'](function(_0x125aa){if(_0x125aa){return _0x125aa['addContacts'](_0x3f3829['body']['ids'],_[_0x8e9c('0x55')](_0x3f3829[_0x8e9c('0x4a')],[_0x8e9c('0x56'),'id'])||{});}})[_0x8e9c('0x25')](respondWithResult(_0x3491e5,null))[_0x8e9c('0x45')](handleError(_0x3491e5,null));};exports[_0x8e9c('0x57')]=function(_0x290188,_0x320b82,_0x47f064){var _0x4e1a2c={};var _0x35b4e5={};var _0x3ea784;var _0x456c48;return db[_0x8e9c('0x2f')]['findOne']({'where':{'id':_0x290188[_0x8e9c('0x52')]['id']}})[_0x8e9c('0x25')](handleEntityNotFound(_0x320b82,null))['then'](function(_0x4545c1){if(_0x4545c1){_0x3ea784=_0x4545c1;_0x35b4e5[_0x8e9c('0x31')]=_['keys'](db[_0x8e9c('0x54')][_0x8e9c('0x58')]);_0x35b4e5[_0x8e9c('0x32')]=_[_0x8e9c('0x33')](_0x290188[_0x8e9c('0x32')]);_0x35b4e5[_0x8e9c('0x34')]=_[_0x8e9c('0x35')](_0x35b4e5[_0x8e9c('0x31')],_0x35b4e5[_0x8e9c('0x32')]);_0x4e1a2c[_0x8e9c('0x36')]=_[_0x8e9c('0x35')](_0x35b4e5['model'],qs['fields'](_0x290188[_0x8e9c('0x32')][_0x8e9c('0x37')]));_0x4e1a2c['attributes']=_0x4e1a2c[_0x8e9c('0x36')]['length']?_0x4e1a2c[_0x8e9c('0x36')]:_0x35b4e5['model'];_0x4e1a2c[_0x8e9c('0x3a')]=qs[_0x8e9c('0x3b')](_0x290188[_0x8e9c('0x32')][_0x8e9c('0x3b')]);_0x4e1a2c[_0x8e9c('0x3c')]=qs[_0x8e9c('0x34')](_[_0x8e9c('0x3d')](_0x290188[_0x8e9c('0x32')],_0x35b4e5[_0x8e9c('0x34')]));if(_0x290188[_0x8e9c('0x32')][_0x8e9c('0x3e')]){_0x4e1a2c['where']=_[_0x8e9c('0x3f')](_0x4e1a2c['where'],{'$or':_[_0x8e9c('0x40')](_0x4e1a2c[_0x8e9c('0x36')],function(_0x2d0f8e){var _0x141817={};_0x141817[_0x2d0f8e]={'$like':'%'+_0x290188['query']['filter']+'%'};return _0x141817;})});}_0x4e1a2c=_[_0x8e9c('0x3f')]({},_0x4e1a2c,_0x290188[_0x8e9c('0x47')]);return _0x3ea784[_0x8e9c('0x57')](_0x4e1a2c);}})[_0x8e9c('0x25')](function(_0xc82c48){if(_0xc82c48){_0x456c48=_0xc82c48[_0x8e9c('0x38')];if(!_0x290188[_0x8e9c('0x32')][_0x8e9c('0x59')]('nolimit')){_0x4e1a2c[_0x8e9c('0x1c')]=qs[_0x8e9c('0x1c')](_0x290188['query'][_0x8e9c('0x1c')]);_0x4e1a2c[_0x8e9c('0x1b')]=qs[_0x8e9c('0x1b')](_0x290188[_0x8e9c('0x32')][_0x8e9c('0x1b')]);}return _0x3ea784[_0x8e9c('0x57')](_0x4e1a2c);}})[_0x8e9c('0x25')](function(_0x2930ee){if(_0x2930ee){return _0x2930ee?{'count':_0x456c48,'rows':_0x2930ee}:null;}})[_0x8e9c('0x25')](respondWithResult(_0x320b82,null))['catch'](handleError(_0x320b82,null));}; \ No newline at end of file +var _0x9b85=['findOne','rawAttributes','length','getContacts','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','CmCompany','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','describe','addContacts','CmContact','ids','omit'];(function(_0x1086fe,_0x2fc750){var _0x53df48=function(_0xaf13ac){while(--_0xaf13ac){_0x1086fe['push'](_0x1086fe['shift']());}};_0x53df48(++_0x2fc750);}(_0x9b85,0x104));var _0x59b8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9b85[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x59b8('0x0'));var rimraf=require(_0x59b8('0x1'));var zipdir=require(_0x59b8('0x2'));var jsonpatch=require(_0x59b8('0x3'));var rp=require(_0x59b8('0x4'));var moment=require('moment');var BPromise=require(_0x59b8('0x5'));var Mustache=require(_0x59b8('0x6'));var util=require(_0x59b8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x59b8('0x8'));var ejs=require(_0x59b8('0x9'));var fs=require('fs');var fs_extra=require(_0x59b8('0xa'));var _=require('lodash');var squel=require(_0x59b8('0xb'));var crypto=require(_0x59b8('0xc'));var jsforce=require(_0x59b8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x59b8('0x8'));var querystring=require(_0x59b8('0xe'));var Papa=require(_0x59b8('0xf'));var Redis=require(_0x59b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x59b8('0x11'));var as=require(_0x59b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59b8('0x13'))(_0x59b8('0x14'));var utils=require(_0x59b8('0x15'));var config=require(_0x59b8('0x16'));var licenseUtil=require(_0x59b8('0x17'));var db=require(_0x59b8('0x18'))['db'];function respondWithStatusCode(_0x2e4cc9,_0x200a2f){_0x200a2f=_0x200a2f||0xcc;return function(_0x36b3e1){if(_0x36b3e1){return _0x2e4cc9[_0x59b8('0x19')](_0x200a2f);}return _0x2e4cc9['status'](_0x200a2f)[_0x59b8('0x1a')]();};}function respondWithResult(_0x1eaa26,_0x588172){_0x588172=_0x588172||0xc8;return function(_0x590375){if(_0x590375){return _0x1eaa26['status'](_0x588172)[_0x59b8('0x1b')](_0x590375);}};}function respondWithFilteredResult(_0x5709cc,_0x3bb03e){return function(_0x55658d){if(_0x55658d){var _0x526b36=typeof _0x3bb03e[_0x59b8('0x1c')]===_0x59b8('0x1d')&&typeof _0x3bb03e[_0x59b8('0x1e')]==='undefined';var _0x4ea84c=_0x55658d[_0x59b8('0x1f')];var _0xfbaa73=_0x526b36?0x0:_0x3bb03e[_0x59b8('0x1c')];var _0x132439=_0x526b36?_0x55658d['count']:_0x3bb03e[_0x59b8('0x1c')]+_0x3bb03e['limit'];var _0x1a8683;if(_0x132439>=_0x4ea84c){_0x132439=_0x4ea84c;_0x1a8683=0xc8;}else{_0x1a8683=0xce;}_0x5709cc[_0x59b8('0x20')](_0x1a8683);return _0x5709cc['set'](_0x59b8('0x21'),_0xfbaa73+'-'+_0x132439+'/'+_0x4ea84c)[_0x59b8('0x1b')](_0x55658d);}return null;};}function patchUpdates(_0x25907e){return function(_0x452aef){try{jsonpatch[_0x59b8('0x22')](_0x452aef,_0x25907e,!![]);}catch(_0x380214){return BPromise[_0x59b8('0x23')](_0x380214);}return _0x452aef[_0x59b8('0x24')]();};}function saveUpdates(_0x24e3f5,_0x414efe){return function(_0x2ebbde){if(_0x2ebbde){return _0x2ebbde[_0x59b8('0x25')](_0x24e3f5)[_0x59b8('0x26')](function(_0x61a8af){return _0x61a8af;});}return null;};}function removeEntity(_0x3db09e,_0x56f52a){return function(_0x9d06bd){if(_0x9d06bd){return _0x9d06bd['destroy']()[_0x59b8('0x26')](function(){var _0x5d316a=_0x9d06bd[_0x59b8('0x27')]({'plain':!![]});var _0x563e4a='Companies';return db[_0x59b8('0x28')][_0x59b8('0x29')]({'where':{'type':_0x563e4a,'resourceId':_0x5d316a['id']}})[_0x59b8('0x26')](function(){return _0x9d06bd;});})[_0x59b8('0x26')](function(){_0x3db09e['status'](0xcc)[_0x59b8('0x1a')]();});}};}function handleEntityNotFound(_0x328e67,_0x4c50aa){return function(_0xc1690e){if(!_0xc1690e){_0x328e67[_0x59b8('0x19')](0x194);}return _0xc1690e;};}function handleError(_0x4b829d,_0x45b993){_0x45b993=_0x45b993||0x1f4;return function(_0x153bd6){logger['error'](_0x153bd6['stack']);if(_0x153bd6[_0x59b8('0x2a')]){delete _0x153bd6[_0x59b8('0x2a')];}_0x4b829d[_0x59b8('0x20')](_0x45b993)[_0x59b8('0x2b')](_0x153bd6);};}exports[_0x59b8('0x2c')]=function(_0x1b8e6b,_0x291345){var _0x530f09={},_0x243c4e={},_0x2ffb83={'count':0x0,'rows':[]};return db[_0x59b8('0x2d')]['describe']()[_0x59b8('0x26')](function(_0x49c204){_0x243c4e['model']=_[_0x59b8('0x2e')](_0x49c204);_0x243c4e[_0x59b8('0x2f')]=_['keys'](_0x1b8e6b[_0x59b8('0x2f')]);_0x243c4e[_0x59b8('0x30')]=_['intersection'](_0x243c4e['model'],_0x243c4e[_0x59b8('0x2f')]);_0x530f09[_0x59b8('0x31')]=_[_0x59b8('0x32')](_0x243c4e[_0x59b8('0x33')],qs[_0x59b8('0x34')](_0x1b8e6b[_0x59b8('0x2f')]['fields']));_0x530f09['attributes']=_0x530f09[_0x59b8('0x31')]['length']?_0x530f09[_0x59b8('0x31')]:_0x243c4e[_0x59b8('0x33')];if(!_0x1b8e6b[_0x59b8('0x2f')][_0x59b8('0x35')]('nolimit')){_0x530f09[_0x59b8('0x1e')]=qs[_0x59b8('0x1e')](_0x1b8e6b[_0x59b8('0x2f')][_0x59b8('0x1e')]);_0x530f09[_0x59b8('0x1c')]=qs[_0x59b8('0x1c')](_0x1b8e6b[_0x59b8('0x2f')][_0x59b8('0x1c')]);}_0x530f09[_0x59b8('0x36')]=qs[_0x59b8('0x37')](_0x1b8e6b[_0x59b8('0x2f')]['sort']);_0x530f09[_0x59b8('0x38')]=qs[_0x59b8('0x30')](_[_0x59b8('0x39')](_0x1b8e6b['query'],_0x243c4e[_0x59b8('0x30')]),_0x49c204);if(_0x1b8e6b[_0x59b8('0x2f')][_0x59b8('0x3a')]){_0x530f09[_0x59b8('0x38')]=_[_0x59b8('0x3b')](_0x530f09[_0x59b8('0x38')],{'$or':_[_0x59b8('0x3c')](_0x530f09[_0x59b8('0x31')],function(_0x3c9d34){var _0x2262cb={};_0x2262cb[_0x3c9d34]={'$like':'%'+_0x1b8e6b[_0x59b8('0x2f')][_0x59b8('0x3a')]+'%'};return _0x2262cb;})});}_0x530f09=_[_0x59b8('0x3b')]({},_0x530f09,_0x1b8e6b[_0x59b8('0x3d')]);var _0x972f0d={'where':_0x530f09[_0x59b8('0x38')]};return db['CmCompany'][_0x59b8('0x1f')](_0x972f0d)['then'](function(_0x525e28){_0x2ffb83['count']=_0x525e28;if(_0x1b8e6b['query'][_0x59b8('0x3e')]){_0x530f09[_0x59b8('0x3f')]=[{'all':!![]}];}return db[_0x59b8('0x2d')][_0x59b8('0x40')](_0x530f09);})['then'](function(_0xb5cbe6){_0x2ffb83['rows']=_0xb5cbe6;return _0x2ffb83;})[_0x59b8('0x26')](respondWithFilteredResult(_0x291345,_0x530f09))['catch'](handleError(_0x291345,null));})['catch'](handleError(_0x291345,null));};exports['show']=function(_0x3a3845,_0x2350c5){var _0x2a1134={'raw':![],'where':{'id':_0x3a3845[_0x59b8('0x41')]['id']}},_0x25248f={};_0x25248f[_0x59b8('0x33')]=_['keys'](db['CmCompany']['rawAttributes']);_0x25248f[_0x59b8('0x2f')]=_[_0x59b8('0x2e')](_0x3a3845[_0x59b8('0x2f')]);_0x25248f[_0x59b8('0x30')]=_['intersection'](_0x25248f[_0x59b8('0x33')],_0x25248f[_0x59b8('0x2f')]);_0x2a1134['attributes']=_[_0x59b8('0x32')](_0x25248f['model'],qs[_0x59b8('0x34')](_0x3a3845['query']['fields']));_0x2a1134[_0x59b8('0x31')]=_0x2a1134[_0x59b8('0x31')]['length']?_0x2a1134[_0x59b8('0x31')]:_0x25248f[_0x59b8('0x33')];if(_0x3a3845[_0x59b8('0x2f')][_0x59b8('0x3e')]){_0x2a1134[_0x59b8('0x3f')]=[{'all':!![]}];}_0x2a1134=_[_0x59b8('0x3b')]({},_0x2a1134,_0x3a3845[_0x59b8('0x3d')]);return db[_0x59b8('0x2d')][_0x59b8('0x42')](_0x2a1134)[_0x59b8('0x26')](handleEntityNotFound(_0x2350c5,null))[_0x59b8('0x26')](respondWithResult(_0x2350c5,null))[_0x59b8('0x43')](handleError(_0x2350c5,null));};exports[_0x59b8('0x44')]=function(_0x118b59,_0x4bd8d2){return db[_0x59b8('0x2d')]['create'](_0x118b59[_0x59b8('0x45')],{})[_0x59b8('0x26')](function(_0x1a107c){var _0x48227b=_0x118b59['user'][_0x59b8('0x27')]({'plain':!![]});if(!_0x48227b)throw new Error(_0x59b8('0x46'));if(_0x48227b[_0x59b8('0x47')]==='user'){var _0x33c655=_0x1a107c[_0x59b8('0x27')]({'plain':!![]});var _0x176817=_0x59b8('0x48');return db[_0x59b8('0x49')][_0x59b8('0x42')]({'where':{'name':_0x176817,'userProfileId':_0x48227b['userProfileId']},'raw':!![]})['then'](function(_0x16fae4){if(_0x16fae4&&_0x16fae4[_0x59b8('0x4a')]===0x0){return db[_0x59b8('0x28')]['create']({'name':_0x33c655[_0x59b8('0x2a')],'resourceId':_0x33c655['id'],'type':_0x16fae4[_0x59b8('0x2a')],'sectionId':_0x16fae4['id']},{})['then'](function(){return _0x1a107c;});}else{return _0x1a107c;}})[_0x59b8('0x43')](function(_0x3a4fb2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a4fb2);throw _0x3a4fb2;});}return _0x1a107c;})[_0x59b8('0x26')](respondWithResult(_0x4bd8d2,0xc9))[_0x59b8('0x43')](handleError(_0x4bd8d2,null));};exports[_0x59b8('0x25')]=function(_0x545703,_0x1bd22c){if(_0x545703['body']['id']){delete _0x545703[_0x59b8('0x45')]['id'];}return db[_0x59b8('0x2d')][_0x59b8('0x42')]({'where':{'id':_0x545703['params']['id']}})['then'](handleEntityNotFound(_0x1bd22c,null))[_0x59b8('0x26')](saveUpdates(_0x545703[_0x59b8('0x45')],null))[_0x59b8('0x26')](respondWithResult(_0x1bd22c,null))[_0x59b8('0x43')](handleError(_0x1bd22c,null));};exports[_0x59b8('0x29')]=function(_0x1b25a3,_0x4a0f0a){return db[_0x59b8('0x2d')][_0x59b8('0x42')]({'where':{'id':_0x1b25a3[_0x59b8('0x41')]['id']}})[_0x59b8('0x26')](handleEntityNotFound(_0x4a0f0a,null))[_0x59b8('0x26')](removeEntity(_0x4a0f0a,null))[_0x59b8('0x43')](handleError(_0x4a0f0a,null));};exports['describe']=function(_0x3dcda6,_0x306cc8){return db[_0x59b8('0x2d')][_0x59b8('0x4b')]()[_0x59b8('0x26')](respondWithResult(_0x306cc8,null))['catch'](handleError(_0x306cc8,null));};exports[_0x59b8('0x4c')]=function(_0x550f1f,_0xdc3269,_0x157c33){return db[_0x59b8('0x4d')][_0x59b8('0x42')]({'where':{'id':_0x550f1f[_0x59b8('0x41')]['id']}})[_0x59b8('0x26')](handleEntityNotFound(_0xdc3269,null))['then'](function(_0x525983){if(_0x525983){return _0x525983['addContacts'](_0x550f1f[_0x59b8('0x45')][_0x59b8('0x4e')],_[_0x59b8('0x4f')](_0x550f1f['body'],[_0x59b8('0x4e'),'id'])||{});}})['then'](respondWithResult(_0xdc3269,null))[_0x59b8('0x43')](handleError(_0xdc3269,null));};exports['getContacts']=function(_0x21067b,_0x76abe7,_0x539a2d){var _0x5bb68e={};var _0x5b4f4e={};var _0x327006;var _0x4793d2;return db[_0x59b8('0x2d')][_0x59b8('0x50')]({'where':{'id':_0x21067b[_0x59b8('0x41')]['id']}})[_0x59b8('0x26')](handleEntityNotFound(_0x76abe7,null))['then'](function(_0x2aa03c){if(_0x2aa03c){_0x327006=_0x2aa03c;_0x5b4f4e[_0x59b8('0x33')]=_[_0x59b8('0x2e')](db[_0x59b8('0x4d')][_0x59b8('0x51')]);_0x5b4f4e[_0x59b8('0x2f')]=_[_0x59b8('0x2e')](_0x21067b[_0x59b8('0x2f')]);_0x5b4f4e[_0x59b8('0x30')]=_['intersection'](_0x5b4f4e['model'],_0x5b4f4e['query']);_0x5bb68e[_0x59b8('0x31')]=_['intersection'](_0x5b4f4e[_0x59b8('0x33')],qs[_0x59b8('0x34')](_0x21067b[_0x59b8('0x2f')][_0x59b8('0x34')]));_0x5bb68e['attributes']=_0x5bb68e[_0x59b8('0x31')][_0x59b8('0x52')]?_0x5bb68e['attributes']:_0x5b4f4e['model'];_0x5bb68e[_0x59b8('0x36')]=qs['sort'](_0x21067b[_0x59b8('0x2f')]['sort']);_0x5bb68e[_0x59b8('0x38')]=qs['filters'](_['pick'](_0x21067b[_0x59b8('0x2f')],_0x5b4f4e[_0x59b8('0x30')]));if(_0x21067b[_0x59b8('0x2f')]['filter']){_0x5bb68e[_0x59b8('0x38')]=_[_0x59b8('0x3b')](_0x5bb68e[_0x59b8('0x38')],{'$or':_['map'](_0x5bb68e[_0x59b8('0x31')],function(_0x3c9d25){var _0x1247af={};_0x1247af[_0x3c9d25]={'$like':'%'+_0x21067b['query'][_0x59b8('0x3a')]+'%'};return _0x1247af;})});}_0x5bb68e=_[_0x59b8('0x3b')]({},_0x5bb68e,_0x21067b['options']);return _0x327006[_0x59b8('0x53')](_0x5bb68e);}})[_0x59b8('0x26')](function(_0x255cc5){if(_0x255cc5){_0x4793d2=_0x255cc5[_0x59b8('0x52')];if(!_0x21067b[_0x59b8('0x2f')]['hasOwnProperty'](_0x59b8('0x54'))){_0x5bb68e[_0x59b8('0x1e')]=qs[_0x59b8('0x1e')](_0x21067b[_0x59b8('0x2f')][_0x59b8('0x1e')]);_0x5bb68e['offset']=qs['offset'](_0x21067b['query'][_0x59b8('0x1c')]);}return _0x327006['getContacts'](_0x5bb68e);}})[_0x59b8('0x26')](function(_0xb05f7e){if(_0xb05f7e){return _0xb05f7e?{'count':_0x4793d2,'rows':_0xb05f7e}:null;}})['then'](respondWithResult(_0x76abe7,null))[_0x59b8('0x43')](handleError(_0x76abe7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index fafe708..72da509 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 _0x88b8=['api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88b8,0xaf));var _0x888b=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x88b8[_0x2c1114];return _0x2b877c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x888b('0x0'))(_0x888b('0x1'));var moment=require(_0x888b('0x2'));var BPromise=require(_0x888b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x888b('0x4'));var rimraf=require(_0x888b('0x5'));var config=require(_0x888b('0x6'));var attributes=require(_0x888b('0x7'));module[_0x888b('0x8')]=function(_0x346e86,_0x26dbad){return _0x346e86[_0x888b('0x9')](_0x888b('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80dc=['exports','define','CmCompany','cm_companies','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x52465e,_0x398f11){var _0x152aec=function(_0x2d339e){while(--_0x2d339e){_0x52465e['push'](_0x52465e['shift']());}};_0x152aec(++_0x398f11);}(_0x80dc,0x124));var _0xc80d=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x80dc[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xc80d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc80d('0x1'));var moment=require(_0xc80d('0x2'));var BPromise=require(_0xc80d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc80d('0x4'));var rimraf=require(_0xc80d('0x5'));var config=require(_0xc80d('0x6'));var attributes=require(_0xc80d('0x7'));module[_0xc80d('0x8')]=function(_0x4171b6,_0x2bc214){return _0x4171b6[_0xc80d('0x9')](_0xc80d('0xa'),attributes,{'tableName':_0xc80d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 5ee9b79..8a1d5aa 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 _0xf8dd=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result'];(function(_0x219853,_0x5eec5d){var _0x360803=function(_0x345df1){while(--_0x345df1){_0x219853['push'](_0x219853['shift']());}};_0x360803(++_0x5eec5d);}(_0xf8dd,0x181));var _0xdf8d=function(_0x4143ec,_0x114346){_0x4143ec=_0x4143ec-0x0;var _0x297f35=_0xf8dd[_0x4143ec];return _0x297f35;};'use strict';var _=require(_0xdf8d('0x0'));var util=require(_0xdf8d('0x1'));var moment=require(_0xdf8d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf8d('0x4'))['db'];var utils=require(_0xdf8d('0x5'));var logger=require(_0xdf8d('0x6'))(_0xdf8d('0x7'));var config=require(_0xdf8d('0x8'));var jayson=require(_0xdf8d('0x9'));var client=jayson[_0xdf8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d52d4,_0x256e90,_0x23517c){return new BPromise(function(_0x5003d5,_0x48b01d){return client[_0xdf8d('0xb')](_0x1d52d4,_0x23517c)[_0xdf8d('0xc')](function(_0x26a0d1){logger[_0xdf8d('0xd')]('CmCompany,\x20%s,\x20%s',_0x256e90,_0xdf8d('0xe'));logger[_0xdf8d('0xf')](_0xdf8d('0x10'),_0x256e90,_0xdf8d('0xe'),JSON[_0xdf8d('0x11')](_0x26a0d1));if(_0x26a0d1[_0xdf8d('0x12')]){if(_0x26a0d1[_0xdf8d('0x12')][_0xdf8d('0x13')]===0x1f4){logger[_0xdf8d('0x12')](_0xdf8d('0x14'),_0x256e90,_0x26a0d1['error']['message']);return _0x48b01d(_0x26a0d1[_0xdf8d('0x12')][_0xdf8d('0x15')]);}logger[_0xdf8d('0x12')](_0xdf8d('0x14'),_0x256e90,_0x26a0d1['error'][_0xdf8d('0x15')]);return _0x5003d5(_0x26a0d1[_0xdf8d('0x12')]['message']);}else{logger['info'](_0xdf8d('0x14'),_0x256e90,_0xdf8d('0xe'));_0x5003d5(_0x26a0d1[_0xdf8d('0x16')]['message']);}})[_0xdf8d('0x17')](function(_0x5b1172){logger[_0xdf8d('0x12')](_0xdf8d('0x14'),_0x256e90,_0x5b1172);_0x48b01d(_0x5b1172);});});} \ No newline at end of file +var _0x4179=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2b129e,_0x3003ec){var _0x59e556=function(_0x53d118){while(--_0x53d118){_0x2b129e['push'](_0x2b129e['shift']());}};_0x59e556(++_0x3003ec);}(_0x4179,0x6a));var _0x9417=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x4179[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require('lodash');var util=require(_0x9417('0x0'));var moment=require(_0x9417('0x1'));var BPromise=require(_0x9417('0x2'));var rs=require(_0x9417('0x3'));var fs=require('fs');var Redis=require(_0x9417('0x4'));var db=require(_0x9417('0x5'))['db'];var utils=require(_0x9417('0x6'));var logger=require(_0x9417('0x7'))(_0x9417('0x8'));var config=require(_0x9417('0x9'));var jayson=require(_0x9417('0xa'));var client=jayson['client'][_0x9417('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x292aba,_0x4fb080,_0x435cdd){return new BPromise(function(_0x50ccc7,_0x2dd430){return client[_0x9417('0xc')](_0x292aba,_0x435cdd)[_0x9417('0xd')](function(_0xe8ca88){logger[_0x9417('0xe')]('CmCompany,\x20%s,\x20%s',_0x4fb080,_0x9417('0xf'));logger['debug'](_0x9417('0x10'),_0x4fb080,_0x9417('0xf'),JSON['stringify'](_0xe8ca88));if(_0xe8ca88[_0x9417('0x11')]){if(_0xe8ca88[_0x9417('0x11')][_0x9417('0x12')]===0x1f4){logger[_0x9417('0x11')]('CmCompany,\x20%s,\x20%s',_0x4fb080,_0xe8ca88['error']['message']);return _0x2dd430(_0xe8ca88[_0x9417('0x11')][_0x9417('0x13')]);}logger[_0x9417('0x11')](_0x9417('0x14'),_0x4fb080,_0xe8ca88[_0x9417('0x11')][_0x9417('0x13')]);return _0x50ccc7(_0xe8ca88['error'][_0x9417('0x13')]);}else{logger[_0x9417('0xe')](_0x9417('0x14'),_0x4fb080,'request\x20sent');_0x50ccc7(_0xe8ca88[_0x9417('0x15')][_0x9417('0x13')]);}})[_0x9417('0x16')](function(_0x36bccb){logger[_0x9417('0x11')]('CmCompany,\x20%s,\x20%s',_0x4fb080,_0x36bccb);_0x2dd430(_0x36bccb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 38afef0..14bea00 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 _0x1d53=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update'];(function(_0x325064,_0x35482f){var _0x5d9b73=function(_0x5d064a){while(--_0x5d064a){_0x325064['push'](_0x325064['shift']());}};_0x5d9b73(++_0x35482f);}(_0x1d53,0x1a4));var _0x31d5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1d53[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x31d5('0x0'));var util=require(_0x31d5('0x1'));var path=require(_0x31d5('0x2'));var timeout=require(_0x31d5('0x3'));var express=require(_0x31d5('0x4'));var router=express[_0x31d5('0x5')]();var fs_extra=require(_0x31d5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x31d5('0x7'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x31d5('0x8')]('/',auth[_0x31d5('0x9')](),controller[_0x31d5('0xa')]);router['get'](_0x31d5('0xb'),auth[_0x31d5('0x9')](),controller[_0x31d5('0xc')]);router['get'](_0x31d5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x31d5('0x8')](_0x31d5('0xe'),auth[_0x31d5('0x9')](),controller[_0x31d5('0xf')]);router[_0x31d5('0x10')]('/',auth['isAuthenticated'](),controller[_0x31d5('0x11')]);router[_0x31d5('0x10')](_0x31d5('0xe'),auth[_0x31d5('0x9')](),controller[_0x31d5('0x12')]);router[_0x31d5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x31d5('0x14')]);router['delete'](_0x31d5('0xd'),auth[_0x31d5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x141c=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','getContacts','post','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x141c,0x1f3));var _0xc141=function(_0x33acf0,_0x4c2b5c){_0x33acf0=_0x33acf0-0x0;var _0x38559f=_0x141c[_0x33acf0];return _0x38559f;};'use strict';var multer=require(_0xc141('0x0'));var util=require('util');var path=require(_0xc141('0x1'));var timeout=require(_0xc141('0x2'));var express=require(_0xc141('0x3'));var router=express[_0xc141('0x4')]();var fs_extra=require(_0xc141('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc141('0x6'));var controller=require('./cmCompany.controller');router[_0xc141('0x7')]('/',auth[_0xc141('0x8')](),controller[_0xc141('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc141('0x7')](_0xc141('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc141('0x7')]('/:id/contacts',auth[_0xc141('0x8')](),controller[_0xc141('0xb')]);router[_0xc141('0xc')]('/',auth[_0xc141('0x8')](),controller[_0xc141('0xd')]);router[_0xc141('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xc141('0xe')]('/:id',auth[_0xc141('0x8')](),controller[_0xc141('0xf')]);router[_0xc141('0x10')]('/:id',auth[_0xc141('0x8')](),controller[_0xc141('0x11')]);module[_0xc141('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a3d850d..a73e280 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 _0xebb2=['NOW','lodash','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x4361b6,_0x414635){var _0x4c6878=function(_0x54cfb6){while(--_0x54cfb6){_0x4361b6['push'](_0x4361b6['shift']());}};_0x4c6878(++_0x414635);}(_0xebb2,0xc5));var _0x2ebb=function(_0x5e790c,_0x37c4d7){_0x5e790c=_0x5e790c-0x0;var _0x45503c=_0xebb2[_0x5e790c];return _0x45503c;};'use strict';var _=require(_0x2ebb('0x0'));var Sequelize=require(_0x2ebb('0x1'));module[_0x2ebb('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x2ebb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2ebb('0x3')]},'dateOfBirth':{'type':Sequelize[_0x2ebb('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x2ebb('0x3')]},'mobile':{'type':Sequelize[_0x2ebb('0x3')]},'fax':{'type':Sequelize[_0x2ebb('0x3')]},'email':{'type':Sequelize[_0x2ebb('0x3')]},'url':{'type':Sequelize[_0x2ebb('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x2ebb('0x3')]},'twitter':{'type':Sequelize[_0x2ebb('0x3')]},'skype':{'type':Sequelize[_0x2ebb('0x3')]},'teams':{'type':Sequelize[_0x2ebb('0x3')]},'viber':{'type':Sequelize[_0x2ebb('0x3')]},'line':{'type':Sequelize[_0x2ebb('0x3')]},'wechat':{'type':Sequelize[_0x2ebb('0x3')]},'telegram':{'type':Sequelize[_0x2ebb('0x3')]},'UserId':{'type':Sequelize[_0x2ebb('0x4')]},'priority':{'type':Sequelize[_0x2ebb('0x4')](0x2)[_0x2ebb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2ebb('0x6')]}}; \ No newline at end of file +var _0x4086=['STRING','INTEGER','NOW','lodash','sequelize','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x4086,0x1b9));var _0x6408=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4086[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6408('0x0'));var Sequelize=require(_0x6408('0x1'));module[_0x6408('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x6408('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6408('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6408('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x6408('0x3')]},'mobile':{'type':Sequelize[_0x6408('0x3')]},'fax':{'type':Sequelize[_0x6408('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x6408('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6408('0x3')]},'skype':{'type':Sequelize[_0x6408('0x3')]},'teams':{'type':Sequelize[_0x6408('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6408('0x3')]},'wechat':{'type':Sequelize[_0x6408('0x3')]},'telegram':{'type':Sequelize[_0x6408('0x3')]},'UserId':{'type':Sequelize[_0x6408('0x4')]},'priority':{'type':Sequelize[_0x6408('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x6408('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 270b287..d500bb0 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 _0x8977=['agent','some','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.fax','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','push','rows','find','params','catch','describe','columnName','displayName','analytics','findAll','alias','custom','body','from','get','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','each','duplicates','$or','findOrCreate','spread','show','$and','omit','format','pickBy','cf_%d','table','id\x20=\x20?','toParam','values','phone','getTags','findOne','rawAttributes','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','fork','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','status','offset','undefined','limit','count','Content-Range','json','update','destroy','then','end','name','send','index','CmContact','startsWith','CmCustomField','trimStart','cf_','all','length','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','select','field','color','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','expr','search','parseSearch','sqlOperator','conditions','keys','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','SELECT','clone','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','role'];(function(_0x3f2fe4,_0xbe9e60){var _0x210f6c=function(_0x1e929e){while(--_0x1e929e){_0x3f2fe4['push'](_0x3f2fe4['shift']());}};_0x210f6c(++_0xbe9e60);}(_0x8977,0x1cd));var _0x7897=function(_0x23862b,_0x5902e6){_0x23862b=_0x23862b-0x0;var _0x405b5d=_0x8977[_0x23862b];return _0x405b5d;};'use strict';var moment=require(_0x7897('0x0'));var BPromise=require(_0x7897('0x1'));var util=require(_0x7897('0x2'));var path=require(_0x7897('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7897('0x4'));var Papa=require(_0x7897('0x5'));var Redis=require(_0x7897('0x6'));var qs=require(_0x7897('0x7'));var as=require(_0x7897('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x7897('0x9'));var db=require(_0x7897('0xa'))['db'];config[_0x7897('0xb')]=_['defaults'](config['redis'],{'host':_0x7897('0xc'),'port':0x18eb});var socket=require(_0x7897('0xd'))(new Redis(config[_0x7897('0xb')]));require(_0x7897('0xe'))['register'](socket);function respondWithResult(_0x21f3bc,_0x136b6d){_0x136b6d=_0x136b6d||0xc8;return function(_0x577875){if(_0x577875){return _0x21f3bc[_0x7897('0xf')](_0x136b6d)['json'](_0x577875);}};}function respondWithFilteredResult(_0x438ad8,_0x41998e){return function(_0x40d103){if(_0x40d103){var _0x3c26c0=typeof _0x41998e[_0x7897('0x10')]===_0x7897('0x11')&&typeof _0x41998e[_0x7897('0x12')]===_0x7897('0x11');var _0x80393e=_0x40d103[_0x7897('0x13')];var _0x5f3718=_0x3c26c0?0x0:_0x41998e[_0x7897('0x10')];var _0x39cc57=_0x3c26c0?_0x40d103[_0x7897('0x13')]:_0x41998e['offset']+_0x41998e[_0x7897('0x12')];var _0x509aee;if(_0x39cc57>=_0x80393e){_0x39cc57=_0x80393e;_0x509aee=0xc8;}else{_0x509aee=0xce;}_0x438ad8[_0x7897('0xf')](_0x509aee);return _0x438ad8['set'](_0x7897('0x14'),_0x5f3718+'-'+_0x39cc57+'/'+_0x80393e)[_0x7897('0x15')](_0x40d103);}return null;};}function saveUpdates(_0x212cb9){return function(_0x630cbe){if(_0x630cbe){return _0x630cbe[_0x7897('0x16')](_0x212cb9)['then'](function(_0x5b67c5){return _0x5b67c5;});}return null;};}function removeEntity(_0x47e2f7){return function(_0x31bfdd){if(_0x31bfdd){return _0x31bfdd[_0x7897('0x17')]()[_0x7897('0x18')](function(){_0x47e2f7[_0x7897('0xf')](0xcc)[_0x7897('0x19')]();});}};}function handleEntityNotFound(_0x17e9de){return function(_0x379da8){if(!_0x379da8){_0x17e9de['sendStatus'](0x194);}return _0x379da8;};}function handleError(_0x188c90,_0x565548){_0x565548=_0x565548||0x1f4;return function(_0x5648a2){logger['error'](_0x5648a2['stack']);if(_0x5648a2[_0x7897('0x1a')]){delete _0x5648a2[_0x7897('0x1a')];}_0x188c90[_0x7897('0xf')](_0x565548)[_0x7897('0x1b')](_0x5648a2);};}exports[_0x7897('0x1c')]=function(_0x531b1f,_0x628372){var _0x215978={},_0x1b6449={},_0x6c96ff={'count':0x0,'rows':[]};return db[_0x7897('0x1d')]['describe']()[_0x7897('0x18')](function(_0xed2811){var _0x4a173a=[];for(var _0x595696=0x0;_0x5956960x1){_0x3e3773['or'](_0x7897('0x5b'),qs[_0x7897('0x5c')](_0x37e969),null);}else{if(qs[_0x7897('0x5d')](_0x37e969)){_0x3e3773['or'](_0x7897('0x5e'),_0x37e969+'%');_0x3e3773['or'](_0x7897('0x5f'),_0x37e969+'%');_0x3e3773['or'](_0x7897('0x60'),_0x37e969+'%');_0x3e3773['or'](_0x7897('0x61'),_0x37e969+'%');}else if(qs[_0x7897('0x62')](_0x37e969)){_0x3e3773['or'](_0x7897('0x63'),_0x37e969+'%');}else{_0x3e3773['or'](_0x7897('0x64'),'%'+_0x37e969+'%');_0x3e3773['or'](_0x7897('0x65'),'%'+_0x37e969+'%');_0x3e3773['or'](_0x7897('0x63'),'%'+_0x37e969+'%');}}}}_0x56f53c[_0x7897('0x39')](_0x3e3773);_0x56f53c[_0x7897('0x66')](_0x7897('0x67'));var _0x57b85d={'type':db['Sequelize']['QueryTypes'][_0x7897('0x68')],'raw':!![]};var _0x3676e8=_0x56f53c[_0x7897('0x69')]()[_0x7897('0x30')]('c.id');if(_0x215978[_0x7897('0x2c')]){_0x215978[_0x7897('0x2c')][_0x7897('0x44')](function(_0x2a1f46){_0x56f53c['order']('c.'+_0x2a1f46[0x0],_0x2a1f46[0x1]===_0x7897('0x6a')?![]:!![]);});}if(!_[_0x7897('0x6b')](_0xddd579)){_0x56f53c[_0x7897('0x6c')](_0x18345c);_0x3676e8[_0x7897('0x39')](_0x7897('0x6d'),_0xddd579);}BPromise[_0x7897('0x6e')]()['then'](function(){if(!_0xff4264)return;if(_0x531b1f[_0x7897('0x6f')][_0x7897('0x70')]!==_0x7897('0x71'))return;if(!_[_0x7897('0x72')](_0xff4264['conditions'],['field',_0x7897('0x47')])){return _0x531b1f[_0x7897('0x6f')]['getLists']({'attributes':['id'],'raw':!![]})[_0x7897('0x18')](function(_0x4d2e41){if(_[_0x7897('0x6b')](_0x4d2e41)){_0x3676e8['where']('c.ListId\x20IS\x20NULL');_0x56f53c['where'](_0x7897('0x73'));}else{_0x3676e8[_0x7897('0x39')](_0x7897('0x56'),_[_0x7897('0x43')](_0x4d2e41,'id'));_0x56f53c['where']('c.ListId\x20IN\x20?',_['map'](_0x4d2e41,'id'));}});}})['then'](function(){if(_0x531b1f[_0x7897('0x6f')][_0x7897('0x70')]==='agent'&&!_0xff4264&&!_0x531b1f[_0x7897('0x25')][_0x7897('0x55')])return[];return db[_0x7897('0x74')][_0x7897('0x25')](_0x3676e8[_0x7897('0x75')](),_0x57b85d);})[_0x7897('0x18')](function(_0xb9257f){_0x6c96ff[_0x7897('0x13')]=_0xb9257f[_0x7897('0x23')];if(_0x6c96ff['count']===0x0)return[];return db[_0x7897('0x74')][_0x7897('0x25')](_0x3dba06[_0x7897('0x75')](),_0x57b85d)[_0x7897('0x18')](function(_0x5ff64d){_0x372978=_[_0x7897('0x76')](_0x5ff64d,'id');_0x57b85d=_[_0x7897('0x77')](_0x57b85d,{'model':db[_0x7897('0x1d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x531b1f[_0x7897('0x25')][_0x7897('0x2a')]){_0x215978['attributes'][_0x7897('0x44')](function(_0x3e8841){_0x56f53c['field']('c.'+_0x3e8841);});}else{_0x56f53c[_0x7897('0x30')](_0x7897('0x67'));_0x56f53c['field']('c.firstName');_0x56f53c['field'](_0x7897('0x78'));_0x56f53c[_0x7897('0x30')](_0x7897('0x79'));_0x56f53c[_0x7897('0x30')]('c.mobile');_0x56f53c[_0x7897('0x30')](_0x7897('0x7a'));_0x56f53c[_0x7897('0x30')]('c.email');_0x56f53c[_0x7897('0x30')](_0x7897('0x7b'));_0x56f53c[_0x7897('0x30')]('c.createdAt');_0x56f53c[_0x7897('0x30')](_0x7897('0x7c'));_0x56f53c['field'](_0x7897('0x7d'));_0x56f53c[_0x7897('0x30')](_0x7897('0x7e'),'TagIds');}if(_0x215978[_0x7897('0x12')])_0x56f53c[_0x7897('0x12')](_0x215978[_0x7897('0x12')]);if(_0x215978['offset'])_0x56f53c[_0x7897('0x10')](_0x215978['offset']);return db[_0x7897('0x74')]['query'](_0x56f53c[_0x7897('0x75')](),_0x57b85d);});})[_0x7897('0x18')](function(_0x3bf98c){_0x3bf98c[_0x7897('0x44')](function(_0x1514e8){if(_0x1514e8['TagIds']){_0x1514e8[_0x7897('0x7f')]=[];_0x1514e8[_0x7897('0x80')][_0x7897('0x42')](',')[_0x7897('0x44')](function(_0x53572){_0x1514e8['Tags'][_0x7897('0x81')](_0x372978[_0x53572]);});}delete _0x1514e8['TagIds'];});_0x6c96ff[_0x7897('0x82')]=_0x3bf98c;return _0x6c96ff;})[_0x7897('0x18')](respondWithFilteredResult(_0x628372,_0x215978));})['catch'](handleError(_0x628372,null));};exports['destroy']=function(_0x1a6234,_0x111021){return db['CmContact'][_0x7897('0x83')]({'where':{'id':_0x1a6234[_0x7897('0x84')]['id']}})[_0x7897('0x18')](handleEntityNotFound(_0x111021,null))[_0x7897('0x18')](removeEntity(_0x111021,null))[_0x7897('0x85')](handleError(_0x111021,null));};exports['describe']=function(_0x28fd97,_0x10b237){return db['CmContact'][_0x7897('0x86')]()[_0x7897('0x18')](function(_0x2e226f){delete _0x2e226f['tags'];for(var _0x13bdd3=0x0;_0x13bdd3=_0x475627){_0x2a940b=_0x475627;_0x525459=0xc8;}else{_0x525459=0xce;}_0x27135a[_0xb657('0x11')](_0x525459);return _0x27135a[_0xb657('0x12')](_0xb657('0x13'),_0x14becc+'-'+_0x2a940b+'/'+_0x475627)[_0xb657('0xd')](_0x3cf248);}return null;};}function saveUpdates(_0x10c0ce){return function(_0x2fcf0c){if(_0x2fcf0c){return _0x2fcf0c['update'](_0x10c0ce)['then'](function(_0x3d05c){return _0x3d05c;});}return null;};}function removeEntity(_0x247b27){return function(_0x69a87f){if(_0x69a87f){return _0x69a87f[_0xb657('0x14')]()[_0xb657('0x15')](function(){_0x247b27[_0xb657('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4ae6){return function(_0x1c4f50){if(!_0x1c4f50){_0x3c4ae6[_0xb657('0x16')](0x194);}return _0x1c4f50;};}function handleError(_0x4d4960,_0x273c1c){_0x273c1c=_0x273c1c||0x1f4;return function(_0x39b84e){logger[_0xb657('0x17')](_0x39b84e[_0xb657('0x18')]);if(_0x39b84e[_0xb657('0x19')]){delete _0x39b84e[_0xb657('0x19')];}_0x4d4960[_0xb657('0x11')](_0x273c1c)[_0xb657('0x1a')](_0x39b84e);};}exports[_0xb657('0x1b')]=function(_0x7fcb82,_0x314082){var _0x2584e4={},_0x5c02b8={},_0x7017e1={'count':0x0,'rows':[]};return db[_0xb657('0x1c')][_0xb657('0x1d')]()[_0xb657('0x15')](function(_0x3920da){var _0x4682f8=[];for(var _0x38637d=0x0;_0x38637d0x1){_0xbb3908['or'](_0xb657('0x5f'),qs[_0xb657('0x60')](_0x43f499),null);}else{if(qs[_0xb657('0x61')](_0x43f499)){_0xbb3908['or']('c.id\x20LIKE\x20?',_0x43f499+'%');_0xbb3908['or'](_0xb657('0x62'),_0x43f499+'%');_0xbb3908['or'](_0xb657('0x63'),_0x43f499+'%');_0xbb3908['or'](_0xb657('0x64'),_0x43f499+'%');}else if(qs[_0xb657('0x65')](_0x43f499)){_0xbb3908['or'](_0xb657('0x66'),_0x43f499+'%');}else{_0xbb3908['or'](_0xb657('0x67'),'%'+_0x43f499+'%');_0xbb3908['or'](_0xb657('0x68'),'%'+_0x43f499+'%');_0xbb3908['or'](_0xb657('0x66'),'%'+_0x43f499+'%');}}}}_0x174533['where'](_0xbb3908);_0x174533[_0xb657('0x69')](_0xb657('0x6a'));var _0xf44fc0={'type':db[_0xb657('0x6b')][_0xb657('0x6c')][_0xb657('0x6d')],'raw':!![]};var _0x4e782f=_0x174533[_0xb657('0x6e')]()[_0xb657('0x34')](_0xb657('0x6a'));if(_0x2584e4[_0xb657('0x30')]){_0x2584e4[_0xb657('0x30')][_0xb657('0x48')](function(_0x4c3a98){_0x174533['order']('c.'+_0x4c3a98[0x0],_0x4c3a98[0x1]===_0xb657('0x6f')?![]:!![]);});}if(!_[_0xb657('0x55')](_0x8433e5)){_0x174533['having'](_0x5acbec);_0x4e782f[_0xb657('0x32')](_0xb657('0x70'),_0x8433e5);}BPromise[_0xb657('0x71')]()[_0xb657('0x15')](function(){if(!_0x2190ae)return;if(_0x7fcb82[_0xb657('0x72')]['role']!==_0xb657('0x73'))return;if(!_[_0xb657('0x74')](_0x2190ae[_0xb657('0x43')],[_0xb657('0x34'),'User'])){return _0x7fcb82[_0xb657('0x72')][_0xb657('0x75')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ece8e){if(_['isEmpty'](_0x3ece8e)){_0x4e782f[_0xb657('0x32')](_0xb657('0x76'));_0x174533['where']('c.ListId\x20IS\x20NULL');}else{_0x4e782f[_0xb657('0x32')](_0xb657('0x57'),_['map'](_0x3ece8e,'id'));_0x174533[_0xb657('0x32')]('c.ListId\x20IN\x20?',_[_0xb657('0x47')](_0x3ece8e,'id'));}});}})['then'](function(){if(_0x7fcb82[_0xb657('0x72')][_0xb657('0x77')]==='agent'&&!_0x2190ae&&!_0x7fcb82[_0xb657('0x28')][_0xb657('0x56')])return[];return db['sequelize']['query'](_0x4e782f[_0xb657('0x78')](),_0xf44fc0);})[_0xb657('0x15')](function(_0x44aab7){_0x7017e1[_0xb657('0x10')]=_0x44aab7[_0xb657('0x1f')];if(_0x7017e1[_0xb657('0x10')]===0x0)return[];return db[_0xb657('0x79')][_0xb657('0x28')](_0xe67649[_0xb657('0x78')](),_0xf44fc0)[_0xb657('0x15')](function(_0x346ed8){_0x4b8a3a=_[_0xb657('0x7a')](_0x346ed8,'id');_0xf44fc0=_[_0xb657('0x7b')](_0xf44fc0,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7fcb82[_0xb657('0x28')][_0xb657('0x2c')]){_0x2584e4[_0xb657('0x2b')][_0xb657('0x48')](function(_0x15c1f2){_0x174533[_0xb657('0x34')]('c.'+_0x15c1f2);});}else{_0x174533['field'](_0xb657('0x6a'));_0x174533[_0xb657('0x34')]('c.firstName');_0x174533['field'](_0xb657('0x7c'));_0x174533[_0xb657('0x34')](_0xb657('0x7d'));_0x174533['field'](_0xb657('0x7e'));_0x174533[_0xb657('0x34')](_0xb657('0x7f'));_0x174533[_0xb657('0x34')](_0xb657('0x80'));_0x174533[_0xb657('0x34')]('c.ListId');_0x174533[_0xb657('0x34')](_0xb657('0x81'));_0x174533[_0xb657('0x34')](_0xb657('0x82'));_0x174533[_0xb657('0x34')](_0xb657('0x83'));_0x174533[_0xb657('0x34')](_0xb657('0x84'),_0xb657('0x85'));}if(_0x2584e4[_0xb657('0x2f')])_0x174533['limit'](_0x2584e4['limit']);if(_0x2584e4['offset'])_0x174533[_0xb657('0xe')](_0x2584e4[_0xb657('0xe')]);return db[_0xb657('0x79')][_0xb657('0x28')](_0x174533[_0xb657('0x78')](),_0xf44fc0);});})[_0xb657('0x15')](function(_0x224cdd){_0x224cdd[_0xb657('0x48')](function(_0x1fae0d){if(_0x1fae0d['TagIds']){_0x1fae0d[_0xb657('0x86')]=[];_0x1fae0d[_0xb657('0x85')]['split'](',')[_0xb657('0x48')](function(_0x5b5345){_0x1fae0d[_0xb657('0x86')]['push'](_0x4b8a3a[_0x5b5345]);});}delete _0x1fae0d[_0xb657('0x85')];});_0x7017e1['rows']=_0x224cdd;return _0x7017e1;})[_0xb657('0x15')](respondWithFilteredResult(_0x314082,_0x2584e4));})['catch'](handleError(_0x314082,null));};exports[_0xb657('0x14')]=function(_0x2974fa,_0x1eb12e){return db[_0xb657('0x1c')][_0xb657('0x87')]({'where':{'id':_0x2974fa[_0xb657('0x88')]['id']}})['then'](handleEntityNotFound(_0x1eb12e,null))['then'](removeEntity(_0x1eb12e,null))[_0xb657('0x89')](handleError(_0x1eb12e,null));};exports[_0xb657('0x1d')]=function(_0x355190,_0x3b367d){return db[_0xb657('0x1c')][_0xb657('0x1d')]()[_0xb657('0x15')](function(_0x11476d){delete _0x11476d['tags'];for(var _0x1726dc=0x0;_0x1726dc{}\s\\|]/g,'-');_0x3d5234(null,util['format'](_0x8aa1('0x1e'),path[_0x8aa1('0x1f')](_0x41359b[_0x8aa1('0x1c')],path['extname'](_0x41359b['originalname'])),Date[_0x8aa1('0x20')](),path[_0x8aa1('0x21')](_0x41359b['originalname'])));}})});router[_0x8aa1('0x16')](_0x8aa1('0x22'),upload['single'](_0x8aa1('0x23')),controller[_0x8aa1('0x24')]);var upload=multer({'storage':multer[_0x8aa1('0x18')]({'destination':function(_0x324034,_0x492726,_0x3777c8){_0x3777c8(null,path[_0x8aa1('0x19')](config[_0x8aa1('0x1a')],_0x8aa1('0x1b')));},'filename':function(_0x1b58be,_0x558820,_0x182790){_0x558820[_0x8aa1('0x1c')]=_0x558820[_0x8aa1('0x1c')][_0x8aa1('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x182790(null,util[_0x8aa1('0x25')](_0x8aa1('0x1e'),path['basename'](_0x558820[_0x8aa1('0x1c')],path['extname'](_0x558820[_0x8aa1('0x1c')])),Date[_0x8aa1('0x20')](),path[_0x8aa1('0x21')](_0x558820[_0x8aa1('0x1c')])));}})});router[_0x8aa1('0x16')](_0x8aa1('0x26'),upload['single'](_0x8aa1('0x23')),controller[_0x8aa1('0x27')]);router[_0x8aa1('0x16')](_0x8aa1('0x28'),auth['isAuthenticated'](),controller[_0x8aa1('0x29')]);router['put'](_0x8aa1('0x2a'),auth[_0x8aa1('0x7')](),controller[_0x8aa1('0x2b')]);router[_0x8aa1('0x2c')](_0x8aa1('0x2a'),auth[_0x8aa1('0x7')](),controller[_0x8aa1('0x2d')]);module[_0x8aa1('0x2e')]=router; \ No newline at end of file +var _0x6c54=['server/files/tmp','originalname','%s-%s%s','basename','extname','now','/csv','single','file','join','replace','format','upload','/upload/:id','import','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','diskStorage','root'];(function(_0x504def,_0x21303a){var _0x1406e4=function(_0x449f72){while(--_0x449f72){_0x504def['push'](_0x504def['shift']());}};_0x1406e4(++_0x21303a);}(_0x6c54,0x178));var _0x46c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6c54[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x46c5('0x0'));var path=require(_0x46c5('0x1'));var timeout=require(_0x46c5('0x2'));var express=require('express');var router=express[_0x46c5('0x3')]();var fs_extra=require(_0x46c5('0x4'));var auth=require(_0x46c5('0x5'));var interaction=require(_0x46c5('0x6'));var config=require(_0x46c5('0x7'));var controller=require(_0x46c5('0x8'));router[_0x46c5('0x9')]('/',auth[_0x46c5('0xa')](),controller[_0x46c5('0xb')]);router['get'](_0x46c5('0xc'),auth[_0x46c5('0xa')](),controller[_0x46c5('0xd')]);router[_0x46c5('0x9')](_0x46c5('0xe'),auth[_0x46c5('0xa')](),controller[_0x46c5('0xf')]);router[_0x46c5('0x9')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x46c5('0x9')]('/:id/hoppers',auth[_0x46c5('0xa')](),controller[_0x46c5('0x10')]);router['get'](_0x46c5('0x11'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x12')]);router[_0x46c5('0x9')](_0x46c5('0x13'),auth[_0x46c5('0xa')](),controller['getHopperFinals']);router[_0x46c5('0x9')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0x46c5('0x14')]);router[_0x46c5('0x9')](_0x46c5('0x15'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x16')]);router[_0x46c5('0x17')](_0x46c5('0x18'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x19')]);router['post']('/',auth[_0x46c5('0xa')](),controller[_0x46c5('0x1a')]);router[_0x46c5('0x17')](_0x46c5('0x1b'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x1c')]);router['post'](_0x46c5('0x1d'),auth[_0x46c5('0xa')](),controller['setTags']);var upload=multer({'storage':multer[_0x46c5('0x1e')]({'destination':function(_0x28b5e9,_0x26fdfc,_0x1527ce){_0x1527ce(null,path['join'](config[_0x46c5('0x1f')],_0x46c5('0x20')));},'filename':function(_0x21451c,_0x30a5c0,_0x4ac911){_0x30a5c0['originalname']=_0x30a5c0[_0x46c5('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ac911(null,util['format'](_0x46c5('0x22'),path[_0x46c5('0x23')](_0x30a5c0[_0x46c5('0x21')],path[_0x46c5('0x24')](_0x30a5c0[_0x46c5('0x21')])),Date[_0x46c5('0x25')](),path[_0x46c5('0x24')](_0x30a5c0[_0x46c5('0x21')])));}})});router[_0x46c5('0x17')](_0x46c5('0x26'),upload[_0x46c5('0x27')](_0x46c5('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x46c5('0x1e')]({'destination':function(_0x5c5ef2,_0xc1814a,_0x3f0308){_0x3f0308(null,path[_0x46c5('0x29')](config[_0x46c5('0x1f')],_0x46c5('0x20')));},'filename':function(_0xeaf875,_0x193b44,_0x22372c){_0x193b44[_0x46c5('0x21')]=_0x193b44[_0x46c5('0x21')][_0x46c5('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x22372c(null,util[_0x46c5('0x2b')](_0x46c5('0x22'),path[_0x46c5('0x23')](_0x193b44[_0x46c5('0x21')],path[_0x46c5('0x24')](_0x193b44[_0x46c5('0x21')])),Date[_0x46c5('0x25')](),path[_0x46c5('0x24')](_0x193b44[_0x46c5('0x21')])));}})});router[_0x46c5('0x17')]('/upload',upload['single'](_0x46c5('0x28')),controller[_0x46c5('0x2c')]);router[_0x46c5('0x17')](_0x46c5('0x2d'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x2e')]);router[_0x46c5('0x2f')]('/:id',auth[_0x46c5('0xa')](),controller[_0x46c5('0x30')]);router['delete'](_0x46c5('0xe'),auth[_0x46c5('0xa')](),controller[_0x46c5('0x31')]);module[_0x46c5('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0d0ebff..90f0bc8 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 _0x491a=['alias','STRING','setDataValue','name','TEXT','long','getDataValue','type','select','parse','values','BOOLEAN','ENUM','voice','exports','VIRTUAL'];(function(_0x379800,_0x36eb73){var _0x553ce3=function(_0x2d7243){while(--_0x2d7243){_0x379800['push'](_0x379800['shift']());}};_0x553ce3(++_0x36eb73);}(_0x491a,0x12e));var _0xa491=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x491a[_0x56fb33];return _0x435ee4;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xa491('0x0')]={'name':{'type':Sequelize[_0xa491('0x1')],'get':function(_0x579d69){return this['getDataValue'](_0xa491('0x2'));}},'alias':{'type':Sequelize[_0xa491('0x3')],'allowNull':![],'set':function(_0x52b536){this[_0xa491('0x4')](_0xa491('0x2'),_0x52b536?_0x52b536:this['getDataValue'](_0xa491('0x5')));}},'type':{'type':Sequelize[_0xa491('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xa491('0x6')](_0xa491('0x7')),'get':function(){if(this[_0xa491('0x8')](_0xa491('0x9'))===_0xa491('0xa')){return JSON[_0xa491('0xb')](this[_0xa491('0x8')]('values'));}else{return this['getDataValue'](_0xa491('0xc'));}},'set':function(_0x4c3639){if(Array['isArray'](_0x4c3639)){this['setDataValue']('values',JSON['stringify'](_0x4c3639));}else{this[_0xa491('0x4')]('values',_0x4c3639);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa491('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa491('0xe')](_0xa491('0xf'))}}; \ No newline at end of file +var _0xffda=['ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x4015e5,_0x33914d){var _0x5c68aa=function(_0x1864f2){while(--_0x1864f2){_0x4015e5['push'](_0x4015e5['shift']());}};_0x5c68aa(++_0x33914d);}(_0xffda,0x11a));var _0xaffd=function(_0x472eb1,_0x4dfe4b){_0x472eb1=_0x472eb1-0x0;var _0x1ba86c=_0xffda[_0x472eb1];return _0x1ba86c;};'use strict';var Sequelize=require(_0xaffd('0x0'));var _=require(_0xaffd('0x1'));module[_0xaffd('0x2')]={'name':{'type':Sequelize[_0xaffd('0x3')],'get':function(_0x4fa3c0){return this[_0xaffd('0x4')](_0xaffd('0x5'));}},'alias':{'type':Sequelize[_0xaffd('0x6')],'allowNull':![],'set':function(_0x769557){this[_0xaffd('0x7')](_0xaffd('0x5'),_0x769557?_0x769557:this[_0xaffd('0x4')](_0xaffd('0x8')));}},'type':{'type':Sequelize[_0xaffd('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xaffd('0x9')](_0xaffd('0xa')),'get':function(){if(this['getDataValue'](_0xaffd('0xb'))===_0xaffd('0xc')){return JSON[_0xaffd('0xd')](this[_0xaffd('0x4')](_0xaffd('0xe')));}else{return this[_0xaffd('0x4')](_0xaffd('0xe'));}},'set':function(_0x46081a){if(Array[_0xaffd('0xf')](_0x46081a)){this[_0xaffd('0x7')](_0xaffd('0xe'),JSON[_0xaffd('0x10')](_0x46081a));}else{this[_0xaffd('0x7')](_0xaffd('0xe'),_0x46081a);}}},'required':{'type':Sequelize[_0xaffd('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xaffd('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xaffd('0x12')](_0xaffd('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a56eaf4..cd57274 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 _0x8f43=['create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','CmCustomField','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','body','destroy'];(function(_0x146bb9,_0x1d4756){var _0x40f815=function(_0x356f4d){while(--_0x356f4d){_0x146bb9['push'](_0x146bb9['shift']());}};_0x40f815(++_0x1d4756);}(_0x8f43,0xc0));var _0x38f4=function(_0x4a4a0f,_0x37dc95){_0x4a4a0f=_0x4a4a0f-0x0;var _0x1d27ae=_0x8f43[_0x4a4a0f];return _0x1d27ae;};'use strict';var emlformat=require(_0x38f4('0x0'));var rimraf=require(_0x38f4('0x1'));var zipdir=require(_0x38f4('0x2'));var jsonpatch=require(_0x38f4('0x3'));var rp=require(_0x38f4('0x4'));var moment=require('moment');var BPromise=require(_0x38f4('0x5'));var Mustache=require(_0x38f4('0x6'));var util=require(_0x38f4('0x7'));var path=require(_0x38f4('0x8'));var sox=require(_0x38f4('0x9'));var csv=require(_0x38f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38f4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x38f4('0xc'));var jsforce=require(_0x38f4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38f4('0xe'));var Papa=require('papaparse');var Redis=require(_0x38f4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x38f4('0x10'));var as=require(_0x38f4('0x11'));var hardwareService=require(_0x38f4('0x12'));var logger=require(_0x38f4('0x13'))('api');var utils=require(_0x38f4('0x14'));var config=require(_0x38f4('0x15'));var licenseUtil=require(_0x38f4('0x16'));var db=require(_0x38f4('0x17'))['db'];function respondWithStatusCode(_0x591ed2,_0x4cc5fc){_0x4cc5fc=_0x4cc5fc||0xcc;return function(_0x42a83d){if(_0x42a83d){return _0x591ed2[_0x38f4('0x18')](_0x4cc5fc);}return _0x591ed2[_0x38f4('0x19')](_0x4cc5fc)[_0x38f4('0x1a')]();};}function respondWithResult(_0x51d331,_0x2355ad){_0x2355ad=_0x2355ad||0xc8;return function(_0x1e7b36){if(_0x1e7b36){return _0x51d331[_0x38f4('0x19')](_0x2355ad)[_0x38f4('0x1b')](_0x1e7b36);}};}function respondWithFilteredResult(_0x4fffb8,_0x106b32){return function(_0x598fe6){if(_0x598fe6){var _0x3ce4b4=typeof _0x106b32['offset']===_0x38f4('0x1c')&&typeof _0x106b32['limit']===_0x38f4('0x1c');var _0x691f2f=_0x598fe6[_0x38f4('0x1d')];var _0x39f8d9=_0x3ce4b4?0x0:_0x106b32[_0x38f4('0x1e')];var _0x2c2b89=_0x3ce4b4?_0x598fe6[_0x38f4('0x1d')]:_0x106b32[_0x38f4('0x1e')]+_0x106b32[_0x38f4('0x1f')];var _0x12100f;if(_0x2c2b89>=_0x691f2f){_0x2c2b89=_0x691f2f;_0x12100f=0xc8;}else{_0x12100f=0xce;}_0x4fffb8[_0x38f4('0x19')](_0x12100f);return _0x4fffb8[_0x38f4('0x20')](_0x38f4('0x21'),_0x39f8d9+'-'+_0x2c2b89+'/'+_0x691f2f)['json'](_0x598fe6);}return null;};}function patchUpdates(_0xe3f6b8){return function(_0x1068c5){try{jsonpatch[_0x38f4('0x22')](_0x1068c5,_0xe3f6b8,!![]);}catch(_0x5b560a){return BPromise[_0x38f4('0x23')](_0x5b560a);}return _0x1068c5[_0x38f4('0x24')]();};}function saveUpdates(_0x1e9bd3,_0x3fba75){return function(_0x4df6f7){if(_0x4df6f7){return _0x4df6f7[_0x38f4('0x25')](_0x1e9bd3)[_0x38f4('0x26')](function(_0x4818b5){return _0x4818b5;});}return null;};}function removeEntity(_0x1db198,_0x20905b){return function(_0x4cf750){if(_0x4cf750){return _0x4cf750['destroy']()[_0x38f4('0x26')](function(){_0x1db198[_0x38f4('0x19')](0xcc)[_0x38f4('0x1a')]();});}};}function handleEntityNotFound(_0x1e40ef,_0x42fbd1){return function(_0x165d73){if(!_0x165d73){_0x1e40ef['sendStatus'](0x194);}return _0x165d73;};}function handleError(_0x4cf3d3,_0x44366b){_0x44366b=_0x44366b||0x1f4;return function(_0xf72a0f){logger[_0x38f4('0x27')](_0xf72a0f[_0x38f4('0x28')]);if(_0xf72a0f[_0x38f4('0x29')]){delete _0xf72a0f['name'];}_0x4cf3d3['status'](_0x44366b)[_0x38f4('0x2a')](_0xf72a0f);};}exports[_0x38f4('0x2b')]=function(_0x1bd347,_0x4ea15b){var _0x1d2c77={},_0x150a50={},_0x6c5dbd={'count':0x0,'rows':[]};var _0x32a938=_['map'](db[_0x38f4('0x2c')]['rawAttributes'],function(_0x5a412a){return{'name':_0x5a412a[_0x38f4('0x2d')],'type':_0x5a412a['type'][_0x38f4('0x2e')]};});_0x150a50[_0x38f4('0x2f')]=_['differenceBy'](_[_0x38f4('0x30')](_0x32a938,_0x38f4('0x29')),[_0x38f4('0x29')]);_0x150a50[_0x38f4('0x31')]=_['keys'](_0x1bd347[_0x38f4('0x31')]);_0x150a50[_0x38f4('0x32')]=_[_0x38f4('0x33')](_0x150a50[_0x38f4('0x2f')],_0x150a50[_0x38f4('0x31')]);_0x1d2c77[_0x38f4('0x34')]=_[_0x38f4('0x33')](_0x150a50['model'],qs[_0x38f4('0x35')](_0x1bd347[_0x38f4('0x31')][_0x38f4('0x35')]));_0x1d2c77[_0x38f4('0x34')]=_0x1d2c77['attributes'][_0x38f4('0x36')]?_0x1d2c77[_0x38f4('0x34')]:_0x150a50[_0x38f4('0x2f')];if(!_0x1bd347[_0x38f4('0x31')][_0x38f4('0x37')](_0x38f4('0x38'))){_0x1d2c77['limit']=qs[_0x38f4('0x1f')](_0x1bd347[_0x38f4('0x31')][_0x38f4('0x1f')]);_0x1d2c77['offset']=qs[_0x38f4('0x1e')](_0x1bd347[_0x38f4('0x31')][_0x38f4('0x1e')]);}_0x1d2c77[_0x38f4('0x39')]=qs[_0x38f4('0x3a')](_0x1bd347['query'][_0x38f4('0x3a')]);_0x1d2c77[_0x38f4('0x3b')]=qs[_0x38f4('0x32')](_[_0x38f4('0x3c')](_0x1bd347[_0x38f4('0x31')],_0x150a50[_0x38f4('0x32')]),_0x32a938);if(_0x1bd347[_0x38f4('0x31')][_0x38f4('0x3d')]){_0x1d2c77[_0x38f4('0x3b')]=_[_0x38f4('0x3e')](_0x1d2c77['where'],{'$or':_[_0x38f4('0x30')](_0x32a938,function(_0x56e54e){if(_0x56e54e[_0x38f4('0x3f')]!==_0x38f4('0x40')){var _0x78f3e6={};_0x78f3e6[_0x56e54e[_0x38f4('0x29')]]={'$like':'%'+_0x1bd347[_0x38f4('0x31')][_0x38f4('0x3d')]+'%'};return _0x78f3e6;}})});}_0x1d2c77=_[_0x38f4('0x3e')]({},_0x1d2c77,_0x1bd347[_0x38f4('0x41')]);var _0x2baa8b={'where':_0x1d2c77[_0x38f4('0x3b')]};return db[_0x38f4('0x2c')][_0x38f4('0x1d')](_0x2baa8b)[_0x38f4('0x26')](function(_0x31957e){_0x6c5dbd['count']=_0x31957e;if(_0x1bd347[_0x38f4('0x31')][_0x38f4('0x42')]){_0x1d2c77[_0x38f4('0x43')]=[{'all':!![]}];}return db['CmCustomField'][_0x38f4('0x44')](_0x1d2c77);})['then'](function(_0x4fc42f){_0x6c5dbd[_0x38f4('0x45')]=_0x4fc42f;return _0x6c5dbd;})['then'](respondWithFilteredResult(_0x4ea15b,_0x1d2c77))[_0x38f4('0x46')](handleError(_0x4ea15b,null));};exports[_0x38f4('0x47')]=function(_0x4042f8,_0x507568){var _0x1fb3ac={'raw':!![],'where':{'id':_0x4042f8[_0x38f4('0x48')]['id']}},_0x5b23ad={};_0x5b23ad[_0x38f4('0x2f')]=_[_0x38f4('0x49')](db[_0x38f4('0x2c')][_0x38f4('0x4a')]);_0x5b23ad[_0x38f4('0x31')]=_[_0x38f4('0x49')](_0x4042f8['query']);_0x5b23ad[_0x38f4('0x32')]=_[_0x38f4('0x33')](_0x5b23ad['model'],_0x5b23ad[_0x38f4('0x31')]);_0x1fb3ac[_0x38f4('0x34')]=_[_0x38f4('0x33')](_0x5b23ad['model'],qs[_0x38f4('0x35')](_0x4042f8[_0x38f4('0x31')][_0x38f4('0x35')]));_0x1fb3ac[_0x38f4('0x34')]=_0x1fb3ac['attributes']['length']?_0x1fb3ac['attributes']:_0x5b23ad[_0x38f4('0x2f')];if(_0x4042f8[_0x38f4('0x31')]['includeAll']){_0x1fb3ac[_0x38f4('0x43')]=[{'all':!![]}];}_0x1fb3ac=_[_0x38f4('0x3e')]({},_0x1fb3ac,_0x4042f8['options']);return db[_0x38f4('0x2c')][_0x38f4('0x4b')](_0x1fb3ac)[_0x38f4('0x26')](handleEntityNotFound(_0x507568,null))[_0x38f4('0x26')](respondWithResult(_0x507568,null))[_0x38f4('0x46')](handleError(_0x507568,null));};exports[_0x38f4('0x25')]=function(_0x304f7a,_0x4fd4ec){if(_0x304f7a['body']['id']){delete _0x304f7a[_0x38f4('0x4c')]['id'];}return db[_0x38f4('0x2c')][_0x38f4('0x4b')]({'where':{'id':_0x304f7a[_0x38f4('0x48')]['id']}})[_0x38f4('0x26')](handleEntityNotFound(_0x4fd4ec,null))[_0x38f4('0x26')](saveUpdates(_0x304f7a[_0x38f4('0x4c')],null))['then'](respondWithResult(_0x4fd4ec,null))[_0x38f4('0x46')](handleError(_0x4fd4ec,null));};exports[_0x38f4('0x4d')]=function(_0x21fcb4,_0x3349f2){return db[_0x38f4('0x2c')][_0x38f4('0x4b')]({'where':{'id':_0x21fcb4[_0x38f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3349f2,null))[_0x38f4('0x26')](removeEntity(_0x3349f2,null))[_0x38f4('0x46')](handleError(_0x3349f2,null));};exports[_0x38f4('0x4e')]=function(_0x247399,_0x175480){var _0x3cc628;return db[_0x38f4('0x4f')][_0x38f4('0x50')](function(_0x52cd93){return db[_0x38f4('0x2c')][_0x38f4('0x4e')](_0x247399[_0x38f4('0x4c')],{'transaction':_0x52cd93})['then'](function(_0x3e1a7a){_0x3cc628=_0x3e1a7a;var _0x3eb0c8={'type':db['Sequelize'][_0x38f4('0x51')],'transaction':_0x52cd93};switch(_0x247399[_0x38f4('0x4c')][_0x38f4('0x3f')]){case'text':_0x3eb0c8[_0x38f4('0x3f')]=db[_0x38f4('0x52')][_0x38f4('0x51')];break;case _0x38f4('0x53'):_0x3eb0c8[_0x38f4('0x3f')]=db[_0x38f4('0x52')][_0x38f4('0x54')];break;case _0x38f4('0x55'):_0x3eb0c8[_0x38f4('0x3f')]=db[_0x38f4('0x52')][_0x38f4('0x56')];_0x3eb0c8[_0x38f4('0x57')]=![];break;default:}return db[_0x38f4('0x4f')]['queryInterface'][_0x38f4('0x58')]('cm_contacts',util['format'](_0x38f4('0x59'),_0x3cc628['id']),_0x3eb0c8);})[_0x38f4('0x26')](function(){return _0x3cc628;});})[_0x38f4('0x26')](respondWithResult(_0x175480,0xc9))['catch'](handleError(_0x175480,null));}; \ No newline at end of file +var _0x9563=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','name','index','map','CmCustomField','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','TEXT','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9563,0xf3));var _0x3956=function(_0x43b6ff,_0x82db44){_0x43b6ff=_0x43b6ff-0x0;var _0x206665=_0x9563[_0x43b6ff];return _0x206665;};'use strict';var emlformat=require(_0x3956('0x0'));var rimraf=require(_0x3956('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3956('0x2'));var moment=require(_0x3956('0x3'));var BPromise=require(_0x3956('0x4'));var Mustache=require(_0x3956('0x5'));var util=require('util');var path=require(_0x3956('0x6'));var sox=require('sox');var csv=require(_0x3956('0x7'));var ejs=require(_0x3956('0x8'));var fs=require('fs');var fs_extra=require(_0x3956('0x9'));var _=require(_0x3956('0xa'));var squel=require(_0x3956('0xb'));var crypto=require(_0x3956('0xc'));var jsforce=require(_0x3956('0xd'));var deskjs=require(_0x3956('0xe'));var toCsv=require(_0x3956('0x7'));var querystring=require(_0x3956('0xf'));var Papa=require(_0x3956('0x10'));var Redis=require('ioredis');var authService=require(_0x3956('0x11'));var qs=require(_0x3956('0x12'));var as=require(_0x3956('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3956('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3956('0x15'));var db=require(_0x3956('0x16'))['db'];function respondWithStatusCode(_0x5b94fa,_0x4261ac){_0x4261ac=_0x4261ac||0xcc;return function(_0x54350b){if(_0x54350b){return _0x5b94fa[_0x3956('0x17')](_0x4261ac);}return _0x5b94fa[_0x3956('0x18')](_0x4261ac)['end']();};}function respondWithResult(_0x538f77,_0xf885){_0xf885=_0xf885||0xc8;return function(_0x31e13a){if(_0x31e13a){return _0x538f77[_0x3956('0x18')](_0xf885)[_0x3956('0x19')](_0x31e13a);}};}function respondWithFilteredResult(_0x43ab59,_0x4ebd06){return function(_0x3e67a9){if(_0x3e67a9){var _0x2ede0f=typeof _0x4ebd06[_0x3956('0x1a')]===_0x3956('0x1b')&&typeof _0x4ebd06[_0x3956('0x1c')]==='undefined';var _0x529f7c=_0x3e67a9[_0x3956('0x1d')];var _0x2a34ca=_0x2ede0f?0x0:_0x4ebd06[_0x3956('0x1a')];var _0x2d02dd=_0x2ede0f?_0x3e67a9[_0x3956('0x1d')]:_0x4ebd06['offset']+_0x4ebd06[_0x3956('0x1c')];var _0x9cd34d;if(_0x2d02dd>=_0x529f7c){_0x2d02dd=_0x529f7c;_0x9cd34d=0xc8;}else{_0x9cd34d=0xce;}_0x43ab59[_0x3956('0x18')](_0x9cd34d);return _0x43ab59[_0x3956('0x1e')]('Content-Range',_0x2a34ca+'-'+_0x2d02dd+'/'+_0x529f7c)[_0x3956('0x19')](_0x3e67a9);}return null;};}function patchUpdates(_0x30b77d){return function(_0x37d3c6){try{jsonpatch['apply'](_0x37d3c6,_0x30b77d,!![]);}catch(_0x9387b0){return BPromise[_0x3956('0x1f')](_0x9387b0);}return _0x37d3c6[_0x3956('0x20')]();};}function saveUpdates(_0x46b3d8,_0x34f9d4){return function(_0x28148f){if(_0x28148f){return _0x28148f[_0x3956('0x21')](_0x46b3d8)[_0x3956('0x22')](function(_0x4088c1){return _0x4088c1;});}return null;};}function removeEntity(_0x27886c,_0x12821b){return function(_0x226dba){if(_0x226dba){return _0x226dba[_0x3956('0x23')]()[_0x3956('0x22')](function(){_0x27886c[_0x3956('0x18')](0xcc)[_0x3956('0x24')]();});}};}function handleEntityNotFound(_0x14de4b,_0x8172f3){return function(_0xe517b){if(!_0xe517b){_0x14de4b[_0x3956('0x17')](0x194);}return _0xe517b;};}function handleError(_0x45b2c0,_0x3d0746){_0x3d0746=_0x3d0746||0x1f4;return function(_0x55031d){logger[_0x3956('0x25')](_0x55031d['stack']);if(_0x55031d[_0x3956('0x26')]){delete _0x55031d[_0x3956('0x26')];}_0x45b2c0[_0x3956('0x18')](_0x3d0746)['send'](_0x55031d);};}exports[_0x3956('0x27')]=function(_0x2be5b6,_0x4773c3){var _0x4ec268={},_0x1b9f6b={},_0x2d655a={'count':0x0,'rows':[]};var _0xd11048=_[_0x3956('0x28')](db[_0x3956('0x29')][_0x3956('0x2a')],function(_0x213d87){return{'name':_0x213d87['fieldName'],'type':_0x213d87['type'][_0x3956('0x2b')]};});_0x1b9f6b[_0x3956('0x2c')]=_[_0x3956('0x2d')](_[_0x3956('0x28')](_0xd11048,_0x3956('0x26')),[_0x3956('0x26')]);_0x1b9f6b[_0x3956('0x2e')]=_[_0x3956('0x2f')](_0x2be5b6[_0x3956('0x2e')]);_0x1b9f6b[_0x3956('0x30')]=_[_0x3956('0x31')](_0x1b9f6b[_0x3956('0x2c')],_0x1b9f6b[_0x3956('0x2e')]);_0x4ec268[_0x3956('0x32')]=_[_0x3956('0x31')](_0x1b9f6b['model'],qs['fields'](_0x2be5b6[_0x3956('0x2e')][_0x3956('0x33')]));_0x4ec268[_0x3956('0x32')]=_0x4ec268[_0x3956('0x32')][_0x3956('0x34')]?_0x4ec268[_0x3956('0x32')]:_0x1b9f6b[_0x3956('0x2c')];if(!_0x2be5b6[_0x3956('0x2e')][_0x3956('0x35')](_0x3956('0x36'))){_0x4ec268['limit']=qs[_0x3956('0x1c')](_0x2be5b6[_0x3956('0x2e')][_0x3956('0x1c')]);_0x4ec268[_0x3956('0x1a')]=qs[_0x3956('0x1a')](_0x2be5b6[_0x3956('0x2e')][_0x3956('0x1a')]);}_0x4ec268[_0x3956('0x37')]=qs['sort'](_0x2be5b6[_0x3956('0x2e')][_0x3956('0x38')]);_0x4ec268[_0x3956('0x39')]=qs['filters'](_[_0x3956('0x3a')](_0x2be5b6[_0x3956('0x2e')],_0x1b9f6b[_0x3956('0x30')]),_0xd11048);if(_0x2be5b6[_0x3956('0x2e')]['filter']){_0x4ec268[_0x3956('0x39')]=_[_0x3956('0x3b')](_0x4ec268['where'],{'$or':_[_0x3956('0x28')](_0xd11048,function(_0x221568){if(_0x221568[_0x3956('0x3c')]!==_0x3956('0x3d')){var _0x570f5a={};_0x570f5a[_0x221568[_0x3956('0x26')]]={'$like':'%'+_0x2be5b6[_0x3956('0x2e')]['filter']+'%'};return _0x570f5a;}})});}_0x4ec268=_[_0x3956('0x3b')]({},_0x4ec268,_0x2be5b6[_0x3956('0x3e')]);var _0x464294={'where':_0x4ec268['where']};return db[_0x3956('0x29')][_0x3956('0x1d')](_0x464294)['then'](function(_0xae286e){_0x2d655a[_0x3956('0x1d')]=_0xae286e;if(_0x2be5b6[_0x3956('0x2e')][_0x3956('0x3f')]){_0x4ec268[_0x3956('0x40')]=[{'all':!![]}];}return db[_0x3956('0x29')][_0x3956('0x41')](_0x4ec268);})[_0x3956('0x22')](function(_0x52738a){_0x2d655a[_0x3956('0x42')]=_0x52738a;return _0x2d655a;})[_0x3956('0x22')](respondWithFilteredResult(_0x4773c3,_0x4ec268))[_0x3956('0x43')](handleError(_0x4773c3,null));};exports[_0x3956('0x44')]=function(_0x1a2949,_0x142aa8){var _0x549ff5={'raw':!![],'where':{'id':_0x1a2949[_0x3956('0x45')]['id']}},_0x2bd56f={};_0x2bd56f[_0x3956('0x2c')]=_['keys'](db['CmCustomField'][_0x3956('0x2a')]);_0x2bd56f[_0x3956('0x2e')]=_[_0x3956('0x2f')](_0x1a2949[_0x3956('0x2e')]);_0x2bd56f[_0x3956('0x30')]=_['intersection'](_0x2bd56f['model'],_0x2bd56f[_0x3956('0x2e')]);_0x549ff5[_0x3956('0x32')]=_[_0x3956('0x31')](_0x2bd56f['model'],qs['fields'](_0x1a2949['query'][_0x3956('0x33')]));_0x549ff5['attributes']=_0x549ff5[_0x3956('0x32')][_0x3956('0x34')]?_0x549ff5[_0x3956('0x32')]:_0x2bd56f['model'];if(_0x1a2949['query'][_0x3956('0x3f')]){_0x549ff5[_0x3956('0x40')]=[{'all':!![]}];}_0x549ff5=_[_0x3956('0x3b')]({},_0x549ff5,_0x1a2949['options']);return db[_0x3956('0x29')][_0x3956('0x46')](_0x549ff5)[_0x3956('0x22')](handleEntityNotFound(_0x142aa8,null))[_0x3956('0x22')](respondWithResult(_0x142aa8,null))[_0x3956('0x43')](handleError(_0x142aa8,null));};exports['update']=function(_0x206cd0,_0x4e5cd0){if(_0x206cd0[_0x3956('0x47')]['id']){delete _0x206cd0[_0x3956('0x47')]['id'];}return db[_0x3956('0x29')][_0x3956('0x46')]({'where':{'id':_0x206cd0[_0x3956('0x45')]['id']}})[_0x3956('0x22')](handleEntityNotFound(_0x4e5cd0,null))[_0x3956('0x22')](saveUpdates(_0x206cd0['body'],null))[_0x3956('0x22')](respondWithResult(_0x4e5cd0,null))[_0x3956('0x43')](handleError(_0x4e5cd0,null));};exports[_0x3956('0x23')]=function(_0x4dc3ae,_0x52efd0){return db['CmCustomField']['find']({'where':{'id':_0x4dc3ae[_0x3956('0x45')]['id']}})[_0x3956('0x22')](handleEntityNotFound(_0x52efd0,null))[_0x3956('0x22')](removeEntity(_0x52efd0,null))[_0x3956('0x43')](handleError(_0x52efd0,null));};exports[_0x3956('0x48')]=function(_0x37d5e0,_0x4ab164){var _0xec2a9f;return db[_0x3956('0x49')]['transaction'](function(_0x32c8e1){return db[_0x3956('0x29')][_0x3956('0x48')](_0x37d5e0[_0x3956('0x47')],{'transaction':_0x32c8e1})[_0x3956('0x22')](function(_0x55d4e6){_0xec2a9f=_0x55d4e6;var _0x243e53={'type':db['Sequelize'][_0x3956('0x4a')],'transaction':_0x32c8e1};switch(_0x37d5e0[_0x3956('0x47')]['type']){case'text':_0x243e53[_0x3956('0x3c')]=db[_0x3956('0x4b')][_0x3956('0x4a')];break;case _0x3956('0x4c'):_0x243e53[_0x3956('0x3c')]=db['Sequelize'][_0x3956('0x4d')];break;case'switch':_0x243e53[_0x3956('0x3c')]=db[_0x3956('0x4b')][_0x3956('0x4e')];_0x243e53[_0x3956('0x4f')]=![];break;default:}return db['sequelize'][_0x3956('0x50')][_0x3956('0x51')](_0x3956('0x52'),util[_0x3956('0x53')](_0x3956('0x54'),_0xec2a9f['id']),_0x243e53);})[_0x3956('0x22')](function(){return _0xec2a9f;});})[_0x3956('0x22')](respondWithResult(_0x4ab164,0xc9))[_0x3956('0x43')](handleError(_0x4ab164,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5560d63..8e96798 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 _0x202c=['define','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19e9a7,_0x57e686){var _0x3a8442=function(_0x154567){while(--_0x154567){_0x19e9a7['push'](_0x19e9a7['shift']());}};_0x3a8442(++_0x57e686);}(_0x202c,0x192));var _0xc202=function(_0x5678a5,_0x5bd9e7){_0x5678a5=_0x5678a5-0x0;var _0x5e2bb6=_0x202c[_0x5678a5];return _0x5e2bb6;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var logger=require(_0xc202('0x1'))(_0xc202('0x2'));var moment=require(_0xc202('0x3'));var BPromise=require(_0xc202('0x4'));var rp=require(_0xc202('0x5'));var fs=require('fs');var path=require(_0xc202('0x6'));var rimraf=require(_0xc202('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x341d2e,_0x585121){return _0x341d2e[_0xc202('0x8')]('CmCustomField',attributes,{'tableName':_0xc202('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeba4=['./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e733a,_0x477403){var _0x34322b=function(_0x3d7210){while(--_0x3d7210){_0x1e733a['push'](_0x1e733a['shift']());}};_0x34322b(++_0x477403);}(_0xeba4,0x1a8));var _0x4eba=function(_0x5bf34c,_0x31429d){_0x5bf34c=_0x5bf34c-0x0;var _0x1c1817=_0xeba4[_0x5bf34c];return _0x1c1817;};'use strict';var _=require(_0x4eba('0x0'));var util=require('util');var logger=require(_0x4eba('0x1'))(_0x4eba('0x2'));var moment=require(_0x4eba('0x3'));var BPromise=require(_0x4eba('0x4'));var rp=require(_0x4eba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4eba('0x6'));module['exports']=function(_0x186955,_0x403837){return _0x186955[_0x4eba('0x7')](_0x4eba('0x8'),attributes,{'tableName':_0x4eba('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 3daf561..52c595d 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 _0x4211=['CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4211,0x1b8));var _0x1421=function(_0x2d92c4,_0x43390d){_0x2d92c4=_0x2d92c4-0x0;var _0x564071=_0x4211[_0x2d92c4];return _0x564071;};'use strict';var _=require('lodash');var util=require(_0x1421('0x0'));var moment=require(_0x1421('0x1'));var BPromise=require(_0x1421('0x2'));var rs=require(_0x1421('0x3'));var fs=require('fs');var Redis=require(_0x1421('0x4'));var db=require(_0x1421('0x5'))['db'];var utils=require(_0x1421('0x6'));var logger=require(_0x1421('0x7'))(_0x1421('0x8'));var config=require(_0x1421('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1421('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d1411,_0x35b720,_0x3d283f){return new BPromise(function(_0x47e949,_0x33d535){return client[_0x1421('0xb')](_0x3d1411,_0x3d283f)[_0x1421('0xc')](function(_0x4cf1a2){logger[_0x1421('0xd')](_0x1421('0xe'),_0x35b720,'request\x20sent');logger[_0x1421('0xf')](_0x1421('0x10'),_0x35b720,_0x1421('0x11'),JSON[_0x1421('0x12')](_0x4cf1a2));if(_0x4cf1a2[_0x1421('0x13')]){if(_0x4cf1a2[_0x1421('0x13')][_0x1421('0x14')]===0x1f4){logger[_0x1421('0x13')](_0x1421('0xe'),_0x35b720,_0x4cf1a2['error']['message']);return _0x33d535(_0x4cf1a2[_0x1421('0x13')][_0x1421('0x15')]);}logger[_0x1421('0x13')](_0x1421('0xe'),_0x35b720,_0x4cf1a2['error'][_0x1421('0x15')]);return _0x47e949(_0x4cf1a2[_0x1421('0x13')]['message']);}else{logger[_0x1421('0xd')]('CmCustomField,\x20%s,\x20%s',_0x35b720,_0x1421('0x11'));_0x47e949(_0x4cf1a2[_0x1421('0x16')]['message']);}})[_0x1421('0x17')](function(_0x16e951){logger['error']('CmCustomField,\x20%s,\x20%s',_0x35b720,_0x16e951);_0x33d535(_0x16e951);});});} \ No newline at end of file +var _0xfc88=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','result','lodash','moment','bluebird','randomstring'];(function(_0x4a9ac6,_0xa1ae26){var _0x25786e=function(_0x3c02bd){while(--_0x3c02bd){_0x4a9ac6['push'](_0x4a9ac6['shift']());}};_0x25786e(++_0xa1ae26);}(_0xfc88,0xd8));var _0x8fc8=function(_0x4f252e,_0x20cc01){_0x4f252e=_0x4f252e-0x0;var _0x264643=_0xfc88[_0x4f252e];return _0x264643;};'use strict';var _=require(_0x8fc8('0x0'));var util=require('util');var moment=require(_0x8fc8('0x1'));var BPromise=require(_0x8fc8('0x2'));var rs=require(_0x8fc8('0x3'));var fs=require('fs');var Redis=require(_0x8fc8('0x4'));var db=require(_0x8fc8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fc8('0x6'))(_0x8fc8('0x7'));var config=require(_0x8fc8('0x8'));var jayson=require(_0x8fc8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c42a1,_0x50b812,_0x30e4cf){return new BPromise(function(_0x4da044,_0x4fac8f){return client[_0x8fc8('0xa')](_0x2c42a1,_0x30e4cf)[_0x8fc8('0xb')](function(_0x255e99){logger[_0x8fc8('0xc')](_0x8fc8('0xd'),_0x50b812,_0x8fc8('0xe'));logger[_0x8fc8('0xf')](_0x8fc8('0x10'),_0x50b812,'request\x20sent',JSON[_0x8fc8('0x11')](_0x255e99));if(_0x255e99[_0x8fc8('0x12')]){if(_0x255e99[_0x8fc8('0x12')]['code']===0x1f4){logger[_0x8fc8('0x12')](_0x8fc8('0xd'),_0x50b812,_0x255e99[_0x8fc8('0x12')]['message']);return _0x4fac8f(_0x255e99[_0x8fc8('0x12')]['message']);}logger[_0x8fc8('0x12')](_0x8fc8('0xd'),_0x50b812,_0x255e99[_0x8fc8('0x12')]['message']);return _0x4da044(_0x255e99['error']['message']);}else{logger['info'](_0x8fc8('0xd'),_0x50b812,_0x8fc8('0xe'));_0x4da044(_0x255e99[_0x8fc8('0x13')]['message']);}})['catch'](function(_0x5eb26e){logger[_0x8fc8('0x12')]('CmCustomField,\x20%s,\x20%s',_0x50b812,_0x5eb26e);_0x4fac8f(_0x5eb26e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 85349b1..706bdf0 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 _0x4ce7=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','./cmCustomField.controller','get','isAuthenticated'];(function(_0x2ca0bd,_0x431233){var _0xa8dc05=function(_0x5d0753){while(--_0x5d0753){_0x2ca0bd['push'](_0x2ca0bd['shift']());}};_0xa8dc05(++_0x431233);}(_0x4ce7,0x1c3));var _0x74ce=function(_0x3f5866,_0x5804a8){_0x3f5866=_0x3f5866-0x0;var _0x55314c=_0x4ce7[_0x3f5866];return _0x55314c;};'use strict';var multer=require(_0x74ce('0x0'));var util=require(_0x74ce('0x1'));var path=require('path');var timeout=require(_0x74ce('0x2'));var express=require(_0x74ce('0x3'));var router=express['Router']();var fs_extra=require(_0x74ce('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74ce('0x5'));router[_0x74ce('0x6')]('/',auth[_0x74ce('0x7')](),controller[_0x74ce('0x8')]);router[_0x74ce('0x6')](_0x74ce('0x9'),auth[_0x74ce('0x7')](),controller['show']);router[_0x74ce('0xa')]('/',auth[_0x74ce('0x7')](),controller[_0x74ce('0xb')]);router[_0x74ce('0xc')]('/:id',auth[_0x74ce('0x7')](),controller[_0x74ce('0xd')]);router[_0x74ce('0xe')](_0x74ce('0x9'),auth[_0x74ce('0x7')](),controller[_0x74ce('0xf')]);module[_0x74ce('0x10')]=router; \ No newline at end of file +var _0x359a=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','update','destroy','multer'];(function(_0x379d4a,_0x57522f){var _0x24af65=function(_0x7daeef){while(--_0x7daeef){_0x379d4a['push'](_0x379d4a['shift']());}};_0x24af65(++_0x57522f);}(_0x359a,0x153));var _0xa359=function(_0x54799d,_0x2cc089){_0x54799d=_0x54799d-0x0;var _0x2b3d7f=_0x359a[_0x54799d];return _0x2b3d7f;};'use strict';var multer=require(_0xa359('0x0'));var util=require(_0xa359('0x1'));var path=require(_0xa359('0x2'));var timeout=require(_0xa359('0x3'));var express=require(_0xa359('0x4'));var router=express['Router']();var fs_extra=require(_0xa359('0x5'));var auth=require(_0xa359('0x6'));var interaction=require(_0xa359('0x7'));var config=require(_0xa359('0x8'));var controller=require(_0xa359('0x9'));router[_0xa359('0xa')]('/',auth[_0xa359('0xb')](),controller[_0xa359('0xc')]);router[_0xa359('0xa')](_0xa359('0xd'),auth['isAuthenticated'](),controller[_0xa359('0xe')]);router['post']('/',auth[_0xa359('0xb')](),controller['create']);router['put'](_0xa359('0xd'),auth[_0xa359('0xb')](),controller[_0xa359('0xf')]);router['delete']('/:id',auth[_0xa359('0xb')](),controller[_0xa359('0x10')]);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 65b52de..796014c 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 _0x4a0e=['DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','INTEGER'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x4a0e,0x1e3));var _0xe4a0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4a0e[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xe4a0('0x0'));var Sequelize=require(_0xe4a0('0x1'));module[_0xe4a0('0x2')]={'phone':{'type':Sequelize[_0xe4a0('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe4a0('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xe4a0('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe4a0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe4a0('0x7')]},'priority':{'type':Sequelize[_0xe4a0('0x6')](0x2)[_0xe4a0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe4a0('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe4a0('0x6')],'unique':_0xe4a0('0x9')},'ListId':{'type':Sequelize[_0xe4a0('0x6')],'unique':_0xe4a0('0x9')},'UserId':{'type':Sequelize[_0xe4a0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe4a0('0x6')],'unique':_0xe4a0('0x9')},'CampaignId':{'type':Sequelize[_0xe4a0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe4a0('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd560=['contactListQueue','moment','STRING','BOOLEAN','format','INTEGER','UNSIGNED'];(function(_0x5786e1,_0x233643){var _0x1590a8=function(_0x2be521){while(--_0x2be521){_0x5786e1['push'](_0x5786e1['shift']());}};_0x1590a8(++_0x233643);}(_0xd560,0x135));var _0x0d56=function(_0x30d650,_0xffb8e2){_0x30d650=_0x30d650-0x0;var _0x41fbab=_0xd560[_0x30d650];return _0x41fbab;};'use strict';var moment=require(_0x0d56('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x0d56('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x0d56('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0d56('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0d56('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0d56('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x0d56('0x4')](0x2)[_0x0d56('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0d56('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0d56('0x4')],'unique':_0x0d56('0x6')},'ListId':{'type':Sequelize[_0x0d56('0x4')],'unique':_0x0d56('0x6')},'UserId':{'type':Sequelize[_0x0d56('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x0d56('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x0d56('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0d56('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0d56('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 a2e9fb1..3a00aa0 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 _0x80b4=['save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','keys','query','intersection','model','filters','concat','$or','$gt','$lt','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$contains','$any','attributes','fields','order','sort','pick','filter','where','merge','type','options','CmHopper','include','findAll','show','params','rawAttributes','length','includeAll','find','catch','create','body','describe','CampaignId','VoiceQueueId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','CmCompany','Company','Queue','dialActive','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x80b4,0x6e));var _0x480b=function(_0x3b16ef,_0x4c825e){_0x3b16ef=_0x3b16ef-0x0;var _0x3a938b=_0x80b4[_0x3b16ef];return _0x3a938b;};'use strict';var emlformat=require(_0x480b('0x0'));var rimraf=require(_0x480b('0x1'));var zipdir=require(_0x480b('0x2'));var jsonpatch=require(_0x480b('0x3'));var rp=require('request-promise');var moment=require(_0x480b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x480b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x480b('0x6'));var csv=require('to-csv');var ejs=require(_0x480b('0x7'));var fs=require('fs');var fs_extra=require(_0x480b('0x8'));var _=require(_0x480b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x480b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x480b('0xb'));var querystring=require(_0x480b('0xc'));var Papa=require(_0x480b('0xd'));var Redis=require(_0x480b('0xe'));var authService=require(_0x480b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x480b('0x10'));var hardwareService=require(_0x480b('0x11'));var logger=require(_0x480b('0x12'))(_0x480b('0x13'));var utils=require('../../config/utils');var config=require(_0x480b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x480b('0x15'))['db'];function respondWithStatusCode(_0x2ac65,_0x410213){_0x410213=_0x410213||0xcc;return function(_0x456814){if(_0x456814){return _0x2ac65[_0x480b('0x16')](_0x410213);}return _0x2ac65[_0x480b('0x17')](_0x410213)[_0x480b('0x18')]();};}function respondWithResult(_0x34d513,_0xcda75f){_0xcda75f=_0xcda75f||0xc8;return function(_0x393360){if(_0x393360){return _0x34d513[_0x480b('0x17')](_0xcda75f)[_0x480b('0x19')](_0x393360);}};}function respondWithFilteredResult(_0x5b9217,_0x4c4539){return function(_0x37950c){if(_0x37950c){var _0x465540=typeof _0x4c4539['offset']==='undefined'&&typeof _0x4c4539[_0x480b('0x1a')]===_0x480b('0x1b');var _0x53b09f=_0x37950c[_0x480b('0x1c')];var _0x8a2bf0=_0x465540?0x0:_0x4c4539[_0x480b('0x1d')];var _0x53cb6c=_0x465540?_0x37950c[_0x480b('0x1c')]:_0x4c4539[_0x480b('0x1d')]+_0x4c4539[_0x480b('0x1a')];var _0x28ba74;if(_0x53cb6c>=_0x53b09f){_0x53cb6c=_0x53b09f;_0x28ba74=0xc8;}else{_0x28ba74=0xce;}_0x5b9217[_0x480b('0x17')](_0x28ba74);return _0x5b9217['set'](_0x480b('0x1e'),_0x8a2bf0+'-'+_0x53cb6c+'/'+_0x53b09f)[_0x480b('0x19')](_0x37950c);}return null;};}function patchUpdates(_0x26cc27){return function(_0x3b14e1){try{jsonpatch[_0x480b('0x1f')](_0x3b14e1,_0x26cc27,!![]);}catch(_0x3cb5db){return BPromise[_0x480b('0x20')](_0x3cb5db);}return _0x3b14e1[_0x480b('0x21')]();};}function saveUpdates(_0x2e3a03,_0x3eb46d){return function(_0x3bbf50){if(_0x3bbf50){return _0x3bbf50[_0x480b('0x22')](_0x2e3a03)[_0x480b('0x23')](function(_0x4f9879){return _0x4f9879;});}return null;};}function removeEntity(_0x5c8306,_0x46230a){return function(_0x4c5ff3){if(_0x4c5ff3){return _0x4c5ff3[_0x480b('0x24')]()['then'](function(){_0x5c8306['status'](0xcc)[_0x480b('0x18')]();});}};}function handleEntityNotFound(_0x8fd0ba,_0x4a1a36){return function(_0x2c1c02){if(!_0x2c1c02){_0x8fd0ba[_0x480b('0x16')](0x194);}return _0x2c1c02;};}function handleError(_0x117890,_0x42d2f8){_0x42d2f8=_0x42d2f8||0x1f4;return function(_0x530025){logger[_0x480b('0x25')](_0x530025[_0x480b('0x26')]);if(_0x530025[_0x480b('0x27')]){delete _0x530025[_0x480b('0x27')];}_0x117890[_0x480b('0x17')](_0x42d2f8)[_0x480b('0x28')](_0x530025);};}exports[_0x480b('0x29')]=function(_0x57258e,_0x59f63a){var _0x104d63={},_0x147f15={},_0x49e0f2={'count':0x0,'rows':[]};var _0x1d26f1=_[_0x480b('0x2a')](db['CmHopper']['rawAttributes'],function(_0xc97150){return{'name':_0xc97150[_0x480b('0x2b')],'type':_0xc97150['type'][_0x480b('0x2c')]};});_0x147f15['model']=_[_0x480b('0x2a')](_0x1d26f1,_0x480b('0x27'));_0x147f15['query']=_[_0x480b('0x2d')](_0x57258e[_0x480b('0x2e')]);_0x147f15['filters']=_[_0x480b('0x2f')](_0x147f15[_0x480b('0x30')],_0x147f15[_0x480b('0x2e')]);_0x147f15[_0x480b('0x31')]=_[_0x480b('0x32')](_0x147f15['filters'],['$and',_0x480b('0x33'),_0x480b('0x34'),'$gte',_0x480b('0x35'),'$lte',_0x480b('0x36'),'$eq',_0x480b('0x37'),_0x480b('0x38'),_0x480b('0x39'),_0x480b('0x3a'),_0x480b('0x3b'),'$like',_0x480b('0x3c'),_0x480b('0x3d'),_0x480b('0x3e'),'$like','$overlap',_0x480b('0x3f'),'$contained',_0x480b('0x40')]);_0x104d63[_0x480b('0x41')]=_[_0x480b('0x2f')](_0x147f15['model'],qs[_0x480b('0x42')](_0x57258e['query'][_0x480b('0x42')]));_0x104d63[_0x480b('0x41')]=_0x104d63['attributes']['length']?_0x104d63[_0x480b('0x41')]:_0x147f15[_0x480b('0x30')];if(!_0x57258e[_0x480b('0x2e')]['hasOwnProperty']('nolimit')){_0x104d63['limit']=qs[_0x480b('0x1a')](_0x57258e['query'][_0x480b('0x1a')]);_0x104d63[_0x480b('0x1d')]=qs[_0x480b('0x1d')](_0x57258e[_0x480b('0x2e')][_0x480b('0x1d')]);}_0x104d63[_0x480b('0x43')]=qs['sort'](_0x57258e[_0x480b('0x2e')][_0x480b('0x44')]);_0x104d63['where']=qs['filters'](_[_0x480b('0x45')](_0x57258e['query'],_0x147f15[_0x480b('0x31')]),_0x1d26f1);if(_0x57258e[_0x480b('0x2e')][_0x480b('0x46')]){_0x104d63[_0x480b('0x47')]=_[_0x480b('0x48')](_0x104d63[_0x480b('0x47')],{'$or':_[_0x480b('0x2a')](_0x1d26f1,function(_0x77245e){if(_0x77245e[_0x480b('0x49')]!=='VIRTUAL'){var _0x528004={};_0x528004[_0x77245e[_0x480b('0x27')]]={'$like':'%'+_0x57258e[_0x480b('0x2e')][_0x480b('0x46')]+'%'};return _0x528004;}})});}_0x104d63=_[_0x480b('0x48')]({},_0x104d63,_0x57258e[_0x480b('0x4a')]);var _0x86dcad={'where':_0x104d63[_0x480b('0x47')]};return db[_0x480b('0x4b')][_0x480b('0x1c')](_0x86dcad)['then'](function(_0x26b926){_0x49e0f2[_0x480b('0x1c')]=_0x26b926;if(_0x57258e[_0x480b('0x2e')]['includeAll']){_0x104d63[_0x480b('0x4c')]=[{'all':!![]}];}return db[_0x480b('0x4b')][_0x480b('0x4d')](_0x104d63);})[_0x480b('0x23')](function(_0x4853ad){_0x49e0f2['rows']=_0x4853ad;return _0x49e0f2;})[_0x480b('0x23')](respondWithFilteredResult(_0x59f63a,_0x104d63))['catch'](handleError(_0x59f63a,null));};exports[_0x480b('0x4e')]=function(_0x4f6eb4,_0x20ab0f){var _0x771ba6={'raw':!![],'where':{'id':_0x4f6eb4[_0x480b('0x4f')]['id']}},_0x46a6c2={};_0x46a6c2[_0x480b('0x30')]=_['keys'](db[_0x480b('0x4b')][_0x480b('0x50')]);_0x46a6c2[_0x480b('0x2e')]=_[_0x480b('0x2d')](_0x4f6eb4[_0x480b('0x2e')]);_0x46a6c2['filters']=_[_0x480b('0x2f')](_0x46a6c2['model'],_0x46a6c2[_0x480b('0x2e')]);_0x771ba6[_0x480b('0x41')]=_[_0x480b('0x2f')](_0x46a6c2[_0x480b('0x30')],qs[_0x480b('0x42')](_0x4f6eb4['query']['fields']));_0x771ba6[_0x480b('0x41')]=_0x771ba6[_0x480b('0x41')][_0x480b('0x51')]?_0x771ba6[_0x480b('0x41')]:_0x46a6c2[_0x480b('0x30')];if(_0x4f6eb4[_0x480b('0x2e')][_0x480b('0x52')]){_0x771ba6[_0x480b('0x4c')]=[{'all':!![]}];}_0x771ba6=_[_0x480b('0x48')]({},_0x771ba6,_0x4f6eb4[_0x480b('0x4a')]);return db[_0x480b('0x4b')][_0x480b('0x53')](_0x771ba6)['then'](handleEntityNotFound(_0x20ab0f,null))[_0x480b('0x23')](respondWithResult(_0x20ab0f,null))[_0x480b('0x54')](handleError(_0x20ab0f,null));};exports[_0x480b('0x55')]=function(_0xf94b0d,_0x2f024f){return db['CmHopper'][_0x480b('0x55')](_0xf94b0d[_0x480b('0x56')],{})[_0x480b('0x23')](respondWithResult(_0x2f024f,0xc9))[_0x480b('0x54')](handleError(_0x2f024f,null));};exports[_0x480b('0x22')]=function(_0x42547f,_0x4ffef3){if(_0x42547f[_0x480b('0x56')]['id']){delete _0x42547f[_0x480b('0x56')]['id'];}return db[_0x480b('0x4b')][_0x480b('0x53')]({'where':{'id':_0x42547f[_0x480b('0x4f')]['id']}})[_0x480b('0x23')](handleEntityNotFound(_0x4ffef3,null))[_0x480b('0x23')](saveUpdates(_0x42547f[_0x480b('0x56')],null))[_0x480b('0x23')](respondWithResult(_0x4ffef3,null))[_0x480b('0x54')](handleError(_0x4ffef3,null));};exports[_0x480b('0x57')]=function(_0x22dbea,_0x2c1d99){return db['CmHopper'][_0x480b('0x57')]()[_0x480b('0x23')](respondWithResult(_0x2c1d99,null))[_0x480b('0x54')](handleError(_0x2c1d99,null));};exports[_0x480b('0x24')]=function(_0x8617d8,_0x247f07){var _0x1382be;return db[_0x480b('0x4b')][_0x480b('0x53')]({'where':{'id':_0x8617d8[_0x480b('0x4f')]['id']}})[_0x480b('0x23')](handleEntityNotFound(_0x247f07,null))[_0x480b('0x23')](function(_0x4b69c9){if(_0x4b69c9){return _0x4b69c9[_0x480b('0x24')]()[_0x480b('0x23')](function(_0x21c45f){return _0x21c45f;});}})[_0x480b('0x23')](function(_0x21adca){_0x1382be=_0x21adca;if(_0x21adca){if(_0x21adca['VoiceQueueId']||_0x21adca[_0x480b('0x58')]){return db[_0x21adca[_0x480b('0x59')]?'VoiceQueue':_0x480b('0x5a')][_0x480b('0x53')]({'where':{'id':_0x21adca[_0x480b('0x59')]?_0x21adca[_0x480b('0x59')]:_0x21adca[_0x480b('0x58')]},'attributes':['id',_0x480b('0x27')],'raw':!![]});}}})['then'](function(_0x26d24f){var _0x345d68={};if(_0x26d24f){_[_0x480b('0x48')](_0x345d68,_[_0x480b('0x5b')](_0x1382be[_0x480b('0x5c')],[_0x480b('0x5d'),_0x480b('0x5e'),'id']));_0x345d68[_0x480b('0x5f')]=0x15;_0x345d68[_0x480b('0x60')]=_0x480b('0x61');_0x345d68[_0x480b('0x62')]=_0x26d24f[_0x480b('0x27')];_0x345d68[_0x480b('0x63')]=_0x8617d8['user'][_0x480b('0x27')];_0x345d68[_0x480b('0x64')]=_0x8617d8[_0x480b('0x65')]['id'];_0x345d68[_0x480b('0x61')]=!![];_0x345d68[_0x480b('0x66')]=moment()[_0x480b('0x67')](_0x480b('0x68'));_0x345d68[_0x480b('0x69')]=_0x1382be['phone'];_0x345d68['campaigntype']=_0x1382be['VoiceQueueId']?'queue':_0x480b('0x6a');return db['CmContact'][_0x480b('0x53')]({'where':{'id':_0x345d68[_0x480b('0x6b')]},'attributes':[_0x480b('0x6c'),'lastName']})[_0x480b('0x23')](function(_0x4f7e53){if(!_[_0x480b('0x6d')](_0x247f07)&&!_['isNil'](_0x4f7e53[_0x480b('0x6c')])){_0x345d68[_0x480b('0x6e')]=_0x4f7e53[_0x480b('0x6c')];if(!_['isNil'](_0x4f7e53[_0x480b('0x6f')])){_0x345d68['calleridname']+='\x20'+_0x4f7e53['lastName'];}}})[_0x480b('0x70')](function(){return db['CmHopperFinal'][_0x480b('0x55')](_0x345d68);});}})[_0x480b('0x23')](function(){return _0x247f07[_0x480b('0x17')](0xcc)[_0x480b('0x18')]();})[_0x480b('0x54')](handleError(_0x247f07,null));};exports[_0x480b('0x71')]=function(_0x4200bf,_0x3db1d3,_0x4c9dff){var _0x5458ba=[];return db['CmContact']['describe']()['then'](function(_0x4598bc){_0x5458ba=_[_0x480b('0x2d')](_0x4598bc);return _0x4200bf[_0x480b('0x65')][_0x480b('0x72')]({'where':{'type':_0x480b('0x73'),'dialActive':!![],'dialMethod':_0x480b('0x74')},'attributes':['id',_0x480b('0x75'),_0x480b('0x76')],'raw':!![]});})[_0x480b('0x23')](function(_0x4a6610){if(_0x4a6610&&_0x4a6610[_0x480b('0x51')]){return db[_0x480b('0x77')]['transaction'](function(_0x59c8db){var _0x1bcb2f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x480b('0x67')](_0x480b('0x68'))},'VoiceQueueId':{'$in':_[_0x480b('0x2a')](_0x4a6610,'id')},'$or':[{'UserId':null},{'UserId':_0x4200bf['user']['id']}]};var _0x5cc74e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4a6610)['filter']([_0x480b('0x76'),0x0])[_0x480b('0x2a')]('id')[_0x480b('0x78')]()},'$or':[{'UserId':null},{'UserId':_0x4200bf['user']['id']}]};var _0x59f5ed={'$or':[_0x1bcb2f,_0x5cc74e]};var _0x11a415=[];if(_0x4200bf['body'][_0x480b('0x79')]&&_0x4200bf[_0x480b('0x56')][_0x480b('0x79')]===_0x480b('0x7a')){if(!_['isEmpty'](_0x4200bf[_0x480b('0x56')][_0x480b('0x7b')])){_0x59f5ed['id']={'$in':_0x4200bf[_0x480b('0x56')]['hopperIds']};}_0x11a415=[[_0x480b('0x7c'),_0x480b('0x7d')],[_0x480b('0x7e'),_0x4a6610[0x0][_0x480b('0x75')]===_0x480b('0x7d')?_0x480b('0x7f'):_0x480b('0x7d')],db['sequelize'][_0x480b('0x80')](_0x480b('0x81')),['id',_0x480b('0x7f')]];}else{if(!_[_0x480b('0x82')](_0x4200bf[_0x480b('0x56')][_0x480b('0x7b')])){_0x59f5ed['id']={'$notIn':_0x4200bf['body'][_0x480b('0x7b')]};}_0x11a415=[['priority',_0x480b('0x7f')],[_0x480b('0x7e'),_0x4a6610[0x0][_0x480b('0x75')]],db[_0x480b('0x77')][_0x480b('0x80')](_0x480b('0x83')),['id',_0x480b('0x7d')]];}return db[_0x480b('0x4b')][_0x480b('0x84')]({'attributes':['id',_0x480b('0x85'),_0x480b('0x86')],'where':_0x59f5ed,'order':_0x11a415,'transaction':_0x59c8db,'lock':_0x59c8db['LOCK'][_0x480b('0x87')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5458ba,'include':[{'model':db[_0x480b('0x88')],'as':_0x480b('0x89'),'attributes':['id',_0x480b('0x27')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x480b('0x27')]},{'model':db['VoiceQueue'],'as':_0x480b('0x8a'),'attributes':['id',_0x480b('0x27'),_0x480b('0x8b')]}]})[_0x480b('0x23')](function(_0x34346c){if(_0x34346c){return _0x34346c['update']({'UserId':_0x4200bf[_0x480b('0x65')]['id']},{'transaction':_0x59c8db});}});});}})[_0x480b('0x23')](handleEntityNotFound(_0x3db1d3,null))[_0x480b('0x23')](respondWithResult(_0x3db1d3,null))[_0x480b('0x54')](handleError(_0x3db1d3,null));};exports['getOpenContacts']=function(_0x97ab53,_0x47b115,_0x39b23d){return _0x97ab53['user'][_0x480b('0x72')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x480b('0x74')},'attributes':['id'],'raw':!![]})[_0x480b('0x23')](function(_0x571934){if(_0x571934&&_0x571934[_0x480b('0x51')]){return db[_0x480b('0x4b')][_0x480b('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x480b('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x571934,'id')},'$or':[{'UserId':null},{'UserId':_0x97ab53['user']['id']}]}});}return 0x0;})[_0x480b('0x23')](function(_0x1756a1){if(!_['isNil'](_0x1756a1)&&_['isNumber'](_0x1756a1)){return _0x47b115[_0x480b('0x17')](0xc8)[_0x480b('0x19')]({'contacts':_0x1756a1});}else{logger[_0x480b('0x25')](_0x480b('0x8c'),_0x480b('0x8d'),0x194,_0x480b('0x8e'));_0x47b115[_0x480b('0x16')](0x194);}})['catch'](handleError(_0x47b115,null));}; \ No newline at end of file +var _0x0b13=['user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','getVoiceQueues','outbound','dialPreviewAutoRecallMe','sequelize','transaction','value','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','getOpenContacts','preview','json','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','$and','$or','$gt','$gte','$lt','$ne','$eq','$notBetween','$in','$notIn','$like','$iLike','$contained','$any','attributes','fields','nolimit','where','pick','merge','VIRTUAL','filter','CmHopper','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername'];(function(_0x5cdeba,_0x3a8713){var _0x15df83=function(_0x5f4719){while(--_0x5f4719){_0x5cdeba['push'](_0x5cdeba['shift']());}};_0x15df83(++_0x3a8713);}(_0x0b13,0x150));var _0x30b1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0b13[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x30b1('0x0'));var rimraf=require(_0x30b1('0x1'));var zipdir=require(_0x30b1('0x2'));var jsonpatch=require(_0x30b1('0x3'));var rp=require(_0x30b1('0x4'));var moment=require(_0x30b1('0x5'));var BPromise=require(_0x30b1('0x6'));var Mustache=require(_0x30b1('0x7'));var util=require(_0x30b1('0x8'));var path=require(_0x30b1('0x9'));var sox=require(_0x30b1('0xa'));var csv=require(_0x30b1('0xb'));var ejs=require(_0x30b1('0xc'));var fs=require('fs');var fs_extra=require(_0x30b1('0xd'));var _=require(_0x30b1('0xe'));var squel=require(_0x30b1('0xf'));var crypto=require(_0x30b1('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x30b1('0x11'));var toCsv=require(_0x30b1('0xb'));var querystring=require(_0x30b1('0x12'));var Papa=require(_0x30b1('0x13'));var Redis=require(_0x30b1('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x30b1('0x15'));var as=require(_0x30b1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x30b1('0x17'));var utils=require(_0x30b1('0x18'));var config=require(_0x30b1('0x19'));var licenseUtil=require(_0x30b1('0x1a'));var db=require(_0x30b1('0x1b'))['db'];function respondWithStatusCode(_0x2a17d8,_0x2bd1f2){_0x2bd1f2=_0x2bd1f2||0xcc;return function(_0x19f069){if(_0x19f069){return _0x2a17d8[_0x30b1('0x1c')](_0x2bd1f2);}return _0x2a17d8[_0x30b1('0x1d')](_0x2bd1f2)[_0x30b1('0x1e')]();};}function respondWithResult(_0x166d92,_0x39c3f3){_0x39c3f3=_0x39c3f3||0xc8;return function(_0x546e1f){if(_0x546e1f){return _0x166d92[_0x30b1('0x1d')](_0x39c3f3)['json'](_0x546e1f);}};}function respondWithFilteredResult(_0x812ee3,_0xdb8da4){return function(_0x290c89){if(_0x290c89){var _0x1bc890=typeof _0xdb8da4[_0x30b1('0x1f')]===_0x30b1('0x20')&&typeof _0xdb8da4[_0x30b1('0x21')]===_0x30b1('0x20');var _0x417f3b=_0x290c89[_0x30b1('0x22')];var _0x1666cb=_0x1bc890?0x0:_0xdb8da4[_0x30b1('0x1f')];var _0x1ef404=_0x1bc890?_0x290c89[_0x30b1('0x22')]:_0xdb8da4[_0x30b1('0x1f')]+_0xdb8da4['limit'];var _0x273f05;if(_0x1ef404>=_0x417f3b){_0x1ef404=_0x417f3b;_0x273f05=0xc8;}else{_0x273f05=0xce;}_0x812ee3[_0x30b1('0x1d')](_0x273f05);return _0x812ee3['set'](_0x30b1('0x23'),_0x1666cb+'-'+_0x1ef404+'/'+_0x417f3b)['json'](_0x290c89);}return null;};}function patchUpdates(_0x771cbd){return function(_0xbeae78){try{jsonpatch[_0x30b1('0x24')](_0xbeae78,_0x771cbd,!![]);}catch(_0xad9931){return BPromise['reject'](_0xad9931);}return _0xbeae78[_0x30b1('0x25')]();};}function saveUpdates(_0xe36387,_0xb2ceec){return function(_0x495320){if(_0x495320){return _0x495320[_0x30b1('0x26')](_0xe36387)[_0x30b1('0x27')](function(_0x3dfeb4){return _0x3dfeb4;});}return null;};}function removeEntity(_0x204d1a,_0xee69ea){return function(_0x3324aa){if(_0x3324aa){return _0x3324aa[_0x30b1('0x28')]()[_0x30b1('0x27')](function(){_0x204d1a[_0x30b1('0x1d')](0xcc)[_0x30b1('0x1e')]();});}};}function handleEntityNotFound(_0x24b468,_0x538997){return function(_0x34126d){if(!_0x34126d){_0x24b468['sendStatus'](0x194);}return _0x34126d;};}function handleError(_0x2c125d,_0x1a4378){_0x1a4378=_0x1a4378||0x1f4;return function(_0x1064a0){logger[_0x30b1('0x29')](_0x1064a0[_0x30b1('0x2a')]);if(_0x1064a0[_0x30b1('0x2b')]){delete _0x1064a0[_0x30b1('0x2b')];}_0x2c125d['status'](_0x1a4378)[_0x30b1('0x2c')](_0x1064a0);};}exports[_0x30b1('0x2d')]=function(_0x5a0e6b,_0x111ef9){var _0x56876d={},_0x21500f={},_0x32f6c4={'count':0x0,'rows':[]};var _0x509b29=_[_0x30b1('0x2e')](db['CmHopper']['rawAttributes'],function(_0x50324e){return{'name':_0x50324e[_0x30b1('0x2f')],'type':_0x50324e[_0x30b1('0x30')][_0x30b1('0x31')]};});_0x21500f[_0x30b1('0x32')]=_[_0x30b1('0x2e')](_0x509b29,_0x30b1('0x2b'));_0x21500f[_0x30b1('0x33')]=_['keys'](_0x5a0e6b[_0x30b1('0x33')]);_0x21500f[_0x30b1('0x34')]=_[_0x30b1('0x35')](_0x21500f[_0x30b1('0x32')],_0x21500f[_0x30b1('0x33')]);_0x21500f[_0x30b1('0x34')]=_['concat'](_0x21500f[_0x30b1('0x34')],[_0x30b1('0x36'),_0x30b1('0x37'),_0x30b1('0x38'),_0x30b1('0x39'),_0x30b1('0x3a'),'$lte',_0x30b1('0x3b'),_0x30b1('0x3c'),'$not','$between',_0x30b1('0x3d'),_0x30b1('0x3e'),_0x30b1('0x3f'),_0x30b1('0x40'),'$notLike',_0x30b1('0x41'),'$notILike','$like','$overlap','$contains',_0x30b1('0x42'),_0x30b1('0x43')]);_0x56876d[_0x30b1('0x44')]=_[_0x30b1('0x35')](_0x21500f[_0x30b1('0x32')],qs[_0x30b1('0x45')](_0x5a0e6b['query']['fields']));_0x56876d['attributes']=_0x56876d[_0x30b1('0x44')]['length']?_0x56876d['attributes']:_0x21500f[_0x30b1('0x32')];if(!_0x5a0e6b[_0x30b1('0x33')]['hasOwnProperty'](_0x30b1('0x46'))){_0x56876d[_0x30b1('0x21')]=qs[_0x30b1('0x21')](_0x5a0e6b[_0x30b1('0x33')][_0x30b1('0x21')]);_0x56876d['offset']=qs[_0x30b1('0x1f')](_0x5a0e6b[_0x30b1('0x33')][_0x30b1('0x1f')]);}_0x56876d['order']=qs['sort'](_0x5a0e6b[_0x30b1('0x33')]['sort']);_0x56876d[_0x30b1('0x47')]=qs[_0x30b1('0x34')](_[_0x30b1('0x48')](_0x5a0e6b['query'],_0x21500f[_0x30b1('0x34')]),_0x509b29);if(_0x5a0e6b[_0x30b1('0x33')]['filter']){_0x56876d[_0x30b1('0x47')]=_[_0x30b1('0x49')](_0x56876d[_0x30b1('0x47')],{'$or':_[_0x30b1('0x2e')](_0x509b29,function(_0xaa6ac3){if(_0xaa6ac3[_0x30b1('0x30')]!==_0x30b1('0x4a')){var _0x3b8243={};_0x3b8243[_0xaa6ac3[_0x30b1('0x2b')]]={'$like':'%'+_0x5a0e6b[_0x30b1('0x33')][_0x30b1('0x4b')]+'%'};return _0x3b8243;}})});}_0x56876d=_[_0x30b1('0x49')]({},_0x56876d,_0x5a0e6b['options']);var _0x62c2c9={'where':_0x56876d[_0x30b1('0x47')]};return db[_0x30b1('0x4c')][_0x30b1('0x22')](_0x62c2c9)[_0x30b1('0x27')](function(_0x18f9f6){_0x32f6c4['count']=_0x18f9f6;if(_0x5a0e6b['query'][_0x30b1('0x4d')]){_0x56876d[_0x30b1('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x30b1('0x4f')](_0x56876d);})[_0x30b1('0x27')](function(_0x4dc2c2){_0x32f6c4[_0x30b1('0x50')]=_0x4dc2c2;return _0x32f6c4;})[_0x30b1('0x27')](respondWithFilteredResult(_0x111ef9,_0x56876d))['catch'](handleError(_0x111ef9,null));};exports[_0x30b1('0x51')]=function(_0x48f2b7,_0x5b55a1){var _0x5d1bdc={'raw':!![],'where':{'id':_0x48f2b7[_0x30b1('0x52')]['id']}},_0x2e955f={};_0x2e955f[_0x30b1('0x32')]=_[_0x30b1('0x53')](db[_0x30b1('0x4c')]['rawAttributes']);_0x2e955f[_0x30b1('0x33')]=_[_0x30b1('0x53')](_0x48f2b7[_0x30b1('0x33')]);_0x2e955f[_0x30b1('0x34')]=_[_0x30b1('0x35')](_0x2e955f[_0x30b1('0x32')],_0x2e955f[_0x30b1('0x33')]);_0x5d1bdc[_0x30b1('0x44')]=_[_0x30b1('0x35')](_0x2e955f['model'],qs[_0x30b1('0x45')](_0x48f2b7[_0x30b1('0x33')]['fields']));_0x5d1bdc[_0x30b1('0x44')]=_0x5d1bdc[_0x30b1('0x44')][_0x30b1('0x54')]?_0x5d1bdc[_0x30b1('0x44')]:_0x2e955f[_0x30b1('0x32')];if(_0x48f2b7['query'][_0x30b1('0x4d')]){_0x5d1bdc['include']=[{'all':!![]}];}_0x5d1bdc=_[_0x30b1('0x49')]({},_0x5d1bdc,_0x48f2b7[_0x30b1('0x55')]);return db['CmHopper'][_0x30b1('0x56')](_0x5d1bdc)['then'](handleEntityNotFound(_0x5b55a1,null))[_0x30b1('0x27')](respondWithResult(_0x5b55a1,null))[_0x30b1('0x57')](handleError(_0x5b55a1,null));};exports[_0x30b1('0x58')]=function(_0x327505,_0x5be16e){return db[_0x30b1('0x4c')][_0x30b1('0x58')](_0x327505['body'],{})[_0x30b1('0x27')](respondWithResult(_0x5be16e,0xc9))[_0x30b1('0x57')](handleError(_0x5be16e,null));};exports[_0x30b1('0x26')]=function(_0x22c528,_0x58fb7d){if(_0x22c528[_0x30b1('0x59')]['id']){delete _0x22c528['body']['id'];}return db[_0x30b1('0x4c')][_0x30b1('0x56')]({'where':{'id':_0x22c528[_0x30b1('0x52')]['id']}})[_0x30b1('0x27')](handleEntityNotFound(_0x58fb7d,null))['then'](saveUpdates(_0x22c528[_0x30b1('0x59')],null))[_0x30b1('0x27')](respondWithResult(_0x58fb7d,null))[_0x30b1('0x57')](handleError(_0x58fb7d,null));};exports[_0x30b1('0x5a')]=function(_0x203f18,_0x1120df){return db[_0x30b1('0x4c')][_0x30b1('0x5a')]()[_0x30b1('0x27')](respondWithResult(_0x1120df,null))[_0x30b1('0x57')](handleError(_0x1120df,null));};exports[_0x30b1('0x28')]=function(_0x2aca10,_0x5cc709){var _0x3d20a2;return db['CmHopper']['find']({'where':{'id':_0x2aca10[_0x30b1('0x52')]['id']}})[_0x30b1('0x27')](handleEntityNotFound(_0x5cc709,null))[_0x30b1('0x27')](function(_0x3c3a18){if(_0x3c3a18){return _0x3c3a18[_0x30b1('0x28')]()[_0x30b1('0x27')](function(_0x4de64f){return _0x4de64f;});}})[_0x30b1('0x27')](function(_0x19947c){_0x3d20a2=_0x19947c;if(_0x19947c){if(_0x19947c[_0x30b1('0x5b')]||_0x19947c[_0x30b1('0x5c')]){return db[_0x19947c['VoiceQueueId']?_0x30b1('0x5d'):'Campaign'][_0x30b1('0x56')]({'where':{'id':_0x19947c[_0x30b1('0x5b')]?_0x19947c['VoiceQueueId']:_0x19947c['CampaignId']},'attributes':['id',_0x30b1('0x2b')],'raw':!![]});}}})[_0x30b1('0x27')](function(_0x50734c){var _0x2bec2b={};if(_0x50734c){_[_0x30b1('0x49')](_0x2bec2b,_[_0x30b1('0x5e')](_0x3d20a2[_0x30b1('0x5f')],[_0x30b1('0x60'),_0x30b1('0x61'),'id']));_0x2bec2b[_0x30b1('0x62')]=0x15;_0x2bec2b['statedesc']=_0x30b1('0x63');_0x2bec2b[_0x30b1('0x64')]=_0x50734c[_0x30b1('0x2b')];_0x2bec2b[_0x30b1('0x65')]=_0x2aca10[_0x30b1('0x66')][_0x30b1('0x2b')];_0x2bec2b['UserId']=_0x2aca10['user']['id'];_0x2bec2b['deleted']=!![];_0x2bec2b[_0x30b1('0x67')]=moment()[_0x30b1('0x68')](_0x30b1('0x69'));_0x2bec2b[_0x30b1('0x6a')]=_0x3d20a2['phone'];_0x2bec2b[_0x30b1('0x6b')]=_0x3d20a2[_0x30b1('0x5b')]?_0x30b1('0x6c'):_0x30b1('0x6d');return db['CmContact'][_0x30b1('0x56')]({'where':{'id':_0x2bec2b[_0x30b1('0x6e')]},'attributes':[_0x30b1('0x6f'),_0x30b1('0x70')]})[_0x30b1('0x27')](function(_0x5c9d9c){if(!_[_0x30b1('0x71')](_0x5cc709)&&!_[_0x30b1('0x71')](_0x5c9d9c['firstName'])){_0x2bec2b[_0x30b1('0x72')]=_0x5c9d9c[_0x30b1('0x6f')];if(!_[_0x30b1('0x71')](_0x5c9d9c[_0x30b1('0x70')])){_0x2bec2b[_0x30b1('0x72')]+='\x20'+_0x5c9d9c[_0x30b1('0x70')];}}})[_0x30b1('0x73')](function(){return db[_0x30b1('0x74')]['create'](_0x2bec2b);});}})[_0x30b1('0x27')](function(){return _0x5cc709[_0x30b1('0x1d')](0xcc)[_0x30b1('0x1e')]();})[_0x30b1('0x57')](handleError(_0x5cc709,null));};exports['getPreview']=function(_0x1b7b9f,_0x4c3a2e,_0x118b08){var _0x1a451a=[];return db[_0x30b1('0x75')][_0x30b1('0x5a')]()[_0x30b1('0x27')](function(_0x491e49){_0x1a451a=_['keys'](_0x491e49);return _0x1b7b9f[_0x30b1('0x66')][_0x30b1('0x76')]({'where':{'type':_0x30b1('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x30b1('0x78')],'raw':!![]});})['then'](function(_0x331438){if(_0x331438&&_0x331438['length']){return db[_0x30b1('0x79')][_0x30b1('0x7a')](function(_0x12a879){var _0x1fef99={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x30b1('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x30b1('0x2e')](_0x331438,'id')},'$or':[{'UserId':null},{'UserId':_0x1b7b9f[_0x30b1('0x66')]['id']}]};var _0x5a2210={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x331438)[_0x30b1('0x4b')]([_0x30b1('0x78'),0x0])[_0x30b1('0x2e')]('id')[_0x30b1('0x7b')]()},'$or':[{'UserId':null},{'UserId':_0x1b7b9f[_0x30b1('0x66')]['id']}]};var _0x19cd54={'$or':[_0x1fef99,_0x5a2210]};var _0xdd41d=[];if(_0x1b7b9f['body']['direction']&&_0x1b7b9f[_0x30b1('0x59')]['direction']==='prev'){if(!_[_0x30b1('0x7c')](_0x1b7b9f[_0x30b1('0x59')][_0x30b1('0x7d')])){_0x19cd54['id']={'$in':_0x1b7b9f[_0x30b1('0x59')][_0x30b1('0x7d')]};}_0xdd41d=[[_0x30b1('0x7e'),_0x30b1('0x7f')],['scheduledAt',_0x331438[0x0][_0x30b1('0x80')]==='ASC'?_0x30b1('0x81'):_0x30b1('0x7f')],db['sequelize'][_0x30b1('0x82')](_0x30b1('0x83')),['id',_0x30b1('0x81')]];}else{if(!_[_0x30b1('0x7c')](_0x1b7b9f['body'][_0x30b1('0x7d')])){_0x19cd54['id']={'$notIn':_0x1b7b9f[_0x30b1('0x59')][_0x30b1('0x7d')]};}_0xdd41d=[[_0x30b1('0x7e'),_0x30b1('0x81')],['scheduledAt',_0x331438[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x30b1('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper'][_0x30b1('0x84')]({'attributes':['id',_0x30b1('0x85'),_0x30b1('0x86')],'where':_0x19cd54,'order':_0xdd41d,'transaction':_0x12a879,'lock':_0x12a879[_0x30b1('0x87')][_0x30b1('0x88')],'include':[{'model':db[_0x30b1('0x75')],'as':_0x30b1('0x89'),'attributes':_0x1a451a,'include':[{'model':db[_0x30b1('0x8a')],'as':_0x30b1('0x8b'),'attributes':['id',_0x30b1('0x2b')]}]},{'model':db['CmList'],'as':_0x30b1('0x8c'),'attributes':['id',_0x30b1('0x2b')]},{'model':db['VoiceQueue'],'as':_0x30b1('0x8d'),'attributes':['id','name','dialActive']}]})['then'](function(_0x1876dc){if(_0x1876dc){return _0x1876dc[_0x30b1('0x26')]({'UserId':_0x1b7b9f[_0x30b1('0x66')]['id']},{'transaction':_0x12a879});}});});}})['then'](handleEntityNotFound(_0x4c3a2e,null))[_0x30b1('0x27')](respondWithResult(_0x4c3a2e,null))[_0x30b1('0x57')](handleError(_0x4c3a2e,null));};exports[_0x30b1('0x8e')]=function(_0xdf15b2,_0x46403c,_0x338ce5){return _0xdf15b2[_0x30b1('0x66')][_0x30b1('0x76')]({'where':{'type':_0x30b1('0x77'),'dialActive':!![],'dialMethod':_0x30b1('0x8f')},'attributes':['id'],'raw':!![]})[_0x30b1('0x27')](function(_0x57db7b){if(_0x57db7b&&_0x57db7b[_0x30b1('0x54')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x30b1('0x68')](_0x30b1('0x69'))},'VoiceQueueId':{'$in':_[_0x30b1('0x2e')](_0x57db7b,'id')},'$or':[{'UserId':null},{'UserId':_0xdf15b2['user']['id']}]}});}return 0x0;})[_0x30b1('0x27')](function(_0x3514c6){if(!_['isNil'](_0x3514c6)&&_['isNumber'](_0x3514c6)){return _0x46403c['status'](0xc8)[_0x30b1('0x90')]({'contacts':_0x3514c6});}else{logger[_0x30b1('0x29')](_0x30b1('0x91'),_0x30b1('0x8e'),0x194,'entity\x20not\x20found');_0x46403c[_0x30b1('0x1c')](0x194);}})[_0x30b1('0x57')](handleError(_0x46403c,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 28c453e..29c0df5 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687b,0x14a));var _0xb687=function(_0x450b2a,_0x174591){_0x450b2a=_0x450b2a-0x0;var _0x37a7ff=_0x687b[_0x450b2a];return _0x37a7ff;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4ce175,_0x42edb3){var _0x53ba2e=function(_0x305edd){while(--_0x305edd){_0x4ce175['push'](_0x4ce175['shift']());}};_0x53ba2e(++_0x42edb3);}(_0x1261,0x144));var _0x1126=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x1261[_0x21b762];return _0x2ea6d4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index eef648f..3129f53 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 _0x3093=['update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','length','UserId','push','body','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','describe','order','GetContactRecallMe','GetCmHopperPreview','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','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','attributes','limit','map','include','model','then','ShowCmHopper','create','CreateCmHopper','UpdateCmHopper'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x3093,0x1aa));var _0x3309=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3093[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3309('0x0'));var util=require('util');var moment=require(_0x3309('0x1'));var BPromise=require(_0x3309('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3309('0x3'))['db'];var utils=require(_0x3309('0x4'));var logger=require(_0x3309('0x5'))(_0x3309('0x6'));var config=require('../../config/environment');var jayson=require(_0x3309('0x7'));var client=jayson['client'][_0x3309('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eef39,_0x2fa5e3,_0x4b4dc9){return new BPromise(function(_0x586f9c,_0x97fadf){return client[_0x3309('0x9')](_0x3eef39,_0x4b4dc9)['then'](function(_0x1d1208){logger[_0x3309('0xa')](_0x3309('0xb'),_0x2fa5e3,_0x3309('0xc'));logger[_0x3309('0xd')](_0x3309('0xe'),_0x2fa5e3,'request\x20sent',JSON[_0x3309('0xf')](_0x1d1208));if(_0x1d1208['error']){if(_0x1d1208[_0x3309('0x10')]['code']===0x1f4){logger[_0x3309('0x10')](_0x3309('0xb'),_0x2fa5e3,_0x1d1208[_0x3309('0x10')][_0x3309('0x11')]);return _0x97fadf(_0x1d1208[_0x3309('0x10')][_0x3309('0x11')]);}logger[_0x3309('0x10')](_0x3309('0xb'),_0x2fa5e3,_0x1d1208[_0x3309('0x10')][_0x3309('0x11')]);return _0x586f9c(_0x1d1208[_0x3309('0x10')]['message']);}else{logger['info'](_0x3309('0xb'),_0x2fa5e3,'request\x20sent');_0x586f9c(_0x1d1208[_0x3309('0x12')][_0x3309('0x11')]);}})[_0x3309('0x13')](function(_0x6cb8e9){logger[_0x3309('0x10')](_0x3309('0xb'),_0x2fa5e3,_0x6cb8e9);_0x97fadf(_0x6cb8e9);});});}exports[_0x3309('0x14')]=function(_0x2c90dd){var _0x329a43=this;return new Promise(function(_0x42eb62,_0x461b14){return db[_0x3309('0x15')][_0x3309('0x16')]({'raw':_0x2c90dd[_0x3309('0x17')]?_0x2c90dd[_0x3309('0x17')][_0x3309('0x18')]===undefined?!![]:![]:!![],'where':_0x2c90dd[_0x3309('0x17')]?_0x2c90dd[_0x3309('0x17')][_0x3309('0x19')]||null:null,'attributes':_0x2c90dd[_0x3309('0x17')]?_0x2c90dd[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'limit':_0x2c90dd[_0x3309('0x17')]?_0x2c90dd[_0x3309('0x17')][_0x3309('0x1b')]||null:null,'include':_0x2c90dd['options']?_0x2c90dd[_0x3309('0x17')]['include']?_[_0x3309('0x1c')](_0x2c90dd[_0x3309('0x17')]['include'],function(_0x31dddc){return{'model':db[_0x31dddc['model']],'as':_0x31dddc['as'],'attributes':_0x31dddc[_0x3309('0x1a')],'include':_0x31dddc[_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x31dddc[_0x3309('0x1d')],function(_0x4da07f){return{'model':db[_0x4da07f[_0x3309('0x1e')]],'as':_0x4da07f['as'],'attributes':_0x4da07f[_0x3309('0x1a')],'include':_0x4da07f[_0x3309('0x1d')]?_['map'](_0x4da07f[_0x3309('0x1d')],function(_0x5b3efa){return{'model':db[_0x5b3efa['model']],'as':_0x5b3efa['as'],'attributes':_0x5b3efa[_0x3309('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3309('0x1f')](function(_0x423cd5){logger['info'](_0x3309('0x14'),_0x2c90dd);logger['debug']('GetCmHopper',_0x2c90dd,JSON[_0x3309('0xf')](_0x423cd5));_0x42eb62(_0x423cd5);})[_0x3309('0x13')](function(_0x1ffae8){logger['error'](_0x3309('0x14'),_0x1ffae8[_0x3309('0x11')],_0x2c90dd);_0x461b14(_0x329a43['error'](0x1f4,_0x1ffae8[_0x3309('0x11')]));});});};exports[_0x3309('0x20')]=function(_0xf7b93b){var _0x412f3f=this;return new Promise(function(_0x22fd5a,_0x407fdc){return db['CmHopper']['find']({'raw':_0xf7b93b[_0x3309('0x17')]?_0xf7b93b[_0x3309('0x17')][_0x3309('0x18')]===undefined?!![]:![]:!![],'where':_0xf7b93b[_0x3309('0x17')]?_0xf7b93b[_0x3309('0x17')][_0x3309('0x19')]||null:null,'attributes':_0xf7b93b[_0x3309('0x17')]?_0xf7b93b[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'include':_0xf7b93b[_0x3309('0x17')]?_0xf7b93b[_0x3309('0x17')][_0x3309('0x1d')]?_[_0x3309('0x1c')](_0xf7b93b['options'][_0x3309('0x1d')],function(_0x1b51a6){return{'model':db[_0x1b51a6[_0x3309('0x1e')]],'as':_0x1b51a6['as'],'attributes':_0x1b51a6[_0x3309('0x1a')],'include':_0x1b51a6[_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x1b51a6[_0x3309('0x1d')],function(_0x131123){return{'model':db[_0x131123['model']],'as':_0x131123['as'],'attributes':_0x131123[_0x3309('0x1a')],'include':_0x131123[_0x3309('0x1d')]?_['map'](_0x131123['include'],function(_0x38da67){return{'model':db[_0x38da67[_0x3309('0x1e')]],'as':_0x38da67['as'],'attributes':_0x38da67[_0x3309('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3309('0x1f')](function(_0x3b7231){logger[_0x3309('0xa')]('ShowCmHopper',_0xf7b93b);logger[_0x3309('0xd')](_0x3309('0x20'),_0xf7b93b,JSON[_0x3309('0xf')](_0x3b7231));_0x22fd5a(_0x3b7231);})[_0x3309('0x13')](function(_0x4bca68){logger['error'](_0x3309('0x20'),_0x4bca68[_0x3309('0x11')],_0xf7b93b);_0x407fdc(_0x412f3f['error'](0x1f4,_0x4bca68[_0x3309('0x11')]));});});};exports['CreateCmHopper']=function(_0x399c4c){var _0x43905c=this;return new Promise(function(_0x3f8d7d,_0x48fa42){return db['CmHopper'][_0x3309('0x21')](_0x399c4c['body'],{'raw':_0x399c4c[_0x3309('0x17')]?_0x399c4c[_0x3309('0x17')][_0x3309('0x18')]===undefined?!![]:![]:!![]})[_0x3309('0x1f')](function(_0x470bd4){logger[_0x3309('0xa')](_0x3309('0x22'),_0x399c4c);logger[_0x3309('0xd')](_0x3309('0x22'),_0x399c4c,JSON['stringify'](_0x470bd4));_0x3f8d7d(_0x470bd4);})[_0x3309('0x13')](function(_0x89616d){logger['error']('CreateCmHopper',_0x89616d[_0x3309('0x11')],_0x399c4c);_0x48fa42(_0x43905c[_0x3309('0x10')](0x1f4,_0x89616d[_0x3309('0x11')]));});});};exports[_0x3309('0x23')]=function(_0x347976){var _0xfff2f4=this;return new Promise(function(_0x7a77b8,_0x11e28f){return db[_0x3309('0x15')][_0x3309('0x24')](_0x347976['body'],{'raw':_0x347976['options']?_0x347976['options'][_0x3309('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347976[_0x3309('0x17')]?_0x347976[_0x3309('0x17')][_0x3309('0x19')]||null:null,'attributes':_0x347976['options']?_0x347976[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'limit':_0x347976[_0x3309('0x17')]?_0x347976[_0x3309('0x17')]['limit']||null:null})['then'](function(_0x1c0346){logger[_0x3309('0xa')](_0x3309('0x23'),_0x347976);logger[_0x3309('0xd')](_0x3309('0x23'),_0x347976,JSON['stringify'](_0x1c0346));_0x7a77b8(_0x1c0346);})[_0x3309('0x13')](function(_0x5bcfa7){logger['error'](_0x3309('0x23'),_0x5bcfa7[_0x3309('0x11')],_0x347976);_0x11e28f(_0xfff2f4[_0x3309('0x10')](0x1f4,_0x5bcfa7[_0x3309('0x11')]));});});};exports[_0x3309('0x25')]=function(_0x437d46){var _0x42ae97=this;return new Promise(function(_0x306e2f,_0x37acab){return db[_0x3309('0x15')][_0x3309('0x26')]({'where':_0x437d46[_0x3309('0x17')]?_0x437d46[_0x3309('0x17')]['where']||null:null})[_0x3309('0x1f')](function(_0x2a0f1d){logger[_0x3309('0xa')](_0x3309('0x25'),_0x437d46);logger[_0x3309('0xd')](_0x3309('0x25'),_0x437d46,JSON['stringify'](_0x2a0f1d));_0x306e2f(_0x2a0f1d);})[_0x3309('0x13')](function(_0x7a2bea){logger['error'](_0x3309('0x25'),_0x7a2bea[_0x3309('0x11')],_0x437d46);_0x37acab(_0x42ae97[_0x3309('0x10')](0x1f4,_0x7a2bea[_0x3309('0x11')]));});});};exports[_0x3309('0x27')]=function(_0x1449ce){var _0x5cbe07=this;return new Promise(function(_0x30e8c1,_0x3aa2ec){return db[_0x3309('0x28')]['describe']()['then'](function(_0x2b2051){return db[_0x3309('0x29')][_0x3309('0x2a')](function(_0x37a689){return db['CmHopper'][_0x3309('0x16')]({'where':_0x1449ce[_0x3309('0x17')]?_0x1449ce['options'][_0x3309('0x19')]||null:null,'attributes':_0x1449ce[_0x3309('0x17')]?_0x1449ce[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'limit':_0x1449ce[_0x3309('0x17')]?_0x1449ce[_0x3309('0x17')]['limit']||null:null,'order':_0x1449ce[_0x3309('0x17')]?_0x1449ce[_0x3309('0x17')]['order']||null:null,'transaction':_0x37a689,'lock':_0x37a689[_0x3309('0x2b')][_0x3309('0x2c')],'include':[{'model':db[_0x3309('0x28')],'as':_0x3309('0x2d'),'attributes':_[_0x3309('0x2e')](_0x2b2051)},{'model':db[_0x3309('0x2f')],'as':_0x3309('0x30'),'attributes':['id','name','voicePause']}]})[_0x3309('0x1f')](function(_0x2bf55f){var _0x32f52b=[];var _0xb18dea=[];for(var _0x497a94=0x0;_0x497a94<_0x2bf55f[_0x3309('0x31')];_0x497a94+=0x1){var _0x1d531f=_0x2bf55f[_0x497a94][_0x3309('0x32')];if(_0x1d531f===null){_0x32f52b[_0x3309('0x33')](_0x2bf55f[_0x497a94][_0x3309('0x24')](_0x1449ce[_0x3309('0x34')],{'transaction':_0x37a689}));}else if(!_0xb18dea['includes'](_0x1d531f)){_0xb18dea[_0x3309('0x33')](_0x1d531f);_0x32f52b[_0x3309('0x33')](_0x2bf55f[_0x497a94][_0x3309('0x24')](_0x1449ce[_0x3309('0x34')],{'transaction':_0x37a689}));}}return BPromise['all'](_0x32f52b);});})[_0x3309('0x1f')](function(_0x384fc7){logger[_0x3309('0xa')](_0x3309('0x27'),_0x1449ce);logger[_0x3309('0xd')]('GetContactDialer',_0x1449ce,JSON['stringify'](_0x384fc7));_0x30e8c1(_0x384fc7);})[_0x3309('0x13')](function(_0x490fe3){logger[_0x3309('0x10')](_0x3309('0x27'),_0x490fe3[_0x3309('0x11')],_0x1449ce);_0x3aa2ec(_0x5cbe07['error'](0x1f4,_0x490fe3[_0x3309('0x11')]));});});});};exports[_0x3309('0x35')]=function(_0x2a314c){var _0x142790=this;return new Promise(function(_0x46bbf5,_0x22a0f5){return db['sequelize']['transaction'](function(_0x3b7ef3){return db[_0x3309('0x36')][_0x3309('0x21')](_0x2a314c[_0x3309('0x34')],{'raw':_0x2a314c[_0x3309('0x17')]?_0x2a314c[_0x3309('0x17')][_0x3309('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3b7ef3})[_0x3309('0x1f')](function(){return db[_0x3309('0x15')][_0x3309('0x26')]({'where':_0x2a314c[_0x3309('0x17')]?_0x2a314c[_0x3309('0x17')][_0x3309('0x19')]||null:null,'transaction':_0x3b7ef3});});})[_0x3309('0x1f')](function(_0x1b33a4){logger[_0x3309('0xa')](_0x3309('0x35'),_0x2a314c);logger['debug'](_0x3309('0x35'),_0x2a314c,JSON['stringify'](_0x1b33a4));_0x46bbf5(_0x1b33a4);})['catch'](function(_0xf764d5){logger[_0x3309('0x10')](_0x3309('0x35'),_0xf764d5[_0x3309('0x11')],_0x2a314c);_0x22a0f5(_0x142790[_0x3309('0x10')](0x1f4,_0xf764d5[_0x3309('0x11')]));});});};exports[_0x3309('0x37')]=function(_0x2f0a39){var _0x346e73=this;return new Promise(function(_0x10e7f8,_0x2c68c1){return db[_0x3309('0x15')][_0x3309('0x16')]({'raw':_0x2f0a39[_0x3309('0x17')]?_0x2f0a39['options'][_0x3309('0x18')]===undefined?!![]:![]:!![],'where':_0x2f0a39[_0x3309('0x17')]?_0x2f0a39['options'][_0x3309('0x19')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x3309('0x29')]['fn']('IF',db[_0x3309('0x29')][_0x3309('0x38')](_0x3309('0x39')+util[_0x3309('0x3a')](_0x3309('0x3b'),moment()[_0x3309('0x3a')](_0x3309('0x3c')))+'\x20,\x201,\x20null'))),_0x3309('0x3d')]]})[_0x3309('0x1f')](function(_0x3c9a9c){logger['info']('CountReScheduled',_0x2f0a39);logger[_0x3309('0xd')]('CountReScheduled',_0x2f0a39,JSON[_0x3309('0xf')](_0x3c9a9c));_0x10e7f8(_0x3c9a9c);})[_0x3309('0x13')](function(_0x2e43d7){logger[_0x3309('0x10')]('CountReScheduled',_0x2e43d7['message'],_0x2f0a39);_0x2c68c1(_0x346e73[_0x3309('0x10')](0x1f4,_0x2e43d7[_0x3309('0x11')]));});});};exports['GetContactRecallMe']=function(_0x5b99ad){var _0x52f9f5=this;return new Promise(function(_0x4c4986,_0x2b4a7f){return db[_0x3309('0x28')][_0x3309('0x3e')]()['then'](function(_0x19a140){return db['sequelize']['transaction'](function(_0x2dd138){return db['CmHopper'][_0x3309('0x16')]({'where':_0x5b99ad['options']?_0x5b99ad['options'][_0x3309('0x19')]||null:null,'attributes':_0x5b99ad['options']?_0x5b99ad[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'limit':0x1,'order':_0x5b99ad['options']?_0x5b99ad[_0x3309('0x17')][_0x3309('0x3f')]||null:null,'group':db[_0x3309('0x15')][_0x3309('0x32')],'transaction':_0x2dd138,'lock':_0x2dd138['LOCK'][_0x3309('0x2c')],'include':_0x5b99ad[_0x3309('0x17')]?_0x5b99ad['options'][_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x5b99ad[_0x3309('0x17')][_0x3309('0x1d')],function(_0x5410b6){return{'model':db[_0x5410b6[_0x3309('0x1e')]],'as':_0x5410b6['as'],'attributes':_0x5410b6[_0x3309('0x1a')],'include':_0x5410b6[_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x5410b6[_0x3309('0x1d')],function(_0x3b23e7){return{'model':db[_0x3b23e7[_0x3309('0x1e')]],'as':_0x3b23e7['as'],'attributes':_0x3b23e7['attributes'],'include':_0x3b23e7['include']?_[_0x3309('0x1c')](_0x3b23e7[_0x3309('0x1d')],function(_0x18db89){return{'model':db[_0x18db89['model']],'as':_0x18db89['as'],'attributes':_0x18db89[_0x3309('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3309('0x1f')](function(_0x58af2c){var _0x8fdf23=[];for(var _0x1df210=0x0;_0x1df210<_0x58af2c[_0x3309('0x31')];_0x1df210+=0x1){_0x8fdf23[_0x3309('0x33')](_0x58af2c[_0x1df210][_0x3309('0x24')](_0x5b99ad[_0x3309('0x34')],{'transaction':_0x2dd138}));}return BPromise['all'](_0x8fdf23);});})['then'](function(_0x5a7ac5){logger[_0x3309('0xa')](_0x3309('0x40'),_0x5b99ad);logger[_0x3309('0xd')](_0x3309('0x40'),_0x5b99ad,JSON[_0x3309('0xf')](_0x5a7ac5));_0x4c4986(_0x5a7ac5);})[_0x3309('0x13')](function(_0x110b34){logger['error'](_0x3309('0x40'),_0x110b34[_0x3309('0x11')],_0x5b99ad);_0x2b4a7f(_0x52f9f5['error'](0x1f4,_0x110b34[_0x3309('0x11')]));});});});};exports[_0x3309('0x41')]=function(_0x3ad253){var _0x34f0e1=this;return new Promise(function(_0x23f790,_0x1fb3e4){db[_0x3309('0x28')]['describe']()[_0x3309('0x1f')](function(_0x11ef1e){return db['CmHopper'][_0x3309('0x16')]({'raw':_0x3ad253[_0x3309('0x17')]?_0x3ad253[_0x3309('0x17')][_0x3309('0x18')]===undefined?!![]:![]:!![],'where':_0x3ad253['options']?_0x3ad253[_0x3309('0x17')][_0x3309('0x19')]||null:null,'attributes':_0x3ad253['options']?_0x3ad253[_0x3309('0x17')][_0x3309('0x1a')]||null:null,'limit':_0x3ad253[_0x3309('0x17')]?_0x3ad253[_0x3309('0x17')][_0x3309('0x1b')]||null:null,'include':_0x3ad253['options']?_0x3ad253[_0x3309('0x17')]['include']?_[_0x3309('0x1c')](_0x3ad253[_0x3309('0x17')][_0x3309('0x1d')],function(_0x584852){return{'model':db[_0x584852[_0x3309('0x1e')]],'as':_0x584852['as'],'attributes':_0x584852['as']===_0x3309('0x2d')?_[_0x3309('0x2e')](_0x11ef1e):_0x584852['attributes'],'include':_0x584852[_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x584852[_0x3309('0x1d')],function(_0x31c8ca){return{'model':db[_0x31c8ca[_0x3309('0x1e')]],'as':_0x31c8ca['as'],'attributes':_0x31c8ca[_0x3309('0x1a')],'include':_0x31c8ca[_0x3309('0x1d')]?_[_0x3309('0x1c')](_0x31c8ca[_0x3309('0x1d')],function(_0x5e6da1){return{'model':db[_0x5e6da1[_0x3309('0x1e')]],'as':_0x5e6da1['as'],'attributes':_0x5e6da1[_0x3309('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3309('0x1f')](function(_0x388ec0){logger['info'](_0x3309('0x14'),_0x3ad253);logger[_0x3309('0xd')](_0x3309('0x14'),_0x3ad253,JSON[_0x3309('0xf')](_0x388ec0));_0x23f790(_0x388ec0);})['catch'](function(_0xfc0dc6){logger[_0x3309('0x10')]('GetCmHopper',_0xfc0dc6['message'],_0x3ad253);_0x1fb3e4(_0x34f0e1[_0x3309('0x10')](0x1f4,_0xfc0dc6[_0x3309('0x11')]));});});});}; \ No newline at end of file +var _0x54cd=['model','map','then','GetCmHopper','debug','catch','CmHopper','find','raw','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','body','DestroyCmHopper','destroy','describe','transaction','findAll','UPDATE','CmContact','Contact','keys','User','Agent','voicePause','UserId','push','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','sequelize','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','length','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','options','where','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54cd,0x145));var _0xd54c=function(_0x461ddb,_0x1703ce){_0x461ddb=_0x461ddb-0x0;var _0x45dbfa=_0x54cd[_0x461ddb];return _0x45dbfa;};'use strict';var _=require(_0xd54c('0x0'));var util=require(_0xd54c('0x1'));var moment=require(_0xd54c('0x2'));var BPromise=require(_0xd54c('0x3'));var rs=require(_0xd54c('0x4'));var fs=require('fs');var Redis=require(_0xd54c('0x5'));var db=require(_0xd54c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd54c('0x7'))(_0xd54c('0x8'));var config=require(_0xd54c('0x9'));var jayson=require(_0xd54c('0xa'));var client=jayson['client'][_0xd54c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54b50d,_0x336d11,_0x339b9f){return new BPromise(function(_0x149b2e,_0x4de007){return client['request'](_0x54b50d,_0x339b9f)['then'](function(_0x234b33){logger[_0xd54c('0xc')](_0xd54c('0xd'),_0x336d11,_0xd54c('0xe'));logger['debug'](_0xd54c('0xf'),_0x336d11,_0xd54c('0xe'),JSON[_0xd54c('0x10')](_0x234b33));if(_0x234b33[_0xd54c('0x11')]){if(_0x234b33[_0xd54c('0x11')]['code']===0x1f4){logger[_0xd54c('0x11')](_0xd54c('0xd'),_0x336d11,_0x234b33[_0xd54c('0x11')][_0xd54c('0x12')]);return _0x4de007(_0x234b33[_0xd54c('0x11')][_0xd54c('0x12')]);}logger[_0xd54c('0x11')]('CmHopper,\x20%s,\x20%s',_0x336d11,_0x234b33[_0xd54c('0x11')][_0xd54c('0x12')]);return _0x149b2e(_0x234b33[_0xd54c('0x11')][_0xd54c('0x12')]);}else{logger[_0xd54c('0xc')]('CmHopper,\x20%s,\x20%s',_0x336d11,'request\x20sent');_0x149b2e(_0x234b33[_0xd54c('0x13')]['message']);}})['catch'](function(_0x1466bc){logger['error'](_0xd54c('0xd'),_0x336d11,_0x1466bc);_0x4de007(_0x1466bc);});});}exports['GetCmHopper']=function(_0x25a0ec){var _0x17629f=this;return new Promise(function(_0x52ff70,_0x5cf7ab){return db['CmHopper']['findAll']({'raw':_0x25a0ec['options']?_0x25a0ec[_0xd54c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x25a0ec['options']?_0x25a0ec['options'][_0xd54c('0x15')]||null:null,'attributes':_0x25a0ec[_0xd54c('0x14')]?_0x25a0ec[_0xd54c('0x14')][_0xd54c('0x16')]||null:null,'limit':_0x25a0ec[_0xd54c('0x14')]?_0x25a0ec[_0xd54c('0x14')][_0xd54c('0x17')]||null:null,'include':_0x25a0ec['options']?_0x25a0ec[_0xd54c('0x14')][_0xd54c('0x18')]?_['map'](_0x25a0ec[_0xd54c('0x14')][_0xd54c('0x18')],function(_0x572258){return{'model':db[_0x572258[_0xd54c('0x19')]],'as':_0x572258['as'],'attributes':_0x572258[_0xd54c('0x16')],'include':_0x572258['include']?_[_0xd54c('0x1a')](_0x572258['include'],function(_0x4730fb){return{'model':db[_0x4730fb[_0xd54c('0x19')]],'as':_0x4730fb['as'],'attributes':_0x4730fb[_0xd54c('0x16')],'include':_0x4730fb[_0xd54c('0x18')]?_['map'](_0x4730fb[_0xd54c('0x18')],function(_0x12f443){return{'model':db[_0x12f443['model']],'as':_0x12f443['as'],'attributes':_0x12f443[_0xd54c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd54c('0x1b')](function(_0x2f2089){logger['info'](_0xd54c('0x1c'),_0x25a0ec);logger[_0xd54c('0x1d')](_0xd54c('0x1c'),_0x25a0ec,JSON[_0xd54c('0x10')](_0x2f2089));_0x52ff70(_0x2f2089);})[_0xd54c('0x1e')](function(_0x5e24e5){logger['error'](_0xd54c('0x1c'),_0x5e24e5[_0xd54c('0x12')],_0x25a0ec);_0x5cf7ab(_0x17629f[_0xd54c('0x11')](0x1f4,_0x5e24e5[_0xd54c('0x12')]));});});};exports['ShowCmHopper']=function(_0x3748f3){var _0xf1bb9a=this;return new Promise(function(_0x48319f,_0x1a981a){return db[_0xd54c('0x1f')][_0xd54c('0x20')]({'raw':_0x3748f3[_0xd54c('0x14')]?_0x3748f3[_0xd54c('0x14')][_0xd54c('0x21')]===undefined?!![]:![]:!![],'where':_0x3748f3[_0xd54c('0x14')]?_0x3748f3[_0xd54c('0x14')][_0xd54c('0x15')]||null:null,'attributes':_0x3748f3[_0xd54c('0x14')]?_0x3748f3[_0xd54c('0x14')][_0xd54c('0x16')]||null:null,'include':_0x3748f3['options']?_0x3748f3['options'][_0xd54c('0x18')]?_['map'](_0x3748f3[_0xd54c('0x14')][_0xd54c('0x18')],function(_0x20f00d){return{'model':db[_0x20f00d[_0xd54c('0x19')]],'as':_0x20f00d['as'],'attributes':_0x20f00d[_0xd54c('0x16')],'include':_0x20f00d[_0xd54c('0x18')]?_[_0xd54c('0x1a')](_0x20f00d[_0xd54c('0x18')],function(_0x5457df){return{'model':db[_0x5457df['model']],'as':_0x5457df['as'],'attributes':_0x5457df[_0xd54c('0x16')],'include':_0x5457df[_0xd54c('0x18')]?_[_0xd54c('0x1a')](_0x5457df[_0xd54c('0x18')],function(_0x461b69){return{'model':db[_0x461b69[_0xd54c('0x19')]],'as':_0x461b69['as'],'attributes':_0x461b69[_0xd54c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd54c('0x1b')](function(_0x32535e){logger[_0xd54c('0xc')](_0xd54c('0x22'),_0x3748f3);logger[_0xd54c('0x1d')](_0xd54c('0x22'),_0x3748f3,JSON[_0xd54c('0x10')](_0x32535e));_0x48319f(_0x32535e);})[_0xd54c('0x1e')](function(_0x37578a){logger[_0xd54c('0x11')](_0xd54c('0x22'),_0x37578a[_0xd54c('0x12')],_0x3748f3);_0x1a981a(_0xf1bb9a['error'](0x1f4,_0x37578a[_0xd54c('0x12')]));});});};exports[_0xd54c('0x23')]=function(_0x4f6801){var _0x419370=this;return new Promise(function(_0x3721bb,_0x44ee1c){return db[_0xd54c('0x1f')]['create'](_0x4f6801['body'],{'raw':_0x4f6801[_0xd54c('0x14')]?_0x4f6801['options']['raw']===undefined?!![]:![]:!![]})[_0xd54c('0x1b')](function(_0x1542e3){logger[_0xd54c('0xc')](_0xd54c('0x23'),_0x4f6801);logger[_0xd54c('0x1d')](_0xd54c('0x23'),_0x4f6801,JSON[_0xd54c('0x10')](_0x1542e3));_0x3721bb(_0x1542e3);})[_0xd54c('0x1e')](function(_0xd3fe6){logger[_0xd54c('0x11')](_0xd54c('0x23'),_0xd3fe6[_0xd54c('0x12')],_0x4f6801);_0x44ee1c(_0x419370[_0xd54c('0x11')](0x1f4,_0xd3fe6[_0xd54c('0x12')]));});});};exports[_0xd54c('0x24')]=function(_0x989179){var _0x52724e=this;return new Promise(function(_0x53b7be,_0x35716f){return db[_0xd54c('0x1f')][_0xd54c('0x25')](_0x989179[_0xd54c('0x26')],{'raw':_0x989179['options']?_0x989179[_0xd54c('0x14')][_0xd54c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x989179['options']?_0x989179['options'][_0xd54c('0x15')]||null:null,'attributes':_0x989179[_0xd54c('0x14')]?_0x989179[_0xd54c('0x14')]['attributes']||null:null,'limit':_0x989179['options']?_0x989179['options'][_0xd54c('0x17')]||null:null})[_0xd54c('0x1b')](function(_0x591c04){logger[_0xd54c('0xc')]('UpdateCmHopper',_0x989179);logger[_0xd54c('0x1d')](_0xd54c('0x24'),_0x989179,JSON[_0xd54c('0x10')](_0x591c04));_0x53b7be(_0x591c04);})[_0xd54c('0x1e')](function(_0x206100){logger[_0xd54c('0x11')]('UpdateCmHopper',_0x206100[_0xd54c('0x12')],_0x989179);_0x35716f(_0x52724e[_0xd54c('0x11')](0x1f4,_0x206100['message']));});});};exports[_0xd54c('0x27')]=function(_0x4a7283){var _0x412917=this;return new Promise(function(_0x25df5d,_0x4ba5ca){return db[_0xd54c('0x1f')][_0xd54c('0x28')]({'where':_0x4a7283[_0xd54c('0x14')]?_0x4a7283[_0xd54c('0x14')][_0xd54c('0x15')]||null:null})[_0xd54c('0x1b')](function(_0x11422c){logger[_0xd54c('0xc')](_0xd54c('0x27'),_0x4a7283);logger[_0xd54c('0x1d')](_0xd54c('0x27'),_0x4a7283,JSON[_0xd54c('0x10')](_0x11422c));_0x25df5d(_0x11422c);})[_0xd54c('0x1e')](function(_0x5b8f7d){logger[_0xd54c('0x11')]('DestroyCmHopper',_0x5b8f7d[_0xd54c('0x12')],_0x4a7283);_0x4ba5ca(_0x412917[_0xd54c('0x11')](0x1f4,_0x5b8f7d['message']));});});};exports['GetContactDialer']=function(_0x3330cc){var _0x5bcde3=this;return new Promise(function(_0xa47bac,_0xba397e){return db['CmContact'][_0xd54c('0x29')]()['then'](function(_0xa82433){return db['sequelize'][_0xd54c('0x2a')](function(_0x430b06){return db[_0xd54c('0x1f')][_0xd54c('0x2b')]({'where':_0x3330cc[_0xd54c('0x14')]?_0x3330cc[_0xd54c('0x14')]['where']||null:null,'attributes':_0x3330cc['options']?_0x3330cc[_0xd54c('0x14')][_0xd54c('0x16')]||null:null,'limit':_0x3330cc[_0xd54c('0x14')]?_0x3330cc[_0xd54c('0x14')][_0xd54c('0x17')]||null:null,'order':_0x3330cc[_0xd54c('0x14')]?_0x3330cc[_0xd54c('0x14')]['order']||null:null,'transaction':_0x430b06,'lock':_0x430b06['LOCK'][_0xd54c('0x2c')],'include':[{'model':db[_0xd54c('0x2d')],'as':_0xd54c('0x2e'),'attributes':_[_0xd54c('0x2f')](_0xa82433)},{'model':db[_0xd54c('0x30')],'as':_0xd54c('0x31'),'attributes':['id','name',_0xd54c('0x32')]}]})[_0xd54c('0x1b')](function(_0x4cad08){var _0x3a6f4d=[];var _0x3897f8=[];for(var _0x3c7619=0x0;_0x3c7619<_0x4cad08['length'];_0x3c7619+=0x1){var _0x378751=_0x4cad08[_0x3c7619][_0xd54c('0x33')];if(_0x378751===null){_0x3a6f4d['push'](_0x4cad08[_0x3c7619]['update'](_0x3330cc[_0xd54c('0x26')],{'transaction':_0x430b06}));}else if(!_0x3897f8['includes'](_0x378751)){_0x3897f8[_0xd54c('0x34')](_0x378751);_0x3a6f4d[_0xd54c('0x34')](_0x4cad08[_0x3c7619][_0xd54c('0x25')](_0x3330cc[_0xd54c('0x26')],{'transaction':_0x430b06}));}}return BPromise[_0xd54c('0x35')](_0x3a6f4d);});})['then'](function(_0x4b1a68){logger[_0xd54c('0xc')]('GetContactDialer',_0x3330cc);logger[_0xd54c('0x1d')](_0xd54c('0x36'),_0x3330cc,JSON['stringify'](_0x4b1a68));_0xa47bac(_0x4b1a68);})[_0xd54c('0x1e')](function(_0x6e8037){logger[_0xd54c('0x11')](_0xd54c('0x36'),_0x6e8037[_0xd54c('0x12')],_0x3330cc);_0xba397e(_0x5bcde3['error'](0x1f4,_0x6e8037['message']));});});});};exports[_0xd54c('0x37')]=function(_0x4bb1b0){var _0xdd5824=this;return new Promise(function(_0x598461,_0x4c18a9){return db['sequelize'][_0xd54c('0x2a')](function(_0x74ed65){return db[_0xd54c('0x38')]['create'](_0x4bb1b0[_0xd54c('0x26')],{'raw':_0x4bb1b0[_0xd54c('0x14')]?_0x4bb1b0[_0xd54c('0x14')][_0xd54c('0x21')]===undefined?!![]:![]:!![],'transaction':_0x74ed65})['then'](function(){return db['CmHopper'][_0xd54c('0x28')]({'where':_0x4bb1b0[_0xd54c('0x14')]?_0x4bb1b0[_0xd54c('0x14')][_0xd54c('0x15')]||null:null,'transaction':_0x74ed65});});})[_0xd54c('0x1b')](function(_0x2aadd1){logger[_0xd54c('0xc')](_0xd54c('0x37'),_0x4bb1b0);logger[_0xd54c('0x1d')]('MoveContactManagedDialer',_0x4bb1b0,JSON[_0xd54c('0x10')](_0x2aadd1));_0x598461(_0x2aadd1);})[_0xd54c('0x1e')](function(_0x1a9fc6){logger[_0xd54c('0x11')]('MoveContactManagedDialer',_0x1a9fc6[_0xd54c('0x12')],_0x4bb1b0);_0x4c18a9(_0xdd5824[_0xd54c('0x11')](0x1f4,_0x1a9fc6[_0xd54c('0x12')]));});});};exports[_0xd54c('0x39')]=function(_0x126c0f){var _0x554fc3=this;return new Promise(function(_0x16e1d5,_0x50c963){return db[_0xd54c('0x1f')][_0xd54c('0x2b')]({'raw':_0x126c0f[_0xd54c('0x14')]?_0x126c0f[_0xd54c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x126c0f[_0xd54c('0x14')]?_0x126c0f['options'][_0xd54c('0x15')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd54c('0x3a'),db[_0xd54c('0x3b')]['fn']('IF',db['sequelize'][_0xd54c('0x3c')](_0xd54c('0x3d')+util['format']('\x22%s\x22',moment()[_0xd54c('0x3e')](_0xd54c('0x3f')))+_0xd54c('0x40')))),_0xd54c('0x41')]]})['then'](function(_0x5495fd){logger[_0xd54c('0xc')](_0xd54c('0x39'),_0x126c0f);logger['debug'](_0xd54c('0x39'),_0x126c0f,JSON[_0xd54c('0x10')](_0x5495fd));_0x16e1d5(_0x5495fd);})['catch'](function(_0x12537d){logger['error'](_0xd54c('0x39'),_0x12537d[_0xd54c('0x12')],_0x126c0f);_0x50c963(_0x554fc3[_0xd54c('0x11')](0x1f4,_0x12537d['message']));});});};exports[_0xd54c('0x42')]=function(_0x494fa0){var _0x3f339c=this;return new Promise(function(_0x2ed625,_0x231f6a){return db[_0xd54c('0x2d')][_0xd54c('0x29')]()[_0xd54c('0x1b')](function(_0x4d382f){return db[_0xd54c('0x3b')]['transaction'](function(_0x452189){return db[_0xd54c('0x1f')][_0xd54c('0x2b')]({'where':_0x494fa0[_0xd54c('0x14')]?_0x494fa0[_0xd54c('0x14')][_0xd54c('0x15')]||null:null,'attributes':_0x494fa0['options']?_0x494fa0[_0xd54c('0x14')][_0xd54c('0x16')]||null:null,'limit':0x1,'order':_0x494fa0[_0xd54c('0x14')]?_0x494fa0[_0xd54c('0x14')][_0xd54c('0x43')]||null:null,'group':db[_0xd54c('0x1f')]['UserId'],'transaction':_0x452189,'lock':_0x452189['LOCK'][_0xd54c('0x2c')],'include':_0x494fa0[_0xd54c('0x14')]?_0x494fa0[_0xd54c('0x14')][_0xd54c('0x18')]?_[_0xd54c('0x1a')](_0x494fa0['options']['include'],function(_0xe1978b){return{'model':db[_0xe1978b[_0xd54c('0x19')]],'as':_0xe1978b['as'],'attributes':_0xe1978b[_0xd54c('0x16')],'include':_0xe1978b[_0xd54c('0x18')]?_[_0xd54c('0x1a')](_0xe1978b['include'],function(_0x519328){return{'model':db[_0x519328[_0xd54c('0x19')]],'as':_0x519328['as'],'attributes':_0x519328[_0xd54c('0x16')],'include':_0x519328['include']?_[_0xd54c('0x1a')](_0x519328[_0xd54c('0x18')],function(_0x50dbbd){return{'model':db[_0x50dbbd['model']],'as':_0x50dbbd['as'],'attributes':_0x50dbbd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd54c('0x1b')](function(_0x513c33){var _0x2ee92a=[];for(var _0x372006=0x0;_0x372006<_0x513c33[_0xd54c('0x44')];_0x372006+=0x1){_0x2ee92a[_0xd54c('0x34')](_0x513c33[_0x372006][_0xd54c('0x25')](_0x494fa0['body'],{'transaction':_0x452189}));}return BPromise['all'](_0x2ee92a);});})['then'](function(_0x55613e){logger[_0xd54c('0xc')]('GetContactRecallMe',_0x494fa0);logger[_0xd54c('0x1d')](_0xd54c('0x42'),_0x494fa0,JSON[_0xd54c('0x10')](_0x55613e));_0x2ed625(_0x55613e);})[_0xd54c('0x1e')](function(_0x957916){logger[_0xd54c('0x11')](_0xd54c('0x42'),_0x957916[_0xd54c('0x12')],_0x494fa0);_0x231f6a(_0x3f339c[_0xd54c('0x11')](0x1f4,_0x957916[_0xd54c('0x12')]));});});});};exports[_0xd54c('0x45')]=function(_0x40aa8c){var _0x3bca38=this;return new Promise(function(_0x177505,_0x16c93d){db[_0xd54c('0x2d')]['describe']()[_0xd54c('0x1b')](function(_0x1830c9){return db[_0xd54c('0x1f')][_0xd54c('0x2b')]({'raw':_0x40aa8c['options']?_0x40aa8c['options'][_0xd54c('0x21')]===undefined?!![]:![]:!![],'where':_0x40aa8c[_0xd54c('0x14')]?_0x40aa8c[_0xd54c('0x14')][_0xd54c('0x15')]||null:null,'attributes':_0x40aa8c[_0xd54c('0x14')]?_0x40aa8c[_0xd54c('0x14')][_0xd54c('0x16')]||null:null,'limit':_0x40aa8c[_0xd54c('0x14')]?_0x40aa8c[_0xd54c('0x14')]['limit']||null:null,'include':_0x40aa8c[_0xd54c('0x14')]?_0x40aa8c['options']['include']?_[_0xd54c('0x1a')](_0x40aa8c['options'][_0xd54c('0x18')],function(_0x31aad1){return{'model':db[_0x31aad1[_0xd54c('0x19')]],'as':_0x31aad1['as'],'attributes':_0x31aad1['as']==='Contact'?_['keys'](_0x1830c9):_0x31aad1[_0xd54c('0x16')],'include':_0x31aad1[_0xd54c('0x18')]?_[_0xd54c('0x1a')](_0x31aad1['include'],function(_0x1dcffe){return{'model':db[_0x1dcffe[_0xd54c('0x19')]],'as':_0x1dcffe['as'],'attributes':_0x1dcffe[_0xd54c('0x16')],'include':_0x1dcffe['include']?_['map'](_0x1dcffe[_0xd54c('0x18')],function(_0x5208ea){return{'model':db[_0x5208ea[_0xd54c('0x19')]],'as':_0x5208ea['as'],'attributes':_0x5208ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xd54c('0x1b')](function(_0xa01ee6){logger[_0xd54c('0xc')](_0xd54c('0x1c'),_0x40aa8c);logger[_0xd54c('0x1d')](_0xd54c('0x1c'),_0x40aa8c,JSON['stringify'](_0xa01ee6));_0x177505(_0xa01ee6);})['catch'](function(_0x195b20){logger[_0xd54c('0x11')](_0xd54c('0x1c'),_0x195b20['message'],_0x40aa8c);_0x16c93d(_0x3bca38[_0xd54c('0x11')](0x1f4,_0x195b20[_0xd54c('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9bcbb0f..3633444 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 _0x9b5b=['get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/:id','show','post','getPreview','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9b5b,0x177));var _0xb9b5=function(_0x2836f3,_0x232362){_0x2836f3=_0x2836f3-0x0;var _0x5abeba=_0x9b5b[_0x2836f3];return _0x5abeba;};'use strict';var multer=require(_0xb9b5('0x0'));var util=require(_0xb9b5('0x1'));var path=require(_0xb9b5('0x2'));var timeout=require(_0xb9b5('0x3'));var express=require(_0xb9b5('0x4'));var router=express[_0xb9b5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb9b5('0x6'));var interaction=require(_0xb9b5('0x7'));var config=require(_0xb9b5('0x8'));var controller=require('./cmHopper.controller');router[_0xb9b5('0x9')]('/',auth['isAuthenticated'](),controller[_0xb9b5('0xa')]);router[_0xb9b5('0x9')](_0xb9b5('0xb'),auth[_0xb9b5('0xc')](),controller[_0xb9b5('0xd')]);router[_0xb9b5('0x9')](_0xb9b5('0xe'),auth['isAuthenticated'](),controller[_0xb9b5('0xf')]);router[_0xb9b5('0x9')](_0xb9b5('0x10'),auth['isAuthenticated'](),controller[_0xb9b5('0x11')]);router[_0xb9b5('0x12')]('/',auth[_0xb9b5('0xc')](),controller['create']);router['post']('/preview',auth['isAuthenticated'](),controller[_0xb9b5('0x13')]);router['put']('/:id',auth[_0xb9b5('0xc')](),controller[_0xb9b5('0x14')]);router[_0xb9b5('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb9b5('0x16')]);module[_0xb9b5('0x17')]=router; \ No newline at end of file +var _0xead5=['index','/describe','/opencontacts','getOpenContacts','/:id','show','post','/preview','getPreview','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xead5,0x1ed));var _0x5ead=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xead5[_0x81f000];return _0x337aa2;};'use strict';var multer=require(_0x5ead('0x0'));var util=require(_0x5ead('0x1'));var path=require(_0x5ead('0x2'));var timeout=require(_0x5ead('0x3'));var express=require(_0x5ead('0x4'));var router=express[_0x5ead('0x5')]();var fs_extra=require(_0x5ead('0x6'));var auth=require(_0x5ead('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5ead('0x8'));var controller=require('./cmHopper.controller');router[_0x5ead('0x9')]('/',auth[_0x5ead('0xa')](),controller[_0x5ead('0xb')]);router[_0x5ead('0x9')](_0x5ead('0xc'),auth[_0x5ead('0xa')](),controller['describe']);router[_0x5ead('0x9')](_0x5ead('0xd'),auth['isAuthenticated'](),controller[_0x5ead('0xe')]);router[_0x5ead('0x9')](_0x5ead('0xf'),auth['isAuthenticated'](),controller[_0x5ead('0x10')]);router[_0x5ead('0x11')]('/',auth[_0x5ead('0xa')](),controller['create']);router[_0x5ead('0x11')](_0x5ead('0x12'),auth[_0x5ead('0xa')](),controller[_0x5ead('0x13')]);router[_0x5ead('0x14')](_0x5ead('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x5ead('0x15')](_0x5ead('0xf'),auth[_0x5ead('0xa')](),controller[_0x5ead('0x16')]);module[_0x5ead('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2bd69b0..787b99b 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 _0x1db9=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1db9,0x176));var _0x91db=function(_0xff97b0,_0x190eef){_0xff97b0=_0xff97b0-0x0;var _0x55a8db=_0x1db9[_0xff97b0];return _0x55a8db;};'use strict';var moment=require(_0x91db('0x0'));var Sequelize=require(_0x91db('0x1'));module[_0x91db('0x2')]={'phone':{'type':Sequelize[_0x91db('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x91db('0x4')],'unique':_0x91db('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x91db('0x5')},'VoiceQueueId':{'type':Sequelize[_0x91db('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x6ec2=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x1e2768,_0x502a8f){var _0xb73fde=function(_0x296f62){while(--_0x296f62){_0x1e2768['push'](_0x1e2768['shift']());}};_0xb73fde(++_0x502a8f);}(_0x6ec2,0x78));var _0x26ec=function(_0x44b353,_0x27a8be){_0x44b353=_0x44b353-0x0;var _0x2b1b76=_0x6ec2[_0x44b353];return _0x2b1b76;};'use strict';var moment=require(_0x26ec('0x0'));var Sequelize=require(_0x26ec('0x1'));module[_0x26ec('0x2')]={'phone':{'type':Sequelize[_0x26ec('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x26ec('0x4')],'unique':_0x26ec('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x26ec('0x5')},'VoiceQueueId':{'type':Sequelize[_0x26ec('0x4')],'unique':_0x26ec('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 26de90c..2f67cc1 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 _0x7ffc=['offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','CmHopperBlack','findAll','catch','show','params','length','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x54a227,_0x41d278){var _0x280f3b=function(_0x54fd0d){while(--_0x54fd0d){_0x54a227['push'](_0x54a227['shift']());}};_0x280f3b(++_0x41d278);}(_0x7ffc,0x10f));var _0xc7ff=function(_0x2e8802,_0x59ad8c){_0x2e8802=_0x2e8802-0x0;var _0x4617aa=_0x7ffc[_0x2e8802];return _0x4617aa;};'use strict';var emlformat=require(_0xc7ff('0x0'));var rimraf=require(_0xc7ff('0x1'));var zipdir=require(_0xc7ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7ff('0x3'));var moment=require(_0xc7ff('0x4'));var BPromise=require(_0xc7ff('0x5'));var Mustache=require(_0xc7ff('0x6'));var util=require(_0xc7ff('0x7'));var path=require(_0xc7ff('0x8'));var sox=require(_0xc7ff('0x9'));var csv=require('to-csv');var ejs=require(_0xc7ff('0xa'));var fs=require('fs');var fs_extra=require(_0xc7ff('0xb'));var _=require('lodash');var squel=require(_0xc7ff('0xc'));var crypto=require(_0xc7ff('0xd'));var jsforce=require(_0xc7ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc7ff('0xf'));var querystring=require('querystring');var Papa=require(_0xc7ff('0x10'));var Redis=require(_0xc7ff('0x11'));var authService=require(_0xc7ff('0x12'));var qs=require(_0xc7ff('0x13'));var as=require(_0xc7ff('0x14'));var hardwareService=require(_0xc7ff('0x15'));var logger=require(_0xc7ff('0x16'))(_0xc7ff('0x17'));var utils=require(_0xc7ff('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc7ff('0x19'));var db=require(_0xc7ff('0x1a'))['db'];function respondWithStatusCode(_0xb2484c,_0x214a3e){_0x214a3e=_0x214a3e||0xcc;return function(_0x1b14a4){if(_0x1b14a4){return _0xb2484c[_0xc7ff('0x1b')](_0x214a3e);}return _0xb2484c['status'](_0x214a3e)['end']();};}function respondWithResult(_0x5081ca,_0x1666dc){_0x1666dc=_0x1666dc||0xc8;return function(_0x359563){if(_0x359563){return _0x5081ca[_0xc7ff('0x1c')](_0x1666dc)[_0xc7ff('0x1d')](_0x359563);}};}function respondWithFilteredResult(_0x372f9e,_0x1ccab6){return function(_0x4b411e){if(_0x4b411e){var _0x341b03=typeof _0x1ccab6['offset']===_0xc7ff('0x1e')&&typeof _0x1ccab6[_0xc7ff('0x1f')]==='undefined';var _0x316ac4=_0x4b411e[_0xc7ff('0x20')];var _0x202501=_0x341b03?0x0:_0x1ccab6[_0xc7ff('0x21')];var _0x52fa14=_0x341b03?_0x4b411e[_0xc7ff('0x20')]:_0x1ccab6[_0xc7ff('0x21')]+_0x1ccab6['limit'];var _0x42d8c7;if(_0x52fa14>=_0x316ac4){_0x52fa14=_0x316ac4;_0x42d8c7=0xc8;}else{_0x42d8c7=0xce;}_0x372f9e[_0xc7ff('0x1c')](_0x42d8c7);return _0x372f9e[_0xc7ff('0x22')](_0xc7ff('0x23'),_0x202501+'-'+_0x52fa14+'/'+_0x316ac4)[_0xc7ff('0x1d')](_0x4b411e);}return null;};}function patchUpdates(_0x196d27){return function(_0x41e3bd){try{jsonpatch[_0xc7ff('0x24')](_0x41e3bd,_0x196d27,!![]);}catch(_0x47b274){return BPromise[_0xc7ff('0x25')](_0x47b274);}return _0x41e3bd['save']();};}function saveUpdates(_0x473b85,_0x21e95e){return function(_0x1060bd){if(_0x1060bd){return _0x1060bd[_0xc7ff('0x26')](_0x473b85)[_0xc7ff('0x27')](function(_0x7bb4fa){return _0x7bb4fa;});}return null;};}function removeEntity(_0x308600,_0x250128){return function(_0x543381){if(_0x543381){return _0x543381[_0xc7ff('0x28')]()[_0xc7ff('0x27')](function(){_0x308600[_0xc7ff('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a9d1,_0x1f8340){return function(_0x48b1c4){if(!_0x48b1c4){_0x14a9d1['sendStatus'](0x194);}return _0x48b1c4;};}function handleError(_0x5aa86b,_0x1d9219){_0x1d9219=_0x1d9219||0x1f4;return function(_0x51e9f7){logger[_0xc7ff('0x29')](_0x51e9f7[_0xc7ff('0x2a')]);if(_0x51e9f7[_0xc7ff('0x2b')]){delete _0x51e9f7['name'];}_0x5aa86b['status'](_0x1d9219)[_0xc7ff('0x2c')](_0x51e9f7);};}exports[_0xc7ff('0x2d')]=function(_0x1be9f3,_0x50a2e0){var _0x1e4b49={},_0x48d883={},_0x2cc49c={'count':0x0,'rows':[]};var _0x21520c=_[_0xc7ff('0x2e')](db['CmHopperBlack'][_0xc7ff('0x2f')],function(_0x377378){return{'name':_0x377378[_0xc7ff('0x30')],'type':_0x377378[_0xc7ff('0x31')]['key']};});_0x48d883[_0xc7ff('0x32')]=_[_0xc7ff('0x2e')](_0x21520c,_0xc7ff('0x2b'));_0x48d883[_0xc7ff('0x33')]=_[_0xc7ff('0x34')](_0x1be9f3[_0xc7ff('0x33')]);_0x48d883[_0xc7ff('0x35')]=_[_0xc7ff('0x36')](_0x48d883[_0xc7ff('0x32')],_0x48d883[_0xc7ff('0x33')]);_0x1e4b49[_0xc7ff('0x37')]=_[_0xc7ff('0x36')](_0x48d883[_0xc7ff('0x32')],qs[_0xc7ff('0x38')](_0x1be9f3[_0xc7ff('0x33')][_0xc7ff('0x38')]));_0x1e4b49[_0xc7ff('0x37')]=_0x1e4b49[_0xc7ff('0x37')]['length']?_0x1e4b49['attributes']:_0x48d883[_0xc7ff('0x32')];if(!_0x1be9f3['query']['hasOwnProperty'](_0xc7ff('0x39'))){_0x1e4b49[_0xc7ff('0x1f')]=qs[_0xc7ff('0x1f')](_0x1be9f3[_0xc7ff('0x33')][_0xc7ff('0x1f')]);_0x1e4b49[_0xc7ff('0x21')]=qs['offset'](_0x1be9f3[_0xc7ff('0x33')]['offset']);}_0x1e4b49[_0xc7ff('0x3a')]=qs['sort'](_0x1be9f3[_0xc7ff('0x33')][_0xc7ff('0x3b')]);_0x1e4b49[_0xc7ff('0x3c')]=qs['filters'](_[_0xc7ff('0x3d')](_0x1be9f3[_0xc7ff('0x33')],_0x48d883[_0xc7ff('0x35')]),_0x21520c);if(_0x1be9f3[_0xc7ff('0x33')][_0xc7ff('0x3e')]){_0x1e4b49['where']=_[_0xc7ff('0x3f')](_0x1e4b49[_0xc7ff('0x3c')],{'$or':_[_0xc7ff('0x2e')](_0x21520c,function(_0x28aa63){if(_0x28aa63[_0xc7ff('0x31')]!==_0xc7ff('0x40')){var _0x36d82f={};_0x36d82f[_0x28aa63[_0xc7ff('0x2b')]]={'$like':'%'+_0x1be9f3[_0xc7ff('0x33')][_0xc7ff('0x3e')]+'%'};return _0x36d82f;}})});}_0x1e4b49=_[_0xc7ff('0x3f')]({},_0x1e4b49,_0x1be9f3[_0xc7ff('0x41')]);var _0x57faeb={'where':_0x1e4b49[_0xc7ff('0x3c')]};return db['CmHopperBlack'][_0xc7ff('0x20')](_0x57faeb)[_0xc7ff('0x27')](function(_0x591736){_0x2cc49c[_0xc7ff('0x20')]=_0x591736;if(_0x1be9f3['query'][_0xc7ff('0x42')]){_0x1e4b49['include']=[{'all':!![]}];}return db[_0xc7ff('0x43')][_0xc7ff('0x44')](_0x1e4b49);})[_0xc7ff('0x27')](function(_0x143482){_0x2cc49c['rows']=_0x143482;return _0x2cc49c;})[_0xc7ff('0x27')](respondWithFilteredResult(_0x50a2e0,_0x1e4b49))[_0xc7ff('0x45')](handleError(_0x50a2e0,null));};exports[_0xc7ff('0x46')]=function(_0x4ca350,_0x2a9fc1){var _0x2af9c1={'raw':!![],'where':{'id':_0x4ca350[_0xc7ff('0x47')]['id']}},_0x3f0b7e={};_0x3f0b7e[_0xc7ff('0x32')]=_[_0xc7ff('0x34')](db['CmHopperBlack']['rawAttributes']);_0x3f0b7e[_0xc7ff('0x33')]=_[_0xc7ff('0x34')](_0x4ca350[_0xc7ff('0x33')]);_0x3f0b7e[_0xc7ff('0x35')]=_[_0xc7ff('0x36')](_0x3f0b7e[_0xc7ff('0x32')],_0x3f0b7e[_0xc7ff('0x33')]);_0x2af9c1[_0xc7ff('0x37')]=_[_0xc7ff('0x36')](_0x3f0b7e['model'],qs[_0xc7ff('0x38')](_0x4ca350['query'][_0xc7ff('0x38')]));_0x2af9c1[_0xc7ff('0x37')]=_0x2af9c1['attributes'][_0xc7ff('0x48')]?_0x2af9c1[_0xc7ff('0x37')]:_0x3f0b7e[_0xc7ff('0x32')];if(_0x4ca350[_0xc7ff('0x33')][_0xc7ff('0x42')]){_0x2af9c1['include']=[{'all':!![]}];}_0x2af9c1=_[_0xc7ff('0x3f')]({},_0x2af9c1,_0x4ca350[_0xc7ff('0x41')]);return db['CmHopperBlack'][_0xc7ff('0x49')](_0x2af9c1)[_0xc7ff('0x27')](handleEntityNotFound(_0x2a9fc1,null))[_0xc7ff('0x27')](respondWithResult(_0x2a9fc1,null))[_0xc7ff('0x45')](handleError(_0x2a9fc1,null));};exports['update']=function(_0x3772d8,_0xd76068){if(_0x3772d8['body']['id']){delete _0x3772d8[_0xc7ff('0x4a')]['id'];}return db['CmHopperBlack'][_0xc7ff('0x49')]({'where':{'id':_0x3772d8[_0xc7ff('0x47')]['id']}})[_0xc7ff('0x27')](handleEntityNotFound(_0xd76068,null))[_0xc7ff('0x27')](saveUpdates(_0x3772d8['body'],null))[_0xc7ff('0x27')](respondWithResult(_0xd76068,null))['catch'](handleError(_0xd76068,null));};exports[_0xc7ff('0x28')]=function(_0xfa033c,_0x5d3e36){return db[_0xc7ff('0x43')][_0xc7ff('0x49')]({'where':{'id':_0xfa033c[_0xc7ff('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d3e36,null))[_0xc7ff('0x27')](removeEntity(_0x5d3e36,null))[_0xc7ff('0x45')](handleError(_0x5d3e36,null));};exports[_0xc7ff('0x4b')]=function(_0x3fd508,_0xd6a7ec){return db[_0xc7ff('0x43')][_0xc7ff('0x4b')]()[_0xc7ff('0x27')](respondWithResult(_0xd6a7ec,null))[_0xc7ff('0x45')](handleError(_0xd6a7ec,null));}; \ No newline at end of file +var _0xcde7=['find','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','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','reject','save','then','destroy','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','length'];(function(_0x5c5cfb,_0x856fe6){var _0xb89878=function(_0x32e5d4){while(--_0x32e5d4){_0x5c5cfb['push'](_0x5c5cfb['shift']());}};_0xb89878(++_0x856fe6);}(_0xcde7,0x129));var _0x7cde=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcde7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7cde('0x0'));var rimraf=require(_0x7cde('0x1'));var zipdir=require(_0x7cde('0x2'));var jsonpatch=require(_0x7cde('0x3'));var rp=require(_0x7cde('0x4'));var moment=require(_0x7cde('0x5'));var BPromise=require(_0x7cde('0x6'));var Mustache=require(_0x7cde('0x7'));var util=require(_0x7cde('0x8'));var path=require(_0x7cde('0x9'));var sox=require('sox');var csv=require(_0x7cde('0xa'));var ejs=require(_0x7cde('0xb'));var fs=require('fs');var fs_extra=require(_0x7cde('0xc'));var _=require('lodash');var squel=require(_0x7cde('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7cde('0xe'));var toCsv=require(_0x7cde('0xa'));var querystring=require(_0x7cde('0xf'));var Papa=require('papaparse');var Redis=require(_0x7cde('0x10'));var authService=require(_0x7cde('0x11'));var qs=require(_0x7cde('0x12'));var as=require(_0x7cde('0x13'));var hardwareService=require(_0x7cde('0x14'));var logger=require(_0x7cde('0x15'))(_0x7cde('0x16'));var utils=require('../../config/utils');var config=require(_0x7cde('0x17'));var licenseUtil=require(_0x7cde('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57765c,_0x45e2b9){_0x45e2b9=_0x45e2b9||0xcc;return function(_0x5c46a2){if(_0x5c46a2){return _0x57765c[_0x7cde('0x19')](_0x45e2b9);}return _0x57765c[_0x7cde('0x1a')](_0x45e2b9)[_0x7cde('0x1b')]();};}function respondWithResult(_0x5424a1,_0x447fc9){_0x447fc9=_0x447fc9||0xc8;return function(_0x504381){if(_0x504381){return _0x5424a1[_0x7cde('0x1a')](_0x447fc9)[_0x7cde('0x1c')](_0x504381);}};}function respondWithFilteredResult(_0x2fccf9,_0x5461aa){return function(_0x54313c){if(_0x54313c){var _0xb059ea=typeof _0x5461aa[_0x7cde('0x1d')]===_0x7cde('0x1e')&&typeof _0x5461aa['limit']===_0x7cde('0x1e');var _0x5af2e7=_0x54313c['count'];var _0x3081b3=_0xb059ea?0x0:_0x5461aa[_0x7cde('0x1d')];var _0x56f3a3=_0xb059ea?_0x54313c[_0x7cde('0x1f')]:_0x5461aa[_0x7cde('0x1d')]+_0x5461aa[_0x7cde('0x20')];var _0x584edc;if(_0x56f3a3>=_0x5af2e7){_0x56f3a3=_0x5af2e7;_0x584edc=0xc8;}else{_0x584edc=0xce;}_0x2fccf9[_0x7cde('0x1a')](_0x584edc);return _0x2fccf9[_0x7cde('0x21')]('Content-Range',_0x3081b3+'-'+_0x56f3a3+'/'+_0x5af2e7)[_0x7cde('0x1c')](_0x54313c);}return null;};}function patchUpdates(_0x57f3e0){return function(_0x187973){try{jsonpatch['apply'](_0x187973,_0x57f3e0,!![]);}catch(_0x2a1d89){return BPromise[_0x7cde('0x22')](_0x2a1d89);}return _0x187973[_0x7cde('0x23')]();};}function saveUpdates(_0x21e2d9,_0x1e2095){return function(_0x16df27){if(_0x16df27){return _0x16df27['update'](_0x21e2d9)[_0x7cde('0x24')](function(_0x1b4d02){return _0x1b4d02;});}return null;};}function removeEntity(_0x38f8c8,_0x5707ed){return function(_0x40b8cb){if(_0x40b8cb){return _0x40b8cb[_0x7cde('0x25')]()[_0x7cde('0x24')](function(){_0x38f8c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab22c,_0x31c622){return function(_0x5bfb51){if(!_0x5bfb51){_0x3ab22c[_0x7cde('0x19')](0x194);}return _0x5bfb51;};}function handleError(_0x438070,_0x50e13b){_0x50e13b=_0x50e13b||0x1f4;return function(_0x3d2b5b){logger[_0x7cde('0x26')](_0x3d2b5b['stack']);if(_0x3d2b5b[_0x7cde('0x27')]){delete _0x3d2b5b[_0x7cde('0x27')];}_0x438070[_0x7cde('0x1a')](_0x50e13b)[_0x7cde('0x28')](_0x3d2b5b);};}exports[_0x7cde('0x29')]=function(_0xef9c97,_0x5c5537){var _0x303d69={},_0x2052d9={},_0x55e5f0={'count':0x0,'rows':[]};var _0x511cf7=_[_0x7cde('0x2a')](db[_0x7cde('0x2b')][_0x7cde('0x2c')],function(_0x754945){return{'name':_0x754945[_0x7cde('0x2d')],'type':_0x754945[_0x7cde('0x2e')]['key']};});_0x2052d9['model']=_['map'](_0x511cf7,_0x7cde('0x27'));_0x2052d9['query']=_[_0x7cde('0x2f')](_0xef9c97[_0x7cde('0x30')]);_0x2052d9[_0x7cde('0x31')]=_[_0x7cde('0x32')](_0x2052d9[_0x7cde('0x33')],_0x2052d9[_0x7cde('0x30')]);_0x303d69[_0x7cde('0x34')]=_[_0x7cde('0x32')](_0x2052d9['model'],qs[_0x7cde('0x35')](_0xef9c97[_0x7cde('0x30')][_0x7cde('0x35')]));_0x303d69[_0x7cde('0x34')]=_0x303d69[_0x7cde('0x34')]['length']?_0x303d69[_0x7cde('0x34')]:_0x2052d9[_0x7cde('0x33')];if(!_0xef9c97[_0x7cde('0x30')][_0x7cde('0x36')](_0x7cde('0x37'))){_0x303d69['limit']=qs[_0x7cde('0x20')](_0xef9c97['query']['limit']);_0x303d69['offset']=qs[_0x7cde('0x1d')](_0xef9c97[_0x7cde('0x30')]['offset']);}_0x303d69[_0x7cde('0x38')]=qs[_0x7cde('0x39')](_0xef9c97[_0x7cde('0x30')]['sort']);_0x303d69['where']=qs['filters'](_[_0x7cde('0x3a')](_0xef9c97['query'],_0x2052d9[_0x7cde('0x31')]),_0x511cf7);if(_0xef9c97[_0x7cde('0x30')]['filter']){_0x303d69['where']=_[_0x7cde('0x3b')](_0x303d69['where'],{'$or':_[_0x7cde('0x2a')](_0x511cf7,function(_0x49fa7b){if(_0x49fa7b[_0x7cde('0x2e')]!==_0x7cde('0x3c')){var _0x180536={};_0x180536[_0x49fa7b[_0x7cde('0x27')]]={'$like':'%'+_0xef9c97['query'][_0x7cde('0x3d')]+'%'};return _0x180536;}})});}_0x303d69=_['merge']({},_0x303d69,_0xef9c97[_0x7cde('0x3e')]);var _0x16da5f={'where':_0x303d69['where']};return db[_0x7cde('0x2b')][_0x7cde('0x1f')](_0x16da5f)['then'](function(_0x1407d1){_0x55e5f0[_0x7cde('0x1f')]=_0x1407d1;if(_0xef9c97[_0x7cde('0x30')][_0x7cde('0x3f')]){_0x303d69[_0x7cde('0x40')]=[{'all':!![]}];}return db[_0x7cde('0x2b')][_0x7cde('0x41')](_0x303d69);})['then'](function(_0x34fadb){_0x55e5f0['rows']=_0x34fadb;return _0x55e5f0;})[_0x7cde('0x24')](respondWithFilteredResult(_0x5c5537,_0x303d69))['catch'](handleError(_0x5c5537,null));};exports['show']=function(_0x7ead52,_0x2ffc47){var _0x264ca4={'raw':!![],'where':{'id':_0x7ead52[_0x7cde('0x42')]['id']}},_0x34255a={};_0x34255a[_0x7cde('0x33')]=_[_0x7cde('0x2f')](db[_0x7cde('0x2b')][_0x7cde('0x2c')]);_0x34255a[_0x7cde('0x30')]=_[_0x7cde('0x2f')](_0x7ead52[_0x7cde('0x30')]);_0x34255a[_0x7cde('0x31')]=_['intersection'](_0x34255a['model'],_0x34255a[_0x7cde('0x30')]);_0x264ca4[_0x7cde('0x34')]=_[_0x7cde('0x32')](_0x34255a[_0x7cde('0x33')],qs[_0x7cde('0x35')](_0x7ead52[_0x7cde('0x30')][_0x7cde('0x35')]));_0x264ca4[_0x7cde('0x34')]=_0x264ca4[_0x7cde('0x34')][_0x7cde('0x43')]?_0x264ca4[_0x7cde('0x34')]:_0x34255a[_0x7cde('0x33')];if(_0x7ead52[_0x7cde('0x30')]['includeAll']){_0x264ca4['include']=[{'all':!![]}];}_0x264ca4=_[_0x7cde('0x3b')]({},_0x264ca4,_0x7ead52[_0x7cde('0x3e')]);return db[_0x7cde('0x2b')][_0x7cde('0x44')](_0x264ca4)[_0x7cde('0x24')](handleEntityNotFound(_0x2ffc47,null))[_0x7cde('0x24')](respondWithResult(_0x2ffc47,null))[_0x7cde('0x45')](handleError(_0x2ffc47,null));};exports[_0x7cde('0x46')]=function(_0x2f3168,_0x1548bd){if(_0x2f3168[_0x7cde('0x47')]['id']){delete _0x2f3168[_0x7cde('0x47')]['id'];}return db[_0x7cde('0x2b')][_0x7cde('0x44')]({'where':{'id':_0x2f3168[_0x7cde('0x42')]['id']}})[_0x7cde('0x24')](handleEntityNotFound(_0x1548bd,null))[_0x7cde('0x24')](saveUpdates(_0x2f3168[_0x7cde('0x47')],null))[_0x7cde('0x24')](respondWithResult(_0x1548bd,null))[_0x7cde('0x45')](handleError(_0x1548bd,null));};exports['destroy']=function(_0x570420,_0x3332f7){return db['CmHopperBlack']['find']({'where':{'id':_0x570420['params']['id']}})['then'](handleEntityNotFound(_0x3332f7,null))[_0x7cde('0x24')](removeEntity(_0x3332f7,null))['catch'](handleError(_0x3332f7,null));};exports[_0x7cde('0x48')]=function(_0x50d2d6,_0x5e4a46){return db[_0x7cde('0x2b')][_0x7cde('0x48')]()['then'](respondWithResult(_0x5e4a46,null))[_0x7cde('0x45')](handleError(_0x5e4a46,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index fe9ba85..92711df 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 _0x13d8=['lodash','util','../../config/logger','api','request-promise','path','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x18b34d,_0x1bd683){var _0x4ec0f3=function(_0x5cef8c){while(--_0x5cef8c){_0x18b34d['push'](_0x18b34d['shift']());}};_0x4ec0f3(++_0x1bd683);}(_0x13d8,0x1ad));var _0x813d=function(_0x122edb,_0x43735d){_0x122edb=_0x122edb-0x0;var _0x3d5c8e=_0x13d8[_0x122edb];return _0x3d5c8e;};'use strict';var _=require(_0x813d('0x0'));var util=require(_0x813d('0x1'));var logger=require(_0x813d('0x2'))(_0x813d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x813d('0x4'));var fs=require('fs');var path=require(_0x813d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x813d('0x6'));module[_0x813d('0x7')]=function(_0x66d167,_0x2d6788){return _0x66d167[_0x813d('0x8')](_0x813d('0x9'),attributes,{'tableName':_0x813d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x028e=['util','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x028e,0x6d));var _0xe028=function(_0x1d6d74,_0x1ee985){_0x1d6d74=_0x1d6d74-0x0;var _0x5e2af6=_0x028e[_0x1d6d74];return _0x5e2af6;};'use strict';var _=require(_0xe028('0x0'));var util=require(_0xe028('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe028('0x2'));var BPromise=require(_0xe028('0x3'));var rp=require(_0xe028('0x4'));var fs=require('fs');var path=require(_0xe028('0x5'));var rimraf=require('rimraf');var config=require(_0xe028('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0xe028('0x7')]=function(_0x3d6c9a,_0xfefacb){return _0x3d6c9a[_0xe028('0x8')](_0xe028('0x9'),attributes,{'tableName':_0xe028('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 16122c5..134a47d 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 _0xb8f1=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x5213cf,_0x167e72){var _0x2804ea=function(_0x4ad1e0){while(--_0x4ad1e0){_0x5213cf['push'](_0x5213cf['shift']());}};_0x2804ea(++_0x167e72);}(_0xb8f1,0x1c0));var _0x1b8f=function(_0xe78235,_0x2feaed){_0xe78235=_0xe78235-0x0;var _0x5ae2d4=_0xb8f1[_0xe78235];return _0x5ae2d4;};'use strict';var _=require(_0x1b8f('0x0'));var util=require(_0x1b8f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b8f('0x2'));var fs=require('fs');var Redis=require(_0x1b8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b8f('0x4'))(_0x1b8f('0x5'));var config=require(_0x1b8f('0x6'));var jayson=require(_0x1b8f('0x7'));var client=jayson[_0x1b8f('0x8')][_0x1b8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ddc9a,_0x17e281,_0x1c59b6){return new BPromise(function(_0x5e806f,_0x3e50e4){return client['request'](_0x2ddc9a,_0x1c59b6)['then'](function(_0x357b86){logger['info'](_0x1b8f('0xa'),_0x17e281,_0x1b8f('0xb'));logger[_0x1b8f('0xc')](_0x1b8f('0xd'),_0x17e281,_0x1b8f('0xb'),JSON[_0x1b8f('0xe')](_0x357b86));if(_0x357b86[_0x1b8f('0xf')]){if(_0x357b86['error'][_0x1b8f('0x10')]===0x1f4){logger[_0x1b8f('0xf')](_0x1b8f('0xa'),_0x17e281,_0x357b86[_0x1b8f('0xf')][_0x1b8f('0x11')]);return _0x3e50e4(_0x357b86[_0x1b8f('0xf')]['message']);}logger[_0x1b8f('0xf')](_0x1b8f('0xa'),_0x17e281,_0x357b86['error']['message']);return _0x5e806f(_0x357b86['error'][_0x1b8f('0x11')]);}else{logger[_0x1b8f('0x12')](_0x1b8f('0xa'),_0x17e281,'request\x20sent');_0x5e806f(_0x357b86['result'][_0x1b8f('0x11')]);}})[_0x1b8f('0x13')](function(_0x255276){logger[_0x1b8f('0xf')](_0x1b8f('0xa'),_0x17e281,_0x255276);_0x3e50e4(_0x255276);});});}exports[_0x1b8f('0x14')]=function(_0x193c89){var _0x2eda80=this;return new Promise(function(_0x57c844,_0x292c28){return db[_0x1b8f('0x15')][_0x1b8f('0x16')]({'raw':_0x193c89[_0x1b8f('0x17')]?_0x193c89[_0x1b8f('0x17')][_0x1b8f('0x18')]===undefined?!![]:![]:!![],'where':_0x193c89[_0x1b8f('0x17')]?_0x193c89['options'][_0x1b8f('0x19')]||null:null,'attributes':_0x193c89[_0x1b8f('0x17')]?_0x193c89[_0x1b8f('0x17')][_0x1b8f('0x1a')]||null:null,'limit':_0x193c89[_0x1b8f('0x17')]?_0x193c89['options'][_0x1b8f('0x1b')]||null:null,'include':_0x193c89[_0x1b8f('0x17')]?_0x193c89[_0x1b8f('0x17')][_0x1b8f('0x1c')]?_[_0x1b8f('0x1d')](_0x193c89['options'][_0x1b8f('0x1c')],function(_0x196a92){return{'model':db[_0x196a92[_0x1b8f('0x1e')]],'as':_0x196a92['as'],'attributes':_0x196a92[_0x1b8f('0x1a')],'include':_0x196a92[_0x1b8f('0x1c')]?_[_0x1b8f('0x1d')](_0x196a92['include'],function(_0x303610){return{'model':db[_0x303610[_0x1b8f('0x1e')]],'as':_0x303610['as'],'attributes':_0x303610[_0x1b8f('0x1a')],'include':_0x303610[_0x1b8f('0x1c')]?_[_0x1b8f('0x1d')](_0x303610['include'],function(_0x456aac){return{'model':db[_0x456aac['model']],'as':_0x456aac['as'],'attributes':_0x456aac['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b8f('0x1f')](function(_0x56dae8){logger[_0x1b8f('0x12')]('GetCmHopperBlack',_0x193c89);logger[_0x1b8f('0xc')](_0x1b8f('0x14'),_0x193c89,JSON[_0x1b8f('0xe')](_0x56dae8));_0x57c844(_0x56dae8);})[_0x1b8f('0x13')](function(_0x3f2ec9){logger[_0x1b8f('0xf')](_0x1b8f('0x14'),_0x3f2ec9[_0x1b8f('0x11')],_0x193c89);_0x292c28(_0x2eda80[_0x1b8f('0xf')](0x1f4,_0x3f2ec9[_0x1b8f('0x11')]));});});};exports[_0x1b8f('0x20')]=function(_0x53cab1){var _0x3bcb16=this;return new Promise(function(_0x2f7abc,_0x498b4d){return db[_0x1b8f('0x15')][_0x1b8f('0x21')](_0x53cab1[_0x1b8f('0x22')],{'raw':_0x53cab1[_0x1b8f('0x17')]?_0x53cab1[_0x1b8f('0x17')][_0x1b8f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53cab1[_0x1b8f('0x17')]?_0x53cab1[_0x1b8f('0x17')][_0x1b8f('0x19')]||null:null,'attributes':_0x53cab1[_0x1b8f('0x17')]?_0x53cab1[_0x1b8f('0x17')]['attributes']||null:null,'limit':_0x53cab1[_0x1b8f('0x17')]?_0x53cab1[_0x1b8f('0x17')][_0x1b8f('0x1b')]||null:null})['then'](function(_0x40f6b4){logger[_0x1b8f('0x12')](_0x1b8f('0x20'),_0x53cab1);logger['debug'](_0x1b8f('0x20'),_0x53cab1,JSON[_0x1b8f('0xe')](_0x40f6b4));_0x2f7abc(_0x40f6b4);})['catch'](function(_0x2a31fc){logger[_0x1b8f('0xf')](_0x1b8f('0x20'),_0x2a31fc[_0x1b8f('0x11')],_0x53cab1);_0x498b4d(_0x3bcb16[_0x1b8f('0xf')](0x1f4,_0x2a31fc[_0x1b8f('0x11')]));});});};exports[_0x1b8f('0x23')]=function(_0x5745be){var _0x5e55d2=this;return new Promise(function(_0x44d0d7,_0x382866){return db['CmHopperBlack']['destroy']({'where':_0x5745be['options']?_0x5745be[_0x1b8f('0x17')][_0x1b8f('0x19')]||null:null})[_0x1b8f('0x1f')](function(_0x32f5fe){logger[_0x1b8f('0x12')](_0x1b8f('0x23'),_0x5745be);logger['debug']('DestroyCmHopperBlack',_0x5745be,JSON[_0x1b8f('0xe')](_0x32f5fe));_0x44d0d7(_0x32f5fe);})[_0x1b8f('0x13')](function(_0x51d60a){logger['error'](_0x1b8f('0x23'),_0x51d60a['message'],_0x5745be);_0x382866(_0x5e55d2['error'](0x1f4,_0x51d60a[_0x1b8f('0x11')]));});});}; \ No newline at end of file +var _0x9eb9=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x436641,_0x4afca2){var _0x29e38f=function(_0x352f84){while(--_0x352f84){_0x436641['push'](_0x436641['shift']());}};_0x29e38f(++_0x4afca2);}(_0x9eb9,0x1bf));var _0x99eb=function(_0x2c13dc,_0x5f900e){_0x2c13dc=_0x2c13dc-0x0;var _0x4e15e6=_0x9eb9[_0x2c13dc];return _0x4e15e6;};'use strict';var _=require(_0x99eb('0x0'));var util=require(_0x99eb('0x1'));var moment=require(_0x99eb('0x2'));var BPromise=require(_0x99eb('0x3'));var rs=require(_0x99eb('0x4'));var fs=require('fs');var Redis=require(_0x99eb('0x5'));var db=require(_0x99eb('0x6'))['db'];var utils=require(_0x99eb('0x7'));var logger=require(_0x99eb('0x8'))('rpc');var config=require(_0x99eb('0x9'));var jayson=require(_0x99eb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8c3a,_0x1e2a46,_0x5931dc){return new BPromise(function(_0x5ee5e7,_0x5e87bb){return client[_0x99eb('0xb')](_0x3c8c3a,_0x5931dc)['then'](function(_0x924cb8){logger['info'](_0x99eb('0xc'),_0x1e2a46,_0x99eb('0xd'));logger[_0x99eb('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1e2a46,_0x99eb('0xd'),JSON[_0x99eb('0xf')](_0x924cb8));if(_0x924cb8[_0x99eb('0x10')]){if(_0x924cb8[_0x99eb('0x10')]['code']===0x1f4){logger[_0x99eb('0x10')](_0x99eb('0xc'),_0x1e2a46,_0x924cb8[_0x99eb('0x10')][_0x99eb('0x11')]);return _0x5e87bb(_0x924cb8[_0x99eb('0x10')][_0x99eb('0x11')]);}logger[_0x99eb('0x10')](_0x99eb('0xc'),_0x1e2a46,_0x924cb8[_0x99eb('0x10')][_0x99eb('0x11')]);return _0x5ee5e7(_0x924cb8[_0x99eb('0x10')]['message']);}else{logger[_0x99eb('0x12')](_0x99eb('0xc'),_0x1e2a46,'request\x20sent');_0x5ee5e7(_0x924cb8[_0x99eb('0x13')]['message']);}})[_0x99eb('0x14')](function(_0x1fc0be){logger[_0x99eb('0x10')](_0x99eb('0xc'),_0x1e2a46,_0x1fc0be);_0x5e87bb(_0x1fc0be);});});}exports[_0x99eb('0x15')]=function(_0x488d58){var _0x4be413=this;return new Promise(function(_0x3884c7,_0x8a137){return db[_0x99eb('0x16')][_0x99eb('0x17')]({'raw':_0x488d58[_0x99eb('0x18')]?_0x488d58[_0x99eb('0x18')][_0x99eb('0x19')]===undefined?!![]:![]:!![],'where':_0x488d58[_0x99eb('0x18')]?_0x488d58[_0x99eb('0x18')][_0x99eb('0x1a')]||null:null,'attributes':_0x488d58[_0x99eb('0x18')]?_0x488d58[_0x99eb('0x18')][_0x99eb('0x1b')]||null:null,'limit':_0x488d58[_0x99eb('0x18')]?_0x488d58[_0x99eb('0x18')]['limit']||null:null,'include':_0x488d58[_0x99eb('0x18')]?_0x488d58[_0x99eb('0x18')][_0x99eb('0x1c')]?_[_0x99eb('0x1d')](_0x488d58[_0x99eb('0x18')][_0x99eb('0x1c')],function(_0x1250a8){return{'model':db[_0x1250a8[_0x99eb('0x1e')]],'as':_0x1250a8['as'],'attributes':_0x1250a8[_0x99eb('0x1b')],'include':_0x1250a8[_0x99eb('0x1c')]?_['map'](_0x1250a8[_0x99eb('0x1c')],function(_0x56f072){return{'model':db[_0x56f072[_0x99eb('0x1e')]],'as':_0x56f072['as'],'attributes':_0x56f072[_0x99eb('0x1b')],'include':_0x56f072[_0x99eb('0x1c')]?_[_0x99eb('0x1d')](_0x56f072[_0x99eb('0x1c')],function(_0x8bbb52){return{'model':db[_0x8bbb52[_0x99eb('0x1e')]],'as':_0x8bbb52['as'],'attributes':_0x8bbb52[_0x99eb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x224e38){logger[_0x99eb('0x12')]('GetCmHopperBlack',_0x488d58);logger['debug'](_0x99eb('0x15'),_0x488d58,JSON[_0x99eb('0xf')](_0x224e38));_0x3884c7(_0x224e38);})[_0x99eb('0x14')](function(_0x3b4281){logger[_0x99eb('0x10')]('GetCmHopperBlack',_0x3b4281['message'],_0x488d58);_0x8a137(_0x4be413[_0x99eb('0x10')](0x1f4,_0x3b4281[_0x99eb('0x11')]));});});};exports[_0x99eb('0x1f')]=function(_0x5eae69){var _0x55d376=this;return new Promise(function(_0x1a25df,_0x546368){return db['CmHopperBlack'][_0x99eb('0x20')](_0x5eae69['body'],{'raw':_0x5eae69['options']?_0x5eae69[_0x99eb('0x18')][_0x99eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eae69[_0x99eb('0x18')]?_0x5eae69[_0x99eb('0x18')][_0x99eb('0x1a')]||null:null,'attributes':_0x5eae69[_0x99eb('0x18')]?_0x5eae69[_0x99eb('0x18')]['attributes']||null:null,'limit':_0x5eae69[_0x99eb('0x18')]?_0x5eae69['options']['limit']||null:null})['then'](function(_0xbd7589){logger['info'](_0x99eb('0x1f'),_0x5eae69);logger[_0x99eb('0xe')](_0x99eb('0x1f'),_0x5eae69,JSON[_0x99eb('0xf')](_0xbd7589));_0x1a25df(_0xbd7589);})[_0x99eb('0x14')](function(_0x3f1d1a){logger['error']('UpdateCmHopperBlack',_0x3f1d1a['message'],_0x5eae69);_0x546368(_0x55d376[_0x99eb('0x10')](0x1f4,_0x3f1d1a[_0x99eb('0x11')]));});});};exports[_0x99eb('0x21')]=function(_0xf4b7f2){var _0x4ef131=this;return new Promise(function(_0x5a1863,_0x263cb1){return db[_0x99eb('0x16')][_0x99eb('0x22')]({'where':_0xf4b7f2[_0x99eb('0x18')]?_0xf4b7f2['options'][_0x99eb('0x1a')]||null:null})[_0x99eb('0x23')](function(_0x4308ef){logger[_0x99eb('0x12')](_0x99eb('0x21'),_0xf4b7f2);logger['debug'](_0x99eb('0x21'),_0xf4b7f2,JSON[_0x99eb('0xf')](_0x4308ef));_0x5a1863(_0x4308ef);})[_0x99eb('0x14')](function(_0x4ab173){logger['error']('DestroyCmHopperBlack',_0x4ab173[_0x99eb('0x11')],_0xf4b7f2);_0x263cb1(_0x4ef131[_0x99eb('0x10')](0x1f4,_0x4ab173[_0x99eb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 439462e..9145f3a 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 _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x64f0e0,_0x5ad931){var _0x185054=function(_0x34f3e8){while(--_0x34f3e8){_0x64f0e0['push'](_0x64f0e0['shift']());}};_0x185054(++_0x5ad931);}(_0x11e5,0x8b));var _0x511e=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x11e5[_0x534c8f];return _0x5a57f5;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x6455,0x97));var _0x5645=function(_0x4e213a,_0x2e0965){_0x4e213a=_0x4e213a-0x0;var _0xf475cc=_0x6455[_0x4e213a];return _0xf475cc;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);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 f774db2..755970c 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 _0xa4dc=['endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x1a4107,_0x5b14a1){var _0x1bcefd=function(_0x22a8d9){while(--_0x22a8d9){_0x1a4107['push'](_0x1a4107['shift']());}};_0x1bcefd(++_0x5b14a1);}(_0xa4dc,0xe2));var _0xca4d=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa4dc[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0xca4d('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xca4d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xca4d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca4d('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xca4d('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xca4d('0x2')]},'calleridname':{'type':Sequelize[_0xca4d('0x2')]},'starttime':{'type':Sequelize[_0xca4d('0x3')]},'responsetime':{'type':Sequelize[_0xca4d('0x3')]},'answertime':{'type':Sequelize[_0xca4d('0x3')]},'droptime':{'type':Sequelize[_0xca4d('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca4d('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xca4d('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xca4d('0x2')]},'disposition':{'type':Sequelize[_0xca4d('0x2')]},'secondDisposition':{'type':Sequelize[_0xca4d('0x2')]},'thirdDisposition':{'type':Sequelize[_0xca4d('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4b18fd){var _0x5b6566=this['getDataValue'](_0xca4d('0x4'));if(_0x5b6566&&_0x4b18fd){this[_0xca4d('0x5')]('followuptime',moment(_0x4b18fd)[_0xca4d('0x6')](moment(_0x5b6566),_0xca4d('0x7')));}return this[_0xca4d('0x5')](_0xca4d('0x8'),_0x4b18fd);}},'amd':{'type':Sequelize[_0xca4d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca4d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca4d('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca4d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xca4d('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca4d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca4d('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xca4d('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xca4d('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca4d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x10cb=['STRING','getDataValue','setDataValue','diff','dispositionat','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x10cb,0x1c8));var _0xb10c=function(_0x2965d6,_0x4f3c54){_0x2965d6=_0x2965d6-0x0;var _0x122ef7=_0x10cb[_0x2965d6];return _0x122ef7;};'use strict';var Sequelize=require(_0xb10c('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xb10c('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb10c('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb10c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb10c('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb10c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb10c('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb10c('0x2')]},'endtime':{'type':Sequelize[_0xb10c('0x2')]},'ringtime':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb10c('0x3')]},'campaign':{'type':Sequelize[_0xb10c('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb10c('0x3')]},'reason':{'type':Sequelize[_0xb10c('0x3')]},'disposition':{'type':Sequelize[_0xb10c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb10c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb10c('0x2')],'set':function(_0x58900b){var _0x5a603f=this[_0xb10c('0x4')]('endtime');if(_0x5a603f&&_0x58900b){this[_0xb10c('0x5')]('followuptime',moment(_0x58900b)[_0xb10c('0x6')](moment(_0x5a603f),'seconds'));}return this[_0xb10c('0x5')](_0xb10c('0x7'),_0x58900b);}},'amd':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb10c('0x2')]},'callback':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb10c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb10c('0x2')]},'deleted':{'type':Sequelize[_0xb10c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb10c('0x2')]},'recallme':{'type':Sequelize[_0xb10c('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb10c('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb10c('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb10c('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 4fad843..19dd7e3 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 _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xeda8,0x104));var _0x8eda=function(_0x117b4e,_0x109653){_0x117b4e=_0x117b4e-0x0;var _0x3868be=_0xeda8[_0x117b4e];return _0x3868be;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));}; \ No newline at end of file +var _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','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/environment','../../mysqldb','sendStatus','status','end'];(function(_0xb832af,_0x418c62){var _0x518549=function(_0x8aefbe){while(--_0x8aefbe){_0xb832af['push'](_0xb832af['shift']());}};_0x518549(++_0x418c62);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 406aa18..8897baa 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 _0x95d7=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','../../config/environment'];(function(_0x13c1c7,_0x143075){var _0x570c2f=function(_0x19cf33){while(--_0x19cf33){_0x13c1c7['push'](_0x13c1c7['shift']());}};_0x570c2f(++_0x143075);}(_0x95d7,0x17d));var _0x795d=function(_0x1a7931,_0x1f3179){_0x1a7931=_0x1a7931-0x0;var _0x430084=_0x95d7[_0x1a7931];return _0x430084;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x795d('0x0'))(_0x795d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x795d('0x2'));var attributes=require(_0x795d('0x3'));module['exports']=function(_0xe73f3c,_0x34ca60){return _0xe73f3c[_0x795d('0x4')]('CmHopperFinal',attributes,{'tableName':_0x795d('0x5'),'paranoid':![],'indexes':[{'name':_0x795d('0x6'),'fields':[_0x795d('0x6')]},{'name':_0x795d('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x01cd=['calleridnum','uniqueid','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x01cd,0xb8));var _0xd01c=function(_0x322ff9,_0xf1ef52){_0x322ff9=_0x322ff9-0x0;var _0x6a9d34=_0x01cd[_0x322ff9];return _0x6a9d34;};'use strict';var _=require('lodash');var util=require(_0xd01c('0x0'));var logger=require(_0xd01c('0x1'))('api');var moment=require(_0xd01c('0x2'));var BPromise=require('bluebird');var rp=require(_0xd01c('0x3'));var fs=require('fs');var path=require(_0xd01c('0x4'));var rimraf=require(_0xd01c('0x5'));var config=require(_0xd01c('0x6'));var attributes=require(_0xd01c('0x7'));module[_0xd01c('0x8')]=function(_0x3ef46f,_0x20ae9b){return _0x3ef46f[_0xd01c('0x9')](_0xd01c('0xa'),attributes,{'tableName':_0xd01c('0xb'),'paranoid':![],'indexes':[{'name':_0xd01c('0xc'),'fields':[_0xd01c('0xc')]},{'name':_0xd01c('0xd'),'fields':[_0xd01c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 9249d85..9fe78e2 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(_0x304440,_0x21027b){var _0x331f09=function(_0x5663a2){while(--_0x5663a2){_0x304440['push'](_0x304440['shift']());}};_0x331f09(++_0x21027b);}(_0xb10b,0x12a));var _0xbb10=function(_0x22ae56,_0x16955c){_0x22ae56=_0x22ae56-0x0;var _0x1544f5=_0xb10b[_0x22ae56];return _0x1544f5;};'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(_0x162141,_0x119200){var _0x154245=function(_0x3b1554){while(--_0x3b1554){_0x162141['push'](_0x162141['shift']());}};_0x154245(++_0x119200);}(_0xb10b,0x12a));var _0xbb10=function(_0x1031ab,_0x11a0e6){_0x1031ab=_0x1031ab-0x0;var _0x15ba29=_0xb10b[_0x1031ab];return _0x15ba29;};'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 6feb26d..6c1b5dd 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 _0x1d12=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x1d12,0x13f));var _0x21d1=function(_0x434c5a,_0x56cc14){_0x434c5a=_0x434c5a-0x0;var _0x327ac5=_0x1d12[_0x434c5a];return _0x327ac5;};'use strict';var multer=require(_0x21d1('0x0'));var util=require(_0x21d1('0x1'));var path=require(_0x21d1('0x2'));var timeout=require(_0x21d1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x21d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21d1('0x5'));var controller=require(_0x21d1('0x6'));router[_0x21d1('0x7')]('/',auth[_0x21d1('0x8')](),controller[_0x21d1('0x9')]);router[_0x21d1('0x7')](_0x21d1('0xa'),auth[_0x21d1('0x8')](),controller[_0x21d1('0xb')]);router[_0x21d1('0x7')](_0x21d1('0xc'),auth[_0x21d1('0x8')](),controller['show']);router[_0x21d1('0x7')](_0x21d1('0xd'),auth[_0x21d1('0x8')](),controller[_0x21d1('0xe')]);router[_0x21d1('0x7')]('/campaign/countAttributes/:id',auth[_0x21d1('0x8')](),controller[_0x21d1('0xf')]);router[_0x21d1('0x10')](_0x21d1('0x11'),auth[_0x21d1('0x8')](),controller[_0x21d1('0x12')]);router[_0x21d1('0x10')](_0x21d1('0x13'),auth[_0x21d1('0x8')](),controller[_0x21d1('0x14')]);router[_0x21d1('0x10')](_0x21d1('0x15'),auth[_0x21d1('0x8')](),controller[_0x21d1('0x16')]);router[_0x21d1('0x17')](_0x21d1('0xc'),auth[_0x21d1('0x8')](),controller[_0x21d1('0x18')]);module[_0x21d1('0x19')]=router; \ No newline at end of file +var _0xd576=['describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd576,0xb1));var _0x6d57=function(_0x5856d3,_0xb4e105){_0x5856d3=_0x5856d3-0x0;var _0x217fd0=_0xd576[_0x5856d3];return _0x217fd0;};'use strict';var multer=require(_0x6d57('0x0'));var util=require(_0x6d57('0x1'));var path=require(_0x6d57('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d57('0x3'));var router=express[_0x6d57('0x4')]();var fs_extra=require(_0x6d57('0x5'));var auth=require(_0x6d57('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d57('0x7'));var controller=require(_0x6d57('0x8'));router[_0x6d57('0x9')]('/',auth[_0x6d57('0xa')](),controller['index']);router[_0x6d57('0x9')](_0x6d57('0xb'),auth[_0x6d57('0xa')](),controller[_0x6d57('0xc')]);router[_0x6d57('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6d57('0xd')]);router['get'](_0x6d57('0xe'),auth[_0x6d57('0xa')](),controller[_0x6d57('0xf')]);router[_0x6d57('0x9')](_0x6d57('0x10'),auth[_0x6d57('0xa')](),controller[_0x6d57('0x11')]);router[_0x6d57('0x12')](_0x6d57('0x13'),auth[_0x6d57('0xa')](),controller[_0x6d57('0x14')]);router[_0x6d57('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x6d57('0x12')](_0x6d57('0x15'),auth[_0x6d57('0xa')](),controller[_0x6d57('0x16')]);router[_0x6d57('0x17')](_0x6d57('0x18'),auth[_0x6d57('0xa')](),controller[_0x6d57('0x19')]);module[_0x6d57('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 3e3389b..7638cb9 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 _0xa71a=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x5152db,_0x55fa0c){var _0x41f8fb=function(_0x154b40){while(--_0x154b40){_0x5152db['push'](_0x5152db['shift']());}};_0x41f8fb(++_0x55fa0c);}(_0xa71a,0xa3));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaa71('0x0'));module['exports']={'state':{'type':Sequelize[_0xaa71('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaa71('0x2')]},'scheduledat':{'type':Sequelize[_0xaa71('0x3')]},'countbusyretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xaa71('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xaa71('0x2')]},'calleridnum':{'type':Sequelize[_0xaa71('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa71('0x3')]},'responsetime':{'type':Sequelize[_0xaa71('0x3')]},'answertime':{'type':Sequelize[_0xaa71('0x3')]},'droptime':{'type':Sequelize[_0xaa71('0x3')]},'endtime':{'type':Sequelize[_0xaa71('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xaa71('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xaa71('0x2')]},'reason':{'type':Sequelize[_0xaa71('0x2')]},'amd':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaa71('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaa71('0x3')]},'recallme':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3cff=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3c73ea,_0x37afb4){var _0x3ed8cd=function(_0x275d8b){while(--_0x275d8b){_0x3c73ea['push'](_0x3c73ea['shift']());}};_0x3ed8cd(++_0x37afb4);}(_0x3cff,0xbd));var _0xf3cf=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x3cff[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0xf3cf('0x0'));module[_0xf3cf('0x1')]={'state':{'type':Sequelize[_0xf3cf('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf3cf('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf3cf('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf3cf('0x4')]},'calleridnum':{'type':Sequelize[_0xf3cf('0x4')]},'calleridname':{'type':Sequelize[_0xf3cf('0x4')]},'starttime':{'type':Sequelize[_0xf3cf('0x3')]},'responsetime':{'type':Sequelize[_0xf3cf('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf3cf('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf3cf('0x4')]},'campaign':{'type':Sequelize[_0xf3cf('0x4')]},'campaigntype':{'type':Sequelize[_0xf3cf('0x4')]},'membername':{'type':Sequelize[_0xf3cf('0x4')]},'reason':{'type':Sequelize[_0xf3cf('0x4')]},'amd':{'type':Sequelize[_0xf3cf('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf3cf('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf3cf('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf3cf('0x3')]},'edited':{'type':Sequelize[_0xf3cf('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf3cf('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 6d8953f..d56a05b 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 _0xe078=['map','rawAttributes','type','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','findAll','catch','attributes','include','find','create','body','describe','uniqueid','params','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0xe078,0x69));var _0x8e07=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe078[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e07('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e07('0x1'));var moment=require(_0x8e07('0x2'));var BPromise=require(_0x8e07('0x3'));var Mustache=require('mustache');var util=require(_0x8e07('0x4'));var path=require(_0x8e07('0x5'));var sox=require(_0x8e07('0x6'));var csv=require(_0x8e07('0x7'));var ejs=require(_0x8e07('0x8'));var fs=require('fs');var fs_extra=require(_0x8e07('0x9'));var _=require(_0x8e07('0xa'));var squel=require(_0x8e07('0xb'));var crypto=require(_0x8e07('0xc'));var jsforce=require(_0x8e07('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e07('0x7'));var querystring=require('querystring');var Papa=require(_0x8e07('0xe'));var Redis=require(_0x8e07('0xf'));var authService=require(_0x8e07('0x10'));var qs=require(_0x8e07('0x11'));var as=require(_0x8e07('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e07('0x13'))(_0x8e07('0x14'));var utils=require(_0x8e07('0x15'));var config=require(_0x8e07('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x478e6a,_0x33b40a){_0x33b40a=_0x33b40a||0xcc;return function(_0x5eb52f){if(_0x5eb52f){return _0x478e6a[_0x8e07('0x17')](_0x33b40a);}return _0x478e6a[_0x8e07('0x18')](_0x33b40a)['end']();};}function respondWithResult(_0x2d78d2,_0x5838b4){_0x5838b4=_0x5838b4||0xc8;return function(_0x4e17c6){if(_0x4e17c6){return _0x2d78d2[_0x8e07('0x18')](_0x5838b4)['json'](_0x4e17c6);}};}function respondWithFilteredResult(_0x1f5dad,_0x5d0518){return function(_0x3d532f){if(_0x3d532f){var _0x2ac25a=typeof _0x5d0518[_0x8e07('0x19')]===_0x8e07('0x1a')&&typeof _0x5d0518[_0x8e07('0x1b')]===_0x8e07('0x1a');var _0x2d8c0e=_0x3d532f[_0x8e07('0x1c')];var _0x56da4e=_0x2ac25a?0x0:_0x5d0518['offset'];var _0x5f21ea=_0x2ac25a?_0x3d532f[_0x8e07('0x1c')]:_0x5d0518[_0x8e07('0x19')]+_0x5d0518['limit'];var _0x4fb503;if(_0x5f21ea>=_0x2d8c0e){_0x5f21ea=_0x2d8c0e;_0x4fb503=0xc8;}else{_0x4fb503=0xce;}_0x1f5dad['status'](_0x4fb503);return _0x1f5dad[_0x8e07('0x1d')](_0x8e07('0x1e'),_0x56da4e+'-'+_0x5f21ea+'/'+_0x2d8c0e)['json'](_0x3d532f);}return null;};}function patchUpdates(_0x545f46){return function(_0x4b637b){try{jsonpatch[_0x8e07('0x1f')](_0x4b637b,_0x545f46,!![]);}catch(_0x33f90d){return BPromise[_0x8e07('0x20')](_0x33f90d);}return _0x4b637b[_0x8e07('0x21')]();};}function saveUpdates(_0x591353,_0x564a9b){return function(_0x5e531c){if(_0x5e531c){return _0x5e531c[_0x8e07('0x22')](_0x591353)[_0x8e07('0x23')](function(_0x223f82){return _0x223f82;});}return null;};}function removeEntity(_0x66ed5,_0x5ea86e){return function(_0x70d1da){if(_0x70d1da){return _0x70d1da[_0x8e07('0x24')]()['then'](function(){_0x66ed5[_0x8e07('0x18')](0xcc)[_0x8e07('0x25')]();});}};}function handleEntityNotFound(_0x322733,_0xad055d){return function(_0x2dfdc7){if(!_0x2dfdc7){_0x322733[_0x8e07('0x17')](0x194);}return _0x2dfdc7;};}function handleError(_0x4cd114,_0x3d1881){_0x3d1881=_0x3d1881||0x1f4;return function(_0x5e286f){logger[_0x8e07('0x26')](_0x5e286f[_0x8e07('0x27')]);if(_0x5e286f[_0x8e07('0x28')]){delete _0x5e286f[_0x8e07('0x28')];}_0x4cd114[_0x8e07('0x18')](_0x3d1881)[_0x8e07('0x29')](_0x5e286f);};}exports[_0x8e07('0x2a')]=function(_0x1b80ff,_0x66c95d){var _0x544ba3={},_0x212ca8={},_0x11147f={'count':0x0,'rows':[]};var _0x51ed34=_[_0x8e07('0x2b')](db['CmHopperHistory'][_0x8e07('0x2c')],function(_0x3a25c4){return{'name':_0x3a25c4['fieldName'],'type':_0x3a25c4[_0x8e07('0x2d')]['key']};});_0x212ca8[_0x8e07('0x2e')]=_[_0x8e07('0x2b')](_0x51ed34,_0x8e07('0x28'));_0x212ca8[_0x8e07('0x2f')]=_[_0x8e07('0x30')](_0x1b80ff[_0x8e07('0x2f')]);_0x212ca8['filters']=_['intersection'](_0x212ca8[_0x8e07('0x2e')],_0x212ca8[_0x8e07('0x2f')]);_0x544ba3['attributes']=_[_0x8e07('0x31')](_0x212ca8[_0x8e07('0x2e')],qs[_0x8e07('0x32')](_0x1b80ff['query'][_0x8e07('0x32')]));_0x544ba3['attributes']=_0x544ba3['attributes'][_0x8e07('0x33')]?_0x544ba3['attributes']:_0x212ca8['model'];if(!_0x1b80ff['query'][_0x8e07('0x34')](_0x8e07('0x35'))){_0x544ba3[_0x8e07('0x1b')]=qs[_0x8e07('0x1b')](_0x1b80ff[_0x8e07('0x2f')]['limit']);_0x544ba3['offset']=qs[_0x8e07('0x19')](_0x1b80ff[_0x8e07('0x2f')][_0x8e07('0x19')]);}_0x544ba3[_0x8e07('0x36')]=qs['sort'](_0x1b80ff[_0x8e07('0x2f')][_0x8e07('0x37')]);_0x544ba3[_0x8e07('0x38')]=qs[_0x8e07('0x39')](_['pick'](_0x1b80ff[_0x8e07('0x2f')],_0x212ca8[_0x8e07('0x39')]),_0x51ed34);if(_0x1b80ff[_0x8e07('0x2f')][_0x8e07('0x3a')]){_0x544ba3['where']=_[_0x8e07('0x3b')](_0x544ba3[_0x8e07('0x38')],{'$or':_[_0x8e07('0x2b')](_0x51ed34,function(_0xae8e12){if(_0xae8e12[_0x8e07('0x2d')]!==_0x8e07('0x3c')){var _0x1cbafb={};_0x1cbafb[_0xae8e12['name']]={'$like':'%'+_0x1b80ff[_0x8e07('0x2f')][_0x8e07('0x3a')]+'%'};return _0x1cbafb;}})});}_0x544ba3=_[_0x8e07('0x3b')]({},_0x544ba3,_0x1b80ff[_0x8e07('0x3d')]);var _0xfd01f6={'where':_0x544ba3[_0x8e07('0x38')]};return db[_0x8e07('0x3e')][_0x8e07('0x1c')](_0xfd01f6)[_0x8e07('0x23')](function(_0x371635){_0x11147f[_0x8e07('0x1c')]=_0x371635;if(_0x1b80ff[_0x8e07('0x2f')][_0x8e07('0x3f')]){_0x544ba3['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x8e07('0x40')](_0x544ba3);})[_0x8e07('0x23')](function(_0xf150be){_0x11147f['rows']=_0xf150be;return _0x11147f;})[_0x8e07('0x23')](respondWithFilteredResult(_0x66c95d,_0x544ba3))[_0x8e07('0x41')](handleError(_0x66c95d,null));};exports['show']=function(_0x4c0d31,_0x3e8c90){var _0x2a5c39={'raw':!![],'where':{'id':_0x4c0d31['params']['id']}},_0x1375f5={};_0x1375f5[_0x8e07('0x2e')]=_['keys'](db[_0x8e07('0x3e')]['rawAttributes']);_0x1375f5[_0x8e07('0x2f')]=_[_0x8e07('0x30')](_0x4c0d31[_0x8e07('0x2f')]);_0x1375f5[_0x8e07('0x39')]=_[_0x8e07('0x31')](_0x1375f5[_0x8e07('0x2e')],_0x1375f5['query']);_0x2a5c39[_0x8e07('0x42')]=_[_0x8e07('0x31')](_0x1375f5['model'],qs[_0x8e07('0x32')](_0x4c0d31[_0x8e07('0x2f')]['fields']));_0x2a5c39[_0x8e07('0x42')]=_0x2a5c39['attributes']['length']?_0x2a5c39[_0x8e07('0x42')]:_0x1375f5[_0x8e07('0x2e')];if(_0x4c0d31['query'][_0x8e07('0x3f')]){_0x2a5c39[_0x8e07('0x43')]=[{'all':!![]}];}_0x2a5c39=_[_0x8e07('0x3b')]({},_0x2a5c39,_0x4c0d31[_0x8e07('0x3d')]);return db[_0x8e07('0x3e')][_0x8e07('0x44')](_0x2a5c39)[_0x8e07('0x23')](handleEntityNotFound(_0x3e8c90,null))[_0x8e07('0x23')](respondWithResult(_0x3e8c90,null))['catch'](handleError(_0x3e8c90,null));};exports[_0x8e07('0x45')]=function(_0x166207,_0x1cf16e){return db[_0x8e07('0x3e')][_0x8e07('0x45')](_0x166207[_0x8e07('0x46')],{})[_0x8e07('0x23')](respondWithResult(_0x1cf16e,0xc9))[_0x8e07('0x41')](handleError(_0x1cf16e,null));};exports[_0x8e07('0x47')]=function(_0x58aed2,_0x323526){return db[_0x8e07('0x3e')][_0x8e07('0x47')]()[_0x8e07('0x23')](respondWithResult(_0x323526,null))[_0x8e07('0x41')](handleError(_0x323526,null));};exports[_0x8e07('0x22')]=function(_0x39909a,_0x2d9a34){if(_0x39909a[_0x8e07('0x46')]['uniqueid']){delete _0x39909a[_0x8e07('0x46')][_0x8e07('0x48')];}return db[_0x8e07('0x3e')][_0x8e07('0x44')]({'where':{'uniqueid':_0x39909a[_0x8e07('0x49')]['id']}})[_0x8e07('0x23')](handleEntityNotFound(_0x2d9a34,null))[_0x8e07('0x23')](saveUpdates(_0x39909a['body'],null))[_0x8e07('0x23')](respondWithResult(_0x2d9a34,null))[_0x8e07('0x41')](handleError(_0x2d9a34,null));}; \ No newline at end of file +var _0xfceb=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','catch','params','include','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfceb,0x169));var _0xbfce=function(_0x5ee8e1,_0x38e3f5){_0x5ee8e1=_0x5ee8e1-0x0;var _0xd77d65=_0xfceb[_0x5ee8e1];return _0xd77d65;};'use strict';var emlformat=require(_0xbfce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfce('0x1'));var jsonpatch=require(_0xbfce('0x2'));var rp=require(_0xbfce('0x3'));var moment=require(_0xbfce('0x4'));var BPromise=require(_0xbfce('0x5'));var Mustache=require(_0xbfce('0x6'));var util=require(_0xbfce('0x7'));var path=require(_0xbfce('0x8'));var sox=require(_0xbfce('0x9'));var csv=require(_0xbfce('0xa'));var ejs=require(_0xbfce('0xb'));var fs=require('fs');var fs_extra=require(_0xbfce('0xc'));var _=require('lodash');var squel=require(_0xbfce('0xd'));var crypto=require(_0xbfce('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbfce('0xf'));var toCsv=require(_0xbfce('0xa'));var querystring=require(_0xbfce('0x10'));var Papa=require(_0xbfce('0x11'));var Redis=require(_0xbfce('0x12'));var authService=require(_0xbfce('0x13'));var qs=require(_0xbfce('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfce('0x15'));var logger=require(_0xbfce('0x16'))(_0xbfce('0x17'));var utils=require('../../config/utils');var config=require(_0xbfce('0x18'));var licenseUtil=require(_0xbfce('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c929f,_0x2eefa4){_0x2eefa4=_0x2eefa4||0xcc;return function(_0x1f4365){if(_0x1f4365){return _0x2c929f[_0xbfce('0x1a')](_0x2eefa4);}return _0x2c929f['status'](_0x2eefa4)[_0xbfce('0x1b')]();};}function respondWithResult(_0x2cc65a,_0x4455c9){_0x4455c9=_0x4455c9||0xc8;return function(_0x5c9a5d){if(_0x5c9a5d){return _0x2cc65a[_0xbfce('0x1c')](_0x4455c9)[_0xbfce('0x1d')](_0x5c9a5d);}};}function respondWithFilteredResult(_0x2c85cd,_0x1e9d9e){return function(_0x31160b){if(_0x31160b){var _0x116c29=typeof _0x1e9d9e[_0xbfce('0x1e')]===_0xbfce('0x1f')&&typeof _0x1e9d9e[_0xbfce('0x20')]===_0xbfce('0x1f');var _0x1da817=_0x31160b[_0xbfce('0x21')];var _0x1c540f=_0x116c29?0x0:_0x1e9d9e[_0xbfce('0x1e')];var _0x3be6c1=_0x116c29?_0x31160b[_0xbfce('0x21')]:_0x1e9d9e['offset']+_0x1e9d9e[_0xbfce('0x20')];var _0xa40f14;if(_0x3be6c1>=_0x1da817){_0x3be6c1=_0x1da817;_0xa40f14=0xc8;}else{_0xa40f14=0xce;}_0x2c85cd[_0xbfce('0x1c')](_0xa40f14);return _0x2c85cd[_0xbfce('0x22')](_0xbfce('0x23'),_0x1c540f+'-'+_0x3be6c1+'/'+_0x1da817)['json'](_0x31160b);}return null;};}function patchUpdates(_0x4f5546){return function(_0x229528){try{jsonpatch['apply'](_0x229528,_0x4f5546,!![]);}catch(_0x1d6d49){return BPromise[_0xbfce('0x24')](_0x1d6d49);}return _0x229528[_0xbfce('0x25')]();};}function saveUpdates(_0x1183ac,_0x3272dd){return function(_0x16aba1){if(_0x16aba1){return _0x16aba1[_0xbfce('0x26')](_0x1183ac)[_0xbfce('0x27')](function(_0x463613){return _0x463613;});}return null;};}function removeEntity(_0x2d555a,_0x457c38){return function(_0x1a2fa4){if(_0x1a2fa4){return _0x1a2fa4[_0xbfce('0x28')]()[_0xbfce('0x27')](function(){_0x2d555a['status'](0xcc)[_0xbfce('0x1b')]();});}};}function handleEntityNotFound(_0x38c8bf,_0x72057a){return function(_0x3895d7){if(!_0x3895d7){_0x38c8bf[_0xbfce('0x1a')](0x194);}return _0x3895d7;};}function handleError(_0x3c0834,_0x2fc7af){_0x2fc7af=_0x2fc7af||0x1f4;return function(_0x1b4647){logger[_0xbfce('0x29')](_0x1b4647[_0xbfce('0x2a')]);if(_0x1b4647[_0xbfce('0x2b')]){delete _0x1b4647['name'];}_0x3c0834[_0xbfce('0x1c')](_0x2fc7af)[_0xbfce('0x2c')](_0x1b4647);};}exports['index']=function(_0x2dbb34,_0xc9cc5b){var _0x3aaee2={},_0x482286={},_0xce59ae={'count':0x0,'rows':[]};var _0x3c1fe0=_[_0xbfce('0x2d')](db[_0xbfce('0x2e')][_0xbfce('0x2f')],function(_0x5f02e9){return{'name':_0x5f02e9['fieldName'],'type':_0x5f02e9['type']['key']};});_0x482286[_0xbfce('0x30')]=_['map'](_0x3c1fe0,'name');_0x482286['query']=_[_0xbfce('0x31')](_0x2dbb34[_0xbfce('0x32')]);_0x482286['filters']=_[_0xbfce('0x33')](_0x482286[_0xbfce('0x30')],_0x482286[_0xbfce('0x32')]);_0x3aaee2['attributes']=_[_0xbfce('0x33')](_0x482286[_0xbfce('0x30')],qs['fields'](_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x34')]));_0x3aaee2[_0xbfce('0x35')]=_0x3aaee2[_0xbfce('0x35')][_0xbfce('0x36')]?_0x3aaee2[_0xbfce('0x35')]:_0x482286[_0xbfce('0x30')];if(!_0x2dbb34['query'][_0xbfce('0x37')](_0xbfce('0x38'))){_0x3aaee2[_0xbfce('0x20')]=qs[_0xbfce('0x20')](_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x20')]);_0x3aaee2[_0xbfce('0x1e')]=qs[_0xbfce('0x1e')](_0x2dbb34[_0xbfce('0x32')]['offset']);}_0x3aaee2['order']=qs[_0xbfce('0x39')](_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x39')]);_0x3aaee2[_0xbfce('0x3a')]=qs[_0xbfce('0x3b')](_[_0xbfce('0x3c')](_0x2dbb34['query'],_0x482286[_0xbfce('0x3b')]),_0x3c1fe0);if(_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x3d')]){_0x3aaee2['where']=_[_0xbfce('0x3e')](_0x3aaee2[_0xbfce('0x3a')],{'$or':_['map'](_0x3c1fe0,function(_0x52d882){if(_0x52d882[_0xbfce('0x3f')]!=='VIRTUAL'){var _0x75d070={};_0x75d070[_0x52d882[_0xbfce('0x2b')]]={'$like':'%'+_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x3d')]+'%'};return _0x75d070;}})});}_0x3aaee2=_[_0xbfce('0x3e')]({},_0x3aaee2,_0x2dbb34[_0xbfce('0x40')]);var _0x45e73f={'where':_0x3aaee2['where']};return db['CmHopperHistory'][_0xbfce('0x21')](_0x45e73f)[_0xbfce('0x27')](function(_0x5077f4){_0xce59ae['count']=_0x5077f4;if(_0x2dbb34[_0xbfce('0x32')][_0xbfce('0x41')]){_0x3aaee2['include']=[{'all':!![]}];}return db[_0xbfce('0x2e')]['findAll'](_0x3aaee2);})['then'](function(_0x5a7d7b){_0xce59ae['rows']=_0x5a7d7b;return _0xce59ae;})[_0xbfce('0x27')](respondWithFilteredResult(_0xc9cc5b,_0x3aaee2))[_0xbfce('0x42')](handleError(_0xc9cc5b,null));};exports['show']=function(_0x512350,_0x5d3ed6){var _0x39a6fa={'raw':!![],'where':{'id':_0x512350[_0xbfce('0x43')]['id']}},_0x1b313d={};_0x1b313d[_0xbfce('0x30')]=_[_0xbfce('0x31')](db[_0xbfce('0x2e')][_0xbfce('0x2f')]);_0x1b313d[_0xbfce('0x32')]=_[_0xbfce('0x31')](_0x512350[_0xbfce('0x32')]);_0x1b313d[_0xbfce('0x3b')]=_[_0xbfce('0x33')](_0x1b313d[_0xbfce('0x30')],_0x1b313d['query']);_0x39a6fa[_0xbfce('0x35')]=_[_0xbfce('0x33')](_0x1b313d['model'],qs[_0xbfce('0x34')](_0x512350[_0xbfce('0x32')][_0xbfce('0x34')]));_0x39a6fa[_0xbfce('0x35')]=_0x39a6fa['attributes'][_0xbfce('0x36')]?_0x39a6fa['attributes']:_0x1b313d['model'];if(_0x512350[_0xbfce('0x32')][_0xbfce('0x41')]){_0x39a6fa[_0xbfce('0x44')]=[{'all':!![]}];}_0x39a6fa=_[_0xbfce('0x3e')]({},_0x39a6fa,_0x512350[_0xbfce('0x40')]);return db[_0xbfce('0x2e')][_0xbfce('0x45')](_0x39a6fa)[_0xbfce('0x27')](handleEntityNotFound(_0x5d3ed6,null))['then'](respondWithResult(_0x5d3ed6,null))[_0xbfce('0x42')](handleError(_0x5d3ed6,null));};exports[_0xbfce('0x46')]=function(_0x590689,_0x2a2262){return db['CmHopperHistory'][_0xbfce('0x46')](_0x590689[_0xbfce('0x47')],{})[_0xbfce('0x27')](respondWithResult(_0x2a2262,0xc9))[_0xbfce('0x42')](handleError(_0x2a2262,null));};exports[_0xbfce('0x48')]=function(_0x87891c,_0x1babf0){return db['CmHopperHistory'][_0xbfce('0x48')]()[_0xbfce('0x27')](respondWithResult(_0x1babf0,null))['catch'](handleError(_0x1babf0,null));};exports['update']=function(_0x54c0cd,_0xde43ba){if(_0x54c0cd[_0xbfce('0x47')][_0xbfce('0x49')]){delete _0x54c0cd['body'][_0xbfce('0x49')];}return db[_0xbfce('0x2e')][_0xbfce('0x45')]({'where':{'uniqueid':_0x54c0cd[_0xbfce('0x43')]['id']}})[_0xbfce('0x27')](handleEntityNotFound(_0xde43ba,null))['then'](saveUpdates(_0x54c0cd[_0xbfce('0x47')],null))[_0xbfce('0x27')](respondWithResult(_0xde43ba,null))[_0xbfce('0x42')](handleError(_0xde43ba,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b256e06..dfbb07f 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 _0xc6a2=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xc6a2,0x69));var _0x2c6a=function(_0x105a78,_0x2a5c8c){_0x105a78=_0x105a78-0x0;var _0xd332d9=_0xc6a2[_0x105a78];return _0xd332d9;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var logger=require('../../config/logger')(_0x2c6a('0x2'));var moment=require(_0x2c6a('0x3'));var BPromise=require(_0x2c6a('0x4'));var rp=require(_0x2c6a('0x5'));var fs=require('fs');var path=require(_0x2c6a('0x6'));var rimraf=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var attributes=require(_0x2c6a('0x9'));module[_0x2c6a('0xa')]=function(_0x3c7e44,_0x4559d8){return _0x3c7e44[_0x2c6a('0xb')](_0x2c6a('0xc'),attributes,{'tableName':_0x2c6a('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x2c6a('0xe')]},{'name':_0x2c6a('0xf'),'fields':[_0x2c6a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8276=['moment','bluebird','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x50c2c8,_0x17421e){var _0x55f8a3=function(_0x1fb37e){while(--_0x1fb37e){_0x50c2c8['push'](_0x50c2c8['shift']());}};_0x55f8a3(++_0x17421e);}(_0x8276,0xa7));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6827('0x2'));var BPromise=require(_0x6827('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6827('0x4'));var rimraf=require(_0x6827('0x5'));var config=require('../../config/environment');var attributes=require(_0x6827('0x6'));module[_0x6827('0x7')]=function(_0xc96297,_0x1c7983){return _0xc96297[_0x6827('0x8')](_0x6827('0x9'),attributes,{'tableName':_0x6827('0xa'),'paranoid':![],'indexes':[{'name':_0x6827('0xb'),'fields':[_0x6827('0xb')]},{'name':'uniqueid','fields':[_0x6827('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7cfc6c6..ea54e2d 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 _0xa477=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash'];(function(_0x20f65e,_0x539a66){var _0x265109=function(_0x85473e){while(--_0x85473e){_0x20f65e['push'](_0x20f65e['shift']());}};_0x265109(++_0x539a66);}(_0xa477,0xe6));var _0x7a47=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa477[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')](_0x5a4e79[_0x7a47('0x1b')],{'raw':_0x5a4e79[_0x7a47('0x1c')]?_0x5a4e79[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![]})[_0x7a47('0xd')](function(_0x46e58d){logger['info'](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON[_0x7a47('0x13')](_0x46e58d));_0x4a24b6(_0x46e58d);})[_0x7a47('0x1e')](function(_0x322426){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x322426[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x322426[_0x7a47('0x16')]));});});};exports[_0x7a47('0x1f')]=function(_0x4ec7ff){var _0x4ef642=this;return new Promise(function(_0xcc1c6a,_0x2c2c43){return db[_0x7a47('0x19')][_0x7a47('0x20')]({'raw':_0x4ec7ff['options']?_0x4ec7ff[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ec7ff['options']?_0x4ec7ff[_0x7a47('0x1c')][_0x7a47('0x21')]||null:null,'attributes':[[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['col']('id')),_0x7a47('0x24')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x7a47('0x25')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x27')))),_0x7a47('0x28')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7a47('0x29')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x2a'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')]['literal'](_0x7a47('0x2b')))),_0x7a47('0x2c')],[db['sequelize']['fn']('AVG',db[_0x7a47('0x22')]['fn']('IF',db['sequelize'][_0x7a47('0x26')](_0x7a47('0x2d')))),_0x7a47('0x2e')]]})[_0x7a47('0xd')](function(_0x20deaf){logger[_0x7a47('0xe')](_0x7a47('0x1f'),_0x4ec7ff);logger[_0x7a47('0x11')](_0x7a47('0x1f'),_0x4ec7ff,JSON[_0x7a47('0x13')](_0x20deaf));_0xcc1c6a(_0x20deaf);})[_0x7a47('0x1e')](function(_0x5835ec){logger[_0x7a47('0x14')]('AvgHandleTime',_0x5835ec[_0x7a47('0x16')],_0x4ec7ff);_0x2c2c43(_0x4ef642[_0x7a47('0x14')](0x1f4,_0x5835ec[_0x7a47('0x16')]));});});};exports[_0x7a47('0x2f')]=function(_0x2ea3f7){var _0xdda0ac=this;return new Promise(function(_0x48bbb1,_0x4930e0){return db[_0x7a47('0x19')][_0x7a47('0x20')]({'raw':_0x2ea3f7['options']?_0x2ea3f7['options'][_0x7a47('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ea3f7[_0x7a47('0x1c')]?_0x2ea3f7[_0x7a47('0x1c')]['where']||null:null,'attributes':[[_0x7a47('0x30'),_0x7a47('0x31')],[db['sequelize']['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x32')))),_0x7a47('0x33')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x34')))),_0x7a47('0x35')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db['sequelize']['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x36')))),_0x7a47('0x37')],[db['sequelize']['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x38')))),_0x7a47('0x39')],[db['sequelize']['fn']('COUNT',db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x3a')))),_0x7a47('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7a47('0x3c')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x3d')))),_0x7a47('0x3e')],[db[_0x7a47('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x3f')))),_0x7a47('0x40')],[db['sequelize']['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')]['literal'](_0x7a47('0x41')))),_0x7a47('0x42')],[db[_0x7a47('0x22')]['fn']('COUNT',db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')]['literal'](_0x7a47('0x43')))),_0x7a47('0x44')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x45')))),_0x7a47('0x46')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db['sequelize']['fn']('IF',db[_0x7a47('0x22')]['literal'](_0x7a47('0x47')))),_0x7a47('0x44')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')](_0x7a47('0x48')))),'outboundReCallsDay']],'group':[_0x7a47('0x30')]})['then'](function(_0xbd2b2c){logger[_0x7a47('0xe')](_0x7a47('0x2f'),_0x2ea3f7);logger[_0x7a47('0x11')]('GetVoiceQueueHopperHistory',_0x2ea3f7,JSON[_0x7a47('0x13')](_0xbd2b2c));_0x48bbb1(_0xbd2b2c);})['catch'](function(_0x2ec84b){logger['error'](_0x7a47('0x2f'),_0x2ec84b[_0x7a47('0x16')],_0x2ea3f7);_0x4930e0(_0xdda0ac[_0x7a47('0x14')](0x1f4,_0x2ec84b[_0x7a47('0x16')]));});});};exports['GetCampaignHopperHistory']=function(_0x13f331){var _0x577719=this;return new Promise(function(_0xd2ac0e,_0x54d5c8){return db[_0x7a47('0x19')]['findAll']({'raw':_0x13f331['options']?_0x13f331['options'][_0x7a47('0x1d')]===undefined?!![]:![]:!![],'where':_0x13f331[_0x7a47('0x1c')]?_0x13f331[_0x7a47('0x1c')][_0x7a47('0x21')]||null:null,'attributes':[['campaign',_0x7a47('0x31')],[db[_0x7a47('0x22')]['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')][_0x7a47('0x49')]('id')),_0x7a47('0x4a')],[db['sequelize']['fn'](_0x7a47('0x23'),db[_0x7a47('0x22')]['fn']('IF',db[_0x7a47('0x22')][_0x7a47('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x7a47('0x4b')]],'group':[_0x7a47('0x30')]})[_0x7a47('0xd')](function(_0x564db8){logger['info'](_0x7a47('0x4c'),_0x13f331);logger[_0x7a47('0x11')](_0x7a47('0x4c'),_0x13f331,JSON[_0x7a47('0x13')](_0x564db8));_0xd2ac0e(_0x564db8);})[_0x7a47('0x1e')](function(_0x343173){logger[_0x7a47('0x14')](_0x7a47('0x4c'),_0x343173[_0x7a47('0x16')],_0x13f331);_0x54d5c8(_0x577719['error'](0x1f4,_0x343173[_0x7a47('0x16')]));});});}; \ No newline at end of file +var _0x6d4a=['GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','where','sequelize','col','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','stringify','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory'];(function(_0x3f4030,_0xd488eb){var _0x587095=function(_0x20dc58){while(--_0x20dc58){_0x3f4030['push'](_0x3f4030['shift']());}};_0x587095(++_0xd488eb);}(_0x6d4a,0x117));var _0xa6d4=function(_0x36c116,_0xf005b5){_0x36c116=_0x36c116-0x0;var _0x61f0a=_0x6d4a[_0x36c116];return _0x61f0a;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require(_0xa6d4('0x6'));var logger=require(_0xa6d4('0x7'))(_0xa6d4('0x8'));var config=require(_0xa6d4('0x9'));var jayson=require(_0xa6d4('0xa'));var client=jayson[_0xa6d4('0xb')][_0xa6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x354148,_0x444bf9,_0x49a9e8){return new BPromise(function(_0x71ccfa,_0xc6d920){return client['request'](_0x354148,_0x49a9e8)[_0xa6d4('0xd')](function(_0x36af3a){logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));logger['debug'](_0xa6d4('0x11'),_0x444bf9,_0xa6d4('0x10'),JSON['stringify'](_0x36af3a));if(_0x36af3a[_0xa6d4('0x12')]){if(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x13')]===0x1f4){logger['error'](_0xa6d4('0xf'),_0x444bf9,_0x36af3a['error'][_0xa6d4('0x14')]);return _0xc6d920(_0x36af3a[_0xa6d4('0x12')]['message']);}logger[_0xa6d4('0x12')](_0xa6d4('0xf'),_0x444bf9,_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);return _0x71ccfa(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);}else{logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));_0x71ccfa(_0x36af3a[_0xa6d4('0x15')][_0xa6d4('0x14')]);}})[_0xa6d4('0x16')](function(_0x518a73){logger[_0xa6d4('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x444bf9,_0x518a73);_0xc6d920(_0x518a73);});});}exports[_0xa6d4('0x17')]=function(_0x474b62){var _0x4533ea=this;return new Promise(function(_0x4a7af1,_0x12226a){return db[_0xa6d4('0x18')]['create'](_0x474b62[_0xa6d4('0x19')],{'raw':_0x474b62[_0xa6d4('0x1a')]?_0x474b62[_0xa6d4('0x1a')][_0xa6d4('0x1b')]===undefined?!![]:![]:!![]})[_0xa6d4('0xd')](function(_0x5c40f5){logger[_0xa6d4('0xe')](_0xa6d4('0x17'),_0x474b62);logger[_0xa6d4('0x1c')]('CreateCmHopperHistory',_0x474b62,JSON['stringify'](_0x5c40f5));_0x4a7af1(_0x5c40f5);})[_0xa6d4('0x16')](function(_0x32bea3){logger[_0xa6d4('0x12')](_0xa6d4('0x17'),_0x32bea3[_0xa6d4('0x14')],_0x474b62);_0x12226a(_0x4533ea[_0xa6d4('0x12')](0x1f4,_0x32bea3['message']));});});};exports[_0xa6d4('0x1d')]=function(_0xd4a69e){var _0xfa4806=this;return new Promise(function(_0x46c48e,_0x27ecc6){return db[_0xa6d4('0x18')]['findAll']({'raw':_0xd4a69e[_0xa6d4('0x1a')]?_0xd4a69e['options'][_0xa6d4('0x1b')]===undefined?!![]:![]:!![],'where':_0xd4a69e['options']?_0xd4a69e[_0xa6d4('0x1a')][_0xa6d4('0x1e')]||null:null,'attributes':[[db[_0xa6d4('0x1f')]['fn']('COUNT',db[_0xa6d4('0x1f')][_0xa6d4('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xa6d4('0x22')](_0xa6d4('0x23')))),_0xa6d4('0x24')],[db['sequelize']['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x25')))),_0xa6d4('0x26')],[db[_0xa6d4('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x27')))),_0xa6d4('0x28')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x29'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa6d4('0x2a')]]})['then'](function(_0x1e0e2c){logger[_0xa6d4('0xe')](_0xa6d4('0x1d'),_0xd4a69e);logger[_0xa6d4('0x1c')](_0xa6d4('0x1d'),_0xd4a69e,JSON[_0xa6d4('0x2b')](_0x1e0e2c));_0x46c48e(_0x1e0e2c);})[_0xa6d4('0x16')](function(_0x4dcc1b){logger['error'](_0xa6d4('0x1d'),_0x4dcc1b[_0xa6d4('0x14')],_0xd4a69e);_0x27ecc6(_0xfa4806['error'](0x1f4,_0x4dcc1b[_0xa6d4('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x145860){var _0x37e796=this;return new Promise(function(_0x52f2e3,_0x5f0f00){return db[_0xa6d4('0x18')][_0xa6d4('0x2c')]({'raw':_0x145860['options']?_0x145860[_0xa6d4('0x1a')][_0xa6d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x145860[_0xa6d4('0x1a')]?_0x145860[_0xa6d4('0x1a')][_0xa6d4('0x1e')]||null:null,'attributes':[[_0xa6d4('0x2d'),_0xa6d4('0x2e')],[db['sequelize']['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db['sequelize'][_0xa6d4('0x22')](_0xa6d4('0x2f')))),'outboundNoSuchCallsDay'],[db[_0xa6d4('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x30')))),_0xa6d4('0x31')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x23')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xa6d4('0x21'),db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0xa6d4('0x32')],[db['sequelize']['fn']('COUNT',db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x33')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xa6d4('0x21'),db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x34')))),_0xa6d4('0x35')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x36')))),_0xa6d4('0x37')],[db['sequelize']['fn'](_0xa6d4('0x21'),db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x38')))),'outboundUnknownCallsDay'],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db['sequelize']['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x39')))),_0xa6d4('0x3a')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x3b')))),_0xa6d4('0x3c')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x3d')))),'outboundRejectCallsDay'],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa6d4('0x3e')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')][_0xa6d4('0x22')](_0xa6d4('0x3f')))),_0xa6d4('0x40')]],'group':[_0xa6d4('0x2d')]})['then'](function(_0x2227a4){logger[_0xa6d4('0xe')](_0xa6d4('0x41'),_0x145860);logger['debug']('GetVoiceQueueHopperHistory',_0x145860,JSON[_0xa6d4('0x2b')](_0x2227a4));_0x52f2e3(_0x2227a4);})[_0xa6d4('0x16')](function(_0x5ce0c9){logger[_0xa6d4('0x12')](_0xa6d4('0x41'),_0x5ce0c9[_0xa6d4('0x14')],_0x145860);_0x5f0f00(_0x37e796['error'](0x1f4,_0x5ce0c9[_0xa6d4('0x14')]));});});};exports[_0xa6d4('0x42')]=function(_0x2ff28b){var _0x1e0ab7=this;return new Promise(function(_0xc232a2,_0x5db317){return db[_0xa6d4('0x18')][_0xa6d4('0x2c')]({'raw':_0x2ff28b[_0xa6d4('0x1a')]?_0x2ff28b[_0xa6d4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff28b[_0xa6d4('0x1a')]?_0x2ff28b['options']['where']||null:null,'attributes':[[_0xa6d4('0x2d'),'name'],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')][_0xa6d4('0x20')]('id')),_0xa6d4('0x43')],[db[_0xa6d4('0x1f')]['fn'](_0xa6d4('0x21'),db[_0xa6d4('0x1f')]['fn']('IF',db[_0xa6d4('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xa6d4('0x44')]],'group':[_0xa6d4('0x2d')]})[_0xa6d4('0xd')](function(_0x53e2d5){logger[_0xa6d4('0xe')](_0xa6d4('0x42'),_0x2ff28b);logger[_0xa6d4('0x1c')](_0xa6d4('0x42'),_0x2ff28b,JSON[_0xa6d4('0x2b')](_0x53e2d5));_0xc232a2(_0x53e2d5);})[_0xa6d4('0x16')](function(_0xad2bf8){logger[_0xa6d4('0x12')](_0xa6d4('0x42'),_0xad2bf8[_0xa6d4('0x14')],_0x2ff28b);_0x5db317(_0x1e0ab7[_0xa6d4('0x12')](0x1f4,_0xad2bf8[_0xa6d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0e5cfae..d7b94f4 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 _0xcf1d=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2948c7,_0x306864){var _0x46a0b7=function(_0x43882f){while(--_0x43882f){_0x2948c7['push'](_0x2948c7['shift']());}};_0x46a0b7(++_0x306864);}(_0xcf1d,0x193));var _0xdcf1=function(_0x586417,_0x20192f){_0x586417=_0x586417-0x0;var _0x5a1138=_0xcf1d[_0x586417];return _0x5a1138;};'use strict';var multer=require(_0xdcf1('0x0'));var util=require('util');var path=require(_0xdcf1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdcf1('0x2'));var auth=require(_0xdcf1('0x3'));var interaction=require(_0xdcf1('0x4'));var config=require(_0xdcf1('0x5'));var controller=require(_0xdcf1('0x6'));router[_0xdcf1('0x7')]('/',auth[_0xdcf1('0x8')](),controller[_0xdcf1('0x9')]);router[_0xdcf1('0x7')](_0xdcf1('0xa'),auth[_0xdcf1('0x8')](),controller[_0xdcf1('0xb')]);router[_0xdcf1('0x7')](_0xdcf1('0xc'),auth['isAuthenticated'](),controller[_0xdcf1('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcf1('0xe')]);router[_0xdcf1('0xf')](_0xdcf1('0xc'),auth[_0xdcf1('0x8')](),controller['update']);module[_0xdcf1('0x10')]=router; \ No newline at end of file +var _0xa8e8=['create','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa8e8,0x11f));var _0x8a8e=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0xa8e8[_0x4969d0];return _0x754944;};'use strict';var multer=require(_0x8a8e('0x0'));var util=require(_0x8a8e('0x1'));var path=require(_0x8a8e('0x2'));var timeout=require(_0x8a8e('0x3'));var express=require(_0x8a8e('0x4'));var router=express[_0x8a8e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a8e('0x6'));var interaction=require(_0x8a8e('0x7'));var config=require(_0x8a8e('0x8'));var controller=require(_0x8a8e('0x9'));router[_0x8a8e('0xa')]('/',auth[_0x8a8e('0xb')](),controller[_0x8a8e('0xc')]);router['get'](_0x8a8e('0xd'),auth[_0x8a8e('0xb')](),controller['describe']);router[_0x8a8e('0xa')](_0x8a8e('0xe'),auth[_0x8a8e('0xb')](),controller[_0x8a8e('0xf')]);router[_0x8a8e('0x10')]('/',auth[_0x8a8e('0xb')](),controller[_0x8a8e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x8a8e('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 9713e4b..ecc4f11 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 _0x1a28=['STRING','name','sequelize','exports'];(function(_0x4fd490,_0x358269){var _0x3a24cf=function(_0x20e228){while(--_0x20e228){_0x4fd490['push'](_0x4fd490['shift']());}};_0x3a24cf(++_0x358269);}(_0x1a28,0x10e));var _0x81a2=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x1a28[_0x21f9c2];return _0x3da17f;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'name':{'type':Sequelize[_0x81a2('0x2')],'unique':_0x81a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x81a2('0x2')]},'dialPrefix':{'type':Sequelize[_0x81a2('0x2')]}}; \ No newline at end of file +var _0x15cb=['STRING','exports','name'];(function(_0xa2836c,_0x206339){var _0x1c1df7=function(_0x518f9a){while(--_0x518f9a){_0xa2836c['push'](_0xa2836c['shift']());}};_0x1c1df7(++_0x206339);}(_0x15cb,0x16f));var _0xb15c=function(_0x58c627,_0x452888){_0x58c627=_0x58c627-0x0;var _0x135379=_0x15cb[_0x58c627];return _0x135379;};'use strict';var Sequelize=require('sequelize');module[_0xb15c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb15c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xb15c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9f5a999..67e8d49 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 _0x33d8=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','Lists','destroy','stack','name','send','index','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','CmList','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','fields','nolimit','order','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','omit','ids','success','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','getContactsCsv','CmCustomField','raw','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','transaction','Sequelize','TEXT','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x33d8,0x1a7));var _0x833d=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x33d8[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x833d('0x0'));var zipdir=require(_0x833d('0x1'));var jsonpatch=require(_0x833d('0x2'));var rp=require(_0x833d('0x3'));var moment=require(_0x833d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x833d('0x5'));var util=require(_0x833d('0x6'));var path=require('path');var sox=require(_0x833d('0x7'));var csv=require(_0x833d('0x8'));var ejs=require(_0x833d('0x9'));var fs=require('fs');var fs_extra=require(_0x833d('0xa'));var _=require(_0x833d('0xb'));var squel=require(_0x833d('0xc'));var crypto=require(_0x833d('0xd'));var jsforce=require(_0x833d('0xe'));var deskjs=require(_0x833d('0xf'));var toCsv=require(_0x833d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x833d('0x10'));var authService=require(_0x833d('0x11'));var qs=require(_0x833d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833d('0x13'));var logger=require(_0x833d('0x14'))(_0x833d('0x15'));var utils=require(_0x833d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x833d('0x17'));var db=require('../../mysqldb')['db'];config[_0x833d('0x18')]=_[_0x833d('0x19')](config[_0x833d('0x18')],{'host':_0x833d('0x1a'),'port':0x18eb});var socket=require(_0x833d('0x1b'))(new Redis(config[_0x833d('0x18')]));require('./cmList.socket')[_0x833d('0x1c')](socket);function respondWithStatusCode(_0xb550b2,_0x1665eb){_0x1665eb=_0x1665eb||0xcc;return function(_0xc3b56a){if(_0xc3b56a){return _0xb550b2[_0x833d('0x1d')](_0x1665eb);}return _0xb550b2[_0x833d('0x1e')](_0x1665eb)[_0x833d('0x1f')]();};}function respondWithResult(_0x1436d5,_0x114879){_0x114879=_0x114879||0xc8;return function(_0x4f2f09){if(_0x4f2f09){return _0x1436d5['status'](_0x114879)['json'](_0x4f2f09);}};}function respondWithFilteredResult(_0xb3dd1,_0x35b42e){return function(_0x48abe3){if(_0x48abe3){var _0xdfda88=typeof _0x35b42e[_0x833d('0x20')]===_0x833d('0x21')&&typeof _0x35b42e[_0x833d('0x22')]===_0x833d('0x21');var _0x313d30=_0x48abe3[_0x833d('0x23')];var _0x22a05a=_0xdfda88?0x0:_0x35b42e[_0x833d('0x20')];var _0xa96fd9=_0xdfda88?_0x48abe3[_0x833d('0x23')]:_0x35b42e[_0x833d('0x20')]+_0x35b42e[_0x833d('0x22')];var _0x49ffbb;if(_0xa96fd9>=_0x313d30){_0xa96fd9=_0x313d30;_0x49ffbb=0xc8;}else{_0x49ffbb=0xce;}_0xb3dd1[_0x833d('0x1e')](_0x49ffbb);return _0xb3dd1['set'](_0x833d('0x24'),_0x22a05a+'-'+_0xa96fd9+'/'+_0x313d30)['json'](_0x48abe3);}return null;};}function patchUpdates(_0x1291fb){return function(_0x29b73e){try{jsonpatch[_0x833d('0x25')](_0x29b73e,_0x1291fb,!![]);}catch(_0x12e1f2){return BPromise['reject'](_0x12e1f2);}return _0x29b73e[_0x833d('0x26')]();};}function saveUpdates(_0x19864a,_0x139964){return function(_0x2f77f5){if(_0x2f77f5){return _0x2f77f5[_0x833d('0x27')](_0x19864a)[_0x833d('0x28')](function(_0xab70ec){return _0xab70ec;});}return null;};}function removeEntity(_0x422e26,_0x5336fe){return function(_0x720a8f){if(_0x720a8f){return _0x720a8f['destroy']()[_0x833d('0x28')](function(){var _0xb0ea3f=_0x720a8f[_0x833d('0x29')]({'plain':!![]});var _0x2a24a8=_0x833d('0x2a');return db['UserProfileResource'][_0x833d('0x2b')]({'where':{'type':_0x2a24a8,'resourceId':_0xb0ea3f['id']}})[_0x833d('0x28')](function(){return _0x720a8f;});})[_0x833d('0x28')](function(){_0x422e26[_0x833d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb4d66,_0x31db6d){return function(_0x24b0a3){if(!_0x24b0a3){_0xeb4d66[_0x833d('0x1d')](0x194);}return _0x24b0a3;};}function handleError(_0x3ae51c,_0x341160){_0x341160=_0x341160||0x1f4;return function(_0x509b69){logger['error'](_0x509b69[_0x833d('0x2c')]);if(_0x509b69[_0x833d('0x2d')]){delete _0x509b69['name'];}_0x3ae51c['status'](_0x341160)[_0x833d('0x2e')](_0x509b69);};}exports[_0x833d('0x2f')]=function(_0x5deb24,_0x3c6dda){var _0x768d0d={},_0x3541b2={},_0x2898ba={'count':0x0,'rows':[]};var _0x11753e=_['map'](db['CmList']['rawAttributes'],function(_0x219197){return{'name':_0x219197[_0x833d('0x30')],'type':_0x219197[_0x833d('0x31')][_0x833d('0x32')]};});_0x3541b2['model']=_[_0x833d('0x33')](_0x11753e,_0x833d('0x2d'));_0x3541b2['query']=_[_0x833d('0x34')](_0x5deb24[_0x833d('0x35')]);_0x3541b2[_0x833d('0x36')]=_[_0x833d('0x37')](_0x3541b2[_0x833d('0x38')],_0x3541b2['query']);_0x768d0d[_0x833d('0x39')]=_[_0x833d('0x37')](_0x3541b2[_0x833d('0x38')],qs['fields'](_0x5deb24[_0x833d('0x35')]['fields']));_0x768d0d[_0x833d('0x39')]=_0x768d0d[_0x833d('0x39')][_0x833d('0x3a')]?_0x768d0d[_0x833d('0x39')]:_0x3541b2[_0x833d('0x38')];if(!_0x5deb24['query'][_0x833d('0x3b')]('nolimit')){_0x768d0d['limit']=qs['limit'](_0x5deb24['query'][_0x833d('0x22')]);_0x768d0d[_0x833d('0x20')]=qs['offset'](_0x5deb24[_0x833d('0x35')][_0x833d('0x20')]);}_0x768d0d['order']=qs[_0x833d('0x3c')](_0x5deb24[_0x833d('0x35')][_0x833d('0x3c')]);_0x768d0d[_0x833d('0x3d')]=qs[_0x833d('0x36')](_[_0x833d('0x3e')](_0x5deb24['query'],_0x3541b2[_0x833d('0x36')]),_0x11753e);if(_0x5deb24[_0x833d('0x35')][_0x833d('0x3f')]){_0x768d0d[_0x833d('0x3d')]=_[_0x833d('0x40')](_0x768d0d[_0x833d('0x3d')],{'$or':_[_0x833d('0x33')](_0x11753e,function(_0x4eb9df){if(_0x4eb9df[_0x833d('0x31')]!==_0x833d('0x41')){var _0x3081bd={};_0x3081bd[_0x4eb9df[_0x833d('0x2d')]]={'$like':'%'+_0x5deb24[_0x833d('0x35')][_0x833d('0x3f')]+'%'};return _0x3081bd;}})});}_0x768d0d=_[_0x833d('0x40')]({},_0x768d0d,_0x5deb24[_0x833d('0x42')]);var _0x2ffda6={'where':_0x768d0d[_0x833d('0x3d')]};return db['CmList'][_0x833d('0x23')](_0x2ffda6)[_0x833d('0x28')](function(_0x12f095){_0x2898ba['count']=_0x12f095;if(_0x5deb24[_0x833d('0x35')]['includeAll']){_0x768d0d[_0x833d('0x43')]=[{'all':!![]}];}return db[_0x833d('0x44')][_0x833d('0x45')](_0x768d0d);})[_0x833d('0x28')](function(_0x53e908){_0x2898ba[_0x833d('0x46')]=_0x53e908;return _0x2898ba;})[_0x833d('0x28')](respondWithFilteredResult(_0x3c6dda,_0x768d0d))[_0x833d('0x47')](handleError(_0x3c6dda,null));};exports[_0x833d('0x48')]=function(_0x2a574f,_0x227ab6){var _0x4a11e1={'raw':![],'where':{'id':_0x2a574f[_0x833d('0x49')]['id']}},_0x2741d9={};_0x2741d9[_0x833d('0x38')]=_['keys'](db['CmList'][_0x833d('0x4a')]);_0x2741d9['query']=_['keys'](_0x2a574f[_0x833d('0x35')]);_0x2741d9[_0x833d('0x36')]=_['intersection'](_0x2741d9[_0x833d('0x38')],_0x2741d9[_0x833d('0x35')]);_0x4a11e1[_0x833d('0x39')]=_[_0x833d('0x37')](_0x2741d9[_0x833d('0x38')],qs['fields'](_0x2a574f['query']['fields']));_0x4a11e1[_0x833d('0x39')]=_0x4a11e1[_0x833d('0x39')][_0x833d('0x3a')]?_0x4a11e1[_0x833d('0x39')]:_0x2741d9['model'];if(_0x2a574f[_0x833d('0x35')][_0x833d('0x4b')]){_0x4a11e1[_0x833d('0x43')]=[{'all':!![]}];}_0x4a11e1=_[_0x833d('0x40')]({},_0x4a11e1,_0x2a574f['options']);return db[_0x833d('0x44')][_0x833d('0x4c')](_0x4a11e1)['then'](handleEntityNotFound(_0x227ab6,null))[_0x833d('0x28')](respondWithResult(_0x227ab6,null))['catch'](handleError(_0x227ab6,null));};exports[_0x833d('0x4d')]=function(_0xbef324,_0x243c92){return db[_0x833d('0x44')][_0x833d('0x4d')](_0xbef324[_0x833d('0x4e')],{})[_0x833d('0x28')](function(_0x496919){var _0x30bacb=_0xbef324[_0x833d('0x4f')]['get']({'plain':!![]});if(!_0x30bacb)throw new Error(_0x833d('0x50'));if(_0x30bacb[_0x833d('0x51')]==='user'){var _0x247d75=_0x496919['get']({'plain':!![]});var _0x2cf028='Lists';return db[_0x833d('0x52')][_0x833d('0x4c')]({'where':{'name':_0x2cf028,'userProfileId':_0x30bacb[_0x833d('0x53')]},'raw':!![]})[_0x833d('0x28')](function(_0x56bfa9){if(_0x56bfa9&&_0x56bfa9[_0x833d('0x54')]===0x0){return db['UserProfileResource'][_0x833d('0x4d')]({'name':_0x247d75[_0x833d('0x2d')],'resourceId':_0x247d75['id'],'type':_0x56bfa9['name'],'sectionId':_0x56bfa9['id']},{})[_0x833d('0x28')](function(){return _0x496919;});}else{return _0x496919;}})['catch'](function(_0x213bec){logger[_0x833d('0x55')](_0x833d('0x56'),_0x213bec);throw _0x213bec;});}return _0x496919;})['then'](respondWithResult(_0x243c92,0xc9))[_0x833d('0x47')](handleError(_0x243c92,null));};exports[_0x833d('0x27')]=function(_0x522e53,_0x20360d){if(_0x522e53[_0x833d('0x4e')]['id']){delete _0x522e53[_0x833d('0x4e')]['id'];}return db[_0x833d('0x44')][_0x833d('0x4c')]({'where':{'id':_0x522e53[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x20360d,null))[_0x833d('0x28')](saveUpdates(_0x522e53['body'],null))[_0x833d('0x28')](respondWithResult(_0x20360d,null))[_0x833d('0x47')](handleError(_0x20360d,null));};exports['destroy']=function(_0x3cc807,_0xc283b5){return db['CmList']['find']({'where':{'id':_0x3cc807[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0xc283b5,null))[_0x833d('0x28')](removeEntity(_0xc283b5,null))['catch'](handleError(_0xc283b5,null));};exports['describe']=function(_0x180d4a,_0x421a07){return db[_0x833d('0x44')][_0x833d('0x57')]()[_0x833d('0x28')](respondWithResult(_0x421a07,null))[_0x833d('0x47')](handleError(_0x421a07,null));};exports['addDisposition']=function(_0x58cef1,_0x5182ff,_0x140c9a){if(_0x58cef1[_0x833d('0x4e')]['id']){delete _0x58cef1[_0x833d('0x4e')]['id'];}return db['CmList'][_0x833d('0x4c')]({'where':{'id':_0x58cef1[_0x833d('0x49')]['id']}})['then'](handleEntityNotFound(_0x5182ff,null))[_0x833d('0x28')](function(_0x5d2bb6){if(_0x5d2bb6){_0x58cef1[_0x833d('0x4e')][_0x833d('0x58')]=_0x5d2bb6['id'];return db[_0x833d('0x59')]['create'](_0x58cef1[_0x833d('0x4e')]);}})[_0x833d('0x28')](respondWithResult(_0x5182ff,null))[_0x833d('0x47')](handleError(_0x5182ff,null));};exports[_0x833d('0x5a')]=function(_0x2e90a7,_0xbf0a4e,_0x15e908){var _0x1d1f2f={'raw':![],'where':{}};var _0x5d053e={};var _0x45d2c7={'count':0x0,'rows':[]};return db[_0x833d('0x44')][_0x833d('0x5b')]({'where':{'id':_0x2e90a7[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0xbf0a4e,null))['then'](function(_0x21b52a){if(_0x21b52a){_0x5d053e[_0x833d('0x38')]=_[_0x833d('0x34')](db[_0x833d('0x59')][_0x833d('0x4a')]);_0x5d053e[_0x833d('0x35')]=_[_0x833d('0x34')](_0x2e90a7[_0x833d('0x35')]);_0x5d053e['filters']=_[_0x833d('0x37')](_0x5d053e['model'],_0x5d053e[_0x833d('0x35')]);_0x1d1f2f[_0x833d('0x39')]=_['intersection'](_0x5d053e[_0x833d('0x38')],qs['fields'](_0x2e90a7[_0x833d('0x35')][_0x833d('0x5c')]));_0x1d1f2f['attributes']=_0x1d1f2f['attributes']['length']?_0x1d1f2f[_0x833d('0x39')]:_0x5d053e[_0x833d('0x38')];if(!_0x2e90a7[_0x833d('0x35')]['hasOwnProperty'](_0x833d('0x5d'))){_0x1d1f2f[_0x833d('0x22')]=qs[_0x833d('0x22')](_0x2e90a7[_0x833d('0x35')]['limit']);_0x1d1f2f[_0x833d('0x20')]=qs[_0x833d('0x20')](_0x2e90a7[_0x833d('0x35')][_0x833d('0x20')]);}_0x1d1f2f[_0x833d('0x5e')]=qs[_0x833d('0x3c')](_0x2e90a7[_0x833d('0x35')][_0x833d('0x3c')]);_0x1d1f2f[_0x833d('0x3d')]=qs[_0x833d('0x36')](_[_0x833d('0x3e')](_0x2e90a7['query'],_0x5d053e[_0x833d('0x36')]));_0x1d1f2f['where']['ListId']=_0x21b52a['id'];if(_0x2e90a7[_0x833d('0x35')][_0x833d('0x3f')]){_0x1d1f2f[_0x833d('0x3d')]=_['merge'](_0x1d1f2f[_0x833d('0x3d')],{'$or':_[_0x833d('0x33')](_0x1d1f2f[_0x833d('0x39')],function(_0x4c0af2){var _0x1803a7={};_0x1803a7[_0x4c0af2]={'$like':'%'+_0x2e90a7[_0x833d('0x35')]['filter']+'%'};return _0x1803a7;})});}_0x1d1f2f=_['merge']({},_0x1d1f2f,_0x2e90a7[_0x833d('0x42')]);return db[_0x833d('0x59')]['count']({'where':_0x1d1f2f[_0x833d('0x3d')]})[_0x833d('0x28')](function(_0x2ed2bb){_0x45d2c7[_0x833d('0x23')]=_0x2ed2bb;if(_0x2e90a7['query']['includeAll']){_0x1d1f2f[_0x833d('0x43')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1d1f2f);})[_0x833d('0x28')](function(_0x1111af){_0x45d2c7[_0x833d('0x46')]=_0x1111af;return _0x45d2c7;});}})['then'](respondWithFilteredResult(_0xbf0a4e,_0x1d1f2f))['catch'](handleError(_0xbf0a4e,null));};exports['removeDispositions']=function(_0x1b71b3,_0x280c08,_0x16f92b){return db[_0x833d('0x44')]['find']({'where':{'id':_0x1b71b3[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x280c08,null))['then'](function(_0xfa77ab){if(_0xfa77ab){return _0xfa77ab[_0x833d('0x5f')](_0x1b71b3['query']['ids']);}})[_0x833d('0x28')](respondWithStatusCode(_0x280c08,null))['catch'](handleError(_0x280c08,null));};exports[_0x833d('0x60')]=function(_0x3ebd04,_0x42694d,_0x42326b){return db['CmList'][_0x833d('0x4c')]({'where':{'id':_0x3ebd04[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x42694d,null))[_0x833d('0x28')](function(_0x3af141){if(_0x3af141){var _0x3a3a0b=[];var _0x48c28f={'success':[],'errors':[]};return db[_0x833d('0x61')][_0x833d('0x57')]()[_0x833d('0x28')](function(_0x422d0d){if(_0x3ebd04['body'][_0x833d('0x62')]&&_['isArray'](_0x3ebd04[_0x833d('0x4e')][_0x833d('0x62')])){if(_0x3ebd04[_0x833d('0x4e')]['tags'][_0x833d('0x3a')]){_0x3ebd04[_0x833d('0x4e')][_0x833d('0x62')]=_0x3ebd04['body']['tags'][_0x833d('0x63')](';')+';';}else{_0x3ebd04['body']['tags']=null;}}else{_0x3ebd04[_0x833d('0x4e')][_0x833d('0x62')]=null;}if(_0x3ebd04[_0x833d('0x4e')]&&_[_0x833d('0x64')](_0x3ebd04['body'])){for(var _0x37e708=0x0;_0x37e708<_0x3ebd04['body'][_0x833d('0x3a')];_0x37e708+=0x1){_0x3ebd04[_0x833d('0x4e')][_0x37e708][_0x833d('0x58')]=_0x3ebd04[_0x833d('0x49')]['id'];_0x3a3a0b[_0x833d('0x65')](_0x3ebd04[_0x833d('0x4e')][_0x37e708]);}return BPromise[_0x833d('0x66')](_0x3a3a0b,function(_0x53b123){return db[_0x833d('0x61')][_0x833d('0x4d')](_[_0x833d('0x67')](_0x53b123,[_0x833d('0x68'),'id'])||{},{'fields':_[_0x833d('0x34')](_0x422d0d),'raw':!![]})[_0x833d('0x28')](function(_0xe1c795){_0x48c28f[_0x833d('0x69')][_0x833d('0x65')](_0xe1c795['dataValues']);})['catch'](function(_0xb2bc20){_0x48c28f[_0x833d('0x6a')]['push']({'data':_0x53b123,'error':_0xb2bc20[_0x833d('0x6b')]});});})[_0x833d('0x28')](function(_0x4b3f61){return _0x48c28f;})[_0x833d('0x47')](function(_0x2eb892){return _0x2eb892;});}else{_0x42694d[_0x833d('0x1e')](0x190)['json']({'message':_0x833d('0x6c')});}});}})[_0x833d('0x28')](respondWithResult(_0x42694d,null))['catch'](handleError(_0x42694d,null));};exports[_0x833d('0x6d')]=function(_0x5ac19a,_0x7d69b4,_0x36e6fa){var _0x5f2796;return db[_0x833d('0x44')]['find']({'where':{'id':_0x5ac19a['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x833d('0x6e')}]})['then'](handleEntityNotFound(_0x7d69b4,null))[_0x833d('0x28')](function(_0x3304d5){if(_0x3304d5){_0x5f2796=_0x3304d5;return db['CmContact']['rawAttributes'];}})['then'](function(_0xb7208d){if(_0xb7208d){var _0x8826bc={};var _0x245106={};_0x245106[_0x833d('0x38')]=_[_0x833d('0x6f')](_[_0x833d('0x34')](_0xb7208d),_[_0x833d('0x33')](_0x5f2796['CustomFields'],function(_0x52c559){return util[_0x833d('0x70')]('cf_%d',_0x52c559['id']);}));_0x245106[_0x833d('0x35')]=_[_0x833d('0x34')](_0x5ac19a[_0x833d('0x35')]);_0x245106[_0x833d('0x36')]=_[_0x833d('0x37')](_0x245106['model'],_0x245106[_0x833d('0x35')]);_0x8826bc[_0x833d('0x39')]=_[_0x833d('0x37')](_0x245106[_0x833d('0x38')],qs[_0x833d('0x5c')](_0x5ac19a[_0x833d('0x35')][_0x833d('0x5c')]));_0x8826bc[_0x833d('0x39')]=_0x8826bc['attributes']['length']?_0x8826bc[_0x833d('0x39')]:_0x245106['model'];if(!_0x5ac19a['query'][_0x833d('0x3b')]('nolimit')){_0x8826bc[_0x833d('0x22')]=qs[_0x833d('0x22')](_0x5ac19a[_0x833d('0x35')][_0x833d('0x22')]);_0x8826bc[_0x833d('0x20')]=qs[_0x833d('0x20')](_0x5ac19a[_0x833d('0x35')][_0x833d('0x20')]);}_0x8826bc['order']=qs[_0x833d('0x3c')](_0x5ac19a[_0x833d('0x35')]['sort']);_0x8826bc[_0x833d('0x3d')]=qs[_0x833d('0x36')](_[_0x833d('0x3e')](_0x5ac19a[_0x833d('0x35')],_0x245106['filters']));_0x8826bc['raw']=!![];if(_0x5ac19a[_0x833d('0x35')][_0x833d('0x3f')]){_0x8826bc['where']=_['merge'](_0x8826bc[_0x833d('0x3d')],{'$or':_[_0x833d('0x33')](_0x8826bc[_0x833d('0x39')],function(_0x4b5249){var _0x474207={};_0x474207[_0x4b5249]={'$like':'%'+_0x5ac19a[_0x833d('0x35')][_0x833d('0x3f')]+'%'};return _0x474207;})});}_0x8826bc=_['merge']({},_0x8826bc,_0x5ac19a[_0x833d('0x42')]);return _0x5f2796['getContacts'](_0x8826bc);}})['then'](respondWithResult(_0x7d69b4,null))[_0x833d('0x47')](handleError(_0x7d69b4,null));};exports[_0x833d('0x71')]=function(_0x46a962,_0x542896,_0xe50cfe){var _0x33375f;return db[_0x833d('0x44')][_0x833d('0x4c')]({'where':{'id':_0x46a962['params']['id']},'include':[{'model':db[_0x833d('0x72')],'as':'CustomFields'}]})[_0x833d('0x28')](handleEntityNotFound(_0x542896,null))['then'](function(_0x177179){if(_0x177179){_0x33375f=_0x177179;return db[_0x833d('0x61')][_0x833d('0x4a')];}})[_0x833d('0x28')](function(_0x394996){if(_0x394996){var _0xc3d6b5={};var _0x3de554={};_0x3de554[_0x833d('0x38')]=_['concat'](_[_0x833d('0x34')](_0x394996),_[_0x833d('0x33')](_0x33375f['CustomFields'],function(_0xe044d8){return util[_0x833d('0x70')]('cf_%d',_0xe044d8['id']);}));_0x3de554[_0x833d('0x35')]=_[_0x833d('0x34')](_0x46a962[_0x833d('0x35')]);_0x3de554['filters']=_[_0x833d('0x37')](_0x3de554[_0x833d('0x38')],_0x3de554[_0x833d('0x35')]);_0xc3d6b5['attributes']=_['intersection'](_0x3de554[_0x833d('0x38')],qs['fields'](_0x46a962[_0x833d('0x35')]['fields']));_0xc3d6b5[_0x833d('0x39')]=_0xc3d6b5[_0x833d('0x39')]['length']?_0xc3d6b5['attributes']:_0x3de554['model'];if(!_0x46a962[_0x833d('0x35')][_0x833d('0x3b')](_0x833d('0x5d'))){_0xc3d6b5[_0x833d('0x22')]=qs[_0x833d('0x22')](_0x46a962[_0x833d('0x35')][_0x833d('0x22')]);_0xc3d6b5['offset']=qs[_0x833d('0x20')](_0x46a962[_0x833d('0x35')]['offset']);}_0xc3d6b5[_0x833d('0x5e')]=qs[_0x833d('0x3c')](_0x46a962[_0x833d('0x35')][_0x833d('0x3c')]);_0xc3d6b5[_0x833d('0x3d')]=qs[_0x833d('0x36')](_['pick'](_0x46a962[_0x833d('0x35')],_0x3de554[_0x833d('0x36')]));_0xc3d6b5[_0x833d('0x73')]=!![];if(_0x46a962[_0x833d('0x35')][_0x833d('0x3f')]){_0xc3d6b5['where']=_[_0x833d('0x40')](_0xc3d6b5[_0x833d('0x3d')],{'$or':_[_0x833d('0x33')](_0xc3d6b5['attributes'],function(_0x3e5f66){var _0x5f4773={};_0x5f4773[_0x3e5f66]={'$like':'%'+_0x46a962['query'][_0x833d('0x3f')]+'%'};return _0x5f4773;})});}_0xc3d6b5=_[_0x833d('0x40')]({},_0xc3d6b5,_0x46a962['options']);return _0x33375f[_0x833d('0x6d')](_0xc3d6b5);}})[_0x833d('0x28')](function(_0x368fe2){if(!_['isEmpty'](_0x368fe2)){var _0x2528a8=toCsv(_0x368fe2);var _0x294eb9=Date[_0x833d('0x74')]();fs[_0x833d('0x75')](util[_0x833d('0x70')]('/tmp/list_%d_%s.csv',_0x33375f['id'],_0x294eb9),_0x2528a8);_0x542896[_0x833d('0x76')](_0x833d('0x77'),_0x833d('0x78')+util[_0x833d('0x70')]('list_%d_%s.csv',_0x33375f['id'],_0x294eb9));_0x542896['setHeader'](_0x833d('0x79'),_0x833d('0x7a'));return _0x542896[_0x833d('0x7b')](util[_0x833d('0x70')](_0x833d('0x7c'),_0x33375f['id'],_0x294eb9));}else{return _0x542896[_0x833d('0x1d')](0xcc);}})[_0x833d('0x47')](handleError(_0x542896,null));};exports['addCustomField']=function(_0x1f3b26,_0x184de6,_0x30ae5f){var _0x450b34;delete _0x1f3b26['body']['id'];return db[_0x833d('0x44')][_0x833d('0x5b')]({'where':{'id':_0x1f3b26[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x184de6,null))[_0x833d('0x28')](function(_0x55914e){if(_0x55914e){return db['sequelize'][_0x833d('0x7d')](function(_0x181d1e){return db[_0x833d('0x72')][_0x833d('0x4d')](_0x1f3b26[_0x833d('0x4e')],{'transaction':_0x181d1e})['then'](function(_0x331118){_0x450b34=_0x331118;return _0x55914e['addCustomFields'](_0x331118,{'transaction':_0x181d1e});})[_0x833d('0x28')](function(){var _0x269836={'type':db[_0x833d('0x7e')]['TEXT'],'transaction':_0x181d1e};switch(_0x1f3b26[_0x833d('0x4e')][_0x833d('0x31')]){case'text':_0x269836[_0x833d('0x31')]=db[_0x833d('0x7e')][_0x833d('0x7f')];break;case'number':_0x269836['type']=db[_0x833d('0x7e')]['INTEGER'];break;case _0x833d('0x80'):_0x269836[_0x833d('0x31')]=db[_0x833d('0x7e')][_0x833d('0x81')];_0x269836[_0x833d('0x82')]=![];break;default:}return db[_0x833d('0x83')][_0x833d('0x84')][_0x833d('0x85')](_0x833d('0x86'),util['format'](_0x833d('0x87'),_0x450b34['id']),_0x269836);})[_0x833d('0x28')](function(){return _0x450b34;});});}})['then'](respondWithResult(_0x184de6,null))[_0x833d('0x47')](handleError(_0x184de6,null));};exports[_0x833d('0x88')]=function(_0x36abda,_0x4cd437,_0x39dd76){var _0x5a91b7={};var _0x2a4dbf={};var _0x2f2dd7;var _0x36f450;return db[_0x833d('0x44')][_0x833d('0x5b')]({'where':{'id':_0x36abda[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x4cd437,null))[_0x833d('0x28')](function(_0x264b8f){if(_0x264b8f){_0x2f2dd7=_0x264b8f;_0x2a4dbf[_0x833d('0x38')]=_['keys'](db['CmCustomField'][_0x833d('0x4a')]);_0x2a4dbf[_0x833d('0x35')]=_[_0x833d('0x34')](_0x36abda[_0x833d('0x35')]);_0x2a4dbf[_0x833d('0x36')]=_[_0x833d('0x37')](_0x2a4dbf[_0x833d('0x38')],_0x2a4dbf[_0x833d('0x35')]);_0x5a91b7[_0x833d('0x39')]=_[_0x833d('0x37')](_0x2a4dbf['model'],qs[_0x833d('0x5c')](_0x36abda[_0x833d('0x35')][_0x833d('0x5c')]));_0x5a91b7[_0x833d('0x39')]=_0x5a91b7[_0x833d('0x39')]['length']?_0x5a91b7['attributes']:_0x2a4dbf[_0x833d('0x38')];_0x5a91b7['order']=qs[_0x833d('0x3c')](_0x36abda[_0x833d('0x35')][_0x833d('0x3c')]);_0x5a91b7[_0x833d('0x3d')]=qs[_0x833d('0x36')](_['pick'](_0x36abda[_0x833d('0x35')],_0x2a4dbf[_0x833d('0x36')]));_0x5a91b7['where']=_[_0x833d('0x40')](_0x5a91b7[_0x833d('0x3d')],{'$or':[{'ListId':_0x264b8f['id']},{'ListId':null}]});if(_0x36abda['query'][_0x833d('0x3f')]){_0x5a91b7[_0x833d('0x3d')]=_[_0x833d('0x40')](_0x5a91b7[_0x833d('0x3d')],{'$or':_['map'](_0x5a91b7[_0x833d('0x39')],function(_0x3964d3){var _0x8ffd1b={};_0x8ffd1b[_0x3964d3]={'$like':'%'+_0x36abda[_0x833d('0x35')][_0x833d('0x3f')]+'%'};return _0x8ffd1b;})});}_0x5a91b7=_[_0x833d('0x40')]({},_0x5a91b7,_0x36abda['options']);return db[_0x833d('0x72')][_0x833d('0x89')](_0x5a91b7);}})[_0x833d('0x28')](respondWithResult(_0x4cd437,null))[_0x833d('0x47')](handleError(_0x4cd437,null));};exports['addAgents']=function(_0x5ba6ea,_0x381baf,_0x335afe){return db['CmList'][_0x833d('0x4c')]({'where':{'id':_0x5ba6ea['params']['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x381baf,null))[_0x833d('0x28')](function(_0x5df58a){if(_0x5df58a){return _0x5df58a['addAgents'](_0x5ba6ea[_0x833d('0x4e')][_0x833d('0x68')],_['omit'](_0x5ba6ea[_0x833d('0x4e')],['ids','id'])||{})[_0x833d('0x8a')](function(_0x40a07a){for(var _0x385341=0x0;_0x385341<_0x5ba6ea[_0x833d('0x4e')]['ids'][_0x833d('0x3a')];_0x385341+=0x1){socket[_0x833d('0x8b')](_0x833d('0x8c'),{'UserId':Number(_0x5ba6ea['body'][_0x833d('0x68')][_0x385341]),'CmListId':Number(_0x5ba6ea['params']['id'])});}return _0x40a07a;});}})[_0x833d('0x28')](respondWithResult(_0x381baf,null))[_0x833d('0x47')](handleError(_0x381baf,null));};exports[_0x833d('0x8d')]=function(_0x1ff38f,_0x408d83,_0xc59043){return db['CmList'][_0x833d('0x4c')]({'where':{'id':_0x1ff38f[_0x833d('0x49')]['id']}})[_0x833d('0x28')](handleEntityNotFound(_0x408d83,null))[_0x833d('0x28')](function(_0x1182b7){if(_0x1182b7){return _0x1182b7[_0x833d('0x8d')](_0x1ff38f['query'][_0x833d('0x68')])['then'](function(){if(_['isArray'](_0x1ff38f[_0x833d('0x35')]['ids'])){for(var _0x11ee7a=0x0;_0x11ee7a<_0x1ff38f['query']['ids']['length'];_0x11ee7a+=0x1){socket[_0x833d('0x8b')](_0x833d('0x8e'),{'UserId':Number(_0x1ff38f[_0x833d('0x35')][_0x833d('0x68')][_0x11ee7a]),'CmListId':Number(_0x1ff38f['params']['id'])});}}else{socket[_0x833d('0x8b')]('userCmList:remove',{'UserId':Number(_0x1ff38f[_0x833d('0x35')][_0x833d('0x68')]),'CmListId':Number(_0x1ff38f[_0x833d('0x49')]['id'])});}});}})[_0x833d('0x28')](respondWithStatusCode(_0x408d83,null))[_0x833d('0x47')](handleError(_0x408d83,null));};exports[_0x833d('0x8f')]=function(_0x4ad7af,_0x159b7a,_0xe2d00e){var _0x44dd9d={};var _0x2ee6f7={};var _0x34a4e8;var _0x543d86;return db[_0x833d('0x44')]['findOne']({'where':{'id':_0x4ad7af[_0x833d('0x49')]['id']}})['then'](handleEntityNotFound(_0x159b7a,null))[_0x833d('0x28')](function(_0x1ef9f7){if(_0x1ef9f7){_0x34a4e8=_0x1ef9f7;_0x2ee6f7[_0x833d('0x38')]=_[_0x833d('0x34')](db[_0x833d('0x90')]['rawAttributes']);_0x2ee6f7[_0x833d('0x35')]=_['keys'](_0x4ad7af[_0x833d('0x35')]);_0x2ee6f7[_0x833d('0x36')]=_[_0x833d('0x37')](_0x2ee6f7[_0x833d('0x38')],_0x2ee6f7[_0x833d('0x35')]);_0x44dd9d[_0x833d('0x39')]=_['intersection'](_0x2ee6f7['model'],qs[_0x833d('0x5c')](_0x4ad7af[_0x833d('0x35')]['fields']));_0x44dd9d[_0x833d('0x39')]=_0x44dd9d[_0x833d('0x39')]['length']?_0x44dd9d[_0x833d('0x39')]:_0x2ee6f7[_0x833d('0x38')];_0x44dd9d[_0x833d('0x5e')]=qs[_0x833d('0x3c')](_0x4ad7af[_0x833d('0x35')][_0x833d('0x3c')]);_0x44dd9d[_0x833d('0x3d')]=qs[_0x833d('0x36')](_[_0x833d('0x3e')](_0x4ad7af[_0x833d('0x35')],_0x2ee6f7['filters']));if(_0x4ad7af[_0x833d('0x35')][_0x833d('0x3f')]){_0x44dd9d[_0x833d('0x3d')]=_[_0x833d('0x40')](_0x44dd9d[_0x833d('0x3d')],{'$or':_[_0x833d('0x33')](_0x44dd9d[_0x833d('0x39')],function(_0x5188c0){var _0x243766={};_0x243766[_0x5188c0]={'$like':'%'+_0x4ad7af[_0x833d('0x35')][_0x833d('0x3f')]+'%'};return _0x243766;})});}_0x44dd9d=_[_0x833d('0x40')]({},_0x44dd9d,_0x4ad7af['options']);return _0x34a4e8[_0x833d('0x8f')](_0x44dd9d);}})['then'](function(_0x274172){if(_0x274172){_0x543d86=_0x274172[_0x833d('0x3a')];if(!_0x4ad7af[_0x833d('0x35')][_0x833d('0x3b')]('nolimit')){_0x44dd9d['limit']=qs[_0x833d('0x22')](_0x4ad7af[_0x833d('0x35')][_0x833d('0x22')]);_0x44dd9d['offset']=qs[_0x833d('0x20')](_0x4ad7af['query'][_0x833d('0x20')]);}return _0x34a4e8[_0x833d('0x8f')](_0x44dd9d);}})['then'](function(_0x275f74){if(_0x275f74){return _0x275f74?{'count':_0x543d86,'rows':_0x275f74}:null;}})['then'](respondWithResult(_0x159b7a,null))[_0x833d('0x47')](handleError(_0x159b7a,null));}; \ No newline at end of file +var _0x2a2d=['CustomFields','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Lists','UserProfileResource','end','name','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','getDispositions','findOne','Disposition','pick','rows','ids','addContacts','tags','isArray','join','CmContact','omit','success','push','dataValues','message','getContacts','CmCustomField','concat'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x2a2d,0x14d));var _0xd2a2=function(_0x32ed89,_0x11d953){_0x32ed89=_0x32ed89-0x0;var _0x262961=_0x2a2d[_0x32ed89];return _0x262961;};'use strict';var emlformat=require(_0xd2a2('0x0'));var rimraf=require(_0xd2a2('0x1'));var zipdir=require(_0xd2a2('0x2'));var jsonpatch=require(_0xd2a2('0x3'));var rp=require(_0xd2a2('0x4'));var moment=require(_0xd2a2('0x5'));var BPromise=require(_0xd2a2('0x6'));var Mustache=require(_0xd2a2('0x7'));var util=require('util');var path=require(_0xd2a2('0x8'));var sox=require(_0xd2a2('0x9'));var csv=require(_0xd2a2('0xa'));var ejs=require(_0xd2a2('0xb'));var fs=require('fs');var fs_extra=require(_0xd2a2('0xc'));var _=require('lodash');var squel=require(_0xd2a2('0xd'));var crypto=require(_0xd2a2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd2a2('0xf'));var toCsv=require(_0xd2a2('0xa'));var querystring=require(_0xd2a2('0x10'));var Papa=require(_0xd2a2('0x11'));var Redis=require('ioredis');var authService=require(_0xd2a2('0x12'));var qs=require(_0xd2a2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2a2('0x14'));var logger=require(_0xd2a2('0x15'))(_0xd2a2('0x16'));var utils=require(_0xd2a2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd2a2('0x18'));var db=require(_0xd2a2('0x19'))['db'];config[_0xd2a2('0x1a')]=_[_0xd2a2('0x1b')](config[_0xd2a2('0x1a')],{'host':_0xd2a2('0x1c'),'port':0x18eb});var socket=require(_0xd2a2('0x1d'))(new Redis(config[_0xd2a2('0x1a')]));require(_0xd2a2('0x1e'))[_0xd2a2('0x1f')](socket);function respondWithStatusCode(_0x8a6a74,_0x1530bb){_0x1530bb=_0x1530bb||0xcc;return function(_0x4a24a1){if(_0x4a24a1){return _0x8a6a74[_0xd2a2('0x20')](_0x1530bb);}return _0x8a6a74[_0xd2a2('0x21')](_0x1530bb)['end']();};}function respondWithResult(_0x1071aa,_0x4f148f){_0x4f148f=_0x4f148f||0xc8;return function(_0x2adea9){if(_0x2adea9){return _0x1071aa[_0xd2a2('0x21')](_0x4f148f)[_0xd2a2('0x22')](_0x2adea9);}};}function respondWithFilteredResult(_0x50cd49,_0x2403e5){return function(_0x451143){if(_0x451143){var _0x4a3b80=typeof _0x2403e5[_0xd2a2('0x23')]===_0xd2a2('0x24')&&typeof _0x2403e5[_0xd2a2('0x25')]===_0xd2a2('0x24');var _0x3403e4=_0x451143[_0xd2a2('0x26')];var _0x1d13f3=_0x4a3b80?0x0:_0x2403e5['offset'];var _0x1ade42=_0x4a3b80?_0x451143[_0xd2a2('0x26')]:_0x2403e5[_0xd2a2('0x23')]+_0x2403e5[_0xd2a2('0x25')];var _0x3eb757;if(_0x1ade42>=_0x3403e4){_0x1ade42=_0x3403e4;_0x3eb757=0xc8;}else{_0x3eb757=0xce;}_0x50cd49[_0xd2a2('0x21')](_0x3eb757);return _0x50cd49[_0xd2a2('0x27')](_0xd2a2('0x28'),_0x1d13f3+'-'+_0x1ade42+'/'+_0x3403e4)[_0xd2a2('0x22')](_0x451143);}return null;};}function patchUpdates(_0xa35786){return function(_0x225a3f){try{jsonpatch[_0xd2a2('0x29')](_0x225a3f,_0xa35786,!![]);}catch(_0x10ba48){return BPromise['reject'](_0x10ba48);}return _0x225a3f[_0xd2a2('0x2a')]();};}function saveUpdates(_0x2a41f8,_0x3a81a2){return function(_0x38c057){if(_0x38c057){return _0x38c057[_0xd2a2('0x2b')](_0x2a41f8)[_0xd2a2('0x2c')](function(_0x140bd0){return _0x140bd0;});}return null;};}function removeEntity(_0xce08a6,_0x3d5152){return function(_0x262f8f){if(_0x262f8f){return _0x262f8f[_0xd2a2('0x2d')]()[_0xd2a2('0x2c')](function(){var _0xaa75f3=_0x262f8f['get']({'plain':!![]});var _0x19675a=_0xd2a2('0x2e');return db[_0xd2a2('0x2f')][_0xd2a2('0x2d')]({'where':{'type':_0x19675a,'resourceId':_0xaa75f3['id']}})[_0xd2a2('0x2c')](function(){return _0x262f8f;});})[_0xd2a2('0x2c')](function(){_0xce08a6[_0xd2a2('0x21')](0xcc)[_0xd2a2('0x30')]();});}};}function handleEntityNotFound(_0x1c421d,_0x2c1bd2){return function(_0x581d97){if(!_0x581d97){_0x1c421d[_0xd2a2('0x20')](0x194);}return _0x581d97;};}function handleError(_0xa2c55e,_0x3779be){_0x3779be=_0x3779be||0x1f4;return function(_0x36db84){logger['error'](_0x36db84['stack']);if(_0x36db84[_0xd2a2('0x31')]){delete _0x36db84[_0xd2a2('0x31')];}_0xa2c55e[_0xd2a2('0x21')](_0x3779be)['send'](_0x36db84);};}exports[_0xd2a2('0x32')]=function(_0x1f98ef,_0x586228){var _0x1de895={},_0x40f2da={},_0x32d88c={'count':0x0,'rows':[]};var _0x1be026=_[_0xd2a2('0x33')](db[_0xd2a2('0x34')][_0xd2a2('0x35')],function(_0x74019){return{'name':_0x74019[_0xd2a2('0x36')],'type':_0x74019[_0xd2a2('0x37')][_0xd2a2('0x38')]};});_0x40f2da[_0xd2a2('0x39')]=_[_0xd2a2('0x33')](_0x1be026,_0xd2a2('0x31'));_0x40f2da['query']=_[_0xd2a2('0x3a')](_0x1f98ef[_0xd2a2('0x3b')]);_0x40f2da[_0xd2a2('0x3c')]=_['intersection'](_0x40f2da[_0xd2a2('0x39')],_0x40f2da[_0xd2a2('0x3b')]);_0x1de895[_0xd2a2('0x3d')]=_[_0xd2a2('0x3e')](_0x40f2da['model'],qs['fields'](_0x1f98ef['query'][_0xd2a2('0x3f')]));_0x1de895[_0xd2a2('0x3d')]=_0x1de895[_0xd2a2('0x3d')][_0xd2a2('0x40')]?_0x1de895['attributes']:_0x40f2da['model'];if(!_0x1f98ef[_0xd2a2('0x3b')][_0xd2a2('0x41')](_0xd2a2('0x42'))){_0x1de895['limit']=qs[_0xd2a2('0x25')](_0x1f98ef['query']['limit']);_0x1de895[_0xd2a2('0x23')]=qs[_0xd2a2('0x23')](_0x1f98ef[_0xd2a2('0x3b')][_0xd2a2('0x23')]);}_0x1de895[_0xd2a2('0x43')]=qs['sort'](_0x1f98ef[_0xd2a2('0x3b')][_0xd2a2('0x44')]);_0x1de895['where']=qs[_0xd2a2('0x3c')](_['pick'](_0x1f98ef[_0xd2a2('0x3b')],_0x40f2da[_0xd2a2('0x3c')]),_0x1be026);if(_0x1f98ef['query'][_0xd2a2('0x45')]){_0x1de895[_0xd2a2('0x46')]=_['merge'](_0x1de895[_0xd2a2('0x46')],{'$or':_[_0xd2a2('0x33')](_0x1be026,function(_0x151908){if(_0x151908[_0xd2a2('0x37')]!==_0xd2a2('0x47')){var _0x3a217b={};_0x3a217b[_0x151908['name']]={'$like':'%'+_0x1f98ef[_0xd2a2('0x3b')][_0xd2a2('0x45')]+'%'};return _0x3a217b;}})});}_0x1de895=_[_0xd2a2('0x48')]({},_0x1de895,_0x1f98ef[_0xd2a2('0x49')]);var _0x3f882e={'where':_0x1de895[_0xd2a2('0x46')]};return db['CmList'][_0xd2a2('0x26')](_0x3f882e)[_0xd2a2('0x2c')](function(_0x1f341b){_0x32d88c[_0xd2a2('0x26')]=_0x1f341b;if(_0x1f98ef[_0xd2a2('0x3b')]['includeAll']){_0x1de895[_0xd2a2('0x4a')]=[{'all':!![]}];}return db[_0xd2a2('0x34')][_0xd2a2('0x4b')](_0x1de895);})['then'](function(_0x5b6cf9){_0x32d88c['rows']=_0x5b6cf9;return _0x32d88c;})['then'](respondWithFilteredResult(_0x586228,_0x1de895))[_0xd2a2('0x4c')](handleError(_0x586228,null));};exports[_0xd2a2('0x4d')]=function(_0x2a948f,_0x3300ab){var _0x176842={'raw':![],'where':{'id':_0x2a948f[_0xd2a2('0x4e')]['id']}},_0x1db8c2={};_0x1db8c2[_0xd2a2('0x39')]=_[_0xd2a2('0x3a')](db[_0xd2a2('0x34')][_0xd2a2('0x35')]);_0x1db8c2[_0xd2a2('0x3b')]=_[_0xd2a2('0x3a')](_0x2a948f[_0xd2a2('0x3b')]);_0x1db8c2[_0xd2a2('0x3c')]=_[_0xd2a2('0x3e')](_0x1db8c2[_0xd2a2('0x39')],_0x1db8c2[_0xd2a2('0x3b')]);_0x176842[_0xd2a2('0x3d')]=_[_0xd2a2('0x3e')](_0x1db8c2[_0xd2a2('0x39')],qs[_0xd2a2('0x3f')](_0x2a948f[_0xd2a2('0x3b')][_0xd2a2('0x3f')]));_0x176842[_0xd2a2('0x3d')]=_0x176842[_0xd2a2('0x3d')]['length']?_0x176842['attributes']:_0x1db8c2[_0xd2a2('0x39')];if(_0x2a948f['query'][_0xd2a2('0x4f')]){_0x176842[_0xd2a2('0x4a')]=[{'all':!![]}];}_0x176842=_[_0xd2a2('0x48')]({},_0x176842,_0x2a948f[_0xd2a2('0x49')]);return db[_0xd2a2('0x34')][_0xd2a2('0x50')](_0x176842)[_0xd2a2('0x2c')](handleEntityNotFound(_0x3300ab,null))['then'](respondWithResult(_0x3300ab,null))[_0xd2a2('0x4c')](handleError(_0x3300ab,null));};exports[_0xd2a2('0x51')]=function(_0x1145ab,_0x4dd62f){return db['CmList'][_0xd2a2('0x51')](_0x1145ab[_0xd2a2('0x52')],{})[_0xd2a2('0x2c')](function(_0x5a54e8){var _0x2faad1=_0x1145ab[_0xd2a2('0x53')]['get']({'plain':!![]});if(!_0x2faad1)throw new Error(_0xd2a2('0x54'));if(_0x2faad1[_0xd2a2('0x55')]===_0xd2a2('0x53')){var _0x413764=_0x5a54e8[_0xd2a2('0x56')]({'plain':!![]});var _0x47d233='Lists';return db[_0xd2a2('0x57')][_0xd2a2('0x50')]({'where':{'name':_0x47d233,'userProfileId':_0x2faad1[_0xd2a2('0x58')]},'raw':!![]})[_0xd2a2('0x2c')](function(_0x5044ce){if(_0x5044ce&&_0x5044ce['autoAssociation']===0x0){return db[_0xd2a2('0x2f')][_0xd2a2('0x51')]({'name':_0x413764[_0xd2a2('0x31')],'resourceId':_0x413764['id'],'type':_0x5044ce[_0xd2a2('0x31')],'sectionId':_0x5044ce['id']},{})[_0xd2a2('0x2c')](function(){return _0x5a54e8;});}else{return _0x5a54e8;}})[_0xd2a2('0x4c')](function(_0x30d66d){logger['error'](_0xd2a2('0x59'),_0x30d66d);throw _0x30d66d;});}return _0x5a54e8;})[_0xd2a2('0x2c')](respondWithResult(_0x4dd62f,0xc9))[_0xd2a2('0x4c')](handleError(_0x4dd62f,null));};exports[_0xd2a2('0x2b')]=function(_0xeab680,_0x2dfde0){if(_0xeab680['body']['id']){delete _0xeab680[_0xd2a2('0x52')]['id'];}return db[_0xd2a2('0x34')][_0xd2a2('0x50')]({'where':{'id':_0xeab680[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x2dfde0,null))['then'](saveUpdates(_0xeab680[_0xd2a2('0x52')],null))[_0xd2a2('0x2c')](respondWithResult(_0x2dfde0,null))['catch'](handleError(_0x2dfde0,null));};exports[_0xd2a2('0x2d')]=function(_0x4dc384,_0x325440){return db[_0xd2a2('0x34')][_0xd2a2('0x50')]({'where':{'id':_0x4dc384[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x325440,null))[_0xd2a2('0x2c')](removeEntity(_0x325440,null))[_0xd2a2('0x4c')](handleError(_0x325440,null));};exports['describe']=function(_0x2a5275,_0x1c2c7f){return db[_0xd2a2('0x34')][_0xd2a2('0x5a')]()[_0xd2a2('0x2c')](respondWithResult(_0x1c2c7f,null))[_0xd2a2('0x4c')](handleError(_0x1c2c7f,null));};exports['addDisposition']=function(_0x226ee0,_0x397d68,_0x5f3757){if(_0x226ee0[_0xd2a2('0x52')]['id']){delete _0x226ee0[_0xd2a2('0x52')]['id'];}return db[_0xd2a2('0x34')][_0xd2a2('0x50')]({'where':{'id':_0x226ee0['params']['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x397d68,null))[_0xd2a2('0x2c')](function(_0x474833){if(_0x474833){_0x226ee0[_0xd2a2('0x52')][_0xd2a2('0x5b')]=_0x474833['id'];return db['Disposition'][_0xd2a2('0x51')](_0x226ee0[_0xd2a2('0x52')]);}})['then'](respondWithResult(_0x397d68,null))[_0xd2a2('0x4c')](handleError(_0x397d68,null));};exports[_0xd2a2('0x5c')]=function(_0x234bb5,_0x387626,_0x5d433b){var _0x34e57b={'raw':![],'where':{}};var _0x1e687a={};var _0x261546={'count':0x0,'rows':[]};return db[_0xd2a2('0x34')][_0xd2a2('0x5d')]({'where':{'id':_0x234bb5[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x387626,null))['then'](function(_0x3c9086){if(_0x3c9086){_0x1e687a[_0xd2a2('0x39')]=_['keys'](db[_0xd2a2('0x5e')][_0xd2a2('0x35')]);_0x1e687a['query']=_[_0xd2a2('0x3a')](_0x234bb5['query']);_0x1e687a[_0xd2a2('0x3c')]=_[_0xd2a2('0x3e')](_0x1e687a['model'],_0x1e687a[_0xd2a2('0x3b')]);_0x34e57b[_0xd2a2('0x3d')]=_[_0xd2a2('0x3e')](_0x1e687a[_0xd2a2('0x39')],qs[_0xd2a2('0x3f')](_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x3f')]));_0x34e57b[_0xd2a2('0x3d')]=_0x34e57b[_0xd2a2('0x3d')][_0xd2a2('0x40')]?_0x34e57b[_0xd2a2('0x3d')]:_0x1e687a[_0xd2a2('0x39')];if(!_0x234bb5['query'][_0xd2a2('0x41')](_0xd2a2('0x42'))){_0x34e57b[_0xd2a2('0x25')]=qs[_0xd2a2('0x25')](_0x234bb5[_0xd2a2('0x3b')]['limit']);_0x34e57b[_0xd2a2('0x23')]=qs[_0xd2a2('0x23')](_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x23')]);}_0x34e57b[_0xd2a2('0x43')]=qs[_0xd2a2('0x44')](_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x44')]);_0x34e57b['where']=qs[_0xd2a2('0x3c')](_[_0xd2a2('0x5f')](_0x234bb5[_0xd2a2('0x3b')],_0x1e687a['filters']));_0x34e57b[_0xd2a2('0x46')][_0xd2a2('0x5b')]=_0x3c9086['id'];if(_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x45')]){_0x34e57b['where']=_['merge'](_0x34e57b[_0xd2a2('0x46')],{'$or':_['map'](_0x34e57b[_0xd2a2('0x3d')],function(_0x242934){var _0xacc7ce={};_0xacc7ce[_0x242934]={'$like':'%'+_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x45')]+'%'};return _0xacc7ce;})});}_0x34e57b=_[_0xd2a2('0x48')]({},_0x34e57b,_0x234bb5['options']);return db[_0xd2a2('0x5e')][_0xd2a2('0x26')]({'where':_0x34e57b[_0xd2a2('0x46')]})[_0xd2a2('0x2c')](function(_0x14062a){_0x261546['count']=_0x14062a;if(_0x234bb5[_0xd2a2('0x3b')][_0xd2a2('0x4f')]){_0x34e57b[_0xd2a2('0x4a')]=[{'all':!![]}];}return db[_0xd2a2('0x5e')][_0xd2a2('0x4b')](_0x34e57b);})[_0xd2a2('0x2c')](function(_0x4dc911){_0x261546[_0xd2a2('0x60')]=_0x4dc911;return _0x261546;});}})['then'](respondWithFilteredResult(_0x387626,_0x34e57b))['catch'](handleError(_0x387626,null));};exports['removeDispositions']=function(_0x48a8eb,_0xe3bb54,_0x40dc3e){return db[_0xd2a2('0x34')][_0xd2a2('0x50')]({'where':{'id':_0x48a8eb[_0xd2a2('0x4e')]['id']}})['then'](handleEntityNotFound(_0xe3bb54,null))[_0xd2a2('0x2c')](function(_0x19dac6){if(_0x19dac6){return _0x19dac6['removeDispositions'](_0x48a8eb[_0xd2a2('0x3b')][_0xd2a2('0x61')]);}})[_0xd2a2('0x2c')](respondWithStatusCode(_0xe3bb54,null))[_0xd2a2('0x4c')](handleError(_0xe3bb54,null));};exports[_0xd2a2('0x62')]=function(_0x2d1baa,_0x22cf84,_0x41093f){return db[_0xd2a2('0x34')][_0xd2a2('0x50')]({'where':{'id':_0x2d1baa[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x22cf84,null))[_0xd2a2('0x2c')](function(_0x260d48){if(_0x260d48){var _0x110564=[];var _0x520393={'success':[],'errors':[]};return db['CmContact'][_0xd2a2('0x5a')]()[_0xd2a2('0x2c')](function(_0x851c4e){if(_0x2d1baa[_0xd2a2('0x52')][_0xd2a2('0x63')]&&_[_0xd2a2('0x64')](_0x2d1baa[_0xd2a2('0x52')]['tags'])){if(_0x2d1baa['body'][_0xd2a2('0x63')][_0xd2a2('0x40')]){_0x2d1baa['body'][_0xd2a2('0x63')]=_0x2d1baa[_0xd2a2('0x52')]['tags'][_0xd2a2('0x65')](';')+';';}else{_0x2d1baa[_0xd2a2('0x52')]['tags']=null;}}else{_0x2d1baa[_0xd2a2('0x52')][_0xd2a2('0x63')]=null;}if(_0x2d1baa[_0xd2a2('0x52')]&&_[_0xd2a2('0x64')](_0x2d1baa[_0xd2a2('0x52')])){for(var _0x5c024b=0x0;_0x5c024b<_0x2d1baa[_0xd2a2('0x52')][_0xd2a2('0x40')];_0x5c024b+=0x1){_0x2d1baa['body'][_0x5c024b][_0xd2a2('0x5b')]=_0x2d1baa[_0xd2a2('0x4e')]['id'];_0x110564['push'](_0x2d1baa[_0xd2a2('0x52')][_0x5c024b]);}return BPromise['each'](_0x110564,function(_0x3de806){return db[_0xd2a2('0x66')][_0xd2a2('0x51')](_[_0xd2a2('0x67')](_0x3de806,[_0xd2a2('0x61'),'id'])||{},{'fields':_[_0xd2a2('0x3a')](_0x851c4e),'raw':!![]})[_0xd2a2('0x2c')](function(_0x1f08a2){_0x520393[_0xd2a2('0x68')][_0xd2a2('0x69')](_0x1f08a2[_0xd2a2('0x6a')]);})['catch'](function(_0x1c36e1){_0x520393['errors']['push']({'data':_0x3de806,'error':_0x1c36e1[_0xd2a2('0x6b')]});});})[_0xd2a2('0x2c')](function(_0x758eab){return _0x520393;})['catch'](function(_0x194ad2){return _0x194ad2;});}else{_0x22cf84[_0xd2a2('0x21')](0x190)[_0xd2a2('0x22')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd2a2('0x2c')](respondWithResult(_0x22cf84,null))[_0xd2a2('0x4c')](handleError(_0x22cf84,null));};exports[_0xd2a2('0x6c')]=function(_0x497132,_0x448ada,_0x5493d7){var _0x25ea0a;return db['CmList'][_0xd2a2('0x50')]({'where':{'id':_0x497132[_0xd2a2('0x4e')]['id']},'include':[{'model':db[_0xd2a2('0x6d')],'as':'CustomFields'}]})[_0xd2a2('0x2c')](handleEntityNotFound(_0x448ada,null))['then'](function(_0x141756){if(_0x141756){_0x25ea0a=_0x141756;return db['CmContact'][_0xd2a2('0x35')];}})[_0xd2a2('0x2c')](function(_0x7fd8c8){if(_0x7fd8c8){var _0x24a47c={};var _0x1ce5b0={};_0x1ce5b0[_0xd2a2('0x39')]=_[_0xd2a2('0x6e')](_[_0xd2a2('0x3a')](_0x7fd8c8),_[_0xd2a2('0x33')](_0x25ea0a[_0xd2a2('0x6f')],function(_0x524b3a){return util[_0xd2a2('0x70')](_0xd2a2('0x71'),_0x524b3a['id']);}));_0x1ce5b0[_0xd2a2('0x3b')]=_[_0xd2a2('0x3a')](_0x497132['query']);_0x1ce5b0[_0xd2a2('0x3c')]=_[_0xd2a2('0x3e')](_0x1ce5b0['model'],_0x1ce5b0[_0xd2a2('0x3b')]);_0x24a47c['attributes']=_[_0xd2a2('0x3e')](_0x1ce5b0[_0xd2a2('0x39')],qs[_0xd2a2('0x3f')](_0x497132[_0xd2a2('0x3b')]['fields']));_0x24a47c['attributes']=_0x24a47c[_0xd2a2('0x3d')][_0xd2a2('0x40')]?_0x24a47c['attributes']:_0x1ce5b0[_0xd2a2('0x39')];if(!_0x497132[_0xd2a2('0x3b')][_0xd2a2('0x41')](_0xd2a2('0x42'))){_0x24a47c[_0xd2a2('0x25')]=qs[_0xd2a2('0x25')](_0x497132['query'][_0xd2a2('0x25')]);_0x24a47c['offset']=qs[_0xd2a2('0x23')](_0x497132[_0xd2a2('0x3b')][_0xd2a2('0x23')]);}_0x24a47c['order']=qs['sort'](_0x497132[_0xd2a2('0x3b')][_0xd2a2('0x44')]);_0x24a47c[_0xd2a2('0x46')]=qs['filters'](_[_0xd2a2('0x5f')](_0x497132[_0xd2a2('0x3b')],_0x1ce5b0['filters']));_0x24a47c[_0xd2a2('0x72')]=!![];if(_0x497132[_0xd2a2('0x3b')][_0xd2a2('0x45')]){_0x24a47c[_0xd2a2('0x46')]=_[_0xd2a2('0x48')](_0x24a47c['where'],{'$or':_[_0xd2a2('0x33')](_0x24a47c[_0xd2a2('0x3d')],function(_0x2e8ddf){var _0x249541={};_0x249541[_0x2e8ddf]={'$like':'%'+_0x497132['query'][_0xd2a2('0x45')]+'%'};return _0x249541;})});}_0x24a47c=_[_0xd2a2('0x48')]({},_0x24a47c,_0x497132[_0xd2a2('0x49')]);return _0x25ea0a[_0xd2a2('0x6c')](_0x24a47c);}})['then'](respondWithResult(_0x448ada,null))[_0xd2a2('0x4c')](handleError(_0x448ada,null));};exports[_0xd2a2('0x73')]=function(_0x519487,_0x1dd684,_0x13048d){var _0x1530fa;return db['CmList']['find']({'where':{'id':_0x519487['params']['id']},'include':[{'model':db[_0xd2a2('0x6d')],'as':_0xd2a2('0x6f')}]})[_0xd2a2('0x2c')](handleEntityNotFound(_0x1dd684,null))[_0xd2a2('0x2c')](function(_0x195f47){if(_0x195f47){_0x1530fa=_0x195f47;return db[_0xd2a2('0x66')][_0xd2a2('0x35')];}})[_0xd2a2('0x2c')](function(_0x1a5621){if(_0x1a5621){var _0x2d20b0={};var _0x40c4fe={};_0x40c4fe[_0xd2a2('0x39')]=_[_0xd2a2('0x6e')](_[_0xd2a2('0x3a')](_0x1a5621),_[_0xd2a2('0x33')](_0x1530fa[_0xd2a2('0x6f')],function(_0xa4db90){return util[_0xd2a2('0x70')](_0xd2a2('0x71'),_0xa4db90['id']);}));_0x40c4fe[_0xd2a2('0x3b')]=_[_0xd2a2('0x3a')](_0x519487['query']);_0x40c4fe[_0xd2a2('0x3c')]=_[_0xd2a2('0x3e')](_0x40c4fe[_0xd2a2('0x39')],_0x40c4fe[_0xd2a2('0x3b')]);_0x2d20b0[_0xd2a2('0x3d')]=_[_0xd2a2('0x3e')](_0x40c4fe[_0xd2a2('0x39')],qs['fields'](_0x519487['query']['fields']));_0x2d20b0[_0xd2a2('0x3d')]=_0x2d20b0[_0xd2a2('0x3d')][_0xd2a2('0x40')]?_0x2d20b0['attributes']:_0x40c4fe['model'];if(!_0x519487[_0xd2a2('0x3b')][_0xd2a2('0x41')]('nolimit')){_0x2d20b0['limit']=qs[_0xd2a2('0x25')](_0x519487['query']['limit']);_0x2d20b0[_0xd2a2('0x23')]=qs[_0xd2a2('0x23')](_0x519487[_0xd2a2('0x3b')][_0xd2a2('0x23')]);}_0x2d20b0[_0xd2a2('0x43')]=qs[_0xd2a2('0x44')](_0x519487[_0xd2a2('0x3b')][_0xd2a2('0x44')]);_0x2d20b0[_0xd2a2('0x46')]=qs[_0xd2a2('0x3c')](_['pick'](_0x519487[_0xd2a2('0x3b')],_0x40c4fe[_0xd2a2('0x3c')]));_0x2d20b0['raw']=!![];if(_0x519487[_0xd2a2('0x3b')][_0xd2a2('0x45')]){_0x2d20b0[_0xd2a2('0x46')]=_[_0xd2a2('0x48')](_0x2d20b0[_0xd2a2('0x46')],{'$or':_['map'](_0x2d20b0[_0xd2a2('0x3d')],function(_0x299d18){var _0x2df694={};_0x2df694[_0x299d18]={'$like':'%'+_0x519487[_0xd2a2('0x3b')][_0xd2a2('0x45')]+'%'};return _0x2df694;})});}_0x2d20b0=_[_0xd2a2('0x48')]({},_0x2d20b0,_0x519487[_0xd2a2('0x49')]);return _0x1530fa['getContacts'](_0x2d20b0);}})[_0xd2a2('0x2c')](function(_0x3006af){if(!_[_0xd2a2('0x74')](_0x3006af)){var _0x332ab4=toCsv(_0x3006af);var _0x568dc0=Date[_0xd2a2('0x75')]();fs[_0xd2a2('0x76')](util[_0xd2a2('0x70')](_0xd2a2('0x77'),_0x1530fa['id'],_0x568dc0),_0x332ab4);_0x1dd684[_0xd2a2('0x78')](_0xd2a2('0x79'),_0xd2a2('0x7a')+util['format'](_0xd2a2('0x7b'),_0x1530fa['id'],_0x568dc0));_0x1dd684['setHeader']('Content-type',_0xd2a2('0x7c'));return _0x1dd684[_0xd2a2('0x7d')](util[_0xd2a2('0x70')](_0xd2a2('0x77'),_0x1530fa['id'],_0x568dc0));}else{return _0x1dd684['sendStatus'](0xcc);}})[_0xd2a2('0x4c')](handleError(_0x1dd684,null));};exports['addCustomField']=function(_0x14d85b,_0x2fb7d3,_0x46d641){var _0x3b1d10;delete _0x14d85b[_0xd2a2('0x52')]['id'];return db[_0xd2a2('0x34')]['findOne']({'where':{'id':_0x14d85b[_0xd2a2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2fb7d3,null))[_0xd2a2('0x2c')](function(_0x47f8b4){if(_0x47f8b4){return db['sequelize'][_0xd2a2('0x7e')](function(_0x4e81b9){return db[_0xd2a2('0x6d')][_0xd2a2('0x51')](_0x14d85b[_0xd2a2('0x52')],{'transaction':_0x4e81b9})['then'](function(_0x339d86){_0x3b1d10=_0x339d86;return _0x47f8b4[_0xd2a2('0x7f')](_0x339d86,{'transaction':_0x4e81b9});})[_0xd2a2('0x2c')](function(){var _0xbab2f8={'type':db[_0xd2a2('0x80')][_0xd2a2('0x81')],'transaction':_0x4e81b9};switch(_0x14d85b[_0xd2a2('0x52')]['type']){case _0xd2a2('0x82'):_0xbab2f8[_0xd2a2('0x37')]=db['Sequelize']['TEXT'];break;case _0xd2a2('0x83'):_0xbab2f8[_0xd2a2('0x37')]=db[_0xd2a2('0x80')][_0xd2a2('0x84')];break;case _0xd2a2('0x85'):_0xbab2f8['type']=db['Sequelize'][_0xd2a2('0x86')];_0xbab2f8['defaultValue']=![];break;default:}return db[_0xd2a2('0x87')][_0xd2a2('0x88')][_0xd2a2('0x89')](_0xd2a2('0x8a'),util[_0xd2a2('0x70')](_0xd2a2('0x8b'),_0x3b1d10['id']),_0xbab2f8);})[_0xd2a2('0x2c')](function(){return _0x3b1d10;});});}})[_0xd2a2('0x2c')](respondWithResult(_0x2fb7d3,null))[_0xd2a2('0x4c')](handleError(_0x2fb7d3,null));};exports['getCustomFields']=function(_0x4281f2,_0x5d3182,_0x12e8ec){var _0x581edd={};var _0x358c79={};var _0x326e23;var _0xa162ef;return db[_0xd2a2('0x34')][_0xd2a2('0x5d')]({'where':{'id':_0x4281f2[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x5d3182,null))[_0xd2a2('0x2c')](function(_0x5bca44){if(_0x5bca44){_0x326e23=_0x5bca44;_0x358c79[_0xd2a2('0x39')]=_['keys'](db[_0xd2a2('0x6d')][_0xd2a2('0x35')]);_0x358c79['query']=_['keys'](_0x4281f2[_0xd2a2('0x3b')]);_0x358c79[_0xd2a2('0x3c')]=_['intersection'](_0x358c79['model'],_0x358c79[_0xd2a2('0x3b')]);_0x581edd[_0xd2a2('0x3d')]=_[_0xd2a2('0x3e')](_0x358c79['model'],qs[_0xd2a2('0x3f')](_0x4281f2[_0xd2a2('0x3b')][_0xd2a2('0x3f')]));_0x581edd['attributes']=_0x581edd[_0xd2a2('0x3d')][_0xd2a2('0x40')]?_0x581edd[_0xd2a2('0x3d')]:_0x358c79[_0xd2a2('0x39')];_0x581edd['order']=qs[_0xd2a2('0x44')](_0x4281f2[_0xd2a2('0x3b')]['sort']);_0x581edd[_0xd2a2('0x46')]=qs['filters'](_[_0xd2a2('0x5f')](_0x4281f2['query'],_0x358c79['filters']));_0x581edd[_0xd2a2('0x46')]=_[_0xd2a2('0x48')](_0x581edd['where'],{'$or':[{'ListId':_0x5bca44['id']},{'ListId':null}]});if(_0x4281f2['query'][_0xd2a2('0x45')]){_0x581edd['where']=_[_0xd2a2('0x48')](_0x581edd[_0xd2a2('0x46')],{'$or':_[_0xd2a2('0x33')](_0x581edd[_0xd2a2('0x3d')],function(_0x563f4c){var _0x394d6b={};_0x394d6b[_0x563f4c]={'$like':'%'+_0x4281f2[_0xd2a2('0x3b')][_0xd2a2('0x45')]+'%'};return _0x394d6b;})});}_0x581edd=_[_0xd2a2('0x48')]({},_0x581edd,_0x4281f2['options']);return db['CmCustomField']['findAndCountAll'](_0x581edd);}})[_0xd2a2('0x2c')](respondWithResult(_0x5d3182,null))[_0xd2a2('0x4c')](handleError(_0x5d3182,null));};exports[_0xd2a2('0x8c')]=function(_0x5e5fdc,_0x31154b,_0x501f1f){return db[_0xd2a2('0x34')]['find']({'where':{'id':_0x5e5fdc[_0xd2a2('0x4e')]['id']}})[_0xd2a2('0x2c')](handleEntityNotFound(_0x31154b,null))[_0xd2a2('0x2c')](function(_0x48a752){if(_0x48a752){return _0x48a752[_0xd2a2('0x8c')](_0x5e5fdc[_0xd2a2('0x52')][_0xd2a2('0x61')],_[_0xd2a2('0x67')](_0x5e5fdc[_0xd2a2('0x52')],['ids','id'])||{})[_0xd2a2('0x8d')](function(_0x39995e){for(var _0x247bf7=0x0;_0x247bf7<_0x5e5fdc[_0xd2a2('0x52')][_0xd2a2('0x61')][_0xd2a2('0x40')];_0x247bf7+=0x1){socket[_0xd2a2('0x8e')](_0xd2a2('0x8f'),{'UserId':Number(_0x5e5fdc['body'][_0xd2a2('0x61')][_0x247bf7]),'CmListId':Number(_0x5e5fdc[_0xd2a2('0x4e')]['id'])});}return _0x39995e;});}})[_0xd2a2('0x2c')](respondWithResult(_0x31154b,null))[_0xd2a2('0x4c')](handleError(_0x31154b,null));};exports[_0xd2a2('0x90')]=function(_0x179c35,_0x3e3e6b,_0x3b03a7){return db[_0xd2a2('0x34')]['find']({'where':{'id':_0x179c35['params']['id']}})['then'](handleEntityNotFound(_0x3e3e6b,null))[_0xd2a2('0x2c')](function(_0x382b3c){if(_0x382b3c){return _0x382b3c['removeAgents'](_0x179c35[_0xd2a2('0x3b')]['ids'])[_0xd2a2('0x2c')](function(){if(_['isArray'](_0x179c35[_0xd2a2('0x3b')][_0xd2a2('0x61')])){for(var _0x7ec730=0x0;_0x7ec730<_0x179c35[_0xd2a2('0x3b')][_0xd2a2('0x61')][_0xd2a2('0x40')];_0x7ec730+=0x1){socket[_0xd2a2('0x8e')](_0xd2a2('0x91'),{'UserId':Number(_0x179c35[_0xd2a2('0x3b')][_0xd2a2('0x61')][_0x7ec730]),'CmListId':Number(_0x179c35[_0xd2a2('0x4e')]['id'])});}}else{socket['emit'](_0xd2a2('0x91'),{'UserId':Number(_0x179c35[_0xd2a2('0x3b')][_0xd2a2('0x61')]),'CmListId':Number(_0x179c35['params']['id'])});}});}})[_0xd2a2('0x2c')](respondWithStatusCode(_0x3e3e6b,null))['catch'](handleError(_0x3e3e6b,null));};exports['getAgents']=function(_0x3df7e0,_0x1701f9,_0x307789){var _0x232fa0={};var _0x3e1c73={};var _0x40f09a;var _0x32d81d;return db[_0xd2a2('0x34')][_0xd2a2('0x5d')]({'where':{'id':_0x3df7e0['params']['id']}})['then'](handleEntityNotFound(_0x1701f9,null))[_0xd2a2('0x2c')](function(_0x46310d){if(_0x46310d){_0x40f09a=_0x46310d;_0x3e1c73[_0xd2a2('0x39')]=_[_0xd2a2('0x3a')](db[_0xd2a2('0x92')][_0xd2a2('0x35')]);_0x3e1c73['query']=_[_0xd2a2('0x3a')](_0x3df7e0[_0xd2a2('0x3b')]);_0x3e1c73[_0xd2a2('0x3c')]=_['intersection'](_0x3e1c73['model'],_0x3e1c73[_0xd2a2('0x3b')]);_0x232fa0['attributes']=_[_0xd2a2('0x3e')](_0x3e1c73[_0xd2a2('0x39')],qs['fields'](_0x3df7e0[_0xd2a2('0x3b')][_0xd2a2('0x3f')]));_0x232fa0[_0xd2a2('0x3d')]=_0x232fa0[_0xd2a2('0x3d')]['length']?_0x232fa0[_0xd2a2('0x3d')]:_0x3e1c73[_0xd2a2('0x39')];_0x232fa0[_0xd2a2('0x43')]=qs[_0xd2a2('0x44')](_0x3df7e0[_0xd2a2('0x3b')][_0xd2a2('0x44')]);_0x232fa0[_0xd2a2('0x46')]=qs[_0xd2a2('0x3c')](_[_0xd2a2('0x5f')](_0x3df7e0['query'],_0x3e1c73['filters']));if(_0x3df7e0['query'][_0xd2a2('0x45')]){_0x232fa0[_0xd2a2('0x46')]=_[_0xd2a2('0x48')](_0x232fa0[_0xd2a2('0x46')],{'$or':_[_0xd2a2('0x33')](_0x232fa0[_0xd2a2('0x3d')],function(_0x8abbf0){var _0x5d7476={};_0x5d7476[_0x8abbf0]={'$like':'%'+_0x3df7e0[_0xd2a2('0x3b')]['filter']+'%'};return _0x5d7476;})});}_0x232fa0=_[_0xd2a2('0x48')]({},_0x232fa0,_0x3df7e0[_0xd2a2('0x49')]);return _0x40f09a[_0xd2a2('0x93')](_0x232fa0);}})[_0xd2a2('0x2c')](function(_0x10d32c){if(_0x10d32c){_0x32d81d=_0x10d32c[_0xd2a2('0x40')];if(!_0x3df7e0[_0xd2a2('0x3b')]['hasOwnProperty']('nolimit')){_0x232fa0[_0xd2a2('0x25')]=qs[_0xd2a2('0x25')](_0x3df7e0['query'][_0xd2a2('0x25')]);_0x232fa0['offset']=qs[_0xd2a2('0x23')](_0x3df7e0[_0xd2a2('0x3b')]['offset']);}return _0x40f09a[_0xd2a2('0x93')](_0x232fa0);}})[_0xd2a2('0x2c')](function(_0x49de20){if(_0x49de20){return _0x49de20?{'count':_0x32d81d,'rows':_0x49de20}:null;}})[_0xd2a2('0x2c')](respondWithResult(_0x1701f9,null))[_0xd2a2('0x4c')](handleError(_0x1701f9,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 757c46f..6e371bc 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x10ddc4,_0x29acf9){var _0x1fdb84=function(_0x57c7e4){while(--_0x57c7e4){_0x10ddc4['push'](_0x10ddc4['shift']());}};_0x1fdb84(++_0x29acf9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5fc3,0xa8));var _0x35fc=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x5fc3[_0x10291b];return _0x1d5fbe;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 553534b..dc6d60a 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x14460c,_0x2bf131){var _0x5689a7=function(_0x4bd8a3){while(--_0x4bd8a3){_0x14460c['push'](_0x14460c['shift']());}};_0x5689a7(++_0x2bf131);}(_0xe706,0xa3));var _0x6e70=function(_0x3e6188,_0xd8d390){_0x3e6188=_0x3e6188-0x0;var _0x47bfe6=_0xe706[_0x3e6188];return _0x47bfe6;};'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'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x21a11e,_0x2bb7db){var _0x55e5a3=function(_0x8e02fe){while(--_0x8e02fe){_0x21a11e['push'](_0x21a11e['shift']());}};_0x55e5a3(++_0x2bb7db);}(_0x54ef,0x112));var _0xf54e=function(_0x41d2f9,_0x67c430){_0x41d2f9=_0x41d2f9-0x0;var _0x20a280=_0x54ef[_0x41d2f9];return _0x20a280;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index b884658..2328e61 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 _0xb4f8=['socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xb4f8,0x179));var _0x8b4f=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb4f8[_0x55abd9];return _0x3e5669;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b4f('0x0'));var BPromise=require(_0x8b4f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b4f('0x2'));var db=require(_0x8b4f('0x3'))['db'];var utils=require(_0x8b4f('0x4'));var logger=require(_0x8b4f('0x5'))(_0x8b4f('0x6'));var config=require(_0x8b4f('0x7'));var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});config['redis']=_[_0x8b4f('0xb')](config[_0x8b4f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b4f('0xd'))(new Redis(config[_0x8b4f('0xc')]));require(_0x8b4f('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f2384,_0x4033fd,_0x35c9c6){return new BPromise(function(_0x3f9fab,_0x1b529a){return client[_0x8b4f('0xf')](_0x1f2384,_0x35c9c6)[_0x8b4f('0x10')](function(_0x5da3d6){logger[_0x8b4f('0x11')](_0x8b4f('0x12'),_0x4033fd,_0x8b4f('0x13'));logger[_0x8b4f('0x14')](_0x8b4f('0x15'),_0x4033fd,_0x8b4f('0x13'),JSON['stringify'](_0x5da3d6));if(_0x5da3d6[_0x8b4f('0x16')]){if(_0x5da3d6[_0x8b4f('0x16')]['code']===0x1f4){logger[_0x8b4f('0x16')](_0x8b4f('0x12'),_0x4033fd,_0x5da3d6[_0x8b4f('0x16')][_0x8b4f('0x17')]);return _0x1b529a(_0x5da3d6[_0x8b4f('0x16')][_0x8b4f('0x17')]);}logger[_0x8b4f('0x16')](_0x8b4f('0x12'),_0x4033fd,_0x5da3d6[_0x8b4f('0x16')]['message']);return _0x3f9fab(_0x5da3d6[_0x8b4f('0x16')][_0x8b4f('0x17')]);}else{logger[_0x8b4f('0x11')]('CmList,\x20%s,\x20%s',_0x4033fd,'request\x20sent');_0x3f9fab(_0x5da3d6[_0x8b4f('0x18')]['message']);}})[_0x8b4f('0x19')](function(_0x576070){logger['error'](_0x8b4f('0x12'),_0x4033fd,_0x576070);_0x1b529a(_0x576070);});});} \ No newline at end of file +var _0xb559=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis'];(function(_0x5c374e,_0x41141b){var _0xebf39d=function(_0x68c64e){while(--_0x68c64e){_0x5c374e['push'](_0x5c374e['shift']());}};_0xebf39d(++_0x41141b);}(_0xb559,0x194));var _0x9b55=function(_0x48f80a,_0x3bb5d4){_0x48f80a=_0x48f80a-0x0;var _0x1327fb=_0xb559[_0x48f80a];return _0x1327fb;};'use strict';var _=require(_0x9b55('0x0'));var util=require(_0x9b55('0x1'));var moment=require(_0x9b55('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b55('0x3'));var db=require(_0x9b55('0x4'))['db'];var utils=require(_0x9b55('0x5'));var logger=require(_0x9b55('0x6'))('rpc');var config=require(_0x9b55('0x7'));var jayson=require(_0x9b55('0x8'));var client=jayson[_0x9b55('0x9')][_0x9b55('0xa')]({'port':0x232a});config[_0x9b55('0xb')]=_[_0x9b55('0xc')](config[_0x9b55('0xb')],{'host':_0x9b55('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b55('0xb')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4e9f14,_0xd11829,_0x575240){return new BPromise(function(_0x3e4061,_0x67423c){return client['request'](_0x4e9f14,_0x575240)['then'](function(_0xa45e75){logger[_0x9b55('0xe')](_0x9b55('0xf'),_0xd11829,_0x9b55('0x10'));logger[_0x9b55('0x11')](_0x9b55('0x12'),_0xd11829,_0x9b55('0x10'),JSON[_0x9b55('0x13')](_0xa45e75));if(_0xa45e75[_0x9b55('0x14')]){if(_0xa45e75[_0x9b55('0x14')][_0x9b55('0x15')]===0x1f4){logger[_0x9b55('0x14')](_0x9b55('0xf'),_0xd11829,_0xa45e75['error']['message']);return _0x67423c(_0xa45e75[_0x9b55('0x14')][_0x9b55('0x16')]);}logger[_0x9b55('0x14')](_0x9b55('0xf'),_0xd11829,_0xa45e75[_0x9b55('0x14')][_0x9b55('0x16')]);return _0x3e4061(_0xa45e75[_0x9b55('0x14')][_0x9b55('0x16')]);}else{logger['info'](_0x9b55('0xf'),_0xd11829,_0x9b55('0x10'));_0x3e4061(_0xa45e75[_0x9b55('0x17')][_0x9b55('0x16')]);}})['catch'](function(_0x30671d){logger['error']('CmList,\x20%s,\x20%s',_0xd11829,_0x30671d);_0x67423c(_0x30671d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8db9045..c4ab0eb 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 _0xdaf0=['update','register','length','./cmList.events','save','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdaf0,0xe7));var _0x0daf=function(_0xf1c314,_0x1eb23b){_0xf1c314=_0xf1c314-0x0;var _0x1b5e72=_0xdaf0[_0xf1c314];return _0x1b5e72;};'use strict';var CmListEvents=require(_0x0daf('0x0'));var events=[_0x0daf('0x1'),_0x0daf('0x2'),_0x0daf('0x3')];function createListener(_0xb1bde9,_0x548429){return function(_0x3d3c1f){_0x548429['emit'](_0xb1bde9,_0x3d3c1f);};}function removeListener(_0x3e27a7,_0x377245){return function(){CmListEvents['removeListener'](_0x3e27a7,_0x377245);};}exports[_0x0daf('0x4')]=function(_0x4c97ee){for(var _0x4fc03d=0x0,_0x310c81=events[_0x0daf('0x5')];_0x4fc03d<_0x310c81;_0x4fc03d++){var _0x35e1df=events[_0x4fc03d];var _0x591a54=createListener('cmList:'+_0x35e1df,_0x4c97ee);CmListEvents['on'](_0x35e1df,_0x591a54);}}; \ No newline at end of file +var _0xd704=['update','emit','removeListener','register','length','./cmList.events','remove'];(function(_0x444bce,_0x2b189c){var _0x4f4520=function(_0x534525){while(--_0x534525){_0x444bce['push'](_0x444bce['shift']());}};_0x4f4520(++_0x2b189c);}(_0xd704,0xd0));var _0x4d70=function(_0x4f897d,_0x24d781){_0x4f897d=_0x4f897d-0x0;var _0x5546fb=_0xd704[_0x4f897d];return _0x5546fb;};'use strict';var CmListEvents=require(_0x4d70('0x0'));var events=['save',_0x4d70('0x1'),_0x4d70('0x2')];function createListener(_0x53af0c,_0x436091){return function(_0x577670){_0x436091[_0x4d70('0x3')](_0x53af0c,_0x577670);};}function removeListener(_0x1574fa,_0x2c3657){return function(){CmListEvents[_0x4d70('0x4')](_0x1574fa,_0x2c3657);};}exports[_0x4d70('0x5')]=function(_0xc3b24b){for(var _0x48839f=0x0,_0x503a5e=events[_0x4d70('0x6')];_0x48839f<_0x503a5e;_0x48839f++){var _0x6bbf4f=events[_0x48839f];var _0x3c61cd=createListener('cmList:'+_0x6bbf4f,_0xc3b24b);CmListEvents['on'](_0x6bbf4f,_0x3c61cd);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index deb79ef..4ddbd7c 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 _0x0292=['get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/users','create','addDisposition','post','/:id/fields','addCustomField','addAgents','update','destroy','removeAgents','exports','path','express','../../components/interaction/service'];(function(_0x1b1a41,_0x37fdba){var _0x2ef3b7=function(_0x4ee4e0){while(--_0x4ee4e0){_0x1b1a41['push'](_0x1b1a41['shift']());}};_0x2ef3b7(++_0x37fdba);}(_0x0292,0x1ad));var _0x2029=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x0292[_0x476bf4];return _0x788ffe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2029('0x0'));var timeout=require('connect-timeout');var express=require(_0x2029('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2029('0x2'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x2029('0x3')]('/',auth[_0x2029('0x4')](),controller[_0x2029('0x5')]);router[_0x2029('0x3')](_0x2029('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2029('0x7'),auth[_0x2029('0x4')](),controller['show']);router[_0x2029('0x3')](_0x2029('0x8'),auth['isAuthenticated'](),controller[_0x2029('0x9')]);router[_0x2029('0x3')](_0x2029('0xa'),auth[_0x2029('0x4')](),controller['getContacts']);router[_0x2029('0x3')](_0x2029('0xb'),auth['isAuthenticated'](),controller[_0x2029('0xc')]);router[_0x2029('0x3')]('/:id/fields',auth[_0x2029('0x4')](),controller['getCustomFields']);router[_0x2029('0x3')](_0x2029('0xd'),auth[_0x2029('0x4')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x2029('0xe')]);router['post'](_0x2029('0x8'),auth[_0x2029('0x4')](),controller[_0x2029('0xf')]);router[_0x2029('0x10')](_0x2029('0xa'),auth[_0x2029('0x4')](),controller['addContacts']);router['post'](_0x2029('0x11'),auth['isAuthenticated'](),controller[_0x2029('0x12')]);router['post']('/:id/users',auth[_0x2029('0x4')](),controller[_0x2029('0x13')]);router['put']('/:id',auth[_0x2029('0x4')](),controller[_0x2029('0x14')]);router['delete'](_0x2029('0x7'),auth[_0x2029('0x4')](),controller[_0x2029('0x15')]);router['delete']('/:id/dispositions',auth[_0x2029('0x4')](),controller['removeDispositions']);router['delete']('/:id/users',auth[_0x2029('0x4')](),controller[_0x2029('0x16')]);module[_0x2029('0x17')]=router; \ No newline at end of file +var _0xdb4c=['/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe'];(function(_0x1e88eb,_0x186ef3){var _0x5dafcb=function(_0x51ffd4){while(--_0x51ffd4){_0x1e88eb['push'](_0x1e88eb['shift']());}};_0x5dafcb(++_0x186ef3);}(_0xdb4c,0x1dc));var _0xcdb4=function(_0x2ac2fa,_0x45fcbd){_0x2ac2fa=_0x2ac2fa-0x0;var _0x446364=_0xdb4c[_0x2ac2fa];return _0x446364;};'use strict';var multer=require(_0xcdb4('0x0'));var util=require(_0xcdb4('0x1'));var path=require(_0xcdb4('0x2'));var timeout=require(_0xcdb4('0x3'));var express=require(_0xcdb4('0x4'));var router=express['Router']();var fs_extra=require(_0xcdb4('0x5'));var auth=require(_0xcdb4('0x6'));var interaction=require(_0xcdb4('0x7'));var config=require(_0xcdb4('0x8'));var controller=require(_0xcdb4('0x9'));router[_0xcdb4('0xa')]('/',auth[_0xcdb4('0xb')](),controller['index']);router[_0xcdb4('0xa')](_0xcdb4('0xc'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0xd')]);router['get'](_0xcdb4('0xe'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0xf')]);router[_0xcdb4('0xa')](_0xcdb4('0x10'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x11')]);router[_0xcdb4('0xa')](_0xcdb4('0x12'),auth[_0xcdb4('0xb')](),controller['getContacts']);router[_0xcdb4('0xa')]('/:id/contacts/csv',auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x13')]);router[_0xcdb4('0xa')](_0xcdb4('0x14'),auth['isAuthenticated'](),controller[_0xcdb4('0x15')]);router['get'](_0xcdb4('0x16'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x17')]);router[_0xcdb4('0x18')]('/',auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x19')]);router[_0xcdb4('0x18')]('/:id/dispositions',auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x1a')]);router['post'](_0xcdb4('0x12'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xcdb4('0x14'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x1b')]);router[_0xcdb4('0x18')](_0xcdb4('0x16'),auth['isAuthenticated'](),controller[_0xcdb4('0x1c')]);router[_0xcdb4('0x1d')](_0xcdb4('0xe'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x1e')]);router['delete'](_0xcdb4('0xe'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x1f')]);router[_0xcdb4('0x20')](_0xcdb4('0x10'),auth[_0xcdb4('0xb')](),controller[_0xcdb4('0x21')]);router['delete'](_0xcdb4('0x16'),auth['isAuthenticated'](),controller[_0xcdb4('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b8d9691..6e82f02 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 _0x55a9=['exports','field','STRING','sequelize'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x55a9,0x103));var _0x955a=function(_0x25d881,_0x3444b4){_0x25d881=_0x25d881-0x0;var _0xa8f505=_0x55a9[_0x25d881];return _0xa8f505;};'use strict';var Sequelize=require(_0x955a('0x0'));module[_0x955a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d78fe){return this['getDataValue'](_0x955a('0x2'));}},'field':{'type':Sequelize[_0x955a('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x955a('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x955a('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xab4f=['sequelize','exports','VIRTUAL','STRING'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xab4f,0xbc));var _0xfab4=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xab4f[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xfab4('0x0'));module[_0xfab4('0x1')]={'name':{'type':Sequelize[_0xfab4('0x2')],'get':function(_0x27ed9f){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xfab4('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xfab4('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 3bcf8f2..e85ec46 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(_0x3da1bf,_0x205de8){var _0x44cb6e=function(_0x54e826){while(--_0x54e826){_0x3da1bf['push'](_0x3da1bf['shift']());}};_0x44cb6e(++_0x205de8);}(_0x7a54,0x106));var _0x47a5=function(_0xeb338d,_0x57b275){_0xeb338d=_0xeb338d-0x0;var _0x29086c=_0x7a54[_0xeb338d];return _0x29086c;};'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(_0x438abc,_0x150145){var _0x20d24b=function(_0x55bfc7){while(--_0x55bfc7){_0x438abc['push'](_0x438abc['shift']());}};_0x20d24b(++_0x150145);}(_0x7a54,0x106));var _0x47a5=function(_0x395e4f,_0x4159a6){_0x395e4f=_0x395e4f-0x0;var _0x1dbacd=_0x7a54[_0x395e4f];return _0x1dbacd;};'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 56cf86a..8b64d94 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 _0xd61f=['moment','bluebird','request-promise','path','../../config/environment','exports','Condition','lodash'];(function(_0x2b53bc,_0x9c40b5){var _0x4ce3ae=function(_0xddd89){while(--_0xddd89){_0x2b53bc['push'](_0x2b53bc['shift']());}};_0x4ce3ae(++_0x9c40b5);}(_0xd61f,0x9f));var _0xfd61=function(_0x35c201,_0x406f2b){_0x35c201=_0x35c201-0x0;var _0x25d3a4=_0xd61f[_0x35c201];return _0x25d3a4;};'use strict';var _=require(_0xfd61('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfd61('0x1'));var BPromise=require(_0xfd61('0x2'));var rp=require(_0xfd61('0x3'));var fs=require('fs');var path=require(_0xfd61('0x4'));var rimraf=require('rimraf');var config=require(_0xfd61('0x5'));var attributes=require('./condition.attributes');module[_0xfd61('0x6')]=function(_0x323f69,_0x49c7bf){return _0x323f69['define'](_0xfd61('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dee=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','Condition','lodash'];(function(_0x1762c4,_0x458ac5){var _0x5075a8=function(_0x371c56){while(--_0x371c56){_0x1762c4['push'](_0x1762c4['shift']());}};_0x5075a8(++_0x458ac5);}(_0x6dee,0x81));var _0xe6de=function(_0x45b46f,_0x291dbb){_0x45b46f=_0x45b46f-0x0;var _0x584441=_0x6dee[_0x45b46f];return _0x584441;};'use strict';var _=require(_0xe6de('0x0'));var util=require(_0xe6de('0x1'));var logger=require(_0xe6de('0x2'))(_0xe6de('0x3'));var moment=require(_0xe6de('0x4'));var BPromise=require('bluebird');var rp=require(_0xe6de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6de('0x6'));var config=require(_0xe6de('0x7'));var attributes=require('./condition.attributes');module[_0xe6de('0x8')]=function(_0x2c82d4,_0x37bbe0){return _0x2c82d4['define'](_0xe6de('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 0fa3fa4..eb01dc8 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 _0x31af=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x461d71,_0xdad325){var _0x443741=function(_0xc7954f){while(--_0xc7954f){_0x461d71['push'](_0x461d71['shift']());}};_0x443741(++_0xdad325);}(_0x31af,0x1cf));var _0xf31a=function(_0x5f12be,_0x7fc1c6){_0x5f12be=_0x5f12be-0x0;var _0x25f95f=_0x31af[_0x5f12be];return _0x25f95f;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require(_0xf31a('0x3'));var rs=require(_0xf31a('0x4'));var fs=require('fs');var Redis=require(_0xf31a('0x5'));var db=require(_0xf31a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf31a('0x7'))(_0xf31a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf31a('0x9'));var client=jayson[_0xf31a('0xa')][_0xf31a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x421ffc,_0x48d040,_0x3e986c){return new BPromise(function(_0x47faf4,_0x12c6ed){return client['request'](_0x421ffc,_0x3e986c)[_0xf31a('0xc')](function(_0x3b5419){logger[_0xf31a('0xd')](_0xf31a('0xe'),_0x48d040,'request\x20sent');logger['debug'](_0xf31a('0xf'),_0x48d040,_0xf31a('0x10'),JSON[_0xf31a('0x11')](_0x3b5419));if(_0x3b5419[_0xf31a('0x12')]){if(_0x3b5419[_0xf31a('0x12')][_0xf31a('0x13')]===0x1f4){logger[_0xf31a('0x12')](_0xf31a('0xe'),_0x48d040,_0x3b5419[_0xf31a('0x12')]['message']);return _0x12c6ed(_0x3b5419[_0xf31a('0x12')]['message']);}logger['error'](_0xf31a('0xe'),_0x48d040,_0x3b5419[_0xf31a('0x12')]['message']);return _0x47faf4(_0x3b5419['error'][_0xf31a('0x14')]);}else{logger[_0xf31a('0xd')](_0xf31a('0xe'),_0x48d040,_0xf31a('0x10'));_0x47faf4(_0x3b5419['result'][_0xf31a('0x14')]);}})[_0xf31a('0x15')](function(_0x127657){logger[_0xf31a('0x12')](_0xf31a('0xe'),_0x48d040,_0x127657);_0x12c6ed(_0x127657);});});} \ No newline at end of file +var _0x11f2=['then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3b5357,_0x1fbdde){var _0x9dce83=function(_0xa0807a){while(--_0xa0807a){_0x3b5357['push'](_0x3b5357['shift']());}};_0x9dce83(++_0x1fbdde);}(_0x11f2,0x9b));var _0x211f=function(_0x8b0e80,_0x3f21b5){_0x8b0e80=_0x8b0e80-0x0;var _0x270535=_0x11f2[_0x8b0e80];return _0x270535;};'use strict';var _=require('lodash');var util=require(_0x211f('0x0'));var moment=require(_0x211f('0x1'));var BPromise=require(_0x211f('0x2'));var rs=require(_0x211f('0x3'));var fs=require('fs');var Redis=require(_0x211f('0x4'));var db=require(_0x211f('0x5'))['db'];var utils=require(_0x211f('0x6'));var logger=require(_0x211f('0x7'))(_0x211f('0x8'));var config=require(_0x211f('0x9'));var jayson=require(_0x211f('0xa'));var client=jayson[_0x211f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3970c4,_0x35f8e3,_0x5d5b8c){return new BPromise(function(_0x5caca3,_0x5d4f7f){return client[_0x211f('0xc')](_0x3970c4,_0x5d5b8c)[_0x211f('0xd')](function(_0x3075d0){logger[_0x211f('0xe')](_0x211f('0xf'),_0x35f8e3,'request\x20sent');logger[_0x211f('0x10')](_0x211f('0x11'),_0x35f8e3,_0x211f('0x12'),JSON[_0x211f('0x13')](_0x3075d0));if(_0x3075d0[_0x211f('0x14')]){if(_0x3075d0[_0x211f('0x14')]['code']===0x1f4){logger[_0x211f('0x14')](_0x211f('0xf'),_0x35f8e3,_0x3075d0['error']['message']);return _0x5d4f7f(_0x3075d0[_0x211f('0x14')][_0x211f('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x35f8e3,_0x3075d0[_0x211f('0x14')][_0x211f('0x15')]);return _0x5caca3(_0x3075d0[_0x211f('0x14')][_0x211f('0x15')]);}else{logger[_0x211f('0xe')](_0x211f('0xf'),_0x35f8e3,_0x211f('0x12'));_0x5caca3(_0x3075d0[_0x211f('0x16')][_0x211f('0x15')]);}})[_0x211f('0x17')](function(_0x89f68f){logger[_0x211f('0x14')](_0x211f('0xf'),_0x35f8e3,_0x89f68f);_0x5d4f7f(_0x89f68f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8545310..5376469 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 _0xb0f8=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','multer','path'];(function(_0x4fa218,_0xcd57cd){var _0xfa4ef7=function(_0x594eea){while(--_0x594eea){_0x4fa218['push'](_0x4fa218['shift']());}};_0xfa4ef7(++_0xcd57cd);}(_0xb0f8,0x67));var _0x8b0f=function(_0x1486c0,_0x501de9){_0x1486c0=_0x1486c0-0x0;var _0x131307=_0xb0f8[_0x1486c0];return _0x131307;};'use strict';var multer=require(_0x8b0f('0x0'));var util=require('util');var path=require(_0x8b0f('0x1'));var timeout=require(_0x8b0f('0x2'));var express=require(_0x8b0f('0x3'));var router=express['Router']();var fs_extra=require(_0x8b0f('0x4'));var auth=require(_0x8b0f('0x5'));var interaction=require(_0x8b0f('0x6'));var config=require(_0x8b0f('0x7'));var controller=require(_0x8b0f('0x8'));router[_0x8b0f('0x9')]('/:id',auth[_0x8b0f('0xa')](),controller[_0x8b0f('0xb')]);router[_0x8b0f('0xc')](_0x8b0f('0xd'),auth[_0x8b0f('0xa')](),controller[_0x8b0f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcffd=['multer','util','path','Router','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x5e5a72,_0x3811ba){var _0x6bf9c2=function(_0x54e443){while(--_0x54e443){_0x5e5a72['push'](_0x5e5a72['shift']());}};_0x6bf9c2(++_0x3811ba);}(_0xcffd,0x188));var _0xdcff=function(_0x437191,_0x3dfedc){_0x437191=_0x437191-0x0;var _0x3b5d70=_0xcffd[_0x437191];return _0x3b5d70;};'use strict';var multer=require(_0xdcff('0x0'));var util=require(_0xdcff('0x1'));var path=require(_0xdcff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcff('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdcff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdcff('0x5'));var controller=require(_0xdcff('0x6'));router[_0xdcff('0x7')]('/:id',auth[_0xdcff('0x8')](),controller[_0xdcff('0x9')]);router[_0xdcff('0xa')](_0xdcff('0xb'),auth[_0xdcff('0x8')](),controller[_0xdcff('0xc')]);module[_0xdcff('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 59dc4c6..9d1de9c 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3dcc23,_0x583ede){var _0x4bbbb5=function(_0x492ada){while(--_0x492ada){_0x3dcc23['push'](_0x3dcc23['shift']());}};_0x4bbbb5(++_0x583ede);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x14c300,_0x18bf25){var _0x4753ae=function(_0x367c1c){while(--_0x367c1c){_0x14c300['push'](_0x14c300['shift']());}};_0x4753ae(++_0x18bf25);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 610194d..5a6264a 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 _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','getItems','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','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','clone','length','omit','createdAt','updatedAt'];(function(_0x4eb306,_0x3673ab){var _0x35b4f2=function(_0x3c10b0){while(--_0x3c10b0){_0x4eb306['push'](_0x4eb306['shift']());}};_0x35b4f2(++_0x3673ab);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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'];config['redis']=_[_0x49c4('0x16')](config[_0x49c4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0x18'))(new Redis(config[_0x49c4('0x17')]));require(_0x49c4('0x19'))[_0x49c4('0x1a')](socket);function respondWithStatusCode(_0x12777c,_0x18211c){_0x18211c=_0x18211c||0xcc;return function(_0x75ea8){if(_0x75ea8){return _0x12777c[_0x49c4('0x1b')](_0x18211c);}return _0x12777c['status'](_0x18211c)[_0x49c4('0x1c')]();};}function respondWithResult(_0x141003,_0x13a2db){_0x13a2db=_0x13a2db||0xc8;return function(_0x81e831){if(_0x81e831){return _0x141003[_0x49c4('0x1d')](_0x13a2db)['json'](_0x81e831);}};}function respondWithFilteredResult(_0x44e607,_0x2891f4){return function(_0x4c3253){if(_0x4c3253){var _0x512650=typeof _0x2891f4[_0x49c4('0x1e')]===_0x49c4('0x1f')&&typeof _0x2891f4[_0x49c4('0x20')]==='undefined';var _0x24856d=_0x4c3253['count'];var _0x2cbd50=_0x512650?0x0:_0x2891f4[_0x49c4('0x1e')];var _0xe31fcc=_0x512650?_0x4c3253[_0x49c4('0x21')]:_0x2891f4[_0x49c4('0x1e')]+_0x2891f4[_0x49c4('0x20')];var _0x280893;if(_0xe31fcc>=_0x24856d){_0xe31fcc=_0x24856d;_0x280893=0xc8;}else{_0x280893=0xce;}_0x44e607[_0x49c4('0x1d')](_0x280893);return _0x44e607[_0x49c4('0x22')]('Content-Range',_0x2cbd50+'-'+_0xe31fcc+'/'+_0x24856d)['json'](_0x4c3253);}return null;};}function patchUpdates(_0x57f502){return function(_0x1c99b1){try{jsonpatch['apply'](_0x1c99b1,_0x57f502,!![]);}catch(_0x592bb8){return BPromise[_0x49c4('0x23')](_0x592bb8);}return _0x1c99b1[_0x49c4('0x24')]();};}function saveUpdates(_0x26c640,_0xd335e4){return function(_0x4811c4){if(_0x4811c4){return _0x4811c4['update'](_0x26c640)[_0x49c4('0x25')](function(_0x9cb797){return _0x9cb797;});}return null;};}function removeEntity(_0x565423,_0x207358){return function(_0x43e014){if(_0x43e014){return _0x43e014[_0x49c4('0x26')]()[_0x49c4('0x25')](function(){var _0x531d92=_0x43e014['get']({'plain':!![]});var _0x449960='CustomDashboards';return db[_0x49c4('0x27')][_0x49c4('0x26')]({'where':{'type':_0x449960,'resourceId':_0x531d92['id']}})[_0x49c4('0x25')](function(){return _0x43e014;});})[_0x49c4('0x25')](function(){_0x565423['status'](0xcc)[_0x49c4('0x1c')]();});}};}function handleEntityNotFound(_0x2b2793,_0x46e04d){return function(_0x4f28a2){if(!_0x4f28a2){_0x2b2793[_0x49c4('0x1b')](0x194);}return _0x4f28a2;};}function handleError(_0x29f835,_0x26ba17){_0x26ba17=_0x26ba17||0x1f4;return function(_0x427b26){logger[_0x49c4('0x28')](_0x427b26[_0x49c4('0x29')]);if(_0x427b26[_0x49c4('0x2a')]){delete _0x427b26['name'];}_0x29f835['status'](_0x26ba17)['send'](_0x427b26);};}exports[_0x49c4('0x2b')]=function(_0x7ee704,_0x1eb035){var _0x27e467={},_0x28eb47={},_0x574fd3={'count':0x0,'rows':[]};var _0x38ad77=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x58e252){return{'name':_0x58e252['fieldName'],'type':_0x58e252[_0x49c4('0x2f')][_0x49c4('0x30')]};});_0x28eb47[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x38ad77,_0x49c4('0x2a'));_0x28eb47['query']=_[_0x49c4('0x32')](_0x7ee704[_0x49c4('0x33')]);_0x28eb47[_0x49c4('0x34')]=_['intersection'](_0x28eb47['model'],_0x28eb47[_0x49c4('0x33')]);_0x27e467[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x28eb47[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x37')]));_0x27e467[_0x49c4('0x35')]=_0x27e467[_0x49c4('0x35')]['length']?_0x27e467[_0x49c4('0x35')]:_0x28eb47['model'];if(!_0x7ee704[_0x49c4('0x33')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x27e467[_0x49c4('0x20')]=qs['limit'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x20')]);_0x27e467[_0x49c4('0x1e')]=qs['offset'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x1e')]);}_0x27e467[_0x49c4('0x3a')]=qs[_0x49c4('0x3b')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x27e467[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3d')](_0x7ee704[_0x49c4('0x33')],_0x28eb47[_0x49c4('0x34')]),_0x38ad77);if(_0x7ee704['query'][_0x49c4('0x3e')]){_0x27e467[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x27e467[_0x49c4('0x3c')],{'$or':_[_0x49c4('0x2c')](_0x38ad77,function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x2f')]!==_0x49c4('0x40')){var _0x248c0a={};_0x248c0a[_0x29dd5d[_0x49c4('0x2a')]]={'$like':'%'+_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3e')]+'%'};return _0x248c0a;}})});}_0x27e467=_[_0x49c4('0x3f')]({},_0x27e467,_0x7ee704['options']);var _0x212366={'where':_0x27e467['where']};return db[_0x49c4('0x2d')][_0x49c4('0x21')](_0x212366)[_0x49c4('0x25')](function(_0x1480da){_0x574fd3[_0x49c4('0x21')]=_0x1480da;if(_0x7ee704[_0x49c4('0x33')]['includeAll']){_0x27e467['include']=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x41')](_0x27e467);})[_0x49c4('0x25')](function(_0x117151){_0x574fd3['rows']=_0x117151;return _0x574fd3;})[_0x49c4('0x25')](respondWithFilteredResult(_0x1eb035,_0x27e467))[_0x49c4('0x42')](handleError(_0x1eb035,null));};exports[_0x49c4('0x43')]=function(_0x444270,_0x81a674){var _0x3bde49={'raw':![],'where':{'id':_0x444270[_0x49c4('0x44')]['id']}},_0x1a9593={};_0x1a9593[_0x49c4('0x31')]=_['keys'](db[_0x49c4('0x2d')]['rawAttributes']);_0x1a9593[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x444270[_0x49c4('0x33')]);_0x1a9593[_0x49c4('0x34')]=_[_0x49c4('0x36')](_0x1a9593['model'],_0x1a9593[_0x49c4('0x33')]);_0x3bde49[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x1a9593[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x444270[_0x49c4('0x33')][_0x49c4('0x37')]));_0x3bde49['attributes']=_0x3bde49[_0x49c4('0x35')]['length']?_0x3bde49[_0x49c4('0x35')]:_0x1a9593[_0x49c4('0x31')];if(_0x444270[_0x49c4('0x33')][_0x49c4('0x45')]){_0x3bde49[_0x49c4('0x46')]=[{'all':!![]}];}_0x3bde49=_[_0x49c4('0x3f')]({},_0x3bde49,_0x444270[_0x49c4('0x47')]);return db['Dashboard'][_0x49c4('0x48')](_0x3bde49)[_0x49c4('0x25')](handleEntityNotFound(_0x81a674,null))['then'](respondWithResult(_0x81a674,null))[_0x49c4('0x42')](handleError(_0x81a674,null));};exports[_0x49c4('0x49')]=function(_0xfbe179,_0x242afc){return db['Dashboard']['create'](_0xfbe179[_0x49c4('0x4a')],{})['then'](function(_0x4597c3){var _0x1f941f=_0xfbe179[_0x49c4('0x4b')][_0x49c4('0x4c')]({'plain':!![]});if(!_0x1f941f)throw new Error(_0x49c4('0x4d'));if(_0x1f941f[_0x49c4('0x4e')]===_0x49c4('0x4b')){var _0x563f0b=_0x4597c3[_0x49c4('0x4c')]({'plain':!![]});var _0x1550ce=_0x49c4('0x4f');return db[_0x49c4('0x50')][_0x49c4('0x48')]({'where':{'name':_0x1550ce,'userProfileId':_0x1f941f[_0x49c4('0x51')]},'raw':!![]})[_0x49c4('0x25')](function(_0x25d174){if(_0x25d174&&_0x25d174[_0x49c4('0x52')]===0x0){return db[_0x49c4('0x27')]['create']({'name':_0x563f0b['name'],'resourceId':_0x563f0b['id'],'type':_0x25d174[_0x49c4('0x2a')],'sectionId':_0x25d174['id']},{})[_0x49c4('0x25')](function(){return _0x4597c3;});}else{return _0x4597c3;}})['catch'](function(_0x59a8bc){logger[_0x49c4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a8bc);throw _0x59a8bc;});}return _0x4597c3;})['then'](respondWithResult(_0x242afc,0xc9))[_0x49c4('0x42')](handleError(_0x242afc,null));};exports[_0x49c4('0x53')]=function(_0x4a0a93,_0x38c480){var _0x2884ca={'where':{'id':_0x4a0a93[_0x49c4('0x44')]['id']}},_0x16949a={};_0x16949a['model']=_[_0x49c4('0x32')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x2884ca[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x16949a[_0x49c4('0x31')],qs['fields'](_0x4a0a93['query'][_0x49c4('0x37')]));_0x2884ca[_0x49c4('0x35')]=_0x2884ca[_0x49c4('0x35')][_0x49c4('0x54')]?_0x2884ca[_0x49c4('0x35')]:_0x16949a[_0x49c4('0x31')];if(_0x4a0a93[_0x49c4('0x33')]['includeAll']){_0x2884ca[_0x49c4('0x46')]=[{'all':!![]}];}_0x2884ca=_[_0x49c4('0x3f')]({},_0x2884ca,_0x4a0a93['options']);return db[_0x49c4('0x2d')]['find'](_0x2884ca)[_0x49c4('0x25')](handleEntityNotFound(_0x38c480,null))[_0x49c4('0x25')](function(_0x9eaa84){if(_0x9eaa84){var _0x2fe89a=_0x9eaa84[_0x49c4('0x4c')]({'plain':!![]});_0x2fe89a=qs[_0x49c4('0x55')](_0x2fe89a,['id',_0x49c4('0x56'),_0x49c4('0x57')]);_0x4a0a93['body']=_[_0x49c4('0x55')](_0x4a0a93[_0x49c4('0x4a')],['id','createdAt',_0x49c4('0x57')]);return db[_0x49c4('0x2d')]['create'](_[_0x49c4('0x3f')](_0x2fe89a,_0x4a0a93[_0x49c4('0x4a')]),{'include':_0x4a0a93['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x513879){var _0xc43386=_0x4a0a93['user'][_0x49c4('0x4c')]({'plain':!![]});if(!_0xc43386)throw new Error(_0x49c4('0x4d'));if(_0xc43386['role']===_0x49c4('0x4b')){var _0xdb2b33=_0x513879['get']({'plain':!![]});var _0x34272f=_0x49c4('0x4f');return db[_0x49c4('0x50')][_0x49c4('0x48')]({'where':{'name':_0x34272f,'userProfileId':_0xc43386['userProfileId']},'raw':!![]})[_0x49c4('0x25')](function(_0x16d0e1){if(_0x16d0e1&&_0x16d0e1[_0x49c4('0x52')]===0x0){return db[_0x49c4('0x27')]['create']({'name':_0xdb2b33[_0x49c4('0x2a')],'resourceId':_0xdb2b33['id'],'type':_0x16d0e1['name'],'sectionId':_0x16d0e1['id']},{})['then'](function(){return _0x513879;});}else{return _0x513879;}})['catch'](function(_0x5d6de0){logger[_0x49c4('0x28')](_0x49c4('0x58'),_0x5d6de0);throw _0x5d6de0;});}return _0x513879;});}})[_0x49c4('0x25')](respondWithResult(_0x38c480,0xc9))[_0x49c4('0x42')](handleError(_0x38c480,null));};exports['update']=function(_0x4daa6d,_0x340523){if(_0x4daa6d[_0x49c4('0x4a')]['id']){delete _0x4daa6d[_0x49c4('0x4a')]['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x4daa6d[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x340523,null))[_0x49c4('0x25')](saveUpdates(_0x4daa6d['body'],null))[_0x49c4('0x25')](respondWithResult(_0x340523,null))['catch'](handleError(_0x340523,null));};exports[_0x49c4('0x26')]=function(_0x264902,_0x1a5d4c){return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x264902[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1a5d4c,null))[_0x49c4('0x25')](removeEntity(_0x1a5d4c,null))[_0x49c4('0x42')](handleError(_0x1a5d4c,null));};function widgetAttributes(_0x1743d0){try{switch(_0x1743d0[_0x49c4('0x2f')]){case _0x49c4('0x59'):return[{'name':_0x49c4('0x5a'),'value':_0x1743d0[_0x49c4('0x5a')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0[_0x49c4('0x5b')][0x0][_0x49c4('0x5c')]:undefined)||'https://'}];case'custom':return[{'name':_0x49c4('0x5d'),'value':_0x1743d0[_0x49c4('0x5d')]||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0[_0x49c4('0x5b')][0x0][_0x49c4('0x5c')]:undefined)||''}];case _0x49c4('0x5e'):return[{'name':'attrHourFormat','value':_0x1743d0['attrHourFormat']||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0[_0x49c4('0x5b')][0x0][_0x49c4('0x5c')]:undefined)||_0x49c4('0x5f')},{'name':_0x49c4('0x60'),'value':_0x1743d0[_0x49c4('0x60')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x1]?_0x1743d0[_0x49c4('0x5b')][0x1]['value']:undefined)||_0x49c4('0x61')},{'name':_0x49c4('0x62'),'value':_0x1743d0[_0x49c4('0x62')]||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x2]?_0x1743d0[_0x49c4('0x5b')][0x2][_0x49c4('0x5c')]:undefined)||0xc}];case _0x49c4('0x63'):return[{'name':_0x49c4('0x64'),'value':_0x1743d0[_0x49c4('0x64')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0['attrs'][0x0][_0x49c4('0x5c')]:undefined)||_0x49c4('0x65')},{'name':_0x49c4('0x66'),'value':_0x1743d0[_0x49c4('0x66')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0['attrs'][0x1]?_0x1743d0['attrs'][0x1][_0x49c4('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x1743d0[_0x49c4('0x62')]||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x2]?_0x1743d0[_0x49c4('0x5b')][0x2][_0x49c4('0x5c')]:undefined)||0x14}];case _0x49c4('0x67'):case'pie-chart':return[{'name':_0x49c4('0x68'),'value':_0x1743d0[_0x49c4('0x68')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0[_0x49c4('0x5b')][0x0][_0x49c4('0x5c')]:undefined)||_0x49c4('0x65')},{'name':_0x49c4('0x69'),'value':_0x1743d0[_0x49c4('0x69')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0['attrs'][0x1]?_0x1743d0[_0x49c4('0x5b')][0x1][_0x49c4('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x1743d0[_0x49c4('0x6a')]||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x2]?_0x1743d0[_0x49c4('0x5b')][0x2][_0x49c4('0x5c')]:undefined)||null},{'name':_0x49c4('0x66'),'value':_0x1743d0[_0x49c4('0x66')]||(_0x1743d0['attrs']&&_0x1743d0[_0x49c4('0x5b')][0x3]?_0x1743d0[_0x49c4('0x5b')][0x3]['value']:undefined)||[]}];case _0x49c4('0x6b'):return[{'name':_0x49c4('0x6c'),'type':_0x1743d0['reportType']||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0['attrs'][0x0][_0x49c4('0x2f')]:undefined)||null,'value':_0x1743d0[_0x49c4('0x6c')]||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0[_0x49c4('0x5b')][0x0]?_0x1743d0['attrs'][0x0][_0x49c4('0x5c')]:undefined)||null},{'name':_0x49c4('0x6d'),'value':_0x1743d0['attrRefresh']||(_0x1743d0[_0x49c4('0x5b')]&&_0x1743d0['attrs'][0x1]?_0x1743d0['attrs'][0x1][_0x49c4('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x507078){logger['error'](_0x49c4('0x6e'),JSON[_0x49c4('0x6f')](_0x507078));return[];}}exports['addItem']=function(_0x23e684,_0x5c3509,_0x578f4b){if(_0x23e684['body']['id']){delete _0x23e684[_0x49c4('0x4a')]['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x23e684[_0x49c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c3509,null))['then'](function(_0x348693){if(_0x348693){_0x23e684['body'][_0x49c4('0x70')]=_0x348693['id'];_0x23e684['body'][_0x49c4('0x5b')]=widgetAttributes(_0x23e684[_0x49c4('0x4a')]);return db[_0x49c4('0x71')][_0x49c4('0x49')](_0x23e684[_0x49c4('0x4a')]);}})[_0x49c4('0x25')](respondWithResult(_0x5c3509,null))[_0x49c4('0x42')](handleError(_0x5c3509,null));};exports['getItems']=function(_0xbde4b2,_0x1518cb,_0x44a188){var _0x16864c={};var _0x6571a2={};var _0x4fe16a;var _0xdb366f;return db[_0x49c4('0x2d')][_0x49c4('0x72')]({'where':{'id':_0xbde4b2['params']['id']}})['then'](handleEntityNotFound(_0x1518cb,null))[_0x49c4('0x25')](function(_0x27b31d){if(_0x27b31d){_0x4fe16a=_0x27b31d;_0x6571a2[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x71')]['rawAttributes']);_0x6571a2[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0xbde4b2[_0x49c4('0x33')]);_0x6571a2[_0x49c4('0x34')]=_['intersection'](_0x6571a2['model'],_0x6571a2[_0x49c4('0x33')]);_0x16864c[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x6571a2[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0xbde4b2['query'][_0x49c4('0x37')]));_0x16864c[_0x49c4('0x35')]=_0x16864c[_0x49c4('0x35')][_0x49c4('0x54')]?_0x16864c[_0x49c4('0x35')]:_0x6571a2[_0x49c4('0x31')];_0x16864c['order']=qs[_0x49c4('0x3b')](_0xbde4b2[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x16864c[_0x49c4('0x3c')]=qs['filters'](_['pick'](_0xbde4b2[_0x49c4('0x33')],_0x6571a2['filters']));if(_0xbde4b2[_0x49c4('0x33')]['filter']){_0x16864c[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x16864c[_0x49c4('0x3c')],{'$or':_[_0x49c4('0x2c')](_0x16864c['attributes'],function(_0x4ad966){var _0x2e352e={};_0x2e352e[_0x4ad966]={'$like':'%'+_0xbde4b2[_0x49c4('0x33')][_0x49c4('0x3e')]+'%'};return _0x2e352e;})});}_0x16864c=_['merge']({},_0x16864c,_0xbde4b2['options']);return _0x4fe16a[_0x49c4('0x73')](_0x16864c);}})['then'](function(_0x5c4742){if(_0x5c4742){_0xdb366f=_0x5c4742[_0x49c4('0x54')];if(!_0xbde4b2['query'][_0x49c4('0x38')](_0x49c4('0x39'))){_0x16864c['limit']=qs[_0x49c4('0x20')](_0xbde4b2[_0x49c4('0x33')]['limit']);_0x16864c['offset']=qs[_0x49c4('0x1e')](_0xbde4b2['query'][_0x49c4('0x1e')]);}return _0x4fe16a[_0x49c4('0x73')](_0x16864c);}})[_0x49c4('0x25')](function(_0x352733){if(_0x352733){return _0x352733?{'count':_0xdb366f,'rows':_0x352733}:null;}})[_0x49c4('0x25')](respondWithResult(_0x1518cb,null))[_0x49c4('0x42')](handleError(_0x1518cb,null));}; \ No newline at end of file +var _0x0796=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','CustomDashboards','destroy','then','end','error','stack','name','send','index','map','Dashboard','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x0796,0x6b));var _0x6079=function(_0x3ca63c,_0x3d5ffa){_0x3ca63c=_0x3ca63c-0x0;var _0x5097dd=_0x0796[_0x3ca63c];return _0x5097dd;};'use strict';var emlformat=require(_0x6079('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6079('0x1'));var jsonpatch=require(_0x6079('0x2'));var rp=require(_0x6079('0x3'));var moment=require(_0x6079('0x4'));var BPromise=require(_0x6079('0x5'));var Mustache=require('mustache');var util=require(_0x6079('0x6'));var path=require(_0x6079('0x7'));var sox=require(_0x6079('0x8'));var csv=require(_0x6079('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6079('0xa'));var _=require(_0x6079('0xb'));var squel=require('squel');var crypto=require(_0x6079('0xc'));var jsforce=require(_0x6079('0xd'));var deskjs=require(_0x6079('0xe'));var toCsv=require(_0x6079('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6079('0xf'));var authService=require(_0x6079('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6079('0x11'));var hardwareService=require(_0x6079('0x12'));var logger=require(_0x6079('0x13'))(_0x6079('0x14'));var utils=require('../../config/utils');var config=require(_0x6079('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6079('0x16'))['db'];config[_0x6079('0x17')]=_[_0x6079('0x18')](config[_0x6079('0x17')],{'host':_0x6079('0x19'),'port':0x18eb});var socket=require(_0x6079('0x1a'))(new Redis(config[_0x6079('0x17')]));require('./dashboard.socket')[_0x6079('0x1b')](socket);function respondWithStatusCode(_0x555dc5,_0xf9f2f8){_0xf9f2f8=_0xf9f2f8||0xcc;return function(_0x28e7e3){if(_0x28e7e3){return _0x555dc5[_0x6079('0x1c')](_0xf9f2f8);}return _0x555dc5[_0x6079('0x1d')](_0xf9f2f8)['end']();};}function respondWithResult(_0x3ff093,_0x576797){_0x576797=_0x576797||0xc8;return function(_0x3abf5e){if(_0x3abf5e){return _0x3ff093['status'](_0x576797)[_0x6079('0x1e')](_0x3abf5e);}};}function respondWithFilteredResult(_0x37530c,_0x173cb8){return function(_0x1968d9){if(_0x1968d9){var _0x279453=typeof _0x173cb8[_0x6079('0x1f')]===_0x6079('0x20')&&typeof _0x173cb8['limit']===_0x6079('0x20');var _0x1aae2b=_0x1968d9[_0x6079('0x21')];var _0x2c4197=_0x279453?0x0:_0x173cb8['offset'];var _0x248da8=_0x279453?_0x1968d9[_0x6079('0x21')]:_0x173cb8[_0x6079('0x1f')]+_0x173cb8['limit'];var _0x4f304f;if(_0x248da8>=_0x1aae2b){_0x248da8=_0x1aae2b;_0x4f304f=0xc8;}else{_0x4f304f=0xce;}_0x37530c[_0x6079('0x1d')](_0x4f304f);return _0x37530c[_0x6079('0x22')](_0x6079('0x23'),_0x2c4197+'-'+_0x248da8+'/'+_0x1aae2b)[_0x6079('0x1e')](_0x1968d9);}return null;};}function patchUpdates(_0x4a9ec8){return function(_0x19188c){try{jsonpatch[_0x6079('0x24')](_0x19188c,_0x4a9ec8,!![]);}catch(_0x42469f){return BPromise[_0x6079('0x25')](_0x42469f);}return _0x19188c[_0x6079('0x26')]();};}function saveUpdates(_0x4635b5,_0x66424e){return function(_0x10604c){if(_0x10604c){return _0x10604c[_0x6079('0x27')](_0x4635b5)['then'](function(_0x3cfbed){return _0x3cfbed;});}return null;};}function removeEntity(_0x5291af,_0x3e63cf){return function(_0x31ab7a){if(_0x31ab7a){return _0x31ab7a['destroy']()['then'](function(){var _0x4d646a=_0x31ab7a[_0x6079('0x28')]({'plain':!![]});var _0x568558=_0x6079('0x29');return db['UserProfileResource'][_0x6079('0x2a')]({'where':{'type':_0x568558,'resourceId':_0x4d646a['id']}})[_0x6079('0x2b')](function(){return _0x31ab7a;});})[_0x6079('0x2b')](function(){_0x5291af[_0x6079('0x1d')](0xcc)[_0x6079('0x2c')]();});}};}function handleEntityNotFound(_0x2f3fb7,_0x3820a7){return function(_0x1f39b3){if(!_0x1f39b3){_0x2f3fb7[_0x6079('0x1c')](0x194);}return _0x1f39b3;};}function handleError(_0x1bd0ee,_0x2629eb){_0x2629eb=_0x2629eb||0x1f4;return function(_0x5c31fc){logger[_0x6079('0x2d')](_0x5c31fc[_0x6079('0x2e')]);if(_0x5c31fc[_0x6079('0x2f')]){delete _0x5c31fc['name'];}_0x1bd0ee['status'](_0x2629eb)[_0x6079('0x30')](_0x5c31fc);};}exports[_0x6079('0x31')]=function(_0x5a08a7,_0x37da54){var _0x24740c={},_0xdc5c20={},_0x2b33f2={'count':0x0,'rows':[]};var _0x546961=_[_0x6079('0x32')](db[_0x6079('0x33')][_0x6079('0x34')],function(_0x583bb8){return{'name':_0x583bb8['fieldName'],'type':_0x583bb8[_0x6079('0x35')]['key']};});_0xdc5c20[_0x6079('0x36')]=_[_0x6079('0x32')](_0x546961,_0x6079('0x2f'));_0xdc5c20[_0x6079('0x37')]=_[_0x6079('0x38')](_0x5a08a7['query']);_0xdc5c20[_0x6079('0x39')]=_[_0x6079('0x3a')](_0xdc5c20[_0x6079('0x36')],_0xdc5c20[_0x6079('0x37')]);_0x24740c['attributes']=_['intersection'](_0xdc5c20[_0x6079('0x36')],qs['fields'](_0x5a08a7[_0x6079('0x37')][_0x6079('0x3b')]));_0x24740c['attributes']=_0x24740c[_0x6079('0x3c')]['length']?_0x24740c['attributes']:_0xdc5c20[_0x6079('0x36')];if(!_0x5a08a7[_0x6079('0x37')]['hasOwnProperty'](_0x6079('0x3d'))){_0x24740c[_0x6079('0x3e')]=qs[_0x6079('0x3e')](_0x5a08a7['query'][_0x6079('0x3e')]);_0x24740c[_0x6079('0x1f')]=qs[_0x6079('0x1f')](_0x5a08a7[_0x6079('0x37')]['offset']);}_0x24740c[_0x6079('0x3f')]=qs[_0x6079('0x40')](_0x5a08a7['query'][_0x6079('0x40')]);_0x24740c[_0x6079('0x41')]=qs[_0x6079('0x39')](_[_0x6079('0x42')](_0x5a08a7['query'],_0xdc5c20[_0x6079('0x39')]),_0x546961);if(_0x5a08a7[_0x6079('0x37')]['filter']){_0x24740c['where']=_[_0x6079('0x43')](_0x24740c[_0x6079('0x41')],{'$or':_['map'](_0x546961,function(_0x5771eb){if(_0x5771eb[_0x6079('0x35')]!=='VIRTUAL'){var _0x35d512={};_0x35d512[_0x5771eb[_0x6079('0x2f')]]={'$like':'%'+_0x5a08a7[_0x6079('0x37')][_0x6079('0x44')]+'%'};return _0x35d512;}})});}_0x24740c=_[_0x6079('0x43')]({},_0x24740c,_0x5a08a7[_0x6079('0x45')]);var _0xe3f81c={'where':_0x24740c[_0x6079('0x41')]};return db[_0x6079('0x33')][_0x6079('0x21')](_0xe3f81c)['then'](function(_0x2644ea){_0x2b33f2['count']=_0x2644ea;if(_0x5a08a7[_0x6079('0x37')][_0x6079('0x46')]){_0x24740c[_0x6079('0x47')]=[{'all':!![]}];}return db[_0x6079('0x33')][_0x6079('0x48')](_0x24740c);})['then'](function(_0x2debcd){_0x2b33f2[_0x6079('0x49')]=_0x2debcd;return _0x2b33f2;})[_0x6079('0x2b')](respondWithFilteredResult(_0x37da54,_0x24740c))[_0x6079('0x4a')](handleError(_0x37da54,null));};exports[_0x6079('0x4b')]=function(_0x5d1adf,_0x364b31){var _0x752a39={'raw':![],'where':{'id':_0x5d1adf['params']['id']}},_0x10f16c={};_0x10f16c['model']=_['keys'](db[_0x6079('0x33')]['rawAttributes']);_0x10f16c[_0x6079('0x37')]=_['keys'](_0x5d1adf[_0x6079('0x37')]);_0x10f16c[_0x6079('0x39')]=_[_0x6079('0x3a')](_0x10f16c[_0x6079('0x36')],_0x10f16c[_0x6079('0x37')]);_0x752a39[_0x6079('0x3c')]=_[_0x6079('0x3a')](_0x10f16c['model'],qs[_0x6079('0x3b')](_0x5d1adf[_0x6079('0x37')][_0x6079('0x3b')]));_0x752a39[_0x6079('0x3c')]=_0x752a39[_0x6079('0x3c')][_0x6079('0x4c')]?_0x752a39[_0x6079('0x3c')]:_0x10f16c[_0x6079('0x36')];if(_0x5d1adf[_0x6079('0x37')][_0x6079('0x46')]){_0x752a39[_0x6079('0x47')]=[{'all':!![]}];}_0x752a39=_[_0x6079('0x43')]({},_0x752a39,_0x5d1adf['options']);return db[_0x6079('0x33')]['find'](_0x752a39)[_0x6079('0x2b')](handleEntityNotFound(_0x364b31,null))['then'](respondWithResult(_0x364b31,null))[_0x6079('0x4a')](handleError(_0x364b31,null));};exports[_0x6079('0x4d')]=function(_0x383be6,_0x42686f){return db[_0x6079('0x33')][_0x6079('0x4d')](_0x383be6[_0x6079('0x4e')],{})[_0x6079('0x2b')](function(_0x180776){var _0xb4bd23=_0x383be6[_0x6079('0x4f')][_0x6079('0x28')]({'plain':!![]});if(!_0xb4bd23)throw new Error(_0x6079('0x50'));if(_0xb4bd23[_0x6079('0x51')]===_0x6079('0x4f')){var _0x2d34e9=_0x180776[_0x6079('0x28')]({'plain':!![]});var _0x3fc610='CustomDashboards';return db[_0x6079('0x52')][_0x6079('0x53')]({'where':{'name':_0x3fc610,'userProfileId':_0xb4bd23[_0x6079('0x54')]},'raw':!![]})[_0x6079('0x2b')](function(_0x14f158){if(_0x14f158&&_0x14f158[_0x6079('0x55')]===0x0){return db[_0x6079('0x56')][_0x6079('0x4d')]({'name':_0x2d34e9[_0x6079('0x2f')],'resourceId':_0x2d34e9['id'],'type':_0x14f158[_0x6079('0x2f')],'sectionId':_0x14f158['id']},{})[_0x6079('0x2b')](function(){return _0x180776;});}else{return _0x180776;}})[_0x6079('0x4a')](function(_0x2ffcbf){logger[_0x6079('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ffcbf);throw _0x2ffcbf;});}return _0x180776;})['then'](respondWithResult(_0x42686f,0xc9))[_0x6079('0x4a')](handleError(_0x42686f,null));};exports[_0x6079('0x57')]=function(_0x2c97b1,_0x3f51b0){var _0x2bbc3e={'where':{'id':_0x2c97b1[_0x6079('0x58')]['id']}},_0x2bdc3a={};_0x2bdc3a[_0x6079('0x36')]=_[_0x6079('0x38')](db['Dashboard'][_0x6079('0x34')]);_0x2bbc3e[_0x6079('0x3c')]=_['intersection'](_0x2bdc3a[_0x6079('0x36')],qs[_0x6079('0x3b')](_0x2c97b1[_0x6079('0x37')][_0x6079('0x3b')]));_0x2bbc3e[_0x6079('0x3c')]=_0x2bbc3e[_0x6079('0x3c')][_0x6079('0x4c')]?_0x2bbc3e[_0x6079('0x3c')]:_0x2bdc3a[_0x6079('0x36')];if(_0x2c97b1[_0x6079('0x37')][_0x6079('0x46')]){_0x2bbc3e['include']=[{'all':!![]}];}_0x2bbc3e=_['merge']({},_0x2bbc3e,_0x2c97b1[_0x6079('0x45')]);return db[_0x6079('0x33')][_0x6079('0x53')](_0x2bbc3e)[_0x6079('0x2b')](handleEntityNotFound(_0x3f51b0,null))[_0x6079('0x2b')](function(_0x49453a){if(_0x49453a){var _0x2b7946=_0x49453a[_0x6079('0x28')]({'plain':!![]});_0x2b7946=qs[_0x6079('0x59')](_0x2b7946,['id','createdAt',_0x6079('0x5a')]);_0x2c97b1[_0x6079('0x4e')]=_[_0x6079('0x59')](_0x2c97b1[_0x6079('0x4e')],['id',_0x6079('0x5b'),_0x6079('0x5a')]);return db[_0x6079('0x33')][_0x6079('0x4d')](_['merge'](_0x2b7946,_0x2c97b1[_0x6079('0x4e')]),{'include':_0x2c97b1[_0x6079('0x37')][_0x6079('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0xd08ae8){var _0xf8b32a=_0x2c97b1[_0x6079('0x4f')][_0x6079('0x28')]({'plain':!![]});if(!_0xf8b32a)throw new Error(_0x6079('0x50'));if(_0xf8b32a[_0x6079('0x51')]===_0x6079('0x4f')){var _0xaf7556=_0xd08ae8[_0x6079('0x28')]({'plain':!![]});var _0x2c2ca1=_0x6079('0x29');return db[_0x6079('0x52')][_0x6079('0x53')]({'where':{'name':_0x2c2ca1,'userProfileId':_0xf8b32a['userProfileId']},'raw':!![]})['then'](function(_0x36fbcb){if(_0x36fbcb&&_0x36fbcb[_0x6079('0x55')]===0x0){return db['UserProfileResource'][_0x6079('0x4d')]({'name':_0xaf7556[_0x6079('0x2f')],'resourceId':_0xaf7556['id'],'type':_0x36fbcb[_0x6079('0x2f')],'sectionId':_0x36fbcb['id']},{})[_0x6079('0x2b')](function(){return _0xd08ae8;});}else{return _0xd08ae8;}})[_0x6079('0x4a')](function(_0x456d3a){logger[_0x6079('0x2d')](_0x6079('0x5c'),_0x456d3a);throw _0x456d3a;});}return _0xd08ae8;});}})[_0x6079('0x2b')](respondWithResult(_0x3f51b0,0xc9))[_0x6079('0x4a')](handleError(_0x3f51b0,null));};exports[_0x6079('0x27')]=function(_0xb44394,_0x2357e8){if(_0xb44394[_0x6079('0x4e')]['id']){delete _0xb44394['body']['id'];}return db[_0x6079('0x33')][_0x6079('0x53')]({'where':{'id':_0xb44394['params']['id']}})[_0x6079('0x2b')](handleEntityNotFound(_0x2357e8,null))['then'](saveUpdates(_0xb44394[_0x6079('0x4e')],null))[_0x6079('0x2b')](respondWithResult(_0x2357e8,null))['catch'](handleError(_0x2357e8,null));};exports[_0x6079('0x2a')]=function(_0x17e841,_0x87304){return db[_0x6079('0x33')][_0x6079('0x53')]({'where':{'id':_0x17e841['params']['id']}})[_0x6079('0x2b')](handleEntityNotFound(_0x87304,null))[_0x6079('0x2b')](removeEntity(_0x87304,null))['catch'](handleError(_0x87304,null));};function widgetAttributes(_0x48c5f8){try{switch(_0x48c5f8[_0x6079('0x35')]){case'iframe':return[{'name':_0x6079('0x5d'),'value':_0x48c5f8[_0x6079('0x5d')]||(_0x48c5f8['attrs']&&_0x48c5f8[_0x6079('0x5e')][0x0]?_0x48c5f8[_0x6079('0x5e')][0x0][_0x6079('0x5f')]:undefined)||'https://'}];case _0x6079('0x60'):return[{'name':_0x6079('0x61'),'value':_0x48c5f8[_0x6079('0x61')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8['attrs'][0x0]?_0x48c5f8['attrs'][0x0][_0x6079('0x5f')]:undefined)||''}];case _0x6079('0x62'):return[{'name':_0x6079('0x63'),'value':_0x48c5f8[_0x6079('0x63')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x0]?_0x48c5f8[_0x6079('0x5e')][0x0][_0x6079('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x6079('0x64'),'value':_0x48c5f8[_0x6079('0x64')]||(_0x48c5f8['attrs']&&_0x48c5f8[_0x6079('0x5e')][0x1]?_0x48c5f8[_0x6079('0x5e')][0x1][_0x6079('0x5f')]:undefined)||_0x6079('0x65')},{'name':_0x6079('0x66'),'value':_0x48c5f8[_0x6079('0x66')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x2]?_0x48c5f8[_0x6079('0x5e')][0x2][_0x6079('0x5f')]:undefined)||0xc}];case'counter':return[{'name':_0x6079('0x67'),'value':_0x48c5f8[_0x6079('0x67')]||(_0x48c5f8['attrs']&&_0x48c5f8[_0x6079('0x5e')][0x0]?_0x48c5f8['attrs'][0x0]['value']:undefined)||_0x6079('0x68')},{'name':_0x6079('0x69'),'value':_0x48c5f8[_0x6079('0x69')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8['attrs'][0x1]?_0x48c5f8['attrs'][0x1][_0x6079('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0x48c5f8['attrFontSize']||(_0x48c5f8['attrs']&&_0x48c5f8[_0x6079('0x5e')][0x2]?_0x48c5f8['attrs'][0x2][_0x6079('0x5f')]:undefined)||0x14}];case _0x6079('0x6a'):case'pie-chart':return[{'name':'attrSerie1','value':_0x48c5f8['attrSerie1']||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8['attrs'][0x0]?_0x48c5f8[_0x6079('0x5e')][0x0][_0x6079('0x5f')]:undefined)||'total'},{'name':'attrSerie2','value':_0x48c5f8['attrSerie2']||(_0x48c5f8['attrs']&&_0x48c5f8['attrs'][0x1]?_0x48c5f8['attrs'][0x1][_0x6079('0x5f')]:undefined)||null},{'name':_0x6079('0x6b'),'value':_0x48c5f8[_0x6079('0x6b')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x2]?_0x48c5f8['attrs'][0x2][_0x6079('0x5f')]:undefined)||null},{'name':_0x6079('0x69'),'value':_0x48c5f8[_0x6079('0x69')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8['attrs'][0x3]?_0x48c5f8[_0x6079('0x5e')][0x3][_0x6079('0x5f')]:undefined)||[]}];case _0x6079('0x6c'):return[{'name':_0x6079('0x6d'),'type':_0x48c5f8[_0x6079('0x6e')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x0]?_0x48c5f8['attrs'][0x0][_0x6079('0x35')]:undefined)||null,'value':_0x48c5f8[_0x6079('0x6d')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x0]?_0x48c5f8[_0x6079('0x5e')][0x0]['value']:undefined)||null},{'name':_0x6079('0x6f'),'value':_0x48c5f8[_0x6079('0x6f')]||(_0x48c5f8[_0x6079('0x5e')]&&_0x48c5f8[_0x6079('0x5e')][0x1]?_0x48c5f8[_0x6079('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x32df00){logger[_0x6079('0x2d')](_0x6079('0x70'),JSON[_0x6079('0x71')](_0x32df00));return[];}}exports['addItem']=function(_0x493d1e,_0x1c8869,_0x431398){if(_0x493d1e[_0x6079('0x4e')]['id']){delete _0x493d1e[_0x6079('0x4e')]['id'];}return db[_0x6079('0x33')][_0x6079('0x53')]({'where':{'id':_0x493d1e[_0x6079('0x58')]['id']}})[_0x6079('0x2b')](handleEntityNotFound(_0x1c8869,null))[_0x6079('0x2b')](function(_0xfb5b44){if(_0xfb5b44){_0x493d1e[_0x6079('0x4e')][_0x6079('0x72')]=_0xfb5b44['id'];_0x493d1e[_0x6079('0x4e')]['attrs']=widgetAttributes(_0x493d1e['body']);return db[_0x6079('0x73')][_0x6079('0x4d')](_0x493d1e[_0x6079('0x4e')]);}})['then'](respondWithResult(_0x1c8869,null))[_0x6079('0x4a')](handleError(_0x1c8869,null));};exports[_0x6079('0x74')]=function(_0x1620c8,_0x4eec7a,_0x726b10){var _0x5a9b3a={};var _0x3bb7a4={};var _0xab01ee;var _0x499764;return db[_0x6079('0x33')][_0x6079('0x75')]({'where':{'id':_0x1620c8[_0x6079('0x58')]['id']}})[_0x6079('0x2b')](handleEntityNotFound(_0x4eec7a,null))[_0x6079('0x2b')](function(_0x1e2497){if(_0x1e2497){_0xab01ee=_0x1e2497;_0x3bb7a4[_0x6079('0x36')]=_[_0x6079('0x38')](db['DashboardItem'][_0x6079('0x34')]);_0x3bb7a4[_0x6079('0x37')]=_['keys'](_0x1620c8[_0x6079('0x37')]);_0x3bb7a4[_0x6079('0x39')]=_['intersection'](_0x3bb7a4[_0x6079('0x36')],_0x3bb7a4[_0x6079('0x37')]);_0x5a9b3a[_0x6079('0x3c')]=_[_0x6079('0x3a')](_0x3bb7a4['model'],qs[_0x6079('0x3b')](_0x1620c8[_0x6079('0x37')]['fields']));_0x5a9b3a[_0x6079('0x3c')]=_0x5a9b3a['attributes']['length']?_0x5a9b3a['attributes']:_0x3bb7a4[_0x6079('0x36')];_0x5a9b3a[_0x6079('0x3f')]=qs[_0x6079('0x40')](_0x1620c8['query'][_0x6079('0x40')]);_0x5a9b3a[_0x6079('0x41')]=qs['filters'](_['pick'](_0x1620c8['query'],_0x3bb7a4[_0x6079('0x39')]));if(_0x1620c8[_0x6079('0x37')][_0x6079('0x44')]){_0x5a9b3a['where']=_[_0x6079('0x43')](_0x5a9b3a[_0x6079('0x41')],{'$or':_['map'](_0x5a9b3a[_0x6079('0x3c')],function(_0x48094b){var _0x295d22={};_0x295d22[_0x48094b]={'$like':'%'+_0x1620c8[_0x6079('0x37')][_0x6079('0x44')]+'%'};return _0x295d22;})});}_0x5a9b3a=_[_0x6079('0x43')]({},_0x5a9b3a,_0x1620c8[_0x6079('0x45')]);return _0xab01ee[_0x6079('0x74')](_0x5a9b3a);}})[_0x6079('0x2b')](function(_0x4e945c){if(_0x4e945c){_0x499764=_0x4e945c[_0x6079('0x4c')];if(!_0x1620c8[_0x6079('0x37')][_0x6079('0x76')]('nolimit')){_0x5a9b3a[_0x6079('0x3e')]=qs[_0x6079('0x3e')](_0x1620c8[_0x6079('0x37')][_0x6079('0x3e')]);_0x5a9b3a[_0x6079('0x1f')]=qs['offset'](_0x1620c8[_0x6079('0x37')][_0x6079('0x1f')]);}return _0xab01ee[_0x6079('0x74')](_0x5a9b3a);}})[_0x6079('0x2b')](function(_0x2ffc8f){if(_0x2ffc8f){return _0x2ffc8f?{'count':_0x499764,'rows':_0x2ffc8f}:null;}})[_0x6079('0x2b')](respondWithResult(_0x4eec7a,null))[_0x6079('0x4a')](handleError(_0x4eec7a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e7f9d16..c21d0af 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 _0x17b9=['setMaxListeners','save','update','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1ef28a,_0x43e524){var _0x43ebef=function(_0xe340a0){while(--_0xe340a0){_0x1ef28a['push'](_0x1ef28a['shift']());}};_0x43ebef(++_0x43e524);}(_0x17b9,0xd6));var _0x917b=function(_0x203779,_0x3199e7){_0x203779=_0x203779-0x0;var _0x261409=_0x17b9[_0x203779];return _0x261409;};'use strict';var EventEmitter=require(_0x917b('0x0'));var Dashboard=require(_0x917b('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x917b('0x2')](0x0);var events={'afterCreate':_0x917b('0x3'),'afterUpdate':_0x917b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3708f0){return function(_0x551819,_0x1c559c,_0x28421b){DashboardEvents['emit'](_0x3708f0+':'+_0x551819['id'],_0x551819);DashboardEvents['emit'](_0x3708f0,_0x551819);_0x28421b(null);};}for(var e in events){if(events[_0x917b('0x5')](e)){var event=events[e];Dashboard[_0x917b('0x6')](e,emitEvent(event));}}module[_0x917b('0x7')]=DashboardEvents; \ No newline at end of file +var _0x48ad=['emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','update','remove'];(function(_0x5274b8,_0x492cfb){var _0x1a4b00=function(_0x22bffd){while(--_0x22bffd){_0x5274b8['push'](_0x5274b8['shift']());}};_0x1a4b00(++_0x492cfb);}(_0x48ad,0xe5));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd48a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xd48a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd48a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd48a('0x3'),'afterDestroy':_0xd48a('0x4')};function emitEvent(_0x3a5444){return function(_0x339a1d,_0x5365d2,_0x112c8e){DashboardEvents[_0xd48a('0x5')](_0x3a5444+':'+_0x339a1d['id'],_0x339a1d);DashboardEvents['emit'](_0x3a5444,_0x339a1d);_0x112c8e(null);};}for(var e in events){if(events[_0xd48a('0x6')](e)){var event=events[e];Dashboard[_0xd48a('0x7')](e,emitEvent(event));}}module[_0xd48a('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ee53086..0ac0992 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 _0x8588=['./dashboard.attributes','exports','define','Dashboard','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x418ec1,_0x11c9a6){var _0x544286=function(_0x3b0546){while(--_0x3b0546){_0x418ec1['push'](_0x418ec1['shift']());}};_0x544286(++_0x11c9a6);}(_0x8588,0x185));var _0x8858=function(_0x6b7708,_0x3e3d26){_0x6b7708=_0x6b7708-0x0;var _0x9b2902=_0x8588[_0x6b7708];return _0x9b2902;};'use strict';var _=require('lodash');var util=require(_0x8858('0x0'));var logger=require(_0x8858('0x1'))(_0x8858('0x2'));var moment=require(_0x8858('0x3'));var BPromise=require('bluebird');var rp=require(_0x8858('0x4'));var fs=require('fs');var path=require(_0x8858('0x5'));var rimraf=require(_0x8858('0x6'));var config=require('../../config/environment');var attributes=require(_0x8858('0x7'));module[_0x8858('0x8')]=function(_0x5d7984,_0x370f4c){return _0x5d7984[_0x8858('0x9')](_0x8858('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x717b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','Dashboard','dashboards','lodash','util'];(function(_0x44761c,_0x3e8a38){var _0x495f15=function(_0x1c7fdf){while(--_0x1c7fdf){_0x44761c['push'](_0x44761c['shift']());}};_0x495f15(++_0x3e8a38);}(_0x717b,0x18a));var _0xb717=function(_0x16e89b,_0x345462){_0x16e89b=_0x16e89b-0x0;var _0x36da3e=_0x717b[_0x16e89b];return _0x36da3e;};'use strict';var _=require(_0xb717('0x0'));var util=require(_0xb717('0x1'));var logger=require(_0xb717('0x2'))(_0xb717('0x3'));var moment=require(_0xb717('0x4'));var BPromise=require(_0xb717('0x5'));var rp=require(_0xb717('0x6'));var fs=require('fs');var path=require(_0xb717('0x7'));var rimraf=require(_0xb717('0x8'));var config=require('../../config/environment');var attributes=require(_0xb717('0x9'));module['exports']=function(_0x4822dd,_0x40bc9d){return _0x4822dd['define'](_0xb717('0xa'),attributes,{'tableName':_0xb717('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 ceae790..b0a0d7d 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 _0xaf90=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2abc8e,_0x35a483){var _0x4f9f5a=function(_0x1baf28){while(--_0x1baf28){_0x2abc8e['push'](_0x2abc8e['shift']());}};_0x4f9f5a(++_0x35a483);}(_0xaf90,0x1f2));var _0x0af9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xaf90[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0af9('0x0'));var util=require(_0x0af9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0af9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0af9('0x3'))['db'];var utils=require(_0x0af9('0x4'));var logger=require(_0x0af9('0x5'))(_0x0af9('0x6'));var config=require('../../config/environment');var jayson=require(_0x0af9('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0af9('0x8')]=_['defaults'](config['redis'],{'host':_0x0af9('0x9'),'port':0x18eb});var socket=require(_0x0af9('0xa'))(new Redis(config['redis']));require(_0x0af9('0xb'))[_0x0af9('0xc')](socket);function respondWithRpcPromise(_0x326e56,_0x4ecc32,_0x4ead9f){return new BPromise(function(_0x363e12,_0x59b03e){return client[_0x0af9('0xd')](_0x326e56,_0x4ead9f)[_0x0af9('0xe')](function(_0x52f583){logger[_0x0af9('0xf')](_0x0af9('0x10'),_0x4ecc32,_0x0af9('0x11'));logger[_0x0af9('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4ecc32,'request\x20sent',JSON[_0x0af9('0x13')](_0x52f583));if(_0x52f583[_0x0af9('0x14')]){if(_0x52f583[_0x0af9('0x14')][_0x0af9('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x4ecc32,_0x52f583[_0x0af9('0x14')][_0x0af9('0x16')]);return _0x59b03e(_0x52f583['error'][_0x0af9('0x16')]);}logger[_0x0af9('0x14')]('Dashboard,\x20%s,\x20%s',_0x4ecc32,_0x52f583[_0x0af9('0x14')]['message']);return _0x363e12(_0x52f583['error']['message']);}else{logger[_0x0af9('0xf')](_0x0af9('0x10'),_0x4ecc32,_0x0af9('0x11'));_0x363e12(_0x52f583[_0x0af9('0x17')]['message']);}})[_0x0af9('0x18')](function(_0x8787f1){logger[_0x0af9('0x14')](_0x0af9('0x10'),_0x4ecc32,_0x8787f1);_0x59b03e(_0x8787f1);});});} \ No newline at end of file +var _0x47ba=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request'];(function(_0x4de798,_0x146402){var _0x3c0757=function(_0x42a629){while(--_0x42a629){_0x4de798['push'](_0x4de798['shift']());}};_0x3c0757(++_0x146402);}(_0x47ba,0x119));var _0xa47b=function(_0x54b179,_0x14a660){_0x54b179=_0x54b179-0x0;var _0x4a5650=_0x47ba[_0x54b179];return _0x4a5650;};'use strict';var _=require(_0xa47b('0x0'));var util=require(_0xa47b('0x1'));var moment=require('moment');var BPromise=require(_0xa47b('0x2'));var rs=require(_0xa47b('0x3'));var fs=require('fs');var Redis=require(_0xa47b('0x4'));var db=require(_0xa47b('0x5'))['db'];var utils=require(_0xa47b('0x6'));var logger=require('../../config/logger')(_0xa47b('0x7'));var config=require(_0xa47b('0x8'));var jayson=require(_0xa47b('0x9'));var client=jayson[_0xa47b('0xa')][_0xa47b('0xb')]({'port':0x232a});config['redis']=_[_0xa47b('0xc')](config[_0xa47b('0xd')],{'host':_0xa47b('0xe'),'port':0x18eb});var socket=require(_0xa47b('0xf'))(new Redis(config[_0xa47b('0xd')]));require(_0xa47b('0x10'))[_0xa47b('0x11')](socket);function respondWithRpcPromise(_0x1b0d0c,_0x4882b2,_0x59d3d6){return new BPromise(function(_0x389c7e,_0xbd2fdd){return client[_0xa47b('0x12')](_0x1b0d0c,_0x59d3d6)[_0xa47b('0x13')](function(_0x48ad60){logger[_0xa47b('0x14')](_0xa47b('0x15'),_0x4882b2,_0xa47b('0x16'));logger[_0xa47b('0x17')](_0xa47b('0x18'),_0x4882b2,_0xa47b('0x16'),JSON[_0xa47b('0x19')](_0x48ad60));if(_0x48ad60[_0xa47b('0x1a')]){if(_0x48ad60[_0xa47b('0x1a')]['code']===0x1f4){logger[_0xa47b('0x1a')](_0xa47b('0x15'),_0x4882b2,_0x48ad60[_0xa47b('0x1a')][_0xa47b('0x1b')]);return _0xbd2fdd(_0x48ad60[_0xa47b('0x1a')]['message']);}logger['error'](_0xa47b('0x15'),_0x4882b2,_0x48ad60['error'][_0xa47b('0x1b')]);return _0x389c7e(_0x48ad60[_0xa47b('0x1a')][_0xa47b('0x1b')]);}else{logger['info'](_0xa47b('0x15'),_0x4882b2,_0xa47b('0x16'));_0x389c7e(_0x48ad60[_0xa47b('0x1c')][_0xa47b('0x1b')]);}})[_0xa47b('0x1d')](function(_0x43776d){logger[_0xa47b('0x1a')]('Dashboard,\x20%s,\x20%s',_0x4882b2,_0x43776d);_0xbd2fdd(_0x43776d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 52f875b..f1a6a7c 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 _0xcd33=['emit','removeListener','register','./dashboard.events','save','remove','update'];(function(_0x587550,_0x20b13c){var _0x4b511b=function(_0x56fa44){while(--_0x56fa44){_0x587550['push'](_0x587550['shift']());}};_0x4b511b(++_0x20b13c);}(_0xcd33,0xa4));var _0x3cd3=function(_0x50f6ad,_0x486372){_0x50f6ad=_0x50f6ad-0x0;var _0xaf3de6=_0xcd33[_0x50f6ad];return _0xaf3de6;};'use strict';var DashboardEvents=require(_0x3cd3('0x0'));var events=[_0x3cd3('0x1'),_0x3cd3('0x2'),_0x3cd3('0x3')];function createListener(_0x59a227,_0x3f2ea9){return function(_0x3aa903){_0x3f2ea9[_0x3cd3('0x4')](_0x59a227,_0x3aa903);};}function removeListener(_0x156c8b,_0x53afe0){return function(){DashboardEvents[_0x3cd3('0x5')](_0x156c8b,_0x53afe0);};}exports[_0x3cd3('0x6')]=function(_0x48c4fb){for(var _0x872073=0x0,_0x5522ad=events['length'];_0x872073<_0x5522ad;_0x872073++){var _0x1ea199=events[_0x872073];var _0x5c01e8=createListener('dashboard:'+_0x1ea199,_0x48c4fb);DashboardEvents['on'](_0x1ea199,_0x5c01e8);}}; \ No newline at end of file +var _0x116e=['dashboard:','./dashboard.events','remove','update','emit','removeListener','register','length'];(function(_0x41acfd,_0xcfa795){var _0x3f1e79=function(_0x3e6db9){while(--_0x3e6db9){_0x41acfd['push'](_0x41acfd['shift']());}};_0x3f1e79(++_0xcfa795);}(_0x116e,0x69));var _0xe116=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x116e[_0x56138f];return _0x1acaf7;};'use strict';var DashboardEvents=require(_0xe116('0x0'));var events=['save',_0xe116('0x1'),_0xe116('0x2')];function createListener(_0x57a9b0,_0x276663){return function(_0xb0811b){_0x276663[_0xe116('0x3')](_0x57a9b0,_0xb0811b);};}function removeListener(_0x26dcc7,_0x580c50){return function(){DashboardEvents[_0xe116('0x4')](_0x26dcc7,_0x580c50);};}exports[_0xe116('0x5')]=function(_0x329184){for(var _0x5e0ba1=0x0,_0x4bdce4=events[_0xe116('0x6')];_0x5e0ba1<_0x4bdce4;_0x5e0ba1++){var _0x2fb445=events[_0x5e0ba1];var _0x2c9dfe=createListener(_0xe116('0x7')+_0x2fb445,_0x329184);DashboardEvents['on'](_0x2fb445,_0x2c9dfe);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index dae0a39..43db593 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 _0x5ee1=['/:id/items','post','create','/:id/clone','clone','addItem','put','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ee1,0xbe));var _0x15ee=function(_0x1d1b24,_0x360da4){_0x1d1b24=_0x1d1b24-0x0;var _0x4e0e0a=_0x5ee1[_0x1d1b24];return _0x4e0e0a;};'use strict';var multer=require(_0x15ee('0x0'));var util=require(_0x15ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x15ee('0x2'));var router=express['Router']();var fs_extra=require(_0x15ee('0x3'));var auth=require(_0x15ee('0x4'));var interaction=require(_0x15ee('0x5'));var config=require('../../config/environment');var controller=require(_0x15ee('0x6'));router[_0x15ee('0x7')]('/',auth[_0x15ee('0x8')](),controller['index']);router[_0x15ee('0x7')](_0x15ee('0x9'),auth[_0x15ee('0x8')](),controller['show']);router[_0x15ee('0x7')](_0x15ee('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x15ee('0xb')]('/',auth[_0x15ee('0x8')](),controller[_0x15ee('0xc')]);router[_0x15ee('0xb')](_0x15ee('0xd'),auth[_0x15ee('0x8')](),controller[_0x15ee('0xe')]);router['post'](_0x15ee('0xa'),auth[_0x15ee('0x8')](),controller[_0x15ee('0xf')]);router[_0x15ee('0x10')](_0x15ee('0x9'),auth[_0x15ee('0x8')](),controller['update']);router[_0x15ee('0x11')](_0x15ee('0x9'),auth[_0x15ee('0x8')](),controller[_0x15ee('0x12')]);module[_0x15ee('0x13')]=router; \ No newline at end of file +var _0xa93c=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3236f8,_0x379d97){var _0x2b5ed2=function(_0x3264e6){while(--_0x3264e6){_0x3236f8['push'](_0x3236f8['shift']());}};_0x2b5ed2(++_0x379d97);}(_0xa93c,0xd8));var _0xca93=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xa93c[_0x50a004];return _0x5e9992;};'use strict';var multer=require(_0xca93('0x0'));var util=require(_0xca93('0x1'));var path=require(_0xca93('0x2'));var timeout=require(_0xca93('0x3'));var express=require(_0xca93('0x4'));var router=express[_0xca93('0x5')]();var fs_extra=require(_0xca93('0x6'));var auth=require(_0xca93('0x7'));var interaction=require(_0xca93('0x8'));var config=require(_0xca93('0x9'));var controller=require('./dashboard.controller');router[_0xca93('0xa')]('/',auth[_0xca93('0xb')](),controller[_0xca93('0xc')]);router[_0xca93('0xa')](_0xca93('0xd'),auth[_0xca93('0xb')](),controller[_0xca93('0xe')]);router[_0xca93('0xa')](_0xca93('0xf'),auth[_0xca93('0xb')](),controller[_0xca93('0x10')]);router[_0xca93('0x11')]('/',auth[_0xca93('0xb')](),controller[_0xca93('0x12')]);router['post'](_0xca93('0x13'),auth[_0xca93('0xb')](),controller[_0xca93('0x14')]);router[_0xca93('0x11')]('/:id/items',auth[_0xca93('0xb')](),controller[_0xca93('0x15')]);router['put'](_0xca93('0xd'),auth['isAuthenticated'](),controller[_0xca93('0x16')]);router[_0xca93('0x17')](_0xca93('0xd'),auth[_0xca93('0xb')](),controller['destroy']);module[_0xca93('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index c69cdab..06a580b 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 _0x7096=['setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7096,0x10c));var _0x6709=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7096[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6709('0x0'));var _=require('lodash');module[_0x6709('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6709('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6709('0x3')](_0x6709('0x4')),'get':function(){try{return JSON[_0x6709('0x5')](this[_0x6709('0x6')](_0x6709('0x7')));}catch(_0xb8fe6d){return[];}},'set':function(_0x9d630f){try{this[_0x6709('0x8')](_0x6709('0x7'),JSON[_0x6709('0x9')](_0x9d630f));}catch(_0x985814){this[_0x6709('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6709('0xa')]},'col':{'type':Sequelize[_0x6709('0xa')]},'background':{'type':Sequelize[_0x6709('0x2')],'allowNull':![],'defaultValue':_0x6709('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6709('0x2')]},'titleFontSize':{'type':Sequelize[_0x6709('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x5c879e,_0xe58074){var _0x30942b=function(_0x535b57){while(--_0x535b57){_0x5c879e['push'](_0x5c879e['shift']());}};_0x30942b(++_0xe58074);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xfcf0[_0x2d982d];return _0x4f36b0;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 45d4b68..10e7ce0 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 _0x331e=['Content-Range','json','apply','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','end','status','offset','undefined','limit','count','set'];(function(_0x11f083,_0x38a7dd){var _0x1a41f3=function(_0x4570b5){while(--_0x4570b5){_0x11f083['push'](_0x11f083['shift']());}};_0x1a41f3(++_0x38a7dd);}(_0x331e,0x193));var _0xe331=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0x331e[_0x3585fb];return _0x48fb79;};'use strict';var emlformat=require(_0xe331('0x0'));var rimraf=require(_0xe331('0x1'));var zipdir=require(_0xe331('0x2'));var jsonpatch=require(_0xe331('0x3'));var rp=require(_0xe331('0x4'));var moment=require(_0xe331('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe331('0x6'));var util=require(_0xe331('0x7'));var path=require('path');var sox=require(_0xe331('0x8'));var csv=require(_0xe331('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe331('0xa'));var _=require('lodash');var squel=require(_0xe331('0xb'));var crypto=require(_0xe331('0xc'));var jsforce=require(_0xe331('0xd'));var deskjs=require(_0xe331('0xe'));var toCsv=require(_0xe331('0x9'));var querystring=require(_0xe331('0xf'));var Papa=require(_0xe331('0x10'));var Redis=require(_0xe331('0x11'));var authService=require(_0xe331('0x12'));var qs=require(_0xe331('0x13'));var as=require(_0xe331('0x14'));var hardwareService=require(_0xe331('0x15'));var logger=require('../../config/logger')(_0xe331('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe331('0x17'));var db=require(_0xe331('0x18'))['db'];config[_0xe331('0x19')]=_[_0xe331('0x1a')](config['redis'],{'host':_0xe331('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe331('0x19')]));require(_0xe331('0x1c'))['register'](socket);function respondWithStatusCode(_0x31987a,_0x499b64){_0x499b64=_0x499b64||0xcc;return function(_0x4d238f){if(_0x4d238f){return _0x31987a[_0xe331('0x1d')](_0x499b64);}return _0x31987a['status'](_0x499b64)[_0xe331('0x1e')]();};}function respondWithResult(_0x1cbf04,_0x9e235e){_0x9e235e=_0x9e235e||0xc8;return function(_0x32535c){if(_0x32535c){return _0x1cbf04[_0xe331('0x1f')](_0x9e235e)['json'](_0x32535c);}};}function respondWithFilteredResult(_0x189f66,_0x248b46){return function(_0xbde197){if(_0xbde197){var _0x3299f7=typeof _0x248b46[_0xe331('0x20')]===_0xe331('0x21')&&typeof _0x248b46[_0xe331('0x22')]===_0xe331('0x21');var _0x5d8269=_0xbde197[_0xe331('0x23')];var _0x331871=_0x3299f7?0x0:_0x248b46[_0xe331('0x20')];var _0x263cbb=_0x3299f7?_0xbde197[_0xe331('0x23')]:_0x248b46[_0xe331('0x20')]+_0x248b46[_0xe331('0x22')];var _0xb5310f;if(_0x263cbb>=_0x5d8269){_0x263cbb=_0x5d8269;_0xb5310f=0xc8;}else{_0xb5310f=0xce;}_0x189f66['status'](_0xb5310f);return _0x189f66[_0xe331('0x24')](_0xe331('0x25'),_0x331871+'-'+_0x263cbb+'/'+_0x5d8269)[_0xe331('0x26')](_0xbde197);}return null;};}function patchUpdates(_0x46c4e0){return function(_0x2910fc){try{jsonpatch[_0xe331('0x27')](_0x2910fc,_0x46c4e0,!![]);}catch(_0x1a15bf){return BPromise['reject'](_0x1a15bf);}return _0x2910fc['save']();};}function saveUpdates(_0x197b33,_0x598613){return function(_0xedef6a){if(_0xedef6a){return _0xedef6a[_0xe331('0x28')](_0x197b33)[_0xe331('0x29')](function(_0x445e29){return _0x445e29;});}return null;};}function removeEntity(_0x49ace1,_0x45d863){return function(_0x524e35){if(_0x524e35){return _0x524e35[_0xe331('0x2a')]()[_0xe331('0x29')](function(){_0x49ace1['status'](0xcc)[_0xe331('0x1e')]();});}};}function handleEntityNotFound(_0x477a99,_0x2bd194){return function(_0x20e908){if(!_0x20e908){_0x477a99[_0xe331('0x1d')](0x194);}return _0x20e908;};}function handleError(_0x520692,_0x459add){_0x459add=_0x459add||0x1f4;return function(_0x4d218a){logger[_0xe331('0x2b')](_0x4d218a[_0xe331('0x2c')]);if(_0x4d218a[_0xe331('0x2d')]){delete _0x4d218a[_0xe331('0x2d')];}_0x520692[_0xe331('0x1f')](_0x459add)[_0xe331('0x2e')](_0x4d218a);};}exports['show']=function(_0x4aabc9,_0x59aa29){var _0x37dfe5={'raw':![],'where':{'id':_0x4aabc9[_0xe331('0x2f')]['id']}},_0xeb2f39={};_0xeb2f39[_0xe331('0x30')]=_[_0xe331('0x31')](db[_0xe331('0x32')][_0xe331('0x33')]);_0xeb2f39[_0xe331('0x34')]=_[_0xe331('0x31')](_0x4aabc9[_0xe331('0x34')]);_0xeb2f39[_0xe331('0x35')]=_[_0xe331('0x36')](_0xeb2f39['model'],_0xeb2f39[_0xe331('0x34')]);_0x37dfe5[_0xe331('0x37')]=_[_0xe331('0x36')](_0xeb2f39[_0xe331('0x30')],qs[_0xe331('0x38')](_0x4aabc9[_0xe331('0x34')][_0xe331('0x38')]));_0x37dfe5[_0xe331('0x37')]=_0x37dfe5[_0xe331('0x37')]['length']?_0x37dfe5[_0xe331('0x37')]:_0xeb2f39[_0xe331('0x30')];if(_0x4aabc9[_0xe331('0x34')][_0xe331('0x39')]){_0x37dfe5['include']=[{'all':!![]}];}_0x37dfe5=_['merge']({},_0x37dfe5,_0x4aabc9[_0xe331('0x3a')]);return db[_0xe331('0x32')][_0xe331('0x3b')](_0x37dfe5)[_0xe331('0x29')](handleEntityNotFound(_0x59aa29,null))['then'](respondWithResult(_0x59aa29,null))[_0xe331('0x3c')](handleError(_0x59aa29,null));};exports[_0xe331('0x2a')]=function(_0x39ea2b,_0x50ec45){return db['DashboardItem']['find']({'where':{'id':_0x39ea2b[_0xe331('0x2f')]['id']}})[_0xe331('0x29')](handleEntityNotFound(_0x50ec45,null))[_0xe331('0x29')](removeEntity(_0x50ec45,null))[_0xe331('0x3c')](handleError(_0x50ec45,null));};function widgetAttributes(_0x1acafa){try{switch(_0x1acafa[_0xe331('0x3d')]){case _0xe331('0x3e'):return[{'name':_0xe331('0x3f'),'value':_0x1acafa['attrUrl']||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x0]?_0x1acafa[_0xe331('0x40')][0x0][_0xe331('0x41')]:undefined)||_0xe331('0x42')}];case _0xe331('0x43'):return[{'name':_0xe331('0x44'),'value':_0x1acafa[_0xe331('0x44')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x0]?_0x1acafa['attrs'][0x0][_0xe331('0x41')]:undefined)||''}];case _0xe331('0x45'):return[{'name':_0xe331('0x46'),'value':_0x1acafa['attrHourFormat']||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa['attrs'][0x0]?_0x1acafa[_0xe331('0x40')][0x0][_0xe331('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1acafa[_0xe331('0x47')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa['attrs'][0x1]?_0x1acafa[_0xe331('0x40')][0x1][_0xe331('0x41')]:undefined)||'0.00'},{'name':_0xe331('0x48'),'value':_0x1acafa[_0xe331('0x48')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x2]?_0x1acafa[_0xe331('0x40')][0x2][_0xe331('0x41')]:undefined)||0xc}];case _0xe331('0x49'):return[{'name':_0xe331('0x4a'),'value':_0x1acafa[_0xe331('0x4a')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa['attrs'][0x0]?_0x1acafa[_0xe331('0x40')][0x0]['value']:undefined)||_0xe331('0x4b')},{'name':_0xe331('0x4c'),'value':_0x1acafa[_0xe331('0x4c')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x1]?_0x1acafa['attrs'][0x1][_0xe331('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x1acafa[_0xe331('0x48')]||(_0x1acafa['attrs']&&_0x1acafa[_0xe331('0x40')][0x2]?_0x1acafa['attrs'][0x2][_0xe331('0x41')]:undefined)||0x14}];case _0xe331('0x4d'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1acafa[_0xe331('0x4e')]||(_0x1acafa['attrs']&&_0x1acafa['attrs'][0x0]?_0x1acafa[_0xe331('0x40')][0x0][_0xe331('0x41')]:undefined)||_0xe331('0x4b')},{'name':_0xe331('0x4f'),'value':_0x1acafa[_0xe331('0x4f')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x1]?_0x1acafa['attrs'][0x1][_0xe331('0x41')]:undefined)||null},{'name':_0xe331('0x50'),'value':_0x1acafa[_0xe331('0x50')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x2]?_0x1acafa[_0xe331('0x40')][0x2]['value']:undefined)||null},{'name':_0xe331('0x4c'),'value':_0x1acafa[_0xe331('0x4c')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x3]?_0x1acafa['attrs'][0x3]['value']:undefined)||[]}];case _0xe331('0x51'):return[{'name':_0xe331('0x52'),'type':_0x1acafa['reportType']||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa['attrs'][0x0]?_0x1acafa[_0xe331('0x40')][0x0][_0xe331('0x3d')]:undefined)||null,'value':_0x1acafa[_0xe331('0x52')]||(_0x1acafa[_0xe331('0x40')]&&_0x1acafa[_0xe331('0x40')][0x0]?_0x1acafa[_0xe331('0x40')][0x0][_0xe331('0x41')]:undefined)||null},{'name':_0xe331('0x53'),'value':_0x1acafa[_0xe331('0x53')]||(_0x1acafa['attrs']&&_0x1acafa['attrs'][0x1]?_0x1acafa[_0xe331('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1f79f7){logger[_0xe331('0x2b')](_0xe331('0x54'),JSON[_0xe331('0x55')](_0x1f79f7));return[];}}exports['create']=function(_0x401d83,_0x5098f0){if(_0x401d83['body']){_0x401d83[_0xe331('0x56')][_0xe331('0x40')]=widgetAttributes(_0x401d83[_0xe331('0x56')]);}return db['DashboardItem'][_0xe331('0x57')](_0x401d83['body'],{})[_0xe331('0x29')](respondWithResult(_0x5098f0,0xc9))[_0xe331('0x3c')](handleError(_0x5098f0,null));};exports[_0xe331('0x28')]=function(_0x13b9d0,_0x244e66){if(_0x13b9d0['body']['id']){delete _0x13b9d0[_0xe331('0x56')]['id'];}_0x13b9d0[_0xe331('0x56')][_0xe331('0x40')]=widgetAttributes(_0x13b9d0['body']);return db['DashboardItem'][_0xe331('0x3b')]({'where':{'id':_0x13b9d0[_0xe331('0x2f')]['id']}})[_0xe331('0x29')](handleEntityNotFound(_0x244e66,null))[_0xe331('0x29')](saveUpdates(_0x13b9d0[_0xe331('0x56')],null))['then'](respondWithResult(_0x244e66,null))[_0xe331('0x3c')](handleError(_0x244e66,null));}; \ No newline at end of file +var _0xb328=['../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5a9207,_0x3770f9){var _0x51a97b=function(_0x5ce94f){while(--_0x5ce94f){_0x5a9207['push'](_0x5a9207['shift']());}};_0x51a97b(++_0x3770f9);}(_0xb328,0x104));var _0x8b32=function(_0xd65f2d,_0x1aeb88){_0xd65f2d=_0xd65f2d-0x0;var _0xffe841=_0xb328[_0xd65f2d];return _0xffe841;};'use strict';var emlformat=require(_0x8b32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b32('0x1'));var jsonpatch=require(_0x8b32('0x2'));var rp=require('request-promise');var moment=require(_0x8b32('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8b32('0x4'));var util=require(_0x8b32('0x5'));var path=require(_0x8b32('0x6'));var sox=require('sox');var csv=require(_0x8b32('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b32('0x8'));var squel=require(_0x8b32('0x9'));var crypto=require(_0x8b32('0xa'));var jsforce=require(_0x8b32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8b32('0x7'));var querystring=require(_0x8b32('0xc'));var Papa=require(_0x8b32('0xd'));var Redis=require('ioredis');var authService=require(_0x8b32('0xe'));var qs=require(_0x8b32('0xf'));var as=require(_0x8b32('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b32('0x11'))(_0x8b32('0x12'));var utils=require(_0x8b32('0x13'));var config=require(_0x8b32('0x14'));var licenseUtil=require(_0x8b32('0x15'));var db=require(_0x8b32('0x16'))['db'];config['redis']=_[_0x8b32('0x17')](config['redis'],{'host':_0x8b32('0x18'),'port':0x18eb});var socket=require(_0x8b32('0x19'))(new Redis(config[_0x8b32('0x1a')]));require(_0x8b32('0x1b'))[_0x8b32('0x1c')](socket);function respondWithStatusCode(_0x34e7ec,_0x3d12a0){_0x3d12a0=_0x3d12a0||0xcc;return function(_0x53a6e7){if(_0x53a6e7){return _0x34e7ec[_0x8b32('0x1d')](_0x3d12a0);}return _0x34e7ec[_0x8b32('0x1e')](_0x3d12a0)['end']();};}function respondWithResult(_0x139aee,_0x1696fd){_0x1696fd=_0x1696fd||0xc8;return function(_0x144c2f){if(_0x144c2f){return _0x139aee['status'](_0x1696fd)[_0x8b32('0x1f')](_0x144c2f);}};}function respondWithFilteredResult(_0x2f193c,_0x1e6b4c){return function(_0x3b2287){if(_0x3b2287){var _0x337a6e=typeof _0x1e6b4c[_0x8b32('0x20')]===_0x8b32('0x21')&&typeof _0x1e6b4c['limit']===_0x8b32('0x21');var _0x17b204=_0x3b2287['count'];var _0x3606a7=_0x337a6e?0x0:_0x1e6b4c[_0x8b32('0x20')];var _0x4144a2=_0x337a6e?_0x3b2287[_0x8b32('0x22')]:_0x1e6b4c[_0x8b32('0x20')]+_0x1e6b4c[_0x8b32('0x23')];var _0x390cdb;if(_0x4144a2>=_0x17b204){_0x4144a2=_0x17b204;_0x390cdb=0xc8;}else{_0x390cdb=0xce;}_0x2f193c[_0x8b32('0x1e')](_0x390cdb);return _0x2f193c[_0x8b32('0x24')](_0x8b32('0x25'),_0x3606a7+'-'+_0x4144a2+'/'+_0x17b204)[_0x8b32('0x1f')](_0x3b2287);}return null;};}function patchUpdates(_0x6d7b78){return function(_0x26f8be){try{jsonpatch[_0x8b32('0x26')](_0x26f8be,_0x6d7b78,!![]);}catch(_0x4ba34a){return BPromise['reject'](_0x4ba34a);}return _0x26f8be[_0x8b32('0x27')]();};}function saveUpdates(_0x2be159,_0xd190ff){return function(_0x35259a){if(_0x35259a){return _0x35259a[_0x8b32('0x28')](_0x2be159)[_0x8b32('0x29')](function(_0x119a29){return _0x119a29;});}return null;};}function removeEntity(_0x238439,_0x5bd116){return function(_0x17497d){if(_0x17497d){return _0x17497d['destroy']()[_0x8b32('0x29')](function(){_0x238439['status'](0xcc)[_0x8b32('0x2a')]();});}};}function handleEntityNotFound(_0x2f0bad,_0x54e7f5){return function(_0x1b998a){if(!_0x1b998a){_0x2f0bad[_0x8b32('0x1d')](0x194);}return _0x1b998a;};}function handleError(_0x2a4526,_0x3b3193){_0x3b3193=_0x3b3193||0x1f4;return function(_0x227b69){logger[_0x8b32('0x2b')](_0x227b69[_0x8b32('0x2c')]);if(_0x227b69[_0x8b32('0x2d')]){delete _0x227b69[_0x8b32('0x2d')];}_0x2a4526[_0x8b32('0x1e')](_0x3b3193)[_0x8b32('0x2e')](_0x227b69);};}exports[_0x8b32('0x2f')]=function(_0x413d00,_0x51d32c){var _0x1b4882={'raw':![],'where':{'id':_0x413d00[_0x8b32('0x30')]['id']}},_0x27eb93={};_0x27eb93[_0x8b32('0x31')]=_[_0x8b32('0x32')](db[_0x8b32('0x33')][_0x8b32('0x34')]);_0x27eb93[_0x8b32('0x35')]=_['keys'](_0x413d00['query']);_0x27eb93[_0x8b32('0x36')]=_[_0x8b32('0x37')](_0x27eb93[_0x8b32('0x31')],_0x27eb93[_0x8b32('0x35')]);_0x1b4882[_0x8b32('0x38')]=_[_0x8b32('0x37')](_0x27eb93[_0x8b32('0x31')],qs['fields'](_0x413d00[_0x8b32('0x35')][_0x8b32('0x39')]));_0x1b4882['attributes']=_0x1b4882[_0x8b32('0x38')]['length']?_0x1b4882['attributes']:_0x27eb93[_0x8b32('0x31')];if(_0x413d00[_0x8b32('0x35')][_0x8b32('0x3a')]){_0x1b4882[_0x8b32('0x3b')]=[{'all':!![]}];}_0x1b4882=_[_0x8b32('0x3c')]({},_0x1b4882,_0x413d00[_0x8b32('0x3d')]);return db[_0x8b32('0x33')][_0x8b32('0x3e')](_0x1b4882)[_0x8b32('0x29')](handleEntityNotFound(_0x51d32c,null))[_0x8b32('0x29')](respondWithResult(_0x51d32c,null))[_0x8b32('0x3f')](handleError(_0x51d32c,null));};exports[_0x8b32('0x40')]=function(_0x4852ad,_0x34f3d5){return db[_0x8b32('0x33')][_0x8b32('0x3e')]({'where':{'id':_0x4852ad[_0x8b32('0x30')]['id']}})[_0x8b32('0x29')](handleEntityNotFound(_0x34f3d5,null))[_0x8b32('0x29')](removeEntity(_0x34f3d5,null))[_0x8b32('0x3f')](handleError(_0x34f3d5,null));};function widgetAttributes(_0x59afc3){try{switch(_0x59afc3[_0x8b32('0x41')]){case _0x8b32('0x42'):return[{'name':'attrUrl','value':_0x59afc3[_0x8b32('0x43')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3[_0x8b32('0x44')][0x0]['value']:undefined)||_0x8b32('0x45')}];case _0x8b32('0x46'):return[{'name':_0x8b32('0x47'),'value':_0x59afc3[_0x8b32('0x47')]||(_0x59afc3['attrs']&&_0x59afc3['attrs'][0x0]?_0x59afc3[_0x8b32('0x44')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x59afc3[_0x8b32('0x48')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3[_0x8b32('0x44')][0x0][_0x8b32('0x49')]:undefined)||_0x8b32('0x4a')},{'name':_0x8b32('0x4b'),'value':_0x59afc3[_0x8b32('0x4b')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3['attrs'][0x1]?_0x59afc3[_0x8b32('0x44')][0x1]['value']:undefined)||_0x8b32('0x4c')},{'name':_0x8b32('0x4d'),'value':_0x59afc3[_0x8b32('0x4d')]||(_0x59afc3['attrs']&&_0x59afc3[_0x8b32('0x44')][0x2]?_0x59afc3['attrs'][0x2][_0x8b32('0x49')]:undefined)||0xc}];case _0x8b32('0x4e'):return[{'name':_0x8b32('0x4f'),'value':_0x59afc3[_0x8b32('0x4f')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3[_0x8b32('0x44')][0x0][_0x8b32('0x49')]:undefined)||_0x8b32('0x50')},{'name':_0x8b32('0x51'),'value':_0x59afc3['attrVoiceQueues']||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3['attrs'][0x1]?_0x59afc3['attrs'][0x1][_0x8b32('0x49')]:undefined)||[]},{'name':_0x8b32('0x4d'),'value':_0x59afc3['attrFontSize']||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x2]?_0x59afc3['attrs'][0x2][_0x8b32('0x49')]:undefined)||0x14}];case _0x8b32('0x52'):case'pie-chart':return[{'name':_0x8b32('0x53'),'value':_0x59afc3['attrSerie1']||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3[_0x8b32('0x44')][0x0][_0x8b32('0x49')]:undefined)||_0x8b32('0x50')},{'name':'attrSerie2','value':_0x59afc3[_0x8b32('0x54')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x1]?_0x59afc3[_0x8b32('0x44')][0x1][_0x8b32('0x49')]:undefined)||null},{'name':_0x8b32('0x55'),'value':_0x59afc3[_0x8b32('0x55')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x2]?_0x59afc3[_0x8b32('0x44')][0x2][_0x8b32('0x49')]:undefined)||null},{'name':_0x8b32('0x51'),'value':_0x59afc3[_0x8b32('0x51')]||(_0x59afc3[_0x8b32('0x44')]&&_0x59afc3[_0x8b32('0x44')][0x3]?_0x59afc3[_0x8b32('0x44')][0x3][_0x8b32('0x49')]:undefined)||[]}];case _0x8b32('0x56'):return[{'name':_0x8b32('0x57'),'type':_0x59afc3[_0x8b32('0x58')]||(_0x59afc3['attrs']&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3['attrs'][0x0][_0x8b32('0x41')]:undefined)||null,'value':_0x59afc3[_0x8b32('0x57')]||(_0x59afc3['attrs']&&_0x59afc3[_0x8b32('0x44')][0x0]?_0x59afc3[_0x8b32('0x44')][0x0][_0x8b32('0x49')]:undefined)||null},{'name':_0x8b32('0x59'),'value':_0x59afc3[_0x8b32('0x59')]||(_0x59afc3['attrs']&&_0x59afc3['attrs'][0x1]?_0x59afc3[_0x8b32('0x44')][0x1][_0x8b32('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x1830f8){logger[_0x8b32('0x2b')](_0x8b32('0x5a'),JSON[_0x8b32('0x5b')](_0x1830f8));return[];}}exports[_0x8b32('0x5c')]=function(_0x36938a,_0x308759){if(_0x36938a[_0x8b32('0x5d')]){_0x36938a[_0x8b32('0x5d')]['attrs']=widgetAttributes(_0x36938a[_0x8b32('0x5d')]);}return db[_0x8b32('0x33')][_0x8b32('0x5c')](_0x36938a[_0x8b32('0x5d')],{})['then'](respondWithResult(_0x308759,0xc9))['catch'](handleError(_0x308759,null));};exports[_0x8b32('0x28')]=function(_0x25d9f2,_0x148830){if(_0x25d9f2[_0x8b32('0x5d')]['id']){delete _0x25d9f2[_0x8b32('0x5d')]['id'];}_0x25d9f2[_0x8b32('0x5d')][_0x8b32('0x44')]=widgetAttributes(_0x25d9f2[_0x8b32('0x5d')]);return db[_0x8b32('0x33')]['find']({'where':{'id':_0x25d9f2[_0x8b32('0x30')]['id']}})[_0x8b32('0x29')](handleEntityNotFound(_0x148830,null))[_0x8b32('0x29')](saveUpdates(_0x25d9f2[_0x8b32('0x5d')],null))[_0x8b32('0x29')](respondWithResult(_0x148830,null))['catch'](handleError(_0x148830,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index cff5440..efbf634 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 _0x36e5=['exports','DashboardItem','setMaxListeners','update','remove','emit','hook'];(function(_0x46aebf,_0x5d8b0a){var _0x5afa3d=function(_0x39da35){while(--_0x39da35){_0x46aebf['push'](_0x46aebf['shift']());}};_0x5afa3d(++_0x5d8b0a);}(_0x36e5,0x6a));var _0x536e=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0x36e5[_0x9a7ea6];return _0x1c2040;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x536e('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x536e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x536e('0x2'),'afterDestroy':_0x536e('0x3')};function emitEvent(_0x3f7f40){return function(_0x5ec37d,_0x15092d,_0x44bb49){DashboardItemEvents[_0x536e('0x4')](_0x3f7f40+':'+_0x5ec37d['id'],_0x5ec37d);DashboardItemEvents[_0x536e('0x4')](_0x3f7f40,_0x5ec37d);_0x44bb49(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x536e('0x5')](e,emitEvent(event));}}module[_0x536e('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x1c76=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit'];(function(_0x34f553,_0x5885f0){var _0x271bf2=function(_0x481545){while(--_0x481545){_0x34f553['push'](_0x34f553['shift']());}};_0x271bf2(++_0x5885f0);}(_0x1c76,0x107));var _0x61c7=function(_0x10b312,_0x349cdd){_0x10b312=_0x10b312-0x0;var _0x3f0935=_0x1c76[_0x10b312];return _0x3f0935;};'use strict';var EventEmitter=require(_0x61c7('0x0'));var DashboardItem=require(_0x61c7('0x1'))['db'][_0x61c7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x61c7('0x3')](0x0);var events={'afterCreate':_0x61c7('0x4'),'afterUpdate':_0x61c7('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa73bfc){return function(_0xbdbee5,_0x6b87b7,_0x4de42a){DashboardItemEvents[_0x61c7('0x6')](_0xa73bfc+':'+_0xbdbee5['id'],_0xbdbee5);DashboardItemEvents[_0x61c7('0x6')](_0xa73bfc,_0xbdbee5);_0x4de42a(null);};}for(var e in events){if(events[_0x61c7('0x7')](e)){var event=events[e];DashboardItem[_0x61c7('0x8')](e,emitEvent(event));}}module[_0x61c7('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 30cb551..2da7001 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 _0x217a=['../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d46a4,_0x2daef9){var _0x4b07f5=function(_0x5c667e){while(--_0x5c667e){_0x5d46a4['push'](_0x5d46a4['shift']());}};_0x4b07f5(++_0x2daef9);}(_0x217a,0x130));var _0xa217=function(_0x2ce2cb,_0x4208bc){_0x2ce2cb=_0x2ce2cb-0x0;var _0x96dc22=_0x217a[_0x2ce2cb];return _0x96dc22;};'use strict';var _=require(_0xa217('0x0'));var util=require('util');var logger=require(_0xa217('0x1'))(_0xa217('0x2'));var moment=require(_0xa217('0x3'));var BPromise=require(_0xa217('0x4'));var rp=require(_0xa217('0x5'));var fs=require('fs');var path=require(_0xa217('0x6'));var rimraf=require(_0xa217('0x7'));var config=require(_0xa217('0x8'));var attributes=require(_0xa217('0x9'));module['exports']=function(_0x154984,_0x4223ca){return _0x154984[_0xa217('0xa')](_0xa217('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8cd=['api','moment','path','rimraf','exports','define','dashboard_items','lodash','util','../../config/logger'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xf8cd,0x16f));var _0xdf8c=function(_0x2f50e2,_0x346e69){_0x2f50e2=_0x2f50e2-0x0;var _0x19414d=_0xf8cd[_0x2f50e2];return _0x19414d;};'use strict';var _=require(_0xdf8c('0x0'));var util=require(_0xdf8c('0x1'));var logger=require(_0xdf8c('0x2'))(_0xdf8c('0x3'));var moment=require(_0xdf8c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf8c('0x5'));var rimraf=require(_0xdf8c('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xdf8c('0x7')]=function(_0x4d8081,_0x451cb1){return _0x4d8081[_0xdf8c('0x8')]('DashboardItem',attributes,{'tableName':_0xdf8c('0x9'),'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 939cbc4..945fbff 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 _0xf0ee=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DashboardItem,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xf0ee,0x90));var _0xef0e=function(_0x799ccd,_0x1fdbda){_0x799ccd=_0x799ccd-0x0;var _0x59cfb8=_0xf0ee[_0x799ccd];return _0x59cfb8;};'use strict';var _=require('lodash');var util=require(_0xef0e('0x0'));var moment=require(_0xef0e('0x1'));var BPromise=require(_0xef0e('0x2'));var rs=require(_0xef0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef0e('0x4'))['db'];var utils=require(_0xef0e('0x5'));var logger=require(_0xef0e('0x6'))('rpc');var config=require(_0xef0e('0x7'));var jayson=require(_0xef0e('0x8'));var client=jayson[_0xef0e('0x9')][_0xef0e('0xa')]({'port':0x232a});config[_0xef0e('0xb')]=_['defaults'](config[_0xef0e('0xb')],{'host':_0xef0e('0xc'),'port':0x18eb});var socket=require(_0xef0e('0xd'))(new Redis(config[_0xef0e('0xb')]));require(_0xef0e('0xe'))[_0xef0e('0xf')](socket);function respondWithRpcPromise(_0x2959e7,_0x39c158,_0x1c0aa2){return new BPromise(function(_0x542293,_0x573f38){return client[_0xef0e('0x10')](_0x2959e7,_0x1c0aa2)[_0xef0e('0x11')](function(_0x4b10be){logger['info']('DashboardItem,\x20%s,\x20%s',_0x39c158,'request\x20sent');logger['debug'](_0xef0e('0x12'),_0x39c158,_0xef0e('0x13'),JSON[_0xef0e('0x14')](_0x4b10be));if(_0x4b10be[_0xef0e('0x15')]){if(_0x4b10be[_0xef0e('0x15')]['code']===0x1f4){logger['error'](_0xef0e('0x16'),_0x39c158,_0x4b10be['error'][_0xef0e('0x17')]);return _0x573f38(_0x4b10be['error'][_0xef0e('0x17')]);}logger[_0xef0e('0x15')]('DashboardItem,\x20%s,\x20%s',_0x39c158,_0x4b10be[_0xef0e('0x15')][_0xef0e('0x17')]);return _0x542293(_0x4b10be[_0xef0e('0x15')][_0xef0e('0x17')]);}else{logger[_0xef0e('0x18')]('DashboardItem,\x20%s,\x20%s',_0x39c158,'request\x20sent');_0x542293(_0x4b10be[_0xef0e('0x19')][_0xef0e('0x17')]);}})[_0xef0e('0x1a')](function(_0x137604){logger[_0xef0e('0x15')](_0xef0e('0x16'),_0x39c158,_0x137604);_0x573f38(_0x137604);});});} \ No newline at end of file +var _0x2719=['localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x41b9ec,_0x2af5f9){var _0xc68d0f=function(_0x5b014a){while(--_0x5b014a){_0x41b9ec['push'](_0x41b9ec['shift']());}};_0xc68d0f(++_0x2af5f9);}(_0x2719,0x17c));var _0x9271=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x2719[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0x9271('0x0'));var util=require(_0x9271('0x1'));var moment=require(_0x9271('0x2'));var BPromise=require(_0x9271('0x3'));var rs=require(_0x9271('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9271('0x5'))['db'];var utils=require(_0x9271('0x6'));var logger=require('../../config/logger')(_0x9271('0x7'));var config=require(_0x9271('0x8'));var jayson=require(_0x9271('0x9'));var client=jayson['client'][_0x9271('0xa')]({'port':0x232a});config[_0x9271('0xb')]=_['defaults'](config[_0x9271('0xb')],{'host':_0x9271('0xc'),'port':0x18eb});var socket=require(_0x9271('0xd'))(new Redis(config[_0x9271('0xb')]));require(_0x9271('0xe'))['register'](socket);function respondWithRpcPromise(_0x46ab82,_0x2b2f7c,_0x323ecf){return new BPromise(function(_0x159a3f,_0x40dbc9){return client[_0x9271('0xf')](_0x46ab82,_0x323ecf)[_0x9271('0x10')](function(_0x76a722){logger[_0x9271('0x11')]('DashboardItem,\x20%s,\x20%s',_0x2b2f7c,_0x9271('0x12'));logger[_0x9271('0x13')](_0x9271('0x14'),_0x2b2f7c,_0x9271('0x12'),JSON[_0x9271('0x15')](_0x76a722));if(_0x76a722[_0x9271('0x16')]){if(_0x76a722['error'][_0x9271('0x17')]===0x1f4){logger['error'](_0x9271('0x18'),_0x2b2f7c,_0x76a722[_0x9271('0x16')][_0x9271('0x19')]);return _0x40dbc9(_0x76a722[_0x9271('0x16')][_0x9271('0x19')]);}logger[_0x9271('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2b2f7c,_0x76a722[_0x9271('0x16')][_0x9271('0x19')]);return _0x159a3f(_0x76a722[_0x9271('0x16')][_0x9271('0x19')]);}else{logger[_0x9271('0x11')](_0x9271('0x18'),_0x2b2f7c,_0x9271('0x12'));_0x159a3f(_0x76a722[_0x9271('0x1a')]['message']);}})[_0x9271('0x1b')](function(_0x55ee4a){logger[_0x9271('0x16')](_0x9271('0x18'),_0x2b2f7c,_0x55ee4a);_0x40dbc9(_0x55ee4a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f71c961..fe890bb 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 _0xe971=['removeListener','length','dashboardItem:','save','remove','update','emit'];(function(_0x5216d3,_0x44b23a){var _0x59f085=function(_0x4e2574){while(--_0x4e2574){_0x5216d3['push'](_0x5216d3['shift']());}};_0x59f085(++_0x44b23a);}(_0xe971,0x192));var _0x1e97=function(_0x364b44,_0x4effcf){_0x364b44=_0x364b44-0x0;var _0x536ee4=_0xe971[_0x364b44];return _0x536ee4;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x1e97('0x0'),_0x1e97('0x1'),_0x1e97('0x2')];function createListener(_0x441bb9,_0x488c8c){return function(_0x1ef46b){_0x488c8c[_0x1e97('0x3')](_0x441bb9,_0x1ef46b);};}function removeListener(_0x5c19f2,_0x5a3c90){return function(){DashboardItemEvents[_0x1e97('0x4')](_0x5c19f2,_0x5a3c90);};}exports['register']=function(_0x20f2f6){for(var _0x3202d9=0x0,_0x250218=events[_0x1e97('0x5')];_0x3202d9<_0x250218;_0x3202d9++){var _0x2bc33e=events[_0x3202d9];var _0x33453e=createListener(_0x1e97('0x6')+_0x2bc33e,_0x20f2f6);DashboardItemEvents['on'](_0x2bc33e,_0x33453e);}}; \ No newline at end of file +var _0xaca4=['length','./dashboardItem.events','save','emit','removeListener','register'];(function(_0x21f4a3,_0xe52114){var _0x55eb87=function(_0x1410ef){while(--_0x1410ef){_0x21f4a3['push'](_0x21f4a3['shift']());}};_0x55eb87(++_0xe52114);}(_0xaca4,0x145));var _0x4aca=function(_0x1e84ff,_0x354f81){_0x1e84ff=_0x1e84ff-0x0;var _0x244512=_0xaca4[_0x1e84ff];return _0x244512;};'use strict';var DashboardItemEvents=require(_0x4aca('0x0'));var events=[_0x4aca('0x1'),'remove','update'];function createListener(_0x5ea558,_0x2a80ef){return function(_0x29dd41){_0x2a80ef[_0x4aca('0x2')](_0x5ea558,_0x29dd41);};}function removeListener(_0x1602f4,_0x11f074){return function(){DashboardItemEvents[_0x4aca('0x3')](_0x1602f4,_0x11f074);};}exports[_0x4aca('0x4')]=function(_0x2ac61d){for(var _0x411418=0x0,_0x2bf8cb=events[_0x4aca('0x5')];_0x411418<_0x2bf8cb;_0x411418++){var _0x1be776=events[_0x411418];var _0x849016=createListener('dashboardItem:'+_0x1be776,_0x2ac61d);DashboardItemEvents['on'](_0x1be776,_0x849016);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index bf1a298..9252515 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 _0x7be1=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x9b3b43,_0x1708bb){var _0x2ce8c2=function(_0x21ce49){while(--_0x21ce49){_0x9b3b43['push'](_0x9b3b43['shift']());}};_0x2ce8c2(++_0x1708bb);}(_0x7be1,0xc7));var _0x17be=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0x7be1[_0x47199b];return _0x390911;};'use strict';var multer=require(_0x17be('0x0'));var util=require('util');var path=require(_0x17be('0x1'));var timeout=require('connect-timeout');var express=require(_0x17be('0x2'));var router=express[_0x17be('0x3')]();var fs_extra=require(_0x17be('0x4'));var auth=require(_0x17be('0x5'));var interaction=require(_0x17be('0x6'));var config=require(_0x17be('0x7'));var controller=require(_0x17be('0x8'));router[_0x17be('0x9')](_0x17be('0xa'),auth[_0x17be('0xb')](),controller[_0x17be('0xc')]);router[_0x17be('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x17be('0xe')](_0x17be('0xa'),auth[_0x17be('0xb')](),controller[_0x17be('0xf')]);router[_0x17be('0x10')](_0x17be('0xa'),auth[_0x17be('0xb')](),controller['destroy']);module[_0x17be('0x11')]=router; \ No newline at end of file +var _0x9cea=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x305bdf,_0x1fd2d7){var _0x4b8c73=function(_0x45289e){while(--_0x45289e){_0x305bdf['push'](_0x305bdf['shift']());}};_0x4b8c73(++_0x1fd2d7);}(_0x9cea,0x1c3));var _0xa9ce=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9cea[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xa9ce('0x0'));var util=require('util');var path=require(_0xa9ce('0x1'));var timeout=require(_0xa9ce('0x2'));var express=require(_0xa9ce('0x3'));var router=express[_0xa9ce('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9ce('0x5'));var config=require(_0xa9ce('0x6'));var controller=require('./dashboardItem.controller');router[_0xa9ce('0x7')](_0xa9ce('0x8'),auth[_0xa9ce('0x9')](),controller[_0xa9ce('0xa')]);router[_0xa9ce('0xb')]('/',auth[_0xa9ce('0x9')](),controller[_0xa9ce('0xc')]);router[_0xa9ce('0xd')](_0xa9ce('0x8'),auth['isAuthenticated'](),controller[_0xa9ce('0xe')]);router[_0xa9ce('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa9ce('0x10')]);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 22dfcbd..cdc2b1f 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 _0x6815=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x6815,0x1e3));var _0x5681=function(_0x2e6406,_0x68a533){_0x2e6406=_0x2e6406-0x0;var _0x4dfcfa=_0x6815[_0x2e6406];return _0x4dfcfa;};'use strict';var Sequelize=require(_0x5681('0x0'));module[_0x5681('0x1')]={'name':{'type':Sequelize[_0x5681('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5681('0x3')](_0x5681('0x4'),_0x5681('0x5'),'third'),'allowNull':![],'defaultValue':_0x5681('0x4')},'description':{'type':Sequelize[_0x5681('0x2')]}}; \ No newline at end of file +var _0xb31c=['STRING','ENUM','first','second','third','sequelize'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xb31c,0x101));var _0xcb31=function(_0x159b5e,_0x178251){_0x159b5e=_0x159b5e-0x0;var _0x4fb93d=_0xb31c[_0x159b5e];return _0x4fb93d;};'use strict';var Sequelize=require(_0xcb31('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb31('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xcb31('0x2')](_0xcb31('0x3'),_0xcb31('0x4'),_0xcb31('0x5')),'allowNull':![],'defaultValue':_0xcb31('0x3')},'description':{'type':Sequelize[_0xcb31('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 343d458..88f0769 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 _0x890c=['user','Dispositions','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','destroy','error','name','send','index','map','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','merge','options','Disposition','includeAll','include','findAll','rawAttributes','length','find','catch','create','body'];(function(_0x29528c,_0x347a9c){var _0x1f4f41=function(_0x10c2b2){while(--_0x10c2b2){_0x29528c['push'](_0x29528c['shift']());}};_0x1f4f41(++_0x347a9c);}(_0x890c,0xf1));var _0xc890=function(_0x813bc0,_0x212c11){_0x813bc0=_0x813bc0-0x0;var _0x39c3cd=_0x890c[_0x813bc0];return _0x39c3cd;};'use strict';var emlformat=require(_0xc890('0x0'));var rimraf=require(_0xc890('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc890('0x2'));var rp=require(_0xc890('0x3'));var moment=require(_0xc890('0x4'));var BPromise=require(_0xc890('0x5'));var Mustache=require(_0xc890('0x6'));var util=require(_0xc890('0x7'));var path=require(_0xc890('0x8'));var sox=require(_0xc890('0x9'));var csv=require(_0xc890('0xa'));var ejs=require(_0xc890('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc890('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc890('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc890('0xe'));var Redis=require(_0xc890('0xf'));var authService=require(_0xc890('0x10'));var qs=require(_0xc890('0x11'));var as=require(_0xc890('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc890('0x13'))(_0xc890('0x14'));var utils=require(_0xc890('0x15'));var config=require(_0xc890('0x16'));var licenseUtil=require(_0xc890('0x17'));var db=require(_0xc890('0x18'))['db'];function respondWithStatusCode(_0x22915d,_0x3547f9){_0x3547f9=_0x3547f9||0xcc;return function(_0x202596){if(_0x202596){return _0x22915d[_0xc890('0x19')](_0x3547f9);}return _0x22915d[_0xc890('0x1a')](_0x3547f9)[_0xc890('0x1b')]();};}function respondWithResult(_0x5f0b72,_0x45d7a3){_0x45d7a3=_0x45d7a3||0xc8;return function(_0x38a142){if(_0x38a142){return _0x5f0b72[_0xc890('0x1a')](_0x45d7a3)['json'](_0x38a142);}};}function respondWithFilteredResult(_0xb86514,_0x2405c1){return function(_0x937a9e){if(_0x937a9e){var _0x1d9326=typeof _0x2405c1[_0xc890('0x1c')]===_0xc890('0x1d')&&typeof _0x2405c1[_0xc890('0x1e')]===_0xc890('0x1d');var _0x14909a=_0x937a9e[_0xc890('0x1f')];var _0x224b82=_0x1d9326?0x0:_0x2405c1['offset'];var _0x1f4e3b=_0x1d9326?_0x937a9e[_0xc890('0x1f')]:_0x2405c1[_0xc890('0x1c')]+_0x2405c1[_0xc890('0x1e')];var _0x4c9b33;if(_0x1f4e3b>=_0x14909a){_0x1f4e3b=_0x14909a;_0x4c9b33=0xc8;}else{_0x4c9b33=0xce;}_0xb86514[_0xc890('0x1a')](_0x4c9b33);return _0xb86514[_0xc890('0x20')](_0xc890('0x21'),_0x224b82+'-'+_0x1f4e3b+'/'+_0x14909a)[_0xc890('0x22')](_0x937a9e);}return null;};}function patchUpdates(_0x2373c5){return function(_0x55ec8e){try{jsonpatch['apply'](_0x55ec8e,_0x2373c5,!![]);}catch(_0x234620){return BPromise[_0xc890('0x23')](_0x234620);}return _0x55ec8e[_0xc890('0x24')]();};}function saveUpdates(_0x1e45b2,_0x9fd8d3){return function(_0x592568){if(_0x592568){return _0x592568[_0xc890('0x25')](_0x1e45b2)[_0xc890('0x26')](function(_0x21b3f5){return _0x21b3f5;});}return null;};}function removeEntity(_0x437591,_0x1ccc3b){return function(_0x274476){if(_0x274476){return _0x274476['destroy']()[_0xc890('0x26')](function(){var _0x546eb0=_0x274476[_0xc890('0x27')]({'plain':!![]});var _0x2e9e05='Dispositions';return db['UserProfileResource'][_0xc890('0x28')]({'where':{'type':_0x2e9e05,'resourceId':_0x546eb0['id']}})['then'](function(){return _0x274476;});})[_0xc890('0x26')](function(){_0x437591[_0xc890('0x1a')](0xcc)[_0xc890('0x1b')]();});}};}function handleEntityNotFound(_0x1ba9c5,_0x49b573){return function(_0x36aee7){if(!_0x36aee7){_0x1ba9c5[_0xc890('0x19')](0x194);}return _0x36aee7;};}function handleError(_0x4ee2a0,_0x7c625d){_0x7c625d=_0x7c625d||0x1f4;return function(_0x2e9244){logger[_0xc890('0x29')](_0x2e9244['stack']);if(_0x2e9244[_0xc890('0x2a')]){delete _0x2e9244[_0xc890('0x2a')];}_0x4ee2a0[_0xc890('0x1a')](_0x7c625d)[_0xc890('0x2b')](_0x2e9244);};}exports[_0xc890('0x2c')]=function(_0x2e11bc,_0x251ef1){var _0x849e23={},_0x41f974={},_0x4dd7c4={'count':0x0,'rows':[]};var _0x2433a4=_[_0xc890('0x2d')](db['Disposition']['rawAttributes'],function(_0x5b02f0){return{'name':_0x5b02f0['fieldName'],'type':_0x5b02f0[_0xc890('0x2e')]['key']};});_0x41f974[_0xc890('0x2f')]=_[_0xc890('0x2d')](_0x2433a4,_0xc890('0x2a'));_0x41f974[_0xc890('0x30')]=_[_0xc890('0x31')](_0x2e11bc[_0xc890('0x30')]);_0x41f974[_0xc890('0x32')]=_[_0xc890('0x33')](_0x41f974[_0xc890('0x2f')],_0x41f974['query']);_0x849e23[_0xc890('0x34')]=_[_0xc890('0x33')](_0x41f974['model'],qs[_0xc890('0x35')](_0x2e11bc['query'][_0xc890('0x35')]));_0x849e23['attributes']=_0x849e23['attributes']['length']?_0x849e23[_0xc890('0x34')]:_0x41f974['model'];if(!_0x2e11bc[_0xc890('0x30')]['hasOwnProperty']('nolimit')){_0x849e23[_0xc890('0x1e')]=qs[_0xc890('0x1e')](_0x2e11bc[_0xc890('0x30')]['limit']);_0x849e23['offset']=qs['offset'](_0x2e11bc[_0xc890('0x30')][_0xc890('0x1c')]);}_0x849e23[_0xc890('0x36')]=qs[_0xc890('0x37')](_0x2e11bc[_0xc890('0x30')][_0xc890('0x37')]);_0x849e23[_0xc890('0x38')]=qs['filters'](_['pick'](_0x2e11bc[_0xc890('0x30')],_0x41f974[_0xc890('0x32')]),_0x2433a4);if(_0x2e11bc[_0xc890('0x30')][_0xc890('0x39')]){_0x849e23[_0xc890('0x38')]=_['merge'](_0x849e23[_0xc890('0x38')],{'$or':_['map'](_0x2433a4,function(_0x1550a0){if(_0x1550a0[_0xc890('0x2e')]!==_0xc890('0x3a')){var _0x5b56d5={};_0x5b56d5[_0x1550a0[_0xc890('0x2a')]]={'$like':'%'+_0x2e11bc['query'][_0xc890('0x39')]+'%'};return _0x5b56d5;}})});}_0x849e23=_[_0xc890('0x3b')]({},_0x849e23,_0x2e11bc[_0xc890('0x3c')]);var _0x2527f6={'where':_0x849e23['where']};return db[_0xc890('0x3d')]['count'](_0x2527f6)[_0xc890('0x26')](function(_0x5705a3){_0x4dd7c4[_0xc890('0x1f')]=_0x5705a3;if(_0x2e11bc[_0xc890('0x30')][_0xc890('0x3e')]){_0x849e23[_0xc890('0x3f')]=[{'all':!![]}];}return db[_0xc890('0x3d')][_0xc890('0x40')](_0x849e23);})[_0xc890('0x26')](function(_0x1c6c02){_0x4dd7c4['rows']=_0x1c6c02;return _0x4dd7c4;})[_0xc890('0x26')](respondWithFilteredResult(_0x251ef1,_0x849e23))['catch'](handleError(_0x251ef1,null));};exports['show']=function(_0x55fda3,_0x17bf13){var _0xa2529a={'raw':!![],'where':{'id':_0x55fda3['params']['id']}},_0x133220={};_0x133220['model']=_[_0xc890('0x31')](db['Disposition'][_0xc890('0x41')]);_0x133220[_0xc890('0x30')]=_['keys'](_0x55fda3[_0xc890('0x30')]);_0x133220[_0xc890('0x32')]=_[_0xc890('0x33')](_0x133220['model'],_0x133220[_0xc890('0x30')]);_0xa2529a[_0xc890('0x34')]=_[_0xc890('0x33')](_0x133220[_0xc890('0x2f')],qs[_0xc890('0x35')](_0x55fda3[_0xc890('0x30')]['fields']));_0xa2529a[_0xc890('0x34')]=_0xa2529a[_0xc890('0x34')][_0xc890('0x42')]?_0xa2529a[_0xc890('0x34')]:_0x133220[_0xc890('0x2f')];if(_0x55fda3[_0xc890('0x30')][_0xc890('0x3e')]){_0xa2529a[_0xc890('0x3f')]=[{'all':!![]}];}_0xa2529a=_[_0xc890('0x3b')]({},_0xa2529a,_0x55fda3[_0xc890('0x3c')]);return db[_0xc890('0x3d')][_0xc890('0x43')](_0xa2529a)[_0xc890('0x26')](handleEntityNotFound(_0x17bf13,null))['then'](respondWithResult(_0x17bf13,null))[_0xc890('0x44')](handleError(_0x17bf13,null));};exports[_0xc890('0x45')]=function(_0x8d246c,_0x5aa8d6){return db[_0xc890('0x3d')][_0xc890('0x45')](_0x8d246c[_0xc890('0x46')],{})['then'](function(_0x10dd57){var _0x5d7eb7=_0x8d246c[_0xc890('0x47')][_0xc890('0x27')]({'plain':!![]});if(!_0x5d7eb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d7eb7['role']===_0xc890('0x47')){var _0x3cf548=_0x10dd57[_0xc890('0x27')]({'plain':!![]});var _0x30d641=_0xc890('0x48');return db[_0xc890('0x49')][_0xc890('0x43')]({'where':{'name':_0x30d641,'userProfileId':_0x5d7eb7['userProfileId']},'raw':!![]})['then'](function(_0x4dc2e8){if(_0x4dc2e8&&_0x4dc2e8[_0xc890('0x4a')]===0x0){return db[_0xc890('0x4b')]['create']({'name':_0x3cf548['name'],'resourceId':_0x3cf548['id'],'type':_0x4dc2e8[_0xc890('0x2a')],'sectionId':_0x4dc2e8['id']},{})[_0xc890('0x26')](function(){return _0x10dd57;});}else{return _0x10dd57;}})[_0xc890('0x44')](function(_0x441d9f){logger[_0xc890('0x29')](_0xc890('0x4c'),_0x441d9f);throw _0x441d9f;});}return _0x10dd57;})[_0xc890('0x26')](respondWithResult(_0x5aa8d6,0xc9))[_0xc890('0x44')](handleError(_0x5aa8d6,null));};exports[_0xc890('0x25')]=function(_0x39329f,_0x2d3acd){if(_0x39329f[_0xc890('0x46')]['id']){delete _0x39329f[_0xc890('0x46')]['id'];}return db[_0xc890('0x3d')][_0xc890('0x43')]({'where':{'id':_0x39329f[_0xc890('0x4d')]['id']}})[_0xc890('0x26')](handleEntityNotFound(_0x2d3acd,null))['then'](saveUpdates(_0x39329f[_0xc890('0x46')],null))[_0xc890('0x26')](respondWithResult(_0x2d3acd,null))[_0xc890('0x44')](handleError(_0x2d3acd,null));};exports[_0xc890('0x28')]=function(_0x5e1e82,_0x561ae3){return db[_0xc890('0x3d')][_0xc890('0x43')]({'where':{'id':_0x5e1e82['params']['id']}})['then'](handleEntityNotFound(_0x561ae3,null))[_0xc890('0x26')](removeEntity(_0x561ae3,null))[_0xc890('0x44')](handleError(_0x561ae3,null));}; \ No newline at end of file +var _0xc205=['destroy','end','error','stack','name','index','map','Disposition','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource'];(function(_0x97bb48,_0x40dec1){var _0xd01b6=function(_0xff7505){while(--_0xff7505){_0x97bb48['push'](_0x97bb48['shift']());}};_0xd01b6(++_0x40dec1);}(_0xc205,0xcb));var _0x5c20=function(_0x5b2224,_0x1d20c3){_0x5b2224=_0x5b2224-0x0;var _0x4a65c9=_0xc205[_0x5b2224];return _0x4a65c9;};'use strict';var emlformat=require(_0x5c20('0x0'));var rimraf=require(_0x5c20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c20('0x2'));var rp=require(_0x5c20('0x3'));var moment=require(_0x5c20('0x4'));var BPromise=require(_0x5c20('0x5'));var Mustache=require(_0x5c20('0x6'));var util=require(_0x5c20('0x7'));var path=require(_0x5c20('0x8'));var sox=require(_0x5c20('0x9'));var csv=require(_0x5c20('0xa'));var ejs=require(_0x5c20('0xb'));var fs=require('fs');var fs_extra=require(_0x5c20('0xc'));var _=require('lodash');var squel=require(_0x5c20('0xd'));var crypto=require('crypto');var jsforce=require(_0x5c20('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c20('0xa'));var querystring=require(_0x5c20('0xf'));var Papa=require(_0x5c20('0x10'));var Redis=require(_0x5c20('0x11'));var authService=require(_0x5c20('0x12'));var qs=require(_0x5c20('0x13'));var as=require(_0x5c20('0x14'));var hardwareService=require(_0x5c20('0x15'));var logger=require(_0x5c20('0x16'))(_0x5c20('0x17'));var utils=require('../../config/utils');var config=require(_0x5c20('0x18'));var licenseUtil=require(_0x5c20('0x19'));var db=require(_0x5c20('0x1a'))['db'];function respondWithStatusCode(_0x4fd0e2,_0x367082){_0x367082=_0x367082||0xcc;return function(_0x5701c5){if(_0x5701c5){return _0x4fd0e2[_0x5c20('0x1b')](_0x367082);}return _0x4fd0e2[_0x5c20('0x1c')](_0x367082)['end']();};}function respondWithResult(_0x34608f,_0x74240e){_0x74240e=_0x74240e||0xc8;return function(_0x16666b){if(_0x16666b){return _0x34608f['status'](_0x74240e)[_0x5c20('0x1d')](_0x16666b);}};}function respondWithFilteredResult(_0x5a7407,_0x37c601){return function(_0xac4be7){if(_0xac4be7){var _0x27a65f=typeof _0x37c601[_0x5c20('0x1e')]==='undefined'&&typeof _0x37c601[_0x5c20('0x1f')]===_0x5c20('0x20');var _0x4b1cb4=_0xac4be7[_0x5c20('0x21')];var _0x5c1050=_0x27a65f?0x0:_0x37c601[_0x5c20('0x1e')];var _0x52fafa=_0x27a65f?_0xac4be7[_0x5c20('0x21')]:_0x37c601[_0x5c20('0x1e')]+_0x37c601['limit'];var _0x1bc0f0;if(_0x52fafa>=_0x4b1cb4){_0x52fafa=_0x4b1cb4;_0x1bc0f0=0xc8;}else{_0x1bc0f0=0xce;}_0x5a7407[_0x5c20('0x1c')](_0x1bc0f0);return _0x5a7407['set'](_0x5c20('0x22'),_0x5c1050+'-'+_0x52fafa+'/'+_0x4b1cb4)['json'](_0xac4be7);}return null;};}function patchUpdates(_0x359dee){return function(_0x5b8f3d){try{jsonpatch[_0x5c20('0x23')](_0x5b8f3d,_0x359dee,!![]);}catch(_0x123b80){return BPromise[_0x5c20('0x24')](_0x123b80);}return _0x5b8f3d[_0x5c20('0x25')]();};}function saveUpdates(_0xe1849d,_0xcc3b93){return function(_0x34506d){if(_0x34506d){return _0x34506d[_0x5c20('0x26')](_0xe1849d)[_0x5c20('0x27')](function(_0x300280){return _0x300280;});}return null;};}function removeEntity(_0x24fbb6,_0x274765){return function(_0x596217){if(_0x596217){return _0x596217['destroy']()[_0x5c20('0x27')](function(){var _0x317d2f=_0x596217[_0x5c20('0x28')]({'plain':!![]});var _0x327db0=_0x5c20('0x29');return db[_0x5c20('0x2a')][_0x5c20('0x2b')]({'where':{'type':_0x327db0,'resourceId':_0x317d2f['id']}})['then'](function(){return _0x596217;});})[_0x5c20('0x27')](function(){_0x24fbb6[_0x5c20('0x1c')](0xcc)[_0x5c20('0x2c')]();});}};}function handleEntityNotFound(_0x2b8948,_0xf00ed4){return function(_0x2f694f){if(!_0x2f694f){_0x2b8948[_0x5c20('0x1b')](0x194);}return _0x2f694f;};}function handleError(_0x3f139c,_0x510786){_0x510786=_0x510786||0x1f4;return function(_0x4bfbd0){logger[_0x5c20('0x2d')](_0x4bfbd0[_0x5c20('0x2e')]);if(_0x4bfbd0[_0x5c20('0x2f')]){delete _0x4bfbd0[_0x5c20('0x2f')];}_0x3f139c[_0x5c20('0x1c')](_0x510786)['send'](_0x4bfbd0);};}exports[_0x5c20('0x30')]=function(_0xa66e3e,_0x5f2152){var _0x8c376a={},_0x1753f0={},_0x5cc2bc={'count':0x0,'rows':[]};var _0x5604df=_[_0x5c20('0x31')](db[_0x5c20('0x32')][_0x5c20('0x33')],function(_0x4b804a){return{'name':_0x4b804a['fieldName'],'type':_0x4b804a['type'][_0x5c20('0x34')]};});_0x1753f0[_0x5c20('0x35')]=_[_0x5c20('0x31')](_0x5604df,'name');_0x1753f0['query']=_['keys'](_0xa66e3e[_0x5c20('0x36')]);_0x1753f0[_0x5c20('0x37')]=_[_0x5c20('0x38')](_0x1753f0[_0x5c20('0x35')],_0x1753f0['query']);_0x8c376a[_0x5c20('0x39')]=_[_0x5c20('0x38')](_0x1753f0[_0x5c20('0x35')],qs[_0x5c20('0x3a')](_0xa66e3e[_0x5c20('0x36')][_0x5c20('0x3a')]));_0x8c376a[_0x5c20('0x39')]=_0x8c376a[_0x5c20('0x39')][_0x5c20('0x3b')]?_0x8c376a[_0x5c20('0x39')]:_0x1753f0['model'];if(!_0xa66e3e[_0x5c20('0x36')]['hasOwnProperty'](_0x5c20('0x3c'))){_0x8c376a['limit']=qs[_0x5c20('0x1f')](_0xa66e3e[_0x5c20('0x36')]['limit']);_0x8c376a[_0x5c20('0x1e')]=qs['offset'](_0xa66e3e[_0x5c20('0x36')][_0x5c20('0x1e')]);}_0x8c376a[_0x5c20('0x3d')]=qs[_0x5c20('0x3e')](_0xa66e3e[_0x5c20('0x36')]['sort']);_0x8c376a['where']=qs[_0x5c20('0x37')](_[_0x5c20('0x3f')](_0xa66e3e[_0x5c20('0x36')],_0x1753f0['filters']),_0x5604df);if(_0xa66e3e[_0x5c20('0x36')][_0x5c20('0x40')]){_0x8c376a[_0x5c20('0x41')]=_[_0x5c20('0x42')](_0x8c376a[_0x5c20('0x41')],{'$or':_['map'](_0x5604df,function(_0x3a1d14){if(_0x3a1d14[_0x5c20('0x43')]!=='VIRTUAL'){var _0x1144d7={};_0x1144d7[_0x3a1d14[_0x5c20('0x2f')]]={'$like':'%'+_0xa66e3e[_0x5c20('0x36')]['filter']+'%'};return _0x1144d7;}})});}_0x8c376a=_[_0x5c20('0x42')]({},_0x8c376a,_0xa66e3e['options']);var _0x2c247b={'where':_0x8c376a[_0x5c20('0x41')]};return db['Disposition']['count'](_0x2c247b)[_0x5c20('0x27')](function(_0x4b3575){_0x5cc2bc[_0x5c20('0x21')]=_0x4b3575;if(_0xa66e3e['query']['includeAll']){_0x8c376a[_0x5c20('0x44')]=[{'all':!![]}];}return db[_0x5c20('0x32')]['findAll'](_0x8c376a);})[_0x5c20('0x27')](function(_0x10d79e){_0x5cc2bc[_0x5c20('0x45')]=_0x10d79e;return _0x5cc2bc;})[_0x5c20('0x27')](respondWithFilteredResult(_0x5f2152,_0x8c376a))[_0x5c20('0x46')](handleError(_0x5f2152,null));};exports[_0x5c20('0x47')]=function(_0x844d0c,_0x426fe1){var _0x23e0df={'raw':!![],'where':{'id':_0x844d0c[_0x5c20('0x48')]['id']}},_0x43e751={};_0x43e751[_0x5c20('0x35')]=_[_0x5c20('0x49')](db[_0x5c20('0x32')][_0x5c20('0x33')]);_0x43e751['query']=_[_0x5c20('0x49')](_0x844d0c['query']);_0x43e751[_0x5c20('0x37')]=_['intersection'](_0x43e751[_0x5c20('0x35')],_0x43e751['query']);_0x23e0df[_0x5c20('0x39')]=_['intersection'](_0x43e751['model'],qs[_0x5c20('0x3a')](_0x844d0c[_0x5c20('0x36')][_0x5c20('0x3a')]));_0x23e0df[_0x5c20('0x39')]=_0x23e0df[_0x5c20('0x39')]['length']?_0x23e0df['attributes']:_0x43e751[_0x5c20('0x35')];if(_0x844d0c[_0x5c20('0x36')]['includeAll']){_0x23e0df[_0x5c20('0x44')]=[{'all':!![]}];}_0x23e0df=_['merge']({},_0x23e0df,_0x844d0c[_0x5c20('0x4a')]);return db[_0x5c20('0x32')][_0x5c20('0x4b')](_0x23e0df)[_0x5c20('0x27')](handleEntityNotFound(_0x426fe1,null))[_0x5c20('0x27')](respondWithResult(_0x426fe1,null))[_0x5c20('0x46')](handleError(_0x426fe1,null));};exports[_0x5c20('0x4c')]=function(_0x295742,_0xe6e4b6){return db['Disposition'][_0x5c20('0x4c')](_0x295742[_0x5c20('0x4d')],{})[_0x5c20('0x27')](function(_0x48477e){var _0x1a9ac9=_0x295742[_0x5c20('0x4e')][_0x5c20('0x28')]({'plain':!![]});if(!_0x1a9ac9)throw new Error(_0x5c20('0x4f'));if(_0x1a9ac9['role']===_0x5c20('0x4e')){var _0x4f977a=_0x48477e[_0x5c20('0x28')]({'plain':!![]});var _0x1b38d9=_0x5c20('0x29');return db[_0x5c20('0x50')]['find']({'where':{'name':_0x1b38d9,'userProfileId':_0x1a9ac9[_0x5c20('0x51')]},'raw':!![]})[_0x5c20('0x27')](function(_0x2aaf1a){if(_0x2aaf1a&&_0x2aaf1a['autoAssociation']===0x0){return db[_0x5c20('0x2a')]['create']({'name':_0x4f977a['name'],'resourceId':_0x4f977a['id'],'type':_0x2aaf1a[_0x5c20('0x2f')],'sectionId':_0x2aaf1a['id']},{})[_0x5c20('0x27')](function(){return _0x48477e;});}else{return _0x48477e;}})[_0x5c20('0x46')](function(_0x58f608){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58f608);throw _0x58f608;});}return _0x48477e;})[_0x5c20('0x27')](respondWithResult(_0xe6e4b6,0xc9))[_0x5c20('0x46')](handleError(_0xe6e4b6,null));};exports[_0x5c20('0x26')]=function(_0x1f8a2e,_0x1d3976){if(_0x1f8a2e[_0x5c20('0x4d')]['id']){delete _0x1f8a2e[_0x5c20('0x4d')]['id'];}return db[_0x5c20('0x32')]['find']({'where':{'id':_0x1f8a2e[_0x5c20('0x48')]['id']}})[_0x5c20('0x27')](handleEntityNotFound(_0x1d3976,null))[_0x5c20('0x27')](saveUpdates(_0x1f8a2e['body'],null))[_0x5c20('0x27')](respondWithResult(_0x1d3976,null))['catch'](handleError(_0x1d3976,null));};exports[_0x5c20('0x2b')]=function(_0xa88c2f,_0x234b63){return db[_0x5c20('0x32')]['find']({'where':{'id':_0xa88c2f['params']['id']}})[_0x5c20('0x27')](handleEntityNotFound(_0x234b63,null))[_0x5c20('0x27')](removeEntity(_0x234b63,null))['catch'](handleError(_0x234b63,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e7846fd..f0322ae 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 _0x5ec5=['../../config/environment','./disposition.attributes','exports','define','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','api','moment','bluebird','request-promise'];(function(_0x5a0653,_0x39baa5){var _0x2d677c=function(_0x47f478){while(--_0x47f478){_0x5a0653['push'](_0x5a0653['shift']());}};_0x2d677c(++_0x39baa5);}(_0x5ec5,0x145));var _0x55ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5ec5[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x55ec('0x0'));var logger=require('../../config/logger')(_0x55ec('0x1'));var moment=require(_0x55ec('0x2'));var BPromise=require(_0x55ec('0x3'));var rp=require(_0x55ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55ec('0x5'));var attributes=require(_0x55ec('0x6'));module[_0x55ec('0x7')]=function(_0x1e916b,_0x453986){return _0x1e916b[_0x55ec('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x55ec('0x9'),'fields':['name','ListId']},{'unique':!![],'name':_0x55ec('0xa'),'fields':[_0x55ec('0xb'),_0x55ec('0xc')]},{'unique':!![],'name':_0x55ec('0xd'),'fields':[_0x55ec('0xb'),_0x55ec('0xe')]},{'unique':!![],'name':_0x55ec('0xf'),'fields':['name',_0x55ec('0x10')]},{'unique':!![],'name':_0x55ec('0x11'),'fields':[_0x55ec('0xb'),_0x55ec('0x12')]},{'unique':!![],'name':_0x55ec('0x13'),'fields':[_0x55ec('0xb'),_0x55ec('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x55ec('0xb'),_0x55ec('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb19d=['OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x55f9c5,_0x58c540){var _0x18900d=function(_0x4ba148){while(--_0x4ba148){_0x55f9c5['push'](_0x55f9c5['shift']());}};_0x18900d(++_0x58c540);}(_0xb19d,0x1b3));var _0xdb19=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xb19d[_0x2d8d69];return _0x39ae22;};'use strict';var _=require('lodash');var util=require(_0xdb19('0x0'));var logger=require(_0xdb19('0x1'))(_0xdb19('0x2'));var moment=require(_0xdb19('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb19('0x4'));var fs=require('fs');var path=require(_0xdb19('0x5'));var rimraf=require(_0xdb19('0x6'));var config=require(_0xdb19('0x7'));var attributes=require(_0xdb19('0x8'));module[_0xdb19('0x9')]=function(_0x2bf75a,_0x599c68){return _0x2bf75a[_0xdb19('0xa')](_0xdb19('0xb'),attributes,{'tableName':_0xdb19('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xdb19('0xd'),'fields':['name','ListId']},{'unique':!![],'name':'name_chat','fields':[_0xdb19('0xe'),_0xdb19('0xf')]},{'unique':!![],'name':_0xdb19('0x10'),'fields':[_0xdb19('0xe'),'MailAccountId']},{'unique':!![],'name':_0xdb19('0x11'),'fields':['name',_0xdb19('0x12')]},{'unique':!![],'name':_0xdb19('0x13'),'fields':[_0xdb19('0xe'),_0xdb19('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0xdb19('0xe'),_0xdb19('0x15')]},{'unique':!![],'name':_0xdb19('0x16'),'fields':['name',_0xdb19('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 e4a0e3c..a89dedd 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(_0x2b00e9,_0x25f808){var _0x5a5962=function(_0x3854b2){while(--_0x3854b2){_0x2b00e9['push'](_0x2b00e9['shift']());}};_0x5a5962(++_0x25f808);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x1f5dd5,_0x2b60b0){var _0x3daafc=function(_0x5643ff){while(--_0x5643ff){_0x1f5dd5['push'](_0x1f5dd5['shift']());}};_0x3daafc(++_0x2b60b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 75a6ce4..b548773 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 _0x38d1=['../../components/interaction/service','./disposition.controller','get','index','isAuthenticated','show','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c3e46,_0x13b09c){var _0x2edf6a=function(_0x17979b){while(--_0x17979b){_0x4c3e46['push'](_0x4c3e46['shift']());}};_0x2edf6a(++_0x13b09c);}(_0x38d1,0x11b));var _0x138d=function(_0x224744,_0xff54db){_0x224744=_0x224744-0x0;var _0x4afa90=_0x38d1[_0x224744];return _0x4afa90;};'use strict';var multer=require(_0x138d('0x0'));var util=require('util');var path=require(_0x138d('0x1'));var timeout=require(_0x138d('0x2'));var express=require(_0x138d('0x3'));var router=express[_0x138d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x138d('0x5'));var interaction=require(_0x138d('0x6'));var config=require('../../config/environment');var controller=require(_0x138d('0x7'));router[_0x138d('0x8')]('/',auth['isAuthenticated'](),controller[_0x138d('0x9')]);router[_0x138d('0x8')]('/:id',auth[_0x138d('0xa')](),controller[_0x138d('0xb')]);router['post']('/',auth[_0x138d('0xa')](),controller['create']);router[_0x138d('0xc')]('/:id',auth[_0x138d('0xa')](),controller[_0x138d('0xd')]);router[_0x138d('0xe')](_0x138d('0xf'),auth[_0x138d('0xa')](),controller['destroy']);module[_0x138d('0x10')]=router; \ No newline at end of file +var _0x95dc=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x146f93,_0x5c5dac){var _0x3c78b7=function(_0x46652a){while(--_0x46652a){_0x146f93['push'](_0x146f93['shift']());}};_0x3c78b7(++_0x5c5dac);}(_0x95dc,0x7f));var _0xc95d=function(_0x5beb45,_0x2cef68){_0x5beb45=_0x5beb45-0x0;var _0x29781d=_0x95dc[_0x5beb45];return _0x29781d;};'use strict';var multer=require(_0xc95d('0x0'));var util=require('util');var path=require(_0xc95d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc95d('0x2'));var router=express[_0xc95d('0x3')]();var fs_extra=require(_0xc95d('0x4'));var auth=require(_0xc95d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc95d('0x6'));var controller=require(_0xc95d('0x7'));router[_0xc95d('0x8')]('/',auth[_0xc95d('0x9')](),controller[_0xc95d('0xa')]);router['get'](_0xc95d('0xb'),auth[_0xc95d('0x9')](),controller[_0xc95d('0xc')]);router[_0xc95d('0xd')]('/',auth[_0xc95d('0x9')](),controller[_0xc95d('0xe')]);router[_0xc95d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc95d('0x10')]);router[_0xc95d('0x11')]('/:id',auth[_0xc95d('0x9')](),controller['destroy']);module[_0xc95d('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c4b1248..ab982eb 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 _0x1c06=['ENUM','2400','4800','7200','9600','12000','14400','INTEGER','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x26b4b6,_0x34975d){var _0x4eaff3=function(_0x1c7901){while(--_0x1c7901){_0x26b4b6['push'](_0x26b4b6['shift']());}};_0x4eaff3(++_0x34975d);}(_0x1c06,0xc0));var _0x61c0=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0x1c06[_0x325a08];return _0x436e01;};'use strict';var Sequelize=require(_0x61c0('0x0'));module[_0x61c0('0x1')]={'name':{'type':Sequelize[_0x61c0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x61c0('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x61c0('0x3'),'no'),'defaultValue':_0x61c0('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x61c0('0x4')},'localstationid':{'type':Sequelize[_0x61c0('0x2')],'unique':_0x61c0('0x5')},'minrate':{'type':Sequelize[_0x61c0('0x6')](_0x61c0('0x7'),_0x61c0('0x8'),_0x61c0('0x9'),_0x61c0('0xa'),_0x61c0('0xb'),_0x61c0('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x61c0('0x6')](_0x61c0('0x7'),_0x61c0('0x8'),_0x61c0('0x9'),_0x61c0('0xa'),_0x61c0('0xb'),'14400'),'defaultValue':_0x61c0('0xc')},'modem':{'type':Sequelize[_0x61c0('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x61c0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x61c0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x61c0('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x61c0('0x6')]('SIP','IAX','DADHI',_0x61c0('0xe')),'defaultValue':_0x61c0('0xf')},'key':{'type':Sequelize[_0x61c0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x61c0('0x10')],'defaultValue':function(){return _0x61c0('0x11');}},'notificationSound':{'type':Sequelize[_0x61c0('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x61c0('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x61c0('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x61c0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x61c0('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x61c0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x61c0('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x61c0('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x61c0('0x12')],'defaultValue':![],'comment':_0x61c0('0x14'),'set':function(_0x115876){if(!_0x115876)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x61c0('0x15')]('mandatoryDisposition',_0x115876);}}}; \ No newline at end of file +var _0x919d=['v17,v27,v29','INTEGER','IAX','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','localstationid','ENUM','7200','9600','12000','4800','2400','14400'];(function(_0x4452a1,_0x1d50fa){var _0x2e5604=function(_0x198e90){while(--_0x198e90){_0x4452a1['push'](_0x4452a1['shift']());}};_0x2e5604(++_0x1d50fa);}(_0x919d,0x1c0));var _0xd919=function(_0x3ed536,_0x38296d){_0x3ed536=_0x3ed536-0x0;var _0x543a14=_0x919d[_0x3ed536];return _0x543a14;};'use strict';var Sequelize=require(_0xd919('0x0'));module[_0xd919('0x1')]={'name':{'type':Sequelize[_0xd919('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd919('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xd919('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd919('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xd919('0x4')},'minrate':{'type':Sequelize[_0xd919('0x5')]('2400','4800',_0xd919('0x6'),_0xd919('0x7'),_0xd919('0x8'),'14400'),'defaultValue':_0xd919('0x9')},'maxrate':{'type':Sequelize[_0xd919('0x5')](_0xd919('0xa'),_0xd919('0x9'),_0xd919('0x6'),'9600',_0xd919('0x8'),_0xd919('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xd919('0xc')},'gateway':{'type':Sequelize[_0xd919('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd919('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd919('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xd919('0xe'),'DADHI',_0xd919('0xf')),'defaultValue':_0xd919('0x10')},'key':{'type':Sequelize[_0xd919('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd919('0x11')],'defaultValue':function(){return _0xd919('0x12');}},'notificationSound':{'type':Sequelize[_0xd919('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd919('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd919('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd919('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd919('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd919('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd919('0x13')],'defaultValue':![],'comment':_0xd919('0x14'),'set':function(_0x503cba){if(!_0x503cba)this[_0xd919('0x15')](_0xd919('0x16'),null);this['setDataValue']('mandatoryDisposition',_0x503cba);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d3e596f..bbd0ae4 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 _0xde94=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','type','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','modem','FAXOPT(','ReceiveFax','sequelize','VoiceExtension','createdAt','updatedAt','TrunkId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','List','ListId','FaxInteraction','out','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result','catch','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xde94,0x1e8));var _0x4de9=function(_0x58a440,_0x49e33b){_0x58a440=_0x58a440-0x0;var _0x30bdc2=_0xde94[_0x58a440];return _0x30bdc2;};'use strict';var emlformat=require(_0x4de9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4de9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4de9('0x2'));var BPromise=require(_0x4de9('0x3'));var Mustache=require(_0x4de9('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4de9('0x5'));var csv=require(_0x4de9('0x6'));var ejs=require(_0x4de9('0x7'));var fs=require('fs');var fs_extra=require(_0x4de9('0x8'));var _=require(_0x4de9('0x9'));var squel=require(_0x4de9('0xa'));var crypto=require(_0x4de9('0xb'));var jsforce=require(_0x4de9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4de9('0x6'));var querystring=require(_0x4de9('0xd'));var Papa=require('papaparse');var Redis=require(_0x4de9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4de9('0xf'));var as=require(_0x4de9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4de9('0x11'))(_0x4de9('0x12'));var utils=require(_0x4de9('0x13'));var config=require(_0x4de9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4de9('0x15'))['db'];config['redis']=_[_0x4de9('0x16')](config[_0x4de9('0x17')],{'host':_0x4de9('0x18'),'port':0x18eb});var socket=require(_0x4de9('0x19'))(new Redis(config[_0x4de9('0x17')]));require('./faxAccount.socket')[_0x4de9('0x1a')](socket);var jayson=require(_0x4de9('0x1b'));var client=jayson[_0x4de9('0x1c')][_0x4de9('0x1d')]({'port':0x232c});var client9002=jayson[_0x4de9('0x1c')][_0x4de9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x500ef1,_0x12b623,_0x505b51,_0x7aa279){return new BPromise(function(_0x2094e2,_0x179c9c){var _0x4d2d4b=_0x7aa279||client;return _0x4d2d4b[_0x4de9('0x1e')](_0x500ef1,_0x505b51)[_0x4de9('0x1f')](function(_0x2ad468){logger['info']('FaxAccount,\x20%s,\x20%s',_0x12b623,_0x4de9('0x20'));logger[_0x4de9('0x21')](_0x4de9('0x22'),_0x12b623,'request\x20sent',JSON[_0x4de9('0x23')](_0x2ad468));if(_0x2ad468[_0x4de9('0x24')]){if(_0x2ad468[_0x4de9('0x24')][_0x4de9('0x25')]===0x1f4){logger[_0x4de9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x12b623,_0x2ad468[_0x4de9('0x24')][_0x4de9('0x26')]);return _0x179c9c(_0x2ad468['error'][_0x4de9('0x26')]);}logger[_0x4de9('0x24')](_0x4de9('0x27'),_0x12b623,_0x2ad468[_0x4de9('0x24')]['message']);return _0x2094e2(_0x2ad468[_0x4de9('0x24')]['message']);}else{logger[_0x4de9('0x28')](_0x4de9('0x27'),_0x12b623,'request\x20sent');_0x2094e2(_0x2ad468[_0x4de9('0x29')]['message']);}})[_0x4de9('0x2a')](function(_0x57922b){logger[_0x4de9('0x24')](_0x4de9('0x27'),_0x12b623,_0x57922b);_0x179c9c(_0x57922b);});});}function respondWithStatusCode(_0x203247,_0x3c87bd){_0x3c87bd=_0x3c87bd||0xcc;return function(_0x30b66e){if(_0x30b66e){return _0x203247['sendStatus'](_0x3c87bd);}return _0x203247[_0x4de9('0x2b')](_0x3c87bd)[_0x4de9('0x2c')]();};}function respondWithResult(_0x12cef1,_0x133304){_0x133304=_0x133304||0xc8;return function(_0x234514){if(_0x234514){return _0x12cef1[_0x4de9('0x2b')](_0x133304)[_0x4de9('0x2d')](_0x234514);}};}function respondWithFilteredResult(_0x119dae,_0x2b969e){return function(_0x51e424){if(_0x51e424){var _0x42f0c8=typeof _0x2b969e[_0x4de9('0x2e')]===_0x4de9('0x2f')&&typeof _0x2b969e['limit']===_0x4de9('0x2f');var _0x1df311=_0x51e424[_0x4de9('0x30')];var _0x4ada1e=_0x42f0c8?0x0:_0x2b969e['offset'];var _0xf0c01a=_0x42f0c8?_0x51e424[_0x4de9('0x30')]:_0x2b969e[_0x4de9('0x2e')]+_0x2b969e['limit'];var _0x4bfee4;if(_0xf0c01a>=_0x1df311){_0xf0c01a=_0x1df311;_0x4bfee4=0xc8;}else{_0x4bfee4=0xce;}_0x119dae[_0x4de9('0x2b')](_0x4bfee4);return _0x119dae[_0x4de9('0x31')](_0x4de9('0x32'),_0x4ada1e+'-'+_0xf0c01a+'/'+_0x1df311)['json'](_0x51e424);}return null;};}function patchUpdates(_0x52c78b){return function(_0x5462f3){try{jsonpatch['apply'](_0x5462f3,_0x52c78b,!![]);}catch(_0x1f9502){return BPromise[_0x4de9('0x33')](_0x1f9502);}return _0x5462f3[_0x4de9('0x34')]();};}function saveUpdates(_0x2fa41d,_0x1e75b2){return function(_0x2fab75){if(_0x2fab75){return _0x2fab75[_0x4de9('0x35')](_0x2fa41d)[_0x4de9('0x1f')](function(_0x433c3f){return _0x433c3f;});}return null;};}function removeEntity(_0x46557f,_0x4fd43b){return function(_0x2d4773){if(_0x2d4773){return _0x2d4773[_0x4de9('0x36')]()[_0x4de9('0x1f')](function(){var _0x3d156a=_0x2d4773[_0x4de9('0x37')]({'plain':!![]});var _0x67a52e=_0x4de9('0x38');return db[_0x4de9('0x39')][_0x4de9('0x36')]({'where':{'type':_0x67a52e,'resourceId':_0x3d156a['id']}})['then'](function(){return _0x2d4773;});})[_0x4de9('0x1f')](function(){_0x46557f[_0x4de9('0x2b')](0xcc)[_0x4de9('0x2c')]();});}};}function handleEntityNotFound(_0x20d11e,_0x541473){return function(_0x4309dc){if(!_0x4309dc){_0x20d11e['sendStatus'](0x194);}return _0x4309dc;};}function handleError(_0xd6c517,_0x8a806c){_0x8a806c=_0x8a806c||0x1f4;return function(_0x56f60){logger[_0x4de9('0x24')](_0x56f60['stack']);if(_0x56f60[_0x4de9('0x3a')]){delete _0x56f60[_0x4de9('0x3a')];}_0xd6c517['status'](_0x8a806c)['send'](_0x56f60);};}exports[_0x4de9('0x3b')]=function(_0x4d6b13,_0x4640ca){var _0x59c9b3={'include':[{'model':db['Pause'],'as':_0x4de9('0x3c')}]},_0x1255be={},_0x94ce79={'count':0x0,'rows':[]};var _0x3b0e7b=_[_0x4de9('0x3d')](db[_0x4de9('0x3e')][_0x4de9('0x3f')],function(_0x3840e3){return{'name':_0x3840e3[_0x4de9('0x40')],'type':_0x3840e3['type'][_0x4de9('0x41')]};});_0x1255be[_0x4de9('0x42')]=_['map'](_0x3b0e7b,_0x4de9('0x3a'));_0x1255be[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x4d6b13[_0x4de9('0x43')]);_0x1255be['filters']=_[_0x4de9('0x45')](_0x1255be['model'],_0x1255be['query']);_0x59c9b3['attributes']=_[_0x4de9('0x45')](_0x1255be[_0x4de9('0x42')],qs['fields'](_0x4d6b13[_0x4de9('0x43')][_0x4de9('0x46')]));_0x59c9b3['attributes']=_0x59c9b3[_0x4de9('0x47')][_0x4de9('0x48')]?_0x59c9b3[_0x4de9('0x47')]:_0x1255be[_0x4de9('0x42')];if(!_0x4d6b13[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x59c9b3[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x4d6b13['query'][_0x4de9('0x4b')]);_0x59c9b3[_0x4de9('0x2e')]=qs['offset'](_0x4d6b13[_0x4de9('0x43')][_0x4de9('0x2e')]);}_0x59c9b3['order']=qs[_0x4de9('0x4c')](_0x4d6b13[_0x4de9('0x43')][_0x4de9('0x4c')]);_0x59c9b3[_0x4de9('0x4d')]=qs[_0x4de9('0x4e')](_[_0x4de9('0x4f')](_0x4d6b13[_0x4de9('0x43')],_0x1255be[_0x4de9('0x4e')]),_0x3b0e7b);if(_0x4d6b13['query'][_0x4de9('0x50')]){_0x59c9b3[_0x4de9('0x4d')]=_[_0x4de9('0x51')](_0x59c9b3[_0x4de9('0x4d')],{'$or':_[_0x4de9('0x3d')](_0x3b0e7b,function(_0x3eff25){if(_0x3eff25['type']!=='VIRTUAL'){var _0x37ba56={};_0x37ba56[_0x3eff25[_0x4de9('0x3a')]]={'$like':'%'+_0x4d6b13[_0x4de9('0x43')][_0x4de9('0x50')]+'%'};return _0x37ba56;}})});}_0x59c9b3=_[_0x4de9('0x51')]({},_0x59c9b3,_0x4d6b13[_0x4de9('0x52')]);var _0x5f1c3f={'where':_0x59c9b3[_0x4de9('0x4d')]};return db[_0x4de9('0x3e')]['count'](_0x5f1c3f)['then'](function(_0x2769e6){_0x94ce79[_0x4de9('0x30')]=_0x2769e6;if(_0x4d6b13['query'][_0x4de9('0x53')]){_0x59c9b3[_0x4de9('0x54')]=[{'all':!![]}];}return db[_0x4de9('0x3e')][_0x4de9('0x55')](_0x59c9b3);})['then'](function(_0x15db79){_0x94ce79[_0x4de9('0x56')]=_0x15db79;return _0x94ce79;})[_0x4de9('0x1f')](respondWithFilteredResult(_0x4640ca,_0x59c9b3))['catch'](handleError(_0x4640ca,null));};exports[_0x4de9('0x57')]=function(_0x35b5c0,_0x4c5ce1){var _0x233d2b={'raw':![],'where':{'id':_0x35b5c0[_0x4de9('0x58')]['id']},'include':[{'model':db[_0x4de9('0x59')],'as':_0x4de9('0x3c')}]},_0x32d0ee={};_0x32d0ee[_0x4de9('0x42')]=_[_0x4de9('0x44')](db[_0x4de9('0x3e')][_0x4de9('0x3f')]);_0x32d0ee[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x35b5c0[_0x4de9('0x43')]);_0x32d0ee[_0x4de9('0x4e')]=_['intersection'](_0x32d0ee[_0x4de9('0x42')],_0x32d0ee[_0x4de9('0x43')]);_0x233d2b[_0x4de9('0x47')]=_['intersection'](_0x32d0ee[_0x4de9('0x42')],qs[_0x4de9('0x46')](_0x35b5c0[_0x4de9('0x43')][_0x4de9('0x46')]));_0x233d2b[_0x4de9('0x47')]=_0x233d2b[_0x4de9('0x47')][_0x4de9('0x48')]?_0x233d2b[_0x4de9('0x47')]:_0x32d0ee['model'];if(_0x35b5c0[_0x4de9('0x43')][_0x4de9('0x53')]){_0x233d2b['include']=[{'all':!![]}];}_0x233d2b=_[_0x4de9('0x51')]({},_0x233d2b,_0x35b5c0['options']);return db['FaxAccount'][_0x4de9('0x5a')](_0x233d2b)['then'](handleEntityNotFound(_0x4c5ce1,null))['then'](respondWithResult(_0x4c5ce1,null))[_0x4de9('0x2a')](handleError(_0x4c5ce1,null));};exports[_0x4de9('0x5b')]=function(_0x464b35,_0x45933c){return db[_0x4de9('0x3e')][_0x4de9('0x5b')](_0x464b35[_0x4de9('0x5c')],{})[_0x4de9('0x1f')](function(_0x254afb){var _0x49f5de=_0x464b35[_0x4de9('0x5d')][_0x4de9('0x37')]({'plain':!![]});if(!_0x49f5de)throw new Error(_0x4de9('0x5e'));if(_0x49f5de['role']==='user'){var _0x16d434=_0x254afb[_0x4de9('0x37')]({'plain':!![]});var _0x16701b=_0x4de9('0x38');return db['UserProfileSection'][_0x4de9('0x5a')]({'where':{'name':_0x16701b,'userProfileId':_0x49f5de['userProfileId']},'raw':!![]})[_0x4de9('0x1f')](function(_0xaf67e8){if(_0xaf67e8&&_0xaf67e8[_0x4de9('0x5f')]===0x0){return db[_0x4de9('0x39')][_0x4de9('0x5b')]({'name':_0x16d434[_0x4de9('0x3a')],'resourceId':_0x16d434['id'],'type':_0xaf67e8[_0x4de9('0x3a')],'sectionId':_0xaf67e8['id']},{})[_0x4de9('0x1f')](function(){return _0x254afb;});}else{return _0x254afb;}})[_0x4de9('0x2a')](function(_0x436575){logger[_0x4de9('0x24')](_0x4de9('0x60'),_0x436575);throw _0x436575;});}return _0x254afb;})[_0x4de9('0x1f')](respondWithResult(_0x45933c,0xc9))[_0x4de9('0x2a')](handleError(_0x45933c,null));};exports['update']=function(_0x5568b4,_0x35531c){if(_0x5568b4[_0x4de9('0x5c')]['id']){delete _0x5568b4[_0x4de9('0x5c')]['id'];}return db['FaxAccount'][_0x4de9('0x5a')]({'where':{'id':_0x5568b4[_0x4de9('0x58')]['id']},'include':[{'model':db[_0x4de9('0x59')],'as':_0x4de9('0x3c')}]})[_0x4de9('0x1f')](handleEntityNotFound(_0x35531c,null))[_0x4de9('0x1f')](saveUpdates(_0x5568b4[_0x4de9('0x5c')],null))[_0x4de9('0x1f')](respondWithResult(_0x35531c,null))[_0x4de9('0x2a')](handleError(_0x35531c,null));};exports[_0x4de9('0x36')]=function(_0x3e0217,_0x290299){return db[_0x4de9('0x3e')][_0x4de9('0x5a')]({'where':{'id':_0x3e0217[_0x4de9('0x58')]['id']}})['then'](handleEntityNotFound(_0x290299,null))[_0x4de9('0x1f')](removeEntity(_0x290299,null))['catch'](handleError(_0x290299,null));};exports[_0x4de9('0x61')]=function(_0x3d89fd,_0x507ffd){return db[_0x4de9('0x3e')][_0x4de9('0x61')]()[_0x4de9('0x1f')](respondWithResult(_0x507ffd,null))[_0x4de9('0x2a')](handleError(_0x507ffd,null));};exports['addDisposition']=function(_0x1ed0fb,_0x4f32e1,_0x3220da){if(_0x1ed0fb[_0x4de9('0x5c')]['id']){delete _0x1ed0fb[_0x4de9('0x5c')]['id'];}return db[_0x4de9('0x3e')]['find']({'where':{'id':_0x1ed0fb[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x4f32e1,null))[_0x4de9('0x1f')](function(_0x1d6847){if(_0x1d6847){_0x1ed0fb[_0x4de9('0x5c')][_0x4de9('0x62')]=_0x1d6847['id'];return db['Disposition'][_0x4de9('0x5b')](_0x1ed0fb[_0x4de9('0x5c')]);}})[_0x4de9('0x1f')](respondWithResult(_0x4f32e1,null))[_0x4de9('0x2a')](handleError(_0x4f32e1,null));};exports[_0x4de9('0x63')]=function(_0x4e981f,_0x28c214,_0x41d000){var _0x4c9337={'raw':![],'where':{}};var _0x47f364={};var _0x3e7d27={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4de9('0x64')]({'where':{'id':_0x4e981f[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x28c214,null))[_0x4de9('0x1f')](function(_0x38da9d){if(_0x38da9d){_0x47f364[_0x4de9('0x42')]=_[_0x4de9('0x44')](db[_0x4de9('0x65')]['rawAttributes']);_0x47f364['query']=_[_0x4de9('0x44')](_0x4e981f[_0x4de9('0x43')]);_0x47f364[_0x4de9('0x4e')]=_[_0x4de9('0x45')](_0x47f364['model'],_0x47f364[_0x4de9('0x43')]);_0x4c9337[_0x4de9('0x47')]=_[_0x4de9('0x45')](_0x47f364['model'],qs[_0x4de9('0x46')](_0x4e981f[_0x4de9('0x43')]['fields']));_0x4c9337[_0x4de9('0x47')]=_0x4c9337[_0x4de9('0x47')][_0x4de9('0x48')]?_0x4c9337[_0x4de9('0x47')]:_0x47f364[_0x4de9('0x42')];if(!_0x4e981f['query']['hasOwnProperty'](_0x4de9('0x4a'))){_0x4c9337['limit']=qs['limit'](_0x4e981f[_0x4de9('0x43')][_0x4de9('0x4b')]);_0x4c9337[_0x4de9('0x2e')]=qs[_0x4de9('0x2e')](_0x4e981f['query'][_0x4de9('0x2e')]);}_0x4c9337[_0x4de9('0x66')]=qs['sort'](_0x4e981f['query']['sort']);_0x4c9337[_0x4de9('0x4d')]=qs[_0x4de9('0x4e')](_[_0x4de9('0x4f')](_0x4e981f[_0x4de9('0x43')],_0x47f364['filters']));_0x4c9337[_0x4de9('0x4d')][_0x4de9('0x62')]=_0x38da9d['id'];if(_0x4e981f['query'][_0x4de9('0x50')]){_0x4c9337['where']=_[_0x4de9('0x51')](_0x4c9337[_0x4de9('0x4d')],{'$or':_[_0x4de9('0x3d')](_0x4c9337[_0x4de9('0x47')],function(_0x5dac45){var _0x2a5d79={};_0x2a5d79[_0x5dac45]={'$like':'%'+_0x4e981f[_0x4de9('0x43')][_0x4de9('0x50')]+'%'};return _0x2a5d79;})});}_0x4c9337=_[_0x4de9('0x51')]({},_0x4c9337,_0x4e981f[_0x4de9('0x52')]);return db[_0x4de9('0x65')]['count']({'where':_0x4c9337[_0x4de9('0x4d')]})['then'](function(_0x13513a){_0x3e7d27[_0x4de9('0x30')]=_0x13513a;if(_0x4e981f[_0x4de9('0x43')][_0x4de9('0x53')]){_0x4c9337[_0x4de9('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4de9('0x55')](_0x4c9337);})['then'](function(_0x20a2f7){_0x3e7d27[_0x4de9('0x56')]=_0x20a2f7;return _0x3e7d27;});}})[_0x4de9('0x1f')](respondWithFilteredResult(_0x28c214,_0x4c9337))['catch'](handleError(_0x28c214,null));};exports[_0x4de9('0x67')]=function(_0x5c1b77,_0x4db80a,_0x1c9dc6){return db[_0x4de9('0x3e')]['find']({'where':{'id':_0x5c1b77[_0x4de9('0x58')]['id']}})['then'](handleEntityNotFound(_0x4db80a,null))[_0x4de9('0x1f')](function(_0x53234d){if(_0x53234d){return _0x53234d[_0x4de9('0x67')](_0x5c1b77[_0x4de9('0x43')][_0x4de9('0x68')]);}})[_0x4de9('0x1f')](respondWithStatusCode(_0x4db80a,null))[_0x4de9('0x2a')](handleError(_0x4db80a,null));};exports['addAnswer']=function(_0x396f8a,_0x37a92e,_0x1e7e9b){if(_0x396f8a['body']['id']){delete _0x396f8a['body']['id'];}return db['FaxAccount'][_0x4de9('0x5a')]({'where':{'id':_0x396f8a[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x37a92e,null))[_0x4de9('0x1f')](function(_0x2a5709){if(_0x2a5709){_0x396f8a[_0x4de9('0x5c')][_0x4de9('0x62')]=_0x2a5709['id'];return db['CannedAnswer']['create'](_0x396f8a[_0x4de9('0x5c')]);}})['then'](respondWithResult(_0x37a92e,null))['catch'](handleError(_0x37a92e,null));};exports[_0x4de9('0x69')]=function(_0x199022,_0x5128e0,_0x21fef7){var _0x5653ab={'raw':![],'where':{}};var _0x28f6f4={};var _0xed0b4d={'count':0x0,'rows':[]};return db[_0x4de9('0x3e')][_0x4de9('0x64')]({'where':{'id':_0x199022['params']['id']}})['then'](handleEntityNotFound(_0x5128e0,null))[_0x4de9('0x1f')](function(_0x5b5444){if(_0x5b5444){_0x28f6f4[_0x4de9('0x42')]=_[_0x4de9('0x44')](db[_0x4de9('0x6a')][_0x4de9('0x3f')]);_0x28f6f4['query']=_[_0x4de9('0x44')](_0x199022[_0x4de9('0x43')]);_0x28f6f4[_0x4de9('0x4e')]=_[_0x4de9('0x45')](_0x28f6f4[_0x4de9('0x42')],_0x28f6f4[_0x4de9('0x43')]);_0x5653ab[_0x4de9('0x47')]=_[_0x4de9('0x45')](_0x28f6f4['model'],qs[_0x4de9('0x46')](_0x199022[_0x4de9('0x43')][_0x4de9('0x46')]));_0x5653ab[_0x4de9('0x47')]=_0x5653ab[_0x4de9('0x47')][_0x4de9('0x48')]?_0x5653ab[_0x4de9('0x47')]:_0x28f6f4[_0x4de9('0x42')];if(!_0x199022[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x5653ab[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x199022[_0x4de9('0x43')][_0x4de9('0x4b')]);_0x5653ab[_0x4de9('0x2e')]=qs[_0x4de9('0x2e')](_0x199022[_0x4de9('0x43')]['offset']);}_0x5653ab['order']=qs[_0x4de9('0x4c')](_0x199022[_0x4de9('0x43')][_0x4de9('0x4c')]);_0x5653ab[_0x4de9('0x4d')]=qs[_0x4de9('0x4e')](_[_0x4de9('0x4f')](_0x199022[_0x4de9('0x43')],_0x28f6f4[_0x4de9('0x4e')]));_0x5653ab[_0x4de9('0x4d')][_0x4de9('0x62')]=_0x5b5444['id'];if(_0x199022[_0x4de9('0x43')][_0x4de9('0x50')]){_0x5653ab[_0x4de9('0x4d')]=_['merge'](_0x5653ab[_0x4de9('0x4d')],{'$or':_[_0x4de9('0x3d')](_0x5653ab[_0x4de9('0x47')],function(_0x57104c){var _0xfed176={};_0xfed176[_0x57104c]={'$like':'%'+_0x199022[_0x4de9('0x43')]['filter']+'%'};return _0xfed176;})});}_0x5653ab=_[_0x4de9('0x51')]({},_0x5653ab,_0x199022['options']);return db['CannedAnswer']['count']({'where':_0x5653ab['where']})[_0x4de9('0x1f')](function(_0x54dfff){_0xed0b4d[_0x4de9('0x30')]=_0x54dfff;if(_0x199022[_0x4de9('0x43')]['includeAll']){_0x5653ab[_0x4de9('0x54')]=[{'all':!![]}];}return db[_0x4de9('0x6a')][_0x4de9('0x55')](_0x5653ab);})[_0x4de9('0x1f')](function(_0x3087d6){_0xed0b4d[_0x4de9('0x56')]=_0x3087d6;return _0xed0b4d;});}})[_0x4de9('0x1f')](respondWithFilteredResult(_0x5128e0,_0x5653ab))['catch'](handleError(_0x5128e0,null));};exports[_0x4de9('0x6b')]=function(_0x4d4f99,_0x5636ec,_0x236e4c){return db[_0x4de9('0x3e')][_0x4de9('0x5a')]({'where':{'id':_0x4d4f99['params']['id']}})['then'](handleEntityNotFound(_0x5636ec,null))[_0x4de9('0x1f')](function(_0x3fffdd){if(_0x3fffdd){return _0x3fffdd[_0x4de9('0x6b')](_0x4d4f99[_0x4de9('0x43')]['ids']);}})[_0x4de9('0x1f')](respondWithStatusCode(_0x5636ec,null))[_0x4de9('0x2a')](handleError(_0x5636ec,null));};exports['addInteraction']=function(_0x65bd9e,_0x49f42a,_0x4e2b9c){return db['FaxInteraction'][_0x4de9('0x5a')]({'where':{'id':_0x65bd9e[_0x4de9('0x58')]['id']}})['then'](handleEntityNotFound(_0x49f42a,null))['then'](function(_0x11b1dd){if(_0x11b1dd){return _0x11b1dd[_0x4de9('0x6c')](_0x65bd9e['body']['ids'],_[_0x4de9('0x6d')](_0x65bd9e['body'],['ids','id'])||{});}})[_0x4de9('0x1f')](respondWithResult(_0x49f42a,null))[_0x4de9('0x2a')](handleError(_0x49f42a,null));};exports[_0x4de9('0x6e')]=function(_0x17f5a8,_0x59bce7,_0x34230f){var _0x5861fd={'raw':![],'where':{}};var _0x228c4d={};var _0x5ee384={'count':0x0,'rows':[]};return db[_0x4de9('0x3e')]['findOne']({'where':{'id':_0x17f5a8[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x59bce7,null))[_0x4de9('0x1f')](function(_0x530864){if(_0x530864){_0x228c4d['model']=_['keys'](db['FaxInteraction'][_0x4de9('0x3f')]);_0x228c4d[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x17f5a8[_0x4de9('0x43')]);_0x228c4d[_0x4de9('0x4e')]=_['intersection'](_0x228c4d[_0x4de9('0x42')],_0x228c4d['query']);_0x5861fd[_0x4de9('0x47')]=_[_0x4de9('0x45')](_0x228c4d[_0x4de9('0x42')],qs[_0x4de9('0x46')](_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x46')]));_0x5861fd[_0x4de9('0x47')]=_0x5861fd[_0x4de9('0x47')][_0x4de9('0x48')]?_0x5861fd['attributes']:_0x228c4d['model'];if(!_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x5861fd[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x17f5a8['query']['limit']);_0x5861fd['offset']=qs['offset'](_0x17f5a8['query'][_0x4de9('0x2e')]);}_0x5861fd[_0x4de9('0x66')]=qs[_0x4de9('0x4c')](_0x17f5a8['query'][_0x4de9('0x4c')]);_0x5861fd['where']=qs['filters'](_[_0x4de9('0x4f')](_0x17f5a8[_0x4de9('0x43')],_0x228c4d[_0x4de9('0x4e')]));_0x5861fd[_0x4de9('0x4d')][_0x4de9('0x62')]=_0x530864['id'];if(_0x17f5a8['query'][_0x4de9('0x50')]){_0x5861fd[_0x4de9('0x4d')]=_[_0x4de9('0x51')](_0x5861fd[_0x4de9('0x4d')],{'$or':_[_0x4de9('0x3d')](_0x5861fd[_0x4de9('0x47')],function(_0x2c0a34){var _0x19f8fd={};_0x19f8fd[_0x2c0a34]={'$like':'%'+_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x50')]+'%'};return _0x19f8fd;})});}_0x5861fd=_[_0x4de9('0x51')]({},_0x5861fd,_0x17f5a8['options']);return db['FaxInteraction'][_0x4de9('0x30')]({'where':_0x5861fd[_0x4de9('0x4d')]})['then'](function(_0x2f81a6){_0x5ee384['count']=_0x2f81a6;if(_0x17f5a8[_0x4de9('0x43')]['includeAll']){_0x5861fd[_0x4de9('0x54')]=[{'model':db[_0x4de9('0x6f')],'as':_0x4de9('0x70'),'required':![]},{'model':db['User'],'as':_0x4de9('0x71'),'attributes':[_0x4de9('0x3a'),_0x4de9('0x72'),_0x4de9('0x73')],'required':![]},{'model':db[_0x4de9('0x74')],'as':_0x4de9('0x75'),'attributes':['id',_0x4de9('0x3a'),_0x4de9('0x76')],'where':_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x77')]?{'id':_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x77')]}:undefined,'required':_0x17f5a8[_0x4de9('0x43')][_0x4de9('0x77')]?!![]:![]}];}return db['FaxInteraction'][_0x4de9('0x55')](_0x5861fd);})['then'](function(_0x3c8644){_0x5ee384[_0x4de9('0x56')]=_0x3c8644;return _0x5ee384;});}})[_0x4de9('0x1f')](respondWithFilteredResult(_0x59bce7,_0x5861fd))[_0x4de9('0x2a')](handleError(_0x59bce7,null));};exports['addApplications']=function(_0x1e82b9,_0x1e993c,_0x369249){return db[_0x4de9('0x3e')]['findOne']({'where':{'id':_0x1e82b9[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x1e993c,null))['then'](function(_0x2aad0a){if(_0x2aad0a){return db['sequelize'][_0x4de9('0x78')](function(_0x12ec30){return db[_0x4de9('0x79')][_0x4de9('0x36')]({'where':{'FaxAccountId':_0x1e82b9[_0x4de9('0x58')]['id']},'transaction':_0x12ec30})[_0x4de9('0x1f')](function(_0x27df6b){var _0x347d06=_['map'](_0x1e82b9[_0x4de9('0x5c')],function(_0x154cad){_0x154cad[_0x4de9('0x62')]=_0x1e82b9[_0x4de9('0x58')]['id'];return _0x154cad;});return db[_0x4de9('0x79')][_0x4de9('0x7a')](_0x347d06,{'transaction':_0x12ec30});});})[_0x4de9('0x1f')](function(){return db[_0x4de9('0x79')][_0x4de9('0x7b')]({'where':{'FaxAccountId':_0x1e82b9['params']['id']},'order':_0x4de9('0x7c')});});}})['then'](respondWithResult(_0x1e993c,null))['catch'](handleError(_0x1e993c,null));};exports[_0x4de9('0x7d')]=function(_0x4db48b,_0x2aa61d,_0x15b6fd){var _0x2e8117={};var _0x38f13e={};var _0x43a476;var _0x4895a7;return db[_0x4de9('0x3e')][_0x4de9('0x64')]({'where':{'id':_0x4db48b[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x2aa61d,null))[_0x4de9('0x1f')](function(_0x2250d5){if(_0x2250d5){_0x43a476=_0x2250d5;_0x38f13e['model']=_[_0x4de9('0x44')](db['FaxApplication'][_0x4de9('0x3f')]);_0x38f13e[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x4db48b[_0x4de9('0x43')]);_0x38f13e[_0x4de9('0x4e')]=_[_0x4de9('0x45')](_0x38f13e[_0x4de9('0x42')],_0x38f13e[_0x4de9('0x43')]);_0x2e8117[_0x4de9('0x47')]=_[_0x4de9('0x45')](_0x38f13e[_0x4de9('0x42')],qs[_0x4de9('0x46')](_0x4db48b[_0x4de9('0x43')][_0x4de9('0x46')]));_0x2e8117[_0x4de9('0x47')]=_0x2e8117['attributes'][_0x4de9('0x48')]?_0x2e8117[_0x4de9('0x47')]:_0x38f13e[_0x4de9('0x42')];_0x2e8117[_0x4de9('0x66')]=qs[_0x4de9('0x4c')](_0x4db48b[_0x4de9('0x43')][_0x4de9('0x4c')]);_0x2e8117['where']=qs[_0x4de9('0x4e')](_[_0x4de9('0x4f')](_0x4db48b['query'],_0x38f13e[_0x4de9('0x4e')]));if(_0x4db48b[_0x4de9('0x43')]['filter']){_0x2e8117['where']=_['merge'](_0x2e8117['where'],{'$or':_[_0x4de9('0x3d')](_0x2e8117[_0x4de9('0x47')],function(_0x2847ed){var _0x202bfa={};_0x202bfa[_0x2847ed]={'$like':'%'+_0x4db48b['query'][_0x4de9('0x50')]+'%'};return _0x202bfa;})});}_0x2e8117=_[_0x4de9('0x51')]({},_0x2e8117,_0x4db48b[_0x4de9('0x52')]);return _0x43a476[_0x4de9('0x7d')](_0x2e8117);}})[_0x4de9('0x1f')](function(_0x42dcb1){if(_0x42dcb1){_0x4895a7=_0x42dcb1[_0x4de9('0x48')];if(!_0x4db48b[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x2e8117[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x4db48b['query'][_0x4de9('0x4b')]);_0x2e8117[_0x4de9('0x2e')]=qs[_0x4de9('0x2e')](_0x4db48b[_0x4de9('0x43')][_0x4de9('0x2e')]);}return _0x43a476[_0x4de9('0x7d')](_0x2e8117);}})[_0x4de9('0x1f')](function(_0x2ffb70){if(_0x2ffb70){return _0x2ffb70?{'count':_0x4895a7,'rows':_0x2ffb70}:null;}})[_0x4de9('0x1f')](respondWithResult(_0x2aa61d,null))['catch'](handleError(_0x2aa61d,null));};function Extension(_0x1ab1be,_0x141e43,_0x2e7030,_0x49bbd4){this[_0x4de9('0x7e')]=_0x4de9('0x7f');this[_0x4de9('0x80')]=_0x1ab1be['localstationid'];this[_0x4de9('0x81')]=_0x49bbd4;this[_0x4de9('0x82')]='system';this[_0x4de9('0x83')]=_0x4de9('0x84');this['FaxAccountId']=_0x1ab1be['id'];this[_0x4de9('0x7c')]=_0x141e43;this[_0x4de9('0x85')]=_0x2e7030;}function createExtensionsReciveFax(_0x1cee47){var _0x52feb9=0x1;var _0x158a66=[];_0x158a66[_0x4de9('0x86')](new Extension(_0x1cee47,_0x52feb9,'',_0x4de9('0x87')));_0x52feb9+=0x1;_0x158a66[_0x4de9('0x86')](new Extension(_0x1cee47,_0x52feb9,_0x4de9('0x88'),_0x4de9('0x89')));_0x52feb9+=0x1;for(var _0x186847 in _0x1cee47){if(_0x1cee47[_0x4de9('0x49')](_0x186847)&&(_0x186847===_0x4de9('0x8a')||_0x186847===_0x4de9('0x8b')||_0x186847===_0x4de9('0x8c')||_0x186847===_0x4de9('0x8d')||_0x186847===_0x4de9('0x8e')||_0x186847==='maxrate'||_0x186847==='minrate'||_0x186847===_0x4de9('0x8f')||_0x186847==='t38timeout')){_0x158a66['push'](new Extension(_0x1cee47,_0x52feb9,_0x4de9('0x90')+_0x186847+')='+_0x1cee47[_0x186847],_0x4de9('0x89')));_0x52feb9+=0x1;}}_0x158a66[_0x4de9('0x86')](new Extension(_0x1cee47,_0x52feb9,'6','Wait'));_0x52feb9+=0x1;_0x158a66[_0x4de9('0x86')](new Extension(_0x1cee47,_0x52feb9,'/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',_0x4de9('0x91')));_0x52feb9=0x0;return _0x158a66;}exports['addAccountApplications']=function(_0xa23c1e,_0x5139ec,_0x2c0556){var _0x23583e;return db[_0x4de9('0x92')]['transaction'](function(_0x1e3a12){return db[_0x4de9('0x3e')][_0x4de9('0x5b')](_0xa23c1e['body'],{'transaction':_0x1e3a12})[_0x4de9('0x1f')](function(_0x5c56f8){_0x23583e=_0x5c56f8[_0x4de9('0x37')]({'plain':!![]});return db[_0x4de9('0x93')][_0x4de9('0x7a')](createExtensionsReciveFax(_0x23583e),{'transaction':_0x1e3a12});});})[_0x4de9('0x1f')](function(){return _0x23583e;})[_0x4de9('0x1f')](respondWithResult(_0x5139ec,null))[_0x4de9('0x2a')](handleError(_0x5139ec,null));};exports['updateAccountApplications']=function(_0x1380b7,_0x3b7142,_0x2c346a){var _0x24e33f;return db[_0x4de9('0x92')]['transaction'](function(_0x2746b4){return db[_0x4de9('0x3e')][_0x4de9('0x35')](_0x1380b7[_0x4de9('0x5c')],{'where':{'id':_0x1380b7['body']['id']},'transaction':_0x2746b4})[_0x4de9('0x1f')](function(_0x52f266){return db['VoiceExtension'][_0x4de9('0x36')]({'where':{'FaxAccountId':_0x1380b7['body']['id']},'transaction':_0x2746b4})[_0x4de9('0x1f')](function(_0x225ab0){return db[_0x4de9('0x93')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x1380b7[_0x4de9('0x5c')],['tech',_0x4de9('0x41'),_0x4de9('0x94'),_0x4de9('0x95'),_0x4de9('0x96'),'ListId'])),{'transaction':_0x2746b4});});});})[_0x4de9('0x1f')](function(){return db[_0x4de9('0x3e')]['findById'](_0x1380b7[_0x4de9('0x5c')]['id']);})['then'](respondWithResult(_0x3b7142,null))[_0x4de9('0x2a')](handleError(_0x3b7142,null));};exports['getMessages']=function(_0x4ed91b,_0x1ead55,_0x1a53a8){var _0x57975f={'raw':!![],'where':{}};var _0x2dab9a={};var _0x9f3202={'count':0x0,'rows':[]};return db[_0x4de9('0x3e')][_0x4de9('0x64')]({'where':{'id':_0x4ed91b[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x1ead55,null))[_0x4de9('0x1f')](function(_0x25a190){if(_0x25a190){_0x2dab9a[_0x4de9('0x42')]=_[_0x4de9('0x44')](db[_0x4de9('0x97')][_0x4de9('0x3f')]);_0x2dab9a[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x4ed91b[_0x4de9('0x43')]);_0x2dab9a['filters']=_[_0x4de9('0x45')](_0x2dab9a[_0x4de9('0x42')],_0x2dab9a[_0x4de9('0x43')]);_0x57975f[_0x4de9('0x47')]=_['intersection'](_0x2dab9a[_0x4de9('0x42')],qs[_0x4de9('0x46')](_0x4ed91b['query']['fields']));_0x57975f[_0x4de9('0x47')]=_0x57975f['attributes'][_0x4de9('0x48')]?_0x57975f[_0x4de9('0x47')]:_0x2dab9a[_0x4de9('0x42')];if(!_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x57975f[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x4b')]);_0x57975f[_0x4de9('0x2e')]=qs[_0x4de9('0x2e')](_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x2e')]);}_0x57975f[_0x4de9('0x66')]=qs[_0x4de9('0x4c')](_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x4c')]);_0x57975f[_0x4de9('0x4d')]=qs[_0x4de9('0x4e')](_[_0x4de9('0x4f')](_0x4ed91b[_0x4de9('0x43')],_0x2dab9a[_0x4de9('0x4e')]));_0x57975f[_0x4de9('0x4d')]['FaxAccountId']=_0x25a190['id'];if(_0x4ed91b['query'][_0x4de9('0x50')]){_0x57975f[_0x4de9('0x4d')]=_['merge'](_0x57975f['where'],{'$or':_[_0x4de9('0x3d')](_0x57975f['attributes'],function(_0xde68a5){var _0x27ee47={};_0x27ee47[_0xde68a5]={'$like':'%'+_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x50')]+'%'};return _0x27ee47;})});}if(_0x4ed91b['query'][_0x4de9('0x98')]){var _0x291342=_0x4ed91b[_0x4de9('0x43')]['$gte'][_0x4de9('0x99')](',');var _0x18dcb6={};_0x18dcb6[_0x291342[0x0]]={'$gte':moment(_0x291342[0x1])[_0x4de9('0x9a')](_0x4de9('0x9b'))};_0x57975f['where']=_['merge'](_0x57975f['where'],_0x18dcb6);}_0x57975f=_[_0x4de9('0x51')]({},_0x57975f,_0x4ed91b[_0x4de9('0x52')]);return db[_0x4de9('0x97')][_0x4de9('0x30')]({'where':_0x57975f['where']})[_0x4de9('0x1f')](function(_0x1dd4eb){_0x9f3202[_0x4de9('0x30')]=_0x1dd4eb;if(_0x4ed91b[_0x4de9('0x43')][_0x4de9('0x53')]){_0x57975f['include']=[{'all':!![]}];}return db[_0x4de9('0x97')][_0x4de9('0x55')](_0x57975f);})[_0x4de9('0x1f')](function(_0x409cf0){_0x9f3202[_0x4de9('0x56')]=_0x409cf0;return _0x9f3202;});}})[_0x4de9('0x1f')](respondWithFilteredResult(_0x1ead55,_0x57975f))[_0x4de9('0x2a')](handleError(_0x1ead55,null));};exports[_0x4de9('0x9c')]=function(_0x3e6832,_0x175862,_0x22afbb){var _0x29f093,_0x1a8668={},_0x46f151;if(_0x3e6832[_0x4de9('0x5c')]['to']){_0x46f151=_0x3e6832[_0x4de9('0x5c')]['to'][0x0];}return db[_0x4de9('0x3e')]['find']({'where':{'id':_0x3e6832[_0x4de9('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4de9('0x6f')],'as':_0x4de9('0x9d'),'where':{'fax':_0x46f151},'limit':0x1,'order':[[_0x4de9('0x95'),_0x4de9('0x9e')]]}]}]})[_0x4de9('0x1f')](handleEntityNotFound(_0x175862,null))[_0x4de9('0x1f')](function(_0x5471ae){_0x29f093=_0x5471ae;if(_0x3e6832['body']['attachments']&&_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')]['length']){for(var _0x17a30b=0x0;_0x17a30b<_0x3e6832[_0x4de9('0x5c')]['attachments']['length'];_0x17a30b+=0x1){_0x3e6832[_0x4de9('0x5c')]['attachments'][_0x17a30b]={'filename':_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][_0x17a30b][_0x4de9('0x3a')],'id':_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][_0x17a30b]['id'],'path':path[_0x4de9('0xa0')](config[_0x4de9('0xa1')],_0x4de9('0xa2'),_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][_0x17a30b][_0x4de9('0xa3')])};}}return respondWithRpcPromise(_0x4de9('0xa4'),_0x4de9('0xa4'),{'FaxAccountId':_['isNil'](_0x3e6832[_0x4de9('0x58')]['id'])?undefined:_0x3e6832[_0x4de9('0x58')]['id'],'path':_[_0x4de9('0xa5')](_0x3e6832[_0x4de9('0x5c')]['attachments'][0x0][_0x4de9('0xa6')])?undefined:_0x3e6832[_0x4de9('0x5c')]['attachments'][0x0]['path'],'fax':_[_0x4de9('0xa5')](_0x3e6832['body']['to'][0x0])?undefined:_0x3e6832[_0x4de9('0x5c')]['to'][0x0]},client9002);})[_0x4de9('0x1f')](function(){if(_0x29f093){if(_[_0x4de9('0xa5')](_0x3e6832['body'][_0x4de9('0xa7')])){_0x3e6832[_0x4de9('0x5c')][_0x4de9('0xa7')]=util[_0x4de9('0x9a')]('\x22%s\x22\x20<%s>',_0x29f093[_0x4de9('0x3a')],_0x29f093[_0x4de9('0xa8')]);}if(_0x29f093[_0x4de9('0xa9')]){if(_0x29f093[_0x4de9('0xa9')][_0x4de9('0x9d')]['length']){return _0x29f093[_0x4de9('0xa9')][_0x4de9('0x9d')][0x0];}else{return db[_0x4de9('0x6f')][_0x4de9('0x5b')](_[_0x4de9('0x16')](_0x3e6832['body'],{'firstName':_0x3e6832[_0x4de9('0x5c')]['to'][0x0],'phone':_0x3e6832[_0x4de9('0x5c')]['to'][0x0],'fax':_0x3e6832[_0x4de9('0x5c')]['to'][0x0],'ListId':_0x29f093[_0x4de9('0xaa')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4de9('0x1f')](function(_0x3e90af){if(_0x3e90af){return db[_0x4de9('0xab')][_0x4de9('0x5a')]({'where':{'ContactId':_0x3e90af['id'],'closed':![],'FaxAccountId':_0x29f093['id']}})[_0x4de9('0x1f')](function(_0x3bf186){if(_0x3bf186){return[_0x3bf186,![]];}return db['FaxInteraction'][_0x4de9('0x5b')]({'UserId':_0x3e6832[_0x4de9('0x5d')]['id'],'ContactId':_0x3e90af['id'],'FaxAccountId':_0x29f093['id'],'fax':_0x3e6832[_0x4de9('0x5c')]['to'][0x0],'firstMsgDirection':_0x4de9('0xac'),'Messages':[_[_0x4de9('0x51')](_0x3e6832['body'],{'read':![],'body':_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][0x0]['filename'],'FaxAccountId':_0x29f093['id'],'UserId':_0x3e6832[_0x4de9('0x5d')]['id'],'ContactId':_0x3e90af['id'],'AttachmentId':_0x3e6832[_0x4de9('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x4de9('0xad')}]})[_0x4de9('0x1f')](function(_0x22614c){return[_0x22614c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4de9('0xae')](function(_0x5ba946,_0xeb6b7e){if(_0xeb6b7e){return _0x5ba946;}return db[_0x4de9('0x97')]['create']({'direction':_0x4de9('0xac'),'read':![],'body':_0x3e6832['body'][_0x4de9('0x9f')][0x0]['filename'],'FaxAccountId':_0x29f093['id'],'FaxInteractionId':_0x5ba946['id'],'UserId':_0x3e6832[_0x4de9('0x5d')]['id'],'ContactId':_0x5ba946['ContactId'],'AttachmentId':_0x3e6832[_0x4de9('0x5c')]['attachments'][0x0]['id']})[_0x4de9('0x1f')](function(_0x36e5ef){_0x5ba946[_0x4de9('0xaf')]['Messages']=[];_0x5ba946[_0x4de9('0xaf')]['Messages'][_0x4de9('0x86')](_0x36e5ef[_0x4de9('0xaf')]);return _0x5ba946;});})[_0x4de9('0x1f')](function(_0x172558){respondWithRpcPromise(_0x4de9('0xb0'),_0x4de9('0xb0'),{'FaxAccountId':_['isNil'](_0x3e6832[_0x4de9('0x58')]['id'])?undefined:_0x3e6832['params']['id'],'path':_[_0x4de9('0xa5')](_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][0x0][_0x4de9('0xa6')])?undefined:_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][0x0]['path'],'fax':_[_0x4de9('0xa5')](_0x3e6832['body']['to'][0x0])?undefined:_0x3e6832[_0x4de9('0x5c')]['to'][0x0],'AttachmentId':_0x3e6832[_0x4de9('0x5c')][_0x4de9('0x9f')][0x0]['id']},client9002)[_0x4de9('0x1f')](function(_0x5d10db){logger[_0x4de9('0x28')](_0x4de9('0xb1'),_0x5d10db);})[_0x4de9('0x2a')](function(_0x532819){logger['info']('SendFaxRpc,\x20%s',_0x532819);});return _0x172558;})['then'](respondWithResult(_0x175862,null))['catch'](handleError(_0x175862,null));};exports[_0x4de9('0xb2')]=function(_0x1710a3,_0x3c3afb,_0xb604f8){return db['FaxAccount'][_0x4de9('0x5a')]({'where':{'id':_0x1710a3['params']['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x3c3afb,null))[_0x4de9('0x1f')](function(_0x41b37c){if(_0x41b37c){return _0x41b37c[_0x4de9('0xb2')](_0x1710a3[_0x4de9('0x5c')][_0x4de9('0x68')],_['omit'](_0x1710a3[_0x4de9('0x5c')],[_0x4de9('0x68'),'id'])||{})[_0x4de9('0xae')](function(_0x163b21){for(var _0x4d30d2=0x0;_0x4d30d2<_0x1710a3[_0x4de9('0x5c')]['ids'][_0x4de9('0x48')];_0x4d30d2+=0x1){socket['emit'](_0x4de9('0xb3'),{'UserId':Number(_0x1710a3[_0x4de9('0x5c')]['ids'][_0x4d30d2]),'FaxAccountId':Number(_0x1710a3[_0x4de9('0x58')]['id'])});}return _0x163b21;});}})[_0x4de9('0x1f')](respondWithResult(_0x3c3afb,null))[_0x4de9('0x2a')](handleError(_0x3c3afb,null));};exports[_0x4de9('0xb4')]=function(_0x31b5bd,_0x4ce9f6,_0x778852){return db[_0x4de9('0x3e')][_0x4de9('0x5a')]({'where':{'id':_0x31b5bd[_0x4de9('0x58')]['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x4ce9f6,null))[_0x4de9('0x1f')](function(_0x10f54c){if(_0x10f54c){return _0x10f54c[_0x4de9('0xb4')](_0x31b5bd[_0x4de9('0x43')]['ids'])[_0x4de9('0x1f')](function(){if(_['isArray'](_0x31b5bd[_0x4de9('0x43')][_0x4de9('0x68')])){for(var _0x109871=0x0;_0x109871<_0x31b5bd[_0x4de9('0x43')][_0x4de9('0x68')][_0x4de9('0x48')];_0x109871+=0x1){socket[_0x4de9('0xb5')](_0x4de9('0xb6'),{'UserId':Number(_0x31b5bd[_0x4de9('0x43')][_0x4de9('0x68')][_0x109871]),'FaxAccountId':Number(_0x31b5bd[_0x4de9('0x58')]['id'])});}}else{socket[_0x4de9('0xb5')](_0x4de9('0xb6'),{'UserId':Number(_0x31b5bd['query'][_0x4de9('0x68')]),'FaxAccountId':Number(_0x31b5bd['params']['id'])});}});}})[_0x4de9('0x1f')](respondWithStatusCode(_0x4ce9f6,null))['catch'](handleError(_0x4ce9f6,null));};exports[_0x4de9('0xb7')]=function(_0x4eefbe,_0x167bb2,_0x127098){var _0x54b3e0={};var _0x41e7f3={};var _0x48e1e1;var _0x308e56;return db[_0x4de9('0x3e')][_0x4de9('0x64')]({'where':{'id':_0x4eefbe['params']['id']}})[_0x4de9('0x1f')](handleEntityNotFound(_0x167bb2,null))['then'](function(_0x3bf7be){if(_0x3bf7be){_0x48e1e1=_0x3bf7be;_0x41e7f3[_0x4de9('0x42')]=_[_0x4de9('0x44')](db[_0x4de9('0xb8')]['rawAttributes']);_0x41e7f3[_0x4de9('0x43')]=_[_0x4de9('0x44')](_0x4eefbe[_0x4de9('0x43')]);_0x41e7f3['filters']=_[_0x4de9('0x45')](_0x41e7f3[_0x4de9('0x42')],_0x41e7f3[_0x4de9('0x43')]);_0x54b3e0[_0x4de9('0x47')]=_['intersection'](_0x41e7f3[_0x4de9('0x42')],qs[_0x4de9('0x46')](_0x4eefbe[_0x4de9('0x43')][_0x4de9('0x46')]));_0x54b3e0[_0x4de9('0x47')]=_0x54b3e0[_0x4de9('0x47')][_0x4de9('0x48')]?_0x54b3e0['attributes']:_0x41e7f3[_0x4de9('0x42')];_0x54b3e0[_0x4de9('0x66')]=qs[_0x4de9('0x4c')](_0x4eefbe['query'][_0x4de9('0x4c')]);_0x54b3e0['where']=qs[_0x4de9('0x4e')](_['pick'](_0x4eefbe[_0x4de9('0x43')],_0x41e7f3[_0x4de9('0x4e')]));if(_0x4eefbe[_0x4de9('0x43')][_0x4de9('0x50')]){_0x54b3e0['where']=_[_0x4de9('0x51')](_0x54b3e0['where'],{'$or':_[_0x4de9('0x3d')](_0x54b3e0[_0x4de9('0x47')],function(_0x1078fe){var _0x34fffb={};_0x34fffb[_0x1078fe]={'$like':'%'+_0x4eefbe['query'][_0x4de9('0x50')]+'%'};return _0x34fffb;})});}_0x54b3e0=_['merge']({},_0x54b3e0,_0x4eefbe[_0x4de9('0x52')]);return _0x48e1e1['getAgents'](_0x54b3e0);}})[_0x4de9('0x1f')](function(_0x22e687){if(_0x22e687){_0x308e56=_0x22e687[_0x4de9('0x48')];if(!_0x4eefbe[_0x4de9('0x43')][_0x4de9('0x49')](_0x4de9('0x4a'))){_0x54b3e0[_0x4de9('0x4b')]=qs[_0x4de9('0x4b')](_0x4eefbe[_0x4de9('0x43')][_0x4de9('0x4b')]);_0x54b3e0[_0x4de9('0x2e')]=qs['offset'](_0x4eefbe[_0x4de9('0x43')][_0x4de9('0x2e')]);}return _0x48e1e1['getAgents'](_0x54b3e0);}})[_0x4de9('0x1f')](function(_0x56f7f6){if(_0x56f7f6){return _0x56f7f6?{'count':_0x308e56,'rows':_0x56f7f6}:null;}})[_0x4de9('0x1f')](respondWithResult(_0x167bb2,null))['catch'](handleError(_0x167bb2,null));}; \ No newline at end of file +var _0x1e75=['where','filter','merge','options','findAll','rows','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','order','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','pick','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','key','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','send','CmList','List','updatedAt','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','out','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','sort'];(function(_0x3d6eb1,_0x1f99b1){var _0x4e5356=function(_0x203406){while(--_0x203406){_0x3d6eb1['push'](_0x3d6eb1['shift']());}};_0x4e5356(++_0x1f99b1);}(_0x1e75,0x6f));var _0x51e7=function(_0x94442f,_0x843f87){_0x94442f=_0x94442f-0x0;var _0x5d4e56=_0x1e75[_0x94442f];return _0x5d4e56;};'use strict';var emlformat=require(_0x51e7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x51e7('0x1'));var rp=require(_0x51e7('0x2'));var moment=require(_0x51e7('0x3'));var BPromise=require(_0x51e7('0x4'));var Mustache=require(_0x51e7('0x5'));var util=require(_0x51e7('0x6'));var path=require(_0x51e7('0x7'));var sox=require(_0x51e7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51e7('0x9'));var _=require(_0x51e7('0xa'));var squel=require(_0x51e7('0xb'));var crypto=require(_0x51e7('0xc'));var jsforce=require(_0x51e7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x51e7('0xe'));var querystring=require(_0x51e7('0xf'));var Papa=require(_0x51e7('0x10'));var Redis=require('ioredis');var authService=require(_0x51e7('0x11'));var qs=require(_0x51e7('0x12'));var as=require(_0x51e7('0x13'));var hardwareService=require(_0x51e7('0x14'));var logger=require(_0x51e7('0x15'))(_0x51e7('0x16'));var utils=require(_0x51e7('0x17'));var config=require(_0x51e7('0x18'));var licenseUtil=require(_0x51e7('0x19'));var db=require(_0x51e7('0x1a'))['db'];config['redis']=_[_0x51e7('0x1b')](config[_0x51e7('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x51e7('0x1d'))(new Redis(config[_0x51e7('0x1c')]));require(_0x51e7('0x1e'))[_0x51e7('0x1f')](socket);var jayson=require(_0x51e7('0x20'));var client=jayson['client'][_0x51e7('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x51e7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4c723e,_0x3bfa36,_0x386be6,_0x52c2c3){return new BPromise(function(_0x1c0006,_0x4738ac){var _0x4fcf60=_0x52c2c3||client;return _0x4fcf60[_0x51e7('0x22')](_0x4c723e,_0x386be6)[_0x51e7('0x23')](function(_0x286bd2){logger[_0x51e7('0x24')](_0x51e7('0x25'),_0x3bfa36,_0x51e7('0x26'));logger[_0x51e7('0x27')](_0x51e7('0x28'),_0x3bfa36,_0x51e7('0x26'),JSON[_0x51e7('0x29')](_0x286bd2));if(_0x286bd2[_0x51e7('0x2a')]){if(_0x286bd2['error'][_0x51e7('0x2b')]===0x1f4){logger[_0x51e7('0x2a')](_0x51e7('0x25'),_0x3bfa36,_0x286bd2[_0x51e7('0x2a')][_0x51e7('0x2c')]);return _0x4738ac(_0x286bd2[_0x51e7('0x2a')][_0x51e7('0x2c')]);}logger['error'](_0x51e7('0x25'),_0x3bfa36,_0x286bd2[_0x51e7('0x2a')][_0x51e7('0x2c')]);return _0x1c0006(_0x286bd2[_0x51e7('0x2a')][_0x51e7('0x2c')]);}else{logger[_0x51e7('0x24')](_0x51e7('0x25'),_0x3bfa36,'request\x20sent');_0x1c0006(_0x286bd2[_0x51e7('0x2d')][_0x51e7('0x2c')]);}})[_0x51e7('0x2e')](function(_0x5e85de){logger[_0x51e7('0x2a')](_0x51e7('0x25'),_0x3bfa36,_0x5e85de);_0x4738ac(_0x5e85de);});});}function respondWithStatusCode(_0x95192c,_0x13efd3){_0x13efd3=_0x13efd3||0xcc;return function(_0x2adc43){if(_0x2adc43){return _0x95192c[_0x51e7('0x2f')](_0x13efd3);}return _0x95192c['status'](_0x13efd3)['end']();};}function respondWithResult(_0x448ff7,_0x146b56){_0x146b56=_0x146b56||0xc8;return function(_0xbb55e){if(_0xbb55e){return _0x448ff7[_0x51e7('0x30')](_0x146b56)[_0x51e7('0x31')](_0xbb55e);}};}function respondWithFilteredResult(_0x3390dd,_0x59f2b4){return function(_0x247b96){if(_0x247b96){var _0x2d047e=typeof _0x59f2b4['offset']===_0x51e7('0x32')&&typeof _0x59f2b4['limit']===_0x51e7('0x32');var _0x14b2b4=_0x247b96[_0x51e7('0x33')];var _0x2a23e1=_0x2d047e?0x0:_0x59f2b4['offset'];var _0x32a769=_0x2d047e?_0x247b96['count']:_0x59f2b4['offset']+_0x59f2b4['limit'];var _0x80244e;if(_0x32a769>=_0x14b2b4){_0x32a769=_0x14b2b4;_0x80244e=0xc8;}else{_0x80244e=0xce;}_0x3390dd['status'](_0x80244e);return _0x3390dd[_0x51e7('0x34')](_0x51e7('0x35'),_0x2a23e1+'-'+_0x32a769+'/'+_0x14b2b4)['json'](_0x247b96);}return null;};}function patchUpdates(_0x34cd52){return function(_0x37b5c9){try{jsonpatch[_0x51e7('0x36')](_0x37b5c9,_0x34cd52,!![]);}catch(_0x28d273){return BPromise[_0x51e7('0x37')](_0x28d273);}return _0x37b5c9[_0x51e7('0x38')]();};}function saveUpdates(_0x5e9e3d,_0x16f172){return function(_0xdfbbe1){if(_0xdfbbe1){return _0xdfbbe1[_0x51e7('0x39')](_0x5e9e3d)[_0x51e7('0x23')](function(_0x409b22){return _0x409b22;});}return null;};}function removeEntity(_0x249a0d,_0x23908c){return function(_0x51d262){if(_0x51d262){return _0x51d262[_0x51e7('0x3a')]()['then'](function(){var _0x31c705=_0x51d262[_0x51e7('0x3b')]({'plain':!![]});var _0x17755e=_0x51e7('0x3c');return db[_0x51e7('0x3d')][_0x51e7('0x3a')]({'where':{'type':_0x17755e,'resourceId':_0x31c705['id']}})['then'](function(){return _0x51d262;});})[_0x51e7('0x23')](function(){_0x249a0d[_0x51e7('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30728c,_0x5e799c){return function(_0x2e0697){if(!_0x2e0697){_0x30728c[_0x51e7('0x2f')](0x194);}return _0x2e0697;};}function handleError(_0xa1b7c5,_0x536784){_0x536784=_0x536784||0x1f4;return function(_0x2298a3){logger['error'](_0x2298a3[_0x51e7('0x3e')]);if(_0x2298a3[_0x51e7('0x3f')]){delete _0x2298a3[_0x51e7('0x3f')];}_0xa1b7c5[_0x51e7('0x30')](_0x536784)['send'](_0x2298a3);};}exports[_0x51e7('0x40')]=function(_0x37b08f,_0x43dd0f){var _0x2ccff5={'include':[{'model':db[_0x51e7('0x41')],'as':_0x51e7('0x42')}]},_0x3a0c26={},_0x38126c={'count':0x0,'rows':[]};var _0x1fd3bd=_[_0x51e7('0x43')](db[_0x51e7('0x44')][_0x51e7('0x45')],function(_0x11f967){return{'name':_0x11f967[_0x51e7('0x46')],'type':_0x11f967[_0x51e7('0x47')]['key']};});_0x3a0c26[_0x51e7('0x48')]=_[_0x51e7('0x43')](_0x1fd3bd,_0x51e7('0x3f'));_0x3a0c26[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0x37b08f[_0x51e7('0x49')]);_0x3a0c26[_0x51e7('0x4b')]=_[_0x51e7('0x4c')](_0x3a0c26[_0x51e7('0x48')],_0x3a0c26['query']);_0x2ccff5[_0x51e7('0x4d')]=_[_0x51e7('0x4c')](_0x3a0c26['model'],qs[_0x51e7('0x4e')](_0x37b08f[_0x51e7('0x49')][_0x51e7('0x4e')]));_0x2ccff5[_0x51e7('0x4d')]=_0x2ccff5[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0x2ccff5[_0x51e7('0x4d')]:_0x3a0c26[_0x51e7('0x48')];if(!_0x37b08f[_0x51e7('0x49')]['hasOwnProperty'](_0x51e7('0x50'))){_0x2ccff5['limit']=qs[_0x51e7('0x51')](_0x37b08f['query'][_0x51e7('0x51')]);_0x2ccff5[_0x51e7('0x52')]=qs[_0x51e7('0x52')](_0x37b08f[_0x51e7('0x49')][_0x51e7('0x52')]);}_0x2ccff5['order']=qs[_0x51e7('0x53')](_0x37b08f[_0x51e7('0x49')][_0x51e7('0x53')]);_0x2ccff5[_0x51e7('0x54')]=qs[_0x51e7('0x4b')](_['pick'](_0x37b08f['query'],_0x3a0c26[_0x51e7('0x4b')]),_0x1fd3bd);if(_0x37b08f[_0x51e7('0x49')][_0x51e7('0x55')]){_0x2ccff5[_0x51e7('0x54')]=_['merge'](_0x2ccff5[_0x51e7('0x54')],{'$or':_['map'](_0x1fd3bd,function(_0x20553d){if(_0x20553d[_0x51e7('0x47')]!=='VIRTUAL'){var _0x1f5878={};_0x1f5878[_0x20553d[_0x51e7('0x3f')]]={'$like':'%'+_0x37b08f[_0x51e7('0x49')][_0x51e7('0x55')]+'%'};return _0x1f5878;}})});}_0x2ccff5=_[_0x51e7('0x56')]({},_0x2ccff5,_0x37b08f[_0x51e7('0x57')]);var _0x366e50={'where':_0x2ccff5[_0x51e7('0x54')]};return db[_0x51e7('0x44')][_0x51e7('0x33')](_0x366e50)[_0x51e7('0x23')](function(_0x2b0dbd){_0x38126c[_0x51e7('0x33')]=_0x2b0dbd;if(_0x37b08f['query']['includeAll']){_0x2ccff5['include']=[{'all':!![]}];}return db[_0x51e7('0x44')][_0x51e7('0x58')](_0x2ccff5);})[_0x51e7('0x23')](function(_0xdf8564){_0x38126c[_0x51e7('0x59')]=_0xdf8564;return _0x38126c;})[_0x51e7('0x23')](respondWithFilteredResult(_0x43dd0f,_0x2ccff5))[_0x51e7('0x2e')](handleError(_0x43dd0f,null));};exports[_0x51e7('0x5a')]=function(_0xaffef9,_0x4919fe){var _0x4256ff={'raw':![],'where':{'id':_0xaffef9[_0x51e7('0x5b')]['id']},'include':[{'model':db[_0x51e7('0x41')],'as':_0x51e7('0x42')}]},_0x23ea48={};_0x23ea48['model']=_[_0x51e7('0x4a')](db[_0x51e7('0x44')][_0x51e7('0x45')]);_0x23ea48[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0xaffef9[_0x51e7('0x49')]);_0x23ea48['filters']=_[_0x51e7('0x4c')](_0x23ea48['model'],_0x23ea48['query']);_0x4256ff[_0x51e7('0x4d')]=_['intersection'](_0x23ea48[_0x51e7('0x48')],qs['fields'](_0xaffef9['query']['fields']));_0x4256ff[_0x51e7('0x4d')]=_0x4256ff[_0x51e7('0x4d')]['length']?_0x4256ff[_0x51e7('0x4d')]:_0x23ea48[_0x51e7('0x48')];if(_0xaffef9[_0x51e7('0x49')]['includeAll']){_0x4256ff[_0x51e7('0x5c')]=[{'all':!![]}];}_0x4256ff=_['merge']({},_0x4256ff,_0xaffef9[_0x51e7('0x57')]);return db[_0x51e7('0x44')]['find'](_0x4256ff)[_0x51e7('0x23')](handleEntityNotFound(_0x4919fe,null))['then'](respondWithResult(_0x4919fe,null))[_0x51e7('0x2e')](handleError(_0x4919fe,null));};exports[_0x51e7('0x5d')]=function(_0x337e96,_0x20fd71){return db[_0x51e7('0x44')][_0x51e7('0x5d')](_0x337e96[_0x51e7('0x5e')],{})['then'](function(_0x142e24){var _0xe12cde=_0x337e96[_0x51e7('0x5f')]['get']({'plain':!![]});if(!_0xe12cde)throw new Error(_0x51e7('0x60'));if(_0xe12cde[_0x51e7('0x61')]===_0x51e7('0x5f')){var _0x4cb5d1=_0x142e24[_0x51e7('0x3b')]({'plain':!![]});var _0x506412=_0x51e7('0x3c');return db[_0x51e7('0x62')]['find']({'where':{'name':_0x506412,'userProfileId':_0xe12cde[_0x51e7('0x63')]},'raw':!![]})[_0x51e7('0x23')](function(_0x517520){if(_0x517520&&_0x517520[_0x51e7('0x64')]===0x0){return db[_0x51e7('0x3d')][_0x51e7('0x5d')]({'name':_0x4cb5d1[_0x51e7('0x3f')],'resourceId':_0x4cb5d1['id'],'type':_0x517520['name'],'sectionId':_0x517520['id']},{})[_0x51e7('0x23')](function(){return _0x142e24;});}else{return _0x142e24;}})[_0x51e7('0x2e')](function(_0x3c68c1){logger[_0x51e7('0x2a')](_0x51e7('0x65'),_0x3c68c1);throw _0x3c68c1;});}return _0x142e24;})[_0x51e7('0x23')](respondWithResult(_0x20fd71,0xc9))[_0x51e7('0x2e')](handleError(_0x20fd71,null));};exports[_0x51e7('0x39')]=function(_0xc9e281,_0x531830){if(_0xc9e281[_0x51e7('0x5e')]['id']){delete _0xc9e281['body']['id'];}return db[_0x51e7('0x44')]['find']({'where':{'id':_0xc9e281[_0x51e7('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x51e7('0x42')}]})['then'](handleEntityNotFound(_0x531830,null))[_0x51e7('0x23')](saveUpdates(_0xc9e281[_0x51e7('0x5e')],null))[_0x51e7('0x23')](respondWithResult(_0x531830,null))[_0x51e7('0x2e')](handleError(_0x531830,null));};exports[_0x51e7('0x3a')]=function(_0x1a6ba3,_0xac218b){return db[_0x51e7('0x44')][_0x51e7('0x66')]({'where':{'id':_0x1a6ba3[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0xac218b,null))['then'](removeEntity(_0xac218b,null))[_0x51e7('0x2e')](handleError(_0xac218b,null));};exports[_0x51e7('0x67')]=function(_0x23c656,_0x46d612){return db[_0x51e7('0x44')][_0x51e7('0x67')]()['then'](respondWithResult(_0x46d612,null))[_0x51e7('0x2e')](handleError(_0x46d612,null));};exports[_0x51e7('0x68')]=function(_0x35d9a2,_0x1b24f2,_0xbfefab){if(_0x35d9a2[_0x51e7('0x5e')]['id']){delete _0x35d9a2[_0x51e7('0x5e')]['id'];}return db['FaxAccount'][_0x51e7('0x66')]({'where':{'id':_0x35d9a2['params']['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x1b24f2,null))[_0x51e7('0x23')](function(_0x2e0dbc){if(_0x2e0dbc){_0x35d9a2[_0x51e7('0x5e')][_0x51e7('0x69')]=_0x2e0dbc['id'];return db['Disposition'][_0x51e7('0x5d')](_0x35d9a2[_0x51e7('0x5e')]);}})[_0x51e7('0x23')](respondWithResult(_0x1b24f2,null))[_0x51e7('0x2e')](handleError(_0x1b24f2,null));};exports[_0x51e7('0x6a')]=function(_0x3b3fa3,_0x175613,_0x5c3ee4){var _0xad44f9={'raw':![],'where':{}};var _0x2c62fc={};var _0x2ea7e9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x51e7('0x6b')]({'where':{'id':_0x3b3fa3[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x175613,null))['then'](function(_0x2abab1){if(_0x2abab1){_0x2c62fc[_0x51e7('0x48')]=_[_0x51e7('0x4a')](db[_0x51e7('0x6c')][_0x51e7('0x45')]);_0x2c62fc[_0x51e7('0x49')]=_['keys'](_0x3b3fa3['query']);_0x2c62fc[_0x51e7('0x4b')]=_['intersection'](_0x2c62fc[_0x51e7('0x48')],_0x2c62fc['query']);_0xad44f9['attributes']=_[_0x51e7('0x4c')](_0x2c62fc[_0x51e7('0x48')],qs[_0x51e7('0x4e')](_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x4e')]));_0xad44f9[_0x51e7('0x4d')]=_0xad44f9[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0xad44f9[_0x51e7('0x4d')]:_0x2c62fc[_0x51e7('0x48')];if(!_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x6d')](_0x51e7('0x50'))){_0xad44f9['limit']=qs[_0x51e7('0x51')](_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x51')]);_0xad44f9['offset']=qs[_0x51e7('0x52')](_0x3b3fa3[_0x51e7('0x49')]['offset']);}_0xad44f9[_0x51e7('0x6e')]=qs[_0x51e7('0x53')](_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x53')]);_0xad44f9[_0x51e7('0x54')]=qs['filters'](_['pick'](_0x3b3fa3['query'],_0x2c62fc[_0x51e7('0x4b')]));_0xad44f9[_0x51e7('0x54')][_0x51e7('0x69')]=_0x2abab1['id'];if(_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x55')]){_0xad44f9[_0x51e7('0x54')]=_['merge'](_0xad44f9[_0x51e7('0x54')],{'$or':_[_0x51e7('0x43')](_0xad44f9[_0x51e7('0x4d')],function(_0xdd1c9e){var _0x38d136={};_0x38d136[_0xdd1c9e]={'$like':'%'+_0x3b3fa3['query'][_0x51e7('0x55')]+'%'};return _0x38d136;})});}_0xad44f9=_['merge']({},_0xad44f9,_0x3b3fa3[_0x51e7('0x57')]);return db[_0x51e7('0x6c')][_0x51e7('0x33')]({'where':_0xad44f9[_0x51e7('0x54')]})[_0x51e7('0x23')](function(_0x8bb509){_0x2ea7e9[_0x51e7('0x33')]=_0x8bb509;if(_0x3b3fa3[_0x51e7('0x49')][_0x51e7('0x6f')]){_0xad44f9[_0x51e7('0x5c')]=[{'all':!![]}];}return db[_0x51e7('0x6c')][_0x51e7('0x58')](_0xad44f9);})['then'](function(_0x3014d6){_0x2ea7e9[_0x51e7('0x59')]=_0x3014d6;return _0x2ea7e9;});}})[_0x51e7('0x23')](respondWithFilteredResult(_0x175613,_0xad44f9))['catch'](handleError(_0x175613,null));};exports[_0x51e7('0x70')]=function(_0xdb8d08,_0x480685,_0x375694){return db[_0x51e7('0x44')][_0x51e7('0x66')]({'where':{'id':_0xdb8d08[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x480685,null))[_0x51e7('0x23')](function(_0x59fc75){if(_0x59fc75){return _0x59fc75['removeDispositions'](_0xdb8d08[_0x51e7('0x49')][_0x51e7('0x71')]);}})[_0x51e7('0x23')](respondWithStatusCode(_0x480685,null))[_0x51e7('0x2e')](handleError(_0x480685,null));};exports['addAnswer']=function(_0x2be151,_0x249497,_0x2b3779){if(_0x2be151[_0x51e7('0x5e')]['id']){delete _0x2be151[_0x51e7('0x5e')]['id'];}return db[_0x51e7('0x44')]['find']({'where':{'id':_0x2be151[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x249497,null))[_0x51e7('0x23')](function(_0x557049){if(_0x557049){_0x2be151[_0x51e7('0x5e')][_0x51e7('0x69')]=_0x557049['id'];return db[_0x51e7('0x72')]['create'](_0x2be151[_0x51e7('0x5e')]);}})['then'](respondWithResult(_0x249497,null))[_0x51e7('0x2e')](handleError(_0x249497,null));};exports[_0x51e7('0x73')]=function(_0x1790e4,_0x411b86,_0x2d58da){var _0x53c73f={'raw':![],'where':{}};var _0x5e8932={};var _0x4bea59={'count':0x0,'rows':[]};return db[_0x51e7('0x44')][_0x51e7('0x6b')]({'where':{'id':_0x1790e4[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x411b86,null))[_0x51e7('0x23')](function(_0x1dab01){if(_0x1dab01){_0x5e8932[_0x51e7('0x48')]=_[_0x51e7('0x4a')](db[_0x51e7('0x72')]['rawAttributes']);_0x5e8932[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0x1790e4['query']);_0x5e8932[_0x51e7('0x4b')]=_[_0x51e7('0x4c')](_0x5e8932[_0x51e7('0x48')],_0x5e8932['query']);_0x53c73f[_0x51e7('0x4d')]=_['intersection'](_0x5e8932[_0x51e7('0x48')],qs[_0x51e7('0x4e')](_0x1790e4[_0x51e7('0x49')][_0x51e7('0x4e')]));_0x53c73f[_0x51e7('0x4d')]=_0x53c73f[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0x53c73f[_0x51e7('0x4d')]:_0x5e8932[_0x51e7('0x48')];if(!_0x1790e4[_0x51e7('0x49')][_0x51e7('0x6d')](_0x51e7('0x50'))){_0x53c73f['limit']=qs[_0x51e7('0x51')](_0x1790e4[_0x51e7('0x49')][_0x51e7('0x51')]);_0x53c73f[_0x51e7('0x52')]=qs[_0x51e7('0x52')](_0x1790e4['query'][_0x51e7('0x52')]);}_0x53c73f[_0x51e7('0x6e')]=qs[_0x51e7('0x53')](_0x1790e4['query']['sort']);_0x53c73f[_0x51e7('0x54')]=qs[_0x51e7('0x4b')](_[_0x51e7('0x74')](_0x1790e4[_0x51e7('0x49')],_0x5e8932['filters']));_0x53c73f[_0x51e7('0x54')][_0x51e7('0x69')]=_0x1dab01['id'];if(_0x1790e4[_0x51e7('0x49')][_0x51e7('0x55')]){_0x53c73f[_0x51e7('0x54')]=_['merge'](_0x53c73f['where'],{'$or':_[_0x51e7('0x43')](_0x53c73f[_0x51e7('0x4d')],function(_0x56789e){var _0x3823eb={};_0x3823eb[_0x56789e]={'$like':'%'+_0x1790e4[_0x51e7('0x49')][_0x51e7('0x55')]+'%'};return _0x3823eb;})});}_0x53c73f=_['merge']({},_0x53c73f,_0x1790e4[_0x51e7('0x57')]);return db[_0x51e7('0x72')][_0x51e7('0x33')]({'where':_0x53c73f[_0x51e7('0x54')]})['then'](function(_0x2ff210){_0x4bea59['count']=_0x2ff210;if(_0x1790e4[_0x51e7('0x49')]['includeAll']){_0x53c73f[_0x51e7('0x5c')]=[{'all':!![]}];}return db[_0x51e7('0x72')][_0x51e7('0x58')](_0x53c73f);})[_0x51e7('0x23')](function(_0x16437b){_0x4bea59[_0x51e7('0x59')]=_0x16437b;return _0x4bea59;});}})[_0x51e7('0x23')](respondWithFilteredResult(_0x411b86,_0x53c73f))[_0x51e7('0x2e')](handleError(_0x411b86,null));};exports[_0x51e7('0x75')]=function(_0x1a8dc3,_0x815aeb,_0x54bcc8){return db[_0x51e7('0x44')]['find']({'where':{'id':_0x1a8dc3['params']['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x815aeb,null))[_0x51e7('0x23')](function(_0x535964){if(_0x535964){return _0x535964['removeAnswers'](_0x1a8dc3[_0x51e7('0x49')][_0x51e7('0x71')]);}})[_0x51e7('0x23')](respondWithStatusCode(_0x815aeb,null))[_0x51e7('0x2e')](handleError(_0x815aeb,null));};exports['addInteraction']=function(_0x5d7536,_0x4ff03c,_0x4874d8){return db[_0x51e7('0x76')][_0x51e7('0x66')]({'where':{'id':_0x5d7536['params']['id']}})['then'](handleEntityNotFound(_0x4ff03c,null))[_0x51e7('0x23')](function(_0x31ad6a){if(_0x31ad6a){return _0x31ad6a[_0x51e7('0x77')](_0x5d7536['body'][_0x51e7('0x71')],_[_0x51e7('0x78')](_0x5d7536[_0x51e7('0x5e')],[_0x51e7('0x71'),'id'])||{});}})['then'](respondWithResult(_0x4ff03c,null))['catch'](handleError(_0x4ff03c,null));};exports[_0x51e7('0x79')]=function(_0x2cf821,_0x35bcf5,_0x4b0728){var _0x555fdf={'raw':![],'where':{}};var _0x53a5a6={};var _0x2e634e={'count':0x0,'rows':[]};return db[_0x51e7('0x44')][_0x51e7('0x6b')]({'where':{'id':_0x2cf821[_0x51e7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x35bcf5,null))[_0x51e7('0x23')](function(_0x476b29){if(_0x476b29){_0x53a5a6[_0x51e7('0x48')]=_['keys'](db[_0x51e7('0x76')][_0x51e7('0x45')]);_0x53a5a6[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0x2cf821['query']);_0x53a5a6[_0x51e7('0x4b')]=_[_0x51e7('0x4c')](_0x53a5a6[_0x51e7('0x48')],_0x53a5a6[_0x51e7('0x49')]);_0x555fdf[_0x51e7('0x4d')]=_['intersection'](_0x53a5a6[_0x51e7('0x48')],qs[_0x51e7('0x4e')](_0x2cf821[_0x51e7('0x49')][_0x51e7('0x4e')]));_0x555fdf[_0x51e7('0x4d')]=_0x555fdf[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0x555fdf[_0x51e7('0x4d')]:_0x53a5a6[_0x51e7('0x48')];if(!_0x2cf821['query'][_0x51e7('0x6d')](_0x51e7('0x50'))){_0x555fdf[_0x51e7('0x51')]=qs[_0x51e7('0x51')](_0x2cf821[_0x51e7('0x49')][_0x51e7('0x51')]);_0x555fdf[_0x51e7('0x52')]=qs[_0x51e7('0x52')](_0x2cf821['query'][_0x51e7('0x52')]);}_0x555fdf[_0x51e7('0x6e')]=qs[_0x51e7('0x53')](_0x2cf821['query'][_0x51e7('0x53')]);_0x555fdf[_0x51e7('0x54')]=qs[_0x51e7('0x4b')](_['pick'](_0x2cf821[_0x51e7('0x49')],_0x53a5a6[_0x51e7('0x4b')]));_0x555fdf['where']['FaxAccountId']=_0x476b29['id'];if(_0x2cf821[_0x51e7('0x49')][_0x51e7('0x55')]){_0x555fdf[_0x51e7('0x54')]=_[_0x51e7('0x56')](_0x555fdf[_0x51e7('0x54')],{'$or':_['map'](_0x555fdf[_0x51e7('0x4d')],function(_0x42dfb3){var _0x504398={};_0x504398[_0x42dfb3]={'$like':'%'+_0x2cf821['query'][_0x51e7('0x55')]+'%'};return _0x504398;})});}_0x555fdf=_['merge']({},_0x555fdf,_0x2cf821[_0x51e7('0x57')]);return db[_0x51e7('0x76')][_0x51e7('0x33')]({'where':_0x555fdf[_0x51e7('0x54')]})[_0x51e7('0x23')](function(_0x3862fb){_0x2e634e['count']=_0x3862fb;if(_0x2cf821[_0x51e7('0x49')][_0x51e7('0x6f')]){_0x555fdf['include']=[{'model':db[_0x51e7('0x7a')],'as':_0x51e7('0x7b'),'required':![]},{'model':db[_0x51e7('0x7c')],'as':_0x51e7('0x7d'),'attributes':[_0x51e7('0x3f'),_0x51e7('0x7e'),_0x51e7('0x7f')],'required':![]},{'model':db[_0x51e7('0x80')],'as':'Tags','attributes':['id',_0x51e7('0x3f'),_0x51e7('0x81')],'where':_0x2cf821[_0x51e7('0x49')][_0x51e7('0x82')]?{'id':_0x2cf821[_0x51e7('0x49')][_0x51e7('0x82')]}:undefined,'required':_0x2cf821[_0x51e7('0x49')][_0x51e7('0x82')]?!![]:![]}];}return db[_0x51e7('0x76')]['findAll'](_0x555fdf);})['then'](function(_0x40b494){_0x2e634e[_0x51e7('0x59')]=_0x40b494;return _0x2e634e;});}})[_0x51e7('0x23')](respondWithFilteredResult(_0x35bcf5,_0x555fdf))[_0x51e7('0x2e')](handleError(_0x35bcf5,null));};exports[_0x51e7('0x83')]=function(_0x16a02a,_0x1a358a,_0x1d7381){return db[_0x51e7('0x44')]['findOne']({'where':{'id':_0x16a02a[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x1a358a,null))[_0x51e7('0x23')](function(_0x2a863c){if(_0x2a863c){return db[_0x51e7('0x84')][_0x51e7('0x85')](function(_0x3e451a){return db['FaxApplication'][_0x51e7('0x3a')]({'where':{'FaxAccountId':_0x16a02a[_0x51e7('0x5b')]['id']},'transaction':_0x3e451a})[_0x51e7('0x23')](function(_0x23cfff){var _0xb8f792=_['map'](_0x16a02a['body'],function(_0x1a4cad){_0x1a4cad[_0x51e7('0x69')]=_0x16a02a['params']['id'];return _0x1a4cad;});return db[_0x51e7('0x86')][_0x51e7('0x87')](_0xb8f792,{'transaction':_0x3e451a});});})[_0x51e7('0x23')](function(){return db[_0x51e7('0x86')][_0x51e7('0x88')]({'where':{'FaxAccountId':_0x16a02a[_0x51e7('0x5b')]['id']},'order':_0x51e7('0x89')});});}})[_0x51e7('0x23')](respondWithResult(_0x1a358a,null))[_0x51e7('0x2e')](handleError(_0x1a358a,null));};exports['getApplications']=function(_0x2f6fef,_0x19af16,_0x503d72){var _0x47cd58={};var _0x5afcea={};var _0x33a35a;var _0x516875;return db[_0x51e7('0x44')][_0x51e7('0x6b')]({'where':{'id':_0x2f6fef[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x19af16,null))[_0x51e7('0x23')](function(_0x3ed351){if(_0x3ed351){_0x33a35a=_0x3ed351;_0x5afcea[_0x51e7('0x48')]=_[_0x51e7('0x4a')](db[_0x51e7('0x86')][_0x51e7('0x45')]);_0x5afcea[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0x2f6fef[_0x51e7('0x49')]);_0x5afcea['filters']=_[_0x51e7('0x4c')](_0x5afcea[_0x51e7('0x48')],_0x5afcea[_0x51e7('0x49')]);_0x47cd58[_0x51e7('0x4d')]=_['intersection'](_0x5afcea[_0x51e7('0x48')],qs[_0x51e7('0x4e')](_0x2f6fef[_0x51e7('0x49')][_0x51e7('0x4e')]));_0x47cd58[_0x51e7('0x4d')]=_0x47cd58[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0x47cd58[_0x51e7('0x4d')]:_0x5afcea[_0x51e7('0x48')];_0x47cd58[_0x51e7('0x6e')]=qs[_0x51e7('0x53')](_0x2f6fef[_0x51e7('0x49')][_0x51e7('0x53')]);_0x47cd58[_0x51e7('0x54')]=qs[_0x51e7('0x4b')](_[_0x51e7('0x74')](_0x2f6fef['query'],_0x5afcea[_0x51e7('0x4b')]));if(_0x2f6fef['query']['filter']){_0x47cd58[_0x51e7('0x54')]=_[_0x51e7('0x56')](_0x47cd58['where'],{'$or':_[_0x51e7('0x43')](_0x47cd58['attributes'],function(_0x30e642){var _0x16ce0f={};_0x16ce0f[_0x30e642]={'$like':'%'+_0x2f6fef['query'][_0x51e7('0x55')]+'%'};return _0x16ce0f;})});}_0x47cd58=_[_0x51e7('0x56')]({},_0x47cd58,_0x2f6fef[_0x51e7('0x57')]);return _0x33a35a[_0x51e7('0x8a')](_0x47cd58);}})[_0x51e7('0x23')](function(_0x481992){if(_0x481992){_0x516875=_0x481992[_0x51e7('0x4f')];if(!_0x2f6fef[_0x51e7('0x49')][_0x51e7('0x6d')](_0x51e7('0x50'))){_0x47cd58['limit']=qs['limit'](_0x2f6fef[_0x51e7('0x49')]['limit']);_0x47cd58[_0x51e7('0x52')]=qs['offset'](_0x2f6fef[_0x51e7('0x49')][_0x51e7('0x52')]);}return _0x33a35a[_0x51e7('0x8a')](_0x47cd58);}})[_0x51e7('0x23')](function(_0x772a4c){if(_0x772a4c){return _0x772a4c?{'count':_0x516875,'rows':_0x772a4c}:null;}})[_0x51e7('0x23')](respondWithResult(_0x19af16,null))[_0x51e7('0x2e')](handleError(_0x19af16,null));};function Extension(_0x59b9e8,_0x431f1e,_0xf2b6ff,_0x37f251){this[_0x51e7('0x8b')]=_0x51e7('0x8c');this['exten']=_0x59b9e8['localstationid'];this['app']=_0x37f251;this[_0x51e7('0x47')]='system';this[_0x51e7('0x8d')]=_0x51e7('0x8e');this[_0x51e7('0x69')]=_0x59b9e8['id'];this['priority']=_0x431f1e;this[_0x51e7('0x8f')]=_0xf2b6ff;}function createExtensionsReciveFax(_0x478d56){var _0x4076da=0x1;var _0x193960=[];_0x193960[_0x51e7('0x90')](new Extension(_0x478d56,_0x4076da,'',_0x51e7('0x91')));_0x4076da+=0x1;_0x193960[_0x51e7('0x90')](new Extension(_0x478d56,_0x4076da,_0x51e7('0x92'),_0x51e7('0x93')));_0x4076da+=0x1;for(var _0x5c0b54 in _0x478d56){if(_0x478d56[_0x51e7('0x6d')](_0x5c0b54)&&(_0x5c0b54===_0x51e7('0x94')||_0x5c0b54==='localstationid'||_0x5c0b54===_0x51e7('0x95')||_0x5c0b54===_0x51e7('0x96')||_0x5c0b54===_0x51e7('0x97')||_0x5c0b54==='maxrate'||_0x5c0b54===_0x51e7('0x98')||_0x5c0b54==='modem'||_0x5c0b54===_0x51e7('0x99'))){_0x193960['push'](new Extension(_0x478d56,_0x4076da,'FAXOPT('+_0x5c0b54+')='+_0x478d56[_0x5c0b54],_0x51e7('0x93')));_0x4076da+=0x1;}}_0x193960[_0x51e7('0x90')](new Extension(_0x478d56,_0x4076da,'6','Wait'));_0x4076da+=0x1;_0x193960[_0x51e7('0x90')](new Extension(_0x478d56,_0x4076da,_0x51e7('0x9a'),_0x51e7('0x9b')));_0x4076da=0x0;return _0x193960;}exports[_0x51e7('0x9c')]=function(_0x48b655,_0x4bccfa,_0x52b360){var _0x3d1f1f;return db[_0x51e7('0x84')][_0x51e7('0x85')](function(_0x26a4f4){return db[_0x51e7('0x44')][_0x51e7('0x5d')](_0x48b655['body'],{'transaction':_0x26a4f4})['then'](function(_0x172f11){_0x3d1f1f=_0x172f11[_0x51e7('0x3b')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x3d1f1f),{'transaction':_0x26a4f4});});})[_0x51e7('0x23')](function(){return _0x3d1f1f;})['then'](respondWithResult(_0x4bccfa,null))[_0x51e7('0x2e')](handleError(_0x4bccfa,null));};exports[_0x51e7('0x9d')]=function(_0x2d398f,_0x141112,_0x2e338c){var _0x3925ca;return db[_0x51e7('0x84')][_0x51e7('0x85')](function(_0x450612){return db['FaxAccount'][_0x51e7('0x39')](_0x2d398f['body'],{'where':{'id':_0x2d398f[_0x51e7('0x5e')]['id']},'transaction':_0x450612})[_0x51e7('0x23')](function(_0x487239){return db['VoiceExtension'][_0x51e7('0x3a')]({'where':{'FaxAccountId':_0x2d398f[_0x51e7('0x5e')]['id']},'transaction':_0x450612})[_0x51e7('0x23')](function(_0x173a11){return db[_0x51e7('0x9e')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x2d398f['body'],['tech',_0x51e7('0x9f'),_0x51e7('0xa0'),'updatedAt',_0x51e7('0xa1'),_0x51e7('0xa2')])),{'transaction':_0x450612});});});})[_0x51e7('0x23')](function(){return db[_0x51e7('0x44')][_0x51e7('0xa3')](_0x2d398f[_0x51e7('0x5e')]['id']);})[_0x51e7('0x23')](respondWithResult(_0x141112,null))[_0x51e7('0x2e')](handleError(_0x141112,null));};exports[_0x51e7('0xa4')]=function(_0x199cdc,_0x4b65f6,_0x72375e){var _0xbc2c2f={'raw':!![],'where':{}};var _0x190a37={};var _0x56567a={'count':0x0,'rows':[]};return db[_0x51e7('0x44')]['findOne']({'where':{'id':_0x199cdc['params']['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x4b65f6,null))[_0x51e7('0x23')](function(_0x1c73dc){if(_0x1c73dc){_0x190a37['model']=_[_0x51e7('0x4a')](db[_0x51e7('0xa5')][_0x51e7('0x45')]);_0x190a37[_0x51e7('0x49')]=_[_0x51e7('0x4a')](_0x199cdc[_0x51e7('0x49')]);_0x190a37['filters']=_[_0x51e7('0x4c')](_0x190a37['model'],_0x190a37[_0x51e7('0x49')]);_0xbc2c2f[_0x51e7('0x4d')]=_['intersection'](_0x190a37['model'],qs[_0x51e7('0x4e')](_0x199cdc[_0x51e7('0x49')][_0x51e7('0x4e')]));_0xbc2c2f[_0x51e7('0x4d')]=_0xbc2c2f[_0x51e7('0x4d')][_0x51e7('0x4f')]?_0xbc2c2f[_0x51e7('0x4d')]:_0x190a37[_0x51e7('0x48')];if(!_0x199cdc[_0x51e7('0x49')][_0x51e7('0x6d')](_0x51e7('0x50'))){_0xbc2c2f[_0x51e7('0x51')]=qs[_0x51e7('0x51')](_0x199cdc['query'][_0x51e7('0x51')]);_0xbc2c2f['offset']=qs[_0x51e7('0x52')](_0x199cdc[_0x51e7('0x49')][_0x51e7('0x52')]);}_0xbc2c2f[_0x51e7('0x6e')]=qs[_0x51e7('0x53')](_0x199cdc['query'][_0x51e7('0x53')]);_0xbc2c2f[_0x51e7('0x54')]=qs[_0x51e7('0x4b')](_[_0x51e7('0x74')](_0x199cdc[_0x51e7('0x49')],_0x190a37[_0x51e7('0x4b')]));_0xbc2c2f[_0x51e7('0x54')][_0x51e7('0x69')]=_0x1c73dc['id'];if(_0x199cdc[_0x51e7('0x49')][_0x51e7('0x55')]){_0xbc2c2f[_0x51e7('0x54')]=_[_0x51e7('0x56')](_0xbc2c2f[_0x51e7('0x54')],{'$or':_[_0x51e7('0x43')](_0xbc2c2f['attributes'],function(_0x1f3888){var _0x593966={};_0x593966[_0x1f3888]={'$like':'%'+_0x199cdc['query']['filter']+'%'};return _0x593966;})});}if(_0x199cdc[_0x51e7('0x49')][_0x51e7('0xa6')]){var _0x54eb3a=_0x199cdc[_0x51e7('0x49')][_0x51e7('0xa6')]['split'](',');var _0x288c3a={};_0x288c3a[_0x54eb3a[0x0]]={'$gte':moment(_0x54eb3a[0x1])[_0x51e7('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0xbc2c2f[_0x51e7('0x54')]=_['merge'](_0xbc2c2f[_0x51e7('0x54')],_0x288c3a);}_0xbc2c2f=_[_0x51e7('0x56')]({},_0xbc2c2f,_0x199cdc[_0x51e7('0x57')]);return db[_0x51e7('0xa5')][_0x51e7('0x33')]({'where':_0xbc2c2f['where']})['then'](function(_0xca65ad){_0x56567a[_0x51e7('0x33')]=_0xca65ad;if(_0x199cdc[_0x51e7('0x49')]['includeAll']){_0xbc2c2f[_0x51e7('0x5c')]=[{'all':!![]}];}return db[_0x51e7('0xa5')]['findAll'](_0xbc2c2f);})['then'](function(_0x41ac6f){_0x56567a[_0x51e7('0x59')]=_0x41ac6f;return _0x56567a;});}})[_0x51e7('0x23')](respondWithFilteredResult(_0x4b65f6,_0xbc2c2f))[_0x51e7('0x2e')](handleError(_0x4b65f6,null));};exports[_0x51e7('0xa8')]=function(_0x95f541,_0x26695e,_0x52a1df){var _0x377a72,_0x132b13={},_0x14f5d4;if(_0x95f541[_0x51e7('0x5e')]['to']){_0x14f5d4=_0x95f541[_0x51e7('0x5e')]['to'][0x0];}return db[_0x51e7('0x44')][_0x51e7('0x66')]({'where':{'id':_0x95f541[_0x51e7('0x5b')]['id']},'include':[{'model':db[_0x51e7('0xa9')],'as':_0x51e7('0xaa'),'include':[{'model':db[_0x51e7('0x7a')],'as':'Contacts','where':{'fax':_0x14f5d4},'limit':0x1,'order':[[_0x51e7('0xab'),'DESC']]}]}]})[_0x51e7('0x23')](handleEntityNotFound(_0x26695e,null))[_0x51e7('0x23')](function(_0x68211e){_0x377a72=_0x68211e;if(_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')]&&_0x95f541['body'][_0x51e7('0xac')][_0x51e7('0x4f')]){for(var _0x2e99db=0x0;_0x2e99db<_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][_0x51e7('0x4f')];_0x2e99db+=0x1){_0x95f541[_0x51e7('0x5e')]['attachments'][_0x2e99db]={'filename':_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][_0x2e99db]['name'],'id':_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][_0x2e99db]['id'],'path':path[_0x51e7('0xad')](config['root'],_0x51e7('0xae'),_0x95f541['body'][_0x51e7('0xac')][_0x2e99db][_0x51e7('0xaf')])};}}return respondWithRpcPromise('CheckAfterSend',_0x51e7('0xb0'),{'FaxAccountId':_[_0x51e7('0xb1')](_0x95f541['params']['id'])?undefined:_0x95f541[_0x51e7('0x5b')]['id'],'path':_['isNil'](_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][0x0][_0x51e7('0x7')])?undefined:_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][0x0]['path'],'fax':_[_0x51e7('0xb1')](_0x95f541['body']['to'][0x0])?undefined:_0x95f541[_0x51e7('0x5e')]['to'][0x0]},client9002);})[_0x51e7('0x23')](function(){if(_0x377a72){if(_[_0x51e7('0xb1')](_0x95f541[_0x51e7('0x5e')][_0x51e7('0xb2')])){_0x95f541[_0x51e7('0x5e')]['from']=util[_0x51e7('0xa7')]('\x22%s\x22\x20<%s>',_0x377a72[_0x51e7('0x3f')],_0x377a72[_0x51e7('0xb3')]);}if(_0x377a72[_0x51e7('0xaa')]){if(_0x377a72[_0x51e7('0xaa')][_0x51e7('0xb4')][_0x51e7('0x4f')]){return _0x377a72[_0x51e7('0xaa')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x51e7('0x1b')](_0x95f541['body'],{'firstName':_0x95f541[_0x51e7('0x5e')]['to'][0x0],'phone':_0x95f541[_0x51e7('0x5e')]['to'][0x0],'fax':_0x95f541[_0x51e7('0x5e')]['to'][0x0],'ListId':_0x377a72['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x51e7('0x23')](function(_0x3e3904){if(_0x3e3904){return db[_0x51e7('0x76')]['find']({'where':{'ContactId':_0x3e3904['id'],'closed':![],'FaxAccountId':_0x377a72['id']}})['then'](function(_0x29836e){if(_0x29836e){return[_0x29836e,![]];}return db[_0x51e7('0x76')]['create']({'UserId':_0x95f541[_0x51e7('0x5f')]['id'],'ContactId':_0x3e3904['id'],'FaxAccountId':_0x377a72['id'],'fax':_0x95f541[_0x51e7('0x5e')]['to'][0x0],'firstMsgDirection':_0x51e7('0xb5'),'Messages':[_['merge'](_0x95f541[_0x51e7('0x5e')],{'read':![],'body':_0x95f541[_0x51e7('0x5e')]['attachments'][0x0][_0x51e7('0xb6')],'FaxAccountId':_0x377a72['id'],'UserId':_0x95f541[_0x51e7('0x5f')]['id'],'ContactId':_0x3e3904['id'],'AttachmentId':_0x95f541[_0x51e7('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x51e7('0xa5')],'as':'Messages'}]})[_0x51e7('0x23')](function(_0x1347a5){return[_0x1347a5,!![]];});});}else{throw new Error(_0x51e7('0xb7'));}})[_0x51e7('0xb8')](function(_0x4e3c87,_0x398961){if(_0x398961){return _0x4e3c87;}return db[_0x51e7('0xa5')][_0x51e7('0x5d')]({'direction':_0x51e7('0xb5'),'read':![],'body':_0x95f541['body'][_0x51e7('0xac')][0x0][_0x51e7('0xb6')],'FaxAccountId':_0x377a72['id'],'FaxInteractionId':_0x4e3c87['id'],'UserId':_0x95f541[_0x51e7('0x5f')]['id'],'ContactId':_0x4e3c87['ContactId'],'AttachmentId':_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][0x0]['id']})['then'](function(_0x555a3b){_0x4e3c87[_0x51e7('0xb9')]['Messages']=[];_0x4e3c87[_0x51e7('0xb9')][_0x51e7('0xba')]['push'](_0x555a3b[_0x51e7('0xb9')]);return _0x4e3c87;});})[_0x51e7('0x23')](function(_0x38816b){respondWithRpcPromise('SendFax',_0x51e7('0xbb'),{'FaxAccountId':_[_0x51e7('0xb1')](_0x95f541['params']['id'])?undefined:_0x95f541['params']['id'],'path':_[_0x51e7('0xb1')](_0x95f541['body'][_0x51e7('0xac')][0x0][_0x51e7('0x7')])?undefined:_0x95f541[_0x51e7('0x5e')]['attachments'][0x0][_0x51e7('0x7')],'fax':_[_0x51e7('0xb1')](_0x95f541[_0x51e7('0x5e')]['to'][0x0])?undefined:_0x95f541[_0x51e7('0x5e')]['to'][0x0],'AttachmentId':_0x95f541[_0x51e7('0x5e')][_0x51e7('0xac')][0x0]['id']},client9002)[_0x51e7('0x23')](function(_0x52ce98){logger[_0x51e7('0x24')](_0x51e7('0xbc'),_0x52ce98);})[_0x51e7('0x2e')](function(_0x1b7802){logger[_0x51e7('0x24')](_0x51e7('0xbc'),_0x1b7802);});return _0x38816b;})[_0x51e7('0x23')](respondWithResult(_0x26695e,null))['catch'](handleError(_0x26695e,null));};exports['addAgents']=function(_0x5c4a2e,_0x362973,_0x37c863){return db['FaxAccount'][_0x51e7('0x66')]({'where':{'id':_0x5c4a2e[_0x51e7('0x5b')]['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x362973,null))[_0x51e7('0x23')](function(_0xe125b9){if(_0xe125b9){return _0xe125b9['addAgents'](_0x5c4a2e[_0x51e7('0x5e')][_0x51e7('0x71')],_['omit'](_0x5c4a2e['body'],['ids','id'])||{})['spread'](function(_0x24f5af){for(var _0x3997bf=0x0;_0x3997bf<_0x5c4a2e[_0x51e7('0x5e')][_0x51e7('0x71')]['length'];_0x3997bf+=0x1){socket[_0x51e7('0xbd')](_0x51e7('0xbe'),{'UserId':Number(_0x5c4a2e['body'][_0x51e7('0x71')][_0x3997bf]),'FaxAccountId':Number(_0x5c4a2e[_0x51e7('0x5b')]['id'])});}return _0x24f5af;});}})[_0x51e7('0x23')](respondWithResult(_0x362973,null))['catch'](handleError(_0x362973,null));};exports[_0x51e7('0xbf')]=function(_0x5e9ea7,_0x4404b4,_0xdcac1c){return db[_0x51e7('0x44')][_0x51e7('0x66')]({'where':{'id':_0x5e9ea7['params']['id']}})['then'](handleEntityNotFound(_0x4404b4,null))[_0x51e7('0x23')](function(_0xdda989){if(_0xdda989){return _0xdda989[_0x51e7('0xbf')](_0x5e9ea7[_0x51e7('0x49')][_0x51e7('0x71')])[_0x51e7('0x23')](function(){if(_[_0x51e7('0xc0')](_0x5e9ea7[_0x51e7('0x49')][_0x51e7('0x71')])){for(var _0xf2b81c=0x0;_0xf2b81c<_0x5e9ea7[_0x51e7('0x49')][_0x51e7('0x71')][_0x51e7('0x4f')];_0xf2b81c+=0x1){socket[_0x51e7('0xbd')](_0x51e7('0xc1'),{'UserId':Number(_0x5e9ea7[_0x51e7('0x49')][_0x51e7('0x71')][_0xf2b81c]),'FaxAccountId':Number(_0x5e9ea7[_0x51e7('0x5b')]['id'])});}}else{socket[_0x51e7('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x5e9ea7['query'][_0x51e7('0x71')]),'FaxAccountId':Number(_0x5e9ea7[_0x51e7('0x5b')]['id'])});}});}})[_0x51e7('0x23')](respondWithStatusCode(_0x4404b4,null))[_0x51e7('0x2e')](handleError(_0x4404b4,null));};exports[_0x51e7('0xc2')]=function(_0x153220,_0x5d971,_0x586fa4){var _0x2c9a4a={};var _0xcbb483={};var _0x476b18;var _0x57eb8d;return db[_0x51e7('0x44')][_0x51e7('0x6b')]({'where':{'id':_0x153220['params']['id']}})[_0x51e7('0x23')](handleEntityNotFound(_0x5d971,null))[_0x51e7('0x23')](function(_0x556ac1){if(_0x556ac1){_0x476b18=_0x556ac1;_0xcbb483[_0x51e7('0x48')]=_[_0x51e7('0x4a')](db[_0x51e7('0x7c')][_0x51e7('0x45')]);_0xcbb483[_0x51e7('0x49')]=_['keys'](_0x153220['query']);_0xcbb483[_0x51e7('0x4b')]=_[_0x51e7('0x4c')](_0xcbb483[_0x51e7('0x48')],_0xcbb483[_0x51e7('0x49')]);_0x2c9a4a[_0x51e7('0x4d')]=_['intersection'](_0xcbb483[_0x51e7('0x48')],qs[_0x51e7('0x4e')](_0x153220[_0x51e7('0x49')][_0x51e7('0x4e')]));_0x2c9a4a[_0x51e7('0x4d')]=_0x2c9a4a[_0x51e7('0x4d')]['length']?_0x2c9a4a[_0x51e7('0x4d')]:_0xcbb483[_0x51e7('0x48')];_0x2c9a4a['order']=qs[_0x51e7('0x53')](_0x153220[_0x51e7('0x49')]['sort']);_0x2c9a4a[_0x51e7('0x54')]=qs['filters'](_['pick'](_0x153220[_0x51e7('0x49')],_0xcbb483[_0x51e7('0x4b')]));if(_0x153220['query']['filter']){_0x2c9a4a['where']=_[_0x51e7('0x56')](_0x2c9a4a[_0x51e7('0x54')],{'$or':_['map'](_0x2c9a4a['attributes'],function(_0x14b3a5){var _0x54f923={};_0x54f923[_0x14b3a5]={'$like':'%'+_0x153220[_0x51e7('0x49')][_0x51e7('0x55')]+'%'};return _0x54f923;})});}_0x2c9a4a=_['merge']({},_0x2c9a4a,_0x153220[_0x51e7('0x57')]);return _0x476b18[_0x51e7('0xc2')](_0x2c9a4a);}})[_0x51e7('0x23')](function(_0xcf8155){if(_0xcf8155){_0x57eb8d=_0xcf8155[_0x51e7('0x4f')];if(!_0x153220[_0x51e7('0x49')][_0x51e7('0x6d')]('nolimit')){_0x2c9a4a['limit']=qs[_0x51e7('0x51')](_0x153220[_0x51e7('0x49')][_0x51e7('0x51')]);_0x2c9a4a[_0x51e7('0x52')]=qs[_0x51e7('0x52')](_0x153220[_0x51e7('0x49')][_0x51e7('0x52')]);}return _0x476b18[_0x51e7('0xc2')](_0x2c9a4a);}})[_0x51e7('0x23')](function(_0x97d727){if(_0x97d727){return _0x97d727?{'count':_0x57eb8d,'rows':_0x97d727}:null;}})[_0x51e7('0x23')](respondWithResult(_0x5d971,null))[_0x51e7('0x2e')](handleError(_0x5d971,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6c512a1..ebfbb9b 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 _0xb4f8=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x2d0015,_0xdbcdce){var _0x320b86=function(_0x262a80){while(--_0x262a80){_0x2d0015['push'](_0x2d0015['shift']());}};_0x320b86(++_0xdbcdce);}(_0xb4f8,0x83));var _0x8b4f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb4f8[_0x243b2f];return _0xcb3c2d;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x8b4f('0x0'))['db'][_0x8b4f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8b4f('0x2')](0x0);var events={'afterCreate':_0x8b4f('0x3'),'afterUpdate':_0x8b4f('0x4'),'afterDestroy':_0x8b4f('0x5')};function emitEvent(_0x544763){return function(_0x1b7400,_0x5e8c12,_0x2c145d){FaxAccountEvents[_0x8b4f('0x6')](_0x544763+':'+_0x1b7400['id'],_0x1b7400);FaxAccountEvents[_0x8b4f('0x6')](_0x544763,_0x1b7400);_0x2c145d(null);};}for(var e in events){if(events[_0x8b4f('0x7')](e)){var event=events[e];FaxAccount[_0x8b4f('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd906=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','FaxAccount'];(function(_0x5bf84b,_0x304515){var _0x39271a=function(_0xd84289){while(--_0xd84289){_0x5bf84b['push'](_0x5bf84b['shift']());}};_0x39271a(++_0x304515);}(_0xd906,0x6b));var _0x6d90=function(_0x59d94c,_0x33f979){_0x59d94c=_0x59d94c-0x0;var _0x4a6d77=_0xd906[_0x59d94c];return _0x4a6d77;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x6d90('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6d90('0x1')](0x0);var events={'afterCreate':_0x6d90('0x2'),'afterUpdate':_0x6d90('0x3'),'afterDestroy':_0x6d90('0x4')};function emitEvent(_0x4d5bbd){return function(_0x2ae140,_0x431c1e,_0x132c67){FaxAccountEvents[_0x6d90('0x5')](_0x4d5bbd+':'+_0x2ae140['id'],_0x2ae140);FaxAccountEvents['emit'](_0x4d5bbd,_0x2ae140);_0x132c67(null);};}for(var e in events){if(events[_0x6d90('0x6')](e)){var event=events[e];FaxAccount[_0x6d90('0x7')](e,emitEvent(event));}}module[_0x6d90('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 fa506e2..022c0eb 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 _0xa8ed=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','moment','path'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xa8ed,0x11f));var _0xda8e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa8ed[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xda8e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xda8e('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda8e('0x2'));var rimraf=require(_0xda8e('0x3'));var config=require(_0xda8e('0x4'));var attributes=require(_0xda8e('0x5'));module[_0xda8e('0x6')]=function(_0xcc4aee,_0x6e8961){return _0xcc4aee[_0xda8e('0x7')](_0xda8e('0x8'),attributes,{'tableName':_0xda8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x412d=['util','../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0x412d,0x74));var _0xd412=function(_0x2b6d79,_0x2d6498){_0x2b6d79=_0x2b6d79-0x0;var _0x5b16e4=_0x412d[_0x2b6d79];return _0x5b16e4;};'use strict';var _=require(_0xd412('0x0'));var util=require(_0xd412('0x1'));var logger=require(_0xd412('0x2'))(_0xd412('0x3'));var moment=require(_0xd412('0x4'));var BPromise=require(_0xd412('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd412('0x6'));var rimraf=require(_0xd412('0x7'));var config=require('../../config/environment');var attributes=require(_0xd412('0x8'));module[_0xd412('0x9')]=function(_0x4a368a,_0x1b04b0){return _0x4a368a[_0xd412('0xa')](_0xd412('0xb'),attributes,{'tableName':_0xd412('0xc'),'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 dd420b2..2b99f89 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 _0x43da=['UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','then','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','includes','find','account','CmList','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','priority','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x43da,0x1dc));var _0xa43d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x43da[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xa43d('0x0'));var util=require(_0xa43d('0x1'));var moment=require('moment');var BPromise=require(_0xa43d('0x2'));var rs=require(_0xa43d('0x3'));var fs=require('fs');var Redis=require(_0xa43d('0x4'));var db=require(_0xa43d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa43d('0x6'))('rpc');var config=require(_0xa43d('0x7'));var jayson=require(_0xa43d('0x8'));var client=jayson[_0xa43d('0x9')]['http']({'port':0x232c});config[_0xa43d('0xa')]=_[_0xa43d('0xb')](config[_0xa43d('0xa')],{'host':_0xa43d('0xc'),'port':0x18eb});var socket=require(_0xa43d('0xd'))(new Redis(config[_0xa43d('0xa')]));require(_0xa43d('0xe'))[_0xa43d('0xf')](socket);function respondWithRpcPromise(_0x209c7a,_0x1c52e4,_0x472c41){return new BPromise(function(_0xdd778d,_0x34857c){return client[_0xa43d('0x10')](_0x209c7a,_0x472c41)['then'](function(_0x26dcb1){logger[_0xa43d('0x11')](_0xa43d('0x12'),_0x1c52e4,_0xa43d('0x13'));logger[_0xa43d('0x14')](_0xa43d('0x15'),_0x1c52e4,_0xa43d('0x13'),JSON[_0xa43d('0x16')](_0x26dcb1));if(_0x26dcb1[_0xa43d('0x17')]){if(_0x26dcb1['error'][_0xa43d('0x18')]===0x1f4){logger[_0xa43d('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1c52e4,_0x26dcb1[_0xa43d('0x17')][_0xa43d('0x19')]);return _0x34857c(_0x26dcb1['error'][_0xa43d('0x19')]);}logger['error'](_0xa43d('0x12'),_0x1c52e4,_0x26dcb1[_0xa43d('0x17')][_0xa43d('0x19')]);return _0xdd778d(_0x26dcb1['error']['message']);}else{logger[_0xa43d('0x11')](_0xa43d('0x12'),_0x1c52e4,'request\x20sent');_0xdd778d(_0x26dcb1[_0xa43d('0x1a')][_0xa43d('0x19')]);}})[_0xa43d('0x1b')](function(_0x4c311d){logger[_0xa43d('0x17')](_0xa43d('0x12'),_0x1c52e4,_0x4c311d);_0x34857c(_0x4c311d);});});}exports['GetFaxAccount']=function(_0x3f29ce){var _0x229bee=this;return new Promise(function(_0x3b81b8,_0x525746){return db[_0xa43d('0x1c')][_0xa43d('0x1d')]({'raw':_0x3f29ce[_0xa43d('0x1e')]?_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3f29ce[_0xa43d('0x1e')]?_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x20')]||null:null,'attributes':_0x3f29ce[_0xa43d('0x1e')]?_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x21')]||null:null,'limit':_0x3f29ce[_0xa43d('0x1e')]?_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x22')]||null:null,'include':_0x3f29ce[_0xa43d('0x1e')]?_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x23')]?_['map'](_0x3f29ce[_0xa43d('0x1e')][_0xa43d('0x23')],function(_0x19a74e){return{'model':db[_0x19a74e[_0xa43d('0x24')]],'as':_0x19a74e['as'],'attributes':_0x19a74e[_0xa43d('0x21')],'include':_0x19a74e['include']?_[_0xa43d('0x25')](_0x19a74e['include'],function(_0x19b772){return{'model':db[_0x19b772['model']],'as':_0x19b772['as'],'attributes':_0x19b772['attributes'],'include':_0x19b772[_0xa43d('0x23')]?_[_0xa43d('0x25')](_0x19b772[_0xa43d('0x23')],function(_0x9733b5){return{'model':db[_0x9733b5[_0xa43d('0x24')]],'as':_0x9733b5['as'],'attributes':_0x9733b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eceea){logger[_0xa43d('0x11')](_0xa43d('0x26'),_0x3f29ce);logger['debug'](_0xa43d('0x26'),_0x3f29ce,JSON[_0xa43d('0x16')](_0x1eceea));_0x3b81b8(_0x1eceea);})[_0xa43d('0x1b')](function(_0x3b9f9e){logger[_0xa43d('0x17')](_0xa43d('0x26'),_0x3b9f9e['message'],_0x3f29ce);_0x525746(_0x229bee[_0xa43d('0x17')](0x1f4,_0x3b9f9e[_0xa43d('0x19')]));});});};exports[_0xa43d('0x27')]=function(_0x5c1c2a,_0x4c61a8,_0xc429c1){var _0x3496e8=this;return new Promise(function(_0x42f7ce,_0xca073d){var _0x538492={'body':_0x5c1c2a[_0xa43d('0x28')],'channel':'fax'};var _0x4f95a9=[];var _0x1ed4a8=[];var _0x3833af={};return db[_0xa43d('0x29')][_0xa43d('0x2a')]()[_0xa43d('0x2b')](function(_0x1553f0){if(!_0x1553f0){throw new db['Sequelize']['ValidationError'](_0xa43d('0x2c'));}_0x4f95a9=_[_0xa43d('0x2d')](_[_0xa43d('0x2e')](_0x1553f0),[_0xa43d('0x2f'),'updatedAt']);_0x1ed4a8=_['difference'](_['keys'](_0x1553f0),[_0xa43d('0x2f'),_0xa43d('0x30'),_0xa43d('0x31'),'ListId']);if(_0x5c1c2a[_0xa43d('0x28')]['id']){delete _0x5c1c2a[_0xa43d('0x28')]['id'];}if(_[_0xa43d('0x32')](_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x33')])){throw new db[(_0xa43d('0x34'))][(_0xa43d('0x35'))](_0xa43d('0x36'));}if(_['isNil'](_0x5c1c2a['body'][_0xa43d('0x28')])||_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x28')]===''){throw new db[(_0xa43d('0x34'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa43d('0x32')](_0x5c1c2a['body'][_0xa43d('0x37')])){throw new db[(_0xa43d('0x34'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ed4a8);}if(!_[_0xa43d('0x38')](_0x1ed4a8,_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x37')])){throw new db[(_0xa43d('0x34'))][(_0xa43d('0x35'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ed4a8);}_0x3833af[_0x5c1c2a['body'][_0xa43d('0x37')]]=_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x33')];})[_0xa43d('0x2b')](function(){return db['FaxAccount'][_0xa43d('0x39')]({'where':{'id':_0x5c1c2a[_0xa43d('0x3a')]['id']},'include':[{'model':db[_0xa43d('0x3b')],'as':_0xa43d('0x3c'),'include':[{'model':db[_0xa43d('0x29')],'as':_0xa43d('0x3d'),'where':_0x3833af,'limit':0x1,'order':[[_0xa43d('0x30'),_0xa43d('0x3e')]]}]},{'model':db[_0xa43d('0x3f')],'as':'Applications'}]});})[_0xa43d('0x2b')](function(_0x4ae64a){if(_0x4ae64a&&_0x4ae64a[_0xa43d('0x3c')]){var _0x1c16a7=_0x4ae64a[_0xa43d('0x40')]({'plain':!![]});_0x538492[_0xa43d('0x3a')]=_0x1c16a7;_0x538492[_0xa43d('0x41')]=_0x1c16a7[_0xa43d('0x42')];_0x538492[_0xa43d('0x43')]=_0x1c16a7[_0xa43d('0x3c')];_0x538492[_0xa43d('0x41')]=_['orderBy'](_0x538492[_0xa43d('0x41')],[_0xa43d('0x44')],['asc']);if(_0x538492[_0xa43d('0x3a')][_0xa43d('0x42')]){delete _0x538492[_0xa43d('0x3a')][_0xa43d('0x42')];}if(_0x538492[_0xa43d('0x3a')][_0xa43d('0x3c')]&&_0x538492['account']['List'][_0xa43d('0x3d')]['length']){return _0x538492[_0xa43d('0x3a')][_0xa43d('0x3c')][_0xa43d('0x3d')][0x0];}var _0x15e290=_[_0xa43d('0xb')](_0x5c1c2a['body'],{'firstName':_0x5c1c2a[_0xa43d('0x28')]['from'],'ListId':_0x1c16a7['ListId']});_0x15e290[_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x37')]]=_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x33')];return db[_0xa43d('0x29')][_0xa43d('0x45')](_0x15e290,{'fields':_0x4f95a9,'raw':!![]});}})[_0xa43d('0x2b')](function(_0x1bb524){_0x538492[_0xa43d('0x46')]=_0x1bb524;if(_0x1bb524){var _0x5d5fc7={'ContactId':_0x1bb524['id'],'FaxAccountId':_0x5c1c2a[_0xa43d('0x3a')]['id'],'fax':_0x1bb524[_0xa43d('0x47')]};return db[_0xa43d('0x48')]['find']({'where':{'ContactId':_0x1bb524['id'],'closed':![],'FaxAccountId':_0x5c1c2a[_0xa43d('0x3a')]['id']}})[_0xa43d('0x2b')](function(_0x2db08b){if(_0x2db08b){return[_0x2db08b,![]];}return db[_0xa43d('0x48')]['create'](_0x5d5fc7)[_0xa43d('0x2b')](function(_0x265c69){return[_0x265c69,!![]];});});}else{throw new Error(_0xa43d('0x49'));}})[_0xa43d('0x4a')](function(_0x4bbb05,_0xba4164){var _0x1398c9=_0x4bbb05[_0xa43d('0x40')]({'plain':!![]});if(_0xba4164){if(_0x538492['account'][_0xa43d('0x4b')]){_0x538492[_0xa43d('0x41')][_0xa43d('0x4c')]({'id':0x0,'priority':_0x538492['applications'][_0xa43d('0x4d')]+0x1,'app':_0xa43d('0x4e'),'appdata':_0xa43d('0x4f'),'interval':_0xa43d('0x50')});}_0x1398c9['created']=!![];}else{_0x1398c9[_0xa43d('0x51')]=![];}_0x538492[_0xa43d('0x52')]=_0x1398c9;return db[_0xa43d('0x53')][_0xa43d('0x45')]({'body':_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x28')],'FaxAccountId':_0x5c1c2a[_0xa43d('0x3a')]['id'],'FaxInteractionId':_0x4bbb05['id'],'direction':'in','ContactId':_0x4bbb05[_0xa43d('0x54')],'AttachmentId':_0x5c1c2a[_0xa43d('0x28')][_0xa43d('0x55')]});})[_0xa43d('0x2b')](function(_0x2fa36d){_0x538492[_0xa43d('0x19')]=_0x2fa36d;if(_0x538492[_0xa43d('0x52')]['UserId']){return db[_0xa43d('0x56')][_0xa43d('0x39')]({'attributes':['id',_0xa43d('0x57')],'where':{'id':_0x538492[_0xa43d('0x52')][_0xa43d('0x58')]}})['then'](function(_0x290885){if(_0x290885){_0x538492[_0xa43d('0x41')][_0xa43d('0x59')]({'id':0x0,'priority':0x0,'app':_0xa43d('0x5a'),'appdata':_0x290885[_0xa43d('0x57')]+','+(_0x538492[_0xa43d('0x3a')][_0xa43d('0x5b')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa43d('0x5c'),_0xa43d('0x5d'),_0x538492);});}return respondWithRpcPromise(_0xa43d('0x5c'),_0xa43d('0x5d'),_0x538492);})[_0xa43d('0x2b')](function(_0x339bae){_0x42f7ce(_0x339bae);})[_0xa43d('0x1b')](function(_0x28033e){_0xca073d(_0x3496e8[_0xa43d('0x17')](0x1f4,_0x28033e[_0xa43d('0x19')]));});});}; \ No newline at end of file +var _0x30d8=['rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','raw','options','attributes','limit','include','map','model','debug','stringify','catch','NotifyFaxAccount','body','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','list','priority','asc','Contacts','length','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x538785,_0x3daf79){var _0x22ec0e=function(_0x573cb8){while(--_0x573cb8){_0x538785['push'](_0x538785['shift']());}};_0x22ec0e(++_0x3daf79);}(_0x30d8,0x1bf));var _0x830d=function(_0x3bc5b0,_0xbf659a){_0x3bc5b0=_0x3bc5b0-0x0;var _0x72ec68=_0x30d8[_0x3bc5b0];return _0x72ec68;};'use strict';var _=require(_0x830d('0x0'));var util=require(_0x830d('0x1'));var moment=require(_0x830d('0x2'));var BPromise=require(_0x830d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x830d('0x4'));var db=require(_0x830d('0x5'))['db'];var utils=require(_0x830d('0x6'));var logger=require(_0x830d('0x7'))(_0x830d('0x8'));var config=require(_0x830d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x830d('0xa')]['http']({'port':0x232c});config[_0x830d('0xb')]=_[_0x830d('0xc')](config[_0x830d('0xb')],{'host':_0x830d('0xd'),'port':0x18eb});var socket=require(_0x830d('0xe'))(new Redis(config[_0x830d('0xb')]));require(_0x830d('0xf'))['register'](socket);function respondWithRpcPromise(_0x21e707,_0x188124,_0x1ac942){return new BPromise(function(_0x177138,_0x38c119){return client[_0x830d('0x10')](_0x21e707,_0x1ac942)[_0x830d('0x11')](function(_0x562979){logger[_0x830d('0x12')]('FaxAccount,\x20%s,\x20%s',_0x188124,'request\x20sent');logger['debug'](_0x830d('0x13'),_0x188124,'request\x20sent',JSON['stringify'](_0x562979));if(_0x562979['error']){if(_0x562979[_0x830d('0x14')][_0x830d('0x15')]===0x1f4){logger[_0x830d('0x14')](_0x830d('0x16'),_0x188124,_0x562979[_0x830d('0x14')][_0x830d('0x17')]);return _0x38c119(_0x562979[_0x830d('0x14')][_0x830d('0x17')]);}logger['error'](_0x830d('0x16'),_0x188124,_0x562979['error'][_0x830d('0x17')]);return _0x177138(_0x562979[_0x830d('0x14')][_0x830d('0x17')]);}else{logger[_0x830d('0x12')]('FaxAccount,\x20%s,\x20%s',_0x188124,'request\x20sent');_0x177138(_0x562979[_0x830d('0x18')][_0x830d('0x17')]);}})['catch'](function(_0x5685f8){logger['error'](_0x830d('0x16'),_0x188124,_0x5685f8);_0x38c119(_0x5685f8);});});}exports[_0x830d('0x19')]=function(_0x599af8){var _0x441f2d=this;return new Promise(function(_0x4986ee,_0x503350){return db[_0x830d('0x1a')]['findAll']({'raw':_0x599af8['options']?_0x599af8['options'][_0x830d('0x1b')]===undefined?!![]:![]:!![],'where':_0x599af8[_0x830d('0x1c')]?_0x599af8[_0x830d('0x1c')]['where']||null:null,'attributes':_0x599af8[_0x830d('0x1c')]?_0x599af8[_0x830d('0x1c')][_0x830d('0x1d')]||null:null,'limit':_0x599af8[_0x830d('0x1c')]?_0x599af8[_0x830d('0x1c')][_0x830d('0x1e')]||null:null,'include':_0x599af8[_0x830d('0x1c')]?_0x599af8[_0x830d('0x1c')][_0x830d('0x1f')]?_[_0x830d('0x20')](_0x599af8['options'][_0x830d('0x1f')],function(_0x40042a){return{'model':db[_0x40042a[_0x830d('0x21')]],'as':_0x40042a['as'],'attributes':_0x40042a[_0x830d('0x1d')],'include':_0x40042a[_0x830d('0x1f')]?_['map'](_0x40042a['include'],function(_0x1ec3ac){return{'model':db[_0x1ec3ac[_0x830d('0x21')]],'as':_0x1ec3ac['as'],'attributes':_0x1ec3ac[_0x830d('0x1d')],'include':_0x1ec3ac[_0x830d('0x1f')]?_[_0x830d('0x20')](_0x1ec3ac['include'],function(_0x28982b){return{'model':db[_0x28982b[_0x830d('0x21')]],'as':_0x28982b['as'],'attributes':_0x28982b['attributes']};}):[]};}):[]};}):[]:[]})[_0x830d('0x11')](function(_0x2ee4a4){logger[_0x830d('0x12')](_0x830d('0x19'),_0x599af8);logger[_0x830d('0x22')](_0x830d('0x19'),_0x599af8,JSON[_0x830d('0x23')](_0x2ee4a4));_0x4986ee(_0x2ee4a4);})[_0x830d('0x24')](function(_0x128bcf){logger[_0x830d('0x14')]('GetFaxAccount',_0x128bcf['message'],_0x599af8);_0x503350(_0x441f2d[_0x830d('0x14')](0x1f4,_0x128bcf[_0x830d('0x17')]));});});};exports[_0x830d('0x25')]=function(_0x4f4f21,_0x13c364,_0x27afb8){var _0x3940e8=this;return new Promise(function(_0x154ea0,_0x2e69d3){var _0x3a863e={'body':_0x4f4f21[_0x830d('0x26')],'channel':'fax'};var _0x5bed75=[];var _0x35dee4=[];var _0x10b48f={};return db[_0x830d('0x27')][_0x830d('0x28')]()[_0x830d('0x11')](function(_0x1a7b8c){if(!_0x1a7b8c){throw new db['Sequelize'][(_0x830d('0x29'))](_0x830d('0x2a'));}_0x5bed75=_[_0x830d('0x2b')](_[_0x830d('0x2c')](_0x1a7b8c),[_0x830d('0x2d'),_0x830d('0x2e')]);_0x35dee4=_['difference'](_['keys'](_0x1a7b8c),[_0x830d('0x2d'),_0x830d('0x2e'),_0x830d('0x2f'),_0x830d('0x30')]);if(_0x4f4f21[_0x830d('0x26')]['id']){delete _0x4f4f21[_0x830d('0x26')]['id'];}if(_[_0x830d('0x31')](_0x4f4f21[_0x830d('0x26')][_0x830d('0x32')])){throw new db[(_0x830d('0x33'))]['ValidationError'](_0x830d('0x34'));}if(_[_0x830d('0x31')](_0x4f4f21[_0x830d('0x26')][_0x830d('0x26')])||_0x4f4f21[_0x830d('0x26')][_0x830d('0x26')]===''){throw new db[(_0x830d('0x33'))][(_0x830d('0x29'))](_0x830d('0x35'));}if(_[_0x830d('0x31')](_0x4f4f21[_0x830d('0x26')][_0x830d('0x36')])){throw new db['Sequelize'][(_0x830d('0x29'))](_0x830d('0x37')+_0x35dee4);}if(!_[_0x830d('0x38')](_0x35dee4,_0x4f4f21[_0x830d('0x26')]['mapKey'])){throw new db[(_0x830d('0x33'))]['ValidationError'](_0x830d('0x39')+_0x35dee4);}_0x10b48f[_0x4f4f21['body']['mapKey']]=_0x4f4f21[_0x830d('0x26')][_0x830d('0x32')];})[_0x830d('0x11')](function(){return db[_0x830d('0x1a')][_0x830d('0x3a')]({'where':{'id':_0x4f4f21[_0x830d('0x3b')]['id']},'include':[{'model':db[_0x830d('0x3c')],'as':_0x830d('0x3d'),'include':[{'model':db[_0x830d('0x27')],'as':'Contacts','where':_0x10b48f,'limit':0x1,'order':[['updatedAt',_0x830d('0x3e')]]}]},{'model':db[_0x830d('0x3f')],'as':'Applications'}]});})[_0x830d('0x11')](function(_0x131137){if(_0x131137&&_0x131137[_0x830d('0x3d')]){var _0x2b826c=_0x131137[_0x830d('0x40')]({'plain':!![]});_0x3a863e[_0x830d('0x3b')]=_0x2b826c;_0x3a863e[_0x830d('0x41')]=_0x2b826c[_0x830d('0x42')];_0x3a863e[_0x830d('0x43')]=_0x2b826c[_0x830d('0x3d')];_0x3a863e['applications']=_['orderBy'](_0x3a863e[_0x830d('0x41')],[_0x830d('0x44')],[_0x830d('0x45')]);if(_0x3a863e[_0x830d('0x3b')]['Applications']){delete _0x3a863e[_0x830d('0x3b')][_0x830d('0x42')];}if(_0x3a863e[_0x830d('0x3b')][_0x830d('0x3d')]&&_0x3a863e[_0x830d('0x3b')][_0x830d('0x3d')][_0x830d('0x46')][_0x830d('0x47')]){return _0x3a863e['account'][_0x830d('0x3d')]['Contacts'][0x0];}var _0x5a9b4b=_[_0x830d('0xc')](_0x4f4f21[_0x830d('0x26')],{'firstName':_0x4f4f21[_0x830d('0x26')]['from'],'ListId':_0x2b826c[_0x830d('0x30')]});_0x5a9b4b[_0x4f4f21[_0x830d('0x26')]['mapKey']]=_0x4f4f21[_0x830d('0x26')][_0x830d('0x32')];return db['CmContact']['create'](_0x5a9b4b,{'fields':_0x5bed75,'raw':!![]});}})[_0x830d('0x11')](function(_0x126663){_0x3a863e[_0x830d('0x48')]=_0x126663;if(_0x126663){var _0x3e2322={'ContactId':_0x126663['id'],'FaxAccountId':_0x4f4f21['account']['id'],'fax':_0x126663[_0x830d('0x49')]};return db[_0x830d('0x4a')][_0x830d('0x3a')]({'where':{'ContactId':_0x126663['id'],'closed':![],'FaxAccountId':_0x4f4f21[_0x830d('0x3b')]['id']}})[_0x830d('0x11')](function(_0x27fb8b){if(_0x27fb8b){return[_0x27fb8b,![]];}return db[_0x830d('0x4a')]['create'](_0x3e2322)[_0x830d('0x11')](function(_0x2feed8){return[_0x2feed8,!![]];});});}else{throw new Error(_0x830d('0x4b'));}})[_0x830d('0x4c')](function(_0x3d42b0,_0x4d33eb){var _0x492c5d=_0x3d42b0[_0x830d('0x40')]({'plain':!![]});if(_0x4d33eb){if(_0x3a863e[_0x830d('0x3b')][_0x830d('0x4d')]){_0x3a863e[_0x830d('0x41')]['push']({'id':0x0,'priority':_0x3a863e['applications'][_0x830d('0x47')]+0x1,'app':_0x830d('0x4e'),'appdata':_0x830d('0x4f'),'interval':_0x830d('0x50')});}_0x492c5d[_0x830d('0x51')]=!![];}else{_0x492c5d['created']=![];}_0x3a863e['interaction']=_0x492c5d;return db[_0x830d('0x52')]['create']({'body':_0x4f4f21[_0x830d('0x26')][_0x830d('0x26')],'FaxAccountId':_0x4f4f21['account']['id'],'FaxInteractionId':_0x3d42b0['id'],'direction':'in','ContactId':_0x3d42b0[_0x830d('0x53')],'AttachmentId':_0x4f4f21['body']['AttachmentId']});})[_0x830d('0x11')](function(_0x2dcb73){_0x3a863e['message']=_0x2dcb73;if(_0x3a863e[_0x830d('0x54')][_0x830d('0x55')]){return db['User'][_0x830d('0x3a')]({'attributes':['id',_0x830d('0x56')],'where':{'id':_0x3a863e[_0x830d('0x54')]['UserId']}})[_0x830d('0x11')](function(_0x2ca535){if(_0x2ca535){_0x3a863e[_0x830d('0x41')][_0x830d('0x57')]({'id':0x0,'priority':0x0,'app':_0x830d('0x58'),'appdata':_0x2ca535[_0x830d('0x56')]+','+(_0x3a863e[_0x830d('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x830d('0x50')});}return respondWithRpcPromise('Start','startRouting',_0x3a863e);});}return respondWithRpcPromise(_0x830d('0x59'),_0x830d('0x5a'),_0x3a863e);})['then'](function(_0x2dfb47){_0x154ea0(_0x2dfb47);})['catch'](function(_0x256279){_0x2e69d3(_0x3940e8[_0x830d('0x14')](0x1f4,_0x256279[_0x830d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2f04161..4911e52 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 _0x5b24=['length','./faxAccount.events','save','update','register'];(function(_0x29c3a4,_0x2d0848){var _0x5d99f=function(_0x62677a){while(--_0x62677a){_0x29c3a4['push'](_0x29c3a4['shift']());}};_0x5d99f(++_0x2d0848);}(_0x5b24,0xb0));var _0x45b2=function(_0x258d6e,_0x54387b){_0x258d6e=_0x258d6e-0x0;var _0x1654f2=_0x5b24[_0x258d6e];return _0x1654f2;};'use strict';var FaxAccountEvents=require(_0x45b2('0x0'));var events=[_0x45b2('0x1'),'remove',_0x45b2('0x2')];function createListener(_0x3494ba,_0x56f1e3){return function(_0x3a1522){_0x56f1e3['emit'](_0x3494ba,_0x3a1522);};}function removeListener(_0x1161ea,_0x48045d){return function(){FaxAccountEvents['removeListener'](_0x1161ea,_0x48045d);};}exports[_0x45b2('0x3')]=function(_0x452c7d){for(var _0x118f58=0x0,_0x5bc653=events[_0x45b2('0x4')];_0x118f58<_0x5bc653;_0x118f58++){var _0x1745e8=events[_0x118f58];var _0x5f1aa4=createListener('faxAccount:'+_0x1745e8,_0x452c7d);FaxAccountEvents['on'](_0x1745e8,_0x5f1aa4);}}; \ No newline at end of file +var _0x2598=['update','emit','removeListener','register','./faxAccount.events','remove'];(function(_0x19d43e,_0x176978){var _0x5eef74=function(_0x440d3a){while(--_0x440d3a){_0x19d43e['push'](_0x19d43e['shift']());}};_0x5eef74(++_0x176978);}(_0x2598,0x1c6));var _0x8259=function(_0x3c0c9e,_0x3ecdee){_0x3c0c9e=_0x3c0c9e-0x0;var _0x5ba5fe=_0x2598[_0x3c0c9e];return _0x5ba5fe;};'use strict';var FaxAccountEvents=require(_0x8259('0x0'));var events=['save',_0x8259('0x1'),_0x8259('0x2')];function createListener(_0x281258,_0x11f49b){return function(_0x30190f){_0x11f49b[_0x8259('0x3')](_0x281258,_0x30190f);};}function removeListener(_0x12a252,_0xdcee9c){return function(){FaxAccountEvents[_0x8259('0x4')](_0x12a252,_0xdcee9c);};}exports[_0x8259('0x5')]=function(_0x22151b){for(var _0x1dac24=0x0,_0x573547=events['length'];_0x1dac24<_0x573547;_0x1dac24++){var _0xc0eeda=events[_0x1dac24];var _0x52a418=createListener('faxAccount:'+_0xc0eeda,_0x22151b);FaxAccountEvents['on'](_0xc0eeda,_0x52a418);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 249a2b4..10dbb7c 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(_0x388660,_0x1a2874){var _0x828ded=function(_0x4adb3f){while(--_0x4adb3f){_0x388660['push'](_0x388660['shift']());}};_0x828ded(++_0x1a2874);}(_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('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(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_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['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 86dfdca..b57839e 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 _0x045b=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3ca61b,_0x1f5e65){var _0x7988d1=function(_0x2d0f56){while(--_0x2d0f56){_0x3ca61b['push'](_0x3ca61b['shift']());}};_0x7988d1(++_0x1f5e65);}(_0x045b,0x17e));var _0xb045=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x045b[_0x54b283];return _0x2462b3;};'use strict';var Sequelize=require(_0xb045('0x0'));module[_0xb045('0x1')]={'priority':{'type':Sequelize[_0xb045('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb045('0x3')],'allowNull':![],'defaultValue':_0xb045('0x4')},'appdata':{'type':Sequelize[_0xb045('0x5')]()},'description':{'type':Sequelize[_0xb045('0x3')]},'interval':{'type':Sequelize[_0xb045('0x3')],'defaultValue':_0xb045('0x6')}}; \ No newline at end of file +var _0xfaa4=['TEXT','*,*,*,*','sequelize','STRING'];(function(_0x4d461c,_0x1f18f2){var _0x1413bb=function(_0x13ad3d){while(--_0x13ad3d){_0x4d461c['push'](_0x4d461c['shift']());}};_0x1413bb(++_0x1f18f2);}(_0xfaa4,0xde));var _0x4faa=function(_0x3eee67,_0x125ea6){_0x3eee67=_0x3eee67-0x0;var _0x1f30bc=_0xfaa4[_0x3eee67];return _0x1f30bc;};'use strict';var Sequelize=require(_0x4faa('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4faa('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4faa('0x2')]()},'description':{'type':Sequelize[_0x4faa('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4faa('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index b51fae5..23632e0 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 _0xe667=['Content-Range','reject','save','update','then','error','stack','name','FaxApplication','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','find','create','body','destroy','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xe667,0xb6));var _0x7e66=function(_0x4267c5,_0x315a4a){_0x4267c5=_0x4267c5-0x0;var _0x398aa6=_0xe667[_0x4267c5];return _0x398aa6;};'use strict';var emlformat=require(_0x7e66('0x0'));var rimraf=require(_0x7e66('0x1'));var zipdir=require(_0x7e66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e66('0x3'));var moment=require(_0x7e66('0x4'));var BPromise=require(_0x7e66('0x5'));var Mustache=require(_0x7e66('0x6'));var util=require('util');var path=require(_0x7e66('0x7'));var sox=require('sox');var csv=require(_0x7e66('0x8'));var ejs=require(_0x7e66('0x9'));var fs=require('fs');var fs_extra=require(_0x7e66('0xa'));var _=require('lodash');var squel=require(_0x7e66('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e66('0xc'));var deskjs=require(_0x7e66('0xd'));var toCsv=require(_0x7e66('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e66('0xe'));var authService=require(_0x7e66('0xf'));var qs=require(_0x7e66('0x10'));var as=require(_0x7e66('0x11'));var hardwareService=require(_0x7e66('0x12'));var logger=require('../../config/logger')(_0x7e66('0x13'));var utils=require(_0x7e66('0x14'));var config=require(_0x7e66('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x154702,_0xb14161){_0xb14161=_0xb14161||0xcc;return function(_0x29da11){if(_0x29da11){return _0x154702[_0x7e66('0x16')](_0xb14161);}return _0x154702[_0x7e66('0x17')](_0xb14161)[_0x7e66('0x18')]();};}function respondWithResult(_0x485f8f,_0x42f993){_0x42f993=_0x42f993||0xc8;return function(_0x48e11f){if(_0x48e11f){return _0x485f8f[_0x7e66('0x17')](_0x42f993)[_0x7e66('0x19')](_0x48e11f);}};}function respondWithFilteredResult(_0xef7804,_0x3d2124){return function(_0x4a2a35){if(_0x4a2a35){var _0x24da3f=typeof _0x3d2124['offset']===_0x7e66('0x1a')&&typeof _0x3d2124['limit']===_0x7e66('0x1a');var _0x4a2ef2=_0x4a2a35[_0x7e66('0x1b')];var _0x1ebef6=_0x24da3f?0x0:_0x3d2124[_0x7e66('0x1c')];var _0x3b6b33=_0x24da3f?_0x4a2a35[_0x7e66('0x1b')]:_0x3d2124[_0x7e66('0x1c')]+_0x3d2124[_0x7e66('0x1d')];var _0x2547f;if(_0x3b6b33>=_0x4a2ef2){_0x3b6b33=_0x4a2ef2;_0x2547f=0xc8;}else{_0x2547f=0xce;}_0xef7804[_0x7e66('0x17')](_0x2547f);return _0xef7804[_0x7e66('0x1e')](_0x7e66('0x1f'),_0x1ebef6+'-'+_0x3b6b33+'/'+_0x4a2ef2)[_0x7e66('0x19')](_0x4a2a35);}return null;};}function patchUpdates(_0x1401d4){return function(_0x15d1e0){try{jsonpatch['apply'](_0x15d1e0,_0x1401d4,!![]);}catch(_0x23b61c){return BPromise[_0x7e66('0x20')](_0x23b61c);}return _0x15d1e0[_0x7e66('0x21')]();};}function saveUpdates(_0x5e715f,_0x458cdb){return function(_0x4a9e14){if(_0x4a9e14){return _0x4a9e14[_0x7e66('0x22')](_0x5e715f)[_0x7e66('0x23')](function(_0x59ff44){return _0x59ff44;});}return null;};}function removeEntity(_0x58fb01,_0x376436){return function(_0x4fbde9){if(_0x4fbde9){return _0x4fbde9['destroy']()[_0x7e66('0x23')](function(){_0x58fb01[_0x7e66('0x17')](0xcc)[_0x7e66('0x18')]();});}};}function handleEntityNotFound(_0x4c04ac,_0x46082c){return function(_0x1160c8){if(!_0x1160c8){_0x4c04ac[_0x7e66('0x16')](0x194);}return _0x1160c8;};}function handleError(_0x1e74f7,_0x377b23){_0x377b23=_0x377b23||0x1f4;return function(_0x397ae6){logger[_0x7e66('0x24')](_0x397ae6[_0x7e66('0x25')]);if(_0x397ae6[_0x7e66('0x26')]){delete _0x397ae6[_0x7e66('0x26')];}_0x1e74f7[_0x7e66('0x17')](_0x377b23)['send'](_0x397ae6);};}exports['index']=function(_0x385ad4,_0x27bca8){var _0x5f39f8={},_0x5ae8b0={},_0x1dd279={'count':0x0,'rows':[]};var _0x347b18=_['map'](db[_0x7e66('0x27')][_0x7e66('0x28')],function(_0x5d9a44){return{'name':_0x5d9a44['fieldName'],'type':_0x5d9a44[_0x7e66('0x29')][_0x7e66('0x2a')]};});_0x5ae8b0[_0x7e66('0x2b')]=_[_0x7e66('0x2c')](_0x347b18,'name');_0x5ae8b0[_0x7e66('0x2d')]=_[_0x7e66('0x2e')](_0x385ad4['query']);_0x5ae8b0[_0x7e66('0x2f')]=_[_0x7e66('0x30')](_0x5ae8b0[_0x7e66('0x2b')],_0x5ae8b0[_0x7e66('0x2d')]);_0x5f39f8[_0x7e66('0x31')]=_['intersection'](_0x5ae8b0[_0x7e66('0x2b')],qs[_0x7e66('0x32')](_0x385ad4[_0x7e66('0x2d')][_0x7e66('0x32')]));_0x5f39f8[_0x7e66('0x31')]=_0x5f39f8[_0x7e66('0x31')][_0x7e66('0x33')]?_0x5f39f8['attributes']:_0x5ae8b0[_0x7e66('0x2b')];if(!_0x385ad4['query'][_0x7e66('0x34')](_0x7e66('0x35'))){_0x5f39f8[_0x7e66('0x1d')]=qs[_0x7e66('0x1d')](_0x385ad4[_0x7e66('0x2d')]['limit']);_0x5f39f8[_0x7e66('0x1c')]=qs[_0x7e66('0x1c')](_0x385ad4[_0x7e66('0x2d')][_0x7e66('0x1c')]);}_0x5f39f8[_0x7e66('0x36')]=qs['sort'](_0x385ad4[_0x7e66('0x2d')][_0x7e66('0x37')]);_0x5f39f8['where']=qs[_0x7e66('0x2f')](_[_0x7e66('0x38')](_0x385ad4[_0x7e66('0x2d')],_0x5ae8b0['filters']),_0x347b18);if(_0x385ad4['query'][_0x7e66('0x39')]){_0x5f39f8[_0x7e66('0x3a')]=_['merge'](_0x5f39f8[_0x7e66('0x3a')],{'$or':_['map'](_0x347b18,function(_0x4eb5fa){if(_0x4eb5fa[_0x7e66('0x29')]!==_0x7e66('0x3b')){var _0x4e6777={};_0x4e6777[_0x4eb5fa[_0x7e66('0x26')]]={'$like':'%'+_0x385ad4[_0x7e66('0x2d')][_0x7e66('0x39')]+'%'};return _0x4e6777;}})});}_0x5f39f8=_[_0x7e66('0x3c')]({},_0x5f39f8,_0x385ad4['options']);var _0x415a28={'where':_0x5f39f8[_0x7e66('0x3a')]};return db[_0x7e66('0x27')][_0x7e66('0x1b')](_0x415a28)[_0x7e66('0x23')](function(_0x3b7947){_0x1dd279[_0x7e66('0x1b')]=_0x3b7947;if(_0x385ad4[_0x7e66('0x2d')][_0x7e66('0x3d')]){_0x5f39f8[_0x7e66('0x3e')]=[{'all':!![]}];}return db[_0x7e66('0x27')][_0x7e66('0x3f')](_0x5f39f8);})[_0x7e66('0x23')](function(_0x1cf8de){_0x1dd279[_0x7e66('0x40')]=_0x1cf8de;return _0x1dd279;})['then'](respondWithFilteredResult(_0x27bca8,_0x5f39f8))[_0x7e66('0x41')](handleError(_0x27bca8,null));};exports['show']=function(_0x584b8f,_0x39968d){var _0x4c49a4={'raw':!![],'where':{'id':_0x584b8f['params']['id']}},_0x27888a={};_0x27888a[_0x7e66('0x2b')]=_[_0x7e66('0x2e')](db[_0x7e66('0x27')]['rawAttributes']);_0x27888a[_0x7e66('0x2d')]=_[_0x7e66('0x2e')](_0x584b8f[_0x7e66('0x2d')]);_0x27888a[_0x7e66('0x2f')]=_[_0x7e66('0x30')](_0x27888a[_0x7e66('0x2b')],_0x27888a['query']);_0x4c49a4[_0x7e66('0x31')]=_['intersection'](_0x27888a[_0x7e66('0x2b')],qs[_0x7e66('0x32')](_0x584b8f[_0x7e66('0x2d')]['fields']));_0x4c49a4['attributes']=_0x4c49a4['attributes'][_0x7e66('0x33')]?_0x4c49a4[_0x7e66('0x31')]:_0x27888a[_0x7e66('0x2b')];if(_0x584b8f[_0x7e66('0x2d')][_0x7e66('0x3d')]){_0x4c49a4[_0x7e66('0x3e')]=[{'all':!![]}];}_0x4c49a4=_['merge']({},_0x4c49a4,_0x584b8f['options']);return db[_0x7e66('0x27')][_0x7e66('0x42')](_0x4c49a4)[_0x7e66('0x23')](handleEntityNotFound(_0x39968d,null))['then'](respondWithResult(_0x39968d,null))[_0x7e66('0x41')](handleError(_0x39968d,null));};exports[_0x7e66('0x43')]=function(_0x50c9f4,_0xc44171){return db[_0x7e66('0x27')][_0x7e66('0x43')](_0x50c9f4[_0x7e66('0x44')],{})['then'](respondWithResult(_0xc44171,0xc9))[_0x7e66('0x41')](handleError(_0xc44171,null));};exports[_0x7e66('0x22')]=function(_0x4b0c39,_0x405eca){if(_0x4b0c39[_0x7e66('0x44')]['id']){delete _0x4b0c39[_0x7e66('0x44')]['id'];}return db[_0x7e66('0x27')][_0x7e66('0x42')]({'where':{'id':_0x4b0c39['params']['id']}})[_0x7e66('0x23')](handleEntityNotFound(_0x405eca,null))[_0x7e66('0x23')](saveUpdates(_0x4b0c39[_0x7e66('0x44')],null))[_0x7e66('0x23')](respondWithResult(_0x405eca,null))[_0x7e66('0x41')](handleError(_0x405eca,null));};exports[_0x7e66('0x45')]=function(_0x778320,_0x1a2f8a){return db['FaxApplication'][_0x7e66('0x42')]({'where':{'id':_0x778320[_0x7e66('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a2f8a,null))['then'](removeEntity(_0x1a2f8a,null))[_0x7e66('0x41')](handleError(_0x1a2f8a,null));}; \ No newline at end of file +var _0x9f47=['apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','FaxApplication','includeAll','include','catch','show','params','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9f47,0xc1));var _0x79f4=function(_0x40d4dc,_0x4dc80d){_0x40d4dc=_0x40d4dc-0x0;var _0xa78734=_0x9f47[_0x40d4dc];return _0xa78734;};'use strict';var emlformat=require(_0x79f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79f4('0x2'));var moment=require(_0x79f4('0x3'));var BPromise=require(_0x79f4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x79f4('0x5'));var csv=require(_0x79f4('0x6'));var ejs=require(_0x79f4('0x7'));var fs=require('fs');var fs_extra=require(_0x79f4('0x8'));var _=require(_0x79f4('0x9'));var squel=require(_0x79f4('0xa'));var crypto=require(_0x79f4('0xb'));var jsforce=require(_0x79f4('0xc'));var deskjs=require(_0x79f4('0xd'));var toCsv=require(_0x79f4('0x6'));var querystring=require(_0x79f4('0xe'));var Papa=require(_0x79f4('0xf'));var Redis=require(_0x79f4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x79f4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79f4('0x12'));var logger=require('../../config/logger')(_0x79f4('0x13'));var utils=require(_0x79f4('0x14'));var config=require(_0x79f4('0x15'));var licenseUtil=require(_0x79f4('0x16'));var db=require(_0x79f4('0x17'))['db'];function respondWithStatusCode(_0x475fa4,_0x8fbebf){_0x8fbebf=_0x8fbebf||0xcc;return function(_0xa8baa3){if(_0xa8baa3){return _0x475fa4['sendStatus'](_0x8fbebf);}return _0x475fa4['status'](_0x8fbebf)['end']();};}function respondWithResult(_0x456219,_0x5250ba){_0x5250ba=_0x5250ba||0xc8;return function(_0x2caf2d){if(_0x2caf2d){return _0x456219['status'](_0x5250ba)[_0x79f4('0x18')](_0x2caf2d);}};}function respondWithFilteredResult(_0x4ed6a0,_0x2284fb){return function(_0x35dc33){if(_0x35dc33){var _0x4b3d23=typeof _0x2284fb[_0x79f4('0x19')]===_0x79f4('0x1a')&&typeof _0x2284fb[_0x79f4('0x1b')]==='undefined';var _0x3941f5=_0x35dc33[_0x79f4('0x1c')];var _0x2314f7=_0x4b3d23?0x0:_0x2284fb[_0x79f4('0x19')];var _0x340859=_0x4b3d23?_0x35dc33[_0x79f4('0x1c')]:_0x2284fb[_0x79f4('0x19')]+_0x2284fb[_0x79f4('0x1b')];var _0x183e92;if(_0x340859>=_0x3941f5){_0x340859=_0x3941f5;_0x183e92=0xc8;}else{_0x183e92=0xce;}_0x4ed6a0[_0x79f4('0x1d')](_0x183e92);return _0x4ed6a0[_0x79f4('0x1e')](_0x79f4('0x1f'),_0x2314f7+'-'+_0x340859+'/'+_0x3941f5)[_0x79f4('0x18')](_0x35dc33);}return null;};}function patchUpdates(_0x819de0){return function(_0x545cc8){try{jsonpatch[_0x79f4('0x20')](_0x545cc8,_0x819de0,!![]);}catch(_0x437019){return BPromise[_0x79f4('0x21')](_0x437019);}return _0x545cc8[_0x79f4('0x22')]();};}function saveUpdates(_0xc6447f,_0x804d0){return function(_0x929c70){if(_0x929c70){return _0x929c70['update'](_0xc6447f)[_0x79f4('0x23')](function(_0x2c15d5){return _0x2c15d5;});}return null;};}function removeEntity(_0x20b9f4,_0x5ecf7f){return function(_0x5b7280){if(_0x5b7280){return _0x5b7280[_0x79f4('0x24')]()['then'](function(){_0x20b9f4[_0x79f4('0x1d')](0xcc)[_0x79f4('0x25')]();});}};}function handleEntityNotFound(_0x5a4888,_0x3d44d6){return function(_0x1d74e9){if(!_0x1d74e9){_0x5a4888[_0x79f4('0x26')](0x194);}return _0x1d74e9;};}function handleError(_0x1ce61d,_0x49454){_0x49454=_0x49454||0x1f4;return function(_0x35fbf2){logger[_0x79f4('0x27')](_0x35fbf2[_0x79f4('0x28')]);if(_0x35fbf2[_0x79f4('0x29')]){delete _0x35fbf2['name'];}_0x1ce61d[_0x79f4('0x1d')](_0x49454)[_0x79f4('0x2a')](_0x35fbf2);};}exports[_0x79f4('0x2b')]=function(_0xb4ac8b,_0x4c5c32){var _0x35172e={},_0x8d6173={},_0x4e5b93={'count':0x0,'rows':[]};var _0x5ec4ba=_[_0x79f4('0x2c')](db['FaxApplication'][_0x79f4('0x2d')],function(_0x533552){return{'name':_0x533552[_0x79f4('0x2e')],'type':_0x533552[_0x79f4('0x2f')][_0x79f4('0x30')]};});_0x8d6173[_0x79f4('0x31')]=_[_0x79f4('0x2c')](_0x5ec4ba,_0x79f4('0x29'));_0x8d6173[_0x79f4('0x32')]=_[_0x79f4('0x33')](_0xb4ac8b['query']);_0x8d6173[_0x79f4('0x34')]=_[_0x79f4('0x35')](_0x8d6173[_0x79f4('0x31')],_0x8d6173[_0x79f4('0x32')]);_0x35172e[_0x79f4('0x36')]=_[_0x79f4('0x35')](_0x8d6173[_0x79f4('0x31')],qs[_0x79f4('0x37')](_0xb4ac8b[_0x79f4('0x32')][_0x79f4('0x37')]));_0x35172e[_0x79f4('0x36')]=_0x35172e['attributes'][_0x79f4('0x38')]?_0x35172e[_0x79f4('0x36')]:_0x8d6173[_0x79f4('0x31')];if(!_0xb4ac8b['query'][_0x79f4('0x39')]('nolimit')){_0x35172e['limit']=qs[_0x79f4('0x1b')](_0xb4ac8b[_0x79f4('0x32')][_0x79f4('0x1b')]);_0x35172e['offset']=qs[_0x79f4('0x19')](_0xb4ac8b['query'][_0x79f4('0x19')]);}_0x35172e[_0x79f4('0x3a')]=qs[_0x79f4('0x3b')](_0xb4ac8b['query'][_0x79f4('0x3b')]);_0x35172e[_0x79f4('0x3c')]=qs[_0x79f4('0x34')](_['pick'](_0xb4ac8b[_0x79f4('0x32')],_0x8d6173[_0x79f4('0x34')]),_0x5ec4ba);if(_0xb4ac8b[_0x79f4('0x32')][_0x79f4('0x3d')]){_0x35172e[_0x79f4('0x3c')]=_['merge'](_0x35172e[_0x79f4('0x3c')],{'$or':_[_0x79f4('0x2c')](_0x5ec4ba,function(_0x11f897){if(_0x11f897[_0x79f4('0x2f')]!==_0x79f4('0x3e')){var _0x1a81d4={};_0x1a81d4[_0x11f897[_0x79f4('0x29')]]={'$like':'%'+_0xb4ac8b['query'][_0x79f4('0x3d')]+'%'};return _0x1a81d4;}})});}_0x35172e=_[_0x79f4('0x3f')]({},_0x35172e,_0xb4ac8b[_0x79f4('0x40')]);var _0x4a9085={'where':_0x35172e[_0x79f4('0x3c')]};return db[_0x79f4('0x41')]['count'](_0x4a9085)[_0x79f4('0x23')](function(_0x861d2b){_0x4e5b93[_0x79f4('0x1c')]=_0x861d2b;if(_0xb4ac8b[_0x79f4('0x32')][_0x79f4('0x42')]){_0x35172e[_0x79f4('0x43')]=[{'all':!![]}];}return db[_0x79f4('0x41')]['findAll'](_0x35172e);})[_0x79f4('0x23')](function(_0x10ea7b){_0x4e5b93['rows']=_0x10ea7b;return _0x4e5b93;})[_0x79f4('0x23')](respondWithFilteredResult(_0x4c5c32,_0x35172e))[_0x79f4('0x44')](handleError(_0x4c5c32,null));};exports[_0x79f4('0x45')]=function(_0xddbdb,_0x496e70){var _0x1e1e1a={'raw':!![],'where':{'id':_0xddbdb[_0x79f4('0x46')]['id']}},_0x510dc3={};_0x510dc3['model']=_['keys'](db[_0x79f4('0x41')][_0x79f4('0x2d')]);_0x510dc3[_0x79f4('0x32')]=_[_0x79f4('0x33')](_0xddbdb['query']);_0x510dc3['filters']=_[_0x79f4('0x35')](_0x510dc3[_0x79f4('0x31')],_0x510dc3[_0x79f4('0x32')]);_0x1e1e1a[_0x79f4('0x36')]=_['intersection'](_0x510dc3['model'],qs[_0x79f4('0x37')](_0xddbdb[_0x79f4('0x32')][_0x79f4('0x37')]));_0x1e1e1a[_0x79f4('0x36')]=_0x1e1e1a[_0x79f4('0x36')][_0x79f4('0x38')]?_0x1e1e1a[_0x79f4('0x36')]:_0x510dc3[_0x79f4('0x31')];if(_0xddbdb[_0x79f4('0x32')][_0x79f4('0x42')]){_0x1e1e1a[_0x79f4('0x43')]=[{'all':!![]}];}_0x1e1e1a=_['merge']({},_0x1e1e1a,_0xddbdb[_0x79f4('0x40')]);return db['FaxApplication'][_0x79f4('0x47')](_0x1e1e1a)[_0x79f4('0x23')](handleEntityNotFound(_0x496e70,null))[_0x79f4('0x23')](respondWithResult(_0x496e70,null))[_0x79f4('0x44')](handleError(_0x496e70,null));};exports['create']=function(_0x41d4ef,_0x3eae71){return db[_0x79f4('0x41')][_0x79f4('0x48')](_0x41d4ef[_0x79f4('0x49')],{})[_0x79f4('0x23')](respondWithResult(_0x3eae71,0xc9))[_0x79f4('0x44')](handleError(_0x3eae71,null));};exports[_0x79f4('0x4a')]=function(_0x1f4fdd,_0x274ee5){if(_0x1f4fdd[_0x79f4('0x49')]['id']){delete _0x1f4fdd[_0x79f4('0x49')]['id'];}return db[_0x79f4('0x41')][_0x79f4('0x47')]({'where':{'id':_0x1f4fdd[_0x79f4('0x46')]['id']}})[_0x79f4('0x23')](handleEntityNotFound(_0x274ee5,null))[_0x79f4('0x23')](saveUpdates(_0x1f4fdd[_0x79f4('0x49')],null))[_0x79f4('0x23')](respondWithResult(_0x274ee5,null))[_0x79f4('0x44')](handleError(_0x274ee5,null));};exports['destroy']=function(_0x2bd4c7,_0x5a8e3f){return db[_0x79f4('0x41')][_0x79f4('0x47')]({'where':{'id':_0x2bd4c7[_0x79f4('0x46')]['id']}})[_0x79f4('0x23')](handleEntityNotFound(_0x5a8e3f,null))[_0x79f4('0x23')](removeEntity(_0x5a8e3f,null))[_0x79f4('0x44')](handleError(_0x5a8e3f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 347ab24..200d1a5 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 _0x1506=['utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','./faxApplication.attributes','define','FaxApplication'];(function(_0x5f135f,_0x14a919){var _0x53befd=function(_0x311d1c){while(--_0x311d1c){_0x5f135f['push'](_0x5f135f['shift']());}};_0x53befd(++_0x14a919);}(_0x1506,0xf1));var _0x6150=function(_0x52cd26,_0x3652c6){_0x52cd26=_0x52cd26-0x0;var _0x329811=_0x1506[_0x52cd26];return _0x329811;};'use strict';var _=require(_0x6150('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6150('0x1'));var moment=require('moment');var BPromise=require(_0x6150('0x2'));var rp=require(_0x6150('0x3'));var fs=require('fs');var path=require(_0x6150('0x4'));var rimraf=require(_0x6150('0x5'));var config=require('../../config/environment');var attributes=require(_0x6150('0x6'));module['exports']=function(_0x144d99,_0x1112c2){return _0x144d99[_0x6150('0x7')](_0x6150('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6150('0x9')});}; \ No newline at end of file +var _0x1ff8=['request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x1a1271,_0x3056b9){var _0x592623=function(_0x315dcf){while(--_0x315dcf){_0x1a1271['push'](_0x1a1271['shift']());}};_0x592623(++_0x3056b9);}(_0x1ff8,0x136));var _0x81ff=function(_0x471b36,_0x2095a9){_0x471b36=_0x471b36-0x0;var _0x1e10c6=_0x1ff8[_0x471b36];return _0x1e10c6;};'use strict';var _=require('lodash');var util=require(_0x81ff('0x0'));var logger=require(_0x81ff('0x1'))(_0x81ff('0x2'));var moment=require(_0x81ff('0x3'));var BPromise=require(_0x81ff('0x4'));var rp=require(_0x81ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81ff('0x6'));var config=require(_0x81ff('0x7'));var attributes=require(_0x81ff('0x8'));module[_0x81ff('0x9')]=function(_0x3dc008,_0xe8e4e7){return _0x3dc008[_0x81ff('0xa')](_0x81ff('0xb'),attributes,{'tableName':_0x81ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81ff('0xd'),'collate':_0x81ff('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ef08462..c34e284 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 _0x482c=['info','UpdateFaxApplication','FaxApplication','body','options','raw','limit','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x482c,0x15a));var _0xc482=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x482c[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xc482('0x0'));var moment=require(_0xc482('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc482('0x2'));var db=require(_0xc482('0x3'))['db'];var utils=require(_0xc482('0x4'));var logger=require(_0xc482('0x5'))(_0xc482('0x6'));var config=require(_0xc482('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc482('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x527b8a,_0x14eafa,_0x578d2f){return new BPromise(function(_0x28782d,_0x53c64b){return client['request'](_0x527b8a,_0x578d2f)[_0xc482('0x9')](function(_0x43c4ed){logger['info'](_0xc482('0xa'),_0x14eafa,'request\x20sent');logger[_0xc482('0xb')](_0xc482('0xc'),_0x14eafa,_0xc482('0xd'),JSON[_0xc482('0xe')](_0x43c4ed));if(_0x43c4ed['error']){if(_0x43c4ed['error'][_0xc482('0xf')]===0x1f4){logger[_0xc482('0x10')](_0xc482('0xa'),_0x14eafa,_0x43c4ed[_0xc482('0x10')][_0xc482('0x11')]);return _0x53c64b(_0x43c4ed[_0xc482('0x10')][_0xc482('0x11')]);}logger[_0xc482('0x10')](_0xc482('0xa'),_0x14eafa,_0x43c4ed[_0xc482('0x10')][_0xc482('0x11')]);return _0x28782d(_0x43c4ed[_0xc482('0x10')][_0xc482('0x11')]);}else{logger[_0xc482('0x12')]('FaxApplication,\x20%s,\x20%s',_0x14eafa,'request\x20sent');_0x28782d(_0x43c4ed['result'][_0xc482('0x11')]);}})['catch'](function(_0xf7a34a){logger[_0xc482('0x10')](_0xc482('0xa'),_0x14eafa,_0xf7a34a);_0x53c64b(_0xf7a34a);});});}exports[_0xc482('0x13')]=function(_0x2c2a85){var _0x52f9d3=this;return new Promise(function(_0x57e704,_0x4fb9b0){return db[_0xc482('0x14')]['update'](_0x2c2a85[_0xc482('0x15')],{'raw':_0x2c2a85[_0xc482('0x16')]?_0x2c2a85[_0xc482('0x16')][_0xc482('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2a85[_0xc482('0x16')]?_0x2c2a85[_0xc482('0x16')]['where']||null:null,'attributes':_0x2c2a85['options']?_0x2c2a85[_0xc482('0x16')]['attributes']||null:null,'limit':_0x2c2a85[_0xc482('0x16')]?_0x2c2a85[_0xc482('0x16')][_0xc482('0x18')]||null:null})[_0xc482('0x9')](function(_0x2f386d){logger['info'](_0xc482('0x13'),_0x2c2a85);logger[_0xc482('0xb')](_0xc482('0x13'),_0x2c2a85,JSON[_0xc482('0xe')](_0x2f386d));_0x57e704(_0x2f386d);})[_0xc482('0x19')](function(_0x2380e7){logger[_0xc482('0x10')](_0xc482('0x13'),_0x2380e7[_0xc482('0x11')],_0x2c2a85);_0x4fb9b0(_0x52f9d3[_0xc482('0x10')](0x1f4,_0x2380e7[_0xc482('0x11')]));});});}; \ No newline at end of file +var _0x21f8=['code','message','info','result','UpdateFaxApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x552bf3,_0x13d3e7){var _0x5f5c29=function(_0x458df5){while(--_0x458df5){_0x552bf3['push'](_0x552bf3['shift']());}};_0x5f5c29(++_0x13d3e7);}(_0x21f8,0x119));var _0x821f=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x21f8[_0x3bceea];return _0x30a8d3;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var moment=require(_0x821f('0x2'));var BPromise=require(_0x821f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x821f('0x4'));var db=require(_0x821f('0x5'))['db'];var utils=require(_0x821f('0x6'));var logger=require(_0x821f('0x7'))(_0x821f('0x8'));var config=require('../../config/environment');var jayson=require(_0x821f('0x9'));var client=jayson[_0x821f('0xa')][_0x821f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x333410,_0x46372d,_0x4d5f4d){return new BPromise(function(_0x2bb352,_0x276b45){return client['request'](_0x333410,_0x4d5f4d)[_0x821f('0xc')](function(_0x2f5ab3){logger['info'](_0x821f('0xd'),_0x46372d,_0x821f('0xe'));logger[_0x821f('0xf')](_0x821f('0x10'),_0x46372d,_0x821f('0xe'),JSON[_0x821f('0x11')](_0x2f5ab3));if(_0x2f5ab3['error']){if(_0x2f5ab3[_0x821f('0x12')][_0x821f('0x13')]===0x1f4){logger[_0x821f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x46372d,_0x2f5ab3['error'][_0x821f('0x14')]);return _0x276b45(_0x2f5ab3[_0x821f('0x12')][_0x821f('0x14')]);}logger[_0x821f('0x12')](_0x821f('0xd'),_0x46372d,_0x2f5ab3[_0x821f('0x12')][_0x821f('0x14')]);return _0x2bb352(_0x2f5ab3['error'][_0x821f('0x14')]);}else{logger[_0x821f('0x15')](_0x821f('0xd'),_0x46372d,'request\x20sent');_0x2bb352(_0x2f5ab3[_0x821f('0x16')]['message']);}})['catch'](function(_0x48b503){logger[_0x821f('0x12')](_0x821f('0xd'),_0x46372d,_0x48b503);_0x276b45(_0x48b503);});});}exports[_0x821f('0x17')]=function(_0x40ee51){var _0x603abb=this;return new Promise(function(_0x572afd,_0x4a48dd){return db['FaxApplication'][_0x821f('0x18')](_0x40ee51[_0x821f('0x19')],{'raw':_0x40ee51[_0x821f('0x1a')]?_0x40ee51[_0x821f('0x1a')][_0x821f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ee51[_0x821f('0x1a')]?_0x40ee51['options']['where']||null:null,'attributes':_0x40ee51[_0x821f('0x1a')]?_0x40ee51[_0x821f('0x1a')][_0x821f('0x1c')]||null:null,'limit':_0x40ee51[_0x821f('0x1a')]?_0x40ee51[_0x821f('0x1a')][_0x821f('0x1d')]||null:null})[_0x821f('0xc')](function(_0x2fef9a){logger[_0x821f('0x15')](_0x821f('0x17'),_0x40ee51);logger[_0x821f('0xf')](_0x821f('0x17'),_0x40ee51,JSON['stringify'](_0x2fef9a));_0x572afd(_0x2fef9a);})['catch'](function(_0x51a923){logger[_0x821f('0x12')]('UpdateFaxApplication',_0x51a923[_0x821f('0x14')],_0x40ee51);_0x4a48dd(_0x603abb['error'](0x1f4,_0x51a923['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5377e59..42429f0 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 _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0xdea4f6,_0xfeb3b6){var _0x39e0be=function(_0x2e2271){while(--_0x2e2271){_0xdea4f6['push'](_0xdea4f6['shift']());}};_0x39e0be(++_0xfeb3b6);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x88620a,_0x1bc1d5){var _0x28983a=function(_0x2fef0c){while(--_0x2fef0c){_0x88620a['push'](_0x88620a['shift']());}};_0x28983a(++_0x1bc1d5);}(_0x2032,0xd9));var _0x2203=function(_0x7fa3d2,_0x2aed73){_0x7fa3d2=_0x7fa3d2-0x0;var _0x381afc=_0x2032[_0x7fa3d2];return _0x381afc;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('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 8d9ec43..fb12f24 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 _0xb997=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0xb5fc12,_0x52af9e){var _0x41063c=function(_0x425ef1){while(--_0x425ef1){_0xb5fc12['push'](_0xb5fc12['shift']());}};_0x41063c(++_0x52af9e);}(_0xb997,0xcd));var _0x7b99=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0xb997[_0x4d934b];return _0xc0338b;};'use strict';var Sequelize=require(_0x7b99('0x0'));module[_0x7b99('0x1')]={'closed':{'type':Sequelize[_0x7b99('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b99('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b99('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b99('0x4')]},'read1stAt':{'type':Sequelize[_0x7b99('0x3')]},'fax':{'type':Sequelize[_0x7b99('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7b99('0x5')]('in',_0x7b99('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7b99('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7b99('0x5')]('in',_0x7b99('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9814=['STRING','out','ENUM','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9814,0x15c));var _0x4981=function(_0x39c3d1,_0x1dbc5d){_0x39c3d1=_0x39c3d1-0x0;var _0x4a543b=_0x9814[_0x39c3d1];return _0x4a543b;};'use strict';var Sequelize=require('sequelize');module[_0x4981('0x0')]={'closed':{'type':Sequelize[_0x4981('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4981('0x2')]},'secondDisposition':{'type':Sequelize[_0x4981('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4981('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x4981('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4981('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4981('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fb2d658..753dfb2 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 _0xcead=['agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','all','show','params','intersection','includeAll','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','createWriteStream','basename','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','fullname','TagIds','Tags','forEach','push','catch','index','map','rawAttributes','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','u.id','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','body','keys','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x121b0e,_0xceebcc){var _0x51ecf0=function(_0x1816f1){while(--_0x1816f1){_0x121b0e['push'](_0x121b0e['shift']());}};_0x51ecf0(++_0xceebcc);}(_0xcead,0x11b));var _0xdcea=function(_0x19248d,_0x5c876f){_0x19248d=_0x19248d-0x0;var _0x2198ca=_0xcead[_0x19248d];return _0x2198ca;};'use strict';var emlformat=require(_0xdcea('0x0'));var rimraf=require(_0xdcea('0x1'));var zipdir=require(_0xdcea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcea('0x3'));var moment=require('moment');var BPromise=require(_0xdcea('0x4'));var Mustache=require(_0xdcea('0x5'));var util=require(_0xdcea('0x6'));var path=require(_0xdcea('0x7'));var sox=require(_0xdcea('0x8'));var csv=require('to-csv');var ejs=require(_0xdcea('0x9'));var fs=require('fs');var fs_extra=require(_0xdcea('0xa'));var _=require('lodash');var squel=require(_0xdcea('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdcea('0xc'));var toCsv=require(_0xdcea('0xd'));var querystring=require(_0xdcea('0xe'));var Papa=require('papaparse');var Redis=require(_0xdcea('0xf'));var authService=require(_0xdcea('0x10'));var qs=require(_0xdcea('0x11'));var as=require(_0xdcea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcea('0x13'))(_0xdcea('0x14'));var utils=require(_0xdcea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdcea('0x16'));var db=require(_0xdcea('0x17'))['db'];config[_0xdcea('0x18')]=_[_0xdcea('0x19')](config[_0xdcea('0x18')],{'host':_0xdcea('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcea('0x18')]));require(_0xdcea('0x1b'))['register'](socket);function respondWithStatusCode(_0x3c3853,_0x748a3e){_0x748a3e=_0x748a3e||0xcc;return function(_0x5180a1){if(_0x5180a1){return _0x3c3853[_0xdcea('0x1c')](_0x748a3e);}return _0x3c3853[_0xdcea('0x1d')](_0x748a3e)['end']();};}function respondWithResult(_0x653c1e,_0x18f251){_0x18f251=_0x18f251||0xc8;return function(_0xa1fa8a){if(_0xa1fa8a){return _0x653c1e['status'](_0x18f251)[_0xdcea('0x1e')](_0xa1fa8a);}};}function respondWithFilteredResult(_0x357310,_0x468e41){return function(_0x460e8a){if(_0x460e8a){var _0x495746=typeof _0x468e41[_0xdcea('0x1f')]===_0xdcea('0x20')&&typeof _0x468e41['limit']===_0xdcea('0x20');var _0x525ce1=_0x460e8a[_0xdcea('0x21')];var _0x3bd63a=_0x495746?0x0:_0x468e41[_0xdcea('0x1f')];var _0x717c22=_0x495746?_0x460e8a['count']:_0x468e41['offset']+_0x468e41['limit'];var _0x2c209d;if(_0x717c22>=_0x525ce1){_0x717c22=_0x525ce1;_0x2c209d=0xc8;}else{_0x2c209d=0xce;}_0x357310[_0xdcea('0x1d')](_0x2c209d);return _0x357310[_0xdcea('0x22')](_0xdcea('0x23'),_0x3bd63a+'-'+_0x717c22+'/'+_0x525ce1)[_0xdcea('0x1e')](_0x460e8a);}return null;};}function patchUpdates(_0x54dfd9){return function(_0xfda4d6){try{jsonpatch[_0xdcea('0x24')](_0xfda4d6,_0x54dfd9,!![]);}catch(_0x310340){return BPromise[_0xdcea('0x25')](_0x310340);}return _0xfda4d6[_0xdcea('0x26')]();};}function saveUpdates(_0x2bd580,_0x1dd0a9){return function(_0x3eb16a){if(_0x3eb16a){return _0x3eb16a[_0xdcea('0x27')](_0x2bd580)[_0xdcea('0x28')](function(_0x477f49){return _0x477f49;});}return null;};}function removeEntity(_0x893b8e,_0x5528ab){return function(_0x399ca0){if(_0x399ca0){return _0x399ca0[_0xdcea('0x29')]()['then'](function(){_0x893b8e['status'](0xcc)[_0xdcea('0x2a')]();});}};}function handleEntityNotFound(_0x4b32c7,_0x4d5a67){return function(_0x308763){if(!_0x308763){_0x4b32c7[_0xdcea('0x1c')](0x194);}return _0x308763;};}function handleError(_0x3e79e9,_0x4699b4){_0x4699b4=_0x4699b4||0x1f4;return function(_0x472edb){logger[_0xdcea('0x2b')](_0x472edb[_0xdcea('0x2c')]);if(_0x472edb[_0xdcea('0x2d')]){delete _0x472edb[_0xdcea('0x2d')];}_0x3e79e9['status'](_0x4699b4)['send'](_0x472edb);};}function getInteractionUsers(_0x21d842,_0x10062f){return new BPromise(function(_0x409a51,_0x456998){try{if(_0x10062f[_0x21d842['id']]){_0x21d842['Users']=_['map'](_0x10062f[_0x21d842['id']],function(_0x4b4726){return{'id':_0x4b4726['id'],'fullname':_0x4b4726[_0xdcea('0x2e')]};});}}catch(_0x1a4941){_0x456998(_0x1a4941);}_0x409a51(_0x21d842);});}function getInteractionTags(_0x3f93d0,_0x681337){return new BPromise(function(_0x4201ea,_0x41856a){try{if(_0x3f93d0[_0xdcea('0x2f')]){_0x3f93d0[_0xdcea('0x30')]=[];_0x3f93d0[_0xdcea('0x2f')]['split'](',')[_0xdcea('0x31')](function(_0x21dc7a){_0x3f93d0[_0xdcea('0x30')][_0xdcea('0x32')](_0x681337[_0x21dc7a]);});}delete _0x3f93d0[_0xdcea('0x2f')];}catch(_0x40b4cb){_0x41856a(_0x40b4cb);}_0x4201ea(_0x3f93d0);});}function updateFaxInteraction(_0x54e397,_0x190e9f,_0x14a899){return new BPromise(function(_0x3eb285,_0x58b7ea){return getInteractionUsers(_0x54e397,_0x14a899)[_0xdcea('0x28')](function(_0x5af098){return getInteractionTags(_0x5af098,_0x190e9f);})[_0xdcea('0x28')](function(_0x38abef){_0x3eb285(_0x38abef);})[_0xdcea('0x33')](function(_0x5e91c4){_0x58b7ea(_0x5e91c4);});});}exports[_0xdcea('0x34')]=function(_0x6ded3,_0x390e46){var _0x269a8e={},_0x301fdf={},_0x215b38={'count':0x0,'rows':[]};var _0x1f2e8c=_[_0xdcea('0x35')](db['FaxInteraction'][_0xdcea('0x36')],function(_0x4c8c6e){return{'name':_0x4c8c6e['fieldName'],'type':_0x4c8c6e[_0xdcea('0x37')]['key']};});_0x301fdf[_0xdcea('0x38')]=_[_0xdcea('0x35')](_0x1f2e8c,_0xdcea('0x2d'));_0x301fdf[_0xdcea('0x39')]=_['keys'](_0x6ded3[_0xdcea('0x39')]);_0x301fdf[_0xdcea('0x3a')]=_['intersection'](_0x301fdf[_0xdcea('0x38')],_0x301fdf['query']);_0x269a8e['attributes']=_['intersection'](_0x301fdf[_0xdcea('0x38')],qs['fields'](_0x6ded3[_0xdcea('0x39')][_0xdcea('0x3b')]));_0x269a8e[_0xdcea('0x3c')]=_0x269a8e['attributes'][_0xdcea('0x3d')]?_0x269a8e['attributes']:_0x301fdf[_0xdcea('0x38')];if(!_0x6ded3[_0xdcea('0x39')][_0xdcea('0x3e')](_0xdcea('0x3f'))){_0x269a8e[_0xdcea('0x40')]=qs[_0xdcea('0x40')](_0x6ded3['query']['limit']);_0x269a8e[_0xdcea('0x1f')]=qs[_0xdcea('0x1f')](_0x6ded3[_0xdcea('0x39')][_0xdcea('0x1f')]);}_0x269a8e[_0xdcea('0x41')]=qs[_0xdcea('0x42')](_0x6ded3[_0xdcea('0x39')][_0xdcea('0x42')]);_0x269a8e[_0xdcea('0x43')]=qs[_0xdcea('0x3a')](_[_0xdcea('0x44')](_0x6ded3['query'],_0x301fdf[_0xdcea('0x3a')]),_0x1f2e8c);var _0x9ff7b0=[];var _0x49f6ac=squel[_0xdcea('0x45')]()['field']('id')[_0xdcea('0x46')](_0xdcea('0x2d'))[_0xdcea('0x46')](_0xdcea('0x47'))[_0xdcea('0x48')]('tools_tags');var _0x3bf0c4=squel[_0xdcea('0x45')]()[_0xdcea('0x46')](_0xdcea('0x49'))[_0xdcea('0x46')]('u.fullname')[_0xdcea('0x46')]('ui.FaxInteractionId')[_0xdcea('0x48')](_0xdcea('0x4a'),'ui')[_0xdcea('0x4b')](_0xdcea('0x4c'),'u',_0xdcea('0x4d'));var _0x1c9c99=squel['select']()['from'](_0xdcea('0x4e'),'i')[_0xdcea('0x4b')](_0xdcea('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xdcea('0x4b')](_0xdcea('0x4c'),'o',_0xdcea('0x50'))['left_join'](_0xdcea('0x51'),'a','a.id\x20=\x20i.FaxAccountId')[_0xdcea('0x4b')](_0xdcea('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xdcea('0x4b')](_0xdcea('0x53'),'it',_0xdcea('0x54'))[_0xdcea('0x4b')]('tools_tags','t',_0xdcea('0x55'));var _0x19e9d7=squel[_0xdcea('0x56')]();var _0x5d4fc8=[];var _0x3583fa=squel[_0xdcea('0x56')]();var _0x5e2246;if(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x57')]){_0x5e2246=as['parseSearch'](_0x6ded3[_0xdcea('0x39')][_0xdcea('0x57')]);var _0xe6457=_0x5e2246[_0xdcea('0x58')];for(var _0x204374=0x0;_0x204374<_0x5e2246[_0xdcea('0x59')][_0xdcea('0x3d')];_0x204374++){var _0x2a5429=_0x5e2246[_0xdcea('0x59')][_0x204374];var _0x2b20f9='i';var _0x5ced57=_[_0xdcea('0x5a')](_0x1f2e8c,[_0xdcea('0x2d'),_0x2a5429['field']]);if(!_0x5ced57){switch(_0x2a5429[_0xdcea('0x46')]){case _0xdcea('0x5b'):if(_0x2a5429[_0xdcea('0x5c')]==0x1){_0x1c9c99[_0xdcea('0x5d')]('`'+_0x2a5429[_0xdcea('0x46')]+_0xdcea('0x5e'));}else{_0x1c9c99[_0xdcea('0x5d')]('`'+_0x2a5429[_0xdcea('0x46')]+_0xdcea('0x5f'));}break;case _0xdcea('0x60'):if(_0x2a5429[_0xdcea('0x61')]===_0xdcea('0x62')){if(_0x2a5429['value'][_0xdcea('0x63')]('\x20')[_0xdcea('0x3d')]>0x1){_0x19e9d7[_0xe6457](_0xdcea('0x64'),qs[_0xdcea('0x65')](_0x2a5429[_0xdcea('0x5c')]),null);}else{var _0x46c15a='%'+_0x2a5429[_0xdcea('0x5c')]+'%';_0x19e9d7[_0xe6457](_0xdcea('0x66'),_0x46c15a,_0x46c15a,_0x46c15a);}}else{_0x5ced57=_[_0xdcea('0x5a')](_0x1f2e8c,[_0xdcea('0x2d'),'ContactId']);_0x2a5429[_0xdcea('0x46')]=_0xdcea('0x67');_0x38f875=as[_0xdcea('0x68')](_0x2b20f9,_0x5ced57['type'],_0x2a5429);_0x19e9d7[_0xe6457](_0x38f875['text'],_0x38f875[_0xdcea('0x5c')][_0xdcea('0x69')],_0x38f875[_0xdcea('0x5c')]['end']);}break;case _0xdcea('0x6a'):var _0x3d24d8=_0x2a5429[_0xdcea('0x5c')][_0xdcea('0x63')](',')[_0xdcea('0x35')](function(_0x562b39){return Number(_0x562b39);});_0x3d24d8['forEach'](function(_0x22a6b9){_0x3583fa['or'](_0xdcea('0x6b'),'%,'+_0x22a6b9+',%');});_0x5d4fc8=_[_0xdcea('0x6c')](_0x5d4fc8,_0x3d24d8);break;case _0xdcea('0x6d'):if(_0x2a5429[_0xdcea('0x61')]===_0xdcea('0x62')){_0x19e9d7[_0xe6457](_0xdcea('0x6e'),'%'+_0x2a5429[_0xdcea('0x5c')]+'%',null);}else{_0x5ced57=_[_0xdcea('0x5a')](_0x1f2e8c,[_0xdcea('0x2d'),_0xdcea('0x6f')]);_0x2a5429[_0xdcea('0x46')]=_0xdcea('0x6f');_0x38f875=as[_0xdcea('0x68')](_0x2b20f9,_0x5ced57[_0xdcea('0x37')],_0x2a5429);_0x19e9d7[_0xe6457](_0x38f875[_0xdcea('0x70')],_0x38f875[_0xdcea('0x5c')][_0xdcea('0x69')],_0x38f875[_0xdcea('0x5c')][_0xdcea('0x2a')]);}break;case _0xdcea('0x71'):_0x38f875=as[_0xdcea('0x68')]('me',null,_0x2a5429);_0x19e9d7[_0xe6457](_0x38f875['text'],_0x38f875[_0xdcea('0x5c')]['start'],_0x38f875[_0xdcea('0x5c')][_0xdcea('0x2a')]);break;}}else{var _0x38f875=as['buildExpression'](_0x2b20f9,_0x5ced57['type'],_0x2a5429);_0x19e9d7[_0xe6457](_0x38f875[_0xdcea('0x70')],_0x38f875['value']['start'],_0x38f875[_0xdcea('0x5c')][_0xdcea('0x2a')]);}}}else{var _0x4e86f3=_(_0x6ded3[_0xdcea('0x39')])[_0xdcea('0x72')]()[_0xdcea('0x35')](function(_0x2d3655){return _[_0xdcea('0x73')](_0x1f2e8c,['name',_0x2d3655])?_0x2d3655:undefined;})['compact']()[_0xdcea('0x5c')]();if(!_[_0xdcea('0x74')](_0x4e86f3)){_0x4e86f3[_0xdcea('0x31')](function(_0x2738b4){if(_0x2738b4===_0xdcea('0x75')){_0x1c9c99[_0xdcea('0x43')](_0xdcea('0x76'),[]['concat'](_0x6ded3['query'][_0x2738b4]));}else if(_0x2738b4===_0xdcea('0x77')){var _0xda1a3b=JSON[_0xdcea('0x78')](_0x6ded3[_0xdcea('0x39')][_0x2738b4])['$gte'];var _0x69ee41=JSON['parse'](_0x6ded3[_0xdcea('0x39')][_0x2738b4])[_0xdcea('0x79')];_0x1c9c99['where'](_0xdcea('0x7a'),_0xda1a3b,_0x69ee41);}else{if(_0x6ded3[_0xdcea('0x39')][_0x2738b4]===_0xdcea('0x7b')){_0x1c9c99[_0xdcea('0x43')]('i.'+_0x2738b4+'\x20IS\x20NULL');}else{_0x1c9c99[_0xdcea('0x43')]('i.'+_0x2738b4+_0xdcea('0x7c'),_0x6ded3[_0xdcea('0x39')][_0x2738b4]);}}});}if(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x7d')]){if(_0x6ded3[_0xdcea('0x39')]['read']==0x1){_0x1c9c99[_0xdcea('0x5d')](_0xdcea('0x7e'));}else{_0x1c9c99[_0xdcea('0x5d')](_0xdcea('0x7f'));}}if(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x80')]){_0x5d4fc8=_['isArray'](_0x6ded3[_0xdcea('0x39')]['tag'])?_0x6ded3[_0xdcea('0x39')][_0xdcea('0x80')]:new Array(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x80')]);_0x5d4fc8[_0xdcea('0x31')](function(_0x4100f2){_0x3583fa['or'](_0xdcea('0x6b'),'%,'+_0x4100f2+',%');});}if(_0x6ded3[_0xdcea('0x39')]['filter']){var _0x24085b=_0x6ded3['query'][_0xdcea('0x81')][_0xdcea('0x82')]('\x5c','\x5c\x5c')[_0xdcea('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x24085b)){_0x19e9d7['or'](_0xdcea('0x83'),_0x24085b+'%')['or'](_0xdcea('0x84'),_0x24085b+'%');}_0x19e9d7['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x24085b+'%');}}_0x1c9c99['where'](_0x19e9d7);_0x1c9c99[_0xdcea('0x85')](_0xdcea('0x86'));var _0x321eec={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x1fe2c0=_0x1c9c99[_0xdcea('0x87')]();_0x1fe2c0[_0xdcea('0x46')]('i.id');_0x1fe2c0[_0xdcea('0x46')](_0xdcea('0x88'),_0xdcea('0x5b'));if(_0x269a8e[_0xdcea('0x41')]){_0x269a8e['order'][_0xdcea('0x31')](function(_0x66a0c9){var _0x52f0c5=_0x66a0c9[0x0]===_0xdcea('0x89')?_0x66a0c9[0x0]:'i.'+_0x66a0c9[0x0];_0x1c9c99[_0xdcea('0x41')](_0x52f0c5,_0x66a0c9[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5d4fc8)){_0x1c9c99['having'](_0x3583fa);_0x1fe2c0[_0xdcea('0x43')](_0xdcea('0x8a'),_0x5d4fc8);}BPromise[_0xdcea('0x8b')]()[_0xdcea('0x28')](function(){if(!_0x5e2246){if(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x75')])return;_0x1fe2c0[_0xdcea('0x43')](_0xdcea('0x8c'));_0x1c9c99[_0xdcea('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x6ded3[_0xdcea('0x8d')][_0xdcea('0x8e')]!==_0xdcea('0x8f'))return;return _0x6ded3['user'][_0xdcea('0x90')]({'attributes':['id'],'raw':!![]})[_0xdcea('0x28')](function(_0x380006){if(_[_0xdcea('0x74')](_0x380006)){_0x1fe2c0[_0xdcea('0x43')]('i.FaxAccountId\x20IS\x20NULL');_0x1c9c99[_0xdcea('0x43')](_0xdcea('0x91'));}else{_0x1fe2c0[_0xdcea('0x43')](_0xdcea('0x76'),_[_0xdcea('0x35')](_0x380006,'id'));_0x1c9c99['where'](_0xdcea('0x76'),_[_0xdcea('0x35')](_0x380006,'id'));}});})[_0xdcea('0x28')](function(){if(_0x6ded3[_0xdcea('0x8d')][_0xdcea('0x8e')]==='agent'&&!_0x5e2246&&!_0x6ded3[_0xdcea('0x39')][_0xdcea('0x75')])return[];return db['sequelize']['query'](_0x1fe2c0[_0xdcea('0x92')](),_0x321eec);})[_0xdcea('0x28')](function(_0x290e57){_0x215b38[_0xdcea('0x21')]=_0x290e57[_0xdcea('0x3d')];if(_0x215b38['count']===0x0)return[];return db['sequelize'][_0xdcea('0x39')](_0x49f6ac['toString'](),_0x321eec)['then'](function(_0x34497f){_0x9ff7b0=_[_0xdcea('0x93')](_0x34497f,'id');_0x321eec=_[_0xdcea('0x94')](_0x321eec,{'model':db[_0xdcea('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6ded3[_0xdcea('0x39')][_0xdcea('0x3b')]){_0x269a8e[_0xdcea('0x3c')]['forEach'](function(_0x2cb63b){_0x1c9c99[_0xdcea('0x46')]('i.'+_0x2cb63b);});}else{_0x1c9c99['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdcea('0x5b'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0x96'),_0xdcea('0x97'));_0x1c9c99['field'](_0xdcea('0x98'),_0xdcea('0x99'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0x9a'),'contactName');_0x1c9c99[_0xdcea('0x46')](_0xdcea('0x9b'));_0x1c9c99['field'](_0xdcea('0x9c'),_0xdcea('0x9d'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0x9e'),_0xdcea('0x9f'));_0x1c9c99[_0xdcea('0x46')]('c.email',_0xdcea('0xa0'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0xa1'),_0xdcea('0xa2'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0xa3'),_0xdcea('0xa4'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0xa5'),_0xdcea('0xa6'));_0x1c9c99['field'](_0xdcea('0xa7'),_0xdcea('0xa8'));_0x1c9c99[_0xdcea('0x46')](_0xdcea('0xa9'),_0xdcea('0xaa'));_0x1c9c99[_0xdcea('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x269a8e[_0xdcea('0x40')])_0x1c9c99['limit'](_0x269a8e['limit']);if(_0x269a8e[_0xdcea('0x1f')])_0x1c9c99[_0xdcea('0x1f')](_0x269a8e[_0xdcea('0x1f')]);return db['sequelize'][_0xdcea('0x39')](_0x1c9c99[_0xdcea('0x92')](),_0x321eec);})[_0xdcea('0x28')](function(_0x3de592){if(_0x3de592[_0xdcea('0x3d')]>0x0)_0x3bf0c4['where'](_0xdcea('0xab'),_[_0xdcea('0x35')](_0x3de592,'id'));return db['sequelize'][_0xdcea('0x39')](_0x3bf0c4[_0xdcea('0x92')](),_0x321eec)[_0xdcea('0x28')](function(_0x502cee){var _0x5ad8d3=_['groupBy'](_0x502cee,'FaxInteractionId');var _0x35056c=[];_0x3de592[_0xdcea('0x31')](function(_0x40ea2d){_0x35056c[_0xdcea('0x32')](updateFaxInteraction(_0x40ea2d,_0x9ff7b0,_0x5ad8d3));});return BPromise[_0xdcea('0xac')](_0x35056c);});});})[_0xdcea('0x28')](function(_0x43b57c){_0x215b38['rows']=_0x43b57c;return _0x215b38;})['then'](respondWithFilteredResult(_0x390e46,_0x269a8e))[_0xdcea('0x33')](handleError(_0x390e46,null));};exports[_0xdcea('0xad')]=function(_0x5a5c07,_0x1699bf){var _0x52fcc1={'raw':![],'where':{'id':_0x5a5c07[_0xdcea('0xae')]['id']}},_0x420798={};_0x420798[_0xdcea('0x38')]=_[_0xdcea('0x72')](db[_0xdcea('0x95')]['rawAttributes']);_0x420798[_0xdcea('0x39')]=_['keys'](_0x5a5c07[_0xdcea('0x39')]);_0x420798['filters']=_['intersection'](_0x420798['model'],_0x420798[_0xdcea('0x39')]);_0x52fcc1[_0xdcea('0x3c')]=_[_0xdcea('0xaf')](_0x420798[_0xdcea('0x38')],qs[_0xdcea('0x3b')](_0x5a5c07[_0xdcea('0x39')][_0xdcea('0x3b')]));_0x52fcc1[_0xdcea('0x3c')]=_0x52fcc1[_0xdcea('0x3c')]['length']?_0x52fcc1[_0xdcea('0x3c')]:_0x420798[_0xdcea('0x38')];if(_0x5a5c07[_0xdcea('0x39')][_0xdcea('0xb0')]){_0x52fcc1['include']=[{'all':!![]}];}_0x52fcc1=_['merge']({},_0x52fcc1,_0x5a5c07[_0xdcea('0xb1')]);return db[_0xdcea('0x95')][_0xdcea('0x5a')](_0x52fcc1)[_0xdcea('0x28')](handleEntityNotFound(_0x1699bf,null))[_0xdcea('0x28')](respondWithResult(_0x1699bf,null))['catch'](handleError(_0x1699bf,null));};exports[_0xdcea('0xb2')]=function(_0x5938bd,_0x5764a6){return db['FaxInteraction']['create'](_0x5938bd[_0xdcea('0x71')],{})[_0xdcea('0x28')](respondWithResult(_0x5764a6,0xc9))[_0xdcea('0x33')](handleError(_0x5764a6,null));};exports[_0xdcea('0x27')]=function(_0x4d7b13,_0x53c355){if(_0x4d7b13[_0xdcea('0x71')]['id']){delete _0x4d7b13[_0xdcea('0x71')]['id'];}return db[_0xdcea('0x95')]['find']({'where':{'id':_0x4d7b13[_0xdcea('0xae')]['id']}})['then'](handleEntityNotFound(_0x53c355,null))[_0xdcea('0x28')](saveUpdates(_0x4d7b13['body'],null))[_0xdcea('0x28')](respondWithResult(_0x53c355,null))[_0xdcea('0x33')](handleError(_0x53c355,null));};exports[_0xdcea('0x29')]=function(_0x51908b,_0x3ca97f){return db[_0xdcea('0x95')]['find']({'where':{'id':_0x51908b[_0xdcea('0xae')]['id']}})['then'](handleEntityNotFound(_0x3ca97f,null))[_0xdcea('0x28')](removeEntity(_0x3ca97f,null))[_0xdcea('0x33')](handleError(_0x3ca97f,null));};exports['describe']=function(_0x3596a0,_0x49eaa7){return db[_0xdcea('0x95')][_0xdcea('0xb3')]()[_0xdcea('0x28')](respondWithResult(_0x49eaa7,null))[_0xdcea('0x33')](handleError(_0x49eaa7,null));};exports[_0xdcea('0xb4')]=function(_0x162d16,_0x20087d,_0x31aaa6){return db[_0xdcea('0xb5')][_0xdcea('0x5a')]({'where':{'id':_0x162d16['params']['id']}})[_0xdcea('0x28')](handleEntityNotFound(_0x20087d,null))[_0xdcea('0x28')](function(_0x3ceb12){if(_0x3ceb12){return _0x3ceb12[_0xdcea('0xb4')](_0x162d16['body'][_0xdcea('0xb6')],_[_0xdcea('0xb7')](_0x162d16[_0xdcea('0x71')],[_0xdcea('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x20087d,null))[_0xdcea('0x33')](handleError(_0x20087d,null));};exports[_0xdcea('0xb8')]=function(_0x480a76,_0x1f8e69,_0x5ad327){var _0x41af7c={'raw':![],'where':{}};var _0x281dca={};var _0x440b72={'count':0x0,'rows':[]};return db[_0xdcea('0x95')][_0xdcea('0xb9')]({'where':{'id':_0x480a76['params']['id']}})[_0xdcea('0x28')](handleEntityNotFound(_0x1f8e69,null))['then'](function(_0x58e483){if(_0x58e483){_0x281dca[_0xdcea('0x38')]=_[_0xdcea('0x72')](db['FaxMessage'][_0xdcea('0x36')]);_0x281dca[_0xdcea('0x39')]=_['keys'](_0x480a76['query']);_0x281dca[_0xdcea('0x3a')]=_[_0xdcea('0xaf')](_0x281dca[_0xdcea('0x38')],_0x281dca['query']);_0x41af7c[_0xdcea('0x3c')]=_['intersection'](_0x281dca['model'],qs['fields'](_0x480a76[_0xdcea('0x39')][_0xdcea('0x3b')]));_0x41af7c[_0xdcea('0x3c')]=_0x41af7c[_0xdcea('0x3c')]['length']?_0x41af7c['attributes']:_0x281dca[_0xdcea('0x38')];if(!_0x480a76[_0xdcea('0x39')][_0xdcea('0x3e')](_0xdcea('0x3f'))){_0x41af7c[_0xdcea('0x40')]=qs[_0xdcea('0x40')](_0x480a76[_0xdcea('0x39')]['limit']);_0x41af7c['offset']=qs[_0xdcea('0x1f')](_0x480a76[_0xdcea('0x39')][_0xdcea('0x1f')]);}_0x41af7c[_0xdcea('0x41')]=qs[_0xdcea('0x42')](_0x480a76[_0xdcea('0x39')]['sort']);_0x41af7c[_0xdcea('0x43')]=qs[_0xdcea('0x3a')](_[_0xdcea('0x44')](_0x480a76['query'],_0x281dca[_0xdcea('0x3a')]));_0x41af7c[_0xdcea('0x43')]['FaxInteractionId']=_0x58e483['id'];if(_0x480a76[_0xdcea('0x39')][_0xdcea('0x81')]){_0x41af7c[_0xdcea('0x43')]=_[_0xdcea('0x94')](_0x41af7c['where'],{'$or':_[_0xdcea('0x35')](_0x41af7c[_0xdcea('0x3c')],function(_0x57fddf){var _0x886bc7={};_0x886bc7[_0x57fddf]={'$like':'%'+_0x480a76['query'][_0xdcea('0x81')]+'%'};return _0x886bc7;})});}if(_0x480a76[_0xdcea('0x39')][_0xdcea('0xba')]){var _0x2f918d=_0x480a76[_0xdcea('0x39')][_0xdcea('0xba')]['split'](',');var _0x4c5db5={};_0x4c5db5[_0x2f918d[0x0]]={'$gte':moment(_0x2f918d[0x1])[_0xdcea('0xbb')](_0xdcea('0xbc'))};_0x41af7c[_0xdcea('0x43')]=_[_0xdcea('0x94')](_0x41af7c['where'],_0x4c5db5);}_0x41af7c=_['merge']({},_0x41af7c,_0x480a76[_0xdcea('0xb1')]);return db[_0xdcea('0xb5')]['count']({'where':_0x41af7c['where']})[_0xdcea('0x28')](function(_0x2b003a){_0x440b72[_0xdcea('0x21')]=_0x2b003a;if(_0x480a76['query'][_0xdcea('0xb0')]){_0x41af7c[_0xdcea('0xbd')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x41af7c);})['then'](function(_0x500c57){_0x440b72['rows']=_0x500c57;return _0x440b72;});}})[_0xdcea('0x28')](respondWithFilteredResult(_0x1f8e69,_0x41af7c))[_0xdcea('0x33')](handleError(_0x1f8e69,null));};exports[_0xdcea('0xbe')]=function(_0x1fc7bd,_0x3d084a,_0x46f0ba){return db[_0xdcea('0x95')][_0xdcea('0x5a')]({'where':{'id':_0x1fc7bd[_0xdcea('0xae')]['id']}})[_0xdcea('0x28')](handleEntityNotFound(_0x3d084a,null))[_0xdcea('0x28')](function(_0x359499){if(_0x359499){return _0x359499['setTags'](_0x1fc7bd['body'][_0xdcea('0xb6')],_['omit'](_0x1fc7bd[_0xdcea('0x71')],['ids','id'])||{})[_0xdcea('0xbf')](function(){return db[_0xdcea('0x6a')]['findAll']({'attributes':['id',_0xdcea('0x2d'),_0xdcea('0x47')],'where':{'id':_0x1fc7bd[_0xdcea('0x71')][_0xdcea('0xb6')]}});})[_0xdcea('0x28')](function(_0x26e341){socket[_0xdcea('0xc0')](_0xdcea('0xc1'),{'id':Number(_0x1fc7bd[_0xdcea('0xae')]['id']),'tags':_0x26e341||[]});return{'id':Number(_0x1fc7bd[_0xdcea('0xae')]['id']),'tags':_0x26e341||[]};});}})['then'](respondWithResult(_0x3d084a,null))[_0xdcea('0x33')](handleError(_0x3d084a,null));};exports[_0xdcea('0xc2')]=function(_0x4f299d,_0x4ba1bb,_0x57e3e2){return db[_0xdcea('0x95')][_0xdcea('0x5a')]({'where':{'id':_0x4f299d['params']['id']}})[_0xdcea('0x28')](handleEntityNotFound(_0x4ba1bb,null))[_0xdcea('0x28')](function(_0x47b856){if(_0x47b856){return _0x47b856[_0xdcea('0xc2')](_0x4f299d[_0xdcea('0x39')][_0xdcea('0xb6')]);}})['then'](respondWithStatusCode(_0x4ba1bb,null))['catch'](handleError(_0x4ba1bb,null));};exports[_0xdcea('0xc3')]=function(_0x5baacd,_0x24f029){var _0x245f7c=moment()[_0xdcea('0xc4')]()[_0xdcea('0x92')]();var _0x3a12ed=path[_0xdcea('0xc5')](config['root'],_0xdcea('0xc6'),_0xdcea('0xc7'),_0xdcea('0xc8'));var _0x4ca421=path[_0xdcea('0xc5')](config[_0xdcea('0xc9')],_0xdcea('0xc6'),_0xdcea('0xc7'),_0xdcea('0xca'));var _0x5e9763=path['join'](_0x3a12ed,_0x245f7c);var _0x2e2b0d=util[_0xdcea('0xbb')](_0xdcea('0xcb'),_0x5baacd[_0xdcea('0xae')]['id'],_0x245f7c);var _0x407057=path[_0xdcea('0xc5')](_0x3a12ed,_0x2e2b0d);var _0x5828db=[];_0x5828db[_0xdcea('0x32')]({'model':db[_0xdcea('0xcc')],'as':_0xdcea('0xcc'),'raw':!![]});var _0x2ac161=[{'model':db[_0xdcea('0xb5')],'as':_0xdcea('0xcd'),'attributes':['id',_0xdcea('0x71'),_0xdcea('0x77')],'include':_0x5828db}];return db[_0xdcea('0x95')][_0xdcea('0x5a')]({'where':{'id':_0x5baacd[_0xdcea('0xae')]['id']},'include':_0x2ac161})['then'](handleEntityNotFound(_0x24f029,null))[_0xdcea('0x28')](function(_0x15f2db){if(_0x15f2db&&_0x15f2db['Messages']){var _0x27a2f0=_0x15f2db[_0xdcea('0xce')]({'plain':!![]});fs['mkdirSync'](_0x5e9763);for(var _0x47bedf=0x0;_0x47bedf<_0x27a2f0[_0xdcea('0xcd')][_0xdcea('0x3d')];_0x47bedf++){var _0x259baa=_0x27a2f0[_0xdcea('0xcd')][_0x47bedf][_0xdcea('0xcc')];if(_0x259baa){var _0x10f5eb=path['join'](_0x4ca421,_0x259baa['basename']);if(fs[_0xdcea('0xcf')](_0x10f5eb)){fs[_0xdcea('0xd0')](_0x10f5eb)['pipe'](fs[_0xdcea('0xd1')](path['join'](_0x5e9763,_0x259baa[_0xdcea('0xd2')])));}}}return BPromise['resolve']()[_0xdcea('0x28')](function(){return new BPromise(function(_0x3412cf,_0x543e59){zipdir(_0x5e9763,{'saveTo':_0x407057},function(_0x3be35b,_0xb74b34){if(_0x3be35b)return _0x543e59(_0x3be35b);return _0x3412cf(_0xb74b34);});})[_0xdcea('0x28')](function(){return new BPromise(function(_0x280553,_0x4e116a){rimraf(_0x5e9763,function(_0x84e9ea){if(_0x84e9ea)_0x4e116a(_0x84e9ea);return _0x280553();});});})[_0xdcea('0x28')](function(){return _0x24f029[_0xdcea('0xc3')](_0x407057,_0x2e2b0d,function(_0x2ec0e3){if(_0x2ec0e3){console['log'](_0xdcea('0xd3'),_0x2ec0e3);}else{fs[_0xdcea('0xd4')](_0x407057);}});});});}else{return _0x24f029['sendStatus'](0xc8);}})[_0xdcea('0x33')](handleError(_0x24f029,null));}; \ No newline at end of file +var _0x9f38=['c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','rows','show','params','includeAll','include','options','create','body','describe','addMessage','FaxMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','fast-json-patch','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/utils','../../config/environment','../../config/license/util','redis','localhost','./faxInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','cm_contacts','fax_accounts','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','`\x20=\x200','having','`\x20>\x200','operator','$substring','value','getFullTextValue','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x9f38,0x1c7));var _0x89f3=function(_0x554306,_0x2ac2f2){_0x554306=_0x554306-0x0;var _0x38c807=_0x9f38[_0x554306];return _0x38c807;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x89f3('0x0'));var rp=require('request-promise');var moment=require(_0x89f3('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x89f3('0x2'));var util=require(_0x89f3('0x3'));var path=require(_0x89f3('0x4'));var sox=require(_0x89f3('0x5'));var csv=require(_0x89f3('0x6'));var ejs=require(_0x89f3('0x7'));var fs=require('fs');var fs_extra=require(_0x89f3('0x8'));var _=require('lodash');var squel=require(_0x89f3('0x9'));var crypto=require(_0x89f3('0xa'));var jsforce=require(_0x89f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x89f3('0x6'));var querystring=require(_0x89f3('0xc'));var Papa=require(_0x89f3('0xd'));var Redis=require(_0x89f3('0xe'));var authService=require(_0x89f3('0xf'));var qs=require(_0x89f3('0x10'));var as=require(_0x89f3('0x11'));var hardwareService=require(_0x89f3('0x12'));var logger=require(_0x89f3('0x13'))(_0x89f3('0x14'));var utils=require(_0x89f3('0x15'));var config=require(_0x89f3('0x16'));var licenseUtil=require(_0x89f3('0x17'));var db=require('../../mysqldb')['db'];config[_0x89f3('0x18')]=_['defaults'](config[_0x89f3('0x18')],{'host':_0x89f3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89f3('0x18')]));require(_0x89f3('0x1a'))[_0x89f3('0x1b')](socket);function respondWithStatusCode(_0x236668,_0x46316e){_0x46316e=_0x46316e||0xcc;return function(_0xaf31c9){if(_0xaf31c9){return _0x236668['sendStatus'](_0x46316e);}return _0x236668[_0x89f3('0x1c')](_0x46316e)[_0x89f3('0x1d')]();};}function respondWithResult(_0x42df6c,_0x39415c){_0x39415c=_0x39415c||0xc8;return function(_0xf25bd0){if(_0xf25bd0){return _0x42df6c['status'](_0x39415c)[_0x89f3('0x1e')](_0xf25bd0);}};}function respondWithFilteredResult(_0x3638de,_0x1c3746){return function(_0xe0d57){if(_0xe0d57){var _0xa14ed2=typeof _0x1c3746['offset']===_0x89f3('0x1f')&&typeof _0x1c3746[_0x89f3('0x20')]===_0x89f3('0x1f');var _0x4caccc=_0xe0d57[_0x89f3('0x21')];var _0x3fad2b=_0xa14ed2?0x0:_0x1c3746[_0x89f3('0x22')];var _0x2a3c87=_0xa14ed2?_0xe0d57[_0x89f3('0x21')]:_0x1c3746[_0x89f3('0x22')]+_0x1c3746['limit'];var _0x478759;if(_0x2a3c87>=_0x4caccc){_0x2a3c87=_0x4caccc;_0x478759=0xc8;}else{_0x478759=0xce;}_0x3638de['status'](_0x478759);return _0x3638de[_0x89f3('0x23')](_0x89f3('0x24'),_0x3fad2b+'-'+_0x2a3c87+'/'+_0x4caccc)[_0x89f3('0x1e')](_0xe0d57);}return null;};}function patchUpdates(_0x587a37){return function(_0x5d0e57){try{jsonpatch[_0x89f3('0x25')](_0x5d0e57,_0x587a37,!![]);}catch(_0x10f1bc){return BPromise['reject'](_0x10f1bc);}return _0x5d0e57[_0x89f3('0x26')]();};}function saveUpdates(_0x25ebff,_0x53407b){return function(_0x67a26a){if(_0x67a26a){return _0x67a26a[_0x89f3('0x27')](_0x25ebff)[_0x89f3('0x28')](function(_0x5f01f2){return _0x5f01f2;});}return null;};}function removeEntity(_0x5a6fbb,_0x1dff77){return function(_0x47df72){if(_0x47df72){return _0x47df72[_0x89f3('0x29')]()[_0x89f3('0x28')](function(){_0x5a6fbb[_0x89f3('0x1c')](0xcc)[_0x89f3('0x1d')]();});}};}function handleEntityNotFound(_0x351ff0,_0x55f9c9){return function(_0xa5807c){if(!_0xa5807c){_0x351ff0[_0x89f3('0x2a')](0x194);}return _0xa5807c;};}function handleError(_0x29655a,_0x32bf3f){_0x32bf3f=_0x32bf3f||0x1f4;return function(_0x3f4133){logger[_0x89f3('0x2b')](_0x3f4133['stack']);if(_0x3f4133[_0x89f3('0x2c')]){delete _0x3f4133['name'];}_0x29655a[_0x89f3('0x1c')](_0x32bf3f)[_0x89f3('0x2d')](_0x3f4133);};}function getInteractionUsers(_0x248bb4,_0x588ce9){return new BPromise(function(_0x5892df,_0x33f933){try{if(_0x588ce9[_0x248bb4['id']]){_0x248bb4['Users']=_[_0x89f3('0x2e')](_0x588ce9[_0x248bb4['id']],function(_0x52ba62){return{'id':_0x52ba62['id'],'fullname':_0x52ba62['fullname']};});}}catch(_0x3b9e18){_0x33f933(_0x3b9e18);}_0x5892df(_0x248bb4);});}function getInteractionTags(_0x1a3919,_0x5d6661){return new BPromise(function(_0x454913,_0xacbc5){try{if(_0x1a3919[_0x89f3('0x2f')]){_0x1a3919[_0x89f3('0x30')]=[];_0x1a3919['TagIds'][_0x89f3('0x31')](',')[_0x89f3('0x32')](function(_0x1061ae){_0x1a3919['Tags'][_0x89f3('0x33')](_0x5d6661[_0x1061ae]);});}delete _0x1a3919[_0x89f3('0x2f')];}catch(_0x329360){_0xacbc5(_0x329360);}_0x454913(_0x1a3919);});}function updateFaxInteraction(_0x4d6f8a,_0x4f8851,_0x2aad54){return new BPromise(function(_0x4ff3d1,_0x95d2bf){return getInteractionUsers(_0x4d6f8a,_0x2aad54)[_0x89f3('0x28')](function(_0x5a61d7){return getInteractionTags(_0x5a61d7,_0x4f8851);})[_0x89f3('0x28')](function(_0x1d6866){_0x4ff3d1(_0x1d6866);})[_0x89f3('0x34')](function(_0xc4cc38){_0x95d2bf(_0xc4cc38);});});}exports[_0x89f3('0x35')]=function(_0x2f0e38,_0x5ecf7){var _0x3dd40c={},_0x40ccf6={},_0x58a365={'count':0x0,'rows':[]};var _0xc5ce2d=_[_0x89f3('0x2e')](db[_0x89f3('0x36')][_0x89f3('0x37')],function(_0x1e29e2){return{'name':_0x1e29e2['fieldName'],'type':_0x1e29e2[_0x89f3('0x38')][_0x89f3('0x39')]};});_0x40ccf6[_0x89f3('0x3a')]=_['map'](_0xc5ce2d,_0x89f3('0x2c'));_0x40ccf6[_0x89f3('0x3b')]=_[_0x89f3('0x3c')](_0x2f0e38[_0x89f3('0x3b')]);_0x40ccf6[_0x89f3('0x3d')]=_[_0x89f3('0x3e')](_0x40ccf6[_0x89f3('0x3a')],_0x40ccf6[_0x89f3('0x3b')]);_0x3dd40c[_0x89f3('0x3f')]=_[_0x89f3('0x3e')](_0x40ccf6['model'],qs['fields'](_0x2f0e38[_0x89f3('0x3b')]['fields']));_0x3dd40c[_0x89f3('0x3f')]=_0x3dd40c[_0x89f3('0x3f')][_0x89f3('0x40')]?_0x3dd40c[_0x89f3('0x3f')]:_0x40ccf6[_0x89f3('0x3a')];if(!_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x41')](_0x89f3('0x42'))){_0x3dd40c[_0x89f3('0x20')]=qs[_0x89f3('0x20')](_0x2f0e38['query'][_0x89f3('0x20')]);_0x3dd40c[_0x89f3('0x22')]=qs['offset'](_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x22')]);}_0x3dd40c[_0x89f3('0x43')]=qs[_0x89f3('0x44')](_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x44')]);_0x3dd40c[_0x89f3('0x45')]=qs[_0x89f3('0x3d')](_[_0x89f3('0x46')](_0x2f0e38[_0x89f3('0x3b')],_0x40ccf6[_0x89f3('0x3d')]),_0xc5ce2d);var _0x5c5d3b=[];var _0x72f15e=squel[_0x89f3('0x47')]()[_0x89f3('0x48')]('id')[_0x89f3('0x48')](_0x89f3('0x2c'))[_0x89f3('0x48')](_0x89f3('0x49'))['from'](_0x89f3('0x4a'));var _0x752977=squel[_0x89f3('0x47')]()[_0x89f3('0x48')]('u.id')[_0x89f3('0x48')]('u.fullname')[_0x89f3('0x48')](_0x89f3('0x4b'))[_0x89f3('0x4c')](_0x89f3('0x4d'),'ui')[_0x89f3('0x4e')](_0x89f3('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x2ef372=squel[_0x89f3('0x47')]()['from']('fax_interactions','i')[_0x89f3('0x4e')](_0x89f3('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x89f3('0x4e')](_0x89f3('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x89f3('0x4e')](_0x89f3('0x51'),'a','a.id\x20=\x20i.FaxAccountId')[_0x89f3('0x4e')]('fax_messages','me',_0x89f3('0x52'))[_0x89f3('0x4e')]('fax_interaction_has_tags','it',_0x89f3('0x53'))[_0x89f3('0x4e')](_0x89f3('0x4a'),'t',_0x89f3('0x54'));var _0x2b1d6e=squel[_0x89f3('0x55')]();var _0x34777b=[];var _0x5c5b34=squel[_0x89f3('0x55')]();var _0x12bc77;if(_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x56')]){_0x12bc77=as[_0x89f3('0x57')](_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x56')]);var _0x280bc7=_0x12bc77['sqlOperator'];for(var _0x24d691=0x0;_0x24d691<_0x12bc77[_0x89f3('0x58')]['length'];_0x24d691++){var _0x525336=_0x12bc77[_0x89f3('0x58')][_0x24d691];var _0x41b295='i';var _0x4d86a8=_['find'](_0xc5ce2d,['name',_0x525336[_0x89f3('0x48')]]);if(!_0x4d86a8){switch(_0x525336[_0x89f3('0x48')]){case _0x89f3('0x59'):if(_0x525336['value']==0x1){_0x2ef372['having']('`'+_0x525336[_0x89f3('0x48')]+_0x89f3('0x5a'));}else{_0x2ef372[_0x89f3('0x5b')]('`'+_0x525336[_0x89f3('0x48')]+_0x89f3('0x5c'));}break;case'Contact':if(_0x525336[_0x89f3('0x5d')]===_0x89f3('0x5e')){if(_0x525336[_0x89f3('0x5f')]['split']('\x20')[_0x89f3('0x40')]>0x1){_0x2b1d6e[_0x280bc7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x89f3('0x60')](_0x525336[_0x89f3('0x5f')]),null);}else{var _0x17c4f8='%'+_0x525336['value']+'%';_0x2b1d6e[_0x280bc7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x17c4f8,_0x17c4f8,_0x17c4f8);}}else{_0x4d86a8=_[_0x89f3('0x61')](_0xc5ce2d,[_0x89f3('0x2c'),'ContactId']);_0x525336[_0x89f3('0x48')]=_0x89f3('0x62');_0x4ded09=as[_0x89f3('0x63')](_0x41b295,_0x4d86a8[_0x89f3('0x38')],_0x525336);_0x2b1d6e[_0x280bc7](_0x4ded09[_0x89f3('0x64')],_0x4ded09[_0x89f3('0x5f')]['start'],_0x4ded09[_0x89f3('0x5f')][_0x89f3('0x1d')]);}break;case _0x89f3('0x65'):var _0x2dc47f=_0x525336[_0x89f3('0x5f')][_0x89f3('0x31')](',')[_0x89f3('0x2e')](function(_0x2949cc){return Number(_0x2949cc);});_0x2dc47f['forEach'](function(_0x778c97){_0x5c5b34['or'](_0x89f3('0x66'),'%,'+_0x778c97+',%');});_0x34777b=_['union'](_0x34777b,_0x2dc47f);break;case _0x89f3('0x67'):if(_0x525336[_0x89f3('0x5d')]===_0x89f3('0x5e')){_0x2b1d6e[_0x280bc7](_0x89f3('0x68'),'%'+_0x525336[_0x89f3('0x5f')]+'%',null);}else{_0x4d86a8=_['find'](_0xc5ce2d,['name','UserId']);_0x525336[_0x89f3('0x48')]='UserId';_0x4ded09=as['buildExpression'](_0x41b295,_0x4d86a8[_0x89f3('0x38')],_0x525336);_0x2b1d6e[_0x280bc7](_0x4ded09['text'],_0x4ded09[_0x89f3('0x5f')]['start'],_0x4ded09['value'][_0x89f3('0x1d')]);}break;case'body':_0x4ded09=as[_0x89f3('0x63')]('me',null,_0x525336);_0x2b1d6e[_0x280bc7](_0x4ded09[_0x89f3('0x64')],_0x4ded09[_0x89f3('0x5f')][_0x89f3('0x69')],_0x4ded09['value'][_0x89f3('0x1d')]);break;}}else{var _0x4ded09=as[_0x89f3('0x63')](_0x41b295,_0x4d86a8[_0x89f3('0x38')],_0x525336);_0x2b1d6e[_0x280bc7](_0x4ded09[_0x89f3('0x64')],_0x4ded09[_0x89f3('0x5f')][_0x89f3('0x69')],_0x4ded09[_0x89f3('0x5f')][_0x89f3('0x1d')]);}}}else{var _0x38c56c=_(_0x2f0e38[_0x89f3('0x3b')])['keys']()[_0x89f3('0x2e')](function(_0x29a93e){return _[_0x89f3('0x6a')](_0xc5ce2d,[_0x89f3('0x2c'),_0x29a93e])?_0x29a93e:undefined;})['compact']()[_0x89f3('0x5f')]();if(!_[_0x89f3('0x6b')](_0x38c56c)){_0x38c56c[_0x89f3('0x32')](function(_0x184ae2){if(_0x184ae2===_0x89f3('0x6c')){_0x2ef372[_0x89f3('0x45')](_0x89f3('0x6d'),[][_0x89f3('0x6e')](_0x2f0e38[_0x89f3('0x3b')][_0x184ae2]));}else if(_0x184ae2===_0x89f3('0x6f')){var _0x5f0db2=JSON['parse'](_0x2f0e38[_0x89f3('0x3b')][_0x184ae2])[_0x89f3('0x70')];var _0x1c050e=JSON[_0x89f3('0x71')](_0x2f0e38[_0x89f3('0x3b')][_0x184ae2])['$lte'];_0x2ef372[_0x89f3('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5f0db2,_0x1c050e);}else{if(_0x2f0e38[_0x89f3('0x3b')][_0x184ae2]==='null'){_0x2ef372[_0x89f3('0x45')]('i.'+_0x184ae2+_0x89f3('0x72'));}else{_0x2ef372['where']('i.'+_0x184ae2+_0x89f3('0x73'),_0x2f0e38[_0x89f3('0x3b')][_0x184ae2]);}}});}if(_0x2f0e38['query'][_0x89f3('0x74')]){if(_0x2f0e38['query'][_0x89f3('0x74')]==0x1){_0x2ef372[_0x89f3('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x2ef372[_0x89f3('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x75')]){_0x34777b=_['isArray'](_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x75')])?_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x75')]:new Array(_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x75')]);_0x34777b[_0x89f3('0x32')](function(_0x2ba4f5){_0x5c5b34['or'](_0x89f3('0x66'),'%,'+_0x2ba4f5+',%');});}if(_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x76')]){var _0x1648ed=_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x76')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x89f3('0x77')](_0x1648ed)){_0x2b1d6e['or'](_0x89f3('0x78'),_0x1648ed+'%')['or'](_0x89f3('0x79'),_0x1648ed+'%');}_0x2b1d6e['or'](_0x89f3('0x7a'),_0x1648ed+'%');}}_0x2ef372[_0x89f3('0x45')](_0x2b1d6e);_0x2ef372['group'](_0x89f3('0x7b'));var _0x49fdb2={'type':db[_0x89f3('0x7c')]['QueryTypes'][_0x89f3('0x7d')],'raw':!![]};var _0x3ded3e=_0x2ef372['clone']();_0x3ded3e[_0x89f3('0x48')](_0x89f3('0x7b'));_0x3ded3e[_0x89f3('0x48')](_0x89f3('0x7e'),_0x89f3('0x59'));if(_0x3dd40c[_0x89f3('0x43')]){_0x3dd40c[_0x89f3('0x43')][_0x89f3('0x32')](function(_0x57cd9e){var _0x17b856=_0x57cd9e[0x0]===_0x89f3('0x7f')?_0x57cd9e[0x0]:'i.'+_0x57cd9e[0x0];_0x2ef372[_0x89f3('0x43')](_0x17b856,_0x57cd9e[0x1]===_0x89f3('0x80')?![]:!![]);});}if(!_['isEmpty'](_0x34777b)){_0x2ef372[_0x89f3('0x5b')](_0x5c5b34);_0x3ded3e[_0x89f3('0x45')]('t.id\x20IN\x20?',_0x34777b);}BPromise['resolve']()['then'](function(){if(!_0x12bc77){if(_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x6c')])return;_0x3ded3e[_0x89f3('0x45')](_0x89f3('0x81'));_0x2ef372[_0x89f3('0x45')](_0x89f3('0x81'));return;}if(_0x2f0e38['user'][_0x89f3('0x82')]!==_0x89f3('0x83'))return;return _0x2f0e38[_0x89f3('0x84')][_0x89f3('0x85')]({'attributes':['id'],'raw':!![]})[_0x89f3('0x28')](function(_0x1f77b1){if(_[_0x89f3('0x6b')](_0x1f77b1)){_0x3ded3e[_0x89f3('0x45')](_0x89f3('0x86'));_0x2ef372[_0x89f3('0x45')](_0x89f3('0x86'));}else{_0x3ded3e[_0x89f3('0x45')](_0x89f3('0x6d'),_['map'](_0x1f77b1,'id'));_0x2ef372[_0x89f3('0x45')](_0x89f3('0x6d'),_[_0x89f3('0x2e')](_0x1f77b1,'id'));}});})[_0x89f3('0x28')](function(){if(_0x2f0e38[_0x89f3('0x84')][_0x89f3('0x82')]===_0x89f3('0x83')&&!_0x12bc77&&!_0x2f0e38[_0x89f3('0x3b')][_0x89f3('0x6c')])return[];return db[_0x89f3('0x87')][_0x89f3('0x3b')](_0x3ded3e['toString'](),_0x49fdb2);})[_0x89f3('0x28')](function(_0x2a3842){_0x58a365[_0x89f3('0x21')]=_0x2a3842[_0x89f3('0x40')];if(_0x58a365[_0x89f3('0x21')]===0x0)return[];return db[_0x89f3('0x87')][_0x89f3('0x3b')](_0x72f15e[_0x89f3('0x88')](),_0x49fdb2)[_0x89f3('0x28')](function(_0x5d859f){_0x5c5d3b=_['keyBy'](_0x5d859f,'id');_0x49fdb2=_[_0x89f3('0x89')](_0x49fdb2,{'model':db[_0x89f3('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f0e38['query'][_0x89f3('0x8a')]){_0x3dd40c[_0x89f3('0x3f')][_0x89f3('0x32')](function(_0x53cafc){_0x2ef372[_0x89f3('0x48')]('i.'+_0x53cafc);});}else{_0x2ef372[_0x89f3('0x48')](_0x89f3('0x7e'),'unreadMessages');_0x2ef372[_0x89f3('0x48')](_0x89f3('0x8b'),_0x89f3('0x8c'));_0x2ef372['field'](_0x89f3('0x8d'),_0x89f3('0x8e'));_0x2ef372[_0x89f3('0x48')](_0x89f3('0x8f'),'contactName');_0x2ef372[_0x89f3('0x48')](_0x89f3('0x90'));_0x2ef372[_0x89f3('0x48')](_0x89f3('0x91'),'Contact.firstName');_0x2ef372[_0x89f3('0x48')](_0x89f3('0x92'),_0x89f3('0x93'));_0x2ef372['field'](_0x89f3('0x94'),_0x89f3('0x95'));_0x2ef372[_0x89f3('0x48')]('c.phone',_0x89f3('0x96'));_0x2ef372[_0x89f3('0x48')](_0x89f3('0x97'),'Contact.mobile');_0x2ef372[_0x89f3('0x48')](_0x89f3('0x98'),_0x89f3('0x99'));_0x2ef372[_0x89f3('0x48')]('o.fullname',_0x89f3('0x9a'));_0x2ef372[_0x89f3('0x48')](_0x89f3('0x9b'),_0x89f3('0x9c'));_0x2ef372[_0x89f3('0x48')](_0x89f3('0x9d'),_0x89f3('0x2f'));}if(_0x3dd40c[_0x89f3('0x20')])_0x2ef372[_0x89f3('0x20')](_0x3dd40c[_0x89f3('0x20')]);if(_0x3dd40c[_0x89f3('0x22')])_0x2ef372[_0x89f3('0x22')](_0x3dd40c['offset']);return db[_0x89f3('0x87')][_0x89f3('0x3b')](_0x2ef372[_0x89f3('0x88')](),_0x49fdb2);})[_0x89f3('0x28')](function(_0x27eb24){if(_0x27eb24['length']>0x0)_0x752977[_0x89f3('0x45')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x27eb24,'id'));return db[_0x89f3('0x87')][_0x89f3('0x3b')](_0x752977[_0x89f3('0x88')](),_0x49fdb2)['then'](function(_0x5c10f2){var _0x28ff8d=_[_0x89f3('0x9e')](_0x5c10f2,_0x89f3('0x9f'));var _0x56e6e5=[];_0x27eb24[_0x89f3('0x32')](function(_0x29402b){_0x56e6e5[_0x89f3('0x33')](updateFaxInteraction(_0x29402b,_0x5c5d3b,_0x28ff8d));});return BPromise['all'](_0x56e6e5);});});})[_0x89f3('0x28')](function(_0x3df3e4){_0x58a365[_0x89f3('0xa0')]=_0x3df3e4;return _0x58a365;})[_0x89f3('0x28')](respondWithFilteredResult(_0x5ecf7,_0x3dd40c))[_0x89f3('0x34')](handleError(_0x5ecf7,null));};exports[_0x89f3('0xa1')]=function(_0x1b1823,_0xb226c6){var _0x230bc8={'raw':![],'where':{'id':_0x1b1823[_0x89f3('0xa2')]['id']}},_0x5009fa={};_0x5009fa[_0x89f3('0x3a')]=_[_0x89f3('0x3c')](db[_0x89f3('0x36')]['rawAttributes']);_0x5009fa[_0x89f3('0x3b')]=_[_0x89f3('0x3c')](_0x1b1823[_0x89f3('0x3b')]);_0x5009fa[_0x89f3('0x3d')]=_[_0x89f3('0x3e')](_0x5009fa[_0x89f3('0x3a')],_0x5009fa[_0x89f3('0x3b')]);_0x230bc8[_0x89f3('0x3f')]=_[_0x89f3('0x3e')](_0x5009fa[_0x89f3('0x3a')],qs[_0x89f3('0x8a')](_0x1b1823[_0x89f3('0x3b')][_0x89f3('0x8a')]));_0x230bc8[_0x89f3('0x3f')]=_0x230bc8['attributes'][_0x89f3('0x40')]?_0x230bc8['attributes']:_0x5009fa[_0x89f3('0x3a')];if(_0x1b1823[_0x89f3('0x3b')][_0x89f3('0xa3')]){_0x230bc8[_0x89f3('0xa4')]=[{'all':!![]}];}_0x230bc8=_[_0x89f3('0x89')]({},_0x230bc8,_0x1b1823[_0x89f3('0xa5')]);return db[_0x89f3('0x36')]['find'](_0x230bc8)['then'](handleEntityNotFound(_0xb226c6,null))[_0x89f3('0x28')](respondWithResult(_0xb226c6,null))['catch'](handleError(_0xb226c6,null));};exports['create']=function(_0xd0da9c,_0x2c6a5c){return db[_0x89f3('0x36')][_0x89f3('0xa6')](_0xd0da9c[_0x89f3('0xa7')],{})['then'](respondWithResult(_0x2c6a5c,0xc9))[_0x89f3('0x34')](handleError(_0x2c6a5c,null));};exports[_0x89f3('0x27')]=function(_0x583dce,_0x1d2394){if(_0x583dce['body']['id']){delete _0x583dce['body']['id'];}return db[_0x89f3('0x36')]['find']({'where':{'id':_0x583dce[_0x89f3('0xa2')]['id']}})[_0x89f3('0x28')](handleEntityNotFound(_0x1d2394,null))[_0x89f3('0x28')](saveUpdates(_0x583dce[_0x89f3('0xa7')],null))['then'](respondWithResult(_0x1d2394,null))['catch'](handleError(_0x1d2394,null));};exports[_0x89f3('0x29')]=function(_0x214f7a,_0x769928){return db[_0x89f3('0x36')][_0x89f3('0x61')]({'where':{'id':_0x214f7a[_0x89f3('0xa2')]['id']}})[_0x89f3('0x28')](handleEntityNotFound(_0x769928,null))[_0x89f3('0x28')](removeEntity(_0x769928,null))['catch'](handleError(_0x769928,null));};exports['describe']=function(_0x43bba8,_0x59109e){return db[_0x89f3('0x36')][_0x89f3('0xa8')]()[_0x89f3('0x28')](respondWithResult(_0x59109e,null))[_0x89f3('0x34')](handleError(_0x59109e,null));};exports[_0x89f3('0xa9')]=function(_0x3060aa,_0x5d740e,_0x59a246){return db[_0x89f3('0xaa')][_0x89f3('0x61')]({'where':{'id':_0x3060aa[_0x89f3('0xa2')]['id']}})[_0x89f3('0x28')](handleEntityNotFound(_0x5d740e,null))[_0x89f3('0x28')](function(_0x504d30){if(_0x504d30){return _0x504d30[_0x89f3('0xa9')](_0x3060aa[_0x89f3('0xa7')][_0x89f3('0xab')],_['omit'](_0x3060aa[_0x89f3('0xa7')],[_0x89f3('0xab'),'id'])||{});}})[_0x89f3('0x28')](respondWithResult(_0x5d740e,null))[_0x89f3('0x34')](handleError(_0x5d740e,null));};exports[_0x89f3('0xac')]=function(_0x2a9f84,_0x520951,_0x5c51a7){var _0xf2a48={'raw':![],'where':{}};var _0x2ab25f={};var _0xf83d6f={'count':0x0,'rows':[]};return db[_0x89f3('0x36')]['findOne']({'where':{'id':_0x2a9f84[_0x89f3('0xa2')]['id']}})[_0x89f3('0x28')](handleEntityNotFound(_0x520951,null))['then'](function(_0x10e329){if(_0x10e329){_0x2ab25f[_0x89f3('0x3a')]=_[_0x89f3('0x3c')](db[_0x89f3('0xaa')]['rawAttributes']);_0x2ab25f[_0x89f3('0x3b')]=_['keys'](_0x2a9f84[_0x89f3('0x3b')]);_0x2ab25f[_0x89f3('0x3d')]=_['intersection'](_0x2ab25f[_0x89f3('0x3a')],_0x2ab25f[_0x89f3('0x3b')]);_0xf2a48[_0x89f3('0x3f')]=_['intersection'](_0x2ab25f['model'],qs[_0x89f3('0x8a')](_0x2a9f84['query'][_0x89f3('0x8a')]));_0xf2a48[_0x89f3('0x3f')]=_0xf2a48[_0x89f3('0x3f')]['length']?_0xf2a48[_0x89f3('0x3f')]:_0x2ab25f['model'];if(!_0x2a9f84[_0x89f3('0x3b')][_0x89f3('0x41')](_0x89f3('0x42'))){_0xf2a48['limit']=qs[_0x89f3('0x20')](_0x2a9f84[_0x89f3('0x3b')][_0x89f3('0x20')]);_0xf2a48[_0x89f3('0x22')]=qs[_0x89f3('0x22')](_0x2a9f84[_0x89f3('0x3b')]['offset']);}_0xf2a48[_0x89f3('0x43')]=qs[_0x89f3('0x44')](_0x2a9f84[_0x89f3('0x3b')][_0x89f3('0x44')]);_0xf2a48['where']=qs['filters'](_[_0x89f3('0x46')](_0x2a9f84[_0x89f3('0x3b')],_0x2ab25f['filters']));_0xf2a48[_0x89f3('0x45')]['FaxInteractionId']=_0x10e329['id'];if(_0x2a9f84['query'][_0x89f3('0x76')]){_0xf2a48[_0x89f3('0x45')]=_[_0x89f3('0x89')](_0xf2a48[_0x89f3('0x45')],{'$or':_[_0x89f3('0x2e')](_0xf2a48[_0x89f3('0x3f')],function(_0x191a05){var _0x499504={};_0x499504[_0x191a05]={'$like':'%'+_0x2a9f84[_0x89f3('0x3b')]['filter']+'%'};return _0x499504;})});}if(_0x2a9f84['query'][_0x89f3('0x70')]){var _0x22eccc=_0x2a9f84[_0x89f3('0x3b')][_0x89f3('0x70')][_0x89f3('0x31')](',');var _0x490757={};_0x490757[_0x22eccc[0x0]]={'$gte':moment(_0x22eccc[0x1])[_0x89f3('0xad')](_0x89f3('0xae'))};_0xf2a48[_0x89f3('0x45')]=_[_0x89f3('0x89')](_0xf2a48[_0x89f3('0x45')],_0x490757);}_0xf2a48=_[_0x89f3('0x89')]({},_0xf2a48,_0x2a9f84[_0x89f3('0xa5')]);return db[_0x89f3('0xaa')][_0x89f3('0x21')]({'where':_0xf2a48[_0x89f3('0x45')]})[_0x89f3('0x28')](function(_0x4ded56){_0xf83d6f[_0x89f3('0x21')]=_0x4ded56;if(_0x2a9f84['query'][_0x89f3('0xa3')]){_0xf2a48['include']=[{'all':!![]}];}return db[_0x89f3('0xaa')]['findAll'](_0xf2a48);})[_0x89f3('0x28')](function(_0xd9d686){_0xf83d6f[_0x89f3('0xa0')]=_0xd9d686;return _0xf83d6f;});}})[_0x89f3('0x28')](respondWithFilteredResult(_0x520951,_0xf2a48))['catch'](handleError(_0x520951,null));};exports[_0x89f3('0xaf')]=function(_0x31a0d4,_0x281ab3,_0x573240){return db[_0x89f3('0x36')][_0x89f3('0x61')]({'where':{'id':_0x31a0d4[_0x89f3('0xa2')]['id']}})[_0x89f3('0x28')](handleEntityNotFound(_0x281ab3,null))[_0x89f3('0x28')](function(_0x4cdf2d){if(_0x4cdf2d){return _0x4cdf2d[_0x89f3('0xb0')](_0x31a0d4[_0x89f3('0xa7')][_0x89f3('0xab')],_['omit'](_0x31a0d4[_0x89f3('0xa7')],[_0x89f3('0xab'),'id'])||{})[_0x89f3('0xb1')](function(){return db[_0x89f3('0x65')][_0x89f3('0xb2')]({'attributes':['id',_0x89f3('0x2c'),_0x89f3('0x49')],'where':{'id':_0x31a0d4[_0x89f3('0xa7')][_0x89f3('0xab')]}});})[_0x89f3('0x28')](function(_0x53ba90){socket[_0x89f3('0xb3')](_0x89f3('0xb4'),{'id':Number(_0x31a0d4[_0x89f3('0xa2')]['id']),'tags':_0x53ba90||[]});return{'id':Number(_0x31a0d4[_0x89f3('0xa2')]['id']),'tags':_0x53ba90||[]};});}})[_0x89f3('0x28')](respondWithResult(_0x281ab3,null))[_0x89f3('0x34')](handleError(_0x281ab3,null));};exports[_0x89f3('0xb5')]=function(_0xec2f44,_0x1f965a,_0x177fad){return db[_0x89f3('0x36')][_0x89f3('0x61')]({'where':{'id':_0xec2f44[_0x89f3('0xa2')]['id']}})['then'](handleEntityNotFound(_0x1f965a,null))[_0x89f3('0x28')](function(_0x4b6a5c){if(_0x4b6a5c){return _0x4b6a5c[_0x89f3('0xb5')](_0xec2f44[_0x89f3('0x3b')]['ids']);}})[_0x89f3('0x28')](respondWithStatusCode(_0x1f965a,null))[_0x89f3('0x34')](handleError(_0x1f965a,null));};exports[_0x89f3('0xb6')]=function(_0x33c8a5,_0x5f71ae){var _0x3a4717=moment()[_0x89f3('0xb7')]()['toString']();var _0xcdc9d3=path[_0x89f3('0xb8')](config['root'],'server',_0x89f3('0xb9'),_0x89f3('0xba'));var _0x4cc62b=path[_0x89f3('0xb8')](config[_0x89f3('0xbb')],'server',_0x89f3('0xb9'),_0x89f3('0xbc'));var _0x2f2c10=path[_0x89f3('0xb8')](_0xcdc9d3,_0x3a4717);var _0x422d48=util[_0x89f3('0xad')](_0x89f3('0xbd'),_0x33c8a5[_0x89f3('0xa2')]['id'],_0x3a4717);var _0x13620e=path[_0x89f3('0xb8')](_0xcdc9d3,_0x422d48);var _0x57fded=[];_0x57fded[_0x89f3('0x33')]({'model':db[_0x89f3('0xbe')],'as':_0x89f3('0xbe'),'raw':!![]});var _0x44fdd1=[{'model':db[_0x89f3('0xaa')],'as':'Messages','attributes':['id',_0x89f3('0xa7'),_0x89f3('0x6f')],'include':_0x57fded}];return db['FaxInteraction'][_0x89f3('0x61')]({'where':{'id':_0x33c8a5['params']['id']},'include':_0x44fdd1})[_0x89f3('0x28')](handleEntityNotFound(_0x5f71ae,null))[_0x89f3('0x28')](function(_0x45d1fd){if(_0x45d1fd&&_0x45d1fd[_0x89f3('0xbf')]){var _0x2d65b5=_0x45d1fd[_0x89f3('0xc0')]({'plain':!![]});fs[_0x89f3('0xc1')](_0x2f2c10);for(var _0x22fd1b=0x0;_0x22fd1b<_0x2d65b5['Messages'][_0x89f3('0x40')];_0x22fd1b++){var _0x3a1afd=_0x2d65b5[_0x89f3('0xbf')][_0x22fd1b][_0x89f3('0xbe')];if(_0x3a1afd){var _0x542e7a=path[_0x89f3('0xb8')](_0x4cc62b,_0x3a1afd[_0x89f3('0xc2')]);if(fs['existsSync'](_0x542e7a)){fs[_0x89f3('0xc3')](_0x542e7a)[_0x89f3('0xc4')](fs[_0x89f3('0xc5')](path[_0x89f3('0xb8')](_0x2f2c10,_0x3a1afd[_0x89f3('0xc2')])));}}}return BPromise[_0x89f3('0xc6')]()['then'](function(){return new BPromise(function(_0x93f3e7,_0x5bcdac){zipdir(_0x2f2c10,{'saveTo':_0x13620e},function(_0x296790,_0xda3593){if(_0x296790)return _0x5bcdac(_0x296790);return _0x93f3e7(_0xda3593);});})[_0x89f3('0x28')](function(){return new BPromise(function(_0x2cedf1,_0x592b1d){rimraf(_0x2f2c10,function(_0x57ed74){if(_0x57ed74)_0x592b1d(_0x57ed74);return _0x2cedf1();});});})[_0x89f3('0x28')](function(){return _0x5f71ae[_0x89f3('0xb6')](_0x13620e,_0x422d48,function(_0x1b1ff6){if(_0x1b1ff6){console[_0x89f3('0xc7')](_0x89f3('0xc8'),_0x1b1ff6);}else{fs[_0x89f3('0xc9')](_0x13620e);}});});});}else{return _0x5f71ae[_0x89f3('0x2a')](0xc8);}})[_0x89f3('0x34')](handleError(_0x5f71ae,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ebe035d..f98f030 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 _0xc26a=['update','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x212169,_0x93fd8){var _0x165fd4=function(_0x647b75){while(--_0x647b75){_0x212169['push'](_0x212169['shift']());}};_0x165fd4(++_0x93fd8);}(_0xc26a,0x1c7));var _0xac26=function(_0x1fb6ff,_0x474709){_0x1fb6ff=_0x1fb6ff-0x0;var _0x339f61=_0xc26a[_0x1fb6ff];return _0x339f61;};'use strict';var EventEmitter=require(_0xac26('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xac26('0x1'))['db'][_0xac26('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac26('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac26('0x4'),'afterDestroy':'remove'};function emitEvent(_0x233f58){return function(_0x360af5,_0x1b5d74,_0x38b94c){_0x360af5[_0xac26('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1cffb4){_0x360af5[_0xac26('0x6')](_0xac26('0x7'),_0x1cffb4['map'](function(_0x28bbb6){return{'id':_0x28bbb6['id']};}));return FaxMessage[_0xac26('0x8')]({'where':{'FaxInteractionId':_0x360af5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac26('0x9')](function(_0x41d0a9){_0x360af5[_0xac26('0x6')](_0xac26('0xa'),_0x41d0a9[_0xac26('0xb')]);FaxInteractionEvents[_0xac26('0xc')](_0x233f58+':'+_0x360af5['id'],_0x360af5);FaxInteractionEvents[_0xac26('0xc')](_0x233f58,_0x360af5);_0x38b94c(null);})[_0xac26('0xd')](_0x38b94c(null));};}for(var e in events){if(events[_0xac26('0xe')](e)){var event=events[e];FaxInteraction[_0xac26('0xf')](e,emitEvent(event));}}module[_0xac26('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x7db2=['getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','remove'];(function(_0x3f9d9b,_0x175b8a){var _0x5d0f71=function(_0x38f389){while(--_0x38f389){_0x3f9d9b['push'](_0x3f9d9b['shift']());}};_0x5d0f71(++_0x175b8a);}(_0x7db2,0x170));var _0x27db=function(_0x29bc28,_0x2f73ba){_0x29bc28=_0x29bc28-0x0;var _0x406c1c=_0x7db2[_0x29bc28];return _0x406c1c;};'use strict';var EventEmitter=require(_0x27db('0x0'));var FaxInteraction=require(_0x27db('0x1'))['db'][_0x27db('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x27db('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x27db('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x27db('0x5')};function emitEvent(_0x5d423a){return function(_0x14599f,_0x5bfab5,_0x5b4b77){_0x14599f[_0x27db('0x6')]({'attributes':['id'],'raw':!![]})[_0x27db('0x7')](function(_0x105d86){_0x14599f[_0x27db('0x8')](_0x27db('0x9'),_0x105d86[_0x27db('0xa')](function(_0x201c43){return{'id':_0x201c43['id']};}));return FaxMessage[_0x27db('0xb')]({'where':{'FaxInteractionId':_0x14599f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2cc9fc){_0x14599f[_0x27db('0x8')]('unreadMessages',_0x2cc9fc[_0x27db('0xc')]);FaxInteractionEvents[_0x27db('0xd')](_0x5d423a+':'+_0x14599f['id'],_0x14599f);FaxInteractionEvents['emit'](_0x5d423a,_0x14599f);_0x5b4b77(null);})[_0x27db('0xe')](_0x5b4b77(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x27db('0xf')](e,emitEvent(event));}}module[_0x27db('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c3bfa92..8e0dee3 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 _0x0607=['closed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed'];(function(_0x1a2fd7,_0x5df7a6){var _0x571dd2=function(_0x66e77d){while(--_0x66e77d){_0x1a2fd7['push'](_0x1a2fd7['shift']());}};_0x571dd2(++_0x5df7a6);}(_0x0607,0x99));var _0x7060=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0607[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x7060('0x0'));var util=require(_0x7060('0x1'));var logger=require(_0x7060('0x2'))('api');var moment=require(_0x7060('0x3'));var BPromise=require(_0x7060('0x4'));var rp=require(_0x7060('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7060('0x6'));var config=require(_0x7060('0x7'));var attributes=require(_0x7060('0x8'));module['exports']=function(_0x1d1e19,_0x200a20){return _0x1d1e19[_0x7060('0x9')](_0x7060('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x563f3f,_0x54bd13,_0x1b1c23){if(_0x563f3f[_0x7060('0xb')](_0x7060('0xc'))){_0x563f3f[_0x7060('0xd')]=moment()[_0x7060('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1b1c23(null,_0x563f3f);}}});}; \ No newline at end of file +var _0x3942=['define','FaxInteraction','fax_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3942,0x1d9));var _0x2394=function(_0x4dd5ce,_0x50b2ce){_0x4dd5ce=_0x4dd5ce-0x0;var _0x6b8ef7=_0x3942[_0x4dd5ce];return _0x6b8ef7;};'use strict';var _=require(_0x2394('0x0'));var util=require(_0x2394('0x1'));var logger=require('../../config/logger')(_0x2394('0x2'));var moment=require(_0x2394('0x3'));var BPromise=require('bluebird');var rp=require(_0x2394('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2394('0x5'));var config=require(_0x2394('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x2394('0x7')]=function(_0x44ac68,_0x21cac3){return _0x44ac68[_0x2394('0x8')](_0x2394('0x9'),attributes,{'tableName':_0x2394('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x455668,_0x3384e6,_0x30adc8){if(_0x455668['changed']('closed')){_0x455668['closedAt']=moment()[_0x2394('0xb')](_0x2394('0xc'));}_0x30adc8(null,_0x455668);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 62dfaef..d13b111 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 _0x4250=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','FaxInteraction','update','body','options','raw','where','attributes','limit','then','UpdateFaxInteraction','catch','find','addTags','ids','omit','spread','AddTags','util','moment'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x4250,0x181));var _0x0425=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4250[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x0425('0x0'));var moment=require(_0x0425('0x1'));var BPromise=require(_0x0425('0x2'));var rs=require(_0x0425('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0425('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0425('0x5'))(_0x0425('0x6'));var config=require(_0x0425('0x7'));var jayson=require(_0x0425('0x8'));var client=jayson[_0x0425('0x9')][_0x0425('0xa')]({'port':0x232a});config[_0x0425('0xb')]=_[_0x0425('0xc')](config[_0x0425('0xb')],{'host':_0x0425('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0425('0xb')]));require(_0x0425('0xe'))[_0x0425('0xf')](socket);function respondWithRpcPromise(_0x50c5b6,_0x51f453,_0xa2315){return new BPromise(function(_0x361daf,_0x252047){return client[_0x0425('0x10')](_0x50c5b6,_0xa2315)['then'](function(_0x2690f2){logger[_0x0425('0x11')](_0x0425('0x12'),_0x51f453,_0x0425('0x13'));logger[_0x0425('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x51f453,_0x0425('0x13'),JSON[_0x0425('0x15')](_0x2690f2));if(_0x2690f2[_0x0425('0x16')]){if(_0x2690f2[_0x0425('0x16')][_0x0425('0x17')]===0x1f4){logger[_0x0425('0x16')](_0x0425('0x12'),_0x51f453,_0x2690f2['error'][_0x0425('0x18')]);return _0x252047(_0x2690f2[_0x0425('0x16')][_0x0425('0x18')]);}logger['error'](_0x0425('0x12'),_0x51f453,_0x2690f2[_0x0425('0x16')][_0x0425('0x18')]);return _0x361daf(_0x2690f2['error'][_0x0425('0x18')]);}else{logger[_0x0425('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x51f453,_0x0425('0x13'));_0x361daf(_0x2690f2[_0x0425('0x19')][_0x0425('0x18')]);}})['catch'](function(_0x1e1f82){logger[_0x0425('0x16')](_0x0425('0x12'),_0x51f453,_0x1e1f82);_0x252047(_0x1e1f82);});});}exports['UpdateFaxInteraction']=function(_0x2ea74d){var _0x435a18=this;return new Promise(function(_0x5edc4c,_0x598e74){return db[_0x0425('0x1a')][_0x0425('0x1b')](_0x2ea74d[_0x0425('0x1c')],{'raw':_0x2ea74d[_0x0425('0x1d')]?_0x2ea74d[_0x0425('0x1d')][_0x0425('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ea74d[_0x0425('0x1d')]?_0x2ea74d[_0x0425('0x1d')][_0x0425('0x1f')]||null:null,'attributes':_0x2ea74d['options']?_0x2ea74d[_0x0425('0x1d')][_0x0425('0x20')]||null:null,'limit':_0x2ea74d[_0x0425('0x1d')]?_0x2ea74d[_0x0425('0x1d')][_0x0425('0x21')]||null:null})[_0x0425('0x22')](function(_0x43368a){logger['info']('UpdateFaxInteraction',_0x2ea74d);logger[_0x0425('0x14')](_0x0425('0x23'),_0x2ea74d,JSON['stringify'](_0x43368a));_0x5edc4c(_0x43368a);})[_0x0425('0x24')](function(_0x4aa6d4){logger['error'](_0x0425('0x23'),_0x4aa6d4[_0x0425('0x18')],_0x2ea74d);_0x598e74(_0x435a18[_0x0425('0x16')](0x1f4,_0x4aa6d4[_0x0425('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0xcd1211){return new Promise(function(_0x1beec4,_0x392436){return db[_0x0425('0x1a')][_0x0425('0x25')]({'where':_0xcd1211['options']?_0xcd1211['options'][_0x0425('0x1f')]||null:null})['then'](function(_0x3f7eb6){if(_0x3f7eb6){return _0x3f7eb6[_0x0425('0x26')](_0xcd1211[_0x0425('0x1c')][_0x0425('0x27')],_[_0x0425('0x28')](_0xcd1211[_0x0425('0x1c')],[_0x0425('0x27'),'id'])||{});}})[_0x0425('0x29')](function(_0x379ca2){logger[_0x0425('0x11')](_0x0425('0x2a'),_0xcd1211);logger[_0x0425('0x14')]('AddTags',_0xcd1211,JSON[_0x0425('0x15')](_0x379ca2));_0x1beec4(_0x379ca2);})[_0x0425('0x24')](function(_0x291a10){logger['error'](_0x0425('0x2a'),_0x291a10[_0x0425('0x18')],_0xcd1211);_0x392436(_this[_0x0425('0x16')](0x1f4,_0x291a10['message']));});});}; \ No newline at end of file +var _0xb7d9=['moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','addTags','body','ids','omit','spread','AddTags','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb7d9,0x124));var _0x9b7d=function(_0x5b759b,_0x3b7b66){_0x5b759b=_0x5b759b-0x0;var _0x3d43bd=_0xb7d9[_0x5b759b];return _0x3d43bd;};'use strict';var _=require(_0x9b7d('0x0'));var util=require(_0x9b7d('0x1'));var moment=require(_0x9b7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9b7d('0x3'));var fs=require('fs');var Redis=require(_0x9b7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b7d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9b7d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9b7d('0x7')][_0x9b7d('0x8')]({'port':0x232a});config['redis']=_[_0x9b7d('0x9')](config[_0x9b7d('0xa')],{'host':_0x9b7d('0xb'),'port':0x18eb});var socket=require(_0x9b7d('0xc'))(new Redis(config['redis']));require(_0x9b7d('0xd'))[_0x9b7d('0xe')](socket);function respondWithRpcPromise(_0x199fa9,_0xc5762,_0x3f6997){return new BPromise(function(_0x297fc3,_0x561081){return client[_0x9b7d('0xf')](_0x199fa9,_0x3f6997)[_0x9b7d('0x10')](function(_0x4b3b18){logger[_0x9b7d('0x11')](_0x9b7d('0x12'),_0xc5762,_0x9b7d('0x13'));logger[_0x9b7d('0x14')](_0x9b7d('0x15'),_0xc5762,_0x9b7d('0x13'),JSON[_0x9b7d('0x16')](_0x4b3b18));if(_0x4b3b18[_0x9b7d('0x17')]){if(_0x4b3b18[_0x9b7d('0x17')][_0x9b7d('0x18')]===0x1f4){logger[_0x9b7d('0x17')](_0x9b7d('0x12'),_0xc5762,_0x4b3b18[_0x9b7d('0x17')][_0x9b7d('0x19')]);return _0x561081(_0x4b3b18[_0x9b7d('0x17')]['message']);}logger[_0x9b7d('0x17')](_0x9b7d('0x12'),_0xc5762,_0x4b3b18[_0x9b7d('0x17')][_0x9b7d('0x19')]);return _0x297fc3(_0x4b3b18['error'][_0x9b7d('0x19')]);}else{logger['info'](_0x9b7d('0x12'),_0xc5762,_0x9b7d('0x13'));_0x297fc3(_0x4b3b18[_0x9b7d('0x1a')][_0x9b7d('0x19')]);}})[_0x9b7d('0x1b')](function(_0x1947dd){logger[_0x9b7d('0x17')](_0x9b7d('0x12'),_0xc5762,_0x1947dd);_0x561081(_0x1947dd);});});}exports[_0x9b7d('0x1c')]=function(_0x56de87){var _0x4f06de=this;return new Promise(function(_0x52cf2a,_0x5692b9){return db[_0x9b7d('0x1d')][_0x9b7d('0x1e')](_0x56de87['body'],{'raw':_0x56de87[_0x9b7d('0x1f')]?_0x56de87['options'][_0x9b7d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56de87[_0x9b7d('0x1f')]?_0x56de87[_0x9b7d('0x1f')][_0x9b7d('0x21')]||null:null,'attributes':_0x56de87[_0x9b7d('0x1f')]?_0x56de87[_0x9b7d('0x1f')][_0x9b7d('0x22')]||null:null,'limit':_0x56de87[_0x9b7d('0x1f')]?_0x56de87[_0x9b7d('0x1f')][_0x9b7d('0x23')]||null:null})[_0x9b7d('0x10')](function(_0x594ac4){logger[_0x9b7d('0x11')]('UpdateFaxInteraction',_0x56de87);logger['debug'](_0x9b7d('0x1c'),_0x56de87,JSON[_0x9b7d('0x16')](_0x594ac4));_0x52cf2a(_0x594ac4);})[_0x9b7d('0x1b')](function(_0x358273){logger['error']('UpdateFaxInteraction',_0x358273['message'],_0x56de87);_0x5692b9(_0x4f06de['error'](0x1f4,_0x358273[_0x9b7d('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x165d2c){return new Promise(function(_0x4fd84e,_0x2fbbbd){return db[_0x9b7d('0x1d')]['find']({'where':_0x165d2c[_0x9b7d('0x1f')]?_0x165d2c[_0x9b7d('0x1f')][_0x9b7d('0x21')]||null:null})['then'](function(_0x4f2445){if(_0x4f2445){return _0x4f2445[_0x9b7d('0x24')](_0x165d2c[_0x9b7d('0x25')][_0x9b7d('0x26')],_[_0x9b7d('0x27')](_0x165d2c['body'],['ids','id'])||{});}})[_0x9b7d('0x28')](function(_0x48a5e1){logger[_0x9b7d('0x11')]('AddTags',_0x165d2c);logger[_0x9b7d('0x14')](_0x9b7d('0x29'),_0x165d2c,JSON[_0x9b7d('0x16')](_0x48a5e1));_0x4fd84e(_0x48a5e1);})[_0x9b7d('0x1b')](function(_0x52d591){logger[_0x9b7d('0x17')](_0x9b7d('0x29'),_0x52d591[_0x9b7d('0x19')],_0x165d2c);_0x2fbbbd(_this[_0x9b7d('0x17')](0x1f4,_0x52d591['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4dbdc73..cc35758 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 _0xc601=['length','faxInteraction:','./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x348659,_0xd595df){var _0x35d731=function(_0x1503cd){while(--_0x1503cd){_0x348659['push'](_0x348659['shift']());}};_0x35d731(++_0xd595df);}(_0xc601,0x7a));var _0x1c60=function(_0x19f3a7,_0x4bf316){_0x19f3a7=_0x19f3a7-0x0;var _0x561930=_0xc601[_0x19f3a7];return _0x561930;};'use strict';var FaxInteractionEvents=require(_0x1c60('0x0'));var events=[_0x1c60('0x1'),_0x1c60('0x2'),'update'];function createListener(_0x8a4a44,_0x1ccc13){return function(_0x46c3c8){_0x1ccc13[_0x1c60('0x3')](_0x8a4a44,_0x46c3c8);};}function removeListener(_0x27e1cb,_0x313012){return function(){FaxInteractionEvents[_0x1c60('0x4')](_0x27e1cb,_0x313012);};}exports[_0x1c60('0x5')]=function(_0x358612){for(var _0x54b699=0x0,_0xada37a=events[_0x1c60('0x6')];_0x54b699<_0xada37a;_0x54b699++){var _0x44ad8b=events[_0x54b699];var _0x160b46=createListener(_0x1c60('0x7')+_0x44ad8b,_0x358612);FaxInteractionEvents['on'](_0x44ad8b,_0x160b46);}}; \ No newline at end of file +var _0xa1c5=['length','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x4fd843,_0x160e2b){var _0x4676f8=function(_0x2dd82f){while(--_0x2dd82f){_0x4fd843['push'](_0x4fd843['shift']());}};_0x4676f8(++_0x160e2b);}(_0xa1c5,0x193));var _0x5a1c=function(_0x351095,_0x22ba27){_0x351095=_0x351095-0x0;var _0x76d2ca=_0xa1c5[_0x351095];return _0x76d2ca;};'use strict';var FaxInteractionEvents=require(_0x5a1c('0x0'));var events=[_0x5a1c('0x1'),_0x5a1c('0x2'),_0x5a1c('0x3')];function createListener(_0x4f6c10,_0x19a94e){return function(_0x3fb9f7){_0x19a94e['emit'](_0x4f6c10,_0x3fb9f7);};}function removeListener(_0x364e49,_0xba1886){return function(){FaxInteractionEvents[_0x5a1c('0x4')](_0x364e49,_0xba1886);};}exports['register']=function(_0x5d2237){for(var _0x49aa96=0x0,_0x22c4a5=events[_0x5a1c('0x5')];_0x49aa96<_0x22c4a5;_0x49aa96++){var _0x3525b6=events[_0x49aa96];var _0x10ebed=createListener('faxInteraction:'+_0x3525b6,_0x5d2237);FaxInteractionEvents['on'](_0x3525b6,_0x10ebed);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e035678..872ed0a 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 _0xe119=['fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34f2a8,_0x1fcbdf){var _0x90e9d=function(_0x41837c){while(--_0x41837c){_0x34f2a8['push'](_0x34f2a8['shift']());}};_0x90e9d(++_0x1fcbdf);}(_0xe119,0x1c8));var _0x9e11=function(_0x3a18f3,_0xa6b079){_0x3a18f3=_0x3a18f3-0x0;var _0x431120=_0xe119[_0x3a18f3];return _0x431120;};'use strict';var multer=require(_0x9e11('0x0'));var util=require(_0x9e11('0x1'));var path=require(_0x9e11('0x2'));var timeout=require(_0x9e11('0x3'));var express=require(_0x9e11('0x4'));var router=express[_0x9e11('0x5')]();var fs_extra=require(_0x9e11('0x6'));var auth=require(_0x9e11('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e11('0x8'));router[_0x9e11('0x9')]('/',auth[_0x9e11('0xa')](),controller[_0x9e11('0xb')]);router[_0x9e11('0x9')](_0x9e11('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x9e11('0xd'),auth[_0x9e11('0xa')](),controller['show']);router['get'](_0x9e11('0xe'),auth[_0x9e11('0xa')](),controller[_0x9e11('0xf')]);router[_0x9e11('0x9')](_0x9e11('0x10'),auth[_0x9e11('0xa')](),controller[_0x9e11('0x11')]);router[_0x9e11('0x12')]('/',auth['isAuthenticated'](),controller[_0x9e11('0x13')]);router[_0x9e11('0x12')]('/:id/messages',auth[_0x9e11('0xa')](),controller[_0x9e11('0x14')]);router[_0x9e11('0x12')](_0x9e11('0x15'),auth['isAuthenticated'](),interaction[_0x9e11('0x16')](_0x9e11('0x17'),_0x9e11('0x18')),controller['addTags']);router[_0x9e11('0x19')](_0x9e11('0xd'),auth[_0x9e11('0xa')](),interaction[_0x9e11('0x16')](_0x9e11('0x17'),_0x9e11('0x1a')),controller[_0x9e11('0x1b')]);router[_0x9e11('0x1c')](_0x9e11('0xd'),auth[_0x9e11('0xa')](),interaction['tracked']('fax',_0x9e11('0x1d')),controller[_0x9e11('0x1e')]);router['delete'](_0x9e11('0x15'),auth[_0x9e11('0xa')](),controller[_0x9e11('0x1f')]);module[_0x9e11('0x20')]=router; \ No newline at end of file +var _0x8fe3=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','addMessage','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x8fe3,0x163));var _0x38fe=function(_0xb9a5da,_0x138776){_0xb9a5da=_0xb9a5da-0x0;var _0x2487fc=_0x8fe3[_0xb9a5da];return _0x2487fc;};'use strict';var multer=require(_0x38fe('0x0'));var util=require(_0x38fe('0x1'));var path=require('path');var timeout=require(_0x38fe('0x2'));var express=require('express');var router=express[_0x38fe('0x3')]();var fs_extra=require(_0x38fe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x38fe('0x5'));var config=require(_0x38fe('0x6'));var controller=require('./faxInteraction.controller');router[_0x38fe('0x7')]('/',auth[_0x38fe('0x8')](),controller['index']);router[_0x38fe('0x7')](_0x38fe('0x9'),auth[_0x38fe('0x8')](),controller[_0x38fe('0xa')]);router['get'](_0x38fe('0xb'),auth['isAuthenticated'](),controller[_0x38fe('0xc')]);router[_0x38fe('0x7')](_0x38fe('0xd'),auth['isAuthenticated'](),controller[_0x38fe('0xe')]);router[_0x38fe('0x7')](_0x38fe('0xf'),auth[_0x38fe('0x8')](),controller['download']);router['post']('/',auth[_0x38fe('0x8')](),controller[_0x38fe('0x10')]);router['post'](_0x38fe('0xd'),auth[_0x38fe('0x8')](),controller[_0x38fe('0x11')]);router['post']('/:id/tags',auth[_0x38fe('0x8')](),interaction[_0x38fe('0x12')]('fax',_0x38fe('0x13')),controller[_0x38fe('0x14')]);router['put']('/:id',auth[_0x38fe('0x8')](),interaction[_0x38fe('0x12')](_0x38fe('0x15'),_0x38fe('0x16')),controller[_0x38fe('0x17')]);router[_0x38fe('0x18')](_0x38fe('0xb'),auth[_0x38fe('0x8')](),interaction[_0x38fe('0x12')](_0x38fe('0x15'),_0x38fe('0x19')),controller['destroy']);router[_0x38fe('0x18')]('/:id/tags',auth[_0x38fe('0x8')](),controller[_0x38fe('0x1a')]);module[_0x38fe('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9665727..45e4509 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 _0xf185=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x1880f5,_0x18418a){var _0x3f0957=function(_0x22b58b){while(--_0x22b58b){_0x1880f5['push'](_0x1880f5['shift']());}};_0x3f0957(++_0x18418a);}(_0xf185,0x1be));var _0x5f18=function(_0x32391f,_0x2b1363){_0x32391f=_0x32391f-0x0;var _0x58bec8=_0xf185[_0x32391f];return _0x58bec8;};'use strict';var Sequelize=require(_0x5f18('0x0'));module['exports']={'body':{'type':Sequelize[_0x5f18('0x1')](_0x5f18('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5f18('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5f18('0x4')]('in',_0x5f18('0x5')),'defaultValue':_0x5f18('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5f18('0x6')]}}; \ No newline at end of file +var _0x0f69=['BOOLEAN','ENUM','out','TEXT'];(function(_0x55caf7,_0x23a2b9){var _0x377d36=function(_0xbfcc08){while(--_0xbfcc08){_0x55caf7['push'](_0x55caf7['shift']());}};_0x377d36(++_0x23a2b9);}(_0x0f69,0x173));var _0x90f6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f69[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x90f6('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x90f6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x90f6('0x2')]('in','out'),'defaultValue':_0x90f6('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x90f6('0x0')],'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 5cbfc5a..5e21bb2 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 _0x144e=['fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','contact','interface','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','fast-json-patch','request-promise','moment','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','rawAttributes','include','find','body','describe','fax-interactions','accept'];(function(_0x6fa74c,_0x1ebc8b){var _0x22d795=function(_0x4e43b8){while(--_0x4e43b8){_0x6fa74c['push'](_0x6fa74c['shift']());}};_0x22d795(++_0x1ebc8b);}(_0x144e,0x14c));var _0xe144=function(_0x2b0daf,_0x3a1bfb){_0x2b0daf=_0x2b0daf-0x0;var _0x777c55=_0x144e[_0x2b0daf];return _0x777c55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe144('0x0'));var rp=require(_0xe144('0x1'));var moment=require(_0xe144('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe144('0x3'));var path=require('path');var sox=require(_0xe144('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe144('0x5'));var squel=require(_0xe144('0x6'));var crypto=require(_0xe144('0x7'));var jsforce=require(_0xe144('0x8'));var deskjs=require(_0xe144('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe144('0xa'));var Papa=require(_0xe144('0xb'));var Redis=require(_0xe144('0xc'));var authService=require(_0xe144('0xd'));var qs=require(_0xe144('0xe'));var as=require(_0xe144('0xf'));var hardwareService=require(_0xe144('0x10'));var logger=require(_0xe144('0x11'))(_0xe144('0x12'));var utils=require('../../config/utils');var config=require(_0xe144('0x13'));var licenseUtil=require(_0xe144('0x14'));var db=require('../../mysqldb')['db'];config[_0xe144('0x15')]=_[_0xe144('0x16')](config[_0xe144('0x15')],{'host':_0xe144('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe144('0x15')]));require(_0xe144('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe144('0x19')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x417d2f,_0x33327b,_0x4fafd3,_0x439691){return new BPromise(function(_0x332c2e,_0x454589){var _0x551165=_0x439691||client;return _0x551165['request'](_0x417d2f,_0x4fafd3)[_0xe144('0x1a')](function(_0x5e4d08){logger[_0xe144('0x1b')](_0xe144('0x1c'),_0x33327b,_0xe144('0x1d'));logger[_0xe144('0x1e')](_0xe144('0x1f'),_0x33327b,'request\x20sent',JSON[_0xe144('0x20')](_0x5e4d08));if(_0x5e4d08['error']){if(_0x5e4d08[_0xe144('0x21')][_0xe144('0x22')]===0x1f4){logger[_0xe144('0x21')](_0xe144('0x1c'),_0x33327b,_0x5e4d08[_0xe144('0x21')]['message']);return _0x454589(_0x5e4d08[_0xe144('0x21')][_0xe144('0x23')]);}logger[_0xe144('0x21')](_0xe144('0x1c'),_0x33327b,_0x5e4d08['error'][_0xe144('0x23')]);return _0x332c2e(_0x5e4d08[_0xe144('0x21')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x33327b,_0xe144('0x1d'));_0x332c2e(_0x5e4d08['result'][_0xe144('0x23')]);}})[_0xe144('0x24')](function(_0x41b8fc){logger[_0xe144('0x21')](_0xe144('0x1c'),_0x33327b,_0x41b8fc);_0x454589(_0x41b8fc);});});}function respondWithStatusCode(_0x5aa51b,_0x177de7){_0x177de7=_0x177de7||0xcc;return function(_0x444103){if(_0x444103){return _0x5aa51b[_0xe144('0x25')](_0x177de7);}return _0x5aa51b[_0xe144('0x26')](_0x177de7)[_0xe144('0x27')]();};}function respondWithResult(_0x1b3a8b,_0x21391d){_0x21391d=_0x21391d||0xc8;return function(_0x17a90b){if(_0x17a90b){return _0x1b3a8b['status'](_0x21391d)[_0xe144('0x28')](_0x17a90b);}};}function respondWithFilteredResult(_0x7c37fe,_0x108e9c){return function(_0x36566e){if(_0x36566e){var _0x2ec84a=typeof _0x108e9c['offset']===_0xe144('0x29')&&typeof _0x108e9c['limit']===_0xe144('0x29');var _0x142f10=_0x36566e[_0xe144('0x2a')];var _0x11da7b=_0x2ec84a?0x0:_0x108e9c[_0xe144('0x2b')];var _0x5391a2=_0x2ec84a?_0x36566e['count']:_0x108e9c[_0xe144('0x2b')]+_0x108e9c['limit'];var _0x59d9d1;if(_0x5391a2>=_0x142f10){_0x5391a2=_0x142f10;_0x59d9d1=0xc8;}else{_0x59d9d1=0xce;}_0x7c37fe[_0xe144('0x26')](_0x59d9d1);return _0x7c37fe[_0xe144('0x2c')](_0xe144('0x2d'),_0x11da7b+'-'+_0x5391a2+'/'+_0x142f10)['json'](_0x36566e);}return null;};}function patchUpdates(_0x17f46d){return function(_0x5542d3){try{jsonpatch[_0xe144('0x2e')](_0x5542d3,_0x17f46d,!![]);}catch(_0xa5ad88){return BPromise[_0xe144('0x2f')](_0xa5ad88);}return _0x5542d3[_0xe144('0x30')]();};}function saveUpdates(_0x5c9d2c,_0x39d9ea){return function(_0x2876ec){if(_0x2876ec){return _0x2876ec[_0xe144('0x31')](_0x5c9d2c)[_0xe144('0x1a')](function(_0x172cc3){return _0x172cc3;});}return null;};}function removeEntity(_0x43b766,_0x2dfa33){return function(_0x4c3110){if(_0x4c3110){return _0x4c3110[_0xe144('0x32')]()['then'](function(){_0x43b766[_0xe144('0x26')](0xcc)[_0xe144('0x27')]();});}};}function handleEntityNotFound(_0x5a3f9f,_0xd077b6){return function(_0xd9f9a8){if(!_0xd9f9a8){_0x5a3f9f['sendStatus'](0x194);}return _0xd9f9a8;};}function handleError(_0x38e02f,_0x1b220b){_0x1b220b=_0x1b220b||0x1f4;return function(_0x36a9f4){logger['error'](_0x36a9f4[_0xe144('0x33')]);if(_0x36a9f4[_0xe144('0x34')]){delete _0x36a9f4[_0xe144('0x34')];}_0x38e02f['status'](_0x1b220b)[_0xe144('0x35')](_0x36a9f4);};}exports[_0xe144('0x36')]=function(_0x1c08b6,_0x33f9ac){var _0x3e19be={},_0x4fbb89={},_0xb9ec9e={'count':0x0,'rows':[]};var _0x13e127=_['map'](db[_0xe144('0x37')]['rawAttributes'],function(_0x1ec17a){return{'name':_0x1ec17a['fieldName'],'type':_0x1ec17a['type'][_0xe144('0x38')]};});_0x4fbb89[_0xe144('0x39')]=_[_0xe144('0x3a')](_0x13e127,_0xe144('0x34'));_0x4fbb89[_0xe144('0x3b')]=_['keys'](_0x1c08b6[_0xe144('0x3b')]);_0x4fbb89[_0xe144('0x3c')]=_[_0xe144('0x3d')](_0x4fbb89[_0xe144('0x39')],_0x4fbb89[_0xe144('0x3b')]);_0x3e19be[_0xe144('0x3e')]=_[_0xe144('0x3d')](_0x4fbb89['model'],qs[_0xe144('0x3f')](_0x1c08b6[_0xe144('0x3b')][_0xe144('0x3f')]));_0x3e19be[_0xe144('0x3e')]=_0x3e19be[_0xe144('0x3e')][_0xe144('0x40')]?_0x3e19be[_0xe144('0x3e')]:_0x4fbb89[_0xe144('0x39')];if(!_0x1c08b6[_0xe144('0x3b')][_0xe144('0x41')](_0xe144('0x42'))){_0x3e19be[_0xe144('0x43')]=qs['limit'](_0x1c08b6[_0xe144('0x3b')]['limit']);_0x3e19be[_0xe144('0x2b')]=qs['offset'](_0x1c08b6[_0xe144('0x3b')][_0xe144('0x2b')]);}_0x3e19be[_0xe144('0x44')]=qs[_0xe144('0x45')](_0x1c08b6[_0xe144('0x3b')]['sort']);_0x3e19be[_0xe144('0x46')]=qs[_0xe144('0x3c')](_[_0xe144('0x47')](_0x1c08b6['query'],_0x4fbb89[_0xe144('0x3c')]),_0x13e127);if(_0x1c08b6['query'][_0xe144('0x48')]){_0x3e19be['where']=_['merge'](_0x3e19be[_0xe144('0x46')],{'$or':_[_0xe144('0x3a')](_0x13e127,function(_0x15309a){if(_0x15309a['type']!==_0xe144('0x49')){var _0x2fff9c={};_0x2fff9c[_0x15309a[_0xe144('0x34')]]={'$like':'%'+_0x1c08b6[_0xe144('0x3b')][_0xe144('0x48')]+'%'};return _0x2fff9c;}})});}_0x3e19be=_[_0xe144('0x4a')]({},_0x3e19be,_0x1c08b6[_0xe144('0x4b')]);var _0x5df1ed={'where':_0x3e19be[_0xe144('0x46')]};return db[_0xe144('0x37')][_0xe144('0x2a')](_0x5df1ed)[_0xe144('0x1a')](function(_0x37ef9e){_0xb9ec9e[_0xe144('0x2a')]=_0x37ef9e;if(_0x1c08b6[_0xe144('0x3b')][_0xe144('0x4c')]){_0x3e19be['include']=[{'all':!![]}];}return db[_0xe144('0x37')][_0xe144('0x4d')](_0x3e19be);})[_0xe144('0x1a')](function(_0x5cc4b3){_0xb9ec9e[_0xe144('0x4e')]=_0x5cc4b3;return _0xb9ec9e;})[_0xe144('0x1a')](respondWithFilteredResult(_0x33f9ac,_0x3e19be))[_0xe144('0x24')](handleError(_0x33f9ac,null));};exports['show']=function(_0x5489e7,_0x240035){var _0x99a227={'raw':!![],'where':{'id':_0x5489e7[_0xe144('0x4f')]['id']}},_0x39bde1={};_0x39bde1[_0xe144('0x39')]=_[_0xe144('0x50')](db[_0xe144('0x37')][_0xe144('0x51')]);_0x39bde1[_0xe144('0x3b')]=_[_0xe144('0x50')](_0x5489e7['query']);_0x39bde1[_0xe144('0x3c')]=_['intersection'](_0x39bde1[_0xe144('0x39')],_0x39bde1['query']);_0x99a227[_0xe144('0x3e')]=_[_0xe144('0x3d')](_0x39bde1['model'],qs[_0xe144('0x3f')](_0x5489e7['query'][_0xe144('0x3f')]));_0x99a227[_0xe144('0x3e')]=_0x99a227['attributes'][_0xe144('0x40')]?_0x99a227[_0xe144('0x3e')]:_0x39bde1[_0xe144('0x39')];if(_0x5489e7[_0xe144('0x3b')][_0xe144('0x4c')]){_0x99a227[_0xe144('0x52')]=[{'all':!![]}];}_0x99a227=_[_0xe144('0x4a')]({},_0x99a227,_0x5489e7[_0xe144('0x4b')]);return db[_0xe144('0x37')][_0xe144('0x53')](_0x99a227)[_0xe144('0x1a')](handleEntityNotFound(_0x240035,null))['then'](respondWithResult(_0x240035,null))[_0xe144('0x24')](handleError(_0x240035,null));};exports['update']=function(_0x821433,_0x3a3ea3){if(_0x821433[_0xe144('0x54')]['id']){delete _0x821433[_0xe144('0x54')]['id'];}return db[_0xe144('0x37')][_0xe144('0x53')]({'where':{'id':_0x821433[_0xe144('0x4f')]['id']}})[_0xe144('0x1a')](handleEntityNotFound(_0x3a3ea3,null))[_0xe144('0x1a')](saveUpdates(_0x821433[_0xe144('0x54')],null))[_0xe144('0x1a')](respondWithResult(_0x3a3ea3,null))[_0xe144('0x24')](handleError(_0x3a3ea3,null));};exports[_0xe144('0x32')]=function(_0x43f232,_0x483eca){return db[_0xe144('0x37')]['find']({'where':{'id':_0x43f232[_0xe144('0x4f')]['id']}})[_0xe144('0x1a')](handleEntityNotFound(_0x483eca,null))[_0xe144('0x1a')](removeEntity(_0x483eca,null))[_0xe144('0x24')](handleError(_0x483eca,null));};exports[_0xe144('0x55')]=function(_0x1d7812,_0x45274d){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x45274d,null))[_0xe144('0x24')](handleError(_0x45274d,null));};var interaction_log=require(_0xe144('0x11'))(_0xe144('0x56'));exports[_0xe144('0x57')]=function(_0x33dbd4,_0x2fe775,_0xb7204b){var _0x431c55={'agent':{},'channel':_0xe144('0x58')};if(_0x33dbd4[_0xe144('0x54')]['id']){delete _0x33dbd4[_0xe144('0x54')]['id'];}_0x33dbd4['body'][_0xe144('0x59')]=!![];_0x33dbd4[_0xe144('0x54')][_0xe144('0x5a')]=moment()[_0xe144('0x5b')](_0xe144('0x5c'));_0x33dbd4[_0xe144('0x54')][_0xe144('0x5d')]=_0x33dbd4[_0xe144('0x54')]['UserId']||_0x33dbd4[_0xe144('0x5e')]['id'];_0x431c55[_0xe144('0x5f')]['id']=_0x33dbd4[_0xe144('0x54')][_0xe144('0x5d')];return db['FaxMessage']['find']({'where':{'id':_0x33dbd4[_0xe144('0x4f')]['id'],'UserId':null}})[_0xe144('0x1a')](handleEntityNotFound(_0x2fe775,null))[_0xe144('0x1a')](saveUpdates(_0x33dbd4[_0xe144('0x54')],null))[_0xe144('0x1a')](function(_0x109e66){if(_0x109e66){_0x431c55[_0xe144('0x23')]=_0x109e66[_0xe144('0x60')]({'plain':!![]});return db[_0xe144('0x61')][_0xe144('0x53')]({'where':{'id':_0x109e66['FaxInteractionId']}});}return null;})[_0xe144('0x1a')](handleEntityNotFound(_0x2fe775,null))[_0xe144('0x1a')](function(_0x28564c){if(_0x28564c){return _0x28564c['update']({'UserId':_0x33dbd4[_0xe144('0x54')][_0xe144('0x5d')],'read1stAt':_[_0xe144('0x62')](_0x28564c[_0xe144('0x63')])?moment()['format'](_0xe144('0x5c')):undefined});}return null;})[_0xe144('0x1a')](function(_0x19ec8c){if(_0x19ec8c){_0x431c55['interaction']=_0x19ec8c[_0xe144('0x60')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33dbd4[_0xe144('0x5e')]['id'],_0x33dbd4[_0xe144('0x5e')][_0xe144('0x34')],_0x33dbd4[_0xe144('0x5e')]['role'],_0x431c55[_0xe144('0x64')]['id'],_0x33dbd4['body']?JSON[_0xe144('0x20')](_0x33dbd4[_0xe144('0x54')]):_0xe144('0x65'));return respondWithRpcPromise('AcceptMessage',_0xe144('0x66'),_0x431c55);}return null;})[_0xe144('0x1a')](function(_0x310653){var _0x90592d=_0xe144('0x67')+_0x310653[_0xe144('0x23')][_0xe144('0x68')];return db[_0xe144('0x69')][_0xe144('0x3b')](_0x90592d,{'type':db[_0xe144('0x6a')][_0xe144('0x6b')]['SELECT'],'raw':!![]})[_0xe144('0x1a')](function(_0x5bd107){return _0x5bd107;});})['then'](function(_0x24460f){if(_0x24460f){_0x431c55[_0xe144('0x23')]['contact']=_0x24460f[0x0];if(!_0x33dbd4[_0xe144('0x54')][_0xe144('0x5d')])return;return db[_0xe144('0x6c')]['find']({'where':{'id':_0x33dbd4[_0xe144('0x54')]['UserId'],'role':_0xe144('0x5f')},'attributes':['id',_0xe144('0x34'),_0xe144('0x6d'),_0xe144('0x6e'),'internal'],'raw':!![]});}return null;})[_0xe144('0x1a')](function(_0x528d2a){if(!_0x528d2a)return null;_0x431c55['message'][_0xe144('0x5f')]=_0x528d2a;return _0x431c55;})[_0xe144('0x1a')](function(_0x4a76d9){if(_0x4a76d9){if(_0x33dbd4[_0xe144('0x54')][_0xe144('0x6f')]){_0x431c55[_0xe144('0x23')]['interface']=util[_0xe144('0x5b')](_0xe144('0x70'),_0x33dbd4[_0xe144('0x5e')][_0xe144('0x34')]);_0x431c55[_0xe144('0x23')]['channel']=_0x431c55[_0xe144('0x71')];_0x431c55['message']['motionChannel']=_0x431c55[_0xe144('0x71')];_0x431c55[_0xe144('0x23')][_0xe144('0x72')]=_0xe144('0x57');return respondWithRpcPromise(_0xe144('0x73'),_0xe144('0x73'),{'event':_0xe144('0x74'),'message':_0x431c55[_0xe144('0x23')]},client9002)[_0xe144('0x1a')](function(){return _0x431c55;});}return _0x431c55;}return null;})[_0xe144('0x1a')](respondWithResult(_0x2fe775,null))[_0xe144('0x24')](handleError(_0x2fe775,null));};var interaction_log=require(_0xe144('0x11'))(_0xe144('0x56'));exports[_0xe144('0x2f')]=function(_0x5a59b3,_0x134be0,_0x9583cc){var _0x1b5f45={'agent':{},'channel':'fax'};if(_0x5a59b3['body']['id']){delete _0x5a59b3[_0xe144('0x54')]['id'];}_0x5a59b3[_0xe144('0x54')][_0xe144('0x5d')]=_0x5a59b3['body'][_0xe144('0x5d')]||_0x5a59b3['user']['id'];_0x1b5f45[_0xe144('0x5f')]['id']=_0x5a59b3['body'][_0xe144('0x5d')];return db[_0xe144('0x37')][_0xe144('0x53')]({'where':{'id':_0x5a59b3[_0xe144('0x4f')]['id'],'UserId':null}})[_0xe144('0x1a')](handleEntityNotFound(_0x134be0,null))[_0xe144('0x1a')](function(_0xd72085){if(_0xd72085){_0x1b5f45['message']=_0xd72085[_0xe144('0x60')]({'plain':!![]});return db[_0xe144('0x61')][_0xe144('0x53')]({'where':{'id':_0xd72085[_0xe144('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x134be0,null))['then'](function(_0x5db498){if(_0x5db498){_0x1b5f45['interaction']=_0x5db498['get']({'plain':!![]});interaction_log[_0xe144('0x1b')](_0xe144('0x76'),_0x5a59b3[_0xe144('0x5e')]['id'],_0x5a59b3[_0xe144('0x5e')][_0xe144('0x34')],_0x5a59b3['user'][_0xe144('0x77')],_0x1b5f45[_0xe144('0x64')]['id'],_0x5a59b3['body']?JSON[_0xe144('0x20')](_0x5a59b3[_0xe144('0x54')]):_0xe144('0x65'));return respondWithRpcPromise(_0xe144('0x78'),'rejectMessage',_0x1b5f45);}return null;})[_0xe144('0x1a')](function(_0x585c81){var _0x28889f=_0xe144('0x67')+_0x585c81[_0xe144('0x23')][_0xe144('0x68')];return db[_0xe144('0x69')][_0xe144('0x3b')](_0x28889f,{'type':db[_0xe144('0x6a')][_0xe144('0x6b')]['SELECT'],'raw':!![]})[_0xe144('0x1a')](function(_0x593ed8){return _0x593ed8;});})[_0xe144('0x1a')](function(_0x50c61f){if(_0x50c61f){_0x1b5f45['message'][_0xe144('0x79')]=_0x50c61f[0x0];if(!_0x5a59b3[_0xe144('0x54')][_0xe144('0x5d')])return;return db['User'][_0xe144('0x53')]({'where':{'id':_0x5a59b3[_0xe144('0x54')][_0xe144('0x5d')],'role':_0xe144('0x5f')},'attributes':['id',_0xe144('0x34'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xe144('0x1a')](function(_0x13fe0d){if(!_0x13fe0d)return null;_0x1b5f45[_0xe144('0x23')]['agent']=_0x13fe0d;return _0x1b5f45;})[_0xe144('0x1a')](function(_0xb5d505){if(_0xb5d505){_0xb5d505[_0xe144('0x23')][_0xe144('0x7a')]=util['format'](_0xe144('0x70'),_0x5a59b3[_0xe144('0x5e')][_0xe144('0x34')]);_0xb5d505[_0xe144('0x23')][_0xe144('0x71')]=_0x1b5f45[_0xe144('0x71')];_0xb5d505[_0xe144('0x23')][_0xe144('0x7b')]=_0x1b5f45[_0xe144('0x71')];_0xb5d505[_0xe144('0x23')][_0xe144('0x72')]=_0xe144('0x2f');respondWithRpcPromise(_0xe144('0x73'),_0xe144('0x73'),{'event':_0xe144('0x7c'),'message':_0xb5d505[_0xe144('0x23')]},client9002);return _0x1b5f45;}return null;})[_0xe144('0x1a')](respondWithResult(_0x134be0,null))[_0xe144('0x24')](handleError(_0x134be0,null));};exports[_0xe144('0x7d')]=function(_0x39c417,_0x14a807){var _0x52c32e;return db['FaxMessage'][_0xe144('0x7d')](_0x39c417[_0xe144('0x54')],{})[_0xe144('0x1a')](function(_0x1e84f8){_0x52c32e=_0x1e84f8;return db[_0xe144('0x7e')][_0xe144('0x7f')]({'where':{'id':_0x52c32e['ContactId']}});})[_0xe144('0x1a')](function(_0xebaf07){if(_[_0xe144('0x62')](_0xebaf07)){return;}else{_0x52c32e[_0xe144('0x58')]=_0xebaf07['fax'];return db[_0xe144('0x80')][_0xe144('0x7f')]({'where':{'id':_0x52c32e[_0xe144('0x81')]}});}})[_0xe144('0x1a')](function(_0x36915e){return respondWithRpcPromise('SendFax',_0xe144('0x82'),{'FaxAccountId':_[_0xe144('0x62')](_0x39c417[_0xe144('0x54')])?undefined:_0x39c417[_0xe144('0x54')][_0xe144('0x83')],'path':_[_0xe144('0x62')](_0x36915e)?undefined:util[_0xe144('0x5b')](_0xe144('0x84'),_0x36915e[_0xe144('0x85')]),'fax':_[_0xe144('0x62')](_0x52c32e['fax'])?undefined:_0x52c32e[_0xe144('0x58')],'AttachmentId':_0x52c32e['AttachmentId']},client9002);})[_0xe144('0x1a')](respondWithResult(_0x14a807,0xc9))[_0xe144('0x24')](handleError(_0x14a807,null));};exports[_0xe144('0x86')]=function(_0x3cd2f2,_0x322b6f){var _0x573dfe=path[_0xe144('0x87')](config[_0xe144('0x88')],_0xe144('0x89'),_0xe144('0x8a'),_0xe144('0x8b'));return db[_0xe144('0x37')][_0xe144('0x53')]({'where':{'id':_0x3cd2f2['params']['id']},'include':[{'model':db[_0xe144('0x80')],'as':_0xe144('0x80')}]})[_0xe144('0x1a')](handleEntityNotFound(_0x322b6f,null))[_0xe144('0x1a')](function(_0x19eb63){if(_0x19eb63){return _0x322b6f[_0xe144('0x86')](path[_0xe144('0x87')](_0x573dfe,_0x19eb63['Attachment'][_0xe144('0x85')]));}})[_0xe144('0x24')](handleError(_0x322b6f,null));}; \ No newline at end of file +var _0xcb82=['read','format','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','Sequelize','User','internal','motionChannel','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','attachments','Attachment','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','sendStatus','stack','name','map','FaxMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','find','update','body','describe','fax-interactions','accept','fax'];(function(_0x4d4cf5,_0x438e6a){var _0x4933a3=function(_0x271aa7){while(--_0x271aa7){_0x4d4cf5['push'](_0x4d4cf5['shift']());}};_0x4933a3(++_0x438e6a);}(_0xcb82,0x155));var _0x2cb8=function(_0x4edfec,_0x581a4a){_0x4edfec=_0x4edfec-0x0;var _0x22c10b=_0xcb82[_0x4edfec];return _0x22c10b;};'use strict';var emlformat=require(_0x2cb8('0x0'));var rimraf=require(_0x2cb8('0x1'));var zipdir=require(_0x2cb8('0x2'));var jsonpatch=require(_0x2cb8('0x3'));var rp=require(_0x2cb8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2cb8('0x5'));var util=require('util');var path=require(_0x2cb8('0x6'));var sox=require(_0x2cb8('0x7'));var csv=require(_0x2cb8('0x8'));var ejs=require(_0x2cb8('0x9'));var fs=require('fs');var fs_extra=require(_0x2cb8('0xa'));var _=require(_0x2cb8('0xb'));var squel=require(_0x2cb8('0xc'));var crypto=require(_0x2cb8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2cb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2cb8('0xf'));var Papa=require(_0x2cb8('0x10'));var Redis=require('ioredis');var authService=require(_0x2cb8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2cb8('0x12'));var hardwareService=require(_0x2cb8('0x13'));var logger=require(_0x2cb8('0x14'))(_0x2cb8('0x15'));var utils=require(_0x2cb8('0x16'));var config=require(_0x2cb8('0x17'));var licenseUtil=require(_0x2cb8('0x18'));var db=require(_0x2cb8('0x19'))['db'];config[_0x2cb8('0x1a')]=_[_0x2cb8('0x1b')](config[_0x2cb8('0x1a')],{'host':_0x2cb8('0x1c'),'port':0x18eb});var socket=require(_0x2cb8('0x1d'))(new Redis(config['redis']));require(_0x2cb8('0x1e'))[_0x2cb8('0x1f')](socket);var jayson=require(_0x2cb8('0x20'));var client=jayson[_0x2cb8('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x2cb8('0x21')][_0x2cb8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2a459c,_0x1aa101,_0x37e931,_0x4afad0){return new BPromise(function(_0x33efdf,_0x2ae6ee){var _0x4e86c3=_0x4afad0||client;return _0x4e86c3[_0x2cb8('0x23')](_0x2a459c,_0x37e931)[_0x2cb8('0x24')](function(_0x137492){logger[_0x2cb8('0x25')](_0x2cb8('0x26'),_0x1aa101,_0x2cb8('0x27'));logger[_0x2cb8('0x28')](_0x2cb8('0x29'),_0x1aa101,_0x2cb8('0x27'),JSON[_0x2cb8('0x2a')](_0x137492));if(_0x137492[_0x2cb8('0x2b')]){if(_0x137492[_0x2cb8('0x2b')]['code']===0x1f4){logger[_0x2cb8('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x1aa101,_0x137492[_0x2cb8('0x2b')]['message']);return _0x2ae6ee(_0x137492['error'][_0x2cb8('0x2c')]);}logger[_0x2cb8('0x2b')](_0x2cb8('0x26'),_0x1aa101,_0x137492[_0x2cb8('0x2b')][_0x2cb8('0x2c')]);return _0x33efdf(_0x137492[_0x2cb8('0x2b')][_0x2cb8('0x2c')]);}else{logger[_0x2cb8('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1aa101,'request\x20sent');_0x33efdf(_0x137492[_0x2cb8('0x2d')][_0x2cb8('0x2c')]);}})['catch'](function(_0x30cf3e){logger[_0x2cb8('0x2b')](_0x2cb8('0x26'),_0x1aa101,_0x30cf3e);_0x2ae6ee(_0x30cf3e);});});}function respondWithStatusCode(_0x37f176,_0x2887e9){_0x2887e9=_0x2887e9||0xcc;return function(_0x55a5d2){if(_0x55a5d2){return _0x37f176['sendStatus'](_0x2887e9);}return _0x37f176[_0x2cb8('0x2e')](_0x2887e9)[_0x2cb8('0x2f')]();};}function respondWithResult(_0x273f72,_0x56d58a){_0x56d58a=_0x56d58a||0xc8;return function(_0x2205c8){if(_0x2205c8){return _0x273f72['status'](_0x56d58a)[_0x2cb8('0x30')](_0x2205c8);}};}function respondWithFilteredResult(_0x4936bf,_0x3deb61){return function(_0xc38354){if(_0xc38354){var _0x24ffa1=typeof _0x3deb61[_0x2cb8('0x31')]==='undefined'&&typeof _0x3deb61['limit']===_0x2cb8('0x32');var _0x108b91=_0xc38354[_0x2cb8('0x33')];var _0x2872a9=_0x24ffa1?0x0:_0x3deb61[_0x2cb8('0x31')];var _0x179324=_0x24ffa1?_0xc38354['count']:_0x3deb61[_0x2cb8('0x31')]+_0x3deb61[_0x2cb8('0x34')];var _0x1f7ee9;if(_0x179324>=_0x108b91){_0x179324=_0x108b91;_0x1f7ee9=0xc8;}else{_0x1f7ee9=0xce;}_0x4936bf[_0x2cb8('0x2e')](_0x1f7ee9);return _0x4936bf[_0x2cb8('0x35')](_0x2cb8('0x36'),_0x2872a9+'-'+_0x179324+'/'+_0x108b91)[_0x2cb8('0x30')](_0xc38354);}return null;};}function patchUpdates(_0x51d380){return function(_0x66a382){try{jsonpatch[_0x2cb8('0x37')](_0x66a382,_0x51d380,!![]);}catch(_0x46a64a){return BPromise[_0x2cb8('0x38')](_0x46a64a);}return _0x66a382[_0x2cb8('0x39')]();};}function saveUpdates(_0x5d647a,_0x47be94){return function(_0x11503d){if(_0x11503d){return _0x11503d['update'](_0x5d647a)['then'](function(_0x4df69e){return _0x4df69e;});}return null;};}function removeEntity(_0x514122,_0x5d0400){return function(_0x30efc9){if(_0x30efc9){return _0x30efc9['destroy']()[_0x2cb8('0x24')](function(){_0x514122['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x112799,_0x24d710){return function(_0x4e4f4c){if(!_0x4e4f4c){_0x112799[_0x2cb8('0x3a')](0x194);}return _0x4e4f4c;};}function handleError(_0x417a7e,_0x399932){_0x399932=_0x399932||0x1f4;return function(_0x3830ad){logger['error'](_0x3830ad[_0x2cb8('0x3b')]);if(_0x3830ad[_0x2cb8('0x3c')]){delete _0x3830ad['name'];}_0x417a7e[_0x2cb8('0x2e')](_0x399932)['send'](_0x3830ad);};}exports['index']=function(_0x3e36e2,_0x533494){var _0x4bc1c2={},_0x4c8159={},_0x5afc27={'count':0x0,'rows':[]};var _0x34ff55=_[_0x2cb8('0x3d')](db[_0x2cb8('0x3e')][_0x2cb8('0x3f')],function(_0x40c80c){return{'name':_0x40c80c[_0x2cb8('0x40')],'type':_0x40c80c['type']['key']};});_0x4c8159['model']=_[_0x2cb8('0x3d')](_0x34ff55,_0x2cb8('0x3c'));_0x4c8159[_0x2cb8('0x41')]=_[_0x2cb8('0x42')](_0x3e36e2[_0x2cb8('0x41')]);_0x4c8159[_0x2cb8('0x43')]=_[_0x2cb8('0x44')](_0x4c8159[_0x2cb8('0x45')],_0x4c8159['query']);_0x4bc1c2[_0x2cb8('0x46')]=_[_0x2cb8('0x44')](_0x4c8159['model'],qs[_0x2cb8('0x47')](_0x3e36e2[_0x2cb8('0x41')]['fields']));_0x4bc1c2[_0x2cb8('0x46')]=_0x4bc1c2[_0x2cb8('0x46')]['length']?_0x4bc1c2['attributes']:_0x4c8159[_0x2cb8('0x45')];if(!_0x3e36e2[_0x2cb8('0x41')]['hasOwnProperty'](_0x2cb8('0x48'))){_0x4bc1c2['limit']=qs['limit'](_0x3e36e2[_0x2cb8('0x41')][_0x2cb8('0x34')]);_0x4bc1c2['offset']=qs[_0x2cb8('0x31')](_0x3e36e2[_0x2cb8('0x41')][_0x2cb8('0x31')]);}_0x4bc1c2['order']=qs[_0x2cb8('0x49')](_0x3e36e2[_0x2cb8('0x41')][_0x2cb8('0x49')]);_0x4bc1c2[_0x2cb8('0x4a')]=qs[_0x2cb8('0x43')](_[_0x2cb8('0x4b')](_0x3e36e2[_0x2cb8('0x41')],_0x4c8159[_0x2cb8('0x43')]),_0x34ff55);if(_0x3e36e2[_0x2cb8('0x41')][_0x2cb8('0x4c')]){_0x4bc1c2['where']=_['merge'](_0x4bc1c2[_0x2cb8('0x4a')],{'$or':_[_0x2cb8('0x3d')](_0x34ff55,function(_0x1196ac){if(_0x1196ac[_0x2cb8('0x4d')]!==_0x2cb8('0x4e')){var _0x10846f={};_0x10846f[_0x1196ac[_0x2cb8('0x3c')]]={'$like':'%'+_0x3e36e2[_0x2cb8('0x41')]['filter']+'%'};return _0x10846f;}})});}_0x4bc1c2=_[_0x2cb8('0x4f')]({},_0x4bc1c2,_0x3e36e2['options']);var _0x4c2267={'where':_0x4bc1c2[_0x2cb8('0x4a')]};return db[_0x2cb8('0x3e')][_0x2cb8('0x33')](_0x4c2267)[_0x2cb8('0x24')](function(_0x1f6317){_0x5afc27['count']=_0x1f6317;if(_0x3e36e2[_0x2cb8('0x41')][_0x2cb8('0x50')]){_0x4bc1c2['include']=[{'all':!![]}];}return db[_0x2cb8('0x3e')][_0x2cb8('0x51')](_0x4bc1c2);})['then'](function(_0x3d7bcf){_0x5afc27[_0x2cb8('0x52')]=_0x3d7bcf;return _0x5afc27;})[_0x2cb8('0x24')](respondWithFilteredResult(_0x533494,_0x4bc1c2))[_0x2cb8('0x53')](handleError(_0x533494,null));};exports[_0x2cb8('0x54')]=function(_0x39beb1,_0x446add){var _0x1b72fb={'raw':!![],'where':{'id':_0x39beb1[_0x2cb8('0x55')]['id']}},_0x2ab151={};_0x2ab151[_0x2cb8('0x45')]=_[_0x2cb8('0x42')](db[_0x2cb8('0x3e')][_0x2cb8('0x3f')]);_0x2ab151['query']=_[_0x2cb8('0x42')](_0x39beb1['query']);_0x2ab151[_0x2cb8('0x43')]=_['intersection'](_0x2ab151[_0x2cb8('0x45')],_0x2ab151[_0x2cb8('0x41')]);_0x1b72fb[_0x2cb8('0x46')]=_[_0x2cb8('0x44')](_0x2ab151[_0x2cb8('0x45')],qs[_0x2cb8('0x47')](_0x39beb1['query'][_0x2cb8('0x47')]));_0x1b72fb[_0x2cb8('0x46')]=_0x1b72fb[_0x2cb8('0x46')]['length']?_0x1b72fb[_0x2cb8('0x46')]:_0x2ab151[_0x2cb8('0x45')];if(_0x39beb1[_0x2cb8('0x41')]['includeAll']){_0x1b72fb[_0x2cb8('0x56')]=[{'all':!![]}];}_0x1b72fb=_[_0x2cb8('0x4f')]({},_0x1b72fb,_0x39beb1['options']);return db[_0x2cb8('0x3e')][_0x2cb8('0x57')](_0x1b72fb)[_0x2cb8('0x24')](handleEntityNotFound(_0x446add,null))[_0x2cb8('0x24')](respondWithResult(_0x446add,null))['catch'](handleError(_0x446add,null));};exports[_0x2cb8('0x58')]=function(_0x36b15a,_0x408518){if(_0x36b15a[_0x2cb8('0x59')]['id']){delete _0x36b15a[_0x2cb8('0x59')]['id'];}return db[_0x2cb8('0x3e')]['find']({'where':{'id':_0x36b15a[_0x2cb8('0x55')]['id']}})[_0x2cb8('0x24')](handleEntityNotFound(_0x408518,null))[_0x2cb8('0x24')](saveUpdates(_0x36b15a[_0x2cb8('0x59')],null))[_0x2cb8('0x24')](respondWithResult(_0x408518,null))['catch'](handleError(_0x408518,null));};exports['destroy']=function(_0x4bd52c,_0x3379da){return db['FaxMessage']['find']({'where':{'id':_0x4bd52c[_0x2cb8('0x55')]['id']}})['then'](handleEntityNotFound(_0x3379da,null))[_0x2cb8('0x24')](removeEntity(_0x3379da,null))[_0x2cb8('0x53')](handleError(_0x3379da,null));};exports[_0x2cb8('0x5a')]=function(_0x4b4bc5,_0x22691d){return db['FaxMessage'][_0x2cb8('0x5a')]()[_0x2cb8('0x24')](respondWithResult(_0x22691d,null))[_0x2cb8('0x53')](handleError(_0x22691d,null));};var interaction_log=require('../../config/logger')(_0x2cb8('0x5b'));exports[_0x2cb8('0x5c')]=function(_0x1ba257,_0x5a5333,_0x4b24a2){var _0xaafcb4={'agent':{},'channel':_0x2cb8('0x5d')};if(_0x1ba257[_0x2cb8('0x59')]['id']){delete _0x1ba257[_0x2cb8('0x59')]['id'];}_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x5e')]=!![];_0x1ba257[_0x2cb8('0x59')]['readAt']=moment()[_0x2cb8('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')]=_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')]||_0x1ba257['user']['id'];_0xaafcb4[_0x2cb8('0x61')]['id']=_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')];return db[_0x2cb8('0x3e')][_0x2cb8('0x57')]({'where':{'id':_0x1ba257[_0x2cb8('0x55')]['id'],'UserId':null}})[_0x2cb8('0x24')](handleEntityNotFound(_0x5a5333,null))['then'](saveUpdates(_0x1ba257[_0x2cb8('0x59')],null))[_0x2cb8('0x24')](function(_0x5f3c0c){if(_0x5f3c0c){_0xaafcb4['message']=_0x5f3c0c[_0x2cb8('0x62')]({'plain':!![]});return db[_0x2cb8('0x63')][_0x2cb8('0x57')]({'where':{'id':_0x5f3c0c[_0x2cb8('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5a5333,null))[_0x2cb8('0x24')](function(_0x1b8f97){if(_0x1b8f97){return _0x1b8f97[_0x2cb8('0x58')]({'UserId':_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')],'read1stAt':_[_0x2cb8('0x65')](_0x1b8f97[_0x2cb8('0x66')])?moment()[_0x2cb8('0x5f')](_0x2cb8('0x67')):undefined});}return null;})['then'](function(_0x4e0cc4){if(_0x4e0cc4){_0xaafcb4[_0x2cb8('0x68')]=_0x4e0cc4[_0x2cb8('0x62')]({'plain':!![]});interaction_log['info'](_0x2cb8('0x69'),_0x1ba257[_0x2cb8('0x6a')]['id'],_0x1ba257[_0x2cb8('0x6a')]['name'],_0x1ba257[_0x2cb8('0x6a')][_0x2cb8('0x6b')],_0xaafcb4['interaction']['id'],_0x1ba257[_0x2cb8('0x59')]?JSON[_0x2cb8('0x2a')](_0x1ba257[_0x2cb8('0x59')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xaafcb4);}return null;})['then'](function(_0x492ebd){var _0x558086=_0x2cb8('0x6c')+_0x492ebd[_0x2cb8('0x2c')][_0x2cb8('0x6d')];return db['sequelize'][_0x2cb8('0x41')](_0x558086,{'type':db['Sequelize'][_0x2cb8('0x6e')][_0x2cb8('0x6f')],'raw':!![]})[_0x2cb8('0x24')](function(_0xb79c7f){return _0xb79c7f;});})[_0x2cb8('0x24')](function(_0x444bb4){if(_0x444bb4){_0xaafcb4[_0x2cb8('0x2c')][_0x2cb8('0x70')]=_0x444bb4[0x0];if(!_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')])return;return db['User'][_0x2cb8('0x57')]({'where':{'id':_0x1ba257[_0x2cb8('0x59')][_0x2cb8('0x60')],'role':_0x2cb8('0x61')},'attributes':['id',_0x2cb8('0x3c'),'fullname',_0x2cb8('0x71'),'internal'],'raw':!![]});}return null;})[_0x2cb8('0x24')](function(_0x460876){if(!_0x460876)return null;_0xaafcb4[_0x2cb8('0x2c')]['agent']=_0x460876;return _0xaafcb4;})[_0x2cb8('0x24')](function(_0x2560c9){if(_0x2560c9){if(_0x1ba257['body'][_0x2cb8('0x72')]){_0xaafcb4[_0x2cb8('0x2c')][_0x2cb8('0x73')]=util[_0x2cb8('0x5f')](_0x2cb8('0x74'),_0x1ba257[_0x2cb8('0x6a')][_0x2cb8('0x3c')]);_0xaafcb4[_0x2cb8('0x2c')][_0x2cb8('0x75')]=_0xaafcb4[_0x2cb8('0x75')];_0xaafcb4[_0x2cb8('0x2c')]['motionChannel']=_0xaafcb4[_0x2cb8('0x75')];_0xaafcb4['message'][_0x2cb8('0x76')]='accept';return respondWithRpcPromise(_0x2cb8('0x77'),_0x2cb8('0x77'),{'event':_0x2cb8('0x78'),'message':_0xaafcb4['message']},client9002)[_0x2cb8('0x24')](function(){return _0xaafcb4;});}return _0xaafcb4;}return null;})[_0x2cb8('0x24')](respondWithResult(_0x5a5333,null))[_0x2cb8('0x53')](handleError(_0x5a5333,null));};var interaction_log=require(_0x2cb8('0x14'))(_0x2cb8('0x5b'));exports[_0x2cb8('0x38')]=function(_0x1a8a9e,_0x5ec1bc,_0x58b18d){var _0x177ea8={'agent':{},'channel':_0x2cb8('0x5d')};if(_0x1a8a9e[_0x2cb8('0x59')]['id']){delete _0x1a8a9e[_0x2cb8('0x59')]['id'];}_0x1a8a9e[_0x2cb8('0x59')]['UserId']=_0x1a8a9e[_0x2cb8('0x59')][_0x2cb8('0x60')]||_0x1a8a9e[_0x2cb8('0x6a')]['id'];_0x177ea8[_0x2cb8('0x61')]['id']=_0x1a8a9e[_0x2cb8('0x59')][_0x2cb8('0x60')];return db['FaxMessage']['find']({'where':{'id':_0x1a8a9e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ec1bc,null))[_0x2cb8('0x24')](function(_0x5d2d22){if(_0x5d2d22){_0x177ea8['message']=_0x5d2d22[_0x2cb8('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x2cb8('0x57')]({'where':{'id':_0x5d2d22[_0x2cb8('0x64')]}});}return null;})[_0x2cb8('0x24')](handleEntityNotFound(_0x5ec1bc,null))['then'](function(_0x421448){if(_0x421448){_0x177ea8[_0x2cb8('0x68')]=_0x421448['get']({'plain':!![]});interaction_log[_0x2cb8('0x25')](_0x2cb8('0x79'),_0x1a8a9e['user']['id'],_0x1a8a9e['user']['name'],_0x1a8a9e[_0x2cb8('0x6a')][_0x2cb8('0x6b')],_0x177ea8[_0x2cb8('0x68')]['id'],_0x1a8a9e[_0x2cb8('0x59')]?JSON[_0x2cb8('0x2a')](_0x1a8a9e[_0x2cb8('0x59')]):_0x2cb8('0x7a'));return respondWithRpcPromise(_0x2cb8('0x7b'),_0x2cb8('0x7c'),_0x177ea8);}return null;})[_0x2cb8('0x24')](function(_0x103754){var _0xc787ee=_0x2cb8('0x6c')+_0x103754[_0x2cb8('0x2c')]['ContactId'];return db[_0x2cb8('0x7d')][_0x2cb8('0x41')](_0xc787ee,{'type':db[_0x2cb8('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2cb8('0x24')](function(_0x5b92bb){return _0x5b92bb;});})[_0x2cb8('0x24')](function(_0x3747fd){if(_0x3747fd){_0x177ea8[_0x2cb8('0x2c')][_0x2cb8('0x70')]=_0x3747fd[0x0];if(!_0x1a8a9e[_0x2cb8('0x59')][_0x2cb8('0x60')])return;return db[_0x2cb8('0x7f')][_0x2cb8('0x57')]({'where':{'id':_0x1a8a9e['body']['UserId'],'role':'agent'},'attributes':['id',_0x2cb8('0x3c'),'fullname','email',_0x2cb8('0x80')],'raw':!![]});}return null;})[_0x2cb8('0x24')](function(_0xb2ecff){if(!_0xb2ecff)return null;_0x177ea8[_0x2cb8('0x2c')][_0x2cb8('0x61')]=_0xb2ecff;return _0x177ea8;})[_0x2cb8('0x24')](function(_0x24b49c){if(_0x24b49c){_0x24b49c[_0x2cb8('0x2c')][_0x2cb8('0x73')]=util[_0x2cb8('0x5f')](_0x2cb8('0x74'),_0x1a8a9e['user']['name']);_0x24b49c[_0x2cb8('0x2c')][_0x2cb8('0x75')]=_0x177ea8[_0x2cb8('0x75')];_0x24b49c[_0x2cb8('0x2c')][_0x2cb8('0x81')]=_0x177ea8[_0x2cb8('0x75')];_0x24b49c[_0x2cb8('0x2c')][_0x2cb8('0x76')]=_0x2cb8('0x38');respondWithRpcPromise(_0x2cb8('0x77'),_0x2cb8('0x77'),{'event':_0x2cb8('0x82'),'message':_0x24b49c[_0x2cb8('0x2c')]},client9002);return _0x177ea8;}return null;})[_0x2cb8('0x24')](respondWithResult(_0x5ec1bc,null))[_0x2cb8('0x53')](handleError(_0x5ec1bc,null));};exports[_0x2cb8('0x83')]=function(_0x34ab90,_0x1cb581){var _0x41f1be;return db['FaxMessage'][_0x2cb8('0x83')](_0x34ab90[_0x2cb8('0x59')],{})[_0x2cb8('0x24')](function(_0x5e303f){_0x41f1be=_0x5e303f;return db[_0x2cb8('0x84')][_0x2cb8('0x85')]({'where':{'id':_0x41f1be[_0x2cb8('0x6d')]}});})[_0x2cb8('0x24')](function(_0x18a491){if(_['isNil'](_0x18a491)){return;}else{_0x41f1be['fax']=_0x18a491[_0x2cb8('0x5d')];return db['Attachment'][_0x2cb8('0x85')]({'where':{'id':_0x41f1be[_0x2cb8('0x86')]}});}})[_0x2cb8('0x24')](function(_0x1d09e4){return respondWithRpcPromise(_0x2cb8('0x87'),'SendFax',{'FaxAccountId':_[_0x2cb8('0x65')](_0x34ab90['body'])?undefined:_0x34ab90['body'][_0x2cb8('0x88')],'path':_[_0x2cb8('0x65')](_0x1d09e4)?undefined:util[_0x2cb8('0x5f')](_0x2cb8('0x89'),_0x1d09e4[_0x2cb8('0x8a')]),'fax':_['isNil'](_0x41f1be[_0x2cb8('0x5d')])?undefined:_0x41f1be['fax'],'AttachmentId':_0x41f1be[_0x2cb8('0x86')]},client9002);})[_0x2cb8('0x24')](respondWithResult(_0x1cb581,0xc9))[_0x2cb8('0x53')](handleError(_0x1cb581,null));};exports[_0x2cb8('0x8b')]=function(_0x392446,_0x1fcb41){var _0x2477c4=path['join'](config[_0x2cb8('0x8c')],_0x2cb8('0x8d'),'files',_0x2cb8('0x8e'));return db['FaxMessage']['find']({'where':{'id':_0x392446[_0x2cb8('0x55')]['id']},'include':[{'model':db[_0x2cb8('0x8f')],'as':'Attachment'}]})[_0x2cb8('0x24')](handleEntityNotFound(_0x1fcb41,null))[_0x2cb8('0x24')](function(_0x31ac43){if(_0x31ac43){return _0x1fcb41[_0x2cb8('0x8b')](path[_0x2cb8('0x90')](_0x2477c4,_0x31ac43[_0x2cb8('0x8f')]['basename']));}})[_0x2cb8('0x53')](handleError(_0x1fcb41,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 39940fb..3a2c6d5 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 _0x794b=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x794b,0x1c2));var _0xb794=function(_0xb17247,_0x4b94b5){_0xb17247=_0xb17247-0x0;var _0x3473ff=_0x794b[_0xb17247];return _0x3473ff;};'use strict';var EventEmitter=require(_0xb794('0x0'));var FaxMessage=require(_0xb794('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb794('0x2')](0x0);var events={'afterCreate':_0xb794('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf9af2a){return function(_0x241c85,_0x4d00a4,_0x5dc6dc){FaxMessageEvents[_0xb794('0x4')](_0xf9af2a+':'+_0x241c85['id'],_0x241c85);FaxMessageEvents[_0xb794('0x4')](_0xf9af2a,_0x241c85);_0x5dc6dc(null);};}for(var e in events){if(events[_0xb794('0x5')](e)){var event=events[e];FaxMessage[_0xb794('0x6')](e,emitEvent(event));}}module[_0xb794('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xad68=['remove','emit','hook','exports','FaxMessage','setMaxListeners'];(function(_0x5f2fea,_0x9fde07){var _0x198a0c=function(_0x2bb11a){while(--_0x2bb11a){_0x5f2fea['push'](_0x5f2fea['shift']());}};_0x198a0c(++_0x9fde07);}(_0xad68,0x100));var _0x8ad6=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xad68[_0x543242];return _0x4c99b6;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x8ad6('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8ad6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8ad6('0x2')};function emitEvent(_0x2b533e){return function(_0x186cec,_0x1aec69,_0x11451d){FaxMessageEvents[_0x8ad6('0x3')](_0x2b533e+':'+_0x186cec['id'],_0x186cec);FaxMessageEvents[_0x8ad6('0x3')](_0x2b533e,_0x186cec);_0x11451d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x8ad6('0x4')](e,emitEvent(event));}}module[_0x8ad6('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index daaf5f3..effa0db 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 _0x3015=['then','update','catch','error','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x1d3e3f,_0x495ec1){var _0x3879fa=function(_0x12e542){while(--_0x12e542){_0x1d3e3f['push'](_0x1d3e3f['shift']());}};_0x3879fa(++_0x495ec1);}(_0x3015,0xde));var _0x5301=function(_0x377602,_0x339d45){_0x377602=_0x377602-0x0;var _0x309b87=_0x3015[_0x377602];return _0x309b87;};'use strict';var _=require('lodash');var util=require(_0x5301('0x0'));var logger=require(_0x5301('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5301('0x2'));var rp=require(_0x5301('0x3'));var fs=require('fs');var path=require(_0x5301('0x4'));var rimraf=require(_0x5301('0x5'));var config=require(_0x5301('0x6'));var attributes=require(_0x5301('0x7'));module[_0x5301('0x8')]=function(_0x4b6c66,_0x3c5ed5){return _0x4b6c66[_0x5301('0x9')](_0x5301('0xa'),attributes,{'tableName':_0x5301('0xb'),'paranoid':![],'indexes':[{'name':_0x5301('0xc'),'fields':[_0x5301('0xd')],'type':_0x5301('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33c3ff,_0x16ac95,_0x3b8ba6){var _0x17663e=_0x4b6c66[_0x5301('0xf')];var _0x5e5a7f=_0x33c3ff[_0x5301('0x10')]({'plain':!![]});if(_0x5e5a7f[_0x5301('0x11')][_0x5301('0x12')]()==='in'||_0x5e5a7f[_0x5301('0x11')][_0x5301('0x12')]()===_0x5301('0x13')&&!_0x5e5a7f[_0x5301('0x14')]&&!_[_0x5301('0x15')](_0x5e5a7f[_0x5301('0x16')])){_0x17663e[_0x5301('0x17')][_0x5301('0x18')]({'where':{'id':_0x5e5a7f[_0x5301('0x19')]}})[_0x5301('0x1a')](function(_0x44bea1){if(_0x44bea1){_0x44bea1[_0x5301('0x1b')]({'lastMsgAt':_0x5e5a7f['createdAt'],'lastMsgDirection':_0x5e5a7f[_0x5301('0x11')]['toLowerCase']()});}})[_0x5301('0x1c')](function(_0x21db31){console[_0x5301('0x1d')](_0x21db31);});}_0x3b8ba6();}},'charset':'utf8mb4','collate':_0x5301('0x1e')});}; \ No newline at end of file +var _0x4e2f=['FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x1612e9,_0x272ff8){var _0x5a39fd=function(_0x358eb9){while(--_0x358eb9){_0x1612e9['push'](_0x1612e9['shift']());}};_0x5a39fd(++_0x272ff8);}(_0x4e2f,0x157));var _0xf4e2=function(_0x180edc,_0x2be29c){_0x180edc=_0x180edc-0x0;var _0x15cbe2=_0x4e2f[_0x180edc];return _0x15cbe2;};'use strict';var _=require(_0xf4e2('0x0'));var util=require('util');var logger=require(_0xf4e2('0x1'))('api');var moment=require(_0xf4e2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4e2('0x3'));var rimraf=require(_0xf4e2('0x4'));var config=require(_0xf4e2('0x5'));var attributes=require(_0xf4e2('0x6'));module[_0xf4e2('0x7')]=function(_0x4d1e4b,_0x4b7d90){return _0x4d1e4b[_0xf4e2('0x8')](_0xf4e2('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xf4e2('0xa'),'fields':[_0xf4e2('0xb')],'type':_0xf4e2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40e14f,_0x2bdb10,_0x3d4683){var _0x94e21=_0x4d1e4b[_0xf4e2('0xd')];var _0x19d7ca=_0x40e14f[_0xf4e2('0xe')]({'plain':!![]});if(_0x19d7ca[_0xf4e2('0xf')][_0xf4e2('0x10')]()==='in'||_0x19d7ca[_0xf4e2('0xf')][_0xf4e2('0x10')]()===_0xf4e2('0x11')&&!_0x19d7ca[_0xf4e2('0x12')]&&!_[_0xf4e2('0x13')](_0x19d7ca[_0xf4e2('0x14')])){_0x94e21[_0xf4e2('0x15')][_0xf4e2('0x16')]({'where':{'id':_0x19d7ca['FaxInteractionId']}})['then'](function(_0x369b54){if(_0x369b54){_0x369b54[_0xf4e2('0x17')]({'lastMsgAt':_0x19d7ca[_0xf4e2('0x18')],'lastMsgDirection':_0x19d7ca[_0xf4e2('0xf')]['toLowerCase']()});}})[_0xf4e2('0x19')](function(_0x3074b8){console[_0xf4e2('0x1a')](_0x3074b8);});}_0x3d4683();}},'charset':_0xf4e2('0x1b'),'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 16bd647..2d3c433 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 _0x00bb=['redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','update','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x50922a,_0x7d309){var _0x5b0c88=function(_0x5008a7){while(--_0x5008a7){_0x50922a['push'](_0x50922a['shift']());}};_0x5b0c88(++_0x7d309);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb00b('0x8')]=_[_0xb00b('0x9')](config[_0xb00b('0x8')],{'host':_0xb00b('0xa'),'port':0x18eb});var socket=require(_0xb00b('0xb'))(new Redis(config[_0xb00b('0x8')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5154d9,_0x1e9b7b,_0x5851d4){return new BPromise(function(_0x46a25c,_0x28d3cc){return client['request'](_0x5154d9,_0x5851d4)[_0xb00b('0xc')](function(_0x5a63ed){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));logger[_0xb00b('0xe')](_0xb00b('0xf'),_0x1e9b7b,_0xb00b('0xd'),JSON[_0xb00b('0x10')](_0x5a63ed));if(_0x5a63ed[_0xb00b('0x11')]){if(_0x5a63ed['error'][_0xb00b('0x12')]===0x1f4){logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);return _0x28d3cc(_0x5a63ed['error']['message']);}logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed['error'][_0xb00b('0x13')]);return _0x46a25c(_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);}else{logger[_0xb00b('0x14')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));_0x46a25c(_0x5a63ed['result'][_0xb00b('0x13')]);}})['catch'](function(_0x25d7a0){logger['error'](_0xb00b('0x15'),_0x1e9b7b,_0x25d7a0);_0x28d3cc(_0x25d7a0);});});}exports[_0xb00b('0x16')]=function(_0x53ee68){var _0x55770c=this;return new Promise(function(_0x2b0da1,_0x4a334b){return db[_0xb00b('0x17')][_0xb00b('0x18')](_0x53ee68[_0xb00b('0x19')],{'raw':_0x53ee68[_0xb00b('0x1a')]?_0x53ee68['options'][_0xb00b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x25a973){logger[_0xb00b('0x14')]('CreateFaxMessage',_0x53ee68);logger[_0xb00b('0xe')](_0xb00b('0x16'),_0x53ee68,JSON['stringify'](_0x25a973));_0x2b0da1(_0x25a973);})[_0xb00b('0x1c')](function(_0x1f04d3){logger['error'](_0xb00b('0x16'),_0x1f04d3[_0xb00b('0x13')],_0x53ee68);_0x4a334b(_0x55770c[_0xb00b('0x11')](0x1f4,_0x1f04d3[_0xb00b('0x13')]));});});};exports['UpdateFaxMessage']=function(_0x50be6c){var _0x3785e9=this;return new Promise(function(_0x490380,_0x550587){return db['FaxMessage'][_0xb00b('0x1d')](_0x50be6c[_0xb00b('0x19')],{'raw':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')][_0xb00b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['where']||null:null,'attributes':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c['options'][_0xb00b('0x1e')]||null:null,'limit':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['limit']||null:null})[_0xb00b('0xc')](function(_0x280ed3){logger[_0xb00b('0x14')](_0xb00b('0x1f'),_0x50be6c);logger[_0xb00b('0xe')](_0xb00b('0x1f'),_0x50be6c,JSON[_0xb00b('0x10')](_0x280ed3));_0x490380(_0x280ed3);})[_0xb00b('0x1c')](function(_0x149c1a){logger['error'](_0xb00b('0x1f'),_0x149c1a[_0xb00b('0x13')],_0x50be6c);_0x550587(_0x3785e9['error'](0x1f4,_0x149c1a[_0xb00b('0x13')]));});});}; \ No newline at end of file +var _0x9a19=['http','redis','socket.io-emitter','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','update','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x9a19,0x114));var _0x99a1=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x9a19[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});config[_0x99a1('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99a1('0xe'))(new Redis(config[_0x99a1('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4696f6,_0xd7b568,_0x23db53){return new BPromise(function(_0x26473f,_0x1551a1){return client['request'](_0x4696f6,_0x23db53)[_0x99a1('0xf')](function(_0xdd29e1){logger[_0x99a1('0x10')](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));logger[_0x99a1('0x13')](_0x99a1('0x14'),_0xd7b568,_0x99a1('0x12'),JSON[_0x99a1('0x15')](_0xdd29e1));if(_0xdd29e1[_0x99a1('0x16')]){if(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x17')]===0x1f4){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')]['message']);return _0x1551a1(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);}logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);return _0x26473f(_0xdd29e1[_0x99a1('0x16')]['message']);}else{logger['info'](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));_0x26473f(_0xdd29e1[_0x99a1('0x19')][_0x99a1('0x18')]);}})[_0x99a1('0x1a')](function(_0x209021){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0x209021);_0x1551a1(_0x209021);});});}exports[_0x99a1('0x1b')]=function(_0x2d8cac){var _0x3c23c0=this;return new Promise(function(_0x5eabcb,_0x3023a1){return db[_0x99a1('0x1c')]['create'](_0x2d8cac[_0x99a1('0x1d')],{'raw':_0x2d8cac['options']?_0x2d8cac[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![]})[_0x99a1('0xf')](function(_0x2d3b82){logger['info'](_0x99a1('0x1b'),_0x2d8cac);logger[_0x99a1('0x13')]('CreateFaxMessage',_0x2d8cac,JSON[_0x99a1('0x15')](_0x2d3b82));_0x5eabcb(_0x2d3b82);})['catch'](function(_0x1f9800){logger[_0x99a1('0x16')](_0x99a1('0x1b'),_0x1f9800[_0x99a1('0x18')],_0x2d8cac);_0x3023a1(_0x3c23c0[_0x99a1('0x16')](0x1f4,_0x1f9800[_0x99a1('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x114b38){var _0x5dabd9=this;return new Promise(function(_0x5dc733,_0xafea84){return db[_0x99a1('0x1c')][_0x99a1('0x20')](_0x114b38[_0x99a1('0x1d')],{'raw':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')]['where']||null:null,'attributes':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x21')]||null:null,'limit':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x22')]||null:null})['then'](function(_0x37514e){logger[_0x99a1('0x10')](_0x99a1('0x23'),_0x114b38);logger[_0x99a1('0x13')](_0x99a1('0x23'),_0x114b38,JSON[_0x99a1('0x15')](_0x37514e));_0x5dc733(_0x37514e);})[_0x99a1('0x1a')](function(_0x26c23c){logger['error']('UpdateFaxMessage',_0x26c23c[_0x99a1('0x18')],_0x114b38);_0xafea84(_0x5dabd9['error'](0x1f4,_0x26c23c[_0x99a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 71a5f93..6a59c03 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 _0x417d=['register','length','./faxMessage.events','save','removeListener'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x417d,0x156));var _0xd417=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x417d[_0x2b49bc];return _0x43cc65;};'use strict';var FaxMessageEvents=require(_0xd417('0x0'));var events=[_0xd417('0x1'),'remove','update'];function createListener(_0x838907,_0x36400c){return function(_0x48a29e){_0x36400c['emit'](_0x838907,_0x48a29e);};}function removeListener(_0x5affa9,_0x33b805){return function(){FaxMessageEvents[_0xd417('0x2')](_0x5affa9,_0x33b805);};}exports[_0xd417('0x3')]=function(_0x450095){for(var _0x2da2ee=0x0,_0x28ee3d=events[_0xd417('0x4')];_0x2da2ee<_0x28ee3d;_0x2da2ee++){var _0x11e160=events[_0x2da2ee];var _0x233fcd=createListener('faxMessage:'+_0x11e160,_0x450095);FaxMessageEvents['on'](_0x11e160,_0x233fcd);}}; \ No newline at end of file +var _0x2df1=['length','faxMessage:','./faxMessage.events','save','remove','update','removeListener','register'];(function(_0x3de3ba,_0x4cf9e7){var _0x148d13=function(_0x2fe925){while(--_0x2fe925){_0x3de3ba['push'](_0x3de3ba['shift']());}};_0x148d13(++_0x4cf9e7);}(_0x2df1,0xca));var _0x12df=function(_0x387825,_0x91d108){_0x387825=_0x387825-0x0;var _0x3a72d4=_0x2df1[_0x387825];return _0x3a72d4;};'use strict';var FaxMessageEvents=require(_0x12df('0x0'));var events=[_0x12df('0x1'),_0x12df('0x2'),_0x12df('0x3')];function createListener(_0x42a453,_0x40708e){return function(_0x15a2d0){_0x40708e['emit'](_0x42a453,_0x15a2d0);};}function removeListener(_0x324d26,_0x1139eb){return function(){FaxMessageEvents[_0x12df('0x4')](_0x324d26,_0x1139eb);};}exports[_0x12df('0x5')]=function(_0x1542d3){for(var _0x49f4de=0x0,_0x2e7401=events[_0x12df('0x6')];_0x49f4de<_0x2e7401;_0x49f4de++){var _0x248ecc=events[_0x49f4de];var _0x7f3dd6=createListener(_0x12df('0x7')+_0x248ecc,_0x1542d3);FaxMessageEvents['on'](_0x248ecc,_0x7f3dd6);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 960002d..7f06ff8 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 _0xf109=['update','/:id/accept','put','/:id/reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','fax','faxmessage:create','create'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf109,0xce));var _0x9f10=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf109[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0x8')]('/:id/download',auth[_0x9f10('0x9')](),controller[_0x9f10('0xe')]);router[_0x9f10('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x9f10('0x10'),_0x9f10('0x11')),controller[_0x9f10('0x12')]);router['put'](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0x13')]);router['put'](_0x9f10('0x14'),auth[_0x9f10('0x9')](),controller['accept']);router[_0x9f10('0x15')](_0x9f10('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x9f10('0x17')](_0x9f10('0xc'),auth['isAuthenticated'](),controller[_0x9f10('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0xcea2,0x15a));var _0x2cea=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcea2[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5035f65..79cff83 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 _0xa842=['STRING','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x30b9aa,_0x4da6b8){var _0x1a8ff0=function(_0x3dd6fb){while(--_0x3dd6fb){_0x30b9aa['push'](_0x30b9aa['shift']());}};_0x1a8ff0(++_0x4da6b8);}(_0xa842,0x8e));var _0x2a84=function(_0x330684,_0x122f42){_0x330684=_0x330684-0x0;var _0x1eda6b=_0xa842[_0x330684];return _0x1eda6b;};'use strict';var Sequelize=require(_0x2a84('0x0'));module[_0x2a84('0x1')]={'name':{'type':Sequelize[_0x2a84('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2a84('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a84('0x4')]('rrmemory',_0x2a84('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x65ac=['exports','STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x2571ff,_0x3abf38){var _0x13a088=function(_0x2b2e2c){while(--_0x2b2e2c){_0x2571ff['push'](_0x2571ff['shift']());}};_0x13a088(++_0x3abf38);}(_0x65ac,0x1a3));var _0xc65a=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x65ac[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xc65a('0x0'));module[_0xc65a('0x1')]={'name':{'type':Sequelize[_0xc65a('0x2')],'unique':_0xc65a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc65a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc65a('0x5')](_0xc65a('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc65a('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 edcd34e..95086fe 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 _0x3e2b=['send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueue','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','findAndCountAll','updatedAt','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','error','stack','name'];(function(_0x1247ba,_0x1742b8){var _0x10b7fb=function(_0xc6cb9){while(--_0xc6cb9){_0x1247ba['push'](_0x1247ba['shift']());}};_0x10b7fb(++_0x1742b8);}(_0x3e2b,0x170));var _0xb3e2=function(_0x33f013,_0x584f62){_0x33f013=_0x33f013-0x0;var _0x2e3af5=_0x3e2b[_0x33f013];return _0x2e3af5;};'use strict';var emlformat=require(_0xb3e2('0x0'));var rimraf=require(_0xb3e2('0x1'));var zipdir=require(_0xb3e2('0x2'));var jsonpatch=require(_0xb3e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb3e2('0x5'));var sox=require(_0xb3e2('0x6'));var csv=require(_0xb3e2('0x7'));var ejs=require(_0xb3e2('0x8'));var fs=require('fs');var fs_extra=require(_0xb3e2('0x9'));var _=require(_0xb3e2('0xa'));var squel=require(_0xb3e2('0xb'));var crypto=require(_0xb3e2('0xc'));var jsforce=require(_0xb3e2('0xd'));var deskjs=require(_0xb3e2('0xe'));var toCsv=require(_0xb3e2('0x7'));var querystring=require(_0xb3e2('0xf'));var Papa=require(_0xb3e2('0x10'));var Redis=require(_0xb3e2('0x11'));var authService=require(_0xb3e2('0x12'));var qs=require(_0xb3e2('0x13'));var as=require(_0xb3e2('0x14'));var hardwareService=require(_0xb3e2('0x15'));var logger=require(_0xb3e2('0x16'))('api');var utils=require(_0xb3e2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb3e2('0x18'));var db=require(_0xb3e2('0x19'))['db'];config[_0xb3e2('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb3e2('0x1b'))(new Redis(config[_0xb3e2('0x1a')]));require(_0xb3e2('0x1c'))[_0xb3e2('0x1d')](socket);function respondWithStatusCode(_0x287cab,_0x2e2dd4){_0x2e2dd4=_0x2e2dd4||0xcc;return function(_0x587b31){if(_0x587b31){return _0x287cab[_0xb3e2('0x1e')](_0x2e2dd4);}return _0x287cab[_0xb3e2('0x1f')](_0x2e2dd4)[_0xb3e2('0x20')]();};}function respondWithResult(_0x5751c1,_0x1a2752){_0x1a2752=_0x1a2752||0xc8;return function(_0x57d63b){if(_0x57d63b){return _0x5751c1[_0xb3e2('0x1f')](_0x1a2752)[_0xb3e2('0x21')](_0x57d63b);}};}function respondWithFilteredResult(_0x27fef7,_0x320cf2){return function(_0x1ab882){if(_0x1ab882){var _0x16f540=typeof _0x320cf2[_0xb3e2('0x22')]==='undefined'&&typeof _0x320cf2[_0xb3e2('0x23')]==='undefined';var _0x11fbbc=_0x1ab882['count'];var _0x332009=_0x16f540?0x0:_0x320cf2[_0xb3e2('0x22')];var _0x43f0e4=_0x16f540?_0x1ab882[_0xb3e2('0x24')]:_0x320cf2[_0xb3e2('0x22')]+_0x320cf2[_0xb3e2('0x23')];var _0x5c9fe8;if(_0x43f0e4>=_0x11fbbc){_0x43f0e4=_0x11fbbc;_0x5c9fe8=0xc8;}else{_0x5c9fe8=0xce;}_0x27fef7[_0xb3e2('0x1f')](_0x5c9fe8);return _0x27fef7[_0xb3e2('0x25')](_0xb3e2('0x26'),_0x332009+'-'+_0x43f0e4+'/'+_0x11fbbc)['json'](_0x1ab882);}return null;};}function patchUpdates(_0x518d70){return function(_0x42b812){try{jsonpatch['apply'](_0x42b812,_0x518d70,!![]);}catch(_0xe503e9){return BPromise[_0xb3e2('0x27')](_0xe503e9);}return _0x42b812[_0xb3e2('0x28')]();};}function saveUpdates(_0x43ce09,_0x3e709b){return function(_0x47fd79){if(_0x47fd79){return _0x47fd79[_0xb3e2('0x29')](_0x43ce09)[_0xb3e2('0x2a')](function(_0x5bc652){return _0x5bc652;});}return null;};}function removeEntity(_0x401cc6,_0x13f7c0){return function(_0x133146){if(_0x133146){return _0x133146['destroy']()[_0xb3e2('0x2a')](function(){var _0x147da9=_0x133146[_0xb3e2('0x2b')]({'plain':!![]});var _0x4d72c8=_0xb3e2('0x2c');return db[_0xb3e2('0x2d')]['destroy']({'where':{'type':_0x4d72c8,'resourceId':_0x147da9['id']}})[_0xb3e2('0x2a')](function(){return _0x133146;});})[_0xb3e2('0x2a')](function(){_0x401cc6[_0xb3e2('0x1f')](0xcc)[_0xb3e2('0x20')]();});}};}function handleEntityNotFound(_0x3d3806,_0x427db2){return function(_0x107ede){if(!_0x107ede){_0x3d3806[_0xb3e2('0x1e')](0x194);}return _0x107ede;};}function handleError(_0x53f3d1,_0x4773d2){_0x4773d2=_0x4773d2||0x1f4;return function(_0xa44ffb){logger[_0xb3e2('0x2e')](_0xa44ffb[_0xb3e2('0x2f')]);if(_0xa44ffb[_0xb3e2('0x30')]){delete _0xa44ffb[_0xb3e2('0x30')];}_0x53f3d1[_0xb3e2('0x1f')](_0x4773d2)[_0xb3e2('0x31')](_0xa44ffb);};}exports[_0xb3e2('0x32')]=function(_0xeb2a5e,_0x5ee059){var _0x3f2f91={},_0x3bfebf={},_0x291194={'count':0x0,'rows':[]};var _0x11ad45=_[_0xb3e2('0x33')](db['FaxQueue'][_0xb3e2('0x34')],function(_0x118c31){return{'name':_0x118c31[_0xb3e2('0x35')],'type':_0x118c31[_0xb3e2('0x36')]['key']};});_0x3bfebf[_0xb3e2('0x37')]=_[_0xb3e2('0x33')](_0x11ad45,_0xb3e2('0x30'));_0x3bfebf[_0xb3e2('0x38')]=_['keys'](_0xeb2a5e[_0xb3e2('0x38')]);_0x3bfebf[_0xb3e2('0x39')]=_[_0xb3e2('0x3a')](_0x3bfebf[_0xb3e2('0x37')],_0x3bfebf['query']);_0x3f2f91[_0xb3e2('0x3b')]=_[_0xb3e2('0x3a')](_0x3bfebf[_0xb3e2('0x37')],qs['fields'](_0xeb2a5e[_0xb3e2('0x38')][_0xb3e2('0x3c')]));_0x3f2f91[_0xb3e2('0x3b')]=_0x3f2f91[_0xb3e2('0x3b')][_0xb3e2('0x3d')]?_0x3f2f91[_0xb3e2('0x3b')]:_0x3bfebf[_0xb3e2('0x37')];if(!_0xeb2a5e[_0xb3e2('0x38')]['hasOwnProperty'](_0xb3e2('0x3e'))){_0x3f2f91[_0xb3e2('0x23')]=qs[_0xb3e2('0x23')](_0xeb2a5e[_0xb3e2('0x38')][_0xb3e2('0x23')]);_0x3f2f91[_0xb3e2('0x22')]=qs[_0xb3e2('0x22')](_0xeb2a5e['query']['offset']);}_0x3f2f91[_0xb3e2('0x3f')]=qs[_0xb3e2('0x40')](_0xeb2a5e[_0xb3e2('0x38')]['sort']);_0x3f2f91[_0xb3e2('0x41')]=qs[_0xb3e2('0x39')](_[_0xb3e2('0x42')](_0xeb2a5e[_0xb3e2('0x38')],_0x3bfebf[_0xb3e2('0x39')]),_0x11ad45);if(_0xeb2a5e['query'][_0xb3e2('0x43')]){_0x3f2f91[_0xb3e2('0x41')]=_[_0xb3e2('0x44')](_0x3f2f91[_0xb3e2('0x41')],{'$or':_[_0xb3e2('0x33')](_0x11ad45,function(_0x5ba0ce){if(_0x5ba0ce['type']!==_0xb3e2('0x45')){var _0x291cec={};_0x291cec[_0x5ba0ce[_0xb3e2('0x30')]]={'$like':'%'+_0xeb2a5e[_0xb3e2('0x38')][_0xb3e2('0x43')]+'%'};return _0x291cec;}})});}_0x3f2f91=_[_0xb3e2('0x44')]({},_0x3f2f91,_0xeb2a5e[_0xb3e2('0x46')]);var _0x5c3bda={'where':_0x3f2f91['where']};return db['FaxQueue'][_0xb3e2('0x24')](_0x5c3bda)[_0xb3e2('0x2a')](function(_0x581709){_0x291194[_0xb3e2('0x24')]=_0x581709;if(_0xeb2a5e[_0xb3e2('0x38')][_0xb3e2('0x47')]){_0x3f2f91[_0xb3e2('0x48')]=[{'all':!![]}];}return db[_0xb3e2('0x49')][_0xb3e2('0x4a')](_0x3f2f91);})[_0xb3e2('0x2a')](function(_0x1a9acf){_0x291194[_0xb3e2('0x4b')]=_0x1a9acf;return _0x291194;})[_0xb3e2('0x2a')](respondWithFilteredResult(_0x5ee059,_0x3f2f91))[_0xb3e2('0x4c')](handleError(_0x5ee059,null));};exports[_0xb3e2('0x4d')]=function(_0x1c31fc,_0x1ef6e6){var _0x13b15f={'raw':!![],'where':{'id':_0x1c31fc[_0xb3e2('0x4e')]['id']}},_0x190b0d={};_0x190b0d[_0xb3e2('0x37')]=_[_0xb3e2('0x4f')](db[_0xb3e2('0x49')]['rawAttributes']);_0x190b0d[_0xb3e2('0x38')]=_['keys'](_0x1c31fc[_0xb3e2('0x38')]);_0x190b0d['filters']=_[_0xb3e2('0x3a')](_0x190b0d['model'],_0x190b0d[_0xb3e2('0x38')]);_0x13b15f['attributes']=_['intersection'](_0x190b0d['model'],qs[_0xb3e2('0x3c')](_0x1c31fc['query'][_0xb3e2('0x3c')]));_0x13b15f[_0xb3e2('0x3b')]=_0x13b15f[_0xb3e2('0x3b')][_0xb3e2('0x3d')]?_0x13b15f[_0xb3e2('0x3b')]:_0x190b0d[_0xb3e2('0x37')];if(_0x1c31fc[_0xb3e2('0x38')][_0xb3e2('0x47')]){_0x13b15f[_0xb3e2('0x48')]=[{'all':!![]}];}_0x13b15f=_['merge']({},_0x13b15f,_0x1c31fc['options']);return db[_0xb3e2('0x49')][_0xb3e2('0x50')](_0x13b15f)[_0xb3e2('0x2a')](handleEntityNotFound(_0x1ef6e6,null))['then'](respondWithResult(_0x1ef6e6,null))[_0xb3e2('0x4c')](handleError(_0x1ef6e6,null));};exports[_0xb3e2('0x51')]=function(_0x5f38db,_0x479ea7){return db['FaxQueue'][_0xb3e2('0x51')](_0x5f38db[_0xb3e2('0x52')],{})[_0xb3e2('0x2a')](function(_0x2e3f89){var _0x165010=_0x5f38db[_0xb3e2('0x53')][_0xb3e2('0x2b')]({'plain':!![]});if(!_0x165010)throw new Error(_0xb3e2('0x54'));if(_0x165010[_0xb3e2('0x55')]===_0xb3e2('0x53')){var _0x11d7db=_0x2e3f89[_0xb3e2('0x2b')]({'plain':!![]});var _0x2a709b=_0xb3e2('0x2c');return db['UserProfileSection'][_0xb3e2('0x50')]({'where':{'name':_0x2a709b,'userProfileId':_0x165010[_0xb3e2('0x56')]},'raw':!![]})[_0xb3e2('0x2a')](function(_0x17f169){if(_0x17f169&&_0x17f169[_0xb3e2('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x11d7db[_0xb3e2('0x30')],'resourceId':_0x11d7db['id'],'type':_0x17f169[_0xb3e2('0x30')],'sectionId':_0x17f169['id']},{})['then'](function(){return _0x2e3f89;});}else{return _0x2e3f89;}})[_0xb3e2('0x4c')](function(_0x5fe955){logger[_0xb3e2('0x2e')](_0xb3e2('0x58'),_0x5fe955);throw _0x5fe955;});}return _0x2e3f89;})[_0xb3e2('0x2a')](respondWithResult(_0x479ea7,0xc9))[_0xb3e2('0x4c')](handleError(_0x479ea7,null));};exports[_0xb3e2('0x29')]=function(_0xa7c6d1,_0x4ab4f6){if(_0xa7c6d1[_0xb3e2('0x52')]['id']){delete _0xa7c6d1['body']['id'];}return db[_0xb3e2('0x49')][_0xb3e2('0x50')]({'where':{'id':_0xa7c6d1['params']['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x4ab4f6,null))['then'](saveUpdates(_0xa7c6d1[_0xb3e2('0x52')],null))[_0xb3e2('0x2a')](respondWithResult(_0x4ab4f6,null))['catch'](handleError(_0x4ab4f6,null));};exports[_0xb3e2('0x59')]=function(_0x40ad60,_0xcd9793){return db[_0xb3e2('0x49')][_0xb3e2('0x50')]({'where':{'id':_0x40ad60[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0xcd9793,null))[_0xb3e2('0x2a')](removeEntity(_0xcd9793,null))[_0xb3e2('0x4c')](handleError(_0xcd9793,null));};exports[_0xb3e2('0x5a')]=function(_0x236150,_0xcad97b){return db[_0xb3e2('0x49')]['describe']()[_0xb3e2('0x2a')](respondWithResult(_0xcad97b,null))[_0xb3e2('0x4c')](handleError(_0xcad97b,null));};exports[_0xb3e2('0x5b')]=function(_0x2f7983,_0x5642a3,_0x32c1ff){var _0x5cec40={'raw':!![],'where':{}},_0x5880dc={},_0x5b5091;return db[_0xb3e2('0x49')][_0xb3e2('0x5c')]({'where':{'id':_0x2f7983[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x5642a3,null))['then'](function(_0x5ed3c1){if(_0x5ed3c1){_0x5b5091=_0x5ed3c1[_0xb3e2('0x2b')]({'plain':!![]});_0x5880dc[_0xb3e2('0x37')]=_[_0xb3e2('0x4f')](db[_0xb3e2('0x5d')][_0xb3e2('0x34')]);_0x5880dc['query']=_[_0xb3e2('0x4f')](_0x2f7983[_0xb3e2('0x38')]);_0x5880dc['filters']=_['intersection'](_0x5880dc['model'],_0x5880dc['query']);_0x5cec40[_0xb3e2('0x3b')]=_[_0xb3e2('0x3a')](_0x5880dc[_0xb3e2('0x37')],qs[_0xb3e2('0x3c')](_0x2f7983['query'][_0xb3e2('0x3c')]));_0x5cec40[_0xb3e2('0x3b')]=_0x5cec40[_0xb3e2('0x3b')]['length']?_0x5cec40['attributes']:_0x5880dc[_0xb3e2('0x37')];if(!_0x2f7983[_0xb3e2('0x38')][_0xb3e2('0x5e')]('nolimit')){_0x5cec40['limit']=qs[_0xb3e2('0x23')](_0x2f7983[_0xb3e2('0x38')][_0xb3e2('0x23')]);_0x5cec40['offset']=qs[_0xb3e2('0x22')](_0x2f7983[_0xb3e2('0x38')][_0xb3e2('0x22')]);}_0x5cec40[_0xb3e2('0x3f')]=qs['sort'](_0x2f7983['query']['sort']);_0x5cec40[_0xb3e2('0x41')]=qs[_0xb3e2('0x39')](_[_0xb3e2('0x42')](_0x2f7983[_0xb3e2('0x38')],_0x5880dc[_0xb3e2('0x39')]));_0x5cec40[_0xb3e2('0x41')]['FaxQueueId']=_0x5ed3c1['id'];if(_0x2f7983[_0xb3e2('0x38')][_0xb3e2('0x43')]){_0x5cec40[_0xb3e2('0x41')]=_[_0xb3e2('0x44')](_0x5cec40[_0xb3e2('0x41')],{'$or':_[_0xb3e2('0x33')](_0x5cec40[_0xb3e2('0x3b')],function(_0x375a09){var _0x282e5b={};_0x282e5b[_0x375a09]={'$like':'%'+_0x2f7983[_0xb3e2('0x38')][_0xb3e2('0x43')]+'%'};return _0x282e5b;})});}_0x5cec40=_[_0xb3e2('0x44')]({},_0x5cec40,_0x2f7983[_0xb3e2('0x46')]);return db[_0xb3e2('0x5d')][_0xb3e2('0x4a')](_0x5cec40);}})['then'](function(_0x567fe6){if(_0x567fe6){return db['User'][_0xb3e2('0x5f')]({'where':{'id':_[_0xb3e2('0x33')](_0x567fe6,'UserId'),'role':'agent'},'attributes':['id','name','faxPause',_0xb3e2('0x60'),'createdAt']});}})[_0xb3e2('0x2a')](function(_0x5e806c){if(_0x5e806c){return{'count':_0x5e806c[_0xb3e2('0x24')],'rows':_['map'](_0x5e806c[_0xb3e2('0x4b')],function(_0x13de60){return{'membername':_0x13de60[_0xb3e2('0x30')],'UserId':_0x13de60['id'],'queue_name':_0x5b5091[_0xb3e2('0x30')],'FaxQueueId':_0x5b5091['id'],'interface':util['format']('%s/%s',_0xb3e2('0x61'),_0x13de60['name']),'penalty':0x0,'paused':_0x13de60['faxPause'],'createdAt':_0x13de60[_0xb3e2('0x62')],'updatedAt':_0x13de60[_0xb3e2('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb3e2('0x2a')](respondWithFilteredResult(_0x5642a3,_0x5cec40))[_0xb3e2('0x4c')](handleError(_0x5642a3,null));};exports[_0xb3e2('0x63')]=function(_0x2f8e2e,_0x4a7585,_0x469252){var _0x114858={};var _0x414340={};var _0x4bcdaa;var _0x1376d9;return db[_0xb3e2('0x49')][_0xb3e2('0x5c')]({'where':{'id':_0x2f8e2e[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x4a7585,null))['then'](function(_0x5196a5){if(_0x5196a5){_0x4bcdaa=_0x5196a5;_0x414340['model']=_[_0xb3e2('0x4f')](db[_0xb3e2('0x64')][_0xb3e2('0x34')]);_0x414340[_0xb3e2('0x38')]=_[_0xb3e2('0x4f')](_0x2f8e2e['query']);_0x414340['filters']=_[_0xb3e2('0x3a')](_0x414340[_0xb3e2('0x37')],_0x414340[_0xb3e2('0x38')]);_0x114858[_0xb3e2('0x3b')]=_[_0xb3e2('0x3a')](_0x414340['model'],qs[_0xb3e2('0x3c')](_0x2f8e2e['query'][_0xb3e2('0x3c')]));_0x114858[_0xb3e2('0x3b')]=_0x114858[_0xb3e2('0x3b')][_0xb3e2('0x3d')]?_0x114858[_0xb3e2('0x3b')]:_0x414340[_0xb3e2('0x37')];_0x114858[_0xb3e2('0x3f')]=qs[_0xb3e2('0x40')](_0x2f8e2e[_0xb3e2('0x38')][_0xb3e2('0x40')]);_0x114858[_0xb3e2('0x41')]=qs['filters'](_[_0xb3e2('0x42')](_0x2f8e2e[_0xb3e2('0x38')],_0x414340['filters']));if(_0x2f8e2e[_0xb3e2('0x38')]['filter']){_0x114858[_0xb3e2('0x41')]=_['merge'](_0x114858[_0xb3e2('0x41')],{'$or':_[_0xb3e2('0x33')](_0x114858[_0xb3e2('0x3b')],function(_0x4342d3){var _0x16de00={};_0x16de00[_0x4342d3]={'$like':'%'+_0x2f8e2e[_0xb3e2('0x38')][_0xb3e2('0x43')]+'%'};return _0x16de00;})});}_0x114858=_[_0xb3e2('0x44')]({},_0x114858,_0x2f8e2e[_0xb3e2('0x46')]);return _0x4bcdaa[_0xb3e2('0x63')](_0x114858);}})[_0xb3e2('0x2a')](function(_0x4a2db6){if(_0x4a2db6){_0x1376d9=_0x4a2db6[_0xb3e2('0x3d')];if(!_0x2f8e2e['query']['hasOwnProperty']('nolimit')){_0x114858[_0xb3e2('0x23')]=qs[_0xb3e2('0x23')](_0x2f8e2e['query'][_0xb3e2('0x23')]);_0x114858['offset']=qs[_0xb3e2('0x22')](_0x2f8e2e[_0xb3e2('0x38')][_0xb3e2('0x22')]);}return _0x4bcdaa[_0xb3e2('0x63')](_0x114858);}})[_0xb3e2('0x2a')](function(_0x39799d){if(_0x39799d){return _0x39799d?{'count':_0x1376d9,'rows':_0x39799d}:null;}})['then'](respondWithResult(_0x4a7585,null))[_0xb3e2('0x4c')](handleError(_0x4a7585,null));};exports[_0xb3e2('0x65')]=function(_0x42ef3c,_0xad7362,_0x3b36fb){var _0x82e9b0=_0x42ef3c[_0xb3e2('0x52')][_0xb3e2('0x66')];return db[_0xb3e2('0x64')][_0xb3e2('0x4a')]({'where':{'id':_0x82e9b0},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb3e2('0x67'),'attributes':['id',_0xb3e2('0x30'),_0xb3e2('0x68'),'voicePause','interface'],'raw':!![]}]})[_0xb3e2('0x2a')](function(_0xbe94e7){if(_0xbe94e7){var _0x294d71=_[_0xb3e2('0x69')](_0xbe94e7,function(_0x3e219c){var _0x73c8db=_0x3e219c[_0xb3e2('0x2b')]({'plain':!![]});return _0x73c8db[_0xb3e2('0x67')];});return db[_0xb3e2('0x49')][_0xb3e2('0x50')]({'where':{'id':_0x42ef3c[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](function(_0xd1231f){return db[_0xb3e2('0x6a')][_0xb3e2('0x6b')](function(_0x322f5c){return _0xd1231f[_0xb3e2('0x65')](_0x82e9b0,{'transaction':_0x322f5c})[_0xb3e2('0x2a')](function(){return BPromise[_0xb3e2('0x6c')](_0x294d71,function(_0x2860c9){return db[_0xb3e2('0x5d')]['findOrCreate']({'where':{'UserId':_0x2860c9['id'],'FaxQueueId':_0x42ef3c[_0xb3e2('0x4e')]['id']},'transaction':_0x322f5c});});})[_0xb3e2('0x2a')](function(){_0x294d71[_0xb3e2('0x6d')](function(_0x5725da){socket['emit'](_0xb3e2('0x6e'),{'UserId':_0x5725da['id'],'FaxQueueId':_0xd1231f['id']});});});});});}})[_0xb3e2('0x2a')](respondWithStatusCode(_0xad7362,null))[_0xb3e2('0x4c')](handleError(_0xad7362,null));};exports[_0xb3e2('0x6f')]=function(_0x371c39,_0x5cb3dc,_0x85069a){return db[_0xb3e2('0x64')][_0xb3e2('0x4a')]({'where':{'id':_0x371c39[_0xb3e2('0x38')][_0xb3e2('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb3e2('0x2a')](handleEntityNotFound(_0x5cb3dc,null))[_0xb3e2('0x2a')](function(_0x1fe552){var _0x36b55c=_['map'](_0x1fe552,'id');var _0x3336f5=[];var _0x1ddaf5=[];var _0x36a14d=squel[_0xb3e2('0x70')]();_0x36a14d[_0xb3e2('0x71')]('tq.TeamId')[_0xb3e2('0x72')](_0xb3e2('0x73'),'tq')[_0xb3e2('0x74')](_0xb3e2('0x75'),'ut',_0xb3e2('0x76'))[_0xb3e2('0x41')]('FaxQueueId\x20=\x20?',_0x371c39['params']['id']);for(var _0x7cb2e4=0x0;_0x7cb2e4<_0x1fe552[_0xb3e2('0x3d')];_0x7cb2e4+=0x1){let _0x1f9942=_0x1fe552[_0x7cb2e4];for(var _0x3b106d=0x0;_0x3b106d<_0x1f9942['Agents']['length'];_0x3b106d+=0x1){let _0x491bfa=_0x1f9942[_0xb3e2('0x67')][_0x3b106d];var _0x1e4d33=_0x36a14d[_0xb3e2('0x77')]();_0x1e4d33[_0xb3e2('0x41')](_0xb3e2('0x78'),_0x491bfa['id']);_0x1ddaf5[_0xb3e2('0x79')](db[_0xb3e2('0x6a')][_0xb3e2('0x38')](_0x1e4d33['toString'](),{'type':db[_0xb3e2('0x6a')][_0xb3e2('0x7a')][_0xb3e2('0x7b')]})[_0xb3e2('0x2a')](function(_0x184982){if(_0x184982['length']===0x1){return _0x491bfa['id'];}else{var _0xa577c8=_[_0xb3e2('0x7c')](_[_0xb3e2('0x33')](_0x184982,_0xb3e2('0x7d')),function(_0x14e29e){return _[_0xb3e2('0x7e')](_0x36b55c,_0x14e29e);});if(_0xa577c8){return _0x491bfa['id'];}}}));}}return BPromise['all'](_0x1ddaf5)[_0xb3e2('0x2a')](function(_0x508c95){_0x3336f5=_(_0x3336f5)[_0xb3e2('0x7f')](_0x508c95)[_0xb3e2('0x80')]()[_0xb3e2('0x81')]();return db[_0xb3e2('0x49')]['find']({'where':{'id':_0x371c39[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](function(_0xa7b113){return db['sequelize'][_0xb3e2('0x6b')](function(_0x51f4c5){return _0xa7b113[_0xb3e2('0x6f')](_0x371c39[_0xb3e2('0x38')][_0xb3e2('0x66')],{'transaction':_0x51f4c5})['then'](function(){if(!_[_0xb3e2('0x82')](_0x3336f5)){return _0xa7b113[_0xb3e2('0x83')](_0x3336f5,{'transaction':_0x51f4c5});}})['then'](function(){_0x3336f5[_0xb3e2('0x6d')](function(_0x3f3ae4){socket['emit'](_0xb3e2('0x84'),{'UserId':_0x3f3ae4,'FaxQueueId':_0xa7b113['id']});});});});});});})[_0xb3e2('0x2a')](respondWithStatusCode(_0x5cb3dc,null))['catch'](handleError(_0x5cb3dc,null));};exports[_0xb3e2('0x85')]=function(_0x1e4a50,_0x20951a,_0x2b1c9f){return db['FaxQueue'][_0xb3e2('0x50')]({'where':{'id':_0x1e4a50[_0xb3e2('0x4e')]['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x20951a,null))['then'](function(_0x877733){if(_0x877733){return _0x877733[_0xb3e2('0x85')](_0x1e4a50[_0xb3e2('0x52')][_0xb3e2('0x66')],_[_0xb3e2('0x86')](_0x1e4a50[_0xb3e2('0x52')],[_0xb3e2('0x66'),'id'])||{})[_0xb3e2('0x87')](function(_0x332b07){for(var _0x154de6=0x0;_0x154de6<_0x1e4a50[_0xb3e2('0x52')][_0xb3e2('0x66')][_0xb3e2('0x3d')];_0x154de6+=0x1){socket[_0xb3e2('0x88')](_0xb3e2('0x6e'),{'UserId':Number(_0x1e4a50[_0xb3e2('0x52')][_0xb3e2('0x66')][_0x154de6]),'FaxQueueId':Number(_0x1e4a50[_0xb3e2('0x4e')]['id'])});}return _0x332b07;});}})['then'](respondWithResult(_0x20951a,null))[_0xb3e2('0x4c')](handleError(_0x20951a,null));};exports[_0xb3e2('0x83')]=function(_0x4cf2fb,_0x2a41cd,_0x1cc61c){return db[_0xb3e2('0x49')][_0xb3e2('0x50')]({'where':{'id':_0x4cf2fb['params']['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x2a41cd,null))[_0xb3e2('0x2a')](function(_0x310065){if(_0x310065){return _0x310065[_0xb3e2('0x83')](_0x4cf2fb[_0xb3e2('0x38')]['ids'])[_0xb3e2('0x2a')](function(){if(_[_0xb3e2('0x89')](_0x4cf2fb[_0xb3e2('0x38')][_0xb3e2('0x66')])){for(var _0x4a7dce=0x0;_0x4a7dce<_0x4cf2fb[_0xb3e2('0x38')]['ids']['length'];_0x4a7dce+=0x1){socket['emit'](_0xb3e2('0x84'),{'UserId':Number(_0x4cf2fb[_0xb3e2('0x38')][_0xb3e2('0x66')][_0x4a7dce]),'FaxQueueId':Number(_0x4cf2fb['params']['id'])});}}else{socket['emit'](_0xb3e2('0x84'),{'UserId':Number(_0x4cf2fb[_0xb3e2('0x38')][_0xb3e2('0x66')]),'FaxQueueId':Number(_0x4cf2fb[_0xb3e2('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a41cd,null))[_0xb3e2('0x4c')](handleError(_0x2a41cd,null));};exports[_0xb3e2('0x8a')]=function(_0x3ab505,_0x15770a,_0xe8fefc){var _0xef2144={};var _0x22a597={};var _0x2d41f3;var _0x122778;return db[_0xb3e2('0x49')]['findOne']({'where':{'id':_0x3ab505['params']['id']}})[_0xb3e2('0x2a')](handleEntityNotFound(_0x15770a,null))[_0xb3e2('0x2a')](function(_0x5d5765){if(_0x5d5765){_0x2d41f3=_0x5d5765;_0x22a597[_0xb3e2('0x37')]=_[_0xb3e2('0x4f')](db['User'][_0xb3e2('0x34')]);_0x22a597[_0xb3e2('0x38')]=_[_0xb3e2('0x4f')](_0x3ab505[_0xb3e2('0x38')]);_0x22a597['filters']=_[_0xb3e2('0x3a')](_0x22a597['model'],_0x22a597[_0xb3e2('0x38')]);_0xef2144[_0xb3e2('0x3b')]=_[_0xb3e2('0x3a')](_0x22a597[_0xb3e2('0x37')],qs[_0xb3e2('0x3c')](_0x3ab505[_0xb3e2('0x38')]['fields']));_0xef2144[_0xb3e2('0x3b')]=_0xef2144[_0xb3e2('0x3b')][_0xb3e2('0x3d')]?_0xef2144[_0xb3e2('0x3b')]:_0x22a597[_0xb3e2('0x37')];_0xef2144[_0xb3e2('0x3f')]=qs[_0xb3e2('0x40')](_0x3ab505[_0xb3e2('0x38')][_0xb3e2('0x40')]);_0xef2144[_0xb3e2('0x41')]=qs[_0xb3e2('0x39')](_[_0xb3e2('0x42')](_0x3ab505[_0xb3e2('0x38')],_0x22a597['filters']));if(_0x3ab505['query']['filter']){_0xef2144[_0xb3e2('0x41')]=_[_0xb3e2('0x44')](_0xef2144[_0xb3e2('0x41')],{'$or':_[_0xb3e2('0x33')](_0xef2144[_0xb3e2('0x3b')],function(_0x45bd84){var _0x2dfc15={};_0x2dfc15[_0x45bd84]={'$like':'%'+_0x3ab505[_0xb3e2('0x38')][_0xb3e2('0x43')]+'%'};return _0x2dfc15;})});}_0xef2144=_['merge']({},_0xef2144,_0x3ab505[_0xb3e2('0x46')]);return _0x2d41f3[_0xb3e2('0x8a')](_0xef2144);}})[_0xb3e2('0x2a')](function(_0x4775cd){if(_0x4775cd){_0x122778=_0x4775cd[_0xb3e2('0x3d')];if(!_0x3ab505[_0xb3e2('0x38')][_0xb3e2('0x5e')](_0xb3e2('0x3e'))){_0xef2144[_0xb3e2('0x23')]=qs[_0xb3e2('0x23')](_0x3ab505[_0xb3e2('0x38')][_0xb3e2('0x23')]);_0xef2144[_0xb3e2('0x22')]=qs[_0xb3e2('0x22')](_0x3ab505['query']['offset']);}return _0x2d41f3['getAgents'](_0xef2144);}})[_0xb3e2('0x2a')](function(_0x4cb00c){if(_0x4cb00c){return _0x4cb00c?{'count':_0x122778,'rows':_0x4cb00c}:null;}})['then'](respondWithResult(_0x15770a,null))[_0xb3e2('0x4c')](handleError(_0x15770a,null));}; \ No newline at end of file +var _0x3aff=['push','toString','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','show','params','rawAttributes','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','createdAt','rows','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','User','Agents','voicePause','sequelize','transaction','each','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x3aff,0x128));var _0xf3af=function(_0x4076cf,_0x5b5b8b){_0x4076cf=_0x4076cf-0x0;var _0xee24fe=_0x3aff[_0x4076cf];return _0xee24fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3af('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3af('0x1'));var moment=require(_0xf3af('0x2'));var BPromise=require(_0xf3af('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf3af('0x4'));var sox=require(_0xf3af('0x5'));var csv=require(_0xf3af('0x6'));var ejs=require(_0xf3af('0x7'));var fs=require('fs');var fs_extra=require(_0xf3af('0x8'));var _=require('lodash');var squel=require(_0xf3af('0x9'));var crypto=require('crypto');var jsforce=require(_0xf3af('0xa'));var deskjs=require(_0xf3af('0xb'));var toCsv=require(_0xf3af('0x6'));var querystring=require(_0xf3af('0xc'));var Papa=require('papaparse');var Redis=require(_0xf3af('0xd'));var authService=require(_0xf3af('0xe'));var qs=require(_0xf3af('0xf'));var as=require(_0xf3af('0x10'));var hardwareService=require(_0xf3af('0x11'));var logger=require('../../config/logger')(_0xf3af('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3af('0x13'));var db=require(_0xf3af('0x14'))['db'];config[_0xf3af('0x15')]=_[_0xf3af('0x16')](config['redis'],{'host':_0xf3af('0x17'),'port':0x18eb});var socket=require(_0xf3af('0x18'))(new Redis(config[_0xf3af('0x15')]));require(_0xf3af('0x19'))['register'](socket);function respondWithStatusCode(_0x333180,_0x5253d7){_0x5253d7=_0x5253d7||0xcc;return function(_0x3c44da){if(_0x3c44da){return _0x333180[_0xf3af('0x1a')](_0x5253d7);}return _0x333180[_0xf3af('0x1b')](_0x5253d7)[_0xf3af('0x1c')]();};}function respondWithResult(_0x393a9b,_0x39384e){_0x39384e=_0x39384e||0xc8;return function(_0x5097b6){if(_0x5097b6){return _0x393a9b['status'](_0x39384e)['json'](_0x5097b6);}};}function respondWithFilteredResult(_0x5b5be8,_0x403e36){return function(_0x38af48){if(_0x38af48){var _0x5e2567=typeof _0x403e36[_0xf3af('0x1d')]===_0xf3af('0x1e')&&typeof _0x403e36[_0xf3af('0x1f')]===_0xf3af('0x1e');var _0x477abc=_0x38af48['count'];var _0x240478=_0x5e2567?0x0:_0x403e36[_0xf3af('0x1d')];var _0x30b07a=_0x5e2567?_0x38af48[_0xf3af('0x20')]:_0x403e36[_0xf3af('0x1d')]+_0x403e36[_0xf3af('0x1f')];var _0x538254;if(_0x30b07a>=_0x477abc){_0x30b07a=_0x477abc;_0x538254=0xc8;}else{_0x538254=0xce;}_0x5b5be8[_0xf3af('0x1b')](_0x538254);return _0x5b5be8[_0xf3af('0x21')](_0xf3af('0x22'),_0x240478+'-'+_0x30b07a+'/'+_0x477abc)[_0xf3af('0x23')](_0x38af48);}return null;};}function patchUpdates(_0x3fd310){return function(_0x14e538){try{jsonpatch[_0xf3af('0x24')](_0x14e538,_0x3fd310,!![]);}catch(_0x3d292f){return BPromise[_0xf3af('0x25')](_0x3d292f);}return _0x14e538[_0xf3af('0x26')]();};}function saveUpdates(_0xa36a0b,_0x27c810){return function(_0x55cd09){if(_0x55cd09){return _0x55cd09[_0xf3af('0x27')](_0xa36a0b)[_0xf3af('0x28')](function(_0x57bc24){return _0x57bc24;});}return null;};}function removeEntity(_0x4b87a7,_0x41c896){return function(_0x27830f){if(_0x27830f){return _0x27830f[_0xf3af('0x29')]()[_0xf3af('0x28')](function(){var _0x56bd7c=_0x27830f['get']({'plain':!![]});var _0x3457af=_0xf3af('0x2a');return db[_0xf3af('0x2b')][_0xf3af('0x29')]({'where':{'type':_0x3457af,'resourceId':_0x56bd7c['id']}})[_0xf3af('0x28')](function(){return _0x27830f;});})[_0xf3af('0x28')](function(){_0x4b87a7[_0xf3af('0x1b')](0xcc)[_0xf3af('0x1c')]();});}};}function handleEntityNotFound(_0x29e480,_0x46f7a8){return function(_0x232d37){if(!_0x232d37){_0x29e480[_0xf3af('0x1a')](0x194);}return _0x232d37;};}function handleError(_0x2dda55,_0xff66a2){_0xff66a2=_0xff66a2||0x1f4;return function(_0x213065){logger[_0xf3af('0x2c')](_0x213065[_0xf3af('0x2d')]);if(_0x213065[_0xf3af('0x2e')]){delete _0x213065['name'];}_0x2dda55['status'](_0xff66a2)[_0xf3af('0x2f')](_0x213065);};}exports[_0xf3af('0x30')]=function(_0x47cb28,_0x542937){var _0x190ffb={},_0x36557f={},_0x4cd473={'count':0x0,'rows':[]};var _0x1a934e=_[_0xf3af('0x31')](db['FaxQueue']['rawAttributes'],function(_0x5eee0b){return{'name':_0x5eee0b[_0xf3af('0x32')],'type':_0x5eee0b[_0xf3af('0x33')][_0xf3af('0x34')]};});_0x36557f[_0xf3af('0x35')]=_[_0xf3af('0x31')](_0x1a934e,_0xf3af('0x2e'));_0x36557f[_0xf3af('0x36')]=_[_0xf3af('0x37')](_0x47cb28[_0xf3af('0x36')]);_0x36557f[_0xf3af('0x38')]=_['intersection'](_0x36557f[_0xf3af('0x35')],_0x36557f['query']);_0x190ffb[_0xf3af('0x39')]=_[_0xf3af('0x3a')](_0x36557f['model'],qs['fields'](_0x47cb28[_0xf3af('0x36')][_0xf3af('0x3b')]));_0x190ffb[_0xf3af('0x39')]=_0x190ffb[_0xf3af('0x39')]['length']?_0x190ffb[_0xf3af('0x39')]:_0x36557f[_0xf3af('0x35')];if(!_0x47cb28[_0xf3af('0x36')][_0xf3af('0x3c')](_0xf3af('0x3d'))){_0x190ffb[_0xf3af('0x1f')]=qs['limit'](_0x47cb28[_0xf3af('0x36')][_0xf3af('0x1f')]);_0x190ffb[_0xf3af('0x1d')]=qs[_0xf3af('0x1d')](_0x47cb28[_0xf3af('0x36')][_0xf3af('0x1d')]);}_0x190ffb[_0xf3af('0x3e')]=qs[_0xf3af('0x3f')](_0x47cb28[_0xf3af('0x36')]['sort']);_0x190ffb[_0xf3af('0x40')]=qs[_0xf3af('0x38')](_['pick'](_0x47cb28[_0xf3af('0x36')],_0x36557f[_0xf3af('0x38')]),_0x1a934e);if(_0x47cb28[_0xf3af('0x36')][_0xf3af('0x41')]){_0x190ffb[_0xf3af('0x40')]=_[_0xf3af('0x42')](_0x190ffb[_0xf3af('0x40')],{'$or':_[_0xf3af('0x31')](_0x1a934e,function(_0x2d18c8){if(_0x2d18c8[_0xf3af('0x33')]!==_0xf3af('0x43')){var _0x464248={};_0x464248[_0x2d18c8[_0xf3af('0x2e')]]={'$like':'%'+_0x47cb28[_0xf3af('0x36')][_0xf3af('0x41')]+'%'};return _0x464248;}})});}_0x190ffb=_[_0xf3af('0x42')]({},_0x190ffb,_0x47cb28[_0xf3af('0x44')]);var _0xb0d964={'where':_0x190ffb['where']};return db[_0xf3af('0x45')][_0xf3af('0x20')](_0xb0d964)[_0xf3af('0x28')](function(_0xec023f){_0x4cd473[_0xf3af('0x20')]=_0xec023f;if(_0x47cb28['query']['includeAll']){_0x190ffb[_0xf3af('0x46')]=[{'all':!![]}];}return db[_0xf3af('0x45')][_0xf3af('0x47')](_0x190ffb);})[_0xf3af('0x28')](function(_0x5cafa4){_0x4cd473['rows']=_0x5cafa4;return _0x4cd473;})[_0xf3af('0x28')](respondWithFilteredResult(_0x542937,_0x190ffb))['catch'](handleError(_0x542937,null));};exports[_0xf3af('0x48')]=function(_0x1a1224,_0x55603d){var _0x7a29f4={'raw':!![],'where':{'id':_0x1a1224[_0xf3af('0x49')]['id']}},_0x3451ff={};_0x3451ff[_0xf3af('0x35')]=_['keys'](db['FaxQueue'][_0xf3af('0x4a')]);_0x3451ff[_0xf3af('0x36')]=_[_0xf3af('0x37')](_0x1a1224[_0xf3af('0x36')]);_0x3451ff[_0xf3af('0x38')]=_[_0xf3af('0x3a')](_0x3451ff[_0xf3af('0x35')],_0x3451ff[_0xf3af('0x36')]);_0x7a29f4[_0xf3af('0x39')]=_[_0xf3af('0x3a')](_0x3451ff[_0xf3af('0x35')],qs[_0xf3af('0x3b')](_0x1a1224[_0xf3af('0x36')]['fields']));_0x7a29f4[_0xf3af('0x39')]=_0x7a29f4[_0xf3af('0x39')][_0xf3af('0x4b')]?_0x7a29f4['attributes']:_0x3451ff['model'];if(_0x1a1224['query'][_0xf3af('0x4c')]){_0x7a29f4[_0xf3af('0x46')]=[{'all':!![]}];}_0x7a29f4=_[_0xf3af('0x42')]({},_0x7a29f4,_0x1a1224[_0xf3af('0x44')]);return db[_0xf3af('0x45')]['find'](_0x7a29f4)[_0xf3af('0x28')](handleEntityNotFound(_0x55603d,null))['then'](respondWithResult(_0x55603d,null))[_0xf3af('0x4d')](handleError(_0x55603d,null));};exports[_0xf3af('0x4e')]=function(_0x1f83a0,_0x4caaad){return db[_0xf3af('0x45')][_0xf3af('0x4e')](_0x1f83a0[_0xf3af('0x4f')],{})[_0xf3af('0x28')](function(_0x4e256f){var _0xf9e770=_0x1f83a0[_0xf3af('0x50')]['get']({'plain':!![]});if(!_0xf9e770)throw new Error(_0xf3af('0x51'));if(_0xf9e770['role']===_0xf3af('0x50')){var _0x239fd4=_0x4e256f[_0xf3af('0x52')]({'plain':!![]});var _0xd5a5f1='FaxQueues';return db[_0xf3af('0x53')][_0xf3af('0x54')]({'where':{'name':_0xd5a5f1,'userProfileId':_0xf9e770['userProfileId']},'raw':!![]})[_0xf3af('0x28')](function(_0x4ca386){if(_0x4ca386&&_0x4ca386['autoAssociation']===0x0){return db[_0xf3af('0x2b')][_0xf3af('0x4e')]({'name':_0x239fd4[_0xf3af('0x2e')],'resourceId':_0x239fd4['id'],'type':_0x4ca386[_0xf3af('0x2e')],'sectionId':_0x4ca386['id']},{})[_0xf3af('0x28')](function(){return _0x4e256f;});}else{return _0x4e256f;}})[_0xf3af('0x4d')](function(_0x8c2c1){logger[_0xf3af('0x2c')](_0xf3af('0x55'),_0x8c2c1);throw _0x8c2c1;});}return _0x4e256f;})[_0xf3af('0x28')](respondWithResult(_0x4caaad,0xc9))[_0xf3af('0x4d')](handleError(_0x4caaad,null));};exports['update']=function(_0x5c3175,_0x219463){if(_0x5c3175[_0xf3af('0x4f')]['id']){delete _0x5c3175[_0xf3af('0x4f')]['id'];}return db[_0xf3af('0x45')][_0xf3af('0x54')]({'where':{'id':_0x5c3175['params']['id']}})['then'](handleEntityNotFound(_0x219463,null))['then'](saveUpdates(_0x5c3175[_0xf3af('0x4f')],null))[_0xf3af('0x28')](respondWithResult(_0x219463,null))[_0xf3af('0x4d')](handleError(_0x219463,null));};exports[_0xf3af('0x29')]=function(_0x224bc2,_0x57eddb){return db['FaxQueue']['find']({'where':{'id':_0x224bc2[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x57eddb,null))[_0xf3af('0x28')](removeEntity(_0x57eddb,null))[_0xf3af('0x4d')](handleError(_0x57eddb,null));};exports[_0xf3af('0x56')]=function(_0x17c3c4,_0x2fa6bd){return db[_0xf3af('0x45')]['describe']()[_0xf3af('0x28')](respondWithResult(_0x2fa6bd,null))['catch'](handleError(_0x2fa6bd,null));};exports[_0xf3af('0x57')]=function(_0x4d86e8,_0x2de60c,_0x4189a6){var _0x57967f={'raw':!![],'where':{}},_0x119a71={},_0x239b7d;return db[_0xf3af('0x45')][_0xf3af('0x58')]({'where':{'id':_0x4d86e8[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x2de60c,null))[_0xf3af('0x28')](function(_0x2decd1){if(_0x2decd1){_0x239b7d=_0x2decd1[_0xf3af('0x52')]({'plain':!![]});_0x119a71[_0xf3af('0x35')]=_['keys'](db['UserFaxQueue'][_0xf3af('0x4a')]);_0x119a71['query']=_[_0xf3af('0x37')](_0x4d86e8[_0xf3af('0x36')]);_0x119a71['filters']=_[_0xf3af('0x3a')](_0x119a71[_0xf3af('0x35')],_0x119a71[_0xf3af('0x36')]);_0x57967f['attributes']=_[_0xf3af('0x3a')](_0x119a71[_0xf3af('0x35')],qs[_0xf3af('0x3b')](_0x4d86e8['query'][_0xf3af('0x3b')]));_0x57967f[_0xf3af('0x39')]=_0x57967f[_0xf3af('0x39')][_0xf3af('0x4b')]?_0x57967f[_0xf3af('0x39')]:_0x119a71['model'];if(!_0x4d86e8['query'][_0xf3af('0x3c')](_0xf3af('0x3d'))){_0x57967f['limit']=qs[_0xf3af('0x1f')](_0x4d86e8['query'][_0xf3af('0x1f')]);_0x57967f[_0xf3af('0x1d')]=qs[_0xf3af('0x1d')](_0x4d86e8[_0xf3af('0x36')][_0xf3af('0x1d')]);}_0x57967f[_0xf3af('0x3e')]=qs[_0xf3af('0x3f')](_0x4d86e8[_0xf3af('0x36')][_0xf3af('0x3f')]);_0x57967f['where']=qs['filters'](_[_0xf3af('0x59')](_0x4d86e8[_0xf3af('0x36')],_0x119a71[_0xf3af('0x38')]));_0x57967f[_0xf3af('0x40')][_0xf3af('0x5a')]=_0x2decd1['id'];if(_0x4d86e8[_0xf3af('0x36')][_0xf3af('0x41')]){_0x57967f['where']=_[_0xf3af('0x42')](_0x57967f[_0xf3af('0x40')],{'$or':_[_0xf3af('0x31')](_0x57967f['attributes'],function(_0x305f20){var _0xa66fe3={};_0xa66fe3[_0x305f20]={'$like':'%'+_0x4d86e8[_0xf3af('0x36')][_0xf3af('0x41')]+'%'};return _0xa66fe3;})});}_0x57967f=_[_0xf3af('0x42')]({},_0x57967f,_0x4d86e8['options']);return db[_0xf3af('0x5b')][_0xf3af('0x47')](_0x57967f);}})['then'](function(_0x2b4cf0){if(_0x2b4cf0){return db['User'][_0xf3af('0x5c')]({'where':{'id':_[_0xf3af('0x31')](_0x2b4cf0,_0xf3af('0x5d')),'role':_0xf3af('0x5e')},'attributes':['id','name',_0xf3af('0x5f'),'updatedAt',_0xf3af('0x60')]});}})[_0xf3af('0x28')](function(_0x29a006){if(_0x29a006){return{'count':_0x29a006['count'],'rows':_[_0xf3af('0x31')](_0x29a006[_0xf3af('0x61')],function(_0xc5b59f){return{'membername':_0xc5b59f[_0xf3af('0x2e')],'UserId':_0xc5b59f['id'],'queue_name':_0x239b7d[_0xf3af('0x2e')],'FaxQueueId':_0x239b7d['id'],'interface':util[_0xf3af('0x62')](_0xf3af('0x63'),_0xf3af('0x64'),_0xc5b59f[_0xf3af('0x2e')]),'penalty':0x0,'paused':_0xc5b59f['faxPause'],'createdAt':_0xc5b59f[_0xf3af('0x60')],'updatedAt':_0xc5b59f[_0xf3af('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf3af('0x28')](respondWithFilteredResult(_0x2de60c,_0x57967f))['catch'](handleError(_0x2de60c,null));};exports['getTeams']=function(_0x4d01c0,_0x48de07,_0x5f31eb){var _0x12c7ac={};var _0x492bac={};var _0x53d54b;var _0x1f0965;return db[_0xf3af('0x45')][_0xf3af('0x58')]({'where':{'id':_0x4d01c0[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x48de07,null))[_0xf3af('0x28')](function(_0xbd7d4f){if(_0xbd7d4f){_0x53d54b=_0xbd7d4f;_0x492bac[_0xf3af('0x35')]=_[_0xf3af('0x37')](db[_0xf3af('0x66')]['rawAttributes']);_0x492bac[_0xf3af('0x36')]=_[_0xf3af('0x37')](_0x4d01c0['query']);_0x492bac['filters']=_[_0xf3af('0x3a')](_0x492bac[_0xf3af('0x35')],_0x492bac[_0xf3af('0x36')]);_0x12c7ac[_0xf3af('0x39')]=_[_0xf3af('0x3a')](_0x492bac['model'],qs[_0xf3af('0x3b')](_0x4d01c0['query'][_0xf3af('0x3b')]));_0x12c7ac[_0xf3af('0x39')]=_0x12c7ac[_0xf3af('0x39')][_0xf3af('0x4b')]?_0x12c7ac[_0xf3af('0x39')]:_0x492bac[_0xf3af('0x35')];_0x12c7ac[_0xf3af('0x3e')]=qs[_0xf3af('0x3f')](_0x4d01c0['query']['sort']);_0x12c7ac[_0xf3af('0x40')]=qs['filters'](_[_0xf3af('0x59')](_0x4d01c0[_0xf3af('0x36')],_0x492bac['filters']));if(_0x4d01c0[_0xf3af('0x36')][_0xf3af('0x41')]){_0x12c7ac[_0xf3af('0x40')]=_['merge'](_0x12c7ac[_0xf3af('0x40')],{'$or':_[_0xf3af('0x31')](_0x12c7ac[_0xf3af('0x39')],function(_0x5bd41e){var _0x2fdd98={};_0x2fdd98[_0x5bd41e]={'$like':'%'+_0x4d01c0[_0xf3af('0x36')][_0xf3af('0x41')]+'%'};return _0x2fdd98;})});}_0x12c7ac=_[_0xf3af('0x42')]({},_0x12c7ac,_0x4d01c0[_0xf3af('0x44')]);return _0x53d54b[_0xf3af('0x67')](_0x12c7ac);}})[_0xf3af('0x28')](function(_0x1ee217){if(_0x1ee217){_0x1f0965=_0x1ee217[_0xf3af('0x4b')];if(!_0x4d01c0[_0xf3af('0x36')][_0xf3af('0x3c')]('nolimit')){_0x12c7ac[_0xf3af('0x1f')]=qs['limit'](_0x4d01c0['query'][_0xf3af('0x1f')]);_0x12c7ac[_0xf3af('0x1d')]=qs['offset'](_0x4d01c0[_0xf3af('0x36')][_0xf3af('0x1d')]);}return _0x53d54b[_0xf3af('0x67')](_0x12c7ac);}})[_0xf3af('0x28')](function(_0x836dd7){if(_0x836dd7){return _0x836dd7?{'count':_0x1f0965,'rows':_0x836dd7}:null;}})[_0xf3af('0x28')](respondWithResult(_0x48de07,null))[_0xf3af('0x4d')](handleError(_0x48de07,null));};exports[_0xf3af('0x68')]=function(_0x1fde8d,_0x1d9682,_0x6d3b44){var _0x38fb68=_0x1fde8d[_0xf3af('0x4f')][_0xf3af('0x69')];return db[_0xf3af('0x66')][_0xf3af('0x47')]({'where':{'id':_0x38fb68},'attributes':['id'],'include':[{'model':db[_0xf3af('0x6a')],'as':_0xf3af('0x6b'),'attributes':['id',_0xf3af('0x2e'),'online',_0xf3af('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0x5d78c0){if(_0x5d78c0){var _0x1f867c=_['flatMap'](_0x5d78c0,function(_0x49a089){var _0x2f9a85=_0x49a089[_0xf3af('0x52')]({'plain':!![]});return _0x2f9a85['Agents'];});return db[_0xf3af('0x45')][_0xf3af('0x54')]({'where':{'id':_0x1fde8d['params']['id']}})[_0xf3af('0x28')](function(_0xbf1fb4){return db[_0xf3af('0x6d')][_0xf3af('0x6e')](function(_0x34446e){return _0xbf1fb4[_0xf3af('0x68')](_0x38fb68,{'transaction':_0x34446e})[_0xf3af('0x28')](function(){return BPromise[_0xf3af('0x6f')](_0x1f867c,function(_0x376f96){return db[_0xf3af('0x5b')]['findOrCreate']({'where':{'UserId':_0x376f96['id'],'FaxQueueId':_0x1fde8d[_0xf3af('0x49')]['id']},'transaction':_0x34446e});});})[_0xf3af('0x28')](function(){_0x1f867c[_0xf3af('0x70')](function(_0x29af35){socket['emit']('userFaxQueue:save',{'UserId':_0x29af35['id'],'FaxQueueId':_0xbf1fb4['id']});});});});});}})['then'](respondWithStatusCode(_0x1d9682,null))[_0xf3af('0x4d')](handleError(_0x1d9682,null));};exports[_0xf3af('0x71')]=function(_0x324c4f,_0x44aab5,_0x466270){return db[_0xf3af('0x66')][_0xf3af('0x47')]({'where':{'id':_0x324c4f[_0xf3af('0x36')][_0xf3af('0x69')]},'attributes':['id'],'include':[{'model':db[_0xf3af('0x6a')],'as':_0xf3af('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf3af('0x28')](handleEntityNotFound(_0x44aab5,null))[_0xf3af('0x28')](function(_0x103a3b){var _0x5789cd=_[_0xf3af('0x31')](_0x103a3b,'id');var _0x1ef73c=[];var _0x420eeb=[];var _0x46df28=squel['select']();_0x46df28['field'](_0xf3af('0x72'))[_0xf3af('0x73')]('team_has_fax_queues','tq')[_0xf3af('0x74')](_0xf3af('0x75'),'ut',_0xf3af('0x76'))[_0xf3af('0x40')]('FaxQueueId\x20=\x20?',_0x324c4f[_0xf3af('0x49')]['id']);for(var _0x4e9637=0x0;_0x4e9637<_0x103a3b['length'];_0x4e9637+=0x1){let _0x2a2393=_0x103a3b[_0x4e9637];for(var _0x395cda=0x0;_0x395cda<_0x2a2393[_0xf3af('0x6b')]['length'];_0x395cda+=0x1){let _0x2e0227=_0x2a2393[_0xf3af('0x6b')][_0x395cda];var _0x58eb03=_0x46df28[_0xf3af('0x77')]();_0x58eb03['where'](_0xf3af('0x78'),_0x2e0227['id']);_0x420eeb[_0xf3af('0x79')](db[_0xf3af('0x6d')][_0xf3af('0x36')](_0x58eb03[_0xf3af('0x7a')](),{'type':db[_0xf3af('0x6d')]['QueryTypes']['SELECT']})[_0xf3af('0x28')](function(_0x56f754){if(_0x56f754[_0xf3af('0x4b')]===0x1){return _0x2e0227['id'];}else{var _0x11e1ec=_[_0xf3af('0x7b')](_[_0xf3af('0x31')](_0x56f754,_0xf3af('0x7c')),function(_0x3ffeb2){return _[_0xf3af('0x7d')](_0x5789cd,_0x3ffeb2);});if(_0x11e1ec){return _0x2e0227['id'];}}}));}}return BPromise[_0xf3af('0x7e')](_0x420eeb)[_0xf3af('0x28')](function(_0x2ed647){_0x1ef73c=_(_0x1ef73c)[_0xf3af('0x7f')](_0x2ed647)['compact']()[_0xf3af('0x80')]();return db[_0xf3af('0x45')]['find']({'where':{'id':_0x324c4f[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](function(_0x2d02cb){return db[_0xf3af('0x6d')]['transaction'](function(_0x52b5c9){return _0x2d02cb[_0xf3af('0x71')](_0x324c4f[_0xf3af('0x36')]['ids'],{'transaction':_0x52b5c9})['then'](function(){if(!_[_0xf3af('0x81')](_0x1ef73c)){return _0x2d02cb[_0xf3af('0x82')](_0x1ef73c,{'transaction':_0x52b5c9});}})[_0xf3af('0x28')](function(){_0x1ef73c['forEach'](function(_0x5a7780){socket[_0xf3af('0x83')](_0xf3af('0x84'),{'UserId':_0x5a7780,'FaxQueueId':_0x2d02cb['id']});});});});});});})[_0xf3af('0x28')](respondWithStatusCode(_0x44aab5,null))['catch'](handleError(_0x44aab5,null));};exports[_0xf3af('0x85')]=function(_0x3d0408,_0x5ef5bf,_0x29b01a){return db[_0xf3af('0x45')]['find']({'where':{'id':_0x3d0408[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x5ef5bf,null))[_0xf3af('0x28')](function(_0x23f52c){if(_0x23f52c){return _0x23f52c['addAgents'](_0x3d0408[_0xf3af('0x4f')][_0xf3af('0x69')],_[_0xf3af('0x86')](_0x3d0408[_0xf3af('0x4f')],[_0xf3af('0x69'),'id'])||{})[_0xf3af('0x87')](function(_0x1b35f2){for(var _0xe8603=0x0;_0xe8603<_0x3d0408[_0xf3af('0x4f')][_0xf3af('0x69')][_0xf3af('0x4b')];_0xe8603+=0x1){socket[_0xf3af('0x83')](_0xf3af('0x88'),{'UserId':Number(_0x3d0408['body'][_0xf3af('0x69')][_0xe8603]),'FaxQueueId':Number(_0x3d0408[_0xf3af('0x49')]['id'])});}return _0x1b35f2;});}})[_0xf3af('0x28')](respondWithResult(_0x5ef5bf,null))['catch'](handleError(_0x5ef5bf,null));};exports[_0xf3af('0x82')]=function(_0x2a1886,_0x68e471,_0x4de5e7){return db[_0xf3af('0x45')][_0xf3af('0x54')]({'where':{'id':_0x2a1886[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x68e471,null))[_0xf3af('0x28')](function(_0x43e307){if(_0x43e307){return _0x43e307['removeAgents'](_0x2a1886[_0xf3af('0x36')][_0xf3af('0x69')])[_0xf3af('0x28')](function(){if(_[_0xf3af('0x89')](_0x2a1886[_0xf3af('0x36')][_0xf3af('0x69')])){for(var _0x47d75f=0x0;_0x47d75f<_0x2a1886[_0xf3af('0x36')]['ids'][_0xf3af('0x4b')];_0x47d75f+=0x1){socket[_0xf3af('0x83')](_0xf3af('0x84'),{'UserId':Number(_0x2a1886['query'][_0xf3af('0x69')][_0x47d75f]),'FaxQueueId':Number(_0x2a1886[_0xf3af('0x49')]['id'])});}}else{socket[_0xf3af('0x83')]('userFaxQueue:remove',{'UserId':Number(_0x2a1886[_0xf3af('0x36')][_0xf3af('0x69')]),'FaxQueueId':Number(_0x2a1886[_0xf3af('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x68e471,null))['catch'](handleError(_0x68e471,null));};exports['getAgents']=function(_0x5c79d8,_0x361154,_0x4f2cd2){var _0x53a64a={};var _0x215f77={};var _0x12ef19;var _0x2868fe;return db[_0xf3af('0x45')]['findOne']({'where':{'id':_0x5c79d8[_0xf3af('0x49')]['id']}})[_0xf3af('0x28')](handleEntityNotFound(_0x361154,null))['then'](function(_0x4bf77f){if(_0x4bf77f){_0x12ef19=_0x4bf77f;_0x215f77['model']=_[_0xf3af('0x37')](db[_0xf3af('0x6a')]['rawAttributes']);_0x215f77['query']=_[_0xf3af('0x37')](_0x5c79d8['query']);_0x215f77[_0xf3af('0x38')]=_[_0xf3af('0x3a')](_0x215f77[_0xf3af('0x35')],_0x215f77[_0xf3af('0x36')]);_0x53a64a[_0xf3af('0x39')]=_[_0xf3af('0x3a')](_0x215f77[_0xf3af('0x35')],qs[_0xf3af('0x3b')](_0x5c79d8[_0xf3af('0x36')][_0xf3af('0x3b')]));_0x53a64a['attributes']=_0x53a64a['attributes'][_0xf3af('0x4b')]?_0x53a64a[_0xf3af('0x39')]:_0x215f77[_0xf3af('0x35')];_0x53a64a[_0xf3af('0x3e')]=qs[_0xf3af('0x3f')](_0x5c79d8[_0xf3af('0x36')][_0xf3af('0x3f')]);_0x53a64a[_0xf3af('0x40')]=qs[_0xf3af('0x38')](_[_0xf3af('0x59')](_0x5c79d8[_0xf3af('0x36')],_0x215f77[_0xf3af('0x38')]));if(_0x5c79d8[_0xf3af('0x36')][_0xf3af('0x41')]){_0x53a64a[_0xf3af('0x40')]=_[_0xf3af('0x42')](_0x53a64a[_0xf3af('0x40')],{'$or':_[_0xf3af('0x31')](_0x53a64a[_0xf3af('0x39')],function(_0x7ee5d3){var _0x4fe2bb={};_0x4fe2bb[_0x7ee5d3]={'$like':'%'+_0x5c79d8[_0xf3af('0x36')][_0xf3af('0x41')]+'%'};return _0x4fe2bb;})});}_0x53a64a=_['merge']({},_0x53a64a,_0x5c79d8[_0xf3af('0x44')]);return _0x12ef19[_0xf3af('0x8a')](_0x53a64a);}})['then'](function(_0x34e417){if(_0x34e417){_0x2868fe=_0x34e417[_0xf3af('0x4b')];if(!_0x5c79d8[_0xf3af('0x36')]['hasOwnProperty'](_0xf3af('0x3d'))){_0x53a64a[_0xf3af('0x1f')]=qs[_0xf3af('0x1f')](_0x5c79d8[_0xf3af('0x36')][_0xf3af('0x1f')]);_0x53a64a['offset']=qs[_0xf3af('0x1d')](_0x5c79d8[_0xf3af('0x36')]['offset']);}return _0x12ef19[_0xf3af('0x8a')](_0x53a64a);}})[_0xf3af('0x28')](function(_0x51a302){if(_0x51a302){return _0x51a302?{'count':_0x2868fe,'rows':_0x51a302}:null;}})[_0xf3af('0x28')](respondWithResult(_0x361154,null))[_0xf3af('0x4d')](handleError(_0x361154,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 36bb217..ddb2984 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 _0x5970=['events','../../mysqldb','setMaxListeners','save','remove','emit','hook'];(function(_0x188f2f,_0xe7bb96){var _0x560cc1=function(_0x44e740){while(--_0x44e740){_0x188f2f['push'](_0x188f2f['shift']());}};_0x560cc1(++_0xe7bb96);}(_0x5970,0x196));var _0x0597=function(_0x59e3db,_0x499793){_0x59e3db=_0x59e3db-0x0;var _0x2ec9a9=_0x5970[_0x59e3db];return _0x2ec9a9;};'use strict';var EventEmitter=require(_0x0597('0x0'));var FaxQueue=require(_0x0597('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0597('0x2')](0x0);var events={'afterCreate':_0x0597('0x3'),'afterUpdate':'update','afterDestroy':_0x0597('0x4')};function emitEvent(_0x373694){return function(_0x260f53,_0xfe74d5,_0x588de9){FaxQueueEvents[_0x0597('0x5')](_0x373694+':'+_0x260f53['id'],_0x260f53);FaxQueueEvents[_0x0597('0x5')](_0x373694,_0x260f53);_0x588de9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0597('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xe6e5=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x3f9c37,_0x11afdc){var _0x583e2a=function(_0x365aea){while(--_0x365aea){_0x3f9c37['push'](_0x3f9c37['shift']());}};_0x583e2a(++_0x11afdc);}(_0xe6e5,0x88));var _0x5e6e=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe6e5[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require(_0x5e6e('0x0'));var FaxQueue=require(_0x5e6e('0x1'))['db'][_0x5e6e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5e6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e6e('0x4'),'afterDestroy':_0x5e6e('0x5')};function emitEvent(_0x4012f3){return function(_0x51c9cb,_0x562aa1,_0x458bff){FaxQueueEvents[_0x5e6e('0x6')](_0x4012f3+':'+_0x51c9cb['id'],_0x51c9cb);FaxQueueEvents[_0x5e6e('0x6')](_0x4012f3,_0x51c9cb);_0x458bff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x5e6e('0x7')](e,emitEvent(event));}}module[_0x5e6e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 20c6df3..6a2bde5 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 _0x0769=['util','../../config/logger','api','bluebird','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0x0769,0xbe));var _0x9076=function(_0x1686eb,_0x3a9343){_0x1686eb=_0x1686eb-0x0;var _0x20c267=_0x0769[_0x1686eb];return _0x20c267;};'use strict';var _=require('lodash');var util=require(_0x9076('0x0'));var logger=require(_0x9076('0x1'))(_0x9076('0x2'));var moment=require('moment');var BPromise=require(_0x9076('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9076('0x4'));var config=require('../../config/environment');var attributes=require(_0x9076('0x5'));module[_0x9076('0x6')]=function(_0x4cf526,_0xe220e){return _0x4cf526[_0x9076('0x7')](_0x9076('0x8'),attributes,{'tableName':_0x9076('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0xf9a2,0x1da));var _0x2f9a=function(_0x2da7d5,_0x42e03f){_0x2da7d5=_0x2da7d5-0x0;var _0x49f156=_0xf9a2[_0x2da7d5];return _0x49f156;};'use strict';var _=require(_0x2f9a('0x0'));var util=require('util');var logger=require(_0x2f9a('0x1'))(_0x2f9a('0x2'));var moment=require(_0x2f9a('0x3'));var BPromise=require(_0x2f9a('0x4'));var rp=require(_0x2f9a('0x5'));var fs=require('fs');var path=require(_0x2f9a('0x6'));var rimraf=require(_0x2f9a('0x7'));var config=require(_0x2f9a('0x8'));var attributes=require(_0x2f9a('0x9'));module[_0x2f9a('0xa')]=function(_0x30db82,_0x9da15){return _0x30db82[_0x2f9a('0xb')](_0x2f9a('0xc'),attributes,{'tableName':_0x2f9a('0xd'),'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 12e1062..42735db 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 _0x7655=['request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','attributes','limit','include','model','map','then','info','raw','where','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register'];(function(_0x1297c3,_0x4e8b43){var _0x3a9ff9=function(_0x1df524){while(--_0x1df524){_0x1297c3['push'](_0x1297c3['shift']());}};_0x3a9ff9(++_0x4e8b43);}(_0x7655,0xe0));var _0x5765=function(_0xac347c,_0x129e5c){_0xac347c=_0xac347c-0x0;var _0x2e6026=_0x7655[_0xac347c];return _0x2e6026;};'use strict';var _=require(_0x5765('0x0'));var util=require('util');var moment=require(_0x5765('0x1'));var BPromise=require(_0x5765('0x2'));var rs=require(_0x5765('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5765('0x4'))['db'];var utils=require(_0x5765('0x5'));var logger=require(_0x5765('0x6'))(_0x5765('0x7'));var config=require('../../config/environment');var jayson=require(_0x5765('0x8'));var client=jayson[_0x5765('0x9')][_0x5765('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5765('0xb')],{'host':_0x5765('0xc'),'port':0x18eb});var socket=require(_0x5765('0xd'))(new Redis(config[_0x5765('0xb')]));require(_0x5765('0xe'))[_0x5765('0xf')](socket);function respondWithRpcPromise(_0x301a3b,_0x413bde,_0x58fd22){return new BPromise(function(_0x14191e,_0x2eb68e){return client[_0x5765('0x10')](_0x301a3b,_0x58fd22)['then'](function(_0x1d374b){logger['info'](_0x5765('0x11'),_0x413bde,_0x5765('0x12'));logger[_0x5765('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x413bde,'request\x20sent',JSON[_0x5765('0x14')](_0x1d374b));if(_0x1d374b[_0x5765('0x15')]){if(_0x1d374b[_0x5765('0x15')][_0x5765('0x16')]===0x1f4){logger[_0x5765('0x15')](_0x5765('0x11'),_0x413bde,_0x1d374b[_0x5765('0x15')][_0x5765('0x17')]);return _0x2eb68e(_0x1d374b['error'][_0x5765('0x17')]);}logger[_0x5765('0x15')](_0x5765('0x11'),_0x413bde,_0x1d374b['error']['message']);return _0x14191e(_0x1d374b[_0x5765('0x15')][_0x5765('0x17')]);}else{logger['info'](_0x5765('0x11'),_0x413bde,'request\x20sent');_0x14191e(_0x1d374b[_0x5765('0x18')][_0x5765('0x17')]);}})[_0x5765('0x19')](function(_0x24aa0e){logger[_0x5765('0x15')](_0x5765('0x11'),_0x413bde,_0x24aa0e);_0x2eb68e(_0x24aa0e);});});}exports[_0x5765('0x1a')]=function(_0x4df729){var _0x37d0f3=this;return new Promise(function(_0x3089da,_0x36ff04){return db[_0x5765('0x1b')][_0x5765('0x1c')]({'raw':_0x4df729[_0x5765('0x1d')]?_0x4df729[_0x5765('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4df729['options']?_0x4df729[_0x5765('0x1d')]['where']||null:null,'attributes':_0x4df729[_0x5765('0x1d')]?_0x4df729['options'][_0x5765('0x1e')]||null:null,'limit':_0x4df729[_0x5765('0x1d')]?_0x4df729[_0x5765('0x1d')][_0x5765('0x1f')]||null:null,'include':_0x4df729[_0x5765('0x1d')]?_0x4df729[_0x5765('0x1d')]['include']?_['map'](_0x4df729['options'][_0x5765('0x20')],function(_0x115fe7){return{'model':db[_0x115fe7[_0x5765('0x21')]],'as':_0x115fe7['as'],'attributes':_0x115fe7['attributes'],'include':_0x115fe7[_0x5765('0x20')]?_[_0x5765('0x22')](_0x115fe7[_0x5765('0x20')],function(_0x32032f){return{'model':db[_0x32032f[_0x5765('0x21')]],'as':_0x32032f['as'],'attributes':_0x32032f[_0x5765('0x1e')],'include':_0x32032f[_0x5765('0x20')]?_[_0x5765('0x22')](_0x32032f[_0x5765('0x20')],function(_0x113833){return{'model':db[_0x113833[_0x5765('0x21')]],'as':_0x113833['as'],'attributes':_0x113833[_0x5765('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5765('0x23')](function(_0x1760d6){logger[_0x5765('0x24')]('GetFaxQueue',_0x4df729);logger[_0x5765('0x13')](_0x5765('0x1a'),_0x4df729,JSON[_0x5765('0x14')](_0x1760d6));_0x3089da(_0x1760d6);})[_0x5765('0x19')](function(_0x58da2f){logger[_0x5765('0x15')](_0x5765('0x1a'),_0x58da2f[_0x5765('0x17')],_0x4df729);_0x36ff04(_0x37d0f3[_0x5765('0x15')](0x1f4,_0x58da2f[_0x5765('0x17')]));});});};exports['ShowFaxQueue']=function(_0x1393d4){var _0x5b4e8a=this;return new Promise(function(_0x522208,_0x3a70e1){return db[_0x5765('0x1b')]['find']({'raw':_0x1393d4[_0x5765('0x1d')]?_0x1393d4[_0x5765('0x1d')][_0x5765('0x25')]===undefined?!![]:![]:!![],'where':_0x1393d4[_0x5765('0x1d')]?_0x1393d4[_0x5765('0x1d')][_0x5765('0x26')]||null:null,'attributes':_0x1393d4['options']?_0x1393d4[_0x5765('0x1d')][_0x5765('0x1e')]||null:null,'include':_0x1393d4[_0x5765('0x1d')]?_0x1393d4[_0x5765('0x1d')][_0x5765('0x20')]?_[_0x5765('0x22')](_0x1393d4[_0x5765('0x1d')]['include'],function(_0x5c5aaa){return{'model':db[_0x5c5aaa[_0x5765('0x21')]],'as':_0x5c5aaa['as'],'attributes':_0x5c5aaa[_0x5765('0x1e')],'include':_0x5c5aaa['include']?_[_0x5765('0x22')](_0x5c5aaa[_0x5765('0x20')],function(_0x49dc78){return{'model':db[_0x49dc78[_0x5765('0x21')]],'as':_0x49dc78['as'],'attributes':_0x49dc78[_0x5765('0x1e')],'include':_0x49dc78[_0x5765('0x20')]?_[_0x5765('0x22')](_0x49dc78[_0x5765('0x20')],function(_0x73aec7){return{'model':db[_0x73aec7[_0x5765('0x21')]],'as':_0x73aec7['as'],'attributes':_0x73aec7[_0x5765('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5765('0x23')](function(_0x4b5c53){logger[_0x5765('0x24')](_0x5765('0x27'),_0x1393d4);logger[_0x5765('0x13')](_0x5765('0x27'),_0x1393d4,JSON[_0x5765('0x14')](_0x4b5c53));_0x522208(_0x4b5c53);})[_0x5765('0x19')](function(_0x3fda76){logger[_0x5765('0x15')](_0x5765('0x27'),_0x3fda76[_0x5765('0x17')],_0x1393d4);_0x3a70e1(_0x5b4e8a['error'](0x1f4,_0x3fda76['message']));});});}; \ No newline at end of file +var _0xedcd=['where','attributes','limit','include','map','model','then','ShowFaxQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw'];(function(_0x411abe,_0x2d60ca){var _0x4b43c3=function(_0x1e75bb){while(--_0x1e75bb){_0x411abe['push'](_0x411abe['shift']());}};_0x4b43c3(++_0x2d60ca);}(_0xedcd,0x138));var _0xdedc=function(_0x1b17f5,_0x26cc08){_0x1b17f5=_0x1b17f5-0x0;var _0x503040=_0xedcd[_0x1b17f5];return _0x503040;};'use strict';var _=require(_0xdedc('0x0'));var util=require(_0xdedc('0x1'));var moment=require('moment');var BPromise=require(_0xdedc('0x2'));var rs=require(_0xdedc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdedc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdedc('0x5'))(_0xdedc('0x6'));var config=require(_0xdedc('0x7'));var jayson=require(_0xdedc('0x8'));var client=jayson[_0xdedc('0x9')][_0xdedc('0xa')]({'port':0x232a});config[_0xdedc('0xb')]=_['defaults'](config[_0xdedc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdedc('0xc'))(new Redis(config[_0xdedc('0xb')]));require(_0xdedc('0xd'))[_0xdedc('0xe')](socket);function respondWithRpcPromise(_0x44c936,_0x2683a8,_0x5dff43){return new BPromise(function(_0x669c84,_0x14b2de){return client[_0xdedc('0xf')](_0x44c936,_0x5dff43)['then'](function(_0x4ca31f){logger[_0xdedc('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2683a8,_0xdedc('0x11'));logger[_0xdedc('0x12')](_0xdedc('0x13'),_0x2683a8,_0xdedc('0x11'),JSON[_0xdedc('0x14')](_0x4ca31f));if(_0x4ca31f[_0xdedc('0x15')]){if(_0x4ca31f[_0xdedc('0x15')]['code']===0x1f4){logger[_0xdedc('0x15')](_0xdedc('0x16'),_0x2683a8,_0x4ca31f[_0xdedc('0x15')][_0xdedc('0x17')]);return _0x14b2de(_0x4ca31f['error'][_0xdedc('0x17')]);}logger['error'](_0xdedc('0x16'),_0x2683a8,_0x4ca31f[_0xdedc('0x15')][_0xdedc('0x17')]);return _0x669c84(_0x4ca31f['error'][_0xdedc('0x17')]);}else{logger[_0xdedc('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2683a8,'request\x20sent');_0x669c84(_0x4ca31f['result']['message']);}})[_0xdedc('0x18')](function(_0x4a3a06){logger[_0xdedc('0x15')](_0xdedc('0x16'),_0x2683a8,_0x4a3a06);_0x14b2de(_0x4a3a06);});});}exports[_0xdedc('0x19')]=function(_0x229870){var _0x5c91e3=this;return new Promise(function(_0x421123,_0xd87c7c){return db[_0xdedc('0x1a')][_0xdedc('0x1b')]({'raw':_0x229870[_0xdedc('0x1c')]?_0x229870[_0xdedc('0x1c')][_0xdedc('0x1d')]===undefined?!![]:![]:!![],'where':_0x229870[_0xdedc('0x1c')]?_0x229870[_0xdedc('0x1c')][_0xdedc('0x1e')]||null:null,'attributes':_0x229870[_0xdedc('0x1c')]?_0x229870[_0xdedc('0x1c')][_0xdedc('0x1f')]||null:null,'limit':_0x229870['options']?_0x229870[_0xdedc('0x1c')][_0xdedc('0x20')]||null:null,'include':_0x229870['options']?_0x229870[_0xdedc('0x1c')][_0xdedc('0x21')]?_[_0xdedc('0x22')](_0x229870[_0xdedc('0x1c')][_0xdedc('0x21')],function(_0x6e1a04){return{'model':db[_0x6e1a04[_0xdedc('0x23')]],'as':_0x6e1a04['as'],'attributes':_0x6e1a04['attributes'],'include':_0x6e1a04[_0xdedc('0x21')]?_[_0xdedc('0x22')](_0x6e1a04[_0xdedc('0x21')],function(_0x1e2364){return{'model':db[_0x1e2364[_0xdedc('0x23')]],'as':_0x1e2364['as'],'attributes':_0x1e2364[_0xdedc('0x1f')],'include':_0x1e2364[_0xdedc('0x21')]?_[_0xdedc('0x22')](_0x1e2364[_0xdedc('0x21')],function(_0x5f0795){return{'model':db[_0x5f0795['model']],'as':_0x5f0795['as'],'attributes':_0x5f0795[_0xdedc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdedc('0x24')](function(_0x172258){logger[_0xdedc('0x10')](_0xdedc('0x19'),_0x229870);logger[_0xdedc('0x12')](_0xdedc('0x19'),_0x229870,JSON['stringify'](_0x172258));_0x421123(_0x172258);})[_0xdedc('0x18')](function(_0x3bd469){logger[_0xdedc('0x15')](_0xdedc('0x19'),_0x3bd469[_0xdedc('0x17')],_0x229870);_0xd87c7c(_0x5c91e3['error'](0x1f4,_0x3bd469[_0xdedc('0x17')]));});});};exports['ShowFaxQueue']=function(_0x57f3b8){var _0x32d6f7=this;return new Promise(function(_0x4258ef,_0x236c89){return db['FaxQueue']['find']({'raw':_0x57f3b8[_0xdedc('0x1c')]?_0x57f3b8[_0xdedc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x57f3b8['options']?_0x57f3b8[_0xdedc('0x1c')][_0xdedc('0x1e')]||null:null,'attributes':_0x57f3b8['options']?_0x57f3b8[_0xdedc('0x1c')][_0xdedc('0x1f')]||null:null,'include':_0x57f3b8['options']?_0x57f3b8[_0xdedc('0x1c')]['include']?_['map'](_0x57f3b8[_0xdedc('0x1c')][_0xdedc('0x21')],function(_0x39d572){return{'model':db[_0x39d572[_0xdedc('0x23')]],'as':_0x39d572['as'],'attributes':_0x39d572[_0xdedc('0x1f')],'include':_0x39d572[_0xdedc('0x21')]?_['map'](_0x39d572[_0xdedc('0x21')],function(_0x68594f){return{'model':db[_0x68594f[_0xdedc('0x23')]],'as':_0x68594f['as'],'attributes':_0x68594f[_0xdedc('0x1f')],'include':_0x68594f[_0xdedc('0x21')]?_[_0xdedc('0x22')](_0x68594f[_0xdedc('0x21')],function(_0x22ca6f){return{'model':db[_0x22ca6f['model']],'as':_0x22ca6f['as'],'attributes':_0x22ca6f[_0xdedc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdedc('0x24')](function(_0x5e1abe){logger[_0xdedc('0x10')](_0xdedc('0x25'),_0x57f3b8);logger[_0xdedc('0x12')]('ShowFaxQueue',_0x57f3b8,JSON[_0xdedc('0x14')](_0x5e1abe));_0x4258ef(_0x5e1abe);})[_0xdedc('0x18')](function(_0x2fb3de){logger[_0xdedc('0x15')](_0xdedc('0x25'),_0x2fb3de[_0xdedc('0x17')],_0x57f3b8);_0x236c89(_0x32d6f7[_0xdedc('0x15')](0x1f4,_0x2fb3de[_0xdedc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d538e22..8a17f86 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 _0xec48=['removeListener','register','length','faxQueue:','save','remove','update','emit'];(function(_0x2c6c99,_0x2170a0){var _0x4dac7a=function(_0x40235b){while(--_0x40235b){_0x2c6c99['push'](_0x2c6c99['shift']());}};_0x4dac7a(++_0x2170a0);}(_0xec48,0x194));var _0x8ec4=function(_0x2e9556,_0x5d18fb){_0x2e9556=_0x2e9556-0x0;var _0x1d4a1f=_0xec48[_0x2e9556];return _0x1d4a1f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x8ec4('0x0'),_0x8ec4('0x1'),_0x8ec4('0x2')];function createListener(_0x2c15eb,_0x350a93){return function(_0x4e8e4c){_0x350a93[_0x8ec4('0x3')](_0x2c15eb,_0x4e8e4c);};}function removeListener(_0x4171af,_0x103b3d){return function(){FaxQueueEvents[_0x8ec4('0x4')](_0x4171af,_0x103b3d);};}exports[_0x8ec4('0x5')]=function(_0x4df8d9){for(var _0x415c59=0x0,_0x1832bb=events[_0x8ec4('0x6')];_0x415c59<_0x1832bb;_0x415c59++){var _0x4b98b0=events[_0x415c59];var _0x1d960b=createListener(_0x8ec4('0x7')+_0x4b98b0,_0x4df8d9);FaxQueueEvents['on'](_0x4b98b0,_0x1d960b);}}; \ No newline at end of file +var _0xb95d=['save','remove','update','emit','removeListener','register','length','./faxQueue.events'];(function(_0x1da515,_0x3e44c6){var _0x9ea2c1=function(_0x4c2928){while(--_0x4c2928){_0x1da515['push'](_0x1da515['shift']());}};_0x9ea2c1(++_0x3e44c6);}(_0xb95d,0x13f));var _0xdb95=function(_0x57ac7c,_0x13eb14){_0x57ac7c=_0x57ac7c-0x0;var _0x52d72c=_0xb95d[_0x57ac7c];return _0x52d72c;};'use strict';var FaxQueueEvents=require(_0xdb95('0x0'));var events=[_0xdb95('0x1'),_0xdb95('0x2'),_0xdb95('0x3')];function createListener(_0x1646bf,_0xf192ea){return function(_0x206da1){_0xf192ea[_0xdb95('0x4')](_0x1646bf,_0x206da1);};}function removeListener(_0x550436,_0x310a44){return function(){FaxQueueEvents[_0xdb95('0x5')](_0x550436,_0x310a44);};}exports[_0xdb95('0x6')]=function(_0x602baa){for(var _0x56103e=0x0,_0x1774e2=events[_0xdb95('0x7')];_0x56103e<_0x1774e2;_0x56103e++){var _0x4c8da2=events[_0x56103e];var _0x2973e4=createListener('faxQueue:'+_0x4c8da2,_0x602baa);FaxQueueEvents['on'](_0x4c8da2,_0x2973e4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8eb9b98..1836859 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 _0x2581=['describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x5aa170,_0x3975fa){var _0x2b1815=function(_0x3f4d49){while(--_0x3f4d49){_0x5aa170['push'](_0x5aa170['shift']());}};_0x2b1815(++_0x3975fa);}(_0x2581,0xcb));var _0x1258=function(_0x46b096,_0x2d9040){_0x46b096=_0x46b096-0x0;var _0x41ebf5=_0x2581[_0x46b096];return _0x41ebf5;};'use strict';var multer=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var timeout=require(_0x1258('0x3'));var express=require(_0x1258('0x4'));var router=express['Router']();var fs_extra=require(_0x1258('0x5'));var auth=require(_0x1258('0x6'));var interaction=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var controller=require(_0x1258('0x9'));router[_0x1258('0xa')]('/',auth[_0x1258('0xb')](),controller[_0x1258('0xc')]);router['get'](_0x1258('0xd'),auth[_0x1258('0xb')](),controller[_0x1258('0xe')]);router[_0x1258('0xa')](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x10')]);router['get']('/:id/members',auth[_0x1258('0xb')](),controller[_0x1258('0x11')]);router[_0x1258('0xa')](_0x1258('0x12'),auth['isAuthenticated'](),controller[_0x1258('0x13')]);router[_0x1258('0xa')](_0x1258('0x14'),auth[_0x1258('0xb')](),controller['getAgents']);router[_0x1258('0x15')]('/',auth[_0x1258('0xb')](),controller[_0x1258('0x16')]);router[_0x1258('0x15')](_0x1258('0x12'),auth[_0x1258('0xb')](),controller[_0x1258('0x17')]);router['post'](_0x1258('0x14'),auth['isAuthenticated'](),controller[_0x1258('0x18')]);router[_0x1258('0x19')](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x1a')]);router['delete'](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x1b')]);router['delete'](_0x1258('0x12'),auth[_0x1258('0xb')](),controller['removeTeams']);router[_0x1258('0x1c')](_0x1258('0x14'),auth[_0x1258('0xb')](),controller[_0x1258('0x1d')]);module[_0x1258('0x1e')]=router; \ No newline at end of file +var _0x1a37=['/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3ee304,_0x489b28){var _0x20e697=function(_0x4aa49a){while(--_0x4aa49a){_0x3ee304['push'](_0x3ee304['shift']());}};_0x20e697(++_0x489b28);}(_0x1a37,0xb4));var _0x71a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a37[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./faxQueue.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getTeams']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0x13')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x13')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x15')]);router[_0x71a3('0x13')](_0x71a3('0x16'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x71a3('0x19')]);router[_0x71a3('0x1a')](_0x71a3('0x1b'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1c')]);router[_0x71a3('0x1a')]('/:id/teams',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1d')]);router['delete']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);module[_0x71a3('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index fb7f5ca..6b6e1c1 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 _0xd6a1=['exports','STRING','DATE'];(function(_0x3f3125,_0x3f49d2){var _0x28bf12=function(_0xb9d9cb){while(--_0xb9d9cb){_0x3f3125['push'](_0x3f3125['shift']());}};_0x28bf12(++_0x3f49d2);}(_0xd6a1,0x7b));var _0x1d6a=function(_0x2d496f,_0x573381){_0x2d496f=_0x2d496f-0x0;var _0x25dedf=_0xd6a1[_0x2d496f];return _0x25dedf;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1d6a('0x0')]={'uniqueid':{'type':Sequelize[_0x1d6a('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1d6a('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1d6a('0x2')]},'exitAt':{'type':Sequelize[_0x1d6a('0x2')]},'reason':{'type':Sequelize[_0x1d6a('0x1')]}}; \ No newline at end of file +var _0xb419=['STRING','DATE','moment','sequelize'];(function(_0x1d8b37,_0x3f6391){var _0x2761e3=function(_0x548d53){while(--_0x548d53){_0x1d8b37['push'](_0x1d8b37['shift']());}};_0x2761e3(++_0x3f6391);}(_0xb419,0x172));var _0x9b41=function(_0x35070c,_0x343112){_0x35070c=_0x35070c-0x0;var _0x97a050=_0xb419[_0x35070c];return _0x97a050;};'use strict';var moment=require(_0x9b41('0x0'));var Sequelize=require(_0x9b41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9b41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9b41('0x2')]},'joinAt':{'type':Sequelize[_0x9b41('0x3')]},'leaveAt':{'type':Sequelize[_0x9b41('0x3')]},'acceptAt':{'type':Sequelize[_0x9b41('0x3')]},'exitAt':{'type':Sequelize[_0x9b41('0x3')]},'reason':{'type':Sequelize[_0x9b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8d985ce..c0c9af6 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 _0x3a25=['end','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','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'];(function(_0x1eeb14,_0x3bdb98){var _0x5b52e9=function(_0x19e0e9){while(--_0x19e0e9){_0x1eeb14['push'](_0x1eeb14['shift']());}};_0x5b52e9(++_0x3bdb98);}(_0x3a25,0x15d));var _0x53a2=function(_0x38a7e6,_0x38cde8){_0x38a7e6=_0x38a7e6-0x0;var _0x5ab33e=_0x3a25[_0x38a7e6];return _0x5ab33e;};'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(){_0x4a1a34[_0x53a2('0x1c')](0xcc)[_0x53a2('0x29')]();});}};}function handleEntityNotFound(_0xa39167,_0x4b26a8){return function(_0x2dfa00){if(!_0x2dfa00){_0xa39167[_0x53a2('0x1b')](0x194);}return _0x2dfa00;};}function handleError(_0x111420,_0x397340){_0x397340=_0x397340||0x1f4;return function(_0x323c8a){logger[_0x53a2('0x2a')](_0x323c8a[_0x53a2('0x2b')]);if(_0x323c8a[_0x53a2('0x2c')]){delete _0x323c8a[_0x53a2('0x2c')];}_0x111420[_0x53a2('0x1c')](_0x397340)[_0x53a2('0x2d')](_0x323c8a);};}exports[_0x53a2('0x2e')]=function(_0x262eba,_0x469b0f){var _0x2a6428={},_0xf12019={},_0x437916={'count':0x0,'rows':[]};var _0x5a84de=_[_0x53a2('0x2f')](db[_0x53a2('0x30')][_0x53a2('0x31')],function(_0x23374b){return{'name':_0x23374b[_0x53a2('0x32')],'type':_0x23374b[_0x53a2('0x33')][_0x53a2('0x34')]};});_0xf12019[_0x53a2('0x35')]=_[_0x53a2('0x2f')](_0x5a84de,_0x53a2('0x2c'));_0xf12019[_0x53a2('0x36')]=_['keys'](_0x262eba[_0x53a2('0x36')]);_0xf12019[_0x53a2('0x37')]=_[_0x53a2('0x38')](_0xf12019[_0x53a2('0x35')],_0xf12019[_0x53a2('0x36')]);_0x2a6428[_0x53a2('0x39')]=_[_0x53a2('0x38')](_0xf12019[_0x53a2('0x35')],qs['fields'](_0x262eba[_0x53a2('0x36')][_0x53a2('0x3a')]));_0x2a6428[_0x53a2('0x39')]=_0x2a6428[_0x53a2('0x39')]['length']?_0x2a6428[_0x53a2('0x39')]:_0xf12019[_0x53a2('0x35')];if(!_0x262eba[_0x53a2('0x36')][_0x53a2('0x3b')](_0x53a2('0x3c'))){_0x2a6428[_0x53a2('0x20')]=qs['limit'](_0x262eba[_0x53a2('0x36')][_0x53a2('0x20')]);_0x2a6428[_0x53a2('0x1e')]=qs['offset'](_0x262eba[_0x53a2('0x36')]['offset']);}_0x2a6428[_0x53a2('0x3d')]=qs[_0x53a2('0x3e')](_0x262eba[_0x53a2('0x36')]['sort']);_0x2a6428['where']=qs[_0x53a2('0x37')](_['pick'](_0x262eba[_0x53a2('0x36')],_0xf12019[_0x53a2('0x37')]),_0x5a84de);if(_0x262eba[_0x53a2('0x36')][_0x53a2('0x3f')]){_0x2a6428[_0x53a2('0x40')]=_[_0x53a2('0x41')](_0x2a6428['where'],{'$or':_[_0x53a2('0x2f')](_0x5a84de,function(_0x1252ee){if(_0x1252ee['type']!=='VIRTUAL'){var _0x31e0b1={};_0x31e0b1[_0x1252ee['name']]={'$like':'%'+_0x262eba[_0x53a2('0x36')][_0x53a2('0x3f')]+'%'};return _0x31e0b1;}})});}_0x2a6428=_['merge']({},_0x2a6428,_0x262eba[_0x53a2('0x42')]);var _0x19d28e={'where':_0x2a6428[_0x53a2('0x40')]};return db[_0x53a2('0x30')][_0x53a2('0x21')](_0x19d28e)['then'](function(_0xf02fa){_0x437916[_0x53a2('0x21')]=_0xf02fa;if(_0x262eba['query'][_0x53a2('0x43')]){_0x2a6428[_0x53a2('0x44')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x53a2('0x45')](_0x2a6428);})['then'](function(_0xd5bcc8){_0x437916[_0x53a2('0x46')]=_0xd5bcc8;return _0x437916;})[_0x53a2('0x27')](respondWithFilteredResult(_0x469b0f,_0x2a6428))[_0x53a2('0x47')](handleError(_0x469b0f,null));};exports[_0x53a2('0x48')]=function(_0x1aa002,_0x524b6a){var _0x71a339={'raw':!![],'where':{'id':_0x1aa002[_0x53a2('0x49')]['id']}},_0x33238d={};_0x33238d[_0x53a2('0x35')]=_[_0x53a2('0x4a')](db[_0x53a2('0x30')][_0x53a2('0x31')]);_0x33238d[_0x53a2('0x36')]=_[_0x53a2('0x4a')](_0x1aa002[_0x53a2('0x36')]);_0x33238d[_0x53a2('0x37')]=_[_0x53a2('0x38')](_0x33238d[_0x53a2('0x35')],_0x33238d[_0x53a2('0x36')]);_0x71a339[_0x53a2('0x39')]=_[_0x53a2('0x38')](_0x33238d['model'],qs[_0x53a2('0x3a')](_0x1aa002[_0x53a2('0x36')]['fields']));_0x71a339['attributes']=_0x71a339[_0x53a2('0x39')]['length']?_0x71a339['attributes']:_0x33238d[_0x53a2('0x35')];if(_0x1aa002[_0x53a2('0x36')][_0x53a2('0x43')]){_0x71a339[_0x53a2('0x44')]=[{'all':!![]}];}_0x71a339=_['merge']({},_0x71a339,_0x1aa002['options']);return db['FaxQueueReport'][_0x53a2('0x4b')](_0x71a339)['then'](handleEntityNotFound(_0x524b6a,null))['then'](respondWithResult(_0x524b6a,null))[_0x53a2('0x47')](handleError(_0x524b6a,null));};exports[_0x53a2('0x4c')]=function(_0x3a384e,_0x32a6fd){return db[_0x53a2('0x30')]['create'](_0x3a384e[_0x53a2('0x4d')],{})['then'](respondWithResult(_0x32a6fd,0xc9))[_0x53a2('0x47')](handleError(_0x32a6fd,null));};exports[_0x53a2('0x26')]=function(_0x5baa46,_0x35fb2b){if(_0x5baa46[_0x53a2('0x4d')]['id']){delete _0x5baa46[_0x53a2('0x4d')]['id'];}return db[_0x53a2('0x30')][_0x53a2('0x4b')]({'where':{'id':_0x5baa46[_0x53a2('0x49')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x35fb2b,null))['then'](saveUpdates(_0x5baa46[_0x53a2('0x4d')],null))[_0x53a2('0x27')](respondWithResult(_0x35fb2b,null))[_0x53a2('0x47')](handleError(_0x35fb2b,null));};exports['destroy']=function(_0x36df41,_0x71dbbf){return db[_0x53a2('0x30')][_0x53a2('0x4b')]({'where':{'id':_0x36df41[_0x53a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x71dbbf,null))['then'](removeEntity(_0x71dbbf,null))[_0x53a2('0x47')](handleError(_0x71dbbf,null));};exports['describe']=function(_0x4363a5,_0x6cc539){return db['FaxQueueReport']['describe']()[_0x53a2('0x27')](respondWithResult(_0x6cc539,null))[_0x53a2('0x47')](handleError(_0x6cc539,null));}; \ No newline at end of file +var _0x2bd6=['destroy','status','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x42fb0e,_0x55fc22){var _0x595566=function(_0x4d7e07){while(--_0x4d7e07){_0x42fb0e['push'](_0x42fb0e['shift']());}};_0x595566(++_0x55fc22);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x2bd6[_0x146a97];return _0x259d5c;};'use strict';var emlformat=require(_0x62bd('0x0'));var rimraf=require(_0x62bd('0x1'));var zipdir=require(_0x62bd('0x2'));var jsonpatch=require(_0x62bd('0x3'));var rp=require(_0x62bd('0x4'));var moment=require('moment');var BPromise=require(_0x62bd('0x5'));var Mustache=require(_0x62bd('0x6'));var util=require(_0x62bd('0x7'));var path=require('path');var sox=require(_0x62bd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62bd('0x9'));var _=require(_0x62bd('0xa'));var squel=require('squel');var crypto=require(_0x62bd('0xb'));var jsforce=require(_0x62bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62bd('0xd'));var querystring=require(_0x62bd('0xe'));var Papa=require(_0x62bd('0xf'));var Redis=require(_0x62bd('0x10'));var authService=require(_0x62bd('0x11'));var qs=require(_0x62bd('0x12'));var as=require(_0x62bd('0x13'));var hardwareService=require(_0x62bd('0x14'));var logger=require(_0x62bd('0x15'))(_0x62bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x17'));var db=require(_0x62bd('0x18'))['db'];function respondWithStatusCode(_0x32941d,_0x7acd92){_0x7acd92=_0x7acd92||0xcc;return function(_0x2b1c2e){if(_0x2b1c2e){return _0x32941d[_0x62bd('0x19')](_0x7acd92);}return _0x32941d['status'](_0x7acd92)[_0x62bd('0x1a')]();};}function respondWithResult(_0x5d42f8,_0x1b751c){_0x1b751c=_0x1b751c||0xc8;return function(_0x5dc408){if(_0x5dc408){return _0x5d42f8['status'](_0x1b751c)[_0x62bd('0x1b')](_0x5dc408);}};}function respondWithFilteredResult(_0x397a41,_0x5260f9){return function(_0x3073e1){if(_0x3073e1){var _0x1d178b=typeof _0x5260f9[_0x62bd('0x1c')]===_0x62bd('0x1d')&&typeof _0x5260f9[_0x62bd('0x1e')]==='undefined';var _0x421658=_0x3073e1[_0x62bd('0x1f')];var _0x1e0b6a=_0x1d178b?0x0:_0x5260f9[_0x62bd('0x1c')];var _0x59a648=_0x1d178b?_0x3073e1[_0x62bd('0x1f')]:_0x5260f9[_0x62bd('0x1c')]+_0x5260f9[_0x62bd('0x1e')];var _0x21613e;if(_0x59a648>=_0x421658){_0x59a648=_0x421658;_0x21613e=0xc8;}else{_0x21613e=0xce;}_0x397a41['status'](_0x21613e);return _0x397a41[_0x62bd('0x20')](_0x62bd('0x21'),_0x1e0b6a+'-'+_0x59a648+'/'+_0x421658)[_0x62bd('0x1b')](_0x3073e1);}return null;};}function patchUpdates(_0x2298d9){return function(_0x482bff){try{jsonpatch[_0x62bd('0x22')](_0x482bff,_0x2298d9,!![]);}catch(_0x2cbc5c){return BPromise[_0x62bd('0x23')](_0x2cbc5c);}return _0x482bff[_0x62bd('0x24')]();};}function saveUpdates(_0x5ec823,_0x2d1d56){return function(_0x3bc39c){if(_0x3bc39c){return _0x3bc39c[_0x62bd('0x25')](_0x5ec823)[_0x62bd('0x26')](function(_0x2806c6){return _0x2806c6;});}return null;};}function removeEntity(_0x10fad2,_0x245628){return function(_0x304cf0){if(_0x304cf0){return _0x304cf0[_0x62bd('0x27')]()[_0x62bd('0x26')](function(){_0x10fad2[_0x62bd('0x28')](0xcc)[_0x62bd('0x1a')]();});}};}function handleEntityNotFound(_0x45e4f2,_0x528b43){return function(_0x855f17){if(!_0x855f17){_0x45e4f2[_0x62bd('0x19')](0x194);}return _0x855f17;};}function handleError(_0x5bce54,_0x2f1d83){_0x2f1d83=_0x2f1d83||0x1f4;return function(_0x3c6761){logger[_0x62bd('0x29')](_0x3c6761['stack']);if(_0x3c6761[_0x62bd('0x2a')]){delete _0x3c6761[_0x62bd('0x2a')];}_0x5bce54[_0x62bd('0x28')](_0x2f1d83)[_0x62bd('0x2b')](_0x3c6761);};}exports[_0x62bd('0x2c')]=function(_0x3f1f06,_0x414b46){var _0x53c2fd={},_0x532515={},_0x4823cf={'count':0x0,'rows':[]};var _0x31ad61=_[_0x62bd('0x2d')](db[_0x62bd('0x2e')][_0x62bd('0x2f')],function(_0x2a5626){return{'name':_0x2a5626[_0x62bd('0x30')],'type':_0x2a5626['type'][_0x62bd('0x31')]};});_0x532515[_0x62bd('0x32')]=_[_0x62bd('0x2d')](_0x31ad61,_0x62bd('0x2a'));_0x532515[_0x62bd('0x33')]=_['keys'](_0x3f1f06[_0x62bd('0x33')]);_0x532515['filters']=_['intersection'](_0x532515[_0x62bd('0x32')],_0x532515[_0x62bd('0x33')]);_0x53c2fd[_0x62bd('0x34')]=_[_0x62bd('0x35')](_0x532515[_0x62bd('0x32')],qs['fields'](_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x36')]));_0x53c2fd[_0x62bd('0x34')]=_0x53c2fd[_0x62bd('0x34')][_0x62bd('0x37')]?_0x53c2fd[_0x62bd('0x34')]:_0x532515[_0x62bd('0x32')];if(!_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x38')]('nolimit')){_0x53c2fd[_0x62bd('0x1e')]=qs['limit'](_0x3f1f06[_0x62bd('0x33')]['limit']);_0x53c2fd[_0x62bd('0x1c')]=qs[_0x62bd('0x1c')](_0x3f1f06['query'][_0x62bd('0x1c')]);}_0x53c2fd[_0x62bd('0x39')]=qs[_0x62bd('0x3a')](_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x3a')]);_0x53c2fd[_0x62bd('0x3b')]=qs[_0x62bd('0x3c')](_[_0x62bd('0x3d')](_0x3f1f06['query'],_0x532515['filters']),_0x31ad61);if(_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x3e')]){_0x53c2fd[_0x62bd('0x3b')]=_[_0x62bd('0x3f')](_0x53c2fd[_0x62bd('0x3b')],{'$or':_[_0x62bd('0x2d')](_0x31ad61,function(_0x28c3ae){if(_0x28c3ae['type']!==_0x62bd('0x40')){var _0x51ab8b={};_0x51ab8b[_0x28c3ae[_0x62bd('0x2a')]]={'$like':'%'+_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x3e')]+'%'};return _0x51ab8b;}})});}_0x53c2fd=_[_0x62bd('0x3f')]({},_0x53c2fd,_0x3f1f06[_0x62bd('0x41')]);var _0x5e6a6d={'where':_0x53c2fd[_0x62bd('0x3b')]};return db[_0x62bd('0x2e')][_0x62bd('0x1f')](_0x5e6a6d)['then'](function(_0x1f6845){_0x4823cf['count']=_0x1f6845;if(_0x3f1f06[_0x62bd('0x33')][_0x62bd('0x42')]){_0x53c2fd[_0x62bd('0x43')]=[{'all':!![]}];}return db[_0x62bd('0x2e')][_0x62bd('0x44')](_0x53c2fd);})[_0x62bd('0x26')](function(_0x428211){_0x4823cf[_0x62bd('0x45')]=_0x428211;return _0x4823cf;})[_0x62bd('0x26')](respondWithFilteredResult(_0x414b46,_0x53c2fd))[_0x62bd('0x46')](handleError(_0x414b46,null));};exports[_0x62bd('0x47')]=function(_0x5cb793,_0x23e430){var _0xb95d88={'raw':!![],'where':{'id':_0x5cb793[_0x62bd('0x48')]['id']}},_0x5bca77={};_0x5bca77[_0x62bd('0x32')]=_[_0x62bd('0x49')](db[_0x62bd('0x2e')][_0x62bd('0x2f')]);_0x5bca77[_0x62bd('0x33')]=_[_0x62bd('0x49')](_0x5cb793[_0x62bd('0x33')]);_0x5bca77[_0x62bd('0x3c')]=_[_0x62bd('0x35')](_0x5bca77[_0x62bd('0x32')],_0x5bca77[_0x62bd('0x33')]);_0xb95d88['attributes']=_['intersection'](_0x5bca77[_0x62bd('0x32')],qs['fields'](_0x5cb793[_0x62bd('0x33')][_0x62bd('0x36')]));_0xb95d88[_0x62bd('0x34')]=_0xb95d88[_0x62bd('0x34')][_0x62bd('0x37')]?_0xb95d88[_0x62bd('0x34')]:_0x5bca77[_0x62bd('0x32')];if(_0x5cb793[_0x62bd('0x33')]['includeAll']){_0xb95d88['include']=[{'all':!![]}];}_0xb95d88=_[_0x62bd('0x3f')]({},_0xb95d88,_0x5cb793[_0x62bd('0x41')]);return db[_0x62bd('0x2e')][_0x62bd('0x4a')](_0xb95d88)['then'](handleEntityNotFound(_0x23e430,null))[_0x62bd('0x26')](respondWithResult(_0x23e430,null))[_0x62bd('0x46')](handleError(_0x23e430,null));};exports[_0x62bd('0x4b')]=function(_0xab88e5,_0x2864ec){return db[_0x62bd('0x2e')]['create'](_0xab88e5[_0x62bd('0x4c')],{})[_0x62bd('0x26')](respondWithResult(_0x2864ec,0xc9))[_0x62bd('0x46')](handleError(_0x2864ec,null));};exports[_0x62bd('0x25')]=function(_0x30660a,_0x3c4f05){if(_0x30660a['body']['id']){delete _0x30660a['body']['id'];}return db['FaxQueueReport'][_0x62bd('0x4a')]({'where':{'id':_0x30660a[_0x62bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c4f05,null))[_0x62bd('0x26')](saveUpdates(_0x30660a[_0x62bd('0x4c')],null))[_0x62bd('0x26')](respondWithResult(_0x3c4f05,null))['catch'](handleError(_0x3c4f05,null));};exports['destroy']=function(_0x1c63e1,_0xa54a4){return db[_0x62bd('0x2e')][_0x62bd('0x4a')]({'where':{'id':_0x1c63e1['params']['id']}})['then'](handleEntityNotFound(_0xa54a4,null))[_0x62bd('0x26')](removeEntity(_0xa54a4,null))[_0x62bd('0x46')](handleError(_0xa54a4,null));};exports['describe']=function(_0x3519eb,_0x1f1cd4){return db[_0x62bd('0x2e')]['describe']()[_0x62bd('0x26')](respondWithResult(_0x1f1cd4,null))[_0x62bd('0x46')](handleError(_0x1f1cd4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d742e0a..8134932 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x1cb9,0x14e));var _0x91cb=function(_0x48238b,_0x143934){_0x48238b=_0x48238b-0x0;var _0x12391f=_0x1cb9[_0x48238b];return _0x12391f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'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(_0x4050fa,_0x2eb3d7){var _0x1d169c=function(_0x59dc3e){while(--_0x59dc3e){_0x4050fa['push'](_0x4050fa['shift']());}};_0x1d169c(++_0x2eb3d7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'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 f92b4db..752ae78 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 _0xfd9e=['rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x47c420,_0x3298d8){var _0x1f3007=function(_0xdf608e){while(--_0xdf608e){_0x47c420['push'](_0x47c420['shift']());}};_0x1f3007(++_0x3298d8);}(_0xfd9e,0x18e));var _0xefd9=function(_0x595abe,_0x9ef5e8){_0x595abe=_0x595abe-0x0;var _0x2a97bd=_0xfd9e[_0x595abe];return _0x2a97bd;};'use strict';var _=require('lodash');var util=require(_0xefd9('0x0'));var moment=require(_0xefd9('0x1'));var BPromise=require(_0xefd9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefd9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefd9('0x4'))(_0xefd9('0x5'));var config=require(_0xefd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xefd9('0x7')][_0xefd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2e5a,_0x2afac2,_0xfa314b){return new BPromise(function(_0x542077,_0x42e266){return client['request'](_0x1e2e5a,_0xfa314b)[_0xefd9('0x9')](function(_0x890342){logger[_0xefd9('0xa')](_0xefd9('0xb'),_0x2afac2,_0xefd9('0xc'));logger[_0xefd9('0xd')](_0xefd9('0xe'),_0x2afac2,_0xefd9('0xc'),JSON[_0xefd9('0xf')](_0x890342));if(_0x890342['error']){if(_0x890342['error'][_0xefd9('0x10')]===0x1f4){logger[_0xefd9('0x11')](_0xefd9('0xb'),_0x2afac2,_0x890342[_0xefd9('0x11')][_0xefd9('0x12')]);return _0x42e266(_0x890342[_0xefd9('0x11')][_0xefd9('0x12')]);}logger[_0xefd9('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x2afac2,_0x890342['error'][_0xefd9('0x12')]);return _0x542077(_0x890342['error'][_0xefd9('0x12')]);}else{logger[_0xefd9('0xa')](_0xefd9('0xb'),_0x2afac2,_0xefd9('0xc'));_0x542077(_0x890342['result'][_0xefd9('0x12')]);}})['catch'](function(_0x1947f2){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2afac2,_0x1947f2);_0x42e266(_0x1947f2);});});}exports[_0xefd9('0x13')]=function(_0x405780){var _0x371821=this;return new Promise(function(_0x1a4e46,_0x1d72a9){return db[_0xefd9('0x14')][_0xefd9('0x15')](_0x405780[_0xefd9('0x16')],{'raw':_0x405780[_0xefd9('0x17')]?_0x405780[_0xefd9('0x17')][_0xefd9('0x18')]===undefined?!![]:![]:!![]})[_0xefd9('0x9')](function(_0x5d2009){logger[_0xefd9('0xa')]('CreateFaxQueueReport',_0x405780);logger[_0xefd9('0xd')](_0xefd9('0x13'),_0x405780,JSON[_0xefd9('0xf')](_0x5d2009));_0x1a4e46(_0x5d2009);})[_0xefd9('0x19')](function(_0x45d132){logger[_0xefd9('0x11')](_0xefd9('0x13'),_0x45d132[_0xefd9('0x12')],_0x405780);_0x1d72a9(_0x371821[_0xefd9('0x11')](0x1f4,_0x45d132[_0xefd9('0x12')]));});});};exports[_0xefd9('0x1a')]=function(_0x303ee8){var _0x22e3a2=this;return new Promise(function(_0x1afdaa,_0x33cd52){return db['FaxQueueReport'][_0xefd9('0x1b')](_0x303ee8[_0xefd9('0x16')],{'raw':_0x303ee8['options']?_0x303ee8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x303ee8['options']?_0x303ee8[_0xefd9('0x17')][_0xefd9('0x1c')]||null:null,'attributes':_0x303ee8[_0xefd9('0x17')]?_0x303ee8['options'][_0xefd9('0x1d')]||null:null,'limit':_0x303ee8[_0xefd9('0x17')]?_0x303ee8[_0xefd9('0x17')][_0xefd9('0x1e')]||null:null})[_0xefd9('0x9')](function(_0x23e4c6){logger[_0xefd9('0xa')](_0xefd9('0x1a'),_0x303ee8);logger[_0xefd9('0xd')](_0xefd9('0x1a'),_0x303ee8,JSON[_0xefd9('0xf')](_0x23e4c6));_0x1afdaa(_0x23e4c6);})[_0xefd9('0x19')](function(_0x3e723e){logger['error']('UpdateFaxQueueReport',_0x3e723e[_0xefd9('0x12')],_0x303ee8);_0x33cd52(_0x22e3a2[_0xefd9('0x11')](0x1f4,_0x3e723e[_0xefd9('0x12')]));});});}; \ No newline at end of file +var _0x27da=['create','body','options','raw','CreateFaxQueueReport','where','limit','UpdateFaxQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueueReport'];(function(_0x2831f0,_0x278c7a){var _0x289f38=function(_0x1cf4fb){while(--_0x1cf4fb){_0x2831f0['push'](_0x2831f0['shift']());}};_0x289f38(++_0x278c7a);}(_0x27da,0x110));var _0xa27d=function(_0x3656b3,_0x14edec){_0x3656b3=_0x3656b3-0x0;var _0x2ba7df=_0x27da[_0x3656b3];return _0x2ba7df;};'use strict';var _=require('lodash');var util=require(_0xa27d('0x0'));var moment=require(_0xa27d('0x1'));var BPromise=require(_0xa27d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa27d('0x3'));var db=require(_0xa27d('0x4'))['db'];var utils=require(_0xa27d('0x5'));var logger=require(_0xa27d('0x6'))(_0xa27d('0x7'));var config=require(_0xa27d('0x8'));var jayson=require(_0xa27d('0x9'));var client=jayson[_0xa27d('0xa')][_0xa27d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x434df4,_0x1f875b,_0x50f627){return new BPromise(function(_0x8f955d,_0x597a27){return client['request'](_0x434df4,_0x50f627)[_0xa27d('0xc')](function(_0x1c00f8){logger[_0xa27d('0xd')](_0xa27d('0xe'),_0x1f875b,'request\x20sent');logger[_0xa27d('0xf')](_0xa27d('0x10'),_0x1f875b,_0xa27d('0x11'),JSON[_0xa27d('0x12')](_0x1c00f8));if(_0x1c00f8[_0xa27d('0x13')]){if(_0x1c00f8['error'][_0xa27d('0x14')]===0x1f4){logger['error'](_0xa27d('0xe'),_0x1f875b,_0x1c00f8['error'][_0xa27d('0x15')]);return _0x597a27(_0x1c00f8[_0xa27d('0x13')][_0xa27d('0x15')]);}logger[_0xa27d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x1f875b,_0x1c00f8[_0xa27d('0x13')][_0xa27d('0x15')]);return _0x8f955d(_0x1c00f8['error'][_0xa27d('0x15')]);}else{logger[_0xa27d('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1f875b,_0xa27d('0x11'));_0x8f955d(_0x1c00f8[_0xa27d('0x16')][_0xa27d('0x15')]);}})[_0xa27d('0x17')](function(_0xee8edd){logger[_0xa27d('0x13')](_0xa27d('0xe'),_0x1f875b,_0xee8edd);_0x597a27(_0xee8edd);});});}exports['CreateFaxQueueReport']=function(_0x4c158d){var _0x47cc63=this;return new Promise(function(_0x513cc2,_0x47f8e9){return db[_0xa27d('0x18')][_0xa27d('0x19')](_0x4c158d[_0xa27d('0x1a')],{'raw':_0x4c158d[_0xa27d('0x1b')]?_0x4c158d[_0xa27d('0x1b')][_0xa27d('0x1c')]===undefined?!![]:![]:!![]})[_0xa27d('0xc')](function(_0x5ad58c){logger[_0xa27d('0xd')](_0xa27d('0x1d'),_0x4c158d);logger['debug']('CreateFaxQueueReport',_0x4c158d,JSON[_0xa27d('0x12')](_0x5ad58c));_0x513cc2(_0x5ad58c);})[_0xa27d('0x17')](function(_0x497d3b){logger[_0xa27d('0x13')](_0xa27d('0x1d'),_0x497d3b['message'],_0x4c158d);_0x47f8e9(_0x47cc63[_0xa27d('0x13')](0x1f4,_0x497d3b['message']));});});};exports['UpdateFaxQueueReport']=function(_0x27be4b){var _0x28cf5b=this;return new Promise(function(_0xe83b3a,_0x55f1cd){return db['FaxQueueReport']['update'](_0x27be4b[_0xa27d('0x1a')],{'raw':_0x27be4b[_0xa27d('0x1b')]?_0x27be4b[_0xa27d('0x1b')][_0xa27d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27be4b[_0xa27d('0x1b')]?_0x27be4b['options'][_0xa27d('0x1e')]||null:null,'attributes':_0x27be4b[_0xa27d('0x1b')]?_0x27be4b[_0xa27d('0x1b')]['attributes']||null:null,'limit':_0x27be4b[_0xa27d('0x1b')]?_0x27be4b['options'][_0xa27d('0x1f')]||null:null})[_0xa27d('0xc')](function(_0xe44f9b){logger[_0xa27d('0xd')](_0xa27d('0x20'),_0x27be4b);logger[_0xa27d('0xf')](_0xa27d('0x20'),_0x27be4b,JSON[_0xa27d('0x12')](_0xe44f9b));_0xe83b3a(_0xe44f9b);})[_0xa27d('0x17')](function(_0x2a331){logger[_0xa27d('0x13')](_0xa27d('0x20'),_0x2a331[_0xa27d('0x15')],_0x27be4b);_0x55f1cd(_0x28cf5b['error'](0x1f4,_0x2a331[_0xa27d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f12a4b3..8cb697c 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 _0xcc83=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','delete','multer','util','path'];(function(_0x39b92,_0x5def4b){var _0x5a48ce=function(_0x6a9f0){while(--_0x6a9f0){_0x39b92['push'](_0x39b92['shift']());}};_0x5a48ce(++_0x5def4b);}(_0xcc83,0x1c9));var _0x3cc8=function(_0x77e9fb,_0x18c7f3){_0x77e9fb=_0x77e9fb-0x0;var _0x375318=_0xcc83[_0x77e9fb];return _0x375318;};'use strict';var multer=require(_0x3cc8('0x0'));var util=require(_0x3cc8('0x1'));var path=require(_0x3cc8('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cc8('0x3'));var router=express[_0x3cc8('0x4')]();var fs_extra=require(_0x3cc8('0x5'));var auth=require(_0x3cc8('0x6'));var interaction=require(_0x3cc8('0x7'));var config=require(_0x3cc8('0x8'));var controller=require(_0x3cc8('0x9'));router['get']('/',auth[_0x3cc8('0xa')](),controller['index']);router[_0x3cc8('0xb')](_0x3cc8('0xc'),auth[_0x3cc8('0xa')](),controller[_0x3cc8('0xd')]);router[_0x3cc8('0xb')](_0x3cc8('0xe'),auth[_0x3cc8('0xa')](),controller['show']);router[_0x3cc8('0xf')]('/',auth[_0x3cc8('0xa')](),controller[_0x3cc8('0x10')]);router[_0x3cc8('0x11')](_0x3cc8('0xe'),auth[_0x3cc8('0xa')](),controller[_0x3cc8('0x12')]);router[_0x3cc8('0x13')](_0x3cc8('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7cad=['/describe','isAuthenticated','describe','/:id','show','post','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x28479d,_0x1b8d89){var _0x45c08e=function(_0x4286ef){while(--_0x4286ef){_0x28479d['push'](_0x28479d['shift']());}};_0x45c08e(++_0x1b8d89);}(_0x7cad,0x1d3));var _0xd7ca=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x7cad[_0x1992f1];return _0x413dfe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd7ca('0x0'));var timeout=require(_0xd7ca('0x1'));var express=require(_0xd7ca('0x2'));var router=express[_0xd7ca('0x3')]();var fs_extra=require(_0xd7ca('0x4'));var auth=require(_0xd7ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd7ca('0x6'));var controller=require(_0xd7ca('0x7'));router[_0xd7ca('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd7ca('0x8')](_0xd7ca('0x9'),auth[_0xd7ca('0xa')](),controller[_0xd7ca('0xb')]);router[_0xd7ca('0x8')](_0xd7ca('0xc'),auth['isAuthenticated'](),controller[_0xd7ca('0xd')]);router[_0xd7ca('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd7ca('0xa')](),controller[_0xd7ca('0xf')]);router['delete'](_0xd7ca('0xc'),auth[_0xd7ca('0xa')](),controller[_0xd7ca('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e6c190b..aa39b76 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5269d2,_0x3b48c3){var _0xd13f84=function(_0x43eacc){while(--_0x43eacc){_0x5269d2['push'](_0x5269d2['shift']());}};_0xd13f84(++_0x3b48c3);}(_0xaa88,0x137));var _0x8aa8=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xaa88[_0xb0de07];return _0x4633d8;};'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 +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5ba809,_0x3b0532){var _0x46bbd8=function(_0x38c868){while(--_0x38c868){_0x5ba809['push'](_0x5ba809['shift']());}};_0x46bbd8(++_0x3b0532);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0xf3cd[_0x448bab];return _0x5dc534;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fc2d109..a513c60 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 _0x2f5e=['type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName'];(function(_0x311ebf,_0x1ac1a7){var _0x1ba494=function(_0x4365ae){while(--_0x4365ae){_0x311ebf['push'](_0x311ebf['shift']());}};_0x1ba494(++_0x1ac1a7);}(_0x2f5e,0x16b));var _0xe2f5=function(_0x40fe04,_0x37d302){_0x40fe04=_0x40fe04-0x0;var _0x3e3844=_0x2f5e[_0x40fe04];return _0x3e3844;};'use strict';var emlformat=require(_0xe2f5('0x0'));var rimraf=require(_0xe2f5('0x1'));var zipdir=require(_0xe2f5('0x2'));var jsonpatch=require(_0xe2f5('0x3'));var rp=require('request-promise');var moment=require(_0xe2f5('0x4'));var BPromise=require(_0xe2f5('0x5'));var Mustache=require(_0xe2f5('0x6'));var util=require(_0xe2f5('0x7'));var path=require('path');var sox=require(_0xe2f5('0x8'));var csv=require(_0xe2f5('0x9'));var ejs=require(_0xe2f5('0xa'));var fs=require('fs');var fs_extra=require(_0xe2f5('0xb'));var _=require(_0xe2f5('0xc'));var squel=require(_0xe2f5('0xd'));var crypto=require(_0xe2f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe2f5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe2f5('0x10'));var Papa=require(_0xe2f5('0x11'));var Redis=require('ioredis');var authService=require(_0xe2f5('0x12'));var qs=require(_0xe2f5('0x13'));var as=require(_0xe2f5('0x14'));var hardwareService=require(_0xe2f5('0x15'));var logger=require(_0xe2f5('0x16'))(_0xe2f5('0x17'));var utils=require(_0xe2f5('0x18'));var config=require(_0xe2f5('0x19'));var licenseUtil=require(_0xe2f5('0x1a'));var db=require(_0xe2f5('0x1b'))['db'];function respondWithStatusCode(_0x3b1572,_0x351354){_0x351354=_0x351354||0xcc;return function(_0x3841b4){if(_0x3841b4){return _0x3b1572[_0xe2f5('0x1c')](_0x351354);}return _0x3b1572['status'](_0x351354)[_0xe2f5('0x1d')]();};}function respondWithResult(_0x202251,_0x1303c1){_0x1303c1=_0x1303c1||0xc8;return function(_0x4ae2d9){if(_0x4ae2d9){return _0x202251['status'](_0x1303c1)['json'](_0x4ae2d9);}};}function respondWithFilteredResult(_0x3d7e14,_0x5d5357){return function(_0xbda593){if(_0xbda593){var _0x49d7c5=typeof _0x5d5357['offset']==='undefined'&&typeof _0x5d5357[_0xe2f5('0x1e')]===_0xe2f5('0x1f');var _0x520a4c=_0xbda593[_0xe2f5('0x20')];var _0xc89660=_0x49d7c5?0x0:_0x5d5357[_0xe2f5('0x21')];var _0x18678e=_0x49d7c5?_0xbda593[_0xe2f5('0x20')]:_0x5d5357[_0xe2f5('0x21')]+_0x5d5357[_0xe2f5('0x1e')];var _0x130fce;if(_0x18678e>=_0x520a4c){_0x18678e=_0x520a4c;_0x130fce=0xc8;}else{_0x130fce=0xce;}_0x3d7e14['status'](_0x130fce);return _0x3d7e14[_0xe2f5('0x22')](_0xe2f5('0x23'),_0xc89660+'-'+_0x18678e+'/'+_0x520a4c)[_0xe2f5('0x24')](_0xbda593);}return null;};}function patchUpdates(_0x2b2aad){return function(_0x39f720){try{jsonpatch[_0xe2f5('0x25')](_0x39f720,_0x2b2aad,!![]);}catch(_0x595f33){return BPromise[_0xe2f5('0x26')](_0x595f33);}return _0x39f720[_0xe2f5('0x27')]();};}function saveUpdates(_0x4c6e55,_0x9e6886){return function(_0x4afe80){if(_0x4afe80){return _0x4afe80['update'](_0x4c6e55)[_0xe2f5('0x28')](function(_0x5dc220){return _0x5dc220;});}return null;};}function removeEntity(_0x5b664c,_0x45090f){return function(_0x3d7c0f){if(_0x3d7c0f){return _0x3d7c0f[_0xe2f5('0x29')]()['then'](function(){_0x5b664c[_0xe2f5('0x2a')](0xcc)[_0xe2f5('0x1d')]();});}};}function handleEntityNotFound(_0x15e67d,_0xd8a755){return function(_0x1384a8){if(!_0x1384a8){_0x15e67d['sendStatus'](0x194);}return _0x1384a8;};}function handleError(_0x4a4719,_0x16036b){_0x16036b=_0x16036b||0x1f4;return function(_0x17fd1d){logger[_0xe2f5('0x2b')](_0x17fd1d[_0xe2f5('0x2c')]);if(_0x17fd1d[_0xe2f5('0x2d')]){delete _0x17fd1d[_0xe2f5('0x2d')];}_0x4a4719[_0xe2f5('0x2a')](_0x16036b)[_0xe2f5('0x2e')](_0x17fd1d);};}exports[_0xe2f5('0x2f')]=function(_0x4d9606,_0x46e485){var _0xa03715={},_0x2e3174={},_0x38942d={'count':0x0,'rows':[]};var _0x4b252d=_[_0xe2f5('0x30')](db[_0xe2f5('0x31')][_0xe2f5('0x32')],function(_0x31dde3){return{'name':_0x31dde3[_0xe2f5('0x33')],'type':_0x31dde3[_0xe2f5('0x34')][_0xe2f5('0x35')]};});_0x2e3174[_0xe2f5('0x36')]=_['map'](_0x4b252d,'name');_0x2e3174['query']=_[_0xe2f5('0x37')](_0x4d9606[_0xe2f5('0x38')]);_0x2e3174['filters']=_[_0xe2f5('0x39')](_0x2e3174['model'],_0x2e3174[_0xe2f5('0x38')]);_0xa03715[_0xe2f5('0x3a')]=_['intersection'](_0x2e3174[_0xe2f5('0x36')],qs['fields'](_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x3b')]));_0xa03715['attributes']=_0xa03715[_0xe2f5('0x3a')][_0xe2f5('0x3c')]?_0xa03715[_0xe2f5('0x3a')]:_0x2e3174[_0xe2f5('0x36')];if(!_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x3d')](_0xe2f5('0x3e'))){_0xa03715['limit']=qs[_0xe2f5('0x1e')](_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x1e')]);_0xa03715['offset']=qs[_0xe2f5('0x21')](_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x21')]);}_0xa03715[_0xe2f5('0x3f')]=qs[_0xe2f5('0x40')](_0x4d9606[_0xe2f5('0x38')]['sort']);_0xa03715['where']=qs[_0xe2f5('0x41')](_[_0xe2f5('0x42')](_0x4d9606[_0xe2f5('0x38')],_0x2e3174['filters']),_0x4b252d);if(_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x43')]){_0xa03715['where']=_[_0xe2f5('0x44')](_0xa03715['where'],{'$or':_[_0xe2f5('0x30')](_0x4b252d,function(_0x53348e){if(_0x53348e[_0xe2f5('0x34')]!==_0xe2f5('0x45')){var _0x507ad7={};_0x507ad7[_0x53348e[_0xe2f5('0x2d')]]={'$like':'%'+_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x43')]+'%'};return _0x507ad7;}})});}_0xa03715=_['merge']({},_0xa03715,_0x4d9606[_0xe2f5('0x46')]);var _0x2abb46={'where':_0xa03715[_0xe2f5('0x47')]};return db['FaxTransferReport'][_0xe2f5('0x20')](_0x2abb46)[_0xe2f5('0x28')](function(_0x4a5a0d){_0x38942d[_0xe2f5('0x20')]=_0x4a5a0d;if(_0x4d9606[_0xe2f5('0x38')][_0xe2f5('0x48')]){_0xa03715['include']=[{'all':!![]}];}return db[_0xe2f5('0x31')][_0xe2f5('0x49')](_0xa03715);})[_0xe2f5('0x28')](function(_0x7c4c86){_0x38942d[_0xe2f5('0x4a')]=_0x7c4c86;return _0x38942d;})[_0xe2f5('0x28')](respondWithFilteredResult(_0x46e485,_0xa03715))[_0xe2f5('0x4b')](handleError(_0x46e485,null));};exports['show']=function(_0xa6a76a,_0x6b5593){var _0x3d2488={'raw':!![],'where':{'id':_0xa6a76a[_0xe2f5('0x4c')]['id']}},_0x5e107d={};_0x5e107d[_0xe2f5('0x36')]=_['keys'](db['FaxTransferReport'][_0xe2f5('0x32')]);_0x5e107d['query']=_[_0xe2f5('0x37')](_0xa6a76a[_0xe2f5('0x38')]);_0x5e107d[_0xe2f5('0x41')]=_[_0xe2f5('0x39')](_0x5e107d['model'],_0x5e107d[_0xe2f5('0x38')]);_0x3d2488[_0xe2f5('0x3a')]=_[_0xe2f5('0x39')](_0x5e107d[_0xe2f5('0x36')],qs['fields'](_0xa6a76a[_0xe2f5('0x38')][_0xe2f5('0x3b')]));_0x3d2488[_0xe2f5('0x3a')]=_0x3d2488[_0xe2f5('0x3a')][_0xe2f5('0x3c')]?_0x3d2488[_0xe2f5('0x3a')]:_0x5e107d[_0xe2f5('0x36')];if(_0xa6a76a[_0xe2f5('0x38')][_0xe2f5('0x48')]){_0x3d2488[_0xe2f5('0x4d')]=[{'all':!![]}];}_0x3d2488=_[_0xe2f5('0x44')]({},_0x3d2488,_0xa6a76a['options']);return db['FaxTransferReport'][_0xe2f5('0x4e')](_0x3d2488)[_0xe2f5('0x28')](handleEntityNotFound(_0x6b5593,null))[_0xe2f5('0x28')](respondWithResult(_0x6b5593,null))['catch'](handleError(_0x6b5593,null));};exports[_0xe2f5('0x4f')]=function(_0x245b7c,_0x5db1a0){return db[_0xe2f5('0x31')][_0xe2f5('0x4f')](_0x245b7c[_0xe2f5('0x50')],{})[_0xe2f5('0x28')](respondWithResult(_0x5db1a0,0xc9))[_0xe2f5('0x4b')](handleError(_0x5db1a0,null));};exports[_0xe2f5('0x51')]=function(_0x5b3280,_0x538237){if(_0x5b3280[_0xe2f5('0x50')]['id']){delete _0x5b3280['body']['id'];}return db['FaxTransferReport'][_0xe2f5('0x4e')]({'where':{'id':_0x5b3280[_0xe2f5('0x4c')]['id']}})[_0xe2f5('0x28')](handleEntityNotFound(_0x538237,null))[_0xe2f5('0x28')](saveUpdates(_0x5b3280['body'],null))['then'](respondWithResult(_0x538237,null))['catch'](handleError(_0x538237,null));};exports[_0xe2f5('0x29')]=function(_0xa6b15d,_0x5e7ac8){return db[_0xe2f5('0x31')][_0xe2f5('0x4e')]({'where':{'id':_0xa6b15d[_0xe2f5('0x4c')]['id']}})[_0xe2f5('0x28')](handleEntityNotFound(_0x5e7ac8,null))['then'](removeEntity(_0x5e7ac8,null))[_0xe2f5('0x4b')](handleError(_0x5e7ac8,null));};exports[_0xe2f5('0x52')]=function(_0x1caca9,_0x5826e9){return db[_0xe2f5('0x31')][_0xe2f5('0x52')]()[_0xe2f5('0x28')](respondWithResult(_0x5826e9,null))[_0xe2f5('0x4b')](handleError(_0x5826e9,null));}; \ No newline at end of file +var _0xef7e=['fieldName','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','update','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','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','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','index','FaxTransferReport'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0xef7e,0x156));var _0xeef7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef7e[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xeef7('0x0'));var rimraf=require(_0xeef7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef7('0x2'));var rp=require(_0xeef7('0x3'));var moment=require(_0xeef7('0x4'));var BPromise=require(_0xeef7('0x5'));var Mustache=require(_0xeef7('0x6'));var util=require(_0xeef7('0x7'));var path=require(_0xeef7('0x8'));var sox=require(_0xeef7('0x9'));var csv=require('to-csv');var ejs=require(_0xeef7('0xa'));var fs=require('fs');var fs_extra=require(_0xeef7('0xb'));var _=require('lodash');var squel=require(_0xeef7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeef7('0xd'));var toCsv=require(_0xeef7('0xe'));var querystring=require('querystring');var Papa=require(_0xeef7('0xf'));var Redis=require(_0xeef7('0x10'));var authService=require(_0xeef7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeef7('0x12'));var hardwareService=require(_0xeef7('0x13'));var logger=require(_0xeef7('0x14'))(_0xeef7('0x15'));var utils=require('../../config/utils');var config=require(_0xeef7('0x16'));var licenseUtil=require(_0xeef7('0x17'));var db=require(_0xeef7('0x18'))['db'];function respondWithStatusCode(_0x1a00f0,_0x5ec6fc){_0x5ec6fc=_0x5ec6fc||0xcc;return function(_0x393dbf){if(_0x393dbf){return _0x1a00f0[_0xeef7('0x19')](_0x5ec6fc);}return _0x1a00f0[_0xeef7('0x1a')](_0x5ec6fc)[_0xeef7('0x1b')]();};}function respondWithResult(_0x271926,_0x5f10b2){_0x5f10b2=_0x5f10b2||0xc8;return function(_0x3bbf4b){if(_0x3bbf4b){return _0x271926[_0xeef7('0x1a')](_0x5f10b2)[_0xeef7('0x1c')](_0x3bbf4b);}};}function respondWithFilteredResult(_0x2c67b0,_0x572257){return function(_0x395b8a){if(_0x395b8a){var _0x517160=typeof _0x572257[_0xeef7('0x1d')]===_0xeef7('0x1e')&&typeof _0x572257[_0xeef7('0x1f')]===_0xeef7('0x1e');var _0x3f244f=_0x395b8a[_0xeef7('0x20')];var _0x1becef=_0x517160?0x0:_0x572257[_0xeef7('0x1d')];var _0x16ebe1=_0x517160?_0x395b8a[_0xeef7('0x20')]:_0x572257[_0xeef7('0x1d')]+_0x572257[_0xeef7('0x1f')];var _0x14fcdf;if(_0x16ebe1>=_0x3f244f){_0x16ebe1=_0x3f244f;_0x14fcdf=0xc8;}else{_0x14fcdf=0xce;}_0x2c67b0[_0xeef7('0x1a')](_0x14fcdf);return _0x2c67b0[_0xeef7('0x21')](_0xeef7('0x22'),_0x1becef+'-'+_0x16ebe1+'/'+_0x3f244f)['json'](_0x395b8a);}return null;};}function patchUpdates(_0xfba0ad){return function(_0x4b8cb7){try{jsonpatch[_0xeef7('0x23')](_0x4b8cb7,_0xfba0ad,!![]);}catch(_0x42077e){return BPromise['reject'](_0x42077e);}return _0x4b8cb7[_0xeef7('0x24')]();};}function saveUpdates(_0x5a0c31,_0x503067){return function(_0x46c6c2){if(_0x46c6c2){return _0x46c6c2['update'](_0x5a0c31)[_0xeef7('0x25')](function(_0x496b12){return _0x496b12;});}return null;};}function removeEntity(_0xa245a8,_0x45a939){return function(_0x237b51){if(_0x237b51){return _0x237b51['destroy']()['then'](function(){_0xa245a8[_0xeef7('0x1a')](0xcc)[_0xeef7('0x1b')]();});}};}function handleEntityNotFound(_0x4c9453,_0x238e61){return function(_0x4c9ccb){if(!_0x4c9ccb){_0x4c9453[_0xeef7('0x19')](0x194);}return _0x4c9ccb;};}function handleError(_0x48aebc,_0xd3790d){_0xd3790d=_0xd3790d||0x1f4;return function(_0x40e430){logger[_0xeef7('0x26')](_0x40e430[_0xeef7('0x27')]);if(_0x40e430[_0xeef7('0x28')]){delete _0x40e430[_0xeef7('0x28')];}_0x48aebc[_0xeef7('0x1a')](_0xd3790d)['send'](_0x40e430);};}exports[_0xeef7('0x29')]=function(_0x5d2f55,_0x54f117){var _0x4a26c6={},_0x553b56={},_0x55841b={'count':0x0,'rows':[]};var _0x35efd3=_['map'](db[_0xeef7('0x2a')]['rawAttributes'],function(_0x20ac7c){return{'name':_0x20ac7c[_0xeef7('0x2b')],'type':_0x20ac7c['type']['key']};});_0x553b56['model']=_[_0xeef7('0x2c')](_0x35efd3,'name');_0x553b56[_0xeef7('0x2d')]=_[_0xeef7('0x2e')](_0x5d2f55[_0xeef7('0x2d')]);_0x553b56['filters']=_[_0xeef7('0x2f')](_0x553b56[_0xeef7('0x30')],_0x553b56[_0xeef7('0x2d')]);_0x4a26c6[_0xeef7('0x31')]=_[_0xeef7('0x2f')](_0x553b56[_0xeef7('0x30')],qs[_0xeef7('0x32')](_0x5d2f55[_0xeef7('0x2d')][_0xeef7('0x32')]));_0x4a26c6[_0xeef7('0x31')]=_0x4a26c6[_0xeef7('0x31')][_0xeef7('0x33')]?_0x4a26c6[_0xeef7('0x31')]:_0x553b56['model'];if(!_0x5d2f55[_0xeef7('0x2d')][_0xeef7('0x34')](_0xeef7('0x35'))){_0x4a26c6[_0xeef7('0x1f')]=qs[_0xeef7('0x1f')](_0x5d2f55['query'][_0xeef7('0x1f')]);_0x4a26c6['offset']=qs[_0xeef7('0x1d')](_0x5d2f55[_0xeef7('0x2d')][_0xeef7('0x1d')]);}_0x4a26c6[_0xeef7('0x36')]=qs[_0xeef7('0x37')](_0x5d2f55[_0xeef7('0x2d')][_0xeef7('0x37')]);_0x4a26c6[_0xeef7('0x38')]=qs[_0xeef7('0x39')](_[_0xeef7('0x3a')](_0x5d2f55[_0xeef7('0x2d')],_0x553b56[_0xeef7('0x39')]),_0x35efd3);if(_0x5d2f55[_0xeef7('0x2d')]['filter']){_0x4a26c6[_0xeef7('0x38')]=_[_0xeef7('0x3b')](_0x4a26c6[_0xeef7('0x38')],{'$or':_['map'](_0x35efd3,function(_0x16e288){if(_0x16e288[_0xeef7('0x3c')]!==_0xeef7('0x3d')){var _0x238aeb={};_0x238aeb[_0x16e288[_0xeef7('0x28')]]={'$like':'%'+_0x5d2f55[_0xeef7('0x2d')]['filter']+'%'};return _0x238aeb;}})});}_0x4a26c6=_[_0xeef7('0x3b')]({},_0x4a26c6,_0x5d2f55[_0xeef7('0x3e')]);var _0x150212={'where':_0x4a26c6['where']};return db[_0xeef7('0x2a')][_0xeef7('0x20')](_0x150212)[_0xeef7('0x25')](function(_0xe8ee92){_0x55841b[_0xeef7('0x20')]=_0xe8ee92;if(_0x5d2f55[_0xeef7('0x2d')]['includeAll']){_0x4a26c6[_0xeef7('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xeef7('0x40')](_0x4a26c6);})[_0xeef7('0x25')](function(_0x1cd860){_0x55841b[_0xeef7('0x41')]=_0x1cd860;return _0x55841b;})[_0xeef7('0x25')](respondWithFilteredResult(_0x54f117,_0x4a26c6))[_0xeef7('0x42')](handleError(_0x54f117,null));};exports[_0xeef7('0x43')]=function(_0x27d0fe,_0x58f8af){var _0x5e3a0e={'raw':!![],'where':{'id':_0x27d0fe[_0xeef7('0x44')]['id']}},_0x4e8761={};_0x4e8761[_0xeef7('0x30')]=_[_0xeef7('0x2e')](db[_0xeef7('0x2a')][_0xeef7('0x45')]);_0x4e8761['query']=_[_0xeef7('0x2e')](_0x27d0fe[_0xeef7('0x2d')]);_0x4e8761[_0xeef7('0x39')]=_[_0xeef7('0x2f')](_0x4e8761[_0xeef7('0x30')],_0x4e8761['query']);_0x5e3a0e[_0xeef7('0x31')]=_[_0xeef7('0x2f')](_0x4e8761['model'],qs['fields'](_0x27d0fe['query'][_0xeef7('0x32')]));_0x5e3a0e[_0xeef7('0x31')]=_0x5e3a0e[_0xeef7('0x31')][_0xeef7('0x33')]?_0x5e3a0e[_0xeef7('0x31')]:_0x4e8761['model'];if(_0x27d0fe[_0xeef7('0x2d')][_0xeef7('0x46')]){_0x5e3a0e['include']=[{'all':!![]}];}_0x5e3a0e=_['merge']({},_0x5e3a0e,_0x27d0fe[_0xeef7('0x3e')]);return db[_0xeef7('0x2a')]['find'](_0x5e3a0e)[_0xeef7('0x25')](handleEntityNotFound(_0x58f8af,null))[_0xeef7('0x25')](respondWithResult(_0x58f8af,null))[_0xeef7('0x42')](handleError(_0x58f8af,null));};exports[_0xeef7('0x47')]=function(_0x20f3d2,_0x399f32){return db[_0xeef7('0x2a')][_0xeef7('0x47')](_0x20f3d2[_0xeef7('0x48')],{})[_0xeef7('0x25')](respondWithResult(_0x399f32,0xc9))[_0xeef7('0x42')](handleError(_0x399f32,null));};exports[_0xeef7('0x49')]=function(_0x224487,_0xb442e){if(_0x224487[_0xeef7('0x48')]['id']){delete _0x224487[_0xeef7('0x48')]['id'];}return db[_0xeef7('0x2a')][_0xeef7('0x4a')]({'where':{'id':_0x224487[_0xeef7('0x44')]['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0xb442e,null))[_0xeef7('0x25')](saveUpdates(_0x224487[_0xeef7('0x48')],null))[_0xeef7('0x25')](respondWithResult(_0xb442e,null))[_0xeef7('0x42')](handleError(_0xb442e,null));};exports[_0xeef7('0x4b')]=function(_0x12e812,_0x2db7d2){return db[_0xeef7('0x2a')][_0xeef7('0x4a')]({'where':{'id':_0x12e812[_0xeef7('0x44')]['id']}})[_0xeef7('0x25')](handleEntityNotFound(_0x2db7d2,null))['then'](removeEntity(_0x2db7d2,null))[_0xeef7('0x42')](handleError(_0x2db7d2,null));};exports['describe']=function(_0x6dee32,_0xe3b313){return db['FaxTransferReport'][_0xeef7('0x4c')]()[_0xeef7('0x25')](respondWithResult(_0xe3b313,null))[_0xeef7('0x42')](handleError(_0xe3b313,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 00a6989..8b8d14f 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 _0xd6ab=['exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xd6ab,0x124));var _0xbd6a=function(_0x208e02,_0x3c37af){_0x208e02=_0x208e02-0x0;var _0x464f1f=_0xd6ab[_0x208e02];return _0x464f1f;};'use strict';var _=require(_0xbd6a('0x0'));var util=require(_0xbd6a('0x1'));var logger=require(_0xbd6a('0x2'))(_0xbd6a('0x3'));var moment=require(_0xbd6a('0x4'));var BPromise=require(_0xbd6a('0x5'));var rp=require(_0xbd6a('0x6'));var fs=require('fs');var path=require(_0xbd6a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xbd6a('0x8')]=function(_0x24a641,_0x5c5bfe){return _0x24a641[_0xbd6a('0x9')]('FaxTransferReport',attributes,{'tableName':_0xbd6a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbd6a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf100=['../../config/environment','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf100,0x119));var _0x0f10=function(_0x3217bb,_0x26b8da){_0x3217bb=_0x3217bb-0x0;var _0x1091c5=_0xf100[_0x3217bb];return _0x1091c5;};'use strict';var _=require(_0x0f10('0x0'));var util=require(_0x0f10('0x1'));var logger=require(_0x0f10('0x2'))(_0x0f10('0x3'));var moment=require('moment');var BPromise=require(_0x0f10('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f10('0x5'));var rimraf=require(_0x0f10('0x6'));var config=require(_0x0f10('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x0f10('0x8')]=function(_0x1f6361,_0x17f8c5){return _0x1f6361['define'](_0x0f10('0x9'),attributes,{'tableName':_0x0f10('0xa'),'paranoid':![],'indexes':[{'name':_0x0f10('0xb'),'fields':[_0x0f10('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f4b81f0..146950f 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 _0x3cd9=['FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3cd9,0xb0));var _0x93cd=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x3cd9[_0x5ad190];return _0x518ed3;};'use strict';var _=require(_0x93cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x93cd('0x1'));var rs=require(_0x93cd('0x2'));var fs=require('fs');var Redis=require(_0x93cd('0x3'));var db=require(_0x93cd('0x4'))['db'];var utils=require(_0x93cd('0x5'));var logger=require(_0x93cd('0x6'))(_0x93cd('0x7'));var config=require(_0x93cd('0x8'));var jayson=require(_0x93cd('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49b5c8,_0x28b368,_0x257cc0){return new BPromise(function(_0x277802,_0x154492){return client[_0x93cd('0xa')](_0x49b5c8,_0x257cc0)[_0x93cd('0xb')](function(_0x290c3a){logger[_0x93cd('0xc')](_0x93cd('0xd'),_0x28b368,'request\x20sent');logger[_0x93cd('0xe')](_0x93cd('0xf'),_0x28b368,_0x93cd('0x10'),JSON[_0x93cd('0x11')](_0x290c3a));if(_0x290c3a['error']){if(_0x290c3a[_0x93cd('0x12')]['code']===0x1f4){logger[_0x93cd('0x12')](_0x93cd('0xd'),_0x28b368,_0x290c3a[_0x93cd('0x12')][_0x93cd('0x13')]);return _0x154492(_0x290c3a[_0x93cd('0x12')][_0x93cd('0x13')]);}logger[_0x93cd('0x12')](_0x93cd('0xd'),_0x28b368,_0x290c3a[_0x93cd('0x12')]['message']);return _0x277802(_0x290c3a['error'][_0x93cd('0x13')]);}else{logger[_0x93cd('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x28b368,_0x93cd('0x10'));_0x277802(_0x290c3a[_0x93cd('0x14')][_0x93cd('0x13')]);}})['catch'](function(_0x807f24){logger[_0x93cd('0x12')](_0x93cd('0xd'),_0x28b368,_0x807f24);_0x154492(_0x807f24);});});} \ No newline at end of file +var _0x8d09=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','util'];(function(_0x17d928,_0x15f099){var _0x2c812c=function(_0x5e42db){while(--_0x5e42db){_0x17d928['push'](_0x17d928['shift']());}};_0x2c812c(++_0x15f099);}(_0x8d09,0x83));var _0x98d0=function(_0xc48539,_0x4f5a61){_0xc48539=_0xc48539-0x0;var _0x17314a=_0x8d09[_0xc48539];return _0x17314a;};'use strict';var _=require('lodash');var util=require(_0x98d0('0x0'));var moment=require(_0x98d0('0x1'));var BPromise=require(_0x98d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98d0('0x3'));var db=require(_0x98d0('0x4'))['db'];var utils=require(_0x98d0('0x5'));var logger=require('../../config/logger')(_0x98d0('0x6'));var config=require('../../config/environment');var jayson=require(_0x98d0('0x7'));var client=jayson[_0x98d0('0x8')][_0x98d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5afe56,_0xc416aa,_0x394a08){return new BPromise(function(_0x524c6c,_0x3185d9){return client[_0x98d0('0xa')](_0x5afe56,_0x394a08)[_0x98d0('0xb')](function(_0x468ec0){logger[_0x98d0('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0xc416aa,_0x98d0('0xd'));logger[_0x98d0('0xe')](_0x98d0('0xf'),_0xc416aa,_0x98d0('0xd'),JSON[_0x98d0('0x10')](_0x468ec0));if(_0x468ec0['error']){if(_0x468ec0[_0x98d0('0x11')][_0x98d0('0x12')]===0x1f4){logger[_0x98d0('0x11')](_0x98d0('0x13'),_0xc416aa,_0x468ec0[_0x98d0('0x11')][_0x98d0('0x14')]);return _0x3185d9(_0x468ec0[_0x98d0('0x11')]['message']);}logger[_0x98d0('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0xc416aa,_0x468ec0['error'][_0x98d0('0x14')]);return _0x524c6c(_0x468ec0[_0x98d0('0x11')][_0x98d0('0x14')]);}else{logger[_0x98d0('0xc')](_0x98d0('0x13'),_0xc416aa,'request\x20sent');_0x524c6c(_0x468ec0['result']['message']);}})[_0x98d0('0x15')](function(_0x1ba0be){logger[_0x98d0('0x11')](_0x98d0('0x13'),_0xc416aa,_0x1ba0be);_0x3185d9(_0x1ba0be);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d9da1e3..53989c9 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 _0x5d0d=['multer','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x36ea36,_0x544f2a){var _0x419659=function(_0x43a55e){while(--_0x43a55e){_0x36ea36['push'](_0x36ea36['shift']());}};_0x419659(++_0x544f2a);}(_0x5d0d,0xaa));var _0xd5d0=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x5d0d[_0x44a64f];return _0x52024b;};'use strict';var multer=require(_0xd5d0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd5d0('0x1')]();var fs_extra=require(_0xd5d0('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd5d0('0x3'));var controller=require('./faxTransferReport.controller');router[_0xd5d0('0x4')]('/',auth['isAuthenticated'](),controller[_0xd5d0('0x5')]);router[_0xd5d0('0x4')](_0xd5d0('0x6'),auth[_0xd5d0('0x7')](),controller[_0xd5d0('0x8')]);router['get'](_0xd5d0('0x9'),auth['isAuthenticated'](),controller[_0xd5d0('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd5d0('0xb')]);router[_0xd5d0('0xc')](_0xd5d0('0x9'),auth['isAuthenticated'](),controller[_0xd5d0('0xd')]);router[_0xd5d0('0xe')](_0xd5d0('0x9'),auth['isAuthenticated'](),controller[_0xd5d0('0xf')]);module[_0xd5d0('0x10')]=router; \ No newline at end of file +var _0x257c=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x257c,0xab));var _0xc257=function(_0x174a4d,_0x203ae3){_0x174a4d=_0x174a4d-0x0;var _0x240fa1=_0x257c[_0x174a4d];return _0x240fa1;};'use strict';var multer=require(_0xc257('0x0'));var util=require('util');var path=require(_0xc257('0x1'));var timeout=require(_0xc257('0x2'));var express=require(_0xc257('0x3'));var router=express[_0xc257('0x4')]();var fs_extra=require(_0xc257('0x5'));var auth=require(_0xc257('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc257('0x7'));var controller=require('./faxTransferReport.controller');router[_0xc257('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc257('0x9'),auth[_0xc257('0xa')](),controller[_0xc257('0xb')]);router[_0xc257('0x8')](_0xc257('0xc'),auth['isAuthenticated'](),controller[_0xc257('0xd')]);router[_0xc257('0xe')]('/',auth[_0xc257('0xa')](),controller[_0xc257('0xf')]);router[_0xc257('0x10')]('/:id',auth[_0xc257('0xa')](),controller[_0xc257('0x11')]);router[_0xc257('0x12')](_0xc257('0xc'),auth[_0xc257('0xa')](),controller[_0xc257('0x13')]);module[_0xc257('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 224293c..f375bf6 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 _0x78bf=['/:id/configurations','getConfigurations','getFields','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x222c9f,_0x515cd0){var _0x3e74b5=function(_0x1597c4){while(--_0x1597c4){_0x222c9f['push'](_0x222c9f['shift']());}};_0x3e74b5(++_0x515cd0);}(_0x78bf,0x1c1));var _0xf78b=function(_0x53b0f8,_0x459130){_0x53b0f8=_0x53b0f8-0x0;var _0x133415=_0x78bf[_0x53b0f8];return _0x133415;};'use strict';var multer=require('multer');var util=require(_0xf78b('0x0'));var path=require(_0xf78b('0x1'));var timeout=require(_0xf78b('0x2'));var express=require(_0xf78b('0x3'));var router=express[_0xf78b('0x4')]();var fs_extra=require(_0xf78b('0x5'));var auth=require(_0xf78b('0x6'));var interaction=require(_0xf78b('0x7'));var config=require(_0xf78b('0x8'));var controller=require('./intDeskAccount.controller');router[_0xf78b('0x9')]('/',auth[_0xf78b('0xa')](),controller[_0xf78b('0xb')]);router[_0xf78b('0x9')](_0xf78b('0xc'),auth[_0xf78b('0xa')](),controller['show']);router[_0xf78b('0x9')](_0xf78b('0xd'),auth[_0xf78b('0xa')](),controller[_0xf78b('0xe')]);router['get']('/:id/fields',auth[_0xf78b('0xa')](),controller[_0xf78b('0xf')]);router[_0xf78b('0x10')]('/',auth[_0xf78b('0xa')](),controller['create']);router[_0xf78b('0x10')](_0xf78b('0xd'),auth[_0xf78b('0xa')](),controller['addConfiguration']);router['put'](_0xf78b('0xc'),auth[_0xf78b('0xa')](),controller[_0xf78b('0x11')]);router[_0xf78b('0x12')]('/:id',auth[_0xf78b('0xa')](),controller[_0xf78b('0x13')]);module[_0xf78b('0x14')]=router; \ No newline at end of file +var _0xf3b8=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0xf3b8,0x1d7));var _0x8f3b=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xf3b8[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x8f3b('0x0'));var util=require(_0x8f3b('0x1'));var path=require('path');var timeout=require(_0x8f3b('0x2'));var express=require('express');var router=express[_0x8f3b('0x3')]();var fs_extra=require(_0x8f3b('0x4'));var auth=require(_0x8f3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8f3b('0x6'));var controller=require('./intDeskAccount.controller');router[_0x8f3b('0x7')]('/',auth[_0x8f3b('0x8')](),controller[_0x8f3b('0x9')]);router[_0x8f3b('0x7')](_0x8f3b('0xa'),auth['isAuthenticated'](),controller[_0x8f3b('0xb')]);router[_0x8f3b('0x7')](_0x8f3b('0xc'),auth[_0x8f3b('0x8')](),controller[_0x8f3b('0xd')]);router[_0x8f3b('0x7')](_0x8f3b('0xe'),auth['isAuthenticated'](),controller[_0x8f3b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8f3b('0x10')]);router[_0x8f3b('0x11')](_0x8f3b('0xc'),auth['isAuthenticated'](),controller[_0x8f3b('0x12')]);router[_0x8f3b('0x13')](_0x8f3b('0xa'),auth[_0x8f3b('0x8')](),controller[_0x8f3b('0x14')]);router['delete'](_0x8f3b('0xa'),auth[_0x8f3b('0x8')](),controller[_0x8f3b('0x15')]);module[_0x8f3b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0326466..a9c0f7b 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 _0x99e8=['exports','STRING','basic','integrationTab'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x99e8,0x178));var _0x899e=function(_0x15e2ef,_0x3359f1){_0x15e2ef=_0x15e2ef-0x0;var _0x1979bb=_0x99e8[_0x15e2ef];return _0x1979bb;};'use strict';var Sequelize=require('sequelize');module[_0x899e('0x0')]={'name':{'type':Sequelize[_0x899e('0x1')]},'description':{'type':Sequelize[_0x899e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x899e('0x2')),'defaultValue':_0x899e('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x899e('0x1')]},'consumerSecret':{'type':Sequelize[_0x899e('0x1')]},'token':{'type':Sequelize[_0x899e('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x899e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x899e('0x3'),'newTab'),'defaultValue':_0x899e('0x3')}}; \ No newline at end of file +var _0x9247=['integrationTab','exports','STRING','ENUM','basic','newTab'];(function(_0x117360,_0x674a6b){var _0x2f8cfb=function(_0x29e54a){while(--_0x29e54a){_0x117360['push'](_0x117360['shift']());}};_0x2f8cfb(++_0x674a6b);}(_0x9247,0x16f));var _0x7924=function(_0x515992,_0x245981){_0x515992=_0x515992-0x0;var _0x29033c=_0x9247[_0x515992];return _0x29033c;};'use strict';var Sequelize=require('sequelize');module[_0x7924('0x0')]={'name':{'type':Sequelize[_0x7924('0x1')]},'description':{'type':Sequelize[_0x7924('0x1')]},'username':{'type':Sequelize[_0x7924('0x1')]},'remoteUri':{'type':Sequelize[_0x7924('0x1')]},'authType':{'type':Sequelize[_0x7924('0x2')](_0x7924('0x3')),'defaultValue':_0x7924('0x3')},'password':{'type':Sequelize[_0x7924('0x1')]},'consumerKey':{'type':Sequelize[_0x7924('0x1')]},'consumerSecret':{'type':Sequelize[_0x7924('0x1')]},'token':{'type':Sequelize[_0x7924('0x1')]},'tokenSecret':{'type':Sequelize[_0x7924('0x1')]},'serverUrl':{'type':Sequelize[_0x7924('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7924('0x2')]('integrationTab',_0x7924('0x4')),'defaultValue':_0x7924('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5cbe077..f825bf2 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 _0xb584=['AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','DeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','update','body','getConfigurations','findOne','DeskConfiguration','sort','options'];(function(_0x37e342,_0x160c8f){var _0x1768f9=function(_0x413c98){while(--_0x413c98){_0x37e342['push'](_0x37e342['shift']());}};_0x1768f9(++_0x160c8f);}(_0xb584,0x1ec));var _0x4b58=function(_0x303d1b,_0x39b670){_0x303d1b=_0x303d1b-0x0;var _0x234a35=_0xb584[_0x303d1b];return _0x234a35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b58('0x0'));var zipdir=require(_0x4b58('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b58('0x2'));var moment=require(_0x4b58('0x3'));var BPromise=require(_0x4b58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b58('0x5'));var sox=require(_0x4b58('0x6'));var csv=require(_0x4b58('0x7'));var ejs=require(_0x4b58('0x8'));var fs=require('fs');var fs_extra=require(_0x4b58('0x9'));var _=require(_0x4b58('0xa'));var squel=require(_0x4b58('0xb'));var crypto=require(_0x4b58('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4b58('0xd'));var toCsv=require(_0x4b58('0x7'));var querystring=require(_0x4b58('0xe'));var Papa=require(_0x4b58('0xf'));var Redis=require(_0x4b58('0x10'));var authService=require(_0x4b58('0x11'));var qs=require(_0x4b58('0x12'));var as=require(_0x4b58('0x13'));var hardwareService=require(_0x4b58('0x14'));var logger=require('../../config/logger')(_0x4b58('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b58('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4b58('0x17'));function respondWithStatusCode(_0x412c22,_0x41187b){_0x41187b=_0x41187b||0xcc;return function(_0x37146c){if(_0x37146c){return _0x412c22[_0x4b58('0x18')](_0x41187b);}return _0x412c22[_0x4b58('0x19')](_0x41187b)[_0x4b58('0x1a')]();};}function respondWithResult(_0x1337b8,_0x525ea2){_0x525ea2=_0x525ea2||0xc8;return function(_0x54aa99){if(_0x54aa99){return _0x1337b8[_0x4b58('0x19')](_0x525ea2)[_0x4b58('0x1b')](_0x54aa99);}};}function respondWithFilteredResult(_0x523fc5,_0x2fae3a){return function(_0x3927f9){if(_0x3927f9){var _0x3c34bc=typeof _0x2fae3a[_0x4b58('0x1c')]===_0x4b58('0x1d')&&typeof _0x2fae3a['limit']==='undefined';var _0x1db3d5=_0x3927f9[_0x4b58('0x1e')];var _0x36babe=_0x3c34bc?0x0:_0x2fae3a[_0x4b58('0x1c')];var _0x9a4a58=_0x3c34bc?_0x3927f9[_0x4b58('0x1e')]:_0x2fae3a[_0x4b58('0x1c')]+_0x2fae3a['limit'];var _0x5c1747;if(_0x9a4a58>=_0x1db3d5){_0x9a4a58=_0x1db3d5;_0x5c1747=0xc8;}else{_0x5c1747=0xce;}_0x523fc5['status'](_0x5c1747);return _0x523fc5[_0x4b58('0x1f')](_0x4b58('0x20'),_0x36babe+'-'+_0x9a4a58+'/'+_0x1db3d5)['json'](_0x3927f9);}return null;};}function patchUpdates(_0x2191cc){return function(_0x121552){try{jsonpatch[_0x4b58('0x21')](_0x121552,_0x2191cc,!![]);}catch(_0x35b038){return BPromise[_0x4b58('0x22')](_0x35b038);}return _0x121552[_0x4b58('0x23')]();};}function saveUpdates(_0x4d5f2d,_0x2f0436){return function(_0x4bbdef){if(_0x4bbdef){return _0x4bbdef['update'](_0x4d5f2d)['then'](function(_0x47f4b2){return _0x47f4b2;});}return null;};}function removeEntity(_0x25bd3f,_0x580de0){return function(_0x1409e1){if(_0x1409e1){return _0x1409e1[_0x4b58('0x24')]()[_0x4b58('0x25')](function(){_0x25bd3f[_0x4b58('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1959c0,_0x4b42a7){return function(_0x3a4ec9){if(!_0x3a4ec9){_0x1959c0[_0x4b58('0x18')](0x194);}return _0x3a4ec9;};}function handleError(_0x5c2e24,_0x5be0a5){_0x5be0a5=_0x5be0a5||0x1f4;return function(_0x441114){logger[_0x4b58('0x26')](_0x441114[_0x4b58('0x27')]);if(_0x441114['name']){delete _0x441114[_0x4b58('0x28')];}_0x5c2e24['status'](_0x5be0a5)['send'](_0x441114);};}exports['index']=function(_0x3cd764,_0x3f8ab3){var _0x1f14a9={},_0x426e23={},_0xe5478d={'count':0x0,'rows':[]};var _0x1b6dda=_['map'](db[_0x4b58('0x29')][_0x4b58('0x2a')],function(_0x4ac3eb){return{'name':_0x4ac3eb[_0x4b58('0x2b')],'type':_0x4ac3eb[_0x4b58('0x2c')][_0x4b58('0x2d')]};});_0x426e23['model']=_[_0x4b58('0x2e')](_0x1b6dda,_0x4b58('0x28'));_0x426e23[_0x4b58('0x2f')]=_[_0x4b58('0x30')](_0x3cd764[_0x4b58('0x2f')]);_0x426e23[_0x4b58('0x31')]=_[_0x4b58('0x32')](_0x426e23[_0x4b58('0x33')],_0x426e23[_0x4b58('0x2f')]);_0x1f14a9[_0x4b58('0x34')]=_[_0x4b58('0x32')](_0x426e23[_0x4b58('0x33')],qs['fields'](_0x3cd764[_0x4b58('0x2f')][_0x4b58('0x35')]));_0x1f14a9[_0x4b58('0x34')]=_0x1f14a9['attributes'][_0x4b58('0x36')]?_0x1f14a9[_0x4b58('0x34')]:_0x426e23[_0x4b58('0x33')];if(!_0x3cd764[_0x4b58('0x2f')]['hasOwnProperty'](_0x4b58('0x37'))){_0x1f14a9['limit']=qs[_0x4b58('0x38')](_0x3cd764[_0x4b58('0x2f')][_0x4b58('0x38')]);_0x1f14a9['offset']=qs['offset'](_0x3cd764['query'][_0x4b58('0x1c')]);}_0x1f14a9[_0x4b58('0x39')]=qs['sort'](_0x3cd764[_0x4b58('0x2f')]['sort']);_0x1f14a9[_0x4b58('0x3a')]=qs[_0x4b58('0x31')](_[_0x4b58('0x3b')](_0x3cd764[_0x4b58('0x2f')],_0x426e23['filters']),_0x1b6dda);if(_0x3cd764[_0x4b58('0x2f')][_0x4b58('0x3c')]){_0x1f14a9[_0x4b58('0x3a')]=_['merge'](_0x1f14a9[_0x4b58('0x3a')],{'$or':_[_0x4b58('0x2e')](_0x1b6dda,function(_0x38932c){if(_0x38932c[_0x4b58('0x2c')]!==_0x4b58('0x3d')){var _0x2736f9={};_0x2736f9[_0x38932c[_0x4b58('0x28')]]={'$like':'%'+_0x3cd764[_0x4b58('0x2f')][_0x4b58('0x3c')]+'%'};return _0x2736f9;}})});}_0x1f14a9=_[_0x4b58('0x3e')]({},_0x1f14a9,_0x3cd764['options']);var _0x44e204={'where':_0x1f14a9['where']};return db[_0x4b58('0x29')]['count'](_0x44e204)['then'](function(_0x12a742){_0xe5478d['count']=_0x12a742;if(_0x3cd764[_0x4b58('0x2f')][_0x4b58('0x3f')]){_0x1f14a9[_0x4b58('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x1f14a9);})[_0x4b58('0x25')](function(_0x488140){_0xe5478d[_0x4b58('0x41')]=_0x488140;return _0xe5478d;})[_0x4b58('0x25')](respondWithFilteredResult(_0x3f8ab3,_0x1f14a9))[_0x4b58('0x42')](handleError(_0x3f8ab3,null));};exports[_0x4b58('0x43')]=function(_0x566f7b,_0x5b82d7){var _0x437fe7={'raw':![],'where':{'id':_0x566f7b[_0x4b58('0x44')]['id']}},_0x43ff26={};_0x43ff26[_0x4b58('0x33')]=_[_0x4b58('0x30')](db[_0x4b58('0x29')][_0x4b58('0x2a')]);_0x43ff26['query']=_[_0x4b58('0x30')](_0x566f7b[_0x4b58('0x2f')]);_0x43ff26[_0x4b58('0x31')]=_[_0x4b58('0x32')](_0x43ff26[_0x4b58('0x33')],_0x43ff26[_0x4b58('0x2f')]);_0x437fe7['attributes']=_[_0x4b58('0x32')](_0x43ff26[_0x4b58('0x33')],qs[_0x4b58('0x35')](_0x566f7b[_0x4b58('0x2f')]['fields']));_0x437fe7[_0x4b58('0x34')]=_0x437fe7[_0x4b58('0x34')][_0x4b58('0x36')]?_0x437fe7[_0x4b58('0x34')]:_0x43ff26[_0x4b58('0x33')];if(_0x566f7b['query'][_0x4b58('0x3f')]){_0x437fe7['include']=[{'all':!![]}];}_0x437fe7=_[_0x4b58('0x3e')]({},_0x437fe7,_0x566f7b['options']);return db[_0x4b58('0x29')][_0x4b58('0x45')](_0x437fe7)[_0x4b58('0x25')](handleEntityNotFound(_0x5b82d7,null))[_0x4b58('0x25')](respondWithResult(_0x5b82d7,null))[_0x4b58('0x42')](handleError(_0x5b82d7,null));};exports[_0x4b58('0x46')]=function(_0xfb4f3a,_0x4c19eb){return db['DeskAccount'][_0x4b58('0x46')](_0xfb4f3a['body'],{})[_0x4b58('0x25')](respondWithResult(_0x4c19eb,0xc9))[_0x4b58('0x42')](handleError(_0x4c19eb,null));};exports[_0x4b58('0x47')]=function(_0x48520c,_0x1d84f5){if(_0x48520c['body']['id']){delete _0x48520c[_0x4b58('0x48')]['id'];}return db['DeskAccount'][_0x4b58('0x45')]({'where':{'id':_0x48520c[_0x4b58('0x44')]['id']}})[_0x4b58('0x25')](handleEntityNotFound(_0x1d84f5,null))[_0x4b58('0x25')](saveUpdates(_0x48520c[_0x4b58('0x48')],null))['then'](respondWithResult(_0x1d84f5,null))[_0x4b58('0x42')](handleError(_0x1d84f5,null));};exports['destroy']=function(_0x1ce623,_0x59e2a1){return db[_0x4b58('0x29')][_0x4b58('0x45')]({'where':{'id':_0x1ce623[_0x4b58('0x44')]['id']}})[_0x4b58('0x25')](handleEntityNotFound(_0x59e2a1,null))[_0x4b58('0x25')](removeEntity(_0x59e2a1,null))[_0x4b58('0x42')](handleError(_0x59e2a1,null));};exports[_0x4b58('0x49')]=function(_0x1c88f4,_0x3335ed,_0x55a3f9){var _0x2be4b9={};var _0x1e2a18={};var _0x4b86f8;var _0x5a9fd4;return db['DeskAccount'][_0x4b58('0x4a')]({'where':{'id':_0x1c88f4['params']['id']}})[_0x4b58('0x25')](handleEntityNotFound(_0x3335ed,null))['then'](function(_0x4ed751){if(_0x4ed751){_0x4b86f8=_0x4ed751;_0x1e2a18[_0x4b58('0x33')]=_['keys'](db[_0x4b58('0x4b')][_0x4b58('0x2a')]);_0x1e2a18[_0x4b58('0x2f')]=_[_0x4b58('0x30')](_0x1c88f4[_0x4b58('0x2f')]);_0x1e2a18['filters']=_[_0x4b58('0x32')](_0x1e2a18['model'],_0x1e2a18[_0x4b58('0x2f')]);_0x2be4b9['attributes']=_[_0x4b58('0x32')](_0x1e2a18[_0x4b58('0x33')],qs[_0x4b58('0x35')](_0x1c88f4[_0x4b58('0x2f')][_0x4b58('0x35')]));_0x2be4b9['attributes']=_0x2be4b9['attributes']['length']?_0x2be4b9['attributes']:_0x1e2a18[_0x4b58('0x33')];_0x2be4b9[_0x4b58('0x39')]=qs[_0x4b58('0x4c')](_0x1c88f4['query'][_0x4b58('0x4c')]);_0x2be4b9[_0x4b58('0x3a')]=qs[_0x4b58('0x31')](_['pick'](_0x1c88f4[_0x4b58('0x2f')],_0x1e2a18['filters']));if(_0x1c88f4[_0x4b58('0x2f')][_0x4b58('0x3c')]){_0x2be4b9[_0x4b58('0x3a')]=_[_0x4b58('0x3e')](_0x2be4b9[_0x4b58('0x3a')],{'$or':_[_0x4b58('0x2e')](_0x2be4b9[_0x4b58('0x34')],function(_0x422ec1){var _0x3bd0ef={};_0x3bd0ef[_0x422ec1]={'$like':'%'+_0x1c88f4[_0x4b58('0x2f')]['filter']+'%'};return _0x3bd0ef;})});}_0x2be4b9=_[_0x4b58('0x3e')]({},_0x2be4b9,_0x1c88f4[_0x4b58('0x4d')]);return _0x4b86f8[_0x4b58('0x49')](_0x2be4b9);}})[_0x4b58('0x25')](function(_0x3f9797){if(_0x3f9797){_0x5a9fd4=_0x3f9797[_0x4b58('0x36')];if(!_0x1c88f4[_0x4b58('0x2f')]['hasOwnProperty'](_0x4b58('0x37'))){_0x2be4b9[_0x4b58('0x38')]=qs[_0x4b58('0x38')](_0x1c88f4[_0x4b58('0x2f')][_0x4b58('0x38')]);_0x2be4b9[_0x4b58('0x1c')]=qs['offset'](_0x1c88f4[_0x4b58('0x2f')][_0x4b58('0x1c')]);}return _0x4b86f8['getConfigurations'](_0x2be4b9);}})[_0x4b58('0x25')](function(_0x5f0f46){if(_0x5f0f46){return _0x5f0f46?{'count':_0x5a9fd4,'rows':_0x5f0f46}:null;}})[_0x4b58('0x25')](respondWithResult(_0x3335ed,null))[_0x4b58('0x42')](handleError(_0x3335ed,null));};exports['addConfiguration']=function(_0x4a8578,_0x31a0bd,_0x35d385){if(_0x4a8578[_0x4b58('0x48')]['id']){delete _0x4a8578[_0x4b58('0x48')]['id'];}return db[_0x4b58('0x29')][_0x4b58('0x4a')]({'where':{'id':_0x4a8578[_0x4b58('0x44')]['id']}})[_0x4b58('0x25')](handleEntityNotFound(_0x31a0bd,null))[_0x4b58('0x25')](function(_0x13f1c9){if(_0x13f1c9){_0x4a8578[_0x4b58('0x48')][_0x4b58('0x4e')]=_0x13f1c9['id'];_0x4a8578[_0x4b58('0x48')][_0x4b58('0x4f')]=integrations[_0x4b58('0x50')](_0x4a8578[_0x4b58('0x48')]['channel'],_0x4a8578[_0x4b58('0x48')][_0x4b58('0x2c')]);_0x4a8578['body'][_0x4b58('0x51')]=integrations[_0x4b58('0x52')](_0x4a8578[_0x4b58('0x48')][_0x4b58('0x53')],_0x4a8578[_0x4b58('0x48')][_0x4b58('0x2c')]);return db[_0x4b58('0x4b')][_0x4b58('0x46')](_0x4a8578['body'],{'include':[{'model':db[_0x4b58('0x54')],'as':_0x4b58('0x4f')},{'model':db[_0x4b58('0x54')],'as':_0x4b58('0x51')}]});}return null;})[_0x4b58('0x25')](respondWithResult(_0x31a0bd,null))[_0x4b58('0x42')](handleError(_0x31a0bd,null));};exports[_0x4b58('0x55')]=function(_0x43d7d2,_0x3fed8f,_0x4b4ce4){var _0x1383d3=[{'name':_0x4b58('0x56'),'label':_0x4b58('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x186b2d='';return db[_0x4b58('0x29')]['findOne']({'where':{'id':_0x43d7d2[_0x4b58('0x44')]['id']},'attributes':['id','remoteUri',_0x4b58('0x57'),_0x4b58('0x58'),_0x4b58('0x59'),'consumerKey',_0x4b58('0x5a'),_0x4b58('0x5b'),_0x4b58('0x5c')]})[_0x4b58('0x25')](handleEntityNotFound(_0x3fed8f,null))['then'](function(_0x3a855b){if(_0x3a855b){_0x186b2d=_0x3a855b['remoteUri'];var _0x3c23f3=_0x186b2d[_0x4b58('0x5d')](-0x1);if(_0x3c23f3==='/'){_0x186b2d=_0x186b2d['substring'](0x0,_0x186b2d['lastIndexOf'](_0x3c23f3));}var _0x3feb1c={'method':_0x4b58('0x5e'),'uri':util[_0x4b58('0x5f')](_0x4b58('0x60'),_0x186b2d),'headers':{'Content-Type':_0x4b58('0x61'),'Accept':_0x4b58('0x61')},'json':!![]};if(_0x3a855b[_0x4b58('0x57')]===_0x4b58('0x62')){_0x3feb1c[_0x4b58('0x63')][_0x4b58('0x64')]=util[_0x4b58('0x5f')](_0x4b58('0x65'),new Buffer(util['format'](_0x4b58('0x66'),_0x3a855b['username'],_0x3a855b['password']))[_0x4b58('0x67')]('base64'));}return rp(_0x3feb1c)[_0x4b58('0x25')](function(_0x43e07f){return _0x1383d3[_0x4b58('0x68')](_[_0x4b58('0x2e')](_0x43e07f[_0x4b58('0x69')]['entries'],function(_0x15f42d){return{'id':_0x15f42d[_0x4b58('0x28')],'name':_0x15f42d[_0x4b58('0x28')],'type':_0x15f42d[_0x4b58('0x2c')],'active':_0x15f42d[_0x4b58('0x6a')],'label':_0x15f42d[_0x4b58('0x6b')],'custom':!![]};}));});}})['then'](function(_0x5e58b3){return{'count':_0x5e58b3[_0x4b58('0x36')],'rows':_0x5e58b3};})[_0x4b58('0x25')](respondWithResult(_0x3fed8f,null))[_0x4b58('0x42')](function(_0x80c804){var _0x32039=_0x43d7d2[_0x4b58('0x2f')][_0x4b58('0x6c')]?0x1f4:_0x80c804[_0x4b58('0x6d')]||0x1f4;logger[_0x4b58('0x26')](_0x4b58('0x6e'),_0x4b58('0x55'),_0x32039,JSON[_0x4b58('0x6f')](_0x80c804));delete _0x80c804[_0x4b58('0x28')];if(_0x32039===0x191){_0x32039=0x190;}_0x3fed8f['status'](_0x32039)[_0x4b58('0x70')](_0x43d7d2[_0x4b58('0x2f')][_0x4b58('0x6c')]?{'message':_0x4b58('0x71'),'statusCode':_0x80c804['statusCode']}:_0x80c804);});}; \ No newline at end of file +var _0x12b1=['%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','error','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','create','body','catch','find','getConfigurations','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','DeskConfiguration','Subjects','Descriptions','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','substring','GET','format','application/json','basic','headers','Authorization','Basic\x20%s'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x12b1,0xed));var _0x112b=function(_0x3038c1,_0x1ea3a7){_0x3038c1=_0x3038c1-0x0;var _0x305853=_0x12b1[_0x3038c1];return _0x305853;};'use strict';var emlformat=require(_0x112b('0x0'));var rimraf=require(_0x112b('0x1'));var zipdir=require(_0x112b('0x2'));var jsonpatch=require(_0x112b('0x3'));var rp=require(_0x112b('0x4'));var moment=require(_0x112b('0x5'));var BPromise=require(_0x112b('0x6'));var Mustache=require(_0x112b('0x7'));var util=require('util');var path=require(_0x112b('0x8'));var sox=require('sox');var csv=require(_0x112b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x112b('0xa'));var _=require(_0x112b('0xb'));var squel=require(_0x112b('0xc'));var crypto=require(_0x112b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x112b('0x9'));var querystring=require(_0x112b('0xe'));var Papa=require(_0x112b('0xf'));var Redis=require(_0x112b('0x10'));var authService=require(_0x112b('0x11'));var qs=require(_0x112b('0x12'));var as=require(_0x112b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x112b('0x14'))(_0x112b('0x15'));var utils=require('../../config/utils');var config=require(_0x112b('0x16'));var licenseUtil=require(_0x112b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x112b('0x18'));function respondWithStatusCode(_0x3a8add,_0xc4a3d4){_0xc4a3d4=_0xc4a3d4||0xcc;return function(_0x497470){if(_0x497470){return _0x3a8add[_0x112b('0x19')](_0xc4a3d4);}return _0x3a8add[_0x112b('0x1a')](_0xc4a3d4)[_0x112b('0x1b')]();};}function respondWithResult(_0x3a4b63,_0xcd3a62){_0xcd3a62=_0xcd3a62||0xc8;return function(_0x53b5ad){if(_0x53b5ad){return _0x3a4b63[_0x112b('0x1a')](_0xcd3a62)['json'](_0x53b5ad);}};}function respondWithFilteredResult(_0x1179d0,_0x5abf36){return function(_0x108cb0){if(_0x108cb0){var _0x4c32c1=typeof _0x5abf36[_0x112b('0x1c')]===_0x112b('0x1d')&&typeof _0x5abf36['limit']===_0x112b('0x1d');var _0x34d873=_0x108cb0[_0x112b('0x1e')];var _0xafb96c=_0x4c32c1?0x0:_0x5abf36['offset'];var _0x48e90b=_0x4c32c1?_0x108cb0[_0x112b('0x1e')]:_0x5abf36[_0x112b('0x1c')]+_0x5abf36['limit'];var _0x31439b;if(_0x48e90b>=_0x34d873){_0x48e90b=_0x34d873;_0x31439b=0xc8;}else{_0x31439b=0xce;}_0x1179d0[_0x112b('0x1a')](_0x31439b);return _0x1179d0[_0x112b('0x1f')]('Content-Range',_0xafb96c+'-'+_0x48e90b+'/'+_0x34d873)[_0x112b('0x20')](_0x108cb0);}return null;};}function patchUpdates(_0x2892a8){return function(_0x343930){try{jsonpatch[_0x112b('0x21')](_0x343930,_0x2892a8,!![]);}catch(_0x22f07e){return BPromise[_0x112b('0x22')](_0x22f07e);}return _0x343930[_0x112b('0x23')]();};}function saveUpdates(_0x4cc3b5,_0x5e305a){return function(_0x3982eb){if(_0x3982eb){return _0x3982eb[_0x112b('0x24')](_0x4cc3b5)['then'](function(_0x5d46a8){return _0x5d46a8;});}return null;};}function removeEntity(_0x2d24a0,_0x2d3205){return function(_0x120b79){if(_0x120b79){return _0x120b79[_0x112b('0x25')]()[_0x112b('0x26')](function(){_0x2d24a0[_0x112b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293ec1,_0x36a1ec){return function(_0x7e4d10){if(!_0x7e4d10){_0x293ec1[_0x112b('0x19')](0x194);}return _0x7e4d10;};}function handleError(_0x3d9374,_0x517356){_0x517356=_0x517356||0x1f4;return function(_0x12c369){logger[_0x112b('0x27')](_0x12c369['stack']);if(_0x12c369[_0x112b('0x28')]){delete _0x12c369[_0x112b('0x28')];}_0x3d9374[_0x112b('0x1a')](_0x517356)['send'](_0x12c369);};}exports[_0x112b('0x29')]=function(_0x4f4e59,_0x11b5a2){var _0x582891={},_0x5d8310={},_0x560140={'count':0x0,'rows':[]};var _0x52c3f8=_[_0x112b('0x2a')](db[_0x112b('0x2b')][_0x112b('0x2c')],function(_0x3b5120){return{'name':_0x3b5120[_0x112b('0x2d')],'type':_0x3b5120[_0x112b('0x2e')]['key']};});_0x5d8310[_0x112b('0x2f')]=_[_0x112b('0x2a')](_0x52c3f8,_0x112b('0x28'));_0x5d8310['query']=_[_0x112b('0x30')](_0x4f4e59[_0x112b('0x31')]);_0x5d8310[_0x112b('0x32')]=_[_0x112b('0x33')](_0x5d8310[_0x112b('0x2f')],_0x5d8310[_0x112b('0x31')]);_0x582891[_0x112b('0x34')]=_[_0x112b('0x33')](_0x5d8310[_0x112b('0x2f')],qs['fields'](_0x4f4e59[_0x112b('0x31')][_0x112b('0x35')]));_0x582891[_0x112b('0x34')]=_0x582891[_0x112b('0x34')]['length']?_0x582891['attributes']:_0x5d8310[_0x112b('0x2f')];if(!_0x4f4e59['query'][_0x112b('0x36')](_0x112b('0x37'))){_0x582891[_0x112b('0x38')]=qs['limit'](_0x4f4e59[_0x112b('0x31')][_0x112b('0x38')]);_0x582891['offset']=qs[_0x112b('0x1c')](_0x4f4e59['query'][_0x112b('0x1c')]);}_0x582891[_0x112b('0x39')]=qs['sort'](_0x4f4e59[_0x112b('0x31')]['sort']);_0x582891[_0x112b('0x3a')]=qs[_0x112b('0x32')](_[_0x112b('0x3b')](_0x4f4e59[_0x112b('0x31')],_0x5d8310[_0x112b('0x32')]),_0x52c3f8);if(_0x4f4e59['query'][_0x112b('0x3c')]){_0x582891[_0x112b('0x3a')]=_[_0x112b('0x3d')](_0x582891[_0x112b('0x3a')],{'$or':_[_0x112b('0x2a')](_0x52c3f8,function(_0x265b45){if(_0x265b45['type']!==_0x112b('0x3e')){var _0x925af2={};_0x925af2[_0x265b45['name']]={'$like':'%'+_0x4f4e59['query']['filter']+'%'};return _0x925af2;}})});}_0x582891=_[_0x112b('0x3d')]({},_0x582891,_0x4f4e59[_0x112b('0x3f')]);var _0x280a0e={'where':_0x582891[_0x112b('0x3a')]};return db[_0x112b('0x2b')][_0x112b('0x1e')](_0x280a0e)[_0x112b('0x26')](function(_0x4775f9){_0x560140['count']=_0x4775f9;if(_0x4f4e59[_0x112b('0x31')][_0x112b('0x40')]){_0x582891[_0x112b('0x41')]=[{'all':!![]}];}return db[_0x112b('0x2b')]['findAll'](_0x582891);})['then'](function(_0x485c67){_0x560140[_0x112b('0x42')]=_0x485c67;return _0x560140;})[_0x112b('0x26')](respondWithFilteredResult(_0x11b5a2,_0x582891))['catch'](handleError(_0x11b5a2,null));};exports[_0x112b('0x43')]=function(_0x4598a7,_0x539742){var _0x3c0db4={'raw':![],'where':{'id':_0x4598a7[_0x112b('0x44')]['id']}},_0x23e982={};_0x23e982[_0x112b('0x2f')]=_[_0x112b('0x30')](db[_0x112b('0x2b')][_0x112b('0x2c')]);_0x23e982['query']=_['keys'](_0x4598a7['query']);_0x23e982[_0x112b('0x32')]=_[_0x112b('0x33')](_0x23e982[_0x112b('0x2f')],_0x23e982['query']);_0x3c0db4[_0x112b('0x34')]=_[_0x112b('0x33')](_0x23e982[_0x112b('0x2f')],qs['fields'](_0x4598a7[_0x112b('0x31')][_0x112b('0x35')]));_0x3c0db4['attributes']=_0x3c0db4[_0x112b('0x34')][_0x112b('0x45')]?_0x3c0db4[_0x112b('0x34')]:_0x23e982[_0x112b('0x2f')];if(_0x4598a7[_0x112b('0x31')][_0x112b('0x40')]){_0x3c0db4[_0x112b('0x41')]=[{'all':!![]}];}_0x3c0db4=_[_0x112b('0x3d')]({},_0x3c0db4,_0x4598a7[_0x112b('0x3f')]);return db[_0x112b('0x2b')]['find'](_0x3c0db4)[_0x112b('0x26')](handleEntityNotFound(_0x539742,null))[_0x112b('0x26')](respondWithResult(_0x539742,null))['catch'](handleError(_0x539742,null));};exports[_0x112b('0x46')]=function(_0x459e4d,_0x538152){return db[_0x112b('0x2b')]['create'](_0x459e4d[_0x112b('0x47')],{})[_0x112b('0x26')](respondWithResult(_0x538152,0xc9))[_0x112b('0x48')](handleError(_0x538152,null));};exports[_0x112b('0x24')]=function(_0x44ce11,_0x137640){if(_0x44ce11[_0x112b('0x47')]['id']){delete _0x44ce11[_0x112b('0x47')]['id'];}return db['DeskAccount'][_0x112b('0x49')]({'where':{'id':_0x44ce11[_0x112b('0x44')]['id']}})[_0x112b('0x26')](handleEntityNotFound(_0x137640,null))['then'](saveUpdates(_0x44ce11[_0x112b('0x47')],null))[_0x112b('0x26')](respondWithResult(_0x137640,null))['catch'](handleError(_0x137640,null));};exports[_0x112b('0x25')]=function(_0x3fcda6,_0x5e17cf){return db[_0x112b('0x2b')][_0x112b('0x49')]({'where':{'id':_0x3fcda6[_0x112b('0x44')]['id']}})[_0x112b('0x26')](handleEntityNotFound(_0x5e17cf,null))[_0x112b('0x26')](removeEntity(_0x5e17cf,null))['catch'](handleError(_0x5e17cf,null));};exports[_0x112b('0x4a')]=function(_0x1c9af5,_0x90cdbb,_0x350090){var _0x399e5a={};var _0x29b121={};var _0x60f0af;var _0x32c499;return db[_0x112b('0x2b')]['findOne']({'where':{'id':_0x1c9af5[_0x112b('0x44')]['id']}})[_0x112b('0x26')](handleEntityNotFound(_0x90cdbb,null))['then'](function(_0x335c3d){if(_0x335c3d){_0x60f0af=_0x335c3d;_0x29b121['model']=_[_0x112b('0x30')](db['DeskConfiguration'][_0x112b('0x2c')]);_0x29b121[_0x112b('0x31')]=_[_0x112b('0x30')](_0x1c9af5[_0x112b('0x31')]);_0x29b121[_0x112b('0x32')]=_[_0x112b('0x33')](_0x29b121[_0x112b('0x2f')],_0x29b121[_0x112b('0x31')]);_0x399e5a['attributes']=_['intersection'](_0x29b121[_0x112b('0x2f')],qs[_0x112b('0x35')](_0x1c9af5[_0x112b('0x31')][_0x112b('0x35')]));_0x399e5a['attributes']=_0x399e5a[_0x112b('0x34')][_0x112b('0x45')]?_0x399e5a[_0x112b('0x34')]:_0x29b121[_0x112b('0x2f')];_0x399e5a[_0x112b('0x39')]=qs[_0x112b('0x4b')](_0x1c9af5[_0x112b('0x31')]['sort']);_0x399e5a['where']=qs[_0x112b('0x32')](_['pick'](_0x1c9af5[_0x112b('0x31')],_0x29b121[_0x112b('0x32')]));if(_0x1c9af5['query']['filter']){_0x399e5a['where']=_[_0x112b('0x3d')](_0x399e5a[_0x112b('0x3a')],{'$or':_[_0x112b('0x2a')](_0x399e5a[_0x112b('0x34')],function(_0x160780){var _0x4d3c86={};_0x4d3c86[_0x160780]={'$like':'%'+_0x1c9af5[_0x112b('0x31')][_0x112b('0x3c')]+'%'};return _0x4d3c86;})});}_0x399e5a=_[_0x112b('0x3d')]({},_0x399e5a,_0x1c9af5[_0x112b('0x3f')]);return _0x60f0af[_0x112b('0x4a')](_0x399e5a);}})[_0x112b('0x26')](function(_0x989051){if(_0x989051){_0x32c499=_0x989051[_0x112b('0x45')];if(!_0x1c9af5[_0x112b('0x31')][_0x112b('0x36')]('nolimit')){_0x399e5a['limit']=qs[_0x112b('0x38')](_0x1c9af5[_0x112b('0x31')][_0x112b('0x38')]);_0x399e5a[_0x112b('0x1c')]=qs['offset'](_0x1c9af5['query']['offset']);}return _0x60f0af[_0x112b('0x4a')](_0x399e5a);}})[_0x112b('0x26')](function(_0x11781a){if(_0x11781a){return _0x11781a?{'count':_0x32c499,'rows':_0x11781a}:null;}})[_0x112b('0x26')](respondWithResult(_0x90cdbb,null))[_0x112b('0x48')](handleError(_0x90cdbb,null));};exports[_0x112b('0x4c')]=function(_0x576e08,_0x51c035,_0x618e46){if(_0x576e08[_0x112b('0x47')]['id']){delete _0x576e08['body']['id'];}return db[_0x112b('0x2b')][_0x112b('0x4d')]({'where':{'id':_0x576e08[_0x112b('0x44')]['id']}})[_0x112b('0x26')](handleEntityNotFound(_0x51c035,null))[_0x112b('0x26')](function(_0x36d1e0){if(_0x36d1e0){_0x576e08[_0x112b('0x47')][_0x112b('0x4e')]=_0x36d1e0['id'];_0x576e08[_0x112b('0x47')]['Subjects']=integrations['getSubjects'](_0x576e08['body'][_0x112b('0x4f')],_0x576e08[_0x112b('0x47')]['type']);_0x576e08[_0x112b('0x47')]['Descriptions']=integrations[_0x112b('0x50')](_0x576e08[_0x112b('0x47')]['channel'],_0x576e08[_0x112b('0x47')][_0x112b('0x2e')]);return db[_0x112b('0x51')][_0x112b('0x46')](_0x576e08[_0x112b('0x47')],{'include':[{'model':db['DeskField'],'as':_0x112b('0x52')},{'model':db['DeskField'],'as':_0x112b('0x53')}]});}return null;})[_0x112b('0x26')](respondWithResult(_0x51c035,null))['catch'](handleError(_0x51c035,null));};exports[_0x112b('0x54')]=function(_0x4863ad,_0x2935ef,_0x56b425){var _0x538746=[{'name':'priority','label':_0x112b('0x55'),'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 _0x4acaec='';return db['DeskAccount'][_0x112b('0x4d')]({'where':{'id':_0x4863ad[_0x112b('0x44')]['id']},'attributes':['id',_0x112b('0x56'),_0x112b('0x57'),'username',_0x112b('0x58'),_0x112b('0x59'),_0x112b('0x5a'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x2935ef,null))['then'](function(_0x563e03){if(_0x563e03){_0x4acaec=_0x563e03[_0x112b('0x56')];var _0x3fbb62=_0x4acaec['slice'](-0x1);if(_0x3fbb62==='/'){_0x4acaec=_0x4acaec[_0x112b('0x5b')](0x0,_0x4acaec['lastIndexOf'](_0x3fbb62));}var _0x514709={'method':_0x112b('0x5c'),'uri':util[_0x112b('0x5d')]('%s/custom_fields',_0x4acaec),'headers':{'Content-Type':'application/json','Accept':_0x112b('0x5e')},'json':!![]};if(_0x563e03['authType']===_0x112b('0x5f')){_0x514709[_0x112b('0x60')][_0x112b('0x61')]=util[_0x112b('0x5d')](_0x112b('0x62'),new Buffer(util[_0x112b('0x5d')](_0x112b('0x63'),_0x563e03[_0x112b('0x64')],_0x563e03['password']))[_0x112b('0x65')](_0x112b('0x66')));}return rp(_0x514709)[_0x112b('0x26')](function(_0x3db47e){return _0x538746[_0x112b('0x67')](_[_0x112b('0x2a')](_0x3db47e[_0x112b('0x68')][_0x112b('0x69')],function(_0xdb9fbc){return{'id':_0xdb9fbc[_0x112b('0x28')],'name':_0xdb9fbc[_0x112b('0x28')],'type':_0xdb9fbc[_0x112b('0x2e')],'active':_0xdb9fbc['active'],'label':_0xdb9fbc[_0x112b('0x6a')],'custom':!![]};}));});}})[_0x112b('0x26')](function(_0x3b832a){return{'count':_0x3b832a[_0x112b('0x45')],'rows':_0x3b832a};})[_0x112b('0x26')](respondWithResult(_0x2935ef,null))[_0x112b('0x48')](function(_0x5e964c){var _0xf479df=_0x4863ad['query'][_0x112b('0x6b')]?0x1f4:_0x5e964c[_0x112b('0x6c')]||0x1f4;logger[_0x112b('0x27')](_0x112b('0x6d'),'getFields',_0xf479df,JSON[_0x112b('0x6e')](_0x5e964c));delete _0x5e964c[_0x112b('0x28')];if(_0xf479df===0x191){_0xf479df=0x190;}_0x2935ef[_0x112b('0x1a')](_0xf479df)[_0x112b('0x6f')](_0x4863ad[_0x112b('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5e964c[_0x112b('0x6c')]}:_0x5e964c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 14ba3f2..018b84c 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 _0xa159=['DeskAccount','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4e9ba3,_0x5ba913){var _0x3fbc68=function(_0x10bef3){while(--_0x10bef3){_0x4e9ba3['push'](_0x4e9ba3['shift']());}};_0x3fbc68(++_0x5ba913);}(_0xa159,0x199));var _0x9a15=function(_0x28f00e,_0x56cb2b){_0x28f00e=_0x28f00e-0x0;var _0x28175d=_0xa159[_0x28f00e];return _0x28175d;};'use strict';var _=require('lodash');var util=require(_0x9a15('0x0'));var logger=require(_0x9a15('0x1'))(_0x9a15('0x2'));var moment=require(_0x9a15('0x3'));var BPromise=require(_0x9a15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a15('0x5'));var rimraf=require(_0x9a15('0x6'));var config=require(_0x9a15('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x9a15('0x8'));module[_0x9a15('0x9')]=function(_0x148470,_0x9b5144){return _0x148470[_0x9a15('0xa')](_0x9a15('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20f0=['api','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','int_desk_accounts','util','../../config/logger'];(function(_0x27bdb3,_0x3011af){var _0x31fd1d=function(_0x3deda4){while(--_0x3deda4){_0x27bdb3['push'](_0x27bdb3['shift']());}};_0x31fd1d(++_0x3011af);}(_0x20f0,0xf1));var _0x020f=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x20f0[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require(_0x020f('0x0'));var logger=require(_0x020f('0x1'))(_0x020f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x020f('0x3'));var fs=require('fs');var path=require(_0x020f('0x4'));var rimraf=require(_0x020f('0x5'));var config=require(_0x020f('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x020f('0x7'));module['exports']=function(_0x5c0a9a,_0x2225e4){return _0x5c0a9a['define']('DeskAccount',attributes,{'tableName':_0x020f('0x8'),'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 4ff1513..aa7985e 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 _0x9ade=['options','limit','map','include','model','attributes','GetDeskAccount','find','raw','ShowDeskAccount','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount','findAll'];(function(_0x4c046a,_0x22b076){var _0xff9b12=function(_0x32ea62){while(--_0x32ea62){_0x4c046a['push'](_0x4c046a['shift']());}};_0xff9b12(++_0x22b076);}(_0x9ade,0xf9));var _0xe9ad=function(_0x3b5226,_0x496a84){_0x3b5226=_0x3b5226-0x0;var _0x3a13d1=_0x9ade[_0x3b5226];return _0x3a13d1;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe9ad('0x2'));var fs=require('fs');var Redis=require(_0xe9ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9ad('0x4'));var logger=require(_0xe9ad('0x5'))('rpc');var config=require(_0xe9ad('0x6'));var jayson=require(_0xe9ad('0x7'));var client=jayson[_0xe9ad('0x8')][_0xe9ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15260a,_0x12fef2,_0x444f38){return new BPromise(function(_0x1e43b4,_0xadcc09){return client[_0xe9ad('0xa')](_0x15260a,_0x444f38)[_0xe9ad('0xb')](function(_0x4f2d59){logger[_0xe9ad('0xc')](_0xe9ad('0xd'),_0x12fef2,_0xe9ad('0xe'));logger[_0xe9ad('0xf')](_0xe9ad('0x10'),_0x12fef2,_0xe9ad('0xe'),JSON[_0xe9ad('0x11')](_0x4f2d59));if(_0x4f2d59[_0xe9ad('0x12')]){if(_0x4f2d59[_0xe9ad('0x12')][_0xe9ad('0x13')]===0x1f4){logger[_0xe9ad('0x12')]('DeskAccount,\x20%s,\x20%s',_0x12fef2,_0x4f2d59['error']['message']);return _0xadcc09(_0x4f2d59[_0xe9ad('0x12')][_0xe9ad('0x14')]);}logger[_0xe9ad('0x12')](_0xe9ad('0xd'),_0x12fef2,_0x4f2d59[_0xe9ad('0x12')][_0xe9ad('0x14')]);return _0x1e43b4(_0x4f2d59[_0xe9ad('0x12')][_0xe9ad('0x14')]);}else{logger[_0xe9ad('0xc')](_0xe9ad('0xd'),_0x12fef2,_0xe9ad('0xe'));_0x1e43b4(_0x4f2d59['result'][_0xe9ad('0x14')]);}})['catch'](function(_0x1be2e7){logger[_0xe9ad('0x12')](_0xe9ad('0xd'),_0x12fef2,_0x1be2e7);_0xadcc09(_0x1be2e7);});});}exports['GetDeskAccount']=function(_0x23a52c){var _0x3805c3=this;return new Promise(function(_0x41cfb6,_0xe444dd){return db[_0xe9ad('0x15')][_0xe9ad('0x16')]({'raw':_0x23a52c['options']?_0x23a52c['options']['raw']===undefined?!![]:![]:!![],'where':_0x23a52c['options']?_0x23a52c[_0xe9ad('0x17')]['where']||null:null,'attributes':_0x23a52c['options']?_0x23a52c[_0xe9ad('0x17')]['attributes']||null:null,'limit':_0x23a52c[_0xe9ad('0x17')]?_0x23a52c[_0xe9ad('0x17')][_0xe9ad('0x18')]||null:null,'include':_0x23a52c[_0xe9ad('0x17')]?_0x23a52c[_0xe9ad('0x17')]['include']?_[_0xe9ad('0x19')](_0x23a52c['options'][_0xe9ad('0x1a')],function(_0x3b5976){return{'model':db[_0x3b5976[_0xe9ad('0x1b')]],'as':_0x3b5976['as'],'attributes':_0x3b5976[_0xe9ad('0x1c')],'include':_0x3b5976[_0xe9ad('0x1a')]?_['map'](_0x3b5976['include'],function(_0x568084){return{'model':db[_0x568084['model']],'as':_0x568084['as'],'attributes':_0x568084[_0xe9ad('0x1c')],'include':_0x568084[_0xe9ad('0x1a')]?_[_0xe9ad('0x19')](_0x568084[_0xe9ad('0x1a')],function(_0x5e4c5d){return{'model':db[_0x5e4c5d[_0xe9ad('0x1b')]],'as':_0x5e4c5d['as'],'attributes':_0x5e4c5d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9ad('0xb')](function(_0x522d90){logger['info'](_0xe9ad('0x1d'),_0x23a52c);logger[_0xe9ad('0xf')](_0xe9ad('0x1d'),_0x23a52c,JSON[_0xe9ad('0x11')](_0x522d90));_0x41cfb6(_0x522d90);})['catch'](function(_0x574ff9){logger[_0xe9ad('0x12')](_0xe9ad('0x1d'),_0x574ff9[_0xe9ad('0x14')],_0x23a52c);_0xe444dd(_0x3805c3[_0xe9ad('0x12')](0x1f4,_0x574ff9[_0xe9ad('0x14')]));});});};exports['ShowDeskAccount']=function(_0x361f7){var _0x2cda19=this;return new Promise(function(_0x2e6cb1,_0x125538){return db[_0xe9ad('0x15')][_0xe9ad('0x1e')]({'raw':_0x361f7['options']?_0x361f7[_0xe9ad('0x17')][_0xe9ad('0x1f')]===undefined?!![]:![]:!![],'where':_0x361f7[_0xe9ad('0x17')]?_0x361f7[_0xe9ad('0x17')]['where']||null:null,'attributes':_0x361f7[_0xe9ad('0x17')]?_0x361f7['options'][_0xe9ad('0x1c')]||null:null,'include':_0x361f7['options']?_0x361f7[_0xe9ad('0x17')][_0xe9ad('0x1a')]?_[_0xe9ad('0x19')](_0x361f7[_0xe9ad('0x17')][_0xe9ad('0x1a')],function(_0x312ba5){return{'model':db[_0x312ba5['model']],'as':_0x312ba5['as'],'attributes':_0x312ba5['attributes'],'include':_0x312ba5[_0xe9ad('0x1a')]?_[_0xe9ad('0x19')](_0x312ba5['include'],function(_0x1ee8f3){return{'model':db[_0x1ee8f3['model']],'as':_0x1ee8f3['as'],'attributes':_0x1ee8f3['attributes'],'include':_0x1ee8f3[_0xe9ad('0x1a')]?_[_0xe9ad('0x19')](_0x1ee8f3['include'],function(_0x4018fd){return{'model':db[_0x4018fd[_0xe9ad('0x1b')]],'as':_0x4018fd['as'],'attributes':_0x4018fd[_0xe9ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39d1e9){logger[_0xe9ad('0xc')](_0xe9ad('0x20'),_0x361f7);logger[_0xe9ad('0xf')](_0xe9ad('0x20'),_0x361f7,JSON['stringify'](_0x39d1e9));_0x2e6cb1(_0x39d1e9);})[_0xe9ad('0x21')](function(_0x229066){logger[_0xe9ad('0x12')](_0xe9ad('0x20'),_0x229066[_0xe9ad('0x14')],_0x361f7);_0x125538(_0x2cda19['error'](0x1f4,_0x229066[_0xe9ad('0x14')]));});});}; \ No newline at end of file +var _0xbf39=['stringify','error','message','request\x20sent','result','GetDeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowDeskAccount','DeskAccount','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x406224,_0x21e9dc){var _0x528dfb=function(_0x4e428c){while(--_0x4e428c){_0x406224['push'](_0x406224['shift']());}};_0x528dfb(++_0x21e9dc);}(_0xbf39,0x188));var _0x9bf3=function(_0x2c1fce,_0x43b7d3){_0x2c1fce=_0x2c1fce-0x0;var _0x38b4c7=_0xbf39[_0x2c1fce];return _0x38b4c7;};'use strict';var _=require(_0x9bf3('0x0'));var util=require(_0x9bf3('0x1'));var moment=require(_0x9bf3('0x2'));var BPromise=require(_0x9bf3('0x3'));var rs=require(_0x9bf3('0x4'));var fs=require('fs');var Redis=require(_0x9bf3('0x5'));var db=require(_0x9bf3('0x6'))['db'];var utils=require(_0x9bf3('0x7'));var logger=require('../../config/logger')(_0x9bf3('0x8'));var config=require(_0x9bf3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9bf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e3c3f,_0x5f3ad2,_0x5038da){return new BPromise(function(_0x3f08d3,_0x2624a2){return client[_0x9bf3('0xb')](_0x1e3c3f,_0x5038da)[_0x9bf3('0xc')](function(_0x227059){logger[_0x9bf3('0xd')](_0x9bf3('0xe'),_0x5f3ad2,'request\x20sent');logger[_0x9bf3('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5f3ad2,'request\x20sent',JSON[_0x9bf3('0x10')](_0x227059));if(_0x227059['error']){if(_0x227059[_0x9bf3('0x11')]['code']===0x1f4){logger[_0x9bf3('0x11')](_0x9bf3('0xe'),_0x5f3ad2,_0x227059[_0x9bf3('0x11')][_0x9bf3('0x12')]);return _0x2624a2(_0x227059[_0x9bf3('0x11')][_0x9bf3('0x12')]);}logger[_0x9bf3('0x11')](_0x9bf3('0xe'),_0x5f3ad2,_0x227059[_0x9bf3('0x11')][_0x9bf3('0x12')]);return _0x3f08d3(_0x227059[_0x9bf3('0x11')][_0x9bf3('0x12')]);}else{logger['info'](_0x9bf3('0xe'),_0x5f3ad2,_0x9bf3('0x13'));_0x3f08d3(_0x227059[_0x9bf3('0x14')]['message']);}})['catch'](function(_0x2a0f41){logger['error'](_0x9bf3('0xe'),_0x5f3ad2,_0x2a0f41);_0x2624a2(_0x2a0f41);});});}exports[_0x9bf3('0x15')]=function(_0x3d93f7){var _0x13ba55=this;return new Promise(function(_0x471c6b,_0x1b5df1){return db['DeskAccount'][_0x9bf3('0x16')]({'raw':_0x3d93f7[_0x9bf3('0x17')]?_0x3d93f7[_0x9bf3('0x17')][_0x9bf3('0x18')]===undefined?!![]:![]:!![],'where':_0x3d93f7[_0x9bf3('0x17')]?_0x3d93f7[_0x9bf3('0x17')][_0x9bf3('0x19')]||null:null,'attributes':_0x3d93f7[_0x9bf3('0x17')]?_0x3d93f7[_0x9bf3('0x17')][_0x9bf3('0x1a')]||null:null,'limit':_0x3d93f7[_0x9bf3('0x17')]?_0x3d93f7[_0x9bf3('0x17')]['limit']||null:null,'include':_0x3d93f7[_0x9bf3('0x17')]?_0x3d93f7[_0x9bf3('0x17')][_0x9bf3('0x1b')]?_['map'](_0x3d93f7[_0x9bf3('0x17')][_0x9bf3('0x1b')],function(_0x47a4e0){return{'model':db[_0x47a4e0[_0x9bf3('0x1c')]],'as':_0x47a4e0['as'],'attributes':_0x47a4e0[_0x9bf3('0x1a')],'include':_0x47a4e0[_0x9bf3('0x1b')]?_[_0x9bf3('0x1d')](_0x47a4e0[_0x9bf3('0x1b')],function(_0x2fd68a){return{'model':db[_0x2fd68a[_0x9bf3('0x1c')]],'as':_0x2fd68a['as'],'attributes':_0x2fd68a[_0x9bf3('0x1a')],'include':_0x2fd68a[_0x9bf3('0x1b')]?_[_0x9bf3('0x1d')](_0x2fd68a['include'],function(_0x50dcc7){return{'model':db[_0x50dcc7[_0x9bf3('0x1c')]],'as':_0x50dcc7['as'],'attributes':_0x50dcc7[_0x9bf3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9bf3('0xc')](function(_0x2ad48b){logger[_0x9bf3('0xd')](_0x9bf3('0x15'),_0x3d93f7);logger[_0x9bf3('0xf')](_0x9bf3('0x15'),_0x3d93f7,JSON[_0x9bf3('0x10')](_0x2ad48b));_0x471c6b(_0x2ad48b);})['catch'](function(_0x3645b8){logger[_0x9bf3('0x11')](_0x9bf3('0x15'),_0x3645b8[_0x9bf3('0x12')],_0x3d93f7);_0x1b5df1(_0x13ba55[_0x9bf3('0x11')](0x1f4,_0x3645b8[_0x9bf3('0x12')]));});});};exports[_0x9bf3('0x1e')]=function(_0xb2082b){var _0x38c31b=this;return new Promise(function(_0x31caf7,_0x4f2872){return db[_0x9bf3('0x1f')][_0x9bf3('0x20')]({'raw':_0xb2082b[_0x9bf3('0x17')]?_0xb2082b[_0x9bf3('0x17')][_0x9bf3('0x18')]===undefined?!![]:![]:!![],'where':_0xb2082b[_0x9bf3('0x17')]?_0xb2082b[_0x9bf3('0x17')][_0x9bf3('0x19')]||null:null,'attributes':_0xb2082b[_0x9bf3('0x17')]?_0xb2082b['options']['attributes']||null:null,'include':_0xb2082b[_0x9bf3('0x17')]?_0xb2082b['options'][_0x9bf3('0x1b')]?_['map'](_0xb2082b['options'][_0x9bf3('0x1b')],function(_0x55f61d){return{'model':db[_0x55f61d[_0x9bf3('0x1c')]],'as':_0x55f61d['as'],'attributes':_0x55f61d[_0x9bf3('0x1a')],'include':_0x55f61d[_0x9bf3('0x1b')]?_[_0x9bf3('0x1d')](_0x55f61d[_0x9bf3('0x1b')],function(_0x5990b6){return{'model':db[_0x5990b6[_0x9bf3('0x1c')]],'as':_0x5990b6['as'],'attributes':_0x5990b6['attributes'],'include':_0x5990b6['include']?_[_0x9bf3('0x1d')](_0x5990b6[_0x9bf3('0x1b')],function(_0x3351c1){return{'model':db[_0x3351c1[_0x9bf3('0x1c')]],'as':_0x3351c1['as'],'attributes':_0x3351c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x9bf3('0xc')](function(_0x44eaae){logger['info'](_0x9bf3('0x1e'),_0xb2082b);logger['debug']('ShowDeskAccount',_0xb2082b,JSON[_0x9bf3('0x10')](_0x44eaae));_0x31caf7(_0x44eaae);})[_0x9bf3('0x21')](function(_0xea939a){logger['error'](_0x9bf3('0x1e'),_0xea939a['message'],_0xb2082b);_0x4f2872(_0x38c31b[_0x9bf3('0x11')](0x1f4,_0xea939a[_0x9bf3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ec28d4e..e82e3ad 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x45657c,_0x5b7583){var _0x4f349e=function(_0x56c4a2){while(--_0x56c4a2){_0x45657c['push'](_0x45657c['shift']());}};_0x4f349e(++_0x5b7583);}(_0xedd9,0xfc));var _0x9edd=function(_0x494e24,_0x44fb33){_0x494e24=_0x494e24-0x0;var _0x2d1701=_0xedd9[_0x494e24];return _0x2d1701;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +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(_0x348c08,_0x1b7523){var _0x2b01d5=function(_0x179c2e){while(--_0x179c2e){_0x348c08['push'](_0x348c08['shift']());}};_0x2b01d5(++_0x1b7523);}(_0x34e8,0x12c));var _0x834e=function(_0x2ec069,_0x486765){_0x2ec069=_0x2ec069-0x0;var _0x475d74=_0x34e8[_0x2ec069];return _0x475d74;};'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 8a96df3..f937901 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 _0x7092=['exports','STRING'];(function(_0x5d0f31,_0x3ce4bf){var _0x500f61=function(_0x45a9f2){while(--_0x45a9f2){_0x5d0f31['push'](_0x5d0f31['shift']());}};_0x500f61(++_0x3ce4bf);}(_0x7092,0x1dc));var _0x2709=function(_0x4af392,_0x411bd5){_0x4af392=_0x4af392-0x0;var _0x5ef7bb=_0x7092[_0x4af392];return _0x5ef7bb;};'use strict';var Sequelize=require('sequelize');module[_0x2709('0x0')]={'name':{'type':Sequelize[_0x2709('0x1')]},'description':{'type':Sequelize[_0x2709('0x1')]}}; \ No newline at end of file +var _0x094e=['sequelize','STRING'];(function(_0x47e0b7,_0x2c9138){var _0x2ff8d8=function(_0x4f1de3){while(--_0x4f1de3){_0x47e0b7['push'](_0x47e0b7['shift']());}};_0x2ff8d8(++_0x2c9138);}(_0x094e,0x164));var _0xe094=function(_0x28dc18,_0xb6f730){_0x28dc18=_0x28dc18-0x0;var _0x160917=_0x094e[_0x28dc18];return _0x160917;};'use strict';var Sequelize=require(_0xe094('0x0'));module['exports']={'name':{'type':Sequelize[_0xe094('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7293dd2..c36c69b 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 _0x70f4=['../../mysqldb','sendStatus','end','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','status','error','stack','name','send','map','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','DeskConfiguration','filters','length','find','catch','create','body','getFields','DeskField','pick','getSubjects','getDescriptions','findOne','hasOwnProperty','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1abbdb,_0x2c36d5){var _0xe4bb01=function(_0x4f9e95){while(--_0x4f9e95){_0x1abbdb['push'](_0x1abbdb['shift']());}};_0xe4bb01(++_0x2c36d5);}(_0x70f4,0x8c));var _0x470f=function(_0x568d30,_0x50fceb){_0x568d30=_0x568d30-0x0;var _0xabb817=_0x70f4[_0x568d30];return _0xabb817;};'use strict';var emlformat=require(_0x470f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x470f('0x1'));var jsonpatch=require(_0x470f('0x2'));var rp=require(_0x470f('0x3'));var moment=require(_0x470f('0x4'));var BPromise=require(_0x470f('0x5'));var Mustache=require('mustache');var util=require(_0x470f('0x6'));var path=require(_0x470f('0x7'));var sox=require('sox');var csv=require(_0x470f('0x8'));var ejs=require(_0x470f('0x9'));var fs=require('fs');var fs_extra=require(_0x470f('0xa'));var _=require(_0x470f('0xb'));var squel=require(_0x470f('0xc'));var crypto=require(_0x470f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x470f('0x8'));var querystring=require(_0x470f('0xe'));var Papa=require(_0x470f('0xf'));var Redis=require(_0x470f('0x10'));var authService=require(_0x470f('0x11'));var qs=require(_0x470f('0x12'));var as=require(_0x470f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x470f('0x14'));var utils=require(_0x470f('0x15'));var config=require(_0x470f('0x16'));var licenseUtil=require(_0x470f('0x17'));var db=require(_0x470f('0x18'))['db'];function respondWithStatusCode(_0x3cb57f,_0x2be747){_0x2be747=_0x2be747||0xcc;return function(_0x364cfc){if(_0x364cfc){return _0x3cb57f[_0x470f('0x19')](_0x2be747);}return _0x3cb57f['status'](_0x2be747)[_0x470f('0x1a')]();};}function respondWithResult(_0x1cd822,_0x578c28){_0x578c28=_0x578c28||0xc8;return function(_0x21e9ed){if(_0x21e9ed){return _0x1cd822['status'](_0x578c28)['json'](_0x21e9ed);}};}function respondWithFilteredResult(_0x6b978,_0x310c07){return function(_0x57d045){if(_0x57d045){var _0x2dddec=typeof _0x310c07['offset']===_0x470f('0x1b')&&typeof _0x310c07[_0x470f('0x1c')]===_0x470f('0x1b');var _0x1c0d3e=_0x57d045['count'];var _0x262362=_0x2dddec?0x0:_0x310c07[_0x470f('0x1d')];var _0xd57d73=_0x2dddec?_0x57d045[_0x470f('0x1e')]:_0x310c07[_0x470f('0x1d')]+_0x310c07[_0x470f('0x1c')];var _0x3163a3;if(_0xd57d73>=_0x1c0d3e){_0xd57d73=_0x1c0d3e;_0x3163a3=0xc8;}else{_0x3163a3=0xce;}_0x6b978['status'](_0x3163a3);return _0x6b978[_0x470f('0x1f')](_0x470f('0x20'),_0x262362+'-'+_0xd57d73+'/'+_0x1c0d3e)['json'](_0x57d045);}return null;};}function patchUpdates(_0x1f9094){return function(_0x3d21e9){try{jsonpatch['apply'](_0x3d21e9,_0x1f9094,!![]);}catch(_0x96aafd){return BPromise[_0x470f('0x21')](_0x96aafd);}return _0x3d21e9['save']();};}function saveUpdates(_0x254bfc,_0x36e16e){return function(_0x2843f1){if(_0x2843f1){return _0x2843f1[_0x470f('0x22')](_0x254bfc)[_0x470f('0x23')](function(_0xc64c9f){return _0xc64c9f;});}return null;};}function removeEntity(_0x2fed69,_0x12a3e6){return function(_0x15ce74){if(_0x15ce74){return _0x15ce74[_0x470f('0x24')]()[_0x470f('0x23')](function(){_0x2fed69[_0x470f('0x25')](0xcc)[_0x470f('0x1a')]();});}};}function handleEntityNotFound(_0x49c509,_0x16ad92){return function(_0x2f79f8){if(!_0x2f79f8){_0x49c509[_0x470f('0x19')](0x194);}return _0x2f79f8;};}function handleError(_0x29391b,_0x10565f){_0x10565f=_0x10565f||0x1f4;return function(_0xb152b3){logger[_0x470f('0x26')](_0xb152b3[_0x470f('0x27')]);if(_0xb152b3[_0x470f('0x28')]){delete _0xb152b3[_0x470f('0x28')];}_0x29391b[_0x470f('0x25')](_0x10565f)[_0x470f('0x29')](_0xb152b3);};}exports['index']=function(_0x11709e,_0x39745d){var _0x932c58={},_0x5b36ff={},_0x1d3fea={'count':0x0,'rows':[]};var _0x4ba348=_[_0x470f('0x2a')](db['DeskConfiguration'][_0x470f('0x2b')],function(_0x3af890){return{'name':_0x3af890['fieldName'],'type':_0x3af890[_0x470f('0x2c')][_0x470f('0x2d')]};});_0x5b36ff['model']=_[_0x470f('0x2a')](_0x4ba348,_0x470f('0x28'));_0x5b36ff['query']=_[_0x470f('0x2e')](_0x11709e['query']);_0x5b36ff['filters']=_[_0x470f('0x2f')](_0x5b36ff[_0x470f('0x30')],_0x5b36ff[_0x470f('0x31')]);_0x932c58[_0x470f('0x32')]=_[_0x470f('0x2f')](_0x5b36ff[_0x470f('0x30')],qs[_0x470f('0x33')](_0x11709e[_0x470f('0x31')][_0x470f('0x33')]));_0x932c58[_0x470f('0x32')]=_0x932c58['attributes']['length']?_0x932c58[_0x470f('0x32')]:_0x5b36ff[_0x470f('0x30')];if(!_0x11709e[_0x470f('0x31')]['hasOwnProperty'](_0x470f('0x34'))){_0x932c58[_0x470f('0x1c')]=qs['limit'](_0x11709e[_0x470f('0x31')][_0x470f('0x1c')]);_0x932c58[_0x470f('0x1d')]=qs[_0x470f('0x1d')](_0x11709e[_0x470f('0x31')][_0x470f('0x1d')]);}_0x932c58[_0x470f('0x35')]=qs[_0x470f('0x36')](_0x11709e[_0x470f('0x31')]['sort']);_0x932c58[_0x470f('0x37')]=qs['filters'](_['pick'](_0x11709e['query'],_0x5b36ff['filters']),_0x4ba348);if(_0x11709e[_0x470f('0x31')][_0x470f('0x38')]){_0x932c58[_0x470f('0x37')]=_[_0x470f('0x39')](_0x932c58[_0x470f('0x37')],{'$or':_[_0x470f('0x2a')](_0x4ba348,function(_0x4d7c04){if(_0x4d7c04[_0x470f('0x2c')]!=='VIRTUAL'){var _0x533245={};_0x533245[_0x4d7c04[_0x470f('0x28')]]={'$like':'%'+_0x11709e[_0x470f('0x31')]['filter']+'%'};return _0x533245;}})});}_0x932c58=_[_0x470f('0x39')]({},_0x932c58,_0x11709e[_0x470f('0x3a')]);var _0x2b3aa9={'where':_0x932c58[_0x470f('0x37')]};return db['DeskConfiguration'][_0x470f('0x1e')](_0x2b3aa9)[_0x470f('0x23')](function(_0x43a13a){_0x1d3fea[_0x470f('0x1e')]=_0x43a13a;if(_0x11709e['query'][_0x470f('0x3b')]){_0x932c58[_0x470f('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x470f('0x3d')](_0x932c58);})[_0x470f('0x23')](function(_0xb5e1f1){_0x1d3fea[_0x470f('0x3e')]=_0xb5e1f1;return _0x1d3fea;})[_0x470f('0x23')](respondWithFilteredResult(_0x39745d,_0x932c58))['catch'](handleError(_0x39745d,null));};exports[_0x470f('0x3f')]=function(_0x13c347,_0x2028ac){var _0x8e718e={'raw':![],'where':{'id':_0x13c347[_0x470f('0x40')]['id']}},_0x143ec2={};_0x143ec2['model']=_['keys'](db[_0x470f('0x41')][_0x470f('0x2b')]);_0x143ec2[_0x470f('0x31')]=_[_0x470f('0x2e')](_0x13c347['query']);_0x143ec2[_0x470f('0x42')]=_[_0x470f('0x2f')](_0x143ec2[_0x470f('0x30')],_0x143ec2[_0x470f('0x31')]);_0x8e718e['attributes']=_[_0x470f('0x2f')](_0x143ec2[_0x470f('0x30')],qs[_0x470f('0x33')](_0x13c347['query']['fields']));_0x8e718e['attributes']=_0x8e718e[_0x470f('0x32')][_0x470f('0x43')]?_0x8e718e[_0x470f('0x32')]:_0x143ec2[_0x470f('0x30')];if(_0x13c347[_0x470f('0x31')]['includeAll']){_0x8e718e[_0x470f('0x3c')]=[{'all':!![]}];}_0x8e718e=_[_0x470f('0x39')]({},_0x8e718e,_0x13c347[_0x470f('0x3a')]);return db[_0x470f('0x41')][_0x470f('0x44')](_0x8e718e)[_0x470f('0x23')](handleEntityNotFound(_0x2028ac,null))['then'](respondWithResult(_0x2028ac,null))[_0x470f('0x45')](handleError(_0x2028ac,null));};exports[_0x470f('0x46')]=function(_0x1c7db1,_0x2224fb){return db[_0x470f('0x41')][_0x470f('0x46')](_0x1c7db1['body'],{})['then'](respondWithResult(_0x2224fb,0xc9))[_0x470f('0x45')](handleError(_0x2224fb,null));};exports['update']=function(_0x22566a,_0x1d3f0e){if(_0x22566a['body']['id']){delete _0x22566a['body']['id'];}return db[_0x470f('0x41')][_0x470f('0x44')]({'where':{'id':_0x22566a[_0x470f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d3f0e,null))[_0x470f('0x23')](saveUpdates(_0x22566a[_0x470f('0x47')],null))[_0x470f('0x23')](respondWithResult(_0x1d3f0e,null))[_0x470f('0x45')](handleError(_0x1d3f0e,null));};exports['destroy']=function(_0x128e32,_0x59ea07){return db[_0x470f('0x41')][_0x470f('0x44')]({'where':{'id':_0x128e32[_0x470f('0x40')]['id']}})[_0x470f('0x23')](handleEntityNotFound(_0x59ea07,null))[_0x470f('0x23')](removeEntity(_0x59ea07,null))['catch'](handleError(_0x59ea07,null));};exports[_0x470f('0x48')]=function(_0x36d918,_0x26a6b8,_0xd1fdc3){var _0x11f4b2={};var _0x244a4e={};var _0x31477e;var _0x11c33a;return db[_0x470f('0x41')]['findOne']({'where':{'id':_0x36d918[_0x470f('0x40')]['id']}})[_0x470f('0x23')](handleEntityNotFound(_0x26a6b8,null))[_0x470f('0x23')](function(_0x50c32c){if(_0x50c32c){_0x31477e=_0x50c32c;_0x244a4e['model']=_[_0x470f('0x2e')](db[_0x470f('0x49')][_0x470f('0x2b')]);_0x244a4e[_0x470f('0x31')]=_[_0x470f('0x2e')](_0x36d918[_0x470f('0x31')]);_0x244a4e[_0x470f('0x42')]=_[_0x470f('0x2f')](_0x244a4e['model'],_0x244a4e[_0x470f('0x31')]);_0x11f4b2[_0x470f('0x32')]=_['intersection'](_0x244a4e[_0x470f('0x30')],qs[_0x470f('0x33')](_0x36d918['query'][_0x470f('0x33')]));_0x11f4b2[_0x470f('0x32')]=_0x11f4b2[_0x470f('0x32')][_0x470f('0x43')]?_0x11f4b2[_0x470f('0x32')]:_0x244a4e[_0x470f('0x30')];_0x11f4b2[_0x470f('0x35')]=qs[_0x470f('0x36')](_0x36d918[_0x470f('0x31')][_0x470f('0x36')]);_0x11f4b2['where']=qs['filters'](_[_0x470f('0x4a')](_0x36d918['query'],_0x244a4e['filters']));if(_0x36d918[_0x470f('0x31')][_0x470f('0x38')]){_0x11f4b2[_0x470f('0x37')]=_[_0x470f('0x39')](_0x11f4b2['where'],{'$or':_[_0x470f('0x2a')](_0x11f4b2['attributes'],function(_0x211631){var _0x2dc0a7={};_0x2dc0a7[_0x211631]={'$like':'%'+_0x36d918[_0x470f('0x31')][_0x470f('0x38')]+'%'};return _0x2dc0a7;})});}_0x11f4b2=_[_0x470f('0x39')]({},_0x11f4b2,_0x36d918[_0x470f('0x3a')]);return _0x31477e[_0x470f('0x48')](_0x11f4b2);}})[_0x470f('0x23')](function(_0x1eb3a0){if(_0x1eb3a0){_0x11c33a=_0x1eb3a0[_0x470f('0x43')];if(!_0x36d918[_0x470f('0x31')]['hasOwnProperty'](_0x470f('0x34'))){_0x11f4b2['limit']=qs['limit'](_0x36d918['query'][_0x470f('0x1c')]);_0x11f4b2[_0x470f('0x1d')]=qs[_0x470f('0x1d')](_0x36d918[_0x470f('0x31')][_0x470f('0x1d')]);}return _0x31477e[_0x470f('0x48')](_0x11f4b2);}})['then'](function(_0x726efe){if(_0x726efe){return _0x726efe?{'count':_0x11c33a,'rows':_0x726efe}:null;}})[_0x470f('0x23')](respondWithResult(_0x26a6b8,null))[_0x470f('0x45')](handleError(_0x26a6b8,null));};exports[_0x470f('0x4b')]=function(_0x13688a,_0x5727ed,_0x1a02c9){var _0x12a4f2={};var _0x3f10bc={};var _0x4c9fa0;var _0x3b3d16;return db['DeskConfiguration']['findOne']({'where':{'id':_0x13688a[_0x470f('0x40')]['id']}})['then'](handleEntityNotFound(_0x5727ed,null))[_0x470f('0x23')](function(_0x2d2e98){if(_0x2d2e98){_0x4c9fa0=_0x2d2e98;_0x3f10bc[_0x470f('0x30')]=_[_0x470f('0x2e')](db[_0x470f('0x49')]['rawAttributes']);_0x3f10bc[_0x470f('0x31')]=_[_0x470f('0x2e')](_0x13688a[_0x470f('0x31')]);_0x3f10bc[_0x470f('0x42')]=_[_0x470f('0x2f')](_0x3f10bc[_0x470f('0x30')],_0x3f10bc[_0x470f('0x31')]);_0x12a4f2[_0x470f('0x32')]=_[_0x470f('0x2f')](_0x3f10bc['model'],qs[_0x470f('0x33')](_0x13688a['query'][_0x470f('0x33')]));_0x12a4f2[_0x470f('0x32')]=_0x12a4f2[_0x470f('0x32')]['length']?_0x12a4f2[_0x470f('0x32')]:_0x3f10bc[_0x470f('0x30')];_0x12a4f2[_0x470f('0x35')]=qs['sort'](_0x13688a[_0x470f('0x31')][_0x470f('0x36')]);_0x12a4f2[_0x470f('0x37')]=qs[_0x470f('0x42')](_[_0x470f('0x4a')](_0x13688a['query'],_0x3f10bc[_0x470f('0x42')]));if(_0x13688a[_0x470f('0x31')][_0x470f('0x38')]){_0x12a4f2[_0x470f('0x37')]=_[_0x470f('0x39')](_0x12a4f2['where'],{'$or':_[_0x470f('0x2a')](_0x12a4f2['attributes'],function(_0x1f4e15){var _0x57bae7={};_0x57bae7[_0x1f4e15]={'$like':'%'+_0x13688a['query'][_0x470f('0x38')]+'%'};return _0x57bae7;})});}_0x12a4f2=_[_0x470f('0x39')]({},_0x12a4f2,_0x13688a['options']);return _0x4c9fa0[_0x470f('0x4b')](_0x12a4f2);}})[_0x470f('0x23')](function(_0x4049f3){if(_0x4049f3){_0x3b3d16=_0x4049f3[_0x470f('0x43')];if(!_0x13688a[_0x470f('0x31')]['hasOwnProperty']('nolimit')){_0x12a4f2[_0x470f('0x1c')]=qs[_0x470f('0x1c')](_0x13688a[_0x470f('0x31')]['limit']);_0x12a4f2[_0x470f('0x1d')]=qs[_0x470f('0x1d')](_0x13688a[_0x470f('0x31')]['offset']);}return _0x4c9fa0[_0x470f('0x4b')](_0x12a4f2);}})[_0x470f('0x23')](function(_0x4240e4){if(_0x4240e4){return _0x4240e4?{'count':_0x3b3d16,'rows':_0x4240e4}:null;}})['then'](respondWithResult(_0x5727ed,null))[_0x470f('0x45')](handleError(_0x5727ed,null));};exports[_0x470f('0x4c')]=function(_0x4e6b0f,_0x288f17,_0x4237cc){var _0x10daac={};var _0x3148c2={};var _0x2798df;var _0xaf27d3;return db[_0x470f('0x41')][_0x470f('0x4d')]({'where':{'id':_0x4e6b0f['params']['id']}})[_0x470f('0x23')](handleEntityNotFound(_0x288f17,null))[_0x470f('0x23')](function(_0x26e4af){if(_0x26e4af){_0x2798df=_0x26e4af;_0x3148c2[_0x470f('0x30')]=_[_0x470f('0x2e')](db[_0x470f('0x49')][_0x470f('0x2b')]);_0x3148c2['query']=_['keys'](_0x4e6b0f[_0x470f('0x31')]);_0x3148c2[_0x470f('0x42')]=_[_0x470f('0x2f')](_0x3148c2[_0x470f('0x30')],_0x3148c2[_0x470f('0x31')]);_0x10daac[_0x470f('0x32')]=_[_0x470f('0x2f')](_0x3148c2[_0x470f('0x30')],qs['fields'](_0x4e6b0f[_0x470f('0x31')][_0x470f('0x33')]));_0x10daac[_0x470f('0x32')]=_0x10daac[_0x470f('0x32')][_0x470f('0x43')]?_0x10daac['attributes']:_0x3148c2[_0x470f('0x30')];_0x10daac[_0x470f('0x35')]=qs[_0x470f('0x36')](_0x4e6b0f['query'][_0x470f('0x36')]);_0x10daac[_0x470f('0x37')]=qs[_0x470f('0x42')](_[_0x470f('0x4a')](_0x4e6b0f['query'],_0x3148c2[_0x470f('0x42')]));if(_0x4e6b0f[_0x470f('0x31')]['filter']){_0x10daac['where']=_[_0x470f('0x39')](_0x10daac[_0x470f('0x37')],{'$or':_['map'](_0x10daac['attributes'],function(_0x47f0f4){var _0x491e6b={};_0x491e6b[_0x47f0f4]={'$like':'%'+_0x4e6b0f['query'][_0x470f('0x38')]+'%'};return _0x491e6b;})});}_0x10daac=_[_0x470f('0x39')]({},_0x10daac,_0x4e6b0f['options']);return _0x2798df[_0x470f('0x4c')](_0x10daac);}})[_0x470f('0x23')](function(_0x1fd853){if(_0x1fd853){_0xaf27d3=_0x1fd853['length'];if(!_0x4e6b0f['query'][_0x470f('0x4e')](_0x470f('0x34'))){_0x10daac[_0x470f('0x1c')]=qs[_0x470f('0x1c')](_0x4e6b0f[_0x470f('0x31')][_0x470f('0x1c')]);_0x10daac[_0x470f('0x1d')]=qs[_0x470f('0x1d')](_0x4e6b0f[_0x470f('0x31')][_0x470f('0x1d')]);}return _0x2798df[_0x470f('0x4c')](_0x10daac);}})[_0x470f('0x23')](function(_0x642c29){if(_0x642c29){return _0x642c29?{'count':_0xaf27d3,'rows':_0x642c29}:null;}})[_0x470f('0x23')](respondWithResult(_0x288f17,null))[_0x470f('0x45')](handleError(_0x288f17,null));};exports[_0x470f('0x4f')]=function(_0x44ddb2,_0x577ba4,_0x27eb0e){var _0x1d01fc={};var _0x270c44={};var _0x3e2dda;var _0xc2aa93;return db[_0x470f('0x41')][_0x470f('0x4d')]({'where':{'id':_0x44ddb2['params']['id']}})[_0x470f('0x23')](handleEntityNotFound(_0x577ba4,null))[_0x470f('0x23')](function(_0x1c64e5){if(_0x1c64e5){_0x3e2dda=_0x1c64e5;_0x270c44[_0x470f('0x30')]=_[_0x470f('0x2e')](db['Tag']['rawAttributes']);_0x270c44['query']=_[_0x470f('0x2e')](_0x44ddb2['query']);_0x270c44[_0x470f('0x42')]=_['intersection'](_0x270c44['model'],_0x270c44[_0x470f('0x31')]);_0x1d01fc[_0x470f('0x32')]=_[_0x470f('0x2f')](_0x270c44[_0x470f('0x30')],qs[_0x470f('0x33')](_0x44ddb2[_0x470f('0x31')]['fields']));_0x1d01fc[_0x470f('0x32')]=_0x1d01fc[_0x470f('0x32')][_0x470f('0x43')]?_0x1d01fc[_0x470f('0x32')]:_0x270c44['model'];_0x1d01fc[_0x470f('0x35')]=qs[_0x470f('0x36')](_0x44ddb2['query'][_0x470f('0x36')]);_0x1d01fc[_0x470f('0x37')]=qs['filters'](_[_0x470f('0x4a')](_0x44ddb2[_0x470f('0x31')],_0x270c44[_0x470f('0x42')]));if(_0x44ddb2['query']['filter']){_0x1d01fc[_0x470f('0x37')]=_[_0x470f('0x39')](_0x1d01fc[_0x470f('0x37')],{'$or':_[_0x470f('0x2a')](_0x1d01fc['attributes'],function(_0x89a9df){var _0x9f00e8={};_0x9f00e8[_0x89a9df]={'$like':'%'+_0x44ddb2[_0x470f('0x31')]['filter']+'%'};return _0x9f00e8;})});}_0x1d01fc=_[_0x470f('0x39')]({},_0x1d01fc,_0x44ddb2['options']);return _0x3e2dda['getTags'](_0x1d01fc);}})[_0x470f('0x23')](function(_0x18619c){if(_0x18619c){_0xc2aa93=_0x18619c[_0x470f('0x43')];if(!_0x44ddb2[_0x470f('0x31')][_0x470f('0x4e')]('nolimit')){_0x1d01fc['limit']=qs['limit'](_0x44ddb2[_0x470f('0x31')]['limit']);_0x1d01fc[_0x470f('0x1d')]=qs['offset'](_0x44ddb2[_0x470f('0x31')][_0x470f('0x1d')]);}return _0x3e2dda[_0x470f('0x4f')](_0x1d01fc);}})[_0x470f('0x23')](function(_0x4e9c0e){if(_0x4e9c0e){return _0x4e9c0e?{'count':_0xc2aa93,'rows':_0x4e9c0e}:null;}})['then'](respondWithResult(_0x577ba4,null))[_0x470f('0x45')](handleError(_0x577ba4,null));};exports['setTags']=function(_0x5a0266,_0x130caa,_0xe6d12d){if(_0x5a0266['body']['id']){delete _0x5a0266[_0x470f('0x47')]['id'];}return db[_0x470f('0x41')][_0x470f('0x4d')]({'where':{'id':_0x5a0266[_0x470f('0x40')]['id']}})[_0x470f('0x23')](handleEntityNotFound(_0x130caa,null))[_0x470f('0x23')](function(_0x2982d1){if(_0x2982d1){return _0x2982d1[_0x470f('0x50')](_0x5a0266[_0x470f('0x47')][_0x470f('0x51')]||[]);}return null;})['then'](respondWithResult(_0x130caa,null))['catch'](handleError(_0x130caa,null));}; \ No newline at end of file +var _0x203f=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','params','length','include','options','find','create','update','body','getFields','DeskField','pick','getSubjects','order','hasOwnProperty','getDescriptions','findOne','getTags','setTags','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x58cce1,_0x73eef2){var _0xa12b3a=function(_0x506b9c){while(--_0x506b9c){_0x58cce1['push'](_0x58cce1['shift']());}};_0xa12b3a(++_0x73eef2);}(_0x203f,0x92));var _0xf203=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x203f[_0x2932cf];return _0x1711dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf203('0x0'));var jsonpatch=require(_0xf203('0x1'));var rp=require(_0xf203('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf203('0x3'));var util=require('util');var path=require(_0xf203('0x4'));var sox=require(_0xf203('0x5'));var csv=require(_0xf203('0x6'));var ejs=require(_0xf203('0x7'));var fs=require('fs');var fs_extra=require(_0xf203('0x8'));var _=require('lodash');var squel=require(_0xf203('0x9'));var crypto=require('crypto');var jsforce=require(_0xf203('0xa'));var deskjs=require(_0xf203('0xb'));var toCsv=require(_0xf203('0x6'));var querystring=require(_0xf203('0xc'));var Papa=require('papaparse');var Redis=require(_0xf203('0xd'));var authService=require(_0xf203('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf203('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf203('0x10'));var utils=require(_0xf203('0x11'));var config=require(_0xf203('0x12'));var licenseUtil=require(_0xf203('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ceee5,_0x337174){_0x337174=_0x337174||0xcc;return function(_0x4b4fa8){if(_0x4b4fa8){return _0x5ceee5[_0xf203('0x14')](_0x337174);}return _0x5ceee5[_0xf203('0x15')](_0x337174)[_0xf203('0x16')]();};}function respondWithResult(_0x5ce4c0,_0x24e5b0){_0x24e5b0=_0x24e5b0||0xc8;return function(_0x47bcb9){if(_0x47bcb9){return _0x5ce4c0[_0xf203('0x15')](_0x24e5b0)[_0xf203('0x17')](_0x47bcb9);}};}function respondWithFilteredResult(_0x11e400,_0x1f08d8){return function(_0x59b438){if(_0x59b438){var _0x3d0ffb=typeof _0x1f08d8['offset']===_0xf203('0x18')&&typeof _0x1f08d8[_0xf203('0x19')]===_0xf203('0x18');var _0x5a055e=_0x59b438[_0xf203('0x1a')];var _0x5ae813=_0x3d0ffb?0x0:_0x1f08d8[_0xf203('0x1b')];var _0x20d623=_0x3d0ffb?_0x59b438[_0xf203('0x1a')]:_0x1f08d8[_0xf203('0x1b')]+_0x1f08d8['limit'];var _0x1633a4;if(_0x20d623>=_0x5a055e){_0x20d623=_0x5a055e;_0x1633a4=0xc8;}else{_0x1633a4=0xce;}_0x11e400[_0xf203('0x15')](_0x1633a4);return _0x11e400[_0xf203('0x1c')](_0xf203('0x1d'),_0x5ae813+'-'+_0x20d623+'/'+_0x5a055e)[_0xf203('0x17')](_0x59b438);}return null;};}function patchUpdates(_0x455f93){return function(_0x128e6e){try{jsonpatch[_0xf203('0x1e')](_0x128e6e,_0x455f93,!![]);}catch(_0x48fdb){return BPromise['reject'](_0x48fdb);}return _0x128e6e[_0xf203('0x1f')]();};}function saveUpdates(_0x2cb3d3,_0x2ead97){return function(_0x481d12){if(_0x481d12){return _0x481d12['update'](_0x2cb3d3)['then'](function(_0x41524a){return _0x41524a;});}return null;};}function removeEntity(_0x70d057,_0x4a1902){return function(_0x5c6039){if(_0x5c6039){return _0x5c6039[_0xf203('0x20')]()[_0xf203('0x21')](function(){_0x70d057['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35af68,_0x85a06c){return function(_0x3ab771){if(!_0x3ab771){_0x35af68['sendStatus'](0x194);}return _0x3ab771;};}function handleError(_0xdc4af8,_0x455735){_0x455735=_0x455735||0x1f4;return function(_0x1db230){logger[_0xf203('0x22')](_0x1db230[_0xf203('0x23')]);if(_0x1db230[_0xf203('0x24')]){delete _0x1db230[_0xf203('0x24')];}_0xdc4af8[_0xf203('0x15')](_0x455735)[_0xf203('0x25')](_0x1db230);};}exports[_0xf203('0x26')]=function(_0x44cf08,_0x5d9e7f){var _0x24d0c1={},_0x579b29={},_0x21e4c4={'count':0x0,'rows':[]};var _0x39e057=_['map'](db[_0xf203('0x27')][_0xf203('0x28')],function(_0x5587e9){return{'name':_0x5587e9['fieldName'],'type':_0x5587e9[_0xf203('0x29')][_0xf203('0x2a')]};});_0x579b29[_0xf203('0x2b')]=_[_0xf203('0x2c')](_0x39e057,'name');_0x579b29[_0xf203('0x2d')]=_[_0xf203('0x2e')](_0x44cf08[_0xf203('0x2d')]);_0x579b29[_0xf203('0x2f')]=_['intersection'](_0x579b29['model'],_0x579b29[_0xf203('0x2d')]);_0x24d0c1['attributes']=_[_0xf203('0x30')](_0x579b29['model'],qs[_0xf203('0x31')](_0x44cf08[_0xf203('0x2d')][_0xf203('0x31')]));_0x24d0c1['attributes']=_0x24d0c1[_0xf203('0x32')]['length']?_0x24d0c1[_0xf203('0x32')]:_0x579b29[_0xf203('0x2b')];if(!_0x44cf08['query']['hasOwnProperty'](_0xf203('0x33'))){_0x24d0c1[_0xf203('0x19')]=qs[_0xf203('0x19')](_0x44cf08['query'][_0xf203('0x19')]);_0x24d0c1['offset']=qs[_0xf203('0x1b')](_0x44cf08[_0xf203('0x2d')][_0xf203('0x1b')]);}_0x24d0c1['order']=qs[_0xf203('0x34')](_0x44cf08[_0xf203('0x2d')][_0xf203('0x34')]);_0x24d0c1[_0xf203('0x35')]=qs['filters'](_['pick'](_0x44cf08[_0xf203('0x2d')],_0x579b29[_0xf203('0x2f')]),_0x39e057);if(_0x44cf08[_0xf203('0x2d')][_0xf203('0x36')]){_0x24d0c1['where']=_[_0xf203('0x37')](_0x24d0c1[_0xf203('0x35')],{'$or':_['map'](_0x39e057,function(_0x4c0580){if(_0x4c0580['type']!==_0xf203('0x38')){var _0x12ba1e={};_0x12ba1e[_0x4c0580[_0xf203('0x24')]]={'$like':'%'+_0x44cf08[_0xf203('0x2d')][_0xf203('0x36')]+'%'};return _0x12ba1e;}})});}_0x24d0c1=_['merge']({},_0x24d0c1,_0x44cf08['options']);var _0x3a41c1={'where':_0x24d0c1[_0xf203('0x35')]};return db[_0xf203('0x27')][_0xf203('0x1a')](_0x3a41c1)[_0xf203('0x21')](function(_0x111b82){_0x21e4c4[_0xf203('0x1a')]=_0x111b82;if(_0x44cf08[_0xf203('0x2d')][_0xf203('0x39')]){_0x24d0c1['include']=[{'all':!![]}];}return db[_0xf203('0x27')]['findAll'](_0x24d0c1);})['then'](function(_0x60d099){_0x21e4c4[_0xf203('0x3a')]=_0x60d099;return _0x21e4c4;})[_0xf203('0x21')](respondWithFilteredResult(_0x5d9e7f,_0x24d0c1))[_0xf203('0x3b')](handleError(_0x5d9e7f,null));};exports['show']=function(_0x41e5c4,_0x5bd888){var _0x3025d8={'raw':![],'where':{'id':_0x41e5c4[_0xf203('0x3c')]['id']}},_0x335eb3={};_0x335eb3[_0xf203('0x2b')]=_[_0xf203('0x2e')](db[_0xf203('0x27')]['rawAttributes']);_0x335eb3['query']=_[_0xf203('0x2e')](_0x41e5c4[_0xf203('0x2d')]);_0x335eb3['filters']=_[_0xf203('0x30')](_0x335eb3[_0xf203('0x2b')],_0x335eb3['query']);_0x3025d8[_0xf203('0x32')]=_['intersection'](_0x335eb3[_0xf203('0x2b')],qs['fields'](_0x41e5c4[_0xf203('0x2d')][_0xf203('0x31')]));_0x3025d8[_0xf203('0x32')]=_0x3025d8['attributes'][_0xf203('0x3d')]?_0x3025d8[_0xf203('0x32')]:_0x335eb3[_0xf203('0x2b')];if(_0x41e5c4[_0xf203('0x2d')]['includeAll']){_0x3025d8[_0xf203('0x3e')]=[{'all':!![]}];}_0x3025d8=_[_0xf203('0x37')]({},_0x3025d8,_0x41e5c4[_0xf203('0x3f')]);return db[_0xf203('0x27')][_0xf203('0x40')](_0x3025d8)[_0xf203('0x21')](handleEntityNotFound(_0x5bd888,null))[_0xf203('0x21')](respondWithResult(_0x5bd888,null))[_0xf203('0x3b')](handleError(_0x5bd888,null));};exports[_0xf203('0x41')]=function(_0x1f4384,_0x46270a){return db[_0xf203('0x27')][_0xf203('0x41')](_0x1f4384['body'],{})['then'](respondWithResult(_0x46270a,0xc9))[_0xf203('0x3b')](handleError(_0x46270a,null));};exports[_0xf203('0x42')]=function(_0x4c386a,_0x671baa){if(_0x4c386a[_0xf203('0x43')]['id']){delete _0x4c386a['body']['id'];}return db[_0xf203('0x27')]['find']({'where':{'id':_0x4c386a['params']['id']}})['then'](handleEntityNotFound(_0x671baa,null))[_0xf203('0x21')](saveUpdates(_0x4c386a[_0xf203('0x43')],null))['then'](respondWithResult(_0x671baa,null))['catch'](handleError(_0x671baa,null));};exports['destroy']=function(_0x23db54,_0x58eee2){return db[_0xf203('0x27')][_0xf203('0x40')]({'where':{'id':_0x23db54['params']['id']}})[_0xf203('0x21')](handleEntityNotFound(_0x58eee2,null))[_0xf203('0x21')](removeEntity(_0x58eee2,null))[_0xf203('0x3b')](handleError(_0x58eee2,null));};exports[_0xf203('0x44')]=function(_0x3cf9a0,_0x3773e3,_0x43c095){var _0x4e7857={};var _0x3b2d3a={};var _0x7bab32;var _0x1202dd;return db[_0xf203('0x27')]['findOne']({'where':{'id':_0x3cf9a0[_0xf203('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3773e3,null))['then'](function(_0x2cbe04){if(_0x2cbe04){_0x7bab32=_0x2cbe04;_0x3b2d3a[_0xf203('0x2b')]=_[_0xf203('0x2e')](db[_0xf203('0x45')]['rawAttributes']);_0x3b2d3a['query']=_[_0xf203('0x2e')](_0x3cf9a0['query']);_0x3b2d3a['filters']=_[_0xf203('0x30')](_0x3b2d3a[_0xf203('0x2b')],_0x3b2d3a[_0xf203('0x2d')]);_0x4e7857[_0xf203('0x32')]=_[_0xf203('0x30')](_0x3b2d3a['model'],qs[_0xf203('0x31')](_0x3cf9a0['query'][_0xf203('0x31')]));_0x4e7857[_0xf203('0x32')]=_0x4e7857[_0xf203('0x32')][_0xf203('0x3d')]?_0x4e7857[_0xf203('0x32')]:_0x3b2d3a[_0xf203('0x2b')];_0x4e7857['order']=qs['sort'](_0x3cf9a0[_0xf203('0x2d')]['sort']);_0x4e7857[_0xf203('0x35')]=qs[_0xf203('0x2f')](_[_0xf203('0x46')](_0x3cf9a0[_0xf203('0x2d')],_0x3b2d3a[_0xf203('0x2f')]));if(_0x3cf9a0['query'][_0xf203('0x36')]){_0x4e7857['where']=_[_0xf203('0x37')](_0x4e7857[_0xf203('0x35')],{'$or':_[_0xf203('0x2c')](_0x4e7857['attributes'],function(_0x5a2f85){var _0x1faedb={};_0x1faedb[_0x5a2f85]={'$like':'%'+_0x3cf9a0[_0xf203('0x2d')][_0xf203('0x36')]+'%'};return _0x1faedb;})});}_0x4e7857=_[_0xf203('0x37')]({},_0x4e7857,_0x3cf9a0[_0xf203('0x3f')]);return _0x7bab32[_0xf203('0x44')](_0x4e7857);}})[_0xf203('0x21')](function(_0x4ca604){if(_0x4ca604){_0x1202dd=_0x4ca604[_0xf203('0x3d')];if(!_0x3cf9a0['query']['hasOwnProperty'](_0xf203('0x33'))){_0x4e7857[_0xf203('0x19')]=qs[_0xf203('0x19')](_0x3cf9a0[_0xf203('0x2d')]['limit']);_0x4e7857[_0xf203('0x1b')]=qs[_0xf203('0x1b')](_0x3cf9a0['query'][_0xf203('0x1b')]);}return _0x7bab32[_0xf203('0x44')](_0x4e7857);}})[_0xf203('0x21')](function(_0x1c1d3d){if(_0x1c1d3d){return _0x1c1d3d?{'count':_0x1202dd,'rows':_0x1c1d3d}:null;}})[_0xf203('0x21')](respondWithResult(_0x3773e3,null))['catch'](handleError(_0x3773e3,null));};exports[_0xf203('0x47')]=function(_0x37e153,_0x4494b9,_0x485a1a){var _0x1fec4a={};var _0x1647ec={};var _0x3edc64;var _0x16857c;return db[_0xf203('0x27')]['findOne']({'where':{'id':_0x37e153[_0xf203('0x3c')]['id']}})[_0xf203('0x21')](handleEntityNotFound(_0x4494b9,null))[_0xf203('0x21')](function(_0x463082){if(_0x463082){_0x3edc64=_0x463082;_0x1647ec[_0xf203('0x2b')]=_[_0xf203('0x2e')](db[_0xf203('0x45')][_0xf203('0x28')]);_0x1647ec[_0xf203('0x2d')]=_[_0xf203('0x2e')](_0x37e153[_0xf203('0x2d')]);_0x1647ec[_0xf203('0x2f')]=_[_0xf203('0x30')](_0x1647ec['model'],_0x1647ec['query']);_0x1fec4a[_0xf203('0x32')]=_[_0xf203('0x30')](_0x1647ec[_0xf203('0x2b')],qs[_0xf203('0x31')](_0x37e153[_0xf203('0x2d')][_0xf203('0x31')]));_0x1fec4a[_0xf203('0x32')]=_0x1fec4a[_0xf203('0x32')][_0xf203('0x3d')]?_0x1fec4a[_0xf203('0x32')]:_0x1647ec[_0xf203('0x2b')];_0x1fec4a[_0xf203('0x48')]=qs[_0xf203('0x34')](_0x37e153[_0xf203('0x2d')][_0xf203('0x34')]);_0x1fec4a['where']=qs[_0xf203('0x2f')](_['pick'](_0x37e153[_0xf203('0x2d')],_0x1647ec['filters']));if(_0x37e153[_0xf203('0x2d')][_0xf203('0x36')]){_0x1fec4a[_0xf203('0x35')]=_['merge'](_0x1fec4a[_0xf203('0x35')],{'$or':_[_0xf203('0x2c')](_0x1fec4a[_0xf203('0x32')],function(_0x3f6048){var _0xfbbd07={};_0xfbbd07[_0x3f6048]={'$like':'%'+_0x37e153[_0xf203('0x2d')][_0xf203('0x36')]+'%'};return _0xfbbd07;})});}_0x1fec4a=_['merge']({},_0x1fec4a,_0x37e153[_0xf203('0x3f')]);return _0x3edc64['getSubjects'](_0x1fec4a);}})[_0xf203('0x21')](function(_0x3b892b){if(_0x3b892b){_0x16857c=_0x3b892b[_0xf203('0x3d')];if(!_0x37e153[_0xf203('0x2d')][_0xf203('0x49')](_0xf203('0x33'))){_0x1fec4a[_0xf203('0x19')]=qs['limit'](_0x37e153['query'][_0xf203('0x19')]);_0x1fec4a['offset']=qs[_0xf203('0x1b')](_0x37e153[_0xf203('0x2d')][_0xf203('0x1b')]);}return _0x3edc64[_0xf203('0x47')](_0x1fec4a);}})['then'](function(_0x59dabd){if(_0x59dabd){return _0x59dabd?{'count':_0x16857c,'rows':_0x59dabd}:null;}})[_0xf203('0x21')](respondWithResult(_0x4494b9,null))[_0xf203('0x3b')](handleError(_0x4494b9,null));};exports[_0xf203('0x4a')]=function(_0x42e5b9,_0x556727,_0x401337){var _0x12cfac={};var _0x2cf740={};var _0x8332d2;var _0x2bc603;return db[_0xf203('0x27')][_0xf203('0x4b')]({'where':{'id':_0x42e5b9[_0xf203('0x3c')]['id']}})[_0xf203('0x21')](handleEntityNotFound(_0x556727,null))[_0xf203('0x21')](function(_0x3a4b03){if(_0x3a4b03){_0x8332d2=_0x3a4b03;_0x2cf740['model']=_[_0xf203('0x2e')](db[_0xf203('0x45')][_0xf203('0x28')]);_0x2cf740[_0xf203('0x2d')]=_[_0xf203('0x2e')](_0x42e5b9['query']);_0x2cf740['filters']=_[_0xf203('0x30')](_0x2cf740[_0xf203('0x2b')],_0x2cf740[_0xf203('0x2d')]);_0x12cfac[_0xf203('0x32')]=_['intersection'](_0x2cf740[_0xf203('0x2b')],qs['fields'](_0x42e5b9[_0xf203('0x2d')]['fields']));_0x12cfac['attributes']=_0x12cfac[_0xf203('0x32')][_0xf203('0x3d')]?_0x12cfac['attributes']:_0x2cf740[_0xf203('0x2b')];_0x12cfac[_0xf203('0x48')]=qs[_0xf203('0x34')](_0x42e5b9[_0xf203('0x2d')][_0xf203('0x34')]);_0x12cfac[_0xf203('0x35')]=qs['filters'](_['pick'](_0x42e5b9['query'],_0x2cf740[_0xf203('0x2f')]));if(_0x42e5b9[_0xf203('0x2d')][_0xf203('0x36')]){_0x12cfac['where']=_['merge'](_0x12cfac[_0xf203('0x35')],{'$or':_[_0xf203('0x2c')](_0x12cfac['attributes'],function(_0x12a3c2){var _0x328625={};_0x328625[_0x12a3c2]={'$like':'%'+_0x42e5b9['query'][_0xf203('0x36')]+'%'};return _0x328625;})});}_0x12cfac=_[_0xf203('0x37')]({},_0x12cfac,_0x42e5b9['options']);return _0x8332d2[_0xf203('0x4a')](_0x12cfac);}})[_0xf203('0x21')](function(_0x5efefb){if(_0x5efefb){_0x2bc603=_0x5efefb[_0xf203('0x3d')];if(!_0x42e5b9[_0xf203('0x2d')]['hasOwnProperty'](_0xf203('0x33'))){_0x12cfac[_0xf203('0x19')]=qs[_0xf203('0x19')](_0x42e5b9[_0xf203('0x2d')][_0xf203('0x19')]);_0x12cfac[_0xf203('0x1b')]=qs[_0xf203('0x1b')](_0x42e5b9['query']['offset']);}return _0x8332d2[_0xf203('0x4a')](_0x12cfac);}})['then'](function(_0x188481){if(_0x188481){return _0x188481?{'count':_0x2bc603,'rows':_0x188481}:null;}})['then'](respondWithResult(_0x556727,null))[_0xf203('0x3b')](handleError(_0x556727,null));};exports[_0xf203('0x4c')]=function(_0x210c5f,_0x321423,_0x1f9e4c){var _0x17f2a1={};var _0x39bf1a={};var _0x1ac792;var _0x3bb0b9;return db['DeskConfiguration'][_0xf203('0x4b')]({'where':{'id':_0x210c5f[_0xf203('0x3c')]['id']}})[_0xf203('0x21')](handleEntityNotFound(_0x321423,null))[_0xf203('0x21')](function(_0x52dd67){if(_0x52dd67){_0x1ac792=_0x52dd67;_0x39bf1a[_0xf203('0x2b')]=_[_0xf203('0x2e')](db['Tag'][_0xf203('0x28')]);_0x39bf1a[_0xf203('0x2d')]=_['keys'](_0x210c5f[_0xf203('0x2d')]);_0x39bf1a[_0xf203('0x2f')]=_['intersection'](_0x39bf1a[_0xf203('0x2b')],_0x39bf1a['query']);_0x17f2a1[_0xf203('0x32')]=_['intersection'](_0x39bf1a['model'],qs[_0xf203('0x31')](_0x210c5f[_0xf203('0x2d')][_0xf203('0x31')]));_0x17f2a1['attributes']=_0x17f2a1['attributes'][_0xf203('0x3d')]?_0x17f2a1[_0xf203('0x32')]:_0x39bf1a['model'];_0x17f2a1[_0xf203('0x48')]=qs[_0xf203('0x34')](_0x210c5f['query'][_0xf203('0x34')]);_0x17f2a1[_0xf203('0x35')]=qs['filters'](_[_0xf203('0x46')](_0x210c5f[_0xf203('0x2d')],_0x39bf1a[_0xf203('0x2f')]));if(_0x210c5f['query'][_0xf203('0x36')]){_0x17f2a1[_0xf203('0x35')]=_[_0xf203('0x37')](_0x17f2a1[_0xf203('0x35')],{'$or':_['map'](_0x17f2a1['attributes'],function(_0x18e487){var _0x20e673={};_0x20e673[_0x18e487]={'$like':'%'+_0x210c5f[_0xf203('0x2d')][_0xf203('0x36')]+'%'};return _0x20e673;})});}_0x17f2a1=_[_0xf203('0x37')]({},_0x17f2a1,_0x210c5f[_0xf203('0x3f')]);return _0x1ac792['getTags'](_0x17f2a1);}})['then'](function(_0x439a62){if(_0x439a62){_0x3bb0b9=_0x439a62[_0xf203('0x3d')];if(!_0x210c5f[_0xf203('0x2d')][_0xf203('0x49')](_0xf203('0x33'))){_0x17f2a1[_0xf203('0x19')]=qs['limit'](_0x210c5f[_0xf203('0x2d')][_0xf203('0x19')]);_0x17f2a1[_0xf203('0x1b')]=qs[_0xf203('0x1b')](_0x210c5f[_0xf203('0x2d')][_0xf203('0x1b')]);}return _0x1ac792[_0xf203('0x4c')](_0x17f2a1);}})['then'](function(_0x282408){if(_0x282408){return _0x282408?{'count':_0x3bb0b9,'rows':_0x282408}:null;}})[_0xf203('0x21')](respondWithResult(_0x321423,null))[_0xf203('0x3b')](handleError(_0x321423,null));};exports['setTags']=function(_0x21f0a5,_0x2fa2c3,_0x44738a){if(_0x21f0a5[_0xf203('0x43')]['id']){delete _0x21f0a5['body']['id'];}return db[_0xf203('0x27')][_0xf203('0x4b')]({'where':{'id':_0x21f0a5[_0xf203('0x3c')]['id']}})[_0xf203('0x21')](handleEntityNotFound(_0x2fa2c3,null))[_0xf203('0x21')](function(_0x714370){if(_0x714370){return _0x714370[_0xf203('0x4d')](_0x21f0a5[_0xf203('0x43')]['ids']||[]);}return null;})[_0xf203('0x21')](respondWithResult(_0x2fa2c3,null))[_0xf203('0x3b')](handleError(_0x2fa2c3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 43d5823..5099b91 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 _0xcd04=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','util','../../config/logger'];(function(_0x29f732,_0x34747f){var _0x8c7e2b=function(_0xd5ae68){while(--_0xd5ae68){_0x29f732['push'](_0x29f732['shift']());}};_0x8c7e2b(++_0x34747f);}(_0xcd04,0x1c6));var _0x4cd0=function(_0x44b011,_0x24fbf0){_0x44b011=_0x44b011-0x0;var _0x580e3d=_0xcd04[_0x44b011];return _0x580e3d;};'use strict';var _=require('lodash');var util=require(_0x4cd0('0x0'));var logger=require(_0x4cd0('0x1'))(_0x4cd0('0x2'));var moment=require(_0x4cd0('0x3'));var BPromise=require(_0x4cd0('0x4'));var rp=require(_0x4cd0('0x5'));var fs=require('fs');var path=require(_0x4cd0('0x6'));var rimraf=require(_0x4cd0('0x7'));var config=require(_0x4cd0('0x8'));var attributes=require(_0x4cd0('0x9'));module[_0x4cd0('0xa')]=function(_0x28971a,_0x5a7ccc){return _0x28971a[_0x4cd0('0xb')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b3e=['define','DeskConfiguration','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x4553f2,_0xf8253c){var _0x3e12f4=function(_0x18269b){while(--_0x18269b){_0x4553f2['push'](_0x4553f2['shift']());}};_0x3e12f4(++_0xf8253c);}(_0x0b3e,0x14c));var _0xe0b3=function(_0x421dfd,_0x9eda46){_0x421dfd=_0x421dfd-0x0;var _0x450994=_0x0b3e[_0x421dfd];return _0x450994;};'use strict';var _=require(_0xe0b3('0x0'));var util=require('util');var logger=require(_0xe0b3('0x1'))('api');var moment=require(_0xe0b3('0x2'));var BPromise=require(_0xe0b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0b3('0x4'));var rimraf=require(_0xe0b3('0x5'));var config=require(_0xe0b3('0x6'));var attributes=require(_0xe0b3('0x7'));module[_0xe0b3('0x8')]=function(_0x46eb92,_0x5c9322){return _0x46eb92[_0xe0b3('0x9')](_0xe0b3('0xa'),attributes,{'tableName':'int_desk_configurations','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 99694f4..1a169f5 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 _0xb7aa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x31fd55,_0x3edf2f){var _0x53190a=function(_0x38133b){while(--_0x38133b){_0x31fd55['push'](_0x31fd55['shift']());}};_0x53190a(++_0x3edf2f);}(_0xb7aa,0x11a));var _0xab7a=function(_0x334bd5,_0x53a368){_0x334bd5=_0x334bd5-0x0;var _0x481cf7=_0xb7aa[_0x334bd5];return _0x481cf7;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require(_0xab7a('0x4'));var fs=require('fs');var Redis=require(_0xab7a('0x5'));var db=require(_0xab7a('0x6'))['db'];var utils=require(_0xab7a('0x7'));var logger=require(_0xab7a('0x8'))(_0xab7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xab7a('0xa'));var client=jayson[_0xab7a('0xb')][_0xab7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29ef15,_0x4e775f,_0x99ac82){return new BPromise(function(_0x1e3b23,_0x520d21){return client[_0xab7a('0xd')](_0x29ef15,_0x99ac82)[_0xab7a('0xe')](function(_0x40e6e6){logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));logger[_0xab7a('0x12')](_0xab7a('0x13'),_0x4e775f,_0xab7a('0x11'),JSON[_0xab7a('0x14')](_0x40e6e6));if(_0x40e6e6['error']){if(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x16')]===0x1f4){logger[_0xab7a('0x15')](_0xab7a('0x10'),_0x4e775f,_0x40e6e6['error'][_0xab7a('0x17')]);return _0x520d21(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);}logger[_0xab7a('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x4e775f,_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);return _0x1e3b23(_0x40e6e6['error'][_0xab7a('0x17')]);}else{logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));_0x1e3b23(_0x40e6e6[_0xab7a('0x18')]['message']);}})[_0xab7a('0x19')](function(_0x19eeb7){logger['error'](_0xab7a('0x10'),_0x4e775f,_0x19eeb7);_0x520d21(_0x19eeb7);});});} \ No newline at end of file +var _0xf9ae=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9ae,0x85));var _0xef9a=function(_0x3eed2e,_0xf9944){_0x3eed2e=_0x3eed2e-0x0;var _0x4eb95b=_0xf9ae[_0x3eed2e];return _0x4eb95b;};'use strict';var _=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var moment=require('moment');var BPromise=require(_0xef9a('0x2'));var rs=require(_0xef9a('0x3'));var fs=require('fs');var Redis=require(_0xef9a('0x4'));var db=require(_0xef9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef9a('0x6'))(_0xef9a('0x7'));var config=require('../../config/environment');var jayson=require(_0xef9a('0x8'));var client=jayson[_0xef9a('0x9')][_0xef9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d72d2,_0x3e1435,_0x387dd0){return new BPromise(function(_0x40afbc,_0x50025e){return client[_0xef9a('0xb')](_0x5d72d2,_0x387dd0)[_0xef9a('0xc')](function(_0x4c5623){logger[_0xef9a('0xd')](_0xef9a('0xe'),_0x3e1435,_0xef9a('0xf'));logger['debug'](_0xef9a('0x10'),_0x3e1435,'request\x20sent',JSON[_0xef9a('0x11')](_0x4c5623));if(_0x4c5623[_0xef9a('0x12')]){if(_0x4c5623[_0xef9a('0x12')][_0xef9a('0x13')]===0x1f4){logger['error'](_0xef9a('0xe'),_0x3e1435,_0x4c5623['error'][_0xef9a('0x14')]);return _0x50025e(_0x4c5623['error'][_0xef9a('0x14')]);}logger[_0xef9a('0x12')](_0xef9a('0xe'),_0x3e1435,_0x4c5623[_0xef9a('0x12')]['message']);return _0x40afbc(_0x4c5623[_0xef9a('0x12')][_0xef9a('0x14')]);}else{logger[_0xef9a('0xd')](_0xef9a('0xe'),_0x3e1435,_0xef9a('0xf'));_0x40afbc(_0x4c5623[_0xef9a('0x15')][_0xef9a('0x14')]);}})['catch'](function(_0x8b79f8){logger[_0xef9a('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x3e1435,_0x8b79f8);_0x50025e(_0x8b79f8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9acfead..9bf22db 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 _0x6784=['/:id','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','show','create','put'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x6784,0x136));var _0x4678=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x6784[_0x163040];return _0x364667;};'use strict';var multer=require('multer');var util=require(_0x4678('0x0'));var path=require(_0x4678('0x1'));var timeout=require(_0x4678('0x2'));var express=require('express');var router=express[_0x4678('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4678('0x4'));var interaction=require(_0x4678('0x5'));var config=require(_0x4678('0x6'));var controller=require(_0x4678('0x7'));router['get']('/',auth[_0x4678('0x8')](),controller[_0x4678('0x9')]);router['get']('/:id',auth[_0x4678('0x8')](),controller[_0x4678('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4678('0xb')]);router[_0x4678('0xc')](_0x4678('0xd'),auth[_0x4678('0x8')](),controller[_0x4678('0xe')]);router[_0x4678('0xf')](_0x4678('0xd'),auth[_0x4678('0x8')](),controller[_0x4678('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4390=['multer','util','path','connect-timeout','express','Router','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0x265b14,_0x4e74a3){var _0x2972b0=function(_0xfd7d66){while(--_0xfd7d66){_0x265b14['push'](_0x265b14['shift']());}};_0x2972b0(++_0x4e74a3);}(_0x4390,0x88));var _0x0439=function(_0x24ba39,_0x1bb01d){_0x24ba39=_0x24ba39-0x0;var _0x46c5a5=_0x4390[_0x24ba39];return _0x46c5a5;};'use strict';var multer=require(_0x0439('0x0'));var util=require(_0x0439('0x1'));var path=require(_0x0439('0x2'));var timeout=require(_0x0439('0x3'));var express=require(_0x0439('0x4'));var router=express[_0x0439('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0439('0x6'));var controller=require(_0x0439('0x7'));router[_0x0439('0x8')]('/',auth[_0x0439('0x9')](),controller['index']);router[_0x0439('0x8')](_0x0439('0xa'),auth[_0x0439('0x9')](),controller['show']);router[_0x0439('0xb')]('/',auth[_0x0439('0x9')](),controller[_0x0439('0xc')]);router[_0x0439('0xd')](_0x0439('0xa'),auth[_0x0439('0x9')](),controller[_0x0439('0xe')]);router[_0x0439('0xf')](_0x0439('0xa'),auth[_0x0439('0x9')](),controller['destroy']);module[_0x0439('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f47e5d9..473bd13 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 _0xf910=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0xe5869d,_0xec9325){var _0x35dffa=function(_0x4ebd06){while(--_0x4ebd06){_0xe5869d['push'](_0xe5869d['shift']());}};_0x35dffa(++_0xec9325);}(_0xf910,0x187));var _0x0f91=function(_0x4b26f3,_0x2293ed){_0x4b26f3=_0x4b26f3-0x0;var _0x3f87d1=_0xf910[_0x4b26f3];return _0x3f87d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0f91('0x0')](_0x0f91('0x1'),_0x0f91('0x2'),_0x0f91('0x3'),_0x0f91('0x4'),_0x0f91('0x5')),'defaultValue':_0x0f91('0x1')},'content':{'type':Sequelize[_0x0f91('0x6')]},'key':{'type':Sequelize[_0x0f91('0x6')]},'keyType':{'type':Sequelize[_0x0f91('0x0')](_0x0f91('0x1'),_0x0f91('0x2'),_0x0f91('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0f91('0x6')]},'nameField':{'type':Sequelize[_0x0f91('0x6')]},'customField':{'type':Sequelize[_0x0f91('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f91('0x6')]}}; \ No newline at end of file +var _0x0995=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x0995,0xb9));var _0x5099=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0995[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5099('0x0'));module[_0x5099('0x1')]={'type':{'type':Sequelize[_0x5099('0x2')](_0x5099('0x3'),_0x5099('0x4'),_0x5099('0x5'),'keyValue',_0x5099('0x6')),'defaultValue':_0x5099('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5099('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5099('0x4'),_0x5099('0x5'))},'keyContent':{'type':Sequelize[_0x5099('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5099('0x7')]},'customField':{'type':Sequelize[_0x5099('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 0abdff5..a2cc459 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 _0x09da=['nolimit','order','sort','where','pick','merge','options','DeskField','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x574ff9,_0x4710e2){var _0x4e8d02=function(_0x183b82){while(--_0x183b82){_0x574ff9['push'](_0x574ff9['shift']());}};_0x4e8d02(++_0x4710e2);}(_0x09da,0xf4));var _0xa09d=function(_0x24cf23,_0x2acd28){_0x24cf23=_0x24cf23-0x0;var _0x47edcc=_0x09da[_0x24cf23];return _0x47edcc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa09d('0x0'));var zipdir=require(_0xa09d('0x1'));var jsonpatch=require(_0xa09d('0x2'));var rp=require(_0xa09d('0x3'));var moment=require(_0xa09d('0x4'));var BPromise=require(_0xa09d('0x5'));var Mustache=require(_0xa09d('0x6'));var util=require('util');var path=require(_0xa09d('0x7'));var sox=require(_0xa09d('0x8'));var csv=require('to-csv');var ejs=require(_0xa09d('0x9'));var fs=require('fs');var fs_extra=require(_0xa09d('0xa'));var _=require(_0xa09d('0xb'));var squel=require(_0xa09d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa09d('0xd'));var toCsv=require(_0xa09d('0xe'));var querystring=require('querystring');var Papa=require(_0xa09d('0xf'));var Redis=require('ioredis');var authService=require(_0xa09d('0x10'));var qs=require(_0xa09d('0x11'));var as=require(_0xa09d('0x12'));var hardwareService=require(_0xa09d('0x13'));var logger=require(_0xa09d('0x14'))(_0xa09d('0x15'));var utils=require(_0xa09d('0x16'));var config=require(_0xa09d('0x17'));var licenseUtil=require(_0xa09d('0x18'));var db=require(_0xa09d('0x19'))['db'];function respondWithStatusCode(_0x4552d9,_0x3cbbf2){_0x3cbbf2=_0x3cbbf2||0xcc;return function(_0x522fd9){if(_0x522fd9){return _0x4552d9[_0xa09d('0x1a')](_0x3cbbf2);}return _0x4552d9[_0xa09d('0x1b')](_0x3cbbf2)['end']();};}function respondWithResult(_0x284ea5,_0x468a5a){_0x468a5a=_0x468a5a||0xc8;return function(_0x19481e){if(_0x19481e){return _0x284ea5['status'](_0x468a5a)['json'](_0x19481e);}};}function respondWithFilteredResult(_0x550463,_0x7e88fc){return function(_0x13d0e6){if(_0x13d0e6){var _0x294eb1=typeof _0x7e88fc[_0xa09d('0x1c')]===_0xa09d('0x1d')&&typeof _0x7e88fc['limit']===_0xa09d('0x1d');var _0x22c06a=_0x13d0e6[_0xa09d('0x1e')];var _0xe478a6=_0x294eb1?0x0:_0x7e88fc[_0xa09d('0x1c')];var _0x5a6754=_0x294eb1?_0x13d0e6[_0xa09d('0x1e')]:_0x7e88fc[_0xa09d('0x1c')]+_0x7e88fc[_0xa09d('0x1f')];var _0x2bb5ce;if(_0x5a6754>=_0x22c06a){_0x5a6754=_0x22c06a;_0x2bb5ce=0xc8;}else{_0x2bb5ce=0xce;}_0x550463[_0xa09d('0x1b')](_0x2bb5ce);return _0x550463[_0xa09d('0x20')](_0xa09d('0x21'),_0xe478a6+'-'+_0x5a6754+'/'+_0x22c06a)[_0xa09d('0x22')](_0x13d0e6);}return null;};}function patchUpdates(_0x1d7021){return function(_0x3d34ed){try{jsonpatch[_0xa09d('0x23')](_0x3d34ed,_0x1d7021,!![]);}catch(_0x409e4e){return BPromise[_0xa09d('0x24')](_0x409e4e);}return _0x3d34ed[_0xa09d('0x25')]();};}function saveUpdates(_0x58fb6e,_0xf97e76){return function(_0x4f57b3){if(_0x4f57b3){return _0x4f57b3['update'](_0x58fb6e)[_0xa09d('0x26')](function(_0x350756){return _0x350756;});}return null;};}function removeEntity(_0xd83a4,_0x9103ed){return function(_0xc09c1c){if(_0xc09c1c){return _0xc09c1c[_0xa09d('0x27')]()[_0xa09d('0x26')](function(){_0xd83a4[_0xa09d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8bce52,_0x32728d){return function(_0x579654){if(!_0x579654){_0x8bce52['sendStatus'](0x194);}return _0x579654;};}function handleError(_0x10e2b5,_0x9ca349){_0x9ca349=_0x9ca349||0x1f4;return function(_0x9041e){logger['error'](_0x9041e[_0xa09d('0x28')]);if(_0x9041e[_0xa09d('0x29')]){delete _0x9041e[_0xa09d('0x29')];}_0x10e2b5['status'](_0x9ca349)[_0xa09d('0x2a')](_0x9041e);};}exports[_0xa09d('0x2b')]=function(_0x127928,_0x49a945){var _0x6a3538={},_0x642870={},_0x286d5e={'count':0x0,'rows':[]};var _0x25d161=_[_0xa09d('0x2c')](db['DeskField']['rawAttributes'],function(_0x2ff018){return{'name':_0x2ff018[_0xa09d('0x2d')],'type':_0x2ff018[_0xa09d('0x2e')]['key']};});_0x642870[_0xa09d('0x2f')]=_[_0xa09d('0x2c')](_0x25d161,'name');_0x642870['query']=_[_0xa09d('0x30')](_0x127928[_0xa09d('0x31')]);_0x642870[_0xa09d('0x32')]=_[_0xa09d('0x33')](_0x642870[_0xa09d('0x2f')],_0x642870[_0xa09d('0x31')]);_0x6a3538['attributes']=_[_0xa09d('0x33')](_0x642870[_0xa09d('0x2f')],qs[_0xa09d('0x34')](_0x127928['query'][_0xa09d('0x34')]));_0x6a3538[_0xa09d('0x35')]=_0x6a3538[_0xa09d('0x35')][_0xa09d('0x36')]?_0x6a3538['attributes']:_0x642870[_0xa09d('0x2f')];if(!_0x127928[_0xa09d('0x31')][_0xa09d('0x37')](_0xa09d('0x38'))){_0x6a3538[_0xa09d('0x1f')]=qs['limit'](_0x127928[_0xa09d('0x31')][_0xa09d('0x1f')]);_0x6a3538[_0xa09d('0x1c')]=qs[_0xa09d('0x1c')](_0x127928[_0xa09d('0x31')][_0xa09d('0x1c')]);}_0x6a3538[_0xa09d('0x39')]=qs['sort'](_0x127928[_0xa09d('0x31')][_0xa09d('0x3a')]);_0x6a3538[_0xa09d('0x3b')]=qs[_0xa09d('0x32')](_[_0xa09d('0x3c')](_0x127928[_0xa09d('0x31')],_0x642870[_0xa09d('0x32')]),_0x25d161);if(_0x127928[_0xa09d('0x31')]['filter']){_0x6a3538[_0xa09d('0x3b')]=_[_0xa09d('0x3d')](_0x6a3538['where'],{'$or':_[_0xa09d('0x2c')](_0x25d161,function(_0x427c1d){if(_0x427c1d[_0xa09d('0x2e')]!=='VIRTUAL'){var _0xb454c0={};_0xb454c0[_0x427c1d[_0xa09d('0x29')]]={'$like':'%'+_0x127928[_0xa09d('0x31')]['filter']+'%'};return _0xb454c0;}})});}_0x6a3538=_['merge']({},_0x6a3538,_0x127928[_0xa09d('0x3e')]);var _0x1fb0b7={'where':_0x6a3538['where']};return db[_0xa09d('0x3f')][_0xa09d('0x1e')](_0x1fb0b7)['then'](function(_0x5151ed){_0x286d5e[_0xa09d('0x1e')]=_0x5151ed;if(_0x127928[_0xa09d('0x31')][_0xa09d('0x40')]){_0x6a3538[_0xa09d('0x41')]=[{'all':!![]}];}return db[_0xa09d('0x3f')][_0xa09d('0x42')](_0x6a3538);})[_0xa09d('0x26')](function(_0x3b2f18){_0x286d5e[_0xa09d('0x43')]=_0x3b2f18;return _0x286d5e;})[_0xa09d('0x26')](respondWithFilteredResult(_0x49a945,_0x6a3538))[_0xa09d('0x44')](handleError(_0x49a945,null));};exports['show']=function(_0x330ee2,_0x194ff1){var _0x27f177={'raw':!![],'where':{'id':_0x330ee2[_0xa09d('0x45')]['id']}},_0x11dc07={};_0x11dc07['model']=_[_0xa09d('0x30')](db['DeskField'][_0xa09d('0x46')]);_0x11dc07[_0xa09d('0x31')]=_[_0xa09d('0x30')](_0x330ee2[_0xa09d('0x31')]);_0x11dc07[_0xa09d('0x32')]=_['intersection'](_0x11dc07[_0xa09d('0x2f')],_0x11dc07[_0xa09d('0x31')]);_0x27f177[_0xa09d('0x35')]=_[_0xa09d('0x33')](_0x11dc07[_0xa09d('0x2f')],qs[_0xa09d('0x34')](_0x330ee2[_0xa09d('0x31')][_0xa09d('0x34')]));_0x27f177[_0xa09d('0x35')]=_0x27f177[_0xa09d('0x35')][_0xa09d('0x36')]?_0x27f177[_0xa09d('0x35')]:_0x11dc07['model'];if(_0x330ee2[_0xa09d('0x31')][_0xa09d('0x40')]){_0x27f177[_0xa09d('0x41')]=[{'all':!![]}];}_0x27f177=_[_0xa09d('0x3d')]({},_0x27f177,_0x330ee2[_0xa09d('0x3e')]);return db[_0xa09d('0x3f')][_0xa09d('0x47')](_0x27f177)['then'](handleEntityNotFound(_0x194ff1,null))[_0xa09d('0x26')](respondWithResult(_0x194ff1,null))[_0xa09d('0x44')](handleError(_0x194ff1,null));};exports[_0xa09d('0x48')]=function(_0xc4041a,_0x211d18){return db[_0xa09d('0x3f')][_0xa09d('0x48')](_0xc4041a['body'],{})['then'](respondWithResult(_0x211d18,0xc9))[_0xa09d('0x44')](handleError(_0x211d18,null));};exports[_0xa09d('0x49')]=function(_0xa03a0a,_0x5a3a86){if(_0xa03a0a[_0xa09d('0x4a')]['id']){delete _0xa03a0a[_0xa09d('0x4a')]['id'];}return db['DeskField'][_0xa09d('0x47')]({'where':{'id':_0xa03a0a['params']['id']}})['then'](handleEntityNotFound(_0x5a3a86,null))['then'](saveUpdates(_0xa03a0a[_0xa09d('0x4a')],null))[_0xa09d('0x26')](respondWithResult(_0x5a3a86,null))[_0xa09d('0x44')](handleError(_0x5a3a86,null));};exports[_0xa09d('0x27')]=function(_0x70689c,_0x3fa1ca){return db[_0xa09d('0x3f')][_0xa09d('0x47')]({'where':{'id':_0x70689c[_0xa09d('0x45')]['id']}})[_0xa09d('0x26')](handleEntityNotFound(_0x3fa1ca,null))[_0xa09d('0x26')](removeEntity(_0x3fa1ca,null))[_0xa09d('0x44')](handleError(_0x3fa1ca,null));}; \ No newline at end of file +var _0xb422=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','update','body','fast-json-patch','bluebird','util'];(function(_0x56e7e0,_0x4dd33b){var _0x2d8c1c=function(_0xf5785c){while(--_0xf5785c){_0x56e7e0['push'](_0x56e7e0['shift']());}};_0x2d8c1c(++_0x4dd33b);}(_0xb422,0x85));var _0x2b42=function(_0x463a03,_0x13914f){_0x463a03=_0x463a03-0x0;var _0x5baa30=_0xb422[_0x463a03];return _0x5baa30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b42('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b42('0x1'));var Mustache=require('mustache');var util=require(_0x2b42('0x2'));var path=require('path');var sox=require(_0x2b42('0x3'));var csv=require('to-csv');var ejs=require(_0x2b42('0x4'));var fs=require('fs');var fs_extra=require(_0x2b42('0x5'));var _=require(_0x2b42('0x6'));var squel=require('squel');var crypto=require(_0x2b42('0x7'));var jsforce=require(_0x2b42('0x8'));var deskjs=require(_0x2b42('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b42('0xa'));var Redis=require('ioredis');var authService=require(_0x2b42('0xb'));var qs=require(_0x2b42('0xc'));var as=require(_0x2b42('0xd'));var hardwareService=require(_0x2b42('0xe'));var logger=require('../../config/logger')(_0x2b42('0xf'));var utils=require(_0x2b42('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b42('0x11'));var db=require(_0x2b42('0x12'))['db'];function respondWithStatusCode(_0x22272e,_0x176efa){_0x176efa=_0x176efa||0xcc;return function(_0x4b8a04){if(_0x4b8a04){return _0x22272e['sendStatus'](_0x176efa);}return _0x22272e[_0x2b42('0x13')](_0x176efa)[_0x2b42('0x14')]();};}function respondWithResult(_0x5dec9a,_0x232c58){_0x232c58=_0x232c58||0xc8;return function(_0x17d103){if(_0x17d103){return _0x5dec9a[_0x2b42('0x13')](_0x232c58)[_0x2b42('0x15')](_0x17d103);}};}function respondWithFilteredResult(_0x4cb695,_0xc7e610){return function(_0x84b092){if(_0x84b092){var _0x1b93d5=typeof _0xc7e610[_0x2b42('0x16')]===_0x2b42('0x17')&&typeof _0xc7e610['limit']===_0x2b42('0x17');var _0x11fdec=_0x84b092[_0x2b42('0x18')];var _0x3e3426=_0x1b93d5?0x0:_0xc7e610[_0x2b42('0x16')];var _0x3ab83c=_0x1b93d5?_0x84b092[_0x2b42('0x18')]:_0xc7e610[_0x2b42('0x16')]+_0xc7e610['limit'];var _0x22b8d6;if(_0x3ab83c>=_0x11fdec){_0x3ab83c=_0x11fdec;_0x22b8d6=0xc8;}else{_0x22b8d6=0xce;}_0x4cb695[_0x2b42('0x13')](_0x22b8d6);return _0x4cb695['set'](_0x2b42('0x19'),_0x3e3426+'-'+_0x3ab83c+'/'+_0x11fdec)['json'](_0x84b092);}return null;};}function patchUpdates(_0x38d41c){return function(_0x13422a){try{jsonpatch[_0x2b42('0x1a')](_0x13422a,_0x38d41c,!![]);}catch(_0x50fd94){return BPromise['reject'](_0x50fd94);}return _0x13422a[_0x2b42('0x1b')]();};}function saveUpdates(_0x24061b,_0x24ac96){return function(_0x2ee957){if(_0x2ee957){return _0x2ee957['update'](_0x24061b)[_0x2b42('0x1c')](function(_0x355859){return _0x355859;});}return null;};}function removeEntity(_0x5063b6,_0x2b9531){return function(_0x2e9aa1){if(_0x2e9aa1){return _0x2e9aa1[_0x2b42('0x1d')]()[_0x2b42('0x1c')](function(){_0x5063b6[_0x2b42('0x13')](0xcc)[_0x2b42('0x14')]();});}};}function handleEntityNotFound(_0x5367f0,_0x20ee74){return function(_0x319692){if(!_0x319692){_0x5367f0[_0x2b42('0x1e')](0x194);}return _0x319692;};}function handleError(_0x256fc9,_0x1d37b9){_0x1d37b9=_0x1d37b9||0x1f4;return function(_0x807625){logger[_0x2b42('0x1f')](_0x807625[_0x2b42('0x20')]);if(_0x807625[_0x2b42('0x21')]){delete _0x807625[_0x2b42('0x21')];}_0x256fc9[_0x2b42('0x13')](_0x1d37b9)['send'](_0x807625);};}exports['index']=function(_0x162efa,_0xcb30f5){var _0x8293e2={},_0x352ef7={},_0x4b43b0={'count':0x0,'rows':[]};var _0x286223=_[_0x2b42('0x22')](db[_0x2b42('0x23')]['rawAttributes'],function(_0x5588ce){return{'name':_0x5588ce[_0x2b42('0x24')],'type':_0x5588ce[_0x2b42('0x25')][_0x2b42('0x26')]};});_0x352ef7[_0x2b42('0x27')]=_['map'](_0x286223,_0x2b42('0x21'));_0x352ef7[_0x2b42('0x28')]=_[_0x2b42('0x29')](_0x162efa['query']);_0x352ef7[_0x2b42('0x2a')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],_0x352ef7[_0x2b42('0x28')]);_0x8293e2[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x352ef7[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x162efa[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x8293e2[_0x2b42('0x2c')]=_0x8293e2['attributes'][_0x2b42('0x2e')]?_0x8293e2['attributes']:_0x352ef7['model'];if(!_0x162efa[_0x2b42('0x28')][_0x2b42('0x2f')]('nolimit')){_0x8293e2['limit']=qs['limit'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x30')]);_0x8293e2[_0x2b42('0x16')]=qs['offset'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x16')]);}_0x8293e2['order']=qs['sort'](_0x162efa[_0x2b42('0x28')][_0x2b42('0x31')]);_0x8293e2[_0x2b42('0x32')]=qs['filters'](_[_0x2b42('0x33')](_0x162efa[_0x2b42('0x28')],_0x352ef7[_0x2b42('0x2a')]),_0x286223);if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]){_0x8293e2['where']=_[_0x2b42('0x35')](_0x8293e2[_0x2b42('0x32')],{'$or':_[_0x2b42('0x22')](_0x286223,function(_0x3971ee){if(_0x3971ee[_0x2b42('0x25')]!==_0x2b42('0x36')){var _0x45fb9f={};_0x45fb9f[_0x3971ee[_0x2b42('0x21')]]={'$like':'%'+_0x162efa[_0x2b42('0x28')][_0x2b42('0x34')]+'%'};return _0x45fb9f;}})});}_0x8293e2=_['merge']({},_0x8293e2,_0x162efa['options']);var _0x17b9b1={'where':_0x8293e2[_0x2b42('0x32')]};return db[_0x2b42('0x23')][_0x2b42('0x18')](_0x17b9b1)['then'](function(_0x1188d9){_0x4b43b0[_0x2b42('0x18')]=_0x1188d9;if(_0x162efa[_0x2b42('0x28')][_0x2b42('0x37')]){_0x8293e2[_0x2b42('0x38')]=[{'all':!![]}];}return db['DeskField'][_0x2b42('0x39')](_0x8293e2);})['then'](function(_0x35e745){_0x4b43b0[_0x2b42('0x3a')]=_0x35e745;return _0x4b43b0;})['then'](respondWithFilteredResult(_0xcb30f5,_0x8293e2))['catch'](handleError(_0xcb30f5,null));};exports[_0x2b42('0x3b')]=function(_0x10fad1,_0x4dc92e){var _0x5c525b={'raw':!![],'where':{'id':_0x10fad1[_0x2b42('0x3c')]['id']}},_0x3cc07e={};_0x3cc07e[_0x2b42('0x27')]=_[_0x2b42('0x29')](db[_0x2b42('0x23')][_0x2b42('0x3d')]);_0x3cc07e['query']=_[_0x2b42('0x29')](_0x10fad1[_0x2b42('0x28')]);_0x3cc07e['filters']=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],_0x3cc07e[_0x2b42('0x28')]);_0x5c525b[_0x2b42('0x2c')]=_[_0x2b42('0x2b')](_0x3cc07e[_0x2b42('0x27')],qs[_0x2b42('0x2d')](_0x10fad1[_0x2b42('0x28')][_0x2b42('0x2d')]));_0x5c525b[_0x2b42('0x2c')]=_0x5c525b[_0x2b42('0x2c')][_0x2b42('0x2e')]?_0x5c525b[_0x2b42('0x2c')]:_0x3cc07e[_0x2b42('0x27')];if(_0x10fad1[_0x2b42('0x28')]['includeAll']){_0x5c525b['include']=[{'all':!![]}];}_0x5c525b=_['merge']({},_0x5c525b,_0x10fad1[_0x2b42('0x3e')]);return db[_0x2b42('0x23')][_0x2b42('0x3f')](_0x5c525b)[_0x2b42('0x1c')](handleEntityNotFound(_0x4dc92e,null))[_0x2b42('0x1c')](respondWithResult(_0x4dc92e,null))[_0x2b42('0x40')](handleError(_0x4dc92e,null));};exports['create']=function(_0x11da42,_0x466e49){return db['DeskField'][_0x2b42('0x41')](_0x11da42['body'],{})[_0x2b42('0x1c')](respondWithResult(_0x466e49,0xc9))[_0x2b42('0x40')](handleError(_0x466e49,null));};exports[_0x2b42('0x42')]=function(_0x45fecd,_0x2890d2){if(_0x45fecd[_0x2b42('0x43')]['id']){delete _0x45fecd[_0x2b42('0x43')]['id'];}return db[_0x2b42('0x23')]['find']({'where':{'id':_0x45fecd[_0x2b42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2890d2,null))[_0x2b42('0x1c')](saveUpdates(_0x45fecd[_0x2b42('0x43')],null))[_0x2b42('0x1c')](respondWithResult(_0x2890d2,null))['catch'](handleError(_0x2890d2,null));};exports[_0x2b42('0x1d')]=function(_0x3e09f3,_0x212b03){return db[_0x2b42('0x23')]['find']({'where':{'id':_0x3e09f3['params']['id']}})[_0x2b42('0x1c')](handleEntityNotFound(_0x212b03,null))[_0x2b42('0x1c')](removeEntity(_0x212b03,null))[_0x2b42('0x40')](handleError(_0x212b03,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a8fc1b5..fc71085 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 _0x7a9a=['path','rimraf','exports','define','int_desk_fields','desk_unique_index','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x7a9a,0x1d4));var _0xa7a9=function(_0x55be98,_0x2462e1){_0x55be98=_0x55be98-0x0;var _0xcc5c47=_0x7a9a[_0x55be98];return _0xcc5c47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa7a9('0x0'))(_0xa7a9('0x1'));var moment=require(_0xa7a9('0x2'));var BPromise=require(_0xa7a9('0x3'));var rp=require(_0xa7a9('0x4'));var fs=require('fs');var path=require(_0xa7a9('0x5'));var rimraf=require(_0xa7a9('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xa7a9('0x7')]=function(_0x2b7215,_0x41c90){return _0x2b7215[_0xa7a9('0x8')]('DeskField',attributes,{'tableName':_0xa7a9('0x9'),'paranoid':![],'indexes':[{'name':_0xa7a9('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5786=['rimraf','./intDeskField.attributes','exports','define','desk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1aeafe,_0x44104a){var _0x3d453c=function(_0x34f0ba){while(--_0x34f0ba){_0x1aeafe['push'](_0x1aeafe['shift']());}};_0x3d453c(++_0x44104a);}(_0x5786,0x1cd));var _0x6578=function(_0x5bf33a,_0x4ed7f8){_0x5bf33a=_0x5bf33a-0x0;var _0x699341=_0x5786[_0x5bf33a];return _0x699341;};'use strict';var _=require('lodash');var util=require(_0x6578('0x0'));var logger=require(_0x6578('0x1'))(_0x6578('0x2'));var moment=require(_0x6578('0x3'));var BPromise=require(_0x6578('0x4'));var rp=require(_0x6578('0x5'));var fs=require('fs');var path=require(_0x6578('0x6'));var rimraf=require(_0x6578('0x7'));var config=require('../../config/environment');var attributes=require(_0x6578('0x8'));module[_0x6578('0x9')]=function(_0x357e0a,_0x106775){return _0x357e0a[_0x6578('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6578('0xb'),'fields':[_0x6578('0xc'),'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 78e237d..76612c0 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 _0xe9ec=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe9ec,0x86));var _0xce9e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe9ec[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xce9e('0x0'));var util=require(_0xce9e('0x1'));var moment=require(_0xce9e('0x2'));var BPromise=require('bluebird');var rs=require(_0xce9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce9e('0x4'))['db'];var utils=require(_0xce9e('0x5'));var logger=require(_0xce9e('0x6'))('rpc');var config=require(_0xce9e('0x7'));var jayson=require(_0xce9e('0x8'));var client=jayson['client'][_0xce9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14bb3a,_0x3094d4,_0x405ed2){return new BPromise(function(_0x58096a,_0x114a74){return client[_0xce9e('0xa')](_0x14bb3a,_0x405ed2)['then'](function(_0x599fa7){logger['info'](_0xce9e('0xb'),_0x3094d4,_0xce9e('0xc'));logger[_0xce9e('0xd')](_0xce9e('0xe'),_0x3094d4,'request\x20sent',JSON[_0xce9e('0xf')](_0x599fa7));if(_0x599fa7[_0xce9e('0x10')]){if(_0x599fa7[_0xce9e('0x10')][_0xce9e('0x11')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x3094d4,_0x599fa7[_0xce9e('0x10')][_0xce9e('0x12')]);return _0x114a74(_0x599fa7['error'][_0xce9e('0x12')]);}logger[_0xce9e('0x10')](_0xce9e('0xb'),_0x3094d4,_0x599fa7[_0xce9e('0x10')][_0xce9e('0x12')]);return _0x58096a(_0x599fa7['error'][_0xce9e('0x12')]);}else{logger[_0xce9e('0x13')](_0xce9e('0xb'),_0x3094d4,_0xce9e('0xc'));_0x58096a(_0x599fa7[_0xce9e('0x14')][_0xce9e('0x12')]);}})[_0xce9e('0x15')](function(_0x12750f){logger['error'](_0xce9e('0xb'),_0x3094d4,_0x12750f);_0x114a74(_0x12750f);});});} \ No newline at end of file +var _0x3716=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','DeskField,\x20%s,\x20%s','result','catch'];(function(_0x2adbf8,_0x4afd45){var _0x4d8466=function(_0x1ea071){while(--_0x1ea071){_0x2adbf8['push'](_0x2adbf8['shift']());}};_0x4d8466(++_0x4afd45);}(_0x3716,0xb8));var _0x6371=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x3716[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x6371('0x0'));var util=require(_0x6371('0x1'));var moment=require('moment');var BPromise=require(_0x6371('0x2'));var rs=require(_0x6371('0x3'));var fs=require('fs');var Redis=require(_0x6371('0x4'));var db=require(_0x6371('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6371('0x6'))(_0x6371('0x7'));var config=require(_0x6371('0x8'));var jayson=require(_0x6371('0x9'));var client=jayson[_0x6371('0xa')][_0x6371('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f11c,_0x309109,_0xf35a4a){return new BPromise(function(_0x181183,_0x523e84){return client['request'](_0x36f11c,_0xf35a4a)[_0x6371('0xc')](function(_0x52bc5c){logger[_0x6371('0xd')]('DeskField,\x20%s,\x20%s',_0x309109,'request\x20sent');logger[_0x6371('0xe')](_0x6371('0xf'),_0x309109,_0x6371('0x10'),JSON[_0x6371('0x11')](_0x52bc5c));if(_0x52bc5c['error']){if(_0x52bc5c['error']['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x309109,_0x52bc5c[_0x6371('0x12')][_0x6371('0x13')]);return _0x523e84(_0x52bc5c['error'][_0x6371('0x13')]);}logger[_0x6371('0x12')](_0x6371('0x14'),_0x309109,_0x52bc5c[_0x6371('0x12')]['message']);return _0x181183(_0x52bc5c['error'][_0x6371('0x13')]);}else{logger[_0x6371('0xd')](_0x6371('0x14'),_0x309109,'request\x20sent');_0x181183(_0x52bc5c[_0x6371('0x15')][_0x6371('0x13')]);}})[_0x6371('0x16')](function(_0x1c37bc){logger['error'](_0x6371('0x14'),_0x309109,_0x1c37bc);_0x523e84(_0x1c37bc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ec83419..7b60ce4 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 _0xb08f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete'];(function(_0x4e2593,_0x5a3014){var _0xb41060=function(_0x528e1f){while(--_0x528e1f){_0x4e2593['push'](_0x4e2593['shift']());}};_0xb41060(++_0x5a3014);}(_0xb08f,0x1dc));var _0xfb08=function(_0x545ab7,_0x121604){_0x545ab7=_0x545ab7-0x0;var _0x1c4523=_0xb08f[_0x545ab7];return _0x1c4523;};'use strict';var multer=require(_0xfb08('0x0'));var util=require(_0xfb08('0x1'));var path=require(_0xfb08('0x2'));var timeout=require(_0xfb08('0x3'));var express=require(_0xfb08('0x4'));var router=express[_0xfb08('0x5')]();var fs_extra=require(_0xfb08('0x6'));var auth=require(_0xfb08('0x7'));var interaction=require(_0xfb08('0x8'));var config=require('../../config/environment');var controller=require(_0xfb08('0x9'));router[_0xfb08('0xa')]('/',auth['isAuthenticated'](),controller[_0xfb08('0xb')]);router[_0xfb08('0xa')](_0xfb08('0xc'),auth['isAuthenticated'](),controller[_0xfb08('0xd')]);router[_0xfb08('0xa')]('/:id/configurations',auth[_0xfb08('0xe')](),controller[_0xfb08('0xf')]);router[_0xfb08('0xa')](_0xfb08('0x10'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x11')]);router[_0xfb08('0x12')]('/',auth['isAuthenticated'](),controller[_0xfb08('0x13')]);router[_0xfb08('0x12')](_0xfb08('0x14'),auth[_0xfb08('0xe')](),controller[_0xfb08('0x15')]);router[_0xfb08('0x16')](_0xfb08('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfb08('0x17')](_0xfb08('0xc'),auth[_0xfb08('0xe')](),controller['destroy']);module[_0xfb08('0x18')]=router; \ No newline at end of file +var _0x5760=['create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x180ce8,_0x1038d7){var _0x559d77=function(_0x301148){while(--_0x301148){_0x180ce8['push'](_0x180ce8['shift']());}};_0x559d77(++_0x1038d7);}(_0x5760,0xce));var _0x0576=function(_0x25893e,_0x3bd3cd){_0x25893e=_0x25893e-0x0;var _0xf167b0=_0x5760[_0x25893e];return _0xf167b0;};'use strict';var multer=require(_0x0576('0x0'));var util=require('util');var path=require(_0x0576('0x1'));var timeout=require(_0x0576('0x2'));var express=require(_0x0576('0x3'));var router=express['Router']();var fs_extra=require(_0x0576('0x4'));var auth=require(_0x0576('0x5'));var interaction=require(_0x0576('0x6'));var config=require(_0x0576('0x7'));var controller=require(_0x0576('0x8'));router['get']('/',auth[_0x0576('0x9')](),controller[_0x0576('0xa')]);router[_0x0576('0xb')](_0x0576('0xc'),auth[_0x0576('0x9')](),controller[_0x0576('0xd')]);router[_0x0576('0xb')](_0x0576('0xe'),auth[_0x0576('0x9')](),controller[_0x0576('0xf')]);router[_0x0576('0xb')](_0x0576('0x10'),auth[_0x0576('0x9')](),controller[_0x0576('0x11')]);router[_0x0576('0x12')]('/',auth[_0x0576('0x9')](),controller[_0x0576('0x13')]);router[_0x0576('0x12')](_0x0576('0xe'),auth[_0x0576('0x9')](),controller[_0x0576('0x14')]);router['put'](_0x0576('0xc'),auth[_0x0576('0x9')](),controller[_0x0576('0x15')]);router[_0x0576('0x16')]('/:id',auth[_0x0576('0x9')](),controller[_0x0576('0x17')]);module[_0x0576('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 463ac5e..b595ef7 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 _0xa67e=['STRING','sequelize','exports'];(function(_0x28ab89,_0x397514){var _0x1c7a66=function(_0xefc0fd){while(--_0xefc0fd){_0x28ab89['push'](_0x28ab89['shift']());}};_0x1c7a66(++_0x397514);}(_0xa67e,0x94));var _0xea67=function(_0x27993c,_0x3a4bcc){_0x27993c=_0x27993c-0x0;var _0x4033ca=_0xa67e[_0x27993c];return _0x4033ca;};'use strict';var Sequelize=require(_0xea67('0x0'));module[_0xea67('0x1')]={'name':{'type':Sequelize[_0xea67('0x2')]},'username':{'type':Sequelize[_0xea67('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xea67('0x2')]},'tenantId':{'type':Sequelize[_0xea67('0x2')]},'clientId':{'type':Sequelize[_0xea67('0x2')]},'clientSecret':{'type':Sequelize[_0xea67('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xea67('0x2')]}}; \ No newline at end of file +var _0x27c0=['exports','STRING','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x27c0,0xad));var _0x027c=function(_0x60cae4,_0x593d8c){_0x60cae4=_0x60cae4-0x0;var _0x14dfe4=_0x27c0[_0x60cae4];return _0x14dfe4;};'use strict';var Sequelize=require(_0x027c('0x0'));module[_0x027c('0x1')]={'name':{'type':Sequelize[_0x027c('0x2')]},'username':{'type':Sequelize[_0x027c('0x2')]},'password':{'type':Sequelize[_0x027c('0x2')]},'remoteUri':{'type':Sequelize[_0x027c('0x2')]},'tenantId':{'type':Sequelize[_0x027c('0x2')]},'clientId':{'type':Sequelize[_0x027c('0x2')]},'clientSecret':{'type':Sequelize[_0x027c('0x2')]},'serverUrl':{'type':Sequelize[_0x027c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f20efa5..274b486 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 _0x1da6=['body','Dynamics365Configuration','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','tenantId','clientId','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','username','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','stack','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','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','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','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','filters','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','fields','attributes','length','includeAll','options','find','create'];(function(_0x23bea4,_0x38a38){var _0xb54789=function(_0x2a5608){while(--_0x2a5608){_0x23bea4['push'](_0x23bea4['shift']());}};_0xb54789(++_0x38a38);}(_0x1da6,0x7c));var _0x61da=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x1da6[_0x3a2118];return _0x1d181d;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];var integrations=require(_0x61da('0x1f'));function respondWithStatusCode(_0x1036e4,_0x43ec70){_0x43ec70=_0x43ec70||0xcc;return function(_0x51695a){if(_0x51695a){return _0x1036e4[_0x61da('0x20')](_0x43ec70);}return _0x1036e4[_0x61da('0x21')](_0x43ec70)[_0x61da('0x22')]();};}function respondWithResult(_0x472abc,_0x55eef1){_0x55eef1=_0x55eef1||0xc8;return function(_0x30e421){if(_0x30e421){return _0x472abc['status'](_0x55eef1)[_0x61da('0x23')](_0x30e421);}};}function respondWithFilteredResult(_0x6d24b7,_0x4a0aea){return function(_0x53f3a4){if(_0x53f3a4){var _0x1305fe=typeof _0x4a0aea[_0x61da('0x24')]===_0x61da('0x25')&&typeof _0x4a0aea[_0x61da('0x26')]===_0x61da('0x25');var _0x1f81a0=_0x53f3a4['count'];var _0x14f049=_0x1305fe?0x0:_0x4a0aea[_0x61da('0x24')];var _0x1230ae=_0x1305fe?_0x53f3a4[_0x61da('0x27')]:_0x4a0aea['offset']+_0x4a0aea[_0x61da('0x26')];var _0x247cbc;if(_0x1230ae>=_0x1f81a0){_0x1230ae=_0x1f81a0;_0x247cbc=0xc8;}else{_0x247cbc=0xce;}_0x6d24b7[_0x61da('0x21')](_0x247cbc);return _0x6d24b7[_0x61da('0x28')]('Content-Range',_0x14f049+'-'+_0x1230ae+'/'+_0x1f81a0)[_0x61da('0x23')](_0x53f3a4);}return null;};}function patchUpdates(_0x5c0363){return function(_0x3131be){try{jsonpatch[_0x61da('0x29')](_0x3131be,_0x5c0363,!![]);}catch(_0x3526d1){return BPromise[_0x61da('0x2a')](_0x3526d1);}return _0x3131be[_0x61da('0x2b')]();};}function saveUpdates(_0x129bb0,_0x30c6f8){return function(_0x42a8e9){if(_0x42a8e9){return _0x42a8e9[_0x61da('0x2c')](_0x129bb0)[_0x61da('0x2d')](function(_0x56f5d2){return _0x56f5d2;});}return null;};}function removeEntity(_0x2c9e83,_0x35550a){return function(_0x1d3dc2){if(_0x1d3dc2){return _0x1d3dc2[_0x61da('0x2e')]()[_0x61da('0x2d')](function(){_0x2c9e83[_0x61da('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5d97,_0xe37079){return function(_0x229326){if(!_0x229326){_0x2c5d97[_0x61da('0x20')](0x194);}return _0x229326;};}function handleError(_0x351241,_0x262e32){_0x262e32=_0x262e32||0x1f4;return function(_0x3d245d){logger[_0x61da('0x2f')](_0x3d245d['stack']);if(_0x3d245d[_0x61da('0x30')]){delete _0x3d245d[_0x61da('0x30')];}_0x351241[_0x61da('0x21')](_0x262e32)[_0x61da('0x31')](_0x3d245d);};}exports['index']=function(_0x275aa6,_0x591efe){var _0x2c9a1d={},_0x2cc862={},_0x3a31a2={'count':0x0,'rows':[]};var _0x226912=_[_0x61da('0x32')](db[_0x61da('0x33')][_0x61da('0x34')],function(_0x52d93d){return{'name':_0x52d93d[_0x61da('0x35')],'type':_0x52d93d['type']['key']};});_0x2cc862[_0x61da('0x36')]=_[_0x61da('0x32')](_0x226912,_0x61da('0x30'));_0x2cc862[_0x61da('0x37')]=_[_0x61da('0x38')](_0x275aa6['query']);_0x2cc862[_0x61da('0x39')]=_[_0x61da('0x3a')](_0x2cc862[_0x61da('0x36')],_0x2cc862[_0x61da('0x37')]);_0x2c9a1d['attributes']=_[_0x61da('0x3a')](_0x2cc862[_0x61da('0x36')],qs['fields'](_0x275aa6[_0x61da('0x37')]['fields']));_0x2c9a1d['attributes']=_0x2c9a1d['attributes']['length']?_0x2c9a1d['attributes']:_0x2cc862[_0x61da('0x36')];if(!_0x275aa6[_0x61da('0x37')][_0x61da('0x3b')](_0x61da('0x3c'))){_0x2c9a1d[_0x61da('0x26')]=qs['limit'](_0x275aa6[_0x61da('0x37')][_0x61da('0x26')]);_0x2c9a1d[_0x61da('0x24')]=qs['offset'](_0x275aa6[_0x61da('0x37')][_0x61da('0x24')]);}_0x2c9a1d[_0x61da('0x3d')]=qs['sort'](_0x275aa6[_0x61da('0x37')][_0x61da('0x3e')]);_0x2c9a1d[_0x61da('0x3f')]=qs[_0x61da('0x39')](_[_0x61da('0x40')](_0x275aa6['query'],_0x2cc862[_0x61da('0x39')]),_0x226912);if(_0x275aa6[_0x61da('0x37')][_0x61da('0x41')]){_0x2c9a1d[_0x61da('0x3f')]=_[_0x61da('0x42')](_0x2c9a1d['where'],{'$or':_['map'](_0x226912,function(_0x5350b9){if(_0x5350b9[_0x61da('0x43')]!==_0x61da('0x44')){var _0x22f01e={};_0x22f01e[_0x5350b9[_0x61da('0x30')]]={'$like':'%'+_0x275aa6[_0x61da('0x37')][_0x61da('0x41')]+'%'};return _0x22f01e;}})});}_0x2c9a1d=_[_0x61da('0x42')]({},_0x2c9a1d,_0x275aa6['options']);var _0x13fa27={'where':_0x2c9a1d[_0x61da('0x3f')]};return db['Dynamics365Account'][_0x61da('0x27')](_0x13fa27)[_0x61da('0x2d')](function(_0xa26236){_0x3a31a2['count']=_0xa26236;if(_0x275aa6[_0x61da('0x37')]['includeAll']){_0x2c9a1d[_0x61da('0x45')]=[{'all':!![]}];}return db[_0x61da('0x33')][_0x61da('0x46')](_0x2c9a1d);})[_0x61da('0x2d')](function(_0x48084d){_0x3a31a2[_0x61da('0x47')]=_0x48084d;return _0x3a31a2;})[_0x61da('0x2d')](respondWithFilteredResult(_0x591efe,_0x2c9a1d))[_0x61da('0x48')](handleError(_0x591efe,null));};exports[_0x61da('0x49')]=function(_0x18e2da,_0x36d744){var _0x1dd879={'raw':![],'where':{'id':_0x18e2da[_0x61da('0x4a')]['id']}},_0x1a1564={};_0x1a1564[_0x61da('0x36')]=_['keys'](db[_0x61da('0x33')][_0x61da('0x34')]);_0x1a1564[_0x61da('0x37')]=_[_0x61da('0x38')](_0x18e2da[_0x61da('0x37')]);_0x1a1564[_0x61da('0x39')]=_[_0x61da('0x3a')](_0x1a1564[_0x61da('0x36')],_0x1a1564['query']);_0x1dd879['attributes']=_[_0x61da('0x3a')](_0x1a1564[_0x61da('0x36')],qs[_0x61da('0x4b')](_0x18e2da[_0x61da('0x37')][_0x61da('0x4b')]));_0x1dd879['attributes']=_0x1dd879[_0x61da('0x4c')][_0x61da('0x4d')]?_0x1dd879[_0x61da('0x4c')]:_0x1a1564[_0x61da('0x36')];if(_0x18e2da[_0x61da('0x37')][_0x61da('0x4e')]){_0x1dd879[_0x61da('0x45')]=[{'all':!![]}];}_0x1dd879=_[_0x61da('0x42')]({},_0x1dd879,_0x18e2da[_0x61da('0x4f')]);return db['Dynamics365Account'][_0x61da('0x50')](_0x1dd879)[_0x61da('0x2d')](handleEntityNotFound(_0x36d744,null))[_0x61da('0x2d')](respondWithResult(_0x36d744,null))[_0x61da('0x48')](handleError(_0x36d744,null));};exports['create']=function(_0x1b5ebf,_0x1dbd9e){return db[_0x61da('0x33')][_0x61da('0x51')](_0x1b5ebf[_0x61da('0x52')],{})['then'](respondWithResult(_0x1dbd9e,0xc9))[_0x61da('0x48')](handleError(_0x1dbd9e,null));};exports[_0x61da('0x2c')]=function(_0x584ddd,_0x164deb){if(_0x584ddd[_0x61da('0x52')]['id']){delete _0x584ddd['body']['id'];}return db[_0x61da('0x33')][_0x61da('0x50')]({'where':{'id':_0x584ddd[_0x61da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x164deb,null))[_0x61da('0x2d')](saveUpdates(_0x584ddd[_0x61da('0x52')],null))[_0x61da('0x2d')](respondWithResult(_0x164deb,null))[_0x61da('0x48')](handleError(_0x164deb,null));};exports['destroy']=function(_0x19ec8a,_0x537ded){return db[_0x61da('0x33')]['find']({'where':{'id':_0x19ec8a[_0x61da('0x4a')]['id']}})[_0x61da('0x2d')](handleEntityNotFound(_0x537ded,null))[_0x61da('0x2d')](removeEntity(_0x537ded,null))[_0x61da('0x48')](handleError(_0x537ded,null));};exports['getConfigurations']=function(_0xc5c8a6,_0x31d838,_0xd2c919){var _0x450807={};var _0x5f9ec9={};var _0x3b52bd;var _0x184038;return db['Dynamics365Account']['findOne']({'where':{'id':_0xc5c8a6['params']['id']}})[_0x61da('0x2d')](handleEntityNotFound(_0x31d838,null))[_0x61da('0x2d')](function(_0x569b93){if(_0x569b93){_0x3b52bd=_0x569b93;_0x5f9ec9['model']=_[_0x61da('0x38')](db[_0x61da('0x53')][_0x61da('0x34')]);_0x5f9ec9[_0x61da('0x37')]=_[_0x61da('0x38')](_0xc5c8a6[_0x61da('0x37')]);_0x5f9ec9[_0x61da('0x39')]=_['intersection'](_0x5f9ec9['model'],_0x5f9ec9[_0x61da('0x37')]);_0x450807[_0x61da('0x4c')]=_[_0x61da('0x3a')](_0x5f9ec9[_0x61da('0x36')],qs[_0x61da('0x4b')](_0xc5c8a6[_0x61da('0x37')][_0x61da('0x4b')]));_0x450807[_0x61da('0x4c')]=_0x450807[_0x61da('0x4c')][_0x61da('0x4d')]?_0x450807[_0x61da('0x4c')]:_0x5f9ec9['model'];_0x450807[_0x61da('0x3d')]=qs[_0x61da('0x3e')](_0xc5c8a6['query'][_0x61da('0x3e')]);_0x450807[_0x61da('0x3f')]=qs[_0x61da('0x39')](_['pick'](_0xc5c8a6[_0x61da('0x37')],_0x5f9ec9[_0x61da('0x39')]));if(_0xc5c8a6['query'][_0x61da('0x41')]){_0x450807[_0x61da('0x3f')]=_[_0x61da('0x42')](_0x450807[_0x61da('0x3f')],{'$or':_[_0x61da('0x32')](_0x450807[_0x61da('0x4c')],function(_0x124988){var _0x4752c7={};_0x4752c7[_0x124988]={'$like':'%'+_0xc5c8a6[_0x61da('0x37')]['filter']+'%'};return _0x4752c7;})});}_0x450807=_['merge']({},_0x450807,_0xc5c8a6[_0x61da('0x4f')]);return _0x3b52bd['getConfigurations'](_0x450807);}})[_0x61da('0x2d')](function(_0x1eb8af){if(_0x1eb8af){_0x184038=_0x1eb8af[_0x61da('0x4d')];if(!_0xc5c8a6['query']['hasOwnProperty'](_0x61da('0x3c'))){_0x450807[_0x61da('0x26')]=qs['limit'](_0xc5c8a6[_0x61da('0x37')][_0x61da('0x26')]);_0x450807[_0x61da('0x24')]=qs[_0x61da('0x24')](_0xc5c8a6[_0x61da('0x37')][_0x61da('0x24')]);}return _0x3b52bd[_0x61da('0x54')](_0x450807);}})[_0x61da('0x2d')](function(_0x2fdde1){if(_0x2fdde1){return _0x2fdde1?{'count':_0x184038,'rows':_0x2fdde1}:null;}})[_0x61da('0x2d')](respondWithResult(_0x31d838,null))[_0x61da('0x48')](handleError(_0x31d838,null));};exports['addConfiguration']=function(_0x3e8d1b,_0x4b03eb,_0x182865){if(_0x3e8d1b[_0x61da('0x52')]['id']){delete _0x3e8d1b[_0x61da('0x52')]['id'];}return db[_0x61da('0x33')][_0x61da('0x55')]({'where':{'id':_0x3e8d1b[_0x61da('0x4a')]['id']}})[_0x61da('0x2d')](handleEntityNotFound(_0x4b03eb,null))[_0x61da('0x2d')](function(_0x368eb7){if(_0x368eb7){_0x3e8d1b[_0x61da('0x52')][_0x61da('0x56')]=_0x368eb7['id'];_0x3e8d1b[_0x61da('0x52')][_0x61da('0x57')]=integrations['getSubjects'](_0x3e8d1b['body'][_0x61da('0x58')],_0x3e8d1b[_0x61da('0x52')][_0x61da('0x43')]);_0x3e8d1b[_0x61da('0x52')][_0x61da('0x59')]=integrations[_0x61da('0x5a')](_0x3e8d1b['body']['channel'],_0x3e8d1b[_0x61da('0x52')][_0x61da('0x43')]);return db[_0x61da('0x53')][_0x61da('0x51')](_0x3e8d1b['body'],{'include':[{'model':db[_0x61da('0x5b')],'as':'Subjects'},{'model':db[_0x61da('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4b03eb,null))[_0x61da('0x48')](handleError(_0x4b03eb,null));};exports['getFields']=function(_0x3b6c8f,_0x501c69,_0x104201){var _0x57d57c=_0x3b6c8f['query']['ticketType'];var _0x46433=_0x57d57c===_0x61da('0x5c')?'Incident':_0x61da('0x5d');var _0x33db8d='';var _0x160f4c='';var _0x3822e4='';var _0x5ef8a3='';var _0x464869='';var _0x41b706='';var _0x1255b2='';var _0x4b4749='';var _0x1f60b6=[_0x61da('0x5e'),'description',_0x61da('0x5f'),_0x61da('0x60'),'caseorigincode',_0x61da('0x61'),_0x61da('0x62'),'regardingobjectid',_0x61da('0x63'),_0x61da('0x64')];var _0x230790=[_0x61da('0x65'),'accountidyominame',_0x61da('0x66'),_0x61da('0x67'),'contactidname',_0x61da('0x68'),_0x61da('0x69'),_0x61da('0x6a'),'createdbyexternalpartyname',_0x61da('0x6b'),'createdbyname',_0x61da('0x6c'),_0x61da('0x6d'),_0x61da('0x6e'),'createdonbehalfbyyominame',_0x61da('0x6f'),_0x61da('0x70'),_0x61da('0x71'),_0x61da('0x72'),_0x61da('0x73'),'entityimage_timestamp',_0x61da('0x74'),'escalatedon','exchangerate',_0x61da('0x75'),_0x61da('0x76'),_0x61da('0x77'),'influencescore','kbarticleidname',_0x61da('0x78'),_0x61da('0x79'),_0x61da('0x7a'),'modifiedbyexternalpartyyominame',_0x61da('0x7b'),_0x61da('0x7c'),_0x61da('0x7d'),'modifiedonbehalfbyname',_0x61da('0x7e'),_0x61da('0x7f'),_0x61da('0x80'),_0x61da('0x81'),_0x61da('0x82'),'overriddencreatedon','owneridname',_0x61da('0x83'),_0x61da('0x84'),_0x61da('0x85'),_0x61da('0x86'),_0x61da('0x87'),_0x61da('0x88'),_0x61da('0x89'),_0x61da('0x8a'),_0x61da('0x8b'),_0x61da('0x8c'),_0x61da('0x8d'),_0x61da('0x8e'),_0x61da('0x8f'),_0x61da('0x90'),_0x61da('0x91'),_0x61da('0x92'),_0x61da('0x93'),_0x61da('0x94'),_0x61da('0x95'),'subjectidname',_0x61da('0x96'),_0x61da('0x97'),'transactioncurrencyidname',_0x61da('0x98'),_0x61da('0x99'),'versionnumber'];var _0x4628e7=_0x1f60b6[_0x61da('0x9a')](_0x230790);return db[_0x61da('0x33')][_0x61da('0x55')]({'where':{'id':_0x3b6c8f[_0x61da('0x4a')]['id']},'attributes':['id','username','password','remoteUri',_0x61da('0x9b'),_0x61da('0x9c'),'clientSecret']})[_0x61da('0x2d')](handleEntityNotFound(_0x501c69,null))['then'](function(_0x4334c3){if(_0x4334c3){_0x4b4749=_0x4334c3['remoteUri'];var _0x174fa9=_0x4b4749['slice'](-0x1);if(_0x174fa9==='/'){_0x4b4749=_0x4b4749[_0x61da('0x9d')](0x0,_0x4b4749[_0x61da('0x9e')](_0x174fa9));}_0x1255b2=util[_0x61da('0x9f')]('%s/api/data/v9.0/',_0x4b4749);var _0x17ce3d={'method':_0x61da('0xa0'),'uri':_0x61da('0xa1')+_0x4334c3[_0x61da('0x9b')]+'/oauth2/token','form':{'client_id':_0x4334c3[_0x61da('0x9c')],'resource':_0x4b4749,'username':_0x4334c3[_0x61da('0xa2')],'password':_0x4334c3[_0x61da('0xa3')],'grant_type':_0x61da('0xa3'),'client_secret':_0x4334c3[_0x61da('0xa4')]},'json':!![]};return rp(_0x17ce3d);}})[_0x61da('0x2d')](function(_0x3ef88d){_0x41b706=_0x3ef88d[_0x61da('0xa5')];var _0x4489be={'method':_0x61da('0xa6'),'uri':encodeURI(_0x1255b2+_0x61da('0xa7')+_0x46433+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x41b706,'If-None-Match':null,'OData-Version':_0x61da('0xa8')},'json':!![]};return rp(_0x4489be);})[_0x61da('0x2d')](function(_0x3fe0e0){var _0x368c6b=_0x3fe0e0['value'][0x0];var _0x1cf199=_0x368c6b[_0x61da('0xa9')];var _0x22c26e={'method':_0x61da('0xa6'),'uri':_0x1255b2+_0x61da('0xaa')+_0x1cf199+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x61da('0xab')+_0x41b706,'If-None-Match':null,'OData-Version':_0x61da('0xa8')},'json':!![]};return rp(_0x22c26e);})[_0x61da('0x2d')](function(_0x3884c7){_0x33db8d=_0x3884c7;_0x160f4c=_0x33db8d[_0x61da('0xac')];_0x160f4c=_[_0x61da('0xad')](_0x160f4c,function(_0x2a8698){return!_0x4628e7[_0x61da('0xae')](_0x2a8698[_0x61da('0xaf')]);});var _0x59fe3f=[];var _0x2f4e03=[];_0x160f4c[_0x61da('0xb0')](function(_0x5ef966){if(_0x5ef966[_0x61da('0xb1')]){var _0x104019=_0x5ef966['@odata.type']['substring'](_0x5ef966[_0x61da('0xb1')][_0x61da('0x9e')]('.')+0x1);if(_0x104019==='PicklistAttributeMetadata'){_0x59fe3f[_0x61da('0xb2')](getSelectList(_0x1255b2,_0x57d57c,_0x2f4e03,_0x33db8d[_0x61da('0xa9')],_0x5ef966['MetadataId'],_0x41b706));}}});return Promise[_0x61da('0xb3')](_0x59fe3f);})['then'](function(_0x3d7256){_0x3822e4=_0x3d7256[0x0];var _0x40122f=[];var _0x59e632=[];_0x160f4c[_0x61da('0xb0')](function(_0x285e85){if(!_[_0x61da('0xb4')](_0x285e85[_0x61da('0xb1')])){var _0x7042c0=_0x285e85['@odata.type'][_0x61da('0x9d')](_0x285e85[_0x61da('0xb1')][_0x61da('0x9e')]('.')+0x1);if(_0x7042c0===_0x61da('0xb5')){_0x40122f[_0x61da('0xb2')](getBooleanList(_0x1255b2,_0x57d57c,_0x59e632,_0x33db8d['MetadataId'],_0x285e85['MetadataId'],_0x41b706));}}});return Promise[_0x61da('0xb3')](_0x40122f);})['then'](function(_0x2298cd){_0x5ef8a3=_0x2298cd[0x0];var _0x23ba27=[];var _0x3bcf11=[];_0x160f4c[_0x61da('0xb0')](function(_0x272b73){if(_0x272b73[_0x61da('0xb1')]){var _0x19752e=_0x272b73[_0x61da('0xb1')][_0x61da('0x9d')](_0x272b73[_0x61da('0xb1')][_0x61da('0x9e')]('.')+0x1);if(_0x19752e==='StringAttributeMetadata'||_0x19752e===_0x61da('0xb6')||_0x19752e===_0x61da('0xb7')||_0x19752e===_0x61da('0xb8')||_0x19752e===_0x61da('0xb9')||_0x19752e===_0x61da('0xba')||_0x19752e===_0x61da('0xbb')||_0x19752e===_0x61da('0xbc')||_0x19752e===_0x61da('0xbd')||_0x19752e==='DecimalAttributeMetadata'){_0x23ba27[_0x61da('0xb2')](getInputList(_0x1255b2,_0x57d57c,_0x19752e,_0x3bcf11,_0x33db8d['MetadataId'],_0x272b73[_0x61da('0xa9')],_0x41b706));}}});return Promise[_0x61da('0xb3')](_0x23ba27);})['then'](function(_0x127d98){_0x464869=_0x127d98[0x0];var _0x4be6db=_0x3822e4['concat'](_0x5ef8a3)[_0x61da('0x9a')](_0x464869);var _0x3e2fb2={'count':_0x4be6db['length'],'rows':_0x4be6db};return _0x3e2fb2;})[_0x61da('0x2d')](respondWithResult(_0x501c69,null))[_0x61da('0x48')](function(_0x229e78){var _0x5a97b0=_0x3b6c8f[_0x61da('0x37')][_0x61da('0xbe')]?0x1f4:_0x229e78[_0x61da('0xbf')]||0x1f4;logger[_0x61da('0x2f')](_0x229e78[_0x61da('0xc0')]);delete _0x229e78['name'];if(_0x5a97b0===0x191){_0x5a97b0=0x190;}_0x501c69[_0x61da('0x21')](_0x5a97b0)['send'](_0x3b6c8f['query'][_0x61da('0xbe')]?{'message':_0x61da('0xc1'),'statusCode':_0x229e78[_0x61da('0xbf')]}:_0x229e78);});};function getSelectList(_0x54672d,_0x1c516e,_0x26f8ea,_0x31fd47,_0x1c456e,_0x585a6d){var _0x2cf445={'method':_0x61da('0xa6'),'uri':_0x54672d+_0x61da('0xaa')+_0x31fd47+')/Attributes('+_0x1c456e+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x61da('0xc2'),'headers':{'Authorization':_0x61da('0xab')+_0x585a6d,'If-None-Match':null,'OData-Version':_0x61da('0xa8')},'json':!![]};return rp(_0x2cf445)[_0x61da('0x2d')](function(_0x36cb6e){var _0x743bcb=[];var _0x551de0=_0x36cb6e[_0x61da('0xc3')]['Options'];_0x551de0[_0x61da('0xb0')](function(_0x2b193e){_0x743bcb[_0x61da('0xb2')]({'name':_0x2b193e[_0x61da('0xc4')][_0x61da('0xc5')][_0x61da('0xc4')],'value':String(_0x2b193e[_0x61da('0xc6')])});});var _0x445ae4={'id':_0x1c516e+'_'+_0x36cb6e[_0x61da('0xaf')],'name':_0x36cb6e[_0x61da('0xc7')][_0x61da('0xc5')]['Label'],'custom':![],'options':_0x743bcb};_0x26f8ea[_0x61da('0xb2')](_0x445ae4);return _0x26f8ea;});}function getBooleanList(_0xce0f82,_0x34dddf,_0x20510f,_0x253554,_0x5cdb42,_0x1ea175){var _0x554b13={'method':'GET','uri':_0xce0f82+'EntityDefinitions('+_0x253554+')/Attributes('+_0x5cdb42+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x1ea175,'If-None-Match':null,'OData-Version':_0x61da('0xa8')},'json':!![]};return rp(_0x554b13)[_0x61da('0x2d')](function(_0x112f49){var _0x5c6bbc=[];_0x5c6bbc['push']({'name':_0x112f49[_0x61da('0xc3')][_0x61da('0xc8')]['Label'][_0x61da('0xc5')][_0x61da('0xc4')],'value':_0x61da('0xc9')},{'name':_0x112f49[_0x61da('0xc3')][_0x61da('0xca')][_0x61da('0xc4')][_0x61da('0xc5')][_0x61da('0xc4')],'value':'false'});var _0x5acea1={'id':_0x34dddf+'_'+_0x112f49[_0x61da('0xaf')],'name':_0x112f49[_0x61da('0xc7')][_0x61da('0xc5')]['Label'],'custom':![],'options':_0x5c6bbc};_0x20510f[_0x61da('0xb2')](_0x5acea1);return _0x20510f;});}function getInputList(_0x3a363b,_0x1c973e,_0x4ffddc,_0x46199a,_0x104669,_0x218c19,_0x3e0df1){var _0x5740ef={'method':_0x61da('0xa6'),'uri':_0x3a363b+_0x61da('0xaa')+_0x104669+_0x61da('0xcb')+_0x218c19+_0x61da('0xcc')+_0x4ffddc+_0x61da('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x3e0df1,'If-None-Match':null,'OData-Version':_0x61da('0xa8')},'json':!![]};return rp(_0x5740ef)[_0x61da('0x2d')](function(_0x33ca12){var _0x48ed3a={'id':_0x1c973e+'_'+_0x33ca12[_0x61da('0xaf')],'name':_0x33ca12['DisplayName'][_0x61da('0xc5')]?_0x33ca12[_0x61da('0xc7')]['UserLocalizedLabel'][_0x61da('0xc4')]:_0x33ca12[_0x61da('0xaf')],'custom':![],'options':[]};_0x46199a['push'](_0x48ed3a);return _0x46199a;});} \ No newline at end of file +var _0xd04b=['AccountId','channel','Descriptions','create','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','clientSecret','remoteUri','slice','substring','format','%s/api/data/v9.0/','POST','clientId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','lastIndexOf','push','all','isNil','@odata.type','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(','Options','UserLocalizedLabel','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','status','sendStatus','error','stack','name','send','Dynamics365Account','rawAttributes','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','includeAll','options','body','find','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration'];(function(_0x22d8a6,_0x4383d6){var _0x1364e0=function(_0x8deee2){while(--_0x8deee2){_0x22d8a6['push'](_0x22d8a6['shift']());}};_0x1364e0(++_0x4383d6);}(_0xd04b,0x145));var _0xbd04=function(_0x48cefb,_0x36bffa){_0x48cefb=_0x48cefb-0x0;var _0x2f2881=_0xd04b[_0x48cefb];return _0x2f2881;};'use strict';var emlformat=require(_0xbd04('0x0'));var rimraf=require(_0xbd04('0x1'));var zipdir=require(_0xbd04('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd04('0x3'));var moment=require('moment');var BPromise=require(_0xbd04('0x4'));var Mustache=require(_0xbd04('0x5'));var util=require(_0xbd04('0x6'));var path=require(_0xbd04('0x7'));var sox=require(_0xbd04('0x8'));var csv=require(_0xbd04('0x9'));var ejs=require(_0xbd04('0xa'));var fs=require('fs');var fs_extra=require(_0xbd04('0xb'));var _=require(_0xbd04('0xc'));var squel=require(_0xbd04('0xd'));var crypto=require(_0xbd04('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbd04('0xf'));var toCsv=require(_0xbd04('0x9'));var querystring=require(_0xbd04('0x10'));var Papa=require(_0xbd04('0x11'));var Redis=require(_0xbd04('0x12'));var authService=require(_0xbd04('0x13'));var qs=require(_0xbd04('0x14'));var as=require(_0xbd04('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd04('0x16'))(_0xbd04('0x17'));var utils=require(_0xbd04('0x18'));var config=require(_0xbd04('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd04('0x1a'))['db'];var integrations=require(_0xbd04('0x1b'));function respondWithStatusCode(_0x8d337b,_0x57baa6){_0x57baa6=_0x57baa6||0xcc;return function(_0x48f257){if(_0x48f257){return _0x8d337b['sendStatus'](_0x57baa6);}return _0x8d337b['status'](_0x57baa6)[_0xbd04('0x1c')]();};}function respondWithResult(_0x291e94,_0x11e875){_0x11e875=_0x11e875||0xc8;return function(_0x4b6813){if(_0x4b6813){return _0x291e94['status'](_0x11e875)[_0xbd04('0x1d')](_0x4b6813);}};}function respondWithFilteredResult(_0x5d31e4,_0x2fe6bf){return function(_0x1b8bfc){if(_0x1b8bfc){var _0x5f4da1=typeof _0x2fe6bf['offset']==='undefined'&&typeof _0x2fe6bf[_0xbd04('0x1e')]===_0xbd04('0x1f');var _0x974adc=_0x1b8bfc[_0xbd04('0x20')];var _0x61161c=_0x5f4da1?0x0:_0x2fe6bf[_0xbd04('0x21')];var _0x48828f=_0x5f4da1?_0x1b8bfc['count']:_0x2fe6bf[_0xbd04('0x21')]+_0x2fe6bf[_0xbd04('0x1e')];var _0x499c23;if(_0x48828f>=_0x974adc){_0x48828f=_0x974adc;_0x499c23=0xc8;}else{_0x499c23=0xce;}_0x5d31e4['status'](_0x499c23);return _0x5d31e4['set'](_0xbd04('0x22'),_0x61161c+'-'+_0x48828f+'/'+_0x974adc)['json'](_0x1b8bfc);}return null;};}function patchUpdates(_0x3a9dea){return function(_0x4b5e90){try{jsonpatch[_0xbd04('0x23')](_0x4b5e90,_0x3a9dea,!![]);}catch(_0x330b06){return BPromise['reject'](_0x330b06);}return _0x4b5e90[_0xbd04('0x24')]();};}function saveUpdates(_0x270ce6,_0x5c7450){return function(_0x45ad2b){if(_0x45ad2b){return _0x45ad2b[_0xbd04('0x25')](_0x270ce6)[_0xbd04('0x26')](function(_0x457db8){return _0x457db8;});}return null;};}function removeEntity(_0x19d792,_0x5d880b){return function(_0x2ecadd){if(_0x2ecadd){return _0x2ecadd[_0xbd04('0x27')]()[_0xbd04('0x26')](function(){_0x19d792[_0xbd04('0x28')](0xcc)[_0xbd04('0x1c')]();});}};}function handleEntityNotFound(_0x527a2d,_0x37a10f){return function(_0x4d3917){if(!_0x4d3917){_0x527a2d[_0xbd04('0x29')](0x194);}return _0x4d3917;};}function handleError(_0x348416,_0x45923c){_0x45923c=_0x45923c||0x1f4;return function(_0x2eb172){logger[_0xbd04('0x2a')](_0x2eb172[_0xbd04('0x2b')]);if(_0x2eb172[_0xbd04('0x2c')]){delete _0x2eb172[_0xbd04('0x2c')];}_0x348416[_0xbd04('0x28')](_0x45923c)[_0xbd04('0x2d')](_0x2eb172);};}exports['index']=function(_0x57815b,_0x311374){var _0x2230f9={},_0xccbb8c={},_0x2f3947={'count':0x0,'rows':[]};var _0x1c322d=_['map'](db[_0xbd04('0x2e')][_0xbd04('0x2f')],function(_0x5c1dac){return{'name':_0x5c1dac['fieldName'],'type':_0x5c1dac[_0xbd04('0x30')][_0xbd04('0x31')]};});_0xccbb8c['model']=_[_0xbd04('0x32')](_0x1c322d,_0xbd04('0x2c'));_0xccbb8c['query']=_[_0xbd04('0x33')](_0x57815b[_0xbd04('0x34')]);_0xccbb8c[_0xbd04('0x35')]=_[_0xbd04('0x36')](_0xccbb8c['model'],_0xccbb8c[_0xbd04('0x34')]);_0x2230f9[_0xbd04('0x37')]=_[_0xbd04('0x36')](_0xccbb8c['model'],qs[_0xbd04('0x38')](_0x57815b[_0xbd04('0x34')][_0xbd04('0x38')]));_0x2230f9[_0xbd04('0x37')]=_0x2230f9[_0xbd04('0x37')][_0xbd04('0x39')]?_0x2230f9[_0xbd04('0x37')]:_0xccbb8c[_0xbd04('0x3a')];if(!_0x57815b[_0xbd04('0x34')][_0xbd04('0x3b')](_0xbd04('0x3c'))){_0x2230f9[_0xbd04('0x1e')]=qs[_0xbd04('0x1e')](_0x57815b['query'][_0xbd04('0x1e')]);_0x2230f9[_0xbd04('0x21')]=qs[_0xbd04('0x21')](_0x57815b[_0xbd04('0x34')][_0xbd04('0x21')]);}_0x2230f9[_0xbd04('0x3d')]=qs[_0xbd04('0x3e')](_0x57815b[_0xbd04('0x34')][_0xbd04('0x3e')]);_0x2230f9[_0xbd04('0x3f')]=qs['filters'](_[_0xbd04('0x40')](_0x57815b[_0xbd04('0x34')],_0xccbb8c[_0xbd04('0x35')]),_0x1c322d);if(_0x57815b[_0xbd04('0x34')][_0xbd04('0x41')]){_0x2230f9[_0xbd04('0x3f')]=_[_0xbd04('0x42')](_0x2230f9[_0xbd04('0x3f')],{'$or':_[_0xbd04('0x32')](_0x1c322d,function(_0x12f0ba){if(_0x12f0ba[_0xbd04('0x30')]!==_0xbd04('0x43')){var _0x512720={};_0x512720[_0x12f0ba[_0xbd04('0x2c')]]={'$like':'%'+_0x57815b['query'][_0xbd04('0x41')]+'%'};return _0x512720;}})});}_0x2230f9=_[_0xbd04('0x42')]({},_0x2230f9,_0x57815b['options']);var _0x5319c6={'where':_0x2230f9[_0xbd04('0x3f')]};return db['Dynamics365Account'][_0xbd04('0x20')](_0x5319c6)[_0xbd04('0x26')](function(_0x482c09){_0x2f3947[_0xbd04('0x20')]=_0x482c09;if(_0x57815b[_0xbd04('0x34')]['includeAll']){_0x2230f9[_0xbd04('0x44')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xbd04('0x45')](_0x2230f9);})[_0xbd04('0x26')](function(_0x4a14d6){_0x2f3947[_0xbd04('0x46')]=_0x4a14d6;return _0x2f3947;})['then'](respondWithFilteredResult(_0x311374,_0x2230f9))[_0xbd04('0x47')](handleError(_0x311374,null));};exports['show']=function(_0x3f3a2b,_0x1971fe){var _0x4d5873={'raw':![],'where':{'id':_0x3f3a2b['params']['id']}},_0x15f5df={};_0x15f5df['model']=_[_0xbd04('0x33')](db[_0xbd04('0x2e')]['rawAttributes']);_0x15f5df[_0xbd04('0x34')]=_['keys'](_0x3f3a2b[_0xbd04('0x34')]);_0x15f5df[_0xbd04('0x35')]=_[_0xbd04('0x36')](_0x15f5df[_0xbd04('0x3a')],_0x15f5df[_0xbd04('0x34')]);_0x4d5873[_0xbd04('0x37')]=_['intersection'](_0x15f5df[_0xbd04('0x3a')],qs['fields'](_0x3f3a2b[_0xbd04('0x34')][_0xbd04('0x38')]));_0x4d5873[_0xbd04('0x37')]=_0x4d5873[_0xbd04('0x37')][_0xbd04('0x39')]?_0x4d5873[_0xbd04('0x37')]:_0x15f5df[_0xbd04('0x3a')];if(_0x3f3a2b[_0xbd04('0x34')][_0xbd04('0x48')]){_0x4d5873[_0xbd04('0x44')]=[{'all':!![]}];}_0x4d5873=_[_0xbd04('0x42')]({},_0x4d5873,_0x3f3a2b[_0xbd04('0x49')]);return db[_0xbd04('0x2e')]['find'](_0x4d5873)[_0xbd04('0x26')](handleEntityNotFound(_0x1971fe,null))[_0xbd04('0x26')](respondWithResult(_0x1971fe,null))[_0xbd04('0x47')](handleError(_0x1971fe,null));};exports['create']=function(_0x5ced26,_0x4eeda9){return db[_0xbd04('0x2e')]['create'](_0x5ced26[_0xbd04('0x4a')],{})[_0xbd04('0x26')](respondWithResult(_0x4eeda9,0xc9))[_0xbd04('0x47')](handleError(_0x4eeda9,null));};exports['update']=function(_0xfafe46,_0x10ef54){if(_0xfafe46[_0xbd04('0x4a')]['id']){delete _0xfafe46[_0xbd04('0x4a')]['id'];}return db[_0xbd04('0x2e')]['find']({'where':{'id':_0xfafe46['params']['id']}})[_0xbd04('0x26')](handleEntityNotFound(_0x10ef54,null))[_0xbd04('0x26')](saveUpdates(_0xfafe46['body'],null))['then'](respondWithResult(_0x10ef54,null))[_0xbd04('0x47')](handleError(_0x10ef54,null));};exports[_0xbd04('0x27')]=function(_0x519c83,_0x1e9365){return db['Dynamics365Account'][_0xbd04('0x4b')]({'where':{'id':_0x519c83[_0xbd04('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e9365,null))[_0xbd04('0x26')](removeEntity(_0x1e9365,null))[_0xbd04('0x47')](handleError(_0x1e9365,null));};exports[_0xbd04('0x4d')]=function(_0xaf3ff4,_0x2b14a4,_0xb9dad8){var _0x2afe2e={};var _0x30a575={};var _0x22ee46;var _0x18f536;return db[_0xbd04('0x2e')][_0xbd04('0x4e')]({'where':{'id':_0xaf3ff4['params']['id']}})[_0xbd04('0x26')](handleEntityNotFound(_0x2b14a4,null))[_0xbd04('0x26')](function(_0x1f0ae0){if(_0x1f0ae0){_0x22ee46=_0x1f0ae0;_0x30a575[_0xbd04('0x3a')]=_['keys'](db[_0xbd04('0x4f')][_0xbd04('0x2f')]);_0x30a575[_0xbd04('0x34')]=_[_0xbd04('0x33')](_0xaf3ff4[_0xbd04('0x34')]);_0x30a575['filters']=_[_0xbd04('0x36')](_0x30a575['model'],_0x30a575['query']);_0x2afe2e[_0xbd04('0x37')]=_[_0xbd04('0x36')](_0x30a575['model'],qs['fields'](_0xaf3ff4[_0xbd04('0x34')][_0xbd04('0x38')]));_0x2afe2e[_0xbd04('0x37')]=_0x2afe2e[_0xbd04('0x37')][_0xbd04('0x39')]?_0x2afe2e[_0xbd04('0x37')]:_0x30a575[_0xbd04('0x3a')];_0x2afe2e[_0xbd04('0x3d')]=qs['sort'](_0xaf3ff4[_0xbd04('0x34')][_0xbd04('0x3e')]);_0x2afe2e['where']=qs['filters'](_['pick'](_0xaf3ff4[_0xbd04('0x34')],_0x30a575[_0xbd04('0x35')]));if(_0xaf3ff4['query'][_0xbd04('0x41')]){_0x2afe2e[_0xbd04('0x3f')]=_[_0xbd04('0x42')](_0x2afe2e[_0xbd04('0x3f')],{'$or':_[_0xbd04('0x32')](_0x2afe2e[_0xbd04('0x37')],function(_0x3ee684){var _0xbd262a={};_0xbd262a[_0x3ee684]={'$like':'%'+_0xaf3ff4[_0xbd04('0x34')]['filter']+'%'};return _0xbd262a;})});}_0x2afe2e=_[_0xbd04('0x42')]({},_0x2afe2e,_0xaf3ff4[_0xbd04('0x49')]);return _0x22ee46[_0xbd04('0x4d')](_0x2afe2e);}})[_0xbd04('0x26')](function(_0x3244fe){if(_0x3244fe){_0x18f536=_0x3244fe[_0xbd04('0x39')];if(!_0xaf3ff4['query'][_0xbd04('0x3b')](_0xbd04('0x3c'))){_0x2afe2e[_0xbd04('0x1e')]=qs[_0xbd04('0x1e')](_0xaf3ff4[_0xbd04('0x34')][_0xbd04('0x1e')]);_0x2afe2e['offset']=qs[_0xbd04('0x21')](_0xaf3ff4[_0xbd04('0x34')][_0xbd04('0x21')]);}return _0x22ee46[_0xbd04('0x4d')](_0x2afe2e);}})[_0xbd04('0x26')](function(_0x5615a2){if(_0x5615a2){return _0x5615a2?{'count':_0x18f536,'rows':_0x5615a2}:null;}})['then'](respondWithResult(_0x2b14a4,null))[_0xbd04('0x47')](handleError(_0x2b14a4,null));};exports[_0xbd04('0x50')]=function(_0x1caa2c,_0x45bce2,_0x56b6e8){if(_0x1caa2c['body']['id']){delete _0x1caa2c[_0xbd04('0x4a')]['id'];}return db[_0xbd04('0x2e')][_0xbd04('0x4e')]({'where':{'id':_0x1caa2c[_0xbd04('0x4c')]['id']}})['then'](handleEntityNotFound(_0x45bce2,null))[_0xbd04('0x26')](function(_0x50fea4){if(_0x50fea4){_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x51')]=_0x50fea4['id'];_0x1caa2c[_0xbd04('0x4a')]['Subjects']=integrations['getSubjects'](_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x52')],_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x30')]);_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x53')]=integrations['getDescriptions'](_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x52')],_0x1caa2c[_0xbd04('0x4a')][_0xbd04('0x30')]);return db['Dynamics365Configuration'][_0xbd04('0x54')](_0x1caa2c[_0xbd04('0x4a')],{'include':[{'model':db[_0xbd04('0x55')],'as':'Subjects'},{'model':db[_0xbd04('0x55')],'as':_0xbd04('0x53')}]});}return null;})[_0xbd04('0x26')](respondWithResult(_0x45bce2,null))['catch'](handleError(_0x45bce2,null));};exports[_0xbd04('0x56')]=function(_0x46bfd5,_0x8daa4d,_0x4765a9){var _0x55de5d=_0x46bfd5[_0xbd04('0x34')][_0xbd04('0x57')];var _0x293006=_0x55de5d===_0xbd04('0x58')?'Incident':_0xbd04('0x59');var _0x3f5075='';var _0x5f4877='';var _0x4c9c30='';var _0x652c8='';var _0x1fd3a7='';var _0x5c592f='';var _0x19184f='';var _0x5bab18='';var _0x3eeb2d=[_0xbd04('0x5a'),'description','customerid','ownerid','caseorigincode','subject',_0xbd04('0x5b'),_0xbd04('0x5c'),'directioncode',_0xbd04('0x5d')];var _0x117ba4=[_0xbd04('0x5e'),_0xbd04('0x5f'),'actualserviceunits',_0xbd04('0x60'),_0xbd04('0x61'),_0xbd04('0x62'),_0xbd04('0x63'),_0xbd04('0x64'),_0xbd04('0x65'),'createdbyexternalpartyyominame',_0xbd04('0x66'),_0xbd04('0x67'),_0xbd04('0x68'),_0xbd04('0x69'),_0xbd04('0x6a'),_0xbd04('0x6b'),_0xbd04('0x6c'),_0xbd04('0x6d'),_0xbd04('0x6e'),'entitlementidname',_0xbd04('0x6f'),_0xbd04('0x70'),_0xbd04('0x71'),_0xbd04('0x72'),'firstresponsebykpiidname',_0xbd04('0x73'),_0xbd04('0x74'),'influencescore',_0xbd04('0x75'),_0xbd04('0x76'),_0xbd04('0x77'),_0xbd04('0x78'),_0xbd04('0x79'),_0xbd04('0x7a'),_0xbd04('0x7b'),_0xbd04('0x7c'),_0xbd04('0x7d'),'modifiedonbehalfbyyominame',_0xbd04('0x7e'),_0xbd04('0x7f'),_0xbd04('0x80'),_0xbd04('0x81'),_0xbd04('0x82'),'owneridname',_0xbd04('0x83'),'owneridyominame',_0xbd04('0x84'),'primarycontactidname',_0xbd04('0x85'),_0xbd04('0x86'),_0xbd04('0x87'),_0xbd04('0x88'),'resolveby','resolvebykpiidname','responseby',_0xbd04('0x89'),_0xbd04('0x8a'),_0xbd04('0x8b'),_0xbd04('0x8c'),_0xbd04('0x8d'),_0xbd04('0x8e'),_0xbd04('0x8f'),_0xbd04('0x90'),_0xbd04('0x91'),'ticketnumber',_0xbd04('0x92'),_0xbd04('0x93'),_0xbd04('0x94'),_0xbd04('0x95'),_0xbd04('0x96')];var _0x163767=_0x3eeb2d[_0xbd04('0x97')](_0x117ba4);return db['Dynamics365Account'][_0xbd04('0x4e')]({'where':{'id':_0x46bfd5[_0xbd04('0x4c')]['id']},'attributes':['id',_0xbd04('0x98'),'password','remoteUri','tenantId','clientId',_0xbd04('0x99')]})[_0xbd04('0x26')](handleEntityNotFound(_0x8daa4d,null))[_0xbd04('0x26')](function(_0x2a2678){if(_0x2a2678){_0x5bab18=_0x2a2678[_0xbd04('0x9a')];var _0x2109f1=_0x5bab18[_0xbd04('0x9b')](-0x1);if(_0x2109f1==='/'){_0x5bab18=_0x5bab18[_0xbd04('0x9c')](0x0,_0x5bab18['lastIndexOf'](_0x2109f1));}_0x19184f=util[_0xbd04('0x9d')](_0xbd04('0x9e'),_0x5bab18);var _0x4d2fee={'method':_0xbd04('0x9f'),'uri':'https://login.microsoftonline.com/'+_0x2a2678['tenantId']+'/oauth2/token','form':{'client_id':_0x2a2678[_0xbd04('0xa0')],'resource':_0x5bab18,'username':_0x2a2678['username'],'password':_0x2a2678[_0xbd04('0xa1')],'grant_type':_0xbd04('0xa1'),'client_secret':_0x2a2678[_0xbd04('0x99')]},'json':!![]};return rp(_0x4d2fee);}})[_0xbd04('0x26')](function(_0x1e5893){_0x5c592f=_0x1e5893[_0xbd04('0xa2')];var _0x39eb28={'method':_0xbd04('0xa3'),'uri':encodeURI(_0x19184f+_0xbd04('0xa4')+_0x293006+'\x27'),'headers':{'Authorization':_0xbd04('0xa5')+_0x5c592f,'If-None-Match':null,'OData-Version':_0xbd04('0xa6')},'json':!![]};return rp(_0x39eb28);})[_0xbd04('0x26')](function(_0x1a77cd){var _0x2f1d5c=_0x1a77cd['value'][0x0];var _0x2227d1=_0x2f1d5c[_0xbd04('0xa7')];var _0x32fa0f={'method':_0xbd04('0xa3'),'uri':_0x19184f+_0xbd04('0xa8')+_0x2227d1+_0xbd04('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x5c592f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32fa0f);})[_0xbd04('0x26')](function(_0x409f13){_0x3f5075=_0x409f13;_0x5f4877=_0x3f5075['Attributes'];_0x5f4877=_[_0xbd04('0xaa')](_0x5f4877,function(_0x59e888){return!_0x163767[_0xbd04('0xab')](_0x59e888[_0xbd04('0xac')]);});var _0x43c0e2=[];var _0x112046=[];_0x5f4877[_0xbd04('0xad')](function(_0x2c1781){if(_0x2c1781['@odata.type']){var _0x1c9f5f=_0x2c1781['@odata.type']['substring'](_0x2c1781['@odata.type'][_0xbd04('0xae')]('.')+0x1);if(_0x1c9f5f==='PicklistAttributeMetadata'){_0x43c0e2[_0xbd04('0xaf')](getSelectList(_0x19184f,_0x55de5d,_0x112046,_0x3f5075['MetadataId'],_0x2c1781[_0xbd04('0xa7')],_0x5c592f));}}});return Promise[_0xbd04('0xb0')](_0x43c0e2);})[_0xbd04('0x26')](function(_0x39f6ff){_0x4c9c30=_0x39f6ff[0x0];var _0x5e479f=[];var _0x469cd3=[];_0x5f4877['forEach'](function(_0x36c308){if(!_[_0xbd04('0xb1')](_0x36c308[_0xbd04('0xb2')])){var _0x182143=_0x36c308['@odata.type'][_0xbd04('0x9c')](_0x36c308['@odata.type']['lastIndexOf']('.')+0x1);if(_0x182143===_0xbd04('0xb3')){_0x5e479f['push'](getBooleanList(_0x19184f,_0x55de5d,_0x469cd3,_0x3f5075['MetadataId'],_0x36c308[_0xbd04('0xa7')],_0x5c592f));}}});return Promise[_0xbd04('0xb0')](_0x5e479f);})[_0xbd04('0x26')](function(_0x22d53a){_0x652c8=_0x22d53a[0x0];var _0x3f4369=[];var _0x124c9c=[];_0x5f4877['forEach'](function(_0xcd6e){if(_0xcd6e[_0xbd04('0xb2')]){var _0x33ad13=_0xcd6e[_0xbd04('0xb2')][_0xbd04('0x9c')](_0xcd6e['@odata.type'][_0xbd04('0xae')]('.')+0x1);if(_0x33ad13===_0xbd04('0xb4')||_0x33ad13==='DoubleAttributeMetadata'||_0x33ad13===_0xbd04('0xb5')||_0x33ad13==='IntegerAttributeMetadata'||_0x33ad13===_0xbd04('0xb6')||_0x33ad13===_0xbd04('0xb7')||_0x33ad13===_0xbd04('0xb8')||_0x33ad13===_0xbd04('0xb9')||_0x33ad13===_0xbd04('0xba')||_0x33ad13==='DecimalAttributeMetadata'){_0x3f4369[_0xbd04('0xaf')](getInputList(_0x19184f,_0x55de5d,_0x33ad13,_0x124c9c,_0x3f5075[_0xbd04('0xa7')],_0xcd6e[_0xbd04('0xa7')],_0x5c592f));}}});return Promise[_0xbd04('0xb0')](_0x3f4369);})[_0xbd04('0x26')](function(_0x2f2532){_0x1fd3a7=_0x2f2532[0x0];var _0x54f5de=_0x4c9c30[_0xbd04('0x97')](_0x652c8)[_0xbd04('0x97')](_0x1fd3a7);var _0x9f8fd0={'count':_0x54f5de[_0xbd04('0x39')],'rows':_0x54f5de};return _0x9f8fd0;})[_0xbd04('0x26')](respondWithResult(_0x8daa4d,null))[_0xbd04('0x47')](function(_0x4d25e1){var _0x2fa1e7=_0x46bfd5[_0xbd04('0x34')][_0xbd04('0xbb')]?0x1f4:_0x4d25e1['statusCode']||0x1f4;logger[_0xbd04('0x2a')](_0x4d25e1[_0xbd04('0x2b')]);delete _0x4d25e1[_0xbd04('0x2c')];if(_0x2fa1e7===0x191){_0x2fa1e7=0x190;}_0x8daa4d[_0xbd04('0x28')](_0x2fa1e7)[_0xbd04('0x2d')](_0x46bfd5[_0xbd04('0x34')]['test']?{'message':_0xbd04('0xbc'),'statusCode':_0x4d25e1[_0xbd04('0xbd')]}:_0x4d25e1);});};function getSelectList(_0x3a0ae2,_0x3dbe77,_0x4327a2,_0x43ca41,_0x52311d,_0x5ad828){var _0x4e2bf7={'method':'GET','uri':_0x3a0ae2+'EntityDefinitions('+_0x43ca41+_0xbd04('0xbe')+_0x52311d+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x5ad828,'If-None-Match':null,'OData-Version':_0xbd04('0xa6')},'json':!![]};return rp(_0x4e2bf7)[_0xbd04('0x26')](function(_0x2f81f8){var _0x55204d=[];var _0x4e1e8e=_0x2f81f8['OptionSet'][_0xbd04('0xbf')];_0x4e1e8e[_0xbd04('0xad')](function(_0x1839d0){_0x55204d['push']({'name':_0x1839d0['Label'][_0xbd04('0xc0')][_0xbd04('0xc1')],'value':String(_0x1839d0[_0xbd04('0xc2')])});});var _0x2cfb84={'id':_0x3dbe77+'_'+_0x2f81f8[_0xbd04('0xac')],'name':_0x2f81f8['DisplayName'][_0xbd04('0xc0')][_0xbd04('0xc1')],'custom':![],'options':_0x55204d};_0x4327a2[_0xbd04('0xaf')](_0x2cfb84);return _0x4327a2;});}function getBooleanList(_0x3ceca0,_0x8a082,_0x3041ef,_0x4ecf02,_0x5381b4,_0x663cff){var _0x106b63={'method':'GET','uri':_0x3ceca0+_0xbd04('0xa8')+_0x4ecf02+_0xbd04('0xbe')+_0x5381b4+_0xbd04('0xc3'),'headers':{'Authorization':'Bearer\x20'+_0x663cff,'If-None-Match':null,'OData-Version':_0xbd04('0xa6')},'json':!![]};return rp(_0x106b63)[_0xbd04('0x26')](function(_0xd7a318){var _0x372dd3=[];_0x372dd3['push']({'name':_0xd7a318[_0xbd04('0xc4')][_0xbd04('0xc5')][_0xbd04('0xc1')][_0xbd04('0xc0')]['Label'],'value':_0xbd04('0xc6')},{'name':_0xd7a318[_0xbd04('0xc4')][_0xbd04('0xc7')]['Label'][_0xbd04('0xc0')][_0xbd04('0xc1')],'value':_0xbd04('0xc8')});var _0x2b37cc={'id':_0x8a082+'_'+_0xd7a318['LogicalName'],'name':_0xd7a318[_0xbd04('0xc9')][_0xbd04('0xc0')][_0xbd04('0xc1')],'custom':![],'options':_0x372dd3};_0x3041ef['push'](_0x2b37cc);return _0x3041ef;});}function getInputList(_0x36079e,_0x4b1b3a,_0x511a1b,_0xef3d6,_0x3107c6,_0x3cb6b3,_0x1f0616){var _0x50f9c8={'method':_0xbd04('0xa3'),'uri':_0x36079e+'EntityDefinitions('+_0x3107c6+_0xbd04('0xbe')+_0x3cb6b3+_0xbd04('0xca')+_0x511a1b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbd04('0xa5')+_0x1f0616,'If-None-Match':null,'OData-Version':_0xbd04('0xa6')},'json':!![]};return rp(_0x50f9c8)[_0xbd04('0x26')](function(_0x5c4f2e){var _0x24211a={'id':_0x4b1b3a+'_'+_0x5c4f2e['LogicalName'],'name':_0x5c4f2e[_0xbd04('0xc9')][_0xbd04('0xc0')]?_0x5c4f2e[_0xbd04('0xc9')][_0xbd04('0xc0')][_0xbd04('0xc1')]:_0x5c4f2e[_0xbd04('0xac')],'custom':![],'options':[]};_0xef3d6[_0xbd04('0xaf')](_0x24211a);return _0xef3d6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 67b7c59..e4fdb25 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x91b04e,_0x4a4035){var _0x29afca=function(_0x388aab){while(--_0x388aab){_0x91b04e['push'](_0x91b04e['shift']());}};_0x29afca(++_0x4a4035);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xcb91[_0x1d1219];return _0x5b5b89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x332166,_0x353c6f){var _0x20bb57=function(_0x7faf3){while(--_0x7faf3){_0x332166['push'](_0x332166['shift']());}};_0x20bb57(++_0x353c6f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 19f3c87..b1564cc 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 _0x0630=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','map','include','model','attributes','ShowDynamics365Account'];(function(_0x54fe86,_0x56c307){var _0x12ad92=function(_0x325db3){while(--_0x325db3){_0x54fe86['push'](_0x54fe86['shift']());}};_0x12ad92(++_0x56c307);}(_0x0630,0x1e0));var _0x0063=function(_0x2b95eb,_0x2f918d){_0x2b95eb=_0x2b95eb-0x0;var _0x23fed8=_0x0630[_0x2b95eb];return _0x23fed8;};'use strict';var _=require(_0x0063('0x0'));var util=require('util');var moment=require(_0x0063('0x1'));var BPromise=require(_0x0063('0x2'));var rs=require(_0x0063('0x3'));var fs=require('fs');var Redis=require(_0x0063('0x4'));var db=require(_0x0063('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0063('0x6'))('rpc');var config=require(_0x0063('0x7'));var jayson=require(_0x0063('0x8'));var client=jayson[_0x0063('0x9')][_0x0063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14f198,_0x53f129,_0x47f7cb){return new BPromise(function(_0x2aa41d,_0x3f65d6){return client['request'](_0x14f198,_0x47f7cb)['then'](function(_0x2abf2a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x53f129,_0x0063('0xb'));logger[_0x0063('0xc')](_0x0063('0xd'),_0x53f129,_0x0063('0xb'),JSON[_0x0063('0xe')](_0x2abf2a));if(_0x2abf2a['error']){if(_0x2abf2a[_0x0063('0xf')][_0x0063('0x10')]===0x1f4){logger[_0x0063('0xf')](_0x0063('0x11'),_0x53f129,_0x2abf2a[_0x0063('0xf')][_0x0063('0x12')]);return _0x3f65d6(_0x2abf2a['error']['message']);}logger[_0x0063('0xf')](_0x0063('0x11'),_0x53f129,_0x2abf2a[_0x0063('0xf')][_0x0063('0x12')]);return _0x2aa41d(_0x2abf2a[_0x0063('0xf')][_0x0063('0x12')]);}else{logger[_0x0063('0x13')](_0x0063('0x11'),_0x53f129,'request\x20sent');_0x2aa41d(_0x2abf2a[_0x0063('0x14')][_0x0063('0x12')]);}})[_0x0063('0x15')](function(_0x54bd84){logger[_0x0063('0xf')](_0x0063('0x11'),_0x53f129,_0x54bd84);_0x3f65d6(_0x54bd84);});});}exports[_0x0063('0x16')]=function(_0x5582f7){var _0x144dd6=this;return new Promise(function(_0x2adf40,_0x59317c){return db[_0x0063('0x17')]['findAll']({'raw':_0x5582f7[_0x0063('0x18')]?_0x5582f7['options'][_0x0063('0x19')]===undefined?!![]:![]:!![],'where':_0x5582f7[_0x0063('0x18')]?_0x5582f7[_0x0063('0x18')][_0x0063('0x1a')]||null:null,'attributes':_0x5582f7[_0x0063('0x18')]?_0x5582f7[_0x0063('0x18')]['attributes']||null:null,'limit':_0x5582f7[_0x0063('0x18')]?_0x5582f7['options']['limit']||null:null,'include':_0x5582f7[_0x0063('0x18')]?_0x5582f7[_0x0063('0x18')]['include']?_[_0x0063('0x1b')](_0x5582f7[_0x0063('0x18')][_0x0063('0x1c')],function(_0xdfa209){return{'model':db[_0xdfa209[_0x0063('0x1d')]],'as':_0xdfa209['as'],'attributes':_0xdfa209[_0x0063('0x1e')],'include':_0xdfa209[_0x0063('0x1c')]?_[_0x0063('0x1b')](_0xdfa209[_0x0063('0x1c')],function(_0x2c674a){return{'model':db[_0x2c674a[_0x0063('0x1d')]],'as':_0x2c674a['as'],'attributes':_0x2c674a['attributes'],'include':_0x2c674a['include']?_['map'](_0x2c674a[_0x0063('0x1c')],function(_0x4c6e0e){return{'model':db[_0x4c6e0e[_0x0063('0x1d')]],'as':_0x4c6e0e['as'],'attributes':_0x4c6e0e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57c6ce){logger['info'](_0x0063('0x16'),_0x5582f7);logger['debug'](_0x0063('0x16'),_0x5582f7,JSON[_0x0063('0xe')](_0x57c6ce));_0x2adf40(_0x57c6ce);})[_0x0063('0x15')](function(_0x18f5ae){logger[_0x0063('0xf')](_0x0063('0x16'),_0x18f5ae['message'],_0x5582f7);_0x59317c(_0x144dd6[_0x0063('0xf')](0x1f4,_0x18f5ae[_0x0063('0x12')]));});});};exports[_0x0063('0x1f')]=function(_0x44553f){var _0x18133d=this;return new Promise(function(_0x53664c,_0x3bce46){return db[_0x0063('0x17')]['find']({'raw':_0x44553f[_0x0063('0x18')]?_0x44553f[_0x0063('0x18')][_0x0063('0x19')]===undefined?!![]:![]:!![],'where':_0x44553f[_0x0063('0x18')]?_0x44553f[_0x0063('0x18')]['where']||null:null,'attributes':_0x44553f[_0x0063('0x18')]?_0x44553f[_0x0063('0x18')][_0x0063('0x1e')]||null:null,'include':_0x44553f[_0x0063('0x18')]?_0x44553f[_0x0063('0x18')][_0x0063('0x1c')]?_[_0x0063('0x1b')](_0x44553f[_0x0063('0x18')][_0x0063('0x1c')],function(_0x588886){return{'model':db[_0x588886['model']],'as':_0x588886['as'],'attributes':_0x588886[_0x0063('0x1e')],'include':_0x588886[_0x0063('0x1c')]?_[_0x0063('0x1b')](_0x588886[_0x0063('0x1c')],function(_0x4e93f3){return{'model':db[_0x4e93f3[_0x0063('0x1d')]],'as':_0x4e93f3['as'],'attributes':_0x4e93f3[_0x0063('0x1e')],'include':_0x4e93f3[_0x0063('0x1c')]?_[_0x0063('0x1b')](_0x4e93f3[_0x0063('0x1c')],function(_0x37ac3d){return{'model':db[_0x37ac3d[_0x0063('0x1d')]],'as':_0x37ac3d['as'],'attributes':_0x37ac3d[_0x0063('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d000f){logger[_0x0063('0x13')](_0x0063('0x1f'),_0x44553f);logger[_0x0063('0xc')](_0x0063('0x1f'),_0x44553f,JSON[_0x0063('0xe')](_0x4d000f));_0x53664c(_0x4d000f);})['catch'](function(_0x437861){logger[_0x0063('0xf')](_0x0063('0x1f'),_0x437861[_0x0063('0x12')],_0x44553f);_0x3bce46(_0x18133d[_0x0063('0xf')](0x1f4,_0x437861[_0x0063('0x12')]));});});}; \ No newline at end of file +var _0x5952=['../../config/environment','jayson/promise','client','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','then','GetDynamics365Account','debug','find','ShowDynamics365Account','stringify','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x5952,0x192));var _0x2595=function(_0x537835,_0x305639){_0x537835=_0x537835-0x0;var _0x383e66=_0x5952[_0x537835];return _0x383e66;};'use strict';var _=require('lodash');var util=require(_0x2595('0x0'));var moment=require(_0x2595('0x1'));var BPromise=require(_0x2595('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2595('0x3'));var logger=require(_0x2595('0x4'))(_0x2595('0x5'));var config=require(_0x2595('0x6'));var jayson=require(_0x2595('0x7'));var client=jayson[_0x2595('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514743,_0x4a0a88,_0x54ec5f){return new BPromise(function(_0x3cc00b,_0x4bcbb8){return client[_0x2595('0x9')](_0x514743,_0x54ec5f)['then'](function(_0x2239e8){logger[_0x2595('0xa')](_0x2595('0xb'),_0x4a0a88,_0x2595('0xc'));logger['debug'](_0x2595('0xd'),_0x4a0a88,_0x2595('0xc'),JSON['stringify'](_0x2239e8));if(_0x2239e8['error']){if(_0x2239e8['error'][_0x2595('0xe')]===0x1f4){logger[_0x2595('0xf')](_0x2595('0xb'),_0x4a0a88,_0x2239e8['error']['message']);return _0x4bcbb8(_0x2239e8[_0x2595('0xf')][_0x2595('0x10')]);}logger[_0x2595('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x4a0a88,_0x2239e8[_0x2595('0xf')][_0x2595('0x10')]);return _0x3cc00b(_0x2239e8['error'][_0x2595('0x10')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4a0a88,_0x2595('0xc'));_0x3cc00b(_0x2239e8[_0x2595('0x11')][_0x2595('0x10')]);}})[_0x2595('0x12')](function(_0x67db00){logger['error'](_0x2595('0xb'),_0x4a0a88,_0x67db00);_0x4bcbb8(_0x67db00);});});}exports['GetDynamics365Account']=function(_0x58b258){var _0x51fb5e=this;return new Promise(function(_0x1a78fd,_0x30a5ce){return db[_0x2595('0x13')][_0x2595('0x14')]({'raw':_0x58b258['options']?_0x58b258[_0x2595('0x15')][_0x2595('0x16')]===undefined?!![]:![]:!![],'where':_0x58b258[_0x2595('0x15')]?_0x58b258[_0x2595('0x15')][_0x2595('0x17')]||null:null,'attributes':_0x58b258['options']?_0x58b258[_0x2595('0x15')][_0x2595('0x18')]||null:null,'limit':_0x58b258[_0x2595('0x15')]?_0x58b258['options']['limit']||null:null,'include':_0x58b258[_0x2595('0x15')]?_0x58b258['options'][_0x2595('0x19')]?_[_0x2595('0x1a')](_0x58b258[_0x2595('0x15')][_0x2595('0x19')],function(_0x3b4bd2){return{'model':db[_0x3b4bd2[_0x2595('0x1b')]],'as':_0x3b4bd2['as'],'attributes':_0x3b4bd2['attributes'],'include':_0x3b4bd2[_0x2595('0x19')]?_[_0x2595('0x1a')](_0x3b4bd2['include'],function(_0x1e9c1d){return{'model':db[_0x1e9c1d[_0x2595('0x1b')]],'as':_0x1e9c1d['as'],'attributes':_0x1e9c1d[_0x2595('0x18')],'include':_0x1e9c1d[_0x2595('0x19')]?_['map'](_0x1e9c1d[_0x2595('0x19')],function(_0x145b19){return{'model':db[_0x145b19['model']],'as':_0x145b19['as'],'attributes':_0x145b19[_0x2595('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2595('0x1c')](function(_0x1237db){logger[_0x2595('0xa')](_0x2595('0x1d'),_0x58b258);logger[_0x2595('0x1e')](_0x2595('0x1d'),_0x58b258,JSON['stringify'](_0x1237db));_0x1a78fd(_0x1237db);})[_0x2595('0x12')](function(_0x22e8ca){logger['error'](_0x2595('0x1d'),_0x22e8ca[_0x2595('0x10')],_0x58b258);_0x30a5ce(_0x51fb5e[_0x2595('0xf')](0x1f4,_0x22e8ca[_0x2595('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x37cb97){var _0x4d798a=this;return new Promise(function(_0xef7072,_0x292df0){return db['Dynamics365Account'][_0x2595('0x1f')]({'raw':_0x37cb97['options']?_0x37cb97[_0x2595('0x15')][_0x2595('0x16')]===undefined?!![]:![]:!![],'where':_0x37cb97[_0x2595('0x15')]?_0x37cb97['options'][_0x2595('0x17')]||null:null,'attributes':_0x37cb97[_0x2595('0x15')]?_0x37cb97[_0x2595('0x15')][_0x2595('0x18')]||null:null,'include':_0x37cb97[_0x2595('0x15')]?_0x37cb97[_0x2595('0x15')]['include']?_[_0x2595('0x1a')](_0x37cb97[_0x2595('0x15')][_0x2595('0x19')],function(_0x583473){return{'model':db[_0x583473[_0x2595('0x1b')]],'as':_0x583473['as'],'attributes':_0x583473[_0x2595('0x18')],'include':_0x583473[_0x2595('0x19')]?_['map'](_0x583473[_0x2595('0x19')],function(_0x596519){return{'model':db[_0x596519[_0x2595('0x1b')]],'as':_0x596519['as'],'attributes':_0x596519[_0x2595('0x18')],'include':_0x596519[_0x2595('0x19')]?_[_0x2595('0x1a')](_0x596519[_0x2595('0x19')],function(_0x4f8790){return{'model':db[_0x4f8790[_0x2595('0x1b')]],'as':_0x4f8790['as'],'attributes':_0x4f8790[_0x2595('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa40f5e){logger[_0x2595('0xa')]('ShowDynamics365Account',_0x37cb97);logger['debug'](_0x2595('0x20'),_0x37cb97,JSON[_0x2595('0x21')](_0xa40f5e));_0xef7072(_0xa40f5e);})[_0x2595('0x12')](function(_0x319f55){logger[_0x2595('0xf')](_0x2595('0x20'),_0x319f55[_0x2595('0x10')],_0x37cb97);_0x292df0(_0x4d798a['error'](0x1f4,_0x319f55[_0x2595('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 66f845d..8e9c4fe 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 _0x7a52=['/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x15cc02,_0x2cbb64){var _0x424f08=function(_0x58f1be){while(--_0x58f1be){_0x15cc02['push'](_0x15cc02['shift']());}};_0x424f08(++_0x2cbb64);}(_0x7a52,0x1bd));var _0x27a5=function(_0x13fedc,_0x2e918f){_0x13fedc=_0x13fedc-0x0;var _0x3925b2=_0x7a52[_0x13fedc];return _0x3925b2;};'use strict';var multer=require(_0x27a5('0x0'));var util=require('util');var path=require(_0x27a5('0x1'));var timeout=require(_0x27a5('0x2'));var express=require(_0x27a5('0x3'));var router=express[_0x27a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27a5('0x5'));var interaction=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var controller=require(_0x27a5('0x8'));router[_0x27a5('0x9')]('/',auth[_0x27a5('0xa')](),controller[_0x27a5('0xb')]);router['get'](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['show']);router['get'](_0x27a5('0xd'),auth['isAuthenticated'](),controller[_0x27a5('0xe')]);router[_0x27a5('0x9')](_0x27a5('0xf'),auth['isAuthenticated'](),controller[_0x27a5('0x10')]);router[_0x27a5('0x9')](_0x27a5('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x27a5('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x27a5('0x13')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller[_0x27a5('0x14')]);router[_0x27a5('0x15')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['destroy']);module[_0x27a5('0x16')]=router; \ No newline at end of file +var _0x5746=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x5746,0x176));var _0x6574=function(_0x4ea7ac,_0x1cca07){_0x4ea7ac=_0x4ea7ac-0x0;var _0xd54278=_0x5746[_0x4ea7ac];return _0xd54278;};'use strict';var multer=require(_0x6574('0x0'));var util=require(_0x6574('0x1'));var path=require('path');var timeout=require(_0x6574('0x2'));var express=require('express');var router=express[_0x6574('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6574('0x4'));var config=require('../../config/environment');var controller=require(_0x6574('0x5'));router[_0x6574('0x6')]('/',auth[_0x6574('0x7')](),controller[_0x6574('0x8')]);router[_0x6574('0x6')](_0x6574('0x9'),auth[_0x6574('0x7')](),controller[_0x6574('0xa')]);router[_0x6574('0x6')](_0x6574('0xb'),auth[_0x6574('0x7')](),controller[_0x6574('0xc')]);router[_0x6574('0x6')](_0x6574('0xd'),auth[_0x6574('0x7')](),controller[_0x6574('0xe')]);router['get'](_0x6574('0xf'),auth[_0x6574('0x7')](),controller[_0x6574('0x10')]);router['post']('/',auth[_0x6574('0x7')](),controller[_0x6574('0x11')]);router[_0x6574('0x12')](_0x6574('0x9'),auth['isAuthenticated'](),controller[_0x6574('0x13')]);router[_0x6574('0x14')](_0x6574('0x9'),auth[_0x6574('0x7')](),controller[_0x6574('0x15')]);module[_0x6574('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b516abc..dfccdc8 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 _0xc017=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x474290,_0x3f99a1){var _0x2e2a18=function(_0x2ebed1){while(--_0x2ebed1){_0x474290['push'](_0x474290['shift']());}};_0x2e2a18(++_0x3f99a1);}(_0xc017,0x1d9));var _0x7c01=function(_0xe67ad3,_0x57cfd6){_0xe67ad3=_0xe67ad3-0x0;var _0x519baa=_0xc017[_0xe67ad3];return _0x519baa;};'use strict';var Sequelize=require(_0x7c01('0x0'));module[_0x7c01('0x1')]={'name':{'type':Sequelize[_0x7c01('0x2')]},'description':{'type':Sequelize[_0x7c01('0x2')]},'ticketType':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x4'),_0x7c01('0x5')),'defaultValue':_0x7c01('0x4')}}; \ No newline at end of file +var _0x3d53=['exports','STRING','ENUM','incident'];(function(_0x15fcd5,_0xb1972){var _0x49dde5=function(_0x5db433){while(--_0x5db433){_0x15fcd5['push'](_0x15fcd5['shift']());}};_0x49dde5(++_0xb1972);}(_0x3d53,0x140));var _0x33d5=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x3d53[_0x2a67fe];return _0x57e726;};'use strict';var Sequelize=require('sequelize');module[_0x33d5('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x33d5('0x1')]},'ticketType':{'type':Sequelize[_0x33d5('0x2')](_0x33d5('0x3'),'phonecall'),'defaultValue':_0x33d5('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 298a796..91138b4 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 _0xab86=['order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','count','then','include','findAll','rows','catch','params','fields','includeAll','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','Content-Range','reject','update','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x42406d,_0x46215f){var _0x45c096=function(_0x409d1b){while(--_0x409d1b){_0x42406d['push'](_0x42406d['shift']());}};_0x45c096(++_0x46215f);}(_0xab86,0x107));var _0x6ab8=function(_0x3cdfdb,_0x40545d){_0x3cdfdb=_0x3cdfdb-0x0;var _0x57d4d8=_0xab86[_0x3cdfdb];return _0x57d4d8;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ab8('0x1'));var jsonpatch=require(_0x6ab8('0x2'));var rp=require(_0x6ab8('0x3'));var moment=require('moment');var BPromise=require(_0x6ab8('0x4'));var Mustache=require('mustache');var util=require(_0x6ab8('0x5'));var path=require(_0x6ab8('0x6'));var sox=require(_0x6ab8('0x7'));var csv=require('to-csv');var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require('squel');var crypto=require(_0x6ab8('0xb'));var jsforce=require(_0x6ab8('0xc'));var deskjs=require(_0x6ab8('0xd'));var toCsv=require(_0x6ab8('0xe'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require(_0x6ab8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x12'));var as=require(_0x6ab8('0x13'));var hardwareService=require(_0x6ab8('0x14'));var logger=require(_0x6ab8('0x15'))(_0x6ab8('0x16'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ab8('0x18'))['db'];function respondWithStatusCode(_0x291ffd,_0x163708){_0x163708=_0x163708||0xcc;return function(_0x40ec4a){if(_0x40ec4a){return _0x291ffd[_0x6ab8('0x19')](_0x163708);}return _0x291ffd[_0x6ab8('0x1a')](_0x163708)[_0x6ab8('0x1b')]();};}function respondWithResult(_0x39f36b,_0x42e495){_0x42e495=_0x42e495||0xc8;return function(_0x2951fb){if(_0x2951fb){return _0x39f36b[_0x6ab8('0x1a')](_0x42e495)[_0x6ab8('0x1c')](_0x2951fb);}};}function respondWithFilteredResult(_0x54d4b8,_0x232635){return function(_0x1bc0cd){if(_0x1bc0cd){var _0xa469f3=typeof _0x232635[_0x6ab8('0x1d')]==='undefined'&&typeof _0x232635['limit']===_0x6ab8('0x1e');var _0x3d1803=_0x1bc0cd['count'];var _0x486fa7=_0xa469f3?0x0:_0x232635['offset'];var _0x5ee515=_0xa469f3?_0x1bc0cd['count']:_0x232635[_0x6ab8('0x1d')]+_0x232635['limit'];var _0x52d927;if(_0x5ee515>=_0x3d1803){_0x5ee515=_0x3d1803;_0x52d927=0xc8;}else{_0x52d927=0xce;}_0x54d4b8[_0x6ab8('0x1a')](_0x52d927);return _0x54d4b8['set'](_0x6ab8('0x1f'),_0x486fa7+'-'+_0x5ee515+'/'+_0x3d1803)[_0x6ab8('0x1c')](_0x1bc0cd);}return null;};}function patchUpdates(_0x6ee7af){return function(_0x5bb87d){try{jsonpatch['apply'](_0x5bb87d,_0x6ee7af,!![]);}catch(_0x142fd0){return BPromise[_0x6ab8('0x20')](_0x142fd0);}return _0x5bb87d['save']();};}function saveUpdates(_0x502efe,_0x49f486){return function(_0x1866b5){if(_0x1866b5){return _0x1866b5[_0x6ab8('0x21')](_0x502efe)['then'](function(_0x571408){return _0x571408;});}return null;};}function removeEntity(_0x1e287d,_0x280916){return function(_0x340c4a){if(_0x340c4a){return _0x340c4a['destroy']()['then'](function(){_0x1e287d[_0x6ab8('0x1a')](0xcc)[_0x6ab8('0x1b')]();});}};}function handleEntityNotFound(_0x5e34d1,_0x56c81b){return function(_0x114ea5){if(!_0x114ea5){_0x5e34d1[_0x6ab8('0x19')](0x194);}return _0x114ea5;};}function handleError(_0x4eec26,_0x389084){_0x389084=_0x389084||0x1f4;return function(_0x144a7e){logger['error'](_0x144a7e[_0x6ab8('0x22')]);if(_0x144a7e['name']){delete _0x144a7e[_0x6ab8('0x23')];}_0x4eec26[_0x6ab8('0x1a')](_0x389084)[_0x6ab8('0x24')](_0x144a7e);};}exports[_0x6ab8('0x25')]=function(_0x2c6912,_0x3a9be1){var _0x3208e9={},_0x3ebd04={},_0x1c97fc={'count':0x0,'rows':[]};var _0x2c6ab9=_['map'](db['Dynamics365Configuration'][_0x6ab8('0x26')],function(_0x2405bd){return{'name':_0x2405bd[_0x6ab8('0x27')],'type':_0x2405bd[_0x6ab8('0x28')][_0x6ab8('0x29')]};});_0x3ebd04[_0x6ab8('0x2a')]=_[_0x6ab8('0x2b')](_0x2c6ab9,'name');_0x3ebd04[_0x6ab8('0x2c')]=_[_0x6ab8('0x2d')](_0x2c6912['query']);_0x3ebd04[_0x6ab8('0x2e')]=_[_0x6ab8('0x2f')](_0x3ebd04[_0x6ab8('0x2a')],_0x3ebd04[_0x6ab8('0x2c')]);_0x3208e9[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0x3ebd04['model'],qs['fields'](_0x2c6912[_0x6ab8('0x2c')]['fields']));_0x3208e9[_0x6ab8('0x30')]=_0x3208e9[_0x6ab8('0x30')][_0x6ab8('0x31')]?_0x3208e9['attributes']:_0x3ebd04['model'];if(!_0x2c6912[_0x6ab8('0x2c')][_0x6ab8('0x32')](_0x6ab8('0x33'))){_0x3208e9[_0x6ab8('0x34')]=qs[_0x6ab8('0x34')](_0x2c6912[_0x6ab8('0x2c')][_0x6ab8('0x34')]);_0x3208e9['offset']=qs[_0x6ab8('0x1d')](_0x2c6912[_0x6ab8('0x2c')][_0x6ab8('0x1d')]);}_0x3208e9[_0x6ab8('0x35')]=qs[_0x6ab8('0x36')](_0x2c6912[_0x6ab8('0x2c')][_0x6ab8('0x36')]);_0x3208e9[_0x6ab8('0x37')]=qs['filters'](_[_0x6ab8('0x38')](_0x2c6912[_0x6ab8('0x2c')],_0x3ebd04['filters']),_0x2c6ab9);if(_0x2c6912[_0x6ab8('0x2c')][_0x6ab8('0x39')]){_0x3208e9[_0x6ab8('0x37')]=_[_0x6ab8('0x3a')](_0x3208e9[_0x6ab8('0x37')],{'$or':_[_0x6ab8('0x2b')](_0x2c6ab9,function(_0x45746e){if(_0x45746e[_0x6ab8('0x28')]!==_0x6ab8('0x3b')){var _0x39b02b={};_0x39b02b[_0x45746e[_0x6ab8('0x23')]]={'$like':'%'+_0x2c6912[_0x6ab8('0x2c')]['filter']+'%'};return _0x39b02b;}})});}_0x3208e9=_['merge']({},_0x3208e9,_0x2c6912[_0x6ab8('0x3c')]);var _0x1d8cca={'where':_0x3208e9[_0x6ab8('0x37')]};return db[_0x6ab8('0x3d')][_0x6ab8('0x3e')](_0x1d8cca)[_0x6ab8('0x3f')](function(_0x21a02a){_0x1c97fc['count']=_0x21a02a;if(_0x2c6912[_0x6ab8('0x2c')]['includeAll']){_0x3208e9[_0x6ab8('0x40')]=[{'all':!![]}];}return db[_0x6ab8('0x3d')][_0x6ab8('0x41')](_0x3208e9);})[_0x6ab8('0x3f')](function(_0x16cfd4){_0x1c97fc[_0x6ab8('0x42')]=_0x16cfd4;return _0x1c97fc;})[_0x6ab8('0x3f')](respondWithFilteredResult(_0x3a9be1,_0x3208e9))[_0x6ab8('0x43')](handleError(_0x3a9be1,null));};exports['show']=function(_0x2df16f,_0x3b79e9){var _0x1542fc={'raw':![],'where':{'id':_0x2df16f[_0x6ab8('0x44')]['id']}},_0x5abeb2={};_0x5abeb2[_0x6ab8('0x2a')]=_['keys'](db[_0x6ab8('0x3d')][_0x6ab8('0x26')]);_0x5abeb2[_0x6ab8('0x2c')]=_[_0x6ab8('0x2d')](_0x2df16f[_0x6ab8('0x2c')]);_0x5abeb2[_0x6ab8('0x2e')]=_[_0x6ab8('0x2f')](_0x5abeb2[_0x6ab8('0x2a')],_0x5abeb2['query']);_0x1542fc[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0x5abeb2[_0x6ab8('0x2a')],qs[_0x6ab8('0x45')](_0x2df16f[_0x6ab8('0x2c')][_0x6ab8('0x45')]));_0x1542fc[_0x6ab8('0x30')]=_0x1542fc['attributes']['length']?_0x1542fc['attributes']:_0x5abeb2['model'];if(_0x2df16f[_0x6ab8('0x2c')][_0x6ab8('0x46')]){_0x1542fc[_0x6ab8('0x40')]=[{'all':!![]}];}_0x1542fc=_[_0x6ab8('0x3a')]({},_0x1542fc,_0x2df16f['options']);return db[_0x6ab8('0x3d')][_0x6ab8('0x47')](_0x1542fc)[_0x6ab8('0x3f')](handleEntityNotFound(_0x3b79e9,null))['then'](respondWithResult(_0x3b79e9,null))['catch'](handleError(_0x3b79e9,null));};exports['create']=function(_0x278dd5,_0x3c3176){return db['Dynamics365Configuration'][_0x6ab8('0x48')](_0x278dd5[_0x6ab8('0x49')],{})[_0x6ab8('0x3f')](respondWithResult(_0x3c3176,0xc9))[_0x6ab8('0x43')](handleError(_0x3c3176,null));};exports[_0x6ab8('0x21')]=function(_0xee3799,_0x2376c5){if(_0xee3799[_0x6ab8('0x49')]['id']){delete _0xee3799[_0x6ab8('0x49')]['id'];}return db[_0x6ab8('0x3d')]['find']({'where':{'id':_0xee3799['params']['id']}})[_0x6ab8('0x3f')](handleEntityNotFound(_0x2376c5,null))[_0x6ab8('0x3f')](saveUpdates(_0xee3799[_0x6ab8('0x49')],null))[_0x6ab8('0x3f')](respondWithResult(_0x2376c5,null))[_0x6ab8('0x43')](handleError(_0x2376c5,null));};exports['destroy']=function(_0x39a084,_0xb40a64){return db[_0x6ab8('0x3d')][_0x6ab8('0x47')]({'where':{'id':_0x39a084[_0x6ab8('0x44')]['id']}})[_0x6ab8('0x3f')](handleEntityNotFound(_0xb40a64,null))[_0x6ab8('0x3f')](removeEntity(_0xb40a64,null))[_0x6ab8('0x43')](handleError(_0xb40a64,null));};exports[_0x6ab8('0x4a')]=function(_0x93da83,_0x707382,_0x58a1bc){var _0x50157a={};var _0x2991b3={};var _0x5ef660;var _0x314b4a;return db[_0x6ab8('0x3d')]['findOne']({'where':{'id':_0x93da83['params']['id']}})[_0x6ab8('0x3f')](handleEntityNotFound(_0x707382,null))[_0x6ab8('0x3f')](function(_0xe9cfd1){if(_0xe9cfd1){_0x5ef660=_0xe9cfd1;_0x2991b3[_0x6ab8('0x2a')]=_['keys'](db['Dynamics365Field'][_0x6ab8('0x26')]);_0x2991b3[_0x6ab8('0x2c')]=_[_0x6ab8('0x2d')](_0x93da83[_0x6ab8('0x2c')]);_0x2991b3['filters']=_[_0x6ab8('0x2f')](_0x2991b3['model'],_0x2991b3[_0x6ab8('0x2c')]);_0x50157a[_0x6ab8('0x30')]=_['intersection'](_0x2991b3[_0x6ab8('0x2a')],qs[_0x6ab8('0x45')](_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x45')]));_0x50157a['attributes']=_0x50157a[_0x6ab8('0x30')][_0x6ab8('0x31')]?_0x50157a[_0x6ab8('0x30')]:_0x2991b3[_0x6ab8('0x2a')];_0x50157a[_0x6ab8('0x35')]=qs[_0x6ab8('0x36')](_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x36')]);_0x50157a[_0x6ab8('0x37')]=qs[_0x6ab8('0x2e')](_[_0x6ab8('0x38')](_0x93da83['query'],_0x2991b3[_0x6ab8('0x2e')]));if(_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x39')]){_0x50157a['where']=_[_0x6ab8('0x3a')](_0x50157a[_0x6ab8('0x37')],{'$or':_['map'](_0x50157a[_0x6ab8('0x30')],function(_0xacfd03){var _0x35ba7d={};_0x35ba7d[_0xacfd03]={'$like':'%'+_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x39')]+'%'};return _0x35ba7d;})});}_0x50157a=_[_0x6ab8('0x3a')]({},_0x50157a,_0x93da83[_0x6ab8('0x3c')]);return _0x5ef660['getFields'](_0x50157a);}})[_0x6ab8('0x3f')](function(_0x550cff){if(_0x550cff){_0x314b4a=_0x550cff['length'];if(!_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x32')](_0x6ab8('0x33'))){_0x50157a[_0x6ab8('0x34')]=qs[_0x6ab8('0x34')](_0x93da83['query']['limit']);_0x50157a['offset']=qs['offset'](_0x93da83[_0x6ab8('0x2c')][_0x6ab8('0x1d')]);}return _0x5ef660[_0x6ab8('0x4a')](_0x50157a);}})[_0x6ab8('0x3f')](function(_0x1f8c76){if(_0x1f8c76){return _0x1f8c76?{'count':_0x314b4a,'rows':_0x1f8c76}:null;}})['then'](respondWithResult(_0x707382,null))[_0x6ab8('0x43')](handleError(_0x707382,null));};exports['getSubjects']=function(_0x2c451e,_0x26b81b,_0x55ebbc){var _0x26adeb={};var _0x4d0abc={};var _0x4addd2;var _0x1b8178;return db[_0x6ab8('0x3d')][_0x6ab8('0x4b')]({'where':{'id':_0x2c451e[_0x6ab8('0x44')]['id']}})[_0x6ab8('0x3f')](handleEntityNotFound(_0x26b81b,null))[_0x6ab8('0x3f')](function(_0x46c58f){if(_0x46c58f){_0x4addd2=_0x46c58f;_0x4d0abc[_0x6ab8('0x2a')]=_['keys'](db[_0x6ab8('0x4c')][_0x6ab8('0x26')]);_0x4d0abc['query']=_[_0x6ab8('0x2d')](_0x2c451e[_0x6ab8('0x2c')]);_0x4d0abc['filters']=_[_0x6ab8('0x2f')](_0x4d0abc['model'],_0x4d0abc[_0x6ab8('0x2c')]);_0x26adeb[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0x4d0abc['model'],qs[_0x6ab8('0x45')](_0x2c451e[_0x6ab8('0x2c')][_0x6ab8('0x45')]));_0x26adeb[_0x6ab8('0x30')]=_0x26adeb['attributes']['length']?_0x26adeb[_0x6ab8('0x30')]:_0x4d0abc[_0x6ab8('0x2a')];_0x26adeb[_0x6ab8('0x35')]=qs[_0x6ab8('0x36')](_0x2c451e[_0x6ab8('0x2c')][_0x6ab8('0x36')]);_0x26adeb[_0x6ab8('0x37')]=qs[_0x6ab8('0x2e')](_[_0x6ab8('0x38')](_0x2c451e['query'],_0x4d0abc[_0x6ab8('0x2e')]));if(_0x2c451e['query'][_0x6ab8('0x39')]){_0x26adeb[_0x6ab8('0x37')]=_[_0x6ab8('0x3a')](_0x26adeb['where'],{'$or':_[_0x6ab8('0x2b')](_0x26adeb['attributes'],function(_0x1382a8){var _0x34178d={};_0x34178d[_0x1382a8]={'$like':'%'+_0x2c451e[_0x6ab8('0x2c')]['filter']+'%'};return _0x34178d;})});}_0x26adeb=_[_0x6ab8('0x3a')]({},_0x26adeb,_0x2c451e[_0x6ab8('0x3c')]);return _0x4addd2[_0x6ab8('0x4d')](_0x26adeb);}})['then'](function(_0x357d23){if(_0x357d23){_0x1b8178=_0x357d23['length'];if(!_0x2c451e[_0x6ab8('0x2c')][_0x6ab8('0x32')]('nolimit')){_0x26adeb[_0x6ab8('0x34')]=qs[_0x6ab8('0x34')](_0x2c451e[_0x6ab8('0x2c')]['limit']);_0x26adeb[_0x6ab8('0x1d')]=qs['offset'](_0x2c451e['query'][_0x6ab8('0x1d')]);}return _0x4addd2[_0x6ab8('0x4d')](_0x26adeb);}})[_0x6ab8('0x3f')](function(_0x4a8a5c){if(_0x4a8a5c){return _0x4a8a5c?{'count':_0x1b8178,'rows':_0x4a8a5c}:null;}})[_0x6ab8('0x3f')](respondWithResult(_0x26b81b,null))[_0x6ab8('0x43')](handleError(_0x26b81b,null));};exports[_0x6ab8('0x4e')]=function(_0xb2bdaa,_0x2e58c4,_0x403814){var _0x2006a0={};var _0x534172={};var _0x2ca92e;var _0x138892;return db[_0x6ab8('0x3d')][_0x6ab8('0x4b')]({'where':{'id':_0xb2bdaa['params']['id']}})['then'](handleEntityNotFound(_0x2e58c4,null))[_0x6ab8('0x3f')](function(_0x5ebbc6){if(_0x5ebbc6){_0x2ca92e=_0x5ebbc6;_0x534172[_0x6ab8('0x2a')]=_[_0x6ab8('0x2d')](db[_0x6ab8('0x4c')][_0x6ab8('0x26')]);_0x534172[_0x6ab8('0x2c')]=_['keys'](_0xb2bdaa[_0x6ab8('0x2c')]);_0x534172[_0x6ab8('0x2e')]=_[_0x6ab8('0x2f')](_0x534172[_0x6ab8('0x2a')],_0x534172[_0x6ab8('0x2c')]);_0x2006a0[_0x6ab8('0x30')]=_['intersection'](_0x534172[_0x6ab8('0x2a')],qs['fields'](_0xb2bdaa[_0x6ab8('0x2c')]['fields']));_0x2006a0['attributes']=_0x2006a0[_0x6ab8('0x30')][_0x6ab8('0x31')]?_0x2006a0[_0x6ab8('0x30')]:_0x534172['model'];_0x2006a0['order']=qs['sort'](_0xb2bdaa[_0x6ab8('0x2c')][_0x6ab8('0x36')]);_0x2006a0[_0x6ab8('0x37')]=qs[_0x6ab8('0x2e')](_['pick'](_0xb2bdaa['query'],_0x534172['filters']));if(_0xb2bdaa[_0x6ab8('0x2c')][_0x6ab8('0x39')]){_0x2006a0[_0x6ab8('0x37')]=_[_0x6ab8('0x3a')](_0x2006a0[_0x6ab8('0x37')],{'$or':_['map'](_0x2006a0[_0x6ab8('0x30')],function(_0x4af4f9){var _0x50da11={};_0x50da11[_0x4af4f9]={'$like':'%'+_0xb2bdaa[_0x6ab8('0x2c')][_0x6ab8('0x39')]+'%'};return _0x50da11;})});}_0x2006a0=_[_0x6ab8('0x3a')]({},_0x2006a0,_0xb2bdaa[_0x6ab8('0x3c')]);return _0x2ca92e[_0x6ab8('0x4e')](_0x2006a0);}})['then'](function(_0x3246df){if(_0x3246df){_0x138892=_0x3246df[_0x6ab8('0x31')];if(!_0xb2bdaa[_0x6ab8('0x2c')]['hasOwnProperty'](_0x6ab8('0x33'))){_0x2006a0[_0x6ab8('0x34')]=qs[_0x6ab8('0x34')](_0xb2bdaa[_0x6ab8('0x2c')]['limit']);_0x2006a0['offset']=qs[_0x6ab8('0x1d')](_0xb2bdaa[_0x6ab8('0x2c')]['offset']);}return _0x2ca92e[_0x6ab8('0x4e')](_0x2006a0);}})[_0x6ab8('0x3f')](function(_0x3d0edb){if(_0x3d0edb){return _0x3d0edb?{'count':_0x138892,'rows':_0x3d0edb}:null;}})[_0x6ab8('0x3f')](respondWithResult(_0x2e58c4,null))['catch'](handleError(_0x2e58c4,null));}; \ No newline at end of file +var _0x839d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','stack','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','include','rows','catch','params','rawAttributes','includeAll','find','create','body','Dynamics365Field','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x8abb66,_0xa4a47b){var _0x472e0b=function(_0x147f41){while(--_0x147f41){_0x8abb66['push'](_0x8abb66['shift']());}};_0x472e0b(++_0xa4a47b);}(_0x839d,0x1c7));var _0xd839=function(_0x6de642,_0x43808c){_0x6de642=_0x6de642-0x0;var _0x4f381f=_0x839d[_0x6de642];return _0x4f381f;};'use strict';var emlformat=require(_0xd839('0x0'));var rimraf=require(_0xd839('0x1'));var zipdir=require(_0xd839('0x2'));var jsonpatch=require(_0xd839('0x3'));var rp=require(_0xd839('0x4'));var moment=require(_0xd839('0x5'));var BPromise=require(_0xd839('0x6'));var Mustache=require(_0xd839('0x7'));var util=require(_0xd839('0x8'));var path=require(_0xd839('0x9'));var sox=require('sox');var csv=require(_0xd839('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd839('0xb'));var _=require(_0xd839('0xc'));var squel=require(_0xd839('0xd'));var crypto=require(_0xd839('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd839('0xf'));var toCsv=require(_0xd839('0xa'));var querystring=require(_0xd839('0x10'));var Papa=require('papaparse');var Redis=require(_0xd839('0x11'));var authService=require(_0xd839('0x12'));var qs=require(_0xd839('0x13'));var as=require(_0xd839('0x14'));var hardwareService=require(_0xd839('0x15'));var logger=require(_0xd839('0x16'))('api');var utils=require(_0xd839('0x17'));var config=require(_0xd839('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd839('0x19'))['db'];function respondWithStatusCode(_0x36c7d8,_0x19030f){_0x19030f=_0x19030f||0xcc;return function(_0x2c9a95){if(_0x2c9a95){return _0x36c7d8[_0xd839('0x1a')](_0x19030f);}return _0x36c7d8[_0xd839('0x1b')](_0x19030f)[_0xd839('0x1c')]();};}function respondWithResult(_0x377d30,_0x5a0445){_0x5a0445=_0x5a0445||0xc8;return function(_0x53a493){if(_0x53a493){return _0x377d30['status'](_0x5a0445)['json'](_0x53a493);}};}function respondWithFilteredResult(_0x176921,_0x5250a4){return function(_0x26e73d){if(_0x26e73d){var _0x1c5df4=typeof _0x5250a4[_0xd839('0x1d')]===_0xd839('0x1e')&&typeof _0x5250a4[_0xd839('0x1f')]===_0xd839('0x1e');var _0x19b316=_0x26e73d['count'];var _0x53a198=_0x1c5df4?0x0:_0x5250a4[_0xd839('0x1d')];var _0x22dde8=_0x1c5df4?_0x26e73d[_0xd839('0x20')]:_0x5250a4['offset']+_0x5250a4[_0xd839('0x1f')];var _0x1e1a99;if(_0x22dde8>=_0x19b316){_0x22dde8=_0x19b316;_0x1e1a99=0xc8;}else{_0x1e1a99=0xce;}_0x176921[_0xd839('0x1b')](_0x1e1a99);return _0x176921[_0xd839('0x21')](_0xd839('0x22'),_0x53a198+'-'+_0x22dde8+'/'+_0x19b316)[_0xd839('0x23')](_0x26e73d);}return null;};}function patchUpdates(_0x2464ae){return function(_0x21a074){try{jsonpatch[_0xd839('0x24')](_0x21a074,_0x2464ae,!![]);}catch(_0x156029){return BPromise[_0xd839('0x25')](_0x156029);}return _0x21a074['save']();};}function saveUpdates(_0x1303c7,_0x20bc72){return function(_0x4f6f74){if(_0x4f6f74){return _0x4f6f74['update'](_0x1303c7)[_0xd839('0x26')](function(_0x344d21){return _0x344d21;});}return null;};}function removeEntity(_0x8f2a0a,_0x2880a8){return function(_0x1e6f2c){if(_0x1e6f2c){return _0x1e6f2c[_0xd839('0x27')]()[_0xd839('0x26')](function(){_0x8f2a0a[_0xd839('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6659,_0x38fccf){return function(_0x4f432b){if(!_0x4f432b){_0x1c6659[_0xd839('0x1a')](0x194);}return _0x4f432b;};}function handleError(_0x25c560,_0x100a2b){_0x100a2b=_0x100a2b||0x1f4;return function(_0xa61e77){logger['error'](_0xa61e77[_0xd839('0x28')]);if(_0xa61e77[_0xd839('0x29')]){delete _0xa61e77['name'];}_0x25c560['status'](_0x100a2b)['send'](_0xa61e77);};}exports['index']=function(_0x196d2b,_0x32e0ca){var _0x58e64e={},_0x2965da={},_0x383e68={'count':0x0,'rows':[]};var _0xbcafe0=_[_0xd839('0x2a')](db['Dynamics365Configuration']['rawAttributes'],function(_0x50d7b9){return{'name':_0x50d7b9[_0xd839('0x2b')],'type':_0x50d7b9[_0xd839('0x2c')][_0xd839('0x2d')]};});_0x2965da[_0xd839('0x2e')]=_[_0xd839('0x2a')](_0xbcafe0,_0xd839('0x29'));_0x2965da[_0xd839('0x2f')]=_[_0xd839('0x30')](_0x196d2b[_0xd839('0x2f')]);_0x2965da['filters']=_[_0xd839('0x31')](_0x2965da[_0xd839('0x2e')],_0x2965da['query']);_0x58e64e['attributes']=_[_0xd839('0x31')](_0x2965da[_0xd839('0x2e')],qs[_0xd839('0x32')](_0x196d2b[_0xd839('0x2f')]['fields']));_0x58e64e[_0xd839('0x33')]=_0x58e64e[_0xd839('0x33')][_0xd839('0x34')]?_0x58e64e[_0xd839('0x33')]:_0x2965da[_0xd839('0x2e')];if(!_0x196d2b['query'][_0xd839('0x35')](_0xd839('0x36'))){_0x58e64e['limit']=qs[_0xd839('0x1f')](_0x196d2b[_0xd839('0x2f')][_0xd839('0x1f')]);_0x58e64e[_0xd839('0x1d')]=qs[_0xd839('0x1d')](_0x196d2b[_0xd839('0x2f')][_0xd839('0x1d')]);}_0x58e64e[_0xd839('0x37')]=qs['sort'](_0x196d2b['query'][_0xd839('0x38')]);_0x58e64e[_0xd839('0x39')]=qs[_0xd839('0x3a')](_[_0xd839('0x3b')](_0x196d2b[_0xd839('0x2f')],_0x2965da[_0xd839('0x3a')]),_0xbcafe0);if(_0x196d2b[_0xd839('0x2f')][_0xd839('0x3c')]){_0x58e64e[_0xd839('0x39')]=_[_0xd839('0x3d')](_0x58e64e[_0xd839('0x39')],{'$or':_[_0xd839('0x2a')](_0xbcafe0,function(_0x503e7e){if(_0x503e7e[_0xd839('0x2c')]!==_0xd839('0x3e')){var _0x465e0a={};_0x465e0a[_0x503e7e[_0xd839('0x29')]]={'$like':'%'+_0x196d2b[_0xd839('0x2f')][_0xd839('0x3c')]+'%'};return _0x465e0a;}})});}_0x58e64e=_[_0xd839('0x3d')]({},_0x58e64e,_0x196d2b[_0xd839('0x3f')]);var _0x25a150={'where':_0x58e64e[_0xd839('0x39')]};return db[_0xd839('0x40')][_0xd839('0x20')](_0x25a150)['then'](function(_0x24af99){_0x383e68[_0xd839('0x20')]=_0x24af99;if(_0x196d2b[_0xd839('0x2f')]['includeAll']){_0x58e64e[_0xd839('0x41')]=[{'all':!![]}];}return db[_0xd839('0x40')]['findAll'](_0x58e64e);})[_0xd839('0x26')](function(_0x140ed2){_0x383e68[_0xd839('0x42')]=_0x140ed2;return _0x383e68;})[_0xd839('0x26')](respondWithFilteredResult(_0x32e0ca,_0x58e64e))[_0xd839('0x43')](handleError(_0x32e0ca,null));};exports['show']=function(_0x423ca7,_0x421a6e){var _0x2def8a={'raw':![],'where':{'id':_0x423ca7[_0xd839('0x44')]['id']}},_0x3ad3f4={};_0x3ad3f4[_0xd839('0x2e')]=_[_0xd839('0x30')](db[_0xd839('0x40')][_0xd839('0x45')]);_0x3ad3f4[_0xd839('0x2f')]=_[_0xd839('0x30')](_0x423ca7[_0xd839('0x2f')]);_0x3ad3f4[_0xd839('0x3a')]=_[_0xd839('0x31')](_0x3ad3f4[_0xd839('0x2e')],_0x3ad3f4[_0xd839('0x2f')]);_0x2def8a[_0xd839('0x33')]=_[_0xd839('0x31')](_0x3ad3f4['model'],qs[_0xd839('0x32')](_0x423ca7['query'][_0xd839('0x32')]));_0x2def8a[_0xd839('0x33')]=_0x2def8a[_0xd839('0x33')][_0xd839('0x34')]?_0x2def8a['attributes']:_0x3ad3f4['model'];if(_0x423ca7[_0xd839('0x2f')][_0xd839('0x46')]){_0x2def8a[_0xd839('0x41')]=[{'all':!![]}];}_0x2def8a=_[_0xd839('0x3d')]({},_0x2def8a,_0x423ca7[_0xd839('0x3f')]);return db['Dynamics365Configuration'][_0xd839('0x47')](_0x2def8a)[_0xd839('0x26')](handleEntityNotFound(_0x421a6e,null))[_0xd839('0x26')](respondWithResult(_0x421a6e,null))['catch'](handleError(_0x421a6e,null));};exports[_0xd839('0x48')]=function(_0x43b0b1,_0x3759d3){return db[_0xd839('0x40')][_0xd839('0x48')](_0x43b0b1['body'],{})[_0xd839('0x26')](respondWithResult(_0x3759d3,0xc9))[_0xd839('0x43')](handleError(_0x3759d3,null));};exports['update']=function(_0x1a00b8,_0x12ea3c){if(_0x1a00b8[_0xd839('0x49')]['id']){delete _0x1a00b8[_0xd839('0x49')]['id'];}return db[_0xd839('0x40')][_0xd839('0x47')]({'where':{'id':_0x1a00b8[_0xd839('0x44')]['id']}})[_0xd839('0x26')](handleEntityNotFound(_0x12ea3c,null))[_0xd839('0x26')](saveUpdates(_0x1a00b8[_0xd839('0x49')],null))['then'](respondWithResult(_0x12ea3c,null))[_0xd839('0x43')](handleError(_0x12ea3c,null));};exports[_0xd839('0x27')]=function(_0x1376ab,_0x35edc9){return db[_0xd839('0x40')][_0xd839('0x47')]({'where':{'id':_0x1376ab['params']['id']}})[_0xd839('0x26')](handleEntityNotFound(_0x35edc9,null))[_0xd839('0x26')](removeEntity(_0x35edc9,null))['catch'](handleError(_0x35edc9,null));};exports['getFields']=function(_0x477169,_0x3249ed,_0x1a434f){var _0x3595fd={};var _0x17e3ce={};var _0x152483;var _0x2a0cce;return db[_0xd839('0x40')]['findOne']({'where':{'id':_0x477169[_0xd839('0x44')]['id']}})[_0xd839('0x26')](handleEntityNotFound(_0x3249ed,null))['then'](function(_0x3ffede){if(_0x3ffede){_0x152483=_0x3ffede;_0x17e3ce[_0xd839('0x2e')]=_[_0xd839('0x30')](db[_0xd839('0x4a')][_0xd839('0x45')]);_0x17e3ce[_0xd839('0x2f')]=_[_0xd839('0x30')](_0x477169[_0xd839('0x2f')]);_0x17e3ce[_0xd839('0x3a')]=_['intersection'](_0x17e3ce[_0xd839('0x2e')],_0x17e3ce[_0xd839('0x2f')]);_0x3595fd[_0xd839('0x33')]=_['intersection'](_0x17e3ce[_0xd839('0x2e')],qs['fields'](_0x477169['query']['fields']));_0x3595fd[_0xd839('0x33')]=_0x3595fd[_0xd839('0x33')][_0xd839('0x34')]?_0x3595fd[_0xd839('0x33')]:_0x17e3ce['model'];_0x3595fd[_0xd839('0x37')]=qs[_0xd839('0x38')](_0x477169['query'][_0xd839('0x38')]);_0x3595fd[_0xd839('0x39')]=qs[_0xd839('0x3a')](_[_0xd839('0x3b')](_0x477169[_0xd839('0x2f')],_0x17e3ce['filters']));if(_0x477169[_0xd839('0x2f')][_0xd839('0x3c')]){_0x3595fd[_0xd839('0x39')]=_[_0xd839('0x3d')](_0x3595fd[_0xd839('0x39')],{'$or':_[_0xd839('0x2a')](_0x3595fd[_0xd839('0x33')],function(_0x5a002c){var _0x2b7edd={};_0x2b7edd[_0x5a002c]={'$like':'%'+_0x477169[_0xd839('0x2f')][_0xd839('0x3c')]+'%'};return _0x2b7edd;})});}_0x3595fd=_[_0xd839('0x3d')]({},_0x3595fd,_0x477169[_0xd839('0x3f')]);return _0x152483[_0xd839('0x4b')](_0x3595fd);}})[_0xd839('0x26')](function(_0x4c2003){if(_0x4c2003){_0x2a0cce=_0x4c2003[_0xd839('0x34')];if(!_0x477169[_0xd839('0x2f')]['hasOwnProperty'](_0xd839('0x36'))){_0x3595fd[_0xd839('0x1f')]=qs[_0xd839('0x1f')](_0x477169[_0xd839('0x2f')][_0xd839('0x1f')]);_0x3595fd[_0xd839('0x1d')]=qs[_0xd839('0x1d')](_0x477169[_0xd839('0x2f')][_0xd839('0x1d')]);}return _0x152483['getFields'](_0x3595fd);}})[_0xd839('0x26')](function(_0x17cda3){if(_0x17cda3){return _0x17cda3?{'count':_0x2a0cce,'rows':_0x17cda3}:null;}})['then'](respondWithResult(_0x3249ed,null))[_0xd839('0x43')](handleError(_0x3249ed,null));};exports[_0xd839('0x4c')]=function(_0x1311d9,_0x52408e,_0x38703d){var _0x672fab={};var _0x2324e6={};var _0x1cb603;var _0x5c04dd;return db[_0xd839('0x40')][_0xd839('0x4d')]({'where':{'id':_0x1311d9['params']['id']}})[_0xd839('0x26')](handleEntityNotFound(_0x52408e,null))['then'](function(_0x574d74){if(_0x574d74){_0x1cb603=_0x574d74;_0x2324e6[_0xd839('0x2e')]=_[_0xd839('0x30')](db['Dynamics365Field'][_0xd839('0x45')]);_0x2324e6['query']=_[_0xd839('0x30')](_0x1311d9[_0xd839('0x2f')]);_0x2324e6[_0xd839('0x3a')]=_[_0xd839('0x31')](_0x2324e6[_0xd839('0x2e')],_0x2324e6[_0xd839('0x2f')]);_0x672fab[_0xd839('0x33')]=_[_0xd839('0x31')](_0x2324e6[_0xd839('0x2e')],qs['fields'](_0x1311d9['query']['fields']));_0x672fab[_0xd839('0x33')]=_0x672fab['attributes'][_0xd839('0x34')]?_0x672fab[_0xd839('0x33')]:_0x2324e6['model'];_0x672fab[_0xd839('0x37')]=qs['sort'](_0x1311d9['query'][_0xd839('0x38')]);_0x672fab['where']=qs[_0xd839('0x3a')](_['pick'](_0x1311d9[_0xd839('0x2f')],_0x2324e6[_0xd839('0x3a')]));if(_0x1311d9[_0xd839('0x2f')][_0xd839('0x3c')]){_0x672fab[_0xd839('0x39')]=_['merge'](_0x672fab['where'],{'$or':_['map'](_0x672fab[_0xd839('0x33')],function(_0x2b1784){var _0x49b2e0={};_0x49b2e0[_0x2b1784]={'$like':'%'+_0x1311d9[_0xd839('0x2f')]['filter']+'%'};return _0x49b2e0;})});}_0x672fab=_[_0xd839('0x3d')]({},_0x672fab,_0x1311d9[_0xd839('0x3f')]);return _0x1cb603[_0xd839('0x4c')](_0x672fab);}})[_0xd839('0x26')](function(_0x57f61a){if(_0x57f61a){_0x5c04dd=_0x57f61a[_0xd839('0x34')];if(!_0x1311d9['query'][_0xd839('0x35')]('nolimit')){_0x672fab['limit']=qs[_0xd839('0x1f')](_0x1311d9[_0xd839('0x2f')][_0xd839('0x1f')]);_0x672fab[_0xd839('0x1d')]=qs[_0xd839('0x1d')](_0x1311d9[_0xd839('0x2f')][_0xd839('0x1d')]);}return _0x1cb603[_0xd839('0x4c')](_0x672fab);}})[_0xd839('0x26')](function(_0x44be83){if(_0x44be83){return _0x44be83?{'count':_0x5c04dd,'rows':_0x44be83}:null;}})[_0xd839('0x26')](respondWithResult(_0x52408e,null))['catch'](handleError(_0x52408e,null));};exports['getDescriptions']=function(_0x4a947c,_0x2005bd,_0x2b9fb8){var _0xeafe84={};var _0x331b7e={};var _0x562198;var _0x59052e;return db[_0xd839('0x40')]['findOne']({'where':{'id':_0x4a947c[_0xd839('0x44')]['id']}})[_0xd839('0x26')](handleEntityNotFound(_0x2005bd,null))['then'](function(_0x1827e8){if(_0x1827e8){_0x562198=_0x1827e8;_0x331b7e['model']=_['keys'](db[_0xd839('0x4a')][_0xd839('0x45')]);_0x331b7e[_0xd839('0x2f')]=_['keys'](_0x4a947c[_0xd839('0x2f')]);_0x331b7e['filters']=_[_0xd839('0x31')](_0x331b7e[_0xd839('0x2e')],_0x331b7e[_0xd839('0x2f')]);_0xeafe84[_0xd839('0x33')]=_[_0xd839('0x31')](_0x331b7e[_0xd839('0x2e')],qs[_0xd839('0x32')](_0x4a947c[_0xd839('0x2f')]['fields']));_0xeafe84[_0xd839('0x33')]=_0xeafe84['attributes']['length']?_0xeafe84[_0xd839('0x33')]:_0x331b7e[_0xd839('0x2e')];_0xeafe84['order']=qs[_0xd839('0x38')](_0x4a947c['query'][_0xd839('0x38')]);_0xeafe84['where']=qs[_0xd839('0x3a')](_[_0xd839('0x3b')](_0x4a947c[_0xd839('0x2f')],_0x331b7e[_0xd839('0x3a')]));if(_0x4a947c[_0xd839('0x2f')][_0xd839('0x3c')]){_0xeafe84[_0xd839('0x39')]=_[_0xd839('0x3d')](_0xeafe84['where'],{'$or':_[_0xd839('0x2a')](_0xeafe84[_0xd839('0x33')],function(_0x289934){var _0x3ac6a0={};_0x3ac6a0[_0x289934]={'$like':'%'+_0x4a947c['query'][_0xd839('0x3c')]+'%'};return _0x3ac6a0;})});}_0xeafe84=_[_0xd839('0x3d')]({},_0xeafe84,_0x4a947c['options']);return _0x562198[_0xd839('0x4e')](_0xeafe84);}})[_0xd839('0x26')](function(_0x35b8e8){if(_0x35b8e8){_0x59052e=_0x35b8e8[_0xd839('0x34')];if(!_0x4a947c[_0xd839('0x2f')][_0xd839('0x35')](_0xd839('0x36'))){_0xeafe84['limit']=qs[_0xd839('0x1f')](_0x4a947c[_0xd839('0x2f')][_0xd839('0x1f')]);_0xeafe84[_0xd839('0x1d')]=qs[_0xd839('0x1d')](_0x4a947c['query'][_0xd839('0x1d')]);}return _0x562198[_0xd839('0x4e')](_0xeafe84);}})[_0xd839('0x26')](function(_0x52d502){if(_0x52d502){return _0x52d502?{'count':_0x59052e,'rows':_0x52d502}:null;}})[_0xd839('0x26')](respondWithResult(_0x2005bd,null))['catch'](handleError(_0x2005bd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ef0317e..047787f 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0x35c346,_0x4e1854){var _0x27c140=function(_0x4fb135){while(--_0x4fb135){_0x35c346['push'](_0x35c346['shift']());}};_0x27c140(++_0x4e1854);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c8dbe,_0x3ce317){_0x4c8dbe=_0x4c8dbe-0x0;var _0x457be7=_0xedd9[_0x4c8dbe];return _0x457be7;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x187e48,_0x4a8cb8){var _0x4684a0=function(_0x53ff7d){while(--_0x53ff7d){_0x187e48['push'](_0x187e48['shift']());}};_0x4684a0(++_0x4a8cb8);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xb4e6[_0x576266];return _0x18234f;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 47cf112..a63a202 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 _0x5536=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2b2e63,_0x54773a){var _0xdf1ed1=function(_0x3b9382){while(--_0x3b9382){_0x2b2e63['push'](_0x2b2e63['shift']());}};_0xdf1ed1(++_0x54773a);}(_0x5536,0x1ce));var _0x6553=function(_0x49c10d,_0x5d47a4){_0x49c10d=_0x49c10d-0x0;var _0xc1f956=_0x5536[_0x49c10d];return _0xc1f956;};'use strict';var _=require(_0x6553('0x0'));var util=require(_0x6553('0x1'));var moment=require(_0x6553('0x2'));var BPromise=require(_0x6553('0x3'));var rs=require(_0x6553('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6553('0x5'))['db'];var utils=require(_0x6553('0x6'));var logger=require('../../config/logger')(_0x6553('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6553('0x8')][_0x6553('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58712a,_0x3f01ce,_0x2c18e6){return new BPromise(function(_0x18d75d,_0x1bccbd){return client[_0x6553('0xa')](_0x58712a,_0x2c18e6)[_0x6553('0xb')](function(_0x1a4770){logger[_0x6553('0xc')](_0x6553('0xd'),_0x3f01ce,_0x6553('0xe'));logger[_0x6553('0xf')](_0x6553('0x10'),_0x3f01ce,'request\x20sent',JSON['stringify'](_0x1a4770));if(_0x1a4770['error']){if(_0x1a4770[_0x6553('0x11')][_0x6553('0x12')]===0x1f4){logger[_0x6553('0x11')](_0x6553('0xd'),_0x3f01ce,_0x1a4770[_0x6553('0x11')][_0x6553('0x13')]);return _0x1bccbd(_0x1a4770[_0x6553('0x11')][_0x6553('0x13')]);}logger[_0x6553('0x11')](_0x6553('0xd'),_0x3f01ce,_0x1a4770[_0x6553('0x11')][_0x6553('0x13')]);return _0x18d75d(_0x1a4770['error'][_0x6553('0x13')]);}else{logger[_0x6553('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f01ce,_0x6553('0xe'));_0x18d75d(_0x1a4770[_0x6553('0x14')][_0x6553('0x13')]);}})[_0x6553('0x15')](function(_0x4c19bd){logger[_0x6553('0x11')](_0x6553('0xd'),_0x3f01ce,_0x4c19bd);_0x1bccbd(_0x4c19bd);});});} \ No newline at end of file +var _0x679e=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x679e,0xc0));var _0xe679=function(_0x2aff39,_0x3e33f4){_0x2aff39=_0x2aff39-0x0;var _0x11c030=_0x679e[_0x2aff39];return _0x11c030;};'use strict';var _=require(_0xe679('0x0'));var util=require(_0xe679('0x1'));var moment=require('moment');var BPromise=require(_0xe679('0x2'));var rs=require(_0xe679('0x3'));var fs=require('fs');var Redis=require(_0xe679('0x4'));var db=require(_0xe679('0x5'))['db'];var utils=require(_0xe679('0x6'));var logger=require(_0xe679('0x7'))(_0xe679('0x8'));var config=require(_0xe679('0x9'));var jayson=require(_0xe679('0xa'));var client=jayson[_0xe679('0xb')][_0xe679('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x352d75,_0x1b4f32,_0xb2332){return new BPromise(function(_0x303501,_0x4fa596){return client[_0xe679('0xd')](_0x352d75,_0xb2332)[_0xe679('0xe')](function(_0x51a7cb){logger['info'](_0xe679('0xf'),_0x1b4f32,_0xe679('0x10'));logger['debug'](_0xe679('0x11'),_0x1b4f32,'request\x20sent',JSON[_0xe679('0x12')](_0x51a7cb));if(_0x51a7cb[_0xe679('0x13')]){if(_0x51a7cb[_0xe679('0x13')][_0xe679('0x14')]===0x1f4){logger['error'](_0xe679('0xf'),_0x1b4f32,_0x51a7cb[_0xe679('0x13')][_0xe679('0x15')]);return _0x4fa596(_0x51a7cb[_0xe679('0x13')]['message']);}logger['error'](_0xe679('0xf'),_0x1b4f32,_0x51a7cb[_0xe679('0x13')]['message']);return _0x303501(_0x51a7cb['error'][_0xe679('0x15')]);}else{logger[_0xe679('0x16')](_0xe679('0xf'),_0x1b4f32,'request\x20sent');_0x303501(_0x51a7cb['result'][_0xe679('0x15')]);}})[_0xe679('0x17')](function(_0x3853b0){logger['error'](_0xe679('0xf'),_0x1b4f32,_0x3853b0);_0x4fa596(_0x3853b0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 62c10d7..9101265 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 _0x213b=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x213b,0x10c));var _0xb213=function(_0x4ccb47,_0x211cd9){_0x4ccb47=_0x4ccb47-0x0;var _0x3f96e6=_0x213b[_0x4ccb47];return _0x3f96e6;};'use strict';var multer=require(_0xb213('0x0'));var util=require(_0xb213('0x1'));var path=require(_0xb213('0x2'));var timeout=require(_0xb213('0x3'));var express=require(_0xb213('0x4'));var router=express[_0xb213('0x5')]();var fs_extra=require(_0xb213('0x6'));var auth=require(_0xb213('0x7'));var interaction=require(_0xb213('0x8'));var config=require(_0xb213('0x9'));var controller=require(_0xb213('0xa'));router[_0xb213('0xb')]('/',auth[_0xb213('0xc')](),controller[_0xb213('0xd')]);router[_0xb213('0xb')](_0xb213('0xe'),auth[_0xb213('0xc')](),controller[_0xb213('0xf')]);router[_0xb213('0x10')]('/',auth[_0xb213('0xc')](),controller[_0xb213('0x11')]);router[_0xb213('0x12')](_0xb213('0xe'),auth[_0xb213('0xc')](),controller[_0xb213('0x13')]);router[_0xb213('0x14')]('/:id',auth[_0xb213('0xc')](),controller[_0xb213('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0a24=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0xa028ff,_0x1716ba){var _0x1f93cd=function(_0x522933){while(--_0x522933){_0xa028ff['push'](_0xa028ff['shift']());}};_0x1f93cd(++_0x1716ba);}(_0x0a24,0xda));var _0x40a2=function(_0x482b06,_0x475ea9){_0x482b06=_0x482b06-0x0;var _0x404a0a=_0x0a24[_0x482b06];return _0x404a0a;};'use strict';var multer=require(_0x40a2('0x0'));var util=require(_0x40a2('0x1'));var path=require(_0x40a2('0x2'));var timeout=require(_0x40a2('0x3'));var express=require(_0x40a2('0x4'));var router=express[_0x40a2('0x5')]();var fs_extra=require(_0x40a2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x40a2('0x7'));var controller=require(_0x40a2('0x8'));router[_0x40a2('0x9')]('/',auth[_0x40a2('0xa')](),controller[_0x40a2('0xb')]);router[_0x40a2('0x9')](_0x40a2('0xc'),auth[_0x40a2('0xa')](),controller[_0x40a2('0xd')]);router['post']('/',auth[_0x40a2('0xa')](),controller[_0x40a2('0xe')]);router['put']('/:id',auth[_0x40a2('0xa')](),controller[_0x40a2('0xf')]);router[_0x40a2('0x10')](_0x40a2('0xc'),auth[_0x40a2('0xa')](),controller['destroy']);module[_0x40a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index cc379d2..01fe27b 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 _0xda86=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x37e310,_0x15ae87){var _0x52263a=function(_0x2b19aa){while(--_0x2b19aa){_0x37e310['push'](_0x37e310['shift']());}};_0x52263a(++_0x15ae87);}(_0xda86,0x1c6));var _0x6da8=function(_0x405de9,_0xfbcd61){_0x405de9=_0x405de9-0x0;var _0xc55f50=_0xda86[_0x405de9];return _0xc55f50;};'use strict';var Sequelize=require(_0x6da8('0x0'));module[_0x6da8('0x1')]={'type':{'type':Sequelize[_0x6da8('0x2')](_0x6da8('0x3'),_0x6da8('0x4'),'customVariable',_0x6da8('0x5'),_0x6da8('0x6')),'defaultValue':_0x6da8('0x3')},'content':{'type':Sequelize[_0x6da8('0x7')]},'key':{'type':Sequelize[_0x6da8('0x7')]},'keyType':{'type':Sequelize[_0x6da8('0x2')](_0x6da8('0x3'),_0x6da8('0x4'),_0x6da8('0x8'))},'keyContent':{'type':Sequelize[_0x6da8('0x7')]},'idField':{'type':Sequelize[_0x6da8('0x7')]},'nameField':{'type':Sequelize[_0x6da8('0x7')]},'customField':{'type':Sequelize[_0x6da8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x59cf=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x534d78,_0x508d3d){var _0x1b7c56=function(_0x34320f){while(--_0x34320f){_0x534d78['push'](_0x534d78['shift']());}};_0x1b7c56(++_0x508d3d);}(_0x59cf,0xf7));var _0xf59c=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x59cf[_0x51b1a5];return _0x15c738;};'use strict';var Sequelize=require(_0xf59c('0x0'));module[_0xf59c('0x1')]={'type':{'type':Sequelize[_0xf59c('0x2')](_0xf59c('0x3'),_0xf59c('0x4'),_0xf59c('0x5'),_0xf59c('0x6'),_0xf59c('0x7')),'defaultValue':_0xf59c('0x3')},'content':{'type':Sequelize[_0xf59c('0x8')]},'key':{'type':Sequelize[_0xf59c('0x8')]},'keyType':{'type':Sequelize[_0xf59c('0x2')]('string','variable',_0xf59c('0x5'))},'keyContent':{'type':Sequelize[_0xf59c('0x8')]},'idField':{'type':Sequelize[_0xf59c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf59c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf59c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f549b8f..ea7e221 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 _0xbcd8=['json','apply','reject','save','update','then','destroy','error','name','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0xbcd8,0x196));var _0x8bcd=function(_0x1e519f,_0x2fb7f2){_0x1e519f=_0x1e519f-0x0;var _0x37f095=_0xbcd8[_0x1e519f];return _0x37f095;};'use strict';var emlformat=require(_0x8bcd('0x0'));var rimraf=require(_0x8bcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bcd('0x2'));var rp=require('request-promise');var moment=require(_0x8bcd('0x3'));var BPromise=require(_0x8bcd('0x4'));var Mustache=require(_0x8bcd('0x5'));var util=require(_0x8bcd('0x6'));var path=require(_0x8bcd('0x7'));var sox=require(_0x8bcd('0x8'));var csv=require(_0x8bcd('0x9'));var ejs=require(_0x8bcd('0xa'));var fs=require('fs');var fs_extra=require(_0x8bcd('0xb'));var _=require(_0x8bcd('0xc'));var squel=require(_0x8bcd('0xd'));var crypto=require(_0x8bcd('0xe'));var jsforce=require(_0x8bcd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8bcd('0x9'));var querystring=require('querystring');var Papa=require(_0x8bcd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bcd('0x11'));var hardwareService=require(_0x8bcd('0x12'));var logger=require(_0x8bcd('0x13'))(_0x8bcd('0x14'));var utils=require(_0x8bcd('0x15'));var config=require(_0x8bcd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bcd('0x17'))['db'];function respondWithStatusCode(_0x46fd8f,_0x402ae2){_0x402ae2=_0x402ae2||0xcc;return function(_0x1e3e50){if(_0x1e3e50){return _0x46fd8f['sendStatus'](_0x402ae2);}return _0x46fd8f[_0x8bcd('0x18')](_0x402ae2)[_0x8bcd('0x19')]();};}function respondWithResult(_0x440a01,_0x1bb47d){_0x1bb47d=_0x1bb47d||0xc8;return function(_0x4acedd){if(_0x4acedd){return _0x440a01[_0x8bcd('0x18')](_0x1bb47d)['json'](_0x4acedd);}};}function respondWithFilteredResult(_0x859792,_0x2267c3){return function(_0x390ef8){if(_0x390ef8){var _0x9db54a=typeof _0x2267c3[_0x8bcd('0x1a')]==='undefined'&&typeof _0x2267c3['limit']===_0x8bcd('0x1b');var _0x776407=_0x390ef8[_0x8bcd('0x1c')];var _0x16c8b9=_0x9db54a?0x0:_0x2267c3[_0x8bcd('0x1a')];var _0x5cea5f=_0x9db54a?_0x390ef8[_0x8bcd('0x1c')]:_0x2267c3[_0x8bcd('0x1a')]+_0x2267c3[_0x8bcd('0x1d')];var _0x9e8826;if(_0x5cea5f>=_0x776407){_0x5cea5f=_0x776407;_0x9e8826=0xc8;}else{_0x9e8826=0xce;}_0x859792['status'](_0x9e8826);return _0x859792[_0x8bcd('0x1e')](_0x8bcd('0x1f'),_0x16c8b9+'-'+_0x5cea5f+'/'+_0x776407)[_0x8bcd('0x20')](_0x390ef8);}return null;};}function patchUpdates(_0x11b79e){return function(_0x3c8f7e){try{jsonpatch[_0x8bcd('0x21')](_0x3c8f7e,_0x11b79e,!![]);}catch(_0x547161){return BPromise[_0x8bcd('0x22')](_0x547161);}return _0x3c8f7e[_0x8bcd('0x23')]();};}function saveUpdates(_0x4a64b2,_0xbb9c99){return function(_0x5a272e){if(_0x5a272e){return _0x5a272e[_0x8bcd('0x24')](_0x4a64b2)[_0x8bcd('0x25')](function(_0x23657c){return _0x23657c;});}return null;};}function removeEntity(_0x4395ff,_0x195dd8){return function(_0x19a77c){if(_0x19a77c){return _0x19a77c[_0x8bcd('0x26')]()[_0x8bcd('0x25')](function(){_0x4395ff[_0x8bcd('0x18')](0xcc)[_0x8bcd('0x19')]();});}};}function handleEntityNotFound(_0x50f796,_0x4548af){return function(_0x41d841){if(!_0x41d841){_0x50f796['sendStatus'](0x194);}return _0x41d841;};}function handleError(_0x40927a,_0x45ce09){_0x45ce09=_0x45ce09||0x1f4;return function(_0x1a0bb0){logger[_0x8bcd('0x27')](_0x1a0bb0['stack']);if(_0x1a0bb0[_0x8bcd('0x28')]){delete _0x1a0bb0[_0x8bcd('0x28')];}_0x40927a[_0x8bcd('0x18')](_0x45ce09)['send'](_0x1a0bb0);};}exports[_0x8bcd('0x29')]=function(_0x3df2e4,_0x36d6e3){var _0x3663b4={},_0x4abf9d={},_0xbcd38f={'count':0x0,'rows':[]};var _0x4eeb42=_[_0x8bcd('0x2a')](db[_0x8bcd('0x2b')]['rawAttributes'],function(_0x24d3aa){return{'name':_0x24d3aa[_0x8bcd('0x2c')],'type':_0x24d3aa[_0x8bcd('0x2d')][_0x8bcd('0x2e')]};});_0x4abf9d[_0x8bcd('0x2f')]=_[_0x8bcd('0x2a')](_0x4eeb42,_0x8bcd('0x28'));_0x4abf9d[_0x8bcd('0x30')]=_[_0x8bcd('0x31')](_0x3df2e4[_0x8bcd('0x30')]);_0x4abf9d[_0x8bcd('0x32')]=_[_0x8bcd('0x33')](_0x4abf9d[_0x8bcd('0x2f')],_0x4abf9d['query']);_0x3663b4['attributes']=_[_0x8bcd('0x33')](_0x4abf9d['model'],qs[_0x8bcd('0x34')](_0x3df2e4['query'][_0x8bcd('0x34')]));_0x3663b4[_0x8bcd('0x35')]=_0x3663b4['attributes'][_0x8bcd('0x36')]?_0x3663b4['attributes']:_0x4abf9d['model'];if(!_0x3df2e4[_0x8bcd('0x30')][_0x8bcd('0x37')](_0x8bcd('0x38'))){_0x3663b4[_0x8bcd('0x1d')]=qs[_0x8bcd('0x1d')](_0x3df2e4[_0x8bcd('0x30')][_0x8bcd('0x1d')]);_0x3663b4[_0x8bcd('0x1a')]=qs[_0x8bcd('0x1a')](_0x3df2e4[_0x8bcd('0x30')][_0x8bcd('0x1a')]);}_0x3663b4[_0x8bcd('0x39')]=qs['sort'](_0x3df2e4[_0x8bcd('0x30')]['sort']);_0x3663b4[_0x8bcd('0x3a')]=qs['filters'](_[_0x8bcd('0x3b')](_0x3df2e4[_0x8bcd('0x30')],_0x4abf9d[_0x8bcd('0x32')]),_0x4eeb42);if(_0x3df2e4[_0x8bcd('0x30')][_0x8bcd('0x3c')]){_0x3663b4[_0x8bcd('0x3a')]=_['merge'](_0x3663b4[_0x8bcd('0x3a')],{'$or':_[_0x8bcd('0x2a')](_0x4eeb42,function(_0x235f9c){if(_0x235f9c[_0x8bcd('0x2d')]!=='VIRTUAL'){var _0xaa31b4={};_0xaa31b4[_0x235f9c['name']]={'$like':'%'+_0x3df2e4[_0x8bcd('0x30')]['filter']+'%'};return _0xaa31b4;}})});}_0x3663b4=_[_0x8bcd('0x3d')]({},_0x3663b4,_0x3df2e4[_0x8bcd('0x3e')]);var _0x3aa788={'where':_0x3663b4['where']};return db[_0x8bcd('0x2b')]['count'](_0x3aa788)[_0x8bcd('0x25')](function(_0x2340aa){_0xbcd38f[_0x8bcd('0x1c')]=_0x2340aa;if(_0x3df2e4[_0x8bcd('0x30')][_0x8bcd('0x3f')]){_0x3663b4[_0x8bcd('0x40')]=[{'all':!![]}];}return db[_0x8bcd('0x2b')][_0x8bcd('0x41')](_0x3663b4);})[_0x8bcd('0x25')](function(_0x2712e6){_0xbcd38f['rows']=_0x2712e6;return _0xbcd38f;})[_0x8bcd('0x25')](respondWithFilteredResult(_0x36d6e3,_0x3663b4))[_0x8bcd('0x42')](handleError(_0x36d6e3,null));};exports[_0x8bcd('0x43')]=function(_0x4556e3,_0x5ec6cb){var _0x540881={'raw':!![],'where':{'id':_0x4556e3[_0x8bcd('0x44')]['id']}},_0x4f98ac={};_0x4f98ac[_0x8bcd('0x2f')]=_[_0x8bcd('0x31')](db[_0x8bcd('0x2b')][_0x8bcd('0x45')]);_0x4f98ac['query']=_['keys'](_0x4556e3['query']);_0x4f98ac['filters']=_[_0x8bcd('0x33')](_0x4f98ac['model'],_0x4f98ac[_0x8bcd('0x30')]);_0x540881[_0x8bcd('0x35')]=_['intersection'](_0x4f98ac[_0x8bcd('0x2f')],qs[_0x8bcd('0x34')](_0x4556e3['query'][_0x8bcd('0x34')]));_0x540881[_0x8bcd('0x35')]=_0x540881[_0x8bcd('0x35')][_0x8bcd('0x36')]?_0x540881[_0x8bcd('0x35')]:_0x4f98ac[_0x8bcd('0x2f')];if(_0x4556e3['query'][_0x8bcd('0x3f')]){_0x540881[_0x8bcd('0x40')]=[{'all':!![]}];}_0x540881=_[_0x8bcd('0x3d')]({},_0x540881,_0x4556e3[_0x8bcd('0x3e')]);return db[_0x8bcd('0x2b')][_0x8bcd('0x46')](_0x540881)['then'](handleEntityNotFound(_0x5ec6cb,null))[_0x8bcd('0x25')](respondWithResult(_0x5ec6cb,null))['catch'](handleError(_0x5ec6cb,null));};exports['create']=function(_0x4c6c89,_0x1e57e4){return db[_0x8bcd('0x2b')][_0x8bcd('0x47')](_0x4c6c89[_0x8bcd('0x48')],{})[_0x8bcd('0x25')](respondWithResult(_0x1e57e4,0xc9))[_0x8bcd('0x42')](handleError(_0x1e57e4,null));};exports[_0x8bcd('0x24')]=function(_0x1014ac,_0x32eb6d){if(_0x1014ac['body']['id']){delete _0x1014ac[_0x8bcd('0x48')]['id'];}return db[_0x8bcd('0x2b')]['find']({'where':{'id':_0x1014ac[_0x8bcd('0x44')]['id']}})[_0x8bcd('0x25')](handleEntityNotFound(_0x32eb6d,null))[_0x8bcd('0x25')](saveUpdates(_0x1014ac['body'],null))[_0x8bcd('0x25')](respondWithResult(_0x32eb6d,null))[_0x8bcd('0x42')](handleError(_0x32eb6d,null));};exports[_0x8bcd('0x26')]=function(_0x2ce277,_0x55ac5e){return db[_0x8bcd('0x2b')][_0x8bcd('0x46')]({'where':{'id':_0x2ce277[_0x8bcd('0x44')]['id']}})['then'](handleEntityNotFound(_0x55ac5e,null))[_0x8bcd('0x25')](removeEntity(_0x55ac5e,null))[_0x8bcd('0x42')](handleError(_0x55ac5e,null));}; \ No newline at end of file +var _0xd6d2=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','send','map','Dynamics365Field','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xd6d2,0x86));var _0x2d6d=function(_0x24317b,_0x2c8925){_0x24317b=_0x24317b-0x0;var _0x41d9e7=_0xd6d2[_0x24317b];return _0x41d9e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d6d('0x0'));var zipdir=require(_0x2d6d('0x1'));var jsonpatch=require(_0x2d6d('0x2'));var rp=require(_0x2d6d('0x3'));var moment=require(_0x2d6d('0x4'));var BPromise=require(_0x2d6d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2d6d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d6d('0x7'));var fs=require('fs');var fs_extra=require(_0x2d6d('0x8'));var _=require('lodash');var squel=require(_0x2d6d('0x9'));var crypto=require(_0x2d6d('0xa'));var jsforce=require(_0x2d6d('0xb'));var deskjs=require(_0x2d6d('0xc'));var toCsv=require(_0x2d6d('0xd'));var querystring=require(_0x2d6d('0xe'));var Papa=require(_0x2d6d('0xf'));var Redis=require(_0x2d6d('0x10'));var authService=require(_0x2d6d('0x11'));var qs=require(_0x2d6d('0x12'));var as=require(_0x2d6d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2d6d('0x14'));var utils=require(_0x2d6d('0x15'));var config=require(_0x2d6d('0x16'));var licenseUtil=require(_0x2d6d('0x17'));var db=require(_0x2d6d('0x18'))['db'];function respondWithStatusCode(_0x87b011,_0x3a74f3){_0x3a74f3=_0x3a74f3||0xcc;return function(_0x439ab4){if(_0x439ab4){return _0x87b011[_0x2d6d('0x19')](_0x3a74f3);}return _0x87b011[_0x2d6d('0x1a')](_0x3a74f3)[_0x2d6d('0x1b')]();};}function respondWithResult(_0x5a0ffb,_0x14c15a){_0x14c15a=_0x14c15a||0xc8;return function(_0x19253d){if(_0x19253d){return _0x5a0ffb['status'](_0x14c15a)[_0x2d6d('0x1c')](_0x19253d);}};}function respondWithFilteredResult(_0x45b1c4,_0x36bc61){return function(_0x58d142){if(_0x58d142){var _0x2c8d3d=typeof _0x36bc61['offset']==='undefined'&&typeof _0x36bc61[_0x2d6d('0x1d')]===_0x2d6d('0x1e');var _0x3dc661=_0x58d142[_0x2d6d('0x1f')];var _0x5c94c3=_0x2c8d3d?0x0:_0x36bc61[_0x2d6d('0x20')];var _0x262cf4=_0x2c8d3d?_0x58d142['count']:_0x36bc61['offset']+_0x36bc61[_0x2d6d('0x1d')];var _0xa25a21;if(_0x262cf4>=_0x3dc661){_0x262cf4=_0x3dc661;_0xa25a21=0xc8;}else{_0xa25a21=0xce;}_0x45b1c4[_0x2d6d('0x1a')](_0xa25a21);return _0x45b1c4[_0x2d6d('0x21')](_0x2d6d('0x22'),_0x5c94c3+'-'+_0x262cf4+'/'+_0x3dc661)[_0x2d6d('0x1c')](_0x58d142);}return null;};}function patchUpdates(_0x33f191){return function(_0xe2eedc){try{jsonpatch[_0x2d6d('0x23')](_0xe2eedc,_0x33f191,!![]);}catch(_0x1c5a96){return BPromise[_0x2d6d('0x24')](_0x1c5a96);}return _0xe2eedc[_0x2d6d('0x25')]();};}function saveUpdates(_0x51ff54,_0x715ea5){return function(_0x1d97dd){if(_0x1d97dd){return _0x1d97dd['update'](_0x51ff54)[_0x2d6d('0x26')](function(_0x546636){return _0x546636;});}return null;};}function removeEntity(_0x2b1d4b,_0x2d332a){return function(_0x52ef58){if(_0x52ef58){return _0x52ef58[_0x2d6d('0x27')]()[_0x2d6d('0x26')](function(){_0x2b1d4b[_0x2d6d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f365,_0x4cee9e){return function(_0x320343){if(!_0x320343){_0x38f365[_0x2d6d('0x19')](0x194);}return _0x320343;};}function handleError(_0x1d21b0,_0x4be88c){_0x4be88c=_0x4be88c||0x1f4;return function(_0x2329de){logger['error'](_0x2329de[_0x2d6d('0x28')]);if(_0x2329de['name']){delete _0x2329de['name'];}_0x1d21b0[_0x2d6d('0x1a')](_0x4be88c)[_0x2d6d('0x29')](_0x2329de);};}exports['index']=function(_0x54c4e9,_0x53c081){var _0x4fc2ea={},_0x482840={},_0xa41723={'count':0x0,'rows':[]};var _0x528a1c=_[_0x2d6d('0x2a')](db[_0x2d6d('0x2b')]['rawAttributes'],function(_0x49f099){return{'name':_0x49f099['fieldName'],'type':_0x49f099[_0x2d6d('0x2c')][_0x2d6d('0x2d')]};});_0x482840[_0x2d6d('0x2e')]=_[_0x2d6d('0x2a')](_0x528a1c,_0x2d6d('0x2f'));_0x482840[_0x2d6d('0x30')]=_['keys'](_0x54c4e9['query']);_0x482840[_0x2d6d('0x31')]=_[_0x2d6d('0x32')](_0x482840[_0x2d6d('0x2e')],_0x482840[_0x2d6d('0x30')]);_0x4fc2ea['attributes']=_[_0x2d6d('0x32')](_0x482840['model'],qs[_0x2d6d('0x33')](_0x54c4e9[_0x2d6d('0x30')]['fields']));_0x4fc2ea[_0x2d6d('0x34')]=_0x4fc2ea[_0x2d6d('0x34')]['length']?_0x4fc2ea[_0x2d6d('0x34')]:_0x482840[_0x2d6d('0x2e')];if(!_0x54c4e9[_0x2d6d('0x30')][_0x2d6d('0x35')](_0x2d6d('0x36'))){_0x4fc2ea[_0x2d6d('0x1d')]=qs[_0x2d6d('0x1d')](_0x54c4e9[_0x2d6d('0x30')][_0x2d6d('0x1d')]);_0x4fc2ea[_0x2d6d('0x20')]=qs[_0x2d6d('0x20')](_0x54c4e9[_0x2d6d('0x30')][_0x2d6d('0x20')]);}_0x4fc2ea[_0x2d6d('0x37')]=qs[_0x2d6d('0x38')](_0x54c4e9['query'][_0x2d6d('0x38')]);_0x4fc2ea[_0x2d6d('0x39')]=qs[_0x2d6d('0x31')](_[_0x2d6d('0x3a')](_0x54c4e9[_0x2d6d('0x30')],_0x482840[_0x2d6d('0x31')]),_0x528a1c);if(_0x54c4e9[_0x2d6d('0x30')][_0x2d6d('0x3b')]){_0x4fc2ea[_0x2d6d('0x39')]=_[_0x2d6d('0x3c')](_0x4fc2ea['where'],{'$or':_['map'](_0x528a1c,function(_0xa13876){if(_0xa13876['type']!==_0x2d6d('0x3d')){var _0x3eed88={};_0x3eed88[_0xa13876[_0x2d6d('0x2f')]]={'$like':'%'+_0x54c4e9['query'][_0x2d6d('0x3b')]+'%'};return _0x3eed88;}})});}_0x4fc2ea=_['merge']({},_0x4fc2ea,_0x54c4e9[_0x2d6d('0x3e')]);var _0x43e908={'where':_0x4fc2ea[_0x2d6d('0x39')]};return db[_0x2d6d('0x2b')][_0x2d6d('0x1f')](_0x43e908)[_0x2d6d('0x26')](function(_0x4c1cec){_0xa41723[_0x2d6d('0x1f')]=_0x4c1cec;if(_0x54c4e9[_0x2d6d('0x30')][_0x2d6d('0x3f')]){_0x4fc2ea[_0x2d6d('0x40')]=[{'all':!![]}];}return db[_0x2d6d('0x2b')][_0x2d6d('0x41')](_0x4fc2ea);})[_0x2d6d('0x26')](function(_0x41fb8c){_0xa41723[_0x2d6d('0x42')]=_0x41fb8c;return _0xa41723;})['then'](respondWithFilteredResult(_0x53c081,_0x4fc2ea))['catch'](handleError(_0x53c081,null));};exports[_0x2d6d('0x43')]=function(_0x20ef1f,_0x15af30){var _0x344ad4={'raw':!![],'where':{'id':_0x20ef1f[_0x2d6d('0x44')]['id']}},_0x5e241d={};_0x5e241d[_0x2d6d('0x2e')]=_[_0x2d6d('0x45')](db[_0x2d6d('0x2b')][_0x2d6d('0x46')]);_0x5e241d[_0x2d6d('0x30')]=_['keys'](_0x20ef1f['query']);_0x5e241d['filters']=_[_0x2d6d('0x32')](_0x5e241d[_0x2d6d('0x2e')],_0x5e241d[_0x2d6d('0x30')]);_0x344ad4['attributes']=_[_0x2d6d('0x32')](_0x5e241d['model'],qs[_0x2d6d('0x33')](_0x20ef1f[_0x2d6d('0x30')][_0x2d6d('0x33')]));_0x344ad4['attributes']=_0x344ad4['attributes']['length']?_0x344ad4['attributes']:_0x5e241d['model'];if(_0x20ef1f['query'][_0x2d6d('0x3f')]){_0x344ad4[_0x2d6d('0x40')]=[{'all':!![]}];}_0x344ad4=_[_0x2d6d('0x3c')]({},_0x344ad4,_0x20ef1f[_0x2d6d('0x3e')]);return db[_0x2d6d('0x2b')][_0x2d6d('0x47')](_0x344ad4)[_0x2d6d('0x26')](handleEntityNotFound(_0x15af30,null))[_0x2d6d('0x26')](respondWithResult(_0x15af30,null))[_0x2d6d('0x48')](handleError(_0x15af30,null));};exports[_0x2d6d('0x49')]=function(_0x502585,_0x43e1f4){return db[_0x2d6d('0x2b')][_0x2d6d('0x49')](_0x502585[_0x2d6d('0x4a')],{})[_0x2d6d('0x26')](respondWithResult(_0x43e1f4,0xc9))[_0x2d6d('0x48')](handleError(_0x43e1f4,null));};exports[_0x2d6d('0x4b')]=function(_0x1d183e,_0x11ae62){if(_0x1d183e[_0x2d6d('0x4a')]['id']){delete _0x1d183e[_0x2d6d('0x4a')]['id'];}return db[_0x2d6d('0x2b')]['find']({'where':{'id':_0x1d183e[_0x2d6d('0x44')]['id']}})['then'](handleEntityNotFound(_0x11ae62,null))['then'](saveUpdates(_0x1d183e[_0x2d6d('0x4a')],null))['then'](respondWithResult(_0x11ae62,null))[_0x2d6d('0x48')](handleError(_0x11ae62,null));};exports[_0x2d6d('0x27')]=function(_0x597925,_0xf3cd1c){return db[_0x2d6d('0x2b')][_0x2d6d('0x47')]({'where':{'id':_0x597925[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x26')](handleEntityNotFound(_0xf3cd1c,null))[_0x2d6d('0x26')](removeEntity(_0xf3cd1c,null))[_0x2d6d('0x48')](handleError(_0xf3cd1c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f07dfad..34e1df6 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 _0xe3e4=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0xe3e4,0x85));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4e3e('0x0'));var util=require(_0x4e3e('0x1'));var logger=require(_0x4e3e('0x2'))(_0x4e3e('0x3'));var moment=require('moment');var BPromise=require(_0x4e3e('0x4'));var rp=require(_0x4e3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3e('0x6'));var config=require(_0x4e3e('0x7'));var attributes=require(_0x4e3e('0x8'));module[_0x4e3e('0x9')]=function(_0x8ec642,_0x116e39){return _0x8ec642['define'](_0x4e3e('0xa'),attributes,{'tableName':_0x4e3e('0xb'),'paranoid':![],'indexes':[{'name':_0x4e3e('0xc'),'fields':[_0x4e3e('0xd'),_0x4e3e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb28=['dynamics365_unique_index','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x140cb3,_0x183957){var _0x41c068=function(_0x17982d){while(--_0x17982d){_0x140cb3['push'](_0x140cb3['shift']());}};_0x41c068(++_0x183957);}(_0xcb28,0x120));var _0x8cb2=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xcb28[_0x1bf809];return _0x1caa4e;};'use strict';var _=require('lodash');var util=require(_0x8cb2('0x0'));var logger=require(_0x8cb2('0x1'))(_0x8cb2('0x2'));var moment=require(_0x8cb2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cb2('0x4'));var rimraf=require(_0x8cb2('0x5'));var config=require(_0x8cb2('0x6'));var attributes=require(_0x8cb2('0x7'));module[_0x8cb2('0x8')]=function(_0x1d6797,_0x53e5a4){return _0x1d6797['define'](_0x8cb2('0x9'),attributes,{'tableName':_0x8cb2('0xa'),'paranoid':![],'indexes':[{'name':_0x8cb2('0xb'),'fields':['idField',_0x8cb2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2f4045c..7192570 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 _0x6874=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x12cfe6,_0x153aee){var _0x34e26a=function(_0x3fde7b){while(--_0x3fde7b){_0x12cfe6['push'](_0x12cfe6['shift']());}};_0x34e26a(++_0x153aee);}(_0x6874,0x1de));var _0x4687=function(_0x2c8a10,_0x16a45c){_0x2c8a10=_0x2c8a10-0x0;var _0x188c29=_0x6874[_0x2c8a10];return _0x188c29;};'use strict';var _=require(_0x4687('0x0'));var util=require('util');var moment=require(_0x4687('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4687('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4687('0x3'));var logger=require(_0x4687('0x4'))('rpc');var config=require(_0x4687('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4687('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x408d85,_0x33a69d,_0x102021){return new BPromise(function(_0x2e3cf4,_0x2d12da){return client[_0x4687('0x7')](_0x408d85,_0x102021)[_0x4687('0x8')](function(_0x55c34f){logger[_0x4687('0x9')]('Dynamics365Field,\x20%s,\x20%s',_0x33a69d,_0x4687('0xa'));logger[_0x4687('0xb')](_0x4687('0xc'),_0x33a69d,_0x4687('0xa'),JSON[_0x4687('0xd')](_0x55c34f));if(_0x55c34f[_0x4687('0xe')]){if(_0x55c34f['error'][_0x4687('0xf')]===0x1f4){logger[_0x4687('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x33a69d,_0x55c34f[_0x4687('0xe')][_0x4687('0x10')]);return _0x2d12da(_0x55c34f[_0x4687('0xe')][_0x4687('0x10')]);}logger[_0x4687('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x33a69d,_0x55c34f[_0x4687('0xe')][_0x4687('0x10')]);return _0x2e3cf4(_0x55c34f['error']['message']);}else{logger['info'](_0x4687('0x11'),_0x33a69d,'request\x20sent');_0x2e3cf4(_0x55c34f[_0x4687('0x12')][_0x4687('0x10')]);}})[_0x4687('0x13')](function(_0x46e3d9){logger[_0x4687('0xe')](_0x4687('0x11'),_0x33a69d,_0x46e3d9);_0x2d12da(_0x46e3d9);});});} \ No newline at end of file +var _0x44aa=['stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x44aa,0xf9));var _0xa44a=function(_0x86e5ee,_0x1d8bd5){_0x86e5ee=_0x86e5ee-0x0;var _0x3a2f43=_0x44aa[_0x86e5ee];return _0x3a2f43;};'use strict';var _=require(_0xa44a('0x0'));var util=require('util');var moment=require(_0xa44a('0x1'));var BPromise=require(_0xa44a('0x2'));var rs=require(_0xa44a('0x3'));var fs=require('fs');var Redis=require(_0xa44a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa44a('0x5'));var logger=require('../../config/logger')(_0xa44a('0x6'));var config=require(_0xa44a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa44a('0x8')][_0xa44a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a5e2,_0x5e1633,_0x52e3d9){return new BPromise(function(_0x2c0867,_0x2ba963){return client[_0xa44a('0xa')](_0x35a5e2,_0x52e3d9)[_0xa44a('0xb')](function(_0x404fb5){logger[_0xa44a('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x5e1633,_0xa44a('0xd'));logger['debug'](_0xa44a('0xe'),_0x5e1633,_0xa44a('0xd'),JSON[_0xa44a('0xf')](_0x404fb5));if(_0x404fb5[_0xa44a('0x10')]){if(_0x404fb5['error'][_0xa44a('0x11')]===0x1f4){logger[_0xa44a('0x10')](_0xa44a('0x12'),_0x5e1633,_0x404fb5[_0xa44a('0x10')][_0xa44a('0x13')]);return _0x2ba963(_0x404fb5[_0xa44a('0x10')][_0xa44a('0x13')]);}logger[_0xa44a('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x5e1633,_0x404fb5[_0xa44a('0x10')][_0xa44a('0x13')]);return _0x2c0867(_0x404fb5[_0xa44a('0x10')]['message']);}else{logger['info'](_0xa44a('0x12'),_0x5e1633,_0xa44a('0xd'));_0x2c0867(_0x404fb5[_0xa44a('0x14')][_0xa44a('0x13')]);}})[_0xa44a('0x15')](function(_0x2e4c3f){logger[_0xa44a('0x10')](_0xa44a('0x12'),_0x5e1633,_0x2e4c3f);_0x2ba963(_0x2e4c3f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5cb155a..08f4399 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 _0x5ef3=['getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/configurations'];(function(_0xea1bcd,_0x465e08){var _0xfbe4c6=function(_0x4e20f1){while(--_0x4e20f1){_0xea1bcd['push'](_0xea1bcd['shift']());}};_0xfbe4c6(++_0x465e08);}(_0x5ef3,0x144));var _0x35ef=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x5ef3[_0x616290];return _0x453879;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35ef('0x0'));var timeout=require(_0x35ef('0x1'));var express=require(_0x35ef('0x2'));var router=express[_0x35ef('0x3')]();var fs_extra=require(_0x35ef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x35ef('0x5'));var config=require(_0x35ef('0x6'));var controller=require(_0x35ef('0x7'));router[_0x35ef('0x8')]('/',auth[_0x35ef('0x9')](),controller[_0x35ef('0xa')]);router['get']('/:id',auth[_0x35ef('0x9')](),controller['show']);router[_0x35ef('0x8')](_0x35ef('0xb'),auth[_0x35ef('0x9')](),controller['getConfigurations']);router[_0x35ef('0x8')]('/:id/fields',auth[_0x35ef('0x9')](),controller[_0x35ef('0xc')]);router[_0x35ef('0xd')]('/',auth[_0x35ef('0x9')](),controller[_0x35ef('0xe')]);router['post']('/:id/configurations',auth[_0x35ef('0x9')](),controller[_0x35ef('0xf')]);router[_0x35ef('0x10')](_0x35ef('0x11'),auth[_0x35ef('0x9')](),controller[_0x35ef('0x12')]);router['delete'](_0x35ef('0x11'),auth['isAuthenticated'](),controller[_0x35ef('0x13')]);module[_0x35ef('0x14')]=router; \ No newline at end of file +var _0x949a=['../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','/:id','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','create','delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2f08d9,_0x57ec33){var _0x2bfd42=function(_0x52f31a){while(--_0x52f31a){_0x2f08d9['push'](_0x2f08d9['shift']());}};_0x2bfd42(++_0x57ec33);}(_0x949a,0xd3));var _0xa949=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x949a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa949('0x0'));var timeout=require('connect-timeout');var express=require(_0xa949('0x1'));var router=express[_0xa949('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa949('0x3'));var interaction=require(_0xa949('0x4'));var config=require(_0xa949('0x5'));var controller=require(_0xa949('0x6'));router['get']('/',auth[_0xa949('0x7')](),controller['index']);router['get'](_0xa949('0x8'),auth[_0xa949('0x7')](),controller['show']);router['get'](_0xa949('0x9'),auth[_0xa949('0x7')](),controller[_0xa949('0xa')]);router[_0xa949('0xb')](_0xa949('0xc'),auth[_0xa949('0x7')](),controller[_0xa949('0xd')]);router[_0xa949('0xe')]('/',auth[_0xa949('0x7')](),controller[_0xa949('0xf')]);router[_0xa949('0xe')](_0xa949('0x9'),auth[_0xa949('0x7')](),controller['addConfiguration']);router['put'](_0xa949('0x8'),auth[_0xa949('0x7')](),controller['update']);router[_0xa949('0x10')](_0xa949('0x8'),auth[_0xa949('0x7')](),controller[_0xa949('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bfbaa8a..3a1526e 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 _0x0424=['username','STRING'];(function(_0x11afd1,_0x4d62ff){var _0x5e8b34=function(_0x77b8b7){while(--_0x77b8b7){_0x11afd1['push'](_0x11afd1['shift']());}};_0x5e8b34(++_0x4d62ff);}(_0x0424,0x159));var _0x4042=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x0424[_0xe89d97];return _0x1b6e5d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0598=['exports','STRING','sequelize'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0x0598,0x92));var _0x8059=function(_0x427d33,_0x140078){_0x427d33=_0x427d33-0x0;var _0x356eac=_0x0598[_0x427d33];return _0x356eac;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d3901a8..2e722ea 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 _0x58a4=['map','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x58a4,0xbf));var _0x458a=function(_0x516510,_0x48f18a){_0x516510=_0x516510-0x0;var _0x5c5246=_0x58a4[_0x516510];return _0x5c5246;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['FreshdeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['FreshdeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['FreshdeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','remoteUri',_0x458a('0x57')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))['then'](function(_0xdfc430){if(_0xdfc430){_0x3948aa=_0xdfc430[_0x458a('0x58')];var _0x350b73=_0x3948aa['slice'](-0x1);if(_0x350b73==='/'){_0x3948aa=_0x3948aa[_0x458a('0x59')](0x0,_0x3948aa[_0x458a('0x5a')](_0x350b73));}return rp({'method':_0x458a('0x5b'),'uri':util[_0x458a('0x5c')](_0x458a('0x5d'),_0x3948aa,_0x458a('0x5e')),'headers':{'Authorization':util['format'](_0x458a('0x5f'),new Buffer(util['format']('%s:X',_0xdfc430[_0x458a('0x57')]))[_0x458a('0x60')](_0x458a('0x61')))},'json':!![]});}})[_0x458a('0x27')](function(_0xaf6262){if(_0xaf6262){var _0x434d04=[_0x458a('0x62'),_0x458a('0x63'),_0x458a('0x64'),_0x458a('0x65'),_0x458a('0x1b'),_0x458a('0x66'),_0x458a('0x67'),_0x458a('0x68'),'ticket_type','group','company'];_[_0x458a('0x69')](_0xaf6262,function(_0x5c6a8d){return _0x434d04[_0x458a('0x6a')](_0x5c6a8d[_0x458a('0x2b')])||!_0x5c6a8d[_0x458a('0x6b')]&&_0x5c6a8d[_0x458a('0x2e')]!==_0x458a('0x6c')&&_0x5c6a8d[_0x458a('0x2e')]!==_0x458a('0x6d');});return{'count':_0xaf6262['length'],'rows':_[_0x458a('0x2d')](_0xaf6262,function(_0x15aecc){return{'id':_0x15aecc['name'],'name':_0x15aecc[_0x458a('0x6e')],'custom':!_0x15aecc['default'],'options':_0x15aecc[_0x458a('0x6f')]?_['map'](_0x15aecc[_0x458a('0x6f')],function(_0x177457){return{'name':_[_0x458a('0x70')](_0x177457),'value':_0x177457};}):[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))['catch'](function(_0x191872){var _0x14b95e=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x191872[_0x458a('0x72')]||0x1f4;logger[_0x458a('0x73')](_0x458a('0x74'),_0x458a('0x56'),_0x14b95e,JSON['stringify'](_0x191872));delete _0x191872[_0x458a('0x2b')];if(_0x14b95e===0x191){_0x14b95e=0x190;}_0x11bbba[_0x458a('0x1b')](_0x14b95e)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')]['test']?{'message':_0x458a('0x75'),'statusCode':_0x191872[_0x458a('0x72')]}:_0x191872);});}; \ No newline at end of file +var _0x282b=['test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','update','then','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','map','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize'];(function(_0x32b7b9,_0x3c7d41){var _0x39ba00=function(_0x476c68){while(--_0x476c68){_0x32b7b9['push'](_0x32b7b9['shift']());}};_0x39ba00(++_0x3c7d41);}(_0x282b,0xec));var _0xb282=function(_0x567757,_0x5f2d25){_0x567757=_0x567757-0x0;var _0x1d9651=_0x282b[_0x567757];return _0x1d9651;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xb282('0x17'));function respondWithStatusCode(_0xc08746,_0x40d7b8){_0x40d7b8=_0x40d7b8||0xcc;return function(_0x9e9072){if(_0x9e9072){return _0xc08746[_0xb282('0x18')](_0x40d7b8);}return _0xc08746['status'](_0x40d7b8)[_0xb282('0x19')]();};}function respondWithResult(_0x5adf7f,_0xe1d53){_0xe1d53=_0xe1d53||0xc8;return function(_0x211862){if(_0x211862){return _0x5adf7f['status'](_0xe1d53)['json'](_0x211862);}};}function respondWithFilteredResult(_0x5bc7c3,_0x13cea1){return function(_0x350676){if(_0x350676){var _0x7c20df=typeof _0x13cea1[_0xb282('0x1a')]===_0xb282('0x1b')&&typeof _0x13cea1['limit']===_0xb282('0x1b');var _0x5519bf=_0x350676[_0xb282('0x1c')];var _0x45b070=_0x7c20df?0x0:_0x13cea1[_0xb282('0x1a')];var _0x492d20=_0x7c20df?_0x350676['count']:_0x13cea1[_0xb282('0x1a')]+_0x13cea1[_0xb282('0x1d')];var _0x599f9e;if(_0x492d20>=_0x5519bf){_0x492d20=_0x5519bf;_0x599f9e=0xc8;}else{_0x599f9e=0xce;}_0x5bc7c3[_0xb282('0x1e')](_0x599f9e);return _0x5bc7c3[_0xb282('0x1f')](_0xb282('0x20'),_0x45b070+'-'+_0x492d20+'/'+_0x5519bf)[_0xb282('0x21')](_0x350676);}return null;};}function patchUpdates(_0x1c3084){return function(_0x533147){try{jsonpatch[_0xb282('0x22')](_0x533147,_0x1c3084,!![]);}catch(_0x16a656){return BPromise[_0xb282('0x23')](_0x16a656);}return _0x533147['save']();};}function saveUpdates(_0x437d66,_0x2a7ef8){return function(_0x3c55ad){if(_0x3c55ad){return _0x3c55ad[_0xb282('0x24')](_0x437d66)[_0xb282('0x25')](function(_0x56645f){return _0x56645f;});}return null;};}function removeEntity(_0x4d624f,_0x360f15){return function(_0x3c7f1f){if(_0x3c7f1f){return _0x3c7f1f['destroy']()['then'](function(){_0x4d624f[_0xb282('0x1e')](0xcc)[_0xb282('0x19')]();});}};}function handleEntityNotFound(_0x3451e5,_0x3c4018){return function(_0x211cc1){if(!_0x211cc1){_0x3451e5[_0xb282('0x18')](0x194);}return _0x211cc1;};}function handleError(_0x5b1d3d,_0xa0d7fb){_0xa0d7fb=_0xa0d7fb||0x1f4;return function(_0x42015c){logger['error'](_0x42015c[_0xb282('0x26')]);if(_0x42015c[_0xb282('0x27')]){delete _0x42015c[_0xb282('0x27')];}_0x5b1d3d[_0xb282('0x1e')](_0xa0d7fb)['send'](_0x42015c);};}exports[_0xb282('0x28')]=function(_0x1fb89f,_0xe337b8){var _0x433ad5={},_0x4cee93={},_0xfddd2e={'count':0x0,'rows':[]};var _0x22f657=_['map'](db[_0xb282('0x29')][_0xb282('0x2a')],function(_0x3eb294){return{'name':_0x3eb294[_0xb282('0x2b')],'type':_0x3eb294[_0xb282('0x2c')]['key']};});_0x4cee93[_0xb282('0x2d')]=_['map'](_0x22f657,_0xb282('0x27'));_0x4cee93[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1fb89f['query']);_0x4cee93[_0xb282('0x30')]=_['intersection'](_0x4cee93[_0xb282('0x2d')],_0x4cee93[_0xb282('0x2e')]);_0x433ad5[_0xb282('0x31')]=_[_0xb282('0x32')](_0x4cee93[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x1fb89f['query'][_0xb282('0x33')]));_0x433ad5[_0xb282('0x31')]=_0x433ad5['attributes']['length']?_0x433ad5[_0xb282('0x31')]:_0x4cee93[_0xb282('0x2d')];if(!_0x1fb89f[_0xb282('0x2e')]['hasOwnProperty']('nolimit')){_0x433ad5['limit']=qs[_0xb282('0x1d')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1d')]);_0x433ad5[_0xb282('0x1a')]=qs[_0xb282('0x1a')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1a')]);}_0x433ad5['order']=qs[_0xb282('0x34')](_0x1fb89f['query'][_0xb282('0x34')]);_0x433ad5[_0xb282('0x35')]=qs[_0xb282('0x30')](_['pick'](_0x1fb89f[_0xb282('0x2e')],_0x4cee93['filters']),_0x22f657);if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x36')]){_0x433ad5[_0xb282('0x35')]=_[_0xb282('0x37')](_0x433ad5['where'],{'$or':_['map'](_0x22f657,function(_0x397fa1){if(_0x397fa1[_0xb282('0x2c')]!==_0xb282('0x38')){var _0x20d56c={};_0x20d56c[_0x397fa1['name']]={'$like':'%'+_0x1fb89f[_0xb282('0x2e')]['filter']+'%'};return _0x20d56c;}})});}_0x433ad5=_[_0xb282('0x37')]({},_0x433ad5,_0x1fb89f[_0xb282('0x39')]);var _0x482ff9={'where':_0x433ad5[_0xb282('0x35')]};return db[_0xb282('0x29')][_0xb282('0x1c')](_0x482ff9)[_0xb282('0x25')](function(_0x3c1e6c){_0xfddd2e[_0xb282('0x1c')]=_0x3c1e6c;if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x3a')]){_0x433ad5[_0xb282('0x3b')]=[{'all':!![]}];}return db[_0xb282('0x29')][_0xb282('0x3c')](_0x433ad5);})[_0xb282('0x25')](function(_0x1caff0){_0xfddd2e[_0xb282('0x3d')]=_0x1caff0;return _0xfddd2e;})[_0xb282('0x25')](respondWithFilteredResult(_0xe337b8,_0x433ad5))[_0xb282('0x3e')](handleError(_0xe337b8,null));};exports[_0xb282('0x3f')]=function(_0x7332d2,_0x573da7){var _0x310ad1={'raw':![],'where':{'id':_0x7332d2[_0xb282('0x40')]['id']}},_0x58109a={};_0x58109a[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x29')][_0xb282('0x2a')]);_0x58109a[_0xb282('0x2e')]=_['keys'](_0x7332d2['query']);_0x58109a[_0xb282('0x30')]=_['intersection'](_0x58109a[_0xb282('0x2d')],_0x58109a[_0xb282('0x2e')]);_0x310ad1['attributes']=_[_0xb282('0x32')](_0x58109a[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x7332d2['query']['fields']));_0x310ad1[_0xb282('0x31')]=_0x310ad1['attributes'][_0xb282('0x41')]?_0x310ad1[_0xb282('0x31')]:_0x58109a[_0xb282('0x2d')];if(_0x7332d2[_0xb282('0x2e')][_0xb282('0x3a')]){_0x310ad1[_0xb282('0x3b')]=[{'all':!![]}];}_0x310ad1=_['merge']({},_0x310ad1,_0x7332d2[_0xb282('0x39')]);return db[_0xb282('0x29')][_0xb282('0x42')](_0x310ad1)['then'](handleEntityNotFound(_0x573da7,null))[_0xb282('0x25')](respondWithResult(_0x573da7,null))['catch'](handleError(_0x573da7,null));};exports[_0xb282('0x43')]=function(_0x4b0822,_0x1bf51c){return db['FreshdeskAccount']['create'](_0x4b0822['body'],{})[_0xb282('0x25')](respondWithResult(_0x1bf51c,0xc9))[_0xb282('0x3e')](handleError(_0x1bf51c,null));};exports[_0xb282('0x24')]=function(_0x7a5aa4,_0x4a2d0e){if(_0x7a5aa4['body']['id']){delete _0x7a5aa4['body']['id'];}return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x7a5aa4[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x4a2d0e,null))['then'](saveUpdates(_0x7a5aa4[_0xb282('0x44')],null))[_0xb282('0x25')](respondWithResult(_0x4a2d0e,null))['catch'](handleError(_0x4a2d0e,null));};exports[_0xb282('0x45')]=function(_0x9f4d79,_0x16f66b){return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x9f4d79['params']['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x16f66b,null))[_0xb282('0x25')](removeEntity(_0x16f66b,null))[_0xb282('0x3e')](handleError(_0x16f66b,null));};exports[_0xb282('0x46')]=function(_0x308aa8,_0x112d4d,_0x4cde65){var _0x87d777={};var _0x574653={};var _0x4554f1;var _0x1e6ade;return db['FreshdeskAccount'][_0xb282('0x47')]({'where':{'id':_0x308aa8[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x112d4d,null))['then'](function(_0x51cbb0){if(_0x51cbb0){_0x4554f1=_0x51cbb0;_0x574653[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x48')]['rawAttributes']);_0x574653[_0xb282('0x2e')]=_['keys'](_0x308aa8[_0xb282('0x2e')]);_0x574653[_0xb282('0x30')]=_['intersection'](_0x574653[_0xb282('0x2d')],_0x574653['query']);_0x87d777[_0xb282('0x31')]=_[_0xb282('0x32')](_0x574653[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x33')]));_0x87d777['attributes']=_0x87d777[_0xb282('0x31')]['length']?_0x87d777[_0xb282('0x31')]:_0x574653[_0xb282('0x2d')];_0x87d777['order']=qs['sort'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x34')]);_0x87d777[_0xb282('0x35')]=qs['filters'](_['pick'](_0x308aa8[_0xb282('0x2e')],_0x574653[_0xb282('0x30')]));if(_0x308aa8[_0xb282('0x2e')]['filter']){_0x87d777[_0xb282('0x35')]=_['merge'](_0x87d777[_0xb282('0x35')],{'$or':_[_0xb282('0x49')](_0x87d777[_0xb282('0x31')],function(_0x27bac8){var _0x178b6a={};_0x178b6a[_0x27bac8]={'$like':'%'+_0x308aa8[_0xb282('0x2e')][_0xb282('0x36')]+'%'};return _0x178b6a;})});}_0x87d777=_['merge']({},_0x87d777,_0x308aa8[_0xb282('0x39')]);return _0x4554f1[_0xb282('0x46')](_0x87d777);}})[_0xb282('0x25')](function(_0x58116b){if(_0x58116b){_0x1e6ade=_0x58116b['length'];if(!_0x308aa8[_0xb282('0x2e')][_0xb282('0x4a')](_0xb282('0x4b'))){_0x87d777['limit']=qs['limit'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1d')]);_0x87d777['offset']=qs[_0xb282('0x1a')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1a')]);}return _0x4554f1['getConfigurations'](_0x87d777);}})[_0xb282('0x25')](function(_0x2fb4e4){if(_0x2fb4e4){return _0x2fb4e4?{'count':_0x1e6ade,'rows':_0x2fb4e4}:null;}})['then'](respondWithResult(_0x112d4d,null))[_0xb282('0x3e')](handleError(_0x112d4d,null));};exports[_0xb282('0x4c')]=function(_0x33b5ec,_0x26c9a6,_0x4ea7a6){if(_0x33b5ec['body']['id']){delete _0x33b5ec[_0xb282('0x44')]['id'];}return db[_0xb282('0x29')]['findOne']({'where':{'id':_0x33b5ec[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x26c9a6,null))[_0xb282('0x25')](function(_0x364b77){if(_0x364b77){_0x33b5ec[_0xb282('0x44')][_0xb282('0x4d')]=_0x364b77['id'];_0x33b5ec[_0xb282('0x44')][_0xb282('0x4e')]=integrations['getSubjects'](_0x33b5ec[_0xb282('0x44')][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')]['type']);_0x33b5ec[_0xb282('0x44')][_0xb282('0x50')]=integrations['getDescriptions'](_0x33b5ec['body'][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')][_0xb282('0x2c')]);return db[_0xb282('0x48')][_0xb282('0x43')](_0x33b5ec[_0xb282('0x44')],{'include':[{'model':db[_0xb282('0x51')],'as':_0xb282('0x4e')},{'model':db[_0xb282('0x51')],'as':_0xb282('0x50')}]});}return null;})[_0xb282('0x25')](respondWithResult(_0x26c9a6,null))[_0xb282('0x3e')](handleError(_0x26c9a6,null));};exports[_0xb282('0x52')]=function(_0x2eae62,_0x3c1579,_0x3a87ce){var _0x4ccef5='';return db[_0xb282('0x29')][_0xb282('0x47')]({'where':{'id':_0x2eae62[_0xb282('0x40')]['id']},'attributes':['id',_0xb282('0x53'),_0xb282('0x54')]})[_0xb282('0x25')](handleEntityNotFound(_0x3c1579,null))[_0xb282('0x25')](function(_0x39859d){if(_0x39859d){_0x4ccef5=_0x39859d[_0xb282('0x53')];var _0x2d237e=_0x4ccef5[_0xb282('0x55')](-0x1);if(_0x2d237e==='/'){_0x4ccef5=_0x4ccef5['substring'](0x0,_0x4ccef5[_0xb282('0x56')](_0x2d237e));}return rp({'method':_0xb282('0x57'),'uri':util[_0xb282('0x58')](_0xb282('0x59'),_0x4ccef5,_0xb282('0x5a')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xb282('0x58')](_0xb282('0x5b'),_0x39859d[_0xb282('0x54')]))[_0xb282('0x5c')](_0xb282('0x5d')))},'json':!![]});}})[_0xb282('0x25')](function(_0x308050){if(_0x308050){var _0x4df661=['requester',_0xb282('0x5e'),_0xb282('0x5f'),'description','status',_0xb282('0x60'),_0xb282('0x61'),_0xb282('0x62'),_0xb282('0x63'),_0xb282('0x61'),_0xb282('0x64')];_[_0xb282('0x65')](_0x308050,function(_0x502447){return _0x4df661[_0xb282('0x66')](_0x502447[_0xb282('0x27')])||!_0x502447[_0xb282('0x67')]&&_0x502447[_0xb282('0x2c')]!==_0xb282('0x68')&&_0x502447[_0xb282('0x2c')]!==_0xb282('0x69');});return{'count':_0x308050[_0xb282('0x41')],'rows':_[_0xb282('0x49')](_0x308050,function(_0x222203){return{'id':_0x222203['name'],'name':_0x222203[_0xb282('0x6a')],'custom':!_0x222203[_0xb282('0x67')],'options':_0x222203[_0xb282('0x6b')]?_[_0xb282('0x49')](_0x222203[_0xb282('0x6b')],function(_0xb1394f){return{'name':_[_0xb282('0x6c')](_0xb1394f),'value':_0xb1394f};}):[]};})};}})[_0xb282('0x25')](respondWithResult(_0x3c1579,null))['catch'](function(_0x199c02){var _0x400f2a=_0x2eae62[_0xb282('0x2e')][_0xb282('0x6d')]?0x1f4:_0x199c02[_0xb282('0x6e')]||0x1f4;logger[_0xb282('0x6f')]('getFields,\x20%s,\x20%s,\x20%s',_0xb282('0x52'),_0x400f2a,JSON[_0xb282('0x70')](_0x199c02));delete _0x199c02[_0xb282('0x27')];if(_0x400f2a===0x191){_0x400f2a=0x190;}_0x3c1579['status'](_0x400f2a)[_0xb282('0x71')](_0x2eae62[_0xb282('0x2e')]['test']?{'message':_0xb282('0x72'),'statusCode':_0x199c02[_0xb282('0x6e')]}:_0x199c02);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4e416da..c5e0ca7 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 _0x715b=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4bf75f,_0xc67dbb){var _0x5b19ed=function(_0x3bc2f1){while(--_0x3bc2f1){_0x4bf75f['push'](_0x4bf75f['shift']());}};_0x5b19ed(++_0xc67dbb);}(_0x715b,0xc9));var _0xb715=function(_0x35eb4d,_0x5ad333){_0x35eb4d=_0x35eb4d-0x0;var _0x453e40=_0x715b[_0x35eb4d];return _0x453e40;};'use strict';var _=require(_0xb715('0x0'));var util=require(_0xb715('0x1'));var logger=require(_0xb715('0x2'))(_0xb715('0x3'));var moment=require(_0xb715('0x4'));var BPromise=require(_0xb715('0x5'));var rp=require(_0xb715('0x6'));var fs=require('fs');var path=require(_0xb715('0x7'));var rimraf=require(_0xb715('0x8'));var config=require(_0xb715('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb715('0xa'));module[_0xb715('0xb')]=function(_0x51f8ef,_0x3c023e){return _0x51f8ef['define'](_0xb715('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf3e=['exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x40e186,_0x2ccc80){var _0x913afd=function(_0xe11092){while(--_0xe11092){_0x40e186['push'](_0x40e186['shift']());}};_0x913afd(++_0x2ccc80);}(_0xbf3e,0xd5));var _0xebf3=function(_0x78de6d,_0x29bff3){_0x78de6d=_0x78de6d-0x0;var _0x1f9f64=_0xbf3e[_0x78de6d];return _0x1f9f64;};'use strict';var _=require(_0xebf3('0x0'));var util=require(_0xebf3('0x1'));var logger=require(_0xebf3('0x2'))(_0xebf3('0x3'));var moment=require(_0xebf3('0x4'));var BPromise=require(_0xebf3('0x5'));var rp=require(_0xebf3('0x6'));var fs=require('fs');var path=require(_0xebf3('0x7'));var rimraf=require(_0xebf3('0x8'));var config=require('../../config/environment');var attributes=require(_0xebf3('0x9'));var integrations=require(_0xebf3('0xa'));module[_0xebf3('0xb')]=function(_0x196071,_0x159cd4){return _0x196071[_0xebf3('0xc')](_0xebf3('0xd'),attributes,{'tableName':'int_freshdesk_accounts','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 ff35dcf..b528068 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 _0xca0e=['then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','findAll','options','raw','limit','include','attributes','map','model','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x308408,_0x37d440){var _0x9dc073=function(_0x29f0c9){while(--_0x29f0c9){_0x308408['push'](_0x308408['shift']());}};_0x9dc073(++_0x37d440);}(_0xca0e,0x1d5));var _0xeca0=function(_0x23fab7,_0x554232){_0x23fab7=_0x23fab7-0x0;var _0x472bd5=_0xca0e[_0x23fab7];return _0x472bd5;};'use strict';var _=require('lodash');var util=require(_0xeca0('0x0'));var moment=require(_0xeca0('0x1'));var BPromise=require(_0xeca0('0x2'));var rs=require(_0xeca0('0x3'));var fs=require('fs');var Redis=require(_0xeca0('0x4'));var db=require(_0xeca0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeca0('0x6'));var config=require(_0xeca0('0x7'));var jayson=require(_0xeca0('0x8'));var client=jayson[_0xeca0('0x9')][_0xeca0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bff4,_0x5479d7,_0x53da56){return new BPromise(function(_0x7544f5,_0xb13abc){return client[_0xeca0('0xb')](_0x37bff4,_0x53da56)[_0xeca0('0xc')](function(_0x3c2021){logger[_0xeca0('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x5479d7,_0xeca0('0xe'));logger[_0xeca0('0xf')](_0xeca0('0x10'),_0x5479d7,_0xeca0('0xe'),JSON['stringify'](_0x3c2021));if(_0x3c2021['error']){if(_0x3c2021[_0xeca0('0x11')][_0xeca0('0x12')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x5479d7,_0x3c2021['error'][_0xeca0('0x13')]);return _0xb13abc(_0x3c2021[_0xeca0('0x11')][_0xeca0('0x13')]);}logger[_0xeca0('0x11')](_0xeca0('0x14'),_0x5479d7,_0x3c2021[_0xeca0('0x11')][_0xeca0('0x13')]);return _0x7544f5(_0x3c2021[_0xeca0('0x11')]['message']);}else{logger[_0xeca0('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x5479d7,'request\x20sent');_0x7544f5(_0x3c2021[_0xeca0('0x15')][_0xeca0('0x13')]);}})[_0xeca0('0x16')](function(_0x21c4db){logger[_0xeca0('0x11')](_0xeca0('0x14'),_0x5479d7,_0x21c4db);_0xb13abc(_0x21c4db);});});}exports['GetFreshdeskAccount']=function(_0x5e0ccc){var _0x502ad1=this;return new Promise(function(_0x2ebde4,_0x7a08f6){return db['FreshdeskAccount'][_0xeca0('0x17')]({'raw':_0x5e0ccc[_0xeca0('0x18')]?_0x5e0ccc[_0xeca0('0x18')][_0xeca0('0x19')]===undefined?!![]:![]:!![],'where':_0x5e0ccc[_0xeca0('0x18')]?_0x5e0ccc[_0xeca0('0x18')]['where']||null:null,'attributes':_0x5e0ccc[_0xeca0('0x18')]?_0x5e0ccc[_0xeca0('0x18')]['attributes']||null:null,'limit':_0x5e0ccc['options']?_0x5e0ccc[_0xeca0('0x18')][_0xeca0('0x1a')]||null:null,'include':_0x5e0ccc[_0xeca0('0x18')]?_0x5e0ccc[_0xeca0('0x18')]['include']?_['map'](_0x5e0ccc[_0xeca0('0x18')][_0xeca0('0x1b')],function(_0xd53e06){return{'model':db[_0xd53e06['model']],'as':_0xd53e06['as'],'attributes':_0xd53e06[_0xeca0('0x1c')],'include':_0xd53e06[_0xeca0('0x1b')]?_['map'](_0xd53e06[_0xeca0('0x1b')],function(_0x52ef02){return{'model':db[_0x52ef02['model']],'as':_0x52ef02['as'],'attributes':_0x52ef02[_0xeca0('0x1c')],'include':_0x52ef02[_0xeca0('0x1b')]?_[_0xeca0('0x1d')](_0x52ef02['include'],function(_0x4f864a){return{'model':db[_0x4f864a[_0xeca0('0x1e')]],'as':_0x4f864a['as'],'attributes':_0x4f864a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3beacc){logger[_0xeca0('0xd')](_0xeca0('0x1f'),_0x5e0ccc);logger[_0xeca0('0xf')](_0xeca0('0x1f'),_0x5e0ccc,JSON[_0xeca0('0x20')](_0x3beacc));_0x2ebde4(_0x3beacc);})[_0xeca0('0x16')](function(_0x1c667d){logger[_0xeca0('0x11')](_0xeca0('0x1f'),_0x1c667d[_0xeca0('0x13')],_0x5e0ccc);_0x7a08f6(_0x502ad1[_0xeca0('0x11')](0x1f4,_0x1c667d['message']));});});};exports[_0xeca0('0x21')]=function(_0x2931d9){var _0x9c4b27=this;return new Promise(function(_0x2f4aec,_0x3c0ea1){return db[_0xeca0('0x22')][_0xeca0('0x23')]({'raw':_0x2931d9[_0xeca0('0x18')]?_0x2931d9[_0xeca0('0x18')][_0xeca0('0x19')]===undefined?!![]:![]:!![],'where':_0x2931d9[_0xeca0('0x18')]?_0x2931d9[_0xeca0('0x18')][_0xeca0('0x24')]||null:null,'attributes':_0x2931d9['options']?_0x2931d9['options'][_0xeca0('0x1c')]||null:null,'include':_0x2931d9['options']?_0x2931d9['options'][_0xeca0('0x1b')]?_[_0xeca0('0x1d')](_0x2931d9[_0xeca0('0x18')][_0xeca0('0x1b')],function(_0xd036ab){return{'model':db[_0xd036ab['model']],'as':_0xd036ab['as'],'attributes':_0xd036ab[_0xeca0('0x1c')],'include':_0xd036ab[_0xeca0('0x1b')]?_[_0xeca0('0x1d')](_0xd036ab[_0xeca0('0x1b')],function(_0x542d05){return{'model':db[_0x542d05[_0xeca0('0x1e')]],'as':_0x542d05['as'],'attributes':_0x542d05['attributes'],'include':_0x542d05[_0xeca0('0x1b')]?_[_0xeca0('0x1d')](_0x542d05['include'],function(_0x2a93ed){return{'model':db[_0x2a93ed[_0xeca0('0x1e')]],'as':_0x2a93ed['as'],'attributes':_0x2a93ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20dccf){logger[_0xeca0('0xd')](_0xeca0('0x21'),_0x2931d9);logger['debug'](_0xeca0('0x21'),_0x2931d9,JSON['stringify'](_0x20dccf));_0x2f4aec(_0x20dccf);})['catch'](function(_0x5cabea){logger['error'](_0xeca0('0x21'),_0x5cabea[_0xeca0('0x13')],_0x2931d9);_0x3c0ea1(_0x9c4b27['error'](0x1f4,_0x5cabea[_0xeca0('0x13')]));});});}; \ No newline at end of file +var _0x34f8=['where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34f8,0xbc));var _0x834f=function(_0x482141,_0xeac92f){_0x482141=_0x482141-0x0;var _0x5c83f3=_0x34f8[_0x482141];return _0x5c83f3;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require('moment');var BPromise=require(_0x834f('0x2'));var rs=require(_0x834f('0x3'));var fs=require('fs');var Redis=require(_0x834f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))(_0x834f('0x7'));var config=require(_0x834f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341f3d,_0x22fb2,_0x559443){return new BPromise(function(_0x2ea0d6,_0x4f5627){return client[_0x834f('0xb')](_0x341f3d,_0x559443)[_0x834f('0xc')](function(_0x48b723){logger['info'](_0x834f('0xd'),_0x22fb2,_0x834f('0xe'));logger[_0x834f('0xf')](_0x834f('0x10'),_0x22fb2,_0x834f('0xe'),JSON[_0x834f('0x11')](_0x48b723));if(_0x48b723[_0x834f('0x12')]){if(_0x48b723['error'][_0x834f('0x13')]===0x1f4){logger[_0x834f('0x12')](_0x834f('0xd'),_0x22fb2,_0x48b723['error'][_0x834f('0x14')]);return _0x4f5627(_0x48b723[_0x834f('0x12')][_0x834f('0x14')]);}logger[_0x834f('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x22fb2,_0x48b723['error'][_0x834f('0x14')]);return _0x2ea0d6(_0x48b723['error'][_0x834f('0x14')]);}else{logger[_0x834f('0x15')](_0x834f('0xd'),_0x22fb2,_0x834f('0xe'));_0x2ea0d6(_0x48b723[_0x834f('0x16')][_0x834f('0x14')]);}})[_0x834f('0x17')](function(_0x2c5768){logger['error'](_0x834f('0xd'),_0x22fb2,_0x2c5768);_0x4f5627(_0x2c5768);});});}exports[_0x834f('0x18')]=function(_0x4eb572){var _0x3e8ff6=this;return new Promise(function(_0x2722e6,_0x7788a1){return db[_0x834f('0x19')]['findAll']({'raw':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1c')]||null:null,'attributes':_0x4eb572['options']?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1d')]||null:null,'limit':_0x4eb572[_0x834f('0x1a')]?_0x4eb572[_0x834f('0x1a')][_0x834f('0x1e')]||null:null,'include':_0x4eb572[_0x834f('0x1a')]?_0x4eb572['options'][_0x834f('0x1f')]?_[_0x834f('0x20')](_0x4eb572[_0x834f('0x1a')][_0x834f('0x1f')],function(_0x48ba80){return{'model':db[_0x48ba80[_0x834f('0x21')]],'as':_0x48ba80['as'],'attributes':_0x48ba80[_0x834f('0x1d')],'include':_0x48ba80[_0x834f('0x1f')]?_['map'](_0x48ba80['include'],function(_0x4b9fb2){return{'model':db[_0x4b9fb2[_0x834f('0x21')]],'as':_0x4b9fb2['as'],'attributes':_0x4b9fb2[_0x834f('0x1d')],'include':_0x4b9fb2[_0x834f('0x1f')]?_[_0x834f('0x20')](_0x4b9fb2[_0x834f('0x1f')],function(_0x393b66){return{'model':db[_0x393b66[_0x834f('0x21')]],'as':_0x393b66['as'],'attributes':_0x393b66[_0x834f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x834f('0xc')](function(_0x459ab4){logger['info'](_0x834f('0x18'),_0x4eb572);logger['debug']('GetFreshdeskAccount',_0x4eb572,JSON[_0x834f('0x11')](_0x459ab4));_0x2722e6(_0x459ab4);})[_0x834f('0x17')](function(_0x449a14){logger['error']('GetFreshdeskAccount',_0x449a14[_0x834f('0x14')],_0x4eb572);_0x7788a1(_0x3e8ff6[_0x834f('0x12')](0x1f4,_0x449a14[_0x834f('0x14')]));});});};exports[_0x834f('0x22')]=function(_0x39398b){var _0x1d4396=this;return new Promise(function(_0x41111b,_0x4183ad){return db[_0x834f('0x19')][_0x834f('0x23')]({'raw':_0x39398b[_0x834f('0x1a')]?_0x39398b[_0x834f('0x1a')][_0x834f('0x1b')]===undefined?!![]:![]:!![],'where':_0x39398b[_0x834f('0x1a')]?_0x39398b['options'][_0x834f('0x1c')]||null:null,'attributes':_0x39398b[_0x834f('0x1a')]?_0x39398b[_0x834f('0x1a')][_0x834f('0x1d')]||null:null,'include':_0x39398b[_0x834f('0x1a')]?_0x39398b['options'][_0x834f('0x1f')]?_[_0x834f('0x20')](_0x39398b[_0x834f('0x1a')][_0x834f('0x1f')],function(_0x468b68){return{'model':db[_0x468b68['model']],'as':_0x468b68['as'],'attributes':_0x468b68[_0x834f('0x1d')],'include':_0x468b68[_0x834f('0x1f')]?_['map'](_0x468b68[_0x834f('0x1f')],function(_0xa1611){return{'model':db[_0xa1611['model']],'as':_0xa1611['as'],'attributes':_0xa1611['attributes'],'include':_0xa1611[_0x834f('0x1f')]?_[_0x834f('0x20')](_0xa1611[_0x834f('0x1f')],function(_0x266dfe){return{'model':db[_0x266dfe['model']],'as':_0x266dfe['as'],'attributes':_0x266dfe[_0x834f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x834f('0xc')](function(_0x3f355d){logger[_0x834f('0x15')](_0x834f('0x22'),_0x39398b);logger[_0x834f('0xf')](_0x834f('0x22'),_0x39398b,JSON[_0x834f('0x11')](_0x3f355d));_0x41111b(_0x3f355d);})[_0x834f('0x17')](function(_0x3f7a51){logger[_0x834f('0x12')](_0x834f('0x22'),_0x3f7a51[_0x834f('0x14')],_0x39398b);_0x4183ad(_0x1d4396['error'](0x1f4,_0x3f7a51[_0x834f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1153630..0311d3d 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 _0x705a=['/:id/tags','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5ab5c2,_0x459e4f){var _0x15e34f=function(_0x5807d5){while(--_0x5807d5){_0x5ab5c2['push'](_0x5ab5c2['shift']());}};_0x15e34f(++_0x459e4f);}(_0x705a,0x174));var _0xa705=function(_0x51f317,_0x873ef8){_0x51f317=_0x51f317-0x0;var _0x18f76a=_0x705a[_0x51f317];return _0x18f76a;};'use strict';var multer=require(_0xa705('0x0'));var util=require(_0xa705('0x1'));var path=require(_0xa705('0x2'));var timeout=require(_0xa705('0x3'));var express=require('express');var router=express[_0xa705('0x4')]();var fs_extra=require(_0xa705('0x5'));var auth=require(_0xa705('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa705('0x7'));var controller=require(_0xa705('0x8'));router[_0xa705('0x9')]('/',auth[_0xa705('0xa')](),controller['index']);router[_0xa705('0x9')](_0xa705('0xb'),auth[_0xa705('0xa')](),controller[_0xa705('0xc')]);router['get']('/:id/fields',auth[_0xa705('0xa')](),controller[_0xa705('0xd')]);router['get'](_0xa705('0xe'),auth[_0xa705('0xa')](),controller[_0xa705('0xf')]);router[_0xa705('0x9')](_0xa705('0x10'),auth['isAuthenticated'](),controller[_0xa705('0x11')]);router[_0xa705('0x9')](_0xa705('0x12'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0xa705('0x13')]);router['post'](_0xa705('0x12'),auth[_0xa705('0xa')](),controller[_0xa705('0x14')]);router[_0xa705('0x15')](_0xa705('0xb'),auth[_0xa705('0xa')](),controller[_0xa705('0x16')]);router[_0xa705('0x17')](_0xa705('0xb'),auth[_0xa705('0xa')](),controller[_0xa705('0x18')]);module[_0xa705('0x19')]=router; \ No newline at end of file +var _0x25ae=['getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x1f719a,_0x3aceab){var _0x6995f8=function(_0x2c09fb){while(--_0x2c09fb){_0x1f719a['push'](_0x1f719a['shift']());}};_0x6995f8(++_0x3aceab);}(_0x25ae,0x164));var _0xe25a=function(_0x3957ff,_0x18ad93){_0x3957ff=_0x3957ff-0x0;var _0x2e4509=_0x25ae[_0x3957ff];return _0x2e4509;};'use strict';var multer=require(_0xe25a('0x0'));var util=require(_0xe25a('0x1'));var path=require(_0xe25a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe25a('0x3')]();var fs_extra=require(_0xe25a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe25a('0x5'));var config=require(_0xe25a('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xe25a('0x7')]('/',auth[_0xe25a('0x8')](),controller[_0xe25a('0x9')]);router[_0xe25a('0x7')](_0xe25a('0xa'),auth[_0xe25a('0x8')](),controller[_0xe25a('0xb')]);router[_0xe25a('0x7')]('/:id/fields',auth[_0xe25a('0x8')](),controller[_0xe25a('0xc')]);router[_0xe25a('0x7')]('/:id/subjects',auth[_0xe25a('0x8')](),controller[_0xe25a('0xd')]);router['get'](_0xe25a('0xe'),auth[_0xe25a('0x8')](),controller[_0xe25a('0xf')]);router[_0xe25a('0x7')]('/:id/tags',auth[_0xe25a('0x8')](),controller[_0xe25a('0x10')]);router[_0xe25a('0x11')]('/',auth[_0xe25a('0x8')](),controller[_0xe25a('0x12')]);router[_0xe25a('0x11')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xe25a('0x13')]('/:id',auth[_0xe25a('0x8')](),controller['update']);router[_0xe25a('0x14')](_0xe25a('0xa'),auth[_0xe25a('0x8')](),controller[_0xe25a('0x15')]);module[_0xe25a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c4227d9..ba27d84 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 _0xa2ae=['STRING','sequelize','exports'];(function(_0x38a426,_0x25094e){var _0xf507e8=function(_0x4c97f2){while(--_0x4c97f2){_0x38a426['push'](_0x38a426['shift']());}};_0xf507e8(++_0x25094e);}(_0xa2ae,0x199));var _0xea2a=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xa2ae[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0xea2a('0x0'));module[_0xea2a('0x1')]={'name':{'type':Sequelize[_0xea2a('0x2')]},'description':{'type':Sequelize[_0xea2a('0x2')]}}; \ No newline at end of file +var _0xf9dd=['sequelize','exports','STRING'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xf9dd,0xa5));var _0xdf9d=function(_0x12a2f1,_0x51606b){_0x12a2f1=_0x12a2f1-0x0;var _0x2e7f0c=_0xf9dd[_0x12a2f1];return _0x2e7f0c;};'use strict';var Sequelize=require(_0xdf9d('0x0'));module[_0xdf9d('0x1')]={'name':{'type':Sequelize[_0xdf9d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e2d99e9..a857404 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 _0x0be9=['create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x8f7d2b,_0x1bebaf){var _0x13c298=function(_0x54717e){while(--_0x54717e){_0x8f7d2b['push'](_0x8f7d2b['shift']());}};_0x13c298(++_0x1bebaf);}(_0x0be9,0x162));var _0x90be=function(_0x7c9da2,_0x5b0d18){_0x7c9da2=_0x7c9da2-0x0;var _0x17fe88=_0x0be9[_0x7c9da2];return _0x17fe88;};'use strict';var emlformat=require(_0x90be('0x0'));var rimraf=require(_0x90be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90be('0x2'));var moment=require(_0x90be('0x3'));var BPromise=require(_0x90be('0x4'));var Mustache=require(_0x90be('0x5'));var util=require(_0x90be('0x6'));var path=require(_0x90be('0x7'));var sox=require(_0x90be('0x8'));var csv=require(_0x90be('0x9'));var ejs=require(_0x90be('0xa'));var fs=require('fs');var fs_extra=require(_0x90be('0xb'));var _=require(_0x90be('0xc'));var squel=require(_0x90be('0xd'));var crypto=require(_0x90be('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x90be('0xf'));var toCsv=require('to-csv');var querystring=require(_0x90be('0x10'));var Papa=require(_0x90be('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x90be('0x12'));var as=require(_0x90be('0x13'));var hardwareService=require(_0x90be('0x14'));var logger=require(_0x90be('0x15'))(_0x90be('0x16'));var utils=require(_0x90be('0x17'));var config=require(_0x90be('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x90be('0x19'))['db'];function respondWithStatusCode(_0x14c034,_0x189bfa){_0x189bfa=_0x189bfa||0xcc;return function(_0x40e918){if(_0x40e918){return _0x14c034[_0x90be('0x1a')](_0x189bfa);}return _0x14c034['status'](_0x189bfa)[_0x90be('0x1b')]();};}function respondWithResult(_0x57eca3,_0x1b73c4){_0x1b73c4=_0x1b73c4||0xc8;return function(_0x4232cc){if(_0x4232cc){return _0x57eca3[_0x90be('0x1c')](_0x1b73c4)['json'](_0x4232cc);}};}function respondWithFilteredResult(_0x411146,_0x2734e3){return function(_0x5e62c3){if(_0x5e62c3){var _0x581832=typeof _0x2734e3[_0x90be('0x1d')]===_0x90be('0x1e')&&typeof _0x2734e3[_0x90be('0x1f')]===_0x90be('0x1e');var _0x573bb6=_0x5e62c3['count'];var _0x56391c=_0x581832?0x0:_0x2734e3[_0x90be('0x1d')];var _0x2b1140=_0x581832?_0x5e62c3[_0x90be('0x20')]:_0x2734e3[_0x90be('0x1d')]+_0x2734e3[_0x90be('0x1f')];var _0x17dc46;if(_0x2b1140>=_0x573bb6){_0x2b1140=_0x573bb6;_0x17dc46=0xc8;}else{_0x17dc46=0xce;}_0x411146[_0x90be('0x1c')](_0x17dc46);return _0x411146['set'](_0x90be('0x21'),_0x56391c+'-'+_0x2b1140+'/'+_0x573bb6)['json'](_0x5e62c3);}return null;};}function patchUpdates(_0x56f3e7){return function(_0x43b3fb){try{jsonpatch[_0x90be('0x22')](_0x43b3fb,_0x56f3e7,!![]);}catch(_0x2cbbba){return BPromise[_0x90be('0x23')](_0x2cbbba);}return _0x43b3fb[_0x90be('0x24')]();};}function saveUpdates(_0x26a371,_0x734c41){return function(_0x51558f){if(_0x51558f){return _0x51558f[_0x90be('0x25')](_0x26a371)[_0x90be('0x26')](function(_0x252075){return _0x252075;});}return null;};}function removeEntity(_0x2fa73e,_0x5c9950){return function(_0x379e5b){if(_0x379e5b){return _0x379e5b[_0x90be('0x27')]()['then'](function(){_0x2fa73e[_0x90be('0x1c')](0xcc)[_0x90be('0x1b')]();});}};}function handleEntityNotFound(_0xcc06ab,_0x1c9bb0){return function(_0x813bc1){if(!_0x813bc1){_0xcc06ab[_0x90be('0x1a')](0x194);}return _0x813bc1;};}function handleError(_0x2b8a4a,_0x33200f){_0x33200f=_0x33200f||0x1f4;return function(_0x106244){logger[_0x90be('0x28')](_0x106244['stack']);if(_0x106244[_0x90be('0x29')]){delete _0x106244[_0x90be('0x29')];}_0x2b8a4a[_0x90be('0x1c')](_0x33200f)[_0x90be('0x2a')](_0x106244);};}exports[_0x90be('0x2b')]=function(_0x491aae,_0xfda4f6){var _0xd84591={},_0x5c9205={},_0x8bfd13={'count':0x0,'rows':[]};var _0x477e3f=_[_0x90be('0x2c')](db[_0x90be('0x2d')][_0x90be('0x2e')],function(_0x357fde){return{'name':_0x357fde[_0x90be('0x2f')],'type':_0x357fde[_0x90be('0x30')][_0x90be('0x31')]};});_0x5c9205['model']=_[_0x90be('0x2c')](_0x477e3f,_0x90be('0x29'));_0x5c9205[_0x90be('0x32')]=_[_0x90be('0x33')](_0x491aae[_0x90be('0x32')]);_0x5c9205[_0x90be('0x34')]=_[_0x90be('0x35')](_0x5c9205[_0x90be('0x36')],_0x5c9205['query']);_0xd84591[_0x90be('0x37')]=_[_0x90be('0x35')](_0x5c9205['model'],qs[_0x90be('0x38')](_0x491aae[_0x90be('0x32')][_0x90be('0x38')]));_0xd84591[_0x90be('0x37')]=_0xd84591[_0x90be('0x37')][_0x90be('0x39')]?_0xd84591[_0x90be('0x37')]:_0x5c9205[_0x90be('0x36')];if(!_0x491aae[_0x90be('0x32')][_0x90be('0x3a')](_0x90be('0x3b'))){_0xd84591[_0x90be('0x1f')]=qs['limit'](_0x491aae[_0x90be('0x32')][_0x90be('0x1f')]);_0xd84591['offset']=qs[_0x90be('0x1d')](_0x491aae[_0x90be('0x32')][_0x90be('0x1d')]);}_0xd84591[_0x90be('0x3c')]=qs[_0x90be('0x3d')](_0x491aae[_0x90be('0x32')]['sort']);_0xd84591[_0x90be('0x3e')]=qs['filters'](_[_0x90be('0x3f')](_0x491aae[_0x90be('0x32')],_0x5c9205[_0x90be('0x34')]),_0x477e3f);if(_0x491aae[_0x90be('0x32')][_0x90be('0x40')]){_0xd84591[_0x90be('0x3e')]=_[_0x90be('0x41')](_0xd84591[_0x90be('0x3e')],{'$or':_['map'](_0x477e3f,function(_0x5b169a){if(_0x5b169a['type']!==_0x90be('0x42')){var _0x352f2b={};_0x352f2b[_0x5b169a[_0x90be('0x29')]]={'$like':'%'+_0x491aae[_0x90be('0x32')][_0x90be('0x40')]+'%'};return _0x352f2b;}})});}_0xd84591=_['merge']({},_0xd84591,_0x491aae[_0x90be('0x43')]);var _0x15e337={'where':_0xd84591[_0x90be('0x3e')]};return db[_0x90be('0x2d')][_0x90be('0x20')](_0x15e337)[_0x90be('0x26')](function(_0xbe5c64){_0x8bfd13[_0x90be('0x20')]=_0xbe5c64;if(_0x491aae[_0x90be('0x32')][_0x90be('0x44')]){_0xd84591['include']=[{'all':!![]}];}return db[_0x90be('0x2d')][_0x90be('0x45')](_0xd84591);})[_0x90be('0x26')](function(_0x38a5c0){_0x8bfd13[_0x90be('0x46')]=_0x38a5c0;return _0x8bfd13;})[_0x90be('0x26')](respondWithFilteredResult(_0xfda4f6,_0xd84591))[_0x90be('0x47')](handleError(_0xfda4f6,null));};exports[_0x90be('0x48')]=function(_0x14f7b9,_0x1cddfc){var _0x2048ea={'raw':![],'where':{'id':_0x14f7b9[_0x90be('0x49')]['id']}},_0x233525={};_0x233525[_0x90be('0x36')]=_['keys'](db['FreshdeskConfiguration'][_0x90be('0x2e')]);_0x233525['query']=_[_0x90be('0x33')](_0x14f7b9[_0x90be('0x32')]);_0x233525['filters']=_[_0x90be('0x35')](_0x233525[_0x90be('0x36')],_0x233525[_0x90be('0x32')]);_0x2048ea[_0x90be('0x37')]=_[_0x90be('0x35')](_0x233525[_0x90be('0x36')],qs[_0x90be('0x38')](_0x14f7b9[_0x90be('0x32')][_0x90be('0x38')]));_0x2048ea[_0x90be('0x37')]=_0x2048ea['attributes']['length']?_0x2048ea['attributes']:_0x233525[_0x90be('0x36')];if(_0x14f7b9[_0x90be('0x32')][_0x90be('0x44')]){_0x2048ea[_0x90be('0x4a')]=[{'all':!![]}];}_0x2048ea=_[_0x90be('0x41')]({},_0x2048ea,_0x14f7b9['options']);return db['FreshdeskConfiguration'][_0x90be('0x4b')](_0x2048ea)['then'](handleEntityNotFound(_0x1cddfc,null))[_0x90be('0x26')](respondWithResult(_0x1cddfc,null))['catch'](handleError(_0x1cddfc,null));};exports[_0x90be('0x4c')]=function(_0x1db7fd,_0x5da0f2){return db[_0x90be('0x2d')][_0x90be('0x4c')](_0x1db7fd[_0x90be('0x4d')],{})[_0x90be('0x26')](respondWithResult(_0x5da0f2,0xc9))[_0x90be('0x47')](handleError(_0x5da0f2,null));};exports['update']=function(_0x207f09,_0x5096f0){if(_0x207f09[_0x90be('0x4d')]['id']){delete _0x207f09['body']['id'];}return db[_0x90be('0x2d')][_0x90be('0x4b')]({'where':{'id':_0x207f09[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x5096f0,null))[_0x90be('0x26')](saveUpdates(_0x207f09[_0x90be('0x4d')],null))[_0x90be('0x26')](respondWithResult(_0x5096f0,null))[_0x90be('0x47')](handleError(_0x5096f0,null));};exports[_0x90be('0x27')]=function(_0x58d489,_0x26af4d){return db[_0x90be('0x2d')]['find']({'where':{'id':_0x58d489[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x26af4d,null))[_0x90be('0x26')](removeEntity(_0x26af4d,null))[_0x90be('0x47')](handleError(_0x26af4d,null));};exports[_0x90be('0x4e')]=function(_0x12adec,_0x2f2ae1,_0x3f798d){var _0xa01166={};var _0x74d41d={};var _0x5e96f6;var _0x14f88a;return db[_0x90be('0x2d')][_0x90be('0x4f')]({'where':{'id':_0x12adec[_0x90be('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f2ae1,null))['then'](function(_0x47a38c){if(_0x47a38c){_0x5e96f6=_0x47a38c;_0x74d41d[_0x90be('0x36')]=_[_0x90be('0x33')](db[_0x90be('0x50')][_0x90be('0x2e')]);_0x74d41d['query']=_['keys'](_0x12adec['query']);_0x74d41d[_0x90be('0x34')]=_[_0x90be('0x35')](_0x74d41d[_0x90be('0x36')],_0x74d41d[_0x90be('0x32')]);_0xa01166[_0x90be('0x37')]=_[_0x90be('0x35')](_0x74d41d[_0x90be('0x36')],qs[_0x90be('0x38')](_0x12adec[_0x90be('0x32')]['fields']));_0xa01166['attributes']=_0xa01166[_0x90be('0x37')][_0x90be('0x39')]?_0xa01166[_0x90be('0x37')]:_0x74d41d[_0x90be('0x36')];_0xa01166[_0x90be('0x3c')]=qs['sort'](_0x12adec['query'][_0x90be('0x3d')]);_0xa01166[_0x90be('0x3e')]=qs[_0x90be('0x34')](_[_0x90be('0x3f')](_0x12adec[_0x90be('0x32')],_0x74d41d[_0x90be('0x34')]));if(_0x12adec[_0x90be('0x32')][_0x90be('0x40')]){_0xa01166[_0x90be('0x3e')]=_[_0x90be('0x41')](_0xa01166['where'],{'$or':_[_0x90be('0x2c')](_0xa01166[_0x90be('0x37')],function(_0x2a0f1a){var _0x382901={};_0x382901[_0x2a0f1a]={'$like':'%'+_0x12adec['query'][_0x90be('0x40')]+'%'};return _0x382901;})});}_0xa01166=_['merge']({},_0xa01166,_0x12adec['options']);return _0x5e96f6[_0x90be('0x4e')](_0xa01166);}})[_0x90be('0x26')](function(_0x430c9b){if(_0x430c9b){_0x14f88a=_0x430c9b[_0x90be('0x39')];if(!_0x12adec[_0x90be('0x32')]['hasOwnProperty']('nolimit')){_0xa01166['limit']=qs[_0x90be('0x1f')](_0x12adec[_0x90be('0x32')]['limit']);_0xa01166[_0x90be('0x1d')]=qs['offset'](_0x12adec[_0x90be('0x32')][_0x90be('0x1d')]);}return _0x5e96f6[_0x90be('0x4e')](_0xa01166);}})[_0x90be('0x26')](function(_0x569f11){if(_0x569f11){return _0x569f11?{'count':_0x14f88a,'rows':_0x569f11}:null;}})[_0x90be('0x26')](respondWithResult(_0x2f2ae1,null))['catch'](handleError(_0x2f2ae1,null));};exports[_0x90be('0x51')]=function(_0x5cbe24,_0x317df8,_0xd06070){var _0x2ee944={};var _0x54dcc4={};var _0xf2d196;var _0x276516;return db[_0x90be('0x2d')][_0x90be('0x4f')]({'where':{'id':_0x5cbe24[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x317df8,null))['then'](function(_0x5b9fce){if(_0x5b9fce){_0xf2d196=_0x5b9fce;_0x54dcc4[_0x90be('0x36')]=_['keys'](db['FreshdeskField'][_0x90be('0x2e')]);_0x54dcc4[_0x90be('0x32')]=_[_0x90be('0x33')](_0x5cbe24[_0x90be('0x32')]);_0x54dcc4[_0x90be('0x34')]=_[_0x90be('0x35')](_0x54dcc4[_0x90be('0x36')],_0x54dcc4['query']);_0x2ee944['attributes']=_[_0x90be('0x35')](_0x54dcc4[_0x90be('0x36')],qs[_0x90be('0x38')](_0x5cbe24[_0x90be('0x32')]['fields']));_0x2ee944[_0x90be('0x37')]=_0x2ee944[_0x90be('0x37')][_0x90be('0x39')]?_0x2ee944['attributes']:_0x54dcc4[_0x90be('0x36')];_0x2ee944[_0x90be('0x3c')]=qs[_0x90be('0x3d')](_0x5cbe24[_0x90be('0x32')][_0x90be('0x3d')]);_0x2ee944[_0x90be('0x3e')]=qs['filters'](_[_0x90be('0x3f')](_0x5cbe24[_0x90be('0x32')],_0x54dcc4['filters']));if(_0x5cbe24[_0x90be('0x32')]['filter']){_0x2ee944[_0x90be('0x3e')]=_[_0x90be('0x41')](_0x2ee944[_0x90be('0x3e')],{'$or':_[_0x90be('0x2c')](_0x2ee944['attributes'],function(_0x1387a2){var _0x454613={};_0x454613[_0x1387a2]={'$like':'%'+_0x5cbe24[_0x90be('0x32')][_0x90be('0x40')]+'%'};return _0x454613;})});}_0x2ee944=_[_0x90be('0x41')]({},_0x2ee944,_0x5cbe24[_0x90be('0x43')]);return _0xf2d196[_0x90be('0x51')](_0x2ee944);}})[_0x90be('0x26')](function(_0x33fb2c){if(_0x33fb2c){_0x276516=_0x33fb2c['length'];if(!_0x5cbe24['query'][_0x90be('0x3a')](_0x90be('0x3b'))){_0x2ee944[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x5cbe24[_0x90be('0x32')][_0x90be('0x1f')]);_0x2ee944[_0x90be('0x1d')]=qs[_0x90be('0x1d')](_0x5cbe24[_0x90be('0x32')][_0x90be('0x1d')]);}return _0xf2d196[_0x90be('0x51')](_0x2ee944);}})[_0x90be('0x26')](function(_0x3640ff){if(_0x3640ff){return _0x3640ff?{'count':_0x276516,'rows':_0x3640ff}:null;}})[_0x90be('0x26')](respondWithResult(_0x317df8,null))[_0x90be('0x47')](handleError(_0x317df8,null));};exports[_0x90be('0x52')]=function(_0x462b89,_0x3bba7c,_0x29f9fa){var _0x4a3996={};var _0x2973b5={};var _0x29ba5;var _0x1ecfea;return db[_0x90be('0x2d')][_0x90be('0x4f')]({'where':{'id':_0x462b89[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x3bba7c,null))[_0x90be('0x26')](function(_0x5ec291){if(_0x5ec291){_0x29ba5=_0x5ec291;_0x2973b5[_0x90be('0x36')]=_[_0x90be('0x33')](db[_0x90be('0x50')][_0x90be('0x2e')]);_0x2973b5[_0x90be('0x32')]=_['keys'](_0x462b89[_0x90be('0x32')]);_0x2973b5[_0x90be('0x34')]=_[_0x90be('0x35')](_0x2973b5['model'],_0x2973b5[_0x90be('0x32')]);_0x4a3996['attributes']=_[_0x90be('0x35')](_0x2973b5[_0x90be('0x36')],qs[_0x90be('0x38')](_0x462b89[_0x90be('0x32')][_0x90be('0x38')]));_0x4a3996['attributes']=_0x4a3996[_0x90be('0x37')][_0x90be('0x39')]?_0x4a3996[_0x90be('0x37')]:_0x2973b5['model'];_0x4a3996[_0x90be('0x3c')]=qs[_0x90be('0x3d')](_0x462b89[_0x90be('0x32')][_0x90be('0x3d')]);_0x4a3996['where']=qs[_0x90be('0x34')](_[_0x90be('0x3f')](_0x462b89[_0x90be('0x32')],_0x2973b5[_0x90be('0x34')]));if(_0x462b89['query'][_0x90be('0x40')]){_0x4a3996[_0x90be('0x3e')]=_[_0x90be('0x41')](_0x4a3996[_0x90be('0x3e')],{'$or':_['map'](_0x4a3996['attributes'],function(_0x28b859){var _0x765975={};_0x765975[_0x28b859]={'$like':'%'+_0x462b89['query'][_0x90be('0x40')]+'%'};return _0x765975;})});}_0x4a3996=_[_0x90be('0x41')]({},_0x4a3996,_0x462b89[_0x90be('0x43')]);return _0x29ba5['getDescriptions'](_0x4a3996);}})[_0x90be('0x26')](function(_0x1ac738){if(_0x1ac738){_0x1ecfea=_0x1ac738[_0x90be('0x39')];if(!_0x462b89[_0x90be('0x32')][_0x90be('0x3a')](_0x90be('0x3b'))){_0x4a3996[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x462b89[_0x90be('0x32')]['limit']);_0x4a3996[_0x90be('0x1d')]=qs[_0x90be('0x1d')](_0x462b89[_0x90be('0x32')][_0x90be('0x1d')]);}return _0x29ba5[_0x90be('0x52')](_0x4a3996);}})[_0x90be('0x26')](function(_0x78fdc2){if(_0x78fdc2){return _0x78fdc2?{'count':_0x1ecfea,'rows':_0x78fdc2}:null;}})['then'](respondWithResult(_0x3bba7c,null))['catch'](handleError(_0x3bba7c,null));};exports[_0x90be('0x53')]=function(_0xb377be,_0x224d92,_0x477dd8){var _0x5a71e2={};var _0x3fe643={};var _0x564acf;var _0x24788e;return db['FreshdeskConfiguration'][_0x90be('0x4f')]({'where':{'id':_0xb377be[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x224d92,null))[_0x90be('0x26')](function(_0x17d20c){if(_0x17d20c){_0x564acf=_0x17d20c;_0x3fe643[_0x90be('0x36')]=_[_0x90be('0x33')](db['Tag'][_0x90be('0x2e')]);_0x3fe643[_0x90be('0x32')]=_[_0x90be('0x33')](_0xb377be[_0x90be('0x32')]);_0x3fe643[_0x90be('0x34')]=_[_0x90be('0x35')](_0x3fe643[_0x90be('0x36')],_0x3fe643[_0x90be('0x32')]);_0x5a71e2[_0x90be('0x37')]=_['intersection'](_0x3fe643[_0x90be('0x36')],qs[_0x90be('0x38')](_0xb377be[_0x90be('0x32')]['fields']));_0x5a71e2[_0x90be('0x37')]=_0x5a71e2['attributes'][_0x90be('0x39')]?_0x5a71e2[_0x90be('0x37')]:_0x3fe643[_0x90be('0x36')];_0x5a71e2[_0x90be('0x3c')]=qs['sort'](_0xb377be[_0x90be('0x32')][_0x90be('0x3d')]);_0x5a71e2[_0x90be('0x3e')]=qs[_0x90be('0x34')](_[_0x90be('0x3f')](_0xb377be['query'],_0x3fe643[_0x90be('0x34')]));if(_0xb377be[_0x90be('0x32')][_0x90be('0x40')]){_0x5a71e2[_0x90be('0x3e')]=_[_0x90be('0x41')](_0x5a71e2['where'],{'$or':_[_0x90be('0x2c')](_0x5a71e2[_0x90be('0x37')],function(_0x1260dc){var _0x2fa684={};_0x2fa684[_0x1260dc]={'$like':'%'+_0xb377be[_0x90be('0x32')][_0x90be('0x40')]+'%'};return _0x2fa684;})});}_0x5a71e2=_['merge']({},_0x5a71e2,_0xb377be[_0x90be('0x43')]);return _0x564acf[_0x90be('0x53')](_0x5a71e2);}})[_0x90be('0x26')](function(_0xf7c6ad){if(_0xf7c6ad){_0x24788e=_0xf7c6ad[_0x90be('0x39')];if(!_0xb377be[_0x90be('0x32')]['hasOwnProperty']('nolimit')){_0x5a71e2[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0xb377be[_0x90be('0x32')][_0x90be('0x1f')]);_0x5a71e2[_0x90be('0x1d')]=qs[_0x90be('0x1d')](_0xb377be[_0x90be('0x32')][_0x90be('0x1d')]);}return _0x564acf[_0x90be('0x53')](_0x5a71e2);}})[_0x90be('0x26')](function(_0x19b411){if(_0x19b411){return _0x19b411?{'count':_0x24788e,'rows':_0x19b411}:null;}})[_0x90be('0x26')](respondWithResult(_0x224d92,null))[_0x90be('0x47')](handleError(_0x224d92,null));};exports[_0x90be('0x54')]=function(_0x138949,_0x309680,_0x511444){if(_0x138949[_0x90be('0x4d')]['id']){delete _0x138949[_0x90be('0x4d')]['id'];}return db[_0x90be('0x2d')][_0x90be('0x4f')]({'where':{'id':_0x138949[_0x90be('0x49')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x309680,null))[_0x90be('0x26')](function(_0x477ed8){if(_0x477ed8){return _0x477ed8[_0x90be('0x54')](_0x138949[_0x90be('0x4d')][_0x90be('0x55')]||[]);}return null;})['then'](respondWithResult(_0x309680,null))[_0x90be('0x47')](handleError(_0x309680,null));}; \ No newline at end of file +var _0x2003=['body','destroy','getFields','findOne','FreshdeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','moment','mustache','util','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/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create'];(function(_0xf80e26,_0x341864){var _0x21a4db=function(_0x15e13a){while(--_0x15e13a){_0xf80e26['push'](_0xf80e26['shift']());}};_0x21a4db(++_0x341864);}(_0x2003,0xb3));var _0x3200=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x2003[_0x1f1e31];return _0x229b56;};'use strict';var emlformat=require(_0x3200('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3200('0x1'));var rp=require('request-promise');var moment=require(_0x3200('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3200('0x3'));var util=require(_0x3200('0x4'));var path=require('path');var sox=require(_0x3200('0x5'));var csv=require(_0x3200('0x6'));var ejs=require(_0x3200('0x7'));var fs=require('fs');var fs_extra=require(_0x3200('0x8'));var _=require(_0x3200('0x9'));var squel=require(_0x3200('0xa'));var crypto=require(_0x3200('0xb'));var jsforce=require(_0x3200('0xc'));var deskjs=require(_0x3200('0xd'));var toCsv=require(_0x3200('0x6'));var querystring=require(_0x3200('0xe'));var Papa=require(_0x3200('0xf'));var Redis=require('ioredis');var authService=require(_0x3200('0x10'));var qs=require(_0x3200('0x11'));var as=require(_0x3200('0x12'));var hardwareService=require(_0x3200('0x13'));var logger=require(_0x3200('0x14'))('api');var utils=require(_0x3200('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3200('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5af1d9,_0x350aed){_0x350aed=_0x350aed||0xcc;return function(_0x3d279e){if(_0x3d279e){return _0x5af1d9[_0x3200('0x17')](_0x350aed);}return _0x5af1d9[_0x3200('0x18')](_0x350aed)[_0x3200('0x19')]();};}function respondWithResult(_0x463afa,_0x394298){_0x394298=_0x394298||0xc8;return function(_0xf2ec52){if(_0xf2ec52){return _0x463afa[_0x3200('0x18')](_0x394298)['json'](_0xf2ec52);}};}function respondWithFilteredResult(_0x10c7a9,_0x34b111){return function(_0x47a47a){if(_0x47a47a){var _0x4eccbd=typeof _0x34b111[_0x3200('0x1a')]===_0x3200('0x1b')&&typeof _0x34b111[_0x3200('0x1c')]===_0x3200('0x1b');var _0x2f5802=_0x47a47a['count'];var _0x25bca7=_0x4eccbd?0x0:_0x34b111['offset'];var _0x4063ae=_0x4eccbd?_0x47a47a[_0x3200('0x1d')]:_0x34b111[_0x3200('0x1a')]+_0x34b111['limit'];var _0xaea1d;if(_0x4063ae>=_0x2f5802){_0x4063ae=_0x2f5802;_0xaea1d=0xc8;}else{_0xaea1d=0xce;}_0x10c7a9[_0x3200('0x18')](_0xaea1d);return _0x10c7a9[_0x3200('0x1e')](_0x3200('0x1f'),_0x25bca7+'-'+_0x4063ae+'/'+_0x2f5802)[_0x3200('0x20')](_0x47a47a);}return null;};}function patchUpdates(_0x5342c9){return function(_0x29b39d){try{jsonpatch[_0x3200('0x21')](_0x29b39d,_0x5342c9,!![]);}catch(_0xfc4786){return BPromise[_0x3200('0x22')](_0xfc4786);}return _0x29b39d[_0x3200('0x23')]();};}function saveUpdates(_0xbb9597,_0x5ab94c){return function(_0x3f2530){if(_0x3f2530){return _0x3f2530[_0x3200('0x24')](_0xbb9597)[_0x3200('0x25')](function(_0x5151cd){return _0x5151cd;});}return null;};}function removeEntity(_0x53cfc,_0xe7289b){return function(_0x5a0a86){if(_0x5a0a86){return _0x5a0a86['destroy']()[_0x3200('0x25')](function(){_0x53cfc[_0x3200('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x406328,_0x300ab5){return function(_0x4eb8e1){if(!_0x4eb8e1){_0x406328[_0x3200('0x17')](0x194);}return _0x4eb8e1;};}function handleError(_0x25e74a,_0x46b605){_0x46b605=_0x46b605||0x1f4;return function(_0x43db1c){logger['error'](_0x43db1c[_0x3200('0x26')]);if(_0x43db1c[_0x3200('0x27')]){delete _0x43db1c[_0x3200('0x27')];}_0x25e74a['status'](_0x46b605)['send'](_0x43db1c);};}exports[_0x3200('0x28')]=function(_0x873103,_0x10623f){var _0x961b47={},_0x3e9525={},_0x49d835={'count':0x0,'rows':[]};var _0x28efa6=_['map'](db[_0x3200('0x29')][_0x3200('0x2a')],function(_0x57251a){return{'name':_0x57251a['fieldName'],'type':_0x57251a[_0x3200('0x2b')][_0x3200('0x2c')]};});_0x3e9525['model']=_[_0x3200('0x2d')](_0x28efa6,'name');_0x3e9525[_0x3200('0x2e')]=_[_0x3200('0x2f')](_0x873103['query']);_0x3e9525[_0x3200('0x30')]=_[_0x3200('0x31')](_0x3e9525['model'],_0x3e9525['query']);_0x961b47['attributes']=_['intersection'](_0x3e9525[_0x3200('0x32')],qs['fields'](_0x873103[_0x3200('0x2e')][_0x3200('0x33')]));_0x961b47[_0x3200('0x34')]=_0x961b47[_0x3200('0x34')][_0x3200('0x35')]?_0x961b47['attributes']:_0x3e9525[_0x3200('0x32')];if(!_0x873103['query']['hasOwnProperty'](_0x3200('0x36'))){_0x961b47['limit']=qs[_0x3200('0x1c')](_0x873103[_0x3200('0x2e')][_0x3200('0x1c')]);_0x961b47[_0x3200('0x1a')]=qs[_0x3200('0x1a')](_0x873103[_0x3200('0x2e')]['offset']);}_0x961b47['order']=qs[_0x3200('0x37')](_0x873103[_0x3200('0x2e')]['sort']);_0x961b47[_0x3200('0x38')]=qs['filters'](_[_0x3200('0x39')](_0x873103[_0x3200('0x2e')],_0x3e9525[_0x3200('0x30')]),_0x28efa6);if(_0x873103['query'][_0x3200('0x3a')]){_0x961b47[_0x3200('0x38')]=_[_0x3200('0x3b')](_0x961b47[_0x3200('0x38')],{'$or':_[_0x3200('0x2d')](_0x28efa6,function(_0x4fca94){if(_0x4fca94[_0x3200('0x2b')]!==_0x3200('0x3c')){var _0x4fdb76={};_0x4fdb76[_0x4fca94[_0x3200('0x27')]]={'$like':'%'+_0x873103[_0x3200('0x2e')][_0x3200('0x3a')]+'%'};return _0x4fdb76;}})});}_0x961b47=_[_0x3200('0x3b')]({},_0x961b47,_0x873103[_0x3200('0x3d')]);var _0x5bf0ca={'where':_0x961b47[_0x3200('0x38')]};return db[_0x3200('0x29')][_0x3200('0x1d')](_0x5bf0ca)['then'](function(_0x55fbbd){_0x49d835[_0x3200('0x1d')]=_0x55fbbd;if(_0x873103[_0x3200('0x2e')][_0x3200('0x3e')]){_0x961b47[_0x3200('0x3f')]=[{'all':!![]}];}return db[_0x3200('0x29')][_0x3200('0x40')](_0x961b47);})[_0x3200('0x25')](function(_0x2d06ff){_0x49d835[_0x3200('0x41')]=_0x2d06ff;return _0x49d835;})[_0x3200('0x25')](respondWithFilteredResult(_0x10623f,_0x961b47))[_0x3200('0x42')](handleError(_0x10623f,null));};exports['show']=function(_0x1b3bc4,_0x408468){var _0x40eb7b={'raw':![],'where':{'id':_0x1b3bc4[_0x3200('0x43')]['id']}},_0x4f2acb={};_0x4f2acb[_0x3200('0x32')]=_[_0x3200('0x2f')](db[_0x3200('0x29')][_0x3200('0x2a')]);_0x4f2acb[_0x3200('0x2e')]=_['keys'](_0x1b3bc4['query']);_0x4f2acb[_0x3200('0x30')]=_[_0x3200('0x31')](_0x4f2acb[_0x3200('0x32')],_0x4f2acb['query']);_0x40eb7b['attributes']=_[_0x3200('0x31')](_0x4f2acb[_0x3200('0x32')],qs[_0x3200('0x33')](_0x1b3bc4[_0x3200('0x2e')][_0x3200('0x33')]));_0x40eb7b['attributes']=_0x40eb7b[_0x3200('0x34')][_0x3200('0x35')]?_0x40eb7b[_0x3200('0x34')]:_0x4f2acb[_0x3200('0x32')];if(_0x1b3bc4['query']['includeAll']){_0x40eb7b[_0x3200('0x3f')]=[{'all':!![]}];}_0x40eb7b=_[_0x3200('0x3b')]({},_0x40eb7b,_0x1b3bc4[_0x3200('0x3d')]);return db[_0x3200('0x29')][_0x3200('0x44')](_0x40eb7b)[_0x3200('0x25')](handleEntityNotFound(_0x408468,null))['then'](respondWithResult(_0x408468,null))['catch'](handleError(_0x408468,null));};exports[_0x3200('0x45')]=function(_0x378923,_0x430272){return db[_0x3200('0x29')]['create'](_0x378923[_0x3200('0x46')],{})[_0x3200('0x25')](respondWithResult(_0x430272,0xc9))['catch'](handleError(_0x430272,null));};exports[_0x3200('0x24')]=function(_0x32f701,_0x3a67b2){if(_0x32f701[_0x3200('0x46')]['id']){delete _0x32f701[_0x3200('0x46')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x32f701['params']['id']}})[_0x3200('0x25')](handleEntityNotFound(_0x3a67b2,null))['then'](saveUpdates(_0x32f701[_0x3200('0x46')],null))[_0x3200('0x25')](respondWithResult(_0x3a67b2,null))[_0x3200('0x42')](handleError(_0x3a67b2,null));};exports[_0x3200('0x47')]=function(_0x594c79,_0x5f373d){return db[_0x3200('0x29')][_0x3200('0x44')]({'where':{'id':_0x594c79['params']['id']}})[_0x3200('0x25')](handleEntityNotFound(_0x5f373d,null))[_0x3200('0x25')](removeEntity(_0x5f373d,null))[_0x3200('0x42')](handleError(_0x5f373d,null));};exports[_0x3200('0x48')]=function(_0x4a326b,_0x194291,_0x2dcd4f){var _0x3cd666={};var _0xf1ff94={};var _0x52b65f;var _0x56336b;return db[_0x3200('0x29')][_0x3200('0x49')]({'where':{'id':_0x4a326b[_0x3200('0x43')]['id']}})['then'](handleEntityNotFound(_0x194291,null))[_0x3200('0x25')](function(_0x1739a7){if(_0x1739a7){_0x52b65f=_0x1739a7;_0xf1ff94['model']=_[_0x3200('0x2f')](db[_0x3200('0x4a')][_0x3200('0x2a')]);_0xf1ff94[_0x3200('0x2e')]=_['keys'](_0x4a326b['query']);_0xf1ff94['filters']=_[_0x3200('0x31')](_0xf1ff94['model'],_0xf1ff94['query']);_0x3cd666[_0x3200('0x34')]=_['intersection'](_0xf1ff94[_0x3200('0x32')],qs['fields'](_0x4a326b[_0x3200('0x2e')][_0x3200('0x33')]));_0x3cd666['attributes']=_0x3cd666[_0x3200('0x34')][_0x3200('0x35')]?_0x3cd666['attributes']:_0xf1ff94[_0x3200('0x32')];_0x3cd666[_0x3200('0x4b')]=qs[_0x3200('0x37')](_0x4a326b['query'][_0x3200('0x37')]);_0x3cd666[_0x3200('0x38')]=qs[_0x3200('0x30')](_[_0x3200('0x39')](_0x4a326b[_0x3200('0x2e')],_0xf1ff94[_0x3200('0x30')]));if(_0x4a326b['query'][_0x3200('0x3a')]){_0x3cd666['where']=_[_0x3200('0x3b')](_0x3cd666[_0x3200('0x38')],{'$or':_['map'](_0x3cd666[_0x3200('0x34')],function(_0x22e29a){var _0xce570e={};_0xce570e[_0x22e29a]={'$like':'%'+_0x4a326b[_0x3200('0x2e')][_0x3200('0x3a')]+'%'};return _0xce570e;})});}_0x3cd666=_[_0x3200('0x3b')]({},_0x3cd666,_0x4a326b[_0x3200('0x3d')]);return _0x52b65f['getFields'](_0x3cd666);}})[_0x3200('0x25')](function(_0x1eb7a3){if(_0x1eb7a3){_0x56336b=_0x1eb7a3[_0x3200('0x35')];if(!_0x4a326b[_0x3200('0x2e')]['hasOwnProperty'](_0x3200('0x36'))){_0x3cd666['limit']=qs[_0x3200('0x1c')](_0x4a326b[_0x3200('0x2e')][_0x3200('0x1c')]);_0x3cd666[_0x3200('0x1a')]=qs[_0x3200('0x1a')](_0x4a326b[_0x3200('0x2e')][_0x3200('0x1a')]);}return _0x52b65f[_0x3200('0x48')](_0x3cd666);}})[_0x3200('0x25')](function(_0x410ebf){if(_0x410ebf){return _0x410ebf?{'count':_0x56336b,'rows':_0x410ebf}:null;}})[_0x3200('0x25')](respondWithResult(_0x194291,null))[_0x3200('0x42')](handleError(_0x194291,null));};exports['getSubjects']=function(_0x71911c,_0x282d87,_0x27cde6){var _0x8f1210={};var _0x534db9={};var _0x5b40b8;var _0x289b06;return db[_0x3200('0x29')]['findOne']({'where':{'id':_0x71911c[_0x3200('0x43')]['id']}})[_0x3200('0x25')](handleEntityNotFound(_0x282d87,null))[_0x3200('0x25')](function(_0x4f60cb){if(_0x4f60cb){_0x5b40b8=_0x4f60cb;_0x534db9[_0x3200('0x32')]=_[_0x3200('0x2f')](db[_0x3200('0x4a')][_0x3200('0x2a')]);_0x534db9[_0x3200('0x2e')]=_[_0x3200('0x2f')](_0x71911c[_0x3200('0x2e')]);_0x534db9[_0x3200('0x30')]=_['intersection'](_0x534db9['model'],_0x534db9[_0x3200('0x2e')]);_0x8f1210[_0x3200('0x34')]=_[_0x3200('0x31')](_0x534db9[_0x3200('0x32')],qs[_0x3200('0x33')](_0x71911c[_0x3200('0x2e')][_0x3200('0x33')]));_0x8f1210['attributes']=_0x8f1210[_0x3200('0x34')]['length']?_0x8f1210['attributes']:_0x534db9[_0x3200('0x32')];_0x8f1210['order']=qs[_0x3200('0x37')](_0x71911c['query'][_0x3200('0x37')]);_0x8f1210[_0x3200('0x38')]=qs[_0x3200('0x30')](_[_0x3200('0x39')](_0x71911c[_0x3200('0x2e')],_0x534db9['filters']));if(_0x71911c['query']['filter']){_0x8f1210[_0x3200('0x38')]=_[_0x3200('0x3b')](_0x8f1210[_0x3200('0x38')],{'$or':_[_0x3200('0x2d')](_0x8f1210[_0x3200('0x34')],function(_0x18f43b){var _0x30ca45={};_0x30ca45[_0x18f43b]={'$like':'%'+_0x71911c[_0x3200('0x2e')][_0x3200('0x3a')]+'%'};return _0x30ca45;})});}_0x8f1210=_['merge']({},_0x8f1210,_0x71911c[_0x3200('0x3d')]);return _0x5b40b8['getSubjects'](_0x8f1210);}})[_0x3200('0x25')](function(_0x54ed28){if(_0x54ed28){_0x289b06=_0x54ed28['length'];if(!_0x71911c['query'][_0x3200('0x4c')](_0x3200('0x36'))){_0x8f1210[_0x3200('0x1c')]=qs[_0x3200('0x1c')](_0x71911c['query'][_0x3200('0x1c')]);_0x8f1210['offset']=qs[_0x3200('0x1a')](_0x71911c[_0x3200('0x2e')][_0x3200('0x1a')]);}return _0x5b40b8[_0x3200('0x4d')](_0x8f1210);}})[_0x3200('0x25')](function(_0x22d554){if(_0x22d554){return _0x22d554?{'count':_0x289b06,'rows':_0x22d554}:null;}})[_0x3200('0x25')](respondWithResult(_0x282d87,null))[_0x3200('0x42')](handleError(_0x282d87,null));};exports[_0x3200('0x4e')]=function(_0x2cd118,_0x4ecfa7,_0x5e52ba){var _0x5713ec={};var _0x5023b2={};var _0x511b1a;var _0x338420;return db[_0x3200('0x29')]['findOne']({'where':{'id':_0x2cd118['params']['id']}})[_0x3200('0x25')](handleEntityNotFound(_0x4ecfa7,null))[_0x3200('0x25')](function(_0x500a7a){if(_0x500a7a){_0x511b1a=_0x500a7a;_0x5023b2[_0x3200('0x32')]=_[_0x3200('0x2f')](db[_0x3200('0x4a')][_0x3200('0x2a')]);_0x5023b2[_0x3200('0x2e')]=_[_0x3200('0x2f')](_0x2cd118[_0x3200('0x2e')]);_0x5023b2[_0x3200('0x30')]=_[_0x3200('0x31')](_0x5023b2['model'],_0x5023b2[_0x3200('0x2e')]);_0x5713ec[_0x3200('0x34')]=_[_0x3200('0x31')](_0x5023b2[_0x3200('0x32')],qs['fields'](_0x2cd118[_0x3200('0x2e')][_0x3200('0x33')]));_0x5713ec['attributes']=_0x5713ec[_0x3200('0x34')][_0x3200('0x35')]?_0x5713ec[_0x3200('0x34')]:_0x5023b2[_0x3200('0x32')];_0x5713ec['order']=qs[_0x3200('0x37')](_0x2cd118[_0x3200('0x2e')][_0x3200('0x37')]);_0x5713ec[_0x3200('0x38')]=qs[_0x3200('0x30')](_[_0x3200('0x39')](_0x2cd118['query'],_0x5023b2[_0x3200('0x30')]));if(_0x2cd118[_0x3200('0x2e')][_0x3200('0x3a')]){_0x5713ec[_0x3200('0x38')]=_[_0x3200('0x3b')](_0x5713ec[_0x3200('0x38')],{'$or':_[_0x3200('0x2d')](_0x5713ec['attributes'],function(_0x3d02d3){var _0x3fbb9d={};_0x3fbb9d[_0x3d02d3]={'$like':'%'+_0x2cd118[_0x3200('0x2e')][_0x3200('0x3a')]+'%'};return _0x3fbb9d;})});}_0x5713ec=_['merge']({},_0x5713ec,_0x2cd118[_0x3200('0x3d')]);return _0x511b1a['getDescriptions'](_0x5713ec);}})[_0x3200('0x25')](function(_0x109645){if(_0x109645){_0x338420=_0x109645[_0x3200('0x35')];if(!_0x2cd118[_0x3200('0x2e')][_0x3200('0x4c')]('nolimit')){_0x5713ec[_0x3200('0x1c')]=qs['limit'](_0x2cd118['query']['limit']);_0x5713ec[_0x3200('0x1a')]=qs[_0x3200('0x1a')](_0x2cd118[_0x3200('0x2e')]['offset']);}return _0x511b1a['getDescriptions'](_0x5713ec);}})[_0x3200('0x25')](function(_0x1289fb){if(_0x1289fb){return _0x1289fb?{'count':_0x338420,'rows':_0x1289fb}:null;}})[_0x3200('0x25')](respondWithResult(_0x4ecfa7,null))[_0x3200('0x42')](handleError(_0x4ecfa7,null));};exports[_0x3200('0x4f')]=function(_0x1cc6f3,_0x2b5e5a,_0x5997ae){var _0x4a5dd3={};var _0x3e04dc={};var _0x4150a6;var _0x1166b7;return db[_0x3200('0x29')][_0x3200('0x49')]({'where':{'id':_0x1cc6f3[_0x3200('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b5e5a,null))['then'](function(_0x3e85bc){if(_0x3e85bc){_0x4150a6=_0x3e85bc;_0x3e04dc[_0x3200('0x32')]=_[_0x3200('0x2f')](db[_0x3200('0x50')][_0x3200('0x2a')]);_0x3e04dc[_0x3200('0x2e')]=_[_0x3200('0x2f')](_0x1cc6f3[_0x3200('0x2e')]);_0x3e04dc[_0x3200('0x30')]=_['intersection'](_0x3e04dc[_0x3200('0x32')],_0x3e04dc[_0x3200('0x2e')]);_0x4a5dd3[_0x3200('0x34')]=_[_0x3200('0x31')](_0x3e04dc[_0x3200('0x32')],qs[_0x3200('0x33')](_0x1cc6f3['query'][_0x3200('0x33')]));_0x4a5dd3[_0x3200('0x34')]=_0x4a5dd3['attributes'][_0x3200('0x35')]?_0x4a5dd3[_0x3200('0x34')]:_0x3e04dc[_0x3200('0x32')];_0x4a5dd3[_0x3200('0x4b')]=qs['sort'](_0x1cc6f3[_0x3200('0x2e')][_0x3200('0x37')]);_0x4a5dd3[_0x3200('0x38')]=qs[_0x3200('0x30')](_[_0x3200('0x39')](_0x1cc6f3['query'],_0x3e04dc['filters']));if(_0x1cc6f3[_0x3200('0x2e')][_0x3200('0x3a')]){_0x4a5dd3[_0x3200('0x38')]=_[_0x3200('0x3b')](_0x4a5dd3[_0x3200('0x38')],{'$or':_['map'](_0x4a5dd3['attributes'],function(_0x25597d){var _0x225e89={};_0x225e89[_0x25597d]={'$like':'%'+_0x1cc6f3['query'][_0x3200('0x3a')]+'%'};return _0x225e89;})});}_0x4a5dd3=_[_0x3200('0x3b')]({},_0x4a5dd3,_0x1cc6f3[_0x3200('0x3d')]);return _0x4150a6[_0x3200('0x4f')](_0x4a5dd3);}})[_0x3200('0x25')](function(_0xee4d2){if(_0xee4d2){_0x1166b7=_0xee4d2[_0x3200('0x35')];if(!_0x1cc6f3['query']['hasOwnProperty'](_0x3200('0x36'))){_0x4a5dd3[_0x3200('0x1c')]=qs['limit'](_0x1cc6f3[_0x3200('0x2e')]['limit']);_0x4a5dd3['offset']=qs['offset'](_0x1cc6f3[_0x3200('0x2e')][_0x3200('0x1a')]);}return _0x4150a6[_0x3200('0x4f')](_0x4a5dd3);}})['then'](function(_0x101f5c){if(_0x101f5c){return _0x101f5c?{'count':_0x1166b7,'rows':_0x101f5c}:null;}})['then'](respondWithResult(_0x2b5e5a,null))[_0x3200('0x42')](handleError(_0x2b5e5a,null));};exports[_0x3200('0x51')]=function(_0xf28fee,_0x449d40,_0x22fbef){if(_0xf28fee[_0x3200('0x46')]['id']){delete _0xf28fee[_0x3200('0x46')]['id'];}return db[_0x3200('0x29')][_0x3200('0x49')]({'where':{'id':_0xf28fee[_0x3200('0x43')]['id']}})[_0x3200('0x25')](handleEntityNotFound(_0x449d40,null))[_0x3200('0x25')](function(_0x109b67){if(_0x109b67){return _0x109b67[_0x3200('0x51')](_0xf28fee[_0x3200('0x46')][_0x3200('0x52')]||[]);}return null;})[_0x3200('0x25')](respondWithResult(_0x449d40,null))['catch'](handleError(_0x449d40,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e84a20e..0f0161a 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 _0x0a60=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x10530b,_0x305795){var _0x37ccf7=function(_0x42139f){while(--_0x42139f){_0x10530b['push'](_0x10530b['shift']());}};_0x37ccf7(++_0x305795);}(_0x0a60,0x159));var _0x00a6=function(_0x587601,_0x4493b0){_0x587601=_0x587601-0x0;var _0x5992da=_0x0a60[_0x587601];return _0x5992da;};'use strict';var _=require(_0x00a6('0x0'));var util=require(_0x00a6('0x1'));var logger=require('../../config/logger')(_0x00a6('0x2'));var moment=require(_0x00a6('0x3'));var BPromise=require(_0x00a6('0x4'));var rp=require(_0x00a6('0x5'));var fs=require('fs');var path=require(_0x00a6('0x6'));var rimraf=require(_0x00a6('0x7'));var config=require(_0x00a6('0x8'));var attributes=require(_0x00a6('0x9'));module['exports']=function(_0xe20417,_0x26d3b0){return _0xe20417[_0x00a6('0xa')](_0x00a6('0xb'),attributes,{'tableName':_0x00a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa785=['./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x110641,_0x48cdcd){var _0x1d3a1a=function(_0x5c6877){while(--_0x5c6877){_0x110641['push'](_0x110641['shift']());}};_0x1d3a1a(++_0x48cdcd);}(_0xa785,0x8a));var _0x5a78=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xa785[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x5a78('0x0'));var logger=require(_0x5a78('0x1'))(_0x5a78('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a78('0x3'));var fs=require('fs');var path=require(_0x5a78('0x4'));var rimraf=require(_0x5a78('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a78('0x6'));module['exports']=function(_0x13fd58,_0x3cd928){return _0x13fd58['define'](_0x5a78('0x7'),attributes,{'tableName':_0x5a78('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5430288..c9197a1 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 _0x9b44=['client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0x9b44,0x1d9));var _0x49b4=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x9b44[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x49b4('0x0'));var util=require(_0x49b4('0x1'));var moment=require(_0x49b4('0x2'));var BPromise=require(_0x49b4('0x3'));var rs=require(_0x49b4('0x4'));var fs=require('fs');var Redis=require(_0x49b4('0x5'));var db=require(_0x49b4('0x6'))['db'];var utils=require(_0x49b4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x49b4('0x8'));var jayson=require(_0x49b4('0x9'));var client=jayson[_0x49b4('0xa')][_0x49b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337c8d,_0x5ca3bc,_0x422f23){return new BPromise(function(_0x59d08f,_0x4f6b35){return client[_0x49b4('0xc')](_0x337c8d,_0x422f23)[_0x49b4('0xd')](function(_0x531e22){logger[_0x49b4('0xe')](_0x49b4('0xf'),_0x5ca3bc,'request\x20sent');logger[_0x49b4('0x10')](_0x49b4('0x11'),_0x5ca3bc,_0x49b4('0x12'),JSON[_0x49b4('0x13')](_0x531e22));if(_0x531e22['error']){if(_0x531e22[_0x49b4('0x14')]['code']===0x1f4){logger['error'](_0x49b4('0xf'),_0x5ca3bc,_0x531e22[_0x49b4('0x14')]['message']);return _0x4f6b35(_0x531e22[_0x49b4('0x14')][_0x49b4('0x15')]);}logger['error'](_0x49b4('0xf'),_0x5ca3bc,_0x531e22[_0x49b4('0x14')][_0x49b4('0x15')]);return _0x59d08f(_0x531e22[_0x49b4('0x14')]['message']);}else{logger[_0x49b4('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ca3bc,'request\x20sent');_0x59d08f(_0x531e22[_0x49b4('0x16')]['message']);}})['catch'](function(_0x40f338){logger[_0x49b4('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ca3bc,_0x40f338);_0x4f6b35(_0x40f338);});});} \ No newline at end of file +var _0x2e0e=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x328d98,_0x4a34a3){var _0x188eb5=function(_0x3133dd){while(--_0x3133dd){_0x328d98['push'](_0x328d98['shift']());}};_0x188eb5(++_0x4a34a3);}(_0x2e0e,0x84));var _0xe2e0=function(_0x3e8a33,_0x5a504f){_0x3e8a33=_0x3e8a33-0x0;var _0x300d47=_0x2e0e[_0x3e8a33];return _0x300d47;};'use strict';var _=require(_0xe2e0('0x0'));var util=require('util');var moment=require(_0xe2e0('0x1'));var BPromise=require(_0xe2e0('0x2'));var rs=require(_0xe2e0('0x3'));var fs=require('fs');var Redis=require(_0xe2e0('0x4'));var db=require(_0xe2e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2e0('0x6'))('rpc');var config=require(_0xe2e0('0x7'));var jayson=require(_0xe2e0('0x8'));var client=jayson['client'][_0xe2e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f206c,_0x1d7e1d,_0x174149){return new BPromise(function(_0x1cbbc6,_0x5b32de){return client[_0xe2e0('0xa')](_0x4f206c,_0x174149)[_0xe2e0('0xb')](function(_0x38d65a){logger[_0xe2e0('0xc')](_0xe2e0('0xd'),_0x1d7e1d,_0xe2e0('0xe'));logger[_0xe2e0('0xf')](_0xe2e0('0x10'),_0x1d7e1d,_0xe2e0('0xe'),JSON[_0xe2e0('0x11')](_0x38d65a));if(_0x38d65a['error']){if(_0x38d65a[_0xe2e0('0x12')][_0xe2e0('0x13')]===0x1f4){logger[_0xe2e0('0x12')](_0xe2e0('0xd'),_0x1d7e1d,_0x38d65a[_0xe2e0('0x12')][_0xe2e0('0x14')]);return _0x5b32de(_0x38d65a['error'][_0xe2e0('0x14')]);}logger[_0xe2e0('0x12')](_0xe2e0('0xd'),_0x1d7e1d,_0x38d65a['error'][_0xe2e0('0x14')]);return _0x1cbbc6(_0x38d65a[_0xe2e0('0x12')][_0xe2e0('0x14')]);}else{logger[_0xe2e0('0xc')](_0xe2e0('0xd'),_0x1d7e1d,'request\x20sent');_0x1cbbc6(_0x38d65a[_0xe2e0('0x15')][_0xe2e0('0x14')]);}})[_0xe2e0('0x16')](function(_0x509696){logger[_0xe2e0('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1d7e1d,_0x509696);_0x5b32de(_0x509696);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f0ac44a..36dfd1b 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 _0x34f1=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','post','create','update','destroy','exports','util','express','Router'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x34f1,0x185));var _0x134f=function(_0x50018f,_0x51e032){_0x50018f=_0x50018f-0x0;var _0x113953=_0x34f1[_0x50018f];return _0x113953;};'use strict';var multer=require('multer');var util=require(_0x134f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x134f('0x1'));var router=express[_0x134f('0x2')]();var fs_extra=require(_0x134f('0x3'));var auth=require(_0x134f('0x4'));var interaction=require(_0x134f('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x134f('0x6')](),controller[_0x134f('0x7')]);router['get'](_0x134f('0x8'),auth[_0x134f('0x6')](),controller['show']);router[_0x134f('0x9')]('/',auth[_0x134f('0x6')](),controller[_0x134f('0xa')]);router['put'](_0x134f('0x8'),auth[_0x134f('0x6')](),controller[_0x134f('0xb')]);router['delete']('/:id',auth[_0x134f('0x6')](),controller[_0x134f('0xc')]);module[_0x134f('0xd')]=router; \ No newline at end of file +var _0x25bf=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','post','isAuthenticated','create','put','/:id','update'];(function(_0x1bd2a6,_0x45f0fc){var _0x525206=function(_0x3ae097){while(--_0x3ae097){_0x1bd2a6['push'](_0x1bd2a6['shift']());}};_0x525206(++_0x45f0fc);}(_0x25bf,0xe5));var _0xf25b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x25bf[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xf25b('0x0'));var util=require(_0xf25b('0x1'));var path=require(_0xf25b('0x2'));var timeout=require(_0xf25b('0x3'));var express=require(_0xf25b('0x4'));var router=express[_0xf25b('0x5')]();var fs_extra=require(_0xf25b('0x6'));var auth=require(_0xf25b('0x7'));var interaction=require(_0xf25b('0x8'));var config=require(_0xf25b('0x9'));var controller=require('./intFreshdeskField.controller');router[_0xf25b('0xa')]('/',auth['isAuthenticated'](),controller[_0xf25b('0xb')]);router[_0xf25b('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf25b('0xc')]('/',auth[_0xf25b('0xd')](),controller[_0xf25b('0xe')]);router[_0xf25b('0xf')](_0xf25b('0x10'),auth[_0xf25b('0xd')](),controller[_0xf25b('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf25b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 79cdbb3..feac3d8 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 _0x0006=['BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0006,0x169));var _0x6000=function(_0x1a55be,_0x27568d){_0x1a55be=_0x1a55be-0x0;var _0x4e8432=_0x0006[_0x1a55be];return _0x4e8432;};'use strict';var Sequelize=require(_0x6000('0x0'));module[_0x6000('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6000('0x2'),_0x6000('0x3'),_0x6000('0x4'),_0x6000('0x5')),'defaultValue':_0x6000('0x6')},'content':{'type':Sequelize[_0x6000('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6000('0x8')](_0x6000('0x6'),'variable',_0x6000('0x3'))},'keyContent':{'type':Sequelize[_0x6000('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6000('0x7')]},'customField':{'type':Sequelize[_0x6000('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x955d=['sequelize','exports','string','keyValue','STRING','ENUM','variable'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0x955d,0x173));var _0xd955=function(_0x2b4753,_0x3abaeb){_0x2b4753=_0x2b4753-0x0;var _0x54048d=_0x955d[_0x2b4753];return _0x54048d;};'use strict';var Sequelize=require(_0xd955('0x0'));module[_0xd955('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd955('0x2'),'variable','customVariable',_0xd955('0x3'),'picklist'),'defaultValue':_0xd955('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd955('0x4')]},'keyType':{'type':Sequelize[_0xd955('0x5')]('string',_0xd955('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd955('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd955('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7ceb45e..54b4903 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 _0xaf80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x1222fa,_0x39a7b9){var _0x1dcd74=function(_0x18ebbf){while(--_0x18ebbf){_0x1222fa['push'](_0x1222fa['shift']());}};_0x1dcd74(++_0x39a7b9);}(_0xaf80,0x1ef));var _0x0af8=function(_0x2ae008,_0x349c5c){_0x2ae008=_0x2ae008-0x0;var _0x5514f9=_0xaf80[_0x2ae008];return _0x5514f9;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){_0x300474['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6306,_0x3b2a80){return function(_0x359583){if(!_0x359583){_0x1c6306[_0x0af8('0x16')](0x194);}return _0x359583;};}function handleError(_0x510efc,_0x500fd5){_0x500fd5=_0x500fd5||0x1f4;return function(_0x315ad){logger[_0x0af8('0x23')](_0x315ad[_0x0af8('0x24')]);if(_0x315ad[_0x0af8('0x25')]){delete _0x315ad[_0x0af8('0x25')];}_0x510efc[_0x0af8('0x17')](_0x500fd5)[_0x0af8('0x26')](_0x315ad);};}exports['index']=function(_0x34aa8b,_0xf898cc){var _0x1a7fdf={},_0x20eab4={},_0x1b94cf={'count':0x0,'rows':[]};var _0x231230=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x270b49){return{'name':_0x270b49[_0x0af8('0x2a')],'type':_0x270b49['type'][_0x0af8('0x2b')]};});_0x20eab4['model']=_[_0x0af8('0x27')](_0x231230,'name');_0x20eab4[_0x0af8('0x2c')]=_[_0x0af8('0x2d')](_0x34aa8b['query']);_0x20eab4[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],_0x20eab4['query']);_0x1a7fdf[_0x0af8('0x31')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],qs['fields'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x32')]));_0x1a7fdf[_0x0af8('0x31')]=_0x1a7fdf[_0x0af8('0x31')][_0x0af8('0x33')]?_0x1a7fdf[_0x0af8('0x31')]:_0x20eab4['model'];if(!_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x34')](_0x0af8('0x35'))){_0x1a7fdf[_0x0af8('0x36')]=qs[_0x0af8('0x36')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x36')]);_0x1a7fdf[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x1a')]);}_0x1a7fdf[_0x0af8('0x37')]=qs['sort'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x38')]);_0x1a7fdf[_0x0af8('0x39')]=qs[_0x0af8('0x2e')](_[_0x0af8('0x3a')](_0x34aa8b[_0x0af8('0x2c')],_0x20eab4[_0x0af8('0x2e')]),_0x231230);if(_0x34aa8b['query'][_0x0af8('0x3b')]){_0x1a7fdf[_0x0af8('0x39')]=_[_0x0af8('0x3c')](_0x1a7fdf['where'],{'$or':_[_0x0af8('0x27')](_0x231230,function(_0x1082de){if(_0x1082de[_0x0af8('0x3d')]!=='VIRTUAL'){var _0x6781fe={};_0x6781fe[_0x1082de[_0x0af8('0x25')]]={'$like':'%'+_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x3b')]+'%'};return _0x6781fe;}})});}_0x1a7fdf=_[_0x0af8('0x3c')]({},_0x1a7fdf,_0x34aa8b[_0x0af8('0x3e')]);var _0x258872={'where':_0x1a7fdf['where']};return db['FreshdeskField'][_0x0af8('0x1b')](_0x258872)[_0x0af8('0x21')](function(_0x5bc8f5){_0x1b94cf[_0x0af8('0x1b')]=_0x5bc8f5;if(_0x34aa8b[_0x0af8('0x2c')]['includeAll']){_0x1a7fdf[_0x0af8('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x0af8('0x40')](_0x1a7fdf);})[_0x0af8('0x21')](function(_0x510bec){_0x1b94cf[_0x0af8('0x41')]=_0x510bec;return _0x1b94cf;})[_0x0af8('0x21')](respondWithFilteredResult(_0xf898cc,_0x1a7fdf))['catch'](handleError(_0xf898cc,null));};exports[_0x0af8('0x42')]=function(_0x496ea4,_0x2e15ec){var _0x423eee={'raw':!![],'where':{'id':_0x496ea4['params']['id']}},_0x141d2f={};_0x141d2f['model']=_[_0x0af8('0x2d')](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x141d2f[_0x0af8('0x2c')]=_['keys'](_0x496ea4[_0x0af8('0x2c')]);_0x141d2f[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x141d2f['model'],_0x141d2f[_0x0af8('0x2c')]);_0x423eee[_0x0af8('0x31')]=_['intersection'](_0x141d2f[_0x0af8('0x30')],qs['fields'](_0x496ea4[_0x0af8('0x2c')]['fields']));_0x423eee['attributes']=_0x423eee['attributes'][_0x0af8('0x33')]?_0x423eee['attributes']:_0x141d2f[_0x0af8('0x30')];if(_0x496ea4['query'][_0x0af8('0x43')]){_0x423eee[_0x0af8('0x3f')]=[{'all':!![]}];}_0x423eee=_[_0x0af8('0x3c')]({},_0x423eee,_0x496ea4[_0x0af8('0x3e')]);return db[_0x0af8('0x28')]['find'](_0x423eee)['then'](handleEntityNotFound(_0x2e15ec,null))[_0x0af8('0x21')](respondWithResult(_0x2e15ec,null))[_0x0af8('0x44')](handleError(_0x2e15ec,null));};exports[_0x0af8('0x45')]=function(_0x24a104,_0x3d86e2){return db[_0x0af8('0x28')][_0x0af8('0x45')](_0x24a104['body'],{})['then'](respondWithResult(_0x3d86e2,0xc9))[_0x0af8('0x44')](handleError(_0x3d86e2,null));};exports[_0x0af8('0x20')]=function(_0x394525,_0x3c57dd){if(_0x394525['body']['id']){delete _0x394525[_0x0af8('0x46')]['id'];}return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x394525[_0x0af8('0x48')]['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x21')](saveUpdates(_0x394525['body'],null))[_0x0af8('0x21')](respondWithResult(_0x3c57dd,null))['catch'](handleError(_0x3c57dd,null));};exports[_0x0af8('0x22')]=function(_0x4a43e3,_0xeddce9){return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x4a43e3['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0xeddce9,null))[_0x0af8('0x21')](removeEntity(_0xeddce9,null))['catch'](handleError(_0xeddce9,null));}; \ No newline at end of file +var _0x9f4d=['fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','reject','update','then','destroy','sendStatus','stack','name','FreshdeskField','rawAttributes'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x1e77ed,_0x5720c1){_0x1e77ed=_0x1e77ed-0x0;var _0x32ed55=_0x9f4d[_0x1e77ed];return _0x32ed55;};'use strict';var emlformat=require(_0xd9f4('0x0'));var rimraf=require(_0xd9f4('0x1'));var zipdir=require(_0xd9f4('0x2'));var jsonpatch=require(_0xd9f4('0x3'));var rp=require(_0xd9f4('0x4'));var moment=require(_0xd9f4('0x5'));var BPromise=require(_0xd9f4('0x6'));var Mustache=require(_0xd9f4('0x7'));var util=require(_0xd9f4('0x8'));var path=require('path');var sox=require(_0xd9f4('0x9'));var csv=require('to-csv');var ejs=require(_0xd9f4('0xa'));var fs=require('fs');var fs_extra=require(_0xd9f4('0xb'));var _=require(_0xd9f4('0xc'));var squel=require(_0xd9f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9f4('0xe'));var deskjs=require(_0xd9f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9f4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9f4('0x11'));var authService=require(_0xd9f4('0x12'));var qs=require(_0xd9f4('0x13'));var as=require(_0xd9f4('0x14'));var hardwareService=require(_0xd9f4('0x15'));var logger=require('../../config/logger')(_0xd9f4('0x16'));var utils=require(_0xd9f4('0x17'));var config=require(_0xd9f4('0x18'));var licenseUtil=require(_0xd9f4('0x19'));var db=require(_0xd9f4('0x1a'))['db'];function respondWithStatusCode(_0x104834,_0x26383d){_0x26383d=_0x26383d||0xcc;return function(_0x131804){if(_0x131804){return _0x104834['sendStatus'](_0x26383d);}return _0x104834[_0xd9f4('0x1b')](_0x26383d)[_0xd9f4('0x1c')]();};}function respondWithResult(_0x158cdd,_0xef7729){_0xef7729=_0xef7729||0xc8;return function(_0x8a035d){if(_0x8a035d){return _0x158cdd[_0xd9f4('0x1b')](_0xef7729)[_0xd9f4('0x1d')](_0x8a035d);}};}function respondWithFilteredResult(_0x12dcfb,_0x35f71c){return function(_0x2ca827){if(_0x2ca827){var _0xfd15a4=typeof _0x35f71c[_0xd9f4('0x1e')]===_0xd9f4('0x1f')&&typeof _0x35f71c['limit']==='undefined';var _0x48ecd3=_0x2ca827['count'];var _0x25a7fe=_0xfd15a4?0x0:_0x35f71c[_0xd9f4('0x1e')];var _0xc01934=_0xfd15a4?_0x2ca827['count']:_0x35f71c[_0xd9f4('0x1e')]+_0x35f71c[_0xd9f4('0x20')];var _0x17d097;if(_0xc01934>=_0x48ecd3){_0xc01934=_0x48ecd3;_0x17d097=0xc8;}else{_0x17d097=0xce;}_0x12dcfb['status'](_0x17d097);return _0x12dcfb[_0xd9f4('0x21')]('Content-Range',_0x25a7fe+'-'+_0xc01934+'/'+_0x48ecd3)[_0xd9f4('0x1d')](_0x2ca827);}return null;};}function patchUpdates(_0x93e8df){return function(_0x7ec2ce){try{jsonpatch['apply'](_0x7ec2ce,_0x93e8df,!![]);}catch(_0x138ca7){return BPromise[_0xd9f4('0x22')](_0x138ca7);}return _0x7ec2ce['save']();};}function saveUpdates(_0x4ec0b3,_0x7196ab){return function(_0x59c8f6){if(_0x59c8f6){return _0x59c8f6[_0xd9f4('0x23')](_0x4ec0b3)[_0xd9f4('0x24')](function(_0x818cd5){return _0x818cd5;});}return null;};}function removeEntity(_0x2a89b6,_0x101e86){return function(_0x33ddd6){if(_0x33ddd6){return _0x33ddd6[_0xd9f4('0x25')]()[_0xd9f4('0x24')](function(){_0x2a89b6[_0xd9f4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x770a2c,_0x1814eb){return function(_0x1fe43b){if(!_0x1fe43b){_0x770a2c[_0xd9f4('0x26')](0x194);}return _0x1fe43b;};}function handleError(_0x3a82dd,_0x2ed32c){_0x2ed32c=_0x2ed32c||0x1f4;return function(_0x12958b){logger['error'](_0x12958b[_0xd9f4('0x27')]);if(_0x12958b[_0xd9f4('0x28')]){delete _0x12958b[_0xd9f4('0x28')];}_0x3a82dd[_0xd9f4('0x1b')](_0x2ed32c)['send'](_0x12958b);};}exports['index']=function(_0x478bc6,_0x261903){var _0x4b453b={},_0x2ca69a={},_0x453a08={'count':0x0,'rows':[]};var _0x5c9ec7=_['map'](db[_0xd9f4('0x29')][_0xd9f4('0x2a')],function(_0x5f6cb9){return{'name':_0x5f6cb9[_0xd9f4('0x2b')],'type':_0x5f6cb9[_0xd9f4('0x2c')][_0xd9f4('0x2d')]};});_0x2ca69a[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x5c9ec7,_0xd9f4('0x28'));_0x2ca69a[_0xd9f4('0x30')]=_[_0xd9f4('0x31')](_0x478bc6[_0xd9f4('0x30')]);_0x2ca69a['filters']=_[_0xd9f4('0x32')](_0x2ca69a['model'],_0x2ca69a[_0xd9f4('0x30')]);_0x4b453b[_0xd9f4('0x33')]=_[_0xd9f4('0x32')](_0x2ca69a[_0xd9f4('0x2e')],qs[_0xd9f4('0x34')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x34')]));_0x4b453b[_0xd9f4('0x33')]=_0x4b453b[_0xd9f4('0x33')][_0xd9f4('0x35')]?_0x4b453b[_0xd9f4('0x33')]:_0x2ca69a[_0xd9f4('0x2e')];if(!_0x478bc6[_0xd9f4('0x30')]['hasOwnProperty']('nolimit')){_0x4b453b['limit']=qs[_0xd9f4('0x20')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x20')]);_0x4b453b[_0xd9f4('0x1e')]=qs[_0xd9f4('0x1e')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x1e')]);}_0x4b453b[_0xd9f4('0x36')]=qs[_0xd9f4('0x37')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x37')]);_0x4b453b['where']=qs['filters'](_[_0xd9f4('0x38')](_0x478bc6[_0xd9f4('0x30')],_0x2ca69a[_0xd9f4('0x39')]),_0x5c9ec7);if(_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x3a')]){_0x4b453b[_0xd9f4('0x3b')]=_[_0xd9f4('0x3c')](_0x4b453b[_0xd9f4('0x3b')],{'$or':_[_0xd9f4('0x2f')](_0x5c9ec7,function(_0x1ce168){if(_0x1ce168[_0xd9f4('0x2c')]!==_0xd9f4('0x3d')){var _0x60feec={};_0x60feec[_0x1ce168['name']]={'$like':'%'+_0x478bc6['query'][_0xd9f4('0x3a')]+'%'};return _0x60feec;}})});}_0x4b453b=_[_0xd9f4('0x3c')]({},_0x4b453b,_0x478bc6[_0xd9f4('0x3e')]);var _0xc8c7a3={'where':_0x4b453b[_0xd9f4('0x3b')]};return db['FreshdeskField'][_0xd9f4('0x3f')](_0xc8c7a3)[_0xd9f4('0x24')](function(_0x522393){_0x453a08[_0xd9f4('0x3f')]=_0x522393;if(_0x478bc6[_0xd9f4('0x30')]['includeAll']){_0x4b453b[_0xd9f4('0x40')]=[{'all':!![]}];}return db[_0xd9f4('0x29')][_0xd9f4('0x41')](_0x4b453b);})[_0xd9f4('0x24')](function(_0xfc7b6c){_0x453a08[_0xd9f4('0x42')]=_0xfc7b6c;return _0x453a08;})[_0xd9f4('0x24')](respondWithFilteredResult(_0x261903,_0x4b453b))[_0xd9f4('0x43')](handleError(_0x261903,null));};exports['show']=function(_0x14aa9e,_0x4ab27a){var _0x48e236={'raw':!![],'where':{'id':_0x14aa9e['params']['id']}},_0x353a01={};_0x353a01[_0xd9f4('0x2e')]=_[_0xd9f4('0x31')](db[_0xd9f4('0x29')][_0xd9f4('0x2a')]);_0x353a01[_0xd9f4('0x30')]=_[_0xd9f4('0x31')](_0x14aa9e[_0xd9f4('0x30')]);_0x353a01['filters']=_[_0xd9f4('0x32')](_0x353a01[_0xd9f4('0x2e')],_0x353a01['query']);_0x48e236[_0xd9f4('0x33')]=_[_0xd9f4('0x32')](_0x353a01[_0xd9f4('0x2e')],qs[_0xd9f4('0x34')](_0x14aa9e['query'][_0xd9f4('0x34')]));_0x48e236[_0xd9f4('0x33')]=_0x48e236[_0xd9f4('0x33')][_0xd9f4('0x35')]?_0x48e236[_0xd9f4('0x33')]:_0x353a01['model'];if(_0x14aa9e[_0xd9f4('0x30')][_0xd9f4('0x44')]){_0x48e236[_0xd9f4('0x40')]=[{'all':!![]}];}_0x48e236=_[_0xd9f4('0x3c')]({},_0x48e236,_0x14aa9e['options']);return db[_0xd9f4('0x29')][_0xd9f4('0x45')](_0x48e236)['then'](handleEntityNotFound(_0x4ab27a,null))[_0xd9f4('0x24')](respondWithResult(_0x4ab27a,null))[_0xd9f4('0x43')](handleError(_0x4ab27a,null));};exports[_0xd9f4('0x46')]=function(_0x4c7d99,_0xbedc3){return db[_0xd9f4('0x29')][_0xd9f4('0x46')](_0x4c7d99[_0xd9f4('0x47')],{})[_0xd9f4('0x24')](respondWithResult(_0xbedc3,0xc9))[_0xd9f4('0x43')](handleError(_0xbedc3,null));};exports[_0xd9f4('0x23')]=function(_0x254af2,_0x360248){if(_0x254af2[_0xd9f4('0x47')]['id']){delete _0x254af2[_0xd9f4('0x47')]['id'];}return db['FreshdeskField'][_0xd9f4('0x45')]({'where':{'id':_0x254af2[_0xd9f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x360248,null))[_0xd9f4('0x24')](saveUpdates(_0x254af2[_0xd9f4('0x47')],null))[_0xd9f4('0x24')](respondWithResult(_0x360248,null))[_0xd9f4('0x43')](handleError(_0x360248,null));};exports[_0xd9f4('0x25')]=function(_0x37c1d9,_0x215df5){return db[_0xd9f4('0x29')][_0xd9f4('0x45')]({'where':{'id':_0x37c1d9['params']['id']}})['then'](handleEntityNotFound(_0x215df5,null))[_0xd9f4('0x24')](removeEntity(_0x215df5,null))[_0xd9f4('0x43')](handleError(_0x215df5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 57a862f..9c230dc 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 _0x61cd=['../../config/logger','api','path','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x513d09,_0x5cd567){var _0x1b6eb9=function(_0x5d7baf){while(--_0x5d7baf){_0x513d09['push'](_0x513d09['shift']());}};_0x1b6eb9(++_0x5cd567);}(_0x61cd,0xa7));var _0xd61c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x61cd[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd61c('0x0'));var util=require(_0xd61c('0x1'));var logger=require(_0xd61c('0x2'))(_0xd61c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd61c('0x4'));var rimraf=require('rimraf');var config=require(_0xd61c('0x5'));var attributes=require(_0xd61c('0x6'));module['exports']=function(_0x4972ad,_0x3787f3){return _0x4972ad[_0xd61c('0x7')](_0xd61c('0x8'),attributes,{'tableName':_0xd61c('0x9'),'paranoid':![],'indexes':[{'name':_0xd61c('0xa'),'fields':[_0xd61c('0xb'),_0xd61c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18e6=['bluebird','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','lodash','../../config/logger','api','moment'];(function(_0x3c989b,_0x53999a){var _0x1c68d2=function(_0x97255e){while(--_0x97255e){_0x3c989b['push'](_0x3c989b['shift']());}};_0x1c68d2(++_0x53999a);}(_0x18e6,0x14c));var _0x618e=function(_0x52b23d,_0x4e31f2){_0x52b23d=_0x52b23d-0x0;var _0x419bfd=_0x18e6[_0x52b23d];return _0x419bfd;};'use strict';var _=require(_0x618e('0x0'));var util=require('util');var logger=require(_0x618e('0x1'))(_0x618e('0x2'));var moment=require(_0x618e('0x3'));var BPromise=require(_0x618e('0x4'));var rp=require(_0x618e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x618e('0x6'));var attributes=require(_0x618e('0x7'));module[_0x618e('0x8')]=function(_0x5e2141,_0x4b2152){return _0x5e2141['define'](_0x618e('0x9'),attributes,{'tableName':_0x618e('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x618e('0xb')],'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 fb4182f..581381d 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 _0x3260=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x3260,0xd0));var _0x0326=function(_0x47e3ef,_0x551b2c){_0x47e3ef=_0x47e3ef-0x0;var _0x502417=_0x3260[_0x47e3ef];return _0x502417;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0326('0x0'));var BPromise=require(_0x0326('0x1'));var rs=require(_0x0326('0x2'));var fs=require('fs');var Redis=require(_0x0326('0x3'));var db=require(_0x0326('0x4'))['db'];var utils=require(_0x0326('0x5'));var logger=require(_0x0326('0x6'))(_0x0326('0x7'));var config=require(_0x0326('0x8'));var jayson=require(_0x0326('0x9'));var client=jayson['client'][_0x0326('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536c48,_0x4cdcc4,_0x3679da){return new BPromise(function(_0x15391c,_0x40135e){return client[_0x0326('0xb')](_0x536c48,_0x3679da)['then'](function(_0x54ea35){logger[_0x0326('0xc')](_0x0326('0xd'),_0x4cdcc4,_0x0326('0xe'));logger[_0x0326('0xf')](_0x0326('0x10'),_0x4cdcc4,'request\x20sent',JSON[_0x0326('0x11')](_0x54ea35));if(_0x54ea35[_0x0326('0x12')]){if(_0x54ea35[_0x0326('0x12')][_0x0326('0x13')]===0x1f4){logger[_0x0326('0x12')](_0x0326('0xd'),_0x4cdcc4,_0x54ea35[_0x0326('0x12')][_0x0326('0x14')]);return _0x40135e(_0x54ea35[_0x0326('0x12')][_0x0326('0x14')]);}logger[_0x0326('0x12')](_0x0326('0xd'),_0x4cdcc4,_0x54ea35['error'][_0x0326('0x14')]);return _0x15391c(_0x54ea35[_0x0326('0x12')][_0x0326('0x14')]);}else{logger[_0x0326('0xc')](_0x0326('0xd'),_0x4cdcc4,'request\x20sent');_0x15391c(_0x54ea35[_0x0326('0x15')]['message']);}})['catch'](function(_0x6df0db){logger[_0x0326('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4cdcc4,_0x6df0db);_0x40135e(_0x6df0db);});});} \ No newline at end of file +var _0x2fde=['http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1d7535,_0x1087e8){var _0x2b9329=function(_0x3a31a2){while(--_0x3a31a2){_0x1d7535['push'](_0x1d7535['shift']());}};_0x2b9329(++_0x1087e8);}(_0x2fde,0x8a));var _0xe2fd=function(_0x1fe295,_0x167f46){_0x1fe295=_0x1fe295-0x0;var _0x1fede9=_0x2fde[_0x1fe295];return _0x1fede9;};'use strict';var _=require(_0xe2fd('0x0'));var util=require(_0xe2fd('0x1'));var moment=require('moment');var BPromise=require(_0xe2fd('0x2'));var rs=require(_0xe2fd('0x3'));var fs=require('fs');var Redis=require(_0xe2fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2fd('0x5'))('rpc');var config=require(_0xe2fd('0x6'));var jayson=require(_0xe2fd('0x7'));var client=jayson[_0xe2fd('0x8')][_0xe2fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b5b4,_0x42fc14,_0x503588){return new BPromise(function(_0x4a35bb,_0x55a06d){return client[_0xe2fd('0xa')](_0x32b5b4,_0x503588)[_0xe2fd('0xb')](function(_0x3a7f60){logger['info'](_0xe2fd('0xc'),_0x42fc14,_0xe2fd('0xd'));logger['debug'](_0xe2fd('0xe'),_0x42fc14,_0xe2fd('0xd'),JSON['stringify'](_0x3a7f60));if(_0x3a7f60[_0xe2fd('0xf')]){if(_0x3a7f60[_0xe2fd('0xf')][_0xe2fd('0x10')]===0x1f4){logger['error'](_0xe2fd('0xc'),_0x42fc14,_0x3a7f60[_0xe2fd('0xf')][_0xe2fd('0x11')]);return _0x55a06d(_0x3a7f60['error'][_0xe2fd('0x11')]);}logger['error'](_0xe2fd('0xc'),_0x42fc14,_0x3a7f60[_0xe2fd('0xf')][_0xe2fd('0x11')]);return _0x4a35bb(_0x3a7f60['error'][_0xe2fd('0x11')]);}else{logger[_0xe2fd('0x12')](_0xe2fd('0xc'),_0x42fc14,'request\x20sent');_0x4a35bb(_0x3a7f60[_0xe2fd('0x13')][_0xe2fd('0x11')]);}})[_0xe2fd('0x14')](function(_0x2a5141){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x42fc14,_0x2a5141);_0x55a06d(_0x2a5141);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index c177a49..51a9d79 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 _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x27c2f2,_0x101d20){var _0x17ad6b=function(_0x30f928){while(--_0x30f928){_0x27c2f2['push'](_0x27c2f2['shift']());}};_0x17ad6b(++_0x101d20);}(_0xc900,0xb3));var _0x0c90=function(_0x655bee,_0x2d6187){_0x655bee=_0x655bee-0x0;var _0x3c0d9a=_0xc900[_0x655bee];return _0x3c0d9a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0xda3f=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x481f1d,_0x3c80c1){var _0x5e283=function(_0x2db1df){while(--_0x2db1df){_0x481f1d['push'](_0x481f1d['shift']());}};_0x5e283(++_0x3c80c1);}(_0xda3f,0xec));var _0xfda3=function(_0x274558,_0x4c9a47){_0x274558=_0x274558-0x0;var _0x540e38=_0xda3f[_0x274558];return _0x540e38;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['put'](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfda3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b6db750..acc0b7a 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x539e76,_0x4af94b){var _0x83b231=function(_0x1e6c9c){while(--_0x1e6c9c){_0x539e76['push'](_0x539e76['shift']());}};_0x83b231(++_0x4af94b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x241e23,_0x2d8bf6){_0x241e23=_0x241e23-0x0;var _0x8ee488=_0xb03e[_0x241e23];return _0x8ee488;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x5cc532,_0x24c122){var _0x2efdd4=function(_0x32a9d1){while(--_0x32a9d1){_0x5cc532['push'](_0x5cc532['shift']());}};_0x2efdd4(++_0x24c122);}(_0x7096,0x10c));var _0x6709=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7096[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('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 c146aaa..c124087 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 _0xba81=['querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','index','FreshsalesAccount','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js'];(function(_0x2eedc3,_0x4e7fdc){var _0xb4da6a=function(_0x5b4f53){while(--_0x5b4f53){_0x2eedc3['push'](_0x2eedc3['shift']());}};_0xb4da6a(++_0x4e7fdc);}(_0xba81,0x11d));var _0x1ba8=function(_0x7ac6d3,_0x5511bd){_0x7ac6d3=_0x7ac6d3-0x0;var _0xa1e3df=_0xba81[_0x7ac6d3];return _0xa1e3df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ba8('0x0'));var zipdir=require(_0x1ba8('0x1'));var jsonpatch=require(_0x1ba8('0x2'));var rp=require(_0x1ba8('0x3'));var moment=require(_0x1ba8('0x4'));var BPromise=require(_0x1ba8('0x5'));var Mustache=require(_0x1ba8('0x6'));var util=require(_0x1ba8('0x7'));var path=require(_0x1ba8('0x8'));var sox=require(_0x1ba8('0x9'));var csv=require(_0x1ba8('0xa'));var ejs=require(_0x1ba8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ba8('0xc'));var squel=require(_0x1ba8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ba8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ba8('0xf'));var Papa=require('papaparse');var Redis=require(_0x1ba8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ba8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ba8('0x12'));var logger=require('../../config/logger')(_0x1ba8('0x13'));var utils=require(_0x1ba8('0x14'));var config=require(_0x1ba8('0x15'));var licenseUtil=require(_0x1ba8('0x16'));var db=require(_0x1ba8('0x17'))['db'];var integrations=require(_0x1ba8('0x18'));function respondWithStatusCode(_0x53487f,_0x547e9d){_0x547e9d=_0x547e9d||0xcc;return function(_0x5b92b8){if(_0x5b92b8){return _0x53487f[_0x1ba8('0x19')](_0x547e9d);}return _0x53487f[_0x1ba8('0x1a')](_0x547e9d)['end']();};}function respondWithResult(_0x4ae0a7,_0x313082){_0x313082=_0x313082||0xc8;return function(_0x10d6a1){if(_0x10d6a1){return _0x4ae0a7[_0x1ba8('0x1a')](_0x313082)['json'](_0x10d6a1);}};}function respondWithFilteredResult(_0x12c89c,_0xa643f4){return function(_0xa59ce){if(_0xa59ce){var _0x103cac=typeof _0xa643f4['offset']==='undefined'&&typeof _0xa643f4['limit']===_0x1ba8('0x1b');var _0x41fd4c=_0xa59ce[_0x1ba8('0x1c')];var _0x308282=_0x103cac?0x0:_0xa643f4[_0x1ba8('0x1d')];var _0x271bff=_0x103cac?_0xa59ce[_0x1ba8('0x1c')]:_0xa643f4['offset']+_0xa643f4[_0x1ba8('0x1e')];var _0x3b6fa1;if(_0x271bff>=_0x41fd4c){_0x271bff=_0x41fd4c;_0x3b6fa1=0xc8;}else{_0x3b6fa1=0xce;}_0x12c89c[_0x1ba8('0x1a')](_0x3b6fa1);return _0x12c89c[_0x1ba8('0x1f')](_0x1ba8('0x20'),_0x308282+'-'+_0x271bff+'/'+_0x41fd4c)['json'](_0xa59ce);}return null;};}function patchUpdates(_0x5a4921){return function(_0x50c9b3){try{jsonpatch[_0x1ba8('0x21')](_0x50c9b3,_0x5a4921,!![]);}catch(_0xa71d82){return BPromise['reject'](_0xa71d82);}return _0x50c9b3[_0x1ba8('0x22')]();};}function saveUpdates(_0x258122,_0x3cb651){return function(_0x1a4001){if(_0x1a4001){return _0x1a4001[_0x1ba8('0x23')](_0x258122)[_0x1ba8('0x24')](function(_0x1e61ba){return _0x1e61ba;});}return null;};}function removeEntity(_0x338259,_0x4562a1){return function(_0x121590){if(_0x121590){return _0x121590[_0x1ba8('0x25')]()['then'](function(){_0x338259[_0x1ba8('0x1a')](0xcc)[_0x1ba8('0x26')]();});}};}function handleEntityNotFound(_0x20c803,_0x14b4fa){return function(_0x2bb4fa){if(!_0x2bb4fa){_0x20c803['sendStatus'](0x194);}return _0x2bb4fa;};}function handleError(_0x5ef632,_0x5adc81){_0x5adc81=_0x5adc81||0x1f4;return function(_0x3b34b8){logger[_0x1ba8('0x27')](_0x3b34b8['stack']);if(_0x3b34b8[_0x1ba8('0x28')]){delete _0x3b34b8[_0x1ba8('0x28')];}_0x5ef632[_0x1ba8('0x1a')](_0x5adc81)['send'](_0x3b34b8);};}exports[_0x1ba8('0x29')]=function(_0x425b45,_0x32d5ed){var _0x197875={},_0x40e260={},_0xdcc198={'count':0x0,'rows':[]};var _0x3add1d=_['map'](db[_0x1ba8('0x2a')][_0x1ba8('0x2b')],function(_0x38e42c){return{'name':_0x38e42c['fieldName'],'type':_0x38e42c[_0x1ba8('0x2c')][_0x1ba8('0x2d')]};});_0x40e260[_0x1ba8('0x2e')]=_[_0x1ba8('0x2f')](_0x3add1d,'name');_0x40e260[_0x1ba8('0x30')]=_['keys'](_0x425b45[_0x1ba8('0x30')]);_0x40e260['filters']=_[_0x1ba8('0x31')](_0x40e260[_0x1ba8('0x2e')],_0x40e260[_0x1ba8('0x30')]);_0x197875['attributes']=_[_0x1ba8('0x31')](_0x40e260[_0x1ba8('0x2e')],qs[_0x1ba8('0x32')](_0x425b45[_0x1ba8('0x30')][_0x1ba8('0x32')]));_0x197875[_0x1ba8('0x33')]=_0x197875[_0x1ba8('0x33')][_0x1ba8('0x34')]?_0x197875[_0x1ba8('0x33')]:_0x40e260[_0x1ba8('0x2e')];if(!_0x425b45[_0x1ba8('0x30')]['hasOwnProperty'](_0x1ba8('0x35'))){_0x197875['limit']=qs[_0x1ba8('0x1e')](_0x425b45[_0x1ba8('0x30')]['limit']);_0x197875[_0x1ba8('0x1d')]=qs[_0x1ba8('0x1d')](_0x425b45['query']['offset']);}_0x197875[_0x1ba8('0x36')]=qs[_0x1ba8('0x37')](_0x425b45[_0x1ba8('0x30')][_0x1ba8('0x37')]);_0x197875[_0x1ba8('0x38')]=qs[_0x1ba8('0x39')](_[_0x1ba8('0x3a')](_0x425b45[_0x1ba8('0x30')],_0x40e260[_0x1ba8('0x39')]),_0x3add1d);if(_0x425b45[_0x1ba8('0x30')][_0x1ba8('0x3b')]){_0x197875['where']=_[_0x1ba8('0x3c')](_0x197875[_0x1ba8('0x38')],{'$or':_[_0x1ba8('0x2f')](_0x3add1d,function(_0x53528e){if(_0x53528e[_0x1ba8('0x2c')]!==_0x1ba8('0x3d')){var _0x445b7a={};_0x445b7a[_0x53528e[_0x1ba8('0x28')]]={'$like':'%'+_0x425b45['query']['filter']+'%'};return _0x445b7a;}})});}_0x197875=_[_0x1ba8('0x3c')]({},_0x197875,_0x425b45['options']);var _0xa5e8e2={'where':_0x197875['where']};return db[_0x1ba8('0x2a')][_0x1ba8('0x1c')](_0xa5e8e2)['then'](function(_0x3b7917){_0xdcc198['count']=_0x3b7917;if(_0x425b45[_0x1ba8('0x30')][_0x1ba8('0x3e')]){_0x197875[_0x1ba8('0x3f')]=[{'all':!![]}];}return db[_0x1ba8('0x2a')][_0x1ba8('0x40')](_0x197875);})[_0x1ba8('0x24')](function(_0x56a167){_0xdcc198[_0x1ba8('0x41')]=_0x56a167;return _0xdcc198;})[_0x1ba8('0x24')](respondWithFilteredResult(_0x32d5ed,_0x197875))[_0x1ba8('0x42')](handleError(_0x32d5ed,null));};exports[_0x1ba8('0x43')]=function(_0x15b0d4,_0x371d3a){var _0x44c4bf={'raw':![],'where':{'id':_0x15b0d4[_0x1ba8('0x44')]['id']}},_0x5f22aa={};_0x5f22aa['model']=_[_0x1ba8('0x45')](db['FreshsalesAccount'][_0x1ba8('0x2b')]);_0x5f22aa[_0x1ba8('0x30')]=_[_0x1ba8('0x45')](_0x15b0d4[_0x1ba8('0x30')]);_0x5f22aa['filters']=_[_0x1ba8('0x31')](_0x5f22aa[_0x1ba8('0x2e')],_0x5f22aa[_0x1ba8('0x30')]);_0x44c4bf[_0x1ba8('0x33')]=_[_0x1ba8('0x31')](_0x5f22aa[_0x1ba8('0x2e')],qs['fields'](_0x15b0d4[_0x1ba8('0x30')][_0x1ba8('0x32')]));_0x44c4bf[_0x1ba8('0x33')]=_0x44c4bf[_0x1ba8('0x33')][_0x1ba8('0x34')]?_0x44c4bf[_0x1ba8('0x33')]:_0x5f22aa['model'];if(_0x15b0d4['query']['includeAll']){_0x44c4bf['include']=[{'all':!![]}];}_0x44c4bf=_[_0x1ba8('0x3c')]({},_0x44c4bf,_0x15b0d4[_0x1ba8('0x46')]);return db['FreshsalesAccount']['find'](_0x44c4bf)['then'](handleEntityNotFound(_0x371d3a,null))[_0x1ba8('0x24')](respondWithResult(_0x371d3a,null))[_0x1ba8('0x42')](handleError(_0x371d3a,null));};exports['create']=function(_0x5f4914,_0x1174f7){return db['FreshsalesAccount'][_0x1ba8('0x47')](_0x5f4914[_0x1ba8('0x48')],{})[_0x1ba8('0x24')](respondWithResult(_0x1174f7,0xc9))[_0x1ba8('0x42')](handleError(_0x1174f7,null));};exports[_0x1ba8('0x23')]=function(_0x3f7974,_0x5e82c4){if(_0x3f7974[_0x1ba8('0x48')]['id']){delete _0x3f7974[_0x1ba8('0x48')]['id'];}return db[_0x1ba8('0x2a')]['find']({'where':{'id':_0x3f7974[_0x1ba8('0x44')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x5e82c4,null))[_0x1ba8('0x24')](saveUpdates(_0x3f7974[_0x1ba8('0x48')],null))[_0x1ba8('0x24')](respondWithResult(_0x5e82c4,null))[_0x1ba8('0x42')](handleError(_0x5e82c4,null));};exports['destroy']=function(_0x1667c7,_0x34c672){return db[_0x1ba8('0x2a')][_0x1ba8('0x49')]({'where':{'id':_0x1667c7[_0x1ba8('0x44')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x34c672,null))['then'](removeEntity(_0x34c672,null))[_0x1ba8('0x42')](handleError(_0x34c672,null));};exports[_0x1ba8('0x4a')]=function(_0x49bca8,_0x43c9cc,_0x5388d6){var _0xeea5df={};var _0x2370db={};var _0x3a7ed7;var _0x3d0991;return db[_0x1ba8('0x2a')][_0x1ba8('0x4b')]({'where':{'id':_0x49bca8['params']['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x43c9cc,null))[_0x1ba8('0x24')](function(_0x15f6c0){if(_0x15f6c0){_0x3a7ed7=_0x15f6c0;_0x2370db[_0x1ba8('0x2e')]=_[_0x1ba8('0x45')](db[_0x1ba8('0x4c')][_0x1ba8('0x2b')]);_0x2370db[_0x1ba8('0x30')]=_['keys'](_0x49bca8['query']);_0x2370db[_0x1ba8('0x39')]=_['intersection'](_0x2370db[_0x1ba8('0x2e')],_0x2370db[_0x1ba8('0x30')]);_0xeea5df['attributes']=_[_0x1ba8('0x31')](_0x2370db[_0x1ba8('0x2e')],qs[_0x1ba8('0x32')](_0x49bca8['query'][_0x1ba8('0x32')]));_0xeea5df[_0x1ba8('0x33')]=_0xeea5df['attributes'][_0x1ba8('0x34')]?_0xeea5df['attributes']:_0x2370db[_0x1ba8('0x2e')];_0xeea5df[_0x1ba8('0x36')]=qs[_0x1ba8('0x37')](_0x49bca8[_0x1ba8('0x30')]['sort']);_0xeea5df[_0x1ba8('0x38')]=qs[_0x1ba8('0x39')](_[_0x1ba8('0x3a')](_0x49bca8['query'],_0x2370db[_0x1ba8('0x39')]));if(_0x49bca8[_0x1ba8('0x30')][_0x1ba8('0x3b')]){_0xeea5df['where']=_[_0x1ba8('0x3c')](_0xeea5df[_0x1ba8('0x38')],{'$or':_[_0x1ba8('0x2f')](_0xeea5df[_0x1ba8('0x33')],function(_0x4d4bd5){var _0x12847f={};_0x12847f[_0x4d4bd5]={'$like':'%'+_0x49bca8[_0x1ba8('0x30')][_0x1ba8('0x3b')]+'%'};return _0x12847f;})});}_0xeea5df=_['merge']({},_0xeea5df,_0x49bca8[_0x1ba8('0x46')]);return _0x3a7ed7[_0x1ba8('0x4a')](_0xeea5df);}})[_0x1ba8('0x24')](function(_0x3df11f){if(_0x3df11f){_0x3d0991=_0x3df11f[_0x1ba8('0x34')];if(!_0x49bca8['query'][_0x1ba8('0x4d')](_0x1ba8('0x35'))){_0xeea5df[_0x1ba8('0x1e')]=qs[_0x1ba8('0x1e')](_0x49bca8[_0x1ba8('0x30')][_0x1ba8('0x1e')]);_0xeea5df[_0x1ba8('0x1d')]=qs[_0x1ba8('0x1d')](_0x49bca8[_0x1ba8('0x30')]['offset']);}return _0x3a7ed7[_0x1ba8('0x4a')](_0xeea5df);}})[_0x1ba8('0x24')](function(_0x48de99){if(_0x48de99){return _0x48de99?{'count':_0x3d0991,'rows':_0x48de99}:null;}})['then'](respondWithResult(_0x43c9cc,null))[_0x1ba8('0x42')](handleError(_0x43c9cc,null));};exports['addConfiguration']=function(_0x2188e2,_0x264440,_0x467ffe){if(_0x2188e2['body']['id']){delete _0x2188e2['body']['id'];}return db[_0x1ba8('0x2a')][_0x1ba8('0x4b')]({'where':{'id':_0x2188e2[_0x1ba8('0x44')]['id']}})[_0x1ba8('0x24')](handleEntityNotFound(_0x264440,null))[_0x1ba8('0x24')](function(_0x5878c0){if(_0x5878c0){_0x2188e2['body']['AccountId']=_0x5878c0['id'];_0x2188e2[_0x1ba8('0x48')][_0x1ba8('0x4e')]=integrations[_0x1ba8('0x4f')](_0x2188e2['body'][_0x1ba8('0x50')],_0x2188e2['body'][_0x1ba8('0x2c')]);_0x2188e2[_0x1ba8('0x48')][_0x1ba8('0x51')]=integrations['getDescriptions'](_0x2188e2[_0x1ba8('0x48')]['channel'],_0x2188e2['body'][_0x1ba8('0x2c')]);return db[_0x1ba8('0x4c')][_0x1ba8('0x47')](_0x2188e2[_0x1ba8('0x48')],{'include':[{'model':db[_0x1ba8('0x52')],'as':_0x1ba8('0x4e')},{'model':db['FreshsalesField'],'as':_0x1ba8('0x51')}]});}return null;})[_0x1ba8('0x24')](respondWithResult(_0x264440,null))[_0x1ba8('0x42')](handleError(_0x264440,null));};exports['getFields']=function(_0x190f9e,_0x266eaf,_0x372d09){var _0x26cced='';var _0x547671='';return db['FreshsalesAccount'][_0x1ba8('0x4b')]({'where':{'id':_0x190f9e[_0x1ba8('0x44')]['id']},'attributes':['id',_0x1ba8('0x53'),_0x1ba8('0x54'),_0x1ba8('0x55')]})['then'](handleEntityNotFound(_0x266eaf,null))[_0x1ba8('0x24')](function(_0x137251){if(_0x137251){_0x547671=_0x137251['username'];_0x26cced=_0x137251[_0x1ba8('0x54')];var _0x218999=_0x137251[_0x1ba8('0x54')][_0x1ba8('0x56')](-0x1);if(_0x218999==='/'){_0x26cced=_0x26cced[_0x1ba8('0x57')](0x0,_0x26cced[_0x1ba8('0x58')](_0x218999));}return rp({'method':_0x1ba8('0x59'),'uri':util[_0x1ba8('0x5a')](_0x1ba8('0x5b'),_0x26cced,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x137251['apiKey']},'json':!![]});}})[_0x1ba8('0x24')](function(_0x12c99c){if(_0x12c99c){var _0x47d7b6=_0x12c99c['users'];var _0x493218=![];var _0x351f85=null;for(_0x351f85=0x0;_0x351f85<_0x47d7b6[_0x1ba8('0x34')];_0x351f85++){if(_0x47d7b6[_0x351f85][_0x1ba8('0x5c')]===_0x547671){_0x493218=!![];}}if(_0x493218){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1ba8('0x5d')});}}})['then'](respondWithResult(_0x266eaf,null))[_0x1ba8('0x42')](function(_0x15b051){var _0x1500fb=_0x190f9e[_0x1ba8('0x30')][_0x1ba8('0x5e')]?0x1f4:_0x15b051[_0x1ba8('0x5f')]||0x1f4;logger[_0x1ba8('0x27')](_0x1ba8('0x60'),'getFields',_0x1500fb,JSON[_0x1ba8('0x61')](_0x15b051));delete _0x15b051[_0x1ba8('0x28')];if(_0x1500fb===0x191){_0x1500fb=0x190;}_0x266eaf[_0x1ba8('0x1a')](_0x1500fb)[_0x1ba8('0x62')](_0x190f9e[_0x1ba8('0x30')][_0x1ba8('0x5e')]?{'message':_0x1ba8('0x63'),'statusCode':_0x15b051[_0x1ba8('0x5f')]}:_0x15b051);});}; \ No newline at end of file +var _0x620c=['nolimit','sort','pick','filter','merge','VIRTUAL','options','where','FreshsalesAccount','count','includeAll','include','findAll','rows','show','intersection','find','catch','body','params','getConfigurations','findOne','FreshsalesConfiguration','order','AccountId','Subjects','channel','Descriptions','create','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','length','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','fields','hasOwnProperty'];(function(_0x2e409e,_0x2d227e){var _0xe6e039=function(_0x47195d){while(--_0x47195d){_0x2e409e['push'](_0x2e409e['shift']());}};_0xe6e039(++_0x2d227e);}(_0x620c,0x1bd));var _0xc620=function(_0x5dfbda,_0x249b85){_0x5dfbda=_0x5dfbda-0x0;var _0xf6a18d=_0x620c[_0x5dfbda];return _0xf6a18d;};'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(_0xc620('0x0'));var moment=require(_0xc620('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc620('0x2'));var util=require('util');var path=require(_0xc620('0x3'));var sox=require(_0xc620('0x4'));var csv=require(_0xc620('0x5'));var ejs=require(_0xc620('0x6'));var fs=require('fs');var fs_extra=require(_0xc620('0x7'));var _=require(_0xc620('0x8'));var squel=require(_0xc620('0x9'));var crypto=require(_0xc620('0xa'));var jsforce=require(_0xc620('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc620('0x5'));var querystring=require(_0xc620('0xc'));var Papa=require(_0xc620('0xd'));var Redis=require(_0xc620('0xe'));var authService=require(_0xc620('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc620('0x10'));var logger=require('../../config/logger')(_0xc620('0x11'));var utils=require('../../config/utils');var config=require(_0xc620('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc620('0x13'))['db'];var integrations=require(_0xc620('0x14'));function respondWithStatusCode(_0x498ea0,_0x55474c){_0x55474c=_0x55474c||0xcc;return function(_0x119dd8){if(_0x119dd8){return _0x498ea0[_0xc620('0x15')](_0x55474c);}return _0x498ea0[_0xc620('0x16')](_0x55474c)[_0xc620('0x17')]();};}function respondWithResult(_0x278503,_0x34ed65){_0x34ed65=_0x34ed65||0xc8;return function(_0x5524f8){if(_0x5524f8){return _0x278503['status'](_0x34ed65)['json'](_0x5524f8);}};}function respondWithFilteredResult(_0x4861e9,_0x4fb990){return function(_0x504a1c){if(_0x504a1c){var _0x263904=typeof _0x4fb990[_0xc620('0x18')]===_0xc620('0x19')&&typeof _0x4fb990[_0xc620('0x1a')]==='undefined';var _0x1a9af1=_0x504a1c['count'];var _0x4df0cf=_0x263904?0x0:_0x4fb990[_0xc620('0x18')];var _0x1a81cf=_0x263904?_0x504a1c['count']:_0x4fb990[_0xc620('0x18')]+_0x4fb990['limit'];var _0x52e79e;if(_0x1a81cf>=_0x1a9af1){_0x1a81cf=_0x1a9af1;_0x52e79e=0xc8;}else{_0x52e79e=0xce;}_0x4861e9['status'](_0x52e79e);return _0x4861e9[_0xc620('0x1b')](_0xc620('0x1c'),_0x4df0cf+'-'+_0x1a81cf+'/'+_0x1a9af1)[_0xc620('0x1d')](_0x504a1c);}return null;};}function patchUpdates(_0x8462b4){return function(_0x30160b){try{jsonpatch[_0xc620('0x1e')](_0x30160b,_0x8462b4,!![]);}catch(_0x46ab31){return BPromise['reject'](_0x46ab31);}return _0x30160b[_0xc620('0x1f')]();};}function saveUpdates(_0x46d5c2,_0x1207bc){return function(_0x3ea2ae){if(_0x3ea2ae){return _0x3ea2ae[_0xc620('0x20')](_0x46d5c2)[_0xc620('0x21')](function(_0x306882){return _0x306882;});}return null;};}function removeEntity(_0x15f391,_0x41e19a){return function(_0x3c961d){if(_0x3c961d){return _0x3c961d[_0xc620('0x22')]()[_0xc620('0x21')](function(){_0x15f391['status'](0xcc)[_0xc620('0x17')]();});}};}function handleEntityNotFound(_0x637b73,_0x33684c){return function(_0x363bed){if(!_0x363bed){_0x637b73[_0xc620('0x15')](0x194);}return _0x363bed;};}function handleError(_0x9b74b0,_0x4f7fa7){_0x4f7fa7=_0x4f7fa7||0x1f4;return function(_0x36dfd0){logger[_0xc620('0x23')](_0x36dfd0[_0xc620('0x24')]);if(_0x36dfd0['name']){delete _0x36dfd0[_0xc620('0x25')];}_0x9b74b0['status'](_0x4f7fa7)[_0xc620('0x26')](_0x36dfd0);};}exports['index']=function(_0x47db5c,_0x3f0f70){var _0xcdb784={},_0x2ef267={},_0x596748={'count':0x0,'rows':[]};var _0x2effdf=_['map'](db['FreshsalesAccount'][_0xc620('0x27')],function(_0x58e2dd){return{'name':_0x58e2dd[_0xc620('0x28')],'type':_0x58e2dd[_0xc620('0x29')]['key']};});_0x2ef267[_0xc620('0x2a')]=_[_0xc620('0x2b')](_0x2effdf,'name');_0x2ef267['query']=_[_0xc620('0x2c')](_0x47db5c[_0xc620('0x2d')]);_0x2ef267[_0xc620('0x2e')]=_['intersection'](_0x2ef267[_0xc620('0x2a')],_0x2ef267[_0xc620('0x2d')]);_0xcdb784[_0xc620('0x2f')]=_['intersection'](_0x2ef267[_0xc620('0x2a')],qs[_0xc620('0x30')](_0x47db5c[_0xc620('0x2d')][_0xc620('0x30')]));_0xcdb784[_0xc620('0x2f')]=_0xcdb784[_0xc620('0x2f')]['length']?_0xcdb784[_0xc620('0x2f')]:_0x2ef267[_0xc620('0x2a')];if(!_0x47db5c[_0xc620('0x2d')][_0xc620('0x31')](_0xc620('0x32'))){_0xcdb784[_0xc620('0x1a')]=qs['limit'](_0x47db5c[_0xc620('0x2d')]['limit']);_0xcdb784[_0xc620('0x18')]=qs[_0xc620('0x18')](_0x47db5c[_0xc620('0x2d')][_0xc620('0x18')]);}_0xcdb784['order']=qs[_0xc620('0x33')](_0x47db5c[_0xc620('0x2d')][_0xc620('0x33')]);_0xcdb784['where']=qs[_0xc620('0x2e')](_[_0xc620('0x34')](_0x47db5c[_0xc620('0x2d')],_0x2ef267[_0xc620('0x2e')]),_0x2effdf);if(_0x47db5c[_0xc620('0x2d')][_0xc620('0x35')]){_0xcdb784['where']=_[_0xc620('0x36')](_0xcdb784['where'],{'$or':_['map'](_0x2effdf,function(_0x597eb3){if(_0x597eb3[_0xc620('0x29')]!==_0xc620('0x37')){var _0x37f504={};_0x37f504[_0x597eb3['name']]={'$like':'%'+_0x47db5c[_0xc620('0x2d')][_0xc620('0x35')]+'%'};return _0x37f504;}})});}_0xcdb784=_[_0xc620('0x36')]({},_0xcdb784,_0x47db5c[_0xc620('0x38')]);var _0x996de5={'where':_0xcdb784[_0xc620('0x39')]};return db[_0xc620('0x3a')][_0xc620('0x3b')](_0x996de5)[_0xc620('0x21')](function(_0x3bcafc){_0x596748[_0xc620('0x3b')]=_0x3bcafc;if(_0x47db5c[_0xc620('0x2d')][_0xc620('0x3c')]){_0xcdb784[_0xc620('0x3d')]=[{'all':!![]}];}return db[_0xc620('0x3a')][_0xc620('0x3e')](_0xcdb784);})[_0xc620('0x21')](function(_0x2fbb5c){_0x596748[_0xc620('0x3f')]=_0x2fbb5c;return _0x596748;})[_0xc620('0x21')](respondWithFilteredResult(_0x3f0f70,_0xcdb784))['catch'](handleError(_0x3f0f70,null));};exports[_0xc620('0x40')]=function(_0x5d7073,_0x517468){var _0x488feb={'raw':![],'where':{'id':_0x5d7073['params']['id']}},_0x5cabe1={};_0x5cabe1['model']=_[_0xc620('0x2c')](db['FreshsalesAccount']['rawAttributes']);_0x5cabe1[_0xc620('0x2d')]=_[_0xc620('0x2c')](_0x5d7073[_0xc620('0x2d')]);_0x5cabe1[_0xc620('0x2e')]=_[_0xc620('0x41')](_0x5cabe1[_0xc620('0x2a')],_0x5cabe1[_0xc620('0x2d')]);_0x488feb[_0xc620('0x2f')]=_[_0xc620('0x41')](_0x5cabe1[_0xc620('0x2a')],qs[_0xc620('0x30')](_0x5d7073[_0xc620('0x2d')]['fields']));_0x488feb['attributes']=_0x488feb[_0xc620('0x2f')]['length']?_0x488feb[_0xc620('0x2f')]:_0x5cabe1[_0xc620('0x2a')];if(_0x5d7073[_0xc620('0x2d')][_0xc620('0x3c')]){_0x488feb[_0xc620('0x3d')]=[{'all':!![]}];}_0x488feb=_[_0xc620('0x36')]({},_0x488feb,_0x5d7073[_0xc620('0x38')]);return db[_0xc620('0x3a')][_0xc620('0x42')](_0x488feb)[_0xc620('0x21')](handleEntityNotFound(_0x517468,null))[_0xc620('0x21')](respondWithResult(_0x517468,null))[_0xc620('0x43')](handleError(_0x517468,null));};exports['create']=function(_0x551953,_0x522e4e){return db[_0xc620('0x3a')]['create'](_0x551953['body'],{})[_0xc620('0x21')](respondWithResult(_0x522e4e,0xc9))[_0xc620('0x43')](handleError(_0x522e4e,null));};exports[_0xc620('0x20')]=function(_0x242c26,_0x40a206){if(_0x242c26[_0xc620('0x44')]['id']){delete _0x242c26[_0xc620('0x44')]['id'];}return db[_0xc620('0x3a')][_0xc620('0x42')]({'where':{'id':_0x242c26[_0xc620('0x45')]['id']}})['then'](handleEntityNotFound(_0x40a206,null))[_0xc620('0x21')](saveUpdates(_0x242c26[_0xc620('0x44')],null))[_0xc620('0x21')](respondWithResult(_0x40a206,null))[_0xc620('0x43')](handleError(_0x40a206,null));};exports[_0xc620('0x22')]=function(_0x5f04cf,_0x5e352b){return db[_0xc620('0x3a')][_0xc620('0x42')]({'where':{'id':_0x5f04cf[_0xc620('0x45')]['id']}})[_0xc620('0x21')](handleEntityNotFound(_0x5e352b,null))[_0xc620('0x21')](removeEntity(_0x5e352b,null))['catch'](handleError(_0x5e352b,null));};exports[_0xc620('0x46')]=function(_0x1e3321,_0x1b6af3,_0x1df15c){var _0x28e5d1={};var _0x54bde8={};var _0x74bfe9;var _0x516117;return db[_0xc620('0x3a')][_0xc620('0x47')]({'where':{'id':_0x1e3321[_0xc620('0x45')]['id']}})[_0xc620('0x21')](handleEntityNotFound(_0x1b6af3,null))['then'](function(_0x1d932c){if(_0x1d932c){_0x74bfe9=_0x1d932c;_0x54bde8[_0xc620('0x2a')]=_[_0xc620('0x2c')](db[_0xc620('0x48')][_0xc620('0x27')]);_0x54bde8[_0xc620('0x2d')]=_[_0xc620('0x2c')](_0x1e3321[_0xc620('0x2d')]);_0x54bde8[_0xc620('0x2e')]=_[_0xc620('0x41')](_0x54bde8[_0xc620('0x2a')],_0x54bde8[_0xc620('0x2d')]);_0x28e5d1[_0xc620('0x2f')]=_[_0xc620('0x41')](_0x54bde8[_0xc620('0x2a')],qs[_0xc620('0x30')](_0x1e3321[_0xc620('0x2d')][_0xc620('0x30')]));_0x28e5d1[_0xc620('0x2f')]=_0x28e5d1[_0xc620('0x2f')]['length']?_0x28e5d1[_0xc620('0x2f')]:_0x54bde8[_0xc620('0x2a')];_0x28e5d1[_0xc620('0x49')]=qs[_0xc620('0x33')](_0x1e3321[_0xc620('0x2d')][_0xc620('0x33')]);_0x28e5d1[_0xc620('0x39')]=qs[_0xc620('0x2e')](_[_0xc620('0x34')](_0x1e3321['query'],_0x54bde8['filters']));if(_0x1e3321[_0xc620('0x2d')][_0xc620('0x35')]){_0x28e5d1[_0xc620('0x39')]=_[_0xc620('0x36')](_0x28e5d1[_0xc620('0x39')],{'$or':_[_0xc620('0x2b')](_0x28e5d1[_0xc620('0x2f')],function(_0xcfdb01){var _0x11dd01={};_0x11dd01[_0xcfdb01]={'$like':'%'+_0x1e3321['query']['filter']+'%'};return _0x11dd01;})});}_0x28e5d1=_[_0xc620('0x36')]({},_0x28e5d1,_0x1e3321[_0xc620('0x38')]);return _0x74bfe9[_0xc620('0x46')](_0x28e5d1);}})[_0xc620('0x21')](function(_0xeea6e7){if(_0xeea6e7){_0x516117=_0xeea6e7['length'];if(!_0x1e3321[_0xc620('0x2d')][_0xc620('0x31')](_0xc620('0x32'))){_0x28e5d1[_0xc620('0x1a')]=qs['limit'](_0x1e3321[_0xc620('0x2d')][_0xc620('0x1a')]);_0x28e5d1[_0xc620('0x18')]=qs[_0xc620('0x18')](_0x1e3321[_0xc620('0x2d')][_0xc620('0x18')]);}return _0x74bfe9[_0xc620('0x46')](_0x28e5d1);}})['then'](function(_0x138756){if(_0x138756){return _0x138756?{'count':_0x516117,'rows':_0x138756}:null;}})[_0xc620('0x21')](respondWithResult(_0x1b6af3,null))[_0xc620('0x43')](handleError(_0x1b6af3,null));};exports['addConfiguration']=function(_0x26ffc1,_0x152da2,_0x379386){if(_0x26ffc1[_0xc620('0x44')]['id']){delete _0x26ffc1[_0xc620('0x44')]['id'];}return db[_0xc620('0x3a')][_0xc620('0x47')]({'where':{'id':_0x26ffc1[_0xc620('0x45')]['id']}})['then'](handleEntityNotFound(_0x152da2,null))['then'](function(_0x8d7799){if(_0x8d7799){_0x26ffc1['body'][_0xc620('0x4a')]=_0x8d7799['id'];_0x26ffc1['body'][_0xc620('0x4b')]=integrations['getSubjects'](_0x26ffc1[_0xc620('0x44')][_0xc620('0x4c')],_0x26ffc1[_0xc620('0x44')]['type']);_0x26ffc1[_0xc620('0x44')][_0xc620('0x4d')]=integrations['getDescriptions'](_0x26ffc1[_0xc620('0x44')]['channel'],_0x26ffc1[_0xc620('0x44')][_0xc620('0x29')]);return db[_0xc620('0x48')][_0xc620('0x4e')](_0x26ffc1[_0xc620('0x44')],{'include':[{'model':db[_0xc620('0x4f')],'as':_0xc620('0x4b')},{'model':db[_0xc620('0x4f')],'as':'Descriptions'}]});}return null;})[_0xc620('0x21')](respondWithResult(_0x152da2,null))[_0xc620('0x43')](handleError(_0x152da2,null));};exports['getFields']=function(_0x195e2d,_0x129a3e,_0x13a1a9){var _0x59e3f3='';var _0x16641b='';return db[_0xc620('0x3a')]['findOne']({'where':{'id':_0x195e2d[_0xc620('0x45')]['id']},'attributes':['id',_0xc620('0x50'),'remoteUri',_0xc620('0x51')]})[_0xc620('0x21')](handleEntityNotFound(_0x129a3e,null))[_0xc620('0x21')](function(_0x578098){if(_0x578098){_0x16641b=_0x578098[_0xc620('0x50')];_0x59e3f3=_0x578098[_0xc620('0x52')];var _0x26c651=_0x578098[_0xc620('0x52')][_0xc620('0x53')](-0x1);if(_0x26c651==='/'){_0x59e3f3=_0x59e3f3[_0xc620('0x54')](0x0,_0x59e3f3[_0xc620('0x55')](_0x26c651));}return rp({'method':_0xc620('0x56'),'uri':util[_0xc620('0x57')](_0xc620('0x58'),_0x59e3f3,_0xc620('0x59')),'headers':{'Authorization':_0xc620('0x5a')+_0x578098[_0xc620('0x51')]},'json':!![]});}})['then'](function(_0x2dbfa8){if(_0x2dbfa8){var _0x3a4d41=_0x2dbfa8[_0xc620('0x5b')];var _0x1d0d79=![];var _0x1b4467=null;for(_0x1b4467=0x0;_0x1b4467<_0x3a4d41[_0xc620('0x5c')];_0x1b4467++){if(_0x3a4d41[_0x1b4467][_0xc620('0x5d')]===_0x16641b){_0x1d0d79=!![];}}if(_0x1d0d79){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc620('0x5e')});}}})[_0xc620('0x21')](respondWithResult(_0x129a3e,null))[_0xc620('0x43')](function(_0x1b8dff){var _0x292c2f=_0x195e2d['query'][_0xc620('0x5f')]?0x1f4:_0x1b8dff['statusCode']||0x1f4;logger['error'](_0xc620('0x60'),'getFields',_0x292c2f,JSON['stringify'](_0x1b8dff));delete _0x1b8dff[_0xc620('0x25')];if(_0x292c2f===0x191){_0x292c2f=0x190;}_0x129a3e[_0xc620('0x16')](_0x292c2f)[_0xc620('0x26')](_0x195e2d[_0xc620('0x2d')][_0xc620('0x5f')]?{'message':_0xc620('0x61'),'statusCode':_0x1b8dff[_0xc620('0x62')]}:_0x1b8dff);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 567444f..0b86e7d 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 _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x6a55,0xdb));var _0x56a5=function(_0x3425f9,_0x2358ca){_0x3425f9=_0x3425f9-0x0;var _0x814f39=_0x6a55[_0x3425f9];return _0x814f39;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshsalesAccount'];(function(_0x23a25c,_0x9c61dc){var _0x21d5a7=function(_0x4afa58){while(--_0x4afa58){_0x23a25c['push'](_0x23a25c['shift']());}};_0x21d5a7(++_0x9c61dc);}(_0xd943,0x15d));var _0x3d94=function(_0x4313ea,_0x84dec2){_0x4313ea=_0x4313ea-0x0;var _0x2c3b6c=_0xd943[_0x4313ea];return _0x2c3b6c;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3d94('0x9')]=function(_0x51cf1f,_0x54e81f){return _0x51cf1f['define'](_0x3d94('0xa'),attributes,{'tableName':_0x3d94('0xb'),'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 946a8e0..e5b90c8 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 _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x7ee1,0x8d));var _0x17ee=function(_0x3cae36,_0x121595){_0x3cae36=_0x3cae36-0x0;var _0x5a5e36=_0x7ee1[_0x3cae36];return _0x5a5e36;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file +var _0x27a0=['client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','options','attributes','limit','include','map','model','then','catch','ShowFreshsalesAccount','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0x27a0,0xbf));var _0x027a=function(_0x2544ee,_0x45006b){_0x2544ee=_0x2544ee-0x0;var _0x1cc810=_0x27a0[_0x2544ee];return _0x1cc810;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe233ed,_0x3c7d67,_0x550fbb){return new BPromise(function(_0x3d1429,_0x271dfe){return client[_0x027a('0x9')](_0xe233ed,_0x550fbb)['then'](function(_0x44c56a){logger[_0x027a('0xa')](_0x027a('0xb'),_0x3c7d67,'request\x20sent');logger[_0x027a('0xc')](_0x027a('0xd'),_0x3c7d67,_0x027a('0xe'),JSON[_0x027a('0xf')](_0x44c56a));if(_0x44c56a[_0x027a('0x10')]){if(_0x44c56a[_0x027a('0x10')][_0x027a('0x11')]===0x1f4){logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x271dfe(_0x44c56a['error'][_0x027a('0x12')]);}logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x3d1429(_0x44c56a['error']['message']);}else{logger[_0x027a('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x3c7d67,_0x027a('0xe'));_0x3d1429(_0x44c56a['result'][_0x027a('0x12')]);}})['catch'](function(_0x4dc3ab){logger['error'](_0x027a('0xb'),_0x3c7d67,_0x4dc3ab);_0x271dfe(_0x4dc3ab);});});}exports[_0x027a('0x13')]=function(_0x826d19){var _0x1fb40b=this;return new Promise(function(_0x52125e,_0x282e70){return db[_0x027a('0x14')]['findAll']({'raw':_0x826d19['options']?_0x826d19[_0x027a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x826d19[_0x027a('0x15')]?_0x826d19['options']['where']||null:null,'attributes':_0x826d19['options']?_0x826d19['options'][_0x027a('0x16')]||null:null,'limit':_0x826d19[_0x027a('0x15')]?_0x826d19[_0x027a('0x15')][_0x027a('0x17')]||null:null,'include':_0x826d19['options']?_0x826d19[_0x027a('0x15')][_0x027a('0x18')]?_[_0x027a('0x19')](_0x826d19[_0x027a('0x15')][_0x027a('0x18')],function(_0x3bbd46){return{'model':db[_0x3bbd46['model']],'as':_0x3bbd46['as'],'attributes':_0x3bbd46[_0x027a('0x16')],'include':_0x3bbd46['include']?_[_0x027a('0x19')](_0x3bbd46[_0x027a('0x18')],function(_0x1b1a13){return{'model':db[_0x1b1a13[_0x027a('0x1a')]],'as':_0x1b1a13['as'],'attributes':_0x1b1a13['attributes'],'include':_0x1b1a13['include']?_[_0x027a('0x19')](_0x1b1a13[_0x027a('0x18')],function(_0x338141){return{'model':db[_0x338141[_0x027a('0x1a')]],'as':_0x338141['as'],'attributes':_0x338141['attributes']};}):[]};}):[]};}):[]:[]})[_0x027a('0x1b')](function(_0x55a8cd){logger[_0x027a('0xa')]('GetFreshsalesAccount',_0x826d19);logger[_0x027a('0xc')]('GetFreshsalesAccount',_0x826d19,JSON['stringify'](_0x55a8cd));_0x52125e(_0x55a8cd);})[_0x027a('0x1c')](function(_0x5782ac){logger['error'](_0x027a('0x13'),_0x5782ac['message'],_0x826d19);_0x282e70(_0x1fb40b[_0x027a('0x10')](0x1f4,_0x5782ac['message']));});});};exports[_0x027a('0x1d')]=function(_0xc99acc){var _0x4d9a29=this;return new Promise(function(_0xe4ea7d,_0x4b4ac4){return db[_0x027a('0x14')][_0x027a('0x1e')]({'raw':_0xc99acc[_0x027a('0x15')]?_0xc99acc[_0x027a('0x15')][_0x027a('0x1f')]===undefined?!![]:![]:!![],'where':_0xc99acc[_0x027a('0x15')]?_0xc99acc['options'][_0x027a('0x20')]||null:null,'attributes':_0xc99acc['options']?_0xc99acc[_0x027a('0x15')]['attributes']||null:null,'include':_0xc99acc[_0x027a('0x15')]?_0xc99acc[_0x027a('0x15')][_0x027a('0x18')]?_[_0x027a('0x19')](_0xc99acc[_0x027a('0x15')]['include'],function(_0x1274e1){return{'model':db[_0x1274e1[_0x027a('0x1a')]],'as':_0x1274e1['as'],'attributes':_0x1274e1[_0x027a('0x16')],'include':_0x1274e1[_0x027a('0x18')]?_[_0x027a('0x19')](_0x1274e1[_0x027a('0x18')],function(_0x1bc29f){return{'model':db[_0x1bc29f[_0x027a('0x1a')]],'as':_0x1bc29f['as'],'attributes':_0x1bc29f[_0x027a('0x16')],'include':_0x1bc29f[_0x027a('0x18')]?_[_0x027a('0x19')](_0x1bc29f['include'],function(_0x29dc8f){return{'model':db[_0x29dc8f[_0x027a('0x1a')]],'as':_0x29dc8f['as'],'attributes':_0x29dc8f[_0x027a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x027a('0x1b')](function(_0x19b476){logger[_0x027a('0xa')](_0x027a('0x1d'),_0xc99acc);logger['debug'](_0x027a('0x1d'),_0xc99acc,JSON[_0x027a('0xf')](_0x19b476));_0xe4ea7d(_0x19b476);})[_0x027a('0x1c')](function(_0x5e9130){logger[_0x027a('0x10')]('ShowFreshsalesAccount',_0x5e9130[_0x027a('0x12')],_0xc99acc);_0x4b4ac4(_0x4d9a29[_0x027a('0x10')](0x1f4,_0x5e9130[_0x027a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index baa2736..6613476 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 _0x1f2d=['isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x55bdf7,_0x2315a9){var _0x291512=function(_0x39841d){while(--_0x39841d){_0x55bdf7['push'](_0x55bdf7['shift']());}};_0x291512(++_0x2315a9);}(_0x1f2d,0x68));var _0xd1f2=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x1f2d[_0x179e11];return _0x549f04;};'use strict';var multer=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var path=require(_0xd1f2('0x2'));var timeout=require(_0xd1f2('0x3'));var express=require(_0xd1f2('0x4'));var router=express[_0xd1f2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1f2('0x6'));var interaction=require(_0xd1f2('0x7'));var config=require(_0xd1f2('0x8'));var controller=require(_0xd1f2('0x9'));router[_0xd1f2('0xa')]('/',auth[_0xd1f2('0xb')](),controller['index']);router[_0xd1f2('0xa')](_0xd1f2('0xc'),auth[_0xd1f2('0xb')](),controller[_0xd1f2('0xd')]);router[_0xd1f2('0xa')](_0xd1f2('0xe'),auth['isAuthenticated'](),controller[_0xd1f2('0xf')]);router[_0xd1f2('0xa')]('/:id/descriptions',auth[_0xd1f2('0xb')](),controller[_0xd1f2('0x10')]);router['get'](_0xd1f2('0x11'),auth['isAuthenticated'](),controller[_0xd1f2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd1f2('0x13')]);router[_0xd1f2('0x14')](_0xd1f2('0xc'),auth['isAuthenticated'](),controller[_0xd1f2('0x15')]);router['delete'](_0xd1f2('0xc'),auth[_0xd1f2('0xb')](),controller['destroy']);module[_0xd1f2('0x16')]=router; \ No newline at end of file +var _0xe226=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','show','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x10f060,_0x572eae){var _0x21e307=function(_0x4afdc4){while(--_0x4afdc4){_0x10f060['push'](_0x10f060['shift']());}};_0x21e307(++_0x572eae);}(_0xe226,0x192));var _0x6e22=function(_0x43041f,_0x3133fe){_0x43041f=_0x43041f-0x0;var _0x291070=_0xe226[_0x43041f];return _0x291070;};'use strict';var multer=require(_0x6e22('0x0'));var util=require(_0x6e22('0x1'));var path=require(_0x6e22('0x2'));var timeout=require(_0x6e22('0x3'));var express=require('express');var router=express[_0x6e22('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e22('0x5'));var interaction=require(_0x6e22('0x6'));var config=require(_0x6e22('0x7'));var controller=require(_0x6e22('0x8'));router[_0x6e22('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6e22('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6e22('0xa')]);router['get']('/:id/subjects',auth[_0x6e22('0xb')](),controller[_0x6e22('0xc')]);router[_0x6e22('0x9')](_0x6e22('0xd'),auth[_0x6e22('0xb')](),controller[_0x6e22('0xe')]);router[_0x6e22('0x9')](_0x6e22('0xf'),auth[_0x6e22('0xb')](),controller[_0x6e22('0x10')]);router[_0x6e22('0x11')]('/',auth[_0x6e22('0xb')](),controller['create']);router[_0x6e22('0x12')](_0x6e22('0x13'),auth[_0x6e22('0xb')](),controller[_0x6e22('0x14')]);router[_0x6e22('0x15')](_0x6e22('0x13'),auth[_0x6e22('0xb')](),controller[_0x6e22('0x16')]);module[_0x6e22('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index cc8e7f6..8f120eb 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 _0xd971=['STRING','exports'];(function(_0x204626,_0x695d61){var _0x4eba87=function(_0x564eff){while(--_0x564eff){_0x204626['push'](_0x204626['shift']());}};_0x4eba87(++_0x695d61);}(_0xd971,0xcf));var _0x1d97=function(_0x60337,_0x163a14){_0x60337=_0x60337-0x0;var _0x48e690=_0xd971[_0x60337];return _0x48e690;};'use strict';var Sequelize=require('sequelize');module[_0x1d97('0x0')]={'name':{'type':Sequelize[_0x1d97('0x1')]},'description':{'type':Sequelize[_0x1d97('0x1')]}}; \ No newline at end of file +var _0x1ad3=['sequelize','STRING'];(function(_0x1e9a3b,_0x5df0a3){var _0x143bd2=function(_0x471afe){while(--_0x471afe){_0x1e9a3b['push'](_0x1e9a3b['shift']());}};_0x143bd2(++_0x5df0a3);}(_0x1ad3,0x1be));var _0x31ad=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x1ad3[_0x23f8c8];return _0x3dc718;};'use strict';var Sequelize=require(_0x31ad('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x31ad('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9448792..f9357c7 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 _0xbd1e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','FreshsalesConfiguration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0xbd1e,0xd9));var _0xebd1=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0xbd1e[_0x57e18a];return _0x1181c7;};'use strict';var emlformat=require(_0xebd1('0x0'));var rimraf=require(_0xebd1('0x1'));var zipdir=require(_0xebd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd1('0x3'));var moment=require(_0xebd1('0x4'));var BPromise=require(_0xebd1('0x5'));var Mustache=require(_0xebd1('0x6'));var util=require('util');var path=require(_0xebd1('0x7'));var sox=require(_0xebd1('0x8'));var csv=require(_0xebd1('0x9'));var ejs=require(_0xebd1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebd1('0xb'));var squel=require('squel');var crypto=require(_0xebd1('0xc'));var jsforce=require(_0xebd1('0xd'));var deskjs=require(_0xebd1('0xe'));var toCsv=require(_0xebd1('0x9'));var querystring=require(_0xebd1('0xf'));var Papa=require(_0xebd1('0x10'));var Redis=require('ioredis');var authService=require(_0xebd1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd1('0x12'));var hardwareService=require(_0xebd1('0x13'));var logger=require('../../config/logger')(_0xebd1('0x14'));var utils=require(_0xebd1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xebd1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cba09,_0x3394ba){_0x3394ba=_0x3394ba||0xcc;return function(_0x5f1ad7){if(_0x5f1ad7){return _0x2cba09[_0xebd1('0x17')](_0x3394ba);}return _0x2cba09[_0xebd1('0x18')](_0x3394ba)['end']();};}function respondWithResult(_0xf0c4f0,_0x12810c){_0x12810c=_0x12810c||0xc8;return function(_0x1c5b31){if(_0x1c5b31){return _0xf0c4f0['status'](_0x12810c)[_0xebd1('0x19')](_0x1c5b31);}};}function respondWithFilteredResult(_0x561885,_0xd7745){return function(_0x512ed1){if(_0x512ed1){var _0x269d18=typeof _0xd7745[_0xebd1('0x1a')]===_0xebd1('0x1b')&&typeof _0xd7745[_0xebd1('0x1c')]===_0xebd1('0x1b');var _0x34db2c=_0x512ed1[_0xebd1('0x1d')];var _0x1bbc5e=_0x269d18?0x0:_0xd7745[_0xebd1('0x1a')];var _0x434f6d=_0x269d18?_0x512ed1[_0xebd1('0x1d')]:_0xd7745['offset']+_0xd7745[_0xebd1('0x1c')];var _0x3d68ce;if(_0x434f6d>=_0x34db2c){_0x434f6d=_0x34db2c;_0x3d68ce=0xc8;}else{_0x3d68ce=0xce;}_0x561885[_0xebd1('0x18')](_0x3d68ce);return _0x561885[_0xebd1('0x1e')](_0xebd1('0x1f'),_0x1bbc5e+'-'+_0x434f6d+'/'+_0x34db2c)['json'](_0x512ed1);}return null;};}function patchUpdates(_0x20033e){return function(_0x28be72){try{jsonpatch[_0xebd1('0x20')](_0x28be72,_0x20033e,!![]);}catch(_0x543d28){return BPromise[_0xebd1('0x21')](_0x543d28);}return _0x28be72[_0xebd1('0x22')]();};}function saveUpdates(_0x50ca42,_0x100dab){return function(_0x52a7fd){if(_0x52a7fd){return _0x52a7fd[_0xebd1('0x23')](_0x50ca42)[_0xebd1('0x24')](function(_0x442209){return _0x442209;});}return null;};}function removeEntity(_0x5db230,_0x1e9043){return function(_0x408b5b){if(_0x408b5b){return _0x408b5b[_0xebd1('0x25')]()[_0xebd1('0x24')](function(){_0x5db230[_0xebd1('0x18')](0xcc)[_0xebd1('0x26')]();});}};}function handleEntityNotFound(_0xa48bc2,_0x2ea9d6){return function(_0x281d8c){if(!_0x281d8c){_0xa48bc2['sendStatus'](0x194);}return _0x281d8c;};}function handleError(_0x44505c,_0x1a5b84){_0x1a5b84=_0x1a5b84||0x1f4;return function(_0x5d6567){logger['error'](_0x5d6567[_0xebd1('0x27')]);if(_0x5d6567['name']){delete _0x5d6567[_0xebd1('0x28')];}_0x44505c[_0xebd1('0x18')](_0x1a5b84)[_0xebd1('0x29')](_0x5d6567);};}exports['index']=function(_0x108a14,_0x4bb9ae){var _0x19b3d9={},_0x338db0={},_0x222436={'count':0x0,'rows':[]};var _0x9a9ef8=_[_0xebd1('0x2a')](db[_0xebd1('0x2b')][_0xebd1('0x2c')],function(_0x423774){return{'name':_0x423774['fieldName'],'type':_0x423774['type'][_0xebd1('0x2d')]};});_0x338db0['model']=_[_0xebd1('0x2a')](_0x9a9ef8,_0xebd1('0x28'));_0x338db0[_0xebd1('0x2e')]=_[_0xebd1('0x2f')](_0x108a14['query']);_0x338db0[_0xebd1('0x30')]=_[_0xebd1('0x31')](_0x338db0[_0xebd1('0x32')],_0x338db0['query']);_0x19b3d9[_0xebd1('0x33')]=_['intersection'](_0x338db0['model'],qs[_0xebd1('0x34')](_0x108a14['query'][_0xebd1('0x34')]));_0x19b3d9[_0xebd1('0x33')]=_0x19b3d9[_0xebd1('0x33')][_0xebd1('0x35')]?_0x19b3d9[_0xebd1('0x33')]:_0x338db0[_0xebd1('0x32')];if(!_0x108a14[_0xebd1('0x2e')][_0xebd1('0x36')](_0xebd1('0x37'))){_0x19b3d9['limit']=qs['limit'](_0x108a14[_0xebd1('0x2e')][_0xebd1('0x1c')]);_0x19b3d9[_0xebd1('0x1a')]=qs[_0xebd1('0x1a')](_0x108a14[_0xebd1('0x2e')][_0xebd1('0x1a')]);}_0x19b3d9['order']=qs[_0xebd1('0x38')](_0x108a14['query'][_0xebd1('0x38')]);_0x19b3d9[_0xebd1('0x39')]=qs[_0xebd1('0x30')](_[_0xebd1('0x3a')](_0x108a14[_0xebd1('0x2e')],_0x338db0[_0xebd1('0x30')]),_0x9a9ef8);if(_0x108a14['query'][_0xebd1('0x3b')]){_0x19b3d9[_0xebd1('0x39')]=_[_0xebd1('0x3c')](_0x19b3d9[_0xebd1('0x39')],{'$or':_[_0xebd1('0x2a')](_0x9a9ef8,function(_0x2b60c2){if(_0x2b60c2['type']!==_0xebd1('0x3d')){var _0xc15046={};_0xc15046[_0x2b60c2[_0xebd1('0x28')]]={'$like':'%'+_0x108a14['query'][_0xebd1('0x3b')]+'%'};return _0xc15046;}})});}_0x19b3d9=_['merge']({},_0x19b3d9,_0x108a14[_0xebd1('0x3e')]);var _0x3c7c34={'where':_0x19b3d9[_0xebd1('0x39')]};return db[_0xebd1('0x2b')]['count'](_0x3c7c34)[_0xebd1('0x24')](function(_0x2f3582){_0x222436[_0xebd1('0x1d')]=_0x2f3582;if(_0x108a14['query'][_0xebd1('0x3f')]){_0x19b3d9['include']=[{'all':!![]}];}return db[_0xebd1('0x2b')][_0xebd1('0x40')](_0x19b3d9);})[_0xebd1('0x24')](function(_0x3b7aa4){_0x222436[_0xebd1('0x41')]=_0x3b7aa4;return _0x222436;})['then'](respondWithFilteredResult(_0x4bb9ae,_0x19b3d9))[_0xebd1('0x42')](handleError(_0x4bb9ae,null));};exports[_0xebd1('0x43')]=function(_0x52f12f,_0xc9fd44){var _0x543f95={'raw':![],'where':{'id':_0x52f12f[_0xebd1('0x44')]['id']}},_0x25ec90={};_0x25ec90['model']=_['keys'](db[_0xebd1('0x2b')]['rawAttributes']);_0x25ec90['query']=_[_0xebd1('0x2f')](_0x52f12f[_0xebd1('0x2e')]);_0x25ec90[_0xebd1('0x30')]=_['intersection'](_0x25ec90[_0xebd1('0x32')],_0x25ec90[_0xebd1('0x2e')]);_0x543f95[_0xebd1('0x33')]=_[_0xebd1('0x31')](_0x25ec90[_0xebd1('0x32')],qs[_0xebd1('0x34')](_0x52f12f[_0xebd1('0x2e')]['fields']));_0x543f95[_0xebd1('0x33')]=_0x543f95['attributes'][_0xebd1('0x35')]?_0x543f95['attributes']:_0x25ec90[_0xebd1('0x32')];if(_0x52f12f[_0xebd1('0x2e')][_0xebd1('0x3f')]){_0x543f95['include']=[{'all':!![]}];}_0x543f95=_[_0xebd1('0x3c')]({},_0x543f95,_0x52f12f[_0xebd1('0x3e')]);return db[_0xebd1('0x2b')][_0xebd1('0x45')](_0x543f95)[_0xebd1('0x24')](handleEntityNotFound(_0xc9fd44,null))[_0xebd1('0x24')](respondWithResult(_0xc9fd44,null))['catch'](handleError(_0xc9fd44,null));};exports[_0xebd1('0x46')]=function(_0x2751a3,_0x110208){return db[_0xebd1('0x2b')][_0xebd1('0x46')](_0x2751a3[_0xebd1('0x47')],{})['then'](respondWithResult(_0x110208,0xc9))['catch'](handleError(_0x110208,null));};exports['update']=function(_0xc266e0,_0x1e4214){if(_0xc266e0[_0xebd1('0x47')]['id']){delete _0xc266e0[_0xebd1('0x47')]['id'];}return db[_0xebd1('0x2b')][_0xebd1('0x45')]({'where':{'id':_0xc266e0[_0xebd1('0x44')]['id']}})[_0xebd1('0x24')](handleEntityNotFound(_0x1e4214,null))['then'](saveUpdates(_0xc266e0[_0xebd1('0x47')],null))['then'](respondWithResult(_0x1e4214,null))[_0xebd1('0x42')](handleError(_0x1e4214,null));};exports[_0xebd1('0x25')]=function(_0x222276,_0x10cd7f){return db[_0xebd1('0x2b')]['find']({'where':{'id':_0x222276[_0xebd1('0x44')]['id']}})[_0xebd1('0x24')](handleEntityNotFound(_0x10cd7f,null))[_0xebd1('0x24')](removeEntity(_0x10cd7f,null))[_0xebd1('0x42')](handleError(_0x10cd7f,null));};exports[_0xebd1('0x48')]=function(_0x2b4047,_0x13effb,_0x53702a){var _0x2eee0c={};var _0x27f987={};var _0x296fde;var _0x4d8516;return db[_0xebd1('0x2b')][_0xebd1('0x49')]({'where':{'id':_0x2b4047['params']['id']}})[_0xebd1('0x24')](handleEntityNotFound(_0x13effb,null))[_0xebd1('0x24')](function(_0x3c1386){if(_0x3c1386){_0x296fde=_0x3c1386;_0x27f987[_0xebd1('0x32')]=_['keys'](db[_0xebd1('0x4a')][_0xebd1('0x2c')]);_0x27f987[_0xebd1('0x2e')]=_['keys'](_0x2b4047[_0xebd1('0x2e')]);_0x27f987[_0xebd1('0x30')]=_[_0xebd1('0x31')](_0x27f987['model'],_0x27f987[_0xebd1('0x2e')]);_0x2eee0c[_0xebd1('0x33')]=_[_0xebd1('0x31')](_0x27f987[_0xebd1('0x32')],qs[_0xebd1('0x34')](_0x2b4047['query'][_0xebd1('0x34')]));_0x2eee0c[_0xebd1('0x33')]=_0x2eee0c['attributes']['length']?_0x2eee0c[_0xebd1('0x33')]:_0x27f987[_0xebd1('0x32')];_0x2eee0c[_0xebd1('0x4b')]=qs['sort'](_0x2b4047[_0xebd1('0x2e')][_0xebd1('0x38')]);_0x2eee0c['where']=qs[_0xebd1('0x30')](_[_0xebd1('0x3a')](_0x2b4047[_0xebd1('0x2e')],_0x27f987[_0xebd1('0x30')]));if(_0x2b4047['query']['filter']){_0x2eee0c[_0xebd1('0x39')]=_['merge'](_0x2eee0c[_0xebd1('0x39')],{'$or':_['map'](_0x2eee0c[_0xebd1('0x33')],function(_0x3ee9a1){var _0xceab80={};_0xceab80[_0x3ee9a1]={'$like':'%'+_0x2b4047[_0xebd1('0x2e')][_0xebd1('0x3b')]+'%'};return _0xceab80;})});}_0x2eee0c=_[_0xebd1('0x3c')]({},_0x2eee0c,_0x2b4047[_0xebd1('0x3e')]);return _0x296fde[_0xebd1('0x48')](_0x2eee0c);}})[_0xebd1('0x24')](function(_0x1a0a15){if(_0x1a0a15){_0x4d8516=_0x1a0a15[_0xebd1('0x35')];if(!_0x2b4047[_0xebd1('0x2e')][_0xebd1('0x36')](_0xebd1('0x37'))){_0x2eee0c['limit']=qs[_0xebd1('0x1c')](_0x2b4047[_0xebd1('0x2e')]['limit']);_0x2eee0c[_0xebd1('0x1a')]=qs[_0xebd1('0x1a')](_0x2b4047[_0xebd1('0x2e')]['offset']);}return _0x296fde[_0xebd1('0x48')](_0x2eee0c);}})[_0xebd1('0x24')](function(_0x420544){if(_0x420544){return _0x420544?{'count':_0x4d8516,'rows':_0x420544}:null;}})[_0xebd1('0x24')](respondWithResult(_0x13effb,null))[_0xebd1('0x42')](handleError(_0x13effb,null));};exports[_0xebd1('0x4c')]=function(_0x3b8202,_0x5cb149,_0x495cea){var _0x2a050b={};var _0x269e78={};var _0x4457a3;var _0x1f490f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3b8202['params']['id']}})[_0xebd1('0x24')](handleEntityNotFound(_0x5cb149,null))[_0xebd1('0x24')](function(_0x28b481){if(_0x28b481){_0x4457a3=_0x28b481;_0x269e78[_0xebd1('0x32')]=_[_0xebd1('0x2f')](db[_0xebd1('0x4a')][_0xebd1('0x2c')]);_0x269e78['query']=_[_0xebd1('0x2f')](_0x3b8202[_0xebd1('0x2e')]);_0x269e78['filters']=_[_0xebd1('0x31')](_0x269e78[_0xebd1('0x32')],_0x269e78['query']);_0x2a050b['attributes']=_[_0xebd1('0x31')](_0x269e78[_0xebd1('0x32')],qs[_0xebd1('0x34')](_0x3b8202[_0xebd1('0x2e')][_0xebd1('0x34')]));_0x2a050b[_0xebd1('0x33')]=_0x2a050b[_0xebd1('0x33')]['length']?_0x2a050b[_0xebd1('0x33')]:_0x269e78[_0xebd1('0x32')];_0x2a050b[_0xebd1('0x4b')]=qs[_0xebd1('0x38')](_0x3b8202[_0xebd1('0x2e')][_0xebd1('0x38')]);_0x2a050b[_0xebd1('0x39')]=qs[_0xebd1('0x30')](_[_0xebd1('0x3a')](_0x3b8202[_0xebd1('0x2e')],_0x269e78[_0xebd1('0x30')]));if(_0x3b8202[_0xebd1('0x2e')][_0xebd1('0x3b')]){_0x2a050b[_0xebd1('0x39')]=_[_0xebd1('0x3c')](_0x2a050b[_0xebd1('0x39')],{'$or':_[_0xebd1('0x2a')](_0x2a050b[_0xebd1('0x33')],function(_0x123776){var _0x51e3bf={};_0x51e3bf[_0x123776]={'$like':'%'+_0x3b8202[_0xebd1('0x2e')]['filter']+'%'};return _0x51e3bf;})});}_0x2a050b=_['merge']({},_0x2a050b,_0x3b8202['options']);return _0x4457a3[_0xebd1('0x4c')](_0x2a050b);}})['then'](function(_0x55f503){if(_0x55f503){_0x1f490f=_0x55f503[_0xebd1('0x35')];if(!_0x3b8202['query']['hasOwnProperty'](_0xebd1('0x37'))){_0x2a050b[_0xebd1('0x1c')]=qs[_0xebd1('0x1c')](_0x3b8202[_0xebd1('0x2e')][_0xebd1('0x1c')]);_0x2a050b[_0xebd1('0x1a')]=qs['offset'](_0x3b8202[_0xebd1('0x2e')][_0xebd1('0x1a')]);}return _0x4457a3[_0xebd1('0x4c')](_0x2a050b);}})[_0xebd1('0x24')](function(_0x16919a){if(_0x16919a){return _0x16919a?{'count':_0x1f490f,'rows':_0x16919a}:null;}})[_0xebd1('0x24')](respondWithResult(_0x5cb149,null))[_0xebd1('0x42')](handleError(_0x5cb149,null));};exports[_0xebd1('0x4d')]=function(_0x2b62ce,_0xd59363,_0xac951){var _0xde8ca4={};var _0x183471={};var _0x1bb1b4;var _0x345814;return db['FreshsalesConfiguration'][_0xebd1('0x49')]({'where':{'id':_0x2b62ce[_0xebd1('0x44')]['id']}})['then'](handleEntityNotFound(_0xd59363,null))['then'](function(_0x3f03b0){if(_0x3f03b0){_0x1bb1b4=_0x3f03b0;_0x183471['model']=_[_0xebd1('0x2f')](db[_0xebd1('0x4a')][_0xebd1('0x2c')]);_0x183471[_0xebd1('0x2e')]=_[_0xebd1('0x2f')](_0x2b62ce['query']);_0x183471['filters']=_['intersection'](_0x183471[_0xebd1('0x32')],_0x183471['query']);_0xde8ca4[_0xebd1('0x33')]=_['intersection'](_0x183471['model'],qs[_0xebd1('0x34')](_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x34')]));_0xde8ca4[_0xebd1('0x33')]=_0xde8ca4[_0xebd1('0x33')][_0xebd1('0x35')]?_0xde8ca4[_0xebd1('0x33')]:_0x183471[_0xebd1('0x32')];_0xde8ca4['order']=qs[_0xebd1('0x38')](_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x38')]);_0xde8ca4[_0xebd1('0x39')]=qs[_0xebd1('0x30')](_[_0xebd1('0x3a')](_0x2b62ce[_0xebd1('0x2e')],_0x183471[_0xebd1('0x30')]));if(_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x3b')]){_0xde8ca4[_0xebd1('0x39')]=_[_0xebd1('0x3c')](_0xde8ca4['where'],{'$or':_[_0xebd1('0x2a')](_0xde8ca4[_0xebd1('0x33')],function(_0x37eefa){var _0x22516b={};_0x22516b[_0x37eefa]={'$like':'%'+_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x3b')]+'%'};return _0x22516b;})});}_0xde8ca4=_['merge']({},_0xde8ca4,_0x2b62ce['options']);return _0x1bb1b4[_0xebd1('0x4d')](_0xde8ca4);}})[_0xebd1('0x24')](function(_0x1cef63){if(_0x1cef63){_0x345814=_0x1cef63[_0xebd1('0x35')];if(!_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x36')](_0xebd1('0x37'))){_0xde8ca4[_0xebd1('0x1c')]=qs[_0xebd1('0x1c')](_0x2b62ce['query'][_0xebd1('0x1c')]);_0xde8ca4['offset']=qs[_0xebd1('0x1a')](_0x2b62ce[_0xebd1('0x2e')][_0xebd1('0x1a')]);}return _0x1bb1b4[_0xebd1('0x4d')](_0xde8ca4);}})['then'](function(_0x1095c9){if(_0x1095c9){return _0x1095c9?{'count':_0x345814,'rows':_0x1095c9}:null;}})[_0xebd1('0x24')](respondWithResult(_0xd59363,null))[_0xebd1('0x42')](handleError(_0xd59363,null));}; \ No newline at end of file +var _0x42be=['rows','params','include','merge','find','catch','create','body','getSubjects','findOne','pick','getDescriptions','getFields','FreshsalesField','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x42be,0xac));var _0xe42b=function(_0xe4fe90,_0x4eaad4){_0xe4fe90=_0xe4fe90-0x0;var _0xd4fe64=_0x42be[_0xe4fe90];return _0xd4fe64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe42b('0x0'));var zipdir=require(_0xe42b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe42b('0x2'));var moment=require('moment');var BPromise=require(_0xe42b('0x3'));var Mustache=require(_0xe42b('0x4'));var util=require(_0xe42b('0x5'));var path=require('path');var sox=require(_0xe42b('0x6'));var csv=require('to-csv');var ejs=require(_0xe42b('0x7'));var fs=require('fs');var fs_extra=require(_0xe42b('0x8'));var _=require(_0xe42b('0x9'));var squel=require(_0xe42b('0xa'));var crypto=require('crypto');var jsforce=require(_0xe42b('0xb'));var deskjs=require(_0xe42b('0xc'));var toCsv=require(_0xe42b('0xd'));var querystring=require(_0xe42b('0xe'));var Papa=require(_0xe42b('0xf'));var Redis=require(_0xe42b('0x10'));var authService=require(_0xe42b('0x11'));var qs=require(_0xe42b('0x12'));var as=require(_0xe42b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe42b('0x14'))(_0xe42b('0x15'));var utils=require('../../config/utils');var config=require(_0xe42b('0x16'));var licenseUtil=require(_0xe42b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf231cf,_0x5103ea){_0x5103ea=_0x5103ea||0xcc;return function(_0x4ccc36){if(_0x4ccc36){return _0xf231cf[_0xe42b('0x18')](_0x5103ea);}return _0xf231cf[_0xe42b('0x19')](_0x5103ea)[_0xe42b('0x1a')]();};}function respondWithResult(_0x1b1b99,_0x2d2d42){_0x2d2d42=_0x2d2d42||0xc8;return function(_0x1db445){if(_0x1db445){return _0x1b1b99[_0xe42b('0x19')](_0x2d2d42)[_0xe42b('0x1b')](_0x1db445);}};}function respondWithFilteredResult(_0x40ebb1,_0x24f244){return function(_0x12a2a4){if(_0x12a2a4){var _0x250f39=typeof _0x24f244[_0xe42b('0x1c')]===_0xe42b('0x1d')&&typeof _0x24f244['limit']==='undefined';var _0x3fc836=_0x12a2a4[_0xe42b('0x1e')];var _0x4b72c3=_0x250f39?0x0:_0x24f244[_0xe42b('0x1c')];var _0x36abe8=_0x250f39?_0x12a2a4[_0xe42b('0x1e')]:_0x24f244[_0xe42b('0x1c')]+_0x24f244[_0xe42b('0x1f')];var _0x51a7f0;if(_0x36abe8>=_0x3fc836){_0x36abe8=_0x3fc836;_0x51a7f0=0xc8;}else{_0x51a7f0=0xce;}_0x40ebb1[_0xe42b('0x19')](_0x51a7f0);return _0x40ebb1[_0xe42b('0x20')](_0xe42b('0x21'),_0x4b72c3+'-'+_0x36abe8+'/'+_0x3fc836)['json'](_0x12a2a4);}return null;};}function patchUpdates(_0x2b4f55){return function(_0x2da6a6){try{jsonpatch['apply'](_0x2da6a6,_0x2b4f55,!![]);}catch(_0x43b8b8){return BPromise['reject'](_0x43b8b8);}return _0x2da6a6[_0xe42b('0x22')]();};}function saveUpdates(_0x5317a3,_0xd9da25){return function(_0x32f221){if(_0x32f221){return _0x32f221[_0xe42b('0x23')](_0x5317a3)[_0xe42b('0x24')](function(_0x45f20a){return _0x45f20a;});}return null;};}function removeEntity(_0x493ea2,_0x59aa36){return function(_0x36d8c8){if(_0x36d8c8){return _0x36d8c8[_0xe42b('0x25')]()[_0xe42b('0x24')](function(){_0x493ea2[_0xe42b('0x19')](0xcc)[_0xe42b('0x1a')]();});}};}function handleEntityNotFound(_0x4cdd28,_0x43c17f){return function(_0x3fbf3f){if(!_0x3fbf3f){_0x4cdd28[_0xe42b('0x18')](0x194);}return _0x3fbf3f;};}function handleError(_0xb3293b,_0x355fe0){_0x355fe0=_0x355fe0||0x1f4;return function(_0x280ce7){logger[_0xe42b('0x26')](_0x280ce7[_0xe42b('0x27')]);if(_0x280ce7[_0xe42b('0x28')]){delete _0x280ce7['name'];}_0xb3293b[_0xe42b('0x19')](_0x355fe0)['send'](_0x280ce7);};}exports[_0xe42b('0x29')]=function(_0x3d7791,_0x3d3033){var _0x1cbbcd={},_0x128a2d={},_0x3b61e2={'count':0x0,'rows':[]};var _0x1129cc=_[_0xe42b('0x2a')](db[_0xe42b('0x2b')][_0xe42b('0x2c')],function(_0x3bac73){return{'name':_0x3bac73['fieldName'],'type':_0x3bac73[_0xe42b('0x2d')][_0xe42b('0x2e')]};});_0x128a2d[_0xe42b('0x2f')]=_[_0xe42b('0x2a')](_0x1129cc,_0xe42b('0x28'));_0x128a2d['query']=_[_0xe42b('0x30')](_0x3d7791[_0xe42b('0x31')]);_0x128a2d[_0xe42b('0x32')]=_[_0xe42b('0x33')](_0x128a2d[_0xe42b('0x2f')],_0x128a2d['query']);_0x1cbbcd[_0xe42b('0x34')]=_['intersection'](_0x128a2d[_0xe42b('0x2f')],qs[_0xe42b('0x35')](_0x3d7791['query'][_0xe42b('0x35')]));_0x1cbbcd[_0xe42b('0x34')]=_0x1cbbcd[_0xe42b('0x34')][_0xe42b('0x36')]?_0x1cbbcd[_0xe42b('0x34')]:_0x128a2d[_0xe42b('0x2f')];if(!_0x3d7791[_0xe42b('0x31')][_0xe42b('0x37')](_0xe42b('0x38'))){_0x1cbbcd[_0xe42b('0x1f')]=qs['limit'](_0x3d7791[_0xe42b('0x31')][_0xe42b('0x1f')]);_0x1cbbcd['offset']=qs[_0xe42b('0x1c')](_0x3d7791[_0xe42b('0x31')][_0xe42b('0x1c')]);}_0x1cbbcd[_0xe42b('0x39')]=qs['sort'](_0x3d7791['query'][_0xe42b('0x3a')]);_0x1cbbcd[_0xe42b('0x3b')]=qs[_0xe42b('0x32')](_['pick'](_0x3d7791[_0xe42b('0x31')],_0x128a2d[_0xe42b('0x32')]),_0x1129cc);if(_0x3d7791[_0xe42b('0x31')][_0xe42b('0x3c')]){_0x1cbbcd['where']=_['merge'](_0x1cbbcd['where'],{'$or':_['map'](_0x1129cc,function(_0x21a1f6){if(_0x21a1f6[_0xe42b('0x2d')]!==_0xe42b('0x3d')){var _0x3dcc4b={};_0x3dcc4b[_0x21a1f6[_0xe42b('0x28')]]={'$like':'%'+_0x3d7791['query'][_0xe42b('0x3c')]+'%'};return _0x3dcc4b;}})});}_0x1cbbcd=_['merge']({},_0x1cbbcd,_0x3d7791[_0xe42b('0x3e')]);var _0x51caba={'where':_0x1cbbcd['where']};return db[_0xe42b('0x2b')][_0xe42b('0x1e')](_0x51caba)[_0xe42b('0x24')](function(_0x3fadb3){_0x3b61e2[_0xe42b('0x1e')]=_0x3fadb3;if(_0x3d7791[_0xe42b('0x31')][_0xe42b('0x3f')]){_0x1cbbcd['include']=[{'all':!![]}];}return db[_0xe42b('0x2b')][_0xe42b('0x40')](_0x1cbbcd);})[_0xe42b('0x24')](function(_0x3087bd){_0x3b61e2[_0xe42b('0x41')]=_0x3087bd;return _0x3b61e2;})['then'](respondWithFilteredResult(_0x3d3033,_0x1cbbcd))['catch'](handleError(_0x3d3033,null));};exports['show']=function(_0x1b4191,_0x459652){var _0x29a60a={'raw':![],'where':{'id':_0x1b4191[_0xe42b('0x42')]['id']}},_0x1447c7={};_0x1447c7['model']=_[_0xe42b('0x30')](db[_0xe42b('0x2b')][_0xe42b('0x2c')]);_0x1447c7[_0xe42b('0x31')]=_[_0xe42b('0x30')](_0x1b4191[_0xe42b('0x31')]);_0x1447c7[_0xe42b('0x32')]=_['intersection'](_0x1447c7[_0xe42b('0x2f')],_0x1447c7['query']);_0x29a60a[_0xe42b('0x34')]=_[_0xe42b('0x33')](_0x1447c7[_0xe42b('0x2f')],qs[_0xe42b('0x35')](_0x1b4191[_0xe42b('0x31')]['fields']));_0x29a60a[_0xe42b('0x34')]=_0x29a60a[_0xe42b('0x34')][_0xe42b('0x36')]?_0x29a60a[_0xe42b('0x34')]:_0x1447c7[_0xe42b('0x2f')];if(_0x1b4191[_0xe42b('0x31')]['includeAll']){_0x29a60a[_0xe42b('0x43')]=[{'all':!![]}];}_0x29a60a=_[_0xe42b('0x44')]({},_0x29a60a,_0x1b4191[_0xe42b('0x3e')]);return db[_0xe42b('0x2b')][_0xe42b('0x45')](_0x29a60a)[_0xe42b('0x24')](handleEntityNotFound(_0x459652,null))[_0xe42b('0x24')](respondWithResult(_0x459652,null))[_0xe42b('0x46')](handleError(_0x459652,null));};exports[_0xe42b('0x47')]=function(_0x197cc3,_0x38dbb3){return db[_0xe42b('0x2b')]['create'](_0x197cc3[_0xe42b('0x48')],{})[_0xe42b('0x24')](respondWithResult(_0x38dbb3,0xc9))[_0xe42b('0x46')](handleError(_0x38dbb3,null));};exports['update']=function(_0x2c55ac,_0x15f419){if(_0x2c55ac[_0xe42b('0x48')]['id']){delete _0x2c55ac['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2c55ac[_0xe42b('0x42')]['id']}})['then'](handleEntityNotFound(_0x15f419,null))['then'](saveUpdates(_0x2c55ac[_0xe42b('0x48')],null))[_0xe42b('0x24')](respondWithResult(_0x15f419,null))[_0xe42b('0x46')](handleError(_0x15f419,null));};exports[_0xe42b('0x25')]=function(_0xadbadc,_0x268655){return db[_0xe42b('0x2b')][_0xe42b('0x45')]({'where':{'id':_0xadbadc[_0xe42b('0x42')]['id']}})[_0xe42b('0x24')](handleEntityNotFound(_0x268655,null))[_0xe42b('0x24')](removeEntity(_0x268655,null))['catch'](handleError(_0x268655,null));};exports[_0xe42b('0x49')]=function(_0x56c245,_0x3b64b1,_0x227a03){var _0x38f1a8={};var _0x31909f={};var _0x2ac4fa;var _0x331127;return db[_0xe42b('0x2b')][_0xe42b('0x4a')]({'where':{'id':_0x56c245[_0xe42b('0x42')]['id']}})[_0xe42b('0x24')](handleEntityNotFound(_0x3b64b1,null))['then'](function(_0x16b5cd){if(_0x16b5cd){_0x2ac4fa=_0x16b5cd;_0x31909f[_0xe42b('0x2f')]=_[_0xe42b('0x30')](db['FreshsalesField'][_0xe42b('0x2c')]);_0x31909f[_0xe42b('0x31')]=_['keys'](_0x56c245[_0xe42b('0x31')]);_0x31909f[_0xe42b('0x32')]=_[_0xe42b('0x33')](_0x31909f[_0xe42b('0x2f')],_0x31909f['query']);_0x38f1a8[_0xe42b('0x34')]=_[_0xe42b('0x33')](_0x31909f[_0xe42b('0x2f')],qs[_0xe42b('0x35')](_0x56c245['query'][_0xe42b('0x35')]));_0x38f1a8['attributes']=_0x38f1a8[_0xe42b('0x34')]['length']?_0x38f1a8[_0xe42b('0x34')]:_0x31909f[_0xe42b('0x2f')];_0x38f1a8[_0xe42b('0x39')]=qs[_0xe42b('0x3a')](_0x56c245[_0xe42b('0x31')][_0xe42b('0x3a')]);_0x38f1a8[_0xe42b('0x3b')]=qs[_0xe42b('0x32')](_[_0xe42b('0x4b')](_0x56c245[_0xe42b('0x31')],_0x31909f[_0xe42b('0x32')]));if(_0x56c245[_0xe42b('0x31')]['filter']){_0x38f1a8['where']=_[_0xe42b('0x44')](_0x38f1a8[_0xe42b('0x3b')],{'$or':_[_0xe42b('0x2a')](_0x38f1a8[_0xe42b('0x34')],function(_0x5ed9d3){var _0x22de93={};_0x22de93[_0x5ed9d3]={'$like':'%'+_0x56c245[_0xe42b('0x31')][_0xe42b('0x3c')]+'%'};return _0x22de93;})});}_0x38f1a8=_[_0xe42b('0x44')]({},_0x38f1a8,_0x56c245[_0xe42b('0x3e')]);return _0x2ac4fa['getSubjects'](_0x38f1a8);}})['then'](function(_0x24f4ad){if(_0x24f4ad){_0x331127=_0x24f4ad[_0xe42b('0x36')];if(!_0x56c245[_0xe42b('0x31')][_0xe42b('0x37')]('nolimit')){_0x38f1a8['limit']=qs['limit'](_0x56c245['query'][_0xe42b('0x1f')]);_0x38f1a8[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x56c245['query']['offset']);}return _0x2ac4fa['getSubjects'](_0x38f1a8);}})[_0xe42b('0x24')](function(_0x175162){if(_0x175162){return _0x175162?{'count':_0x331127,'rows':_0x175162}:null;}})[_0xe42b('0x24')](respondWithResult(_0x3b64b1,null))[_0xe42b('0x46')](handleError(_0x3b64b1,null));};exports[_0xe42b('0x4c')]=function(_0x5c65f0,_0x36e382,_0x1234ee){var _0xb15596={};var _0x146edf={};var _0x591ea8;var _0x43063e;return db[_0xe42b('0x2b')][_0xe42b('0x4a')]({'where':{'id':_0x5c65f0[_0xe42b('0x42')]['id']}})[_0xe42b('0x24')](handleEntityNotFound(_0x36e382,null))[_0xe42b('0x24')](function(_0x28fc29){if(_0x28fc29){_0x591ea8=_0x28fc29;_0x146edf[_0xe42b('0x2f')]=_[_0xe42b('0x30')](db['FreshsalesField'][_0xe42b('0x2c')]);_0x146edf[_0xe42b('0x31')]=_[_0xe42b('0x30')](_0x5c65f0[_0xe42b('0x31')]);_0x146edf[_0xe42b('0x32')]=_[_0xe42b('0x33')](_0x146edf[_0xe42b('0x2f')],_0x146edf['query']);_0xb15596[_0xe42b('0x34')]=_[_0xe42b('0x33')](_0x146edf['model'],qs[_0xe42b('0x35')](_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x35')]));_0xb15596[_0xe42b('0x34')]=_0xb15596['attributes']['length']?_0xb15596[_0xe42b('0x34')]:_0x146edf[_0xe42b('0x2f')];_0xb15596[_0xe42b('0x39')]=qs[_0xe42b('0x3a')](_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x3a')]);_0xb15596[_0xe42b('0x3b')]=qs['filters'](_['pick'](_0x5c65f0[_0xe42b('0x31')],_0x146edf[_0xe42b('0x32')]));if(_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x3c')]){_0xb15596[_0xe42b('0x3b')]=_[_0xe42b('0x44')](_0xb15596['where'],{'$or':_[_0xe42b('0x2a')](_0xb15596[_0xe42b('0x34')],function(_0x4d258b){var _0x2d20cc={};_0x2d20cc[_0x4d258b]={'$like':'%'+_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x3c')]+'%'};return _0x2d20cc;})});}_0xb15596=_[_0xe42b('0x44')]({},_0xb15596,_0x5c65f0[_0xe42b('0x3e')]);return _0x591ea8[_0xe42b('0x4c')](_0xb15596);}})['then'](function(_0x5c00ad){if(_0x5c00ad){_0x43063e=_0x5c00ad[_0xe42b('0x36')];if(!_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x37')](_0xe42b('0x38'))){_0xb15596[_0xe42b('0x1f')]=qs['limit'](_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x1f')]);_0xb15596[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x5c65f0[_0xe42b('0x31')][_0xe42b('0x1c')]);}return _0x591ea8[_0xe42b('0x4c')](_0xb15596);}})[_0xe42b('0x24')](function(_0x3096f2){if(_0x3096f2){return _0x3096f2?{'count':_0x43063e,'rows':_0x3096f2}:null;}})[_0xe42b('0x24')](respondWithResult(_0x36e382,null))['catch'](handleError(_0x36e382,null));};exports[_0xe42b('0x4d')]=function(_0x3cafbe,_0x460344,_0x22deb8){var _0x2537d8={};var _0x430336={};var _0x384da8;var _0xd6f404;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3cafbe[_0xe42b('0x42')]['id']}})[_0xe42b('0x24')](handleEntityNotFound(_0x460344,null))[_0xe42b('0x24')](function(_0x4150b0){if(_0x4150b0){_0x384da8=_0x4150b0;_0x430336[_0xe42b('0x2f')]=_['keys'](db[_0xe42b('0x4e')][_0xe42b('0x2c')]);_0x430336['query']=_[_0xe42b('0x30')](_0x3cafbe[_0xe42b('0x31')]);_0x430336[_0xe42b('0x32')]=_[_0xe42b('0x33')](_0x430336[_0xe42b('0x2f')],_0x430336[_0xe42b('0x31')]);_0x2537d8[_0xe42b('0x34')]=_[_0xe42b('0x33')](_0x430336['model'],qs[_0xe42b('0x35')](_0x3cafbe[_0xe42b('0x31')][_0xe42b('0x35')]));_0x2537d8['attributes']=_0x2537d8[_0xe42b('0x34')][_0xe42b('0x36')]?_0x2537d8[_0xe42b('0x34')]:_0x430336[_0xe42b('0x2f')];_0x2537d8[_0xe42b('0x39')]=qs[_0xe42b('0x3a')](_0x3cafbe['query'][_0xe42b('0x3a')]);_0x2537d8['where']=qs[_0xe42b('0x32')](_['pick'](_0x3cafbe[_0xe42b('0x31')],_0x430336['filters']));if(_0x3cafbe[_0xe42b('0x31')][_0xe42b('0x3c')]){_0x2537d8[_0xe42b('0x3b')]=_[_0xe42b('0x44')](_0x2537d8[_0xe42b('0x3b')],{'$or':_[_0xe42b('0x2a')](_0x2537d8[_0xe42b('0x34')],function(_0x1b05d2){var _0x554eee={};_0x554eee[_0x1b05d2]={'$like':'%'+_0x3cafbe['query'][_0xe42b('0x3c')]+'%'};return _0x554eee;})});}_0x2537d8=_[_0xe42b('0x44')]({},_0x2537d8,_0x3cafbe['options']);return _0x384da8['getFields'](_0x2537d8);}})['then'](function(_0x3738b0){if(_0x3738b0){_0xd6f404=_0x3738b0[_0xe42b('0x36')];if(!_0x3cafbe[_0xe42b('0x31')][_0xe42b('0x37')](_0xe42b('0x38'))){_0x2537d8[_0xe42b('0x1f')]=qs[_0xe42b('0x1f')](_0x3cafbe[_0xe42b('0x31')][_0xe42b('0x1f')]);_0x2537d8[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x3cafbe[_0xe42b('0x31')][_0xe42b('0x1c')]);}return _0x384da8['getFields'](_0x2537d8);}})[_0xe42b('0x24')](function(_0x5947b6){if(_0x5947b6){return _0x5947b6?{'count':_0xd6f404,'rows':_0x5947b6}:null;}})[_0xe42b('0x24')](respondWithResult(_0x460344,null))['catch'](handleError(_0x460344,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index cfd8cab..f7c8929 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 _0xa74e=['FreshsalesConfiguration','util','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x3a2b09,_0x27c1ec){var _0x545e36=function(_0x237f77){while(--_0x237f77){_0x3a2b09['push'](_0x3a2b09['shift']());}};_0x545e36(++_0x27c1ec);}(_0xa74e,0x6f));var _0xea74=function(_0x27b50f,_0x2ff270){_0x27b50f=_0x27b50f-0x0;var _0xe72328=_0xa74e[_0x27b50f];return _0xe72328;};'use strict';var _=require('lodash');var util=require(_0xea74('0x0'));var logger=require('../../config/logger')(_0xea74('0x1'));var moment=require(_0xea74('0x2'));var BPromise=require('bluebird');var rp=require(_0xea74('0x3'));var fs=require('fs');var path=require(_0xea74('0x4'));var rimraf=require(_0xea74('0x5'));var config=require(_0xea74('0x6'));var attributes=require(_0xea74('0x7'));module['exports']=function(_0x4bfb89,_0x3b9d12){return _0x4bfb89[_0xea74('0x8')](_0xea74('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8c3=['FreshsalesConfiguration','util','../../config/logger','api','moment','request-promise','path','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8c3,0x1f0));var _0x3b8c=function(_0x3ad721,_0x4b7de5){_0x3ad721=_0x3ad721-0x0;var _0x52b183=_0xb8c3[_0x3ad721];return _0x52b183;};'use strict';var _=require('lodash');var util=require(_0x3b8c('0x0'));var logger=require(_0x3b8c('0x1'))(_0x3b8c('0x2'));var moment=require(_0x3b8c('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b8c('0x4'));var fs=require('fs');var path=require(_0x3b8c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x3b8c('0x6')]=function(_0x167a77,_0x94c781){return _0x167a77[_0x3b8c('0x7')](_0x3b8c('0x8'),attributes,{'tableName':'int_freshsales_configurations','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 6ff074a..68d3508 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 _0xa54a=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x193fc6,_0x5e0f10){var _0x81628f=function(_0x440b2f){while(--_0x440b2f){_0x193fc6['push'](_0x193fc6['shift']());}};_0x81628f(++_0x5e0f10);}(_0xa54a,0xda));var _0xaa54=function(_0x53b4dc,_0x51f549){_0x53b4dc=_0x53b4dc-0x0;var _0x3b2b68=_0xa54a[_0x53b4dc];return _0x3b2b68;};'use strict';var _=require(_0xaa54('0x0'));var util=require(_0xaa54('0x1'));var moment=require(_0xaa54('0x2'));var BPromise=require(_0xaa54('0x3'));var rs=require(_0xaa54('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa54('0x6'))(_0xaa54('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa54('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38a980,_0x510066,_0x1b2086){return new BPromise(function(_0xec8fb,_0x531a46){return client[_0xaa54('0x9')](_0x38a980,_0x1b2086)['then'](function(_0x12d01c){logger[_0xaa54('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x510066,_0xaa54('0xb'));logger[_0xaa54('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x510066,'request\x20sent',JSON[_0xaa54('0xd')](_0x12d01c));if(_0x12d01c[_0xaa54('0xe')]){if(_0x12d01c[_0xaa54('0xe')][_0xaa54('0xf')]===0x1f4){logger['error'](_0xaa54('0x10'),_0x510066,_0x12d01c[_0xaa54('0xe')]['message']);return _0x531a46(_0x12d01c[_0xaa54('0xe')][_0xaa54('0x11')]);}logger[_0xaa54('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x510066,_0x12d01c['error'][_0xaa54('0x11')]);return _0xec8fb(_0x12d01c[_0xaa54('0xe')][_0xaa54('0x11')]);}else{logger['info'](_0xaa54('0x10'),_0x510066,_0xaa54('0xb'));_0xec8fb(_0x12d01c[_0xaa54('0x12')][_0xaa54('0x11')]);}})[_0xaa54('0x13')](function(_0x501a3a){logger[_0xaa54('0xe')](_0xaa54('0x10'),_0x510066,_0x501a3a);_0x531a46(_0x501a3a);});});} \ No newline at end of file +var _0x50db=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x1b2618,_0x1b1af3){var _0x37de91=function(_0xbbb3a5){while(--_0xbbb3a5){_0x1b2618['push'](_0x1b2618['shift']());}};_0x37de91(++_0x1b1af3);}(_0x50db,0x13c));var _0xb50d=function(_0x279dfb,_0x5ddaeb){_0x279dfb=_0x279dfb-0x0;var _0x927888=_0x50db[_0x279dfb];return _0x927888;};'use strict';var _=require(_0xb50d('0x0'));var util=require(_0xb50d('0x1'));var moment=require(_0xb50d('0x2'));var BPromise=require(_0xb50d('0x3'));var rs=require(_0xb50d('0x4'));var fs=require('fs');var Redis=require(_0xb50d('0x5'));var db=require(_0xb50d('0x6'))['db'];var utils=require(_0xb50d('0x7'));var logger=require('../../config/logger')(_0xb50d('0x8'));var config=require(_0xb50d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb50d('0xa')][_0xb50d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x355685,_0x20e987,_0x23e7ee){return new BPromise(function(_0x46d987,_0x2bc209){return client['request'](_0x355685,_0x23e7ee)['then'](function(_0x4692a0){logger[_0xb50d('0xc')](_0xb50d('0xd'),_0x20e987,_0xb50d('0xe'));logger['debug'](_0xb50d('0xf'),_0x20e987,_0xb50d('0xe'),JSON[_0xb50d('0x10')](_0x4692a0));if(_0x4692a0[_0xb50d('0x11')]){if(_0x4692a0[_0xb50d('0x11')]['code']===0x1f4){logger[_0xb50d('0x11')](_0xb50d('0xd'),_0x20e987,_0x4692a0['error'][_0xb50d('0x12')]);return _0x2bc209(_0x4692a0['error'][_0xb50d('0x12')]);}logger[_0xb50d('0x11')](_0xb50d('0xd'),_0x20e987,_0x4692a0[_0xb50d('0x11')][_0xb50d('0x12')]);return _0x46d987(_0x4692a0[_0xb50d('0x11')][_0xb50d('0x12')]);}else{logger[_0xb50d('0xc')](_0xb50d('0xd'),_0x20e987,_0xb50d('0xe'));_0x46d987(_0x4692a0[_0xb50d('0x13')][_0xb50d('0x12')]);}})['catch'](function(_0xf67131){logger[_0xb50d('0x11')](_0xb50d('0xd'),_0x20e987,_0xf67131);_0x2bc209(_0xf67131);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8a56b8e..522421a 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 _0x5ff3=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','util','connect-timeout','Router'];(function(_0x4690f1,_0x10f22f){var _0x5c2b55=function(_0x311b95){while(--_0x311b95){_0x4690f1['push'](_0x4690f1['shift']());}};_0x5c2b55(++_0x10f22f);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2072cc,_0x128e4b){_0x2072cc=_0x2072cc-0x0;var _0x23e58c=_0x5ff3[_0x2072cc];return _0x23e58c;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/:id',auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xa')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0xb')]);router['put'](_0x35ff('0xc'),auth['isAuthenticated'](),controller[_0x35ff('0xd')]);router[_0x35ff('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb48d=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','/:id','destroy','multer','path'];(function(_0x5de7be,_0x51575a){var _0x21b73e=function(_0x2d12a1){while(--_0x2d12a1){_0x5de7be['push'](_0x5de7be['shift']());}};_0x21b73e(++_0x51575a);}(_0xb48d,0x194));var _0xdb48=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xb48d[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xdb48('0x0'));var util=require('util');var path=require(_0xdb48('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb48('0x2'));var router=express[_0xdb48('0x3')]();var fs_extra=require(_0xdb48('0x4'));var auth=require(_0xdb48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb48('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xdb48('0x7')]('/',auth[_0xdb48('0x8')](),controller[_0xdb48('0x9')]);router['get']('/:id',auth[_0xdb48('0x8')](),controller[_0xdb48('0xa')]);router['post']('/',auth[_0xdb48('0x8')](),controller[_0xdb48('0xb')]);router['put'](_0xdb48('0xc'),auth[_0xdb48('0x8')](),controller['update']);router['delete'](_0xdb48('0xc'),auth[_0xdb48('0x8')](),controller[_0xdb48('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 472a4af..f0fd526 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 _0x960c=['keyValue','picklist','string','STRING','sequelize','ENUM','variable'];(function(_0x128a5a,_0x1f2909){var _0x5e42cb=function(_0xd3c91e){while(--_0xd3c91e){_0x128a5a['push'](_0x128a5a['shift']());}};_0x5e42cb(++_0x1f2909);}(_0x960c,0x9e));var _0xc960=function(_0x3d9745,_0x4345e5){_0x3d9745=_0x3d9745-0x0;var _0x2fe51f=_0x960c[_0x3d9745];return _0x2fe51f;};'use strict';var Sequelize=require(_0xc960('0x0'));module['exports']={'type':{'type':Sequelize[_0xc960('0x1')]('string',_0xc960('0x2'),'customVariable',_0xc960('0x3'),_0xc960('0x4')),'defaultValue':_0xc960('0x5')},'content':{'type':Sequelize[_0xc960('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc960('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xc960('0x6')]},'idField':{'type':Sequelize[_0xc960('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc960('0x6')]}}; \ No newline at end of file +var _0x3513=['string','variable','picklist','STRING','customVariable','ENUM'];(function(_0x4eb58d,_0x4f21e7){var _0x1e6669=function(_0x1f7511){while(--_0x1f7511){_0x4eb58d['push'](_0x4eb58d['shift']());}};_0x1e6669(++_0x4f21e7);}(_0x3513,0x119));var _0x3351=function(_0x52e993,_0x2c72f1){_0x52e993=_0x52e993-0x0;var _0x518d41=_0x3513[_0x52e993];return _0x518d41;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3351('0x0')](_0x3351('0x1'),_0x3351('0x2'),'customVariable','keyValue',_0x3351('0x3')),'defaultValue':_0x3351('0x1')},'content':{'type':Sequelize[_0x3351('0x4')]},'key':{'type':Sequelize[_0x3351('0x4')]},'keyType':{'type':Sequelize[_0x3351('0x0')](_0x3351('0x1'),'variable',_0x3351('0x5'))},'keyContent':{'type':Sequelize[_0x3351('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3351('0x4')]},'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 1529d94..93d805f 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 _0x3438=['Content-Range','apply','reject','save','then','destroy','error','send','index','map','FreshsalesField','fieldName','type','model','name','query','keys','filters','attributes','fields','length','nolimit','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','rawAttributes','intersection','options','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x385615,_0x1e98ee){var _0x511a6b=function(_0x2f8d31){while(--_0x2f8d31){_0x385615['push'](_0x385615['shift']());}};_0x511a6b(++_0x1e98ee);}(_0x3438,0x1a9));var _0x8343=function(_0x173089,_0x4ceadc){_0x173089=_0x173089-0x0;var _0x5e712b=_0x3438[_0x173089];return _0x5e712b;};'use strict';var emlformat=require(_0x8343('0x0'));var rimraf=require(_0x8343('0x1'));var zipdir=require(_0x8343('0x2'));var jsonpatch=require(_0x8343('0x3'));var rp=require(_0x8343('0x4'));var moment=require(_0x8343('0x5'));var BPromise=require(_0x8343('0x6'));var Mustache=require(_0x8343('0x7'));var util=require('util');var path=require(_0x8343('0x8'));var sox=require(_0x8343('0x9'));var csv=require(_0x8343('0xa'));var ejs=require(_0x8343('0xb'));var fs=require('fs');var fs_extra=require(_0x8343('0xc'));var _=require(_0x8343('0xd'));var squel=require(_0x8343('0xe'));var crypto=require('crypto');var jsforce=require(_0x8343('0xf'));var deskjs=require(_0x8343('0x10'));var toCsv=require(_0x8343('0xa'));var querystring=require('querystring');var Papa=require(_0x8343('0x11'));var Redis=require(_0x8343('0x12'));var authService=require(_0x8343('0x13'));var qs=require(_0x8343('0x14'));var as=require(_0x8343('0x15'));var hardwareService=require(_0x8343('0x16'));var logger=require(_0x8343('0x17'))(_0x8343('0x18'));var utils=require(_0x8343('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8343('0x1a'));var db=require(_0x8343('0x1b'))['db'];function respondWithStatusCode(_0x2d9731,_0x27b1a1){_0x27b1a1=_0x27b1a1||0xcc;return function(_0x4bb5c7){if(_0x4bb5c7){return _0x2d9731[_0x8343('0x1c')](_0x27b1a1);}return _0x2d9731[_0x8343('0x1d')](_0x27b1a1)[_0x8343('0x1e')]();};}function respondWithResult(_0x18a73e,_0x1c4bda){_0x1c4bda=_0x1c4bda||0xc8;return function(_0x2c2e05){if(_0x2c2e05){return _0x18a73e['status'](_0x1c4bda)[_0x8343('0x1f')](_0x2c2e05);}};}function respondWithFilteredResult(_0x1348f7,_0x2546f2){return function(_0x4ab4b6){if(_0x4ab4b6){var _0x4e0689=typeof _0x2546f2[_0x8343('0x20')]===_0x8343('0x21')&&typeof _0x2546f2[_0x8343('0x22')]===_0x8343('0x21');var _0x4521da=_0x4ab4b6['count'];var _0x369951=_0x4e0689?0x0:_0x2546f2[_0x8343('0x20')];var _0x52584d=_0x4e0689?_0x4ab4b6[_0x8343('0x23')]:_0x2546f2[_0x8343('0x20')]+_0x2546f2['limit'];var _0x2b6685;if(_0x52584d>=_0x4521da){_0x52584d=_0x4521da;_0x2b6685=0xc8;}else{_0x2b6685=0xce;}_0x1348f7[_0x8343('0x1d')](_0x2b6685);return _0x1348f7[_0x8343('0x24')](_0x8343('0x25'),_0x369951+'-'+_0x52584d+'/'+_0x4521da)['json'](_0x4ab4b6);}return null;};}function patchUpdates(_0x24931b){return function(_0x58be5a){try{jsonpatch[_0x8343('0x26')](_0x58be5a,_0x24931b,!![]);}catch(_0x4730b2){return BPromise[_0x8343('0x27')](_0x4730b2);}return _0x58be5a[_0x8343('0x28')]();};}function saveUpdates(_0x17ca16,_0x496078){return function(_0x201dfc){if(_0x201dfc){return _0x201dfc['update'](_0x17ca16)[_0x8343('0x29')](function(_0x4d3826){return _0x4d3826;});}return null;};}function removeEntity(_0x243bc2,_0x31a319){return function(_0x5da666){if(_0x5da666){return _0x5da666[_0x8343('0x2a')]()[_0x8343('0x29')](function(){_0x243bc2[_0x8343('0x1d')](0xcc)[_0x8343('0x1e')]();});}};}function handleEntityNotFound(_0x308a7b,_0x567e53){return function(_0xf483c3){if(!_0xf483c3){_0x308a7b[_0x8343('0x1c')](0x194);}return _0xf483c3;};}function handleError(_0x2ae779,_0x3e15f4){_0x3e15f4=_0x3e15f4||0x1f4;return function(_0x5a46c4){logger[_0x8343('0x2b')](_0x5a46c4['stack']);if(_0x5a46c4['name']){delete _0x5a46c4['name'];}_0x2ae779[_0x8343('0x1d')](_0x3e15f4)[_0x8343('0x2c')](_0x5a46c4);};}exports[_0x8343('0x2d')]=function(_0x4a5d57,_0xe02c54){var _0x445a46={},_0x286043={},_0x4e1b78={'count':0x0,'rows':[]};var _0x5aaf6b=_[_0x8343('0x2e')](db[_0x8343('0x2f')]['rawAttributes'],function(_0x5c9e8e){return{'name':_0x5c9e8e[_0x8343('0x30')],'type':_0x5c9e8e[_0x8343('0x31')]['key']};});_0x286043[_0x8343('0x32')]=_[_0x8343('0x2e')](_0x5aaf6b,_0x8343('0x33'));_0x286043[_0x8343('0x34')]=_[_0x8343('0x35')](_0x4a5d57['query']);_0x286043[_0x8343('0x36')]=_['intersection'](_0x286043['model'],_0x286043[_0x8343('0x34')]);_0x445a46[_0x8343('0x37')]=_['intersection'](_0x286043[_0x8343('0x32')],qs[_0x8343('0x38')](_0x4a5d57[_0x8343('0x34')]['fields']));_0x445a46[_0x8343('0x37')]=_0x445a46[_0x8343('0x37')][_0x8343('0x39')]?_0x445a46['attributes']:_0x286043[_0x8343('0x32')];if(!_0x4a5d57[_0x8343('0x34')]['hasOwnProperty'](_0x8343('0x3a'))){_0x445a46[_0x8343('0x22')]=qs['limit'](_0x4a5d57[_0x8343('0x34')][_0x8343('0x22')]);_0x445a46[_0x8343('0x20')]=qs['offset'](_0x4a5d57[_0x8343('0x34')][_0x8343('0x20')]);}_0x445a46['order']=qs['sort'](_0x4a5d57['query'][_0x8343('0x3b')]);_0x445a46['where']=qs['filters'](_['pick'](_0x4a5d57[_0x8343('0x34')],_0x286043['filters']),_0x5aaf6b);if(_0x4a5d57[_0x8343('0x34')][_0x8343('0x3c')]){_0x445a46[_0x8343('0x3d')]=_['merge'](_0x445a46['where'],{'$or':_['map'](_0x5aaf6b,function(_0x48af55){if(_0x48af55[_0x8343('0x31')]!==_0x8343('0x3e')){var _0x3f282e={};_0x3f282e[_0x48af55[_0x8343('0x33')]]={'$like':'%'+_0x4a5d57['query']['filter']+'%'};return _0x3f282e;}})});}_0x445a46=_[_0x8343('0x3f')]({},_0x445a46,_0x4a5d57['options']);var _0x6635f={'where':_0x445a46[_0x8343('0x3d')]};return db[_0x8343('0x2f')][_0x8343('0x23')](_0x6635f)['then'](function(_0x365539){_0x4e1b78[_0x8343('0x23')]=_0x365539;if(_0x4a5d57[_0x8343('0x34')][_0x8343('0x40')]){_0x445a46[_0x8343('0x41')]=[{'all':!![]}];}return db[_0x8343('0x2f')][_0x8343('0x42')](_0x445a46);})[_0x8343('0x29')](function(_0xe42d04){_0x4e1b78['rows']=_0xe42d04;return _0x4e1b78;})[_0x8343('0x29')](respondWithFilteredResult(_0xe02c54,_0x445a46))[_0x8343('0x43')](handleError(_0xe02c54,null));};exports[_0x8343('0x44')]=function(_0x332ceb,_0x4a2ab1){var _0x1642ac={'raw':!![],'where':{'id':_0x332ceb['params']['id']}},_0x301103={};_0x301103[_0x8343('0x32')]=_['keys'](db['FreshsalesField'][_0x8343('0x45')]);_0x301103[_0x8343('0x34')]=_[_0x8343('0x35')](_0x332ceb[_0x8343('0x34')]);_0x301103['filters']=_[_0x8343('0x46')](_0x301103[_0x8343('0x32')],_0x301103['query']);_0x1642ac[_0x8343('0x37')]=_[_0x8343('0x46')](_0x301103['model'],qs['fields'](_0x332ceb['query'][_0x8343('0x38')]));_0x1642ac['attributes']=_0x1642ac[_0x8343('0x37')][_0x8343('0x39')]?_0x1642ac[_0x8343('0x37')]:_0x301103[_0x8343('0x32')];if(_0x332ceb[_0x8343('0x34')][_0x8343('0x40')]){_0x1642ac[_0x8343('0x41')]=[{'all':!![]}];}_0x1642ac=_[_0x8343('0x3f')]({},_0x1642ac,_0x332ceb[_0x8343('0x47')]);return db[_0x8343('0x2f')]['find'](_0x1642ac)['then'](handleEntityNotFound(_0x4a2ab1,null))[_0x8343('0x29')](respondWithResult(_0x4a2ab1,null))[_0x8343('0x43')](handleError(_0x4a2ab1,null));};exports[_0x8343('0x48')]=function(_0x1df64a,_0x4c1dd0){return db[_0x8343('0x2f')][_0x8343('0x48')](_0x1df64a[_0x8343('0x49')],{})[_0x8343('0x29')](respondWithResult(_0x4c1dd0,0xc9))['catch'](handleError(_0x4c1dd0,null));};exports[_0x8343('0x4a')]=function(_0x360bc8,_0x27280e){if(_0x360bc8[_0x8343('0x49')]['id']){delete _0x360bc8['body']['id'];}return db['FreshsalesField'][_0x8343('0x4b')]({'where':{'id':_0x360bc8[_0x8343('0x4c')]['id']}})[_0x8343('0x29')](handleEntityNotFound(_0x27280e,null))[_0x8343('0x29')](saveUpdates(_0x360bc8[_0x8343('0x49')],null))[_0x8343('0x29')](respondWithResult(_0x27280e,null))[_0x8343('0x43')](handleError(_0x27280e,null));};exports[_0x8343('0x2a')]=function(_0x2986a3,_0x172ee3){return db[_0x8343('0x2f')]['find']({'where':{'id':_0x2986a3[_0x8343('0x4c')]['id']}})[_0x8343('0x29')](handleEntityNotFound(_0x172ee3,null))[_0x8343('0x29')](removeEntity(_0x172ee3,null))['catch'](handleError(_0x172ee3,null));}; \ No newline at end of file +var _0xd345=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','type','merge','FreshsalesField','includeAll','findAll','rows','params','find','catch','create'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xd345,0x15f));var _0x5d34=function(_0x38250d,_0x5a2e9b){_0x38250d=_0x38250d-0x0;var _0x3a313b=_0xd345[_0x38250d];return _0x3a313b;};'use strict';var emlformat=require(_0x5d34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d34('0x1'));var jsonpatch=require(_0x5d34('0x2'));var rp=require(_0x5d34('0x3'));var moment=require(_0x5d34('0x4'));var BPromise=require(_0x5d34('0x5'));var Mustache=require(_0x5d34('0x6'));var util=require(_0x5d34('0x7'));var path=require('path');var sox=require(_0x5d34('0x8'));var csv=require(_0x5d34('0x9'));var ejs=require(_0x5d34('0xa'));var fs=require('fs');var fs_extra=require(_0x5d34('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d34('0xc'));var jsforce=require(_0x5d34('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d34('0x9'));var querystring=require(_0x5d34('0xe'));var Papa=require(_0x5d34('0xf'));var Redis=require(_0x5d34('0x10'));var authService=require(_0x5d34('0x11'));var qs=require(_0x5d34('0x12'));var as=require(_0x5d34('0x13'));var hardwareService=require(_0x5d34('0x14'));var logger=require('../../config/logger')(_0x5d34('0x15'));var utils=require('../../config/utils');var config=require(_0x5d34('0x16'));var licenseUtil=require(_0x5d34('0x17'));var db=require(_0x5d34('0x18'))['db'];function respondWithStatusCode(_0x3ec45b,_0x4f9e57){_0x4f9e57=_0x4f9e57||0xcc;return function(_0x288bce){if(_0x288bce){return _0x3ec45b[_0x5d34('0x19')](_0x4f9e57);}return _0x3ec45b[_0x5d34('0x1a')](_0x4f9e57)[_0x5d34('0x1b')]();};}function respondWithResult(_0xee92e9,_0x257361){_0x257361=_0x257361||0xc8;return function(_0x4c13cd){if(_0x4c13cd){return _0xee92e9[_0x5d34('0x1a')](_0x257361)[_0x5d34('0x1c')](_0x4c13cd);}};}function respondWithFilteredResult(_0x220e70,_0x155cdf){return function(_0x58c2b6){if(_0x58c2b6){var _0x5adf96=typeof _0x155cdf[_0x5d34('0x1d')]==='undefined'&&typeof _0x155cdf[_0x5d34('0x1e')]==='undefined';var _0x2a8eff=_0x58c2b6[_0x5d34('0x1f')];var _0x423db4=_0x5adf96?0x0:_0x155cdf[_0x5d34('0x1d')];var _0x4853ef=_0x5adf96?_0x58c2b6[_0x5d34('0x1f')]:_0x155cdf[_0x5d34('0x1d')]+_0x155cdf[_0x5d34('0x1e')];var _0x383e99;if(_0x4853ef>=_0x2a8eff){_0x4853ef=_0x2a8eff;_0x383e99=0xc8;}else{_0x383e99=0xce;}_0x220e70['status'](_0x383e99);return _0x220e70[_0x5d34('0x20')](_0x5d34('0x21'),_0x423db4+'-'+_0x4853ef+'/'+_0x2a8eff)['json'](_0x58c2b6);}return null;};}function patchUpdates(_0x221b89){return function(_0x189d23){try{jsonpatch['apply'](_0x189d23,_0x221b89,!![]);}catch(_0x45ec34){return BPromise['reject'](_0x45ec34);}return _0x189d23[_0x5d34('0x22')]();};}function saveUpdates(_0x41ae7e,_0x825429){return function(_0x262457){if(_0x262457){return _0x262457[_0x5d34('0x23')](_0x41ae7e)[_0x5d34('0x24')](function(_0x363a7e){return _0x363a7e;});}return null;};}function removeEntity(_0x4257e0,_0x37b536){return function(_0x10f213){if(_0x10f213){return _0x10f213[_0x5d34('0x25')]()[_0x5d34('0x24')](function(){_0x4257e0[_0x5d34('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a4bef,_0x16e4d3){return function(_0x5dfe5d){if(!_0x5dfe5d){_0x2a4bef[_0x5d34('0x19')](0x194);}return _0x5dfe5d;};}function handleError(_0x334b65,_0x3d89c5){_0x3d89c5=_0x3d89c5||0x1f4;return function(_0xc8b1c4){logger[_0x5d34('0x26')](_0xc8b1c4['stack']);if(_0xc8b1c4['name']){delete _0xc8b1c4[_0x5d34('0x27')];}_0x334b65[_0x5d34('0x1a')](_0x3d89c5)['send'](_0xc8b1c4);};}exports[_0x5d34('0x28')]=function(_0x387b35,_0x5c8828){var _0x157382={},_0x23eca9={},_0x4e5b5b={'count':0x0,'rows':[]};var _0x5aaede=_[_0x5d34('0x29')](db['FreshsalesField'][_0x5d34('0x2a')],function(_0x5d2492){return{'name':_0x5d2492[_0x5d34('0x2b')],'type':_0x5d2492['type'][_0x5d34('0x2c')]};});_0x23eca9[_0x5d34('0x2d')]=_[_0x5d34('0x29')](_0x5aaede,_0x5d34('0x27'));_0x23eca9[_0x5d34('0x2e')]=_[_0x5d34('0x2f')](_0x387b35[_0x5d34('0x2e')]);_0x23eca9['filters']=_['intersection'](_0x23eca9[_0x5d34('0x2d')],_0x23eca9['query']);_0x157382[_0x5d34('0x30')]=_[_0x5d34('0x31')](_0x23eca9[_0x5d34('0x2d')],qs[_0x5d34('0x32')](_0x387b35[_0x5d34('0x2e')][_0x5d34('0x32')]));_0x157382[_0x5d34('0x30')]=_0x157382[_0x5d34('0x30')][_0x5d34('0x33')]?_0x157382[_0x5d34('0x30')]:_0x23eca9['model'];if(!_0x387b35[_0x5d34('0x2e')][_0x5d34('0x34')]('nolimit')){_0x157382[_0x5d34('0x1e')]=qs[_0x5d34('0x1e')](_0x387b35['query']['limit']);_0x157382['offset']=qs['offset'](_0x387b35['query'][_0x5d34('0x1d')]);}_0x157382[_0x5d34('0x35')]=qs['sort'](_0x387b35['query'][_0x5d34('0x36')]);_0x157382['where']=qs['filters'](_[_0x5d34('0x37')](_0x387b35[_0x5d34('0x2e')],_0x23eca9[_0x5d34('0x38')]),_0x5aaede);if(_0x387b35[_0x5d34('0x2e')][_0x5d34('0x39')]){_0x157382[_0x5d34('0x3a')]=_['merge'](_0x157382[_0x5d34('0x3a')],{'$or':_['map'](_0x5aaede,function(_0x3c7b46){if(_0x3c7b46[_0x5d34('0x3b')]!=='VIRTUAL'){var _0x28a659={};_0x28a659[_0x3c7b46[_0x5d34('0x27')]]={'$like':'%'+_0x387b35[_0x5d34('0x2e')][_0x5d34('0x39')]+'%'};return _0x28a659;}})});}_0x157382=_[_0x5d34('0x3c')]({},_0x157382,_0x387b35['options']);var _0x2592c6={'where':_0x157382[_0x5d34('0x3a')]};return db[_0x5d34('0x3d')][_0x5d34('0x1f')](_0x2592c6)[_0x5d34('0x24')](function(_0x213765){_0x4e5b5b[_0x5d34('0x1f')]=_0x213765;if(_0x387b35[_0x5d34('0x2e')][_0x5d34('0x3e')]){_0x157382['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x5d34('0x3f')](_0x157382);})[_0x5d34('0x24')](function(_0x38c56b){_0x4e5b5b[_0x5d34('0x40')]=_0x38c56b;return _0x4e5b5b;})[_0x5d34('0x24')](respondWithFilteredResult(_0x5c8828,_0x157382))['catch'](handleError(_0x5c8828,null));};exports['show']=function(_0x4734f9,_0x4d8be4){var _0x2fde0e={'raw':!![],'where':{'id':_0x4734f9[_0x5d34('0x41')]['id']}},_0x30bd32={};_0x30bd32[_0x5d34('0x2d')]=_['keys'](db[_0x5d34('0x3d')][_0x5d34('0x2a')]);_0x30bd32[_0x5d34('0x2e')]=_[_0x5d34('0x2f')](_0x4734f9[_0x5d34('0x2e')]);_0x30bd32[_0x5d34('0x38')]=_[_0x5d34('0x31')](_0x30bd32['model'],_0x30bd32['query']);_0x2fde0e[_0x5d34('0x30')]=_['intersection'](_0x30bd32['model'],qs[_0x5d34('0x32')](_0x4734f9[_0x5d34('0x2e')][_0x5d34('0x32')]));_0x2fde0e[_0x5d34('0x30')]=_0x2fde0e[_0x5d34('0x30')][_0x5d34('0x33')]?_0x2fde0e[_0x5d34('0x30')]:_0x30bd32['model'];if(_0x4734f9[_0x5d34('0x2e')][_0x5d34('0x3e')]){_0x2fde0e['include']=[{'all':!![]}];}_0x2fde0e=_[_0x5d34('0x3c')]({},_0x2fde0e,_0x4734f9['options']);return db[_0x5d34('0x3d')][_0x5d34('0x42')](_0x2fde0e)[_0x5d34('0x24')](handleEntityNotFound(_0x4d8be4,null))[_0x5d34('0x24')](respondWithResult(_0x4d8be4,null))[_0x5d34('0x43')](handleError(_0x4d8be4,null));};exports[_0x5d34('0x44')]=function(_0x4462b8,_0x265a41){return db[_0x5d34('0x3d')][_0x5d34('0x44')](_0x4462b8['body'],{})[_0x5d34('0x24')](respondWithResult(_0x265a41,0xc9))[_0x5d34('0x43')](handleError(_0x265a41,null));};exports[_0x5d34('0x23')]=function(_0x48f6a3,_0x8de2de){if(_0x48f6a3[_0x5d34('0x45')]['id']){delete _0x48f6a3[_0x5d34('0x45')]['id'];}return db[_0x5d34('0x3d')][_0x5d34('0x42')]({'where':{'id':_0x48f6a3['params']['id']}})[_0x5d34('0x24')](handleEntityNotFound(_0x8de2de,null))[_0x5d34('0x24')](saveUpdates(_0x48f6a3['body'],null))[_0x5d34('0x24')](respondWithResult(_0x8de2de,null))[_0x5d34('0x43')](handleError(_0x8de2de,null));};exports[_0x5d34('0x25')]=function(_0x3a5637,_0x3361fd){return db['FreshsalesField']['find']({'where':{'id':_0x3a5637[_0x5d34('0x41')]['id']}})['then'](handleEntityNotFound(_0x3361fd,null))[_0x5d34('0x24')](removeEntity(_0x3361fd,null))[_0x5d34('0x43')](handleError(_0x3361fd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5b11be4..9d495d8 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 _0xbc95=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','FreshsalesField','idField','FieldId'];(function(_0x424c52,_0xd02950){var _0x3af0a8=function(_0x247b3e){while(--_0x247b3e){_0x424c52['push'](_0x424c52['shift']());}};_0x3af0a8(++_0xd02950);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x8261bb,_0x48e718){_0x8261bb=_0x8261bb-0x0;var _0x530867=_0xbc95[_0x8261bb];return _0x530867;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var logger=require(_0x5bc9('0x2'))(_0x5bc9('0x3'));var moment=require(_0x5bc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc9('0x5'));var config=require(_0x5bc9('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x5cca07,_0x889a0e){return _0x5cca07['define'](_0x5bc9('0x7'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x5bc9('0x8'),_0x5bc9('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba38=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x39e1fe,_0x3e4eb6){var _0x2c311c=function(_0x110468){while(--_0x110468){_0x39e1fe['push'](_0x39e1fe['shift']());}};_0x2c311c(++_0x3e4eb6);}(_0xba38,0x190));var _0x8ba3=function(_0x903337,_0x373c55){_0x903337=_0x903337-0x0;var _0x22b7cd=_0xba38[_0x903337];return _0x22b7cd;};'use strict';var _=require('lodash');var util=require(_0x8ba3('0x0'));var logger=require(_0x8ba3('0x1'))(_0x8ba3('0x2'));var moment=require('moment');var BPromise=require(_0x8ba3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba3('0x4'));var rimraf=require(_0x8ba3('0x5'));var config=require(_0x8ba3('0x6'));var attributes=require(_0x8ba3('0x7'));module[_0x8ba3('0x8')]=function(_0x1d18b7,_0x3edeae){return _0x1d18b7[_0x8ba3('0x9')](_0x8ba3('0xa'),attributes,{'tableName':_0x8ba3('0xb'),'paranoid':![],'indexes':[{'name':_0x8ba3('0xc'),'fields':[_0x8ba3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c7d6382..915a378 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f8478,_0x542154){var _0x4968dc=function(_0x1ddf36){while(--_0x1ddf36){_0x4f8478['push'](_0x4f8478['shift']());}};_0x4968dc(++_0x542154);}(_0x1623,0xab));var _0x3162=function(_0x1a71df,_0x4686e5){_0x1a71df=_0x1a71df-0x0;var _0x384c7e=_0x1623[_0x1a71df];return _0x384c7e;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0x5d58,0x187));var _0x85d5=function(_0x19ac75,_0x3f3dd3){_0x19ac75=_0x19ac75-0x0;var _0x27e32c=_0x5d58[_0x19ac75];return _0x27e32c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d8ee15d..b40f028 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1d1c96,_0x2db0a9){var _0x3ed593=function(_0x1c6cee){while(--_0x1c6cee){_0x1d1c96['push'](_0x1d1c96['shift']());}};_0x3ed593(++_0x2db0a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x459c5d,_0xa67134){var _0x349019=function(_0x36975f){while(--_0x36975f){_0x459c5d['push'](_0x459c5d['shift']());}};_0x349019(++_0xa67134);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f868ef0..7b79eb8 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 _0x2b10=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x40aed1,_0x13178b){var _0x20d58e=function(_0x183d7b){while(--_0x183d7b){_0x40aed1['push'](_0x40aed1['shift']());}};_0x20d58e(++_0x13178b);}(_0x2b10,0x114));var _0x02b1=function(_0x204d27,_0x5dd5bb){_0x204d27=_0x204d27-0x0;var _0x181641=_0x2b10[_0x204d27];return _0x181641;};'use strict';var Sequelize=require(_0x02b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x02b1('0x1')]},'description':{'type':Sequelize[_0x02b1('0x1')]},'username':{'type':Sequelize[_0x02b1('0x1')],'unique':_0x02b1('0x2')},'remoteUri':{'type':Sequelize[_0x02b1('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x02b1('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x02b1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x02b1('0x3')](_0x02b1('0x4'),_0x02b1('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x57ef=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x25352a,_0x1a9ea4){var _0x4b82d9=function(_0x47cb95){while(--_0x47cb95){_0x25352a['push'](_0x25352a['shift']());}};_0x4b82d9(++_0x1a9ea4);}(_0x57ef,0xdb));var _0xf57e=function(_0xc46146,_0x2c7b7a){_0xc46146=_0xc46146-0x0;var _0x922b70=_0x57ef[_0xc46146];return _0x922b70;};'use strict';var Sequelize=require('sequelize');module[_0xf57e('0x0')]={'name':{'type':Sequelize[_0xf57e('0x1')]},'description':{'type':Sequelize[_0xf57e('0x1')]},'username':{'type':Sequelize[_0xf57e('0x1')],'unique':_0xf57e('0x2')},'remoteUri':{'type':Sequelize[_0xf57e('0x1')]},'password':{'type':Sequelize[_0xf57e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf57e('0x1')]},'securityToken':{'type':Sequelize[_0xf57e('0x1')]},'serverUrl':{'type':Sequelize[_0xf57e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf57e('0x3')](_0xf57e('0x4'),_0xf57e('0x5')),'defaultValue':_0xf57e('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b534443..60123af 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 _0xd053=['lastIndexOf','Connection','login','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','remove','includes','label','custom','picklistValues','value','False','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','status','index','map','rawAttributes','fieldName','type','key','keys','intersection','model','attributes','fields','query','length','hasOwnProperty','order','sort','filters','where','VIRTUAL','filter','merge','options','SalesforceAccount','findAll','rows','show','params','include','catch','create','body','find','destroy','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','substring'];(function(_0x31d84e,_0x45c456){var _0x2aa733=function(_0x3455eb){while(--_0x3455eb){_0x31d84e['push'](_0x31d84e['shift']());}};_0x2aa733(++_0x45c456);}(_0xd053,0x18b));var _0x3d05=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0xd053[_0x323430];return _0x9eecd1;};'use strict';var emlformat=require(_0x3d05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d05('0x1'));var jsonpatch=require(_0x3d05('0x2'));var rp=require(_0x3d05('0x3'));var moment=require('moment');var BPromise=require(_0x3d05('0x4'));var Mustache=require(_0x3d05('0x5'));var util=require('util');var path=require(_0x3d05('0x6'));var sox=require(_0x3d05('0x7'));var csv=require(_0x3d05('0x8'));var ejs=require(_0x3d05('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d05('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d05('0xb'));var deskjs=require(_0x3d05('0xc'));var toCsv=require(_0x3d05('0x8'));var querystring=require(_0x3d05('0xd'));var Papa=require('papaparse');var Redis=require(_0x3d05('0xe'));var authService=require(_0x3d05('0xf'));var qs=require(_0x3d05('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d05('0x11'));var logger=require('../../config/logger')(_0x3d05('0x12'));var utils=require(_0x3d05('0x13'));var config=require(_0x3d05('0x14'));var licenseUtil=require(_0x3d05('0x15'));var db=require(_0x3d05('0x16'))['db'];var integrations=require(_0x3d05('0x17'));function respondWithStatusCode(_0x256944,_0x2ad5db){_0x2ad5db=_0x2ad5db||0xcc;return function(_0xcfd096){if(_0xcfd096){return _0x256944[_0x3d05('0x18')](_0x2ad5db);}return _0x256944['status'](_0x2ad5db)[_0x3d05('0x19')]();};}function respondWithResult(_0x217975,_0x370abd){_0x370abd=_0x370abd||0xc8;return function(_0x26e149){if(_0x26e149){return _0x217975['status'](_0x370abd)[_0x3d05('0x1a')](_0x26e149);}};}function respondWithFilteredResult(_0x5e1925,_0xfba9f7){return function(_0x5a174e){if(_0x5a174e){var _0x4bd9cc=typeof _0xfba9f7[_0x3d05('0x1b')]===_0x3d05('0x1c')&&typeof _0xfba9f7[_0x3d05('0x1d')]===_0x3d05('0x1c');var _0x512a61=_0x5a174e[_0x3d05('0x1e')];var _0x3b7028=_0x4bd9cc?0x0:_0xfba9f7['offset'];var _0xe81871=_0x4bd9cc?_0x5a174e['count']:_0xfba9f7[_0x3d05('0x1b')]+_0xfba9f7[_0x3d05('0x1d')];var _0x46febf;if(_0xe81871>=_0x512a61){_0xe81871=_0x512a61;_0x46febf=0xc8;}else{_0x46febf=0xce;}_0x5e1925['status'](_0x46febf);return _0x5e1925[_0x3d05('0x1f')](_0x3d05('0x20'),_0x3b7028+'-'+_0xe81871+'/'+_0x512a61)[_0x3d05('0x1a')](_0x5a174e);}return null;};}function patchUpdates(_0x1ff86d){return function(_0x1621f0){try{jsonpatch['apply'](_0x1621f0,_0x1ff86d,!![]);}catch(_0x48affd){return BPromise[_0x3d05('0x21')](_0x48affd);}return _0x1621f0['save']();};}function saveUpdates(_0x44d3ca,_0x57357e){return function(_0x58d725){if(_0x58d725){return _0x58d725[_0x3d05('0x22')](_0x44d3ca)[_0x3d05('0x23')](function(_0x2cf030){return _0x2cf030;});}return null;};}function removeEntity(_0x2935ff,_0x3b239f){return function(_0x12c0c5){if(_0x12c0c5){return _0x12c0c5['destroy']()['then'](function(){_0x2935ff['status'](0xcc)[_0x3d05('0x19')]();});}};}function handleEntityNotFound(_0xdec907,_0x2b35de){return function(_0x545552){if(!_0x545552){_0xdec907['sendStatus'](0x194);}return _0x545552;};}function handleError(_0x1a9eb4,_0x22ade9){_0x22ade9=_0x22ade9||0x1f4;return function(_0x8d518f){logger['error'](_0x8d518f[_0x3d05('0x24')]);if(_0x8d518f[_0x3d05('0x25')]){delete _0x8d518f[_0x3d05('0x25')];}_0x1a9eb4[_0x3d05('0x26')](_0x22ade9)['send'](_0x8d518f);};}exports[_0x3d05('0x27')]=function(_0x23cbe1,_0x3622c7){var _0x3b5d78={},_0x2945ba={},_0x2976d5={'count':0x0,'rows':[]};var _0x411dda=_[_0x3d05('0x28')](db['SalesforceAccount'][_0x3d05('0x29')],function(_0x481353){return{'name':_0x481353[_0x3d05('0x2a')],'type':_0x481353[_0x3d05('0x2b')][_0x3d05('0x2c')]};});_0x2945ba['model']=_['map'](_0x411dda,_0x3d05('0x25'));_0x2945ba['query']=_[_0x3d05('0x2d')](_0x23cbe1['query']);_0x2945ba['filters']=_[_0x3d05('0x2e')](_0x2945ba[_0x3d05('0x2f')],_0x2945ba['query']);_0x3b5d78[_0x3d05('0x30')]=_['intersection'](_0x2945ba['model'],qs[_0x3d05('0x31')](_0x23cbe1[_0x3d05('0x32')][_0x3d05('0x31')]));_0x3b5d78['attributes']=_0x3b5d78[_0x3d05('0x30')][_0x3d05('0x33')]?_0x3b5d78[_0x3d05('0x30')]:_0x2945ba[_0x3d05('0x2f')];if(!_0x23cbe1[_0x3d05('0x32')][_0x3d05('0x34')]('nolimit')){_0x3b5d78[_0x3d05('0x1d')]=qs[_0x3d05('0x1d')](_0x23cbe1['query'][_0x3d05('0x1d')]);_0x3b5d78[_0x3d05('0x1b')]=qs[_0x3d05('0x1b')](_0x23cbe1[_0x3d05('0x32')][_0x3d05('0x1b')]);}_0x3b5d78[_0x3d05('0x35')]=qs[_0x3d05('0x36')](_0x23cbe1[_0x3d05('0x32')][_0x3d05('0x36')]);_0x3b5d78['where']=qs[_0x3d05('0x37')](_['pick'](_0x23cbe1[_0x3d05('0x32')],_0x2945ba[_0x3d05('0x37')]),_0x411dda);if(_0x23cbe1[_0x3d05('0x32')]['filter']){_0x3b5d78[_0x3d05('0x38')]=_['merge'](_0x3b5d78[_0x3d05('0x38')],{'$or':_[_0x3d05('0x28')](_0x411dda,function(_0x1a730a){if(_0x1a730a[_0x3d05('0x2b')]!==_0x3d05('0x39')){var _0x556152={};_0x556152[_0x1a730a['name']]={'$like':'%'+_0x23cbe1[_0x3d05('0x32')][_0x3d05('0x3a')]+'%'};return _0x556152;}})});}_0x3b5d78=_[_0x3d05('0x3b')]({},_0x3b5d78,_0x23cbe1[_0x3d05('0x3c')]);var _0x402cb3={'where':_0x3b5d78[_0x3d05('0x38')]};return db[_0x3d05('0x3d')][_0x3d05('0x1e')](_0x402cb3)['then'](function(_0x28b639){_0x2976d5['count']=_0x28b639;if(_0x23cbe1['query']['includeAll']){_0x3b5d78['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x3d05('0x3e')](_0x3b5d78);})[_0x3d05('0x23')](function(_0x566269){_0x2976d5[_0x3d05('0x3f')]=_0x566269;return _0x2976d5;})[_0x3d05('0x23')](respondWithFilteredResult(_0x3622c7,_0x3b5d78))['catch'](handleError(_0x3622c7,null));};exports[_0x3d05('0x40')]=function(_0x591906,_0x493ba3){var _0x4a44ab={'raw':![],'where':{'id':_0x591906[_0x3d05('0x41')]['id']}},_0x4d46a1={};_0x4d46a1[_0x3d05('0x2f')]=_['keys'](db[_0x3d05('0x3d')][_0x3d05('0x29')]);_0x4d46a1[_0x3d05('0x32')]=_[_0x3d05('0x2d')](_0x591906[_0x3d05('0x32')]);_0x4d46a1['filters']=_['intersection'](_0x4d46a1[_0x3d05('0x2f')],_0x4d46a1[_0x3d05('0x32')]);_0x4a44ab[_0x3d05('0x30')]=_[_0x3d05('0x2e')](_0x4d46a1[_0x3d05('0x2f')],qs[_0x3d05('0x31')](_0x591906['query']['fields']));_0x4a44ab['attributes']=_0x4a44ab[_0x3d05('0x30')][_0x3d05('0x33')]?_0x4a44ab[_0x3d05('0x30')]:_0x4d46a1[_0x3d05('0x2f')];if(_0x591906['query']['includeAll']){_0x4a44ab[_0x3d05('0x42')]=[{'all':!![]}];}_0x4a44ab=_['merge']({},_0x4a44ab,_0x591906[_0x3d05('0x3c')]);return db[_0x3d05('0x3d')]['find'](_0x4a44ab)[_0x3d05('0x23')](handleEntityNotFound(_0x493ba3,null))[_0x3d05('0x23')](respondWithResult(_0x493ba3,null))[_0x3d05('0x43')](handleError(_0x493ba3,null));};exports[_0x3d05('0x44')]=function(_0x342f94,_0x2b8360){return db[_0x3d05('0x3d')]['create'](_0x342f94[_0x3d05('0x45')],{})[_0x3d05('0x23')](respondWithResult(_0x2b8360,0xc9))[_0x3d05('0x43')](handleError(_0x2b8360,null));};exports[_0x3d05('0x22')]=function(_0x65a4ca,_0x519868){if(_0x65a4ca[_0x3d05('0x45')]['id']){delete _0x65a4ca[_0x3d05('0x45')]['id'];}return db[_0x3d05('0x3d')][_0x3d05('0x46')]({'where':{'id':_0x65a4ca[_0x3d05('0x41')]['id']}})[_0x3d05('0x23')](handleEntityNotFound(_0x519868,null))[_0x3d05('0x23')](saveUpdates(_0x65a4ca[_0x3d05('0x45')],null))['then'](respondWithResult(_0x519868,null))['catch'](handleError(_0x519868,null));};exports[_0x3d05('0x47')]=function(_0x326d47,_0x461d80){return db['SalesforceAccount'][_0x3d05('0x46')]({'where':{'id':_0x326d47[_0x3d05('0x41')]['id']}})[_0x3d05('0x23')](handleEntityNotFound(_0x461d80,null))[_0x3d05('0x23')](removeEntity(_0x461d80,null))[_0x3d05('0x43')](handleError(_0x461d80,null));};exports[_0x3d05('0x48')]=function(_0x4b2d6a,_0xa4339c,_0x69e73e){var _0xb01d22={};var _0x8a85c={};var _0x30683e;var _0x425af6;return db[_0x3d05('0x3d')][_0x3d05('0x49')]({'where':{'id':_0x4b2d6a[_0x3d05('0x41')]['id']}})['then'](handleEntityNotFound(_0xa4339c,null))[_0x3d05('0x23')](function(_0x23d25f){if(_0x23d25f){_0x30683e=_0x23d25f;_0x8a85c[_0x3d05('0x2f')]=_['keys'](db[_0x3d05('0x4a')][_0x3d05('0x29')]);_0x8a85c[_0x3d05('0x32')]=_[_0x3d05('0x2d')](_0x4b2d6a[_0x3d05('0x32')]);_0x8a85c[_0x3d05('0x37')]=_[_0x3d05('0x2e')](_0x8a85c['model'],_0x8a85c[_0x3d05('0x32')]);_0xb01d22['attributes']=_[_0x3d05('0x2e')](_0x8a85c[_0x3d05('0x2f')],qs[_0x3d05('0x31')](_0x4b2d6a[_0x3d05('0x32')]['fields']));_0xb01d22[_0x3d05('0x30')]=_0xb01d22[_0x3d05('0x30')][_0x3d05('0x33')]?_0xb01d22[_0x3d05('0x30')]:_0x8a85c[_0x3d05('0x2f')];_0xb01d22[_0x3d05('0x35')]=qs[_0x3d05('0x36')](_0x4b2d6a[_0x3d05('0x32')]['sort']);_0xb01d22[_0x3d05('0x38')]=qs[_0x3d05('0x37')](_['pick'](_0x4b2d6a[_0x3d05('0x32')],_0x8a85c[_0x3d05('0x37')]));if(_0x4b2d6a['query'][_0x3d05('0x3a')]){_0xb01d22[_0x3d05('0x38')]=_['merge'](_0xb01d22[_0x3d05('0x38')],{'$or':_[_0x3d05('0x28')](_0xb01d22[_0x3d05('0x30')],function(_0x109088){var _0x4ecdcb={};_0x4ecdcb[_0x109088]={'$like':'%'+_0x4b2d6a['query'][_0x3d05('0x3a')]+'%'};return _0x4ecdcb;})});}_0xb01d22=_[_0x3d05('0x3b')]({},_0xb01d22,_0x4b2d6a[_0x3d05('0x3c')]);return _0x30683e['getConfigurations'](_0xb01d22);}})[_0x3d05('0x23')](function(_0x1d87bb){if(_0x1d87bb){_0x425af6=_0x1d87bb['length'];if(!_0x4b2d6a[_0x3d05('0x32')][_0x3d05('0x34')](_0x3d05('0x4b'))){_0xb01d22['limit']=qs[_0x3d05('0x1d')](_0x4b2d6a[_0x3d05('0x32')][_0x3d05('0x1d')]);_0xb01d22[_0x3d05('0x1b')]=qs[_0x3d05('0x1b')](_0x4b2d6a['query']['offset']);}return _0x30683e[_0x3d05('0x48')](_0xb01d22);}})['then'](function(_0x820f1d){if(_0x820f1d){return _0x820f1d?{'count':_0x425af6,'rows':_0x820f1d}:null;}})[_0x3d05('0x23')](respondWithResult(_0xa4339c,null))[_0x3d05('0x43')](handleError(_0xa4339c,null));};exports[_0x3d05('0x4c')]=function(_0x327437,_0xd865b3,_0x8f739b){if(_0x327437['body']['id']){delete _0x327437[_0x3d05('0x45')]['id'];}return db[_0x3d05('0x3d')][_0x3d05('0x49')]({'where':{'id':_0x327437[_0x3d05('0x41')]['id']}})[_0x3d05('0x23')](handleEntityNotFound(_0xd865b3,null))[_0x3d05('0x23')](function(_0x4413ee){if(_0x4413ee){_0x327437[_0x3d05('0x45')]['AccountId']=_0x4413ee['id'];_0x327437[_0x3d05('0x45')][_0x3d05('0x4d')]=integrations['getSubjects'](_0x327437[_0x3d05('0x45')][_0x3d05('0x4e')],_0x327437[_0x3d05('0x45')]['type']);_0x327437[_0x3d05('0x45')][_0x3d05('0x4f')]=integrations[_0x3d05('0x50')](_0x327437[_0x3d05('0x45')][_0x3d05('0x4e')],_0x327437[_0x3d05('0x45')][_0x3d05('0x2b')]);return db[_0x3d05('0x4a')][_0x3d05('0x44')](_0x327437[_0x3d05('0x45')],{'include':[{'model':db[_0x3d05('0x51')],'as':_0x3d05('0x4d')},{'model':db[_0x3d05('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xd865b3,null))['catch'](handleError(_0xd865b3,null));};exports[_0x3d05('0x52')]=function(_0x3c2bad,_0x125802,_0x5196de){var _0x21bee7;var _0x24cd35='';var _0x5d3688='Task';return db['SalesforceAccount'][_0x3d05('0x49')]({'where':{'id':_0x3c2bad[_0x3d05('0x41')]['id']},'attributes':['id',_0x3d05('0x53'),_0x3d05('0x54'),_0x3d05('0x55'),_0x3d05('0x56'),_0x3d05('0x57'),'securityToken']})[_0x3d05('0x23')](handleEntityNotFound(_0x125802,null))['then'](function(_0x528617){if(_0x528617){_0x24cd35=_0x528617[_0x3d05('0x53')];var _0x4c8fb7=_0x24cd35['slice'](-0x1);if(_0x4c8fb7==='/'){_0x24cd35=_0x24cd35[_0x3d05('0x58')](0x0,_0x24cd35[_0x3d05('0x59')](_0x4c8fb7));}_0x21bee7=new jsforce[(_0x3d05('0x5a'))]({'oauth2':{'loginUrl':_0x24cd35,'clientId':_0x528617[_0x3d05('0x54')],'clientSecret':_0x528617[_0x3d05('0x55')]}});return _0x21bee7[_0x3d05('0x5b')](_0x528617[_0x3d05('0x56')],_0x528617['password']['concat'](_0x528617[_0x3d05('0x5c')]));}})[_0x3d05('0x23')](function(_0x9f8255){if(_0x9f8255){if(!_[_0x3d05('0x5d')](_0x3c2bad[_0x3d05('0x32')][_0x3d05('0x5e')])){_0x5d3688=_0x3c2bad['query']['ticketType'];}return _0x21bee7[_0x3d05('0x5f')](_0x5d3688)[_0x3d05('0x60')]();}})[_0x3d05('0x23')](function(_0x3af21d){var _0x991130=[_0x3d05('0x61'),_0x3d05('0x62'),_0x3d05('0x63'),_0x3d05('0x64'),_0x3d05('0x65'),'Description'];var _0x41956e=[_0x3d05('0x66'),_0x3d05('0x67'),_0x3d05('0x68'),_0x3d05('0x69'),_0x3d05('0x6a'),'textarea','phone'];if(_0x3af21d){_[_0x3d05('0x6b')](_0x3af21d[_0x3d05('0x31')],function(_0x30a919){return _0x991130['includes'](_0x30a919['name'])||!_0x41956e[_0x3d05('0x6c')](_0x30a919['type']);});return{'count':_0x3af21d['fields'][_0x3d05('0x33')],'rows':_[_0x3d05('0x28')](_0x3af21d[_0x3d05('0x31')],function(_0x365df7){return{'id':_0x365df7[_0x3d05('0x25')],'name':_0x365df7[_0x3d05('0x6d')],'custom':_0x365df7[_0x3d05('0x6e')],'options':_0x365df7[_0x3d05('0x6f')][_0x3d05('0x33')]>0x0?_[_0x3d05('0x28')](_0x365df7[_0x3d05('0x6f')],function(_0xf24801){return{'name':_0xf24801[_0x3d05('0x6d')],'value':_0xf24801[_0x3d05('0x70')]};}):_0x365df7['type']=='boolean'?[{'name':'True','value':'true'},{'name':_0x3d05('0x71'),'value':'false'}]:[]};})};}})[_0x3d05('0x23')](respondWithResult(_0x125802,null))['catch'](function(_0x3ecb76){var _0x19e483=_0x3c2bad[_0x3d05('0x32')][_0x3d05('0x72')]?0x1f4:_0x3ecb76['statusCode']||0x1f4;logger[_0x3d05('0x73')](_0x3d05('0x74'),_0x3d05('0x52'),_0x19e483,JSON[_0x3d05('0x75')](_0x3ecb76));delete _0x3ecb76[_0x3d05('0x25')];if(_0x19e483===0x191){_0x19e483=0x190;}_0x125802['status'](_0x19e483)[_0x3d05('0x76')](_0x3c2bad[_0x3d05('0x32')][_0x3d05('0x72')]?{'message':_0x3d05('0x77'),'statusCode':_0x3ecb76[_0x3d05('0x78')]}:_0x3ecb76);});}; \ No newline at end of file +var _0xc8ca=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','catch','params','findOne','SalesforceConfiguration','fields','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','type','getFields','Task','clientId','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x292f84,_0x26ca99){var _0x324990=function(_0x25ccf9){while(--_0x25ccf9){_0x292f84['push'](_0x292f84['shift']());}};_0x324990(++_0x26ca99);}(_0xc8ca,0x68));var _0xac8c=function(_0xb8a324,_0x2ee9e6){_0xb8a324=_0xb8a324-0x0;var _0x2e970a=_0xc8ca[_0xb8a324];return _0x2e970a;};'use strict';var emlformat=require(_0xac8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xac8c('0x1'));var rp=require(_0xac8c('0x2'));var moment=require('moment');var BPromise=require(_0xac8c('0x3'));var Mustache=require(_0xac8c('0x4'));var util=require('util');var path=require(_0xac8c('0x5'));var sox=require(_0xac8c('0x6'));var csv=require('to-csv');var ejs=require(_0xac8c('0x7'));var fs=require('fs');var fs_extra=require(_0xac8c('0x8'));var _=require(_0xac8c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac8c('0xa'));var toCsv=require(_0xac8c('0xb'));var querystring=require(_0xac8c('0xc'));var Papa=require(_0xac8c('0xd'));var Redis=require(_0xac8c('0xe'));var authService=require(_0xac8c('0xf'));var qs=require(_0xac8c('0x10'));var as=require(_0xac8c('0x11'));var hardwareService=require(_0xac8c('0x12'));var logger=require('../../config/logger')(_0xac8c('0x13'));var utils=require('../../config/utils');var config=require(_0xac8c('0x14'));var licenseUtil=require(_0xac8c('0x15'));var db=require(_0xac8c('0x16'))['db'];var integrations=require(_0xac8c('0x17'));function respondWithStatusCode(_0xdc1d84,_0x4a1a1d){_0x4a1a1d=_0x4a1a1d||0xcc;return function(_0x83afb6){if(_0x83afb6){return _0xdc1d84[_0xac8c('0x18')](_0x4a1a1d);}return _0xdc1d84[_0xac8c('0x19')](_0x4a1a1d)['end']();};}function respondWithResult(_0x1e6760,_0x6d6739){_0x6d6739=_0x6d6739||0xc8;return function(_0x976b18){if(_0x976b18){return _0x1e6760[_0xac8c('0x19')](_0x6d6739)[_0xac8c('0x1a')](_0x976b18);}};}function respondWithFilteredResult(_0x588f36,_0x35952f){return function(_0x850436){if(_0x850436){var _0x57337b=typeof _0x35952f[_0xac8c('0x1b')]===_0xac8c('0x1c')&&typeof _0x35952f[_0xac8c('0x1d')]==='undefined';var _0x135448=_0x850436[_0xac8c('0x1e')];var _0x312530=_0x57337b?0x0:_0x35952f[_0xac8c('0x1b')];var _0x2e021e=_0x57337b?_0x850436[_0xac8c('0x1e')]:_0x35952f[_0xac8c('0x1b')]+_0x35952f[_0xac8c('0x1d')];var _0x138c6e;if(_0x2e021e>=_0x135448){_0x2e021e=_0x135448;_0x138c6e=0xc8;}else{_0x138c6e=0xce;}_0x588f36[_0xac8c('0x19')](_0x138c6e);return _0x588f36[_0xac8c('0x1f')](_0xac8c('0x20'),_0x312530+'-'+_0x2e021e+'/'+_0x135448)[_0xac8c('0x1a')](_0x850436);}return null;};}function patchUpdates(_0x453249){return function(_0x39934b){try{jsonpatch[_0xac8c('0x21')](_0x39934b,_0x453249,!![]);}catch(_0x584f52){return BPromise[_0xac8c('0x22')](_0x584f52);}return _0x39934b[_0xac8c('0x23')]();};}function saveUpdates(_0x52395e,_0x594330){return function(_0x355038){if(_0x355038){return _0x355038[_0xac8c('0x24')](_0x52395e)[_0xac8c('0x25')](function(_0xda37e7){return _0xda37e7;});}return null;};}function removeEntity(_0x10ada9,_0x16a416){return function(_0xf431ac){if(_0xf431ac){return _0xf431ac[_0xac8c('0x26')]()['then'](function(){_0x10ada9[_0xac8c('0x19')](0xcc)[_0xac8c('0x27')]();});}};}function handleEntityNotFound(_0x2c9b51,_0x5ce84b){return function(_0x1b9020){if(!_0x1b9020){_0x2c9b51[_0xac8c('0x18')](0x194);}return _0x1b9020;};}function handleError(_0x16ed73,_0x33944f){_0x33944f=_0x33944f||0x1f4;return function(_0x2371b2){logger[_0xac8c('0x28')](_0x2371b2[_0xac8c('0x29')]);if(_0x2371b2['name']){delete _0x2371b2[_0xac8c('0x2a')];}_0x16ed73[_0xac8c('0x19')](_0x33944f)[_0xac8c('0x2b')](_0x2371b2);};}exports[_0xac8c('0x2c')]=function(_0x830e7f,_0x18a791){var _0x16a8fc={},_0x21f7dc={},_0x50d906={'count':0x0,'rows':[]};var _0x1f274e=_[_0xac8c('0x2d')](db[_0xac8c('0x2e')][_0xac8c('0x2f')],function(_0x410ff3){return{'name':_0x410ff3[_0xac8c('0x30')],'type':_0x410ff3['type'][_0xac8c('0x31')]};});_0x21f7dc[_0xac8c('0x32')]=_[_0xac8c('0x2d')](_0x1f274e,_0xac8c('0x2a'));_0x21f7dc[_0xac8c('0x33')]=_[_0xac8c('0x34')](_0x830e7f[_0xac8c('0x33')]);_0x21f7dc[_0xac8c('0x35')]=_['intersection'](_0x21f7dc['model'],_0x21f7dc[_0xac8c('0x33')]);_0x16a8fc[_0xac8c('0x36')]=_[_0xac8c('0x37')](_0x21f7dc[_0xac8c('0x32')],qs['fields'](_0x830e7f[_0xac8c('0x33')]['fields']));_0x16a8fc[_0xac8c('0x36')]=_0x16a8fc['attributes'][_0xac8c('0x38')]?_0x16a8fc[_0xac8c('0x36')]:_0x21f7dc[_0xac8c('0x32')];if(!_0x830e7f[_0xac8c('0x33')][_0xac8c('0x39')](_0xac8c('0x3a'))){_0x16a8fc['limit']=qs[_0xac8c('0x1d')](_0x830e7f[_0xac8c('0x33')][_0xac8c('0x1d')]);_0x16a8fc[_0xac8c('0x1b')]=qs[_0xac8c('0x1b')](_0x830e7f[_0xac8c('0x33')]['offset']);}_0x16a8fc[_0xac8c('0x3b')]=qs['sort'](_0x830e7f[_0xac8c('0x33')][_0xac8c('0x3c')]);_0x16a8fc['where']=qs[_0xac8c('0x35')](_[_0xac8c('0x3d')](_0x830e7f[_0xac8c('0x33')],_0x21f7dc[_0xac8c('0x35')]),_0x1f274e);if(_0x830e7f[_0xac8c('0x33')]['filter']){_0x16a8fc[_0xac8c('0x3e')]=_[_0xac8c('0x3f')](_0x16a8fc[_0xac8c('0x3e')],{'$or':_[_0xac8c('0x2d')](_0x1f274e,function(_0x198307){if(_0x198307['type']!==_0xac8c('0x40')){var _0x3e7627={};_0x3e7627[_0x198307[_0xac8c('0x2a')]]={'$like':'%'+_0x830e7f[_0xac8c('0x33')][_0xac8c('0x41')]+'%'};return _0x3e7627;}})});}_0x16a8fc=_[_0xac8c('0x3f')]({},_0x16a8fc,_0x830e7f[_0xac8c('0x42')]);var _0x6b29df={'where':_0x16a8fc[_0xac8c('0x3e')]};return db['SalesforceAccount'][_0xac8c('0x1e')](_0x6b29df)['then'](function(_0x4f8552){_0x50d906[_0xac8c('0x1e')]=_0x4f8552;if(_0x830e7f[_0xac8c('0x33')][_0xac8c('0x43')]){_0x16a8fc[_0xac8c('0x44')]=[{'all':!![]}];}return db[_0xac8c('0x2e')][_0xac8c('0x45')](_0x16a8fc);})['then'](function(_0xb95e96){_0x50d906[_0xac8c('0x46')]=_0xb95e96;return _0x50d906;})[_0xac8c('0x25')](respondWithFilteredResult(_0x18a791,_0x16a8fc))['catch'](handleError(_0x18a791,null));};exports['show']=function(_0x3d9ec8,_0x54857a){var _0x2e286b={'raw':![],'where':{'id':_0x3d9ec8['params']['id']}},_0x1f4cd7={};_0x1f4cd7['model']=_['keys'](db[_0xac8c('0x2e')][_0xac8c('0x2f')]);_0x1f4cd7['query']=_[_0xac8c('0x34')](_0x3d9ec8['query']);_0x1f4cd7[_0xac8c('0x35')]=_[_0xac8c('0x37')](_0x1f4cd7[_0xac8c('0x32')],_0x1f4cd7['query']);_0x2e286b[_0xac8c('0x36')]=_[_0xac8c('0x37')](_0x1f4cd7[_0xac8c('0x32')],qs['fields'](_0x3d9ec8[_0xac8c('0x33')]['fields']));_0x2e286b[_0xac8c('0x36')]=_0x2e286b[_0xac8c('0x36')][_0xac8c('0x38')]?_0x2e286b[_0xac8c('0x36')]:_0x1f4cd7[_0xac8c('0x32')];if(_0x3d9ec8['query'][_0xac8c('0x43')]){_0x2e286b['include']=[{'all':!![]}];}_0x2e286b=_['merge']({},_0x2e286b,_0x3d9ec8[_0xac8c('0x42')]);return db[_0xac8c('0x2e')][_0xac8c('0x47')](_0x2e286b)[_0xac8c('0x25')](handleEntityNotFound(_0x54857a,null))[_0xac8c('0x25')](respondWithResult(_0x54857a,null))['catch'](handleError(_0x54857a,null));};exports[_0xac8c('0x48')]=function(_0x110077,_0x3a92a2){return db['SalesforceAccount'][_0xac8c('0x48')](_0x110077[_0xac8c('0x49')],{})[_0xac8c('0x25')](respondWithResult(_0x3a92a2,0xc9))[_0xac8c('0x4a')](handleError(_0x3a92a2,null));};exports['update']=function(_0x4fe92f,_0x25855a){if(_0x4fe92f['body']['id']){delete _0x4fe92f['body']['id'];}return db[_0xac8c('0x2e')]['find']({'where':{'id':_0x4fe92f[_0xac8c('0x4b')]['id']}})[_0xac8c('0x25')](handleEntityNotFound(_0x25855a,null))[_0xac8c('0x25')](saveUpdates(_0x4fe92f[_0xac8c('0x49')],null))[_0xac8c('0x25')](respondWithResult(_0x25855a,null))[_0xac8c('0x4a')](handleError(_0x25855a,null));};exports['destroy']=function(_0x3792e6,_0x351309){return db[_0xac8c('0x2e')][_0xac8c('0x47')]({'where':{'id':_0x3792e6[_0xac8c('0x4b')]['id']}})[_0xac8c('0x25')](handleEntityNotFound(_0x351309,null))[_0xac8c('0x25')](removeEntity(_0x351309,null))['catch'](handleError(_0x351309,null));};exports['getConfigurations']=function(_0x49d959,_0x70cbfa,_0x2c005e){var _0x35b398={};var _0x143b74={};var _0x56aabf;var _0xa4baa4;return db[_0xac8c('0x2e')][_0xac8c('0x4c')]({'where':{'id':_0x49d959[_0xac8c('0x4b')]['id']}})[_0xac8c('0x25')](handleEntityNotFound(_0x70cbfa,null))[_0xac8c('0x25')](function(_0x282a8a){if(_0x282a8a){_0x56aabf=_0x282a8a;_0x143b74[_0xac8c('0x32')]=_[_0xac8c('0x34')](db[_0xac8c('0x4d')][_0xac8c('0x2f')]);_0x143b74['query']=_[_0xac8c('0x34')](_0x49d959[_0xac8c('0x33')]);_0x143b74[_0xac8c('0x35')]=_[_0xac8c('0x37')](_0x143b74[_0xac8c('0x32')],_0x143b74[_0xac8c('0x33')]);_0x35b398[_0xac8c('0x36')]=_[_0xac8c('0x37')](_0x143b74[_0xac8c('0x32')],qs[_0xac8c('0x4e')](_0x49d959['query'][_0xac8c('0x4e')]));_0x35b398[_0xac8c('0x36')]=_0x35b398[_0xac8c('0x36')][_0xac8c('0x38')]?_0x35b398['attributes']:_0x143b74[_0xac8c('0x32')];_0x35b398[_0xac8c('0x3b')]=qs[_0xac8c('0x3c')](_0x49d959[_0xac8c('0x33')][_0xac8c('0x3c')]);_0x35b398[_0xac8c('0x3e')]=qs[_0xac8c('0x35')](_[_0xac8c('0x3d')](_0x49d959[_0xac8c('0x33')],_0x143b74['filters']));if(_0x49d959[_0xac8c('0x33')][_0xac8c('0x41')]){_0x35b398[_0xac8c('0x3e')]=_[_0xac8c('0x3f')](_0x35b398['where'],{'$or':_[_0xac8c('0x2d')](_0x35b398[_0xac8c('0x36')],function(_0x51ae74){var _0x5eb0ad={};_0x5eb0ad[_0x51ae74]={'$like':'%'+_0x49d959['query'][_0xac8c('0x41')]+'%'};return _0x5eb0ad;})});}_0x35b398=_[_0xac8c('0x3f')]({},_0x35b398,_0x49d959['options']);return _0x56aabf[_0xac8c('0x4f')](_0x35b398);}})[_0xac8c('0x25')](function(_0x4b4bd6){if(_0x4b4bd6){_0xa4baa4=_0x4b4bd6[_0xac8c('0x38')];if(!_0x49d959[_0xac8c('0x33')][_0xac8c('0x39')](_0xac8c('0x3a'))){_0x35b398[_0xac8c('0x1d')]=qs[_0xac8c('0x1d')](_0x49d959[_0xac8c('0x33')][_0xac8c('0x1d')]);_0x35b398[_0xac8c('0x1b')]=qs['offset'](_0x49d959[_0xac8c('0x33')][_0xac8c('0x1b')]);}return _0x56aabf[_0xac8c('0x4f')](_0x35b398);}})[_0xac8c('0x25')](function(_0x1d94f0){if(_0x1d94f0){return _0x1d94f0?{'count':_0xa4baa4,'rows':_0x1d94f0}:null;}})['then'](respondWithResult(_0x70cbfa,null))[_0xac8c('0x4a')](handleError(_0x70cbfa,null));};exports[_0xac8c('0x50')]=function(_0x1ec10e,_0x3b8c32,_0x1351b1){if(_0x1ec10e[_0xac8c('0x49')]['id']){delete _0x1ec10e[_0xac8c('0x49')]['id'];}return db[_0xac8c('0x2e')][_0xac8c('0x4c')]({'where':{'id':_0x1ec10e[_0xac8c('0x4b')]['id']}})[_0xac8c('0x25')](handleEntityNotFound(_0x3b8c32,null))['then'](function(_0x3c5d7b){if(_0x3c5d7b){_0x1ec10e[_0xac8c('0x49')][_0xac8c('0x51')]=_0x3c5d7b['id'];_0x1ec10e[_0xac8c('0x49')]['Subjects']=integrations[_0xac8c('0x52')](_0x1ec10e[_0xac8c('0x49')][_0xac8c('0x53')],_0x1ec10e[_0xac8c('0x49')]['type']);_0x1ec10e[_0xac8c('0x49')][_0xac8c('0x54')]=integrations[_0xac8c('0x55')](_0x1ec10e[_0xac8c('0x49')]['channel'],_0x1ec10e[_0xac8c('0x49')][_0xac8c('0x56')]);return db[_0xac8c('0x4d')][_0xac8c('0x48')](_0x1ec10e[_0xac8c('0x49')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xac8c('0x54')}]});}return null;})['then'](respondWithResult(_0x3b8c32,null))[_0xac8c('0x4a')](handleError(_0x3b8c32,null));};exports[_0xac8c('0x57')]=function(_0x392c67,_0x2d8464,_0x3e2779){var _0x2fe4fe;var _0x544afa='';var _0x228f08=_0xac8c('0x58');return db[_0xac8c('0x2e')][_0xac8c('0x4c')]({'where':{'id':_0x392c67[_0xac8c('0x4b')]['id']},'attributes':['id','remoteUri',_0xac8c('0x59'),_0xac8c('0x5a'),_0xac8c('0x5b'),_0xac8c('0x5c'),'securityToken']})['then'](handleEntityNotFound(_0x2d8464,null))[_0xac8c('0x25')](function(_0x4c8ac1){if(_0x4c8ac1){_0x544afa=_0x4c8ac1[_0xac8c('0x5d')];var _0x2c1740=_0x544afa[_0xac8c('0x5e')](-0x1);if(_0x2c1740==='/'){_0x544afa=_0x544afa[_0xac8c('0x5f')](0x0,_0x544afa[_0xac8c('0x60')](_0x2c1740));}_0x2fe4fe=new jsforce['Connection']({'oauth2':{'loginUrl':_0x544afa,'clientId':_0x4c8ac1[_0xac8c('0x59')],'clientSecret':_0x4c8ac1[_0xac8c('0x5a')]}});return _0x2fe4fe['login'](_0x4c8ac1[_0xac8c('0x5b')],_0x4c8ac1[_0xac8c('0x5c')]['concat'](_0x4c8ac1['securityToken']));}})[_0xac8c('0x25')](function(_0x3f26f8){if(_0x3f26f8){if(!_[_0xac8c('0x61')](_0x392c67[_0xac8c('0x33')]['ticketType'])){_0x228f08=_0x392c67['query'][_0xac8c('0x62')];}return _0x2fe4fe['sobject'](_0x228f08)[_0xac8c('0x63')]();}})[_0xac8c('0x25')](function(_0x434209){var _0x1d4c56=[_0xac8c('0x64'),_0xac8c('0x65'),_0xac8c('0x66'),_0xac8c('0x67'),_0xac8c('0x68'),'Description'];var _0x34094b=[_0xac8c('0x69'),_0xac8c('0x6a'),_0xac8c('0x6b'),_0xac8c('0x6c'),_0xac8c('0x6d'),'textarea',_0xac8c('0x6e')];if(_0x434209){_[_0xac8c('0x6f')](_0x434209[_0xac8c('0x4e')],function(_0x3632fb){return _0x1d4c56[_0xac8c('0x70')](_0x3632fb[_0xac8c('0x2a')])||!_0x34094b[_0xac8c('0x70')](_0x3632fb['type']);});return{'count':_0x434209[_0xac8c('0x4e')][_0xac8c('0x38')],'rows':_['map'](_0x434209['fields'],function(_0x52d12d){return{'id':_0x52d12d['name'],'name':_0x52d12d[_0xac8c('0x71')],'custom':_0x52d12d[_0xac8c('0x72')],'options':_0x52d12d[_0xac8c('0x73')][_0xac8c('0x38')]>0x0?_[_0xac8c('0x2d')](_0x52d12d['picklistValues'],function(_0x20454b){return{'name':_0x20454b['label'],'value':_0x20454b[_0xac8c('0x74')]};}):_0x52d12d[_0xac8c('0x56')]=='boolean'?[{'name':_0xac8c('0x75'),'value':'true'},{'name':_0xac8c('0x76'),'value':_0xac8c('0x77')}]:[]};})};}})[_0xac8c('0x25')](respondWithResult(_0x2d8464,null))[_0xac8c('0x4a')](function(_0x1e80f4){var _0x457ea8=_0x392c67[_0xac8c('0x33')][_0xac8c('0x78')]?0x1f4:_0x1e80f4[_0xac8c('0x79')]||0x1f4;logger[_0xac8c('0x28')](_0xac8c('0x7a'),'getFields',_0x457ea8,JSON['stringify'](_0x1e80f4));delete _0x1e80f4['name'];if(_0x457ea8===0x191){_0x457ea8=0x190;}_0x2d8464[_0xac8c('0x19')](_0x457ea8)[_0xac8c('0x2b')](_0x392c67['query'][_0xac8c('0x78')]?{'message':_0xac8c('0x7b'),'statusCode':_0x1e80f4[_0xac8c('0x79')]}:_0x1e80f4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ddae5c7..6585418 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 _0x8f5d=['define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x9d4343,_0x9ba308){var _0x50dcf5=function(_0x29e73f){while(--_0x29e73f){_0x9d4343['push'](_0x9d4343['shift']());}};_0x50dcf5(++_0x9ba308);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x8f5d[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xd8f5('0x0'));var util=require('util');var logger=require(_0xd8f5('0x1'))('api');var moment=require(_0xd8f5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8f5('0x3'));var rimraf=require(_0xd8f5('0x4'));var config=require(_0xd8f5('0x5'));var attributes=require(_0xd8f5('0x6'));var integrations=require(_0xd8f5('0x7'));module[_0xd8f5('0x8')]=function(_0x2f8a1a,_0x2a28a0){return _0x2f8a1a[_0xd8f5('0x9')](_0xd8f5('0xa'),attributes,{'tableName':_0xd8f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe189=['request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','bluebird'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0xe189,0x194));var _0x9e18=function(_0x4186e6,_0xdc2de2){_0x4186e6=_0x4186e6-0x0;var _0x583758=_0xe189[_0x4186e6];return _0x583758;};'use strict';var _=require(_0x9e18('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9e18('0x1'));var moment=require(_0x9e18('0x2'));var BPromise=require(_0x9e18('0x3'));var rp=require(_0x9e18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e18('0x5'));var attributes=require(_0x9e18('0x6'));var integrations=require(_0x9e18('0x7'));module[_0x9e18('0x8')]=function(_0x3e6881,_0x5e6097){return _0x3e6881[_0x9e18('0x9')](_0x9e18('0xa'),attributes,{'tableName':_0x9e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 674b576..1e1ddc1 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 _0x5a43=['randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','model','map','attributes','debug','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird'];(function(_0x1f4bcc,_0x8f710f){var _0x29127e=function(_0x13018f){while(--_0x13018f){_0x1f4bcc['push'](_0x1f4bcc['shift']());}};_0x29127e(++_0x8f710f);}(_0x5a43,0xf1));var _0x35a4=function(_0x247dde,_0x5e7a49){_0x247dde=_0x247dde-0x0;var _0xaa539=_0x5a43[_0x247dde];return _0xaa539;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetSalesforceAccount',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetSalesforceAccount',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')]({'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x1da508[_0x35a4('0x17')]?_0x1da508['options'][_0x35a4('0x1e')]||null:null,'include':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')]['include']?_[_0x35a4('0x1d')](_0x1da508[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x48245c){return{'model':db[_0x48245c['model']],'as':_0x48245c['as'],'attributes':_0x48245c[_0x35a4('0x1e')],'include':_0x48245c['include']?_[_0x35a4('0x1d')](_0x48245c[_0x35a4('0x1b')],function(_0x274237){return{'model':db[_0x274237['model']],'as':_0x274237['as'],'attributes':_0x274237['attributes'],'include':_0x274237[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x274237[_0x35a4('0x1b')],function(_0x55510a){return{'model':db[_0x55510a[_0x35a4('0x1c')]],'as':_0x55510a['as'],'attributes':_0x55510a[_0x35a4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x368330){logger['info']('ShowSalesforceAccount',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x368330));_0x160bb5(_0x368330);})[_0x35a4('0x13')](function(_0xba030a){logger['error'](_0x35a4('0x21'),_0xba030a['message'],_0x1da508);_0x2e6d5d(_0x2e1985[_0x35a4('0xf')](0x1f4,_0xba030a['message']));});});}; \ No newline at end of file +var _0xbc5c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowSalesforceAccount','find','catch','lodash','moment','bluebird'];(function(_0x11c6f1,_0x2ef889){var _0x25225a=function(_0x150ed1){while(--_0x150ed1){_0x11c6f1['push'](_0x11c6f1['shift']());}};_0x25225a(++_0x2ef889);}(_0xbc5c,0x115));var _0xcbc5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbc5c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcbc5('0x0'));var util=require('util');var moment=require(_0xcbc5('0x1'));var BPromise=require(_0xcbc5('0x2'));var rs=require(_0xcbc5('0x3'));var fs=require('fs');var Redis=require(_0xcbc5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbc5('0x5'));var logger=require(_0xcbc5('0x6'))(_0xcbc5('0x7'));var config=require(_0xcbc5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbc5('0x9')][_0xcbc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x145c35,_0x432070,_0x4c5fb7){return new BPromise(function(_0x2a5459,_0x1328be){return client[_0xcbc5('0xb')](_0x145c35,_0x4c5fb7)['then'](function(_0x4149ce){logger[_0xcbc5('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x432070,_0xcbc5('0xd'));logger['debug'](_0xcbc5('0xe'),_0x432070,_0xcbc5('0xd'),JSON[_0xcbc5('0xf')](_0x4149ce));if(_0x4149ce['error']){if(_0x4149ce[_0xcbc5('0x10')]['code']===0x1f4){logger['error'](_0xcbc5('0x11'),_0x432070,_0x4149ce['error'][_0xcbc5('0x12')]);return _0x1328be(_0x4149ce[_0xcbc5('0x10')]['message']);}logger['error'](_0xcbc5('0x11'),_0x432070,_0x4149ce['error']['message']);return _0x2a5459(_0x4149ce[_0xcbc5('0x10')]['message']);}else{logger[_0xcbc5('0xc')](_0xcbc5('0x11'),_0x432070,'request\x20sent');_0x2a5459(_0x4149ce['result'][_0xcbc5('0x12')]);}})['catch'](function(_0x465a6e){logger[_0xcbc5('0x10')](_0xcbc5('0x11'),_0x432070,_0x465a6e);_0x1328be(_0x465a6e);});});}exports[_0xcbc5('0x13')]=function(_0x1bc063){var _0x9069e5=this;return new Promise(function(_0x7f8a36,_0x31c515){return db[_0xcbc5('0x14')][_0xcbc5('0x15')]({'raw':_0x1bc063[_0xcbc5('0x16')]?_0x1bc063['options'][_0xcbc5('0x17')]===undefined?!![]:![]:!![],'where':_0x1bc063[_0xcbc5('0x16')]?_0x1bc063[_0xcbc5('0x16')][_0xcbc5('0x18')]||null:null,'attributes':_0x1bc063['options']?_0x1bc063['options'][_0xcbc5('0x19')]||null:null,'limit':_0x1bc063[_0xcbc5('0x16')]?_0x1bc063['options'][_0xcbc5('0x1a')]||null:null,'include':_0x1bc063[_0xcbc5('0x16')]?_0x1bc063['options'][_0xcbc5('0x1b')]?_[_0xcbc5('0x1c')](_0x1bc063[_0xcbc5('0x16')]['include'],function(_0x531330){return{'model':db[_0x531330['model']],'as':_0x531330['as'],'attributes':_0x531330['attributes'],'include':_0x531330[_0xcbc5('0x1b')]?_[_0xcbc5('0x1c')](_0x531330[_0xcbc5('0x1b')],function(_0x50bcba){return{'model':db[_0x50bcba['model']],'as':_0x50bcba['as'],'attributes':_0x50bcba[_0xcbc5('0x19')],'include':_0x50bcba[_0xcbc5('0x1b')]?_[_0xcbc5('0x1c')](_0x50bcba[_0xcbc5('0x1b')],function(_0x1ede9b){return{'model':db[_0x1ede9b[_0xcbc5('0x1d')]],'as':_0x1ede9b['as'],'attributes':_0x1ede9b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbc5('0x1e')](function(_0x1e7819){logger[_0xcbc5('0xc')](_0xcbc5('0x13'),_0x1bc063);logger[_0xcbc5('0x1f')](_0xcbc5('0x13'),_0x1bc063,JSON['stringify'](_0x1e7819));_0x7f8a36(_0x1e7819);})['catch'](function(_0x1b4f27){logger[_0xcbc5('0x10')]('GetSalesforceAccount',_0x1b4f27[_0xcbc5('0x12')],_0x1bc063);_0x31c515(_0x9069e5[_0xcbc5('0x10')](0x1f4,_0x1b4f27[_0xcbc5('0x12')]));});});};exports[_0xcbc5('0x20')]=function(_0x5a1e16){var _0x31471f=this;return new Promise(function(_0x50cc56,_0x13a1cc){return db['SalesforceAccount'][_0xcbc5('0x21')]({'raw':_0x5a1e16[_0xcbc5('0x16')]?_0x5a1e16[_0xcbc5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5a1e16[_0xcbc5('0x16')]?_0x5a1e16['options']['where']||null:null,'attributes':_0x5a1e16[_0xcbc5('0x16')]?_0x5a1e16[_0xcbc5('0x16')][_0xcbc5('0x19')]||null:null,'include':_0x5a1e16[_0xcbc5('0x16')]?_0x5a1e16[_0xcbc5('0x16')][_0xcbc5('0x1b')]?_[_0xcbc5('0x1c')](_0x5a1e16[_0xcbc5('0x16')][_0xcbc5('0x1b')],function(_0x5ad3d5){return{'model':db[_0x5ad3d5[_0xcbc5('0x1d')]],'as':_0x5ad3d5['as'],'attributes':_0x5ad3d5['attributes'],'include':_0x5ad3d5[_0xcbc5('0x1b')]?_['map'](_0x5ad3d5[_0xcbc5('0x1b')],function(_0x3b14a4){return{'model':db[_0x3b14a4[_0xcbc5('0x1d')]],'as':_0x3b14a4['as'],'attributes':_0x3b14a4['attributes'],'include':_0x3b14a4[_0xcbc5('0x1b')]?_[_0xcbc5('0x1c')](_0x3b14a4['include'],function(_0x55f1c6){return{'model':db[_0x55f1c6[_0xcbc5('0x1d')]],'as':_0x55f1c6['as'],'attributes':_0x55f1c6[_0xcbc5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcbc5('0x1e')](function(_0xa87a8d){logger['info'](_0xcbc5('0x20'),_0x5a1e16);logger['debug'](_0xcbc5('0x20'),_0x5a1e16,JSON[_0xcbc5('0xf')](_0xa87a8d));_0x50cc56(_0xa87a8d);})[_0xcbc5('0x22')](function(_0x4c4e97){logger[_0xcbc5('0x10')](_0xcbc5('0x20'),_0x4c4e97['message'],_0x5a1e16);_0x13a1cc(_0x31471f[_0xcbc5('0x10')](0x1f4,_0x4c4e97[_0xcbc5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 77d19d2..0a198a0 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdb28,0x106));var _0x8db2=function(_0x567474,_0x37aff7){_0x567474=_0x567474-0x0;var _0x1f4280=_0xdb28[_0x567474];return _0x1f4280;};'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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x0b0e[_0x207811];return _0x170d56;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 6df2b63..85d8562 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 _0x9616=['lead','contact_lead','account','sequelize','exports','STRING','ENUM','Task','Case','contact'];(function(_0x45ce4e,_0x3a367c){var _0x4a105a=function(_0x52f8bb){while(--_0x52f8bb){_0x45ce4e['push'](_0x45ce4e['shift']());}};_0x4a105a(++_0x3a367c);}(_0x9616,0x1b1));var _0x6961=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x9616[_0x295314];return _0x584b0c;};'use strict';var Sequelize=require(_0x6961('0x0'));module[_0x6961('0x1')]={'name':{'type':Sequelize[_0x6961('0x2')]},'description':{'type':Sequelize[_0x6961('0x2')]},'ticketType':{'type':Sequelize[_0x6961('0x3')](_0x6961('0x4'),_0x6961('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x6961('0x3')]('contact_lead',_0x6961('0x6'),_0x6961('0x7'),'account_contact_lead','account'),'defaultValue':_0x6961('0x8')},'moduleCreate':{'type':Sequelize[_0x6961('0x3')]('nothing','contact',_0x6961('0x7'),_0x6961('0x9')),'defaultValue':_0x6961('0x7')},'leadId':{'type':Sequelize[_0x6961('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x6961('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6961('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6961('0x2')]}}; \ No newline at end of file +var _0x7817=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize'];(function(_0xdde379,_0x112d6c){var _0x524284=function(_0x36421b){while(--_0x36421b){_0xdde379['push'](_0xdde379['shift']());}};_0x524284(++_0x112d6c);}(_0x7817,0x185));var _0x7781=function(_0x56d26d,_0x14e1e1){_0x56d26d=_0x56d26d-0x0;var _0x6bca55=_0x7817[_0x56d26d];return _0x6bca55;};'use strict';var Sequelize=require(_0x7781('0x0'));module[_0x7781('0x1')]={'name':{'type':Sequelize[_0x7781('0x2')]},'description':{'type':Sequelize[_0x7781('0x2')]},'ticketType':{'type':Sequelize[_0x7781('0x3')](_0x7781('0x4'),_0x7781('0x5')),'defaultValue':_0x7781('0x4')},'moduleSearch':{'type':Sequelize[_0x7781('0x3')](_0x7781('0x6'),_0x7781('0x7'),_0x7781('0x8'),'account_contact_lead','account'),'defaultValue':_0x7781('0x6')},'moduleCreate':{'type':Sequelize[_0x7781('0x3')](_0x7781('0x9'),_0x7781('0x7'),'lead','account'),'defaultValue':_0x7781('0x8')},'leadId':{'type':Sequelize[_0x7781('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x7781('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fb882f7..b5ec930 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 _0xd154=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','error','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','then','catch','params','fields','includeAll','include','find','create','body','destroy','getFields','SalesforceField','pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xd154,0x168));var _0x4d15=function(_0x36b4c2,_0x1e86ea){_0x36b4c2=_0x36b4c2-0x0;var _0x10457d=_0xd154[_0x36b4c2];return _0x10457d;};'use strict';var emlformat=require(_0x4d15('0x0'));var rimraf=require(_0x4d15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d15('0x2'));var rp=require(_0x4d15('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4d15('0x4'));var sox=require(_0x4d15('0x5'));var csv=require(_0x4d15('0x6'));var ejs=require(_0x4d15('0x7'));var fs=require('fs');var fs_extra=require(_0x4d15('0x8'));var _=require(_0x4d15('0x9'));var squel=require(_0x4d15('0xa'));var crypto=require(_0x4d15('0xb'));var jsforce=require(_0x4d15('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4d15('0x6'));var querystring=require(_0x4d15('0xd'));var Papa=require(_0x4d15('0xe'));var Redis=require(_0x4d15('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4d15('0x10'));var as=require(_0x4d15('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d15('0x12'))('api');var utils=require(_0x4d15('0x13'));var config=require(_0x4d15('0x14'));var licenseUtil=require(_0x4d15('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8145,_0x223f49){_0x223f49=_0x223f49||0xcc;return function(_0x2abf22){if(_0x2abf22){return _0x4a8145[_0x4d15('0x16')](_0x223f49);}return _0x4a8145[_0x4d15('0x17')](_0x223f49)[_0x4d15('0x18')]();};}function respondWithResult(_0x338583,_0x1c4ea5){_0x1c4ea5=_0x1c4ea5||0xc8;return function(_0x17709a){if(_0x17709a){return _0x338583[_0x4d15('0x17')](_0x1c4ea5)[_0x4d15('0x19')](_0x17709a);}};}function respondWithFilteredResult(_0x3cfd08,_0x4c0f2a){return function(_0x40c331){if(_0x40c331){var _0x11d5e5=typeof _0x4c0f2a['offset']===_0x4d15('0x1a')&&typeof _0x4c0f2a[_0x4d15('0x1b')]===_0x4d15('0x1a');var _0x5b20fc=_0x40c331['count'];var _0xc4c6b9=_0x11d5e5?0x0:_0x4c0f2a[_0x4d15('0x1c')];var _0x190e60=_0x11d5e5?_0x40c331[_0x4d15('0x1d')]:_0x4c0f2a['offset']+_0x4c0f2a['limit'];var _0x297073;if(_0x190e60>=_0x5b20fc){_0x190e60=_0x5b20fc;_0x297073=0xc8;}else{_0x297073=0xce;}_0x3cfd08[_0x4d15('0x17')](_0x297073);return _0x3cfd08[_0x4d15('0x1e')](_0x4d15('0x1f'),_0xc4c6b9+'-'+_0x190e60+'/'+_0x5b20fc)[_0x4d15('0x19')](_0x40c331);}return null;};}function patchUpdates(_0x12a695){return function(_0x27e8cf){try{jsonpatch['apply'](_0x27e8cf,_0x12a695,!![]);}catch(_0x58735f){return BPromise[_0x4d15('0x20')](_0x58735f);}return _0x27e8cf[_0x4d15('0x21')]();};}function saveUpdates(_0x9c61d4,_0x4d5001){return function(_0xc068f2){if(_0xc068f2){return _0xc068f2[_0x4d15('0x22')](_0x9c61d4)['then'](function(_0xd3d2b3){return _0xd3d2b3;});}return null;};}function removeEntity(_0x7e17f0,_0xa49f0a){return function(_0x57d93a){if(_0x57d93a){return _0x57d93a['destroy']()['then'](function(){_0x7e17f0[_0x4d15('0x17')](0xcc)[_0x4d15('0x18')]();});}};}function handleEntityNotFound(_0x50c93a,_0x39d8bf){return function(_0x2ce8e6){if(!_0x2ce8e6){_0x50c93a[_0x4d15('0x16')](0x194);}return _0x2ce8e6;};}function handleError(_0x57db8e,_0x45cb12){_0x45cb12=_0x45cb12||0x1f4;return function(_0x4cd56c){logger[_0x4d15('0x23')](_0x4cd56c['stack']);if(_0x4cd56c['name']){delete _0x4cd56c[_0x4d15('0x24')];}_0x57db8e[_0x4d15('0x17')](_0x45cb12)[_0x4d15('0x25')](_0x4cd56c);};}exports[_0x4d15('0x26')]=function(_0x399220,_0x58e382){var _0x141c79={},_0x454bfb={},_0x29a554={'count':0x0,'rows':[]};var _0x51a7af=_[_0x4d15('0x27')](db[_0x4d15('0x28')][_0x4d15('0x29')],function(_0x670dbd){return{'name':_0x670dbd['fieldName'],'type':_0x670dbd[_0x4d15('0x2a')][_0x4d15('0x2b')]};});_0x454bfb[_0x4d15('0x2c')]=_['map'](_0x51a7af,_0x4d15('0x24'));_0x454bfb['query']=_[_0x4d15('0x2d')](_0x399220['query']);_0x454bfb[_0x4d15('0x2e')]=_[_0x4d15('0x2f')](_0x454bfb[_0x4d15('0x2c')],_0x454bfb[_0x4d15('0x30')]);_0x141c79[_0x4d15('0x31')]=_['intersection'](_0x454bfb[_0x4d15('0x2c')],qs['fields'](_0x399220[_0x4d15('0x30')]['fields']));_0x141c79['attributes']=_0x141c79[_0x4d15('0x31')][_0x4d15('0x32')]?_0x141c79[_0x4d15('0x31')]:_0x454bfb[_0x4d15('0x2c')];if(!_0x399220['query'][_0x4d15('0x33')]('nolimit')){_0x141c79[_0x4d15('0x1b')]=qs[_0x4d15('0x1b')](_0x399220['query'][_0x4d15('0x1b')]);_0x141c79['offset']=qs['offset'](_0x399220[_0x4d15('0x30')][_0x4d15('0x1c')]);}_0x141c79[_0x4d15('0x34')]=qs[_0x4d15('0x35')](_0x399220[_0x4d15('0x30')]['sort']);_0x141c79[_0x4d15('0x36')]=qs['filters'](_['pick'](_0x399220['query'],_0x454bfb[_0x4d15('0x2e')]),_0x51a7af);if(_0x399220[_0x4d15('0x30')][_0x4d15('0x37')]){_0x141c79['where']=_['merge'](_0x141c79[_0x4d15('0x36')],{'$or':_[_0x4d15('0x27')](_0x51a7af,function(_0x2663c1){if(_0x2663c1[_0x4d15('0x2a')]!=='VIRTUAL'){var _0x5a4ada={};_0x5a4ada[_0x2663c1['name']]={'$like':'%'+_0x399220[_0x4d15('0x30')]['filter']+'%'};return _0x5a4ada;}})});}_0x141c79=_[_0x4d15('0x38')]({},_0x141c79,_0x399220[_0x4d15('0x39')]);var _0x4eafb1={'where':_0x141c79[_0x4d15('0x36')]};return db[_0x4d15('0x28')]['count'](_0x4eafb1)['then'](function(_0x22e282){_0x29a554[_0x4d15('0x1d')]=_0x22e282;if(_0x399220[_0x4d15('0x30')]['includeAll']){_0x141c79['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x141c79);})[_0x4d15('0x3a')](function(_0x4b1dba){_0x29a554['rows']=_0x4b1dba;return _0x29a554;})[_0x4d15('0x3a')](respondWithFilteredResult(_0x58e382,_0x141c79))[_0x4d15('0x3b')](handleError(_0x58e382,null));};exports['show']=function(_0x980f2a,_0x5a7ec0){var _0x45e78d={'raw':![],'where':{'id':_0x980f2a[_0x4d15('0x3c')]['id']}},_0x359c57={};_0x359c57[_0x4d15('0x2c')]=_['keys'](db[_0x4d15('0x28')][_0x4d15('0x29')]);_0x359c57[_0x4d15('0x30')]=_[_0x4d15('0x2d')](_0x980f2a[_0x4d15('0x30')]);_0x359c57['filters']=_[_0x4d15('0x2f')](_0x359c57['model'],_0x359c57[_0x4d15('0x30')]);_0x45e78d[_0x4d15('0x31')]=_[_0x4d15('0x2f')](_0x359c57[_0x4d15('0x2c')],qs[_0x4d15('0x3d')](_0x980f2a['query']['fields']));_0x45e78d[_0x4d15('0x31')]=_0x45e78d[_0x4d15('0x31')][_0x4d15('0x32')]?_0x45e78d[_0x4d15('0x31')]:_0x359c57[_0x4d15('0x2c')];if(_0x980f2a[_0x4d15('0x30')][_0x4d15('0x3e')]){_0x45e78d[_0x4d15('0x3f')]=[{'all':!![]}];}_0x45e78d=_[_0x4d15('0x38')]({},_0x45e78d,_0x980f2a[_0x4d15('0x39')]);return db[_0x4d15('0x28')][_0x4d15('0x40')](_0x45e78d)['then'](handleEntityNotFound(_0x5a7ec0,null))[_0x4d15('0x3a')](respondWithResult(_0x5a7ec0,null))[_0x4d15('0x3b')](handleError(_0x5a7ec0,null));};exports[_0x4d15('0x41')]=function(_0x42e073,_0x224b74){return db[_0x4d15('0x28')][_0x4d15('0x41')](_0x42e073[_0x4d15('0x42')],{})[_0x4d15('0x3a')](respondWithResult(_0x224b74,0xc9))['catch'](handleError(_0x224b74,null));};exports[_0x4d15('0x22')]=function(_0x199454,_0xc1deb0){if(_0x199454[_0x4d15('0x42')]['id']){delete _0x199454['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x199454[_0x4d15('0x3c')]['id']}})[_0x4d15('0x3a')](handleEntityNotFound(_0xc1deb0,null))[_0x4d15('0x3a')](saveUpdates(_0x199454[_0x4d15('0x42')],null))[_0x4d15('0x3a')](respondWithResult(_0xc1deb0,null))[_0x4d15('0x3b')](handleError(_0xc1deb0,null));};exports[_0x4d15('0x43')]=function(_0x58d54d,_0x5ebb32){return db[_0x4d15('0x28')]['find']({'where':{'id':_0x58d54d[_0x4d15('0x3c')]['id']}})[_0x4d15('0x3a')](handleEntityNotFound(_0x5ebb32,null))[_0x4d15('0x3a')](removeEntity(_0x5ebb32,null))['catch'](handleError(_0x5ebb32,null));};exports[_0x4d15('0x44')]=function(_0x2c5071,_0x3aba46,_0x4fae6e){var _0x560ccb={};var _0x2639f6={};var _0x3d4331;var _0x519389;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2c5071['params']['id']}})['then'](handleEntityNotFound(_0x3aba46,null))[_0x4d15('0x3a')](function(_0x42df9c){if(_0x42df9c){_0x3d4331=_0x42df9c;_0x2639f6[_0x4d15('0x2c')]=_['keys'](db[_0x4d15('0x45')][_0x4d15('0x29')]);_0x2639f6['query']=_[_0x4d15('0x2d')](_0x2c5071['query']);_0x2639f6[_0x4d15('0x2e')]=_[_0x4d15('0x2f')](_0x2639f6[_0x4d15('0x2c')],_0x2639f6[_0x4d15('0x30')]);_0x560ccb[_0x4d15('0x31')]=_[_0x4d15('0x2f')](_0x2639f6['model'],qs[_0x4d15('0x3d')](_0x2c5071[_0x4d15('0x30')][_0x4d15('0x3d')]));_0x560ccb[_0x4d15('0x31')]=_0x560ccb['attributes'][_0x4d15('0x32')]?_0x560ccb[_0x4d15('0x31')]:_0x2639f6[_0x4d15('0x2c')];_0x560ccb[_0x4d15('0x34')]=qs['sort'](_0x2c5071[_0x4d15('0x30')][_0x4d15('0x35')]);_0x560ccb[_0x4d15('0x36')]=qs[_0x4d15('0x2e')](_[_0x4d15('0x46')](_0x2c5071['query'],_0x2639f6[_0x4d15('0x2e')]));if(_0x2c5071['query'][_0x4d15('0x37')]){_0x560ccb[_0x4d15('0x36')]=_[_0x4d15('0x38')](_0x560ccb[_0x4d15('0x36')],{'$or':_[_0x4d15('0x27')](_0x560ccb[_0x4d15('0x31')],function(_0x5564c3){var _0x485a57={};_0x485a57[_0x5564c3]={'$like':'%'+_0x2c5071[_0x4d15('0x30')][_0x4d15('0x37')]+'%'};return _0x485a57;})});}_0x560ccb=_['merge']({},_0x560ccb,_0x2c5071[_0x4d15('0x39')]);return _0x3d4331['getFields'](_0x560ccb);}})[_0x4d15('0x3a')](function(_0x53ee33){if(_0x53ee33){_0x519389=_0x53ee33['length'];if(!_0x2c5071[_0x4d15('0x30')][_0x4d15('0x33')](_0x4d15('0x47'))){_0x560ccb[_0x4d15('0x1b')]=qs[_0x4d15('0x1b')](_0x2c5071[_0x4d15('0x30')][_0x4d15('0x1b')]);_0x560ccb[_0x4d15('0x1c')]=qs['offset'](_0x2c5071[_0x4d15('0x30')][_0x4d15('0x1c')]);}return _0x3d4331[_0x4d15('0x44')](_0x560ccb);}})[_0x4d15('0x3a')](function(_0x4214ca){if(_0x4214ca){return _0x4214ca?{'count':_0x519389,'rows':_0x4214ca}:null;}})[_0x4d15('0x3a')](respondWithResult(_0x3aba46,null))[_0x4d15('0x3b')](handleError(_0x3aba46,null));};exports[_0x4d15('0x48')]=function(_0xfcb534,_0x2a1e3d,_0x4c34d2){var _0x5922b0={};var _0x1a204b={};var _0x3af67d;var _0x1f4729;return db[_0x4d15('0x28')][_0x4d15('0x49')]({'where':{'id':_0xfcb534[_0x4d15('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a1e3d,null))[_0x4d15('0x3a')](function(_0x2ec5a5){if(_0x2ec5a5){_0x3af67d=_0x2ec5a5;_0x1a204b[_0x4d15('0x2c')]=_[_0x4d15('0x2d')](db['SalesforceField']['rawAttributes']);_0x1a204b[_0x4d15('0x30')]=_[_0x4d15('0x2d')](_0xfcb534[_0x4d15('0x30')]);_0x1a204b[_0x4d15('0x2e')]=_[_0x4d15('0x2f')](_0x1a204b['model'],_0x1a204b[_0x4d15('0x30')]);_0x5922b0[_0x4d15('0x31')]=_['intersection'](_0x1a204b[_0x4d15('0x2c')],qs[_0x4d15('0x3d')](_0xfcb534[_0x4d15('0x30')][_0x4d15('0x3d')]));_0x5922b0['attributes']=_0x5922b0[_0x4d15('0x31')][_0x4d15('0x32')]?_0x5922b0['attributes']:_0x1a204b[_0x4d15('0x2c')];_0x5922b0[_0x4d15('0x34')]=qs[_0x4d15('0x35')](_0xfcb534[_0x4d15('0x30')][_0x4d15('0x35')]);_0x5922b0[_0x4d15('0x36')]=qs['filters'](_[_0x4d15('0x46')](_0xfcb534[_0x4d15('0x30')],_0x1a204b[_0x4d15('0x2e')]));if(_0xfcb534[_0x4d15('0x30')][_0x4d15('0x37')]){_0x5922b0[_0x4d15('0x36')]=_[_0x4d15('0x38')](_0x5922b0['where'],{'$or':_[_0x4d15('0x27')](_0x5922b0['attributes'],function(_0x18c0c1){var _0x3362e8={};_0x3362e8[_0x18c0c1]={'$like':'%'+_0xfcb534[_0x4d15('0x30')][_0x4d15('0x37')]+'%'};return _0x3362e8;})});}_0x5922b0=_['merge']({},_0x5922b0,_0xfcb534[_0x4d15('0x39')]);return _0x3af67d['getSubjects'](_0x5922b0);}})[_0x4d15('0x3a')](function(_0x107412){if(_0x107412){_0x1f4729=_0x107412[_0x4d15('0x32')];if(!_0xfcb534[_0x4d15('0x30')][_0x4d15('0x33')](_0x4d15('0x47'))){_0x5922b0[_0x4d15('0x1b')]=qs[_0x4d15('0x1b')](_0xfcb534['query'][_0x4d15('0x1b')]);_0x5922b0[_0x4d15('0x1c')]=qs[_0x4d15('0x1c')](_0xfcb534[_0x4d15('0x30')][_0x4d15('0x1c')]);}return _0x3af67d['getSubjects'](_0x5922b0);}})[_0x4d15('0x3a')](function(_0x1aacc8){if(_0x1aacc8){return _0x1aacc8?{'count':_0x1f4729,'rows':_0x1aacc8}:null;}})['then'](respondWithResult(_0x2a1e3d,null))['catch'](handleError(_0x2a1e3d,null));};exports[_0x4d15('0x4a')]=function(_0x57acfb,_0x277a80,_0x59fc5c){var _0x3e6f12={};var _0x4812bd={};var _0x40439b;var _0x412817;return db[_0x4d15('0x28')][_0x4d15('0x49')]({'where':{'id':_0x57acfb[_0x4d15('0x3c')]['id']}})[_0x4d15('0x3a')](handleEntityNotFound(_0x277a80,null))[_0x4d15('0x3a')](function(_0x4551f5){if(_0x4551f5){_0x40439b=_0x4551f5;_0x4812bd[_0x4d15('0x2c')]=_[_0x4d15('0x2d')](db['SalesforceField'][_0x4d15('0x29')]);_0x4812bd[_0x4d15('0x30')]=_['keys'](_0x57acfb['query']);_0x4812bd[_0x4d15('0x2e')]=_[_0x4d15('0x2f')](_0x4812bd[_0x4d15('0x2c')],_0x4812bd[_0x4d15('0x30')]);_0x3e6f12[_0x4d15('0x31')]=_[_0x4d15('0x2f')](_0x4812bd['model'],qs[_0x4d15('0x3d')](_0x57acfb[_0x4d15('0x30')]['fields']));_0x3e6f12[_0x4d15('0x31')]=_0x3e6f12[_0x4d15('0x31')][_0x4d15('0x32')]?_0x3e6f12[_0x4d15('0x31')]:_0x4812bd[_0x4d15('0x2c')];_0x3e6f12['order']=qs[_0x4d15('0x35')](_0x57acfb[_0x4d15('0x30')][_0x4d15('0x35')]);_0x3e6f12['where']=qs[_0x4d15('0x2e')](_['pick'](_0x57acfb['query'],_0x4812bd[_0x4d15('0x2e')]));if(_0x57acfb[_0x4d15('0x30')][_0x4d15('0x37')]){_0x3e6f12['where']=_[_0x4d15('0x38')](_0x3e6f12[_0x4d15('0x36')],{'$or':_[_0x4d15('0x27')](_0x3e6f12[_0x4d15('0x31')],function(_0x15987b){var _0x288d75={};_0x288d75[_0x15987b]={'$like':'%'+_0x57acfb['query']['filter']+'%'};return _0x288d75;})});}_0x3e6f12=_[_0x4d15('0x38')]({},_0x3e6f12,_0x57acfb[_0x4d15('0x39')]);return _0x40439b['getDescriptions'](_0x3e6f12);}})[_0x4d15('0x3a')](function(_0x273399){if(_0x273399){_0x412817=_0x273399[_0x4d15('0x32')];if(!_0x57acfb[_0x4d15('0x30')][_0x4d15('0x33')]('nolimit')){_0x3e6f12[_0x4d15('0x1b')]=qs[_0x4d15('0x1b')](_0x57acfb[_0x4d15('0x30')][_0x4d15('0x1b')]);_0x3e6f12[_0x4d15('0x1c')]=qs[_0x4d15('0x1c')](_0x57acfb[_0x4d15('0x30')][_0x4d15('0x1c')]);}return _0x40439b[_0x4d15('0x4a')](_0x3e6f12);}})[_0x4d15('0x3a')](function(_0x2f2f98){if(_0x2f2f98){return _0x2f2f98?{'count':_0x412817,'rows':_0x2f2f98}:null;}})[_0x4d15('0x3a')](respondWithResult(_0x277a80,null))['catch'](handleError(_0x277a80,null));}; \ No newline at end of file +var _0x8178=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','create','body','find','params','SalesforceField','rawAttributes','order','getFields','hasOwnProperty','getSubjects','getDescriptions','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/qs','../../components/parsers/advancedSearch'];(function(_0x212bbf,_0x3aea75){var _0x2b17b6=function(_0x4f6808){while(--_0x4f6808){_0x212bbf['push'](_0x212bbf['shift']());}};_0x2b17b6(++_0x3aea75);}(_0x8178,0x8f));var _0x8817=function(_0x2c69f2,_0x5b0e39){_0x2c69f2=_0x2c69f2-0x0;var _0x2276a9=_0x8178[_0x2c69f2];return _0x2276a9;};'use strict';var emlformat=require(_0x8817('0x0'));var rimraf=require(_0x8817('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8817('0x2'));var rp=require(_0x8817('0x3'));var moment=require('moment');var BPromise=require(_0x8817('0x4'));var Mustache=require(_0x8817('0x5'));var util=require(_0x8817('0x6'));var path=require(_0x8817('0x7'));var sox=require('sox');var csv=require(_0x8817('0x8'));var ejs=require(_0x8817('0x9'));var fs=require('fs');var fs_extra=require(_0x8817('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8817('0xb'));var deskjs=require(_0x8817('0xc'));var toCsv=require(_0x8817('0x8'));var querystring=require(_0x8817('0xd'));var Papa=require(_0x8817('0xe'));var Redis=require(_0x8817('0xf'));var authService=require(_0x8817('0x10'));var qs=require(_0x8817('0x11'));var as=require(_0x8817('0x12'));var hardwareService=require(_0x8817('0x13'));var logger=require(_0x8817('0x14'))(_0x8817('0x15'));var utils=require(_0x8817('0x16'));var config=require(_0x8817('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8817('0x18'))['db'];function respondWithStatusCode(_0x1f3cd5,_0x1c45da){_0x1c45da=_0x1c45da||0xcc;return function(_0x3b606c){if(_0x3b606c){return _0x1f3cd5['sendStatus'](_0x1c45da);}return _0x1f3cd5[_0x8817('0x19')](_0x1c45da)['end']();};}function respondWithResult(_0x42e336,_0x5735ce){_0x5735ce=_0x5735ce||0xc8;return function(_0x2d8677){if(_0x2d8677){return _0x42e336[_0x8817('0x19')](_0x5735ce)[_0x8817('0x1a')](_0x2d8677);}};}function respondWithFilteredResult(_0x468388,_0x2c4823){return function(_0x35c775){if(_0x35c775){var _0x421f79=typeof _0x2c4823[_0x8817('0x1b')]==='undefined'&&typeof _0x2c4823[_0x8817('0x1c')]===_0x8817('0x1d');var _0x415e99=_0x35c775[_0x8817('0x1e')];var _0x1abb93=_0x421f79?0x0:_0x2c4823[_0x8817('0x1b')];var _0xf73f00=_0x421f79?_0x35c775[_0x8817('0x1e')]:_0x2c4823[_0x8817('0x1b')]+_0x2c4823[_0x8817('0x1c')];var _0x354adb;if(_0xf73f00>=_0x415e99){_0xf73f00=_0x415e99;_0x354adb=0xc8;}else{_0x354adb=0xce;}_0x468388[_0x8817('0x19')](_0x354adb);return _0x468388[_0x8817('0x1f')](_0x8817('0x20'),_0x1abb93+'-'+_0xf73f00+'/'+_0x415e99)['json'](_0x35c775);}return null;};}function patchUpdates(_0x99a8f2){return function(_0x33de6d){try{jsonpatch[_0x8817('0x21')](_0x33de6d,_0x99a8f2,!![]);}catch(_0x4a8e2c){return BPromise[_0x8817('0x22')](_0x4a8e2c);}return _0x33de6d[_0x8817('0x23')]();};}function saveUpdates(_0x2946e0,_0x30f476){return function(_0x3689e6){if(_0x3689e6){return _0x3689e6[_0x8817('0x24')](_0x2946e0)['then'](function(_0x7e04e0){return _0x7e04e0;});}return null;};}function removeEntity(_0x255656,_0x4c0e28){return function(_0x3801cd){if(_0x3801cd){return _0x3801cd[_0x8817('0x25')]()[_0x8817('0x26')](function(){_0x255656[_0x8817('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128202,_0x3252b8){return function(_0x2e8314){if(!_0x2e8314){_0x128202['sendStatus'](0x194);}return _0x2e8314;};}function handleError(_0x3fdf38,_0x4fa00c){_0x4fa00c=_0x4fa00c||0x1f4;return function(_0x23659d){logger[_0x8817('0x27')](_0x23659d[_0x8817('0x28')]);if(_0x23659d[_0x8817('0x29')]){delete _0x23659d[_0x8817('0x29')];}_0x3fdf38[_0x8817('0x19')](_0x4fa00c)['send'](_0x23659d);};}exports[_0x8817('0x2a')]=function(_0x3bb0b5,_0x27fa91){var _0xcc4da8={},_0x323b63={},_0x5393f8={'count':0x0,'rows':[]};var _0xa9f1cf=_[_0x8817('0x2b')](db['SalesforceConfiguration']['rawAttributes'],function(_0x104c39){return{'name':_0x104c39[_0x8817('0x2c')],'type':_0x104c39[_0x8817('0x2d')][_0x8817('0x2e')]};});_0x323b63[_0x8817('0x2f')]=_[_0x8817('0x2b')](_0xa9f1cf,_0x8817('0x29'));_0x323b63['query']=_[_0x8817('0x30')](_0x3bb0b5[_0x8817('0x31')]);_0x323b63[_0x8817('0x32')]=_['intersection'](_0x323b63['model'],_0x323b63[_0x8817('0x31')]);_0xcc4da8['attributes']=_[_0x8817('0x33')](_0x323b63[_0x8817('0x2f')],qs['fields'](_0x3bb0b5[_0x8817('0x31')][_0x8817('0x34')]));_0xcc4da8[_0x8817('0x35')]=_0xcc4da8[_0x8817('0x35')][_0x8817('0x36')]?_0xcc4da8['attributes']:_0x323b63[_0x8817('0x2f')];if(!_0x3bb0b5[_0x8817('0x31')]['hasOwnProperty'](_0x8817('0x37'))){_0xcc4da8[_0x8817('0x1c')]=qs['limit'](_0x3bb0b5['query'][_0x8817('0x1c')]);_0xcc4da8[_0x8817('0x1b')]=qs[_0x8817('0x1b')](_0x3bb0b5['query'][_0x8817('0x1b')]);}_0xcc4da8['order']=qs['sort'](_0x3bb0b5[_0x8817('0x31')][_0x8817('0x38')]);_0xcc4da8[_0x8817('0x39')]=qs[_0x8817('0x32')](_[_0x8817('0x3a')](_0x3bb0b5['query'],_0x323b63[_0x8817('0x32')]),_0xa9f1cf);if(_0x3bb0b5['query'][_0x8817('0x3b')]){_0xcc4da8[_0x8817('0x39')]=_['merge'](_0xcc4da8[_0x8817('0x39')],{'$or':_['map'](_0xa9f1cf,function(_0x44d528){if(_0x44d528['type']!==_0x8817('0x3c')){var _0x11f52d={};_0x11f52d[_0x44d528['name']]={'$like':'%'+_0x3bb0b5['query'][_0x8817('0x3b')]+'%'};return _0x11f52d;}})});}_0xcc4da8=_[_0x8817('0x3d')]({},_0xcc4da8,_0x3bb0b5[_0x8817('0x3e')]);var _0x52e64b={'where':_0xcc4da8[_0x8817('0x39')]};return db[_0x8817('0x3f')][_0x8817('0x1e')](_0x52e64b)[_0x8817('0x26')](function(_0xa0e516){_0x5393f8[_0x8817('0x1e')]=_0xa0e516;if(_0x3bb0b5[_0x8817('0x31')][_0x8817('0x40')]){_0xcc4da8[_0x8817('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x8817('0x42')](_0xcc4da8);})[_0x8817('0x26')](function(_0x4fb3c3){_0x5393f8[_0x8817('0x43')]=_0x4fb3c3;return _0x5393f8;})[_0x8817('0x26')](respondWithFilteredResult(_0x27fa91,_0xcc4da8))[_0x8817('0x44')](handleError(_0x27fa91,null));};exports[_0x8817('0x45')]=function(_0x5a1e24,_0x15b4c6){var _0x20ae95={'raw':![],'where':{'id':_0x5a1e24['params']['id']}},_0x149de9={};_0x149de9[_0x8817('0x2f')]=_[_0x8817('0x30')](db[_0x8817('0x3f')]['rawAttributes']);_0x149de9[_0x8817('0x31')]=_[_0x8817('0x30')](_0x5a1e24[_0x8817('0x31')]);_0x149de9[_0x8817('0x32')]=_[_0x8817('0x33')](_0x149de9[_0x8817('0x2f')],_0x149de9['query']);_0x20ae95['attributes']=_[_0x8817('0x33')](_0x149de9[_0x8817('0x2f')],qs[_0x8817('0x34')](_0x5a1e24[_0x8817('0x31')][_0x8817('0x34')]));_0x20ae95[_0x8817('0x35')]=_0x20ae95['attributes'][_0x8817('0x36')]?_0x20ae95[_0x8817('0x35')]:_0x149de9[_0x8817('0x2f')];if(_0x5a1e24[_0x8817('0x31')][_0x8817('0x40')]){_0x20ae95[_0x8817('0x41')]=[{'all':!![]}];}_0x20ae95=_[_0x8817('0x3d')]({},_0x20ae95,_0x5a1e24[_0x8817('0x3e')]);return db['SalesforceConfiguration']['find'](_0x20ae95)['then'](handleEntityNotFound(_0x15b4c6,null))['then'](respondWithResult(_0x15b4c6,null))['catch'](handleError(_0x15b4c6,null));};exports[_0x8817('0x46')]=function(_0x2fb736,_0x25a4f2){return db[_0x8817('0x3f')][_0x8817('0x46')](_0x2fb736[_0x8817('0x47')],{})['then'](respondWithResult(_0x25a4f2,0xc9))[_0x8817('0x44')](handleError(_0x25a4f2,null));};exports[_0x8817('0x24')]=function(_0xb040b7,_0x105901){if(_0xb040b7[_0x8817('0x47')]['id']){delete _0xb040b7[_0x8817('0x47')]['id'];}return db[_0x8817('0x3f')][_0x8817('0x48')]({'where':{'id':_0xb040b7['params']['id']}})[_0x8817('0x26')](handleEntityNotFound(_0x105901,null))[_0x8817('0x26')](saveUpdates(_0xb040b7['body'],null))[_0x8817('0x26')](respondWithResult(_0x105901,null))[_0x8817('0x44')](handleError(_0x105901,null));};exports[_0x8817('0x25')]=function(_0x3daff1,_0x2c6538){return db[_0x8817('0x3f')][_0x8817('0x48')]({'where':{'id':_0x3daff1['params']['id']}})[_0x8817('0x26')](handleEntityNotFound(_0x2c6538,null))[_0x8817('0x26')](removeEntity(_0x2c6538,null))[_0x8817('0x44')](handleError(_0x2c6538,null));};exports['getFields']=function(_0x2b8923,_0x3cdc34,_0x2bdb1c){var _0x40d79f={};var _0x1cd0f={};var _0x55f75d;var _0x453844;return db[_0x8817('0x3f')]['findOne']({'where':{'id':_0x2b8923[_0x8817('0x49')]['id']}})[_0x8817('0x26')](handleEntityNotFound(_0x3cdc34,null))['then'](function(_0xccf9d1){if(_0xccf9d1){_0x55f75d=_0xccf9d1;_0x1cd0f['model']=_[_0x8817('0x30')](db[_0x8817('0x4a')][_0x8817('0x4b')]);_0x1cd0f['query']=_[_0x8817('0x30')](_0x2b8923[_0x8817('0x31')]);_0x1cd0f[_0x8817('0x32')]=_[_0x8817('0x33')](_0x1cd0f['model'],_0x1cd0f[_0x8817('0x31')]);_0x40d79f['attributes']=_[_0x8817('0x33')](_0x1cd0f[_0x8817('0x2f')],qs[_0x8817('0x34')](_0x2b8923[_0x8817('0x31')]['fields']));_0x40d79f[_0x8817('0x35')]=_0x40d79f[_0x8817('0x35')][_0x8817('0x36')]?_0x40d79f['attributes']:_0x1cd0f['model'];_0x40d79f[_0x8817('0x4c')]=qs['sort'](_0x2b8923[_0x8817('0x31')][_0x8817('0x38')]);_0x40d79f['where']=qs[_0x8817('0x32')](_[_0x8817('0x3a')](_0x2b8923['query'],_0x1cd0f[_0x8817('0x32')]));if(_0x2b8923[_0x8817('0x31')][_0x8817('0x3b')]){_0x40d79f['where']=_['merge'](_0x40d79f['where'],{'$or':_[_0x8817('0x2b')](_0x40d79f[_0x8817('0x35')],function(_0xc11fcd){var _0x7c73d={};_0x7c73d[_0xc11fcd]={'$like':'%'+_0x2b8923[_0x8817('0x31')]['filter']+'%'};return _0x7c73d;})});}_0x40d79f=_[_0x8817('0x3d')]({},_0x40d79f,_0x2b8923[_0x8817('0x3e')]);return _0x55f75d[_0x8817('0x4d')](_0x40d79f);}})[_0x8817('0x26')](function(_0x53b1ec){if(_0x53b1ec){_0x453844=_0x53b1ec[_0x8817('0x36')];if(!_0x2b8923[_0x8817('0x31')][_0x8817('0x4e')](_0x8817('0x37'))){_0x40d79f['limit']=qs[_0x8817('0x1c')](_0x2b8923['query'][_0x8817('0x1c')]);_0x40d79f['offset']=qs[_0x8817('0x1b')](_0x2b8923[_0x8817('0x31')]['offset']);}return _0x55f75d[_0x8817('0x4d')](_0x40d79f);}})['then'](function(_0x3dbead){if(_0x3dbead){return _0x3dbead?{'count':_0x453844,'rows':_0x3dbead}:null;}})[_0x8817('0x26')](respondWithResult(_0x3cdc34,null))[_0x8817('0x44')](handleError(_0x3cdc34,null));};exports[_0x8817('0x4f')]=function(_0x1c444d,_0xd2d44,_0x48d696){var _0x222a41={};var _0x44d5aa={};var _0x1ba664;var _0x5c84b5;return db[_0x8817('0x3f')]['findOne']({'where':{'id':_0x1c444d[_0x8817('0x49')]['id']}})['then'](handleEntityNotFound(_0xd2d44,null))[_0x8817('0x26')](function(_0x2404a9){if(_0x2404a9){_0x1ba664=_0x2404a9;_0x44d5aa[_0x8817('0x2f')]=_[_0x8817('0x30')](db[_0x8817('0x4a')][_0x8817('0x4b')]);_0x44d5aa['query']=_[_0x8817('0x30')](_0x1c444d[_0x8817('0x31')]);_0x44d5aa[_0x8817('0x32')]=_[_0x8817('0x33')](_0x44d5aa['model'],_0x44d5aa[_0x8817('0x31')]);_0x222a41[_0x8817('0x35')]=_[_0x8817('0x33')](_0x44d5aa['model'],qs[_0x8817('0x34')](_0x1c444d[_0x8817('0x31')][_0x8817('0x34')]));_0x222a41[_0x8817('0x35')]=_0x222a41[_0x8817('0x35')][_0x8817('0x36')]?_0x222a41[_0x8817('0x35')]:_0x44d5aa[_0x8817('0x2f')];_0x222a41['order']=qs['sort'](_0x1c444d[_0x8817('0x31')]['sort']);_0x222a41[_0x8817('0x39')]=qs[_0x8817('0x32')](_[_0x8817('0x3a')](_0x1c444d[_0x8817('0x31')],_0x44d5aa[_0x8817('0x32')]));if(_0x1c444d[_0x8817('0x31')][_0x8817('0x3b')]){_0x222a41[_0x8817('0x39')]=_['merge'](_0x222a41[_0x8817('0x39')],{'$or':_[_0x8817('0x2b')](_0x222a41[_0x8817('0x35')],function(_0x323a96){var _0x30049d={};_0x30049d[_0x323a96]={'$like':'%'+_0x1c444d['query'][_0x8817('0x3b')]+'%'};return _0x30049d;})});}_0x222a41=_[_0x8817('0x3d')]({},_0x222a41,_0x1c444d[_0x8817('0x3e')]);return _0x1ba664[_0x8817('0x4f')](_0x222a41);}})[_0x8817('0x26')](function(_0x5e9122){if(_0x5e9122){_0x5c84b5=_0x5e9122[_0x8817('0x36')];if(!_0x1c444d[_0x8817('0x31')][_0x8817('0x4e')](_0x8817('0x37'))){_0x222a41[_0x8817('0x1c')]=qs[_0x8817('0x1c')](_0x1c444d[_0x8817('0x31')][_0x8817('0x1c')]);_0x222a41['offset']=qs[_0x8817('0x1b')](_0x1c444d['query'][_0x8817('0x1b')]);}return _0x1ba664['getSubjects'](_0x222a41);}})[_0x8817('0x26')](function(_0x11ea12){if(_0x11ea12){return _0x11ea12?{'count':_0x5c84b5,'rows':_0x11ea12}:null;}})['then'](respondWithResult(_0xd2d44,null))[_0x8817('0x44')](handleError(_0xd2d44,null));};exports[_0x8817('0x50')]=function(_0x4babbb,_0x20c382,_0x28c77d){var _0x4bc366={};var _0xfd04e1={};var _0x2d3f40;var _0x236270;return db[_0x8817('0x3f')]['findOne']({'where':{'id':_0x4babbb[_0x8817('0x49')]['id']}})[_0x8817('0x26')](handleEntityNotFound(_0x20c382,null))[_0x8817('0x26')](function(_0x377dc3){if(_0x377dc3){_0x2d3f40=_0x377dc3;_0xfd04e1[_0x8817('0x2f')]=_[_0x8817('0x30')](db[_0x8817('0x4a')][_0x8817('0x4b')]);_0xfd04e1[_0x8817('0x31')]=_[_0x8817('0x30')](_0x4babbb['query']);_0xfd04e1[_0x8817('0x32')]=_[_0x8817('0x33')](_0xfd04e1[_0x8817('0x2f')],_0xfd04e1['query']);_0x4bc366['attributes']=_['intersection'](_0xfd04e1[_0x8817('0x2f')],qs[_0x8817('0x34')](_0x4babbb[_0x8817('0x31')]['fields']));_0x4bc366['attributes']=_0x4bc366['attributes'][_0x8817('0x36')]?_0x4bc366[_0x8817('0x35')]:_0xfd04e1['model'];_0x4bc366[_0x8817('0x4c')]=qs[_0x8817('0x38')](_0x4babbb[_0x8817('0x31')][_0x8817('0x38')]);_0x4bc366[_0x8817('0x39')]=qs[_0x8817('0x32')](_['pick'](_0x4babbb[_0x8817('0x31')],_0xfd04e1[_0x8817('0x32')]));if(_0x4babbb[_0x8817('0x31')][_0x8817('0x3b')]){_0x4bc366['where']=_[_0x8817('0x3d')](_0x4bc366['where'],{'$or':_[_0x8817('0x2b')](_0x4bc366[_0x8817('0x35')],function(_0x5152aa){var _0x3d3775={};_0x3d3775[_0x5152aa]={'$like':'%'+_0x4babbb[_0x8817('0x31')][_0x8817('0x3b')]+'%'};return _0x3d3775;})});}_0x4bc366=_[_0x8817('0x3d')]({},_0x4bc366,_0x4babbb[_0x8817('0x3e')]);return _0x2d3f40[_0x8817('0x50')](_0x4bc366);}})[_0x8817('0x26')](function(_0x5b1485){if(_0x5b1485){_0x236270=_0x5b1485[_0x8817('0x36')];if(!_0x4babbb[_0x8817('0x31')][_0x8817('0x4e')](_0x8817('0x37'))){_0x4bc366[_0x8817('0x1c')]=qs[_0x8817('0x1c')](_0x4babbb[_0x8817('0x31')][_0x8817('0x1c')]);_0x4bc366['offset']=qs[_0x8817('0x1b')](_0x4babbb[_0x8817('0x31')][_0x8817('0x1b')]);}return _0x2d3f40[_0x8817('0x50')](_0x4bc366);}})[_0x8817('0x26')](function(_0x406ed6){if(_0x406ed6){return _0x406ed6?{'count':_0x236270,'rows':_0x406ed6}:null;}})[_0x8817('0x26')](respondWithResult(_0x20c382,null))[_0x8817('0x44')](handleError(_0x20c382,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3501b3e..ae20222 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 _0x9395=['api','moment','bluebird','request-promise','path','rimraf','exports','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x26167d,_0x4d5874){var _0x54cb7a=function(_0x192b1b){while(--_0x192b1b){_0x26167d['push'](_0x26167d['shift']());}};_0x54cb7a(++_0x4d5874);}(_0x9395,0x81));var _0x5939=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9395[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5939('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5939('0x1'));var moment=require(_0x5939('0x2'));var BPromise=require(_0x5939('0x3'));var rp=require(_0x5939('0x4'));var fs=require('fs');var path=require(_0x5939('0x5'));var rimraf=require(_0x5939('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x5939('0x7')]=function(_0xe55e9c,_0x59dc1a){return _0xe55e9c['define'](_0x5939('0x8'),attributes,{'tableName':_0x5939('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb8=['./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8cb8,0x10b));var _0x88cb=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x8cb8[_0x1034ee];return _0x2922af;};'use strict';var _=require(_0x88cb('0x0'));var util=require(_0x88cb('0x1'));var logger=require(_0x88cb('0x2'))(_0x88cb('0x3'));var moment=require(_0x88cb('0x4'));var BPromise=require(_0x88cb('0x5'));var rp=require(_0x88cb('0x6'));var fs=require('fs');var path=require(_0x88cb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x88cb('0x8'));module['exports']=function(_0x19eb42,_0x641618){return _0x19eb42[_0x88cb('0x9')](_0x88cb('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 94e29f0..4ec21ce 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 _0x7ac7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x5c6980,_0x2ed264){var _0x6f558b=function(_0x1225e9){while(--_0x1225e9){_0x5c6980['push'](_0x5c6980['shift']());}};_0x6f558b(++_0x2ed264);}(_0x7ac7,0x9e));var _0x77ac=function(_0x28d3a3,_0x51af38){_0x28d3a3=_0x28d3a3-0x0;var _0x5e5be5=_0x7ac7[_0x28d3a3];return _0x5e5be5;};'use strict';var _=require('lodash');var util=require(_0x77ac('0x0'));var moment=require(_0x77ac('0x1'));var BPromise=require(_0x77ac('0x2'));var rs=require(_0x77ac('0x3'));var fs=require('fs');var Redis=require(_0x77ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x77ac('0x5'));var logger=require(_0x77ac('0x6'))(_0x77ac('0x7'));var config=require(_0x77ac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77ac('0x9')][_0x77ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283dda,_0x265597,_0x3796d4){return new BPromise(function(_0x4db035,_0x293a0b){return client[_0x77ac('0xb')](_0x283dda,_0x3796d4)[_0x77ac('0xc')](function(_0xe284d){logger[_0x77ac('0xd')](_0x77ac('0xe'),_0x265597,'request\x20sent');logger[_0x77ac('0xf')](_0x77ac('0x10'),_0x265597,_0x77ac('0x11'),JSON[_0x77ac('0x12')](_0xe284d));if(_0xe284d[_0x77ac('0x13')]){if(_0xe284d['error'][_0x77ac('0x14')]===0x1f4){logger['error'](_0x77ac('0xe'),_0x265597,_0xe284d[_0x77ac('0x13')][_0x77ac('0x15')]);return _0x293a0b(_0xe284d[_0x77ac('0x13')][_0x77ac('0x15')]);}logger[_0x77ac('0x13')](_0x77ac('0xe'),_0x265597,_0xe284d[_0x77ac('0x13')][_0x77ac('0x15')]);return _0x4db035(_0xe284d[_0x77ac('0x13')][_0x77ac('0x15')]);}else{logger[_0x77ac('0xd')](_0x77ac('0xe'),_0x265597,_0x77ac('0x11'));_0x4db035(_0xe284d['result'][_0x77ac('0x15')]);}})[_0x77ac('0x16')](function(_0x892ec7){logger[_0x77ac('0x13')](_0x77ac('0xe'),_0x265597,_0x892ec7);_0x293a0b(_0x892ec7);});});} \ No newline at end of file +var _0xd059=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x24eb36,_0x47bb7b){var _0x4ae8ea=function(_0x24168e){while(--_0x24168e){_0x24eb36['push'](_0x24eb36['shift']());}};_0x4ae8ea(++_0x47bb7b);}(_0xd059,0x1a5));var _0x9d05=function(_0x544aad,_0x5b2b90){_0x544aad=_0x544aad-0x0;var _0x14c567=_0xd059[_0x544aad];return _0x14c567;};'use strict';var _=require(_0x9d05('0x0'));var util=require(_0x9d05('0x1'));var moment=require(_0x9d05('0x2'));var BPromise=require(_0x9d05('0x3'));var rs=require(_0x9d05('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d05('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d05('0x6'))(_0x9d05('0x7'));var config=require(_0x9d05('0x8'));var jayson=require(_0x9d05('0x9'));var client=jayson[_0x9d05('0xa')][_0x9d05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3daba2,_0x1e67c3,_0x57f9fe){return new BPromise(function(_0x123dfe,_0x1ee0fd){return client[_0x9d05('0xc')](_0x3daba2,_0x57f9fe)['then'](function(_0x239ad0){logger[_0x9d05('0xd')](_0x9d05('0xe'),_0x1e67c3,_0x9d05('0xf'));logger[_0x9d05('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1e67c3,_0x9d05('0xf'),JSON[_0x9d05('0x11')](_0x239ad0));if(_0x239ad0[_0x9d05('0x12')]){if(_0x239ad0['error'][_0x9d05('0x13')]===0x1f4){logger['error'](_0x9d05('0xe'),_0x1e67c3,_0x239ad0[_0x9d05('0x12')][_0x9d05('0x14')]);return _0x1ee0fd(_0x239ad0[_0x9d05('0x12')][_0x9d05('0x14')]);}logger['error'](_0x9d05('0xe'),_0x1e67c3,_0x239ad0[_0x9d05('0x12')]['message']);return _0x123dfe(_0x239ad0[_0x9d05('0x12')][_0x9d05('0x14')]);}else{logger[_0x9d05('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1e67c3,_0x9d05('0xf'));_0x123dfe(_0x239ad0[_0x9d05('0x15')]['message']);}})[_0x9d05('0x16')](function(_0x37170a){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1e67c3,_0x37170a);_0x1ee0fd(_0x37170a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a356f58..ba0127b 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 _0x5617=['show','post','create','update','delete','/:id','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5617,0x1da));var _0x7561=function(_0x51d22e,_0x276640){_0x51d22e=_0x51d22e-0x0;var _0x275be3=_0x5617[_0x51d22e];return _0x275be3;};'use strict';var multer=require('multer');var util=require(_0x7561('0x0'));var path=require(_0x7561('0x1'));var timeout=require(_0x7561('0x2'));var express=require(_0x7561('0x3'));var router=express[_0x7561('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7561('0x5'));var interaction=require(_0x7561('0x6'));var config=require(_0x7561('0x7'));var controller=require(_0x7561('0x8'));router[_0x7561('0x9')]('/',auth[_0x7561('0xa')](),controller[_0x7561('0xb')]);router['get']('/:id',auth[_0x7561('0xa')](),controller[_0x7561('0xc')]);router[_0x7561('0xd')]('/',auth[_0x7561('0xa')](),controller[_0x7561('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7561('0xf')]);router[_0x7561('0x10')](_0x7561('0x11'),auth[_0x7561('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdbc3=['index','get','/:id','put','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2da7cb,_0x4c9ba2){var _0xfa4be=function(_0xbc3cbf){while(--_0xbc3cbf){_0x2da7cb['push'](_0x2da7cb['shift']());}};_0xfa4be(++_0x4c9ba2);}(_0xdbc3,0x1c0));var _0x3dbc=function(_0x361f8f,_0x506981){_0x361f8f=_0x361f8f-0x0;var _0x5c05de=_0xdbc3[_0x361f8f];return _0x5c05de;};'use strict';var multer=require(_0x3dbc('0x0'));var util=require(_0x3dbc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3dbc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3dbc('0x3'));var interaction=require(_0x3dbc('0x4'));var config=require(_0x3dbc('0x5'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x3dbc('0x6')](),controller[_0x3dbc('0x7')]);router[_0x3dbc('0x8')](_0x3dbc('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3dbc('0x6')](),controller['create']);router[_0x3dbc('0xa')](_0x3dbc('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3dbc('0xb')](_0x3dbc('0x9'),auth[_0x3dbc('0x6')](),controller['destroy']);module[_0x3dbc('0xc')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 732d552..0a29975 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 _0x15c8=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2ef8a7,_0x342bac){var _0x440623=function(_0x37f8cc){while(--_0x37f8cc){_0x2ef8a7['push'](_0x2ef8a7['shift']());}};_0x440623(++_0x342bac);}(_0x15c8,0x1de));var _0x815c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x15c8[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x815c('0x0'));module[_0x815c('0x1')]={'type':{'type':Sequelize[_0x815c('0x2')](_0x815c('0x3'),_0x815c('0x4'),_0x815c('0x5'),_0x815c('0x6'),_0x815c('0x7')),'defaultValue':_0x815c('0x3')},'content':{'type':Sequelize[_0x815c('0x8')]},'key':{'type':Sequelize[_0x815c('0x8')]},'keyType':{'type':Sequelize[_0x815c('0x2')](_0x815c('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x815c('0x8')]},'idField':{'type':Sequelize[_0x815c('0x8')]},'variableName':{'type':Sequelize[_0x815c('0x8')]}}; \ No newline at end of file +var _0x3319=['sequelize','ENUM','keyValue','picklist','STRING','string','customVariable'];(function(_0x5a4b2b,_0x210f4e){var _0x290f97=function(_0x30e5e9){while(--_0x30e5e9){_0x5a4b2b['push'](_0x5a4b2b['shift']());}};_0x290f97(++_0x210f4e);}(_0x3319,0x17a));var _0x9331=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x3319[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x9331('0x0'));module['exports']={'type':{'type':Sequelize[_0x9331('0x1')]('string','variable','customVariable',_0x9331('0x2'),_0x9331('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9331('0x4')]},'key':{'type':Sequelize[_0x9331('0x4')]},'keyType':{'type':Sequelize[_0x9331('0x1')](_0x9331('0x5'),'variable',_0x9331('0x6'))},'keyContent':{'type':Sequelize[_0x9331('0x4')]},'idField':{'type':Sequelize[_0x9331('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a3a835b..4f7dacd 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 _0x7e05=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','filter','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','catch','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e05,0x166));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x57e0('0x0'));var rimraf=require(_0x57e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57e0('0x2'));var moment=require(_0x57e0('0x3'));var BPromise=require(_0x57e0('0x4'));var Mustache=require('mustache');var util=require(_0x57e0('0x5'));var path=require(_0x57e0('0x6'));var sox=require(_0x57e0('0x7'));var csv=require('to-csv');var ejs=require(_0x57e0('0x8'));var fs=require('fs');var fs_extra=require(_0x57e0('0x9'));var _=require(_0x57e0('0xa'));var squel=require('squel');var crypto=require(_0x57e0('0xb'));var jsforce=require(_0x57e0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x57e0('0xd'));var querystring=require(_0x57e0('0xe'));var Papa=require(_0x57e0('0xf'));var Redis=require(_0x57e0('0x10'));var authService=require(_0x57e0('0x11'));var qs=require(_0x57e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57e0('0x13'))(_0x57e0('0x14'));var utils=require(_0x57e0('0x15'));var config=require(_0x57e0('0x16'));var licenseUtil=require(_0x57e0('0x17'));var db=require(_0x57e0('0x18'))['db'];function respondWithStatusCode(_0x4adaa7,_0x1cb5e3){_0x1cb5e3=_0x1cb5e3||0xcc;return function(_0x207347){if(_0x207347){return _0x4adaa7[_0x57e0('0x19')](_0x1cb5e3);}return _0x4adaa7[_0x57e0('0x1a')](_0x1cb5e3)['end']();};}function respondWithResult(_0x958054,_0x5b63f6){_0x5b63f6=_0x5b63f6||0xc8;return function(_0xc94cf7){if(_0xc94cf7){return _0x958054['status'](_0x5b63f6)[_0x57e0('0x1b')](_0xc94cf7);}};}function respondWithFilteredResult(_0x564581,_0x368cb3){return function(_0x4e6e25){if(_0x4e6e25){var _0x1c79d8=typeof _0x368cb3[_0x57e0('0x1c')]===_0x57e0('0x1d')&&typeof _0x368cb3[_0x57e0('0x1e')]===_0x57e0('0x1d');var _0x2770da=_0x4e6e25['count'];var _0x51c136=_0x1c79d8?0x0:_0x368cb3['offset'];var _0x3a8ccb=_0x1c79d8?_0x4e6e25[_0x57e0('0x1f')]:_0x368cb3[_0x57e0('0x1c')]+_0x368cb3[_0x57e0('0x1e')];var _0x35db26;if(_0x3a8ccb>=_0x2770da){_0x3a8ccb=_0x2770da;_0x35db26=0xc8;}else{_0x35db26=0xce;}_0x564581[_0x57e0('0x1a')](_0x35db26);return _0x564581[_0x57e0('0x20')](_0x57e0('0x21'),_0x51c136+'-'+_0x3a8ccb+'/'+_0x2770da)['json'](_0x4e6e25);}return null;};}function patchUpdates(_0x7b2fc8){return function(_0x11b27b){try{jsonpatch['apply'](_0x11b27b,_0x7b2fc8,!![]);}catch(_0x158ff7){return BPromise[_0x57e0('0x22')](_0x158ff7);}return _0x11b27b[_0x57e0('0x23')]();};}function saveUpdates(_0x228679,_0x4f130f){return function(_0x4d78a2){if(_0x4d78a2){return _0x4d78a2[_0x57e0('0x24')](_0x228679)[_0x57e0('0x25')](function(_0x5c4314){return _0x5c4314;});}return null;};}function removeEntity(_0x120146,_0x211e27){return function(_0x1dfa9f){if(_0x1dfa9f){return _0x1dfa9f[_0x57e0('0x26')]()[_0x57e0('0x25')](function(){_0x120146['status'](0xcc)[_0x57e0('0x27')]();});}};}function handleEntityNotFound(_0x4436a8,_0x53672d){return function(_0x3d3a7b){if(!_0x3d3a7b){_0x4436a8['sendStatus'](0x194);}return _0x3d3a7b;};}function handleError(_0x309a44,_0x21a642){_0x21a642=_0x21a642||0x1f4;return function(_0x4235ad){logger[_0x57e0('0x28')](_0x4235ad[_0x57e0('0x29')]);if(_0x4235ad[_0x57e0('0x2a')]){delete _0x4235ad[_0x57e0('0x2a')];}_0x309a44[_0x57e0('0x1a')](_0x21a642)[_0x57e0('0x2b')](_0x4235ad);};}exports['index']=function(_0xd2b71b,_0x4aa5ac){var _0x67d04b={},_0x503e4e={},_0x181fd6={'count':0x0,'rows':[]};var _0x2377f6=_[_0x57e0('0x2c')](db[_0x57e0('0x2d')][_0x57e0('0x2e')],function(_0x5175bf){return{'name':_0x5175bf[_0x57e0('0x2f')],'type':_0x5175bf[_0x57e0('0x30')][_0x57e0('0x31')]};});_0x503e4e[_0x57e0('0x32')]=_[_0x57e0('0x2c')](_0x2377f6,'name');_0x503e4e[_0x57e0('0x33')]=_[_0x57e0('0x34')](_0xd2b71b[_0x57e0('0x33')]);_0x503e4e[_0x57e0('0x35')]=_[_0x57e0('0x36')](_0x503e4e['model'],_0x503e4e[_0x57e0('0x33')]);_0x67d04b['attributes']=_[_0x57e0('0x36')](_0x503e4e[_0x57e0('0x32')],qs[_0x57e0('0x37')](_0xd2b71b[_0x57e0('0x33')][_0x57e0('0x37')]));_0x67d04b[_0x57e0('0x38')]=_0x67d04b[_0x57e0('0x38')][_0x57e0('0x39')]?_0x67d04b['attributes']:_0x503e4e[_0x57e0('0x32')];if(!_0xd2b71b[_0x57e0('0x33')]['hasOwnProperty'](_0x57e0('0x3a'))){_0x67d04b[_0x57e0('0x1e')]=qs[_0x57e0('0x1e')](_0xd2b71b['query'][_0x57e0('0x1e')]);_0x67d04b[_0x57e0('0x1c')]=qs[_0x57e0('0x1c')](_0xd2b71b['query'][_0x57e0('0x1c')]);}_0x67d04b[_0x57e0('0x3b')]=qs['sort'](_0xd2b71b[_0x57e0('0x33')]['sort']);_0x67d04b[_0x57e0('0x3c')]=qs['filters'](_['pick'](_0xd2b71b[_0x57e0('0x33')],_0x503e4e[_0x57e0('0x35')]),_0x2377f6);if(_0xd2b71b[_0x57e0('0x33')][_0x57e0('0x3d')]){_0x67d04b[_0x57e0('0x3c')]=_['merge'](_0x67d04b['where'],{'$or':_[_0x57e0('0x2c')](_0x2377f6,function(_0x3bcb11){if(_0x3bcb11[_0x57e0('0x30')]!=='VIRTUAL'){var _0x25f23c={};_0x25f23c[_0x3bcb11[_0x57e0('0x2a')]]={'$like':'%'+_0xd2b71b[_0x57e0('0x33')][_0x57e0('0x3d')]+'%'};return _0x25f23c;}})});}_0x67d04b=_['merge']({},_0x67d04b,_0xd2b71b[_0x57e0('0x3e')]);var _0x4135ef={'where':_0x67d04b['where']};return db[_0x57e0('0x2d')][_0x57e0('0x1f')](_0x4135ef)[_0x57e0('0x25')](function(_0x56b13e){_0x181fd6[_0x57e0('0x1f')]=_0x56b13e;if(_0xd2b71b[_0x57e0('0x33')][_0x57e0('0x3f')]){_0x67d04b[_0x57e0('0x40')]=[{'all':!![]}];}return db[_0x57e0('0x2d')][_0x57e0('0x41')](_0x67d04b);})[_0x57e0('0x25')](function(_0x103022){_0x181fd6[_0x57e0('0x42')]=_0x103022;return _0x181fd6;})[_0x57e0('0x25')](respondWithFilteredResult(_0x4aa5ac,_0x67d04b))['catch'](handleError(_0x4aa5ac,null));};exports[_0x57e0('0x43')]=function(_0x4284d5,_0x40a332){var _0x216ed6={'raw':!![],'where':{'id':_0x4284d5[_0x57e0('0x44')]['id']}},_0x35b83d={};_0x35b83d[_0x57e0('0x32')]=_['keys'](db[_0x57e0('0x2d')][_0x57e0('0x2e')]);_0x35b83d[_0x57e0('0x33')]=_[_0x57e0('0x34')](_0x4284d5['query']);_0x35b83d[_0x57e0('0x35')]=_[_0x57e0('0x36')](_0x35b83d['model'],_0x35b83d[_0x57e0('0x33')]);_0x216ed6[_0x57e0('0x38')]=_[_0x57e0('0x36')](_0x35b83d[_0x57e0('0x32')],qs[_0x57e0('0x37')](_0x4284d5[_0x57e0('0x33')][_0x57e0('0x37')]));_0x216ed6[_0x57e0('0x38')]=_0x216ed6[_0x57e0('0x38')]['length']?_0x216ed6[_0x57e0('0x38')]:_0x35b83d['model'];if(_0x4284d5[_0x57e0('0x33')][_0x57e0('0x3f')]){_0x216ed6[_0x57e0('0x40')]=[{'all':!![]}];}_0x216ed6=_[_0x57e0('0x45')]({},_0x216ed6,_0x4284d5[_0x57e0('0x3e')]);return db[_0x57e0('0x2d')][_0x57e0('0x46')](_0x216ed6)[_0x57e0('0x25')](handleEntityNotFound(_0x40a332,null))[_0x57e0('0x25')](respondWithResult(_0x40a332,null))['catch'](handleError(_0x40a332,null));};exports[_0x57e0('0x47')]=function(_0x2fb1c4,_0x400c26){return db[_0x57e0('0x2d')][_0x57e0('0x47')](_0x2fb1c4[_0x57e0('0x48')],{})[_0x57e0('0x25')](respondWithResult(_0x400c26,0xc9))[_0x57e0('0x49')](handleError(_0x400c26,null));};exports[_0x57e0('0x24')]=function(_0x3e3f71,_0x52ae6f){if(_0x3e3f71[_0x57e0('0x48')]['id']){delete _0x3e3f71[_0x57e0('0x48')]['id'];}return db[_0x57e0('0x2d')][_0x57e0('0x46')]({'where':{'id':_0x3e3f71['params']['id']}})[_0x57e0('0x25')](handleEntityNotFound(_0x52ae6f,null))[_0x57e0('0x25')](saveUpdates(_0x3e3f71[_0x57e0('0x48')],null))[_0x57e0('0x25')](respondWithResult(_0x52ae6f,null))['catch'](handleError(_0x52ae6f,null));};exports['destroy']=function(_0x1b7093,_0x199ea8){return db[_0x57e0('0x2d')][_0x57e0('0x46')]({'where':{'id':_0x1b7093['params']['id']}})[_0x57e0('0x25')](handleEntityNotFound(_0x199ea8,null))['then'](removeEntity(_0x199ea8,null))[_0x57e0('0x49')](handleError(_0x199ea8,null));}; \ No newline at end of file +var _0x600c=['name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x600c,0x198));var _0xc600=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x600c[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0xc600('0x0'));var rimraf=require(_0xc600('0x1'));var zipdir=require(_0xc600('0x2'));var jsonpatch=require(_0xc600('0x3'));var rp=require(_0xc600('0x4'));var moment=require(_0xc600('0x5'));var BPromise=require(_0xc600('0x6'));var Mustache=require(_0xc600('0x7'));var util=require('util');var path=require(_0xc600('0x8'));var sox=require(_0xc600('0x9'));var csv=require(_0xc600('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc600('0xb'));var _=require(_0xc600('0xc'));var squel=require(_0xc600('0xd'));var crypto=require(_0xc600('0xe'));var jsforce=require(_0xc600('0xf'));var deskjs=require(_0xc600('0x10'));var toCsv=require(_0xc600('0xa'));var querystring=require(_0xc600('0x11'));var Papa=require(_0xc600('0x12'));var Redis=require(_0xc600('0x13'));var authService=require(_0xc600('0x14'));var qs=require(_0xc600('0x15'));var as=require(_0xc600('0x16'));var hardwareService=require(_0xc600('0x17'));var logger=require(_0xc600('0x18'))('api');var utils=require(_0xc600('0x19'));var config=require(_0xc600('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc600('0x1b'))['db'];function respondWithStatusCode(_0x5e1c0c,_0x27915d){_0x27915d=_0x27915d||0xcc;return function(_0x1c3eb7){if(_0x1c3eb7){return _0x5e1c0c[_0xc600('0x1c')](_0x27915d);}return _0x5e1c0c['status'](_0x27915d)[_0xc600('0x1d')]();};}function respondWithResult(_0x49b35f,_0x2a41f9){_0x2a41f9=_0x2a41f9||0xc8;return function(_0x10bc0b){if(_0x10bc0b){return _0x49b35f[_0xc600('0x1e')](_0x2a41f9)[_0xc600('0x1f')](_0x10bc0b);}};}function respondWithFilteredResult(_0x5b7e8c,_0x18ed01){return function(_0x498e29){if(_0x498e29){var _0x5043a2=typeof _0x18ed01[_0xc600('0x20')]===_0xc600('0x21')&&typeof _0x18ed01[_0xc600('0x22')]===_0xc600('0x21');var _0x2c06a5=_0x498e29[_0xc600('0x23')];var _0x376edf=_0x5043a2?0x0:_0x18ed01[_0xc600('0x20')];var _0xca10bb=_0x5043a2?_0x498e29[_0xc600('0x23')]:_0x18ed01[_0xc600('0x20')]+_0x18ed01[_0xc600('0x22')];var _0x164978;if(_0xca10bb>=_0x2c06a5){_0xca10bb=_0x2c06a5;_0x164978=0xc8;}else{_0x164978=0xce;}_0x5b7e8c['status'](_0x164978);return _0x5b7e8c['set'](_0xc600('0x24'),_0x376edf+'-'+_0xca10bb+'/'+_0x2c06a5)[_0xc600('0x1f')](_0x498e29);}return null;};}function patchUpdates(_0x23f75a){return function(_0x303d90){try{jsonpatch['apply'](_0x303d90,_0x23f75a,!![]);}catch(_0x2d6662){return BPromise[_0xc600('0x25')](_0x2d6662);}return _0x303d90[_0xc600('0x26')]();};}function saveUpdates(_0x4c0f00,_0x26bf0d){return function(_0x5ed6bb){if(_0x5ed6bb){return _0x5ed6bb['update'](_0x4c0f00)[_0xc600('0x27')](function(_0x5c2139){return _0x5c2139;});}return null;};}function removeEntity(_0x17c147,_0x476c4c){return function(_0x157727){if(_0x157727){return _0x157727[_0xc600('0x28')]()[_0xc600('0x27')](function(){_0x17c147[_0xc600('0x1e')](0xcc)[_0xc600('0x1d')]();});}};}function handleEntityNotFound(_0x52d9d6,_0x1a1ff8){return function(_0x343cac){if(!_0x343cac){_0x52d9d6[_0xc600('0x1c')](0x194);}return _0x343cac;};}function handleError(_0x3e101a,_0x9d37c3){_0x9d37c3=_0x9d37c3||0x1f4;return function(_0x147003){logger['error'](_0x147003[_0xc600('0x29')]);if(_0x147003[_0xc600('0x2a')]){delete _0x147003[_0xc600('0x2a')];}_0x3e101a[_0xc600('0x1e')](_0x9d37c3)[_0xc600('0x2b')](_0x147003);};}exports[_0xc600('0x2c')]=function(_0x4e70e6,_0x4b0480){var _0x47ab7a={},_0x1e3fcd={},_0xb70f5c={'count':0x0,'rows':[]};var _0x56b266=_[_0xc600('0x2d')](db[_0xc600('0x2e')][_0xc600('0x2f')],function(_0x3e9ccf){return{'name':_0x3e9ccf[_0xc600('0x30')],'type':_0x3e9ccf[_0xc600('0x31')]['key']};});_0x1e3fcd[_0xc600('0x32')]=_[_0xc600('0x2d')](_0x56b266,_0xc600('0x2a'));_0x1e3fcd['query']=_[_0xc600('0x33')](_0x4e70e6[_0xc600('0x34')]);_0x1e3fcd['filters']=_[_0xc600('0x35')](_0x1e3fcd[_0xc600('0x32')],_0x1e3fcd['query']);_0x47ab7a['attributes']=_[_0xc600('0x35')](_0x1e3fcd['model'],qs[_0xc600('0x36')](_0x4e70e6[_0xc600('0x34')][_0xc600('0x36')]));_0x47ab7a[_0xc600('0x37')]=_0x47ab7a['attributes']['length']?_0x47ab7a[_0xc600('0x37')]:_0x1e3fcd[_0xc600('0x32')];if(!_0x4e70e6[_0xc600('0x34')]['hasOwnProperty'](_0xc600('0x38'))){_0x47ab7a[_0xc600('0x22')]=qs[_0xc600('0x22')](_0x4e70e6['query'][_0xc600('0x22')]);_0x47ab7a['offset']=qs[_0xc600('0x20')](_0x4e70e6[_0xc600('0x34')][_0xc600('0x20')]);}_0x47ab7a[_0xc600('0x39')]=qs[_0xc600('0x3a')](_0x4e70e6[_0xc600('0x34')][_0xc600('0x3a')]);_0x47ab7a[_0xc600('0x3b')]=qs[_0xc600('0x3c')](_[_0xc600('0x3d')](_0x4e70e6[_0xc600('0x34')],_0x1e3fcd[_0xc600('0x3c')]),_0x56b266);if(_0x4e70e6['query']['filter']){_0x47ab7a[_0xc600('0x3b')]=_[_0xc600('0x3e')](_0x47ab7a['where'],{'$or':_['map'](_0x56b266,function(_0x5b190f){if(_0x5b190f[_0xc600('0x31')]!=='VIRTUAL'){var _0x34d75f={};_0x34d75f[_0x5b190f[_0xc600('0x2a')]]={'$like':'%'+_0x4e70e6[_0xc600('0x34')]['filter']+'%'};return _0x34d75f;}})});}_0x47ab7a=_[_0xc600('0x3e')]({},_0x47ab7a,_0x4e70e6['options']);var _0x3569a6={'where':_0x47ab7a[_0xc600('0x3b')]};return db['SalesforceField'][_0xc600('0x23')](_0x3569a6)[_0xc600('0x27')](function(_0x199711){_0xb70f5c[_0xc600('0x23')]=_0x199711;if(_0x4e70e6[_0xc600('0x34')][_0xc600('0x3f')]){_0x47ab7a[_0xc600('0x40')]=[{'all':!![]}];}return db[_0xc600('0x2e')][_0xc600('0x41')](_0x47ab7a);})[_0xc600('0x27')](function(_0x152883){_0xb70f5c[_0xc600('0x42')]=_0x152883;return _0xb70f5c;})[_0xc600('0x27')](respondWithFilteredResult(_0x4b0480,_0x47ab7a))[_0xc600('0x43')](handleError(_0x4b0480,null));};exports[_0xc600('0x44')]=function(_0x41940a,_0x4f2d0b){var _0x3ebf19={'raw':!![],'where':{'id':_0x41940a[_0xc600('0x45')]['id']}},_0x5e7866={};_0x5e7866['model']=_['keys'](db['SalesforceField'][_0xc600('0x2f')]);_0x5e7866[_0xc600('0x34')]=_['keys'](_0x41940a['query']);_0x5e7866[_0xc600('0x3c')]=_[_0xc600('0x35')](_0x5e7866[_0xc600('0x32')],_0x5e7866[_0xc600('0x34')]);_0x3ebf19[_0xc600('0x37')]=_[_0xc600('0x35')](_0x5e7866['model'],qs['fields'](_0x41940a['query'][_0xc600('0x36')]));_0x3ebf19['attributes']=_0x3ebf19[_0xc600('0x37')][_0xc600('0x46')]?_0x3ebf19['attributes']:_0x5e7866[_0xc600('0x32')];if(_0x41940a[_0xc600('0x34')]['includeAll']){_0x3ebf19[_0xc600('0x40')]=[{'all':!![]}];}_0x3ebf19=_[_0xc600('0x3e')]({},_0x3ebf19,_0x41940a[_0xc600('0x47')]);return db['SalesforceField'][_0xc600('0x48')](_0x3ebf19)['then'](handleEntityNotFound(_0x4f2d0b,null))[_0xc600('0x27')](respondWithResult(_0x4f2d0b,null))[_0xc600('0x43')](handleError(_0x4f2d0b,null));};exports[_0xc600('0x49')]=function(_0x103d2b,_0x512061){return db['SalesforceField'][_0xc600('0x49')](_0x103d2b[_0xc600('0x4a')],{})[_0xc600('0x27')](respondWithResult(_0x512061,0xc9))[_0xc600('0x43')](handleError(_0x512061,null));};exports['update']=function(_0x4b4634,_0x441da2){if(_0x4b4634['body']['id']){delete _0x4b4634[_0xc600('0x4a')]['id'];}return db[_0xc600('0x2e')]['find']({'where':{'id':_0x4b4634[_0xc600('0x45')]['id']}})[_0xc600('0x27')](handleEntityNotFound(_0x441da2,null))[_0xc600('0x27')](saveUpdates(_0x4b4634[_0xc600('0x4a')],null))[_0xc600('0x27')](respondWithResult(_0x441da2,null))[_0xc600('0x43')](handleError(_0x441da2,null));};exports['destroy']=function(_0x45d159,_0x194a02){return db[_0xc600('0x2e')]['find']({'where':{'id':_0x45d159[_0xc600('0x45')]['id']}})[_0xc600('0x27')](handleEntityNotFound(_0x194a02,null))[_0xc600('0x27')](removeEntity(_0x194a02,null))[_0xc600('0x43')](handleError(_0x194a02,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 347e098..065ec49 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 _0x7401=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x4d3941,_0x5b0bc0){var _0x5c311b=function(_0x2df585){while(--_0x2df585){_0x4d3941['push'](_0x4d3941['shift']());}};_0x5c311b(++_0x5b0bc0);}(_0x7401,0x96));var _0x1740=function(_0xd8da16,_0x2b31ef){_0xd8da16=_0xd8da16-0x0;var _0xc090cb=_0x7401[_0xd8da16];return _0xc090cb;};'use strict';var _=require(_0x1740('0x0'));var util=require(_0x1740('0x1'));var logger=require(_0x1740('0x2'))(_0x1740('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1740('0x4'));var fs=require('fs');var path=require(_0x1740('0x5'));var rimraf=require(_0x1740('0x6'));var config=require('../../config/environment');var attributes=require(_0x1740('0x7'));module[_0x1740('0x8')]=function(_0x5283f2,_0x266c3d){return _0x5283f2[_0x1740('0x9')](_0x1740('0xa'),attributes,{'tableName':_0x1740('0xb'),'paranoid':![],'indexes':[{'name':_0x1740('0xc'),'fields':[_0x1740('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6561=['./intSalesforceField.attributes','exports','salesforce_unique_index','FieldId','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6561,0x9a));var _0x1656=function(_0xd92e0f,_0x4c28de){_0xd92e0f=_0xd92e0f-0x0;var _0x408a33=_0x6561[_0xd92e0f];return _0x408a33;};'use strict';var _=require(_0x1656('0x0'));var util=require(_0x1656('0x1'));var logger=require('../../config/logger')(_0x1656('0x2'));var moment=require(_0x1656('0x3'));var BPromise=require('bluebird');var rp=require(_0x1656('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1656('0x5'));var attributes=require(_0x1656('0x6'));module[_0x1656('0x7')]=function(_0x1ef26a,_0x4929b2){return _0x1ef26a['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1656('0x8'),'fields':['idField',_0x1656('0x9')],'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 e6e61ad..8b28083 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 _0xd648=['../../config/utils','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd648,0x1b2));var _0x8d64=function(_0x534a32,_0x1be585){_0x534a32=_0x534a32-0x0;var _0x19ffb2=_0xd648[_0x534a32];return _0x19ffb2;};'use strict';var _=require(_0x8d64('0x0'));var util=require('util');var moment=require(_0x8d64('0x1'));var BPromise=require(_0x8d64('0x2'));var rs=require(_0x8d64('0x3'));var fs=require('fs');var Redis=require(_0x8d64('0x4'));var db=require(_0x8d64('0x5'))['db'];var utils=require(_0x8d64('0x6'));var logger=require('../../config/logger')(_0x8d64('0x7'));var config=require(_0x8d64('0x8'));var jayson=require(_0x8d64('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3570f8,_0x9122f1,_0x317304){return new BPromise(function(_0x5f23ce,_0x5160c5){return client[_0x8d64('0xa')](_0x3570f8,_0x317304)['then'](function(_0x491efe){logger[_0x8d64('0xb')](_0x8d64('0xc'),_0x9122f1,'request\x20sent');logger[_0x8d64('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x9122f1,_0x8d64('0xe'),JSON[_0x8d64('0xf')](_0x491efe));if(_0x491efe['error']){if(_0x491efe[_0x8d64('0x10')]['code']===0x1f4){logger[_0x8d64('0x10')](_0x8d64('0xc'),_0x9122f1,_0x491efe['error']['message']);return _0x5160c5(_0x491efe[_0x8d64('0x10')]['message']);}logger[_0x8d64('0x10')](_0x8d64('0xc'),_0x9122f1,_0x491efe[_0x8d64('0x10')]['message']);return _0x5f23ce(_0x491efe[_0x8d64('0x10')][_0x8d64('0x11')]);}else{logger[_0x8d64('0xb')](_0x8d64('0xc'),_0x9122f1,_0x8d64('0xe'));_0x5f23ce(_0x491efe[_0x8d64('0x12')][_0x8d64('0x11')]);}})[_0x8d64('0x13')](function(_0x44e62c){logger[_0x8d64('0x10')]('SalesforceField,\x20%s,\x20%s',_0x9122f1,_0x44e62c);_0x5160c5(_0x44e62c);});});} \ No newline at end of file +var _0x7474=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x26acda,_0xd2cbc){var _0x482b6f=function(_0x4a4a1a){while(--_0x4a4a1a){_0x26acda['push'](_0x26acda['shift']());}};_0x482b6f(++_0xd2cbc);}(_0x7474,0x73));var _0x4747=function(_0x65b0a5,_0x229602){_0x65b0a5=_0x65b0a5-0x0;var _0x454b36=_0x7474[_0x65b0a5];return _0x454b36;};'use strict';var _=require(_0x4747('0x0'));var util=require(_0x4747('0x1'));var moment=require(_0x4747('0x2'));var BPromise=require(_0x4747('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4747('0x4'));var db=require(_0x4747('0x5'))['db'];var utils=require(_0x4747('0x6'));var logger=require(_0x4747('0x7'))(_0x4747('0x8'));var config=require(_0x4747('0x9'));var jayson=require(_0x4747('0xa'));var client=jayson['client'][_0x4747('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1f79,_0x4c22f3,_0x127439){return new BPromise(function(_0x2e73c8,_0x334679){return client['request'](_0x4e1f79,_0x127439)[_0x4747('0xc')](function(_0x20011b){logger['info'](_0x4747('0xd'),_0x4c22f3,_0x4747('0xe'));logger[_0x4747('0xf')](_0x4747('0x10'),_0x4c22f3,_0x4747('0xe'),JSON[_0x4747('0x11')](_0x20011b));if(_0x20011b[_0x4747('0x12')]){if(_0x20011b[_0x4747('0x12')][_0x4747('0x13')]===0x1f4){logger[_0x4747('0x12')](_0x4747('0xd'),_0x4c22f3,_0x20011b[_0x4747('0x12')]['message']);return _0x334679(_0x20011b['error'][_0x4747('0x14')]);}logger[_0x4747('0x12')](_0x4747('0xd'),_0x4c22f3,_0x20011b[_0x4747('0x12')][_0x4747('0x14')]);return _0x2e73c8(_0x20011b[_0x4747('0x12')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x4c22f3,'request\x20sent');_0x2e73c8(_0x20011b[_0x4747('0x15')]['message']);}})[_0x4747('0x16')](function(_0x681854){logger['error']('SalesforceField,\x20%s,\x20%s',_0x4c22f3,_0x681854);_0x334679(_0x681854);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e2b7efa..3d8e270 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 _0xf9ec=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4b5f4f,_0x31a3e2){var _0x2651e2=function(_0x16d76f){while(--_0x16d76f){_0x4b5f4f['push'](_0x4b5f4f['shift']());}};_0x2651e2(++_0x31a3e2);}(_0xf9ec,0x128));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcf9e('0x0'));var util=require(_0xcf9e('0x1'));var path=require(_0xcf9e('0x2'));var timeout=require(_0xcf9e('0x3'));var express=require(_0xcf9e('0x4'));var router=express[_0xcf9e('0x5')]();var fs_extra=require(_0xcf9e('0x6'));var auth=require(_0xcf9e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcf9e('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xcf9e('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf9e('0xa')]);router[_0xcf9e('0x9')](_0xcf9e('0xb'),auth[_0xcf9e('0xc')](),controller[_0xcf9e('0xd')]);router['get'](_0xcf9e('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xcf9e('0x9')](_0xcf9e('0xf'),auth['isAuthenticated'](),controller[_0xcf9e('0x10')]);router[_0xcf9e('0x11')]('/',auth[_0xcf9e('0xc')](),controller[_0xcf9e('0x12')]);router[_0xcf9e('0x11')](_0xcf9e('0xe'),auth[_0xcf9e('0xc')](),controller[_0xcf9e('0x13')]);router[_0xcf9e('0x14')](_0xcf9e('0xb'),auth[_0xcf9e('0xc')](),controller[_0xcf9e('0x15')]);router[_0xcf9e('0x16')](_0xcf9e('0xb'),auth[_0xcf9e('0xc')](),controller[_0xcf9e('0x17')]);module[_0xcf9e('0x18')]=router; \ No newline at end of file +var _0x08d0=['getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0x08d0,0x133));var _0x008d=function(_0x1e12b2,_0x203a9e){_0x1e12b2=_0x1e12b2-0x0;var _0x5c9b5f=_0x08d0[_0x1e12b2];return _0x5c9b5f;};'use strict';var multer=require(_0x008d('0x0'));var util=require(_0x008d('0x1'));var path=require(_0x008d('0x2'));var timeout=require('connect-timeout');var express=require(_0x008d('0x3'));var router=express[_0x008d('0x4')]();var fs_extra=require(_0x008d('0x5'));var auth=require(_0x008d('0x6'));var interaction=require(_0x008d('0x7'));var config=require(_0x008d('0x8'));var controller=require(_0x008d('0x9'));router['get']('/',auth[_0x008d('0xa')](),controller[_0x008d('0xb')]);router[_0x008d('0xc')](_0x008d('0xd'),auth[_0x008d('0xa')](),controller[_0x008d('0xe')]);router['get'](_0x008d('0xf'),auth[_0x008d('0xa')](),controller[_0x008d('0x10')]);router[_0x008d('0xc')](_0x008d('0x11'),auth[_0x008d('0xa')](),controller[_0x008d('0x12')]);router[_0x008d('0x13')]('/',auth[_0x008d('0xa')](),controller['create']);router['post'](_0x008d('0xf'),auth[_0x008d('0xa')](),controller[_0x008d('0x14')]);router[_0x008d('0x15')](_0x008d('0xd'),auth[_0x008d('0xa')](),controller['update']);router[_0x008d('0x16')](_0x008d('0xd'),auth[_0x008d('0xa')](),controller[_0x008d('0x17')]);module[_0x008d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4ae387f..9237ab6 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 _0x379d=['sequelize','exports','STRING','username'];(function(_0x2c26ef,_0x540bcb){var _0xefbd60=function(_0x3018b1){while(--_0x3018b1){_0x2c26ef['push'](_0x2c26ef['shift']());}};_0xefbd60(++_0x540bcb);}(_0x379d,0xe0));var _0xd379=function(_0x34ab92,_0x51e5c5){_0x34ab92=_0x34ab92-0x0;var _0x376ac2=_0x379d[_0x34ab92];return _0x376ac2;};'use strict';var Sequelize=require(_0xd379('0x0'));module[_0xd379('0x1')]={'name':{'type':Sequelize[_0xd379('0x2')]},'description':{'type':Sequelize[_0xd379('0x2')]},'username':{'type':Sequelize[_0xd379('0x2')],'unique':_0xd379('0x3')},'password':{'type':Sequelize[_0xd379('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd379('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd379('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb111=['username','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb111,0x189));var _0x1b11=function(_0x32689c,_0x1e5ad2){_0x32689c=_0x32689c-0x0;var _0xce38dd=_0xb111[_0x32689c];return _0xce38dd;};'use strict';var Sequelize=require(_0x1b11('0x0'));module[_0x1b11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1b11('0x2')]},'username':{'type':Sequelize[_0x1b11('0x2')],'unique':_0x1b11('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1b11('0x2')]},'remoteUri':{'type':Sequelize[_0x1b11('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1b11('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 9139d27..f2fb021 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 _0x7c3b=['../../config/logger','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','end','sendStatus','error','stack','name','send','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','order','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','state','sys_created_by','calendar_stc','closed_at','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','false','value','push','eml-format','rimraf','zip-dir','fast-json-patch','path','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7c3b,0x150));var _0xb7c3=function(_0x170229,_0xc6006e){_0x170229=_0x170229-0x0;var _0x50a701=_0x7c3b[_0x170229];return _0x50a701;};'use strict';var emlformat=require(_0xb7c3('0x0'));var rimraf=require(_0xb7c3('0x1'));var zipdir=require(_0xb7c3('0x2'));var jsonpatch=require(_0xb7c3('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(_0xb7c3('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb7c3('0x5'));var fs=require('fs');var fs_extra=require(_0xb7c3('0x6'));var _=require('lodash');var squel=require(_0xb7c3('0x7'));var crypto=require(_0xb7c3('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7c3('0x9'));var querystring=require(_0xb7c3('0xa'));var Papa=require(_0xb7c3('0xb'));var Redis=require(_0xb7c3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xb7c3('0xd'));var as=require(_0xb7c3('0xe'));var hardwareService=require(_0xb7c3('0xf'));var logger=require(_0xb7c3('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb7c3('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7c3('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xed04d1,_0x396a53){_0x396a53=_0x396a53||0xcc;return function(_0x6047e){if(_0x6047e){return _0xed04d1['sendStatus'](_0x396a53);}return _0xed04d1[_0xb7c3('0x13')](_0x396a53)['end']();};}function respondWithResult(_0x5f31d1,_0x2be00b){_0x2be00b=_0x2be00b||0xc8;return function(_0x36e70c){if(_0x36e70c){return _0x5f31d1[_0xb7c3('0x13')](_0x2be00b)[_0xb7c3('0x14')](_0x36e70c);}};}function respondWithFilteredResult(_0x4f774f,_0xf07012){return function(_0x1898b4){if(_0x1898b4){var _0x4aa756=typeof _0xf07012['offset']===_0xb7c3('0x15')&&typeof _0xf07012[_0xb7c3('0x16')]==='undefined';var _0x17e06e=_0x1898b4[_0xb7c3('0x17')];var _0x4dedf7=_0x4aa756?0x0:_0xf07012['offset'];var _0x10434b=_0x4aa756?_0x1898b4[_0xb7c3('0x17')]:_0xf07012[_0xb7c3('0x18')]+_0xf07012['limit'];var _0x197008;if(_0x10434b>=_0x17e06e){_0x10434b=_0x17e06e;_0x197008=0xc8;}else{_0x197008=0xce;}_0x4f774f[_0xb7c3('0x13')](_0x197008);return _0x4f774f[_0xb7c3('0x19')](_0xb7c3('0x1a'),_0x4dedf7+'-'+_0x10434b+'/'+_0x17e06e)['json'](_0x1898b4);}return null;};}function patchUpdates(_0x2fd17d){return function(_0x3d0767){try{jsonpatch['apply'](_0x3d0767,_0x2fd17d,!![]);}catch(_0x5ccae0){return BPromise['reject'](_0x5ccae0);}return _0x3d0767[_0xb7c3('0x1b')]();};}function saveUpdates(_0x257be1,_0x4cec78){return function(_0x2d9fdc){if(_0x2d9fdc){return _0x2d9fdc[_0xb7c3('0x1c')](_0x257be1)['then'](function(_0x2a401c){return _0x2a401c;});}return null;};}function removeEntity(_0x3cb8f5,_0x5c00c4){return function(_0x1a9623){if(_0x1a9623){return _0x1a9623['destroy']()[_0xb7c3('0x1d')](function(){_0x3cb8f5[_0xb7c3('0x13')](0xcc)[_0xb7c3('0x1e')]();});}};}function handleEntityNotFound(_0x5678d8,_0x13528a){return function(_0x45ec40){if(!_0x45ec40){_0x5678d8[_0xb7c3('0x1f')](0x194);}return _0x45ec40;};}function handleError(_0xe0f1a2,_0x4e4890){_0x4e4890=_0x4e4890||0x1f4;return function(_0x2587fe){logger[_0xb7c3('0x20')](_0x2587fe[_0xb7c3('0x21')]);if(_0x2587fe[_0xb7c3('0x22')]){delete _0x2587fe[_0xb7c3('0x22')];}_0xe0f1a2[_0xb7c3('0x13')](_0x4e4890)[_0xb7c3('0x23')](_0x2587fe);};}exports['index']=function(_0x4240d4,_0x3d0e13){var _0x57987d={},_0x3a9caa={},_0x2fffc2={'count':0x0,'rows':[]};var _0x5d4d48=_[_0xb7c3('0x24')](db[_0xb7c3('0x25')][_0xb7c3('0x26')],function(_0x51830f){return{'name':_0x51830f['fieldName'],'type':_0x51830f[_0xb7c3('0x27')]['key']};});_0x3a9caa[_0xb7c3('0x28')]=_['map'](_0x5d4d48,'name');_0x3a9caa[_0xb7c3('0x29')]=_[_0xb7c3('0x2a')](_0x4240d4[_0xb7c3('0x29')]);_0x3a9caa[_0xb7c3('0x2b')]=_[_0xb7c3('0x2c')](_0x3a9caa[_0xb7c3('0x28')],_0x3a9caa[_0xb7c3('0x29')]);_0x57987d[_0xb7c3('0x2d')]=_['intersection'](_0x3a9caa[_0xb7c3('0x28')],qs[_0xb7c3('0x2e')](_0x4240d4[_0xb7c3('0x29')][_0xb7c3('0x2e')]));_0x57987d[_0xb7c3('0x2d')]=_0x57987d[_0xb7c3('0x2d')][_0xb7c3('0x2f')]?_0x57987d['attributes']:_0x3a9caa[_0xb7c3('0x28')];if(!_0x4240d4['query'][_0xb7c3('0x30')](_0xb7c3('0x31'))){_0x57987d[_0xb7c3('0x16')]=qs['limit'](_0x4240d4[_0xb7c3('0x29')][_0xb7c3('0x16')]);_0x57987d[_0xb7c3('0x18')]=qs['offset'](_0x4240d4[_0xb7c3('0x29')][_0xb7c3('0x18')]);}_0x57987d['order']=qs[_0xb7c3('0x32')](_0x4240d4[_0xb7c3('0x29')][_0xb7c3('0x32')]);_0x57987d[_0xb7c3('0x33')]=qs[_0xb7c3('0x2b')](_[_0xb7c3('0x34')](_0x4240d4[_0xb7c3('0x29')],_0x3a9caa[_0xb7c3('0x2b')]),_0x5d4d48);if(_0x4240d4[_0xb7c3('0x29')]['filter']){_0x57987d[_0xb7c3('0x33')]=_[_0xb7c3('0x35')](_0x57987d[_0xb7c3('0x33')],{'$or':_[_0xb7c3('0x24')](_0x5d4d48,function(_0x3e4766){if(_0x3e4766['type']!==_0xb7c3('0x36')){var _0x46fa86={};_0x46fa86[_0x3e4766[_0xb7c3('0x22')]]={'$like':'%'+_0x4240d4[_0xb7c3('0x29')]['filter']+'%'};return _0x46fa86;}})});}_0x57987d=_[_0xb7c3('0x35')]({},_0x57987d,_0x4240d4[_0xb7c3('0x37')]);var _0x5acaee={'where':_0x57987d['where']};return db[_0xb7c3('0x25')][_0xb7c3('0x17')](_0x5acaee)[_0xb7c3('0x1d')](function(_0x1b16e9){_0x2fffc2[_0xb7c3('0x17')]=_0x1b16e9;if(_0x4240d4[_0xb7c3('0x29')]['includeAll']){_0x57987d['include']=[{'all':!![]}];}return db[_0xb7c3('0x25')][_0xb7c3('0x38')](_0x57987d);})[_0xb7c3('0x1d')](function(_0x3bd192){_0x2fffc2[_0xb7c3('0x39')]=_0x3bd192;return _0x2fffc2;})[_0xb7c3('0x1d')](respondWithFilteredResult(_0x3d0e13,_0x57987d))[_0xb7c3('0x3a')](handleError(_0x3d0e13,null));};exports[_0xb7c3('0x3b')]=function(_0x324a27,_0x19234a){var _0x2d0110={'raw':![],'where':{'id':_0x324a27[_0xb7c3('0x3c')]['id']}},_0x5ebdb9={};_0x5ebdb9[_0xb7c3('0x28')]=_[_0xb7c3('0x2a')](db['ServicenowAccount'][_0xb7c3('0x26')]);_0x5ebdb9[_0xb7c3('0x29')]=_[_0xb7c3('0x2a')](_0x324a27[_0xb7c3('0x29')]);_0x5ebdb9[_0xb7c3('0x2b')]=_[_0xb7c3('0x2c')](_0x5ebdb9[_0xb7c3('0x28')],_0x5ebdb9[_0xb7c3('0x29')]);_0x2d0110[_0xb7c3('0x2d')]=_['intersection'](_0x5ebdb9[_0xb7c3('0x28')],qs[_0xb7c3('0x2e')](_0x324a27[_0xb7c3('0x29')][_0xb7c3('0x2e')]));_0x2d0110[_0xb7c3('0x2d')]=_0x2d0110['attributes'][_0xb7c3('0x2f')]?_0x2d0110[_0xb7c3('0x2d')]:_0x5ebdb9[_0xb7c3('0x28')];if(_0x324a27[_0xb7c3('0x29')][_0xb7c3('0x3d')]){_0x2d0110['include']=[{'all':!![]}];}_0x2d0110=_[_0xb7c3('0x35')]({},_0x2d0110,_0x324a27[_0xb7c3('0x37')]);return db[_0xb7c3('0x25')]['find'](_0x2d0110)['then'](handleEntityNotFound(_0x19234a,null))[_0xb7c3('0x1d')](respondWithResult(_0x19234a,null))[_0xb7c3('0x3a')](handleError(_0x19234a,null));};exports['create']=function(_0x3efc4c,_0xfb8064){return db['ServicenowAccount'][_0xb7c3('0x3e')](_0x3efc4c['body'],{})[_0xb7c3('0x1d')](respondWithResult(_0xfb8064,0xc9))[_0xb7c3('0x3a')](handleError(_0xfb8064,null));};exports[_0xb7c3('0x1c')]=function(_0x5ba268,_0xfb2488){if(_0x5ba268[_0xb7c3('0x3f')]['id']){delete _0x5ba268['body']['id'];}return db[_0xb7c3('0x25')]['find']({'where':{'id':_0x5ba268[_0xb7c3('0x3c')]['id']}})[_0xb7c3('0x1d')](handleEntityNotFound(_0xfb2488,null))[_0xb7c3('0x1d')](saveUpdates(_0x5ba268[_0xb7c3('0x3f')],null))[_0xb7c3('0x1d')](respondWithResult(_0xfb2488,null))[_0xb7c3('0x3a')](handleError(_0xfb2488,null));};exports['destroy']=function(_0x3a40fb,_0x48edbc){return db[_0xb7c3('0x25')][_0xb7c3('0x40')]({'where':{'id':_0x3a40fb['params']['id']}})[_0xb7c3('0x1d')](handleEntityNotFound(_0x48edbc,null))[_0xb7c3('0x1d')](removeEntity(_0x48edbc,null))[_0xb7c3('0x3a')](handleError(_0x48edbc,null));};exports[_0xb7c3('0x41')]=function(_0x6ef057,_0x3c825a,_0x16dbd){var _0x339f30={};var _0xe89759={};var _0x147c34;var _0x28bdac;return db[_0xb7c3('0x25')][_0xb7c3('0x42')]({'where':{'id':_0x6ef057[_0xb7c3('0x3c')]['id']}})[_0xb7c3('0x1d')](handleEntityNotFound(_0x3c825a,null))['then'](function(_0x2663fd){if(_0x2663fd){_0x147c34=_0x2663fd;_0xe89759[_0xb7c3('0x28')]=_['keys'](db['ServicenowConfiguration'][_0xb7c3('0x26')]);_0xe89759[_0xb7c3('0x29')]=_[_0xb7c3('0x2a')](_0x6ef057[_0xb7c3('0x29')]);_0xe89759[_0xb7c3('0x2b')]=_[_0xb7c3('0x2c')](_0xe89759[_0xb7c3('0x28')],_0xe89759[_0xb7c3('0x29')]);_0x339f30[_0xb7c3('0x2d')]=_[_0xb7c3('0x2c')](_0xe89759['model'],qs[_0xb7c3('0x2e')](_0x6ef057[_0xb7c3('0x29')][_0xb7c3('0x2e')]));_0x339f30[_0xb7c3('0x2d')]=_0x339f30[_0xb7c3('0x2d')][_0xb7c3('0x2f')]?_0x339f30[_0xb7c3('0x2d')]:_0xe89759[_0xb7c3('0x28')];_0x339f30[_0xb7c3('0x43')]=qs[_0xb7c3('0x32')](_0x6ef057[_0xb7c3('0x29')][_0xb7c3('0x32')]);_0x339f30[_0xb7c3('0x33')]=qs[_0xb7c3('0x2b')](_['pick'](_0x6ef057[_0xb7c3('0x29')],_0xe89759[_0xb7c3('0x2b')]));if(_0x6ef057[_0xb7c3('0x29')][_0xb7c3('0x44')]){_0x339f30[_0xb7c3('0x33')]=_[_0xb7c3('0x35')](_0x339f30[_0xb7c3('0x33')],{'$or':_[_0xb7c3('0x24')](_0x339f30[_0xb7c3('0x2d')],function(_0x560374){var _0x512772={};_0x512772[_0x560374]={'$like':'%'+_0x6ef057['query']['filter']+'%'};return _0x512772;})});}_0x339f30=_[_0xb7c3('0x35')]({},_0x339f30,_0x6ef057[_0xb7c3('0x37')]);return _0x147c34[_0xb7c3('0x41')](_0x339f30);}})[_0xb7c3('0x1d')](function(_0x48b44c){if(_0x48b44c){_0x28bdac=_0x48b44c[_0xb7c3('0x2f')];if(!_0x6ef057['query'][_0xb7c3('0x30')](_0xb7c3('0x31'))){_0x339f30['limit']=qs[_0xb7c3('0x16')](_0x6ef057[_0xb7c3('0x29')][_0xb7c3('0x16')]);_0x339f30[_0xb7c3('0x18')]=qs[_0xb7c3('0x18')](_0x6ef057[_0xb7c3('0x29')][_0xb7c3('0x18')]);}return _0x147c34[_0xb7c3('0x41')](_0x339f30);}})[_0xb7c3('0x1d')](function(_0x63ce6f){if(_0x63ce6f){return _0x63ce6f?{'count':_0x28bdac,'rows':_0x63ce6f}:null;}})[_0xb7c3('0x1d')](respondWithResult(_0x3c825a,null))[_0xb7c3('0x3a')](handleError(_0x3c825a,null));};exports[_0xb7c3('0x45')]=function(_0x21ec21,_0xf8bfbd,_0x13ece4){if(_0x21ec21[_0xb7c3('0x3f')]['id']){delete _0x21ec21['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x21ec21[_0xb7c3('0x3c')]['id']}})[_0xb7c3('0x1d')](handleEntityNotFound(_0xf8bfbd,null))[_0xb7c3('0x1d')](function(_0x40bc57){if(_0x40bc57){_0x21ec21[_0xb7c3('0x3f')][_0xb7c3('0x46')]=_0x40bc57['id'];_0x21ec21[_0xb7c3('0x3f')]['Subjects']=integrations[_0xb7c3('0x47')](_0x21ec21[_0xb7c3('0x3f')][_0xb7c3('0x48')],_0x21ec21['body'][_0xb7c3('0x27')]);_0x21ec21['body'][_0xb7c3('0x49')]=integrations[_0xb7c3('0x4a')](_0x21ec21[_0xb7c3('0x3f')][_0xb7c3('0x48')],_0x21ec21[_0xb7c3('0x3f')][_0xb7c3('0x27')]);return db[_0xb7c3('0x4b')]['create'](_0x21ec21['body'],{'include':[{'model':db[_0xb7c3('0x4c')],'as':_0xb7c3('0x4d')},{'model':db[_0xb7c3('0x4c')],'as':_0xb7c3('0x49')}]});}return null;})[_0xb7c3('0x1d')](respondWithResult(_0xf8bfbd,null))[_0xb7c3('0x3a')](handleError(_0xf8bfbd,null));};exports[_0xb7c3('0x4e')]=function(_0x434fbe,_0x2fd175,_0x3e8b5a){var _0x8f9d9=['made_sla',_0xb7c3('0x4f'),_0xb7c3('0x50'),_0xb7c3('0x51'),_0xb7c3('0x52'),_0xb7c3('0x53'),_0xb7c3('0x54'),_0xb7c3('0x55'),'category'];var _0x4cbb2b=[_0xb7c3('0x56'),_0xb7c3('0x57'),_0xb7c3('0x58'),_0xb7c3('0x59'),_0xb7c3('0x5a'),_0xb7c3('0x5b'),_0xb7c3('0x5c'),'hold_reason',_0xb7c3('0x5d'),_0xb7c3('0x5e'),'resolved_by',_0xb7c3('0x5f'),_0xb7c3('0x60'),_0xb7c3('0x61'),'sys_created_on','sys_domain',_0xb7c3('0x62'),_0xb7c3('0x63'),_0xb7c3('0x50'),_0xb7c3('0x43'),_0xb7c3('0x64'),_0xb7c3('0x65'),'cmdb_ci','delivery_plan',_0xb7c3('0x66'),_0xb7c3('0x67'),_0xb7c3('0x68'),'business_service','priority',_0xb7c3('0x69'),_0xb7c3('0x6a'),_0xb7c3('0x6b'),'expected_start',_0xb7c3('0x6c'),_0xb7c3('0x6d'),_0xb7c3('0x6e'),_0xb7c3('0x6f'),_0xb7c3('0x70'),'resolved_at',_0xb7c3('0x71'),_0xb7c3('0x72'),_0xb7c3('0x51'),_0xb7c3('0x73'),_0xb7c3('0x74'),_0xb7c3('0x52'),'correlation_display',_0xb7c3('0x75'),_0xb7c3('0x76'),_0xb7c3('0x77'),_0xb7c3('0x78'),_0xb7c3('0x79'),_0xb7c3('0x7a'),_0xb7c3('0x7b'),_0xb7c3('0x53'),'sys_class_name','close_notes','closed_by',_0xb7c3('0x7c'),_0xb7c3('0x7d'),'sys_id',_0xb7c3('0x7e'),_0xb7c3('0x7f'),_0xb7c3('0x54'),_0xb7c3('0x80'),'problem_id',_0xb7c3('0x81'),_0xb7c3('0x82'),'activity_due','assigned_to',_0xb7c3('0x55'),_0xb7c3('0x83'),'sla_due',_0xb7c3('0x84'),_0xb7c3('0x85'),_0xb7c3('0x86'),_0xb7c3('0x87'),_0xb7c3('0x88'),_0xb7c3('0x89'),'escalation',_0xb7c3('0x8a'),_0xb7c3('0x8b'),_0xb7c3('0x8c'),_0xb7c3('0x8d')];var _0x477437='';var _0x432d76='';var _0x5b7c8f=[];var _0x177f9a='';var _0x5b8740='';var _0x4fd72f=[];var _0x2130e9='';var _0x232c34='';var _0x5baaa7={};var _0x3569ac='';return db[_0xb7c3('0x25')][_0xb7c3('0x42')]({'where':{'id':_0x434fbe[_0xb7c3('0x3c')]['id']},'attributes':['id',_0xb7c3('0x8e'),_0xb7c3('0x8f'),_0xb7c3('0x90'),_0xb7c3('0x91'),_0xb7c3('0x92')]})[_0xb7c3('0x1d')](handleEntityNotFound(_0x2fd175,null))[_0xb7c3('0x1d')](function(_0x313077){if(_0x313077){_0x3569ac=_0x313077[_0xb7c3('0x91')];var _0x51d150=_0x3569ac[_0xb7c3('0x93')](-0x1);if(_0x51d150==='/'){_0x3569ac=_0x3569ac[_0xb7c3('0x94')](0x0,_0x3569ac[_0xb7c3('0x95')](_0x51d150));}_0x232c34=util[_0xb7c3('0x96')]('%s/api/now/doc/table/schema/',_0x3569ac);_0x2130e9=util[_0xb7c3('0x96')]('%s/api/now/table/',_0x3569ac);_0x5baaa7={'user':_0x313077['username'],'pass':_0x313077[_0xb7c3('0x8f')]};var _0x1d3ab0={'method':_0xb7c3('0x97'),'uri':_0x232c34+_0xb7c3('0x98'),'auth':_0x5baaa7,'json':!![]};return rp(_0x1d3ab0);}})['then'](function(_0x441966){if(_0x441966[_0xb7c3('0x99')]['length']>0x0){_0x477437=_0x441966[_0xb7c3('0x99')];}console[_0xb7c3('0x9a')](_0xb7c3('0x9b'),_0x477437);_0x4fd72f=[];_0x432d76=Object[_0xb7c3('0x9c')]([],_0x477437);_[_0xb7c3('0x9d')](_0x432d76,function(_0x5e3ac0){return!_0x8f9d9[_0xb7c3('0x9e')](_0x5e3ac0[_0xb7c3('0x22')]);});_0x432d76[_0xb7c3('0x9f')](function(_0x2282c3){var _0x59baea=createFieldObject(_0x2130e9,_0x5baaa7,_0x2282c3['internalType'],_0x2282c3[_0xb7c3('0x22')],_0x2282c3['label'],![]);_0x4fd72f['push'](_0x59baea);});return Promise[_0xb7c3('0xa0')](_0x4fd72f);})['then'](function(_0x4c7889){_0x5b7c8f=_0x4c7889;_0x177f9a=Object[_0xb7c3('0x9c')]([],_0x477437);console['log'](_0xb7c3('0xa1'),_0x477437);_[_0xb7c3('0x9d')](_0x177f9a,function(_0x2578cd){return _0x4cbb2b[_0xb7c3('0x9e')](_0x2578cd['name']);});console[_0xb7c3('0x9a')](_0xb7c3('0xa2'),_0x177f9a);_0x4fd72f=[];_0x177f9a[_0xb7c3('0x9f')](function(_0x6c90e){var _0x19bbe9=createFieldObject(_0x2130e9,_0x5baaa7,_0x6c90e[_0xb7c3('0xa3')],_0x6c90e[_0xb7c3('0x22')],_0x6c90e[_0xb7c3('0xa4')],!![]);_0x4fd72f['push'](_0x19bbe9);});return Promise['all'](_0x4fd72f);})[_0xb7c3('0x1d')](function(_0x155579){_0x5b8740=_0x155579;var _0x6e7b80=_0x5b7c8f[_0xb7c3('0xa5')](_0x5b8740);return{'count':_0x6e7b80['length'],'rows':_0x6e7b80};})[_0xb7c3('0x1d')](respondWithResult(_0x2fd175,null))[_0xb7c3('0x3a')](function(_0x55e2e7){console[_0xb7c3('0x9a')](_0xb7c3('0xa6')+_0x55e2e7);var _0x3d8360=_0x434fbe[_0xb7c3('0x29')][_0xb7c3('0xa7')]?0x1f4:_0x55e2e7[_0xb7c3('0xa8')]||0x1f4;logger[_0xb7c3('0x20')](_0x55e2e7[_0xb7c3('0x21')]);delete _0x55e2e7[_0xb7c3('0x22')];if(_0x3d8360===0x191){_0x3d8360=0x190;}_0x2fd175[_0xb7c3('0x13')](_0x3d8360)['send'](_0x434fbe['query'][_0xb7c3('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x55e2e7['statusCode']}:_0x55e2e7);});};function createFieldObject(_0x51597d,_0x6d33ef,_0x4844e4,_0x14bcaf,_0x5a4973,_0x170c07){return new Promise(function(_0x193cd3,_0x33e631){var _0x1745e5={'id':_0x14bcaf,'name':_0x5a4973,'custom':_0x170c07};if(_0x4844e4===_0xb7c3('0xa9')){_0x1745e5[_0xb7c3('0x37')]=[{'name':_0xb7c3('0xaa'),'value':_0xb7c3('0xab')},{'name':'False','value':'false'}];_0x193cd3(_0x1745e5);}else{var _0x114cfb={'method':_0xb7c3('0x97'),'uri':_0x51597d+_0xb7c3('0xac')+_0x14bcaf,'auth':_0x6d33ef,'json':!![]};return rp(_0x114cfb)[_0xb7c3('0x1d')](function(_0xcc2f08){var _0x4adf7d=[];if(_0xcc2f08[_0xb7c3('0x99')][_0xb7c3('0x2f')]>0x0){_0xcc2f08[_0xb7c3('0x99')][_0xb7c3('0x9f')](function(_0x240a6c){if(_0x240a6c['inactive']===_0xb7c3('0xad')){var _0x219882={'name':_0x240a6c[_0xb7c3('0xa4')],'value':_0x240a6c[_0xb7c3('0xae')]};_0x4adf7d[_0xb7c3('0xaf')](_0x219882);}});}_0x1745e5[_0xb7c3('0x37')]=_0x4adf7d;if(_0x1745e5['options']['length']>0x0){_0x193cd3(_0x1745e5);}else{if(_0x170c07==![]){_0x193cd3();}else{_0x193cd3(_0x1745e5);}}});}});} \ No newline at end of file +var _0x52e3=['offset','undefined','count','limit','set','json','reject','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','filters','fields','includeAll','options','find','create','body','update','params','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','description','calendar_duration','closed_by','parent_incident','sys_id','reopened_by','urgency','company','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','remoteUri','serverUrl','substring','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','internalType','label','assign','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x4791c6,_0x293adf){var _0x52b5d3=function(_0x172af3){while(--_0x172af3){_0x4791c6['push'](_0x4791c6['shift']());}};_0x52b5d3(++_0x293adf);}(_0x52e3,0x1f1));var _0x352e=function(_0x58b0e3,_0x90a544){_0x58b0e3=_0x58b0e3-0x0;var _0x2e7940=_0x52e3[_0x58b0e3];return _0x2e7940;};'use strict';var emlformat=require(_0x352e('0x0'));var rimraf=require(_0x352e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x352e('0x2'));var rp=require(_0x352e('0x3'));var moment=require(_0x352e('0x4'));var BPromise=require(_0x352e('0x5'));var Mustache=require(_0x352e('0x6'));var util=require(_0x352e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x352e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x352e('0x9'));var _=require('lodash');var squel=require(_0x352e('0xa'));var crypto=require(_0x352e('0xb'));var jsforce=require(_0x352e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x352e('0x8'));var querystring=require(_0x352e('0xd'));var Papa=require(_0x352e('0xe'));var Redis=require(_0x352e('0xf'));var authService=require(_0x352e('0x10'));var qs=require(_0x352e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x352e('0x12'))(_0x352e('0x13'));var utils=require(_0x352e('0x14'));var config=require(_0x352e('0x15'));var licenseUtil=require(_0x352e('0x16'));var db=require(_0x352e('0x17'))['db'];var integrations=require(_0x352e('0x18'));function respondWithStatusCode(_0x47c9ca,_0x20dbc9){_0x20dbc9=_0x20dbc9||0xcc;return function(_0x3c24e5){if(_0x3c24e5){return _0x47c9ca[_0x352e('0x19')](_0x20dbc9);}return _0x47c9ca[_0x352e('0x1a')](_0x20dbc9)[_0x352e('0x1b')]();};}function respondWithResult(_0x364766,_0x3efca0){_0x3efca0=_0x3efca0||0xc8;return function(_0x1d3217){if(_0x1d3217){return _0x364766[_0x352e('0x1a')](_0x3efca0)['json'](_0x1d3217);}};}function respondWithFilteredResult(_0x3aae32,_0x4c268b){return function(_0x4b6bdb){if(_0x4b6bdb){var _0x44fce0=typeof _0x4c268b[_0x352e('0x1c')]===_0x352e('0x1d')&&typeof _0x4c268b['limit']==='undefined';var _0x496a0f=_0x4b6bdb[_0x352e('0x1e')];var _0x2280ac=_0x44fce0?0x0:_0x4c268b[_0x352e('0x1c')];var _0x34974b=_0x44fce0?_0x4b6bdb[_0x352e('0x1e')]:_0x4c268b['offset']+_0x4c268b[_0x352e('0x1f')];var _0x6fb898;if(_0x34974b>=_0x496a0f){_0x34974b=_0x496a0f;_0x6fb898=0xc8;}else{_0x6fb898=0xce;}_0x3aae32[_0x352e('0x1a')](_0x6fb898);return _0x3aae32[_0x352e('0x20')]('Content-Range',_0x2280ac+'-'+_0x34974b+'/'+_0x496a0f)[_0x352e('0x21')](_0x4b6bdb);}return null;};}function patchUpdates(_0x56fb18){return function(_0x16a496){try{jsonpatch['apply'](_0x16a496,_0x56fb18,!![]);}catch(_0x3a21a3){return BPromise[_0x352e('0x22')](_0x3a21a3);}return _0x16a496['save']();};}function saveUpdates(_0x8dc9f2,_0x38520c){return function(_0xb61e4d){if(_0xb61e4d){return _0xb61e4d['update'](_0x8dc9f2)[_0x352e('0x23')](function(_0x31b772){return _0x31b772;});}return null;};}function removeEntity(_0x554777,_0x5d5c2d){return function(_0x103fe4){if(_0x103fe4){return _0x103fe4[_0x352e('0x24')]()[_0x352e('0x23')](function(){_0x554777[_0x352e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6e15,_0x3b0e58){return function(_0x4fe308){if(!_0x4fe308){_0x3b6e15['sendStatus'](0x194);}return _0x4fe308;};}function handleError(_0xa6cc96,_0x35f685){_0x35f685=_0x35f685||0x1f4;return function(_0x528734){logger[_0x352e('0x25')](_0x528734[_0x352e('0x26')]);if(_0x528734['name']){delete _0x528734[_0x352e('0x27')];}_0xa6cc96[_0x352e('0x1a')](_0x35f685)[_0x352e('0x28')](_0x528734);};}exports[_0x352e('0x29')]=function(_0x49a7ce,_0x544c5e){var _0xd6b12b={},_0x1372b9={},_0x461fa6={'count':0x0,'rows':[]};var _0x1a4986=_[_0x352e('0x2a')](db[_0x352e('0x2b')][_0x352e('0x2c')],function(_0x8b183e){return{'name':_0x8b183e['fieldName'],'type':_0x8b183e[_0x352e('0x2d')]['key']};});_0x1372b9[_0x352e('0x2e')]=_['map'](_0x1a4986,_0x352e('0x27'));_0x1372b9[_0x352e('0x2f')]=_[_0x352e('0x30')](_0x49a7ce[_0x352e('0x2f')]);_0x1372b9['filters']=_[_0x352e('0x31')](_0x1372b9[_0x352e('0x2e')],_0x1372b9[_0x352e('0x2f')]);_0xd6b12b['attributes']=_[_0x352e('0x31')](_0x1372b9[_0x352e('0x2e')],qs['fields'](_0x49a7ce[_0x352e('0x2f')]['fields']));_0xd6b12b[_0x352e('0x32')]=_0xd6b12b[_0x352e('0x32')][_0x352e('0x33')]?_0xd6b12b[_0x352e('0x32')]:_0x1372b9[_0x352e('0x2e')];if(!_0x49a7ce[_0x352e('0x2f')][_0x352e('0x34')](_0x352e('0x35'))){_0xd6b12b[_0x352e('0x1f')]=qs['limit'](_0x49a7ce[_0x352e('0x2f')][_0x352e('0x1f')]);_0xd6b12b[_0x352e('0x1c')]=qs[_0x352e('0x1c')](_0x49a7ce['query'][_0x352e('0x1c')]);}_0xd6b12b[_0x352e('0x36')]=qs['sort'](_0x49a7ce[_0x352e('0x2f')][_0x352e('0x37')]);_0xd6b12b[_0x352e('0x38')]=qs['filters'](_[_0x352e('0x39')](_0x49a7ce['query'],_0x1372b9['filters']),_0x1a4986);if(_0x49a7ce[_0x352e('0x2f')]['filter']){_0xd6b12b[_0x352e('0x38')]=_[_0x352e('0x3a')](_0xd6b12b['where'],{'$or':_[_0x352e('0x2a')](_0x1a4986,function(_0x10be73){if(_0x10be73[_0x352e('0x2d')]!==_0x352e('0x3b')){var _0x2ec1b0={};_0x2ec1b0[_0x10be73[_0x352e('0x27')]]={'$like':'%'+_0x49a7ce[_0x352e('0x2f')][_0x352e('0x3c')]+'%'};return _0x2ec1b0;}})});}_0xd6b12b=_[_0x352e('0x3a')]({},_0xd6b12b,_0x49a7ce['options']);var _0xa1b08b={'where':_0xd6b12b[_0x352e('0x38')]};return db[_0x352e('0x2b')]['count'](_0xa1b08b)[_0x352e('0x23')](function(_0x3b7624){_0x461fa6['count']=_0x3b7624;if(_0x49a7ce[_0x352e('0x2f')]['includeAll']){_0xd6b12b[_0x352e('0x3d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x352e('0x3e')](_0xd6b12b);})[_0x352e('0x23')](function(_0x41093a){_0x461fa6['rows']=_0x41093a;return _0x461fa6;})[_0x352e('0x23')](respondWithFilteredResult(_0x544c5e,_0xd6b12b))[_0x352e('0x3f')](handleError(_0x544c5e,null));};exports[_0x352e('0x40')]=function(_0x49dc26,_0x3d1121){var _0x2ba7e1={'raw':![],'where':{'id':_0x49dc26['params']['id']}},_0x4ab2cb={};_0x4ab2cb[_0x352e('0x2e')]=_['keys'](db[_0x352e('0x2b')]['rawAttributes']);_0x4ab2cb[_0x352e('0x2f')]=_['keys'](_0x49dc26[_0x352e('0x2f')]);_0x4ab2cb[_0x352e('0x41')]=_[_0x352e('0x31')](_0x4ab2cb['model'],_0x4ab2cb[_0x352e('0x2f')]);_0x2ba7e1[_0x352e('0x32')]=_[_0x352e('0x31')](_0x4ab2cb[_0x352e('0x2e')],qs[_0x352e('0x42')](_0x49dc26['query'][_0x352e('0x42')]));_0x2ba7e1['attributes']=_0x2ba7e1['attributes'][_0x352e('0x33')]?_0x2ba7e1[_0x352e('0x32')]:_0x4ab2cb[_0x352e('0x2e')];if(_0x49dc26[_0x352e('0x2f')][_0x352e('0x43')]){_0x2ba7e1['include']=[{'all':!![]}];}_0x2ba7e1=_[_0x352e('0x3a')]({},_0x2ba7e1,_0x49dc26[_0x352e('0x44')]);return db[_0x352e('0x2b')][_0x352e('0x45')](_0x2ba7e1)[_0x352e('0x23')](handleEntityNotFound(_0x3d1121,null))['then'](respondWithResult(_0x3d1121,null))[_0x352e('0x3f')](handleError(_0x3d1121,null));};exports[_0x352e('0x46')]=function(_0x364eee,_0x47645c){return db[_0x352e('0x2b')][_0x352e('0x46')](_0x364eee[_0x352e('0x47')],{})['then'](respondWithResult(_0x47645c,0xc9))[_0x352e('0x3f')](handleError(_0x47645c,null));};exports[_0x352e('0x48')]=function(_0x2ab56a,_0x2cf000){if(_0x2ab56a['body']['id']){delete _0x2ab56a[_0x352e('0x47')]['id'];}return db[_0x352e('0x2b')][_0x352e('0x45')]({'where':{'id':_0x2ab56a[_0x352e('0x49')]['id']}})[_0x352e('0x23')](handleEntityNotFound(_0x2cf000,null))[_0x352e('0x23')](saveUpdates(_0x2ab56a[_0x352e('0x47')],null))[_0x352e('0x23')](respondWithResult(_0x2cf000,null))['catch'](handleError(_0x2cf000,null));};exports[_0x352e('0x24')]=function(_0x3071d3,_0x2ac4a7){return db[_0x352e('0x2b')][_0x352e('0x45')]({'where':{'id':_0x3071d3['params']['id']}})[_0x352e('0x23')](handleEntityNotFound(_0x2ac4a7,null))[_0x352e('0x23')](removeEntity(_0x2ac4a7,null))[_0x352e('0x3f')](handleError(_0x2ac4a7,null));};exports[_0x352e('0x4a')]=function(_0x492ca4,_0x4eb01d,_0x57aa70){var _0x166110={};var _0x3e2147={};var _0x5d4685;var _0x148631;return db[_0x352e('0x2b')][_0x352e('0x4b')]({'where':{'id':_0x492ca4[_0x352e('0x49')]['id']}})[_0x352e('0x23')](handleEntityNotFound(_0x4eb01d,null))[_0x352e('0x23')](function(_0x441386){if(_0x441386){_0x5d4685=_0x441386;_0x3e2147[_0x352e('0x2e')]=_[_0x352e('0x30')](db[_0x352e('0x4c')][_0x352e('0x2c')]);_0x3e2147[_0x352e('0x2f')]=_[_0x352e('0x30')](_0x492ca4['query']);_0x3e2147[_0x352e('0x41')]=_[_0x352e('0x31')](_0x3e2147[_0x352e('0x2e')],_0x3e2147[_0x352e('0x2f')]);_0x166110[_0x352e('0x32')]=_['intersection'](_0x3e2147[_0x352e('0x2e')],qs[_0x352e('0x42')](_0x492ca4[_0x352e('0x2f')][_0x352e('0x42')]));_0x166110['attributes']=_0x166110['attributes'][_0x352e('0x33')]?_0x166110[_0x352e('0x32')]:_0x3e2147[_0x352e('0x2e')];_0x166110[_0x352e('0x36')]=qs[_0x352e('0x37')](_0x492ca4[_0x352e('0x2f')][_0x352e('0x37')]);_0x166110[_0x352e('0x38')]=qs[_0x352e('0x41')](_[_0x352e('0x39')](_0x492ca4[_0x352e('0x2f')],_0x3e2147[_0x352e('0x41')]));if(_0x492ca4['query']['filter']){_0x166110[_0x352e('0x38')]=_['merge'](_0x166110['where'],{'$or':_[_0x352e('0x2a')](_0x166110[_0x352e('0x32')],function(_0xbe0959){var _0x33a8c4={};_0x33a8c4[_0xbe0959]={'$like':'%'+_0x492ca4[_0x352e('0x2f')]['filter']+'%'};return _0x33a8c4;})});}_0x166110=_[_0x352e('0x3a')]({},_0x166110,_0x492ca4[_0x352e('0x44')]);return _0x5d4685['getConfigurations'](_0x166110);}})[_0x352e('0x23')](function(_0x4dc005){if(_0x4dc005){_0x148631=_0x4dc005[_0x352e('0x33')];if(!_0x492ca4[_0x352e('0x2f')][_0x352e('0x34')](_0x352e('0x35'))){_0x166110[_0x352e('0x1f')]=qs[_0x352e('0x1f')](_0x492ca4[_0x352e('0x2f')][_0x352e('0x1f')]);_0x166110[_0x352e('0x1c')]=qs['offset'](_0x492ca4[_0x352e('0x2f')][_0x352e('0x1c')]);}return _0x5d4685[_0x352e('0x4a')](_0x166110);}})[_0x352e('0x23')](function(_0x22d852){if(_0x22d852){return _0x22d852?{'count':_0x148631,'rows':_0x22d852}:null;}})[_0x352e('0x23')](respondWithResult(_0x4eb01d,null))[_0x352e('0x3f')](handleError(_0x4eb01d,null));};exports['addConfiguration']=function(_0x473bef,_0x2b4e1a,_0x225aae){if(_0x473bef['body']['id']){delete _0x473bef[_0x352e('0x47')]['id'];}return db['ServicenowAccount'][_0x352e('0x4b')]({'where':{'id':_0x473bef[_0x352e('0x49')]['id']}})[_0x352e('0x23')](handleEntityNotFound(_0x2b4e1a,null))['then'](function(_0x39ea26){if(_0x39ea26){_0x473bef[_0x352e('0x47')][_0x352e('0x4d')]=_0x39ea26['id'];_0x473bef[_0x352e('0x47')][_0x352e('0x4e')]=integrations[_0x352e('0x4f')](_0x473bef['body'][_0x352e('0x50')],_0x473bef[_0x352e('0x47')][_0x352e('0x2d')]);_0x473bef[_0x352e('0x47')][_0x352e('0x51')]=integrations[_0x352e('0x52')](_0x473bef[_0x352e('0x47')][_0x352e('0x50')],_0x473bef[_0x352e('0x47')]['type']);return db[_0x352e('0x4c')][_0x352e('0x46')](_0x473bef[_0x352e('0x47')],{'include':[{'model':db[_0x352e('0x53')],'as':_0x352e('0x4e')},{'model':db[_0x352e('0x53')],'as':_0x352e('0x51')}]});}return null;})[_0x352e('0x23')](respondWithResult(_0x2b4e1a,null))[_0x352e('0x3f')](handleError(_0x2b4e1a,null));};exports[_0x352e('0x54')]=function(_0x98dd1a,_0x509cd5,_0x21de44){var _0xe873d9=['made_sla','hold_reason',_0x352e('0x55'),_0x352e('0x56'),_0x352e('0x57'),_0x352e('0x58'),_0x352e('0x59'),'severity',_0x352e('0x5a')];var _0x53f44f=[_0x352e('0x5b'),_0x352e('0x5c'),'caused_by','watch_list','upon_reject',_0x352e('0x5d'),_0x352e('0x5e'),'hold_reason',_0x352e('0x5f'),_0x352e('0x60'),_0x352e('0x61'),_0x352e('0x62'),_0x352e('0x63'),_0x352e('0x64'),'sys_created_on',_0x352e('0x65'),_0x352e('0x66'),_0x352e('0x67'),_0x352e('0x55'),_0x352e('0x36'),_0x352e('0x68'),_0x352e('0x69'),_0x352e('0x6a'),_0x352e('0x6b'),'impact',_0x352e('0x6c'),_0x352e('0x6d'),_0x352e('0x6e'),_0x352e('0x6f'),_0x352e('0x70'),_0x352e('0x71'),'time_worked',_0x352e('0x72'),'opened_at',_0x352e('0x73'),_0x352e('0x74'),_0x352e('0x75'),'reopened_time','resolved_at',_0x352e('0x76'),_0x352e('0x77'),_0x352e('0x56'),_0x352e('0x78'),_0x352e('0x79'),'close_code',_0x352e('0x7a'),_0x352e('0x7b'),_0x352e('0x7c'),'assignment_group',_0x352e('0x7d'),'additional_assignee_list',_0x352e('0x7e'),_0x352e('0x7f'),'notify','sys_class_name','close_notes',_0x352e('0x80'),'follow_up',_0x352e('0x81'),_0x352e('0x82'),'contact_type',_0x352e('0x83'),_0x352e('0x59'),_0x352e('0x84'),'problem_id',_0x352e('0x85'),'reassignment_count','activity_due','assigned_to','severity','comments',_0x352e('0x86'),_0x352e('0x87'),_0x352e('0x88'),_0x352e('0x89'),_0x352e('0x8a'),_0x352e('0x8b'),'sys_tags',_0x352e('0x8c'),'upon_approval',_0x352e('0x8d'),_0x352e('0x8e'),_0x352e('0x5a')];var _0x2db527='';var _0x431dac='';var _0x3f9791=[];var _0x53fce1='';var _0x3c0f6e='';var _0x5ed31d=[];var _0x5db6d0='';var _0x21d865='';var _0x187288={};var _0x5d424f='';return db['ServicenowAccount'][_0x352e('0x4b')]({'where':{'id':_0x98dd1a['params']['id']},'attributes':['id',_0x352e('0x8f'),_0x352e('0x90'),'email',_0x352e('0x91'),_0x352e('0x92')]})['then'](handleEntityNotFound(_0x509cd5,null))[_0x352e('0x23')](function(_0x5d7374){if(_0x5d7374){_0x5d424f=_0x5d7374[_0x352e('0x91')];var _0x4a7f11=_0x5d424f['slice'](-0x1);if(_0x4a7f11==='/'){_0x5d424f=_0x5d424f[_0x352e('0x93')](0x0,_0x5d424f['lastIndexOf'](_0x4a7f11));}_0x21d865=util['format'](_0x352e('0x94'),_0x5d424f);_0x5db6d0=util[_0x352e('0x95')]('%s/api/now/table/',_0x5d424f);_0x187288={'user':_0x5d7374[_0x352e('0x8f')],'pass':_0x5d7374[_0x352e('0x90')]};var _0x472bd6={'method':_0x352e('0x96'),'uri':_0x21d865+_0x352e('0x97'),'auth':_0x187288,'json':!![]};return rp(_0x472bd6);}})['then'](function(_0x463773){if(_0x463773[_0x352e('0x98')][_0x352e('0x33')]>0x0){_0x2db527=_0x463773[_0x352e('0x98')];}console['log'](_0x352e('0x99'),_0x2db527);_0x5ed31d=[];_0x431dac=Object['assign']([],_0x2db527);_['remove'](_0x431dac,function(_0x1521a7){return!_0xe873d9[_0x352e('0x9a')](_0x1521a7[_0x352e('0x27')]);});_0x431dac[_0x352e('0x9b')](function(_0x2ff67d){var _0xee8e9e=createFieldObject(_0x5db6d0,_0x187288,_0x2ff67d[_0x352e('0x9c')],_0x2ff67d['name'],_0x2ff67d[_0x352e('0x9d')],![]);_0x5ed31d['push'](_0xee8e9e);});return Promise['all'](_0x5ed31d);})['then'](function(_0x17b530){_0x3f9791=_0x17b530;_0x53fce1=Object[_0x352e('0x9e')]([],_0x2db527);console[_0x352e('0x9f')](_0x352e('0xa0'),_0x2db527);_[_0x352e('0xa1')](_0x53fce1,function(_0x292b04){return _0x53f44f[_0x352e('0x9a')](_0x292b04[_0x352e('0x27')]);});console[_0x352e('0x9f')](_0x352e('0xa2'),_0x53fce1);_0x5ed31d=[];_0x53fce1['forEach'](function(_0x47a244){var _0x5247a1=createFieldObject(_0x5db6d0,_0x187288,_0x47a244[_0x352e('0x9c')],_0x47a244[_0x352e('0x27')],_0x47a244[_0x352e('0x9d')],!![]);_0x5ed31d[_0x352e('0xa3')](_0x5247a1);});return Promise[_0x352e('0xa4')](_0x5ed31d);})[_0x352e('0x23')](function(_0x4b2c7b){_0x3c0f6e=_0x4b2c7b;var _0x5f0a11=_0x3f9791[_0x352e('0xa5')](_0x3c0f6e);return{'count':_0x5f0a11[_0x352e('0x33')],'rows':_0x5f0a11};})[_0x352e('0x23')](respondWithResult(_0x509cd5,null))['catch'](function(_0x41eed8){console[_0x352e('0x9f')](_0x352e('0xa6')+_0x41eed8);var _0x24df1d=_0x98dd1a['query'][_0x352e('0xa7')]?0x1f4:_0x41eed8['statusCode']||0x1f4;logger[_0x352e('0x25')](_0x41eed8[_0x352e('0x26')]);delete _0x41eed8[_0x352e('0x27')];if(_0x24df1d===0x191){_0x24df1d=0x190;}_0x509cd5[_0x352e('0x1a')](_0x24df1d)[_0x352e('0x28')](_0x98dd1a[_0x352e('0x2f')][_0x352e('0xa7')]?{'message':_0x352e('0xa8'),'statusCode':_0x41eed8[_0x352e('0xa9')]}:_0x41eed8);});};function createFieldObject(_0x427a46,_0x9e5752,_0x41c1a6,_0x14eee,_0x33cc14,_0x5c7a89){return new Promise(function(_0x377df1,_0x33073e){var _0x455ba8={'id':_0x14eee,'name':_0x33cc14,'custom':_0x5c7a89};if(_0x41c1a6===_0x352e('0xaa')){_0x455ba8[_0x352e('0x44')]=[{'name':'True','value':_0x352e('0xab')},{'name':'False','value':_0x352e('0xac')}];_0x377df1(_0x455ba8);}else{var _0x4b76ce={'method':_0x352e('0x96'),'uri':_0x427a46+_0x352e('0xad')+_0x14eee,'auth':_0x9e5752,'json':!![]};return rp(_0x4b76ce)[_0x352e('0x23')](function(_0x1c29d5){var _0x2ef862=[];if(_0x1c29d5[_0x352e('0x98')][_0x352e('0x33')]>0x0){_0x1c29d5[_0x352e('0x98')][_0x352e('0x9b')](function(_0xfc2071){if(_0xfc2071['inactive']===_0x352e('0xac')){var _0x438316={'name':_0xfc2071[_0x352e('0x9d')],'value':_0xfc2071[_0x352e('0xae')]};_0x2ef862[_0x352e('0xa3')](_0x438316);}});}_0x455ba8[_0x352e('0x44')]=_0x2ef862;if(_0x455ba8[_0x352e('0x44')][_0x352e('0x33')]>0x0){_0x377df1(_0x455ba8);}else{if(_0x5c7a89==![]){_0x377df1();}else{_0x377df1(_0x455ba8);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5b99a3e..7633f13 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 _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'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'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x26425a,_0x1b4d6f){var _0x12802a=function(_0x5db8a7){while(--_0x5db8a7){_0x26425a['push'](_0x26425a['shift']());}};_0x12802a(++_0x1b4d6f);}(_0xeff8,0x186));var _0x8eff=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xeff8[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 215b18b..fa8c247 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 _0xd9e8=['raw','where','attributes','limit','include','map','model','catch','find','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','GetServicenowAccount','ServicenowAccount','options'];(function(_0x3c9504,_0x689c03){var _0x5f4aab=function(_0x2948ec){while(--_0x2948ec){_0x3c9504['push'](_0x3c9504['shift']());}};_0x5f4aab(++_0x689c03);}(_0xd9e8,0xca));var _0x8d9e=function(_0x3a7f33,_0x1d995e){_0x3a7f33=_0x3a7f33-0x0;var _0x2765a0=_0xd9e8[_0x3a7f33];return _0x2765a0;};'use strict';var _=require(_0x8d9e('0x0'));var util=require(_0x8d9e('0x1'));var moment=require('moment');var BPromise=require(_0x8d9e('0x2'));var rs=require(_0x8d9e('0x3'));var fs=require('fs');var Redis=require(_0x8d9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d9e('0x5'));var logger=require(_0x8d9e('0x6'))('rpc');var config=require(_0x8d9e('0x7'));var jayson=require(_0x8d9e('0x8'));var client=jayson[_0x8d9e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387d3f,_0x48274d,_0x50e1df){return new BPromise(function(_0x31806b,_0x43410f){return client['request'](_0x387d3f,_0x50e1df)[_0x8d9e('0xa')](function(_0x1912ba){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x48274d,_0x8d9e('0xb'));logger[_0x8d9e('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x48274d,_0x8d9e('0xb'),JSON[_0x8d9e('0xd')](_0x1912ba));if(_0x1912ba['error']){if(_0x1912ba[_0x8d9e('0xe')][_0x8d9e('0xf')]===0x1f4){logger['error'](_0x8d9e('0x10'),_0x48274d,_0x1912ba[_0x8d9e('0xe')][_0x8d9e('0x11')]);return _0x43410f(_0x1912ba[_0x8d9e('0xe')][_0x8d9e('0x11')]);}logger[_0x8d9e('0xe')](_0x8d9e('0x10'),_0x48274d,_0x1912ba['error'][_0x8d9e('0x11')]);return _0x31806b(_0x1912ba[_0x8d9e('0xe')][_0x8d9e('0x11')]);}else{logger[_0x8d9e('0x12')](_0x8d9e('0x10'),_0x48274d,_0x8d9e('0xb'));_0x31806b(_0x1912ba['result']['message']);}})['catch'](function(_0x44582f){logger['error'](_0x8d9e('0x10'),_0x48274d,_0x44582f);_0x43410f(_0x44582f);});});}exports[_0x8d9e('0x13')]=function(_0x3378f9){var _0x10b2fb=this;return new Promise(function(_0x306ed3,_0x88220f){return db[_0x8d9e('0x14')]['findAll']({'raw':_0x3378f9['options']?_0x3378f9[_0x8d9e('0x15')][_0x8d9e('0x16')]===undefined?!![]:![]:!![],'where':_0x3378f9[_0x8d9e('0x15')]?_0x3378f9[_0x8d9e('0x15')][_0x8d9e('0x17')]||null:null,'attributes':_0x3378f9[_0x8d9e('0x15')]?_0x3378f9['options'][_0x8d9e('0x18')]||null:null,'limit':_0x3378f9[_0x8d9e('0x15')]?_0x3378f9[_0x8d9e('0x15')][_0x8d9e('0x19')]||null:null,'include':_0x3378f9[_0x8d9e('0x15')]?_0x3378f9['options'][_0x8d9e('0x1a')]?_[_0x8d9e('0x1b')](_0x3378f9[_0x8d9e('0x15')][_0x8d9e('0x1a')],function(_0x72c3f3){return{'model':db[_0x72c3f3[_0x8d9e('0x1c')]],'as':_0x72c3f3['as'],'attributes':_0x72c3f3[_0x8d9e('0x18')],'include':_0x72c3f3[_0x8d9e('0x1a')]?_[_0x8d9e('0x1b')](_0x72c3f3[_0x8d9e('0x1a')],function(_0x1810c6){return{'model':db[_0x1810c6['model']],'as':_0x1810c6['as'],'attributes':_0x1810c6[_0x8d9e('0x18')],'include':_0x1810c6[_0x8d9e('0x1a')]?_[_0x8d9e('0x1b')](_0x1810c6[_0x8d9e('0x1a')],function(_0x347456){return{'model':db[_0x347456['model']],'as':_0x347456['as'],'attributes':_0x347456[_0x8d9e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8d9e('0xa')](function(_0x49f61f){logger[_0x8d9e('0x12')](_0x8d9e('0x13'),_0x3378f9);logger[_0x8d9e('0xc')](_0x8d9e('0x13'),_0x3378f9,JSON[_0x8d9e('0xd')](_0x49f61f));_0x306ed3(_0x49f61f);})[_0x8d9e('0x1d')](function(_0x526cd6){logger[_0x8d9e('0xe')](_0x8d9e('0x13'),_0x526cd6[_0x8d9e('0x11')],_0x3378f9);_0x88220f(_0x10b2fb['error'](0x1f4,_0x526cd6[_0x8d9e('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x5dfe11){var _0x255b72=this;return new Promise(function(_0x271e40,_0x3f06bc){return db[_0x8d9e('0x14')][_0x8d9e('0x1e')]({'raw':_0x5dfe11['options']?_0x5dfe11['options']['raw']===undefined?!![]:![]:!![],'where':_0x5dfe11[_0x8d9e('0x15')]?_0x5dfe11['options'][_0x8d9e('0x17')]||null:null,'attributes':_0x5dfe11[_0x8d9e('0x15')]?_0x5dfe11[_0x8d9e('0x15')][_0x8d9e('0x18')]||null:null,'include':_0x5dfe11[_0x8d9e('0x15')]?_0x5dfe11[_0x8d9e('0x15')][_0x8d9e('0x1a')]?_[_0x8d9e('0x1b')](_0x5dfe11[_0x8d9e('0x15')]['include'],function(_0x35696c){return{'model':db[_0x35696c['model']],'as':_0x35696c['as'],'attributes':_0x35696c['attributes'],'include':_0x35696c['include']?_[_0x8d9e('0x1b')](_0x35696c['include'],function(_0x1b77ae){return{'model':db[_0x1b77ae['model']],'as':_0x1b77ae['as'],'attributes':_0x1b77ae[_0x8d9e('0x18')],'include':_0x1b77ae[_0x8d9e('0x1a')]?_['map'](_0x1b77ae[_0x8d9e('0x1a')],function(_0x21997f){return{'model':db[_0x21997f[_0x8d9e('0x1c')]],'as':_0x21997f['as'],'attributes':_0x21997f[_0x8d9e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8d9e('0xa')](function(_0x4a0331){logger[_0x8d9e('0x12')](_0x8d9e('0x1f'),_0x5dfe11);logger[_0x8d9e('0xc')](_0x8d9e('0x1f'),_0x5dfe11,JSON[_0x8d9e('0xd')](_0x4a0331));_0x271e40(_0x4a0331);})[_0x8d9e('0x1d')](function(_0x49a580){logger[_0x8d9e('0xe')](_0x8d9e('0x1f'),_0x49a580[_0x8d9e('0x11')],_0x5dfe11);_0x3f06bc(_0x255b72[_0x8d9e('0xe')](0x1f4,_0x49a580[_0x8d9e('0x11')]));});});}; \ No newline at end of file +var _0x46fe=['result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','model','ShowServicenowAccount','ServicenowAccount','find','map','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x46fe,0x125));var _0xe46f=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x46fe[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe46f('0x0'));var BPromise=require(_0xe46f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe46f('0x2'));var db=require(_0xe46f('0x3'))['db'];var utils=require(_0xe46f('0x4'));var logger=require(_0xe46f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe46f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39061e,_0xc51c4f,_0x210565){return new BPromise(function(_0x31307c,_0xcbe1fe){return client[_0xe46f('0x7')](_0x39061e,_0x210565)[_0xe46f('0x8')](function(_0x535fe2){logger['info'](_0xe46f('0x9'),_0xc51c4f,_0xe46f('0xa'));logger[_0xe46f('0xb')](_0xe46f('0xc'),_0xc51c4f,_0xe46f('0xa'),JSON['stringify'](_0x535fe2));if(_0x535fe2['error']){if(_0x535fe2[_0xe46f('0xd')][_0xe46f('0xe')]===0x1f4){logger[_0xe46f('0xd')](_0xe46f('0x9'),_0xc51c4f,_0x535fe2[_0xe46f('0xd')]['message']);return _0xcbe1fe(_0x535fe2[_0xe46f('0xd')][_0xe46f('0xf')]);}logger[_0xe46f('0xd')](_0xe46f('0x9'),_0xc51c4f,_0x535fe2['error'][_0xe46f('0xf')]);return _0x31307c(_0x535fe2[_0xe46f('0xd')]['message']);}else{logger[_0xe46f('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xc51c4f,_0xe46f('0xa'));_0x31307c(_0x535fe2[_0xe46f('0x11')]['message']);}})[_0xe46f('0x12')](function(_0x4bf39d){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xc51c4f,_0x4bf39d);_0xcbe1fe(_0x4bf39d);});});}exports[_0xe46f('0x13')]=function(_0x48ce73){var _0x49e56b=this;return new Promise(function(_0x4c1bdf,_0x7406ca){return db['ServicenowAccount'][_0xe46f('0x14')]({'raw':_0x48ce73[_0xe46f('0x15')]?_0x48ce73[_0xe46f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x48ce73[_0xe46f('0x15')]?_0x48ce73[_0xe46f('0x15')][_0xe46f('0x16')]||null:null,'attributes':_0x48ce73[_0xe46f('0x15')]?_0x48ce73['options'][_0xe46f('0x17')]||null:null,'limit':_0x48ce73[_0xe46f('0x15')]?_0x48ce73[_0xe46f('0x15')][_0xe46f('0x18')]||null:null,'include':_0x48ce73[_0xe46f('0x15')]?_0x48ce73[_0xe46f('0x15')][_0xe46f('0x19')]?_['map'](_0x48ce73[_0xe46f('0x15')][_0xe46f('0x19')],function(_0x49f68f){return{'model':db[_0x49f68f[_0xe46f('0x1a')]],'as':_0x49f68f['as'],'attributes':_0x49f68f[_0xe46f('0x17')],'include':_0x49f68f[_0xe46f('0x19')]?_['map'](_0x49f68f['include'],function(_0x1375c2){return{'model':db[_0x1375c2[_0xe46f('0x1a')]],'as':_0x1375c2['as'],'attributes':_0x1375c2[_0xe46f('0x17')],'include':_0x1375c2[_0xe46f('0x19')]?_['map'](_0x1375c2[_0xe46f('0x19')],function(_0x34ff06){return{'model':db[_0x34ff06['model']],'as':_0x34ff06['as'],'attributes':_0x34ff06[_0xe46f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f9b8){logger[_0xe46f('0x10')](_0xe46f('0x13'),_0x48ce73);logger[_0xe46f('0xb')](_0xe46f('0x13'),_0x48ce73,JSON['stringify'](_0x21f9b8));_0x4c1bdf(_0x21f9b8);})[_0xe46f('0x12')](function(_0x7a5799){logger[_0xe46f('0xd')](_0xe46f('0x13'),_0x7a5799['message'],_0x48ce73);_0x7406ca(_0x49e56b[_0xe46f('0xd')](0x1f4,_0x7a5799[_0xe46f('0xf')]));});});};exports[_0xe46f('0x1b')]=function(_0x30ebd1){var _0x469883=this;return new Promise(function(_0x4823f0,_0x4afc01){return db[_0xe46f('0x1c')][_0xe46f('0x1d')]({'raw':_0x30ebd1[_0xe46f('0x15')]?_0x30ebd1[_0xe46f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x30ebd1['options']?_0x30ebd1[_0xe46f('0x15')]['where']||null:null,'attributes':_0x30ebd1[_0xe46f('0x15')]?_0x30ebd1[_0xe46f('0x15')]['attributes']||null:null,'include':_0x30ebd1[_0xe46f('0x15')]?_0x30ebd1[_0xe46f('0x15')][_0xe46f('0x19')]?_[_0xe46f('0x1e')](_0x30ebd1[_0xe46f('0x15')][_0xe46f('0x19')],function(_0x3626b3){return{'model':db[_0x3626b3[_0xe46f('0x1a')]],'as':_0x3626b3['as'],'attributes':_0x3626b3[_0xe46f('0x17')],'include':_0x3626b3[_0xe46f('0x19')]?_[_0xe46f('0x1e')](_0x3626b3[_0xe46f('0x19')],function(_0x4dc3d3){return{'model':db[_0x4dc3d3[_0xe46f('0x1a')]],'as':_0x4dc3d3['as'],'attributes':_0x4dc3d3[_0xe46f('0x17')],'include':_0x4dc3d3[_0xe46f('0x19')]?_[_0xe46f('0x1e')](_0x4dc3d3[_0xe46f('0x19')],function(_0x103409){return{'model':db[_0x103409[_0xe46f('0x1a')]],'as':_0x103409['as'],'attributes':_0x103409[_0xe46f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe46f('0x8')](function(_0x11b040){logger[_0xe46f('0x10')](_0xe46f('0x1b'),_0x30ebd1);logger[_0xe46f('0xb')](_0xe46f('0x1b'),_0x30ebd1,JSON['stringify'](_0x11b040));_0x4823f0(_0x11b040);})[_0xe46f('0x12')](function(_0x2e5851){logger[_0xe46f('0xd')]('ShowServicenowAccount',_0x2e5851['message'],_0x30ebd1);_0x4afc01(_0x469883[_0xe46f('0xd')](0x1f4,_0x2e5851[_0xe46f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ccf0462..3d6f05f 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 _0xa89b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0xa89b,0x1dc));var _0xba89=function(_0x4a258d,_0x30f281){_0x4a258d=_0x4a258d-0x0;var _0x104963=_0xa89b[_0x4a258d];return _0x104963;};'use strict';var multer=require(_0xba89('0x0'));var util=require('util');var path=require(_0xba89('0x1'));var timeout=require(_0xba89('0x2'));var express=require(_0xba89('0x3'));var router=express[_0xba89('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba89('0x5'));var interaction=require(_0xba89('0x6'));var config=require(_0xba89('0x7'));var controller=require(_0xba89('0x8'));router[_0xba89('0x9')]('/',auth[_0xba89('0xa')](),controller[_0xba89('0xb')]);router['get'](_0xba89('0xc'),auth[_0xba89('0xa')](),controller[_0xba89('0xd')]);router[_0xba89('0x9')](_0xba89('0xe'),auth[_0xba89('0xa')](),controller[_0xba89('0xf')]);router['get'](_0xba89('0x10'),auth[_0xba89('0xa')](),controller['getSubjects']);router[_0xba89('0x9')]('/:id/descriptions',auth[_0xba89('0xa')](),controller[_0xba89('0x11')]);router[_0xba89('0x12')]('/',auth[_0xba89('0xa')](),controller[_0xba89('0x13')]);router[_0xba89('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xba89('0x15')]('/:id',auth[_0xba89('0xa')](),controller[_0xba89('0x16')]);module[_0xba89('0x17')]=router; \ No newline at end of file +var _0xe6b6=['/:id/fields','getSubjects','getDescriptions','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x35eec2,_0x21ab9a){var _0x5dde4f=function(_0x232e61){while(--_0x232e61){_0x35eec2['push'](_0x35eec2['shift']());}};_0x5dde4f(++_0x21ab9a);}(_0xe6b6,0x140));var _0x6e6b=function(_0x4625c6,_0x3d30e3){_0x4625c6=_0x4625c6-0x0;var _0x2e651b=_0xe6b6[_0x4625c6];return _0x2e651b;};'use strict';var multer=require(_0x6e6b('0x0'));var util=require(_0x6e6b('0x1'));var path=require(_0x6e6b('0x2'));var timeout=require(_0x6e6b('0x3'));var express=require(_0x6e6b('0x4'));var router=express[_0x6e6b('0x5')]();var fs_extra=require(_0x6e6b('0x6'));var auth=require(_0x6e6b('0x7'));var interaction=require(_0x6e6b('0x8'));var config=require(_0x6e6b('0x9'));var controller=require(_0x6e6b('0xa'));router[_0x6e6b('0xb')]('/',auth[_0x6e6b('0xc')](),controller[_0x6e6b('0xd')]);router[_0x6e6b('0xb')](_0x6e6b('0xe'),auth[_0x6e6b('0xc')](),controller[_0x6e6b('0xf')]);router[_0x6e6b('0xb')](_0x6e6b('0x10'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x6e6b('0x11')]);router['get']('/:id/descriptions',auth[_0x6e6b('0xc')](),controller[_0x6e6b('0x12')]);router[_0x6e6b('0x13')]('/',auth[_0x6e6b('0xc')](),controller[_0x6e6b('0x14')]);router['put'](_0x6e6b('0xe'),auth[_0x6e6b('0xc')](),controller[_0x6e6b('0x15')]);router['delete'](_0x6e6b('0xe'),auth[_0x6e6b('0xc')](),controller[_0x6e6b('0x16')]);module[_0x6e6b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 73ca0bf..2c694bf 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 _0x702b=['STRING'];(function(_0x226128,_0x29199c){var _0x1af223=function(_0x30f811){while(--_0x30f811){_0x226128['push'](_0x226128['shift']());}};_0x1af223(++_0x29199c);}(_0x702b,0x193));var _0xb702=function(_0x46af07,_0x48954a){_0x46af07=_0x46af07-0x0;var _0x3bf11f=_0x702b[_0x46af07];return _0x3bf11f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb702('0x0')]}}; \ No newline at end of file +var _0xfaf2=['STRING','sequelize'];(function(_0x16d0a2,_0x1fd929){var _0x282b34=function(_0x309e52){while(--_0x309e52){_0x16d0a2['push'](_0x16d0a2['shift']());}};_0x282b34(++_0x1fd929);}(_0xfaf2,0x10d));var _0x2faf=function(_0x5b05e9,_0x331d7d){_0x5b05e9=_0x5b05e9-0x0;var _0x3fad30=_0xfaf2[_0x5b05e9];return _0x3fad30;};'use strict';var Sequelize=require(_0x2faf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2faf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6c9bc6a..cf588ea 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 _0x3376=['length','include','merge','find','create','body','params','findOne','ServicenowField','order','getFields','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','ServicenowConfiguration','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','name','options','includeAll','findAll','rows','catch','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3376,0xb1));var _0x6337=function(_0xc06125,_0x512de5){_0xc06125=_0xc06125-0x0;var _0x1911df=_0x3376[_0xc06125];return _0x1911df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6337('0x0'));var jsonpatch=require(_0x6337('0x1'));var rp=require(_0x6337('0x2'));var moment=require(_0x6337('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6337('0x4'));var util=require(_0x6337('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6337('0x6'));var ejs=require(_0x6337('0x7'));var fs=require('fs');var fs_extra=require(_0x6337('0x8'));var _=require('lodash');var squel=require(_0x6337('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6337('0xa'));var toCsv=require(_0x6337('0x6'));var querystring=require(_0x6337('0xb'));var Papa=require(_0x6337('0xc'));var Redis=require(_0x6337('0xd'));var authService=require(_0x6337('0xe'));var qs=require(_0x6337('0xf'));var as=require(_0x6337('0x10'));var hardwareService=require(_0x6337('0x11'));var logger=require(_0x6337('0x12'))(_0x6337('0x13'));var utils=require(_0x6337('0x14'));var config=require(_0x6337('0x15'));var licenseUtil=require(_0x6337('0x16'));var db=require(_0x6337('0x17'))['db'];function respondWithStatusCode(_0x5edcc8,_0x42e930){_0x42e930=_0x42e930||0xcc;return function(_0x586eaf){if(_0x586eaf){return _0x5edcc8['sendStatus'](_0x42e930);}return _0x5edcc8[_0x6337('0x18')](_0x42e930)[_0x6337('0x19')]();};}function respondWithResult(_0x11fcd4,_0x2acb27){_0x2acb27=_0x2acb27||0xc8;return function(_0xda191a){if(_0xda191a){return _0x11fcd4[_0x6337('0x18')](_0x2acb27)[_0x6337('0x1a')](_0xda191a);}};}function respondWithFilteredResult(_0x2406a3,_0x2a6175){return function(_0x4ded77){if(_0x4ded77){var _0x21890f=typeof _0x2a6175[_0x6337('0x1b')]==='undefined'&&typeof _0x2a6175[_0x6337('0x1c')]===_0x6337('0x1d');var _0x36fc7d=_0x4ded77[_0x6337('0x1e')];var _0x59bb75=_0x21890f?0x0:_0x2a6175[_0x6337('0x1b')];var _0x511559=_0x21890f?_0x4ded77[_0x6337('0x1e')]:_0x2a6175[_0x6337('0x1b')]+_0x2a6175[_0x6337('0x1c')];var _0x4618b2;if(_0x511559>=_0x36fc7d){_0x511559=_0x36fc7d;_0x4618b2=0xc8;}else{_0x4618b2=0xce;}_0x2406a3[_0x6337('0x18')](_0x4618b2);return _0x2406a3[_0x6337('0x1f')]('Content-Range',_0x59bb75+'-'+_0x511559+'/'+_0x36fc7d)[_0x6337('0x1a')](_0x4ded77);}return null;};}function patchUpdates(_0x4e8649){return function(_0x48eb47){try{jsonpatch[_0x6337('0x20')](_0x48eb47,_0x4e8649,!![]);}catch(_0x574dcb){return BPromise[_0x6337('0x21')](_0x574dcb);}return _0x48eb47[_0x6337('0x22')]();};}function saveUpdates(_0x302101,_0x4b0f09){return function(_0x43b371){if(_0x43b371){return _0x43b371[_0x6337('0x23')](_0x302101)[_0x6337('0x24')](function(_0x83fb9f){return _0x83fb9f;});}return null;};}function removeEntity(_0x58acce,_0x5497dc){return function(_0x3f35cc){if(_0x3f35cc){return _0x3f35cc[_0x6337('0x25')]()['then'](function(){_0x58acce[_0x6337('0x18')](0xcc)[_0x6337('0x19')]();});}};}function handleEntityNotFound(_0x146f23,_0xec4894){return function(_0x503766){if(!_0x503766){_0x146f23[_0x6337('0x26')](0x194);}return _0x503766;};}function handleError(_0x34096b,_0x5bc94d){_0x5bc94d=_0x5bc94d||0x1f4;return function(_0x4adabf){logger[_0x6337('0x27')](_0x4adabf[_0x6337('0x28')]);if(_0x4adabf['name']){delete _0x4adabf['name'];}_0x34096b[_0x6337('0x18')](_0x5bc94d)[_0x6337('0x29')](_0x4adabf);};}exports[_0x6337('0x2a')]=function(_0x23db77,_0x4f9b54){var _0x405cc9={},_0x2c7460={},_0x388662={'count':0x0,'rows':[]};var _0x4c27c6=_[_0x6337('0x2b')](db[_0x6337('0x2c')][_0x6337('0x2d')],function(_0x340919){return{'name':_0x340919['fieldName'],'type':_0x340919['type'][_0x6337('0x2e')]};});_0x2c7460[_0x6337('0x2f')]=_[_0x6337('0x2b')](_0x4c27c6,'name');_0x2c7460[_0x6337('0x30')]=_[_0x6337('0x31')](_0x23db77[_0x6337('0x30')]);_0x2c7460['filters']=_[_0x6337('0x32')](_0x2c7460[_0x6337('0x2f')],_0x2c7460[_0x6337('0x30')]);_0x405cc9[_0x6337('0x33')]=_['intersection'](_0x2c7460[_0x6337('0x2f')],qs['fields'](_0x23db77[_0x6337('0x30')][_0x6337('0x34')]));_0x405cc9[_0x6337('0x33')]=_0x405cc9[_0x6337('0x33')]['length']?_0x405cc9[_0x6337('0x33')]:_0x2c7460['model'];if(!_0x23db77['query'][_0x6337('0x35')](_0x6337('0x36'))){_0x405cc9[_0x6337('0x1c')]=qs[_0x6337('0x1c')](_0x23db77[_0x6337('0x30')][_0x6337('0x1c')]);_0x405cc9[_0x6337('0x1b')]=qs[_0x6337('0x1b')](_0x23db77[_0x6337('0x30')][_0x6337('0x1b')]);}_0x405cc9['order']=qs[_0x6337('0x37')](_0x23db77[_0x6337('0x30')][_0x6337('0x37')]);_0x405cc9[_0x6337('0x38')]=qs['filters'](_[_0x6337('0x39')](_0x23db77[_0x6337('0x30')],_0x2c7460[_0x6337('0x3a')]),_0x4c27c6);if(_0x23db77[_0x6337('0x30')][_0x6337('0x3b')]){_0x405cc9[_0x6337('0x38')]=_['merge'](_0x405cc9['where'],{'$or':_[_0x6337('0x2b')](_0x4c27c6,function(_0x48381a){if(_0x48381a[_0x6337('0x3c')]!==_0x6337('0x3d')){var _0x8160cb={};_0x8160cb[_0x48381a[_0x6337('0x3e')]]={'$like':'%'+_0x23db77['query'][_0x6337('0x3b')]+'%'};return _0x8160cb;}})});}_0x405cc9=_['merge']({},_0x405cc9,_0x23db77[_0x6337('0x3f')]);var _0xc08588={'where':_0x405cc9[_0x6337('0x38')]};return db[_0x6337('0x2c')]['count'](_0xc08588)[_0x6337('0x24')](function(_0x21b3f9){_0x388662[_0x6337('0x1e')]=_0x21b3f9;if(_0x23db77['query'][_0x6337('0x40')]){_0x405cc9['include']=[{'all':!![]}];}return db[_0x6337('0x2c')][_0x6337('0x41')](_0x405cc9);})[_0x6337('0x24')](function(_0x5b24d3){_0x388662[_0x6337('0x42')]=_0x5b24d3;return _0x388662;})[_0x6337('0x24')](respondWithFilteredResult(_0x4f9b54,_0x405cc9))[_0x6337('0x43')](handleError(_0x4f9b54,null));};exports[_0x6337('0x44')]=function(_0x5a6c92,_0x15066f){var _0x21f4a5={'raw':![],'where':{'id':_0x5a6c92['params']['id']}},_0x5ce052={};_0x5ce052[_0x6337('0x2f')]=_[_0x6337('0x31')](db[_0x6337('0x2c')][_0x6337('0x2d')]);_0x5ce052[_0x6337('0x30')]=_['keys'](_0x5a6c92[_0x6337('0x30')]);_0x5ce052[_0x6337('0x3a')]=_[_0x6337('0x32')](_0x5ce052[_0x6337('0x2f')],_0x5ce052[_0x6337('0x30')]);_0x21f4a5[_0x6337('0x33')]=_['intersection'](_0x5ce052['model'],qs[_0x6337('0x34')](_0x5a6c92[_0x6337('0x30')][_0x6337('0x34')]));_0x21f4a5[_0x6337('0x33')]=_0x21f4a5[_0x6337('0x33')][_0x6337('0x45')]?_0x21f4a5[_0x6337('0x33')]:_0x5ce052[_0x6337('0x2f')];if(_0x5a6c92['query']['includeAll']){_0x21f4a5[_0x6337('0x46')]=[{'all':!![]}];}_0x21f4a5=_[_0x6337('0x47')]({},_0x21f4a5,_0x5a6c92[_0x6337('0x3f')]);return db[_0x6337('0x2c')][_0x6337('0x48')](_0x21f4a5)[_0x6337('0x24')](handleEntityNotFound(_0x15066f,null))[_0x6337('0x24')](respondWithResult(_0x15066f,null))[_0x6337('0x43')](handleError(_0x15066f,null));};exports[_0x6337('0x49')]=function(_0x5d0cbb,_0x4feb5d){return db[_0x6337('0x2c')][_0x6337('0x49')](_0x5d0cbb[_0x6337('0x4a')],{})['then'](respondWithResult(_0x4feb5d,0xc9))[_0x6337('0x43')](handleError(_0x4feb5d,null));};exports[_0x6337('0x23')]=function(_0x286e91,_0x5e3beb){if(_0x286e91[_0x6337('0x4a')]['id']){delete _0x286e91[_0x6337('0x4a')]['id'];}return db[_0x6337('0x2c')][_0x6337('0x48')]({'where':{'id':_0x286e91['params']['id']}})[_0x6337('0x24')](handleEntityNotFound(_0x5e3beb,null))['then'](saveUpdates(_0x286e91['body'],null))[_0x6337('0x24')](respondWithResult(_0x5e3beb,null))[_0x6337('0x43')](handleError(_0x5e3beb,null));};exports[_0x6337('0x25')]=function(_0x50dcc3,_0x636263){return db[_0x6337('0x2c')]['find']({'where':{'id':_0x50dcc3[_0x6337('0x4b')]['id']}})[_0x6337('0x24')](handleEntityNotFound(_0x636263,null))[_0x6337('0x24')](removeEntity(_0x636263,null))[_0x6337('0x43')](handleError(_0x636263,null));};exports['getFields']=function(_0x3cfb5d,_0x3fe8d1,_0x54d1c2){var _0x1d6ab4={};var _0x11e32d={};var _0x300ab7;var _0x34fefe;return db[_0x6337('0x2c')][_0x6337('0x4c')]({'where':{'id':_0x3cfb5d[_0x6337('0x4b')]['id']}})[_0x6337('0x24')](handleEntityNotFound(_0x3fe8d1,null))[_0x6337('0x24')](function(_0x506db9){if(_0x506db9){_0x300ab7=_0x506db9;_0x11e32d[_0x6337('0x2f')]=_[_0x6337('0x31')](db[_0x6337('0x4d')][_0x6337('0x2d')]);_0x11e32d[_0x6337('0x30')]=_[_0x6337('0x31')](_0x3cfb5d[_0x6337('0x30')]);_0x11e32d[_0x6337('0x3a')]=_[_0x6337('0x32')](_0x11e32d[_0x6337('0x2f')],_0x11e32d['query']);_0x1d6ab4[_0x6337('0x33')]=_['intersection'](_0x11e32d[_0x6337('0x2f')],qs[_0x6337('0x34')](_0x3cfb5d['query'][_0x6337('0x34')]));_0x1d6ab4[_0x6337('0x33')]=_0x1d6ab4[_0x6337('0x33')][_0x6337('0x45')]?_0x1d6ab4['attributes']:_0x11e32d['model'];_0x1d6ab4[_0x6337('0x4e')]=qs[_0x6337('0x37')](_0x3cfb5d['query'][_0x6337('0x37')]);_0x1d6ab4[_0x6337('0x38')]=qs['filters'](_[_0x6337('0x39')](_0x3cfb5d[_0x6337('0x30')],_0x11e32d[_0x6337('0x3a')]));if(_0x3cfb5d[_0x6337('0x30')]['filter']){_0x1d6ab4[_0x6337('0x38')]=_[_0x6337('0x47')](_0x1d6ab4[_0x6337('0x38')],{'$or':_[_0x6337('0x2b')](_0x1d6ab4[_0x6337('0x33')],function(_0x292241){var _0x1fcd67={};_0x1fcd67[_0x292241]={'$like':'%'+_0x3cfb5d['query'][_0x6337('0x3b')]+'%'};return _0x1fcd67;})});}_0x1d6ab4=_[_0x6337('0x47')]({},_0x1d6ab4,_0x3cfb5d['options']);return _0x300ab7['getFields'](_0x1d6ab4);}})[_0x6337('0x24')](function(_0x5e8be9){if(_0x5e8be9){_0x34fefe=_0x5e8be9['length'];if(!_0x3cfb5d[_0x6337('0x30')][_0x6337('0x35')](_0x6337('0x36'))){_0x1d6ab4['limit']=qs['limit'](_0x3cfb5d[_0x6337('0x30')][_0x6337('0x1c')]);_0x1d6ab4[_0x6337('0x1b')]=qs['offset'](_0x3cfb5d['query']['offset']);}return _0x300ab7[_0x6337('0x4f')](_0x1d6ab4);}})[_0x6337('0x24')](function(_0x4f7064){if(_0x4f7064){return _0x4f7064?{'count':_0x34fefe,'rows':_0x4f7064}:null;}})[_0x6337('0x24')](respondWithResult(_0x3fe8d1,null))[_0x6337('0x43')](handleError(_0x3fe8d1,null));};exports[_0x6337('0x50')]=function(_0x140d6a,_0x35db1d,_0x3e73c6){var _0x1ed5f1={};var _0x30fafa={};var _0xd25bb0;var _0x1243d6;return db[_0x6337('0x2c')][_0x6337('0x4c')]({'where':{'id':_0x140d6a[_0x6337('0x4b')]['id']}})[_0x6337('0x24')](handleEntityNotFound(_0x35db1d,null))['then'](function(_0x353827){if(_0x353827){_0xd25bb0=_0x353827;_0x30fafa[_0x6337('0x2f')]=_[_0x6337('0x31')](db['ServicenowField'][_0x6337('0x2d')]);_0x30fafa[_0x6337('0x30')]=_[_0x6337('0x31')](_0x140d6a['query']);_0x30fafa[_0x6337('0x3a')]=_[_0x6337('0x32')](_0x30fafa[_0x6337('0x2f')],_0x30fafa[_0x6337('0x30')]);_0x1ed5f1[_0x6337('0x33')]=_[_0x6337('0x32')](_0x30fafa['model'],qs['fields'](_0x140d6a['query'][_0x6337('0x34')]));_0x1ed5f1['attributes']=_0x1ed5f1[_0x6337('0x33')][_0x6337('0x45')]?_0x1ed5f1['attributes']:_0x30fafa[_0x6337('0x2f')];_0x1ed5f1[_0x6337('0x4e')]=qs[_0x6337('0x37')](_0x140d6a[_0x6337('0x30')][_0x6337('0x37')]);_0x1ed5f1['where']=qs[_0x6337('0x3a')](_['pick'](_0x140d6a[_0x6337('0x30')],_0x30fafa[_0x6337('0x3a')]));if(_0x140d6a[_0x6337('0x30')]['filter']){_0x1ed5f1['where']=_['merge'](_0x1ed5f1['where'],{'$or':_['map'](_0x1ed5f1[_0x6337('0x33')],function(_0x555c7d){var _0x38fcd4={};_0x38fcd4[_0x555c7d]={'$like':'%'+_0x140d6a[_0x6337('0x30')]['filter']+'%'};return _0x38fcd4;})});}_0x1ed5f1=_[_0x6337('0x47')]({},_0x1ed5f1,_0x140d6a[_0x6337('0x3f')]);return _0xd25bb0[_0x6337('0x50')](_0x1ed5f1);}})['then'](function(_0x53cecf){if(_0x53cecf){_0x1243d6=_0x53cecf['length'];if(!_0x140d6a[_0x6337('0x30')][_0x6337('0x35')](_0x6337('0x36'))){_0x1ed5f1[_0x6337('0x1c')]=qs[_0x6337('0x1c')](_0x140d6a[_0x6337('0x30')]['limit']);_0x1ed5f1[_0x6337('0x1b')]=qs[_0x6337('0x1b')](_0x140d6a[_0x6337('0x30')]['offset']);}return _0xd25bb0[_0x6337('0x50')](_0x1ed5f1);}})[_0x6337('0x24')](function(_0x3921ac){if(_0x3921ac){return _0x3921ac?{'count':_0x1243d6,'rows':_0x3921ac}:null;}})[_0x6337('0x24')](respondWithResult(_0x35db1d,null))[_0x6337('0x43')](handleError(_0x35db1d,null));};exports[_0x6337('0x51')]=function(_0x13f51a,_0x377140,_0x2a8924){var _0x487809={};var _0xa6c3={};var _0x10bdb6;var _0x3f0729;return db[_0x6337('0x2c')]['findOne']({'where':{'id':_0x13f51a[_0x6337('0x4b')]['id']}})[_0x6337('0x24')](handleEntityNotFound(_0x377140,null))[_0x6337('0x24')](function(_0x157ed5){if(_0x157ed5){_0x10bdb6=_0x157ed5;_0xa6c3[_0x6337('0x2f')]=_['keys'](db['ServicenowField'][_0x6337('0x2d')]);_0xa6c3[_0x6337('0x30')]=_[_0x6337('0x31')](_0x13f51a[_0x6337('0x30')]);_0xa6c3['filters']=_[_0x6337('0x32')](_0xa6c3['model'],_0xa6c3[_0x6337('0x30')]);_0x487809[_0x6337('0x33')]=_[_0x6337('0x32')](_0xa6c3[_0x6337('0x2f')],qs[_0x6337('0x34')](_0x13f51a['query'][_0x6337('0x34')]));_0x487809[_0x6337('0x33')]=_0x487809['attributes']['length']?_0x487809[_0x6337('0x33')]:_0xa6c3[_0x6337('0x2f')];_0x487809[_0x6337('0x4e')]=qs[_0x6337('0x37')](_0x13f51a['query'][_0x6337('0x37')]);_0x487809['where']=qs[_0x6337('0x3a')](_[_0x6337('0x39')](_0x13f51a[_0x6337('0x30')],_0xa6c3['filters']));if(_0x13f51a['query'][_0x6337('0x3b')]){_0x487809[_0x6337('0x38')]=_[_0x6337('0x47')](_0x487809['where'],{'$or':_[_0x6337('0x2b')](_0x487809['attributes'],function(_0x4aed99){var _0x44aa4f={};_0x44aa4f[_0x4aed99]={'$like':'%'+_0x13f51a['query']['filter']+'%'};return _0x44aa4f;})});}_0x487809=_[_0x6337('0x47')]({},_0x487809,_0x13f51a[_0x6337('0x3f')]);return _0x10bdb6[_0x6337('0x51')](_0x487809);}})[_0x6337('0x24')](function(_0x3a95c5){if(_0x3a95c5){_0x3f0729=_0x3a95c5[_0x6337('0x45')];if(!_0x13f51a[_0x6337('0x30')][_0x6337('0x35')](_0x6337('0x36'))){_0x487809[_0x6337('0x1c')]=qs[_0x6337('0x1c')](_0x13f51a['query'][_0x6337('0x1c')]);_0x487809[_0x6337('0x1b')]=qs[_0x6337('0x1b')](_0x13f51a[_0x6337('0x30')][_0x6337('0x1b')]);}return _0x10bdb6[_0x6337('0x51')](_0x487809);}})[_0x6337('0x24')](function(_0x223e1b){if(_0x223e1b){return _0x223e1b?{'count':_0x3f0729,'rows':_0x223e1b}:null;}})[_0x6337('0x24')](respondWithResult(_0x377140,null))['catch'](handleError(_0x377140,null));}; \ No newline at end of file +var _0x9c82=['end','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields','findOne','ServicenowField','options','hasOwnProperty','getSubjects','getDescriptions','nolimit','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x117352,_0x15bccb){var _0x212dcf=function(_0x5118bb){while(--_0x5118bb){_0x117352['push'](_0x117352['shift']());}};_0x212dcf(++_0x15bccb);}(_0x9c82,0xc5));var _0x29c8=function(_0x5cbbb7,_0x35571c){_0x5cbbb7=_0x5cbbb7-0x0;var _0x462386=_0x9c82[_0x5cbbb7];return _0x462386;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29c8('0x0'));var zipdir=require(_0x29c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x29c8('0x2'));var BPromise=require(_0x29c8('0x3'));var Mustache=require(_0x29c8('0x4'));var util=require('util');var path=require('path');var sox=require(_0x29c8('0x5'));var csv=require(_0x29c8('0x6'));var ejs=require(_0x29c8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29c8('0x8'));var squel=require(_0x29c8('0x9'));var crypto=require('crypto');var jsforce=require(_0x29c8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x29c8('0x6'));var querystring=require(_0x29c8('0xb'));var Papa=require(_0x29c8('0xc'));var Redis=require('ioredis');var authService=require(_0x29c8('0xd'));var qs=require(_0x29c8('0xe'));var as=require(_0x29c8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c8('0x10'))(_0x29c8('0x11'));var utils=require('../../config/utils');var config=require(_0x29c8('0x12'));var licenseUtil=require(_0x29c8('0x13'));var db=require(_0x29c8('0x14'))['db'];function respondWithStatusCode(_0x3239b0,_0x1ae9d7){_0x1ae9d7=_0x1ae9d7||0xcc;return function(_0x1853f2){if(_0x1853f2){return _0x3239b0['sendStatus'](_0x1ae9d7);}return _0x3239b0[_0x29c8('0x15')](_0x1ae9d7)['end']();};}function respondWithResult(_0x3423ea,_0x199e86){_0x199e86=_0x199e86||0xc8;return function(_0x36712c){if(_0x36712c){return _0x3423ea[_0x29c8('0x15')](_0x199e86)[_0x29c8('0x16')](_0x36712c);}};}function respondWithFilteredResult(_0x4cf700,_0x3a82cd){return function(_0x4d14f6){if(_0x4d14f6){var _0x3d9c3c=typeof _0x3a82cd['offset']===_0x29c8('0x17')&&typeof _0x3a82cd[_0x29c8('0x18')]==='undefined';var _0x4ad71e=_0x4d14f6[_0x29c8('0x19')];var _0x273d09=_0x3d9c3c?0x0:_0x3a82cd[_0x29c8('0x1a')];var _0x11795f=_0x3d9c3c?_0x4d14f6[_0x29c8('0x19')]:_0x3a82cd[_0x29c8('0x1a')]+_0x3a82cd['limit'];var _0x4d1d9a;if(_0x11795f>=_0x4ad71e){_0x11795f=_0x4ad71e;_0x4d1d9a=0xc8;}else{_0x4d1d9a=0xce;}_0x4cf700[_0x29c8('0x15')](_0x4d1d9a);return _0x4cf700[_0x29c8('0x1b')](_0x29c8('0x1c'),_0x273d09+'-'+_0x11795f+'/'+_0x4ad71e)[_0x29c8('0x16')](_0x4d14f6);}return null;};}function patchUpdates(_0xfaa9b1){return function(_0x4b65ac){try{jsonpatch['apply'](_0x4b65ac,_0xfaa9b1,!![]);}catch(_0x17f798){return BPromise[_0x29c8('0x1d')](_0x17f798);}return _0x4b65ac[_0x29c8('0x1e')]();};}function saveUpdates(_0x1cba77,_0x5c8d7a){return function(_0x14d404){if(_0x14d404){return _0x14d404[_0x29c8('0x1f')](_0x1cba77)[_0x29c8('0x20')](function(_0xaa907b){return _0xaa907b;});}return null;};}function removeEntity(_0x5f486e,_0x4bc90a){return function(_0x3358f1){if(_0x3358f1){return _0x3358f1[_0x29c8('0x21')]()[_0x29c8('0x20')](function(){_0x5f486e['status'](0xcc)[_0x29c8('0x22')]();});}};}function handleEntityNotFound(_0x1dbac2,_0x49e922){return function(_0x3431fd){if(!_0x3431fd){_0x1dbac2['sendStatus'](0x194);}return _0x3431fd;};}function handleError(_0x3852d1,_0x160a93){_0x160a93=_0x160a93||0x1f4;return function(_0x241db3){logger[_0x29c8('0x23')](_0x241db3[_0x29c8('0x24')]);if(_0x241db3['name']){delete _0x241db3[_0x29c8('0x25')];}_0x3852d1[_0x29c8('0x15')](_0x160a93)[_0x29c8('0x26')](_0x241db3);};}exports['index']=function(_0x58a419,_0x72c721){var _0x55a007={},_0x3f19ed={},_0x451408={'count':0x0,'rows':[]};var _0x16c87c=_[_0x29c8('0x27')](db[_0x29c8('0x28')][_0x29c8('0x29')],function(_0x49a334){return{'name':_0x49a334[_0x29c8('0x2a')],'type':_0x49a334[_0x29c8('0x2b')][_0x29c8('0x2c')]};});_0x3f19ed[_0x29c8('0x2d')]=_[_0x29c8('0x27')](_0x16c87c,'name');_0x3f19ed[_0x29c8('0x2e')]=_[_0x29c8('0x2f')](_0x58a419[_0x29c8('0x2e')]);_0x3f19ed['filters']=_[_0x29c8('0x30')](_0x3f19ed['model'],_0x3f19ed[_0x29c8('0x2e')]);_0x55a007[_0x29c8('0x31')]=_[_0x29c8('0x30')](_0x3f19ed['model'],qs[_0x29c8('0x32')](_0x58a419[_0x29c8('0x2e')][_0x29c8('0x32')]));_0x55a007[_0x29c8('0x31')]=_0x55a007[_0x29c8('0x31')]['length']?_0x55a007[_0x29c8('0x31')]:_0x3f19ed[_0x29c8('0x2d')];if(!_0x58a419['query']['hasOwnProperty']('nolimit')){_0x55a007[_0x29c8('0x18')]=qs[_0x29c8('0x18')](_0x58a419[_0x29c8('0x2e')]['limit']);_0x55a007['offset']=qs['offset'](_0x58a419[_0x29c8('0x2e')]['offset']);}_0x55a007[_0x29c8('0x33')]=qs[_0x29c8('0x34')](_0x58a419['query'][_0x29c8('0x34')]);_0x55a007[_0x29c8('0x35')]=qs[_0x29c8('0x36')](_[_0x29c8('0x37')](_0x58a419[_0x29c8('0x2e')],_0x3f19ed['filters']),_0x16c87c);if(_0x58a419[_0x29c8('0x2e')][_0x29c8('0x38')]){_0x55a007[_0x29c8('0x35')]=_['merge'](_0x55a007['where'],{'$or':_[_0x29c8('0x27')](_0x16c87c,function(_0x145b1f){if(_0x145b1f[_0x29c8('0x2b')]!==_0x29c8('0x39')){var _0x52b391={};_0x52b391[_0x145b1f[_0x29c8('0x25')]]={'$like':'%'+_0x58a419['query']['filter']+'%'};return _0x52b391;}})});}_0x55a007=_[_0x29c8('0x3a')]({},_0x55a007,_0x58a419['options']);var _0x1cab73={'where':_0x55a007[_0x29c8('0x35')]};return db['ServicenowConfiguration'][_0x29c8('0x19')](_0x1cab73)['then'](function(_0x2c0ecc){_0x451408[_0x29c8('0x19')]=_0x2c0ecc;if(_0x58a419[_0x29c8('0x2e')][_0x29c8('0x3b')]){_0x55a007[_0x29c8('0x3c')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x29c8('0x3d')](_0x55a007);})['then'](function(_0x194f4c){_0x451408[_0x29c8('0x3e')]=_0x194f4c;return _0x451408;})[_0x29c8('0x20')](respondWithFilteredResult(_0x72c721,_0x55a007))[_0x29c8('0x3f')](handleError(_0x72c721,null));};exports['show']=function(_0x335a47,_0x5cd6f9){var _0xd2678b={'raw':![],'where':{'id':_0x335a47[_0x29c8('0x40')]['id']}},_0x41a151={};_0x41a151[_0x29c8('0x2d')]=_['keys'](db[_0x29c8('0x28')][_0x29c8('0x29')]);_0x41a151[_0x29c8('0x2e')]=_[_0x29c8('0x2f')](_0x335a47[_0x29c8('0x2e')]);_0x41a151[_0x29c8('0x36')]=_[_0x29c8('0x30')](_0x41a151[_0x29c8('0x2d')],_0x41a151['query']);_0xd2678b[_0x29c8('0x31')]=_['intersection'](_0x41a151[_0x29c8('0x2d')],qs[_0x29c8('0x32')](_0x335a47['query']['fields']));_0xd2678b[_0x29c8('0x31')]=_0xd2678b[_0x29c8('0x31')][_0x29c8('0x41')]?_0xd2678b['attributes']:_0x41a151[_0x29c8('0x2d')];if(_0x335a47['query'][_0x29c8('0x3b')]){_0xd2678b[_0x29c8('0x3c')]=[{'all':!![]}];}_0xd2678b=_[_0x29c8('0x3a')]({},_0xd2678b,_0x335a47['options']);return db[_0x29c8('0x28')][_0x29c8('0x42')](_0xd2678b)['then'](handleEntityNotFound(_0x5cd6f9,null))[_0x29c8('0x20')](respondWithResult(_0x5cd6f9,null))[_0x29c8('0x3f')](handleError(_0x5cd6f9,null));};exports[_0x29c8('0x43')]=function(_0x472aaf,_0x3b4965){return db[_0x29c8('0x28')]['create'](_0x472aaf[_0x29c8('0x44')],{})[_0x29c8('0x20')](respondWithResult(_0x3b4965,0xc9))['catch'](handleError(_0x3b4965,null));};exports['update']=function(_0x5b6460,_0x170db9){if(_0x5b6460[_0x29c8('0x44')]['id']){delete _0x5b6460[_0x29c8('0x44')]['id'];}return db[_0x29c8('0x28')][_0x29c8('0x42')]({'where':{'id':_0x5b6460[_0x29c8('0x40')]['id']}})[_0x29c8('0x20')](handleEntityNotFound(_0x170db9,null))['then'](saveUpdates(_0x5b6460[_0x29c8('0x44')],null))['then'](respondWithResult(_0x170db9,null))[_0x29c8('0x3f')](handleError(_0x170db9,null));};exports[_0x29c8('0x21')]=function(_0x250351,_0x3bfa37){return db['ServicenowConfiguration'][_0x29c8('0x42')]({'where':{'id':_0x250351[_0x29c8('0x40')]['id']}})[_0x29c8('0x20')](handleEntityNotFound(_0x3bfa37,null))[_0x29c8('0x20')](removeEntity(_0x3bfa37,null))[_0x29c8('0x3f')](handleError(_0x3bfa37,null));};exports[_0x29c8('0x45')]=function(_0xac3b1f,_0x31da0a,_0x50fe13){var _0x20b9c2={};var _0x495a5f={};var _0x1355ec;var _0x3689ac;return db['ServicenowConfiguration'][_0x29c8('0x46')]({'where':{'id':_0xac3b1f['params']['id']}})[_0x29c8('0x20')](handleEntityNotFound(_0x31da0a,null))['then'](function(_0x5de7c7){if(_0x5de7c7){_0x1355ec=_0x5de7c7;_0x495a5f['model']=_[_0x29c8('0x2f')](db[_0x29c8('0x47')][_0x29c8('0x29')]);_0x495a5f[_0x29c8('0x2e')]=_['keys'](_0xac3b1f['query']);_0x495a5f[_0x29c8('0x36')]=_[_0x29c8('0x30')](_0x495a5f[_0x29c8('0x2d')],_0x495a5f[_0x29c8('0x2e')]);_0x20b9c2['attributes']=_[_0x29c8('0x30')](_0x495a5f['model'],qs[_0x29c8('0x32')](_0xac3b1f[_0x29c8('0x2e')]['fields']));_0x20b9c2[_0x29c8('0x31')]=_0x20b9c2['attributes'][_0x29c8('0x41')]?_0x20b9c2[_0x29c8('0x31')]:_0x495a5f[_0x29c8('0x2d')];_0x20b9c2[_0x29c8('0x33')]=qs[_0x29c8('0x34')](_0xac3b1f[_0x29c8('0x2e')]['sort']);_0x20b9c2[_0x29c8('0x35')]=qs[_0x29c8('0x36')](_[_0x29c8('0x37')](_0xac3b1f[_0x29c8('0x2e')],_0x495a5f[_0x29c8('0x36')]));if(_0xac3b1f[_0x29c8('0x2e')][_0x29c8('0x38')]){_0x20b9c2[_0x29c8('0x35')]=_[_0x29c8('0x3a')](_0x20b9c2[_0x29c8('0x35')],{'$or':_[_0x29c8('0x27')](_0x20b9c2['attributes'],function(_0x2a3b07){var _0x5f02e9={};_0x5f02e9[_0x2a3b07]={'$like':'%'+_0xac3b1f[_0x29c8('0x2e')]['filter']+'%'};return _0x5f02e9;})});}_0x20b9c2=_['merge']({},_0x20b9c2,_0xac3b1f[_0x29c8('0x48')]);return _0x1355ec[_0x29c8('0x45')](_0x20b9c2);}})['then'](function(_0x342785){if(_0x342785){_0x3689ac=_0x342785[_0x29c8('0x41')];if(!_0xac3b1f['query'][_0x29c8('0x49')]('nolimit')){_0x20b9c2['limit']=qs[_0x29c8('0x18')](_0xac3b1f[_0x29c8('0x2e')][_0x29c8('0x18')]);_0x20b9c2[_0x29c8('0x1a')]=qs['offset'](_0xac3b1f[_0x29c8('0x2e')][_0x29c8('0x1a')]);}return _0x1355ec[_0x29c8('0x45')](_0x20b9c2);}})[_0x29c8('0x20')](function(_0x39a5b0){if(_0x39a5b0){return _0x39a5b0?{'count':_0x3689ac,'rows':_0x39a5b0}:null;}})[_0x29c8('0x20')](respondWithResult(_0x31da0a,null))['catch'](handleError(_0x31da0a,null));};exports['getSubjects']=function(_0x2911b3,_0x563906,_0x42a88b){var _0x33871e={};var _0xb7ddac={};var _0x3434c9;var _0x5385cd;return db['ServicenowConfiguration'][_0x29c8('0x46')]({'where':{'id':_0x2911b3[_0x29c8('0x40')]['id']}})['then'](handleEntityNotFound(_0x563906,null))['then'](function(_0x1e167f){if(_0x1e167f){_0x3434c9=_0x1e167f;_0xb7ddac[_0x29c8('0x2d')]=_[_0x29c8('0x2f')](db[_0x29c8('0x47')][_0x29c8('0x29')]);_0xb7ddac[_0x29c8('0x2e')]=_[_0x29c8('0x2f')](_0x2911b3[_0x29c8('0x2e')]);_0xb7ddac[_0x29c8('0x36')]=_[_0x29c8('0x30')](_0xb7ddac[_0x29c8('0x2d')],_0xb7ddac['query']);_0x33871e[_0x29c8('0x31')]=_[_0x29c8('0x30')](_0xb7ddac[_0x29c8('0x2d')],qs[_0x29c8('0x32')](_0x2911b3[_0x29c8('0x2e')][_0x29c8('0x32')]));_0x33871e[_0x29c8('0x31')]=_0x33871e[_0x29c8('0x31')][_0x29c8('0x41')]?_0x33871e[_0x29c8('0x31')]:_0xb7ddac['model'];_0x33871e['order']=qs[_0x29c8('0x34')](_0x2911b3[_0x29c8('0x2e')][_0x29c8('0x34')]);_0x33871e[_0x29c8('0x35')]=qs[_0x29c8('0x36')](_[_0x29c8('0x37')](_0x2911b3[_0x29c8('0x2e')],_0xb7ddac[_0x29c8('0x36')]));if(_0x2911b3[_0x29c8('0x2e')][_0x29c8('0x38')]){_0x33871e[_0x29c8('0x35')]=_[_0x29c8('0x3a')](_0x33871e[_0x29c8('0x35')],{'$or':_[_0x29c8('0x27')](_0x33871e[_0x29c8('0x31')],function(_0x2cbc3b){var _0x57257a={};_0x57257a[_0x2cbc3b]={'$like':'%'+_0x2911b3[_0x29c8('0x2e')]['filter']+'%'};return _0x57257a;})});}_0x33871e=_[_0x29c8('0x3a')]({},_0x33871e,_0x2911b3[_0x29c8('0x48')]);return _0x3434c9[_0x29c8('0x4a')](_0x33871e);}})[_0x29c8('0x20')](function(_0xe17fee){if(_0xe17fee){_0x5385cd=_0xe17fee[_0x29c8('0x41')];if(!_0x2911b3[_0x29c8('0x2e')][_0x29c8('0x49')]('nolimit')){_0x33871e['limit']=qs[_0x29c8('0x18')](_0x2911b3[_0x29c8('0x2e')]['limit']);_0x33871e[_0x29c8('0x1a')]=qs[_0x29c8('0x1a')](_0x2911b3[_0x29c8('0x2e')][_0x29c8('0x1a')]);}return _0x3434c9[_0x29c8('0x4a')](_0x33871e);}})[_0x29c8('0x20')](function(_0x334863){if(_0x334863){return _0x334863?{'count':_0x5385cd,'rows':_0x334863}:null;}})['then'](respondWithResult(_0x563906,null))[_0x29c8('0x3f')](handleError(_0x563906,null));};exports['getDescriptions']=function(_0x1b628f,_0x18ccdf,_0x1faddb){var _0x361bac={};var _0x170c1b={};var _0x3575b5;var _0xd1c5ec;return db[_0x29c8('0x28')]['findOne']({'where':{'id':_0x1b628f['params']['id']}})[_0x29c8('0x20')](handleEntityNotFound(_0x18ccdf,null))[_0x29c8('0x20')](function(_0x5f2dc1){if(_0x5f2dc1){_0x3575b5=_0x5f2dc1;_0x170c1b[_0x29c8('0x2d')]=_[_0x29c8('0x2f')](db[_0x29c8('0x47')][_0x29c8('0x29')]);_0x170c1b[_0x29c8('0x2e')]=_['keys'](_0x1b628f[_0x29c8('0x2e')]);_0x170c1b[_0x29c8('0x36')]=_[_0x29c8('0x30')](_0x170c1b[_0x29c8('0x2d')],_0x170c1b[_0x29c8('0x2e')]);_0x361bac[_0x29c8('0x31')]=_[_0x29c8('0x30')](_0x170c1b['model'],qs[_0x29c8('0x32')](_0x1b628f[_0x29c8('0x2e')]['fields']));_0x361bac['attributes']=_0x361bac[_0x29c8('0x31')][_0x29c8('0x41')]?_0x361bac['attributes']:_0x170c1b['model'];_0x361bac[_0x29c8('0x33')]=qs[_0x29c8('0x34')](_0x1b628f[_0x29c8('0x2e')][_0x29c8('0x34')]);_0x361bac[_0x29c8('0x35')]=qs['filters'](_[_0x29c8('0x37')](_0x1b628f[_0x29c8('0x2e')],_0x170c1b[_0x29c8('0x36')]));if(_0x1b628f[_0x29c8('0x2e')][_0x29c8('0x38')]){_0x361bac[_0x29c8('0x35')]=_[_0x29c8('0x3a')](_0x361bac[_0x29c8('0x35')],{'$or':_['map'](_0x361bac['attributes'],function(_0x4718db){var _0x25aff4={};_0x25aff4[_0x4718db]={'$like':'%'+_0x1b628f[_0x29c8('0x2e')][_0x29c8('0x38')]+'%'};return _0x25aff4;})});}_0x361bac=_['merge']({},_0x361bac,_0x1b628f['options']);return _0x3575b5[_0x29c8('0x4b')](_0x361bac);}})[_0x29c8('0x20')](function(_0x220e22){if(_0x220e22){_0xd1c5ec=_0x220e22['length'];if(!_0x1b628f[_0x29c8('0x2e')][_0x29c8('0x49')](_0x29c8('0x4c'))){_0x361bac[_0x29c8('0x18')]=qs[_0x29c8('0x18')](_0x1b628f['query'][_0x29c8('0x18')]);_0x361bac['offset']=qs[_0x29c8('0x1a')](_0x1b628f[_0x29c8('0x2e')][_0x29c8('0x1a')]);}return _0x3575b5['getDescriptions'](_0x361bac);}})['then'](function(_0x165bb0){if(_0x165bb0){return _0x165bb0?{'count':_0xd1c5ec,'rows':_0x165bb0}:null;}})[_0x29c8('0x20')](respondWithResult(_0x18ccdf,null))[_0x29c8('0x3f')](handleError(_0x18ccdf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index fdfac83..bd2b844 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 _0xa5dd=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1fb195,_0x2227a7){var _0xf20531=function(_0x4a80f0){while(--_0x4a80f0){_0x1fb195['push'](_0x1fb195['shift']());}};_0xf20531(++_0x2227a7);}(_0xa5dd,0x101));var _0xda5d=function(_0x18b7ba,_0x3572e1){_0x18b7ba=_0x18b7ba-0x0;var _0x2603f0=_0xa5dd[_0x18b7ba];return _0x2603f0;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda5d('0x1'));var moment=require(_0xda5d('0x2'));var BPromise=require(_0xda5d('0x3'));var rp=require(_0xda5d('0x4'));var fs=require('fs');var path=require(_0xda5d('0x5'));var rimraf=require('rimraf');var config=require(_0xda5d('0x6'));var attributes=require(_0xda5d('0x7'));module[_0xda5d('0x8')]=function(_0x5a437a,_0x555107){return _0x5a437a[_0xda5d('0x9')](_0xda5d('0xa'),attributes,{'tableName':_0xda5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab23=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xab23,0x1bc));var _0x3ab2=function(_0x3f42ba,_0x52f139){_0x3f42ba=_0x3f42ba-0x0;var _0x2a9e22=_0xab23[_0x3f42ba];return _0x2a9e22;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var moment=require(_0x3ab2('0x4'));var BPromise=require(_0x3ab2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab2('0x6'));var rimraf=require(_0x3ab2('0x7'));var config=require(_0x3ab2('0x8'));var attributes=require(_0x3ab2('0x9'));module['exports']=function(_0x5222ba,_0x3445f2){return _0x5222ba['define']('ServicenowConfiguration',attributes,{'tableName':_0x3ab2('0xa'),'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 5b36d48..27b92b6 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 _0x8d30=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird'];(function(_0x5b564d,_0x533fa7){var _0x37cac6=function(_0x5e12a0){while(--_0x5e12a0){_0x5b564d['push'](_0x5b564d['shift']());}};_0x37cac6(++_0x533fa7);}(_0x8d30,0x128));var _0x08d3=function(_0x31c796,_0x2e3c7f){_0x31c796=_0x31c796-0x0;var _0x128356=_0x8d30[_0x31c796];return _0x128356;};'use strict';var _=require(_0x08d3('0x0'));var util=require(_0x08d3('0x1'));var moment=require(_0x08d3('0x2'));var BPromise=require(_0x08d3('0x3'));var rs=require(_0x08d3('0x4'));var fs=require('fs');var Redis=require(_0x08d3('0x5'));var db=require(_0x08d3('0x6'))['db'];var utils=require(_0x08d3('0x7'));var logger=require(_0x08d3('0x8'))(_0x08d3('0x9'));var config=require(_0x08d3('0xa'));var jayson=require(_0x08d3('0xb'));var client=jayson[_0x08d3('0xc')][_0x08d3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x379ac0,_0x58079e,_0xb06199){return new BPromise(function(_0x2d6f42,_0x574cc9){return client[_0x08d3('0xe')](_0x379ac0,_0xb06199)['then'](function(_0x188d3a){logger[_0x08d3('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58079e,_0x08d3('0x10'));logger[_0x08d3('0x11')](_0x08d3('0x12'),_0x58079e,_0x08d3('0x10'),JSON[_0x08d3('0x13')](_0x188d3a));if(_0x188d3a['error']){if(_0x188d3a[_0x08d3('0x14')][_0x08d3('0x15')]===0x1f4){logger[_0x08d3('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58079e,_0x188d3a['error'][_0x08d3('0x16')]);return _0x574cc9(_0x188d3a['error'][_0x08d3('0x16')]);}logger['error'](_0x08d3('0x17'),_0x58079e,_0x188d3a[_0x08d3('0x14')][_0x08d3('0x16')]);return _0x2d6f42(_0x188d3a[_0x08d3('0x14')][_0x08d3('0x16')]);}else{logger[_0x08d3('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58079e,_0x08d3('0x10'));_0x2d6f42(_0x188d3a['result'][_0x08d3('0x16')]);}})[_0x08d3('0x18')](function(_0x4dec06){logger[_0x08d3('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58079e,_0x4dec06);_0x574cc9(_0x4dec06);});});} \ No newline at end of file +var _0x1cfd=['jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x8f826d,_0x3b4969){var _0x5df792=function(_0x3c1fe0){while(--_0x3c1fe0){_0x8f826d['push'](_0x8f826d['shift']());}};_0x5df792(++_0x3b4969);}(_0x1cfd,0x1db));var _0xd1cf=function(_0x377efb,_0x39a31b){_0x377efb=_0x377efb-0x0;var _0x4b982b=_0x1cfd[_0x377efb];return _0x4b982b;};'use strict';var _=require(_0xd1cf('0x0'));var util=require(_0xd1cf('0x1'));var moment=require(_0xd1cf('0x2'));var BPromise=require(_0xd1cf('0x3'));var rs=require(_0xd1cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1cf('0x5'))['db'];var utils=require(_0xd1cf('0x6'));var logger=require(_0xd1cf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd1cf('0x8'));var client=jayson[_0xd1cf('0x9')][_0xd1cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a4879,_0x1bf822,_0x123b1d){return new BPromise(function(_0x36e860,_0x2f74dd){return client['request'](_0x4a4879,_0x123b1d)[_0xd1cf('0xb')](function(_0x69e911){logger[_0xd1cf('0xc')](_0xd1cf('0xd'),_0x1bf822,_0xd1cf('0xe'));logger[_0xd1cf('0xf')](_0xd1cf('0x10'),_0x1bf822,'request\x20sent',JSON[_0xd1cf('0x11')](_0x69e911));if(_0x69e911[_0xd1cf('0x12')]){if(_0x69e911[_0xd1cf('0x12')][_0xd1cf('0x13')]===0x1f4){logger[_0xd1cf('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1bf822,_0x69e911[_0xd1cf('0x12')][_0xd1cf('0x14')]);return _0x2f74dd(_0x69e911[_0xd1cf('0x12')][_0xd1cf('0x14')]);}logger[_0xd1cf('0x12')](_0xd1cf('0xd'),_0x1bf822,_0x69e911['error'][_0xd1cf('0x14')]);return _0x36e860(_0x69e911[_0xd1cf('0x12')]['message']);}else{logger[_0xd1cf('0xc')](_0xd1cf('0xd'),_0x1bf822,_0xd1cf('0xe'));_0x36e860(_0x69e911[_0xd1cf('0x15')][_0xd1cf('0x14')]);}})[_0xd1cf('0x16')](function(_0x3180bd){logger[_0xd1cf('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1bf822,_0x3180bd);_0x2f74dd(_0x3180bd);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 00fb27a..aed2326 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 _0x77a1=['index','/:id','show','create','put','isAuthenticated','update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x17848c,_0x329bd8){var _0x7ceb9f=function(_0x2cf16e){while(--_0x2cf16e){_0x17848c['push'](_0x17848c['shift']());}};_0x7ceb9f(++_0x329bd8);}(_0x77a1,0x158));var _0x177a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x77a1[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x177a('0x0'));var path=require(_0x177a('0x1'));var timeout=require(_0x177a('0x2'));var express=require(_0x177a('0x3'));var router=express['Router']();var fs_extra=require(_0x177a('0x4'));var auth=require(_0x177a('0x5'));var interaction=require(_0x177a('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x177a('0x7')]('/',auth['isAuthenticated'](),controller[_0x177a('0x8')]);router[_0x177a('0x7')](_0x177a('0x9'),auth['isAuthenticated'](),controller[_0x177a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x177a('0xb')]);router[_0x177a('0xc')](_0x177a('0x9'),auth[_0x177a('0xd')](),controller[_0x177a('0xe')]);router[_0x177a('0xf')]('/:id',auth[_0x177a('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9dc0=['isAuthenticated','index','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x9dc0,0x1ed));var _0x09dc=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x9dc0[_0x156a0d];return _0x98a9ba;};'use strict';var multer=require(_0x09dc('0x0'));var util=require(_0x09dc('0x1'));var path=require(_0x09dc('0x2'));var timeout=require(_0x09dc('0x3'));var express=require(_0x09dc('0x4'));var router=express['Router']();var fs_extra=require(_0x09dc('0x5'));var auth=require(_0x09dc('0x6'));var interaction=require(_0x09dc('0x7'));var config=require(_0x09dc('0x8'));var controller=require(_0x09dc('0x9'));router[_0x09dc('0xa')]('/',auth[_0x09dc('0xb')](),controller[_0x09dc('0xc')]);router[_0x09dc('0xa')]('/:id',auth[_0x09dc('0xb')](),controller['show']);router['post']('/',auth[_0x09dc('0xb')](),controller[_0x09dc('0xd')]);router['put'](_0x09dc('0xe'),auth[_0x09dc('0xb')](),controller[_0x09dc('0xf')]);router[_0x09dc('0x10')](_0x09dc('0xe'),auth[_0x09dc('0xb')](),controller['destroy']);module[_0x09dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 8a54f4c..e36a054 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 _0xcd2d=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0xcd2d,0x144));var _0xdcd2=function(_0x53f933,_0x26d4ef){_0x53f933=_0x53f933-0x0;var _0x385bd0=_0xcd2d[_0x53f933];return _0x385bd0;};'use strict';var Sequelize=require(_0xdcd2('0x0'));module[_0xdcd2('0x1')]={'type':{'type':Sequelize[_0xdcd2('0x2')]('string',_0xdcd2('0x3'),_0xdcd2('0x4'),_0xdcd2('0x5'),_0xdcd2('0x6')),'defaultValue':_0xdcd2('0x7')},'content':{'type':Sequelize[_0xdcd2('0x8')]},'key':{'type':Sequelize[_0xdcd2('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xdcd2('0x7'),'variable',_0xdcd2('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb54e=['keyValue','picklist','STRING','ENUM','string','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x361ecd,_0x32451e){var _0x31942f=function(_0x4fe2b5){while(--_0x4fe2b5){_0x361ecd['push'](_0x361ecd['shift']());}};_0x31942f(++_0x32451e);}(_0xb54e,0xa7));var _0xeb54=function(_0x4e9b03,_0x523457){_0x4e9b03=_0x4e9b03-0x0;var _0x2ca16a=_0xb54e[_0x4e9b03];return _0x2ca16a;};'use strict';var Sequelize=require(_0xeb54('0x0'));module[_0xeb54('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xeb54('0x2'),_0xeb54('0x3'),_0xeb54('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeb54('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeb54('0x6')](_0xeb54('0x7'),_0xeb54('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xeb54('0x5')]},'idField':{'type':Sequelize[_0xeb54('0x5')]},'nameField':{'type':Sequelize[_0xeb54('0x5')]},'customField':{'type':Sequelize[_0xeb54('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb54('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b6c6772..33a96e2 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 _0x3dc2=['end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','type','options','includeAll','findAll','rows','length','include','catch','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dc2,0x1d8));var _0x23dc=function(_0x3aec0b,_0x1a1074){_0x3aec0b=_0x3aec0b-0x0;var _0x7d7f10=_0x3dc2[_0x3aec0b];return _0x7d7f10;};'use strict';var emlformat=require(_0x23dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23dc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23dc('0x2'));var moment=require(_0x23dc('0x3'));var BPromise=require(_0x23dc('0x4'));var Mustache=require(_0x23dc('0x5'));var util=require(_0x23dc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x23dc('0x7'));var ejs=require(_0x23dc('0x8'));var fs=require('fs');var fs_extra=require(_0x23dc('0x9'));var _=require('lodash');var squel=require(_0x23dc('0xa'));var crypto=require(_0x23dc('0xb'));var jsforce=require(_0x23dc('0xc'));var deskjs=require(_0x23dc('0xd'));var toCsv=require(_0x23dc('0x7'));var querystring=require(_0x23dc('0xe'));var Papa=require(_0x23dc('0xf'));var Redis=require(_0x23dc('0x10'));var authService=require(_0x23dc('0x11'));var qs=require(_0x23dc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x23dc('0x13'))(_0x23dc('0x14'));var utils=require(_0x23dc('0x15'));var config=require(_0x23dc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x274836,_0x1d4a2c){_0x1d4a2c=_0x1d4a2c||0xcc;return function(_0x49d9df){if(_0x49d9df){return _0x274836[_0x23dc('0x17')](_0x1d4a2c);}return _0x274836[_0x23dc('0x18')](_0x1d4a2c)[_0x23dc('0x19')]();};}function respondWithResult(_0x3cec51,_0x158c3d){_0x158c3d=_0x158c3d||0xc8;return function(_0x413dcc){if(_0x413dcc){return _0x3cec51[_0x23dc('0x18')](_0x158c3d)[_0x23dc('0x1a')](_0x413dcc);}};}function respondWithFilteredResult(_0x418be3,_0x1958ab){return function(_0x3dc2e5){if(_0x3dc2e5){var _0xf9c23f=typeof _0x1958ab['offset']===_0x23dc('0x1b')&&typeof _0x1958ab['limit']===_0x23dc('0x1b');var _0x2ac542=_0x3dc2e5[_0x23dc('0x1c')];var _0x34cbd1=_0xf9c23f?0x0:_0x1958ab['offset'];var _0xbafa79=_0xf9c23f?_0x3dc2e5[_0x23dc('0x1c')]:_0x1958ab[_0x23dc('0x1d')]+_0x1958ab[_0x23dc('0x1e')];var _0x16add0;if(_0xbafa79>=_0x2ac542){_0xbafa79=_0x2ac542;_0x16add0=0xc8;}else{_0x16add0=0xce;}_0x418be3[_0x23dc('0x18')](_0x16add0);return _0x418be3[_0x23dc('0x1f')](_0x23dc('0x20'),_0x34cbd1+'-'+_0xbafa79+'/'+_0x2ac542)[_0x23dc('0x1a')](_0x3dc2e5);}return null;};}function patchUpdates(_0x3cdccd){return function(_0x48643b){try{jsonpatch[_0x23dc('0x21')](_0x48643b,_0x3cdccd,!![]);}catch(_0x1c0447){return BPromise['reject'](_0x1c0447);}return _0x48643b['save']();};}function saveUpdates(_0x588132,_0x4e7d85){return function(_0x56890a){if(_0x56890a){return _0x56890a[_0x23dc('0x22')](_0x588132)[_0x23dc('0x23')](function(_0x22677b){return _0x22677b;});}return null;};}function removeEntity(_0x4da6f3,_0x2fb9e7){return function(_0xbdcc9f){if(_0xbdcc9f){return _0xbdcc9f[_0x23dc('0x24')]()[_0x23dc('0x23')](function(){_0x4da6f3[_0x23dc('0x18')](0xcc)[_0x23dc('0x19')]();});}};}function handleEntityNotFound(_0x43f370,_0x5587a8){return function(_0x25c88f){if(!_0x25c88f){_0x43f370['sendStatus'](0x194);}return _0x25c88f;};}function handleError(_0x4d0979,_0x5c2575){_0x5c2575=_0x5c2575||0x1f4;return function(_0x37e52e){logger[_0x23dc('0x25')](_0x37e52e[_0x23dc('0x26')]);if(_0x37e52e[_0x23dc('0x27')]){delete _0x37e52e[_0x23dc('0x27')];}_0x4d0979[_0x23dc('0x18')](_0x5c2575)[_0x23dc('0x28')](_0x37e52e);};}exports[_0x23dc('0x29')]=function(_0x11826d,_0x59dd28){var _0x17593a={},_0x40ce9e={},_0xcb5e76={'count':0x0,'rows':[]};var _0x34c6fb=_[_0x23dc('0x2a')](db[_0x23dc('0x2b')][_0x23dc('0x2c')],function(_0x584c28){return{'name':_0x584c28['fieldName'],'type':_0x584c28['type'][_0x23dc('0x2d')]};});_0x40ce9e['model']=_[_0x23dc('0x2a')](_0x34c6fb,_0x23dc('0x27'));_0x40ce9e[_0x23dc('0x2e')]=_[_0x23dc('0x2f')](_0x11826d[_0x23dc('0x2e')]);_0x40ce9e[_0x23dc('0x30')]=_['intersection'](_0x40ce9e[_0x23dc('0x31')],_0x40ce9e[_0x23dc('0x2e')]);_0x17593a['attributes']=_[_0x23dc('0x32')](_0x40ce9e['model'],qs[_0x23dc('0x33')](_0x11826d[_0x23dc('0x2e')][_0x23dc('0x33')]));_0x17593a['attributes']=_0x17593a[_0x23dc('0x34')]['length']?_0x17593a[_0x23dc('0x34')]:_0x40ce9e[_0x23dc('0x31')];if(!_0x11826d['query'][_0x23dc('0x35')]('nolimit')){_0x17593a[_0x23dc('0x1e')]=qs[_0x23dc('0x1e')](_0x11826d['query'][_0x23dc('0x1e')]);_0x17593a[_0x23dc('0x1d')]=qs[_0x23dc('0x1d')](_0x11826d['query'][_0x23dc('0x1d')]);}_0x17593a[_0x23dc('0x36')]=qs['sort'](_0x11826d[_0x23dc('0x2e')]['sort']);_0x17593a[_0x23dc('0x37')]=qs[_0x23dc('0x30')](_[_0x23dc('0x38')](_0x11826d[_0x23dc('0x2e')],_0x40ce9e['filters']),_0x34c6fb);if(_0x11826d[_0x23dc('0x2e')][_0x23dc('0x39')]){_0x17593a[_0x23dc('0x37')]=_[_0x23dc('0x3a')](_0x17593a[_0x23dc('0x37')],{'$or':_[_0x23dc('0x2a')](_0x34c6fb,function(_0xa4d2ab){if(_0xa4d2ab[_0x23dc('0x3b')]!=='VIRTUAL'){var _0x358720={};_0x358720[_0xa4d2ab['name']]={'$like':'%'+_0x11826d[_0x23dc('0x2e')][_0x23dc('0x39')]+'%'};return _0x358720;}})});}_0x17593a=_['merge']({},_0x17593a,_0x11826d[_0x23dc('0x3c')]);var _0x23dff5={'where':_0x17593a[_0x23dc('0x37')]};return db[_0x23dc('0x2b')][_0x23dc('0x1c')](_0x23dff5)['then'](function(_0x215681){_0xcb5e76[_0x23dc('0x1c')]=_0x215681;if(_0x11826d[_0x23dc('0x2e')][_0x23dc('0x3d')]){_0x17593a['include']=[{'all':!![]}];}return db[_0x23dc('0x2b')][_0x23dc('0x3e')](_0x17593a);})[_0x23dc('0x23')](function(_0x2ba75a){_0xcb5e76[_0x23dc('0x3f')]=_0x2ba75a;return _0xcb5e76;})[_0x23dc('0x23')](respondWithFilteredResult(_0x59dd28,_0x17593a))['catch'](handleError(_0x59dd28,null));};exports['show']=function(_0x1027b8,_0x2a86c1){var _0x32715d={'raw':!![],'where':{'id':_0x1027b8['params']['id']}},_0x16a0f9={};_0x16a0f9[_0x23dc('0x31')]=_[_0x23dc('0x2f')](db[_0x23dc('0x2b')][_0x23dc('0x2c')]);_0x16a0f9[_0x23dc('0x2e')]=_[_0x23dc('0x2f')](_0x1027b8[_0x23dc('0x2e')]);_0x16a0f9[_0x23dc('0x30')]=_['intersection'](_0x16a0f9[_0x23dc('0x31')],_0x16a0f9['query']);_0x32715d[_0x23dc('0x34')]=_['intersection'](_0x16a0f9[_0x23dc('0x31')],qs[_0x23dc('0x33')](_0x1027b8[_0x23dc('0x2e')][_0x23dc('0x33')]));_0x32715d[_0x23dc('0x34')]=_0x32715d[_0x23dc('0x34')][_0x23dc('0x40')]?_0x32715d[_0x23dc('0x34')]:_0x16a0f9[_0x23dc('0x31')];if(_0x1027b8[_0x23dc('0x2e')][_0x23dc('0x3d')]){_0x32715d[_0x23dc('0x41')]=[{'all':!![]}];}_0x32715d=_[_0x23dc('0x3a')]({},_0x32715d,_0x1027b8[_0x23dc('0x3c')]);return db[_0x23dc('0x2b')]['find'](_0x32715d)[_0x23dc('0x23')](handleEntityNotFound(_0x2a86c1,null))[_0x23dc('0x23')](respondWithResult(_0x2a86c1,null))[_0x23dc('0x42')](handleError(_0x2a86c1,null));};exports[_0x23dc('0x43')]=function(_0x3aff23,_0x339713){return db[_0x23dc('0x2b')][_0x23dc('0x43')](_0x3aff23[_0x23dc('0x44')],{})[_0x23dc('0x23')](respondWithResult(_0x339713,0xc9))[_0x23dc('0x42')](handleError(_0x339713,null));};exports[_0x23dc('0x22')]=function(_0x489f63,_0x3bb8de){if(_0x489f63[_0x23dc('0x44')]['id']){delete _0x489f63[_0x23dc('0x44')]['id'];}return db[_0x23dc('0x2b')][_0x23dc('0x45')]({'where':{'id':_0x489f63[_0x23dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bb8de,null))[_0x23dc('0x23')](saveUpdates(_0x489f63[_0x23dc('0x44')],null))['then'](respondWithResult(_0x3bb8de,null))[_0x23dc('0x42')](handleError(_0x3bb8de,null));};exports[_0x23dc('0x24')]=function(_0x2c13f1,_0x499d07){return db['ServicenowField'][_0x23dc('0x45')]({'where':{'id':_0x2c13f1[_0x23dc('0x46')]['id']}})[_0x23dc('0x23')](handleEntityNotFound(_0x499d07,null))[_0x23dc('0x23')](removeEntity(_0x499d07,null))[_0x23dc('0x42')](handleError(_0x499d07,null));}; \ No newline at end of file +var _0xded8=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','options','ServicenowField','include','rows','catch','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','request-promise','moment','util','path','sox'];(function(_0x4080dd,_0x5b595d){var _0x4ecf85=function(_0x5d281a){while(--_0x5d281a){_0x4080dd['push'](_0x4080dd['shift']());}};_0x4ecf85(++_0x5b595d);}(_0xded8,0x14d));var _0x8ded=function(_0x2d5ebc,_0x5e6f46){_0x2d5ebc=_0x2d5ebc-0x0;var _0x289733=_0xded8[_0x2d5ebc];return _0x289733;};'use strict';var emlformat=require(_0x8ded('0x0'));var rimraf=require(_0x8ded('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ded('0x2'));var moment=require(_0x8ded('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8ded('0x4'));var path=require(_0x8ded('0x5'));var sox=require(_0x8ded('0x6'));var csv=require(_0x8ded('0x7'));var ejs=require(_0x8ded('0x8'));var fs=require('fs');var fs_extra=require(_0x8ded('0x9'));var _=require('lodash');var squel=require(_0x8ded('0xa'));var crypto=require(_0x8ded('0xb'));var jsforce=require(_0x8ded('0xc'));var deskjs=require(_0x8ded('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ded('0xe'));var Redis=require(_0x8ded('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ded('0x10'));var as=require(_0x8ded('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ded('0x12'));var utils=require(_0x8ded('0x13'));var config=require(_0x8ded('0x14'));var licenseUtil=require(_0x8ded('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348f18,_0x293c81){_0x293c81=_0x293c81||0xcc;return function(_0x39dabe){if(_0x39dabe){return _0x348f18[_0x8ded('0x16')](_0x293c81);}return _0x348f18[_0x8ded('0x17')](_0x293c81)[_0x8ded('0x18')]();};}function respondWithResult(_0x16f818,_0x103d25){_0x103d25=_0x103d25||0xc8;return function(_0x1283d9){if(_0x1283d9){return _0x16f818[_0x8ded('0x17')](_0x103d25)['json'](_0x1283d9);}};}function respondWithFilteredResult(_0x1bdf83,_0x551227){return function(_0x1eafa5){if(_0x1eafa5){var _0xa12663=typeof _0x551227[_0x8ded('0x19')]===_0x8ded('0x1a')&&typeof _0x551227[_0x8ded('0x1b')]===_0x8ded('0x1a');var _0x44b2cb=_0x1eafa5['count'];var _0x519ec4=_0xa12663?0x0:_0x551227[_0x8ded('0x19')];var _0x720f80=_0xa12663?_0x1eafa5[_0x8ded('0x1c')]:_0x551227[_0x8ded('0x19')]+_0x551227[_0x8ded('0x1b')];var _0x3133b5;if(_0x720f80>=_0x44b2cb){_0x720f80=_0x44b2cb;_0x3133b5=0xc8;}else{_0x3133b5=0xce;}_0x1bdf83[_0x8ded('0x17')](_0x3133b5);return _0x1bdf83['set'](_0x8ded('0x1d'),_0x519ec4+'-'+_0x720f80+'/'+_0x44b2cb)[_0x8ded('0x1e')](_0x1eafa5);}return null;};}function patchUpdates(_0x4b0bc2){return function(_0x4b6081){try{jsonpatch[_0x8ded('0x1f')](_0x4b6081,_0x4b0bc2,!![]);}catch(_0x3b6d57){return BPromise[_0x8ded('0x20')](_0x3b6d57);}return _0x4b6081['save']();};}function saveUpdates(_0x18eb0a,_0x3f6067){return function(_0x3f10d4){if(_0x3f10d4){return _0x3f10d4[_0x8ded('0x21')](_0x18eb0a)[_0x8ded('0x22')](function(_0x17c69e){return _0x17c69e;});}return null;};}function removeEntity(_0x52896f,_0x372763){return function(_0x1419f4){if(_0x1419f4){return _0x1419f4[_0x8ded('0x23')]()[_0x8ded('0x22')](function(){_0x52896f[_0x8ded('0x17')](0xcc)[_0x8ded('0x18')]();});}};}function handleEntityNotFound(_0x8b2397,_0x5a9b05){return function(_0x43f9ef){if(!_0x43f9ef){_0x8b2397['sendStatus'](0x194);}return _0x43f9ef;};}function handleError(_0x381488,_0x2d52c0){_0x2d52c0=_0x2d52c0||0x1f4;return function(_0x3e39b8){logger[_0x8ded('0x24')](_0x3e39b8[_0x8ded('0x25')]);if(_0x3e39b8['name']){delete _0x3e39b8[_0x8ded('0x26')];}_0x381488['status'](_0x2d52c0)[_0x8ded('0x27')](_0x3e39b8);};}exports['index']=function(_0x1d115a,_0x4b8cb1){var _0x33b6e4={},_0xe90ba0={},_0x1e6de8={'count':0x0,'rows':[]};var _0x3f4448=_[_0x8ded('0x28')](db['ServicenowField']['rawAttributes'],function(_0x4860cc){return{'name':_0x4860cc['fieldName'],'type':_0x4860cc['type'][_0x8ded('0x29')]};});_0xe90ba0['model']=_[_0x8ded('0x28')](_0x3f4448,_0x8ded('0x26'));_0xe90ba0[_0x8ded('0x2a')]=_[_0x8ded('0x2b')](_0x1d115a[_0x8ded('0x2a')]);_0xe90ba0[_0x8ded('0x2c')]=_[_0x8ded('0x2d')](_0xe90ba0['model'],_0xe90ba0['query']);_0x33b6e4[_0x8ded('0x2e')]=_['intersection'](_0xe90ba0[_0x8ded('0x2f')],qs[_0x8ded('0x30')](_0x1d115a[_0x8ded('0x2a')]['fields']));_0x33b6e4['attributes']=_0x33b6e4[_0x8ded('0x2e')][_0x8ded('0x31')]?_0x33b6e4[_0x8ded('0x2e')]:_0xe90ba0[_0x8ded('0x2f')];if(!_0x1d115a[_0x8ded('0x2a')][_0x8ded('0x32')]('nolimit')){_0x33b6e4[_0x8ded('0x1b')]=qs[_0x8ded('0x1b')](_0x1d115a['query'][_0x8ded('0x1b')]);_0x33b6e4[_0x8ded('0x19')]=qs[_0x8ded('0x19')](_0x1d115a[_0x8ded('0x2a')]['offset']);}_0x33b6e4[_0x8ded('0x33')]=qs[_0x8ded('0x34')](_0x1d115a[_0x8ded('0x2a')][_0x8ded('0x34')]);_0x33b6e4['where']=qs['filters'](_['pick'](_0x1d115a[_0x8ded('0x2a')],_0xe90ba0['filters']),_0x3f4448);if(_0x1d115a['query'][_0x8ded('0x35')]){_0x33b6e4[_0x8ded('0x36')]=_[_0x8ded('0x37')](_0x33b6e4[_0x8ded('0x36')],{'$or':_[_0x8ded('0x28')](_0x3f4448,function(_0x2a5672){if(_0x2a5672[_0x8ded('0x38')]!=='VIRTUAL'){var _0x566014={};_0x566014[_0x2a5672[_0x8ded('0x26')]]={'$like':'%'+_0x1d115a[_0x8ded('0x2a')][_0x8ded('0x35')]+'%'};return _0x566014;}})});}_0x33b6e4=_[_0x8ded('0x37')]({},_0x33b6e4,_0x1d115a[_0x8ded('0x39')]);var _0x44b5e2={'where':_0x33b6e4[_0x8ded('0x36')]};return db[_0x8ded('0x3a')][_0x8ded('0x1c')](_0x44b5e2)['then'](function(_0xaeea96){_0x1e6de8['count']=_0xaeea96;if(_0x1d115a['query']['includeAll']){_0x33b6e4[_0x8ded('0x3b')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x33b6e4);})['then'](function(_0x40a951){_0x1e6de8[_0x8ded('0x3c')]=_0x40a951;return _0x1e6de8;})[_0x8ded('0x22')](respondWithFilteredResult(_0x4b8cb1,_0x33b6e4))[_0x8ded('0x3d')](handleError(_0x4b8cb1,null));};exports['show']=function(_0x49a1b4,_0x20b458){var _0x3c271f={'raw':!![],'where':{'id':_0x49a1b4[_0x8ded('0x3e')]['id']}},_0x8ffc37={};_0x8ffc37[_0x8ded('0x2f')]=_[_0x8ded('0x2b')](db[_0x8ded('0x3a')][_0x8ded('0x3f')]);_0x8ffc37[_0x8ded('0x2a')]=_[_0x8ded('0x2b')](_0x49a1b4[_0x8ded('0x2a')]);_0x8ffc37[_0x8ded('0x2c')]=_[_0x8ded('0x2d')](_0x8ffc37[_0x8ded('0x2f')],_0x8ffc37[_0x8ded('0x2a')]);_0x3c271f[_0x8ded('0x2e')]=_[_0x8ded('0x2d')](_0x8ffc37[_0x8ded('0x2f')],qs['fields'](_0x49a1b4[_0x8ded('0x2a')]['fields']));_0x3c271f['attributes']=_0x3c271f[_0x8ded('0x2e')]['length']?_0x3c271f[_0x8ded('0x2e')]:_0x8ffc37[_0x8ded('0x2f')];if(_0x49a1b4['query'][_0x8ded('0x40')]){_0x3c271f['include']=[{'all':!![]}];}_0x3c271f=_[_0x8ded('0x37')]({},_0x3c271f,_0x49a1b4[_0x8ded('0x39')]);return db[_0x8ded('0x3a')][_0x8ded('0x41')](_0x3c271f)['then'](handleEntityNotFound(_0x20b458,null))[_0x8ded('0x22')](respondWithResult(_0x20b458,null))['catch'](handleError(_0x20b458,null));};exports[_0x8ded('0x42')]=function(_0x19c518,_0x151ba2){return db['ServicenowField']['create'](_0x19c518[_0x8ded('0x43')],{})[_0x8ded('0x22')](respondWithResult(_0x151ba2,0xc9))['catch'](handleError(_0x151ba2,null));};exports[_0x8ded('0x21')]=function(_0xf9cd71,_0x8ce61c){if(_0xf9cd71[_0x8ded('0x43')]['id']){delete _0xf9cd71[_0x8ded('0x43')]['id'];}return db[_0x8ded('0x3a')][_0x8ded('0x41')]({'where':{'id':_0xf9cd71[_0x8ded('0x3e')]['id']}})[_0x8ded('0x22')](handleEntityNotFound(_0x8ce61c,null))['then'](saveUpdates(_0xf9cd71[_0x8ded('0x43')],null))[_0x8ded('0x22')](respondWithResult(_0x8ce61c,null))[_0x8ded('0x3d')](handleError(_0x8ce61c,null));};exports[_0x8ded('0x23')]=function(_0xbf6c0,_0x42054a){return db[_0x8ded('0x3a')][_0x8ded('0x41')]({'where':{'id':_0xbf6c0[_0x8ded('0x3e')]['id']}})['then'](handleEntityNotFound(_0x42054a,null))[_0x8ded('0x22')](removeEntity(_0x42054a,null))['catch'](handleError(_0x42054a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 388972d..3afe2ad 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 _0x9105=['./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4e9f34,_0x48f276){var _0x1aaa8e=function(_0x54aa17){while(--_0x54aa17){_0x4e9f34['push'](_0x4e9f34['shift']());}};_0x1aaa8e(++_0x48f276);}(_0x9105,0xc9));var _0x5910=function(_0x7aa560,_0x2a5594){_0x7aa560=_0x7aa560-0x0;var _0x2d6ed0=_0x9105[_0x7aa560];return _0x2d6ed0;};'use strict';var _=require(_0x5910('0x0'));var util=require('util');var logger=require(_0x5910('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5910('0x2'));var rp=require(_0x5910('0x3'));var fs=require('fs');var path=require(_0x5910('0x4'));var rimraf=require(_0x5910('0x5'));var config=require(_0x5910('0x6'));var attributes=require(_0x5910('0x7'));module[_0x5910('0x8')]=function(_0x184fbb,_0x244471){return _0x184fbb[_0x5910('0x9')]('ServicenowField',attributes,{'tableName':_0x5910('0xa'),'paranoid':![],'indexes':[{'name':_0x5910('0xb'),'fields':[_0x5910('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1fa=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField','idField','FieldId'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0xa1fa,0x9c));var _0xaa1f=function(_0x34f693,_0x3dffca){_0x34f693=_0x34f693-0x0;var _0x3e9197=_0xa1fa[_0x34f693];return _0x3e9197;};'use strict';var _=require(_0xaa1f('0x0'));var util=require('util');var logger=require(_0xaa1f('0x1'))(_0xaa1f('0x2'));var moment=require(_0xaa1f('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa1f('0x4'));var fs=require('fs');var path=require(_0xaa1f('0x5'));var rimraf=require('rimraf');var config=require(_0xaa1f('0x6'));var attributes=require(_0xaa1f('0x7'));module['exports']=function(_0x4beb9a,_0x4f7d17){return _0x4beb9a[_0xaa1f('0x8')](_0xaa1f('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xaa1f('0xa'),_0xaa1f('0xb')],'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 b635f07..b58d087 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4346aa,_0x1e597e){_0x4346aa=_0x4346aa-0x0;var _0x31a809=_0xbdb7[_0x4346aa];return _0x31a809;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1b89be,_0x55ceec){var _0x55f150=function(_0xbf29fb){while(--_0xbf29fb){_0x1b89be['push'](_0x1b89be['shift']());}};_0x55f150(++_0x55ceec);}(_0xf4eb,0xec));var _0xbf4e=function(_0xbec756,_0x345863){_0xbec756=_0xbec756-0x0;var _0x9bd770=_0xf4eb[_0xbec756];return _0x9bd770;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b1b8a17..22054c6 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(_0x392270,_0x40c08c){var _0x52e4e6=function(_0x41f4bd){while(--_0x41f4bd){_0x392270['push'](_0x392270['shift']());}};_0x52e4e6(++_0x40c08c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x41eb90,_0x10a7e4){var _0x5199ed=function(_0x1b6325){while(--_0x1b6325){_0x41eb90['push'](_0x41eb90['shift']());}};_0x5199ed(++_0x10a7e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 41b6b1f..8d07a58 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(_0x283386,_0x3a1715){var _0x4bec07=function(_0x5eb973){while(--_0x5eb973){_0x283386['push'](_0x283386['shift']());}};_0x4bec07(++_0x3a1715);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x41fcef,_0x508f13){var _0x3e1346=function(_0x16a62e){while(--_0x16a62e){_0x41fcef['push'](_0x41fcef['shift']());}};_0x3e1346(++_0x508f13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 99bdfe3..3fcda76 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 _0x0a7f=['xCALLY\x20Motion\x20Integration','get_module_fields','module_fields','remove','values','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','name','map','SugarcrmAccount','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_minutes','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN'];(function(_0x285884,_0x60a068){var _0x2e7e33=function(_0x5d8155){while(--_0x5d8155){_0x285884['push'](_0x285884['shift']());}};_0x2e7e33(++_0x60a068);}(_0x0a7f,0xe6));var _0xf0a7=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0x0a7f[_0x401ccd];return _0x5a57ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0a7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0a7('0x1'));var moment=require(_0xf0a7('0x2'));var BPromise=require(_0xf0a7('0x3'));var Mustache=require(_0xf0a7('0x4'));var util=require(_0xf0a7('0x5'));var path=require(_0xf0a7('0x6'));var sox=require('sox');var csv=require(_0xf0a7('0x7'));var ejs=require(_0xf0a7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf0a7('0x9'));var crypto=require(_0xf0a7('0xa'));var jsforce=require(_0xf0a7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0a7('0x7'));var querystring=require(_0xf0a7('0xc'));var Papa=require(_0xf0a7('0xd'));var Redis=require(_0xf0a7('0xe'));var authService=require(_0xf0a7('0xf'));var qs=require(_0xf0a7('0x10'));var as=require(_0xf0a7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0a7('0x12'))('api');var utils=require(_0xf0a7('0x13'));var config=require(_0xf0a7('0x14'));var licenseUtil=require(_0xf0a7('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf0a7('0x16'));function respondWithStatusCode(_0x11c036,_0x23d5fe){_0x23d5fe=_0x23d5fe||0xcc;return function(_0x2804a8){if(_0x2804a8){return _0x11c036[_0xf0a7('0x17')](_0x23d5fe);}return _0x11c036[_0xf0a7('0x18')](_0x23d5fe)[_0xf0a7('0x19')]();};}function respondWithResult(_0x27e3b6,_0x5d5f7e){_0x5d5f7e=_0x5d5f7e||0xc8;return function(_0x2b3bae){if(_0x2b3bae){return _0x27e3b6[_0xf0a7('0x18')](_0x5d5f7e)[_0xf0a7('0x1a')](_0x2b3bae);}};}function respondWithFilteredResult(_0xaafb82,_0x3f457a){return function(_0x22a1fc){if(_0x22a1fc){var _0x163520=typeof _0x3f457a[_0xf0a7('0x1b')]===_0xf0a7('0x1c')&&typeof _0x3f457a['limit']==='undefined';var _0x196424=_0x22a1fc[_0xf0a7('0x1d')];var _0x271583=_0x163520?0x0:_0x3f457a[_0xf0a7('0x1b')];var _0x78ced8=_0x163520?_0x22a1fc[_0xf0a7('0x1d')]:_0x3f457a['offset']+_0x3f457a[_0xf0a7('0x1e')];var _0x16b98c;if(_0x78ced8>=_0x196424){_0x78ced8=_0x196424;_0x16b98c=0xc8;}else{_0x16b98c=0xce;}_0xaafb82[_0xf0a7('0x18')](_0x16b98c);return _0xaafb82['set'](_0xf0a7('0x1f'),_0x271583+'-'+_0x78ced8+'/'+_0x196424)[_0xf0a7('0x1a')](_0x22a1fc);}return null;};}function patchUpdates(_0x5ab854){return function(_0x3c7f0c){try{jsonpatch[_0xf0a7('0x20')](_0x3c7f0c,_0x5ab854,!![]);}catch(_0x1b534d){return BPromise[_0xf0a7('0x21')](_0x1b534d);}return _0x3c7f0c['save']();};}function saveUpdates(_0x49c5fc,_0x4f30d1){return function(_0x58bed1){if(_0x58bed1){return _0x58bed1[_0xf0a7('0x22')](_0x49c5fc)[_0xf0a7('0x23')](function(_0x411bc6){return _0x411bc6;});}return null;};}function removeEntity(_0xb0e2a,_0x29d9c9){return function(_0x4c56c1){if(_0x4c56c1){return _0x4c56c1['destroy']()['then'](function(){_0xb0e2a[_0xf0a7('0x18')](0xcc)[_0xf0a7('0x19')]();});}};}function handleEntityNotFound(_0x2cf972,_0x57010a){return function(_0x5798e1){if(!_0x5798e1){_0x2cf972[_0xf0a7('0x17')](0x194);}return _0x5798e1;};}function handleError(_0xa684a,_0x236b4c){_0x236b4c=_0x236b4c||0x1f4;return function(_0x1dbf6a){logger['error'](_0x1dbf6a['stack']);if(_0x1dbf6a['name']){delete _0x1dbf6a[_0xf0a7('0x24')];}_0xa684a['status'](_0x236b4c)['send'](_0x1dbf6a);};}exports['index']=function(_0x2405b0,_0x1380d6){var _0x387019={},_0x2e6b25={},_0x38d5f0={'count':0x0,'rows':[]};var _0x3be558=_[_0xf0a7('0x25')](db[_0xf0a7('0x26')]['rawAttributes'],function(_0x14a762){return{'name':_0x14a762['fieldName'],'type':_0x14a762['type']['key']};});_0x2e6b25[_0xf0a7('0x27')]=_['map'](_0x3be558,_0xf0a7('0x24'));_0x2e6b25[_0xf0a7('0x28')]=_['keys'](_0x2405b0[_0xf0a7('0x28')]);_0x2e6b25[_0xf0a7('0x29')]=_[_0xf0a7('0x2a')](_0x2e6b25['model'],_0x2e6b25['query']);_0x387019['attributes']=_[_0xf0a7('0x2a')](_0x2e6b25[_0xf0a7('0x27')],qs[_0xf0a7('0x2b')](_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x2b')]));_0x387019[_0xf0a7('0x2c')]=_0x387019[_0xf0a7('0x2c')][_0xf0a7('0x2d')]?_0x387019[_0xf0a7('0x2c')]:_0x2e6b25['model'];if(!_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x2e')](_0xf0a7('0x2f'))){_0x387019[_0xf0a7('0x1e')]=qs[_0xf0a7('0x1e')](_0x2405b0['query'][_0xf0a7('0x1e')]);_0x387019['offset']=qs[_0xf0a7('0x1b')](_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x1b')]);}_0x387019[_0xf0a7('0x30')]=qs[_0xf0a7('0x31')](_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x31')]);_0x387019['where']=qs[_0xf0a7('0x29')](_[_0xf0a7('0x32')](_0x2405b0[_0xf0a7('0x28')],_0x2e6b25[_0xf0a7('0x29')]),_0x3be558);if(_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x33')]){_0x387019[_0xf0a7('0x34')]=_[_0xf0a7('0x35')](_0x387019[_0xf0a7('0x34')],{'$or':_[_0xf0a7('0x25')](_0x3be558,function(_0x1359bb){if(_0x1359bb[_0xf0a7('0x36')]!==_0xf0a7('0x37')){var _0x52ca8e={};_0x52ca8e[_0x1359bb[_0xf0a7('0x24')]]={'$like':'%'+_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x33')]+'%'};return _0x52ca8e;}})});}_0x387019=_[_0xf0a7('0x35')]({},_0x387019,_0x2405b0[_0xf0a7('0x38')]);var _0x36098c={'where':_0x387019[_0xf0a7('0x34')]};return db[_0xf0a7('0x26')][_0xf0a7('0x1d')](_0x36098c)[_0xf0a7('0x23')](function(_0x5e1e95){_0x38d5f0[_0xf0a7('0x1d')]=_0x5e1e95;if(_0x2405b0[_0xf0a7('0x28')][_0xf0a7('0x39')]){_0x387019['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x387019);})[_0xf0a7('0x23')](function(_0x1c4cfc){_0x38d5f0[_0xf0a7('0x3a')]=_0x1c4cfc;return _0x38d5f0;})[_0xf0a7('0x23')](respondWithFilteredResult(_0x1380d6,_0x387019))[_0xf0a7('0x3b')](handleError(_0x1380d6,null));};exports[_0xf0a7('0x3c')]=function(_0x42cc54,_0x44cf8b){var _0x3278eb={'raw':![],'where':{'id':_0x42cc54[_0xf0a7('0x3d')]['id']}},_0x3c1144={};_0x3c1144['model']=_[_0xf0a7('0x3e')](db[_0xf0a7('0x26')][_0xf0a7('0x3f')]);_0x3c1144[_0xf0a7('0x28')]=_[_0xf0a7('0x3e')](_0x42cc54[_0xf0a7('0x28')]);_0x3c1144[_0xf0a7('0x29')]=_[_0xf0a7('0x2a')](_0x3c1144[_0xf0a7('0x27')],_0x3c1144[_0xf0a7('0x28')]);_0x3278eb[_0xf0a7('0x2c')]=_[_0xf0a7('0x2a')](_0x3c1144['model'],qs[_0xf0a7('0x2b')](_0x42cc54[_0xf0a7('0x28')][_0xf0a7('0x2b')]));_0x3278eb['attributes']=_0x3278eb[_0xf0a7('0x2c')][_0xf0a7('0x2d')]?_0x3278eb[_0xf0a7('0x2c')]:_0x3c1144[_0xf0a7('0x27')];if(_0x42cc54[_0xf0a7('0x28')][_0xf0a7('0x39')]){_0x3278eb[_0xf0a7('0x40')]=[{'all':!![]}];}_0x3278eb=_[_0xf0a7('0x35')]({},_0x3278eb,_0x42cc54[_0xf0a7('0x38')]);return db['SugarcrmAccount'][_0xf0a7('0x41')](_0x3278eb)[_0xf0a7('0x23')](handleEntityNotFound(_0x44cf8b,null))['then'](respondWithResult(_0x44cf8b,null))[_0xf0a7('0x3b')](handleError(_0x44cf8b,null));};exports[_0xf0a7('0x42')]=function(_0x2784f8,_0x48a2b0){return db['SugarcrmAccount'][_0xf0a7('0x42')](_0x2784f8[_0xf0a7('0x43')],{})['then'](respondWithResult(_0x48a2b0,0xc9))[_0xf0a7('0x3b')](handleError(_0x48a2b0,null));};exports['update']=function(_0x1fe20b,_0x45ce7c){if(_0x1fe20b[_0xf0a7('0x43')]['id']){delete _0x1fe20b[_0xf0a7('0x43')]['id'];}return db['SugarcrmAccount'][_0xf0a7('0x41')]({'where':{'id':_0x1fe20b[_0xf0a7('0x3d')]['id']}})[_0xf0a7('0x23')](handleEntityNotFound(_0x45ce7c,null))[_0xf0a7('0x23')](saveUpdates(_0x1fe20b[_0xf0a7('0x43')],null))[_0xf0a7('0x23')](respondWithResult(_0x45ce7c,null))[_0xf0a7('0x3b')](handleError(_0x45ce7c,null));};exports['destroy']=function(_0x579fd8,_0x325f0d){return db[_0xf0a7('0x26')][_0xf0a7('0x41')]({'where':{'id':_0x579fd8[_0xf0a7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x325f0d,null))['then'](removeEntity(_0x325f0d,null))[_0xf0a7('0x3b')](handleError(_0x325f0d,null));};exports[_0xf0a7('0x44')]=function(_0x24a18f,_0x11d90e,_0x424e98){var _0x5ea63a={};var _0x525aa4={};var _0x3a356d;var _0x42d281;return db[_0xf0a7('0x26')][_0xf0a7('0x45')]({'where':{'id':_0x24a18f[_0xf0a7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x11d90e,null))[_0xf0a7('0x23')](function(_0x222a9c){if(_0x222a9c){_0x3a356d=_0x222a9c;_0x525aa4['model']=_[_0xf0a7('0x3e')](db[_0xf0a7('0x46')][_0xf0a7('0x3f')]);_0x525aa4[_0xf0a7('0x28')]=_[_0xf0a7('0x3e')](_0x24a18f[_0xf0a7('0x28')]);_0x525aa4[_0xf0a7('0x29')]=_[_0xf0a7('0x2a')](_0x525aa4[_0xf0a7('0x27')],_0x525aa4[_0xf0a7('0x28')]);_0x5ea63a[_0xf0a7('0x2c')]=_['intersection'](_0x525aa4[_0xf0a7('0x27')],qs[_0xf0a7('0x2b')](_0x24a18f[_0xf0a7('0x28')]['fields']));_0x5ea63a[_0xf0a7('0x2c')]=_0x5ea63a[_0xf0a7('0x2c')]['length']?_0x5ea63a[_0xf0a7('0x2c')]:_0x525aa4[_0xf0a7('0x27')];_0x5ea63a['order']=qs[_0xf0a7('0x31')](_0x24a18f[_0xf0a7('0x28')][_0xf0a7('0x31')]);_0x5ea63a[_0xf0a7('0x34')]=qs[_0xf0a7('0x29')](_[_0xf0a7('0x32')](_0x24a18f[_0xf0a7('0x28')],_0x525aa4[_0xf0a7('0x29')]));if(_0x24a18f['query'][_0xf0a7('0x33')]){_0x5ea63a['where']=_[_0xf0a7('0x35')](_0x5ea63a['where'],{'$or':_[_0xf0a7('0x25')](_0x5ea63a[_0xf0a7('0x2c')],function(_0x1537d2){var _0x2535ce={};_0x2535ce[_0x1537d2]={'$like':'%'+_0x24a18f[_0xf0a7('0x28')][_0xf0a7('0x33')]+'%'};return _0x2535ce;})});}_0x5ea63a=_[_0xf0a7('0x35')]({},_0x5ea63a,_0x24a18f['options']);return _0x3a356d[_0xf0a7('0x44')](_0x5ea63a);}})[_0xf0a7('0x23')](function(_0x48d294){if(_0x48d294){_0x42d281=_0x48d294['length'];if(!_0x24a18f['query'][_0xf0a7('0x2e')]('nolimit')){_0x5ea63a[_0xf0a7('0x1e')]=qs[_0xf0a7('0x1e')](_0x24a18f[_0xf0a7('0x28')]['limit']);_0x5ea63a[_0xf0a7('0x1b')]=qs['offset'](_0x24a18f[_0xf0a7('0x28')][_0xf0a7('0x1b')]);}return _0x3a356d[_0xf0a7('0x44')](_0x5ea63a);}})[_0xf0a7('0x23')](function(_0x244eda){if(_0x244eda){return _0x244eda?{'count':_0x42d281,'rows':_0x244eda}:null;}})[_0xf0a7('0x23')](respondWithResult(_0x11d90e,null))[_0xf0a7('0x3b')](handleError(_0x11d90e,null));};exports[_0xf0a7('0x47')]=function(_0x48de9a,_0x307835,_0x1a01f3){if(_0x48de9a[_0xf0a7('0x43')]['id']){delete _0x48de9a[_0xf0a7('0x43')]['id'];}return db[_0xf0a7('0x26')]['findOne']({'where':{'id':_0x48de9a[_0xf0a7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x307835,null))[_0xf0a7('0x23')](function(_0x164f35){if(_0x164f35){_0x48de9a['body'][_0xf0a7('0x48')]=_0x164f35['id'];_0x48de9a[_0xf0a7('0x43')][_0xf0a7('0x49')]=integrations[_0xf0a7('0x4a')](_0x48de9a[_0xf0a7('0x43')][_0xf0a7('0x4b')],_0x48de9a['body'][_0xf0a7('0x36')]);_0x48de9a[_0xf0a7('0x43')][_0xf0a7('0x4c')]=integrations['getDescriptions'](_0x48de9a[_0xf0a7('0x43')][_0xf0a7('0x4b')],_0x48de9a[_0xf0a7('0x43')][_0xf0a7('0x36')]);return db[_0xf0a7('0x46')][_0xf0a7('0x42')](_0x48de9a[_0xf0a7('0x43')],{'include':[{'model':db[_0xf0a7('0x4d')],'as':_0xf0a7('0x49')},{'model':db[_0xf0a7('0x4d')],'as':_0xf0a7('0x4c')}]});}return null;})['then'](respondWithResult(_0x307835,null))[_0xf0a7('0x3b')](handleError(_0x307835,null));};exports['getFields']=function(_0x1e869a,_0x39ae71,_0x49bfa2){var _0x3733ff='';var _0x429af1=['id',_0xf0a7('0x24'),_0xf0a7('0x4e'),_0xf0a7('0x4f'),'description',_0xf0a7('0x50'),'duration_hours',_0xf0a7('0x51'),'parent_id',_0xf0a7('0x52'),_0xf0a7('0x53'),'direction'];return db[_0xf0a7('0x26')][_0xf0a7('0x45')]({'where':{'id':_0x1e869a[_0xf0a7('0x3d')]['id']},'attributes':['id','username',_0xf0a7('0x54'),_0xf0a7('0x55')]})[_0xf0a7('0x23')](handleEntityNotFound(_0x39ae71,null))[_0xf0a7('0x23')](function(_0x4c9440){if(_0x4c9440){_0x3733ff=_0x4c9440[_0xf0a7('0x55')];var _0x3c7584=_0x3733ff[_0xf0a7('0x56')](-0x1);if(_0x3c7584==='/'){_0x3733ff=_0x3733ff[_0xf0a7('0x57')](0x0,_0x3733ff[_0xf0a7('0x58')](_0x3c7584));}return rp({'method':_0xf0a7('0x59'),'uri':util[_0xf0a7('0x5a')](_0xf0a7('0x5b'),_0x3733ff,_0xf0a7('0x5c')),'json':!![],'form':{'method':_0xf0a7('0x5d'),'input_type':_0xf0a7('0x5e'),'response_type':_0xf0a7('0x5e'),'rest_data':JSON[_0xf0a7('0x5f')]({'user_auth':{'user_name':_0x4c9440['username'],'password':_0x4c9440['password'],'encryption':_0xf0a7('0x60')},'application':_0xf0a7('0x61')})}});}})[_0xf0a7('0x23')](function(_0x21fa21){if(_0x21fa21&&_0x21fa21['name']!=='Invalid\x20Login'&&_0x21fa21[_0xf0a7('0x24')]!=='Password\x20Expired'){return rp({'method':_0xf0a7('0x59'),'uri':util['format'](_0xf0a7('0x5b'),_0x3733ff,_0xf0a7('0x5c')),'json':!![],'form':{'method':_0xf0a7('0x62'),'input_type':_0xf0a7('0x5e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x21fa21['id'],'module_name':'Calls'})}})[_0xf0a7('0x23')](function(_0x17a8f1){if(_0x17a8f1){var _0x54e68c=_['values'](_0x17a8f1[_0xf0a7('0x63')]);_[_0xf0a7('0x64')](_0x54e68c,function(_0x2eb43f){return _0x429af1['includes'](_0x2eb43f['name']);});return{'count':_0x54e68c[_0xf0a7('0x2d')],'rows':_[_0xf0a7('0x25')](_0x54e68c,function(_0x5208bc){return{'id':_0x5208bc[_0xf0a7('0x24')],'name':_0x5208bc['label'],'custom':_['endsWith'](_0x5208bc[_0xf0a7('0x24')],'_c')?!![]:![],'options':_0x5208bc[_0xf0a7('0x38')]?_[_0xf0a7('0x25')](_[_0xf0a7('0x65')](_0x5208bc[_0xf0a7('0x38')]),function(_0x5bd6ce){return{'name':_0x5bd6ce['value'],'value':_0x5bd6ce[_0xf0a7('0x24')]};}):[]};})};}})[_0xf0a7('0x23')](respondWithResult(_0x39ae71,null))[_0xf0a7('0x3b')](function(_0x12db8e){var _0x31f058=_0x1e869a[_0xf0a7('0x28')][_0xf0a7('0x66')]?0x1f4:_0x12db8e[_0xf0a7('0x67')]||0x1f4;logger[_0xf0a7('0x68')](_0xf0a7('0x69'),_0xf0a7('0x6a'),_0x31f058,JSON[_0xf0a7('0x5f')](_0x12db8e));delete _0x12db8e[_0xf0a7('0x24')];if(_0x31f058===0x191){_0x31f058=0x190;}_0x39ae71[_0xf0a7('0x18')](_0x31f058)[_0xf0a7('0x6b')](_0x1e869a[_0xf0a7('0x28')][_0xf0a7('0x66')]?{'message':_0xf0a7('0x6c'),'statusCode':_0x12db8e['statusCode']}:_0x12db8e);});}else{var _0xaf7af9=0x1f4;_0x39ae71[_0xf0a7('0x18')](_0xaf7af9)[_0xf0a7('0x6b')]({'message':_0xf0a7('0x6c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xf3a6=['rawAttributes','intersection','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','parent_type','direction','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','username','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','catch'];(function(_0x5d09d5,_0x550022){var _0x226f63=function(_0x28cb72){while(--_0x28cb72){_0x5d09d5['push'](_0x5d09d5['shift']());}};_0x226f63(++_0x550022);}(_0xf3a6,0xa0));var _0x6f3a=function(_0xc7ed29,_0x515330){_0xc7ed29=_0xc7ed29-0x0;var _0xf8da19=_0xf3a6[_0xc7ed29];return _0xf8da19;};'use strict';var emlformat=require(_0x6f3a('0x0'));var rimraf=require(_0x6f3a('0x1'));var zipdir=require(_0x6f3a('0x2'));var jsonpatch=require(_0x6f3a('0x3'));var rp=require(_0x6f3a('0x4'));var moment=require(_0x6f3a('0x5'));var BPromise=require(_0x6f3a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f3a('0x7'));var sox=require(_0x6f3a('0x8'));var csv=require('to-csv');var ejs=require(_0x6f3a('0x9'));var fs=require('fs');var fs_extra=require(_0x6f3a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f3a('0xb'));var jsforce=require(_0x6f3a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f3a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f3a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f3a('0xf'));var logger=require(_0x6f3a('0x10'))('api');var utils=require(_0x6f3a('0x11'));var config=require(_0x6f3a('0x12'));var licenseUtil=require(_0x6f3a('0x13'));var db=require(_0x6f3a('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x194c72,_0x4c8355){_0x4c8355=_0x4c8355||0xcc;return function(_0x32623f){if(_0x32623f){return _0x194c72[_0x6f3a('0x15')](_0x4c8355);}return _0x194c72[_0x6f3a('0x16')](_0x4c8355)[_0x6f3a('0x17')]();};}function respondWithResult(_0x155f1d,_0x4db26d){_0x4db26d=_0x4db26d||0xc8;return function(_0x4a140f){if(_0x4a140f){return _0x155f1d[_0x6f3a('0x16')](_0x4db26d)[_0x6f3a('0x18')](_0x4a140f);}};}function respondWithFilteredResult(_0x1be5b1,_0x3d46e0){return function(_0x22ec83){if(_0x22ec83){var _0x40a9df=typeof _0x3d46e0[_0x6f3a('0x19')]===_0x6f3a('0x1a')&&typeof _0x3d46e0[_0x6f3a('0x1b')]===_0x6f3a('0x1a');var _0x3d22b1=_0x22ec83[_0x6f3a('0x1c')];var _0x1ad5fb=_0x40a9df?0x0:_0x3d46e0[_0x6f3a('0x19')];var _0x296d01=_0x40a9df?_0x22ec83['count']:_0x3d46e0[_0x6f3a('0x19')]+_0x3d46e0['limit'];var _0x4540f1;if(_0x296d01>=_0x3d22b1){_0x296d01=_0x3d22b1;_0x4540f1=0xc8;}else{_0x4540f1=0xce;}_0x1be5b1[_0x6f3a('0x16')](_0x4540f1);return _0x1be5b1[_0x6f3a('0x1d')](_0x6f3a('0x1e'),_0x1ad5fb+'-'+_0x296d01+'/'+_0x3d22b1)['json'](_0x22ec83);}return null;};}function patchUpdates(_0x4375fa){return function(_0x1e7f1f){try{jsonpatch['apply'](_0x1e7f1f,_0x4375fa,!![]);}catch(_0x2ca0fc){return BPromise['reject'](_0x2ca0fc);}return _0x1e7f1f[_0x6f3a('0x1f')]();};}function saveUpdates(_0x564f46,_0x32ce5e){return function(_0x31dfcb){if(_0x31dfcb){return _0x31dfcb['update'](_0x564f46)[_0x6f3a('0x20')](function(_0x197a18){return _0x197a18;});}return null;};}function removeEntity(_0x46aa00,_0x2d51f7){return function(_0x5eec5d){if(_0x5eec5d){return _0x5eec5d[_0x6f3a('0x21')]()[_0x6f3a('0x20')](function(){_0x46aa00['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x431451,_0xffa48b){return function(_0x672955){if(!_0x672955){_0x431451[_0x6f3a('0x15')](0x194);}return _0x672955;};}function handleError(_0x97a0a1,_0x25d4a8){_0x25d4a8=_0x25d4a8||0x1f4;return function(_0x27cc07){logger[_0x6f3a('0x22')](_0x27cc07[_0x6f3a('0x23')]);if(_0x27cc07[_0x6f3a('0x24')]){delete _0x27cc07['name'];}_0x97a0a1[_0x6f3a('0x16')](_0x25d4a8)[_0x6f3a('0x25')](_0x27cc07);};}exports[_0x6f3a('0x26')]=function(_0x57f883,_0x591e3e){var _0x56aea5={},_0xdcba34={},_0xab4612={'count':0x0,'rows':[]};var _0x1b6451=_[_0x6f3a('0x27')](db[_0x6f3a('0x28')]['rawAttributes'],function(_0x2c395a){return{'name':_0x2c395a[_0x6f3a('0x29')],'type':_0x2c395a[_0x6f3a('0x2a')][_0x6f3a('0x2b')]};});_0xdcba34[_0x6f3a('0x2c')]=_[_0x6f3a('0x27')](_0x1b6451,_0x6f3a('0x24'));_0xdcba34[_0x6f3a('0x2d')]=_[_0x6f3a('0x2e')](_0x57f883[_0x6f3a('0x2d')]);_0xdcba34[_0x6f3a('0x2f')]=_['intersection'](_0xdcba34[_0x6f3a('0x2c')],_0xdcba34[_0x6f3a('0x2d')]);_0x56aea5[_0x6f3a('0x30')]=_['intersection'](_0xdcba34[_0x6f3a('0x2c')],qs[_0x6f3a('0x31')](_0x57f883[_0x6f3a('0x2d')][_0x6f3a('0x31')]));_0x56aea5[_0x6f3a('0x30')]=_0x56aea5[_0x6f3a('0x30')][_0x6f3a('0x32')]?_0x56aea5['attributes']:_0xdcba34[_0x6f3a('0x2c')];if(!_0x57f883[_0x6f3a('0x2d')][_0x6f3a('0x33')](_0x6f3a('0x34'))){_0x56aea5[_0x6f3a('0x1b')]=qs[_0x6f3a('0x1b')](_0x57f883['query'][_0x6f3a('0x1b')]);_0x56aea5[_0x6f3a('0x19')]=qs[_0x6f3a('0x19')](_0x57f883[_0x6f3a('0x2d')]['offset']);}_0x56aea5[_0x6f3a('0x35')]=qs[_0x6f3a('0x36')](_0x57f883[_0x6f3a('0x2d')]['sort']);_0x56aea5['where']=qs[_0x6f3a('0x2f')](_[_0x6f3a('0x37')](_0x57f883['query'],_0xdcba34[_0x6f3a('0x2f')]),_0x1b6451);if(_0x57f883[_0x6f3a('0x2d')][_0x6f3a('0x38')]){_0x56aea5[_0x6f3a('0x39')]=_[_0x6f3a('0x3a')](_0x56aea5['where'],{'$or':_['map'](_0x1b6451,function(_0xfb3897){if(_0xfb3897[_0x6f3a('0x2a')]!=='VIRTUAL'){var _0x5bb6b7={};_0x5bb6b7[_0xfb3897['name']]={'$like':'%'+_0x57f883[_0x6f3a('0x2d')][_0x6f3a('0x38')]+'%'};return _0x5bb6b7;}})});}_0x56aea5=_['merge']({},_0x56aea5,_0x57f883[_0x6f3a('0x3b')]);var _0x5051c9={'where':_0x56aea5['where']};return db['SugarcrmAccount'][_0x6f3a('0x1c')](_0x5051c9)[_0x6f3a('0x20')](function(_0x29d80d){_0xab4612[_0x6f3a('0x1c')]=_0x29d80d;if(_0x57f883[_0x6f3a('0x2d')]['includeAll']){_0x56aea5[_0x6f3a('0x3c')]=[{'all':!![]}];}return db[_0x6f3a('0x28')]['findAll'](_0x56aea5);})[_0x6f3a('0x20')](function(_0x11e321){_0xab4612['rows']=_0x11e321;return _0xab4612;})[_0x6f3a('0x20')](respondWithFilteredResult(_0x591e3e,_0x56aea5))[_0x6f3a('0x3d')](handleError(_0x591e3e,null));};exports['show']=function(_0x977859,_0x28b6f4){var _0x4c7201={'raw':![],'where':{'id':_0x977859['params']['id']}},_0x1f2360={};_0x1f2360[_0x6f3a('0x2c')]=_['keys'](db[_0x6f3a('0x28')][_0x6f3a('0x3e')]);_0x1f2360[_0x6f3a('0x2d')]=_[_0x6f3a('0x2e')](_0x977859[_0x6f3a('0x2d')]);_0x1f2360['filters']=_[_0x6f3a('0x3f')](_0x1f2360[_0x6f3a('0x2c')],_0x1f2360[_0x6f3a('0x2d')]);_0x4c7201[_0x6f3a('0x30')]=_[_0x6f3a('0x3f')](_0x1f2360[_0x6f3a('0x2c')],qs['fields'](_0x977859[_0x6f3a('0x2d')][_0x6f3a('0x31')]));_0x4c7201[_0x6f3a('0x30')]=_0x4c7201[_0x6f3a('0x30')]['length']?_0x4c7201[_0x6f3a('0x30')]:_0x1f2360[_0x6f3a('0x2c')];if(_0x977859[_0x6f3a('0x2d')]['includeAll']){_0x4c7201[_0x6f3a('0x3c')]=[{'all':!![]}];}_0x4c7201=_[_0x6f3a('0x3a')]({},_0x4c7201,_0x977859[_0x6f3a('0x3b')]);return db[_0x6f3a('0x28')][_0x6f3a('0x40')](_0x4c7201)['then'](handleEntityNotFound(_0x28b6f4,null))[_0x6f3a('0x20')](respondWithResult(_0x28b6f4,null))['catch'](handleError(_0x28b6f4,null));};exports['create']=function(_0x5a73b2,_0xb33a55){return db[_0x6f3a('0x28')][_0x6f3a('0x41')](_0x5a73b2[_0x6f3a('0x42')],{})[_0x6f3a('0x20')](respondWithResult(_0xb33a55,0xc9))[_0x6f3a('0x3d')](handleError(_0xb33a55,null));};exports['update']=function(_0x3698e5,_0x2d12ca){if(_0x3698e5['body']['id']){delete _0x3698e5[_0x6f3a('0x42')]['id'];}return db['SugarcrmAccount'][_0x6f3a('0x40')]({'where':{'id':_0x3698e5['params']['id']}})[_0x6f3a('0x20')](handleEntityNotFound(_0x2d12ca,null))[_0x6f3a('0x20')](saveUpdates(_0x3698e5['body'],null))[_0x6f3a('0x20')](respondWithResult(_0x2d12ca,null))['catch'](handleError(_0x2d12ca,null));};exports[_0x6f3a('0x21')]=function(_0x556d36,_0xdaea31){return db[_0x6f3a('0x28')]['find']({'where':{'id':_0x556d36[_0x6f3a('0x43')]['id']}})[_0x6f3a('0x20')](handleEntityNotFound(_0xdaea31,null))[_0x6f3a('0x20')](removeEntity(_0xdaea31,null))['catch'](handleError(_0xdaea31,null));};exports[_0x6f3a('0x44')]=function(_0x24545a,_0x27c082,_0x2c99e9){var _0x1e34d6={};var _0x51d78f={};var _0x41c631;var _0x4609d3;return db[_0x6f3a('0x28')][_0x6f3a('0x45')]({'where':{'id':_0x24545a[_0x6f3a('0x43')]['id']}})['then'](handleEntityNotFound(_0x27c082,null))[_0x6f3a('0x20')](function(_0x1b8eb4){if(_0x1b8eb4){_0x41c631=_0x1b8eb4;_0x51d78f[_0x6f3a('0x2c')]=_['keys'](db[_0x6f3a('0x46')][_0x6f3a('0x3e')]);_0x51d78f['query']=_[_0x6f3a('0x2e')](_0x24545a[_0x6f3a('0x2d')]);_0x51d78f[_0x6f3a('0x2f')]=_[_0x6f3a('0x3f')](_0x51d78f[_0x6f3a('0x2c')],_0x51d78f['query']);_0x1e34d6[_0x6f3a('0x30')]=_[_0x6f3a('0x3f')](_0x51d78f[_0x6f3a('0x2c')],qs[_0x6f3a('0x31')](_0x24545a['query'][_0x6f3a('0x31')]));_0x1e34d6[_0x6f3a('0x30')]=_0x1e34d6[_0x6f3a('0x30')][_0x6f3a('0x32')]?_0x1e34d6[_0x6f3a('0x30')]:_0x51d78f['model'];_0x1e34d6[_0x6f3a('0x35')]=qs[_0x6f3a('0x36')](_0x24545a['query'][_0x6f3a('0x36')]);_0x1e34d6[_0x6f3a('0x39')]=qs['filters'](_['pick'](_0x24545a[_0x6f3a('0x2d')],_0x51d78f[_0x6f3a('0x2f')]));if(_0x24545a['query'][_0x6f3a('0x38')]){_0x1e34d6[_0x6f3a('0x39')]=_[_0x6f3a('0x3a')](_0x1e34d6[_0x6f3a('0x39')],{'$or':_[_0x6f3a('0x27')](_0x1e34d6['attributes'],function(_0x417567){var _0x57b9fa={};_0x57b9fa[_0x417567]={'$like':'%'+_0x24545a['query']['filter']+'%'};return _0x57b9fa;})});}_0x1e34d6=_[_0x6f3a('0x3a')]({},_0x1e34d6,_0x24545a[_0x6f3a('0x3b')]);return _0x41c631[_0x6f3a('0x44')](_0x1e34d6);}})[_0x6f3a('0x20')](function(_0x51ef1f){if(_0x51ef1f){_0x4609d3=_0x51ef1f[_0x6f3a('0x32')];if(!_0x24545a[_0x6f3a('0x2d')][_0x6f3a('0x33')]('nolimit')){_0x1e34d6['limit']=qs[_0x6f3a('0x1b')](_0x24545a['query']['limit']);_0x1e34d6[_0x6f3a('0x19')]=qs['offset'](_0x24545a[_0x6f3a('0x2d')][_0x6f3a('0x19')]);}return _0x41c631[_0x6f3a('0x44')](_0x1e34d6);}})[_0x6f3a('0x20')](function(_0x14f027){if(_0x14f027){return _0x14f027?{'count':_0x4609d3,'rows':_0x14f027}:null;}})[_0x6f3a('0x20')](respondWithResult(_0x27c082,null))['catch'](handleError(_0x27c082,null));};exports[_0x6f3a('0x47')]=function(_0x2fb8f8,_0x445b9e,_0x4be14f){if(_0x2fb8f8[_0x6f3a('0x42')]['id']){delete _0x2fb8f8['body']['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2fb8f8[_0x6f3a('0x43')]['id']}})[_0x6f3a('0x20')](handleEntityNotFound(_0x445b9e,null))['then'](function(_0x1ba32e){if(_0x1ba32e){_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x48')]=_0x1ba32e['id'];_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x49')]=integrations[_0x6f3a('0x4a')](_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x4b')],_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x2a')]);_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x4c')]=integrations['getDescriptions'](_0x2fb8f8[_0x6f3a('0x42')][_0x6f3a('0x4b')],_0x2fb8f8['body'][_0x6f3a('0x2a')]);return db['SugarcrmConfiguration'][_0x6f3a('0x41')](_0x2fb8f8[_0x6f3a('0x42')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x6f3a('0x4c')}]});}return null;})[_0x6f3a('0x20')](respondWithResult(_0x445b9e,null))[_0x6f3a('0x3d')](handleError(_0x445b9e,null));};exports[_0x6f3a('0x4d')]=function(_0x5aea25,_0x3f22db,_0x4f982f){var _0x2cceca='';var _0x4070e=['id',_0x6f3a('0x24'),_0x6f3a('0x4e'),_0x6f3a('0x4f'),_0x6f3a('0x50'),'date_start',_0x6f3a('0x51'),'duration_minutes','parent_id',_0x6f3a('0x52'),'parent_name',_0x6f3a('0x53')];return db['SugarcrmAccount'][_0x6f3a('0x45')]({'where':{'id':_0x5aea25[_0x6f3a('0x43')]['id']},'attributes':['id','username',_0x6f3a('0x54'),_0x6f3a('0x55')]})[_0x6f3a('0x20')](handleEntityNotFound(_0x3f22db,null))[_0x6f3a('0x20')](function(_0x3b5e00){if(_0x3b5e00){_0x2cceca=_0x3b5e00[_0x6f3a('0x55')];var _0x37b48f=_0x2cceca[_0x6f3a('0x56')](-0x1);if(_0x37b48f==='/'){_0x2cceca=_0x2cceca['substring'](0x0,_0x2cceca[_0x6f3a('0x57')](_0x37b48f));}return rp({'method':_0x6f3a('0x58'),'uri':util[_0x6f3a('0x59')](_0x6f3a('0x5a'),_0x2cceca,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6f3a('0x5b'),'input_type':_0x6f3a('0x5c'),'response_type':_0x6f3a('0x5c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3b5e00[_0x6f3a('0x5d')],'password':_0x3b5e00[_0x6f3a('0x54')],'encryption':_0x6f3a('0x5e')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6f3a('0x20')](function(_0x568b59){if(_0x568b59&&_0x568b59[_0x6f3a('0x24')]!==_0x6f3a('0x5f')&&_0x568b59[_0x6f3a('0x24')]!==_0x6f3a('0x60')){return rp({'method':_0x6f3a('0x58'),'uri':util[_0x6f3a('0x59')]('%s%s',_0x2cceca,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6f3a('0x61'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x568b59['id'],'module_name':_0x6f3a('0x62')})}})[_0x6f3a('0x20')](function(_0x232a4d){if(_0x232a4d){var _0x376ce6=_['values'](_0x232a4d[_0x6f3a('0x63')]);_[_0x6f3a('0x64')](_0x376ce6,function(_0x4ed31c){return _0x4070e[_0x6f3a('0x65')](_0x4ed31c[_0x6f3a('0x24')]);});return{'count':_0x376ce6[_0x6f3a('0x32')],'rows':_[_0x6f3a('0x27')](_0x376ce6,function(_0x243c4a){return{'id':_0x243c4a['name'],'name':_0x243c4a[_0x6f3a('0x66')],'custom':_[_0x6f3a('0x67')](_0x243c4a[_0x6f3a('0x24')],'_c')?!![]:![],'options':_0x243c4a[_0x6f3a('0x3b')]?_[_0x6f3a('0x27')](_[_0x6f3a('0x68')](_0x243c4a[_0x6f3a('0x3b')]),function(_0x2f8b10){return{'name':_0x2f8b10[_0x6f3a('0x69')],'value':_0x2f8b10[_0x6f3a('0x24')]};}):[]};})};}})['then'](respondWithResult(_0x3f22db,null))[_0x6f3a('0x3d')](function(_0x546967){var _0x1610a2=_0x5aea25[_0x6f3a('0x2d')]['test']?0x1f4:_0x546967[_0x6f3a('0x6a')]||0x1f4;logger[_0x6f3a('0x22')](_0x6f3a('0x6b'),_0x6f3a('0x4d'),_0x1610a2,JSON[_0x6f3a('0x6c')](_0x546967));delete _0x546967[_0x6f3a('0x24')];if(_0x1610a2===0x191){_0x1610a2=0x190;}_0x3f22db[_0x6f3a('0x16')](_0x1610a2)[_0x6f3a('0x25')](_0x5aea25[_0x6f3a('0x2d')][_0x6f3a('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x546967[_0x6f3a('0x6a')]}:_0x546967);});}else{var _0x57bcda=0x1f4;_0x3f22db[_0x6f3a('0x16')](_0x57bcda)[_0x6f3a('0x25')]({'message':_0x6f3a('0x6e'),'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 2fb0754..05a1abf 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 _0x23b8=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x23b8,0xb9));var _0x823b=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0x23b8[_0x1f404a];return _0x2cdcd5;};'use strict';var _=require(_0x823b('0x0'));var util=require(_0x823b('0x1'));var logger=require(_0x823b('0x2'))(_0x823b('0x3'));var moment=require(_0x823b('0x4'));var BPromise=require(_0x823b('0x5'));var rp=require(_0x823b('0x6'));var fs=require('fs');var path=require(_0x823b('0x7'));var rimraf=require(_0x823b('0x8'));var config=require(_0x823b('0x9'));var attributes=require(_0x823b('0xa'));var integrations=require(_0x823b('0xb'));module['exports']=function(_0x591ecd,_0x196bb3){return _0x591ecd[_0x823b('0xc')](_0x823b('0xd'),attributes,{'tableName':_0x823b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x242c=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x52d5d9,_0x24bc67){var _0x2507c4=function(_0x266b20){while(--_0x266b20){_0x52d5d9['push'](_0x52d5d9['shift']());}};_0x2507c4(++_0x24bc67);}(_0x242c,0xfb));var _0xc242=function(_0x2a7967,_0x54deef){_0x2a7967=_0x2a7967-0x0;var _0x195477=_0x242c[_0x2a7967];return _0x195477;};'use strict';var _=require(_0xc242('0x0'));var util=require(_0xc242('0x1'));var logger=require(_0xc242('0x2'))(_0xc242('0x3'));var moment=require(_0xc242('0x4'));var BPromise=require('bluebird');var rp=require(_0xc242('0x5'));var fs=require('fs');var path=require(_0xc242('0x6'));var rimraf=require(_0xc242('0x7'));var config=require(_0xc242('0x8'));var attributes=require(_0xc242('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xc242('0xa')]=function(_0x1cc0cd,_0x45bfe1){return _0x1cc0cd[_0xc242('0xb')](_0xc242('0xc'),attributes,{'tableName':_0xc242('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 b219d27..66dbae1 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 _0xf05e=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowSugarcrmAccount','find','where','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x275630,_0x4d6438){var _0x4a5645=function(_0x455e3c){while(--_0x455e3c){_0x275630['push'](_0x275630['shift']());}};_0x4a5645(++_0x4d6438);}(_0xf05e,0x13a));var _0xef05=function(_0x747f4d,_0x159f21){_0x747f4d=_0x747f4d-0x0;var _0xdad964=_0xf05e[_0x747f4d];return _0xdad964;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xef05('0x0'));var rs=require(_0xef05('0x1'));var fs=require('fs');var Redis=require(_0xef05('0x2'));var db=require(_0xef05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xef05('0x4'))(_0xef05('0x5'));var config=require(_0xef05('0x6'));var jayson=require(_0xef05('0x7'));var client=jayson[_0xef05('0x8')][_0xef05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346c53,_0x2ff87d,_0x2eb128){return new BPromise(function(_0x4b0667,_0x5b1b7f){return client[_0xef05('0xa')](_0x346c53,_0x2eb128)['then'](function(_0x4e1f21){logger[_0xef05('0xb')](_0xef05('0xc'),_0x2ff87d,_0xef05('0xd'));logger[_0xef05('0xe')](_0xef05('0xf'),_0x2ff87d,'request\x20sent',JSON[_0xef05('0x10')](_0x4e1f21));if(_0x4e1f21[_0xef05('0x11')]){if(_0x4e1f21[_0xef05('0x11')][_0xef05('0x12')]===0x1f4){logger[_0xef05('0x11')](_0xef05('0xc'),_0x2ff87d,_0x4e1f21[_0xef05('0x11')][_0xef05('0x13')]);return _0x5b1b7f(_0x4e1f21[_0xef05('0x11')][_0xef05('0x13')]);}logger[_0xef05('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ff87d,_0x4e1f21[_0xef05('0x11')][_0xef05('0x13')]);return _0x4b0667(_0x4e1f21['error']['message']);}else{logger[_0xef05('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ff87d,_0xef05('0xd'));_0x4b0667(_0x4e1f21[_0xef05('0x14')][_0xef05('0x13')]);}})[_0xef05('0x15')](function(_0x33aa8c){logger[_0xef05('0x11')](_0xef05('0xc'),_0x2ff87d,_0x33aa8c);_0x5b1b7f(_0x33aa8c);});});}exports[_0xef05('0x16')]=function(_0x5f3f52){var _0x3fe21e=this;return new Promise(function(_0x5edd5e,_0x40029a){return db[_0xef05('0x17')][_0xef05('0x18')]({'raw':_0x5f3f52[_0xef05('0x19')]?_0x5f3f52[_0xef05('0x19')][_0xef05('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f3f52[_0xef05('0x19')]?_0x5f3f52[_0xef05('0x19')]['where']||null:null,'attributes':_0x5f3f52['options']?_0x5f3f52['options'][_0xef05('0x1b')]||null:null,'limit':_0x5f3f52[_0xef05('0x19')]?_0x5f3f52['options'][_0xef05('0x1c')]||null:null,'include':_0x5f3f52[_0xef05('0x19')]?_0x5f3f52[_0xef05('0x19')][_0xef05('0x1d')]?_[_0xef05('0x1e')](_0x5f3f52[_0xef05('0x19')]['include'],function(_0x47e884){return{'model':db[_0x47e884[_0xef05('0x1f')]],'as':_0x47e884['as'],'attributes':_0x47e884[_0xef05('0x1b')],'include':_0x47e884[_0xef05('0x1d')]?_[_0xef05('0x1e')](_0x47e884[_0xef05('0x1d')],function(_0x41589c){return{'model':db[_0x41589c[_0xef05('0x1f')]],'as':_0x41589c['as'],'attributes':_0x41589c[_0xef05('0x1b')],'include':_0x41589c['include']?_[_0xef05('0x1e')](_0x41589c[_0xef05('0x1d')],function(_0x418b04){return{'model':db[_0x418b04[_0xef05('0x1f')]],'as':_0x418b04['as'],'attributes':_0x418b04['attributes']};}):[]};}):[]};}):[]:[]})[_0xef05('0x20')](function(_0x2bbbb1){logger['info'](_0xef05('0x16'),_0x5f3f52);logger['debug']('GetSugarcrmAccount',_0x5f3f52,JSON['stringify'](_0x2bbbb1));_0x5edd5e(_0x2bbbb1);})['catch'](function(_0x17638c){logger[_0xef05('0x11')]('GetSugarcrmAccount',_0x17638c['message'],_0x5f3f52);_0x40029a(_0x3fe21e[_0xef05('0x11')](0x1f4,_0x17638c[_0xef05('0x13')]));});});};exports[_0xef05('0x21')]=function(_0x1d9c65){var _0x303061=this;return new Promise(function(_0x3069d7,_0x2e3994){return db['SugarcrmAccount'][_0xef05('0x22')]({'raw':_0x1d9c65[_0xef05('0x19')]?_0x1d9c65[_0xef05('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d9c65[_0xef05('0x19')]?_0x1d9c65[_0xef05('0x19')][_0xef05('0x23')]||null:null,'attributes':_0x1d9c65[_0xef05('0x19')]?_0x1d9c65['options']['attributes']||null:null,'include':_0x1d9c65[_0xef05('0x19')]?_0x1d9c65[_0xef05('0x19')][_0xef05('0x1d')]?_[_0xef05('0x1e')](_0x1d9c65[_0xef05('0x19')]['include'],function(_0x4bce6a){return{'model':db[_0x4bce6a[_0xef05('0x1f')]],'as':_0x4bce6a['as'],'attributes':_0x4bce6a[_0xef05('0x1b')],'include':_0x4bce6a[_0xef05('0x1d')]?_[_0xef05('0x1e')](_0x4bce6a[_0xef05('0x1d')],function(_0x38ee01){return{'model':db[_0x38ee01[_0xef05('0x1f')]],'as':_0x38ee01['as'],'attributes':_0x38ee01[_0xef05('0x1b')],'include':_0x38ee01['include']?_['map'](_0x38ee01[_0xef05('0x1d')],function(_0x4265a8){return{'model':db[_0x4265a8['model']],'as':_0x4265a8['as'],'attributes':_0x4265a8[_0xef05('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xef05('0x20')](function(_0x9e05ef){logger[_0xef05('0xb')](_0xef05('0x21'),_0x1d9c65);logger[_0xef05('0xe')]('ShowSugarcrmAccount',_0x1d9c65,JSON[_0xef05('0x10')](_0x9e05ef));_0x3069d7(_0x9e05ef);})['catch'](function(_0x5a40b2){logger['error']('ShowSugarcrmAccount',_0x5a40b2[_0xef05('0x13')],_0x1d9c65);_0x2e3994(_0x303061[_0xef05('0x11')](0x1f4,_0x5a40b2['message']));});});}; \ No newline at end of file +var _0x1141=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','model','include','ShowSugarcrmAccount','find','where','util','moment','bluebird','randomstring'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x1141,0xda));var _0x1114=function(_0x19cee7,_0x562ecb){_0x19cee7=_0x19cee7-0x0;var _0x45657b=_0x1141[_0x19cee7];return _0x45657b;};'use strict';var _=require('lodash');var util=require(_0x1114('0x0'));var moment=require(_0x1114('0x1'));var BPromise=require(_0x1114('0x2'));var rs=require(_0x1114('0x3'));var fs=require('fs');var Redis=require(_0x1114('0x4'));var db=require(_0x1114('0x5'))['db'];var utils=require(_0x1114('0x6'));var logger=require(_0x1114('0x7'))(_0x1114('0x8'));var config=require(_0x1114('0x9'));var jayson=require(_0x1114('0xa'));var client=jayson['client'][_0x1114('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x543f2f,_0x2cafd3,_0xf4efd0){return new BPromise(function(_0x21c2af,_0x2b0dfa){return client[_0x1114('0xc')](_0x543f2f,_0xf4efd0)[_0x1114('0xd')](function(_0x1559b3){logger[_0x1114('0xe')](_0x1114('0xf'),_0x2cafd3,_0x1114('0x10'));logger[_0x1114('0x11')](_0x1114('0x12'),_0x2cafd3,_0x1114('0x10'),JSON[_0x1114('0x13')](_0x1559b3));if(_0x1559b3[_0x1114('0x14')]){if(_0x1559b3['error'][_0x1114('0x15')]===0x1f4){logger[_0x1114('0x14')](_0x1114('0xf'),_0x2cafd3,_0x1559b3[_0x1114('0x14')][_0x1114('0x16')]);return _0x2b0dfa(_0x1559b3[_0x1114('0x14')]['message']);}logger[_0x1114('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cafd3,_0x1559b3[_0x1114('0x14')]['message']);return _0x21c2af(_0x1559b3[_0x1114('0x14')][_0x1114('0x16')]);}else{logger[_0x1114('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cafd3,_0x1114('0x10'));_0x21c2af(_0x1559b3['result']['message']);}})[_0x1114('0x17')](function(_0x35acbe){logger[_0x1114('0x14')](_0x1114('0xf'),_0x2cafd3,_0x35acbe);_0x2b0dfa(_0x35acbe);});});}exports[_0x1114('0x18')]=function(_0x2c3370){var _0x30ca29=this;return new Promise(function(_0x2a3ddf,_0x3442eb){return db[_0x1114('0x19')][_0x1114('0x1a')]({'raw':_0x2c3370[_0x1114('0x1b')]?_0x2c3370['options'][_0x1114('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c3370[_0x1114('0x1b')]?_0x2c3370[_0x1114('0x1b')]['where']||null:null,'attributes':_0x2c3370[_0x1114('0x1b')]?_0x2c3370[_0x1114('0x1b')][_0x1114('0x1d')]||null:null,'limit':_0x2c3370[_0x1114('0x1b')]?_0x2c3370['options'][_0x1114('0x1e')]||null:null,'include':_0x2c3370[_0x1114('0x1b')]?_0x2c3370[_0x1114('0x1b')]['include']?_[_0x1114('0x1f')](_0x2c3370[_0x1114('0x1b')]['include'],function(_0x52e303){return{'model':db[_0x52e303[_0x1114('0x20')]],'as':_0x52e303['as'],'attributes':_0x52e303[_0x1114('0x1d')],'include':_0x52e303[_0x1114('0x21')]?_['map'](_0x52e303[_0x1114('0x21')],function(_0x108cd1){return{'model':db[_0x108cd1[_0x1114('0x20')]],'as':_0x108cd1['as'],'attributes':_0x108cd1[_0x1114('0x1d')],'include':_0x108cd1[_0x1114('0x21')]?_[_0x1114('0x1f')](_0x108cd1[_0x1114('0x21')],function(_0x1e9315){return{'model':db[_0x1e9315['model']],'as':_0x1e9315['as'],'attributes':_0x1e9315[_0x1114('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1114('0xd')](function(_0x5edb91){logger[_0x1114('0xe')](_0x1114('0x18'),_0x2c3370);logger[_0x1114('0x11')](_0x1114('0x18'),_0x2c3370,JSON[_0x1114('0x13')](_0x5edb91));_0x2a3ddf(_0x5edb91);})['catch'](function(_0x4c85bd){logger['error'](_0x1114('0x18'),_0x4c85bd[_0x1114('0x16')],_0x2c3370);_0x3442eb(_0x30ca29[_0x1114('0x14')](0x1f4,_0x4c85bd['message']));});});};exports[_0x1114('0x22')]=function(_0x32c669){var _0x5a2d64=this;return new Promise(function(_0x2bdd05,_0x31a482){return db[_0x1114('0x19')][_0x1114('0x23')]({'raw':_0x32c669[_0x1114('0x1b')]?_0x32c669[_0x1114('0x1b')][_0x1114('0x1c')]===undefined?!![]:![]:!![],'where':_0x32c669[_0x1114('0x1b')]?_0x32c669['options'][_0x1114('0x24')]||null:null,'attributes':_0x32c669[_0x1114('0x1b')]?_0x32c669[_0x1114('0x1b')][_0x1114('0x1d')]||null:null,'include':_0x32c669[_0x1114('0x1b')]?_0x32c669[_0x1114('0x1b')][_0x1114('0x21')]?_['map'](_0x32c669['options'][_0x1114('0x21')],function(_0x1ee963){return{'model':db[_0x1ee963[_0x1114('0x20')]],'as':_0x1ee963['as'],'attributes':_0x1ee963['attributes'],'include':_0x1ee963['include']?_[_0x1114('0x1f')](_0x1ee963[_0x1114('0x21')],function(_0x12157e){return{'model':db[_0x12157e['model']],'as':_0x12157e['as'],'attributes':_0x12157e[_0x1114('0x1d')],'include':_0x12157e[_0x1114('0x21')]?_['map'](_0x12157e['include'],function(_0x1421ac){return{'model':db[_0x1421ac['model']],'as':_0x1421ac['as'],'attributes':_0x1421ac[_0x1114('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eeb24){logger['info'](_0x1114('0x22'),_0x32c669);logger[_0x1114('0x11')](_0x1114('0x22'),_0x32c669,JSON[_0x1114('0x13')](_0x4eeb24));_0x2bdd05(_0x4eeb24);})[_0x1114('0x17')](function(_0x1ad046){logger[_0x1114('0x14')](_0x1114('0x22'),_0x1ad046[_0x1114('0x16')],_0x32c669);_0x31a482(_0x5a2d64[_0x1114('0x14')](0x1f4,_0x1ad046[_0x1114('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3b0eda3..53569d6 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 _0xb5fe=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x1fb677,_0x2ef276){var _0x15d994=function(_0x182a4c){while(--_0x182a4c){_0x1fb677['push'](_0x1fb677['shift']());}};_0x15d994(++_0x2ef276);}(_0xb5fe,0x11f));var _0xeb5f=function(_0x24b918,_0x39ce17){_0x24b918=_0x24b918-0x0;var _0x15712f=_0xb5fe[_0x24b918];return _0x15712f;};'use strict';var multer=require('multer');var util=require(_0xeb5f('0x0'));var path=require(_0xeb5f('0x1'));var timeout=require(_0xeb5f('0x2'));var express=require('express');var router=express[_0xeb5f('0x3')]();var fs_extra=require(_0xeb5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeb5f('0x5'));var config=require(_0xeb5f('0x6'));var controller=require(_0xeb5f('0x7'));router['get']('/',auth[_0xeb5f('0x8')](),controller[_0xeb5f('0x9')]);router[_0xeb5f('0xa')](_0xeb5f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xeb5f('0xa')]('/:id/fields',auth[_0xeb5f('0x8')](),controller['getFields']);router[_0xeb5f('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xeb5f('0xc')]);router['get'](_0xeb5f('0xd'),auth[_0xeb5f('0x8')](),controller[_0xeb5f('0xe')]);router['post']('/',auth[_0xeb5f('0x8')](),controller[_0xeb5f('0xf')]);router[_0xeb5f('0x10')](_0xeb5f('0xb'),auth[_0xeb5f('0x8')](),controller['update']);router['delete'](_0xeb5f('0xb'),auth['isAuthenticated'](),controller[_0xeb5f('0x11')]);module[_0xeb5f('0x12')]=router; \ No newline at end of file +var _0x6f54=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','index','/:id','isAuthenticated','show','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f54,0xcf));var _0x46f5=function(_0x270393,_0x29650e){_0x270393=_0x270393-0x0;var _0x4ede29=_0x6f54[_0x270393];return _0x4ede29;};'use strict';var multer=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var path=require(_0x46f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46f5('0x3')]();var fs_extra=require(_0x46f5('0x4'));var auth=require(_0x46f5('0x5'));var interaction=require(_0x46f5('0x6'));var config=require('../../config/environment');var controller=require(_0x46f5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x46f5('0x8')]);router['get'](_0x46f5('0x9'),auth[_0x46f5('0xa')](),controller[_0x46f5('0xb')]);router[_0x46f5('0xc')](_0x46f5('0xd'),auth[_0x46f5('0xa')](),controller[_0x46f5('0xe')]);router[_0x46f5('0xc')](_0x46f5('0xf'),auth[_0x46f5('0xa')](),controller[_0x46f5('0x10')]);router[_0x46f5('0xc')](_0x46f5('0x11'),auth[_0x46f5('0xa')](),controller['getDescriptions']);router[_0x46f5('0x12')]('/',auth[_0x46f5('0xa')](),controller[_0x46f5('0x13')]);router['put'](_0x46f5('0x9'),auth[_0x46f5('0xa')](),controller['update']);router[_0x46f5('0x14')](_0x46f5('0x9'),auth[_0x46f5('0xa')](),controller[_0x46f5('0x15')]);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 af25732..290478c 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 _0x4f8b=['exports','STRING'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x4f8b,0x194));var _0xb4f8=function(_0x3b0512,_0x19715b){_0x3b0512=_0x3b0512-0x0;var _0x1f180f=_0x4f8b[_0x3b0512];return _0x1f180f;};'use strict';var Sequelize=require('sequelize');module[_0xb4f8('0x0')]={'name':{'type':Sequelize[_0xb4f8('0x1')]},'description':{'type':Sequelize[_0xb4f8('0x1')]}}; \ No newline at end of file +var _0x696a=['STRING','exports'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x696a,0x131));var _0xa696=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x696a[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require('sequelize');module[_0xa696('0x0')]={'name':{'type':Sequelize[_0xa696('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c91d355..12b0d46 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 _0x8bfa=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','SugarcrmConfiguration','includeAll','include','catch','show','params','rawAttributes','create','body','find','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','model','keys','query'];(function(_0x4d0b50,_0x5b13c6){var _0x44f403=function(_0x5d5e01){while(--_0x5d5e01){_0x4d0b50['push'](_0x4d0b50['shift']());}};_0x44f403(++_0x5b13c6);}(_0x8bfa,0x156));var _0xa8bf=function(_0x31cdff,_0x545438){_0x31cdff=_0x31cdff-0x0;var _0x14091f=_0x8bfa[_0x31cdff];return _0x14091f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8bf('0x0'));var zipdir=require(_0xa8bf('0x1'));var jsonpatch=require(_0xa8bf('0x2'));var rp=require(_0xa8bf('0x3'));var moment=require(_0xa8bf('0x4'));var BPromise=require(_0xa8bf('0x5'));var Mustache=require(_0xa8bf('0x6'));var util=require(_0xa8bf('0x7'));var path=require(_0xa8bf('0x8'));var sox=require(_0xa8bf('0x9'));var csv=require(_0xa8bf('0xa'));var ejs=require(_0xa8bf('0xb'));var fs=require('fs');var fs_extra=require(_0xa8bf('0xc'));var _=require(_0xa8bf('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8bf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa8bf('0xf'));var Redis=require(_0xa8bf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa8bf('0x11'));var as=require(_0xa8bf('0x12'));var hardwareService=require(_0xa8bf('0x13'));var logger=require('../../config/logger')(_0xa8bf('0x14'));var utils=require('../../config/utils');var config=require(_0xa8bf('0x15'));var licenseUtil=require(_0xa8bf('0x16'));var db=require(_0xa8bf('0x17'))['db'];function respondWithStatusCode(_0x46c8f0,_0xe8314a){_0xe8314a=_0xe8314a||0xcc;return function(_0x505c2d){if(_0x505c2d){return _0x46c8f0[_0xa8bf('0x18')](_0xe8314a);}return _0x46c8f0[_0xa8bf('0x19')](_0xe8314a)[_0xa8bf('0x1a')]();};}function respondWithResult(_0x4c15af,_0x269b81){_0x269b81=_0x269b81||0xc8;return function(_0x2d52f2){if(_0x2d52f2){return _0x4c15af[_0xa8bf('0x19')](_0x269b81)['json'](_0x2d52f2);}};}function respondWithFilteredResult(_0x23c7df,_0x392acf){return function(_0x514da7){if(_0x514da7){var _0x4d8c65=typeof _0x392acf['offset']===_0xa8bf('0x1b')&&typeof _0x392acf[_0xa8bf('0x1c')]===_0xa8bf('0x1b');var _0x1df828=_0x514da7['count'];var _0x155ce8=_0x4d8c65?0x0:_0x392acf[_0xa8bf('0x1d')];var _0x644b2d=_0x4d8c65?_0x514da7[_0xa8bf('0x1e')]:_0x392acf[_0xa8bf('0x1d')]+_0x392acf['limit'];var _0x2c5d41;if(_0x644b2d>=_0x1df828){_0x644b2d=_0x1df828;_0x2c5d41=0xc8;}else{_0x2c5d41=0xce;}_0x23c7df[_0xa8bf('0x19')](_0x2c5d41);return _0x23c7df['set'](_0xa8bf('0x1f'),_0x155ce8+'-'+_0x644b2d+'/'+_0x1df828)[_0xa8bf('0x20')](_0x514da7);}return null;};}function patchUpdates(_0x27f43b){return function(_0x4f6d2a){try{jsonpatch[_0xa8bf('0x21')](_0x4f6d2a,_0x27f43b,!![]);}catch(_0x181964){return BPromise[_0xa8bf('0x22')](_0x181964);}return _0x4f6d2a[_0xa8bf('0x23')]();};}function saveUpdates(_0x1dcb82,_0x51d858){return function(_0x177b7a){if(_0x177b7a){return _0x177b7a[_0xa8bf('0x24')](_0x1dcb82)[_0xa8bf('0x25')](function(_0x535e62){return _0x535e62;});}return null;};}function removeEntity(_0x3fb373,_0x2d3eb9){return function(_0x38e5c7){if(_0x38e5c7){return _0x38e5c7[_0xa8bf('0x26')]()[_0xa8bf('0x25')](function(){_0x3fb373[_0xa8bf('0x19')](0xcc)[_0xa8bf('0x1a')]();});}};}function handleEntityNotFound(_0x480a9a,_0x2c6365){return function(_0x3d8ae1){if(!_0x3d8ae1){_0x480a9a[_0xa8bf('0x18')](0x194);}return _0x3d8ae1;};}function handleError(_0x17f21f,_0xb20ce7){_0xb20ce7=_0xb20ce7||0x1f4;return function(_0x34ddff){logger[_0xa8bf('0x27')](_0x34ddff['stack']);if(_0x34ddff[_0xa8bf('0x28')]){delete _0x34ddff[_0xa8bf('0x28')];}_0x17f21f[_0xa8bf('0x19')](_0xb20ce7)[_0xa8bf('0x29')](_0x34ddff);};}exports[_0xa8bf('0x2a')]=function(_0x1bd6aa,_0x59a46e){var _0x3eece8={},_0x9fd4e5={},_0x1014f0={'count':0x0,'rows':[]};var _0x45ed74=_[_0xa8bf('0x2b')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x20d477){return{'name':_0x20d477[_0xa8bf('0x2c')],'type':_0x20d477['type']['key']};});_0x9fd4e5[_0xa8bf('0x2d')]=_[_0xa8bf('0x2b')](_0x45ed74,'name');_0x9fd4e5['query']=_[_0xa8bf('0x2e')](_0x1bd6aa[_0xa8bf('0x2f')]);_0x9fd4e5[_0xa8bf('0x30')]=_[_0xa8bf('0x31')](_0x9fd4e5[_0xa8bf('0x2d')],_0x9fd4e5[_0xa8bf('0x2f')]);_0x3eece8[_0xa8bf('0x32')]=_['intersection'](_0x9fd4e5[_0xa8bf('0x2d')],qs[_0xa8bf('0x33')](_0x1bd6aa[_0xa8bf('0x2f')][_0xa8bf('0x33')]));_0x3eece8['attributes']=_0x3eece8['attributes'][_0xa8bf('0x34')]?_0x3eece8['attributes']:_0x9fd4e5[_0xa8bf('0x2d')];if(!_0x1bd6aa['query'][_0xa8bf('0x35')](_0xa8bf('0x36'))){_0x3eece8[_0xa8bf('0x1c')]=qs[_0xa8bf('0x1c')](_0x1bd6aa[_0xa8bf('0x2f')][_0xa8bf('0x1c')]);_0x3eece8[_0xa8bf('0x1d')]=qs[_0xa8bf('0x1d')](_0x1bd6aa[_0xa8bf('0x2f')]['offset']);}_0x3eece8[_0xa8bf('0x37')]=qs[_0xa8bf('0x38')](_0x1bd6aa[_0xa8bf('0x2f')][_0xa8bf('0x38')]);_0x3eece8['where']=qs[_0xa8bf('0x30')](_[_0xa8bf('0x39')](_0x1bd6aa[_0xa8bf('0x2f')],_0x9fd4e5[_0xa8bf('0x30')]),_0x45ed74);if(_0x1bd6aa[_0xa8bf('0x2f')][_0xa8bf('0x3a')]){_0x3eece8[_0xa8bf('0x3b')]=_[_0xa8bf('0x3c')](_0x3eece8[_0xa8bf('0x3b')],{'$or':_['map'](_0x45ed74,function(_0x3ca0a8){if(_0x3ca0a8[_0xa8bf('0x3d')]!=='VIRTUAL'){var _0x344a34={};_0x344a34[_0x3ca0a8[_0xa8bf('0x28')]]={'$like':'%'+_0x1bd6aa[_0xa8bf('0x2f')][_0xa8bf('0x3a')]+'%'};return _0x344a34;}})});}_0x3eece8=_[_0xa8bf('0x3c')]({},_0x3eece8,_0x1bd6aa[_0xa8bf('0x3e')]);var _0x131ee0={'where':_0x3eece8[_0xa8bf('0x3b')]};return db[_0xa8bf('0x3f')]['count'](_0x131ee0)[_0xa8bf('0x25')](function(_0x258dea){_0x1014f0[_0xa8bf('0x1e')]=_0x258dea;if(_0x1bd6aa['query'][_0xa8bf('0x40')]){_0x3eece8[_0xa8bf('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x3eece8);})[_0xa8bf('0x25')](function(_0x4083d5){_0x1014f0['rows']=_0x4083d5;return _0x1014f0;})[_0xa8bf('0x25')](respondWithFilteredResult(_0x59a46e,_0x3eece8))[_0xa8bf('0x42')](handleError(_0x59a46e,null));};exports[_0xa8bf('0x43')]=function(_0x7d57da,_0x33bc89){var _0x168634={'raw':![],'where':{'id':_0x7d57da[_0xa8bf('0x44')]['id']}},_0x5a2842={};_0x5a2842[_0xa8bf('0x2d')]=_[_0xa8bf('0x2e')](db[_0xa8bf('0x3f')][_0xa8bf('0x45')]);_0x5a2842[_0xa8bf('0x2f')]=_['keys'](_0x7d57da[_0xa8bf('0x2f')]);_0x5a2842[_0xa8bf('0x30')]=_[_0xa8bf('0x31')](_0x5a2842[_0xa8bf('0x2d')],_0x5a2842['query']);_0x168634[_0xa8bf('0x32')]=_[_0xa8bf('0x31')](_0x5a2842[_0xa8bf('0x2d')],qs[_0xa8bf('0x33')](_0x7d57da[_0xa8bf('0x2f')][_0xa8bf('0x33')]));_0x168634[_0xa8bf('0x32')]=_0x168634[_0xa8bf('0x32')][_0xa8bf('0x34')]?_0x168634[_0xa8bf('0x32')]:_0x5a2842[_0xa8bf('0x2d')];if(_0x7d57da[_0xa8bf('0x2f')]['includeAll']){_0x168634[_0xa8bf('0x41')]=[{'all':!![]}];}_0x168634=_['merge']({},_0x168634,_0x7d57da[_0xa8bf('0x3e')]);return db['SugarcrmConfiguration']['find'](_0x168634)[_0xa8bf('0x25')](handleEntityNotFound(_0x33bc89,null))[_0xa8bf('0x25')](respondWithResult(_0x33bc89,null))[_0xa8bf('0x42')](handleError(_0x33bc89,null));};exports[_0xa8bf('0x46')]=function(_0x4d8d6b,_0x101efe){return db['SugarcrmConfiguration'][_0xa8bf('0x46')](_0x4d8d6b['body'],{})['then'](respondWithResult(_0x101efe,0xc9))[_0xa8bf('0x42')](handleError(_0x101efe,null));};exports[_0xa8bf('0x24')]=function(_0x59deca,_0x1defe2){if(_0x59deca[_0xa8bf('0x47')]['id']){delete _0x59deca['body']['id'];}return db[_0xa8bf('0x3f')][_0xa8bf('0x48')]({'where':{'id':_0x59deca['params']['id']}})[_0xa8bf('0x25')](handleEntityNotFound(_0x1defe2,null))['then'](saveUpdates(_0x59deca[_0xa8bf('0x47')],null))['then'](respondWithResult(_0x1defe2,null))['catch'](handleError(_0x1defe2,null));};exports[_0xa8bf('0x26')]=function(_0x339947,_0x360846){return db[_0xa8bf('0x3f')]['find']({'where':{'id':_0x339947[_0xa8bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x360846,null))[_0xa8bf('0x25')](removeEntity(_0x360846,null))[_0xa8bf('0x42')](handleError(_0x360846,null));};exports['getFields']=function(_0x34c4a1,_0x5f5495,_0x1dddd0){var _0x24d77d={};var _0x12e9b9={};var _0x586b14;var _0x2e9adb;return db[_0xa8bf('0x3f')][_0xa8bf('0x49')]({'where':{'id':_0x34c4a1['params']['id']}})['then'](handleEntityNotFound(_0x5f5495,null))['then'](function(_0xc6e88f){if(_0xc6e88f){_0x586b14=_0xc6e88f;_0x12e9b9[_0xa8bf('0x2d')]=_[_0xa8bf('0x2e')](db[_0xa8bf('0x4a')][_0xa8bf('0x45')]);_0x12e9b9[_0xa8bf('0x2f')]=_[_0xa8bf('0x2e')](_0x34c4a1['query']);_0x12e9b9[_0xa8bf('0x30')]=_[_0xa8bf('0x31')](_0x12e9b9[_0xa8bf('0x2d')],_0x12e9b9[_0xa8bf('0x2f')]);_0x24d77d[_0xa8bf('0x32')]=_[_0xa8bf('0x31')](_0x12e9b9[_0xa8bf('0x2d')],qs[_0xa8bf('0x33')](_0x34c4a1[_0xa8bf('0x2f')][_0xa8bf('0x33')]));_0x24d77d['attributes']=_0x24d77d[_0xa8bf('0x32')]['length']?_0x24d77d[_0xa8bf('0x32')]:_0x12e9b9[_0xa8bf('0x2d')];_0x24d77d[_0xa8bf('0x37')]=qs[_0xa8bf('0x38')](_0x34c4a1[_0xa8bf('0x2f')][_0xa8bf('0x38')]);_0x24d77d[_0xa8bf('0x3b')]=qs[_0xa8bf('0x30')](_[_0xa8bf('0x39')](_0x34c4a1[_0xa8bf('0x2f')],_0x12e9b9[_0xa8bf('0x30')]));if(_0x34c4a1['query'][_0xa8bf('0x3a')]){_0x24d77d[_0xa8bf('0x3b')]=_[_0xa8bf('0x3c')](_0x24d77d[_0xa8bf('0x3b')],{'$or':_[_0xa8bf('0x2b')](_0x24d77d[_0xa8bf('0x32')],function(_0x1526c1){var _0x167784={};_0x167784[_0x1526c1]={'$like':'%'+_0x34c4a1['query'][_0xa8bf('0x3a')]+'%'};return _0x167784;})});}_0x24d77d=_[_0xa8bf('0x3c')]({},_0x24d77d,_0x34c4a1['options']);return _0x586b14[_0xa8bf('0x4b')](_0x24d77d);}})[_0xa8bf('0x25')](function(_0x1c438b){if(_0x1c438b){_0x2e9adb=_0x1c438b[_0xa8bf('0x34')];if(!_0x34c4a1[_0xa8bf('0x2f')]['hasOwnProperty'](_0xa8bf('0x36'))){_0x24d77d[_0xa8bf('0x1c')]=qs[_0xa8bf('0x1c')](_0x34c4a1[_0xa8bf('0x2f')][_0xa8bf('0x1c')]);_0x24d77d[_0xa8bf('0x1d')]=qs['offset'](_0x34c4a1['query'][_0xa8bf('0x1d')]);}return _0x586b14[_0xa8bf('0x4b')](_0x24d77d);}})[_0xa8bf('0x25')](function(_0x369f81){if(_0x369f81){return _0x369f81?{'count':_0x2e9adb,'rows':_0x369f81}:null;}})[_0xa8bf('0x25')](respondWithResult(_0x5f5495,null))['catch'](handleError(_0x5f5495,null));};exports[_0xa8bf('0x4c')]=function(_0x1ba396,_0x12ab70,_0x2f9514){var _0x261d25={};var _0x82122b={};var _0xbf65f6;var _0x10c3c0;return db['SugarcrmConfiguration'][_0xa8bf('0x49')]({'where':{'id':_0x1ba396[_0xa8bf('0x44')]['id']}})[_0xa8bf('0x25')](handleEntityNotFound(_0x12ab70,null))[_0xa8bf('0x25')](function(_0x34506d){if(_0x34506d){_0xbf65f6=_0x34506d;_0x82122b[_0xa8bf('0x2d')]=_['keys'](db[_0xa8bf('0x4a')][_0xa8bf('0x45')]);_0x82122b['query']=_[_0xa8bf('0x2e')](_0x1ba396['query']);_0x82122b[_0xa8bf('0x30')]=_[_0xa8bf('0x31')](_0x82122b[_0xa8bf('0x2d')],_0x82122b['query']);_0x261d25['attributes']=_[_0xa8bf('0x31')](_0x82122b[_0xa8bf('0x2d')],qs['fields'](_0x1ba396[_0xa8bf('0x2f')][_0xa8bf('0x33')]));_0x261d25[_0xa8bf('0x32')]=_0x261d25[_0xa8bf('0x32')][_0xa8bf('0x34')]?_0x261d25[_0xa8bf('0x32')]:_0x82122b[_0xa8bf('0x2d')];_0x261d25[_0xa8bf('0x37')]=qs[_0xa8bf('0x38')](_0x1ba396['query']['sort']);_0x261d25[_0xa8bf('0x3b')]=qs['filters'](_[_0xa8bf('0x39')](_0x1ba396[_0xa8bf('0x2f')],_0x82122b['filters']));if(_0x1ba396['query'][_0xa8bf('0x3a')]){_0x261d25[_0xa8bf('0x3b')]=_[_0xa8bf('0x3c')](_0x261d25[_0xa8bf('0x3b')],{'$or':_[_0xa8bf('0x2b')](_0x261d25[_0xa8bf('0x32')],function(_0x25fd5e){var _0x3ec688={};_0x3ec688[_0x25fd5e]={'$like':'%'+_0x1ba396[_0xa8bf('0x2f')][_0xa8bf('0x3a')]+'%'};return _0x3ec688;})});}_0x261d25=_[_0xa8bf('0x3c')]({},_0x261d25,_0x1ba396[_0xa8bf('0x3e')]);return _0xbf65f6[_0xa8bf('0x4c')](_0x261d25);}})[_0xa8bf('0x25')](function(_0x4b9f04){if(_0x4b9f04){_0x10c3c0=_0x4b9f04[_0xa8bf('0x34')];if(!_0x1ba396[_0xa8bf('0x2f')][_0xa8bf('0x35')](_0xa8bf('0x36'))){_0x261d25[_0xa8bf('0x1c')]=qs[_0xa8bf('0x1c')](_0x1ba396[_0xa8bf('0x2f')]['limit']);_0x261d25[_0xa8bf('0x1d')]=qs[_0xa8bf('0x1d')](_0x1ba396['query'][_0xa8bf('0x1d')]);}return _0xbf65f6['getSubjects'](_0x261d25);}})[_0xa8bf('0x25')](function(_0x559f96){if(_0x559f96){return _0x559f96?{'count':_0x10c3c0,'rows':_0x559f96}:null;}})[_0xa8bf('0x25')](respondWithResult(_0x12ab70,null))[_0xa8bf('0x42')](handleError(_0x12ab70,null));};exports[_0xa8bf('0x4d')]=function(_0x1a7c07,_0x4ae4ca,_0x392ad6){var _0x584c42={};var _0x8680e0={};var _0x11c60a;var _0x2379ca;return db[_0xa8bf('0x3f')][_0xa8bf('0x49')]({'where':{'id':_0x1a7c07[_0xa8bf('0x44')]['id']}})[_0xa8bf('0x25')](handleEntityNotFound(_0x4ae4ca,null))['then'](function(_0x5e4534){if(_0x5e4534){_0x11c60a=_0x5e4534;_0x8680e0[_0xa8bf('0x2d')]=_[_0xa8bf('0x2e')](db[_0xa8bf('0x4a')][_0xa8bf('0x45')]);_0x8680e0[_0xa8bf('0x2f')]=_[_0xa8bf('0x2e')](_0x1a7c07[_0xa8bf('0x2f')]);_0x8680e0[_0xa8bf('0x30')]=_['intersection'](_0x8680e0[_0xa8bf('0x2d')],_0x8680e0[_0xa8bf('0x2f')]);_0x584c42[_0xa8bf('0x32')]=_[_0xa8bf('0x31')](_0x8680e0[_0xa8bf('0x2d')],qs['fields'](_0x1a7c07[_0xa8bf('0x2f')][_0xa8bf('0x33')]));_0x584c42[_0xa8bf('0x32')]=_0x584c42[_0xa8bf('0x32')][_0xa8bf('0x34')]?_0x584c42['attributes']:_0x8680e0['model'];_0x584c42[_0xa8bf('0x37')]=qs['sort'](_0x1a7c07[_0xa8bf('0x2f')][_0xa8bf('0x38')]);_0x584c42[_0xa8bf('0x3b')]=qs[_0xa8bf('0x30')](_[_0xa8bf('0x39')](_0x1a7c07[_0xa8bf('0x2f')],_0x8680e0[_0xa8bf('0x30')]));if(_0x1a7c07[_0xa8bf('0x2f')][_0xa8bf('0x3a')]){_0x584c42[_0xa8bf('0x3b')]=_['merge'](_0x584c42['where'],{'$or':_[_0xa8bf('0x2b')](_0x584c42['attributes'],function(_0x327b1b){var _0x25fd91={};_0x25fd91[_0x327b1b]={'$like':'%'+_0x1a7c07['query'][_0xa8bf('0x3a')]+'%'};return _0x25fd91;})});}_0x584c42=_[_0xa8bf('0x3c')]({},_0x584c42,_0x1a7c07[_0xa8bf('0x3e')]);return _0x11c60a[_0xa8bf('0x4d')](_0x584c42);}})[_0xa8bf('0x25')](function(_0x5c5fb8){if(_0x5c5fb8){_0x2379ca=_0x5c5fb8[_0xa8bf('0x34')];if(!_0x1a7c07[_0xa8bf('0x2f')]['hasOwnProperty'](_0xa8bf('0x36'))){_0x584c42['limit']=qs[_0xa8bf('0x1c')](_0x1a7c07[_0xa8bf('0x2f')][_0xa8bf('0x1c')]);_0x584c42[_0xa8bf('0x1d')]=qs[_0xa8bf('0x1d')](_0x1a7c07[_0xa8bf('0x2f')][_0xa8bf('0x1d')]);}return _0x11c60a[_0xa8bf('0x4d')](_0x584c42);}})[_0xa8bf('0x25')](function(_0x846a39){if(_0x846a39){return _0x846a39?{'count':_0x2379ca,'rows':_0x846a39}:null;}})[_0xa8bf('0x25')](respondWithResult(_0x4ae4ca,null))['catch'](handleError(_0x4ae4ca,null));}; \ No newline at end of file +var _0x6ccc=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','update','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ccc,0xdd));var _0xc6cc=function(_0x2dea58,_0x59d6f0){_0x2dea58=_0x2dea58-0x0;var _0x2b23c2=_0x6ccc[_0x2dea58];return _0x2b23c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6cc('0x0'));var zipdir=require(_0xc6cc('0x1'));var jsonpatch=require(_0xc6cc('0x2'));var rp=require(_0xc6cc('0x3'));var moment=require('moment');var BPromise=require(_0xc6cc('0x4'));var Mustache=require('mustache');var util=require(_0xc6cc('0x5'));var path=require(_0xc6cc('0x6'));var sox=require(_0xc6cc('0x7'));var csv=require(_0xc6cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6cc('0x9'));var _=require('lodash');var squel=require(_0xc6cc('0xa'));var crypto=require(_0xc6cc('0xb'));var jsforce=require(_0xc6cc('0xc'));var deskjs=require(_0xc6cc('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6cc('0xe'));var authService=require(_0xc6cc('0xf'));var qs=require(_0xc6cc('0x10'));var as=require(_0xc6cc('0x11'));var hardwareService=require(_0xc6cc('0x12'));var logger=require(_0xc6cc('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc6cc('0x14'));var licenseUtil=require(_0xc6cc('0x15'));var db=require(_0xc6cc('0x16'))['db'];function respondWithStatusCode(_0x446180,_0xafee2e){_0xafee2e=_0xafee2e||0xcc;return function(_0x931c6){if(_0x931c6){return _0x446180[_0xc6cc('0x17')](_0xafee2e);}return _0x446180[_0xc6cc('0x18')](_0xafee2e)[_0xc6cc('0x19')]();};}function respondWithResult(_0x5d3542,_0x2db9e3){_0x2db9e3=_0x2db9e3||0xc8;return function(_0x2f1d76){if(_0x2f1d76){return _0x5d3542[_0xc6cc('0x18')](_0x2db9e3)[_0xc6cc('0x1a')](_0x2f1d76);}};}function respondWithFilteredResult(_0x12475d,_0x5e365c){return function(_0x32029f){if(_0x32029f){var _0x5dea5f=typeof _0x5e365c[_0xc6cc('0x1b')]===_0xc6cc('0x1c')&&typeof _0x5e365c['limit']===_0xc6cc('0x1c');var _0x82b1d=_0x32029f[_0xc6cc('0x1d')];var _0x122437=_0x5dea5f?0x0:_0x5e365c[_0xc6cc('0x1b')];var _0x199818=_0x5dea5f?_0x32029f[_0xc6cc('0x1d')]:_0x5e365c[_0xc6cc('0x1b')]+_0x5e365c[_0xc6cc('0x1e')];var _0x47d51a;if(_0x199818>=_0x82b1d){_0x199818=_0x82b1d;_0x47d51a=0xc8;}else{_0x47d51a=0xce;}_0x12475d[_0xc6cc('0x18')](_0x47d51a);return _0x12475d[_0xc6cc('0x1f')](_0xc6cc('0x20'),_0x122437+'-'+_0x199818+'/'+_0x82b1d)[_0xc6cc('0x1a')](_0x32029f);}return null;};}function patchUpdates(_0x4241cb){return function(_0x134028){try{jsonpatch[_0xc6cc('0x21')](_0x134028,_0x4241cb,!![]);}catch(_0x67e841){return BPromise['reject'](_0x67e841);}return _0x134028['save']();};}function saveUpdates(_0xae65bf,_0x469b4d){return function(_0x4ac6ab){if(_0x4ac6ab){return _0x4ac6ab['update'](_0xae65bf)[_0xc6cc('0x22')](function(_0x1cd683){return _0x1cd683;});}return null;};}function removeEntity(_0x102c6d,_0x3870fa){return function(_0x2b3fb7){if(_0x2b3fb7){return _0x2b3fb7[_0xc6cc('0x23')]()[_0xc6cc('0x22')](function(){_0x102c6d[_0xc6cc('0x18')](0xcc)[_0xc6cc('0x19')]();});}};}function handleEntityNotFound(_0x3c7c0c,_0x245b9d){return function(_0x43b494){if(!_0x43b494){_0x3c7c0c[_0xc6cc('0x17')](0x194);}return _0x43b494;};}function handleError(_0x5948c2,_0x37b162){_0x37b162=_0x37b162||0x1f4;return function(_0x4f582c){logger[_0xc6cc('0x24')](_0x4f582c[_0xc6cc('0x25')]);if(_0x4f582c[_0xc6cc('0x26')]){delete _0x4f582c[_0xc6cc('0x26')];}_0x5948c2[_0xc6cc('0x18')](_0x37b162)[_0xc6cc('0x27')](_0x4f582c);};}exports[_0xc6cc('0x28')]=function(_0x3fb457,_0xdda29a){var _0x4c3fe8={},_0x59cb56={},_0x74be43={'count':0x0,'rows':[]};var _0x4ff28a=_['map'](db[_0xc6cc('0x29')]['rawAttributes'],function(_0x4a2859){return{'name':_0x4a2859[_0xc6cc('0x2a')],'type':_0x4a2859[_0xc6cc('0x2b')][_0xc6cc('0x2c')]};});_0x59cb56[_0xc6cc('0x2d')]=_['map'](_0x4ff28a,_0xc6cc('0x26'));_0x59cb56[_0xc6cc('0x2e')]=_['keys'](_0x3fb457[_0xc6cc('0x2e')]);_0x59cb56['filters']=_[_0xc6cc('0x2f')](_0x59cb56['model'],_0x59cb56[_0xc6cc('0x2e')]);_0x4c3fe8[_0xc6cc('0x30')]=_['intersection'](_0x59cb56[_0xc6cc('0x2d')],qs['fields'](_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x31')]));_0x4c3fe8[_0xc6cc('0x30')]=_0x4c3fe8[_0xc6cc('0x30')][_0xc6cc('0x32')]?_0x4c3fe8[_0xc6cc('0x30')]:_0x59cb56[_0xc6cc('0x2d')];if(!_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x33')](_0xc6cc('0x34'))){_0x4c3fe8[_0xc6cc('0x1e')]=qs['limit'](_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x1e')]);_0x4c3fe8[_0xc6cc('0x1b')]=qs[_0xc6cc('0x1b')](_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x1b')]);}_0x4c3fe8[_0xc6cc('0x35')]=qs['sort'](_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x36')]);_0x4c3fe8[_0xc6cc('0x37')]=qs[_0xc6cc('0x38')](_[_0xc6cc('0x39')](_0x3fb457[_0xc6cc('0x2e')],_0x59cb56[_0xc6cc('0x38')]),_0x4ff28a);if(_0x3fb457[_0xc6cc('0x2e')][_0xc6cc('0x3a')]){_0x4c3fe8['where']=_['merge'](_0x4c3fe8[_0xc6cc('0x37')],{'$or':_[_0xc6cc('0x3b')](_0x4ff28a,function(_0x5a0eb5){if(_0x5a0eb5['type']!==_0xc6cc('0x3c')){var _0x4739d0={};_0x4739d0[_0x5a0eb5['name']]={'$like':'%'+_0x3fb457['query'][_0xc6cc('0x3a')]+'%'};return _0x4739d0;}})});}_0x4c3fe8=_[_0xc6cc('0x3d')]({},_0x4c3fe8,_0x3fb457[_0xc6cc('0x3e')]);var _0x35b9c9={'where':_0x4c3fe8['where']};return db['SugarcrmConfiguration'][_0xc6cc('0x1d')](_0x35b9c9)[_0xc6cc('0x22')](function(_0x2a9d3d){_0x74be43[_0xc6cc('0x1d')]=_0x2a9d3d;if(_0x3fb457['query']['includeAll']){_0x4c3fe8[_0xc6cc('0x3f')]=[{'all':!![]}];}return db[_0xc6cc('0x29')][_0xc6cc('0x40')](_0x4c3fe8);})['then'](function(_0x5b351a){_0x74be43[_0xc6cc('0x41')]=_0x5b351a;return _0x74be43;})[_0xc6cc('0x22')](respondWithFilteredResult(_0xdda29a,_0x4c3fe8))[_0xc6cc('0x42')](handleError(_0xdda29a,null));};exports[_0xc6cc('0x43')]=function(_0x328219,_0x2c293b){var _0x3170bd={'raw':![],'where':{'id':_0x328219[_0xc6cc('0x44')]['id']}},_0x5893a0={};_0x5893a0[_0xc6cc('0x2d')]=_['keys'](db[_0xc6cc('0x29')][_0xc6cc('0x45')]);_0x5893a0[_0xc6cc('0x2e')]=_[_0xc6cc('0x46')](_0x328219[_0xc6cc('0x2e')]);_0x5893a0[_0xc6cc('0x38')]=_[_0xc6cc('0x2f')](_0x5893a0[_0xc6cc('0x2d')],_0x5893a0['query']);_0x3170bd[_0xc6cc('0x30')]=_[_0xc6cc('0x2f')](_0x5893a0[_0xc6cc('0x2d')],qs[_0xc6cc('0x31')](_0x328219['query'][_0xc6cc('0x31')]));_0x3170bd[_0xc6cc('0x30')]=_0x3170bd[_0xc6cc('0x30')][_0xc6cc('0x32')]?_0x3170bd[_0xc6cc('0x30')]:_0x5893a0[_0xc6cc('0x2d')];if(_0x328219['query'][_0xc6cc('0x47')]){_0x3170bd[_0xc6cc('0x3f')]=[{'all':!![]}];}_0x3170bd=_[_0xc6cc('0x3d')]({},_0x3170bd,_0x328219['options']);return db[_0xc6cc('0x29')][_0xc6cc('0x48')](_0x3170bd)[_0xc6cc('0x22')](handleEntityNotFound(_0x2c293b,null))['then'](respondWithResult(_0x2c293b,null))[_0xc6cc('0x42')](handleError(_0x2c293b,null));};exports['create']=function(_0x505d6c,_0xf9aaaf){return db[_0xc6cc('0x29')][_0xc6cc('0x49')](_0x505d6c[_0xc6cc('0x4a')],{})[_0xc6cc('0x22')](respondWithResult(_0xf9aaaf,0xc9))[_0xc6cc('0x42')](handleError(_0xf9aaaf,null));};exports[_0xc6cc('0x4b')]=function(_0x1618ac,_0x51040e){if(_0x1618ac['body']['id']){delete _0x1618ac['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1618ac['params']['id']}})[_0xc6cc('0x22')](handleEntityNotFound(_0x51040e,null))[_0xc6cc('0x22')](saveUpdates(_0x1618ac[_0xc6cc('0x4a')],null))['then'](respondWithResult(_0x51040e,null))[_0xc6cc('0x42')](handleError(_0x51040e,null));};exports[_0xc6cc('0x23')]=function(_0x242305,_0x2cf2bd){return db[_0xc6cc('0x29')][_0xc6cc('0x48')]({'where':{'id':_0x242305[_0xc6cc('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cf2bd,null))[_0xc6cc('0x22')](removeEntity(_0x2cf2bd,null))[_0xc6cc('0x42')](handleError(_0x2cf2bd,null));};exports[_0xc6cc('0x4c')]=function(_0x404296,_0x2c9a98,_0x3c9756){var _0x3bb831={};var _0x2fc3ca={};var _0x4b0258;var _0x523469;return db[_0xc6cc('0x29')][_0xc6cc('0x4d')]({'where':{'id':_0x404296[_0xc6cc('0x44')]['id']}})[_0xc6cc('0x22')](handleEntityNotFound(_0x2c9a98,null))[_0xc6cc('0x22')](function(_0x1e0e52){if(_0x1e0e52){_0x4b0258=_0x1e0e52;_0x2fc3ca['model']=_[_0xc6cc('0x46')](db[_0xc6cc('0x4e')][_0xc6cc('0x45')]);_0x2fc3ca[_0xc6cc('0x2e')]=_[_0xc6cc('0x46')](_0x404296[_0xc6cc('0x2e')]);_0x2fc3ca['filters']=_[_0xc6cc('0x2f')](_0x2fc3ca['model'],_0x2fc3ca[_0xc6cc('0x2e')]);_0x3bb831['attributes']=_[_0xc6cc('0x2f')](_0x2fc3ca[_0xc6cc('0x2d')],qs[_0xc6cc('0x31')](_0x404296[_0xc6cc('0x2e')][_0xc6cc('0x31')]));_0x3bb831['attributes']=_0x3bb831[_0xc6cc('0x30')][_0xc6cc('0x32')]?_0x3bb831['attributes']:_0x2fc3ca['model'];_0x3bb831['order']=qs[_0xc6cc('0x36')](_0x404296[_0xc6cc('0x2e')][_0xc6cc('0x36')]);_0x3bb831[_0xc6cc('0x37')]=qs['filters'](_['pick'](_0x404296[_0xc6cc('0x2e')],_0x2fc3ca[_0xc6cc('0x38')]));if(_0x404296[_0xc6cc('0x2e')]['filter']){_0x3bb831[_0xc6cc('0x37')]=_[_0xc6cc('0x3d')](_0x3bb831[_0xc6cc('0x37')],{'$or':_[_0xc6cc('0x3b')](_0x3bb831[_0xc6cc('0x30')],function(_0x27274f){var _0x5419cb={};_0x5419cb[_0x27274f]={'$like':'%'+_0x404296[_0xc6cc('0x2e')]['filter']+'%'};return _0x5419cb;})});}_0x3bb831=_[_0xc6cc('0x3d')]({},_0x3bb831,_0x404296[_0xc6cc('0x3e')]);return _0x4b0258['getFields'](_0x3bb831);}})[_0xc6cc('0x22')](function(_0x5a1b8f){if(_0x5a1b8f){_0x523469=_0x5a1b8f[_0xc6cc('0x32')];if(!_0x404296['query'][_0xc6cc('0x33')]('nolimit')){_0x3bb831[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x404296[_0xc6cc('0x2e')][_0xc6cc('0x1e')]);_0x3bb831[_0xc6cc('0x1b')]=qs[_0xc6cc('0x1b')](_0x404296['query'][_0xc6cc('0x1b')]);}return _0x4b0258[_0xc6cc('0x4c')](_0x3bb831);}})[_0xc6cc('0x22')](function(_0x199939){if(_0x199939){return _0x199939?{'count':_0x523469,'rows':_0x199939}:null;}})['then'](respondWithResult(_0x2c9a98,null))[_0xc6cc('0x42')](handleError(_0x2c9a98,null));};exports['getSubjects']=function(_0x5161e2,_0xb5e350,_0x468cce){var _0x4cb2cb={};var _0x3000f2={};var _0x51c23d;var _0x3583e9;return db[_0xc6cc('0x29')][_0xc6cc('0x4d')]({'where':{'id':_0x5161e2['params']['id']}})['then'](handleEntityNotFound(_0xb5e350,null))[_0xc6cc('0x22')](function(_0x6cff7f){if(_0x6cff7f){_0x51c23d=_0x6cff7f;_0x3000f2[_0xc6cc('0x2d')]=_['keys'](db[_0xc6cc('0x4e')][_0xc6cc('0x45')]);_0x3000f2['query']=_['keys'](_0x5161e2[_0xc6cc('0x2e')]);_0x3000f2[_0xc6cc('0x38')]=_[_0xc6cc('0x2f')](_0x3000f2['model'],_0x3000f2[_0xc6cc('0x2e')]);_0x4cb2cb[_0xc6cc('0x30')]=_['intersection'](_0x3000f2['model'],qs[_0xc6cc('0x31')](_0x5161e2[_0xc6cc('0x2e')]['fields']));_0x4cb2cb[_0xc6cc('0x30')]=_0x4cb2cb['attributes'][_0xc6cc('0x32')]?_0x4cb2cb['attributes']:_0x3000f2[_0xc6cc('0x2d')];_0x4cb2cb[_0xc6cc('0x35')]=qs['sort'](_0x5161e2['query'][_0xc6cc('0x36')]);_0x4cb2cb[_0xc6cc('0x37')]=qs[_0xc6cc('0x38')](_[_0xc6cc('0x39')](_0x5161e2[_0xc6cc('0x2e')],_0x3000f2[_0xc6cc('0x38')]));if(_0x5161e2[_0xc6cc('0x2e')][_0xc6cc('0x3a')]){_0x4cb2cb['where']=_[_0xc6cc('0x3d')](_0x4cb2cb['where'],{'$or':_[_0xc6cc('0x3b')](_0x4cb2cb[_0xc6cc('0x30')],function(_0x3e12a6){var _0xcfcf38={};_0xcfcf38[_0x3e12a6]={'$like':'%'+_0x5161e2[_0xc6cc('0x2e')][_0xc6cc('0x3a')]+'%'};return _0xcfcf38;})});}_0x4cb2cb=_[_0xc6cc('0x3d')]({},_0x4cb2cb,_0x5161e2[_0xc6cc('0x3e')]);return _0x51c23d[_0xc6cc('0x4f')](_0x4cb2cb);}})['then'](function(_0x406aff){if(_0x406aff){_0x3583e9=_0x406aff[_0xc6cc('0x32')];if(!_0x5161e2[_0xc6cc('0x2e')]['hasOwnProperty'](_0xc6cc('0x34'))){_0x4cb2cb[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x5161e2['query'][_0xc6cc('0x1e')]);_0x4cb2cb['offset']=qs[_0xc6cc('0x1b')](_0x5161e2[_0xc6cc('0x2e')][_0xc6cc('0x1b')]);}return _0x51c23d['getSubjects'](_0x4cb2cb);}})['then'](function(_0x10d889){if(_0x10d889){return _0x10d889?{'count':_0x3583e9,'rows':_0x10d889}:null;}})[_0xc6cc('0x22')](respondWithResult(_0xb5e350,null))[_0xc6cc('0x42')](handleError(_0xb5e350,null));};exports[_0xc6cc('0x50')]=function(_0x193e71,_0xac806e,_0x126535){var _0x1904c3={};var _0xf4c6e0={};var _0x3b041a;var _0x2d408a;return db[_0xc6cc('0x29')]['findOne']({'where':{'id':_0x193e71[_0xc6cc('0x44')]['id']}})[_0xc6cc('0x22')](handleEntityNotFound(_0xac806e,null))['then'](function(_0x33d52c){if(_0x33d52c){_0x3b041a=_0x33d52c;_0xf4c6e0[_0xc6cc('0x2d')]=_[_0xc6cc('0x46')](db[_0xc6cc('0x4e')][_0xc6cc('0x45')]);_0xf4c6e0[_0xc6cc('0x2e')]=_[_0xc6cc('0x46')](_0x193e71['query']);_0xf4c6e0[_0xc6cc('0x38')]=_[_0xc6cc('0x2f')](_0xf4c6e0[_0xc6cc('0x2d')],_0xf4c6e0['query']);_0x1904c3[_0xc6cc('0x30')]=_['intersection'](_0xf4c6e0[_0xc6cc('0x2d')],qs[_0xc6cc('0x31')](_0x193e71[_0xc6cc('0x2e')]['fields']));_0x1904c3[_0xc6cc('0x30')]=_0x1904c3[_0xc6cc('0x30')]['length']?_0x1904c3['attributes']:_0xf4c6e0[_0xc6cc('0x2d')];_0x1904c3[_0xc6cc('0x35')]=qs['sort'](_0x193e71[_0xc6cc('0x2e')][_0xc6cc('0x36')]);_0x1904c3[_0xc6cc('0x37')]=qs[_0xc6cc('0x38')](_[_0xc6cc('0x39')](_0x193e71[_0xc6cc('0x2e')],_0xf4c6e0[_0xc6cc('0x38')]));if(_0x193e71[_0xc6cc('0x2e')][_0xc6cc('0x3a')]){_0x1904c3['where']=_[_0xc6cc('0x3d')](_0x1904c3[_0xc6cc('0x37')],{'$or':_[_0xc6cc('0x3b')](_0x1904c3['attributes'],function(_0x5832db){var _0xdd7d5={};_0xdd7d5[_0x5832db]={'$like':'%'+_0x193e71[_0xc6cc('0x2e')][_0xc6cc('0x3a')]+'%'};return _0xdd7d5;})});}_0x1904c3=_['merge']({},_0x1904c3,_0x193e71[_0xc6cc('0x3e')]);return _0x3b041a[_0xc6cc('0x50')](_0x1904c3);}})[_0xc6cc('0x22')](function(_0x259d8b){if(_0x259d8b){_0x2d408a=_0x259d8b[_0xc6cc('0x32')];if(!_0x193e71[_0xc6cc('0x2e')][_0xc6cc('0x33')](_0xc6cc('0x34'))){_0x1904c3[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x193e71['query'][_0xc6cc('0x1e')]);_0x1904c3[_0xc6cc('0x1b')]=qs[_0xc6cc('0x1b')](_0x193e71['query'][_0xc6cc('0x1b')]);}return _0x3b041a['getDescriptions'](_0x1904c3);}})['then'](function(_0x3fd926){if(_0x3fd926){return _0x3fd926?{'count':_0x2d408a,'rows':_0x3fd926}:null;}})['then'](respondWithResult(_0xac806e,null))[_0xc6cc('0x42')](handleError(_0xac806e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ebae709..0c332d7 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 _0x9b9c=['moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger','api'];(function(_0x93d9a8,_0x1b3190){var _0x447a1d=function(_0x204a57){while(--_0x204a57){_0x93d9a8['push'](_0x93d9a8['shift']());}};_0x447a1d(++_0x1b3190);}(_0x9b9c,0xb7));var _0xc9b9=function(_0x563de4,_0x3e2e89){_0x563de4=_0x563de4-0x0;var _0xd97f29=_0x9b9c[_0x563de4];return _0xd97f29;};'use strict';var _=require(_0xc9b9('0x0'));var util=require(_0xc9b9('0x1'));var logger=require(_0xc9b9('0x2'))(_0xc9b9('0x3'));var moment=require(_0xc9b9('0x4'));var BPromise=require(_0xc9b9('0x5'));var rp=require(_0xc9b9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b9('0x7'));var config=require('../../config/environment');var attributes=require(_0xc9b9('0x8'));module[_0xc9b9('0x9')]=function(_0x29f9d6,_0x1f923a){return _0x29f9d6['define'](_0xc9b9('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x333d=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2b9ac8,_0xf820cb){var _0x3ceea9=function(_0x407d34){while(--_0x407d34){_0x2b9ac8['push'](_0x2b9ac8['shift']());}};_0x3ceea9(++_0xf820cb);}(_0x333d,0x137));var _0xd333=function(_0x1bb47b,_0x54e02e){_0x1bb47b=_0x1bb47b-0x0;var _0x566418=_0x333d[_0x1bb47b];return _0x566418;};'use strict';var _=require(_0xd333('0x0'));var util=require(_0xd333('0x1'));var logger=require(_0xd333('0x2'))(_0xd333('0x3'));var moment=require(_0xd333('0x4'));var BPromise=require('bluebird');var rp=require(_0xd333('0x5'));var fs=require('fs');var path=require(_0xd333('0x6'));var rimraf=require(_0xd333('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xd333('0x8')]=function(_0x12d8ef,_0x57dd4d){return _0x12d8ef['define'](_0xd333('0x9'),attributes,{'tableName':_0xd333('0xa'),'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 9536d15..860950e 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 _0xd09b=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x308146,_0x54dcc8){var _0x40a219=function(_0x19d4a6){while(--_0x19d4a6){_0x308146['push'](_0x308146['shift']());}};_0x40a219(++_0x54dcc8);}(_0xd09b,0x97));var _0xbd09=function(_0x39b8d0,_0x597110){_0x39b8d0=_0x39b8d0-0x0;var _0x491857=_0xd09b[_0x39b8d0];return _0x491857;};'use strict';var _=require(_0xbd09('0x0'));var util=require(_0xbd09('0x1'));var moment=require(_0xbd09('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd09('0x3'));var fs=require('fs');var Redis=require(_0xbd09('0x4'));var db=require(_0xbd09('0x5'))['db'];var utils=require(_0xbd09('0x6'));var logger=require('../../config/logger')(_0xbd09('0x7'));var config=require(_0xbd09('0x8'));var jayson=require(_0xbd09('0x9'));var client=jayson[_0xbd09('0xa')][_0xbd09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cc5a9,_0x28db0c,_0x65238d){return new BPromise(function(_0x644f42,_0x29404d){return client[_0xbd09('0xc')](_0x5cc5a9,_0x65238d)['then'](function(_0x398588){logger[_0xbd09('0xd')](_0xbd09('0xe'),_0x28db0c,_0xbd09('0xf'));logger['debug'](_0xbd09('0x10'),_0x28db0c,_0xbd09('0xf'),JSON['stringify'](_0x398588));if(_0x398588['error']){if(_0x398588[_0xbd09('0x11')]['code']===0x1f4){logger[_0xbd09('0x11')](_0xbd09('0xe'),_0x28db0c,_0x398588[_0xbd09('0x11')]['message']);return _0x29404d(_0x398588[_0xbd09('0x11')][_0xbd09('0x12')]);}logger[_0xbd09('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28db0c,_0x398588[_0xbd09('0x11')][_0xbd09('0x12')]);return _0x644f42(_0x398588[_0xbd09('0x11')]['message']);}else{logger[_0xbd09('0xd')](_0xbd09('0xe'),_0x28db0c,_0xbd09('0xf'));_0x644f42(_0x398588[_0xbd09('0x13')]['message']);}})[_0xbd09('0x14')](function(_0x1b2825){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x28db0c,_0x1b2825);_0x29404d(_0x1b2825);});});} \ No newline at end of file +var _0x64f0=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x64f0,0x144));var _0x064f=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x64f0[_0x5a7d41];return _0x98d8fa;};'use strict';var _=require(_0x064f('0x0'));var util=require(_0x064f('0x1'));var moment=require('moment');var BPromise=require(_0x064f('0x2'));var rs=require(_0x064f('0x3'));var fs=require('fs');var Redis=require(_0x064f('0x4'));var db=require(_0x064f('0x5'))['db'];var utils=require(_0x064f('0x6'));var logger=require(_0x064f('0x7'))('rpc');var config=require(_0x064f('0x8'));var jayson=require(_0x064f('0x9'));var client=jayson[_0x064f('0xa')][_0x064f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea541c,_0x1bda12,_0x4eed1a){return new BPromise(function(_0x29e88a,_0x779a7){return client[_0x064f('0xc')](_0xea541c,_0x4eed1a)[_0x064f('0xd')](function(_0x8244e3){logger['info'](_0x064f('0xe'),_0x1bda12,_0x064f('0xf'));logger[_0x064f('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1bda12,_0x064f('0xf'),JSON[_0x064f('0x11')](_0x8244e3));if(_0x8244e3['error']){if(_0x8244e3[_0x064f('0x12')][_0x064f('0x13')]===0x1f4){logger['error'](_0x064f('0xe'),_0x1bda12,_0x8244e3[_0x064f('0x12')][_0x064f('0x14')]);return _0x779a7(_0x8244e3[_0x064f('0x12')][_0x064f('0x14')]);}logger[_0x064f('0x12')](_0x064f('0xe'),_0x1bda12,_0x8244e3['error'][_0x064f('0x14')]);return _0x29e88a(_0x8244e3[_0x064f('0x12')]['message']);}else{logger['info'](_0x064f('0xe'),_0x1bda12,'request\x20sent');_0x29e88a(_0x8244e3[_0x064f('0x15')]['message']);}})['catch'](function(_0x162745){logger['error'](_0x064f('0xe'),_0x1bda12,_0x162745);_0x779a7(_0x162745);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6134caa..e6588ef 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 _0x04dd=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer'];(function(_0x3945e2,_0x588e9b){var _0x21e322=function(_0x4fbb69){while(--_0x4fbb69){_0x3945e2['push'](_0x3945e2['shift']());}};_0x21e322(++_0x588e9b);}(_0x04dd,0x9f));var _0xd04d=function(_0x5a709c,_0x1e6cfe){_0x5a709c=_0x5a709c-0x0;var _0x719025=_0x04dd[_0x5a709c];return _0x719025;};'use strict';var multer=require(_0xd04d('0x0'));var util=require(_0xd04d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd04d('0x2'));var router=express[_0xd04d('0x3')]();var fs_extra=require(_0xd04d('0x4'));var auth=require(_0xd04d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd04d('0x6'));var controller=require('./intSugarcrmField.controller');router[_0xd04d('0x7')]('/',auth[_0xd04d('0x8')](),controller[_0xd04d('0x9')]);router[_0xd04d('0x7')](_0xd04d('0xa'),auth[_0xd04d('0x8')](),controller[_0xd04d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd04d('0xc')]('/:id',auth[_0xd04d('0x8')](),controller['update']);router[_0xd04d('0xd')](_0xd04d('0xa'),auth[_0xd04d('0x8')](),controller[_0xd04d('0xe')]);module[_0xd04d('0xf')]=router; \ No newline at end of file +var _0xf0e5=['put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xf0e5,0x1a2));var _0x5f0e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf0e5[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x5f0e('0x0'));var util=require(_0x5f0e('0x1'));var path=require('path');var timeout=require(_0x5f0e('0x2'));var express=require(_0x5f0e('0x3'));var router=express[_0x5f0e('0x4')]();var fs_extra=require(_0x5f0e('0x5'));var auth=require(_0x5f0e('0x6'));var interaction=require(_0x5f0e('0x7'));var config=require(_0x5f0e('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x5f0e('0x9')]('/',auth[_0x5f0e('0xa')](),controller[_0x5f0e('0xb')]);router[_0x5f0e('0x9')](_0x5f0e('0xc'),auth[_0x5f0e('0xa')](),controller[_0x5f0e('0xd')]);router['post']('/',auth[_0x5f0e('0xa')](),controller['create']);router[_0x5f0e('0xe')](_0x5f0e('0xc'),auth[_0x5f0e('0xa')](),controller['update']);router['delete'](_0x5f0e('0xc'),auth[_0x5f0e('0xa')](),controller[_0x5f0e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4efeb06..9561366 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 _0xe460=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x3d8aef,_0x4cbbfd){var _0x3b360f=function(_0x1987a6){while(--_0x1987a6){_0x3d8aef['push'](_0x3d8aef['shift']());}};_0x3b360f(++_0x4cbbfd);}(_0xe460,0x118));var _0x0e46=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0xe460[_0x2e655a];return _0x26f13b;};'use strict';var Sequelize=require('sequelize');module[_0x0e46('0x0')]={'type':{'type':Sequelize[_0x0e46('0x1')](_0x0e46('0x2'),'variable',_0x0e46('0x3'),_0x0e46('0x4'),_0x0e46('0x5')),'defaultValue':_0x0e46('0x2')},'content':{'type':Sequelize[_0x0e46('0x6')]},'key':{'type':Sequelize[_0x0e46('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0e46('0x2'),_0x0e46('0x7'),_0x0e46('0x3'))},'keyContent':{'type':Sequelize[_0x0e46('0x6')]},'idField':{'type':Sequelize[_0x0e46('0x6')]},'nameField':{'type':Sequelize[_0x0e46('0x6')]},'customField':{'type':Sequelize[_0x0e46('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e46('0x6')]}}; \ No newline at end of file +var _0x2c00=['BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x4c72a0,_0x5c7867){var _0x42ac21=function(_0x1d272d){while(--_0x1d272d){_0x4c72a0['push'](_0x4c72a0['shift']());}};_0x42ac21(++_0x5c7867);}(_0x2c00,0x79));var _0x02c0=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x2c00[_0x58eec7];return _0x25c5d3;};'use strict';var Sequelize=require(_0x02c0('0x0'));module[_0x02c0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x02c0('0x2'),'variable',_0x02c0('0x3'),_0x02c0('0x4'),_0x02c0('0x5')),'defaultValue':_0x02c0('0x2')},'content':{'type':Sequelize[_0x02c0('0x6')]},'key':{'type':Sequelize[_0x02c0('0x6')]},'keyType':{'type':Sequelize[_0x02c0('0x7')]('string',_0x02c0('0x8'),_0x02c0('0x3'))},'keyContent':{'type':Sequelize[_0x02c0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x02c0('0x6')]},'customField':{'type':Sequelize[_0x02c0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index dde41ca..c781757 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 _0x6890=['update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','rows','show','length','includeAll','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save'];(function(_0x29e5de,_0x19242b){var _0x18aceb=function(_0x4ed041){while(--_0x4ed041){_0x29e5de['push'](_0x29e5de['shift']());}};_0x18aceb(++_0x19242b);}(_0x6890,0x10e));var _0x0689=function(_0x306781,_0x1f6f49){_0x306781=_0x306781-0x0;var _0x1f5ef5=_0x6890[_0x306781];return _0x1f5ef5;};'use strict';var emlformat=require(_0x0689('0x0'));var rimraf=require(_0x0689('0x1'));var zipdir=require(_0x0689('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0689('0x3'));var moment=require(_0x0689('0x4'));var BPromise=require(_0x0689('0x5'));var Mustache=require(_0x0689('0x6'));var util=require(_0x0689('0x7'));var path=require(_0x0689('0x8'));var sox=require(_0x0689('0x9'));var csv=require(_0x0689('0xa'));var ejs=require(_0x0689('0xb'));var fs=require('fs');var fs_extra=require(_0x0689('0xc'));var _=require(_0x0689('0xd'));var squel=require(_0x0689('0xe'));var crypto=require('crypto');var jsforce=require(_0x0689('0xf'));var deskjs=require(_0x0689('0x10'));var toCsv=require(_0x0689('0xa'));var querystring=require('querystring');var Papa=require(_0x0689('0x11'));var Redis=require(_0x0689('0x12'));var authService=require(_0x0689('0x13'));var qs=require(_0x0689('0x14'));var as=require(_0x0689('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0689('0x16'))(_0x0689('0x17'));var utils=require(_0x0689('0x18'));var config=require(_0x0689('0x19'));var licenseUtil=require(_0x0689('0x1a'));var db=require(_0x0689('0x1b'))['db'];function respondWithStatusCode(_0x538554,_0x9387aa){_0x9387aa=_0x9387aa||0xcc;return function(_0x4bf165){if(_0x4bf165){return _0x538554[_0x0689('0x1c')](_0x9387aa);}return _0x538554[_0x0689('0x1d')](_0x9387aa)[_0x0689('0x1e')]();};}function respondWithResult(_0x3c5302,_0x32c3f8){_0x32c3f8=_0x32c3f8||0xc8;return function(_0x242b2f){if(_0x242b2f){return _0x3c5302[_0x0689('0x1d')](_0x32c3f8)[_0x0689('0x1f')](_0x242b2f);}};}function respondWithFilteredResult(_0x539b22,_0x4fb604){return function(_0x2171ed){if(_0x2171ed){var _0x5c8fa5=typeof _0x4fb604[_0x0689('0x20')]===_0x0689('0x21')&&typeof _0x4fb604[_0x0689('0x22')]===_0x0689('0x21');var _0x52ceef=_0x2171ed['count'];var _0x4003a2=_0x5c8fa5?0x0:_0x4fb604[_0x0689('0x20')];var _0x1e52e8=_0x5c8fa5?_0x2171ed[_0x0689('0x23')]:_0x4fb604[_0x0689('0x20')]+_0x4fb604[_0x0689('0x22')];var _0x38ad55;if(_0x1e52e8>=_0x52ceef){_0x1e52e8=_0x52ceef;_0x38ad55=0xc8;}else{_0x38ad55=0xce;}_0x539b22[_0x0689('0x1d')](_0x38ad55);return _0x539b22['set']('Content-Range',_0x4003a2+'-'+_0x1e52e8+'/'+_0x52ceef)[_0x0689('0x1f')](_0x2171ed);}return null;};}function patchUpdates(_0x1b920a){return function(_0x17b7a2){try{jsonpatch['apply'](_0x17b7a2,_0x1b920a,!![]);}catch(_0x54344e){return BPromise[_0x0689('0x24')](_0x54344e);}return _0x17b7a2[_0x0689('0x25')]();};}function saveUpdates(_0x14fe94,_0x3a125d){return function(_0x324daa){if(_0x324daa){return _0x324daa[_0x0689('0x26')](_0x14fe94)[_0x0689('0x27')](function(_0x3e4f3a){return _0x3e4f3a;});}return null;};}function removeEntity(_0x50a516,_0x34a394){return function(_0x2c85cd){if(_0x2c85cd){return _0x2c85cd[_0x0689('0x28')]()[_0x0689('0x27')](function(){_0x50a516[_0x0689('0x1d')](0xcc)[_0x0689('0x1e')]();});}};}function handleEntityNotFound(_0x386496,_0x1ce7ae){return function(_0x26921e){if(!_0x26921e){_0x386496[_0x0689('0x1c')](0x194);}return _0x26921e;};}function handleError(_0x16f4fa,_0x3a6808){_0x3a6808=_0x3a6808||0x1f4;return function(_0x15dac4){logger[_0x0689('0x29')](_0x15dac4[_0x0689('0x2a')]);if(_0x15dac4[_0x0689('0x2b')]){delete _0x15dac4[_0x0689('0x2b')];}_0x16f4fa[_0x0689('0x1d')](_0x3a6808)[_0x0689('0x2c')](_0x15dac4);};}exports[_0x0689('0x2d')]=function(_0x11ab1b,_0x268a95){var _0x1245f1={},_0x3f2239={},_0x3df785={'count':0x0,'rows':[]};var _0x3667e0=_['map'](db[_0x0689('0x2e')][_0x0689('0x2f')],function(_0x434b0a){return{'name':_0x434b0a[_0x0689('0x30')],'type':_0x434b0a[_0x0689('0x31')][_0x0689('0x32')]};});_0x3f2239[_0x0689('0x33')]=_[_0x0689('0x34')](_0x3667e0,_0x0689('0x2b'));_0x3f2239[_0x0689('0x35')]=_[_0x0689('0x36')](_0x11ab1b[_0x0689('0x35')]);_0x3f2239[_0x0689('0x37')]=_[_0x0689('0x38')](_0x3f2239[_0x0689('0x33')],_0x3f2239[_0x0689('0x35')]);_0x1245f1[_0x0689('0x39')]=_[_0x0689('0x38')](_0x3f2239[_0x0689('0x33')],qs['fields'](_0x11ab1b[_0x0689('0x35')][_0x0689('0x3a')]));_0x1245f1[_0x0689('0x39')]=_0x1245f1['attributes']['length']?_0x1245f1[_0x0689('0x39')]:_0x3f2239['model'];if(!_0x11ab1b[_0x0689('0x35')][_0x0689('0x3b')](_0x0689('0x3c'))){_0x1245f1['limit']=qs[_0x0689('0x22')](_0x11ab1b[_0x0689('0x35')]['limit']);_0x1245f1[_0x0689('0x20')]=qs[_0x0689('0x20')](_0x11ab1b[_0x0689('0x35')][_0x0689('0x20')]);}_0x1245f1[_0x0689('0x3d')]=qs[_0x0689('0x3e')](_0x11ab1b[_0x0689('0x35')][_0x0689('0x3e')]);_0x1245f1[_0x0689('0x3f')]=qs[_0x0689('0x37')](_[_0x0689('0x40')](_0x11ab1b[_0x0689('0x35')],_0x3f2239[_0x0689('0x37')]),_0x3667e0);if(_0x11ab1b['query'][_0x0689('0x41')]){_0x1245f1[_0x0689('0x3f')]=_[_0x0689('0x42')](_0x1245f1['where'],{'$or':_[_0x0689('0x34')](_0x3667e0,function(_0x2d9997){if(_0x2d9997[_0x0689('0x31')]!=='VIRTUAL'){var _0x26e0f1={};_0x26e0f1[_0x2d9997[_0x0689('0x2b')]]={'$like':'%'+_0x11ab1b[_0x0689('0x35')][_0x0689('0x41')]+'%'};return _0x26e0f1;}})});}_0x1245f1=_[_0x0689('0x42')]({},_0x1245f1,_0x11ab1b[_0x0689('0x43')]);var _0x4d0b88={'where':_0x1245f1[_0x0689('0x3f')]};return db[_0x0689('0x2e')][_0x0689('0x23')](_0x4d0b88)[_0x0689('0x27')](function(_0x4adedc){_0x3df785[_0x0689('0x23')]=_0x4adedc;if(_0x11ab1b[_0x0689('0x35')]['includeAll']){_0x1245f1['include']=[{'all':!![]}];}return db[_0x0689('0x2e')]['findAll'](_0x1245f1);})[_0x0689('0x27')](function(_0x364206){_0x3df785[_0x0689('0x44')]=_0x364206;return _0x3df785;})['then'](respondWithFilteredResult(_0x268a95,_0x1245f1))['catch'](handleError(_0x268a95,null));};exports[_0x0689('0x45')]=function(_0x10037e,_0x54d43c){var _0x46ae13={'raw':!![],'where':{'id':_0x10037e['params']['id']}},_0x808bdb={};_0x808bdb['model']=_['keys'](db[_0x0689('0x2e')][_0x0689('0x2f')]);_0x808bdb[_0x0689('0x35')]=_[_0x0689('0x36')](_0x10037e[_0x0689('0x35')]);_0x808bdb[_0x0689('0x37')]=_[_0x0689('0x38')](_0x808bdb[_0x0689('0x33')],_0x808bdb[_0x0689('0x35')]);_0x46ae13[_0x0689('0x39')]=_['intersection'](_0x808bdb[_0x0689('0x33')],qs[_0x0689('0x3a')](_0x10037e[_0x0689('0x35')][_0x0689('0x3a')]));_0x46ae13[_0x0689('0x39')]=_0x46ae13[_0x0689('0x39')][_0x0689('0x46')]?_0x46ae13['attributes']:_0x808bdb['model'];if(_0x10037e['query'][_0x0689('0x47')]){_0x46ae13['include']=[{'all':!![]}];}_0x46ae13=_[_0x0689('0x42')]({},_0x46ae13,_0x10037e[_0x0689('0x43')]);return db['SugarcrmField'][_0x0689('0x48')](_0x46ae13)['then'](handleEntityNotFound(_0x54d43c,null))[_0x0689('0x27')](respondWithResult(_0x54d43c,null))[_0x0689('0x49')](handleError(_0x54d43c,null));};exports[_0x0689('0x4a')]=function(_0x443195,_0x29d826){return db[_0x0689('0x2e')][_0x0689('0x4a')](_0x443195[_0x0689('0x4b')],{})[_0x0689('0x27')](respondWithResult(_0x29d826,0xc9))['catch'](handleError(_0x29d826,null));};exports[_0x0689('0x26')]=function(_0x126c06,_0x3a0825){if(_0x126c06['body']['id']){delete _0x126c06[_0x0689('0x4b')]['id'];}return db[_0x0689('0x2e')][_0x0689('0x48')]({'where':{'id':_0x126c06[_0x0689('0x4c')]['id']}})[_0x0689('0x27')](handleEntityNotFound(_0x3a0825,null))[_0x0689('0x27')](saveUpdates(_0x126c06[_0x0689('0x4b')],null))[_0x0689('0x27')](respondWithResult(_0x3a0825,null))[_0x0689('0x49')](handleError(_0x3a0825,null));};exports[_0x0689('0x28')]=function(_0x27bf2f,_0x2887b5){return db[_0x0689('0x2e')][_0x0689('0x48')]({'where':{'id':_0x27bf2f[_0x0689('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2887b5,null))[_0x0689('0x27')](removeEntity(_0x2887b5,null))['catch'](handleError(_0x2887b5,null));}; \ No newline at end of file +var _0x94c7=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x18029a,_0x104d32){var _0x198420=function(_0x5695a8){while(--_0x5695a8){_0x18029a['push'](_0x18029a['shift']());}};_0x198420(++_0x104d32);}(_0x94c7,0x1b9));var _0x794c=function(_0x306e42,_0x1639af){_0x306e42=_0x306e42-0x0;var _0xa0ff27=_0x94c7[_0x306e42];return _0xa0ff27;};'use strict';var emlformat=require(_0x794c('0x0'));var rimraf=require(_0x794c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x794c('0x2'));var BPromise=require(_0x794c('0x3'));var Mustache=require(_0x794c('0x4'));var util=require(_0x794c('0x5'));var path=require(_0x794c('0x6'));var sox=require(_0x794c('0x7'));var csv=require(_0x794c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x794c('0x9'));var _=require(_0x794c('0xa'));var squel=require(_0x794c('0xb'));var crypto=require(_0x794c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x794c('0xd'));var toCsv=require(_0x794c('0x8'));var querystring=require(_0x794c('0xe'));var Papa=require(_0x794c('0xf'));var Redis=require(_0x794c('0x10'));var authService=require(_0x794c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x794c('0x12'));var hardwareService=require(_0x794c('0x13'));var logger=require(_0x794c('0x14'))(_0x794c('0x15'));var utils=require(_0x794c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x794c('0x17'))['db'];function respondWithStatusCode(_0x38d42b,_0x39b68a){_0x39b68a=_0x39b68a||0xcc;return function(_0x30b851){if(_0x30b851){return _0x38d42b['sendStatus'](_0x39b68a);}return _0x38d42b['status'](_0x39b68a)['end']();};}function respondWithResult(_0x8d9d2c,_0x2771e3){_0x2771e3=_0x2771e3||0xc8;return function(_0x5209bd){if(_0x5209bd){return _0x8d9d2c['status'](_0x2771e3)[_0x794c('0x18')](_0x5209bd);}};}function respondWithFilteredResult(_0x34ff41,_0x423ddd){return function(_0x1e1425){if(_0x1e1425){var _0x385f24=typeof _0x423ddd[_0x794c('0x19')]===_0x794c('0x1a')&&typeof _0x423ddd[_0x794c('0x1b')]==='undefined';var _0x2ee738=_0x1e1425[_0x794c('0x1c')];var _0x217160=_0x385f24?0x0:_0x423ddd[_0x794c('0x19')];var _0x15f3ec=_0x385f24?_0x1e1425[_0x794c('0x1c')]:_0x423ddd[_0x794c('0x19')]+_0x423ddd[_0x794c('0x1b')];var _0xa42ce4;if(_0x15f3ec>=_0x2ee738){_0x15f3ec=_0x2ee738;_0xa42ce4=0xc8;}else{_0xa42ce4=0xce;}_0x34ff41[_0x794c('0x1d')](_0xa42ce4);return _0x34ff41['set'](_0x794c('0x1e'),_0x217160+'-'+_0x15f3ec+'/'+_0x2ee738)[_0x794c('0x18')](_0x1e1425);}return null;};}function patchUpdates(_0x37a9db){return function(_0x966827){try{jsonpatch[_0x794c('0x1f')](_0x966827,_0x37a9db,!![]);}catch(_0x2ca389){return BPromise[_0x794c('0x20')](_0x2ca389);}return _0x966827[_0x794c('0x21')]();};}function saveUpdates(_0x19bfb3,_0x4bf040){return function(_0x544e4b){if(_0x544e4b){return _0x544e4b[_0x794c('0x22')](_0x19bfb3)[_0x794c('0x23')](function(_0x415665){return _0x415665;});}return null;};}function removeEntity(_0x3bff74,_0x3587bc){return function(_0x11050f){if(_0x11050f){return _0x11050f[_0x794c('0x24')]()[_0x794c('0x23')](function(){_0x3bff74['status'](0xcc)[_0x794c('0x25')]();});}};}function handleEntityNotFound(_0x57d9ea,_0x47814f){return function(_0x1c1ac7){if(!_0x1c1ac7){_0x57d9ea['sendStatus'](0x194);}return _0x1c1ac7;};}function handleError(_0xa3ad40,_0x5e637f){_0x5e637f=_0x5e637f||0x1f4;return function(_0x41f316){logger['error'](_0x41f316[_0x794c('0x26')]);if(_0x41f316[_0x794c('0x27')]){delete _0x41f316[_0x794c('0x27')];}_0xa3ad40[_0x794c('0x1d')](_0x5e637f)[_0x794c('0x28')](_0x41f316);};}exports[_0x794c('0x29')]=function(_0x4ffb45,_0xb55e2e){var _0xb6b1da={},_0x8e5f91={},_0x53367f={'count':0x0,'rows':[]};var _0x310fa9=_[_0x794c('0x2a')](db['SugarcrmField'][_0x794c('0x2b')],function(_0x369d09){return{'name':_0x369d09[_0x794c('0x2c')],'type':_0x369d09[_0x794c('0x2d')][_0x794c('0x2e')]};});_0x8e5f91[_0x794c('0x2f')]=_[_0x794c('0x2a')](_0x310fa9,_0x794c('0x27'));_0x8e5f91[_0x794c('0x30')]=_[_0x794c('0x31')](_0x4ffb45[_0x794c('0x30')]);_0x8e5f91[_0x794c('0x32')]=_['intersection'](_0x8e5f91[_0x794c('0x2f')],_0x8e5f91[_0x794c('0x30')]);_0xb6b1da[_0x794c('0x33')]=_[_0x794c('0x34')](_0x8e5f91[_0x794c('0x2f')],qs[_0x794c('0x35')](_0x4ffb45[_0x794c('0x30')]['fields']));_0xb6b1da[_0x794c('0x33')]=_0xb6b1da[_0x794c('0x33')][_0x794c('0x36')]?_0xb6b1da[_0x794c('0x33')]:_0x8e5f91[_0x794c('0x2f')];if(!_0x4ffb45['query'][_0x794c('0x37')](_0x794c('0x38'))){_0xb6b1da[_0x794c('0x1b')]=qs[_0x794c('0x1b')](_0x4ffb45[_0x794c('0x30')][_0x794c('0x1b')]);_0xb6b1da[_0x794c('0x19')]=qs[_0x794c('0x19')](_0x4ffb45['query']['offset']);}_0xb6b1da[_0x794c('0x39')]=qs[_0x794c('0x3a')](_0x4ffb45[_0x794c('0x30')]['sort']);_0xb6b1da[_0x794c('0x3b')]=qs[_0x794c('0x32')](_[_0x794c('0x3c')](_0x4ffb45[_0x794c('0x30')],_0x8e5f91[_0x794c('0x32')]),_0x310fa9);if(_0x4ffb45[_0x794c('0x30')][_0x794c('0x3d')]){_0xb6b1da['where']=_[_0x794c('0x3e')](_0xb6b1da[_0x794c('0x3b')],{'$or':_[_0x794c('0x2a')](_0x310fa9,function(_0x3bcd16){if(_0x3bcd16[_0x794c('0x2d')]!==_0x794c('0x3f')){var _0x1c9c97={};_0x1c9c97[_0x3bcd16[_0x794c('0x27')]]={'$like':'%'+_0x4ffb45['query'][_0x794c('0x3d')]+'%'};return _0x1c9c97;}})});}_0xb6b1da=_[_0x794c('0x3e')]({},_0xb6b1da,_0x4ffb45[_0x794c('0x40')]);var _0x4b33f3={'where':_0xb6b1da[_0x794c('0x3b')]};return db[_0x794c('0x41')][_0x794c('0x1c')](_0x4b33f3)[_0x794c('0x23')](function(_0x411a4e){_0x53367f[_0x794c('0x1c')]=_0x411a4e;if(_0x4ffb45[_0x794c('0x30')][_0x794c('0x42')]){_0xb6b1da[_0x794c('0x43')]=[{'all':!![]}];}return db['SugarcrmField'][_0x794c('0x44')](_0xb6b1da);})[_0x794c('0x23')](function(_0x580d00){_0x53367f['rows']=_0x580d00;return _0x53367f;})[_0x794c('0x23')](respondWithFilteredResult(_0xb55e2e,_0xb6b1da))[_0x794c('0x45')](handleError(_0xb55e2e,null));};exports[_0x794c('0x46')]=function(_0x8d6c9c,_0x4bb959){var _0x3d4555={'raw':!![],'where':{'id':_0x8d6c9c[_0x794c('0x47')]['id']}},_0x13724={};_0x13724['model']=_[_0x794c('0x31')](db[_0x794c('0x41')]['rawAttributes']);_0x13724[_0x794c('0x30')]=_[_0x794c('0x31')](_0x8d6c9c[_0x794c('0x30')]);_0x13724['filters']=_[_0x794c('0x34')](_0x13724[_0x794c('0x2f')],_0x13724['query']);_0x3d4555[_0x794c('0x33')]=_['intersection'](_0x13724[_0x794c('0x2f')],qs[_0x794c('0x35')](_0x8d6c9c['query']['fields']));_0x3d4555['attributes']=_0x3d4555[_0x794c('0x33')][_0x794c('0x36')]?_0x3d4555['attributes']:_0x13724[_0x794c('0x2f')];if(_0x8d6c9c['query'][_0x794c('0x42')]){_0x3d4555[_0x794c('0x43')]=[{'all':!![]}];}_0x3d4555=_[_0x794c('0x3e')]({},_0x3d4555,_0x8d6c9c[_0x794c('0x40')]);return db['SugarcrmField'][_0x794c('0x48')](_0x3d4555)[_0x794c('0x23')](handleEntityNotFound(_0x4bb959,null))[_0x794c('0x23')](respondWithResult(_0x4bb959,null))[_0x794c('0x45')](handleError(_0x4bb959,null));};exports[_0x794c('0x49')]=function(_0x1d021e,_0x18b996){return db[_0x794c('0x41')][_0x794c('0x49')](_0x1d021e[_0x794c('0x4a')],{})[_0x794c('0x23')](respondWithResult(_0x18b996,0xc9))[_0x794c('0x45')](handleError(_0x18b996,null));};exports[_0x794c('0x22')]=function(_0x393b8f,_0x2ea5d2){if(_0x393b8f[_0x794c('0x4a')]['id']){delete _0x393b8f[_0x794c('0x4a')]['id'];}return db[_0x794c('0x41')][_0x794c('0x48')]({'where':{'id':_0x393b8f[_0x794c('0x47')]['id']}})[_0x794c('0x23')](handleEntityNotFound(_0x2ea5d2,null))[_0x794c('0x23')](saveUpdates(_0x393b8f['body'],null))[_0x794c('0x23')](respondWithResult(_0x2ea5d2,null))[_0x794c('0x45')](handleError(_0x2ea5d2,null));};exports[_0x794c('0x24')]=function(_0x25d12e,_0x45b53b){return db[_0x794c('0x41')][_0x794c('0x48')]({'where':{'id':_0x25d12e[_0x794c('0x47')]['id']}})[_0x794c('0x23')](handleEntityNotFound(_0x45b53b,null))[_0x794c('0x23')](removeEntity(_0x45b53b,null))['catch'](handleError(_0x45b53b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a0855a2..1cf06bd 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 _0x10d7=['request-promise','path','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10d7,0x168));var _0x710d=function(_0x34440c,_0x29e860){_0x34440c=_0x34440c-0x0;var _0x57266d=_0x10d7[_0x34440c];return _0x57266d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x710d('0x0'))(_0x710d('0x1'));var moment=require(_0x710d('0x2'));var BPromise=require(_0x710d('0x3'));var rp=require(_0x710d('0x4'));var fs=require('fs');var path=require(_0x710d('0x5'));var rimraf=require(_0x710d('0x6'));var config=require('../../config/environment');var attributes=require(_0x710d('0x7'));module['exports']=function(_0x5b6b42,_0x1dd449){return _0x5b6b42[_0x710d('0x8')](_0x710d('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x710d('0xa'),'fields':[_0x710d('0xb'),_0x710d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67a0=['sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x67a0,0x81));var _0x067a=function(_0x2322ba,_0xf3548a){_0x2322ba=_0x2322ba-0x0;var _0x54da3a=_0x67a0[_0x2322ba];return _0x54da3a;};'use strict';var _=require(_0x067a('0x0'));var util=require('util');var logger=require(_0x067a('0x1'))(_0x067a('0x2'));var moment=require('moment');var BPromise=require(_0x067a('0x3'));var rp=require(_0x067a('0x4'));var fs=require('fs');var path=require(_0x067a('0x5'));var rimraf=require('rimraf');var config=require(_0x067a('0x6'));var attributes=require(_0x067a('0x7'));module[_0x067a('0x8')]=function(_0x3bc35b,_0xb48d05){return _0x3bc35b[_0x067a('0x9')]('SugarcrmField',attributes,{'tableName':_0x067a('0xa'),'paranoid':![],'indexes':[{'name':_0x067a('0xb'),'fields':[_0x067a('0xc'),_0x067a('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 2cba99c..eab4b4d 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 _0xca3e=['rpc','client','http','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xca3e,0xcc));var _0xeca3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xca3e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xeca3('0x0'));var util=require(_0xeca3('0x1'));var moment=require(_0xeca3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeca3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeca3('0x4'));var logger=require(_0xeca3('0x5'))(_0xeca3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeca3('0x7')][_0xeca3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe284c5,_0x3cf8f6,_0x11668a){return new BPromise(function(_0x4fedc5,_0x4e79ba){return client[_0xeca3('0x9')](_0xe284c5,_0x11668a)[_0xeca3('0xa')](function(_0x450616){logger[_0xeca3('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x3cf8f6,_0xeca3('0xc'));logger['debug'](_0xeca3('0xd'),_0x3cf8f6,_0xeca3('0xc'),JSON[_0xeca3('0xe')](_0x450616));if(_0x450616['error']){if(_0x450616[_0xeca3('0xf')][_0xeca3('0x10')]===0x1f4){logger[_0xeca3('0xf')](_0xeca3('0x11'),_0x3cf8f6,_0x450616['error'][_0xeca3('0x12')]);return _0x4e79ba(_0x450616[_0xeca3('0xf')]['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3cf8f6,_0x450616[_0xeca3('0xf')]['message']);return _0x4fedc5(_0x450616[_0xeca3('0xf')][_0xeca3('0x12')]);}else{logger[_0xeca3('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x3cf8f6,'request\x20sent');_0x4fedc5(_0x450616[_0xeca3('0x13')][_0xeca3('0x12')]);}})[_0xeca3('0x14')](function(_0x1b4f3c){logger['error'](_0xeca3('0x11'),_0x3cf8f6,_0x1b4f3c);_0x4e79ba(_0x1b4f3c);});});} \ No newline at end of file +var _0x4871=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x4871,0x1d4));var _0x1487=function(_0x7f6856,_0x51e8d6){_0x7f6856=_0x7f6856-0x0;var _0x30f8e9=_0x4871[_0x7f6856];return _0x30f8e9;};'use strict';var _=require(_0x1487('0x0'));var util=require(_0x1487('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1487('0x2'));var fs=require('fs');var Redis=require(_0x1487('0x3'));var db=require(_0x1487('0x4'))['db'];var utils=require(_0x1487('0x5'));var logger=require('../../config/logger')(_0x1487('0x6'));var config=require(_0x1487('0x7'));var jayson=require(_0x1487('0x8'));var client=jayson[_0x1487('0x9')][_0x1487('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c814b,_0x31bbb6,_0x5a0de2){return new BPromise(function(_0xa18512,_0x52231e){return client[_0x1487('0xb')](_0x2c814b,_0x5a0de2)[_0x1487('0xc')](function(_0x24f671){logger[_0x1487('0xd')](_0x1487('0xe'),_0x31bbb6,_0x1487('0xf'));logger[_0x1487('0x10')](_0x1487('0x11'),_0x31bbb6,_0x1487('0xf'),JSON['stringify'](_0x24f671));if(_0x24f671['error']){if(_0x24f671['error'][_0x1487('0x12')]===0x1f4){logger['error'](_0x1487('0xe'),_0x31bbb6,_0x24f671[_0x1487('0x13')][_0x1487('0x14')]);return _0x52231e(_0x24f671[_0x1487('0x13')][_0x1487('0x14')]);}logger[_0x1487('0x13')](_0x1487('0xe'),_0x31bbb6,_0x24f671[_0x1487('0x13')]['message']);return _0xa18512(_0x24f671[_0x1487('0x13')][_0x1487('0x14')]);}else{logger[_0x1487('0xd')](_0x1487('0xe'),_0x31bbb6,_0x1487('0xf'));_0xa18512(_0x24f671[_0x1487('0x15')]['message']);}})[_0x1487('0x16')](function(_0x4f22e0){logger[_0x1487('0x13')](_0x1487('0xe'),_0x31bbb6,_0x4f22e0);_0x52231e(_0x4f22e0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e2901f9..ca2f192 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 _0x6737=['addConfiguration','put','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','create','/:id/configurations'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x6737,0xe2));var _0x7673=function(_0x3025c8,_0x144967){_0x3025c8=_0x3025c8-0x0;var _0x964dfb=_0x6737[_0x3025c8];return _0x964dfb;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7673('0xa')]('/:id/configurations',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);router['get'](_0x7673('0xc'),auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7673('0xe')]);router['post'](_0x7673('0xf'),auth[_0x7673('0x8')](),controller[_0x7673('0x10')]);router[_0x7673('0x11')](_0x7673('0x12'),auth[_0x7673('0x8')](),controller[_0x7673('0x13')]);router[_0x7673('0x14')](_0x7673('0x12'),auth[_0x7673('0x8')](),controller['destroy']);module[_0x7673('0x15')]=router; \ No newline at end of file +var _0xe630=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xe630,0x149));var _0x0e63=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0xe630[_0x3585fb];return _0x48fb79;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0x8')](_0x0e63('0xd'),auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0x8')](_0x0e63('0xf'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x11')]('/',auth[_0x0e63('0x9')](),controller['create']);router[_0x0e63('0x11')](_0x0e63('0xd'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x12')]);router[_0x0e63('0x13')](_0x0e63('0xb'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x14')]);router[_0x0e63('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0e63('0x16')]);module[_0x0e63('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 a452e2d..c3ed0fe 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 _0x97c1=['STRING','HelpDesk','exports'];(function(_0x310ebe,_0x1dcc59){var _0x3895f9=function(_0xbed188){while(--_0xbed188){_0x310ebe['push'](_0x310ebe['shift']());}};_0x3895f9(++_0x1dcc59);}(_0x97c1,0xd1));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x197c('0x0')]={'name':{'type':Sequelize[_0x197c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x197c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x197c('0x1')],'allowNull':![],'defaultValue':_0x197c('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x197c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xcef6=['STRING','HelpDesk'];(function(_0x56a103,_0x74e793){var _0x5c0d0b=function(_0x56a022){while(--_0x56a022){_0x56a103['push'](_0x56a103['shift']());}};_0x5c0d0b(++_0x74e793);}(_0xcef6,0x1cc));var _0x6cef=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0xcef6[_0x5d04ee];return _0x4a666a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6cef('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6cef('0x0')],'allowNull':![],'defaultValue':_0x6cef('0x1')},'remoteUri':{'type':Sequelize[_0x6cef('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6cef('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6cef('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index be27f69..51d855e 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 _0x7fd3=['GET','success','login','result','describe','autogenerated','reference','remove','false','label','cf_','picklist','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','findAll','rows','show','intersection','includeAll','find','catch','create','body','params','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php'];(function(_0x1b8579,_0x471435){var _0x4650a0=function(_0x5b58cd){while(--_0x5b58cd){_0x1b8579['push'](_0x1b8579['shift']());}};_0x4650a0(++_0x471435);}(_0x7fd3,0x1e2));var _0x37fd=function(_0x42d5b4,_0x278e87){_0x42d5b4=_0x42d5b4-0x0;var _0x5ae2d1=_0x7fd3[_0x42d5b4];return _0x5ae2d1;};'use strict';var emlformat=require(_0x37fd('0x0'));var rimraf=require(_0x37fd('0x1'));var zipdir=require(_0x37fd('0x2'));var jsonpatch=require(_0x37fd('0x3'));var rp=require(_0x37fd('0x4'));var moment=require(_0x37fd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x37fd('0x6'));var path=require(_0x37fd('0x7'));var sox=require(_0x37fd('0x8'));var csv=require(_0x37fd('0x9'));var ejs=require(_0x37fd('0xa'));var fs=require('fs');var fs_extra=require(_0x37fd('0xb'));var _=require(_0x37fd('0xc'));var squel=require(_0x37fd('0xd'));var crypto=require(_0x37fd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x37fd('0xf'));var toCsv=require(_0x37fd('0x9'));var querystring=require('querystring');var Papa=require(_0x37fd('0x10'));var Redis=require('ioredis');var authService=require(_0x37fd('0x11'));var qs=require(_0x37fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37fd('0x13'));var logger=require(_0x37fd('0x14'))('api');var utils=require(_0x37fd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37fd('0x16'));var db=require(_0x37fd('0x17'))['db'];var integrations=require(_0x37fd('0x18'));function respondWithStatusCode(_0x4c732a,_0xb87861){_0xb87861=_0xb87861||0xcc;return function(_0x33225f){if(_0x33225f){return _0x4c732a[_0x37fd('0x19')](_0xb87861);}return _0x4c732a[_0x37fd('0x1a')](_0xb87861)[_0x37fd('0x1b')]();};}function respondWithResult(_0x4cf7a6,_0x3c120b){_0x3c120b=_0x3c120b||0xc8;return function(_0x53ebeb){if(_0x53ebeb){return _0x4cf7a6[_0x37fd('0x1a')](_0x3c120b)[_0x37fd('0x1c')](_0x53ebeb);}};}function respondWithFilteredResult(_0x42a976,_0x294c87){return function(_0x53e1fc){if(_0x53e1fc){var _0x4cea80=typeof _0x294c87[_0x37fd('0x1d')]==='undefined'&&typeof _0x294c87[_0x37fd('0x1e')]===_0x37fd('0x1f');var _0x29a1b8=_0x53e1fc[_0x37fd('0x20')];var _0x281c9b=_0x4cea80?0x0:_0x294c87[_0x37fd('0x1d')];var _0x1e3e86=_0x4cea80?_0x53e1fc[_0x37fd('0x20')]:_0x294c87[_0x37fd('0x1d')]+_0x294c87[_0x37fd('0x1e')];var _0x35b431;if(_0x1e3e86>=_0x29a1b8){_0x1e3e86=_0x29a1b8;_0x35b431=0xc8;}else{_0x35b431=0xce;}_0x42a976[_0x37fd('0x1a')](_0x35b431);return _0x42a976[_0x37fd('0x21')](_0x37fd('0x22'),_0x281c9b+'-'+_0x1e3e86+'/'+_0x29a1b8)['json'](_0x53e1fc);}return null;};}function patchUpdates(_0x4b09aa){return function(_0x344b33){try{jsonpatch['apply'](_0x344b33,_0x4b09aa,!![]);}catch(_0x14d0bd){return BPromise[_0x37fd('0x23')](_0x14d0bd);}return _0x344b33[_0x37fd('0x24')]();};}function saveUpdates(_0x57299a,_0x26786c){return function(_0x14b418){if(_0x14b418){return _0x14b418[_0x37fd('0x25')](_0x57299a)['then'](function(_0x5e0d3e){return _0x5e0d3e;});}return null;};}function removeEntity(_0xdfc163,_0x3ea695){return function(_0x304ec2){if(_0x304ec2){return _0x304ec2[_0x37fd('0x26')]()['then'](function(){_0xdfc163[_0x37fd('0x1a')](0xcc)[_0x37fd('0x1b')]();});}};}function handleEntityNotFound(_0x199e01,_0x1a0ac6){return function(_0x511de7){if(!_0x511de7){_0x199e01[_0x37fd('0x19')](0x194);}return _0x511de7;};}function handleError(_0x234a2d,_0x361257){_0x361257=_0x361257||0x1f4;return function(_0x5e707a){logger[_0x37fd('0x27')](_0x5e707a[_0x37fd('0x28')]);if(_0x5e707a['name']){delete _0x5e707a[_0x37fd('0x29')];}_0x234a2d[_0x37fd('0x1a')](_0x361257)[_0x37fd('0x2a')](_0x5e707a);};}exports[_0x37fd('0x2b')]=function(_0x3df723,_0x100398){var _0x1ea81c={},_0x1f915c={},_0x54aab1={'count':0x0,'rows':[]};var _0x7e5f98=_[_0x37fd('0x2c')](db[_0x37fd('0x2d')][_0x37fd('0x2e')],function(_0x16cae5){return{'name':_0x16cae5[_0x37fd('0x2f')],'type':_0x16cae5[_0x37fd('0x30')][_0x37fd('0x31')]};});_0x1f915c[_0x37fd('0x32')]=_[_0x37fd('0x2c')](_0x7e5f98,_0x37fd('0x29'));_0x1f915c['query']=_[_0x37fd('0x33')](_0x3df723[_0x37fd('0x34')]);_0x1f915c[_0x37fd('0x35')]=_['intersection'](_0x1f915c['model'],_0x1f915c[_0x37fd('0x34')]);_0x1ea81c[_0x37fd('0x36')]=_['intersection'](_0x1f915c['model'],qs[_0x37fd('0x37')](_0x3df723['query'][_0x37fd('0x37')]));_0x1ea81c[_0x37fd('0x36')]=_0x1ea81c[_0x37fd('0x36')][_0x37fd('0x38')]?_0x1ea81c['attributes']:_0x1f915c['model'];if(!_0x3df723[_0x37fd('0x34')][_0x37fd('0x39')]('nolimit')){_0x1ea81c[_0x37fd('0x1e')]=qs[_0x37fd('0x1e')](_0x3df723[_0x37fd('0x34')][_0x37fd('0x1e')]);_0x1ea81c[_0x37fd('0x1d')]=qs[_0x37fd('0x1d')](_0x3df723[_0x37fd('0x34')][_0x37fd('0x1d')]);}_0x1ea81c[_0x37fd('0x3a')]=qs[_0x37fd('0x3b')](_0x3df723[_0x37fd('0x34')][_0x37fd('0x3b')]);_0x1ea81c[_0x37fd('0x3c')]=qs['filters'](_[_0x37fd('0x3d')](_0x3df723[_0x37fd('0x34')],_0x1f915c['filters']),_0x7e5f98);if(_0x3df723[_0x37fd('0x34')]['filter']){_0x1ea81c[_0x37fd('0x3c')]=_[_0x37fd('0x3e')](_0x1ea81c[_0x37fd('0x3c')],{'$or':_['map'](_0x7e5f98,function(_0x37ad7b){if(_0x37ad7b['type']!==_0x37fd('0x3f')){var _0x45daa3={};_0x45daa3[_0x37ad7b[_0x37fd('0x29')]]={'$like':'%'+_0x3df723['query'][_0x37fd('0x40')]+'%'};return _0x45daa3;}})});}_0x1ea81c=_['merge']({},_0x1ea81c,_0x3df723[_0x37fd('0x41')]);var _0x8956cd={'where':_0x1ea81c[_0x37fd('0x3c')]};return db[_0x37fd('0x2d')][_0x37fd('0x20')](_0x8956cd)[_0x37fd('0x42')](function(_0xd7d3c8){_0x54aab1[_0x37fd('0x20')]=_0xd7d3c8;if(_0x3df723[_0x37fd('0x34')]['includeAll']){_0x1ea81c[_0x37fd('0x43')]=[{'all':!![]}];}return db[_0x37fd('0x2d')][_0x37fd('0x44')](_0x1ea81c);})[_0x37fd('0x42')](function(_0x289583){_0x54aab1[_0x37fd('0x45')]=_0x289583;return _0x54aab1;})[_0x37fd('0x42')](respondWithFilteredResult(_0x100398,_0x1ea81c))['catch'](handleError(_0x100398,null));};exports[_0x37fd('0x46')]=function(_0x1ef312,_0x425926){var _0x5d22ac={'raw':![],'where':{'id':_0x1ef312['params']['id']}},_0x5c7db8={};_0x5c7db8[_0x37fd('0x32')]=_[_0x37fd('0x33')](db[_0x37fd('0x2d')][_0x37fd('0x2e')]);_0x5c7db8[_0x37fd('0x34')]=_[_0x37fd('0x33')](_0x1ef312[_0x37fd('0x34')]);_0x5c7db8[_0x37fd('0x35')]=_[_0x37fd('0x47')](_0x5c7db8[_0x37fd('0x32')],_0x5c7db8['query']);_0x5d22ac[_0x37fd('0x36')]=_[_0x37fd('0x47')](_0x5c7db8[_0x37fd('0x32')],qs[_0x37fd('0x37')](_0x1ef312[_0x37fd('0x34')][_0x37fd('0x37')]));_0x5d22ac['attributes']=_0x5d22ac['attributes'][_0x37fd('0x38')]?_0x5d22ac[_0x37fd('0x36')]:_0x5c7db8['model'];if(_0x1ef312[_0x37fd('0x34')][_0x37fd('0x48')]){_0x5d22ac['include']=[{'all':!![]}];}_0x5d22ac=_['merge']({},_0x5d22ac,_0x1ef312[_0x37fd('0x41')]);return db[_0x37fd('0x2d')][_0x37fd('0x49')](_0x5d22ac)['then'](handleEntityNotFound(_0x425926,null))[_0x37fd('0x42')](respondWithResult(_0x425926,null))[_0x37fd('0x4a')](handleError(_0x425926,null));};exports['create']=function(_0x496469,_0x5530d7){return db['VtigerAccount'][_0x37fd('0x4b')](_0x496469['body'],{})[_0x37fd('0x42')](respondWithResult(_0x5530d7,0xc9))[_0x37fd('0x4a')](handleError(_0x5530d7,null));};exports[_0x37fd('0x25')]=function(_0x27bd48,_0x4f68d7){if(_0x27bd48['body']['id']){delete _0x27bd48[_0x37fd('0x4c')]['id'];}return db[_0x37fd('0x2d')][_0x37fd('0x49')]({'where':{'id':_0x27bd48[_0x37fd('0x4d')]['id']}})[_0x37fd('0x42')](handleEntityNotFound(_0x4f68d7,null))['then'](saveUpdates(_0x27bd48['body'],null))[_0x37fd('0x42')](respondWithResult(_0x4f68d7,null))['catch'](handleError(_0x4f68d7,null));};exports[_0x37fd('0x26')]=function(_0x17e46f,_0x1378f3){return db[_0x37fd('0x2d')]['find']({'where':{'id':_0x17e46f['params']['id']}})[_0x37fd('0x42')](handleEntityNotFound(_0x1378f3,null))[_0x37fd('0x42')](removeEntity(_0x1378f3,null))[_0x37fd('0x4a')](handleError(_0x1378f3,null));};exports[_0x37fd('0x4e')]=function(_0x504aa6,_0x1239af,_0x2e3bd2){var _0xf66c46={};var _0x418005={};var _0x223929;var _0x2e9331;return db['VtigerAccount']['findOne']({'where':{'id':_0x504aa6[_0x37fd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1239af,null))[_0x37fd('0x42')](function(_0x49f901){if(_0x49f901){_0x223929=_0x49f901;_0x418005[_0x37fd('0x32')]=_[_0x37fd('0x33')](db[_0x37fd('0x4f')][_0x37fd('0x2e')]);_0x418005['query']=_[_0x37fd('0x33')](_0x504aa6[_0x37fd('0x34')]);_0x418005['filters']=_[_0x37fd('0x47')](_0x418005['model'],_0x418005[_0x37fd('0x34')]);_0xf66c46[_0x37fd('0x36')]=_[_0x37fd('0x47')](_0x418005[_0x37fd('0x32')],qs['fields'](_0x504aa6[_0x37fd('0x34')][_0x37fd('0x37')]));_0xf66c46[_0x37fd('0x36')]=_0xf66c46[_0x37fd('0x36')][_0x37fd('0x38')]?_0xf66c46[_0x37fd('0x36')]:_0x418005[_0x37fd('0x32')];_0xf66c46[_0x37fd('0x3a')]=qs[_0x37fd('0x3b')](_0x504aa6[_0x37fd('0x34')]['sort']);_0xf66c46['where']=qs['filters'](_[_0x37fd('0x3d')](_0x504aa6[_0x37fd('0x34')],_0x418005[_0x37fd('0x35')]));if(_0x504aa6[_0x37fd('0x34')][_0x37fd('0x40')]){_0xf66c46[_0x37fd('0x3c')]=_[_0x37fd('0x3e')](_0xf66c46['where'],{'$or':_[_0x37fd('0x2c')](_0xf66c46[_0x37fd('0x36')],function(_0x52575d){var _0x2a4b51={};_0x2a4b51[_0x52575d]={'$like':'%'+_0x504aa6[_0x37fd('0x34')][_0x37fd('0x40')]+'%'};return _0x2a4b51;})});}_0xf66c46=_[_0x37fd('0x3e')]({},_0xf66c46,_0x504aa6[_0x37fd('0x41')]);return _0x223929[_0x37fd('0x4e')](_0xf66c46);}})[_0x37fd('0x42')](function(_0x4ccba7){if(_0x4ccba7){_0x2e9331=_0x4ccba7[_0x37fd('0x38')];if(!_0x504aa6['query'][_0x37fd('0x39')]('nolimit')){_0xf66c46[_0x37fd('0x1e')]=qs['limit'](_0x504aa6[_0x37fd('0x34')][_0x37fd('0x1e')]);_0xf66c46[_0x37fd('0x1d')]=qs[_0x37fd('0x1d')](_0x504aa6[_0x37fd('0x34')]['offset']);}return _0x223929['getConfigurations'](_0xf66c46);}})[_0x37fd('0x42')](function(_0x4e8eea){if(_0x4e8eea){return _0x4e8eea?{'count':_0x2e9331,'rows':_0x4e8eea}:null;}})[_0x37fd('0x42')](respondWithResult(_0x1239af,null))[_0x37fd('0x4a')](handleError(_0x1239af,null));};exports[_0x37fd('0x50')]=function(_0x4b7255,_0x122a00,_0x3af4c7){if(_0x4b7255[_0x37fd('0x4c')]['id']){delete _0x4b7255['body']['id'];}return db[_0x37fd('0x2d')][_0x37fd('0x51')]({'where':{'id':_0x4b7255[_0x37fd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x122a00,null))[_0x37fd('0x42')](function(_0x3da409){if(_0x3da409){_0x4b7255[_0x37fd('0x4c')][_0x37fd('0x52')]=_0x3da409['id'];_0x4b7255[_0x37fd('0x4c')]['Subjects']=integrations[_0x37fd('0x53')](_0x4b7255[_0x37fd('0x4c')]['channel'],_0x4b7255[_0x37fd('0x4c')][_0x37fd('0x30')]);_0x4b7255['body'][_0x37fd('0x54')]=integrations[_0x37fd('0x55')](_0x4b7255[_0x37fd('0x4c')]['channel'],_0x4b7255['body']['type']);return db[_0x37fd('0x4f')][_0x37fd('0x4b')](_0x4b7255['body'],{'include':[{'model':db[_0x37fd('0x56')],'as':'Subjects'},{'model':db[_0x37fd('0x56')],'as':'Descriptions'}]});}return null;})[_0x37fd('0x42')](respondWithResult(_0x122a00,null))[_0x37fd('0x4a')](handleError(_0x122a00,null));};var md5=require(_0x37fd('0x57'));exports[_0x37fd('0x58')]=function(_0x36c64b,_0x34587a,_0x58fa94){var _0x2914d0=null;var _0x4f2e25=null;var _0x52e639=null;var _0x4f843f=null;var _0x51a86a='';return db[_0x37fd('0x2d')][_0x37fd('0x51')]({'where':{'id':_0x36c64b[_0x37fd('0x4d')]['id']},'attributes':['id',_0x37fd('0x29'),'username',_0x37fd('0x59'),_0x37fd('0x5a'),_0x37fd('0x5b'),_0x37fd('0x5c'),_0x37fd('0x5d')]})[_0x37fd('0x42')](handleEntityNotFound(_0x34587a,null))[_0x37fd('0x42')](function(_0x1287b5){if(_0x1287b5){_0x2914d0=_0x1287b5['username'];_0x4f2e25=_0x1287b5[_0x37fd('0x5d')];_0x52e639=_0x1287b5[_0x37fd('0x5a')];_0x51a86a=_0x1287b5['remoteUri'];var _0x55bed7=_0x51a86a[_0x37fd('0x5e')](-0x1);if(_0x55bed7==='/'){_0x51a86a=_0x51a86a[_0x37fd('0x5f')](0x0,_0x51a86a['lastIndexOf'](_0x55bed7));}_0x4f843f=util[_0x37fd('0x60')](_0x37fd('0x61'),_0x51a86a);var _0x595f25={'method':_0x37fd('0x62'),'uri':_0x4f843f,'qs':{'operation':'getchallenge','username':_0x1287b5['username']},'json':!![]};return rp(_0x595f25);}})[_0x37fd('0x42')](function(_0x5e0068){if(_0x5e0068[_0x37fd('0x63')]){var _0x51f949={'method':'POST','uri':_0x4f843f,'form':{'operation':_0x37fd('0x64'),'username':_0x2914d0,'accessKey':md5(_0x5e0068[_0x37fd('0x65')]['token']+_0x4f2e25)},'json':!![]};return rp(_0x51f949);}})[_0x37fd('0x42')](function(_0x4463de){if(_0x4463de[_0x37fd('0x63')]){var _0x162aab={'method':'GET','uri':_0x4f843f,'qs':{'operation':_0x37fd('0x66'),'username':_0x2914d0,'sessionName':_0x4463de['result']['sessionName'],'elementType':_0x52e639},'json':!![]};return rp(_0x162aab);}})[_0x37fd('0x42')](function(_0x9b563f){if(_0x9b563f[_0x37fd('0x63')]){var _0x1815c2=[_0x37fd('0x67'),_0x37fd('0x68'),'owner'];_['remove'](_0x9b563f[_0x37fd('0x65')]['fields'],function(_0x5c71d3){return _0x1815c2['includes'](_0x5c71d3[_0x37fd('0x30')][_0x37fd('0x29')]);});_[_0x37fd('0x69')](_0x9b563f[_0x37fd('0x65')][_0x37fd('0x37')],function(_0x4bcf1b){return _0x4bcf1b['editable']===_0x37fd('0x6a');});return{'count':_0x9b563f[_0x37fd('0x65')]['fields']['length'],'rows':_[_0x37fd('0x2c')](_0x9b563f[_0x37fd('0x65')]['fields'],function(_0x4c50aa){return{'id':_0x4c50aa['name'],'name':_0x4c50aa[_0x37fd('0x6b')],'custom':_['startsWith'](_0x4c50aa[_0x37fd('0x29')],_0x37fd('0x6c'))?!![]:![],'options':_0x4c50aa[_0x37fd('0x30')][_0x37fd('0x29')]===_0x37fd('0x6d')&&_0x4c50aa['type'][_0x37fd('0x6e')][_0x37fd('0x38')]>0x0?_[_0x37fd('0x2c')](_0x4c50aa[_0x37fd('0x30')][_0x37fd('0x6e')],function(_0x4238db){return{'name':_0x4238db['label'],'value':_0x4238db[_0x37fd('0x6f')]};}):[]};})};}})[_0x37fd('0x42')](respondWithResult(_0x34587a,null))[_0x37fd('0x4a')](function(_0x975b8d){console[_0x37fd('0x70')]('vTiger\x20error:\x20'+_0x975b8d);var _0x36ac5c=_0x36c64b['query']['test']?0x1f4:_0x975b8d[_0x37fd('0x71')]||0x1f4;logger['error'](_0x37fd('0x72'),_0x37fd('0x58'),_0x36ac5c,JSON['stringify'](_0x975b8d));delete _0x975b8d[_0x37fd('0x29')];if(_0x36ac5c===0x191){_0x36ac5c=0x190;}_0x34587a[_0x37fd('0x1a')](_0x36ac5c)[_0x37fd('0x2a')](_0x36c64b[_0x37fd('0x34')][_0x37fd('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x975b8d[_0x37fd('0x71')]}:_0x975b8d);});}; \ No newline at end of file +var _0x8970=['../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','filters','attributes','fields','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','merge','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','result','token','describe','sessionName','owner','includes','remove','editable','false','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8970,0x1ca));var _0x0897=function(_0xc73b09,_0x266bdf){_0xc73b09=_0xc73b09-0x0;var _0x42fcf5=_0x8970[_0xc73b09];return _0x42fcf5;};'use strict';var emlformat=require(_0x0897('0x0'));var rimraf=require(_0x0897('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0897('0x2'));var rp=require('request-promise');var moment=require(_0x0897('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0897('0x4'));var path=require(_0x0897('0x5'));var sox=require(_0x0897('0x6'));var csv=require(_0x0897('0x7'));var ejs=require(_0x0897('0x8'));var fs=require('fs');var fs_extra=require(_0x0897('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0897('0xa'));var jsforce=require(_0x0897('0xb'));var deskjs=require(_0x0897('0xc'));var toCsv=require(_0x0897('0x7'));var querystring=require(_0x0897('0xd'));var Papa=require(_0x0897('0xe'));var Redis=require(_0x0897('0xf'));var authService=require(_0x0897('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0897('0x11'));var hardwareService=require(_0x0897('0x12'));var logger=require(_0x0897('0x13'))(_0x0897('0x14'));var utils=require(_0x0897('0x15'));var config=require(_0x0897('0x16'));var licenseUtil=require(_0x0897('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0897('0x18'));function respondWithStatusCode(_0x444205,_0x3a6945){_0x3a6945=_0x3a6945||0xcc;return function(_0x1b28da){if(_0x1b28da){return _0x444205['sendStatus'](_0x3a6945);}return _0x444205[_0x0897('0x19')](_0x3a6945)[_0x0897('0x1a')]();};}function respondWithResult(_0x167dbe,_0x204cec){_0x204cec=_0x204cec||0xc8;return function(_0x1336b3){if(_0x1336b3){return _0x167dbe[_0x0897('0x19')](_0x204cec)['json'](_0x1336b3);}};}function respondWithFilteredResult(_0xe7658e,_0x2e6be7){return function(_0x5102e3){if(_0x5102e3){var _0x4e19b9=typeof _0x2e6be7[_0x0897('0x1b')]===_0x0897('0x1c')&&typeof _0x2e6be7[_0x0897('0x1d')]===_0x0897('0x1c');var _0x577df0=_0x5102e3[_0x0897('0x1e')];var _0x32e540=_0x4e19b9?0x0:_0x2e6be7[_0x0897('0x1b')];var _0x3b1894=_0x4e19b9?_0x5102e3['count']:_0x2e6be7['offset']+_0x2e6be7[_0x0897('0x1d')];var _0x6ba88f;if(_0x3b1894>=_0x577df0){_0x3b1894=_0x577df0;_0x6ba88f=0xc8;}else{_0x6ba88f=0xce;}_0xe7658e['status'](_0x6ba88f);return _0xe7658e['set']('Content-Range',_0x32e540+'-'+_0x3b1894+'/'+_0x577df0)[_0x0897('0x1f')](_0x5102e3);}return null;};}function patchUpdates(_0x2a6df6){return function(_0x3fd3db){try{jsonpatch[_0x0897('0x20')](_0x3fd3db,_0x2a6df6,!![]);}catch(_0x31c42b){return BPromise[_0x0897('0x21')](_0x31c42b);}return _0x3fd3db[_0x0897('0x22')]();};}function saveUpdates(_0x214cbd,_0x448cc0){return function(_0x226c09){if(_0x226c09){return _0x226c09[_0x0897('0x23')](_0x214cbd)[_0x0897('0x24')](function(_0x446219){return _0x446219;});}return null;};}function removeEntity(_0x46c813,_0x5bd129){return function(_0x900f29){if(_0x900f29){return _0x900f29[_0x0897('0x25')]()[_0x0897('0x24')](function(){_0x46c813[_0x0897('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x232dff,_0x664f46){return function(_0x5170b2){if(!_0x5170b2){_0x232dff['sendStatus'](0x194);}return _0x5170b2;};}function handleError(_0x435acf,_0x11db55){_0x11db55=_0x11db55||0x1f4;return function(_0x4cc494){logger[_0x0897('0x26')](_0x4cc494[_0x0897('0x27')]);if(_0x4cc494[_0x0897('0x28')]){delete _0x4cc494['name'];}_0x435acf[_0x0897('0x19')](_0x11db55)[_0x0897('0x29')](_0x4cc494);};}exports[_0x0897('0x2a')]=function(_0x16558a,_0x5db90c){var _0x27be44={},_0x5c7e59={},_0x1c0264={'count':0x0,'rows':[]};var _0x456703=_[_0x0897('0x2b')](db[_0x0897('0x2c')]['rawAttributes'],function(_0xc37cdf){return{'name':_0xc37cdf[_0x0897('0x2d')],'type':_0xc37cdf[_0x0897('0x2e')][_0x0897('0x2f')]};});_0x5c7e59[_0x0897('0x30')]=_[_0x0897('0x2b')](_0x456703,_0x0897('0x28'));_0x5c7e59['query']=_['keys'](_0x16558a[_0x0897('0x31')]);_0x5c7e59[_0x0897('0x32')]=_['intersection'](_0x5c7e59[_0x0897('0x30')],_0x5c7e59[_0x0897('0x31')]);_0x27be44[_0x0897('0x33')]=_['intersection'](_0x5c7e59['model'],qs[_0x0897('0x34')](_0x16558a['query'][_0x0897('0x34')]));_0x27be44['attributes']=_0x27be44[_0x0897('0x33')]['length']?_0x27be44[_0x0897('0x33')]:_0x5c7e59['model'];if(!_0x16558a['query']['hasOwnProperty']('nolimit')){_0x27be44[_0x0897('0x1d')]=qs[_0x0897('0x1d')](_0x16558a['query']['limit']);_0x27be44[_0x0897('0x1b')]=qs['offset'](_0x16558a[_0x0897('0x31')]['offset']);}_0x27be44[_0x0897('0x35')]=qs[_0x0897('0x36')](_0x16558a[_0x0897('0x31')][_0x0897('0x36')]);_0x27be44['where']=qs[_0x0897('0x32')](_['pick'](_0x16558a[_0x0897('0x31')],_0x5c7e59['filters']),_0x456703);if(_0x16558a['query'][_0x0897('0x37')]){_0x27be44[_0x0897('0x38')]=_['merge'](_0x27be44[_0x0897('0x38')],{'$or':_['map'](_0x456703,function(_0x5ec0e9){if(_0x5ec0e9[_0x0897('0x2e')]!==_0x0897('0x39')){var _0x365c95={};_0x365c95[_0x5ec0e9['name']]={'$like':'%'+_0x16558a[_0x0897('0x31')]['filter']+'%'};return _0x365c95;}})});}_0x27be44=_['merge']({},_0x27be44,_0x16558a[_0x0897('0x3a')]);var _0x540f3c={'where':_0x27be44[_0x0897('0x38')]};return db[_0x0897('0x2c')][_0x0897('0x1e')](_0x540f3c)[_0x0897('0x24')](function(_0x249651){_0x1c0264[_0x0897('0x1e')]=_0x249651;if(_0x16558a['query'][_0x0897('0x3b')]){_0x27be44[_0x0897('0x3c')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0897('0x3d')](_0x27be44);})[_0x0897('0x24')](function(_0x574c99){_0x1c0264[_0x0897('0x3e')]=_0x574c99;return _0x1c0264;})['then'](respondWithFilteredResult(_0x5db90c,_0x27be44))[_0x0897('0x3f')](handleError(_0x5db90c,null));};exports[_0x0897('0x40')]=function(_0x249b4c,_0x350e0f){var _0x2e2ae9={'raw':![],'where':{'id':_0x249b4c[_0x0897('0x41')]['id']}},_0x2328ec={};_0x2328ec[_0x0897('0x30')]=_[_0x0897('0x42')](db[_0x0897('0x2c')]['rawAttributes']);_0x2328ec['query']=_[_0x0897('0x42')](_0x249b4c[_0x0897('0x31')]);_0x2328ec[_0x0897('0x32')]=_[_0x0897('0x43')](_0x2328ec[_0x0897('0x30')],_0x2328ec[_0x0897('0x31')]);_0x2e2ae9['attributes']=_[_0x0897('0x43')](_0x2328ec[_0x0897('0x30')],qs[_0x0897('0x34')](_0x249b4c[_0x0897('0x31')]['fields']));_0x2e2ae9[_0x0897('0x33')]=_0x2e2ae9[_0x0897('0x33')][_0x0897('0x44')]?_0x2e2ae9[_0x0897('0x33')]:_0x2328ec['model'];if(_0x249b4c[_0x0897('0x31')]['includeAll']){_0x2e2ae9[_0x0897('0x3c')]=[{'all':!![]}];}_0x2e2ae9=_[_0x0897('0x45')]({},_0x2e2ae9,_0x249b4c[_0x0897('0x3a')]);return db['VtigerAccount'][_0x0897('0x46')](_0x2e2ae9)['then'](handleEntityNotFound(_0x350e0f,null))[_0x0897('0x24')](respondWithResult(_0x350e0f,null))[_0x0897('0x3f')](handleError(_0x350e0f,null));};exports[_0x0897('0x47')]=function(_0x6c57c1,_0x50e66c){return db[_0x0897('0x2c')][_0x0897('0x47')](_0x6c57c1[_0x0897('0x48')],{})[_0x0897('0x24')](respondWithResult(_0x50e66c,0xc9))[_0x0897('0x3f')](handleError(_0x50e66c,null));};exports[_0x0897('0x23')]=function(_0x332036,_0x4e45a2){if(_0x332036['body']['id']){delete _0x332036[_0x0897('0x48')]['id'];}return db[_0x0897('0x2c')][_0x0897('0x46')]({'where':{'id':_0x332036['params']['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x4e45a2,null))[_0x0897('0x24')](saveUpdates(_0x332036[_0x0897('0x48')],null))['then'](respondWithResult(_0x4e45a2,null))[_0x0897('0x3f')](handleError(_0x4e45a2,null));};exports['destroy']=function(_0x594147,_0x17551e){return db[_0x0897('0x2c')][_0x0897('0x46')]({'where':{'id':_0x594147[_0x0897('0x41')]['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x17551e,null))[_0x0897('0x24')](removeEntity(_0x17551e,null))[_0x0897('0x3f')](handleError(_0x17551e,null));};exports['getConfigurations']=function(_0x31e41e,_0x5047a8,_0x1901d9){var _0x17a5bd={};var _0x405c59={};var _0x4c74c9;var _0x2919f0;return db['VtigerAccount'][_0x0897('0x49')]({'where':{'id':_0x31e41e['params']['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x5047a8,null))[_0x0897('0x24')](function(_0x36ed28){if(_0x36ed28){_0x4c74c9=_0x36ed28;_0x405c59[_0x0897('0x30')]=_[_0x0897('0x42')](db['VtigerConfiguration']['rawAttributes']);_0x405c59['query']=_[_0x0897('0x42')](_0x31e41e[_0x0897('0x31')]);_0x405c59['filters']=_[_0x0897('0x43')](_0x405c59[_0x0897('0x30')],_0x405c59['query']);_0x17a5bd[_0x0897('0x33')]=_[_0x0897('0x43')](_0x405c59[_0x0897('0x30')],qs[_0x0897('0x34')](_0x31e41e[_0x0897('0x31')][_0x0897('0x34')]));_0x17a5bd[_0x0897('0x33')]=_0x17a5bd['attributes'][_0x0897('0x44')]?_0x17a5bd[_0x0897('0x33')]:_0x405c59[_0x0897('0x30')];_0x17a5bd[_0x0897('0x35')]=qs['sort'](_0x31e41e['query'][_0x0897('0x36')]);_0x17a5bd[_0x0897('0x38')]=qs[_0x0897('0x32')](_[_0x0897('0x4a')](_0x31e41e[_0x0897('0x31')],_0x405c59[_0x0897('0x32')]));if(_0x31e41e[_0x0897('0x31')]['filter']){_0x17a5bd[_0x0897('0x38')]=_[_0x0897('0x45')](_0x17a5bd[_0x0897('0x38')],{'$or':_[_0x0897('0x2b')](_0x17a5bd[_0x0897('0x33')],function(_0x5501ce){var _0x38a011={};_0x38a011[_0x5501ce]={'$like':'%'+_0x31e41e[_0x0897('0x31')][_0x0897('0x37')]+'%'};return _0x38a011;})});}_0x17a5bd=_['merge']({},_0x17a5bd,_0x31e41e[_0x0897('0x3a')]);return _0x4c74c9[_0x0897('0x4b')](_0x17a5bd);}})[_0x0897('0x24')](function(_0x3cf416){if(_0x3cf416){_0x2919f0=_0x3cf416[_0x0897('0x44')];if(!_0x31e41e[_0x0897('0x31')]['hasOwnProperty']('nolimit')){_0x17a5bd[_0x0897('0x1d')]=qs[_0x0897('0x1d')](_0x31e41e[_0x0897('0x31')][_0x0897('0x1d')]);_0x17a5bd['offset']=qs['offset'](_0x31e41e[_0x0897('0x31')]['offset']);}return _0x4c74c9[_0x0897('0x4b')](_0x17a5bd);}})[_0x0897('0x24')](function(_0xdf78e){if(_0xdf78e){return _0xdf78e?{'count':_0x2919f0,'rows':_0xdf78e}:null;}})[_0x0897('0x24')](respondWithResult(_0x5047a8,null))[_0x0897('0x3f')](handleError(_0x5047a8,null));};exports[_0x0897('0x4c')]=function(_0x517237,_0x39807d,_0x32c5af){if(_0x517237[_0x0897('0x48')]['id']){delete _0x517237[_0x0897('0x48')]['id'];}return db[_0x0897('0x2c')][_0x0897('0x49')]({'where':{'id':_0x517237[_0x0897('0x41')]['id']}})[_0x0897('0x24')](handleEntityNotFound(_0x39807d,null))[_0x0897('0x24')](function(_0x3cd15d){if(_0x3cd15d){_0x517237['body'][_0x0897('0x4d')]=_0x3cd15d['id'];_0x517237['body'][_0x0897('0x4e')]=integrations[_0x0897('0x4f')](_0x517237['body'][_0x0897('0x50')],_0x517237[_0x0897('0x48')][_0x0897('0x2e')]);_0x517237[_0x0897('0x48')][_0x0897('0x51')]=integrations[_0x0897('0x52')](_0x517237[_0x0897('0x48')][_0x0897('0x50')],_0x517237[_0x0897('0x48')][_0x0897('0x2e')]);return db[_0x0897('0x53')][_0x0897('0x47')](_0x517237['body'],{'include':[{'model':db[_0x0897('0x54')],'as':_0x0897('0x4e')},{'model':db[_0x0897('0x54')],'as':_0x0897('0x51')}]});}return null;})[_0x0897('0x24')](respondWithResult(_0x39807d,null))[_0x0897('0x3f')](handleError(_0x39807d,null));};var md5=require(_0x0897('0x55'));exports[_0x0897('0x56')]=function(_0x585df8,_0x2e6616,_0x2339e6){var _0xe4c0c=null;var _0x431051=null;var _0x107590=null;var _0x42197b=null;var _0x43a276='';return db[_0x0897('0x2c')][_0x0897('0x49')]({'where':{'id':_0x585df8[_0x0897('0x41')]['id']},'attributes':['id',_0x0897('0x28'),_0x0897('0x57'),_0x0897('0x58'),_0x0897('0x59'),_0x0897('0x5a'),_0x0897('0x5b'),'accessKey']})[_0x0897('0x24')](handleEntityNotFound(_0x2e6616,null))['then'](function(_0x6b8e9b){if(_0x6b8e9b){_0xe4c0c=_0x6b8e9b[_0x0897('0x57')];_0x431051=_0x6b8e9b[_0x0897('0x5c')];_0x107590=_0x6b8e9b['moduleName'];_0x43a276=_0x6b8e9b[_0x0897('0x5a')];var _0x3d83d8=_0x43a276[_0x0897('0x5d')](-0x1);if(_0x3d83d8==='/'){_0x43a276=_0x43a276[_0x0897('0x5e')](0x0,_0x43a276[_0x0897('0x5f')](_0x3d83d8));}_0x42197b=util[_0x0897('0x60')]('%s/webservice.php',_0x43a276);var _0x49bdc8={'method':_0x0897('0x61'),'uri':_0x42197b,'qs':{'operation':_0x0897('0x62'),'username':_0x6b8e9b['username']},'json':!![]};return rp(_0x49bdc8);}})[_0x0897('0x24')](function(_0x5ed63a){if(_0x5ed63a[_0x0897('0x63')]){var _0x5ddec4={'method':_0x0897('0x64'),'uri':_0x42197b,'form':{'operation':'login','username':_0xe4c0c,'accessKey':md5(_0x5ed63a[_0x0897('0x65')][_0x0897('0x66')]+_0x431051)},'json':!![]};return rp(_0x5ddec4);}})['then'](function(_0x190589){if(_0x190589['success']){var _0x5a529a={'method':'GET','uri':_0x42197b,'qs':{'operation':_0x0897('0x67'),'username':_0xe4c0c,'sessionName':_0x190589[_0x0897('0x65')][_0x0897('0x68')],'elementType':_0x107590},'json':!![]};return rp(_0x5a529a);}})[_0x0897('0x24')](function(_0x3edb14){if(_0x3edb14[_0x0897('0x63')]){var _0x57a79e=['autogenerated','reference',_0x0897('0x69')];_['remove'](_0x3edb14['result']['fields'],function(_0xa8a7e8){return _0x57a79e[_0x0897('0x6a')](_0xa8a7e8[_0x0897('0x2e')][_0x0897('0x28')]);});_[_0x0897('0x6b')](_0x3edb14[_0x0897('0x65')]['fields'],function(_0x54debd){return _0x54debd[_0x0897('0x6c')]===_0x0897('0x6d');});return{'count':_0x3edb14[_0x0897('0x65')][_0x0897('0x34')][_0x0897('0x44')],'rows':_[_0x0897('0x2b')](_0x3edb14[_0x0897('0x65')][_0x0897('0x34')],function(_0x11c74b){return{'id':_0x11c74b[_0x0897('0x28')],'name':_0x11c74b['label'],'custom':_['startsWith'](_0x11c74b[_0x0897('0x28')],_0x0897('0x6e'))?!![]:![],'options':_0x11c74b[_0x0897('0x2e')][_0x0897('0x28')]===_0x0897('0x6f')&&_0x11c74b[_0x0897('0x2e')][_0x0897('0x70')]['length']>0x0?_['map'](_0x11c74b[_0x0897('0x2e')][_0x0897('0x70')],function(_0x4d114c){return{'name':_0x4d114c['label'],'value':_0x4d114c[_0x0897('0x71')]};}):[]};})};}})[_0x0897('0x24')](respondWithResult(_0x2e6616,null))[_0x0897('0x3f')](function(_0x293781){console[_0x0897('0x72')]('vTiger\x20error:\x20'+_0x293781);var _0x152a98=_0x585df8[_0x0897('0x31')][_0x0897('0x73')]?0x1f4:_0x293781[_0x0897('0x74')]||0x1f4;logger[_0x0897('0x26')](_0x0897('0x75'),_0x0897('0x56'),_0x152a98,JSON[_0x0897('0x76')](_0x293781));delete _0x293781['name'];if(_0x152a98===0x191){_0x152a98=0x190;}_0x2e6616[_0x0897('0x19')](_0x152a98)['send'](_0x585df8[_0x0897('0x31')][_0x0897('0x73')]?{'message':_0x0897('0x77'),'statusCode':_0x293781[_0x0897('0x74')]}:_0x293781);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index effaead..6a149b4 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 _0x43ed=['VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define'];(function(_0x2de851,_0xebd764){var _0x20f97e=function(_0x39c90d){while(--_0x39c90d){_0x2de851['push'](_0x2de851['shift']());}};_0x20f97e(++_0xebd764);}(_0x43ed,0x92));var _0xd43e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x43ed[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xd43e('0x0'));var util=require('util');var logger=require(_0xd43e('0x1'))('api');var moment=require(_0xd43e('0x2'));var BPromise=require('bluebird');var rp=require(_0xd43e('0x3'));var fs=require('fs');var path=require(_0xd43e('0x4'));var rimraf=require(_0xd43e('0x5'));var config=require(_0xd43e('0x6'));var attributes=require(_0xd43e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd43e('0x8')]=function(_0x13863d,_0x443d63){return _0x13863d[_0xd43e('0x9')](_0xd43e('0xa'),attributes,{'tableName':_0xd43e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d32=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x5c98cc,_0x58190a){var _0x164644=function(_0x540bae){while(--_0x540bae){_0x5c98cc['push'](_0x5c98cc['shift']());}};_0x164644(++_0x58190a);}(_0x4d32,0x1b9));var _0x24d3=function(_0xb0ed0c,_0x1a1fb1){_0xb0ed0c=_0xb0ed0c-0x0;var _0x5d5356=_0x4d32[_0xb0ed0c];return _0x5d5356;};'use strict';var _=require(_0x24d3('0x0'));var util=require('util');var logger=require(_0x24d3('0x1'))('api');var moment=require(_0x24d3('0x2'));var BPromise=require(_0x24d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24d3('0x4'));var rimraf=require(_0x24d3('0x5'));var config=require(_0x24d3('0x6'));var attributes=require(_0x24d3('0x7'));var integrations=require(_0x24d3('0x8'));module[_0x24d3('0x9')]=function(_0x142de2,_0x26afd8){return _0x142de2[_0x24d3('0xa')](_0x24d3('0xb'),attributes,{'tableName':_0x24d3('0xc'),'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 91b386f..cb89a8e 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 _0xe605=['include','map','model','ShowVtigerAccount','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe605,0x92));var _0x5e60=function(_0x3ad913,_0x31042f){_0x3ad913=_0x3ad913-0x0;var _0x2497a8=_0xe605[_0x3ad913];return _0x2497a8;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')]({'raw':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'limit':_0x5c485d['options']?_0x5c485d[_0x5e60('0x19')]['limit']||null:null,'include':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')],function(_0x2636f1){return{'model':db[_0x2636f1['model']],'as':_0x2636f1['as'],'attributes':_0x2636f1[_0x5e60('0x1c')],'include':_0x2636f1[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2636f1['include'],function(_0x45cb62){return{'model':db[_0x45cb62[_0x5e60('0x1f')]],'as':_0x45cb62['as'],'attributes':_0x45cb62[_0x5e60('0x1c')],'include':_0x45cb62[_0x5e60('0x1d')]?_['map'](_0x45cb62[_0x5e60('0x1d')],function(_0x5712f7){return{'model':db[_0x5712f7[_0x5e60('0x1f')]],'as':_0x5712f7['as'],'attributes':_0x5712f7[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46691f){logger[_0x5e60('0xe')]('GetVtigerAccount',_0x5c485d);logger[_0x5e60('0x11')](_0x5e60('0x16'),_0x5c485d,JSON['stringify'](_0x46691f));_0x22d718(_0x46691f);})['catch'](function(_0x52f668){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x52f668[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x52f668[_0x5e60('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x168ce6){var _0x405461=this;return new Promise(function(_0x4d4b55,_0x11fc87){return db['VtigerAccount']['find']({'raw':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'include':_0x168ce6[_0x5e60('0x19')]?_0x168ce6['options'][_0x5e60('0x1d')]?_['map'](_0x168ce6['options'][_0x5e60('0x1d')],function(_0x317206){return{'model':db[_0x317206['model']],'as':_0x317206['as'],'attributes':_0x317206[_0x5e60('0x1c')],'include':_0x317206['include']?_[_0x5e60('0x1e')](_0x317206[_0x5e60('0x1d')],function(_0x2b2426){return{'model':db[_0x2b2426[_0x5e60('0x1f')]],'as':_0x2b2426['as'],'attributes':_0x2b2426[_0x5e60('0x1c')],'include':_0x2b2426[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2b2426[_0x5e60('0x1d')],function(_0x5b3aa5){return{'model':db[_0x5b3aa5[_0x5e60('0x1f')]],'as':_0x5b3aa5['as'],'attributes':_0x5b3aa5[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0xd')](function(_0x1a3782){logger[_0x5e60('0xe')](_0x5e60('0x20'),_0x168ce6);logger[_0x5e60('0x11')]('ShowVtigerAccount',_0x168ce6,JSON[_0x5e60('0x21')](_0x1a3782));_0x4d4b55(_0x1a3782);})[_0x5e60('0x22')](function(_0x4cba18){logger['error'](_0x5e60('0x20'),_0x4cba18[_0x5e60('0x14')],_0x168ce6);_0x11fc87(_0x405461[_0x5e60('0x12')](0x1f4,_0x4cba18[_0x5e60('0x14')]));});});}; \ No newline at end of file +var _0xe605=['include','map','model','ShowVtigerAccount','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe605,0x92));var _0x5e60=function(_0x4d8dc7,_0x18c3a4){_0x4d8dc7=_0x4d8dc7-0x0;var _0x537a9b=_0xe605[_0x4d8dc7];return _0x537a9b;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')]({'raw':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'limit':_0x5c485d['options']?_0x5c485d[_0x5e60('0x19')]['limit']||null:null,'include':_0x5c485d[_0x5e60('0x19')]?_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x5c485d[_0x5e60('0x19')][_0x5e60('0x1d')],function(_0x2636f1){return{'model':db[_0x2636f1['model']],'as':_0x2636f1['as'],'attributes':_0x2636f1[_0x5e60('0x1c')],'include':_0x2636f1[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2636f1['include'],function(_0x45cb62){return{'model':db[_0x45cb62[_0x5e60('0x1f')]],'as':_0x45cb62['as'],'attributes':_0x45cb62[_0x5e60('0x1c')],'include':_0x45cb62[_0x5e60('0x1d')]?_['map'](_0x45cb62[_0x5e60('0x1d')],function(_0x5712f7){return{'model':db[_0x5712f7[_0x5e60('0x1f')]],'as':_0x5712f7['as'],'attributes':_0x5712f7[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46691f){logger[_0x5e60('0xe')]('GetVtigerAccount',_0x5c485d);logger[_0x5e60('0x11')](_0x5e60('0x16'),_0x5c485d,JSON['stringify'](_0x46691f));_0x22d718(_0x46691f);})['catch'](function(_0x52f668){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x52f668[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x52f668[_0x5e60('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x168ce6){var _0x405461=this;return new Promise(function(_0x4d4b55,_0x11fc87){return db['VtigerAccount']['find']({'raw':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1a')]===undefined?!![]:![]:!![],'where':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1b')]||null:null,'attributes':_0x168ce6[_0x5e60('0x19')]?_0x168ce6[_0x5e60('0x19')][_0x5e60('0x1c')]||null:null,'include':_0x168ce6[_0x5e60('0x19')]?_0x168ce6['options'][_0x5e60('0x1d')]?_['map'](_0x168ce6['options'][_0x5e60('0x1d')],function(_0x317206){return{'model':db[_0x317206['model']],'as':_0x317206['as'],'attributes':_0x317206[_0x5e60('0x1c')],'include':_0x317206['include']?_[_0x5e60('0x1e')](_0x317206[_0x5e60('0x1d')],function(_0x2b2426){return{'model':db[_0x2b2426[_0x5e60('0x1f')]],'as':_0x2b2426['as'],'attributes':_0x2b2426[_0x5e60('0x1c')],'include':_0x2b2426[_0x5e60('0x1d')]?_[_0x5e60('0x1e')](_0x2b2426[_0x5e60('0x1d')],function(_0x5b3aa5){return{'model':db[_0x5b3aa5[_0x5e60('0x1f')]],'as':_0x5b3aa5['as'],'attributes':_0x5b3aa5[_0x5e60('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e60('0xd')](function(_0x1a3782){logger[_0x5e60('0xe')](_0x5e60('0x20'),_0x168ce6);logger[_0x5e60('0x11')]('ShowVtigerAccount',_0x168ce6,JSON[_0x5e60('0x21')](_0x1a3782));_0x4d4b55(_0x1a3782);})[_0x5e60('0x22')](function(_0x4cba18){logger['error'](_0x5e60('0x20'),_0x4cba18[_0x5e60('0x14')],_0x168ce6);_0x11fc87(_0x405461[_0x5e60('0x12')](0x1f4,_0x4cba18[_0x5e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 130943e..2e152d4 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 _0x7d0a=['isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x165e83,_0x4469de){var _0x5dd88a=function(_0x5cfae9){while(--_0x5cfae9){_0x165e83['push'](_0x165e83['shift']());}};_0x5dd88a(++_0x4469de);}(_0x7d0a,0x19b));var _0xa7d0=function(_0xf925f2,_0x1fb6a0){_0xf925f2=_0xf925f2-0x0;var _0x181a50=_0x7d0a[_0xf925f2];return _0x181a50;};'use strict';var multer=require(_0xa7d0('0x0'));var util=require(_0xa7d0('0x1'));var path=require('path');var timeout=require(_0xa7d0('0x2'));var express=require(_0xa7d0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7d0('0x4'));var interaction=require(_0xa7d0('0x5'));var config=require(_0xa7d0('0x6'));var controller=require(_0xa7d0('0x7'));router[_0xa7d0('0x8')]('/',auth[_0xa7d0('0x9')](),controller[_0xa7d0('0xa')]);router[_0xa7d0('0x8')](_0xa7d0('0xb'),auth[_0xa7d0('0x9')](),controller['show']);router[_0xa7d0('0x8')](_0xa7d0('0xc'),auth[_0xa7d0('0x9')](),controller[_0xa7d0('0xd')]);router[_0xa7d0('0x8')]('/:id/subjects',auth[_0xa7d0('0x9')](),controller[_0xa7d0('0xe')]);router[_0xa7d0('0x8')]('/:id/descriptions',auth[_0xa7d0('0x9')](),controller[_0xa7d0('0xf')]);router[_0xa7d0('0x10')]('/',auth[_0xa7d0('0x9')](),controller[_0xa7d0('0x11')]);router[_0xa7d0('0x12')](_0xa7d0('0xb'),auth[_0xa7d0('0x9')](),controller['update']);router[_0xa7d0('0x13')](_0xa7d0('0xb'),auth[_0xa7d0('0x9')](),controller['destroy']);module[_0xa7d0('0x14')]=router; \ No newline at end of file +var _0x6096=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x40df2a,_0x3db29f){var _0x5d3334=function(_0x1c370b){while(--_0x1c370b){_0x40df2a['push'](_0x40df2a['shift']());}};_0x5d3334(++_0x3db29f);}(_0x6096,0xbb));var _0x6609=function(_0x4713b9,_0x4d89ca){_0x4713b9=_0x4713b9-0x0;var _0x200680=_0x6096[_0x4713b9];return _0x200680;};'use strict';var multer=require(_0x6609('0x0'));var util=require('util');var path=require(_0x6609('0x1'));var timeout=require('connect-timeout');var express=require(_0x6609('0x2'));var router=express[_0x6609('0x3')]();var fs_extra=require(_0x6609('0x4'));var auth=require(_0x6609('0x5'));var interaction=require(_0x6609('0x6'));var config=require('../../config/environment');var controller=require(_0x6609('0x7'));router[_0x6609('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6609('0x8')](_0x6609('0x9'),auth[_0x6609('0xa')](),controller['show']);router[_0x6609('0x8')](_0x6609('0xb'),auth[_0x6609('0xa')](),controller['getFields']);router[_0x6609('0x8')](_0x6609('0xc'),auth[_0x6609('0xa')](),controller[_0x6609('0xd')]);router['get'](_0x6609('0xe'),auth['isAuthenticated'](),controller[_0x6609('0xf')]);router[_0x6609('0x10')]('/',auth[_0x6609('0xa')](),controller[_0x6609('0x11')]);router['put'](_0x6609('0x9'),auth[_0x6609('0xa')](),controller[_0x6609('0x12')]);router[_0x6609('0x13')]('/:id',auth[_0x6609('0xa')](),controller[_0x6609('0x14')]);module[_0x6609('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index bbeaaf7..8eec380 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 _0x2c63=['sequelize','exports','STRING'];(function(_0x49b786,_0x423a99){var _0x1f0fb4=function(_0x25f91a){while(--_0x25f91a){_0x49b786['push'](_0x49b786['shift']());}};_0x1f0fb4(++_0x423a99);}(_0x2c63,0x7b));var _0x32c6=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x2c63[_0x245afe];return _0x4eefde;};'use strict';var Sequelize=require(_0x32c6('0x0'));module[_0x32c6('0x1')]={'name':{'type':Sequelize[_0x32c6('0x2')]},'description':{'type':Sequelize[_0x32c6('0x2')]}}; \ No newline at end of file +var _0x63df=['STRING','sequelize','exports'];(function(_0x1c1a68,_0x3ff826){var _0x319750=function(_0x415c36){while(--_0x415c36){_0x1c1a68['push'](_0x1c1a68['shift']());}};_0x319750(++_0x3ff826);}(_0x63df,0x1ed));var _0xf63d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x63df[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0xf63d('0x0'));module[_0xf63d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf63d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d8e791b..6b331f3 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 _0xfb99=['catch','show','params','options','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','include','findAll','rows'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xfb99,0x1e1));var _0x9fb9=function(_0x13a73a,_0x46cf87){_0x13a73a=_0x13a73a-0x0;var _0x32949b=_0xfb99[_0x13a73a];return _0x32949b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9fb9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fb9('0x1'));var moment=require(_0x9fb9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9fb9('0x3'));var util=require(_0x9fb9('0x4'));var path=require(_0x9fb9('0x5'));var sox=require('sox');var csv=require(_0x9fb9('0x6'));var ejs=require(_0x9fb9('0x7'));var fs=require('fs');var fs_extra=require(_0x9fb9('0x8'));var _=require(_0x9fb9('0x9'));var squel=require(_0x9fb9('0xa'));var crypto=require(_0x9fb9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fb9('0xc'));var toCsv=require(_0x9fb9('0x6'));var querystring=require('querystring');var Papa=require(_0x9fb9('0xd'));var Redis=require(_0x9fb9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9fb9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9fb9('0x10'));var utils=require(_0x9fb9('0x11'));var config=require(_0x9fb9('0x12'));var licenseUtil=require(_0x9fb9('0x13'));var db=require(_0x9fb9('0x14'))['db'];function respondWithStatusCode(_0x5b44,_0x457764){_0x457764=_0x457764||0xcc;return function(_0x41a935){if(_0x41a935){return _0x5b44[_0x9fb9('0x15')](_0x457764);}return _0x5b44['status'](_0x457764)[_0x9fb9('0x16')]();};}function respondWithResult(_0x23e803,_0x648bd9){_0x648bd9=_0x648bd9||0xc8;return function(_0x31c5de){if(_0x31c5de){return _0x23e803[_0x9fb9('0x17')](_0x648bd9)[_0x9fb9('0x18')](_0x31c5de);}};}function respondWithFilteredResult(_0x4d870b,_0x102d86){return function(_0x1f6673){if(_0x1f6673){var _0x1e6ec1=typeof _0x102d86['offset']==='undefined'&&typeof _0x102d86[_0x9fb9('0x19')]==='undefined';var _0x672e50=_0x1f6673['count'];var _0x114049=_0x1e6ec1?0x0:_0x102d86[_0x9fb9('0x1a')];var _0x5019c8=_0x1e6ec1?_0x1f6673['count']:_0x102d86[_0x9fb9('0x1a')]+_0x102d86[_0x9fb9('0x19')];var _0x4d9956;if(_0x5019c8>=_0x672e50){_0x5019c8=_0x672e50;_0x4d9956=0xc8;}else{_0x4d9956=0xce;}_0x4d870b[_0x9fb9('0x17')](_0x4d9956);return _0x4d870b[_0x9fb9('0x1b')](_0x9fb9('0x1c'),_0x114049+'-'+_0x5019c8+'/'+_0x672e50)['json'](_0x1f6673);}return null;};}function patchUpdates(_0x44d67f){return function(_0x5aad85){try{jsonpatch[_0x9fb9('0x1d')](_0x5aad85,_0x44d67f,!![]);}catch(_0x572414){return BPromise[_0x9fb9('0x1e')](_0x572414);}return _0x5aad85[_0x9fb9('0x1f')]();};}function saveUpdates(_0x44d4ab,_0x2ec7b0){return function(_0x1a03f){if(_0x1a03f){return _0x1a03f[_0x9fb9('0x20')](_0x44d4ab)['then'](function(_0x22407b){return _0x22407b;});}return null;};}function removeEntity(_0x1ab6d9,_0x2c187e){return function(_0x3acc19){if(_0x3acc19){return _0x3acc19[_0x9fb9('0x21')]()[_0x9fb9('0x22')](function(){_0x1ab6d9[_0x9fb9('0x17')](0xcc)[_0x9fb9('0x16')]();});}};}function handleEntityNotFound(_0x1b2f62,_0x463e36){return function(_0x56c27e){if(!_0x56c27e){_0x1b2f62[_0x9fb9('0x15')](0x194);}return _0x56c27e;};}function handleError(_0x1ac65b,_0x4cf388){_0x4cf388=_0x4cf388||0x1f4;return function(_0xe50773){logger['error'](_0xe50773[_0x9fb9('0x23')]);if(_0xe50773[_0x9fb9('0x24')]){delete _0xe50773['name'];}_0x1ac65b[_0x9fb9('0x17')](_0x4cf388)[_0x9fb9('0x25')](_0xe50773);};}exports[_0x9fb9('0x26')]=function(_0x4e71ae,_0x3dc626){var _0x50f7ed={},_0x1be73e={},_0x35ab46={'count':0x0,'rows':[]};var _0x4c4d87=_[_0x9fb9('0x27')](db[_0x9fb9('0x28')][_0x9fb9('0x29')],function(_0x4ffaaa){return{'name':_0x4ffaaa[_0x9fb9('0x2a')],'type':_0x4ffaaa[_0x9fb9('0x2b')][_0x9fb9('0x2c')]};});_0x1be73e[_0x9fb9('0x2d')]=_[_0x9fb9('0x27')](_0x4c4d87,_0x9fb9('0x24'));_0x1be73e[_0x9fb9('0x2e')]=_[_0x9fb9('0x2f')](_0x4e71ae[_0x9fb9('0x2e')]);_0x1be73e[_0x9fb9('0x30')]=_['intersection'](_0x1be73e['model'],_0x1be73e[_0x9fb9('0x2e')]);_0x50f7ed['attributes']=_[_0x9fb9('0x31')](_0x1be73e[_0x9fb9('0x2d')],qs[_0x9fb9('0x32')](_0x4e71ae[_0x9fb9('0x2e')]['fields']));_0x50f7ed[_0x9fb9('0x33')]=_0x50f7ed[_0x9fb9('0x33')][_0x9fb9('0x34')]?_0x50f7ed[_0x9fb9('0x33')]:_0x1be73e['model'];if(!_0x4e71ae[_0x9fb9('0x2e')][_0x9fb9('0x35')](_0x9fb9('0x36'))){_0x50f7ed[_0x9fb9('0x19')]=qs[_0x9fb9('0x19')](_0x4e71ae[_0x9fb9('0x2e')]['limit']);_0x50f7ed[_0x9fb9('0x1a')]=qs[_0x9fb9('0x1a')](_0x4e71ae[_0x9fb9('0x2e')][_0x9fb9('0x1a')]);}_0x50f7ed[_0x9fb9('0x37')]=qs[_0x9fb9('0x38')](_0x4e71ae[_0x9fb9('0x2e')][_0x9fb9('0x38')]);_0x50f7ed[_0x9fb9('0x39')]=qs['filters'](_['pick'](_0x4e71ae['query'],_0x1be73e['filters']),_0x4c4d87);if(_0x4e71ae[_0x9fb9('0x2e')][_0x9fb9('0x3a')]){_0x50f7ed[_0x9fb9('0x39')]=_[_0x9fb9('0x3b')](_0x50f7ed['where'],{'$or':_[_0x9fb9('0x27')](_0x4c4d87,function(_0x5bbb72){if(_0x5bbb72[_0x9fb9('0x2b')]!=='VIRTUAL'){var _0x1a19d1={};_0x1a19d1[_0x5bbb72['name']]={'$like':'%'+_0x4e71ae['query'][_0x9fb9('0x3a')]+'%'};return _0x1a19d1;}})});}_0x50f7ed=_[_0x9fb9('0x3b')]({},_0x50f7ed,_0x4e71ae['options']);var _0x31f2cb={'where':_0x50f7ed[_0x9fb9('0x39')]};return db[_0x9fb9('0x28')][_0x9fb9('0x3c')](_0x31f2cb)[_0x9fb9('0x22')](function(_0x2182b6){_0x35ab46[_0x9fb9('0x3c')]=_0x2182b6;if(_0x4e71ae[_0x9fb9('0x2e')][_0x9fb9('0x3d')]){_0x50f7ed[_0x9fb9('0x3e')]=[{'all':!![]}];}return db[_0x9fb9('0x28')][_0x9fb9('0x3f')](_0x50f7ed);})[_0x9fb9('0x22')](function(_0x224476){_0x35ab46[_0x9fb9('0x40')]=_0x224476;return _0x35ab46;})[_0x9fb9('0x22')](respondWithFilteredResult(_0x3dc626,_0x50f7ed))[_0x9fb9('0x41')](handleError(_0x3dc626,null));};exports[_0x9fb9('0x42')]=function(_0x459d46,_0x3231ee){var _0x5800b7={'raw':![],'where':{'id':_0x459d46[_0x9fb9('0x43')]['id']}},_0x4653b2={};_0x4653b2['model']=_[_0x9fb9('0x2f')](db['VtigerConfiguration'][_0x9fb9('0x29')]);_0x4653b2[_0x9fb9('0x2e')]=_[_0x9fb9('0x2f')](_0x459d46[_0x9fb9('0x2e')]);_0x4653b2['filters']=_['intersection'](_0x4653b2[_0x9fb9('0x2d')],_0x4653b2['query']);_0x5800b7[_0x9fb9('0x33')]=_[_0x9fb9('0x31')](_0x4653b2[_0x9fb9('0x2d')],qs[_0x9fb9('0x32')](_0x459d46[_0x9fb9('0x2e')][_0x9fb9('0x32')]));_0x5800b7[_0x9fb9('0x33')]=_0x5800b7[_0x9fb9('0x33')][_0x9fb9('0x34')]?_0x5800b7[_0x9fb9('0x33')]:_0x4653b2['model'];if(_0x459d46[_0x9fb9('0x2e')][_0x9fb9('0x3d')]){_0x5800b7[_0x9fb9('0x3e')]=[{'all':!![]}];}_0x5800b7=_[_0x9fb9('0x3b')]({},_0x5800b7,_0x459d46[_0x9fb9('0x44')]);return db['VtigerConfiguration'][_0x9fb9('0x45')](_0x5800b7)[_0x9fb9('0x22')](handleEntityNotFound(_0x3231ee,null))['then'](respondWithResult(_0x3231ee,null))[_0x9fb9('0x41')](handleError(_0x3231ee,null));};exports[_0x9fb9('0x46')]=function(_0x24e9dc,_0x50e396){return db[_0x9fb9('0x28')][_0x9fb9('0x46')](_0x24e9dc[_0x9fb9('0x47')],{})[_0x9fb9('0x22')](respondWithResult(_0x50e396,0xc9))['catch'](handleError(_0x50e396,null));};exports[_0x9fb9('0x20')]=function(_0x5f5cb0,_0x337b61){if(_0x5f5cb0['body']['id']){delete _0x5f5cb0['body']['id'];}return db[_0x9fb9('0x28')][_0x9fb9('0x45')]({'where':{'id':_0x5f5cb0[_0x9fb9('0x43')]['id']}})[_0x9fb9('0x22')](handleEntityNotFound(_0x337b61,null))[_0x9fb9('0x22')](saveUpdates(_0x5f5cb0[_0x9fb9('0x47')],null))[_0x9fb9('0x22')](respondWithResult(_0x337b61,null))[_0x9fb9('0x41')](handleError(_0x337b61,null));};exports[_0x9fb9('0x21')]=function(_0x1b6d2b,_0x5e74f1){return db['VtigerConfiguration'][_0x9fb9('0x45')]({'where':{'id':_0x1b6d2b[_0x9fb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e74f1,null))['then'](removeEntity(_0x5e74f1,null))[_0x9fb9('0x41')](handleError(_0x5e74f1,null));};exports[_0x9fb9('0x48')]=function(_0x32efd7,_0x523649,_0x3991af){var _0x23cc4d={};var _0x13b94c={};var _0x5784a4;var _0x3e1748;return db['VtigerConfiguration'][_0x9fb9('0x49')]({'where':{'id':_0x32efd7['params']['id']}})[_0x9fb9('0x22')](handleEntityNotFound(_0x523649,null))[_0x9fb9('0x22')](function(_0x3509db){if(_0x3509db){_0x5784a4=_0x3509db;_0x13b94c[_0x9fb9('0x2d')]=_[_0x9fb9('0x2f')](db[_0x9fb9('0x4a')]['rawAttributes']);_0x13b94c[_0x9fb9('0x2e')]=_[_0x9fb9('0x2f')](_0x32efd7['query']);_0x13b94c['filters']=_[_0x9fb9('0x31')](_0x13b94c[_0x9fb9('0x2d')],_0x13b94c[_0x9fb9('0x2e')]);_0x23cc4d[_0x9fb9('0x33')]=_[_0x9fb9('0x31')](_0x13b94c[_0x9fb9('0x2d')],qs[_0x9fb9('0x32')](_0x32efd7['query'][_0x9fb9('0x32')]));_0x23cc4d[_0x9fb9('0x33')]=_0x23cc4d[_0x9fb9('0x33')][_0x9fb9('0x34')]?_0x23cc4d[_0x9fb9('0x33')]:_0x13b94c[_0x9fb9('0x2d')];_0x23cc4d['order']=qs[_0x9fb9('0x38')](_0x32efd7['query']['sort']);_0x23cc4d[_0x9fb9('0x39')]=qs[_0x9fb9('0x30')](_['pick'](_0x32efd7[_0x9fb9('0x2e')],_0x13b94c['filters']));if(_0x32efd7[_0x9fb9('0x2e')][_0x9fb9('0x3a')]){_0x23cc4d[_0x9fb9('0x39')]=_[_0x9fb9('0x3b')](_0x23cc4d['where'],{'$or':_[_0x9fb9('0x27')](_0x23cc4d['attributes'],function(_0x5e7ffb){var _0x34dc9b={};_0x34dc9b[_0x5e7ffb]={'$like':'%'+_0x32efd7[_0x9fb9('0x2e')][_0x9fb9('0x3a')]+'%'};return _0x34dc9b;})});}_0x23cc4d=_[_0x9fb9('0x3b')]({},_0x23cc4d,_0x32efd7[_0x9fb9('0x44')]);return _0x5784a4[_0x9fb9('0x48')](_0x23cc4d);}})[_0x9fb9('0x22')](function(_0x190cb0){if(_0x190cb0){_0x3e1748=_0x190cb0['length'];if(!_0x32efd7[_0x9fb9('0x2e')][_0x9fb9('0x35')](_0x9fb9('0x36'))){_0x23cc4d[_0x9fb9('0x19')]=qs['limit'](_0x32efd7[_0x9fb9('0x2e')][_0x9fb9('0x19')]);_0x23cc4d[_0x9fb9('0x1a')]=qs['offset'](_0x32efd7['query'][_0x9fb9('0x1a')]);}return _0x5784a4[_0x9fb9('0x48')](_0x23cc4d);}})[_0x9fb9('0x22')](function(_0x8cd8b8){if(_0x8cd8b8){return _0x8cd8b8?{'count':_0x3e1748,'rows':_0x8cd8b8}:null;}})['then'](respondWithResult(_0x523649,null))['catch'](handleError(_0x523649,null));};exports['getSubjects']=function(_0x194192,_0x1b8677,_0x1896b0){var _0x42e1ed={};var _0x49e07e={};var _0x51bd91;var _0x455cf6;return db[_0x9fb9('0x28')][_0x9fb9('0x49')]({'where':{'id':_0x194192[_0x9fb9('0x43')]['id']}})[_0x9fb9('0x22')](handleEntityNotFound(_0x1b8677,null))['then'](function(_0xd31d53){if(_0xd31d53){_0x51bd91=_0xd31d53;_0x49e07e[_0x9fb9('0x2d')]=_['keys'](db[_0x9fb9('0x4a')]['rawAttributes']);_0x49e07e[_0x9fb9('0x2e')]=_[_0x9fb9('0x2f')](_0x194192[_0x9fb9('0x2e')]);_0x49e07e[_0x9fb9('0x30')]=_[_0x9fb9('0x31')](_0x49e07e[_0x9fb9('0x2d')],_0x49e07e[_0x9fb9('0x2e')]);_0x42e1ed['attributes']=_['intersection'](_0x49e07e['model'],qs[_0x9fb9('0x32')](_0x194192[_0x9fb9('0x2e')][_0x9fb9('0x32')]));_0x42e1ed[_0x9fb9('0x33')]=_0x42e1ed['attributes'][_0x9fb9('0x34')]?_0x42e1ed[_0x9fb9('0x33')]:_0x49e07e[_0x9fb9('0x2d')];_0x42e1ed[_0x9fb9('0x37')]=qs['sort'](_0x194192[_0x9fb9('0x2e')][_0x9fb9('0x38')]);_0x42e1ed[_0x9fb9('0x39')]=qs[_0x9fb9('0x30')](_[_0x9fb9('0x4b')](_0x194192[_0x9fb9('0x2e')],_0x49e07e['filters']));if(_0x194192[_0x9fb9('0x2e')][_0x9fb9('0x3a')]){_0x42e1ed[_0x9fb9('0x39')]=_[_0x9fb9('0x3b')](_0x42e1ed[_0x9fb9('0x39')],{'$or':_['map'](_0x42e1ed[_0x9fb9('0x33')],function(_0x56b53e){var _0x45c2ac={};_0x45c2ac[_0x56b53e]={'$like':'%'+_0x194192[_0x9fb9('0x2e')][_0x9fb9('0x3a')]+'%'};return _0x45c2ac;})});}_0x42e1ed=_['merge']({},_0x42e1ed,_0x194192[_0x9fb9('0x44')]);return _0x51bd91[_0x9fb9('0x4c')](_0x42e1ed);}})[_0x9fb9('0x22')](function(_0x1ffd7e){if(_0x1ffd7e){_0x455cf6=_0x1ffd7e[_0x9fb9('0x34')];if(!_0x194192[_0x9fb9('0x2e')]['hasOwnProperty'](_0x9fb9('0x36'))){_0x42e1ed['limit']=qs['limit'](_0x194192[_0x9fb9('0x2e')]['limit']);_0x42e1ed['offset']=qs[_0x9fb9('0x1a')](_0x194192[_0x9fb9('0x2e')][_0x9fb9('0x1a')]);}return _0x51bd91[_0x9fb9('0x4c')](_0x42e1ed);}})['then'](function(_0x4aeb58){if(_0x4aeb58){return _0x4aeb58?{'count':_0x455cf6,'rows':_0x4aeb58}:null;}})['then'](respondWithResult(_0x1b8677,null))['catch'](handleError(_0x1b8677,null));};exports[_0x9fb9('0x4d')]=function(_0x4f935e,_0x52ce8d,_0x31fafe){var _0x166c48={};var _0x3a16a1={};var _0xfce459;var _0x453e73;return db['VtigerConfiguration'][_0x9fb9('0x49')]({'where':{'id':_0x4f935e[_0x9fb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ce8d,null))['then'](function(_0x245389){if(_0x245389){_0xfce459=_0x245389;_0x3a16a1[_0x9fb9('0x2d')]=_[_0x9fb9('0x2f')](db[_0x9fb9('0x4a')][_0x9fb9('0x29')]);_0x3a16a1[_0x9fb9('0x2e')]=_[_0x9fb9('0x2f')](_0x4f935e[_0x9fb9('0x2e')]);_0x3a16a1[_0x9fb9('0x30')]=_['intersection'](_0x3a16a1[_0x9fb9('0x2d')],_0x3a16a1[_0x9fb9('0x2e')]);_0x166c48[_0x9fb9('0x33')]=_['intersection'](_0x3a16a1[_0x9fb9('0x2d')],qs[_0x9fb9('0x32')](_0x4f935e['query'][_0x9fb9('0x32')]));_0x166c48[_0x9fb9('0x33')]=_0x166c48[_0x9fb9('0x33')][_0x9fb9('0x34')]?_0x166c48['attributes']:_0x3a16a1[_0x9fb9('0x2d')];_0x166c48['order']=qs[_0x9fb9('0x38')](_0x4f935e[_0x9fb9('0x2e')][_0x9fb9('0x38')]);_0x166c48['where']=qs[_0x9fb9('0x30')](_[_0x9fb9('0x4b')](_0x4f935e[_0x9fb9('0x2e')],_0x3a16a1[_0x9fb9('0x30')]));if(_0x4f935e[_0x9fb9('0x2e')][_0x9fb9('0x3a')]){_0x166c48[_0x9fb9('0x39')]=_[_0x9fb9('0x3b')](_0x166c48['where'],{'$or':_['map'](_0x166c48[_0x9fb9('0x33')],function(_0x2d7436){var _0x15038b={};_0x15038b[_0x2d7436]={'$like':'%'+_0x4f935e[_0x9fb9('0x2e')]['filter']+'%'};return _0x15038b;})});}_0x166c48=_['merge']({},_0x166c48,_0x4f935e[_0x9fb9('0x44')]);return _0xfce459['getDescriptions'](_0x166c48);}})[_0x9fb9('0x22')](function(_0x16f86f){if(_0x16f86f){_0x453e73=_0x16f86f[_0x9fb9('0x34')];if(!_0x4f935e['query'][_0x9fb9('0x35')]('nolimit')){_0x166c48[_0x9fb9('0x19')]=qs[_0x9fb9('0x19')](_0x4f935e[_0x9fb9('0x2e')]['limit']);_0x166c48[_0x9fb9('0x1a')]=qs[_0x9fb9('0x1a')](_0x4f935e[_0x9fb9('0x2e')]['offset']);}return _0xfce459[_0x9fb9('0x4d')](_0x166c48);}})[_0x9fb9('0x22')](function(_0x506c0c){if(_0x506c0c){return _0x506c0c?{'count':_0x453e73,'rows':_0x506c0c}:null;}})[_0x9fb9('0x22')](respondWithResult(_0x52ce8d,null))[_0x9fb9('0x41')](handleError(_0x52ce8d,null));}; \ No newline at end of file +var _0x0427=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','VtigerConfiguration','rows','catch','show','keys','includeAll','find','create','body','update','params','getFields','VtigerField','rawAttributes','length','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0427,0x137));var _0x7042=function(_0x2894a6,_0x381a84){_0x2894a6=_0x2894a6-0x0;var _0x5c9db1=_0x0427[_0x2894a6];return _0x5c9db1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7042('0x0'));var jsonpatch=require(_0x7042('0x1'));var rp=require('request-promise');var moment=require(_0x7042('0x2'));var BPromise=require(_0x7042('0x3'));var Mustache=require(_0x7042('0x4'));var util=require(_0x7042('0x5'));var path=require(_0x7042('0x6'));var sox=require(_0x7042('0x7'));var csv=require(_0x7042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7042('0x9'));var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0x8'));var querystring=require(_0x7042('0xf'));var Papa=require(_0x7042('0x10'));var Redis=require('ioredis');var authService=require(_0x7042('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x12'));var utils=require('../../config/utils');var config=require(_0x7042('0x13'));var licenseUtil=require(_0x7042('0x14'));var db=require(_0x7042('0x15'))['db'];function respondWithStatusCode(_0x5629f2,_0x5c06f0){_0x5c06f0=_0x5c06f0||0xcc;return function(_0x292c4a){if(_0x292c4a){return _0x5629f2[_0x7042('0x16')](_0x5c06f0);}return _0x5629f2[_0x7042('0x17')](_0x5c06f0)[_0x7042('0x18')]();};}function respondWithResult(_0x25dfe5,_0xee4c2){_0xee4c2=_0xee4c2||0xc8;return function(_0x5def25){if(_0x5def25){return _0x25dfe5[_0x7042('0x17')](_0xee4c2)[_0x7042('0x19')](_0x5def25);}};}function respondWithFilteredResult(_0x6ed505,_0x5c1ef0){return function(_0x4c68c4){if(_0x4c68c4){var _0xc7e44e=typeof _0x5c1ef0['offset']===_0x7042('0x1a')&&typeof _0x5c1ef0['limit']==='undefined';var _0x28add7=_0x4c68c4[_0x7042('0x1b')];var _0x1e69aa=_0xc7e44e?0x0:_0x5c1ef0[_0x7042('0x1c')];var _0x6e18fb=_0xc7e44e?_0x4c68c4['count']:_0x5c1ef0[_0x7042('0x1c')]+_0x5c1ef0[_0x7042('0x1d')];var _0x34fda6;if(_0x6e18fb>=_0x28add7){_0x6e18fb=_0x28add7;_0x34fda6=0xc8;}else{_0x34fda6=0xce;}_0x6ed505[_0x7042('0x17')](_0x34fda6);return _0x6ed505[_0x7042('0x1e')]('Content-Range',_0x1e69aa+'-'+_0x6e18fb+'/'+_0x28add7)[_0x7042('0x19')](_0x4c68c4);}return null;};}function patchUpdates(_0x580f84){return function(_0x363f3c){try{jsonpatch['apply'](_0x363f3c,_0x580f84,!![]);}catch(_0x3b8203){return BPromise[_0x7042('0x1f')](_0x3b8203);}return _0x363f3c[_0x7042('0x20')]();};}function saveUpdates(_0x456dfc,_0x484c82){return function(_0x5a224b){if(_0x5a224b){return _0x5a224b['update'](_0x456dfc)[_0x7042('0x21')](function(_0x30a722){return _0x30a722;});}return null;};}function removeEntity(_0x3af8bc,_0x1949fe){return function(_0x48d529){if(_0x48d529){return _0x48d529[_0x7042('0x22')]()[_0x7042('0x21')](function(){_0x3af8bc[_0x7042('0x17')](0xcc)[_0x7042('0x18')]();});}};}function handleEntityNotFound(_0x459ff6,_0x54445b){return function(_0xc5fed3){if(!_0xc5fed3){_0x459ff6[_0x7042('0x16')](0x194);}return _0xc5fed3;};}function handleError(_0xf3c3f9,_0x1a05d1){_0x1a05d1=_0x1a05d1||0x1f4;return function(_0x2e4dbe){logger[_0x7042('0x23')](_0x2e4dbe[_0x7042('0x24')]);if(_0x2e4dbe[_0x7042('0x25')]){delete _0x2e4dbe[_0x7042('0x25')];}_0xf3c3f9[_0x7042('0x17')](_0x1a05d1)[_0x7042('0x26')](_0x2e4dbe);};}exports[_0x7042('0x27')]=function(_0x88c156,_0x1b6a29){var _0x101b89={},_0x3203f3={},_0x477972={'count':0x0,'rows':[]};var _0xa7461d=_[_0x7042('0x28')](db['VtigerConfiguration']['rawAttributes'],function(_0x37cf52){return{'name':_0x37cf52[_0x7042('0x29')],'type':_0x37cf52[_0x7042('0x2a')][_0x7042('0x2b')]};});_0x3203f3[_0x7042('0x2c')]=_[_0x7042('0x28')](_0xa7461d,_0x7042('0x25'));_0x3203f3['query']=_['keys'](_0x88c156[_0x7042('0x2d')]);_0x3203f3[_0x7042('0x2e')]=_['intersection'](_0x3203f3[_0x7042('0x2c')],_0x3203f3[_0x7042('0x2d')]);_0x101b89['attributes']=_[_0x7042('0x2f')](_0x3203f3[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x88c156[_0x7042('0x2d')][_0x7042('0x30')]));_0x101b89['attributes']=_0x101b89[_0x7042('0x31')]['length']?_0x101b89['attributes']:_0x3203f3[_0x7042('0x2c')];if(!_0x88c156['query'][_0x7042('0x32')](_0x7042('0x33'))){_0x101b89['limit']=qs[_0x7042('0x1d')](_0x88c156['query'][_0x7042('0x1d')]);_0x101b89[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x88c156[_0x7042('0x2d')][_0x7042('0x1c')]);}_0x101b89[_0x7042('0x34')]=qs[_0x7042('0x35')](_0x88c156[_0x7042('0x2d')][_0x7042('0x35')]);_0x101b89['where']=qs[_0x7042('0x2e')](_[_0x7042('0x36')](_0x88c156[_0x7042('0x2d')],_0x3203f3['filters']),_0xa7461d);if(_0x88c156['query'][_0x7042('0x37')]){_0x101b89[_0x7042('0x38')]=_['merge'](_0x101b89[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0xa7461d,function(_0x349198){if(_0x349198[_0x7042('0x2a')]!==_0x7042('0x39')){var _0x3abd08={};_0x3abd08[_0x349198[_0x7042('0x25')]]={'$like':'%'+_0x88c156[_0x7042('0x2d')][_0x7042('0x37')]+'%'};return _0x3abd08;}})});}_0x101b89=_[_0x7042('0x3a')]({},_0x101b89,_0x88c156[_0x7042('0x3b')]);var _0x4232c2={'where':_0x101b89[_0x7042('0x38')]};return db['VtigerConfiguration']['count'](_0x4232c2)[_0x7042('0x21')](function(_0x43f372){_0x477972[_0x7042('0x1b')]=_0x43f372;if(_0x88c156[_0x7042('0x2d')]['includeAll']){_0x101b89[_0x7042('0x3c')]=[{'all':!![]}];}return db[_0x7042('0x3d')]['findAll'](_0x101b89);})['then'](function(_0x1f8e68){_0x477972[_0x7042('0x3e')]=_0x1f8e68;return _0x477972;})[_0x7042('0x21')](respondWithFilteredResult(_0x1b6a29,_0x101b89))[_0x7042('0x3f')](handleError(_0x1b6a29,null));};exports[_0x7042('0x40')]=function(_0x4a4e90,_0x5de476){var _0x2c8d2a={'raw':![],'where':{'id':_0x4a4e90['params']['id']}},_0x3897fc={};_0x3897fc[_0x7042('0x2c')]=_[_0x7042('0x41')](db[_0x7042('0x3d')]['rawAttributes']);_0x3897fc['query']=_[_0x7042('0x41')](_0x4a4e90[_0x7042('0x2d')]);_0x3897fc[_0x7042('0x2e')]=_['intersection'](_0x3897fc[_0x7042('0x2c')],_0x3897fc[_0x7042('0x2d')]);_0x2c8d2a['attributes']=_[_0x7042('0x2f')](_0x3897fc[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x4a4e90[_0x7042('0x2d')][_0x7042('0x30')]));_0x2c8d2a[_0x7042('0x31')]=_0x2c8d2a[_0x7042('0x31')]['length']?_0x2c8d2a[_0x7042('0x31')]:_0x3897fc[_0x7042('0x2c')];if(_0x4a4e90['query'][_0x7042('0x42')]){_0x2c8d2a[_0x7042('0x3c')]=[{'all':!![]}];}_0x2c8d2a=_[_0x7042('0x3a')]({},_0x2c8d2a,_0x4a4e90[_0x7042('0x3b')]);return db[_0x7042('0x3d')][_0x7042('0x43')](_0x2c8d2a)['then'](handleEntityNotFound(_0x5de476,null))['then'](respondWithResult(_0x5de476,null))['catch'](handleError(_0x5de476,null));};exports[_0x7042('0x44')]=function(_0x55ecfe,_0x4821d3){return db[_0x7042('0x3d')]['create'](_0x55ecfe[_0x7042('0x45')],{})[_0x7042('0x21')](respondWithResult(_0x4821d3,0xc9))[_0x7042('0x3f')](handleError(_0x4821d3,null));};exports[_0x7042('0x46')]=function(_0x1a22d5,_0x11e7ce){if(_0x1a22d5[_0x7042('0x45')]['id']){delete _0x1a22d5[_0x7042('0x45')]['id'];}return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x1a22d5[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x11e7ce,null))[_0x7042('0x21')](saveUpdates(_0x1a22d5['body'],null))[_0x7042('0x21')](respondWithResult(_0x11e7ce,null))[_0x7042('0x3f')](handleError(_0x11e7ce,null));};exports[_0x7042('0x22')]=function(_0x81b898,_0x3fcf0e){return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x81b898[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x3fcf0e,null))[_0x7042('0x21')](removeEntity(_0x3fcf0e,null))[_0x7042('0x3f')](handleError(_0x3fcf0e,null));};exports[_0x7042('0x48')]=function(_0x79f988,_0x4d1518,_0x388c5d){var _0x4b1bba={};var _0x2cb2da={};var _0x1a2b3a;var _0x418794;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x79f988[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x4d1518,null))[_0x7042('0x21')](function(_0x43fd19){if(_0x43fd19){_0x1a2b3a=_0x43fd19;_0x2cb2da['model']=_['keys'](db[_0x7042('0x49')][_0x7042('0x4a')]);_0x2cb2da['query']=_[_0x7042('0x41')](_0x79f988[_0x7042('0x2d')]);_0x2cb2da['filters']=_[_0x7042('0x2f')](_0x2cb2da[_0x7042('0x2c')],_0x2cb2da['query']);_0x4b1bba[_0x7042('0x31')]=_[_0x7042('0x2f')](_0x2cb2da[_0x7042('0x2c')],qs['fields'](_0x79f988[_0x7042('0x2d')][_0x7042('0x30')]));_0x4b1bba[_0x7042('0x31')]=_0x4b1bba[_0x7042('0x31')][_0x7042('0x4b')]?_0x4b1bba[_0x7042('0x31')]:_0x2cb2da[_0x7042('0x2c')];_0x4b1bba[_0x7042('0x34')]=qs[_0x7042('0x35')](_0x79f988[_0x7042('0x2d')][_0x7042('0x35')]);_0x4b1bba[_0x7042('0x38')]=qs['filters'](_[_0x7042('0x36')](_0x79f988[_0x7042('0x2d')],_0x2cb2da[_0x7042('0x2e')]));if(_0x79f988[_0x7042('0x2d')][_0x7042('0x37')]){_0x4b1bba[_0x7042('0x38')]=_['merge'](_0x4b1bba[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0x4b1bba[_0x7042('0x31')],function(_0x4ba034){var _0x13fb0e={};_0x13fb0e[_0x4ba034]={'$like':'%'+_0x79f988[_0x7042('0x2d')][_0x7042('0x37')]+'%'};return _0x13fb0e;})});}_0x4b1bba=_[_0x7042('0x3a')]({},_0x4b1bba,_0x79f988[_0x7042('0x3b')]);return _0x1a2b3a[_0x7042('0x48')](_0x4b1bba);}})[_0x7042('0x21')](function(_0x3c55e6){if(_0x3c55e6){_0x418794=_0x3c55e6['length'];if(!_0x79f988[_0x7042('0x2d')][_0x7042('0x32')](_0x7042('0x33'))){_0x4b1bba[_0x7042('0x1d')]=qs[_0x7042('0x1d')](_0x79f988[_0x7042('0x2d')][_0x7042('0x1d')]);_0x4b1bba['offset']=qs[_0x7042('0x1c')](_0x79f988['query'][_0x7042('0x1c')]);}return _0x1a2b3a[_0x7042('0x48')](_0x4b1bba);}})[_0x7042('0x21')](function(_0x8a0a9e){if(_0x8a0a9e){return _0x8a0a9e?{'count':_0x418794,'rows':_0x8a0a9e}:null;}})['then'](respondWithResult(_0x4d1518,null))['catch'](handleError(_0x4d1518,null));};exports[_0x7042('0x4c')]=function(_0x38a9bf,_0x4d07f2,_0x242abc){var _0x412142={};var _0x12df51={};var _0x195f08;var _0x336777;return db[_0x7042('0x3d')][_0x7042('0x4d')]({'where':{'id':_0x38a9bf[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x4d07f2,null))['then'](function(_0x2185f3){if(_0x2185f3){_0x195f08=_0x2185f3;_0x12df51[_0x7042('0x2c')]=_[_0x7042('0x41')](db[_0x7042('0x49')]['rawAttributes']);_0x12df51[_0x7042('0x2d')]=_['keys'](_0x38a9bf[_0x7042('0x2d')]);_0x12df51[_0x7042('0x2e')]=_['intersection'](_0x12df51['model'],_0x12df51[_0x7042('0x2d')]);_0x412142['attributes']=_[_0x7042('0x2f')](_0x12df51[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x38a9bf['query']['fields']));_0x412142['attributes']=_0x412142[_0x7042('0x31')][_0x7042('0x4b')]?_0x412142['attributes']:_0x12df51[_0x7042('0x2c')];_0x412142[_0x7042('0x34')]=qs[_0x7042('0x35')](_0x38a9bf['query'][_0x7042('0x35')]);_0x412142[_0x7042('0x38')]=qs['filters'](_['pick'](_0x38a9bf[_0x7042('0x2d')],_0x12df51['filters']));if(_0x38a9bf['query'][_0x7042('0x37')]){_0x412142[_0x7042('0x38')]=_[_0x7042('0x3a')](_0x412142[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0x412142[_0x7042('0x31')],function(_0x473af8){var _0x1d8277={};_0x1d8277[_0x473af8]={'$like':'%'+_0x38a9bf['query']['filter']+'%'};return _0x1d8277;})});}_0x412142=_[_0x7042('0x3a')]({},_0x412142,_0x38a9bf[_0x7042('0x3b')]);return _0x195f08[_0x7042('0x4c')](_0x412142);}})['then'](function(_0x5671c2){if(_0x5671c2){_0x336777=_0x5671c2[_0x7042('0x4b')];if(!_0x38a9bf['query'][_0x7042('0x32')](_0x7042('0x33'))){_0x412142[_0x7042('0x1d')]=qs['limit'](_0x38a9bf[_0x7042('0x2d')][_0x7042('0x1d')]);_0x412142['offset']=qs[_0x7042('0x1c')](_0x38a9bf[_0x7042('0x2d')]['offset']);}return _0x195f08['getSubjects'](_0x412142);}})[_0x7042('0x21')](function(_0x33f827){if(_0x33f827){return _0x33f827?{'count':_0x336777,'rows':_0x33f827}:null;}})['then'](respondWithResult(_0x4d07f2,null))[_0x7042('0x3f')](handleError(_0x4d07f2,null));};exports[_0x7042('0x4e')]=function(_0x3e2833,_0x1fb3e9,_0x3fe844){var _0x8fd4ec={};var _0x21c587={};var _0x2c4d6f;var _0x36d2ac;return db[_0x7042('0x3d')]['findOne']({'where':{'id':_0x3e2833[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x1fb3e9,null))[_0x7042('0x21')](function(_0x26707e){if(_0x26707e){_0x2c4d6f=_0x26707e;_0x21c587['model']=_[_0x7042('0x41')](db[_0x7042('0x49')][_0x7042('0x4a')]);_0x21c587[_0x7042('0x2d')]=_['keys'](_0x3e2833[_0x7042('0x2d')]);_0x21c587[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x21c587[_0x7042('0x2c')],_0x21c587[_0x7042('0x2d')]);_0x8fd4ec['attributes']=_['intersection'](_0x21c587[_0x7042('0x2c')],qs['fields'](_0x3e2833[_0x7042('0x2d')][_0x7042('0x30')]));_0x8fd4ec[_0x7042('0x31')]=_0x8fd4ec[_0x7042('0x31')][_0x7042('0x4b')]?_0x8fd4ec[_0x7042('0x31')]:_0x21c587['model'];_0x8fd4ec[_0x7042('0x34')]=qs['sort'](_0x3e2833[_0x7042('0x2d')][_0x7042('0x35')]);_0x8fd4ec['where']=qs[_0x7042('0x2e')](_[_0x7042('0x36')](_0x3e2833[_0x7042('0x2d')],_0x21c587[_0x7042('0x2e')]));if(_0x3e2833['query'][_0x7042('0x37')]){_0x8fd4ec[_0x7042('0x38')]=_[_0x7042('0x3a')](_0x8fd4ec[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0x8fd4ec[_0x7042('0x31')],function(_0x43610e){var _0x356841={};_0x356841[_0x43610e]={'$like':'%'+_0x3e2833[_0x7042('0x2d')]['filter']+'%'};return _0x356841;})});}_0x8fd4ec=_[_0x7042('0x3a')]({},_0x8fd4ec,_0x3e2833[_0x7042('0x3b')]);return _0x2c4d6f[_0x7042('0x4e')](_0x8fd4ec);}})['then'](function(_0x41fafb){if(_0x41fafb){_0x36d2ac=_0x41fafb['length'];if(!_0x3e2833['query'][_0x7042('0x32')](_0x7042('0x33'))){_0x8fd4ec[_0x7042('0x1d')]=qs['limit'](_0x3e2833[_0x7042('0x2d')][_0x7042('0x1d')]);_0x8fd4ec[_0x7042('0x1c')]=qs['offset'](_0x3e2833[_0x7042('0x2d')][_0x7042('0x1c')]);}return _0x2c4d6f[_0x7042('0x4e')](_0x8fd4ec);}})[_0x7042('0x21')](function(_0x6e531f){if(_0x6e531f){return _0x6e531f?{'count':_0x36d2ac,'rows':_0x6e531f}:null;}})[_0x7042('0x21')](respondWithResult(_0x1fb3e9,null))[_0x7042('0x3f')](handleError(_0x1fb3e9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 02071fb..cf07520 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 _0x2f20=['./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23c5e9,_0x4ea3b5){var _0x318525=function(_0x4a02fc){while(--_0x4a02fc){_0x23c5e9['push'](_0x23c5e9['shift']());}};_0x318525(++_0x4ea3b5);}(_0x2f20,0x1c5));var _0x02f2=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x2f20[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02f2('0x0'))('api');var moment=require(_0x02f2('0x1'));var BPromise=require(_0x02f2('0x2'));var rp=require(_0x02f2('0x3'));var fs=require('fs');var path=require(_0x02f2('0x4'));var rimraf=require(_0x02f2('0x5'));var config=require(_0x02f2('0x6'));var attributes=require(_0x02f2('0x7'));module['exports']=function(_0x40a1b0,_0x3c740c){return _0x40a1b0['define'](_0x02f2('0x8'),attributes,{'tableName':_0x02f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30f2=['exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes'];(function(_0x372791,_0x37c573){var _0x19c83c=function(_0x3ec8cb){while(--_0x3ec8cb){_0x372791['push'](_0x372791['shift']());}};_0x19c83c(++_0x37c573);}(_0x30f2,0x16b));var _0x230f=function(_0x10571d,_0x1770ae){_0x10571d=_0x10571d-0x0;var _0x3905eb=_0x30f2[_0x10571d];return _0x3905eb;};'use strict';var _=require(_0x230f('0x0'));var util=require(_0x230f('0x1'));var logger=require(_0x230f('0x2'))(_0x230f('0x3'));var moment=require(_0x230f('0x4'));var BPromise=require(_0x230f('0x5'));var rp=require(_0x230f('0x6'));var fs=require('fs');var path=require(_0x230f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x230f('0x8'));module[_0x230f('0x9')]=function(_0x56169b,_0x1df64b){return _0x56169b[_0x230f('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x230f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 3f89190..1b97664 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 _0x008b=['rpc','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x31fbfa,_0x2baf40){var _0xae89db=function(_0x28d283){while(--_0x28d283){_0x31fbfa['push'](_0x31fbfa['shift']());}};_0xae89db(++_0x2baf40);}(_0x008b,0x65));var _0xb008=function(_0x53e0f9,_0x2c84f0){_0x53e0f9=_0x53e0f9-0x0;var _0x46afe5=_0x008b[_0x53e0f9];return _0x46afe5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb008('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb008('0x1'));var db=require(_0xb008('0x2'))['db'];var utils=require(_0xb008('0x3'));var logger=require('../../config/logger')(_0xb008('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358cf0,_0x519214,_0x2f2c10){return new BPromise(function(_0x53688d,_0x18c8b2){return client[_0xb008('0x5')](_0x358cf0,_0x2f2c10)[_0xb008('0x6')](function(_0x52b177){logger[_0xb008('0x7')](_0xb008('0x8'),_0x519214,_0xb008('0x9'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x519214,'request\x20sent',JSON['stringify'](_0x52b177));if(_0x52b177['error']){if(_0x52b177[_0xb008('0xa')][_0xb008('0xb')]===0x1f4){logger[_0xb008('0xa')](_0xb008('0x8'),_0x519214,_0x52b177[_0xb008('0xa')][_0xb008('0xc')]);return _0x18c8b2(_0x52b177[_0xb008('0xa')][_0xb008('0xc')]);}logger[_0xb008('0xa')](_0xb008('0x8'),_0x519214,_0x52b177['error'][_0xb008('0xc')]);return _0x53688d(_0x52b177[_0xb008('0xa')]['message']);}else{logger[_0xb008('0x7')](_0xb008('0x8'),_0x519214,_0xb008('0x9'));_0x53688d(_0x52b177[_0xb008('0xd')][_0xb008('0xc')]);}})[_0xb008('0xe')](function(_0x23c571){logger[_0xb008('0xa')](_0xb008('0x8'),_0x519214,_0x23c571);_0x18c8b2(_0x23c571);});});} \ No newline at end of file +var _0x78ab=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment'];(function(_0x4b359c,_0x1987a9){var _0x5ac361=function(_0x31ab84){while(--_0x31ab84){_0x4b359c['push'](_0x4b359c['shift']());}};_0x5ac361(++_0x1987a9);}(_0x78ab,0xb7));var _0xb78a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x78ab[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xb78a('0x0'));var util=require(_0xb78a('0x1'));var moment=require(_0xb78a('0x2'));var BPromise=require(_0xb78a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb78a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb78a('0x5'));var config=require(_0xb78a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb78a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ad6be,_0x50342d,_0x1230e3){return new BPromise(function(_0x1a74aa,_0x5cee43){return client[_0xb78a('0x8')](_0x4ad6be,_0x1230e3)[_0xb78a('0x9')](function(_0x5e1992){logger[_0xb78a('0xa')](_0xb78a('0xb'),_0x50342d,_0xb78a('0xc'));logger[_0xb78a('0xd')](_0xb78a('0xe'),_0x50342d,_0xb78a('0xc'),JSON['stringify'](_0x5e1992));if(_0x5e1992['error']){if(_0x5e1992[_0xb78a('0xf')]['code']===0x1f4){logger[_0xb78a('0xf')](_0xb78a('0xb'),_0x50342d,_0x5e1992[_0xb78a('0xf')]['message']);return _0x5cee43(_0x5e1992[_0xb78a('0xf')][_0xb78a('0x10')]);}logger[_0xb78a('0xf')](_0xb78a('0xb'),_0x50342d,_0x5e1992['error'][_0xb78a('0x10')]);return _0x1a74aa(_0x5e1992['error'][_0xb78a('0x10')]);}else{logger[_0xb78a('0xa')](_0xb78a('0xb'),_0x50342d,_0xb78a('0xc'));_0x1a74aa(_0x5e1992[_0xb78a('0x11')][_0xb78a('0x10')]);}})[_0xb78a('0x12')](function(_0x24ea87){logger[_0xb78a('0xf')](_0xb78a('0xb'),_0x50342d,_0x24ea87);_0x5cee43(_0x24ea87);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 06fd9af..00a9f42 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 _0x9302=['isAuthenticated','index','/:id','put','update','delete','path','connect-timeout','Router','fs-extra','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9302,0xc1));var _0x2930=function(_0x3f591e,_0xe02469){_0x3f591e=_0x3f591e-0x0;var _0x41d0c6=_0x9302[_0x3f591e];return _0x41d0c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2930('0x0'));var timeout=require(_0x2930('0x1'));var express=require('express');var router=express[_0x2930('0x2')]();var fs_extra=require(_0x2930('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x2930('0x4')]('/',auth[_0x2930('0x5')](),controller[_0x2930('0x6')]);router[_0x2930('0x4')](_0x2930('0x7'),auth[_0x2930('0x5')](),controller['show']);router['post']('/',auth[_0x2930('0x5')](),controller['create']);router[_0x2930('0x8')](_0x2930('0x7'),auth[_0x2930('0x5')](),controller[_0x2930('0x9')]);router[_0x2930('0xa')](_0x2930('0x7'),auth[_0x2930('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x62b8=['exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x511695,_0x1ba5b1){var _0x573705=function(_0x2f6a4a){while(--_0x2f6a4a){_0x511695['push'](_0x511695['shift']());}};_0x573705(++_0x1ba5b1);}(_0x62b8,0x1dd));var _0x862b=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x62b8[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x862b('0x0'));var util=require(_0x862b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x862b('0x2'));var router=express['Router']();var fs_extra=require(_0x862b('0x3'));var auth=require(_0x862b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x862b('0x5'));var controller=require(_0x862b('0x6'));router[_0x862b('0x7')]('/',auth[_0x862b('0x8')](),controller[_0x862b('0x9')]);router['get'](_0x862b('0xa'),auth[_0x862b('0x8')](),controller['show']);router[_0x862b('0xb')]('/',auth[_0x862b('0x8')](),controller[_0x862b('0xc')]);router[_0x862b('0xd')](_0x862b('0xa'),auth['isAuthenticated'](),controller[_0x862b('0xe')]);router['delete'](_0x862b('0xa'),auth['isAuthenticated'](),controller[_0x862b('0xf')]);module[_0x862b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f28be9a..c5072b5 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 _0x7436=['STRING','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string'];(function(_0x5f2c5f,_0x76561d){var _0x44cd63=function(_0x197bb5){while(--_0x197bb5){_0x5f2c5f['push'](_0x5f2c5f['shift']());}};_0x44cd63(++_0x76561d);}(_0x7436,0x11a));var _0x6743=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7436[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x6743('0x0'));module[_0x6743('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6743('0x2'),_0x6743('0x3'),_0x6743('0x4'),'picklist'),'defaultValue':_0x6743('0x5')},'content':{'type':Sequelize[_0x6743('0x6')]},'key':{'type':Sequelize[_0x6743('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x6743('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6743('0x6')]},'idField':{'type':Sequelize[_0x6743('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6743('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6743('0x6')]}}; \ No newline at end of file +var _0x6318=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x27469b,_0x2b036c){var _0x1b9a5a=function(_0x34076){while(--_0x34076){_0x27469b['push'](_0x27469b['shift']());}};_0x1b9a5a(++_0x2b036c);}(_0x6318,0x1bc));var _0x8631=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x6318[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x8631('0x0'));module[_0x8631('0x1')]={'type':{'type':Sequelize[_0x8631('0x2')]('string','variable',_0x8631('0x3'),_0x8631('0x4'),_0x8631('0x5')),'defaultValue':_0x8631('0x6')},'content':{'type':Sequelize[_0x8631('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8631('0x2')](_0x8631('0x6'),_0x8631('0x8'),_0x8631('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8631('0x7')]},'nameField':{'type':Sequelize[_0x8631('0x7')]},'customField':{'type':Sequelize[_0x8631('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ef53d7f..c0cd558 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 _0xc247=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VtigerField','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','eml-format','rimraf','zip-dir'];(function(_0x258eca,_0x1992ee){var _0x96b799=function(_0x4a2e68){while(--_0x4a2e68){_0x258eca['push'](_0x258eca['shift']());}};_0x96b799(++_0x1992ee);}(_0xc247,0x8b));var _0x7c24=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xc247[_0x95942];return _0x6d7f81;};'use strict';var emlformat=require(_0x7c24('0x0'));var rimraf=require(_0x7c24('0x1'));var zipdir=require(_0x7c24('0x2'));var jsonpatch=require(_0x7c24('0x3'));var rp=require(_0x7c24('0x4'));var moment=require(_0x7c24('0x5'));var BPromise=require(_0x7c24('0x6'));var Mustache=require('mustache');var util=require(_0x7c24('0x7'));var path=require(_0x7c24('0x8'));var sox=require(_0x7c24('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c24('0xa'));var squel=require('squel');var crypto=require(_0x7c24('0xb'));var jsforce=require(_0x7c24('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7c24('0xd'));var querystring=require(_0x7c24('0xe'));var Papa=require(_0x7c24('0xf'));var Redis=require(_0x7c24('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c24('0x12'));var utils=require(_0x7c24('0x13'));var config=require(_0x7c24('0x14'));var licenseUtil=require(_0x7c24('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ecd9d,_0x4e165a){_0x4e165a=_0x4e165a||0xcc;return function(_0x2a72f){if(_0x2a72f){return _0x2ecd9d[_0x7c24('0x16')](_0x4e165a);}return _0x2ecd9d['status'](_0x4e165a)['end']();};}function respondWithResult(_0x2b00e2,_0x4c5dd1){_0x4c5dd1=_0x4c5dd1||0xc8;return function(_0x4db6e7){if(_0x4db6e7){return _0x2b00e2[_0x7c24('0x17')](_0x4c5dd1)[_0x7c24('0x18')](_0x4db6e7);}};}function respondWithFilteredResult(_0x49719c,_0x315247){return function(_0xf23a44){if(_0xf23a44){var _0x51911c=typeof _0x315247['offset']===_0x7c24('0x19')&&typeof _0x315247['limit']===_0x7c24('0x19');var _0x3753cb=_0xf23a44[_0x7c24('0x1a')];var _0x4908c8=_0x51911c?0x0:_0x315247[_0x7c24('0x1b')];var _0x36f619=_0x51911c?_0xf23a44[_0x7c24('0x1a')]:_0x315247[_0x7c24('0x1b')]+_0x315247['limit'];var _0x3d2e9a;if(_0x36f619>=_0x3753cb){_0x36f619=_0x3753cb;_0x3d2e9a=0xc8;}else{_0x3d2e9a=0xce;}_0x49719c[_0x7c24('0x17')](_0x3d2e9a);return _0x49719c[_0x7c24('0x1c')](_0x7c24('0x1d'),_0x4908c8+'-'+_0x36f619+'/'+_0x3753cb)[_0x7c24('0x18')](_0xf23a44);}return null;};}function patchUpdates(_0x20963f){return function(_0x34b65a){try{jsonpatch[_0x7c24('0x1e')](_0x34b65a,_0x20963f,!![]);}catch(_0x31b31d){return BPromise[_0x7c24('0x1f')](_0x31b31d);}return _0x34b65a['save']();};}function saveUpdates(_0x4f0fc5,_0x43bf0c){return function(_0x2b1613){if(_0x2b1613){return _0x2b1613['update'](_0x4f0fc5)[_0x7c24('0x20')](function(_0x50221d){return _0x50221d;});}return null;};}function removeEntity(_0x4383a3,_0x58c20a){return function(_0x54546c){if(_0x54546c){return _0x54546c[_0x7c24('0x21')]()['then'](function(){_0x4383a3[_0x7c24('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc104c,_0x486d0a){return function(_0x483210){if(!_0x483210){_0xfc104c[_0x7c24('0x16')](0x194);}return _0x483210;};}function handleError(_0x4b58dd,_0x10eb94){_0x10eb94=_0x10eb94||0x1f4;return function(_0x5cbb14){logger[_0x7c24('0x22')](_0x5cbb14['stack']);if(_0x5cbb14[_0x7c24('0x23')]){delete _0x5cbb14[_0x7c24('0x23')];}_0x4b58dd['status'](_0x10eb94)[_0x7c24('0x24')](_0x5cbb14);};}exports[_0x7c24('0x25')]=function(_0x15115b,_0x44cb60){var _0x5cffe2={},_0x4ee614={},_0x520f41={'count':0x0,'rows':[]};var _0x25cbcb=_[_0x7c24('0x26')](db[_0x7c24('0x27')]['rawAttributes'],function(_0x20a810){return{'name':_0x20a810[_0x7c24('0x28')],'type':_0x20a810['type'][_0x7c24('0x29')]};});_0x4ee614[_0x7c24('0x2a')]=_[_0x7c24('0x26')](_0x25cbcb,'name');_0x4ee614['query']=_[_0x7c24('0x2b')](_0x15115b[_0x7c24('0x2c')]);_0x4ee614[_0x7c24('0x2d')]=_['intersection'](_0x4ee614[_0x7c24('0x2a')],_0x4ee614[_0x7c24('0x2c')]);_0x5cffe2[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x4ee614[_0x7c24('0x2a')],qs[_0x7c24('0x30')](_0x15115b[_0x7c24('0x2c')][_0x7c24('0x30')]));_0x5cffe2['attributes']=_0x5cffe2['attributes'][_0x7c24('0x31')]?_0x5cffe2[_0x7c24('0x2e')]:_0x4ee614[_0x7c24('0x2a')];if(!_0x15115b[_0x7c24('0x2c')][_0x7c24('0x32')](_0x7c24('0x33'))){_0x5cffe2[_0x7c24('0x34')]=qs['limit'](_0x15115b['query'][_0x7c24('0x34')]);_0x5cffe2[_0x7c24('0x1b')]=qs[_0x7c24('0x1b')](_0x15115b['query'][_0x7c24('0x1b')]);}_0x5cffe2[_0x7c24('0x35')]=qs[_0x7c24('0x36')](_0x15115b[_0x7c24('0x2c')]['sort']);_0x5cffe2[_0x7c24('0x37')]=qs[_0x7c24('0x2d')](_[_0x7c24('0x38')](_0x15115b[_0x7c24('0x2c')],_0x4ee614['filters']),_0x25cbcb);if(_0x15115b[_0x7c24('0x2c')][_0x7c24('0x39')]){_0x5cffe2[_0x7c24('0x37')]=_[_0x7c24('0x3a')](_0x5cffe2[_0x7c24('0x37')],{'$or':_[_0x7c24('0x26')](_0x25cbcb,function(_0x302c7a){if(_0x302c7a['type']!=='VIRTUAL'){var _0x381cbd={};_0x381cbd[_0x302c7a['name']]={'$like':'%'+_0x15115b['query'][_0x7c24('0x39')]+'%'};return _0x381cbd;}})});}_0x5cffe2=_[_0x7c24('0x3a')]({},_0x5cffe2,_0x15115b[_0x7c24('0x3b')]);var _0x451eca={'where':_0x5cffe2['where']};return db[_0x7c24('0x27')][_0x7c24('0x1a')](_0x451eca)[_0x7c24('0x20')](function(_0x2dea2d){_0x520f41['count']=_0x2dea2d;if(_0x15115b[_0x7c24('0x2c')][_0x7c24('0x3c')]){_0x5cffe2['include']=[{'all':!![]}];}return db['VtigerField'][_0x7c24('0x3d')](_0x5cffe2);})[_0x7c24('0x20')](function(_0x2cf40c){_0x520f41[_0x7c24('0x3e')]=_0x2cf40c;return _0x520f41;})['then'](respondWithFilteredResult(_0x44cb60,_0x5cffe2))[_0x7c24('0x3f')](handleError(_0x44cb60,null));};exports[_0x7c24('0x40')]=function(_0x133fc0,_0x2704ca){var _0xd1173f={'raw':!![],'where':{'id':_0x133fc0[_0x7c24('0x41')]['id']}},_0x1e8748={};_0x1e8748[_0x7c24('0x2a')]=_[_0x7c24('0x2b')](db[_0x7c24('0x27')][_0x7c24('0x42')]);_0x1e8748[_0x7c24('0x2c')]=_[_0x7c24('0x2b')](_0x133fc0[_0x7c24('0x2c')]);_0x1e8748['filters']=_['intersection'](_0x1e8748[_0x7c24('0x2a')],_0x1e8748[_0x7c24('0x2c')]);_0xd1173f[_0x7c24('0x2e')]=_[_0x7c24('0x2f')](_0x1e8748[_0x7c24('0x2a')],qs[_0x7c24('0x30')](_0x133fc0[_0x7c24('0x2c')][_0x7c24('0x30')]));_0xd1173f['attributes']=_0xd1173f['attributes']['length']?_0xd1173f['attributes']:_0x1e8748['model'];if(_0x133fc0['query'][_0x7c24('0x3c')]){_0xd1173f['include']=[{'all':!![]}];}_0xd1173f=_[_0x7c24('0x3a')]({},_0xd1173f,_0x133fc0[_0x7c24('0x3b')]);return db[_0x7c24('0x27')][_0x7c24('0x43')](_0xd1173f)[_0x7c24('0x20')](handleEntityNotFound(_0x2704ca,null))[_0x7c24('0x20')](respondWithResult(_0x2704ca,null))[_0x7c24('0x3f')](handleError(_0x2704ca,null));};exports[_0x7c24('0x44')]=function(_0x11cbe5,_0x1fa759){return db[_0x7c24('0x27')][_0x7c24('0x44')](_0x11cbe5['body'],{})[_0x7c24('0x20')](respondWithResult(_0x1fa759,0xc9))['catch'](handleError(_0x1fa759,null));};exports[_0x7c24('0x45')]=function(_0x33619f,_0x16265d){if(_0x33619f[_0x7c24('0x46')]['id']){delete _0x33619f[_0x7c24('0x46')]['id'];}return db[_0x7c24('0x27')]['find']({'where':{'id':_0x33619f[_0x7c24('0x41')]['id']}})[_0x7c24('0x20')](handleEntityNotFound(_0x16265d,null))[_0x7c24('0x20')](saveUpdates(_0x33619f[_0x7c24('0x46')],null))['then'](respondWithResult(_0x16265d,null))[_0x7c24('0x3f')](handleError(_0x16265d,null));};exports[_0x7c24('0x21')]=function(_0x4020c1,_0x36c86b){return db[_0x7c24('0x27')][_0x7c24('0x43')]({'where':{'id':_0x4020c1['params']['id']}})[_0x7c24('0x20')](handleEntityNotFound(_0x36c86b,null))[_0x7c24('0x20')](removeEntity(_0x36c86b,null))[_0x7c24('0x3f')](handleError(_0x36c86b,null));}; \ No newline at end of file +var _0x8130=['order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','includeAll','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x2b20da,_0x337a7f){var _0x1450c8=function(_0x3417f1){while(--_0x3417f1){_0x2b20da['push'](_0x2b20da['shift']());}};_0x1450c8(++_0x337a7f);}(_0x8130,0xf7));var _0x0813=function(_0x1c1a47,_0x5a2db9){_0x1c1a47=_0x1c1a47-0x0;var _0x12fdcb=_0x8130[_0x1c1a47];return _0x12fdcb;};'use strict';var emlformat=require(_0x0813('0x0'));var rimraf=require(_0x0813('0x1'));var zipdir=require(_0x0813('0x2'));var jsonpatch=require(_0x0813('0x3'));var rp=require(_0x0813('0x4'));var moment=require(_0x0813('0x5'));var BPromise=require(_0x0813('0x6'));var Mustache=require(_0x0813('0x7'));var util=require(_0x0813('0x8'));var path=require(_0x0813('0x9'));var sox=require(_0x0813('0xa'));var csv=require(_0x0813('0xb'));var ejs=require(_0x0813('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0813('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0813('0xe'));var deskjs=require(_0x0813('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0813('0x10'));var Papa=require(_0x0813('0x11'));var Redis=require(_0x0813('0x12'));var authService=require(_0x0813('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0813('0x14'));var hardwareService=require(_0x0813('0x15'));var logger=require(_0x0813('0x16'))(_0x0813('0x17'));var utils=require('../../config/utils');var config=require(_0x0813('0x18'));var licenseUtil=require(_0x0813('0x19'));var db=require(_0x0813('0x1a'))['db'];function respondWithStatusCode(_0x2015a4,_0x59cf7f){_0x59cf7f=_0x59cf7f||0xcc;return function(_0x2a8b94){if(_0x2a8b94){return _0x2015a4[_0x0813('0x1b')](_0x59cf7f);}return _0x2015a4[_0x0813('0x1c')](_0x59cf7f)[_0x0813('0x1d')]();};}function respondWithResult(_0x4a02ab,_0x50d992){_0x50d992=_0x50d992||0xc8;return function(_0x29f488){if(_0x29f488){return _0x4a02ab[_0x0813('0x1c')](_0x50d992)[_0x0813('0x1e')](_0x29f488);}};}function respondWithFilteredResult(_0x57b739,_0x51c6d4){return function(_0x237d98){if(_0x237d98){var _0x16fc25=typeof _0x51c6d4[_0x0813('0x1f')]===_0x0813('0x20')&&typeof _0x51c6d4[_0x0813('0x21')]===_0x0813('0x20');var _0xa80c08=_0x237d98[_0x0813('0x22')];var _0x55bad4=_0x16fc25?0x0:_0x51c6d4['offset'];var _0x2fab15=_0x16fc25?_0x237d98[_0x0813('0x22')]:_0x51c6d4[_0x0813('0x1f')]+_0x51c6d4[_0x0813('0x21')];var _0x17b449;if(_0x2fab15>=_0xa80c08){_0x2fab15=_0xa80c08;_0x17b449=0xc8;}else{_0x17b449=0xce;}_0x57b739[_0x0813('0x1c')](_0x17b449);return _0x57b739[_0x0813('0x23')](_0x0813('0x24'),_0x55bad4+'-'+_0x2fab15+'/'+_0xa80c08)['json'](_0x237d98);}return null;};}function patchUpdates(_0x342d70){return function(_0x620caf){try{jsonpatch[_0x0813('0x25')](_0x620caf,_0x342d70,!![]);}catch(_0x54cb5a){return BPromise[_0x0813('0x26')](_0x54cb5a);}return _0x620caf['save']();};}function saveUpdates(_0x130588,_0x6dcee7){return function(_0x3286f4){if(_0x3286f4){return _0x3286f4[_0x0813('0x27')](_0x130588)[_0x0813('0x28')](function(_0x406b89){return _0x406b89;});}return null;};}function removeEntity(_0x523b7e,_0x3dbbe2){return function(_0x3453a8){if(_0x3453a8){return _0x3453a8[_0x0813('0x29')]()[_0x0813('0x28')](function(){_0x523b7e[_0x0813('0x1c')](0xcc)[_0x0813('0x1d')]();});}};}function handleEntityNotFound(_0x3a07d9,_0x55814e){return function(_0x3e9132){if(!_0x3e9132){_0x3a07d9[_0x0813('0x1b')](0x194);}return _0x3e9132;};}function handleError(_0x32c700,_0x232fdf){_0x232fdf=_0x232fdf||0x1f4;return function(_0x543c0b){logger[_0x0813('0x2a')](_0x543c0b[_0x0813('0x2b')]);if(_0x543c0b[_0x0813('0x2c')]){delete _0x543c0b['name'];}_0x32c700[_0x0813('0x1c')](_0x232fdf)['send'](_0x543c0b);};}exports[_0x0813('0x2d')]=function(_0x45fede,_0x15491b){var _0x4f49f1={},_0x5acefd={},_0x123f03={'count':0x0,'rows':[]};var _0x1d1b26=_[_0x0813('0x2e')](db[_0x0813('0x2f')][_0x0813('0x30')],function(_0x48a10a){return{'name':_0x48a10a[_0x0813('0x31')],'type':_0x48a10a[_0x0813('0x32')][_0x0813('0x33')]};});_0x5acefd[_0x0813('0x34')]=_[_0x0813('0x2e')](_0x1d1b26,_0x0813('0x2c'));_0x5acefd[_0x0813('0x35')]=_[_0x0813('0x36')](_0x45fede[_0x0813('0x35')]);_0x5acefd[_0x0813('0x37')]=_[_0x0813('0x38')](_0x5acefd[_0x0813('0x34')],_0x5acefd[_0x0813('0x35')]);_0x4f49f1[_0x0813('0x39')]=_[_0x0813('0x38')](_0x5acefd[_0x0813('0x34')],qs[_0x0813('0x3a')](_0x45fede[_0x0813('0x35')][_0x0813('0x3a')]));_0x4f49f1[_0x0813('0x39')]=_0x4f49f1[_0x0813('0x39')][_0x0813('0x3b')]?_0x4f49f1[_0x0813('0x39')]:_0x5acefd[_0x0813('0x34')];if(!_0x45fede[_0x0813('0x35')]['hasOwnProperty'](_0x0813('0x3c'))){_0x4f49f1[_0x0813('0x21')]=qs[_0x0813('0x21')](_0x45fede['query'][_0x0813('0x21')]);_0x4f49f1[_0x0813('0x1f')]=qs['offset'](_0x45fede[_0x0813('0x35')][_0x0813('0x1f')]);}_0x4f49f1[_0x0813('0x3d')]=qs[_0x0813('0x3e')](_0x45fede[_0x0813('0x35')]['sort']);_0x4f49f1['where']=qs[_0x0813('0x37')](_['pick'](_0x45fede[_0x0813('0x35')],_0x5acefd[_0x0813('0x37')]),_0x1d1b26);if(_0x45fede['query']['filter']){_0x4f49f1[_0x0813('0x3f')]=_[_0x0813('0x40')](_0x4f49f1[_0x0813('0x3f')],{'$or':_['map'](_0x1d1b26,function(_0x1d2bdc){if(_0x1d2bdc[_0x0813('0x32')]!==_0x0813('0x41')){var _0x164879={};_0x164879[_0x1d2bdc[_0x0813('0x2c')]]={'$like':'%'+_0x45fede[_0x0813('0x35')][_0x0813('0x42')]+'%'};return _0x164879;}})});}_0x4f49f1=_[_0x0813('0x40')]({},_0x4f49f1,_0x45fede[_0x0813('0x43')]);var _0x3b0b09={'where':_0x4f49f1['where']};return db['VtigerField']['count'](_0x3b0b09)[_0x0813('0x28')](function(_0xa30b19){_0x123f03[_0x0813('0x22')]=_0xa30b19;if(_0x45fede['query']['includeAll']){_0x4f49f1[_0x0813('0x44')]=[{'all':!![]}];}return db[_0x0813('0x2f')][_0x0813('0x45')](_0x4f49f1);})[_0x0813('0x28')](function(_0x2ab9ee){_0x123f03['rows']=_0x2ab9ee;return _0x123f03;})[_0x0813('0x28')](respondWithFilteredResult(_0x15491b,_0x4f49f1))[_0x0813('0x46')](handleError(_0x15491b,null));};exports[_0x0813('0x47')]=function(_0x32f609,_0x4992d5){var _0x55a9a7={'raw':!![],'where':{'id':_0x32f609['params']['id']}},_0x352aa6={};_0x352aa6[_0x0813('0x34')]=_[_0x0813('0x36')](db[_0x0813('0x2f')][_0x0813('0x30')]);_0x352aa6[_0x0813('0x35')]=_[_0x0813('0x36')](_0x32f609[_0x0813('0x35')]);_0x352aa6[_0x0813('0x37')]=_[_0x0813('0x38')](_0x352aa6[_0x0813('0x34')],_0x352aa6[_0x0813('0x35')]);_0x55a9a7[_0x0813('0x39')]=_[_0x0813('0x38')](_0x352aa6[_0x0813('0x34')],qs[_0x0813('0x3a')](_0x32f609[_0x0813('0x35')][_0x0813('0x3a')]));_0x55a9a7[_0x0813('0x39')]=_0x55a9a7[_0x0813('0x39')]['length']?_0x55a9a7[_0x0813('0x39')]:_0x352aa6[_0x0813('0x34')];if(_0x32f609[_0x0813('0x35')][_0x0813('0x48')]){_0x55a9a7['include']=[{'all':!![]}];}_0x55a9a7=_[_0x0813('0x40')]({},_0x55a9a7,_0x32f609[_0x0813('0x43')]);return db['VtigerField']['find'](_0x55a9a7)[_0x0813('0x28')](handleEntityNotFound(_0x4992d5,null))[_0x0813('0x28')](respondWithResult(_0x4992d5,null))[_0x0813('0x46')](handleError(_0x4992d5,null));};exports[_0x0813('0x49')]=function(_0x485c16,_0xea33eb){return db[_0x0813('0x2f')][_0x0813('0x49')](_0x485c16[_0x0813('0x4a')],{})[_0x0813('0x28')](respondWithResult(_0xea33eb,0xc9))['catch'](handleError(_0xea33eb,null));};exports[_0x0813('0x27')]=function(_0xcef8f4,_0x2d983e){if(_0xcef8f4[_0x0813('0x4a')]['id']){delete _0xcef8f4['body']['id'];}return db[_0x0813('0x2f')][_0x0813('0x4b')]({'where':{'id':_0xcef8f4[_0x0813('0x4c')]['id']}})[_0x0813('0x28')](handleEntityNotFound(_0x2d983e,null))[_0x0813('0x28')](saveUpdates(_0xcef8f4[_0x0813('0x4a')],null))[_0x0813('0x28')](respondWithResult(_0x2d983e,null))[_0x0813('0x46')](handleError(_0x2d983e,null));};exports[_0x0813('0x29')]=function(_0xa833a1,_0x355f8e){return db[_0x0813('0x2f')]['find']({'where':{'id':_0xa833a1[_0x0813('0x4c')]['id']}})[_0x0813('0x28')](handleEntityNotFound(_0x355f8e,null))[_0x0813('0x28')](removeEntity(_0x355f8e,null))['catch'](handleError(_0x355f8e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 71e2acd..886c99b 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 _0xc0af=['int_vtiger_fields','idField','lodash','../../config/logger','moment','bluebird','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x1d7b38,_0x508206){var _0x2a6290=function(_0x54ed99){while(--_0x54ed99){_0x1d7b38['push'](_0x1d7b38['shift']());}};_0x2a6290(++_0x508206);}(_0xc0af,0x1ce));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfc0a('0x0'));var util=require('util');var logger=require(_0xfc0a('0x1'))('api');var moment=require(_0xfc0a('0x2'));var BPromise=require(_0xfc0a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfc0a('0x4'));var attributes=require(_0xfc0a('0x5'));module[_0xfc0a('0x6')]=function(_0x5f587f,_0x55b6c8){return _0x5f587f['define'](_0xfc0a('0x7'),attributes,{'tableName':_0xfc0a('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xfc0a('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c1a=['api','moment','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x26390f,_0x5e1005){var _0x3d9d11=function(_0x3402e0){while(--_0x3402e0){_0x26390f['push'](_0x26390f['shift']());}};_0x3d9d11(++_0x5e1005);}(_0x2c1a,0x65));var _0xa2c1=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0x2c1a[_0x4d3a9b];return _0x1b5471;};'use strict';var _=require(_0xa2c1('0x0'));var util=require(_0xa2c1('0x1'));var logger=require(_0xa2c1('0x2'))(_0xa2c1('0x3'));var moment=require(_0xa2c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2c1('0x5'));var rimraf=require(_0xa2c1('0x6'));var config=require(_0xa2c1('0x7'));var attributes=require(_0xa2c1('0x8'));module['exports']=function(_0x408a2a,_0x2beb6e){return _0x408a2a['define'](_0xa2c1('0x9'),attributes,{'tableName':_0xa2c1('0xa'),'paranoid':![],'indexes':[{'name':_0xa2c1('0xb'),'fields':['idField',_0xa2c1('0xc')],'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 b74d6d6..1af2b4b 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 _0x0157=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xc5911,_0x5109a4){var _0x24ac73=function(_0x3b540c){while(--_0x3b540c){_0xc5911['push'](_0xc5911['shift']());}};_0x24ac73(++_0x5109a4);}(_0x0157,0x1b8));var _0x7015=function(_0x1eb24f,_0x5229b6){_0x1eb24f=_0x1eb24f-0x0;var _0x23594a=_0x0157[_0x1eb24f];return _0x23594a;};'use strict';var _=require(_0x7015('0x0'));var util=require(_0x7015('0x1'));var moment=require(_0x7015('0x2'));var BPromise=require(_0x7015('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7015('0x4'))['db'];var utils=require(_0x7015('0x5'));var logger=require(_0x7015('0x6'))(_0x7015('0x7'));var config=require(_0x7015('0x8'));var jayson=require(_0x7015('0x9'));var client=jayson[_0x7015('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0fd7,_0x3577f7,_0x370d1c){return new BPromise(function(_0x5a3c69,_0x5d75d3){return client[_0x7015('0xb')](_0x4f0fd7,_0x370d1c)[_0x7015('0xc')](function(_0x566505){logger[_0x7015('0xd')](_0x7015('0xe'),_0x3577f7,_0x7015('0xf'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x3577f7,_0x7015('0xf'),JSON[_0x7015('0x10')](_0x566505));if(_0x566505[_0x7015('0x11')]){if(_0x566505['error'][_0x7015('0x12')]===0x1f4){logger[_0x7015('0x11')](_0x7015('0xe'),_0x3577f7,_0x566505[_0x7015('0x11')]['message']);return _0x5d75d3(_0x566505[_0x7015('0x11')][_0x7015('0x13')]);}logger[_0x7015('0x11')]('VtigerField,\x20%s,\x20%s',_0x3577f7,_0x566505[_0x7015('0x11')]['message']);return _0x5a3c69(_0x566505['error'][_0x7015('0x13')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3577f7,'request\x20sent');_0x5a3c69(_0x566505[_0x7015('0x14')][_0x7015('0x13')]);}})[_0x7015('0x15')](function(_0x3ed850){logger['error'](_0x7015('0xe'),_0x3577f7,_0x3ed850);_0x5d75d3(_0x3ed850);});});} \ No newline at end of file +var _0xbc5b=['code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d3706,_0x43e0d7){var _0x8cffac=function(_0x14b461){while(--_0x14b461){_0x1d3706['push'](_0x1d3706['shift']());}};_0x8cffac(++_0x43e0d7);}(_0xbc5b,0x1d1));var _0xbbc5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbc5b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbbc5('0x0'));var util=require('util');var moment=require(_0xbbc5('0x1'));var BPromise=require(_0xbbc5('0x2'));var rs=require(_0xbbc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbc5('0x4'))['db'];var utils=require(_0xbbc5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbbc5('0x6'));var jayson=require(_0xbbc5('0x7'));var client=jayson[_0xbbc5('0x8')][_0xbbc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x106d74,_0x427ee5,_0x236974){return new BPromise(function(_0x2c65a3,_0x5907f8){return client[_0xbbc5('0xa')](_0x106d74,_0x236974)['then'](function(_0xd31e61){logger[_0xbbc5('0xb')]('VtigerField,\x20%s,\x20%s',_0x427ee5,_0xbbc5('0xc'));logger['debug'](_0xbbc5('0xd'),_0x427ee5,'request\x20sent',JSON['stringify'](_0xd31e61));if(_0xd31e61[_0xbbc5('0xe')]){if(_0xd31e61[_0xbbc5('0xe')][_0xbbc5('0xf')]===0x1f4){logger[_0xbbc5('0xe')](_0xbbc5('0x10'),_0x427ee5,_0xd31e61[_0xbbc5('0xe')][_0xbbc5('0x11')]);return _0x5907f8(_0xd31e61[_0xbbc5('0xe')][_0xbbc5('0x11')]);}logger[_0xbbc5('0xe')]('VtigerField,\x20%s,\x20%s',_0x427ee5,_0xd31e61[_0xbbc5('0xe')][_0xbbc5('0x11')]);return _0x2c65a3(_0xd31e61[_0xbbc5('0xe')][_0xbbc5('0x11')]);}else{logger[_0xbbc5('0xb')](_0xbbc5('0x10'),_0x427ee5,_0xbbc5('0xc'));_0x2c65a3(_0xd31e61[_0xbbc5('0x12')][_0xbbc5('0x11')]);}})[_0xbbc5('0x13')](function(_0x1ecbca){logger[_0xbbc5('0xe')]('VtigerField,\x20%s,\x20%s',_0x427ee5,_0x1ecbca);_0x5907f8(_0x1ecbca);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8d21a03..0d9382c 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 _0xda37=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1dfebf,_0x546f10){var _0x2cbe7b=function(_0xb6218d){while(--_0xb6218d){_0x1dfebf['push'](_0x1dfebf['shift']());}};_0x2cbe7b(++_0x546f10);}(_0xda37,0x1d6));var _0x7da3=function(_0x107e0f,_0x4d9510){_0x107e0f=_0x107e0f-0x0;var _0x541777=_0xda37[_0x107e0f];return _0x541777;};'use strict';var multer=require(_0x7da3('0x0'));var util=require(_0x7da3('0x1'));var path=require(_0x7da3('0x2'));var timeout=require(_0x7da3('0x3'));var express=require(_0x7da3('0x4'));var router=express[_0x7da3('0x5')]();var fs_extra=require(_0x7da3('0x6'));var auth=require(_0x7da3('0x7'));var interaction=require(_0x7da3('0x8'));var config=require('../../config/environment');var controller=require(_0x7da3('0x9'));router[_0x7da3('0xa')]('/',auth[_0x7da3('0xb')](),controller[_0x7da3('0xc')]);router['get'](_0x7da3('0xd'),auth['isAuthenticated'](),controller[_0x7da3('0xe')]);router[_0x7da3('0xa')](_0x7da3('0xf'),auth[_0x7da3('0xb')](),controller[_0x7da3('0x10')]);router[_0x7da3('0xa')](_0x7da3('0x11'),auth[_0x7da3('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7da3('0x12')]('/:id/configurations',auth[_0x7da3('0xb')](),controller[_0x7da3('0x13')]);router[_0x7da3('0x14')](_0x7da3('0xd'),auth[_0x7da3('0xb')](),controller[_0x7da3('0x15')]);router[_0x7da3('0x16')]('/:id',auth[_0x7da3('0xb')](),controller[_0x7da3('0x17')]);module[_0x7da3('0x18')]=router; \ No newline at end of file +var _0x03ab=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy'];(function(_0x1f169d,_0x1b918e){var _0x30fefe=function(_0x1a8e62){while(--_0x1a8e62){_0x1f169d['push'](_0x1f169d['shift']());}};_0x30fefe(++_0x1b918e);}(_0x03ab,0x1e5));var _0xb03a=function(_0x5a54e,_0x44d18f){_0x5a54e=_0x5a54e-0x0;var _0x3c809d=_0x03ab[_0x5a54e];return _0x3c809d;};'use strict';var multer=require('multer');var util=require(_0xb03a('0x0'));var path=require(_0xb03a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb03a('0x2'));var router=express[_0xb03a('0x3')]();var fs_extra=require(_0xb03a('0x4'));var auth=require(_0xb03a('0x5'));var interaction=require(_0xb03a('0x6'));var config=require(_0xb03a('0x7'));var controller=require(_0xb03a('0x8'));router[_0xb03a('0x9')]('/',auth[_0xb03a('0xa')](),controller['index']);router['get'](_0xb03a('0xb'),auth[_0xb03a('0xa')](),controller['show']);router[_0xb03a('0x9')](_0xb03a('0xc'),auth[_0xb03a('0xa')](),controller[_0xb03a('0xd')]);router['get'](_0xb03a('0xe'),auth['isAuthenticated'](),controller[_0xb03a('0xf')]);router[_0xb03a('0x10')]('/',auth['isAuthenticated'](),controller[_0xb03a('0x11')]);router[_0xb03a('0x10')]('/:id/configurations',auth[_0xb03a('0xa')](),controller['addConfiguration']);router[_0xb03a('0x12')](_0xb03a('0xb'),auth[_0xb03a('0xa')](),controller['update']);router[_0xb03a('0x13')](_0xb03a('0xb'),auth[_0xb03a('0xa')](),controller[_0xb03a('0x14')]);module[_0xb03a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1bd8566..4d3e931 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 _0x3a6d=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x3f9828,_0xf07728){var _0xf5e8a3=function(_0x45f2f7){while(--_0x45f2f7){_0x3f9828['push'](_0x3f9828['shift']());}};_0xf5e8a3(++_0xf07728);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'password':{'type':Sequelize[_0xd3a6('0x2')]},'token':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd3a6('0x4')},'authType':{'type':Sequelize[_0xd3a6('0x5')](_0xd3a6('0x6'),_0xd3a6('0x7')),'defaultValue':_0xd3a6('0x6')},'serverUrl':{'type':Sequelize[_0xd3a6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd3a6('0x8'),_0xd3a6('0x9')),'defaultValue':_0xd3a6('0x8')}}; \ No newline at end of file +var _0xdeb3=['newTab','exports','STRING','remoteUri','ENUM','token','integrationTab'];(function(_0x1f102d,_0x38971d){var _0x38c292=function(_0x59c555){while(--_0x59c555){_0x1f102d['push'](_0x1f102d['shift']());}};_0x38c292(++_0x38971d);}(_0xdeb3,0xb7));var _0x3deb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdeb3[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x3deb('0x0')]={'name':{'type':Sequelize[_0x3deb('0x1')]},'description':{'type':Sequelize[_0x3deb('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x3deb('0x1')]},'token':{'type':Sequelize[_0x3deb('0x1')]},'remoteUri':{'type':Sequelize[_0x3deb('0x1')],'unique':_0x3deb('0x2')},'authType':{'type':Sequelize[_0x3deb('0x3')]('password',_0x3deb('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3deb('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3deb('0x5'),_0x3deb('0x6')),'defaultValue':_0x3deb('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c6db292..099ce91 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 _0x878f=['username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','group','assignee','includes','position','title','system_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','name','send','index','ZendeskAccount','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','catch','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x878f,0x173));var _0xf878=function(_0x582270,_0x113b42){_0x582270=_0x582270-0x0;var _0x42d4cf=_0x878f[_0x582270];return _0x42d4cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];var integrations=require(_0xf878('0x15'));function respondWithStatusCode(_0x596fb5,_0x1ce004){_0x1ce004=_0x1ce004||0xcc;return function(_0x38eddf){if(_0x38eddf){return _0x596fb5[_0xf878('0x16')](_0x1ce004);}return _0x596fb5['status'](_0x1ce004)[_0xf878('0x17')]();};}function respondWithResult(_0x3902f7,_0x119e9e){_0x119e9e=_0x119e9e||0xc8;return function(_0x492260){if(_0x492260){return _0x3902f7['status'](_0x119e9e)[_0xf878('0x18')](_0x492260);}};}function respondWithFilteredResult(_0x35ff2d,_0x31d888){return function(_0x6dbeca){if(_0x6dbeca){var _0x44aacc=typeof _0x31d888[_0xf878('0x19')]===_0xf878('0x1a')&&typeof _0x31d888[_0xf878('0x1b')]===_0xf878('0x1a');var _0x3a55f3=_0x6dbeca[_0xf878('0x1c')];var _0x47a91a=_0x44aacc?0x0:_0x31d888[_0xf878('0x19')];var _0x34ae59=_0x44aacc?_0x6dbeca[_0xf878('0x1c')]:_0x31d888[_0xf878('0x19')]+_0x31d888[_0xf878('0x1b')];var _0x237d15;if(_0x34ae59>=_0x3a55f3){_0x34ae59=_0x3a55f3;_0x237d15=0xc8;}else{_0x237d15=0xce;}_0x35ff2d[_0xf878('0x1d')](_0x237d15);return _0x35ff2d['set'](_0xf878('0x1e'),_0x47a91a+'-'+_0x34ae59+'/'+_0x3a55f3)[_0xf878('0x18')](_0x6dbeca);}return null;};}function patchUpdates(_0x250f85){return function(_0x59efcb){try{jsonpatch[_0xf878('0x1f')](_0x59efcb,_0x250f85,!![]);}catch(_0x23590c){return BPromise[_0xf878('0x20')](_0x23590c);}return _0x59efcb[_0xf878('0x21')]();};}function saveUpdates(_0x22d884,_0x442450){return function(_0x1cbc92){if(_0x1cbc92){return _0x1cbc92[_0xf878('0x22')](_0x22d884)[_0xf878('0x23')](function(_0x1a6506){return _0x1a6506;});}return null;};}function removeEntity(_0x45e61f,_0x566995){return function(_0x2ac38b){if(_0x2ac38b){return _0x2ac38b['destroy']()[_0xf878('0x23')](function(){_0x45e61f[_0xf878('0x1d')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x280036,_0x20449e){return function(_0x5ebaa0){if(!_0x5ebaa0){_0x280036['sendStatus'](0x194);}return _0x5ebaa0;};}function handleError(_0x59ba7b,_0x242926){_0x242926=_0x242926||0x1f4;return function(_0x3baba4){logger[_0xf878('0x24')](_0x3baba4['stack']);if(_0x3baba4[_0xf878('0x25')]){delete _0x3baba4[_0xf878('0x25')];}_0x59ba7b[_0xf878('0x1d')](_0x242926)[_0xf878('0x26')](_0x3baba4);};}exports[_0xf878('0x27')]=function(_0x5aff46,_0x502322){var _0x9a127d={},_0x5d9c97={},_0x4a0286={'count':0x0,'rows':[]};var _0x31e2e1=_['map'](db[_0xf878('0x28')]['rawAttributes'],function(_0x2c61c1){return{'name':_0x2c61c1['fieldName'],'type':_0x2c61c1[_0xf878('0x29')]['key']};});_0x5d9c97[_0xf878('0x2a')]=_[_0xf878('0x2b')](_0x31e2e1,_0xf878('0x25'));_0x5d9c97[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x5aff46[_0xf878('0x2c')]);_0x5d9c97['filters']=_[_0xf878('0x2e')](_0x5d9c97[_0xf878('0x2a')],_0x5d9c97[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2f')]=_[_0xf878('0x2e')](_0x5d9c97['model'],qs[_0xf878('0x30')](_0x5aff46[_0xf878('0x2c')]['fields']));_0x9a127d[_0xf878('0x2f')]=_0x9a127d[_0xf878('0x2f')][_0xf878('0x31')]?_0x9a127d[_0xf878('0x2f')]:_0x5d9c97[_0xf878('0x2a')];if(!_0x5aff46['query'][_0xf878('0x32')](_0xf878('0x33'))){_0x9a127d[_0xf878('0x1b')]=qs[_0xf878('0x1b')](_0x5aff46['query'][_0xf878('0x1b')]);_0x9a127d['offset']=qs['offset'](_0x5aff46[_0xf878('0x2c')][_0xf878('0x19')]);}_0x9a127d[_0xf878('0x34')]=qs[_0xf878('0x35')](_0x5aff46[_0xf878('0x2c')]['sort']);_0x9a127d[_0xf878('0x36')]=qs['filters'](_[_0xf878('0x37')](_0x5aff46[_0xf878('0x2c')],_0x5d9c97['filters']),_0x31e2e1);if(_0x5aff46[_0xf878('0x2c')][_0xf878('0x38')]){_0x9a127d['where']=_[_0xf878('0x39')](_0x9a127d[_0xf878('0x36')],{'$or':_['map'](_0x31e2e1,function(_0x4129c2){if(_0x4129c2[_0xf878('0x29')]!==_0xf878('0x3a')){var _0xc8eb91={};_0xc8eb91[_0x4129c2[_0xf878('0x25')]]={'$like':'%'+_0x5aff46[_0xf878('0x2c')][_0xf878('0x38')]+'%'};return _0xc8eb91;}})});}_0x9a127d=_['merge']({},_0x9a127d,_0x5aff46[_0xf878('0x3b')]);var _0x14340d={'where':_0x9a127d['where']};return db[_0xf878('0x28')]['count'](_0x14340d)['then'](function(_0x2ec109){_0x4a0286[_0xf878('0x1c')]=_0x2ec109;if(_0x5aff46[_0xf878('0x2c')][_0xf878('0x3c')]){_0x9a127d[_0xf878('0x3d')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xf878('0x3e')](_0x9a127d);})['then'](function(_0xb09736){_0x4a0286[_0xf878('0x3f')]=_0xb09736;return _0x4a0286;})['then'](respondWithFilteredResult(_0x502322,_0x9a127d))['catch'](handleError(_0x502322,null));};exports[_0xf878('0x40')]=function(_0x2a66c1,_0x13fcd3){var _0x2f6ee5={'raw':![],'where':{'id':_0x2a66c1[_0xf878('0x41')]['id']}},_0x5d6e03={};_0x5d6e03[_0xf878('0x2a')]=_[_0xf878('0x2d')](db[_0xf878('0x28')]['rawAttributes']);_0x5d6e03[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x2a66c1[_0xf878('0x2c')]);_0x5d6e03[_0xf878('0x42')]=_[_0xf878('0x2e')](_0x5d6e03[_0xf878('0x2a')],_0x5d6e03['query']);_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2e')](_0x5d6e03[_0xf878('0x2a')],qs[_0xf878('0x30')](_0x2a66c1[_0xf878('0x2c')]['fields']));_0x2f6ee5[_0xf878('0x2f')]=_0x2f6ee5[_0xf878('0x2f')][_0xf878('0x31')]?_0x2f6ee5[_0xf878('0x2f')]:_0x5d6e03['model'];if(_0x2a66c1[_0xf878('0x2c')][_0xf878('0x3c')]){_0x2f6ee5[_0xf878('0x3d')]=[{'all':!![]}];}_0x2f6ee5=_['merge']({},_0x2f6ee5,_0x2a66c1['options']);return db[_0xf878('0x28')]['find'](_0x2f6ee5)['then'](handleEntityNotFound(_0x13fcd3,null))['then'](respondWithResult(_0x13fcd3,null))[_0xf878('0x43')](handleError(_0x13fcd3,null));};exports['create']=function(_0x156fdb,_0x450a10){return db[_0xf878('0x28')][_0xf878('0x44')](_0x156fdb[_0xf878('0x45')],{})[_0xf878('0x23')](respondWithResult(_0x450a10,0xc9))[_0xf878('0x43')](handleError(_0x450a10,null));};exports['update']=function(_0xb0bf4c,_0x361ac8){if(_0xb0bf4c[_0xf878('0x45')]['id']){delete _0xb0bf4c[_0xf878('0x45')]['id'];}return db[_0xf878('0x28')]['find']({'where':{'id':_0xb0bf4c['params']['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x361ac8,null))[_0xf878('0x23')](saveUpdates(_0xb0bf4c['body'],null))[_0xf878('0x23')](respondWithResult(_0x361ac8,null))['catch'](handleError(_0x361ac8,null));};exports[_0xf878('0x46')]=function(_0x31adde,_0x379912){return db[_0xf878('0x28')]['find']({'where':{'id':_0x31adde[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x379912,null))[_0xf878('0x23')](removeEntity(_0x379912,null))['catch'](handleError(_0x379912,null));};exports[_0xf878('0x47')]=function(_0x30df05,_0x1d3427,_0x28c393){var _0x53e3c3={};var _0x112f2a={};var _0x181f09;var _0x3f9fce;return db['ZendeskAccount'][_0xf878('0x48')]({'where':{'id':_0x30df05[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x1d3427,null))[_0xf878('0x23')](function(_0x5118f4){if(_0x5118f4){_0x181f09=_0x5118f4;_0x112f2a['model']=_['keys'](db[_0xf878('0x49')]['rawAttributes']);_0x112f2a['query']=_['keys'](_0x30df05[_0xf878('0x2c')]);_0x112f2a[_0xf878('0x42')]=_['intersection'](_0x112f2a[_0xf878('0x2a')],_0x112f2a[_0xf878('0x2c')]);_0x53e3c3[_0xf878('0x2f')]=_['intersection'](_0x112f2a['model'],qs[_0xf878('0x30')](_0x30df05['query'][_0xf878('0x30')]));_0x53e3c3[_0xf878('0x2f')]=_0x53e3c3[_0xf878('0x2f')][_0xf878('0x31')]?_0x53e3c3[_0xf878('0x2f')]:_0x112f2a[_0xf878('0x2a')];_0x53e3c3['order']=qs[_0xf878('0x35')](_0x30df05[_0xf878('0x2c')]['sort']);_0x53e3c3[_0xf878('0x36')]=qs[_0xf878('0x42')](_[_0xf878('0x37')](_0x30df05[_0xf878('0x2c')],_0x112f2a[_0xf878('0x42')]));if(_0x30df05[_0xf878('0x2c')][_0xf878('0x38')]){_0x53e3c3['where']=_[_0xf878('0x39')](_0x53e3c3[_0xf878('0x36')],{'$or':_[_0xf878('0x2b')](_0x53e3c3['attributes'],function(_0x392242){var _0x560e0b={};_0x560e0b[_0x392242]={'$like':'%'+_0x30df05[_0xf878('0x2c')][_0xf878('0x38')]+'%'};return _0x560e0b;})});}_0x53e3c3=_[_0xf878('0x39')]({},_0x53e3c3,_0x30df05[_0xf878('0x3b')]);return _0x181f09[_0xf878('0x47')](_0x53e3c3);}})[_0xf878('0x23')](function(_0x1141dd){if(_0x1141dd){_0x3f9fce=_0x1141dd[_0xf878('0x31')];if(!_0x30df05[_0xf878('0x2c')][_0xf878('0x32')]('nolimit')){_0x53e3c3['limit']=qs['limit'](_0x30df05[_0xf878('0x2c')]['limit']);_0x53e3c3[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x30df05['query']['offset']);}return _0x181f09[_0xf878('0x47')](_0x53e3c3);}})[_0xf878('0x23')](function(_0x3340c1){if(_0x3340c1){return _0x3340c1?{'count':_0x3f9fce,'rows':_0x3340c1}:null;}})[_0xf878('0x23')](respondWithResult(_0x1d3427,null))[_0xf878('0x43')](handleError(_0x1d3427,null));};exports[_0xf878('0x4a')]=function(_0x3e78fc,_0x302258,_0x1602ed){if(_0x3e78fc[_0xf878('0x45')]['id']){delete _0x3e78fc[_0xf878('0x45')]['id'];}return db[_0xf878('0x28')][_0xf878('0x48')]({'where':{'id':_0x3e78fc[_0xf878('0x41')]['id']}})[_0xf878('0x23')](handleEntityNotFound(_0x302258,null))[_0xf878('0x23')](function(_0x1254dd){if(_0x1254dd){_0x3e78fc[_0xf878('0x45')]['AccountId']=_0x1254dd['id'];_0x3e78fc[_0xf878('0x45')]['Subjects']=integrations[_0xf878('0x4b')](_0x3e78fc[_0xf878('0x45')][_0xf878('0x4c')],_0x3e78fc[_0xf878('0x45')][_0xf878('0x29')]);_0x3e78fc[_0xf878('0x45')][_0xf878('0x4d')]=integrations[_0xf878('0x4e')](_0x3e78fc[_0xf878('0x45')]['channel'],_0x3e78fc[_0xf878('0x45')][_0xf878('0x29')]);return db[_0xf878('0x49')][_0xf878('0x44')](_0x3e78fc['body'],{'include':[{'model':db[_0xf878('0x4f')],'as':_0xf878('0x50')},{'model':db[_0xf878('0x4f')],'as':_0xf878('0x4d')}]});}return null;})[_0xf878('0x23')](respondWithResult(_0x302258,null))['catch'](handleError(_0x302258,null));};exports['getFields']=function(_0x453644,_0x1b0230,_0x193f6c){var _0x251613='';return db[_0xf878('0x28')][_0xf878('0x48')]({'where':{'id':_0x453644[_0xf878('0x41')]['id']},'attributes':['id',_0xf878('0x51'),_0xf878('0x52'),_0xf878('0x53'),_0xf878('0x54'),_0xf878('0x55')]})[_0xf878('0x23')](handleEntityNotFound(_0x1b0230,null))[_0xf878('0x23')](function(_0x3bfd00){if(_0x3bfd00){_0x251613=_0x3bfd00[_0xf878('0x55')];var _0x153069=_0x251613['slice'](-0x1);if(_0x153069==='/'){_0x251613=_0x251613[_0xf878('0x56')](0x0,_0x251613[_0xf878('0x57')](_0x153069));}var _0x288235={'method':_0xf878('0x58'),'uri':util[_0xf878('0x59')](_0xf878('0x5a'),_0x251613,_0xf878('0x5b')),'json':!![]};switch(_0x3bfd00[_0xf878('0x54')]){case _0xf878('0x52'):_0x288235['headers']={'Authorization':util[_0xf878('0x59')](_0xf878('0x5c'),new Buffer(util[_0xf878('0x59')](_0xf878('0x5d'),_0x3bfd00[_0xf878('0x51')],_0x3bfd00[_0xf878('0x52')]))[_0xf878('0x5e')]('base64'))};break;case'token':_0x288235[_0xf878('0x5f')]={'Authorization':util['format'](_0xf878('0x5c'),new Buffer(util[_0xf878('0x59')](_0xf878('0x60'),_0x3bfd00[_0xf878('0x51')],_0x3bfd00['token']))[_0xf878('0x5e')](_0xf878('0x61')))};break;default:throw new db[(_0xf878('0x62'))][(_0xf878('0x63'))]('Unknown\x20authentication\x20type');}return rp(_0x288235);}})[_0xf878('0x23')](function(_0x565e8c){if(_0x565e8c){var _0x21537f=[_0xf878('0x64'),_0xf878('0x65'),_0xf878('0x66'),_0xf878('0x67')];_['remove'](_0x565e8c[_0xf878('0x5b')],function(_0x21c5d1){return _0x21537f[_0xf878('0x68')](_0x21c5d1[_0xf878('0x29')]);});return{'count':_0x565e8c['ticket_fields'][_0xf878('0x31')],'rows':_['map'](_0x565e8c[_0xf878('0x5b')],function(_0x107456){return{'id':_0x107456['id'],'name':_0x107456[_0xf878('0x69')]>0x7?_0x107456[_0xf878('0x6a')]:_0x107456[_0xf878('0x29')],'custom':_0x107456[_0xf878('0x69')]>0x7?!![]:![],'options':_0x107456[_0xf878('0x6b')]?_0x107456[_0xf878('0x6b')]:_0x107456['custom_field_options']?_0x107456['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x1b0230,null))[_0xf878('0x43')](function(_0x1a9af7){var _0x497b7a=_0x453644['query'][_0xf878('0x6c')]?0x1f4:_0x1a9af7['statusCode']||0x1f4;logger[_0xf878('0x24')](_0xf878('0x6d'),_0xf878('0x6e'),_0x497b7a,JSON[_0xf878('0x6f')](_0x1a9af7));delete _0x1a9af7[_0xf878('0x25')];if(_0x497b7a===0x191){_0x497b7a=0x190;}_0x1b0230[_0xf878('0x1d')](_0x497b7a)[_0xf878('0x26')](_0x453644[_0xf878('0x2c')][_0xf878('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x1a9af7[_0xf878('0x70')]}:_0x1a9af7);});}; \ No newline at end of file +var _0xd914=['channel','ZendeskField','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','group','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','pick','map','options','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd914,0x17f));var _0x4d91=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xd914[_0x45161c];return _0x186581;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];var integrations=require(_0x4d91('0x1b'));function respondWithStatusCode(_0x318e0c,_0x4ea591){_0x4ea591=_0x4ea591||0xcc;return function(_0x577a69){if(_0x577a69){return _0x318e0c[_0x4d91('0x1c')](_0x4ea591);}return _0x318e0c[_0x4d91('0x1d')](_0x4ea591)[_0x4d91('0x1e')]();};}function respondWithResult(_0x3c9fd6,_0x33fbd4){_0x33fbd4=_0x33fbd4||0xc8;return function(_0x25bafc){if(_0x25bafc){return _0x3c9fd6[_0x4d91('0x1d')](_0x33fbd4)['json'](_0x25bafc);}};}function respondWithFilteredResult(_0x3a8ec9,_0x42631a){return function(_0x1e2ef7){if(_0x1e2ef7){var _0xb92681=typeof _0x42631a[_0x4d91('0x1f')]==='undefined'&&typeof _0x42631a[_0x4d91('0x20')]===_0x4d91('0x21');var _0x241564=_0x1e2ef7[_0x4d91('0x22')];var _0x4cfa40=_0xb92681?0x0:_0x42631a[_0x4d91('0x1f')];var _0x3b579b=_0xb92681?_0x1e2ef7[_0x4d91('0x22')]:_0x42631a['offset']+_0x42631a[_0x4d91('0x20')];var _0x127911;if(_0x3b579b>=_0x241564){_0x3b579b=_0x241564;_0x127911=0xc8;}else{_0x127911=0xce;}_0x3a8ec9[_0x4d91('0x1d')](_0x127911);return _0x3a8ec9[_0x4d91('0x23')](_0x4d91('0x24'),_0x4cfa40+'-'+_0x3b579b+'/'+_0x241564)[_0x4d91('0x25')](_0x1e2ef7);}return null;};}function patchUpdates(_0xc1d44f){return function(_0x193ca9){try{jsonpatch[_0x4d91('0x26')](_0x193ca9,_0xc1d44f,!![]);}catch(_0x226d85){return BPromise['reject'](_0x226d85);}return _0x193ca9[_0x4d91('0x27')]();};}function saveUpdates(_0x5f5236,_0x57913e){return function(_0x74a697){if(_0x74a697){return _0x74a697[_0x4d91('0x28')](_0x5f5236)[_0x4d91('0x29')](function(_0x9cb864){return _0x9cb864;});}return null;};}function removeEntity(_0x7d8cbf,_0x12b722){return function(_0x100cd4){if(_0x100cd4){return _0x100cd4[_0x4d91('0x2a')]()['then'](function(){_0x7d8cbf['status'](0xcc)[_0x4d91('0x1e')]();});}};}function handleEntityNotFound(_0x112923,_0x3bed98){return function(_0x45fc91){if(!_0x45fc91){_0x112923[_0x4d91('0x1c')](0x194);}return _0x45fc91;};}function handleError(_0x2c7d7a,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x560966){logger[_0x4d91('0x2b')](_0x560966[_0x4d91('0x2c')]);if(_0x560966[_0x4d91('0x2d')]){delete _0x560966['name'];}_0x2c7d7a['status'](_0x14bdb4)[_0x4d91('0x2e')](_0x560966);};}exports[_0x4d91('0x2f')]=function(_0x5ed948,_0x50fe76){var _0x42d5a0={},_0x2d6981={},_0x43371e={'count':0x0,'rows':[]};var _0x17c7bc=_['map'](db[_0x4d91('0x30')][_0x4d91('0x31')],function(_0x468e95){return{'name':_0x468e95[_0x4d91('0x32')],'type':_0x468e95[_0x4d91('0x33')][_0x4d91('0x34')]};});_0x2d6981[_0x4d91('0x35')]=_['map'](_0x17c7bc,_0x4d91('0x2d'));_0x2d6981['query']=_['keys'](_0x5ed948[_0x4d91('0x36')]);_0x2d6981[_0x4d91('0x37')]=_['intersection'](_0x2d6981[_0x4d91('0x35')],_0x2d6981[_0x4d91('0x36')]);_0x42d5a0[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x2d6981[_0x4d91('0x35')],qs['fields'](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x42d5a0[_0x4d91('0x38')]=_0x42d5a0[_0x4d91('0x38')][_0x4d91('0x3b')]?_0x42d5a0[_0x4d91('0x38')]:_0x2d6981['model'];if(!_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3c')]('nolimit')){_0x42d5a0[_0x4d91('0x20')]=qs[_0x4d91('0x20')](_0x5ed948[_0x4d91('0x36')]['limit']);_0x42d5a0[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x1f')]);}_0x42d5a0['order']=qs[_0x4d91('0x3d')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x42d5a0[_0x4d91('0x3e')]=qs['filters'](_['pick'](_0x5ed948[_0x4d91('0x36')],_0x2d6981[_0x4d91('0x37')]),_0x17c7bc);if(_0x5ed948['query'][_0x4d91('0x3f')]){_0x42d5a0[_0x4d91('0x3e')]=_[_0x4d91('0x40')](_0x42d5a0[_0x4d91('0x3e')],{'$or':_['map'](_0x17c7bc,function(_0x2eb7c7){if(_0x2eb7c7[_0x4d91('0x33')]!=='VIRTUAL'){var _0x1ba6cd={};_0x1ba6cd[_0x2eb7c7['name']]={'$like':'%'+_0x5ed948[_0x4d91('0x36')]['filter']+'%'};return _0x1ba6cd;}})});}_0x42d5a0=_[_0x4d91('0x40')]({},_0x42d5a0,_0x5ed948['options']);var _0x24fc69={'where':_0x42d5a0[_0x4d91('0x3e')]};return db[_0x4d91('0x30')][_0x4d91('0x22')](_0x24fc69)['then'](function(_0x5bcc9b){_0x43371e[_0x4d91('0x22')]=_0x5bcc9b;if(_0x5ed948['query'][_0x4d91('0x41')]){_0x42d5a0[_0x4d91('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4d91('0x43')](_0x42d5a0);})[_0x4d91('0x29')](function(_0x14db37){_0x43371e[_0x4d91('0x44')]=_0x14db37;return _0x43371e;})[_0x4d91('0x29')](respondWithFilteredResult(_0x50fe76,_0x42d5a0))[_0x4d91('0x45')](handleError(_0x50fe76,null));};exports[_0x4d91('0x46')]=function(_0x4f6254,_0x1e4c6d){var _0x4c70af={'raw':![],'where':{'id':_0x4f6254[_0x4d91('0x47')]['id']}},_0x41c06a={};_0x41c06a[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x30')][_0x4d91('0x31')]);_0x41c06a['query']=_['keys'](_0x4f6254[_0x4d91('0x36')]);_0x41c06a[_0x4d91('0x37')]=_['intersection'](_0x41c06a[_0x4d91('0x35')],_0x41c06a[_0x4d91('0x36')]);_0x4c70af[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x41c06a[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x4f6254[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x4c70af[_0x4d91('0x38')]=_0x4c70af['attributes']['length']?_0x4c70af[_0x4d91('0x38')]:_0x41c06a['model'];if(_0x4f6254[_0x4d91('0x36')][_0x4d91('0x41')]){_0x4c70af[_0x4d91('0x42')]=[{'all':!![]}];}_0x4c70af=_[_0x4d91('0x40')]({},_0x4c70af,_0x4f6254['options']);return db[_0x4d91('0x30')]['find'](_0x4c70af)['then'](handleEntityNotFound(_0x1e4c6d,null))[_0x4d91('0x29')](respondWithResult(_0x1e4c6d,null))[_0x4d91('0x45')](handleError(_0x1e4c6d,null));};exports[_0x4d91('0x49')]=function(_0xa03d75,_0x1f91ec){return db[_0x4d91('0x30')]['create'](_0xa03d75[_0x4d91('0x4a')],{})[_0x4d91('0x29')](respondWithResult(_0x1f91ec,0xc9))[_0x4d91('0x45')](handleError(_0x1f91ec,null));};exports[_0x4d91('0x28')]=function(_0x106e5b,_0x44e9ec){if(_0x106e5b[_0x4d91('0x4a')]['id']){delete _0x106e5b[_0x4d91('0x4a')]['id'];}return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x106e5b[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e9ec,null))[_0x4d91('0x29')](saveUpdates(_0x106e5b['body'],null))[_0x4d91('0x29')](respondWithResult(_0x44e9ec,null))[_0x4d91('0x45')](handleError(_0x44e9ec,null));};exports[_0x4d91('0x2a')]=function(_0x386935,_0x436a3d){return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x386935[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x436a3d,null))[_0x4d91('0x29')](removeEntity(_0x436a3d,null))[_0x4d91('0x45')](handleError(_0x436a3d,null));};exports[_0x4d91('0x4c')]=function(_0x2bba43,_0x26ecd7,_0x19e57e){var _0x5765ce={};var _0x4aae23={};var _0x392cc3;var _0x2159e4;return db[_0x4d91('0x30')][_0x4d91('0x4d')]({'where':{'id':_0x2bba43[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x29')](function(_0x4138c5){if(_0x4138c5){_0x392cc3=_0x4138c5;_0x4aae23[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x4e')][_0x4d91('0x31')]);_0x4aae23[_0x4d91('0x36')]=_[_0x4d91('0x48')](_0x2bba43[_0x4d91('0x36')]);_0x4aae23[_0x4d91('0x37')]=_[_0x4d91('0x39')](_0x4aae23['model'],_0x4aae23['query']);_0x5765ce['attributes']=_[_0x4d91('0x39')](_0x4aae23[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x2bba43['query'][_0x4d91('0x3a')]));_0x5765ce[_0x4d91('0x38')]=_0x5765ce[_0x4d91('0x38')]['length']?_0x5765ce['attributes']:_0x4aae23['model'];_0x5765ce[_0x4d91('0x4f')]=qs[_0x4d91('0x3d')](_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x5765ce[_0x4d91('0x3e')]=qs['filters'](_[_0x4d91('0x50')](_0x2bba43[_0x4d91('0x36')],_0x4aae23['filters']));if(_0x2bba43['query'][_0x4d91('0x3f')]){_0x5765ce['where']=_[_0x4d91('0x40')](_0x5765ce[_0x4d91('0x3e')],{'$or':_[_0x4d91('0x51')](_0x5765ce['attributes'],function(_0x2e0bff){var _0x3d6c26={};_0x3d6c26[_0x2e0bff]={'$like':'%'+_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3f')]+'%'};return _0x3d6c26;})});}_0x5765ce=_[_0x4d91('0x40')]({},_0x5765ce,_0x2bba43[_0x4d91('0x52')]);return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})['then'](function(_0x533572){if(_0x533572){_0x2159e4=_0x533572['length'];if(!_0x2bba43['query'][_0x4d91('0x3c')](_0x4d91('0x53'))){_0x5765ce[_0x4d91('0x20')]=qs['limit'](_0x2bba43[_0x4d91('0x36')]['limit']);_0x5765ce[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x2bba43['query']['offset']);}return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})[_0x4d91('0x29')](function(_0x31150f){if(_0x31150f){return _0x31150f?{'count':_0x2159e4,'rows':_0x31150f}:null;}})[_0x4d91('0x29')](respondWithResult(_0x26ecd7,null))[_0x4d91('0x45')](handleError(_0x26ecd7,null));};exports[_0x4d91('0x54')]=function(_0x7a94e2,_0x42e550,_0xd384a9){if(_0x7a94e2[_0x4d91('0x4a')]['id']){delete _0x7a94e2['body']['id'];}return db['ZendeskAccount'][_0x4d91('0x4d')]({'where':{'id':_0x7a94e2[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x42e550,null))[_0x4d91('0x29')](function(_0x16ba26){if(_0x16ba26){_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x55')]=_0x16ba26['id'];_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x56')]=integrations['getSubjects'](_0x7a94e2['body']['channel'],_0x7a94e2['body'][_0x4d91('0x33')]);_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x57')]=integrations[_0x4d91('0x58')](_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x59')],_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x33')]);return db[_0x4d91('0x4e')][_0x4d91('0x49')](_0x7a94e2[_0x4d91('0x4a')],{'include':[{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x56')},{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x57')}]});}return null;})[_0x4d91('0x29')](respondWithResult(_0x42e550,null))[_0x4d91('0x45')](handleError(_0x42e550,null));};exports['getFields']=function(_0x4062c6,_0x1be4b1,_0xc4ef10){var _0x2e2105='';return db[_0x4d91('0x30')]['findOne']({'where':{'id':_0x4062c6[_0x4d91('0x47')]['id']},'attributes':['id',_0x4d91('0x5b'),'password',_0x4d91('0x5c'),_0x4d91('0x5d'),_0x4d91('0x5e')]})[_0x4d91('0x29')](handleEntityNotFound(_0x1be4b1,null))[_0x4d91('0x29')](function(_0x4bc5a0){if(_0x4bc5a0){_0x2e2105=_0x4bc5a0[_0x4d91('0x5e')];var _0x2a5bc0=_0x2e2105['slice'](-0x1);if(_0x2a5bc0==='/'){_0x2e2105=_0x2e2105[_0x4d91('0x5f')](0x0,_0x2e2105[_0x4d91('0x60')](_0x2a5bc0));}var _0xd94b29={'method':'GET','uri':util[_0x4d91('0x61')](_0x4d91('0x62'),_0x2e2105,_0x4d91('0x63')),'json':!![]};switch(_0x4bc5a0[_0x4d91('0x5d')]){case _0x4d91('0x64'):_0xd94b29[_0x4d91('0x65')]={'Authorization':util[_0x4d91('0x61')]('Basic\x20%s',new Buffer(util[_0x4d91('0x61')](_0x4d91('0x66'),_0x4bc5a0['username'],_0x4bc5a0[_0x4d91('0x64')]))['toString']('base64'))};break;case _0x4d91('0x5c'):_0xd94b29['headers']={'Authorization':util[_0x4d91('0x61')](_0x4d91('0x67'),new Buffer(util[_0x4d91('0x61')](_0x4d91('0x68'),_0x4bc5a0[_0x4d91('0x5b')],_0x4bc5a0[_0x4d91('0x5c')]))[_0x4d91('0x69')]('base64'))};break;default:throw new db['Sequelize'][(_0x4d91('0x6a'))](_0x4d91('0x6b'));}return rp(_0xd94b29);}})[_0x4d91('0x29')](function(_0x42164f){if(_0x42164f){var _0x1e3838=['subject','description',_0x4d91('0x6c'),'assignee'];_['remove'](_0x42164f[_0x4d91('0x63')],function(_0x54fea8){return _0x1e3838['includes'](_0x54fea8[_0x4d91('0x33')]);});return{'count':_0x42164f[_0x4d91('0x63')][_0x4d91('0x3b')],'rows':_['map'](_0x42164f['ticket_fields'],function(_0x52604d){return{'id':_0x52604d['id'],'name':_0x52604d[_0x4d91('0x6d')]>0x7?_0x52604d[_0x4d91('0x6e')]:_0x52604d[_0x4d91('0x33')],'custom':_0x52604d[_0x4d91('0x6d')]>0x7?!![]:![],'options':_0x52604d[_0x4d91('0x6f')]?_0x52604d[_0x4d91('0x6f')]:_0x52604d[_0x4d91('0x70')]?_0x52604d[_0x4d91('0x70')]:[]};})};}})[_0x4d91('0x29')](respondWithResult(_0x1be4b1,null))['catch'](function(_0xb9d1ff){var _0x579a9e=_0x4062c6['query'][_0x4d91('0x71')]?0x1f4:_0xb9d1ff[_0x4d91('0x72')]||0x1f4;logger[_0x4d91('0x2b')](_0x4d91('0x73'),'getFields',_0x579a9e,JSON[_0x4d91('0x74')](_0xb9d1ff));delete _0xb9d1ff[_0x4d91('0x2d')];if(_0x579a9e===0x191){_0x579a9e=0x190;}_0x1be4b1[_0x4d91('0x1d')](_0x579a9e)[_0x4d91('0x2e')](_0x4062c6[_0x4d91('0x36')][_0x4d91('0x71')]?{'message':_0x4d91('0x75'),'statusCode':_0xb9d1ff['statusCode']}:_0xb9d1ff);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 264a5da..3d95b68 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 _0x0333=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','api','bluebird','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0333,0x13b));var _0x3033=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x0333[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x3033('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3033('0x1'));var moment=require('moment');var BPromise=require(_0x3033('0x2'));var rp=require(_0x3033('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3033('0x4'));var config=require(_0x3033('0x5'));var attributes=require(_0x3033('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3033('0x7')]=function(_0x386387,_0x3ca5ab){return _0x386387[_0x3033('0x8')](_0x3033('0x9'),attributes,{'tableName':_0x3033('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd8c=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5e586f,_0x4d823e){var _0x430f35=function(_0xa2db18){while(--_0xa2db18){_0x5e586f['push'](_0x5e586f['shift']());}};_0x430f35(++_0x4d823e);}(_0xbd8c,0x1a7));var _0xcbd8=function(_0x57c276,_0x120d7e){_0x57c276=_0x57c276-0x0;var _0x3d13fe=_0xbd8c[_0x57c276];return _0x3d13fe;};'use strict';var _=require(_0xcbd8('0x0'));var util=require(_0xcbd8('0x1'));var logger=require(_0xcbd8('0x2'))(_0xcbd8('0x3'));var moment=require(_0xcbd8('0x4'));var BPromise=require(_0xcbd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbd8('0x6'));var rimraf=require(_0xcbd8('0x7'));var config=require(_0xcbd8('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x110b76,_0x14e66f){return _0x110b76[_0xcbd8('0x9')](_0xcbd8('0xa'),attributes,{'tableName':_0xcbd8('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 411a16f..6ceda2a 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 _0x8f18=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowZendeskAccount','find','catch','lodash','util','moment','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8f18,0x1ea));var _0x88f1=function(_0x4e2443,_0x21d9ad){_0x4e2443=_0x4e2443-0x0;var _0x6a0117=_0x8f18[_0x4e2443];return _0x6a0117;};'use strict';var _=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var rs=require(_0x88f1('0x4'));var fs=require('fs');var Redis=require(_0x88f1('0x5'));var db=require(_0x88f1('0x6'))['db'];var utils=require(_0x88f1('0x7'));var logger=require(_0x88f1('0x8'))(_0x88f1('0x9'));var config=require('../../config/environment');var jayson=require(_0x88f1('0xa'));var client=jayson['client'][_0x88f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4321c5,_0x1ed67f,_0x4ef18f){return new BPromise(function(_0x36a144,_0x56d312){return client[_0x88f1('0xc')](_0x4321c5,_0x4ef18f)[_0x88f1('0xd')](function(_0x2c25bd){logger[_0x88f1('0xe')](_0x88f1('0xf'),_0x1ed67f,_0x88f1('0x10'));logger[_0x88f1('0x11')](_0x88f1('0x12'),_0x1ed67f,'request\x20sent',JSON['stringify'](_0x2c25bd));if(_0x2c25bd[_0x88f1('0x13')]){if(_0x2c25bd[_0x88f1('0x13')][_0x88f1('0x14')]===0x1f4){logger[_0x88f1('0x13')](_0x88f1('0xf'),_0x1ed67f,_0x2c25bd[_0x88f1('0x13')][_0x88f1('0x15')]);return _0x56d312(_0x2c25bd[_0x88f1('0x13')][_0x88f1('0x15')]);}logger['error'](_0x88f1('0xf'),_0x1ed67f,_0x2c25bd[_0x88f1('0x13')][_0x88f1('0x15')]);return _0x36a144(_0x2c25bd[_0x88f1('0x13')][_0x88f1('0x15')]);}else{logger[_0x88f1('0xe')](_0x88f1('0xf'),_0x1ed67f,_0x88f1('0x10'));_0x36a144(_0x2c25bd[_0x88f1('0x16')]['message']);}})['catch'](function(_0x5c7b18){logger[_0x88f1('0x13')](_0x88f1('0xf'),_0x1ed67f,_0x5c7b18);_0x56d312(_0x5c7b18);});});}exports[_0x88f1('0x17')]=function(_0x41975a){var _0x46a65e=this;return new Promise(function(_0x4ac312,_0x1d407c){return db[_0x88f1('0x18')][_0x88f1('0x19')]({'raw':_0x41975a['options']?_0x41975a[_0x88f1('0x1a')][_0x88f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x41975a[_0x88f1('0x1a')]?_0x41975a['options'][_0x88f1('0x1c')]||null:null,'attributes':_0x41975a[_0x88f1('0x1a')]?_0x41975a[_0x88f1('0x1a')]['attributes']||null:null,'limit':_0x41975a[_0x88f1('0x1a')]?_0x41975a['options'][_0x88f1('0x1d')]||null:null,'include':_0x41975a['options']?_0x41975a[_0x88f1('0x1a')][_0x88f1('0x1e')]?_[_0x88f1('0x1f')](_0x41975a[_0x88f1('0x1a')][_0x88f1('0x1e')],function(_0x53bd9f){return{'model':db[_0x53bd9f[_0x88f1('0x20')]],'as':_0x53bd9f['as'],'attributes':_0x53bd9f['attributes'],'include':_0x53bd9f[_0x88f1('0x1e')]?_[_0x88f1('0x1f')](_0x53bd9f[_0x88f1('0x1e')],function(_0x33dac4){return{'model':db[_0x33dac4['model']],'as':_0x33dac4['as'],'attributes':_0x33dac4[_0x88f1('0x21')],'include':_0x33dac4[_0x88f1('0x1e')]?_['map'](_0x33dac4[_0x88f1('0x1e')],function(_0x17f6d3){return{'model':db[_0x17f6d3[_0x88f1('0x20')]],'as':_0x17f6d3['as'],'attributes':_0x17f6d3[_0x88f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x88f1('0xd')](function(_0x563219){logger[_0x88f1('0xe')](_0x88f1('0x17'),_0x41975a);logger[_0x88f1('0x11')](_0x88f1('0x17'),_0x41975a,JSON[_0x88f1('0x22')](_0x563219));_0x4ac312(_0x563219);})['catch'](function(_0x2b3674){logger[_0x88f1('0x13')](_0x88f1('0x17'),_0x2b3674['message'],_0x41975a);_0x1d407c(_0x46a65e[_0x88f1('0x13')](0x1f4,_0x2b3674[_0x88f1('0x15')]));});});};exports[_0x88f1('0x23')]=function(_0x3e8f3c){var _0x7b4426=this;return new Promise(function(_0x3b156c,_0x39392d){return db['ZendeskAccount'][_0x88f1('0x24')]({'raw':_0x3e8f3c['options']?_0x3e8f3c['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e8f3c[_0x88f1('0x1a')]?_0x3e8f3c['options'][_0x88f1('0x1c')]||null:null,'attributes':_0x3e8f3c[_0x88f1('0x1a')]?_0x3e8f3c[_0x88f1('0x1a')][_0x88f1('0x21')]||null:null,'include':_0x3e8f3c[_0x88f1('0x1a')]?_0x3e8f3c[_0x88f1('0x1a')][_0x88f1('0x1e')]?_[_0x88f1('0x1f')](_0x3e8f3c['options'][_0x88f1('0x1e')],function(_0x3da97a){return{'model':db[_0x3da97a['model']],'as':_0x3da97a['as'],'attributes':_0x3da97a['attributes'],'include':_0x3da97a[_0x88f1('0x1e')]?_['map'](_0x3da97a['include'],function(_0x2f8129){return{'model':db[_0x2f8129['model']],'as':_0x2f8129['as'],'attributes':_0x2f8129[_0x88f1('0x21')],'include':_0x2f8129[_0x88f1('0x1e')]?_[_0x88f1('0x1f')](_0x2f8129[_0x88f1('0x1e')],function(_0x5d3e0e){return{'model':db[_0x5d3e0e[_0x88f1('0x20')]],'as':_0x5d3e0e['as'],'attributes':_0x5d3e0e[_0x88f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x88f1('0xd')](function(_0x25028b){logger[_0x88f1('0xe')](_0x88f1('0x23'),_0x3e8f3c);logger['debug'](_0x88f1('0x23'),_0x3e8f3c,JSON['stringify'](_0x25028b));_0x3b156c(_0x25028b);})[_0x88f1('0x25')](function(_0x987201){logger['error'](_0x88f1('0x23'),_0x987201['message'],_0x3e8f3c);_0x39392d(_0x7b4426[_0x88f1('0x13')](0x1f4,_0x987201[_0x88f1('0x15')]));});});}; \ No newline at end of file +var _0x64df=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','then','GetZendeskAccount','stringify','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2378c1,_0x45750a){var _0x57d92e=function(_0x18d392){while(--_0x18d392){_0x2378c1['push'](_0x2378c1['shift']());}};_0x57d92e(++_0x45750a);}(_0x64df,0x1f2));var _0xf64d=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x64df[_0x1443eb];return _0x2b8810;};'use strict';var _=require(_0xf64d('0x0'));var util=require('util');var moment=require(_0xf64d('0x1'));var BPromise=require(_0xf64d('0x2'));var rs=require(_0xf64d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf64d('0x4'))['db'];var utils=require(_0xf64d('0x5'));var logger=require(_0xf64d('0x6'))(_0xf64d('0x7'));var config=require(_0xf64d('0x8'));var jayson=require(_0xf64d('0x9'));var client=jayson[_0xf64d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20e998,_0x39e153,_0x410630){return new BPromise(function(_0x182990,_0x5e36ba){return client[_0xf64d('0xb')](_0x20e998,_0x410630)['then'](function(_0x47e2c1){logger[_0xf64d('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x39e153,'request\x20sent');logger[_0xf64d('0xd')](_0xf64d('0xe'),_0x39e153,'request\x20sent',JSON['stringify'](_0x47e2c1));if(_0x47e2c1[_0xf64d('0xf')]){if(_0x47e2c1[_0xf64d('0xf')][_0xf64d('0x10')]===0x1f4){logger[_0xf64d('0xf')](_0xf64d('0x11'),_0x39e153,_0x47e2c1['error'][_0xf64d('0x12')]);return _0x5e36ba(_0x47e2c1['error']['message']);}logger['error'](_0xf64d('0x11'),_0x39e153,_0x47e2c1[_0xf64d('0xf')][_0xf64d('0x12')]);return _0x182990(_0x47e2c1[_0xf64d('0xf')]['message']);}else{logger[_0xf64d('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x39e153,_0xf64d('0x13'));_0x182990(_0x47e2c1[_0xf64d('0x14')][_0xf64d('0x12')]);}})[_0xf64d('0x15')](function(_0x2f1e05){logger['error'](_0xf64d('0x11'),_0x39e153,_0x2f1e05);_0x5e36ba(_0x2f1e05);});});}exports['GetZendeskAccount']=function(_0x240d4f){var _0xd602c2=this;return new Promise(function(_0x41241b,_0x1dec1e){return db[_0xf64d('0x16')][_0xf64d('0x17')]({'raw':_0x240d4f[_0xf64d('0x18')]?_0x240d4f[_0xf64d('0x18')][_0xf64d('0x19')]===undefined?!![]:![]:!![],'where':_0x240d4f[_0xf64d('0x18')]?_0x240d4f[_0xf64d('0x18')][_0xf64d('0x1a')]||null:null,'attributes':_0x240d4f['options']?_0x240d4f[_0xf64d('0x18')][_0xf64d('0x1b')]||null:null,'limit':_0x240d4f['options']?_0x240d4f['options']['limit']||null:null,'include':_0x240d4f[_0xf64d('0x18')]?_0x240d4f[_0xf64d('0x18')][_0xf64d('0x1c')]?_['map'](_0x240d4f['options'][_0xf64d('0x1c')],function(_0x27959a){return{'model':db[_0x27959a['model']],'as':_0x27959a['as'],'attributes':_0x27959a[_0xf64d('0x1b')],'include':_0x27959a[_0xf64d('0x1c')]?_[_0xf64d('0x1d')](_0x27959a[_0xf64d('0x1c')],function(_0x48240b){return{'model':db[_0x48240b[_0xf64d('0x1e')]],'as':_0x48240b['as'],'attributes':_0x48240b['attributes'],'include':_0x48240b[_0xf64d('0x1c')]?_[_0xf64d('0x1d')](_0x48240b[_0xf64d('0x1c')],function(_0x3b8824){return{'model':db[_0x3b8824[_0xf64d('0x1e')]],'as':_0x3b8824['as'],'attributes':_0x3b8824[_0xf64d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf64d('0x1f')](function(_0x2ba265){logger[_0xf64d('0xc')](_0xf64d('0x20'),_0x240d4f);logger['debug']('GetZendeskAccount',_0x240d4f,JSON[_0xf64d('0x21')](_0x2ba265));_0x41241b(_0x2ba265);})[_0xf64d('0x15')](function(_0x2eca49){logger['error']('GetZendeskAccount',_0x2eca49[_0xf64d('0x12')],_0x240d4f);_0x1dec1e(_0xd602c2[_0xf64d('0xf')](0x1f4,_0x2eca49[_0xf64d('0x12')]));});});};exports[_0xf64d('0x22')]=function(_0x28ff85){var _0x448aa0=this;return new Promise(function(_0x40b40f,_0x16672d){return db[_0xf64d('0x16')][_0xf64d('0x23')]({'raw':_0x28ff85[_0xf64d('0x18')]?_0x28ff85[_0xf64d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x28ff85[_0xf64d('0x18')]?_0x28ff85[_0xf64d('0x18')]['where']||null:null,'attributes':_0x28ff85['options']?_0x28ff85[_0xf64d('0x18')][_0xf64d('0x1b')]||null:null,'include':_0x28ff85[_0xf64d('0x18')]?_0x28ff85[_0xf64d('0x18')][_0xf64d('0x1c')]?_['map'](_0x28ff85['options'][_0xf64d('0x1c')],function(_0x3d1d08){return{'model':db[_0x3d1d08[_0xf64d('0x1e')]],'as':_0x3d1d08['as'],'attributes':_0x3d1d08['attributes'],'include':_0x3d1d08['include']?_[_0xf64d('0x1d')](_0x3d1d08[_0xf64d('0x1c')],function(_0x9760b1){return{'model':db[_0x9760b1['model']],'as':_0x9760b1['as'],'attributes':_0x9760b1[_0xf64d('0x1b')],'include':_0x9760b1[_0xf64d('0x1c')]?_[_0xf64d('0x1d')](_0x9760b1[_0xf64d('0x1c')],function(_0x437b97){return{'model':db[_0x437b97[_0xf64d('0x1e')]],'as':_0x437b97['as'],'attributes':_0x437b97[_0xf64d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35d329){logger[_0xf64d('0xc')](_0xf64d('0x22'),_0x28ff85);logger[_0xf64d('0xd')](_0xf64d('0x22'),_0x28ff85,JSON[_0xf64d('0x21')](_0x35d329));_0x40b40f(_0x35d329);})[_0xf64d('0x15')](function(_0x3b5eec){logger[_0xf64d('0xf')]('ShowZendeskAccount',_0x3b5eec[_0xf64d('0x12')],_0x28ff85);_0x16672d(_0x448aa0['error'](0x1f4,_0x3b5eec[_0xf64d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 543423e..f89426a 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 _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a1291,_0x4db2d5){var _0x3875d8=function(_0x29eb70){while(--_0x29eb70){_0x5a1291['push'](_0x5a1291['shift']());}};_0x3875d8(++_0x4db2d5);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0xe5b5[_0x75ce5b];return _0x22195e;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=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(_0x48e519,_0x47e9b1){var _0x17af1e=function(_0x68d35c){while(--_0x68d35c){_0x48e519['push'](_0x48e519['shift']());}};_0x17af1e(++_0x47e9b1);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x5eb8[_0x3a6e4b];return _0x36572d;};'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 2699c8b..5a8581b 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 _0x3807=['exports'];(function(_0x1e099f,_0x470a08){var _0x2027a3=function(_0xea10c1){while(--_0xea10c1){_0x1e099f['push'](_0x1e099f['shift']());}};_0x2027a3(++_0x470a08);}(_0x3807,0xf3));var _0x7380=function(_0x2fcd1b,_0x272dea){_0x2fcd1b=_0x2fcd1b-0x0;var _0x4f1b58=_0x3807[_0x2fcd1b];return _0x4f1b58;};'use strict';var Sequelize=require('sequelize');module[_0x7380('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xefa3=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefa3,0x9e));var _0x3efa=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xefa3[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0x3efa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3efa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d5ae8ba..0fecd4f 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 _0xdf65=['stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','model','find','create','body','catch','getFields','findOne','rawAttributes','order','ZendeskField','options','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xdf65,0x1dd));var _0x5df6=function(_0x19d46f,_0xd7a100){_0x19d46f=_0x19d46f-0x0;var _0x1c0a06=_0xdf65[_0x19d46f];return _0x1c0a06;};'use strict';var emlformat=require(_0x5df6('0x0'));var rimraf=require(_0x5df6('0x1'));var zipdir=require(_0x5df6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5df6('0x3'));var moment=require('moment');var BPromise=require(_0x5df6('0x4'));var Mustache=require(_0x5df6('0x5'));var util=require(_0x5df6('0x6'));var path=require(_0x5df6('0x7'));var sox=require('sox');var csv=require(_0x5df6('0x8'));var ejs=require(_0x5df6('0x9'));var fs=require('fs');var fs_extra=require(_0x5df6('0xa'));var _=require(_0x5df6('0xb'));var squel=require(_0x5df6('0xc'));var crypto=require(_0x5df6('0xd'));var jsforce=require(_0x5df6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5df6('0xf'));var authService=require(_0x5df6('0x10'));var qs=require(_0x5df6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df6('0x12'));var logger=require(_0x5df6('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df6('0x14'));var licenseUtil=require(_0x5df6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185f5b,_0x452835){_0x452835=_0x452835||0xcc;return function(_0x358ccc){if(_0x358ccc){return _0x185f5b[_0x5df6('0x16')](_0x452835);}return _0x185f5b['status'](_0x452835)[_0x5df6('0x17')]();};}function respondWithResult(_0x52dc8b,_0x5b9db4){_0x5b9db4=_0x5b9db4||0xc8;return function(_0x2213d6){if(_0x2213d6){return _0x52dc8b[_0x5df6('0x18')](_0x5b9db4)[_0x5df6('0x19')](_0x2213d6);}};}function respondWithFilteredResult(_0x5ee4fa,_0x5e65b2){return function(_0x11d130){if(_0x11d130){var _0xd76c42=typeof _0x5e65b2[_0x5df6('0x1a')]===_0x5df6('0x1b')&&typeof _0x5e65b2['limit']==='undefined';var _0x3890b5=_0x11d130[_0x5df6('0x1c')];var _0x1aa84f=_0xd76c42?0x0:_0x5e65b2[_0x5df6('0x1a')];var _0x4299c1=_0xd76c42?_0x11d130[_0x5df6('0x1c')]:_0x5e65b2['offset']+_0x5e65b2[_0x5df6('0x1d')];var _0x281840;if(_0x4299c1>=_0x3890b5){_0x4299c1=_0x3890b5;_0x281840=0xc8;}else{_0x281840=0xce;}_0x5ee4fa[_0x5df6('0x18')](_0x281840);return _0x5ee4fa[_0x5df6('0x1e')](_0x5df6('0x1f'),_0x1aa84f+'-'+_0x4299c1+'/'+_0x3890b5)['json'](_0x11d130);}return null;};}function patchUpdates(_0x550f89){return function(_0x148db0){try{jsonpatch[_0x5df6('0x20')](_0x148db0,_0x550f89,!![]);}catch(_0x4e48fd){return BPromise[_0x5df6('0x21')](_0x4e48fd);}return _0x148db0[_0x5df6('0x22')]();};}function saveUpdates(_0x13cb0b,_0x1e6b2d){return function(_0x3f4f3d){if(_0x3f4f3d){return _0x3f4f3d[_0x5df6('0x23')](_0x13cb0b)[_0x5df6('0x24')](function(_0x42f70a){return _0x42f70a;});}return null;};}function removeEntity(_0x59c48b,_0x2d5608){return function(_0x1e6a07){if(_0x1e6a07){return _0x1e6a07[_0x5df6('0x25')]()[_0x5df6('0x24')](function(){_0x59c48b[_0x5df6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be447,_0x43ba06){return function(_0x2270c6){if(!_0x2270c6){_0x4be447[_0x5df6('0x16')](0x194);}return _0x2270c6;};}function handleError(_0x5acb1e,_0x159af3){_0x159af3=_0x159af3||0x1f4;return function(_0x15c334){logger[_0x5df6('0x26')](_0x15c334[_0x5df6('0x27')]);if(_0x15c334[_0x5df6('0x28')]){delete _0x15c334[_0x5df6('0x28')];}_0x5acb1e[_0x5df6('0x18')](_0x159af3)[_0x5df6('0x29')](_0x15c334);};}exports[_0x5df6('0x2a')]=function(_0xb32eba,_0x39cf09){var _0x282c6f={},_0x2f66ff={},_0x14e61d={'count':0x0,'rows':[]};var _0x1651e9=_[_0x5df6('0x2b')](db[_0x5df6('0x2c')]['rawAttributes'],function(_0x43d262){return{'name':_0x43d262[_0x5df6('0x2d')],'type':_0x43d262[_0x5df6('0x2e')][_0x5df6('0x2f')]};});_0x2f66ff['model']=_['map'](_0x1651e9,_0x5df6('0x28'));_0x2f66ff[_0x5df6('0x30')]=_[_0x5df6('0x31')](_0xb32eba[_0x5df6('0x30')]);_0x2f66ff['filters']=_[_0x5df6('0x32')](_0x2f66ff['model'],_0x2f66ff[_0x5df6('0x30')]);_0x282c6f[_0x5df6('0x33')]=_['intersection'](_0x2f66ff['model'],qs[_0x5df6('0x34')](_0xb32eba['query'][_0x5df6('0x34')]));_0x282c6f[_0x5df6('0x33')]=_0x282c6f[_0x5df6('0x33')][_0x5df6('0x35')]?_0x282c6f[_0x5df6('0x33')]:_0x2f66ff['model'];if(!_0xb32eba['query'][_0x5df6('0x36')](_0x5df6('0x37'))){_0x282c6f[_0x5df6('0x1d')]=qs[_0x5df6('0x1d')](_0xb32eba[_0x5df6('0x30')][_0x5df6('0x1d')]);_0x282c6f[_0x5df6('0x1a')]=qs[_0x5df6('0x1a')](_0xb32eba[_0x5df6('0x30')]['offset']);}_0x282c6f['order']=qs['sort'](_0xb32eba[_0x5df6('0x30')][_0x5df6('0x38')]);_0x282c6f[_0x5df6('0x39')]=qs[_0x5df6('0x3a')](_[_0x5df6('0x3b')](_0xb32eba[_0x5df6('0x30')],_0x2f66ff[_0x5df6('0x3a')]),_0x1651e9);if(_0xb32eba[_0x5df6('0x30')]['filter']){_0x282c6f[_0x5df6('0x39')]=_[_0x5df6('0x3c')](_0x282c6f[_0x5df6('0x39')],{'$or':_['map'](_0x1651e9,function(_0x316e9a){if(_0x316e9a[_0x5df6('0x2e')]!==_0x5df6('0x3d')){var _0x36d5fa={};_0x36d5fa[_0x316e9a['name']]={'$like':'%'+_0xb32eba[_0x5df6('0x30')][_0x5df6('0x3e')]+'%'};return _0x36d5fa;}})});}_0x282c6f=_[_0x5df6('0x3c')]({},_0x282c6f,_0xb32eba['options']);var _0x523c40={'where':_0x282c6f[_0x5df6('0x39')]};return db[_0x5df6('0x2c')]['count'](_0x523c40)[_0x5df6('0x24')](function(_0x4d13c8){_0x14e61d[_0x5df6('0x1c')]=_0x4d13c8;if(_0xb32eba[_0x5df6('0x30')][_0x5df6('0x3f')]){_0x282c6f[_0x5df6('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x5df6('0x41')](_0x282c6f);})[_0x5df6('0x24')](function(_0x5e9bc6){_0x14e61d[_0x5df6('0x42')]=_0x5e9bc6;return _0x14e61d;})[_0x5df6('0x24')](respondWithFilteredResult(_0x39cf09,_0x282c6f))['catch'](handleError(_0x39cf09,null));};exports[_0x5df6('0x43')]=function(_0x26ba0b,_0x2f42d7){var _0x2a3ef0={'raw':![],'where':{'id':_0x26ba0b[_0x5df6('0x44')]['id']}},_0x4959ca={};_0x4959ca['model']=_['keys'](db[_0x5df6('0x2c')]['rawAttributes']);_0x4959ca[_0x5df6('0x30')]=_[_0x5df6('0x31')](_0x26ba0b[_0x5df6('0x30')]);_0x4959ca[_0x5df6('0x3a')]=_[_0x5df6('0x32')](_0x4959ca['model'],_0x4959ca[_0x5df6('0x30')]);_0x2a3ef0[_0x5df6('0x33')]=_['intersection'](_0x4959ca[_0x5df6('0x45')],qs[_0x5df6('0x34')](_0x26ba0b[_0x5df6('0x30')][_0x5df6('0x34')]));_0x2a3ef0[_0x5df6('0x33')]=_0x2a3ef0[_0x5df6('0x33')][_0x5df6('0x35')]?_0x2a3ef0[_0x5df6('0x33')]:_0x4959ca[_0x5df6('0x45')];if(_0x26ba0b['query'][_0x5df6('0x3f')]){_0x2a3ef0[_0x5df6('0x40')]=[{'all':!![]}];}_0x2a3ef0=_[_0x5df6('0x3c')]({},_0x2a3ef0,_0x26ba0b['options']);return db[_0x5df6('0x2c')][_0x5df6('0x46')](_0x2a3ef0)[_0x5df6('0x24')](handleEntityNotFound(_0x2f42d7,null))[_0x5df6('0x24')](respondWithResult(_0x2f42d7,null))['catch'](handleError(_0x2f42d7,null));};exports[_0x5df6('0x47')]=function(_0x25db25,_0xcf320){return db[_0x5df6('0x2c')]['create'](_0x25db25[_0x5df6('0x48')],{})[_0x5df6('0x24')](respondWithResult(_0xcf320,0xc9))[_0x5df6('0x49')](handleError(_0xcf320,null));};exports['update']=function(_0x300021,_0x4753f9){if(_0x300021[_0x5df6('0x48')]['id']){delete _0x300021['body']['id'];}return db[_0x5df6('0x2c')]['find']({'where':{'id':_0x300021[_0x5df6('0x44')]['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x4753f9,null))[_0x5df6('0x24')](saveUpdates(_0x300021[_0x5df6('0x48')],null))[_0x5df6('0x24')](respondWithResult(_0x4753f9,null))[_0x5df6('0x49')](handleError(_0x4753f9,null));};exports[_0x5df6('0x25')]=function(_0x1233ea,_0x3d8278){return db['ZendeskConfiguration']['find']({'where':{'id':_0x1233ea[_0x5df6('0x44')]['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x3d8278,null))[_0x5df6('0x24')](removeEntity(_0x3d8278,null))['catch'](handleError(_0x3d8278,null));};exports[_0x5df6('0x4a')]=function(_0x59261c,_0x12f1c7,_0x5841e8){var _0x4aba6a={};var _0x431d93={};var _0x170183;var _0x30716c;return db[_0x5df6('0x2c')][_0x5df6('0x4b')]({'where':{'id':_0x59261c['params']['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x12f1c7,null))[_0x5df6('0x24')](function(_0x345a80){if(_0x345a80){_0x170183=_0x345a80;_0x431d93[_0x5df6('0x45')]=_[_0x5df6('0x31')](db['ZendeskField'][_0x5df6('0x4c')]);_0x431d93[_0x5df6('0x30')]=_[_0x5df6('0x31')](_0x59261c[_0x5df6('0x30')]);_0x431d93[_0x5df6('0x3a')]=_[_0x5df6('0x32')](_0x431d93[_0x5df6('0x45')],_0x431d93[_0x5df6('0x30')]);_0x4aba6a[_0x5df6('0x33')]=_[_0x5df6('0x32')](_0x431d93[_0x5df6('0x45')],qs[_0x5df6('0x34')](_0x59261c[_0x5df6('0x30')][_0x5df6('0x34')]));_0x4aba6a[_0x5df6('0x33')]=_0x4aba6a[_0x5df6('0x33')][_0x5df6('0x35')]?_0x4aba6a['attributes']:_0x431d93['model'];_0x4aba6a[_0x5df6('0x4d')]=qs[_0x5df6('0x38')](_0x59261c['query'][_0x5df6('0x38')]);_0x4aba6a[_0x5df6('0x39')]=qs[_0x5df6('0x3a')](_['pick'](_0x59261c[_0x5df6('0x30')],_0x431d93['filters']));if(_0x59261c[_0x5df6('0x30')][_0x5df6('0x3e')]){_0x4aba6a[_0x5df6('0x39')]=_[_0x5df6('0x3c')](_0x4aba6a[_0x5df6('0x39')],{'$or':_[_0x5df6('0x2b')](_0x4aba6a[_0x5df6('0x33')],function(_0x1ea5f1){var _0x329552={};_0x329552[_0x1ea5f1]={'$like':'%'+_0x59261c[_0x5df6('0x30')][_0x5df6('0x3e')]+'%'};return _0x329552;})});}_0x4aba6a=_[_0x5df6('0x3c')]({},_0x4aba6a,_0x59261c['options']);return _0x170183['getFields'](_0x4aba6a);}})[_0x5df6('0x24')](function(_0x41179e){if(_0x41179e){_0x30716c=_0x41179e[_0x5df6('0x35')];if(!_0x59261c[_0x5df6('0x30')][_0x5df6('0x36')]('nolimit')){_0x4aba6a['limit']=qs[_0x5df6('0x1d')](_0x59261c['query']['limit']);_0x4aba6a[_0x5df6('0x1a')]=qs['offset'](_0x59261c['query'][_0x5df6('0x1a')]);}return _0x170183['getFields'](_0x4aba6a);}})[_0x5df6('0x24')](function(_0x455235){if(_0x455235){return _0x455235?{'count':_0x30716c,'rows':_0x455235}:null;}})[_0x5df6('0x24')](respondWithResult(_0x12f1c7,null))[_0x5df6('0x49')](handleError(_0x12f1c7,null));};exports['getSubjects']=function(_0x3f615f,_0x454423,_0x56ff3b){var _0x5c7a38={};var _0x478a75={};var _0x5c4c89;var _0x2135cf;return db[_0x5df6('0x2c')][_0x5df6('0x4b')]({'where':{'id':_0x3f615f[_0x5df6('0x44')]['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x454423,null))[_0x5df6('0x24')](function(_0x3c3f1f){if(_0x3c3f1f){_0x5c4c89=_0x3c3f1f;_0x478a75[_0x5df6('0x45')]=_[_0x5df6('0x31')](db[_0x5df6('0x4e')][_0x5df6('0x4c')]);_0x478a75[_0x5df6('0x30')]=_[_0x5df6('0x31')](_0x3f615f[_0x5df6('0x30')]);_0x478a75[_0x5df6('0x3a')]=_[_0x5df6('0x32')](_0x478a75['model'],_0x478a75['query']);_0x5c7a38['attributes']=_[_0x5df6('0x32')](_0x478a75[_0x5df6('0x45')],qs[_0x5df6('0x34')](_0x3f615f['query'][_0x5df6('0x34')]));_0x5c7a38[_0x5df6('0x33')]=_0x5c7a38[_0x5df6('0x33')][_0x5df6('0x35')]?_0x5c7a38[_0x5df6('0x33')]:_0x478a75['model'];_0x5c7a38[_0x5df6('0x4d')]=qs[_0x5df6('0x38')](_0x3f615f['query'][_0x5df6('0x38')]);_0x5c7a38[_0x5df6('0x39')]=qs[_0x5df6('0x3a')](_[_0x5df6('0x3b')](_0x3f615f['query'],_0x478a75[_0x5df6('0x3a')]));if(_0x3f615f[_0x5df6('0x30')][_0x5df6('0x3e')]){_0x5c7a38[_0x5df6('0x39')]=_['merge'](_0x5c7a38['where'],{'$or':_[_0x5df6('0x2b')](_0x5c7a38[_0x5df6('0x33')],function(_0x1b5372){var _0x192d35={};_0x192d35[_0x1b5372]={'$like':'%'+_0x3f615f[_0x5df6('0x30')][_0x5df6('0x3e')]+'%'};return _0x192d35;})});}_0x5c7a38=_[_0x5df6('0x3c')]({},_0x5c7a38,_0x3f615f[_0x5df6('0x4f')]);return _0x5c4c89[_0x5df6('0x50')](_0x5c7a38);}})[_0x5df6('0x24')](function(_0x588b8d){if(_0x588b8d){_0x2135cf=_0x588b8d['length'];if(!_0x3f615f[_0x5df6('0x30')]['hasOwnProperty'](_0x5df6('0x37'))){_0x5c7a38[_0x5df6('0x1d')]=qs[_0x5df6('0x1d')](_0x3f615f[_0x5df6('0x30')][_0x5df6('0x1d')]);_0x5c7a38[_0x5df6('0x1a')]=qs[_0x5df6('0x1a')](_0x3f615f[_0x5df6('0x30')][_0x5df6('0x1a')]);}return _0x5c4c89[_0x5df6('0x50')](_0x5c7a38);}})[_0x5df6('0x24')](function(_0x5b4862){if(_0x5b4862){return _0x5b4862?{'count':_0x2135cf,'rows':_0x5b4862}:null;}})[_0x5df6('0x24')](respondWithResult(_0x454423,null))['catch'](handleError(_0x454423,null));};exports[_0x5df6('0x51')]=function(_0x14a470,_0x5a08e4,_0x9ce439){var _0x48af48={};var _0x302daf={};var _0x530fa2;var _0x4d5e44;return db[_0x5df6('0x2c')]['findOne']({'where':{'id':_0x14a470[_0x5df6('0x44')]['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x5a08e4,null))[_0x5df6('0x24')](function(_0xa4eb56){if(_0xa4eb56){_0x530fa2=_0xa4eb56;_0x302daf['model']=_[_0x5df6('0x31')](db[_0x5df6('0x4e')][_0x5df6('0x4c')]);_0x302daf['query']=_[_0x5df6('0x31')](_0x14a470['query']);_0x302daf[_0x5df6('0x3a')]=_[_0x5df6('0x32')](_0x302daf['model'],_0x302daf['query']);_0x48af48[_0x5df6('0x33')]=_['intersection'](_0x302daf[_0x5df6('0x45')],qs[_0x5df6('0x34')](_0x14a470[_0x5df6('0x30')]['fields']));_0x48af48[_0x5df6('0x33')]=_0x48af48['attributes'][_0x5df6('0x35')]?_0x48af48[_0x5df6('0x33')]:_0x302daf[_0x5df6('0x45')];_0x48af48[_0x5df6('0x4d')]=qs['sort'](_0x14a470['query']['sort']);_0x48af48[_0x5df6('0x39')]=qs[_0x5df6('0x3a')](_[_0x5df6('0x3b')](_0x14a470[_0x5df6('0x30')],_0x302daf[_0x5df6('0x3a')]));if(_0x14a470[_0x5df6('0x30')][_0x5df6('0x3e')]){_0x48af48[_0x5df6('0x39')]=_[_0x5df6('0x3c')](_0x48af48[_0x5df6('0x39')],{'$or':_[_0x5df6('0x2b')](_0x48af48[_0x5df6('0x33')],function(_0x4e85cb){var _0x4c1f51={};_0x4c1f51[_0x4e85cb]={'$like':'%'+_0x14a470[_0x5df6('0x30')][_0x5df6('0x3e')]+'%'};return _0x4c1f51;})});}_0x48af48=_[_0x5df6('0x3c')]({},_0x48af48,_0x14a470[_0x5df6('0x4f')]);return _0x530fa2[_0x5df6('0x51')](_0x48af48);}})[_0x5df6('0x24')](function(_0x2f1aa7){if(_0x2f1aa7){_0x4d5e44=_0x2f1aa7[_0x5df6('0x35')];if(!_0x14a470[_0x5df6('0x30')][_0x5df6('0x36')](_0x5df6('0x37'))){_0x48af48[_0x5df6('0x1d')]=qs[_0x5df6('0x1d')](_0x14a470[_0x5df6('0x30')][_0x5df6('0x1d')]);_0x48af48[_0x5df6('0x1a')]=qs[_0x5df6('0x1a')](_0x14a470[_0x5df6('0x30')][_0x5df6('0x1a')]);}return _0x530fa2['getDescriptions'](_0x48af48);}})[_0x5df6('0x24')](function(_0x28a34d){if(_0x28a34d){return _0x28a34d?{'count':_0x4d5e44,'rows':_0x28a34d}:null;}})[_0x5df6('0x24')](respondWithResult(_0x5a08e4,null))[_0x5df6('0x49')](handleError(_0x5a08e4,null));};exports[_0x5df6('0x52')]=function(_0x1ef3f0,_0xb61a8a,_0x485945){var _0xa206dc={};var _0x48e2ba={};var _0xa8cd2f;var _0x5ea3e1;return db[_0x5df6('0x2c')][_0x5df6('0x4b')]({'where':{'id':_0x1ef3f0['params']['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0xb61a8a,null))[_0x5df6('0x24')](function(_0x3a01d2){if(_0x3a01d2){_0xa8cd2f=_0x3a01d2;_0x48e2ba[_0x5df6('0x45')]=_[_0x5df6('0x31')](db[_0x5df6('0x53')][_0x5df6('0x4c')]);_0x48e2ba[_0x5df6('0x30')]=_[_0x5df6('0x31')](_0x1ef3f0[_0x5df6('0x30')]);_0x48e2ba['filters']=_[_0x5df6('0x32')](_0x48e2ba[_0x5df6('0x45')],_0x48e2ba[_0x5df6('0x30')]);_0xa206dc[_0x5df6('0x33')]=_[_0x5df6('0x32')](_0x48e2ba[_0x5df6('0x45')],qs[_0x5df6('0x34')](_0x1ef3f0[_0x5df6('0x30')]['fields']));_0xa206dc[_0x5df6('0x33')]=_0xa206dc[_0x5df6('0x33')][_0x5df6('0x35')]?_0xa206dc[_0x5df6('0x33')]:_0x48e2ba[_0x5df6('0x45')];_0xa206dc[_0x5df6('0x4d')]=qs[_0x5df6('0x38')](_0x1ef3f0[_0x5df6('0x30')][_0x5df6('0x38')]);_0xa206dc[_0x5df6('0x39')]=qs['filters'](_[_0x5df6('0x3b')](_0x1ef3f0[_0x5df6('0x30')],_0x48e2ba['filters']));if(_0x1ef3f0[_0x5df6('0x30')][_0x5df6('0x3e')]){_0xa206dc[_0x5df6('0x39')]=_[_0x5df6('0x3c')](_0xa206dc[_0x5df6('0x39')],{'$or':_[_0x5df6('0x2b')](_0xa206dc[_0x5df6('0x33')],function(_0x38d58f){var _0xa1ab32={};_0xa1ab32[_0x38d58f]={'$like':'%'+_0x1ef3f0[_0x5df6('0x30')][_0x5df6('0x3e')]+'%'};return _0xa1ab32;})});}_0xa206dc=_['merge']({},_0xa206dc,_0x1ef3f0[_0x5df6('0x4f')]);return _0xa8cd2f[_0x5df6('0x52')](_0xa206dc);}})[_0x5df6('0x24')](function(_0x1d1cd9){if(_0x1d1cd9){_0x5ea3e1=_0x1d1cd9[_0x5df6('0x35')];if(!_0x1ef3f0['query'][_0x5df6('0x36')](_0x5df6('0x37'))){_0xa206dc[_0x5df6('0x1d')]=qs[_0x5df6('0x1d')](_0x1ef3f0['query'][_0x5df6('0x1d')]);_0xa206dc[_0x5df6('0x1a')]=qs[_0x5df6('0x1a')](_0x1ef3f0[_0x5df6('0x30')][_0x5df6('0x1a')]);}return _0xa8cd2f[_0x5df6('0x52')](_0xa206dc);}})[_0x5df6('0x24')](function(_0x535c37){if(_0x535c37){return _0x535c37?{'count':_0x5ea3e1,'rows':_0x535c37}:null;}})['then'](respondWithResult(_0xb61a8a,null))[_0x5df6('0x49')](handleError(_0xb61a8a,null));};exports[_0x5df6('0x54')]=function(_0x458d0e,_0x336a6f,_0x473833){if(_0x458d0e[_0x5df6('0x48')]['id']){delete _0x458d0e['body']['id'];}return db[_0x5df6('0x2c')]['findOne']({'where':{'id':_0x458d0e[_0x5df6('0x44')]['id']}})[_0x5df6('0x24')](handleEntityNotFound(_0x336a6f,null))[_0x5df6('0x24')](function(_0x584088){if(_0x584088){return _0x584088['setTags'](_0x458d0e[_0x5df6('0x48')][_0x5df6('0x55')]||[]);}return null;})[_0x5df6('0x24')](respondWithResult(_0x336a6f,null))[_0x5df6('0x49')](handleError(_0x336a6f,null));}; \ No newline at end of file +var _0x0418=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskConfiguration','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x0418,0x101));var _0x8041=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0418[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x8041('0x0'));var rimraf=require(_0x8041('0x1'));var zipdir=require(_0x8041('0x2'));var jsonpatch=require(_0x8041('0x3'));var rp=require(_0x8041('0x4'));var moment=require(_0x8041('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8041('0x6'));var util=require(_0x8041('0x7'));var path=require(_0x8041('0x8'));var sox=require(_0x8041('0x9'));var csv=require(_0x8041('0xa'));var ejs=require(_0x8041('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8041('0xc'));var squel=require(_0x8041('0xd'));var crypto=require(_0x8041('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8041('0xf'));var toCsv=require(_0x8041('0xa'));var querystring=require(_0x8041('0x10'));var Papa=require(_0x8041('0x11'));var Redis=require(_0x8041('0x12'));var authService=require(_0x8041('0x13'));var qs=require(_0x8041('0x14'));var as=require(_0x8041('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8041('0x16'))('api');var utils=require(_0x8041('0x17'));var config=require(_0x8041('0x18'));var licenseUtil=require(_0x8041('0x19'));var db=require(_0x8041('0x1a'))['db'];function respondWithStatusCode(_0x30b544,_0x39fb3b){_0x39fb3b=_0x39fb3b||0xcc;return function(_0x1a1873){if(_0x1a1873){return _0x30b544['sendStatus'](_0x39fb3b);}return _0x30b544['status'](_0x39fb3b)[_0x8041('0x1b')]();};}function respondWithResult(_0x47a149,_0x587d73){_0x587d73=_0x587d73||0xc8;return function(_0x4b710f){if(_0x4b710f){return _0x47a149[_0x8041('0x1c')](_0x587d73)[_0x8041('0x1d')](_0x4b710f);}};}function respondWithFilteredResult(_0x3f3aae,_0x4bc2c6){return function(_0x22555c){if(_0x22555c){var _0x2d5d27=typeof _0x4bc2c6[_0x8041('0x1e')]==='undefined'&&typeof _0x4bc2c6[_0x8041('0x1f')]==='undefined';var _0x3fab56=_0x22555c['count'];var _0x4ec769=_0x2d5d27?0x0:_0x4bc2c6[_0x8041('0x1e')];var _0x34edc2=_0x2d5d27?_0x22555c['count']:_0x4bc2c6['offset']+_0x4bc2c6['limit'];var _0x385af1;if(_0x34edc2>=_0x3fab56){_0x34edc2=_0x3fab56;_0x385af1=0xc8;}else{_0x385af1=0xce;}_0x3f3aae['status'](_0x385af1);return _0x3f3aae[_0x8041('0x20')](_0x8041('0x21'),_0x4ec769+'-'+_0x34edc2+'/'+_0x3fab56)[_0x8041('0x1d')](_0x22555c);}return null;};}function patchUpdates(_0x46da19){return function(_0x2c7ee0){try{jsonpatch[_0x8041('0x22')](_0x2c7ee0,_0x46da19,!![]);}catch(_0x762eee){return BPromise[_0x8041('0x23')](_0x762eee);}return _0x2c7ee0[_0x8041('0x24')]();};}function saveUpdates(_0x27c831,_0x4f1229){return function(_0x133946){if(_0x133946){return _0x133946[_0x8041('0x25')](_0x27c831)[_0x8041('0x26')](function(_0x258270){return _0x258270;});}return null;};}function removeEntity(_0xf6f05d,_0x33fd8b){return function(_0x10ea62){if(_0x10ea62){return _0x10ea62[_0x8041('0x27')]()[_0x8041('0x26')](function(){_0xf6f05d[_0x8041('0x1c')](0xcc)[_0x8041('0x1b')]();});}};}function handleEntityNotFound(_0xcca494,_0x3959b9){return function(_0x1008cd){if(!_0x1008cd){_0xcca494[_0x8041('0x28')](0x194);}return _0x1008cd;};}function handleError(_0x1b10b8,_0x55edb6){_0x55edb6=_0x55edb6||0x1f4;return function(_0x4db3ef){logger[_0x8041('0x29')](_0x4db3ef[_0x8041('0x2a')]);if(_0x4db3ef[_0x8041('0x2b')]){delete _0x4db3ef['name'];}_0x1b10b8[_0x8041('0x1c')](_0x55edb6)[_0x8041('0x2c')](_0x4db3ef);};}exports[_0x8041('0x2d')]=function(_0x343051,_0x5d8418){var _0x461e02={},_0x27dc5={},_0x470b2d={'count':0x0,'rows':[]};var _0x49648b=_['map'](db[_0x8041('0x2e')]['rawAttributes'],function(_0x5c71b1){return{'name':_0x5c71b1['fieldName'],'type':_0x5c71b1['type'][_0x8041('0x2f')]};});_0x27dc5[_0x8041('0x30')]=_[_0x8041('0x31')](_0x49648b,'name');_0x27dc5[_0x8041('0x32')]=_[_0x8041('0x33')](_0x343051[_0x8041('0x32')]);_0x27dc5['filters']=_['intersection'](_0x27dc5[_0x8041('0x30')],_0x27dc5[_0x8041('0x32')]);_0x461e02[_0x8041('0x34')]=_[_0x8041('0x35')](_0x27dc5[_0x8041('0x30')],qs['fields'](_0x343051[_0x8041('0x32')][_0x8041('0x36')]));_0x461e02['attributes']=_0x461e02['attributes'][_0x8041('0x37')]?_0x461e02[_0x8041('0x34')]:_0x27dc5[_0x8041('0x30')];if(!_0x343051[_0x8041('0x32')][_0x8041('0x38')](_0x8041('0x39'))){_0x461e02[_0x8041('0x1f')]=qs[_0x8041('0x1f')](_0x343051[_0x8041('0x32')][_0x8041('0x1f')]);_0x461e02[_0x8041('0x1e')]=qs['offset'](_0x343051[_0x8041('0x32')][_0x8041('0x1e')]);}_0x461e02[_0x8041('0x3a')]=qs[_0x8041('0x3b')](_0x343051[_0x8041('0x32')]['sort']);_0x461e02[_0x8041('0x3c')]=qs[_0x8041('0x3d')](_[_0x8041('0x3e')](_0x343051['query'],_0x27dc5[_0x8041('0x3d')]),_0x49648b);if(_0x343051[_0x8041('0x32')][_0x8041('0x3f')]){_0x461e02['where']=_[_0x8041('0x40')](_0x461e02['where'],{'$or':_[_0x8041('0x31')](_0x49648b,function(_0x5ce51c){if(_0x5ce51c[_0x8041('0x41')]!==_0x8041('0x42')){var _0x4c32d4={};_0x4c32d4[_0x5ce51c[_0x8041('0x2b')]]={'$like':'%'+_0x343051[_0x8041('0x32')]['filter']+'%'};return _0x4c32d4;}})});}_0x461e02=_[_0x8041('0x40')]({},_0x461e02,_0x343051[_0x8041('0x43')]);var _0x515763={'where':_0x461e02['where']};return db['ZendeskConfiguration'][_0x8041('0x44')](_0x515763)['then'](function(_0x410653){_0x470b2d[_0x8041('0x44')]=_0x410653;if(_0x343051[_0x8041('0x32')][_0x8041('0x45')]){_0x461e02[_0x8041('0x46')]=[{'all':!![]}];}return db[_0x8041('0x2e')]['findAll'](_0x461e02);})[_0x8041('0x26')](function(_0x5aad29){_0x470b2d['rows']=_0x5aad29;return _0x470b2d;})[_0x8041('0x26')](respondWithFilteredResult(_0x5d8418,_0x461e02))[_0x8041('0x47')](handleError(_0x5d8418,null));};exports[_0x8041('0x48')]=function(_0x48a47e,_0x17f531){var _0x25b1f4={'raw':![],'where':{'id':_0x48a47e[_0x8041('0x49')]['id']}},_0x52abb2={};_0x52abb2['model']=_[_0x8041('0x33')](db[_0x8041('0x2e')][_0x8041('0x4a')]);_0x52abb2[_0x8041('0x32')]=_[_0x8041('0x33')](_0x48a47e[_0x8041('0x32')]);_0x52abb2[_0x8041('0x3d')]=_[_0x8041('0x35')](_0x52abb2['model'],_0x52abb2[_0x8041('0x32')]);_0x25b1f4[_0x8041('0x34')]=_['intersection'](_0x52abb2[_0x8041('0x30')],qs[_0x8041('0x36')](_0x48a47e[_0x8041('0x32')][_0x8041('0x36')]));_0x25b1f4[_0x8041('0x34')]=_0x25b1f4[_0x8041('0x34')][_0x8041('0x37')]?_0x25b1f4['attributes']:_0x52abb2[_0x8041('0x30')];if(_0x48a47e[_0x8041('0x32')]['includeAll']){_0x25b1f4[_0x8041('0x46')]=[{'all':!![]}];}_0x25b1f4=_[_0x8041('0x40')]({},_0x25b1f4,_0x48a47e[_0x8041('0x43')]);return db[_0x8041('0x2e')][_0x8041('0x4b')](_0x25b1f4)[_0x8041('0x26')](handleEntityNotFound(_0x17f531,null))['then'](respondWithResult(_0x17f531,null))[_0x8041('0x47')](handleError(_0x17f531,null));};exports[_0x8041('0x4c')]=function(_0x4679cc,_0x1ac6d7){return db[_0x8041('0x2e')][_0x8041('0x4c')](_0x4679cc['body'],{})[_0x8041('0x26')](respondWithResult(_0x1ac6d7,0xc9))[_0x8041('0x47')](handleError(_0x1ac6d7,null));};exports[_0x8041('0x25')]=function(_0x1726cb,_0x6e8587){if(_0x1726cb[_0x8041('0x4d')]['id']){delete _0x1726cb[_0x8041('0x4d')]['id'];}return db[_0x8041('0x2e')][_0x8041('0x4b')]({'where':{'id':_0x1726cb[_0x8041('0x49')]['id']}})[_0x8041('0x26')](handleEntityNotFound(_0x6e8587,null))[_0x8041('0x26')](saveUpdates(_0x1726cb[_0x8041('0x4d')],null))['then'](respondWithResult(_0x6e8587,null))[_0x8041('0x47')](handleError(_0x6e8587,null));};exports[_0x8041('0x27')]=function(_0x42863d,_0x2714ed){return db[_0x8041('0x2e')][_0x8041('0x4b')]({'where':{'id':_0x42863d[_0x8041('0x49')]['id']}})[_0x8041('0x26')](handleEntityNotFound(_0x2714ed,null))[_0x8041('0x26')](removeEntity(_0x2714ed,null))[_0x8041('0x47')](handleError(_0x2714ed,null));};exports[_0x8041('0x4e')]=function(_0x33114f,_0x1db9fc,_0x48c9d2){var _0x163900={};var _0x34c248={};var _0x3dbf21;var _0x471e46;return db[_0x8041('0x2e')][_0x8041('0x4f')]({'where':{'id':_0x33114f['params']['id']}})[_0x8041('0x26')](handleEntityNotFound(_0x1db9fc,null))[_0x8041('0x26')](function(_0x45753f){if(_0x45753f){_0x3dbf21=_0x45753f;_0x34c248[_0x8041('0x30')]=_['keys'](db[_0x8041('0x50')][_0x8041('0x4a')]);_0x34c248['query']=_[_0x8041('0x33')](_0x33114f[_0x8041('0x32')]);_0x34c248[_0x8041('0x3d')]=_[_0x8041('0x35')](_0x34c248[_0x8041('0x30')],_0x34c248[_0x8041('0x32')]);_0x163900[_0x8041('0x34')]=_[_0x8041('0x35')](_0x34c248[_0x8041('0x30')],qs[_0x8041('0x36')](_0x33114f['query'][_0x8041('0x36')]));_0x163900['attributes']=_0x163900[_0x8041('0x34')][_0x8041('0x37')]?_0x163900[_0x8041('0x34')]:_0x34c248[_0x8041('0x30')];_0x163900[_0x8041('0x3a')]=qs[_0x8041('0x3b')](_0x33114f[_0x8041('0x32')][_0x8041('0x3b')]);_0x163900[_0x8041('0x3c')]=qs[_0x8041('0x3d')](_['pick'](_0x33114f[_0x8041('0x32')],_0x34c248['filters']));if(_0x33114f[_0x8041('0x32')][_0x8041('0x3f')]){_0x163900[_0x8041('0x3c')]=_[_0x8041('0x40')](_0x163900[_0x8041('0x3c')],{'$or':_[_0x8041('0x31')](_0x163900[_0x8041('0x34')],function(_0x2dc662){var _0x227b41={};_0x227b41[_0x2dc662]={'$like':'%'+_0x33114f[_0x8041('0x32')][_0x8041('0x3f')]+'%'};return _0x227b41;})});}_0x163900=_['merge']({},_0x163900,_0x33114f[_0x8041('0x43')]);return _0x3dbf21['getFields'](_0x163900);}})['then'](function(_0x4e4cca){if(_0x4e4cca){_0x471e46=_0x4e4cca['length'];if(!_0x33114f['query'][_0x8041('0x38')]('nolimit')){_0x163900[_0x8041('0x1f')]=qs[_0x8041('0x1f')](_0x33114f[_0x8041('0x32')][_0x8041('0x1f')]);_0x163900[_0x8041('0x1e')]=qs[_0x8041('0x1e')](_0x33114f[_0x8041('0x32')][_0x8041('0x1e')]);}return _0x3dbf21[_0x8041('0x4e')](_0x163900);}})['then'](function(_0x55217c){if(_0x55217c){return _0x55217c?{'count':_0x471e46,'rows':_0x55217c}:null;}})['then'](respondWithResult(_0x1db9fc,null))[_0x8041('0x47')](handleError(_0x1db9fc,null));};exports['getSubjects']=function(_0x393b18,_0x4acafb,_0x1ce454){var _0x544ceb={};var _0x119513={};var _0x3c25c2;var _0x46de59;return db[_0x8041('0x2e')][_0x8041('0x4f')]({'where':{'id':_0x393b18[_0x8041('0x49')]['id']}})[_0x8041('0x26')](handleEntityNotFound(_0x4acafb,null))[_0x8041('0x26')](function(_0x36e145){if(_0x36e145){_0x3c25c2=_0x36e145;_0x119513[_0x8041('0x30')]=_[_0x8041('0x33')](db[_0x8041('0x50')][_0x8041('0x4a')]);_0x119513[_0x8041('0x32')]=_[_0x8041('0x33')](_0x393b18[_0x8041('0x32')]);_0x119513[_0x8041('0x3d')]=_[_0x8041('0x35')](_0x119513[_0x8041('0x30')],_0x119513[_0x8041('0x32')]);_0x544ceb[_0x8041('0x34')]=_[_0x8041('0x35')](_0x119513[_0x8041('0x30')],qs['fields'](_0x393b18['query'][_0x8041('0x36')]));_0x544ceb[_0x8041('0x34')]=_0x544ceb[_0x8041('0x34')][_0x8041('0x37')]?_0x544ceb[_0x8041('0x34')]:_0x119513[_0x8041('0x30')];_0x544ceb[_0x8041('0x3a')]=qs[_0x8041('0x3b')](_0x393b18[_0x8041('0x32')][_0x8041('0x3b')]);_0x544ceb[_0x8041('0x3c')]=qs['filters'](_[_0x8041('0x3e')](_0x393b18[_0x8041('0x32')],_0x119513['filters']));if(_0x393b18[_0x8041('0x32')][_0x8041('0x3f')]){_0x544ceb[_0x8041('0x3c')]=_[_0x8041('0x40')](_0x544ceb['where'],{'$or':_[_0x8041('0x31')](_0x544ceb['attributes'],function(_0x31e2b3){var _0x3709e2={};_0x3709e2[_0x31e2b3]={'$like':'%'+_0x393b18['query'][_0x8041('0x3f')]+'%'};return _0x3709e2;})});}_0x544ceb=_[_0x8041('0x40')]({},_0x544ceb,_0x393b18[_0x8041('0x43')]);return _0x3c25c2[_0x8041('0x51')](_0x544ceb);}})['then'](function(_0x2512fd){if(_0x2512fd){_0x46de59=_0x2512fd['length'];if(!_0x393b18['query'][_0x8041('0x38')](_0x8041('0x39'))){_0x544ceb[_0x8041('0x1f')]=qs[_0x8041('0x1f')](_0x393b18[_0x8041('0x32')][_0x8041('0x1f')]);_0x544ceb[_0x8041('0x1e')]=qs[_0x8041('0x1e')](_0x393b18[_0x8041('0x32')][_0x8041('0x1e')]);}return _0x3c25c2[_0x8041('0x51')](_0x544ceb);}})[_0x8041('0x26')](function(_0x416d2d){if(_0x416d2d){return _0x416d2d?{'count':_0x46de59,'rows':_0x416d2d}:null;}})[_0x8041('0x26')](respondWithResult(_0x4acafb,null))[_0x8041('0x47')](handleError(_0x4acafb,null));};exports[_0x8041('0x52')]=function(_0x57f427,_0x5d3ea9,_0x5b8e8b){var _0x351981={};var _0x4c6dee={};var _0x31e54d;var _0x5b3917;return db[_0x8041('0x2e')][_0x8041('0x4f')]({'where':{'id':_0x57f427['params']['id']}})[_0x8041('0x26')](handleEntityNotFound(_0x5d3ea9,null))[_0x8041('0x26')](function(_0x5af738){if(_0x5af738){_0x31e54d=_0x5af738;_0x4c6dee[_0x8041('0x30')]=_[_0x8041('0x33')](db[_0x8041('0x50')][_0x8041('0x4a')]);_0x4c6dee[_0x8041('0x32')]=_[_0x8041('0x33')](_0x57f427[_0x8041('0x32')]);_0x4c6dee[_0x8041('0x3d')]=_[_0x8041('0x35')](_0x4c6dee['model'],_0x4c6dee[_0x8041('0x32')]);_0x351981[_0x8041('0x34')]=_[_0x8041('0x35')](_0x4c6dee[_0x8041('0x30')],qs[_0x8041('0x36')](_0x57f427[_0x8041('0x32')][_0x8041('0x36')]));_0x351981[_0x8041('0x34')]=_0x351981[_0x8041('0x34')]['length']?_0x351981[_0x8041('0x34')]:_0x4c6dee[_0x8041('0x30')];_0x351981[_0x8041('0x3a')]=qs[_0x8041('0x3b')](_0x57f427[_0x8041('0x32')][_0x8041('0x3b')]);_0x351981['where']=qs[_0x8041('0x3d')](_[_0x8041('0x3e')](_0x57f427['query'],_0x4c6dee['filters']));if(_0x57f427[_0x8041('0x32')][_0x8041('0x3f')]){_0x351981[_0x8041('0x3c')]=_[_0x8041('0x40')](_0x351981['where'],{'$or':_[_0x8041('0x31')](_0x351981[_0x8041('0x34')],function(_0x4b9bb4){var _0x3b1ef7={};_0x3b1ef7[_0x4b9bb4]={'$like':'%'+_0x57f427[_0x8041('0x32')][_0x8041('0x3f')]+'%'};return _0x3b1ef7;})});}_0x351981=_['merge']({},_0x351981,_0x57f427[_0x8041('0x43')]);return _0x31e54d['getDescriptions'](_0x351981);}})[_0x8041('0x26')](function(_0x21063b){if(_0x21063b){_0x5b3917=_0x21063b[_0x8041('0x37')];if(!_0x57f427[_0x8041('0x32')]['hasOwnProperty'](_0x8041('0x39'))){_0x351981[_0x8041('0x1f')]=qs[_0x8041('0x1f')](_0x57f427[_0x8041('0x32')][_0x8041('0x1f')]);_0x351981[_0x8041('0x1e')]=qs[_0x8041('0x1e')](_0x57f427['query'][_0x8041('0x1e')]);}return _0x31e54d[_0x8041('0x52')](_0x351981);}})['then'](function(_0x5bac1b){if(_0x5bac1b){return _0x5bac1b?{'count':_0x5b3917,'rows':_0x5bac1b}:null;}})[_0x8041('0x26')](respondWithResult(_0x5d3ea9,null))[_0x8041('0x47')](handleError(_0x5d3ea9,null));};exports[_0x8041('0x53')]=function(_0x1f8f6f,_0x4df145,_0x5384fe){var _0x464db3={};var _0x41501d={};var _0x1c0c70;var _0x3077f5;return db[_0x8041('0x2e')][_0x8041('0x4f')]({'where':{'id':_0x1f8f6f[_0x8041('0x49')]['id']}})['then'](handleEntityNotFound(_0x4df145,null))['then'](function(_0xa8cbe6){if(_0xa8cbe6){_0x1c0c70=_0xa8cbe6;_0x41501d[_0x8041('0x30')]=_[_0x8041('0x33')](db[_0x8041('0x54')]['rawAttributes']);_0x41501d[_0x8041('0x32')]=_[_0x8041('0x33')](_0x1f8f6f[_0x8041('0x32')]);_0x41501d[_0x8041('0x3d')]=_[_0x8041('0x35')](_0x41501d['model'],_0x41501d[_0x8041('0x32')]);_0x464db3[_0x8041('0x34')]=_[_0x8041('0x35')](_0x41501d['model'],qs[_0x8041('0x36')](_0x1f8f6f[_0x8041('0x32')][_0x8041('0x36')]));_0x464db3['attributes']=_0x464db3[_0x8041('0x34')][_0x8041('0x37')]?_0x464db3[_0x8041('0x34')]:_0x41501d[_0x8041('0x30')];_0x464db3['order']=qs[_0x8041('0x3b')](_0x1f8f6f['query']['sort']);_0x464db3['where']=qs['filters'](_['pick'](_0x1f8f6f[_0x8041('0x32')],_0x41501d[_0x8041('0x3d')]));if(_0x1f8f6f['query'][_0x8041('0x3f')]){_0x464db3[_0x8041('0x3c')]=_[_0x8041('0x40')](_0x464db3[_0x8041('0x3c')],{'$or':_['map'](_0x464db3[_0x8041('0x34')],function(_0x24fc4f){var _0x273896={};_0x273896[_0x24fc4f]={'$like':'%'+_0x1f8f6f[_0x8041('0x32')][_0x8041('0x3f')]+'%'};return _0x273896;})});}_0x464db3=_[_0x8041('0x40')]({},_0x464db3,_0x1f8f6f['options']);return _0x1c0c70[_0x8041('0x53')](_0x464db3);}})['then'](function(_0x75a023){if(_0x75a023){_0x3077f5=_0x75a023[_0x8041('0x37')];if(!_0x1f8f6f[_0x8041('0x32')]['hasOwnProperty'](_0x8041('0x39'))){_0x464db3[_0x8041('0x1f')]=qs[_0x8041('0x1f')](_0x1f8f6f[_0x8041('0x32')][_0x8041('0x1f')]);_0x464db3[_0x8041('0x1e')]=qs[_0x8041('0x1e')](_0x1f8f6f[_0x8041('0x32')]['offset']);}return _0x1c0c70[_0x8041('0x53')](_0x464db3);}})[_0x8041('0x26')](function(_0x16aec9){if(_0x16aec9){return _0x16aec9?{'count':_0x3077f5,'rows':_0x16aec9}:null;}})[_0x8041('0x26')](respondWithResult(_0x4df145,null))[_0x8041('0x47')](handleError(_0x4df145,null));};exports[_0x8041('0x55')]=function(_0x583511,_0x502f14,_0x21e4d8){if(_0x583511[_0x8041('0x4d')]['id']){delete _0x583511['body']['id'];}return db[_0x8041('0x2e')][_0x8041('0x4f')]({'where':{'id':_0x583511[_0x8041('0x49')]['id']}})['then'](handleEntityNotFound(_0x502f14,null))['then'](function(_0x4dd6e6){if(_0x4dd6e6){return _0x4dd6e6['setTags'](_0x583511[_0x8041('0x4d')][_0x8041('0x56')]||[]);}return null;})[_0x8041('0x26')](respondWithResult(_0x502f14,null))[_0x8041('0x47')](handleError(_0x502f14,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 86d50cd..8af3b04 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 _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x4bfbd2,_0x120e01){var _0x4d61ec=function(_0x41e97d){while(--_0x41e97d){_0x4bfbd2['push'](_0x4bfbd2['shift']());}};_0x4d61ec(++_0x120e01);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x290c78,_0x406c3d){_0x290c78=_0x290c78-0x0;var _0x5d5bf5=_0xe2cf[_0x290c78];return _0x5d5bf5;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb4=['bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x86a7ac,_0x2ff628){var _0x52aa8b=function(_0x39598b){while(--_0x39598b){_0x86a7ac['push'](_0x86a7ac['shift']());}};_0x52aa8b(++_0x2ff628);}(_0x6cb4,0xff));var _0x46cb=function(_0x724ff5,_0x1b2f32){_0x724ff5=_0x724ff5-0x0;var _0x47b122=_0x6cb4[_0x724ff5];return _0x47b122;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'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 7aa17dc..bab8c35 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 _0x8f59=['result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x1ff1db,_0xb82369){var _0x44d43d=function(_0x70525b){while(--_0x70525b){_0x1ff1db['push'](_0x1ff1db['shift']());}};_0x44d43d(++_0xb82369);}(_0x8f59,0x10a));var _0x98f5=function(_0xc6ea98,_0x1f0fe7){_0xc6ea98=_0xc6ea98-0x0;var _0x154999=_0x8f59[_0xc6ea98];return _0x154999;};'use strict';var _=require('lodash');var util=require(_0x98f5('0x0'));var moment=require('moment');var BPromise=require(_0x98f5('0x1'));var rs=require(_0x98f5('0x2'));var fs=require('fs');var Redis=require(_0x98f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98f5('0x4'))(_0x98f5('0x5'));var config=require(_0x98f5('0x6'));var jayson=require(_0x98f5('0x7'));var client=jayson[_0x98f5('0x8')][_0x98f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186fac,_0x47ca03,_0x534271){return new BPromise(function(_0x48b0cd,_0x315289){return client[_0x98f5('0xa')](_0x186fac,_0x534271)[_0x98f5('0xb')](function(_0x1c4878){logger[_0x98f5('0xc')](_0x98f5('0xd'),_0x47ca03,'request\x20sent');logger[_0x98f5('0xe')](_0x98f5('0xf'),_0x47ca03,'request\x20sent',JSON[_0x98f5('0x10')](_0x1c4878));if(_0x1c4878['error']){if(_0x1c4878['error'][_0x98f5('0x11')]===0x1f4){logger[_0x98f5('0x12')](_0x98f5('0xd'),_0x47ca03,_0x1c4878['error']['message']);return _0x315289(_0x1c4878[_0x98f5('0x12')]['message']);}logger[_0x98f5('0x12')](_0x98f5('0xd'),_0x47ca03,_0x1c4878['error'][_0x98f5('0x13')]);return _0x48b0cd(_0x1c4878['error'][_0x98f5('0x13')]);}else{logger[_0x98f5('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x47ca03,'request\x20sent');_0x48b0cd(_0x1c4878[_0x98f5('0x14')]['message']);}})[_0x98f5('0x15')](function(_0x1dd14b){logger['error'](_0x98f5('0xd'),_0x47ca03,_0x1dd14b);_0x315289(_0x1dd14b);});});} \ No newline at end of file +var _0x316f=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x16e73a,_0x146629){var _0x187aa1=function(_0x26eb2f){while(--_0x26eb2f){_0x16e73a['push'](_0x16e73a['shift']());}};_0x187aa1(++_0x146629);}(_0x316f,0x8e));var _0xf316=function(_0x1a5687,_0xc2188f){_0x1a5687=_0x1a5687-0x0;var _0x257d5c=_0x316f[_0x1a5687];return _0x257d5c;};'use strict';var _=require(_0xf316('0x0'));var util=require(_0xf316('0x1'));var moment=require(_0xf316('0x2'));var BPromise=require(_0xf316('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf316('0x4'));var db=require(_0xf316('0x5'))['db'];var utils=require(_0xf316('0x6'));var logger=require(_0xf316('0x7'))(_0xf316('0x8'));var config=require('../../config/environment');var jayson=require(_0xf316('0x9'));var client=jayson[_0xf316('0xa')][_0xf316('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x360bce,_0x3072df,_0x20a9e2){return new BPromise(function(_0x2361a3,_0x5c7411){return client[_0xf316('0xc')](_0x360bce,_0x20a9e2)[_0xf316('0xd')](function(_0x5c42bd){logger[_0xf316('0xe')](_0xf316('0xf'),_0x3072df,_0xf316('0x10'));logger[_0xf316('0x11')](_0xf316('0x12'),_0x3072df,_0xf316('0x10'),JSON['stringify'](_0x5c42bd));if(_0x5c42bd[_0xf316('0x13')]){if(_0x5c42bd[_0xf316('0x13')][_0xf316('0x14')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3072df,_0x5c42bd['error'][_0xf316('0x15')]);return _0x5c7411(_0x5c42bd[_0xf316('0x13')][_0xf316('0x15')]);}logger[_0xf316('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3072df,_0x5c42bd[_0xf316('0x13')]['message']);return _0x2361a3(_0x5c42bd[_0xf316('0x13')]['message']);}else{logger[_0xf316('0xe')](_0xf316('0xf'),_0x3072df,'request\x20sent');_0x2361a3(_0x5c42bd[_0xf316('0x16')]['message']);}})['catch'](function(_0xf7e38f){logger['error'](_0xf316('0xf'),_0x3072df,_0xf7e38f);_0x5c7411(_0xf7e38f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 84174a5..768345f 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 _0x9252=['get','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9252,0x185));var _0x2925=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x9252[_0x2aecb2];return _0x3ebb80;};'use strict';var multer=require(_0x2925('0x0'));var util=require(_0x2925('0x1'));var path=require(_0x2925('0x2'));var timeout=require(_0x2925('0x3'));var express=require(_0x2925('0x4'));var router=express['Router']();var fs_extra=require(_0x2925('0x5'));var auth=require(_0x2925('0x6'));var interaction=require(_0x2925('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x2925('0x8')](),controller[_0x2925('0x9')]);router[_0x2925('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2925('0xb')]);router[_0x2925('0xc')]('/',auth[_0x2925('0x8')](),controller[_0x2925('0xd')]);router[_0x2925('0xe')](_0x2925('0xf'),auth[_0x2925('0x8')](),controller[_0x2925('0x10')]);router[_0x2925('0x11')](_0x2925('0xf'),auth[_0x2925('0x8')](),controller['destroy']);module[_0x2925('0x12')]=router; \ No newline at end of file +var _0xdad8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0xf42142,_0x448cd8){var _0x195537=function(_0x5d3598){while(--_0x5d3598){_0xf42142['push'](_0xf42142['shift']());}};_0x195537(++_0x448cd8);}(_0xdad8,0xce));var _0x8dad=function(_0x45a6c5,_0x54f583){_0x45a6c5=_0x45a6c5-0x0;var _0x124aa1=_0xdad8[_0x45a6c5];return _0x124aa1;};'use strict';var multer=require(_0x8dad('0x0'));var util=require(_0x8dad('0x1'));var path=require(_0x8dad('0x2'));var timeout=require(_0x8dad('0x3'));var express=require(_0x8dad('0x4'));var router=express[_0x8dad('0x5')]();var fs_extra=require(_0x8dad('0x6'));var auth=require(_0x8dad('0x7'));var interaction=require(_0x8dad('0x8'));var config=require(_0x8dad('0x9'));var controller=require('./intZendeskField.controller');router[_0x8dad('0xa')]('/',auth[_0x8dad('0xb')](),controller['index']);router['get'](_0x8dad('0xc'),auth[_0x8dad('0xb')](),controller['show']);router[_0x8dad('0xd')]('/',auth[_0x8dad('0xb')](),controller[_0x8dad('0xe')]);router[_0x8dad('0xf')]('/:id',auth[_0x8dad('0xb')](),controller[_0x8dad('0x10')]);router['delete'](_0x8dad('0xc'),auth[_0x8dad('0xb')](),controller[_0x8dad('0x11')]);module[_0x8dad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 88d2351..ca8f589 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 _0x6c41=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x386408,_0x584c61){var _0xedb599=function(_0x3f1962){while(--_0x3f1962){_0x386408['push'](_0x386408['shift']());}};_0xedb599(++_0x584c61);}(_0x6c41,0x1d2));var _0x16c4=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x6c41[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require(_0x16c4('0x0'));module[_0x16c4('0x1')]={'type':{'type':Sequelize[_0x16c4('0x2')](_0x16c4('0x3'),_0x16c4('0x4'),_0x16c4('0x5'),'keyValue',_0x16c4('0x6')),'defaultValue':_0x16c4('0x3')},'content':{'type':Sequelize[_0x16c4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x16c4('0x2')]('string',_0x16c4('0x4'),_0x16c4('0x5'))},'keyContent':{'type':Sequelize[_0x16c4('0x7')]},'idField':{'type':Sequelize[_0x16c4('0x7')]},'nameField':{'type':Sequelize[_0x16c4('0x7')]},'customField':{'type':Sequelize[_0x16c4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16c4('0x7')]}}; \ No newline at end of file +var _0x9765=['STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x47290c,_0x4cb96d){var _0x496aae=function(_0x4028f7){while(--_0x4028f7){_0x47290c['push'](_0x47290c['shift']());}};_0x496aae(++_0x4cb96d);}(_0x9765,0x112));var _0x5976=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9765[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x5976('0x0')]={'type':{'type':Sequelize[_0x5976('0x1')](_0x5976('0x2'),_0x5976('0x3'),_0x5976('0x4'),_0x5976('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5976('0x6')]},'key':{'type':Sequelize[_0x5976('0x6')]},'keyType':{'type':Sequelize[_0x5976('0x1')](_0x5976('0x2'),_0x5976('0x3'),_0x5976('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5976('0x6')]},'nameField':{'type':Sequelize[_0x5976('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5976('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b5bc356..8ea8023 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 _0x39a0=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','then','error','stack','name','send','index','map','ZendeskField','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','catch','show','params','rawAttributes','length','include','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x130339,_0x1cf3e0){var _0x1bbcc6=function(_0x45a33b){while(--_0x45a33b){_0x130339['push'](_0x130339['shift']());}};_0x1bbcc6(++_0x1cf3e0);}(_0x39a0,0x7b));var _0x039a=function(_0x508ac6,_0x4d9a97){_0x508ac6=_0x508ac6-0x0;var _0x25d22a=_0x39a0[_0x508ac6];return _0x25d22a;};'use strict';var emlformat=require(_0x039a('0x0'));var rimraf=require(_0x039a('0x1'));var zipdir=require(_0x039a('0x2'));var jsonpatch=require(_0x039a('0x3'));var rp=require(_0x039a('0x4'));var moment=require(_0x039a('0x5'));var BPromise=require(_0x039a('0x6'));var Mustache=require(_0x039a('0x7'));var util=require(_0x039a('0x8'));var path=require('path');var sox=require(_0x039a('0x9'));var csv=require(_0x039a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x039a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x039a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x039a('0xd'));var toCsv=require(_0x039a('0xa'));var querystring=require(_0x039a('0xe'));var Papa=require(_0x039a('0xf'));var Redis=require(_0x039a('0x10'));var authService=require(_0x039a('0x11'));var qs=require(_0x039a('0x12'));var as=require(_0x039a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x039a('0x14'))(_0x039a('0x15'));var utils=require(_0x039a('0x16'));var config=require(_0x039a('0x17'));var licenseUtil=require(_0x039a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8230,_0x4d45b6){_0x4d45b6=_0x4d45b6||0xcc;return function(_0x33f0e8){if(_0x33f0e8){return _0x4a8230[_0x039a('0x19')](_0x4d45b6);}return _0x4a8230[_0x039a('0x1a')](_0x4d45b6)['end']();};}function respondWithResult(_0x45ab66,_0x1b69c4){_0x1b69c4=_0x1b69c4||0xc8;return function(_0x2e6835){if(_0x2e6835){return _0x45ab66[_0x039a('0x1a')](_0x1b69c4)['json'](_0x2e6835);}};}function respondWithFilteredResult(_0x40e7be,_0x1b4481){return function(_0x471a0c){if(_0x471a0c){var _0x432410=typeof _0x1b4481[_0x039a('0x1b')]===_0x039a('0x1c')&&typeof _0x1b4481[_0x039a('0x1d')]===_0x039a('0x1c');var _0x2e922a=_0x471a0c['count'];var _0x5388fa=_0x432410?0x0:_0x1b4481[_0x039a('0x1b')];var _0x494dcf=_0x432410?_0x471a0c[_0x039a('0x1e')]:_0x1b4481[_0x039a('0x1b')]+_0x1b4481[_0x039a('0x1d')];var _0x56daf0;if(_0x494dcf>=_0x2e922a){_0x494dcf=_0x2e922a;_0x56daf0=0xc8;}else{_0x56daf0=0xce;}_0x40e7be[_0x039a('0x1a')](_0x56daf0);return _0x40e7be[_0x039a('0x1f')]('Content-Range',_0x5388fa+'-'+_0x494dcf+'/'+_0x2e922a)[_0x039a('0x20')](_0x471a0c);}return null;};}function patchUpdates(_0x24461f){return function(_0x587c9d){try{jsonpatch['apply'](_0x587c9d,_0x24461f,!![]);}catch(_0x3e9b42){return BPromise[_0x039a('0x21')](_0x3e9b42);}return _0x587c9d[_0x039a('0x22')]();};}function saveUpdates(_0x1f95f5,_0x44aed9){return function(_0x59f6dd){if(_0x59f6dd){return _0x59f6dd['update'](_0x1f95f5)[_0x039a('0x23')](function(_0x3faec4){return _0x3faec4;});}return null;};}function removeEntity(_0x592998,_0x6ee2d0){return function(_0x3551a1){if(_0x3551a1){return _0x3551a1['destroy']()[_0x039a('0x23')](function(){_0x592998['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c8a3,_0x54ac97){return function(_0x4500ad){if(!_0x4500ad){_0x39c8a3['sendStatus'](0x194);}return _0x4500ad;};}function handleError(_0x4061c4,_0x58480a){_0x58480a=_0x58480a||0x1f4;return function(_0x291f57){logger[_0x039a('0x24')](_0x291f57[_0x039a('0x25')]);if(_0x291f57[_0x039a('0x26')]){delete _0x291f57['name'];}_0x4061c4[_0x039a('0x1a')](_0x58480a)[_0x039a('0x27')](_0x291f57);};}exports[_0x039a('0x28')]=function(_0x5caf25,_0x3d2e68){var _0x1636c7={},_0x445b9c={},_0x57bffa={'count':0x0,'rows':[]};var _0x429d45=_[_0x039a('0x29')](db[_0x039a('0x2a')]['rawAttributes'],function(_0xb8dcdf){return{'name':_0xb8dcdf['fieldName'],'type':_0xb8dcdf[_0x039a('0x2b')][_0x039a('0x2c')]};});_0x445b9c[_0x039a('0x2d')]=_[_0x039a('0x29')](_0x429d45,'name');_0x445b9c['query']=_[_0x039a('0x2e')](_0x5caf25['query']);_0x445b9c[_0x039a('0x2f')]=_['intersection'](_0x445b9c['model'],_0x445b9c[_0x039a('0x30')]);_0x1636c7[_0x039a('0x31')]=_[_0x039a('0x32')](_0x445b9c['model'],qs[_0x039a('0x33')](_0x5caf25[_0x039a('0x30')][_0x039a('0x33')]));_0x1636c7[_0x039a('0x31')]=_0x1636c7[_0x039a('0x31')]['length']?_0x1636c7['attributes']:_0x445b9c[_0x039a('0x2d')];if(!_0x5caf25[_0x039a('0x30')][_0x039a('0x34')](_0x039a('0x35'))){_0x1636c7[_0x039a('0x1d')]=qs[_0x039a('0x1d')](_0x5caf25[_0x039a('0x30')][_0x039a('0x1d')]);_0x1636c7[_0x039a('0x1b')]=qs['offset'](_0x5caf25[_0x039a('0x30')][_0x039a('0x1b')]);}_0x1636c7[_0x039a('0x36')]=qs[_0x039a('0x37')](_0x5caf25['query'][_0x039a('0x37')]);_0x1636c7['where']=qs[_0x039a('0x2f')](_['pick'](_0x5caf25['query'],_0x445b9c[_0x039a('0x2f')]),_0x429d45);if(_0x5caf25[_0x039a('0x30')]['filter']){_0x1636c7[_0x039a('0x38')]=_[_0x039a('0x39')](_0x1636c7[_0x039a('0x38')],{'$or':_[_0x039a('0x29')](_0x429d45,function(_0x4aa846){if(_0x4aa846['type']!=='VIRTUAL'){var _0x411cf5={};_0x411cf5[_0x4aa846['name']]={'$like':'%'+_0x5caf25[_0x039a('0x30')][_0x039a('0x3a')]+'%'};return _0x411cf5;}})});}_0x1636c7=_[_0x039a('0x39')]({},_0x1636c7,_0x5caf25[_0x039a('0x3b')]);var _0x25bd87={'where':_0x1636c7['where']};return db[_0x039a('0x2a')][_0x039a('0x1e')](_0x25bd87)[_0x039a('0x23')](function(_0x24a480){_0x57bffa['count']=_0x24a480;if(_0x5caf25[_0x039a('0x30')][_0x039a('0x3c')]){_0x1636c7['include']=[{'all':!![]}];}return db[_0x039a('0x2a')]['findAll'](_0x1636c7);})[_0x039a('0x23')](function(_0x4b8945){_0x57bffa['rows']=_0x4b8945;return _0x57bffa;})[_0x039a('0x23')](respondWithFilteredResult(_0x3d2e68,_0x1636c7))[_0x039a('0x3d')](handleError(_0x3d2e68,null));};exports[_0x039a('0x3e')]=function(_0xa112b5,_0x346862){var _0x54adea={'raw':!![],'where':{'id':_0xa112b5[_0x039a('0x3f')]['id']}},_0x4f392d={};_0x4f392d['model']=_[_0x039a('0x2e')](db['ZendeskField'][_0x039a('0x40')]);_0x4f392d[_0x039a('0x30')]=_[_0x039a('0x2e')](_0xa112b5[_0x039a('0x30')]);_0x4f392d[_0x039a('0x2f')]=_['intersection'](_0x4f392d[_0x039a('0x2d')],_0x4f392d[_0x039a('0x30')]);_0x54adea[_0x039a('0x31')]=_[_0x039a('0x32')](_0x4f392d[_0x039a('0x2d')],qs[_0x039a('0x33')](_0xa112b5['query'][_0x039a('0x33')]));_0x54adea[_0x039a('0x31')]=_0x54adea[_0x039a('0x31')][_0x039a('0x41')]?_0x54adea['attributes']:_0x4f392d[_0x039a('0x2d')];if(_0xa112b5[_0x039a('0x30')]['includeAll']){_0x54adea[_0x039a('0x42')]=[{'all':!![]}];}_0x54adea=_[_0x039a('0x39')]({},_0x54adea,_0xa112b5['options']);return db[_0x039a('0x2a')]['find'](_0x54adea)[_0x039a('0x23')](handleEntityNotFound(_0x346862,null))[_0x039a('0x23')](respondWithResult(_0x346862,null))[_0x039a('0x3d')](handleError(_0x346862,null));};exports[_0x039a('0x43')]=function(_0x3c50d5,_0x183646){return db[_0x039a('0x2a')][_0x039a('0x43')](_0x3c50d5[_0x039a('0x44')],{})[_0x039a('0x23')](respondWithResult(_0x183646,0xc9))['catch'](handleError(_0x183646,null));};exports[_0x039a('0x45')]=function(_0x23b7af,_0x570140){if(_0x23b7af['body']['id']){delete _0x23b7af[_0x039a('0x44')]['id'];}return db[_0x039a('0x2a')][_0x039a('0x46')]({'where':{'id':_0x23b7af[_0x039a('0x3f')]['id']}})[_0x039a('0x23')](handleEntityNotFound(_0x570140,null))['then'](saveUpdates(_0x23b7af[_0x039a('0x44')],null))[_0x039a('0x23')](respondWithResult(_0x570140,null))[_0x039a('0x3d')](handleError(_0x570140,null));};exports[_0x039a('0x47')]=function(_0x5ddd02,_0x59dc6c){return db[_0x039a('0x2a')][_0x039a('0x46')]({'where':{'id':_0x5ddd02[_0x039a('0x3f')]['id']}})[_0x039a('0x23')](handleEntityNotFound(_0x59dc6c,null))[_0x039a('0x23')](removeEntity(_0x59dc6c,null))[_0x039a('0x3d')](handleError(_0x59dc6c,null));}; \ No newline at end of file +var _0x8248=['map','ZendeskField','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x550e2f,_0x3d9c58){var _0x4fdb8e=function(_0x10207d){while(--_0x10207d){_0x550e2f['push'](_0x550e2f['shift']());}};_0x4fdb8e(++_0x3d9c58);}(_0x8248,0x67));var _0x8824=function(_0x1489be,_0x116081){_0x1489be=_0x1489be-0x0;var _0x3edce3=_0x8248[_0x1489be];return _0x3edce3;};'use strict';var emlformat=require(_0x8824('0x0'));var rimraf=require(_0x8824('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8824('0x2'));var rp=require('request-promise');var moment=require(_0x8824('0x3'));var BPromise=require(_0x8824('0x4'));var Mustache=require('mustache');var util=require(_0x8824('0x5'));var path=require(_0x8824('0x6'));var sox=require(_0x8824('0x7'));var csv=require(_0x8824('0x8'));var ejs=require(_0x8824('0x9'));var fs=require('fs');var fs_extra=require(_0x8824('0xa'));var _=require(_0x8824('0xb'));var squel=require(_0x8824('0xc'));var crypto=require(_0x8824('0xd'));var jsforce=require(_0x8824('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8824('0x8'));var querystring=require(_0x8824('0xf'));var Papa=require(_0x8824('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8824('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8824('0x12'));var config=require(_0x8824('0x13'));var licenseUtil=require(_0x8824('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x73cad2,_0x4e28c7){_0x4e28c7=_0x4e28c7||0xcc;return function(_0x458a3f){if(_0x458a3f){return _0x73cad2['sendStatus'](_0x4e28c7);}return _0x73cad2[_0x8824('0x15')](_0x4e28c7)[_0x8824('0x16')]();};}function respondWithResult(_0x31da9a,_0x2323cc){_0x2323cc=_0x2323cc||0xc8;return function(_0x3d4704){if(_0x3d4704){return _0x31da9a[_0x8824('0x15')](_0x2323cc)[_0x8824('0x17')](_0x3d4704);}};}function respondWithFilteredResult(_0x2b2fc9,_0xf048cb){return function(_0x447946){if(_0x447946){var _0x367ffe=typeof _0xf048cb[_0x8824('0x18')]===_0x8824('0x19')&&typeof _0xf048cb[_0x8824('0x1a')]==='undefined';var _0x1635e4=_0x447946['count'];var _0x5672ed=_0x367ffe?0x0:_0xf048cb[_0x8824('0x18')];var _0x4f4953=_0x367ffe?_0x447946[_0x8824('0x1b')]:_0xf048cb[_0x8824('0x18')]+_0xf048cb['limit'];var _0x452814;if(_0x4f4953>=_0x1635e4){_0x4f4953=_0x1635e4;_0x452814=0xc8;}else{_0x452814=0xce;}_0x2b2fc9['status'](_0x452814);return _0x2b2fc9[_0x8824('0x1c')]('Content-Range',_0x5672ed+'-'+_0x4f4953+'/'+_0x1635e4)[_0x8824('0x17')](_0x447946);}return null;};}function patchUpdates(_0x3a3bbd){return function(_0x2801a8){try{jsonpatch[_0x8824('0x1d')](_0x2801a8,_0x3a3bbd,!![]);}catch(_0x473723){return BPromise[_0x8824('0x1e')](_0x473723);}return _0x2801a8[_0x8824('0x1f')]();};}function saveUpdates(_0x4c5580,_0x4a10f8){return function(_0x39665b){if(_0x39665b){return _0x39665b[_0x8824('0x20')](_0x4c5580)[_0x8824('0x21')](function(_0x55bee8){return _0x55bee8;});}return null;};}function removeEntity(_0x452f3d,_0x587251){return function(_0x5275d6){if(_0x5275d6){return _0x5275d6[_0x8824('0x22')]()[_0x8824('0x21')](function(){_0x452f3d[_0x8824('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd89d43,_0x20bc03){return function(_0x4086ac){if(!_0x4086ac){_0xd89d43[_0x8824('0x23')](0x194);}return _0x4086ac;};}function handleError(_0x4a967d,_0x321695){_0x321695=_0x321695||0x1f4;return function(_0x2e1719){logger[_0x8824('0x24')](_0x2e1719[_0x8824('0x25')]);if(_0x2e1719[_0x8824('0x26')]){delete _0x2e1719[_0x8824('0x26')];}_0x4a967d[_0x8824('0x15')](_0x321695)[_0x8824('0x27')](_0x2e1719);};}exports[_0x8824('0x28')]=function(_0xfe4d0b,_0x4bb39a){var _0x137523={},_0x5bac2d={},_0x48a178={'count':0x0,'rows':[]};var _0x4cb8b7=_[_0x8824('0x29')](db[_0x8824('0x2a')][_0x8824('0x2b')],function(_0x221000){return{'name':_0x221000[_0x8824('0x2c')],'type':_0x221000['type']['key']};});_0x5bac2d['model']=_['map'](_0x4cb8b7,'name');_0x5bac2d[_0x8824('0x2d')]=_['keys'](_0xfe4d0b[_0x8824('0x2d')]);_0x5bac2d[_0x8824('0x2e')]=_[_0x8824('0x2f')](_0x5bac2d['model'],_0x5bac2d['query']);_0x137523[_0x8824('0x30')]=_[_0x8824('0x2f')](_0x5bac2d[_0x8824('0x31')],qs['fields'](_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x32')]));_0x137523['attributes']=_0x137523[_0x8824('0x30')][_0x8824('0x33')]?_0x137523[_0x8824('0x30')]:_0x5bac2d[_0x8824('0x31')];if(!_0xfe4d0b[_0x8824('0x2d')]['hasOwnProperty'](_0x8824('0x34'))){_0x137523[_0x8824('0x1a')]=qs[_0x8824('0x1a')](_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x1a')]);_0x137523['offset']=qs[_0x8824('0x18')](_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x18')]);}_0x137523[_0x8824('0x35')]=qs[_0x8824('0x36')](_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x36')]);_0x137523[_0x8824('0x37')]=qs[_0x8824('0x2e')](_[_0x8824('0x38')](_0xfe4d0b[_0x8824('0x2d')],_0x5bac2d['filters']),_0x4cb8b7);if(_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x39')]){_0x137523[_0x8824('0x37')]=_[_0x8824('0x3a')](_0x137523[_0x8824('0x37')],{'$or':_['map'](_0x4cb8b7,function(_0x4073d9){if(_0x4073d9[_0x8824('0x3b')]!=='VIRTUAL'){var _0x2c95d2={};_0x2c95d2[_0x4073d9[_0x8824('0x26')]]={'$like':'%'+_0xfe4d0b[_0x8824('0x2d')][_0x8824('0x39')]+'%'};return _0x2c95d2;}})});}_0x137523=_[_0x8824('0x3a')]({},_0x137523,_0xfe4d0b[_0x8824('0x3c')]);var _0xac8792={'where':_0x137523[_0x8824('0x37')]};return db[_0x8824('0x2a')][_0x8824('0x1b')](_0xac8792)[_0x8824('0x21')](function(_0x3390c1){_0x48a178[_0x8824('0x1b')]=_0x3390c1;if(_0xfe4d0b['query'][_0x8824('0x3d')]){_0x137523[_0x8824('0x3e')]=[{'all':!![]}];}return db[_0x8824('0x2a')][_0x8824('0x3f')](_0x137523);})[_0x8824('0x21')](function(_0x433ecd){_0x48a178[_0x8824('0x40')]=_0x433ecd;return _0x48a178;})[_0x8824('0x21')](respondWithFilteredResult(_0x4bb39a,_0x137523))[_0x8824('0x41')](handleError(_0x4bb39a,null));};exports[_0x8824('0x42')]=function(_0x293ee7,_0x235fcf){var _0x4df038={'raw':!![],'where':{'id':_0x293ee7[_0x8824('0x43')]['id']}},_0x338d82={};_0x338d82['model']=_[_0x8824('0x44')](db[_0x8824('0x2a')]['rawAttributes']);_0x338d82[_0x8824('0x2d')]=_[_0x8824('0x44')](_0x293ee7['query']);_0x338d82[_0x8824('0x2e')]=_[_0x8824('0x2f')](_0x338d82[_0x8824('0x31')],_0x338d82[_0x8824('0x2d')]);_0x4df038['attributes']=_[_0x8824('0x2f')](_0x338d82['model'],qs[_0x8824('0x32')](_0x293ee7[_0x8824('0x2d')]['fields']));_0x4df038[_0x8824('0x30')]=_0x4df038['attributes'][_0x8824('0x33')]?_0x4df038[_0x8824('0x30')]:_0x338d82[_0x8824('0x31')];if(_0x293ee7[_0x8824('0x2d')][_0x8824('0x3d')]){_0x4df038['include']=[{'all':!![]}];}_0x4df038=_[_0x8824('0x3a')]({},_0x4df038,_0x293ee7['options']);return db[_0x8824('0x2a')]['find'](_0x4df038)[_0x8824('0x21')](handleEntityNotFound(_0x235fcf,null))[_0x8824('0x21')](respondWithResult(_0x235fcf,null))[_0x8824('0x41')](handleError(_0x235fcf,null));};exports[_0x8824('0x45')]=function(_0x25a99f,_0x343b08){return db[_0x8824('0x2a')][_0x8824('0x45')](_0x25a99f['body'],{})[_0x8824('0x21')](respondWithResult(_0x343b08,0xc9))[_0x8824('0x41')](handleError(_0x343b08,null));};exports[_0x8824('0x20')]=function(_0x84fb40,_0x593c23){if(_0x84fb40[_0x8824('0x46')]['id']){delete _0x84fb40['body']['id'];}return db[_0x8824('0x2a')][_0x8824('0x47')]({'where':{'id':_0x84fb40[_0x8824('0x43')]['id']}})[_0x8824('0x21')](handleEntityNotFound(_0x593c23,null))[_0x8824('0x21')](saveUpdates(_0x84fb40['body'],null))[_0x8824('0x21')](respondWithResult(_0x593c23,null))[_0x8824('0x41')](handleError(_0x593c23,null));};exports[_0x8824('0x22')]=function(_0x161bd6,_0x15cccf){return db['ZendeskField'][_0x8824('0x47')]({'where':{'id':_0x161bd6['params']['id']}})[_0x8824('0x21')](handleEntityNotFound(_0x15cccf,null))[_0x8824('0x21')](removeEntity(_0x15cccf,null))[_0x8824('0x41')](handleError(_0x15cccf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 790ff7e..13028a2 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 _0x6526=['FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0x6526,0x12c));var _0x6652=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x6526[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x6652('0x0'));var util=require('util');var logger=require(_0x6652('0x1'))('api');var moment=require(_0x6652('0x2'));var BPromise=require(_0x6652('0x3'));var rp=require(_0x6652('0x4'));var fs=require('fs');var path=require(_0x6652('0x5'));var rimraf=require(_0x6652('0x6'));var config=require('../../config/environment');var attributes=require(_0x6652('0x7'));module[_0x6652('0x8')]=function(_0x49b6dc,_0x175b3a){return _0x49b6dc[_0x6652('0x9')]('ZendeskField',attributes,{'tableName':_0x6652('0xa'),'paranoid':![],'indexes':[{'name':_0x6652('0xb'),'fields':['idField',_0x6652('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab69=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x158e28,_0x28ae93){var _0x4c5165=function(_0x1bd7b9){while(--_0x1bd7b9){_0x158e28['push'](_0x158e28['shift']());}};_0x4c5165(++_0x28ae93);}(_0xab69,0x130));var _0x9ab6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xab69[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x9ab6('0x0'));var util=require(_0x9ab6('0x1'));var logger=require(_0x9ab6('0x2'))(_0x9ab6('0x3'));var moment=require(_0x9ab6('0x4'));var BPromise=require(_0x9ab6('0x5'));var rp=require(_0x9ab6('0x6'));var fs=require('fs');var path=require(_0x9ab6('0x7'));var rimraf=require(_0x9ab6('0x8'));var config=require(_0x9ab6('0x9'));var attributes=require(_0x9ab6('0xa'));module['exports']=function(_0xfeef97,_0x27bb88){return _0xfeef97[_0x9ab6('0xb')]('ZendeskField',attributes,{'tableName':_0x9ab6('0xc'),'paranoid':![],'indexes':[{'name':_0x9ab6('0xd'),'fields':[_0x9ab6('0xe'),_0x9ab6('0xf')],'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 054cc8a..31fdeb2 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 _0x8c50=['message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8c50,0x1a2));var _0x08c5=function(_0x16e23e,_0x163660){_0x16e23e=_0x16e23e-0x0;var _0x5d161d=_0x8c50[_0x16e23e];return _0x5d161d;};'use strict';var _=require(_0x08c5('0x0'));var util=require(_0x08c5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x08c5('0x2'));var fs=require('fs');var Redis=require(_0x08c5('0x3'));var db=require(_0x08c5('0x4'))['db'];var utils=require(_0x08c5('0x5'));var logger=require(_0x08c5('0x6'))(_0x08c5('0x7'));var config=require(_0x08c5('0x8'));var jayson=require(_0x08c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c0645,_0x11e0a8,_0x4a241d){return new BPromise(function(_0x111626,_0x13f548){return client[_0x08c5('0xa')](_0x5c0645,_0x4a241d)[_0x08c5('0xb')](function(_0x425f59){logger['info'](_0x08c5('0xc'),_0x11e0a8,_0x08c5('0xd'));logger[_0x08c5('0xe')](_0x08c5('0xf'),_0x11e0a8,_0x08c5('0xd'),JSON[_0x08c5('0x10')](_0x425f59));if(_0x425f59[_0x08c5('0x11')]){if(_0x425f59['error'][_0x08c5('0x12')]===0x1f4){logger[_0x08c5('0x11')](_0x08c5('0xc'),_0x11e0a8,_0x425f59[_0x08c5('0x11')][_0x08c5('0x13')]);return _0x13f548(_0x425f59['error'][_0x08c5('0x13')]);}logger[_0x08c5('0x11')](_0x08c5('0xc'),_0x11e0a8,_0x425f59[_0x08c5('0x11')][_0x08c5('0x13')]);return _0x111626(_0x425f59[_0x08c5('0x11')][_0x08c5('0x13')]);}else{logger[_0x08c5('0x14')]('ZendeskField,\x20%s,\x20%s',_0x11e0a8,_0x08c5('0xd'));_0x111626(_0x425f59[_0x08c5('0x15')][_0x08c5('0x13')]);}})[_0x08c5('0x16')](function(_0x14defb){logger['error']('ZendeskField,\x20%s,\x20%s',_0x11e0a8,_0x14defb);_0x13f548(_0x14defb);});});} \ No newline at end of file +var _0x9197=['message','ZendeskField,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','code','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9197,0x1e3));var _0x7919=function(_0x13661e,_0x2d95aa){_0x13661e=_0x13661e-0x0;var _0x2a5f4d=_0x9197[_0x13661e];return _0x2a5f4d;};'use strict';var _=require('lodash');var util=require(_0x7919('0x0'));var moment=require(_0x7919('0x1'));var BPromise=require(_0x7919('0x2'));var rs=require(_0x7919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7919('0x4'))['db'];var utils=require(_0x7919('0x5'));var logger=require(_0x7919('0x6'))('rpc');var config=require(_0x7919('0x7'));var jayson=require(_0x7919('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9159,_0x514453,_0x52bb48){return new BPromise(function(_0x1c01f8,_0x3a82b0){return client[_0x7919('0x9')](_0x1f9159,_0x52bb48)[_0x7919('0xa')](function(_0x2232f5){logger[_0x7919('0xb')]('ZendeskField,\x20%s,\x20%s',_0x514453,_0x7919('0xc'));logger[_0x7919('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x514453,_0x7919('0xc'),JSON[_0x7919('0xe')](_0x2232f5));if(_0x2232f5['error']){if(_0x2232f5['error'][_0x7919('0xf')]===0x1f4){logger[_0x7919('0x10')]('ZendeskField,\x20%s,\x20%s',_0x514453,_0x2232f5[_0x7919('0x10')][_0x7919('0x11')]);return _0x3a82b0(_0x2232f5[_0x7919('0x10')][_0x7919('0x11')]);}logger[_0x7919('0x10')](_0x7919('0x12'),_0x514453,_0x2232f5[_0x7919('0x10')][_0x7919('0x11')]);return _0x1c01f8(_0x2232f5[_0x7919('0x10')][_0x7919('0x11')]);}else{logger[_0x7919('0xb')](_0x7919('0x12'),_0x514453,_0x7919('0xc'));_0x1c01f8(_0x2232f5['result'][_0x7919('0x11')]);}})[_0x7919('0x13')](function(_0x10dc8a){logger[_0x7919('0x10')](_0x7919('0x12'),_0x514453,_0x10dc8a);_0x3a82b0(_0x10dc8a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2953db3..101001b 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 _0x62d1=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','addConfiguration','put'];(function(_0x281a3d,_0x86b2ad){var _0xd5cd59=function(_0x570484){while(--_0x570484){_0x281a3d['push'](_0x281a3d['shift']());}};_0xd5cd59(++_0x86b2ad);}(_0x62d1,0x18e));var _0x162d=function(_0x373daf,_0x18b9a8){_0x373daf=_0x373daf-0x0;var _0x1fa416=_0x62d1[_0x373daf];return _0x1fa416;};'use strict';var multer=require(_0x162d('0x0'));var util=require(_0x162d('0x1'));var path=require(_0x162d('0x2'));var timeout=require(_0x162d('0x3'));var express=require(_0x162d('0x4'));var router=express[_0x162d('0x5')]();var fs_extra=require(_0x162d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x162d('0x7'));var config=require(_0x162d('0x8'));var controller=require(_0x162d('0x9'));router[_0x162d('0xa')]('/',auth[_0x162d('0xb')](),controller[_0x162d('0xc')]);router[_0x162d('0xa')](_0x162d('0xd'),auth['isAuthenticated'](),controller[_0x162d('0xe')]);router[_0x162d('0xa')]('/:id/configurations',auth[_0x162d('0xb')](),controller[_0x162d('0xf')]);router[_0x162d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x162d('0x10')]('/',auth[_0x162d('0xb')](),controller[_0x162d('0x11')]);router[_0x162d('0x10')]('/:id/configurations',auth[_0x162d('0xb')](),controller[_0x162d('0x12')]);router[_0x162d('0x13')](_0x162d('0xd'),auth[_0x162d('0xb')](),controller[_0x162d('0x14')]);router['delete'](_0x162d('0xd'),auth[_0x162d('0xb')](),controller[_0x162d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x086d=['../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x436093,_0x40a495){var _0x4c07ce=function(_0x6f9243){while(--_0x6f9243){_0x436093['push'](_0x436093['shift']());}};_0x4c07ce(++_0x40a495);}(_0x086d,0xeb));var _0xd086=function(_0x1868c9,_0x4ee82f){_0x1868c9=_0x1868c9-0x0;var _0x12ffa8=_0x086d[_0x1868c9];return _0x12ffa8;};'use strict';var multer=require(_0xd086('0x0'));var util=require('util');var path=require(_0xd086('0x1'));var timeout=require(_0xd086('0x2'));var express=require('express');var router=express[_0xd086('0x3')]();var fs_extra=require(_0xd086('0x4'));var auth=require(_0xd086('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd086('0x6'));var controller=require(_0xd086('0x7'));router[_0xd086('0x8')]('/',auth[_0xd086('0x9')](),controller['index']);router[_0xd086('0x8')](_0xd086('0xa'),auth[_0xd086('0x9')](),controller[_0xd086('0xb')]);router[_0xd086('0x8')](_0xd086('0xc'),auth[_0xd086('0x9')](),controller['getConfigurations']);router[_0xd086('0x8')](_0xd086('0xd'),auth[_0xd086('0x9')](),controller[_0xd086('0xe')]);router['post']('/',auth[_0xd086('0x9')](),controller[_0xd086('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd086('0x10')](_0xd086('0xa'),auth[_0xd086('0x9')](),controller[_0xd086('0x11')]);router[_0xd086('0x12')](_0xd086('0xa'),auth[_0xd086('0x9')](),controller['destroy']);module[_0xd086('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e6bd217..2bafdc6 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 _0xb4e6=['sequelize','STRING'];(function(_0x262ed3,_0x2fb06d){var _0x5e2f84=function(_0x393403){while(--_0x393403){_0x262ed3['push'](_0x262ed3['shift']());}};_0x5e2f84(++_0x2fb06d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xb4e6[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file +var _0xaa88=['exports','STRING','sequelize'];(function(_0x18c517,_0x4337ce){var _0x5b24c0=function(_0x32dbea){while(--_0x32dbea){_0x18c517['push'](_0x18c517['shift']());}};_0x5b24c0(++_0x4337ce);}(_0xaa88,0x137));var _0x8aa8=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xaa88[_0x11b1b3];return _0x437029;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 985c827..e544467 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 _0x961e=['rows','catch','show','params','keys','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','GET','format','Calls','Zoho-oauthtoken\x20','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','error','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll'];(function(_0x3b8f36,_0x12991e){var _0x30b8d3=function(_0x2207e8){while(--_0x2207e8){_0x3b8f36['push'](_0x3b8f36['shift']());}};_0x30b8d3(++_0x12991e);}(_0x961e,0xbd));var _0xe961=function(_0x35cf5f,_0x3fc093){_0x35cf5f=_0x35cf5f-0x0;var _0xc07026=_0x961e[_0x35cf5f];return _0xc07026;};'use strict';var emlformat=require(_0xe961('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe961('0x1'));var jsonpatch=require(_0xe961('0x2'));var rp=require(_0xe961('0x3'));var moment=require(_0xe961('0x4'));var BPromise=require(_0xe961('0x5'));var Mustache=require(_0xe961('0x6'));var util=require(_0xe961('0x7'));var path=require('path');var sox=require(_0xe961('0x8'));var csv=require(_0xe961('0x9'));var ejs=require(_0xe961('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe961('0xb'));var crypto=require('crypto');var jsforce=require(_0xe961('0xc'));var deskjs=require(_0xe961('0xd'));var toCsv=require(_0xe961('0x9'));var querystring=require('querystring');var Papa=require(_0xe961('0xe'));var Redis=require(_0xe961('0xf'));var authService=require(_0xe961('0x10'));var qs=require(_0xe961('0x11'));var as=require(_0xe961('0x12'));var hardwareService=require(_0xe961('0x13'));var logger=require(_0xe961('0x14'))(_0xe961('0x15'));var utils=require(_0xe961('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe961('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c403c,_0xcd22e3){_0xcd22e3=_0xcd22e3||0xcc;return function(_0x1193cf){if(_0x1193cf){return _0x3c403c[_0xe961('0x18')](_0xcd22e3);}return _0x3c403c['status'](_0xcd22e3)[_0xe961('0x19')]();};}function respondWithResult(_0x49ab35,_0x2ce96c){_0x2ce96c=_0x2ce96c||0xc8;return function(_0x4fc293){if(_0x4fc293){return _0x49ab35['status'](_0x2ce96c)[_0xe961('0x1a')](_0x4fc293);}};}function respondWithFilteredResult(_0x14ae61,_0x34710b){return function(_0x56df4b){if(_0x56df4b){var _0xb007bc=typeof _0x34710b['offset']===_0xe961('0x1b')&&typeof _0x34710b[_0xe961('0x1c')]==='undefined';var _0x15e317=_0x56df4b[_0xe961('0x1d')];var _0x4db542=_0xb007bc?0x0:_0x34710b['offset'];var _0xbed6d1=_0xb007bc?_0x56df4b['count']:_0x34710b[_0xe961('0x1e')]+_0x34710b[_0xe961('0x1c')];var _0x1508b1;if(_0xbed6d1>=_0x15e317){_0xbed6d1=_0x15e317;_0x1508b1=0xc8;}else{_0x1508b1=0xce;}_0x14ae61[_0xe961('0x1f')](_0x1508b1);return _0x14ae61['set'](_0xe961('0x20'),_0x4db542+'-'+_0xbed6d1+'/'+_0x15e317)[_0xe961('0x1a')](_0x56df4b);}return null;};}function patchUpdates(_0x4ed65d){return function(_0x10517b){try{jsonpatch[_0xe961('0x21')](_0x10517b,_0x4ed65d,!![]);}catch(_0x5622f8){return BPromise[_0xe961('0x22')](_0x5622f8);}return _0x10517b[_0xe961('0x23')]();};}function saveUpdates(_0x3d883a,_0x53b738){return function(_0x402bae){if(_0x402bae){return _0x402bae[_0xe961('0x24')](_0x3d883a)['then'](function(_0x42d04f){return _0x42d04f;});}return null;};}function removeEntity(_0x5a015b,_0x5b6fd2){return function(_0x15d363){if(_0x15d363){return _0x15d363['destroy']()[_0xe961('0x25')](function(){_0x5a015b[_0xe961('0x1f')](0xcc)[_0xe961('0x19')]();});}};}function handleEntityNotFound(_0x884958,_0x2a2404){return function(_0x29a229){if(!_0x29a229){_0x884958[_0xe961('0x18')](0x194);}return _0x29a229;};}function handleError(_0x41c8b3,_0x462666){_0x462666=_0x462666||0x1f4;return function(_0x40a6b5){logger[_0xe961('0x26')](_0x40a6b5['stack']);if(_0x40a6b5[_0xe961('0x27')]){delete _0x40a6b5[_0xe961('0x27')];}_0x41c8b3[_0xe961('0x1f')](_0x462666)[_0xe961('0x28')](_0x40a6b5);};}exports['index']=function(_0x575f93,_0x421615){var _0x4483ae={},_0x5b67a1={},_0x11814c={'count':0x0,'rows':[]};var _0x483276=_[_0xe961('0x29')](db[_0xe961('0x2a')][_0xe961('0x2b')],function(_0x20e06d){return{'name':_0x20e06d['fieldName'],'type':_0x20e06d[_0xe961('0x2c')][_0xe961('0x2d')]};});_0x5b67a1[_0xe961('0x2e')]=_[_0xe961('0x29')](_0x483276,_0xe961('0x27'));_0x5b67a1[_0xe961('0x2f')]=_['keys'](_0x575f93[_0xe961('0x2f')]);_0x5b67a1['filters']=_[_0xe961('0x30')](_0x5b67a1[_0xe961('0x2e')],_0x5b67a1[_0xe961('0x2f')]);_0x4483ae[_0xe961('0x31')]=_[_0xe961('0x30')](_0x5b67a1['model'],qs[_0xe961('0x32')](_0x575f93[_0xe961('0x2f')][_0xe961('0x32')]));_0x4483ae[_0xe961('0x31')]=_0x4483ae[_0xe961('0x31')][_0xe961('0x33')]?_0x4483ae[_0xe961('0x31')]:_0x5b67a1[_0xe961('0x2e')];if(!_0x575f93['query'][_0xe961('0x34')](_0xe961('0x35'))){_0x4483ae[_0xe961('0x1c')]=qs['limit'](_0x575f93[_0xe961('0x2f')]['limit']);_0x4483ae[_0xe961('0x1e')]=qs['offset'](_0x575f93['query'][_0xe961('0x1e')]);}_0x4483ae[_0xe961('0x36')]=qs[_0xe961('0x37')](_0x575f93['query']['sort']);_0x4483ae[_0xe961('0x38')]=qs['filters'](_[_0xe961('0x39')](_0x575f93['query'],_0x5b67a1[_0xe961('0x3a')]),_0x483276);if(_0x575f93[_0xe961('0x2f')]['filter']){_0x4483ae['where']=_[_0xe961('0x3b')](_0x4483ae[_0xe961('0x38')],{'$or':_[_0xe961('0x29')](_0x483276,function(_0x940f52){if(_0x940f52['type']!==_0xe961('0x3c')){var _0x456ed5={};_0x456ed5[_0x940f52[_0xe961('0x27')]]={'$like':'%'+_0x575f93[_0xe961('0x2f')][_0xe961('0x3d')]+'%'};return _0x456ed5;}})});}_0x4483ae=_[_0xe961('0x3b')]({},_0x4483ae,_0x575f93['options']);var _0x4255bf={'where':_0x4483ae[_0xe961('0x38')]};return db[_0xe961('0x2a')]['count'](_0x4255bf)[_0xe961('0x25')](function(_0x1dbf3c){_0x11814c[_0xe961('0x1d')]=_0x1dbf3c;if(_0x575f93[_0xe961('0x2f')][_0xe961('0x3e')]){_0x4483ae[_0xe961('0x3f')]=[{'all':!![]}];}return db[_0xe961('0x2a')][_0xe961('0x40')](_0x4483ae);})[_0xe961('0x25')](function(_0x496963){_0x11814c[_0xe961('0x41')]=_0x496963;return _0x11814c;})[_0xe961('0x25')](respondWithFilteredResult(_0x421615,_0x4483ae))[_0xe961('0x42')](handleError(_0x421615,null));};exports[_0xe961('0x43')]=function(_0x1df022,_0x2a2486){var _0x1e54d3={'raw':![],'where':{'id':_0x1df022[_0xe961('0x44')]['id']}},_0x6a8664={};_0x6a8664['model']=_[_0xe961('0x45')](db[_0xe961('0x2a')][_0xe961('0x2b')]);_0x6a8664[_0xe961('0x2f')]=_[_0xe961('0x45')](_0x1df022['query']);_0x6a8664[_0xe961('0x3a')]=_[_0xe961('0x30')](_0x6a8664[_0xe961('0x2e')],_0x6a8664[_0xe961('0x2f')]);_0x1e54d3[_0xe961('0x31')]=_[_0xe961('0x30')](_0x6a8664[_0xe961('0x2e')],qs[_0xe961('0x32')](_0x1df022[_0xe961('0x2f')][_0xe961('0x32')]));_0x1e54d3['attributes']=_0x1e54d3['attributes'][_0xe961('0x33')]?_0x1e54d3['attributes']:_0x6a8664[_0xe961('0x2e')];if(_0x1df022[_0xe961('0x2f')][_0xe961('0x3e')]){_0x1e54d3['include']=[{'all':!![]}];}_0x1e54d3=_[_0xe961('0x3b')]({},_0x1e54d3,_0x1df022[_0xe961('0x46')]);return db[_0xe961('0x2a')][_0xe961('0x47')](_0x1e54d3)[_0xe961('0x25')](handleEntityNotFound(_0x2a2486,null))[_0xe961('0x25')](respondWithResult(_0x2a2486,null))['catch'](handleError(_0x2a2486,null));};exports[_0xe961('0x48')]=function(_0x2bc9c4,_0x56dfa3){return db['ZohoAccount'][_0xe961('0x48')](_0x2bc9c4[_0xe961('0x49')],{})['then'](respondWithResult(_0x56dfa3,0xc9))[_0xe961('0x42')](handleError(_0x56dfa3,null));};exports[_0xe961('0x24')]=function(_0x597780,_0x5d6f7a){if(_0x597780[_0xe961('0x49')]['id']){delete _0x597780[_0xe961('0x49')]['id'];}return db[_0xe961('0x2a')][_0xe961('0x47')]({'where':{'id':_0x597780['params']['id']}})[_0xe961('0x25')](handleEntityNotFound(_0x5d6f7a,null))[_0xe961('0x25')](saveUpdates(_0x597780['body'],null))[_0xe961('0x25')](respondWithResult(_0x5d6f7a,null))[_0xe961('0x42')](handleError(_0x5d6f7a,null));};exports[_0xe961('0x4a')]=function(_0x330782,_0x171cc5){return db[_0xe961('0x2a')]['find']({'where':{'id':_0x330782[_0xe961('0x44')]['id']}})[_0xe961('0x25')](handleEntityNotFound(_0x171cc5,null))[_0xe961('0x25')](removeEntity(_0x171cc5,null))[_0xe961('0x42')](handleError(_0x171cc5,null));};exports[_0xe961('0x4b')]=function(_0x1f78f4,_0x2618c3,_0x565191){var _0x2d580a={};var _0xe63698={};var _0x3cb225;var _0x4b43af;return db['ZohoAccount'][_0xe961('0x4c')]({'where':{'id':_0x1f78f4['params']['id']}})[_0xe961('0x25')](handleEntityNotFound(_0x2618c3,null))['then'](function(_0x209e7a){if(_0x209e7a){_0x3cb225=_0x209e7a;_0xe63698[_0xe961('0x2e')]=_['keys'](db[_0xe961('0x4d')]['rawAttributes']);_0xe63698[_0xe961('0x2f')]=_[_0xe961('0x45')](_0x1f78f4[_0xe961('0x2f')]);_0xe63698[_0xe961('0x3a')]=_['intersection'](_0xe63698[_0xe961('0x2e')],_0xe63698['query']);_0x2d580a[_0xe961('0x31')]=_[_0xe961('0x30')](_0xe63698[_0xe961('0x2e')],qs[_0xe961('0x32')](_0x1f78f4[_0xe961('0x2f')]['fields']));_0x2d580a['attributes']=_0x2d580a[_0xe961('0x31')]['length']?_0x2d580a[_0xe961('0x31')]:_0xe63698[_0xe961('0x2e')];_0x2d580a[_0xe961('0x36')]=qs[_0xe961('0x37')](_0x1f78f4['query'][_0xe961('0x37')]);_0x2d580a[_0xe961('0x38')]=qs[_0xe961('0x3a')](_[_0xe961('0x39')](_0x1f78f4[_0xe961('0x2f')],_0xe63698[_0xe961('0x3a')]));if(_0x1f78f4['query'][_0xe961('0x3d')]){_0x2d580a[_0xe961('0x38')]=_[_0xe961('0x3b')](_0x2d580a[_0xe961('0x38')],{'$or':_[_0xe961('0x29')](_0x2d580a[_0xe961('0x31')],function(_0x55b568){var _0x24de6e={};_0x24de6e[_0x55b568]={'$like':'%'+_0x1f78f4['query']['filter']+'%'};return _0x24de6e;})});}_0x2d580a=_[_0xe961('0x3b')]({},_0x2d580a,_0x1f78f4[_0xe961('0x46')]);return _0x3cb225[_0xe961('0x4b')](_0x2d580a);}})[_0xe961('0x25')](function(_0x2fb32c){if(_0x2fb32c){_0x4b43af=_0x2fb32c[_0xe961('0x33')];if(!_0x1f78f4['query'][_0xe961('0x34')](_0xe961('0x35'))){_0x2d580a[_0xe961('0x1c')]=qs[_0xe961('0x1c')](_0x1f78f4['query']['limit']);_0x2d580a[_0xe961('0x1e')]=qs[_0xe961('0x1e')](_0x1f78f4[_0xe961('0x2f')]['offset']);}return _0x3cb225[_0xe961('0x4b')](_0x2d580a);}})[_0xe961('0x25')](function(_0x40cd24){if(_0x40cd24){return _0x40cd24?{'count':_0x4b43af,'rows':_0x40cd24}:null;}})[_0xe961('0x25')](respondWithResult(_0x2618c3,null))[_0xe961('0x42')](handleError(_0x2618c3,null));};exports['addConfiguration']=function(_0x37efa2,_0x1e375c,_0x8b3c57){if(_0x37efa2[_0xe961('0x49')]['id']){delete _0x37efa2['body']['id'];}return db[_0xe961('0x2a')][_0xe961('0x4c')]({'where':{'id':_0x37efa2['params']['id']}})[_0xe961('0x25')](handleEntityNotFound(_0x1e375c,null))[_0xe961('0x25')](function(_0x501690){if(_0x501690){_0x37efa2[_0xe961('0x49')][_0xe961('0x4e')]=_0x501690['id'];_0x37efa2['body'][_0xe961('0x4f')]=integrations[_0xe961('0x50')](_0x37efa2[_0xe961('0x49')][_0xe961('0x51')],_0x37efa2[_0xe961('0x49')][_0xe961('0x2c')]);_0x37efa2[_0xe961('0x49')][_0xe961('0x52')]=integrations[_0xe961('0x53')](_0x37efa2['body']['channel'],_0x37efa2[_0xe961('0x49')][_0xe961('0x2c')]);return db[_0xe961('0x4d')]['create'](_0x37efa2[_0xe961('0x49')],{'include':[{'model':db[_0xe961('0x54')],'as':_0xe961('0x4f')},{'model':db['ZohoField'],'as':_0xe961('0x52')}]});}return null;})[_0xe961('0x25')](respondWithResult(_0x1e375c,null))[_0xe961('0x42')](handleError(_0x1e375c,null));};function getAccessToken(_0xc2490d){return new Promise(function(_0x17d368,_0x357dcc){var _0x1689de;switch(_0xc2490d[_0xe961('0x55')]){case'US':_0x1689de=_0xe961('0x56');break;case'AU':_0x1689de='https://accounts.zoho.com.au';break;case'EU':_0x1689de=_0xe961('0x57');break;case'IN':_0x1689de='https://accounts.zoho.in';break;case'CN':_0x1689de=_0xe961('0x58');break;default:_0x1689de='https://accounts.zoho.eu';break;}var _0x280cc0={'method':_0xe961('0x59'),'uri':_0x1689de+_0xe961('0x5a'),'qs':{'refresh_token':_0xc2490d['refreshToken'],'client_id':_0xc2490d[_0xe961('0x5b')],'client_secret':_0xc2490d[_0xe961('0x5c')],'grant_type':_0xe961('0x5d')},'json':!![]};return rp(_0x280cc0)[_0xe961('0x25')](function(_0x9d7cc4){if(_0x9d7cc4[_0xe961('0x5e')]){_0x17d368(_0x9d7cc4[_0xe961('0x5e')]);}else{_0x357dcc(_0xe961('0x5f'));}})[_0xe961('0x42')](function(_0x4ff2f5){_0x357dcc(_0x4ff2f5);});});}exports[_0xe961('0x60')]=function(_0x1d3a0d,_0x2959be,_0x35c841){var _0x13377d,_0x1b6b66,_0x4ed4bb,_0x36d004,_0x23a9e1;return db[_0xe961('0x2a')][_0xe961('0x4c')]({'where':{'id':_0x1d3a0d[_0xe961('0x44')]['id']},'attributes':['id','host','zone','clientId',_0xe961('0x5c'),_0xe961('0x61'),_0xe961('0x62'),_0xe961('0x63')]})[_0xe961('0x25')](handleEntityNotFound(_0x2959be,null))[_0xe961('0x25')](function(_0x421cb0){_0x23a9e1=_0x421cb0;_0x13377d=_0x23a9e1['host'];_0x1b6b66=_0x13377d===_0xe961('0x64')?'eu':_0xe961('0x65');_0x4ed4bb=_0x23a9e1[_0xe961('0x61')];var _0x5a09fe=_0x4ed4bb[_0xe961('0x66')](-0x1);if(_0x5a09fe==='/'||_0x5a09fe==='\x5c'||_0x5a09fe===':'){_0x4ed4bb=_0x4ed4bb[_0xe961('0x67')](0x0,_0x4ed4bb['lastIndexOf'](_0x5a09fe));}if(!_0x23a9e1[_0xe961('0x63')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x23a9e1);})[_0xe961('0x25')](function(_0x3d30d4){if(_0x3d30d4){return rp({'method':_0xe961('0x68'),'uri':util[_0xe961('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1b6b66),'qs':{'module':_0xe961('0x6a')},'headers':{'Authorization':_0xe961('0x6b')+_0x3d30d4},'json':!![]});}})[_0xe961('0x25')](function(_0x1ceb6f){if(_0x1ceb6f){if(_0x1ceb6f['response']&&_0x1ceb6f['response'][_0xe961('0x26')]){throw new Error(_0x1ceb6f['response'][_0xe961('0x26')][_0xe961('0x6c')]);}var _0x1e1373=[];var _0x370255=[];var _0x34c411=[_0xe961('0x6d'),_0xe961('0x6e'),'Description',_0xe961('0x6f'),_0xe961('0x70'),_0xe961('0x71'),_0xe961('0x72'),_0xe961('0x73')];_0x370255=_['remove'](_0x1ceb6f[_0xe961('0x32')],function(_0xee8f4f){return _0x34c411[_0xe961('0x74')](_0xee8f4f['api_name']);});for(var _0x1d7f29=0x0;_0x1d7f29<_0x370255[_0xe961('0x33')];_0x1d7f29++){if(_0x370255[_0x1d7f29][_0xe961('0x75')]===![]){_0x1e1373[_0xe961('0x76')]({'id':_0x370255[_0x1d7f29]['id'],'name':_0x370255[_0x1d7f29][_0xe961('0x77')],'custom':_0x370255[_0x1d7f29][_0xe961('0x78')],'options':_0x370255[_0x1d7f29][_0xe961('0x79')]===_0xe961('0x7a')&&_0x370255[_0x1d7f29][_0xe961('0x7b')][_0xe961('0x33')]>-0x1?_['map'](_0x370255[_0x1d7f29]['pick_list_values'],function(_0x241021){return{'name':_0x241021,'value':_0x241021};}):[]});}}return{'count':_0x1e1373[_0xe961('0x33')],'rows':_0x1e1373};}else{return{'count':0x0,'rows':[]};}})[_0xe961('0x25')](respondWithResult(_0x2959be,null))[_0xe961('0x42')](function(_0x5c366c){var _0x151fcb=_0x1d3a0d[_0xe961('0x2f')][_0xe961('0x7c')]?0x1f4:_0x5c366c['statusCode']||0x1f4;logger[_0xe961('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xe961('0x60'),_0x151fcb,JSON[_0xe961('0x7d')](_0x5c366c));delete _0x5c366c[_0xe961('0x27')];if(_0x151fcb===0x191){_0x151fcb=0x190;}_0x2959be['status'](_0x151fcb)[_0xe961('0x28')](_0x1d3a0d[_0xe961('0x2f')][_0xe961('0x7c')]?{'message':_0xe961('0x7e'),'statusCode':_0x5c366c['statusCode']}:_0x5c366c);});}; \ No newline at end of file +var _0xc713=['order','sort','where','pick','filter','merge','options','ZohoAccount','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','type','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','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','code','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','error','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1b4eaa,_0x66ef22){var _0x4a7185=function(_0x22794d){while(--_0x22794d){_0x1b4eaa['push'](_0x1b4eaa['shift']());}};_0x4a7185(++_0x66ef22);}(_0xc713,0x150));var _0x3c71=function(_0x5d2523,_0x14bc7e){_0x5d2523=_0x5d2523-0x0;var _0x4b0e39=_0xc713[_0x5d2523];return _0x4b0e39;};'use strict';var emlformat=require(_0x3c71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c71('0x2'));var moment=require(_0x3c71('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c71('0x4'));var util=require(_0x3c71('0x5'));var path=require(_0x3c71('0x6'));var sox=require('sox');var csv=require(_0x3c71('0x7'));var ejs=require(_0x3c71('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c71('0x9'));var squel=require('squel');var crypto=require(_0x3c71('0xa'));var jsforce=require(_0x3c71('0xb'));var deskjs=require(_0x3c71('0xc'));var toCsv=require(_0x3c71('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c71('0xd'));var authService=require(_0x3c71('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3c71('0xf'));var hardwareService=require(_0x3c71('0x10'));var logger=require(_0x3c71('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3c71('0x12'));var licenseUtil=require(_0x3c71('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59277f,_0xfd59d0){_0xfd59d0=_0xfd59d0||0xcc;return function(_0x5394b6){if(_0x5394b6){return _0x59277f['sendStatus'](_0xfd59d0);}return _0x59277f[_0x3c71('0x14')](_0xfd59d0)[_0x3c71('0x15')]();};}function respondWithResult(_0x5657de,_0x32523e){_0x32523e=_0x32523e||0xc8;return function(_0x2bd587){if(_0x2bd587){return _0x5657de[_0x3c71('0x14')](_0x32523e)[_0x3c71('0x16')](_0x2bd587);}};}function respondWithFilteredResult(_0x5490d4,_0x4ba20d){return function(_0x595a24){if(_0x595a24){var _0x4c3852=typeof _0x4ba20d[_0x3c71('0x17')]===_0x3c71('0x18')&&typeof _0x4ba20d[_0x3c71('0x19')]==='undefined';var _0x12fd45=_0x595a24['count'];var _0x572c1f=_0x4c3852?0x0:_0x4ba20d['offset'];var _0x240673=_0x4c3852?_0x595a24[_0x3c71('0x1a')]:_0x4ba20d[_0x3c71('0x17')]+_0x4ba20d['limit'];var _0x40aa56;if(_0x240673>=_0x12fd45){_0x240673=_0x12fd45;_0x40aa56=0xc8;}else{_0x40aa56=0xce;}_0x5490d4[_0x3c71('0x14')](_0x40aa56);return _0x5490d4['set'](_0x3c71('0x1b'),_0x572c1f+'-'+_0x240673+'/'+_0x12fd45)['json'](_0x595a24);}return null;};}function patchUpdates(_0x2ff70c){return function(_0x5779ac){try{jsonpatch[_0x3c71('0x1c')](_0x5779ac,_0x2ff70c,!![]);}catch(_0x5d188b){return BPromise[_0x3c71('0x1d')](_0x5d188b);}return _0x5779ac[_0x3c71('0x1e')]();};}function saveUpdates(_0x3a0c7f,_0x54ccc1){return function(_0x10b62c){if(_0x10b62c){return _0x10b62c[_0x3c71('0x1f')](_0x3a0c7f)['then'](function(_0x42b617){return _0x42b617;});}return null;};}function removeEntity(_0x22bead,_0x4b705f){return function(_0x16dbac){if(_0x16dbac){return _0x16dbac[_0x3c71('0x20')]()[_0x3c71('0x21')](function(){_0x22bead['status'](0xcc)[_0x3c71('0x15')]();});}};}function handleEntityNotFound(_0xb5e333,_0x176aab){return function(_0x175a98){if(!_0x175a98){_0xb5e333['sendStatus'](0x194);}return _0x175a98;};}function handleError(_0x5a2c6c,_0x52c80c){_0x52c80c=_0x52c80c||0x1f4;return function(_0x175ee7){logger['error'](_0x175ee7[_0x3c71('0x22')]);if(_0x175ee7[_0x3c71('0x23')]){delete _0x175ee7[_0x3c71('0x23')];}_0x5a2c6c['status'](_0x52c80c)[_0x3c71('0x24')](_0x175ee7);};}exports['index']=function(_0x124717,_0x527cdb){var _0xd16a9b={},_0x3239ea={},_0x3fbbb5={'count':0x0,'rows':[]};var _0x506790=_[_0x3c71('0x25')](db['ZohoAccount'][_0x3c71('0x26')],function(_0x517e09){return{'name':_0x517e09[_0x3c71('0x27')],'type':_0x517e09['type'][_0x3c71('0x28')]};});_0x3239ea['model']=_['map'](_0x506790,_0x3c71('0x23'));_0x3239ea[_0x3c71('0x29')]=_[_0x3c71('0x2a')](_0x124717[_0x3c71('0x29')]);_0x3239ea[_0x3c71('0x2b')]=_[_0x3c71('0x2c')](_0x3239ea[_0x3c71('0x2d')],_0x3239ea[_0x3c71('0x29')]);_0xd16a9b[_0x3c71('0x2e')]=_[_0x3c71('0x2c')](_0x3239ea['model'],qs[_0x3c71('0x2f')](_0x124717['query'][_0x3c71('0x2f')]));_0xd16a9b[_0x3c71('0x2e')]=_0xd16a9b[_0x3c71('0x2e')][_0x3c71('0x30')]?_0xd16a9b['attributes']:_0x3239ea[_0x3c71('0x2d')];if(!_0x124717[_0x3c71('0x29')][_0x3c71('0x31')](_0x3c71('0x32'))){_0xd16a9b[_0x3c71('0x19')]=qs['limit'](_0x124717['query'][_0x3c71('0x19')]);_0xd16a9b[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0x124717[_0x3c71('0x29')][_0x3c71('0x17')]);}_0xd16a9b[_0x3c71('0x33')]=qs[_0x3c71('0x34')](_0x124717[_0x3c71('0x29')][_0x3c71('0x34')]);_0xd16a9b[_0x3c71('0x35')]=qs[_0x3c71('0x2b')](_[_0x3c71('0x36')](_0x124717[_0x3c71('0x29')],_0x3239ea[_0x3c71('0x2b')]),_0x506790);if(_0x124717[_0x3c71('0x29')][_0x3c71('0x37')]){_0xd16a9b[_0x3c71('0x35')]=_[_0x3c71('0x38')](_0xd16a9b['where'],{'$or':_['map'](_0x506790,function(_0x157d56){if(_0x157d56['type']!=='VIRTUAL'){var _0x1332f2={};_0x1332f2[_0x157d56[_0x3c71('0x23')]]={'$like':'%'+_0x124717[_0x3c71('0x29')][_0x3c71('0x37')]+'%'};return _0x1332f2;}})});}_0xd16a9b=_[_0x3c71('0x38')]({},_0xd16a9b,_0x124717[_0x3c71('0x39')]);var _0x2280fa={'where':_0xd16a9b[_0x3c71('0x35')]};return db[_0x3c71('0x3a')][_0x3c71('0x1a')](_0x2280fa)['then'](function(_0x46531c){_0x3fbbb5[_0x3c71('0x1a')]=_0x46531c;if(_0x124717[_0x3c71('0x29')][_0x3c71('0x3b')]){_0xd16a9b['include']=[{'all':!![]}];}return db[_0x3c71('0x3a')][_0x3c71('0x3c')](_0xd16a9b);})['then'](function(_0x43f25a){_0x3fbbb5[_0x3c71('0x3d')]=_0x43f25a;return _0x3fbbb5;})[_0x3c71('0x21')](respondWithFilteredResult(_0x527cdb,_0xd16a9b))[_0x3c71('0x3e')](handleError(_0x527cdb,null));};exports[_0x3c71('0x3f')]=function(_0x1509c5,_0x3d875f){var _0x13cb3b={'raw':![],'where':{'id':_0x1509c5[_0x3c71('0x40')]['id']}},_0x3ab8c4={};_0x3ab8c4[_0x3c71('0x2d')]=_[_0x3c71('0x2a')](db[_0x3c71('0x3a')][_0x3c71('0x26')]);_0x3ab8c4[_0x3c71('0x29')]=_[_0x3c71('0x2a')](_0x1509c5[_0x3c71('0x29')]);_0x3ab8c4['filters']=_['intersection'](_0x3ab8c4[_0x3c71('0x2d')],_0x3ab8c4[_0x3c71('0x29')]);_0x13cb3b[_0x3c71('0x2e')]=_[_0x3c71('0x2c')](_0x3ab8c4[_0x3c71('0x2d')],qs[_0x3c71('0x2f')](_0x1509c5[_0x3c71('0x29')][_0x3c71('0x2f')]));_0x13cb3b[_0x3c71('0x2e')]=_0x13cb3b[_0x3c71('0x2e')][_0x3c71('0x30')]?_0x13cb3b['attributes']:_0x3ab8c4[_0x3c71('0x2d')];if(_0x1509c5[_0x3c71('0x29')]['includeAll']){_0x13cb3b[_0x3c71('0x41')]=[{'all':!![]}];}_0x13cb3b=_['merge']({},_0x13cb3b,_0x1509c5[_0x3c71('0x39')]);return db[_0x3c71('0x3a')][_0x3c71('0x42')](_0x13cb3b)[_0x3c71('0x21')](handleEntityNotFound(_0x3d875f,null))[_0x3c71('0x21')](respondWithResult(_0x3d875f,null))[_0x3c71('0x3e')](handleError(_0x3d875f,null));};exports['create']=function(_0x13ec82,_0x25e32e){return db['ZohoAccount'][_0x3c71('0x43')](_0x13ec82[_0x3c71('0x44')],{})[_0x3c71('0x21')](respondWithResult(_0x25e32e,0xc9))[_0x3c71('0x3e')](handleError(_0x25e32e,null));};exports['update']=function(_0x1b5a0e,_0x4a5f85){if(_0x1b5a0e['body']['id']){delete _0x1b5a0e[_0x3c71('0x44')]['id'];}return db[_0x3c71('0x3a')][_0x3c71('0x42')]({'where':{'id':_0x1b5a0e[_0x3c71('0x40')]['id']}})[_0x3c71('0x21')](handleEntityNotFound(_0x4a5f85,null))[_0x3c71('0x21')](saveUpdates(_0x1b5a0e[_0x3c71('0x44')],null))[_0x3c71('0x21')](respondWithResult(_0x4a5f85,null))['catch'](handleError(_0x4a5f85,null));};exports[_0x3c71('0x20')]=function(_0x3c7ffa,_0x123036){return db['ZohoAccount'][_0x3c71('0x42')]({'where':{'id':_0x3c7ffa[_0x3c71('0x40')]['id']}})['then'](handleEntityNotFound(_0x123036,null))[_0x3c71('0x21')](removeEntity(_0x123036,null))[_0x3c71('0x3e')](handleError(_0x123036,null));};exports['getConfigurations']=function(_0xf9dba1,_0x245952,_0x330c32){var _0x12c09e={};var _0x307d14={};var _0x138e42;var _0x14abb7;return db[_0x3c71('0x3a')][_0x3c71('0x45')]({'where':{'id':_0xf9dba1[_0x3c71('0x40')]['id']}})[_0x3c71('0x21')](handleEntityNotFound(_0x245952,null))[_0x3c71('0x21')](function(_0x3afd10){if(_0x3afd10){_0x138e42=_0x3afd10;_0x307d14[_0x3c71('0x2d')]=_[_0x3c71('0x2a')](db[_0x3c71('0x46')]['rawAttributes']);_0x307d14[_0x3c71('0x29')]=_[_0x3c71('0x2a')](_0xf9dba1[_0x3c71('0x29')]);_0x307d14[_0x3c71('0x2b')]=_['intersection'](_0x307d14['model'],_0x307d14[_0x3c71('0x29')]);_0x12c09e[_0x3c71('0x2e')]=_[_0x3c71('0x2c')](_0x307d14[_0x3c71('0x2d')],qs[_0x3c71('0x2f')](_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x2f')]));_0x12c09e[_0x3c71('0x2e')]=_0x12c09e[_0x3c71('0x2e')][_0x3c71('0x30')]?_0x12c09e[_0x3c71('0x2e')]:_0x307d14[_0x3c71('0x2d')];_0x12c09e['order']=qs[_0x3c71('0x34')](_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x34')]);_0x12c09e['where']=qs[_0x3c71('0x2b')](_[_0x3c71('0x36')](_0xf9dba1[_0x3c71('0x29')],_0x307d14[_0x3c71('0x2b')]));if(_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x37')]){_0x12c09e[_0x3c71('0x35')]=_[_0x3c71('0x38')](_0x12c09e['where'],{'$or':_[_0x3c71('0x25')](_0x12c09e['attributes'],function(_0x53f809){var _0x11689b={};_0x11689b[_0x53f809]={'$like':'%'+_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x37')]+'%'};return _0x11689b;})});}_0x12c09e=_[_0x3c71('0x38')]({},_0x12c09e,_0xf9dba1[_0x3c71('0x39')]);return _0x138e42['getConfigurations'](_0x12c09e);}})[_0x3c71('0x21')](function(_0x5e6f6f){if(_0x5e6f6f){_0x14abb7=_0x5e6f6f[_0x3c71('0x30')];if(!_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x31')](_0x3c71('0x32'))){_0x12c09e['limit']=qs[_0x3c71('0x19')](_0xf9dba1['query'][_0x3c71('0x19')]);_0x12c09e[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0xf9dba1[_0x3c71('0x29')][_0x3c71('0x17')]);}return _0x138e42[_0x3c71('0x47')](_0x12c09e);}})['then'](function(_0x12ef5a){if(_0x12ef5a){return _0x12ef5a?{'count':_0x14abb7,'rows':_0x12ef5a}:null;}})[_0x3c71('0x21')](respondWithResult(_0x245952,null))[_0x3c71('0x3e')](handleError(_0x245952,null));};exports[_0x3c71('0x48')]=function(_0x203104,_0x2d622a,_0xc396e){if(_0x203104[_0x3c71('0x44')]['id']){delete _0x203104[_0x3c71('0x44')]['id'];}return db[_0x3c71('0x3a')][_0x3c71('0x45')]({'where':{'id':_0x203104[_0x3c71('0x40')]['id']}})[_0x3c71('0x21')](handleEntityNotFound(_0x2d622a,null))[_0x3c71('0x21')](function(_0xaf5f63){if(_0xaf5f63){_0x203104[_0x3c71('0x44')][_0x3c71('0x49')]=_0xaf5f63['id'];_0x203104[_0x3c71('0x44')][_0x3c71('0x4a')]=integrations['getSubjects'](_0x203104[_0x3c71('0x44')]['channel'],_0x203104[_0x3c71('0x44')][_0x3c71('0x4b')]);_0x203104[_0x3c71('0x44')]['Descriptions']=integrations['getDescriptions'](_0x203104[_0x3c71('0x44')][_0x3c71('0x4c')],_0x203104['body'][_0x3c71('0x4b')]);return db[_0x3c71('0x46')][_0x3c71('0x43')](_0x203104['body'],{'include':[{'model':db[_0x3c71('0x4d')],'as':_0x3c71('0x4a')},{'model':db[_0x3c71('0x4d')],'as':_0x3c71('0x4e')}]});}return null;})[_0x3c71('0x21')](respondWithResult(_0x2d622a,null))['catch'](handleError(_0x2d622a,null));};function getAccessToken(_0x4fabaf){return new Promise(function(_0x2dbbf5,_0x1cf2b5){var _0x11cb54;switch(_0x4fabaf[_0x3c71('0x4f')]){case'US':_0x11cb54=_0x3c71('0x50');break;case'AU':_0x11cb54=_0x3c71('0x51');break;case'EU':_0x11cb54=_0x3c71('0x52');break;case'IN':_0x11cb54=_0x3c71('0x53');break;case'CN':_0x11cb54=_0x3c71('0x54');break;default:_0x11cb54=_0x3c71('0x52');break;}var _0x42cc2f={'method':_0x3c71('0x55'),'uri':_0x11cb54+_0x3c71('0x56'),'qs':{'refresh_token':_0x4fabaf[_0x3c71('0x57')],'client_id':_0x4fabaf[_0x3c71('0x58')],'client_secret':_0x4fabaf[_0x3c71('0x59')],'grant_type':_0x3c71('0x5a')},'json':!![]};return rp(_0x42cc2f)['then'](function(_0x469b4f){if(_0x469b4f[_0x3c71('0x5b')]){_0x2dbbf5(_0x469b4f['access_token']);}else{_0x1cf2b5(_0x3c71('0x5c'));}})[_0x3c71('0x3e')](function(_0x2e2ace){_0x1cf2b5(_0x2e2ace);});});}exports[_0x3c71('0x5d')]=function(_0x14820b,_0x573a0a,_0x2a6d46){var _0x313d7c,_0x12cff1,_0x7dff0d,_0x4a95e5,_0x8fde8;return db[_0x3c71('0x3a')][_0x3c71('0x45')]({'where':{'id':_0x14820b[_0x3c71('0x40')]['id']},'attributes':['id','host',_0x3c71('0x4f'),'clientId',_0x3c71('0x59'),'serverUrl',_0x3c71('0x5e'),_0x3c71('0x57')]})[_0x3c71('0x21')](handleEntityNotFound(_0x573a0a,null))[_0x3c71('0x21')](function(_0x503d47){_0x8fde8=_0x503d47;_0x313d7c=_0x8fde8[_0x3c71('0x5f')];_0x12cff1=_0x313d7c===_0x3c71('0x60')?'eu':_0x3c71('0x61');_0x7dff0d=_0x8fde8[_0x3c71('0x62')];var _0x2e97cc=_0x7dff0d[_0x3c71('0x63')](-0x1);if(_0x2e97cc==='/'||_0x2e97cc==='\x5c'||_0x2e97cc===':'){_0x7dff0d=_0x7dff0d[_0x3c71('0x64')](0x0,_0x7dff0d[_0x3c71('0x65')](_0x2e97cc));}if(!_0x8fde8['refreshToken']){throw new Error(_0x3c71('0x66'));}return getAccessToken(_0x8fde8);})[_0x3c71('0x21')](function(_0x574e71){if(_0x574e71){return rp({'method':_0x3c71('0x67'),'uri':util[_0x3c71('0x68')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x12cff1),'qs':{'module':_0x3c71('0x69')},'headers':{'Authorization':_0x3c71('0x6a')+_0x574e71},'json':!![]});}})['then'](function(_0x14b14e){if(_0x14b14e){if(_0x14b14e['response']&&_0x14b14e['response'][_0x3c71('0x6b')]){throw new Error(_0x14b14e[_0x3c71('0x6c')]['error'][_0x3c71('0x6d')]);}var _0x58dc4b=[];var _0x586d01=[];var _0x4e8c19=[_0x3c71('0x6e'),_0x3c71('0x6f'),_0x3c71('0x70'),'WhoId',_0x3c71('0x71'),_0x3c71('0x72'),_0x3c71('0x73'),'Call_Type'];_0x586d01=_[_0x3c71('0x74')](_0x14b14e[_0x3c71('0x2f')],function(_0x4c59b7){return _0x4e8c19[_0x3c71('0x75')](_0x4c59b7['api_name']);});for(var _0x51d00f=0x0;_0x51d00f<_0x586d01[_0x3c71('0x30')];_0x51d00f++){if(_0x586d01[_0x51d00f][_0x3c71('0x76')]===![]){_0x58dc4b[_0x3c71('0x77')]({'id':_0x586d01[_0x51d00f]['id'],'name':_0x586d01[_0x51d00f][_0x3c71('0x78')],'custom':_0x586d01[_0x51d00f][_0x3c71('0x79')],'options':_0x586d01[_0x51d00f][_0x3c71('0x7a')]==='picklist'&&_0x586d01[_0x51d00f]['pick_list_values'][_0x3c71('0x30')]>-0x1?_[_0x3c71('0x25')](_0x586d01[_0x51d00f][_0x3c71('0x7b')],function(_0x8105a){return{'name':_0x8105a,'value':_0x8105a};}):[]});}}return{'count':_0x58dc4b['length'],'rows':_0x58dc4b};}else{return{'count':0x0,'rows':[]};}})[_0x3c71('0x21')](respondWithResult(_0x573a0a,null))[_0x3c71('0x3e')](function(_0x17805d){var _0x4e0488=_0x14820b[_0x3c71('0x29')][_0x3c71('0x7c')]?0x1f4:_0x17805d['statusCode']||0x1f4;logger[_0x3c71('0x6b')](_0x3c71('0x7d'),_0x3c71('0x5d'),_0x4e0488,JSON[_0x3c71('0x7e')](_0x17805d));delete _0x17805d[_0x3c71('0x23')];if(_0x4e0488===0x191){_0x4e0488=0x190;}_0x573a0a[_0x3c71('0x14')](_0x4e0488)['send'](_0x14820b[_0x3c71('0x29')][_0x3c71('0x7c')]?{'message':_0x3c71('0x7f'),'statusCode':_0x17805d[_0x3c71('0x80')]}:_0x17805d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 38de9b8..c37b0df 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 _0x2dc4=['int_zoho_accounts','changed','serverUrl','clientId','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','zone','slice','substring','https://accounts.zoho.com.au','/oauth/v2/token','catch','util','../../config/logger','moment','bluebird','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount'];(function(_0x59e067,_0x377449){var _0x3a2d0d=function(_0xa955a2){while(--_0xa955a2){_0x59e067['push'](_0x59e067['shift']());}};_0x3a2d0d(++_0x377449);}(_0x2dc4,0x199));var _0x42dc=function(_0x2e30ee,_0x20d8fb){_0x2e30ee=_0x2e30ee-0x0;var _0x1d2626=_0x2dc4[_0x2e30ee];return _0x1d2626;};'use strict';var _=require('lodash');var util=require(_0x42dc('0x0'));var logger=require(_0x42dc('0x1'))('api');var moment=require(_0x42dc('0x2'));var BPromise=require(_0x42dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42dc('0x4'));var rimraf=require(_0x42dc('0x5'));var config=require('../../config/environment');var attributes=require(_0x42dc('0x6'));var integrations=require(_0x42dc('0x7'));module[_0x42dc('0x8')]=function(_0x228ab8,_0x57a42a){return _0x228ab8[_0x42dc('0x9')](_0x42dc('0xa'),attributes,{'tableName':_0x42dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23088b,_0x25d672,_0x5736ce){if(_0x23088b['changed']('zone')||_0x23088b[_0x42dc('0xc')](_0x42dc('0xd'))||_0x23088b[_0x42dc('0xc')](_0x42dc('0xe'))||_0x23088b[_0x42dc('0xc')]('clientSecret')||_0x23088b['changed'](_0x42dc('0xf'))||_0x23088b['changed'](_0x42dc('0x10'))){var _0x322fba,_0x56dcbd;_0x322fba=_0x23088b[_0x42dc('0xd')];var _0x366b72=_0x322fba['slice'](-0x1);if(_0x366b72==='/'||_0x366b72==='\x5c'||_0x366b72===':'){_0x322fba=_0x322fba['substring'](0x0,_0x322fba[_0x42dc('0x11')](_0x366b72));}switch(_0x23088b['zone']){case'US':_0x56dcbd=_0x42dc('0x12');break;case'AU':_0x56dcbd='https://accounts.zoho.com.au';break;case'IN':_0x56dcbd='https://accounts.zoho.in';break;case'CN':_0x56dcbd=_0x42dc('0x13');break;default:_0x56dcbd=_0x42dc('0x14');break;}var _0x4138f3={'method':_0x42dc('0x15'),'uri':_0x56dcbd+'/oauth/v2/token','form':{'grant_type':_0x42dc('0x16'),'client_id':_0x23088b[_0x42dc('0xe')],'client_secret':_0x23088b[_0x42dc('0x17')],'redirect_uri':_0x23088b[_0x42dc('0xd')],'code':_0x23088b['code']},'headers':{'Content-Type':_0x42dc('0x18')}};return rp(_0x4138f3)[_0x42dc('0x19')](function(_0x5f1ca3){var _0x32681d=JSON[_0x42dc('0x1a')](_0x5f1ca3);if(_0x32681d[_0x42dc('0x1b')]){_0x23088b[_0x42dc('0x1c')]=_0x32681d[_0x42dc('0x1b')];logger[_0x42dc('0x1d')](util['format'](_0x42dc('0x1e'),_0x23088b[_0x42dc('0x1f')],_0x23088b['id']));}else{logger[_0x42dc('0x20')](util[_0x42dc('0x21')](_0x42dc('0x22'),_0x23088b[_0x42dc('0x1f')],_0x23088b['id']),util[_0x42dc('0x23')](_0x32681d,{'showHidden':![],'depth':null}));}return _0x5736ce(null,_0x25d672);})['catch'](function(_0x58c812){logger['error'](util['format'](_0x42dc('0x22'),_0x23088b[_0x42dc('0x1f')],_0x23088b['id']),util[_0x42dc('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5736ce(_0x58c812);});}else{return _0x5736ce(null,_0x25d672);}},'beforeUpdate':function(_0x4a8330,_0xe6201f,_0x81cc82){if(_0x4a8330[_0x42dc('0xc')](_0x42dc('0x24'))||_0x4a8330['changed'](_0x42dc('0xd'))||_0x4a8330[_0x42dc('0xc')](_0x42dc('0xe'))||_0x4a8330[_0x42dc('0xc')](_0x42dc('0x17'))||_0x4a8330['changed']('code')||_0x4a8330[_0x42dc('0xc')](_0x42dc('0x10'))){var _0x5d8972,_0x5ce5dc;_0x5d8972=_0x4a8330[_0x42dc('0xd')];var _0x13af3f=_0x5d8972[_0x42dc('0x25')](-0x1);if(_0x13af3f==='/'||_0x13af3f==='\x5c'||_0x13af3f===':'){_0x5d8972=_0x5d8972[_0x42dc('0x26')](0x0,_0x5d8972[_0x42dc('0x11')](_0x13af3f));}switch(_0x4a8330['zone']){case'US':_0x5ce5dc='https://accounts.zoho.com';break;case'AU':_0x5ce5dc=_0x42dc('0x27');break;case'IN':_0x5ce5dc='https://accounts.zoho.in';break;case'CN':_0x5ce5dc=_0x42dc('0x13');break;default:_0x5ce5dc=_0x42dc('0x14');break;}var _0x10e7a2={'method':'POST','uri':_0x5ce5dc+_0x42dc('0x28'),'form':{'grant_type':_0x42dc('0x16'),'client_id':_0x4a8330[_0x42dc('0xe')],'client_secret':_0x4a8330['clientSecret'],'redirect_uri':_0x4a8330[_0x42dc('0xd')],'code':_0x4a8330[_0x42dc('0xf')]},'headers':{'Content-Type':_0x42dc('0x18')}};return rp(_0x10e7a2)[_0x42dc('0x19')](function(_0x13ee51){var _0x3f4a41=JSON[_0x42dc('0x1a')](_0x13ee51);if(_0x3f4a41[_0x42dc('0x1b')]){_0x4a8330[_0x42dc('0x1c')]=_0x3f4a41[_0x42dc('0x1b')];logger[_0x42dc('0x1d')](util[_0x42dc('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a8330[_0x42dc('0x1f')],_0x4a8330['id']));}else{logger[_0x42dc('0x20')](util['format'](_0x42dc('0x22'),_0x4a8330['name'],_0x4a8330['id']),util[_0x42dc('0x23')](_0x3f4a41,{'showHidden':![],'depth':null}));}return _0x81cc82(null,_0xe6201f);})[_0x42dc('0x29')](function(_0x5bcd0e){logger[_0x42dc('0x20')](util[_0x42dc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a8330['name'],_0x4a8330['id']),util[_0x42dc('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x81cc82(_0x5bcd0e);});}else{return _0x81cc82(null,_0xe6201f);}}}});}; \ No newline at end of file +var _0x6fcc=['define','ZohoAccount','changed','zone','clientId','clientSecret','code','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice','POST','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x281cd3,_0x4a0e3b){var _0x3a6179=function(_0x5bcf89){while(--_0x5bcf89){_0x281cd3['push'](_0x281cd3['shift']());}};_0x3a6179(++_0x4a0e3b);}(_0x6fcc,0xf2));var _0xc6fc=function(_0x218e04,_0x1c52db){_0x218e04=_0x218e04-0x0;var _0xb251f4=_0x6fcc[_0x218e04];return _0xb251f4;};'use strict';var _=require('lodash');var util=require(_0xc6fc('0x0'));var logger=require(_0xc6fc('0x1'))(_0xc6fc('0x2'));var moment=require('moment');var BPromise=require(_0xc6fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6fc('0x4'));var rimraf=require(_0xc6fc('0x5'));var config=require(_0xc6fc('0x6'));var attributes=require(_0xc6fc('0x7'));var integrations=require(_0xc6fc('0x8'));module[_0xc6fc('0x9')]=function(_0x45ef9,_0x3d4ce0){return _0x45ef9[_0xc6fc('0xa')](_0xc6fc('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d842a,_0x5d35f9,_0x29ab7f){if(_0x1d842a[_0xc6fc('0xc')](_0xc6fc('0xd'))||_0x1d842a[_0xc6fc('0xc')]('serverUrl')||_0x1d842a[_0xc6fc('0xc')](_0xc6fc('0xe'))||_0x1d842a[_0xc6fc('0xc')](_0xc6fc('0xf'))||_0x1d842a[_0xc6fc('0xc')](_0xc6fc('0x10'))||_0x1d842a['changed'](_0xc6fc('0x11'))){var _0x262e0f,_0x4d9df5;_0x262e0f=_0x1d842a[_0xc6fc('0x12')];var _0x174a6b=_0x262e0f['slice'](-0x1);if(_0x174a6b==='/'||_0x174a6b==='\x5c'||_0x174a6b===':'){_0x262e0f=_0x262e0f[_0xc6fc('0x13')](0x0,_0x262e0f[_0xc6fc('0x14')](_0x174a6b));}switch(_0x1d842a['zone']){case'US':_0x4d9df5=_0xc6fc('0x15');break;case'AU':_0x4d9df5=_0xc6fc('0x16');break;case'IN':_0x4d9df5=_0xc6fc('0x17');break;case'CN':_0x4d9df5='https://accounts.zoho.com.cn';break;default:_0x4d9df5=_0xc6fc('0x18');break;}var _0x562bb8={'method':'POST','uri':_0x4d9df5+_0xc6fc('0x19'),'form':{'grant_type':_0xc6fc('0x1a'),'client_id':_0x1d842a[_0xc6fc('0xe')],'client_secret':_0x1d842a[_0xc6fc('0xf')],'redirect_uri':_0x1d842a[_0xc6fc('0x12')],'code':_0x1d842a['code']},'headers':{'Content-Type':_0xc6fc('0x1b')}};return rp(_0x562bb8)[_0xc6fc('0x1c')](function(_0x24d238){var _0x3543b4=JSON[_0xc6fc('0x1d')](_0x24d238);if(_0x3543b4[_0xc6fc('0x1e')]){_0x1d842a[_0xc6fc('0x1f')]=_0x3543b4['refresh_token'];logger[_0xc6fc('0x20')](util[_0xc6fc('0x21')](_0xc6fc('0x22'),_0x1d842a[_0xc6fc('0x23')],_0x1d842a['id']));}else{logger[_0xc6fc('0x24')](util[_0xc6fc('0x21')](_0xc6fc('0x25'),_0x1d842a['name'],_0x1d842a['id']),util['inspect'](_0x3543b4,{'showHidden':![],'depth':null}));}return _0x29ab7f(null,_0x5d35f9);})[_0xc6fc('0x26')](function(_0x258ef5){logger[_0xc6fc('0x24')](util[_0xc6fc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d842a['name'],_0x1d842a['id']),util[_0xc6fc('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x29ab7f(_0x258ef5);});}else{return _0x29ab7f(null,_0x5d35f9);}},'beforeUpdate':function(_0x3dc001,_0x1d101d,_0x59f58d){if(_0x3dc001['changed'](_0xc6fc('0xd'))||_0x3dc001[_0xc6fc('0xc')](_0xc6fc('0x12'))||_0x3dc001['changed'](_0xc6fc('0xe'))||_0x3dc001['changed'](_0xc6fc('0xf'))||_0x3dc001[_0xc6fc('0xc')](_0xc6fc('0x10'))||_0x3dc001['changed'](_0xc6fc('0x11'))){var _0xd8906f,_0x588d5d;_0xd8906f=_0x3dc001[_0xc6fc('0x12')];var _0x8c4be1=_0xd8906f[_0xc6fc('0x28')](-0x1);if(_0x8c4be1==='/'||_0x8c4be1==='\x5c'||_0x8c4be1===':'){_0xd8906f=_0xd8906f['substring'](0x0,_0xd8906f[_0xc6fc('0x14')](_0x8c4be1));}switch(_0x3dc001[_0xc6fc('0xd')]){case'US':_0x588d5d=_0xc6fc('0x15');break;case'AU':_0x588d5d=_0xc6fc('0x16');break;case'IN':_0x588d5d='https://accounts.zoho.in';break;case'CN':_0x588d5d='https://accounts.zoho.com.cn';break;default:_0x588d5d=_0xc6fc('0x18');break;}var _0x5094a6={'method':_0xc6fc('0x29'),'uri':_0x588d5d+_0xc6fc('0x19'),'form':{'grant_type':_0xc6fc('0x1a'),'client_id':_0x3dc001['clientId'],'client_secret':_0x3dc001[_0xc6fc('0xf')],'redirect_uri':_0x3dc001[_0xc6fc('0x12')],'code':_0x3dc001[_0xc6fc('0x10')]},'headers':{'Content-Type':_0xc6fc('0x1b')}};return rp(_0x5094a6)['then'](function(_0x4934a9){var _0x115e3b=JSON[_0xc6fc('0x1d')](_0x4934a9);if(_0x115e3b[_0xc6fc('0x1e')]){_0x3dc001[_0xc6fc('0x1f')]=_0x115e3b[_0xc6fc('0x1e')];logger['info'](util[_0xc6fc('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3dc001[_0xc6fc('0x23')],_0x3dc001['id']));}else{logger[_0xc6fc('0x24')](util[_0xc6fc('0x21')](_0xc6fc('0x25'),_0x3dc001[_0xc6fc('0x23')],_0x3dc001['id']),util['inspect'](_0x115e3b,{'showHidden':![],'depth':null}));}return _0x59f58d(null,_0x1d101d);})[_0xc6fc('0x26')](function(_0x41be51){logger[_0xc6fc('0x24')](util[_0xc6fc('0x21')](_0xc6fc('0x25'),_0x3dc001[_0xc6fc('0x23')],_0x3dc001['id']),util[_0xc6fc('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x59f58d(_0x41be51);});}else{return _0x59f58d(null,_0x1d101d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ed3ba84..911c2b8 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 _0xb1ad=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowZohoAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x409cfa,_0x2b189e){var _0x1d599f=function(_0x26bb34){while(--_0x26bb34){_0x409cfa['push'](_0x409cfa['shift']());}};_0x1d599f(++_0x2b189e);}(_0xb1ad,0x184));var _0xdb1a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1ad[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var moment=require(_0xdb1a('0x2'));var BPromise=require(_0xdb1a('0x3'));var rs=require(_0xdb1a('0x4'));var fs=require('fs');var Redis=require(_0xdb1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1a('0x6'));var logger=require(_0xdb1a('0x7'))(_0xdb1a('0x8'));var config=require(_0xdb1a('0x9'));var jayson=require(_0xdb1a('0xa'));var client=jayson[_0xdb1a('0xb')][_0xdb1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12b8c5,_0x2712fe,_0x2a24f2){return new BPromise(function(_0x5fc831,_0x188988){return client[_0xdb1a('0xd')](_0x12b8c5,_0x2a24f2)[_0xdb1a('0xe')](function(_0x122af8){logger['info'](_0xdb1a('0xf'),_0x2712fe,_0xdb1a('0x10'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2712fe,'request\x20sent',JSON[_0xdb1a('0x11')](_0x122af8));if(_0x122af8[_0xdb1a('0x12')]){if(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x13')]===0x1f4){logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);return _0x188988(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')]['message']);return _0x5fc831(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}else{logger[_0xdb1a('0x15')]('ZohoAccount,\x20%s,\x20%s',_0x2712fe,_0xdb1a('0x10'));_0x5fc831(_0x122af8['result'][_0xdb1a('0x14')]);}})[_0xdb1a('0x16')](function(_0x1637fa){logger['error'](_0xdb1a('0xf'),_0x2712fe,_0x1637fa);_0x188988(_0x1637fa);});});}exports[_0xdb1a('0x17')]=function(_0x268ce8){var _0x5539bf=this;return new Promise(function(_0xe3780b,_0x30b54c){return db[_0xdb1a('0x18')][_0xdb1a('0x19')]({'raw':_0x268ce8[_0xdb1a('0x1a')]?_0x268ce8[_0xdb1a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x268ce8[_0xdb1a('0x1a')]?_0x268ce8[_0xdb1a('0x1a')][_0xdb1a('0x1b')]||null:null,'attributes':_0x268ce8[_0xdb1a('0x1a')]?_0x268ce8[_0xdb1a('0x1a')][_0xdb1a('0x1c')]||null:null,'limit':_0x268ce8[_0xdb1a('0x1a')]?_0x268ce8[_0xdb1a('0x1a')][_0xdb1a('0x1d')]||null:null,'include':_0x268ce8[_0xdb1a('0x1a')]?_0x268ce8['options'][_0xdb1a('0x1e')]?_['map'](_0x268ce8[_0xdb1a('0x1a')][_0xdb1a('0x1e')],function(_0x3d07fc){return{'model':db[_0x3d07fc['model']],'as':_0x3d07fc['as'],'attributes':_0x3d07fc[_0xdb1a('0x1c')],'include':_0x3d07fc['include']?_[_0xdb1a('0x1f')](_0x3d07fc[_0xdb1a('0x1e')],function(_0x22c95e){return{'model':db[_0x22c95e[_0xdb1a('0x20')]],'as':_0x22c95e['as'],'attributes':_0x22c95e[_0xdb1a('0x1c')],'include':_0x22c95e[_0xdb1a('0x1e')]?_[_0xdb1a('0x1f')](_0x22c95e[_0xdb1a('0x1e')],function(_0x5c963b){return{'model':db[_0x5c963b['model']],'as':_0x5c963b['as'],'attributes':_0x5c963b[_0xdb1a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb1a('0xe')](function(_0x151af7){logger[_0xdb1a('0x15')](_0xdb1a('0x17'),_0x268ce8);logger[_0xdb1a('0x21')]('GetZohoAccount',_0x268ce8,JSON[_0xdb1a('0x11')](_0x151af7));_0xe3780b(_0x151af7);})['catch'](function(_0x5a67c4){logger[_0xdb1a('0x12')]('GetZohoAccount',_0x5a67c4['message'],_0x268ce8);_0x30b54c(_0x5539bf[_0xdb1a('0x12')](0x1f4,_0x5a67c4[_0xdb1a('0x14')]));});});};exports[_0xdb1a('0x22')]=function(_0x4f8c08){var _0x3ef1ce=this;return new Promise(function(_0x2080a4,_0xc684d5){return db[_0xdb1a('0x18')]['find']({'raw':_0x4f8c08[_0xdb1a('0x1a')]?_0x4f8c08[_0xdb1a('0x1a')][_0xdb1a('0x23')]===undefined?!![]:![]:!![],'where':_0x4f8c08['options']?_0x4f8c08[_0xdb1a('0x1a')][_0xdb1a('0x1b')]||null:null,'attributes':_0x4f8c08[_0xdb1a('0x1a')]?_0x4f8c08[_0xdb1a('0x1a')]['attributes']||null:null,'include':_0x4f8c08['options']?_0x4f8c08['options'][_0xdb1a('0x1e')]?_[_0xdb1a('0x1f')](_0x4f8c08['options'][_0xdb1a('0x1e')],function(_0xdd719a){return{'model':db[_0xdd719a[_0xdb1a('0x20')]],'as':_0xdd719a['as'],'attributes':_0xdd719a[_0xdb1a('0x1c')],'include':_0xdd719a[_0xdb1a('0x1e')]?_['map'](_0xdd719a['include'],function(_0x56fcf1){return{'model':db[_0x56fcf1[_0xdb1a('0x20')]],'as':_0x56fcf1['as'],'attributes':_0x56fcf1['attributes'],'include':_0x56fcf1['include']?_[_0xdb1a('0x1f')](_0x56fcf1[_0xdb1a('0x1e')],function(_0x57feab){return{'model':db[_0x57feab[_0xdb1a('0x20')]],'as':_0x57feab['as'],'attributes':_0x57feab[_0xdb1a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb1a('0xe')](function(_0x3459e5){logger[_0xdb1a('0x15')]('ShowZohoAccount',_0x4f8c08);logger['debug'](_0xdb1a('0x22'),_0x4f8c08,JSON[_0xdb1a('0x11')](_0x3459e5));_0x2080a4(_0x3459e5);})[_0xdb1a('0x16')](function(_0x14f66a){logger[_0xdb1a('0x12')](_0xdb1a('0x22'),_0x14f66a[_0xdb1a('0x14')],_0x4f8c08);_0xc684d5(_0x3ef1ce['error'](0x1f4,_0x14f66a[_0xdb1a('0x14')]));});});}; \ No newline at end of file +var _0xbf13=['then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','model','map','debug','find','ShowZohoAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xbf13,0xe2));var _0x3bf1=function(_0x28ce3e,_0x2e6afe){_0x28ce3e=_0x28ce3e-0x0;var _0x479e76=_0xbf13[_0x28ce3e];return _0x479e76;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require(_0x3bf1('0x7'));var jayson=require(_0x3bf1('0x8'));var client=jayson[_0x3bf1('0x9')][_0x3bf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54eada,_0x4d9fa2,_0x4502c5){return new BPromise(function(_0x30bda1,_0x56eb60){return client[_0x3bf1('0xb')](_0x54eada,_0x4502c5)[_0x3bf1('0xc')](function(_0x28906a){logger[_0x3bf1('0xd')](_0x3bf1('0xe'),_0x4d9fa2,_0x3bf1('0xf'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4d9fa2,_0x3bf1('0xf'),JSON[_0x3bf1('0x10')](_0x28906a));if(_0x28906a['error']){if(_0x28906a[_0x3bf1('0x11')]['code']===0x1f4){logger[_0x3bf1('0x11')](_0x3bf1('0xe'),_0x4d9fa2,_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);return _0x56eb60(_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4d9fa2,_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);return _0x30bda1(_0x28906a[_0x3bf1('0x11')][_0x3bf1('0x12')]);}else{logger[_0x3bf1('0xd')](_0x3bf1('0xe'),_0x4d9fa2,_0x3bf1('0xf'));_0x30bda1(_0x28906a[_0x3bf1('0x13')][_0x3bf1('0x12')]);}})[_0x3bf1('0x14')](function(_0x260440){logger[_0x3bf1('0x11')](_0x3bf1('0xe'),_0x4d9fa2,_0x260440);_0x56eb60(_0x260440);});});}exports[_0x3bf1('0x15')]=function(_0x5cf15b){var _0x50df9e=this;return new Promise(function(_0x96ad97,_0x2b6fe1){return db[_0x3bf1('0x16')]['findAll']({'raw':_0x5cf15b['options']?_0x5cf15b[_0x3bf1('0x17')][_0x3bf1('0x18')]===undefined?!![]:![]:!![],'where':_0x5cf15b[_0x3bf1('0x17')]?_0x5cf15b[_0x3bf1('0x17')][_0x3bf1('0x19')]||null:null,'attributes':_0x5cf15b[_0x3bf1('0x17')]?_0x5cf15b[_0x3bf1('0x17')][_0x3bf1('0x1a')]||null:null,'limit':_0x5cf15b[_0x3bf1('0x17')]?_0x5cf15b[_0x3bf1('0x17')][_0x3bf1('0x1b')]||null:null,'include':_0x5cf15b['options']?_0x5cf15b['options'][_0x3bf1('0x1c')]?_['map'](_0x5cf15b[_0x3bf1('0x17')]['include'],function(_0x58a2a6){return{'model':db[_0x58a2a6[_0x3bf1('0x1d')]],'as':_0x58a2a6['as'],'attributes':_0x58a2a6[_0x3bf1('0x1a')],'include':_0x58a2a6[_0x3bf1('0x1c')]?_[_0x3bf1('0x1e')](_0x58a2a6[_0x3bf1('0x1c')],function(_0x49bcb5){return{'model':db[_0x49bcb5[_0x3bf1('0x1d')]],'as':_0x49bcb5['as'],'attributes':_0x49bcb5['attributes'],'include':_0x49bcb5[_0x3bf1('0x1c')]?_[_0x3bf1('0x1e')](_0x49bcb5['include'],function(_0x4dc3ce){return{'model':db[_0x4dc3ce[_0x3bf1('0x1d')]],'as':_0x4dc3ce['as'],'attributes':_0x4dc3ce[_0x3bf1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3bf1('0xc')](function(_0x45b204){logger['info'](_0x3bf1('0x15'),_0x5cf15b);logger[_0x3bf1('0x1f')]('GetZohoAccount',_0x5cf15b,JSON[_0x3bf1('0x10')](_0x45b204));_0x96ad97(_0x45b204);})[_0x3bf1('0x14')](function(_0x3bad13){logger[_0x3bf1('0x11')](_0x3bf1('0x15'),_0x3bad13[_0x3bf1('0x12')],_0x5cf15b);_0x2b6fe1(_0x50df9e['error'](0x1f4,_0x3bad13[_0x3bf1('0x12')]));});});};exports['ShowZohoAccount']=function(_0x1c5e7b){var _0x4de023=this;return new Promise(function(_0x57be3c,_0x57c658){return db[_0x3bf1('0x16')][_0x3bf1('0x20')]({'raw':_0x1c5e7b[_0x3bf1('0x17')]?_0x1c5e7b['options'][_0x3bf1('0x18')]===undefined?!![]:![]:!![],'where':_0x1c5e7b[_0x3bf1('0x17')]?_0x1c5e7b[_0x3bf1('0x17')][_0x3bf1('0x19')]||null:null,'attributes':_0x1c5e7b[_0x3bf1('0x17')]?_0x1c5e7b['options']['attributes']||null:null,'include':_0x1c5e7b['options']?_0x1c5e7b[_0x3bf1('0x17')][_0x3bf1('0x1c')]?_['map'](_0x1c5e7b['options'][_0x3bf1('0x1c')],function(_0x26a8ce){return{'model':db[_0x26a8ce['model']],'as':_0x26a8ce['as'],'attributes':_0x26a8ce['attributes'],'include':_0x26a8ce['include']?_[_0x3bf1('0x1e')](_0x26a8ce[_0x3bf1('0x1c')],function(_0x501228){return{'model':db[_0x501228[_0x3bf1('0x1d')]],'as':_0x501228['as'],'attributes':_0x501228[_0x3bf1('0x1a')],'include':_0x501228[_0x3bf1('0x1c')]?_[_0x3bf1('0x1e')](_0x501228[_0x3bf1('0x1c')],function(_0x362a10){return{'model':db[_0x362a10[_0x3bf1('0x1d')]],'as':_0x362a10['as'],'attributes':_0x362a10[_0x3bf1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3bf1('0xc')](function(_0x495d0f){logger[_0x3bf1('0xd')]('ShowZohoAccount',_0x1c5e7b);logger[_0x3bf1('0x1f')](_0x3bf1('0x21'),_0x1c5e7b,JSON[_0x3bf1('0x10')](_0x495d0f));_0x57be3c(_0x495d0f);})[_0x3bf1('0x14')](function(_0x3ab1ba){logger[_0x3bf1('0x11')]('ShowZohoAccount',_0x3ab1ba[_0x3bf1('0x12')],_0x1c5e7b);_0x57c658(_0x4de023['error'](0x1f4,_0x3ab1ba[_0x3bf1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 98e29e7..9af2fae 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 _0xb3f5=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x466410,_0x4069d9){var _0x3d758e=function(_0x400fc0){while(--_0x400fc0){_0x466410['push'](_0x466410['shift']());}};_0x3d758e(++_0x4069d9);}(_0xb3f5,0x1d9));var _0x5b3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5b3f('0x0'));var util=require(_0x5b3f('0x1'));var path=require(_0x5b3f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b3f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b3f('0x4'));var config=require(_0x5b3f('0x5'));var controller=require(_0x5b3f('0x6'));router[_0x5b3f('0x7')]('/',auth[_0x5b3f('0x8')](),controller[_0x5b3f('0x9')]);router[_0x5b3f('0x7')](_0x5b3f('0xa'),auth['isAuthenticated'](),controller[_0x5b3f('0xb')]);router['get'](_0x5b3f('0xc'),auth[_0x5b3f('0x8')](),controller[_0x5b3f('0xd')]);router[_0x5b3f('0x7')](_0x5b3f('0xe'),auth['isAuthenticated'](),controller[_0x5b3f('0xf')]);router[_0x5b3f('0x7')](_0x5b3f('0x10'),auth[_0x5b3f('0x8')](),controller[_0x5b3f('0x11')]);router[_0x5b3f('0x12')]('/',auth['isAuthenticated'](),controller[_0x5b3f('0x13')]);router[_0x5b3f('0x14')]('/:id',auth[_0x5b3f('0x8')](),controller[_0x5b3f('0x15')]);router['delete'](_0x5b3f('0xa'),auth[_0x5b3f('0x8')](),controller[_0x5b3f('0x16')]);module[_0x5b3f('0x17')]=router; \ No newline at end of file +var _0x677b=['/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create'];(function(_0x153546,_0x4f714a){var _0x41295=function(_0x32b2e1){while(--_0x32b2e1){_0x153546['push'](_0x153546['shift']());}};_0x41295(++_0x4f714a);}(_0x677b,0x82));var _0xb677=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x677b[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xb677('0x0'));var util=require(_0xb677('0x1'));var path=require('path');var timeout=require(_0xb677('0x2'));var express=require(_0xb677('0x3'));var router=express[_0xb677('0x4')]();var fs_extra=require(_0xb677('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb677('0x6'));var controller=require(_0xb677('0x7'));router[_0xb677('0x8')]('/',auth[_0xb677('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb677('0xa')]);router[_0xb677('0x8')](_0xb677('0xb'),auth[_0xb677('0x9')](),controller[_0xb677('0xc')]);router[_0xb677('0x8')](_0xb677('0xd'),auth[_0xb677('0x9')](),controller[_0xb677('0xe')]);router['get'](_0xb677('0xf'),auth[_0xb677('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xb677('0x9')](),controller[_0xb677('0x10')]);router['put'](_0xb677('0x11'),auth['isAuthenticated'](),controller[_0xb677('0x12')]);router[_0xb677('0x13')](_0xb677('0x11'),auth[_0xb677('0x9')](),controller['destroy']);module[_0xb677('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3b56927..89269f2 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 _0x1a31=['nothing','lead','contact_lead','STRING','ENUM','contact'];(function(_0x417650,_0x38cd90){var _0x1d6087=function(_0x5d82e2){while(--_0x5d82e2){_0x417650['push'](_0x417650['shift']());}};_0x1d6087(++_0x38cd90);}(_0x1a31,0xca));var _0x11a3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1a31[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x11a3('0x0')]('lead',_0x11a3('0x1'),_0x11a3('0x2')),'defaultValue':_0x11a3('0x3')},'moduleSearch':{'type':Sequelize[_0x11a3('0x0')](_0x11a3('0x4'),'contact',_0x11a3('0x3')),'defaultValue':_0x11a3('0x4')},'description':{'type':Sequelize[_0x11a3('0x5')]}}; \ No newline at end of file +var _0x214c=['contact_lead','sequelize','exports','STRING','lead','contact','nothing','ENUM'];(function(_0x299efe,_0x3576d3){var _0x433c12=function(_0x5420c6){while(--_0x5420c6){_0x299efe['push'](_0x299efe['shift']());}};_0x433c12(++_0x3576d3);}(_0x214c,0x169));var _0xc214=function(_0x200111,_0x548ed1){_0x200111=_0x200111-0x0;var _0x223060=_0x214c[_0x200111];return _0x223060;};'use strict';var Sequelize=require(_0xc214('0x0'));module[_0xc214('0x1')]={'name':{'type':Sequelize[_0xc214('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc214('0x3'),_0xc214('0x4'),_0xc214('0x5')),'defaultValue':_0xc214('0x3')},'moduleSearch':{'type':Sequelize[_0xc214('0x6')](_0xc214('0x7'),_0xc214('0x4'),_0xc214('0x3')),'defaultValue':_0xc214('0x7')},'description':{'type':Sequelize[_0xc214('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b29dde1..1123677 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 _0xabda=['includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ZohoField','merge','nolimit','getSubjects','getDescriptions','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','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','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','filter','options'];(function(_0x1f7aad,_0x370587){var _0x3ffaf=function(_0x4430bf){while(--_0x4430bf){_0x1f7aad['push'](_0x1f7aad['shift']());}};_0x3ffaf(++_0x370587);}(_0xabda,0x15a));var _0xaabd=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xabda[_0x5c6299];return _0x23b564;};'use strict';var emlformat=require(_0xaabd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaabd('0x1'));var jsonpatch=require(_0xaabd('0x2'));var rp=require(_0xaabd('0x3'));var moment=require(_0xaabd('0x4'));var BPromise=require(_0xaabd('0x5'));var Mustache=require(_0xaabd('0x6'));var util=require(_0xaabd('0x7'));var path=require(_0xaabd('0x8'));var sox=require(_0xaabd('0x9'));var csv=require(_0xaabd('0xa'));var ejs=require(_0xaabd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaabd('0xc'));var crypto=require('crypto');var jsforce=require(_0xaabd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaabd('0xe'));var Papa=require(_0xaabd('0xf'));var Redis=require(_0xaabd('0x10'));var authService=require(_0xaabd('0x11'));var qs=require(_0xaabd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaabd('0x13'));var logger=require(_0xaabd('0x14'))(_0xaabd('0x15'));var utils=require(_0xaabd('0x16'));var config=require(_0xaabd('0x17'));var licenseUtil=require(_0xaabd('0x18'));var db=require(_0xaabd('0x19'))['db'];function respondWithStatusCode(_0x27e761,_0xc5c4ca){_0xc5c4ca=_0xc5c4ca||0xcc;return function(_0x24d449){if(_0x24d449){return _0x27e761[_0xaabd('0x1a')](_0xc5c4ca);}return _0x27e761[_0xaabd('0x1b')](_0xc5c4ca)[_0xaabd('0x1c')]();};}function respondWithResult(_0x4703f1,_0x6e9569){_0x6e9569=_0x6e9569||0xc8;return function(_0x178702){if(_0x178702){return _0x4703f1[_0xaabd('0x1b')](_0x6e9569)[_0xaabd('0x1d')](_0x178702);}};}function respondWithFilteredResult(_0x195c6f,_0x230b0f){return function(_0x58abe6){if(_0x58abe6){var _0x3dfdaa=typeof _0x230b0f[_0xaabd('0x1e')]===_0xaabd('0x1f')&&typeof _0x230b0f['limit']===_0xaabd('0x1f');var _0x261585=_0x58abe6[_0xaabd('0x20')];var _0x41249e=_0x3dfdaa?0x0:_0x230b0f[_0xaabd('0x1e')];var _0x8dd4e3=_0x3dfdaa?_0x58abe6['count']:_0x230b0f[_0xaabd('0x1e')]+_0x230b0f['limit'];var _0x42d3d6;if(_0x8dd4e3>=_0x261585){_0x8dd4e3=_0x261585;_0x42d3d6=0xc8;}else{_0x42d3d6=0xce;}_0x195c6f['status'](_0x42d3d6);return _0x195c6f['set'](_0xaabd('0x21'),_0x41249e+'-'+_0x8dd4e3+'/'+_0x261585)[_0xaabd('0x1d')](_0x58abe6);}return null;};}function patchUpdates(_0x1f8ce5){return function(_0x37c7d8){try{jsonpatch[_0xaabd('0x22')](_0x37c7d8,_0x1f8ce5,!![]);}catch(_0x31a951){return BPromise[_0xaabd('0x23')](_0x31a951);}return _0x37c7d8['save']();};}function saveUpdates(_0xe62f81,_0x4c87ad){return function(_0x21416a){if(_0x21416a){return _0x21416a['update'](_0xe62f81)['then'](function(_0x2206c3){return _0x2206c3;});}return null;};}function removeEntity(_0x5918eb,_0x52b6d7){return function(_0x40cd58){if(_0x40cd58){return _0x40cd58[_0xaabd('0x24')]()[_0xaabd('0x25')](function(){_0x5918eb[_0xaabd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378209,_0x3254b3){return function(_0x396546){if(!_0x396546){_0x378209['sendStatus'](0x194);}return _0x396546;};}function handleError(_0x594451,_0x3ce50a){_0x3ce50a=_0x3ce50a||0x1f4;return function(_0x22fad3){logger[_0xaabd('0x26')](_0x22fad3[_0xaabd('0x27')]);if(_0x22fad3[_0xaabd('0x28')]){delete _0x22fad3[_0xaabd('0x28')];}_0x594451[_0xaabd('0x1b')](_0x3ce50a)[_0xaabd('0x29')](_0x22fad3);};}exports[_0xaabd('0x2a')]=function(_0x467f78,_0x35cd43){var _0x7b780c={},_0x41ac40={},_0x595525={'count':0x0,'rows':[]};var _0x23ecc4=_[_0xaabd('0x2b')](db[_0xaabd('0x2c')][_0xaabd('0x2d')],function(_0xf5ce13){return{'name':_0xf5ce13[_0xaabd('0x2e')],'type':_0xf5ce13[_0xaabd('0x2f')]['key']};});_0x41ac40[_0xaabd('0x30')]=_[_0xaabd('0x2b')](_0x23ecc4,_0xaabd('0x28'));_0x41ac40[_0xaabd('0x31')]=_[_0xaabd('0x32')](_0x467f78[_0xaabd('0x31')]);_0x41ac40[_0xaabd('0x33')]=_[_0xaabd('0x34')](_0x41ac40[_0xaabd('0x30')],_0x41ac40[_0xaabd('0x31')]);_0x7b780c[_0xaabd('0x35')]=_[_0xaabd('0x34')](_0x41ac40[_0xaabd('0x30')],qs[_0xaabd('0x36')](_0x467f78[_0xaabd('0x31')][_0xaabd('0x36')]));_0x7b780c['attributes']=_0x7b780c[_0xaabd('0x35')][_0xaabd('0x37')]?_0x7b780c['attributes']:_0x41ac40[_0xaabd('0x30')];if(!_0x467f78['query'][_0xaabd('0x38')]('nolimit')){_0x7b780c[_0xaabd('0x39')]=qs[_0xaabd('0x39')](_0x467f78[_0xaabd('0x31')][_0xaabd('0x39')]);_0x7b780c[_0xaabd('0x1e')]=qs['offset'](_0x467f78[_0xaabd('0x31')][_0xaabd('0x1e')]);}_0x7b780c[_0xaabd('0x3a')]=qs[_0xaabd('0x3b')](_0x467f78['query']['sort']);_0x7b780c['where']=qs['filters'](_['pick'](_0x467f78[_0xaabd('0x31')],_0x41ac40[_0xaabd('0x33')]),_0x23ecc4);if(_0x467f78[_0xaabd('0x31')]['filter']){_0x7b780c[_0xaabd('0x3c')]=_['merge'](_0x7b780c[_0xaabd('0x3c')],{'$or':_[_0xaabd('0x2b')](_0x23ecc4,function(_0x5ed2fe){if(_0x5ed2fe[_0xaabd('0x2f')]!==_0xaabd('0x3d')){var _0x337df7={};_0x337df7[_0x5ed2fe[_0xaabd('0x28')]]={'$like':'%'+_0x467f78[_0xaabd('0x31')][_0xaabd('0x3e')]+'%'};return _0x337df7;}})});}_0x7b780c=_['merge']({},_0x7b780c,_0x467f78[_0xaabd('0x3f')]);var _0x5d59f9={'where':_0x7b780c[_0xaabd('0x3c')]};return db[_0xaabd('0x2c')]['count'](_0x5d59f9)[_0xaabd('0x25')](function(_0x58d4a4){_0x595525[_0xaabd('0x20')]=_0x58d4a4;if(_0x467f78['query'][_0xaabd('0x40')]){_0x7b780c[_0xaabd('0x41')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xaabd('0x42')](_0x7b780c);})['then'](function(_0x9b6687){_0x595525[_0xaabd('0x43')]=_0x9b6687;return _0x595525;})[_0xaabd('0x25')](respondWithFilteredResult(_0x35cd43,_0x7b780c))['catch'](handleError(_0x35cd43,null));};exports[_0xaabd('0x44')]=function(_0x92773d,_0x419be){var _0x54abfb={'raw':![],'where':{'id':_0x92773d[_0xaabd('0x45')]['id']}},_0x4b3511={};_0x4b3511[_0xaabd('0x30')]=_['keys'](db['ZohoConfiguration'][_0xaabd('0x2d')]);_0x4b3511[_0xaabd('0x31')]=_[_0xaabd('0x32')](_0x92773d[_0xaabd('0x31')]);_0x4b3511[_0xaabd('0x33')]=_[_0xaabd('0x34')](_0x4b3511[_0xaabd('0x30')],_0x4b3511[_0xaabd('0x31')]);_0x54abfb['attributes']=_[_0xaabd('0x34')](_0x4b3511[_0xaabd('0x30')],qs[_0xaabd('0x36')](_0x92773d[_0xaabd('0x31')]['fields']));_0x54abfb['attributes']=_0x54abfb['attributes'][_0xaabd('0x37')]?_0x54abfb[_0xaabd('0x35')]:_0x4b3511['model'];if(_0x92773d[_0xaabd('0x31')][_0xaabd('0x40')]){_0x54abfb[_0xaabd('0x41')]=[{'all':!![]}];}_0x54abfb=_['merge']({},_0x54abfb,_0x92773d[_0xaabd('0x3f')]);return db['ZohoConfiguration'][_0xaabd('0x46')](_0x54abfb)[_0xaabd('0x25')](handleEntityNotFound(_0x419be,null))[_0xaabd('0x25')](respondWithResult(_0x419be,null))[_0xaabd('0x47')](handleError(_0x419be,null));};exports[_0xaabd('0x48')]=function(_0x33f5a3,_0x3bfbc9){return db[_0xaabd('0x2c')][_0xaabd('0x48')](_0x33f5a3[_0xaabd('0x49')],{})[_0xaabd('0x25')](respondWithResult(_0x3bfbc9,0xc9))['catch'](handleError(_0x3bfbc9,null));};exports['update']=function(_0xbcf07,_0x1508fa){if(_0xbcf07[_0xaabd('0x49')]['id']){delete _0xbcf07['body']['id'];}return db[_0xaabd('0x2c')][_0xaabd('0x46')]({'where':{'id':_0xbcf07[_0xaabd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1508fa,null))[_0xaabd('0x25')](saveUpdates(_0xbcf07[_0xaabd('0x49')],null))[_0xaabd('0x25')](respondWithResult(_0x1508fa,null))['catch'](handleError(_0x1508fa,null));};exports['destroy']=function(_0x4954b7,_0x2fc0d5){return db[_0xaabd('0x2c')][_0xaabd('0x46')]({'where':{'id':_0x4954b7[_0xaabd('0x45')]['id']}})[_0xaabd('0x25')](handleEntityNotFound(_0x2fc0d5,null))[_0xaabd('0x25')](removeEntity(_0x2fc0d5,null))[_0xaabd('0x47')](handleError(_0x2fc0d5,null));};exports[_0xaabd('0x4a')]=function(_0x38d020,_0x5aa930,_0x31a2ba){var _0x1af6a1={};var _0x5b5e78={};var _0xd83019;var _0xf29e51;return db[_0xaabd('0x2c')][_0xaabd('0x4b')]({'where':{'id':_0x38d020[_0xaabd('0x45')]['id']}})[_0xaabd('0x25')](handleEntityNotFound(_0x5aa930,null))['then'](function(_0x1dcbc0){if(_0x1dcbc0){_0xd83019=_0x1dcbc0;_0x5b5e78[_0xaabd('0x30')]=_[_0xaabd('0x32')](db[_0xaabd('0x4c')]['rawAttributes']);_0x5b5e78['query']=_[_0xaabd('0x32')](_0x38d020[_0xaabd('0x31')]);_0x5b5e78[_0xaabd('0x33')]=_[_0xaabd('0x34')](_0x5b5e78[_0xaabd('0x30')],_0x5b5e78[_0xaabd('0x31')]);_0x1af6a1[_0xaabd('0x35')]=_[_0xaabd('0x34')](_0x5b5e78[_0xaabd('0x30')],qs['fields'](_0x38d020[_0xaabd('0x31')]['fields']));_0x1af6a1[_0xaabd('0x35')]=_0x1af6a1[_0xaabd('0x35')][_0xaabd('0x37')]?_0x1af6a1[_0xaabd('0x35')]:_0x5b5e78[_0xaabd('0x30')];_0x1af6a1[_0xaabd('0x3a')]=qs[_0xaabd('0x3b')](_0x38d020[_0xaabd('0x31')][_0xaabd('0x3b')]);_0x1af6a1[_0xaabd('0x3c')]=qs[_0xaabd('0x33')](_['pick'](_0x38d020[_0xaabd('0x31')],_0x5b5e78[_0xaabd('0x33')]));if(_0x38d020[_0xaabd('0x31')][_0xaabd('0x3e')]){_0x1af6a1[_0xaabd('0x3c')]=_['merge'](_0x1af6a1[_0xaabd('0x3c')],{'$or':_['map'](_0x1af6a1[_0xaabd('0x35')],function(_0x26a297){var _0x27afb9={};_0x27afb9[_0x26a297]={'$like':'%'+_0x38d020[_0xaabd('0x31')][_0xaabd('0x3e')]+'%'};return _0x27afb9;})});}_0x1af6a1=_[_0xaabd('0x4d')]({},_0x1af6a1,_0x38d020[_0xaabd('0x3f')]);return _0xd83019[_0xaabd('0x4a')](_0x1af6a1);}})[_0xaabd('0x25')](function(_0xa2cf47){if(_0xa2cf47){_0xf29e51=_0xa2cf47['length'];if(!_0x38d020['query'][_0xaabd('0x38')](_0xaabd('0x4e'))){_0x1af6a1[_0xaabd('0x39')]=qs['limit'](_0x38d020[_0xaabd('0x31')]['limit']);_0x1af6a1[_0xaabd('0x1e')]=qs[_0xaabd('0x1e')](_0x38d020[_0xaabd('0x31')][_0xaabd('0x1e')]);}return _0xd83019[_0xaabd('0x4a')](_0x1af6a1);}})[_0xaabd('0x25')](function(_0x1c1dba){if(_0x1c1dba){return _0x1c1dba?{'count':_0xf29e51,'rows':_0x1c1dba}:null;}})[_0xaabd('0x25')](respondWithResult(_0x5aa930,null))['catch'](handleError(_0x5aa930,null));};exports[_0xaabd('0x4f')]=function(_0x5c4b13,_0x332613,_0x53dc34){var _0x508efb={};var _0x6cfdff={};var _0x155e4e;var _0x587b18;return db[_0xaabd('0x2c')][_0xaabd('0x4b')]({'where':{'id':_0x5c4b13[_0xaabd('0x45')]['id']}})[_0xaabd('0x25')](handleEntityNotFound(_0x332613,null))[_0xaabd('0x25')](function(_0x4c338a){if(_0x4c338a){_0x155e4e=_0x4c338a;_0x6cfdff[_0xaabd('0x30')]=_[_0xaabd('0x32')](db[_0xaabd('0x4c')][_0xaabd('0x2d')]);_0x6cfdff[_0xaabd('0x31')]=_[_0xaabd('0x32')](_0x5c4b13['query']);_0x6cfdff[_0xaabd('0x33')]=_['intersection'](_0x6cfdff[_0xaabd('0x30')],_0x6cfdff[_0xaabd('0x31')]);_0x508efb['attributes']=_[_0xaabd('0x34')](_0x6cfdff[_0xaabd('0x30')],qs[_0xaabd('0x36')](_0x5c4b13[_0xaabd('0x31')][_0xaabd('0x36')]));_0x508efb[_0xaabd('0x35')]=_0x508efb[_0xaabd('0x35')][_0xaabd('0x37')]?_0x508efb[_0xaabd('0x35')]:_0x6cfdff['model'];_0x508efb[_0xaabd('0x3a')]=qs[_0xaabd('0x3b')](_0x5c4b13[_0xaabd('0x31')][_0xaabd('0x3b')]);_0x508efb[_0xaabd('0x3c')]=qs[_0xaabd('0x33')](_['pick'](_0x5c4b13[_0xaabd('0x31')],_0x6cfdff[_0xaabd('0x33')]));if(_0x5c4b13[_0xaabd('0x31')][_0xaabd('0x3e')]){_0x508efb[_0xaabd('0x3c')]=_[_0xaabd('0x4d')](_0x508efb[_0xaabd('0x3c')],{'$or':_[_0xaabd('0x2b')](_0x508efb[_0xaabd('0x35')],function(_0x4f3ffa){var _0x10f69b={};_0x10f69b[_0x4f3ffa]={'$like':'%'+_0x5c4b13[_0xaabd('0x31')][_0xaabd('0x3e')]+'%'};return _0x10f69b;})});}_0x508efb=_['merge']({},_0x508efb,_0x5c4b13[_0xaabd('0x3f')]);return _0x155e4e[_0xaabd('0x4f')](_0x508efb);}})[_0xaabd('0x25')](function(_0x4b3768){if(_0x4b3768){_0x587b18=_0x4b3768['length'];if(!_0x5c4b13['query'][_0xaabd('0x38')](_0xaabd('0x4e'))){_0x508efb['limit']=qs[_0xaabd('0x39')](_0x5c4b13['query']['limit']);_0x508efb['offset']=qs[_0xaabd('0x1e')](_0x5c4b13[_0xaabd('0x31')][_0xaabd('0x1e')]);}return _0x155e4e[_0xaabd('0x4f')](_0x508efb);}})[_0xaabd('0x25')](function(_0x100a6a){if(_0x100a6a){return _0x100a6a?{'count':_0x587b18,'rows':_0x100a6a}:null;}})[_0xaabd('0x25')](respondWithResult(_0x332613,null))[_0xaabd('0x47')](handleError(_0x332613,null));};exports[_0xaabd('0x50')]=function(_0xf6c224,_0x1d814d,_0xba2d71){var _0xe6ef6c={};var _0xbfba07={};var _0x55ce2f;var _0x37179f;return db[_0xaabd('0x2c')][_0xaabd('0x4b')]({'where':{'id':_0xf6c224[_0xaabd('0x45')]['id']}})[_0xaabd('0x25')](handleEntityNotFound(_0x1d814d,null))[_0xaabd('0x25')](function(_0x4ab14f){if(_0x4ab14f){_0x55ce2f=_0x4ab14f;_0xbfba07['model']=_[_0xaabd('0x32')](db[_0xaabd('0x4c')][_0xaabd('0x2d')]);_0xbfba07[_0xaabd('0x31')]=_[_0xaabd('0x32')](_0xf6c224[_0xaabd('0x31')]);_0xbfba07[_0xaabd('0x33')]=_[_0xaabd('0x34')](_0xbfba07[_0xaabd('0x30')],_0xbfba07['query']);_0xe6ef6c['attributes']=_[_0xaabd('0x34')](_0xbfba07[_0xaabd('0x30')],qs[_0xaabd('0x36')](_0xf6c224[_0xaabd('0x31')][_0xaabd('0x36')]));_0xe6ef6c['attributes']=_0xe6ef6c[_0xaabd('0x35')][_0xaabd('0x37')]?_0xe6ef6c[_0xaabd('0x35')]:_0xbfba07['model'];_0xe6ef6c[_0xaabd('0x3a')]=qs['sort'](_0xf6c224[_0xaabd('0x31')]['sort']);_0xe6ef6c['where']=qs['filters'](_[_0xaabd('0x51')](_0xf6c224[_0xaabd('0x31')],_0xbfba07[_0xaabd('0x33')]));if(_0xf6c224['query']['filter']){_0xe6ef6c[_0xaabd('0x3c')]=_[_0xaabd('0x4d')](_0xe6ef6c[_0xaabd('0x3c')],{'$or':_[_0xaabd('0x2b')](_0xe6ef6c[_0xaabd('0x35')],function(_0x8144d0){var _0x4a9656={};_0x4a9656[_0x8144d0]={'$like':'%'+_0xf6c224[_0xaabd('0x31')][_0xaabd('0x3e')]+'%'};return _0x4a9656;})});}_0xe6ef6c=_[_0xaabd('0x4d')]({},_0xe6ef6c,_0xf6c224[_0xaabd('0x3f')]);return _0x55ce2f[_0xaabd('0x50')](_0xe6ef6c);}})[_0xaabd('0x25')](function(_0x361bd0){if(_0x361bd0){_0x37179f=_0x361bd0[_0xaabd('0x37')];if(!_0xf6c224[_0xaabd('0x31')][_0xaabd('0x38')](_0xaabd('0x4e'))){_0xe6ef6c[_0xaabd('0x39')]=qs[_0xaabd('0x39')](_0xf6c224[_0xaabd('0x31')]['limit']);_0xe6ef6c[_0xaabd('0x1e')]=qs[_0xaabd('0x1e')](_0xf6c224[_0xaabd('0x31')][_0xaabd('0x1e')]);}return _0x55ce2f[_0xaabd('0x50')](_0xe6ef6c);}})[_0xaabd('0x25')](function(_0x58ed5a){if(_0x58ed5a){return _0x58ed5a?{'count':_0x37179f,'rows':_0x58ed5a}:null;}})[_0xaabd('0x25')](respondWithResult(_0x1d814d,null))[_0xaabd('0x47')](handleError(_0x1d814d,null));}; \ No newline at end of file +var _0x3895=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','update','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','then','include','findAll','rows','catch','show','includeAll','find','create','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5a0dec,_0x5b4855){var _0xff1429=function(_0x13128a){while(--_0x13128a){_0x5a0dec['push'](_0x5a0dec['shift']());}};_0xff1429(++_0x5b4855);}(_0x3895,0xd9));var _0x5389=function(_0x159f6c,_0x3f5415){_0x159f6c=_0x159f6c-0x0;var _0x58ef06=_0x3895[_0x159f6c];return _0x58ef06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5389('0x0'));var zipdir=require(_0x5389('0x1'));var jsonpatch=require(_0x5389('0x2'));var rp=require(_0x5389('0x3'));var moment=require('moment');var BPromise=require(_0x5389('0x4'));var Mustache=require(_0x5389('0x5'));var util=require(_0x5389('0x6'));var path=require(_0x5389('0x7'));var sox=require('sox');var csv=require(_0x5389('0x8'));var ejs=require(_0x5389('0x9'));var fs=require('fs');var fs_extra=require(_0x5389('0xa'));var _=require(_0x5389('0xb'));var squel=require('squel');var crypto=require(_0x5389('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5389('0xd'));var toCsv=require(_0x5389('0x8'));var querystring=require(_0x5389('0xe'));var Papa=require('papaparse');var Redis=require(_0x5389('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5389('0x10'));var as=require(_0x5389('0x11'));var hardwareService=require(_0x5389('0x12'));var logger=require(_0x5389('0x13'))(_0x5389('0x14'));var utils=require(_0x5389('0x15'));var config=require(_0x5389('0x16'));var licenseUtil=require(_0x5389('0x17'));var db=require(_0x5389('0x18'))['db'];function respondWithStatusCode(_0x3de9d0,_0x1ecac6){_0x1ecac6=_0x1ecac6||0xcc;return function(_0x311cd4){if(_0x311cd4){return _0x3de9d0[_0x5389('0x19')](_0x1ecac6);}return _0x3de9d0[_0x5389('0x1a')](_0x1ecac6)[_0x5389('0x1b')]();};}function respondWithResult(_0x50909a,_0x3b5e13){_0x3b5e13=_0x3b5e13||0xc8;return function(_0x3d3e8e){if(_0x3d3e8e){return _0x50909a['status'](_0x3b5e13)['json'](_0x3d3e8e);}};}function respondWithFilteredResult(_0xcb0212,_0x4878a6){return function(_0x2b2dbd){if(_0x2b2dbd){var _0x467bbe=typeof _0x4878a6['offset']===_0x5389('0x1c')&&typeof _0x4878a6[_0x5389('0x1d')]===_0x5389('0x1c');var _0x22332d=_0x2b2dbd[_0x5389('0x1e')];var _0x2355ab=_0x467bbe?0x0:_0x4878a6[_0x5389('0x1f')];var _0x9665c6=_0x467bbe?_0x2b2dbd[_0x5389('0x1e')]:_0x4878a6[_0x5389('0x1f')]+_0x4878a6[_0x5389('0x1d')];var _0x5d09ca;if(_0x9665c6>=_0x22332d){_0x9665c6=_0x22332d;_0x5d09ca=0xc8;}else{_0x5d09ca=0xce;}_0xcb0212[_0x5389('0x1a')](_0x5d09ca);return _0xcb0212[_0x5389('0x20')]('Content-Range',_0x2355ab+'-'+_0x9665c6+'/'+_0x22332d)['json'](_0x2b2dbd);}return null;};}function patchUpdates(_0x3ea7a8){return function(_0x3c3b0c){try{jsonpatch[_0x5389('0x21')](_0x3c3b0c,_0x3ea7a8,!![]);}catch(_0x53a833){return BPromise[_0x5389('0x22')](_0x53a833);}return _0x3c3b0c[_0x5389('0x23')]();};}function saveUpdates(_0x467682,_0x10c2b8){return function(_0x4fc118){if(_0x4fc118){return _0x4fc118[_0x5389('0x24')](_0x467682)['then'](function(_0x5948b5){return _0x5948b5;});}return null;};}function removeEntity(_0x348886,_0x883073){return function(_0x493f41){if(_0x493f41){return _0x493f41[_0x5389('0x25')]()['then'](function(){_0x348886[_0x5389('0x1a')](0xcc)[_0x5389('0x1b')]();});}};}function handleEntityNotFound(_0x3dec47,_0x515685){return function(_0x53ebf7){if(!_0x53ebf7){_0x3dec47[_0x5389('0x19')](0x194);}return _0x53ebf7;};}function handleError(_0x526f97,_0x17aca6){_0x17aca6=_0x17aca6||0x1f4;return function(_0x501c7f){logger['error'](_0x501c7f[_0x5389('0x26')]);if(_0x501c7f[_0x5389('0x27')]){delete _0x501c7f[_0x5389('0x27')];}_0x526f97[_0x5389('0x1a')](_0x17aca6)['send'](_0x501c7f);};}exports[_0x5389('0x28')]=function(_0x9a259c,_0x12be7e){var _0xb94a10={},_0x11107e={},_0x50554b={'count':0x0,'rows':[]};var _0x3bbcf3=_[_0x5389('0x29')](db[_0x5389('0x2a')][_0x5389('0x2b')],function(_0x419ff3){return{'name':_0x419ff3[_0x5389('0x2c')],'type':_0x419ff3['type'][_0x5389('0x2d')]};});_0x11107e['model']=_[_0x5389('0x29')](_0x3bbcf3,_0x5389('0x27'));_0x11107e[_0x5389('0x2e')]=_[_0x5389('0x2f')](_0x9a259c[_0x5389('0x2e')]);_0x11107e['filters']=_[_0x5389('0x30')](_0x11107e[_0x5389('0x31')],_0x11107e[_0x5389('0x2e')]);_0xb94a10['attributes']=_[_0x5389('0x30')](_0x11107e[_0x5389('0x31')],qs[_0x5389('0x32')](_0x9a259c['query']['fields']));_0xb94a10[_0x5389('0x33')]=_0xb94a10[_0x5389('0x33')][_0x5389('0x34')]?_0xb94a10['attributes']:_0x11107e[_0x5389('0x31')];if(!_0x9a259c['query'][_0x5389('0x35')](_0x5389('0x36'))){_0xb94a10[_0x5389('0x1d')]=qs[_0x5389('0x1d')](_0x9a259c[_0x5389('0x2e')][_0x5389('0x1d')]);_0xb94a10[_0x5389('0x1f')]=qs['offset'](_0x9a259c[_0x5389('0x2e')][_0x5389('0x1f')]);}_0xb94a10[_0x5389('0x37')]=qs['sort'](_0x9a259c[_0x5389('0x2e')][_0x5389('0x38')]);_0xb94a10[_0x5389('0x39')]=qs['filters'](_[_0x5389('0x3a')](_0x9a259c[_0x5389('0x2e')],_0x11107e[_0x5389('0x3b')]),_0x3bbcf3);if(_0x9a259c[_0x5389('0x2e')]['filter']){_0xb94a10[_0x5389('0x39')]=_[_0x5389('0x3c')](_0xb94a10[_0x5389('0x39')],{'$or':_[_0x5389('0x29')](_0x3bbcf3,function(_0x594589){if(_0x594589['type']!==_0x5389('0x3d')){var _0xe71fe4={};_0xe71fe4[_0x594589[_0x5389('0x27')]]={'$like':'%'+_0x9a259c[_0x5389('0x2e')][_0x5389('0x3e')]+'%'};return _0xe71fe4;}})});}_0xb94a10=_[_0x5389('0x3c')]({},_0xb94a10,_0x9a259c[_0x5389('0x3f')]);var _0x3efea1={'where':_0xb94a10[_0x5389('0x39')]};return db['ZohoConfiguration']['count'](_0x3efea1)[_0x5389('0x40')](function(_0x3346df){_0x50554b[_0x5389('0x1e')]=_0x3346df;if(_0x9a259c[_0x5389('0x2e')]['includeAll']){_0xb94a10[_0x5389('0x41')]=[{'all':!![]}];}return db[_0x5389('0x2a')][_0x5389('0x42')](_0xb94a10);})[_0x5389('0x40')](function(_0x2267cf){_0x50554b[_0x5389('0x43')]=_0x2267cf;return _0x50554b;})['then'](respondWithFilteredResult(_0x12be7e,_0xb94a10))[_0x5389('0x44')](handleError(_0x12be7e,null));};exports[_0x5389('0x45')]=function(_0x5d3208,_0x5ef4b5){var _0xbf2b7={'raw':![],'where':{'id':_0x5d3208['params']['id']}},_0x8340e8={};_0x8340e8[_0x5389('0x31')]=_[_0x5389('0x2f')](db['ZohoConfiguration'][_0x5389('0x2b')]);_0x8340e8[_0x5389('0x2e')]=_['keys'](_0x5d3208[_0x5389('0x2e')]);_0x8340e8[_0x5389('0x3b')]=_[_0x5389('0x30')](_0x8340e8[_0x5389('0x31')],_0x8340e8[_0x5389('0x2e')]);_0xbf2b7[_0x5389('0x33')]=_[_0x5389('0x30')](_0x8340e8['model'],qs['fields'](_0x5d3208[_0x5389('0x2e')][_0x5389('0x32')]));_0xbf2b7[_0x5389('0x33')]=_0xbf2b7['attributes'][_0x5389('0x34')]?_0xbf2b7[_0x5389('0x33')]:_0x8340e8['model'];if(_0x5d3208[_0x5389('0x2e')][_0x5389('0x46')]){_0xbf2b7['include']=[{'all':!![]}];}_0xbf2b7=_[_0x5389('0x3c')]({},_0xbf2b7,_0x5d3208[_0x5389('0x3f')]);return db['ZohoConfiguration'][_0x5389('0x47')](_0xbf2b7)[_0x5389('0x40')](handleEntityNotFound(_0x5ef4b5,null))['then'](respondWithResult(_0x5ef4b5,null))[_0x5389('0x44')](handleError(_0x5ef4b5,null));};exports[_0x5389('0x48')]=function(_0x5ad2b9,_0x184677){return db['ZohoConfiguration'][_0x5389('0x48')](_0x5ad2b9[_0x5389('0x49')],{})[_0x5389('0x40')](respondWithResult(_0x184677,0xc9))[_0x5389('0x44')](handleError(_0x184677,null));};exports['update']=function(_0x1780df,_0x350a4c){if(_0x1780df['body']['id']){delete _0x1780df[_0x5389('0x49')]['id'];}return db['ZohoConfiguration'][_0x5389('0x47')]({'where':{'id':_0x1780df[_0x5389('0x4a')]['id']}})['then'](handleEntityNotFound(_0x350a4c,null))['then'](saveUpdates(_0x1780df[_0x5389('0x49')],null))[_0x5389('0x40')](respondWithResult(_0x350a4c,null))[_0x5389('0x44')](handleError(_0x350a4c,null));};exports[_0x5389('0x25')]=function(_0x821034,_0x1a2163){return db[_0x5389('0x2a')]['find']({'where':{'id':_0x821034[_0x5389('0x4a')]['id']}})[_0x5389('0x40')](handleEntityNotFound(_0x1a2163,null))[_0x5389('0x40')](removeEntity(_0x1a2163,null))['catch'](handleError(_0x1a2163,null));};exports[_0x5389('0x4b')]=function(_0x317392,_0x22530c,_0x207984){var _0x1841a3={};var _0x18011f={};var _0x134338;var _0x121326;return db[_0x5389('0x2a')][_0x5389('0x4c')]({'where':{'id':_0x317392[_0x5389('0x4a')]['id']}})[_0x5389('0x40')](handleEntityNotFound(_0x22530c,null))['then'](function(_0xa64f7d){if(_0xa64f7d){_0x134338=_0xa64f7d;_0x18011f['model']=_[_0x5389('0x2f')](db[_0x5389('0x4d')]['rawAttributes']);_0x18011f[_0x5389('0x2e')]=_[_0x5389('0x2f')](_0x317392[_0x5389('0x2e')]);_0x18011f['filters']=_[_0x5389('0x30')](_0x18011f['model'],_0x18011f[_0x5389('0x2e')]);_0x1841a3['attributes']=_[_0x5389('0x30')](_0x18011f[_0x5389('0x31')],qs['fields'](_0x317392[_0x5389('0x2e')][_0x5389('0x32')]));_0x1841a3['attributes']=_0x1841a3[_0x5389('0x33')][_0x5389('0x34')]?_0x1841a3[_0x5389('0x33')]:_0x18011f['model'];_0x1841a3[_0x5389('0x37')]=qs[_0x5389('0x38')](_0x317392[_0x5389('0x2e')][_0x5389('0x38')]);_0x1841a3[_0x5389('0x39')]=qs[_0x5389('0x3b')](_['pick'](_0x317392[_0x5389('0x2e')],_0x18011f[_0x5389('0x3b')]));if(_0x317392[_0x5389('0x2e')][_0x5389('0x3e')]){_0x1841a3[_0x5389('0x39')]=_[_0x5389('0x3c')](_0x1841a3[_0x5389('0x39')],{'$or':_[_0x5389('0x29')](_0x1841a3[_0x5389('0x33')],function(_0x25e6d5){var _0x9fe5bf={};_0x9fe5bf[_0x25e6d5]={'$like':'%'+_0x317392[_0x5389('0x2e')][_0x5389('0x3e')]+'%'};return _0x9fe5bf;})});}_0x1841a3=_[_0x5389('0x3c')]({},_0x1841a3,_0x317392[_0x5389('0x3f')]);return _0x134338['getFields'](_0x1841a3);}})[_0x5389('0x40')](function(_0x11c5b6){if(_0x11c5b6){_0x121326=_0x11c5b6[_0x5389('0x34')];if(!_0x317392[_0x5389('0x2e')][_0x5389('0x35')](_0x5389('0x36'))){_0x1841a3['limit']=qs['limit'](_0x317392[_0x5389('0x2e')][_0x5389('0x1d')]);_0x1841a3[_0x5389('0x1f')]=qs[_0x5389('0x1f')](_0x317392[_0x5389('0x2e')][_0x5389('0x1f')]);}return _0x134338['getFields'](_0x1841a3);}})[_0x5389('0x40')](function(_0x57aa1e){if(_0x57aa1e){return _0x57aa1e?{'count':_0x121326,'rows':_0x57aa1e}:null;}})[_0x5389('0x40')](respondWithResult(_0x22530c,null))[_0x5389('0x44')](handleError(_0x22530c,null));};exports[_0x5389('0x4e')]=function(_0x1c596f,_0x25cb84,_0x40d1b2){var _0x3d6a83={};var _0x45a735={};var _0x27e5b2;var _0x5a6a06;return db[_0x5389('0x2a')][_0x5389('0x4c')]({'where':{'id':_0x1c596f[_0x5389('0x4a')]['id']}})[_0x5389('0x40')](handleEntityNotFound(_0x25cb84,null))[_0x5389('0x40')](function(_0x2165cf){if(_0x2165cf){_0x27e5b2=_0x2165cf;_0x45a735[_0x5389('0x31')]=_[_0x5389('0x2f')](db['ZohoField'][_0x5389('0x2b')]);_0x45a735[_0x5389('0x2e')]=_[_0x5389('0x2f')](_0x1c596f[_0x5389('0x2e')]);_0x45a735[_0x5389('0x3b')]=_[_0x5389('0x30')](_0x45a735['model'],_0x45a735[_0x5389('0x2e')]);_0x3d6a83['attributes']=_['intersection'](_0x45a735[_0x5389('0x31')],qs[_0x5389('0x32')](_0x1c596f[_0x5389('0x2e')][_0x5389('0x32')]));_0x3d6a83[_0x5389('0x33')]=_0x3d6a83[_0x5389('0x33')][_0x5389('0x34')]?_0x3d6a83[_0x5389('0x33')]:_0x45a735['model'];_0x3d6a83[_0x5389('0x37')]=qs[_0x5389('0x38')](_0x1c596f[_0x5389('0x2e')]['sort']);_0x3d6a83[_0x5389('0x39')]=qs[_0x5389('0x3b')](_['pick'](_0x1c596f[_0x5389('0x2e')],_0x45a735[_0x5389('0x3b')]));if(_0x1c596f['query']['filter']){_0x3d6a83[_0x5389('0x39')]=_['merge'](_0x3d6a83[_0x5389('0x39')],{'$or':_['map'](_0x3d6a83[_0x5389('0x33')],function(_0x46d0e8){var _0x16b55e={};_0x16b55e[_0x46d0e8]={'$like':'%'+_0x1c596f['query'][_0x5389('0x3e')]+'%'};return _0x16b55e;})});}_0x3d6a83=_[_0x5389('0x3c')]({},_0x3d6a83,_0x1c596f[_0x5389('0x3f')]);return _0x27e5b2['getSubjects'](_0x3d6a83);}})[_0x5389('0x40')](function(_0x270482){if(_0x270482){_0x5a6a06=_0x270482[_0x5389('0x34')];if(!_0x1c596f['query'][_0x5389('0x35')](_0x5389('0x36'))){_0x3d6a83[_0x5389('0x1d')]=qs[_0x5389('0x1d')](_0x1c596f[_0x5389('0x2e')][_0x5389('0x1d')]);_0x3d6a83[_0x5389('0x1f')]=qs[_0x5389('0x1f')](_0x1c596f[_0x5389('0x2e')][_0x5389('0x1f')]);}return _0x27e5b2[_0x5389('0x4e')](_0x3d6a83);}})[_0x5389('0x40')](function(_0x494da2){if(_0x494da2){return _0x494da2?{'count':_0x5a6a06,'rows':_0x494da2}:null;}})[_0x5389('0x40')](respondWithResult(_0x25cb84,null))[_0x5389('0x44')](handleError(_0x25cb84,null));};exports[_0x5389('0x4f')]=function(_0x39ad6a,_0x26e079,_0x241903){var _0x547dc8={};var _0x564d03={};var _0x1fff99;var _0x517f50;return db['ZohoConfiguration'][_0x5389('0x4c')]({'where':{'id':_0x39ad6a[_0x5389('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26e079,null))[_0x5389('0x40')](function(_0x24f693){if(_0x24f693){_0x1fff99=_0x24f693;_0x564d03[_0x5389('0x31')]=_[_0x5389('0x2f')](db[_0x5389('0x4d')]['rawAttributes']);_0x564d03[_0x5389('0x2e')]=_['keys'](_0x39ad6a[_0x5389('0x2e')]);_0x564d03[_0x5389('0x3b')]=_[_0x5389('0x30')](_0x564d03[_0x5389('0x31')],_0x564d03[_0x5389('0x2e')]);_0x547dc8[_0x5389('0x33')]=_['intersection'](_0x564d03['model'],qs[_0x5389('0x32')](_0x39ad6a[_0x5389('0x2e')][_0x5389('0x32')]));_0x547dc8[_0x5389('0x33')]=_0x547dc8['attributes'][_0x5389('0x34')]?_0x547dc8[_0x5389('0x33')]:_0x564d03[_0x5389('0x31')];_0x547dc8['order']=qs[_0x5389('0x38')](_0x39ad6a[_0x5389('0x2e')][_0x5389('0x38')]);_0x547dc8[_0x5389('0x39')]=qs[_0x5389('0x3b')](_[_0x5389('0x3a')](_0x39ad6a['query'],_0x564d03[_0x5389('0x3b')]));if(_0x39ad6a['query']['filter']){_0x547dc8[_0x5389('0x39')]=_[_0x5389('0x3c')](_0x547dc8[_0x5389('0x39')],{'$or':_['map'](_0x547dc8[_0x5389('0x33')],function(_0x250b8c){var _0x3fb932={};_0x3fb932[_0x250b8c]={'$like':'%'+_0x39ad6a['query'][_0x5389('0x3e')]+'%'};return _0x3fb932;})});}_0x547dc8=_[_0x5389('0x3c')]({},_0x547dc8,_0x39ad6a[_0x5389('0x3f')]);return _0x1fff99['getDescriptions'](_0x547dc8);}})[_0x5389('0x40')](function(_0x51bdf4){if(_0x51bdf4){_0x517f50=_0x51bdf4[_0x5389('0x34')];if(!_0x39ad6a[_0x5389('0x2e')][_0x5389('0x35')](_0x5389('0x36'))){_0x547dc8['limit']=qs[_0x5389('0x1d')](_0x39ad6a[_0x5389('0x2e')][_0x5389('0x1d')]);_0x547dc8[_0x5389('0x1f')]=qs[_0x5389('0x1f')](_0x39ad6a['query'][_0x5389('0x1f')]);}return _0x1fff99[_0x5389('0x4f')](_0x547dc8);}})[_0x5389('0x40')](function(_0x3483a1){if(_0x3483a1){return _0x3483a1?{'count':_0x517f50,'rows':_0x3483a1}:null;}})['then'](respondWithResult(_0x26e079,null))[_0x5389('0x44')](handleError(_0x26e079,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4edbbc3..02832ab 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 _0xbeaf=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations'];(function(_0x4dc987,_0xc28e37){var _0x2e0f8f=function(_0x17f265){while(--_0x17f265){_0x4dc987['push'](_0x4dc987['shift']());}};_0x2e0f8f(++_0xc28e37);}(_0xbeaf,0x197));var _0xfbea=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbeaf[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xfbea('0x0'));var util=require('util');var logger=require(_0xfbea('0x1'))(_0xfbea('0x2'));var moment=require(_0xfbea('0x3'));var BPromise=require(_0xfbea('0x4'));var rp=require(_0xfbea('0x5'));var fs=require('fs');var path=require(_0xfbea('0x6'));var rimraf=require('rimraf');var config=require(_0xfbea('0x7'));var attributes=require(_0xfbea('0x8'));module[_0xfbea('0x9')]=function(_0xc9151b,_0x1a2bbd){return _0xc9151b['define']('ZohoConfiguration',attributes,{'tableName':_0xfbea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6053=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger'];(function(_0x54cf2e,_0x22a2e1){var _0x20ffc7=function(_0x254de5){while(--_0x254de5){_0x54cf2e['push'](_0x54cf2e['shift']());}};_0x20ffc7(++_0x22a2e1);}(_0x6053,0x166));var _0x3605=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6053[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3605('0x0'));var util=require('util');var logger=require(_0x3605('0x1'))(_0x3605('0x2'));var moment=require(_0x3605('0x3'));var BPromise=require('bluebird');var rp=require(_0x3605('0x4'));var fs=require('fs');var path=require(_0x3605('0x5'));var rimraf=require(_0x3605('0x6'));var config=require(_0x3605('0x7'));var attributes=require(_0x3605('0x8'));module['exports']=function(_0x10d421,_0x3d8032){return _0x10d421[_0x3605('0x9')](_0x3605('0xa'),attributes,{'tableName':_0x3605('0xb'),'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 5d7190b..c4065ae 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 _0xaeb9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x42bf0b,_0x465c08){var _0x3e333f=function(_0xcc97b8){while(--_0xcc97b8){_0x42bf0b['push'](_0x42bf0b['shift']());}};_0x3e333f(++_0x465c08);}(_0xaeb9,0x88));var _0x9aeb=function(_0xeb496f,_0x2f7006){_0xeb496f=_0xeb496f-0x0;var _0x28400c=_0xaeb9[_0xeb496f];return _0x28400c;};'use strict';var _=require(_0x9aeb('0x0'));var util=require(_0x9aeb('0x1'));var moment=require('moment');var BPromise=require(_0x9aeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aeb('0x3'));var db=require(_0x9aeb('0x4'))['db'];var utils=require(_0x9aeb('0x5'));var logger=require(_0x9aeb('0x6'))(_0x9aeb('0x7'));var config=require(_0x9aeb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9aeb('0x9')][_0x9aeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34f8a2,_0x2ff65c,_0x5e16f2){return new BPromise(function(_0x1091e4,_0x183765){return client[_0x9aeb('0xb')](_0x34f8a2,_0x5e16f2)[_0x9aeb('0xc')](function(_0x457321){logger[_0x9aeb('0xd')](_0x9aeb('0xe'),_0x2ff65c,_0x9aeb('0xf'));logger['debug'](_0x9aeb('0x10'),_0x2ff65c,_0x9aeb('0xf'),JSON[_0x9aeb('0x11')](_0x457321));if(_0x457321[_0x9aeb('0x12')]){if(_0x457321[_0x9aeb('0x12')][_0x9aeb('0x13')]===0x1f4){logger[_0x9aeb('0x12')](_0x9aeb('0xe'),_0x2ff65c,_0x457321[_0x9aeb('0x12')][_0x9aeb('0x14')]);return _0x183765(_0x457321[_0x9aeb('0x12')]['message']);}logger[_0x9aeb('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x2ff65c,_0x457321[_0x9aeb('0x12')]['message']);return _0x1091e4(_0x457321[_0x9aeb('0x12')][_0x9aeb('0x14')]);}else{logger[_0x9aeb('0xd')](_0x9aeb('0xe'),_0x2ff65c,'request\x20sent');_0x1091e4(_0x457321[_0x9aeb('0x15')]['message']);}})[_0x9aeb('0x16')](function(_0x3edf20){logger[_0x9aeb('0x12')](_0x9aeb('0xe'),_0x2ff65c,_0x3edf20);_0x183765(_0x3edf20);});});} \ No newline at end of file +var _0xdc50=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x12a29f,_0x526ddb){var _0x1f1b9e=function(_0x35aef7){while(--_0x35aef7){_0x12a29f['push'](_0x12a29f['shift']());}};_0x1f1b9e(++_0x526ddb);}(_0xdc50,0x15f));var _0x0dc5=function(_0x2b334f,_0x350f95){_0x2b334f=_0x2b334f-0x0;var _0x5ccf57=_0xdc50[_0x2b334f];return _0x5ccf57;};'use strict';var _=require(_0x0dc5('0x0'));var util=require(_0x0dc5('0x1'));var moment=require(_0x0dc5('0x2'));var BPromise=require(_0x0dc5('0x3'));var rs=require(_0x0dc5('0x4'));var fs=require('fs');var Redis=require(_0x0dc5('0x5'));var db=require(_0x0dc5('0x6'))['db'];var utils=require(_0x0dc5('0x7'));var logger=require(_0x0dc5('0x8'))(_0x0dc5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0dc5('0xa')][_0x0dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22577b,_0x405a07,_0x4833b6){return new BPromise(function(_0x2d2c4b,_0x41f4f7){return client[_0x0dc5('0xc')](_0x22577b,_0x4833b6)['then'](function(_0x1bbfe6){logger[_0x0dc5('0xd')](_0x0dc5('0xe'),_0x405a07,_0x0dc5('0xf'));logger['debug'](_0x0dc5('0x10'),_0x405a07,'request\x20sent',JSON['stringify'](_0x1bbfe6));if(_0x1bbfe6[_0x0dc5('0x11')]){if(_0x1bbfe6[_0x0dc5('0x11')][_0x0dc5('0x12')]===0x1f4){logger[_0x0dc5('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x405a07,_0x1bbfe6[_0x0dc5('0x11')][_0x0dc5('0x13')]);return _0x41f4f7(_0x1bbfe6[_0x0dc5('0x11')][_0x0dc5('0x13')]);}logger[_0x0dc5('0x11')](_0x0dc5('0xe'),_0x405a07,_0x1bbfe6[_0x0dc5('0x11')][_0x0dc5('0x13')]);return _0x2d2c4b(_0x1bbfe6[_0x0dc5('0x11')]['message']);}else{logger[_0x0dc5('0xd')](_0x0dc5('0xe'),_0x405a07,'request\x20sent');_0x2d2c4b(_0x1bbfe6[_0x0dc5('0x14')][_0x0dc5('0x13')]);}})[_0x0dc5('0x15')](function(_0x5ec8e8){logger[_0x0dc5('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x405a07,_0x5ec8e8);_0x41f4f7(_0x5ec8e8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c192ea8..c0ccf3e 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 _0x1d93=['/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x404616,_0x36d681){var _0x1bbf75=function(_0x1d9da3){while(--_0x1d9da3){_0x404616['push'](_0x404616['shift']());}};_0x1bbf75(++_0x36d681);}(_0x1d93,0x111));var _0x31d9=function(_0x31c981,_0x18c6c0){_0x31c981=_0x31c981-0x0;var _0x44c461=_0x1d93[_0x31c981];return _0x44c461;};'use strict';var multer=require(_0x31d9('0x0'));var util=require(_0x31d9('0x1'));var path=require(_0x31d9('0x2'));var timeout=require(_0x31d9('0x3'));var express=require(_0x31d9('0x4'));var router=express[_0x31d9('0x5')]();var fs_extra=require(_0x31d9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x31d9('0x7'));var config=require(_0x31d9('0x8'));var controller=require('./intZohoField.controller');router[_0x31d9('0x9')]('/',auth[_0x31d9('0xa')](),controller[_0x31d9('0xb')]);router['get'](_0x31d9('0xc'),auth[_0x31d9('0xa')](),controller[_0x31d9('0xd')]);router[_0x31d9('0xe')]('/',auth[_0x31d9('0xa')](),controller[_0x31d9('0xf')]);router[_0x31d9('0x10')](_0x31d9('0xc'),auth[_0x31d9('0xa')](),controller['update']);router[_0x31d9('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x31d9('0x12')]=router; \ No newline at end of file +var _0xf9c9=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util','path','express'];(function(_0x140010,_0x4d7233){var _0x373bb8=function(_0x2b6291){while(--_0x2b6291){_0x140010['push'](_0x140010['shift']());}};_0x373bb8(++_0x4d7233);}(_0xf9c9,0xb0));var _0x9f9c=function(_0x2bf76a,_0xb01832){_0x2bf76a=_0x2bf76a-0x0;var _0x1ec759=_0xf9c9[_0x2bf76a];return _0x1ec759;};'use strict';var multer=require(_0x9f9c('0x0'));var util=require(_0x9f9c('0x1'));var path=require(_0x9f9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f9c('0x3'));var router=express[_0x9f9c('0x4')]();var fs_extra=require(_0x9f9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f9c('0x6'));var config=require(_0x9f9c('0x7'));var controller=require(_0x9f9c('0x8'));router[_0x9f9c('0x9')]('/',auth[_0x9f9c('0xa')](),controller[_0x9f9c('0xb')]);router[_0x9f9c('0x9')](_0x9f9c('0xc'),auth[_0x9f9c('0xa')](),controller[_0x9f9c('0xd')]);router[_0x9f9c('0xe')]('/',auth[_0x9f9c('0xa')](),controller[_0x9f9c('0xf')]);router['put']('/:id',auth[_0x9f9c('0xa')](),controller['update']);router['delete']('/:id',auth[_0x9f9c('0xa')](),controller[_0x9f9c('0x10')]);module[_0x9f9c('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 6f62323..ac90365 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 _0x5ac7=['variable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1c9dad,_0x320f6d){var _0xaa7bca=function(_0x4ac0ed){while(--_0x4ac0ed){_0x1c9dad['push'](_0x1c9dad['shift']());}};_0xaa7bca(++_0x320f6d);}(_0x5ac7,0x125));var _0x75ac=function(_0x27d2d7,_0xb90ae6){_0x27d2d7=_0x27d2d7-0x0;var _0x52669c=_0x5ac7[_0x27d2d7];return _0x52669c;};'use strict';var Sequelize=require(_0x75ac('0x0'));module['exports']={'type':{'type':Sequelize[_0x75ac('0x1')](_0x75ac('0x2'),_0x75ac('0x3'),'customVariable',_0x75ac('0x4'),_0x75ac('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x75ac('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x75ac('0x2'),_0x75ac('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x75ac('0x6')]},'idField':{'type':Sequelize[_0x75ac('0x6')]},'nameField':{'type':Sequelize[_0x75ac('0x6')]},'customField':{'type':Sequelize[_0x75ac('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75ac('0x6')]}}; \ No newline at end of file +var _0xae88=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xae88,0x103));var _0x8ae8=function(_0x2a6d73,_0x15cf7d){_0x2a6d73=_0x2a6d73-0x0;var _0x3799c7=_0xae88[_0x2a6d73];return _0x3799c7;};'use strict';var Sequelize=require(_0x8ae8('0x0'));module[_0x8ae8('0x1')]={'type':{'type':Sequelize[_0x8ae8('0x2')]('string',_0x8ae8('0x3'),_0x8ae8('0x4'),_0x8ae8('0x5'),_0x8ae8('0x6')),'defaultValue':_0x8ae8('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8ae8('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x8ae8('0x7'),_0x8ae8('0x3'),_0x8ae8('0x4'))},'keyContent':{'type':Sequelize[_0x8ae8('0x8')]},'idField':{'type':Sequelize[_0x8ae8('0x8')]},'nameField':{'type':Sequelize[_0x8ae8('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 690fa99..2002d84 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 _0xe491=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','error','name','index','map','ZohoField','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xe491,0x156));var _0x1e49=function(_0x332741,_0x1e0b7e){_0x332741=_0x332741-0x0;var _0x509ee5=_0xe491[_0x332741];return _0x509ee5;};'use strict';var emlformat=require(_0x1e49('0x0'));var rimraf=require(_0x1e49('0x1'));var zipdir=require(_0x1e49('0x2'));var jsonpatch=require(_0x1e49('0x3'));var rp=require(_0x1e49('0x4'));var moment=require(_0x1e49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1e49('0x6'));var util=require(_0x1e49('0x7'));var path=require(_0x1e49('0x8'));var sox=require(_0x1e49('0x9'));var csv=require(_0x1e49('0xa'));var ejs=require(_0x1e49('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e49('0xc'));var squel=require(_0x1e49('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e49('0xe'));var deskjs=require(_0x1e49('0xf'));var toCsv=require(_0x1e49('0xa'));var querystring=require('querystring');var Papa=require(_0x1e49('0x10'));var Redis=require(_0x1e49('0x11'));var authService=require(_0x1e49('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1e49('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e49('0x14'))(_0x1e49('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e49('0x16'));var db=require(_0x1e49('0x17'))['db'];function respondWithStatusCode(_0x15eb81,_0x4184c6){_0x4184c6=_0x4184c6||0xcc;return function(_0x190ff7){if(_0x190ff7){return _0x15eb81[_0x1e49('0x18')](_0x4184c6);}return _0x15eb81['status'](_0x4184c6)[_0x1e49('0x19')]();};}function respondWithResult(_0x28b2b1,_0x99c9df){_0x99c9df=_0x99c9df||0xc8;return function(_0x44f78d){if(_0x44f78d){return _0x28b2b1[_0x1e49('0x1a')](_0x99c9df)[_0x1e49('0x1b')](_0x44f78d);}};}function respondWithFilteredResult(_0x29b0f8,_0x1f1cde){return function(_0x7ae5fb){if(_0x7ae5fb){var _0x3ee9c8=typeof _0x1f1cde[_0x1e49('0x1c')]===_0x1e49('0x1d')&&typeof _0x1f1cde[_0x1e49('0x1e')]===_0x1e49('0x1d');var _0x4ce919=_0x7ae5fb[_0x1e49('0x1f')];var _0x39654a=_0x3ee9c8?0x0:_0x1f1cde[_0x1e49('0x1c')];var _0x2b33ee=_0x3ee9c8?_0x7ae5fb[_0x1e49('0x1f')]:_0x1f1cde[_0x1e49('0x1c')]+_0x1f1cde[_0x1e49('0x1e')];var _0xeede9d;if(_0x2b33ee>=_0x4ce919){_0x2b33ee=_0x4ce919;_0xeede9d=0xc8;}else{_0xeede9d=0xce;}_0x29b0f8[_0x1e49('0x1a')](_0xeede9d);return _0x29b0f8[_0x1e49('0x20')]('Content-Range',_0x39654a+'-'+_0x2b33ee+'/'+_0x4ce919)['json'](_0x7ae5fb);}return null;};}function patchUpdates(_0x48051a){return function(_0x5620a6){try{jsonpatch[_0x1e49('0x21')](_0x5620a6,_0x48051a,!![]);}catch(_0x153861){return BPromise['reject'](_0x153861);}return _0x5620a6[_0x1e49('0x22')]();};}function saveUpdates(_0x93e259,_0x59f822){return function(_0x1af132){if(_0x1af132){return _0x1af132[_0x1e49('0x23')](_0x93e259)['then'](function(_0x9227c3){return _0x9227c3;});}return null;};}function removeEntity(_0x2625a7,_0x2298ff){return function(_0x25196a){if(_0x25196a){return _0x25196a[_0x1e49('0x24')]()['then'](function(){_0x2625a7[_0x1e49('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398c51,_0x56bd42){return function(_0x3d33d8){if(!_0x3d33d8){_0x398c51[_0x1e49('0x18')](0x194);}return _0x3d33d8;};}function handleError(_0x94efbe,_0x49bc82){_0x49bc82=_0x49bc82||0x1f4;return function(_0x388707){logger[_0x1e49('0x25')](_0x388707['stack']);if(_0x388707[_0x1e49('0x26')]){delete _0x388707['name'];}_0x94efbe[_0x1e49('0x1a')](_0x49bc82)['send'](_0x388707);};}exports[_0x1e49('0x27')]=function(_0x4326e7,_0x270710){var _0x351300={},_0x53f676={},_0x3a6cca={'count':0x0,'rows':[]};var _0x48bf56=_[_0x1e49('0x28')](db[_0x1e49('0x29')]['rawAttributes'],function(_0x398e5d){return{'name':_0x398e5d[_0x1e49('0x2a')],'type':_0x398e5d[_0x1e49('0x2b')][_0x1e49('0x2c')]};});_0x53f676[_0x1e49('0x2d')]=_[_0x1e49('0x28')](_0x48bf56,'name');_0x53f676['query']=_[_0x1e49('0x2e')](_0x4326e7[_0x1e49('0x2f')]);_0x53f676['filters']=_[_0x1e49('0x30')](_0x53f676[_0x1e49('0x2d')],_0x53f676[_0x1e49('0x2f')]);_0x351300[_0x1e49('0x31')]=_[_0x1e49('0x30')](_0x53f676[_0x1e49('0x2d')],qs[_0x1e49('0x32')](_0x4326e7[_0x1e49('0x2f')][_0x1e49('0x32')]));_0x351300[_0x1e49('0x31')]=_0x351300[_0x1e49('0x31')][_0x1e49('0x33')]?_0x351300['attributes']:_0x53f676[_0x1e49('0x2d')];if(!_0x4326e7['query']['hasOwnProperty']('nolimit')){_0x351300[_0x1e49('0x1e')]=qs['limit'](_0x4326e7['query']['limit']);_0x351300[_0x1e49('0x1c')]=qs[_0x1e49('0x1c')](_0x4326e7['query'][_0x1e49('0x1c')]);}_0x351300[_0x1e49('0x34')]=qs[_0x1e49('0x35')](_0x4326e7[_0x1e49('0x2f')][_0x1e49('0x35')]);_0x351300[_0x1e49('0x36')]=qs[_0x1e49('0x37')](_[_0x1e49('0x38')](_0x4326e7[_0x1e49('0x2f')],_0x53f676[_0x1e49('0x37')]),_0x48bf56);if(_0x4326e7[_0x1e49('0x2f')][_0x1e49('0x39')]){_0x351300[_0x1e49('0x36')]=_[_0x1e49('0x3a')](_0x351300[_0x1e49('0x36')],{'$or':_[_0x1e49('0x28')](_0x48bf56,function(_0x3c398f){if(_0x3c398f[_0x1e49('0x2b')]!==_0x1e49('0x3b')){var _0x5e8220={};_0x5e8220[_0x3c398f[_0x1e49('0x26')]]={'$like':'%'+_0x4326e7[_0x1e49('0x2f')]['filter']+'%'};return _0x5e8220;}})});}_0x351300=_[_0x1e49('0x3a')]({},_0x351300,_0x4326e7[_0x1e49('0x3c')]);var _0x432e93={'where':_0x351300[_0x1e49('0x36')]};return db[_0x1e49('0x29')][_0x1e49('0x1f')](_0x432e93)[_0x1e49('0x3d')](function(_0x178e2d){_0x3a6cca['count']=_0x178e2d;if(_0x4326e7[_0x1e49('0x2f')][_0x1e49('0x3e')]){_0x351300['include']=[{'all':!![]}];}return db[_0x1e49('0x29')][_0x1e49('0x3f')](_0x351300);})['then'](function(_0x454e89){_0x3a6cca['rows']=_0x454e89;return _0x3a6cca;})['then'](respondWithFilteredResult(_0x270710,_0x351300))[_0x1e49('0x40')](handleError(_0x270710,null));};exports[_0x1e49('0x41')]=function(_0x5ba034,_0x59279f){var _0x10e9fe={'raw':!![],'where':{'id':_0x5ba034[_0x1e49('0x42')]['id']}},_0x12d88d={};_0x12d88d['model']=_[_0x1e49('0x2e')](db[_0x1e49('0x29')][_0x1e49('0x43')]);_0x12d88d['query']=_[_0x1e49('0x2e')](_0x5ba034[_0x1e49('0x2f')]);_0x12d88d[_0x1e49('0x37')]=_[_0x1e49('0x30')](_0x12d88d['model'],_0x12d88d[_0x1e49('0x2f')]);_0x10e9fe['attributes']=_[_0x1e49('0x30')](_0x12d88d[_0x1e49('0x2d')],qs['fields'](_0x5ba034[_0x1e49('0x2f')]['fields']));_0x10e9fe['attributes']=_0x10e9fe[_0x1e49('0x31')][_0x1e49('0x33')]?_0x10e9fe[_0x1e49('0x31')]:_0x12d88d[_0x1e49('0x2d')];if(_0x5ba034['query']['includeAll']){_0x10e9fe[_0x1e49('0x44')]=[{'all':!![]}];}_0x10e9fe=_['merge']({},_0x10e9fe,_0x5ba034[_0x1e49('0x3c')]);return db[_0x1e49('0x29')]['find'](_0x10e9fe)[_0x1e49('0x3d')](handleEntityNotFound(_0x59279f,null))['then'](respondWithResult(_0x59279f,null))[_0x1e49('0x40')](handleError(_0x59279f,null));};exports[_0x1e49('0x45')]=function(_0xd021c7,_0x2234cb){return db[_0x1e49('0x29')][_0x1e49('0x45')](_0xd021c7[_0x1e49('0x46')],{})[_0x1e49('0x3d')](respondWithResult(_0x2234cb,0xc9))[_0x1e49('0x40')](handleError(_0x2234cb,null));};exports[_0x1e49('0x23')]=function(_0x10bad3,_0xe2c945){if(_0x10bad3[_0x1e49('0x46')]['id']){delete _0x10bad3[_0x1e49('0x46')]['id'];}return db['ZohoField'][_0x1e49('0x47')]({'where':{'id':_0x10bad3[_0x1e49('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2c945,null))[_0x1e49('0x3d')](saveUpdates(_0x10bad3[_0x1e49('0x46')],null))[_0x1e49('0x3d')](respondWithResult(_0xe2c945,null))['catch'](handleError(_0xe2c945,null));};exports[_0x1e49('0x24')]=function(_0x4c5c2c,_0x275a9d){return db[_0x1e49('0x29')][_0x1e49('0x47')]({'where':{'id':_0x4c5c2c[_0x1e49('0x42')]['id']}})[_0x1e49('0x3d')](handleEntityNotFound(_0x275a9d,null))['then'](removeEntity(_0x275a9d,null))[_0x1e49('0x40')](handleError(_0x275a9d,null));}; \ No newline at end of file +var _0xc3a1=['show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','ZohoField','includeAll','include','rows','catch'];(function(_0x31f04b,_0x38dbdf){var _0xb80dd=function(_0x5ef7ce){while(--_0x5ef7ce){_0x31f04b['push'](_0x31f04b['shift']());}};_0xb80dd(++_0x38dbdf);}(_0xc3a1,0xd9));var _0x1c3a=function(_0x13cbdf,_0x15b2f7){_0x13cbdf=_0x13cbdf-0x0;var _0x1044cf=_0xc3a1[_0x13cbdf];return _0x1044cf;};'use strict';var emlformat=require(_0x1c3a('0x0'));var rimraf=require(_0x1c3a('0x1'));var zipdir=require(_0x1c3a('0x2'));var jsonpatch=require(_0x1c3a('0x3'));var rp=require(_0x1c3a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c3a('0x5'));var path=require('path');var sox=require(_0x1c3a('0x6'));var csv=require(_0x1c3a('0x7'));var ejs=require(_0x1c3a('0x8'));var fs=require('fs');var fs_extra=require(_0x1c3a('0x9'));var _=require('lodash');var squel=require(_0x1c3a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1c3a('0xb'));var toCsv=require(_0x1c3a('0x7'));var querystring=require('querystring');var Papa=require(_0x1c3a('0xc'));var Redis=require(_0x1c3a('0xd'));var authService=require(_0x1c3a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1c3a('0xf'));var hardwareService=require(_0x1c3a('0x10'));var logger=require(_0x1c3a('0x11'))('api');var utils=require(_0x1c3a('0x12'));var config=require(_0x1c3a('0x13'));var licenseUtil=require(_0x1c3a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48dbf6,_0x1ef107){_0x1ef107=_0x1ef107||0xcc;return function(_0x4a1380){if(_0x4a1380){return _0x48dbf6[_0x1c3a('0x15')](_0x1ef107);}return _0x48dbf6[_0x1c3a('0x16')](_0x1ef107)[_0x1c3a('0x17')]();};}function respondWithResult(_0x4886f8,_0x173635){_0x173635=_0x173635||0xc8;return function(_0x22b7cc){if(_0x22b7cc){return _0x4886f8['status'](_0x173635)[_0x1c3a('0x18')](_0x22b7cc);}};}function respondWithFilteredResult(_0x47cd9b,_0xad2586){return function(_0xda7bb9){if(_0xda7bb9){var _0xd1dc85=typeof _0xad2586[_0x1c3a('0x19')]===_0x1c3a('0x1a')&&typeof _0xad2586[_0x1c3a('0x1b')]===_0x1c3a('0x1a');var _0x481161=_0xda7bb9[_0x1c3a('0x1c')];var _0x166dd6=_0xd1dc85?0x0:_0xad2586[_0x1c3a('0x19')];var _0x3a7b6a=_0xd1dc85?_0xda7bb9['count']:_0xad2586['offset']+_0xad2586['limit'];var _0xd72f01;if(_0x3a7b6a>=_0x481161){_0x3a7b6a=_0x481161;_0xd72f01=0xc8;}else{_0xd72f01=0xce;}_0x47cd9b[_0x1c3a('0x16')](_0xd72f01);return _0x47cd9b[_0x1c3a('0x1d')]('Content-Range',_0x166dd6+'-'+_0x3a7b6a+'/'+_0x481161)[_0x1c3a('0x18')](_0xda7bb9);}return null;};}function patchUpdates(_0x52e64f){return function(_0x127b50){try{jsonpatch['apply'](_0x127b50,_0x52e64f,!![]);}catch(_0xa57fc3){return BPromise[_0x1c3a('0x1e')](_0xa57fc3);}return _0x127b50[_0x1c3a('0x1f')]();};}function saveUpdates(_0x25bcad,_0x404bcc){return function(_0x30bd95){if(_0x30bd95){return _0x30bd95[_0x1c3a('0x20')](_0x25bcad)[_0x1c3a('0x21')](function(_0x537ace){return _0x537ace;});}return null;};}function removeEntity(_0x26cb4e,_0x991d72){return function(_0x193ffd){if(_0x193ffd){return _0x193ffd['destroy']()[_0x1c3a('0x21')](function(){_0x26cb4e[_0x1c3a('0x16')](0xcc)[_0x1c3a('0x17')]();});}};}function handleEntityNotFound(_0x2d2b54,_0x38211b){return function(_0x181a2e){if(!_0x181a2e){_0x2d2b54[_0x1c3a('0x15')](0x194);}return _0x181a2e;};}function handleError(_0x2645b5,_0x4f8dfb){_0x4f8dfb=_0x4f8dfb||0x1f4;return function(_0xe475ae){logger[_0x1c3a('0x22')](_0xe475ae['stack']);if(_0xe475ae[_0x1c3a('0x23')]){delete _0xe475ae[_0x1c3a('0x23')];}_0x2645b5[_0x1c3a('0x16')](_0x4f8dfb)[_0x1c3a('0x24')](_0xe475ae);};}exports[_0x1c3a('0x25')]=function(_0x37f535,_0x269fa8){var _0x524803={},_0x533451={},_0x49e87d={'count':0x0,'rows':[]};var _0x14f38c=_[_0x1c3a('0x26')](db['ZohoField']['rawAttributes'],function(_0x5a7665){return{'name':_0x5a7665[_0x1c3a('0x27')],'type':_0x5a7665[_0x1c3a('0x28')][_0x1c3a('0x29')]};});_0x533451['model']=_[_0x1c3a('0x26')](_0x14f38c,_0x1c3a('0x23'));_0x533451[_0x1c3a('0x2a')]=_['keys'](_0x37f535[_0x1c3a('0x2a')]);_0x533451[_0x1c3a('0x2b')]=_[_0x1c3a('0x2c')](_0x533451[_0x1c3a('0x2d')],_0x533451['query']);_0x524803['attributes']=_[_0x1c3a('0x2c')](_0x533451[_0x1c3a('0x2d')],qs['fields'](_0x37f535['query'][_0x1c3a('0x2e')]));_0x524803[_0x1c3a('0x2f')]=_0x524803['attributes'][_0x1c3a('0x30')]?_0x524803['attributes']:_0x533451[_0x1c3a('0x2d')];if(!_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x31')](_0x1c3a('0x32'))){_0x524803[_0x1c3a('0x1b')]=qs[_0x1c3a('0x1b')](_0x37f535[_0x1c3a('0x2a')]['limit']);_0x524803[_0x1c3a('0x19')]=qs['offset'](_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x19')]);}_0x524803[_0x1c3a('0x33')]=qs['sort'](_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x34')]);_0x524803['where']=qs['filters'](_[_0x1c3a('0x35')](_0x37f535[_0x1c3a('0x2a')],_0x533451[_0x1c3a('0x2b')]),_0x14f38c);if(_0x37f535['query'][_0x1c3a('0x36')]){_0x524803['where']=_[_0x1c3a('0x37')](_0x524803[_0x1c3a('0x38')],{'$or':_[_0x1c3a('0x26')](_0x14f38c,function(_0xb490c4){if(_0xb490c4['type']!==_0x1c3a('0x39')){var _0x4cc3c6={};_0x4cc3c6[_0xb490c4[_0x1c3a('0x23')]]={'$like':'%'+_0x37f535[_0x1c3a('0x2a')]['filter']+'%'};return _0x4cc3c6;}})});}_0x524803=_[_0x1c3a('0x37')]({},_0x524803,_0x37f535['options']);var _0x1ee740={'where':_0x524803['where']};return db[_0x1c3a('0x3a')][_0x1c3a('0x1c')](_0x1ee740)[_0x1c3a('0x21')](function(_0x58f3c6){_0x49e87d[_0x1c3a('0x1c')]=_0x58f3c6;if(_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x3b')]){_0x524803[_0x1c3a('0x3c')]=[{'all':!![]}];}return db[_0x1c3a('0x3a')]['findAll'](_0x524803);})[_0x1c3a('0x21')](function(_0xe44f15){_0x49e87d[_0x1c3a('0x3d')]=_0xe44f15;return _0x49e87d;})[_0x1c3a('0x21')](respondWithFilteredResult(_0x269fa8,_0x524803))[_0x1c3a('0x3e')](handleError(_0x269fa8,null));};exports[_0x1c3a('0x3f')]=function(_0x3dae16,_0x5af911){var _0x22ab3f={'raw':!![],'where':{'id':_0x3dae16[_0x1c3a('0x40')]['id']}},_0x5f1ab7={};_0x5f1ab7['model']=_[_0x1c3a('0x41')](db['ZohoField'][_0x1c3a('0x42')]);_0x5f1ab7['query']=_['keys'](_0x3dae16[_0x1c3a('0x2a')]);_0x5f1ab7[_0x1c3a('0x2b')]=_[_0x1c3a('0x2c')](_0x5f1ab7[_0x1c3a('0x2d')],_0x5f1ab7[_0x1c3a('0x2a')]);_0x22ab3f['attributes']=_[_0x1c3a('0x2c')](_0x5f1ab7['model'],qs[_0x1c3a('0x2e')](_0x3dae16[_0x1c3a('0x2a')][_0x1c3a('0x2e')]));_0x22ab3f['attributes']=_0x22ab3f[_0x1c3a('0x2f')][_0x1c3a('0x30')]?_0x22ab3f[_0x1c3a('0x2f')]:_0x5f1ab7[_0x1c3a('0x2d')];if(_0x3dae16[_0x1c3a('0x2a')]['includeAll']){_0x22ab3f[_0x1c3a('0x3c')]=[{'all':!![]}];}_0x22ab3f=_['merge']({},_0x22ab3f,_0x3dae16['options']);return db['ZohoField']['find'](_0x22ab3f)[_0x1c3a('0x21')](handleEntityNotFound(_0x5af911,null))[_0x1c3a('0x21')](respondWithResult(_0x5af911,null))[_0x1c3a('0x3e')](handleError(_0x5af911,null));};exports['create']=function(_0x498782,_0x4e5660){return db[_0x1c3a('0x3a')][_0x1c3a('0x43')](_0x498782[_0x1c3a('0x44')],{})[_0x1c3a('0x21')](respondWithResult(_0x4e5660,0xc9))[_0x1c3a('0x3e')](handleError(_0x4e5660,null));};exports[_0x1c3a('0x20')]=function(_0x53c26f,_0x178eda){if(_0x53c26f[_0x1c3a('0x44')]['id']){delete _0x53c26f['body']['id'];}return db[_0x1c3a('0x3a')][_0x1c3a('0x45')]({'where':{'id':_0x53c26f['params']['id']}})['then'](handleEntityNotFound(_0x178eda,null))[_0x1c3a('0x21')](saveUpdates(_0x53c26f[_0x1c3a('0x44')],null))[_0x1c3a('0x21')](respondWithResult(_0x178eda,null))[_0x1c3a('0x3e')](handleError(_0x178eda,null));};exports['destroy']=function(_0x1b45da,_0x4fb4cc){return db[_0x1c3a('0x3a')]['find']({'where':{'id':_0x1b45da[_0x1c3a('0x40')]['id']}})[_0x1c3a('0x21')](handleEntityNotFound(_0x4fb4cc,null))[_0x1c3a('0x21')](removeEntity(_0x4fb4cc,null))[_0x1c3a('0x3e')](handleError(_0x4fb4cc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index fbb9262..ec968b3 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 _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x429ddf,_0x12913c){var _0x5f5973=function(_0x6cf92f){while(--_0x6cf92f){_0x429ddf['push'](_0x429ddf['shift']());}};_0x5f5973(++_0x12913c);}(_0x1a85,0x178));var _0x51a8=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0x1a85[_0xfdec06];return _0x58a539;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['int_zoho_fields','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x4f8492,_0x1eec76){var _0x8c2e1f=function(_0x373e1b){while(--_0x373e1b){_0x4f8492['push'](_0x4f8492['shift']());}};_0x8c2e1f(++_0x1eec76);}(_0x32f4,0x154));var _0x432f=function(_0xc7c23,_0x1901b8){_0xc7c23=_0xc7c23-0x0;var _0x3f8daa=_0x32f4[_0xc7c23];return _0x3f8daa;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x432f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ce77d8f..58b36b2 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 _0xf2ac=['result','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message'];(function(_0xc7019c,_0x32e07a){var _0x5f2873=function(_0x125529){while(--_0x125529){_0xc7019c['push'](_0xc7019c['shift']());}};_0x5f2873(++_0x32e07a);}(_0xf2ac,0x67));var _0xcf2a=function(_0x539afa,_0x98f1ea){_0x539afa=_0x539afa-0x0;var _0x5e2ec4=_0xf2ac[_0x539afa];return _0x5e2ec4;};'use strict';var _=require('lodash');var util=require(_0xcf2a('0x0'));var moment=require(_0xcf2a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf2a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf2a('0x3'));var config=require(_0xcf2a('0x4'));var jayson=require(_0xcf2a('0x5'));var client=jayson[_0xcf2a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26c01e,_0x518cb9,_0x99f48f){return new BPromise(function(_0x4fe7dc,_0x1bfd94){return client['request'](_0x26c01e,_0x99f48f)[_0xcf2a('0x7')](function(_0x9ff434){logger[_0xcf2a('0x8')]('ZohoField,\x20%s,\x20%s',_0x518cb9,'request\x20sent');logger[_0xcf2a('0x9')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x518cb9,_0xcf2a('0xa'),JSON[_0xcf2a('0xb')](_0x9ff434));if(_0x9ff434['error']){if(_0x9ff434[_0xcf2a('0xc')][_0xcf2a('0xd')]===0x1f4){logger['error'](_0xcf2a('0xe'),_0x518cb9,_0x9ff434[_0xcf2a('0xc')][_0xcf2a('0xf')]);return _0x1bfd94(_0x9ff434[_0xcf2a('0xc')][_0xcf2a('0xf')]);}logger[_0xcf2a('0xc')]('ZohoField,\x20%s,\x20%s',_0x518cb9,_0x9ff434[_0xcf2a('0xc')][_0xcf2a('0xf')]);return _0x4fe7dc(_0x9ff434[_0xcf2a('0xc')]['message']);}else{logger['info'](_0xcf2a('0xe'),_0x518cb9,_0xcf2a('0xa'));_0x4fe7dc(_0x9ff434[_0xcf2a('0x10')]['message']);}})['catch'](function(_0x2bb2f9){logger[_0xcf2a('0xc')]('ZohoField,\x20%s,\x20%s',_0x518cb9,_0x2bb2f9);_0x1bfd94(_0x2bb2f9);});});} \ No newline at end of file +var _0x14e7=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x14e7,0xcf));var _0x714e=function(_0x2fc1ce,_0x1a26d5){_0x2fc1ce=_0x2fc1ce-0x0;var _0x2b41df=_0x14e7[_0x2fc1ce];return _0x2b41df;};'use strict';var _=require(_0x714e('0x0'));var util=require(_0x714e('0x1'));var moment=require(_0x714e('0x2'));var BPromise=require(_0x714e('0x3'));var rs=require(_0x714e('0x4'));var fs=require('fs');var Redis=require(_0x714e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x714e('0x6'));var logger=require(_0x714e('0x7'))(_0x714e('0x8'));var config=require(_0x714e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x714e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37df85,_0x3dc19a,_0x5b16a6){return new BPromise(function(_0x4653dd,_0x3daa0d){return client[_0x714e('0xb')](_0x37df85,_0x5b16a6)[_0x714e('0xc')](function(_0xccfb45){logger[_0x714e('0xd')](_0x714e('0xe'),_0x3dc19a,_0x714e('0xf'));logger[_0x714e('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3dc19a,_0x714e('0xf'),JSON['stringify'](_0xccfb45));if(_0xccfb45['error']){if(_0xccfb45[_0x714e('0x11')][_0x714e('0x12')]===0x1f4){logger[_0x714e('0x11')](_0x714e('0xe'),_0x3dc19a,_0xccfb45[_0x714e('0x11')][_0x714e('0x13')]);return _0x3daa0d(_0xccfb45[_0x714e('0x11')]['message']);}logger[_0x714e('0x11')](_0x714e('0xe'),_0x3dc19a,_0xccfb45['error'][_0x714e('0x13')]);return _0x4653dd(_0xccfb45['error'][_0x714e('0x13')]);}else{logger[_0x714e('0xd')](_0x714e('0xe'),_0x3dc19a,_0x714e('0xf'));_0x4653dd(_0xccfb45[_0x714e('0x14')][_0x714e('0x13')]);}})['catch'](function(_0x2b83a6){logger[_0x714e('0x11')](_0x714e('0xe'),_0x3dc19a,_0x2b83a6);_0x3daa0d(_0x2b83a6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d561ce6..40a7067 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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(_0x5592ac,_0x33327e){var _0x47f30c=function(_0x30cb57){while(--_0x30cb57){_0x5592ac['push'](_0x5592ac['shift']());}};_0x47f30c(++_0x33327e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9b56954..c56c8d2 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 _0xb469=['unique_name_and_version','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0xabd040,_0x3d364d){var _0x3048a9=function(_0x14f5fe){while(--_0x14f5fe){_0xabd040['push'](_0xabd040['shift']());}};_0x3048a9(++_0x3d364d);}(_0xb469,0x13b));var _0x9b46=function(_0x21cd52,_0x359aaf){_0x21cd52=_0x21cd52-0x0;var _0x18c957=_0xb469[_0x21cd52];return _0x18c957;};'use strict';var Sequelize=require(_0x9b46('0x0'));module[_0x9b46('0x1')]={'name':{'type':Sequelize[_0x9b46('0x2')],'allowNull':![],'unique':_0x9b46('0x3')},'version':{'type':Sequelize[_0x9b46('0x2')],'allowNull':![],'unique':_0x9b46('0x3')},'main':{'type':Sequelize[_0x9b46('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9b46('0x2')]},'path':{'type':Sequelize[_0x9b46('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x9b46('0x4')]},'active':{'type':Sequelize[_0x9b46('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9b46('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x9b46('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9b46('0x2')]},'link':{'type':Sequelize[_0x9b46('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x765f=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports'];(function(_0x3779fa,_0x18fb47){var _0x1a6b9d=function(_0x5e5f79){while(--_0x5e5f79){_0x3779fa['push'](_0x3779fa['shift']());}};_0x1a6b9d(++_0x18fb47);}(_0x765f,0x1b1));var _0xf765=function(_0x2a5836,_0x346c70){_0x2a5836=_0x2a5836-0x0;var _0x5b7a67=_0x765f[_0x2a5836];return _0x5b7a67;};'use strict';var Sequelize=require('sequelize');module[_0xf765('0x0')]={'name':{'type':Sequelize[_0xf765('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf765('0x1')],'allowNull':![],'unique':_0xf765('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf765('0x3')},'filename':{'type':Sequelize[_0xf765('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf765('0x1')]},'size':{'type':Sequelize[_0xf765('0x4')]},'active':{'type':Sequelize[_0xf765('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf765('0x1')]},'state':{'type':Sequelize[_0xf765('0x1')],'unique':_0xf765('0x6')},'description':{'type':Sequelize[_0xf765('0x1')]},'title':{'type':Sequelize[_0xf765('0x1')]},'remoteUri':{'type':Sequelize[_0xf765('0x1')]},'link':{'type':Sequelize[_0xf765('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a8bf938..7f3448b 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 _0xe2fe=['include','catch','show','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','Integration','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['Integration']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['Integration']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));}; \ No newline at end of file +var _0x687b=['order','sort','where','filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3bb0d4,_0xe492ec){var _0x269be3=function(_0x3fc0af){while(--_0x3fc0af){_0x3bb0d4['push'](_0x3bb0d4['shift']());}};_0x269be3(++_0xe492ec);}(_0x687b,0x14a));var _0xb687=function(_0x3530d0,_0x4dfb47){_0x3530d0=_0x3530d0-0x0;var _0x2165c6=_0x687b[_0x3530d0];return _0x2165c6;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['Integration'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['Integration']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index fb0bc63..8dbbeaa 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 _0x4c04=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x4c04,0x159));var _0x44c0=function(_0x166e7a,_0x11296a){_0x166e7a=_0x166e7a-0x0;var _0x45e5f2=_0x4c04[_0x166e7a];return _0x45e5f2;};'use strict';var _=require(_0x44c0('0x0'));var util=require(_0x44c0('0x1'));var logger=require(_0x44c0('0x2'))(_0x44c0('0x3'));var moment=require(_0x44c0('0x4'));var BPromise=require(_0x44c0('0x5'));var rp=require(_0x44c0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44c0('0x7'));var config=require(_0x44c0('0x8'));var attributes=require(_0x44c0('0x9'));module[_0x44c0('0xa')]=function(_0x1a0e3e,_0x5c3142){return _0x1a0e3e[_0x44c0('0xb')](_0x44c0('0xc'),attributes,{'tableName':_0x44c0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed5c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integration.attributes','Integration','integrations','util'];(function(_0x3c6d6e,_0x51b2bc){var _0x10c052=function(_0x13f4ee){while(--_0x13f4ee){_0x3c6d6e['push'](_0x3c6d6e['shift']());}};_0x10c052(++_0x51b2bc);}(_0xed5c,0x175));var _0xced5=function(_0x996519,_0x4afa60){_0x996519=_0x996519-0x0;var _0xde4902=_0xed5c[_0x996519];return _0xde4902;};'use strict';var _=require('lodash');var util=require(_0xced5('0x0'));var logger=require(_0xced5('0x1'))(_0xced5('0x2'));var moment=require(_0xced5('0x3'));var BPromise=require(_0xced5('0x4'));var rp=require(_0xced5('0x5'));var fs=require('fs');var path=require(_0xced5('0x6'));var rimraf=require(_0xced5('0x7'));var config=require('../../config/environment');var attributes=require(_0xced5('0x8'));module['exports']=function(_0x9dbf6d,_0x596c5b){return _0x9dbf6d['define'](_0xced5('0x9'),attributes,{'tableName':_0xced5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 0001747..248cfcd 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5fe5ca,_0x4e92d3){var _0x42f45f=function(_0x2511eb){while(--_0x2511eb){_0x5fe5ca['push'](_0x5fe5ca['shift']());}};_0x42f45f(++_0x4e92d3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x76d008,_0x2ca111){_0x76d008=_0x76d008-0x0;var _0x2ea4a6=_0xd7d1[_0x76d008];return _0x2ea4a6;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5dadc0,_0x58a3b6){var _0x4e6709=function(_0x102917){while(--_0x102917){_0x5dadc0['push'](_0x5dadc0['shift']());}};_0x4e6709(++_0x58a3b6);}(_0xdb28,0x106));var _0x8db2=function(_0x144940,_0x4f0f85){_0x144940=_0x144940-0x0;var _0x4d0515=_0xdb28[_0x144940];return _0x4d0515;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 95a1c75..29d03f7 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x0295,0x1f0));var _0x5029=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x0295[_0x3ee9b2];return _0x51ac3e;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x517cef,_0x1106b7){var _0x198fc1=function(_0x4d1c39){while(--_0x4d1c39){_0x517cef['push'](_0x517cef['shift']());}};_0x198fc1(++_0x1106b7);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2d9820,_0x28c727){_0x2d9820=_0x2d9820-0x0;var _0x30916f=_0xc6ac[_0x2d9820];return _0x30916f;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 26bf5aa..e10e73e 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 _0x24cf=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x4a0866,_0x8e2145){var _0x5acd8d=function(_0x1c8a0f){while(--_0x1c8a0f){_0x4a0866['push'](_0x4a0866['shift']());}};_0x5acd8d(++_0x8e2145);}(_0x24cf,0x16a));var _0xf24c=function(_0x19c70e,_0x857b51){_0x19c70e=_0x19c70e-0x0;var _0x5ad64a=_0x24cf[_0x19c70e];return _0x5ad64a;};'use strict';var Sequelize=require(_0xf24c('0x0'));module[_0xf24c('0x1')]={'integration':{'type':Sequelize[_0xf24c('0x2')]},'eventChannel':{'type':Sequelize[_0xf24c('0x2')]},'exitStatus':{'type':Sequelize[_0xf24c('0x2')]},'ticketId':{'type':Sequelize[_0xf24c('0x2')]},'integrationId':{'type':Sequelize[_0xf24c('0x3')]},'contacts':{'type':Sequelize[_0xf24c('0x2')]},'uniqueid':{'type':Sequelize[_0xf24c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf24c('0x2')]},'membername':{'type':Sequelize[_0xf24c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf24c('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf24c('0x4')]},'holdtime':{'type':Sequelize[_0xf24c('0x3')]},'agentcomplete':{'type':Sequelize[_0xf24c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf24c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf24c('0x3')]},'reason':{'type':Sequelize[_0xf24c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf24c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf24c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf24c('0x4')]},'lastevent':{'type':Sequelize[_0xf24c('0x2')]},'channel':{'type':Sequelize[_0xf24c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf24c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf24c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf24c('0x2')]},'context':{'type':Sequelize[_0xf24c('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf24c('0x2')]},'destchannelstate':{'type':Sequelize[_0xf24c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf24c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf24c('0x2')]},'destcalleridname':{'type':Sequelize[_0xf24c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf24c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf24c('0x2')]},'destlanguage':{'type':Sequelize[_0xf24c('0x2')]},'destaccountcode':{'type':Sequelize[_0xf24c('0x2')]},'destcontext':{'type':Sequelize[_0xf24c('0x2')]},'destexten':{'type':Sequelize[_0xf24c('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf24c('0x2')]},'messageId':{'type':Sequelize[_0xf24c('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf24c('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf24c('0x2')]},'cc':{'type':Sequelize[_0xf24c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf24c('0x6')]},'text':{'type':Sequelize[_0xf24c('0x6')]},'status':{'type':Sequelize[_0xf24c('0x7')](_0xf24c('0x8'),_0xf24c('0x9'),_0xf24c('0xa'),_0xf24c('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf24c('0x2')]},'projectId':{'type':Sequelize[_0xf24c('0x3')]}}; \ No newline at end of file +var _0x0776=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x533db8,_0x267df3){var _0x549d36=function(_0x239602){while(--_0x239602){_0x533db8['push'](_0x533db8['shift']());}};_0x549d36(++_0x267df3);}(_0x0776,0x1c5));var _0x6077=function(_0x1e896e,_0x32d09e){_0x1e896e=_0x1e896e-0x0;var _0x59e126=_0x0776[_0x1e896e];return _0x59e126;};'use strict';var Sequelize=require(_0x6077('0x0'));module[_0x6077('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x6077('0x2')]},'exitStatus':{'type':Sequelize[_0x6077('0x2')]},'ticketId':{'type':Sequelize[_0x6077('0x2')]},'integrationId':{'type':Sequelize[_0x6077('0x3')]},'contacts':{'type':Sequelize[_0x6077('0x2')]},'uniqueid':{'type':Sequelize[_0x6077('0x2')]},'calleridnum':{'type':Sequelize[_0x6077('0x2')]},'calleridname':{'type':Sequelize[_0x6077('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6077('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6077('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6077('0x4')]},'holdtime':{'type':Sequelize[_0x6077('0x3')]},'agentcomplete':{'type':Sequelize[_0x6077('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6077('0x4')]},'talktime':{'type':Sequelize[_0x6077('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6077('0x3')]},'reason':{'type':Sequelize[_0x6077('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6077('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6077('0x2')]},'channel':{'type':Sequelize[_0x6077('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6077('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6077('0x2')]},'connectedlinename':{'type':Sequelize[_0x6077('0x2')]},'language':{'type':Sequelize[_0x6077('0x2')]},'accountcode':{'type':Sequelize[_0x6077('0x2')]},'context':{'type':Sequelize[_0x6077('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6077('0x2')]},'destchannel':{'type':Sequelize[_0x6077('0x2')]},'destchannelstate':{'type':Sequelize[_0x6077('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6077('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6077('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6077('0x2')]},'destlanguage':{'type':Sequelize[_0x6077('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6077('0x2')]},'destexten':{'type':Sequelize[_0x6077('0x2')]},'destpriority':{'type':Sequelize[_0x6077('0x2')]},'destuniqueid':{'type':Sequelize[_0x6077('0x2')]},'messageId':{'type':Sequelize[_0x6077('0x2')]},'inReplyTo':{'type':Sequelize[_0x6077('0x2')]},'subject':{'type':Sequelize[_0x6077('0x2')]},'from':{'type':Sequelize[_0x6077('0x2')]},'to':{'type':Sequelize[_0x6077('0x2')]},'cc':{'type':Sequelize[_0x6077('0x2')]},'attachment':{'type':Sequelize[_0x6077('0x6')]},'html':{'type':Sequelize[_0x6077('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6077('0x7')](_0x6077('0x8'),_0x6077('0x9'),_0x6077('0xa'),_0x6077('0xb'))},'url':{'type':Sequelize[_0x6077('0x2')]},'app':{'type':Sequelize[_0x6077('0x2')]},'appdata':{'type':Sequelize[_0x6077('0x2')]},'projectId':{'type':Sequelize[_0x6077('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b566bac..d6ce7fc 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 _0x0000=['then','includeAll','findAll','rows','show','include','options','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4123c6,_0x29e2f3){var _0x4c28bb=function(_0x218d4f){while(--_0x218d4f){_0x4123c6['push'](_0x4123c6['shift']());}};_0x4c28bb(++_0x29e2f3);}(_0x0000,0xfc));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0000('0x0'));var rimraf=require(_0x0000('0x1'));var zipdir=require(_0x0000('0x2'));var jsonpatch=require(_0x0000('0x3'));var rp=require(_0x0000('0x4'));var moment=require('moment');var BPromise=require(_0x0000('0x5'));var Mustache=require(_0x0000('0x6'));var util=require(_0x0000('0x7'));var path=require(_0x0000('0x8'));var sox=require('sox');var csv=require(_0x0000('0x9'));var ejs=require(_0x0000('0xa'));var fs=require('fs');var fs_extra=require(_0x0000('0xb'));var _=require(_0x0000('0xc'));var squel=require(_0x0000('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0000('0xe'));var toCsv=require(_0x0000('0x9'));var querystring=require(_0x0000('0xf'));var Papa=require(_0x0000('0x10'));var Redis=require(_0x0000('0x11'));var authService=require(_0x0000('0x12'));var qs=require(_0x0000('0x13'));var as=require(_0x0000('0x14'));var hardwareService=require(_0x0000('0x15'));var logger=require(_0x0000('0x16'))(_0x0000('0x17'));var utils=require(_0x0000('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0000('0x19'));var db=require(_0x0000('0x1a'))['db'];function respondWithStatusCode(_0x139535,_0x201da2){_0x201da2=_0x201da2||0xcc;return function(_0x14cb9a){if(_0x14cb9a){return _0x139535[_0x0000('0x1b')](_0x201da2);}return _0x139535[_0x0000('0x1c')](_0x201da2)[_0x0000('0x1d')]();};}function respondWithResult(_0x4cdf80,_0x1ba621){_0x1ba621=_0x1ba621||0xc8;return function(_0x18e76d){if(_0x18e76d){return _0x4cdf80[_0x0000('0x1c')](_0x1ba621)[_0x0000('0x1e')](_0x18e76d);}};}function respondWithFilteredResult(_0x4f8c35,_0x18bad2){return function(_0x1d6b06){if(_0x1d6b06){var _0x317134=typeof _0x18bad2[_0x0000('0x1f')]===_0x0000('0x20')&&typeof _0x18bad2[_0x0000('0x21')]==='undefined';var _0x150af7=_0x1d6b06['count'];var _0x59c019=_0x317134?0x0:_0x18bad2[_0x0000('0x1f')];var _0x1eaa07=_0x317134?_0x1d6b06[_0x0000('0x22')]:_0x18bad2[_0x0000('0x1f')]+_0x18bad2['limit'];var _0x21d753;if(_0x1eaa07>=_0x150af7){_0x1eaa07=_0x150af7;_0x21d753=0xc8;}else{_0x21d753=0xce;}_0x4f8c35['status'](_0x21d753);return _0x4f8c35[_0x0000('0x23')](_0x0000('0x24'),_0x59c019+'-'+_0x1eaa07+'/'+_0x150af7)['json'](_0x1d6b06);}return null;};}function patchUpdates(_0x23fef3){return function(_0x12daad){try{jsonpatch[_0x0000('0x25')](_0x12daad,_0x23fef3,!![]);}catch(_0xb2af63){return BPromise[_0x0000('0x26')](_0xb2af63);}return _0x12daad[_0x0000('0x27')]();};}function saveUpdates(_0x15a9f2,_0x5cdaa8){return function(_0x2fcd1c){if(_0x2fcd1c){return _0x2fcd1c[_0x0000('0x28')](_0x15a9f2)['then'](function(_0x8c2014){return _0x8c2014;});}return null;};}function removeEntity(_0x38abfd,_0x315774){return function(_0x43cb06){if(_0x43cb06){return _0x43cb06[_0x0000('0x29')]()['then'](function(){_0x38abfd[_0x0000('0x1c')](0xcc)[_0x0000('0x1d')]();});}};}function handleEntityNotFound(_0x3596c9,_0xec3cf6){return function(_0x4e369e){if(!_0x4e369e){_0x3596c9['sendStatus'](0x194);}return _0x4e369e;};}function handleError(_0x1c30ac,_0x407187){_0x407187=_0x407187||0x1f4;return function(_0x544c43){logger['error'](_0x544c43[_0x0000('0x2a')]);if(_0x544c43[_0x0000('0x2b')]){delete _0x544c43[_0x0000('0x2b')];}_0x1c30ac[_0x0000('0x1c')](_0x407187)[_0x0000('0x2c')](_0x544c43);};}exports[_0x0000('0x2d')]=function(_0x4985a8,_0x370e82){var _0x264235={},_0x17e3b5={},_0x3ebc4b={'count':0x0,'rows':[]};var _0xc2c4b8=_[_0x0000('0x2e')](db[_0x0000('0x2f')][_0x0000('0x30')],function(_0x248d9a){return{'name':_0x248d9a['fieldName'],'type':_0x248d9a[_0x0000('0x31')][_0x0000('0x32')]};});_0x17e3b5[_0x0000('0x33')]=_[_0x0000('0x2e')](_0xc2c4b8,_0x0000('0x2b'));_0x17e3b5[_0x0000('0x34')]=_[_0x0000('0x35')](_0x4985a8[_0x0000('0x34')]);_0x17e3b5[_0x0000('0x36')]=_[_0x0000('0x37')](_0x17e3b5[_0x0000('0x33')],_0x17e3b5[_0x0000('0x34')]);_0x264235['attributes']=_[_0x0000('0x37')](_0x17e3b5[_0x0000('0x33')],qs[_0x0000('0x38')](_0x4985a8[_0x0000('0x34')]['fields']));_0x264235[_0x0000('0x39')]=_0x264235[_0x0000('0x39')][_0x0000('0x3a')]?_0x264235['attributes']:_0x17e3b5['model'];if(!_0x4985a8[_0x0000('0x34')][_0x0000('0x3b')](_0x0000('0x3c'))){_0x264235[_0x0000('0x21')]=qs['limit'](_0x4985a8[_0x0000('0x34')][_0x0000('0x21')]);_0x264235[_0x0000('0x1f')]=qs[_0x0000('0x1f')](_0x4985a8[_0x0000('0x34')][_0x0000('0x1f')]);}_0x264235[_0x0000('0x3d')]=qs[_0x0000('0x3e')](_0x4985a8['query']['sort']);_0x264235[_0x0000('0x3f')]=qs['filters'](_[_0x0000('0x40')](_0x4985a8[_0x0000('0x34')],_0x17e3b5[_0x0000('0x36')]),_0xc2c4b8);if(_0x4985a8[_0x0000('0x34')][_0x0000('0x41')]){_0x264235[_0x0000('0x3f')]=_[_0x0000('0x42')](_0x264235['where'],{'$or':_[_0x0000('0x2e')](_0xc2c4b8,function(_0x12e37a){if(_0x12e37a['type']!==_0x0000('0x43')){var _0x2a525c={};_0x2a525c[_0x12e37a[_0x0000('0x2b')]]={'$like':'%'+_0x4985a8[_0x0000('0x34')]['filter']+'%'};return _0x2a525c;}})});}_0x264235=_[_0x0000('0x42')]({},_0x264235,_0x4985a8['options']);var _0x24e448={'where':_0x264235[_0x0000('0x3f')]};return db[_0x0000('0x2f')][_0x0000('0x22')](_0x24e448)[_0x0000('0x44')](function(_0x51a93d){_0x3ebc4b['count']=_0x51a93d;if(_0x4985a8['query'][_0x0000('0x45')]){_0x264235['include']=[{'all':!![]}];}return db[_0x0000('0x2f')][_0x0000('0x46')](_0x264235);})['then'](function(_0x21b825){_0x3ebc4b[_0x0000('0x47')]=_0x21b825;return _0x3ebc4b;})[_0x0000('0x44')](respondWithFilteredResult(_0x370e82,_0x264235))['catch'](handleError(_0x370e82,null));};exports[_0x0000('0x48')]=function(_0x5f45fb,_0xb5c051){var _0x1786cd={'raw':![],'where':{'id':_0x5f45fb['params']['id']}},_0x4fbce5={};_0x4fbce5['model']=_['keys'](db[_0x0000('0x2f')][_0x0000('0x30')]);_0x4fbce5[_0x0000('0x34')]=_[_0x0000('0x35')](_0x5f45fb[_0x0000('0x34')]);_0x4fbce5['filters']=_[_0x0000('0x37')](_0x4fbce5[_0x0000('0x33')],_0x4fbce5[_0x0000('0x34')]);_0x1786cd[_0x0000('0x39')]=_[_0x0000('0x37')](_0x4fbce5[_0x0000('0x33')],qs[_0x0000('0x38')](_0x5f45fb[_0x0000('0x34')]['fields']));_0x1786cd[_0x0000('0x39')]=_0x1786cd['attributes'][_0x0000('0x3a')]?_0x1786cd['attributes']:_0x4fbce5['model'];if(_0x5f45fb['query']['includeAll']){_0x1786cd[_0x0000('0x49')]=[{'all':!![]}];}_0x1786cd=_[_0x0000('0x42')]({},_0x1786cd,_0x5f45fb[_0x0000('0x4a')]);return db[_0x0000('0x2f')]['find'](_0x1786cd)[_0x0000('0x44')](handleEntityNotFound(_0xb5c051,null))['then'](respondWithResult(_0xb5c051,null))[_0x0000('0x4b')](handleError(_0xb5c051,null));};exports[_0x0000('0x4c')]=function(_0x58cde9,_0x20d7d2){return db['IntegrationReport']['create'](_0x58cde9[_0x0000('0x4d')],{})[_0x0000('0x44')](respondWithResult(_0x20d7d2,0xc9))[_0x0000('0x4b')](handleError(_0x20d7d2,null));};exports[_0x0000('0x28')]=function(_0x115cc8,_0xdeefee){if(_0x115cc8['body']['id']){delete _0x115cc8['body']['id'];}return db[_0x0000('0x2f')]['find']({'where':{'id':_0x115cc8['params']['id']}})[_0x0000('0x44')](handleEntityNotFound(_0xdeefee,null))[_0x0000('0x44')](saveUpdates(_0x115cc8[_0x0000('0x4d')],null))[_0x0000('0x44')](respondWithResult(_0xdeefee,null))[_0x0000('0x4b')](handleError(_0xdeefee,null));};exports['destroy']=function(_0x168fa9,_0x1e8ed2){return db[_0x0000('0x2f')]['find']({'where':{'id':_0x168fa9[_0x0000('0x4e')]['id']}})[_0x0000('0x44')](handleEntityNotFound(_0x1e8ed2,null))[_0x0000('0x44')](removeEntity(_0x1e8ed2,null))['catch'](handleError(_0x1e8ed2,null));};exports['describe']=function(_0x116c05,_0x2f14af){return db[_0x0000('0x2f')][_0x0000('0x4f')]()[_0x0000('0x44')](respondWithResult(_0x2f14af,null))[_0x0000('0x4b')](handleError(_0x2f14af,null));}; \ No newline at end of file +var _0x6a99=['to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','apply','reject','save','update','then','end','error','name','send','index','IntegrationReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x57fbad,_0x4e3dcb){var _0x21fa8c=function(_0x5fcb87){while(--_0x5fcb87){_0x57fbad['push'](_0x57fbad['shift']());}};_0x21fa8c(++_0x4e3dcb);}(_0x6a99,0x16a));var _0x96a9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6a99[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x96a9('0x0'));var rimraf=require(_0x96a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x96a9('0x2'));var moment=require(_0x96a9('0x3'));var BPromise=require(_0x96a9('0x4'));var Mustache=require(_0x96a9('0x5'));var util=require(_0x96a9('0x6'));var path=require('path');var sox=require(_0x96a9('0x7'));var csv=require(_0x96a9('0x8'));var ejs=require(_0x96a9('0x9'));var fs=require('fs');var fs_extra=require(_0x96a9('0xa'));var _=require(_0x96a9('0xb'));var squel=require(_0x96a9('0xc'));var crypto=require(_0x96a9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96a9('0xe'));var Papa=require(_0x96a9('0xf'));var Redis=require('ioredis');var authService=require(_0x96a9('0x10'));var qs=require(_0x96a9('0x11'));var as=require(_0x96a9('0x12'));var hardwareService=require(_0x96a9('0x13'));var logger=require(_0x96a9('0x14'))(_0x96a9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96a9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348a8c,_0x58f2ac){_0x58f2ac=_0x58f2ac||0xcc;return function(_0x9db504){if(_0x9db504){return _0x348a8c[_0x96a9('0x17')](_0x58f2ac);}return _0x348a8c[_0x96a9('0x18')](_0x58f2ac)['end']();};}function respondWithResult(_0x41064d,_0x2699e8){_0x2699e8=_0x2699e8||0xc8;return function(_0x56d3ca){if(_0x56d3ca){return _0x41064d[_0x96a9('0x18')](_0x2699e8)['json'](_0x56d3ca);}};}function respondWithFilteredResult(_0x2ed7d7,_0x39ed38){return function(_0x336aa7){if(_0x336aa7){var _0x4b15a4=typeof _0x39ed38['offset']===_0x96a9('0x19')&&typeof _0x39ed38[_0x96a9('0x1a')]===_0x96a9('0x19');var _0x19bf17=_0x336aa7[_0x96a9('0x1b')];var _0x3aced5=_0x4b15a4?0x0:_0x39ed38[_0x96a9('0x1c')];var _0x1fc73e=_0x4b15a4?_0x336aa7[_0x96a9('0x1b')]:_0x39ed38[_0x96a9('0x1c')]+_0x39ed38[_0x96a9('0x1a')];var _0x4ddc37;if(_0x1fc73e>=_0x19bf17){_0x1fc73e=_0x19bf17;_0x4ddc37=0xc8;}else{_0x4ddc37=0xce;}_0x2ed7d7['status'](_0x4ddc37);return _0x2ed7d7[_0x96a9('0x1d')]('Content-Range',_0x3aced5+'-'+_0x1fc73e+'/'+_0x19bf17)['json'](_0x336aa7);}return null;};}function patchUpdates(_0x1b5e3d){return function(_0x50925b){try{jsonpatch[_0x96a9('0x1e')](_0x50925b,_0x1b5e3d,!![]);}catch(_0x24d335){return BPromise[_0x96a9('0x1f')](_0x24d335);}return _0x50925b[_0x96a9('0x20')]();};}function saveUpdates(_0x52e2d1,_0x35747e){return function(_0x43be2c){if(_0x43be2c){return _0x43be2c[_0x96a9('0x21')](_0x52e2d1)['then'](function(_0x1aceb3){return _0x1aceb3;});}return null;};}function removeEntity(_0x2bbfed,_0x1e2dd3){return function(_0x12a3c2){if(_0x12a3c2){return _0x12a3c2['destroy']()[_0x96a9('0x22')](function(){_0x2bbfed['status'](0xcc)[_0x96a9('0x23')]();});}};}function handleEntityNotFound(_0xd73cbc,_0x21a13b){return function(_0x4dbdbf){if(!_0x4dbdbf){_0xd73cbc[_0x96a9('0x17')](0x194);}return _0x4dbdbf;};}function handleError(_0x420e58,_0x1f4c98){_0x1f4c98=_0x1f4c98||0x1f4;return function(_0x2bbe11){logger[_0x96a9('0x24')](_0x2bbe11['stack']);if(_0x2bbe11[_0x96a9('0x25')]){delete _0x2bbe11[_0x96a9('0x25')];}_0x420e58[_0x96a9('0x18')](_0x1f4c98)[_0x96a9('0x26')](_0x2bbe11);};}exports[_0x96a9('0x27')]=function(_0x5b04a8,_0x5280f0){var _0x442591={},_0x659103={},_0x230cf4={'count':0x0,'rows':[]};var _0xafb6a9=_['map'](db[_0x96a9('0x28')]['rawAttributes'],function(_0x57e29d){return{'name':_0x57e29d[_0x96a9('0x29')],'type':_0x57e29d[_0x96a9('0x2a')][_0x96a9('0x2b')]};});_0x659103[_0x96a9('0x2c')]=_[_0x96a9('0x2d')](_0xafb6a9,_0x96a9('0x25'));_0x659103[_0x96a9('0x2e')]=_[_0x96a9('0x2f')](_0x5b04a8[_0x96a9('0x2e')]);_0x659103['filters']=_[_0x96a9('0x30')](_0x659103[_0x96a9('0x2c')],_0x659103['query']);_0x442591[_0x96a9('0x31')]=_[_0x96a9('0x30')](_0x659103[_0x96a9('0x2c')],qs[_0x96a9('0x32')](_0x5b04a8['query'][_0x96a9('0x32')]));_0x442591[_0x96a9('0x31')]=_0x442591[_0x96a9('0x31')][_0x96a9('0x33')]?_0x442591[_0x96a9('0x31')]:_0x659103[_0x96a9('0x2c')];if(!_0x5b04a8[_0x96a9('0x2e')][_0x96a9('0x34')](_0x96a9('0x35'))){_0x442591[_0x96a9('0x1a')]=qs[_0x96a9('0x1a')](_0x5b04a8[_0x96a9('0x2e')][_0x96a9('0x1a')]);_0x442591[_0x96a9('0x1c')]=qs[_0x96a9('0x1c')](_0x5b04a8['query'][_0x96a9('0x1c')]);}_0x442591['order']=qs[_0x96a9('0x36')](_0x5b04a8[_0x96a9('0x2e')]['sort']);_0x442591['where']=qs[_0x96a9('0x37')](_[_0x96a9('0x38')](_0x5b04a8['query'],_0x659103[_0x96a9('0x37')]),_0xafb6a9);if(_0x5b04a8[_0x96a9('0x2e')][_0x96a9('0x39')]){_0x442591['where']=_[_0x96a9('0x3a')](_0x442591[_0x96a9('0x3b')],{'$or':_[_0x96a9('0x2d')](_0xafb6a9,function(_0x165f5a){if(_0x165f5a['type']!=='VIRTUAL'){var _0x56e2e9={};_0x56e2e9[_0x165f5a[_0x96a9('0x25')]]={'$like':'%'+_0x5b04a8[_0x96a9('0x2e')]['filter']+'%'};return _0x56e2e9;}})});}_0x442591=_[_0x96a9('0x3a')]({},_0x442591,_0x5b04a8['options']);var _0x4b6dfc={'where':_0x442591[_0x96a9('0x3b')]};return db[_0x96a9('0x28')][_0x96a9('0x1b')](_0x4b6dfc)['then'](function(_0x24ed3d){_0x230cf4[_0x96a9('0x1b')]=_0x24ed3d;if(_0x5b04a8['query'][_0x96a9('0x3c')]){_0x442591[_0x96a9('0x3d')]=[{'all':!![]}];}return db[_0x96a9('0x28')][_0x96a9('0x3e')](_0x442591);})[_0x96a9('0x22')](function(_0x253341){_0x230cf4[_0x96a9('0x3f')]=_0x253341;return _0x230cf4;})[_0x96a9('0x22')](respondWithFilteredResult(_0x5280f0,_0x442591))[_0x96a9('0x40')](handleError(_0x5280f0,null));};exports[_0x96a9('0x41')]=function(_0x825fc6,_0x3f21af){var _0x54cf11={'raw':![],'where':{'id':_0x825fc6[_0x96a9('0x42')]['id']}},_0x5f5d9b={};_0x5f5d9b[_0x96a9('0x2c')]=_[_0x96a9('0x2f')](db['IntegrationReport'][_0x96a9('0x43')]);_0x5f5d9b['query']=_['keys'](_0x825fc6[_0x96a9('0x2e')]);_0x5f5d9b[_0x96a9('0x37')]=_[_0x96a9('0x30')](_0x5f5d9b[_0x96a9('0x2c')],_0x5f5d9b['query']);_0x54cf11[_0x96a9('0x31')]=_['intersection'](_0x5f5d9b[_0x96a9('0x2c')],qs[_0x96a9('0x32')](_0x825fc6['query']['fields']));_0x54cf11[_0x96a9('0x31')]=_0x54cf11['attributes'][_0x96a9('0x33')]?_0x54cf11[_0x96a9('0x31')]:_0x5f5d9b[_0x96a9('0x2c')];if(_0x825fc6[_0x96a9('0x2e')][_0x96a9('0x3c')]){_0x54cf11[_0x96a9('0x3d')]=[{'all':!![]}];}_0x54cf11=_[_0x96a9('0x3a')]({},_0x54cf11,_0x825fc6[_0x96a9('0x44')]);return db[_0x96a9('0x28')]['find'](_0x54cf11)['then'](handleEntityNotFound(_0x3f21af,null))['then'](respondWithResult(_0x3f21af,null))[_0x96a9('0x40')](handleError(_0x3f21af,null));};exports[_0x96a9('0x45')]=function(_0x34d2e1,_0x235dfc){return db[_0x96a9('0x28')][_0x96a9('0x45')](_0x34d2e1['body'],{})[_0x96a9('0x22')](respondWithResult(_0x235dfc,0xc9))[_0x96a9('0x40')](handleError(_0x235dfc,null));};exports['update']=function(_0x107e37,_0x23f686){if(_0x107e37[_0x96a9('0x46')]['id']){delete _0x107e37[_0x96a9('0x46')]['id'];}return db[_0x96a9('0x28')][_0x96a9('0x47')]({'where':{'id':_0x107e37['params']['id']}})[_0x96a9('0x22')](handleEntityNotFound(_0x23f686,null))[_0x96a9('0x22')](saveUpdates(_0x107e37[_0x96a9('0x46')],null))[_0x96a9('0x22')](respondWithResult(_0x23f686,null))[_0x96a9('0x40')](handleError(_0x23f686,null));};exports[_0x96a9('0x48')]=function(_0x274aeb,_0x366b0a){return db[_0x96a9('0x28')][_0x96a9('0x47')]({'where':{'id':_0x274aeb['params']['id']}})[_0x96a9('0x22')](handleEntityNotFound(_0x366b0a,null))[_0x96a9('0x22')](removeEntity(_0x366b0a,null))[_0x96a9('0x40')](handleError(_0x366b0a,null));};exports['describe']=function(_0x4c223f,_0x51e2f3){return db[_0x96a9('0x28')][_0x96a9('0x49')]()[_0x96a9('0x22')](respondWithResult(_0x51e2f3,null))[_0x96a9('0x40')](handleError(_0x51e2f3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7a35896..05888d9 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 _0x1e7f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport'];(function(_0x30e25c,_0x355276){var _0x47959b=function(_0x2f9417){while(--_0x2f9417){_0x30e25c['push'](_0x30e25c['shift']());}};_0x47959b(++_0x355276);}(_0x1e7f,0xc0));var _0xf1e7=function(_0x24274f,_0x44af4e){_0x24274f=_0x24274f-0x0;var _0x3fd37c=_0x1e7f[_0x24274f];return _0x3fd37c;};'use strict';var _=require(_0xf1e7('0x0'));var util=require(_0xf1e7('0x1'));var logger=require(_0xf1e7('0x2'))(_0xf1e7('0x3'));var moment=require(_0xf1e7('0x4'));var BPromise=require('bluebird');var rp=require(_0xf1e7('0x5'));var fs=require('fs');var path=require(_0xf1e7('0x6'));var rimraf=require(_0xf1e7('0x7'));var config=require(_0xf1e7('0x8'));var attributes=require(_0xf1e7('0x9'));module['exports']=function(_0x198f70,_0x33d39c){return _0x198f70[_0xf1e7('0xa')](_0xf1e7('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a63=['./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3a63,0x10c));var _0x33a6=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x3a63[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x33a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x33a6('0x1'));var moment=require(_0x33a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x33a6('0x3'));var fs=require('fs');var path=require(_0x33a6('0x4'));var rimraf=require(_0x33a6('0x5'));var config=require(_0x33a6('0x6'));var attributes=require(_0x33a6('0x7'));module[_0x33a6('0x8')]=function(_0x56f6f2,_0xd644b6){return _0x56f6f2['define'](_0x33a6('0x9'),attributes,{'tableName':_0x33a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index d0766ee..46b2b66 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x26248f,_0x30c724){var _0x237cc4=function(_0x1aadea){while(--_0x1aadea){_0x26248f['push'](_0x26248f['shift']());}};_0x237cc4(++_0x30c724);}(_0x1261,0x144));var _0x1126=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0x1261[_0x21ba7d];return _0x1445b6;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _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(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'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 15b4014..4242568 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 _0x4c23=['/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0x4c23,0x138));var _0x34c2=function(_0x2d9a37,_0x1cfbbd){_0x2d9a37=_0x2d9a37-0x0;var _0x217832=_0x4c23[_0x2d9a37];return _0x217832;};'use strict';var multer=require(_0x34c2('0x0'));var util=require(_0x34c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x34c2('0x2'));var router=express[_0x34c2('0x3')]();var fs_extra=require(_0x34c2('0x4'));var auth=require(_0x34c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x34c2('0x6'));var controller=require(_0x34c2('0x7'));router[_0x34c2('0x8')]('/',auth[_0x34c2('0x9')](),controller[_0x34c2('0xa')]);router[_0x34c2('0x8')]('/:id',auth[_0x34c2('0x9')](),controller[_0x34c2('0xb')]);router['get'](_0x34c2('0xc'),auth[_0x34c2('0x9')](),controller[_0x34c2('0xd')]);router[_0x34c2('0xe')]('/',auth[_0x34c2('0x9')](),controller['create']);router[_0x34c2('0xe')](_0x34c2('0xc'),auth[_0x34c2('0x9')](),controller['addInterval']);router['post'](_0x34c2('0xf'),auth[_0x34c2('0x9')](),controller[_0x34c2('0x10')]);router[_0x34c2('0x11')](_0x34c2('0x12'),auth[_0x34c2('0x9')](),controller[_0x34c2('0x13')]);router[_0x34c2('0x14')](_0x34c2('0x12'),auth[_0x34c2('0x9')](),controller[_0x34c2('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4d61=['addIntervals','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many'];(function(_0xdf05e9,_0x4a0eaa){var _0x359b53=function(_0x34d527){while(--_0x34d527){_0xdf05e9['push'](_0xdf05e9['shift']());}};_0x359b53(++_0x4a0eaa);}(_0x4d61,0x147));var _0x14d6=function(_0x49036e,_0x1eed49){_0x49036e=_0x49036e-0x0;var _0xb21daf=_0x4d61[_0x49036e];return _0xb21daf;};'use strict';var multer=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var path=require(_0x14d6('0x2'));var timeout=require(_0x14d6('0x3'));var express=require(_0x14d6('0x4'));var router=express[_0x14d6('0x5')]();var fs_extra=require(_0x14d6('0x6'));var auth=require(_0x14d6('0x7'));var interaction=require(_0x14d6('0x8'));var config=require('../../config/environment');var controller=require(_0x14d6('0x9'));router[_0x14d6('0xa')]('/',auth[_0x14d6('0xb')](),controller[_0x14d6('0xc')]);router[_0x14d6('0xa')](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller['show']);router[_0x14d6('0xa')]('/:id/sub_intervals',auth[_0x14d6('0xb')](),controller['getIntervals']);router[_0x14d6('0xe')]('/',auth[_0x14d6('0xb')](),controller['create']);router[_0x14d6('0xe')](_0x14d6('0xf'),auth[_0x14d6('0xb')](),controller[_0x14d6('0x10')]);router[_0x14d6('0xe')](_0x14d6('0x11'),auth[_0x14d6('0xb')](),controller[_0x14d6('0x12')]);router[_0x14d6('0x13')](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller['update']);router[_0x14d6('0x14')](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller[_0x14d6('0x15')]);module[_0x14d6('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c548c1f..0c5cc40 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 _0x0519=['exports','STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0519,0x14f));var _0x9051=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x0519[_0x13992d];return _0x3d15bf;};'use strict';var Sequelize=require(_0x9051('0x0'));module[_0x9051('0x1')]={'name':{'type':Sequelize[_0x9051('0x2')]},'description':{'type':Sequelize[_0x9051('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x25a1=['exports','STRING','sequelize'];(function(_0x24a560,_0x3085a4){var _0x1aa520=function(_0x257392){while(--_0x257392){_0x24a560['push'](_0x24a560['shift']());}};_0x1aa520(++_0x3085a4);}(_0x25a1,0x1ca));var _0x125a=function(_0x1b57f5,_0x1bf64d){_0x1b57f5=_0x1b57f5-0x0;var _0x264be0=_0x25a1[_0x1b57f5];return _0x264be0;};'use strict';var Sequelize=require(_0x125a('0x0'));module[_0x125a('0x1')]={'name':{'type':Sequelize[_0x125a('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x125a('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 01cc6b3..f9add56 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 _0xe095=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','then','destroy','get','UserProfileResource','name','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','hasOwnProperty','nolimit','addIntervals','findOne','sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x1b7d53,_0xee7979){var _0x30727a=function(_0x5be362){while(--_0x5be362){_0x1b7d53['push'](_0x1b7d53['shift']());}};_0x30727a(++_0xee7979);}(_0xe095,0x154));var _0x5e09=function(_0x13e588,_0xa966d3){_0x13e588=_0x13e588-0x0;var _0x42523d=_0xe095[_0x13e588];return _0x42523d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e09('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e09('0x1'));var moment=require(_0x5e09('0x2'));var BPromise=require(_0x5e09('0x3'));var Mustache=require(_0x5e09('0x4'));var util=require(_0x5e09('0x5'));var path=require(_0x5e09('0x6'));var sox=require(_0x5e09('0x7'));var csv=require('to-csv');var ejs=require(_0x5e09('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e09('0x9'));var squel=require(_0x5e09('0xa'));var crypto=require(_0x5e09('0xb'));var jsforce=require(_0x5e09('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e09('0xd'));var querystring=require(_0x5e09('0xe'));var Papa=require(_0x5e09('0xf'));var Redis=require(_0x5e09('0x10'));var authService=require(_0x5e09('0x11'));var qs=require(_0x5e09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e09('0x13'))(_0x5e09('0x14'));var utils=require(_0x5e09('0x15'));var config=require(_0x5e09('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e09('0x17'))['db'];var extensions=require(_0x5e09('0x18'));function respondWithStatusCode(_0x235b6f,_0x1f766b){_0x1f766b=_0x1f766b||0xcc;return function(_0x92d39e){if(_0x92d39e){return _0x235b6f[_0x5e09('0x19')](_0x1f766b);}return _0x235b6f[_0x5e09('0x1a')](_0x1f766b)[_0x5e09('0x1b')]();};}function respondWithResult(_0x38e7cd,_0x274155){_0x274155=_0x274155||0xc8;return function(_0x58d799){if(_0x58d799){return _0x38e7cd[_0x5e09('0x1a')](_0x274155)[_0x5e09('0x1c')](_0x58d799);}};}function respondWithFilteredResult(_0x29270d,_0x2944b4){return function(_0x2c016c){if(_0x2c016c){var _0x5609cb=typeof _0x2944b4['offset']===_0x5e09('0x1d')&&typeof _0x2944b4[_0x5e09('0x1e')]===_0x5e09('0x1d');var _0x10894d=_0x2c016c[_0x5e09('0x1f')];var _0x5e5130=_0x5609cb?0x0:_0x2944b4[_0x5e09('0x20')];var _0x574d47=_0x5609cb?_0x2c016c['count']:_0x2944b4[_0x5e09('0x20')]+_0x2944b4[_0x5e09('0x1e')];var _0x44fd1d;if(_0x574d47>=_0x10894d){_0x574d47=_0x10894d;_0x44fd1d=0xc8;}else{_0x44fd1d=0xce;}_0x29270d[_0x5e09('0x1a')](_0x44fd1d);return _0x29270d['set'](_0x5e09('0x21'),_0x5e5130+'-'+_0x574d47+'/'+_0x10894d)['json'](_0x2c016c);}return null;};}function patchUpdates(_0x540ddf){return function(_0x95ad53){try{jsonpatch[_0x5e09('0x22')](_0x95ad53,_0x540ddf,!![]);}catch(_0x589370){return BPromise['reject'](_0x589370);}return _0x95ad53['save']();};}function saveUpdates(_0x103404,_0xe9269e){return function(_0x551d70){if(_0x551d70){return _0x551d70['update'](_0x103404)[_0x5e09('0x23')](function(_0x92fd87){return _0x92fd87;});}return null;};}function removeEntity(_0x48606b,_0x242ee8){return function(_0x44601d){if(_0x44601d){return _0x44601d[_0x5e09('0x24')]()[_0x5e09('0x23')](function(){var _0x69f51f=_0x44601d[_0x5e09('0x25')]({'plain':!![]});var _0x13c747='Intervals';return db[_0x5e09('0x26')][_0x5e09('0x24')]({'where':{'type':_0x13c747,'resourceId':_0x69f51f['id']}})['then'](function(){return _0x44601d;});})[_0x5e09('0x23')](function(){_0x48606b[_0x5e09('0x1a')](0xcc)[_0x5e09('0x1b')]();});}};}function handleEntityNotFound(_0x37c689,_0x12802f){return function(_0x5c853d){if(!_0x5c853d){_0x37c689[_0x5e09('0x19')](0x194);}return _0x5c853d;};}function handleError(_0x98984e,_0x3ad63d){_0x3ad63d=_0x3ad63d||0x1f4;return function(_0x4cb5ea){logger['error'](_0x4cb5ea['stack']);if(_0x4cb5ea[_0x5e09('0x27')]){delete _0x4cb5ea[_0x5e09('0x27')];}_0x98984e[_0x5e09('0x1a')](_0x3ad63d)['send'](_0x4cb5ea);};}exports[_0x5e09('0x28')]=function(_0x5dadee,_0x71531){var _0x5a058e={},_0x3ff4c6={},_0xe9f2c0={'count':0x0,'rows':[]};var _0x50e1a8=_[_0x5e09('0x29')](db[_0x5e09('0x2a')][_0x5e09('0x2b')],function(_0x4b3d84){return{'name':_0x4b3d84[_0x5e09('0x2c')],'type':_0x4b3d84['type'][_0x5e09('0x2d')]};});_0x3ff4c6[_0x5e09('0x2e')]=_[_0x5e09('0x29')](_0x50e1a8,_0x5e09('0x27'));_0x3ff4c6[_0x5e09('0x2f')]=_[_0x5e09('0x30')](_0x5dadee[_0x5e09('0x2f')]);_0x3ff4c6[_0x5e09('0x31')]=_[_0x5e09('0x32')](_0x3ff4c6[_0x5e09('0x2e')],_0x3ff4c6[_0x5e09('0x2f')]);_0x5a058e[_0x5e09('0x33')]=_[_0x5e09('0x32')](_0x3ff4c6[_0x5e09('0x2e')],qs[_0x5e09('0x34')](_0x5dadee[_0x5e09('0x2f')]['fields']));_0x5a058e[_0x5e09('0x33')]=_0x5a058e[_0x5e09('0x33')][_0x5e09('0x35')]?_0x5a058e[_0x5e09('0x33')]:_0x3ff4c6[_0x5e09('0x2e')];if(!_0x5dadee['query']['hasOwnProperty']('nolimit')){_0x5a058e[_0x5e09('0x1e')]=qs['limit'](_0x5dadee['query'][_0x5e09('0x1e')]);_0x5a058e[_0x5e09('0x20')]=qs[_0x5e09('0x20')](_0x5dadee[_0x5e09('0x2f')][_0x5e09('0x20')]);}_0x5a058e[_0x5e09('0x36')]=qs[_0x5e09('0x37')](_0x5dadee['query'][_0x5e09('0x37')]);_0x5a058e[_0x5e09('0x38')]=qs[_0x5e09('0x31')](_[_0x5e09('0x39')](_0x5dadee[_0x5e09('0x2f')],_0x3ff4c6['filters']),_0x50e1a8);if(_0x5dadee[_0x5e09('0x2f')]['filter']){_0x5a058e[_0x5e09('0x38')]=_[_0x5e09('0x3a')](_0x5a058e[_0x5e09('0x38')],{'$or':_['map'](_0x50e1a8,function(_0x1f54c0){if(_0x1f54c0['type']!==_0x5e09('0x3b')){var _0x1e0984={};_0x1e0984[_0x1f54c0[_0x5e09('0x27')]]={'$like':'%'+_0x5dadee['query'][_0x5e09('0x3c')]+'%'};return _0x1e0984;}})});}_0x5a058e=_[_0x5e09('0x3a')]({},_0x5a058e,_0x5dadee[_0x5e09('0x3d')]);var _0xdbea8a={'where':_0x5a058e[_0x5e09('0x38')]};return db[_0x5e09('0x2a')]['count'](_0xdbea8a)[_0x5e09('0x23')](function(_0x2ef9f4){_0xe9f2c0[_0x5e09('0x1f')]=_0x2ef9f4;if(_0x5dadee[_0x5e09('0x2f')][_0x5e09('0x3e')]){_0x5a058e[_0x5e09('0x3f')]=[{'all':!![]}];}return db[_0x5e09('0x2a')][_0x5e09('0x40')](_0x5a058e);})['then'](function(_0x487606){_0xe9f2c0[_0x5e09('0x41')]=_0x487606;return _0xe9f2c0;})[_0x5e09('0x23')](respondWithFilteredResult(_0x71531,_0x5a058e))[_0x5e09('0x42')](handleError(_0x71531,null));};exports[_0x5e09('0x43')]=function(_0x1024f7,_0x212d68){var _0x2d3921={'raw':!![],'where':{'id':_0x1024f7[_0x5e09('0x44')]['id']}},_0x505c0c={};_0x505c0c[_0x5e09('0x2e')]=_['keys'](db[_0x5e09('0x2a')][_0x5e09('0x2b')]);_0x505c0c[_0x5e09('0x2f')]=_[_0x5e09('0x30')](_0x1024f7['query']);_0x505c0c[_0x5e09('0x31')]=_['intersection'](_0x505c0c[_0x5e09('0x2e')],_0x505c0c['query']);_0x2d3921[_0x5e09('0x33')]=_[_0x5e09('0x32')](_0x505c0c['model'],qs[_0x5e09('0x34')](_0x1024f7[_0x5e09('0x2f')][_0x5e09('0x34')]));_0x2d3921[_0x5e09('0x33')]=_0x2d3921[_0x5e09('0x33')][_0x5e09('0x35')]?_0x2d3921['attributes']:_0x505c0c[_0x5e09('0x2e')];if(_0x1024f7[_0x5e09('0x2f')][_0x5e09('0x3e')]){_0x2d3921[_0x5e09('0x3f')]=[{'all':!![]}];}_0x2d3921=_[_0x5e09('0x3a')]({},_0x2d3921,_0x1024f7['options']);return db[_0x5e09('0x2a')][_0x5e09('0x45')](_0x2d3921)['then'](handleEntityNotFound(_0x212d68,null))[_0x5e09('0x23')](respondWithResult(_0x212d68,null))['catch'](handleError(_0x212d68,null));};exports[_0x5e09('0x46')]=function(_0x2cf1c2,_0x1ddf0e){return db[_0x5e09('0x2a')][_0x5e09('0x46')](_0x2cf1c2[_0x5e09('0x47')],{})['then'](function(_0x3e6800){var _0x1ffa21=_0x2cf1c2[_0x5e09('0x48')][_0x5e09('0x25')]({'plain':!![]});if(!_0x1ffa21)throw new Error(_0x5e09('0x49'));if(_0x1ffa21[_0x5e09('0x4a')]==='user'){var _0x3df2d3=_0x3e6800[_0x5e09('0x25')]({'plain':!![]});var _0x39cb8f=_0x5e09('0x4b');return db[_0x5e09('0x4c')][_0x5e09('0x45')]({'where':{'name':_0x39cb8f,'userProfileId':_0x1ffa21['userProfileId']},'raw':!![]})[_0x5e09('0x23')](function(_0xa37f86){if(_0xa37f86&&_0xa37f86[_0x5e09('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3df2d3[_0x5e09('0x27')],'resourceId':_0x3df2d3['id'],'type':_0xa37f86[_0x5e09('0x27')],'sectionId':_0xa37f86['id']},{})[_0x5e09('0x23')](function(){return _0x3e6800;});}else{return _0x3e6800;}})[_0x5e09('0x42')](function(_0x54a5be){logger[_0x5e09('0x4e')](_0x5e09('0x4f'),_0x54a5be);throw _0x54a5be;});}return _0x3e6800;})[_0x5e09('0x23')](respondWithResult(_0x1ddf0e,0xc9))[_0x5e09('0x42')](handleError(_0x1ddf0e,null));};exports[_0x5e09('0x50')]=function(_0x5df335,_0x64f5a1){if(_0x5df335[_0x5e09('0x47')]['id']){delete _0x5df335[_0x5e09('0x47')]['id'];}return db[_0x5e09('0x2a')][_0x5e09('0x45')]({'where':{'id':_0x5df335[_0x5e09('0x44')]['id']}})[_0x5e09('0x23')](handleEntityNotFound(_0x64f5a1,null))['then'](saveUpdates(_0x5df335[_0x5e09('0x47')],null))[_0x5e09('0x23')](respondWithResult(_0x64f5a1,null))[_0x5e09('0x42')](handleError(_0x64f5a1,null));};exports['destroy']=function(_0x504001,_0x2da80c){return db['Interval'][_0x5e09('0x45')]({'where':{'id':_0x504001['params']['id']}})[_0x5e09('0x23')](handleEntityNotFound(_0x2da80c,null))['then'](removeEntity(_0x2da80c,null))[_0x5e09('0x42')](handleError(_0x2da80c,null));};exports[_0x5e09('0x51')]=function(_0x86f371,_0x5bdde3,_0x23bafc){if(_0x86f371['body']['id']){delete _0x86f371['body']['id'];}return db[_0x5e09('0x2a')][_0x5e09('0x45')]({'where':{'id':_0x86f371[_0x5e09('0x44')]['id']}})[_0x5e09('0x23')](handleEntityNotFound(_0x5bdde3,null))[_0x5e09('0x23')](function(_0x5145e9){if(_0x5145e9){_0x86f371[_0x5e09('0x47')][_0x5e09('0x52')]=_0x5145e9['id'];return db[_0x5e09('0x2a')][_0x5e09('0x46')](_0x86f371[_0x5e09('0x47')]);}})[_0x5e09('0x23')](respondWithResult(_0x5bdde3,null))[_0x5e09('0x42')](handleError(_0x5bdde3,null));};exports[_0x5e09('0x53')]=function(_0x544c6f,_0x3e41ce,_0x3f71ab){var _0x2890d2={};var _0x3735b6={};var _0x54820e;var _0x4809dd;return db[_0x5e09('0x2a')]['findOne']({'where':{'id':_0x544c6f[_0x5e09('0x44')]['id']}})[_0x5e09('0x23')](handleEntityNotFound(_0x3e41ce,null))[_0x5e09('0x23')](function(_0x341d0f){if(_0x341d0f){_0x54820e=_0x341d0f;_0x3735b6['model']=_['keys'](db[_0x5e09('0x2a')]['rawAttributes']);_0x3735b6[_0x5e09('0x2f')]=_[_0x5e09('0x30')](_0x544c6f[_0x5e09('0x2f')]);_0x3735b6['filters']=_[_0x5e09('0x32')](_0x3735b6['model'],_0x3735b6[_0x5e09('0x2f')]);_0x2890d2[_0x5e09('0x33')]=_['intersection'](_0x3735b6[_0x5e09('0x2e')],qs[_0x5e09('0x34')](_0x544c6f[_0x5e09('0x2f')]['fields']));_0x2890d2[_0x5e09('0x33')]=_0x2890d2['attributes'][_0x5e09('0x35')]?_0x2890d2[_0x5e09('0x33')]:_0x3735b6['model'];_0x2890d2[_0x5e09('0x36')]=qs[_0x5e09('0x37')](_0x544c6f[_0x5e09('0x2f')][_0x5e09('0x37')]);_0x2890d2[_0x5e09('0x38')]=qs[_0x5e09('0x31')](_[_0x5e09('0x39')](_0x544c6f[_0x5e09('0x2f')],_0x3735b6[_0x5e09('0x31')]));if(_0x544c6f[_0x5e09('0x2f')][_0x5e09('0x3c')]){_0x2890d2[_0x5e09('0x38')]=_['merge'](_0x2890d2[_0x5e09('0x38')],{'$or':_[_0x5e09('0x29')](_0x2890d2[_0x5e09('0x33')],function(_0x408f27){var _0x20c3d0={};_0x20c3d0[_0x408f27]={'$like':'%'+_0x544c6f[_0x5e09('0x2f')][_0x5e09('0x3c')]+'%'};return _0x20c3d0;})});}_0x2890d2=_[_0x5e09('0x3a')]({},_0x2890d2,_0x544c6f['options']);return _0x54820e[_0x5e09('0x53')](_0x2890d2);}})[_0x5e09('0x23')](function(_0x20c563){if(_0x20c563){_0x4809dd=_0x20c563[_0x5e09('0x35')];if(!_0x544c6f['query'][_0x5e09('0x54')](_0x5e09('0x55'))){_0x2890d2['limit']=qs[_0x5e09('0x1e')](_0x544c6f['query'][_0x5e09('0x1e')]);_0x2890d2[_0x5e09('0x20')]=qs[_0x5e09('0x20')](_0x544c6f[_0x5e09('0x2f')][_0x5e09('0x20')]);}return _0x54820e[_0x5e09('0x53')](_0x2890d2);}})['then'](function(_0x2ddded){if(_0x2ddded){return _0x2ddded?{'count':_0x4809dd,'rows':_0x2ddded}:null;}})[_0x5e09('0x23')](respondWithResult(_0x3e41ce,null))['catch'](handleError(_0x3e41ce,null));};exports[_0x5e09('0x56')]=function(_0x539b7e,_0xaf6aa9,_0x24a85d){return db[_0x5e09('0x2a')][_0x5e09('0x57')]({'where':{'id':_0x539b7e['params']['id']}})[_0x5e09('0x23')](handleEntityNotFound(_0xaf6aa9,null))[_0x5e09('0x23')](function(_0xdde254){if(_0xdde254){return db[_0x5e09('0x58')]['transaction'](function(_0x972d0b){return db[_0x5e09('0x2a')][_0x5e09('0x24')]({'where':{'IntervalId':_0x539b7e['params']['id']},'transaction':_0x972d0b})[_0x5e09('0x23')](function(_0x22c280){var _0x1465ec=_[_0x5e09('0x29')](_0x539b7e[_0x5e09('0x47')],function(_0x57d44c){delete _0x57d44c['id'];_0x57d44c[_0x5e09('0x52')]=_0x539b7e[_0x5e09('0x44')]['id'];return _0x57d44c;});return db[_0x5e09('0x2a')]['bulkCreate'](_0x1465ec,{'transaction':_0x972d0b});});})['then'](function(){return db['Interval'][_0x5e09('0x40')]({'where':{'IntervalId':_0x539b7e['params']['id']}});});}})[_0x5e09('0x23')](respondWithResult(_0xaf6aa9,null))[_0x5e09('0x42')](handleError(_0xaf6aa9,null));}; \ No newline at end of file +var _0x3149=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','offset','undefined','limit','count','set','apply','save','update','then','get','UserProfileResource','destroy','end','error','name','send','index','map','Interval','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','order','hasOwnProperty','nolimit','addIntervals','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1d46c7,_0x5ebda6){var _0x2a328f=function(_0x3725a8){while(--_0x3725a8){_0x1d46c7['push'](_0x1d46c7['shift']());}};_0x2a328f(++_0x5ebda6);}(_0x3149,0xf5));var _0x9314=function(_0x927dc8,_0x95f32b){_0x927dc8=_0x927dc8-0x0;var _0x48d23b=_0x3149[_0x927dc8];return _0x48d23b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9314('0x0'));var zipdir=require(_0x9314('0x1'));var jsonpatch=require(_0x9314('0x2'));var rp=require(_0x9314('0x3'));var moment=require(_0x9314('0x4'));var BPromise=require(_0x9314('0x5'));var Mustache=require('mustache');var util=require(_0x9314('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(_0x9314('0x7'));var _=require(_0x9314('0x8'));var squel=require(_0x9314('0x9'));var crypto=require(_0x9314('0xa'));var jsforce=require(_0x9314('0xb'));var deskjs=require(_0x9314('0xc'));var toCsv=require(_0x9314('0xd'));var querystring=require(_0x9314('0xe'));var Papa=require(_0x9314('0xf'));var Redis=require(_0x9314('0x10'));var authService=require(_0x9314('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9314('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9314('0x13'))(_0x9314('0x14'));var utils=require(_0x9314('0x15'));var config=require(_0x9314('0x16'));var licenseUtil=require(_0x9314('0x17'));var db=require(_0x9314('0x18'))['db'];var extensions=require(_0x9314('0x19'));function respondWithStatusCode(_0xf813fd,_0x2e9cd1){_0x2e9cd1=_0x2e9cd1||0xcc;return function(_0x447225){if(_0x447225){return _0xf813fd['sendStatus'](_0x2e9cd1);}return _0xf813fd[_0x9314('0x1a')](_0x2e9cd1)['end']();};}function respondWithResult(_0x146345,_0x391864){_0x391864=_0x391864||0xc8;return function(_0x392368){if(_0x392368){return _0x146345['status'](_0x391864)['json'](_0x392368);}};}function respondWithFilteredResult(_0x1f60bf,_0x9d51d){return function(_0x551343){if(_0x551343){var _0xb97c47=typeof _0x9d51d[_0x9314('0x1b')]===_0x9314('0x1c')&&typeof _0x9d51d[_0x9314('0x1d')]==='undefined';var _0x1fac12=_0x551343[_0x9314('0x1e')];var _0x1454d2=_0xb97c47?0x0:_0x9d51d['offset'];var _0xeb45c8=_0xb97c47?_0x551343[_0x9314('0x1e')]:_0x9d51d[_0x9314('0x1b')]+_0x9d51d[_0x9314('0x1d')];var _0x19238e;if(_0xeb45c8>=_0x1fac12){_0xeb45c8=_0x1fac12;_0x19238e=0xc8;}else{_0x19238e=0xce;}_0x1f60bf[_0x9314('0x1a')](_0x19238e);return _0x1f60bf[_0x9314('0x1f')]('Content-Range',_0x1454d2+'-'+_0xeb45c8+'/'+_0x1fac12)['json'](_0x551343);}return null;};}function patchUpdates(_0x353c4e){return function(_0x284315){try{jsonpatch[_0x9314('0x20')](_0x284315,_0x353c4e,!![]);}catch(_0x572112){return BPromise['reject'](_0x572112);}return _0x284315[_0x9314('0x21')]();};}function saveUpdates(_0x3c3f97,_0x44809c){return function(_0x127ede){if(_0x127ede){return _0x127ede[_0x9314('0x22')](_0x3c3f97)[_0x9314('0x23')](function(_0x436819){return _0x436819;});}return null;};}function removeEntity(_0x5348e7,_0x2cd4f3){return function(_0x1ca5be){if(_0x1ca5be){return _0x1ca5be['destroy']()['then'](function(){var _0x205276=_0x1ca5be[_0x9314('0x24')]({'plain':!![]});var _0x38b59b='Intervals';return db[_0x9314('0x25')][_0x9314('0x26')]({'where':{'type':_0x38b59b,'resourceId':_0x205276['id']}})[_0x9314('0x23')](function(){return _0x1ca5be;});})['then'](function(){_0x5348e7[_0x9314('0x1a')](0xcc)[_0x9314('0x27')]();});}};}function handleEntityNotFound(_0x542ff8,_0x3e24fe){return function(_0x21e52c){if(!_0x21e52c){_0x542ff8['sendStatus'](0x194);}return _0x21e52c;};}function handleError(_0x17e333,_0x36ea34){_0x36ea34=_0x36ea34||0x1f4;return function(_0x94848a){logger[_0x9314('0x28')](_0x94848a['stack']);if(_0x94848a['name']){delete _0x94848a[_0x9314('0x29')];}_0x17e333[_0x9314('0x1a')](_0x36ea34)[_0x9314('0x2a')](_0x94848a);};}exports[_0x9314('0x2b')]=function(_0x2d362e,_0x2ad4b5){var _0x4469be={},_0x5731dc={},_0x4f5ee1={'count':0x0,'rows':[]};var _0x4c129a=_[_0x9314('0x2c')](db[_0x9314('0x2d')]['rawAttributes'],function(_0x399a19){return{'name':_0x399a19[_0x9314('0x2e')],'type':_0x399a19[_0x9314('0x2f')][_0x9314('0x30')]};});_0x5731dc['model']=_[_0x9314('0x2c')](_0x4c129a,_0x9314('0x29'));_0x5731dc[_0x9314('0x31')]=_['keys'](_0x2d362e[_0x9314('0x31')]);_0x5731dc[_0x9314('0x32')]=_['intersection'](_0x5731dc[_0x9314('0x33')],_0x5731dc['query']);_0x4469be['attributes']=_[_0x9314('0x34')](_0x5731dc[_0x9314('0x33')],qs[_0x9314('0x35')](_0x2d362e[_0x9314('0x31')]['fields']));_0x4469be[_0x9314('0x36')]=_0x4469be[_0x9314('0x36')][_0x9314('0x37')]?_0x4469be['attributes']:_0x5731dc[_0x9314('0x33')];if(!_0x2d362e[_0x9314('0x31')]['hasOwnProperty']('nolimit')){_0x4469be[_0x9314('0x1d')]=qs[_0x9314('0x1d')](_0x2d362e[_0x9314('0x31')][_0x9314('0x1d')]);_0x4469be[_0x9314('0x1b')]=qs[_0x9314('0x1b')](_0x2d362e[_0x9314('0x31')][_0x9314('0x1b')]);}_0x4469be['order']=qs[_0x9314('0x38')](_0x2d362e[_0x9314('0x31')][_0x9314('0x38')]);_0x4469be['where']=qs[_0x9314('0x32')](_[_0x9314('0x39')](_0x2d362e[_0x9314('0x31')],_0x5731dc['filters']),_0x4c129a);if(_0x2d362e[_0x9314('0x31')][_0x9314('0x3a')]){_0x4469be[_0x9314('0x3b')]=_[_0x9314('0x3c')](_0x4469be[_0x9314('0x3b')],{'$or':_[_0x9314('0x2c')](_0x4c129a,function(_0x536751){if(_0x536751[_0x9314('0x2f')]!=='VIRTUAL'){var _0x367081={};_0x367081[_0x536751['name']]={'$like':'%'+_0x2d362e['query'][_0x9314('0x3a')]+'%'};return _0x367081;}})});}_0x4469be=_[_0x9314('0x3c')]({},_0x4469be,_0x2d362e[_0x9314('0x3d')]);var _0x53ba1e={'where':_0x4469be[_0x9314('0x3b')]};return db['Interval'][_0x9314('0x1e')](_0x53ba1e)[_0x9314('0x23')](function(_0x31132e){_0x4f5ee1[_0x9314('0x1e')]=_0x31132e;if(_0x2d362e['query'][_0x9314('0x3e')]){_0x4469be[_0x9314('0x3f')]=[{'all':!![]}];}return db[_0x9314('0x2d')][_0x9314('0x40')](_0x4469be);})[_0x9314('0x23')](function(_0x214ead){_0x4f5ee1['rows']=_0x214ead;return _0x4f5ee1;})[_0x9314('0x23')](respondWithFilteredResult(_0x2ad4b5,_0x4469be))[_0x9314('0x41')](handleError(_0x2ad4b5,null));};exports['show']=function(_0x104487,_0x53b093){var _0x565dae={'raw':!![],'where':{'id':_0x104487[_0x9314('0x42')]['id']}},_0x48ef8e={};_0x48ef8e[_0x9314('0x33')]=_[_0x9314('0x43')](db[_0x9314('0x2d')]['rawAttributes']);_0x48ef8e[_0x9314('0x31')]=_['keys'](_0x104487['query']);_0x48ef8e['filters']=_[_0x9314('0x34')](_0x48ef8e[_0x9314('0x33')],_0x48ef8e[_0x9314('0x31')]);_0x565dae[_0x9314('0x36')]=_[_0x9314('0x34')](_0x48ef8e['model'],qs[_0x9314('0x35')](_0x104487[_0x9314('0x31')][_0x9314('0x35')]));_0x565dae[_0x9314('0x36')]=_0x565dae['attributes'][_0x9314('0x37')]?_0x565dae[_0x9314('0x36')]:_0x48ef8e['model'];if(_0x104487[_0x9314('0x31')][_0x9314('0x3e')]){_0x565dae[_0x9314('0x3f')]=[{'all':!![]}];}_0x565dae=_['merge']({},_0x565dae,_0x104487[_0x9314('0x3d')]);return db['Interval']['find'](_0x565dae)[_0x9314('0x23')](handleEntityNotFound(_0x53b093,null))[_0x9314('0x23')](respondWithResult(_0x53b093,null))[_0x9314('0x41')](handleError(_0x53b093,null));};exports[_0x9314('0x44')]=function(_0x3230b8,_0x36557d){return db[_0x9314('0x2d')]['create'](_0x3230b8[_0x9314('0x45')],{})[_0x9314('0x23')](function(_0x11f372){var _0x47bf5c=_0x3230b8[_0x9314('0x46')][_0x9314('0x24')]({'plain':!![]});if(!_0x47bf5c)throw new Error(_0x9314('0x47'));if(_0x47bf5c[_0x9314('0x48')]===_0x9314('0x46')){var _0x31bfc2=_0x11f372[_0x9314('0x24')]({'plain':!![]});var _0x22c0ac='Intervals';return db[_0x9314('0x49')][_0x9314('0x4a')]({'where':{'name':_0x22c0ac,'userProfileId':_0x47bf5c[_0x9314('0x4b')]},'raw':!![]})['then'](function(_0x521b7e){if(_0x521b7e&&_0x521b7e[_0x9314('0x4c')]===0x0){return db[_0x9314('0x25')][_0x9314('0x44')]({'name':_0x31bfc2[_0x9314('0x29')],'resourceId':_0x31bfc2['id'],'type':_0x521b7e['name'],'sectionId':_0x521b7e['id']},{})['then'](function(){return _0x11f372;});}else{return _0x11f372;}})[_0x9314('0x41')](function(_0x43093e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43093e);throw _0x43093e;});}return _0x11f372;})[_0x9314('0x23')](respondWithResult(_0x36557d,0xc9))[_0x9314('0x41')](handleError(_0x36557d,null));};exports[_0x9314('0x22')]=function(_0x389580,_0x29a350){if(_0x389580['body']['id']){delete _0x389580['body']['id'];}return db[_0x9314('0x2d')][_0x9314('0x4a')]({'where':{'id':_0x389580['params']['id']}})[_0x9314('0x23')](handleEntityNotFound(_0x29a350,null))['then'](saveUpdates(_0x389580[_0x9314('0x45')],null))[_0x9314('0x23')](respondWithResult(_0x29a350,null))[_0x9314('0x41')](handleError(_0x29a350,null));};exports['destroy']=function(_0x52f469,_0x5663af){return db[_0x9314('0x2d')]['find']({'where':{'id':_0x52f469[_0x9314('0x42')]['id']}})['then'](handleEntityNotFound(_0x5663af,null))[_0x9314('0x23')](removeEntity(_0x5663af,null))[_0x9314('0x41')](handleError(_0x5663af,null));};exports[_0x9314('0x4d')]=function(_0x81cbf0,_0x3af1f8,_0x116fac){if(_0x81cbf0[_0x9314('0x45')]['id']){delete _0x81cbf0[_0x9314('0x45')]['id'];}return db[_0x9314('0x2d')][_0x9314('0x4a')]({'where':{'id':_0x81cbf0[_0x9314('0x42')]['id']}})['then'](handleEntityNotFound(_0x3af1f8,null))[_0x9314('0x23')](function(_0x9e8fe3){if(_0x9e8fe3){_0x81cbf0[_0x9314('0x45')][_0x9314('0x4e')]=_0x9e8fe3['id'];return db['Interval'][_0x9314('0x44')](_0x81cbf0['body']);}})['then'](respondWithResult(_0x3af1f8,null))[_0x9314('0x41')](handleError(_0x3af1f8,null));};exports[_0x9314('0x4f')]=function(_0x34b0c9,_0x412ed9,_0x3577f3){var _0x2445bf={};var _0x203b62={};var _0x14a5a7;var _0x39b18f;return db[_0x9314('0x2d')][_0x9314('0x50')]({'where':{'id':_0x34b0c9[_0x9314('0x42')]['id']}})[_0x9314('0x23')](handleEntityNotFound(_0x412ed9,null))['then'](function(_0x5a6192){if(_0x5a6192){_0x14a5a7=_0x5a6192;_0x203b62[_0x9314('0x33')]=_[_0x9314('0x43')](db[_0x9314('0x2d')]['rawAttributes']);_0x203b62['query']=_[_0x9314('0x43')](_0x34b0c9[_0x9314('0x31')]);_0x203b62[_0x9314('0x32')]=_[_0x9314('0x34')](_0x203b62['model'],_0x203b62['query']);_0x2445bf[_0x9314('0x36')]=_['intersection'](_0x203b62[_0x9314('0x33')],qs['fields'](_0x34b0c9[_0x9314('0x31')][_0x9314('0x35')]));_0x2445bf[_0x9314('0x36')]=_0x2445bf[_0x9314('0x36')]['length']?_0x2445bf[_0x9314('0x36')]:_0x203b62[_0x9314('0x33')];_0x2445bf[_0x9314('0x51')]=qs[_0x9314('0x38')](_0x34b0c9[_0x9314('0x31')][_0x9314('0x38')]);_0x2445bf[_0x9314('0x3b')]=qs['filters'](_[_0x9314('0x39')](_0x34b0c9[_0x9314('0x31')],_0x203b62['filters']));if(_0x34b0c9[_0x9314('0x31')][_0x9314('0x3a')]){_0x2445bf[_0x9314('0x3b')]=_[_0x9314('0x3c')](_0x2445bf[_0x9314('0x3b')],{'$or':_['map'](_0x2445bf[_0x9314('0x36')],function(_0x4ba18f){var _0x4839cf={};_0x4839cf[_0x4ba18f]={'$like':'%'+_0x34b0c9[_0x9314('0x31')][_0x9314('0x3a')]+'%'};return _0x4839cf;})});}_0x2445bf=_['merge']({},_0x2445bf,_0x34b0c9[_0x9314('0x3d')]);return _0x14a5a7[_0x9314('0x4f')](_0x2445bf);}})[_0x9314('0x23')](function(_0x4d85e1){if(_0x4d85e1){_0x39b18f=_0x4d85e1[_0x9314('0x37')];if(!_0x34b0c9['query'][_0x9314('0x52')](_0x9314('0x53'))){_0x2445bf[_0x9314('0x1d')]=qs['limit'](_0x34b0c9[_0x9314('0x31')][_0x9314('0x1d')]);_0x2445bf['offset']=qs[_0x9314('0x1b')](_0x34b0c9[_0x9314('0x31')][_0x9314('0x1b')]);}return _0x14a5a7[_0x9314('0x4f')](_0x2445bf);}})['then'](function(_0x391757){if(_0x391757){return _0x391757?{'count':_0x39b18f,'rows':_0x391757}:null;}})['then'](respondWithResult(_0x412ed9,null))[_0x9314('0x41')](handleError(_0x412ed9,null));};exports[_0x9314('0x54')]=function(_0x55555a,_0x5dcb2a,_0x22da9c){return db[_0x9314('0x2d')][_0x9314('0x50')]({'where':{'id':_0x55555a['params']['id']}})[_0x9314('0x23')](handleEntityNotFound(_0x5dcb2a,null))['then'](function(_0x483caa){if(_0x483caa){return db[_0x9314('0x55')][_0x9314('0x56')](function(_0x87c73d){return db[_0x9314('0x2d')][_0x9314('0x26')]({'where':{'IntervalId':_0x55555a['params']['id']},'transaction':_0x87c73d})[_0x9314('0x23')](function(_0x4d2ca1){var _0x491f7b=_[_0x9314('0x2c')](_0x55555a['body'],function(_0x58b38b){delete _0x58b38b['id'];_0x58b38b['IntervalId']=_0x55555a[_0x9314('0x42')]['id'];return _0x58b38b;});return db[_0x9314('0x2d')][_0x9314('0x57')](_0x491f7b,{'transaction':_0x87c73d});});})['then'](function(){return db[_0x9314('0x2d')][_0x9314('0x40')]({'where':{'IntervalId':_0x55555a[_0x9314('0x42')]['id']}});});}})[_0x9314('0x23')](respondWithResult(_0x5dcb2a,null))['catch'](handleError(_0x5dcb2a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d3643a8..1688e96 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 _0xaff6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./interval.attributes','exports','define','Interval','rewrite'];(function(_0x4b19cf,_0x24be08){var _0x4fdb3b=function(_0x591dbf){while(--_0x591dbf){_0x4b19cf['push'](_0x4b19cf['shift']());}};_0x4fdb3b(++_0x24be08);}(_0xaff6,0xa9));var _0x6aff=function(_0x3369c5,_0xce66ba){_0x3369c5=_0x3369c5-0x0;var _0x10fae9=_0xaff6[_0x3369c5];return _0x10fae9;};'use strict';var _=require('lodash');var util=require(_0x6aff('0x0'));var logger=require(_0x6aff('0x1'))(_0x6aff('0x2'));var moment=require(_0x6aff('0x3'));var BPromise=require(_0x6aff('0x4'));var rp=require(_0x6aff('0x5'));var fs=require('fs');var path=require(_0x6aff('0x6'));var rimraf=require(_0x6aff('0x7'));var config=require('../../config/environment');var attributes=require(_0x6aff('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x6aff('0x9')]=function(_0x481fdd,_0xf69d57){return _0x481fdd[_0x6aff('0xa')](_0x6aff('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35fd45,_0x30f4eb){extensions['rewrite'](_0x481fdd,_0x35fd45);},'afterBulkCreate':function(_0x56aa0e,_0x3dbe62,_0x4f21bf){_0x4f21bf();extensions[_0x6aff('0xc')](_0x481fdd,_0x56aa0e[0x0]);},'afterUpdate':function(_0x2520e8,_0x4b2dbd){extensions[_0x6aff('0xc')](_0x481fdd,_0x2520e8);},'afterDestroy':function(_0x4dc8f0,_0x5c06a5){extensions['rewrite'](_0x481fdd,_0x4dc8f0);}}});}; \ No newline at end of file +var _0xcf10=['tools_intervals','rewrite','lodash','../../config/logger','moment','request-promise','path','rimraf','./interval.attributes','exports','define'];(function(_0x513f85,_0x22c91e){var _0x5600b8=function(_0x4bc65e){while(--_0x4bc65e){_0x513f85['push'](_0x513f85['shift']());}};_0x5600b8(++_0x22c91e);}(_0xcf10,0xc8));var _0x0cf1=function(_0xfbac0b,_0x20b38b){_0xfbac0b=_0xfbac0b-0x0;var _0x14e054=_0xcf10[_0xfbac0b];return _0x14e054;};'use strict';var _=require(_0x0cf1('0x0'));var util=require('util');var logger=require(_0x0cf1('0x1'))('api');var moment=require(_0x0cf1('0x2'));var BPromise=require('bluebird');var rp=require(_0x0cf1('0x3'));var fs=require('fs');var path=require(_0x0cf1('0x4'));var rimraf=require(_0x0cf1('0x5'));var config=require('../../config/environment');var attributes=require(_0x0cf1('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x0cf1('0x7')]=function(_0x2d3d3f,_0x8519dd){return _0x2d3d3f[_0x0cf1('0x8')]('Interval',attributes,{'tableName':_0x0cf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb029,_0x215bbc){extensions['rewrite'](_0x2d3d3f,_0x3eb029);},'afterBulkCreate':function(_0x1a22e5,_0x1270c3,_0x309b52){_0x309b52();extensions[_0x0cf1('0xa')](_0x2d3d3f,_0x1a22e5[0x0]);},'afterUpdate':function(_0x28a966,_0x11b1c){extensions[_0x0cf1('0xa')](_0x2d3d3f,_0x28a966);},'afterDestroy':function(_0x37bf58,_0xf2176a){extensions['rewrite'](_0x2d3d3f,_0x37bf58);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 44a1231..813434b 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(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_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);});});}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(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 100f4dc..b96f9a5 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(_0x45f29a,_0x5c7b24){var _0x4bd257=function(_0x5c1b0f){while(--_0x5c1b0f){_0x45f29a['push'](_0x45f29a['shift']());}};_0x4bd257(++_0x5c7b24);}(_0x2ef3,0xba));var _0x32ef=function(_0x19249a,_0x332012){_0x19249a=_0x19249a-0x0;var _0x43f5a6=_0x2ef3[_0x19249a];return _0x43f5a6;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1151f6,_0x428f14){var _0x5df5c5=function(_0x26daeb){while(--_0x26daeb){_0x1151f6['push'](_0x1151f6['shift']());}};_0x5df5c5(++_0x428f14);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b0966,_0x3fc4ca){_0x3b0966=_0x3b0966-0x0;var _0x18e6b0=_0x5f2f[_0x3b0966];return _0x18e6b0;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f93a1ac..9092033 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 _0xe58c=['MOTGUI','Report','\x20from\x20','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key'];(function(_0x5ce7a4,_0x316e0b){var _0x4e82ab=function(_0x1db1cd){while(--_0x1db1cd){_0x5ce7a4['push'](_0x5ce7a4['shift']());}};_0x4e82ab(++_0x316e0b);}(_0xe58c,0xf7));var _0xce58=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe58c[_0x2dadb9];return _0x2f0097;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xce58('0x0'))(_0xce58('0x1'));var USERNAME=_0xce58('0x2');var PASSWORD=_0xce58('0x3');function openIssue(_0x406841,_0x437073){var _0x35f9d3={'fields':{'project':{'key':_0x406841[_0xce58('0x4')]||_0xce58('0x5')},'summary':(_0x406841['summary']||_0xce58('0x6'))+_0xce58('0x7')+_0x406841['ip'],'description':_0x406841['description']||JSON[_0xce58('0x8')](_0x406841),'issuetype':{'name':_0x406841['issuetype']||_0xce58('0x9')}}};_0x35f9d3['fields'][_0xce58('0xa')]=_0x406841[_0xce58('0xb')];_0x35f9d3[_0xce58('0xc')][_0xce58('0xd')]=_0x406841[_0xce58('0xe')];_0x35f9d3[_0xce58('0xc')]['customfield_11502']=_0x406841[_0xce58('0xf')];_0x35f9d3[_0xce58('0xc')][_0xce58('0x10')]=_0x406841[_0xce58('0x11')];_0x35f9d3[_0xce58('0xc')]['customfield_11504']=_0x406841[_0xce58('0x12')];_0x35f9d3['fields'][_0xce58('0x13')]=_0x406841['ip'];var _0x237e83={'host':_0xce58('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xce58('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xce58('0x16'),'Authorization':_0xce58('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xce58('0x18')](_0xce58('0x19'))}};var _0x4cf274=JSON[_0xce58('0x8')](_0x35f9d3);var _0x9639fe=https[_0xce58('0x1a')](_0x237e83,function(_0x32d90b){_0x32d90b[_0xce58('0x1b')]('utf8');var _0xc4f6bd='';_0x32d90b['on'](_0xce58('0x1c'),function(_0xd07f2d){_0xc4f6bd+=_0xd07f2d;});_0x32d90b['on'](_0xce58('0x1d'),function(){if(_0x437073){return _0x437073[_0xce58('0x1e')](_0x32d90b[_0xce58('0x1f')])[_0xce58('0x20')](JSON[_0xce58('0x21')](_0xc4f6bd));}});});_0x9639fe['on'](_0xce58('0x22'),function(_0x29692b){if(_0x437073){return _0x437073['status'](0x1f4)[_0xce58('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xce58('0x23')}]});}});_0x9639fe[_0xce58('0x24')](_0x4cf274);_0x9639fe['end']();}exports[_0xce58('0x25')]=openIssue;exports[_0xce58('0x26')]=function(_0x378d06,_0x4c4cb6){_0x378d06['body']['ip']=_0x378d06['headers']['x-forwarded-for']||_0x378d06[_0xce58('0x27')][_0xce58('0x28')]||_0x378d06[_0xce58('0x29')]['remoteAddress']||_0x378d06[_0xce58('0x27')][_0xce58('0x29')][_0xce58('0x28')];return openIssue(_0x378d06['body'],_0x4c4cb6);}; \ No newline at end of file +var _0x6ab0=['customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','api','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','email','fields','oldToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ab0,0x1ab));var _0x06ab=function(_0x3d1f47,_0x1b5066){_0x3d1f47=_0x3d1f47-0x0;var _0x41efdf=_0x6ab0[_0x3d1f47];return _0x41efdf;};'use strict';var BPromise=require(_0x06ab('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x06ab('0x1'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x570ed7,_0x3c0932){var _0x1d9a17={'fields':{'project':{'key':_0x570ed7[_0x06ab('0x2')]||_0x06ab('0x3')},'summary':(_0x570ed7[_0x06ab('0x4')]||'Report')+_0x06ab('0x5')+_0x570ed7['ip'],'description':_0x570ed7[_0x06ab('0x6')]||JSON[_0x06ab('0x7')](_0x570ed7),'issuetype':{'name':_0x570ed7[_0x06ab('0x8')]||_0x06ab('0x9')}}};_0x1d9a17['fields']['customfield_11500']=_0x570ed7[_0x06ab('0xa')];_0x1d9a17[_0x06ab('0xb')]['customfield_11501']=_0x570ed7[_0x06ab('0xc')];_0x1d9a17[_0x06ab('0xb')][_0x06ab('0xd')]=_0x570ed7[_0x06ab('0xe')];_0x1d9a17[_0x06ab('0xb')][_0x06ab('0xf')]=_0x570ed7[_0x06ab('0x10')];_0x1d9a17[_0x06ab('0xb')][_0x06ab('0x11')]=_0x570ed7['reason'];_0x1d9a17[_0x06ab('0xb')][_0x06ab('0x12')]=_0x570ed7['ip'];var _0x23d444={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x06ab('0x13'),'method':_0x06ab('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x06ab('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x06ab('0x16')](_0x06ab('0x17'))}};var _0x3418ea=JSON['stringify'](_0x1d9a17);var _0x271e23=https['request'](_0x23d444,function(_0x3b7cf5){_0x3b7cf5[_0x06ab('0x18')]('utf8');var _0x1e7e46='';_0x3b7cf5['on']('data',function(_0x1fc4b6){_0x1e7e46+=_0x1fc4b6;});_0x3b7cf5['on'](_0x06ab('0x19'),function(){if(_0x3c0932){return _0x3c0932[_0x06ab('0x1a')](_0x3b7cf5['statusCode'])[_0x06ab('0x1b')](JSON[_0x06ab('0x1c')](_0x1e7e46));}});});_0x271e23['on'](_0x06ab('0x1d'),function(_0x2bd69e){if(_0x3c0932){return _0x3c0932['status'](0x1f4)[_0x06ab('0x1b')]({'errors':[{'message':_0x06ab('0x1e'),'type':_0x06ab('0x1f')}]});}});_0x271e23[_0x06ab('0x20')](_0x3418ea);_0x271e23['end']();}exports[_0x06ab('0x21')]=openIssue;exports[_0x06ab('0x22')]=function(_0x14b391,_0x1af48b){_0x14b391[_0x06ab('0x23')]['ip']=_0x14b391[_0x06ab('0x24')][_0x06ab('0x25')]||_0x14b391['connection'][_0x06ab('0x26')]||_0x14b391[_0x06ab('0x27')]['remoteAddress']||_0x14b391['connection'][_0x06ab('0x27')][_0x06ab('0x26')];return openIssue(_0x14b391[_0x06ab('0x23')],_0x1af48b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2b077a4..986998e 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 _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x1770f8,_0x3e1dfd){var _0x58546b=function(_0x1541d2){while(--_0x1541d2){_0x1770f8['push'](_0x1770f8['shift']());}};_0x58546b(++_0x3e1dfd);}(_0xa8a8,0xec));var _0x8a8a=function(_0x142ef1,_0x713486){_0x142ef1=_0x142ef1-0x0;var _0x106667=_0xa8a8[_0x142ef1];return _0x106667;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file +var _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x114d03,_0x37adb1){var _0x13e979=function(_0x264408){while(--_0x264408){_0x114d03['push'](_0x114d03['shift']());}};_0x13e979(++_0x37adb1);}(_0xb821,0xa7));var _0x1b82=function(_0x2a714f,_0x5e63ea){_0x2a714f=_0x2a714f-0x0;var _0x306c6d=_0xb821[_0x2a714f];return _0x306c6d;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('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 4588b20..d58654d 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x29fb2b,_0x39f980){_0x29fb2b=_0x29fb2b-0x0;var _0x500946=_0x7a54[_0x29fb2b];return _0x500946;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1f984c,_0x469223){_0x1f984c=_0x1f984c-0x0;var _0x3a1002=_0x7a54[_0x1f984c];return _0x3a1002;};'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 a34c0a8..7fd1b67 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 _0xa423=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','findAll','rows','show','params','keys','length','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4856fe,_0x3fbf69){var _0x30e54b=function(_0x262f03){while(--_0x262f03){_0x4856fe['push'](_0x4856fe['shift']());}};_0x30e54b(++_0x3fbf69);}(_0xa423,0x16c));var _0x3a42=function(_0x375b7d,_0x243a50){_0x375b7d=_0x375b7d-0x0;var _0x4b4cfb=_0xa423[_0x375b7d];return _0x4b4cfb;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ccc8,_0x4df153){_0x4df153=_0x4df153||0xcc;return function(_0x4008ea){if(_0x4008ea){return _0x11ccc8[_0x3a42('0x1a')](_0x4df153);}return _0x11ccc8[_0x3a42('0x1b')](_0x4df153)[_0x3a42('0x1c')]();};}function respondWithResult(_0x891963,_0x475602){_0x475602=_0x475602||0xc8;return function(_0x5f5244){if(_0x5f5244){return _0x891963[_0x3a42('0x1b')](_0x475602)['json'](_0x5f5244);}};}function respondWithFilteredResult(_0x469c73,_0x4b1d68){return function(_0x3e5d77){if(_0x3e5d77){var _0x5895a8=typeof _0x4b1d68[_0x3a42('0x1d')]==='undefined'&&typeof _0x4b1d68['limit']==='undefined';var _0x26c844=_0x3e5d77[_0x3a42('0x1e')];var _0x438cf1=_0x5895a8?0x0:_0x4b1d68[_0x3a42('0x1d')];var _0x318526=_0x5895a8?_0x3e5d77['count']:_0x4b1d68[_0x3a42('0x1d')]+_0x4b1d68[_0x3a42('0x1f')];var _0x49f00e;if(_0x318526>=_0x26c844){_0x318526=_0x26c844;_0x49f00e=0xc8;}else{_0x49f00e=0xce;}_0x469c73[_0x3a42('0x1b')](_0x49f00e);return _0x469c73[_0x3a42('0x20')](_0x3a42('0x21'),_0x438cf1+'-'+_0x318526+'/'+_0x26c844)['json'](_0x3e5d77);}return null;};}function patchUpdates(_0x1fcea4){return function(_0x3f4afb){try{jsonpatch[_0x3a42('0x22')](_0x3f4afb,_0x1fcea4,!![]);}catch(_0x477605){return BPromise[_0x3a42('0x23')](_0x477605);}return _0x3f4afb['save']();};}function saveUpdates(_0x34927a,_0x42b40f){return function(_0x379fe6){if(_0x379fe6){return _0x379fe6[_0x3a42('0x24')](_0x34927a)[_0x3a42('0x25')](function(_0x5b41d2){return _0x5b41d2;});}return null;};}function removeEntity(_0xab8ab7,_0x41b374){return function(_0x477cb9){if(_0x477cb9){return _0x477cb9[_0x3a42('0x26')]()[_0x3a42('0x25')](function(){_0xab8ab7[_0x3a42('0x1b')](0xcc)[_0x3a42('0x1c')]();});}};}function handleEntityNotFound(_0x434044,_0x2c4b3a){return function(_0x3a3f87){if(!_0x3a3f87){_0x434044[_0x3a42('0x1a')](0x194);}return _0x3a3f87;};}function handleError(_0x510c93,_0x222f88){_0x222f88=_0x222f88||0x1f4;return function(_0x468ea8){logger['error'](_0x468ea8[_0x3a42('0x27')]);if(_0x468ea8['name']){delete _0x468ea8[_0x3a42('0x28')];}_0x510c93[_0x3a42('0x1b')](_0x222f88)[_0x3a42('0x29')](_0x468ea8);};}exports[_0x3a42('0x2a')]=function(_0x1559cd,_0xaf28ad){var _0x4b8fe7={},_0x175fc4={},_0xdb014d={'count':0x0,'rows':[]};var _0x1dc0c0=_[_0x3a42('0x2b')](db[_0x3a42('0x2c')][_0x3a42('0x2d')],function(_0x41776f){return{'name':_0x41776f['fieldName'],'type':_0x41776f[_0x3a42('0x2e')][_0x3a42('0x2f')]};});_0x175fc4[_0x3a42('0x30')]=_[_0x3a42('0x2b')](_0x1dc0c0,_0x3a42('0x28'));_0x175fc4['query']=_['keys'](_0x1559cd[_0x3a42('0x31')]);_0x175fc4['filters']=_[_0x3a42('0x32')](_0x175fc4[_0x3a42('0x30')],_0x175fc4[_0x3a42('0x31')]);_0x4b8fe7[_0x3a42('0x33')]=_[_0x3a42('0x32')](_0x175fc4[_0x3a42('0x30')],qs['fields'](_0x1559cd[_0x3a42('0x31')][_0x3a42('0x34')]));_0x4b8fe7[_0x3a42('0x33')]=_0x4b8fe7['attributes']['length']?_0x4b8fe7[_0x3a42('0x33')]:_0x175fc4[_0x3a42('0x30')];if(!_0x1559cd[_0x3a42('0x31')][_0x3a42('0x35')](_0x3a42('0x36'))){_0x4b8fe7['limit']=qs['limit'](_0x1559cd[_0x3a42('0x31')][_0x3a42('0x1f')]);_0x4b8fe7[_0x3a42('0x1d')]=qs[_0x3a42('0x1d')](_0x1559cd['query'][_0x3a42('0x1d')]);}_0x4b8fe7[_0x3a42('0x37')]=qs['sort'](_0x1559cd['query']['sort']);_0x4b8fe7[_0x3a42('0x38')]=qs['filters'](_[_0x3a42('0x39')](_0x1559cd[_0x3a42('0x31')],_0x175fc4[_0x3a42('0x3a')]),_0x1dc0c0);if(_0x1559cd[_0x3a42('0x31')][_0x3a42('0x3b')]){_0x4b8fe7[_0x3a42('0x38')]=_[_0x3a42('0x3c')](_0x4b8fe7[_0x3a42('0x38')],{'$or':_[_0x3a42('0x2b')](_0x1dc0c0,function(_0x54004c){if(_0x54004c[_0x3a42('0x2e')]!==_0x3a42('0x3d')){var _0x2541db={};_0x2541db[_0x54004c[_0x3a42('0x28')]]={'$like':'%'+_0x1559cd[_0x3a42('0x31')]['filter']+'%'};return _0x2541db;}})});}_0x4b8fe7=_[_0x3a42('0x3c')]({},_0x4b8fe7,_0x1559cd['options']);var _0x4e9224={'where':_0x4b8fe7['where']};return db['JscriptyAnswerReport'][_0x3a42('0x1e')](_0x4e9224)['then'](function(_0x56e32b){_0xdb014d['count']=_0x56e32b;if(_0x1559cd[_0x3a42('0x31')]['includeAll']){_0x4b8fe7['include']=[{'all':!![]}];}return db[_0x3a42('0x2c')][_0x3a42('0x3e')](_0x4b8fe7);})[_0x3a42('0x25')](function(_0x1f49e9){_0xdb014d[_0x3a42('0x3f')]=_0x1f49e9;return _0xdb014d;})[_0x3a42('0x25')](respondWithFilteredResult(_0xaf28ad,_0x4b8fe7))['catch'](handleError(_0xaf28ad,null));};exports[_0x3a42('0x40')]=function(_0x139593,_0x3e5f89){var _0x52a21c={'raw':!![],'where':{'id':_0x139593[_0x3a42('0x41')]['id']}},_0x167dc3={};_0x167dc3['model']=_[_0x3a42('0x42')](db[_0x3a42('0x2c')][_0x3a42('0x2d')]);_0x167dc3[_0x3a42('0x31')]=_[_0x3a42('0x42')](_0x139593[_0x3a42('0x31')]);_0x167dc3[_0x3a42('0x3a')]=_['intersection'](_0x167dc3[_0x3a42('0x30')],_0x167dc3[_0x3a42('0x31')]);_0x52a21c[_0x3a42('0x33')]=_[_0x3a42('0x32')](_0x167dc3[_0x3a42('0x30')],qs['fields'](_0x139593[_0x3a42('0x31')][_0x3a42('0x34')]));_0x52a21c[_0x3a42('0x33')]=_0x52a21c['attributes'][_0x3a42('0x43')]?_0x52a21c[_0x3a42('0x33')]:_0x167dc3[_0x3a42('0x30')];if(_0x139593[_0x3a42('0x31')][_0x3a42('0x44')]){_0x52a21c['include']=[{'all':!![]}];}_0x52a21c=_[_0x3a42('0x3c')]({},_0x52a21c,_0x139593[_0x3a42('0x45')]);return db[_0x3a42('0x2c')][_0x3a42('0x46')](_0x52a21c)['then'](handleEntityNotFound(_0x3e5f89,null))[_0x3a42('0x25')](respondWithResult(_0x3e5f89,null))[_0x3a42('0x47')](handleError(_0x3e5f89,null));};exports[_0x3a42('0x48')]=function(_0x2d3e3c,_0x8e5316){return db[_0x3a42('0x2c')][_0x3a42('0x48')](_0x2d3e3c['body'],{})[_0x3a42('0x25')](respondWithResult(_0x8e5316,0xc9))[_0x3a42('0x47')](handleError(_0x8e5316,null));};exports[_0x3a42('0x24')]=function(_0x1f9912,_0x34cf64){if(_0x1f9912[_0x3a42('0x49')]['id']){delete _0x1f9912['body']['id'];}return db[_0x3a42('0x2c')]['find']({'where':{'id':_0x1f9912[_0x3a42('0x41')]['id']}})[_0x3a42('0x25')](handleEntityNotFound(_0x34cf64,null))[_0x3a42('0x25')](saveUpdates(_0x1f9912[_0x3a42('0x49')],null))[_0x3a42('0x25')](respondWithResult(_0x34cf64,null))[_0x3a42('0x47')](handleError(_0x34cf64,null));};exports[_0x3a42('0x26')]=function(_0x36dbb3,_0x32552f){return db['JscriptyAnswerReport'][_0x3a42('0x46')]({'where':{'id':_0x36dbb3[_0x3a42('0x41')]['id']}})['then'](handleEntityNotFound(_0x32552f,null))['then'](removeEntity(_0x32552f,null))[_0x3a42('0x47')](handleError(_0x32552f,null));};exports[_0x3a42('0x4a')]=function(_0x4e968d,_0x1fc91c){return db[_0x3a42('0x2c')][_0x3a42('0x4a')]()['then'](respondWithResult(_0x1fc91c,null))[_0x3a42('0x47')](handleError(_0x1fc91c,null));}; \ No newline at end of file +var _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0xa751,0x175));var _0x1a75=function(_0xc3b924,_0x1b4a69){_0xc3b924=_0xc3b924-0x0;var _0x325071=_0xa751[_0xc3b924];return _0x325071;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['JscriptyAnswerReport'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3d926ff..86e74ec 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 _0xb350=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb350,0x1cc));var _0x0b35=function(_0x4db25c,_0x2468ef){_0x4db25c=_0x4db25c-0x0;var _0x6cb1d2=_0xb350[_0x4db25c];return _0x6cb1d2;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require('../../config/logger')(_0x0b35('0x2'));var moment=require(_0x0b35('0x3'));var BPromise=require(_0x0b35('0x4'));var rp=require(_0x0b35('0x5'));var fs=require('fs');var path=require(_0x0b35('0x6'));var rimraf=require('rimraf');var config=require(_0x0b35('0x7'));var attributes=require(_0x0b35('0x8'));module[_0x0b35('0x9')]=function(_0x20b967,_0x2ff41f){return _0x20b967['define'](_0x0b35('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad61=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x22eeae,_0x4984f2){var _0x3b9c11=function(_0x1c0a28){while(--_0x1c0a28){_0x22eeae['push'](_0x22eeae['shift']());}};_0x3b9c11(++_0x4984f2);}(_0xad61,0x85));var _0x1ad6=function(_0x773203,_0x2d3f74){_0x773203=_0x773203-0x0;var _0x4a7d22=_0xad61[_0x773203];return _0x4a7d22;};'use strict';var _=require(_0x1ad6('0x0'));var util=require(_0x1ad6('0x1'));var logger=require(_0x1ad6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1ad6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ad6('0x4'));var rimraf=require(_0x1ad6('0x5'));var config=require(_0x1ad6('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x5b31fc,_0x588a8b){return _0x5b31fc[_0x1ad6('0x7')](_0x1ad6('0x8'),attributes,{'tableName':_0x1ad6('0x9'),'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 9419f64..06d3a71 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 _0xb80d=['../../config/environment','jayson/promise','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x66cdcf,_0x37ecfd){var _0x26a851=function(_0x50191e){while(--_0x50191e){_0x66cdcf['push'](_0x66cdcf['shift']());}};_0x26a851(++_0x37ecfd);}(_0xb80d,0x171));var _0xdb80=function(_0x70dc3f,_0xfc371b){_0x70dc3f=_0x70dc3f-0x0;var _0x447aa4=_0xb80d[_0x70dc3f];return _0x447aa4;};'use strict';var _=require(_0xdb80('0x0'));var util=require(_0xdb80('0x1'));var moment=require(_0xdb80('0x2'));var BPromise=require(_0xdb80('0x3'));var rs=require(_0xdb80('0x4'));var fs=require('fs');var Redis=require(_0xdb80('0x5'));var db=require(_0xdb80('0x6'))['db'];var utils=require(_0xdb80('0x7'));var logger=require('../../config/logger')(_0xdb80('0x8'));var config=require(_0xdb80('0x9'));var jayson=require(_0xdb80('0xa'));var client=jayson['client'][_0xdb80('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x381d21,_0x216e2f,_0x22783c){return new BPromise(function(_0x90a308,_0x392b35){return client[_0xdb80('0xc')](_0x381d21,_0x22783c)['then'](function(_0x21eb3f){logger[_0xdb80('0xd')](_0xdb80('0xe'),_0x216e2f,_0xdb80('0xf'));logger['debug'](_0xdb80('0x10'),_0x216e2f,_0xdb80('0xf'),JSON[_0xdb80('0x11')](_0x21eb3f));if(_0x21eb3f[_0xdb80('0x12')]){if(_0x21eb3f['error'][_0xdb80('0x13')]===0x1f4){logger['error'](_0xdb80('0xe'),_0x216e2f,_0x21eb3f[_0xdb80('0x12')][_0xdb80('0x14')]);return _0x392b35(_0x21eb3f[_0xdb80('0x12')][_0xdb80('0x14')]);}logger[_0xdb80('0x12')](_0xdb80('0xe'),_0x216e2f,_0x21eb3f['error'][_0xdb80('0x14')]);return _0x90a308(_0x21eb3f[_0xdb80('0x12')][_0xdb80('0x14')]);}else{logger[_0xdb80('0xd')](_0xdb80('0xe'),_0x216e2f,_0xdb80('0xf'));_0x90a308(_0x21eb3f['result']['message']);}})['catch'](function(_0x333baf){logger[_0xdb80('0x12')](_0xdb80('0xe'),_0x216e2f,_0x333baf);_0x392b35(_0x333baf);});});} \ No newline at end of file +var _0x1580=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x166f70,_0x482794){var _0x439994=function(_0x16cbce){while(--_0x16cbce){_0x166f70['push'](_0x166f70['shift']());}};_0x439994(++_0x482794);}(_0x1580,0x93));var _0x0158=function(_0x290343,_0x36c848){_0x290343=_0x290343-0x0;var _0x211bcd=_0x1580[_0x290343];return _0x211bcd;};'use strict';var _=require(_0x0158('0x0'));var util=require(_0x0158('0x1'));var moment=require(_0x0158('0x2'));var BPromise=require(_0x0158('0x3'));var rs=require(_0x0158('0x4'));var fs=require('fs');var Redis=require(_0x0158('0x5'));var db=require(_0x0158('0x6'))['db'];var utils=require(_0x0158('0x7'));var logger=require('../../config/logger')(_0x0158('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0158('0x9')][_0x0158('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bb47,_0x1d23ae,_0x197989){return new BPromise(function(_0x51c96b,_0x200ebb){return client[_0x0158('0xb')](_0x31bb47,_0x197989)['then'](function(_0x2d21f7){logger[_0x0158('0xc')](_0x0158('0xd'),_0x1d23ae,_0x0158('0xe'));logger[_0x0158('0xf')](_0x0158('0x10'),_0x1d23ae,_0x0158('0xe'),JSON[_0x0158('0x11')](_0x2d21f7));if(_0x2d21f7[_0x0158('0x12')]){if(_0x2d21f7[_0x0158('0x12')]['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1d23ae,_0x2d21f7[_0x0158('0x12')][_0x0158('0x13')]);return _0x200ebb(_0x2d21f7[_0x0158('0x12')][_0x0158('0x13')]);}logger[_0x0158('0x12')](_0x0158('0xd'),_0x1d23ae,_0x2d21f7[_0x0158('0x12')][_0x0158('0x13')]);return _0x51c96b(_0x2d21f7[_0x0158('0x12')][_0x0158('0x13')]);}else{logger[_0x0158('0xc')](_0x0158('0xd'),_0x1d23ae,_0x0158('0xe'));_0x51c96b(_0x2d21f7[_0x0158('0x14')][_0x0158('0x13')]);}})['catch'](function(_0x18c8c4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1d23ae,_0x18c8c4);_0x200ebb(_0x18c8c4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 324fc71..8b4fbea 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 _0xe38b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','/:id','show','/:id/sessions','isAuthenticated','getSessions','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','delete','exports','multer'];(function(_0x132889,_0x2207a8){var _0xd93752=function(_0x572faa){while(--_0x572faa){_0x132889['push'](_0x132889['shift']());}};_0xd93752(++_0x2207a8);}(_0xe38b,0x1a8));var _0xbe38=function(_0x162625,_0x5c1689){_0x162625=_0x162625-0x0;var _0x48c177=_0xe38b[_0x162625];return _0x48c177;};'use strict';var multer=require(_0xbe38('0x0'));var util=require(_0xbe38('0x1'));var path=require(_0xbe38('0x2'));var timeout=require(_0xbe38('0x3'));var express=require(_0xbe38('0x4'));var router=express[_0xbe38('0x5')]();var fs_extra=require(_0xbe38('0x6'));var auth=require(_0xbe38('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbe38('0x8'));var controller=require(_0xbe38('0x9'));router[_0xbe38('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbe38('0xb'),auth['isAuthenticated'](),controller[_0xbe38('0xc')]);router[_0xbe38('0xa')](_0xbe38('0xd'),auth[_0xbe38('0xe')](),controller[_0xbe38('0xf')]);router[_0xbe38('0xa')]('/:id/answers',auth[_0xbe38('0xe')](),controller[_0xbe38('0x10')]);router[_0xbe38('0xa')](_0xbe38('0x11'),auth['isAuthenticated'](),timeout(_0xbe38('0x12')),controller['getSummary']);router[_0xbe38('0x13')]('/',auth[_0xbe38('0xe')](),controller['create']);router[_0xbe38('0x13')](_0xbe38('0x14'),auth[_0xbe38('0xe')](),controller[_0xbe38('0x15')]);router[_0xbe38('0x16')](_0xbe38('0xb'),auth[_0xbe38('0xe')](),controller['update']);router[_0xbe38('0x17')](_0xbe38('0xb'),auth[_0xbe38('0xe')](),controller['destroy']);module[_0xbe38('0x18')]=router; \ No newline at end of file +var _0x833d=['getSessions','/:id/answers','/:id/summary','post','create','clone','put','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x833d,0x8c));var _0xd833=function(_0x42f602,_0x4e9b42){_0x42f602=_0x42f602-0x0;var _0x13e363=_0x833d[_0x42f602];return _0x13e363;};'use strict';var multer=require('multer');var util=require(_0xd833('0x0'));var path=require(_0xd833('0x1'));var timeout=require(_0xd833('0x2'));var express=require(_0xd833('0x3'));var router=express[_0xd833('0x4')]();var fs_extra=require(_0xd833('0x5'));var auth=require(_0xd833('0x6'));var interaction=require(_0xd833('0x7'));var config=require('../../config/environment');var controller=require(_0xd833('0x8'));router[_0xd833('0x9')]('/',auth[_0xd833('0xa')](),controller[_0xd833('0xb')]);router[_0xd833('0x9')](_0xd833('0xc'),auth['isAuthenticated'](),controller[_0xd833('0xd')]);router[_0xd833('0x9')]('/:id/sessions',auth[_0xd833('0xa')](),controller[_0xd833('0xe')]);router[_0xd833('0x9')](_0xd833('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd833('0x9')](_0xd833('0x10'),auth[_0xd833('0xa')](),timeout('30s'),controller['getSummary']);router[_0xd833('0x11')]('/',auth[_0xd833('0xa')](),controller[_0xd833('0x12')]);router['post']('/:id/clone',auth[_0xd833('0xa')](),controller[_0xd833('0x13')]);router[_0xd833('0x14')](_0xd833('0xc'),auth[_0xd833('0xa')](),controller['update']);router[_0xd833('0x15')](_0xd833('0xc'),auth[_0xd833('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c1198f3..c078c88 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 _0xcfa7=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format'];(function(_0x48fab2,_0x234e78){var _0x5724c5=function(_0xb44095){while(--_0xb44095){_0x48fab2['push'](_0x48fab2['shift']());}};_0x5724c5(++_0x234e78);}(_0xcfa7,0xe1));var _0x7cfa=function(_0x52a149,_0x5ae6e5){_0x52a149=_0x52a149-0x0;var _0x1fcf3c=_0xcfa7[_0x52a149];return _0x1fcf3c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7cfa('0x0'));var util=require(_0x7cfa('0x1'));module[_0x7cfa('0x2')]={'name':{'type':Sequelize[_0x7cfa('0x3')],'unique':_0x7cfa('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7cfa('0x5')](_0x7cfa('0x6')),'set':function(_0x624131){if(_[_0x7cfa('0x7')](_0x624131)){this[_0x7cfa('0x8')]('formData',JSON[_0x7cfa('0x9')](_0x624131));}else if(_[_0x7cfa('0xa')](_0x624131)){this[_0x7cfa('0x8')]('formData',_0x624131);}else{this[_0x7cfa('0x8')](_0x7cfa('0xb'),util[_0x7cfa('0xc')](_0x7cfa('0xd'),this[_0x7cfa('0xe')](_0x7cfa('0x4'))||'',this['getDataValue'](_0x7cfa('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7cfa('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7cfa('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x6da1=['TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x5579f2,_0x1d2737){var _0x1425d7=function(_0xc1728a){while(--_0xc1728a){_0x5579f2['push'](_0x5579f2['shift']());}};_0x1425d7(++_0x1d2737);}(_0x6da1,0x102));var _0x16da=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x6da1[_0x5517c0];return _0x33803b;};'use strict';var Sequelize=require(_0x16da('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0x16da('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x16da('0x1')]},'formData':{'type':Sequelize[_0x16da('0x2')](_0x16da('0x3')),'set':function(_0x1d7718){if(_[_0x16da('0x4')](_0x1d7718)){this[_0x16da('0x5')]('formData',JSON[_0x16da('0x6')](_0x1d7718));}else if(_[_0x16da('0x7')](_0x1d7718)){this[_0x16da('0x5')]('formData',_0x1d7718);}else{this['setDataValue'](_0x16da('0x8'),util[_0x16da('0x9')](_0x16da('0xa'),this[_0x16da('0xb')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x16da('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x16da('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2ec8771..ed902d6 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 _0xbcf1=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbcf1,0x97));var _0x1bcf=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xbcf1[_0x418549];return _0x288826;};'use strict';var emlformat=require(_0x1bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bcf('0x1'));var jsonpatch=require(_0x1bcf('0x2'));var rp=require(_0x1bcf('0x3'));var moment=require(_0x1bcf('0x4'));var BPromise=require(_0x1bcf('0x5'));var Mustache=require('mustache');var util=require(_0x1bcf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1bcf('0x7'));var ejs=require(_0x1bcf('0x8'));var fs=require('fs');var fs_extra=require(_0x1bcf('0x9'));var _=require(_0x1bcf('0xa'));var squel=require(_0x1bcf('0xb'));var crypto=require(_0x1bcf('0xc'));var jsforce=require(_0x1bcf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1bcf('0x7'));var querystring=require('querystring');var Papa=require(_0x1bcf('0xe'));var Redis=require(_0x1bcf('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1bcf('0x10'));var logger=require(_0x1bcf('0x11'))(_0x1bcf('0x12'));var utils=require(_0x1bcf('0x13'));var config=require(_0x1bcf('0x14'));var licenseUtil=require(_0x1bcf('0x15'));var db=require(_0x1bcf('0x16'))['db'];function respondWithStatusCode(_0x1edd48,_0x36e8ee){_0x36e8ee=_0x36e8ee||0xcc;return function(_0x11dcb3){if(_0x11dcb3){return _0x1edd48[_0x1bcf('0x17')](_0x36e8ee);}return _0x1edd48[_0x1bcf('0x18')](_0x36e8ee)['end']();};}function respondWithResult(_0x547f3f,_0x395a2d){_0x395a2d=_0x395a2d||0xc8;return function(_0x31b48b){if(_0x31b48b){return _0x547f3f[_0x1bcf('0x18')](_0x395a2d)['json'](_0x31b48b);}};}function respondWithFilteredResult(_0x3e6106,_0x419fce){return function(_0x34badf){if(_0x34badf){var _0x123252=typeof _0x419fce[_0x1bcf('0x19')]===_0x1bcf('0x1a')&&typeof _0x419fce[_0x1bcf('0x1b')]==='undefined';var _0x191a68=_0x34badf['count'];var _0x39778a=_0x123252?0x0:_0x419fce[_0x1bcf('0x19')];var _0x47b110=_0x123252?_0x34badf[_0x1bcf('0x1c')]:_0x419fce[_0x1bcf('0x19')]+_0x419fce['limit'];var _0x4b1f72;if(_0x47b110>=_0x191a68){_0x47b110=_0x191a68;_0x4b1f72=0xc8;}else{_0x4b1f72=0xce;}_0x3e6106[_0x1bcf('0x18')](_0x4b1f72);return _0x3e6106['set'](_0x1bcf('0x1d'),_0x39778a+'-'+_0x47b110+'/'+_0x191a68)[_0x1bcf('0x1e')](_0x34badf);}return null;};}function patchUpdates(_0x284f3b){return function(_0x1f412a){try{jsonpatch[_0x1bcf('0x1f')](_0x1f412a,_0x284f3b,!![]);}catch(_0x2783e6){return BPromise[_0x1bcf('0x20')](_0x2783e6);}return _0x1f412a[_0x1bcf('0x21')]();};}function saveUpdates(_0x16b452,_0x257fe8){return function(_0x5d5a91){if(_0x5d5a91){return _0x5d5a91[_0x1bcf('0x22')](_0x16b452)[_0x1bcf('0x23')](function(_0x563085){return _0x563085;});}return null;};}function removeEntity(_0x4c028c,_0x11f22c){return function(_0x313b5c){if(_0x313b5c){return _0x313b5c[_0x1bcf('0x24')]()[_0x1bcf('0x23')](function(){var _0x400605=_0x313b5c[_0x1bcf('0x25')]({'plain':!![]});var _0x4ac28d=_0x1bcf('0x26');return db[_0x1bcf('0x27')][_0x1bcf('0x24')]({'where':{'type':_0x4ac28d,'resourceId':_0x400605['id']}})['then'](function(){return _0x313b5c;});})[_0x1bcf('0x23')](function(){_0x4c028c['status'](0xcc)[_0x1bcf('0x28')]();});}};}function handleEntityNotFound(_0x4097ff,_0x4cdade){return function(_0x331192){if(!_0x331192){_0x4097ff[_0x1bcf('0x17')](0x194);}return _0x331192;};}function handleError(_0x5575b1,_0x27292b){_0x27292b=_0x27292b||0x1f4;return function(_0x1b4848){logger[_0x1bcf('0x29')](_0x1b4848[_0x1bcf('0x2a')]);if(_0x1b4848[_0x1bcf('0x2b')]){delete _0x1b4848[_0x1bcf('0x2b')];}_0x5575b1[_0x1bcf('0x18')](_0x27292b)[_0x1bcf('0x2c')](_0x1b4848);};}exports[_0x1bcf('0x2d')]=function(_0x14bd62,_0x5637f6){var _0x35fa4c={},_0x56f211={},_0x142210={'count':0x0,'rows':[]};var _0x24400=_[_0x1bcf('0x2e')](db[_0x1bcf('0x2f')][_0x1bcf('0x30')],function(_0x1b5733){return{'name':_0x1b5733[_0x1bcf('0x31')],'type':_0x1b5733[_0x1bcf('0x32')][_0x1bcf('0x33')]};});_0x56f211['model']=_[_0x1bcf('0x2e')](_0x24400,'name');_0x56f211[_0x1bcf('0x34')]=_[_0x1bcf('0x35')](_0x14bd62[_0x1bcf('0x34')]);_0x56f211[_0x1bcf('0x36')]=_['intersection'](_0x56f211[_0x1bcf('0x37')],_0x56f211[_0x1bcf('0x34')]);_0x35fa4c[_0x1bcf('0x38')]=_['intersection'](_0x56f211['model'],qs['fields'](_0x14bd62[_0x1bcf('0x34')]['fields']));_0x35fa4c[_0x1bcf('0x38')]=_0x35fa4c[_0x1bcf('0x38')]['length']?_0x35fa4c[_0x1bcf('0x38')]:_0x56f211[_0x1bcf('0x37')];if(!_0x14bd62[_0x1bcf('0x34')]['hasOwnProperty']('nolimit')){_0x35fa4c[_0x1bcf('0x1b')]=qs[_0x1bcf('0x1b')](_0x14bd62[_0x1bcf('0x34')][_0x1bcf('0x1b')]);_0x35fa4c[_0x1bcf('0x19')]=qs[_0x1bcf('0x19')](_0x14bd62[_0x1bcf('0x34')][_0x1bcf('0x19')]);}_0x35fa4c[_0x1bcf('0x39')]=qs['sort'](_0x14bd62[_0x1bcf('0x34')][_0x1bcf('0x3a')]);_0x35fa4c[_0x1bcf('0x3b')]=qs[_0x1bcf('0x36')](_[_0x1bcf('0x3c')](_0x14bd62[_0x1bcf('0x34')],_0x56f211[_0x1bcf('0x36')]),_0x24400);if(_0x14bd62['query'][_0x1bcf('0x3d')]){_0x35fa4c[_0x1bcf('0x3b')]=_[_0x1bcf('0x3e')](_0x35fa4c[_0x1bcf('0x3b')],{'$or':_[_0x1bcf('0x2e')](_0x24400,function(_0x382ed0){if(_0x382ed0[_0x1bcf('0x32')]!=='VIRTUAL'){var _0x2fce25={};_0x2fce25[_0x382ed0[_0x1bcf('0x2b')]]={'$like':'%'+_0x14bd62[_0x1bcf('0x34')]['filter']+'%'};return _0x2fce25;}})});}_0x35fa4c=_[_0x1bcf('0x3e')]({},_0x35fa4c,_0x14bd62[_0x1bcf('0x3f')]);var _0x584612={'where':_0x35fa4c[_0x1bcf('0x3b')]};return db[_0x1bcf('0x2f')][_0x1bcf('0x1c')](_0x584612)[_0x1bcf('0x23')](function(_0x3b9b8e){_0x142210[_0x1bcf('0x1c')]=_0x3b9b8e;if(_0x14bd62[_0x1bcf('0x34')][_0x1bcf('0x40')]){_0x35fa4c[_0x1bcf('0x41')]=[{'all':!![]}];}return db['JscriptyProject'][_0x1bcf('0x42')](_0x35fa4c);})[_0x1bcf('0x23')](function(_0x494738){_0x142210[_0x1bcf('0x43')]=_0x494738;return _0x142210;})[_0x1bcf('0x23')](respondWithFilteredResult(_0x5637f6,_0x35fa4c))[_0x1bcf('0x44')](handleError(_0x5637f6,null));};exports[_0x1bcf('0x45')]=function(_0x4beb69,_0x1fdd4b){var _0x12aa37={'raw':![],'where':{'id':_0x4beb69[_0x1bcf('0x46')]['id']}},_0x364dec={};_0x364dec[_0x1bcf('0x37')]=_[_0x1bcf('0x35')](db[_0x1bcf('0x2f')][_0x1bcf('0x30')]);_0x364dec[_0x1bcf('0x34')]=_['keys'](_0x4beb69[_0x1bcf('0x34')]);_0x364dec['filters']=_[_0x1bcf('0x47')](_0x364dec[_0x1bcf('0x37')],_0x364dec[_0x1bcf('0x34')]);_0x12aa37[_0x1bcf('0x38')]=_[_0x1bcf('0x47')](_0x364dec[_0x1bcf('0x37')],qs[_0x1bcf('0x48')](_0x4beb69['query']['fields']));_0x12aa37[_0x1bcf('0x38')]=_0x12aa37[_0x1bcf('0x38')][_0x1bcf('0x49')]?_0x12aa37[_0x1bcf('0x38')]:_0x364dec[_0x1bcf('0x37')];if(_0x4beb69[_0x1bcf('0x34')][_0x1bcf('0x40')]){_0x12aa37[_0x1bcf('0x41')]=[{'all':!![]}];}_0x12aa37=_['merge']({},_0x12aa37,_0x4beb69[_0x1bcf('0x3f')]);return db[_0x1bcf('0x2f')][_0x1bcf('0x4a')](_0x12aa37)[_0x1bcf('0x23')](handleEntityNotFound(_0x1fdd4b,null))[_0x1bcf('0x23')](respondWithResult(_0x1fdd4b,null))[_0x1bcf('0x44')](handleError(_0x1fdd4b,null));};exports[_0x1bcf('0x4b')]=function(_0x400b98,_0x59ed75){return db['JscriptyProject'][_0x1bcf('0x4b')](_0x400b98[_0x1bcf('0x4c')],{})[_0x1bcf('0x23')](function(_0x3fd6e5){var _0x2d63e8=_0x400b98['user'][_0x1bcf('0x25')]({'plain':!![]});if(!_0x2d63e8)throw new Error(_0x1bcf('0x4d'));if(_0x2d63e8[_0x1bcf('0x4e')]===_0x1bcf('0x4f')){var _0x313c1b=_0x3fd6e5[_0x1bcf('0x25')]({'plain':!![]});var _0x2d2887=_0x1bcf('0x26');return db[_0x1bcf('0x50')][_0x1bcf('0x4a')]({'where':{'name':_0x2d2887,'userProfileId':_0x2d63e8[_0x1bcf('0x51')]},'raw':!![]})['then'](function(_0x48a4a9){if(_0x48a4a9&&_0x48a4a9[_0x1bcf('0x52')]===0x0){return db[_0x1bcf('0x27')][_0x1bcf('0x4b')]({'name':_0x313c1b['name'],'resourceId':_0x313c1b['id'],'type':_0x48a4a9[_0x1bcf('0x2b')],'sectionId':_0x48a4a9['id']},{})[_0x1bcf('0x23')](function(){return _0x3fd6e5;});}else{return _0x3fd6e5;}})[_0x1bcf('0x44')](function(_0x4c1465){logger[_0x1bcf('0x29')](_0x1bcf('0x53'),_0x4c1465);throw _0x4c1465;});}return _0x3fd6e5;})[_0x1bcf('0x23')](respondWithResult(_0x59ed75,0xc9))[_0x1bcf('0x44')](handleError(_0x59ed75,null));};exports[_0x1bcf('0x54')]=function(_0x22c59a,_0x7ccabf){var _0x38dd1e={'where':{'id':_0x22c59a[_0x1bcf('0x46')]['id']}},_0x33ab77={};_0x33ab77[_0x1bcf('0x37')]=_[_0x1bcf('0x35')](db[_0x1bcf('0x2f')]['rawAttributes']);_0x38dd1e['attributes']=_[_0x1bcf('0x47')](_0x33ab77[_0x1bcf('0x37')],qs[_0x1bcf('0x48')](_0x22c59a[_0x1bcf('0x34')][_0x1bcf('0x48')]));_0x38dd1e[_0x1bcf('0x38')]=_0x38dd1e[_0x1bcf('0x38')][_0x1bcf('0x49')]?_0x38dd1e[_0x1bcf('0x38')]:_0x33ab77[_0x1bcf('0x37')];if(_0x22c59a[_0x1bcf('0x34')]['includeAll']){_0x38dd1e['include']=[{'all':!![]}];}_0x38dd1e=_[_0x1bcf('0x3e')]({},_0x38dd1e,_0x22c59a['options']);return db[_0x1bcf('0x2f')]['find'](_0x38dd1e)[_0x1bcf('0x23')](handleEntityNotFound(_0x7ccabf,null))[_0x1bcf('0x23')](function(_0x74bed6){if(_0x74bed6){var _0x18a590=_0x74bed6['get']({'plain':!![]});_0x18a590=qs['omit'](_0x18a590,['id',_0x1bcf('0x55'),_0x1bcf('0x56')]);_0x22c59a[_0x1bcf('0x4c')]=_[_0x1bcf('0x57')](_0x22c59a[_0x1bcf('0x4c')],['id',_0x1bcf('0x55'),_0x1bcf('0x56')]);return db[_0x1bcf('0x2f')][_0x1bcf('0x4b')](_[_0x1bcf('0x3e')](_0x18a590,_0x22c59a[_0x1bcf('0x4c')]),{'include':_0x22c59a[_0x1bcf('0x34')][_0x1bcf('0x40')]?[{'all':!![]}]:undefined})[_0x1bcf('0x23')](function(_0x55fba1){var _0x100d3f=_0x22c59a[_0x1bcf('0x4f')][_0x1bcf('0x25')]({'plain':!![]});if(!_0x100d3f)throw new Error(_0x1bcf('0x4d'));if(_0x100d3f['role']===_0x1bcf('0x4f')){var _0x395fbe=_0x55fba1[_0x1bcf('0x25')]({'plain':!![]});var _0x519c77=_0x1bcf('0x26');return db[_0x1bcf('0x50')][_0x1bcf('0x4a')]({'where':{'name':_0x519c77,'userProfileId':_0x100d3f[_0x1bcf('0x51')]},'raw':!![]})[_0x1bcf('0x23')](function(_0x463301){if(_0x463301&&_0x463301[_0x1bcf('0x52')]===0x0){return db[_0x1bcf('0x27')][_0x1bcf('0x4b')]({'name':_0x395fbe[_0x1bcf('0x2b')],'resourceId':_0x395fbe['id'],'type':_0x463301[_0x1bcf('0x2b')],'sectionId':_0x463301['id']},{})[_0x1bcf('0x23')](function(){return _0x55fba1;});}else{return _0x55fba1;}})[_0x1bcf('0x44')](function(_0x1e6e19){logger[_0x1bcf('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e6e19);throw _0x1e6e19;});}return _0x55fba1;});}})[_0x1bcf('0x23')](respondWithResult(_0x7ccabf,0xc9))[_0x1bcf('0x44')](handleError(_0x7ccabf,null));};exports['update']=function(_0x1f90e3,_0x422606){if(_0x1f90e3[_0x1bcf('0x4c')]['id']){delete _0x1f90e3[_0x1bcf('0x4c')]['id'];}return db[_0x1bcf('0x2f')][_0x1bcf('0x4a')]({'where':{'id':_0x1f90e3[_0x1bcf('0x46')]['id']}})[_0x1bcf('0x23')](handleEntityNotFound(_0x422606,null))['then'](saveUpdates(_0x1f90e3[_0x1bcf('0x4c')],null))['then'](respondWithResult(_0x422606,null))[_0x1bcf('0x44')](handleError(_0x422606,null));};exports[_0x1bcf('0x24')]=function(_0x1d418d,_0x30e03f){return db[_0x1bcf('0x2f')][_0x1bcf('0x4a')]({'where':{'id':_0x1d418d[_0x1bcf('0x46')]['id']}})[_0x1bcf('0x23')](handleEntityNotFound(_0x30e03f,null))[_0x1bcf('0x23')](removeEntity(_0x30e03f,null))['catch'](handleError(_0x30e03f,null));};exports[_0x1bcf('0x58')]=function(_0x127429,_0x1726bd,_0x504428){var _0x2005ac={'raw':!![],'where':{}};var _0x564272={};var _0x4a880b={'count':0x0,'rows':[]};return db[_0x1bcf('0x2f')][_0x1bcf('0x59')]({'where':{'id':_0x127429['params']['id']}})[_0x1bcf('0x23')](handleEntityNotFound(_0x1726bd,null))[_0x1bcf('0x23')](function(_0x367d63){if(_0x367d63){_0x564272[_0x1bcf('0x37')]=_[_0x1bcf('0x35')](db[_0x1bcf('0x5a')]['rawAttributes']);_0x564272[_0x1bcf('0x34')]=_['keys'](_0x127429[_0x1bcf('0x34')]);_0x564272[_0x1bcf('0x36')]=_[_0x1bcf('0x47')](_0x564272['model'],_0x564272[_0x1bcf('0x34')]);_0x2005ac[_0x1bcf('0x38')]=_['intersection'](_0x564272[_0x1bcf('0x37')],qs[_0x1bcf('0x48')](_0x127429['query'][_0x1bcf('0x48')]));_0x2005ac[_0x1bcf('0x38')]=_0x2005ac['attributes']['length']?_0x2005ac[_0x1bcf('0x38')]:_0x564272['model'];if(!_0x127429[_0x1bcf('0x34')][_0x1bcf('0x5b')](_0x1bcf('0x5c'))){_0x2005ac[_0x1bcf('0x1b')]=qs[_0x1bcf('0x1b')](_0x127429[_0x1bcf('0x34')][_0x1bcf('0x1b')]);_0x2005ac[_0x1bcf('0x19')]=qs[_0x1bcf('0x19')](_0x127429[_0x1bcf('0x34')][_0x1bcf('0x19')]);}_0x2005ac[_0x1bcf('0x39')]=qs[_0x1bcf('0x3a')](_0x127429[_0x1bcf('0x34')]['sort']);_0x2005ac[_0x1bcf('0x3b')]=qs[_0x1bcf('0x36')](_['pick'](_0x127429[_0x1bcf('0x34')],_0x564272['filters']));_0x2005ac['where'][_0x1bcf('0x5d')]=_0x367d63['id'];if(_0x127429[_0x1bcf('0x34')]['filter']){_0x2005ac['where']=_[_0x1bcf('0x3e')](_0x2005ac['where'],{'$or':_[_0x1bcf('0x2e')](_0x2005ac[_0x1bcf('0x38')],function(_0x409d75){var _0x1ef18a={};_0x1ef18a[_0x409d75]={'$like':'%'+_0x127429[_0x1bcf('0x34')]['filter']+'%'};return _0x1ef18a;})});}_0x2005ac=_[_0x1bcf('0x3e')]({},_0x2005ac,_0x127429['options']);return db[_0x1bcf('0x5a')][_0x1bcf('0x1c')]({'where':_0x2005ac['where']})[_0x1bcf('0x23')](function(_0x15c277){_0x4a880b[_0x1bcf('0x1c')]=_0x15c277;if(_0x127429[_0x1bcf('0x34')][_0x1bcf('0x40')]){_0x2005ac[_0x1bcf('0x41')]=[{'all':!![]}];}return db[_0x1bcf('0x5a')][_0x1bcf('0x42')](_0x2005ac);})[_0x1bcf('0x23')](function(_0x527b2f){_0x4a880b[_0x1bcf('0x43')]=_0x527b2f;return _0x4a880b;});}})[_0x1bcf('0x23')](respondWithFilteredResult(_0x1726bd,_0x2005ac))[_0x1bcf('0x44')](handleError(_0x1726bd,null));};exports[_0x1bcf('0x5e')]=function(_0x176053,_0x2d952a,_0x248598){var _0x1c9942={'raw':!![],'where':{}};var _0x224392={};var _0x3ab5a5={'count':0x0,'rows':[]};return db[_0x1bcf('0x2f')][_0x1bcf('0x59')]({'where':{'id':_0x176053[_0x1bcf('0x46')]['id']}})[_0x1bcf('0x23')](handleEntityNotFound(_0x2d952a,null))[_0x1bcf('0x23')](function(_0x181b01){if(_0x181b01){_0x224392[_0x1bcf('0x37')]=_[_0x1bcf('0x35')](db['JscriptyAnswerReport'][_0x1bcf('0x30')]);_0x224392[_0x1bcf('0x34')]=_[_0x1bcf('0x35')](_0x176053[_0x1bcf('0x34')]);_0x224392['filters']=_['intersection'](_0x224392['model'],_0x224392['query']);_0x1c9942[_0x1bcf('0x38')]=_[_0x1bcf('0x47')](_0x224392[_0x1bcf('0x37')],qs['fields'](_0x176053[_0x1bcf('0x34')][_0x1bcf('0x48')]));_0x1c9942[_0x1bcf('0x38')]=_0x1c9942[_0x1bcf('0x38')][_0x1bcf('0x49')]?_0x1c9942[_0x1bcf('0x38')]:_0x224392[_0x1bcf('0x37')];if(!_0x176053['query']['hasOwnProperty'](_0x1bcf('0x5c'))){_0x1c9942[_0x1bcf('0x1b')]=qs[_0x1bcf('0x1b')](_0x176053['query'][_0x1bcf('0x1b')]);_0x1c9942[_0x1bcf('0x19')]=qs[_0x1bcf('0x19')](_0x176053['query'][_0x1bcf('0x19')]);}_0x1c9942[_0x1bcf('0x39')]=qs[_0x1bcf('0x3a')](_0x176053[_0x1bcf('0x34')][_0x1bcf('0x3a')]);_0x1c9942[_0x1bcf('0x3b')]=qs[_0x1bcf('0x36')](_[_0x1bcf('0x3c')](_0x176053[_0x1bcf('0x34')],_0x224392[_0x1bcf('0x36')]));_0x1c9942[_0x1bcf('0x3b')][_0x1bcf('0x5d')]=_0x181b01['id'];if(_0x176053[_0x1bcf('0x34')]['filter']){_0x1c9942['where']=_['merge'](_0x1c9942[_0x1bcf('0x3b')],{'$or':_[_0x1bcf('0x2e')](_0x1c9942['attributes'],function(_0x5eb7b0){var _0x88aea0={};_0x88aea0[_0x5eb7b0]={'$like':'%'+_0x176053[_0x1bcf('0x34')][_0x1bcf('0x3d')]+'%'};return _0x88aea0;})});}_0x1c9942=_[_0x1bcf('0x3e')]({},_0x1c9942,_0x176053[_0x1bcf('0x3f')]);return db['JscriptyAnswerReport']['count']({'where':_0x1c9942[_0x1bcf('0x3b')]})[_0x1bcf('0x23')](function(_0x2bcfd7){_0x3ab5a5[_0x1bcf('0x1c')]=_0x2bcfd7;if(_0x176053[_0x1bcf('0x34')][_0x1bcf('0x40')]){_0x1c9942[_0x1bcf('0x41')]=[{'all':!![]}];}return db[_0x1bcf('0x5f')]['findAll'](_0x1c9942);})[_0x1bcf('0x23')](function(_0xa34f92){_0x3ab5a5[_0x1bcf('0x43')]=_0xa34f92;return _0x3ab5a5;});}})['then'](respondWithFilteredResult(_0x2d952a,_0x1c9942))[_0x1bcf('0x44')](handleError(_0x2d952a,null));};function char(_0x3165ed){return _0x1bcf('0x60')===typeof _0x3165ed?String[_0x1bcf('0x61')][_0x1bcf('0x1f')](null,arguments):_0x3165ed;}function needsEncapsulation(_0x30d196){return!!_0x30d196&&(_0x30d196[_0x1bcf('0x62')]()[_0x1bcf('0x63')](char(0xd))>=0x0||_0x30d196['toString']()[_0x1bcf('0x63')](char(0xa))>=0x0||_0x30d196[_0x1bcf('0x62')]()[_0x1bcf('0x63')](char(0x2c))>=0x0||_0x30d196[_0x1bcf('0x62')]()[_0x1bcf('0x63')](char(0x22))>=0x0);}function encapsulate(_0x4e2b15){var _0x4fe5a4=char(0x22),_0x4eb9eb='\x5c'+char(0x22),_0x3df35f=_0x4e2b15[_0x1bcf('0x62')]()['replace'](new RegExp(_0x4fe5a4,'g'),_0x4eb9eb);return _0x4fe5a4+_0x3df35f+_0x4fe5a4;}exports[_0x1bcf('0x64')]=function(_0x8f53ba,_0xa19ce4,_0x280ba4){var _0x51efbf,_0x192a73;var _0x3e1728={'where':{'ProjectId':_0x8f53ba[_0x1bcf('0x46')]['id']}};if(_0x8f53ba['query'][_0x1bcf('0x65')]){_0x3e1728[_0x1bcf('0x3b')]['starttime']=JSON[_0x1bcf('0x66')](_0x8f53ba[_0x1bcf('0x34')]['startTime']);}return db[_0x1bcf('0x5a')][_0x1bcf('0x42')](_0x3e1728)['then'](handleEntityNotFound(_0xa19ce4,null))[_0x1bcf('0x23')](function(_0xcc78dd){if(_0xcc78dd){_0x51efbf=_0xcc78dd;return db[_0x1bcf('0x67')][_0x1bcf('0x42')]({'where':{'SessionId':{'$in':_[_0x1bcf('0x2e')](_0x51efbf,'id')},'ProjectId':_0x8f53ba[_0x1bcf('0x46')]['id']},'order':_0x1bcf('0x68')});}})['then'](handleEntityNotFound(_0xa19ce4,null))[_0x1bcf('0x23')](function(_0x3b1f7e){if(_0x3b1f7e){_0x192a73=_0x3b1f7e;var _0x17c9c={};for(var _0x1e17c3=0x0,_0x5a67e2=_0x192a73[_0x1bcf('0x49')];_0x1e17c3<_0x5a67e2;_0x1e17c3++){if(!_0x17c9c[_0x1bcf('0x5b')](_0x192a73[_0x1e17c3]['questionId'])){_0x17c9c[_0x192a73[_0x1e17c3][_0x1bcf('0x69')]]=needsEncapsulation(_0x192a73[_0x1e17c3][_0x1bcf('0x6a')])?encapsulate(_0x192a73[_0x1e17c3][_0x1bcf('0x6a')]):_0x192a73[_0x1e17c3][_0x1bcf('0x6a')];}}var _0x3a1150=[],_0x27b387={};for(var _0x59d866=0x0,_0x4b9f32=_0x51efbf[_0x1bcf('0x49')];_0x59d866<_0x4b9f32;_0x59d866++){_0x27b387={'ProjectId':_0x8f53ba['params']['id'],'SessionId':_0x51efbf[_0x59d866]['id'],'StartTime':moment(_0x51efbf[_0x59d866][_0x1bcf('0x6b')])[_0x1bcf('0x6c')](_0x1bcf('0x6d'))};for(var _0xcd77f2=0x0,_0x226ba1=_0x192a73[_0x1bcf('0x49')];_0xcd77f2<_0x226ba1;_0xcd77f2++){if(_0x192a73[_0xcd77f2]['SessionId']==_0x51efbf[_0x59d866]['id']&&_0x17c9c['hasOwnProperty'](_0x192a73[_0xcd77f2][_0x1bcf('0x69')])){_0x27b387[_0x17c9c[_0x192a73[_0xcd77f2]['questionId']]]=_0x192a73[_0xcd77f2]['answer'];}}for(var _0x3d4ca3 in _0x17c9c){if(!_0x27b387[_0x1bcf('0x5b')](_0x17c9c[_0x3d4ca3])){_0x27b387[_0x17c9c[_0x3d4ca3]]=null;}}_0x3a1150['push'](_0x27b387);}return _0x3a1150;}})[_0x1bcf('0x23')](function(_0x37e2b6){if(!_[_0x1bcf('0x6e')](_0x37e2b6)){var _0x5bd831=toCsv(_0x37e2b6);var _0x4ba13e=Date[_0x1bcf('0x6f')]();fs['writeFileSync'](util[_0x1bcf('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x8f53ba[_0x1bcf('0x46')]['id'],_0x4ba13e),_0x5bd831);_0xa19ce4[_0x1bcf('0x70')](_0x1bcf('0x71'),_0x1bcf('0x72')+util[_0x1bcf('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x8f53ba[_0x1bcf('0x46')]['id'],_0x4ba13e));_0xa19ce4[_0x1bcf('0x70')](_0x1bcf('0x73'),'text/csv');return _0xa19ce4['download'](util[_0x1bcf('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x8f53ba[_0x1bcf('0x46')]['id'],_0x4ba13e));}else{return _0xa19ce4[_0x1bcf('0x17')](0xcc);}})['catch'](handleError(_0xa19ce4,null));}; \ No newline at end of file +var _0x1beb=['isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','findOne','JscriptySessionReport','order','ProjectId','findAll','JscriptyAnswerReport','pick','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x1beb,0x165));var _0xb1be=function(_0x2486ed,_0x10d0d8){_0x2486ed=_0x2486ed-0x0;var _0x450e84=_0x1beb[_0x2486ed];return _0x450e84;};'use strict';var emlformat=require(_0xb1be('0x0'));var rimraf=require(_0xb1be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1be('0x2'));var rp=require(_0xb1be('0x3'));var moment=require(_0xb1be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1be('0x5'));var util=require(_0xb1be('0x6'));var path=require('path');var sox=require(_0xb1be('0x7'));var csv=require(_0xb1be('0x8'));var ejs=require(_0xb1be('0x9'));var fs=require('fs');var fs_extra=require(_0xb1be('0xa'));var _=require(_0xb1be('0xb'));var squel=require(_0xb1be('0xc'));var crypto=require(_0xb1be('0xd'));var jsforce=require(_0xb1be('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb1be('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb1be('0xf'));var authService=require(_0xb1be('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1be('0x11'));var logger=require(_0xb1be('0x12'))('api');var utils=require(_0xb1be('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb1be('0x14'));var db=require(_0xb1be('0x15'))['db'];function respondWithStatusCode(_0x5eb9a7,_0x276ef4){_0x276ef4=_0x276ef4||0xcc;return function(_0x33fd7e){if(_0x33fd7e){return _0x5eb9a7[_0xb1be('0x16')](_0x276ef4);}return _0x5eb9a7[_0xb1be('0x17')](_0x276ef4)[_0xb1be('0x18')]();};}function respondWithResult(_0x1b28d6,_0xe9afab){_0xe9afab=_0xe9afab||0xc8;return function(_0x3772d3){if(_0x3772d3){return _0x1b28d6['status'](_0xe9afab)[_0xb1be('0x19')](_0x3772d3);}};}function respondWithFilteredResult(_0x5399b0,_0x361954){return function(_0x386c28){if(_0x386c28){var _0x172e74=typeof _0x361954[_0xb1be('0x1a')]===_0xb1be('0x1b')&&typeof _0x361954['limit']==='undefined';var _0x213c9d=_0x386c28[_0xb1be('0x1c')];var _0x2bad8f=_0x172e74?0x0:_0x361954['offset'];var _0x157b8a=_0x172e74?_0x386c28['count']:_0x361954[_0xb1be('0x1a')]+_0x361954[_0xb1be('0x1d')];var _0x58ceff;if(_0x157b8a>=_0x213c9d){_0x157b8a=_0x213c9d;_0x58ceff=0xc8;}else{_0x58ceff=0xce;}_0x5399b0[_0xb1be('0x17')](_0x58ceff);return _0x5399b0[_0xb1be('0x1e')]('Content-Range',_0x2bad8f+'-'+_0x157b8a+'/'+_0x213c9d)[_0xb1be('0x19')](_0x386c28);}return null;};}function patchUpdates(_0x453530){return function(_0x9fa059){try{jsonpatch['apply'](_0x9fa059,_0x453530,!![]);}catch(_0x36d7bf){return BPromise[_0xb1be('0x1f')](_0x36d7bf);}return _0x9fa059['save']();};}function saveUpdates(_0x362768,_0x35c456){return function(_0x57cf28){if(_0x57cf28){return _0x57cf28[_0xb1be('0x20')](_0x362768)[_0xb1be('0x21')](function(_0x36f72d){return _0x36f72d;});}return null;};}function removeEntity(_0x55bd24,_0x372a6c){return function(_0x5de89c){if(_0x5de89c){return _0x5de89c['destroy']()[_0xb1be('0x21')](function(){var _0x5194d2=_0x5de89c[_0xb1be('0x22')]({'plain':!![]});var _0x281c25=_0xb1be('0x23');return db[_0xb1be('0x24')][_0xb1be('0x25')]({'where':{'type':_0x281c25,'resourceId':_0x5194d2['id']}})['then'](function(){return _0x5de89c;});})[_0xb1be('0x21')](function(){_0x55bd24[_0xb1be('0x17')](0xcc)[_0xb1be('0x18')]();});}};}function handleEntityNotFound(_0x53da29,_0x3ef2b2){return function(_0x339adc){if(!_0x339adc){_0x53da29[_0xb1be('0x16')](0x194);}return _0x339adc;};}function handleError(_0x5000eb,_0x585e89){_0x585e89=_0x585e89||0x1f4;return function(_0x1129d5){logger[_0xb1be('0x26')](_0x1129d5[_0xb1be('0x27')]);if(_0x1129d5[_0xb1be('0x28')]){delete _0x1129d5['name'];}_0x5000eb[_0xb1be('0x17')](_0x585e89)[_0xb1be('0x29')](_0x1129d5);};}exports[_0xb1be('0x2a')]=function(_0x59b7ae,_0x188fe1){var _0x49b160={},_0x12d4f2={},_0x2c4c1d={'count':0x0,'rows':[]};var _0x1cbe07=_[_0xb1be('0x2b')](db['JscriptyProject'][_0xb1be('0x2c')],function(_0x5494b8){return{'name':_0x5494b8[_0xb1be('0x2d')],'type':_0x5494b8[_0xb1be('0x2e')][_0xb1be('0x2f')]};});_0x12d4f2['model']=_[_0xb1be('0x2b')](_0x1cbe07,_0xb1be('0x28'));_0x12d4f2['query']=_[_0xb1be('0x30')](_0x59b7ae[_0xb1be('0x31')]);_0x12d4f2['filters']=_[_0xb1be('0x32')](_0x12d4f2[_0xb1be('0x33')],_0x12d4f2['query']);_0x49b160['attributes']=_['intersection'](_0x12d4f2[_0xb1be('0x33')],qs[_0xb1be('0x34')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x34')]));_0x49b160[_0xb1be('0x35')]=_0x49b160[_0xb1be('0x35')][_0xb1be('0x36')]?_0x49b160[_0xb1be('0x35')]:_0x12d4f2[_0xb1be('0x33')];if(!_0x59b7ae['query'][_0xb1be('0x37')](_0xb1be('0x38'))){_0x49b160[_0xb1be('0x1d')]=qs[_0xb1be('0x1d')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x1d')]);_0x49b160[_0xb1be('0x1a')]=qs['offset'](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0x49b160['order']=qs[_0xb1be('0x39')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x39')]);_0x49b160[_0xb1be('0x3a')]=qs[_0xb1be('0x3b')](_['pick'](_0x59b7ae['query'],_0x12d4f2['filters']),_0x1cbe07);if(_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x3c')]){_0x49b160[_0xb1be('0x3a')]=_['merge'](_0x49b160[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0x1cbe07,function(_0x3b884e){if(_0x3b884e['type']!==_0xb1be('0x3d')){var _0x3fe2cf={};_0x3fe2cf[_0x3b884e[_0xb1be('0x28')]]={'$like':'%'+_0x59b7ae['query']['filter']+'%'};return _0x3fe2cf;}})});}_0x49b160=_['merge']({},_0x49b160,_0x59b7ae[_0xb1be('0x3e')]);var _0x50b0bc={'where':_0x49b160[_0xb1be('0x3a')]};return db[_0xb1be('0x3f')]['count'](_0x50b0bc)[_0xb1be('0x21')](function(_0x193c73){_0x2c4c1d[_0xb1be('0x1c')]=_0x193c73;if(_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x40')]){_0x49b160[_0xb1be('0x41')]=[{'all':!![]}];}return db[_0xb1be('0x3f')]['findAll'](_0x49b160);})[_0xb1be('0x21')](function(_0x125ee7){_0x2c4c1d[_0xb1be('0x42')]=_0x125ee7;return _0x2c4c1d;})[_0xb1be('0x21')](respondWithFilteredResult(_0x188fe1,_0x49b160))[_0xb1be('0x43')](handleError(_0x188fe1,null));};exports['show']=function(_0x2b3836,_0x17ff51){var _0x116509={'raw':![],'where':{'id':_0x2b3836['params']['id']}},_0x38794e={};_0x38794e[_0xb1be('0x33')]=_['keys'](db[_0xb1be('0x3f')][_0xb1be('0x2c')]);_0x38794e[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0x2b3836[_0xb1be('0x31')]);_0x38794e['filters']=_[_0xb1be('0x32')](_0x38794e['model'],_0x38794e[_0xb1be('0x31')]);_0x116509[_0xb1be('0x35')]=_[_0xb1be('0x32')](_0x38794e[_0xb1be('0x33')],qs['fields'](_0x2b3836[_0xb1be('0x31')][_0xb1be('0x34')]));_0x116509[_0xb1be('0x35')]=_0x116509[_0xb1be('0x35')]['length']?_0x116509['attributes']:_0x38794e[_0xb1be('0x33')];if(_0x2b3836['query']['includeAll']){_0x116509[_0xb1be('0x41')]=[{'all':!![]}];}_0x116509=_[_0xb1be('0x44')]({},_0x116509,_0x2b3836[_0xb1be('0x3e')]);return db[_0xb1be('0x3f')][_0xb1be('0x45')](_0x116509)[_0xb1be('0x21')](handleEntityNotFound(_0x17ff51,null))['then'](respondWithResult(_0x17ff51,null))[_0xb1be('0x43')](handleError(_0x17ff51,null));};exports[_0xb1be('0x46')]=function(_0x23f03f,_0x425257){return db['JscriptyProject']['create'](_0x23f03f[_0xb1be('0x47')],{})[_0xb1be('0x21')](function(_0x4abd1b){var _0x1db7ed=_0x23f03f[_0xb1be('0x48')]['get']({'plain':!![]});if(!_0x1db7ed)throw new Error(_0xb1be('0x49'));if(_0x1db7ed[_0xb1be('0x4a')]===_0xb1be('0x48')){var _0x2fcf8a=_0x4abd1b['get']({'plain':!![]});var _0x298cf3=_0xb1be('0x23');return db[_0xb1be('0x4b')][_0xb1be('0x45')]({'where':{'name':_0x298cf3,'userProfileId':_0x1db7ed[_0xb1be('0x4c')]},'raw':!![]})['then'](function(_0x584f54){if(_0x584f54&&_0x584f54[_0xb1be('0x4d')]===0x0){return db['UserProfileResource'][_0xb1be('0x46')]({'name':_0x2fcf8a[_0xb1be('0x28')],'resourceId':_0x2fcf8a['id'],'type':_0x584f54[_0xb1be('0x28')],'sectionId':_0x584f54['id']},{})[_0xb1be('0x21')](function(){return _0x4abd1b;});}else{return _0x4abd1b;}})[_0xb1be('0x43')](function(_0x44a47a){logger[_0xb1be('0x26')](_0xb1be('0x4e'),_0x44a47a);throw _0x44a47a;});}return _0x4abd1b;})[_0xb1be('0x21')](respondWithResult(_0x425257,0xc9))[_0xb1be('0x43')](handleError(_0x425257,null));};exports['clone']=function(_0x196eb0,_0x1f3531){var _0x540014={'where':{'id':_0x196eb0[_0xb1be('0x4f')]['id']}},_0x1ace00={};_0x1ace00[_0xb1be('0x33')]=_[_0xb1be('0x30')](db[_0xb1be('0x3f')][_0xb1be('0x2c')]);_0x540014[_0xb1be('0x35')]=_[_0xb1be('0x32')](_0x1ace00[_0xb1be('0x33')],qs[_0xb1be('0x34')](_0x196eb0[_0xb1be('0x31')]['fields']));_0x540014[_0xb1be('0x35')]=_0x540014['attributes'][_0xb1be('0x36')]?_0x540014[_0xb1be('0x35')]:_0x1ace00[_0xb1be('0x33')];if(_0x196eb0[_0xb1be('0x31')][_0xb1be('0x40')]){_0x540014[_0xb1be('0x41')]=[{'all':!![]}];}_0x540014=_[_0xb1be('0x44')]({},_0x540014,_0x196eb0[_0xb1be('0x3e')]);return db[_0xb1be('0x3f')][_0xb1be('0x45')](_0x540014)[_0xb1be('0x21')](handleEntityNotFound(_0x1f3531,null))['then'](function(_0x5bf6fe){if(_0x5bf6fe){var _0xce9df7=_0x5bf6fe[_0xb1be('0x22')]({'plain':!![]});_0xce9df7=qs[_0xb1be('0x50')](_0xce9df7,['id',_0xb1be('0x51'),'updatedAt']);_0x196eb0['body']=_['omit'](_0x196eb0[_0xb1be('0x47')],['id',_0xb1be('0x51'),'updatedAt']);return db[_0xb1be('0x3f')][_0xb1be('0x46')](_[_0xb1be('0x44')](_0xce9df7,_0x196eb0[_0xb1be('0x47')]),{'include':_0x196eb0[_0xb1be('0x31')][_0xb1be('0x40')]?[{'all':!![]}]:undefined})[_0xb1be('0x21')](function(_0x43ddc5){var _0x21edbe=_0x196eb0[_0xb1be('0x48')][_0xb1be('0x22')]({'plain':!![]});if(!_0x21edbe)throw new Error(_0xb1be('0x49'));if(_0x21edbe[_0xb1be('0x4a')]==='user'){var _0x393977=_0x43ddc5['get']({'plain':!![]});var _0x3fce0f=_0xb1be('0x23');return db[_0xb1be('0x4b')][_0xb1be('0x45')]({'where':{'name':_0x3fce0f,'userProfileId':_0x21edbe['userProfileId']},'raw':!![]})['then'](function(_0x48d91d){if(_0x48d91d&&_0x48d91d[_0xb1be('0x4d')]===0x0){return db[_0xb1be('0x24')][_0xb1be('0x46')]({'name':_0x393977[_0xb1be('0x28')],'resourceId':_0x393977['id'],'type':_0x48d91d[_0xb1be('0x28')],'sectionId':_0x48d91d['id']},{})[_0xb1be('0x21')](function(){return _0x43ddc5;});}else{return _0x43ddc5;}})[_0xb1be('0x43')](function(_0x44341e){logger['error'](_0xb1be('0x4e'),_0x44341e);throw _0x44341e;});}return _0x43ddc5;});}})['then'](respondWithResult(_0x1f3531,0xc9))[_0xb1be('0x43')](handleError(_0x1f3531,null));};exports[_0xb1be('0x20')]=function(_0x189286,_0xc3316c){if(_0x189286[_0xb1be('0x47')]['id']){delete _0x189286[_0xb1be('0x47')]['id'];}return db[_0xb1be('0x3f')][_0xb1be('0x45')]({'where':{'id':_0x189286[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0xc3316c,null))[_0xb1be('0x21')](saveUpdates(_0x189286[_0xb1be('0x47')],null))[_0xb1be('0x21')](respondWithResult(_0xc3316c,null))['catch'](handleError(_0xc3316c,null));};exports[_0xb1be('0x25')]=function(_0x3d4a1b,_0x18e7c5){return db['JscriptyProject'][_0xb1be('0x45')]({'where':{'id':_0x3d4a1b[_0xb1be('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18e7c5,null))['then'](removeEntity(_0x18e7c5,null))[_0xb1be('0x43')](handleError(_0x18e7c5,null));};exports['getSessions']=function(_0xbea274,_0x169fa7,_0x5e750a){var _0xc4202b={'raw':!![],'where':{}};var _0x585bff={};var _0x47e061={'count':0x0,'rows':[]};return db[_0xb1be('0x3f')][_0xb1be('0x52')]({'where':{'id':_0xbea274[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0x169fa7,null))[_0xb1be('0x21')](function(_0x21e088){if(_0x21e088){_0x585bff['model']=_[_0xb1be('0x30')](db[_0xb1be('0x53')][_0xb1be('0x2c')]);_0x585bff[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0xbea274[_0xb1be('0x31')]);_0x585bff[_0xb1be('0x3b')]=_[_0xb1be('0x32')](_0x585bff[_0xb1be('0x33')],_0x585bff[_0xb1be('0x31')]);_0xc4202b[_0xb1be('0x35')]=_['intersection'](_0x585bff['model'],qs[_0xb1be('0x34')](_0xbea274[_0xb1be('0x31')]['fields']));_0xc4202b[_0xb1be('0x35')]=_0xc4202b[_0xb1be('0x35')][_0xb1be('0x36')]?_0xc4202b[_0xb1be('0x35')]:_0x585bff[_0xb1be('0x33')];if(!_0xbea274[_0xb1be('0x31')][_0xb1be('0x37')](_0xb1be('0x38'))){_0xc4202b[_0xb1be('0x1d')]=qs[_0xb1be('0x1d')](_0xbea274[_0xb1be('0x31')][_0xb1be('0x1d')]);_0xc4202b['offset']=qs['offset'](_0xbea274[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0xc4202b[_0xb1be('0x54')]=qs[_0xb1be('0x39')](_0xbea274[_0xb1be('0x31')][_0xb1be('0x39')]);_0xc4202b['where']=qs['filters'](_['pick'](_0xbea274['query'],_0x585bff[_0xb1be('0x3b')]));_0xc4202b[_0xb1be('0x3a')][_0xb1be('0x55')]=_0x21e088['id'];if(_0xbea274['query'][_0xb1be('0x3c')]){_0xc4202b['where']=_[_0xb1be('0x44')](_0xc4202b[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0xc4202b[_0xb1be('0x35')],function(_0x1b3023){var _0x3315da={};_0x3315da[_0x1b3023]={'$like':'%'+_0xbea274[_0xb1be('0x31')][_0xb1be('0x3c')]+'%'};return _0x3315da;})});}_0xc4202b=_[_0xb1be('0x44')]({},_0xc4202b,_0xbea274[_0xb1be('0x3e')]);return db['JscriptySessionReport'][_0xb1be('0x1c')]({'where':_0xc4202b[_0xb1be('0x3a')]})['then'](function(_0x12d3b8){_0x47e061['count']=_0x12d3b8;if(_0xbea274[_0xb1be('0x31')][_0xb1be('0x40')]){_0xc4202b[_0xb1be('0x41')]=[{'all':!![]}];}return db[_0xb1be('0x53')][_0xb1be('0x56')](_0xc4202b);})[_0xb1be('0x21')](function(_0x59afc2){_0x47e061[_0xb1be('0x42')]=_0x59afc2;return _0x47e061;});}})[_0xb1be('0x21')](respondWithFilteredResult(_0x169fa7,_0xc4202b))[_0xb1be('0x43')](handleError(_0x169fa7,null));};exports['getAnswers']=function(_0xd9ff0a,_0x5a91bb,_0x5e1a89){var _0x137c24={'raw':!![],'where':{}};var _0x527237={};var _0x1657a6={'count':0x0,'rows':[]};return db[_0xb1be('0x3f')][_0xb1be('0x52')]({'where':{'id':_0xd9ff0a[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0x5a91bb,null))[_0xb1be('0x21')](function(_0x1f0d48){if(_0x1f0d48){_0x527237['model']=_[_0xb1be('0x30')](db[_0xb1be('0x57')]['rawAttributes']);_0x527237[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0xd9ff0a[_0xb1be('0x31')]);_0x527237[_0xb1be('0x3b')]=_[_0xb1be('0x32')](_0x527237[_0xb1be('0x33')],_0x527237[_0xb1be('0x31')]);_0x137c24['attributes']=_['intersection'](_0x527237['model'],qs[_0xb1be('0x34')](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x34')]));_0x137c24['attributes']=_0x137c24[_0xb1be('0x35')][_0xb1be('0x36')]?_0x137c24[_0xb1be('0x35')]:_0x527237[_0xb1be('0x33')];if(!_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x37')](_0xb1be('0x38'))){_0x137c24[_0xb1be('0x1d')]=qs['limit'](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x1d')]);_0x137c24[_0xb1be('0x1a')]=qs[_0xb1be('0x1a')](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0x137c24[_0xb1be('0x54')]=qs[_0xb1be('0x39')](_0xd9ff0a[_0xb1be('0x31')]['sort']);_0x137c24[_0xb1be('0x3a')]=qs[_0xb1be('0x3b')](_[_0xb1be('0x58')](_0xd9ff0a[_0xb1be('0x31')],_0x527237[_0xb1be('0x3b')]));_0x137c24[_0xb1be('0x3a')]['ProjectId']=_0x1f0d48['id'];if(_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x3c')]){_0x137c24[_0xb1be('0x3a')]=_[_0xb1be('0x44')](_0x137c24[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0x137c24[_0xb1be('0x35')],function(_0x4351eb){var _0x10d65b={};_0x10d65b[_0x4351eb]={'$like':'%'+_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x3c')]+'%'};return _0x10d65b;})});}_0x137c24=_['merge']({},_0x137c24,_0xd9ff0a[_0xb1be('0x3e')]);return db[_0xb1be('0x57')]['count']({'where':_0x137c24[_0xb1be('0x3a')]})[_0xb1be('0x21')](function(_0x3d6816){_0x1657a6[_0xb1be('0x1c')]=_0x3d6816;if(_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x40')]){_0x137c24['include']=[{'all':!![]}];}return db[_0xb1be('0x57')][_0xb1be('0x56')](_0x137c24);})[_0xb1be('0x21')](function(_0x5dd376){_0x1657a6[_0xb1be('0x42')]=_0x5dd376;return _0x1657a6;});}})[_0xb1be('0x21')](respondWithFilteredResult(_0x5a91bb,_0x137c24))[_0xb1be('0x43')](handleError(_0x5a91bb,null));};function char(_0x25e703){return _0xb1be('0x59')===typeof _0x25e703?String[_0xb1be('0x5a')][_0xb1be('0x5b')](null,arguments):_0x25e703;}function needsEncapsulation(_0x44d184){return!!_0x44d184&&(_0x44d184[_0xb1be('0x5c')]()[_0xb1be('0x5d')](char(0xd))>=0x0||_0x44d184[_0xb1be('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x44d184[_0xb1be('0x5c')]()[_0xb1be('0x5d')](char(0x2c))>=0x0||_0x44d184['toString']()[_0xb1be('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x4a7ad9){var _0x2fb7d6=char(0x22),_0x578ae8='\x5c'+char(0x22),_0x32ac9e=_0x4a7ad9[_0xb1be('0x5c')]()[_0xb1be('0x5e')](new RegExp(_0x2fb7d6,'g'),_0x578ae8);return _0x2fb7d6+_0x32ac9e+_0x2fb7d6;}exports[_0xb1be('0x5f')]=function(_0x4231cb,_0x44edae,_0x1ac1e6){var _0xe75b2c,_0x1184bc;var _0x45a26f={'where':{'ProjectId':_0x4231cb['params']['id']}};if(_0x4231cb[_0xb1be('0x31')][_0xb1be('0x60')]){_0x45a26f[_0xb1be('0x3a')][_0xb1be('0x61')]=JSON[_0xb1be('0x62')](_0x4231cb[_0xb1be('0x31')][_0xb1be('0x60')]);}return db['JscriptySessionReport'][_0xb1be('0x56')](_0x45a26f)[_0xb1be('0x21')](handleEntityNotFound(_0x44edae,null))[_0xb1be('0x21')](function(_0x257324){if(_0x257324){_0xe75b2c=_0x257324;return db[_0xb1be('0x63')][_0xb1be('0x56')]({'where':{'SessionId':{'$in':_[_0xb1be('0x2b')](_0xe75b2c,'id')},'ProjectId':_0x4231cb['params']['id']},'order':_0xb1be('0x64')});}})[_0xb1be('0x21')](handleEntityNotFound(_0x44edae,null))[_0xb1be('0x21')](function(_0x51c4c3){if(_0x51c4c3){_0x1184bc=_0x51c4c3;var _0x1ecdbc={};for(var _0x4939c4=0x0,_0x3ae879=_0x1184bc['length'];_0x4939c4<_0x3ae879;_0x4939c4++){if(!_0x1ecdbc[_0xb1be('0x37')](_0x1184bc[_0x4939c4][_0xb1be('0x65')])){_0x1ecdbc[_0x1184bc[_0x4939c4][_0xb1be('0x65')]]=needsEncapsulation(_0x1184bc[_0x4939c4]['question'])?encapsulate(_0x1184bc[_0x4939c4][_0xb1be('0x66')]):_0x1184bc[_0x4939c4][_0xb1be('0x66')];}}var _0x4684fe=[],_0x1ae3c0={};for(var _0x483102=0x0,_0x5b1f65=_0xe75b2c['length'];_0x483102<_0x5b1f65;_0x483102++){_0x1ae3c0={'ProjectId':_0x4231cb[_0xb1be('0x4f')]['id'],'SessionId':_0xe75b2c[_0x483102]['id'],'StartTime':moment(_0xe75b2c[_0x483102][_0xb1be('0x61')])[_0xb1be('0x67')](_0xb1be('0x68'))};for(var _0xec5743=0x0,_0x17c726=_0x1184bc[_0xb1be('0x36')];_0xec5743<_0x17c726;_0xec5743++){if(_0x1184bc[_0xec5743][_0xb1be('0x69')]==_0xe75b2c[_0x483102]['id']&&_0x1ecdbc[_0xb1be('0x37')](_0x1184bc[_0xec5743]['questionId'])){_0x1ae3c0[_0x1ecdbc[_0x1184bc[_0xec5743][_0xb1be('0x65')]]]=_0x1184bc[_0xec5743]['answer'];}}for(var _0x2d1b38 in _0x1ecdbc){if(!_0x1ae3c0[_0xb1be('0x37')](_0x1ecdbc[_0x2d1b38])){_0x1ae3c0[_0x1ecdbc[_0x2d1b38]]=null;}}_0x4684fe[_0xb1be('0x6a')](_0x1ae3c0);}return _0x4684fe;}})[_0xb1be('0x21')](function(_0x49b35f){if(!_[_0xb1be('0x6b')](_0x49b35f)){var _0x50ded8=toCsv(_0x49b35f);var _0x4eedde=Date[_0xb1be('0x6c')]();fs[_0xb1be('0x6d')](util['format'](_0xb1be('0x6e'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde),_0x50ded8);_0x44edae[_0xb1be('0x6f')](_0xb1be('0x70'),_0xb1be('0x71')+util[_0xb1be('0x67')](_0xb1be('0x72'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde));_0x44edae[_0xb1be('0x6f')](_0xb1be('0x73'),'text/csv');return _0x44edae['download'](util[_0xb1be('0x67')](_0xb1be('0x6e'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde));}else{return _0x44edae['sendStatus'](0xcc);}})[_0xb1be('0x43')](handleError(_0x44edae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5f83cbc..8d3880d 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 _0xdb2a=['bluebird','request-promise','rimraf','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb2a,0x16f));var _0xadb2=function(_0x208635,_0x4441a4){_0x208635=_0x208635-0x0;var _0xedef1f=_0xdb2a[_0x208635];return _0xedef1f;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var logger=require(_0xadb2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadb2('0x3'));var rp=require(_0xadb2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb2('0x5'));var config=require('../../config/environment');var attributes=require(_0xadb2('0x6'));module[_0xadb2('0x7')]=function(_0x1f5c7e,_0x297e69){return _0x1f5c7e[_0xadb2('0x8')]('JscriptyProject',attributes,{'tableName':_0xadb2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf185=['define','JscriptyProject','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x530865,_0x32f9a3){var _0x458a4f=function(_0x41b754){while(--_0x41b754){_0x530865['push'](_0x530865['shift']());}};_0x458a4f(++_0x32f9a3);}(_0xf185,0x1be));var _0x5f18=function(_0x3fe944,_0x5356e9){_0x3fe944=_0x3fe944-0x0;var _0x1bc66c=_0xf185[_0x3fe944];return _0x1bc66c;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require(_0x5f18('0x5'));var fs=require('fs');var path=require(_0x5f18('0x6'));var rimraf=require('rimraf');var config=require(_0x5f18('0x7'));var attributes=require(_0x5f18('0x8'));module[_0x5f18('0x9')]=function(_0x1cac08,_0x5b7cc5){return _0x1cac08[_0x5f18('0xa')](_0x5f18('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index d6dfa65..4867edb 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(_0x594f70,_0x379643){var _0x41d23c=function(_0x4a3894){while(--_0x4a3894){_0x594f70['push'](_0x594f70['shift']());}};_0x41d23c(++_0x379643);}(_0xaa88,0x137));var _0x8aa8=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0xaa88[_0x15af0f];return _0x2bd1cb;};'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(_0x575993,_0x452ba8){var _0x4ddeda=function(_0x165e56){while(--_0x165e56){_0x575993['push'](_0x575993['shift']());}};_0x4ddeda(++_0x452ba8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index fef8601..6ff621d 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 _0xe86f=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x37d89c,_0x126544){var _0x3b5837=function(_0x17e8af){while(--_0x17e8af){_0x37d89c['push'](_0x37d89c['shift']());}};_0x3b5837(++_0x126544);}(_0xe86f,0x166));var _0xfe86=function(_0x40243a,_0x725061){_0x40243a=_0x40243a-0x0;var _0x2cc496=_0xe86f[_0x40243a];return _0x2cc496;};'use strict';var multer=require(_0xfe86('0x0'));var util=require(_0xfe86('0x1'));var path=require(_0xfe86('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe86('0x3'));var router=express[_0xfe86('0x4')]();var fs_extra=require(_0xfe86('0x5'));var auth=require(_0xfe86('0x6'));var interaction=require(_0xfe86('0x7'));var config=require(_0xfe86('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0xfe86('0x9')]('/',auth[_0xfe86('0xa')](),controller[_0xfe86('0xb')]);router[_0xfe86('0x9')](_0xfe86('0xc'),auth[_0xfe86('0xa')](),controller[_0xfe86('0xd')]);router[_0xfe86('0x9')](_0xfe86('0xe'),auth[_0xfe86('0xa')](),controller[_0xfe86('0xf')]);router['post']('/',auth[_0xfe86('0xa')](),controller[_0xfe86('0x10')]);router[_0xfe86('0x11')](_0xfe86('0xe'),auth['isAuthenticated'](),controller[_0xfe86('0x12')]);router[_0xfe86('0x13')](_0xfe86('0xe'),auth[_0xfe86('0xa')](),controller[_0xfe86('0x14')]);module[_0xfe86('0x15')]=router; \ No newline at end of file +var _0x9c4c=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1327f7,_0x574202){var _0xa7a00c=function(_0x4cfe0b){while(--_0x4cfe0b){_0x1327f7['push'](_0x1327f7['shift']());}};_0xa7a00c(++_0x574202);}(_0x9c4c,0xf6));var _0xc9c4=function(_0x2d45d7,_0x4a339a){_0x2d45d7=_0x2d45d7-0x0;var _0x576939=_0x9c4c[_0x2d45d7];return _0x576939;};'use strict';var multer=require('multer');var util=require(_0xc9c4('0x0'));var path=require(_0xc9c4('0x1'));var timeout=require(_0xc9c4('0x2'));var express=require(_0xc9c4('0x3'));var router=express[_0xc9c4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc9c4('0x5'));var config=require(_0xc9c4('0x6'));var controller=require(_0xc9c4('0x7'));router[_0xc9c4('0x8')]('/',auth[_0xc9c4('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc9c4('0xa'),auth[_0xc9c4('0x9')](),controller[_0xc9c4('0xb')]);router[_0xc9c4('0xc')]('/',auth[_0xc9c4('0x9')](),controller['create']);router[_0xc9c4('0xd')]('/:id',auth[_0xc9c4('0x9')](),controller[_0xc9c4('0xe')]);router[_0xc9c4('0xf')](_0xc9c4('0xa'),auth[_0xc9c4('0x9')](),controller[_0xc9c4('0x10')]);module[_0xc9c4('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 68f1783..7615f31 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x66e3b9,_0x11e75b){_0x66e3b9=_0x66e3b9-0x0;var _0x1f885c=_0x7a54[_0x66e3b9];return _0x1f885c;};'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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x4ef021,_0x25912d){_0x4ef021=_0x4ef021-0x0;var _0xb1c550=_0x7a54[_0x4ef021];return _0xb1c550;};'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 ba1d3da..88c6a6b 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 _0x8450=['Content-Range','reject','save','update','then','end','error','send','index','fieldName','type','key','map','name','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','catch','show','params','length','find','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8450,0xfd));var _0x0845=function(_0x3fca8b,_0x4ce5fd){_0x3fca8b=_0x3fca8b-0x0;var _0x3552a1=_0x8450[_0x3fca8b];return _0x3552a1;};'use strict';var emlformat=require(_0x0845('0x0'));var rimraf=require(_0x0845('0x1'));var zipdir=require(_0x0845('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0845('0x3'));var moment=require(_0x0845('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0845('0x5'));var util=require(_0x0845('0x6'));var path=require(_0x0845('0x7'));var sox=require('sox');var csv=require(_0x0845('0x8'));var ejs=require(_0x0845('0x9'));var fs=require('fs');var fs_extra=require(_0x0845('0xa'));var _=require(_0x0845('0xb'));var squel=require(_0x0845('0xc'));var crypto=require('crypto');var jsforce=require(_0x0845('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0845('0x8'));var querystring=require('querystring');var Papa=require(_0x0845('0xe'));var Redis=require(_0x0845('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0845('0x10'));var hardwareService=require(_0x0845('0x11'));var logger=require(_0x0845('0x12'))(_0x0845('0x13'));var utils=require('../../config/utils');var config=require(_0x0845('0x14'));var licenseUtil=require(_0x0845('0x15'));var db=require(_0x0845('0x16'))['db'];function respondWithStatusCode(_0x57fe40,_0x3b5b4b){_0x3b5b4b=_0x3b5b4b||0xcc;return function(_0x2d06a8){if(_0x2d06a8){return _0x57fe40[_0x0845('0x17')](_0x3b5b4b);}return _0x57fe40[_0x0845('0x18')](_0x3b5b4b)['end']();};}function respondWithResult(_0x3cbbad,_0x2829ea){_0x2829ea=_0x2829ea||0xc8;return function(_0x5b3d43){if(_0x5b3d43){return _0x3cbbad['status'](_0x2829ea)[_0x0845('0x19')](_0x5b3d43);}};}function respondWithFilteredResult(_0x10f9a2,_0x4621f6){return function(_0x22cfb4){if(_0x22cfb4){var _0x59bf19=typeof _0x4621f6[_0x0845('0x1a')]===_0x0845('0x1b')&&typeof _0x4621f6[_0x0845('0x1c')]===_0x0845('0x1b');var _0x4332db=_0x22cfb4[_0x0845('0x1d')];var _0x58b89c=_0x59bf19?0x0:_0x4621f6[_0x0845('0x1a')];var _0x110ec0=_0x59bf19?_0x22cfb4[_0x0845('0x1d')]:_0x4621f6[_0x0845('0x1a')]+_0x4621f6['limit'];var _0x295aa5;if(_0x110ec0>=_0x4332db){_0x110ec0=_0x4332db;_0x295aa5=0xc8;}else{_0x295aa5=0xce;}_0x10f9a2[_0x0845('0x18')](_0x295aa5);return _0x10f9a2[_0x0845('0x1e')](_0x0845('0x1f'),_0x58b89c+'-'+_0x110ec0+'/'+_0x4332db)[_0x0845('0x19')](_0x22cfb4);}return null;};}function patchUpdates(_0x584e65){return function(_0x56cc26){try{jsonpatch['apply'](_0x56cc26,_0x584e65,!![]);}catch(_0x295532){return BPromise[_0x0845('0x20')](_0x295532);}return _0x56cc26[_0x0845('0x21')]();};}function saveUpdates(_0x252b04,_0x264ee2){return function(_0x5b1e69){if(_0x5b1e69){return _0x5b1e69[_0x0845('0x22')](_0x252b04)['then'](function(_0x5ca496){return _0x5ca496;});}return null;};}function removeEntity(_0x3fd02e,_0x7d808f){return function(_0x26f6c4){if(_0x26f6c4){return _0x26f6c4['destroy']()[_0x0845('0x23')](function(){_0x3fd02e[_0x0845('0x18')](0xcc)[_0x0845('0x24')]();});}};}function handleEntityNotFound(_0x3fb996,_0x5e9627){return function(_0x44d657){if(!_0x44d657){_0x3fb996['sendStatus'](0x194);}return _0x44d657;};}function handleError(_0x472900,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x26b37a){logger[_0x0845('0x25')](_0x26b37a['stack']);if(_0x26b37a['name']){delete _0x26b37a['name'];}_0x472900[_0x0845('0x18')](_0x303d24)[_0x0845('0x26')](_0x26b37a);};}exports[_0x0845('0x27')]=function(_0x28e367,_0x2e6ead){var _0x1a0ebb={},_0x51e405={},_0x3ad54d={'count':0x0,'rows':[]};var _0x3ea7b2=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x2ca6fd){return{'name':_0x2ca6fd[_0x0845('0x28')],'type':_0x2ca6fd[_0x0845('0x29')][_0x0845('0x2a')]};});_0x51e405['model']=_[_0x0845('0x2b')](_0x3ea7b2,_0x0845('0x2c'));_0x51e405[_0x0845('0x2d')]=_[_0x0845('0x2e')](_0x28e367[_0x0845('0x2d')]);_0x51e405[_0x0845('0x2f')]=_[_0x0845('0x30')](_0x51e405['model'],_0x51e405[_0x0845('0x2d')]);_0x1a0ebb[_0x0845('0x31')]=_[_0x0845('0x30')](_0x51e405[_0x0845('0x32')],qs[_0x0845('0x33')](_0x28e367['query'][_0x0845('0x33')]));_0x1a0ebb['attributes']=_0x1a0ebb[_0x0845('0x31')]['length']?_0x1a0ebb[_0x0845('0x31')]:_0x51e405['model'];if(!_0x28e367[_0x0845('0x2d')]['hasOwnProperty'](_0x0845('0x34'))){_0x1a0ebb['limit']=qs[_0x0845('0x1c')](_0x28e367[_0x0845('0x2d')][_0x0845('0x1c')]);_0x1a0ebb[_0x0845('0x1a')]=qs[_0x0845('0x1a')](_0x28e367[_0x0845('0x2d')][_0x0845('0x1a')]);}_0x1a0ebb['order']=qs[_0x0845('0x35')](_0x28e367[_0x0845('0x2d')][_0x0845('0x35')]);_0x1a0ebb['where']=qs[_0x0845('0x2f')](_[_0x0845('0x36')](_0x28e367['query'],_0x51e405[_0x0845('0x2f')]),_0x3ea7b2);if(_0x28e367[_0x0845('0x2d')][_0x0845('0x37')]){_0x1a0ebb[_0x0845('0x38')]=_[_0x0845('0x39')](_0x1a0ebb['where'],{'$or':_[_0x0845('0x2b')](_0x3ea7b2,function(_0x14a360){if(_0x14a360['type']!==_0x0845('0x3a')){var _0x52e13d={};_0x52e13d[_0x14a360[_0x0845('0x2c')]]={'$like':'%'+_0x28e367[_0x0845('0x2d')][_0x0845('0x37')]+'%'};return _0x52e13d;}})});}_0x1a0ebb=_[_0x0845('0x39')]({},_0x1a0ebb,_0x28e367[_0x0845('0x3b')]);var _0x13e177={'where':_0x1a0ebb[_0x0845('0x38')]};return db[_0x0845('0x3c')][_0x0845('0x1d')](_0x13e177)['then'](function(_0x1644bd){_0x3ad54d[_0x0845('0x1d')]=_0x1644bd;if(_0x28e367['query'][_0x0845('0x3d')]){_0x1a0ebb[_0x0845('0x3e')]=[{'all':!![]}];}return db[_0x0845('0x3c')]['findAll'](_0x1a0ebb);})[_0x0845('0x23')](function(_0x489e06){_0x3ad54d['rows']=_0x489e06;return _0x3ad54d;})[_0x0845('0x23')](respondWithFilteredResult(_0x2e6ead,_0x1a0ebb))[_0x0845('0x3f')](handleError(_0x2e6ead,null));};exports[_0x0845('0x40')]=function(_0x39f4c5,_0x332d69){var _0xba7fff={'raw':!![],'where':{'id':_0x39f4c5[_0x0845('0x41')]['id']}},_0x548e57={};_0x548e57[_0x0845('0x32')]=_[_0x0845('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x548e57[_0x0845('0x2d')]=_['keys'](_0x39f4c5[_0x0845('0x2d')]);_0x548e57[_0x0845('0x2f')]=_[_0x0845('0x30')](_0x548e57[_0x0845('0x32')],_0x548e57[_0x0845('0x2d')]);_0xba7fff[_0x0845('0x31')]=_['intersection'](_0x548e57[_0x0845('0x32')],qs[_0x0845('0x33')](_0x39f4c5[_0x0845('0x2d')][_0x0845('0x33')]));_0xba7fff['attributes']=_0xba7fff[_0x0845('0x31')][_0x0845('0x42')]?_0xba7fff[_0x0845('0x31')]:_0x548e57[_0x0845('0x32')];if(_0x39f4c5[_0x0845('0x2d')][_0x0845('0x3d')]){_0xba7fff[_0x0845('0x3e')]=[{'all':!![]}];}_0xba7fff=_[_0x0845('0x39')]({},_0xba7fff,_0x39f4c5[_0x0845('0x3b')]);return db[_0x0845('0x3c')][_0x0845('0x43')](_0xba7fff)['then'](handleEntityNotFound(_0x332d69,null))['then'](respondWithResult(_0x332d69,null))[_0x0845('0x3f')](handleError(_0x332d69,null));};exports['create']=function(_0x4a4942,_0x3aaa79){return db[_0x0845('0x3c')]['create'](_0x4a4942[_0x0845('0x44')],{})[_0x0845('0x23')](respondWithResult(_0x3aaa79,0xc9))[_0x0845('0x3f')](handleError(_0x3aaa79,null));};exports[_0x0845('0x22')]=function(_0x43ab67,_0x167f19){if(_0x43ab67['body']['id']){delete _0x43ab67[_0x0845('0x44')]['id'];}return db[_0x0845('0x3c')][_0x0845('0x43')]({'where':{'id':_0x43ab67[_0x0845('0x41')]['id']}})[_0x0845('0x23')](handleEntityNotFound(_0x167f19,null))[_0x0845('0x23')](saveUpdates(_0x43ab67[_0x0845('0x44')],null))['then'](respondWithResult(_0x167f19,null))[_0x0845('0x3f')](handleError(_0x167f19,null));};exports[_0x0845('0x45')]=function(_0x211404,_0x2c520c){return db['JscriptyQuestionReport'][_0x0845('0x43')]({'where':{'id':_0x211404[_0x0845('0x41')]['id']}})[_0x0845('0x23')](handleEntityNotFound(_0x2c520c,null))[_0x0845('0x23')](removeEntity(_0x2c520c,null))[_0x0845('0x3f')](handleError(_0x2c520c,null));};exports['describe']=function(_0x3f935b,_0x45c067){return db['JscriptyQuestionReport'][_0x0845('0x46')]()[_0x0845('0x23')](respondWithResult(_0x45c067,null))['catch'](handleError(_0x45c067,null));}; \ No newline at end of file +var _0xcdd8=['filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','include','catch','show','params','keys','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x225a57,_0x3e66d4){var _0x4ad8fd=function(_0x1ce840){while(--_0x1ce840){_0x225a57['push'](_0x225a57['shift']());}};_0x4ad8fd(++_0x3e66d4);}(_0xcdd8,0x69));var _0x8cdd=function(_0xa8e653,_0xb66e98){_0xa8e653=_0xa8e653-0x0;var _0x21f31a=_0xcdd8[_0xa8e653];return _0x21f31a;};'use strict';var emlformat=require(_0x8cdd('0x0'));var rimraf=require(_0x8cdd('0x1'));var zipdir=require(_0x8cdd('0x2'));var jsonpatch=require(_0x8cdd('0x3'));var rp=require('request-promise');var moment=require(_0x8cdd('0x4'));var BPromise=require(_0x8cdd('0x5'));var Mustache=require('mustache');var util=require(_0x8cdd('0x6'));var path=require(_0x8cdd('0x7'));var sox=require(_0x8cdd('0x8'));var csv=require(_0x8cdd('0x9'));var ejs=require(_0x8cdd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8cdd('0xb'));var crypto=require(_0x8cdd('0xc'));var jsforce=require(_0x8cdd('0xd'));var deskjs=require(_0x8cdd('0xe'));var toCsv=require(_0x8cdd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cdd('0xf'));var qs=require(_0x8cdd('0x10'));var as=require(_0x8cdd('0x11'));var hardwareService=require(_0x8cdd('0x12'));var logger=require(_0x8cdd('0x13'))('api');var utils=require(_0x8cdd('0x14'));var config=require(_0x8cdd('0x15'));var licenseUtil=require(_0x8cdd('0x16'));var db=require(_0x8cdd('0x17'))['db'];function respondWithStatusCode(_0x595cb2,_0x2e7281){_0x2e7281=_0x2e7281||0xcc;return function(_0x347183){if(_0x347183){return _0x595cb2[_0x8cdd('0x18')](_0x2e7281);}return _0x595cb2[_0x8cdd('0x19')](_0x2e7281)[_0x8cdd('0x1a')]();};}function respondWithResult(_0x210528,_0x5aaff9){_0x5aaff9=_0x5aaff9||0xc8;return function(_0x7c2aab){if(_0x7c2aab){return _0x210528[_0x8cdd('0x19')](_0x5aaff9)['json'](_0x7c2aab);}};}function respondWithFilteredResult(_0x380516,_0x3ef80f){return function(_0x57dd07){if(_0x57dd07){var _0x629de6=typeof _0x3ef80f[_0x8cdd('0x1b')]===_0x8cdd('0x1c')&&typeof _0x3ef80f[_0x8cdd('0x1d')]==='undefined';var _0x5bead7=_0x57dd07['count'];var _0x2756a5=_0x629de6?0x0:_0x3ef80f['offset'];var _0x4fd630=_0x629de6?_0x57dd07['count']:_0x3ef80f[_0x8cdd('0x1b')]+_0x3ef80f[_0x8cdd('0x1d')];var _0x5b8970;if(_0x4fd630>=_0x5bead7){_0x4fd630=_0x5bead7;_0x5b8970=0xc8;}else{_0x5b8970=0xce;}_0x380516[_0x8cdd('0x19')](_0x5b8970);return _0x380516[_0x8cdd('0x1e')](_0x8cdd('0x1f'),_0x2756a5+'-'+_0x4fd630+'/'+_0x5bead7)['json'](_0x57dd07);}return null;};}function patchUpdates(_0x285db3){return function(_0x20629b){try{jsonpatch[_0x8cdd('0x20')](_0x20629b,_0x285db3,!![]);}catch(_0x3cfb25){return BPromise[_0x8cdd('0x21')](_0x3cfb25);}return _0x20629b['save']();};}function saveUpdates(_0x54ec35,_0x3496e0){return function(_0x5919c2){if(_0x5919c2){return _0x5919c2['update'](_0x54ec35)[_0x8cdd('0x22')](function(_0x2e451b){return _0x2e451b;});}return null;};}function removeEntity(_0x492010,_0x22c108){return function(_0x17613d){if(_0x17613d){return _0x17613d[_0x8cdd('0x23')]()[_0x8cdd('0x22')](function(){_0x492010['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40209e,_0x102e61){return function(_0x4abebd){if(!_0x4abebd){_0x40209e[_0x8cdd('0x18')](0x194);}return _0x4abebd;};}function handleError(_0x3cfcb5,_0x41e86c){_0x41e86c=_0x41e86c||0x1f4;return function(_0x3ee506){logger[_0x8cdd('0x24')](_0x3ee506[_0x8cdd('0x25')]);if(_0x3ee506[_0x8cdd('0x26')]){delete _0x3ee506[_0x8cdd('0x26')];}_0x3cfcb5['status'](_0x41e86c)[_0x8cdd('0x27')](_0x3ee506);};}exports[_0x8cdd('0x28')]=function(_0x2fbb92,_0x2fb3ec){var _0x177070={},_0x46c40a={},_0x20c8f6={'count':0x0,'rows':[]};var _0x43a4cc=_[_0x8cdd('0x29')](db['JscriptyQuestionReport'][_0x8cdd('0x2a')],function(_0x1d1d29){return{'name':_0x1d1d29[_0x8cdd('0x2b')],'type':_0x1d1d29[_0x8cdd('0x2c')][_0x8cdd('0x2d')]};});_0x46c40a[_0x8cdd('0x2e')]=_['map'](_0x43a4cc,_0x8cdd('0x26'));_0x46c40a['query']=_['keys'](_0x2fbb92['query']);_0x46c40a[_0x8cdd('0x2f')]=_[_0x8cdd('0x30')](_0x46c40a[_0x8cdd('0x2e')],_0x46c40a[_0x8cdd('0x31')]);_0x177070['attributes']=_[_0x8cdd('0x30')](_0x46c40a['model'],qs[_0x8cdd('0x32')](_0x2fbb92[_0x8cdd('0x31')][_0x8cdd('0x32')]));_0x177070['attributes']=_0x177070[_0x8cdd('0x33')][_0x8cdd('0x34')]?_0x177070[_0x8cdd('0x33')]:_0x46c40a[_0x8cdd('0x2e')];if(!_0x2fbb92['query'][_0x8cdd('0x35')](_0x8cdd('0x36'))){_0x177070[_0x8cdd('0x1d')]=qs[_0x8cdd('0x1d')](_0x2fbb92[_0x8cdd('0x31')]['limit']);_0x177070['offset']=qs[_0x8cdd('0x1b')](_0x2fbb92[_0x8cdd('0x31')]['offset']);}_0x177070[_0x8cdd('0x37')]=qs[_0x8cdd('0x38')](_0x2fbb92['query'][_0x8cdd('0x38')]);_0x177070['where']=qs['filters'](_[_0x8cdd('0x39')](_0x2fbb92[_0x8cdd('0x31')],_0x46c40a[_0x8cdd('0x2f')]),_0x43a4cc);if(_0x2fbb92['query'][_0x8cdd('0x3a')]){_0x177070['where']=_[_0x8cdd('0x3b')](_0x177070[_0x8cdd('0x3c')],{'$or':_[_0x8cdd('0x29')](_0x43a4cc,function(_0x4351af){if(_0x4351af['type']!==_0x8cdd('0x3d')){var _0x17e23f={};_0x17e23f[_0x4351af[_0x8cdd('0x26')]]={'$like':'%'+_0x2fbb92['query'][_0x8cdd('0x3a')]+'%'};return _0x17e23f;}})});}_0x177070=_['merge']({},_0x177070,_0x2fbb92[_0x8cdd('0x3e')]);var _0x154069={'where':_0x177070['where']};return db[_0x8cdd('0x3f')][_0x8cdd('0x40')](_0x154069)[_0x8cdd('0x22')](function(_0x1de4e6){_0x20c8f6['count']=_0x1de4e6;if(_0x2fbb92[_0x8cdd('0x31')][_0x8cdd('0x41')]){_0x177070[_0x8cdd('0x42')]=[{'all':!![]}];}return db[_0x8cdd('0x3f')]['findAll'](_0x177070);})[_0x8cdd('0x22')](function(_0x64d9ce){_0x20c8f6['rows']=_0x64d9ce;return _0x20c8f6;})[_0x8cdd('0x22')](respondWithFilteredResult(_0x2fb3ec,_0x177070))[_0x8cdd('0x43')](handleError(_0x2fb3ec,null));};exports[_0x8cdd('0x44')]=function(_0x357359,_0xd5aefe){var _0x2d3781={'raw':!![],'where':{'id':_0x357359[_0x8cdd('0x45')]['id']}},_0x23cdc4={};_0x23cdc4[_0x8cdd('0x2e')]=_[_0x8cdd('0x46')](db['JscriptyQuestionReport'][_0x8cdd('0x2a')]);_0x23cdc4[_0x8cdd('0x31')]=_[_0x8cdd('0x46')](_0x357359['query']);_0x23cdc4['filters']=_[_0x8cdd('0x30')](_0x23cdc4[_0x8cdd('0x2e')],_0x23cdc4[_0x8cdd('0x31')]);_0x2d3781['attributes']=_[_0x8cdd('0x30')](_0x23cdc4[_0x8cdd('0x2e')],qs[_0x8cdd('0x32')](_0x357359[_0x8cdd('0x31')][_0x8cdd('0x32')]));_0x2d3781[_0x8cdd('0x33')]=_0x2d3781[_0x8cdd('0x33')]['length']?_0x2d3781['attributes']:_0x23cdc4[_0x8cdd('0x2e')];if(_0x357359[_0x8cdd('0x31')][_0x8cdd('0x41')]){_0x2d3781[_0x8cdd('0x42')]=[{'all':!![]}];}_0x2d3781=_[_0x8cdd('0x3b')]({},_0x2d3781,_0x357359[_0x8cdd('0x3e')]);return db[_0x8cdd('0x3f')][_0x8cdd('0x47')](_0x2d3781)[_0x8cdd('0x22')](handleEntityNotFound(_0xd5aefe,null))['then'](respondWithResult(_0xd5aefe,null))[_0x8cdd('0x43')](handleError(_0xd5aefe,null));};exports[_0x8cdd('0x48')]=function(_0x11bda5,_0x5e611b){return db[_0x8cdd('0x3f')][_0x8cdd('0x48')](_0x11bda5['body'],{})['then'](respondWithResult(_0x5e611b,0xc9))[_0x8cdd('0x43')](handleError(_0x5e611b,null));};exports[_0x8cdd('0x49')]=function(_0x544fa2,_0x4b04e3){if(_0x544fa2[_0x8cdd('0x4a')]['id']){delete _0x544fa2[_0x8cdd('0x4a')]['id'];}return db[_0x8cdd('0x3f')][_0x8cdd('0x47')]({'where':{'id':_0x544fa2[_0x8cdd('0x45')]['id']}})[_0x8cdd('0x22')](handleEntityNotFound(_0x4b04e3,null))[_0x8cdd('0x22')](saveUpdates(_0x544fa2['body'],null))[_0x8cdd('0x22')](respondWithResult(_0x4b04e3,null))['catch'](handleError(_0x4b04e3,null));};exports[_0x8cdd('0x23')]=function(_0x1ce6a2,_0x5a489e){return db['JscriptyQuestionReport'][_0x8cdd('0x47')]({'where':{'id':_0x1ce6a2[_0x8cdd('0x45')]['id']}})[_0x8cdd('0x22')](handleEntityNotFound(_0x5a489e,null))[_0x8cdd('0x22')](removeEntity(_0x5a489e,null))['catch'](handleError(_0x5a489e,null));};exports[_0x8cdd('0x4b')]=function(_0x44cd95,_0x38a1eb){return db[_0x8cdd('0x3f')][_0x8cdd('0x4b')]()['then'](respondWithResult(_0x38a1eb,null))[_0x8cdd('0x43')](handleError(_0x38a1eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7af450a..62ad3f0 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 _0x3d7b=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d7b,0x14a));var _0xb3d7=function(_0x24e91e,_0x38b947){_0x24e91e=_0x24e91e-0x0;var _0x51252c=_0x3d7b[_0x24e91e];return _0x51252c;};'use strict';var _=require(_0xb3d7('0x0'));var util=require(_0xb3d7('0x1'));var logger=require('../../config/logger')(_0xb3d7('0x2'));var moment=require('moment');var BPromise=require(_0xb3d7('0x3'));var rp=require(_0xb3d7('0x4'));var fs=require('fs');var path=require(_0xb3d7('0x5'));var rimraf=require(_0xb3d7('0x6'));var config=require(_0xb3d7('0x7'));var attributes=require(_0xb3d7('0x8'));module['exports']=function(_0x4ae02c,_0x3df3c6){return _0x4ae02c[_0xb3d7('0x9')](_0xb3d7('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f4d=['request-promise','path','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird'];(function(_0x1af2fd,_0xe1be5c){var _0x132392=function(_0x3f8131){while(--_0x3f8131){_0x1af2fd['push'](_0x1af2fd['shift']());}};_0x132392(++_0xe1be5c);}(_0x1f4d,0xf7));var _0xd1f4=function(_0x9c8839,_0x3ca6bc){_0x9c8839=_0x9c8839-0x0;var _0x52b9c8=_0x1f4d[_0x9c8839];return _0x52b9c8;};'use strict';var _=require(_0xd1f4('0x0'));var util=require(_0xd1f4('0x1'));var logger=require(_0xd1f4('0x2'))(_0xd1f4('0x3'));var moment=require('moment');var BPromise=require(_0xd1f4('0x4'));var rp=require(_0xd1f4('0x5'));var fs=require('fs');var path=require(_0xd1f4('0x6'));var rimraf=require('rimraf');var config=require(_0xd1f4('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xd1f4('0x8')]=function(_0x287225,_0x357e64){return _0x287225[_0xd1f4('0x9')](_0xd1f4('0xa'),attributes,{'tableName':_0xd1f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 9e31cef..a566284 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 _0x9cc3=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9cc3,0x83));var _0x39cc=function(_0x2ab051,_0x368634){_0x2ab051=_0x2ab051-0x0;var _0x3869cb=_0x9cc3[_0x2ab051];return _0x3869cb;};'use strict';var _=require(_0x39cc('0x0'));var util=require(_0x39cc('0x1'));var moment=require(_0x39cc('0x2'));var BPromise=require(_0x39cc('0x3'));var rs=require(_0x39cc('0x4'));var fs=require('fs');var Redis=require(_0x39cc('0x5'));var db=require(_0x39cc('0x6'))['db'];var utils=require(_0x39cc('0x7'));var logger=require('../../config/logger')(_0x39cc('0x8'));var config=require(_0x39cc('0x9'));var jayson=require(_0x39cc('0xa'));var client=jayson[_0x39cc('0xb')][_0x39cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38141e,_0xdec9eb,_0x5e5693){return new BPromise(function(_0x378276,_0x4bde17){return client[_0x39cc('0xd')](_0x38141e,_0x5e5693)[_0x39cc('0xe')](function(_0x4c1009){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xdec9eb,_0x39cc('0xf'));logger[_0x39cc('0x10')](_0x39cc('0x11'),_0xdec9eb,_0x39cc('0xf'),JSON[_0x39cc('0x12')](_0x4c1009));if(_0x4c1009['error']){if(_0x4c1009['error'][_0x39cc('0x13')]===0x1f4){logger[_0x39cc('0x14')](_0x39cc('0x15'),_0xdec9eb,_0x4c1009[_0x39cc('0x14')][_0x39cc('0x16')]);return _0x4bde17(_0x4c1009[_0x39cc('0x14')]['message']);}logger[_0x39cc('0x14')](_0x39cc('0x15'),_0xdec9eb,_0x4c1009['error'][_0x39cc('0x16')]);return _0x378276(_0x4c1009[_0x39cc('0x14')][_0x39cc('0x16')]);}else{logger[_0x39cc('0x17')](_0x39cc('0x15'),_0xdec9eb,_0x39cc('0xf'));_0x378276(_0x4c1009[_0x39cc('0x18')][_0x39cc('0x16')]);}})[_0x39cc('0x19')](function(_0x34e3c3){logger['error'](_0x39cc('0x15'),_0xdec9eb,_0x34e3c3);_0x4bde17(_0x34e3c3);});});} \ No newline at end of file +var _0xea4e=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2542fc,_0x262c59){var _0x5a84e9=function(_0x2d7b62){while(--_0x2d7b62){_0x2542fc['push'](_0x2542fc['shift']());}};_0x5a84e9(++_0x262c59);}(_0xea4e,0xdf));var _0xeea4=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xea4e[_0x5eef05];return _0x56d4b8;};'use strict';var _=require('lodash');var util=require(_0xeea4('0x0'));var moment=require(_0xeea4('0x1'));var BPromise=require(_0xeea4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeea4('0x3'));var db=require(_0xeea4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeea4('0x5'));var config=require('../../config/environment');var jayson=require(_0xeea4('0x6'));var client=jayson[_0xeea4('0x7')][_0xeea4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x212ef3,_0x315689,_0xda53b3){return new BPromise(function(_0x3c2d1f,_0x5cb0c3){return client[_0xeea4('0x9')](_0x212ef3,_0xda53b3)[_0xeea4('0xa')](function(_0x7adca1){logger[_0xeea4('0xb')](_0xeea4('0xc'),_0x315689,'request\x20sent');logger[_0xeea4('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x315689,_0xeea4('0xe'),JSON[_0xeea4('0xf')](_0x7adca1));if(_0x7adca1[_0xeea4('0x10')]){if(_0x7adca1[_0xeea4('0x10')]['code']===0x1f4){logger[_0xeea4('0x10')](_0xeea4('0xc'),_0x315689,_0x7adca1[_0xeea4('0x10')][_0xeea4('0x11')]);return _0x5cb0c3(_0x7adca1['error'][_0xeea4('0x11')]);}logger['error'](_0xeea4('0xc'),_0x315689,_0x7adca1['error'][_0xeea4('0x11')]);return _0x3c2d1f(_0x7adca1[_0xeea4('0x10')][_0xeea4('0x11')]);}else{logger['info'](_0xeea4('0xc'),_0x315689,_0xeea4('0xe'));_0x3c2d1f(_0x7adca1[_0xeea4('0x12')][_0xeea4('0x11')]);}})[_0xeea4('0x13')](function(_0x795c21){logger[_0xeea4('0x10')](_0xeea4('0xc'),_0x315689,_0x795c21);_0x5cb0c3(_0x795c21);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7e67977..134f314 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 _0xa15b=['/:id','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','getQuestions','create','put'];(function(_0x4e120a,_0x596153){var _0x31be74=function(_0x3b4a2e){while(--_0x3b4a2e){_0x4e120a['push'](_0x4e120a['shift']());}};_0x31be74(++_0x596153);}(_0xa15b,0x16b));var _0xba15=function(_0x29118f,_0x26d9e5){_0x29118f=_0x29118f-0x0;var _0x1589dc=_0xa15b[_0x29118f];return _0x1589dc;};'use strict';var multer=require(_0xba15('0x0'));var util=require('util');var path=require(_0xba15('0x1'));var timeout=require(_0xba15('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba15('0x3'));var auth=require(_0xba15('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xba15('0x5')]('/',auth[_0xba15('0x6')](),controller[_0xba15('0x7')]);router['get']('/describe',auth[_0xba15('0x6')](),controller[_0xba15('0x8')]);router['get']('/:id',auth[_0xba15('0x6')](),controller['show']);router[_0xba15('0x5')]('/:id/questions',auth[_0xba15('0x6')](),controller[_0xba15('0x9')]);router['post']('/',auth[_0xba15('0x6')](),controller[_0xba15('0xa')]);router[_0xba15('0xb')](_0xba15('0xc'),auth['isAuthenticated'](),controller[_0xba15('0xd')]);router[_0xba15('0xe')](_0xba15('0xc'),auth[_0xba15('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6457=['/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x6457,0x14e));var _0x7645=function(_0x5d968b,_0x504f2c){_0x5d968b=_0x5d968b-0x0;var _0x1c4b2f=_0x6457[_0x5d968b];return _0x1c4b2f;};'use strict';var multer=require(_0x7645('0x0'));var util=require(_0x7645('0x1'));var path=require(_0x7645('0x2'));var timeout=require('connect-timeout');var express=require(_0x7645('0x3'));var router=express[_0x7645('0x4')]();var fs_extra=require(_0x7645('0x5'));var auth=require(_0x7645('0x6'));var interaction=require(_0x7645('0x7'));var config=require(_0x7645('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x7645('0x9')]('/',auth['isAuthenticated'](),controller[_0x7645('0xa')]);router[_0x7645('0x9')](_0x7645('0xb'),auth[_0x7645('0xc')](),controller[_0x7645('0xd')]);router[_0x7645('0x9')](_0x7645('0xe'),auth['isAuthenticated'](),controller[_0x7645('0xf')]);router[_0x7645('0x9')](_0x7645('0x10'),auth['isAuthenticated'](),controller[_0x7645('0x11')]);router[_0x7645('0x12')]('/',auth[_0x7645('0xc')](),controller[_0x7645('0x13')]);router[_0x7645('0x14')](_0x7645('0xe'),auth[_0x7645('0xc')](),controller[_0x7645('0x15')]);router[_0x7645('0x16')](_0x7645('0xe'),auth[_0x7645('0xc')](),controller[_0x7645('0x17')]);module[_0x7645('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index adf7f54..7b54418 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 _0xb183=['DATE','setDataValue','starttime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x12c542,_0x427d5f){var _0x11db9d=function(_0x59bae3){while(--_0x59bae3){_0x12c542['push'](_0x12c542['shift']());}};_0x11db9d(++_0x427d5f);}(_0xb183,0x1cd));var _0x3b18=function(_0xe4fe90,_0x49f01a){_0xe4fe90=_0xe4fe90-0x0;var _0x194642=_0xb183[_0xe4fe90];return _0x194642;};'use strict';var moment=require(_0x3b18('0x0'));var Sequelize=require(_0x3b18('0x1'));module[_0x3b18('0x2')]={'starttime':{'type':Sequelize[_0x3b18('0x3')],'set':function(_0x48fae7){this[_0x3b18('0x4')](_0x3b18('0x5'),_0x48fae7);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x3b18('0x3')]},'membername':{'type':Sequelize[_0x3b18('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3b18('0x6')]},'uniqueid':{'type':Sequelize[_0x3b18('0x6')]},'calleridname':{'type':Sequelize[_0x3b18('0x6')]},'calleridnum':{'type':Sequelize[_0x3b18('0x6')]},'completed':{'type':Sequelize[_0x3b18('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a8a=['setDataValue','starttime','endtime','format','STRING','moment','sequelize','DATE'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5a8a,0x19d));var _0xa5a8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5a8a[_0x432682];return _0x463d05;};'use strict';var moment=require(_0xa5a8('0x0'));var Sequelize=require(_0xa5a8('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xa5a8('0x2')],'set':function(_0x4983a4){this[_0xa5a8('0x3')](_0xa5a8('0x4'),_0x4983a4);this[_0xa5a8('0x3')](_0xa5a8('0x5'),moment()[_0xa5a8('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa5a8('0x2')]},'membername':{'type':Sequelize[_0xa5a8('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa5a8('0x7')]},'uniqueid':{'type':Sequelize[_0xa5a8('0x7')]},'calleridname':{'type':Sequelize[_0xa5a8('0x7')]},'calleridnum':{'type':Sequelize[_0xa5a8('0x7')]},'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 5b17e68..50a0d71 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 _0x8ca6=['pick','filters','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x41b50e,_0x2ccfa3){var _0x505c89=function(_0x14ec4f){while(--_0x14ec4f){_0x41b50e['push'](_0x41b50e['shift']());}};_0x505c89(++_0x2ccfa3);}(_0x8ca6,0xb0));var _0x68ca=function(_0x4db1f0,_0x53d110){_0x4db1f0=_0x4db1f0-0x0;var _0x5b6fe3=_0x8ca6[_0x4db1f0];return _0x5b6fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68ca('0x0'));var rp=require('request-promise');var moment=require(_0x68ca('0x1'));var BPromise=require(_0x68ca('0x2'));var Mustache=require('mustache');var util=require(_0x68ca('0x3'));var path=require(_0x68ca('0x4'));var sox=require(_0x68ca('0x5'));var csv=require('to-csv');var ejs=require(_0x68ca('0x6'));var fs=require('fs');var fs_extra=require(_0x68ca('0x7'));var _=require('lodash');var squel=require(_0x68ca('0x8'));var crypto=require(_0x68ca('0x9'));var jsforce=require(_0x68ca('0xa'));var deskjs=require(_0x68ca('0xb'));var toCsv=require('to-csv');var querystring=require(_0x68ca('0xc'));var Papa=require(_0x68ca('0xd'));var Redis=require(_0x68ca('0xe'));var authService=require(_0x68ca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68ca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68ca('0x11'));var utils=require(_0x68ca('0x12'));var config=require(_0x68ca('0x13'));var licenseUtil=require(_0x68ca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x575592,_0x26d099){_0x26d099=_0x26d099||0xcc;return function(_0x30666e){if(_0x30666e){return _0x575592[_0x68ca('0x15')](_0x26d099);}return _0x575592[_0x68ca('0x16')](_0x26d099)[_0x68ca('0x17')]();};}function respondWithResult(_0x4801e8,_0xb2c89){_0xb2c89=_0xb2c89||0xc8;return function(_0x3e07b2){if(_0x3e07b2){return _0x4801e8[_0x68ca('0x16')](_0xb2c89)[_0x68ca('0x18')](_0x3e07b2);}};}function respondWithFilteredResult(_0x48e937,_0xd71d14){return function(_0xc21942){if(_0xc21942){var _0x9a066b=typeof _0xd71d14['offset']===_0x68ca('0x19')&&typeof _0xd71d14[_0x68ca('0x1a')]===_0x68ca('0x19');var _0xc17168=_0xc21942[_0x68ca('0x1b')];var _0x31dc2c=_0x9a066b?0x0:_0xd71d14[_0x68ca('0x1c')];var _0xca249b=_0x9a066b?_0xc21942[_0x68ca('0x1b')]:_0xd71d14[_0x68ca('0x1c')]+_0xd71d14[_0x68ca('0x1a')];var _0x13094d;if(_0xca249b>=_0xc17168){_0xca249b=_0xc17168;_0x13094d=0xc8;}else{_0x13094d=0xce;}_0x48e937[_0x68ca('0x16')](_0x13094d);return _0x48e937['set'](_0x68ca('0x1d'),_0x31dc2c+'-'+_0xca249b+'/'+_0xc17168)[_0x68ca('0x18')](_0xc21942);}return null;};}function patchUpdates(_0x5c4d27){return function(_0x4b7130){try{jsonpatch['apply'](_0x4b7130,_0x5c4d27,!![]);}catch(_0x44f3fd){return BPromise['reject'](_0x44f3fd);}return _0x4b7130[_0x68ca('0x1e')]();};}function saveUpdates(_0x1c617c,_0x1c30a3){return function(_0x19f225){if(_0x19f225){return _0x19f225[_0x68ca('0x1f')](_0x1c617c)['then'](function(_0x5d4b3f){return _0x5d4b3f;});}return null;};}function removeEntity(_0x1d2e63,_0x300cb6){return function(_0x2c6c69){if(_0x2c6c69){return _0x2c6c69[_0x68ca('0x20')]()['then'](function(){_0x1d2e63['status'](0xcc)[_0x68ca('0x17')]();});}};}function handleEntityNotFound(_0x4d0684,_0x28290f){return function(_0x3a6a7c){if(!_0x3a6a7c){_0x4d0684[_0x68ca('0x15')](0x194);}return _0x3a6a7c;};}function handleError(_0x117d85,_0x1c8c9d){_0x1c8c9d=_0x1c8c9d||0x1f4;return function(_0xf02729){logger[_0x68ca('0x21')](_0xf02729[_0x68ca('0x22')]);if(_0xf02729[_0x68ca('0x23')]){delete _0xf02729['name'];}_0x117d85['status'](_0x1c8c9d)[_0x68ca('0x24')](_0xf02729);};}exports[_0x68ca('0x25')]=function(_0x5bbe1c,_0xc749db){var _0x181929={},_0x67b29a={},_0x4b01bd={'count':0x0,'rows':[]};var _0xc958b3=_[_0x68ca('0x26')](db[_0x68ca('0x27')]['rawAttributes'],function(_0x4477b4){return{'name':_0x4477b4[_0x68ca('0x28')],'type':_0x4477b4[_0x68ca('0x29')]['key']};});_0x67b29a[_0x68ca('0x2a')]=_[_0x68ca('0x26')](_0xc958b3,_0x68ca('0x23'));_0x67b29a[_0x68ca('0x2b')]=_[_0x68ca('0x2c')](_0x5bbe1c[_0x68ca('0x2b')]);_0x67b29a['filters']=_['intersection'](_0x67b29a[_0x68ca('0x2a')],_0x67b29a['query']);_0x181929[_0x68ca('0x2d')]=_[_0x68ca('0x2e')](_0x67b29a[_0x68ca('0x2a')],qs[_0x68ca('0x2f')](_0x5bbe1c[_0x68ca('0x2b')][_0x68ca('0x2f')]));_0x181929[_0x68ca('0x2d')]=_0x181929[_0x68ca('0x2d')][_0x68ca('0x30')]?_0x181929[_0x68ca('0x2d')]:_0x67b29a[_0x68ca('0x2a')];if(!_0x5bbe1c['query'][_0x68ca('0x31')](_0x68ca('0x32'))){_0x181929[_0x68ca('0x1a')]=qs['limit'](_0x5bbe1c[_0x68ca('0x2b')][_0x68ca('0x1a')]);_0x181929[_0x68ca('0x1c')]=qs[_0x68ca('0x1c')](_0x5bbe1c[_0x68ca('0x2b')]['offset']);}_0x181929['order']=qs[_0x68ca('0x33')](_0x5bbe1c['query'][_0x68ca('0x33')]);_0x181929['where']=qs['filters'](_[_0x68ca('0x34')](_0x5bbe1c[_0x68ca('0x2b')],_0x67b29a[_0x68ca('0x35')]),_0xc958b3);if(_0x5bbe1c[_0x68ca('0x2b')][_0x68ca('0x36')]){_0x181929[_0x68ca('0x37')]=_[_0x68ca('0x38')](_0x181929['where'],{'$or':_[_0x68ca('0x26')](_0xc958b3,function(_0xe14f22){if(_0xe14f22[_0x68ca('0x29')]!==_0x68ca('0x39')){var _0xddb6a1={};_0xddb6a1[_0xe14f22[_0x68ca('0x23')]]={'$like':'%'+_0x5bbe1c[_0x68ca('0x2b')][_0x68ca('0x36')]+'%'};return _0xddb6a1;}})});}_0x181929=_[_0x68ca('0x38')]({},_0x181929,_0x5bbe1c['options']);var _0x2c96c6={'where':_0x181929[_0x68ca('0x37')]};return db['JscriptySessionReport'][_0x68ca('0x1b')](_0x2c96c6)[_0x68ca('0x3a')](function(_0x1c9a3f){_0x4b01bd[_0x68ca('0x1b')]=_0x1c9a3f;if(_0x5bbe1c['query'][_0x68ca('0x3b')]){_0x181929[_0x68ca('0x3c')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x68ca('0x3d')](_0x181929);})[_0x68ca('0x3a')](function(_0x50db0e){_0x4b01bd[_0x68ca('0x3e')]=_0x50db0e;return _0x4b01bd;})[_0x68ca('0x3a')](respondWithFilteredResult(_0xc749db,_0x181929))[_0x68ca('0x3f')](handleError(_0xc749db,null));};exports['show']=function(_0x4bfaee,_0x39897d){var _0x291fa5={'raw':!![],'where':{'id':_0x4bfaee[_0x68ca('0x40')]['id']}},_0x36fb88={};_0x36fb88[_0x68ca('0x2a')]=_[_0x68ca('0x2c')](db[_0x68ca('0x27')][_0x68ca('0x41')]);_0x36fb88[_0x68ca('0x2b')]=_[_0x68ca('0x2c')](_0x4bfaee['query']);_0x36fb88[_0x68ca('0x35')]=_['intersection'](_0x36fb88[_0x68ca('0x2a')],_0x36fb88[_0x68ca('0x2b')]);_0x291fa5['attributes']=_[_0x68ca('0x2e')](_0x36fb88[_0x68ca('0x2a')],qs['fields'](_0x4bfaee['query'][_0x68ca('0x2f')]));_0x291fa5[_0x68ca('0x2d')]=_0x291fa5[_0x68ca('0x2d')]['length']?_0x291fa5['attributes']:_0x36fb88[_0x68ca('0x2a')];if(_0x4bfaee[_0x68ca('0x2b')]['includeAll']){_0x291fa5[_0x68ca('0x3c')]=[{'all':!![]}];}_0x291fa5=_[_0x68ca('0x38')]({},_0x291fa5,_0x4bfaee[_0x68ca('0x42')]);return db[_0x68ca('0x27')][_0x68ca('0x43')](_0x291fa5)[_0x68ca('0x3a')](handleEntityNotFound(_0x39897d,null))[_0x68ca('0x3a')](respondWithResult(_0x39897d,null))['catch'](handleError(_0x39897d,null));};exports['create']=function(_0x51be4b,_0x4617f6){return db[_0x68ca('0x27')][_0x68ca('0x44')](_0x51be4b[_0x68ca('0x45')],{})['then'](respondWithResult(_0x4617f6,0xc9))[_0x68ca('0x3f')](handleError(_0x4617f6,null));};exports[_0x68ca('0x1f')]=function(_0x35ca73,_0x41a881){if(_0x35ca73[_0x68ca('0x45')]['id']){delete _0x35ca73['body']['id'];}return db[_0x68ca('0x27')][_0x68ca('0x43')]({'where':{'id':_0x35ca73[_0x68ca('0x40')]['id']}})['then'](handleEntityNotFound(_0x41a881,null))['then'](saveUpdates(_0x35ca73[_0x68ca('0x45')],null))[_0x68ca('0x3a')](respondWithResult(_0x41a881,null))['catch'](handleError(_0x41a881,null));};exports[_0x68ca('0x20')]=function(_0x326148,_0x11d9f9){return db[_0x68ca('0x27')][_0x68ca('0x43')]({'where':{'id':_0x326148[_0x68ca('0x40')]['id']}})[_0x68ca('0x3a')](handleEntityNotFound(_0x11d9f9,null))['then'](removeEntity(_0x11d9f9,null))[_0x68ca('0x3f')](handleError(_0x11d9f9,null));};exports[_0x68ca('0x46')]=function(_0x3c812d,_0x2a98b9){return db[_0x68ca('0x27')][_0x68ca('0x46')]()['then'](respondWithResult(_0x2a98b9,null))[_0x68ca('0x3f')](handleError(_0x2a98b9,null));};exports[_0x68ca('0x47')]=function(_0x1607d6,_0xac0ee1,_0x2d7bcd){var _0x2e25bb={'raw':!![],'where':{}};var _0x2452e1={};var _0xb92453={'count':0x0,'rows':[]};return db[_0x68ca('0x27')][_0x68ca('0x48')]({'where':{'id':_0x1607d6[_0x68ca('0x40')]['id']}})[_0x68ca('0x3a')](handleEntityNotFound(_0xac0ee1,null))[_0x68ca('0x3a')](function(_0x552782){if(_0x552782){_0x2452e1[_0x68ca('0x2a')]=_['keys'](db[_0x68ca('0x49')]['rawAttributes']);_0x2452e1[_0x68ca('0x2b')]=_[_0x68ca('0x2c')](_0x1607d6[_0x68ca('0x2b')]);_0x2452e1[_0x68ca('0x35')]=_[_0x68ca('0x2e')](_0x2452e1[_0x68ca('0x2a')],_0x2452e1[_0x68ca('0x2b')]);_0x2e25bb[_0x68ca('0x2d')]=_['intersection'](_0x2452e1[_0x68ca('0x2a')],qs['fields'](_0x1607d6[_0x68ca('0x2b')][_0x68ca('0x2f')]));_0x2e25bb[_0x68ca('0x2d')]=_0x2e25bb[_0x68ca('0x2d')][_0x68ca('0x30')]?_0x2e25bb[_0x68ca('0x2d')]:_0x2452e1[_0x68ca('0x2a')];if(!_0x1607d6['query'][_0x68ca('0x31')](_0x68ca('0x32'))){_0x2e25bb[_0x68ca('0x1a')]=qs[_0x68ca('0x1a')](_0x1607d6[_0x68ca('0x2b')][_0x68ca('0x1a')]);_0x2e25bb[_0x68ca('0x1c')]=qs[_0x68ca('0x1c')](_0x1607d6[_0x68ca('0x2b')][_0x68ca('0x1c')]);}_0x2e25bb[_0x68ca('0x4a')]=qs['sort'](_0x1607d6['query'][_0x68ca('0x33')]);_0x2e25bb['where']=qs[_0x68ca('0x35')](_[_0x68ca('0x34')](_0x1607d6['query'],_0x2452e1['filters']));_0x2e25bb[_0x68ca('0x37')][_0x68ca('0x4b')]=_0x552782['id'];if(_0x1607d6[_0x68ca('0x2b')][_0x68ca('0x36')]){_0x2e25bb['where']=_[_0x68ca('0x38')](_0x2e25bb[_0x68ca('0x37')],{'$or':_[_0x68ca('0x26')](_0x2e25bb[_0x68ca('0x2d')],function(_0x22713e){var _0x567ce5={};_0x567ce5[_0x22713e]={'$like':'%'+_0x1607d6['query']['filter']+'%'};return _0x567ce5;})});}_0x2e25bb=_[_0x68ca('0x38')]({},_0x2e25bb,_0x1607d6[_0x68ca('0x42')]);return db[_0x68ca('0x49')][_0x68ca('0x1b')]({'where':_0x2e25bb[_0x68ca('0x37')]})['then'](function(_0x374e19){_0xb92453[_0x68ca('0x1b')]=_0x374e19;if(_0x1607d6['query']['includeAll']){_0x2e25bb[_0x68ca('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x68ca('0x3d')](_0x2e25bb);})[_0x68ca('0x3a')](function(_0x2b7982){_0xb92453['rows']=_0x2b7982;return _0xb92453;});}})[_0x68ca('0x3a')](respondWithFilteredResult(_0xac0ee1,_0x2e25bb))[_0x68ca('0x3f')](handleError(_0xac0ee1,null));}; \ No newline at end of file +var _0x3d25=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','JscriptyQuestionReport','pick','SessionId','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','jsforce','desk.js','to-csv','papaparse','ioredis','../../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','apply','reject','save','update','destroy','then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x5f5777,_0x577d6a){var _0x110317=function(_0x2dc5d7){while(--_0x2dc5d7){_0x5f5777['push'](_0x5f5777['shift']());}};_0x110317(++_0x577d6a);}(_0x3d25,0x1e0));var _0x53d2=function(_0x45bc3f,_0x234416){_0x45bc3f=_0x45bc3f-0x0;var _0x530329=_0x3d25[_0x45bc3f];return _0x530329;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x53d2('0x0'));var rp=require(_0x53d2('0x1'));var moment=require(_0x53d2('0x2'));var BPromise=require(_0x53d2('0x3'));var Mustache=require(_0x53d2('0x4'));var util=require(_0x53d2('0x5'));var path=require(_0x53d2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x53d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53d2('0x8'));var deskjs=require(_0x53d2('0x9'));var toCsv=require(_0x53d2('0xa'));var querystring=require('querystring');var Papa=require(_0x53d2('0xb'));var Redis=require(_0x53d2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x53d2('0xd'));var as=require(_0x53d2('0xe'));var hardwareService=require(_0x53d2('0xf'));var logger=require(_0x53d2('0x10'))(_0x53d2('0x11'));var utils=require(_0x53d2('0x12'));var config=require(_0x53d2('0x13'));var licenseUtil=require(_0x53d2('0x14'));var db=require(_0x53d2('0x15'))['db'];function respondWithStatusCode(_0x31a599,_0x46cf09){_0x46cf09=_0x46cf09||0xcc;return function(_0x26dfbb){if(_0x26dfbb){return _0x31a599[_0x53d2('0x16')](_0x46cf09);}return _0x31a599['status'](_0x46cf09)[_0x53d2('0x17')]();};}function respondWithResult(_0x5539fd,_0x267145){_0x267145=_0x267145||0xc8;return function(_0xd766a8){if(_0xd766a8){return _0x5539fd['status'](_0x267145)[_0x53d2('0x18')](_0xd766a8);}};}function respondWithFilteredResult(_0x265921,_0x54eacb){return function(_0x170e21){if(_0x170e21){var _0x5491ef=typeof _0x54eacb[_0x53d2('0x19')]==='undefined'&&typeof _0x54eacb['limit']===_0x53d2('0x1a');var _0x4aa73e=_0x170e21[_0x53d2('0x1b')];var _0x38e684=_0x5491ef?0x0:_0x54eacb[_0x53d2('0x19')];var _0x1e9f52=_0x5491ef?_0x170e21[_0x53d2('0x1b')]:_0x54eacb['offset']+_0x54eacb[_0x53d2('0x1c')];var _0x54ee41;if(_0x1e9f52>=_0x4aa73e){_0x1e9f52=_0x4aa73e;_0x54ee41=0xc8;}else{_0x54ee41=0xce;}_0x265921[_0x53d2('0x1d')](_0x54ee41);return _0x265921['set']('Content-Range',_0x38e684+'-'+_0x1e9f52+'/'+_0x4aa73e)[_0x53d2('0x18')](_0x170e21);}return null;};}function patchUpdates(_0x106a65){return function(_0xfca310){try{jsonpatch[_0x53d2('0x1e')](_0xfca310,_0x106a65,!![]);}catch(_0x349c88){return BPromise[_0x53d2('0x1f')](_0x349c88);}return _0xfca310[_0x53d2('0x20')]();};}function saveUpdates(_0xa99c20,_0x4e4245){return function(_0xd7c3e7){if(_0xd7c3e7){return _0xd7c3e7[_0x53d2('0x21')](_0xa99c20)['then'](function(_0x2e683b){return _0x2e683b;});}return null;};}function removeEntity(_0x579cc3,_0x4e364b){return function(_0x2aecd5){if(_0x2aecd5){return _0x2aecd5[_0x53d2('0x22')]()[_0x53d2('0x23')](function(){_0x579cc3[_0x53d2('0x1d')](0xcc)[_0x53d2('0x17')]();});}};}function handleEntityNotFound(_0x24f017,_0x3cb77d){return function(_0x5379df){if(!_0x5379df){_0x24f017[_0x53d2('0x16')](0x194);}return _0x5379df;};}function handleError(_0x2ef85c,_0x5929e7){_0x5929e7=_0x5929e7||0x1f4;return function(_0x32eb86){logger[_0x53d2('0x24')](_0x32eb86['stack']);if(_0x32eb86[_0x53d2('0x25')]){delete _0x32eb86[_0x53d2('0x25')];}_0x2ef85c['status'](_0x5929e7)[_0x53d2('0x26')](_0x32eb86);};}exports[_0x53d2('0x27')]=function(_0x14ac43,_0x452aa2){var _0x1cd678={},_0x279856={},_0x3d9270={'count':0x0,'rows':[]};var _0x5354c9=_[_0x53d2('0x28')](db[_0x53d2('0x29')][_0x53d2('0x2a')],function(_0x4c0a4f){return{'name':_0x4c0a4f[_0x53d2('0x2b')],'type':_0x4c0a4f[_0x53d2('0x2c')]['key']};});_0x279856[_0x53d2('0x2d')]=_[_0x53d2('0x28')](_0x5354c9,_0x53d2('0x25'));_0x279856['query']=_[_0x53d2('0x2e')](_0x14ac43['query']);_0x279856[_0x53d2('0x2f')]=_['intersection'](_0x279856['model'],_0x279856['query']);_0x1cd678['attributes']=_[_0x53d2('0x30')](_0x279856[_0x53d2('0x2d')],qs[_0x53d2('0x31')](_0x14ac43[_0x53d2('0x32')]['fields']));_0x1cd678[_0x53d2('0x33')]=_0x1cd678[_0x53d2('0x33')][_0x53d2('0x34')]?_0x1cd678['attributes']:_0x279856[_0x53d2('0x2d')];if(!_0x14ac43[_0x53d2('0x32')][_0x53d2('0x35')](_0x53d2('0x36'))){_0x1cd678['limit']=qs[_0x53d2('0x1c')](_0x14ac43[_0x53d2('0x32')][_0x53d2('0x1c')]);_0x1cd678['offset']=qs[_0x53d2('0x19')](_0x14ac43['query'][_0x53d2('0x19')]);}_0x1cd678[_0x53d2('0x37')]=qs[_0x53d2('0x38')](_0x14ac43[_0x53d2('0x32')][_0x53d2('0x38')]);_0x1cd678[_0x53d2('0x39')]=qs[_0x53d2('0x2f')](_['pick'](_0x14ac43[_0x53d2('0x32')],_0x279856[_0x53d2('0x2f')]),_0x5354c9);if(_0x14ac43['query'][_0x53d2('0x3a')]){_0x1cd678[_0x53d2('0x39')]=_[_0x53d2('0x3b')](_0x1cd678[_0x53d2('0x39')],{'$or':_[_0x53d2('0x28')](_0x5354c9,function(_0x1f3971){if(_0x1f3971['type']!==_0x53d2('0x3c')){var _0x55c90c={};_0x55c90c[_0x1f3971['name']]={'$like':'%'+_0x14ac43[_0x53d2('0x32')]['filter']+'%'};return _0x55c90c;}})});}_0x1cd678=_['merge']({},_0x1cd678,_0x14ac43[_0x53d2('0x3d')]);var _0x5e9960={'where':_0x1cd678[_0x53d2('0x39')]};return db[_0x53d2('0x29')][_0x53d2('0x1b')](_0x5e9960)[_0x53d2('0x23')](function(_0x412a3e){_0x3d9270[_0x53d2('0x1b')]=_0x412a3e;if(_0x14ac43['query'][_0x53d2('0x3e')]){_0x1cd678[_0x53d2('0x3f')]=[{'all':!![]}];}return db[_0x53d2('0x29')][_0x53d2('0x40')](_0x1cd678);})['then'](function(_0x4d202c){_0x3d9270[_0x53d2('0x41')]=_0x4d202c;return _0x3d9270;})[_0x53d2('0x23')](respondWithFilteredResult(_0x452aa2,_0x1cd678))[_0x53d2('0x42')](handleError(_0x452aa2,null));};exports[_0x53d2('0x43')]=function(_0x2dab8f,_0x5be482){var _0x4ff9cb={'raw':!![],'where':{'id':_0x2dab8f[_0x53d2('0x44')]['id']}},_0x5a2ea9={};_0x5a2ea9[_0x53d2('0x2d')]=_[_0x53d2('0x2e')](db[_0x53d2('0x29')]['rawAttributes']);_0x5a2ea9['query']=_[_0x53d2('0x2e')](_0x2dab8f['query']);_0x5a2ea9[_0x53d2('0x2f')]=_[_0x53d2('0x30')](_0x5a2ea9[_0x53d2('0x2d')],_0x5a2ea9[_0x53d2('0x32')]);_0x4ff9cb[_0x53d2('0x33')]=_['intersection'](_0x5a2ea9[_0x53d2('0x2d')],qs['fields'](_0x2dab8f['query']['fields']));_0x4ff9cb[_0x53d2('0x33')]=_0x4ff9cb['attributes'][_0x53d2('0x34')]?_0x4ff9cb[_0x53d2('0x33')]:_0x5a2ea9[_0x53d2('0x2d')];if(_0x2dab8f[_0x53d2('0x32')]['includeAll']){_0x4ff9cb[_0x53d2('0x3f')]=[{'all':!![]}];}_0x4ff9cb=_['merge']({},_0x4ff9cb,_0x2dab8f['options']);return db[_0x53d2('0x29')][_0x53d2('0x45')](_0x4ff9cb)[_0x53d2('0x23')](handleEntityNotFound(_0x5be482,null))[_0x53d2('0x23')](respondWithResult(_0x5be482,null))[_0x53d2('0x42')](handleError(_0x5be482,null));};exports['create']=function(_0x1e63e6,_0x5dde1f){return db[_0x53d2('0x29')][_0x53d2('0x46')](_0x1e63e6[_0x53d2('0x47')],{})[_0x53d2('0x23')](respondWithResult(_0x5dde1f,0xc9))[_0x53d2('0x42')](handleError(_0x5dde1f,null));};exports['update']=function(_0x3141df,_0x36abd5){if(_0x3141df[_0x53d2('0x47')]['id']){delete _0x3141df['body']['id'];}return db[_0x53d2('0x29')][_0x53d2('0x45')]({'where':{'id':_0x3141df[_0x53d2('0x44')]['id']}})[_0x53d2('0x23')](handleEntityNotFound(_0x36abd5,null))['then'](saveUpdates(_0x3141df['body'],null))[_0x53d2('0x23')](respondWithResult(_0x36abd5,null))['catch'](handleError(_0x36abd5,null));};exports['destroy']=function(_0x44e163,_0x29f415){return db[_0x53d2('0x29')]['find']({'where':{'id':_0x44e163['params']['id']}})[_0x53d2('0x23')](handleEntityNotFound(_0x29f415,null))[_0x53d2('0x23')](removeEntity(_0x29f415,null))[_0x53d2('0x42')](handleError(_0x29f415,null));};exports[_0x53d2('0x48')]=function(_0x4d34d7,_0x127431){return db[_0x53d2('0x29')][_0x53d2('0x48')]()['then'](respondWithResult(_0x127431,null))[_0x53d2('0x42')](handleError(_0x127431,null));};exports[_0x53d2('0x49')]=function(_0x3f7092,_0x354870,_0x3fc8a5){var _0x56abd7={'raw':!![],'where':{}};var _0x23c03e={};var _0x19b8a4={'count':0x0,'rows':[]};return db[_0x53d2('0x29')]['findOne']({'where':{'id':_0x3f7092[_0x53d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x354870,null))[_0x53d2('0x23')](function(_0x174548){if(_0x174548){_0x23c03e[_0x53d2('0x2d')]=_['keys'](db[_0x53d2('0x4a')][_0x53d2('0x2a')]);_0x23c03e[_0x53d2('0x32')]=_[_0x53d2('0x2e')](_0x3f7092[_0x53d2('0x32')]);_0x23c03e[_0x53d2('0x2f')]=_[_0x53d2('0x30')](_0x23c03e[_0x53d2('0x2d')],_0x23c03e[_0x53d2('0x32')]);_0x56abd7[_0x53d2('0x33')]=_[_0x53d2('0x30')](_0x23c03e[_0x53d2('0x2d')],qs[_0x53d2('0x31')](_0x3f7092['query'][_0x53d2('0x31')]));_0x56abd7[_0x53d2('0x33')]=_0x56abd7[_0x53d2('0x33')]['length']?_0x56abd7[_0x53d2('0x33')]:_0x23c03e[_0x53d2('0x2d')];if(!_0x3f7092[_0x53d2('0x32')][_0x53d2('0x35')](_0x53d2('0x36'))){_0x56abd7['limit']=qs[_0x53d2('0x1c')](_0x3f7092[_0x53d2('0x32')][_0x53d2('0x1c')]);_0x56abd7[_0x53d2('0x19')]=qs[_0x53d2('0x19')](_0x3f7092[_0x53d2('0x32')]['offset']);}_0x56abd7[_0x53d2('0x37')]=qs['sort'](_0x3f7092[_0x53d2('0x32')][_0x53d2('0x38')]);_0x56abd7[_0x53d2('0x39')]=qs[_0x53d2('0x2f')](_[_0x53d2('0x4b')](_0x3f7092[_0x53d2('0x32')],_0x23c03e[_0x53d2('0x2f')]));_0x56abd7['where'][_0x53d2('0x4c')]=_0x174548['id'];if(_0x3f7092[_0x53d2('0x32')]['filter']){_0x56abd7['where']=_[_0x53d2('0x3b')](_0x56abd7[_0x53d2('0x39')],{'$or':_[_0x53d2('0x28')](_0x56abd7[_0x53d2('0x33')],function(_0x5508a8){var _0x5c3ccd={};_0x5c3ccd[_0x5508a8]={'$like':'%'+_0x3f7092[_0x53d2('0x32')][_0x53d2('0x3a')]+'%'};return _0x5c3ccd;})});}_0x56abd7=_[_0x53d2('0x3b')]({},_0x56abd7,_0x3f7092[_0x53d2('0x3d')]);return db[_0x53d2('0x4a')]['count']({'where':_0x56abd7[_0x53d2('0x39')]})[_0x53d2('0x23')](function(_0x42b38d){_0x19b8a4[_0x53d2('0x1b')]=_0x42b38d;if(_0x3f7092['query']['includeAll']){_0x56abd7[_0x53d2('0x3f')]=[{'all':!![]}];}return db[_0x53d2('0x4a')]['findAll'](_0x56abd7);})[_0x53d2('0x23')](function(_0x313a47){_0x19b8a4['rows']=_0x313a47;return _0x19b8a4;});}})[_0x53d2('0x23')](respondWithFilteredResult(_0x354870,_0x56abd7))['catch'](handleError(_0x354870,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 9b47129..c0f475e 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 _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5e8c35,_0x158b3a){_0x5e8c35=_0x5e8c35-0x0;var _0x546803=_0x3baf[_0x5e8c35];return _0x546803;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['JscriptySessionReport','util','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x18c11f,_0x58c569){var _0x10e9d6=function(_0x7b7848){while(--_0x7b7848){_0x18c11f['push'](_0x18c11f['shift']());}};_0x10e9d6(++_0x58c569);}(_0x81c6,0x1d5));var _0x681c=function(_0x23d160,_0x15e4dc){_0x23d160=_0x23d160-0x0;var _0x5df430=_0x81c6[_0x23d160];return _0x5df430;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_jscripty_sessions','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 3769368..3101eab 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x16ed44,_0xf6a568){var _0xe99b78=function(_0x4b78ea){while(--_0x4b78ea){_0x16ed44['push'](_0x16ed44['shift']());}};_0xe99b78(++_0xf6a568);}(_0xba34,0x119));var _0x4ba3=function(_0xf1b173,_0x466b71){_0xf1b173=_0xf1b173-0x0;var _0x5d1fca=_0xba34[_0xf1b173];return _0x5d1fca;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0x8aad=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0xe0e9ad,_0x5af9cf){var _0x1ae462=function(_0x3883af){while(--_0x3883af){_0xe0e9ad['push'](_0xe0e9ad['shift']());}};_0x1ae462(++_0x5af9cf);}(_0x8aad,0x146));var _0xd8aa=function(_0xe8e3c,_0x3ead2d){_0xe8e3c=_0xe8e3c-0x0;var _0x5d3fc1=_0x8aad[_0xe8e3c];return _0x5d3fc1;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index aff1e62..860f3c9 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 _0x8f9e=['put','/:id','isAuthenticated','exports','multer','util','connect-timeout','express','../../components/interaction/service','./license.controller','get','index'];(function(_0x5d8d79,_0x24a214){var _0x304a8c=function(_0x33afff){while(--_0x33afff){_0x5d8d79['push'](_0x5d8d79['shift']());}};_0x304a8c(++_0x24a214);}(_0x8f9e,0x160));var _0xe8f9=function(_0x5636e0,_0x274670){_0x5636e0=_0x5636e0-0x0;var _0x106770=_0x8f9e[_0x5636e0];return _0x106770;};'use strict';var multer=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var path=require('path');var timeout=require(_0xe8f9('0x2'));var express=require(_0xe8f9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe8f9('0x4'));var config=require('../../config/environment');var controller=require(_0xe8f9('0x5'));router[_0xe8f9('0x6')]('/',controller[_0xe8f9('0x7')]);router[_0xe8f9('0x8')](_0xe8f9('0x9'),auth[_0xe8f9('0xa')](),controller['update']);module[_0xe8f9('0xb')]=router; \ No newline at end of file +var _0x394e=['./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x394e,0x88));var _0xe394=function(_0x264659,_0x197677){_0x264659=_0x264659-0x0;var _0x1ac1a9=_0x394e[_0x264659];return _0x1ac1a9;};'use strict';var multer=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var path=require('path');var timeout=require(_0xe394('0x2'));var express=require(_0xe394('0x3'));var router=express[_0xe394('0x4')]();var fs_extra=require(_0xe394('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var controller=require(_0xe394('0x8'));router[_0xe394('0x9')]('/',controller[_0xe394('0xa')]);router[_0xe394('0xb')](_0xe394('0xc'),auth[_0xe394('0xd')](),controller[_0xe394('0xe')]);module[_0xe394('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 6c573f4..ef310eb 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 _0x533b=['exports','STRING','INTEGER','sequelize'];(function(_0x33f3f8,_0x51b47a){var _0x2122db=function(_0x52fa7e){while(--_0x52fa7e){_0x33f3f8['push'](_0x33f3f8['shift']());}};_0x2122db(++_0x51b47a);}(_0x533b,0x107));var _0xb533=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x533b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb533('0x0'));module[_0xb533('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xb533('0x2')]},'data2':{'type':Sequelize[_0xb533('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xb533('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x62f4=['STRING','sequelize','TEXT'];(function(_0x46f2e5,_0x2f8ae6){var _0x5e8c34=function(_0x254a70){while(--_0x254a70){_0x46f2e5['push'](_0x46f2e5['shift']());}};_0x5e8c34(++_0x2f8ae6);}(_0x62f4,0xc4));var _0x462f=function(_0x1ab6c5,_0x42c96f){_0x1ab6c5=_0x1ab6c5-0x0;var _0x2c222d=_0x62f4[_0x1ab6c5];return _0x2c222d;};'use strict';var Sequelize=require(_0x462f('0x0'));module['exports']={'license':{'type':Sequelize[_0x462f('0x1')]},'data1':{'type':Sequelize[_0x462f('0x2')]},'data2':{'type':Sequelize[_0x462f('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f0a6282..1099350 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 _0x5fc3=['mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','model','keys','License','query','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x5fc3[_0x11ce46];return _0x368a1e;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}var utilLicense=require('../../config/license/util');exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={'raw':!![],'where':{'id':0x1}},_0x3735da={};_0x3735da[_0x35fc('0x29')]=_[_0x35fc('0x2a')](db[_0x35fc('0x2b')]['rawAttributes']);_0x3735da[_0x35fc('0x2c')]=_[_0x35fc('0x2a')](_0x645eac[_0x35fc('0x2c')]);_0x3735da['filters']=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],_0x3735da[_0x35fc('0x2c')]);_0x9f3c8a[_0x35fc('0x2e')]=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],qs[_0x35fc('0x2f')](_0x645eac[_0x35fc('0x2c')][_0x35fc('0x2f')]));_0x9f3c8a[_0x35fc('0x2e')]=_0x9f3c8a['attributes']['length']?_0x9f3c8a[_0x35fc('0x2e')]:_0x3735da['model'];_0x9f3c8a=_[_0x35fc('0x30')]({},_0x9f3c8a,_0x645eac[_0x35fc('0x31')]);return utilLicense[_0x35fc('0x32')](_0x9f3c8a)[_0x35fc('0x24')](respondWithResult(_0x383837,null))[_0x35fc('0x33')](handleError(_0x383837,null));};exports[_0x35fc('0x23')]=function(_0x4e43b4,_0x3fe193){if(_0x4e43b4[_0x35fc('0x34')]['id']){delete _0x4e43b4[_0x35fc('0x34')]['id'];}return db[_0x35fc('0x2b')][_0x35fc('0x35')]({'where':{'id':_0x4e43b4[_0x35fc('0x36')]['id']}})['then'](handleEntityNotFound(_0x3fe193,null))[_0x35fc('0x24')](function(_0x38193d){var _0x1fecdf=_0x38193d['get']({'plain':!![]});return utilLicense[_0x35fc('0x37')](_0x1fecdf,_0x4e43b4['body'][_0x35fc('0x38')]);})[_0x35fc('0x24')](function(_0x266a11){if(!_0x266a11[_0x35fc('0x39')]){return saveUpdates(_0x4e43b4['body'],null);}return _0x266a11;})['then'](respondWithResult(_0x3fe193,null))['catch'](handleError(_0x3fe193,null));}; \ No newline at end of file +var _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x472f91,_0x2c1349){var _0x10e363=function(_0x172f90){while(--_0x172f90){_0x472f91['push'](_0x472f91['shift']());}};_0x10e363(++_0x2c1349);}(_0xabce,0x103));var _0xeabc=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xabce[_0x5317b5];return _0x3b7ce2;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c04604e..e60f728 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 _0x7592=['exports','define','license','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./license.attributes'];(function(_0x34369b,_0x4b2e1c){var _0x2f6482=function(_0x3c5132){while(--_0x3c5132){_0x34369b['push'](_0x34369b['shift']());}};_0x2f6482(++_0x4b2e1c);}(_0x7592,0xe9));var _0x2759=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x7592[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x2759('0x0'));var util=require('util');var logger=require(_0x2759('0x1'))(_0x2759('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2759('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2759('0x4'));var config=require(_0x2759('0x5'));var attributes=require(_0x2759('0x6'));module[_0x2759('0x7')]=function(_0x27a7b9,_0x45232c){return _0x27a7b9[_0x2759('0x8')]('License',attributes,{'tableName':_0x2759('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1133=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','License','license','lodash'];(function(_0x4d471b,_0x281167){var _0x54fd9b=function(_0x4d85b0){while(--_0x4d85b0){_0x4d471b['push'](_0x4d471b['shift']());}};_0x54fd9b(++_0x281167);}(_0x1133,0xfc));var _0x3113=function(_0x1706aa,_0x38137e){_0x1706aa=_0x1706aa-0x0;var _0x5e9431=_0x1133[_0x1706aa];return _0x5e9431;};'use strict';var _=require(_0x3113('0x0'));var util=require(_0x3113('0x1'));var logger=require('../../config/logger')(_0x3113('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3113('0x3'));var fs=require('fs');var path=require(_0x3113('0x4'));var rimraf=require(_0x3113('0x5'));var config=require(_0x3113('0x6'));var attributes=require('./license.attributes');module[_0x3113('0x7')]=function(_0x3ef1fa,_0x1f8936){return _0x3ef1fa[_0x3113('0x8')](_0x3113('0x9'),attributes,{'tableName':_0x3113('0xa'),'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 2901cbf..3de3a21 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 _0x3113=['code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error'];(function(_0xda0256,_0x2b77ce){var _0x1c9ff5=function(_0x378d85){while(--_0x378d85){_0xda0256['push'](_0xda0256['shift']());}};_0x1c9ff5(++_0x2b77ce);}(_0x3113,0xe0));var _0x3311=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3113[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3311('0x0'));var moment=require(_0x3311('0x1'));var BPromise=require('bluebird');var rs=require(_0x3311('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3311('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3311('0x4'))(_0x3311('0x5'));var config=require(_0x3311('0x6'));var jayson=require(_0x3311('0x7'));var client=jayson[_0x3311('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae37f,_0x5c3d4e,_0x3ac5ae){return new BPromise(function(_0x57bd69,_0x5ed1c1){return client[_0x3311('0x9')](_0x2ae37f,_0x3ac5ae)[_0x3311('0xa')](function(_0x42162d){logger[_0x3311('0xb')](_0x3311('0xc'),_0x5c3d4e,_0x3311('0xd'));logger['debug'](_0x3311('0xe'),_0x5c3d4e,'request\x20sent',JSON['stringify'](_0x42162d));if(_0x42162d[_0x3311('0xf')]){if(_0x42162d[_0x3311('0xf')][_0x3311('0x10')]===0x1f4){logger[_0x3311('0xf')](_0x3311('0xc'),_0x5c3d4e,_0x42162d['error'][_0x3311('0x11')]);return _0x5ed1c1(_0x42162d['error'][_0x3311('0x11')]);}logger[_0x3311('0xf')](_0x3311('0xc'),_0x5c3d4e,_0x42162d[_0x3311('0xf')][_0x3311('0x11')]);return _0x57bd69(_0x42162d[_0x3311('0xf')]['message']);}else{logger[_0x3311('0xb')](_0x3311('0xc'),_0x5c3d4e,_0x3311('0xd'));_0x57bd69(_0x42162d[_0x3311('0x12')][_0x3311('0x11')]);}})[_0x3311('0x13')](function(_0x2a9e8d){logger[_0x3311('0xf')](_0x3311('0xc'),_0x5c3d4e,_0x2a9e8d);_0x5ed1c1(_0x2a9e8d);});});} \ No newline at end of file +var _0xf3b7=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message'];(function(_0x321ff5,_0x4aa227){var _0x370a32=function(_0x1b2d06){while(--_0x1b2d06){_0x321ff5['push'](_0x321ff5['shift']());}};_0x370a32(++_0x4aa227);}(_0xf3b7,0x144));var _0x7f3b=function(_0x9ace85,_0x405e2d){_0x9ace85=_0x9ace85-0x0;var _0x51e80b=_0xf3b7[_0x9ace85];return _0x51e80b;};'use strict';var _=require(_0x7f3b('0x0'));var util=require(_0x7f3b('0x1'));var moment=require(_0x7f3b('0x2'));var BPromise=require(_0x7f3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f3b('0x4'))['db'];var utils=require(_0x7f3b('0x5'));var logger=require(_0x7f3b('0x6'))(_0x7f3b('0x7'));var config=require(_0x7f3b('0x8'));var jayson=require(_0x7f3b('0x9'));var client=jayson['client'][_0x7f3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29acab,_0x231e55,_0x50c68c){return new BPromise(function(_0x123113,_0x2cefd0){return client[_0x7f3b('0xb')](_0x29acab,_0x50c68c)[_0x7f3b('0xc')](function(_0x5518a8){logger[_0x7f3b('0xd')]('License,\x20%s,\x20%s',_0x231e55,'request\x20sent');logger[_0x7f3b('0xe')](_0x7f3b('0xf'),_0x231e55,_0x7f3b('0x10'),JSON['stringify'](_0x5518a8));if(_0x5518a8['error']){if(_0x5518a8[_0x7f3b('0x11')][_0x7f3b('0x12')]===0x1f4){logger[_0x7f3b('0x11')](_0x7f3b('0x13'),_0x231e55,_0x5518a8[_0x7f3b('0x11')][_0x7f3b('0x14')]);return _0x2cefd0(_0x5518a8[_0x7f3b('0x11')][_0x7f3b('0x14')]);}logger[_0x7f3b('0x11')](_0x7f3b('0x13'),_0x231e55,_0x5518a8[_0x7f3b('0x11')][_0x7f3b('0x14')]);return _0x123113(_0x5518a8['error'][_0x7f3b('0x14')]);}else{logger[_0x7f3b('0xd')](_0x7f3b('0x13'),_0x231e55,_0x7f3b('0x10'));_0x123113(_0x5518a8[_0x7f3b('0x15')][_0x7f3b('0x14')]);}})[_0x7f3b('0x16')](function(_0x431457){logger[_0x7f3b('0x11')](_0x7f3b('0x13'),_0x231e55,_0x431457);_0x2cefd0(_0x431457);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0e8aba2..71d55ec 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 _0xbed7=['send','addAgents','put','update','delete','removeDispositions','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/send'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0xbed7,0x14b));var _0x7bed=function(_0x2f93e4,_0x42d9f6){_0x2f93e4=_0x2f93e4-0x0;var _0x1ad645=_0xbed7[_0x2f93e4];return _0x1ad645;};'use strict';var multer=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var path=require(_0x7bed('0x2'));var timeout=require(_0x7bed('0x3'));var express=require(_0x7bed('0x4'));var router=express['Router']();var fs_extra=require(_0x7bed('0x5'));var auth=require(_0x7bed('0x6'));var interaction=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var controller=require(_0x7bed('0x9'));router[_0x7bed('0xa')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xc')]);router[_0x7bed('0xa')]('/describe',auth[_0x7bed('0xb')](),controller[_0x7bed('0xd')]);router['get'](_0x7bed('0xe'),auth[_0x7bed('0xb')](),controller['show']);router[_0x7bed('0xa')](_0x7bed('0xf'),auth['isAuthenticated'](),controller[_0x7bed('0x10')]);router[_0x7bed('0xa')](_0x7bed('0x11'),auth[_0x7bed('0xb')](),controller['getAnswers']);router[_0x7bed('0xa')](_0x7bed('0x12'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x13')]);router[_0x7bed('0xa')](_0x7bed('0x14'),auth['isAuthenticated'](),controller[_0x7bed('0x15')]);router[_0x7bed('0xa')](_0x7bed('0x16'),auth[_0x7bed('0xb')](),controller['getInteractions']);router[_0x7bed('0xa')](_0x7bed('0x17'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x18')]);router[_0x7bed('0xa')](_0x7bed('0x19'),auth[_0x7bed('0xb')](),controller['getMessages']);router['get'](_0x7bed('0x1a'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x1b')]);router[_0x7bed('0xa')](_0x7bed('0x1c'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x1d')]);router[_0x7bed('0x1e')](_0x7bed('0xf'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x1f')]);router[_0x7bed('0x1e')]('/:id/canned_answers',auth[_0x7bed('0xb')](),controller[_0x7bed('0x20')]);router[_0x7bed('0x1e')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0x21')]);router[_0x7bed('0x1e')](_0x7bed('0x12'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x22')]);router[_0x7bed('0x1e')](_0x7bed('0x14'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x23')]);router[_0x7bed('0x1e')](_0x7bed('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x7bed('0xb')](),controller['addApplications']);router[_0x7bed('0x1e')](_0x7bed('0x24'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x25')]);router['post'](_0x7bed('0x1c'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x26')]);router[_0x7bed('0x27')](_0x7bed('0xe'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x28')]);router[_0x7bed('0x29')]('/:id/dispositions',auth[_0x7bed('0xb')](),controller[_0x7bed('0x2a')]);router[_0x7bed('0x29')]('/:id/canned_answers',auth[_0x7bed('0xb')](),controller['removeAnswers']);router[_0x7bed('0x29')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0x7bed('0x29')](_0x7bed('0x14'),auth['isAuthenticated'](),controller[_0x7bed('0x2b')]);router[_0x7bed('0x29')](_0x7bed('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x7bed('0x29')](_0x7bed('0x1c'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x2c')]);module[_0x7bed('0x2d')]=router; \ No newline at end of file +var _0x918e=['removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','addDisposition','/:id/canned_answers','addAnswer','post','/:id/in_servers','addImap','addSmtp','addInteraction','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x57b194,_0x5742aa){var _0x53c12=function(_0x3befc5){while(--_0x3befc5){_0x57b194['push'](_0x57b194['shift']());}};_0x53c12(++_0x5742aa);}(_0x918e,0x17b));var _0xe918=function(_0x45e635,_0x376349){_0x45e635=_0x45e635-0x0;var _0x32e70e=_0x918e[_0x45e635];return _0x32e70e;};'use strict';var multer=require(_0xe918('0x0'));var util=require(_0xe918('0x1'));var path=require(_0xe918('0x2'));var timeout=require(_0xe918('0x3'));var express=require(_0xe918('0x4'));var router=express[_0xe918('0x5')]();var fs_extra=require(_0xe918('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe918('0x7'));var config=require(_0xe918('0x8'));var controller=require('./mailAccount.controller');router[_0xe918('0x9')]('/',auth[_0xe918('0xa')](),controller[_0xe918('0xb')]);router[_0xe918('0x9')](_0xe918('0xc'),auth[_0xe918('0xa')](),controller['describe']);router[_0xe918('0x9')]('/:id',auth[_0xe918('0xa')](),controller[_0xe918('0xd')]);router[_0xe918('0x9')](_0xe918('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe918('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe918('0xf')]);router[_0xe918('0x9')]('/:id/in_servers',auth[_0xe918('0xa')](),controller[_0xe918('0x10')]);router[_0xe918('0x9')](_0xe918('0x11'),auth[_0xe918('0xa')](),controller[_0xe918('0x12')]);router[_0xe918('0x9')](_0xe918('0x13'),auth[_0xe918('0xa')](),controller[_0xe918('0x14')]);router['get'](_0xe918('0x15'),auth[_0xe918('0xa')](),controller[_0xe918('0x16')]);router[_0xe918('0x9')](_0xe918('0x17'),auth[_0xe918('0xa')](),controller[_0xe918('0x18')]);router[_0xe918('0x9')]('/:id/verify',auth[_0xe918('0xa')](),controller['verifySmtp']);router[_0xe918('0x9')](_0xe918('0x19'),auth['isAuthenticated'](),controller[_0xe918('0x1a')]);router['post']('/:id/dispositions',auth[_0xe918('0xa')](),controller[_0xe918('0x1b')]);router['post'](_0xe918('0x1c'),auth['isAuthenticated'](),controller[_0xe918('0x1d')]);router[_0xe918('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe918('0x1e')](_0xe918('0x1f'),auth[_0xe918('0xa')](),controller[_0xe918('0x20')]);router[_0xe918('0x1e')](_0xe918('0x11'),auth['isAuthenticated'](),controller[_0xe918('0x21')]);router[_0xe918('0x1e')]('/:id/interactions',auth[_0xe918('0xa')](),controller[_0xe918('0x22')]);router[_0xe918('0x1e')](_0xe918('0x15'),auth[_0xe918('0xa')](),controller['addApplications']);router['post']('/:id/send',auth[_0xe918('0xa')](),controller[_0xe918('0x23')]);router['post'](_0xe918('0x19'),auth[_0xe918('0xa')](),controller[_0xe918('0x24')]);router[_0xe918('0x25')](_0xe918('0x26'),auth['isAuthenticated'](),controller[_0xe918('0x27')]);router[_0xe918('0x28')]('/:id/dispositions',auth[_0xe918('0xa')](),controller[_0xe918('0x29')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe918('0x2a')]);router[_0xe918('0x28')]('/:id/in_servers',auth[_0xe918('0xa')](),controller[_0xe918('0x2b')]);router['delete'](_0xe918('0x11'),auth[_0xe918('0xa')](),controller[_0xe918('0x2c')]);router['delete'](_0xe918('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0xe918('0x28')](_0xe918('0x19'),auth[_0xe918('0xa')](),controller[_0xe918('0x2d')]);module[_0xe918('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4f49e89..2d68194 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 _0x1354=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x1354,0x95));var _0x4135=function(_0x1d0b74,_0x2b9295){_0x1d0b74=_0x1d0b74-0x0;var _0x1c18e7=_0x1354[_0x1d0b74];return _0x1c18e7;};'use strict';var Sequelize=require(_0x4135('0x0'));module[_0x4135('0x1')]={'description':{'type':Sequelize[_0x4135('0x2')]},'name':{'type':Sequelize[_0x4135('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4135('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4135('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x4135('0x4')]},'markAsUnread':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4135('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4135('0x5')](0x2)[_0x4135('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4135('0x7');}},'notificationSound':{'type':Sequelize[_0x4135('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4135('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4135('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x4135('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4135('0x9'),'set':function(_0x5a7014){if(!_0x5a7014)this['setDataValue'](_0x4135('0xa'),null);this[_0x4135('0xb')](_0x4135('0xc'),_0x5a7014);}}}; \ No newline at end of file +var _0x66fa=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5ce074,_0x383b63){var _0x231c06=function(_0x3e36e5){while(--_0x3e36e5){_0x5ce074['push'](_0x5ce074['shift']());}};_0x231c06(++_0x383b63);}(_0x66fa,0x168));var _0xa66f=function(_0x208806,_0x43eda7){_0x208806=_0x208806-0x0;var _0x3ccd2b=_0x66fa[_0x208806];return _0x3ccd2b;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'description':{'type':Sequelize[_0xa66f('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa66f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa66f('0x4')]},'markAsUnread':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![],'defaultValue':_0xa66f('0x5')},'fontSize':{'type':Sequelize[_0xa66f('0x6')](0x2)[_0xa66f('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa66f('0x4')],'defaultValue':function(){return _0xa66f('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa66f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa66f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa66f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa66f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![],'comment':_0xa66f('0xa'),'set':function(_0x42f064){if(!_0x42f064)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa66f('0xb')]('mandatoryDisposition',_0x42f064);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9641a82..f64123b 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 _0xb541=['verifySmtp','VerifySmtp','Sequelize','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','sendStatus','status','end','limit','count','offset','set','json','apply','save','update','get','MailAccounts','destroy','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','Pause','keys','length','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','key','email','isNil','active','description','user','cuser','password','cpassword','authentication','host','port','service','cservice','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','send','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xb541,0x19d));var _0x1b54=function(_0x2db2aa,_0x32ce39){_0x2db2aa=_0x2db2aa-0x0;var _0x378415=_0xb541[_0x2db2aa];return _0x378415;};'use strict';var emlformat=require(_0x1b54('0x0'));var rimraf=require(_0x1b54('0x1'));var zipdir=require(_0x1b54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b54('0x3'));var BPromise=require(_0x1b54('0x4'));var Mustache=require(_0x1b54('0x5'));var util=require(_0x1b54('0x6'));var path=require(_0x1b54('0x7'));var sox=require(_0x1b54('0x8'));var csv=require('to-csv');var ejs=require(_0x1b54('0x9'));var fs=require('fs');var fs_extra=require(_0x1b54('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1b54('0xb'));var jsforce=require(_0x1b54('0xc'));var deskjs=require(_0x1b54('0xd'));var toCsv=require(_0x1b54('0xe'));var querystring=require(_0x1b54('0xf'));var Papa=require(_0x1b54('0x10'));var htmlToText=require(_0x1b54('0x11'));var juice=require('juice');var Redis=require(_0x1b54('0x12'));var authService=require(_0x1b54('0x13'));var qs=require(_0x1b54('0x14'));var as=require(_0x1b54('0x15'));var hardwareService=require(_0x1b54('0x16'));var logger=require(_0x1b54('0x17'))(_0x1b54('0x18'));var utils=require(_0x1b54('0x19'));var config=require(_0x1b54('0x1a'));var licenseUtil=require(_0x1b54('0x1b'));var db=require(_0x1b54('0x1c'))['db'];config[_0x1b54('0x1d')]=_[_0x1b54('0x1e')](config[_0x1b54('0x1d')],{'host':_0x1b54('0x1f'),'port':0x18eb});var socket=require(_0x1b54('0x20'))(new Redis(config[_0x1b54('0x1d')]));require(_0x1b54('0x21'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1b54('0x22')][_0x1b54('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x984853,_0x3b109d,_0x90c44c,_0x2333ec){return new BPromise(function(_0x4ad834,_0x42f1e1){var _0x3dd4b8=_0x2333ec||client;return _0x3dd4b8['request'](_0x984853,_0x90c44c)[_0x1b54('0x24')](function(_0x369d93){logger[_0x1b54('0x25')]('MailAccount,\x20%s,\x20%s',_0x3b109d,_0x1b54('0x26'));logger[_0x1b54('0x27')](_0x1b54('0x28'),_0x3b109d,'request\x20sent',JSON[_0x1b54('0x29')](_0x369d93));if(_0x369d93[_0x1b54('0x2a')]){if(_0x369d93[_0x1b54('0x2a')][_0x1b54('0x2b')]===0x1f4){logger[_0x1b54('0x2a')]('MailAccount,\x20%s,\x20%s',_0x3b109d,_0x369d93[_0x1b54('0x2a')][_0x1b54('0x2c')]);return _0x42f1e1(_0x369d93[_0x1b54('0x2a')][_0x1b54('0x2c')]);}logger['error'](_0x1b54('0x2d'),_0x3b109d,_0x369d93[_0x1b54('0x2a')][_0x1b54('0x2c')]);return _0x4ad834(_0x369d93[_0x1b54('0x2a')][_0x1b54('0x2c')]);}else{logger[_0x1b54('0x25')](_0x1b54('0x2d'),_0x3b109d,_0x1b54('0x26'));_0x4ad834(_0x369d93[_0x1b54('0x2e')][_0x1b54('0x2c')]);}})['catch'](function(_0x42c4b2){logger['error']('MailAccount,\x20%s,\x20%s',_0x3b109d,_0x42c4b2);_0x42f1e1(_0x42c4b2);});});}function respondWithStatusCode(_0x14cdb6,_0x402306){_0x402306=_0x402306||0xcc;return function(_0x24e084){if(_0x24e084){return _0x14cdb6[_0x1b54('0x2f')](_0x402306);}return _0x14cdb6[_0x1b54('0x30')](_0x402306)[_0x1b54('0x31')]();};}function respondWithResult(_0x2d0586,_0x1c6e10){_0x1c6e10=_0x1c6e10||0xc8;return function(_0x4f4b17){if(_0x4f4b17){return _0x2d0586[_0x1b54('0x30')](_0x1c6e10)['json'](_0x4f4b17);}};}function respondWithFilteredResult(_0x1735b2,_0x2a2fee){return function(_0x408111){if(_0x408111){var _0x502fb0=typeof _0x2a2fee['offset']==='undefined'&&typeof _0x2a2fee[_0x1b54('0x32')]==='undefined';var _0x320a69=_0x408111[_0x1b54('0x33')];var _0x565785=_0x502fb0?0x0:_0x2a2fee[_0x1b54('0x34')];var _0x1c5bd1=_0x502fb0?_0x408111['count']:_0x2a2fee[_0x1b54('0x34')]+_0x2a2fee[_0x1b54('0x32')];var _0x438eac;if(_0x1c5bd1>=_0x320a69){_0x1c5bd1=_0x320a69;_0x438eac=0xc8;}else{_0x438eac=0xce;}_0x1735b2[_0x1b54('0x30')](_0x438eac);return _0x1735b2[_0x1b54('0x35')]('Content-Range',_0x565785+'-'+_0x1c5bd1+'/'+_0x320a69)[_0x1b54('0x36')](_0x408111);}return null;};}function patchUpdates(_0x39ec9a){return function(_0x91e30d){try{jsonpatch[_0x1b54('0x37')](_0x91e30d,_0x39ec9a,!![]);}catch(_0x35e3d2){return BPromise['reject'](_0x35e3d2);}return _0x91e30d[_0x1b54('0x38')]();};}function saveUpdates(_0xb160e4,_0x5c6c9d){return function(_0x4abf68){if(_0x4abf68){return _0x4abf68[_0x1b54('0x39')](_0xb160e4)[_0x1b54('0x24')](function(_0xc68ed0){return _0xc68ed0;});}return null;};}function removeEntity(_0x3646a7,_0x5b8637){return function(_0x2d5b97){if(_0x2d5b97){return _0x2d5b97['destroy']()[_0x1b54('0x24')](function(){var _0x171f5d=_0x2d5b97[_0x1b54('0x3a')]({'plain':!![]});var _0x22fe00=_0x1b54('0x3b');return db['UserProfileResource'][_0x1b54('0x3c')]({'where':{'type':_0x22fe00,'resourceId':_0x171f5d['id']}})[_0x1b54('0x24')](function(){return _0x2d5b97;});})[_0x1b54('0x24')](function(){_0x3646a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316763,_0x406a41){return function(_0x37a822){if(!_0x37a822){_0x316763[_0x1b54('0x2f')](0x194);}return _0x37a822;};}function handleError(_0x413968,_0x4cb277){_0x4cb277=_0x4cb277||0x1f4;return function(_0x3c77d9){logger[_0x1b54('0x2a')](_0x3c77d9[_0x1b54('0x3d')]);if(_0x3c77d9[_0x1b54('0x3e')]){delete _0x3c77d9[_0x1b54('0x3e')];}_0x413968[_0x1b54('0x30')](_0x4cb277)['send'](_0x3c77d9);};}exports[_0x1b54('0x3f')]=function(_0x5512b5,_0x11d9c0){var _0x2fee59={'include':[{'model':db[_0x1b54('0x40')],'as':_0x1b54('0x41')},{'model':db[_0x1b54('0x42')],'as':_0x1b54('0x43')},{'model':db['Pause'],'as':_0x1b54('0x44')}]},_0x3b0648={},_0x5d41c9={'count':0x0,'rows':[]};var _0x20c770=_[_0x1b54('0x45')](db[_0x1b54('0x46')][_0x1b54('0x47')],function(_0x6bda63){return{'name':_0x6bda63[_0x1b54('0x48')],'type':_0x6bda63[_0x1b54('0x49')]['key']};});_0x3b0648[_0x1b54('0x4a')]=_[_0x1b54('0x45')](_0x20c770,'name');_0x3b0648[_0x1b54('0x4b')]=_['keys'](_0x5512b5['query']);_0x3b0648['filters']=_['intersection'](_0x3b0648['model'],_0x3b0648[_0x1b54('0x4b')]);_0x2fee59[_0x1b54('0x4c')]=_[_0x1b54('0x4d')](_0x3b0648['model'],qs[_0x1b54('0x4e')](_0x5512b5[_0x1b54('0x4b')][_0x1b54('0x4e')]));_0x2fee59[_0x1b54('0x4c')]=_0x2fee59[_0x1b54('0x4c')]['length']?_0x2fee59['attributes']:_0x3b0648[_0x1b54('0x4a')];if(!_0x5512b5[_0x1b54('0x4b')][_0x1b54('0x4f')](_0x1b54('0x50'))){_0x2fee59[_0x1b54('0x32')]=qs[_0x1b54('0x32')](_0x5512b5[_0x1b54('0x4b')]['limit']);_0x2fee59[_0x1b54('0x34')]=qs[_0x1b54('0x34')](_0x5512b5['query']['offset']);}_0x2fee59['order']=qs[_0x1b54('0x51')](_0x5512b5[_0x1b54('0x4b')][_0x1b54('0x51')]);_0x2fee59[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_[_0x1b54('0x54')](_0x5512b5['query'],_0x3b0648['filters']),_0x20c770);if(_0x5512b5[_0x1b54('0x4b')]['filter']){_0x2fee59['where']=_[_0x1b54('0x55')](_0x2fee59['where'],{'$or':_[_0x1b54('0x45')](_0x20c770,function(_0x46ec01){if(_0x46ec01[_0x1b54('0x49')]!==_0x1b54('0x56')){var _0x377573={};_0x377573[_0x46ec01[_0x1b54('0x3e')]]={'$like':'%'+_0x5512b5[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x377573;}})});}_0x2fee59=_[_0x1b54('0x55')]({},_0x2fee59,_0x5512b5[_0x1b54('0x58')]);var _0x1d24b7={'where':_0x2fee59[_0x1b54('0x52')]};return db['MailAccount'][_0x1b54('0x33')](_0x1d24b7)['then'](function(_0x526ba2){_0x5d41c9[_0x1b54('0x33')]=_0x526ba2;if(_0x5512b5[_0x1b54('0x4b')]['includeAll']){_0x2fee59[_0x1b54('0x59')]=[{'all':!![]}];}return db[_0x1b54('0x46')][_0x1b54('0x5a')](_0x2fee59);})[_0x1b54('0x24')](function(_0x47bbaa){_0x5d41c9[_0x1b54('0x5b')]=_0x47bbaa;return _0x5d41c9;})['then'](respondWithFilteredResult(_0x11d9c0,_0x2fee59))[_0x1b54('0x5c')](handleError(_0x11d9c0,null));};exports['show']=function(_0x35781e,_0x4576ef){var _0x564a1a={'raw':![],'where':{'id':_0x35781e[_0x1b54('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x1b54('0x42')],'as':_0x1b54('0x43')},{'model':db[_0x1b54('0x5e')],'as':_0x1b54('0x44')}]},_0x528cd3={};_0x528cd3[_0x1b54('0x4a')]=_[_0x1b54('0x5f')](db[_0x1b54('0x46')]['rawAttributes']);_0x528cd3[_0x1b54('0x4b')]=_[_0x1b54('0x5f')](_0x35781e['query']);_0x528cd3[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0x528cd3[_0x1b54('0x4a')],_0x528cd3[_0x1b54('0x4b')]);_0x564a1a[_0x1b54('0x4c')]=_['intersection'](_0x528cd3[_0x1b54('0x4a')],qs['fields'](_0x35781e[_0x1b54('0x4b')][_0x1b54('0x4e')]));_0x564a1a[_0x1b54('0x4c')]=_0x564a1a[_0x1b54('0x4c')][_0x1b54('0x60')]?_0x564a1a[_0x1b54('0x4c')]:_0x528cd3[_0x1b54('0x4a')];if(_0x35781e[_0x1b54('0x4b')]['includeAll']){_0x564a1a[_0x1b54('0x59')]=[{'all':!![]}];}_0x564a1a=_['merge']({},_0x564a1a,_0x35781e[_0x1b54('0x58')]);return db[_0x1b54('0x46')][_0x1b54('0x61')](_0x564a1a)[_0x1b54('0x24')](handleEntityNotFound(_0x4576ef,null))[_0x1b54('0x24')](respondWithResult(_0x4576ef,null))[_0x1b54('0x5c')](handleError(_0x4576ef,null));};exports[_0x1b54('0x39')]=function(_0x5285e3,_0xe6b64e){if(_0x5285e3[_0x1b54('0x62')]['id']){delete _0x5285e3['body']['id'];}return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x5285e3[_0x1b54('0x5d')]['id']},'include':[{'model':db[_0x1b54('0x40')],'as':_0x1b54('0x41')},{'model':db[_0x1b54('0x42')],'as':'Smtp'},{'model':db[_0x1b54('0x5e')],'as':_0x1b54('0x44')}]})[_0x1b54('0x24')](handleEntityNotFound(_0xe6b64e,null))[_0x1b54('0x24')](saveUpdates(_0x5285e3[_0x1b54('0x62')],null))['then'](function(_0x1890af){if(_0x1890af&&_0x5285e3[_0x1b54('0x62')][_0x1b54('0x41')]){return db[_0x1b54('0x40')][_0x1b54('0x39')](_0x5285e3[_0x1b54('0x62')][_0x1b54('0x41')],{'where':{'MailAccountId':_0x1890af['id']}})[_0x1b54('0x24')](function(){return _0x1890af;});}return _0x1890af;})[_0x1b54('0x24')](function(_0x2cb1cb){if(_0x2cb1cb&&_0x5285e3['body'][_0x1b54('0x43')]){return db['MailServerOut'][_0x1b54('0x39')](_0x5285e3[_0x1b54('0x62')]['Smtp'],{'where':{'MailAccountId':_0x2cb1cb['id']}})[_0x1b54('0x24')](function(){return _0x2cb1cb;});}return _0x2cb1cb;})[_0x1b54('0x24')](respondWithResult(_0xe6b64e,null))[_0x1b54('0x5c')](handleError(_0xe6b64e,null));};exports['describe']=function(_0xc057c3,_0x61b15b){return db[_0x1b54('0x46')][_0x1b54('0x63')]()[_0x1b54('0x24')](respondWithResult(_0x61b15b,null))[_0x1b54('0x5c')](handleError(_0x61b15b,null));};exports[_0x1b54('0x64')]=function(_0x230857,_0x3bed69,_0x239b41){if(_0x230857[_0x1b54('0x62')]['id']){delete _0x230857[_0x1b54('0x62')]['id'];}return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x230857[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x3bed69,null))[_0x1b54('0x24')](function(_0x146e34){if(_0x146e34){_0x230857[_0x1b54('0x62')][_0x1b54('0x65')]=_0x146e34['id'];return db[_0x1b54('0x66')][_0x1b54('0x67')](_0x230857['body']);}})[_0x1b54('0x24')](respondWithResult(_0x3bed69,null))[_0x1b54('0x5c')](handleError(_0x3bed69,null));};exports[_0x1b54('0x68')]=function(_0x16c067,_0x34ec57,_0x4fefe5){var _0xd782f1={'raw':![],'where':{}};var _0x4c9645={};var _0x52e424={'count':0x0,'rows':[]};return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x16c067[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x34ec57,null))['then'](function(_0x5133d4){if(_0x5133d4){_0x4c9645['model']=_[_0x1b54('0x5f')](db['Disposition'][_0x1b54('0x47')]);_0x4c9645[_0x1b54('0x4b')]=_['keys'](_0x16c067[_0x1b54('0x4b')]);_0x4c9645[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0x4c9645[_0x1b54('0x4a')],_0x4c9645[_0x1b54('0x4b')]);_0xd782f1[_0x1b54('0x4c')]=_[_0x1b54('0x4d')](_0x4c9645[_0x1b54('0x4a')],qs[_0x1b54('0x4e')](_0x16c067[_0x1b54('0x4b')]['fields']));_0xd782f1[_0x1b54('0x4c')]=_0xd782f1[_0x1b54('0x4c')][_0x1b54('0x60')]?_0xd782f1[_0x1b54('0x4c')]:_0x4c9645[_0x1b54('0x4a')];if(!_0x16c067[_0x1b54('0x4b')]['hasOwnProperty'](_0x1b54('0x50'))){_0xd782f1[_0x1b54('0x32')]=qs[_0x1b54('0x32')](_0x16c067[_0x1b54('0x4b')][_0x1b54('0x32')]);_0xd782f1['offset']=qs['offset'](_0x16c067['query']['offset']);}_0xd782f1[_0x1b54('0x6a')]=qs[_0x1b54('0x51')](_0x16c067[_0x1b54('0x4b')][_0x1b54('0x51')]);_0xd782f1[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_['pick'](_0x16c067[_0x1b54('0x4b')],_0x4c9645[_0x1b54('0x53')]));_0xd782f1[_0x1b54('0x52')][_0x1b54('0x65')]=_0x5133d4['id'];if(_0x16c067[_0x1b54('0x4b')][_0x1b54('0x57')]){_0xd782f1[_0x1b54('0x52')]=_[_0x1b54('0x55')](_0xd782f1[_0x1b54('0x52')],{'$or':_[_0x1b54('0x45')](_0xd782f1[_0x1b54('0x4c')],function(_0x567e59){var _0x32b36a={};_0x32b36a[_0x567e59]={'$like':'%'+_0x16c067[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x32b36a;})});}_0xd782f1=_[_0x1b54('0x55')]({},_0xd782f1,_0x16c067[_0x1b54('0x58')]);return db[_0x1b54('0x66')][_0x1b54('0x33')]({'where':_0xd782f1['where']})['then'](function(_0x2521b2){_0x52e424[_0x1b54('0x33')]=_0x2521b2;if(_0x16c067[_0x1b54('0x4b')][_0x1b54('0x6b')]){_0xd782f1[_0x1b54('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x1b54('0x5a')](_0xd782f1);})[_0x1b54('0x24')](function(_0x526f2f){_0x52e424['rows']=_0x526f2f;return _0x52e424;});}})['then'](respondWithFilteredResult(_0x34ec57,_0xd782f1))[_0x1b54('0x5c')](handleError(_0x34ec57,null));};exports[_0x1b54('0x6c')]=function(_0x5c4030,_0x2961d8,_0x4d70f2){return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x5c4030[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x2961d8,null))['then'](function(_0x37538d){if(_0x37538d){return _0x37538d[_0x1b54('0x6c')](_0x5c4030[_0x1b54('0x4b')][_0x1b54('0x6d')]);}})['then'](respondWithStatusCode(_0x2961d8,null))['catch'](handleError(_0x2961d8,null));};exports[_0x1b54('0x6e')]=function(_0x18e1aa,_0xf22486,_0x4f15b9){if(_0x18e1aa[_0x1b54('0x62')]['id']){delete _0x18e1aa[_0x1b54('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x18e1aa['params']['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0xf22486,null))[_0x1b54('0x24')](function(_0x368772){if(_0x368772){_0x18e1aa['body'][_0x1b54('0x65')]=_0x368772['id'];return db['CannedAnswer'][_0x1b54('0x67')](_0x18e1aa[_0x1b54('0x62')]);}})[_0x1b54('0x24')](respondWithResult(_0xf22486,null))[_0x1b54('0x5c')](handleError(_0xf22486,null));};exports[_0x1b54('0x6f')]=function(_0x168035,_0x4076e8,_0x32d6ef){var _0x40f07c={'raw':![],'where':{}};var _0x472c64={};var _0x34fb12={'count':0x0,'rows':[]};return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x168035[_0x1b54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4076e8,null))[_0x1b54('0x24')](function(_0x1c73d6){if(_0x1c73d6){_0x472c64[_0x1b54('0x4a')]=_[_0x1b54('0x5f')](db[_0x1b54('0x70')][_0x1b54('0x47')]);_0x472c64[_0x1b54('0x4b')]=_[_0x1b54('0x5f')](_0x168035['query']);_0x472c64[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0x472c64[_0x1b54('0x4a')],_0x472c64['query']);_0x40f07c[_0x1b54('0x4c')]=_[_0x1b54('0x4d')](_0x472c64[_0x1b54('0x4a')],qs['fields'](_0x168035[_0x1b54('0x4b')]['fields']));_0x40f07c[_0x1b54('0x4c')]=_0x40f07c['attributes'][_0x1b54('0x60')]?_0x40f07c[_0x1b54('0x4c')]:_0x472c64[_0x1b54('0x4a')];if(!_0x168035[_0x1b54('0x4b')][_0x1b54('0x4f')](_0x1b54('0x50'))){_0x40f07c[_0x1b54('0x32')]=qs['limit'](_0x168035['query'][_0x1b54('0x32')]);_0x40f07c[_0x1b54('0x34')]=qs['offset'](_0x168035['query'][_0x1b54('0x34')]);}_0x40f07c[_0x1b54('0x6a')]=qs[_0x1b54('0x51')](_0x168035[_0x1b54('0x4b')][_0x1b54('0x51')]);_0x40f07c[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_[_0x1b54('0x54')](_0x168035['query'],_0x472c64[_0x1b54('0x53')]));_0x40f07c[_0x1b54('0x52')][_0x1b54('0x65')]=_0x1c73d6['id'];if(_0x168035['query'][_0x1b54('0x57')]){_0x40f07c['where']=_[_0x1b54('0x55')](_0x40f07c[_0x1b54('0x52')],{'$or':_['map'](_0x40f07c[_0x1b54('0x4c')],function(_0x2bf4c5){var _0x1fdc19={};_0x1fdc19[_0x2bf4c5]={'$like':'%'+_0x168035[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x1fdc19;})});}_0x40f07c=_[_0x1b54('0x55')]({},_0x40f07c,_0x168035[_0x1b54('0x58')]);return db['CannedAnswer'][_0x1b54('0x33')]({'where':_0x40f07c[_0x1b54('0x52')]})['then'](function(_0x5b0ba1){_0x34fb12['count']=_0x5b0ba1;if(_0x168035[_0x1b54('0x4b')][_0x1b54('0x6b')]){_0x40f07c[_0x1b54('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x40f07c);})[_0x1b54('0x24')](function(_0x3e7ea4){_0x34fb12[_0x1b54('0x5b')]=_0x3e7ea4;return _0x34fb12;});}})[_0x1b54('0x24')](respondWithFilteredResult(_0x4076e8,_0x40f07c))[_0x1b54('0x5c')](handleError(_0x4076e8,null));};exports['removeAnswers']=function(_0x116686,_0x24a60d,_0x444259){return db[_0x1b54('0x46')]['find']({'where':{'id':_0x116686[_0x1b54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x24a60d,null))[_0x1b54('0x24')](function(_0x522950){if(_0x522950){return _0x522950[_0x1b54('0x71')](_0x116686['query'][_0x1b54('0x6d')]);}})[_0x1b54('0x24')](respondWithStatusCode(_0x24a60d,null))['catch'](handleError(_0x24a60d,null));};exports['create']=function(_0x242557,_0x3b3dec){var _0x2ccdf3={'name':_0x242557[_0x1b54('0x62')]['name'],'key':_0x242557[_0x1b54('0x62')][_0x1b54('0x72')],'email':_0x242557[_0x1b54('0x62')][_0x1b54('0x73')],'ListId':_0x242557['body']['ListId'],'active':!_[_0x1b54('0x74')](_0x242557['body'][_0x1b54('0x75')])?_0x242557[_0x1b54('0x62')][_0x1b54('0x75')]:!![],'description':_0x242557[_0x1b54('0x62')][_0x1b54('0x76')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x242557[_0x1b54('0x62')]['cservice'])){if(_0x242557[_0x1b54('0x62')]['cauthentication']){_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x77')]=_0x2ccdf3[_0x1b54('0x43')][_0x1b54('0x77')]=_0x242557['body'][_0x1b54('0x78')];_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x79')]=_0x2ccdf3[_0x1b54('0x43')]['pass']=_0x242557[_0x1b54('0x62')][_0x1b54('0x7a')];}else{_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x7b')]=_0x2ccdf3[_0x1b54('0x43')][_0x1b54('0x7b')]=![];}_0x2ccdf3['Imap']['host']=_0x242557[_0x1b54('0x62')][_0x1b54('0x41')][_0x1b54('0x7c')];_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x7d')]=_0x242557['body'][_0x1b54('0x41')][_0x1b54('0x7d')];_0x2ccdf3['Smtp'][_0x1b54('0x7c')]=_0x242557[_0x1b54('0x62')][_0x1b54('0x43')][_0x1b54('0x7c')];_0x2ccdf3['Smtp'][_0x1b54('0x7d')]=_0x242557[_0x1b54('0x62')]['Smtp']['port'];}else{_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x7e')]=_0x2ccdf3[_0x1b54('0x43')][_0x1b54('0x7e')]=_0x242557['body'][_0x1b54('0x7f')];_0x2ccdf3[_0x1b54('0x41')][_0x1b54('0x77')]=_0x2ccdf3[_0x1b54('0x43')][_0x1b54('0x77')]=_0x242557[_0x1b54('0x62')][_0x1b54('0x78')];_0x2ccdf3['Imap'][_0x1b54('0x79')]=_0x2ccdf3['Smtp'][_0x1b54('0x80')]=_0x242557['body'][_0x1b54('0x7a')];}return db[_0x1b54('0x46')]['create'](_0x2ccdf3,{'include':[{'model':db[_0x1b54('0x42')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x1b54('0x41')}]})[_0x1b54('0x24')](function(_0x2b3ebb){var _0x5cfa45=_0x242557[_0x1b54('0x77')][_0x1b54('0x3a')]({'plain':!![]});if(!_0x5cfa45)throw new Error(_0x1b54('0x81'));if(_0x5cfa45[_0x1b54('0x82')]===_0x1b54('0x77')){var _0x41f026=_0x2b3ebb[_0x1b54('0x3a')]({'plain':!![]});return db[_0x1b54('0x83')][_0x1b54('0x61')]({'where':{'name':_0x1b54('0x3b'),'userProfileId':_0x5cfa45[_0x1b54('0x84')]},'raw':!![]})[_0x1b54('0x24')](function(_0x50aa51){if(_0x50aa51&&_0x50aa51[_0x1b54('0x85')]===0x0){return db[_0x1b54('0x86')][_0x1b54('0x67')]({'name':_0x41f026[_0x1b54('0x3e')],'resourceId':_0x41f026['id'],'type':_0x50aa51[_0x1b54('0x3e')],'sectionId':_0x50aa51['id']},{})[_0x1b54('0x24')](function(){return _0x2b3ebb;});}else{return _0x2b3ebb;}})[_0x1b54('0x5c')](function(_0x5b82ca){logger[_0x1b54('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b82ca);throw _0x5b82ca;});}return _0x2b3ebb;})[_0x1b54('0x24')](respondWithResult(_0x3b3dec,0xc9))[_0x1b54('0x5c')](handleError(_0x3b3dec,null));};exports[_0x1b54('0x87')]=function(_0x171301,_0x595ead,_0x13ae83){return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x171301[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x595ead,null))[_0x1b54('0x24')](function(_0xab43cb){if(_0xab43cb){return _0xab43cb['getImap']();}return null;})['then'](respondWithResult(_0x595ead,null))['catch'](handleError(_0x595ead,null));};exports[_0x1b54('0x88')]=function(_0xdaa693,_0xf67fe9,_0x51ebf7){if(_0xdaa693[_0x1b54('0x62')]['id']){delete _0xdaa693[_0x1b54('0x62')]['id'];}return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0xdaa693['params']['id']}})['then'](handleEntityNotFound(_0xf67fe9,null))[_0x1b54('0x24')](function(_0x5aef10){if(_0x5aef10){_0xdaa693[_0x1b54('0x62')][_0x1b54('0x65')]=_0x5aef10['id'];return db[_0x1b54('0x40')][_0x1b54('0x67')](_0xdaa693[_0x1b54('0x62')]);}})[_0x1b54('0x24')](respondWithResult(_0xf67fe9,null))[_0x1b54('0x5c')](handleError(_0xf67fe9,null));};exports[_0x1b54('0x89')]=function(_0x4ed81c,_0xad063a,_0x1eb8a0){return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x4ed81c[_0x1b54('0x5d')]['id']}})['then'](handleEntityNotFound(_0xad063a,null))[_0x1b54('0x24')](function(_0x5b9f45){if(_0x5b9f45){return _0x5b9f45['setImap'](null);}return null;})[_0x1b54('0x24')](respondWithStatusCode(_0xad063a,null))['catch'](handleError(_0xad063a,null));};exports[_0x1b54('0x8a')]=function(_0x53d00a,_0x13ecf5,_0x170980){return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x53d00a['params']['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x13ecf5,null))[_0x1b54('0x24')](function(_0xd880ca){if(_0xd880ca){return _0xd880ca[_0x1b54('0x8a')]();}return null;})[_0x1b54('0x24')](respondWithResult(_0x13ecf5,null))[_0x1b54('0x5c')](handleError(_0x13ecf5,null));};exports[_0x1b54('0x8b')]=function(_0x3b86c1,_0x1bdfc0,_0x40a543){if(_0x3b86c1[_0x1b54('0x62')]['id']){delete _0x3b86c1[_0x1b54('0x62')]['id'];}return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x3b86c1[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x1bdfc0,null))[_0x1b54('0x24')](function(_0x1b87b3){if(_0x1b87b3){_0x3b86c1[_0x1b54('0x62')][_0x1b54('0x65')]=_0x1b87b3['id'];return db['MailServerOut'][_0x1b54('0x67')](_0x3b86c1[_0x1b54('0x62')]);}})[_0x1b54('0x24')](respondWithResult(_0x1bdfc0,null))[_0x1b54('0x5c')](handleError(_0x1bdfc0,null));};exports[_0x1b54('0x8c')]=function(_0x50b2ea,_0x451682,_0x2f7afc){return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x50b2ea['params']['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x451682,null))['then'](function(_0x34a583){if(_0x34a583){return _0x34a583[_0x1b54('0x8d')](null);}return null;})['then'](respondWithStatusCode(_0x451682,null))[_0x1b54('0x5c')](handleError(_0x451682,null));};exports['addInteraction']=function(_0x7fe3fe,_0x53377f,_0x42959f){return db[_0x1b54('0x8e')][_0x1b54('0x61')]({'where':{'id':_0x7fe3fe['params']['id']}})['then'](handleEntityNotFound(_0x53377f,null))['then'](function(_0x421da8){if(_0x421da8){return _0x421da8[_0x1b54('0x8f')](_0x7fe3fe[_0x1b54('0x62')][_0x1b54('0x6d')],_[_0x1b54('0x90')](_0x7fe3fe[_0x1b54('0x62')],[_0x1b54('0x6d'),'id'])||{});}})[_0x1b54('0x24')](respondWithResult(_0x53377f,null))[_0x1b54('0x5c')](handleError(_0x53377f,null));};exports['getInteractions']=function(_0x5ec276,_0x5951e2,_0x48de63){var _0x2d9ac3={'raw':![],'where':{}};var _0x381fdf={};var _0x2138bf={'count':0x0,'rows':[]};return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x5ec276[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x5951e2,null))[_0x1b54('0x24')](function(_0x251cbc){if(_0x251cbc){_0x381fdf[_0x1b54('0x4a')]=_['keys'](db['MailInteraction'][_0x1b54('0x47')]);_0x381fdf[_0x1b54('0x4b')]=_[_0x1b54('0x5f')](_0x5ec276['query']);_0x381fdf[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0x381fdf['model'],_0x381fdf[_0x1b54('0x4b')]);_0x2d9ac3[_0x1b54('0x4c')]=_[_0x1b54('0x4d')](_0x381fdf[_0x1b54('0x4a')],qs[_0x1b54('0x4e')](_0x5ec276[_0x1b54('0x4b')][_0x1b54('0x4e')]));_0x2d9ac3['attributes']=_0x2d9ac3[_0x1b54('0x4c')]['length']?_0x2d9ac3[_0x1b54('0x4c')]:_0x381fdf[_0x1b54('0x4a')];if(!_0x5ec276['query'][_0x1b54('0x4f')](_0x1b54('0x50'))){_0x2d9ac3[_0x1b54('0x32')]=qs[_0x1b54('0x32')](_0x5ec276[_0x1b54('0x4b')][_0x1b54('0x32')]);_0x2d9ac3[_0x1b54('0x34')]=qs['offset'](_0x5ec276[_0x1b54('0x4b')][_0x1b54('0x34')]);}_0x2d9ac3[_0x1b54('0x6a')]=qs['sort'](_0x5ec276[_0x1b54('0x4b')][_0x1b54('0x51')]);_0x2d9ac3[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_[_0x1b54('0x54')](_0x5ec276['query'],_0x381fdf[_0x1b54('0x53')]));_0x2d9ac3['where'][_0x1b54('0x65')]=_0x251cbc['id'];if(_0x5ec276['query'][_0x1b54('0x57')]){_0x2d9ac3[_0x1b54('0x52')]=_[_0x1b54('0x55')](_0x2d9ac3[_0x1b54('0x52')],{'$or':_[_0x1b54('0x45')](_0x2d9ac3['attributes'],function(_0x359dba){var _0x2189fa={};_0x2189fa[_0x359dba]={'$like':'%'+_0x5ec276['query'][_0x1b54('0x57')]+'%'};return _0x2189fa;})});}_0x2d9ac3=_['merge']({},_0x2d9ac3,_0x5ec276[_0x1b54('0x58')]);return db[_0x1b54('0x8e')][_0x1b54('0x33')]({'where':_0x2d9ac3[_0x1b54('0x52')]})[_0x1b54('0x24')](function(_0x4a2e73){_0x2138bf[_0x1b54('0x33')]=_0x4a2e73;if(_0x5ec276['query'][_0x1b54('0x6b')]){_0x2d9ac3[_0x1b54('0x59')]=[{'model':db[_0x1b54('0x91')],'as':_0x1b54('0x92'),'required':![]},{'model':db[_0x1b54('0x93')],'as':_0x1b54('0x94'),'attributes':['name','fullname',_0x1b54('0x95')],'required':![]},{'model':db[_0x1b54('0x96')],'as':_0x1b54('0x97'),'attributes':['id',_0x1b54('0x3e'),'color'],'where':_0x5ec276[_0x1b54('0x4b')][_0x1b54('0x98')]?{'id':_0x5ec276['query'][_0x1b54('0x98')]}:undefined,'required':_0x5ec276['query'][_0x1b54('0x98')]?!![]:![]}];}return db[_0x1b54('0x8e')][_0x1b54('0x5a')](_0x2d9ac3);})[_0x1b54('0x24')](function(_0x215ca6){_0x2138bf[_0x1b54('0x5b')]=_0x215ca6;return _0x2138bf;});}})['then'](respondWithFilteredResult(_0x5951e2,_0x2d9ac3))[_0x1b54('0x5c')](handleError(_0x5951e2,null));};exports['addApplications']=function addApplications(_0x1aa02a,_0x57b87f){var _0xb0b889=_0x1aa02a[_0x1b54('0x5d')]['id'];var _0x144662=_0x1aa02a[_0x1b54('0x62')];var _0x4db07e=0xc8;var _0x1edfd3=null;return db[_0x1b54('0x99')][_0x1b54('0x9a')]({'isolationLevel':db[_0x1b54('0x99')][_0x1b54('0x9b')][_0x1b54('0x9c')]['READ_COMMITTED']},function(_0x2474f3){return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0xb0b889},'transaction':_0x2474f3})['then'](function(_0x45f596){if(_0x45f596){return db['MailApplication'][_0x1b54('0x3c')]({'where':{'MailAccountId':_0xb0b889},'transaction':_0x2474f3})['then'](function(){var _0x1c7d06=_[_0x1b54('0x45')](_0x144662,function(_0x229590){_0x229590[_0x1b54('0x65')]=_0xb0b889;return _0x229590;});return db[_0x1b54('0x9d')]['bulkCreate'](_0x1c7d06,{'transaction':_0x2474f3});});}else{_0x4db07e=0x194;_0x1edfd3=[];}});})[_0x1b54('0x24')](function(){if(_0x4db07e!==0x194){return db[_0x1b54('0x9d')][_0x1b54('0x9e')]({'where':{'MailAccountId':_0xb0b889},'order':_0x1b54('0x9f')})['then'](function(_0x132948){_0x1edfd3=_0x132948;});}})[_0x1b54('0x5c')](function(_0x1878b5){_0x4db07e=0x1f4;logger[_0x1b54('0x2a')](_0x1878b5[_0x1b54('0x3d')]);if(_0x1878b5[_0x1b54('0x3e')]){delete _0x1878b5['name'];}_0x1edfd3=_0x1878b5;})[_0x1b54('0xa0')](function(){if(_0x1edfd3===null){_0x57b87f['sendStatus'](_0x4db07e);}else{if(_0x4db07e===0x1f4){_0x57b87f[_0x1b54('0x30')](_0x4db07e)['send'](_0x1edfd3);}else{_0x57b87f[_0x1b54('0x30')](_0x4db07e)[_0x1b54('0x36')](_0x1edfd3);}}});};exports[_0x1b54('0xa1')]=function(_0x4c2760,_0x5c0122,_0x41e2a8){var _0x4501fa={};var _0x2d668d={};var _0x2d4861;var _0x1a7d51;return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x4c2760['params']['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0x5c0122,null))[_0x1b54('0x24')](function(_0x3c329e){if(_0x3c329e){_0x2d4861=_0x3c329e;_0x2d668d[_0x1b54('0x4a')]=_[_0x1b54('0x5f')](db[_0x1b54('0x9d')]['rawAttributes']);_0x2d668d['query']=_[_0x1b54('0x5f')](_0x4c2760[_0x1b54('0x4b')]);_0x2d668d[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0x2d668d[_0x1b54('0x4a')],_0x2d668d[_0x1b54('0x4b')]);_0x4501fa[_0x1b54('0x4c')]=_['intersection'](_0x2d668d[_0x1b54('0x4a')],qs[_0x1b54('0x4e')](_0x4c2760[_0x1b54('0x4b')]['fields']));_0x4501fa['attributes']=_0x4501fa['attributes'][_0x1b54('0x60')]?_0x4501fa[_0x1b54('0x4c')]:_0x2d668d[_0x1b54('0x4a')];_0x4501fa['order']=qs[_0x1b54('0x51')](_0x4c2760[_0x1b54('0x4b')]['sort']);_0x4501fa[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_[_0x1b54('0x54')](_0x4c2760[_0x1b54('0x4b')],_0x2d668d[_0x1b54('0x53')]));if(_0x4c2760[_0x1b54('0x4b')][_0x1b54('0x57')]){_0x4501fa['where']=_[_0x1b54('0x55')](_0x4501fa['where'],{'$or':_[_0x1b54('0x45')](_0x4501fa['attributes'],function(_0x18965e){var _0x39af90={};_0x39af90[_0x18965e]={'$like':'%'+_0x4c2760[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x39af90;})});}_0x4501fa=_[_0x1b54('0x55')]({},_0x4501fa,_0x4c2760[_0x1b54('0x58')]);return _0x2d4861['getApplications'](_0x4501fa);}})[_0x1b54('0x24')](function(_0x165c7f){if(_0x165c7f){_0x1a7d51=_0x165c7f[_0x1b54('0x60')];if(!_0x4c2760['query'][_0x1b54('0x4f')]('nolimit')){_0x4501fa['limit']=qs[_0x1b54('0x32')](_0x4c2760['query'][_0x1b54('0x32')]);_0x4501fa[_0x1b54('0x34')]=qs[_0x1b54('0x34')](_0x4c2760['query'][_0x1b54('0x34')]);}return _0x2d4861[_0x1b54('0xa1')](_0x4501fa);}})[_0x1b54('0x24')](function(_0x4dcd36){if(_0x4dcd36){return _0x4dcd36?{'count':_0x1a7d51,'rows':_0x4dcd36}:null;}})[_0x1b54('0x24')](respondWithResult(_0x5c0122,null))[_0x1b54('0x5c')](handleError(_0x5c0122,null));};exports[_0x1b54('0xa2')]=function(_0x4e92f4,_0xa51198,_0x42b7d2){var _0x594b04={'raw':!![],'where':{}};var _0x2dfd71={};var _0x268f47={'count':0x0,'rows':[]};return db[_0x1b54('0x46')][_0x1b54('0x69')]({'where':{'id':_0x4e92f4[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0xa51198,null))['then'](function(_0x18823d){if(_0x18823d){_0x2dfd71['model']=_[_0x1b54('0x5f')](db['MailMessage'][_0x1b54('0x47')]);_0x2dfd71[_0x1b54('0x4b')]=_[_0x1b54('0x5f')](_0x4e92f4[_0x1b54('0x4b')]);_0x2dfd71[_0x1b54('0x53')]=_['intersection'](_0x2dfd71[_0x1b54('0x4a')],_0x2dfd71[_0x1b54('0x4b')]);_0x594b04['attributes']=_[_0x1b54('0x4d')](_0x2dfd71['model'],qs['fields'](_0x4e92f4[_0x1b54('0x4b')]['fields']));_0x594b04[_0x1b54('0x4c')]=_0x594b04['attributes'][_0x1b54('0x60')]?_0x594b04[_0x1b54('0x4c')]:_0x2dfd71[_0x1b54('0x4a')];if(!_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0x4f')]('nolimit')){_0x594b04['limit']=qs[_0x1b54('0x32')](_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0x32')]);_0x594b04['offset']=qs[_0x1b54('0x34')](_0x4e92f4[_0x1b54('0x4b')]['offset']);}_0x594b04[_0x1b54('0x6a')]=qs[_0x1b54('0x51')](_0x4e92f4[_0x1b54('0x4b')]['sort']);_0x594b04[_0x1b54('0x52')]=qs[_0x1b54('0x53')](_[_0x1b54('0x54')](_0x4e92f4[_0x1b54('0x4b')],_0x2dfd71[_0x1b54('0x53')]));_0x594b04['where'][_0x1b54('0x65')]=_0x18823d['id'];if(_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0x57')]){_0x594b04[_0x1b54('0x52')]=_['merge'](_0x594b04['where'],{'$or':_[_0x1b54('0x45')](_0x594b04['attributes'],function(_0x174b9f){var _0x11ac3b={};_0x11ac3b[_0x174b9f]={'$like':'%'+_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x11ac3b;})});}if(_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0xa3')]){var _0x4b5db7=_0x4e92f4[_0x1b54('0x4b')]['$gte'][_0x1b54('0xa4')](',');var _0xf2fc58={};_0xf2fc58[_0x4b5db7[0x0]]={'$gte':moment(_0x4b5db7[0x1])[_0x1b54('0xa5')](_0x1b54('0xa6'))};_0x594b04[_0x1b54('0x52')]=_[_0x1b54('0x55')](_0x594b04[_0x1b54('0x52')],_0xf2fc58);}_0x594b04=_[_0x1b54('0x55')]({},_0x594b04,_0x4e92f4['options']);return db[_0x1b54('0xa7')]['count']({'where':_0x594b04[_0x1b54('0x52')]})['then'](function(_0x1f9a21){_0x268f47[_0x1b54('0x33')]=_0x1f9a21;if(_0x4e92f4[_0x1b54('0x4b')]['includeAll']){_0x594b04[_0x1b54('0x59')]=[{'all':!![]}];}return db[_0x1b54('0xa7')][_0x1b54('0x5a')](_0x594b04);})[_0x1b54('0x24')](function(_0x134602){if(_0x4e92f4[_0x1b54('0x4b')][_0x1b54('0xa8')]===_0x1b54('0xa9')){for(var _0x147368=0x0;_0x147368<_0x134602['length'];_0x147368++){_0x134602[_0x147368][_0x1b54('0x62')]=juice(_0x134602[_0x147368][_0x1b54('0x62')]);}}_0x268f47[_0x1b54('0x5b')]=_0x134602;return _0x268f47;});}})[_0x1b54('0x24')](respondWithFilteredResult(_0xa51198,_0x594b04))[_0x1b54('0x5c')](handleError(_0xa51198,null));};exports[_0x1b54('0xaa')]=function(_0x577fe9,_0x3837d1,_0x152a45){var _0x511217,_0x325363={},_0x49d2f2;if(_0x577fe9[_0x1b54('0x62')]['to']){_0x49d2f2=_0x577fe9[_0x1b54('0x62')]['to'][_0x1b54('0xa4')](',')[0x0];}return db['MailAccount'][_0x1b54('0x61')]({'where':{'id':_0x577fe9[_0x1b54('0x5d')]['id']},'include':[{'model':db[_0x1b54('0xab')],'as':_0x1b54('0xac'),'include':[{'model':db[_0x1b54('0x91')],'as':_0x1b54('0xad'),'where':{'email':_0x49d2f2},'limit':0x1,'order':[[_0x1b54('0xae'),_0x1b54('0xaf')]]}]},{'model':db['MailServerOut'],'as':_0x1b54('0x43'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3837d1,null))['then'](function(_0x368e60){if(_0x368e60){_0x511217=_0x368e60;if(_0x368e60['Smtp']){if(_['isNil'](_0x577fe9[_0x1b54('0x62')][_0x1b54('0xb0')])){_0x577fe9[_0x1b54('0x62')]['from']=util[_0x1b54('0xa5')](_0x1b54('0xb1'),_0x368e60[_0x1b54('0x3e')],_0x368e60['email']||_0x368e60[_0x1b54('0x43')][_0x1b54('0x77')]);}if(_0x577fe9[_0x1b54('0x62')]['attachments']&&_0x577fe9['body']['attachments'][_0x1b54('0x60')]){for(var _0x340352=0x0;_0x340352<_0x577fe9[_0x1b54('0x62')][_0x1b54('0xb2')][_0x1b54('0x60')];_0x340352+=0x1){_0x577fe9[_0x1b54('0x62')][_0x1b54('0xb2')][_0x340352]={'filename':_0x577fe9['body'][_0x1b54('0xb2')][_0x340352][_0x1b54('0x3e')],'path':path[_0x1b54('0xb3')](config[_0x1b54('0xb4')],'server/files/attachments',_0x577fe9[_0x1b54('0x62')][_0x1b54('0xb2')][_0x340352][_0x1b54('0xb5')])};}}var _0x540983={'tls':{'rejectUnauthorized':![]}};if(_[_0x1b54('0x74')](_0x368e60[_0x1b54('0x43')][_0x1b54('0x7e')])){if(_0x368e60[_0x1b54('0x43')][_0x1b54('0x7b')]){_0x540983[_0x1b54('0xb6')]={'user':_0x368e60[_0x1b54('0x43')][_0x1b54('0x77')],'pass':_0x368e60[_0x1b54('0x43')][_0x1b54('0x80')]};}_0x540983['host']=_0x368e60['Smtp'][_0x1b54('0x7c')];_0x540983[_0x1b54('0x7d')]=_0x368e60[_0x1b54('0x43')][_0x1b54('0x7d')];_0x540983[_0x1b54('0xb7')]=_0x368e60[_0x1b54('0x43')][_0x1b54('0xb7')];}else{_0x540983[_0x1b54('0x7e')]=_0x368e60[_0x1b54('0x43')][_0x1b54('0x7e')];_0x540983[_0x1b54('0xb6')]={'user':_0x368e60['Smtp'][_0x1b54('0x77')],'pass':_0x368e60[_0x1b54('0x43')][_0x1b54('0x80')]};}return respondWithRpcPromise(_0x1b54('0xb8'),_0x1b54('0xb9'),{'account':_0x540983,'message':_0x577fe9[_0x1b54('0x62')]});}else{throw new Error(_0x1b54('0xba'));}}})[_0x1b54('0x24')](function(_0x455065){if(_0x455065){_0x325363=_0x455065;if(_0x511217[_0x1b54('0xac')]){if(_0x511217[_0x1b54('0xac')][_0x1b54('0xad')][_0x1b54('0x60')]){return _0x511217[_0x1b54('0xac')][_0x1b54('0xad')][0x0];}else{return db[_0x1b54('0x91')]['create'](_[_0x1b54('0x1e')](_0x577fe9[_0x1b54('0x62')],{'firstName':_0x577fe9[_0x1b54('0x62')]['to'],'email':_0x577fe9['body']['to'],'phone':_0x577fe9[_0x1b54('0x62')]['to'],'ListId':_0x511217['ListId']}));}}else{throw new Error(_0x1b54('0xba'));}}})[_0x1b54('0x24')](function(_0x12eb59){if(_0x12eb59){var _0x455c60={'UserId':_0x577fe9[_0x1b54('0x77')]['id'],'ContactId':_0x12eb59['id'],'MailAccountId':_0x511217['id'],'inReplyTo':_0x325363[_0x1b54('0xbb')],'to':_0x577fe9[_0x1b54('0x62')][_0x1b54('0xb0')],'cc':_0x577fe9['body']['cc'],'subject':_0x577fe9[_0x1b54('0x62')][_0x1b54('0xbc')],'attach':_0x577fe9[_0x1b54('0x62')][_0x1b54('0xbd')],'firstMsgDirection':_0x1b54('0xbe'),'lastMsgAt':moment()['format'](_0x1b54('0xa6')),'lastMsgDirection':_0x1b54('0xbe'),'Messages':[_['merge'](_0x577fe9[_0x1b54('0x62')],{'messageId':_0x325363['messageId'],'sentAt':moment()[_0x1b54('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x511217['id'],'UserId':_0x577fe9[_0x1b54('0x77')]['id'],'ContactId':_0x12eb59['id']})]};if(_0x577fe9[_0x1b54('0x62')]['Interaction']){_0x455c60=_[_0x1b54('0x55')](_0x455c60,_0x577fe9[_0x1b54('0x62')][_0x1b54('0xbf')]);}return db[_0x1b54('0x8e')]['create'](_0x455c60,{'include':[{'model':db['MailMessage'],'as':_0x1b54('0xc0')}]});}})[_0x1b54('0x24')](respondWithResult(_0x3837d1,null))['catch'](handleError(_0x3837d1,null));};exports[_0x1b54('0xc1')]=function(_0x5e5325,_0x4d036b,_0x3bffe0){return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x5e5325[_0x1b54('0x5d')]['id']},'include':[{'model':db[_0x1b54('0x42')],'as':_0x1b54('0x43'),'raw':!![]}]})[_0x1b54('0x24')](handleEntityNotFound(_0x4d036b,null))[_0x1b54('0x24')](function(_0x267f06){if(_0x267f06&&_0x267f06[_0x1b54('0x43')]){var _0x15746f={'id':_0x267f06['id'],'tls':{'rejectUnauthorized':![]}};if(_0x267f06[_0x1b54('0x43')][_0x1b54('0x7e')]){_0x15746f[_0x1b54('0x7e')]=_0x267f06[_0x1b54('0x43')][_0x1b54('0x7e')];}else{_0x15746f['host']=_0x267f06[_0x1b54('0x43')]['host'];_0x15746f[_0x1b54('0x7d')]=_0x267f06[_0x1b54('0x43')]['port'];_0x15746f[_0x1b54('0xb7')]=_0x267f06[_0x1b54('0x43')][_0x1b54('0xb7')];}if(_0x267f06[_0x1b54('0x43')][_0x1b54('0x7b')]){_0x15746f[_0x1b54('0xb6')]={'user':_0x267f06[_0x1b54('0x43')][_0x1b54('0x77')],'pass':_0x267f06[_0x1b54('0x43')]['pass']};}return respondWithRpcPromise(_0x1b54('0xc2'),'verifySmtp',{'account':_0x15746f});}})['then'](respondWithResult(_0x4d036b,null))[_0x1b54('0x5c')](handleError(_0x4d036b,null));};exports[_0x1b54('0x3c')]=function(_0x52e722,_0x5c3966){return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x52e722['params']['id']}})['then'](handleEntityNotFound(_0x5c3966,null))[_0x1b54('0x24')](function(_0x381a26){if(_0x381a26&&_0x381a26[_0x1b54('0x7e')]){throw new db[(_0x1b54('0xc3'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x381a26;})[_0x1b54('0x24')](removeEntity(_0x5c3966,null))[_0x1b54('0x5c')](handleError(_0x5c3966,null));};exports['addAgents']=function(_0x237b8a,_0x1b35ab,_0x5ce03e){return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x237b8a[_0x1b54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1b35ab,null))['then'](function(_0x3beebd){if(_0x3beebd){return _0x3beebd['addAgents'](_0x237b8a[_0x1b54('0x62')][_0x1b54('0x6d')],_[_0x1b54('0x90')](_0x237b8a['body'],[_0x1b54('0x6d'),'id'])||{})[_0x1b54('0xc4')](function(_0x585b23){for(var _0x4b329b=0x0;_0x4b329b<_0x237b8a[_0x1b54('0x62')]['ids'][_0x1b54('0x60')];_0x4b329b+=0x1){socket[_0x1b54('0xc5')]('userMailAccount:save',{'UserId':Number(_0x237b8a['body'][_0x1b54('0x6d')][_0x4b329b]),'MailAccountId':Number(_0x237b8a[_0x1b54('0x5d')]['id'])});}return _0x585b23;});}})[_0x1b54('0x24')](respondWithResult(_0x1b35ab,null))[_0x1b54('0x5c')](handleError(_0x1b35ab,null));};exports['removeAgents']=function(_0x1d1821,_0xe9fc2d,_0x490151){return db[_0x1b54('0x46')][_0x1b54('0x61')]({'where':{'id':_0x1d1821[_0x1b54('0x5d')]['id']}})[_0x1b54('0x24')](handleEntityNotFound(_0xe9fc2d,null))[_0x1b54('0x24')](function(_0x4c3107){if(_0x4c3107){return _0x4c3107[_0x1b54('0xc6')](_0x1d1821[_0x1b54('0x4b')]['ids'])[_0x1b54('0x24')](function(){if(_[_0x1b54('0xc7')](_0x1d1821[_0x1b54('0x4b')][_0x1b54('0x6d')])){for(var _0x1c1ede=0x0;_0x1c1ede<_0x1d1821['query'][_0x1b54('0x6d')][_0x1b54('0x60')];_0x1c1ede+=0x1){socket[_0x1b54('0xc5')](_0x1b54('0xc8'),{'UserId':Number(_0x1d1821[_0x1b54('0x4b')][_0x1b54('0x6d')][_0x1c1ede]),'MailAccountId':Number(_0x1d1821['params']['id'])});}}else{socket[_0x1b54('0xc5')](_0x1b54('0xc8'),{'UserId':Number(_0x1d1821[_0x1b54('0x4b')]['ids']),'MailAccountId':Number(_0x1d1821['params']['id'])});}});}})[_0x1b54('0x24')](respondWithStatusCode(_0xe9fc2d,null))[_0x1b54('0x5c')](handleError(_0xe9fc2d,null));};exports['getAgents']=function(_0x78c88,_0x423111,_0x4e8aeb){var _0x3fa740={};var _0xc2e0a2={};var _0x59098d;var _0x57cbb6;return db[_0x1b54('0x46')]['findOne']({'where':{'id':_0x78c88[_0x1b54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x423111,null))[_0x1b54('0x24')](function(_0x17cc35){if(_0x17cc35){_0x59098d=_0x17cc35;_0xc2e0a2[_0x1b54('0x4a')]=_[_0x1b54('0x5f')](db[_0x1b54('0x93')][_0x1b54('0x47')]);_0xc2e0a2['query']=_['keys'](_0x78c88[_0x1b54('0x4b')]);_0xc2e0a2[_0x1b54('0x53')]=_[_0x1b54('0x4d')](_0xc2e0a2[_0x1b54('0x4a')],_0xc2e0a2[_0x1b54('0x4b')]);_0x3fa740[_0x1b54('0x4c')]=_['intersection'](_0xc2e0a2[_0x1b54('0x4a')],qs['fields'](_0x78c88['query'][_0x1b54('0x4e')]));_0x3fa740[_0x1b54('0x4c')]=_0x3fa740[_0x1b54('0x4c')][_0x1b54('0x60')]?_0x3fa740[_0x1b54('0x4c')]:_0xc2e0a2['model'];_0x3fa740['order']=qs['sort'](_0x78c88[_0x1b54('0x4b')]['sort']);_0x3fa740[_0x1b54('0x52')]=qs['filters'](_['pick'](_0x78c88[_0x1b54('0x4b')],_0xc2e0a2[_0x1b54('0x53')]));if(_0x78c88[_0x1b54('0x4b')][_0x1b54('0x57')]){_0x3fa740['where']=_[_0x1b54('0x55')](_0x3fa740['where'],{'$or':_[_0x1b54('0x45')](_0x3fa740[_0x1b54('0x4c')],function(_0x851721){var _0x34a89f={};_0x34a89f[_0x851721]={'$like':'%'+_0x78c88[_0x1b54('0x4b')][_0x1b54('0x57')]+'%'};return _0x34a89f;})});}_0x3fa740=_[_0x1b54('0x55')]({},_0x3fa740,_0x78c88[_0x1b54('0x58')]);return _0x59098d[_0x1b54('0xc9')](_0x3fa740);}})[_0x1b54('0x24')](function(_0x4adcb8){if(_0x4adcb8){_0x57cbb6=_0x4adcb8[_0x1b54('0x60')];if(!_0x78c88['query']['hasOwnProperty'](_0x1b54('0x50'))){_0x3fa740[_0x1b54('0x32')]=qs[_0x1b54('0x32')](_0x78c88['query'][_0x1b54('0x32')]);_0x3fa740[_0x1b54('0x34')]=qs[_0x1b54('0x34')](_0x78c88[_0x1b54('0x4b')][_0x1b54('0x34')]);}return _0x59098d[_0x1b54('0xc9')](_0x3fa740);}})[_0x1b54('0x24')](function(_0x28cc5e){if(_0x28cc5e){return _0x28cc5e?{'count':_0x57cbb6,'rows':_0x28cc5e}:null;}})[_0x1b54('0x24')](respondWithResult(_0x423111,null))[_0x1b54('0x5c')](handleError(_0x423111,null));}; \ No newline at end of file +var _0x6156=['removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','color','tag','sequelize','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','MailMessage','$gte','split','format','inlineCss','true','CmList','Contacts','DESC','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','List','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','secure','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','ids','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','MailAccounts','end','sendStatus','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','map','MailAccount','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','show','params','mandatoryDispositionPause','rawAttributes','includeAll','options','body','find','update','describe','addDisposition','Disposition','create','getDispositions','length','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','findAll','rows','removeAnswers','email','ListId','isNil','active','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','service','cservice','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6156,0x1dd));var _0x6615=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6156[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x6615('0x0'));var rimraf=require(_0x6615('0x1'));var zipdir=require(_0x6615('0x2'));var jsonpatch=require(_0x6615('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6615('0x4'));var Mustache=require(_0x6615('0x5'));var util=require('util');var path=require(_0x6615('0x6'));var sox=require(_0x6615('0x7'));var csv=require(_0x6615('0x8'));var ejs=require(_0x6615('0x9'));var fs=require('fs');var fs_extra=require(_0x6615('0xa'));var _=require(_0x6615('0xb'));var squel=require(_0x6615('0xc'));var crypto=require(_0x6615('0xd'));var jsforce=require(_0x6615('0xe'));var deskjs=require(_0x6615('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6615('0x10'));var Papa=require(_0x6615('0x11'));var htmlToText=require(_0x6615('0x12'));var juice=require(_0x6615('0x13'));var Redis=require(_0x6615('0x14'));var authService=require(_0x6615('0x15'));var qs=require(_0x6615('0x16'));var as=require(_0x6615('0x17'));var hardwareService=require(_0x6615('0x18'));var logger=require(_0x6615('0x19'))(_0x6615('0x1a'));var utils=require(_0x6615('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x6615('0x1c'));var db=require(_0x6615('0x1d'))['db'];config[_0x6615('0x1e')]=_[_0x6615('0x1f')](config[_0x6615('0x1e')],{'host':_0x6615('0x20'),'port':0x18eb});var socket=require(_0x6615('0x21'))(new Redis(config[_0x6615('0x1e')]));require('./mailAccount.socket')[_0x6615('0x22')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6615('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x596740,_0x1978af,_0xcb8d,_0x187665){return new BPromise(function(_0xda1fa9,_0x2a8998){var _0x5ccc17=_0x187665||client;return _0x5ccc17[_0x6615('0x24')](_0x596740,_0xcb8d)[_0x6615('0x25')](function(_0x57c66c){logger[_0x6615('0x26')](_0x6615('0x27'),_0x1978af,'request\x20sent');logger[_0x6615('0x28')](_0x6615('0x29'),_0x1978af,_0x6615('0x2a'),JSON[_0x6615('0x2b')](_0x57c66c));if(_0x57c66c[_0x6615('0x2c')]){if(_0x57c66c[_0x6615('0x2c')][_0x6615('0x2d')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1978af,_0x57c66c['error']['message']);return _0x2a8998(_0x57c66c['error'][_0x6615('0x2e')]);}logger[_0x6615('0x2c')](_0x6615('0x27'),_0x1978af,_0x57c66c[_0x6615('0x2c')][_0x6615('0x2e')]);return _0xda1fa9(_0x57c66c[_0x6615('0x2c')][_0x6615('0x2e')]);}else{logger[_0x6615('0x26')](_0x6615('0x27'),_0x1978af,_0x6615('0x2a'));_0xda1fa9(_0x57c66c[_0x6615('0x2f')]['message']);}})[_0x6615('0x30')](function(_0x252de6){logger[_0x6615('0x2c')]('MailAccount,\x20%s,\x20%s',_0x1978af,_0x252de6);_0x2a8998(_0x252de6);});});}function respondWithStatusCode(_0x147537,_0x362ef4){_0x362ef4=_0x362ef4||0xcc;return function(_0x40ea65){if(_0x40ea65){return _0x147537['sendStatus'](_0x362ef4);}return _0x147537[_0x6615('0x31')](_0x362ef4)['end']();};}function respondWithResult(_0x4383b2,_0x1d58d2){_0x1d58d2=_0x1d58d2||0xc8;return function(_0x7b8716){if(_0x7b8716){return _0x4383b2[_0x6615('0x31')](_0x1d58d2)['json'](_0x7b8716);}};}function respondWithFilteredResult(_0x20b2ed,_0x2c880d){return function(_0x300bbe){if(_0x300bbe){var _0x377765=typeof _0x2c880d[_0x6615('0x32')]===_0x6615('0x33')&&typeof _0x2c880d[_0x6615('0x34')]===_0x6615('0x33');var _0x33835e=_0x300bbe[_0x6615('0x35')];var _0x542ebc=_0x377765?0x0:_0x2c880d[_0x6615('0x32')];var _0x3e4888=_0x377765?_0x300bbe[_0x6615('0x35')]:_0x2c880d[_0x6615('0x32')]+_0x2c880d[_0x6615('0x34')];var _0x207e77;if(_0x3e4888>=_0x33835e){_0x3e4888=_0x33835e;_0x207e77=0xc8;}else{_0x207e77=0xce;}_0x20b2ed['status'](_0x207e77);return _0x20b2ed[_0x6615('0x36')](_0x6615('0x37'),_0x542ebc+'-'+_0x3e4888+'/'+_0x33835e)[_0x6615('0x38')](_0x300bbe);}return null;};}function patchUpdates(_0x4921e5){return function(_0x5b4d7b){try{jsonpatch[_0x6615('0x39')](_0x5b4d7b,_0x4921e5,!![]);}catch(_0x31b243){return BPromise[_0x6615('0x3a')](_0x31b243);}return _0x5b4d7b[_0x6615('0x3b')]();};}function saveUpdates(_0x45c756,_0x35a958){return function(_0x4928a6){if(_0x4928a6){return _0x4928a6['update'](_0x45c756)[_0x6615('0x25')](function(_0x235cc0){return _0x235cc0;});}return null;};}function removeEntity(_0x4cb12d,_0xff210){return function(_0x173624){if(_0x173624){return _0x173624[_0x6615('0x3c')]()[_0x6615('0x25')](function(){var _0x4adfcd=_0x173624['get']({'plain':!![]});var _0x5c5f73=_0x6615('0x3d');return db['UserProfileResource'][_0x6615('0x3c')]({'where':{'type':_0x5c5f73,'resourceId':_0x4adfcd['id']}})[_0x6615('0x25')](function(){return _0x173624;});})[_0x6615('0x25')](function(){_0x4cb12d[_0x6615('0x31')](0xcc)[_0x6615('0x3e')]();});}};}function handleEntityNotFound(_0x545ea8,_0x5965f9){return function(_0x4882e4){if(!_0x4882e4){_0x545ea8[_0x6615('0x3f')](0x194);}return _0x4882e4;};}function handleError(_0x3fa132,_0x5b02a6){_0x5b02a6=_0x5b02a6||0x1f4;return function(_0x1df610){logger[_0x6615('0x2c')](_0x1df610[_0x6615('0x40')]);if(_0x1df610[_0x6615('0x41')]){delete _0x1df610[_0x6615('0x41')];}_0x3fa132[_0x6615('0x31')](_0x5b02a6)['send'](_0x1df610);};}exports[_0x6615('0x42')]=function(_0x43766f,_0x212952){var _0x43a7e9={'include':[{'model':db[_0x6615('0x43')],'as':_0x6615('0x44')},{'model':db[_0x6615('0x45')],'as':_0x6615('0x46')},{'model':db[_0x6615('0x47')],'as':'mandatoryDispositionPause'}]},_0x44b142={},_0x60539f={'count':0x0,'rows':[]};var _0x522b79=_[_0x6615('0x48')](db[_0x6615('0x49')]['rawAttributes'],function(_0x34ce1c){return{'name':_0x34ce1c['fieldName'],'type':_0x34ce1c[_0x6615('0x4a')][_0x6615('0x4b')]};});_0x44b142[_0x6615('0x4c')]=_[_0x6615('0x48')](_0x522b79,_0x6615('0x41'));_0x44b142[_0x6615('0x4d')]=_[_0x6615('0x4e')](_0x43766f[_0x6615('0x4d')]);_0x44b142[_0x6615('0x4f')]=_[_0x6615('0x50')](_0x44b142[_0x6615('0x4c')],_0x44b142[_0x6615('0x4d')]);_0x43a7e9[_0x6615('0x51')]=_[_0x6615('0x50')](_0x44b142['model'],qs[_0x6615('0x52')](_0x43766f[_0x6615('0x4d')]['fields']));_0x43a7e9[_0x6615('0x51')]=_0x43a7e9[_0x6615('0x51')]['length']?_0x43a7e9['attributes']:_0x44b142[_0x6615('0x4c')];if(!_0x43766f[_0x6615('0x4d')]['hasOwnProperty'](_0x6615('0x53'))){_0x43a7e9[_0x6615('0x34')]=qs[_0x6615('0x34')](_0x43766f[_0x6615('0x4d')][_0x6615('0x34')]);_0x43a7e9[_0x6615('0x32')]=qs['offset'](_0x43766f[_0x6615('0x4d')][_0x6615('0x32')]);}_0x43a7e9[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x43766f[_0x6615('0x4d')][_0x6615('0x55')]);_0x43a7e9[_0x6615('0x56')]=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x43766f['query'],_0x44b142['filters']),_0x522b79);if(_0x43766f[_0x6615('0x4d')][_0x6615('0x58')]){_0x43a7e9['where']=_[_0x6615('0x59')](_0x43a7e9[_0x6615('0x56')],{'$or':_['map'](_0x522b79,function(_0x29f019){if(_0x29f019[_0x6615('0x4a')]!==_0x6615('0x5a')){var _0x5dc093={};_0x5dc093[_0x29f019[_0x6615('0x41')]]={'$like':'%'+_0x43766f[_0x6615('0x4d')]['filter']+'%'};return _0x5dc093;}})});}_0x43a7e9=_[_0x6615('0x59')]({},_0x43a7e9,_0x43766f['options']);var _0x1e5639={'where':_0x43a7e9[_0x6615('0x56')]};return db['MailAccount'][_0x6615('0x35')](_0x1e5639)[_0x6615('0x25')](function(_0x5890b8){_0x60539f['count']=_0x5890b8;if(_0x43766f[_0x6615('0x4d')]['includeAll']){_0x43a7e9[_0x6615('0x5b')]=[{'all':!![]}];}return db[_0x6615('0x49')]['findAll'](_0x43a7e9);})[_0x6615('0x25')](function(_0x6e6eca){_0x60539f['rows']=_0x6e6eca;return _0x60539f;})[_0x6615('0x25')](respondWithFilteredResult(_0x212952,_0x43a7e9))['catch'](handleError(_0x212952,null));};exports[_0x6615('0x5c')]=function(_0x165af5,_0x24091e){var _0xdfb7f8={'raw':![],'where':{'id':_0x165af5[_0x6615('0x5d')]['id']},'include':[{'model':db[_0x6615('0x43')],'as':_0x6615('0x44')},{'model':db[_0x6615('0x45')],'as':'Smtp'},{'model':db['Pause'],'as':_0x6615('0x5e')}]},_0x38c810={};_0x38c810[_0x6615('0x4c')]=_[_0x6615('0x4e')](db[_0x6615('0x49')][_0x6615('0x5f')]);_0x38c810[_0x6615('0x4d')]=_[_0x6615('0x4e')](_0x165af5[_0x6615('0x4d')]);_0x38c810['filters']=_[_0x6615('0x50')](_0x38c810[_0x6615('0x4c')],_0x38c810['query']);_0xdfb7f8[_0x6615('0x51')]=_[_0x6615('0x50')](_0x38c810[_0x6615('0x4c')],qs[_0x6615('0x52')](_0x165af5[_0x6615('0x4d')][_0x6615('0x52')]));_0xdfb7f8[_0x6615('0x51')]=_0xdfb7f8['attributes']['length']?_0xdfb7f8[_0x6615('0x51')]:_0x38c810[_0x6615('0x4c')];if(_0x165af5[_0x6615('0x4d')][_0x6615('0x60')]){_0xdfb7f8[_0x6615('0x5b')]=[{'all':!![]}];}_0xdfb7f8=_['merge']({},_0xdfb7f8,_0x165af5[_0x6615('0x61')]);return db['MailAccount']['find'](_0xdfb7f8)[_0x6615('0x25')](handleEntityNotFound(_0x24091e,null))[_0x6615('0x25')](respondWithResult(_0x24091e,null))[_0x6615('0x30')](handleError(_0x24091e,null));};exports['update']=function(_0x369b7e,_0x22b88e){if(_0x369b7e[_0x6615('0x62')]['id']){delete _0x369b7e['body']['id'];}return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x369b7e[_0x6615('0x5d')]['id']},'include':[{'model':db[_0x6615('0x43')],'as':_0x6615('0x44')},{'model':db[_0x6615('0x45')],'as':_0x6615('0x46')},{'model':db['Pause'],'as':_0x6615('0x5e')}]})[_0x6615('0x25')](handleEntityNotFound(_0x22b88e,null))[_0x6615('0x25')](saveUpdates(_0x369b7e[_0x6615('0x62')],null))[_0x6615('0x25')](function(_0x1d58d7){if(_0x1d58d7&&_0x369b7e[_0x6615('0x62')][_0x6615('0x44')]){return db[_0x6615('0x43')][_0x6615('0x64')](_0x369b7e[_0x6615('0x62')][_0x6615('0x44')],{'where':{'MailAccountId':_0x1d58d7['id']}})[_0x6615('0x25')](function(){return _0x1d58d7;});}return _0x1d58d7;})[_0x6615('0x25')](function(_0x7dd67d){if(_0x7dd67d&&_0x369b7e['body'][_0x6615('0x46')]){return db['MailServerOut'][_0x6615('0x64')](_0x369b7e[_0x6615('0x62')]['Smtp'],{'where':{'MailAccountId':_0x7dd67d['id']}})[_0x6615('0x25')](function(){return _0x7dd67d;});}return _0x7dd67d;})[_0x6615('0x25')](respondWithResult(_0x22b88e,null))[_0x6615('0x30')](handleError(_0x22b88e,null));};exports['describe']=function(_0x41cb37,_0x23b6f5){return db[_0x6615('0x49')][_0x6615('0x65')]()[_0x6615('0x25')](respondWithResult(_0x23b6f5,null))[_0x6615('0x30')](handleError(_0x23b6f5,null));};exports[_0x6615('0x66')]=function(_0x1ab720,_0x7aac9a,_0x3b705d){if(_0x1ab720[_0x6615('0x62')]['id']){delete _0x1ab720[_0x6615('0x62')]['id'];}return db[_0x6615('0x49')]['find']({'where':{'id':_0x1ab720[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x7aac9a,null))['then'](function(_0x32692e){if(_0x32692e){_0x1ab720[_0x6615('0x62')]['MailAccountId']=_0x32692e['id'];return db[_0x6615('0x67')][_0x6615('0x68')](_0x1ab720[_0x6615('0x62')]);}})['then'](respondWithResult(_0x7aac9a,null))[_0x6615('0x30')](handleError(_0x7aac9a,null));};exports[_0x6615('0x69')]=function(_0x573852,_0x4bd03b,_0x502795){var _0x3dbef0={'raw':![],'where':{}};var _0x41d98d={};var _0xe4838c={'count':0x0,'rows':[]};return db[_0x6615('0x49')]['findOne']({'where':{'id':_0x573852[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x4bd03b,null))[_0x6615('0x25')](function(_0x3b1e83){if(_0x3b1e83){_0x41d98d[_0x6615('0x4c')]=_[_0x6615('0x4e')](db['Disposition'][_0x6615('0x5f')]);_0x41d98d[_0x6615('0x4d')]=_[_0x6615('0x4e')](_0x573852[_0x6615('0x4d')]);_0x41d98d['filters']=_[_0x6615('0x50')](_0x41d98d[_0x6615('0x4c')],_0x41d98d[_0x6615('0x4d')]);_0x3dbef0[_0x6615('0x51')]=_[_0x6615('0x50')](_0x41d98d[_0x6615('0x4c')],qs[_0x6615('0x52')](_0x573852[_0x6615('0x4d')][_0x6615('0x52')]));_0x3dbef0[_0x6615('0x51')]=_0x3dbef0[_0x6615('0x51')][_0x6615('0x6a')]?_0x3dbef0[_0x6615('0x51')]:_0x41d98d[_0x6615('0x4c')];if(!_0x573852[_0x6615('0x4d')]['hasOwnProperty']('nolimit')){_0x3dbef0[_0x6615('0x34')]=qs[_0x6615('0x34')](_0x573852['query'][_0x6615('0x34')]);_0x3dbef0[_0x6615('0x32')]=qs[_0x6615('0x32')](_0x573852[_0x6615('0x4d')][_0x6615('0x32')]);}_0x3dbef0['order']=qs[_0x6615('0x55')](_0x573852[_0x6615('0x4d')][_0x6615('0x55')]);_0x3dbef0[_0x6615('0x56')]=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x573852[_0x6615('0x4d')],_0x41d98d[_0x6615('0x4f')]));_0x3dbef0[_0x6615('0x56')][_0x6615('0x6b')]=_0x3b1e83['id'];if(_0x573852[_0x6615('0x4d')][_0x6615('0x58')]){_0x3dbef0[_0x6615('0x56')]=_[_0x6615('0x59')](_0x3dbef0[_0x6615('0x56')],{'$or':_[_0x6615('0x48')](_0x3dbef0[_0x6615('0x51')],function(_0x5d575f){var _0x49bcbe={};_0x49bcbe[_0x5d575f]={'$like':'%'+_0x573852[_0x6615('0x4d')][_0x6615('0x58')]+'%'};return _0x49bcbe;})});}_0x3dbef0=_[_0x6615('0x59')]({},_0x3dbef0,_0x573852[_0x6615('0x61')]);return db[_0x6615('0x67')][_0x6615('0x35')]({'where':_0x3dbef0['where']})[_0x6615('0x25')](function(_0x47ff28){_0xe4838c[_0x6615('0x35')]=_0x47ff28;if(_0x573852['query'][_0x6615('0x60')]){_0x3dbef0[_0x6615('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3dbef0);})['then'](function(_0x3acefb){_0xe4838c['rows']=_0x3acefb;return _0xe4838c;});}})['then'](respondWithFilteredResult(_0x4bd03b,_0x3dbef0))[_0x6615('0x30')](handleError(_0x4bd03b,null));};exports[_0x6615('0x6c')]=function(_0x4601e1,_0x466476,_0x36ca44){return db[_0x6615('0x49')]['find']({'where':{'id':_0x4601e1['params']['id']}})['then'](handleEntityNotFound(_0x466476,null))['then'](function(_0x46893d){if(_0x46893d){return _0x46893d[_0x6615('0x6c')](_0x4601e1[_0x6615('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x466476,null))[_0x6615('0x30')](handleError(_0x466476,null));};exports[_0x6615('0x6d')]=function(_0x5703af,_0x546fe8,_0x1c1463){if(_0x5703af[_0x6615('0x62')]['id']){delete _0x5703af[_0x6615('0x62')]['id'];}return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x5703af[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x546fe8,null))[_0x6615('0x25')](function(_0x3aa81d){if(_0x3aa81d){_0x5703af[_0x6615('0x62')][_0x6615('0x6b')]=_0x3aa81d['id'];return db[_0x6615('0x6e')][_0x6615('0x68')](_0x5703af[_0x6615('0x62')]);}})['then'](respondWithResult(_0x546fe8,null))[_0x6615('0x30')](handleError(_0x546fe8,null));};exports[_0x6615('0x6f')]=function(_0x49103a,_0x3c9380,_0x4b87c1){var _0x480dea={'raw':![],'where':{}};var _0x4b314c={};var _0x436051={'count':0x0,'rows':[]};return db[_0x6615('0x49')][_0x6615('0x70')]({'where':{'id':_0x49103a[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x3c9380,null))['then'](function(_0x41392c){if(_0x41392c){_0x4b314c[_0x6615('0x4c')]=_['keys'](db[_0x6615('0x6e')][_0x6615('0x5f')]);_0x4b314c[_0x6615('0x4d')]=_['keys'](_0x49103a[_0x6615('0x4d')]);_0x4b314c['filters']=_[_0x6615('0x50')](_0x4b314c[_0x6615('0x4c')],_0x4b314c[_0x6615('0x4d')]);_0x480dea[_0x6615('0x51')]=_[_0x6615('0x50')](_0x4b314c['model'],qs['fields'](_0x49103a[_0x6615('0x4d')][_0x6615('0x52')]));_0x480dea['attributes']=_0x480dea['attributes'][_0x6615('0x6a')]?_0x480dea[_0x6615('0x51')]:_0x4b314c[_0x6615('0x4c')];if(!_0x49103a[_0x6615('0x4d')][_0x6615('0x71')](_0x6615('0x53'))){_0x480dea[_0x6615('0x34')]=qs[_0x6615('0x34')](_0x49103a[_0x6615('0x4d')]['limit']);_0x480dea[_0x6615('0x32')]=qs[_0x6615('0x32')](_0x49103a[_0x6615('0x4d')][_0x6615('0x32')]);}_0x480dea[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x49103a[_0x6615('0x4d')][_0x6615('0x55')]);_0x480dea['where']=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x49103a[_0x6615('0x4d')],_0x4b314c[_0x6615('0x4f')]));_0x480dea[_0x6615('0x56')][_0x6615('0x6b')]=_0x41392c['id'];if(_0x49103a[_0x6615('0x4d')][_0x6615('0x58')]){_0x480dea[_0x6615('0x56')]=_[_0x6615('0x59')](_0x480dea[_0x6615('0x56')],{'$or':_[_0x6615('0x48')](_0x480dea['attributes'],function(_0x217d2d){var _0x4a2b80={};_0x4a2b80[_0x217d2d]={'$like':'%'+_0x49103a[_0x6615('0x4d')][_0x6615('0x58')]+'%'};return _0x4a2b80;})});}_0x480dea=_[_0x6615('0x59')]({},_0x480dea,_0x49103a['options']);return db[_0x6615('0x6e')][_0x6615('0x35')]({'where':_0x480dea[_0x6615('0x56')]})[_0x6615('0x25')](function(_0x15257e){_0x436051[_0x6615('0x35')]=_0x15257e;if(_0x49103a[_0x6615('0x4d')]['includeAll']){_0x480dea[_0x6615('0x5b')]=[{'all':!![]}];}return db[_0x6615('0x6e')][_0x6615('0x72')](_0x480dea);})[_0x6615('0x25')](function(_0xdf1783){_0x436051[_0x6615('0x73')]=_0xdf1783;return _0x436051;});}})['then'](respondWithFilteredResult(_0x3c9380,_0x480dea))['catch'](handleError(_0x3c9380,null));};exports['removeAnswers']=function(_0x3f1aee,_0x45083e,_0x29f953){return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x3f1aee['params']['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x45083e,null))[_0x6615('0x25')](function(_0x565f93){if(_0x565f93){return _0x565f93[_0x6615('0x74')](_0x3f1aee[_0x6615('0x4d')]['ids']);}})[_0x6615('0x25')](respondWithStatusCode(_0x45083e,null))['catch'](handleError(_0x45083e,null));};exports[_0x6615('0x68')]=function(_0x2cdabc,_0x437ecf){var _0x1fd785={'name':_0x2cdabc['body'][_0x6615('0x41')],'key':_0x2cdabc[_0x6615('0x62')]['key'],'email':_0x2cdabc[_0x6615('0x62')][_0x6615('0x75')],'ListId':_0x2cdabc[_0x6615('0x62')][_0x6615('0x76')],'active':!_[_0x6615('0x77')](_0x2cdabc[_0x6615('0x62')][_0x6615('0x78')])?_0x2cdabc[_0x6615('0x62')][_0x6615('0x78')]:!![],'description':_0x2cdabc[_0x6615('0x62')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x6615('0x77')](_0x2cdabc['body']['cservice'])){if(_0x2cdabc[_0x6615('0x62')][_0x6615('0x79')]){_0x1fd785['Imap'][_0x6615('0x7a')]=_0x1fd785[_0x6615('0x46')][_0x6615('0x7a')]=_0x2cdabc['body'][_0x6615('0x7b')];_0x1fd785[_0x6615('0x44')][_0x6615('0x7c')]=_0x1fd785[_0x6615('0x46')][_0x6615('0x7d')]=_0x2cdabc[_0x6615('0x62')][_0x6615('0x7e')];}else{_0x1fd785[_0x6615('0x44')][_0x6615('0x7f')]=_0x1fd785['Smtp'][_0x6615('0x7f')]=![];}_0x1fd785['Imap']['host']=_0x2cdabc[_0x6615('0x62')]['Imap']['host'];_0x1fd785[_0x6615('0x44')][_0x6615('0x80')]=_0x2cdabc[_0x6615('0x62')][_0x6615('0x44')][_0x6615('0x80')];_0x1fd785[_0x6615('0x46')][_0x6615('0x81')]=_0x2cdabc['body']['Smtp'][_0x6615('0x81')];_0x1fd785[_0x6615('0x46')][_0x6615('0x80')]=_0x2cdabc[_0x6615('0x62')][_0x6615('0x46')][_0x6615('0x80')];}else{_0x1fd785['Imap'][_0x6615('0x82')]=_0x1fd785['Smtp'][_0x6615('0x82')]=_0x2cdabc[_0x6615('0x62')][_0x6615('0x83')];_0x1fd785[_0x6615('0x44')][_0x6615('0x7a')]=_0x1fd785[_0x6615('0x46')][_0x6615('0x7a')]=_0x2cdabc[_0x6615('0x62')][_0x6615('0x7b')];_0x1fd785['Imap'][_0x6615('0x7c')]=_0x1fd785['Smtp']['pass']=_0x2cdabc['body'][_0x6615('0x7e')];}return db[_0x6615('0x49')][_0x6615('0x68')](_0x1fd785,{'include':[{'model':db[_0x6615('0x45')],'as':_0x6615('0x46')},{'model':db[_0x6615('0x43')],'as':_0x6615('0x44')}]})['then'](function(_0x53b2f4){var _0xf5ca3a=_0x2cdabc[_0x6615('0x7a')][_0x6615('0x84')]({'plain':!![]});if(!_0xf5ca3a)throw new Error(_0x6615('0x85'));if(_0xf5ca3a[_0x6615('0x86')]===_0x6615('0x7a')){var _0x30faea=_0x53b2f4[_0x6615('0x84')]({'plain':!![]});return db[_0x6615('0x87')]['find']({'where':{'name':_0x6615('0x3d'),'userProfileId':_0xf5ca3a[_0x6615('0x88')]},'raw':!![]})[_0x6615('0x25')](function(_0x4f5c22){if(_0x4f5c22&&_0x4f5c22[_0x6615('0x89')]===0x0){return db[_0x6615('0x8a')][_0x6615('0x68')]({'name':_0x30faea['name'],'resourceId':_0x30faea['id'],'type':_0x4f5c22[_0x6615('0x41')],'sectionId':_0x4f5c22['id']},{})[_0x6615('0x25')](function(){return _0x53b2f4;});}else{return _0x53b2f4;}})['catch'](function(_0x56583f){logger['error'](_0x6615('0x8b'),_0x56583f);throw _0x56583f;});}return _0x53b2f4;})[_0x6615('0x25')](respondWithResult(_0x437ecf,0xc9))[_0x6615('0x30')](handleError(_0x437ecf,null));};exports[_0x6615('0x8c')]=function(_0x18d4e1,_0x434f17,_0x2b7e77){return db['MailAccount']['findOne']({'where':{'id':_0x18d4e1[_0x6615('0x5d')]['id']}})['then'](handleEntityNotFound(_0x434f17,null))['then'](function(_0x5d0f0c){if(_0x5d0f0c){return _0x5d0f0c['getImap']();}return null;})[_0x6615('0x25')](respondWithResult(_0x434f17,null))['catch'](handleError(_0x434f17,null));};exports['addImap']=function(_0x1746da,_0xf76bf2,_0x45421b){if(_0x1746da['body']['id']){delete _0x1746da['body']['id'];}return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x1746da[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0xf76bf2,null))[_0x6615('0x25')](function(_0x25e42c){if(_0x25e42c){_0x1746da['body'][_0x6615('0x6b')]=_0x25e42c['id'];return db[_0x6615('0x43')][_0x6615('0x68')](_0x1746da[_0x6615('0x62')]);}})[_0x6615('0x25')](respondWithResult(_0xf76bf2,null))['catch'](handleError(_0xf76bf2,null));};exports[_0x6615('0x8d')]=function(_0x46cd76,_0x4881ba,_0xa47845){return db['MailAccount']['findOne']({'where':{'id':_0x46cd76[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x4881ba,null))[_0x6615('0x25')](function(_0x4acf0b){if(_0x4acf0b){return _0x4acf0b[_0x6615('0x8e')](null);}return null;})[_0x6615('0x25')](respondWithStatusCode(_0x4881ba,null))[_0x6615('0x30')](handleError(_0x4881ba,null));};exports[_0x6615('0x8f')]=function(_0x29228d,_0x54c00d,_0x4be45d){return db['MailAccount'][_0x6615('0x70')]({'where':{'id':_0x29228d['params']['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x54c00d,null))[_0x6615('0x25')](function(_0xcb62ec){if(_0xcb62ec){return _0xcb62ec[_0x6615('0x8f')]();}return null;})[_0x6615('0x25')](respondWithResult(_0x54c00d,null))[_0x6615('0x30')](handleError(_0x54c00d,null));};exports[_0x6615('0x90')]=function(_0x12ba3c,_0x58c41a,_0xd85167){if(_0x12ba3c[_0x6615('0x62')]['id']){delete _0x12ba3c[_0x6615('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x12ba3c[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x58c41a,null))[_0x6615('0x25')](function(_0xbf3fde){if(_0xbf3fde){_0x12ba3c[_0x6615('0x62')]['MailAccountId']=_0xbf3fde['id'];return db[_0x6615('0x45')][_0x6615('0x68')](_0x12ba3c['body']);}})['then'](respondWithResult(_0x58c41a,null))[_0x6615('0x30')](handleError(_0x58c41a,null));};exports[_0x6615('0x91')]=function(_0x564c6b,_0x1e6b8d,_0x2c32f2){return db[_0x6615('0x49')]['findOne']({'where':{'id':_0x564c6b[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x1e6b8d,null))[_0x6615('0x25')](function(_0x4531cd){if(_0x4531cd){return _0x4531cd[_0x6615('0x92')](null);}return null;})[_0x6615('0x25')](respondWithStatusCode(_0x1e6b8d,null))['catch'](handleError(_0x1e6b8d,null));};exports[_0x6615('0x93')]=function(_0x42fe6c,_0x32b279,_0xd6cb30){return db[_0x6615('0x94')]['find']({'where':{'id':_0x42fe6c[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x32b279,null))[_0x6615('0x25')](function(_0x745099){if(_0x745099){return _0x745099[_0x6615('0x93')](_0x42fe6c[_0x6615('0x62')]['ids'],_[_0x6615('0x95')](_0x42fe6c[_0x6615('0x62')],['ids','id'])||{});}})[_0x6615('0x25')](respondWithResult(_0x32b279,null))['catch'](handleError(_0x32b279,null));};exports[_0x6615('0x96')]=function(_0x3ad6f0,_0x2e96b3,_0x2b664f){var _0x4bcdc7={'raw':![],'where':{}};var _0x3f1def={};var _0x20862f={'count':0x0,'rows':[]};return db[_0x6615('0x49')][_0x6615('0x70')]({'where':{'id':_0x3ad6f0[_0x6615('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e96b3,null))[_0x6615('0x25')](function(_0x559bbd){if(_0x559bbd){_0x3f1def[_0x6615('0x4c')]=_['keys'](db[_0x6615('0x94')]['rawAttributes']);_0x3f1def[_0x6615('0x4d')]=_[_0x6615('0x4e')](_0x3ad6f0[_0x6615('0x4d')]);_0x3f1def[_0x6615('0x4f')]=_[_0x6615('0x50')](_0x3f1def[_0x6615('0x4c')],_0x3f1def['query']);_0x4bcdc7[_0x6615('0x51')]=_[_0x6615('0x50')](_0x3f1def[_0x6615('0x4c')],qs['fields'](_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x52')]));_0x4bcdc7['attributes']=_0x4bcdc7['attributes'][_0x6615('0x6a')]?_0x4bcdc7[_0x6615('0x51')]:_0x3f1def[_0x6615('0x4c')];if(!_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x71')](_0x6615('0x53'))){_0x4bcdc7[_0x6615('0x34')]=qs['limit'](_0x3ad6f0['query']['limit']);_0x4bcdc7[_0x6615('0x32')]=qs[_0x6615('0x32')](_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x32')]);}_0x4bcdc7[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x3ad6f0['query']['sort']);_0x4bcdc7[_0x6615('0x56')]=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x3ad6f0[_0x6615('0x4d')],_0x3f1def[_0x6615('0x4f')]));_0x4bcdc7[_0x6615('0x56')][_0x6615('0x6b')]=_0x559bbd['id'];if(_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x58')]){_0x4bcdc7[_0x6615('0x56')]=_[_0x6615('0x59')](_0x4bcdc7[_0x6615('0x56')],{'$or':_[_0x6615('0x48')](_0x4bcdc7[_0x6615('0x51')],function(_0x12bb23){var _0x41cbc3={};_0x41cbc3[_0x12bb23]={'$like':'%'+_0x3ad6f0['query'][_0x6615('0x58')]+'%'};return _0x41cbc3;})});}_0x4bcdc7=_[_0x6615('0x59')]({},_0x4bcdc7,_0x3ad6f0['options']);return db[_0x6615('0x94')]['count']({'where':_0x4bcdc7['where']})['then'](function(_0x4775f3){_0x20862f[_0x6615('0x35')]=_0x4775f3;if(_0x3ad6f0['query'][_0x6615('0x60')]){_0x4bcdc7[_0x6615('0x5b')]=[{'model':db[_0x6615('0x97')],'as':_0x6615('0x98'),'required':![]},{'model':db[_0x6615('0x99')],'as':'Owner','attributes':[_0x6615('0x41'),_0x6615('0x9a'),_0x6615('0x9b')],'required':![]},{'model':db[_0x6615('0x9c')],'as':'Tags','attributes':['id',_0x6615('0x41'),_0x6615('0x9d')],'where':_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x9e')]?{'id':_0x3ad6f0['query'][_0x6615('0x9e')]}:undefined,'required':_0x3ad6f0[_0x6615('0x4d')][_0x6615('0x9e')]?!![]:![]}];}return db[_0x6615('0x94')][_0x6615('0x72')](_0x4bcdc7);})['then'](function(_0x4560e9){_0x20862f[_0x6615('0x73')]=_0x4560e9;return _0x20862f;});}})['then'](respondWithFilteredResult(_0x2e96b3,_0x4bcdc7))[_0x6615('0x30')](handleError(_0x2e96b3,null));};exports['addApplications']=function addApplications(_0x2e5bc8,_0x479511){var _0x2aca11=_0x2e5bc8[_0x6615('0x5d')]['id'];var _0x45b895=_0x2e5bc8[_0x6615('0x62')];var _0x518bd0=0xc8;var _0x5b38fc=null;return db[_0x6615('0x9f')]['transaction']({'isolationLevel':db['sequelize'][_0x6615('0xa0')]['ISOLATION_LEVELS'][_0x6615('0xa1')]},function(_0x572761){return db[_0x6615('0x49')][_0x6615('0x70')]({'where':{'id':_0x2aca11},'transaction':_0x572761})[_0x6615('0x25')](function(_0x4fe1b5){if(_0x4fe1b5){return db[_0x6615('0xa2')][_0x6615('0x3c')]({'where':{'MailAccountId':_0x2aca11},'transaction':_0x572761})[_0x6615('0x25')](function(){var _0x38ba9a=_[_0x6615('0x48')](_0x45b895,function(_0x375e46){_0x375e46[_0x6615('0x6b')]=_0x2aca11;return _0x375e46;});return db['MailApplication']['bulkCreate'](_0x38ba9a,{'transaction':_0x572761});});}else{_0x518bd0=0x194;_0x5b38fc=[];}});})[_0x6615('0x25')](function(){if(_0x518bd0!==0x194){return db[_0x6615('0xa2')][_0x6615('0xa3')]({'where':{'MailAccountId':_0x2aca11},'order':_0x6615('0xa4')})[_0x6615('0x25')](function(_0xb289be){_0x5b38fc=_0xb289be;});}})['catch'](function(_0x18caf0){_0x518bd0=0x1f4;logger['error'](_0x18caf0[_0x6615('0x40')]);if(_0x18caf0['name']){delete _0x18caf0[_0x6615('0x41')];}_0x5b38fc=_0x18caf0;})[_0x6615('0xa5')](function(){if(_0x5b38fc===null){_0x479511[_0x6615('0x3f')](_0x518bd0);}else{if(_0x518bd0===0x1f4){_0x479511[_0x6615('0x31')](_0x518bd0)[_0x6615('0xa6')](_0x5b38fc);}else{_0x479511[_0x6615('0x31')](_0x518bd0)[_0x6615('0x38')](_0x5b38fc);}}});};exports['getApplications']=function(_0x37b420,_0x40ea7c,_0x1d702e){var _0x361710={};var _0x552b6b={};var _0x4986ab;var _0x3e19e7;return db[_0x6615('0x49')]['findOne']({'where':{'id':_0x37b420[_0x6615('0x5d')]['id']}})['then'](handleEntityNotFound(_0x40ea7c,null))['then'](function(_0x4cc87b){if(_0x4cc87b){_0x4986ab=_0x4cc87b;_0x552b6b[_0x6615('0x4c')]=_[_0x6615('0x4e')](db[_0x6615('0xa2')]['rawAttributes']);_0x552b6b[_0x6615('0x4d')]=_['keys'](_0x37b420[_0x6615('0x4d')]);_0x552b6b[_0x6615('0x4f')]=_['intersection'](_0x552b6b[_0x6615('0x4c')],_0x552b6b[_0x6615('0x4d')]);_0x361710['attributes']=_[_0x6615('0x50')](_0x552b6b[_0x6615('0x4c')],qs[_0x6615('0x52')](_0x37b420['query']['fields']));_0x361710[_0x6615('0x51')]=_0x361710[_0x6615('0x51')][_0x6615('0x6a')]?_0x361710['attributes']:_0x552b6b[_0x6615('0x4c')];_0x361710[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x37b420['query'][_0x6615('0x55')]);_0x361710[_0x6615('0x56')]=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x37b420['query'],_0x552b6b[_0x6615('0x4f')]));if(_0x37b420[_0x6615('0x4d')][_0x6615('0x58')]){_0x361710[_0x6615('0x56')]=_[_0x6615('0x59')](_0x361710[_0x6615('0x56')],{'$or':_[_0x6615('0x48')](_0x361710['attributes'],function(_0x5d4666){var _0x19a22d={};_0x19a22d[_0x5d4666]={'$like':'%'+_0x37b420[_0x6615('0x4d')][_0x6615('0x58')]+'%'};return _0x19a22d;})});}_0x361710=_[_0x6615('0x59')]({},_0x361710,_0x37b420[_0x6615('0x61')]);return _0x4986ab[_0x6615('0xa7')](_0x361710);}})[_0x6615('0x25')](function(_0x5289ce){if(_0x5289ce){_0x3e19e7=_0x5289ce['length'];if(!_0x37b420[_0x6615('0x4d')][_0x6615('0x71')](_0x6615('0x53'))){_0x361710[_0x6615('0x34')]=qs[_0x6615('0x34')](_0x37b420[_0x6615('0x4d')][_0x6615('0x34')]);_0x361710['offset']=qs[_0x6615('0x32')](_0x37b420[_0x6615('0x4d')][_0x6615('0x32')]);}return _0x4986ab['getApplications'](_0x361710);}})[_0x6615('0x25')](function(_0x591179){if(_0x591179){return _0x591179?{'count':_0x3e19e7,'rows':_0x591179}:null;}})[_0x6615('0x25')](respondWithResult(_0x40ea7c,null))['catch'](handleError(_0x40ea7c,null));};exports['getMessages']=function(_0x47b41e,_0x2e79f3,_0x5965a8){var _0x3914be={'raw':!![],'where':{}};var _0x55f87a={};var _0x59aa35={'count':0x0,'rows':[]};return db[_0x6615('0x49')][_0x6615('0x70')]({'where':{'id':_0x47b41e[_0x6615('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e79f3,null))[_0x6615('0x25')](function(_0x58aae0){if(_0x58aae0){_0x55f87a[_0x6615('0x4c')]=_[_0x6615('0x4e')](db[_0x6615('0xa8')][_0x6615('0x5f')]);_0x55f87a['query']=_[_0x6615('0x4e')](_0x47b41e[_0x6615('0x4d')]);_0x55f87a[_0x6615('0x4f')]=_[_0x6615('0x50')](_0x55f87a[_0x6615('0x4c')],_0x55f87a['query']);_0x3914be[_0x6615('0x51')]=_[_0x6615('0x50')](_0x55f87a['model'],qs[_0x6615('0x52')](_0x47b41e[_0x6615('0x4d')]['fields']));_0x3914be[_0x6615('0x51')]=_0x3914be[_0x6615('0x51')][_0x6615('0x6a')]?_0x3914be[_0x6615('0x51')]:_0x55f87a[_0x6615('0x4c')];if(!_0x47b41e[_0x6615('0x4d')][_0x6615('0x71')](_0x6615('0x53'))){_0x3914be[_0x6615('0x34')]=qs[_0x6615('0x34')](_0x47b41e['query'][_0x6615('0x34')]);_0x3914be[_0x6615('0x32')]=qs[_0x6615('0x32')](_0x47b41e['query'][_0x6615('0x32')]);}_0x3914be[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x47b41e['query'][_0x6615('0x55')]);_0x3914be[_0x6615('0x56')]=qs[_0x6615('0x4f')](_['pick'](_0x47b41e[_0x6615('0x4d')],_0x55f87a['filters']));_0x3914be[_0x6615('0x56')][_0x6615('0x6b')]=_0x58aae0['id'];if(_0x47b41e['query']['filter']){_0x3914be[_0x6615('0x56')]=_[_0x6615('0x59')](_0x3914be['where'],{'$or':_[_0x6615('0x48')](_0x3914be[_0x6615('0x51')],function(_0x298385){var _0x3bbd59={};_0x3bbd59[_0x298385]={'$like':'%'+_0x47b41e[_0x6615('0x4d')][_0x6615('0x58')]+'%'};return _0x3bbd59;})});}if(_0x47b41e[_0x6615('0x4d')][_0x6615('0xa9')]){var _0x465748=_0x47b41e[_0x6615('0x4d')]['$gte'][_0x6615('0xaa')](',');var _0x323bcd={};_0x323bcd[_0x465748[0x0]]={'$gte':moment(_0x465748[0x1])[_0x6615('0xab')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3914be[_0x6615('0x56')]=_['merge'](_0x3914be[_0x6615('0x56')],_0x323bcd);}_0x3914be=_['merge']({},_0x3914be,_0x47b41e[_0x6615('0x61')]);return db[_0x6615('0xa8')][_0x6615('0x35')]({'where':_0x3914be['where']})[_0x6615('0x25')](function(_0x3d97fc){_0x59aa35['count']=_0x3d97fc;if(_0x47b41e['query'][_0x6615('0x60')]){_0x3914be['include']=[{'all':!![]}];}return db[_0x6615('0xa8')][_0x6615('0x72')](_0x3914be);})[_0x6615('0x25')](function(_0x183a1e){if(_0x47b41e[_0x6615('0x4d')][_0x6615('0xac')]===_0x6615('0xad')){for(var _0x353cc7=0x0;_0x353cc7<_0x183a1e[_0x6615('0x6a')];_0x353cc7++){_0x183a1e[_0x353cc7]['body']=juice(_0x183a1e[_0x353cc7][_0x6615('0x62')]);}}_0x59aa35[_0x6615('0x73')]=_0x183a1e;return _0x59aa35;});}})['then'](respondWithFilteredResult(_0x2e79f3,_0x3914be))[_0x6615('0x30')](handleError(_0x2e79f3,null));};exports[_0x6615('0xa6')]=function(_0x53b3f6,_0x5195b3,_0x2caa7a){var _0x2ca3a4,_0x291073={},_0x10e65a;if(_0x53b3f6[_0x6615('0x62')]['to']){_0x10e65a=_0x53b3f6[_0x6615('0x62')]['to'][_0x6615('0xaa')](',')[0x0];}return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x53b3f6[_0x6615('0x5d')]['id']},'include':[{'model':db[_0x6615('0xae')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6615('0xaf'),'where':{'email':_0x10e65a},'limit':0x1,'order':[['updatedAt',_0x6615('0xb0')]]}]},{'model':db[_0x6615('0x45')],'as':_0x6615('0x46'),'raw':!![]}]})[_0x6615('0x25')](handleEntityNotFound(_0x5195b3,null))[_0x6615('0x25')](function(_0x4a3dd7){if(_0x4a3dd7){_0x2ca3a4=_0x4a3dd7;if(_0x4a3dd7[_0x6615('0x46')]){if(_['isNil'](_0x53b3f6[_0x6615('0x62')][_0x6615('0xb1')])){_0x53b3f6[_0x6615('0x62')][_0x6615('0xb1')]=util[_0x6615('0xab')](_0x6615('0xb2'),_0x4a3dd7[_0x6615('0x41')],_0x4a3dd7['email']||_0x4a3dd7[_0x6615('0x46')][_0x6615('0x7a')]);}if(_0x53b3f6[_0x6615('0x62')][_0x6615('0xb3')]&&_0x53b3f6['body'][_0x6615('0xb3')][_0x6615('0x6a')]){for(var _0x39ae8c=0x0;_0x39ae8c<_0x53b3f6[_0x6615('0x62')]['attachments']['length'];_0x39ae8c+=0x1){_0x53b3f6[_0x6615('0x62')][_0x6615('0xb3')][_0x39ae8c]={'filename':_0x53b3f6[_0x6615('0x62')][_0x6615('0xb3')][_0x39ae8c][_0x6615('0x41')],'path':path[_0x6615('0xb4')](config['root'],_0x6615('0xb5'),_0x53b3f6[_0x6615('0x62')]['attachments'][_0x39ae8c][_0x6615('0xb6')])};}}var _0x58d541={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4a3dd7['Smtp'][_0x6615('0x82')])){if(_0x4a3dd7['Smtp'][_0x6615('0x7f')]){_0x58d541[_0x6615('0xb7')]={'user':_0x4a3dd7['Smtp'][_0x6615('0x7a')],'pass':_0x4a3dd7[_0x6615('0x46')][_0x6615('0x7d')]};}_0x58d541[_0x6615('0x81')]=_0x4a3dd7[_0x6615('0x46')][_0x6615('0x81')];_0x58d541['port']=_0x4a3dd7[_0x6615('0x46')]['port'];_0x58d541['secure']=_0x4a3dd7[_0x6615('0x46')]['secure'];}else{_0x58d541[_0x6615('0x82')]=_0x4a3dd7['Smtp']['service'];_0x58d541[_0x6615('0xb7')]={'user':_0x4a3dd7[_0x6615('0x46')][_0x6615('0x7a')],'pass':_0x4a3dd7[_0x6615('0x46')][_0x6615('0x7d')]};}return respondWithRpcPromise(_0x6615('0xb8'),_0x6615('0xb9'),{'account':_0x58d541,'message':_0x53b3f6[_0x6615('0x62')]});}else{throw new Error(_0x6615('0xba'));}}})[_0x6615('0x25')](function(_0x1bab9a){if(_0x1bab9a){_0x291073=_0x1bab9a;if(_0x2ca3a4[_0x6615('0xbb')]){if(_0x2ca3a4[_0x6615('0xbb')][_0x6615('0xaf')][_0x6615('0x6a')]){return _0x2ca3a4[_0x6615('0xbb')][_0x6615('0xaf')][0x0];}else{return db[_0x6615('0x97')]['create'](_[_0x6615('0x1f')](_0x53b3f6[_0x6615('0x62')],{'firstName':_0x53b3f6[_0x6615('0x62')]['to'],'email':_0x53b3f6[_0x6615('0x62')]['to'],'phone':_0x53b3f6[_0x6615('0x62')]['to'],'ListId':_0x2ca3a4[_0x6615('0x76')]}));}}else{throw new Error(_0x6615('0xba'));}}})['then'](function(_0x2a5ab3){if(_0x2a5ab3){var _0x2afe21={'UserId':_0x53b3f6[_0x6615('0x7a')]['id'],'ContactId':_0x2a5ab3['id'],'MailAccountId':_0x2ca3a4['id'],'inReplyTo':_0x291073[_0x6615('0xbc')],'to':_0x53b3f6[_0x6615('0x62')][_0x6615('0xb1')],'cc':_0x53b3f6[_0x6615('0x62')]['cc'],'subject':_0x53b3f6[_0x6615('0x62')]['subject'],'attach':_0x53b3f6[_0x6615('0x62')][_0x6615('0xbd')],'firstMsgDirection':_0x6615('0xbe'),'lastMsgAt':moment()[_0x6615('0xab')](_0x6615('0xbf')),'lastMsgDirection':_0x6615('0xbe'),'Messages':[_[_0x6615('0x59')](_0x53b3f6[_0x6615('0x62')],{'messageId':_0x291073[_0x6615('0xbc')],'sentAt':moment()[_0x6615('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2ca3a4['id'],'UserId':_0x53b3f6[_0x6615('0x7a')]['id'],'ContactId':_0x2a5ab3['id']})]};if(_0x53b3f6[_0x6615('0x62')][_0x6615('0xc0')]){_0x2afe21=_[_0x6615('0x59')](_0x2afe21,_0x53b3f6[_0x6615('0x62')][_0x6615('0xc0')]);}return db[_0x6615('0x94')][_0x6615('0x68')](_0x2afe21,{'include':[{'model':db[_0x6615('0xa8')],'as':'Messages'}]});}})[_0x6615('0x25')](respondWithResult(_0x5195b3,null))[_0x6615('0x30')](handleError(_0x5195b3,null));};exports['verifySmtp']=function(_0x1ebced,_0x24323e,_0x3b59f3){return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x1ebced[_0x6615('0x5d')]['id']},'include':[{'model':db[_0x6615('0x45')],'as':_0x6615('0x46'),'raw':!![]}]})[_0x6615('0x25')](handleEntityNotFound(_0x24323e,null))[_0x6615('0x25')](function(_0x5ec4d4){if(_0x5ec4d4&&_0x5ec4d4[_0x6615('0x46')]){var _0x476cba={'id':_0x5ec4d4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5ec4d4['Smtp'][_0x6615('0x82')]){_0x476cba[_0x6615('0x82')]=_0x5ec4d4[_0x6615('0x46')][_0x6615('0x82')];}else{_0x476cba[_0x6615('0x81')]=_0x5ec4d4[_0x6615('0x46')][_0x6615('0x81')];_0x476cba[_0x6615('0x80')]=_0x5ec4d4['Smtp'][_0x6615('0x80')];_0x476cba[_0x6615('0xc1')]=_0x5ec4d4[_0x6615('0x46')]['secure'];}if(_0x5ec4d4[_0x6615('0x46')][_0x6615('0x7f')]){_0x476cba[_0x6615('0xb7')]={'user':_0x5ec4d4[_0x6615('0x46')][_0x6615('0x7a')],'pass':_0x5ec4d4[_0x6615('0x46')]['pass']};}return respondWithRpcPromise(_0x6615('0xc2'),_0x6615('0xc3'),{'account':_0x476cba});}})[_0x6615('0x25')](respondWithResult(_0x24323e,null))[_0x6615('0x30')](handleError(_0x24323e,null));};exports[_0x6615('0x3c')]=function(_0x1b4066,_0x321abb){return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x1b4066[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x321abb,null))[_0x6615('0x25')](function(_0x39a3cf){if(_0x39a3cf&&_0x39a3cf[_0x6615('0x82')]){throw new db['Sequelize'][(_0x6615('0xc4'))](_0x6615('0xc5'));}return _0x39a3cf;})['then'](removeEntity(_0x321abb,null))[_0x6615('0x30')](handleError(_0x321abb,null));};exports['addAgents']=function(_0x5333af,_0x39b30f,_0x13e768){return db[_0x6615('0x49')][_0x6615('0x63')]({'where':{'id':_0x5333af[_0x6615('0x5d')]['id']}})['then'](handleEntityNotFound(_0x39b30f,null))[_0x6615('0x25')](function(_0x4daced){if(_0x4daced){return _0x4daced['addAgents'](_0x5333af[_0x6615('0x62')][_0x6615('0xc6')],_[_0x6615('0x95')](_0x5333af[_0x6615('0x62')],['ids','id'])||{})[_0x6615('0xc7')](function(_0x4fff16){for(var _0x51c794=0x0;_0x51c794<_0x5333af[_0x6615('0x62')][_0x6615('0xc6')][_0x6615('0x6a')];_0x51c794+=0x1){socket['emit'](_0x6615('0xc8'),{'UserId':Number(_0x5333af[_0x6615('0x62')]['ids'][_0x51c794]),'MailAccountId':Number(_0x5333af[_0x6615('0x5d')]['id'])});}return _0x4fff16;});}})['then'](respondWithResult(_0x39b30f,null))[_0x6615('0x30')](handleError(_0x39b30f,null));};exports[_0x6615('0xc9')]=function(_0x2db232,_0x25fae1,_0x13863d){return db['MailAccount'][_0x6615('0x63')]({'where':{'id':_0x2db232[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0x25fae1,null))[_0x6615('0x25')](function(_0x4358a1){if(_0x4358a1){return _0x4358a1[_0x6615('0xc9')](_0x2db232[_0x6615('0x4d')][_0x6615('0xc6')])['then'](function(){if(_[_0x6615('0xca')](_0x2db232[_0x6615('0x4d')][_0x6615('0xc6')])){for(var _0x4f4e46=0x0;_0x4f4e46<_0x2db232[_0x6615('0x4d')][_0x6615('0xc6')]['length'];_0x4f4e46+=0x1){socket[_0x6615('0xcb')](_0x6615('0xcc'),{'UserId':Number(_0x2db232[_0x6615('0x4d')][_0x6615('0xc6')][_0x4f4e46]),'MailAccountId':Number(_0x2db232[_0x6615('0x5d')]['id'])});}}else{socket[_0x6615('0xcb')]('userMailAccount:remove',{'UserId':Number(_0x2db232[_0x6615('0x4d')][_0x6615('0xc6')]),'MailAccountId':Number(_0x2db232[_0x6615('0x5d')]['id'])});}});}})[_0x6615('0x25')](respondWithStatusCode(_0x25fae1,null))['catch'](handleError(_0x25fae1,null));};exports['getAgents']=function(_0x1bd15a,_0xcd1a68,_0x2f78ac){var _0x32a800={};var _0x59b173={};var _0x3e584b;var _0x24d068;return db['MailAccount'][_0x6615('0x70')]({'where':{'id':_0x1bd15a[_0x6615('0x5d')]['id']}})[_0x6615('0x25')](handleEntityNotFound(_0xcd1a68,null))[_0x6615('0x25')](function(_0x336d1c){if(_0x336d1c){_0x3e584b=_0x336d1c;_0x59b173[_0x6615('0x4c')]=_[_0x6615('0x4e')](db[_0x6615('0x99')][_0x6615('0x5f')]);_0x59b173[_0x6615('0x4d')]=_['keys'](_0x1bd15a[_0x6615('0x4d')]);_0x59b173['filters']=_[_0x6615('0x50')](_0x59b173[_0x6615('0x4c')],_0x59b173[_0x6615('0x4d')]);_0x32a800[_0x6615('0x51')]=_['intersection'](_0x59b173[_0x6615('0x4c')],qs[_0x6615('0x52')](_0x1bd15a['query'][_0x6615('0x52')]));_0x32a800[_0x6615('0x51')]=_0x32a800['attributes'][_0x6615('0x6a')]?_0x32a800['attributes']:_0x59b173[_0x6615('0x4c')];_0x32a800[_0x6615('0x54')]=qs[_0x6615('0x55')](_0x1bd15a['query'][_0x6615('0x55')]);_0x32a800[_0x6615('0x56')]=qs[_0x6615('0x4f')](_[_0x6615('0x57')](_0x1bd15a[_0x6615('0x4d')],_0x59b173[_0x6615('0x4f')]));if(_0x1bd15a[_0x6615('0x4d')][_0x6615('0x58')]){_0x32a800[_0x6615('0x56')]=_[_0x6615('0x59')](_0x32a800[_0x6615('0x56')],{'$or':_[_0x6615('0x48')](_0x32a800[_0x6615('0x51')],function(_0x3151bd){var _0x37b065={};_0x37b065[_0x3151bd]={'$like':'%'+_0x1bd15a['query']['filter']+'%'};return _0x37b065;})});}_0x32a800=_['merge']({},_0x32a800,_0x1bd15a[_0x6615('0x61')]);return _0x3e584b[_0x6615('0xcd')](_0x32a800);}})['then'](function(_0x3b3e8f){if(_0x3b3e8f){_0x24d068=_0x3b3e8f[_0x6615('0x6a')];if(!_0x1bd15a[_0x6615('0x4d')][_0x6615('0x71')](_0x6615('0x53'))){_0x32a800['limit']=qs['limit'](_0x1bd15a[_0x6615('0x4d')]['limit']);_0x32a800[_0x6615('0x32')]=qs[_0x6615('0x32')](_0x1bd15a[_0x6615('0x4d')]['offset']);}return _0x3e584b[_0x6615('0xcd')](_0x32a800);}})['then'](function(_0x4ab9cb){if(_0x4ab9cb){return _0x4ab9cb?{'count':_0x24d068,'rows':_0x4ab9cb}:null;}})[_0x6615('0x25')](respondWithResult(_0xcd1a68,null))['catch'](handleError(_0xcd1a68,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 74b5a73..4394b8d 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 _0x479b=['exports','events','../../mysqldb','MailAccount','save','update','emit','hasOwnProperty'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x479b,0x151));var _0xb479=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x479b[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0xb479('0x0'));var MailAccount=require(_0xb479('0x1'))['db'][_0xb479('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb479('0x3'),'afterUpdate':_0xb479('0x4'),'afterDestroy':'remove'};function emitEvent(_0x545354){return function(_0x48849c,_0x20f8dd,_0x2b4a9d){MailAccountEvents['emit'](_0x545354+':'+_0x48849c['id'],_0x48849c);MailAccountEvents[_0xb479('0x5')](_0x545354,_0x48849c);_0x2b4a9d(null);};}for(var e in events){if(events[_0xb479('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb479('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x5458=['../../mysqldb','MailAccount','save','update','emit','hasOwnProperty','hook','events'];(function(_0x20b793,_0x258dc7){var _0x204535=function(_0x56a8c6){while(--_0x56a8c6){_0x20b793['push'](_0x20b793['shift']());}};_0x204535(++_0x258dc7);}(_0x5458,0x1c7));var _0x8545=function(_0x179f07,_0x4763dc){_0x179f07=_0x179f07-0x0;var _0x12d6d1=_0x5458[_0x179f07];return _0x12d6d1;};'use strict';var EventEmitter=require(_0x8545('0x0'));var MailAccount=require(_0x8545('0x1'))['db'][_0x8545('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8545('0x3'),'afterUpdate':_0x8545('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35d361){return function(_0x1d3a7b,_0x31e7cf,_0x4dee65){MailAccountEvents[_0x8545('0x5')](_0x35d361+':'+_0x1d3a7b['id'],_0x1d3a7b);MailAccountEvents[_0x8545('0x5')](_0x35d361,_0x1d3a7b);_0x4dee65(null);};}for(var e in events){if(events[_0x8545('0x6')](e)){var event=events[e];MailAccount[_0x8545('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 904576e..b374f32 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 _0x51fa=['rimraf','../../config/environment','MailAccount','mail_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51fa,0x164));var _0xa51f=function(_0x1fc0b0,_0x59eeb0){_0x1fc0b0=_0x1fc0b0-0x0;var _0x5e59c9=_0x51fa[_0x1fc0b0];return _0x5e59c9;};'use strict';var _=require(_0xa51f('0x0'));var util=require(_0xa51f('0x1'));var logger=require(_0xa51f('0x2'))('api');var moment=require(_0xa51f('0x3'));var BPromise=require(_0xa51f('0x4'));var rp=require(_0xa51f('0x5'));var fs=require('fs');var path=require(_0xa51f('0x6'));var rimraf=require(_0xa51f('0x7'));var config=require(_0xa51f('0x8'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x28c3d6,_0x348cec){return _0x28c3d6['define'](_0xa51f('0x9'),attributes,{'tableName':_0xa51f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b0c=['path','../../config/environment','./mailAccount.attributes','define','MailAccount','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2d3a72,_0x3e591d){var _0x5f2a1c=function(_0x184948){while(--_0x184948){_0x2d3a72['push'](_0x2d3a72['shift']());}};_0x5f2a1c(++_0x3e591d);}(_0x3b0c,0xcd));var _0xc3b0=function(_0x5c0fc4,_0x1b114a){_0x5c0fc4=_0x5c0fc4-0x0;var _0x975db6=_0x3b0c[_0x5c0fc4];return _0x975db6;};'use strict';var _=require('lodash');var util=require(_0xc3b0('0x0'));var logger=require(_0xc3b0('0x1'))(_0xc3b0('0x2'));var moment=require('moment');var BPromise=require(_0xc3b0('0x3'));var rp=require(_0xc3b0('0x4'));var fs=require('fs');var path=require(_0xc3b0('0x5'));var rimraf=require('rimraf');var config=require(_0xc3b0('0x6'));var attributes=require(_0xc3b0('0x7'));module['exports']=function(_0x5e253c,_0x56f630){return _0x5e253c[_0xc3b0('0x8')](_0xc3b0('0x9'),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 4ae9717..8ef23dc 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 _0x14b1=['then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailAccount','options','raw','where','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','find','body','mail','difference','keys','CmContact','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','priority','asc','account','autoclose','push','length','close','*,*,*,*','ListId','List\x20not\x20found','contact','messageId','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./mailAccount.socket','request'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x14b1,0x18e));var _0x114b=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0x14b1[_0x2d9535];return _0xb4e710;};'use strict';var _=require(_0x114b('0x0'));var util=require(_0x114b('0x1'));var moment=require(_0x114b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x114b('0x3'));var db=require(_0x114b('0x4'))['db'];var utils=require(_0x114b('0x5'));var logger=require(_0x114b('0x6'))(_0x114b('0x7'));var config=require(_0x114b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x114b('0x9')]['http']({'port':0x232c});config[_0x114b('0xa')]=_[_0x114b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x114b('0xa')]));require(_0x114b('0xc'))['register'](socket);function respondWithRpcPromise(_0x665108,_0x11e137,_0x4bae5e){return new BPromise(function(_0x53ee8d,_0xe8a54b){return client[_0x114b('0xd')](_0x665108,_0x4bae5e)[_0x114b('0xe')](function(_0x5872d7){logger[_0x114b('0xf')](_0x114b('0x10'),_0x11e137,_0x114b('0x11'));logger['debug'](_0x114b('0x12'),_0x11e137,_0x114b('0x11'),JSON[_0x114b('0x13')](_0x5872d7));if(_0x5872d7[_0x114b('0x14')]){if(_0x5872d7[_0x114b('0x14')][_0x114b('0x15')]===0x1f4){logger[_0x114b('0x14')](_0x114b('0x10'),_0x11e137,_0x5872d7['error'][_0x114b('0x16')]);return _0xe8a54b(_0x5872d7[_0x114b('0x14')]['message']);}logger[_0x114b('0x14')](_0x114b('0x10'),_0x11e137,_0x5872d7['error'][_0x114b('0x16')]);return _0x53ee8d(_0x5872d7['error'][_0x114b('0x16')]);}else{logger[_0x114b('0xf')](_0x114b('0x10'),_0x11e137,'request\x20sent');_0x53ee8d(_0x5872d7['result']['message']);}})[_0x114b('0x17')](function(_0x5ebac7){logger[_0x114b('0x14')](_0x114b('0x10'),_0x11e137,_0x5ebac7);_0xe8a54b(_0x5ebac7);});});}exports['GetMailAccount']=function(_0x40e3f8){var _0x20550a=this;return new Promise(function(_0x7ccc8b,_0x1a28bc){return db[_0x114b('0x18')]['findAll']({'raw':_0x40e3f8[_0x114b('0x19')]?_0x40e3f8[_0x114b('0x19')][_0x114b('0x1a')]===undefined?!![]:![]:!![],'where':_0x40e3f8[_0x114b('0x19')]?_0x40e3f8[_0x114b('0x19')][_0x114b('0x1b')]||null:null,'attributes':_0x40e3f8[_0x114b('0x19')]?_0x40e3f8[_0x114b('0x19')][_0x114b('0x1c')]||null:null,'limit':_0x40e3f8[_0x114b('0x19')]?_0x40e3f8[_0x114b('0x19')][_0x114b('0x1d')]||null:null,'include':_0x40e3f8[_0x114b('0x19')]?_0x40e3f8[_0x114b('0x19')][_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x40e3f8[_0x114b('0x19')][_0x114b('0x1e')],function(_0x9e7425){return{'model':db[_0x9e7425['model']],'as':_0x9e7425['as'],'attributes':_0x9e7425[_0x114b('0x1c')],'include':_0x9e7425[_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x9e7425[_0x114b('0x1e')],function(_0x3cb41b){return{'model':db[_0x3cb41b[_0x114b('0x20')]],'as':_0x3cb41b['as'],'attributes':_0x3cb41b['attributes'],'include':_0x3cb41b[_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x3cb41b[_0x114b('0x1e')],function(_0x2f2dc0){return{'model':db[_0x2f2dc0['model']],'as':_0x2f2dc0['as'],'attributes':_0x2f2dc0['attributes']};}):[]};}):[]};}):[]:[]})[_0x114b('0xe')](function(_0x25f494){logger[_0x114b('0xf')](_0x114b('0x21'),_0x40e3f8);logger[_0x114b('0x22')]('GetMailAccount',_0x40e3f8,JSON[_0x114b('0x13')](_0x25f494));_0x7ccc8b(_0x25f494);})[_0x114b('0x17')](function(_0x4e8a15){logger[_0x114b('0x14')]('GetMailAccount',_0x4e8a15[_0x114b('0x16')],_0x40e3f8);_0x1a28bc(_0x20550a['error'](0x1f4,_0x4e8a15[_0x114b('0x16')]));});});};exports[_0x114b('0x23')]=function(_0x33fb0c){var _0x2a4572=this;return new Promise(function(_0x301c06,_0x16df42){return db[_0x114b('0x18')][_0x114b('0x24')]({'raw':_0x33fb0c[_0x114b('0x19')]?_0x33fb0c[_0x114b('0x19')][_0x114b('0x1a')]===undefined?!![]:![]:!![],'where':_0x33fb0c[_0x114b('0x19')]?_0x33fb0c[_0x114b('0x19')][_0x114b('0x1b')]||null:null,'attributes':_0x33fb0c[_0x114b('0x19')]?_0x33fb0c[_0x114b('0x19')][_0x114b('0x1c')]||null:null,'include':_0x33fb0c[_0x114b('0x19')]?_0x33fb0c['options'][_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x33fb0c['options']['include'],function(_0x166372){return{'model':db[_0x166372[_0x114b('0x20')]],'as':_0x166372['as'],'attributes':_0x166372[_0x114b('0x1c')],'include':_0x166372[_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x166372['include'],function(_0x144ba6){return{'model':db[_0x144ba6[_0x114b('0x20')]],'as':_0x144ba6['as'],'attributes':_0x144ba6[_0x114b('0x1c')],'include':_0x144ba6[_0x114b('0x1e')]?_[_0x114b('0x1f')](_0x144ba6[_0x114b('0x1e')],function(_0x987e56){return{'model':db[_0x987e56['model']],'as':_0x987e56['as'],'attributes':_0x987e56[_0x114b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x114b('0xe')](function(_0x5e1866){logger[_0x114b('0xf')](_0x114b('0x23'),_0x33fb0c);logger[_0x114b('0x22')](_0x114b('0x23'),_0x33fb0c,JSON[_0x114b('0x13')](_0x5e1866));_0x301c06(_0x5e1866);})[_0x114b('0x17')](function(_0x37eea5){logger['error'](_0x114b('0x23'),_0x37eea5['message'],_0x33fb0c);_0x16df42(_0x2a4572['error'](0x1f4,_0x37eea5[_0x114b('0x16')]));});});};exports['NotifyMailAccount']=function(_0x43a9ec){var _0x117258=this;return new Promise(function(_0x5998db,_0x8dcaaa){var _0x58e334={'body':_0x43a9ec[_0x114b('0x25')],'channel':_0x114b('0x26')};var _0x459471=_[_0x114b('0x27')](_[_0x114b('0x28')](db[_0x114b('0x29')]['rawAttributes']),[_0x114b('0x2a'),_0x114b('0x2b'),'CompanyId','ListId']);var _0x26d473=![];if(_0x43a9ec['body']['id']){delete _0x43a9ec[_0x114b('0x25')]['id'];}if(_[_0x114b('0x2c')](_0x43a9ec[_0x114b('0x25')][_0x114b('0x2d')])){return _0x8dcaaa(_0x117258[_0x114b('0x14')](0x1f4,_0x114b('0x2e')));}if(_[_0x114b('0x2c')](_0x43a9ec[_0x114b('0x25')][_0x114b('0x25')])||_0x43a9ec[_0x114b('0x25')][_0x114b('0x25')]===''){return _0x8dcaaa(_0x117258[_0x114b('0x14')](0x1f4,_0x114b('0x2f')));}if(_[_0x114b('0x2c')](_0x43a9ec[_0x114b('0x25')][_0x114b('0x30')])){return _0x8dcaaa(_0x117258['error'](0x1f4,_0x114b('0x31')+_0x459471));}if(!_[_0x114b('0x32')](_0x459471,_0x43a9ec['body'][_0x114b('0x30')])){return _0x8dcaaa(_0x117258[_0x114b('0x14')](0x1f4,_0x114b('0x33')+_0x459471));}var _0x598fd4={};_0x598fd4[_0x43a9ec[_0x114b('0x25')]['mapKey']]=_0x43a9ec[_0x114b('0x25')][_0x114b('0x2d')];return db[_0x114b('0x18')][_0x114b('0x24')]({'where':{'id':_0x43a9ec['account']['id']},'include':[{'model':db[_0x114b('0x34')],'as':_0x114b('0x35'),'include':[{'model':db[_0x114b('0x29')],'as':_0x114b('0x36'),'where':_0x598fd4,'limit':0x1,'order':[[_0x114b('0x2b'),_0x114b('0x37')]]}]},{'model':db[_0x114b('0x38')],'as':_0x114b('0x39')},{'model':db['MailServerOut'],'as':_0x114b('0x3a')}]})[_0x114b('0xe')](function(_0x183dfe){if(_0x183dfe&&_0x183dfe['List']){var _0x3f119b=_0x183dfe[_0x114b('0x3b')]({'plain':!![]});_0x58e334['account']=_[_0x114b('0x3c')](_0x3f119b,[_0x114b('0x39'),_0x114b('0x35')]);_0x58e334[_0x114b('0x3d')]=_0x3f119b[_0x114b('0x39')];_0x58e334[_0x114b('0x3e')]=_0x3f119b[_0x114b('0x35')];_0x58e334[_0x114b('0x3d')]=_['orderBy'](_0x58e334[_0x114b('0x3d')],[_0x114b('0x3f')],[_0x114b('0x40')]);if(_0x58e334[_0x114b('0x41')]&&_0x58e334[_0x114b('0x41')][_0x114b('0x42')]){_0x58e334[_0x114b('0x3d')][_0x114b('0x43')]({'id':0x0,'priority':_0x58e334[_0x114b('0x3d')][_0x114b('0x44')]+0x1,'app':_0x114b('0x45'),'appdata':_0x114b('0x42'),'interval':_0x114b('0x46')});}if(_0x58e334[_0x114b('0x41')][_0x114b('0x39')]){delete _0x58e334[_0x114b('0x41')][_0x114b('0x39')];}if(_0x58e334['account'][_0x114b('0x35')]){delete _0x58e334[_0x114b('0x41')][_0x114b('0x35')];}if(_0x3f119b[_0x114b('0x35')]['Contacts'][_0x114b('0x44')]){return _0x3f119b['List'][_0x114b('0x36')][0x0];}var _0x569f2c=_['defaults'](_0x43a9ec[_0x114b('0x25')],{'firstName':_0x43a9ec[_0x114b('0x25')][_0x114b('0x2d')],'ListId':_0x3f119b[_0x114b('0x47')]});_0x569f2c[_0x43a9ec[_0x114b('0x25')][_0x114b('0x30')]]=_0x43a9ec[_0x114b('0x25')][_0x114b('0x2d')];return db[_0x114b('0x29')]['create'](_0x569f2c);}else{throw new Error(_0x114b('0x48'));}})[_0x114b('0xe')](function(_0x2234d3){_0x58e334[_0x114b('0x49')]=_0x2234d3;if(_0x2234d3){if(!_0x43a9ec[_0x114b('0x25')]['message'][_0x114b('0x4a')]){_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')]['messageId']=rs['generate']()+'\x20'+_0x43a9ec['body']['message'][_0x114b('0x2d')];}var _0x565351={'ContactId':_0x2234d3['id'],'MailAccountId':_0x43a9ec[_0x114b('0x41')]['id'],'inReplyTo':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x4a')],'to':_0x43a9ec[_0x114b('0x25')]['message']['from'],'cc':_0x43a9ec[_0x114b('0x25')]['message']['cc'],'subject':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')]['subject'],'attach':_0x43a9ec[_0x114b('0x25')]['message'][_0x114b('0x4b')],'lastMsgAt':moment()[_0x114b('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x114b('0x4d')][_0x114b('0x24')]({'where':{'closed':![],'MailAccountId':_0x43a9ec[_0x114b('0x41')]['id']},'include':[{'model':db[_0x114b('0x4e')],'as':_0x114b('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x50')]}}]})[_0x114b('0xe')](function(_0x3329bf){if(_0x3329bf){return[_0x3329bf,![]];}return db[_0x114b('0x4d')][_0x114b('0x51')](_0x565351)[_0x114b('0xe')](function(_0x5057b2){return[_0x5057b2,!![]];});});}else{throw new Error(_0x114b('0x52'));}})[_0x114b('0x53')](function(_0x2a7466,_0x4bc579){if(_0x2a7466){_0x26d473=_0x4bc579;if(!_0x4bc579){return _0x2a7466[_0x114b('0x54')]({'inReplyTo':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x4a')],'to':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x2d')],'cc':_0x43a9ec[_0x114b('0x25')]['message']['cc'],'subject':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x55')],'attach':_0x2a7466[_0x114b('0x4b')]?_0x2a7466[_0x114b('0x4b')]:_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x4b')],'substatus':null,'substatusAt':moment()[_0x114b('0x4c')](_0x114b('0x56')),'lastMsgAt':moment()['format'](_0x114b('0x56')),'lastMsgDirection':'in'});}else{return _0x2a7466;}}})[_0x114b('0xe')](function(_0x18b2cf){_0x58e334[_0x114b('0x57')]=_0x18b2cf[_0x114b('0x3b')]({'plain':!![]});_0x58e334[_0x114b('0x57')]['created']=_0x26d473;return db['MailMessage'][_0x114b('0x51')]({'body':_0x43a9ec[_0x114b('0x25')][_0x114b('0x25')],'MailAccountId':_0x43a9ec[_0x114b('0x41')]['id'],'MailInteractionId':_0x18b2cf['id'],'direction':'in','ContactId':_0x58e334[_0x114b('0x49')]['id'],'messageId':_0x43a9ec['body'][_0x114b('0x16')][_0x114b('0x4a')],'from':_0x43a9ec[_0x114b('0x25')]['message']['from'],'to':_0x43a9ec[_0x114b('0x25')]['message']['to'],'cc':_0x43a9ec['body']['message']['cc'],'subject':_0x43a9ec[_0x114b('0x25')]['message'][_0x114b('0x55')],'attach':_0x43a9ec['body']['message'][_0x114b('0x4b')],'Attachments':_0x43a9ec[_0x114b('0x25')]['message']['attachments'],'originTo':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x58')],'originCc':_0x43a9ec['body'][_0x114b('0x16')][_0x114b('0x59')],'bcc':_0x43a9ec[_0x114b('0x25')]['message'][_0x114b('0x5a')],'ChatWebsiteId':_0x43a9ec[_0x114b('0x25')]['message'][_0x114b('0x5b')]||null,'originChannel':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x5c')]||'Email','ChatOfflineMessageId':_0x43a9ec[_0x114b('0x25')][_0x114b('0x16')][_0x114b('0x5d')]||null},{'include':[{'model':db['Attachment'],'as':_0x114b('0x5e')}]});})[_0x114b('0xe')](function(_0x434900){_0x58e334[_0x114b('0x16')]=_0x434900;if(_0x58e334[_0x114b('0x57')][_0x114b('0x5f')]){return db[_0x114b('0x60')][_0x114b('0x24')]({'attributes':['id',_0x114b('0x61')],'where':{'id':_0x58e334['interaction'][_0x114b('0x5f')]}})[_0x114b('0xe')](function(_0x1e59fb){if(_0x1e59fb){_0x58e334[_0x114b('0x3d')][_0x114b('0x62')]({'id':0x0,'priority':0x0,'app':_0x114b('0x63'),'appdata':_0x1e59fb[_0x114b('0x61')]+','+(_0x58e334[_0x114b('0x41')][_0x114b('0x64')]||0xa),'interval':_0x114b('0x46')});}return respondWithRpcPromise(_0x114b('0x65'),_0x114b('0x66'),_0x58e334);});}return respondWithRpcPromise('Start',_0x114b('0x66'),_0x58e334);})[_0x114b('0xe')](function(_0x5a3653){_0x5998db(_0x5a3653);})[_0x114b('0x17')](function(_0x4e1128){_0x8dcaaa(_0x117258[_0x114b('0x14')](0x1f4,_0x4e1128[_0x114b('0x16')]));});});}; \ No newline at end of file +var _0x4701=['agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','MailServerOut','Smtp','get','Applications','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','List\x20not\x20found','contact','messageId','generate','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','create','attachments','originTo','bcc','ChatWebsiteId','Attachment','Attachments','UserId','User','name','unshift'];(function(_0x2ccf68,_0x1d41df){var _0x2793f7=function(_0x3351af){while(--_0x3351af){_0x2ccf68['push'](_0x2ccf68['shift']());}};_0x2793f7(++_0x1d41df);}(_0x4701,0x145));var _0x1470=function(_0x968110,_0x9c78e5){_0x968110=_0x968110-0x0;var _0x311eb7=_0x4701[_0x968110];return _0x311eb7;};'use strict';var _=require(_0x1470('0x0'));var util=require(_0x1470('0x1'));var moment=require(_0x1470('0x2'));var BPromise=require(_0x1470('0x3'));var rs=require(_0x1470('0x4'));var fs=require('fs');var Redis=require(_0x1470('0x5'));var db=require(_0x1470('0x6'))['db'];var utils=require(_0x1470('0x7'));var logger=require(_0x1470('0x8'))(_0x1470('0x9'));var config=require('../../config/environment');var jayson=require(_0x1470('0xa'));var client=jayson[_0x1470('0xb')][_0x1470('0xc')]({'port':0x232c});config[_0x1470('0xd')]=_[_0x1470('0xe')](config[_0x1470('0xd')],{'host':_0x1470('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1470('0xd')]));require(_0x1470('0x10'))[_0x1470('0x11')](socket);function respondWithRpcPromise(_0x3b183c,_0x17c061,_0x229e90){return new BPromise(function(_0x77e2a6,_0x2b3506){return client[_0x1470('0x12')](_0x3b183c,_0x229e90)[_0x1470('0x13')](function(_0x169859){logger[_0x1470('0x14')](_0x1470('0x15'),_0x17c061,_0x1470('0x16'));logger['debug'](_0x1470('0x17'),_0x17c061,_0x1470('0x16'),JSON[_0x1470('0x18')](_0x169859));if(_0x169859['error']){if(_0x169859[_0x1470('0x19')][_0x1470('0x1a')]===0x1f4){logger[_0x1470('0x19')](_0x1470('0x15'),_0x17c061,_0x169859[_0x1470('0x19')][_0x1470('0x1b')]);return _0x2b3506(_0x169859['error'][_0x1470('0x1b')]);}logger[_0x1470('0x19')]('MailAccount,\x20%s,\x20%s',_0x17c061,_0x169859[_0x1470('0x19')][_0x1470('0x1b')]);return _0x77e2a6(_0x169859[_0x1470('0x19')][_0x1470('0x1b')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x17c061,_0x1470('0x16'));_0x77e2a6(_0x169859[_0x1470('0x1c')][_0x1470('0x1b')]);}})[_0x1470('0x1d')](function(_0x5e32c6){logger[_0x1470('0x19')](_0x1470('0x15'),_0x17c061,_0x5e32c6);_0x2b3506(_0x5e32c6);});});}exports[_0x1470('0x1e')]=function(_0x23b14e){var _0x3d0441=this;return new Promise(function(_0x72a1ae,_0x26992d){return db[_0x1470('0x1f')]['findAll']({'raw':_0x23b14e[_0x1470('0x20')]?_0x23b14e[_0x1470('0x20')][_0x1470('0x21')]===undefined?!![]:![]:!![],'where':_0x23b14e[_0x1470('0x20')]?_0x23b14e['options'][_0x1470('0x22')]||null:null,'attributes':_0x23b14e[_0x1470('0x20')]?_0x23b14e[_0x1470('0x20')][_0x1470('0x23')]||null:null,'limit':_0x23b14e['options']?_0x23b14e[_0x1470('0x20')][_0x1470('0x24')]||null:null,'include':_0x23b14e['options']?_0x23b14e[_0x1470('0x20')][_0x1470('0x25')]?_[_0x1470('0x26')](_0x23b14e[_0x1470('0x20')][_0x1470('0x25')],function(_0x318b4c){return{'model':db[_0x318b4c['model']],'as':_0x318b4c['as'],'attributes':_0x318b4c['attributes'],'include':_0x318b4c['include']?_[_0x1470('0x26')](_0x318b4c[_0x1470('0x25')],function(_0x5bc040){return{'model':db[_0x5bc040[_0x1470('0x27')]],'as':_0x5bc040['as'],'attributes':_0x5bc040[_0x1470('0x23')],'include':_0x5bc040[_0x1470('0x25')]?_[_0x1470('0x26')](_0x5bc040[_0x1470('0x25')],function(_0x2eea2e){return{'model':db[_0x2eea2e['model']],'as':_0x2eea2e['as'],'attributes':_0x2eea2e[_0x1470('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1470('0x13')](function(_0x41c8b4){logger[_0x1470('0x14')](_0x1470('0x1e'),_0x23b14e);logger[_0x1470('0x28')](_0x1470('0x1e'),_0x23b14e,JSON[_0x1470('0x18')](_0x41c8b4));_0x72a1ae(_0x41c8b4);})['catch'](function(_0x5b31b4){logger['error'](_0x1470('0x1e'),_0x5b31b4[_0x1470('0x1b')],_0x23b14e);_0x26992d(_0x3d0441[_0x1470('0x19')](0x1f4,_0x5b31b4[_0x1470('0x1b')]));});});};exports[_0x1470('0x29')]=function(_0x4198b8){var _0xe9d187=this;return new Promise(function(_0x470620,_0x145f40){return db[_0x1470('0x1f')][_0x1470('0x2a')]({'raw':_0x4198b8[_0x1470('0x20')]?_0x4198b8[_0x1470('0x20')][_0x1470('0x21')]===undefined?!![]:![]:!![],'where':_0x4198b8[_0x1470('0x20')]?_0x4198b8[_0x1470('0x20')][_0x1470('0x22')]||null:null,'attributes':_0x4198b8[_0x1470('0x20')]?_0x4198b8[_0x1470('0x20')][_0x1470('0x23')]||null:null,'include':_0x4198b8[_0x1470('0x20')]?_0x4198b8[_0x1470('0x20')][_0x1470('0x25')]?_[_0x1470('0x26')](_0x4198b8[_0x1470('0x20')][_0x1470('0x25')],function(_0x1ad9a6){return{'model':db[_0x1ad9a6[_0x1470('0x27')]],'as':_0x1ad9a6['as'],'attributes':_0x1ad9a6[_0x1470('0x23')],'include':_0x1ad9a6[_0x1470('0x25')]?_[_0x1470('0x26')](_0x1ad9a6[_0x1470('0x25')],function(_0x6b1037){return{'model':db[_0x6b1037['model']],'as':_0x6b1037['as'],'attributes':_0x6b1037[_0x1470('0x23')],'include':_0x6b1037[_0x1470('0x25')]?_['map'](_0x6b1037[_0x1470('0x25')],function(_0x483628){return{'model':db[_0x483628['model']],'as':_0x483628['as'],'attributes':_0x483628[_0x1470('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1470('0x13')](function(_0x50999e){logger[_0x1470('0x14')]('ShowMailAccount',_0x4198b8);logger[_0x1470('0x28')](_0x1470('0x29'),_0x4198b8,JSON[_0x1470('0x18')](_0x50999e));_0x470620(_0x50999e);})['catch'](function(_0x388f37){logger[_0x1470('0x19')](_0x1470('0x29'),_0x388f37[_0x1470('0x1b')],_0x4198b8);_0x145f40(_0xe9d187[_0x1470('0x19')](0x1f4,_0x388f37[_0x1470('0x1b')]));});});};exports[_0x1470('0x2b')]=function(_0x41f8af){var _0x3e8966=this;return new Promise(function(_0xaa6110,_0x7ab3cf){var _0x358268={'body':_0x41f8af[_0x1470('0x2c')],'channel':_0x1470('0x2d')};var _0x486456=_['difference'](_[_0x1470('0x2e')](db['CmContact'][_0x1470('0x2f')]),[_0x1470('0x30'),_0x1470('0x31'),_0x1470('0x32'),_0x1470('0x33')]);var _0x25291f=![];if(_0x41f8af['body']['id']){delete _0x41f8af[_0x1470('0x2c')]['id'];}if(_[_0x1470('0x34')](_0x41f8af[_0x1470('0x2c')][_0x1470('0x35')])){return _0x7ab3cf(_0x3e8966['error'](0x1f4,_0x1470('0x36')));}if(_[_0x1470('0x34')](_0x41f8af[_0x1470('0x2c')][_0x1470('0x2c')])||_0x41f8af['body']['body']===''){return _0x7ab3cf(_0x3e8966[_0x1470('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1470('0x34')](_0x41f8af[_0x1470('0x2c')][_0x1470('0x37')])){return _0x7ab3cf(_0x3e8966[_0x1470('0x19')](0x1f4,_0x1470('0x38')+_0x486456));}if(!_[_0x1470('0x39')](_0x486456,_0x41f8af[_0x1470('0x2c')][_0x1470('0x37')])){return _0x7ab3cf(_0x3e8966[_0x1470('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x486456));}var _0x4d8195={};_0x4d8195[_0x41f8af[_0x1470('0x2c')][_0x1470('0x37')]]=_0x41f8af[_0x1470('0x2c')][_0x1470('0x35')];return db[_0x1470('0x1f')][_0x1470('0x2a')]({'where':{'id':_0x41f8af[_0x1470('0x3a')]['id']},'include':[{'model':db[_0x1470('0x3b')],'as':_0x1470('0x3c'),'include':[{'model':db[_0x1470('0x3d')],'as':'Contacts','where':_0x4d8195,'limit':0x1,'order':[[_0x1470('0x31'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x1470('0x3e')],'as':_0x1470('0x3f')}]})[_0x1470('0x13')](function(_0x2a02f3){if(_0x2a02f3&&_0x2a02f3[_0x1470('0x3c')]){var _0x579271=_0x2a02f3[_0x1470('0x40')]({'plain':!![]});_0x358268[_0x1470('0x3a')]=_['omit'](_0x579271,[_0x1470('0x41'),_0x1470('0x3c')]);_0x358268[_0x1470('0x42')]=_0x579271['Applications'];_0x358268[_0x1470('0x43')]=_0x579271[_0x1470('0x3c')];_0x358268['applications']=_[_0x1470('0x44')](_0x358268[_0x1470('0x42')],[_0x1470('0x45')],[_0x1470('0x46')]);if(_0x358268[_0x1470('0x3a')]&&_0x358268[_0x1470('0x3a')]['autoclose']){_0x358268[_0x1470('0x42')][_0x1470('0x47')]({'id':0x0,'priority':_0x358268[_0x1470('0x42')][_0x1470('0x48')]+0x1,'app':_0x1470('0x49'),'appdata':_0x1470('0x4a'),'interval':_0x1470('0x4b')});}if(_0x358268[_0x1470('0x3a')][_0x1470('0x41')]){delete _0x358268[_0x1470('0x3a')][_0x1470('0x41')];}if(_0x358268[_0x1470('0x3a')]['List']){delete _0x358268[_0x1470('0x3a')]['List'];}if(_0x579271[_0x1470('0x3c')][_0x1470('0x4c')][_0x1470('0x48')]){return _0x579271[_0x1470('0x3c')][_0x1470('0x4c')][0x0];}var _0x1b0232=_[_0x1470('0xe')](_0x41f8af[_0x1470('0x2c')],{'firstName':_0x41f8af[_0x1470('0x2c')]['from'],'ListId':_0x579271[_0x1470('0x33')]});_0x1b0232[_0x41f8af[_0x1470('0x2c')][_0x1470('0x37')]]=_0x41f8af[_0x1470('0x2c')]['from'];return db[_0x1470('0x3d')]['create'](_0x1b0232);}else{throw new Error(_0x1470('0x4d'));}})[_0x1470('0x13')](function(_0x510bdf){_0x358268[_0x1470('0x4e')]=_0x510bdf;if(_0x510bdf){if(!_0x41f8af['body'][_0x1470('0x1b')][_0x1470('0x4f')]){_0x41f8af['body'][_0x1470('0x1b')]['messageId']=rs[_0x1470('0x50')]()+'\x20'+_0x41f8af['body'][_0x1470('0x1b')][_0x1470('0x35')];}var _0x3046aa={'ContactId':_0x510bdf['id'],'MailAccountId':_0x41f8af[_0x1470('0x3a')]['id'],'inReplyTo':_0x41f8af[_0x1470('0x2c')]['message'][_0x1470('0x4f')],'to':_0x41f8af['body'][_0x1470('0x1b')]['from'],'cc':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')]['cc'],'subject':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x51')],'attach':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')]['attach'],'lastMsgAt':moment()[_0x1470('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1470('0x2a')]({'where':{'closed':![],'MailAccountId':_0x41f8af[_0x1470('0x3a')]['id']},'include':[{'model':db[_0x1470('0x53')],'as':_0x1470('0x54'),'attributes':['messageId'],'where':{'messageId':_0x41f8af[_0x1470('0x2c')]['message'][_0x1470('0x55')]}}]})[_0x1470('0x13')](function(_0x5dedc7){if(_0x5dedc7){return[_0x5dedc7,![]];}return db[_0x1470('0x56')]['create'](_0x3046aa)[_0x1470('0x13')](function(_0x530672){return[_0x530672,!![]];});});}else{throw new Error(_0x1470('0x57'));}})['spread'](function(_0x3a6e8f,_0x1df713){if(_0x3a6e8f){_0x25291f=_0x1df713;if(!_0x1df713){return _0x3a6e8f['update']({'inReplyTo':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x4f')],'to':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x35')],'cc':_0x41f8af['body'][_0x1470('0x1b')]['cc'],'subject':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')]['subject'],'attach':_0x3a6e8f['attach']?_0x3a6e8f[_0x1470('0x58')]:_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x58')],'substatus':null,'substatusAt':moment()[_0x1470('0x52')](_0x1470('0x59')),'lastMsgAt':moment()[_0x1470('0x52')](_0x1470('0x59')),'lastMsgDirection':'in'});}else{return _0x3a6e8f;}}})['then'](function(_0x281587){_0x358268[_0x1470('0x5a')]=_0x281587[_0x1470('0x40')]({'plain':!![]});_0x358268[_0x1470('0x5a')][_0x1470('0x5b')]=_0x25291f;return db[_0x1470('0x53')][_0x1470('0x5c')]({'body':_0x41f8af['body']['body'],'MailAccountId':_0x41f8af['account']['id'],'MailInteractionId':_0x281587['id'],'direction':'in','ContactId':_0x358268[_0x1470('0x4e')]['id'],'messageId':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x4f')],'from':_0x41f8af[_0x1470('0x2c')]['message'][_0x1470('0x35')],'to':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')]['to'],'cc':_0x41f8af['body']['message']['cc'],'subject':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x51')],'attach':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x58')],'Attachments':_0x41f8af[_0x1470('0x2c')]['message'][_0x1470('0x5d')],'originTo':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x5e')],'originCc':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')]['originCc'],'bcc':_0x41f8af[_0x1470('0x2c')][_0x1470('0x1b')][_0x1470('0x5f')],'ChatWebsiteId':_0x41f8af[_0x1470('0x2c')]['message'][_0x1470('0x60')]||null,'originChannel':_0x41f8af['body'][_0x1470('0x1b')]['originChannel']||'Email','ChatOfflineMessageId':_0x41f8af['body']['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x1470('0x61')],'as':_0x1470('0x62')}]});})[_0x1470('0x13')](function(_0x307eb7){_0x358268[_0x1470('0x1b')]=_0x307eb7;if(_0x358268[_0x1470('0x5a')][_0x1470('0x63')]){return db[_0x1470('0x64')][_0x1470('0x2a')]({'attributes':['id',_0x1470('0x65')],'where':{'id':_0x358268['interaction'][_0x1470('0x63')]}})['then'](function(_0x46d64b){if(_0x46d64b){_0x358268[_0x1470('0x42')][_0x1470('0x66')]({'id':0x0,'priority':0x0,'app':_0x1470('0x67'),'appdata':_0x46d64b['name']+','+(_0x358268['account'][_0x1470('0x68')]||0xa),'interval':_0x1470('0x4b')});}return respondWithRpcPromise(_0x1470('0x69'),_0x1470('0x6a'),_0x358268);});}return respondWithRpcPromise(_0x1470('0x69'),_0x1470('0x6a'),_0x358268);})[_0x1470('0x13')](function(_0x5e480c){_0xaa6110(_0x5e480c);})[_0x1470('0x1d')](function(_0x27b891){_0x7ab3cf(_0x3e8966[_0x1470('0x19')](0x1f4,_0x27b891[_0x1470('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index cc2d32d..c714f8e 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 _0x9a1c=['save','emit','length','mailAccount:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9a1c,0x150));var _0xc9a1=function(_0x4a227a,_0x956896){_0x4a227a=_0x4a227a-0x0;var _0x469b82=_0x9a1c[_0x4a227a];return _0x469b82;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xc9a1('0x0'),'remove','update'];function createListener(_0x28e3d3,_0x517732){return function(_0x38085c){_0x517732[_0xc9a1('0x1')](_0x28e3d3,_0x38085c);};}function removeListener(_0x49ad70,_0x1496af){return function(){MailAccountEvents['removeListener'](_0x49ad70,_0x1496af);};}exports['register']=function(_0x3fbece){for(var _0x52d914=0x0,_0x5114df=events[_0xc9a1('0x2')];_0x52d914<_0x5114df;_0x52d914++){var _0x1d62de=events[_0x52d914];var _0x2e6129=createListener(_0xc9a1('0x3')+_0x1d62de,_0x3fbece);MailAccountEvents['on'](_0x1d62de,_0x2e6129);}}; \ No newline at end of file +var _0xc92d=['length','mailAccount:','save','remove','update','emit','removeListener'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc92d,0x198));var _0xdc92=function(_0x5aa3a6,_0x37dbaa){_0x5aa3a6=_0x5aa3a6-0x0;var _0x220f18=_0xc92d[_0x5aa3a6];return _0x220f18;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xdc92('0x0'),_0xdc92('0x1'),_0xdc92('0x2')];function createListener(_0x125365,_0x22f4ed){return function(_0x4a9c7f){_0x22f4ed[_0xdc92('0x3')](_0x125365,_0x4a9c7f);};}function removeListener(_0x4de463,_0x453ca0){return function(){MailAccountEvents[_0xdc92('0x4')](_0x4de463,_0x453ca0);};}exports['register']=function(_0x187dfa){for(var _0x562ec0=0x0,_0x2bd39e=events[_0xdc92('0x5')];_0x562ec0<_0x2bd39e;_0x562ec0++){var _0x119da7=events[_0x562ec0];var _0xaf3072=createListener(_0xdc92('0x6')+_0x119da7,_0x187dfa);MailAccountEvents['on'](_0x119da7,_0xaf3072);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d4fa187..320ed33 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 _0xee32=['update','delete','destroy','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','put'];(function(_0x367660,_0xce8732){var _0x2d3abf=function(_0x1f83c5){while(--_0x1f83c5){_0x367660['push'](_0x367660['shift']());}};_0x2d3abf(++_0xce8732);}(_0xee32,0x15f));var _0x2ee3=function(_0x3ca648,_0x1c49c4){_0x3ca648=_0x3ca648-0x0;var _0xaf87b=_0xee32[_0x3ca648];return _0xaf87b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2ee3('0x0'));var router=express[_0x2ee3('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x2ee3('0x2'));var interaction=require(_0x2ee3('0x3'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x2ee3('0x4')](_0x2ee3('0x5'),auth[_0x2ee3('0x6')](),controller[_0x2ee3('0x7')]);router[_0x2ee3('0x8')](_0x2ee3('0x5'),auth[_0x2ee3('0x6')](),controller[_0x2ee3('0x9')]);router[_0x2ee3('0xa')](_0x2ee3('0x5'),auth[_0x2ee3('0x6')](),controller[_0x2ee3('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe2f0=['put','update','delete','isAuthenticated','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id','show'];(function(_0x4159b6,_0x160b2c){var _0x288756=function(_0x1df2bd){while(--_0x1df2bd){_0x4159b6['push'](_0x4159b6['shift']());}};_0x288756(++_0x160b2c);}(_0xe2f0,0x1c8));var _0x0e2f=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0xe2f0[_0x153738];return _0x3028d9;};'use strict';var multer=require(_0x0e2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e2f('0x1'));var express=require(_0x0e2f('0x2'));var router=express[_0x0e2f('0x3')]();var fs_extra=require(_0x0e2f('0x4'));var auth=require(_0x0e2f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x0e2f('0x6')](_0x0e2f('0x7'),auth['isAuthenticated'](),controller[_0x0e2f('0x8')]);router[_0x0e2f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e2f('0xa')]);router[_0x0e2f('0xb')](_0x0e2f('0x7'),auth[_0x0e2f('0xc')](),controller[_0x0e2f('0xd')]);module[_0x0e2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index bd205f7..c766027 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 _0x7de0=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x5a18ed,_0x9936d2){var _0x12d357=function(_0x1bfa4c){while(--_0x1bfa4c){_0x5a18ed['push'](_0x5a18ed['shift']());}};_0x12d357(++_0x9936d2);}(_0x7de0,0x1ad));var _0x07de=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7de0[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x07de('0x0'));module[_0x07de('0x1')]={'priority':{'type':Sequelize[_0x07de('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x07de('0x3')],'allowNull':![],'defaultValue':_0x07de('0x4')},'appdata':{'type':Sequelize[_0x07de('0x5')]()},'description':{'type':Sequelize[_0x07de('0x3')]},'interval':{'type':Sequelize[_0x07de('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3d63=['sequelize','INTEGER','STRING','*,*,*,*'];(function(_0x34fb60,_0x3618df){var _0x29fd41=function(_0x405e48){while(--_0x405e48){_0x34fb60['push'](_0x34fb60['shift']());}};_0x29fd41(++_0x3618df);}(_0x3d63,0x134));var _0x33d6=function(_0x281c80,_0x25c747){_0x281c80=_0x281c80-0x0;var _0x312392=_0x3d63[_0x281c80];return _0x312392;};'use strict';var Sequelize=require(_0x33d6('0x0'));module['exports']={'priority':{'type':Sequelize[_0x33d6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x33d6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x33d6('0x2')],'defaultValue':_0x33d6('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 616677e..862b5ea 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x2ac0ed,_0x59e7ae){var _0x5b5bb2=function(_0x1cce34){while(--_0x1cce34){_0x2ac0ed['push'](_0x2ac0ed['shift']());}};_0x5b5bb2(++_0x59e7ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x165271,_0x3ecf75){var _0x1f5022=function(_0x2f75ca){while(--_0x2f75ca){_0x165271['push'](_0x165271['shift']());}};_0x1f5022(++_0x3ecf75);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2e0a1a,_0x22e89f){_0x2e0a1a=_0x2e0a1a-0x0;var _0x227e00=_0x9bde[_0x2e0a1a];return _0x227e00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 555bc3f..259d4d4 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 _0x4a0f=['exports','define','MailApplication','mail_applications','lodash','util','../../config/logger','moment','bluebird','request-promise','./mailApplication.attributes'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x4a0f,0xe0));var _0xf4a0=function(_0x5fa0ac,_0xffd3b0){_0x5fa0ac=_0x5fa0ac-0x0;var _0x3bbf18=_0x4a0f[_0x5fa0ac];return _0x3bbf18;};'use strict';var _=require(_0xf4a0('0x0'));var util=require(_0xf4a0('0x1'));var logger=require(_0xf4a0('0x2'))('api');var moment=require(_0xf4a0('0x3'));var BPromise=require(_0xf4a0('0x4'));var rp=require(_0xf4a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4a0('0x6'));module[_0xf4a0('0x7')]=function(_0x42848d,_0x1ba12a){return _0x42848d[_0xf4a0('0x8')](_0xf4a0('0x9'),attributes,{'tableName':_0xf4a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x13a6=['define','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x51031f,_0x495c1d){var _0x8a5c89=function(_0x46e326){while(--_0x46e326){_0x51031f['push'](_0x51031f['shift']());}};_0x8a5c89(++_0x495c1d);}(_0x13a6,0xd3));var _0x613a=function(_0x62f454,_0x50218f){_0x62f454=_0x62f454-0x0;var _0x1fb34a=_0x13a6[_0x62f454];return _0x1fb34a;};'use strict';var _=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var logger=require(_0x613a('0x2'))(_0x613a('0x3'));var moment=require(_0x613a('0x4'));var BPromise=require('bluebird');var rp=require(_0x613a('0x5'));var fs=require('fs');var path=require(_0x613a('0x6'));var rimraf=require(_0x613a('0x7'));var config=require(_0x613a('0x8'));var attributes=require(_0x613a('0x9'));module['exports']=function(_0x3ff43c,_0x175de2){return _0x3ff43c[_0x613a('0xa')]('MailApplication',attributes,{'tableName':_0x613a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x613a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e9b7fda..682f376 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 _0xfbd4=['debug','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x5136f4,_0x25057e){var _0x54755f=function(_0x570f9f){while(--_0x570f9f){_0x5136f4['push'](_0x5136f4['shift']());}};_0x54755f(++_0x25057e);}(_0xfbd4,0x11b));var _0x4fbd=function(_0x2b6671,_0xe4a82f){_0x2b6671=_0x2b6671-0x0;var _0x2f1e98=_0xfbd4[_0x2b6671];return _0x2f1e98;};'use strict';var _=require(_0x4fbd('0x0'));var util=require(_0x4fbd('0x1'));var moment=require(_0x4fbd('0x2'));var BPromise=require(_0x4fbd('0x3'));var rs=require(_0x4fbd('0x4'));var fs=require('fs');var Redis=require(_0x4fbd('0x5'));var db=require(_0x4fbd('0x6'))['db'];var utils=require(_0x4fbd('0x7'));var logger=require(_0x4fbd('0x8'))(_0x4fbd('0x9'));var config=require('../../config/environment');var jayson=require(_0x4fbd('0xa'));var client=jayson['client'][_0x4fbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59cb2d,_0x260cdb,_0x2e52a6){return new BPromise(function(_0x5ca1c4,_0x4c8fe1){return client[_0x4fbd('0xc')](_0x59cb2d,_0x2e52a6)[_0x4fbd('0xd')](function(_0x23576c){logger[_0x4fbd('0xe')](_0x4fbd('0xf'),_0x260cdb,_0x4fbd('0x10'));logger[_0x4fbd('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x260cdb,'request\x20sent',JSON[_0x4fbd('0x12')](_0x23576c));if(_0x23576c['error']){if(_0x23576c[_0x4fbd('0x13')]['code']===0x1f4){logger[_0x4fbd('0x13')](_0x4fbd('0xf'),_0x260cdb,_0x23576c[_0x4fbd('0x13')][_0x4fbd('0x14')]);return _0x4c8fe1(_0x23576c[_0x4fbd('0x13')]['message']);}logger['error'](_0x4fbd('0xf'),_0x260cdb,_0x23576c['error'][_0x4fbd('0x14')]);return _0x5ca1c4(_0x23576c['error'][_0x4fbd('0x14')]);}else{logger[_0x4fbd('0xe')](_0x4fbd('0xf'),_0x260cdb,_0x4fbd('0x10'));_0x5ca1c4(_0x23576c[_0x4fbd('0x15')]['message']);}})[_0x4fbd('0x16')](function(_0x1ed84e){logger['error'](_0x4fbd('0xf'),_0x260cdb,_0x1ed84e);_0x4c8fe1(_0x1ed84e);});});}exports[_0x4fbd('0x17')]=function(_0x376c1e){var _0x441b1e=this;return new Promise(function(_0x8efbc0,_0x10df4e){return db[_0x4fbd('0x18')]['update'](_0x376c1e[_0x4fbd('0x19')],{'raw':_0x376c1e['options']?_0x376c1e[_0x4fbd('0x1a')][_0x4fbd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376c1e[_0x4fbd('0x1a')]?_0x376c1e[_0x4fbd('0x1a')][_0x4fbd('0x1c')]||null:null,'attributes':_0x376c1e[_0x4fbd('0x1a')]?_0x376c1e['options']['attributes']||null:null,'limit':_0x376c1e[_0x4fbd('0x1a')]?_0x376c1e[_0x4fbd('0x1a')][_0x4fbd('0x1d')]||null:null})[_0x4fbd('0xd')](function(_0x350067){logger[_0x4fbd('0xe')]('UpdateMailApplication',_0x376c1e);logger[_0x4fbd('0x11')](_0x4fbd('0x17'),_0x376c1e,JSON[_0x4fbd('0x12')](_0x350067));_0x8efbc0(_0x350067);})[_0x4fbd('0x16')](function(_0x1c61b2){logger[_0x4fbd('0x13')](_0x4fbd('0x17'),_0x1c61b2[_0x4fbd('0x14')],_0x376c1e);_0x10df4e(_0x441b1e[_0x4fbd('0x13')](0x1f4,_0x1c61b2[_0x4fbd('0x14')]));});});}; \ No newline at end of file +var _0x59c7=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','options','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x373e8e,_0x6bb6d9){var _0x453d22=function(_0x5dd3ba){while(--_0x5dd3ba){_0x373e8e['push'](_0x373e8e['shift']());}};_0x453d22(++_0x6bb6d9);}(_0x59c7,0x1e7));var _0x759c=function(_0x1cf447,_0x4446f6){_0x1cf447=_0x1cf447-0x0;var _0x2d80e8=_0x59c7[_0x1cf447];return _0x2d80e8;};'use strict';var _=require(_0x759c('0x0'));var util=require(_0x759c('0x1'));var moment=require(_0x759c('0x2'));var BPromise=require(_0x759c('0x3'));var rs=require(_0x759c('0x4'));var fs=require('fs');var Redis=require(_0x759c('0x5'));var db=require(_0x759c('0x6'))['db'];var utils=require(_0x759c('0x7'));var logger=require('../../config/logger')(_0x759c('0x8'));var config=require(_0x759c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x759c('0xa')][_0x759c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45ec4a,_0x3f36c9,_0x391ad0){return new BPromise(function(_0x376b0e,_0x5626e5){return client[_0x759c('0xc')](_0x45ec4a,_0x391ad0)[_0x759c('0xd')](function(_0x5171ef){logger[_0x759c('0xe')](_0x759c('0xf'),_0x3f36c9,'request\x20sent');logger[_0x759c('0x10')](_0x759c('0x11'),_0x3f36c9,_0x759c('0x12'),JSON[_0x759c('0x13')](_0x5171ef));if(_0x5171ef[_0x759c('0x14')]){if(_0x5171ef[_0x759c('0x14')]['code']===0x1f4){logger[_0x759c('0x14')](_0x759c('0xf'),_0x3f36c9,_0x5171ef[_0x759c('0x14')][_0x759c('0x15')]);return _0x5626e5(_0x5171ef[_0x759c('0x14')][_0x759c('0x15')]);}logger[_0x759c('0x14')]('MailApplication,\x20%s,\x20%s',_0x3f36c9,_0x5171ef[_0x759c('0x14')]['message']);return _0x376b0e(_0x5171ef[_0x759c('0x14')]['message']);}else{logger[_0x759c('0xe')](_0x759c('0xf'),_0x3f36c9,'request\x20sent');_0x376b0e(_0x5171ef[_0x759c('0x16')][_0x759c('0x15')]);}})[_0x759c('0x17')](function(_0x3e02e5){logger[_0x759c('0x14')]('MailApplication,\x20%s,\x20%s',_0x3f36c9,_0x3e02e5);_0x5626e5(_0x3e02e5);});});}exports[_0x759c('0x18')]=function(_0x3a4f26){var _0x26ed57=this;return new Promise(function(_0x140d22,_0x2eff40){return db[_0x759c('0x19')]['update'](_0x3a4f26['body'],{'raw':_0x3a4f26[_0x759c('0x1a')]?_0x3a4f26['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4f26[_0x759c('0x1a')]?_0x3a4f26['options'][_0x759c('0x1b')]||null:null,'attributes':_0x3a4f26['options']?_0x3a4f26['options']['attributes']||null:null,'limit':_0x3a4f26[_0x759c('0x1a')]?_0x3a4f26['options'][_0x759c('0x1c')]||null:null})['then'](function(_0x5897b3){logger['info'](_0x759c('0x18'),_0x3a4f26);logger[_0x759c('0x10')](_0x759c('0x18'),_0x3a4f26,JSON[_0x759c('0x13')](_0x5897b3));_0x140d22(_0x5897b3);})[_0x759c('0x17')](function(_0x229a09){logger[_0x759c('0x14')](_0x759c('0x18'),_0x229a09[_0x759c('0x15')],_0x3a4f26);_0x2eff40(_0x26ed57[_0x759c('0x14')](0x1f4,_0x229a09[_0x759c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e9f6e72..2e8787f 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 _0xf951=['getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','mailinteraction:update','update','delete','destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xf951,0xfa));var _0x1f95=function(_0x469a2d,_0x53bcbe){_0x469a2d=_0x469a2d-0x0;var _0x148147=_0xf951[_0x469a2d];return _0x148147;};'use strict';var express=require('express');var router=express[_0x1f95('0x0')]();var auth=require(_0x1f95('0x1'));var interaction=require(_0x1f95('0x2'));var controller=require(_0x1f95('0x3'));router['get']('/',auth[_0x1f95('0x4')](),controller[_0x1f95('0x5')]);router[_0x1f95('0x6')](_0x1f95('0x7'),auth['isAuthenticated'](),controller[_0x1f95('0x8')]);router[_0x1f95('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x1f95('0x9')]);router[_0x1f95('0x6')](_0x1f95('0xa'),auth['isAuthenticated'](),controller[_0x1f95('0xb')]);router[_0x1f95('0x6')](_0x1f95('0xc'),auth[_0x1f95('0x4')](),controller['download']);router[_0x1f95('0xd')]('/',auth['isAuthenticated'](),controller[_0x1f95('0xe')]);router[_0x1f95('0xd')](_0x1f95('0xa'),auth[_0x1f95('0x4')](),controller[_0x1f95('0xf')]);router[_0x1f95('0xd')](_0x1f95('0x10'),auth['isAuthenticated'](),interaction[_0x1f95('0x11')]('mail',_0x1f95('0x12')),controller[_0x1f95('0x13')]);router[_0x1f95('0x14')](_0x1f95('0x15'),auth[_0x1f95('0x4')](),interaction[_0x1f95('0x11')](_0x1f95('0x16'),_0x1f95('0x17')),controller[_0x1f95('0x18')]);router[_0x1f95('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0x1f95('0x1a')]);router[_0x1f95('0x19')](_0x1f95('0x10'),auth['isAuthenticated'](),controller[_0x1f95('0x1b')]);module[_0x1f95('0x1c')]=router; \ No newline at end of file +var _0x9363=['../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','mailinteraction:update','update','destroy','delete','removeTags','exports','Router'];(function(_0x18dbbc,_0x4036b2){var _0x23c487=function(_0x8aba93){while(--_0x8aba93){_0x18dbbc['push'](_0x18dbbc['shift']());}};_0x23c487(++_0x4036b2);}(_0x9363,0x89));var _0x3936=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x9363[_0x53f897];return _0x6879f8;};'use strict';var express=require('express');var router=express[_0x3936('0x0')]();var auth=require(_0x3936('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x3936('0x2'));router[_0x3936('0x3')]('/',auth[_0x3936('0x4')](),controller['index']);router[_0x3936('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x3936('0x5')]);router['get'](_0x3936('0x6'),auth[_0x3936('0x4')](),controller['show']);router[_0x3936('0x3')](_0x3936('0x7'),auth[_0x3936('0x4')](),controller[_0x3936('0x8')]);router['get'](_0x3936('0x9'),auth['isAuthenticated'](),controller['download']);router[_0x3936('0xa')]('/',auth[_0x3936('0x4')](),controller['create']);router[_0x3936('0xa')](_0x3936('0x7'),auth[_0x3936('0x4')](),controller[_0x3936('0xb')]);router[_0x3936('0xa')](_0x3936('0xc'),auth[_0x3936('0x4')](),interaction[_0x3936('0xd')]('mail',_0x3936('0xe')),controller[_0x3936('0xf')]);router['put'](_0x3936('0x6'),auth[_0x3936('0x4')](),interaction[_0x3936('0xd')](_0x3936('0x10'),_0x3936('0x11')),controller[_0x3936('0x12')]);router['delete'](_0x3936('0x6'),auth[_0x3936('0x4')](),interaction[_0x3936('0xd')](_0x3936('0x10'),'mailinteraction:destroy'),controller[_0x3936('0x13')]);router[_0x3936('0x14')](_0x3936('0xc'),auth[_0x3936('0x4')](),controller[_0x3936('0x15')]);module[_0x3936('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ec26a61..93ef18f 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 _0x53c0=['exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','sequelize','iconv'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x53c0,0xda));var _0x053c=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x53c0[_0x152121];return _0x592a85;};'use strict';var Sequelize=require(_0x053c('0x0'));var iconv=require(_0x053c('0x1'));module[_0x053c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x053c('0x3')]},'disposition':{'type':Sequelize[_0x053c('0x4')]},'secondDisposition':{'type':Sequelize[_0x053c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x053c('0x4')]},'note':{'type':Sequelize[_0x053c('0x4')]},'inReplyTo':{'type':Sequelize[_0x053c('0x4')](0x1fe)},'to':{'type':Sequelize[_0x053c('0x4')]},'cc':{'type':Sequelize[_0x053c('0x5')](_0x053c('0x6'))},'subject':{'type':Sequelize[_0x053c('0x5')]()},'attach':{'type':Sequelize[_0x053c('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x053c('0x3')]},'substatus':{'type':Sequelize[_0x053c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x053c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x053c('0x8')]('in',_0x053c('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x053c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x053c('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe04d=['ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe04d,0x1ce));var _0xde04=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xe04d[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0xde04('0x0'));var iconv=require(_0xde04('0x1'));module[_0xde04('0x2')]={'closed':{'type':Sequelize[_0xde04('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xde04('0x4')]},'disposition':{'type':Sequelize[_0xde04('0x5')]},'secondDisposition':{'type':Sequelize[_0xde04('0x5')]},'thirdDisposition':{'type':Sequelize[_0xde04('0x5')]},'note':{'type':Sequelize[_0xde04('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xde04('0x6')](_0xde04('0x7'))},'subject':{'type':Sequelize[_0xde04('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xde04('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xde04('0x8')]('in',_0xde04('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xde04('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xde04('0x8')]('in',_0xde04('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xde04('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 251ec42..0bb145e 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 _0xb0f3=['i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','intersection','includeAll','include','options','create','body','params','describe','addMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachments','Messages','get','mkdirSync','each','decode','headers','bcc','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','path','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','status','end','json','undefined','count','offset','limit','set','Content-Range','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','-id','then','plainBody','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','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','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent'];(function(_0x67e6d7,_0x11d4e3){var _0x11ab30=function(_0x4045c9){while(--_0x4045c9){_0x67e6d7['push'](_0x67e6d7['shift']());}};_0x11ab30(++_0x11d4e3);}(_0xb0f3,0x13e));var _0x3b0f=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xb0f3[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b0f('0x0'));var zipdir=require(_0x3b0f('0x1'));var moment=require(_0x3b0f('0x2'));var BPromise=require(_0x3b0f('0x3'));var util=require('util');var path=require(_0x3b0f('0x4'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require(_0x3b0f('0x5'));var Redis=require('ioredis');var qs=require(_0x3b0f('0x6'));var as=require(_0x3b0f('0x7'));var logger=require(_0x3b0f('0x8'))(_0x3b0f('0x9'));var config=require('../../config/environment');var db=require(_0x3b0f('0xa'))['db'];var htmlEntities=require(_0x3b0f('0xb'));config[_0x3b0f('0xc')]=_[_0x3b0f('0xd')](config[_0x3b0f('0xc')],{'host':_0x3b0f('0xe'),'port':0x18eb});var socket=require(_0x3b0f('0xf'))(new Redis(config['redis']));require(_0x3b0f('0x10'))['register'](socket);function respondWithStatusCode(_0x1b03cc,_0xd5f72e){_0xd5f72e=_0xd5f72e||0xcc;return function(_0x2f5305){if(_0x2f5305){return _0x1b03cc['sendStatus'](_0xd5f72e);}return _0x1b03cc[_0x3b0f('0x11')](_0xd5f72e)[_0x3b0f('0x12')]();};}function respondWithResult(_0x57577f,_0x2d88b9){_0x2d88b9=_0x2d88b9||0xc8;return function(_0xbe276a){if(_0xbe276a){return _0x57577f[_0x3b0f('0x11')](_0x2d88b9)[_0x3b0f('0x13')](_0xbe276a);}};}function respondWithFilteredResult(_0x350037,_0x316992){return function(_0x5a6a51){if(_0x5a6a51){var _0x19785f=typeof _0x316992['offset']===_0x3b0f('0x14')&&typeof _0x316992['limit']===_0x3b0f('0x14');var _0x3b4a32=_0x5a6a51[_0x3b0f('0x15')];var _0x388d4c=_0x19785f?0x0:_0x316992['offset'];var _0xd56fd0=_0x19785f?_0x5a6a51[_0x3b0f('0x15')]:_0x316992[_0x3b0f('0x16')]+_0x316992[_0x3b0f('0x17')];var _0xb86a2a;if(_0xd56fd0>=_0x3b4a32){_0xd56fd0=_0x3b4a32;_0xb86a2a=0xc8;}else{_0xb86a2a=0xce;}_0x350037[_0x3b0f('0x11')](_0xb86a2a);return _0x350037[_0x3b0f('0x18')](_0x3b0f('0x19'),_0x388d4c+'-'+_0xd56fd0+'/'+_0x3b4a32)[_0x3b0f('0x13')](_0x5a6a51);}return null;};}function saveUpdates(_0x569697){return function(_0x321441){if(_0x321441){return _0x321441['update'](_0x569697)['then'](function(_0x447e5b){return _0x447e5b;});}return null;};}function removeEntity(_0x1a6ce1){return function(_0x1aa4d){if(_0x1aa4d){return _0x1aa4d['destroy']()['then'](function(){_0x1a6ce1[_0x3b0f('0x11')](0xcc)[_0x3b0f('0x12')]();});}};}function handleEntityNotFound(_0x82624a){return function(_0x39f3c7){if(!_0x39f3c7){_0x82624a['sendStatus'](0x194);}return _0x39f3c7;};}function handleError(_0x497e79,_0x17ae46){_0x17ae46=_0x17ae46||0x1f4;return function(_0x5e706b){logger[_0x3b0f('0x1a')](_0x5e706b['stack']);if(_0x5e706b[_0x3b0f('0x1b')]){delete _0x5e706b['name'];}_0x497e79[_0x3b0f('0x11')](_0x17ae46)[_0x3b0f('0x1c')](_0x5e706b);};}function getInteractionUsers(_0x4e0d30,_0x5760f0){return new BPromise(function(_0x2cf953,_0x4efb8a){try{if(_0x5760f0[_0x4e0d30['id']]){_0x4e0d30[_0x3b0f('0x1d')]=_[_0x3b0f('0x1e')](_0x5760f0[_0x4e0d30['id']],function(_0x553464){return{'id':_0x553464['id'],'fullname':_0x553464[_0x3b0f('0x1f')]};});}}catch(_0x23736a){_0x4efb8a(_0x23736a);}_0x2cf953(_0x4e0d30);});}function getInteractionTags(_0x5ce9bd,_0x3655fc){return new BPromise(function(_0x366899,_0x2f819f){try{if(_0x5ce9bd[_0x3b0f('0x20')]){_0x5ce9bd[_0x3b0f('0x21')]=[];_0x5ce9bd[_0x3b0f('0x20')][_0x3b0f('0x22')](',')[_0x3b0f('0x23')](function(_0x582ccf){_0x5ce9bd[_0x3b0f('0x21')][_0x3b0f('0x24')](_0x3655fc[_0x582ccf]);});}delete _0x5ce9bd[_0x3b0f('0x20')];}catch(_0x2c1629){_0x2f819f(_0x2c1629);}_0x366899(_0x5ce9bd);});}function getLastMessageText(_0x2c7237){return new BPromise(function(_0x46b6ec,_0x583885){return db[_0x3b0f('0x25')][_0x3b0f('0x26')]({'where':{'$and':[{'MailInteractionId':_0x2c7237['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x3b0f('0x27'),'raw':!![]})[_0x3b0f('0x28')](function(_0x128667){if(_0x128667&&_0x128667[_0x3b0f('0x29')]){_0x2c7237['lastMsgText']=_[_0x3b0f('0x2a')](_0x128667['plainBody']);}_0x46b6ec(_0x2c7237);})[_0x3b0f('0x2b')](function(_0x570397){_0x583885(_0x570397);});});}function updateMailInteraction(_0x31db7,_0x1dc843,_0x42cc74,_0x321e00){return new BPromise(function(_0xdb219b,_0x284ef3){return getInteractionUsers(_0x31db7,_0x42cc74)[_0x3b0f('0x28')](function(_0x49831a){return getInteractionTags(_0x49831a,_0x1dc843);})[_0x3b0f('0x28')](function(_0x19e8ae){if(_0x321e00){_0xdb219b(getLastMessageText(_0x19e8ae));}else{_0xdb219b(_0x19e8ae);}})['catch'](function(_0x30be32){_0x284ef3(_0x30be32);});});}exports[_0x3b0f('0x2c')]=function(_0x34a462,_0x299368){var _0x3a8d48={},_0x3dc400={},_0x40996b={'count':0x0,'rows':[]};var _0x22d024=_['map'](db[_0x3b0f('0x2d')][_0x3b0f('0x2e')],function(_0x1cec66){return{'name':_0x1cec66[_0x3b0f('0x2f')],'type':_0x1cec66['type']['key']};});_0x3dc400[_0x3b0f('0x30')]=_[_0x3b0f('0x1e')](_0x22d024,'name');_0x3dc400[_0x3b0f('0x31')]=_[_0x3b0f('0x32')](_0x34a462[_0x3b0f('0x31')]);_0x3dc400[_0x3b0f('0x33')]=_['intersection'](_0x3dc400[_0x3b0f('0x30')],_0x3dc400[_0x3b0f('0x31')]);_0x3a8d48[_0x3b0f('0x34')]=_['intersection'](_0x3dc400[_0x3b0f('0x30')],qs[_0x3b0f('0x35')](_0x34a462['query'][_0x3b0f('0x35')]));_0x3a8d48[_0x3b0f('0x34')]=_0x3a8d48['attributes'][_0x3b0f('0x36')]?_0x3a8d48[_0x3b0f('0x34')]:_0x3dc400[_0x3b0f('0x30')];if(!_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x37')](_0x3b0f('0x38'))){_0x3a8d48[_0x3b0f('0x17')]=qs[_0x3b0f('0x17')](_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x17')]);_0x3a8d48['offset']=qs[_0x3b0f('0x16')](_0x34a462['query']['offset']);}_0x3a8d48[_0x3b0f('0x39')]=qs[_0x3b0f('0x3a')](_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x3a')]);_0x3a8d48[_0x3b0f('0x3b')]=qs['filters'](_[_0x3b0f('0x3c')](_0x34a462[_0x3b0f('0x31')],_0x3dc400['filters']),_0x22d024);var _0x871f4d=[];var _0x210e4d=squel[_0x3b0f('0x3d')]()['field']('id')[_0x3b0f('0x3e')]('name')[_0x3b0f('0x3e')](_0x3b0f('0x3f'))[_0x3b0f('0x40')](_0x3b0f('0x41'));var _0x17b785=squel['select']()[_0x3b0f('0x3e')](_0x3b0f('0x42'))[_0x3b0f('0x3e')](_0x3b0f('0x43'))[_0x3b0f('0x3e')](_0x3b0f('0x44'))[_0x3b0f('0x40')]('user_has_mail_interactions','ui')[_0x3b0f('0x45')](_0x3b0f('0x46'),'u',_0x3b0f('0x47'));var _0x2e4b1f=squel[_0x3b0f('0x3d')]()['from'](_0x3b0f('0x48'),'i')[_0x3b0f('0x45')](_0x3b0f('0x49'),'c',_0x3b0f('0x4a'))[_0x3b0f('0x45')](_0x3b0f('0x46'),'o',_0x3b0f('0x4b'))['left_join'](_0x3b0f('0x4c'),'a',_0x3b0f('0x4d'))[_0x3b0f('0x45')](_0x3b0f('0x4e'),'me',_0x3b0f('0x4f'))['left_join']('mail_interaction_has_tags','it',_0x3b0f('0x50'))[_0x3b0f('0x45')](_0x3b0f('0x41'),'t','t.id\x20=\x20it.TagId');var _0x28ccbb=squel[_0x3b0f('0x51')]();var _0x534d5b=[];var _0x109f98=squel[_0x3b0f('0x51')]();var _0x4e6236;if(_0x34a462[_0x3b0f('0x31')]['search']){_0x4e6236=as[_0x3b0f('0x52')](_0x34a462[_0x3b0f('0x31')]['search']);var _0x14f5ba=_0x4e6236[_0x3b0f('0x53')];for(var _0x4ec980=0x0;_0x4ec980<_0x4e6236[_0x3b0f('0x54')][_0x3b0f('0x36')];_0x4ec980++){var _0x2b2aea=_0x4e6236[_0x3b0f('0x54')][_0x4ec980];var _0x4d7826='i';var _0x611a4c=_[_0x3b0f('0x55')](_0x22d024,[_0x3b0f('0x1b'),_0x2b2aea[_0x3b0f('0x3e')]]);if(!_0x611a4c){switch(_0x2b2aea[_0x3b0f('0x3e')]){case _0x3b0f('0x56'):if(_0x2b2aea[_0x3b0f('0x57')]==0x1){_0x2e4b1f['having']('`'+_0x2b2aea['field']+'`\x20=\x200');}else{_0x2e4b1f[_0x3b0f('0x58')]('`'+_0x2b2aea[_0x3b0f('0x3e')]+_0x3b0f('0x59'));}break;case _0x3b0f('0x5a'):if(_0x2b2aea[_0x3b0f('0x5b')]===_0x3b0f('0x5c')){if(_0x2b2aea[_0x3b0f('0x57')][_0x3b0f('0x22')]('\x20')[_0x3b0f('0x36')]>0x1){_0x28ccbb[_0x14f5ba](_0x3b0f('0x5d'),qs[_0x3b0f('0x5e')](_0x2b2aea['value']),null);}else{var _0x4eadfe='%'+_0x2b2aea[_0x3b0f('0x57')]+'%';_0x28ccbb[_0x14f5ba](_0x3b0f('0x5f'),_0x4eadfe,_0x4eadfe,_0x4eadfe);}}else{_0x611a4c=_[_0x3b0f('0x55')](_0x22d024,[_0x3b0f('0x1b'),_0x3b0f('0x60')]);_0x2b2aea[_0x3b0f('0x3e')]=_0x3b0f('0x60');_0x17d38f=as[_0x3b0f('0x61')](_0x4d7826,_0x611a4c[_0x3b0f('0x62')],_0x2b2aea);_0x28ccbb[_0x14f5ba](_0x17d38f[_0x3b0f('0x63')],_0x17d38f[_0x3b0f('0x57')]['start'],_0x17d38f[_0x3b0f('0x57')][_0x3b0f('0x12')]);}break;case _0x3b0f('0x64'):var _0x5d9a84=_0x2b2aea[_0x3b0f('0x57')][_0x3b0f('0x22')](',')[_0x3b0f('0x1e')](function(_0x14d0bc){return Number(_0x14d0bc);});_0x5d9a84[_0x3b0f('0x23')](function(_0x57069b){_0x109f98['or'](_0x3b0f('0x65'),'%,'+_0x57069b+',%');});_0x534d5b=_[_0x3b0f('0x66')](_0x534d5b,_0x5d9a84);break;case _0x3b0f('0x67'):if(_0x2b2aea[_0x3b0f('0x5b')]===_0x3b0f('0x5c')){_0x28ccbb[_0x14f5ba](_0x3b0f('0x68'),'%'+_0x2b2aea[_0x3b0f('0x57')]+'%',null);}else{_0x611a4c=_[_0x3b0f('0x55')](_0x22d024,[_0x3b0f('0x1b'),_0x3b0f('0x69')]);_0x2b2aea['field']=_0x3b0f('0x69');_0x17d38f=as[_0x3b0f('0x61')](_0x4d7826,_0x611a4c['type'],_0x2b2aea);_0x28ccbb[_0x14f5ba](_0x17d38f[_0x3b0f('0x63')],_0x17d38f[_0x3b0f('0x57')][_0x3b0f('0x6a')],_0x17d38f[_0x3b0f('0x57')][_0x3b0f('0x12')]);}break;case'plainBody':_0x17d38f=as[_0x3b0f('0x61')]('me',null,_0x2b2aea);_0x28ccbb[_0x14f5ba](_0x17d38f[_0x3b0f('0x63')],_0x17d38f[_0x3b0f('0x57')][_0x3b0f('0x6a')],_0x17d38f[_0x3b0f('0x57')]['end']);break;}}else{var _0x17d38f=as[_0x3b0f('0x61')](_0x4d7826,_0x611a4c[_0x3b0f('0x62')],_0x2b2aea);_0x28ccbb[_0x14f5ba](_0x17d38f['text'],_0x17d38f['value'][_0x3b0f('0x6a')],_0x17d38f[_0x3b0f('0x57')]['end']);}}}else{var _0x39d2b2=_(_0x34a462[_0x3b0f('0x31')])[_0x3b0f('0x32')]()[_0x3b0f('0x1e')](function(_0x4a0b3b){return _['some'](_0x22d024,[_0x3b0f('0x1b'),_0x4a0b3b])?_0x4a0b3b:undefined;})[_0x3b0f('0x6b')]()[_0x3b0f('0x57')]();if(!_['isEmpty'](_0x39d2b2)){_0x39d2b2[_0x3b0f('0x23')](function(_0x218be0){if(_0x218be0===_0x3b0f('0x6c')){_0x2e4b1f[_0x3b0f('0x3b')](_0x3b0f('0x6d'),[][_0x3b0f('0x6e')](_0x34a462[_0x3b0f('0x31')][_0x218be0]));}else if(_0x218be0===_0x3b0f('0x6f')){var _0x1dbc52=JSON[_0x3b0f('0x70')](_0x34a462['query'][_0x218be0])[_0x3b0f('0x71')];var _0xb71d15=JSON['parse'](_0x34a462[_0x3b0f('0x31')][_0x218be0])[_0x3b0f('0x72')];_0x2e4b1f[_0x3b0f('0x3b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1dbc52,_0xb71d15);}else{if(_0x34a462[_0x3b0f('0x31')][_0x218be0]===_0x3b0f('0x73')){_0x2e4b1f[_0x3b0f('0x3b')]('i.'+_0x218be0+_0x3b0f('0x74'));}else{_0x2e4b1f[_0x3b0f('0x3b')]('i.'+_0x218be0+_0x3b0f('0x75'),_0x34a462[_0x3b0f('0x31')][_0x218be0]);}}});}if(_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x76')]){if(_0x34a462[_0x3b0f('0x31')]['read']==0x1){_0x2e4b1f[_0x3b0f('0x58')](_0x3b0f('0x77'));}else{_0x2e4b1f['having'](_0x3b0f('0x78'));}}if(_0x34a462[_0x3b0f('0x31')]['tag']){_0x534d5b=_[_0x3b0f('0x79')](_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x7a')])?_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x7a')]:new Array(_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x7a')]);_0x534d5b[_0x3b0f('0x23')](function(_0x4927b7){_0x109f98['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4927b7+',%');});}if(_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x7b')]){var _0x3b41ff=_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x3b0f('0x7c')](/'/g,'\x27\x27');if(qs[_0x3b0f('0x7d')](_0x3b41ff)){_0x28ccbb['or']('i.id\x20LIKE\x20?',_0x3b41ff+'%');}else if(qs['isEmail'](_0x3b41ff)){_0x28ccbb['or'](_0x3b0f('0x7e'),_0x3b41ff+'%');}else{_0x28ccbb['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b0f('0x5e')](_0x3b41ff))['or'](_0x3b0f('0x7f'),qs[_0x3b0f('0x5e')](_0x3b41ff));}}}_0x2e4b1f[_0x3b0f('0x3b')](_0x28ccbb);_0x2e4b1f[_0x3b0f('0x80')](_0x3b0f('0x81'));var _0x131f80={'type':db[_0x3b0f('0x82')][_0x3b0f('0x83')][_0x3b0f('0x84')],'raw':!![]};var _0x5768af=_0x2e4b1f[_0x3b0f('0x85')]();_0x5768af[_0x3b0f('0x3e')](_0x3b0f('0x81'));_0x5768af[_0x3b0f('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3b0f('0x56'));if(_0x3a8d48['order']){_0x3a8d48['order'][_0x3b0f('0x23')](function(_0x59c3c5){var _0x5b473c=_0x59c3c5[0x0]==='contactName'?_0x59c3c5[0x0]:'i.'+_0x59c3c5[0x0];_0x2e4b1f[_0x3b0f('0x39')](_0x5b473c,_0x59c3c5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3b0f('0x86')](_0x534d5b)){_0x2e4b1f[_0x3b0f('0x58')](_0x109f98);_0x5768af['where'](_0x3b0f('0x87'),_0x534d5b);}BPromise[_0x3b0f('0x88')]()['then'](function(){if(!_0x4e6236){if(_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x6c')])return;_0x5768af[_0x3b0f('0x3b')](_0x3b0f('0x89'));_0x2e4b1f[_0x3b0f('0x3b')](_0x3b0f('0x89'));return;}if(_0x34a462[_0x3b0f('0x8a')]['role']!==_0x3b0f('0x8b'))return;return _0x34a462[_0x3b0f('0x8a')]['getMailAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x18a4e0){if(_[_0x3b0f('0x86')](_0x18a4e0)){_0x5768af[_0x3b0f('0x3b')]('i.MailAccountId\x20IS\x20NULL');_0x2e4b1f[_0x3b0f('0x3b')](_0x3b0f('0x8c'));}else{_0x5768af['where'](_0x3b0f('0x6d'),_['map'](_0x18a4e0,'id'));_0x2e4b1f[_0x3b0f('0x3b')](_0x3b0f('0x6d'),_[_0x3b0f('0x1e')](_0x18a4e0,'id'));}});})[_0x3b0f('0x28')](function(){if(_0x34a462['user']['role']==='agent'&&!_0x4e6236&&!_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x6c')])return[];return db['sequelize'][_0x3b0f('0x31')](_0x5768af['toString'](),_0x131f80);})[_0x3b0f('0x28')](function(_0x403268){_0x40996b[_0x3b0f('0x15')]=_0x403268[_0x3b0f('0x36')];if(_0x40996b[_0x3b0f('0x15')]===0x0)return[];return db['sequelize'][_0x3b0f('0x31')](_0x210e4d[_0x3b0f('0x8d')](),_0x131f80)[_0x3b0f('0x28')](function(_0x43e36f){_0x871f4d=_[_0x3b0f('0x8e')](_0x43e36f,'id');_0x131f80=_[_0x3b0f('0x8f')](_0x131f80,{'model':db[_0x3b0f('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34a462[_0x3b0f('0x31')][_0x3b0f('0x35')]){_0x3a8d48[_0x3b0f('0x34')][_0x3b0f('0x23')](function(_0x9f98e0){_0x2e4b1f['field']('i.'+_0x9f98e0);});}else{_0x2e4b1f['field'](_0x3b0f('0x90'),'unreadMessages');_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x91'),_0x3b0f('0x92'));_0x2e4b1f[_0x3b0f('0x3e')]('a.mandatoryDisposition',_0x3b0f('0x93'));_0x2e4b1f['field'](_0x3b0f('0x94'),_0x3b0f('0x95'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x81'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x96'));_0x2e4b1f['field'](_0x3b0f('0x97'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x98'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x99'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9a'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9b'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9c'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9d'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9e'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0x9f'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xa0'));_0x2e4b1f[_0x3b0f('0x3e')]('i.substatus');_0x2e4b1f['field'](_0x3b0f('0xa1'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xa2'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xa3'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xa4'));_0x2e4b1f['field'](_0x3b0f('0xa5'),'Contact.firstName');_0x2e4b1f[_0x3b0f('0x3e')]('c.lastName',_0x3b0f('0xa6'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xa7'),_0x3b0f('0xa8'));_0x2e4b1f[_0x3b0f('0x3e')]('c.phone',_0x3b0f('0xa9'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xaa'),'Contact.mobile');_0x2e4b1f['field'](_0x3b0f('0xab'),_0x3b0f('0xac'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xad'),'Owner.fullname');_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xae'),_0x3b0f('0xaf'));_0x2e4b1f[_0x3b0f('0x3e')](_0x3b0f('0xb0'),_0x3b0f('0x20'));}if(_0x3a8d48[_0x3b0f('0x17')])_0x2e4b1f['limit'](_0x3a8d48[_0x3b0f('0x17')]);if(_0x3a8d48[_0x3b0f('0x16')])_0x2e4b1f[_0x3b0f('0x16')](_0x3a8d48['offset']);return db[_0x3b0f('0xb1')][_0x3b0f('0x31')](_0x2e4b1f['toString'](),_0x131f80);})['then'](function(_0x56e0e7){if(_0x56e0e7[_0x3b0f('0x36')]>0x0)_0x17b785['where'](_0x3b0f('0xb2'),_[_0x3b0f('0x1e')](_0x56e0e7,'id'));return db[_0x3b0f('0xb1')][_0x3b0f('0x31')](_0x17b785[_0x3b0f('0x8d')](),_0x131f80)[_0x3b0f('0x28')](function(_0x5e544f){var _0x38facf=_['groupBy'](_0x5e544f,_0x3b0f('0xb3'));var _0x35162d=[];return db[_0x3b0f('0xb4')][_0x3b0f('0x26')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x3b0f('0x28')](function(_0x40a06f){var _0x145ef8=_0x40a06f[_0x3b0f('0xb5')];_0x56e0e7[_0x3b0f('0x23')](function(_0x429b21){_0x35162d['push'](updateMailInteraction(_0x429b21,_0x871f4d,_0x38facf,_0x145ef8));});return BPromise[_0x3b0f('0xb6')](_0x35162d);});});});})[_0x3b0f('0x28')](function(_0x34a748){_0x40996b[_0x3b0f('0xb7')]=_0x34a748;return _0x40996b;})[_0x3b0f('0x28')](respondWithFilteredResult(_0x299368,_0x3a8d48))[_0x3b0f('0x2b')](handleError(_0x299368,null));};exports[_0x3b0f('0xb8')]=function(_0x365dfa,_0x5612fd){var _0x4d40dc={'raw':![],'where':{'id':_0x365dfa['params']['id']}},_0x3f85b1={};_0x3f85b1[_0x3b0f('0x30')]=_[_0x3b0f('0x32')](db[_0x3b0f('0x2d')]['rawAttributes']);_0x3f85b1[_0x3b0f('0x31')]=_[_0x3b0f('0x32')](_0x365dfa[_0x3b0f('0x31')]);_0x3f85b1[_0x3b0f('0x33')]=_[_0x3b0f('0xb9')](_0x3f85b1[_0x3b0f('0x30')],_0x3f85b1[_0x3b0f('0x31')]);_0x4d40dc[_0x3b0f('0x34')]=_[_0x3b0f('0xb9')](_0x3f85b1[_0x3b0f('0x30')],qs[_0x3b0f('0x35')](_0x365dfa[_0x3b0f('0x31')]['fields']));_0x4d40dc[_0x3b0f('0x34')]=_0x4d40dc['attributes'][_0x3b0f('0x36')]?_0x4d40dc[_0x3b0f('0x34')]:_0x3f85b1[_0x3b0f('0x30')];if(_0x365dfa[_0x3b0f('0x31')][_0x3b0f('0xba')]){_0x4d40dc[_0x3b0f('0xbb')]=[{'all':!![]}];}_0x4d40dc=_[_0x3b0f('0x8f')]({},_0x4d40dc,_0x365dfa[_0x3b0f('0xbc')]);return db[_0x3b0f('0x2d')]['find'](_0x4d40dc)[_0x3b0f('0x28')](handleEntityNotFound(_0x5612fd,null))['then'](respondWithResult(_0x5612fd,null))[_0x3b0f('0x2b')](handleError(_0x5612fd,null));};exports[_0x3b0f('0xbd')]=function(_0x558be7,_0x5b483b){return db[_0x3b0f('0x2d')][_0x3b0f('0xbd')](_0x558be7[_0x3b0f('0xbe')],{})[_0x3b0f('0x28')](respondWithResult(_0x5b483b,0xc9))[_0x3b0f('0x2b')](handleError(_0x5b483b,null));};exports['update']=function(_0x3773a7,_0x37c3e1){if(_0x3773a7[_0x3b0f('0xbe')]['id']){delete _0x3773a7[_0x3b0f('0xbe')]['id'];}return db['MailInteraction'][_0x3b0f('0x55')]({'where':{'id':_0x3773a7[_0x3b0f('0xbf')]['id']}})[_0x3b0f('0x28')](handleEntityNotFound(_0x37c3e1,null))[_0x3b0f('0x28')](saveUpdates(_0x3773a7['body'],null))[_0x3b0f('0x28')](respondWithResult(_0x37c3e1,null))[_0x3b0f('0x2b')](handleError(_0x37c3e1,null));};exports['destroy']=function(_0x13148e,_0x24eb3c){return db['MailInteraction']['find']({'where':{'id':_0x13148e[_0x3b0f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x24eb3c,null))[_0x3b0f('0x28')](removeEntity(_0x24eb3c,null))[_0x3b0f('0x2b')](handleError(_0x24eb3c,null));};exports[_0x3b0f('0xc0')]=function(_0x370773,_0x49828e){return db[_0x3b0f('0x2d')]['describe']()[_0x3b0f('0x28')](respondWithResult(_0x49828e,null))['catch'](handleError(_0x49828e,null));};exports[_0x3b0f('0xc1')]=function(_0x7d618c,_0x5db341){return db[_0x3b0f('0x25')][_0x3b0f('0x55')]({'where':{'id':_0x7d618c[_0x3b0f('0xbf')]['id']}})[_0x3b0f('0x28')](handleEntityNotFound(_0x5db341,null))[_0x3b0f('0x28')](function(_0x25bbc1){if(_0x25bbc1){return _0x25bbc1[_0x3b0f('0xc1')](_0x7d618c[_0x3b0f('0xbe')][_0x3b0f('0xc2')],_['omit'](_0x7d618c[_0x3b0f('0xbe')],['ids','id'])||{});}})[_0x3b0f('0x28')](respondWithResult(_0x5db341,null))[_0x3b0f('0x2b')](handleError(_0x5db341,null));};exports['getMessages']=function(_0x2cf584,_0x1f2eca){var _0x556b97={'raw':![],'where':{}};var _0x571b1e={};var _0x4a1c11={'count':0x0,'rows':[]};return db['MailInteraction'][_0x3b0f('0x26')]({'where':{'id':_0x2cf584[_0x3b0f('0xbf')]['id']}})[_0x3b0f('0x28')](handleEntityNotFound(_0x1f2eca,null))[_0x3b0f('0x28')](function(_0x550396){if(_0x550396){_0x571b1e[_0x3b0f('0x30')]=_[_0x3b0f('0x32')](db[_0x3b0f('0x25')][_0x3b0f('0x2e')]);_0x571b1e['query']=_['keys'](_0x2cf584[_0x3b0f('0x31')]);_0x571b1e['filters']=_[_0x3b0f('0xb9')](_0x571b1e['model'],_0x571b1e[_0x3b0f('0x31')]);_0x556b97[_0x3b0f('0x34')]=_[_0x3b0f('0xb9')](_0x571b1e['model'],qs[_0x3b0f('0x35')](_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x35')]));_0x556b97[_0x3b0f('0x34')]=_0x556b97[_0x3b0f('0x34')][_0x3b0f('0x36')]?_0x556b97[_0x3b0f('0x34')]:_0x571b1e[_0x3b0f('0x30')];if(!_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x37')](_0x3b0f('0x38'))){_0x556b97[_0x3b0f('0x17')]=qs[_0x3b0f('0x17')](_0x2cf584['query'][_0x3b0f('0x17')]);_0x556b97['offset']=qs[_0x3b0f('0x16')](_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x16')]);}_0x556b97[_0x3b0f('0x39')]=qs[_0x3b0f('0x3a')](_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x3a')]);_0x556b97['where']=qs[_0x3b0f('0x33')](_[_0x3b0f('0x3c')](_0x2cf584[_0x3b0f('0x31')],_0x571b1e[_0x3b0f('0x33')]));_0x556b97['where']['MailInteractionId']=_0x550396['id'];if(_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x7b')]){_0x556b97[_0x3b0f('0x3b')]=_[_0x3b0f('0x8f')](_0x556b97[_0x3b0f('0x3b')],{'$or':_['map'](_0x556b97[_0x3b0f('0x34')],function(_0x30d1cc){var _0x93b8ce={};_0x93b8ce[_0x30d1cc]={'$like':'%'+_0x2cf584['query'][_0x3b0f('0x7b')]+'%'};return _0x93b8ce;})});}if(_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x71')]){var _0x35fb54=_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0x71')]['split'](',');var _0x83079e={};_0x83079e[_0x35fb54[0x0]]={'$gte':moment(_0x35fb54[0x1])[_0x3b0f('0xc3')](_0x3b0f('0xc4'))};_0x556b97[_0x3b0f('0x3b')]=_[_0x3b0f('0x8f')](_0x556b97[_0x3b0f('0x3b')],_0x83079e);}_0x556b97=_[_0x3b0f('0x8f')]({},_0x556b97,_0x2cf584['options']);return db[_0x3b0f('0x25')][_0x3b0f('0x15')]({'where':_0x556b97[_0x3b0f('0x3b')]})[_0x3b0f('0x28')](function(_0x11775e){_0x4a1c11[_0x3b0f('0x15')]=_0x11775e;if(_0x2cf584[_0x3b0f('0x31')][_0x3b0f('0xba')]){_0x556b97[_0x3b0f('0xbb')]=[{'all':!![]}];}return db['MailMessage'][_0x3b0f('0xc5')](_0x556b97);})[_0x3b0f('0x28')](function(_0x57b117){if(_0x2cf584['query'][_0x3b0f('0xc6')]===_0x3b0f('0xc7')){for(var _0x526713=0x0;_0x526713<_0x57b117[_0x3b0f('0x36')];_0x526713++){_0x57b117[_0x526713]['body']=juice(_0x57b117[_0x526713][_0x3b0f('0xbe')]);}}_0x4a1c11[_0x3b0f('0xb7')]=_0x57b117;return _0x4a1c11;});}})[_0x3b0f('0x28')](respondWithFilteredResult(_0x1f2eca,_0x556b97))['catch'](handleError(_0x1f2eca,null));};exports[_0x3b0f('0xc8')]=function(_0x296746,_0x45c818){return db['MailInteraction']['find']({'where':{'id':_0x296746[_0x3b0f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x45c818,null))[_0x3b0f('0x28')](function(_0x5962cb){if(_0x5962cb){return _0x5962cb[_0x3b0f('0xc9')](_0x296746['body'][_0x3b0f('0xc2')],_[_0x3b0f('0xca')](_0x296746[_0x3b0f('0xbe')],['ids','id'])||{})[_0x3b0f('0xcb')](function(){return db['Tag'][_0x3b0f('0xc5')]({'attributes':['id','name',_0x3b0f('0x3f')],'where':{'id':_0x296746[_0x3b0f('0xbe')][_0x3b0f('0xc2')]}});})[_0x3b0f('0x28')](function(_0x1eea41){socket['emit']('mailInteractionTags:save',{'id':Number(_0x296746['params']['id']),'tags':_0x1eea41||[]});return{'id':Number(_0x296746[_0x3b0f('0xbf')]['id']),'tags':_0x1eea41||[]};});}})['then'](respondWithResult(_0x45c818,null))[_0x3b0f('0x2b')](handleError(_0x45c818,null));};exports[_0x3b0f('0xcc')]=function(_0x215437,_0x2771c9){return db[_0x3b0f('0x2d')]['find']({'where':{'id':_0x215437['params']['id']}})[_0x3b0f('0x28')](handleEntityNotFound(_0x2771c9,null))[_0x3b0f('0x28')](function(_0x978df4){if(_0x978df4){return _0x978df4['removeTags'](_0x215437[_0x3b0f('0x31')][_0x3b0f('0xc2')]);}})[_0x3b0f('0x28')](respondWithStatusCode(_0x2771c9,null))[_0x3b0f('0x2b')](handleError(_0x2771c9,null));};exports['download']=function(_0x5152ea,_0xb6a12b){var _0x58d753=moment()[_0x3b0f('0xcd')]()['toString']();var _0x2cd383=path[_0x3b0f('0xce')](config[_0x3b0f('0xcf')],_0x3b0f('0xd0'),'files',_0x3b0f('0xd1'));var _0x1ecc42=path[_0x3b0f('0xce')](config['root'],_0x3b0f('0xd0'),_0x3b0f('0xd2'),_0x3b0f('0xd3'));var _0xfcd19a=path['join'](_0x2cd383,_0x58d753);var _0x34d5b2=util[_0x3b0f('0xc3')](_0x3b0f('0xd4'),_0x5152ea[_0x3b0f('0xbf')]['id'],_0x58d753);var _0x10074c=path[_0x3b0f('0xce')](_0x2cd383,_0x34d5b2);var _0x420b4c=[];if(_0x5152ea['query'][_0x3b0f('0xd3')]){_0x420b4c[_0x3b0f('0x24')]({'model':db['Attachment'],'as':_0x3b0f('0xd5'),'raw':!![]});}var _0x1cb371=[{'model':db[_0x3b0f('0x25')],'as':_0x3b0f('0xd6'),'attributes':['id',_0x3b0f('0xbe'),'from','to','cc','bcc','subject',_0x3b0f('0x6f')],'where':{'secret':![]},'order':qs[_0x3b0f('0x3a')]('id'),'include':_0x420b4c}];return db[_0x3b0f('0x2d')]['find']({'where':{'id':_0x5152ea['params']['id']},'include':_0x1cb371})[_0x3b0f('0x28')](handleEntityNotFound(_0xb6a12b,null))['then'](function(_0x32c550){if(_0x32c550&&_0x32c550['Messages']){var _0x4898a4=_0x32c550[_0x3b0f('0xd7')]({'plain':!![]});fs[_0x3b0f('0xd8')](_0xfcd19a);return BPromise[_0x3b0f('0xd9')](_0x4898a4[_0x3b0f('0xd6')],function(_0x1827e2,_0x310f22){var _0x461afd={'from':_0x1827e2[_0x3b0f('0x40')],'to':_0x1827e2['to'],'subject':_0x1827e2['subject'],'html':htmlEntities[_0x3b0f('0xda')](_0x1827e2['body']),'headers':{'Date':moment(_0x1827e2[_0x3b0f('0x6f')])[_0x3b0f('0xc3')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1827e2['cc']){_0x461afd[_0x3b0f('0xdb')]['Cc']=_0x1827e2['cc'];}if(_0x1827e2[_0x3b0f('0xdc')]){_0x461afd['headers']['Bcc']=_0x1827e2[_0x3b0f('0xdc')];}return new BPromise(function(_0x5e59e9,_0x4acbfc){if(_0x1827e2[_0x3b0f('0xd5')]){for(var _0xb38083=0x0;_0xb38083<_0x1827e2['Attachments'][_0x3b0f('0x36')];_0xb38083++){var _0x33bd72=_0x1827e2['Attachments'][_0xb38083];var _0x2c56f7=path['join'](_0x1ecc42,_0x33bd72[_0x3b0f('0xdd')]);if(fs[_0x3b0f('0xde')](_0x2c56f7)){_0x461afd[_0x3b0f('0xd3')][_0x3b0f('0x24')]({'name':_0x33bd72[_0x3b0f('0x1b')],'contentType':_0x33bd72[_0x3b0f('0x62')],'data':fs[_0x3b0f('0xdf')](_0x2c56f7)});}}}emlformat[_0x3b0f('0xe0')](_0x461afd,function(_0x571a8b,_0x2149b9){if(_0x571a8b)return _0x4acbfc(_0x571a8b);fs['writeFileSync'](path[_0x3b0f('0xce')](_0xfcd19a,util[_0x3b0f('0xc3')](_0x3b0f('0xe1'),_0x310f22)),_0x2149b9);return _0x5e59e9(_0x2149b9);});});})['then'](function(){return new BPromise(function(_0x5f26b4,_0x1179d3){zipdir(_0xfcd19a,{'saveTo':_0x10074c},function(_0xbe0220,_0x4bc459){if(_0xbe0220)return _0x1179d3(_0xbe0220);return _0x5f26b4(_0x4bc459);});})[_0x3b0f('0x28')](function(){return new BPromise(function(_0x5f4b79,_0x38656d){rimraf(_0xfcd19a,function(_0x55a66c){if(_0x55a66c)_0x38656d(_0x55a66c);return _0x5f4b79();});});})[_0x3b0f('0x28')](function(){return _0xb6a12b[_0x3b0f('0xe2')](_0x10074c,_0x34d5b2,function(_0x1b0094){if(!_0x1b0094)fs[_0x3b0f('0xe3')](_0x10074c);});});});}else{return _0xb6a12b[_0x3b0f('0xe4')](0xc8);}})['catch'](handleError(_0xb6a12b,null));}; \ No newline at end of file +var _0x1330=['c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','push','rows','show','params','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','mkdirSync','each','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','download','unlinkSync','eml-format','rimraf','moment','bluebird','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','limit','undefined','count','offset','set','json','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','MailMessage','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','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','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x1330,0x12d));var _0x0133=function(_0x58c654,_0x56f774){_0x58c654=_0x58c654-0x0;var _0x1b1164=_0x1330[_0x58c654];return _0x1b1164;};'use strict';var emlformat=require(_0x0133('0x0'));var rimraf=require(_0x0133('0x1'));var zipdir=require('zip-dir');var moment=require(_0x0133('0x2'));var BPromise=require(_0x0133('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x0133('0x4'));var squel=require(_0x0133('0x5'));var juice=require(_0x0133('0x6'));var Redis=require(_0x0133('0x7'));var qs=require(_0x0133('0x8'));var as=require(_0x0133('0x9'));var logger=require(_0x0133('0xa'))(_0x0133('0xb'));var config=require(_0x0133('0xc'));var db=require(_0x0133('0xd'))['db'];var htmlEntities=require(_0x0133('0xe'));config[_0x0133('0xf')]=_[_0x0133('0x10')](config[_0x0133('0xf')],{'host':_0x0133('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0133('0xf')]));require(_0x0133('0x12'))[_0x0133('0x13')](socket);function respondWithStatusCode(_0x4aa405,_0x59fd0a){_0x59fd0a=_0x59fd0a||0xcc;return function(_0x1c184d){if(_0x1c184d){return _0x4aa405[_0x0133('0x14')](_0x59fd0a);}return _0x4aa405[_0x0133('0x15')](_0x59fd0a)[_0x0133('0x16')]();};}function respondWithResult(_0x28db71,_0x36a6da){_0x36a6da=_0x36a6da||0xc8;return function(_0x36babc){if(_0x36babc){return _0x28db71[_0x0133('0x15')](_0x36a6da)['json'](_0x36babc);}};}function respondWithFilteredResult(_0x597dce,_0x131e53){return function(_0x4f7288){if(_0x4f7288){var _0x2f37a0=typeof _0x131e53['offset']==='undefined'&&typeof _0x131e53[_0x0133('0x17')]===_0x0133('0x18');var _0x10e2c=_0x4f7288[_0x0133('0x19')];var _0x351579=_0x2f37a0?0x0:_0x131e53[_0x0133('0x1a')];var _0xeb5380=_0x2f37a0?_0x4f7288['count']:_0x131e53['offset']+_0x131e53[_0x0133('0x17')];var _0x2a5148;if(_0xeb5380>=_0x10e2c){_0xeb5380=_0x10e2c;_0x2a5148=0xc8;}else{_0x2a5148=0xce;}_0x597dce[_0x0133('0x15')](_0x2a5148);return _0x597dce[_0x0133('0x1b')]('Content-Range',_0x351579+'-'+_0xeb5380+'/'+_0x10e2c)[_0x0133('0x1c')](_0x4f7288);}return null;};}function saveUpdates(_0x260f86){return function(_0x29b3fb){if(_0x29b3fb){return _0x29b3fb[_0x0133('0x1d')](_0x260f86)['then'](function(_0x336118){return _0x336118;});}return null;};}function removeEntity(_0xd9d621){return function(_0x231fd7){if(_0x231fd7){return _0x231fd7[_0x0133('0x1e')]()[_0x0133('0x1f')](function(){_0xd9d621[_0x0133('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ffa9){return function(_0x54a5b4){if(!_0x54a5b4){_0x54ffa9[_0x0133('0x14')](0x194);}return _0x54a5b4;};}function handleError(_0x2dc038,_0x512898){_0x512898=_0x512898||0x1f4;return function(_0x4cc2c3){logger[_0x0133('0x20')](_0x4cc2c3[_0x0133('0x21')]);if(_0x4cc2c3['name']){delete _0x4cc2c3[_0x0133('0x22')];}_0x2dc038['status'](_0x512898)[_0x0133('0x23')](_0x4cc2c3);};}function getInteractionUsers(_0x359e5c,_0x5618b8){return new BPromise(function(_0x4dc98e,_0x107a00){try{if(_0x5618b8[_0x359e5c['id']]){_0x359e5c[_0x0133('0x24')]=_[_0x0133('0x25')](_0x5618b8[_0x359e5c['id']],function(_0x29fb7e){return{'id':_0x29fb7e['id'],'fullname':_0x29fb7e[_0x0133('0x26')]};});}}catch(_0x54d7dc){_0x107a00(_0x54d7dc);}_0x4dc98e(_0x359e5c);});}function getInteractionTags(_0x3204eb,_0xa98fd5){return new BPromise(function(_0x5d72c7,_0x3ed704){try{if(_0x3204eb[_0x0133('0x27')]){_0x3204eb[_0x0133('0x28')]=[];_0x3204eb[_0x0133('0x27')]['split'](',')[_0x0133('0x29')](function(_0x5e66be){_0x3204eb[_0x0133('0x28')]['push'](_0xa98fd5[_0x5e66be]);});}delete _0x3204eb[_0x0133('0x27')];}catch(_0x107a2f){_0x3ed704(_0x107a2f);}_0x5d72c7(_0x3204eb);});}function getLastMessageText(_0x19286b){return new BPromise(function(_0x514b97,_0x1262f2){return db[_0x0133('0x2a')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x19286b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0133('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0133('0x2c'),'raw':!![]})['then'](function(_0x945c6f){if(_0x945c6f&&_0x945c6f[_0x0133('0x2d')]){_0x19286b[_0x0133('0x2e')]=_[_0x0133('0x2f')](_0x945c6f[_0x0133('0x2d')]);}_0x514b97(_0x19286b);})[_0x0133('0x30')](function(_0x5e0859){_0x1262f2(_0x5e0859);});});}function updateMailInteraction(_0x7a222d,_0x40d860,_0x4fce51,_0x1c6dbf){return new BPromise(function(_0x1b3a19,_0x1bb2da){return getInteractionUsers(_0x7a222d,_0x4fce51)[_0x0133('0x1f')](function(_0x28f439){return getInteractionTags(_0x28f439,_0x40d860);})[_0x0133('0x1f')](function(_0x35859f){if(_0x1c6dbf){_0x1b3a19(getLastMessageText(_0x35859f));}else{_0x1b3a19(_0x35859f);}})[_0x0133('0x30')](function(_0x501723){_0x1bb2da(_0x501723);});});}exports[_0x0133('0x31')]=function(_0x3008b0,_0x535a1d){var _0x181b7e={},_0x36b7fa={},_0x92e8f4={'count':0x0,'rows':[]};var _0x2339a1=_[_0x0133('0x25')](db[_0x0133('0x32')][_0x0133('0x33')],function(_0x3a71a8){return{'name':_0x3a71a8[_0x0133('0x34')],'type':_0x3a71a8['type'][_0x0133('0x35')]};});_0x36b7fa[_0x0133('0x36')]=_[_0x0133('0x25')](_0x2339a1,_0x0133('0x22'));_0x36b7fa['query']=_[_0x0133('0x37')](_0x3008b0[_0x0133('0x38')]);_0x36b7fa['filters']=_[_0x0133('0x39')](_0x36b7fa[_0x0133('0x36')],_0x36b7fa[_0x0133('0x38')]);_0x181b7e[_0x0133('0x3a')]=_[_0x0133('0x39')](_0x36b7fa[_0x0133('0x36')],qs[_0x0133('0x3b')](_0x3008b0['query'][_0x0133('0x3b')]));_0x181b7e[_0x0133('0x3a')]=_0x181b7e[_0x0133('0x3a')][_0x0133('0x3c')]?_0x181b7e[_0x0133('0x3a')]:_0x36b7fa[_0x0133('0x36')];if(!_0x3008b0[_0x0133('0x38')][_0x0133('0x3d')]('nolimit')){_0x181b7e['limit']=qs[_0x0133('0x17')](_0x3008b0[_0x0133('0x38')][_0x0133('0x17')]);_0x181b7e[_0x0133('0x1a')]=qs[_0x0133('0x1a')](_0x3008b0['query'][_0x0133('0x1a')]);}_0x181b7e[_0x0133('0x3e')]=qs[_0x0133('0x3f')](_0x3008b0['query']['sort']);_0x181b7e[_0x0133('0x40')]=qs[_0x0133('0x41')](_[_0x0133('0x42')](_0x3008b0['query'],_0x36b7fa[_0x0133('0x41')]),_0x2339a1);var _0x18e2db=[];var _0xf38bf0=squel[_0x0133('0x43')]()[_0x0133('0x44')]('id')[_0x0133('0x44')]('name')['field']('color')[_0x0133('0x45')](_0x0133('0x46'));var _0x55445b=squel['select']()[_0x0133('0x44')](_0x0133('0x47'))[_0x0133('0x44')](_0x0133('0x48'))[_0x0133('0x44')](_0x0133('0x49'))[_0x0133('0x45')](_0x0133('0x4a'),'ui')['left_join'](_0x0133('0x4b'),'u',_0x0133('0x4c'));var _0x33fd30=squel[_0x0133('0x43')]()[_0x0133('0x45')](_0x0133('0x4d'),'i')[_0x0133('0x4e')](_0x0133('0x4f'),'c',_0x0133('0x50'))[_0x0133('0x4e')](_0x0133('0x4b'),'o',_0x0133('0x51'))[_0x0133('0x4e')](_0x0133('0x52'),'a','a.id\x20=\x20i.MailAccountId')[_0x0133('0x4e')](_0x0133('0x53'),'me',_0x0133('0x54'))[_0x0133('0x4e')]('mail_interaction_has_tags','it',_0x0133('0x55'))['left_join'](_0x0133('0x46'),'t','t.id\x20=\x20it.TagId');var _0x4d5977=squel[_0x0133('0x56')]();var _0x5d2b0d=[];var _0x247fdf=squel[_0x0133('0x56')]();var _0x214391;if(_0x3008b0[_0x0133('0x38')][_0x0133('0x57')]){_0x214391=as[_0x0133('0x58')](_0x3008b0['query'][_0x0133('0x57')]);var _0x4efe4a=_0x214391[_0x0133('0x59')];for(var _0xabbd70=0x0;_0xabbd70<_0x214391[_0x0133('0x5a')]['length'];_0xabbd70++){var _0x12b6e0=_0x214391[_0x0133('0x5a')][_0xabbd70];var _0x3addb5='i';var _0x2f7975=_[_0x0133('0x5b')](_0x2339a1,[_0x0133('0x22'),_0x12b6e0['field']]);if(!_0x2f7975){switch(_0x12b6e0['field']){case _0x0133('0x5c'):if(_0x12b6e0[_0x0133('0x5d')]==0x1){_0x33fd30[_0x0133('0x5e')]('`'+_0x12b6e0[_0x0133('0x44')]+_0x0133('0x5f'));}else{_0x33fd30[_0x0133('0x5e')]('`'+_0x12b6e0[_0x0133('0x44')]+_0x0133('0x60'));}break;case'Contact':if(_0x12b6e0[_0x0133('0x61')]===_0x0133('0x62')){if(_0x12b6e0[_0x0133('0x5d')][_0x0133('0x63')]('\x20')['length']>0x1){_0x4d5977[_0x4efe4a](_0x0133('0x64'),qs[_0x0133('0x65')](_0x12b6e0[_0x0133('0x5d')]),null);}else{var _0x3d3011='%'+_0x12b6e0[_0x0133('0x5d')]+'%';_0x4d5977[_0x4efe4a](_0x0133('0x66'),_0x3d3011,_0x3d3011,_0x3d3011);}}else{_0x2f7975=_[_0x0133('0x5b')](_0x2339a1,[_0x0133('0x22'),_0x0133('0x67')]);_0x12b6e0['field']=_0x0133('0x67');_0x3b3c4=as[_0x0133('0x68')](_0x3addb5,_0x2f7975[_0x0133('0x69')],_0x12b6e0);_0x4d5977[_0x4efe4a](_0x3b3c4[_0x0133('0x6a')],_0x3b3c4['value'][_0x0133('0x6b')],_0x3b3c4['value'][_0x0133('0x16')]);}break;case _0x0133('0x6c'):var _0x11c856=_0x12b6e0[_0x0133('0x5d')]['split'](',')[_0x0133('0x25')](function(_0x50dc7f){return Number(_0x50dc7f);});_0x11c856[_0x0133('0x29')](function(_0x10dab9){_0x247fdf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x10dab9+',%');});_0x5d2b0d=_[_0x0133('0x6d')](_0x5d2b0d,_0x11c856);break;case _0x0133('0x6e'):if(_0x12b6e0[_0x0133('0x61')]===_0x0133('0x62')){_0x4d5977[_0x4efe4a](_0x0133('0x6f'),'%'+_0x12b6e0['value']+'%',null);}else{_0x2f7975=_[_0x0133('0x5b')](_0x2339a1,[_0x0133('0x22'),_0x0133('0x70')]);_0x12b6e0[_0x0133('0x44')]=_0x0133('0x70');_0x3b3c4=as['buildExpression'](_0x3addb5,_0x2f7975[_0x0133('0x69')],_0x12b6e0);_0x4d5977[_0x4efe4a](_0x3b3c4[_0x0133('0x6a')],_0x3b3c4['value']['start'],_0x3b3c4['value'][_0x0133('0x16')]);}break;case'plainBody':_0x3b3c4=as['buildExpression']('me',null,_0x12b6e0);_0x4d5977[_0x4efe4a](_0x3b3c4['text'],_0x3b3c4[_0x0133('0x5d')][_0x0133('0x6b')],_0x3b3c4['value'][_0x0133('0x16')]);break;}}else{var _0x3b3c4=as[_0x0133('0x68')](_0x3addb5,_0x2f7975[_0x0133('0x69')],_0x12b6e0);_0x4d5977[_0x4efe4a](_0x3b3c4['text'],_0x3b3c4[_0x0133('0x5d')][_0x0133('0x6b')],_0x3b3c4['value'][_0x0133('0x16')]);}}}else{var _0x4656a8=_(_0x3008b0[_0x0133('0x38')])['keys']()[_0x0133('0x25')](function(_0x519a47){return _[_0x0133('0x71')](_0x2339a1,[_0x0133('0x22'),_0x519a47])?_0x519a47:undefined;})[_0x0133('0x72')]()[_0x0133('0x5d')]();if(!_[_0x0133('0x73')](_0x4656a8)){_0x4656a8[_0x0133('0x29')](function(_0x522088){if(_0x522088===_0x0133('0x74')){_0x33fd30[_0x0133('0x40')](_0x0133('0x75'),[]['concat'](_0x3008b0[_0x0133('0x38')][_0x522088]));}else if(_0x522088===_0x0133('0x76')){var _0x1ac4d3=JSON[_0x0133('0x77')](_0x3008b0[_0x0133('0x38')][_0x522088])['$gte'];var _0x10cd8e=JSON['parse'](_0x3008b0[_0x0133('0x38')][_0x522088])[_0x0133('0x78')];_0x33fd30['where'](_0x0133('0x79'),_0x1ac4d3,_0x10cd8e);}else{if(_0x3008b0['query'][_0x522088]==='null'){_0x33fd30[_0x0133('0x40')]('i.'+_0x522088+_0x0133('0x7a'));}else{_0x33fd30['where']('i.'+_0x522088+_0x0133('0x7b'),_0x3008b0['query'][_0x522088]);}}});}if(_0x3008b0[_0x0133('0x38')][_0x0133('0x7c')]){if(_0x3008b0[_0x0133('0x38')][_0x0133('0x7c')]==0x1){_0x33fd30[_0x0133('0x5e')](_0x0133('0x7d'));}else{_0x33fd30['having'](_0x0133('0x7e'));}}if(_0x3008b0[_0x0133('0x38')]['tag']){_0x5d2b0d=_[_0x0133('0x7f')](_0x3008b0[_0x0133('0x38')][_0x0133('0x80')])?_0x3008b0[_0x0133('0x38')][_0x0133('0x80')]:new Array(_0x3008b0[_0x0133('0x38')][_0x0133('0x80')]);_0x5d2b0d['forEach'](function(_0x1c070f){_0x247fdf['or'](_0x0133('0x81'),'%,'+_0x1c070f+',%');});}if(_0x3008b0[_0x0133('0x38')][_0x0133('0x82')]){var _0x45f709=_0x3008b0['query'][_0x0133('0x82')]['replace']('\x5c','\x5c\x5c')[_0x0133('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x45f709)){_0x4d5977['or'](_0x0133('0x84'),_0x45f709+'%');}else if(qs['isEmail'](_0x45f709)){_0x4d5977['or'](_0x0133('0x85'),_0x45f709+'%');}else{_0x4d5977['or'](_0x0133('0x86'),qs[_0x0133('0x65')](_0x45f709))['or'](_0x0133('0x87'),qs['getFullTextValue'](_0x45f709));}}}_0x33fd30['where'](_0x4d5977);_0x33fd30[_0x0133('0x88')](_0x0133('0x89'));var _0x172207={'type':db[_0x0133('0x8a')][_0x0133('0x8b')][_0x0133('0x8c')],'raw':!![]};var _0x31b8d1=_0x33fd30['clone']();_0x31b8d1['field'](_0x0133('0x89'));_0x31b8d1[_0x0133('0x44')](_0x0133('0x8d'),_0x0133('0x5c'));if(_0x181b7e['order']){_0x181b7e['order']['forEach'](function(_0x7e07f5){var _0x15398e=_0x7e07f5[0x0]===_0x0133('0x8e')?_0x7e07f5[0x0]:'i.'+_0x7e07f5[0x0];_0x33fd30[_0x0133('0x3e')](_0x15398e,_0x7e07f5[0x1]===_0x0133('0x8f')?![]:!![]);});}if(!_[_0x0133('0x73')](_0x5d2b0d)){_0x33fd30[_0x0133('0x5e')](_0x247fdf);_0x31b8d1[_0x0133('0x40')](_0x0133('0x90'),_0x5d2b0d);}BPromise[_0x0133('0x91')]()[_0x0133('0x1f')](function(){if(!_0x214391){if(_0x3008b0[_0x0133('0x38')][_0x0133('0x74')])return;_0x31b8d1[_0x0133('0x40')](_0x0133('0x92'));_0x33fd30[_0x0133('0x40')](_0x0133('0x92'));return;}if(_0x3008b0[_0x0133('0x93')][_0x0133('0x94')]!=='agent')return;return _0x3008b0['user'][_0x0133('0x95')]({'attributes':['id'],'raw':!![]})[_0x0133('0x1f')](function(_0x296c38){if(_[_0x0133('0x73')](_0x296c38)){_0x31b8d1[_0x0133('0x40')](_0x0133('0x96'));_0x33fd30[_0x0133('0x40')](_0x0133('0x96'));}else{_0x31b8d1[_0x0133('0x40')](_0x0133('0x75'),_[_0x0133('0x25')](_0x296c38,'id'));_0x33fd30['where'](_0x0133('0x75'),_['map'](_0x296c38,'id'));}});})[_0x0133('0x1f')](function(){if(_0x3008b0[_0x0133('0x93')]['role']===_0x0133('0x97')&&!_0x214391&&!_0x3008b0[_0x0133('0x38')][_0x0133('0x74')])return[];return db[_0x0133('0x98')][_0x0133('0x38')](_0x31b8d1[_0x0133('0x99')](),_0x172207);})[_0x0133('0x1f')](function(_0x2ebdd7){_0x92e8f4[_0x0133('0x19')]=_0x2ebdd7[_0x0133('0x3c')];if(_0x92e8f4[_0x0133('0x19')]===0x0)return[];return db['sequelize']['query'](_0xf38bf0[_0x0133('0x99')](),_0x172207)[_0x0133('0x1f')](function(_0x1163db){_0x18e2db=_[_0x0133('0x9a')](_0x1163db,'id');_0x172207=_['merge'](_0x172207,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3008b0[_0x0133('0x38')][_0x0133('0x3b')]){_0x181b7e['attributes']['forEach'](function(_0x3cffe9){_0x33fd30[_0x0133('0x44')]('i.'+_0x3cffe9);});}else{_0x33fd30[_0x0133('0x44')](_0x0133('0x8d'),_0x0133('0x5c'));_0x33fd30[_0x0133('0x44')](_0x0133('0x9b'),_0x0133('0x9c'));_0x33fd30[_0x0133('0x44')]('a.mandatoryDisposition',_0x0133('0x9d'));_0x33fd30[_0x0133('0x44')]('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',_0x0133('0x8e'));_0x33fd30['field']('i.id');_0x33fd30[_0x0133('0x44')](_0x0133('0x9e'));_0x33fd30['field'](_0x0133('0x9f'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa0'));_0x33fd30[_0x0133('0x44')]('i.closedAt');_0x33fd30[_0x0133('0x44')]('i.attach');_0x33fd30[_0x0133('0x44')]('i.lastMsgAt');_0x33fd30[_0x0133('0x44')](_0x0133('0xa1'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa2'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa3'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa4'));_0x33fd30['field'](_0x0133('0xa5'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa6'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa7'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa8'));_0x33fd30[_0x0133('0x44')](_0x0133('0xa9'));_0x33fd30[_0x0133('0x44')](_0x0133('0xaa'));_0x33fd30[_0x0133('0x44')](_0x0133('0xab'),_0x0133('0xac'));_0x33fd30[_0x0133('0x44')](_0x0133('0xad'),_0x0133('0xae'));_0x33fd30[_0x0133('0x44')](_0x0133('0xaf'),_0x0133('0xb0'));_0x33fd30['field'](_0x0133('0xb1'),_0x0133('0xb2'));_0x33fd30['field'](_0x0133('0xb3'),_0x0133('0xb4'));_0x33fd30[_0x0133('0x44')](_0x0133('0xb5'),_0x0133('0xb6'));_0x33fd30[_0x0133('0x44')](_0x0133('0xb7'),_0x0133('0xb8'));_0x33fd30[_0x0133('0x44')]('o.internal','Owner.internal');_0x33fd30[_0x0133('0x44')](_0x0133('0xb9'),'TagIds');}if(_0x181b7e[_0x0133('0x17')])_0x33fd30[_0x0133('0x17')](_0x181b7e[_0x0133('0x17')]);if(_0x181b7e[_0x0133('0x1a')])_0x33fd30['offset'](_0x181b7e[_0x0133('0x1a')]);return db['sequelize'][_0x0133('0x38')](_0x33fd30[_0x0133('0x99')](),_0x172207);})[_0x0133('0x1f')](function(_0x50ce34){if(_0x50ce34['length']>0x0)_0x55445b['where'](_0x0133('0xba'),_[_0x0133('0x25')](_0x50ce34,'id'));return db['sequelize']['query'](_0x55445b[_0x0133('0x99')](),_0x172207)['then'](function(_0x451e1f){var _0x34c7fc=_[_0x0133('0xbb')](_0x451e1f,_0x0133('0xbc'));var _0x33a550=[];return db[_0x0133('0xbd')][_0x0133('0xbe')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x0133('0x1f')](function(_0x2ff6ae){var _0x1abe5e=_0x2ff6ae[_0x0133('0xbf')];_0x50ce34[_0x0133('0x29')](function(_0x409e43){_0x33a550[_0x0133('0xc0')](updateMailInteraction(_0x409e43,_0x18e2db,_0x34c7fc,_0x1abe5e));});return BPromise['all'](_0x33a550);});});});})['then'](function(_0x2d9449){_0x92e8f4[_0x0133('0xc1')]=_0x2d9449;return _0x92e8f4;})[_0x0133('0x1f')](respondWithFilteredResult(_0x535a1d,_0x181b7e))[_0x0133('0x30')](handleError(_0x535a1d,null));};exports[_0x0133('0xc2')]=function(_0x58c56c,_0x71e346){var _0x472d17={'raw':![],'where':{'id':_0x58c56c[_0x0133('0xc3')]['id']}},_0x46e21e={};_0x46e21e[_0x0133('0x36')]=_[_0x0133('0x37')](db[_0x0133('0x32')]['rawAttributes']);_0x46e21e['query']=_[_0x0133('0x37')](_0x58c56c['query']);_0x46e21e[_0x0133('0x41')]=_[_0x0133('0x39')](_0x46e21e[_0x0133('0x36')],_0x46e21e[_0x0133('0x38')]);_0x472d17[_0x0133('0x3a')]=_[_0x0133('0x39')](_0x46e21e[_0x0133('0x36')],qs['fields'](_0x58c56c[_0x0133('0x38')][_0x0133('0x3b')]));_0x472d17['attributes']=_0x472d17[_0x0133('0x3a')][_0x0133('0x3c')]?_0x472d17['attributes']:_0x46e21e['model'];if(_0x58c56c[_0x0133('0x38')]['includeAll']){_0x472d17[_0x0133('0xc4')]=[{'all':!![]}];}_0x472d17=_[_0x0133('0xc5')]({},_0x472d17,_0x58c56c[_0x0133('0xc6')]);return db[_0x0133('0x32')][_0x0133('0x5b')](_0x472d17)[_0x0133('0x1f')](handleEntityNotFound(_0x71e346,null))['then'](respondWithResult(_0x71e346,null))['catch'](handleError(_0x71e346,null));};exports[_0x0133('0xc7')]=function(_0x3f7d0c,_0x163a0c){return db[_0x0133('0x32')][_0x0133('0xc7')](_0x3f7d0c['body'],{})['then'](respondWithResult(_0x163a0c,0xc9))[_0x0133('0x30')](handleError(_0x163a0c,null));};exports[_0x0133('0x1d')]=function(_0x51f74d,_0x205cf2){if(_0x51f74d['body']['id']){delete _0x51f74d[_0x0133('0xc8')]['id'];}return db[_0x0133('0x32')][_0x0133('0x5b')]({'where':{'id':_0x51f74d[_0x0133('0xc3')]['id']}})['then'](handleEntityNotFound(_0x205cf2,null))['then'](saveUpdates(_0x51f74d[_0x0133('0xc8')],null))[_0x0133('0x1f')](respondWithResult(_0x205cf2,null))[_0x0133('0x30')](handleError(_0x205cf2,null));};exports['destroy']=function(_0x2f8bef,_0x27d221){return db[_0x0133('0x32')][_0x0133('0x5b')]({'where':{'id':_0x2f8bef['params']['id']}})[_0x0133('0x1f')](handleEntityNotFound(_0x27d221,null))[_0x0133('0x1f')](removeEntity(_0x27d221,null))[_0x0133('0x30')](handleError(_0x27d221,null));};exports[_0x0133('0xc9')]=function(_0x45c175,_0x5020ed){return db[_0x0133('0x32')][_0x0133('0xc9')]()[_0x0133('0x1f')](respondWithResult(_0x5020ed,null))[_0x0133('0x30')](handleError(_0x5020ed,null));};exports['addMessage']=function(_0xbe6fac,_0x3484ba){return db[_0x0133('0x2a')][_0x0133('0x5b')]({'where':{'id':_0xbe6fac[_0x0133('0xc3')]['id']}})['then'](handleEntityNotFound(_0x3484ba,null))['then'](function(_0x3e0979){if(_0x3e0979){return _0x3e0979[_0x0133('0xca')](_0xbe6fac[_0x0133('0xc8')][_0x0133('0xcb')],_[_0x0133('0xcc')](_0xbe6fac['body'],['ids','id'])||{});}})[_0x0133('0x1f')](respondWithResult(_0x3484ba,null))[_0x0133('0x30')](handleError(_0x3484ba,null));};exports[_0x0133('0xcd')]=function(_0x12c3ee,_0xf585db){var _0x49c9bf={'raw':![],'where':{}};var _0x9992d9={};var _0x1d6c73={'count':0x0,'rows':[]};return db[_0x0133('0x32')][_0x0133('0xbe')]({'where':{'id':_0x12c3ee[_0x0133('0xc3')]['id']}})[_0x0133('0x1f')](handleEntityNotFound(_0xf585db,null))[_0x0133('0x1f')](function(_0x7764ee){if(_0x7764ee){_0x9992d9[_0x0133('0x36')]=_[_0x0133('0x37')](db['MailMessage'][_0x0133('0x33')]);_0x9992d9[_0x0133('0x38')]=_[_0x0133('0x37')](_0x12c3ee[_0x0133('0x38')]);_0x9992d9[_0x0133('0x41')]=_['intersection'](_0x9992d9[_0x0133('0x36')],_0x9992d9[_0x0133('0x38')]);_0x49c9bf[_0x0133('0x3a')]=_[_0x0133('0x39')](_0x9992d9[_0x0133('0x36')],qs[_0x0133('0x3b')](_0x12c3ee[_0x0133('0x38')]['fields']));_0x49c9bf[_0x0133('0x3a')]=_0x49c9bf[_0x0133('0x3a')]['length']?_0x49c9bf['attributes']:_0x9992d9[_0x0133('0x36')];if(!_0x12c3ee['query'][_0x0133('0x3d')](_0x0133('0xce'))){_0x49c9bf[_0x0133('0x17')]=qs['limit'](_0x12c3ee['query'][_0x0133('0x17')]);_0x49c9bf[_0x0133('0x1a')]=qs[_0x0133('0x1a')](_0x12c3ee[_0x0133('0x38')][_0x0133('0x1a')]);}_0x49c9bf['order']=qs['sort'](_0x12c3ee[_0x0133('0x38')][_0x0133('0x3f')]);_0x49c9bf['where']=qs[_0x0133('0x41')](_[_0x0133('0x42')](_0x12c3ee[_0x0133('0x38')],_0x9992d9[_0x0133('0x41')]));_0x49c9bf[_0x0133('0x40')][_0x0133('0xbc')]=_0x7764ee['id'];if(_0x12c3ee[_0x0133('0x38')][_0x0133('0x82')]){_0x49c9bf[_0x0133('0x40')]=_['merge'](_0x49c9bf[_0x0133('0x40')],{'$or':_[_0x0133('0x25')](_0x49c9bf[_0x0133('0x3a')],function(_0x466354){var _0x18fe78={};_0x18fe78[_0x466354]={'$like':'%'+_0x12c3ee[_0x0133('0x38')][_0x0133('0x82')]+'%'};return _0x18fe78;})});}if(_0x12c3ee[_0x0133('0x38')][_0x0133('0xcf')]){var _0x1ec149=_0x12c3ee['query']['$gte'][_0x0133('0x63')](',');var _0x2d7a9f={};_0x2d7a9f[_0x1ec149[0x0]]={'$gte':moment(_0x1ec149[0x1])['format'](_0x0133('0xd0'))};_0x49c9bf['where']=_['merge'](_0x49c9bf['where'],_0x2d7a9f);}_0x49c9bf=_[_0x0133('0xc5')]({},_0x49c9bf,_0x12c3ee[_0x0133('0xc6')]);return db[_0x0133('0x2a')][_0x0133('0x19')]({'where':_0x49c9bf[_0x0133('0x40')]})['then'](function(_0x2c700a){_0x1d6c73[_0x0133('0x19')]=_0x2c700a;if(_0x12c3ee[_0x0133('0x38')][_0x0133('0xd1')]){_0x49c9bf['include']=[{'all':!![]}];}return db[_0x0133('0x2a')]['findAll'](_0x49c9bf);})[_0x0133('0x1f')](function(_0x25ac5e){if(_0x12c3ee['query'][_0x0133('0xd2')]===_0x0133('0xd3')){for(var _0x25848e=0x0;_0x25848e<_0x25ac5e[_0x0133('0x3c')];_0x25848e++){_0x25ac5e[_0x25848e][_0x0133('0xc8')]=juice(_0x25ac5e[_0x25848e][_0x0133('0xc8')]);}}_0x1d6c73[_0x0133('0xc1')]=_0x25ac5e;return _0x1d6c73;});}})[_0x0133('0x1f')](respondWithFilteredResult(_0xf585db,_0x49c9bf))[_0x0133('0x30')](handleError(_0xf585db,null));};exports['addTags']=function(_0x4186af,_0x4902bd){return db['MailInteraction'][_0x0133('0x5b')]({'where':{'id':_0x4186af[_0x0133('0xc3')]['id']}})[_0x0133('0x1f')](handleEntityNotFound(_0x4902bd,null))[_0x0133('0x1f')](function(_0x24dcf9){if(_0x24dcf9){return _0x24dcf9[_0x0133('0xd4')](_0x4186af[_0x0133('0xc8')]['ids'],_['omit'](_0x4186af['body'],[_0x0133('0xcb'),'id'])||{})[_0x0133('0xd5')](function(){return db[_0x0133('0x6c')][_0x0133('0xd6')]({'attributes':['id','name','color'],'where':{'id':_0x4186af[_0x0133('0xc8')][_0x0133('0xcb')]}});})[_0x0133('0x1f')](function(_0x1594be){socket[_0x0133('0xd7')](_0x0133('0xd8'),{'id':Number(_0x4186af[_0x0133('0xc3')]['id']),'tags':_0x1594be||[]});return{'id':Number(_0x4186af['params']['id']),'tags':_0x1594be||[]};});}})[_0x0133('0x1f')](respondWithResult(_0x4902bd,null))[_0x0133('0x30')](handleError(_0x4902bd,null));};exports[_0x0133('0xd9')]=function(_0x2e44d8,_0x472880){return db[_0x0133('0x32')][_0x0133('0x5b')]({'where':{'id':_0x2e44d8[_0x0133('0xc3')]['id']}})['then'](handleEntityNotFound(_0x472880,null))[_0x0133('0x1f')](function(_0x2ea1dd){if(_0x2ea1dd){return _0x2ea1dd[_0x0133('0xd9')](_0x2e44d8[_0x0133('0x38')][_0x0133('0xcb')]);}})[_0x0133('0x1f')](respondWithStatusCode(_0x472880,null))[_0x0133('0x30')](handleError(_0x472880,null));};exports['download']=function(_0xfd35ab,_0x2f1388){var _0x6f5495=moment()[_0x0133('0xda')]()[_0x0133('0x99')]();var _0x3093e0=path[_0x0133('0xdb')](config[_0x0133('0xdc')],_0x0133('0xdd'),_0x0133('0xde'),'tmp');var _0x46d52e=path[_0x0133('0xdb')](config['root'],_0x0133('0xdd'),_0x0133('0xde'),_0x0133('0xdf'));var _0x5c2ebb=path[_0x0133('0xdb')](_0x3093e0,_0x6f5495);var _0x196b84=util['format'](_0x0133('0xe0'),_0xfd35ab[_0x0133('0xc3')]['id'],_0x6f5495);var _0x3f4055=path[_0x0133('0xdb')](_0x3093e0,_0x196b84);var _0x3dc91b=[];if(_0xfd35ab['query'][_0x0133('0xdf')]){_0x3dc91b['push']({'model':db[_0x0133('0xe1')],'as':_0x0133('0xe2'),'raw':!![]});}var _0x25afd0=[{'model':db[_0x0133('0x2a')],'as':_0x0133('0xe3'),'attributes':['id',_0x0133('0xc8'),_0x0133('0x45'),'to','cc','bcc',_0x0133('0xe4'),_0x0133('0x76')],'where':{'secret':![]},'order':qs[_0x0133('0x3f')]('id'),'include':_0x3dc91b}];return db[_0x0133('0x32')]['find']({'where':{'id':_0xfd35ab[_0x0133('0xc3')]['id']},'include':_0x25afd0})[_0x0133('0x1f')](handleEntityNotFound(_0x2f1388,null))['then'](function(_0x44db86){if(_0x44db86&&_0x44db86[_0x0133('0xe3')]){var _0x5b25c9=_0x44db86[_0x0133('0xe5')]({'plain':!![]});fs[_0x0133('0xe6')](_0x5c2ebb);return BPromise[_0x0133('0xe7')](_0x5b25c9[_0x0133('0xe3')],function(_0x88cfe3,_0x17b245){var _0x55d0d6={'from':_0x88cfe3[_0x0133('0x45')],'to':_0x88cfe3['to'],'subject':_0x88cfe3[_0x0133('0xe4')],'html':htmlEntities['decode'](_0x88cfe3['body']),'headers':{'Date':moment(_0x88cfe3['createdAt'])[_0x0133('0xe8')](_0x0133('0xe9'))},'attachments':[]};if(_0x88cfe3['cc']){_0x55d0d6[_0x0133('0xea')]['Cc']=_0x88cfe3['cc'];}if(_0x88cfe3[_0x0133('0xeb')]){_0x55d0d6['headers'][_0x0133('0xec')]=_0x88cfe3[_0x0133('0xeb')];}return new BPromise(function(_0x313153,_0x4acb95){if(_0x88cfe3[_0x0133('0xe2')]){for(var _0x4e38a3=0x0;_0x4e38a3<_0x88cfe3['Attachments'][_0x0133('0x3c')];_0x4e38a3++){var _0x296e1d=_0x88cfe3[_0x0133('0xe2')][_0x4e38a3];var _0x1e756b=path['join'](_0x46d52e,_0x296e1d['basename']);if(fs[_0x0133('0xed')](_0x1e756b)){_0x55d0d6[_0x0133('0xdf')][_0x0133('0xc0')]({'name':_0x296e1d[_0x0133('0x22')],'contentType':_0x296e1d[_0x0133('0x69')],'data':fs['readFileSync'](_0x1e756b)});}}}emlformat['build'](_0x55d0d6,function(_0x3b3f7f,_0x3be6e0){if(_0x3b3f7f)return _0x4acb95(_0x3b3f7f);fs['writeFileSync'](path[_0x0133('0xdb')](_0x5c2ebb,util[_0x0133('0xe8')]('message%d.eml',_0x17b245)),_0x3be6e0);return _0x313153(_0x3be6e0);});});})[_0x0133('0x1f')](function(){return new BPromise(function(_0x5442b2,_0x23082b){zipdir(_0x5c2ebb,{'saveTo':_0x3f4055},function(_0x1e2660,_0x2acd11){if(_0x1e2660)return _0x23082b(_0x1e2660);return _0x5442b2(_0x2acd11);});})['then'](function(){return new BPromise(function(_0x5e1cd6,_0x221a26){rimraf(_0x5c2ebb,function(_0x5e6a79){if(_0x5e6a79)_0x221a26(_0x5e6a79);return _0x5e1cd6();});});})[_0x0133('0x1f')](function(){return _0x2f1388[_0x0133('0xee')](_0x3f4055,_0x196b84,function(_0x1bd931){if(!_0x1bd931)fs[_0x0133('0xef')](_0x3f4055);});});});}else{return _0x2f1388[_0x0133('0x14')](0xc8);}})[_0x0133('0x30')](handleError(_0x2f1388,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c1d9fe4..ccc5ad2 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 _0x7217=['events','../../mysqldb','MailInteraction','setMaxListeners','update','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x166b14,_0x3ce1ce){var _0x5dc7c6=function(_0x43b519){while(--_0x43b519){_0x166b14['push'](_0x166b14['shift']());}};_0x5dc7c6(++_0x3ce1ce);}(_0x7217,0x160));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require(_0x7721('0x0'));var MailInteraction=require(_0x7721('0x1'))['db'][_0x7721('0x2')];var MailMessage=require(_0x7721('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7721('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7721('0x4'),'afterDestroy':'remove'};function emitEvent(_0x381284){return function(_0x255654,_0x1befb4,_0x444d11){_0x255654[_0x7721('0x5')]({'attributes':['id'],'raw':!![]})[_0x7721('0x6')](function(_0x95dde7){_0x255654[_0x7721('0x7')](_0x7721('0x8'),_0x95dde7['map'](function(_0xf8c8ac){return{'id':_0xf8c8ac['id']};}));return MailMessage[_0x7721('0x9')]({'where':{'MailInteractionId':_0x255654['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7721('0x6')](function(_0x31397f){_0x255654['setDataValue']('unreadMessages',_0x31397f[_0x7721('0xa')]);MailInteractionEvents[_0x7721('0xb')](_0x381284+':'+_0x255654['id'],_0x255654);MailInteractionEvents[_0x7721('0xb')](_0x381284,_0x255654);_0x444d11(null);})[_0x7721('0xc')](_0x444d11(null));};}for(var e in events){if(events[_0x7721('0xd')](e)){var event=events[e];MailInteraction[_0x7721('0xe')](e,emitEvent(event));}}module[_0x7721('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x4f2d=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','hook','exports','events','../../mysqldb'];(function(_0x5a9288,_0x13ff0d){var _0x3e6455=function(_0x5337df){while(--_0x5337df){_0x5a9288['push'](_0x5a9288['shift']());}};_0x3e6455(++_0x13ff0d);}(_0x4f2d,0xa8));var _0xd4f2=function(_0x1ed31f,_0x2e3826){_0x1ed31f=_0x1ed31f-0x0;var _0x20d5df=_0x4f2d[_0x1ed31f];return _0x20d5df;};'use strict';var EventEmitter=require(_0xd4f2('0x0'));var MailInteraction=require(_0xd4f2('0x1'))['db'][_0xd4f2('0x2')];var MailMessage=require(_0xd4f2('0x1'))['db'][_0xd4f2('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd4f2('0x4')](0x0);var events={'afterCreate':_0xd4f2('0x5'),'afterUpdate':_0xd4f2('0x6'),'afterDestroy':_0xd4f2('0x7')};function emitEvent(_0xd20ef8){return function(_0x3111e7,_0x18ab13,_0x36dc1b){_0x3111e7['getUsers']({'attributes':['id'],'raw':!![]})[_0xd4f2('0x8')](function(_0x34dbc6){_0x3111e7[_0xd4f2('0x9')](_0xd4f2('0xa'),_0x34dbc6[_0xd4f2('0xb')](function(_0x2a10c8){return{'id':_0x2a10c8['id']};}));return MailMessage[_0xd4f2('0xc')]({'where':{'MailInteractionId':_0x3111e7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd4f2('0x8')](function(_0x5d98cb){_0x3111e7[_0xd4f2('0x9')](_0xd4f2('0xd'),_0x5d98cb['length']);MailInteractionEvents[_0xd4f2('0xe')](_0xd20ef8+':'+_0x3111e7['id'],_0x3111e7);MailInteractionEvents['emit'](_0xd20ef8,_0x3111e7);_0x36dc1b(null);})['catch'](_0x36dc1b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd4f2('0xf')](e,emitEvent(event));}}module[_0xd4f2('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 6a013a7..36a32ba 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 _0x8db1=['request-promise','path','../../config/environment','exports','define','mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','substatusAt','get','closed','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x422c3f,_0x1d114b){var _0x16648e=function(_0x4c0ca5){while(--_0x4c0ca5){_0x422c3f['push'](_0x422c3f['shift']());}};_0x16648e(++_0x1d114b);}(_0x8db1,0x19b));var _0x18db=function(_0x3386a6,_0x474678){_0x3386a6=_0x3386a6-0x0;var _0x362b74=_0x8db1[_0x3386a6];return _0x362b74;};'use strict';var _=require(_0x18db('0x0'));var util=require(_0x18db('0x1'));var logger=require(_0x18db('0x2'))(_0x18db('0x3'));var moment=require('moment');var BPromise=require(_0x18db('0x4'));var rp=require(_0x18db('0x5'));var fs=require('fs');var path=require(_0x18db('0x6'));var rimraf=require('rimraf');var config=require(_0x18db('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x18db('0x8')]=function(_0x452186,_0x3b62d3){return _0x452186[_0x18db('0x9')]('MailInteraction',attributes,{'tableName':_0x18db('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x18db('0xb'),'to'],'type':_0x18db('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c0854,_0x24104f,_0x25278d){if(_0x2c0854['substatus']){_0x2c0854['substatusAt']=moment()[_0x18db('0xd')](_0x18db('0xe'));}if(_0x2c0854['closed']){_0x2c0854[_0x18db('0xf')]=moment()[_0x18db('0xd')](_0x18db('0xe'));}_0x25278d(null,_0x24104f);},'beforeUpdate':function(_0x33c262,_0x352165,_0x1d8a62){if(_0x33c262[_0x18db('0x10')](_0x18db('0x11'))){_0x33c262[_0x18db('0x12')]=_0x33c262[_0x18db('0x11')]?moment()[_0x18db('0xd')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x33c262[_0x18db('0x10')]('closed')){_0x33c262[_0x18db('0xf')]=moment()[_0x18db('0xd')](_0x18db('0xe'));_0x33c262[_0x18db('0x11')]=null;_0x33c262[_0x18db('0x12')]=null;}_0x1d8a62(null,_0x33c262);},'afterUpdate':function(_0x36b466,_0x3f7fde,_0x5f14ca){var _0x36faa6=_0x452186['models'];var _0xa60932=_0x36b466[_0x18db('0x13')]({'plain':!![]});if(_0xa60932[_0x18db('0x14')]){return _0x36faa6[_0x18db('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xa60932['id']}})[_0x18db('0x16')](function(){_0x5f14ca();})[_0x18db('0x17')](function(_0x137a2e){_0x5f14ca(_0x137a2e);});}else{_0x5f14ca();}}},'charset':_0x18db('0x18'),'collate':_0x18db('0x19')});}; \ No newline at end of file +var _0x6309=['MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x6309,0x88));var _0x9630=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x6309[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x9630('0x0'));var util=require(_0x9630('0x1'));var logger=require(_0x9630('0x2'))(_0x9630('0x3'));var moment=require(_0x9630('0x4'));var BPromise=require(_0x9630('0x5'));var rp=require(_0x9630('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9630('0x7'));var config=require(_0x9630('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x9630('0x9')]=function(_0x1635bf,_0x3353f1){return _0x1635bf['define']('MailInteraction',attributes,{'tableName':_0x9630('0xa'),'paranoid':![],'indexes':[{'name':_0x9630('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d6219,_0x5734d5,_0x220faf){if(_0x5d6219[_0x9630('0xc')]){_0x5d6219[_0x9630('0xd')]=moment()[_0x9630('0xe')](_0x9630('0xf'));}if(_0x5d6219[_0x9630('0x10')]){_0x5d6219[_0x9630('0x11')]=moment()['format'](_0x9630('0xf'));}_0x220faf(null,_0x5734d5);},'beforeUpdate':function(_0x135949,_0xbd94a5,_0xb5c999){if(_0x135949[_0x9630('0x12')](_0x9630('0xc'))){_0x135949[_0x9630('0xd')]=_0x135949[_0x9630('0xc')]?moment()[_0x9630('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x135949[_0x9630('0x12')](_0x9630('0x10'))){_0x135949[_0x9630('0x11')]=moment()[_0x9630('0xe')](_0x9630('0xf'));_0x135949[_0x9630('0xc')]=null;_0x135949[_0x9630('0xd')]=null;}_0xb5c999(null,_0x135949);},'afterUpdate':function(_0x157286,_0x5dcc14,_0x78fb7b){var _0x1aac54=_0x1635bf[_0x9630('0x13')];var _0x3fed51=_0x157286['get']({'plain':!![]});if(_0x3fed51[_0x9630('0x10')]){return _0x1aac54[_0x9630('0x14')][_0x9630('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x3fed51['id']}})[_0x9630('0x16')](function(){_0x78fb7b();})[_0x9630('0x17')](function(_0x36e65a){_0x78fb7b(_0x36e65a);});}else{_0x78fb7b();}}},'charset':_0x9630('0x18'),'collate':_0x9630('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 910cd39..d1f586c 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 _0x7d5d=['then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','result','MailInteraction','body','options','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','request'];(function(_0x215c47,_0x2a0fcc){var _0x115674=function(_0x51b97f){while(--_0x51b97f){_0x215c47['push'](_0x215c47['shift']());}};_0x115674(++_0x2a0fcc);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x16c6e2,_0x5ea66c){_0x16c6e2=_0x16c6e2-0x0;var _0x1d5c2c=_0x7d5d[_0x16c6e2];return _0x1d5c2c;};'use strict';var _=require('lodash');var util=require(_0xd7d5('0x0'));var moment=require(_0xd7d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7d5('0x2'));var db=require(_0xd7d5('0x3'))['db'];var utils=require(_0xd7d5('0x4'));var logger=require('../../config/logger')(_0xd7d5('0x5'));var config=require(_0xd7d5('0x6'));var jayson=require(_0xd7d5('0x7'));var client=jayson[_0xd7d5('0x8')][_0xd7d5('0x9')]({'port':0x232a});config['redis']=_[_0xd7d5('0xa')](config[_0xd7d5('0xb')],{'host':_0xd7d5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7d5('0xb')]));require(_0xd7d5('0xd'))['register'](socket);function respondWithRpcPromise(_0x19a60d,_0x23b02e,_0x213761){return new BPromise(function(_0x58a716,_0x1fa3e4){return client[_0xd7d5('0xe')](_0x19a60d,_0x213761)[_0xd7d5('0xf')](function(_0x46bc88){logger['info']('MailInteraction,\x20%s,\x20%s',_0x23b02e,_0xd7d5('0x10'));logger[_0xd7d5('0x11')](_0xd7d5('0x12'),_0x23b02e,_0xd7d5('0x10'),JSON[_0xd7d5('0x13')](_0x46bc88));if(_0x46bc88[_0xd7d5('0x14')]){if(_0x46bc88['error'][_0xd7d5('0x15')]===0x1f4){logger[_0xd7d5('0x14')](_0xd7d5('0x16'),_0x23b02e,_0x46bc88[_0xd7d5('0x14')][_0xd7d5('0x17')]);return _0x1fa3e4(_0x46bc88['error'][_0xd7d5('0x17')]);}logger[_0xd7d5('0x14')](_0xd7d5('0x16'),_0x23b02e,_0x46bc88[_0xd7d5('0x14')][_0xd7d5('0x17')]);return _0x58a716(_0x46bc88[_0xd7d5('0x14')][_0xd7d5('0x17')]);}else{logger[_0xd7d5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x23b02e,'request\x20sent');_0x58a716(_0x46bc88[_0xd7d5('0x19')]['message']);}})['catch'](function(_0x168ad2){logger['error'](_0xd7d5('0x16'),_0x23b02e,_0x168ad2);_0x1fa3e4(_0x168ad2);});});}exports['UpdateMailInteraction']=function(_0x32483d){var _0x3acc3d=this;return new Promise(function(_0x2dc625,_0x302159){return db[_0xd7d5('0x1a')]['update'](_0x32483d[_0xd7d5('0x1b')],{'raw':_0x32483d[_0xd7d5('0x1c')]?_0x32483d[_0xd7d5('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32483d['options']?_0x32483d[_0xd7d5('0x1c')]['where']||null:null,'attributes':_0x32483d[_0xd7d5('0x1c')]?_0x32483d[_0xd7d5('0x1c')][_0xd7d5('0x1d')]||null:null,'limit':_0x32483d[_0xd7d5('0x1c')]?_0x32483d[_0xd7d5('0x1c')][_0xd7d5('0x1e')]||null:null})[_0xd7d5('0xf')](function(_0x4da10b){logger[_0xd7d5('0x18')](_0xd7d5('0x1f'),_0x32483d);logger['debug'](_0xd7d5('0x1f'),_0x32483d,JSON[_0xd7d5('0x13')](_0x4da10b));_0x2dc625(_0x4da10b);})[_0xd7d5('0x20')](function(_0xd3e212){logger[_0xd7d5('0x14')](_0xd7d5('0x1f'),_0xd3e212[_0xd7d5('0x17')],_0x32483d);_0x302159(_0x3acc3d[_0xd7d5('0x14')](0x1f4,_0xd3e212[_0xd7d5('0x17')]));});});};exports[_0xd7d5('0x21')]=function(_0x34fe0a){return new Promise(function(_0x2930c8,_0x2c9b8b){return db[_0xd7d5('0x1a')][_0xd7d5('0x22')]({'where':_0x34fe0a['options']?_0x34fe0a[_0xd7d5('0x1c')][_0xd7d5('0x23')]||null:null})['then'](function(_0x30b929){if(_0x30b929){return _0x30b929[_0xd7d5('0x24')](_0x34fe0a[_0xd7d5('0x1b')][_0xd7d5('0x25')],_[_0xd7d5('0x26')](_0x34fe0a[_0xd7d5('0x1b')],['ids','id'])||{});}})[_0xd7d5('0x27')](function(_0x1460ad){logger['info']('AddTags',_0x34fe0a);logger['debug']('AddTags',_0x34fe0a,JSON[_0xd7d5('0x13')](_0x1460ad));_0x2930c8(_0x1460ad);})[_0xd7d5('0x20')](function(_0x3e943d){logger[_0xd7d5('0x14')](_0xd7d5('0x28'),_0x3e943d[_0xd7d5('0x17')],_0x34fe0a);_0x2c9b8b(_this[_0xd7d5('0x14')](0x1f4,_0x3e943d[_0xd7d5('0x17')]));});});}; \ No newline at end of file +var _0x14e4=['catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','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','code','message'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0x14e4,0x144));var _0x414e=function(_0x27eb24,_0x1f6465){_0x27eb24=_0x27eb24-0x0;var _0x49e183=_0x14e4[_0x27eb24];return _0x49e183;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var moment=require(_0x414e('0x2'));var BPromise=require(_0x414e('0x3'));var rs=require(_0x414e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x414e('0x5'))['db'];var utils=require(_0x414e('0x6'));var logger=require(_0x414e('0x7'))(_0x414e('0x8'));var config=require('../../config/environment');var jayson=require(_0x414e('0x9'));var client=jayson[_0x414e('0xa')][_0x414e('0xb')]({'port':0x232a});config['redis']=_[_0x414e('0xc')](config[_0x414e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x414e('0xe'))(new Redis(config['redis']));require(_0x414e('0xf'))[_0x414e('0x10')](socket);function respondWithRpcPromise(_0x335be7,_0x33be53,_0x1acf63){return new BPromise(function(_0x4762db,_0x19a850){return client[_0x414e('0x11')](_0x335be7,_0x1acf63)[_0x414e('0x12')](function(_0x16cf1c){logger[_0x414e('0x13')](_0x414e('0x14'),_0x33be53,'request\x20sent');logger[_0x414e('0x15')](_0x414e('0x16'),_0x33be53,_0x414e('0x17'),JSON[_0x414e('0x18')](_0x16cf1c));if(_0x16cf1c[_0x414e('0x19')]){if(_0x16cf1c[_0x414e('0x19')][_0x414e('0x1a')]===0x1f4){logger['error'](_0x414e('0x14'),_0x33be53,_0x16cf1c[_0x414e('0x19')][_0x414e('0x1b')]);return _0x19a850(_0x16cf1c[_0x414e('0x19')]['message']);}logger[_0x414e('0x19')]('MailInteraction,\x20%s,\x20%s',_0x33be53,_0x16cf1c['error'][_0x414e('0x1b')]);return _0x4762db(_0x16cf1c[_0x414e('0x19')][_0x414e('0x1b')]);}else{logger[_0x414e('0x13')](_0x414e('0x14'),_0x33be53,_0x414e('0x17'));_0x4762db(_0x16cf1c['result'][_0x414e('0x1b')]);}})[_0x414e('0x1c')](function(_0x29639b){logger[_0x414e('0x19')](_0x414e('0x14'),_0x33be53,_0x29639b);_0x19a850(_0x29639b);});});}exports[_0x414e('0x1d')]=function(_0x364f93){var _0x233f04=this;return new Promise(function(_0x5db6ae,_0x11dd15){return db['MailInteraction'][_0x414e('0x1e')](_0x364f93[_0x414e('0x1f')],{'raw':_0x364f93[_0x414e('0x20')]?_0x364f93[_0x414e('0x20')][_0x414e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x364f93[_0x414e('0x20')]?_0x364f93['options'][_0x414e('0x22')]||null:null,'attributes':_0x364f93[_0x414e('0x20')]?_0x364f93[_0x414e('0x20')][_0x414e('0x23')]||null:null,'limit':_0x364f93[_0x414e('0x20')]?_0x364f93['options'][_0x414e('0x24')]||null:null})['then'](function(_0x3bf25c){logger[_0x414e('0x13')](_0x414e('0x1d'),_0x364f93);logger['debug']('UpdateMailInteraction',_0x364f93,JSON[_0x414e('0x18')](_0x3bf25c));_0x5db6ae(_0x3bf25c);})['catch'](function(_0x101c81){logger['error'](_0x414e('0x1d'),_0x101c81['message'],_0x364f93);_0x11dd15(_0x233f04['error'](0x1f4,_0x101c81[_0x414e('0x1b')]));});});};exports[_0x414e('0x25')]=function(_0x44c0f4){return new Promise(function(_0x32aba8,_0x50ee9f){return db['MailInteraction'][_0x414e('0x26')]({'where':_0x44c0f4['options']?_0x44c0f4[_0x414e('0x20')][_0x414e('0x22')]||null:null})[_0x414e('0x12')](function(_0x5bf54d){if(_0x5bf54d){return _0x5bf54d[_0x414e('0x27')](_0x44c0f4[_0x414e('0x1f')][_0x414e('0x28')],_[_0x414e('0x29')](_0x44c0f4[_0x414e('0x1f')],[_0x414e('0x28'),'id'])||{});}})[_0x414e('0x2a')](function(_0x2ddce4){logger['info'](_0x414e('0x2b'),_0x44c0f4);logger[_0x414e('0x15')]('AddTags',_0x44c0f4,JSON[_0x414e('0x18')](_0x2ddce4));_0x32aba8(_0x2ddce4);})['catch'](function(_0x258c88){logger[_0x414e('0x19')](_0x414e('0x2b'),_0x258c88[_0x414e('0x1b')],_0x44c0f4);_0x50ee9f(_this[_0x414e('0x19')](0x1f4,_0x258c88[_0x414e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4270999..5234d42 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 _0xd8c8=['register','length','mailInteraction:','./mailInteraction.events','save','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8c8,0x13b));var _0x8d8c=function(_0x69a340,_0x1d6257){_0x69a340=_0x69a340-0x0;var _0x192f50=_0xd8c8[_0x69a340];return _0x192f50;};'use strict';var MailInteractionEvents=require(_0x8d8c('0x0'));var events=[_0x8d8c('0x1'),'remove',_0x8d8c('0x2')];function createListener(_0x40a9a0,_0xbfe95a){return function(_0x2bdd0a){_0xbfe95a[_0x8d8c('0x3')](_0x40a9a0,_0x2bdd0a);};}function removeListener(_0x49fe4f,_0x8ce2c4){return function(){MailInteractionEvents[_0x8d8c('0x4')](_0x49fe4f,_0x8ce2c4);};}exports[_0x8d8c('0x5')]=function(_0x4e85e5){for(var _0x13fe62=0x0,_0x5cb9d4=events[_0x8d8c('0x6')];_0x13fe62<_0x5cb9d4;_0x13fe62++){var _0x5cad8b=events[_0x13fe62];var _0xd597d0=createListener(_0x8d8c('0x7')+_0x5cad8b,_0x4e85e5);MailInteractionEvents['on'](_0x5cad8b,_0xd597d0);}}; \ No newline at end of file +var _0xfd56=['mailInteraction:','./mailInteraction.events','save','update','emit','register'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xfd56,0x1e7));var _0x6fd5=function(_0x410190,_0x24dc21){_0x410190=_0x410190-0x0;var _0x5a981f=_0xfd56[_0x410190];return _0x5a981f;};'use strict';var MailInteractionEvents=require(_0x6fd5('0x0'));var events=[_0x6fd5('0x1'),'remove',_0x6fd5('0x2')];function createListener(_0x3e439c,_0x52b493){return function(_0xab576a){_0x52b493[_0x6fd5('0x3')](_0x3e439c,_0xab576a);};}function removeListener(_0x10fdd1,_0x5cc61a){return function(){MailInteractionEvents['removeListener'](_0x10fdd1,_0x5cc61a);};}exports[_0x6fd5('0x4')]=function(_0x591bbd){for(var _0x574479=0x0,_0x2d9dde=events['length'];_0x574479<_0x2d9dde;_0x574479++){var _0x2dde54=events[_0x574479];var _0x2eb398=createListener(_0x6fd5('0x5')+_0x2dde54,_0x591bbd);MailInteractionEvents['on'](_0x2dde54,_0x2eb398);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ad5dac2..26b8864 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 _0xf632=['isAuthenticated','/:id','/:id/download','download','post','mail','mailmessage:create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe'];(function(_0x51b9cf,_0x3e1e05){var _0x38408d=function(_0x553d34){while(--_0x553d34){_0x51b9cf['push'](_0x51b9cf['shift']());}};_0x38408d(++_0x3e1e05);}(_0xf632,0xf9));var _0x2f63=function(_0x4fc571,_0x249668){_0x4fc571=_0x4fc571-0x0;var _0x4c1972=_0xf632[_0x4fc571];return _0x4c1972;};'use strict';var multer=require(_0x2f63('0x0'));var util=require(_0x2f63('0x1'));var path=require(_0x2f63('0x2'));var timeout=require(_0x2f63('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f63('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2f63('0x5'));var config=require(_0x2f63('0x6'));var controller=require(_0x2f63('0x7'));router[_0x2f63('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f63('0x9')]);router[_0x2f63('0x8')](_0x2f63('0xa'),auth[_0x2f63('0xb')](),controller['describe']);router[_0x2f63('0x8')](_0x2f63('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2f63('0x8')](_0x2f63('0xd'),auth[_0x2f63('0xb')](),controller[_0x2f63('0xe')]);router[_0x2f63('0xf')]('/',auth[_0x2f63('0xb')](),interaction['tracked'](_0x2f63('0x10'),_0x2f63('0x11')),controller['create']);router[_0x2f63('0x12')]('/:id',auth[_0x2f63('0xb')](),controller['update']);router[_0x2f63('0x12')](_0x2f63('0x13'),auth[_0x2f63('0xb')](),controller[_0x2f63('0x14')]);router[_0x2f63('0x12')](_0x2f63('0x15'),auth[_0x2f63('0xb')](),controller[_0x2f63('0x16')]);router[_0x2f63('0x17')]('/:id',auth[_0x2f63('0xb')](),controller[_0x2f63('0x18')]);module[_0x2f63('0x19')]=router; \ No newline at end of file +var _0x97a2=['get','isAuthenticated','index','/describe','/:id','show','/:id/download','tracked','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x115303,_0x47d05f){var _0x1e695f=function(_0x2dbdf2){while(--_0x2dbdf2){_0x115303['push'](_0x115303['shift']());}};_0x1e695f(++_0x47d05f);}(_0x97a2,0x1b1));var _0x297a=function(_0x2b8189,_0xb90e23){_0x2b8189=_0x2b8189-0x0;var _0x2dc101=_0x97a2[_0x2b8189];return _0x2dc101;};'use strict';var multer=require(_0x297a('0x0'));var util=require('util');var path=require(_0x297a('0x1'));var timeout=require(_0x297a('0x2'));var express=require(_0x297a('0x3'));var router=express[_0x297a('0x4')]();var fs_extra=require(_0x297a('0x5'));var auth=require(_0x297a('0x6'));var interaction=require(_0x297a('0x7'));var config=require(_0x297a('0x8'));var controller=require('./mailMessage.controller');router[_0x297a('0x9')]('/',auth[_0x297a('0xa')](),controller[_0x297a('0xb')]);router[_0x297a('0x9')](_0x297a('0xc'),auth[_0x297a('0xa')](),controller['describe']);router[_0x297a('0x9')](_0x297a('0xd'),auth[_0x297a('0xa')](),controller[_0x297a('0xe')]);router[_0x297a('0x9')](_0x297a('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x297a('0xa')](),interaction[_0x297a('0x10')](_0x297a('0x11'),_0x297a('0x12')),controller['create']);router[_0x297a('0x13')](_0x297a('0xd'),auth[_0x297a('0xa')](),controller[_0x297a('0x14')]);router[_0x297a('0x13')](_0x297a('0x15'),auth[_0x297a('0xa')](),controller['accept']);router['put'](_0x297a('0x16'),auth['isAuthenticated'](),controller[_0x297a('0x17')]);router[_0x297a('0x18')]('/:id',auth[_0x297a('0xa')](),controller[_0x297a('0x19')]);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 f5977f9..bfae554 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 _0x9527=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize','lodash'];(function(_0x3751dc,_0x563d41){var _0x2e113b=function(_0x2440f4){while(--_0x2440f4){_0x3751dc['push'](_0x3751dc['shift']());}};_0x2e113b(++_0x563d41);}(_0x9527,0x1cc));var _0x7952=function(_0x584ea3,_0xaad566){_0x584ea3=_0x584ea3-0x0;var _0xbe9d75=_0x9527[_0x584ea3];return _0xbe9d75;};'use strict';var Sequelize=require(_0x7952('0x0'));var _=require(_0x7952('0x1'));module[_0x7952('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7952('0x3')](_0x7952('0x4'))},'read':{'type':Sequelize[_0x7952('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7952('0x6')]('in',_0x7952('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7952('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7952('0x8')]},'to':{'type':Sequelize[_0x7952('0x3')](_0x7952('0x9'))},'cc':{'type':Sequelize[_0x7952('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x7952('0x9'))},'subject':{'type':Sequelize[_0x7952('0x3')]},'sentAt':{'type':Sequelize[_0x7952('0xa')]},'attach':{'type':Sequelize[_0x7952('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7952('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7952('0xa')]},'originTo':{'type':Sequelize[_0x7952('0x3')]('long')},'originCc':{'type':Sequelize[_0x7952('0x3')]('long')},'originChannel':{'type':Sequelize[_0x7952('0x6')](_0x7952('0xc'),_0x7952('0xd')),'defaultValue':_0x7952('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x5527=['BOOLEAN','out','STRING','DATE','long','ENUM','Email','sequelize','lodash','exports','TEXT','medium'];(function(_0x4a8eca,_0x5960c6){var _0xe67da5=function(_0x4c89ab){while(--_0x4c89ab){_0x4a8eca['push'](_0x4a8eca['shift']());}};_0xe67da5(++_0x5960c6);}(_0x5527,0x13f));var _0x7552=function(_0x22e22f,_0x4b43c5){_0x22e22f=_0x22e22f-0x0;var _0x41a005=_0x5527[_0x22e22f];return _0x41a005;};'use strict';var Sequelize=require(_0x7552('0x0'));var _=require(_0x7552('0x1'));module[_0x7552('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7552('0x3')](_0x7552('0x4'))},'read':{'type':Sequelize[_0x7552('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7552('0x6')),'defaultValue':_0x7552('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7552('0x7')](0x1fe)},'from':{'type':Sequelize[_0x7552('0x7')]},'to':{'type':Sequelize[_0x7552('0x3')]('long')},'cc':{'type':Sequelize[_0x7552('0x3')]('long')},'bcc':{'type':Sequelize[_0x7552('0x3')]('long')},'subject':{'type':Sequelize[_0x7552('0x3')]},'sentAt':{'type':Sequelize[_0x7552('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7552('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7552('0x8')]},'originTo':{'type':Sequelize[_0x7552('0x3')]('long')},'originCc':{'type':Sequelize[_0x7552('0x3')](_0x7552('0x9'))},'originChannel':{'type':Sequelize[_0x7552('0xa')](_0x7552('0xb'),'Chat'),'defaultValue':_0x7552('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ba2c726..e12b382 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 _0xd9fc=['pick','filter','VIRTUAL','options','MailMessage','includeAll','findAll','rows','params','include','find','body','describe','create','direction','out','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','basename','defaults','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','mail','RejectMessage','rejectMessage','Sequelize','reject','rejectmessage','download','unix','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','Bcc','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','request','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x44a3e1,_0x4084b4){var _0x493faa=function(_0x406529){while(--_0x406529){_0x44a3e1['push'](_0x44a3e1['shift']());}};_0x493faa(++_0x4084b4);}(_0xd9fc,0x1a3));var _0xcd9f=function(_0x32dc60,_0x13e42c){_0x32dc60=_0x32dc60-0x0;var _0x53cb92=_0xd9fc[_0x32dc60];return _0x53cb92;};'use strict';var emlformat=require(_0xcd9f('0x0'));var moment=require(_0xcd9f('0x1'));var BPromise=require(_0xcd9f('0x2'));var util=require(_0xcd9f('0x3'));var path=require(_0xcd9f('0x4'));var fs=require('fs');var _=require(_0xcd9f('0x5'));var Redis=require(_0xcd9f('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xcd9f('0x7'));var logger=require('../../config/logger')(_0xcd9f('0x8'));var interaction_log=require('../../config/logger')(_0xcd9f('0x9'));var config=require(_0xcd9f('0xa'));var db=require(_0xcd9f('0xb'))['db'];config['redis']=_['defaults'](config[_0xcd9f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd9f('0xd'))(new Redis(config[_0xcd9f('0xc')]));var htmlEntities=require(_0xcd9f('0xe'));require(_0xcd9f('0xf'))[_0xcd9f('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcd9f('0x11')]({'port':0x232c});var client9003=jayson[_0xcd9f('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xcd9f('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5898,_0x581aa4,_0x189588,_0x14d2bd){return new BPromise(function(_0x45c4f6,_0x2cc4c2){var _0x49e116=_0x14d2bd||client;return _0x49e116[_0xcd9f('0x13')](_0x3a5898,_0x189588)['then'](function(_0xe28fbf){logger[_0xcd9f('0x14')](_0xcd9f('0x15'),_0x581aa4,'request\x20sent');logger['debug'](_0xcd9f('0x16'),_0x581aa4,_0xcd9f('0x17'),JSON[_0xcd9f('0x18')](_0xe28fbf));if(_0xe28fbf[_0xcd9f('0x19')]){if(_0xe28fbf['error'][_0xcd9f('0x1a')]===0x1f4){logger[_0xcd9f('0x19')]('MailMessage,\x20%s,\x20%s',_0x581aa4,_0xe28fbf[_0xcd9f('0x19')][_0xcd9f('0x1b')]);return _0x2cc4c2(_0xe28fbf[_0xcd9f('0x19')][_0xcd9f('0x1b')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x581aa4,_0xe28fbf[_0xcd9f('0x19')][_0xcd9f('0x1b')]);return _0x45c4f6(_0xe28fbf[_0xcd9f('0x19')]['message']);}else{logger[_0xcd9f('0x14')](_0xcd9f('0x15'),_0x581aa4,_0xcd9f('0x17'));_0x45c4f6(_0xe28fbf[_0xcd9f('0x1c')][_0xcd9f('0x1b')]);}})[_0xcd9f('0x1d')](function(_0xd29c66){logger[_0xcd9f('0x19')]('MailMessage,\x20%s,\x20%s',_0x581aa4,_0xd29c66);_0x2cc4c2(_0xd29c66);});});}function respondWithResult(_0x1ac69d,_0x160ce0){_0x160ce0=_0x160ce0||0xc8;return function(_0x15505b){if(_0x15505b){return _0x1ac69d[_0xcd9f('0x1e')](_0x160ce0)['json'](_0x15505b);}};}function respondWithFilteredResult(_0x14e1e3,_0x458358){return function(_0x186359){if(_0x186359){var _0x1d3968=typeof _0x458358[_0xcd9f('0x1f')]===_0xcd9f('0x20')&&typeof _0x458358[_0xcd9f('0x21')]===_0xcd9f('0x20');var _0x263a84=_0x186359[_0xcd9f('0x22')];var _0x42bb25=_0x1d3968?0x0:_0x458358[_0xcd9f('0x1f')];var _0x542dc3=_0x1d3968?_0x186359[_0xcd9f('0x22')]:_0x458358[_0xcd9f('0x1f')]+_0x458358[_0xcd9f('0x21')];var _0x166615;if(_0x542dc3>=_0x263a84){_0x542dc3=_0x263a84;_0x166615=0xc8;}else{_0x166615=0xce;}_0x14e1e3[_0xcd9f('0x1e')](_0x166615);return _0x14e1e3[_0xcd9f('0x23')](_0xcd9f('0x24'),_0x42bb25+'-'+_0x542dc3+'/'+_0x263a84)['json'](_0x186359);}return null;};}function saveUpdates(_0x170d06){return function(_0x228a03){if(_0x228a03){return _0x228a03[_0xcd9f('0x25')](_0x170d06)[_0xcd9f('0x26')](function(_0x871a88){return _0x871a88;});}return null;};}function removeEntity(_0x3d2656){return function(_0x22cc1e){if(_0x22cc1e){return _0x22cc1e[_0xcd9f('0x27')]()['then'](function(){_0x3d2656['status'](0xcc)[_0xcd9f('0x28')]();});}};}function handleEntityNotFound(_0x169866){return function(_0x243326){if(!_0x243326){_0x169866['sendStatus'](0x194);}return _0x243326;};}function handleError(_0x31ceb9,_0x278929){_0x278929=_0x278929||0x1f4;return function(_0x5b15b2){logger['error'](_0x5b15b2['stack']);if(_0x5b15b2[_0xcd9f('0x29')]){delete _0x5b15b2[_0xcd9f('0x29')];}_0x31ceb9[_0xcd9f('0x1e')](_0x278929)[_0xcd9f('0x2a')](_0x5b15b2);};}exports[_0xcd9f('0x2b')]=function(_0x58b734,_0x35bcb2){var _0x3759eb={},_0x2346de={},_0x50a2cb={'count':0x0,'rows':[]};var _0x1b7e47=_['map'](db['MailMessage'][_0xcd9f('0x2c')],function(_0x540cdf){return{'name':_0x540cdf['fieldName'],'type':_0x540cdf[_0xcd9f('0x2d')][_0xcd9f('0x2e')]};});_0x2346de[_0xcd9f('0x2f')]=_[_0xcd9f('0x30')](_0x1b7e47,_0xcd9f('0x29'));_0x2346de[_0xcd9f('0x31')]=_[_0xcd9f('0x32')](_0x58b734['query']);_0x2346de[_0xcd9f('0x33')]=_[_0xcd9f('0x34')](_0x2346de['model'],_0x2346de[_0xcd9f('0x31')]);_0x3759eb[_0xcd9f('0x35')]=_[_0xcd9f('0x34')](_0x2346de[_0xcd9f('0x2f')],qs[_0xcd9f('0x36')](_0x58b734['query'][_0xcd9f('0x36')]));_0x3759eb[_0xcd9f('0x35')]=_0x3759eb[_0xcd9f('0x35')][_0xcd9f('0x37')]?_0x3759eb[_0xcd9f('0x35')]:_0x2346de[_0xcd9f('0x2f')];if(!_0x58b734['query'][_0xcd9f('0x38')](_0xcd9f('0x39'))){_0x3759eb[_0xcd9f('0x21')]=qs[_0xcd9f('0x21')](_0x58b734[_0xcd9f('0x31')]['limit']);_0x3759eb[_0xcd9f('0x1f')]=qs['offset'](_0x58b734[_0xcd9f('0x31')][_0xcd9f('0x1f')]);}_0x3759eb[_0xcd9f('0x3a')]=qs[_0xcd9f('0x3b')](_0x58b734[_0xcd9f('0x31')][_0xcd9f('0x3b')]);_0x3759eb[_0xcd9f('0x3c')]=qs[_0xcd9f('0x33')](_[_0xcd9f('0x3d')](_0x58b734[_0xcd9f('0x31')],_0x2346de[_0xcd9f('0x33')]),_0x1b7e47);if(_0x58b734['query'][_0xcd9f('0x3e')]){_0x3759eb[_0xcd9f('0x3c')]=_['merge'](_0x3759eb['where'],{'$or':_['map'](_0x1b7e47,function(_0xe670e5){if(_0xe670e5[_0xcd9f('0x2d')]!==_0xcd9f('0x3f')){var _0xfc64b5={};_0xfc64b5[_0xe670e5[_0xcd9f('0x29')]]={'$like':'%'+_0x58b734[_0xcd9f('0x31')][_0xcd9f('0x3e')]+'%'};return _0xfc64b5;}})});}_0x3759eb=_['merge']({},_0x3759eb,_0x58b734[_0xcd9f('0x40')]);var _0x206906={'where':_0x3759eb[_0xcd9f('0x3c')]};return db[_0xcd9f('0x41')][_0xcd9f('0x22')](_0x206906)[_0xcd9f('0x26')](function(_0x1b3566){_0x50a2cb[_0xcd9f('0x22')]=_0x1b3566;if(_0x58b734['query'][_0xcd9f('0x42')]){_0x3759eb['include']=[{'all':!![]}];}return db[_0xcd9f('0x41')][_0xcd9f('0x43')](_0x3759eb);})['then'](function(_0x16b85b){_0x50a2cb[_0xcd9f('0x44')]=_0x16b85b;return _0x50a2cb;})[_0xcd9f('0x26')](respondWithFilteredResult(_0x35bcb2,_0x3759eb))['catch'](handleError(_0x35bcb2,null));};exports['show']=function(_0x30f85e,_0x40c75a){var _0x5a3d20={'raw':!![],'where':{'id':_0x30f85e[_0xcd9f('0x45')]['id']}},_0x47a7e1={};_0x47a7e1['model']=_[_0xcd9f('0x32')](db[_0xcd9f('0x41')]['rawAttributes']);_0x47a7e1[_0xcd9f('0x31')]=_[_0xcd9f('0x32')](_0x30f85e['query']);_0x47a7e1[_0xcd9f('0x33')]=_[_0xcd9f('0x34')](_0x47a7e1[_0xcd9f('0x2f')],_0x47a7e1['query']);_0x5a3d20[_0xcd9f('0x35')]=_[_0xcd9f('0x34')](_0x47a7e1[_0xcd9f('0x2f')],qs[_0xcd9f('0x36')](_0x30f85e['query'][_0xcd9f('0x36')]));_0x5a3d20[_0xcd9f('0x35')]=_0x5a3d20[_0xcd9f('0x35')]['length']?_0x5a3d20[_0xcd9f('0x35')]:_0x47a7e1[_0xcd9f('0x2f')];if(_0x30f85e['query'][_0xcd9f('0x42')]){_0x5a3d20[_0xcd9f('0x46')]=[{'all':!![]}];}_0x5a3d20=_['merge']({},_0x5a3d20,_0x30f85e['options']);return db[_0xcd9f('0x41')][_0xcd9f('0x47')](_0x5a3d20)['then'](handleEntityNotFound(_0x40c75a,null))[_0xcd9f('0x26')](respondWithResult(_0x40c75a,null))['catch'](handleError(_0x40c75a,null));};exports[_0xcd9f('0x25')]=function(_0x2e961d,_0x45f2c3){if(_0x2e961d['body']['id']){delete _0x2e961d[_0xcd9f('0x48')]['id'];}return db[_0xcd9f('0x41')][_0xcd9f('0x47')]({'where':{'id':_0x2e961d[_0xcd9f('0x45')]['id']}})[_0xcd9f('0x26')](handleEntityNotFound(_0x45f2c3,null))[_0xcd9f('0x26')](saveUpdates(_0x2e961d[_0xcd9f('0x48')],null))[_0xcd9f('0x26')](respondWithResult(_0x45f2c3,null))[_0xcd9f('0x1d')](handleError(_0x45f2c3,null));};exports[_0xcd9f('0x27')]=function(_0x38c2d5,_0x28914b){return db[_0xcd9f('0x41')][_0xcd9f('0x47')]({'where':{'id':_0x38c2d5['params']['id']}})[_0xcd9f('0x26')](handleEntityNotFound(_0x28914b,null))[_0xcd9f('0x26')](removeEntity(_0x28914b,null))['catch'](handleError(_0x28914b,null));};exports[_0xcd9f('0x49')]=function(_0x3c4c5b,_0x1a06e4){return db[_0xcd9f('0x41')][_0xcd9f('0x49')]()[_0xcd9f('0x26')](respondWithResult(_0x1a06e4,null))['catch'](handleError(_0x1a06e4,null));};exports[_0xcd9f('0x4a')]=function(_0x5ba492,_0x4bf4ab){return db[_0xcd9f('0x41')]['create'](_0x5ba492[_0xcd9f('0x48')])[_0xcd9f('0x26')](function(_0x40d5e9){if(_0x40d5e9){if(_0x40d5e9[_0xcd9f('0x4b')]===_0xcd9f('0x4c')&&!_0x40d5e9['secret']){var _0x3e8f82,_0x302aa5,_0xcede01;if(_0x5ba492[_0xcd9f('0x48')]['to']){_0x302aa5=_0x5ba492['body']['to']['split'](',')[0x0];}return db[_0xcd9f('0x4d')][_0xcd9f('0x4e')]({'where':{'id':_0x40d5e9[_0xcd9f('0x4f')]},'include':[{'model':db[_0xcd9f('0x50')],'as':_0xcd9f('0x51'),'include':[{'model':db[_0xcd9f('0x52')],'as':_0xcd9f('0x53'),'where':{'email':_0x302aa5},'limit':0x1,'order':[[_0xcd9f('0x54'),_0xcd9f('0x55')]]}]},{'model':db[_0xcd9f('0x56')],'as':'Smtp','raw':!![]}]})[_0xcd9f('0x26')](function(_0x41866d){_0x3e8f82=_0x41866d;if(_0x3e8f82&&_0x3e8f82[_0xcd9f('0x57')]){var _0x2dd134={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x58')])){_0x2dd134[_0xcd9f('0x59')]=_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x59')];_0x2dd134['port']=_0x3e8f82['Smtp'][_0xcd9f('0x5a')];_0x2dd134['secure']=_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x5b')];if(_0x3e8f82['Smtp'][_0xcd9f('0x5c')]){_0x2dd134[_0xcd9f('0x5d')]={'user':_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x5e')],'pass':_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x5f')]};}}else{_0x2dd134[_0xcd9f('0x58')]=_0x3e8f82['Smtp'][_0xcd9f('0x58')];_0x2dd134[_0xcd9f('0x5d')]={'user':_0x3e8f82['Smtp'][_0xcd9f('0x5e')],'pass':_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x5f')]};_0x2dd134[_0xcd9f('0x5b')]=_0x3e8f82[_0xcd9f('0x57')][_0xcd9f('0x5b')];}if(_0x5ba492[_0xcd9f('0x48')][_0xcd9f('0x60')]&&_0x5ba492[_0xcd9f('0x48')][_0xcd9f('0x60')]['length']){for(var _0x1300d5=0x0;_0x1300d5<_0x5ba492[_0xcd9f('0x48')][_0xcd9f('0x60')][_0xcd9f('0x37')];_0x1300d5+=0x1){_0x5ba492[_0xcd9f('0x48')][_0xcd9f('0x60')][_0x1300d5]={'filename':_0x5ba492[_0xcd9f('0x48')][_0xcd9f('0x60')][_0x1300d5]['name'],'path':path[_0xcd9f('0x61')](config[_0xcd9f('0x62')],'server/files/attachments',_0x5ba492['body']['attachments'][_0x1300d5][_0xcd9f('0x63')])};}}_0xcede01={'account':_0x2dd134,'message':_0x5ba492[_0xcd9f('0x48')]};return;}})[_0xcd9f('0x26')](function(){if(_0x3e8f82['List']){if(_0x3e8f82['List'][_0xcd9f('0x53')]['length']){return _0x3e8f82[_0xcd9f('0x51')]['Contacts'][0x0];}else{return db[_0xcd9f('0x52')][_0xcd9f('0x4a')](_[_0xcd9f('0x64')](_0x5ba492[_0xcd9f('0x48')],{'firstName':_0x5ba492[_0xcd9f('0x48')]['to'],'email':_0x5ba492[_0xcd9f('0x48')]['to'],'phone':_0x5ba492[_0xcd9f('0x48')]['to'],'ListId':_0x3e8f82['ListId']}));}}else{throw new Error(_0xcd9f('0x65'));}})['then'](function(){if(_0xcede01){return respondWithRpcPromise(_0xcd9f('0x66'),_0xcd9f('0x67'),_0xcede01,client9003)[_0xcd9f('0x26')](function(_0x5aff62){return _0x40d5e9[_0xcd9f('0x25')]({'read':!![],'messageId':_0x5aff62['messageId'],'sentAt':moment()[_0xcd9f('0x68')](_0xcd9f('0x69'))});})[_0xcd9f('0x1d')](function(_0xae182d){logger[_0xcd9f('0x19')]('%s',JSON[_0xcd9f('0x18')](_0xae182d));return _0x40d5e9;});}return _0x40d5e9;});}return _0x40d5e9;}})['then'](respondWithResult(_0x4bf4ab,0xc9))['catch'](handleError(_0x4bf4ab,null));};exports[_0xcd9f('0x6a')]=function(_0x397064,_0x1a06af){var _0xf02306={'agent':{},'channel':'mail'};if(_0x397064[_0xcd9f('0x48')]['id']){delete _0x397064[_0xcd9f('0x48')]['id'];}_0x397064[_0xcd9f('0x48')]['read']=!![];_0x397064[_0xcd9f('0x48')][_0xcd9f('0x6b')]=moment()[_0xcd9f('0x68')](_0xcd9f('0x69'));_0x397064['body'][_0xcd9f('0x6c')]=_0x397064[_0xcd9f('0x48')][_0xcd9f('0x6c')]||_0x397064[_0xcd9f('0x5e')]['id'];_0xf02306[_0xcd9f('0x6d')]['id']=_0x397064[_0xcd9f('0x48')][_0xcd9f('0x6c')];return db[_0xcd9f('0x41')][_0xcd9f('0x47')]({'where':{'id':_0x397064[_0xcd9f('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a06af,null))[_0xcd9f('0x26')](saveUpdates(_0x397064[_0xcd9f('0x48')],null))['then'](function(_0x21ea2b){if(_0x21ea2b){_0xf02306['message']=_0x21ea2b[_0xcd9f('0x6e')]({'plain':!![]});return db[_0xcd9f('0x6f')][_0xcd9f('0x47')]({'where':{'id':_0x21ea2b[_0xcd9f('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x1a06af,null))[_0xcd9f('0x26')](function(_0x2160a0){if(_0x2160a0){return _0x2160a0['update']({'UserId':_0x397064[_0xcd9f('0x48')]['UserId'],'read1stAt':_[_0xcd9f('0x71')](_0x2160a0[_0xcd9f('0x72')])?moment()['format'](_0xcd9f('0x69')):undefined});}return null;})[_0xcd9f('0x26')](function(_0x2b1419){if(_0x2b1419){_0xf02306[_0xcd9f('0x73')]=_0x2b1419['get']({'plain':!![]});interaction_log['info'](_0xcd9f('0x74'),_0x397064[_0xcd9f('0x5e')]['id'],_0x397064[_0xcd9f('0x5e')][_0xcd9f('0x29')],_0x397064[_0xcd9f('0x5e')][_0xcd9f('0x75')],_0xf02306[_0xcd9f('0x73')]['id'],_0x397064[_0xcd9f('0x48')]?JSON['stringify'](_0x397064[_0xcd9f('0x48')]):_0xcd9f('0x76'));return respondWithRpcPromise(_0xcd9f('0x77'),'acceptMessage',_0xf02306);}return null;})[_0xcd9f('0x26')](function(_0x188cdf){var _0x2f78ef='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x188cdf[_0xcd9f('0x1b')][_0xcd9f('0x78')];return db[_0xcd9f('0x79')][_0xcd9f('0x31')](_0x2f78ef,{'type':db['Sequelize'][_0xcd9f('0x7a')][_0xcd9f('0x7b')],'raw':!![]})[_0xcd9f('0x26')](function(_0x5a20f6){return _0x5a20f6;});})[_0xcd9f('0x26')](function(_0x138732){if(_0x138732){_0xf02306['message'][_0xcd9f('0x7c')]=_0x138732[0x0];if(!_0x397064[_0xcd9f('0x48')]['UserId'])return;return db['User'][_0xcd9f('0x47')]({'where':{'id':_0x397064[_0xcd9f('0x48')][_0xcd9f('0x6c')],'role':_0xcd9f('0x6d')},'attributes':['id',_0xcd9f('0x29'),_0xcd9f('0x7d'),_0xcd9f('0x7e'),_0xcd9f('0x7f')],'raw':!![]});}return null;})[_0xcd9f('0x26')](function(_0x52264b){if(!_0x52264b)return null;_0xf02306[_0xcd9f('0x1b')][_0xcd9f('0x6d')]=_0x52264b;return _0xf02306;})[_0xcd9f('0x26')](function(_0x471b9d){if(_0x471b9d){if(_0x397064[_0xcd9f('0x48')][_0xcd9f('0x80')]){_0xf02306[_0xcd9f('0x1b')][_0xcd9f('0x81')]=util['format']('SIP/%s',_0x397064[_0xcd9f('0x5e')]['name']);_0xf02306['message'][_0xcd9f('0x82')]=_0xf02306['channel'];_0xf02306[_0xcd9f('0x1b')][_0xcd9f('0x83')]=_0xf02306[_0xcd9f('0x82')];_0xf02306[_0xcd9f('0x1b')][_0xcd9f('0x84')]=_0xcd9f('0x6a');_0xf02306[_0xcd9f('0x1b')][_0xcd9f('0x48')]=htmlToText[_0xcd9f('0x85')](_0xf02306['message'][_0xcd9f('0x48')]);return respondWithRpcPromise('EventManager',_0xcd9f('0x86'),{'event':_0xcd9f('0x87'),'message':_0xf02306[_0xcd9f('0x1b')]},client9002)[_0xcd9f('0x26')](function(){return _0xf02306;});}return _0xf02306;}return null;})[_0xcd9f('0x26')](respondWithResult(_0x1a06af,null))[_0xcd9f('0x1d')](handleError(_0x1a06af,null));};exports['reject']=function(_0x174f36,_0x156b0b){var _0x72f3aa={'agent':{},'channel':_0xcd9f('0x88')};if(_0x174f36[_0xcd9f('0x48')]['id']){delete _0x174f36[_0xcd9f('0x48')]['id'];}_0x174f36[_0xcd9f('0x48')][_0xcd9f('0x6c')]=_0x174f36[_0xcd9f('0x48')]['UserId']||_0x174f36[_0xcd9f('0x5e')]['id'];_0x72f3aa[_0xcd9f('0x6d')]['id']=_0x174f36[_0xcd9f('0x48')]['UserId'];return db[_0xcd9f('0x41')]['find']({'where':{'id':_0x174f36[_0xcd9f('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x156b0b,null))['then'](function(_0xb36eb3){if(_0xb36eb3){_0x72f3aa['message']=_0xb36eb3[_0xcd9f('0x6e')]({'plain':!![]});return db['MailInteraction'][_0xcd9f('0x47')]({'where':{'id':_0xb36eb3[_0xcd9f('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x156b0b,null))[_0xcd9f('0x26')](function(_0x2c277e){if(_0x2c277e){_0x72f3aa[_0xcd9f('0x73')]=_0x2c277e[_0xcd9f('0x6e')]({'plain':!![]});interaction_log[_0xcd9f('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x174f36[_0xcd9f('0x5e')]['id'],_0x174f36['user'][_0xcd9f('0x29')],_0x174f36[_0xcd9f('0x5e')][_0xcd9f('0x75')],_0x72f3aa['interaction']['id'],_0x174f36[_0xcd9f('0x48')]?JSON[_0xcd9f('0x18')](_0x174f36[_0xcd9f('0x48')]):_0xcd9f('0x76'));return respondWithRpcPromise(_0xcd9f('0x89'),_0xcd9f('0x8a'),_0x72f3aa);}return null;})[_0xcd9f('0x26')](function(_0x27e86c){var _0x4b2505='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27e86c['message']['ContactId'];return db[_0xcd9f('0x79')]['query'](_0x4b2505,{'type':db[_0xcd9f('0x8b')][_0xcd9f('0x7a')][_0xcd9f('0x7b')],'raw':!![]})['then'](function(_0x5e0833){return _0x5e0833;});})[_0xcd9f('0x26')](function(_0x2b09a3){if(_0x2b09a3){_0x72f3aa[_0xcd9f('0x1b')]['contact']=_0x2b09a3[0x0];if(!_0x174f36[_0xcd9f('0x48')][_0xcd9f('0x6c')])return;return db['User']['find']({'where':{'id':_0x174f36[_0xcd9f('0x48')][_0xcd9f('0x6c')],'role':_0xcd9f('0x6d')},'attributes':['id','name',_0xcd9f('0x7d'),_0xcd9f('0x7e'),_0xcd9f('0x7f')],'raw':!![]});}return null;})[_0xcd9f('0x26')](function(_0x22d57c){if(!_0x22d57c)return null;_0x72f3aa['message'][_0xcd9f('0x6d')]=_0x22d57c;return _0x72f3aa;})[_0xcd9f('0x26')](function(_0x3c44fa){if(_0x3c44fa){_0x3c44fa[_0xcd9f('0x1b')][_0xcd9f('0x81')]=util[_0xcd9f('0x68')]('SIP/%s',_0x174f36[_0xcd9f('0x5e')]['name']);_0x3c44fa['message']['channel']=_0x72f3aa[_0xcd9f('0x82')];_0x3c44fa[_0xcd9f('0x1b')]['motionChannel']=_0x72f3aa[_0xcd9f('0x82')];_0x3c44fa[_0xcd9f('0x1b')][_0xcd9f('0x84')]=_0xcd9f('0x8c');_0x3c44fa[_0xcd9f('0x1b')]['body']=htmlToText[_0xcd9f('0x85')](_0x72f3aa['message'][_0xcd9f('0x48')]);respondWithRpcPromise(_0xcd9f('0x86'),_0xcd9f('0x86'),{'event':_0xcd9f('0x8d'),'message':_0x3c44fa['message']},client9002);return _0x72f3aa;}return null;})[_0xcd9f('0x26')](respondWithResult(_0x156b0b,null))[_0xcd9f('0x1d')](handleError(_0x156b0b,null));};exports[_0xcd9f('0x8e')]=function(_0x575352,_0x3b96fe){var _0x176aec=moment()[_0xcd9f('0x8f')]()[_0xcd9f('0x90')]();var _0x2bcd52=path[_0xcd9f('0x61')](config['root'],_0xcd9f('0x91'),_0xcd9f('0x92'),'tmp');var _0xea7314=path[_0xcd9f('0x61')](config[_0xcd9f('0x62')],_0xcd9f('0x91'),_0xcd9f('0x92'),_0xcd9f('0x60'));var _0x576174=util[_0xcd9f('0x68')](_0xcd9f('0x93'),_0x176aec);return db['MailMessage'][_0xcd9f('0x47')]({'where':{'id':_0x575352[_0xcd9f('0x45')]['id']},'attributes':['id',_0xcd9f('0x48'),'from','to','cc',_0xcd9f('0x94'),_0xcd9f('0x95'),_0xcd9f('0x96')],'include':_0x575352[_0xcd9f('0x31')]['attachments']?[{'model':db[_0xcd9f('0x97')],'as':_0xcd9f('0x98')}]:undefined})[_0xcd9f('0x26')](handleEntityNotFound(_0x3b96fe,null))['then'](function(_0xaa35f){if(_0xaa35f){var _0x3b03aa=_0xaa35f;var _0x256c79={'from':_0x3b03aa[_0xcd9f('0x99')],'to':_0x3b03aa['to'],'subject':_0x3b03aa['subject'],'html':htmlEntities[_0xcd9f('0x9a')](_0x3b03aa[_0xcd9f('0x48')]),'headers':{'Date':moment(_0x3b03aa[_0xcd9f('0x96')])[_0xcd9f('0x68')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xaa35f['cc']){_0x256c79['headers']['Cc']=_0xaa35f['cc'];}if(_0xaa35f[_0xcd9f('0x94')]){_0x256c79['headers'][_0xcd9f('0x9b')]=_0xaa35f[_0xcd9f('0x94')];}return new BPromise(function(_0x1011d5,_0x294fd5){if(_0xaa35f['Attachments']){for(var _0x478fb1=0x0;_0x478fb1<_0xaa35f[_0xcd9f('0x98')]['length'];_0x478fb1++){var _0x13a9b8=_0xaa35f[_0xcd9f('0x98')][_0x478fb1];var _0xd3264b=path[_0xcd9f('0x61')](_0xea7314,_0x13a9b8[_0xcd9f('0x63')]);if(fs[_0xcd9f('0x9c')](_0xd3264b)){_0x256c79['attachments'][_0xcd9f('0x9d')]({'name':_0x13a9b8[_0xcd9f('0x29')],'contentType':_0x13a9b8[_0xcd9f('0x2d')],'data':fs['readFileSync'](_0xd3264b)});}}}emlformat[_0xcd9f('0x9e')](_0x256c79,function(_0x53f041,_0x5827c9){if(_0x53f041)return _0x294fd5(_0x53f041);fs['writeFileSync'](path['join'](_0x2bcd52,_0x576174),_0x5827c9);return _0x1011d5(_0x5827c9);});});}})['then'](function(_0x1bb854){if(_0x1bb854){return _0x3b96fe['download'](path[_0xcd9f('0x61')](_0x2bcd52,_0x576174),_0x576174,function(_0x12004a){if(!_0x12004a)fs[_0xcd9f('0x9f')](path[_0xcd9f('0x61')](_0x2bcd52,_0x576174));});}})['catch'](handleError(_0x3b96fe,null));}; \ No newline at end of file +var _0xf223=['json','update','destroy','end','sendStatus','name','send','MailMessage','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','describe','create','out','secret','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','CmContact','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','SIP/%s','motionChannel','download','unix','toString','files','tmp','server','message-%s.eml','bcc','createdAt','Attachments','from','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','status','offset','undefined','limit','count','Content-Range'];(function(_0x530e78,_0x34b3c2){var _0x50ab0c=function(_0x32389d){while(--_0x32389d){_0x530e78['push'](_0x530e78['shift']());}};_0x50ab0c(++_0x34b3c2);}(_0xf223,0x7c));var _0x3f22=function(_0x387357,_0x1c560c){_0x387357=_0x387357-0x0;var _0x5a1a42=_0xf223[_0x387357];return _0x5a1a42;};'use strict';var emlformat=require(_0x3f22('0x0'));var moment=require(_0x3f22('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x3f22('0x2'));var fs=require('fs');var _=require(_0x3f22('0x3'));var Redis=require(_0x3f22('0x4'));var htmlToText=require(_0x3f22('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f22('0x6'))(_0x3f22('0x7'));var interaction_log=require('../../config/logger')(_0x3f22('0x8'));var config=require(_0x3f22('0x9'));var db=require(_0x3f22('0xa'))['db'];config[_0x3f22('0xb')]=_[_0x3f22('0xc')](config[_0x3f22('0xb')],{'host':_0x3f22('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f22('0xb')]));var htmlEntities=require('html-entities');require(_0x3f22('0xe'))[_0x3f22('0xf')](socket);var jayson=require(_0x3f22('0x10'));var client=jayson[_0x3f22('0x11')]['http']({'port':0x232c});var client9003=jayson[_0x3f22('0x11')][_0x3f22('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x3f22('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x1a7147,_0x7cb57c,_0x1b831c,_0x3f881e){return new BPromise(function(_0x19b9de,_0xe39e27){var _0x37a3b0=_0x3f881e||client;return _0x37a3b0[_0x3f22('0x13')](_0x1a7147,_0x1b831c)[_0x3f22('0x14')](function(_0x4bd43f){logger[_0x3f22('0x15')](_0x3f22('0x16'),_0x7cb57c,_0x3f22('0x17'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x7cb57c,_0x3f22('0x17'),JSON[_0x3f22('0x18')](_0x4bd43f));if(_0x4bd43f['error']){if(_0x4bd43f[_0x3f22('0x19')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x7cb57c,_0x4bd43f[_0x3f22('0x19')][_0x3f22('0x1a')]);return _0xe39e27(_0x4bd43f[_0x3f22('0x19')][_0x3f22('0x1a')]);}logger[_0x3f22('0x19')]('MailMessage,\x20%s,\x20%s',_0x7cb57c,_0x4bd43f[_0x3f22('0x19')][_0x3f22('0x1a')]);return _0x19b9de(_0x4bd43f[_0x3f22('0x19')][_0x3f22('0x1a')]);}else{logger[_0x3f22('0x15')](_0x3f22('0x16'),_0x7cb57c,_0x3f22('0x17'));_0x19b9de(_0x4bd43f['result'][_0x3f22('0x1a')]);}})['catch'](function(_0x5e4804){logger[_0x3f22('0x19')](_0x3f22('0x16'),_0x7cb57c,_0x5e4804);_0xe39e27(_0x5e4804);});});}function respondWithResult(_0x584533,_0x4f8348){_0x4f8348=_0x4f8348||0xc8;return function(_0x98461d){if(_0x98461d){return _0x584533[_0x3f22('0x1b')](_0x4f8348)['json'](_0x98461d);}};}function respondWithFilteredResult(_0x1476ad,_0x2dae58){return function(_0x1f165e){if(_0x1f165e){var _0x5d39fd=typeof _0x2dae58[_0x3f22('0x1c')]===_0x3f22('0x1d')&&typeof _0x2dae58[_0x3f22('0x1e')]===_0x3f22('0x1d');var _0x3c7c88=_0x1f165e[_0x3f22('0x1f')];var _0x379071=_0x5d39fd?0x0:_0x2dae58[_0x3f22('0x1c')];var _0x567bb1=_0x5d39fd?_0x1f165e[_0x3f22('0x1f')]:_0x2dae58[_0x3f22('0x1c')]+_0x2dae58[_0x3f22('0x1e')];var _0x498985;if(_0x567bb1>=_0x3c7c88){_0x567bb1=_0x3c7c88;_0x498985=0xc8;}else{_0x498985=0xce;}_0x1476ad['status'](_0x498985);return _0x1476ad['set'](_0x3f22('0x20'),_0x379071+'-'+_0x567bb1+'/'+_0x3c7c88)[_0x3f22('0x21')](_0x1f165e);}return null;};}function saveUpdates(_0x526032){return function(_0x194852){if(_0x194852){return _0x194852[_0x3f22('0x22')](_0x526032)[_0x3f22('0x14')](function(_0x4df068){return _0x4df068;});}return null;};}function removeEntity(_0x147089){return function(_0x5bf0ef){if(_0x5bf0ef){return _0x5bf0ef[_0x3f22('0x23')]()['then'](function(){_0x147089['status'](0xcc)[_0x3f22('0x24')]();});}};}function handleEntityNotFound(_0x1167ca){return function(_0x4eee04){if(!_0x4eee04){_0x1167ca[_0x3f22('0x25')](0x194);}return _0x4eee04;};}function handleError(_0x23d0ba,_0x12a8da){_0x12a8da=_0x12a8da||0x1f4;return function(_0x2ae5cf){logger[_0x3f22('0x19')](_0x2ae5cf['stack']);if(_0x2ae5cf[_0x3f22('0x26')]){delete _0x2ae5cf[_0x3f22('0x26')];}_0x23d0ba[_0x3f22('0x1b')](_0x12a8da)[_0x3f22('0x27')](_0x2ae5cf);};}exports['index']=function(_0x57e096,_0x395215){var _0xf8a764={},_0x2e129a={},_0x124c61={'count':0x0,'rows':[]};var _0xa22375=_['map'](db[_0x3f22('0x28')]['rawAttributes'],function(_0x2b9de4){return{'name':_0x2b9de4[_0x3f22('0x29')],'type':_0x2b9de4['type']['key']};});_0x2e129a[_0x3f22('0x2a')]=_[_0x3f22('0x2b')](_0xa22375,_0x3f22('0x26'));_0x2e129a[_0x3f22('0x2c')]=_[_0x3f22('0x2d')](_0x57e096[_0x3f22('0x2c')]);_0x2e129a[_0x3f22('0x2e')]=_[_0x3f22('0x2f')](_0x2e129a['model'],_0x2e129a[_0x3f22('0x2c')]);_0xf8a764[_0x3f22('0x30')]=_[_0x3f22('0x2f')](_0x2e129a[_0x3f22('0x2a')],qs[_0x3f22('0x31')](_0x57e096[_0x3f22('0x2c')][_0x3f22('0x31')]));_0xf8a764[_0x3f22('0x30')]=_0xf8a764[_0x3f22('0x30')][_0x3f22('0x32')]?_0xf8a764[_0x3f22('0x30')]:_0x2e129a[_0x3f22('0x2a')];if(!_0x57e096[_0x3f22('0x2c')][_0x3f22('0x33')](_0x3f22('0x34'))){_0xf8a764[_0x3f22('0x1e')]=qs[_0x3f22('0x1e')](_0x57e096[_0x3f22('0x2c')][_0x3f22('0x1e')]);_0xf8a764[_0x3f22('0x1c')]=qs['offset'](_0x57e096[_0x3f22('0x2c')][_0x3f22('0x1c')]);}_0xf8a764[_0x3f22('0x35')]=qs[_0x3f22('0x36')](_0x57e096[_0x3f22('0x2c')]['sort']);_0xf8a764[_0x3f22('0x37')]=qs['filters'](_[_0x3f22('0x38')](_0x57e096[_0x3f22('0x2c')],_0x2e129a['filters']),_0xa22375);if(_0x57e096['query'][_0x3f22('0x39')]){_0xf8a764['where']=_['merge'](_0xf8a764['where'],{'$or':_['map'](_0xa22375,function(_0x55a161){if(_0x55a161[_0x3f22('0x3a')]!==_0x3f22('0x3b')){var _0x12302d={};_0x12302d[_0x55a161[_0x3f22('0x26')]]={'$like':'%'+_0x57e096[_0x3f22('0x2c')]['filter']+'%'};return _0x12302d;}})});}_0xf8a764=_['merge']({},_0xf8a764,_0x57e096[_0x3f22('0x3c')]);var _0x231e93={'where':_0xf8a764[_0x3f22('0x37')]};return db[_0x3f22('0x28')][_0x3f22('0x1f')](_0x231e93)[_0x3f22('0x14')](function(_0x3bedba){_0x124c61[_0x3f22('0x1f')]=_0x3bedba;if(_0x57e096[_0x3f22('0x2c')][_0x3f22('0x3d')]){_0xf8a764[_0x3f22('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0x3f22('0x3f')](_0xf8a764);})['then'](function(_0x2c7b9d){_0x124c61[_0x3f22('0x40')]=_0x2c7b9d;return _0x124c61;})['then'](respondWithFilteredResult(_0x395215,_0xf8a764))['catch'](handleError(_0x395215,null));};exports[_0x3f22('0x41')]=function(_0x5b6050,_0x24efd4){var _0x5bb1de={'raw':!![],'where':{'id':_0x5b6050[_0x3f22('0x42')]['id']}},_0x31f848={};_0x31f848[_0x3f22('0x2a')]=_[_0x3f22('0x2d')](db[_0x3f22('0x28')]['rawAttributes']);_0x31f848[_0x3f22('0x2c')]=_[_0x3f22('0x2d')](_0x5b6050[_0x3f22('0x2c')]);_0x31f848['filters']=_[_0x3f22('0x2f')](_0x31f848[_0x3f22('0x2a')],_0x31f848[_0x3f22('0x2c')]);_0x5bb1de[_0x3f22('0x30')]=_['intersection'](_0x31f848['model'],qs['fields'](_0x5b6050[_0x3f22('0x2c')][_0x3f22('0x31')]));_0x5bb1de[_0x3f22('0x30')]=_0x5bb1de[_0x3f22('0x30')]['length']?_0x5bb1de[_0x3f22('0x30')]:_0x31f848[_0x3f22('0x2a')];if(_0x5b6050[_0x3f22('0x2c')][_0x3f22('0x3d')]){_0x5bb1de[_0x3f22('0x3e')]=[{'all':!![]}];}_0x5bb1de=_['merge']({},_0x5bb1de,_0x5b6050['options']);return db[_0x3f22('0x28')][_0x3f22('0x43')](_0x5bb1de)[_0x3f22('0x14')](handleEntityNotFound(_0x24efd4,null))['then'](respondWithResult(_0x24efd4,null))[_0x3f22('0x44')](handleError(_0x24efd4,null));};exports['update']=function(_0x58d0e3,_0x29464c){if(_0x58d0e3[_0x3f22('0x45')]['id']){delete _0x58d0e3[_0x3f22('0x45')]['id'];}return db['MailMessage'][_0x3f22('0x43')]({'where':{'id':_0x58d0e3[_0x3f22('0x42')]['id']}})['then'](handleEntityNotFound(_0x29464c,null))['then'](saveUpdates(_0x58d0e3[_0x3f22('0x45')],null))[_0x3f22('0x14')](respondWithResult(_0x29464c,null))[_0x3f22('0x44')](handleError(_0x29464c,null));};exports[_0x3f22('0x23')]=function(_0x2a9605,_0x5e92a1){return db[_0x3f22('0x28')][_0x3f22('0x43')]({'where':{'id':_0x2a9605[_0x3f22('0x42')]['id']}})[_0x3f22('0x14')](handleEntityNotFound(_0x5e92a1,null))[_0x3f22('0x14')](removeEntity(_0x5e92a1,null))['catch'](handleError(_0x5e92a1,null));};exports[_0x3f22('0x46')]=function(_0x4c2813,_0x2bf078){return db['MailMessage'][_0x3f22('0x46')]()[_0x3f22('0x14')](respondWithResult(_0x2bf078,null))[_0x3f22('0x44')](handleError(_0x2bf078,null));};exports[_0x3f22('0x47')]=function(_0x415e9e,_0x5c2807){return db['MailMessage'][_0x3f22('0x47')](_0x415e9e[_0x3f22('0x45')])[_0x3f22('0x14')](function(_0x3ac931){if(_0x3ac931){if(_0x3ac931['direction']===_0x3f22('0x48')&&!_0x3ac931[_0x3f22('0x49')]){var _0x4ebc95,_0x13a7ea,_0x280a06;if(_0x415e9e[_0x3f22('0x45')]['to']){_0x13a7ea=_0x415e9e[_0x3f22('0x45')]['to']['split'](',')[0x0];}return db[_0x3f22('0x4a')][_0x3f22('0x4b')]({'where':{'id':_0x3ac931[_0x3f22('0x4c')]},'include':[{'model':db[_0x3f22('0x4d')],'as':_0x3f22('0x4e'),'include':[{'model':db['CmContact'],'as':_0x3f22('0x4f'),'where':{'email':_0x13a7ea},'limit':0x1,'order':[[_0x3f22('0x50'),_0x3f22('0x51')]]}]},{'model':db[_0x3f22('0x52')],'as':'Smtp','raw':!![]}]})[_0x3f22('0x14')](function(_0xef1bea){_0x4ebc95=_0xef1bea;if(_0x4ebc95&&_0x4ebc95[_0x3f22('0x53')]){var _0xfa414c={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x54')])){_0xfa414c['host']=_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x55')];_0xfa414c[_0x3f22('0x56')]=_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x56')];_0xfa414c['secure']=_0x4ebc95['Smtp'][_0x3f22('0x57')];if(_0x4ebc95['Smtp'][_0x3f22('0x58')]){_0xfa414c[_0x3f22('0x59')]={'user':_0x4ebc95['Smtp'][_0x3f22('0x5a')],'pass':_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x5b')]};}}else{_0xfa414c[_0x3f22('0x54')]=_0x4ebc95['Smtp']['service'];_0xfa414c[_0x3f22('0x59')]={'user':_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x5a')],'pass':_0x4ebc95[_0x3f22('0x53')][_0x3f22('0x5b')]};_0xfa414c[_0x3f22('0x57')]=_0x4ebc95[_0x3f22('0x53')]['secure'];}if(_0x415e9e[_0x3f22('0x45')][_0x3f22('0x5c')]&&_0x415e9e['body']['attachments'][_0x3f22('0x32')]){for(var _0x53e682=0x0;_0x53e682<_0x415e9e[_0x3f22('0x45')][_0x3f22('0x5c')][_0x3f22('0x32')];_0x53e682+=0x1){_0x415e9e[_0x3f22('0x45')][_0x3f22('0x5c')][_0x53e682]={'filename':_0x415e9e[_0x3f22('0x45')][_0x3f22('0x5c')][_0x53e682]['name'],'path':path[_0x3f22('0x5d')](config['root'],_0x3f22('0x5e'),_0x415e9e['body'][_0x3f22('0x5c')][_0x53e682]['basename'])};}}_0x280a06={'account':_0xfa414c,'message':_0x415e9e['body']};return;}})['then'](function(){if(_0x4ebc95['List']){if(_0x4ebc95[_0x3f22('0x4e')][_0x3f22('0x4f')][_0x3f22('0x32')]){return _0x4ebc95[_0x3f22('0x4e')][_0x3f22('0x4f')][0x0];}else{return db[_0x3f22('0x5f')][_0x3f22('0x47')](_[_0x3f22('0xc')](_0x415e9e[_0x3f22('0x45')],{'firstName':_0x415e9e[_0x3f22('0x45')]['to'],'email':_0x415e9e['body']['to'],'phone':_0x415e9e[_0x3f22('0x45')]['to'],'ListId':_0x4ebc95[_0x3f22('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x3f22('0x14')](function(){if(_0x280a06){return respondWithRpcPromise(_0x3f22('0x61'),_0x3f22('0x62'),_0x280a06,client9003)[_0x3f22('0x14')](function(_0x12a3c0){return _0x3ac931[_0x3f22('0x22')]({'read':!![],'messageId':_0x12a3c0[_0x3f22('0x63')],'sentAt':moment()[_0x3f22('0x64')](_0x3f22('0x65'))});})[_0x3f22('0x44')](function(_0x43f495){logger[_0x3f22('0x19')]('%s',JSON[_0x3f22('0x18')](_0x43f495));return _0x3ac931;});}return _0x3ac931;});}return _0x3ac931;}})[_0x3f22('0x14')](respondWithResult(_0x5c2807,0xc9))[_0x3f22('0x44')](handleError(_0x5c2807,null));};exports[_0x3f22('0x66')]=function(_0x2c5772,_0x211f99){var _0x1a4495={'agent':{},'channel':_0x3f22('0x67')};if(_0x2c5772[_0x3f22('0x45')]['id']){delete _0x2c5772[_0x3f22('0x45')]['id'];}_0x2c5772[_0x3f22('0x45')][_0x3f22('0x68')]=!![];_0x2c5772[_0x3f22('0x45')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c5772[_0x3f22('0x45')][_0x3f22('0x69')]=_0x2c5772['body'][_0x3f22('0x69')]||_0x2c5772['user']['id'];_0x1a4495[_0x3f22('0x6a')]['id']=_0x2c5772[_0x3f22('0x45')][_0x3f22('0x69')];return db[_0x3f22('0x28')][_0x3f22('0x43')]({'where':{'id':_0x2c5772['params']['id'],'UserId':null}})[_0x3f22('0x14')](handleEntityNotFound(_0x211f99,null))['then'](saveUpdates(_0x2c5772['body'],null))[_0x3f22('0x14')](function(_0x3c8ccf){if(_0x3c8ccf){_0x1a4495[_0x3f22('0x1a')]=_0x3c8ccf[_0x3f22('0x6b')]({'plain':!![]});return db[_0x3f22('0x6c')]['find']({'where':{'id':_0x3c8ccf[_0x3f22('0x6d')]}});}return null;})[_0x3f22('0x14')](handleEntityNotFound(_0x211f99,null))[_0x3f22('0x14')](function(_0x5935ab){if(_0x5935ab){return _0x5935ab[_0x3f22('0x22')]({'UserId':_0x2c5772[_0x3f22('0x45')]['UserId'],'read1stAt':_[_0x3f22('0x6e')](_0x5935ab[_0x3f22('0x6f')])?moment()[_0x3f22('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3f22('0x14')](function(_0x3e24c9){if(_0x3e24c9){_0x1a4495['interaction']=_0x3e24c9['get']({'plain':!![]});interaction_log[_0x3f22('0x15')](_0x3f22('0x70'),_0x2c5772[_0x3f22('0x5a')]['id'],_0x2c5772[_0x3f22('0x5a')]['name'],_0x2c5772[_0x3f22('0x5a')][_0x3f22('0x71')],_0x1a4495[_0x3f22('0x72')]['id'],_0x2c5772[_0x3f22('0x45')]?JSON['stringify'](_0x2c5772['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x3f22('0x73'),_0x1a4495);}return null;})[_0x3f22('0x14')](function(_0x537be3){var _0x30acc2=_0x3f22('0x74')+_0x537be3['message'][_0x3f22('0x75')];return db[_0x3f22('0x76')][_0x3f22('0x2c')](_0x30acc2,{'type':db[_0x3f22('0x77')]['QueryTypes'][_0x3f22('0x78')],'raw':!![]})[_0x3f22('0x14')](function(_0x53753d){return _0x53753d;});})[_0x3f22('0x14')](function(_0x3c9c32){if(_0x3c9c32){_0x1a4495['message'][_0x3f22('0x79')]=_0x3c9c32[0x0];if(!_0x2c5772[_0x3f22('0x45')]['UserId'])return;return db[_0x3f22('0x7a')][_0x3f22('0x43')]({'where':{'id':_0x2c5772[_0x3f22('0x45')]['UserId'],'role':_0x3f22('0x6a')},'attributes':['id',_0x3f22('0x26'),'fullname',_0x3f22('0x7b'),_0x3f22('0x7c')],'raw':!![]});}return null;})[_0x3f22('0x14')](function(_0x19ba42){if(!_0x19ba42)return null;_0x1a4495['message']['agent']=_0x19ba42;return _0x1a4495;})[_0x3f22('0x14')](function(_0x163328){if(_0x163328){if(_0x2c5772[_0x3f22('0x45')]['manual']){_0x1a4495[_0x3f22('0x1a')][_0x3f22('0x7d')]=util[_0x3f22('0x64')]('SIP/%s',_0x2c5772['user'][_0x3f22('0x26')]);_0x1a4495[_0x3f22('0x1a')][_0x3f22('0x7e')]=_0x1a4495[_0x3f22('0x7e')];_0x1a4495['message']['motionChannel']=_0x1a4495[_0x3f22('0x7e')];_0x1a4495['message'][_0x3f22('0x7f')]=_0x3f22('0x66');_0x1a4495[_0x3f22('0x1a')]['body']=htmlToText[_0x3f22('0x80')](_0x1a4495[_0x3f22('0x1a')][_0x3f22('0x45')]);return respondWithRpcPromise(_0x3f22('0x81'),'EventManager',{'event':_0x3f22('0x82'),'message':_0x1a4495[_0x3f22('0x1a')]},client9002)[_0x3f22('0x14')](function(){return _0x1a4495;});}return _0x1a4495;}return null;})[_0x3f22('0x14')](respondWithResult(_0x211f99,null))[_0x3f22('0x44')](handleError(_0x211f99,null));};exports[_0x3f22('0x83')]=function(_0x5b0389,_0x5d2ec4){var _0x4ac8fd={'agent':{},'channel':_0x3f22('0x67')};if(_0x5b0389[_0x3f22('0x45')]['id']){delete _0x5b0389[_0x3f22('0x45')]['id'];}_0x5b0389[_0x3f22('0x45')][_0x3f22('0x69')]=_0x5b0389[_0x3f22('0x45')][_0x3f22('0x69')]||_0x5b0389[_0x3f22('0x5a')]['id'];_0x4ac8fd[_0x3f22('0x6a')]['id']=_0x5b0389[_0x3f22('0x45')][_0x3f22('0x69')];return db[_0x3f22('0x28')]['find']({'where':{'id':_0x5b0389[_0x3f22('0x42')]['id'],'UserId':null}})[_0x3f22('0x14')](handleEntityNotFound(_0x5d2ec4,null))[_0x3f22('0x14')](function(_0x592b19){if(_0x592b19){_0x4ac8fd[_0x3f22('0x1a')]=_0x592b19[_0x3f22('0x6b')]({'plain':!![]});return db[_0x3f22('0x6c')]['find']({'where':{'id':_0x592b19['MailInteractionId']}});}return null;})[_0x3f22('0x14')](handleEntityNotFound(_0x5d2ec4,null))['then'](function(_0x3826af){if(_0x3826af){_0x4ac8fd[_0x3f22('0x72')]=_0x3826af[_0x3f22('0x6b')]({'plain':!![]});interaction_log[_0x3f22('0x15')](_0x3f22('0x84'),_0x5b0389[_0x3f22('0x5a')]['id'],_0x5b0389['user'][_0x3f22('0x26')],_0x5b0389[_0x3f22('0x5a')][_0x3f22('0x71')],_0x4ac8fd['interaction']['id'],_0x5b0389[_0x3f22('0x45')]?JSON[_0x3f22('0x18')](_0x5b0389[_0x3f22('0x45')]):'null');return respondWithRpcPromise(_0x3f22('0x85'),_0x3f22('0x86'),_0x4ac8fd);}return null;})['then'](function(_0x473d5d){var _0x38fa10=_0x3f22('0x74')+_0x473d5d['message'][_0x3f22('0x75')];return db['sequelize'][_0x3f22('0x2c')](_0x38fa10,{'type':db[_0x3f22('0x77')]['QueryTypes'][_0x3f22('0x78')],'raw':!![]})[_0x3f22('0x14')](function(_0x4b3bc4){return _0x4b3bc4;});})[_0x3f22('0x14')](function(_0x2329e7){if(_0x2329e7){_0x4ac8fd[_0x3f22('0x1a')][_0x3f22('0x79')]=_0x2329e7[0x0];if(!_0x5b0389['body'][_0x3f22('0x69')])return;return db[_0x3f22('0x7a')][_0x3f22('0x43')]({'where':{'id':_0x5b0389['body'][_0x3f22('0x69')],'role':_0x3f22('0x6a')},'attributes':['id',_0x3f22('0x26'),_0x3f22('0x87'),_0x3f22('0x7b'),_0x3f22('0x7c')],'raw':!![]});}return null;})[_0x3f22('0x14')](function(_0x45b9d6){if(!_0x45b9d6)return null;_0x4ac8fd[_0x3f22('0x1a')][_0x3f22('0x6a')]=_0x45b9d6;return _0x4ac8fd;})['then'](function(_0x4e1a31){if(_0x4e1a31){_0x4e1a31[_0x3f22('0x1a')][_0x3f22('0x7d')]=util[_0x3f22('0x64')](_0x3f22('0x88'),_0x5b0389[_0x3f22('0x5a')][_0x3f22('0x26')]);_0x4e1a31[_0x3f22('0x1a')][_0x3f22('0x7e')]=_0x4ac8fd['channel'];_0x4e1a31[_0x3f22('0x1a')][_0x3f22('0x89')]=_0x4ac8fd[_0x3f22('0x7e')];_0x4e1a31['message'][_0x3f22('0x7f')]=_0x3f22('0x83');_0x4e1a31[_0x3f22('0x1a')][_0x3f22('0x45')]=htmlToText[_0x3f22('0x80')](_0x4ac8fd[_0x3f22('0x1a')]['body']);respondWithRpcPromise(_0x3f22('0x81'),_0x3f22('0x81'),{'event':'rejectmessage','message':_0x4e1a31[_0x3f22('0x1a')]},client9002);return _0x4ac8fd;}return null;})[_0x3f22('0x14')](respondWithResult(_0x5d2ec4,null))[_0x3f22('0x44')](handleError(_0x5d2ec4,null));};exports[_0x3f22('0x8a')]=function(_0x5da9ec,_0x444edb){var _0x5eaef8=moment()[_0x3f22('0x8b')]()[_0x3f22('0x8c')]();var _0x41bfdb=path[_0x3f22('0x5d')](config['root'],'server',_0x3f22('0x8d'),_0x3f22('0x8e'));var _0x4812d3=path[_0x3f22('0x5d')](config['root'],_0x3f22('0x8f'),_0x3f22('0x8d'),_0x3f22('0x5c'));var _0x12fb03=util[_0x3f22('0x64')](_0x3f22('0x90'),_0x5eaef8);return db[_0x3f22('0x28')]['find']({'where':{'id':_0x5da9ec[_0x3f22('0x42')]['id']},'attributes':['id',_0x3f22('0x45'),'from','to','cc',_0x3f22('0x91'),'subject',_0x3f22('0x92')],'include':_0x5da9ec[_0x3f22('0x2c')][_0x3f22('0x5c')]?[{'model':db['Attachment'],'as':_0x3f22('0x93')}]:undefined})[_0x3f22('0x14')](handleEntityNotFound(_0x444edb,null))[_0x3f22('0x14')](function(_0x110b21){if(_0x110b21){var _0x1c61ea=_0x110b21;var _0x161935={'from':_0x1c61ea[_0x3f22('0x94')],'to':_0x1c61ea['to'],'subject':_0x1c61ea['subject'],'html':htmlEntities['decode'](_0x1c61ea[_0x3f22('0x45')]),'headers':{'Date':moment(_0x1c61ea['createdAt'])[_0x3f22('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x110b21['cc']){_0x161935[_0x3f22('0x95')]['Cc']=_0x110b21['cc'];}if(_0x110b21[_0x3f22('0x91')]){_0x161935[_0x3f22('0x95')][_0x3f22('0x96')]=_0x110b21[_0x3f22('0x91')];}return new BPromise(function(_0x512f20,_0x1dd31a){if(_0x110b21[_0x3f22('0x93')]){for(var _0x440094=0x0;_0x440094<_0x110b21['Attachments']['length'];_0x440094++){var _0x440e7c=_0x110b21['Attachments'][_0x440094];var _0x77e13c=path[_0x3f22('0x5d')](_0x4812d3,_0x440e7c[_0x3f22('0x97')]);if(fs[_0x3f22('0x98')](_0x77e13c)){_0x161935[_0x3f22('0x5c')][_0x3f22('0x99')]({'name':_0x440e7c[_0x3f22('0x26')],'contentType':_0x440e7c[_0x3f22('0x3a')],'data':fs[_0x3f22('0x9a')](_0x77e13c)});}}}emlformat[_0x3f22('0x9b')](_0x161935,function(_0x229ce0,_0x4d0a3c){if(_0x229ce0)return _0x1dd31a(_0x229ce0);fs[_0x3f22('0x9c')](path['join'](_0x41bfdb,_0x12fb03),_0x4d0a3c);return _0x512f20(_0x4d0a3c);});});}})[_0x3f22('0x14')](function(_0x5e6184){if(_0x5e6184){return _0x444edb[_0x3f22('0x8a')](path[_0x3f22('0x5d')](_0x41bfdb,_0x12fb03),_0x12fb03,function(_0x3a278d){if(!_0x3a278d)fs['unlinkSync'](path['join'](_0x41bfdb,_0x12fb03));});}})[_0x3f22('0x44')](handleError(_0x444edb,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a2ef590..591f1aa 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 _0x0556=['events','MailMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x284462,_0x42893d){var _0x446ebc=function(_0xa7d185){while(--_0xa7d185){_0x284462['push'](_0x284462['shift']());}};_0x446ebc(++_0x42893d);}(_0x0556,0x183));var _0x6055=function(_0x2575eb,_0x456f3f){_0x2575eb=_0x2575eb-0x0;var _0x1c49da=_0x0556[_0x2575eb];return _0x1c49da;};'use strict';var EventEmitter=require(_0x6055('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x6055('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6055('0x2'),'afterUpdate':_0x6055('0x3'),'afterDestroy':_0x6055('0x4')};function emitEvent(_0x54a74f){return function(_0x4c2b2f,_0x25c818,_0x23cc91){MailMessageEvents[_0x6055('0x5')](_0x54a74f+':'+_0x4c2b2f['id'],_0x4c2b2f);MailMessageEvents[_0x6055('0x5')](_0x54a74f,_0x4c2b2f);_0x23cc91(null);};}for(var e in events){if(events[_0x6055('0x6')](e)){var event=events[e];MailMessage[_0x6055('0x7')](e,emitEvent(event));}}module[_0x6055('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x3f23=['../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3f23,0x17a));var _0x33f2=function(_0x4784fb,_0xd52a18){_0x4784fb=_0x4784fb-0x0;var _0x164fb7=_0x3f23[_0x4784fb];return _0x164fb7;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x33f2('0x0'))['db'][_0x33f2('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x33f2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x33f2('0x3'),'afterDestroy':_0x33f2('0x4')};function emitEvent(_0x3812cb){return function(_0x358099,_0x4e2b21,_0x188335){MailMessageEvents[_0x33f2('0x5')](_0x3812cb+':'+_0x358099['id'],_0x358099);MailMessageEvents[_0x33f2('0x5')](_0x3812cb,_0x358099);_0x188335(null);};}for(var e in events){if(events[_0x33f2('0x6')](e)){var event=events[e];MailMessage[_0x33f2('0x7')](e,emitEvent(event));}}module[_0x33f2('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 2534c20..7023472 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 _0xc690=['fti_mail_messages','plainBody','FULLTEXT','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc690,0x123));var _0x0c69=function(_0x298f88,_0x464f4b){_0x298f88=_0x298f88-0x0;var _0xd748de=_0xc690[_0x298f88];return _0xd748de;};'use strict';var _=require(_0x0c69('0x0'));var util=require(_0x0c69('0x1'));var logger=require(_0x0c69('0x2'))(_0x0c69('0x3'));var moment=require(_0x0c69('0x4'));var BPromise=require(_0x0c69('0x5'));var rp=require(_0x0c69('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0c69('0x7'));var rimraf=require('rimraf');var config=require(_0x0c69('0x8'));var attributes=require(_0x0c69('0x9'));module[_0x0c69('0xa')]=function(_0x465887,_0x292c1e){return _0x465887[_0x0c69('0xb')](_0x0c69('0xc'),attributes,{'tableName':_0x0c69('0xd'),'paranoid':![],'indexes':[{'name':_0x0c69('0xe'),'fields':[_0x0c69('0xe')]},{'name':_0x0c69('0xf'),'fields':[_0x0c69('0x10'),'subject'],'type':_0x0c69('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3652b7,_0x2d23eb,_0x520ce9){if(_0x3652b7['body']){_0x3652b7[_0x0c69('0x10')]=htmlToText[_0x0c69('0x12')](_0x3652b7['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x520ce9(null,_0x2d23eb);},'afterCreate':function(_0x1b969a,_0x3ff7a5,_0x559b0d){var _0x1d0812=_0x465887[_0x0c69('0x13')];var _0x4d1780=_0x1b969a[_0x0c69('0x14')]({'plain':!![]});if(_0x4d1780[_0x0c69('0x15')][_0x0c69('0x16')]()==='in'||_0x4d1780['direction']['toLowerCase']()==='out'&&!_0x4d1780[_0x0c69('0x17')]&&!_[_0x0c69('0x18')](_0x4d1780[_0x0c69('0x19')])){_0x1d0812[_0x0c69('0x1a')][_0x0c69('0x1b')]({'where':{'id':_0x4d1780['MailInteractionId']}})['then'](function(_0x372d97){if(_0x372d97){_0x372d97[_0x0c69('0x1c')]({'lastMsgAt':_0x4d1780[_0x0c69('0x1d')],'lastMsgDirection':_0x4d1780['direction']['toLowerCase']()});}})[_0x0c69('0x1e')](function(_0x42efcb){console[_0x0c69('0x1f')](_0x42efcb);});}_0x559b0d();}},'charset':_0x0c69('0x20'),'collate':_0x0c69('0x21')});}; \ No newline at end of file +var _0x8e16=['createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','then'];(function(_0x5f41a8,_0x19c20d){var _0x5092c6=function(_0x300d15){while(--_0x300d15){_0x5f41a8['push'](_0x5f41a8['shift']());}};_0x5092c6(++_0x19c20d);}(_0x8e16,0x197));var _0x68e1=function(_0x175462,_0x4ab9c3){_0x175462=_0x175462-0x0;var _0x4ce7b1=_0x8e16[_0x175462];return _0x4ce7b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x68e1('0x0'))(_0x68e1('0x1'));var moment=require(_0x68e1('0x2'));var BPromise=require(_0x68e1('0x3'));var rp=require(_0x68e1('0x4'));var htmlToText=require(_0x68e1('0x5'));var fs=require('fs');var path=require(_0x68e1('0x6'));var rimraf=require(_0x68e1('0x7'));var config=require(_0x68e1('0x8'));var attributes=require(_0x68e1('0x9'));module['exports']=function(_0x3e7d0d,_0x20c4a0){return _0x3e7d0d['define'](_0x68e1('0xa'),attributes,{'tableName':_0x68e1('0xb'),'paranoid':![],'indexes':[{'name':_0x68e1('0xc'),'fields':[_0x68e1('0xc')]},{'name':_0x68e1('0xd'),'fields':['plainBody','subject'],'type':_0x68e1('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36df20,_0x140c7f,_0x46a44f){if(_0x36df20[_0x68e1('0xf')]){_0x36df20[_0x68e1('0x10')]=htmlToText[_0x68e1('0x11')](_0x36df20[_0x68e1('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x46a44f(null,_0x140c7f);},'afterCreate':function(_0x29fab6,_0x440d3e,_0x26eab4){var _0x3ed61c=_0x3e7d0d[_0x68e1('0x12')];var _0x42547a=_0x29fab6['get']({'plain':!![]});if(_0x42547a[_0x68e1('0x13')][_0x68e1('0x14')]()==='in'||_0x42547a[_0x68e1('0x13')][_0x68e1('0x14')]()===_0x68e1('0x15')&&!_0x42547a[_0x68e1('0x16')]&&!_[_0x68e1('0x17')](_0x42547a[_0x68e1('0x18')])){_0x3ed61c[_0x68e1('0x19')]['findOne']({'where':{'id':_0x42547a['MailInteractionId']}})[_0x68e1('0x1a')](function(_0x26b7fd){if(_0x26b7fd){_0x26b7fd['update']({'lastMsgAt':_0x42547a[_0x68e1('0x1b')],'lastMsgDirection':_0x42547a['direction'][_0x68e1('0x14')]()});}})['catch'](function(_0xef8c28){console[_0x68e1('0x1c')](_0xef8c28);});}_0x26eab4();}},'charset':_0x68e1('0x1d'),'collate':_0x68e1('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d62a730..03d5c47 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 _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9519da,_0x599840){var _0x74b199=function(_0x357b9c){while(--_0x357b9c){_0x9519da['push'](_0x9519da['shift']());}};_0x74b199(++_0x599840);}(_0x7d25,0x8a));var _0x57d2=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x7d25[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file +var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateMailMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ba6d5,_0x241a95){var _0x486b68=function(_0x3d82b6){while(--_0x3d82b6){_0x1ba6d5['push'](_0x1ba6d5['shift']());}};_0x486b68(++_0x241a95);}(_0x5eb8,0xb0));var _0x85eb=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x5eb8[_0x15876a];return _0xbd900f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./mailMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateMailMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['MailMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateMailMessage',_0x24cf28);logger['debug']('CreateMailMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9dbfba0..c02097e 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 _0x93a0=['length','mailMessage:','remove','emit','removeListener','register'];(function(_0x2beae6,_0x1f6c64){var _0x58489d=function(_0x34c8f1){while(--_0x34c8f1){_0x2beae6['push'](_0x2beae6['shift']());}};_0x58489d(++_0x1f6c64);}(_0x93a0,0x1c4));var _0x093a=function(_0x59c812,_0x245990){_0x59c812=_0x59c812-0x0;var _0x3b3681=_0x93a0[_0x59c812];return _0x3b3681;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x093a('0x0'),'update'];function createListener(_0x13a7cb,_0x2ec5e2){return function(_0x2df303){_0x2ec5e2[_0x093a('0x1')](_0x13a7cb,_0x2df303);};}function removeListener(_0x39e40e,_0x50711b){return function(){MailMessageEvents[_0x093a('0x2')](_0x39e40e,_0x50711b);};}exports[_0x093a('0x3')]=function(_0x3beb5f){for(var _0x256ad9=0x0,_0x41ce4e=events[_0x093a('0x4')];_0x256ad9<_0x41ce4e;_0x256ad9++){var _0x2970f2=events[_0x256ad9];var _0x25ac09=createListener(_0x093a('0x5')+_0x2970f2,_0x3beb5f);MailMessageEvents['on'](_0x2970f2,_0x25ac09);}}; \ No newline at end of file +var _0xaba0=['removeListener','register','length','mailMessage:','save','remove','update','emit'];(function(_0x4cee11,_0xbe9073){var _0x330547=function(_0x45e145){while(--_0x45e145){_0x4cee11['push'](_0x4cee11['shift']());}};_0x330547(++_0xbe9073);}(_0xaba0,0x64));var _0x0aba=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xaba0[_0x6131cd];return _0x47e916;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x0aba('0x0'),_0x0aba('0x1'),_0x0aba('0x2')];function createListener(_0x36effd,_0x4c5340){return function(_0x19cb2c){_0x4c5340[_0x0aba('0x3')](_0x36effd,_0x19cb2c);};}function removeListener(_0x2736e2,_0x1f0235){return function(){MailMessageEvents[_0x0aba('0x4')](_0x2736e2,_0x1f0235);};}exports[_0x0aba('0x5')]=function(_0x52c8b1){for(var _0x1a9fd5=0x0,_0x521bf1=events[_0x0aba('0x6')];_0x1a9fd5<_0x521bf1;_0x1a9fd5++){var _0x587537=events[_0x1a9fd5];var _0x24c1e5=createListener(_0x0aba('0x7')+_0x587537,_0x52c8b1);MailMessageEvents['on'](_0x587537,_0x24c1e5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8d778c9..c3eef52 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 _0x8112=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','destroy','removeTeams','removeAgents','util'];(function(_0x18bc72,_0x1b2062){var _0x3db2c0=function(_0x2c6256){while(--_0x2c6256){_0x18bc72['push'](_0x18bc72['shift']());}};_0x3db2c0(++_0x1b2062);}(_0x8112,0x128));var _0x2811=function(_0x20844e,_0x3bf79a){_0x20844e=_0x20844e-0x0;var _0x327d07=_0x8112[_0x20844e];return _0x327d07;};'use strict';var multer=require('multer');var util=require(_0x2811('0x0'));var path=require('path');var timeout=require(_0x2811('0x1'));var express=require(_0x2811('0x2'));var router=express[_0x2811('0x3')]();var fs_extra=require(_0x2811('0x4'));var auth=require(_0x2811('0x5'));var interaction=require(_0x2811('0x6'));var config=require(_0x2811('0x7'));var controller=require('./mailQueue.controller');router[_0x2811('0x8')]('/',auth[_0x2811('0x9')](),controller[_0x2811('0xa')]);router['get'](_0x2811('0xb'),auth['isAuthenticated'](),controller[_0x2811('0xc')]);router[_0x2811('0x8')](_0x2811('0xd'),auth[_0x2811('0x9')](),controller[_0x2811('0xe')]);router[_0x2811('0x8')](_0x2811('0xf'),auth['isAuthenticated'](),controller[_0x2811('0x10')]);router['get'](_0x2811('0x11'),auth[_0x2811('0x9')](),controller[_0x2811('0x12')]);router[_0x2811('0x8')](_0x2811('0x13'),auth[_0x2811('0x9')](),controller[_0x2811('0x14')]);router[_0x2811('0x15')]('/',auth['isAuthenticated'](),controller[_0x2811('0x16')]);router[_0x2811('0x15')]('/:id/teams',auth[_0x2811('0x9')](),controller['addTeams']);router[_0x2811('0x15')](_0x2811('0x13'),auth[_0x2811('0x9')](),controller['addAgents']);router[_0x2811('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2811('0x9')](),controller[_0x2811('0x18')]);router['delete'](_0x2811('0x11'),auth[_0x2811('0x9')](),controller[_0x2811('0x19')]);router['delete'](_0x2811('0x13'),auth[_0x2811('0x9')](),controller[_0x2811('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb06e=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','show','/:id/members'];(function(_0x210cc5,_0x225e82){var _0x128ff6=function(_0x393fbb){while(--_0x393fbb){_0x210cc5['push'](_0x210cc5['shift']());}};_0x128ff6(++_0x225e82);}(_0xb06e,0x1e1));var _0xeb06=function(_0xf74a9f,_0x483e3b){_0xf74a9f=_0xf74a9f-0x0;var _0x53b807=_0xb06e[_0xf74a9f];return _0x53b807;};'use strict';var multer=require(_0xeb06('0x0'));var util=require(_0xeb06('0x1'));var path=require(_0xeb06('0x2'));var timeout=require(_0xeb06('0x3'));var express=require(_0xeb06('0x4'));var router=express[_0xeb06('0x5')]();var fs_extra=require(_0xeb06('0x6'));var auth=require(_0xeb06('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xeb06('0x8'));var controller=require(_0xeb06('0x9'));router[_0xeb06('0xa')]('/',auth[_0xeb06('0xb')](),controller['index']);router[_0xeb06('0xa')](_0xeb06('0xc'),auth[_0xeb06('0xb')](),controller['describe']);router['get']('/:id',auth[_0xeb06('0xb')](),controller[_0xeb06('0xd')]);router[_0xeb06('0xa')](_0xeb06('0xe'),auth[_0xeb06('0xb')](),controller[_0xeb06('0xf')]);router[_0xeb06('0xa')](_0xeb06('0x10'),auth[_0xeb06('0xb')](),controller[_0xeb06('0x11')]);router[_0xeb06('0xa')](_0xeb06('0x12'),auth['isAuthenticated'](),controller[_0xeb06('0x13')]);router[_0xeb06('0x14')]('/',auth[_0xeb06('0xb')](),controller[_0xeb06('0x15')]);router[_0xeb06('0x14')]('/:id/teams',auth[_0xeb06('0xb')](),controller[_0xeb06('0x16')]);router[_0xeb06('0x14')](_0xeb06('0x12'),auth['isAuthenticated'](),controller[_0xeb06('0x17')]);router['put'](_0xeb06('0x18'),auth[_0xeb06('0xb')](),controller[_0xeb06('0x19')]);router['delete'](_0xeb06('0x18'),auth['isAuthenticated'](),controller[_0xeb06('0x1a')]);router[_0xeb06('0x1b')](_0xeb06('0x10'),auth[_0xeb06('0xb')](),controller[_0xeb06('0x1c')]);router['delete'](_0xeb06('0x12'),auth[_0xeb06('0xb')](),controller[_0xeb06('0x1d')]);module[_0xeb06('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 53054ca..071c6af 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 _0xf8d5=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','STRING'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0xf8d5,0x83));var _0x5f8d=function(_0x4f9896,_0x13f9bf){_0x4f9896=_0x4f9896-0x0;var _0x47a9ae=_0xf8d5[_0x4f9896];return _0x47a9ae;};'use strict';var Sequelize=require(_0x5f8d('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f8d('0x1')],'unique':_0x5f8d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f8d('0x1')]},'timeout':{'type':Sequelize[_0x5f8d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f8d('0x4')](_0x5f8d('0x5'),_0x5f8d('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xc15f=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x355b97,_0x53b83a){var _0x3c41dd=function(_0x1c9eba){while(--_0x1c9eba){_0x355b97['push'](_0x355b97['shift']());}};_0x3c41dd(++_0x53b83a);}(_0xc15f,0x1af));var _0xfc15=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xc15f[_0xcf4569];return _0x7fef;};'use strict';var Sequelize=require('sequelize');module[_0xfc15('0x0')]={'name':{'type':Sequelize[_0xfc15('0x1')],'unique':_0xfc15('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfc15('0x1')]},'timeout':{'type':Sequelize[_0xfc15('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfc15('0x4')](_0xfc15('0x5'),_0xfc15('0x6'),_0xfc15('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 347cf46..cd9c613 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 _0x2ed4=['createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','emit','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','json','limit','undefined','offset','count','status','set','apply','reject','update','destroy','then','get','MailQueues','UserProfileResource','end','name','send','MailQueue','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','body','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','updatedAt','%s/%s','SIP','mailPause'];(function(_0x3d6785,_0x492ea3){var _0x39a624=function(_0x27d7db){while(--_0x27d7db){_0x3d6785['push'](_0x3d6785['shift']());}};_0x39a624(++_0x492ea3);}(_0x2ed4,0x1b3));var _0x42ed=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x2ed4[_0x257642];return _0x3d813b;};'use strict';var emlformat=require(_0x42ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42ed('0x1'));var jsonpatch=require(_0x42ed('0x2'));var rp=require(_0x42ed('0x3'));var moment=require(_0x42ed('0x4'));var BPromise=require(_0x42ed('0x5'));var Mustache=require(_0x42ed('0x6'));var util=require(_0x42ed('0x7'));var path=require(_0x42ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42ed('0x9'));var fs=require('fs');var fs_extra=require(_0x42ed('0xa'));var _=require(_0x42ed('0xb'));var squel=require(_0x42ed('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x42ed('0xd'));var Papa=require(_0x42ed('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x42ed('0xf'));var as=require(_0x42ed('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x42ed('0x11'));var utils=require(_0x42ed('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x42ed('0x13'));var db=require(_0x42ed('0x14'))['db'];config[_0x42ed('0x15')]=_[_0x42ed('0x16')](config[_0x42ed('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x42ed('0x17'))(new Redis(config[_0x42ed('0x15')]));require(_0x42ed('0x18'))[_0x42ed('0x19')](socket);function respondWithStatusCode(_0x2d1c81,_0x239f4e){_0x239f4e=_0x239f4e||0xcc;return function(_0x3cf614){if(_0x3cf614){return _0x2d1c81[_0x42ed('0x1a')](_0x239f4e);}return _0x2d1c81['status'](_0x239f4e)['end']();};}function respondWithResult(_0x512359,_0x31b17e){_0x31b17e=_0x31b17e||0xc8;return function(_0x26c04d){if(_0x26c04d){return _0x512359['status'](_0x31b17e)[_0x42ed('0x1b')](_0x26c04d);}};}function respondWithFilteredResult(_0x116d14,_0x439498){return function(_0x3eda89){if(_0x3eda89){var _0x6be4a9=typeof _0x439498['offset']==='undefined'&&typeof _0x439498[_0x42ed('0x1c')]===_0x42ed('0x1d');var _0x5750db=_0x3eda89['count'];var _0x4ceba1=_0x6be4a9?0x0:_0x439498[_0x42ed('0x1e')];var _0x3686a2=_0x6be4a9?_0x3eda89[_0x42ed('0x1f')]:_0x439498[_0x42ed('0x1e')]+_0x439498[_0x42ed('0x1c')];var _0x2a70d5;if(_0x3686a2>=_0x5750db){_0x3686a2=_0x5750db;_0x2a70d5=0xc8;}else{_0x2a70d5=0xce;}_0x116d14[_0x42ed('0x20')](_0x2a70d5);return _0x116d14[_0x42ed('0x21')]('Content-Range',_0x4ceba1+'-'+_0x3686a2+'/'+_0x5750db)['json'](_0x3eda89);}return null;};}function patchUpdates(_0x40864f){return function(_0x61711b){try{jsonpatch[_0x42ed('0x22')](_0x61711b,_0x40864f,!![]);}catch(_0xc9ab4){return BPromise[_0x42ed('0x23')](_0xc9ab4);}return _0x61711b['save']();};}function saveUpdates(_0x1eda6b,_0x403e59){return function(_0x431365){if(_0x431365){return _0x431365[_0x42ed('0x24')](_0x1eda6b)['then'](function(_0x420bbf){return _0x420bbf;});}return null;};}function removeEntity(_0x18125c,_0x3bf81a){return function(_0xcbfb99){if(_0xcbfb99){return _0xcbfb99[_0x42ed('0x25')]()[_0x42ed('0x26')](function(){var _0x14f24f=_0xcbfb99[_0x42ed('0x27')]({'plain':!![]});var _0x80e03d=_0x42ed('0x28');return db[_0x42ed('0x29')][_0x42ed('0x25')]({'where':{'type':_0x80e03d,'resourceId':_0x14f24f['id']}})['then'](function(){return _0xcbfb99;});})[_0x42ed('0x26')](function(){_0x18125c[_0x42ed('0x20')](0xcc)[_0x42ed('0x2a')]();});}};}function handleEntityNotFound(_0x178e26,_0x5a9c42){return function(_0x23aef1){if(!_0x23aef1){_0x178e26[_0x42ed('0x1a')](0x194);}return _0x23aef1;};}function handleError(_0x226453,_0xf890aa){_0xf890aa=_0xf890aa||0x1f4;return function(_0x53faa0){logger['error'](_0x53faa0['stack']);if(_0x53faa0[_0x42ed('0x2b')]){delete _0x53faa0[_0x42ed('0x2b')];}_0x226453['status'](_0xf890aa)[_0x42ed('0x2c')](_0x53faa0);};}exports['index']=function(_0x132eed,_0x211615){var _0x1b9156={},_0x5a479f={},_0x3db543={'count':0x0,'rows':[]};var _0xb573d6=_['map'](db[_0x42ed('0x2d')]['rawAttributes'],function(_0x21e1b6){return{'name':_0x21e1b6[_0x42ed('0x2e')],'type':_0x21e1b6[_0x42ed('0x2f')]['key']};});_0x5a479f[_0x42ed('0x30')]=_[_0x42ed('0x31')](_0xb573d6,_0x42ed('0x2b'));_0x5a479f[_0x42ed('0x32')]=_[_0x42ed('0x33')](_0x132eed[_0x42ed('0x32')]);_0x5a479f[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x5a479f[_0x42ed('0x30')],_0x5a479f['query']);_0x1b9156[_0x42ed('0x36')]=_[_0x42ed('0x35')](_0x5a479f[_0x42ed('0x30')],qs[_0x42ed('0x37')](_0x132eed[_0x42ed('0x32')]['fields']));_0x1b9156['attributes']=_0x1b9156[_0x42ed('0x36')]['length']?_0x1b9156[_0x42ed('0x36')]:_0x5a479f[_0x42ed('0x30')];if(!_0x132eed['query'][_0x42ed('0x38')](_0x42ed('0x39'))){_0x1b9156[_0x42ed('0x1c')]=qs[_0x42ed('0x1c')](_0x132eed[_0x42ed('0x32')][_0x42ed('0x1c')]);_0x1b9156[_0x42ed('0x1e')]=qs[_0x42ed('0x1e')](_0x132eed[_0x42ed('0x32')][_0x42ed('0x1e')]);}_0x1b9156[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x132eed[_0x42ed('0x32')]['sort']);_0x1b9156[_0x42ed('0x3c')]=qs['filters'](_[_0x42ed('0x3d')](_0x132eed[_0x42ed('0x32')],_0x5a479f[_0x42ed('0x34')]),_0xb573d6);if(_0x132eed[_0x42ed('0x32')][_0x42ed('0x3e')]){_0x1b9156['where']=_[_0x42ed('0x3f')](_0x1b9156[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x31')](_0xb573d6,function(_0x294b01){if(_0x294b01[_0x42ed('0x2f')]!==_0x42ed('0x40')){var _0x5a6fb0={};_0x5a6fb0[_0x294b01[_0x42ed('0x2b')]]={'$like':'%'+_0x132eed['query']['filter']+'%'};return _0x5a6fb0;}})});}_0x1b9156=_[_0x42ed('0x3f')]({},_0x1b9156,_0x132eed[_0x42ed('0x41')]);var _0x24ecfc={'where':_0x1b9156[_0x42ed('0x3c')]};return db[_0x42ed('0x2d')][_0x42ed('0x1f')](_0x24ecfc)[_0x42ed('0x26')](function(_0x4703a1){_0x3db543[_0x42ed('0x1f')]=_0x4703a1;if(_0x132eed[_0x42ed('0x32')]['includeAll']){_0x1b9156[_0x42ed('0x42')]=[{'all':!![]}];}return db[_0x42ed('0x2d')][_0x42ed('0x43')](_0x1b9156);})[_0x42ed('0x26')](function(_0x57b6ae){_0x3db543[_0x42ed('0x44')]=_0x57b6ae;return _0x3db543;})[_0x42ed('0x26')](respondWithFilteredResult(_0x211615,_0x1b9156))['catch'](handleError(_0x211615,null));};exports[_0x42ed('0x45')]=function(_0x573a64,_0x3acb47){var _0x4e91db={'raw':!![],'where':{'id':_0x573a64[_0x42ed('0x46')]['id']}},_0x1d4911={};_0x1d4911[_0x42ed('0x30')]=_[_0x42ed('0x33')](db[_0x42ed('0x2d')][_0x42ed('0x47')]);_0x1d4911['query']=_['keys'](_0x573a64[_0x42ed('0x32')]);_0x1d4911['filters']=_['intersection'](_0x1d4911[_0x42ed('0x30')],_0x1d4911[_0x42ed('0x32')]);_0x4e91db['attributes']=_[_0x42ed('0x35')](_0x1d4911[_0x42ed('0x30')],qs[_0x42ed('0x37')](_0x573a64[_0x42ed('0x32')][_0x42ed('0x37')]));_0x4e91db[_0x42ed('0x36')]=_0x4e91db[_0x42ed('0x36')][_0x42ed('0x48')]?_0x4e91db['attributes']:_0x1d4911['model'];if(_0x573a64[_0x42ed('0x32')][_0x42ed('0x49')]){_0x4e91db[_0x42ed('0x42')]=[{'all':!![]}];}_0x4e91db=_['merge']({},_0x4e91db,_0x573a64['options']);return db[_0x42ed('0x2d')][_0x42ed('0x4a')](_0x4e91db)['then'](handleEntityNotFound(_0x3acb47,null))[_0x42ed('0x26')](respondWithResult(_0x3acb47,null))[_0x42ed('0x4b')](handleError(_0x3acb47,null));};exports[_0x42ed('0x4c')]=function(_0x1d714b,_0xa2faf3){return db[_0x42ed('0x2d')]['create'](_0x1d714b['body'],{})[_0x42ed('0x26')](function(_0x2c0a0b){var _0x29ab95=_0x1d714b['user']['get']({'plain':!![]});if(!_0x29ab95)throw new Error(_0x42ed('0x4d'));if(_0x29ab95[_0x42ed('0x4e')]===_0x42ed('0x4f')){var _0x318325=_0x2c0a0b[_0x42ed('0x27')]({'plain':!![]});var _0x308f70=_0x42ed('0x28');return db[_0x42ed('0x50')][_0x42ed('0x4a')]({'where':{'name':_0x308f70,'userProfileId':_0x29ab95[_0x42ed('0x51')]},'raw':!![]})[_0x42ed('0x26')](function(_0xf9c3e0){if(_0xf9c3e0&&_0xf9c3e0[_0x42ed('0x52')]===0x0){return db[_0x42ed('0x29')][_0x42ed('0x4c')]({'name':_0x318325[_0x42ed('0x2b')],'resourceId':_0x318325['id'],'type':_0xf9c3e0[_0x42ed('0x2b')],'sectionId':_0xf9c3e0['id']},{})['then'](function(){return _0x2c0a0b;});}else{return _0x2c0a0b;}})['catch'](function(_0x53bc86){logger[_0x42ed('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53bc86);throw _0x53bc86;});}return _0x2c0a0b;})[_0x42ed('0x26')](respondWithResult(_0xa2faf3,0xc9))[_0x42ed('0x4b')](handleError(_0xa2faf3,null));};exports[_0x42ed('0x24')]=function(_0x4a00cf,_0x3ad9c2){if(_0x4a00cf[_0x42ed('0x54')]['id']){delete _0x4a00cf[_0x42ed('0x54')]['id'];}return db['MailQueue'][_0x42ed('0x4a')]({'where':{'id':_0x4a00cf[_0x42ed('0x46')]['id']}})[_0x42ed('0x26')](handleEntityNotFound(_0x3ad9c2,null))[_0x42ed('0x26')](saveUpdates(_0x4a00cf['body'],null))['then'](respondWithResult(_0x3ad9c2,null))[_0x42ed('0x4b')](handleError(_0x3ad9c2,null));};exports[_0x42ed('0x25')]=function(_0x82377e,_0x117f6a){return db[_0x42ed('0x2d')][_0x42ed('0x4a')]({'where':{'id':_0x82377e[_0x42ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x117f6a,null))[_0x42ed('0x26')](removeEntity(_0x117f6a,null))[_0x42ed('0x4b')](handleError(_0x117f6a,null));};exports[_0x42ed('0x55')]=function(_0x25906b,_0x6a329c){return db['MailQueue'][_0x42ed('0x55')]()['then'](respondWithResult(_0x6a329c,null))['catch'](handleError(_0x6a329c,null));};exports[_0x42ed('0x56')]=function(_0x5f0270,_0x11fcfc,_0x21d342){var _0x57ba4f={'raw':!![],'where':{}},_0xe05137={},_0x2b2158;return db[_0x42ed('0x2d')][_0x42ed('0x57')]({'where':{'id':_0x5f0270[_0x42ed('0x46')]['id']}})[_0x42ed('0x26')](handleEntityNotFound(_0x11fcfc,null))[_0x42ed('0x26')](function(_0x3770d8){if(_0x3770d8){_0x2b2158=_0x3770d8[_0x42ed('0x27')]({'plain':!![]});_0xe05137[_0x42ed('0x30')]=_[_0x42ed('0x33')](db['UserMailQueue'][_0x42ed('0x47')]);_0xe05137[_0x42ed('0x32')]=_[_0x42ed('0x33')](_0x5f0270[_0x42ed('0x32')]);_0xe05137[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0xe05137['model'],_0xe05137[_0x42ed('0x32')]);_0x57ba4f[_0x42ed('0x36')]=_[_0x42ed('0x35')](_0xe05137[_0x42ed('0x30')],qs[_0x42ed('0x37')](_0x5f0270[_0x42ed('0x32')][_0x42ed('0x37')]));_0x57ba4f['attributes']=_0x57ba4f[_0x42ed('0x36')][_0x42ed('0x48')]?_0x57ba4f['attributes']:_0xe05137[_0x42ed('0x30')];if(!_0x5f0270[_0x42ed('0x32')][_0x42ed('0x38')](_0x42ed('0x39'))){_0x57ba4f[_0x42ed('0x1c')]=qs[_0x42ed('0x1c')](_0x5f0270[_0x42ed('0x32')][_0x42ed('0x1c')]);_0x57ba4f[_0x42ed('0x1e')]=qs[_0x42ed('0x1e')](_0x5f0270[_0x42ed('0x32')][_0x42ed('0x1e')]);}_0x57ba4f['order']=qs[_0x42ed('0x3b')](_0x5f0270[_0x42ed('0x32')][_0x42ed('0x3b')]);_0x57ba4f[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x5f0270['query'],_0xe05137[_0x42ed('0x34')]));_0x57ba4f['where'][_0x42ed('0x58')]=_0x3770d8['id'];if(_0x5f0270[_0x42ed('0x32')][_0x42ed('0x3e')]){_0x57ba4f[_0x42ed('0x3c')]=_['merge'](_0x57ba4f[_0x42ed('0x3c')],{'$or':_['map'](_0x57ba4f['attributes'],function(_0x2e9b4b){var _0x5e1897={};_0x5e1897[_0x2e9b4b]={'$like':'%'+_0x5f0270[_0x42ed('0x32')][_0x42ed('0x3e')]+'%'};return _0x5e1897;})});}_0x57ba4f=_[_0x42ed('0x3f')]({},_0x57ba4f,_0x5f0270[_0x42ed('0x41')]);return db[_0x42ed('0x59')]['findAll'](_0x57ba4f);}})[_0x42ed('0x26')](function(_0x36e01e){if(_0x36e01e){return db[_0x42ed('0x5a')][_0x42ed('0x5b')]({'where':{'id':_[_0x42ed('0x31')](_0x36e01e,_0x42ed('0x5c')),'role':'agent'},'attributes':['id',_0x42ed('0x2b'),'mailPause',_0x42ed('0x5d'),'createdAt']});}})[_0x42ed('0x26')](function(_0x14c503){if(_0x14c503){return{'count':_0x14c503[_0x42ed('0x1f')],'rows':_['map'](_0x14c503[_0x42ed('0x44')],function(_0x2cc579){return{'membername':_0x2cc579[_0x42ed('0x2b')],'UserId':_0x2cc579['id'],'queue_name':_0x2b2158[_0x42ed('0x2b')],'MailQueueId':_0x2b2158['id'],'interface':util['format'](_0x42ed('0x5e'),_0x42ed('0x5f'),_0x2cc579[_0x42ed('0x2b')]),'penalty':0x0,'paused':_0x2cc579[_0x42ed('0x60')],'createdAt':_0x2cc579[_0x42ed('0x61')],'updatedAt':_0x2cc579[_0x42ed('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x42ed('0x26')](respondWithFilteredResult(_0x11fcfc,_0x57ba4f))['catch'](handleError(_0x11fcfc,null));};exports[_0x42ed('0x62')]=function(_0x5d8470,_0x1d191b,_0x5441a8){var _0x18018c={};var _0x494961={};var _0x2c945f;var _0x1ba8ac;return db[_0x42ed('0x2d')]['findOne']({'where':{'id':_0x5d8470['params']['id']}})[_0x42ed('0x26')](handleEntityNotFound(_0x1d191b,null))[_0x42ed('0x26')](function(_0x1d87f9){if(_0x1d87f9){_0x2c945f=_0x1d87f9;_0x494961['model']=_['keys'](db[_0x42ed('0x63')]['rawAttributes']);_0x494961['query']=_['keys'](_0x5d8470[_0x42ed('0x32')]);_0x494961[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x494961[_0x42ed('0x30')],_0x494961[_0x42ed('0x32')]);_0x18018c[_0x42ed('0x36')]=_[_0x42ed('0x35')](_0x494961['model'],qs[_0x42ed('0x37')](_0x5d8470['query'][_0x42ed('0x37')]));_0x18018c[_0x42ed('0x36')]=_0x18018c[_0x42ed('0x36')][_0x42ed('0x48')]?_0x18018c[_0x42ed('0x36')]:_0x494961[_0x42ed('0x30')];_0x18018c['order']=qs['sort'](_0x5d8470[_0x42ed('0x32')][_0x42ed('0x3b')]);_0x18018c[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x5d8470[_0x42ed('0x32')],_0x494961[_0x42ed('0x34')]));if(_0x5d8470[_0x42ed('0x32')]['filter']){_0x18018c[_0x42ed('0x3c')]=_['merge'](_0x18018c[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x31')](_0x18018c['attributes'],function(_0x1d7dea){var _0x4d2ec3={};_0x4d2ec3[_0x1d7dea]={'$like':'%'+_0x5d8470[_0x42ed('0x32')]['filter']+'%'};return _0x4d2ec3;})});}_0x18018c=_[_0x42ed('0x3f')]({},_0x18018c,_0x5d8470['options']);return _0x2c945f[_0x42ed('0x62')](_0x18018c);}})[_0x42ed('0x26')](function(_0x2ef18d){if(_0x2ef18d){_0x1ba8ac=_0x2ef18d['length'];if(!_0x5d8470['query'][_0x42ed('0x38')]('nolimit')){_0x18018c[_0x42ed('0x1c')]=qs[_0x42ed('0x1c')](_0x5d8470[_0x42ed('0x32')][_0x42ed('0x1c')]);_0x18018c[_0x42ed('0x1e')]=qs[_0x42ed('0x1e')](_0x5d8470['query']['offset']);}return _0x2c945f[_0x42ed('0x62')](_0x18018c);}})[_0x42ed('0x26')](function(_0x452c9f){if(_0x452c9f){return _0x452c9f?{'count':_0x1ba8ac,'rows':_0x452c9f}:null;}})[_0x42ed('0x26')](respondWithResult(_0x1d191b,null))[_0x42ed('0x4b')](handleError(_0x1d191b,null));};exports[_0x42ed('0x64')]=function(_0x38358c,_0x573181,_0x4d84ca){var _0x13fd14=_0x38358c[_0x42ed('0x54')][_0x42ed('0x65')];return db[_0x42ed('0x63')][_0x42ed('0x43')]({'where':{'id':_0x13fd14},'attributes':['id'],'include':[{'model':db[_0x42ed('0x5a')],'as':_0x42ed('0x66'),'attributes':['id',_0x42ed('0x2b'),_0x42ed('0x67'),_0x42ed('0x68'),_0x42ed('0x69')],'raw':!![]}]})[_0x42ed('0x26')](function(_0x53e163){if(_0x53e163){var _0x4c94b5=_[_0x42ed('0x6a')](_0x53e163,function(_0x4c42c5){var _0x445213=_0x4c42c5[_0x42ed('0x27')]({'plain':!![]});return _0x445213[_0x42ed('0x66')];});return db[_0x42ed('0x2d')][_0x42ed('0x4a')]({'where':{'id':_0x38358c[_0x42ed('0x46')]['id']}})[_0x42ed('0x26')](function(_0x5d0a1f){return db[_0x42ed('0x6b')][_0x42ed('0x6c')](function(_0x3ca48d){return _0x5d0a1f[_0x42ed('0x64')](_0x13fd14,{'transaction':_0x3ca48d})['then'](function(){return BPromise[_0x42ed('0x6d')](_0x4c94b5,function(_0x184ebb){return db[_0x42ed('0x59')]['findOrCreate']({'where':{'UserId':_0x184ebb['id'],'MailQueueId':_0x38358c[_0x42ed('0x46')]['id']},'transaction':_0x3ca48d});});})[_0x42ed('0x26')](function(){_0x4c94b5[_0x42ed('0x6e')](function(_0x3bd47e){socket['emit'](_0x42ed('0x6f'),{'UserId':_0x3bd47e['id'],'MailQueueId':_0x5d0a1f['id']});});});});});}})['then'](respondWithStatusCode(_0x573181,null))['catch'](handleError(_0x573181,null));};exports[_0x42ed('0x70')]=function(_0x217e12,_0x584f9c,_0x3a9460){return db['Team']['findAll']({'where':{'id':_0x217e12['query'][_0x42ed('0x65')]},'attributes':['id'],'include':[{'model':db[_0x42ed('0x5a')],'as':_0x42ed('0x66'),'attributes':['id'],'raw':!![]}]})[_0x42ed('0x26')](handleEntityNotFound(_0x584f9c,null))['then'](function(_0x4836d2){var _0x1df405=_['map'](_0x4836d2,'id');var _0x4e151f=[];var _0x362a53=[];var _0x4dc40d=squel[_0x42ed('0x71')]();_0x4dc40d['field'](_0x42ed('0x72'))[_0x42ed('0x73')]('team_has_mail_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x42ed('0x3c')](_0x42ed('0x74'),_0x217e12[_0x42ed('0x46')]['id']);for(var _0x28b4b0=0x0;_0x28b4b0<_0x4836d2[_0x42ed('0x48')];_0x28b4b0+=0x1){let _0x2098b0=_0x4836d2[_0x28b4b0];for(var _0x5be266=0x0;_0x5be266<_0x2098b0[_0x42ed('0x66')][_0x42ed('0x48')];_0x5be266+=0x1){let _0x31c684=_0x2098b0[_0x42ed('0x66')][_0x5be266];var _0x17e6ef=_0x4dc40d[_0x42ed('0x75')]();_0x17e6ef[_0x42ed('0x3c')](_0x42ed('0x76'),_0x31c684['id']);_0x362a53[_0x42ed('0x77')](db[_0x42ed('0x6b')][_0x42ed('0x32')](_0x17e6ef['toString'](),{'type':db[_0x42ed('0x6b')][_0x42ed('0x78')][_0x42ed('0x79')]})[_0x42ed('0x26')](function(_0x2dde5c){if(_0x2dde5c[_0x42ed('0x48')]===0x1){return _0x31c684['id'];}else{var _0x24e1cb=_[_0x42ed('0x7a')](_['map'](_0x2dde5c,_0x42ed('0x7b')),function(_0x167b16){return _[_0x42ed('0x7c')](_0x1df405,_0x167b16);});if(_0x24e1cb){return _0x31c684['id'];}}}));}}return BPromise[_0x42ed('0x7d')](_0x362a53)[_0x42ed('0x26')](function(_0x5d016f){_0x4e151f=_(_0x4e151f)['union'](_0x5d016f)[_0x42ed('0x7e')]()['value']();return db[_0x42ed('0x2d')]['find']({'where':{'id':_0x217e12[_0x42ed('0x46')]['id']}})['then'](function(_0x4c306a){return db[_0x42ed('0x6b')]['transaction'](function(_0x41bdb0){return _0x4c306a[_0x42ed('0x70')](_0x217e12[_0x42ed('0x32')][_0x42ed('0x65')],{'transaction':_0x41bdb0})['then'](function(){if(!_[_0x42ed('0x7f')](_0x4e151f)){return _0x4c306a['removeAgents'](_0x4e151f,{'transaction':_0x41bdb0});}})[_0x42ed('0x26')](function(){_0x4e151f[_0x42ed('0x6e')](function(_0x53edf7){socket[_0x42ed('0x80')]('userMailQueue:remove',{'UserId':_0x53edf7,'MailQueueId':_0x4c306a['id']});});});});});});})[_0x42ed('0x26')](respondWithStatusCode(_0x584f9c,null))[_0x42ed('0x4b')](handleError(_0x584f9c,null));};exports['addAgents']=function(_0x5e0eea,_0x259723,_0x35a1aa){return db[_0x42ed('0x2d')][_0x42ed('0x4a')]({'where':{'id':_0x5e0eea[_0x42ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x259723,null))[_0x42ed('0x26')](function(_0x3f00de){if(_0x3f00de){return _0x3f00de['addAgents'](_0x5e0eea[_0x42ed('0x54')][_0x42ed('0x65')],_['omit'](_0x5e0eea[_0x42ed('0x54')],['ids','id'])||{})['spread'](function(_0x2904e2){for(var _0x121d1f=0x0;_0x121d1f<_0x5e0eea['body'][_0x42ed('0x65')][_0x42ed('0x48')];_0x121d1f+=0x1){socket['emit'](_0x42ed('0x6f'),{'UserId':Number(_0x5e0eea['body'][_0x42ed('0x65')][_0x121d1f]),'MailQueueId':Number(_0x5e0eea[_0x42ed('0x46')]['id'])});}return _0x2904e2;});}})[_0x42ed('0x26')](respondWithResult(_0x259723,null))[_0x42ed('0x4b')](handleError(_0x259723,null));};exports[_0x42ed('0x81')]=function(_0x33ae7f,_0x3e1b58,_0x319320){return db[_0x42ed('0x2d')][_0x42ed('0x4a')]({'where':{'id':_0x33ae7f[_0x42ed('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e1b58,null))[_0x42ed('0x26')](function(_0xb35a1f){if(_0xb35a1f){return _0xb35a1f[_0x42ed('0x81')](_0x33ae7f[_0x42ed('0x32')][_0x42ed('0x65')])['then'](function(){if(_[_0x42ed('0x82')](_0x33ae7f[_0x42ed('0x32')][_0x42ed('0x65')])){for(var _0x33c60b=0x0;_0x33c60b<_0x33ae7f[_0x42ed('0x32')][_0x42ed('0x65')][_0x42ed('0x48')];_0x33c60b+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x33ae7f[_0x42ed('0x32')]['ids'][_0x33c60b]),'MailQueueId':Number(_0x33ae7f[_0x42ed('0x46')]['id'])});}}else{socket[_0x42ed('0x80')](_0x42ed('0x83'),{'UserId':Number(_0x33ae7f[_0x42ed('0x32')][_0x42ed('0x65')]),'MailQueueId':Number(_0x33ae7f[_0x42ed('0x46')]['id'])});}});}})[_0x42ed('0x26')](respondWithStatusCode(_0x3e1b58,null))['catch'](handleError(_0x3e1b58,null));};exports[_0x42ed('0x84')]=function(_0x63d99f,_0x1b9f43,_0x5a4eae){var _0x18f983={};var _0x360dc3={};var _0x16d79a;var _0x539b38;return db[_0x42ed('0x2d')]['findOne']({'where':{'id':_0x63d99f[_0x42ed('0x46')]['id']}})[_0x42ed('0x26')](handleEntityNotFound(_0x1b9f43,null))[_0x42ed('0x26')](function(_0x22e443){if(_0x22e443){_0x16d79a=_0x22e443;_0x360dc3[_0x42ed('0x30')]=_['keys'](db[_0x42ed('0x5a')][_0x42ed('0x47')]);_0x360dc3[_0x42ed('0x32')]=_['keys'](_0x63d99f[_0x42ed('0x32')]);_0x360dc3[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x360dc3['model'],_0x360dc3[_0x42ed('0x32')]);_0x18f983['attributes']=_['intersection'](_0x360dc3[_0x42ed('0x30')],qs[_0x42ed('0x37')](_0x63d99f[_0x42ed('0x32')][_0x42ed('0x37')]));_0x18f983[_0x42ed('0x36')]=_0x18f983[_0x42ed('0x36')][_0x42ed('0x48')]?_0x18f983[_0x42ed('0x36')]:_0x360dc3[_0x42ed('0x30')];_0x18f983[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x63d99f['query'][_0x42ed('0x3b')]);_0x18f983[_0x42ed('0x3c')]=qs['filters'](_[_0x42ed('0x3d')](_0x63d99f['query'],_0x360dc3[_0x42ed('0x34')]));if(_0x63d99f[_0x42ed('0x32')][_0x42ed('0x3e')]){_0x18f983[_0x42ed('0x3c')]=_[_0x42ed('0x3f')](_0x18f983[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x31')](_0x18f983[_0x42ed('0x36')],function(_0x383a48){var _0x4783b7={};_0x4783b7[_0x383a48]={'$like':'%'+_0x63d99f[_0x42ed('0x32')][_0x42ed('0x3e')]+'%'};return _0x4783b7;})});}_0x18f983=_[_0x42ed('0x3f')]({},_0x18f983,_0x63d99f['options']);return _0x16d79a[_0x42ed('0x84')](_0x18f983);}})[_0x42ed('0x26')](function(_0x2b6cb5){if(_0x2b6cb5){_0x539b38=_0x2b6cb5['length'];if(!_0x63d99f[_0x42ed('0x32')]['hasOwnProperty'](_0x42ed('0x39'))){_0x18f983[_0x42ed('0x1c')]=qs[_0x42ed('0x1c')](_0x63d99f[_0x42ed('0x32')]['limit']);_0x18f983[_0x42ed('0x1e')]=qs[_0x42ed('0x1e')](_0x63d99f[_0x42ed('0x32')][_0x42ed('0x1e')]);}return _0x16d79a['getAgents'](_0x18f983);}})[_0x42ed('0x26')](function(_0x10534f){if(_0x10534f){return _0x10534f?{'count':_0x539b38,'rows':_0x10534f}:null;}})[_0x42ed('0x26')](respondWithResult(_0x1b9f43,null))['catch'](handleError(_0x1b9f43,null));}; \ No newline at end of file +var _0x5fa1=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','mailPause','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','get','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','find','userProfileId'];(function(_0x29cce9,_0x3dfc12){var _0x535ed7=function(_0xe01105){while(--_0xe01105){_0x29cce9['push'](_0x29cce9['shift']());}};_0x535ed7(++_0x3dfc12);}(_0x5fa1,0xcb));var _0x15fa=function(_0x452e01,_0x5c6899){_0x452e01=_0x452e01-0x0;var _0x11e205=_0x5fa1[_0x452e01];return _0x11e205;};'use strict';var emlformat=require(_0x15fa('0x0'));var rimraf=require(_0x15fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15fa('0x2'));var moment=require(_0x15fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x15fa('0x4'));var util=require(_0x15fa('0x5'));var path=require(_0x15fa('0x6'));var sox=require(_0x15fa('0x7'));var csv=require(_0x15fa('0x8'));var ejs=require(_0x15fa('0x9'));var fs=require('fs');var fs_extra=require(_0x15fa('0xa'));var _=require(_0x15fa('0xb'));var squel=require(_0x15fa('0xc'));var crypto=require('crypto');var jsforce=require(_0x15fa('0xd'));var deskjs=require(_0x15fa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x15fa('0xf'));var Papa=require(_0x15fa('0x10'));var Redis=require(_0x15fa('0x11'));var authService=require(_0x15fa('0x12'));var qs=require(_0x15fa('0x13'));var as=require(_0x15fa('0x14'));var hardwareService=require(_0x15fa('0x15'));var logger=require(_0x15fa('0x16'))(_0x15fa('0x17'));var utils=require('../../config/utils');var config=require(_0x15fa('0x18'));var licenseUtil=require(_0x15fa('0x19'));var db=require(_0x15fa('0x1a'))['db'];config[_0x15fa('0x1b')]=_[_0x15fa('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x15fa('0x1d'))(new Redis(config[_0x15fa('0x1b')]));require(_0x15fa('0x1e'))[_0x15fa('0x1f')](socket);function respondWithStatusCode(_0x12c879,_0x24fb71){_0x24fb71=_0x24fb71||0xcc;return function(_0x404d29){if(_0x404d29){return _0x12c879[_0x15fa('0x20')](_0x24fb71);}return _0x12c879[_0x15fa('0x21')](_0x24fb71)['end']();};}function respondWithResult(_0x22067b,_0x2d9d5f){_0x2d9d5f=_0x2d9d5f||0xc8;return function(_0x24be32){if(_0x24be32){return _0x22067b[_0x15fa('0x21')](_0x2d9d5f)['json'](_0x24be32);}};}function respondWithFilteredResult(_0xc8dbb4,_0x40bda8){return function(_0x4d067f){if(_0x4d067f){var _0x3f11ac=typeof _0x40bda8[_0x15fa('0x22')]===_0x15fa('0x23')&&typeof _0x40bda8['limit']===_0x15fa('0x23');var _0x5b4b3e=_0x4d067f['count'];var _0x55edc1=_0x3f11ac?0x0:_0x40bda8['offset'];var _0x4dfd3f=_0x3f11ac?_0x4d067f[_0x15fa('0x24')]:_0x40bda8[_0x15fa('0x22')]+_0x40bda8['limit'];var _0x310ad6;if(_0x4dfd3f>=_0x5b4b3e){_0x4dfd3f=_0x5b4b3e;_0x310ad6=0xc8;}else{_0x310ad6=0xce;}_0xc8dbb4[_0x15fa('0x21')](_0x310ad6);return _0xc8dbb4[_0x15fa('0x25')](_0x15fa('0x26'),_0x55edc1+'-'+_0x4dfd3f+'/'+_0x5b4b3e)[_0x15fa('0x27')](_0x4d067f);}return null;};}function patchUpdates(_0x2a55a3){return function(_0x5985aa){try{jsonpatch['apply'](_0x5985aa,_0x2a55a3,!![]);}catch(_0x4a5b54){return BPromise[_0x15fa('0x28')](_0x4a5b54);}return _0x5985aa['save']();};}function saveUpdates(_0x174065,_0x26ea95){return function(_0x1c8427){if(_0x1c8427){return _0x1c8427[_0x15fa('0x29')](_0x174065)[_0x15fa('0x2a')](function(_0x5d08f8){return _0x5d08f8;});}return null;};}function removeEntity(_0x8bcf4e,_0xdbee40){return function(_0x3ea2a6){if(_0x3ea2a6){return _0x3ea2a6[_0x15fa('0x2b')]()[_0x15fa('0x2a')](function(){var _0x4b3f73=_0x3ea2a6[_0x15fa('0x2c')]({'plain':!![]});var _0xd49d83='MailQueues';return db['UserProfileResource'][_0x15fa('0x2b')]({'where':{'type':_0xd49d83,'resourceId':_0x4b3f73['id']}})[_0x15fa('0x2a')](function(){return _0x3ea2a6;});})['then'](function(){_0x8bcf4e[_0x15fa('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a734,_0x47afde){return function(_0x185d7e){if(!_0x185d7e){_0x21a734[_0x15fa('0x20')](0x194);}return _0x185d7e;};}function handleError(_0x13e66f,_0x9d2de7){_0x9d2de7=_0x9d2de7||0x1f4;return function(_0x10bb63){logger[_0x15fa('0x2d')](_0x10bb63[_0x15fa('0x2e')]);if(_0x10bb63[_0x15fa('0x2f')]){delete _0x10bb63[_0x15fa('0x2f')];}_0x13e66f[_0x15fa('0x21')](_0x9d2de7)[_0x15fa('0x30')](_0x10bb63);};}exports[_0x15fa('0x31')]=function(_0x565ded,_0x197f2a){var _0x5d2327={},_0x435bf5={},_0x4aa9ae={'count':0x0,'rows':[]};var _0x53b315=_['map'](db[_0x15fa('0x32')][_0x15fa('0x33')],function(_0x2b8a9d){return{'name':_0x2b8a9d[_0x15fa('0x34')],'type':_0x2b8a9d[_0x15fa('0x35')][_0x15fa('0x36')]};});_0x435bf5['model']=_[_0x15fa('0x37')](_0x53b315,_0x15fa('0x2f'));_0x435bf5[_0x15fa('0x38')]=_[_0x15fa('0x39')](_0x565ded[_0x15fa('0x38')]);_0x435bf5[_0x15fa('0x3a')]=_['intersection'](_0x435bf5[_0x15fa('0x3b')],_0x435bf5['query']);_0x5d2327[_0x15fa('0x3c')]=_[_0x15fa('0x3d')](_0x435bf5[_0x15fa('0x3b')],qs[_0x15fa('0x3e')](_0x565ded[_0x15fa('0x38')]['fields']));_0x5d2327[_0x15fa('0x3c')]=_0x5d2327[_0x15fa('0x3c')][_0x15fa('0x3f')]?_0x5d2327['attributes']:_0x435bf5['model'];if(!_0x565ded[_0x15fa('0x38')][_0x15fa('0x40')](_0x15fa('0x41'))){_0x5d2327[_0x15fa('0x42')]=qs[_0x15fa('0x42')](_0x565ded['query'][_0x15fa('0x42')]);_0x5d2327[_0x15fa('0x22')]=qs['offset'](_0x565ded[_0x15fa('0x38')][_0x15fa('0x22')]);}_0x5d2327[_0x15fa('0x43')]=qs['sort'](_0x565ded['query'][_0x15fa('0x44')]);_0x5d2327[_0x15fa('0x45')]=qs[_0x15fa('0x3a')](_[_0x15fa('0x46')](_0x565ded['query'],_0x435bf5[_0x15fa('0x3a')]),_0x53b315);if(_0x565ded['query'][_0x15fa('0x47')]){_0x5d2327[_0x15fa('0x45')]=_[_0x15fa('0x48')](_0x5d2327[_0x15fa('0x45')],{'$or':_[_0x15fa('0x37')](_0x53b315,function(_0x1b21ba){if(_0x1b21ba['type']!==_0x15fa('0x49')){var _0x2e4066={};_0x2e4066[_0x1b21ba[_0x15fa('0x2f')]]={'$like':'%'+_0x565ded[_0x15fa('0x38')][_0x15fa('0x47')]+'%'};return _0x2e4066;}})});}_0x5d2327=_[_0x15fa('0x48')]({},_0x5d2327,_0x565ded['options']);var _0x4d0906={'where':_0x5d2327[_0x15fa('0x45')]};return db[_0x15fa('0x32')][_0x15fa('0x24')](_0x4d0906)[_0x15fa('0x2a')](function(_0x513069){_0x4aa9ae[_0x15fa('0x24')]=_0x513069;if(_0x565ded[_0x15fa('0x38')][_0x15fa('0x4a')]){_0x5d2327[_0x15fa('0x4b')]=[{'all':!![]}];}return db[_0x15fa('0x32')][_0x15fa('0x4c')](_0x5d2327);})['then'](function(_0x58a6a4){_0x4aa9ae[_0x15fa('0x4d')]=_0x58a6a4;return _0x4aa9ae;})['then'](respondWithFilteredResult(_0x197f2a,_0x5d2327))['catch'](handleError(_0x197f2a,null));};exports[_0x15fa('0x4e')]=function(_0x288074,_0x52acdd){var _0x500240={'raw':!![],'where':{'id':_0x288074[_0x15fa('0x4f')]['id']}},_0x4b6a88={};_0x4b6a88[_0x15fa('0x3b')]=_[_0x15fa('0x39')](db[_0x15fa('0x32')]['rawAttributes']);_0x4b6a88['query']=_[_0x15fa('0x39')](_0x288074[_0x15fa('0x38')]);_0x4b6a88['filters']=_['intersection'](_0x4b6a88[_0x15fa('0x3b')],_0x4b6a88[_0x15fa('0x38')]);_0x500240[_0x15fa('0x3c')]=_[_0x15fa('0x3d')](_0x4b6a88[_0x15fa('0x3b')],qs[_0x15fa('0x3e')](_0x288074[_0x15fa('0x38')][_0x15fa('0x3e')]));_0x500240['attributes']=_0x500240['attributes'][_0x15fa('0x3f')]?_0x500240[_0x15fa('0x3c')]:_0x4b6a88[_0x15fa('0x3b')];if(_0x288074[_0x15fa('0x38')][_0x15fa('0x4a')]){_0x500240[_0x15fa('0x4b')]=[{'all':!![]}];}_0x500240=_[_0x15fa('0x48')]({},_0x500240,_0x288074[_0x15fa('0x50')]);return db[_0x15fa('0x32')]['find'](_0x500240)[_0x15fa('0x2a')](handleEntityNotFound(_0x52acdd,null))['then'](respondWithResult(_0x52acdd,null))[_0x15fa('0x51')](handleError(_0x52acdd,null));};exports[_0x15fa('0x52')]=function(_0x4df137,_0x3462d5){return db['MailQueue'][_0x15fa('0x52')](_0x4df137[_0x15fa('0x53')],{})[_0x15fa('0x2a')](function(_0x4eadca){var _0x271eb0=_0x4df137['user'][_0x15fa('0x2c')]({'plain':!![]});if(!_0x271eb0)throw new Error(_0x15fa('0x54'));if(_0x271eb0[_0x15fa('0x55')]===_0x15fa('0x56')){var _0xb2ed59=_0x4eadca[_0x15fa('0x2c')]({'plain':!![]});var _0x2238dd=_0x15fa('0x57');return db[_0x15fa('0x58')][_0x15fa('0x59')]({'where':{'name':_0x2238dd,'userProfileId':_0x271eb0[_0x15fa('0x5a')]},'raw':!![]})['then'](function(_0x2fa338){if(_0x2fa338&&_0x2fa338[_0x15fa('0x5b')]===0x0){return db['UserProfileResource'][_0x15fa('0x52')]({'name':_0xb2ed59[_0x15fa('0x2f')],'resourceId':_0xb2ed59['id'],'type':_0x2fa338[_0x15fa('0x2f')],'sectionId':_0x2fa338['id']},{})['then'](function(){return _0x4eadca;});}else{return _0x4eadca;}})[_0x15fa('0x51')](function(_0x28b8b2){logger[_0x15fa('0x2d')](_0x15fa('0x5c'),_0x28b8b2);throw _0x28b8b2;});}return _0x4eadca;})[_0x15fa('0x2a')](respondWithResult(_0x3462d5,0xc9))['catch'](handleError(_0x3462d5,null));};exports[_0x15fa('0x29')]=function(_0x2d817b,_0x40073a){if(_0x2d817b[_0x15fa('0x53')]['id']){delete _0x2d817b[_0x15fa('0x53')]['id'];}return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x2d817b[_0x15fa('0x4f')]['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x40073a,null))[_0x15fa('0x2a')](saveUpdates(_0x2d817b[_0x15fa('0x53')],null))[_0x15fa('0x2a')](respondWithResult(_0x40073a,null))[_0x15fa('0x51')](handleError(_0x40073a,null));};exports[_0x15fa('0x2b')]=function(_0x464707,_0x5582b5){return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x464707[_0x15fa('0x4f')]['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x5582b5,null))['then'](removeEntity(_0x5582b5,null))[_0x15fa('0x51')](handleError(_0x5582b5,null));};exports['describe']=function(_0x54c6bc,_0x4b8e66){return db[_0x15fa('0x32')]['describe']()[_0x15fa('0x2a')](respondWithResult(_0x4b8e66,null))[_0x15fa('0x51')](handleError(_0x4b8e66,null));};exports[_0x15fa('0x5d')]=function(_0x58bd3f,_0x1440d7,_0x3c4eb1){var _0x266528={'raw':!![],'where':{}},_0x264726={},_0x52ec83;return db['MailQueue'][_0x15fa('0x5e')]({'where':{'id':_0x58bd3f['params']['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x1440d7,null))[_0x15fa('0x2a')](function(_0x3c117a){if(_0x3c117a){_0x52ec83=_0x3c117a[_0x15fa('0x2c')]({'plain':!![]});_0x264726['model']=_[_0x15fa('0x39')](db[_0x15fa('0x5f')][_0x15fa('0x33')]);_0x264726['query']=_[_0x15fa('0x39')](_0x58bd3f[_0x15fa('0x38')]);_0x264726['filters']=_[_0x15fa('0x3d')](_0x264726[_0x15fa('0x3b')],_0x264726[_0x15fa('0x38')]);_0x266528[_0x15fa('0x3c')]=_[_0x15fa('0x3d')](_0x264726[_0x15fa('0x3b')],qs[_0x15fa('0x3e')](_0x58bd3f[_0x15fa('0x38')][_0x15fa('0x3e')]));_0x266528['attributes']=_0x266528[_0x15fa('0x3c')][_0x15fa('0x3f')]?_0x266528[_0x15fa('0x3c')]:_0x264726['model'];if(!_0x58bd3f['query'][_0x15fa('0x40')](_0x15fa('0x41'))){_0x266528['limit']=qs[_0x15fa('0x42')](_0x58bd3f[_0x15fa('0x38')][_0x15fa('0x42')]);_0x266528[_0x15fa('0x22')]=qs[_0x15fa('0x22')](_0x58bd3f['query'][_0x15fa('0x22')]);}_0x266528[_0x15fa('0x43')]=qs[_0x15fa('0x44')](_0x58bd3f['query']['sort']);_0x266528['where']=qs[_0x15fa('0x3a')](_['pick'](_0x58bd3f[_0x15fa('0x38')],_0x264726['filters']));_0x266528[_0x15fa('0x45')][_0x15fa('0x60')]=_0x3c117a['id'];if(_0x58bd3f[_0x15fa('0x38')][_0x15fa('0x47')]){_0x266528[_0x15fa('0x45')]=_[_0x15fa('0x48')](_0x266528['where'],{'$or':_[_0x15fa('0x37')](_0x266528[_0x15fa('0x3c')],function(_0x445a6a){var _0x40d6e8={};_0x40d6e8[_0x445a6a]={'$like':'%'+_0x58bd3f['query'][_0x15fa('0x47')]+'%'};return _0x40d6e8;})});}_0x266528=_[_0x15fa('0x48')]({},_0x266528,_0x58bd3f[_0x15fa('0x50')]);return db['UserMailQueue'][_0x15fa('0x4c')](_0x266528);}})[_0x15fa('0x2a')](function(_0x173248){if(_0x173248){return db[_0x15fa('0x61')][_0x15fa('0x62')]({'where':{'id':_[_0x15fa('0x37')](_0x173248,_0x15fa('0x63')),'role':'agent'},'attributes':['id',_0x15fa('0x2f'),'mailPause',_0x15fa('0x64'),_0x15fa('0x65')]});}})[_0x15fa('0x2a')](function(_0xd9f601){if(_0xd9f601){return{'count':_0xd9f601[_0x15fa('0x24')],'rows':_[_0x15fa('0x37')](_0xd9f601[_0x15fa('0x4d')],function(_0x54dc7c){return{'membername':_0x54dc7c[_0x15fa('0x2f')],'UserId':_0x54dc7c['id'],'queue_name':_0x52ec83[_0x15fa('0x2f')],'MailQueueId':_0x52ec83['id'],'interface':util[_0x15fa('0x66')](_0x15fa('0x67'),_0x15fa('0x68'),_0x54dc7c[_0x15fa('0x2f')]),'penalty':0x0,'paused':_0x54dc7c[_0x15fa('0x69')],'createdAt':_0x54dc7c[_0x15fa('0x65')],'updatedAt':_0x54dc7c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x15fa('0x2a')](respondWithFilteredResult(_0x1440d7,_0x266528))['catch'](handleError(_0x1440d7,null));};exports[_0x15fa('0x6a')]=function(_0x574a0a,_0xf18bf1,_0x332aa0){var _0x1eda7e={};var _0x454f06={};var _0x3d09d4;var _0x3301ef;return db[_0x15fa('0x32')]['findOne']({'where':{'id':_0x574a0a[_0x15fa('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf18bf1,null))[_0x15fa('0x2a')](function(_0x5c915e){if(_0x5c915e){_0x3d09d4=_0x5c915e;_0x454f06[_0x15fa('0x3b')]=_[_0x15fa('0x39')](db[_0x15fa('0x6b')][_0x15fa('0x33')]);_0x454f06['query']=_[_0x15fa('0x39')](_0x574a0a['query']);_0x454f06['filters']=_[_0x15fa('0x3d')](_0x454f06['model'],_0x454f06[_0x15fa('0x38')]);_0x1eda7e[_0x15fa('0x3c')]=_['intersection'](_0x454f06[_0x15fa('0x3b')],qs[_0x15fa('0x3e')](_0x574a0a[_0x15fa('0x38')]['fields']));_0x1eda7e[_0x15fa('0x3c')]=_0x1eda7e[_0x15fa('0x3c')][_0x15fa('0x3f')]?_0x1eda7e[_0x15fa('0x3c')]:_0x454f06[_0x15fa('0x3b')];_0x1eda7e[_0x15fa('0x43')]=qs[_0x15fa('0x44')](_0x574a0a[_0x15fa('0x38')][_0x15fa('0x44')]);_0x1eda7e[_0x15fa('0x45')]=qs[_0x15fa('0x3a')](_['pick'](_0x574a0a[_0x15fa('0x38')],_0x454f06['filters']));if(_0x574a0a[_0x15fa('0x38')][_0x15fa('0x47')]){_0x1eda7e['where']=_['merge'](_0x1eda7e[_0x15fa('0x45')],{'$or':_[_0x15fa('0x37')](_0x1eda7e[_0x15fa('0x3c')],function(_0x33b659){var _0x155a84={};_0x155a84[_0x33b659]={'$like':'%'+_0x574a0a[_0x15fa('0x38')][_0x15fa('0x47')]+'%'};return _0x155a84;})});}_0x1eda7e=_['merge']({},_0x1eda7e,_0x574a0a[_0x15fa('0x50')]);return _0x3d09d4['getTeams'](_0x1eda7e);}})[_0x15fa('0x2a')](function(_0x47f9d0){if(_0x47f9d0){_0x3301ef=_0x47f9d0[_0x15fa('0x3f')];if(!_0x574a0a[_0x15fa('0x38')]['hasOwnProperty'](_0x15fa('0x41'))){_0x1eda7e[_0x15fa('0x42')]=qs['limit'](_0x574a0a[_0x15fa('0x38')][_0x15fa('0x42')]);_0x1eda7e[_0x15fa('0x22')]=qs[_0x15fa('0x22')](_0x574a0a[_0x15fa('0x38')]['offset']);}return _0x3d09d4[_0x15fa('0x6a')](_0x1eda7e);}})[_0x15fa('0x2a')](function(_0x5ce4ed){if(_0x5ce4ed){return _0x5ce4ed?{'count':_0x3301ef,'rows':_0x5ce4ed}:null;}})[_0x15fa('0x2a')](respondWithResult(_0xf18bf1,null))['catch'](handleError(_0xf18bf1,null));};exports['addTeams']=function(_0x157e92,_0x38711d,_0x152bbc){var _0x40266b=_0x157e92['body'][_0x15fa('0x6c')];return db['Team'][_0x15fa('0x4c')]({'where':{'id':_0x40266b},'attributes':['id'],'include':[{'model':db[_0x15fa('0x61')],'as':_0x15fa('0x6d'),'attributes':['id',_0x15fa('0x2f'),_0x15fa('0x6e'),_0x15fa('0x6f'),_0x15fa('0x70')],'raw':!![]}]})[_0x15fa('0x2a')](function(_0x12d364){if(_0x12d364){var _0x2c7018=_[_0x15fa('0x71')](_0x12d364,function(_0x2e751e){var _0x342089=_0x2e751e[_0x15fa('0x2c')]({'plain':!![]});return _0x342089['Agents'];});return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x157e92[_0x15fa('0x4f')]['id']}})[_0x15fa('0x2a')](function(_0x428529){return db[_0x15fa('0x72')][_0x15fa('0x73')](function(_0x5c81ec){return _0x428529['addTeams'](_0x40266b,{'transaction':_0x5c81ec})[_0x15fa('0x2a')](function(){return BPromise[_0x15fa('0x74')](_0x2c7018,function(_0x5baee1){return db[_0x15fa('0x5f')][_0x15fa('0x75')]({'where':{'UserId':_0x5baee1['id'],'MailQueueId':_0x157e92[_0x15fa('0x4f')]['id']},'transaction':_0x5c81ec});});})[_0x15fa('0x2a')](function(){_0x2c7018[_0x15fa('0x76')](function(_0x4f7767){socket['emit'](_0x15fa('0x77'),{'UserId':_0x4f7767['id'],'MailQueueId':_0x428529['id']});});});});});}})[_0x15fa('0x2a')](respondWithStatusCode(_0x38711d,null))[_0x15fa('0x51')](handleError(_0x38711d,null));};exports[_0x15fa('0x78')]=function(_0x12d460,_0x2a44dd,_0xa02d6c){return db[_0x15fa('0x6b')][_0x15fa('0x4c')]({'where':{'id':_0x12d460['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x15fa('0x61')],'as':_0x15fa('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x15fa('0x2a')](handleEntityNotFound(_0x2a44dd,null))['then'](function(_0x455a6f){var _0x52e0da=_['map'](_0x455a6f,'id');var _0x3bb40e=[];var _0x26f435=[];var _0x1c7e81=squel[_0x15fa('0x79')]();_0x1c7e81[_0x15fa('0x7a')](_0x15fa('0x7b'))[_0x15fa('0x7c')](_0x15fa('0x7d'),'tq')[_0x15fa('0x7e')](_0x15fa('0x7f'),'ut',_0x15fa('0x80'))['where']('MailQueueId\x20=\x20?',_0x12d460[_0x15fa('0x4f')]['id']);for(var _0x26a0a6=0x0;_0x26a0a6<_0x455a6f[_0x15fa('0x3f')];_0x26a0a6+=0x1){let _0x546db7=_0x455a6f[_0x26a0a6];for(var _0x17a6d9=0x0;_0x17a6d9<_0x546db7[_0x15fa('0x6d')][_0x15fa('0x3f')];_0x17a6d9+=0x1){let _0x1957c1=_0x546db7[_0x15fa('0x6d')][_0x17a6d9];var _0xf63879=_0x1c7e81[_0x15fa('0x81')]();_0xf63879[_0x15fa('0x45')](_0x15fa('0x82'),_0x1957c1['id']);_0x26f435[_0x15fa('0x83')](db['sequelize'][_0x15fa('0x38')](_0xf63879['toString'](),{'type':db['sequelize'][_0x15fa('0x84')][_0x15fa('0x85')]})['then'](function(_0x1ec76d){if(_0x1ec76d[_0x15fa('0x3f')]===0x1){return _0x1957c1['id'];}else{var _0x198b8a=_['every'](_[_0x15fa('0x37')](_0x1ec76d,_0x15fa('0x86')),function(_0x4cf1cb){return _[_0x15fa('0x87')](_0x52e0da,_0x4cf1cb);});if(_0x198b8a){return _0x1957c1['id'];}}}));}}return BPromise['all'](_0x26f435)[_0x15fa('0x2a')](function(_0x29faef){_0x3bb40e=_(_0x3bb40e)[_0x15fa('0x88')](_0x29faef)[_0x15fa('0x89')]()[_0x15fa('0x8a')]();return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x12d460['params']['id']}})['then'](function(_0x331304){return db[_0x15fa('0x72')][_0x15fa('0x73')](function(_0x41e53c){return _0x331304[_0x15fa('0x78')](_0x12d460[_0x15fa('0x38')][_0x15fa('0x6c')],{'transaction':_0x41e53c})[_0x15fa('0x2a')](function(){if(!_[_0x15fa('0x8b')](_0x3bb40e)){return _0x331304[_0x15fa('0x8c')](_0x3bb40e,{'transaction':_0x41e53c});}})[_0x15fa('0x2a')](function(){_0x3bb40e[_0x15fa('0x76')](function(_0x11c753){socket[_0x15fa('0x8d')](_0x15fa('0x8e'),{'UserId':_0x11c753,'MailQueueId':_0x331304['id']});});});});});});})[_0x15fa('0x2a')](respondWithStatusCode(_0x2a44dd,null))[_0x15fa('0x51')](handleError(_0x2a44dd,null));};exports['addAgents']=function(_0x50e551,_0x5556b7,_0x11bb84){return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x50e551['params']['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x5556b7,null))[_0x15fa('0x2a')](function(_0xba9a18){if(_0xba9a18){return _0xba9a18[_0x15fa('0x8f')](_0x50e551[_0x15fa('0x53')][_0x15fa('0x6c')],_['omit'](_0x50e551['body'],[_0x15fa('0x6c'),'id'])||{})[_0x15fa('0x90')](function(_0x1f7a81){for(var _0x58f94f=0x0;_0x58f94f<_0x50e551[_0x15fa('0x53')]['ids'][_0x15fa('0x3f')];_0x58f94f+=0x1){socket[_0x15fa('0x8d')](_0x15fa('0x77'),{'UserId':Number(_0x50e551[_0x15fa('0x53')][_0x15fa('0x6c')][_0x58f94f]),'MailQueueId':Number(_0x50e551[_0x15fa('0x4f')]['id'])});}return _0x1f7a81;});}})['then'](respondWithResult(_0x5556b7,null))[_0x15fa('0x51')](handleError(_0x5556b7,null));};exports[_0x15fa('0x8c')]=function(_0x499c22,_0x2f26d2,_0x4c646b){return db[_0x15fa('0x32')][_0x15fa('0x59')]({'where':{'id':_0x499c22[_0x15fa('0x4f')]['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x2f26d2,null))[_0x15fa('0x2a')](function(_0x266255){if(_0x266255){return _0x266255[_0x15fa('0x8c')](_0x499c22[_0x15fa('0x38')][_0x15fa('0x6c')])[_0x15fa('0x2a')](function(){if(_[_0x15fa('0x91')](_0x499c22[_0x15fa('0x38')][_0x15fa('0x6c')])){for(var _0x4fab7f=0x0;_0x4fab7f<_0x499c22[_0x15fa('0x38')]['ids']['length'];_0x4fab7f+=0x1){socket[_0x15fa('0x8d')]('userMailQueue:remove',{'UserId':Number(_0x499c22[_0x15fa('0x38')][_0x15fa('0x6c')][_0x4fab7f]),'MailQueueId':Number(_0x499c22[_0x15fa('0x4f')]['id'])});}}else{socket[_0x15fa('0x8d')](_0x15fa('0x8e'),{'UserId':Number(_0x499c22[_0x15fa('0x38')][_0x15fa('0x6c')]),'MailQueueId':Number(_0x499c22[_0x15fa('0x4f')]['id'])});}});}})[_0x15fa('0x2a')](respondWithStatusCode(_0x2f26d2,null))[_0x15fa('0x51')](handleError(_0x2f26d2,null));};exports[_0x15fa('0x92')]=function(_0x5c5ee0,_0x2a4988,_0x349617){var _0x278fd8={};var _0x2beb9a={};var _0x366033;var _0x261133;return db[_0x15fa('0x32')][_0x15fa('0x5e')]({'where':{'id':_0x5c5ee0[_0x15fa('0x4f')]['id']}})[_0x15fa('0x2a')](handleEntityNotFound(_0x2a4988,null))[_0x15fa('0x2a')](function(_0x1e937e){if(_0x1e937e){_0x366033=_0x1e937e;_0x2beb9a[_0x15fa('0x3b')]=_[_0x15fa('0x39')](db['User']['rawAttributes']);_0x2beb9a[_0x15fa('0x38')]=_[_0x15fa('0x39')](_0x5c5ee0[_0x15fa('0x38')]);_0x2beb9a['filters']=_[_0x15fa('0x3d')](_0x2beb9a[_0x15fa('0x3b')],_0x2beb9a['query']);_0x278fd8[_0x15fa('0x3c')]=_[_0x15fa('0x3d')](_0x2beb9a[_0x15fa('0x3b')],qs[_0x15fa('0x3e')](_0x5c5ee0[_0x15fa('0x38')][_0x15fa('0x3e')]));_0x278fd8[_0x15fa('0x3c')]=_0x278fd8['attributes'][_0x15fa('0x3f')]?_0x278fd8[_0x15fa('0x3c')]:_0x2beb9a[_0x15fa('0x3b')];_0x278fd8[_0x15fa('0x43')]=qs['sort'](_0x5c5ee0[_0x15fa('0x38')][_0x15fa('0x44')]);_0x278fd8['where']=qs[_0x15fa('0x3a')](_[_0x15fa('0x46')](_0x5c5ee0[_0x15fa('0x38')],_0x2beb9a[_0x15fa('0x3a')]));if(_0x5c5ee0[_0x15fa('0x38')][_0x15fa('0x47')]){_0x278fd8[_0x15fa('0x45')]=_[_0x15fa('0x48')](_0x278fd8[_0x15fa('0x45')],{'$or':_[_0x15fa('0x37')](_0x278fd8[_0x15fa('0x3c')],function(_0x3a37cf){var _0x4c3a5f={};_0x4c3a5f[_0x3a37cf]={'$like':'%'+_0x5c5ee0[_0x15fa('0x38')][_0x15fa('0x47')]+'%'};return _0x4c3a5f;})});}_0x278fd8=_[_0x15fa('0x48')]({},_0x278fd8,_0x5c5ee0[_0x15fa('0x50')]);return _0x366033[_0x15fa('0x92')](_0x278fd8);}})[_0x15fa('0x2a')](function(_0x43e543){if(_0x43e543){_0x261133=_0x43e543[_0x15fa('0x3f')];if(!_0x5c5ee0['query'][_0x15fa('0x40')]('nolimit')){_0x278fd8['limit']=qs['limit'](_0x5c5ee0['query'][_0x15fa('0x42')]);_0x278fd8[_0x15fa('0x22')]=qs['offset'](_0x5c5ee0[_0x15fa('0x38')]['offset']);}return _0x366033[_0x15fa('0x92')](_0x278fd8);}})[_0x15fa('0x2a')](function(_0x2476df){if(_0x2476df){return _0x2476df?{'count':_0x261133,'rows':_0x2476df}:null;}})['then'](respondWithResult(_0x2a4988,null))[_0x15fa('0x51')](handleError(_0x2a4988,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ba5b0bc..f8d1498 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 _0x2aab=['emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x5d9bd4,_0x5bc10f){var _0x7b8110=function(_0x52ee13){while(--_0x52ee13){_0x5d9bd4['push'](_0x5d9bd4['shift']());}};_0x7b8110(++_0x5bc10f);}(_0x2aab,0xdb));var _0xb2aa=function(_0x5bf6d3,_0x430325){_0x5bf6d3=_0x5bf6d3-0x0;var _0x19ac1c=_0x2aab[_0x5bf6d3];return _0x19ac1c;};'use strict';var EventEmitter=require(_0xb2aa('0x0'));var MailQueue=require(_0xb2aa('0x1'))['db'][_0xb2aa('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb2aa('0x3')](0x0);var events={'afterCreate':_0xb2aa('0x4'),'afterUpdate':'update','afterDestroy':_0xb2aa('0x5')};function emitEvent(_0x1f94cd){return function(_0x13a57d,_0x5575ab,_0x158381){MailQueueEvents[_0xb2aa('0x6')](_0x1f94cd+':'+_0x13a57d['id'],_0x13a57d);MailQueueEvents[_0xb2aa('0x6')](_0x1f94cd,_0x13a57d);_0x158381(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xb2aa('0x7')](e,emitEvent(event));}}module[_0xb2aa('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x415f=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x1ab459,_0x4b2402){var _0x4df14c=function(_0x671b81){while(--_0x671b81){_0x1ab459['push'](_0x1ab459['shift']());}};_0x4df14c(++_0x4b2402);}(_0x415f,0x99));var _0xf415=function(_0x1a1e45,_0x5a7504){_0x1a1e45=_0x1a1e45-0x0;var _0x4270d0=_0x415f[_0x1a1e45];return _0x4270d0;};'use strict';var EventEmitter=require(_0xf415('0x0'));var MailQueue=require(_0xf415('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf415('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf415('0x3')};function emitEvent(_0x1cfb1a){return function(_0x1d8267,_0x4c579e,_0x468118){MailQueueEvents[_0xf415('0x4')](_0x1cfb1a+':'+_0x1d8267['id'],_0x1d8267);MailQueueEvents[_0xf415('0x4')](_0x1cfb1a,_0x1d8267);_0x468118(null);};}for(var e in events){if(events[_0xf415('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf415('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 a55bfbf..8f096dd 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 _0xa2d8=['request-promise','path','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa2d8,0x1eb));var _0x8a2d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa2d8[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x8a2d('0x0'));var util=require(_0x8a2d('0x1'));var logger=require(_0x8a2d('0x2'))(_0x8a2d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a2d('0x4'));var fs=require('fs');var path=require(_0x8a2d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a2d('0x6'));module[_0x8a2d('0x7')]=function(_0x8e335e,_0x57ebcd){return _0x8e335e[_0x8a2d('0x8')](_0x8a2d('0x9'),attributes,{'tableName':_0x8a2d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc560=['bluebird','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0xeb10d1,_0x2a981f){var _0x17cd8f=function(_0xee6f74){while(--_0xee6f74){_0xeb10d1['push'](_0xeb10d1['shift']());}};_0x17cd8f(++_0x2a981f);}(_0xc560,0xe4));var _0x0c56=function(_0x406cc0,_0x224994){_0x406cc0=_0x406cc0-0x0;var _0x3e8aaf=_0xc560[_0x406cc0];return _0x3e8aaf;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var logger=require(_0x0c56('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c56('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c56('0x3'));var rimraf=require(_0x0c56('0x4'));var config=require(_0x0c56('0x5'));var attributes=require('./mailQueue.attributes');module[_0x0c56('0x6')]=function(_0x39a640,_0x49c312){return _0x39a640[_0x0c56('0x7')](_0x0c56('0x8'),attributes,{'tableName':_0x0c56('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 d848bae..0d312b8 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 _0xa68b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','include','map','model','attributes','info','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x495281,_0x393e09){var _0x7d8871=function(_0x182323){while(--_0x182323){_0x495281['push'](_0x495281['shift']());}};_0x7d8871(++_0x393e09);}(_0xa68b,0xf6));var _0xba68=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xa68b[_0x2f57b2];return _0x5ace77;};'use strict';var _=require('lodash');var util=require(_0xba68('0x0'));var moment=require(_0xba68('0x1'));var BPromise=require(_0xba68('0x2'));var rs=require(_0xba68('0x3'));var fs=require('fs');var Redis=require(_0xba68('0x4'));var db=require(_0xba68('0x5'))['db'];var utils=require(_0xba68('0x6'));var logger=require('../../config/logger')(_0xba68('0x7'));var config=require(_0xba68('0x8'));var jayson=require(_0xba68('0x9'));var client=jayson[_0xba68('0xa')][_0xba68('0xb')]({'port':0x232a});config[_0xba68('0xc')]=_[_0xba68('0xd')](config[_0xba68('0xc')],{'host':_0xba68('0xe'),'port':0x18eb});var socket=require(_0xba68('0xf'))(new Redis(config[_0xba68('0xc')]));require(_0xba68('0x10'))[_0xba68('0x11')](socket);function respondWithRpcPromise(_0x14a2b7,_0xfbd1af,_0x11227e){return new BPromise(function(_0x5387f9,_0x3d6170){return client['request'](_0x14a2b7,_0x11227e)[_0xba68('0x12')](function(_0x4edbe7){logger['info'](_0xba68('0x13'),_0xfbd1af,_0xba68('0x14'));logger[_0xba68('0x15')](_0xba68('0x16'),_0xfbd1af,'request\x20sent',JSON[_0xba68('0x17')](_0x4edbe7));if(_0x4edbe7[_0xba68('0x18')]){if(_0x4edbe7['error'][_0xba68('0x19')]===0x1f4){logger[_0xba68('0x18')](_0xba68('0x13'),_0xfbd1af,_0x4edbe7['error']['message']);return _0x3d6170(_0x4edbe7[_0xba68('0x18')][_0xba68('0x1a')]);}logger[_0xba68('0x18')](_0xba68('0x13'),_0xfbd1af,_0x4edbe7[_0xba68('0x18')][_0xba68('0x1a')]);return _0x5387f9(_0x4edbe7[_0xba68('0x18')][_0xba68('0x1a')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0xfbd1af,_0xba68('0x14'));_0x5387f9(_0x4edbe7[_0xba68('0x1b')][_0xba68('0x1a')]);}})[_0xba68('0x1c')](function(_0x475256){logger['error'](_0xba68('0x13'),_0xfbd1af,_0x475256);_0x3d6170(_0x475256);});});}exports[_0xba68('0x1d')]=function(_0x3368ab){var _0x1c5459=this;return new Promise(function(_0x74ce44,_0x1168da){return db[_0xba68('0x1e')]['findAll']({'raw':_0x3368ab[_0xba68('0x1f')]?_0x3368ab['options'][_0xba68('0x20')]===undefined?!![]:![]:!![],'where':_0x3368ab['options']?_0x3368ab[_0xba68('0x1f')][_0xba68('0x21')]||null:null,'attributes':_0x3368ab[_0xba68('0x1f')]?_0x3368ab[_0xba68('0x1f')]['attributes']||null:null,'limit':_0x3368ab[_0xba68('0x1f')]?_0x3368ab[_0xba68('0x1f')][_0xba68('0x22')]||null:null,'include':_0x3368ab['options']?_0x3368ab[_0xba68('0x1f')][_0xba68('0x23')]?_['map'](_0x3368ab[_0xba68('0x1f')][_0xba68('0x23')],function(_0x33f688){return{'model':db[_0x33f688['model']],'as':_0x33f688['as'],'attributes':_0x33f688['attributes'],'include':_0x33f688['include']?_[_0xba68('0x24')](_0x33f688[_0xba68('0x23')],function(_0xc957e4){return{'model':db[_0xc957e4[_0xba68('0x25')]],'as':_0xc957e4['as'],'attributes':_0xc957e4[_0xba68('0x26')],'include':_0xc957e4[_0xba68('0x23')]?_[_0xba68('0x24')](_0xc957e4[_0xba68('0x23')],function(_0x4916b2){return{'model':db[_0x4916b2[_0xba68('0x25')]],'as':_0x4916b2['as'],'attributes':_0x4916b2[_0xba68('0x26')]};}):[]};}):[]};}):[]:[]})[_0xba68('0x12')](function(_0x2c60be){logger[_0xba68('0x27')](_0xba68('0x1d'),_0x3368ab);logger[_0xba68('0x15')](_0xba68('0x1d'),_0x3368ab,JSON[_0xba68('0x17')](_0x2c60be));_0x74ce44(_0x2c60be);})[_0xba68('0x1c')](function(_0x5dd522){logger[_0xba68('0x18')]('GetMailQueue',_0x5dd522[_0xba68('0x1a')],_0x3368ab);_0x1168da(_0x1c5459[_0xba68('0x18')](0x1f4,_0x5dd522[_0xba68('0x1a')]));});});};exports[_0xba68('0x28')]=function(_0x3345be){var _0x380c29=this;return new Promise(function(_0x223fd4,_0x2be214){return db[_0xba68('0x1e')][_0xba68('0x29')]({'raw':_0x3345be['options']?_0x3345be[_0xba68('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3345be[_0xba68('0x1f')]?_0x3345be[_0xba68('0x1f')][_0xba68('0x21')]||null:null,'attributes':_0x3345be[_0xba68('0x1f')]?_0x3345be[_0xba68('0x1f')][_0xba68('0x26')]||null:null,'include':_0x3345be['options']?_0x3345be[_0xba68('0x1f')][_0xba68('0x23')]?_[_0xba68('0x24')](_0x3345be[_0xba68('0x1f')][_0xba68('0x23')],function(_0x508ba4){return{'model':db[_0x508ba4[_0xba68('0x25')]],'as':_0x508ba4['as'],'attributes':_0x508ba4[_0xba68('0x26')],'include':_0x508ba4[_0xba68('0x23')]?_['map'](_0x508ba4['include'],function(_0x134ca7){return{'model':db[_0x134ca7[_0xba68('0x25')]],'as':_0x134ca7['as'],'attributes':_0x134ca7[_0xba68('0x26')],'include':_0x134ca7[_0xba68('0x23')]?_[_0xba68('0x24')](_0x134ca7[_0xba68('0x23')],function(_0x123c3f){return{'model':db[_0x123c3f[_0xba68('0x25')]],'as':_0x123c3f['as'],'attributes':_0x123c3f[_0xba68('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d34f9){logger[_0xba68('0x27')](_0xba68('0x28'),_0x3345be);logger[_0xba68('0x15')]('ShowMailQueue',_0x3345be,JSON[_0xba68('0x17')](_0x3d34f9));_0x223fd4(_0x3d34f9);})[_0xba68('0x1c')](function(_0x521bb4){logger[_0xba68('0x18')](_0xba68('0x28'),_0x521bb4[_0xba68('0x1a')],_0x3345be);_0x2be214(_0x380c29[_0xba68('0x18')](0x1f4,_0x521bb4[_0xba68('0x1a')]));});});}; \ No newline at end of file +var _0x9bb4=['result','GetMailQueue','MailQueue','options','where','include','model','attributes','map','then','catch','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x9bb4,0xd5));var _0x49bb=function(_0x14544f,_0x47b658){_0x14544f=_0x14544f-0x0;var _0x25a237=_0x9bb4[_0x14544f];return _0x25a237;};'use strict';var _=require(_0x49bb('0x0'));var util=require(_0x49bb('0x1'));var moment=require(_0x49bb('0x2'));var BPromise=require(_0x49bb('0x3'));var rs=require(_0x49bb('0x4'));var fs=require('fs');var Redis=require(_0x49bb('0x5'));var db=require(_0x49bb('0x6'))['db'];var utils=require(_0x49bb('0x7'));var logger=require(_0x49bb('0x8'))('rpc');var config=require(_0x49bb('0x9'));var jayson=require(_0x49bb('0xa'));var client=jayson[_0x49bb('0xb')][_0x49bb('0xc')]({'port':0x232a});config['redis']=_[_0x49bb('0xd')](config[_0x49bb('0xe')],{'host':_0x49bb('0xf'),'port':0x18eb});var socket=require(_0x49bb('0x10'))(new Redis(config[_0x49bb('0xe')]));require('./mailQueue.socket')[_0x49bb('0x11')](socket);function respondWithRpcPromise(_0x4d6ec7,_0x245b5e,_0x1708d4){return new BPromise(function(_0x561e59,_0x2de0ba){return client['request'](_0x4d6ec7,_0x1708d4)['then'](function(_0x50ad46){logger['info'](_0x49bb('0x12'),_0x245b5e,_0x49bb('0x13'));logger[_0x49bb('0x14')](_0x49bb('0x15'),_0x245b5e,_0x49bb('0x13'),JSON[_0x49bb('0x16')](_0x50ad46));if(_0x50ad46[_0x49bb('0x17')]){if(_0x50ad46[_0x49bb('0x17')][_0x49bb('0x18')]===0x1f4){logger['error'](_0x49bb('0x12'),_0x245b5e,_0x50ad46['error'][_0x49bb('0x19')]);return _0x2de0ba(_0x50ad46[_0x49bb('0x17')][_0x49bb('0x19')]);}logger[_0x49bb('0x17')](_0x49bb('0x12'),_0x245b5e,_0x50ad46[_0x49bb('0x17')][_0x49bb('0x19')]);return _0x561e59(_0x50ad46[_0x49bb('0x17')]['message']);}else{logger[_0x49bb('0x1a')](_0x49bb('0x12'),_0x245b5e,'request\x20sent');_0x561e59(_0x50ad46[_0x49bb('0x1b')][_0x49bb('0x19')]);}})['catch'](function(_0x381eed){logger[_0x49bb('0x17')]('MailQueue,\x20%s,\x20%s',_0x245b5e,_0x381eed);_0x2de0ba(_0x381eed);});});}exports[_0x49bb('0x1c')]=function(_0x8ea413){var _0x586085=this;return new Promise(function(_0xc1d3bb,_0x5387ed){return db[_0x49bb('0x1d')]['findAll']({'raw':_0x8ea413['options']?_0x8ea413[_0x49bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x8ea413['options']?_0x8ea413[_0x49bb('0x1e')][_0x49bb('0x1f')]||null:null,'attributes':_0x8ea413[_0x49bb('0x1e')]?_0x8ea413[_0x49bb('0x1e')]['attributes']||null:null,'limit':_0x8ea413['options']?_0x8ea413['options']['limit']||null:null,'include':_0x8ea413['options']?_0x8ea413[_0x49bb('0x1e')]['include']?_['map'](_0x8ea413[_0x49bb('0x1e')][_0x49bb('0x20')],function(_0x341bd9){return{'model':db[_0x341bd9[_0x49bb('0x21')]],'as':_0x341bd9['as'],'attributes':_0x341bd9[_0x49bb('0x22')],'include':_0x341bd9['include']?_[_0x49bb('0x23')](_0x341bd9[_0x49bb('0x20')],function(_0x1a6afb){return{'model':db[_0x1a6afb[_0x49bb('0x21')]],'as':_0x1a6afb['as'],'attributes':_0x1a6afb['attributes'],'include':_0x1a6afb[_0x49bb('0x20')]?_[_0x49bb('0x23')](_0x1a6afb[_0x49bb('0x20')],function(_0x47540c){return{'model':db[_0x47540c['model']],'as':_0x47540c['as'],'attributes':_0x47540c[_0x49bb('0x22')]};}):[]};}):[]};}):[]:[]})[_0x49bb('0x24')](function(_0x3ab8a8){logger[_0x49bb('0x1a')]('GetMailQueue',_0x8ea413);logger[_0x49bb('0x14')](_0x49bb('0x1c'),_0x8ea413,JSON['stringify'](_0x3ab8a8));_0xc1d3bb(_0x3ab8a8);})[_0x49bb('0x25')](function(_0x56b65b){logger[_0x49bb('0x17')](_0x49bb('0x1c'),_0x56b65b['message'],_0x8ea413);_0x5387ed(_0x586085[_0x49bb('0x17')](0x1f4,_0x56b65b[_0x49bb('0x19')]));});});};exports['ShowMailQueue']=function(_0x28629f){var _0x6f2294=this;return new Promise(function(_0x14af93,_0x3993c0){return db[_0x49bb('0x1d')][_0x49bb('0x26')]({'raw':_0x28629f[_0x49bb('0x1e')]?_0x28629f[_0x49bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x28629f[_0x49bb('0x1e')]?_0x28629f[_0x49bb('0x1e')][_0x49bb('0x1f')]||null:null,'attributes':_0x28629f[_0x49bb('0x1e')]?_0x28629f['options'][_0x49bb('0x22')]||null:null,'include':_0x28629f['options']?_0x28629f[_0x49bb('0x1e')]['include']?_[_0x49bb('0x23')](_0x28629f['options'][_0x49bb('0x20')],function(_0x1a24f3){return{'model':db[_0x1a24f3['model']],'as':_0x1a24f3['as'],'attributes':_0x1a24f3['attributes'],'include':_0x1a24f3['include']?_['map'](_0x1a24f3['include'],function(_0x26cc95){return{'model':db[_0x26cc95[_0x49bb('0x21')]],'as':_0x26cc95['as'],'attributes':_0x26cc95[_0x49bb('0x22')],'include':_0x26cc95[_0x49bb('0x20')]?_[_0x49bb('0x23')](_0x26cc95[_0x49bb('0x20')],function(_0x1025c5){return{'model':db[_0x1025c5['model']],'as':_0x1025c5['as'],'attributes':_0x1025c5['attributes']};}):[]};}):[]};}):[]:[]})[_0x49bb('0x24')](function(_0xd98017){logger['info'](_0x49bb('0x27'),_0x28629f);logger[_0x49bb('0x14')]('ShowMailQueue',_0x28629f,JSON['stringify'](_0xd98017));_0x14af93(_0xd98017);})[_0x49bb('0x25')](function(_0x50e7de){logger[_0x49bb('0x17')](_0x49bb('0x27'),_0x50e7de[_0x49bb('0x19')],_0x28629f);_0x3993c0(_0x6f2294[_0x49bb('0x17')](0x1f4,_0x50e7de[_0x49bb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e7da605..367493c 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 _0xcc81=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x5285c3,_0x11be4f){var _0x2af3ff=function(_0x31aeab){while(--_0x31aeab){_0x5285c3['push'](_0x5285c3['shift']());}};_0x2af3ff(++_0x11be4f);}(_0xcc81,0x19c));var _0x1cc8=function(_0x114e6a,_0x3dc9d2){_0x114e6a=_0x114e6a-0x0;var _0x423189=_0xcc81[_0x114e6a];return _0x423189;};'use strict';var MailQueueEvents=require(_0x1cc8('0x0'));var events=['save','remove',_0x1cc8('0x1')];function createListener(_0x4bf57b,_0x2501d6){return function(_0x8e75){_0x2501d6[_0x1cc8('0x2')](_0x4bf57b,_0x8e75);};}function removeListener(_0x1ac092,_0x5c5d11){return function(){MailQueueEvents[_0x1cc8('0x3')](_0x1ac092,_0x5c5d11);};}exports[_0x1cc8('0x4')]=function(_0x577f88){for(var _0x434432=0x0,_0x29e813=events[_0x1cc8('0x5')];_0x434432<_0x29e813;_0x434432++){var _0x3c131a=events[_0x434432];var _0x59db9f=createListener(_0x1cc8('0x6')+_0x3c131a,_0x577f88);MailQueueEvents['on'](_0x3c131a,_0x59db9f);}}; \ No newline at end of file +var _0xf12a=['length','mailQueue:','./mailQueue.events','save','remove','update','register'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xf12a,0x8e));var _0xaf12=function(_0x292688,_0x4ed5d4){_0x292688=_0x292688-0x0;var _0x12f117=_0xf12a[_0x292688];return _0x12f117;};'use strict';var MailQueueEvents=require(_0xaf12('0x0'));var events=[_0xaf12('0x1'),_0xaf12('0x2'),_0xaf12('0x3')];function createListener(_0x38e2c1,_0x205455){return function(_0x193278){_0x205455['emit'](_0x38e2c1,_0x193278);};}function removeListener(_0x5b7b5b,_0x1b1d82){return function(){MailQueueEvents['removeListener'](_0x5b7b5b,_0x1b1d82);};}exports[_0xaf12('0x4')]=function(_0x581be3){for(var _0x17c0c8=0x0,_0x581819=events[_0xaf12('0x5')];_0x17c0c8<_0x581819;_0x17c0c8++){var _0x418c64=events[_0x17c0c8];var _0x3b6626=createListener(_0xaf12('0x6')+_0x418c64,_0x581be3);MailQueueEvents['on'](_0x418c64,_0x3b6626);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d3a1a1f..7c24486 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 _0x03ef=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','delete','exports','util','path','connect-timeout'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x03ef,0x17d));var _0xf03e=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x03ef[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require(_0xf03e('0x0'));var path=require(_0xf03e('0x1'));var timeout=require(_0xf03e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf03e('0x3'));var auth=require(_0xf03e('0x4'));var interaction=require(_0xf03e('0x5'));var config=require('../../config/environment');var controller=require(_0xf03e('0x6'));router[_0xf03e('0x7')]('/',auth[_0xf03e('0x8')](),controller['index']);router[_0xf03e('0x7')](_0xf03e('0x9'),auth[_0xf03e('0x8')](),controller['describe']);router[_0xf03e('0x7')](_0xf03e('0xa'),auth['isAuthenticated'](),controller[_0xf03e('0xb')]);router[_0xf03e('0xc')]('/',auth[_0xf03e('0x8')](),controller['create']);router[_0xf03e('0xd')](_0xf03e('0xa'),auth[_0xf03e('0x8')](),controller['update']);router[_0xf03e('0xe')](_0xf03e('0xa'),auth[_0xf03e('0x8')](),controller['destroy']);module[_0xf03e('0xf')]=router; \ No newline at end of file +var _0xeff2=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x31be8f,_0x27f909){var _0x248860=function(_0x4de002){while(--_0x4de002){_0x31be8f['push'](_0x31be8f['shift']());}};_0x248860(++_0x27f909);}(_0xeff2,0x1a0));var _0x2eff=function(_0x450907,_0x446cb9){_0x450907=_0x450907-0x0;var _0x1242a5=_0xeff2[_0x450907];return _0x1242a5;};'use strict';var multer=require(_0x2eff('0x0'));var util=require(_0x2eff('0x1'));var path=require(_0x2eff('0x2'));var timeout=require(_0x2eff('0x3'));var express=require(_0x2eff('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2eff('0x5'));var interaction=require(_0x2eff('0x6'));var config=require(_0x2eff('0x7'));var controller=require(_0x2eff('0x8'));router[_0x2eff('0x9')]('/',auth[_0x2eff('0xa')](),controller[_0x2eff('0xb')]);router['get'](_0x2eff('0xc'),auth[_0x2eff('0xa')](),controller[_0x2eff('0xd')]);router[_0x2eff('0x9')](_0x2eff('0xe'),auth['isAuthenticated'](),controller[_0x2eff('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2eff('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2eff('0x11')](_0x2eff('0xe'),auth['isAuthenticated'](),controller[_0x2eff('0x12')]);module[_0x2eff('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 81ea271..64dd64c 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 _0x303f=['DATE','moment','STRING'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x303f,0xbe));var _0xf303=function(_0x1c3cd1,_0x2c4c7a){_0x1c3cd1=_0x1c3cd1-0x0;var _0x14580e=_0x303f[_0x1c3cd1];return _0x14580e;};'use strict';var moment=require(_0xf303('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf303('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xf303('0x1')]},'joinAt':{'type':Sequelize[_0xf303('0x2')]},'leaveAt':{'type':Sequelize[_0xf303('0x2')]},'acceptAt':{'type':Sequelize[_0xf303('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x45fd=['sequelize','exports','STRING','DATE'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x45fd,0xa4));var _0xd45f=function(_0x4ae524,_0x5b869d){_0x4ae524=_0x4ae524-0x0;var _0x54ebd3=_0x45fd[_0x4ae524];return _0x54ebd3;};'use strict';var moment=require('moment');var Sequelize=require(_0xd45f('0x0'));module[_0xd45f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd45f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd45f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd45f('0x3')]},'reason':{'type':Sequelize[_0xd45f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0bbcb1d..49adf6b 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 _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','MailQueueReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2e9748,_0x2c1271){_0x2e9748=_0x2e9748-0x0;var _0x142522=_0xc6ac[_0x2e9748];return _0x142522;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','MailQueueReport','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x6343,0x168));var _0x3634=function(_0x1b69e7,_0x69f428){_0x1b69e7=_0x1b69e7-0x0;var _0x263ee3=_0x6343[_0x1b69e7];return _0x263ee3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['MailQueueReport'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':!![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['MailQueueReport'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1314fe0..9300dd0 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 _0xde69=['report_mail_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x32a2ff,_0x137529){var _0x1a3610=function(_0x9966b8){while(--_0x9966b8){_0x32a2ff['push'](_0x32a2ff['shift']());}};_0x1a3610(++_0x137529);}(_0xde69,0x187));var _0x9de6=function(_0x34651f,_0x1b07dd){_0x34651f=_0x34651f-0x0;var _0x2d88fe=_0xde69[_0x34651f];return _0x2d88fe;};'use strict';var _=require(_0x9de6('0x0'));var util=require('util');var logger=require(_0x9de6('0x1'))(_0x9de6('0x2'));var moment=require(_0x9de6('0x3'));var BPromise=require(_0x9de6('0x4'));var rp=require(_0x9de6('0x5'));var fs=require('fs');var path=require(_0x9de6('0x6'));var rimraf=require(_0x9de6('0x7'));var config=require('../../config/environment');var attributes=require(_0x9de6('0x8'));module[_0x9de6('0x9')]=function(_0xeebbd8,_0x9c5570){return _0xeebbd8[_0x9de6('0xa')](_0x9de6('0xb'),attributes,{'tableName':_0x9de6('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f94=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x7f94,0x65));var _0x47f9=function(_0x4828a1,_0xa71f0c){_0x4828a1=_0x4828a1-0x0;var _0x9e2ffd=_0x7f94[_0x4828a1];return _0x9e2ffd;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var logger=require(_0x47f9('0x1'))(_0x47f9('0x2'));var moment=require(_0x47f9('0x3'));var BPromise=require(_0x47f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47f9('0x5'));var rimraf=require(_0x47f9('0x6'));var config=require(_0x47f9('0x7'));var attributes=require(_0x47f9('0x8'));module[_0x47f9('0x9')]=function(_0xfba0ba,_0x386d8f){return _0xfba0ba['define'](_0x47f9('0xa'),attributes,{'tableName':_0x47f9('0xb'),'paranoid':![],'indexes':[{'name':_0x47f9('0xc'),'fields':[_0x47f9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a50a5ea..5c44b4f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1bcb9d,_0x196e3d){var _0x5651f2=function(_0x3e8151){while(--_0x3e8151){_0x1bcb9d['push'](_0x1bcb9d['shift']());}};_0x5651f2(++_0x196e3d);}(_0x2ef3,0xba));var _0x32ef=function(_0x310f45,_0x5cd5e0){_0x310f45=_0x310f45-0x0;var _0x302564=_0x2ef3[_0x310f45];return _0x302564;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x8a092,_0x175c11){var _0x39bbec=function(_0x4b13c8){while(--_0x4b13c8){_0x8a092['push'](_0x8a092['shift']());}};_0x39bbec(++_0x175c11);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 697d43d..cbf6122 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(_0x1b0104,_0x16b5f2){var _0x49d2cb=function(_0xe27325){while(--_0xe27325){_0x1b0104['push'](_0x1b0104['shift']());}};_0x49d2cb(++_0x16b5f2);}(_0x70e0,0x17b));var _0x070e=function(_0x2fb81b,_0x1e1d74){_0x2fb81b=_0x2fb81b-0x0;var _0x494bb9=_0x70e0[_0x2fb81b];return _0x494bb9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3f761d,_0x5d907d){var _0x49d6e3=function(_0x39ab43){while(--_0x39ab43){_0x3f761d['push'](_0x3f761d['shift']());}};_0x49d6e3(++_0x5d907d);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d153086..8a30aa1 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 _0xaa88=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x66c485,_0x45af89){var _0x33369a=function(_0xad56b6){while(--_0xad56b6){_0x66c485['push'](_0x66c485['shift']());}};_0x33369a(++_0x45af89);}(_0xaa88,0x137));var _0x8aa8=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0xaa88[_0x320b8e];return _0x55a10a;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize[_0x8aa8('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x8aa8('0x2')]},'password':{'type':Sequelize[_0x8aa8('0x2')]},'port':{'type':Sequelize[_0x8aa8('0x3')]},'tls':{'type':Sequelize[_0x8aa8('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8aa8('0x2')],'defaultValue':_0x8aa8('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file +var _0xab40=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4e11fb,_0x4cd66c){var _0x6a4a3d=function(_0x58d9d2){while(--_0x58d9d2){_0x4e11fb['push'](_0x4e11fb['shift']());}};_0x6a4a3d(++_0x4cd66c);}(_0xab40,0xcd));var _0x0ab4=function(_0x146910,_0x2552da){_0x146910=_0x146910-0x0;var _0x44a6c8=_0xab40[_0x146910];return _0x44a6c8;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x0ab4('0x2')]},'password':{'type':Sequelize[_0x0ab4('0x2')]},'port':{'type':Sequelize[_0x0ab4('0x3')]},'tls':{'type':Sequelize[_0x0ab4('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0ab4('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0ab4('0x3')],'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 1235cec..7e74e89 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 _0x669a=['bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','../../config/logger','api'];(function(_0x579f64,_0x2b24ad){var _0x3db2f3=function(_0x1f4cc9){while(--_0x1f4cc9){_0x579f64['push'](_0x579f64['shift']());}};_0x3db2f3(++_0x2b24ad);}(_0x669a,0x1b5));var _0xa669=function(_0x4900f5,_0xa20189){_0x4900f5=_0x4900f5-0x0;var _0x2b2d67=_0x669a[_0x4900f5];return _0x2b2d67;};'use strict';var _=require(_0xa669('0x0'));var util=require('util');var logger=require(_0xa669('0x1'))(_0xa669('0x2'));var moment=require('moment');var BPromise=require(_0xa669('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa669('0x4'));var rimraf=require(_0xa669('0x5'));var config=require(_0xa669('0x6'));var attributes=require(_0xa669('0x7'));module['exports']=function(_0x518ee5,_0x300dcb){return _0x518ee5['define'](_0xa669('0x8'),attributes,{'tableName':_0xa669('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d80=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','moment'];(function(_0x401900,_0x504206){var _0x241cfb=function(_0x4dc931){while(--_0x4dc931){_0x401900['push'](_0x401900['shift']());}};_0x241cfb(++_0x504206);}(_0x1d80,0x105));var _0x01d8=function(_0x3d962b,_0x4c7d80){_0x3d962b=_0x3d962b-0x0;var _0x4cdc0e=_0x1d80[_0x3d962b];return _0x4cdc0e;};'use strict';var _=require(_0x01d8('0x0'));var util=require(_0x01d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x01d8('0x2'));var BPromise=require(_0x01d8('0x3'));var rp=require(_0x01d8('0x4'));var fs=require('fs');var path=require(_0x01d8('0x5'));var rimraf=require(_0x01d8('0x6'));var config=require(_0x01d8('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x01d8('0x8')]=function(_0x3bb03c,_0x25c7c8){return _0x3bb03c[_0x01d8('0x9')](_0x01d8('0xa'),attributes,{'tableName':_0x01d8('0xb'),'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 dc8dd77..a598ea7 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 _0x072f=['attributes','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','findAll','options','raw','limit','map','include'];(function(_0x2b56e0,_0x336aea){var _0x5b1e59=function(_0x14ed52){while(--_0x14ed52){_0x2b56e0['push'](_0x2b56e0['shift']());}};_0x5b1e59(++_0x336aea);}(_0x072f,0x1a7));var _0xf072=function(_0x110949,_0xb15ab0){_0x110949=_0x110949-0x0;var _0x217aca=_0x072f[_0x110949];return _0x217aca;};'use strict';var _=require('lodash');var util=require(_0xf072('0x0'));var moment=require(_0xf072('0x1'));var BPromise=require(_0xf072('0x2'));var rs=require(_0xf072('0x3'));var fs=require('fs');var Redis=require(_0xf072('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf072('0x5'))(_0xf072('0x6'));var config=require(_0xf072('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf072('0x8')][_0xf072('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9dd048,_0x3df633,_0x2bca9c){return new BPromise(function(_0x40ebb9,_0xc8a75e){return client['request'](_0x9dd048,_0x2bca9c)[_0xf072('0xa')](function(_0x28fafb){logger[_0xf072('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3df633,_0xf072('0xc'));logger['debug'](_0xf072('0xd'),_0x3df633,_0xf072('0xc'),JSON['stringify'](_0x28fafb));if(_0x28fafb[_0xf072('0xe')]){if(_0x28fafb[_0xf072('0xe')][_0xf072('0xf')]===0x1f4){logger[_0xf072('0xe')]('MailServerIn,\x20%s,\x20%s',_0x3df633,_0x28fafb[_0xf072('0xe')][_0xf072('0x10')]);return _0xc8a75e(_0x28fafb['error'][_0xf072('0x10')]);}logger['error'](_0xf072('0x11'),_0x3df633,_0x28fafb[_0xf072('0xe')]['message']);return _0x40ebb9(_0x28fafb[_0xf072('0xe')]['message']);}else{logger[_0xf072('0xb')](_0xf072('0x11'),_0x3df633,_0xf072('0xc'));_0x40ebb9(_0x28fafb[_0xf072('0x12')][_0xf072('0x10')]);}})[_0xf072('0x13')](function(_0x3a5736){logger['error'](_0xf072('0x11'),_0x3df633,_0x3a5736);_0xc8a75e(_0x3a5736);});});}exports[_0xf072('0x14')]=function(_0x551b68){var _0x1bdac8=this;return new Promise(function(_0x322952,_0x5c7efc){return db['MailServerIn'][_0xf072('0x15')]({'raw':_0x551b68[_0xf072('0x16')]?_0x551b68['options'][_0xf072('0x17')]===undefined?!![]:![]:!![],'where':_0x551b68['options']?_0x551b68[_0xf072('0x16')]['where']||null:null,'attributes':_0x551b68['options']?_0x551b68[_0xf072('0x16')]['attributes']||null:null,'limit':_0x551b68[_0xf072('0x16')]?_0x551b68[_0xf072('0x16')][_0xf072('0x18')]||null:null,'include':_0x551b68[_0xf072('0x16')]?_0x551b68[_0xf072('0x16')]['include']?_[_0xf072('0x19')](_0x551b68[_0xf072('0x16')][_0xf072('0x1a')],function(_0x156d8c){return{'model':db[_0x156d8c['model']],'as':_0x156d8c['as'],'attributes':_0x156d8c['attributes'],'include':_0x156d8c[_0xf072('0x1a')]?_[_0xf072('0x19')](_0x156d8c[_0xf072('0x1a')],function(_0x1ac8ab){return{'model':db[_0x1ac8ab['model']],'as':_0x1ac8ab['as'],'attributes':_0x1ac8ab[_0xf072('0x1b')],'include':_0x1ac8ab[_0xf072('0x1a')]?_[_0xf072('0x19')](_0x1ac8ab[_0xf072('0x1a')],function(_0x124482){return{'model':db[_0x124482['model']],'as':_0x124482['as'],'attributes':_0x124482[_0xf072('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf072('0xa')](function(_0x4f2fde){logger[_0xf072('0xb')]('GetMailServerIn',_0x551b68);logger[_0xf072('0x1c')](_0xf072('0x14'),_0x551b68,JSON[_0xf072('0x1d')](_0x4f2fde));_0x322952(_0x4f2fde);})[_0xf072('0x13')](function(_0x1b24de){logger[_0xf072('0xe')](_0xf072('0x14'),_0x1b24de[_0xf072('0x10')],_0x551b68);_0x5c7efc(_0x1bdac8['error'](0x1f4,_0x1b24de[_0xf072('0x10')]));});});}; \ No newline at end of file +var _0x8d79=['debug','error','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x54d50f,_0x14a8b0){var _0x54245e=function(_0x212efb){while(--_0x212efb){_0x54d50f['push'](_0x54d50f['shift']());}};_0x54245e(++_0x14a8b0);}(_0x8d79,0x10a));var _0x98d7=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x8d79[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x98d7('0x0'));var util=require(_0x98d7('0x1'));var moment=require(_0x98d7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98d7('0x3'));var db=require(_0x98d7('0x4'))['db'];var utils=require(_0x98d7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x98d7('0x6'));var client=jayson[_0x98d7('0x7')][_0x98d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4344,_0x5e041d,_0x448a6d){return new BPromise(function(_0x53faf2,_0x38b639){return client[_0x98d7('0x9')](_0x2d4344,_0x448a6d)[_0x98d7('0xa')](function(_0x37f0de){logger[_0x98d7('0xb')](_0x98d7('0xc'),_0x5e041d,_0x98d7('0xd'));logger[_0x98d7('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5e041d,'request\x20sent',JSON['stringify'](_0x37f0de));if(_0x37f0de[_0x98d7('0xf')]){if(_0x37f0de[_0x98d7('0xf')]['code']===0x1f4){logger['error'](_0x98d7('0xc'),_0x5e041d,_0x37f0de[_0x98d7('0xf')][_0x98d7('0x10')]);return _0x38b639(_0x37f0de[_0x98d7('0xf')][_0x98d7('0x10')]);}logger['error'](_0x98d7('0xc'),_0x5e041d,_0x37f0de['error'][_0x98d7('0x10')]);return _0x53faf2(_0x37f0de['error'][_0x98d7('0x10')]);}else{logger[_0x98d7('0xb')](_0x98d7('0xc'),_0x5e041d,'request\x20sent');_0x53faf2(_0x37f0de['result']['message']);}})[_0x98d7('0x11')](function(_0x26cbae){logger[_0x98d7('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5e041d,_0x26cbae);_0x38b639(_0x26cbae);});});}exports[_0x98d7('0x12')]=function(_0x917429){var _0x4133ce=this;return new Promise(function(_0x4e6997,_0x5114c2){return db[_0x98d7('0x13')]['findAll']({'raw':_0x917429[_0x98d7('0x14')]?_0x917429[_0x98d7('0x14')][_0x98d7('0x15')]===undefined?!![]:![]:!![],'where':_0x917429[_0x98d7('0x14')]?_0x917429[_0x98d7('0x14')][_0x98d7('0x16')]||null:null,'attributes':_0x917429[_0x98d7('0x14')]?_0x917429[_0x98d7('0x14')][_0x98d7('0x17')]||null:null,'limit':_0x917429['options']?_0x917429[_0x98d7('0x14')]['limit']||null:null,'include':_0x917429[_0x98d7('0x14')]?_0x917429[_0x98d7('0x14')]['include']?_[_0x98d7('0x18')](_0x917429[_0x98d7('0x14')][_0x98d7('0x19')],function(_0x342e8f){return{'model':db[_0x342e8f[_0x98d7('0x1a')]],'as':_0x342e8f['as'],'attributes':_0x342e8f[_0x98d7('0x17')],'include':_0x342e8f[_0x98d7('0x19')]?_[_0x98d7('0x18')](_0x342e8f['include'],function(_0x1ba70e){return{'model':db[_0x1ba70e[_0x98d7('0x1a')]],'as':_0x1ba70e['as'],'attributes':_0x1ba70e[_0x98d7('0x17')],'include':_0x1ba70e[_0x98d7('0x19')]?_[_0x98d7('0x18')](_0x1ba70e[_0x98d7('0x19')],function(_0x3810c3){return{'model':db[_0x3810c3[_0x98d7('0x1a')]],'as':_0x3810c3['as'],'attributes':_0x3810c3[_0x98d7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x98d7('0xa')](function(_0xea4f31){logger[_0x98d7('0xb')]('GetMailServerIn',_0x917429);logger['debug'](_0x98d7('0x12'),_0x917429,JSON[_0x98d7('0x1b')](_0xea4f31));_0x4e6997(_0xea4f31);})['catch'](function(_0x12f3d1){logger[_0x98d7('0xf')](_0x98d7('0x12'),_0x12f3d1[_0x98d7('0x10')],_0x917429);_0x5114c2(_0x4133ce[_0x98d7('0xf')](0x1f4,_0x12f3d1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4faecb3..9c1668b 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(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7a54,0x106));var _0x47a5=function(_0x556e9f,_0x56d8f2){_0x556e9f=_0x556e9f-0x0;var _0x54c538=_0x7a54[_0x556e9f];return _0x54c538;};'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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x1e6772,_0x2081c1){_0x1e6772=_0x1e6772-0x0;var _0x3d9bdc=_0x7a54[_0x1e6772];return _0x3d9bdc;};'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 8105982..3607f9d 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 _0x5f3f=['STRING','BOOLEAN'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x5f3f,0x6e));var _0xf5f3=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0x5f3f[_0x40ebc3];return _0x1d8b08;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xf5f3('0x0')]},'host':{'type':Sequelize[_0xf5f3('0x0')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xf5f3('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xf5f3('0x1')],'defaultValue':![]},'service':{'type':Sequelize[_0xf5f3('0x0')]},'authentication':{'type':Sequelize[_0xf5f3('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5344=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x2e2b80,_0x180dff){var _0x40b409=function(_0x81897e){while(--_0x81897e){_0x2e2b80['push'](_0x2e2b80['shift']());}};_0x40b409(++_0x180dff);}(_0x5344,0x1b0));var _0x4534=function(_0x3e91a0,_0x957f02){_0x3e91a0=_0x3e91a0-0x0;var _0x341fed=_0x5344[_0x3e91a0];return _0x341fed;};'use strict';var Sequelize=require(_0x4534('0x0'));module[_0x4534('0x1')]={'description':{'type':Sequelize[_0x4534('0x2')]},'host':{'type':Sequelize[_0x4534('0x2')]},'user':{'type':Sequelize[_0x4534('0x2')]},'pass':{'type':Sequelize[_0x4534('0x2')]},'port':{'type':Sequelize[_0x4534('0x3')]},'secure':{'type':Sequelize[_0x4534('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4534('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 04c1f8e..4a56f3e 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 _0xf0af=['length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','update','then','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0xcca4ed,_0x25f2eb){var _0x5ebea5=function(_0x3ce3a1){while(--_0x3ce3a1){_0xcca4ed['push'](_0xcca4ed['shift']());}};_0x5ebea5(++_0x25f2eb);}(_0xf0af,0x1a6));var _0xff0a=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0xf0af[_0x35bd6c];return _0x2f421d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff0a('0x0'));var zipdir=require(_0xff0a('0x1'));var jsonpatch=require(_0xff0a('0x2'));var rp=require(_0xff0a('0x3'));var moment=require('moment');var BPromise=require(_0xff0a('0x4'));var Mustache=require('mustache');var util=require(_0xff0a('0x5'));var path=require(_0xff0a('0x6'));var sox=require(_0xff0a('0x7'));var csv=require(_0xff0a('0x8'));var ejs=require(_0xff0a('0x9'));var fs=require('fs');var fs_extra=require(_0xff0a('0xa'));var _=require('lodash');var squel=require(_0xff0a('0xb'));var crypto=require(_0xff0a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff0a('0x8'));var querystring=require('querystring');var Papa=require(_0xff0a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff0a('0xe'));var as=require(_0xff0a('0xf'));var hardwareService=require(_0xff0a('0x10'));var logger=require('../../config/logger')(_0xff0a('0x11'));var utils=require(_0xff0a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff0a('0x13'))['db'];function respondWithStatusCode(_0xfb4e4c,_0x44ff7e){_0x44ff7e=_0x44ff7e||0xcc;return function(_0x3083f1){if(_0x3083f1){return _0xfb4e4c[_0xff0a('0x14')](_0x44ff7e);}return _0xfb4e4c[_0xff0a('0x15')](_0x44ff7e)[_0xff0a('0x16')]();};}function respondWithResult(_0x4e61fd,_0x3cf779){_0x3cf779=_0x3cf779||0xc8;return function(_0x54aac5){if(_0x54aac5){return _0x4e61fd[_0xff0a('0x15')](_0x3cf779)[_0xff0a('0x17')](_0x54aac5);}};}function respondWithFilteredResult(_0x38b732,_0x23df4f){return function(_0x405127){if(_0x405127){var _0x3b165e=typeof _0x23df4f[_0xff0a('0x18')]==='undefined'&&typeof _0x23df4f['limit']===_0xff0a('0x19');var _0x55a5e6=_0x405127['count'];var _0x2b3e7a=_0x3b165e?0x0:_0x23df4f[_0xff0a('0x18')];var _0xb84922=_0x3b165e?_0x405127['count']:_0x23df4f[_0xff0a('0x18')]+_0x23df4f[_0xff0a('0x1a')];var _0x1c0aaa;if(_0xb84922>=_0x55a5e6){_0xb84922=_0x55a5e6;_0x1c0aaa=0xc8;}else{_0x1c0aaa=0xce;}_0x38b732['status'](_0x1c0aaa);return _0x38b732['set'](_0xff0a('0x1b'),_0x2b3e7a+'-'+_0xb84922+'/'+_0x55a5e6)[_0xff0a('0x17')](_0x405127);}return null;};}function patchUpdates(_0x19eab0){return function(_0x468775){try{jsonpatch['apply'](_0x468775,_0x19eab0,!![]);}catch(_0x29041b){return BPromise['reject'](_0x29041b);}return _0x468775[_0xff0a('0x1c')]();};}function saveUpdates(_0xafc179,_0x3fbcd1){return function(_0xffe877){if(_0xffe877){return _0xffe877[_0xff0a('0x1d')](_0xafc179)[_0xff0a('0x1e')](function(_0x2dd68e){return _0x2dd68e;});}return null;};}function removeEntity(_0x1997e3,_0xe1ffc8){return function(_0x2cb6eb){if(_0x2cb6eb){return _0x2cb6eb['destroy']()[_0xff0a('0x1e')](function(){_0x1997e3[_0xff0a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549e4b,_0x3cc913){return function(_0x16c102){if(!_0x16c102){_0x549e4b['sendStatus'](0x194);}return _0x16c102;};}function handleError(_0x3d1f2c,_0x2e4b25){_0x2e4b25=_0x2e4b25||0x1f4;return function(_0x5c48ea){logger['error'](_0x5c48ea[_0xff0a('0x1f')]);if(_0x5c48ea[_0xff0a('0x20')]){delete _0x5c48ea[_0xff0a('0x20')];}_0x3d1f2c['status'](_0x2e4b25)[_0xff0a('0x21')](_0x5c48ea);};}exports[_0xff0a('0x22')]=function(_0x4a2dc6,_0x395e26){var _0x5d810e={},_0x2708aa={},_0xc2de1e={'count':0x0,'rows':[]};var _0x43dc5c=_[_0xff0a('0x23')](db[_0xff0a('0x24')][_0xff0a('0x25')],function(_0x379b46){return{'name':_0x379b46[_0xff0a('0x26')],'type':_0x379b46['type'][_0xff0a('0x27')]};});_0x2708aa[_0xff0a('0x28')]=_[_0xff0a('0x23')](_0x43dc5c,_0xff0a('0x20'));_0x2708aa[_0xff0a('0x29')]=_[_0xff0a('0x2a')](_0x4a2dc6[_0xff0a('0x29')]);_0x2708aa[_0xff0a('0x2b')]=_[_0xff0a('0x2c')](_0x2708aa[_0xff0a('0x28')],_0x2708aa['query']);_0x5d810e[_0xff0a('0x2d')]=_['intersection'](_0x2708aa[_0xff0a('0x28')],qs[_0xff0a('0x2e')](_0x4a2dc6['query'][_0xff0a('0x2e')]));_0x5d810e[_0xff0a('0x2d')]=_0x5d810e[_0xff0a('0x2d')][_0xff0a('0x2f')]?_0x5d810e[_0xff0a('0x2d')]:_0x2708aa[_0xff0a('0x28')];if(!_0x4a2dc6[_0xff0a('0x29')][_0xff0a('0x30')]('nolimit')){_0x5d810e['limit']=qs[_0xff0a('0x1a')](_0x4a2dc6['query'][_0xff0a('0x1a')]);_0x5d810e['offset']=qs[_0xff0a('0x18')](_0x4a2dc6['query'][_0xff0a('0x18')]);}_0x5d810e[_0xff0a('0x31')]=qs[_0xff0a('0x32')](_0x4a2dc6[_0xff0a('0x29')]['sort']);_0x5d810e[_0xff0a('0x33')]=qs['filters'](_[_0xff0a('0x34')](_0x4a2dc6[_0xff0a('0x29')],_0x2708aa[_0xff0a('0x2b')]),_0x43dc5c);if(_0x4a2dc6[_0xff0a('0x29')][_0xff0a('0x35')]){_0x5d810e['where']=_[_0xff0a('0x36')](_0x5d810e[_0xff0a('0x33')],{'$or':_[_0xff0a('0x23')](_0x43dc5c,function(_0x3ba6c8){if(_0x3ba6c8['type']!=='VIRTUAL'){var _0x5459a8={};_0x5459a8[_0x3ba6c8[_0xff0a('0x20')]]={'$like':'%'+_0x4a2dc6[_0xff0a('0x29')][_0xff0a('0x35')]+'%'};return _0x5459a8;}})});}_0x5d810e=_['merge']({},_0x5d810e,_0x4a2dc6[_0xff0a('0x37')]);var _0x429590={'where':_0x5d810e['where']};return db[_0xff0a('0x24')][_0xff0a('0x38')](_0x429590)[_0xff0a('0x1e')](function(_0x106a70){_0xc2de1e[_0xff0a('0x38')]=_0x106a70;if(_0x4a2dc6['query'][_0xff0a('0x39')]){_0x5d810e[_0xff0a('0x3a')]=[{'all':!![]}];}return db[_0xff0a('0x24')][_0xff0a('0x3b')](_0x5d810e);})['then'](function(_0x7c0ac4){_0xc2de1e['rows']=_0x7c0ac4;return _0xc2de1e;})[_0xff0a('0x1e')](respondWithFilteredResult(_0x395e26,_0x5d810e))[_0xff0a('0x3c')](handleError(_0x395e26,null));};exports[_0xff0a('0x3d')]=function(_0x3afcc4,_0x350b95){var _0x18b7e6={'raw':!![],'where':{'id':_0x3afcc4[_0xff0a('0x3e')]['id']}},_0x6bc9d8={};_0x6bc9d8[_0xff0a('0x28')]=_[_0xff0a('0x2a')](db[_0xff0a('0x24')][_0xff0a('0x25')]);_0x6bc9d8[_0xff0a('0x29')]=_[_0xff0a('0x2a')](_0x3afcc4[_0xff0a('0x29')]);_0x6bc9d8[_0xff0a('0x2b')]=_[_0xff0a('0x2c')](_0x6bc9d8[_0xff0a('0x28')],_0x6bc9d8[_0xff0a('0x29')]);_0x18b7e6[_0xff0a('0x2d')]=_[_0xff0a('0x2c')](_0x6bc9d8[_0xff0a('0x28')],qs['fields'](_0x3afcc4[_0xff0a('0x29')][_0xff0a('0x2e')]));_0x18b7e6[_0xff0a('0x2d')]=_0x18b7e6[_0xff0a('0x2d')][_0xff0a('0x2f')]?_0x18b7e6['attributes']:_0x6bc9d8[_0xff0a('0x28')];if(_0x3afcc4[_0xff0a('0x29')][_0xff0a('0x39')]){_0x18b7e6[_0xff0a('0x3a')]=[{'all':!![]}];}_0x18b7e6=_[_0xff0a('0x36')]({},_0x18b7e6,_0x3afcc4[_0xff0a('0x37')]);return db[_0xff0a('0x24')][_0xff0a('0x3f')](_0x18b7e6)[_0xff0a('0x1e')](handleEntityNotFound(_0x350b95,null))[_0xff0a('0x1e')](respondWithResult(_0x350b95,null))[_0xff0a('0x3c')](handleError(_0x350b95,null));};exports[_0xff0a('0x40')]=function(_0xda4c61,_0x298451){return db[_0xff0a('0x24')][_0xff0a('0x40')](_0xda4c61[_0xff0a('0x41')],{})[_0xff0a('0x1e')](respondWithResult(_0x298451,0xc9))[_0xff0a('0x3c')](handleError(_0x298451,null));};exports['update']=function(_0x38ef19,_0x27ee13){if(_0x38ef19['body']['id']){delete _0x38ef19['body']['id'];}return db[_0xff0a('0x24')][_0xff0a('0x3f')]({'where':{'id':_0x38ef19[_0xff0a('0x3e')]['id']}})[_0xff0a('0x1e')](handleEntityNotFound(_0x27ee13,null))[_0xff0a('0x1e')](saveUpdates(_0x38ef19['body'],null))[_0xff0a('0x1e')](respondWithResult(_0x27ee13,null))['catch'](handleError(_0x27ee13,null));};exports[_0xff0a('0x42')]=function(_0x3c482a,_0xe3d0e7){return db[_0xff0a('0x24')][_0xff0a('0x3f')]({'where':{'id':_0x3c482a[_0xff0a('0x3e')]['id']}})[_0xff0a('0x1e')](handleEntityNotFound(_0xe3d0e7,null))[_0xff0a('0x1e')](removeEntity(_0xe3d0e7,null))['catch'](handleError(_0xe3d0e7,null));}; \ No newline at end of file +var _0xb12e=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','MailServerOut','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','fieldName','type','model','map','query','filters','attributes','intersection','fields'];(function(_0x320363,_0x11d07f){var _0x5d0c5a=function(_0x3c5d90){while(--_0x3c5d90){_0x320363['push'](_0x320363['shift']());}};_0x5d0c5a(++_0x11d07f);}(_0xb12e,0x1c0));var _0xeb12=function(_0x408721,_0x31df20){_0x408721=_0x408721-0x0;var _0x2e965e=_0xb12e[_0x408721];return _0x2e965e;};'use strict';var emlformat=require(_0xeb12('0x0'));var rimraf=require(_0xeb12('0x1'));var zipdir=require(_0xeb12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb12('0x3'));var moment=require(_0xeb12('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeb12('0x5'));var util=require(_0xeb12('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb12('0x7'));var fs=require('fs');var fs_extra=require(_0xeb12('0x8'));var _=require(_0xeb12('0x9'));var squel=require('squel');var crypto=require(_0xeb12('0xa'));var jsforce=require(_0xeb12('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb12('0xc'));var Papa=require(_0xeb12('0xd'));var Redis=require(_0xeb12('0xe'));var authService=require(_0xeb12('0xf'));var qs=require(_0xeb12('0x10'));var as=require(_0xeb12('0x11'));var hardwareService=require(_0xeb12('0x12'));var logger=require('../../config/logger')(_0xeb12('0x13'));var utils=require('../../config/utils');var config=require(_0xeb12('0x14'));var licenseUtil=require(_0xeb12('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1619bf,_0x25f45b){_0x25f45b=_0x25f45b||0xcc;return function(_0x36a2af){if(_0x36a2af){return _0x1619bf[_0xeb12('0x16')](_0x25f45b);}return _0x1619bf['status'](_0x25f45b)[_0xeb12('0x17')]();};}function respondWithResult(_0x3f466f,_0x92c80d){_0x92c80d=_0x92c80d||0xc8;return function(_0x504076){if(_0x504076){return _0x3f466f[_0xeb12('0x18')](_0x92c80d)[_0xeb12('0x19')](_0x504076);}};}function respondWithFilteredResult(_0x258d0e,_0x529f03){return function(_0x28d9c4){if(_0x28d9c4){var _0x30bec0=typeof _0x529f03[_0xeb12('0x1a')]===_0xeb12('0x1b')&&typeof _0x529f03[_0xeb12('0x1c')]===_0xeb12('0x1b');var _0x2fc347=_0x28d9c4[_0xeb12('0x1d')];var _0x4e7381=_0x30bec0?0x0:_0x529f03[_0xeb12('0x1a')];var _0x51807b=_0x30bec0?_0x28d9c4['count']:_0x529f03[_0xeb12('0x1a')]+_0x529f03[_0xeb12('0x1c')];var _0x1a9512;if(_0x51807b>=_0x2fc347){_0x51807b=_0x2fc347;_0x1a9512=0xc8;}else{_0x1a9512=0xce;}_0x258d0e[_0xeb12('0x18')](_0x1a9512);return _0x258d0e[_0xeb12('0x1e')]('Content-Range',_0x4e7381+'-'+_0x51807b+'/'+_0x2fc347)[_0xeb12('0x19')](_0x28d9c4);}return null;};}function patchUpdates(_0xf533b3){return function(_0x5d6789){try{jsonpatch['apply'](_0x5d6789,_0xf533b3,!![]);}catch(_0x5b2553){return BPromise[_0xeb12('0x1f')](_0x5b2553);}return _0x5d6789[_0xeb12('0x20')]();};}function saveUpdates(_0xbed1b2,_0xebbe18){return function(_0x4dc11c){if(_0x4dc11c){return _0x4dc11c[_0xeb12('0x21')](_0xbed1b2)[_0xeb12('0x22')](function(_0x3bea72){return _0x3bea72;});}return null;};}function removeEntity(_0x192945,_0x1a000e){return function(_0x37afd7){if(_0x37afd7){return _0x37afd7['destroy']()[_0xeb12('0x22')](function(){_0x192945[_0xeb12('0x18')](0xcc)[_0xeb12('0x17')]();});}};}function handleEntityNotFound(_0x1fcd42,_0x1ed2d1){return function(_0xd7ba0e){if(!_0xd7ba0e){_0x1fcd42[_0xeb12('0x16')](0x194);}return _0xd7ba0e;};}function handleError(_0x40a8f6,_0x3eb925){_0x3eb925=_0x3eb925||0x1f4;return function(_0x178532){logger[_0xeb12('0x23')](_0x178532[_0xeb12('0x24')]);if(_0x178532['name']){delete _0x178532[_0xeb12('0x25')];}_0x40a8f6[_0xeb12('0x18')](_0x3eb925)[_0xeb12('0x26')](_0x178532);};}exports[_0xeb12('0x27')]=function(_0x508dea,_0x816215){var _0x3a94e1={},_0x3d0762={},_0x56e5cc={'count':0x0,'rows':[]};var _0x1ae7bf=_['map'](db['MailServerOut']['rawAttributes'],function(_0x4539f2){return{'name':_0x4539f2[_0xeb12('0x28')],'type':_0x4539f2[_0xeb12('0x29')]['key']};});_0x3d0762[_0xeb12('0x2a')]=_[_0xeb12('0x2b')](_0x1ae7bf,_0xeb12('0x25'));_0x3d0762['query']=_['keys'](_0x508dea[_0xeb12('0x2c')]);_0x3d0762[_0xeb12('0x2d')]=_['intersection'](_0x3d0762[_0xeb12('0x2a')],_0x3d0762['query']);_0x3a94e1[_0xeb12('0x2e')]=_[_0xeb12('0x2f')](_0x3d0762[_0xeb12('0x2a')],qs['fields'](_0x508dea[_0xeb12('0x2c')][_0xeb12('0x30')]));_0x3a94e1['attributes']=_0x3a94e1['attributes'][_0xeb12('0x31')]?_0x3a94e1[_0xeb12('0x2e')]:_0x3d0762['model'];if(!_0x508dea[_0xeb12('0x2c')][_0xeb12('0x32')](_0xeb12('0x33'))){_0x3a94e1[_0xeb12('0x1c')]=qs['limit'](_0x508dea['query'][_0xeb12('0x1c')]);_0x3a94e1['offset']=qs[_0xeb12('0x1a')](_0x508dea[_0xeb12('0x2c')][_0xeb12('0x1a')]);}_0x3a94e1['order']=qs[_0xeb12('0x34')](_0x508dea[_0xeb12('0x2c')][_0xeb12('0x34')]);_0x3a94e1[_0xeb12('0x35')]=qs[_0xeb12('0x2d')](_[_0xeb12('0x36')](_0x508dea['query'],_0x3d0762[_0xeb12('0x2d')]),_0x1ae7bf);if(_0x508dea[_0xeb12('0x2c')][_0xeb12('0x37')]){_0x3a94e1[_0xeb12('0x35')]=_['merge'](_0x3a94e1[_0xeb12('0x35')],{'$or':_['map'](_0x1ae7bf,function(_0xf1bec4){if(_0xf1bec4[_0xeb12('0x29')]!==_0xeb12('0x38')){var _0x1477aa={};_0x1477aa[_0xf1bec4[_0xeb12('0x25')]]={'$like':'%'+_0x508dea[_0xeb12('0x2c')][_0xeb12('0x37')]+'%'};return _0x1477aa;}})});}_0x3a94e1=_[_0xeb12('0x39')]({},_0x3a94e1,_0x508dea[_0xeb12('0x3a')]);var _0x2cafdf={'where':_0x3a94e1['where']};return db[_0xeb12('0x3b')][_0xeb12('0x1d')](_0x2cafdf)[_0xeb12('0x22')](function(_0x5033d2){_0x56e5cc[_0xeb12('0x1d')]=_0x5033d2;if(_0x508dea[_0xeb12('0x2c')][_0xeb12('0x3c')]){_0x3a94e1['include']=[{'all':!![]}];}return db[_0xeb12('0x3b')][_0xeb12('0x3d')](_0x3a94e1);})[_0xeb12('0x22')](function(_0x148a27){_0x56e5cc[_0xeb12('0x3e')]=_0x148a27;return _0x56e5cc;})['then'](respondWithFilteredResult(_0x816215,_0x3a94e1))[_0xeb12('0x3f')](handleError(_0x816215,null));};exports[_0xeb12('0x40')]=function(_0x4433e2,_0x264914){var _0x5789bf={'raw':!![],'where':{'id':_0x4433e2[_0xeb12('0x41')]['id']}},_0x27e844={};_0x27e844[_0xeb12('0x2a')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x27e844[_0xeb12('0x2c')]=_[_0xeb12('0x42')](_0x4433e2[_0xeb12('0x2c')]);_0x27e844['filters']=_['intersection'](_0x27e844['model'],_0x27e844['query']);_0x5789bf[_0xeb12('0x2e')]=_['intersection'](_0x27e844[_0xeb12('0x2a')],qs['fields'](_0x4433e2[_0xeb12('0x2c')][_0xeb12('0x30')]));_0x5789bf[_0xeb12('0x2e')]=_0x5789bf[_0xeb12('0x2e')][_0xeb12('0x31')]?_0x5789bf['attributes']:_0x27e844[_0xeb12('0x2a')];if(_0x4433e2[_0xeb12('0x2c')][_0xeb12('0x3c')]){_0x5789bf[_0xeb12('0x43')]=[{'all':!![]}];}_0x5789bf=_[_0xeb12('0x39')]({},_0x5789bf,_0x4433e2[_0xeb12('0x3a')]);return db[_0xeb12('0x3b')][_0xeb12('0x44')](_0x5789bf)[_0xeb12('0x22')](handleEntityNotFound(_0x264914,null))['then'](respondWithResult(_0x264914,null))[_0xeb12('0x3f')](handleError(_0x264914,null));};exports['create']=function(_0x435735,_0x391778){return db[_0xeb12('0x3b')][_0xeb12('0x45')](_0x435735['body'],{})[_0xeb12('0x22')](respondWithResult(_0x391778,0xc9))[_0xeb12('0x3f')](handleError(_0x391778,null));};exports[_0xeb12('0x21')]=function(_0x2f7bb5,_0x3b230e){if(_0x2f7bb5[_0xeb12('0x46')]['id']){delete _0x2f7bb5[_0xeb12('0x46')]['id'];}return db[_0xeb12('0x3b')][_0xeb12('0x44')]({'where':{'id':_0x2f7bb5['params']['id']}})[_0xeb12('0x22')](handleEntityNotFound(_0x3b230e,null))[_0xeb12('0x22')](saveUpdates(_0x2f7bb5[_0xeb12('0x46')],null))[_0xeb12('0x22')](respondWithResult(_0x3b230e,null))[_0xeb12('0x3f')](handleError(_0x3b230e,null));};exports['destroy']=function(_0xa883a1,_0x5d3a58){return db['MailServerOut'][_0xeb12('0x44')]({'where':{'id':_0xa883a1[_0xeb12('0x41')]['id']}})[_0xeb12('0x22')](handleEntityNotFound(_0x5d3a58,null))[_0xeb12('0x22')](removeEntity(_0x5d3a58,null))[_0xeb12('0x3f')](handleError(_0x5d3a58,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f06a455..ea1c44d 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 _0xa1ae=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailServerOut'];(function(_0x2d240a,_0x5447d7){var _0x441c83=function(_0x572fe8){while(--_0x572fe8){_0x2d240a['push'](_0x2d240a['shift']());}};_0x441c83(++_0x5447d7);}(_0xa1ae,0x153));var _0xea1a=function(_0x20a138,_0x137ec9){_0x20a138=_0x20a138-0x0;var _0x4e6877=_0xa1ae[_0x20a138];return _0x4e6877;};'use strict';var _=require(_0xea1a('0x0'));var util=require(_0xea1a('0x1'));var logger=require(_0xea1a('0x2'))(_0xea1a('0x3'));var moment=require(_0xea1a('0x4'));var BPromise=require(_0xea1a('0x5'));var rp=require(_0xea1a('0x6'));var fs=require('fs');var path=require(_0xea1a('0x7'));var rimraf=require(_0xea1a('0x8'));var config=require(_0xea1a('0x9'));var attributes=require('./mailServerOut.attributes');module[_0xea1a('0xa')]=function(_0xc931c,_0x149089){return _0xc931c['define'](_0xea1a('0xb'),attributes,{'tableName':_0xea1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf3d=['bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0x1b4058,_0x210dba){var _0x132a2f=function(_0xd6c3fd){while(--_0xd6c3fd){_0x1b4058['push'](_0x1b4058['shift']());}};_0x132a2f(++_0x210dba);}(_0xcf3d,0x15d));var _0xdcf3=function(_0x39bddb,_0x178ad7){_0x39bddb=_0x39bddb-0x0;var _0x24613b=_0xcf3d[_0x39bddb];return _0x24613b;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdcf3('0x2'));var BPromise=require(_0xdcf3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcf3('0x4'));var rimraf=require(_0xdcf3('0x5'));var config=require(_0xdcf3('0x6'));var attributes=require(_0xdcf3('0x7'));module[_0xdcf3('0x8')]=function(_0x4c5dcb,_0x10e8b1){return _0x4c5dcb['define'](_0xdcf3('0x9'),attributes,{'tableName':_0xdcf3('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 246b787..e45dc55 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3bca2d,_0x1af8f4){var _0x144a7c=function(_0x2a46ce){while(--_0x2a46ce){_0x3bca2d['push'](_0x3bca2d['shift']());}};_0x144a7c(++_0x1af8f4);}(_0xadb5,0xad));var _0x5adb=function(_0x4ecb63,_0x3022ba){_0x4ecb63=_0x4ecb63-0x0;var _0x2a003d=_0xadb5[_0x4ecb63];return _0x2a003d;};'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']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x1efbb0,_0x5d8ddc){_0x1efbb0=_0x1efbb0-0x0;var _0x4ed53f=_0x7a54[_0x1efbb0];return _0x4ed53f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b1d4ca1..c9564d4 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 _0x137c=['create','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x542857,_0x18f281){var _0x1ec421=function(_0x334273){while(--_0x334273){_0x542857['push'](_0x542857['shift']());}};_0x1ec421(++_0x18f281);}(_0x137c,0x11e));var _0xc137=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x137c[_0xf2628e];return _0x13863a;};'use strict';var multer=require(_0xc137('0x0'));var util=require('util');var path=require(_0xc137('0x1'));var timeout=require(_0xc137('0x2'));var express=require('express');var router=express[_0xc137('0x3')]();var fs_extra=require(_0xc137('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc137('0x5'));var controller=require(_0xc137('0x6'));router[_0xc137('0x7')]('/',auth[_0xc137('0x8')](),controller[_0xc137('0x9')]);router[_0xc137('0x7')](_0xc137('0xa'),auth[_0xc137('0x8')](),controller[_0xc137('0xb')]);router[_0xc137('0x7')]('/:id',auth[_0xc137('0x8')](),controller[_0xc137('0xc')]);router[_0xc137('0xd')]('/',auth['isAuthenticated'](),controller[_0xc137('0xe')]);router[_0xc137('0xf')](_0xc137('0x10'),auth[_0xc137('0x8')](),controller[_0xc137('0x11')]);router[_0xc137('0x12')](_0xc137('0x10'),auth[_0xc137('0x8')](),controller[_0xc137('0x13')]);module['exports']=router; \ No newline at end of file +var _0xee98=['/:id','post','create','put','update','delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe'];(function(_0x49dee1,_0x5933bf){var _0x3e3c00=function(_0x499db4){while(--_0x499db4){_0x49dee1['push'](_0x49dee1['shift']());}};_0x3e3c00(++_0x5933bf);}(_0xee98,0x148));var _0x8ee9=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xee98[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x8ee9('0x0'));var util=require('util');var path=require(_0x8ee9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8ee9('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8ee9('0x3'));var controller=require(_0x8ee9('0x4'));router[_0x8ee9('0x5')]('/',auth[_0x8ee9('0x6')](),controller['index']);router[_0x8ee9('0x5')](_0x8ee9('0x7'),auth[_0x8ee9('0x6')](),controller['describe']);router[_0x8ee9('0x5')](_0x8ee9('0x8'),auth[_0x8ee9('0x6')](),controller['show']);router[_0x8ee9('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ee9('0xa')]);router[_0x8ee9('0xb')](_0x8ee9('0x8'),auth['isAuthenticated'](),controller[_0x8ee9('0xc')]);router[_0x8ee9('0xd')]('/:id',auth[_0x8ee9('0x6')](),controller[_0x8ee9('0xe')]);module[_0x8ee9('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index eb951c0..c433bbd 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 _0x11e5=['name','sequelize','STRING'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x11e5,0x8b));var _0x511e=function(_0x3899cb,_0xb95555){_0x3899cb=_0x3899cb-0x0;var _0x3fe239=_0x11e5[_0x3899cb];return _0x3fe239;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'unique':_0x511e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd046=['exports','STRING','name'];(function(_0x576139,_0x4d401d){var _0x3519cc=function(_0x45c718){while(--_0x45c718){_0x576139['push'](_0x576139['shift']());}};_0x3519cc(++_0x4d401d);}(_0xd046,0x129));var _0x6d04=function(_0x204cdd,_0x5d50bc){_0x204cdd=_0x204cdd-0x0;var _0x48e952=_0xd046[_0x204cdd];return _0x48e952;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'unique':_0x6d04('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index bfdd320..c5b2862 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 _0x6bcb=['destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','include','catch','show','params','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0x6bcb,0x101));var _0xb6bc=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x6bcb[_0x3a13cf];return _0x4817c;};'use strict';var emlformat=require(_0xb6bc('0x0'));var rimraf=require(_0xb6bc('0x1'));var zipdir=require(_0xb6bc('0x2'));var jsonpatch=require(_0xb6bc('0x3'));var rp=require(_0xb6bc('0x4'));var moment=require(_0xb6bc('0x5'));var BPromise=require(_0xb6bc('0x6'));var Mustache=require('mustache');var util=require(_0xb6bc('0x7'));var path=require(_0xb6bc('0x8'));var sox=require('sox');var csv=require(_0xb6bc('0x9'));var ejs=require(_0xb6bc('0xa'));var fs=require('fs');var fs_extra=require(_0xb6bc('0xb'));var _=require(_0xb6bc('0xc'));var squel=require('squel');var crypto=require(_0xb6bc('0xd'));var jsforce=require(_0xb6bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb6bc('0x9'));var querystring=require('querystring');var Papa=require(_0xb6bc('0xf'));var Redis=require('ioredis');var authService=require(_0xb6bc('0x10'));var qs=require(_0xb6bc('0x11'));var as=require(_0xb6bc('0x12'));var hardwareService=require(_0xb6bc('0x13'));var logger=require('../../config/logger')(_0xb6bc('0x14'));var utils=require(_0xb6bc('0x15'));var config=require(_0xb6bc('0x16'));var licenseUtil=require(_0xb6bc('0x17'));var db=require(_0xb6bc('0x18'))['db'];function respondWithStatusCode(_0x3d4a88,_0x13d2ec){_0x13d2ec=_0x13d2ec||0xcc;return function(_0x3a430d){if(_0x3a430d){return _0x3d4a88[_0xb6bc('0x19')](_0x13d2ec);}return _0x3d4a88[_0xb6bc('0x1a')](_0x13d2ec)[_0xb6bc('0x1b')]();};}function respondWithResult(_0x227e41,_0x2e94cd){_0x2e94cd=_0x2e94cd||0xc8;return function(_0x271514){if(_0x271514){return _0x227e41[_0xb6bc('0x1a')](_0x2e94cd)['json'](_0x271514);}};}function respondWithFilteredResult(_0x3d324f,_0x2ae2d1){return function(_0x1625bd){if(_0x1625bd){var _0x19e37d=typeof _0x2ae2d1[_0xb6bc('0x1c')]===_0xb6bc('0x1d')&&typeof _0x2ae2d1[_0xb6bc('0x1e')]==='undefined';var _0x33d21b=_0x1625bd[_0xb6bc('0x1f')];var _0x25096c=_0x19e37d?0x0:_0x2ae2d1[_0xb6bc('0x1c')];var _0x39ecf0=_0x19e37d?_0x1625bd[_0xb6bc('0x1f')]:_0x2ae2d1['offset']+_0x2ae2d1['limit'];var _0x5720f1;if(_0x39ecf0>=_0x33d21b){_0x39ecf0=_0x33d21b;_0x5720f1=0xc8;}else{_0x5720f1=0xce;}_0x3d324f['status'](_0x5720f1);return _0x3d324f[_0xb6bc('0x20')](_0xb6bc('0x21'),_0x25096c+'-'+_0x39ecf0+'/'+_0x33d21b)['json'](_0x1625bd);}return null;};}function patchUpdates(_0x49959a){return function(_0x35eda9){try{jsonpatch['apply'](_0x35eda9,_0x49959a,!![]);}catch(_0x29b64b){return BPromise['reject'](_0x29b64b);}return _0x35eda9[_0xb6bc('0x22')]();};}function saveUpdates(_0x5c6c22,_0x336af0){return function(_0x29c862){if(_0x29c862){return _0x29c862['update'](_0x5c6c22)['then'](function(_0x206b6d){return _0x206b6d;});}return null;};}function removeEntity(_0x3cdbd6,_0x3f9e80){return function(_0x1d1b0c){if(_0x1d1b0c){return _0x1d1b0c[_0xb6bc('0x23')]()['then'](function(){_0x3cdbd6[_0xb6bc('0x1a')](0xcc)[_0xb6bc('0x1b')]();});}};}function handleEntityNotFound(_0x479e1e,_0x19de8c){return function(_0x477606){if(!_0x477606){_0x479e1e[_0xb6bc('0x19')](0x194);}return _0x477606;};}function handleError(_0x2b0b21,_0x20e863){_0x20e863=_0x20e863||0x1f4;return function(_0x237537){logger[_0xb6bc('0x24')](_0x237537[_0xb6bc('0x25')]);if(_0x237537[_0xb6bc('0x26')]){delete _0x237537[_0xb6bc('0x26')];}_0x2b0b21[_0xb6bc('0x1a')](_0x20e863)[_0xb6bc('0x27')](_0x237537);};}exports[_0xb6bc('0x28')]=function(_0x1cbc79,_0x4f2432){var _0x19f959={},_0x62a990={},_0x54f138={'count':0x0,'rows':[]};var _0x2d4f2c=_['map'](db[_0xb6bc('0x29')][_0xb6bc('0x2a')],function(_0x43d9f3){return{'name':_0x43d9f3['fieldName'],'type':_0x43d9f3[_0xb6bc('0x2b')][_0xb6bc('0x2c')]};});_0x62a990['model']=_['map'](_0x2d4f2c,_0xb6bc('0x26'));_0x62a990[_0xb6bc('0x2d')]=_[_0xb6bc('0x2e')](_0x1cbc79[_0xb6bc('0x2d')]);_0x62a990['filters']=_[_0xb6bc('0x2f')](_0x62a990[_0xb6bc('0x30')],_0x62a990[_0xb6bc('0x2d')]);_0x19f959[_0xb6bc('0x31')]=_['intersection'](_0x62a990[_0xb6bc('0x30')],qs[_0xb6bc('0x32')](_0x1cbc79[_0xb6bc('0x2d')]['fields']));_0x19f959['attributes']=_0x19f959[_0xb6bc('0x31')][_0xb6bc('0x33')]?_0x19f959[_0xb6bc('0x31')]:_0x62a990[_0xb6bc('0x30')];if(!_0x1cbc79[_0xb6bc('0x2d')]['hasOwnProperty'](_0xb6bc('0x34'))){_0x19f959[_0xb6bc('0x1e')]=qs[_0xb6bc('0x1e')](_0x1cbc79[_0xb6bc('0x2d')][_0xb6bc('0x1e')]);_0x19f959[_0xb6bc('0x1c')]=qs[_0xb6bc('0x1c')](_0x1cbc79['query'][_0xb6bc('0x1c')]);}_0x19f959[_0xb6bc('0x35')]=qs[_0xb6bc('0x36')](_0x1cbc79['query'][_0xb6bc('0x36')]);_0x19f959['where']=qs[_0xb6bc('0x37')](_[_0xb6bc('0x38')](_0x1cbc79[_0xb6bc('0x2d')],_0x62a990['filters']),_0x2d4f2c);if(_0x1cbc79[_0xb6bc('0x2d')][_0xb6bc('0x39')]){_0x19f959[_0xb6bc('0x3a')]=_[_0xb6bc('0x3b')](_0x19f959['where'],{'$or':_['map'](_0x2d4f2c,function(_0x13375a){if(_0x13375a[_0xb6bc('0x2b')]!==_0xb6bc('0x3c')){var _0x1e5a37={};_0x1e5a37[_0x13375a['name']]={'$like':'%'+_0x1cbc79[_0xb6bc('0x2d')][_0xb6bc('0x39')]+'%'};return _0x1e5a37;}})});}_0x19f959=_[_0xb6bc('0x3b')]({},_0x19f959,_0x1cbc79[_0xb6bc('0x3d')]);var _0x36df4b={'where':_0x19f959['where']};return db[_0xb6bc('0x29')][_0xb6bc('0x1f')](_0x36df4b)[_0xb6bc('0x3e')](function(_0x430fef){_0x54f138[_0xb6bc('0x1f')]=_0x430fef;if(_0x1cbc79[_0xb6bc('0x2d')]['includeAll']){_0x19f959[_0xb6bc('0x3f')]=[{'all':!![]}];}return db[_0xb6bc('0x29')]['findAll'](_0x19f959);})['then'](function(_0x4564a6){_0x54f138['rows']=_0x4564a6;return _0x54f138;})[_0xb6bc('0x3e')](respondWithFilteredResult(_0x4f2432,_0x19f959))[_0xb6bc('0x40')](handleError(_0x4f2432,null));};exports[_0xb6bc('0x41')]=function(_0x3d1c37,_0x2f92fc){var _0x1784d5={'raw':!![],'where':{'id':_0x3d1c37[_0xb6bc('0x42')]['id']}},_0x31d676={};_0x31d676['model']=_[_0xb6bc('0x2e')](db[_0xb6bc('0x29')][_0xb6bc('0x2a')]);_0x31d676[_0xb6bc('0x2d')]=_[_0xb6bc('0x2e')](_0x3d1c37[_0xb6bc('0x2d')]);_0x31d676['filters']=_[_0xb6bc('0x2f')](_0x31d676[_0xb6bc('0x30')],_0x31d676[_0xb6bc('0x2d')]);_0x1784d5[_0xb6bc('0x31')]=_[_0xb6bc('0x2f')](_0x31d676[_0xb6bc('0x30')],qs[_0xb6bc('0x32')](_0x3d1c37[_0xb6bc('0x2d')][_0xb6bc('0x32')]));_0x1784d5[_0xb6bc('0x31')]=_0x1784d5[_0xb6bc('0x31')][_0xb6bc('0x33')]?_0x1784d5[_0xb6bc('0x31')]:_0x31d676[_0xb6bc('0x30')];if(_0x3d1c37[_0xb6bc('0x2d')][_0xb6bc('0x43')]){_0x1784d5['include']=[{'all':!![]}];}_0x1784d5=_[_0xb6bc('0x3b')]({},_0x1784d5,_0x3d1c37[_0xb6bc('0x3d')]);return db[_0xb6bc('0x29')][_0xb6bc('0x44')](_0x1784d5)[_0xb6bc('0x3e')](handleEntityNotFound(_0x2f92fc,null))['then'](respondWithResult(_0x2f92fc,null))[_0xb6bc('0x40')](handleError(_0x2f92fc,null));};exports[_0xb6bc('0x45')]=function(_0xfa09ef,_0x27cd16){return db[_0xb6bc('0x29')][_0xb6bc('0x45')](_0xfa09ef[_0xb6bc('0x46')],{})[_0xb6bc('0x3e')](respondWithResult(_0x27cd16,0xc9))[_0xb6bc('0x40')](handleError(_0x27cd16,null));};exports[_0xb6bc('0x47')]=function(_0x7c5daa,_0x5385ae){if(_0x7c5daa['body']['id']){delete _0x7c5daa[_0xb6bc('0x46')]['id'];}return db[_0xb6bc('0x29')][_0xb6bc('0x44')]({'where':{'id':_0x7c5daa[_0xb6bc('0x42')]['id']}})[_0xb6bc('0x3e')](handleEntityNotFound(_0x5385ae,null))[_0xb6bc('0x3e')](saveUpdates(_0x7c5daa[_0xb6bc('0x46')],null))[_0xb6bc('0x3e')](respondWithResult(_0x5385ae,null))[_0xb6bc('0x40')](handleError(_0x5385ae,null));};exports[_0xb6bc('0x23')]=function(_0x34e1c8,_0x47f56e){return db[_0xb6bc('0x29')][_0xb6bc('0x44')]({'where':{'id':_0x34e1c8['params']['id']}})[_0xb6bc('0x3e')](handleEntityNotFound(_0x47f56e,null))[_0xb6bc('0x3e')](removeEntity(_0x47f56e,null))['catch'](handleError(_0x47f56e,null));};exports['describe']=function(_0x5f56e0,_0x369728){return db[_0xb6bc('0x29')][_0xb6bc('0x48')]()['then'](respondWithResult(_0x369728,null))[_0xb6bc('0x40')](handleError(_0x369728,null));}; \ No newline at end of file +var _0xd3a7=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','length','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','MailSubstatus','rawAttributes','type','key','map','keys','query','filters','intersection','fields','attributes','model'];(function(_0x2a77c0,_0x5c4939){var _0x2d3506=function(_0xa497ef){while(--_0xa497ef){_0x2a77c0['push'](_0x2a77c0['shift']());}};_0x2d3506(++_0x5c4939);}(_0xd3a7,0xfe));var _0x7d3a=function(_0x3a29ea,_0x5713d4){_0x3a29ea=_0x3a29ea-0x0;var _0x46783e=_0xd3a7[_0x3a29ea];return _0x46783e;};'use strict';var emlformat=require(_0x7d3a('0x0'));var rimraf=require(_0x7d3a('0x1'));var zipdir=require(_0x7d3a('0x2'));var jsonpatch=require(_0x7d3a('0x3'));var rp=require('request-promise');var moment=require(_0x7d3a('0x4'));var BPromise=require(_0x7d3a('0x5'));var Mustache=require(_0x7d3a('0x6'));var util=require('util');var path=require(_0x7d3a('0x7'));var sox=require(_0x7d3a('0x8'));var csv=require(_0x7d3a('0x9'));var ejs=require(_0x7d3a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d3a('0xb'));var squel=require(_0x7d3a('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d3a('0xd'));var deskjs=require(_0x7d3a('0xe'));var toCsv=require(_0x7d3a('0x9'));var querystring=require(_0x7d3a('0xf'));var Papa=require(_0x7d3a('0x10'));var Redis=require(_0x7d3a('0x11'));var authService=require(_0x7d3a('0x12'));var qs=require(_0x7d3a('0x13'));var as=require(_0x7d3a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d3a('0x15'))('api');var utils=require(_0x7d3a('0x16'));var config=require(_0x7d3a('0x17'));var licenseUtil=require(_0x7d3a('0x18'));var db=require(_0x7d3a('0x19'))['db'];function respondWithStatusCode(_0x51122c,_0xa595f9){_0xa595f9=_0xa595f9||0xcc;return function(_0x105c13){if(_0x105c13){return _0x51122c[_0x7d3a('0x1a')](_0xa595f9);}return _0x51122c[_0x7d3a('0x1b')](_0xa595f9)[_0x7d3a('0x1c')]();};}function respondWithResult(_0x3d4f77,_0xe76be0){_0xe76be0=_0xe76be0||0xc8;return function(_0x338348){if(_0x338348){return _0x3d4f77[_0x7d3a('0x1b')](_0xe76be0)['json'](_0x338348);}};}function respondWithFilteredResult(_0x5c507f,_0x296072){return function(_0x38f15f){if(_0x38f15f){var _0x49fb2c=typeof _0x296072[_0x7d3a('0x1d')]==='undefined'&&typeof _0x296072[_0x7d3a('0x1e')]===_0x7d3a('0x1f');var _0x26655c=_0x38f15f[_0x7d3a('0x20')];var _0x257e04=_0x49fb2c?0x0:_0x296072[_0x7d3a('0x1d')];var _0x5f13b2=_0x49fb2c?_0x38f15f[_0x7d3a('0x20')]:_0x296072[_0x7d3a('0x1d')]+_0x296072['limit'];var _0x3ca979;if(_0x5f13b2>=_0x26655c){_0x5f13b2=_0x26655c;_0x3ca979=0xc8;}else{_0x3ca979=0xce;}_0x5c507f[_0x7d3a('0x1b')](_0x3ca979);return _0x5c507f[_0x7d3a('0x21')](_0x7d3a('0x22'),_0x257e04+'-'+_0x5f13b2+'/'+_0x26655c)[_0x7d3a('0x23')](_0x38f15f);}return null;};}function patchUpdates(_0x475799){return function(_0xd754c1){try{jsonpatch[_0x7d3a('0x24')](_0xd754c1,_0x475799,!![]);}catch(_0x174b7c){return BPromise[_0x7d3a('0x25')](_0x174b7c);}return _0xd754c1[_0x7d3a('0x26')]();};}function saveUpdates(_0x1b4a5d,_0x330ffb){return function(_0x2f3217){if(_0x2f3217){return _0x2f3217[_0x7d3a('0x27')](_0x1b4a5d)['then'](function(_0x587ca4){return _0x587ca4;});}return null;};}function removeEntity(_0x316981,_0x2345f3){return function(_0x4c4e2c){if(_0x4c4e2c){return _0x4c4e2c[_0x7d3a('0x28')]()[_0x7d3a('0x29')](function(){_0x316981[_0x7d3a('0x1b')](0xcc)[_0x7d3a('0x1c')]();});}};}function handleEntityNotFound(_0x24eec8,_0x35c174){return function(_0x3d787c){if(!_0x3d787c){_0x24eec8[_0x7d3a('0x1a')](0x194);}return _0x3d787c;};}function handleError(_0x3a3023,_0x5e8881){_0x5e8881=_0x5e8881||0x1f4;return function(_0x108bf6){logger['error'](_0x108bf6[_0x7d3a('0x2a')]);if(_0x108bf6[_0x7d3a('0x2b')]){delete _0x108bf6[_0x7d3a('0x2b')];}_0x3a3023[_0x7d3a('0x1b')](_0x5e8881)[_0x7d3a('0x2c')](_0x108bf6);};}exports[_0x7d3a('0x2d')]=function(_0x418319,_0x36523f){var _0x1fef26={},_0x10995d={},_0x44169b={'count':0x0,'rows':[]};var _0x24fe40=_['map'](db[_0x7d3a('0x2e')][_0x7d3a('0x2f')],function(_0x5e841e){return{'name':_0x5e841e['fieldName'],'type':_0x5e841e[_0x7d3a('0x30')][_0x7d3a('0x31')]};});_0x10995d['model']=_[_0x7d3a('0x32')](_0x24fe40,_0x7d3a('0x2b'));_0x10995d['query']=_[_0x7d3a('0x33')](_0x418319[_0x7d3a('0x34')]);_0x10995d[_0x7d3a('0x35')]=_[_0x7d3a('0x36')](_0x10995d['model'],_0x10995d[_0x7d3a('0x34')]);_0x1fef26['attributes']=_['intersection'](_0x10995d['model'],qs[_0x7d3a('0x37')](_0x418319[_0x7d3a('0x34')][_0x7d3a('0x37')]));_0x1fef26[_0x7d3a('0x38')]=_0x1fef26[_0x7d3a('0x38')]['length']?_0x1fef26['attributes']:_0x10995d[_0x7d3a('0x39')];if(!_0x418319['query'][_0x7d3a('0x3a')](_0x7d3a('0x3b'))){_0x1fef26[_0x7d3a('0x1e')]=qs[_0x7d3a('0x1e')](_0x418319[_0x7d3a('0x34')][_0x7d3a('0x1e')]);_0x1fef26[_0x7d3a('0x1d')]=qs[_0x7d3a('0x1d')](_0x418319[_0x7d3a('0x34')][_0x7d3a('0x1d')]);}_0x1fef26[_0x7d3a('0x3c')]=qs[_0x7d3a('0x3d')](_0x418319[_0x7d3a('0x34')]['sort']);_0x1fef26[_0x7d3a('0x3e')]=qs[_0x7d3a('0x35')](_[_0x7d3a('0x3f')](_0x418319[_0x7d3a('0x34')],_0x10995d[_0x7d3a('0x35')]),_0x24fe40);if(_0x418319['query']['filter']){_0x1fef26[_0x7d3a('0x3e')]=_[_0x7d3a('0x40')](_0x1fef26[_0x7d3a('0x3e')],{'$or':_['map'](_0x24fe40,function(_0x33574d){if(_0x33574d[_0x7d3a('0x30')]!==_0x7d3a('0x41')){var _0x3c932f={};_0x3c932f[_0x33574d[_0x7d3a('0x2b')]]={'$like':'%'+_0x418319[_0x7d3a('0x34')][_0x7d3a('0x42')]+'%'};return _0x3c932f;}})});}_0x1fef26=_[_0x7d3a('0x40')]({},_0x1fef26,_0x418319['options']);var _0x16dac8={'where':_0x1fef26['where']};return db['MailSubstatus']['count'](_0x16dac8)[_0x7d3a('0x29')](function(_0x388235){_0x44169b[_0x7d3a('0x20')]=_0x388235;if(_0x418319['query'][_0x7d3a('0x43')]){_0x1fef26[_0x7d3a('0x44')]=[{'all':!![]}];}return db[_0x7d3a('0x2e')]['findAll'](_0x1fef26);})[_0x7d3a('0x29')](function(_0x3229ab){_0x44169b['rows']=_0x3229ab;return _0x44169b;})['then'](respondWithFilteredResult(_0x36523f,_0x1fef26))[_0x7d3a('0x45')](handleError(_0x36523f,null));};exports[_0x7d3a('0x46')]=function(_0x3d2e84,_0x3cf7aa){var _0x2f5572={'raw':!![],'where':{'id':_0x3d2e84[_0x7d3a('0x47')]['id']}},_0x42dc6e={};_0x42dc6e[_0x7d3a('0x39')]=_[_0x7d3a('0x33')](db['MailSubstatus']['rawAttributes']);_0x42dc6e['query']=_[_0x7d3a('0x33')](_0x3d2e84[_0x7d3a('0x34')]);_0x42dc6e[_0x7d3a('0x35')]=_['intersection'](_0x42dc6e[_0x7d3a('0x39')],_0x42dc6e[_0x7d3a('0x34')]);_0x2f5572[_0x7d3a('0x38')]=_[_0x7d3a('0x36')](_0x42dc6e[_0x7d3a('0x39')],qs[_0x7d3a('0x37')](_0x3d2e84[_0x7d3a('0x34')][_0x7d3a('0x37')]));_0x2f5572[_0x7d3a('0x38')]=_0x2f5572[_0x7d3a('0x38')][_0x7d3a('0x48')]?_0x2f5572[_0x7d3a('0x38')]:_0x42dc6e['model'];if(_0x3d2e84[_0x7d3a('0x34')][_0x7d3a('0x43')]){_0x2f5572[_0x7d3a('0x44')]=[{'all':!![]}];}_0x2f5572=_['merge']({},_0x2f5572,_0x3d2e84[_0x7d3a('0x49')]);return db[_0x7d3a('0x2e')]['find'](_0x2f5572)['then'](handleEntityNotFound(_0x3cf7aa,null))[_0x7d3a('0x29')](respondWithResult(_0x3cf7aa,null))[_0x7d3a('0x45')](handleError(_0x3cf7aa,null));};exports['create']=function(_0x5d42af,_0x4bce35){return db[_0x7d3a('0x2e')][_0x7d3a('0x4a')](_0x5d42af[_0x7d3a('0x4b')],{})[_0x7d3a('0x29')](respondWithResult(_0x4bce35,0xc9))[_0x7d3a('0x45')](handleError(_0x4bce35,null));};exports[_0x7d3a('0x27')]=function(_0x1bd79c,_0x4a5fbd){if(_0x1bd79c[_0x7d3a('0x4b')]['id']){delete _0x1bd79c[_0x7d3a('0x4b')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x1bd79c[_0x7d3a('0x47')]['id']}})[_0x7d3a('0x29')](handleEntityNotFound(_0x4a5fbd,null))[_0x7d3a('0x29')](saveUpdates(_0x1bd79c['body'],null))[_0x7d3a('0x29')](respondWithResult(_0x4a5fbd,null))[_0x7d3a('0x45')](handleError(_0x4a5fbd,null));};exports[_0x7d3a('0x28')]=function(_0x193a7b,_0x3cb743){return db[_0x7d3a('0x2e')][_0x7d3a('0x4c')]({'where':{'id':_0x193a7b[_0x7d3a('0x47')]['id']}})[_0x7d3a('0x29')](handleEntityNotFound(_0x3cb743,null))[_0x7d3a('0x29')](removeEntity(_0x3cb743,null))[_0x7d3a('0x45')](handleError(_0x3cb743,null));};exports[_0x7d3a('0x4d')]=function(_0x37241a,_0x2d213a){return db[_0x7d3a('0x2e')]['describe']()[_0x7d3a('0x29')](respondWithResult(_0x2d213a,null))[_0x7d3a('0x45')](handleError(_0x2d213a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 31b78bb..515d952 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 _0x7205=['moment','bluebird','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','api'];(function(_0x2bc5c8,_0x4f5f83){var _0x22603d=function(_0x38ed38){while(--_0x38ed38){_0x2bc5c8['push'](_0x2bc5c8['shift']());}};_0x22603d(++_0x4f5f83);}(_0x7205,0xc3));var _0x5720=function(_0x2d0601,_0x12d333){_0x2d0601=_0x2d0601-0x0;var _0x571a61=_0x7205[_0x2d0601];return _0x571a61;};'use strict';var _=require(_0x5720('0x0'));var util=require(_0x5720('0x1'));var logger=require('../../config/logger')(_0x5720('0x2'));var moment=require(_0x5720('0x3'));var BPromise=require(_0x5720('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5720('0x5'));var config=require(_0x5720('0x6'));var attributes=require(_0x5720('0x7'));module[_0x5720('0x8')]=function(_0x4d16e6,_0x415e9a){return _0x4d16e6[_0x5720('0x9')](_0x5720('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe776=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0xe776,0x8e));var _0x6e77=function(_0xc40090,_0x200790){_0xc40090=_0xc40090-0x0;var _0x32409f=_0xe776[_0xc40090];return _0x32409f;};'use strict';var _=require(_0x6e77('0x0'));var util=require(_0x6e77('0x1'));var logger=require(_0x6e77('0x2'))('api');var moment=require(_0x6e77('0x3'));var BPromise=require(_0x6e77('0x4'));var rp=require(_0x6e77('0x5'));var fs=require('fs');var path=require(_0x6e77('0x6'));var rimraf=require(_0x6e77('0x7'));var config=require(_0x6e77('0x8'));var attributes=require(_0x6e77('0x9'));module[_0x6e77('0xa')]=function(_0x1a13fe,_0xb8cbe9){return _0x1a13fe['define'](_0x6e77('0xb'),attributes,{'tableName':_0x6e77('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 e5aa9e1..18be70c 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 _0x7c24=['client','then','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x360827,_0x885bab){var _0x21f863=function(_0x472341){while(--_0x472341){_0x360827['push'](_0x360827['shift']());}};_0x21f863(++_0x885bab);}(_0x7c24,0x186));var _0x47c2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7c24[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47c2('0x4'));var db=require(_0x47c2('0x5'))['db'];var utils=require(_0x47c2('0x6'));var logger=require(_0x47c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x47c2('0x8'));var client=jayson[_0x47c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280b64,_0x2d477f,_0x2a2189){return new BPromise(function(_0x186644,_0x241961){return client['request'](_0x280b64,_0x2a2189)[_0x47c2('0xa')](function(_0x11172a){logger['info'](_0x47c2('0xb'),_0x2d477f,'request\x20sent');logger[_0x47c2('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'),JSON[_0x47c2('0xe')](_0x11172a));if(_0x11172a[_0x47c2('0xf')]){if(_0x11172a[_0x47c2('0xf')][_0x47c2('0x10')]===0x1f4){logger[_0x47c2('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x2d477f,_0x11172a[_0x47c2('0xf')][_0x47c2('0x11')]);return _0x241961(_0x11172a['error']['message']);}logger[_0x47c2('0xf')](_0x47c2('0xb'),_0x2d477f,_0x11172a[_0x47c2('0xf')]['message']);return _0x186644(_0x11172a['error']['message']);}else{logger[_0x47c2('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'));_0x186644(_0x11172a[_0x47c2('0x13')][_0x47c2('0x11')]);}})[_0x47c2('0x14')](function(_0x4a3866){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2d477f,_0x4a3866);_0x241961(_0x4a3866);});});} \ No newline at end of file +var _0x0040=['catch','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x75267d,_0x5d286c){var _0x21ccec=function(_0x1a3c1f){while(--_0x1a3c1f){_0x75267d['push'](_0x75267d['shift']());}};_0x21ccec(++_0x5d286c);}(_0x0040,0x157));var _0x0004=function(_0x1e203a,_0x397111){_0x1e203a=_0x1e203a-0x0;var _0x2a5006=_0x0040[_0x1e203a];return _0x2a5006;};'use strict';var _=require('lodash');var util=require(_0x0004('0x0'));var moment=require('moment');var BPromise=require(_0x0004('0x1'));var rs=require(_0x0004('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0004('0x3'));var logger=require(_0x0004('0x4'))('rpc');var config=require(_0x0004('0x5'));var jayson=require(_0x0004('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7917dc,_0x14addb,_0x15d518){return new BPromise(function(_0x56b42a,_0x1ee4bf){return client['request'](_0x7917dc,_0x15d518)['then'](function(_0x448c88){logger[_0x0004('0x7')](_0x0004('0x8'),_0x14addb,_0x0004('0x9'));logger[_0x0004('0xa')](_0x0004('0xb'),_0x14addb,_0x0004('0x9'),JSON[_0x0004('0xc')](_0x448c88));if(_0x448c88['error']){if(_0x448c88[_0x0004('0xd')][_0x0004('0xe')]===0x1f4){logger[_0x0004('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x14addb,_0x448c88[_0x0004('0xd')]['message']);return _0x1ee4bf(_0x448c88[_0x0004('0xd')]['message']);}logger[_0x0004('0xd')](_0x0004('0x8'),_0x14addb,_0x448c88[_0x0004('0xd')][_0x0004('0xf')]);return _0x56b42a(_0x448c88[_0x0004('0xd')][_0x0004('0xf')]);}else{logger[_0x0004('0x7')](_0x0004('0x8'),_0x14addb,_0x0004('0x9'));_0x56b42a(_0x448c88[_0x0004('0x10')]['message']);}})[_0x0004('0x11')](function(_0x4593f7){logger['error'](_0x0004('0x8'),_0x14addb,_0x4593f7);_0x1ee4bf(_0x4593f7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8c3ce47..af8e7c0 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 _0xd459=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x1907cf,_0x18c318){var _0x16dd6c=function(_0x3e576f){while(--_0x3e576f){_0x1907cf['push'](_0x1907cf['shift']());}};_0x16dd6c(++_0x18c318);}(_0xd459,0x166));var _0x9d45=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd459[_0x4fde08];return _0x12e725;};'use strict';var multer=require(_0x9d45('0x0'));var util=require(_0x9d45('0x1'));var path=require(_0x9d45('0x2'));var timeout=require(_0x9d45('0x3'));var express=require('express');var router=express[_0x9d45('0x4')]();var fs_extra=require(_0x9d45('0x5'));var auth=require(_0x9d45('0x6'));var interaction=require(_0x9d45('0x7'));var config=require('../../config/environment');var controller=require(_0x9d45('0x8'));router[_0x9d45('0x9')]('/',auth[_0x9d45('0xa')](),controller[_0x9d45('0xb')]);router['get'](_0x9d45('0xc'),auth[_0x9d45('0xa')](),controller[_0x9d45('0xd')]);router[_0x9d45('0x9')](_0x9d45('0xe'),auth[_0x9d45('0xa')](),controller[_0x9d45('0xf')]);router['post']('/',auth[_0x9d45('0xa')](),controller[_0x9d45('0x10')]);router['put'](_0x9d45('0xe'),auth[_0x9d45('0xa')](),controller['update']);router[_0x9d45('0x11')](_0x9d45('0xe'),auth[_0x9d45('0xa')](),controller[_0x9d45('0x12')]);module[_0x9d45('0x13')]=router; \ No newline at end of file +var _0xe0ad=['./mailTransferReport.controller','index','get','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xe0ad,0xca));var _0xde0a=function(_0x42e69d,_0x6d3830){_0x42e69d=_0x42e69d-0x0;var _0xc8000d=_0xe0ad[_0x42e69d];return _0xc8000d;};'use strict';var multer=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var path=require(_0xde0a('0x2'));var timeout=require(_0xde0a('0x3'));var express=require('express');var router=express[_0xde0a('0x4')]();var fs_extra=require(_0xde0a('0x5'));var auth=require(_0xde0a('0x6'));var interaction=require(_0xde0a('0x7'));var config=require('../../config/environment');var controller=require(_0xde0a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xde0a('0x9')]);router[_0xde0a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xde0a('0xb')]);router[_0xde0a('0xa')](_0xde0a('0xc'),auth[_0xde0a('0xd')](),controller[_0xde0a('0xe')]);router[_0xde0a('0xf')]('/',auth[_0xde0a('0xd')](),controller['create']);router[_0xde0a('0x10')](_0xde0a('0xc'),auth[_0xde0a('0xd')](),controller[_0xde0a('0x11')]);router[_0xde0a('0x12')]('/:id',auth[_0xde0a('0xd')](),controller[_0xde0a('0x13')]);module[_0xde0a('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 f253df5..99e9e86 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x115966,_0x47faf0){var _0x54b11b=function(_0x347335){while(--_0x347335){_0x115966['push'](_0x115966['shift']());}};_0x54b11b(++_0x47faf0);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5193a6,_0x406718){var _0x37d331=function(_0x13ec2a){while(--_0x13ec2a){_0x5193a6['push'](_0x5193a6['shift']());}};_0x37d331(++_0x406718);}(_0x70e0,0x17b));var _0x070e=function(_0x3a4376,_0x1268d0){_0x3a4376=_0x3a4376-0x0;var _0x23b383=_0x70e0[_0x3a4376];return _0x23b383;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 41b6a2e..85fca03 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 _0x0ca8=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x183d87,_0x4b69c9){var _0xb00f7a=function(_0xb7e09f){while(--_0xb7e09f){_0x183d87['push'](_0x183d87['shift']());}};_0xb00f7a(++_0x4b69c9);}(_0x0ca8,0x11d));var _0x80ca=function(_0x22ab3c,_0x5a2d84){_0x22ab3c=_0x22ab3c-0x0;var _0x2e3677=_0x0ca8[_0x22ab3c];return _0x2e3677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80ca('0x0'));var zipdir=require(_0x80ca('0x1'));var jsonpatch=require(_0x80ca('0x2'));var rp=require(_0x80ca('0x3'));var moment=require(_0x80ca('0x4'));var BPromise=require(_0x80ca('0x5'));var Mustache=require(_0x80ca('0x6'));var util=require(_0x80ca('0x7'));var path=require(_0x80ca('0x8'));var sox=require(_0x80ca('0x9'));var csv=require(_0x80ca('0xa'));var ejs=require(_0x80ca('0xb'));var fs=require('fs');var fs_extra=require(_0x80ca('0xc'));var _=require(_0x80ca('0xd'));var squel=require(_0x80ca('0xe'));var crypto=require(_0x80ca('0xf'));var jsforce=require(_0x80ca('0x10'));var deskjs=require(_0x80ca('0x11'));var toCsv=require(_0x80ca('0xa'));var querystring=require(_0x80ca('0x12'));var Papa=require('papaparse');var Redis=require(_0x80ca('0x13'));var authService=require(_0x80ca('0x14'));var qs=require(_0x80ca('0x15'));var as=require(_0x80ca('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80ca('0x17'))(_0x80ca('0x18'));var utils=require('../../config/utils');var config=require(_0x80ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10c8d4,_0x297669){_0x297669=_0x297669||0xcc;return function(_0x59f24b){if(_0x59f24b){return _0x10c8d4[_0x80ca('0x1a')](_0x297669);}return _0x10c8d4[_0x80ca('0x1b')](_0x297669)[_0x80ca('0x1c')]();};}function respondWithResult(_0x362693,_0x2407d1){_0x2407d1=_0x2407d1||0xc8;return function(_0xe8211b){if(_0xe8211b){return _0x362693['status'](_0x2407d1)[_0x80ca('0x1d')](_0xe8211b);}};}function respondWithFilteredResult(_0x2640eb,_0xbfadf3){return function(_0x3d62c2){if(_0x3d62c2){var _0x21b620=typeof _0xbfadf3[_0x80ca('0x1e')]===_0x80ca('0x1f')&&typeof _0xbfadf3[_0x80ca('0x20')]===_0x80ca('0x1f');var _0x2263ef=_0x3d62c2[_0x80ca('0x21')];var _0xa4cc5f=_0x21b620?0x0:_0xbfadf3[_0x80ca('0x1e')];var _0x2382ea=_0x21b620?_0x3d62c2[_0x80ca('0x21')]:_0xbfadf3[_0x80ca('0x1e')]+_0xbfadf3[_0x80ca('0x20')];var _0x5802ac;if(_0x2382ea>=_0x2263ef){_0x2382ea=_0x2263ef;_0x5802ac=0xc8;}else{_0x5802ac=0xce;}_0x2640eb[_0x80ca('0x1b')](_0x5802ac);return _0x2640eb[_0x80ca('0x22')](_0x80ca('0x23'),_0xa4cc5f+'-'+_0x2382ea+'/'+_0x2263ef)[_0x80ca('0x1d')](_0x3d62c2);}return null;};}function patchUpdates(_0x2d0d9a){return function(_0x5d29d5){try{jsonpatch[_0x80ca('0x24')](_0x5d29d5,_0x2d0d9a,!![]);}catch(_0x41be08){return BPromise[_0x80ca('0x25')](_0x41be08);}return _0x5d29d5['save']();};}function saveUpdates(_0x166b9f,_0x21614f){return function(_0x58799d){if(_0x58799d){return _0x58799d[_0x80ca('0x26')](_0x166b9f)[_0x80ca('0x27')](function(_0x5a6ad1){return _0x5a6ad1;});}return null;};}function removeEntity(_0x2347c9,_0x1327f1){return function(_0x589454){if(_0x589454){return _0x589454[_0x80ca('0x28')]()['then'](function(){_0x2347c9[_0x80ca('0x1b')](0xcc)[_0x80ca('0x1c')]();});}};}function handleEntityNotFound(_0x1e4562,_0x22b43a){return function(_0x5bef85){if(!_0x5bef85){_0x1e4562[_0x80ca('0x1a')](0x194);}return _0x5bef85;};}function handleError(_0x50fc8a,_0x53590e){_0x53590e=_0x53590e||0x1f4;return function(_0x90727f){logger[_0x80ca('0x29')](_0x90727f[_0x80ca('0x2a')]);if(_0x90727f['name']){delete _0x90727f['name'];}_0x50fc8a['status'](_0x53590e)[_0x80ca('0x2b')](_0x90727f);};}exports[_0x80ca('0x2c')]=function(_0x5b322a,_0x2731e0){var _0x5ad699={},_0x5536d4={},_0x5217a1={'count':0x0,'rows':[]};var _0x4016c3=_[_0x80ca('0x2d')](db[_0x80ca('0x2e')][_0x80ca('0x2f')],function(_0x454508){return{'name':_0x454508[_0x80ca('0x30')],'type':_0x454508['type'][_0x80ca('0x31')]};});_0x5536d4[_0x80ca('0x32')]=_['map'](_0x4016c3,'name');_0x5536d4['query']=_[_0x80ca('0x33')](_0x5b322a['query']);_0x5536d4[_0x80ca('0x34')]=_[_0x80ca('0x35')](_0x5536d4[_0x80ca('0x32')],_0x5536d4[_0x80ca('0x36')]);_0x5ad699[_0x80ca('0x37')]=_[_0x80ca('0x35')](_0x5536d4[_0x80ca('0x32')],qs[_0x80ca('0x38')](_0x5b322a['query'][_0x80ca('0x38')]));_0x5ad699[_0x80ca('0x37')]=_0x5ad699[_0x80ca('0x37')][_0x80ca('0x39')]?_0x5ad699[_0x80ca('0x37')]:_0x5536d4[_0x80ca('0x32')];if(!_0x5b322a[_0x80ca('0x36')][_0x80ca('0x3a')](_0x80ca('0x3b'))){_0x5ad699['limit']=qs[_0x80ca('0x20')](_0x5b322a[_0x80ca('0x36')][_0x80ca('0x20')]);_0x5ad699['offset']=qs['offset'](_0x5b322a[_0x80ca('0x36')][_0x80ca('0x1e')]);}_0x5ad699['order']=qs['sort'](_0x5b322a['query'][_0x80ca('0x3c')]);_0x5ad699[_0x80ca('0x3d')]=qs[_0x80ca('0x34')](_[_0x80ca('0x3e')](_0x5b322a[_0x80ca('0x36')],_0x5536d4[_0x80ca('0x34')]),_0x4016c3);if(_0x5b322a[_0x80ca('0x36')][_0x80ca('0x3f')]){_0x5ad699[_0x80ca('0x3d')]=_[_0x80ca('0x40')](_0x5ad699[_0x80ca('0x3d')],{'$or':_[_0x80ca('0x2d')](_0x4016c3,function(_0x3b4fc1){if(_0x3b4fc1[_0x80ca('0x41')]!==_0x80ca('0x42')){var _0x3b7536={};_0x3b7536[_0x3b4fc1['name']]={'$like':'%'+_0x5b322a['query'][_0x80ca('0x3f')]+'%'};return _0x3b7536;}})});}_0x5ad699=_[_0x80ca('0x40')]({},_0x5ad699,_0x5b322a[_0x80ca('0x43')]);var _0x56af1b={'where':_0x5ad699[_0x80ca('0x3d')]};return db[_0x80ca('0x2e')][_0x80ca('0x21')](_0x56af1b)[_0x80ca('0x27')](function(_0x4bdb37){_0x5217a1[_0x80ca('0x21')]=_0x4bdb37;if(_0x5b322a[_0x80ca('0x36')][_0x80ca('0x44')]){_0x5ad699[_0x80ca('0x45')]=[{'all':!![]}];}return db[_0x80ca('0x2e')][_0x80ca('0x46')](_0x5ad699);})['then'](function(_0x10b009){_0x5217a1[_0x80ca('0x47')]=_0x10b009;return _0x5217a1;})['then'](respondWithFilteredResult(_0x2731e0,_0x5ad699))[_0x80ca('0x48')](handleError(_0x2731e0,null));};exports[_0x80ca('0x49')]=function(_0xf6139b,_0x3093ce){var _0x2587bc={'raw':!![],'where':{'id':_0xf6139b[_0x80ca('0x4a')]['id']}},_0x370637={};_0x370637[_0x80ca('0x32')]=_[_0x80ca('0x33')](db[_0x80ca('0x2e')][_0x80ca('0x2f')]);_0x370637[_0x80ca('0x36')]=_[_0x80ca('0x33')](_0xf6139b['query']);_0x370637[_0x80ca('0x34')]=_[_0x80ca('0x35')](_0x370637[_0x80ca('0x32')],_0x370637[_0x80ca('0x36')]);_0x2587bc[_0x80ca('0x37')]=_[_0x80ca('0x35')](_0x370637[_0x80ca('0x32')],qs['fields'](_0xf6139b[_0x80ca('0x36')][_0x80ca('0x38')]));_0x2587bc[_0x80ca('0x37')]=_0x2587bc[_0x80ca('0x37')][_0x80ca('0x39')]?_0x2587bc[_0x80ca('0x37')]:_0x370637['model'];if(_0xf6139b[_0x80ca('0x36')][_0x80ca('0x44')]){_0x2587bc[_0x80ca('0x45')]=[{'all':!![]}];}_0x2587bc=_[_0x80ca('0x40')]({},_0x2587bc,_0xf6139b[_0x80ca('0x43')]);return db[_0x80ca('0x2e')][_0x80ca('0x4b')](_0x2587bc)[_0x80ca('0x27')](handleEntityNotFound(_0x3093ce,null))['then'](respondWithResult(_0x3093ce,null))[_0x80ca('0x48')](handleError(_0x3093ce,null));};exports[_0x80ca('0x4c')]=function(_0x3d8f0f,_0x167916){return db[_0x80ca('0x2e')][_0x80ca('0x4c')](_0x3d8f0f[_0x80ca('0x4d')],{})['then'](respondWithResult(_0x167916,0xc9))['catch'](handleError(_0x167916,null));};exports[_0x80ca('0x26')]=function(_0x47fc68,_0x3f79ad){if(_0x47fc68[_0x80ca('0x4d')]['id']){delete _0x47fc68['body']['id'];}return db['MailTransferReport'][_0x80ca('0x4b')]({'where':{'id':_0x47fc68[_0x80ca('0x4a')]['id']}})[_0x80ca('0x27')](handleEntityNotFound(_0x3f79ad,null))[_0x80ca('0x27')](saveUpdates(_0x47fc68[_0x80ca('0x4d')],null))[_0x80ca('0x27')](respondWithResult(_0x3f79ad,null))[_0x80ca('0x48')](handleError(_0x3f79ad,null));};exports[_0x80ca('0x28')]=function(_0x55ee9d,_0x13fde0){return db['MailTransferReport'][_0x80ca('0x4b')]({'where':{'id':_0x55ee9d['params']['id']}})[_0x80ca('0x27')](handleEntityNotFound(_0x13fde0,null))['then'](removeEntity(_0x13fde0,null))[_0x80ca('0x48')](handleError(_0x13fde0,null));};exports['describe']=function(_0x42c484,_0x5464ff){return db[_0x80ca('0x2e')][_0x80ca('0x4e')]()[_0x80ca('0x27')](respondWithResult(_0x5464ff,null))[_0x80ca('0x48')](handleError(_0x5464ff,null));}; \ No newline at end of file +var _0x01be=['fieldName','type','key','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','attributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','MailTransferReport','rawAttributes'];(function(_0x3f5896,_0x8873d){var _0x5c4b2e=function(_0x2e0dc4){while(--_0x2e0dc4){_0x3f5896['push'](_0x3f5896['shift']());}};_0x5c4b2e(++_0x8873d);}(_0x01be,0x105));var _0xe01b=function(_0x48cc9e,_0x558d7f){_0x48cc9e=_0x48cc9e-0x0;var _0x3ff206=_0x01be[_0x48cc9e];return _0x3ff206;};'use strict';var emlformat=require(_0xe01b('0x0'));var rimraf=require(_0xe01b('0x1'));var zipdir=require(_0xe01b('0x2'));var jsonpatch=require(_0xe01b('0x3'));var rp=require(_0xe01b('0x4'));var moment=require(_0xe01b('0x5'));var BPromise=require(_0xe01b('0x6'));var Mustache=require(_0xe01b('0x7'));var util=require('util');var path=require(_0xe01b('0x8'));var sox=require(_0xe01b('0x9'));var csv=require(_0xe01b('0xa'));var ejs=require(_0xe01b('0xb'));var fs=require('fs');var fs_extra=require(_0xe01b('0xc'));var _=require(_0xe01b('0xd'));var squel=require('squel');var crypto=require(_0xe01b('0xe'));var jsforce=require(_0xe01b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe01b('0xa'));var querystring=require(_0xe01b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe01b('0x11'));var authService=require(_0xe01b('0x12'));var qs=require(_0xe01b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01b('0x14'))(_0xe01b('0x15'));var utils=require(_0xe01b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe01b('0x17'));var db=require(_0xe01b('0x18'))['db'];function respondWithStatusCode(_0x3a70bb,_0x3f18fd){_0x3f18fd=_0x3f18fd||0xcc;return function(_0x5b2d18){if(_0x5b2d18){return _0x3a70bb[_0xe01b('0x19')](_0x3f18fd);}return _0x3a70bb[_0xe01b('0x1a')](_0x3f18fd)[_0xe01b('0x1b')]();};}function respondWithResult(_0x33fe93,_0x1a6f88){_0x1a6f88=_0x1a6f88||0xc8;return function(_0x4df404){if(_0x4df404){return _0x33fe93['status'](_0x1a6f88)[_0xe01b('0x1c')](_0x4df404);}};}function respondWithFilteredResult(_0x25bc9f,_0x1c0933){return function(_0x55bf36){if(_0x55bf36){var _0x56e284=typeof _0x1c0933[_0xe01b('0x1d')]===_0xe01b('0x1e')&&typeof _0x1c0933[_0xe01b('0x1f')]==='undefined';var _0x17cd8e=_0x55bf36[_0xe01b('0x20')];var _0x315519=_0x56e284?0x0:_0x1c0933[_0xe01b('0x1d')];var _0x3c1224=_0x56e284?_0x55bf36[_0xe01b('0x20')]:_0x1c0933[_0xe01b('0x1d')]+_0x1c0933['limit'];var _0x2c396b;if(_0x3c1224>=_0x17cd8e){_0x3c1224=_0x17cd8e;_0x2c396b=0xc8;}else{_0x2c396b=0xce;}_0x25bc9f['status'](_0x2c396b);return _0x25bc9f[_0xe01b('0x21')](_0xe01b('0x22'),_0x315519+'-'+_0x3c1224+'/'+_0x17cd8e)[_0xe01b('0x1c')](_0x55bf36);}return null;};}function patchUpdates(_0x195902){return function(_0x47eb63){try{jsonpatch[_0xe01b('0x23')](_0x47eb63,_0x195902,!![]);}catch(_0x415cb5){return BPromise[_0xe01b('0x24')](_0x415cb5);}return _0x47eb63[_0xe01b('0x25')]();};}function saveUpdates(_0x2644dc,_0x404aaa){return function(_0x48ce15){if(_0x48ce15){return _0x48ce15[_0xe01b('0x26')](_0x2644dc)[_0xe01b('0x27')](function(_0x477ddb){return _0x477ddb;});}return null;};}function removeEntity(_0x2cd400,_0x2f4fb0){return function(_0x268972){if(_0x268972){return _0x268972[_0xe01b('0x28')]()['then'](function(){_0x2cd400[_0xe01b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d62e,_0x5af0a4){return function(_0x919906){if(!_0x919906){_0x42d62e[_0xe01b('0x19')](0x194);}return _0x919906;};}function handleError(_0x3b8391,_0x5efb3b){_0x5efb3b=_0x5efb3b||0x1f4;return function(_0x3b322a){logger['error'](_0x3b322a['stack']);if(_0x3b322a[_0xe01b('0x29')]){delete _0x3b322a[_0xe01b('0x29')];}_0x3b8391['status'](_0x5efb3b)[_0xe01b('0x2a')](_0x3b322a);};}exports[_0xe01b('0x2b')]=function(_0x3f7d2a,_0x4361da){var _0x1a48f6={},_0x15799e={},_0x530f3b={'count':0x0,'rows':[]};var _0x17e1d1=_[_0xe01b('0x2c')](db[_0xe01b('0x2d')][_0xe01b('0x2e')],function(_0x5f2a6c){return{'name':_0x5f2a6c[_0xe01b('0x2f')],'type':_0x5f2a6c[_0xe01b('0x30')][_0xe01b('0x31')]};});_0x15799e[_0xe01b('0x32')]=_[_0xe01b('0x2c')](_0x17e1d1,_0xe01b('0x29'));_0x15799e[_0xe01b('0x33')]=_[_0xe01b('0x34')](_0x3f7d2a[_0xe01b('0x33')]);_0x15799e['filters']=_[_0xe01b('0x35')](_0x15799e[_0xe01b('0x32')],_0x15799e[_0xe01b('0x33')]);_0x1a48f6['attributes']=_[_0xe01b('0x35')](_0x15799e['model'],qs[_0xe01b('0x36')](_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x36')]));_0x1a48f6['attributes']=_0x1a48f6['attributes'][_0xe01b('0x37')]?_0x1a48f6['attributes']:_0x15799e['model'];if(!_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x38')](_0xe01b('0x39'))){_0x1a48f6['limit']=qs[_0xe01b('0x1f')](_0x3f7d2a[_0xe01b('0x33')]['limit']);_0x1a48f6[_0xe01b('0x1d')]=qs[_0xe01b('0x1d')](_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x1d')]);}_0x1a48f6[_0xe01b('0x3a')]=qs['sort'](_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x3b')]);_0x1a48f6[_0xe01b('0x3c')]=qs[_0xe01b('0x3d')](_['pick'](_0x3f7d2a[_0xe01b('0x33')],_0x15799e[_0xe01b('0x3d')]),_0x17e1d1);if(_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x3e')]){_0x1a48f6[_0xe01b('0x3c')]=_[_0xe01b('0x3f')](_0x1a48f6['where'],{'$or':_[_0xe01b('0x2c')](_0x17e1d1,function(_0xb95bcc){if(_0xb95bcc[_0xe01b('0x30')]!==_0xe01b('0x40')){var _0x110340={};_0x110340[_0xb95bcc[_0xe01b('0x29')]]={'$like':'%'+_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x3e')]+'%'};return _0x110340;}})});}_0x1a48f6=_['merge']({},_0x1a48f6,_0x3f7d2a[_0xe01b('0x41')]);var _0x56eefd={'where':_0x1a48f6[_0xe01b('0x3c')]};return db['MailTransferReport'][_0xe01b('0x20')](_0x56eefd)['then'](function(_0x386135){_0x530f3b[_0xe01b('0x20')]=_0x386135;if(_0x3f7d2a[_0xe01b('0x33')][_0xe01b('0x42')]){_0x1a48f6[_0xe01b('0x43')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x1a48f6);})[_0xe01b('0x27')](function(_0x18958d){_0x530f3b[_0xe01b('0x44')]=_0x18958d;return _0x530f3b;})[_0xe01b('0x27')](respondWithFilteredResult(_0x4361da,_0x1a48f6))[_0xe01b('0x45')](handleError(_0x4361da,null));};exports[_0xe01b('0x46')]=function(_0xf25619,_0x4a8a01){var _0x38cea2={'raw':!![],'where':{'id':_0xf25619['params']['id']}},_0x2e4ef1={};_0x2e4ef1[_0xe01b('0x32')]=_[_0xe01b('0x34')](db[_0xe01b('0x2d')][_0xe01b('0x2e')]);_0x2e4ef1[_0xe01b('0x33')]=_[_0xe01b('0x34')](_0xf25619[_0xe01b('0x33')]);_0x2e4ef1[_0xe01b('0x3d')]=_[_0xe01b('0x35')](_0x2e4ef1[_0xe01b('0x32')],_0x2e4ef1[_0xe01b('0x33')]);_0x38cea2['attributes']=_[_0xe01b('0x35')](_0x2e4ef1[_0xe01b('0x32')],qs[_0xe01b('0x36')](_0xf25619[_0xe01b('0x33')][_0xe01b('0x36')]));_0x38cea2[_0xe01b('0x47')]=_0x38cea2[_0xe01b('0x47')]['length']?_0x38cea2[_0xe01b('0x47')]:_0x2e4ef1[_0xe01b('0x32')];if(_0xf25619[_0xe01b('0x33')]['includeAll']){_0x38cea2[_0xe01b('0x43')]=[{'all':!![]}];}_0x38cea2=_[_0xe01b('0x3f')]({},_0x38cea2,_0xf25619['options']);return db[_0xe01b('0x2d')][_0xe01b('0x48')](_0x38cea2)[_0xe01b('0x27')](handleEntityNotFound(_0x4a8a01,null))[_0xe01b('0x27')](respondWithResult(_0x4a8a01,null))['catch'](handleError(_0x4a8a01,null));};exports[_0xe01b('0x49')]=function(_0x47dcca,_0x4f33a2){return db[_0xe01b('0x2d')][_0xe01b('0x49')](_0x47dcca[_0xe01b('0x4a')],{})[_0xe01b('0x27')](respondWithResult(_0x4f33a2,0xc9))[_0xe01b('0x45')](handleError(_0x4f33a2,null));};exports[_0xe01b('0x26')]=function(_0x3dddf9,_0x46309f){if(_0x3dddf9['body']['id']){delete _0x3dddf9['body']['id'];}return db['MailTransferReport'][_0xe01b('0x48')]({'where':{'id':_0x3dddf9[_0xe01b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46309f,null))['then'](saveUpdates(_0x3dddf9[_0xe01b('0x4a')],null))[_0xe01b('0x27')](respondWithResult(_0x46309f,null))[_0xe01b('0x45')](handleError(_0x46309f,null));};exports[_0xe01b('0x28')]=function(_0x291018,_0x2b6029){return db[_0xe01b('0x2d')][_0xe01b('0x48')]({'where':{'id':_0x291018['params']['id']}})['then'](handleEntityNotFound(_0x2b6029,null))[_0xe01b('0x27')](removeEntity(_0x2b6029,null))[_0xe01b('0x45')](handleError(_0x2b6029,null));};exports['describe']=function(_0x450b36,_0x21a6e8){return db['MailTransferReport'][_0xe01b('0x4c')]()[_0xe01b('0x27')](respondWithResult(_0x21a6e8,null))[_0xe01b('0x45')](handleError(_0x21a6e8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 67497c6..574ad75 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 _0x655d=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailTransferReport.attributes','define'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x655d,0x13b));var _0xd655=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x655d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var logger=require(_0xd655('0x2'))(_0xd655('0x3'));var moment=require(_0xd655('0x4'));var BPromise=require(_0xd655('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd655('0x6'));var rimraf=require(_0xd655('0x7'));var config=require('../../config/environment');var attributes=require(_0xd655('0x8'));module['exports']=function(_0x1a2ecb,_0x1c3f69){return _0x1a2ecb[_0xd655('0x9')](_0xd655('0xa'),attributes,{'tableName':_0xd655('0xb'),'paranoid':![],'indexes':[{'name':_0xd655('0xc'),'fields':[_0xd655('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd51f=['api','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x34756e,_0x3c036a){var _0x365e63=function(_0xc96601){while(--_0xc96601){_0x34756e['push'](_0x34756e['shift']());}};_0x365e63(++_0x3c036a);}(_0xd51f,0xf0));var _0xfd51=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd51f[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var logger=require('../../config/logger')(_0xfd51('0x2'));var moment=require(_0xfd51('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd51('0x4'));var fs=require('fs');var path=require(_0xfd51('0x5'));var rimraf=require('rimraf');var config=require(_0xfd51('0x6'));var attributes=require(_0xfd51('0x7'));module['exports']=function(_0x3e3517,_0x3a2cd4){return _0x3e3517['define'](_0xfd51('0x8'),attributes,{'tableName':_0xfd51('0x9'),'paranoid':![],'indexes':[{'name':_0xfd51('0xa'),'fields':[_0xfd51('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 911c775..bafd303 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 _0xa8b5=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x4b0959,_0x18238b){var _0x3fd8a7=function(_0x15f1b7){while(--_0x15f1b7){_0x4b0959['push'](_0x4b0959['shift']());}};_0x3fd8a7(++_0x18238b);}(_0xa8b5,0x67));var _0x5a8b=function(_0x1a8739,_0x52cff9){_0x1a8739=_0x1a8739-0x0;var _0xe83276=_0xa8b5[_0x1a8739];return _0xe83276;};'use strict';var _=require(_0x5a8b('0x0'));var util=require(_0x5a8b('0x1'));var moment=require(_0x5a8b('0x2'));var BPromise=require(_0x5a8b('0x3'));var rs=require(_0x5a8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a8b('0x5'))['db'];var utils=require(_0x5a8b('0x6'));var logger=require(_0x5a8b('0x7'))(_0x5a8b('0x8'));var config=require(_0x5a8b('0x9'));var jayson=require(_0x5a8b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4107b8,_0x1c0883,_0x997dd2){return new BPromise(function(_0x4ac8b7,_0x3e1455){return client[_0x5a8b('0xb')](_0x4107b8,_0x997dd2)[_0x5a8b('0xc')](function(_0x3bc5ca){logger[_0x5a8b('0xd')](_0x5a8b('0xe'),_0x1c0883,_0x5a8b('0xf'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x1c0883,_0x5a8b('0xf'),JSON['stringify'](_0x3bc5ca));if(_0x3bc5ca['error']){if(_0x3bc5ca[_0x5a8b('0x10')][_0x5a8b('0x11')]===0x1f4){logger[_0x5a8b('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x1c0883,_0x3bc5ca['error'][_0x5a8b('0x12')]);return _0x3e1455(_0x3bc5ca[_0x5a8b('0x10')][_0x5a8b('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x1c0883,_0x3bc5ca[_0x5a8b('0x10')][_0x5a8b('0x12')]);return _0x4ac8b7(_0x3bc5ca['error'][_0x5a8b('0x12')]);}else{logger[_0x5a8b('0xd')](_0x5a8b('0xe'),_0x1c0883,_0x5a8b('0xf'));_0x4ac8b7(_0x3bc5ca[_0x5a8b('0x13')][_0x5a8b('0x12')]);}})[_0x5a8b('0x14')](function(_0x4c77f7){logger[_0x5a8b('0x10')](_0x5a8b('0xe'),_0x1c0883,_0x4c77f7);_0x3e1455(_0x4c77f7);});});} \ No newline at end of file +var _0x1c50=['stringify','error','code','message','result','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x1c50,0x16e));var _0x01c5=function(_0x537927,_0xf9443f){_0x537927=_0x537927-0x0;var _0x5622b1=_0x1c50[_0x537927];return _0x5622b1;};'use strict';var _=require(_0x01c5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01c5('0x1'));var db=require(_0x01c5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x01c5('0x3'))(_0x01c5('0x4'));var config=require(_0x01c5('0x5'));var jayson=require(_0x01c5('0x6'));var client=jayson[_0x01c5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300be3,_0x262580,_0x55f995){return new BPromise(function(_0x48d5b5,_0x5ad557){return client[_0x01c5('0x8')](_0x300be3,_0x55f995)[_0x01c5('0x9')](function(_0x42655b){logger[_0x01c5('0xa')](_0x01c5('0xb'),_0x262580,_0x01c5('0xc'));logger['debug'](_0x01c5('0xd'),_0x262580,_0x01c5('0xc'),JSON[_0x01c5('0xe')](_0x42655b));if(_0x42655b[_0x01c5('0xf')]){if(_0x42655b[_0x01c5('0xf')][_0x01c5('0x10')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x262580,_0x42655b[_0x01c5('0xf')][_0x01c5('0x11')]);return _0x5ad557(_0x42655b['error'][_0x01c5('0x11')]);}logger[_0x01c5('0xf')](_0x01c5('0xb'),_0x262580,_0x42655b[_0x01c5('0xf')]['message']);return _0x48d5b5(_0x42655b[_0x01c5('0xf')][_0x01c5('0x11')]);}else{logger[_0x01c5('0xa')](_0x01c5('0xb'),_0x262580,_0x01c5('0xc'));_0x48d5b5(_0x42655b[_0x01c5('0x12')][_0x01c5('0x11')]);}})['catch'](function(_0x539000){logger['error'](_0x01c5('0xb'),_0x262580,_0x539000);_0x5ad557(_0x539000);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 34dd2a5..1fc2d2e 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 _0x61dc=['destroy','exports','multer','util','path','fs-extra','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x2e74ee,_0x450916){var _0x7aa215=function(_0x4588f0){while(--_0x4588f0){_0x2e74ee['push'](_0x2e74ee['shift']());}};_0x7aa215(++_0x450916);}(_0x61dc,0xce));var _0xc61d=function(_0x22499a,_0x431a5c){_0x22499a=_0x22499a-0x0;var _0x4cc7f8=_0x61dc[_0x22499a];return _0x4cc7f8;};'use strict';var multer=require(_0xc61d('0x0'));var util=require(_0xc61d('0x1'));var path=require(_0xc61d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc61d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc61d('0x4'));router[_0xc61d('0x5')]('/',auth[_0xc61d('0x6')](),controller['index']);router[_0xc61d('0x5')](_0xc61d('0x7'),auth[_0xc61d('0x6')](),controller[_0xc61d('0x8')]);router[_0xc61d('0x5')](_0xc61d('0x9'),auth[_0xc61d('0x6')](),controller[_0xc61d('0xa')]);router[_0xc61d('0xb')]('/',auth[_0xc61d('0x6')](),controller['create']);router[_0xc61d('0xc')](_0xc61d('0x9'),auth[_0xc61d('0x6')](),controller[_0xc61d('0xd')]);router[_0xc61d('0xe')](_0xc61d('0x9'),auth[_0xc61d('0x6')](),controller[_0xc61d('0xf')]);module[_0xc61d('0x10')]=router; \ No newline at end of file +var _0x3699=['index','get','describe','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3699,0x1c9));var _0x9369=function(_0x33d8d4,_0x9f0c30){_0x33d8d4=_0x33d8d4-0x0;var _0x4c4d94=_0x3699[_0x33d8d4];return _0x4c4d94;};'use strict';var multer=require(_0x9369('0x0'));var util=require(_0x9369('0x1'));var path=require(_0x9369('0x2'));var timeout=require(_0x9369('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9369('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9369('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x9369('0x6')](),controller[_0x9369('0x7')]);router[_0x9369('0x8')]('/describe',auth[_0x9369('0x6')](),controller[_0x9369('0x9')]);router[_0x9369('0x8')](_0x9369('0xa'),auth['isAuthenticated'](),controller[_0x9369('0xb')]);router['post']('/',auth[_0x9369('0x6')](),controller[_0x9369('0xc')]);router['put'](_0x9369('0xa'),auth[_0x9369('0x6')](),controller['update']);router[_0x9369('0xd')](_0x9369('0xa'),auth['isAuthenticated'](),controller[_0x9369('0xe')]);module[_0x9369('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 06ae1bb..ddaf45e 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 _0x44d4=['talk:[destination]','talk:[dial\x20string]','sequelize','STRING','INTEGER','DATE','getDataValue','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x18d95a,_0x35591a){var _0x28045d=function(_0x191d54){while(--_0x191d54){_0x18d95a['push'](_0x18d95a['shift']());}};_0x28045d(++_0x35591a);}(_0x44d4,0x161));var _0x444d=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0x44d4[_0x390b40];return _0x11a416;};'use strict';var Sequelize=require(_0x444d('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x444d('0x1')]},'interface':{'type':Sequelize[_0x444d('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x444d('0x2')]},'enterAt':{'type':Sequelize[_0x444d('0x3')]},'exitAt':{'type':Sequelize[_0x444d('0x3')],'set':function(_0x24f601){var _0x45dfdb=moment(_0x24f601);var _0x33fe8c=moment(this[_0x444d('0x4')]('enterAt'));var _0x38938a=_0x45dfdb['diff'](_0x33fe8c,_0x444d('0x5'));this[_0x444d('0x6')](_0x444d('0x7'),_0x24f601);this[_0x444d('0x6')](_0x444d('0x8'),_0x38938a||null);}},'data1':{'type':Sequelize[_0x444d('0x1')],'comment':_0x444d('0x9')},'data2':{'type':Sequelize[_0x444d('0x1')],'comment':_0x444d('0xa')},'data3':{'type':Sequelize[_0x444d('0x1')],'comment':_0x444d('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0x444d('0xc')},'data5':{'type':Sequelize[_0x444d('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x444d('0x1')]},'internal':{'type':Sequelize[_0x444d('0x2')]},'uniqueid':{'type':Sequelize[_0x444d('0x1')]}}; \ No newline at end of file +var _0x639a=['INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x639a,0xec));var _0xa639=function(_0x6e3386,_0x5f5c1b){_0x6e3386=_0x6e3386-0x0;var _0x443df1=_0x639a[_0x6e3386];return _0x443df1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa639('0x0'));module[_0xa639('0x1')]={'channel':{'type':Sequelize[_0xa639('0x2')]},'membername':{'type':Sequelize[_0xa639('0x2')]},'interface':{'type':Sequelize[_0xa639('0x2')]},'type':{'type':Sequelize[_0xa639('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xa639('0x3')},'duration':{'type':Sequelize[_0xa639('0x4')]},'enterAt':{'type':Sequelize[_0xa639('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xa1931a){var _0x21aca9=moment(_0xa1931a);var _0x29d2e4=moment(this[_0xa639('0x6')]('enterAt'));var _0xfb7f17=_0x21aca9[_0xa639('0x7')](_0x29d2e4,_0xa639('0x8'));this[_0xa639('0x9')](_0xa639('0xa'),_0xa1931a);this[_0xa639('0x9')](_0xa639('0xb'),_0xfb7f17||null);}},'data1':{'type':Sequelize[_0xa639('0x2')],'comment':_0xa639('0xc')},'data2':{'type':Sequelize[_0xa639('0x2')],'comment':_0xa639('0xd')},'data3':{'type':Sequelize[_0xa639('0x2')],'comment':_0xa639('0xe')},'data4':{'type':Sequelize[_0xa639('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xa639('0x2')]},'internal':{'type':Sequelize[_0xa639('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 2c93050..2d9bd3b 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xedd9,0xfc));var _0x9edd=function(_0x4afe44,_0x1d5e4d){_0x4afe44=_0x4afe44-0x0;var _0x49e2f6=_0xedd9[_0x4afe44];return _0x49e2f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x3e74,0x175));var _0x43e7=function(_0xb0c0b9,_0x2a0d1d){_0xb0c0b9=_0xb0c0b9-0x0;var _0x12c1ca=_0x3e74[_0xb0c0b9];return _0x12c1ca;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d0a93a0..625fc05 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 _0xfaf1=['interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x16d3a6,_0x22ba0f){var _0x344f95=function(_0x2ad5d5){while(--_0x2ad5d5){_0x16d3a6['push'](_0x16d3a6['shift']());}};_0x344f95(++_0x22ba0f);}(_0xfaf1,0xd3));var _0x1faf=function(_0x57961e,_0x149f3a){_0x57961e=_0x57961e-0x0;var _0x49a42b=_0xfaf1[_0x57961e];return _0x49a42b;};'use strict';var _=require(_0x1faf('0x0'));var util=require(_0x1faf('0x1'));var logger=require(_0x1faf('0x2'))(_0x1faf('0x3'));var moment=require(_0x1faf('0x4'));var BPromise=require(_0x1faf('0x5'));var rp=require(_0x1faf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1faf('0x7'));module[_0x1faf('0x8')]=function(_0x5cb9c6,_0x47c865){return _0x5cb9c6[_0x1faf('0x9')](_0x1faf('0xa'),attributes,{'tableName':_0x1faf('0xb'),'paranoid':![],'indexes':[{'name':_0x1faf('0xc'),'fields':['membername',_0x1faf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39c4=['rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','membername','interface','lodash','api','moment','request-promise','path'];(function(_0x4d7c80,_0x2af89b){var _0x24fcb6=function(_0x3cc104){while(--_0x3cc104){_0x4d7c80['push'](_0x4d7c80['shift']());}};_0x24fcb6(++_0x2af89b);}(_0x39c4,0xdf));var _0x439c=function(_0xdcce44,_0x53d035){_0xdcce44=_0xdcce44-0x0;var _0x54ca1b=_0x39c4[_0xdcce44];return _0x54ca1b;};'use strict';var _=require(_0x439c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x439c('0x1'));var moment=require(_0x439c('0x2'));var BPromise=require('bluebird');var rp=require(_0x439c('0x3'));var fs=require('fs');var path=require(_0x439c('0x4'));var rimraf=require(_0x439c('0x5'));var config=require(_0x439c('0x6'));var attributes=require(_0x439c('0x7'));module['exports']=function(_0x13d2e4,_0x23a055){return _0x13d2e4[_0x439c('0x8')](_0x439c('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x439c('0xa'),_0x439c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 522323b..a7417ae 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 _0xae35=['result','catch','GetMemberReport','MemberReport','options','attributes','limit','include','map','model','then','debug','create','raw','CreateMemberReport','UpdateMemberReport','update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message'];(function(_0x4be3f3,_0x20efd7){var _0x5278b3=function(_0x147367){while(--_0x147367){_0x4be3f3['push'](_0x4be3f3['shift']());}};_0x5278b3(++_0x20efd7);}(_0xae35,0x172));var _0x5ae3=function(_0x1fff0d,_0x5aa59e){_0x1fff0d=_0x1fff0d-0x0;var _0x42d7e9=_0xae35[_0x1fff0d];return _0x42d7e9;};'use strict';var _=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var moment=require(_0x5ae3('0x2'));var BPromise=require(_0x5ae3('0x3'));var rs=require(_0x5ae3('0x4'));var fs=require('fs');var Redis=require(_0x5ae3('0x5'));var db=require(_0x5ae3('0x6'))['db'];var utils=require(_0x5ae3('0x7'));var logger=require('../../config/logger')(_0x5ae3('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ae3('0x9'));var client=jayson[_0x5ae3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e748,_0x1e1d6b,_0x5697d7){return new BPromise(function(_0x1ff692,_0x2c91a0){return client[_0x5ae3('0xb')](_0x45e748,_0x5697d7)['then'](function(_0x36f616){logger[_0x5ae3('0xc')]('MemberReport,\x20%s,\x20%s',_0x1e1d6b,_0x5ae3('0xd'));logger['debug'](_0x5ae3('0xe'),_0x1e1d6b,_0x5ae3('0xd'),JSON[_0x5ae3('0xf')](_0x36f616));if(_0x36f616[_0x5ae3('0x10')]){if(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x11')]===0x1f4){logger['error'](_0x5ae3('0x12'),_0x1e1d6b,_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);return _0x2c91a0(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);}logger[_0x5ae3('0x10')]('MemberReport,\x20%s,\x20%s',_0x1e1d6b,_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);return _0x1ff692(_0x36f616[_0x5ae3('0x10')][_0x5ae3('0x13')]);}else{logger[_0x5ae3('0xc')](_0x5ae3('0x12'),_0x1e1d6b,'request\x20sent');_0x1ff692(_0x36f616[_0x5ae3('0x14')]['message']);}})[_0x5ae3('0x15')](function(_0x5e2470){logger[_0x5ae3('0x10')](_0x5ae3('0x12'),_0x1e1d6b,_0x5e2470);_0x2c91a0(_0x5e2470);});});}exports[_0x5ae3('0x16')]=function(_0x2d8626){var _0x3b34eb=this;return new Promise(function(_0x27be78,_0x1d45bc){return db[_0x5ae3('0x17')]['findAll']({'raw':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')]['where']||null:null,'attributes':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626['options'][_0x5ae3('0x19')]||null:null,'limit':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1a')]||null:null,'include':_0x2d8626[_0x5ae3('0x18')]?_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x2d8626[_0x5ae3('0x18')][_0x5ae3('0x1b')],function(_0x4f97c6){return{'model':db[_0x4f97c6['model']],'as':_0x4f97c6['as'],'attributes':_0x4f97c6[_0x5ae3('0x19')],'include':_0x4f97c6[_0x5ae3('0x1b')]?_['map'](_0x4f97c6[_0x5ae3('0x1b')],function(_0x49ec7b){return{'model':db[_0x49ec7b[_0x5ae3('0x1d')]],'as':_0x49ec7b['as'],'attributes':_0x49ec7b[_0x5ae3('0x19')],'include':_0x49ec7b[_0x5ae3('0x1b')]?_[_0x5ae3('0x1c')](_0x49ec7b['include'],function(_0x1b95ed){return{'model':db[_0x1b95ed[_0x5ae3('0x1d')]],'as':_0x1b95ed['as'],'attributes':_0x1b95ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ae3('0x1e')](function(_0x4dbe22){logger['info'](_0x5ae3('0x16'),_0x2d8626);logger[_0x5ae3('0x1f')]('GetMemberReport',_0x2d8626,JSON[_0x5ae3('0xf')](_0x4dbe22));_0x27be78(_0x4dbe22);})[_0x5ae3('0x15')](function(_0x4c9c7a){logger[_0x5ae3('0x10')](_0x5ae3('0x16'),_0x4c9c7a['message'],_0x2d8626);_0x1d45bc(_0x3b34eb[_0x5ae3('0x10')](0x1f4,_0x4c9c7a[_0x5ae3('0x13')]));});});};exports['CreateMemberReport']=function(_0x37d206){var _0xf0bb19=this;return new Promise(function(_0xabe28a,_0x2217a8){return db[_0x5ae3('0x17')][_0x5ae3('0x20')](_0x37d206['body'],{'raw':_0x37d206[_0x5ae3('0x18')]?_0x37d206[_0x5ae3('0x18')][_0x5ae3('0x21')]===undefined?!![]:![]:!![]})[_0x5ae3('0x1e')](function(_0xb16eff){logger['info'](_0x5ae3('0x22'),_0x37d206);logger['debug']('CreateMemberReport',_0x37d206,JSON[_0x5ae3('0xf')](_0xb16eff));_0xabe28a(_0xb16eff);})[_0x5ae3('0x15')](function(_0x41526f){logger[_0x5ae3('0x10')](_0x5ae3('0x22'),_0x41526f['message'],_0x37d206);_0x2217a8(_0xf0bb19[_0x5ae3('0x10')](0x1f4,_0x41526f[_0x5ae3('0x13')]));});});};exports[_0x5ae3('0x23')]=function(_0x315c59){var _0x682da0=this;return new Promise(function(_0x2875ba,_0x5b66d9){return db['MemberReport'][_0x5ae3('0x24')](_0x315c59[_0x5ae3('0x25')],{'raw':_0x315c59[_0x5ae3('0x18')]?_0x315c59[_0x5ae3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x315c59[_0x5ae3('0x18')]?_0x315c59[_0x5ae3('0x18')][_0x5ae3('0x26')]||null:null,'attributes':_0x315c59[_0x5ae3('0x18')]?_0x315c59['options'][_0x5ae3('0x19')]||null:null,'limit':_0x315c59['options']?_0x315c59['options'][_0x5ae3('0x1a')]||null:null})[_0x5ae3('0x1e')](function(_0x1484df){logger[_0x5ae3('0xc')](_0x5ae3('0x23'),_0x315c59);logger['debug'](_0x5ae3('0x23'),_0x315c59,JSON['stringify'](_0x1484df));_0x2875ba(_0x1484df);})['catch'](function(_0x4cf9f5){logger[_0x5ae3('0x10')](_0x5ae3('0x23'),_0x4cf9f5[_0x5ae3('0x13')],_0x315c59);_0x5b66d9(_0x682da0[_0x5ae3('0x10')](0x1f4,_0x4cf9f5['message']));});});}; \ No newline at end of file +var _0x4fb4=['rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','include','map','model','raw','CreateMemberReport','update','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xad8646,_0x376bbb){var _0x240032=function(_0x507c9a){while(--_0x507c9a){_0xad8646['push'](_0xad8646['shift']());}};_0x240032(++_0x376bbb);}(_0x4fb4,0x190));var _0x44fb=function(_0x4fbbd3,_0x11ddb5){_0x4fbbd3=_0x4fbbd3-0x0;var _0x27427f=_0x4fb4[_0x4fbbd3];return _0x27427f;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var moment=require(_0x44fb('0x1'));var BPromise=require(_0x44fb('0x2'));var rs=require(_0x44fb('0x3'));var fs=require('fs');var Redis=require(_0x44fb('0x4'));var db=require(_0x44fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x44fb('0x6'))(_0x44fb('0x7'));var config=require(_0x44fb('0x8'));var jayson=require(_0x44fb('0x9'));var client=jayson[_0x44fb('0xa')][_0x44fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x464af5,_0x2a4d75,_0x59aa6d){return new BPromise(function(_0x87f716,_0xd4ead0){return client['request'](_0x464af5,_0x59aa6d)[_0x44fb('0xc')](function(_0x3d9002){logger[_0x44fb('0xd')](_0x44fb('0xe'),_0x2a4d75,_0x44fb('0xf'));logger[_0x44fb('0x10')](_0x44fb('0x11'),_0x2a4d75,_0x44fb('0xf'),JSON[_0x44fb('0x12')](_0x3d9002));if(_0x3d9002[_0x44fb('0x13')]){if(_0x3d9002['error'][_0x44fb('0x14')]===0x1f4){logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x3d9002[_0x44fb('0x13')][_0x44fb('0x15')]);return _0xd4ead0(_0x3d9002['error'][_0x44fb('0x15')]);}logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x3d9002[_0x44fb('0x13')][_0x44fb('0x15')]);return _0x87f716(_0x3d9002['error'][_0x44fb('0x15')]);}else{logger[_0x44fb('0xd')](_0x44fb('0xe'),_0x2a4d75,_0x44fb('0xf'));_0x87f716(_0x3d9002[_0x44fb('0x16')][_0x44fb('0x15')]);}})[_0x44fb('0x17')](function(_0x585559){logger[_0x44fb('0x13')](_0x44fb('0xe'),_0x2a4d75,_0x585559);_0xd4ead0(_0x585559);});});}exports[_0x44fb('0x18')]=function(_0x13cf75){var _0x65f887=this;return new Promise(function(_0x22c2eb,_0x19409a){return db[_0x44fb('0x19')][_0x44fb('0x1a')]({'raw':_0x13cf75[_0x44fb('0x1b')]?_0x13cf75['options']['raw']===undefined?!![]:![]:!![],'where':_0x13cf75['options']?_0x13cf75[_0x44fb('0x1b')][_0x44fb('0x1c')]||null:null,'attributes':_0x13cf75[_0x44fb('0x1b')]?_0x13cf75['options'][_0x44fb('0x1d')]||null:null,'limit':_0x13cf75[_0x44fb('0x1b')]?_0x13cf75[_0x44fb('0x1b')]['limit']||null:null,'include':_0x13cf75['options']?_0x13cf75[_0x44fb('0x1b')][_0x44fb('0x1e')]?_[_0x44fb('0x1f')](_0x13cf75['options'][_0x44fb('0x1e')],function(_0x3563a6){return{'model':db[_0x3563a6[_0x44fb('0x20')]],'as':_0x3563a6['as'],'attributes':_0x3563a6['attributes'],'include':_0x3563a6['include']?_[_0x44fb('0x1f')](_0x3563a6[_0x44fb('0x1e')],function(_0x1c831e){return{'model':db[_0x1c831e[_0x44fb('0x20')]],'as':_0x1c831e['as'],'attributes':_0x1c831e['attributes'],'include':_0x1c831e[_0x44fb('0x1e')]?_[_0x44fb('0x1f')](_0x1c831e['include'],function(_0x5b6ce5){return{'model':db[_0x5b6ce5[_0x44fb('0x20')]],'as':_0x5b6ce5['as'],'attributes':_0x5b6ce5[_0x44fb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x44fb('0xc')](function(_0x1f5d4c){logger[_0x44fb('0xd')](_0x44fb('0x18'),_0x13cf75);logger[_0x44fb('0x10')](_0x44fb('0x18'),_0x13cf75,JSON[_0x44fb('0x12')](_0x1f5d4c));_0x22c2eb(_0x1f5d4c);})['catch'](function(_0x48eb7d){logger['error'](_0x44fb('0x18'),_0x48eb7d['message'],_0x13cf75);_0x19409a(_0x65f887[_0x44fb('0x13')](0x1f4,_0x48eb7d[_0x44fb('0x15')]));});});};exports['CreateMemberReport']=function(_0x212b10){var _0x262aa1=this;return new Promise(function(_0xca9051,_0x1b13bb){return db[_0x44fb('0x19')]['create'](_0x212b10['body'],{'raw':_0x212b10[_0x44fb('0x1b')]?_0x212b10['options'][_0x44fb('0x21')]===undefined?!![]:![]:!![]})[_0x44fb('0xc')](function(_0x15aa21){logger[_0x44fb('0xd')](_0x44fb('0x22'),_0x212b10);logger[_0x44fb('0x10')](_0x44fb('0x22'),_0x212b10,JSON[_0x44fb('0x12')](_0x15aa21));_0xca9051(_0x15aa21);})[_0x44fb('0x17')](function(_0x112b5e){logger[_0x44fb('0x13')](_0x44fb('0x22'),_0x112b5e[_0x44fb('0x15')],_0x212b10);_0x1b13bb(_0x262aa1[_0x44fb('0x13')](0x1f4,_0x112b5e[_0x44fb('0x15')]));});});};exports['UpdateMemberReport']=function(_0x5ec419){var _0x47b858=this;return new Promise(function(_0xcc146c,_0x765284){return db[_0x44fb('0x19')][_0x44fb('0x23')](_0x5ec419['body'],{'raw':_0x5ec419[_0x44fb('0x1b')]?_0x5ec419[_0x44fb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ec419[_0x44fb('0x1b')]?_0x5ec419['options'][_0x44fb('0x1c')]||null:null,'attributes':_0x5ec419['options']?_0x5ec419[_0x44fb('0x1b')]['attributes']||null:null,'limit':_0x5ec419[_0x44fb('0x1b')]?_0x5ec419['options']['limit']||null:null})[_0x44fb('0xc')](function(_0x43cc77){logger[_0x44fb('0xd')](_0x44fb('0x24'),_0x5ec419);logger[_0x44fb('0x10')](_0x44fb('0x24'),_0x5ec419,JSON[_0x44fb('0x12')](_0x43cc77));_0xcc146c(_0x43cc77);})[_0x44fb('0x17')](function(_0xb96aa4){logger[_0x44fb('0x13')]('UpdateMemberReport',_0xb96aa4[_0x44fb('0x15')],_0x5ec419);_0x765284(_0x47b858[_0x44fb('0x13')](0x1f4,_0xb96aa4[_0x44fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index ad00da1..6624cd9 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 _0xb8ff=['../../components/auth/service','./migration.controller','get','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x59d1fb,_0x2c61bb){var _0x4bd188=function(_0x2b3c96){while(--_0x2b3c96){_0x59d1fb['push'](_0x59d1fb['shift']());}};_0x4bd188(++_0x2c61bb);}(_0xb8ff,0x180));var _0xfb8f=function(_0x555f92,_0x43e36f){_0x555f92=_0x555f92-0x0;var _0x1bf237=_0xb8ff[_0x555f92];return _0x1bf237;};'use strict';var multer=require('multer');var util=require(_0xfb8f('0x0'));var path=require(_0xfb8f('0x1'));var timeout=require(_0xfb8f('0x2'));var express=require(_0xfb8f('0x3'));var router=express[_0xfb8f('0x4')]();var fs_extra=require(_0xfb8f('0x5'));var auth=require(_0xfb8f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfb8f('0x7'));router[_0xfb8f('0x8')]('/',controller['index']);module[_0xfb8f('0x9')]=router; \ No newline at end of file +var _0xb190=['util','path','connect-timeout','Router','../../components/auth/service','get','index','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb190,0xce));var _0x0b19=function(_0x5a68ba,_0x29927a){_0x5a68ba=_0x5a68ba-0x0;var _0x14e92f=_0xb190[_0x5a68ba];return _0x14e92f;};'use strict';var multer=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var path=require(_0x0b19('0x2'));var timeout=require(_0x0b19('0x3'));var express=require('express');var router=express[_0x0b19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b19('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x0b19('0x6')]('/',controller[_0x0b19('0x7')]);module[_0x0b19('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index ba0a3a2..0293a0f 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 _0x4a3d=['version','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a3d,0x1d8));var _0xd4a3=function(_0x5876b6,_0x3fc875){_0x5876b6=_0x5876b6-0x0;var _0x4d4523=_0x4a3d[_0x5876b6];return _0x4d4523;};'use strict';var Sequelize=require('sequelize');module[_0xd4a3('0x0')]={'version':{'type':Sequelize[_0xd4a3('0x1')],'unique':_0xd4a3('0x2')}}; \ No newline at end of file +var _0xa892=['STRING','version'];(function(_0x23b009,_0xc96d27){var _0x37cd21=function(_0x52c4de){while(--_0x52c4de){_0x23b009['push'](_0x23b009['shift']());}};_0x37cd21(++_0xc96d27);}(_0xa892,0x154));var _0x2a89=function(_0x4e75cf,_0x1ff526){_0x4e75cf=_0x4e75cf-0x0;var _0x4fb151=_0xa892[_0x4e75cf];return _0x4fb151;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x2a89('0x0')],'unique':_0x2a89('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b357abc..0e8b41d 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 _0x2064=['filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','send','index','Migration','rawAttributes','key','model','map','name','query'];(function(_0x39e853,_0x16d356){var _0x3a0ddb=function(_0x3fef8c){while(--_0x3fef8c){_0x39e853['push'](_0x39e853['shift']());}};_0x3a0ddb(++_0x16d356);}(_0x2064,0x15c));var _0x4206=function(_0xc6d32b,_0x608367){_0xc6d32b=_0xc6d32b-0x0;var _0x5d773a=_0x2064[_0xc6d32b];return _0x5d773a;};'use strict';var emlformat=require(_0x4206('0x0'));var rimraf=require(_0x4206('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4206('0x2'));var rp=require(_0x4206('0x3'));var moment=require(_0x4206('0x4'));var BPromise=require(_0x4206('0x5'));var Mustache=require(_0x4206('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4206('0x7'));var csv=require(_0x4206('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4206('0x9'));var _=require('lodash');var squel=require(_0x4206('0xa'));var crypto=require('crypto');var jsforce=require(_0x4206('0xb'));var deskjs=require(_0x4206('0xc'));var toCsv=require(_0x4206('0x8'));var querystring=require(_0x4206('0xd'));var Papa=require('papaparse');var Redis=require(_0x4206('0xe'));var authService=require(_0x4206('0xf'));var qs=require(_0x4206('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4206('0x11'));var logger=require(_0x4206('0x12'))(_0x4206('0x13'));var utils=require(_0x4206('0x14'));var config=require(_0x4206('0x15'));var licenseUtil=require(_0x4206('0x16'));var db=require(_0x4206('0x17'))['db'];function respondWithStatusCode(_0x2c009a,_0x5f3cb2){_0x5f3cb2=_0x5f3cb2||0xcc;return function(_0x24a784){if(_0x24a784){return _0x2c009a[_0x4206('0x18')](_0x5f3cb2);}return _0x2c009a[_0x4206('0x19')](_0x5f3cb2)[_0x4206('0x1a')]();};}function respondWithResult(_0x2d3c76,_0x4aaf32){_0x4aaf32=_0x4aaf32||0xc8;return function(_0xc27d3a){if(_0xc27d3a){return _0x2d3c76[_0x4206('0x19')](_0x4aaf32)[_0x4206('0x1b')](_0xc27d3a);}};}function respondWithFilteredResult(_0xd0f488,_0x1620fd){return function(_0x4ae66e){if(_0x4ae66e){var _0x327413=typeof _0x1620fd[_0x4206('0x1c')]==='undefined'&&typeof _0x1620fd['limit']===_0x4206('0x1d');var _0x5f09dc=_0x4ae66e[_0x4206('0x1e')];var _0x3d7e31=_0x327413?0x0:_0x1620fd[_0x4206('0x1c')];var _0x53bbda=_0x327413?_0x4ae66e[_0x4206('0x1e')]:_0x1620fd['offset']+_0x1620fd['limit'];var _0x32c2ed;if(_0x53bbda>=_0x5f09dc){_0x53bbda=_0x5f09dc;_0x32c2ed=0xc8;}else{_0x32c2ed=0xce;}_0xd0f488[_0x4206('0x19')](_0x32c2ed);return _0xd0f488[_0x4206('0x1f')](_0x4206('0x20'),_0x3d7e31+'-'+_0x53bbda+'/'+_0x5f09dc)['json'](_0x4ae66e);}return null;};}function patchUpdates(_0x2f0516){return function(_0x5077a0){try{jsonpatch['apply'](_0x5077a0,_0x2f0516,!![]);}catch(_0x53d35b){return BPromise[_0x4206('0x21')](_0x53d35b);}return _0x5077a0[_0x4206('0x22')]();};}function saveUpdates(_0x3c4670,_0x1757fa){return function(_0x4a62af){if(_0x4a62af){return _0x4a62af[_0x4206('0x23')](_0x3c4670)['then'](function(_0x16b325){return _0x16b325;});}return null;};}function removeEntity(_0x4d1e4f,_0x2246ab){return function(_0x5e0ea1){if(_0x5e0ea1){return _0x5e0ea1['destroy']()[_0x4206('0x24')](function(){_0x4d1e4f[_0x4206('0x19')](0xcc)[_0x4206('0x1a')]();});}};}function handleEntityNotFound(_0x56d724,_0x1f3501){return function(_0x5b6c4e){if(!_0x5b6c4e){_0x56d724[_0x4206('0x18')](0x194);}return _0x5b6c4e;};}function handleError(_0x1df68f,_0x18e6ea){_0x18e6ea=_0x18e6ea||0x1f4;return function(_0x1092de){logger[_0x4206('0x25')](_0x1092de[_0x4206('0x26')]);if(_0x1092de['name']){delete _0x1092de['name'];}_0x1df68f['status'](_0x18e6ea)[_0x4206('0x27')](_0x1092de);};}exports[_0x4206('0x28')]=function(_0x1d780d,_0x1e6ef8){var _0xacadc5={},_0x35201b={},_0x33058f={'count':0x0,'rows':[]};var _0x255b91=_['map'](db[_0x4206('0x29')][_0x4206('0x2a')],function(_0x2a9be8){return{'name':_0x2a9be8['fieldName'],'type':_0x2a9be8['type'][_0x4206('0x2b')]};});_0x35201b[_0x4206('0x2c')]=_[_0x4206('0x2d')](_0x255b91,_0x4206('0x2e'));_0x35201b[_0x4206('0x2f')]=_['keys'](_0x1d780d['query']);_0x35201b[_0x4206('0x30')]=_[_0x4206('0x31')](_0x35201b[_0x4206('0x2c')],_0x35201b['query']);_0xacadc5['attributes']=_[_0x4206('0x31')](_0x35201b[_0x4206('0x2c')],qs[_0x4206('0x32')](_0x1d780d[_0x4206('0x2f')]['fields']));_0xacadc5['attributes']=_0xacadc5[_0x4206('0x33')][_0x4206('0x34')]?_0xacadc5[_0x4206('0x33')]:_0x35201b['model'];if(!_0x1d780d[_0x4206('0x2f')][_0x4206('0x35')]('nolimit')){_0xacadc5['limit']=qs[_0x4206('0x36')](_0x1d780d[_0x4206('0x2f')][_0x4206('0x36')]);_0xacadc5[_0x4206('0x1c')]=qs['offset'](_0x1d780d['query'][_0x4206('0x1c')]);}_0xacadc5['order']=qs[_0x4206('0x37')](_0x1d780d[_0x4206('0x2f')][_0x4206('0x37')]);_0xacadc5[_0x4206('0x38')]=qs[_0x4206('0x30')](_[_0x4206('0x39')](_0x1d780d[_0x4206('0x2f')],_0x35201b[_0x4206('0x30')]),_0x255b91);if(_0x1d780d[_0x4206('0x2f')][_0x4206('0x3a')]){_0xacadc5[_0x4206('0x38')]=_[_0x4206('0x3b')](_0xacadc5[_0x4206('0x38')],{'$or':_[_0x4206('0x2d')](_0x255b91,function(_0x53be4e){if(_0x53be4e[_0x4206('0x3c')]!==_0x4206('0x3d')){var _0x4f981d={};_0x4f981d[_0x53be4e[_0x4206('0x2e')]]={'$like':'%'+_0x1d780d[_0x4206('0x2f')][_0x4206('0x3a')]+'%'};return _0x4f981d;}})});}_0xacadc5=_['merge']({},_0xacadc5,_0x1d780d[_0x4206('0x3e')]);var _0x31bcb4={'where':_0xacadc5[_0x4206('0x38')]};return db[_0x4206('0x29')][_0x4206('0x1e')](_0x31bcb4)[_0x4206('0x24')](function(_0x11eec3){_0x33058f[_0x4206('0x1e')]=_0x11eec3;if(_0x1d780d[_0x4206('0x2f')][_0x4206('0x3f')]){_0xacadc5[_0x4206('0x40')]=[{'all':!![]}];}return db['Migration'][_0x4206('0x41')](_0xacadc5);})[_0x4206('0x24')](function(_0x2e2b22){_0x33058f['rows']=_0x2e2b22;return _0x33058f;})[_0x4206('0x24')](respondWithFilteredResult(_0x1e6ef8,_0xacadc5))['catch'](handleError(_0x1e6ef8,null));}; \ No newline at end of file +var _0xb2f3=['limit','Content-Range','json','apply','save','update','then','end','error','stack','name','map','Migration','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','rows','catch','zip-dir','moment','mustache','util','sox','ejs','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xb2f3,0x1b9));var _0x3b2f=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb2f3[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b2f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b2f('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3b2f('0x2'));var util=require(_0x3b2f('0x3'));var path=require('path');var sox=require(_0x3b2f('0x4'));var csv=require('to-csv');var ejs=require(_0x3b2f('0x5'));var fs=require('fs');var fs_extra=require(_0x3b2f('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b2f('0x7'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b2f('0x8'));var authService=require(_0x3b2f('0x9'));var qs=require(_0x3b2f('0xa'));var as=require(_0x3b2f('0xb'));var hardwareService=require(_0x3b2f('0xc'));var logger=require(_0x3b2f('0xd'))(_0x3b2f('0xe'));var utils=require(_0x3b2f('0xf'));var config=require(_0x3b2f('0x10'));var licenseUtil=require(_0x3b2f('0x11'));var db=require(_0x3b2f('0x12'))['db'];function respondWithStatusCode(_0x3b736e,_0x2f755f){_0x2f755f=_0x2f755f||0xcc;return function(_0x47172a){if(_0x47172a){return _0x3b736e[_0x3b2f('0x13')](_0x2f755f);}return _0x3b736e[_0x3b2f('0x14')](_0x2f755f)['end']();};}function respondWithResult(_0x29639c,_0x3e46e1){_0x3e46e1=_0x3e46e1||0xc8;return function(_0x57cd66){if(_0x57cd66){return _0x29639c[_0x3b2f('0x14')](_0x3e46e1)['json'](_0x57cd66);}};}function respondWithFilteredResult(_0x204f6c,_0x59d8bb){return function(_0x3e7bab){if(_0x3e7bab){var _0x51cd15=typeof _0x59d8bb[_0x3b2f('0x15')]==='undefined'&&typeof _0x59d8bb['limit']==='undefined';var _0x500624=_0x3e7bab[_0x3b2f('0x16')];var _0x565243=_0x51cd15?0x0:_0x59d8bb[_0x3b2f('0x15')];var _0x38c1c9=_0x51cd15?_0x3e7bab[_0x3b2f('0x16')]:_0x59d8bb[_0x3b2f('0x15')]+_0x59d8bb[_0x3b2f('0x17')];var _0x786332;if(_0x38c1c9>=_0x500624){_0x38c1c9=_0x500624;_0x786332=0xc8;}else{_0x786332=0xce;}_0x204f6c['status'](_0x786332);return _0x204f6c['set'](_0x3b2f('0x18'),_0x565243+'-'+_0x38c1c9+'/'+_0x500624)[_0x3b2f('0x19')](_0x3e7bab);}return null;};}function patchUpdates(_0x2fd0f1){return function(_0x5de36c){try{jsonpatch[_0x3b2f('0x1a')](_0x5de36c,_0x2fd0f1,!![]);}catch(_0x7bcb77){return BPromise['reject'](_0x7bcb77);}return _0x5de36c[_0x3b2f('0x1b')]();};}function saveUpdates(_0x5c9ec4,_0x5c5016){return function(_0x384665){if(_0x384665){return _0x384665[_0x3b2f('0x1c')](_0x5c9ec4)[_0x3b2f('0x1d')](function(_0x1f0f63){return _0x1f0f63;});}return null;};}function removeEntity(_0x4a1449,_0xa72a9a){return function(_0x4317c9){if(_0x4317c9){return _0x4317c9['destroy']()[_0x3b2f('0x1d')](function(){_0x4a1449[_0x3b2f('0x14')](0xcc)[_0x3b2f('0x1e')]();});}};}function handleEntityNotFound(_0xad997e,_0x23cc8c){return function(_0x2ff163){if(!_0x2ff163){_0xad997e[_0x3b2f('0x13')](0x194);}return _0x2ff163;};}function handleError(_0x173395,_0x53b558){_0x53b558=_0x53b558||0x1f4;return function(_0x23a2d3){logger[_0x3b2f('0x1f')](_0x23a2d3[_0x3b2f('0x20')]);if(_0x23a2d3[_0x3b2f('0x21')]){delete _0x23a2d3[_0x3b2f('0x21')];}_0x173395[_0x3b2f('0x14')](_0x53b558)['send'](_0x23a2d3);};}exports['index']=function(_0x55b5d4,_0xfedba1){var _0x3b9510={},_0x5dfcf3={},_0x475799={'count':0x0,'rows':[]};var _0x97f209=_[_0x3b2f('0x22')](db[_0x3b2f('0x23')][_0x3b2f('0x24')],function(_0x118a9e){return{'name':_0x118a9e[_0x3b2f('0x25')],'type':_0x118a9e[_0x3b2f('0x26')]['key']};});_0x5dfcf3[_0x3b2f('0x27')]=_[_0x3b2f('0x22')](_0x97f209,_0x3b2f('0x21'));_0x5dfcf3[_0x3b2f('0x28')]=_['keys'](_0x55b5d4['query']);_0x5dfcf3['filters']=_[_0x3b2f('0x29')](_0x5dfcf3['model'],_0x5dfcf3[_0x3b2f('0x28')]);_0x3b9510[_0x3b2f('0x2a')]=_[_0x3b2f('0x29')](_0x5dfcf3[_0x3b2f('0x27')],qs[_0x3b2f('0x2b')](_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x2b')]));_0x3b9510[_0x3b2f('0x2a')]=_0x3b9510[_0x3b2f('0x2a')][_0x3b2f('0x2c')]?_0x3b9510[_0x3b2f('0x2a')]:_0x5dfcf3[_0x3b2f('0x27')];if(!_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x2d')](_0x3b2f('0x2e'))){_0x3b9510[_0x3b2f('0x17')]=qs[_0x3b2f('0x17')](_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x17')]);_0x3b9510[_0x3b2f('0x15')]=qs[_0x3b2f('0x15')](_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x15')]);}_0x3b9510[_0x3b2f('0x2f')]=qs[_0x3b2f('0x30')](_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x30')]);_0x3b9510['where']=qs['filters'](_['pick'](_0x55b5d4[_0x3b2f('0x28')],_0x5dfcf3[_0x3b2f('0x31')]),_0x97f209);if(_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x32')]){_0x3b9510[_0x3b2f('0x33')]=_[_0x3b2f('0x34')](_0x3b9510['where'],{'$or':_[_0x3b2f('0x22')](_0x97f209,function(_0x5aaa15){if(_0x5aaa15[_0x3b2f('0x26')]!=='VIRTUAL'){var _0x5ef373={};_0x5ef373[_0x5aaa15['name']]={'$like':'%'+_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x32')]+'%'};return _0x5ef373;}})});}_0x3b9510=_[_0x3b2f('0x34')]({},_0x3b9510,_0x55b5d4[_0x3b2f('0x35')]);var _0x4ab31c={'where':_0x3b9510[_0x3b2f('0x33')]};return db[_0x3b2f('0x23')]['count'](_0x4ab31c)[_0x3b2f('0x1d')](function(_0x4eddea){_0x475799[_0x3b2f('0x16')]=_0x4eddea;if(_0x55b5d4[_0x3b2f('0x28')][_0x3b2f('0x36')]){_0x3b9510[_0x3b2f('0x37')]=[{'all':!![]}];}return db[_0x3b2f('0x23')]['findAll'](_0x3b9510);})[_0x3b2f('0x1d')](function(_0x58c5b5){_0x475799[_0x3b2f('0x38')]=_0x58c5b5;return _0x475799;})[_0x3b2f('0x1d')](respondWithFilteredResult(_0xfedba1,_0x3b9510))[_0x3b2f('0x39')](handleError(_0xfedba1,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bf529ea..8e1af68 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 _0x9a3b=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0xf34b2c,_0x16648f){var _0x383177=function(_0x32f0d7){while(--_0x32f0d7){_0xf34b2c['push'](_0xf34b2c['shift']());}};_0x383177(++_0x16648f);}(_0x9a3b,0xa6));var _0xb9a3=function(_0x2051c5,_0x3d235c){_0x2051c5=_0x2051c5-0x0;var _0x146f60=_0x9a3b[_0x2051c5];return _0x146f60;};'use strict';var _=require(_0xb9a3('0x0'));var util=require(_0xb9a3('0x1'));var logger=require(_0xb9a3('0x2'))(_0xb9a3('0x3'));var moment=require(_0xb9a3('0x4'));var BPromise=require(_0xb9a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9a3('0x6'));var rimraf=require(_0xb9a3('0x7'));var config=require(_0xb9a3('0x8'));var attributes=require('./migration.attributes');module[_0xb9a3('0x9')]=function(_0x4d162e,_0x45e526){return _0x4d162e[_0xb9a3('0xa')](_0xb9a3('0xb'),attributes,{'tableName':_0xb9a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ba=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','Migration','util'];(function(_0x332005,_0x24edf1){var _0x4393e1=function(_0x352f93){while(--_0x352f93){_0x332005['push'](_0x332005['shift']());}};_0x4393e1(++_0x24edf1);}(_0xf9ba,0x121));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xaf9b('0x0'));var logger=require(_0xaf9b('0x1'))(_0xaf9b('0x2'));var moment=require(_0xaf9b('0x3'));var BPromise=require(_0xaf9b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf9b('0x5'));var rimraf=require(_0xaf9b('0x6'));var config=require(_0xaf9b('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x51fd1f,_0x3e2155){return _0x51fd1f[_0xaf9b('0x8')](_0xaf9b('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 63343db..fffcce2 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 _0x3a25=['then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x332b7e,_0x33c1e0){var _0x118474=function(_0x2b4ca1){while(--_0x2b4ca1){_0x332b7e['push'](_0x332b7e['shift']());}};_0x118474(++_0x33c1e0);}(_0x3a25,0x15d));var _0x53a2=function(_0x5ad380,_0x15d25e){_0x5ad380=_0x5ad380-0x0;var _0x37928e=_0x3a25[_0x5ad380];return _0x37928e;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('Migration,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});} \ No newline at end of file +var _0x89e8=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0xb4a27,_0x1bbc8e){var _0x164ada=function(_0x460f36){while(--_0x460f36){_0xb4a27['push'](_0xb4a27['shift']());}};_0x164ada(++_0x1bbc8e);}(_0x89e8,0x74));var _0x889e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x89e8[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var moment=require(_0x889e('0x2'));var BPromise=require(_0x889e('0x3'));var rs=require(_0x889e('0x4'));var fs=require('fs');var Redis=require(_0x889e('0x5'));var db=require(_0x889e('0x6'))['db'];var utils=require(_0x889e('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x889e('0x8'));var client=jayson[_0x889e('0x9')][_0x889e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed85f,_0x38eeae,_0x54f734){return new BPromise(function(_0x2bfae4,_0x42be62){return client[_0x889e('0xb')](_0x5ed85f,_0x54f734)['then'](function(_0x21c1d9){logger[_0x889e('0xc')](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));logger['debug'](_0x889e('0xf'),_0x38eeae,_0x889e('0xe'),JSON['stringify'](_0x21c1d9));if(_0x21c1d9[_0x889e('0x10')]){if(_0x21c1d9[_0x889e('0x10')][_0x889e('0x11')]===0x1f4){logger[_0x889e('0x10')]('Migration,\x20%s,\x20%s',_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x42be62(_0x21c1d9[_0x889e('0x10')]['message']);}logger[_0x889e('0x10')](_0x889e('0xd'),_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x2bfae4(_0x21c1d9[_0x889e('0x10')]['message']);}else{logger['info'](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));_0x2bfae4(_0x21c1d9[_0x889e('0x13')][_0x889e('0x12')]);}})['catch'](function(_0x22fbf6){logger[_0x889e('0x10')]('Migration,\x20%s,\x20%s',_0x38eeae,_0x22fbf6);_0x42be62(_0x22fbf6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6130f6f..94a4794 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 _0xbf07=['connect-timeout','Router','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x15a49f,_0x565cfe){var _0x57f460=function(_0xb6f5e0){while(--_0xb6f5e0){_0x15a49f['push'](_0x15a49f['shift']());}};_0x57f460(++_0x565cfe);}(_0xbf07,0x17a));var _0x7bf0=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xbf07[_0x2c5255];return _0x30d0ea;};'use strict';var multer=require(_0x7bf0('0x0'));var util=require('util');var path=require(_0x7bf0('0x1'));var timeout=require(_0x7bf0('0x2'));var express=require('express');var router=express[_0x7bf0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7bf0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7bf0('0x5'));var controller=require(_0x7bf0('0x6'));router[_0x7bf0('0x7')]('/',auth['isAuthenticated'](),controller[_0x7bf0('0x8')]);router[_0x7bf0('0x7')](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xb')]);router[_0x7bf0('0xc')]('/',auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xd')]);router[_0x7bf0('0xe')]('/:id',auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xf')]);router[_0x7bf0('0x10')](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x11')]);module[_0x7bf0('0x12')]=router; \ No newline at end of file +var _0xad40=['get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x14e787,_0x8d6c2e){var _0x46d289=function(_0x2b6ab3){while(--_0x2b6ab3){_0x14e787['push'](_0x14e787['shift']());}};_0x46d289(++_0x8d6c2e);}(_0xad40,0xfa));var _0x0ad4=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xad40[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var path=require(_0x0ad4('0x2'));var timeout=require(_0x0ad4('0x3'));var express=require('express');var router=express[_0x0ad4('0x4')]();var fs_extra=require(_0x0ad4('0x5'));var auth=require(_0x0ad4('0x6'));var interaction=require(_0x0ad4('0x7'));var config=require(_0x0ad4('0x8'));var controller=require(_0x0ad4('0x9'));router[_0x0ad4('0xa')]('/',auth['isAuthenticated'](),controller[_0x0ad4('0xb')]);router[_0x0ad4('0xa')](_0x0ad4('0xc'),auth[_0x0ad4('0xd')](),controller[_0x0ad4('0xe')]);router[_0x0ad4('0xf')]('/',auth[_0x0ad4('0xd')](),controller['create']);router[_0x0ad4('0x10')](_0x0ad4('0xc'),auth[_0x0ad4('0xd')](),controller[_0x0ad4('0x11')]);router[_0x0ad4('0x12')](_0x0ad4('0xc'),auth[_0x0ad4('0xd')](),controller['destroy']);module[_0x0ad4('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5f936db..0825fcb 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 _0x8cf2=['STRING','sequelize','ENUM','localnet','stun','turn'];(function(_0x4bd73d,_0x2577fd){var _0x5ebd61=function(_0x113360){while(--_0x113360){_0x4bd73d['push'](_0x4bd73d['shift']());}};_0x5ebd61(++_0x2577fd);}(_0x8cf2,0x181));var _0x28cf=function(_0xb8b698,_0x35b692){_0xb8b698=_0xb8b698-0x0;var _0x1fc601=_0x8cf2[_0xb8b698];return _0x1fc601;};'use strict';var Sequelize=require(_0x28cf('0x0'));module['exports']={'type':{'type':Sequelize[_0x28cf('0x1')](_0x28cf('0x2'),'externip',_0x28cf('0x3'),_0x28cf('0x4'))},'value':{'type':Sequelize[_0x28cf('0x5')]},'username':{'type':Sequelize[_0x28cf('0x5')]},'password':{'type':Sequelize[_0x28cf('0x5')]}}; \ No newline at end of file +var _0x4c16=['localnet','externip','stun','turn','STRING','sequelize','ENUM'];(function(_0x2e7048,_0x551590){var _0x789806=function(_0xcebf0){while(--_0xcebf0){_0x2e7048['push'](_0x2e7048['shift']());}};_0x789806(++_0x551590);}(_0x4c16,0x163));var _0x64c1=function(_0x23dda5,_0x221860){_0x23dda5=_0x23dda5-0x0;var _0x32c24e=_0x4c16[_0x23dda5];return _0x32c24e;};'use strict';var Sequelize=require(_0x64c1('0x0'));module['exports']={'type':{'type':Sequelize[_0x64c1('0x1')](_0x64c1('0x2'),_0x64c1('0x3'),_0x64c1('0x4'),_0x64c1('0x5'))},'value':{'type':Sequelize[_0x64c1('0x6')]},'username':{'type':Sequelize[_0x64c1('0x6')]},'password':{'type':Sequelize[_0x64c1('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d8e0b82..d7d95ee 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 _0xa226=['toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Network','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','order','sort','filters','filter','merge','includeAll','include','rows','show','params','options','find','create','sequelize','transaction','body','findAll'];(function(_0x440f51,_0x3a90c3){var _0x5cb796=function(_0x40d061){while(--_0x40d061){_0x440f51['push'](_0x440f51['shift']());}};_0x5cb796(++_0x3a90c3);}(_0xa226,0x1b7));var _0x6a22=function(_0x2437de,_0xe7bbd9){_0x2437de=_0x2437de-0x0;var _0x53466e=_0xa226[_0x2437de];return _0x53466e;};'use strict';var emlformat=require(_0x6a22('0x0'));var rimraf=require(_0x6a22('0x1'));var zipdir=require(_0x6a22('0x2'));var jsonpatch=require(_0x6a22('0x3'));var rp=require(_0x6a22('0x4'));var moment=require(_0x6a22('0x5'));var BPromise=require(_0x6a22('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a22('0x7'));var sox=require(_0x6a22('0x8'));var csv=require('to-csv');var ejs=require(_0x6a22('0x9'));var fs=require('fs');var fs_extra=require(_0x6a22('0xa'));var _=require(_0x6a22('0xb'));var squel=require(_0x6a22('0xc'));var crypto=require(_0x6a22('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a22('0xe'));var querystring=require('querystring');var Papa=require(_0x6a22('0xf'));var Redis=require(_0x6a22('0x10'));var authService=require(_0x6a22('0x11'));var qs=require(_0x6a22('0x12'));var as=require(_0x6a22('0x13'));var hardwareService=require(_0x6a22('0x14'));var logger=require('../../config/logger')(_0x6a22('0x15'));var utils=require('../../config/utils');var config=require(_0x6a22('0x16'));var licenseUtil=require(_0x6a22('0x17'));var db=require(_0x6a22('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6a22('0x19')][_0x6a22('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2835e7,_0x1495c8,_0xfbf409,_0x1d906e){return new BPromise(function(_0x313814,_0xdfdf1f){var _0x2e0938=_0x1d906e||client;return _0x2e0938[_0x6a22('0x1b')](_0x2835e7,_0xfbf409)[_0x6a22('0x1c')](function(_0x3e65a6){logger[_0x6a22('0x1d')](_0x6a22('0x1e'),_0x1495c8,'request\x20sent');logger['debug'](_0x6a22('0x1f'),_0x1495c8,_0x6a22('0x20'),JSON['stringify'](_0x3e65a6));if(_0x3e65a6[_0x6a22('0x21')]){if(_0x3e65a6['error'][_0x6a22('0x22')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x1495c8,_0x3e65a6['error'][_0x6a22('0x23')]);return _0xdfdf1f(_0x3e65a6[_0x6a22('0x21')][_0x6a22('0x23')]);}logger['error']('Network,\x20%s,\x20%s',_0x1495c8,_0x3e65a6[_0x6a22('0x21')][_0x6a22('0x23')]);return _0x313814(_0x3e65a6[_0x6a22('0x21')][_0x6a22('0x23')]);}else{logger[_0x6a22('0x1d')](_0x6a22('0x1e'),_0x1495c8,_0x6a22('0x20'));_0x313814(_0x3e65a6[_0x6a22('0x24')]['message']);}})[_0x6a22('0x25')](function(_0x5769a5){logger[_0x6a22('0x21')]('Network,\x20%s,\x20%s',_0x1495c8,_0x5769a5);_0xdfdf1f(_0x5769a5);});});}function respondWithStatusCode(_0x2df7f5,_0x41568f){_0x41568f=_0x41568f||0xcc;return function(_0x3b1989){if(_0x3b1989){return _0x2df7f5[_0x6a22('0x26')](_0x41568f);}return _0x2df7f5['status'](_0x41568f)[_0x6a22('0x27')]();};}function respondWithResult(_0x55f9fa,_0x2c0b1d){_0x2c0b1d=_0x2c0b1d||0xc8;return function(_0x19c056){if(_0x19c056){return _0x55f9fa[_0x6a22('0x28')](_0x2c0b1d)[_0x6a22('0x29')](_0x19c056);}};}function respondWithFilteredResult(_0x506815,_0x31cd4a){return function(_0x31b6a2){if(_0x31b6a2){var _0x3e609b=typeof _0x31cd4a[_0x6a22('0x2a')]==='undefined'&&typeof _0x31cd4a[_0x6a22('0x2b')]===_0x6a22('0x2c');var _0x5ae530=_0x31b6a2[_0x6a22('0x2d')];var _0x115b3e=_0x3e609b?0x0:_0x31cd4a[_0x6a22('0x2a')];var _0xe8457f=_0x3e609b?_0x31b6a2['count']:_0x31cd4a[_0x6a22('0x2a')]+_0x31cd4a[_0x6a22('0x2b')];var _0x52c4e2;if(_0xe8457f>=_0x5ae530){_0xe8457f=_0x5ae530;_0x52c4e2=0xc8;}else{_0x52c4e2=0xce;}_0x506815[_0x6a22('0x28')](_0x52c4e2);return _0x506815[_0x6a22('0x2e')](_0x6a22('0x2f'),_0x115b3e+'-'+_0xe8457f+'/'+_0x5ae530)[_0x6a22('0x29')](_0x31b6a2);}return null;};}function patchUpdates(_0x325338){return function(_0x11e907){try{jsonpatch[_0x6a22('0x30')](_0x11e907,_0x325338,!![]);}catch(_0x5da588){return BPromise[_0x6a22('0x31')](_0x5da588);}return _0x11e907[_0x6a22('0x32')]();};}function saveUpdates(_0x2b9498,_0x3cd926){return function(_0x3aa613){if(_0x3aa613){return _0x3aa613[_0x6a22('0x33')](_0x2b9498)[_0x6a22('0x1c')](function(_0x148a5d){return _0x148a5d;});}return null;};}function removeEntity(_0x202cf3,_0x176c18){return function(_0xc7b13d){if(_0xc7b13d){return _0xc7b13d[_0x6a22('0x34')]()[_0x6a22('0x1c')](function(){_0x202cf3['status'](0xcc)[_0x6a22('0x27')]();});}};}function handleEntityNotFound(_0x1ea89c,_0x52b7f0){return function(_0x2ccb84){if(!_0x2ccb84){_0x1ea89c['sendStatus'](0x194);}return _0x2ccb84;};}function handleError(_0x48a0fc,_0xd4916e){_0xd4916e=_0xd4916e||0x1f4;return function(_0x2ea292){logger['error'](_0x2ea292[_0x6a22('0x35')]);if(_0x2ea292[_0x6a22('0x36')]){delete _0x2ea292[_0x6a22('0x36')];}_0x48a0fc[_0x6a22('0x28')](_0xd4916e)[_0x6a22('0x37')](_0x2ea292);};}exports['index']=function(_0x2ca740,_0x18f724){var _0x3e8f29={},_0x936e0f={},_0x17b318={'count':0x0,'rows':[]};var _0x5edfe2=_[_0x6a22('0x38')](db[_0x6a22('0x39')][_0x6a22('0x3a')],function(_0x56e50b){return{'name':_0x56e50b[_0x6a22('0x3b')],'type':_0x56e50b[_0x6a22('0x3c')][_0x6a22('0x3d')]};});_0x936e0f['model']=_[_0x6a22('0x38')](_0x5edfe2,_0x6a22('0x36'));_0x936e0f['query']=_[_0x6a22('0x3e')](_0x2ca740[_0x6a22('0x3f')]);_0x936e0f['filters']=_[_0x6a22('0x40')](_0x936e0f[_0x6a22('0x41')],_0x936e0f[_0x6a22('0x3f')]);_0x3e8f29[_0x6a22('0x42')]=_[_0x6a22('0x40')](_0x936e0f[_0x6a22('0x41')],qs[_0x6a22('0x43')](_0x2ca740[_0x6a22('0x3f')][_0x6a22('0x43')]));_0x3e8f29[_0x6a22('0x42')]=_0x3e8f29['attributes'][_0x6a22('0x44')]?_0x3e8f29['attributes']:_0x936e0f[_0x6a22('0x41')];if(!_0x2ca740['query']['hasOwnProperty']('nolimit')){_0x3e8f29[_0x6a22('0x2b')]=qs['limit'](_0x2ca740['query']['limit']);_0x3e8f29[_0x6a22('0x2a')]=qs[_0x6a22('0x2a')](_0x2ca740[_0x6a22('0x3f')][_0x6a22('0x2a')]);}_0x3e8f29[_0x6a22('0x45')]=qs['sort'](_0x2ca740[_0x6a22('0x3f')][_0x6a22('0x46')]);_0x3e8f29['where']=qs[_0x6a22('0x47')](_['pick'](_0x2ca740[_0x6a22('0x3f')],_0x936e0f['filters']),_0x5edfe2);if(_0x2ca740['query'][_0x6a22('0x48')]){_0x3e8f29['where']=_[_0x6a22('0x49')](_0x3e8f29['where'],{'$or':_[_0x6a22('0x38')](_0x5edfe2,function(_0x517670){if(_0x517670[_0x6a22('0x3c')]!=='VIRTUAL'){var _0x205641={};_0x205641[_0x517670[_0x6a22('0x36')]]={'$like':'%'+_0x2ca740[_0x6a22('0x3f')]['filter']+'%'};return _0x205641;}})});}_0x3e8f29=_[_0x6a22('0x49')]({},_0x3e8f29,_0x2ca740['options']);var _0x3523fd={'where':_0x3e8f29['where']};return db[_0x6a22('0x39')][_0x6a22('0x2d')](_0x3523fd)[_0x6a22('0x1c')](function(_0x2d6214){_0x17b318['count']=_0x2d6214;if(_0x2ca740['query'][_0x6a22('0x4a')]){_0x3e8f29[_0x6a22('0x4b')]=[{'all':!![]}];}return db[_0x6a22('0x39')]['findAll'](_0x3e8f29);})['then'](function(_0x135888){_0x17b318[_0x6a22('0x4c')]=_0x135888;return _0x17b318;})[_0x6a22('0x1c')](respondWithFilteredResult(_0x18f724,_0x3e8f29))[_0x6a22('0x25')](handleError(_0x18f724,null));};exports[_0x6a22('0x4d')]=function(_0x29aa33,_0x35de70){var _0x5fb455={'raw':!![],'where':{'id':_0x29aa33[_0x6a22('0x4e')]['id']}},_0x18e1b5={};_0x18e1b5[_0x6a22('0x41')]=_[_0x6a22('0x3e')](db[_0x6a22('0x39')][_0x6a22('0x3a')]);_0x18e1b5['query']=_[_0x6a22('0x3e')](_0x29aa33[_0x6a22('0x3f')]);_0x18e1b5[_0x6a22('0x47')]=_[_0x6a22('0x40')](_0x18e1b5['model'],_0x18e1b5['query']);_0x5fb455[_0x6a22('0x42')]=_[_0x6a22('0x40')](_0x18e1b5[_0x6a22('0x41')],qs[_0x6a22('0x43')](_0x29aa33['query'][_0x6a22('0x43')]));_0x5fb455[_0x6a22('0x42')]=_0x5fb455[_0x6a22('0x42')][_0x6a22('0x44')]?_0x5fb455[_0x6a22('0x42')]:_0x18e1b5[_0x6a22('0x41')];if(_0x29aa33['query'][_0x6a22('0x4a')]){_0x5fb455[_0x6a22('0x4b')]=[{'all':!![]}];}_0x5fb455=_[_0x6a22('0x49')]({},_0x5fb455,_0x29aa33[_0x6a22('0x4f')]);return db[_0x6a22('0x39')][_0x6a22('0x50')](_0x5fb455)[_0x6a22('0x1c')](handleEntityNotFound(_0x35de70,null))[_0x6a22('0x1c')](respondWithResult(_0x35de70,null))[_0x6a22('0x25')](handleError(_0x35de70,null));};exports[_0x6a22('0x51')]=function(_0x2f4f4e,_0x2dc9af,_0x5a2a54){var _0x25badd;return db[_0x6a22('0x52')][_0x6a22('0x53')](function(_0x11fd4d){return db['Network']['create'](_0x2f4f4e[_0x6a22('0x54')],{'raw':!![]})[_0x6a22('0x1c')](function(_0x9673dd){_0x25badd=_0x9673dd;return db['Network'][_0x6a22('0x55')]({'where':{'type':_0x2f4f4e[_0x6a22('0x54')][_0x6a22('0x3c')]},'raw':!![]});})[_0x6a22('0x1c')](function(_0x44b94e){if(_0x25badd[_0x6a22('0x3c')][_0x6a22('0x56')]()==_0x6a22('0x57')){var _0x318436=fs['readFileSync'](path[_0x6a22('0x58')](config['root'],_0x6a22('0x59')),_0x6a22('0x5a'));var _0x5c1531=ejs[_0x6a22('0x5b')](_0x318436,{'networks':_0x44b94e||[]});fs[_0x6a22('0x5c')](_0x6a22('0x5d'),_0x5c1531);return respondWithRpcPromise(_0x6a22('0x5e'),_0x6a22('0x51'),{'module':_0x6a22('0x5f')});}else if(_0x25badd['type']['toUpperCase']()=='TURN'){var _0x3d33eb=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x62')),_0x6a22('0x5a'));var _0x51da9d=ejs[_0x6a22('0x5b')](_0x3d33eb,{'networks':_0x44b94e||[]});fs[_0x6a22('0x5c')](_0x6a22('0x63'),_0x51da9d);return respondWithRpcPromise(_0x6a22('0x5e'),'create',{'module':_0x6a22('0x5f')});}else{var _0x29572c=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x64')),_0x6a22('0x5a'));var _0x84bf6a=ejs['render'](_0x29572c,{'networks':_0x44b94e||[]});fs[_0x6a22('0x5c')](util[_0x6a22('0x65')](_0x6a22('0x66'),_0x2f4f4e[_0x6a22('0x54')][_0x6a22('0x3c')][_0x6a22('0x67')]()),_0x84bf6a);return respondWithRpcPromise('Reload',_0x6a22('0x51'),{'module':_0x6a22('0x68')});}return null;})[_0x6a22('0x1c')](function(){return _0x25badd;});})['then'](respondWithResult(_0x2dc9af,0xc9))[_0x6a22('0x25')](handleError(_0x2dc9af,null));};exports[_0x6a22('0x33')]=function(_0x34c24b,_0x512b93,_0x37b741){var _0x2b173f;return db[_0x6a22('0x52')][_0x6a22('0x53')](function(_0x157dc8){return db[_0x6a22('0x39')][_0x6a22('0x50')]({'where':{'id':_0x34c24b[_0x6a22('0x4e')]['id']}})[_0x6a22('0x1c')](handleEntityNotFound(_0x512b93,null))['then'](saveUpdates(_0x34c24b[_0x6a22('0x54')],null))[_0x6a22('0x1c')](function(_0x3c98e5){if(_0x3c98e5){_0x2b173f=_0x3c98e5;return db[_0x6a22('0x39')]['findAll']({'where':{'type':_0x2b173f[_0x6a22('0x3c')]},'raw':!![]});}return null;})['then'](function(_0x351313){if(_0x2b173f[_0x6a22('0x3c')][_0x6a22('0x56')]()==_0x6a22('0x57')){var _0x4fcab1=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x59')),_0x6a22('0x5a'));var _0x227e55=ejs['render'](_0x4fcab1,{'networks':_0x351313||[]});fs['writeFileSync'](_0x6a22('0x5d'),_0x227e55);return respondWithRpcPromise(_0x6a22('0x5e'),_0x6a22('0x33'),{'module':_0x6a22('0x5f')});}else if(_0x2b173f[_0x6a22('0x3c')][_0x6a22('0x56')]()=='TURN'){var _0x5537e6=fs['readFileSync'](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x62')),_0x6a22('0x5a'));var _0x29d02b=ejs[_0x6a22('0x5b')](_0x5537e6,{'networks':_0x351313||[]});fs['writeFileSync'](_0x6a22('0x63'),_0x29d02b);return respondWithRpcPromise(_0x6a22('0x5e'),_0x6a22('0x33'),{'module':_0x6a22('0x5f')});}else{var _0x2a708e=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x64')),_0x6a22('0x5a'));var _0x310419=ejs[_0x6a22('0x5b')](_0x2a708e,{'networks':_0x351313||[]});fs[_0x6a22('0x5c')](util[_0x6a22('0x65')](_0x6a22('0x66'),_0x34c24b[_0x6a22('0x54')]['type']['toLowerCase']()),_0x310419);return respondWithRpcPromise(_0x6a22('0x5e'),_0x6a22('0x33'),{'module':_0x6a22('0x68')});}return null;})['then'](function(_0x352a0b){if(_0x352a0b){return _0x2b173f;}return null;});})[_0x6a22('0x1c')](respondWithResult(_0x512b93,null))[_0x6a22('0x25')](handleError(_0x512b93,null));};exports[_0x6a22('0x34')]=function(_0x46bdfa,_0x2d5c3c,_0x437cac){var _0x1c4971;return db[_0x6a22('0x39')][_0x6a22('0x50')]({'where':{'id':_0x46bdfa[_0x6a22('0x4e')]['id']}})[_0x6a22('0x1c')](function(_0x1882d9){_0x1c4971=_0x1882d9;return _0x1882d9;})[_0x6a22('0x1c')](handleEntityNotFound(_0x2d5c3c,null))[_0x6a22('0x1c')](removeEntity(_0x2d5c3c,null))[_0x6a22('0x1c')](function(){if(_0x1c4971){return db[_0x6a22('0x39')][_0x6a22('0x55')]({'where':{'type':_0x1c4971[_0x6a22('0x3c')]},'raw':!![]});}})[_0x6a22('0x1c')](function(_0x25191c){if(_0x1c4971[_0x6a22('0x3c')]['toUpperCase']()==_0x6a22('0x57')){var _0xa63683=fs[_0x6a22('0x60')](path['join'](config[_0x6a22('0x61')],_0x6a22('0x59')),_0x6a22('0x5a'));var _0x105a8c=ejs[_0x6a22('0x5b')](_0xa63683,{'networks':_0x25191c||[]});fs[_0x6a22('0x5c')](_0x6a22('0x5d'),_0x105a8c);return respondWithRpcPromise(_0x6a22('0x5e'),_0x6a22('0x34'),{'module':'res_stun_monitor.so'});}else if(_0x1c4971['type'][_0x6a22('0x56')]()=='TURN'){var _0x852bc1=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],_0x6a22('0x62')),_0x6a22('0x5a'));var _0x2f7ad3=ejs['render'](_0x852bc1,{'networks':_0x25191c||[]});fs[_0x6a22('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2f7ad3);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x5730ce=fs[_0x6a22('0x60')](path[_0x6a22('0x58')](config[_0x6a22('0x61')],'server/files/templates/network.ejs'),_0x6a22('0x5a'));var _0x2a3229=ejs['render'](_0x5730ce,{'networks':_0x25191c||[]});fs['writeFileSync'](util[_0x6a22('0x65')](_0x6a22('0x66'),_0x46bdfa[_0x6a22('0x54')]['type'][_0x6a22('0x67')]()),_0x2a3229);return respondWithRpcPromise('Reload','destroy',{'module':_0x6a22('0x68')});}return null;})[_0x6a22('0x25')](handleError(_0x2d5c3c,null));}; \ No newline at end of file +var _0x3b36=['status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','sendStatus','stack','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Network','find','catch','sequelize','create','body','toUpperCase','STUN','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','transaction','chan_sip.so','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3b36,0x181));var _0x63b3=function(_0x41992d,_0x12e9e1){_0x41992d=_0x41992d-0x0;var _0x9d5d29=_0x3b36[_0x41992d];return _0x9d5d29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63b3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63b3('0x1'));var rp=require(_0x63b3('0x2'));var moment=require(_0x63b3('0x3'));var BPromise=require(_0x63b3('0x4'));var Mustache=require(_0x63b3('0x5'));var util=require(_0x63b3('0x6'));var path=require(_0x63b3('0x7'));var sox=require(_0x63b3('0x8'));var csv=require(_0x63b3('0x9'));var ejs=require(_0x63b3('0xa'));var fs=require('fs');var fs_extra=require(_0x63b3('0xb'));var _=require(_0x63b3('0xc'));var squel=require(_0x63b3('0xd'));var crypto=require(_0x63b3('0xe'));var jsforce=require(_0x63b3('0xf'));var deskjs=require(_0x63b3('0x10'));var toCsv=require(_0x63b3('0x9'));var querystring=require(_0x63b3('0x11'));var Papa=require(_0x63b3('0x12'));var Redis=require('ioredis');var authService=require(_0x63b3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x63b3('0x14'));var hardwareService=require(_0x63b3('0x15'));var logger=require(_0x63b3('0x16'))(_0x63b3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x63b3('0x18'));var db=require(_0x63b3('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x63b3('0x1a')][_0x63b3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1198f2,_0x31340b,_0x5f4623,_0x3ab666){return new BPromise(function(_0x566f33,_0x348bcc){var _0x16aecc=_0x3ab666||client;return _0x16aecc[_0x63b3('0x1c')](_0x1198f2,_0x5f4623)[_0x63b3('0x1d')](function(_0x343a54){logger[_0x63b3('0x1e')]('Network,\x20%s,\x20%s',_0x31340b,'request\x20sent');logger[_0x63b3('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x31340b,_0x63b3('0x20'),JSON[_0x63b3('0x21')](_0x343a54));if(_0x343a54['error']){if(_0x343a54[_0x63b3('0x22')][_0x63b3('0x23')]===0x1f4){logger[_0x63b3('0x22')](_0x63b3('0x24'),_0x31340b,_0x343a54[_0x63b3('0x22')][_0x63b3('0x25')]);return _0x348bcc(_0x343a54[_0x63b3('0x22')]['message']);}logger[_0x63b3('0x22')](_0x63b3('0x24'),_0x31340b,_0x343a54['error'][_0x63b3('0x25')]);return _0x566f33(_0x343a54[_0x63b3('0x22')][_0x63b3('0x25')]);}else{logger[_0x63b3('0x1e')](_0x63b3('0x24'),_0x31340b,_0x63b3('0x20'));_0x566f33(_0x343a54[_0x63b3('0x26')][_0x63b3('0x25')]);}})['catch'](function(_0x328fc1){logger[_0x63b3('0x22')](_0x63b3('0x24'),_0x31340b,_0x328fc1);_0x348bcc(_0x328fc1);});});}function respondWithStatusCode(_0x175a6a,_0x1778fe){_0x1778fe=_0x1778fe||0xcc;return function(_0x4248bb){if(_0x4248bb){return _0x175a6a['sendStatus'](_0x1778fe);}return _0x175a6a[_0x63b3('0x27')](_0x1778fe)[_0x63b3('0x28')]();};}function respondWithResult(_0x34f8aa,_0x53fc34){_0x53fc34=_0x53fc34||0xc8;return function(_0x26a53e){if(_0x26a53e){return _0x34f8aa['status'](_0x53fc34)[_0x63b3('0x29')](_0x26a53e);}};}function respondWithFilteredResult(_0x89efa2,_0xfc946f){return function(_0x130451){if(_0x130451){var _0x243089=typeof _0xfc946f[_0x63b3('0x2a')]===_0x63b3('0x2b')&&typeof _0xfc946f[_0x63b3('0x2c')]==='undefined';var _0xbcc84a=_0x130451[_0x63b3('0x2d')];var _0x1153e2=_0x243089?0x0:_0xfc946f[_0x63b3('0x2a')];var _0x383a78=_0x243089?_0x130451[_0x63b3('0x2d')]:_0xfc946f[_0x63b3('0x2a')]+_0xfc946f[_0x63b3('0x2c')];var _0x1c0d0d;if(_0x383a78>=_0xbcc84a){_0x383a78=_0xbcc84a;_0x1c0d0d=0xc8;}else{_0x1c0d0d=0xce;}_0x89efa2[_0x63b3('0x27')](_0x1c0d0d);return _0x89efa2['set']('Content-Range',_0x1153e2+'-'+_0x383a78+'/'+_0xbcc84a)['json'](_0x130451);}return null;};}function patchUpdates(_0x296347){return function(_0xb4bc6){try{jsonpatch[_0x63b3('0x2e')](_0xb4bc6,_0x296347,!![]);}catch(_0x46943e){return BPromise[_0x63b3('0x2f')](_0x46943e);}return _0xb4bc6[_0x63b3('0x30')]();};}function saveUpdates(_0xf878c2,_0x3065dd){return function(_0x123d44){if(_0x123d44){return _0x123d44[_0x63b3('0x31')](_0xf878c2)[_0x63b3('0x1d')](function(_0x15600f){return _0x15600f;});}return null;};}function removeEntity(_0x3843d4,_0x42adf9){return function(_0x12e8f9){if(_0x12e8f9){return _0x12e8f9[_0x63b3('0x32')]()[_0x63b3('0x1d')](function(){_0x3843d4[_0x63b3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24eae9,_0xd56332){return function(_0xcc544c){if(!_0xcc544c){_0x24eae9[_0x63b3('0x33')](0x194);}return _0xcc544c;};}function handleError(_0x35d54d,_0x3f5383){_0x3f5383=_0x3f5383||0x1f4;return function(_0x1340b6){logger[_0x63b3('0x22')](_0x1340b6[_0x63b3('0x34')]);if(_0x1340b6['name']){delete _0x1340b6['name'];}_0x35d54d[_0x63b3('0x27')](_0x3f5383)['send'](_0x1340b6);};}exports[_0x63b3('0x35')]=function(_0x1dfe7e,_0xbf6117){var _0x453626={},_0x37546f={},_0x36dfd7={'count':0x0,'rows':[]};var _0xffcd1e=_[_0x63b3('0x36')](db['Network'][_0x63b3('0x37')],function(_0x4273dc){return{'name':_0x4273dc[_0x63b3('0x38')],'type':_0x4273dc[_0x63b3('0x39')]['key']};});_0x37546f[_0x63b3('0x3a')]=_[_0x63b3('0x36')](_0xffcd1e,'name');_0x37546f[_0x63b3('0x3b')]=_[_0x63b3('0x3c')](_0x1dfe7e[_0x63b3('0x3b')]);_0x37546f[_0x63b3('0x3d')]=_[_0x63b3('0x3e')](_0x37546f[_0x63b3('0x3a')],_0x37546f[_0x63b3('0x3b')]);_0x453626[_0x63b3('0x3f')]=_['intersection'](_0x37546f[_0x63b3('0x3a')],qs[_0x63b3('0x40')](_0x1dfe7e[_0x63b3('0x3b')][_0x63b3('0x40')]));_0x453626[_0x63b3('0x3f')]=_0x453626[_0x63b3('0x3f')][_0x63b3('0x41')]?_0x453626['attributes']:_0x37546f[_0x63b3('0x3a')];if(!_0x1dfe7e[_0x63b3('0x3b')]['hasOwnProperty']('nolimit')){_0x453626[_0x63b3('0x2c')]=qs[_0x63b3('0x2c')](_0x1dfe7e[_0x63b3('0x3b')]['limit']);_0x453626['offset']=qs['offset'](_0x1dfe7e[_0x63b3('0x3b')][_0x63b3('0x2a')]);}_0x453626[_0x63b3('0x42')]=qs['sort'](_0x1dfe7e[_0x63b3('0x3b')][_0x63b3('0x43')]);_0x453626['where']=qs['filters'](_['pick'](_0x1dfe7e[_0x63b3('0x3b')],_0x37546f['filters']),_0xffcd1e);if(_0x1dfe7e[_0x63b3('0x3b')][_0x63b3('0x44')]){_0x453626[_0x63b3('0x45')]=_['merge'](_0x453626['where'],{'$or':_[_0x63b3('0x36')](_0xffcd1e,function(_0x43553c){if(_0x43553c[_0x63b3('0x39')]!==_0x63b3('0x46')){var _0x34c6bd={};_0x34c6bd[_0x43553c['name']]={'$like':'%'+_0x1dfe7e[_0x63b3('0x3b')][_0x63b3('0x44')]+'%'};return _0x34c6bd;}})});}_0x453626=_[_0x63b3('0x47')]({},_0x453626,_0x1dfe7e[_0x63b3('0x48')]);var _0x3c8170={'where':_0x453626[_0x63b3('0x45')]};return db['Network'][_0x63b3('0x2d')](_0x3c8170)[_0x63b3('0x1d')](function(_0x3827de){_0x36dfd7['count']=_0x3827de;if(_0x1dfe7e['query'][_0x63b3('0x49')]){_0x453626[_0x63b3('0x4a')]=[{'all':!![]}];}return db['Network'][_0x63b3('0x4b')](_0x453626);})[_0x63b3('0x1d')](function(_0x32e88e){_0x36dfd7[_0x63b3('0x4c')]=_0x32e88e;return _0x36dfd7;})[_0x63b3('0x1d')](respondWithFilteredResult(_0xbf6117,_0x453626))['catch'](handleError(_0xbf6117,null));};exports[_0x63b3('0x4d')]=function(_0x141617,_0x11e2d9){var _0x7e8064={'raw':!![],'where':{'id':_0x141617[_0x63b3('0x4e')]['id']}},_0x125796={};_0x125796[_0x63b3('0x3a')]=_[_0x63b3('0x3c')](db[_0x63b3('0x4f')][_0x63b3('0x37')]);_0x125796['query']=_['keys'](_0x141617[_0x63b3('0x3b')]);_0x125796['filters']=_['intersection'](_0x125796[_0x63b3('0x3a')],_0x125796[_0x63b3('0x3b')]);_0x7e8064[_0x63b3('0x3f')]=_[_0x63b3('0x3e')](_0x125796[_0x63b3('0x3a')],qs[_0x63b3('0x40')](_0x141617[_0x63b3('0x3b')][_0x63b3('0x40')]));_0x7e8064[_0x63b3('0x3f')]=_0x7e8064['attributes'][_0x63b3('0x41')]?_0x7e8064['attributes']:_0x125796['model'];if(_0x141617[_0x63b3('0x3b')][_0x63b3('0x49')]){_0x7e8064[_0x63b3('0x4a')]=[{'all':!![]}];}_0x7e8064=_[_0x63b3('0x47')]({},_0x7e8064,_0x141617[_0x63b3('0x48')]);return db[_0x63b3('0x4f')][_0x63b3('0x50')](_0x7e8064)[_0x63b3('0x1d')](handleEntityNotFound(_0x11e2d9,null))['then'](respondWithResult(_0x11e2d9,null))[_0x63b3('0x51')](handleError(_0x11e2d9,null));};exports['create']=function(_0x522c79,_0x40360d,_0x34166f){var _0x4aff6a;return db[_0x63b3('0x52')]['transaction'](function(_0x2cdf12){return db[_0x63b3('0x4f')][_0x63b3('0x53')](_0x522c79[_0x63b3('0x54')],{'raw':!![]})['then'](function(_0x1fe29f){_0x4aff6a=_0x1fe29f;return db[_0x63b3('0x4f')][_0x63b3('0x4b')]({'where':{'type':_0x522c79[_0x63b3('0x54')]['type']},'raw':!![]});})[_0x63b3('0x1d')](function(_0x116093){if(_0x4aff6a[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x56')){var _0x19c810=fs['readFileSync'](path['join'](config['root'],_0x63b3('0x57')),_0x63b3('0x58'));var _0xe52004=ejs[_0x63b3('0x59')](_0x19c810,{'networks':_0x116093||[]});fs[_0x63b3('0x5a')](_0x63b3('0x5b'),_0xe52004);return respondWithRpcPromise(_0x63b3('0x5c'),_0x63b3('0x53'),{'module':_0x63b3('0x5d')});}else if(_0x4aff6a[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x5e')){var _0x249abc=fs[_0x63b3('0x5f')](path['join'](config[_0x63b3('0x60')],_0x63b3('0x61')),_0x63b3('0x58'));var _0x38eaaf=ejs['render'](_0x249abc,{'networks':_0x116093||[]});fs[_0x63b3('0x5a')](_0x63b3('0x62'),_0x38eaaf);return respondWithRpcPromise('Reload','create',{'module':_0x63b3('0x5d')});}else{var _0x11cd95=fs[_0x63b3('0x5f')](path[_0x63b3('0x63')](config[_0x63b3('0x60')],_0x63b3('0x64')),_0x63b3('0x58'));var _0x57b1d4=ejs[_0x63b3('0x59')](_0x11cd95,{'networks':_0x116093||[]});fs[_0x63b3('0x5a')](util[_0x63b3('0x65')](_0x63b3('0x66'),_0x522c79[_0x63b3('0x54')][_0x63b3('0x39')][_0x63b3('0x67')]()),_0x57b1d4);return respondWithRpcPromise(_0x63b3('0x5c'),_0x63b3('0x53'),{'module':'chan_sip.so'});}return null;})[_0x63b3('0x1d')](function(){return _0x4aff6a;});})[_0x63b3('0x1d')](respondWithResult(_0x40360d,0xc9))[_0x63b3('0x51')](handleError(_0x40360d,null));};exports['update']=function(_0x1aad8f,_0x171f14,_0xf2c311){var _0x1fb035;return db[_0x63b3('0x52')][_0x63b3('0x68')](function(_0x3a7247){return db[_0x63b3('0x4f')][_0x63b3('0x50')]({'where':{'id':_0x1aad8f[_0x63b3('0x4e')]['id']}})[_0x63b3('0x1d')](handleEntityNotFound(_0x171f14,null))['then'](saveUpdates(_0x1aad8f[_0x63b3('0x54')],null))[_0x63b3('0x1d')](function(_0xca84c8){if(_0xca84c8){_0x1fb035=_0xca84c8;return db[_0x63b3('0x4f')][_0x63b3('0x4b')]({'where':{'type':_0x1fb035[_0x63b3('0x39')]},'raw':!![]});}return null;})[_0x63b3('0x1d')](function(_0xce6ec7){if(_0x1fb035[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x56')){var _0x468169=fs[_0x63b3('0x5f')](path['join'](config['root'],_0x63b3('0x57')),'utf8');var _0x1b9a1f=ejs['render'](_0x468169,{'networks':_0xce6ec7||[]});fs['writeFileSync'](_0x63b3('0x5b'),_0x1b9a1f);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else if(_0x1fb035[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x5e')){var _0x509924=fs['readFileSync'](path[_0x63b3('0x63')](config[_0x63b3('0x60')],_0x63b3('0x61')),'utf8');var _0x2368e9=ejs['render'](_0x509924,{'networks':_0xce6ec7||[]});fs[_0x63b3('0x5a')](_0x63b3('0x62'),_0x2368e9);return respondWithRpcPromise(_0x63b3('0x5c'),_0x63b3('0x31'),{'module':_0x63b3('0x5d')});}else{var _0x1102dd=fs['readFileSync'](path['join'](config['root'],_0x63b3('0x64')),_0x63b3('0x58'));var _0x2d36e5=ejs[_0x63b3('0x59')](_0x1102dd,{'networks':_0xce6ec7||[]});fs['writeFileSync'](util[_0x63b3('0x65')](_0x63b3('0x66'),_0x1aad8f[_0x63b3('0x54')]['type']['toLowerCase']()),_0x2d36e5);return respondWithRpcPromise(_0x63b3('0x5c'),_0x63b3('0x31'),{'module':_0x63b3('0x69')});}return null;})[_0x63b3('0x1d')](function(_0x4c7bf2){if(_0x4c7bf2){return _0x1fb035;}return null;});})[_0x63b3('0x1d')](respondWithResult(_0x171f14,null))[_0x63b3('0x51')](handleError(_0x171f14,null));};exports['destroy']=function(_0x26d3d0,_0x714a04,_0x5a444f){var _0x3d5d39;return db[_0x63b3('0x4f')]['find']({'where':{'id':_0x26d3d0[_0x63b3('0x4e')]['id']}})['then'](function(_0x449141){_0x3d5d39=_0x449141;return _0x449141;})[_0x63b3('0x1d')](handleEntityNotFound(_0x714a04,null))[_0x63b3('0x1d')](removeEntity(_0x714a04,null))['then'](function(){if(_0x3d5d39){return db[_0x63b3('0x4f')][_0x63b3('0x4b')]({'where':{'type':_0x3d5d39[_0x63b3('0x39')]},'raw':!![]});}})['then'](function(_0x1b15aa){if(_0x3d5d39[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x56')){var _0x35c77c=fs[_0x63b3('0x5f')](path[_0x63b3('0x63')](config['root'],_0x63b3('0x57')),_0x63b3('0x58'));var _0x4cdf46=ejs[_0x63b3('0x59')](_0x35c77c,{'networks':_0x1b15aa||[]});fs[_0x63b3('0x5a')](_0x63b3('0x5b'),_0x4cdf46);return respondWithRpcPromise(_0x63b3('0x5c'),_0x63b3('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x3d5d39[_0x63b3('0x39')][_0x63b3('0x55')]()==_0x63b3('0x5e')){var _0x1716e8=fs[_0x63b3('0x5f')](path[_0x63b3('0x63')](config[_0x63b3('0x60')],'server/files/templates/turn_multiple.ejs'),_0x63b3('0x58'));var _0x1236a8=ejs['render'](_0x1716e8,{'networks':_0x1b15aa||[]});fs[_0x63b3('0x5a')](_0x63b3('0x62'),_0x1236a8);return respondWithRpcPromise('Reload',_0x63b3('0x32'),{'module':_0x63b3('0x5d')});}else{var _0xaeb81b=fs[_0x63b3('0x5f')](path[_0x63b3('0x63')](config[_0x63b3('0x60')],_0x63b3('0x64')),_0x63b3('0x58'));var _0x424760=ejs[_0x63b3('0x59')](_0xaeb81b,{'networks':_0x1b15aa||[]});fs[_0x63b3('0x5a')](util[_0x63b3('0x65')](_0x63b3('0x66'),_0x26d3d0[_0x63b3('0x54')][_0x63b3('0x39')][_0x63b3('0x67')]()),_0x424760);return respondWithRpcPromise('Reload','destroy',{'module':_0x63b3('0x69')});}return null;})[_0x63b3('0x51')](handleError(_0x714a04,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3ac58bc..0659d2b 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 _0xa74f=['network','../../config/logger','bluebird','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x54c680,_0x2fff8c){var _0x5439d9=function(_0x2ad2d3){while(--_0x2ad2d3){_0x54c680['push'](_0x54c680['shift']());}};_0x5439d9(++_0x2fff8c);}(_0xa74f,0x9a));var _0xfa74=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xa74f[_0x4b7b69];return _0x173b4c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf290=['Network','network','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1c39d7,_0x241835){var _0x52f255=function(_0x64caf7){while(--_0x64caf7){_0x1c39d7['push'](_0x1c39d7['shift']());}};_0x52f255(++_0x241835);}(_0xf290,0xde));var _0x0f29=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0xf290[_0x334f9a];return _0x2b219d;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var fs=require('fs');var path=require(_0x0f29('0x4'));var rimraf=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var attributes=require('./network.attributes');module[_0x0f29('0x7')]=function(_0x4911fb,_0x2d5350){return _0x4911fb[_0x0f29('0x8')](_0x0f29('0x9'),attributes,{'tableName':_0x0f29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 238ca47..861708d 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(_0x41f34f,_0x3b2ac2){var _0x2b1eb5=function(_0x5e8522){while(--_0x5e8522){_0x41f34f['push'](_0x41f34f['shift']());}};_0x2b1eb5(++_0x3b2ac2);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5316b9,_0x1aae1e){_0x5316b9=_0x5316b9-0x0;var _0x25bf20=_0x7a54[_0x5316b9];return _0x25bf20;};'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 57d9c74..491f10c 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 _0x3186=['/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3186,0x143));var _0x6318=function(_0x39120f,_0x14ead7){_0x39120f=_0x39120f-0x0;var _0x53b2c7=_0x3186[_0x39120f];return _0x53b2c7;};'use strict';var multer=require(_0x6318('0x0'));var util=require(_0x6318('0x1'));var path=require(_0x6318('0x2'));var timeout=require(_0x6318('0x3'));var express=require(_0x6318('0x4'));var router=express[_0x6318('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6318('0x6'));var interaction=require(_0x6318('0x7'));var config=require(_0x6318('0x8'));var controller=require(_0x6318('0x9'));router[_0x6318('0xa')]('/',auth['isAuthenticated'](),controller[_0x6318('0xb')]);router[_0x6318('0xa')](_0x6318('0xc'),auth[_0x6318('0xd')](),controller[_0x6318('0xe')]);router[_0x6318('0xa')](_0x6318('0xf'),auth[_0x6318('0xd')](),controller[_0x6318('0x10')]);router[_0x6318('0xa')](_0x6318('0x11'),auth[_0x6318('0xd')](),controller[_0x6318('0x12')]);router[_0x6318('0xa')](_0x6318('0x13'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x6318('0xa')](_0x6318('0x14'),auth[_0x6318('0xd')](),controller[_0x6318('0x15')]);router[_0x6318('0xa')](_0x6318('0x16'),auth[_0x6318('0xd')](),controller[_0x6318('0x17')]);router[_0x6318('0xa')](_0x6318('0x18'),auth[_0x6318('0xd')](),controller[_0x6318('0x19')]);router['post']('/',auth[_0x6318('0xd')](),controller[_0x6318('0x1a')]);router[_0x6318('0x1b')](_0x6318('0x11'),auth['isAuthenticated'](),controller[_0x6318('0x1c')]);router[_0x6318('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6318('0x1d')]);router[_0x6318('0x1b')]('/:id/notify',controller[_0x6318('0x1e')]);router[_0x6318('0x1b')]('/:id/applications',auth[_0x6318('0xd')](),controller['addApplications']);router[_0x6318('0x1b')](_0x6318('0x18'),auth[_0x6318('0xd')](),controller[_0x6318('0x1f')]);router['post']('/:id/send',auth[_0x6318('0xd')](),controller[_0x6318('0x20')]);router[_0x6318('0x21')](_0x6318('0xf'),auth[_0x6318('0xd')](),controller['update']);router[_0x6318('0x22')](_0x6318('0xf'),auth[_0x6318('0xd')](),controller[_0x6318('0x23')]);router[_0x6318('0x22')](_0x6318('0x11'),auth[_0x6318('0xd')](),controller[_0x6318('0x24')]);router[_0x6318('0x22')](_0x6318('0x13'),auth[_0x6318('0xd')](),controller[_0x6318('0x25')]);router[_0x6318('0x22')]('/:id/users',auth[_0x6318('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x01cb=['isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getAgents','post','create','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0x01cb,0x14d));var _0xb01c=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x01cb[_0x22e47a];return _0x15a12a;};'use strict';var multer=require(_0xb01c('0x0'));var util=require(_0xb01c('0x1'));var path=require(_0xb01c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb01c('0x3'));var router=express['Router']();var fs_extra=require(_0xb01c('0x4'));var auth=require(_0xb01c('0x5'));var interaction=require(_0xb01c('0x6'));var config=require(_0xb01c('0x7'));var controller=require('./openchannelAccount.controller');router[_0xb01c('0x8')]('/',auth[_0xb01c('0x9')](),controller[_0xb01c('0xa')]);router[_0xb01c('0x8')]('/describe',auth[_0xb01c('0x9')](),controller[_0xb01c('0xb')]);router['get']('/:id',auth[_0xb01c('0x9')](),controller[_0xb01c('0xc')]);router[_0xb01c('0x8')](_0xb01c('0xd'),auth[_0xb01c('0x9')](),controller[_0xb01c('0xe')]);router[_0xb01c('0x8')](_0xb01c('0xf'),auth[_0xb01c('0x9')](),controller['getAnswers']);router[_0xb01c('0x8')](_0xb01c('0x10'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x11')]);router[_0xb01c('0x8')](_0xb01c('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb01c('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xb01c('0x13')]);router[_0xb01c('0x14')]('/',auth[_0xb01c('0x9')](),controller[_0xb01c('0x15')]);router[_0xb01c('0x14')](_0xb01c('0xd'),auth[_0xb01c('0x9')](),controller['addDisposition']);router[_0xb01c('0x14')]('/:id/canned_answers',auth[_0xb01c('0x9')](),controller['addAnswer']);router[_0xb01c('0x14')](_0xb01c('0x16'),controller[_0xb01c('0x17')]);router[_0xb01c('0x14')](_0xb01c('0x10'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb01c('0x19')]);router[_0xb01c('0x14')](_0xb01c('0x1a'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x1b')]);router[_0xb01c('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xb01c('0x1d')]);router[_0xb01c('0x1e')](_0xb01c('0x1f'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x20')]);router[_0xb01c('0x1e')]('/:id/dispositions',auth[_0xb01c('0x9')](),controller[_0xb01c('0x21')]);router[_0xb01c('0x1e')](_0xb01c('0xf'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x22')]);router[_0xb01c('0x1e')](_0xb01c('0x23'),auth[_0xb01c('0x9')](),controller[_0xb01c('0x24')]);module[_0xb01c('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f32c0ca..80d8370 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 _0xfefb=['sequelize','STRING','name','generate','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'];(function(_0x51125e,_0x56df44){var _0x39a92c=function(_0x245b4f){while(--_0x245b4f){_0x51125e['push'](_0x51125e['shift']());}};_0x39a92c(++_0x56df44);}(_0xfefb,0x78));var _0xbfef=function(_0x1bed81,_0x4b326a){_0x1bed81=_0x1bed81-0x0;var _0x2ac7ac=_0xfefb[_0x1bed81];return _0x2ac7ac;};'use strict';var Sequelize=require(_0xbfef('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xbfef('0x1')],'unique':_0xbfef('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbfef('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbfef('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbfef('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbfef('0x4');}},'notificationSound':{'type':Sequelize[_0xbfef('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbfef('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbfef('0x1')]},'queueTransfer':{'type':Sequelize[_0xbfef('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbfef('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xbfef('0x5')],'defaultValue':![],'comment':_0xbfef('0x8'),'set':function(_0x37f8ab){if(!_0x37f8ab)this[_0xbfef('0x9')](_0xbfef('0xa'),null);this[_0xbfef('0x9')](_0xbfef('0xb'),_0x37f8ab);}}}; \ No newline at end of file +var _0xbb95=['STRING','name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x200d3d,_0xd42086){var _0x4f30f1=function(_0x44e185){while(--_0x44e185){_0x200d3d['push'](_0x200d3d['shift']());}};_0x4f30f1(++_0xd42086);}(_0xbb95,0x12a));var _0x5bb9=function(_0x19c882,_0x32fe6a){_0x19c882=_0x19c882-0x0;var _0x15a997=_0xbb95[_0x19c882];return _0x15a997;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5bb9('0x0'));module[_0x5bb9('0x1')]={'name':{'type':Sequelize[_0x5bb9('0x2')],'unique':_0x5bb9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5bb9('0x2')]},'token':{'type':Sequelize[_0x5bb9('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5bb9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5bb9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5bb9('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5bb9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5bb9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bb9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bb9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bb9('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bb9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5bb9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5bb9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x5bb9('0x5')],'defaultValue':![],'comment':_0x5bb9('0x8'),'set':function(_0x4632c5){if(!_0x4632c5)this[_0x5bb9('0x9')](_0x5bb9('0xa'),null);this[_0x5bb9('0x9')](_0x5bb9('0xb'),_0x4632c5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0ffe16c..b50e749 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 _0xf721=['emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','create','user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','list','applications','orderBy','priority','asc','contact','firstName','threadId','externalUrl','OpenchannelInteraction','spread','lastName','messageId','interaction','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','bulkCreate','findAndCountAll','getApplications','Owner','internal','Tags','color','tag','addAgents','omit','isArray'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf721,0x16f));var _0x1f72=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xf721[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require(_0x1f72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f72('0x1'));var jsonpatch=require(_0x1f72('0x2'));var rp=require(_0x1f72('0x3'));var moment=require(_0x1f72('0x4'));var BPromise=require(_0x1f72('0x5'));var Mustache=require(_0x1f72('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1f72('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f72('0x8'));var _=require(_0x1f72('0x9'));var squel=require(_0x1f72('0xa'));var crypto=require('crypto');var jsforce=require(_0x1f72('0xb'));var deskjs=require(_0x1f72('0xc'));var toCsv=require(_0x1f72('0x7'));var querystring=require(_0x1f72('0xd'));var Papa=require(_0x1f72('0xe'));var Redis=require(_0x1f72('0xf'));var authService=require(_0x1f72('0x10'));var qs=require(_0x1f72('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f72('0x12'));var logger=require(_0x1f72('0x13'))('api');var utils=require(_0x1f72('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f72('0x15'))['db'];config[_0x1f72('0x16')]=_[_0x1f72('0x17')](config[_0x1f72('0x16')],{'host':_0x1f72('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f72('0x16')]));require(_0x1f72('0x19'))[_0x1f72('0x1a')](socket);var jayson=require(_0x1f72('0x1b'));var client=jayson['client'][_0x1f72('0x1c')]({'port':0x232c});var client9002=jayson[_0x1f72('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b5ff,_0x446659,_0x1ac709,_0x55a2e2){return new BPromise(function(_0xa7efce,_0x46a2c4){var _0x4b2208=_0x55a2e2||client;return _0x4b2208['request'](_0x32b5ff,_0x1ac709)[_0x1f72('0x1e')](function(_0x55df28){logger[_0x1f72('0x1f')](_0x1f72('0x20'),_0x446659,'request\x20sent');logger[_0x1f72('0x21')](_0x1f72('0x22'),_0x446659,'request\x20sent',JSON['stringify'](_0x55df28));if(_0x55df28[_0x1f72('0x23')]){if(_0x55df28[_0x1f72('0x23')][_0x1f72('0x24')]===0x1f4){logger[_0x1f72('0x23')](_0x1f72('0x20'),_0x446659,_0x55df28[_0x1f72('0x23')][_0x1f72('0x25')]);return _0x46a2c4(_0x55df28['error'][_0x1f72('0x25')]);}logger[_0x1f72('0x23')](_0x1f72('0x20'),_0x446659,_0x55df28[_0x1f72('0x23')][_0x1f72('0x25')]);return _0xa7efce(_0x55df28[_0x1f72('0x23')][_0x1f72('0x25')]);}else{logger[_0x1f72('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x446659,_0x1f72('0x26'));_0xa7efce(_0x55df28[_0x1f72('0x27')][_0x1f72('0x25')]);}})[_0x1f72('0x28')](function(_0x219457){logger[_0x1f72('0x23')](_0x1f72('0x20'),_0x446659,_0x219457);_0x46a2c4(_0x219457);});});}function respondWithStatusCode(_0x49b93f,_0x50f6bb){_0x50f6bb=_0x50f6bb||0xcc;return function(_0x30bae5){if(_0x30bae5){return _0x49b93f[_0x1f72('0x29')](_0x50f6bb);}return _0x49b93f[_0x1f72('0x2a')](_0x50f6bb)[_0x1f72('0x2b')]();};}function respondWithResult(_0x47d07f,_0x241e32){_0x241e32=_0x241e32||0xc8;return function(_0x1d112e){if(_0x1d112e){return _0x47d07f['status'](_0x241e32)[_0x1f72('0x2c')](_0x1d112e);}};}function respondWithFilteredResult(_0x45bb81,_0x4ae669){return function(_0x264001){if(_0x264001){var _0xa885ae=typeof _0x4ae669[_0x1f72('0x2d')]==='undefined'&&typeof _0x4ae669['limit']===_0x1f72('0x2e');var _0xda9b08=_0x264001[_0x1f72('0x2f')];var _0x5168a5=_0xa885ae?0x0:_0x4ae669[_0x1f72('0x2d')];var _0x2bd1fc=_0xa885ae?_0x264001[_0x1f72('0x2f')]:_0x4ae669[_0x1f72('0x2d')]+_0x4ae669[_0x1f72('0x30')];var _0x4c93db;if(_0x2bd1fc>=_0xda9b08){_0x2bd1fc=_0xda9b08;_0x4c93db=0xc8;}else{_0x4c93db=0xce;}_0x45bb81[_0x1f72('0x2a')](_0x4c93db);return _0x45bb81[_0x1f72('0x31')](_0x1f72('0x32'),_0x5168a5+'-'+_0x2bd1fc+'/'+_0xda9b08)[_0x1f72('0x2c')](_0x264001);}return null;};}function patchUpdates(_0x47895c){return function(_0x284a9a){try{jsonpatch['apply'](_0x284a9a,_0x47895c,!![]);}catch(_0x47eba6){return BPromise[_0x1f72('0x33')](_0x47eba6);}return _0x284a9a[_0x1f72('0x34')]();};}function saveUpdates(_0xf47e85,_0x5288ab){return function(_0x895b79){if(_0x895b79){return _0x895b79[_0x1f72('0x35')](_0xf47e85)[_0x1f72('0x1e')](function(_0x83e55e){return _0x83e55e;});}return null;};}function removeEntity(_0x521c7d,_0x40b109){return function(_0x1f92ed){if(_0x1f92ed){return _0x1f92ed[_0x1f72('0x36')]()[_0x1f72('0x1e')](function(){var _0x3199ba=_0x1f92ed[_0x1f72('0x37')]({'plain':!![]});var _0xbf9ab3=_0x1f72('0x38');return db[_0x1f72('0x39')]['destroy']({'where':{'type':_0xbf9ab3,'resourceId':_0x3199ba['id']}})[_0x1f72('0x1e')](function(){return _0x1f92ed;});})['then'](function(){_0x521c7d[_0x1f72('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381ee4,_0xddd1eb){return function(_0x5707e6){if(!_0x5707e6){_0x381ee4[_0x1f72('0x29')](0x194);}return _0x5707e6;};}function handleError(_0x1f0da1,_0x485955){_0x485955=_0x485955||0x1f4;return function(_0x3f9ca6){logger[_0x1f72('0x23')](_0x3f9ca6[_0x1f72('0x3a')]);if(_0x3f9ca6[_0x1f72('0x3b')]){delete _0x3f9ca6[_0x1f72('0x3b')];}_0x1f0da1['status'](_0x485955)[_0x1f72('0x3c')](_0x3f9ca6);};}exports[_0x1f72('0x3d')]=function(_0x294ce2,_0x5ab333){var _0x39d94e={'include':[{'model':db[_0x1f72('0x3e')],'as':_0x1f72('0x3f')}]},_0x324e78={},_0x5f3c7a={'count':0x0,'rows':[]};var _0x143a2f=_[_0x1f72('0x40')](db[_0x1f72('0x41')][_0x1f72('0x42')],function(_0x1f85e5){return{'name':_0x1f85e5[_0x1f72('0x43')],'type':_0x1f85e5[_0x1f72('0x44')][_0x1f72('0x45')]};});_0x324e78['model']=_[_0x1f72('0x40')](_0x143a2f,_0x1f72('0x3b'));_0x324e78[_0x1f72('0x46')]=_[_0x1f72('0x47')](_0x294ce2[_0x1f72('0x46')]);_0x324e78[_0x1f72('0x48')]=_['intersection'](_0x324e78[_0x1f72('0x49')],_0x324e78[_0x1f72('0x46')]);_0x39d94e[_0x1f72('0x4a')]=_[_0x1f72('0x4b')](_0x324e78[_0x1f72('0x49')],qs['fields'](_0x294ce2[_0x1f72('0x46')][_0x1f72('0x4c')]));_0x39d94e[_0x1f72('0x4a')]=_0x39d94e[_0x1f72('0x4a')][_0x1f72('0x4d')]?_0x39d94e['attributes']:_0x324e78[_0x1f72('0x49')];if(!_0x294ce2[_0x1f72('0x46')]['hasOwnProperty'](_0x1f72('0x4e'))){_0x39d94e[_0x1f72('0x30')]=qs['limit'](_0x294ce2[_0x1f72('0x46')][_0x1f72('0x30')]);_0x39d94e[_0x1f72('0x2d')]=qs[_0x1f72('0x2d')](_0x294ce2[_0x1f72('0x46')][_0x1f72('0x2d')]);}_0x39d94e[_0x1f72('0x4f')]=qs[_0x1f72('0x50')](_0x294ce2['query'][_0x1f72('0x50')]);_0x39d94e[_0x1f72('0x51')]=qs[_0x1f72('0x48')](_[_0x1f72('0x52')](_0x294ce2[_0x1f72('0x46')],_0x324e78[_0x1f72('0x48')]),_0x143a2f);if(_0x294ce2['query'][_0x1f72('0x53')]){_0x39d94e[_0x1f72('0x51')]=_[_0x1f72('0x54')](_0x39d94e[_0x1f72('0x51')],{'$or':_[_0x1f72('0x40')](_0x143a2f,function(_0x2f4666){if(_0x2f4666[_0x1f72('0x44')]!==_0x1f72('0x55')){var _0x250119={};_0x250119[_0x2f4666[_0x1f72('0x3b')]]={'$like':'%'+_0x294ce2[_0x1f72('0x46')][_0x1f72('0x53')]+'%'};return _0x250119;}})});}_0x39d94e=_[_0x1f72('0x54')]({},_0x39d94e,_0x294ce2[_0x1f72('0x56')]);var _0x5a24e7={'where':_0x39d94e['where']};return db[_0x1f72('0x41')][_0x1f72('0x2f')](_0x5a24e7)[_0x1f72('0x1e')](function(_0x34e523){_0x5f3c7a[_0x1f72('0x2f')]=_0x34e523;if(_0x294ce2[_0x1f72('0x46')]['includeAll']){_0x39d94e['include']=[{'all':!![]}];}return db[_0x1f72('0x41')][_0x1f72('0x57')](_0x39d94e);})['then'](function(_0x516d99){_0x5f3c7a[_0x1f72('0x58')]=_0x516d99;return _0x5f3c7a;})[_0x1f72('0x1e')](respondWithFilteredResult(_0x5ab333,_0x39d94e))['catch'](handleError(_0x5ab333,null));};exports[_0x1f72('0x59')]=function(_0x12a189,_0x348b48){var _0x380019={'raw':![],'where':{'id':_0x12a189[_0x1f72('0x5a')]['id']},'include':[{'model':db[_0x1f72('0x3e')],'as':'mandatoryDispositionPause'}]},_0x422403={};_0x422403[_0x1f72('0x49')]=_['keys'](db[_0x1f72('0x41')][_0x1f72('0x42')]);_0x422403['query']=_[_0x1f72('0x47')](_0x12a189[_0x1f72('0x46')]);_0x422403[_0x1f72('0x48')]=_[_0x1f72('0x4b')](_0x422403[_0x1f72('0x49')],_0x422403['query']);_0x380019[_0x1f72('0x4a')]=_[_0x1f72('0x4b')](_0x422403['model'],qs[_0x1f72('0x4c')](_0x12a189['query'][_0x1f72('0x4c')]));_0x380019[_0x1f72('0x4a')]=_0x380019[_0x1f72('0x4a')][_0x1f72('0x4d')]?_0x380019['attributes']:_0x422403[_0x1f72('0x49')];if(_0x12a189[_0x1f72('0x46')][_0x1f72('0x5b')]){_0x380019['include']=[{'all':!![]}];}_0x380019=_['merge']({},_0x380019,_0x12a189[_0x1f72('0x56')]);return db[_0x1f72('0x41')]['find'](_0x380019)['then'](handleEntityNotFound(_0x348b48,null))[_0x1f72('0x1e')](respondWithResult(_0x348b48,null))[_0x1f72('0x28')](handleError(_0x348b48,null));};exports['create']=function(_0x1b0f3f,_0x5653bd){return db[_0x1f72('0x41')][_0x1f72('0x5c')](_0x1b0f3f['body'],{})[_0x1f72('0x1e')](function(_0x588ec2){var _0x5ea433=_0x1b0f3f[_0x1f72('0x5d')][_0x1f72('0x37')]({'plain':!![]});if(!_0x5ea433)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ea433[_0x1f72('0x5e')]===_0x1f72('0x5d')){var _0x4205bd=_0x588ec2[_0x1f72('0x37')]({'plain':!![]});var _0x196278='OpenchannelAccounts';return db[_0x1f72('0x5f')][_0x1f72('0x60')]({'where':{'name':_0x196278,'userProfileId':_0x5ea433['userProfileId']},'raw':!![]})[_0x1f72('0x1e')](function(_0x388268){if(_0x388268&&_0x388268['autoAssociation']===0x0){return db[_0x1f72('0x39')]['create']({'name':_0x4205bd[_0x1f72('0x3b')],'resourceId':_0x4205bd['id'],'type':_0x388268['name'],'sectionId':_0x388268['id']},{})[_0x1f72('0x1e')](function(){return _0x588ec2;});}else{return _0x588ec2;}})[_0x1f72('0x28')](function(_0x2fb7e2){logger[_0x1f72('0x23')](_0x1f72('0x61'),_0x2fb7e2);throw _0x2fb7e2;});}return _0x588ec2;})[_0x1f72('0x1e')](respondWithResult(_0x5653bd,0xc9))[_0x1f72('0x28')](handleError(_0x5653bd,null));};exports[_0x1f72('0x35')]=function(_0x194894,_0x4e1351){if(_0x194894[_0x1f72('0x62')]['id']){delete _0x194894['body']['id'];}return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x194894[_0x1f72('0x5a')]['id']},'include':[{'model':db[_0x1f72('0x3e')],'as':_0x1f72('0x3f')}]})[_0x1f72('0x1e')](handleEntityNotFound(_0x4e1351,null))[_0x1f72('0x1e')](saveUpdates(_0x194894[_0x1f72('0x62')],null))[_0x1f72('0x1e')](respondWithResult(_0x4e1351,null))[_0x1f72('0x28')](handleError(_0x4e1351,null));};exports[_0x1f72('0x36')]=function(_0x3305cf,_0x1b819e){return db['OpenchannelAccount'][_0x1f72('0x60')]({'where':{'id':_0x3305cf[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x1b819e,null))[_0x1f72('0x1e')](removeEntity(_0x1b819e,null))[_0x1f72('0x28')](handleError(_0x1b819e,null));};exports[_0x1f72('0x63')]=function(_0x124e55,_0x5d9304){return db[_0x1f72('0x41')]['describe']()['then'](respondWithResult(_0x5d9304,null))[_0x1f72('0x28')](handleError(_0x5d9304,null));};exports['addDisposition']=function(_0x91688,_0xc1bb91,_0x63209b){if(_0x91688[_0x1f72('0x62')]['id']){delete _0x91688[_0x1f72('0x62')]['id'];}return db['OpenchannelAccount'][_0x1f72('0x60')]({'where':{'id':_0x91688[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0xc1bb91,null))[_0x1f72('0x1e')](function(_0x115961){if(_0x115961){_0x91688[_0x1f72('0x62')][_0x1f72('0x64')]=_0x115961['id'];return db[_0x1f72('0x65')][_0x1f72('0x5c')](_0x91688[_0x1f72('0x62')]);}})[_0x1f72('0x1e')](respondWithResult(_0xc1bb91,null))[_0x1f72('0x28')](handleError(_0xc1bb91,null));};exports[_0x1f72('0x66')]=function(_0x296dcc,_0x4da718,_0x475fa8){var _0x54aaea={'raw':![],'where':{}};var _0x44daf1={};var _0x5bd24b={'count':0x0,'rows':[]};return db[_0x1f72('0x41')][_0x1f72('0x67')]({'where':{'id':_0x296dcc[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x4da718,null))[_0x1f72('0x1e')](function(_0x4301f8){if(_0x4301f8){_0x44daf1[_0x1f72('0x49')]=_[_0x1f72('0x47')](db[_0x1f72('0x65')][_0x1f72('0x42')]);_0x44daf1[_0x1f72('0x46')]=_[_0x1f72('0x47')](_0x296dcc[_0x1f72('0x46')]);_0x44daf1['filters']=_[_0x1f72('0x4b')](_0x44daf1[_0x1f72('0x49')],_0x44daf1['query']);_0x54aaea['attributes']=_[_0x1f72('0x4b')](_0x44daf1[_0x1f72('0x49')],qs[_0x1f72('0x4c')](_0x296dcc[_0x1f72('0x46')][_0x1f72('0x4c')]));_0x54aaea[_0x1f72('0x4a')]=_0x54aaea['attributes']['length']?_0x54aaea[_0x1f72('0x4a')]:_0x44daf1[_0x1f72('0x49')];if(!_0x296dcc[_0x1f72('0x46')][_0x1f72('0x68')](_0x1f72('0x4e'))){_0x54aaea[_0x1f72('0x30')]=qs[_0x1f72('0x30')](_0x296dcc[_0x1f72('0x46')][_0x1f72('0x30')]);_0x54aaea[_0x1f72('0x2d')]=qs[_0x1f72('0x2d')](_0x296dcc[_0x1f72('0x46')][_0x1f72('0x2d')]);}_0x54aaea[_0x1f72('0x4f')]=qs[_0x1f72('0x50')](_0x296dcc['query'][_0x1f72('0x50')]);_0x54aaea[_0x1f72('0x51')]=qs['filters'](_['pick'](_0x296dcc[_0x1f72('0x46')],_0x44daf1[_0x1f72('0x48')]));_0x54aaea[_0x1f72('0x51')]['OpenchannelAccountId']=_0x4301f8['id'];if(_0x296dcc[_0x1f72('0x46')][_0x1f72('0x53')]){_0x54aaea['where']=_[_0x1f72('0x54')](_0x54aaea[_0x1f72('0x51')],{'$or':_['map'](_0x54aaea[_0x1f72('0x4a')],function(_0x5cb95e){var _0x2455dc={};_0x2455dc[_0x5cb95e]={'$like':'%'+_0x296dcc[_0x1f72('0x46')][_0x1f72('0x53')]+'%'};return _0x2455dc;})});}_0x54aaea=_[_0x1f72('0x54')]({},_0x54aaea,_0x296dcc[_0x1f72('0x56')]);return db['Disposition'][_0x1f72('0x2f')]({'where':_0x54aaea['where']})['then'](function(_0x5a6881){_0x5bd24b[_0x1f72('0x2f')]=_0x5a6881;if(_0x296dcc[_0x1f72('0x46')][_0x1f72('0x5b')]){_0x54aaea[_0x1f72('0x69')]=[{'all':!![]}];}return db[_0x1f72('0x65')][_0x1f72('0x57')](_0x54aaea);})['then'](function(_0x12d380){_0x5bd24b[_0x1f72('0x58')]=_0x12d380;return _0x5bd24b;});}})[_0x1f72('0x1e')](respondWithFilteredResult(_0x4da718,_0x54aaea))[_0x1f72('0x28')](handleError(_0x4da718,null));};exports[_0x1f72('0x6a')]=function(_0x449e7a,_0x558563,_0x1b3a35){return db[_0x1f72('0x41')]['find']({'where':{'id':_0x449e7a[_0x1f72('0x5a')]['id']}})['then'](handleEntityNotFound(_0x558563,null))['then'](function(_0xb16cee){if(_0xb16cee){return _0xb16cee[_0x1f72('0x6a')](_0x449e7a[_0x1f72('0x46')]['ids']);}})[_0x1f72('0x1e')](respondWithStatusCode(_0x558563,null))['catch'](handleError(_0x558563,null));};exports[_0x1f72('0x6b')]=function(_0x5ae92e,_0x48f30c,_0x28d349){if(_0x5ae92e[_0x1f72('0x62')]['id']){delete _0x5ae92e[_0x1f72('0x62')]['id'];}return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x5ae92e[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x48f30c,null))['then'](function(_0x143f0a){if(_0x143f0a){_0x5ae92e[_0x1f72('0x62')][_0x1f72('0x64')]=_0x143f0a['id'];return db[_0x1f72('0x6c')][_0x1f72('0x5c')](_0x5ae92e[_0x1f72('0x62')]);}})[_0x1f72('0x1e')](respondWithResult(_0x48f30c,null))['catch'](handleError(_0x48f30c,null));};exports[_0x1f72('0x6d')]=function(_0x454cde,_0x53f258,_0x303074){var _0x52fad0={'raw':![],'where':{}};var _0x201b48={};var _0x4c948c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1f72('0x67')]({'where':{'id':_0x454cde['params']['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x53f258,null))['then'](function(_0x3964d3){if(_0x3964d3){_0x201b48['model']=_[_0x1f72('0x47')](db[_0x1f72('0x6c')][_0x1f72('0x42')]);_0x201b48[_0x1f72('0x46')]=_['keys'](_0x454cde[_0x1f72('0x46')]);_0x201b48[_0x1f72('0x48')]=_[_0x1f72('0x4b')](_0x201b48[_0x1f72('0x49')],_0x201b48[_0x1f72('0x46')]);_0x52fad0[_0x1f72('0x4a')]=_[_0x1f72('0x4b')](_0x201b48[_0x1f72('0x49')],qs[_0x1f72('0x4c')](_0x454cde['query'][_0x1f72('0x4c')]));_0x52fad0[_0x1f72('0x4a')]=_0x52fad0[_0x1f72('0x4a')][_0x1f72('0x4d')]?_0x52fad0['attributes']:_0x201b48['model'];if(!_0x454cde[_0x1f72('0x46')]['hasOwnProperty']('nolimit')){_0x52fad0[_0x1f72('0x30')]=qs[_0x1f72('0x30')](_0x454cde[_0x1f72('0x46')][_0x1f72('0x30')]);_0x52fad0['offset']=qs['offset'](_0x454cde[_0x1f72('0x46')]['offset']);}_0x52fad0[_0x1f72('0x4f')]=qs[_0x1f72('0x50')](_0x454cde[_0x1f72('0x46')][_0x1f72('0x50')]);_0x52fad0['where']=qs[_0x1f72('0x48')](_[_0x1f72('0x52')](_0x454cde[_0x1f72('0x46')],_0x201b48[_0x1f72('0x48')]));_0x52fad0[_0x1f72('0x51')]['OpenchannelAccountId']=_0x3964d3['id'];if(_0x454cde[_0x1f72('0x46')][_0x1f72('0x53')]){_0x52fad0['where']=_[_0x1f72('0x54')](_0x52fad0[_0x1f72('0x51')],{'$or':_['map'](_0x52fad0[_0x1f72('0x4a')],function(_0xa9b05f){var _0x16909a={};_0x16909a[_0xa9b05f]={'$like':'%'+_0x454cde[_0x1f72('0x46')]['filter']+'%'};return _0x16909a;})});}_0x52fad0=_[_0x1f72('0x54')]({},_0x52fad0,_0x454cde[_0x1f72('0x56')]);return db['CannedAnswer'][_0x1f72('0x2f')]({'where':_0x52fad0['where']})['then'](function(_0x70ad82){_0x4c948c[_0x1f72('0x2f')]=_0x70ad82;if(_0x454cde[_0x1f72('0x46')][_0x1f72('0x5b')]){_0x52fad0[_0x1f72('0x69')]=[{'all':!![]}];}return db[_0x1f72('0x6c')]['findAll'](_0x52fad0);})[_0x1f72('0x1e')](function(_0xf11f73){_0x4c948c[_0x1f72('0x58')]=_0xf11f73;return _0x4c948c;});}})[_0x1f72('0x1e')](respondWithFilteredResult(_0x53f258,_0x52fad0))[_0x1f72('0x28')](handleError(_0x53f258,null));};exports[_0x1f72('0x6e')]=function(_0x1e7b37,_0x285004,_0x4296f5){return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x1e7b37[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x285004,null))['then'](function(_0x4786fb){if(_0x4786fb){return _0x4786fb[_0x1f72('0x6e')](_0x1e7b37[_0x1f72('0x46')][_0x1f72('0x6f')]);}})[_0x1f72('0x1e')](respondWithStatusCode(_0x285004,null))[_0x1f72('0x28')](handleError(_0x285004,null));};exports[_0x1f72('0x70')]=function(_0x519c64,_0x42fb87,_0x2cc9e3){var _0x2cad4a={'body':_0x519c64['body'],'channel':'openchannel'};var _0x1c422c=[];var _0x2a993f=[];var _0xd000d6={};var _0x6d3c9e=![];return db[_0x1f72('0x71')][_0x1f72('0x63')]()[_0x1f72('0x1e')](function(_0x29fc8b){if(!_0x29fc8b){throw new db[(_0x1f72('0x72'))][(_0x1f72('0x73'))](_0x1f72('0x74'));}_0x1c422c=_[_0x1f72('0x75')](_[_0x1f72('0x47')](_0x29fc8b),[_0x1f72('0x76'),_0x1f72('0x77')]);_0x2a993f=_['difference'](_[_0x1f72('0x47')](_0x29fc8b),[_0x1f72('0x76'),_0x1f72('0x77'),'CompanyId',_0x1f72('0x78')]);if(_0x519c64[_0x1f72('0x62')]['id']){delete _0x519c64[_0x1f72('0x62')]['id'];}if(_['isNil'](_0x519c64[_0x1f72('0x62')]['from'])){throw new db[(_0x1f72('0x72'))][(_0x1f72('0x73'))](_0x1f72('0x79'));}if(_['isNil'](_0x519c64['body'][_0x1f72('0x62')])||_0x519c64[_0x1f72('0x62')]['body']===''){throw new db['Sequelize'][(_0x1f72('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1f72('0x7a')](_0x519c64['body']['mapKey'])){throw new db[(_0x1f72('0x72'))]['ValidationError'](_0x1f72('0x7b')+_0x2a993f);}if(!_[_0x1f72('0x7c')](_0x2a993f,_0x519c64[_0x1f72('0x62')][_0x1f72('0x7d')])){throw new db['Sequelize'][(_0x1f72('0x73'))](_0x1f72('0x7e')+_0x2a993f);}_0xd000d6[_0x519c64['body'][_0x1f72('0x7d')]]=_0x519c64[_0x1f72('0x62')][_0x1f72('0x7f')];})[_0x1f72('0x1e')](function(){return db[_0x1f72('0x41')]['find']({'where':{'id':_0x519c64[_0x1f72('0x5a')]['id']},'include':[{'model':db[_0x1f72('0x80')],'as':'List','include':[{'model':db[_0x1f72('0x71')],'as':_0x1f72('0x81'),'where':_0xd000d6,'limit':0x1,'order':[[_0x1f72('0x77'),_0x1f72('0x82')]]}]},{'model':db[_0x1f72('0x83')],'as':_0x1f72('0x84')}]});})[_0x1f72('0x1e')](handleEntityNotFound(_0x42fb87,null))[_0x1f72('0x1e')](function(_0x21f97f){if(_0x21f97f&&_0x21f97f[_0x1f72('0x85')]){_0x2cad4a[_0x1f72('0x86')]=_0x21f97f;_0x2cad4a['applications']=_0x21f97f[_0x1f72('0x84')];_0x2cad4a[_0x1f72('0x87')]=_0x21f97f[_0x1f72('0x85')];_0x2cad4a[_0x1f72('0x88')]=_[_0x1f72('0x89')](_0x2cad4a['applications'],[_0x1f72('0x8a')],[_0x1f72('0x8b')]);if(_0x2cad4a[_0x1f72('0x86')][_0x1f72('0x84')]){delete _0x2cad4a[_0x1f72('0x86')]['Applications'];}if(_0x2cad4a['account'][_0x1f72('0x85')]&&_0x2cad4a[_0x1f72('0x86')][_0x1f72('0x85')][_0x1f72('0x81')]['length']){return _0x2cad4a[_0x1f72('0x86')]['List'][_0x1f72('0x81')][0x0];}var _0x52e44d=_[_0x1f72('0x17')](_0x519c64['body'],{'firstName':_0x519c64[_0x1f72('0x62')][_0x1f72('0x7f')],'ListId':_0x21f97f[_0x1f72('0x78')]});_0x52e44d[_0x519c64['body']['mapKey']]=_0x519c64[_0x1f72('0x62')][_0x1f72('0x7f')];return db[_0x1f72('0x71')]['create'](_0x52e44d,{'fields':_0x1c422c,'raw':!![]});}})['then'](handleEntityNotFound(_0x42fb87,null))[_0x1f72('0x1e')](function(_0x4cd043){_0x2cad4a[_0x1f72('0x8c')]=_0x4cd043;if(_0x4cd043){var _0x44ecbc={'ContactId':_0x4cd043['id'],'OpenchannelAccountId':_0x519c64['params']['id'],'from':(_0x4cd043[_0x1f72('0x8d')]||'')+'\x20'+(_0x4cd043['lastName']||'')};var _0x57e512={'OpenchannelAccountId':_0x519c64[_0x1f72('0x5a')]['id'],'closed':![]};if(_0x519c64[_0x1f72('0x62')][_0x1f72('0x8e')]){_0x57e512['threadId']=_0x519c64['body'][_0x1f72('0x8e')];return db['OpenchannelInteraction'][_0x1f72('0x60')]({'where':_0x57e512})['then'](function(_0x15ecf3){if(_0x15ecf3){return[_0x15ecf3,![]];}_0x44ecbc['threadId']=_0x519c64['body'][_0x1f72('0x8e')];_0x44ecbc[_0x1f72('0x8f')]=_0x519c64[_0x1f72('0x62')]['externalUrl'];return db[_0x1f72('0x90')][_0x1f72('0x5c')](_0x44ecbc)['then'](function(_0x3a138a){return[_0x3a138a,!![]];});});}else{_0x57e512[_0x1f72('0x8e')]=null;}_0x57e512['ContactId']=_0x4cd043['id'];return db[_0x1f72('0x90')][_0x1f72('0x60')]({'where':_0x57e512})[_0x1f72('0x1e')](function(_0x88f2f5){if(_0x88f2f5){return[_0x88f2f5,![]];}return db['OpenchannelInteraction']['create'](_0x44ecbc)[_0x1f72('0x1e')](function(_0x42d98f){return[_0x42d98f,!![]];});});}})[_0x1f72('0x91')](function(_0x2ed416,_0x4afd9a){if(_0x2ed416){_0x6d3c9e=_0x4afd9a;if(!_0x4afd9a){var _0x14780a={'from':(_0x2cad4a[_0x1f72('0x8c')][_0x1f72('0x8d')]||'')+'\x20'+(_0x2cad4a['contact'][_0x1f72('0x92')]||'')};if(_0x519c64[_0x1f72('0x62')][_0x1f72('0x8e')]&&_0x519c64['body'][_0x1f72('0x93')]&&_0x519c64[_0x1f72('0x62')][_0x1f72('0x8e')]!=_0x519c64['body']['messageId']){_0x14780a['threadId']=_0x519c64[_0x1f72('0x62')][_0x1f72('0x93')];}return _0x2ed416[_0x1f72('0x35')](_0x14780a);}else{return _0x2ed416;}}})[_0x1f72('0x1e')](function(_0x4fb53a){_0x2cad4a[_0x1f72('0x94')]=_0x4fb53a['get']({'plain':!![]});_0x2cad4a[_0x1f72('0x94')]['created']=_0x6d3c9e;if(_0x2cad4a['interaction']['created']){if(_0x2cad4a[_0x1f72('0x86')][_0x1f72('0x95')]){_0x2cad4a[_0x1f72('0x88')][_0x1f72('0x96')]({'id':0x0,'priority':_0x2cad4a[_0x1f72('0x88')]['length']+0x1,'app':'close','appdata':_0x1f72('0x97'),'interval':_0x1f72('0x98')});}}return db[_0x1f72('0x99')][_0x1f72('0x5c')]({'body':_0x519c64[_0x1f72('0x62')][_0x1f72('0x62')],'OpenchannelAccountId':_0x519c64['params']['id'],'OpenchannelInteractionId':_0x4fb53a['id'],'direction':'in','ContactId':_0x2cad4a['contact']['id'],'AttachmentId':_0x519c64[_0x1f72('0x62')][_0x1f72('0x9a')]});})[_0x1f72('0x1e')](function(_0x1c3946){_0x2cad4a[_0x1f72('0x25')]=_0x1c3946;if(_0x2cad4a['interaction']['UserId']){return db[_0x1f72('0x9b')][_0x1f72('0x60')]({'attributes':['id',_0x1f72('0x3b')],'where':{'id':_0x2cad4a[_0x1f72('0x94')][_0x1f72('0x9c')]}})[_0x1f72('0x1e')](function(_0x1251d9){if(_0x1251d9){_0x2cad4a[_0x1f72('0x88')][_0x1f72('0x9d')]({'id':0x0,'priority':0x0,'app':_0x1f72('0x9e'),'appdata':_0x1251d9[_0x1f72('0x3b')]+','+(_0x2cad4a[_0x1f72('0x86')][_0x1f72('0x9f')]||0xa),'interval':_0x1f72('0x98')});_0x2cad4a[_0x1f72('0xa0')]=![];}return respondWithRpcPromise(_0x1f72('0xa1'),_0x1f72('0xa2'),_0x2cad4a);});}return respondWithRpcPromise('Start',_0x1f72('0xa2'),_0x2cad4a);})['then'](function(_0x1fdd24){respondWithRpcPromise(_0x1f72('0xa3'),_0x1f72('0xa3'),{'event':'notify','message':_0x1fdd24},client9002);return _0x1fdd24;})['then'](respondWithResult(_0x42fb87,null))['catch'](handleError(_0x42fb87,null));};exports['addApplications']=function(_0x1ff54a,_0x427f8e,_0x3b8f0a){return db[_0x1f72('0x41')][_0x1f72('0x67')]({'where':{'id':_0x1ff54a[_0x1f72('0x5a')]['id']}})['then'](handleEntityNotFound(_0x427f8e,null))[_0x1f72('0x1e')](function(_0x183335){if(_0x183335){return db[_0x1f72('0xa4')]['transaction'](function(_0x1a8884){return db[_0x1f72('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x1ff54a[_0x1f72('0x5a')]['id']},'transaction':_0x1a8884})['then'](function(_0x2de135){var _0x2a7274=_[_0x1f72('0x40')](_0x1ff54a['body'],function(_0x4dce7){_0x4dce7['OpenchannelAccountId']=_0x1ff54a[_0x1f72('0x5a')]['id'];return _0x4dce7;});return db['OpenchannelApplication'][_0x1f72('0xa5')](_0x2a7274,{'transaction':_0x1a8884});});})[_0x1f72('0x1e')](function(){return db[_0x1f72('0x83')][_0x1f72('0xa6')]({'where':{'OpenchannelAccountId':_0x1ff54a[_0x1f72('0x5a')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x427f8e,null))[_0x1f72('0x28')](handleError(_0x427f8e,null));};exports[_0x1f72('0xa7')]=function(_0x5839f1,_0x5c4292,_0x312bfe){var _0x2f302c={};var _0x1e5e43={};var _0x5cafde;var _0x38aa8a;return db['OpenchannelAccount'][_0x1f72('0x67')]({'where':{'id':_0x5839f1[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x5c4292,null))[_0x1f72('0x1e')](function(_0x265d41){if(_0x265d41){_0x5cafde=_0x265d41;_0x1e5e43['model']=_[_0x1f72('0x47')](db[_0x1f72('0x83')][_0x1f72('0x42')]);_0x1e5e43['query']=_[_0x1f72('0x47')](_0x5839f1['query']);_0x1e5e43[_0x1f72('0x48')]=_[_0x1f72('0x4b')](_0x1e5e43['model'],_0x1e5e43['query']);_0x2f302c['attributes']=_[_0x1f72('0x4b')](_0x1e5e43['model'],qs[_0x1f72('0x4c')](_0x5839f1[_0x1f72('0x46')][_0x1f72('0x4c')]));_0x2f302c[_0x1f72('0x4a')]=_0x2f302c['attributes'][_0x1f72('0x4d')]?_0x2f302c[_0x1f72('0x4a')]:_0x1e5e43['model'];_0x2f302c[_0x1f72('0x4f')]=qs[_0x1f72('0x50')](_0x5839f1[_0x1f72('0x46')][_0x1f72('0x50')]);_0x2f302c['where']=qs[_0x1f72('0x48')](_[_0x1f72('0x52')](_0x5839f1[_0x1f72('0x46')],_0x1e5e43[_0x1f72('0x48')]));if(_0x5839f1[_0x1f72('0x46')]['filter']){_0x2f302c[_0x1f72('0x51')]=_[_0x1f72('0x54')](_0x2f302c[_0x1f72('0x51')],{'$or':_[_0x1f72('0x40')](_0x2f302c[_0x1f72('0x4a')],function(_0x2da508){var _0x4f56b2={};_0x4f56b2[_0x2da508]={'$like':'%'+_0x5839f1[_0x1f72('0x46')][_0x1f72('0x53')]+'%'};return _0x4f56b2;})});}_0x2f302c=_[_0x1f72('0x54')]({},_0x2f302c,_0x5839f1[_0x1f72('0x56')]);return _0x5cafde['getApplications'](_0x2f302c);}})[_0x1f72('0x1e')](function(_0x13484d){if(_0x13484d){_0x38aa8a=_0x13484d['length'];if(!_0x5839f1[_0x1f72('0x46')]['hasOwnProperty'](_0x1f72('0x4e'))){_0x2f302c[_0x1f72('0x30')]=qs[_0x1f72('0x30')](_0x5839f1['query'][_0x1f72('0x30')]);_0x2f302c['offset']=qs[_0x1f72('0x2d')](_0x5839f1[_0x1f72('0x46')]['offset']);}return _0x5cafde[_0x1f72('0xa7')](_0x2f302c);}})['then'](function(_0x7c92b5){if(_0x7c92b5){return _0x7c92b5?{'count':_0x38aa8a,'rows':_0x7c92b5}:null;}})[_0x1f72('0x1e')](respondWithResult(_0x5c4292,null))[_0x1f72('0x28')](handleError(_0x5c4292,null));};exports['getInteractions']=function(_0x5adff0,_0x161edf,_0x864614){var _0x370ee3={'raw':![],'where':{}};var _0x3ff672={};var _0xd2880c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1f72('0x67')]({'where':{'id':_0x5adff0['params']['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x161edf,null))['then'](function(_0xdd593d){if(_0xdd593d){_0x3ff672['model']=_['keys'](db[_0x1f72('0x90')][_0x1f72('0x42')]);_0x3ff672['query']=_[_0x1f72('0x47')](_0x5adff0[_0x1f72('0x46')]);_0x3ff672[_0x1f72('0x48')]=_[_0x1f72('0x4b')](_0x3ff672['model'],_0x3ff672[_0x1f72('0x46')]);_0x370ee3[_0x1f72('0x4a')]=_[_0x1f72('0x4b')](_0x3ff672['model'],qs[_0x1f72('0x4c')](_0x5adff0[_0x1f72('0x46')][_0x1f72('0x4c')]));_0x370ee3[_0x1f72('0x4a')]=_0x370ee3[_0x1f72('0x4a')][_0x1f72('0x4d')]?_0x370ee3[_0x1f72('0x4a')]:_0x3ff672['model'];if(!_0x5adff0[_0x1f72('0x46')][_0x1f72('0x68')](_0x1f72('0x4e'))){_0x370ee3[_0x1f72('0x30')]=qs[_0x1f72('0x30')](_0x5adff0['query'][_0x1f72('0x30')]);_0x370ee3[_0x1f72('0x2d')]=qs[_0x1f72('0x2d')](_0x5adff0['query'][_0x1f72('0x2d')]);}_0x370ee3[_0x1f72('0x4f')]=qs['sort'](_0x5adff0['query'][_0x1f72('0x50')]);_0x370ee3['where']=qs[_0x1f72('0x48')](_['pick'](_0x5adff0[_0x1f72('0x46')],_0x3ff672[_0x1f72('0x48')]));_0x370ee3[_0x1f72('0x51')][_0x1f72('0x64')]=_0xdd593d['id'];if(_0x5adff0[_0x1f72('0x46')][_0x1f72('0x53')]){_0x370ee3['where']=_[_0x1f72('0x54')](_0x370ee3['where'],{'$or':_['map'](_0x370ee3[_0x1f72('0x4a')],function(_0x182aa6){var _0x134d92={};_0x134d92[_0x182aa6]={'$like':'%'+_0x5adff0['query'][_0x1f72('0x53')]+'%'};return _0x134d92;})});}_0x370ee3=_[_0x1f72('0x54')]({},_0x370ee3,_0x5adff0['options']);return db[_0x1f72('0x90')]['count']({'where':_0x370ee3['where']})[_0x1f72('0x1e')](function(_0x51e85f){_0xd2880c[_0x1f72('0x2f')]=_0x51e85f;if(_0x5adff0['query'][_0x1f72('0x5b')]){_0x370ee3[_0x1f72('0x69')]=[{'model':db[_0x1f72('0x71')],'as':'Contact','required':![]},{'model':db[_0x1f72('0x9b')],'as':_0x1f72('0xa8'),'attributes':[_0x1f72('0x3b'),'fullname',_0x1f72('0xa9')],'required':![]},{'model':db['Tag'],'as':_0x1f72('0xaa'),'attributes':['id',_0x1f72('0x3b'),_0x1f72('0xab')],'where':_0x5adff0[_0x1f72('0x46')][_0x1f72('0xac')]?{'id':_0x5adff0[_0x1f72('0x46')][_0x1f72('0xac')]}:undefined,'required':_0x5adff0['query']['tag']?!![]:![]}];}return db[_0x1f72('0x90')][_0x1f72('0x57')](_0x370ee3);})['then'](function(_0x1b5089){_0xd2880c['rows']=_0x1b5089;return _0xd2880c;});}})[_0x1f72('0x1e')](respondWithFilteredResult(_0x161edf,_0x370ee3))[_0x1f72('0x28')](handleError(_0x161edf,null));};exports[_0x1f72('0xad')]=function(_0x4e691e,_0x1a24a2,_0x20d255){return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x4e691e[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x1a24a2,null))['then'](function(_0x725de8){if(_0x725de8){return _0x725de8[_0x1f72('0xad')](_0x4e691e[_0x1f72('0x62')][_0x1f72('0x6f')],_[_0x1f72('0xae')](_0x4e691e[_0x1f72('0x62')],[_0x1f72('0x6f'),'id'])||{})['spread'](function(_0x36ecff){for(var _0x33174f=0x0;_0x33174f<_0x4e691e['body'][_0x1f72('0x6f')][_0x1f72('0x4d')];_0x33174f+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x4e691e['body'][_0x1f72('0x6f')][_0x33174f]),'OpenchannelAccountId':Number(_0x4e691e['params']['id'])});}return _0x36ecff;});}})[_0x1f72('0x1e')](respondWithResult(_0x1a24a2,null))['catch'](handleError(_0x1a24a2,null));};exports['removeAgents']=function(_0x143b6f,_0x397aa4,_0x3d6910){return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x143b6f['params']['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x397aa4,null))['then'](function(_0x5a6571){if(_0x5a6571){return _0x5a6571['removeAgents'](_0x143b6f[_0x1f72('0x46')][_0x1f72('0x6f')])[_0x1f72('0x1e')](function(){if(_[_0x1f72('0xaf')](_0x143b6f[_0x1f72('0x46')]['ids'])){for(var _0x4005ce=0x0;_0x4005ce<_0x143b6f[_0x1f72('0x46')]['ids'][_0x1f72('0x4d')];_0x4005ce+=0x1){socket[_0x1f72('0xb0')](_0x1f72('0xb1'),{'UserId':Number(_0x143b6f[_0x1f72('0x46')][_0x1f72('0x6f')][_0x4005ce]),'OpenchannelAccountId':Number(_0x143b6f[_0x1f72('0x5a')]['id'])});}}else{socket[_0x1f72('0xb0')](_0x1f72('0xb1'),{'UserId':Number(_0x143b6f['query']['ids']),'OpenchannelAccountId':Number(_0x143b6f[_0x1f72('0x5a')]['id'])});}});}})[_0x1f72('0x1e')](respondWithStatusCode(_0x397aa4,null))[_0x1f72('0x28')](handleError(_0x397aa4,null));};exports[_0x1f72('0xb2')]=function(_0x1c4d36,_0x4247f9,_0xe35f07){var _0x4f0ac6={};var _0x477e6f={};var _0x31afd4;var _0x581b65;return db['OpenchannelAccount'][_0x1f72('0x67')]({'where':{'id':_0x1c4d36[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x4247f9,null))[_0x1f72('0x1e')](function(_0xe403d2){if(_0xe403d2){_0x31afd4=_0xe403d2;_0x477e6f[_0x1f72('0x49')]=_[_0x1f72('0x47')](db['User'][_0x1f72('0x42')]);_0x477e6f['query']=_['keys'](_0x1c4d36['query']);_0x477e6f['filters']=_[_0x1f72('0x4b')](_0x477e6f[_0x1f72('0x49')],_0x477e6f[_0x1f72('0x46')]);_0x4f0ac6[_0x1f72('0x4a')]=_[_0x1f72('0x4b')](_0x477e6f['model'],qs[_0x1f72('0x4c')](_0x1c4d36[_0x1f72('0x46')][_0x1f72('0x4c')]));_0x4f0ac6[_0x1f72('0x4a')]=_0x4f0ac6[_0x1f72('0x4a')]['length']?_0x4f0ac6[_0x1f72('0x4a')]:_0x477e6f[_0x1f72('0x49')];_0x4f0ac6[_0x1f72('0x4f')]=qs[_0x1f72('0x50')](_0x1c4d36[_0x1f72('0x46')][_0x1f72('0x50')]);_0x4f0ac6[_0x1f72('0x51')]=qs[_0x1f72('0x48')](_[_0x1f72('0x52')](_0x1c4d36[_0x1f72('0x46')],_0x477e6f[_0x1f72('0x48')]));if(_0x1c4d36[_0x1f72('0x46')][_0x1f72('0x53')]){_0x4f0ac6['where']=_[_0x1f72('0x54')](_0x4f0ac6[_0x1f72('0x51')],{'$or':_[_0x1f72('0x40')](_0x4f0ac6[_0x1f72('0x4a')],function(_0x23a753){var _0x43e592={};_0x43e592[_0x23a753]={'$like':'%'+_0x1c4d36['query'][_0x1f72('0x53')]+'%'};return _0x43e592;})});}_0x4f0ac6=_['merge']({},_0x4f0ac6,_0x1c4d36['options']);return _0x31afd4[_0x1f72('0xb2')](_0x4f0ac6);}})['then'](function(_0x1b79b5){if(_0x1b79b5){_0x581b65=_0x1b79b5[_0x1f72('0x4d')];if(!_0x1c4d36[_0x1f72('0x46')][_0x1f72('0x68')](_0x1f72('0x4e'))){_0x4f0ac6[_0x1f72('0x30')]=qs[_0x1f72('0x30')](_0x1c4d36[_0x1f72('0x46')][_0x1f72('0x30')]);_0x4f0ac6['offset']=qs['offset'](_0x1c4d36['query'][_0x1f72('0x2d')]);}return _0x31afd4['getAgents'](_0x4f0ac6);}})[_0x1f72('0x1e')](function(_0x3ad0dc){if(_0x3ad0dc){return _0x3ad0dc?{'count':_0x581b65,'rows':_0x3ad0dc}:null;}})[_0x1f72('0x1e')](respondWithResult(_0x4247f9,null))[_0x1f72('0x28')](handleError(_0x4247f9,null));};exports[_0x1f72('0x3c')]=function(_0xe8df93,_0x3eb954,_0xfba84d){var _0x41ddcc,_0x27a410,_0x48b724;if(_[_0x1f72('0x7a')](_0xe8df93['body'][_0x1f72('0x62')])||_0xe8df93[_0x1f72('0x62')][_0x1f72('0x62')]===''){throw new db[(_0x1f72('0x72'))]['ValidationError'](_0x1f72('0xb3'));}if(_[_0x1f72('0x7a')](_0xe8df93['body']['to'])){}_0x41ddcc=_0xe8df93[_0x1f72('0x62')]['to'];return db[_0x1f72('0x41')][_0x1f72('0x67')]({'where':{'id':_0xe8df93[_0x1f72('0x5a')]['id']}})[_0x1f72('0x1e')](handleEntityNotFound(_0x3eb954,null))[_0x1f72('0x1e')](function(_0x5843e4){if(_0x5843e4){return db[_0x1f72('0x41')][_0x1f72('0x60')]({'where':{'id':_0x5843e4['id']},'include':[{'model':db[_0x1f72('0x80')],'as':_0x1f72('0x85'),'include':[{'model':db[_0x1f72('0x71')],'as':_0x1f72('0x81'),'where':{[_0x5843e4[_0x1f72('0x7d')]]:_0x41ddcc},'limit':0x1,'order':[[_0x1f72('0x77'),_0x1f72('0x82')]]}]}]})[_0x1f72('0x1e')](handleEntityNotFound(_0x3eb954,null))['then'](function(_0x1aec83){if(_0x1aec83&&_0x1aec83[_0x1f72('0x85')]){_0x27a410=_0x1aec83[_0x1f72('0x37')]({'plain':!![]});if(_0x27a410[_0x1f72('0x85')]&&_0x27a410['List']['Contacts'][_0x1f72('0x4d')]){return _0x27a410[_0x1f72('0x85')][_0x1f72('0x81')][0x0];}return db[_0x1f72('0x71')][_0x1f72('0x5c')](_['defaults'](_0xe8df93[_0x1f72('0x62')],{'firstName':_0x41ddcc,[_0x1aec83[_0x1f72('0x7d')]]:_0x41ddcc,'phone':_0x41ddcc,'ListId':_0x27a410['ListId']}));}})[_0x1f72('0x1e')](handleEntityNotFound(_0x3eb954,null))[_0x1f72('0x1e')](function(_0x7149c2){if(_0x7149c2){_0x48b724=_0x7149c2;return db[_0x1f72('0x90')]['find']({'where':{'ContactId':_0x48b724['id'],'closed':![],'OpenchannelAccountId':_0x27a410['id']}})[_0x1f72('0x1e')](function(_0x15e17c){if(_0x15e17c){return[_0x15e17c,![]];}return db[_0x1f72('0x90')]['create']({'UserId':_0xe8df93[_0x1f72('0x5d')]['id'],'ContactId':_0x48b724['id'],'OpenchannelAccountId':_0x27a410['id'],'lastMsgDirection':'out','Messages':[_[_0x1f72('0x54')](_0xe8df93['body'],{'read':![],'body':_0xe8df93[_0x1f72('0x62')][_0x1f72('0x62')],'OpenchannelAccountId':_0x27a410['id'],'UserId':_0xe8df93[_0x1f72('0x5d')]['id'],'ContactId':_0x48b724['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x1f72('0x1e')](function(_0x4ec40c){return[_0x4ec40c,!![]];});});}})[_0x1f72('0x91')](function(_0x5e3a0f,_0x4e1510){if(_0x4e1510){return _0x5e3a0f;}return db['OpenchannelMessage']['create'](_[_0x1f72('0x54')](_0xe8df93[_0x1f72('0x62')],{'read':![],'body':_0xe8df93[_0x1f72('0x62')]['body'],'OpenchannelAccountId':_0x27a410['id'],'OpenchannelInteractionId':_0x5e3a0f['id'],'UserId':_0xe8df93[_0x1f72('0x5d')]['id'],'ContactId':_0x48b724['id']}))[_0x1f72('0x1e')](function(_0x46a56d){_0x5e3a0f['dataValues'][_0x1f72('0xb4')]=[];_0x5e3a0f['dataValues'][_0x1f72('0xb4')][_0x1f72('0x96')](_0x46a56d['dataValues']);return _0x5e3a0f;});});}})['then'](respondWithResult(_0x3eb954,null))[_0x1f72('0x28')](handleError(_0x3eb954,null));}; \ No newline at end of file +var _0x5196=['messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','agent','startRouting','Start','EventManager','sequelize','transaction','OpenchannelApplication','bulkCreate','getApplications','Contact','Tag','Tags','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','destroy','then','get','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','rawAttributes','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','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5196,0xd7));var _0x6519=function(_0x3822f1,_0x42aa55){_0x3822f1=_0x3822f1-0x0;var _0x3b1270=_0x5196[_0x3822f1];return _0x3b1270;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6519('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6519('0x1'));var rp=require(_0x6519('0x2'));var moment=require(_0x6519('0x3'));var BPromise=require(_0x6519('0x4'));var Mustache=require(_0x6519('0x5'));var util=require(_0x6519('0x6'));var path=require(_0x6519('0x7'));var sox=require(_0x6519('0x8'));var csv=require(_0x6519('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6519('0xa'));var _=require(_0x6519('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6519('0xc'));var deskjs=require(_0x6519('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6519('0xe'));var Papa=require(_0x6519('0xf'));var Redis=require(_0x6519('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6519('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6519('0x12'));var logger=require(_0x6519('0x13'))(_0x6519('0x14'));var utils=require(_0x6519('0x15'));var config=require(_0x6519('0x16'));var licenseUtil=require(_0x6519('0x17'));var db=require('../../mysqldb')['db'];config[_0x6519('0x18')]=_[_0x6519('0x19')](config[_0x6519('0x18')],{'host':_0x6519('0x1a'),'port':0x18eb});var socket=require(_0x6519('0x1b'))(new Redis(config['redis']));require(_0x6519('0x1c'))[_0x6519('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6519('0x1e')][_0x6519('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x6519('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x262e60,_0x1491b5,_0x5a6163,_0x129b88){return new BPromise(function(_0x55eee2,_0x3b20b9){var _0x16b078=_0x129b88||client;return _0x16b078[_0x6519('0x20')](_0x262e60,_0x5a6163)['then'](function(_0x4ccb2c){logger['info'](_0x6519('0x21'),_0x1491b5,'request\x20sent');logger['debug'](_0x6519('0x22'),_0x1491b5,_0x6519('0x23'),JSON[_0x6519('0x24')](_0x4ccb2c));if(_0x4ccb2c['error']){if(_0x4ccb2c[_0x6519('0x25')][_0x6519('0x26')]===0x1f4){logger['error'](_0x6519('0x21'),_0x1491b5,_0x4ccb2c[_0x6519('0x25')][_0x6519('0x27')]);return _0x3b20b9(_0x4ccb2c['error']['message']);}logger[_0x6519('0x25')](_0x6519('0x21'),_0x1491b5,_0x4ccb2c['error'][_0x6519('0x27')]);return _0x55eee2(_0x4ccb2c[_0x6519('0x25')][_0x6519('0x27')]);}else{logger[_0x6519('0x28')](_0x6519('0x21'),_0x1491b5,'request\x20sent');_0x55eee2(_0x4ccb2c['result']['message']);}})[_0x6519('0x29')](function(_0x13ea8b){logger[_0x6519('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x1491b5,_0x13ea8b);_0x3b20b9(_0x13ea8b);});});}function respondWithStatusCode(_0x205457,_0xc12bc1){_0xc12bc1=_0xc12bc1||0xcc;return function(_0x104d9f){if(_0x104d9f){return _0x205457[_0x6519('0x2a')](_0xc12bc1);}return _0x205457[_0x6519('0x2b')](_0xc12bc1)[_0x6519('0x2c')]();};}function respondWithResult(_0x175127,_0x5e5109){_0x5e5109=_0x5e5109||0xc8;return function(_0x1b6e2c){if(_0x1b6e2c){return _0x175127[_0x6519('0x2b')](_0x5e5109)['json'](_0x1b6e2c);}};}function respondWithFilteredResult(_0x56c20b,_0x4d278a){return function(_0x399012){if(_0x399012){var _0x3ed42a=typeof _0x4d278a[_0x6519('0x2d')]===_0x6519('0x2e')&&typeof _0x4d278a[_0x6519('0x2f')]===_0x6519('0x2e');var _0x1b597b=_0x399012[_0x6519('0x30')];var _0x5d2fc7=_0x3ed42a?0x0:_0x4d278a['offset'];var _0x14d8b0=_0x3ed42a?_0x399012[_0x6519('0x30')]:_0x4d278a[_0x6519('0x2d')]+_0x4d278a['limit'];var _0x596a7d;if(_0x14d8b0>=_0x1b597b){_0x14d8b0=_0x1b597b;_0x596a7d=0xc8;}else{_0x596a7d=0xce;}_0x56c20b[_0x6519('0x2b')](_0x596a7d);return _0x56c20b['set']('Content-Range',_0x5d2fc7+'-'+_0x14d8b0+'/'+_0x1b597b)[_0x6519('0x31')](_0x399012);}return null;};}function patchUpdates(_0xcb7828){return function(_0x367eb2){try{jsonpatch[_0x6519('0x32')](_0x367eb2,_0xcb7828,!![]);}catch(_0x1a4221){return BPromise['reject'](_0x1a4221);}return _0x367eb2[_0x6519('0x33')]();};}function saveUpdates(_0x406662,_0x426cc1){return function(_0x459910){if(_0x459910){return _0x459910[_0x6519('0x34')](_0x406662)['then'](function(_0x5a5aae){return _0x5a5aae;});}return null;};}function removeEntity(_0x3c77a5,_0x7746b0){return function(_0x37b6a6){if(_0x37b6a6){return _0x37b6a6[_0x6519('0x35')]()[_0x6519('0x36')](function(){var _0x2e9ffe=_0x37b6a6[_0x6519('0x37')]({'plain':!![]});var _0x963630=_0x6519('0x38');return db['UserProfileResource'][_0x6519('0x35')]({'where':{'type':_0x963630,'resourceId':_0x2e9ffe['id']}})[_0x6519('0x36')](function(){return _0x37b6a6;});})[_0x6519('0x36')](function(){_0x3c77a5[_0x6519('0x2b')](0xcc)[_0x6519('0x2c')]();});}};}function handleEntityNotFound(_0xde44f2,_0xe947f0){return function(_0x53965a){if(!_0x53965a){_0xde44f2[_0x6519('0x2a')](0x194);}return _0x53965a;};}function handleError(_0x188c89,_0x5645fb){_0x5645fb=_0x5645fb||0x1f4;return function(_0x220c88){logger['error'](_0x220c88[_0x6519('0x39')]);if(_0x220c88['name']){delete _0x220c88[_0x6519('0x3a')];}_0x188c89[_0x6519('0x2b')](_0x5645fb)[_0x6519('0x3b')](_0x220c88);};}exports[_0x6519('0x3c')]=function(_0xea3599,_0x3c51fa){var _0x2a747e={'include':[{'model':db[_0x6519('0x3d')],'as':_0x6519('0x3e')}]},_0x800457={},_0x5ab387={'count':0x0,'rows':[]};var _0x422d76=_[_0x6519('0x3f')](db[_0x6519('0x40')]['rawAttributes'],function(_0x322ac3){return{'name':_0x322ac3[_0x6519('0x41')],'type':_0x322ac3['type']['key']};});_0x800457['model']=_[_0x6519('0x3f')](_0x422d76,_0x6519('0x3a'));_0x800457[_0x6519('0x42')]=_[_0x6519('0x43')](_0xea3599[_0x6519('0x42')]);_0x800457[_0x6519('0x44')]=_[_0x6519('0x45')](_0x800457[_0x6519('0x46')],_0x800457['query']);_0x2a747e[_0x6519('0x47')]=_[_0x6519('0x45')](_0x800457[_0x6519('0x46')],qs[_0x6519('0x48')](_0xea3599[_0x6519('0x42')][_0x6519('0x48')]));_0x2a747e[_0x6519('0x47')]=_0x2a747e['attributes'][_0x6519('0x49')]?_0x2a747e['attributes']:_0x800457[_0x6519('0x46')];if(!_0xea3599['query']['hasOwnProperty'](_0x6519('0x4a'))){_0x2a747e['limit']=qs[_0x6519('0x2f')](_0xea3599['query']['limit']);_0x2a747e[_0x6519('0x2d')]=qs[_0x6519('0x2d')](_0xea3599[_0x6519('0x42')][_0x6519('0x2d')]);}_0x2a747e[_0x6519('0x4b')]=qs[_0x6519('0x4c')](_0xea3599[_0x6519('0x42')][_0x6519('0x4c')]);_0x2a747e[_0x6519('0x4d')]=qs[_0x6519('0x44')](_[_0x6519('0x4e')](_0xea3599[_0x6519('0x42')],_0x800457[_0x6519('0x44')]),_0x422d76);if(_0xea3599[_0x6519('0x42')]['filter']){_0x2a747e[_0x6519('0x4d')]=_[_0x6519('0x4f')](_0x2a747e['where'],{'$or':_[_0x6519('0x3f')](_0x422d76,function(_0x4ee0dc){if(_0x4ee0dc['type']!=='VIRTUAL'){var _0x54c9ef={};_0x54c9ef[_0x4ee0dc[_0x6519('0x3a')]]={'$like':'%'+_0xea3599[_0x6519('0x42')][_0x6519('0x50')]+'%'};return _0x54c9ef;}})});}_0x2a747e=_[_0x6519('0x4f')]({},_0x2a747e,_0xea3599[_0x6519('0x51')]);var _0x2bc4c0={'where':_0x2a747e[_0x6519('0x4d')]};return db['OpenchannelAccount'][_0x6519('0x30')](_0x2bc4c0)['then'](function(_0x214227){_0x5ab387['count']=_0x214227;if(_0xea3599[_0x6519('0x42')][_0x6519('0x52')]){_0x2a747e[_0x6519('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6519('0x54')](_0x2a747e);})[_0x6519('0x36')](function(_0x32f924){_0x5ab387[_0x6519('0x55')]=_0x32f924;return _0x5ab387;})[_0x6519('0x36')](respondWithFilteredResult(_0x3c51fa,_0x2a747e))['catch'](handleError(_0x3c51fa,null));};exports[_0x6519('0x56')]=function(_0x356073,_0x3805e9){var _0x36fbd9={'raw':![],'where':{'id':_0x356073['params']['id']},'include':[{'model':db[_0x6519('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2cdf9d={};_0x2cdf9d[_0x6519('0x46')]=_[_0x6519('0x43')](db[_0x6519('0x40')][_0x6519('0x57')]);_0x2cdf9d[_0x6519('0x42')]=_['keys'](_0x356073['query']);_0x2cdf9d[_0x6519('0x44')]=_[_0x6519('0x45')](_0x2cdf9d[_0x6519('0x46')],_0x2cdf9d['query']);_0x36fbd9[_0x6519('0x47')]=_[_0x6519('0x45')](_0x2cdf9d[_0x6519('0x46')],qs[_0x6519('0x48')](_0x356073[_0x6519('0x42')][_0x6519('0x48')]));_0x36fbd9[_0x6519('0x47')]=_0x36fbd9['attributes']['length']?_0x36fbd9['attributes']:_0x2cdf9d['model'];if(_0x356073[_0x6519('0x42')]['includeAll']){_0x36fbd9['include']=[{'all':!![]}];}_0x36fbd9=_[_0x6519('0x4f')]({},_0x36fbd9,_0x356073[_0x6519('0x51')]);return db[_0x6519('0x40')][_0x6519('0x58')](_0x36fbd9)[_0x6519('0x36')](handleEntityNotFound(_0x3805e9,null))[_0x6519('0x36')](respondWithResult(_0x3805e9,null))[_0x6519('0x29')](handleError(_0x3805e9,null));};exports['create']=function(_0x37f57b,_0x1e60a1){return db['OpenchannelAccount'][_0x6519('0x59')](_0x37f57b[_0x6519('0x5a')],{})[_0x6519('0x36')](function(_0x13160c){var _0x45fe87=_0x37f57b[_0x6519('0x5b')]['get']({'plain':!![]});if(!_0x45fe87)throw new Error(_0x6519('0x5c'));if(_0x45fe87[_0x6519('0x5d')]==='user'){var _0x9a8221=_0x13160c[_0x6519('0x37')]({'plain':!![]});var _0x2c0add=_0x6519('0x38');return db[_0x6519('0x5e')][_0x6519('0x58')]({'where':{'name':_0x2c0add,'userProfileId':_0x45fe87['userProfileId']},'raw':!![]})[_0x6519('0x36')](function(_0x16d077){if(_0x16d077&&_0x16d077[_0x6519('0x5f')]===0x0){return db[_0x6519('0x60')][_0x6519('0x59')]({'name':_0x9a8221['name'],'resourceId':_0x9a8221['id'],'type':_0x16d077[_0x6519('0x3a')],'sectionId':_0x16d077['id']},{})[_0x6519('0x36')](function(){return _0x13160c;});}else{return _0x13160c;}})['catch'](function(_0x2f917a){logger[_0x6519('0x25')](_0x6519('0x61'),_0x2f917a);throw _0x2f917a;});}return _0x13160c;})[_0x6519('0x36')](respondWithResult(_0x1e60a1,0xc9))[_0x6519('0x29')](handleError(_0x1e60a1,null));};exports[_0x6519('0x34')]=function(_0x41214e,_0x51021a){if(_0x41214e[_0x6519('0x5a')]['id']){delete _0x41214e['body']['id'];}return db[_0x6519('0x40')]['find']({'where':{'id':_0x41214e[_0x6519('0x62')]['id']},'include':[{'model':db[_0x6519('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x6519('0x36')](handleEntityNotFound(_0x51021a,null))[_0x6519('0x36')](saveUpdates(_0x41214e[_0x6519('0x5a')],null))[_0x6519('0x36')](respondWithResult(_0x51021a,null))[_0x6519('0x29')](handleError(_0x51021a,null));};exports['destroy']=function(_0x32949d,_0x37233d){return db['OpenchannelAccount'][_0x6519('0x58')]({'where':{'id':_0x32949d['params']['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x37233d,null))[_0x6519('0x36')](removeEntity(_0x37233d,null))[_0x6519('0x29')](handleError(_0x37233d,null));};exports[_0x6519('0x63')]=function(_0xd6df90,_0x282d7f){return db[_0x6519('0x40')]['describe']()['then'](respondWithResult(_0x282d7f,null))[_0x6519('0x29')](handleError(_0x282d7f,null));};exports[_0x6519('0x64')]=function(_0x350569,_0x497ecb,_0x27fd59){if(_0x350569['body']['id']){delete _0x350569[_0x6519('0x5a')]['id'];}return db['OpenchannelAccount'][_0x6519('0x58')]({'where':{'id':_0x350569[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x497ecb,null))['then'](function(_0x498777){if(_0x498777){_0x350569[_0x6519('0x5a')][_0x6519('0x65')]=_0x498777['id'];return db[_0x6519('0x66')]['create'](_0x350569[_0x6519('0x5a')]);}})[_0x6519('0x36')](respondWithResult(_0x497ecb,null))['catch'](handleError(_0x497ecb,null));};exports[_0x6519('0x67')]=function(_0x48e976,_0x2484e5,_0x18e260){var _0xb9cb34={'raw':![],'where':{}};var _0x494600={};var _0x54ca6b={'count':0x0,'rows':[]};return db[_0x6519('0x40')][_0x6519('0x68')]({'where':{'id':_0x48e976[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x2484e5,null))[_0x6519('0x36')](function(_0x466e56){if(_0x466e56){_0x494600['model']=_[_0x6519('0x43')](db[_0x6519('0x66')][_0x6519('0x57')]);_0x494600[_0x6519('0x42')]=_['keys'](_0x48e976['query']);_0x494600[_0x6519('0x44')]=_[_0x6519('0x45')](_0x494600[_0x6519('0x46')],_0x494600[_0x6519('0x42')]);_0xb9cb34[_0x6519('0x47')]=_[_0x6519('0x45')](_0x494600[_0x6519('0x46')],qs[_0x6519('0x48')](_0x48e976[_0x6519('0x42')]['fields']));_0xb9cb34[_0x6519('0x47')]=_0xb9cb34[_0x6519('0x47')][_0x6519('0x49')]?_0xb9cb34[_0x6519('0x47')]:_0x494600[_0x6519('0x46')];if(!_0x48e976[_0x6519('0x42')][_0x6519('0x69')](_0x6519('0x4a'))){_0xb9cb34[_0x6519('0x2f')]=qs[_0x6519('0x2f')](_0x48e976[_0x6519('0x42')][_0x6519('0x2f')]);_0xb9cb34['offset']=qs[_0x6519('0x2d')](_0x48e976['query'][_0x6519('0x2d')]);}_0xb9cb34[_0x6519('0x4b')]=qs[_0x6519('0x4c')](_0x48e976[_0x6519('0x42')][_0x6519('0x4c')]);_0xb9cb34[_0x6519('0x4d')]=qs['filters'](_['pick'](_0x48e976[_0x6519('0x42')],_0x494600[_0x6519('0x44')]));_0xb9cb34[_0x6519('0x4d')][_0x6519('0x65')]=_0x466e56['id'];if(_0x48e976[_0x6519('0x42')][_0x6519('0x50')]){_0xb9cb34[_0x6519('0x4d')]=_[_0x6519('0x4f')](_0xb9cb34[_0x6519('0x4d')],{'$or':_[_0x6519('0x3f')](_0xb9cb34[_0x6519('0x47')],function(_0x563f0f){var _0x539188={};_0x539188[_0x563f0f]={'$like':'%'+_0x48e976[_0x6519('0x42')][_0x6519('0x50')]+'%'};return _0x539188;})});}_0xb9cb34=_[_0x6519('0x4f')]({},_0xb9cb34,_0x48e976[_0x6519('0x51')]);return db[_0x6519('0x66')][_0x6519('0x30')]({'where':_0xb9cb34[_0x6519('0x4d')]})[_0x6519('0x36')](function(_0x2f65a9){_0x54ca6b[_0x6519('0x30')]=_0x2f65a9;if(_0x48e976[_0x6519('0x42')][_0x6519('0x52')]){_0xb9cb34[_0x6519('0x53')]=[{'all':!![]}];}return db[_0x6519('0x66')][_0x6519('0x54')](_0xb9cb34);})[_0x6519('0x36')](function(_0x90aab5){_0x54ca6b[_0x6519('0x55')]=_0x90aab5;return _0x54ca6b;});}})[_0x6519('0x36')](respondWithFilteredResult(_0x2484e5,_0xb9cb34))[_0x6519('0x29')](handleError(_0x2484e5,null));};exports[_0x6519('0x6a')]=function(_0x34b867,_0x2a909e,_0x12c61a){return db[_0x6519('0x40')][_0x6519('0x58')]({'where':{'id':_0x34b867[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x2a909e,null))[_0x6519('0x36')](function(_0x55c44d){if(_0x55c44d){return _0x55c44d['removeDispositions'](_0x34b867['query'][_0x6519('0x6b')]);}})['then'](respondWithStatusCode(_0x2a909e,null))[_0x6519('0x29')](handleError(_0x2a909e,null));};exports[_0x6519('0x6c')]=function(_0x3e19f4,_0x458dff,_0x575c08){if(_0x3e19f4['body']['id']){delete _0x3e19f4['body']['id'];}return db[_0x6519('0x40')][_0x6519('0x58')]({'where':{'id':_0x3e19f4[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x458dff,null))[_0x6519('0x36')](function(_0x8b09ad){if(_0x8b09ad){_0x3e19f4[_0x6519('0x5a')][_0x6519('0x65')]=_0x8b09ad['id'];return db[_0x6519('0x6d')][_0x6519('0x59')](_0x3e19f4[_0x6519('0x5a')]);}})[_0x6519('0x36')](respondWithResult(_0x458dff,null))[_0x6519('0x29')](handleError(_0x458dff,null));};exports[_0x6519('0x6e')]=function(_0x4737af,_0x44fe61,_0x22cddd){var _0x180a93={'raw':![],'where':{}};var _0xbf2e4a={};var _0x59074f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6519('0x68')]({'where':{'id':_0x4737af[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x44fe61,null))['then'](function(_0xd34428){if(_0xd34428){_0xbf2e4a[_0x6519('0x46')]=_[_0x6519('0x43')](db[_0x6519('0x6d')][_0x6519('0x57')]);_0xbf2e4a['query']=_[_0x6519('0x43')](_0x4737af[_0x6519('0x42')]);_0xbf2e4a[_0x6519('0x44')]=_[_0x6519('0x45')](_0xbf2e4a[_0x6519('0x46')],_0xbf2e4a[_0x6519('0x42')]);_0x180a93[_0x6519('0x47')]=_[_0x6519('0x45')](_0xbf2e4a[_0x6519('0x46')],qs['fields'](_0x4737af[_0x6519('0x42')][_0x6519('0x48')]));_0x180a93[_0x6519('0x47')]=_0x180a93['attributes']['length']?_0x180a93['attributes']:_0xbf2e4a[_0x6519('0x46')];if(!_0x4737af[_0x6519('0x42')]['hasOwnProperty'](_0x6519('0x4a'))){_0x180a93[_0x6519('0x2f')]=qs['limit'](_0x4737af[_0x6519('0x42')][_0x6519('0x2f')]);_0x180a93[_0x6519('0x2d')]=qs[_0x6519('0x2d')](_0x4737af[_0x6519('0x42')][_0x6519('0x2d')]);}_0x180a93['order']=qs[_0x6519('0x4c')](_0x4737af[_0x6519('0x42')][_0x6519('0x4c')]);_0x180a93[_0x6519('0x4d')]=qs[_0x6519('0x44')](_['pick'](_0x4737af[_0x6519('0x42')],_0xbf2e4a['filters']));_0x180a93[_0x6519('0x4d')]['OpenchannelAccountId']=_0xd34428['id'];if(_0x4737af[_0x6519('0x42')][_0x6519('0x50')]){_0x180a93['where']=_[_0x6519('0x4f')](_0x180a93['where'],{'$or':_[_0x6519('0x3f')](_0x180a93[_0x6519('0x47')],function(_0x35de46){var _0x1d79d2={};_0x1d79d2[_0x35de46]={'$like':'%'+_0x4737af[_0x6519('0x42')]['filter']+'%'};return _0x1d79d2;})});}_0x180a93=_['merge']({},_0x180a93,_0x4737af['options']);return db[_0x6519('0x6d')]['count']({'where':_0x180a93['where']})[_0x6519('0x36')](function(_0x412309){_0x59074f[_0x6519('0x30')]=_0x412309;if(_0x4737af[_0x6519('0x42')][_0x6519('0x52')]){_0x180a93['include']=[{'all':!![]}];}return db[_0x6519('0x6d')]['findAll'](_0x180a93);})[_0x6519('0x36')](function(_0x3e99ba){_0x59074f[_0x6519('0x55')]=_0x3e99ba;return _0x59074f;});}})['then'](respondWithFilteredResult(_0x44fe61,_0x180a93))['catch'](handleError(_0x44fe61,null));};exports[_0x6519('0x6f')]=function(_0x3aa68d,_0x258fad,_0x637544){return db['OpenchannelAccount'][_0x6519('0x58')]({'where':{'id':_0x3aa68d[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x258fad,null))['then'](function(_0x27ac3a){if(_0x27ac3a){return _0x27ac3a[_0x6519('0x6f')](_0x3aa68d['query']['ids']);}})['then'](respondWithStatusCode(_0x258fad,null))[_0x6519('0x29')](handleError(_0x258fad,null));};exports[_0x6519('0x70')]=function(_0x1f4989,_0x43cbe7,_0x354e94){var _0x4f4870={'body':_0x1f4989[_0x6519('0x5a')],'channel':_0x6519('0x71')};var _0x1a6735=[];var _0x4d2b9e=[];var _0x40ccaa={};var _0x2f13f1=![];return db[_0x6519('0x72')][_0x6519('0x63')]()[_0x6519('0x36')](function(_0x6982ca){if(!_0x6982ca){throw new db[(_0x6519('0x73'))][(_0x6519('0x74'))](_0x6519('0x75'));}_0x1a6735=_[_0x6519('0x76')](_['keys'](_0x6982ca),['createdAt',_0x6519('0x77')]);_0x4d2b9e=_[_0x6519('0x76')](_[_0x6519('0x43')](_0x6982ca),['createdAt','updatedAt','CompanyId',_0x6519('0x78')]);if(_0x1f4989['body']['id']){delete _0x1f4989[_0x6519('0x5a')]['id'];}if(_[_0x6519('0x79')](_0x1f4989[_0x6519('0x5a')]['from'])){throw new db[(_0x6519('0x73'))][(_0x6519('0x74'))](_0x6519('0x7a'));}if(_[_0x6519('0x79')](_0x1f4989[_0x6519('0x5a')][_0x6519('0x5a')])||_0x1f4989[_0x6519('0x5a')][_0x6519('0x5a')]===''){throw new db[(_0x6519('0x73'))]['ValidationError'](_0x6519('0x7b'));}if(_[_0x6519('0x79')](_0x1f4989[_0x6519('0x5a')][_0x6519('0x7c')])){throw new db[(_0x6519('0x73'))][(_0x6519('0x74'))](_0x6519('0x7d')+_0x4d2b9e);}if(!_[_0x6519('0x7e')](_0x4d2b9e,_0x1f4989['body']['mapKey'])){throw new db['Sequelize'][(_0x6519('0x74'))](_0x6519('0x7f')+_0x4d2b9e);}_0x40ccaa[_0x1f4989[_0x6519('0x5a')][_0x6519('0x7c')]]=_0x1f4989[_0x6519('0x5a')][_0x6519('0x80')];})[_0x6519('0x36')](function(){return db['OpenchannelAccount'][_0x6519('0x58')]({'where':{'id':_0x1f4989[_0x6519('0x62')]['id']},'include':[{'model':db[_0x6519('0x81')],'as':_0x6519('0x82'),'include':[{'model':db['CmContact'],'as':_0x6519('0x83'),'where':_0x40ccaa,'limit':0x1,'order':[[_0x6519('0x77'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x6519('0x84')}]});})[_0x6519('0x36')](handleEntityNotFound(_0x43cbe7,null))[_0x6519('0x36')](function(_0x19503b){if(_0x19503b&&_0x19503b[_0x6519('0x82')]){_0x4f4870[_0x6519('0x85')]=_0x19503b;_0x4f4870[_0x6519('0x86')]=_0x19503b[_0x6519('0x84')];_0x4f4870[_0x6519('0x87')]=_0x19503b['List'];_0x4f4870[_0x6519('0x86')]=_[_0x6519('0x88')](_0x4f4870[_0x6519('0x86')],[_0x6519('0x89')],[_0x6519('0x8a')]);if(_0x4f4870[_0x6519('0x85')][_0x6519('0x84')]){delete _0x4f4870[_0x6519('0x85')][_0x6519('0x84')];}if(_0x4f4870[_0x6519('0x85')][_0x6519('0x82')]&&_0x4f4870[_0x6519('0x85')][_0x6519('0x82')][_0x6519('0x83')][_0x6519('0x49')]){return _0x4f4870[_0x6519('0x85')][_0x6519('0x82')][_0x6519('0x83')][0x0];}var _0x4b636e=_['defaults'](_0x1f4989[_0x6519('0x5a')],{'firstName':_0x1f4989['body'][_0x6519('0x80')],'ListId':_0x19503b[_0x6519('0x78')]});_0x4b636e[_0x1f4989['body'][_0x6519('0x7c')]]=_0x1f4989['body'][_0x6519('0x80')];return db[_0x6519('0x72')][_0x6519('0x59')](_0x4b636e,{'fields':_0x1a6735,'raw':!![]});}})['then'](handleEntityNotFound(_0x43cbe7,null))['then'](function(_0x2117e1){_0x4f4870[_0x6519('0x8b')]=_0x2117e1;if(_0x2117e1){var _0x4ef3a9={'ContactId':_0x2117e1['id'],'OpenchannelAccountId':_0x1f4989['params']['id'],'from':(_0x2117e1[_0x6519('0x8c')]||'')+'\x20'+(_0x2117e1[_0x6519('0x8d')]||'')};var _0x2d1519={'OpenchannelAccountId':_0x1f4989[_0x6519('0x62')]['id'],'closed':![]};if(_0x1f4989[_0x6519('0x5a')][_0x6519('0x8e')]){_0x2d1519[_0x6519('0x8e')]=_0x1f4989['body']['threadId'];return db[_0x6519('0x8f')][_0x6519('0x58')]({'where':_0x2d1519})[_0x6519('0x36')](function(_0x1f91dd){if(_0x1f91dd){return[_0x1f91dd,![]];}_0x4ef3a9[_0x6519('0x8e')]=_0x1f4989[_0x6519('0x5a')][_0x6519('0x8e')];_0x4ef3a9[_0x6519('0x90')]=_0x1f4989[_0x6519('0x5a')][_0x6519('0x90')];return db[_0x6519('0x8f')][_0x6519('0x59')](_0x4ef3a9)['then'](function(_0x196588){return[_0x196588,!![]];});});}else{_0x2d1519[_0x6519('0x8e')]=null;}_0x2d1519[_0x6519('0x91')]=_0x2117e1['id'];return db[_0x6519('0x8f')][_0x6519('0x58')]({'where':_0x2d1519})['then'](function(_0x4985c0){if(_0x4985c0){return[_0x4985c0,![]];}return db[_0x6519('0x8f')][_0x6519('0x59')](_0x4ef3a9)[_0x6519('0x36')](function(_0x1804e1){return[_0x1804e1,!![]];});});}})[_0x6519('0x92')](function(_0x1425cd,_0x60cca){if(_0x1425cd){_0x2f13f1=_0x60cca;if(!_0x60cca){var _0x4dadbf={'from':(_0x4f4870[_0x6519('0x8b')][_0x6519('0x8c')]||'')+'\x20'+(_0x4f4870[_0x6519('0x8b')]['lastName']||'')};if(_0x1f4989[_0x6519('0x5a')][_0x6519('0x8e')]&&_0x1f4989[_0x6519('0x5a')][_0x6519('0x93')]&&_0x1f4989[_0x6519('0x5a')][_0x6519('0x8e')]!=_0x1f4989[_0x6519('0x5a')][_0x6519('0x93')]){_0x4dadbf[_0x6519('0x8e')]=_0x1f4989[_0x6519('0x5a')][_0x6519('0x93')];}return _0x1425cd[_0x6519('0x34')](_0x4dadbf);}else{return _0x1425cd;}}})[_0x6519('0x36')](function(_0x5598c8){_0x4f4870[_0x6519('0x94')]=_0x5598c8['get']({'plain':!![]});_0x4f4870[_0x6519('0x94')][_0x6519('0x95')]=_0x2f13f1;if(_0x4f4870['interaction'][_0x6519('0x95')]){if(_0x4f4870[_0x6519('0x85')][_0x6519('0x96')]){_0x4f4870[_0x6519('0x86')][_0x6519('0x97')]({'id':0x0,'priority':_0x4f4870[_0x6519('0x86')][_0x6519('0x49')]+0x1,'app':_0x6519('0x98'),'appdata':_0x6519('0x99'),'interval':_0x6519('0x9a')});}}return db['OpenchannelMessage']['create']({'body':_0x1f4989[_0x6519('0x5a')]['body'],'OpenchannelAccountId':_0x1f4989[_0x6519('0x62')]['id'],'OpenchannelInteractionId':_0x5598c8['id'],'direction':'in','ContactId':_0x4f4870[_0x6519('0x8b')]['id'],'AttachmentId':_0x1f4989[_0x6519('0x5a')][_0x6519('0x9b')]});})['then'](function(_0x20cafc){_0x4f4870[_0x6519('0x27')]=_0x20cafc;if(_0x4f4870['interaction']['UserId']){return db[_0x6519('0x9c')]['find']({'attributes':['id',_0x6519('0x3a')],'where':{'id':_0x4f4870[_0x6519('0x94')][_0x6519('0x9d')]}})[_0x6519('0x36')](function(_0x260709){if(_0x260709){_0x4f4870[_0x6519('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6519('0x9e'),'appdata':_0x260709[_0x6519('0x3a')]+','+(_0x4f4870[_0x6519('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x6519('0x9a')});_0x4f4870['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x6519('0x9f'),_0x4f4870);});}return respondWithRpcPromise(_0x6519('0xa0'),_0x6519('0x9f'),_0x4f4870);})[_0x6519('0x36')](function(_0xbaeee8){respondWithRpcPromise('EventManager',_0x6519('0xa1'),{'event':_0x6519('0x70'),'message':_0xbaeee8},client9002);return _0xbaeee8;})['then'](respondWithResult(_0x43cbe7,null))[_0x6519('0x29')](handleError(_0x43cbe7,null));};exports['addApplications']=function(_0x35228f,_0x1735f3,_0x577ca2){return db[_0x6519('0x40')][_0x6519('0x68')]({'where':{'id':_0x35228f[_0x6519('0x62')]['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x1735f3,null))[_0x6519('0x36')](function(_0x610468){if(_0x610468){return db[_0x6519('0xa2')][_0x6519('0xa3')](function(_0x1a22e5){return db[_0x6519('0xa4')][_0x6519('0x35')]({'where':{'OpenchannelAccountId':_0x35228f['params']['id']},'transaction':_0x1a22e5})[_0x6519('0x36')](function(_0x1ae8f0){var _0x292320=_[_0x6519('0x3f')](_0x35228f[_0x6519('0x5a')],function(_0x206a29){_0x206a29[_0x6519('0x65')]=_0x35228f[_0x6519('0x62')]['id'];return _0x206a29;});return db[_0x6519('0xa4')][_0x6519('0xa5')](_0x292320,{'transaction':_0x1a22e5});});})[_0x6519('0x36')](function(){return db[_0x6519('0xa4')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x35228f['params']['id']},'order':_0x6519('0x89')});});}})[_0x6519('0x36')](respondWithResult(_0x1735f3,null))[_0x6519('0x29')](handleError(_0x1735f3,null));};exports[_0x6519('0xa6')]=function(_0x6ff7d6,_0x5606e7,_0x142760){var _0x527194={};var _0xec6af5={};var _0x745ff8;var _0x304e6c;return db[_0x6519('0x40')][_0x6519('0x68')]({'where':{'id':_0x6ff7d6[_0x6519('0x62')]['id']}})['then'](handleEntityNotFound(_0x5606e7,null))[_0x6519('0x36')](function(_0x25e831){if(_0x25e831){_0x745ff8=_0x25e831;_0xec6af5[_0x6519('0x46')]=_[_0x6519('0x43')](db[_0x6519('0xa4')][_0x6519('0x57')]);_0xec6af5[_0x6519('0x42')]=_[_0x6519('0x43')](_0x6ff7d6[_0x6519('0x42')]);_0xec6af5[_0x6519('0x44')]=_[_0x6519('0x45')](_0xec6af5[_0x6519('0x46')],_0xec6af5[_0x6519('0x42')]);_0x527194[_0x6519('0x47')]=_[_0x6519('0x45')](_0xec6af5[_0x6519('0x46')],qs[_0x6519('0x48')](_0x6ff7d6[_0x6519('0x42')][_0x6519('0x48')]));_0x527194[_0x6519('0x47')]=_0x527194[_0x6519('0x47')][_0x6519('0x49')]?_0x527194[_0x6519('0x47')]:_0xec6af5[_0x6519('0x46')];_0x527194[_0x6519('0x4b')]=qs[_0x6519('0x4c')](_0x6ff7d6[_0x6519('0x42')][_0x6519('0x4c')]);_0x527194['where']=qs['filters'](_[_0x6519('0x4e')](_0x6ff7d6[_0x6519('0x42')],_0xec6af5[_0x6519('0x44')]));if(_0x6ff7d6[_0x6519('0x42')][_0x6519('0x50')]){_0x527194[_0x6519('0x4d')]=_[_0x6519('0x4f')](_0x527194['where'],{'$or':_['map'](_0x527194[_0x6519('0x47')],function(_0x3cff75){var _0x3c3894={};_0x3c3894[_0x3cff75]={'$like':'%'+_0x6ff7d6[_0x6519('0x42')]['filter']+'%'};return _0x3c3894;})});}_0x527194=_[_0x6519('0x4f')]({},_0x527194,_0x6ff7d6[_0x6519('0x51')]);return _0x745ff8[_0x6519('0xa6')](_0x527194);}})[_0x6519('0x36')](function(_0x243bd9){if(_0x243bd9){_0x304e6c=_0x243bd9['length'];if(!_0x6ff7d6[_0x6519('0x42')]['hasOwnProperty']('nolimit')){_0x527194[_0x6519('0x2f')]=qs[_0x6519('0x2f')](_0x6ff7d6[_0x6519('0x42')][_0x6519('0x2f')]);_0x527194[_0x6519('0x2d')]=qs[_0x6519('0x2d')](_0x6ff7d6['query'][_0x6519('0x2d')]);}return _0x745ff8['getApplications'](_0x527194);}})[_0x6519('0x36')](function(_0x493c30){if(_0x493c30){return _0x493c30?{'count':_0x304e6c,'rows':_0x493c30}:null;}})[_0x6519('0x36')](respondWithResult(_0x5606e7,null))[_0x6519('0x29')](handleError(_0x5606e7,null));};exports['getInteractions']=function(_0x24575d,_0x47a746,_0x5ee638){var _0x38aa3c={'raw':![],'where':{}};var _0xa6be14={};var _0xd989d6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6519('0x68')]({'where':{'id':_0x24575d[_0x6519('0x62')]['id']}})['then'](handleEntityNotFound(_0x47a746,null))['then'](function(_0x579914){if(_0x579914){_0xa6be14[_0x6519('0x46')]=_[_0x6519('0x43')](db[_0x6519('0x8f')]['rawAttributes']);_0xa6be14['query']=_[_0x6519('0x43')](_0x24575d[_0x6519('0x42')]);_0xa6be14[_0x6519('0x44')]=_['intersection'](_0xa6be14[_0x6519('0x46')],_0xa6be14[_0x6519('0x42')]);_0x38aa3c[_0x6519('0x47')]=_[_0x6519('0x45')](_0xa6be14[_0x6519('0x46')],qs[_0x6519('0x48')](_0x24575d[_0x6519('0x42')][_0x6519('0x48')]));_0x38aa3c[_0x6519('0x47')]=_0x38aa3c['attributes']['length']?_0x38aa3c[_0x6519('0x47')]:_0xa6be14['model'];if(!_0x24575d[_0x6519('0x42')]['hasOwnProperty'](_0x6519('0x4a'))){_0x38aa3c['limit']=qs[_0x6519('0x2f')](_0x24575d[_0x6519('0x42')]['limit']);_0x38aa3c[_0x6519('0x2d')]=qs[_0x6519('0x2d')](_0x24575d[_0x6519('0x42')][_0x6519('0x2d')]);}_0x38aa3c[_0x6519('0x4b')]=qs[_0x6519('0x4c')](_0x24575d[_0x6519('0x42')][_0x6519('0x4c')]);_0x38aa3c[_0x6519('0x4d')]=qs[_0x6519('0x44')](_[_0x6519('0x4e')](_0x24575d[_0x6519('0x42')],_0xa6be14['filters']));_0x38aa3c['where'][_0x6519('0x65')]=_0x579914['id'];if(_0x24575d[_0x6519('0x42')][_0x6519('0x50')]){_0x38aa3c[_0x6519('0x4d')]=_[_0x6519('0x4f')](_0x38aa3c['where'],{'$or':_[_0x6519('0x3f')](_0x38aa3c[_0x6519('0x47')],function(_0x4bc8ae){var _0xb7898a={};_0xb7898a[_0x4bc8ae]={'$like':'%'+_0x24575d[_0x6519('0x42')][_0x6519('0x50')]+'%'};return _0xb7898a;})});}_0x38aa3c=_['merge']({},_0x38aa3c,_0x24575d[_0x6519('0x51')]);return db[_0x6519('0x8f')][_0x6519('0x30')]({'where':_0x38aa3c[_0x6519('0x4d')]})['then'](function(_0x5b6817){_0xd989d6[_0x6519('0x30')]=_0x5b6817;if(_0x24575d[_0x6519('0x42')][_0x6519('0x52')]){_0x38aa3c[_0x6519('0x53')]=[{'model':db[_0x6519('0x72')],'as':_0x6519('0xa7'),'required':![]},{'model':db[_0x6519('0x9c')],'as':'Owner','attributes':[_0x6519('0x3a'),'fullname','internal'],'required':![]},{'model':db[_0x6519('0xa8')],'as':_0x6519('0xa9'),'attributes':['id',_0x6519('0x3a'),'color'],'where':_0x24575d[_0x6519('0x42')][_0x6519('0xaa')]?{'id':_0x24575d[_0x6519('0x42')][_0x6519('0xaa')]}:undefined,'required':_0x24575d[_0x6519('0x42')][_0x6519('0xaa')]?!![]:![]}];}return db[_0x6519('0x8f')]['findAll'](_0x38aa3c);})[_0x6519('0x36')](function(_0x2b73c1){_0xd989d6[_0x6519('0x55')]=_0x2b73c1;return _0xd989d6;});}})[_0x6519('0x36')](respondWithFilteredResult(_0x47a746,_0x38aa3c))[_0x6519('0x29')](handleError(_0x47a746,null));};exports['addAgents']=function(_0x54f045,_0x272e05,_0x49e022){return db[_0x6519('0x40')][_0x6519('0x58')]({'where':{'id':_0x54f045['params']['id']}})[_0x6519('0x36')](handleEntityNotFound(_0x272e05,null))[_0x6519('0x36')](function(_0xc8feb5){if(_0xc8feb5){return _0xc8feb5[_0x6519('0xab')](_0x54f045[_0x6519('0x5a')][_0x6519('0x6b')],_['omit'](_0x54f045[_0x6519('0x5a')],['ids','id'])||{})[_0x6519('0x92')](function(_0x555d37){for(var _0x47eb04=0x0;_0x47eb04<_0x54f045[_0x6519('0x5a')][_0x6519('0x6b')][_0x6519('0x49')];_0x47eb04+=0x1){socket[_0x6519('0xac')]('userOpenchannelAccount:save',{'UserId':Number(_0x54f045[_0x6519('0x5a')]['ids'][_0x47eb04]),'OpenchannelAccountId':Number(_0x54f045[_0x6519('0x62')]['id'])});}return _0x555d37;});}})[_0x6519('0x36')](respondWithResult(_0x272e05,null))[_0x6519('0x29')](handleError(_0x272e05,null));};exports['removeAgents']=function(_0x4c713f,_0x543d88,_0x2b1834){return db[_0x6519('0x40')]['find']({'where':{'id':_0x4c713f[_0x6519('0x62')]['id']}})['then'](handleEntityNotFound(_0x543d88,null))[_0x6519('0x36')](function(_0x196078){if(_0x196078){return _0x196078[_0x6519('0xad')](_0x4c713f['query'][_0x6519('0x6b')])[_0x6519('0x36')](function(){if(_[_0x6519('0xae')](_0x4c713f[_0x6519('0x42')][_0x6519('0x6b')])){for(var _0x273605=0x0;_0x273605<_0x4c713f[_0x6519('0x42')][_0x6519('0x6b')][_0x6519('0x49')];_0x273605+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4c713f[_0x6519('0x42')][_0x6519('0x6b')][_0x273605]),'OpenchannelAccountId':Number(_0x4c713f['params']['id'])});}}else{socket[_0x6519('0xac')](_0x6519('0xaf'),{'UserId':Number(_0x4c713f[_0x6519('0x42')][_0x6519('0x6b')]),'OpenchannelAccountId':Number(_0x4c713f['params']['id'])});}});}})[_0x6519('0x36')](respondWithStatusCode(_0x543d88,null))[_0x6519('0x29')](handleError(_0x543d88,null));};exports[_0x6519('0xb0')]=function(_0x3f30f3,_0x1d1aa4,_0x402160){var _0x463e54={};var _0x1a4a39={};var _0x2a9711;var _0x505fb8;return db[_0x6519('0x40')][_0x6519('0x68')]({'where':{'id':_0x3f30f3[_0x6519('0x62')]['id']}})['then'](handleEntityNotFound(_0x1d1aa4,null))['then'](function(_0x2b8a84){if(_0x2b8a84){_0x2a9711=_0x2b8a84;_0x1a4a39[_0x6519('0x46')]=_[_0x6519('0x43')](db['User'][_0x6519('0x57')]);_0x1a4a39['query']=_[_0x6519('0x43')](_0x3f30f3['query']);_0x1a4a39[_0x6519('0x44')]=_[_0x6519('0x45')](_0x1a4a39[_0x6519('0x46')],_0x1a4a39[_0x6519('0x42')]);_0x463e54[_0x6519('0x47')]=_['intersection'](_0x1a4a39['model'],qs[_0x6519('0x48')](_0x3f30f3[_0x6519('0x42')][_0x6519('0x48')]));_0x463e54[_0x6519('0x47')]=_0x463e54[_0x6519('0x47')][_0x6519('0x49')]?_0x463e54['attributes']:_0x1a4a39['model'];_0x463e54[_0x6519('0x4b')]=qs[_0x6519('0x4c')](_0x3f30f3['query'][_0x6519('0x4c')]);_0x463e54[_0x6519('0x4d')]=qs[_0x6519('0x44')](_[_0x6519('0x4e')](_0x3f30f3[_0x6519('0x42')],_0x1a4a39['filters']));if(_0x3f30f3[_0x6519('0x42')][_0x6519('0x50')]){_0x463e54[_0x6519('0x4d')]=_[_0x6519('0x4f')](_0x463e54['where'],{'$or':_[_0x6519('0x3f')](_0x463e54[_0x6519('0x47')],function(_0x5dcee3){var _0x9da2d1={};_0x9da2d1[_0x5dcee3]={'$like':'%'+_0x3f30f3[_0x6519('0x42')][_0x6519('0x50')]+'%'};return _0x9da2d1;})});}_0x463e54=_[_0x6519('0x4f')]({},_0x463e54,_0x3f30f3['options']);return _0x2a9711[_0x6519('0xb0')](_0x463e54);}})[_0x6519('0x36')](function(_0x141e84){if(_0x141e84){_0x505fb8=_0x141e84[_0x6519('0x49')];if(!_0x3f30f3[_0x6519('0x42')][_0x6519('0x69')](_0x6519('0x4a'))){_0x463e54[_0x6519('0x2f')]=qs[_0x6519('0x2f')](_0x3f30f3[_0x6519('0x42')][_0x6519('0x2f')]);_0x463e54['offset']=qs[_0x6519('0x2d')](_0x3f30f3['query'][_0x6519('0x2d')]);}return _0x2a9711[_0x6519('0xb0')](_0x463e54);}})[_0x6519('0x36')](function(_0x1ca758){if(_0x1ca758){return _0x1ca758?{'count':_0x505fb8,'rows':_0x1ca758}:null;}})[_0x6519('0x36')](respondWithResult(_0x1d1aa4,null))[_0x6519('0x29')](handleError(_0x1d1aa4,null));};exports[_0x6519('0x3b')]=function(_0x21dc84,_0x348069,_0x42e190){var _0x1d282f,_0xcf6e92,_0x11d163;if(_['isNil'](_0x21dc84[_0x6519('0x5a')][_0x6519('0x5a')])||_0x21dc84[_0x6519('0x5a')][_0x6519('0x5a')]===''){throw new db['Sequelize'][(_0x6519('0x74'))](_0x6519('0x7b'));}if(_[_0x6519('0x79')](_0x21dc84[_0x6519('0x5a')]['to'])){}_0x1d282f=_0x21dc84[_0x6519('0x5a')]['to'];return db[_0x6519('0x40')][_0x6519('0x68')]({'where':{'id':_0x21dc84['params']['id']}})['then'](handleEntityNotFound(_0x348069,null))[_0x6519('0x36')](function(_0x53ae48){if(_0x53ae48){return db[_0x6519('0x40')][_0x6519('0x58')]({'where':{'id':_0x53ae48['id']},'include':[{'model':db[_0x6519('0x81')],'as':_0x6519('0x82'),'include':[{'model':db[_0x6519('0x72')],'as':_0x6519('0x83'),'where':{[_0x53ae48[_0x6519('0x7c')]]:_0x1d282f},'limit':0x1,'order':[[_0x6519('0x77'),'DESC']]}]}]})[_0x6519('0x36')](handleEntityNotFound(_0x348069,null))['then'](function(_0x102046){if(_0x102046&&_0x102046[_0x6519('0x82')]){_0xcf6e92=_0x102046[_0x6519('0x37')]({'plain':!![]});if(_0xcf6e92['List']&&_0xcf6e92[_0x6519('0x82')][_0x6519('0x83')][_0x6519('0x49')]){return _0xcf6e92[_0x6519('0x82')][_0x6519('0x83')][0x0];}return db[_0x6519('0x72')][_0x6519('0x59')](_[_0x6519('0x19')](_0x21dc84[_0x6519('0x5a')],{'firstName':_0x1d282f,[_0x102046[_0x6519('0x7c')]]:_0x1d282f,'phone':_0x1d282f,'ListId':_0xcf6e92['ListId']}));}})['then'](handleEntityNotFound(_0x348069,null))['then'](function(_0x4469b6){if(_0x4469b6){_0x11d163=_0x4469b6;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x11d163['id'],'closed':![],'OpenchannelAccountId':_0xcf6e92['id']}})[_0x6519('0x36')](function(_0x56f351){if(_0x56f351){return[_0x56f351,![]];}return db[_0x6519('0x8f')][_0x6519('0x59')]({'UserId':_0x21dc84[_0x6519('0x5b')]['id'],'ContactId':_0x11d163['id'],'OpenchannelAccountId':_0xcf6e92['id'],'lastMsgDirection':_0x6519('0xb1'),'Messages':[_['merge'](_0x21dc84[_0x6519('0x5a')],{'read':![],'body':_0x21dc84[_0x6519('0x5a')][_0x6519('0x5a')],'OpenchannelAccountId':_0xcf6e92['id'],'UserId':_0x21dc84[_0x6519('0x5b')]['id'],'ContactId':_0x11d163['id']})]},{'include':[{'model':db[_0x6519('0xb2')],'as':_0x6519('0xb3')}]})['then'](function(_0x53b329){return[_0x53b329,!![]];});});}})[_0x6519('0x92')](function(_0xae6782,_0x331977){if(_0x331977){return _0xae6782;}return db[_0x6519('0xb2')][_0x6519('0x59')](_[_0x6519('0x4f')](_0x21dc84[_0x6519('0x5a')],{'read':![],'body':_0x21dc84['body'][_0x6519('0x5a')],'OpenchannelAccountId':_0xcf6e92['id'],'OpenchannelInteractionId':_0xae6782['id'],'UserId':_0x21dc84[_0x6519('0x5b')]['id'],'ContactId':_0x11d163['id']}))[_0x6519('0x36')](function(_0xaddc67){_0xae6782['dataValues'][_0x6519('0xb3')]=[];_0xae6782[_0x6519('0xb4')][_0x6519('0xb3')][_0x6519('0x97')](_0xaddc67[_0x6519('0xb4')]);return _0xae6782;});});}})[_0x6519('0x36')](respondWithResult(_0x348069,null))[_0x6519('0x29')](handleError(_0x348069,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8d70708..e46e6fc 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 _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0xdace,0xc5));var _0xedac=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xdace[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x5c758d,_0x3bbadb){var _0x516580=function(_0x114392){while(--_0x114392){_0x5c758d['push'](_0x5c758d['shift']());}};_0x516580(++_0x3bbadb);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xb4e6[_0x382c73];return _0x1dd0bf;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](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 ccf9069..03a891f 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(_0x4abada,_0x226db9){var _0x240f3d=function(_0xc65d34){while(--_0xc65d34){_0x4abada['push'](_0x4abada['shift']());}};_0x240f3d(++_0x226db9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2dbdcd,_0x2289d4){var _0xfb4915=function(_0x289c29){while(--_0x289c29){_0x2dbdcd['push'](_0x2dbdcd['shift']());}};_0xfb4915(++_0x2289d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 0385fa6..698446b 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 _0x55f1=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost'];(function(_0x1bda53,_0x3deff9){var _0x4ffe4e=function(_0x36aa62){while(--_0x36aa62){_0x1bda53['push'](_0x1bda53['shift']());}};_0x4ffe4e(++_0x3deff9);}(_0x55f1,0x9b));var _0x155f=function(_0x3ab401,_0x8a188c){_0x3ab401=_0x3ab401-0x0;var _0x87ca16=_0x55f1[_0x3ab401];return _0x87ca16;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});config[_0x155f('0xa')]=_[_0x155f('0xb')](config[_0x155f('0xa')],{'host':_0x155f('0xc'),'port':0x18eb});var socket=require(_0x155f('0xd'))(new Redis(config[_0x155f('0xa')]));require(_0x155f('0xe'))[_0x155f('0xf')](socket);function respondWithRpcPromise(_0x281c5a,_0x11c946,_0x39d85a){return new BPromise(function(_0x5b9e3b,_0x9fb9a){return client[_0x155f('0x10')](_0x281c5a,_0x39d85a)[_0x155f('0x11')](function(_0x3575d8){logger['info'](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));logger[_0x155f('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11c946,'request\x20sent',JSON[_0x155f('0x15')](_0x3575d8));if(_0x3575d8[_0x155f('0x16')]){if(_0x3575d8[_0x155f('0x16')][_0x155f('0x17')]===0x1f4){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')]['message']);return _0x9fb9a(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}logger['error'](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);return _0x5b9e3b(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}else{logger[_0x155f('0x19')](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));_0x5b9e3b(_0x3575d8[_0x155f('0x1a')][_0x155f('0x18')]);}})[_0x155f('0x1b')](function(_0x3bdede){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3bdede);_0x9fb9a(_0x3bdede);});});} \ No newline at end of file +var _0x7be1=['../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x7be1,0x165));var _0x17be=function(_0x57bfad,_0x5126cc){_0x57bfad=_0x57bfad-0x0;var _0x5d8e2f=_0x7be1[_0x57bfad];return _0x5d8e2f;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});config['redis']=_[_0x17be('0xa')](config[_0x17be('0xb')],{'host':_0x17be('0xc'),'port':0x18eb});var socket=require(_0x17be('0xd'))(new Redis(config[_0x17be('0xb')]));require(_0x17be('0xe'))['register'](socket);function respondWithRpcPromise(_0x41e383,_0x589cdb,_0x3d23c3){return new BPromise(function(_0x2c276e,_0x520a49){return client[_0x17be('0xf')](_0x41e383,_0x3d23c3)[_0x17be('0x10')](function(_0x1ee322){logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));logger['debug'](_0x17be('0x13'),_0x589cdb,'request\x20sent',JSON[_0x17be('0x14')](_0x1ee322));if(_0x1ee322[_0x17be('0x15')]){if(_0x1ee322[_0x17be('0x15')][_0x17be('0x16')]===0x1f4){logger[_0x17be('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x1ee322[_0x17be('0x15')]['message']);return _0x520a49(_0x1ee322['error'][_0x17be('0x17')]);}logger['error'](_0x17be('0x18'),_0x589cdb,_0x1ee322['error'][_0x17be('0x17')]);return _0x2c276e(_0x1ee322[_0x17be('0x15')]['message']);}else{logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));_0x2c276e(_0x1ee322['result'][_0x17be('0x17')]);}})[_0x17be('0x19')](function(_0x416f81){logger[_0x17be('0x15')](_0x17be('0x18'),_0x589cdb,_0x416f81);_0x520a49(_0x416f81);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0ccde70..90a66b8 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 _0x5620=['remove','update','emit','register','length','./openchannelAccount.events'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x5620,0xbf));var _0x0562=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5620[_0x1992f1];return _0x413dfe;};'use strict';var OpenchannelAccountEvents=require(_0x0562('0x0'));var events=['save',_0x0562('0x1'),_0x0562('0x2')];function createListener(_0x517581,_0x57a89e){return function(_0x5d7473){_0x57a89e[_0x0562('0x3')](_0x517581,_0x5d7473);};}function removeListener(_0x4ef07f,_0x18ea87){return function(){OpenchannelAccountEvents['removeListener'](_0x4ef07f,_0x18ea87);};}exports[_0x0562('0x4')]=function(_0x39ab9a){for(var _0x4155b9=0x0,_0x24b8d1=events[_0x0562('0x5')];_0x4155b9<_0x24b8d1;_0x4155b9++){var _0x126c04=events[_0x4155b9];var _0x5f47ba=createListener('openchannelAccount:'+_0x126c04,_0x39ab9a);OpenchannelAccountEvents['on'](_0x126c04,_0x5f47ba);}}; \ No newline at end of file +var _0x65f4=['length','openchannelAccount:','remove','update','emit','register'];(function(_0x2ed4d8,_0x5a79bd){var _0x5306a3=function(_0x1d998a){while(--_0x1d998a){_0x2ed4d8['push'](_0x2ed4d8['shift']());}};_0x5306a3(++_0x5a79bd);}(_0x65f4,0x19a));var _0x465f=function(_0xcdfbbb,_0x26e0b9){_0xcdfbbb=_0xcdfbbb-0x0;var _0x267924=_0x65f4[_0xcdfbbb];return _0x267924;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x465f('0x0'),_0x465f('0x1')];function createListener(_0x34f1ce,_0x59c7cb){return function(_0x584451){_0x59c7cb[_0x465f('0x2')](_0x34f1ce,_0x584451);};}function removeListener(_0x3bf967,_0x307a2b){return function(){OpenchannelAccountEvents['removeListener'](_0x3bf967,_0x307a2b);};}exports[_0x465f('0x3')]=function(_0xe5a9bd){for(var _0x44d697=0x0,_0x553ce9=events[_0x465f('0x4')];_0x44d697<_0x553ce9;_0x44d697++){var _0x5e26ea=events[_0x44d697];var _0x523ca1=createListener(_0x465f('0x5')+_0x5e26ea,_0xe5a9bd);OpenchannelAccountEvents['on'](_0x5e26ea,_0x523ca1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 313c89e..109d7f1 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 _0x2dd4=['./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x2dd4,0x69));var _0x42dd=function(_0x5c80ea,_0x4188d1){_0x5c80ea=_0x5c80ea-0x0;var _0x39064c=_0x2dd4[_0x5c80ea];return _0x39064c;};'use strict';var multer=require(_0x42dd('0x0'));var util=require(_0x42dd('0x1'));var path=require(_0x42dd('0x2'));var timeout=require(_0x42dd('0x3'));var express=require('express');var router=express[_0x42dd('0x4')]();var fs_extra=require(_0x42dd('0x5'));var auth=require(_0x42dd('0x6'));var interaction=require(_0x42dd('0x7'));var config=require(_0x42dd('0x8'));var controller=require(_0x42dd('0x9'));router[_0x42dd('0xa')]('/',auth[_0x42dd('0xb')](),controller['index']);router[_0x42dd('0xa')](_0x42dd('0xc'),auth['isAuthenticated'](),controller[_0x42dd('0xd')]);router[_0x42dd('0xe')]('/',auth[_0x42dd('0xb')](),controller[_0x42dd('0xf')]);router[_0x42dd('0x10')]('/:id',auth[_0x42dd('0xb')](),controller['update']);router[_0x42dd('0x11')]('/:id',auth[_0x42dd('0xb')](),controller[_0x42dd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x01f4=['delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x58ef39,_0x4d0505){var _0x2b4b1a=function(_0xeadce5){while(--_0xeadce5){_0x58ef39['push'](_0x58ef39['shift']());}};_0x2b4b1a(++_0x4d0505);}(_0x01f4,0x73));var _0x401f=function(_0x5f4d2b,_0xd32256){_0x5f4d2b=_0x5f4d2b-0x0;var _0x297978=_0x01f4[_0x5f4d2b];return _0x297978;};'use strict';var multer=require(_0x401f('0x0'));var util=require('util');var path=require(_0x401f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x401f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x401f('0x3'));var controller=require(_0x401f('0x4'));router[_0x401f('0x5')]('/',auth[_0x401f('0x6')](),controller['index']);router[_0x401f('0x5')](_0x401f('0x7'),auth[_0x401f('0x6')](),controller[_0x401f('0x8')]);router[_0x401f('0x9')]('/',auth[_0x401f('0x6')](),controller[_0x401f('0xa')]);router[_0x401f('0xb')](_0x401f('0x7'),auth[_0x401f('0x6')](),controller[_0x401f('0xc')]);router[_0x401f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x401f('0xe')]);module[_0x401f('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c5a3737..4c205e6 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 _0xfec7=['STRING','noop','*,*,*,*','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfec7,0x147));var _0x7fec=function(_0xa44c8f,_0x4012c6){_0xa44c8f=_0xa44c8f-0x0;var _0x30eabf=_0xfec7[_0xa44c8f];return _0x30eabf;};'use strict';var Sequelize=require(_0x7fec('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7fec('0x1')],'allowNull':![],'defaultValue':_0x7fec('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7fec('0x1')]},'interval':{'type':Sequelize[_0x7fec('0x1')],'defaultValue':_0x7fec('0x3')}}; \ No newline at end of file +var _0xb579=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xc963f2,_0x3de322){var _0x352905=function(_0x14b6c3){while(--_0x14b6c3){_0xc963f2['push'](_0xc963f2['shift']());}};_0x352905(++_0x3de322);}(_0xb579,0x169));var _0x9b57=function(_0x1f347e,_0xb506e5){_0x1f347e=_0x1f347e-0x0;var _0x437a3a=_0xb579[_0x1f347e];return _0x437a3a;};'use strict';var Sequelize=require(_0x9b57('0x0'));module[_0x9b57('0x1')]={'priority':{'type':Sequelize[_0x9b57('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b57('0x3')],'allowNull':![],'defaultValue':_0x9b57('0x4')},'appdata':{'type':Sequelize[_0x9b57('0x5')]()},'description':{'type':Sequelize[_0x9b57('0x3')]},'interval':{'type':Sequelize[_0x9b57('0x3')],'defaultValue':_0x9b57('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6bbc975..c561866 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 _0x8819=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x8819,0xdc));var _0x9881=function(_0x1009a4,_0xbac4f6){_0x1009a4=_0x1009a4-0x0;var _0x4df99c=_0x8819[_0x1009a4];return _0x4df99c;};'use strict';var emlformat=require(_0x9881('0x0'));var rimraf=require(_0x9881('0x1'));var zipdir=require(_0x9881('0x2'));var jsonpatch=require(_0x9881('0x3'));var rp=require(_0x9881('0x4'));var moment=require(_0x9881('0x5'));var BPromise=require(_0x9881('0x6'));var Mustache=require(_0x9881('0x7'));var util=require('util');var path=require(_0x9881('0x8'));var sox=require(_0x9881('0x9'));var csv=require(_0x9881('0xa'));var ejs=require(_0x9881('0xb'));var fs=require('fs');var fs_extra=require(_0x9881('0xc'));var _=require('lodash');var squel=require(_0x9881('0xd'));var crypto=require(_0x9881('0xe'));var jsforce=require(_0x9881('0xf'));var deskjs=require(_0x9881('0x10'));var toCsv=require(_0x9881('0xa'));var querystring=require(_0x9881('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9881('0x12'));var qs=require(_0x9881('0x13'));var as=require(_0x9881('0x14'));var hardwareService=require(_0x9881('0x15'));var logger=require(_0x9881('0x16'))('api');var utils=require(_0x9881('0x17'));var config=require(_0x9881('0x18'));var licenseUtil=require(_0x9881('0x19'));var db=require(_0x9881('0x1a'))['db'];function respondWithStatusCode(_0x3c3d5b,_0x2d150f){_0x2d150f=_0x2d150f||0xcc;return function(_0x3686e9){if(_0x3686e9){return _0x3c3d5b['sendStatus'](_0x2d150f);}return _0x3c3d5b[_0x9881('0x1b')](_0x2d150f)[_0x9881('0x1c')]();};}function respondWithResult(_0x4c8a2b,_0x13fcbf){_0x13fcbf=_0x13fcbf||0xc8;return function(_0x5cd02b){if(_0x5cd02b){return _0x4c8a2b['status'](_0x13fcbf)[_0x9881('0x1d')](_0x5cd02b);}};}function respondWithFilteredResult(_0x3dd25f,_0x4d5d1f){return function(_0x5bef9d){if(_0x5bef9d){var _0xedc5e8=typeof _0x4d5d1f[_0x9881('0x1e')]===_0x9881('0x1f')&&typeof _0x4d5d1f[_0x9881('0x20')]===_0x9881('0x1f');var _0x247b7b=_0x5bef9d[_0x9881('0x21')];var _0x44dfce=_0xedc5e8?0x0:_0x4d5d1f[_0x9881('0x1e')];var _0x281145=_0xedc5e8?_0x5bef9d[_0x9881('0x21')]:_0x4d5d1f['offset']+_0x4d5d1f[_0x9881('0x20')];var _0x2e7107;if(_0x281145>=_0x247b7b){_0x281145=_0x247b7b;_0x2e7107=0xc8;}else{_0x2e7107=0xce;}_0x3dd25f[_0x9881('0x1b')](_0x2e7107);return _0x3dd25f[_0x9881('0x22')]('Content-Range',_0x44dfce+'-'+_0x281145+'/'+_0x247b7b)[_0x9881('0x1d')](_0x5bef9d);}return null;};}function patchUpdates(_0x48a9a6){return function(_0x760a70){try{jsonpatch[_0x9881('0x23')](_0x760a70,_0x48a9a6,!![]);}catch(_0x4ec01f){return BPromise[_0x9881('0x24')](_0x4ec01f);}return _0x760a70[_0x9881('0x25')]();};}function saveUpdates(_0x406764,_0x57ffd6){return function(_0x106948){if(_0x106948){return _0x106948[_0x9881('0x26')](_0x406764)['then'](function(_0x18d531){return _0x18d531;});}return null;};}function removeEntity(_0x4be7eb,_0x2563b3){return function(_0xf40333){if(_0xf40333){return _0xf40333[_0x9881('0x27')]()[_0x9881('0x28')](function(){_0x4be7eb['status'](0xcc)[_0x9881('0x1c')]();});}};}function handleEntityNotFound(_0x5c04ec,_0x184a4e){return function(_0x256d11){if(!_0x256d11){_0x5c04ec['sendStatus'](0x194);}return _0x256d11;};}function handleError(_0x322884,_0x435806){_0x435806=_0x435806||0x1f4;return function(_0x7ccfcd){logger[_0x9881('0x29')](_0x7ccfcd[_0x9881('0x2a')]);if(_0x7ccfcd['name']){delete _0x7ccfcd[_0x9881('0x2b')];}_0x322884[_0x9881('0x1b')](_0x435806)[_0x9881('0x2c')](_0x7ccfcd);};}exports[_0x9881('0x2d')]=function(_0x4dc973,_0x4ad998){var _0x10f13a={},_0xb7d284={},_0x53373f={'count':0x0,'rows':[]};var _0x1a24d3=_[_0x9881('0x2e')](db[_0x9881('0x2f')][_0x9881('0x30')],function(_0x3cb63d){return{'name':_0x3cb63d[_0x9881('0x31')],'type':_0x3cb63d['type']['key']};});_0xb7d284[_0x9881('0x32')]=_[_0x9881('0x2e')](_0x1a24d3,_0x9881('0x2b'));_0xb7d284['query']=_[_0x9881('0x33')](_0x4dc973[_0x9881('0x34')]);_0xb7d284[_0x9881('0x35')]=_['intersection'](_0xb7d284['model'],_0xb7d284['query']);_0x10f13a[_0x9881('0x36')]=_['intersection'](_0xb7d284[_0x9881('0x32')],qs['fields'](_0x4dc973['query'][_0x9881('0x37')]));_0x10f13a[_0x9881('0x36')]=_0x10f13a['attributes']['length']?_0x10f13a[_0x9881('0x36')]:_0xb7d284[_0x9881('0x32')];if(!_0x4dc973[_0x9881('0x34')][_0x9881('0x38')](_0x9881('0x39'))){_0x10f13a[_0x9881('0x20')]=qs['limit'](_0x4dc973[_0x9881('0x34')]['limit']);_0x10f13a[_0x9881('0x1e')]=qs[_0x9881('0x1e')](_0x4dc973['query']['offset']);}_0x10f13a[_0x9881('0x3a')]=qs[_0x9881('0x3b')](_0x4dc973['query'][_0x9881('0x3b')]);_0x10f13a[_0x9881('0x3c')]=qs['filters'](_[_0x9881('0x3d')](_0x4dc973[_0x9881('0x34')],_0xb7d284['filters']),_0x1a24d3);if(_0x4dc973[_0x9881('0x34')][_0x9881('0x3e')]){_0x10f13a[_0x9881('0x3c')]=_[_0x9881('0x3f')](_0x10f13a['where'],{'$or':_['map'](_0x1a24d3,function(_0x2a580b){if(_0x2a580b[_0x9881('0x40')]!=='VIRTUAL'){var _0x193b5c={};_0x193b5c[_0x2a580b[_0x9881('0x2b')]]={'$like':'%'+_0x4dc973[_0x9881('0x34')]['filter']+'%'};return _0x193b5c;}})});}_0x10f13a=_[_0x9881('0x3f')]({},_0x10f13a,_0x4dc973[_0x9881('0x41')]);var _0x37e45e={'where':_0x10f13a[_0x9881('0x3c')]};return db[_0x9881('0x2f')][_0x9881('0x21')](_0x37e45e)[_0x9881('0x28')](function(_0x117cab){_0x53373f[_0x9881('0x21')]=_0x117cab;if(_0x4dc973[_0x9881('0x34')]['includeAll']){_0x10f13a[_0x9881('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9881('0x43')](_0x10f13a);})[_0x9881('0x28')](function(_0x4f48f0){_0x53373f[_0x9881('0x44')]=_0x4f48f0;return _0x53373f;})[_0x9881('0x28')](respondWithFilteredResult(_0x4ad998,_0x10f13a))[_0x9881('0x45')](handleError(_0x4ad998,null));};exports[_0x9881('0x46')]=function(_0x25178e,_0x2aa956){var _0x5b4b71={'raw':!![],'where':{'id':_0x25178e[_0x9881('0x47')]['id']}},_0x5940a7={};_0x5940a7[_0x9881('0x32')]=_[_0x9881('0x33')](db['OpenchannelApplication'][_0x9881('0x30')]);_0x5940a7[_0x9881('0x34')]=_[_0x9881('0x33')](_0x25178e[_0x9881('0x34')]);_0x5940a7[_0x9881('0x35')]=_[_0x9881('0x48')](_0x5940a7[_0x9881('0x32')],_0x5940a7['query']);_0x5b4b71[_0x9881('0x36')]=_[_0x9881('0x48')](_0x5940a7[_0x9881('0x32')],qs['fields'](_0x25178e[_0x9881('0x34')]['fields']));_0x5b4b71[_0x9881('0x36')]=_0x5b4b71[_0x9881('0x36')]['length']?_0x5b4b71['attributes']:_0x5940a7[_0x9881('0x32')];if(_0x25178e[_0x9881('0x34')][_0x9881('0x49')]){_0x5b4b71['include']=[{'all':!![]}];}_0x5b4b71=_['merge']({},_0x5b4b71,_0x25178e['options']);return db[_0x9881('0x2f')][_0x9881('0x4a')](_0x5b4b71)['then'](handleEntityNotFound(_0x2aa956,null))[_0x9881('0x28')](respondWithResult(_0x2aa956,null))[_0x9881('0x45')](handleError(_0x2aa956,null));};exports['create']=function(_0x1d22f5,_0x27db78){return db[_0x9881('0x2f')][_0x9881('0x4b')](_0x1d22f5[_0x9881('0x4c')],{})[_0x9881('0x28')](respondWithResult(_0x27db78,0xc9))[_0x9881('0x45')](handleError(_0x27db78,null));};exports[_0x9881('0x26')]=function(_0x2957aa,_0x38364c){if(_0x2957aa['body']['id']){delete _0x2957aa[_0x9881('0x4c')]['id'];}return db[_0x9881('0x2f')][_0x9881('0x4a')]({'where':{'id':_0x2957aa[_0x9881('0x47')]['id']}})[_0x9881('0x28')](handleEntityNotFound(_0x38364c,null))[_0x9881('0x28')](saveUpdates(_0x2957aa['body'],null))['then'](respondWithResult(_0x38364c,null))[_0x9881('0x45')](handleError(_0x38364c,null));};exports[_0x9881('0x27')]=function(_0x548a21,_0x18587c){return db[_0x9881('0x2f')][_0x9881('0x4a')]({'where':{'id':_0x548a21[_0x9881('0x47')]['id']}})[_0x9881('0x28')](handleEntityNotFound(_0x18587c,null))[_0x9881('0x28')](removeEntity(_0x18587c,null))[_0x9881('0x45')](handleError(_0x18587c,null));}; \ No newline at end of file +var _0xe444=['../../config/environment','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4c4ed5,_0x34c268){var _0x5118e6=function(_0x1ee1fe){while(--_0x1ee1fe){_0x4c4ed5['push'](_0x4c4ed5['shift']());}};_0x5118e6(++_0x34c268);}(_0xe444,0x1af));var _0x4e44=function(_0x5d0339,_0x43b4b6){_0x5d0339=_0x5d0339-0x0;var _0x4f0272=_0xe444[_0x5d0339];return _0x4f0272;};'use strict';var emlformat=require(_0x4e44('0x0'));var rimraf=require(_0x4e44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e44('0x2'));var moment=require(_0x4e44('0x3'));var BPromise=require(_0x4e44('0x4'));var Mustache=require(_0x4e44('0x5'));var util=require(_0x4e44('0x6'));var path=require(_0x4e44('0x7'));var sox=require(_0x4e44('0x8'));var csv=require(_0x4e44('0x9'));var ejs=require(_0x4e44('0xa'));var fs=require('fs');var fs_extra=require(_0x4e44('0xb'));var _=require(_0x4e44('0xc'));var squel=require(_0x4e44('0xd'));var crypto=require(_0x4e44('0xe'));var jsforce=require(_0x4e44('0xf'));var deskjs=require(_0x4e44('0x10'));var toCsv=require(_0x4e44('0x9'));var querystring=require(_0x4e44('0x11'));var Papa=require(_0x4e44('0x12'));var Redis=require(_0x4e44('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4e44('0x14'));var as=require(_0x4e44('0x15'));var hardwareService=require(_0x4e44('0x16'));var logger=require(_0x4e44('0x17'))(_0x4e44('0x18'));var utils=require('../../config/utils');var config=require(_0x4e44('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363944,_0x1b1dbf){_0x1b1dbf=_0x1b1dbf||0xcc;return function(_0x4d739e){if(_0x4d739e){return _0x363944[_0x4e44('0x1a')](_0x1b1dbf);}return _0x363944['status'](_0x1b1dbf)[_0x4e44('0x1b')]();};}function respondWithResult(_0x2fe12f,_0x94da25){_0x94da25=_0x94da25||0xc8;return function(_0xfc3387){if(_0xfc3387){return _0x2fe12f[_0x4e44('0x1c')](_0x94da25)[_0x4e44('0x1d')](_0xfc3387);}};}function respondWithFilteredResult(_0x2f3697,_0x76c318){return function(_0x32d2d8){if(_0x32d2d8){var _0x16dcc3=typeof _0x76c318[_0x4e44('0x1e')]===_0x4e44('0x1f')&&typeof _0x76c318['limit']===_0x4e44('0x1f');var _0x184a9c=_0x32d2d8[_0x4e44('0x20')];var _0x30d060=_0x16dcc3?0x0:_0x76c318[_0x4e44('0x1e')];var _0x25d9f5=_0x16dcc3?_0x32d2d8[_0x4e44('0x20')]:_0x76c318[_0x4e44('0x1e')]+_0x76c318['limit'];var _0x1e8cc3;if(_0x25d9f5>=_0x184a9c){_0x25d9f5=_0x184a9c;_0x1e8cc3=0xc8;}else{_0x1e8cc3=0xce;}_0x2f3697[_0x4e44('0x1c')](_0x1e8cc3);return _0x2f3697[_0x4e44('0x21')](_0x4e44('0x22'),_0x30d060+'-'+_0x25d9f5+'/'+_0x184a9c)[_0x4e44('0x1d')](_0x32d2d8);}return null;};}function patchUpdates(_0x36b040){return function(_0x1d6ee4){try{jsonpatch[_0x4e44('0x23')](_0x1d6ee4,_0x36b040,!![]);}catch(_0x4d9f9d){return BPromise[_0x4e44('0x24')](_0x4d9f9d);}return _0x1d6ee4[_0x4e44('0x25')]();};}function saveUpdates(_0x527246,_0x51ccc3){return function(_0x517027){if(_0x517027){return _0x517027[_0x4e44('0x26')](_0x527246)['then'](function(_0x251b9d){return _0x251b9d;});}return null;};}function removeEntity(_0xdd7bda,_0x1bd4f0){return function(_0x1dcb35){if(_0x1dcb35){return _0x1dcb35[_0x4e44('0x27')]()[_0x4e44('0x28')](function(){_0xdd7bda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab0a8,_0x2913c7){return function(_0x57addd){if(!_0x57addd){_0x2ab0a8[_0x4e44('0x1a')](0x194);}return _0x57addd;};}function handleError(_0x1db9be,_0x37e858){_0x37e858=_0x37e858||0x1f4;return function(_0x28f03e){logger[_0x4e44('0x29')](_0x28f03e[_0x4e44('0x2a')]);if(_0x28f03e[_0x4e44('0x2b')]){delete _0x28f03e['name'];}_0x1db9be[_0x4e44('0x1c')](_0x37e858)[_0x4e44('0x2c')](_0x28f03e);};}exports[_0x4e44('0x2d')]=function(_0x18935f,_0x26a639){var _0x40c2ff={},_0x403117={},_0x3baa68={'count':0x0,'rows':[]};var _0x37b665=_[_0x4e44('0x2e')](db[_0x4e44('0x2f')]['rawAttributes'],function(_0x124226){return{'name':_0x124226['fieldName'],'type':_0x124226[_0x4e44('0x30')][_0x4e44('0x31')]};});_0x403117['model']=_['map'](_0x37b665,_0x4e44('0x2b'));_0x403117['query']=_[_0x4e44('0x32')](_0x18935f[_0x4e44('0x33')]);_0x403117[_0x4e44('0x34')]=_[_0x4e44('0x35')](_0x403117[_0x4e44('0x36')],_0x403117[_0x4e44('0x33')]);_0x40c2ff['attributes']=_['intersection'](_0x403117['model'],qs['fields'](_0x18935f['query'][_0x4e44('0x37')]));_0x40c2ff[_0x4e44('0x38')]=_0x40c2ff['attributes'][_0x4e44('0x39')]?_0x40c2ff['attributes']:_0x403117['model'];if(!_0x18935f[_0x4e44('0x33')][_0x4e44('0x3a')]('nolimit')){_0x40c2ff[_0x4e44('0x3b')]=qs[_0x4e44('0x3b')](_0x18935f[_0x4e44('0x33')][_0x4e44('0x3b')]);_0x40c2ff[_0x4e44('0x1e')]=qs['offset'](_0x18935f['query']['offset']);}_0x40c2ff['order']=qs['sort'](_0x18935f[_0x4e44('0x33')][_0x4e44('0x3c')]);_0x40c2ff[_0x4e44('0x3d')]=qs[_0x4e44('0x34')](_['pick'](_0x18935f[_0x4e44('0x33')],_0x403117[_0x4e44('0x34')]),_0x37b665);if(_0x18935f[_0x4e44('0x33')]['filter']){_0x40c2ff[_0x4e44('0x3d')]=_[_0x4e44('0x3e')](_0x40c2ff[_0x4e44('0x3d')],{'$or':_[_0x4e44('0x2e')](_0x37b665,function(_0x5a0b2a){if(_0x5a0b2a[_0x4e44('0x30')]!==_0x4e44('0x3f')){var _0x3436da={};_0x3436da[_0x5a0b2a[_0x4e44('0x2b')]]={'$like':'%'+_0x18935f['query'][_0x4e44('0x40')]+'%'};return _0x3436da;}})});}_0x40c2ff=_[_0x4e44('0x3e')]({},_0x40c2ff,_0x18935f['options']);var _0x4578f6={'where':_0x40c2ff[_0x4e44('0x3d')]};return db[_0x4e44('0x2f')][_0x4e44('0x20')](_0x4578f6)[_0x4e44('0x28')](function(_0x5f3b7a){_0x3baa68[_0x4e44('0x20')]=_0x5f3b7a;if(_0x18935f[_0x4e44('0x33')]['includeAll']){_0x40c2ff[_0x4e44('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x4e44('0x42')](_0x40c2ff);})['then'](function(_0xb6efdc){_0x3baa68[_0x4e44('0x43')]=_0xb6efdc;return _0x3baa68;})['then'](respondWithFilteredResult(_0x26a639,_0x40c2ff))[_0x4e44('0x44')](handleError(_0x26a639,null));};exports[_0x4e44('0x45')]=function(_0x5ebfb3,_0x4dd38c){var _0x26e294={'raw':!![],'where':{'id':_0x5ebfb3['params']['id']}},_0x2c3dc5={};_0x2c3dc5[_0x4e44('0x36')]=_[_0x4e44('0x32')](db['OpenchannelApplication']['rawAttributes']);_0x2c3dc5['query']=_['keys'](_0x5ebfb3[_0x4e44('0x33')]);_0x2c3dc5[_0x4e44('0x34')]=_[_0x4e44('0x35')](_0x2c3dc5[_0x4e44('0x36')],_0x2c3dc5[_0x4e44('0x33')]);_0x26e294[_0x4e44('0x38')]=_[_0x4e44('0x35')](_0x2c3dc5['model'],qs[_0x4e44('0x37')](_0x5ebfb3[_0x4e44('0x33')][_0x4e44('0x37')]));_0x26e294[_0x4e44('0x38')]=_0x26e294[_0x4e44('0x38')][_0x4e44('0x39')]?_0x26e294[_0x4e44('0x38')]:_0x2c3dc5[_0x4e44('0x36')];if(_0x5ebfb3[_0x4e44('0x33')][_0x4e44('0x46')]){_0x26e294[_0x4e44('0x41')]=[{'all':!![]}];}_0x26e294=_[_0x4e44('0x3e')]({},_0x26e294,_0x5ebfb3[_0x4e44('0x47')]);return db[_0x4e44('0x2f')][_0x4e44('0x48')](_0x26e294)[_0x4e44('0x28')](handleEntityNotFound(_0x4dd38c,null))['then'](respondWithResult(_0x4dd38c,null))[_0x4e44('0x44')](handleError(_0x4dd38c,null));};exports['create']=function(_0x438b9f,_0x36b5a1){return db[_0x4e44('0x2f')][_0x4e44('0x49')](_0x438b9f[_0x4e44('0x4a')],{})[_0x4e44('0x28')](respondWithResult(_0x36b5a1,0xc9))['catch'](handleError(_0x36b5a1,null));};exports['update']=function(_0x3e5703,_0x5e979a){if(_0x3e5703[_0x4e44('0x4a')]['id']){delete _0x3e5703[_0x4e44('0x4a')]['id'];}return db[_0x4e44('0x2f')]['find']({'where':{'id':_0x3e5703[_0x4e44('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e979a,null))[_0x4e44('0x28')](saveUpdates(_0x3e5703[_0x4e44('0x4a')],null))[_0x4e44('0x28')](respondWithResult(_0x5e979a,null))[_0x4e44('0x44')](handleError(_0x5e979a,null));};exports[_0x4e44('0x27')]=function(_0x54d87a,_0x4d814f){return db[_0x4e44('0x2f')]['find']({'where':{'id':_0x54d87a[_0x4e44('0x4b')]['id']}})[_0x4e44('0x28')](handleEntityNotFound(_0x4d814f,null))[_0x4e44('0x28')](removeEntity(_0x4d814f,null))[_0x4e44('0x44')](handleError(_0x4d814f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a08c279..67c0379 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 _0x01bf=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','lodash','../../config/logger'];(function(_0xa769d4,_0x25c875){var _0x44f441=function(_0x5e6274){while(--_0x5e6274){_0xa769d4['push'](_0xa769d4['shift']());}};_0x44f441(++_0x25c875);}(_0x01bf,0xae));var _0xf01b=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0x01bf[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0xf01b('0x0'));var util=require('util');var logger=require(_0xf01b('0x1'))(_0xf01b('0x2'));var moment=require(_0xf01b('0x3'));var BPromise=require(_0xf01b('0x4'));var rp=require(_0xf01b('0x5'));var fs=require('fs');var path=require(_0xf01b('0x6'));var rimraf=require('rimraf');var config=require(_0xf01b('0x7'));var attributes=require(_0xf01b('0x8'));module[_0xf01b('0x9')]=function(_0x535f79,_0xc36be){return _0x535f79['define']('OpenchannelApplication',attributes,{'tableName':_0xf01b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9db9=['bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x56a7cf,_0x57011f){var _0xfc19e3=function(_0x2cfb3e){while(--_0x2cfb3e){_0x56a7cf['push'](_0x56a7cf['shift']());}};_0xfc19e3(++_0x57011f);}(_0x9db9,0x140));var _0x99db=function(_0x1568b8,_0x543f3f){_0x1568b8=_0x1568b8-0x0;var _0x1182bd=_0x9db9[_0x1568b8];return _0x1182bd;};'use strict';var _=require(_0x99db('0x0'));var util=require(_0x99db('0x1'));var logger=require(_0x99db('0x2'))(_0x99db('0x3'));var moment=require(_0x99db('0x4'));var BPromise=require(_0x99db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99db('0x6'));var rimraf=require(_0x99db('0x7'));var config=require(_0x99db('0x8'));var attributes=require(_0x99db('0x9'));module[_0x99db('0xa')]=function(_0xc8a127,_0x3605a3){return _0xc8a127[_0x99db('0xb')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x99db('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 916a601..b9dbcf1 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 _0x75ef=['message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x75ef,0xbf));var _0xf75e=function(_0x4fd114,_0x1a3aef){_0x4fd114=_0x4fd114-0x0;var _0x2ded75=_0x75ef[_0x4fd114];return _0x2ded75;};'use strict';var _=require('lodash');var util=require(_0xf75e('0x0'));var moment=require('moment');var BPromise=require(_0xf75e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf75e('0x2'));var db=require(_0xf75e('0x3'))['db'];var utils=require(_0xf75e('0x4'));var logger=require(_0xf75e('0x5'))('rpc');var config=require(_0xf75e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf75e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d1e06,_0x5ad2d3,_0x1dcf48){return new BPromise(function(_0x38f3a5,_0x55ae9d){return client['request'](_0x2d1e06,_0x1dcf48)[_0xf75e('0x8')](function(_0x543174){logger[_0xf75e('0x9')](_0xf75e('0xa'),_0x5ad2d3,'request\x20sent');logger[_0xf75e('0xb')](_0xf75e('0xc'),_0x5ad2d3,_0xf75e('0xd'),JSON[_0xf75e('0xe')](_0x543174));if(_0x543174[_0xf75e('0xf')]){if(_0x543174[_0xf75e('0xf')][_0xf75e('0x10')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x5ad2d3,_0x543174['error']['message']);return _0x55ae9d(_0x543174[_0xf75e('0xf')][_0xf75e('0x11')]);}logger[_0xf75e('0xf')](_0xf75e('0xa'),_0x5ad2d3,_0x543174['error'][_0xf75e('0x11')]);return _0x38f3a5(_0x543174[_0xf75e('0xf')]['message']);}else{logger[_0xf75e('0x9')](_0xf75e('0xa'),_0x5ad2d3,_0xf75e('0xd'));_0x38f3a5(_0x543174[_0xf75e('0x12')]['message']);}})[_0xf75e('0x13')](function(_0x884f8d){logger[_0xf75e('0xf')](_0xf75e('0xa'),_0x5ad2d3,_0x884f8d);_0x55ae9d(_0x884f8d);});});}exports[_0xf75e('0x14')]=function(_0x5ad042){var _0x36e495=this;return new Promise(function(_0xa678f1,_0xf08af9){return db[_0xf75e('0x15')][_0xf75e('0x16')](_0x5ad042['body'],{'raw':_0x5ad042[_0xf75e('0x17')]?_0x5ad042[_0xf75e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad042['options']?_0x5ad042['options']['where']||null:null,'attributes':_0x5ad042[_0xf75e('0x17')]?_0x5ad042[_0xf75e('0x17')][_0xf75e('0x18')]||null:null,'limit':_0x5ad042[_0xf75e('0x17')]?_0x5ad042[_0xf75e('0x17')][_0xf75e('0x19')]||null:null})[_0xf75e('0x8')](function(_0x4266da){logger[_0xf75e('0x9')](_0xf75e('0x14'),_0x5ad042);logger['debug'](_0xf75e('0x14'),_0x5ad042,JSON[_0xf75e('0xe')](_0x4266da));_0xa678f1(_0x4266da);})[_0xf75e('0x13')](function(_0xcb3d3d){logger[_0xf75e('0xf')]('UpdateOpenchannelApplication',_0xcb3d3d[_0xf75e('0x11')],_0x5ad042);_0xf08af9(_0x36e495[_0xf75e('0xf')](0x1f4,_0xcb3d3d['message']));});});}; \ No newline at end of file +var _0xd913=['info','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit'];(function(_0x41099e,_0xc94991){var _0x5a6c5d=function(_0x1f6ace){while(--_0x1f6ace){_0x41099e['push'](_0x41099e['shift']());}};_0x5a6c5d(++_0xc94991);}(_0xd913,0x107));var _0x3d91=function(_0x37b83f,_0x29a8f7){_0x37b83f=_0x37b83f-0x0;var _0x1fbac1=_0xd913[_0x37b83f];return _0x1fbac1;};'use strict';var _=require(_0x3d91('0x0'));var util=require(_0x3d91('0x1'));var moment=require(_0x3d91('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d91('0x4'))['db'];var utils=require(_0x3d91('0x5'));var logger=require('../../config/logger')(_0x3d91('0x6'));var config=require('../../config/environment');var jayson=require(_0x3d91('0x7'));var client=jayson[_0x3d91('0x8')][_0x3d91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x106f8d,_0x43b6d2,_0xd151d4){return new BPromise(function(_0x3225ed,_0x5de3a2){return client[_0x3d91('0xa')](_0x106f8d,_0xd151d4)[_0x3d91('0xb')](function(_0x16634a){logger['info'](_0x3d91('0xc'),_0x43b6d2,_0x3d91('0xd'));logger[_0x3d91('0xe')](_0x3d91('0xf'),_0x43b6d2,'request\x20sent',JSON['stringify'](_0x16634a));if(_0x16634a[_0x3d91('0x10')]){if(_0x16634a[_0x3d91('0x10')]['code']===0x1f4){logger[_0x3d91('0x10')](_0x3d91('0xc'),_0x43b6d2,_0x16634a[_0x3d91('0x10')][_0x3d91('0x11')]);return _0x5de3a2(_0x16634a[_0x3d91('0x10')][_0x3d91('0x11')]);}logger['error'](_0x3d91('0xc'),_0x43b6d2,_0x16634a[_0x3d91('0x10')][_0x3d91('0x11')]);return _0x3225ed(_0x16634a[_0x3d91('0x10')][_0x3d91('0x11')]);}else{logger['info'](_0x3d91('0xc'),_0x43b6d2,_0x3d91('0xd'));_0x3225ed(_0x16634a['result']['message']);}})[_0x3d91('0x12')](function(_0x2b6fe1){logger[_0x3d91('0x10')](_0x3d91('0xc'),_0x43b6d2,_0x2b6fe1);_0x5de3a2(_0x2b6fe1);});});}exports[_0x3d91('0x13')]=function(_0x5791ca){var _0x48905c=this;return new Promise(function(_0x13b9f8,_0x2a07b1){return db[_0x3d91('0x14')][_0x3d91('0x15')](_0x5791ca[_0x3d91('0x16')],{'raw':_0x5791ca[_0x3d91('0x17')]?_0x5791ca['options'][_0x3d91('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5791ca[_0x3d91('0x17')]?_0x5791ca[_0x3d91('0x17')][_0x3d91('0x19')]||null:null,'attributes':_0x5791ca[_0x3d91('0x17')]?_0x5791ca['options']['attributes']||null:null,'limit':_0x5791ca[_0x3d91('0x17')]?_0x5791ca['options'][_0x3d91('0x1a')]||null:null})['then'](function(_0xcad7be){logger[_0x3d91('0x1b')](_0x3d91('0x13'),_0x5791ca);logger[_0x3d91('0xe')](_0x3d91('0x13'),_0x5791ca,JSON[_0x3d91('0x1c')](_0xcad7be));_0x13b9f8(_0xcad7be);})[_0x3d91('0x12')](function(_0x161570){logger[_0x3d91('0x10')](_0x3d91('0x13'),_0x161570[_0x3d91('0x11')],_0x5791ca);_0x2a07b1(_0x48905c[_0x3d91('0x10')](0x1f4,_0x161570[_0x3d91('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index cbda592..c066fa5 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 _0xb3d7=['delete','openchannelinteraction:destroy','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','download','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update'];(function(_0x2d6ea9,_0x2840b9){var _0x22a1de=function(_0x1aed1d){while(--_0x1aed1d){_0x2d6ea9['push'](_0x2d6ea9['shift']());}};_0x22a1de(++_0x2840b9);}(_0xb3d7,0x199));var _0x7b3d=function(_0x20dfdb,_0x346ed4){_0x20dfdb=_0x20dfdb-0x0;var _0x49604e=_0xb3d7[_0x20dfdb];return _0x49604e;};'use strict';var multer=require(_0x7b3d('0x0'));var util=require(_0x7b3d('0x1'));var path=require('path');var timeout=require(_0x7b3d('0x2'));var express=require(_0x7b3d('0x3'));var router=express['Router']();var fs_extra=require(_0x7b3d('0x4'));var auth=require(_0x7b3d('0x5'));var interaction=require(_0x7b3d('0x6'));var config=require(_0x7b3d('0x7'));var controller=require(_0x7b3d('0x8'));router[_0x7b3d('0x9')]('/',auth[_0x7b3d('0xa')](),controller[_0x7b3d('0xb')]);router['get'](_0x7b3d('0xc'),auth[_0x7b3d('0xa')](),controller['describe']);router['get'](_0x7b3d('0xd'),auth[_0x7b3d('0xa')](),controller['show']);router[_0x7b3d('0x9')](_0x7b3d('0xe'),auth['isAuthenticated'](),controller[_0x7b3d('0xf')]);router[_0x7b3d('0x9')]('/:id/download',auth[_0x7b3d('0xa')](),controller[_0x7b3d('0x10')]);router['post']('/',auth[_0x7b3d('0xa')](),controller['create']);router['post'](_0x7b3d('0xe'),auth[_0x7b3d('0xa')](),controller['addMessage']);router[_0x7b3d('0x11')](_0x7b3d('0x12'),auth[_0x7b3d('0xa')](),interaction[_0x7b3d('0x13')](_0x7b3d('0x14'),_0x7b3d('0x15')),controller[_0x7b3d('0x16')]);router[_0x7b3d('0x17')](_0x7b3d('0xd'),auth[_0x7b3d('0xa')](),interaction[_0x7b3d('0x13')](_0x7b3d('0x14'),_0x7b3d('0x18')),controller[_0x7b3d('0x19')]);router[_0x7b3d('0x1a')](_0x7b3d('0xd'),auth[_0x7b3d('0xa')](),interaction[_0x7b3d('0x13')](_0x7b3d('0x14'),_0x7b3d('0x1b')),controller[_0x7b3d('0x1c')]);router['delete']('/:id/tags',auth[_0x7b3d('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x36b7=['getMessages','/:id/download','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages'];(function(_0x1f0043,_0x110542){var _0x190f46=function(_0x4648b6){while(--_0x4648b6){_0x1f0043['push'](_0x1f0043['shift']());}};_0x190f46(++_0x110542);}(_0x36b7,0x99));var _0x736b=function(_0x141104,_0x27051a){_0x141104=_0x141104-0x0;var _0x5a084a=_0x36b7[_0x141104];return _0x5a084a;};'use strict';var multer=require('multer');var util=require(_0x736b('0x0'));var path=require('path');var timeout=require(_0x736b('0x1'));var express=require(_0x736b('0x2'));var router=express[_0x736b('0x3')]();var fs_extra=require(_0x736b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x736b('0x5'));var controller=require(_0x736b('0x6'));router[_0x736b('0x7')]('/',auth['isAuthenticated'](),controller[_0x736b('0x8')]);router[_0x736b('0x7')](_0x736b('0x9'),auth[_0x736b('0xa')](),controller[_0x736b('0xb')]);router[_0x736b('0x7')](_0x736b('0xc'),auth[_0x736b('0xa')](),controller[_0x736b('0xd')]);router[_0x736b('0x7')](_0x736b('0xe'),auth[_0x736b('0xa')](),controller[_0x736b('0xf')]);router[_0x736b('0x7')](_0x736b('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x736b('0x11')]('/',auth[_0x736b('0xa')](),controller['create']);router[_0x736b('0x11')]('/:id/messages',auth[_0x736b('0xa')](),controller['addMessage']);router[_0x736b('0x11')](_0x736b('0x12'),auth[_0x736b('0xa')](),interaction[_0x736b('0x13')](_0x736b('0x14'),_0x736b('0x15')),controller['addTags']);router[_0x736b('0x16')](_0x736b('0xc'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x736b('0x17')),controller[_0x736b('0x18')]);router['delete']('/:id',auth[_0x736b('0xa')](),interaction[_0x736b('0x13')](_0x736b('0x14'),_0x736b('0x19')),controller['destroy']);router[_0x736b('0x1a')]('/:id/tags',auth[_0x736b('0xa')](),controller['removeTags']);module[_0x736b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f83256e..4013d81 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 _0x27bf=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x27bf,0x117));var _0xf27b=function(_0x3f11d2,_0x4108ca){_0x3f11d2=_0x3f11d2-0x0;var _0x98ed30=_0x27bf[_0x3f11d2];return _0x98ed30;};'use strict';var Sequelize=require(_0xf27b('0x0'));module[_0xf27b('0x1')]={'closed':{'type':Sequelize[_0xf27b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf27b('0x3')]},'disposition':{'type':Sequelize[_0xf27b('0x4')]},'secondDisposition':{'type':Sequelize[_0xf27b('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf27b('0x4')]},'note':{'type':Sequelize[_0xf27b('0x4')]},'read1stAt':{'type':Sequelize[_0xf27b('0x3')]},'threadId':{'type':Sequelize[_0xf27b('0x4')]},'externalUrl':{'type':Sequelize[_0xf27b('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf27b('0x5')]('in',_0xf27b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf27b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf27b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a19=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9a19,0x114));var _0x99a1=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9a19[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'closed':{'type':Sequelize[_0x99a1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x99a1('0x3')]},'secondDisposition':{'type':Sequelize[_0x99a1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x99a1('0x3')]},'note':{'type':Sequelize[_0x99a1('0x3')]},'read1stAt':{'type':Sequelize[_0x99a1('0x4')]},'threadId':{'type':Sequelize[_0x99a1('0x3')]},'externalUrl':{'type':Sequelize[_0x99a1('0x3')]},'lastMsgAt':{'type':Sequelize[_0x99a1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x99a1('0x5')]('in',_0x99a1('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x99a1('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 13e6dc2..dffd70f 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 _0x75e2=['i.from\x20LIKE\x20?','group','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','toString','groupBy','OpenchannelInteractionId','push','all','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','$gte','format','findAll','addTags','omit','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','root','tmp','join','server','files','transcript-%d-%s.zip','firstName','lastName','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','update','then','name','send','map','fullname','TagIds','split','forEach','Tags','catch','index','OpenchannelInteraction','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','color','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','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','ContactId','text','start','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','OpenchannelAccountId','where','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x225443,_0x8e3b5b){var _0x2c9706=function(_0x538010){while(--_0x538010){_0x225443['push'](_0x225443['shift']());}};_0x2c9706(++_0x8e3b5b);}(_0x75e2,0x157));var _0x275e=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x75e2[_0x33dcf7];return _0x542d4e;};'use strict';var emlformat=require(_0x275e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x275e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x275e('0x2'));var moment=require(_0x275e('0x3'));var BPromise=require(_0x275e('0x4'));var Mustache=require(_0x275e('0x5'));var util=require(_0x275e('0x6'));var path=require('path');var sox=require(_0x275e('0x7'));var csv=require(_0x275e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x275e('0x9'));var _=require(_0x275e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x275e('0xb'));var deskjs=require(_0x275e('0xc'));var toCsv=require(_0x275e('0x8'));var querystring=require(_0x275e('0xd'));var Papa=require(_0x275e('0xe'));var Redis=require(_0x275e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x275e('0x10'));var as=require(_0x275e('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x275e('0x12'))('api');var utils=require(_0x275e('0x13'));var config=require(_0x275e('0x14'));var licenseUtil=require(_0x275e('0x15'));var db=require(_0x275e('0x16'))['db'];config[_0x275e('0x17')]=_[_0x275e('0x18')](config['redis'],{'host':_0x275e('0x19'),'port':0x18eb});var socket=require(_0x275e('0x1a'))(new Redis(config[_0x275e('0x17')]));require(_0x275e('0x1b'))[_0x275e('0x1c')](socket);function respondWithStatusCode(_0x5dd76e,_0x50f83c){_0x50f83c=_0x50f83c||0xcc;return function(_0x441082){if(_0x441082){return _0x5dd76e[_0x275e('0x1d')](_0x50f83c);}return _0x5dd76e['status'](_0x50f83c)[_0x275e('0x1e')]();};}function respondWithResult(_0x15981a,_0x1e88d5){_0x1e88d5=_0x1e88d5||0xc8;return function(_0x3fe102){if(_0x3fe102){return _0x15981a['status'](_0x1e88d5)[_0x275e('0x1f')](_0x3fe102);}};}function respondWithFilteredResult(_0x3304f3,_0x592ece){return function(_0x2de08c){if(_0x2de08c){var _0x29e55b=typeof _0x592ece['offset']===_0x275e('0x20')&&typeof _0x592ece[_0x275e('0x21')]===_0x275e('0x20');var _0x22abc4=_0x2de08c['count'];var _0x3168d0=_0x29e55b?0x0:_0x592ece[_0x275e('0x22')];var _0x17f2ed=_0x29e55b?_0x2de08c[_0x275e('0x23')]:_0x592ece[_0x275e('0x22')]+_0x592ece[_0x275e('0x21')];var _0xd5b6bb;if(_0x17f2ed>=_0x22abc4){_0x17f2ed=_0x22abc4;_0xd5b6bb=0xc8;}else{_0xd5b6bb=0xce;}_0x3304f3[_0x275e('0x24')](_0xd5b6bb);return _0x3304f3[_0x275e('0x25')](_0x275e('0x26'),_0x3168d0+'-'+_0x17f2ed+'/'+_0x22abc4)[_0x275e('0x1f')](_0x2de08c);}return null;};}function patchUpdates(_0x17b359){return function(_0x3ee060){try{jsonpatch['apply'](_0x3ee060,_0x17b359,!![]);}catch(_0x23bfc9){return BPromise[_0x275e('0x27')](_0x23bfc9);}return _0x3ee060['save']();};}function saveUpdates(_0x2522bb,_0xf9e16c){return function(_0x1fe753){if(_0x1fe753){return _0x1fe753[_0x275e('0x28')](_0x2522bb)[_0x275e('0x29')](function(_0xbc5e31){return _0xbc5e31;});}return null;};}function removeEntity(_0x4677ce,_0xc8579){return function(_0x11adf7){if(_0x11adf7){return _0x11adf7['destroy']()['then'](function(){_0x4677ce['status'](0xcc)[_0x275e('0x1e')]();});}};}function handleEntityNotFound(_0x2e53ce,_0x289037){return function(_0x91c0cb){if(!_0x91c0cb){_0x2e53ce[_0x275e('0x1d')](0x194);}return _0x91c0cb;};}function handleError(_0x5a9f5e,_0x1fcf48){_0x1fcf48=_0x1fcf48||0x1f4;return function(_0x25519f){logger['error'](_0x25519f['stack']);if(_0x25519f[_0x275e('0x2a')]){delete _0x25519f[_0x275e('0x2a')];}_0x5a9f5e['status'](_0x1fcf48)[_0x275e('0x2b')](_0x25519f);};}function getInteractionUsers(_0x44239d,_0x2cd5b4){return new BPromise(function(_0x5ec15c,_0x25bdc0){try{if(_0x2cd5b4[_0x44239d['id']]){_0x44239d['Users']=_[_0x275e('0x2c')](_0x2cd5b4[_0x44239d['id']],function(_0x25ba4e){return{'id':_0x25ba4e['id'],'fullname':_0x25ba4e[_0x275e('0x2d')]};});}}catch(_0x5af5b8){_0x25bdc0(_0x5af5b8);}_0x5ec15c(_0x44239d);});}function getInteractionTags(_0xba70e6,_0x23e9c9){return new BPromise(function(_0x61691f,_0x30fb77){try{if(_0xba70e6[_0x275e('0x2e')]){_0xba70e6['Tags']=[];_0xba70e6[_0x275e('0x2e')][_0x275e('0x2f')](',')[_0x275e('0x30')](function(_0x300922){_0xba70e6[_0x275e('0x31')]['push'](_0x23e9c9[_0x300922]);});}delete _0xba70e6[_0x275e('0x2e')];}catch(_0x1af5ef){_0x30fb77(_0x1af5ef);}_0x61691f(_0xba70e6);});}function updateOpenchannelInteraction(_0x4f4c99,_0x32b2e9,_0x2a7552){return new BPromise(function(_0x249452,_0x812497){return getInteractionUsers(_0x4f4c99,_0x2a7552)[_0x275e('0x29')](function(_0x1098cf){return getInteractionTags(_0x1098cf,_0x32b2e9);})[_0x275e('0x29')](function(_0x152e63){_0x249452(_0x152e63);})[_0x275e('0x32')](function(_0x1e4c12){_0x812497(_0x1e4c12);});});}exports[_0x275e('0x33')]=function(_0x228a1c,_0x33b61d){var _0x47e38e={},_0x133418={},_0x2157e9={'count':0x0,'rows':[]};var _0xa48302=_[_0x275e('0x2c')](db[_0x275e('0x34')][_0x275e('0x35')],function(_0x3ffbc1){return{'name':_0x3ffbc1['fieldName'],'type':_0x3ffbc1[_0x275e('0x36')]['key']};});_0x133418[_0x275e('0x37')]=_['map'](_0xa48302,'name');_0x133418[_0x275e('0x38')]=_[_0x275e('0x39')](_0x228a1c[_0x275e('0x38')]);_0x133418[_0x275e('0x3a')]=_['intersection'](_0x133418[_0x275e('0x37')],_0x133418[_0x275e('0x38')]);_0x47e38e[_0x275e('0x3b')]=_[_0x275e('0x3c')](_0x133418[_0x275e('0x37')],qs['fields'](_0x228a1c[_0x275e('0x38')][_0x275e('0x3d')]));_0x47e38e[_0x275e('0x3b')]=_0x47e38e['attributes'][_0x275e('0x3e')]?_0x47e38e['attributes']:_0x133418[_0x275e('0x37')];if(!_0x228a1c[_0x275e('0x38')][_0x275e('0x3f')](_0x275e('0x40'))){_0x47e38e[_0x275e('0x21')]=qs[_0x275e('0x21')](_0x228a1c[_0x275e('0x38')][_0x275e('0x21')]);_0x47e38e[_0x275e('0x22')]=qs[_0x275e('0x22')](_0x228a1c[_0x275e('0x38')][_0x275e('0x22')]);}_0x47e38e['order']=qs[_0x275e('0x41')](_0x228a1c[_0x275e('0x38')][_0x275e('0x41')]);_0x47e38e['where']=qs['filters'](_[_0x275e('0x42')](_0x228a1c['query'],_0x133418[_0x275e('0x3a')]),_0xa48302);var _0x219dc2=[];var _0x84a6ac=squel[_0x275e('0x43')]()[_0x275e('0x44')]('id')[_0x275e('0x44')]('name')[_0x275e('0x44')](_0x275e('0x45'))['from'](_0x275e('0x46'));var _0x5ed765=squel[_0x275e('0x43')]()[_0x275e('0x44')](_0x275e('0x47'))[_0x275e('0x44')](_0x275e('0x48'))[_0x275e('0x44')]('ui.OpenchannelInteractionId')['from'](_0x275e('0x49'),'ui')[_0x275e('0x4a')](_0x275e('0x4b'),'u',_0x275e('0x4c'));var _0x536ce4=squel['select']()[_0x275e('0x4d')](_0x275e('0x4e'),'i')[_0x275e('0x4a')](_0x275e('0x4f'),'c',_0x275e('0x50'))[_0x275e('0x4a')](_0x275e('0x4b'),'o',_0x275e('0x51'))[_0x275e('0x4a')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x275e('0x4a')](_0x275e('0x52'),'me',_0x275e('0x53'))[_0x275e('0x4a')](_0x275e('0x54'),'it',_0x275e('0x55'))[_0x275e('0x4a')](_0x275e('0x46'),'t','t.id\x20=\x20it.TagId');var _0x193875=squel[_0x275e('0x56')]();var _0x26ed44=[];var _0x598681=squel[_0x275e('0x56')]();var _0x503c71;if(_0x228a1c[_0x275e('0x38')]['search']){_0x503c71=as['parseSearch'](_0x228a1c[_0x275e('0x38')][_0x275e('0x57')]);var _0x13db2=_0x503c71[_0x275e('0x58')];for(var _0x15ee83=0x0;_0x15ee83<_0x503c71[_0x275e('0x59')][_0x275e('0x3e')];_0x15ee83++){var _0x421e11=_0x503c71[_0x275e('0x59')][_0x15ee83];var _0x1c11bd='i';var _0x36d4a8=_[_0x275e('0x5a')](_0xa48302,[_0x275e('0x2a'),_0x421e11[_0x275e('0x44')]]);if(!_0x36d4a8){switch(_0x421e11[_0x275e('0x44')]){case _0x275e('0x5b'):if(_0x421e11[_0x275e('0x5c')]==0x1){_0x536ce4[_0x275e('0x5d')]('`'+_0x421e11[_0x275e('0x44')]+_0x275e('0x5e'));}else{_0x536ce4[_0x275e('0x5d')]('`'+_0x421e11[_0x275e('0x44')]+_0x275e('0x5f'));}break;case _0x275e('0x60'):if(_0x421e11[_0x275e('0x61')]===_0x275e('0x62')){if(_0x421e11[_0x275e('0x5c')][_0x275e('0x2f')]('\x20')['length']>0x1){_0x193875[_0x13db2](_0x275e('0x63'),qs[_0x275e('0x64')](_0x421e11[_0x275e('0x5c')]),null);}else{var _0x23d26d='%'+_0x421e11[_0x275e('0x5c')]+'%';_0x193875[_0x13db2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x23d26d,_0x23d26d,_0x23d26d);}}else{_0x36d4a8=_['find'](_0xa48302,[_0x275e('0x2a'),_0x275e('0x65')]);_0x421e11[_0x275e('0x44')]=_0x275e('0x65');_0x1e4578=as['buildExpression'](_0x1c11bd,_0x36d4a8[_0x275e('0x36')],_0x421e11);_0x193875[_0x13db2](_0x1e4578[_0x275e('0x66')],_0x1e4578['value'][_0x275e('0x67')],_0x1e4578[_0x275e('0x5c')][_0x275e('0x1e')]);}break;case'Tag':var _0x5e1a49=_0x421e11[_0x275e('0x5c')][_0x275e('0x2f')](',')['map'](function(_0x13c7bc){return Number(_0x13c7bc);});_0x5e1a49[_0x275e('0x30')](function(_0x702e70){_0x598681['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x702e70+',%');});_0x26ed44=_['union'](_0x26ed44,_0x5e1a49);break;case _0x275e('0x68'):if(_0x421e11[_0x275e('0x61')]==='$substring'){_0x193875[_0x13db2](_0x275e('0x69'),'%'+_0x421e11[_0x275e('0x5c')]+'%',null);}else{_0x36d4a8=_[_0x275e('0x5a')](_0xa48302,[_0x275e('0x2a'),_0x275e('0x6a')]);_0x421e11['field']=_0x275e('0x6a');_0x1e4578=as[_0x275e('0x6b')](_0x1c11bd,_0x36d4a8[_0x275e('0x36')],_0x421e11);_0x193875[_0x13db2](_0x1e4578[_0x275e('0x66')],_0x1e4578[_0x275e('0x5c')][_0x275e('0x67')],_0x1e4578['value'][_0x275e('0x1e')]);}break;case _0x275e('0x6c'):_0x1e4578=as[_0x275e('0x6b')]('me',null,_0x421e11);_0x193875[_0x13db2](_0x1e4578[_0x275e('0x66')],_0x1e4578[_0x275e('0x5c')][_0x275e('0x67')],_0x1e4578[_0x275e('0x5c')][_0x275e('0x1e')]);break;}}else{var _0x1e4578=as[_0x275e('0x6b')](_0x1c11bd,_0x36d4a8[_0x275e('0x36')],_0x421e11);_0x193875[_0x13db2](_0x1e4578[_0x275e('0x66')],_0x1e4578[_0x275e('0x5c')]['start'],_0x1e4578[_0x275e('0x5c')][_0x275e('0x1e')]);}}}else{var _0x206c9a=_(_0x228a1c[_0x275e('0x38')])[_0x275e('0x39')]()[_0x275e('0x2c')](function(_0x430ef5){return _[_0x275e('0x6d')](_0xa48302,[_0x275e('0x2a'),_0x430ef5])?_0x430ef5:undefined;})['compact']()[_0x275e('0x5c')]();if(!_[_0x275e('0x6e')](_0x206c9a)){_0x206c9a[_0x275e('0x30')](function(_0x5d4a56){if(_0x5d4a56===_0x275e('0x6f')){_0x536ce4[_0x275e('0x70')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x228a1c[_0x275e('0x38')][_0x5d4a56]));}else if(_0x5d4a56==='createdAt'){var _0x2dfac3=JSON[_0x275e('0x71')](_0x228a1c[_0x275e('0x38')][_0x5d4a56])['$gte'];var _0x2236d3=JSON[_0x275e('0x71')](_0x228a1c['query'][_0x5d4a56])[_0x275e('0x72')];_0x536ce4[_0x275e('0x70')](_0x275e('0x73'),_0x2dfac3,_0x2236d3);}else{if(_0x228a1c['query'][_0x5d4a56]===_0x275e('0x74')){_0x536ce4[_0x275e('0x70')]('i.'+_0x5d4a56+_0x275e('0x75'));}else{_0x536ce4[_0x275e('0x70')]('i.'+_0x5d4a56+_0x275e('0x76'),_0x228a1c[_0x275e('0x38')][_0x5d4a56]);}}});}if(_0x228a1c[_0x275e('0x38')][_0x275e('0x77')]){if(_0x228a1c[_0x275e('0x38')][_0x275e('0x77')]==0x1){_0x536ce4[_0x275e('0x5d')](_0x275e('0x78'));}else{_0x536ce4['having'](_0x275e('0x79'));}}if(_0x228a1c[_0x275e('0x38')][_0x275e('0x7a')]){_0x26ed44=_[_0x275e('0x7b')](_0x228a1c[_0x275e('0x38')]['tag'])?_0x228a1c['query'][_0x275e('0x7a')]:new Array(_0x228a1c[_0x275e('0x38')][_0x275e('0x7a')]);_0x26ed44['forEach'](function(_0x17f139){_0x598681['or'](_0x275e('0x7c'),'%,'+_0x17f139+',%');});}if(_0x228a1c['query']['filter']){var _0x19d800=_0x228a1c[_0x275e('0x38')][_0x275e('0x7d')][_0x275e('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x19d800)){_0x193875['or'](_0x275e('0x7f'),_0x19d800+'%');}else{_0x193875['or'](_0x275e('0x80'),qs[_0x275e('0x64')](_0x19d800))['or'](_0x275e('0x81'),_0x19d800+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x19d800+'%');}}}_0x536ce4['where'](_0x193875);_0x536ce4[_0x275e('0x82')]('i.id');var _0x2b383f={'type':db[_0x275e('0x83')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1901ae=_0x536ce4[_0x275e('0x84')]();_0x1901ae[_0x275e('0x44')](_0x275e('0x85'));_0x1901ae[_0x275e('0x44')](_0x275e('0x86'),_0x275e('0x5b'));if(_0x47e38e[_0x275e('0x87')]){_0x47e38e[_0x275e('0x87')]['forEach'](function(_0x1641f5){var _0x1b60fb=_0x1641f5[0x0]==='contactName'?_0x1641f5[0x0]:'i.'+_0x1641f5[0x0];_0x536ce4['order'](_0x1b60fb,_0x1641f5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x275e('0x6e')](_0x26ed44)){_0x536ce4[_0x275e('0x5d')](_0x598681);_0x1901ae[_0x275e('0x70')](_0x275e('0x88'),_0x26ed44);}BPromise[_0x275e('0x89')]()['then'](function(){if(!_0x503c71){if(_0x228a1c[_0x275e('0x38')]['OpenchannelAccountId'])return;_0x1901ae[_0x275e('0x70')](_0x275e('0x8a'));_0x536ce4[_0x275e('0x70')](_0x275e('0x8a'));return;}if(_0x228a1c['user'][_0x275e('0x8b')]!==_0x275e('0x8c'))return;return _0x228a1c[_0x275e('0x8d')][_0x275e('0x8e')]({'attributes':['id'],'raw':!![]})[_0x275e('0x29')](function(_0x51fde6){if(_[_0x275e('0x6e')](_0x51fde6)){_0x1901ae['where'](_0x275e('0x8f'));_0x536ce4[_0x275e('0x70')](_0x275e('0x8f'));}else{_0x1901ae[_0x275e('0x70')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x275e('0x2c')](_0x51fde6,'id'));_0x536ce4[_0x275e('0x70')](_0x275e('0x90'),_['map'](_0x51fde6,'id'));}});})[_0x275e('0x29')](function(){if(_0x228a1c[_0x275e('0x8d')][_0x275e('0x8b')]===_0x275e('0x8c')&&!_0x503c71&&!_0x228a1c[_0x275e('0x38')][_0x275e('0x6f')])return[];return db['sequelize']['query'](_0x1901ae['toString'](),_0x2b383f);})[_0x275e('0x29')](function(_0x576516){_0x2157e9[_0x275e('0x23')]=_0x576516[_0x275e('0x3e')];if(_0x2157e9[_0x275e('0x23')]===0x0)return[];return db['sequelize'][_0x275e('0x38')](_0x84a6ac['toString'](),_0x2b383f)[_0x275e('0x29')](function(_0x286233){_0x219dc2=_[_0x275e('0x91')](_0x286233,'id');_0x2b383f=_[_0x275e('0x92')](_0x2b383f,{'model':db[_0x275e('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x228a1c[_0x275e('0x38')][_0x275e('0x3d')]){_0x47e38e[_0x275e('0x3b')][_0x275e('0x30')](function(_0x41c523){_0x536ce4[_0x275e('0x44')]('i.'+_0x41c523);});}else{_0x536ce4[_0x275e('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x275e('0x5b'));_0x536ce4['field'](_0x275e('0x93'),_0x275e('0x94'));_0x536ce4[_0x275e('0x44')](_0x275e('0x95'),_0x275e('0x96'));_0x536ce4[_0x275e('0x44')](_0x275e('0x97'),_0x275e('0x98'));_0x536ce4[_0x275e('0x44')](_0x275e('0x99'));_0x536ce4[_0x275e('0x44')]('c.firstName',_0x275e('0x9a'));_0x536ce4[_0x275e('0x44')]('c.lastName',_0x275e('0x9b'));_0x536ce4[_0x275e('0x44')](_0x275e('0x9c'),_0x275e('0x9d'));_0x536ce4[_0x275e('0x44')]('c.phone',_0x275e('0x9e'));_0x536ce4[_0x275e('0x44')](_0x275e('0x9f'),'Contact.mobile');_0x536ce4[_0x275e('0x44')](_0x275e('0xa0'),_0x275e('0xa1'));_0x536ce4['field'](_0x275e('0xa2'),'Owner.fullname');_0x536ce4[_0x275e('0x44')]('o.internal',_0x275e('0xa3'));_0x536ce4['field'](_0x275e('0xa4'),_0x275e('0x2e'));}if(_0x47e38e['limit'])_0x536ce4[_0x275e('0x21')](_0x47e38e[_0x275e('0x21')]);if(_0x47e38e[_0x275e('0x22')])_0x536ce4[_0x275e('0x22')](_0x47e38e['offset']);return db[_0x275e('0xa5')][_0x275e('0x38')](_0x536ce4['toString'](),_0x2b383f);})['then'](function(_0x3fd135){if(_0x3fd135['length']>0x0)_0x5ed765[_0x275e('0x70')](_0x275e('0xa6'),_[_0x275e('0x2c')](_0x3fd135,'id'));return db[_0x275e('0xa5')][_0x275e('0x38')](_0x5ed765[_0x275e('0xa7')](),_0x2b383f)[_0x275e('0x29')](function(_0x3bd0ee){var _0x14fe42=_[_0x275e('0xa8')](_0x3bd0ee,_0x275e('0xa9'));var _0x9b3c1a=[];_0x3fd135[_0x275e('0x30')](function(_0x2cfffa){_0x9b3c1a[_0x275e('0xaa')](updateOpenchannelInteraction(_0x2cfffa,_0x219dc2,_0x14fe42));});return BPromise[_0x275e('0xab')](_0x9b3c1a);});});})[_0x275e('0x29')](function(_0x408bae){_0x2157e9[_0x275e('0xac')]=_0x408bae;return _0x2157e9;})[_0x275e('0x29')](respondWithFilteredResult(_0x33b61d,_0x47e38e))[_0x275e('0x32')](handleError(_0x33b61d,null));};exports[_0x275e('0xad')]=function(_0xef21af,_0x2b0bca){var _0xa32637={};if(_0xef21af[_0x275e('0x38')]['type']&&_0xef21af[_0x275e('0x38')][_0x275e('0x36')]===_0x275e('0x4d')){_0xa32637['from']=_0xef21af[_0x275e('0xae')]['id'];}else{_0xa32637['id']=_0xef21af[_0x275e('0xae')]['id'];}var _0x5b3890={'raw':![],'where':_0xa32637},_0x41d747={};_0x41d747[_0x275e('0x37')]=_[_0x275e('0x39')](db[_0x275e('0x34')][_0x275e('0x35')]);_0x41d747['query']=_['keys'](_0xef21af[_0x275e('0x38')]);_0x41d747[_0x275e('0x3a')]=_[_0x275e('0x3c')](_0x41d747[_0x275e('0x37')],_0x41d747[_0x275e('0x38')]);_0x5b3890[_0x275e('0x3b')]=_[_0x275e('0x3c')](_0x41d747[_0x275e('0x37')],qs[_0x275e('0x3d')](_0xef21af['query'][_0x275e('0x3d')]));_0x5b3890[_0x275e('0x3b')]=_0x5b3890[_0x275e('0x3b')][_0x275e('0x3e')]?_0x5b3890[_0x275e('0x3b')]:_0x41d747['model'];if(_0xef21af[_0x275e('0x38')][_0x275e('0xaf')]){_0x5b3890[_0x275e('0xb0')]=[{'all':!![]}];}_0x5b3890=_[_0x275e('0x92')]({},_0x5b3890,_0xef21af[_0x275e('0xb1')]);return db['OpenchannelInteraction'][_0x275e('0x5a')](_0x5b3890)['then'](handleEntityNotFound(_0x2b0bca,null))[_0x275e('0x29')](respondWithResult(_0x2b0bca,null))[_0x275e('0x32')](handleError(_0x2b0bca,null));};exports[_0x275e('0xb2')]=function(_0x3e21d6,_0x2d1abd){return db['OpenchannelInteraction'][_0x275e('0xb2')](_0x3e21d6[_0x275e('0x6c')],{})['then'](respondWithResult(_0x2d1abd,0xc9))['catch'](handleError(_0x2d1abd,null));};exports[_0x275e('0x28')]=function(_0x376004,_0xf29df3){if(_0x376004[_0x275e('0x6c')]['id']){delete _0x376004[_0x275e('0x6c')]['id'];}return db['OpenchannelInteraction'][_0x275e('0x5a')]({'where':{'id':_0x376004[_0x275e('0xae')]['id']}})[_0x275e('0x29')](handleEntityNotFound(_0xf29df3,null))['then'](saveUpdates(_0x376004['body'],null))[_0x275e('0x29')](respondWithResult(_0xf29df3,null))[_0x275e('0x32')](handleError(_0xf29df3,null));};exports[_0x275e('0xb3')]=function(_0x3dc173,_0x37147e){return db['OpenchannelInteraction'][_0x275e('0x5a')]({'where':{'id':_0x3dc173[_0x275e('0xae')]['id']}})[_0x275e('0x29')](handleEntityNotFound(_0x37147e,null))[_0x275e('0x29')](removeEntity(_0x37147e,null))['catch'](handleError(_0x37147e,null));};exports[_0x275e('0xb4')]=function(_0x5a6393,_0x4dced9){return db[_0x275e('0x34')]['describe']()[_0x275e('0x29')](respondWithResult(_0x4dced9,null))[_0x275e('0x32')](handleError(_0x4dced9,null));};exports[_0x275e('0xb5')]=function(_0x127534,_0x168fe9,_0x2eca07){return db[_0x275e('0xb6')][_0x275e('0x5a')]({'where':{'id':_0x127534['params']['id']}})['then'](handleEntityNotFound(_0x168fe9,null))[_0x275e('0x29')](function(_0x2bcdaa){if(_0x2bcdaa){return _0x2bcdaa[_0x275e('0xb5')](_0x127534['body']['ids'],_['omit'](_0x127534[_0x275e('0x6c')],[_0x275e('0xb7'),'id'])||{});}})[_0x275e('0x29')](respondWithResult(_0x168fe9,null))[_0x275e('0x32')](handleError(_0x168fe9,null));};exports[_0x275e('0xb8')]=function(_0x49c2d8,_0x477b1a,_0xfed7b4){var _0xea2ff7={'raw':![],'where':{}};var _0x5ccc09={};var _0x1169ea={'count':0x0,'rows':[]};return db[_0x275e('0x34')][_0x275e('0xb9')]({'where':{'id':_0x49c2d8[_0x275e('0xae')]['id']}})[_0x275e('0x29')](handleEntityNotFound(_0x477b1a,null))['then'](function(_0x2f6303){if(_0x2f6303){_0x5ccc09[_0x275e('0x37')]=_[_0x275e('0x39')](db[_0x275e('0xb6')]['rawAttributes']);_0x5ccc09[_0x275e('0x38')]=_[_0x275e('0x39')](_0x49c2d8[_0x275e('0x38')]);_0x5ccc09[_0x275e('0x3a')]=_[_0x275e('0x3c')](_0x5ccc09[_0x275e('0x37')],_0x5ccc09['query']);_0xea2ff7[_0x275e('0x3b')]=_[_0x275e('0x3c')](_0x5ccc09[_0x275e('0x37')],qs[_0x275e('0x3d')](_0x49c2d8['query'][_0x275e('0x3d')]));_0xea2ff7[_0x275e('0x3b')]=_0xea2ff7[_0x275e('0x3b')][_0x275e('0x3e')]?_0xea2ff7[_0x275e('0x3b')]:_0x5ccc09[_0x275e('0x37')];if(!_0x49c2d8[_0x275e('0x38')]['hasOwnProperty'](_0x275e('0x40'))){_0xea2ff7['limit']=qs[_0x275e('0x21')](_0x49c2d8[_0x275e('0x38')]['limit']);_0xea2ff7[_0x275e('0x22')]=qs[_0x275e('0x22')](_0x49c2d8[_0x275e('0x38')][_0x275e('0x22')]);}_0xea2ff7[_0x275e('0x87')]=qs[_0x275e('0x41')](_0x49c2d8['query']['sort']);_0xea2ff7[_0x275e('0x70')]=qs[_0x275e('0x3a')](_[_0x275e('0x42')](_0x49c2d8[_0x275e('0x38')],_0x5ccc09[_0x275e('0x3a')]));_0xea2ff7[_0x275e('0x70')][_0x275e('0xa9')]=_0x2f6303['id'];if(_0x49c2d8[_0x275e('0x38')]['filter']){_0xea2ff7[_0x275e('0x70')]=_['merge'](_0xea2ff7[_0x275e('0x70')],{'$or':_[_0x275e('0x2c')](_0xea2ff7['attributes'],function(_0x209302){var _0x5450e7={};_0x5450e7[_0x209302]={'$like':'%'+_0x49c2d8[_0x275e('0x38')][_0x275e('0x7d')]+'%'};return _0x5450e7;})});}if(_0x49c2d8[_0x275e('0x38')]['$gte']){var _0x415ee7=_0x49c2d8['query'][_0x275e('0xba')]['split'](',');var _0x1ec765={};_0x1ec765[_0x415ee7[0x0]]={'$gte':moment(_0x415ee7[0x1])[_0x275e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0xea2ff7['where']=_[_0x275e('0x92')](_0xea2ff7[_0x275e('0x70')],_0x1ec765);}_0xea2ff7=_[_0x275e('0x92')]({},_0xea2ff7,_0x49c2d8['options']);return db['OpenchannelMessage'][_0x275e('0x23')]({'where':_0xea2ff7['where']})[_0x275e('0x29')](function(_0x340617){_0x1169ea[_0x275e('0x23')]=_0x340617;if(_0x49c2d8[_0x275e('0x38')][_0x275e('0xaf')]){_0xea2ff7[_0x275e('0xb0')]=[{'all':!![]}];}return db[_0x275e('0xb6')][_0x275e('0xbc')](_0xea2ff7);})['then'](function(_0x1b1f1c){_0x1169ea[_0x275e('0xac')]=_0x1b1f1c;return _0x1169ea;});}})[_0x275e('0x29')](respondWithFilteredResult(_0x477b1a,_0xea2ff7))['catch'](handleError(_0x477b1a,null));};exports[_0x275e('0xbd')]=function(_0x505afe,_0x3981bf,_0x180643){return db[_0x275e('0x34')][_0x275e('0x5a')]({'where':{'id':_0x505afe[_0x275e('0xae')]['id']}})['then'](handleEntityNotFound(_0x3981bf,null))['then'](function(_0x4bd6b3){if(_0x4bd6b3){return _0x4bd6b3['setTags'](_0x505afe[_0x275e('0x6c')][_0x275e('0xb7')],_[_0x275e('0xbe')](_0x505afe['body'],[_0x275e('0xb7'),'id'])||{})[_0x275e('0xbf')](function(){return db[_0x275e('0xc0')][_0x275e('0xbc')]({'attributes':['id',_0x275e('0x2a'),'color'],'where':{'id':_0x505afe['body'][_0x275e('0xb7')]}});})[_0x275e('0x29')](function(_0x4586a9){socket[_0x275e('0xc1')](_0x275e('0xc2'),{'id':Number(_0x505afe['params']['id']),'tags':_0x4586a9||[]});return{'id':Number(_0x505afe['params']['id']),'tags':_0x4586a9||[]};});}})[_0x275e('0x29')](respondWithResult(_0x3981bf,null))[_0x275e('0x32')](handleError(_0x3981bf,null));};exports['removeTags']=function(_0x4031af,_0xe20bc4,_0x2d7ea){return db['OpenchannelInteraction'][_0x275e('0x5a')]({'where':{'id':_0x4031af[_0x275e('0xae')]['id']}})['then'](handleEntityNotFound(_0xe20bc4,null))[_0x275e('0x29')](function(_0x400283){if(_0x400283){return _0x400283[_0x275e('0xc3')](_0x4031af[_0x275e('0x38')][_0x275e('0xb7')]);}})['then'](respondWithStatusCode(_0xe20bc4,null))[_0x275e('0x32')](handleError(_0xe20bc4,null));};exports[_0x275e('0xc4')]=function(_0x5b6585,_0x39f760){var _0x2e31f8=moment()[_0x275e('0xc5')]()[_0x275e('0xa7')]();var _0x1ffedc=path['join'](config[_0x275e('0xc6')],'server','files',_0x275e('0xc7'));var _0x3d0977=path[_0x275e('0xc8')](config['root'],_0x275e('0xc9'),_0x275e('0xca'),'attachments');var _0x301649=path[_0x275e('0xc8')](_0x1ffedc,_0x2e31f8);var _0x2fc812=util[_0x275e('0xbb')](_0x275e('0xcb'),_0x5b6585[_0x275e('0xae')]['id'],_0x2e31f8);var _0x1b203c=path[_0x275e('0xc8')](_0x1ffedc,_0x2fc812);var _0x4a2320=[];_0x4a2320[_0x275e('0xaa')]({'model':db[_0x275e('0x68')],'as':_0x275e('0x68'),'attributes':['id',_0x275e('0x2d')],'raw':!![]});_0x4a2320[_0x275e('0xaa')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x275e('0xcc'),_0x275e('0xcd')],'raw':!![]});if(_0x5b6585[_0x275e('0x38')]['attachments']){_0x4a2320['push']({'model':db[_0x275e('0xce')],'as':_0x275e('0xce'),'raw':!![]});}var _0x263bf0=[{'model':db[_0x275e('0xb6')],'as':'Messages','attributes':['id',_0x275e('0x6c'),_0x275e('0xcf'),_0x275e('0xd0'),_0x275e('0xd1'),'read'],'include':_0x4a2320}];_0x263bf0['push']({'model':db[_0x275e('0xd2')],'as':_0x275e('0xd3'),'attributes':['id',_0x275e('0x2a')]});_0x263bf0[_0x275e('0xaa')]({'model':db[_0x275e('0x68')],'as':_0x275e('0xd4'),'attributes':['id','fullname']});return db[_0x275e('0x34')]['find']({'where':{'id':_0x5b6585[_0x275e('0xae')]['id']},'include':_0x263bf0})[_0x275e('0x29')](handleEntityNotFound(_0x39f760,null))['then'](function(_0x2c4bbd){if(_0x2c4bbd){var _0x2f7c3e=_0x2c4bbd[_0x275e('0xd5')]({'plain':!![]});fs[_0x275e('0xd6')](_0x301649);var _0x16d790={'channel':_0x275e('0xd7'),'account':_0x2f7c3e[_0x275e('0xd3')][_0x275e('0x2a')],'agent':_0x2f7c3e[_0x275e('0xd4')]?_0x2f7c3e['Owner'][_0x275e('0x2d')]:'N.A.','createdAt':moment(_0x2f7c3e[_0x275e('0xcf')])[_0x275e('0xbb')](_0x275e('0xd8'))[_0x275e('0xa7')](),'closedAt':_0x2f7c3e[_0x275e('0xd9')]?moment(_0x2f7c3e[_0x275e('0xda')])[_0x275e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x275e('0xa7')]():'','disposition':_0x2f7c3e[_0x275e('0xdb')],'visibility':_0x2f7c3e[_0x275e('0xdc')]?_0x275e('0xdd'):_0x275e('0xde'),'messages':_(_0x2f7c3e[_0x275e('0xdf')])[_0x275e('0x7d')]({'secret':![]})['map'](function(_0x1eacdc){if(_0x1eacdc[_0x275e('0xce')]){var _0xda0f6d=path['join'](_0x3d0977,_0x1eacdc[_0x275e('0xce')][_0x275e('0xe0')]);if(fs[_0x275e('0xe1')](_0xda0f6d)){fs['createReadStream'](_0xda0f6d)['pipe'](fs[_0x275e('0xe2')](path[_0x275e('0xc8')](_0x301649,_0x1eacdc['Attachment'][_0x275e('0xe0')])));}}return{'date':moment(_0x1eacdc[_0x275e('0xcf')])[_0x275e('0xbb')](_0x275e('0xd8'))['toString'](),'sender':_0x1eacdc[_0x275e('0xd0')]===_0x275e('0xe3')?_0x1eacdc['User']?_0x1eacdc[_0x275e('0x68')][_0x275e('0x2d')]:'System':_0x1eacdc[_0x275e('0x60')][_0x275e('0xcc')]+(_0x1eacdc['Contact'][_0x275e('0xcd')]?'\x20'+_0x1eacdc['Contact'][_0x275e('0xcd')]:''),'body':_0x1eacdc[_0x275e('0xce')]?_0x1eacdc[_0x275e('0xce')][_0x275e('0xe0')]:_0x1eacdc[_0x275e('0x6c')],'direction':_0x1eacdc[_0x275e('0xd0')]===_0x275e('0xe3')?'A':'C','secret':_0x1eacdc[_0x275e('0xd1')],'read':_0x1eacdc[_0x275e('0x77')],'attachment':_0x1eacdc['Attachment']};})['value']()};return ejs[_0x275e('0xe4')](path[_0x275e('0xc8')](config['root'],'server',_0x275e('0xe5'),_0x275e('0xe6')),{'interaction':_0x16d790})[_0x275e('0x29')](function(_0x49bd0a){var _0x454f91=path[_0x275e('0xc8')](_0x301649,_0x275e('0xe7')+_0x2f7c3e['id']+'-'+_0x2e31f8+_0x275e('0xe8'));var _0x2c3212={'path':_0x454f91,'channel':'Openchannel','interactionId':_0x2f7c3e['id']};return pdf[_0x275e('0xe9')](_0x49bd0a,_0x2c3212);})[_0x275e('0x29')](function(){return new BPromise(function(_0x55f84b,_0x55533c){zipdir(_0x301649,{'saveTo':_0x1b203c},function(_0x301a31,_0x5c42ed){if(_0x301a31)return _0x55533c(_0x301a31);return _0x55f84b(_0x5c42ed);});})[_0x275e('0x29')](function(){return new BPromise(function(_0xcd5156,_0x3e701a){rimraf(_0x301649,function(_0x5896ec){if(_0x5896ec)_0x3e701a(_0x5896ec);return _0xcd5156();});});})[_0x275e('0x29')](function(){return _0x39f760[_0x275e('0xc4')](_0x1b203c,_0x2fc812,function(_0xc1f5a9){if(_0xc1f5a9){console['log'](_0x275e('0xea'),_0xc1f5a9);}else{fs[_0x275e('0xeb')](_0x1b203c);}});});});}else{return _0x39f760[_0x275e('0x1d')](0xc8);}})[_0x275e('0x32')](handleError(_0x39f760,null));}; \ No newline at end of file +var _0x549a=['ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./openchannelInteraction.socket','register','status','offset','limit','count','json','apply','reject','save','update','then','destroy','end','stack','name','send','Users','map','fullname','TagIds','forEach','push','catch','index','OpenchannelInteraction','fieldName','type','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','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','start','Tag','split','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','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','rawAttributes','includeAll','include','merge','options','create','describe','addMessage','ids','findOne','OpenchannelMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','firstName','Attachment','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','format','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','transcript-','log','err','unlinkSync','sendStatus','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x36cb2e,_0x17ecf5){var _0x2769d0=function(_0x278e58){while(--_0x278e58){_0x36cb2e['push'](_0x36cb2e['shift']());}};_0x2769d0(++_0x17ecf5);}(_0x549a,0x1c1));var _0xa549=function(_0x79c1e1,_0x9dfd45){_0x79c1e1=_0x79c1e1-0x0;var _0x2ed1d0=_0x549a[_0x79c1e1];return _0x2ed1d0;};'use strict';var emlformat=require(_0xa549('0x0'));var rimraf=require(_0xa549('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa549('0x2'));var moment=require(_0xa549('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa549('0x4'));var util=require(_0xa549('0x5'));var path=require('path');var sox=require(_0xa549('0x6'));var csv=require('to-csv');var ejs=require(_0xa549('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa549('0x8'));var crypto=require(_0xa549('0x9'));var jsforce=require(_0xa549('0xa'));var deskjs=require(_0xa549('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa549('0xc'));var Redis=require(_0xa549('0xd'));var authService=require(_0xa549('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa549('0xf'))('api');var utils=require(_0xa549('0x10'));var config=require(_0xa549('0x11'));var licenseUtil=require(_0xa549('0x12'));var db=require(_0xa549('0x13'))['db'];config[_0xa549('0x14')]=_['defaults'](config[_0xa549('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa549('0x15'))[_0xa549('0x16')](socket);function respondWithStatusCode(_0x17cba0,_0x10b1f7){_0x10b1f7=_0x10b1f7||0xcc;return function(_0x182d09){if(_0x182d09){return _0x17cba0['sendStatus'](_0x10b1f7);}return _0x17cba0[_0xa549('0x17')](_0x10b1f7)['end']();};}function respondWithResult(_0x35f863,_0x34b090){_0x34b090=_0x34b090||0xc8;return function(_0x5addd2){if(_0x5addd2){return _0x35f863[_0xa549('0x17')](_0x34b090)['json'](_0x5addd2);}};}function respondWithFilteredResult(_0x145866,_0x59a073){return function(_0x49d517){if(_0x49d517){var _0x2bfddd=typeof _0x59a073[_0xa549('0x18')]==='undefined'&&typeof _0x59a073[_0xa549('0x19')]==='undefined';var _0x4431cb=_0x49d517['count'];var _0x57ac78=_0x2bfddd?0x0:_0x59a073['offset'];var _0x50647b=_0x2bfddd?_0x49d517[_0xa549('0x1a')]:_0x59a073[_0xa549('0x18')]+_0x59a073[_0xa549('0x19')];var _0x59a384;if(_0x50647b>=_0x4431cb){_0x50647b=_0x4431cb;_0x59a384=0xc8;}else{_0x59a384=0xce;}_0x145866[_0xa549('0x17')](_0x59a384);return _0x145866['set']('Content-Range',_0x57ac78+'-'+_0x50647b+'/'+_0x4431cb)[_0xa549('0x1b')](_0x49d517);}return null;};}function patchUpdates(_0x270081){return function(_0x5e7a70){try{jsonpatch[_0xa549('0x1c')](_0x5e7a70,_0x270081,!![]);}catch(_0x3069d8){return BPromise[_0xa549('0x1d')](_0x3069d8);}return _0x5e7a70[_0xa549('0x1e')]();};}function saveUpdates(_0xebcc4c,_0x4e449e){return function(_0xd45e11){if(_0xd45e11){return _0xd45e11[_0xa549('0x1f')](_0xebcc4c)[_0xa549('0x20')](function(_0x383a53){return _0x383a53;});}return null;};}function removeEntity(_0x7464d6,_0xea1b51){return function(_0x25b3a1){if(_0x25b3a1){return _0x25b3a1[_0xa549('0x21')]()['then'](function(){_0x7464d6[_0xa549('0x17')](0xcc)[_0xa549('0x22')]();});}};}function handleEntityNotFound(_0x19711e,_0x41f788){return function(_0x1e02d6){if(!_0x1e02d6){_0x19711e['sendStatus'](0x194);}return _0x1e02d6;};}function handleError(_0x1ef686,_0x46d217){_0x46d217=_0x46d217||0x1f4;return function(_0x45004c){logger['error'](_0x45004c[_0xa549('0x23')]);if(_0x45004c[_0xa549('0x24')]){delete _0x45004c['name'];}_0x1ef686[_0xa549('0x17')](_0x46d217)[_0xa549('0x25')](_0x45004c);};}function getInteractionUsers(_0x571412,_0x38b645){return new BPromise(function(_0x34b363,_0x59bd72){try{if(_0x38b645[_0x571412['id']]){_0x571412[_0xa549('0x26')]=_[_0xa549('0x27')](_0x38b645[_0x571412['id']],function(_0x2226f8){return{'id':_0x2226f8['id'],'fullname':_0x2226f8[_0xa549('0x28')]};});}}catch(_0x139a30){_0x59bd72(_0x139a30);}_0x34b363(_0x571412);});}function getInteractionTags(_0x298ff4,_0x1e482a){return new BPromise(function(_0x249209,_0x22ee6c){try{if(_0x298ff4[_0xa549('0x29')]){_0x298ff4['Tags']=[];_0x298ff4[_0xa549('0x29')]['split'](',')[_0xa549('0x2a')](function(_0x45ef5e){_0x298ff4['Tags'][_0xa549('0x2b')](_0x1e482a[_0x45ef5e]);});}delete _0x298ff4[_0xa549('0x29')];}catch(_0x3bb317){_0x22ee6c(_0x3bb317);}_0x249209(_0x298ff4);});}function updateOpenchannelInteraction(_0x3cc83e,_0x419885,_0xfe14bf){return new BPromise(function(_0x49824e,_0x4c2dbc){return getInteractionUsers(_0x3cc83e,_0xfe14bf)[_0xa549('0x20')](function(_0x1dabbb){return getInteractionTags(_0x1dabbb,_0x419885);})[_0xa549('0x20')](function(_0x35a24d){_0x49824e(_0x35a24d);})[_0xa549('0x2c')](function(_0x53dff4){_0x4c2dbc(_0x53dff4);});});}exports[_0xa549('0x2d')]=function(_0x2ba5b1,_0x298b9d){var _0x2a94c4={},_0x544e88={},_0x40c4a0={'count':0x0,'rows':[]};var _0x5352b5=_[_0xa549('0x27')](db[_0xa549('0x2e')]['rawAttributes'],function(_0x1d374c){return{'name':_0x1d374c[_0xa549('0x2f')],'type':_0x1d374c[_0xa549('0x30')]['key']};});_0x544e88[_0xa549('0x31')]=_[_0xa549('0x27')](_0x5352b5,'name');_0x544e88['query']=_['keys'](_0x2ba5b1['query']);_0x544e88[_0xa549('0x32')]=_['intersection'](_0x544e88[_0xa549('0x31')],_0x544e88[_0xa549('0x33')]);_0x2a94c4[_0xa549('0x34')]=_[_0xa549('0x35')](_0x544e88[_0xa549('0x31')],qs['fields'](_0x2ba5b1[_0xa549('0x33')][_0xa549('0x36')]));_0x2a94c4[_0xa549('0x34')]=_0x2a94c4[_0xa549('0x34')][_0xa549('0x37')]?_0x2a94c4[_0xa549('0x34')]:_0x544e88[_0xa549('0x31')];if(!_0x2ba5b1['query'][_0xa549('0x38')](_0xa549('0x39'))){_0x2a94c4[_0xa549('0x19')]=qs[_0xa549('0x19')](_0x2ba5b1[_0xa549('0x33')][_0xa549('0x19')]);_0x2a94c4[_0xa549('0x18')]=qs[_0xa549('0x18')](_0x2ba5b1['query'][_0xa549('0x18')]);}_0x2a94c4['order']=qs[_0xa549('0x3a')](_0x2ba5b1[_0xa549('0x33')][_0xa549('0x3a')]);_0x2a94c4[_0xa549('0x3b')]=qs['filters'](_[_0xa549('0x3c')](_0x2ba5b1[_0xa549('0x33')],_0x544e88['filters']),_0x5352b5);var _0x1adf9c=[];var _0x2f0af7=squel[_0xa549('0x3d')]()[_0xa549('0x3e')]('id')[_0xa549('0x3e')](_0xa549('0x24'))['field'](_0xa549('0x3f'))[_0xa549('0x40')](_0xa549('0x41'));var _0x11d6e4=squel[_0xa549('0x3d')]()[_0xa549('0x3e')](_0xa549('0x42'))[_0xa549('0x3e')](_0xa549('0x43'))[_0xa549('0x3e')](_0xa549('0x44'))[_0xa549('0x40')](_0xa549('0x45'),'ui')[_0xa549('0x46')]('users','u',_0xa549('0x47'));var _0x3332ee=squel[_0xa549('0x3d')]()['from'](_0xa549('0x48'),'i')[_0xa549('0x46')]('cm_contacts','c',_0xa549('0x49'))[_0xa549('0x46')]('users','o',_0xa549('0x4a'))['left_join'](_0xa549('0x4b'),'a',_0xa549('0x4c'))[_0xa549('0x46')](_0xa549('0x4d'),'me',_0xa549('0x4e'))['left_join']('openchannel_interaction_has_tags','it',_0xa549('0x4f'))[_0xa549('0x46')](_0xa549('0x41'),'t',_0xa549('0x50'));var _0x24d491=squel['expr']();var _0x5af6f7=[];var _0x3836c5=squel[_0xa549('0x51')]();var _0x552e4a;if(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x52')]){_0x552e4a=as['parseSearch'](_0x2ba5b1[_0xa549('0x33')][_0xa549('0x52')]);var _0x1bcc1d=_0x552e4a[_0xa549('0x53')];for(var _0x56310a=0x0;_0x56310a<_0x552e4a[_0xa549('0x54')][_0xa549('0x37')];_0x56310a++){var _0x36bbe4=_0x552e4a[_0xa549('0x54')][_0x56310a];var _0x1459a3='i';var _0x4e1423=_[_0xa549('0x55')](_0x5352b5,[_0xa549('0x24'),_0x36bbe4[_0xa549('0x3e')]]);if(!_0x4e1423){switch(_0x36bbe4[_0xa549('0x3e')]){case _0xa549('0x56'):if(_0x36bbe4[_0xa549('0x57')]==0x1){_0x3332ee[_0xa549('0x58')]('`'+_0x36bbe4[_0xa549('0x3e')]+_0xa549('0x59'));}else{_0x3332ee['having']('`'+_0x36bbe4['field']+_0xa549('0x5a'));}break;case _0xa549('0x5b'):if(_0x36bbe4[_0xa549('0x5c')]===_0xa549('0x5d')){if(_0x36bbe4[_0xa549('0x57')]['split']('\x20')[_0xa549('0x37')]>0x1){_0x24d491[_0x1bcc1d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa549('0x5e')](_0x36bbe4[_0xa549('0x57')]),null);}else{var _0x5005aa='%'+_0x36bbe4[_0xa549('0x57')]+'%';_0x24d491[_0x1bcc1d](_0xa549('0x5f'),_0x5005aa,_0x5005aa,_0x5005aa);}}else{_0x4e1423=_['find'](_0x5352b5,[_0xa549('0x24'),_0xa549('0x60')]);_0x36bbe4['field']=_0xa549('0x60');_0x533aee=as[_0xa549('0x61')](_0x1459a3,_0x4e1423[_0xa549('0x30')],_0x36bbe4);_0x24d491[_0x1bcc1d](_0x533aee[_0xa549('0x62')],_0x533aee[_0xa549('0x57')][_0xa549('0x63')],_0x533aee[_0xa549('0x57')]['end']);}break;case _0xa549('0x64'):var _0x31b2a8=_0x36bbe4[_0xa549('0x57')][_0xa549('0x65')](',')[_0xa549('0x27')](function(_0x50fac5){return Number(_0x50fac5);});_0x31b2a8[_0xa549('0x2a')](function(_0x4bc685){_0x3836c5['or'](_0xa549('0x66'),'%,'+_0x4bc685+',%');});_0x5af6f7=_[_0xa549('0x67')](_0x5af6f7,_0x31b2a8);break;case _0xa549('0x68'):if(_0x36bbe4[_0xa549('0x5c')]===_0xa549('0x5d')){_0x24d491[_0x1bcc1d](_0xa549('0x69'),'%'+_0x36bbe4['value']+'%',null);}else{_0x4e1423=_[_0xa549('0x55')](_0x5352b5,[_0xa549('0x24'),_0xa549('0x6a')]);_0x36bbe4[_0xa549('0x3e')]='UserId';_0x533aee=as[_0xa549('0x61')](_0x1459a3,_0x4e1423[_0xa549('0x30')],_0x36bbe4);_0x24d491[_0x1bcc1d](_0x533aee['text'],_0x533aee[_0xa549('0x57')][_0xa549('0x63')],_0x533aee[_0xa549('0x57')][_0xa549('0x22')]);}break;case _0xa549('0x6b'):_0x533aee=as[_0xa549('0x61')]('me',null,_0x36bbe4);_0x24d491[_0x1bcc1d](_0x533aee[_0xa549('0x62')],_0x533aee[_0xa549('0x57')][_0xa549('0x63')],_0x533aee[_0xa549('0x57')]['end']);break;}}else{var _0x533aee=as[_0xa549('0x61')](_0x1459a3,_0x4e1423['type'],_0x36bbe4);_0x24d491[_0x1bcc1d](_0x533aee[_0xa549('0x62')],_0x533aee[_0xa549('0x57')][_0xa549('0x63')],_0x533aee[_0xa549('0x57')][_0xa549('0x22')]);}}}else{var _0xfa884=_(_0x2ba5b1[_0xa549('0x33')])[_0xa549('0x6c')]()[_0xa549('0x27')](function(_0x3837a1){return _[_0xa549('0x6d')](_0x5352b5,[_0xa549('0x24'),_0x3837a1])?_0x3837a1:undefined;})[_0xa549('0x6e')]()[_0xa549('0x57')]();if(!_[_0xa549('0x6f')](_0xfa884)){_0xfa884['forEach'](function(_0x2f3af4){if(_0x2f3af4===_0xa549('0x70')){_0x3332ee[_0xa549('0x3b')](_0xa549('0x71'),[][_0xa549('0x72')](_0x2ba5b1[_0xa549('0x33')][_0x2f3af4]));}else if(_0x2f3af4===_0xa549('0x73')){var _0x163216=JSON[_0xa549('0x74')](_0x2ba5b1[_0xa549('0x33')][_0x2f3af4])[_0xa549('0x75')];var _0x559eef=JSON[_0xa549('0x74')](_0x2ba5b1['query'][_0x2f3af4])[_0xa549('0x76')];_0x3332ee['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x163216,_0x559eef);}else{if(_0x2ba5b1[_0xa549('0x33')][_0x2f3af4]===_0xa549('0x77')){_0x3332ee['where']('i.'+_0x2f3af4+_0xa549('0x78'));}else{_0x3332ee['where']('i.'+_0x2f3af4+'\x20=\x20?',_0x2ba5b1[_0xa549('0x33')][_0x2f3af4]);}}});}if(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x79')]){if(_0x2ba5b1['query'][_0xa549('0x79')]==0x1){_0x3332ee[_0xa549('0x58')](_0xa549('0x7a'));}else{_0x3332ee[_0xa549('0x58')]('`unreadMessages`\x20>\x200');}}if(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x7b')]){_0x5af6f7=_[_0xa549('0x7c')](_0x2ba5b1[_0xa549('0x33')][_0xa549('0x7b')])?_0x2ba5b1[_0xa549('0x33')]['tag']:new Array(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x7b')]);_0x5af6f7[_0xa549('0x2a')](function(_0x7cefe9){_0x3836c5['or'](_0xa549('0x66'),'%,'+_0x7cefe9+',%');});}if(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x7d')]){var _0x111392=_0x2ba5b1['query'][_0xa549('0x7d')]['replace']('\x5c','\x5c\x5c')[_0xa549('0x7e')](/'/g,'\x27\x27');if(qs[_0xa549('0x7f')](_0x111392)){_0x24d491['or'](_0xa549('0x80'),_0x111392+'%');}else{_0x24d491['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x111392))['or'](_0xa549('0x81'),_0x111392+'%')['or'](_0xa549('0x82'),_0x111392+'%');}}}_0x3332ee[_0xa549('0x3b')](_0x24d491);_0x3332ee[_0xa549('0x83')](_0xa549('0x84'));var _0x807383={'type':db[_0xa549('0x85')][_0xa549('0x86')][_0xa549('0x87')],'raw':!![]};var _0x2ca4b1=_0x3332ee[_0xa549('0x88')]();_0x2ca4b1['field'](_0xa549('0x84'));_0x2ca4b1[_0xa549('0x3e')](_0xa549('0x89'),_0xa549('0x56'));if(_0x2a94c4['order']){_0x2a94c4[_0xa549('0x8a')][_0xa549('0x2a')](function(_0x43edab){var _0x35148b=_0x43edab[0x0]===_0xa549('0x8b')?_0x43edab[0x0]:'i.'+_0x43edab[0x0];_0x3332ee['order'](_0x35148b,_0x43edab[0x1]===_0xa549('0x8c')?![]:!![]);});}if(!_[_0xa549('0x6f')](_0x5af6f7)){_0x3332ee[_0xa549('0x58')](_0x3836c5);_0x2ca4b1['where']('t.id\x20IN\x20?',_0x5af6f7);}BPromise[_0xa549('0x8d')]()[_0xa549('0x20')](function(){if(!_0x552e4a){if(_0x2ba5b1[_0xa549('0x33')][_0xa549('0x70')])return;_0x2ca4b1[_0xa549('0x3b')](_0xa549('0x8e'));_0x3332ee[_0xa549('0x3b')](_0xa549('0x8e'));return;}if(_0x2ba5b1[_0xa549('0x8f')][_0xa549('0x90')]!==_0xa549('0x91'))return;return _0x2ba5b1[_0xa549('0x8f')][_0xa549('0x92')]({'attributes':['id'],'raw':!![]})[_0xa549('0x20')](function(_0x567319){if(_[_0xa549('0x6f')](_0x567319)){_0x2ca4b1['where'](_0xa549('0x93'));_0x3332ee['where'](_0xa549('0x93'));}else{_0x2ca4b1[_0xa549('0x3b')](_0xa549('0x71'),_[_0xa549('0x27')](_0x567319,'id'));_0x3332ee[_0xa549('0x3b')](_0xa549('0x71'),_['map'](_0x567319,'id'));}});})[_0xa549('0x20')](function(){if(_0x2ba5b1[_0xa549('0x8f')][_0xa549('0x90')]===_0xa549('0x91')&&!_0x552e4a&&!_0x2ba5b1[_0xa549('0x33')][_0xa549('0x70')])return[];return db['sequelize'][_0xa549('0x33')](_0x2ca4b1['toString'](),_0x807383);})[_0xa549('0x20')](function(_0x101703){_0x40c4a0[_0xa549('0x1a')]=_0x101703[_0xa549('0x37')];if(_0x40c4a0[_0xa549('0x1a')]===0x0)return[];return db[_0xa549('0x94')]['query'](_0x2f0af7[_0xa549('0x95')](),_0x807383)[_0xa549('0x20')](function(_0x36de29){_0x1adf9c=_['keyBy'](_0x36de29,'id');_0x807383=_['merge'](_0x807383,{'model':db[_0xa549('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ba5b1['query']['fields']){_0x2a94c4[_0xa549('0x34')][_0xa549('0x2a')](function(_0x5f5793){_0x3332ee[_0xa549('0x3e')]('i.'+_0x5f5793);});}else{_0x3332ee['field'](_0xa549('0x89'),_0xa549('0x56'));_0x3332ee[_0xa549('0x3e')](_0xa549('0x96'),'Account.key');_0x3332ee[_0xa549('0x3e')](_0xa549('0x97'),_0xa549('0x98'));_0x3332ee[_0xa549('0x3e')]('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',_0xa549('0x8b'));_0x3332ee[_0xa549('0x3e')](_0xa549('0x99'));_0x3332ee['field']('c.firstName',_0xa549('0x9a'));_0x3332ee['field'](_0xa549('0x9b'),_0xa549('0x9c'));_0x3332ee[_0xa549('0x3e')](_0xa549('0x9d'),_0xa549('0x9e'));_0x3332ee[_0xa549('0x3e')](_0xa549('0x9f'),'Contact.phone');_0x3332ee['field'](_0xa549('0xa0'),'Contact.mobile');_0x3332ee[_0xa549('0x3e')](_0xa549('0xa1'),'Contact.fax');_0x3332ee[_0xa549('0x3e')](_0xa549('0xa2'),_0xa549('0xa3'));_0x3332ee['field'](_0xa549('0xa4'),_0xa549('0xa5'));_0x3332ee['field'](_0xa549('0xa6'),_0xa549('0x29'));}if(_0x2a94c4[_0xa549('0x19')])_0x3332ee['limit'](_0x2a94c4[_0xa549('0x19')]);if(_0x2a94c4[_0xa549('0x18')])_0x3332ee['offset'](_0x2a94c4[_0xa549('0x18')]);return db['sequelize'][_0xa549('0x33')](_0x3332ee[_0xa549('0x95')](),_0x807383);})[_0xa549('0x20')](function(_0x3d2db9){if(_0x3d2db9['length']>0x0)_0x11d6e4[_0xa549('0x3b')](_0xa549('0xa7'),_['map'](_0x3d2db9,'id'));return db['sequelize'][_0xa549('0x33')](_0x11d6e4[_0xa549('0x95')](),_0x807383)[_0xa549('0x20')](function(_0x1a787b){var _0x54ab66=_[_0xa549('0xa8')](_0x1a787b,_0xa549('0xa9'));var _0x227ade=[];_0x3d2db9['forEach'](function(_0x228839){_0x227ade['push'](updateOpenchannelInteraction(_0x228839,_0x1adf9c,_0x54ab66));});return BPromise[_0xa549('0xaa')](_0x227ade);});});})[_0xa549('0x20')](function(_0xd3bfa3){_0x40c4a0[_0xa549('0xab')]=_0xd3bfa3;return _0x40c4a0;})['then'](respondWithFilteredResult(_0x298b9d,_0x2a94c4))[_0xa549('0x2c')](handleError(_0x298b9d,null));};exports[_0xa549('0xac')]=function(_0x11d1f5,_0x538715){var _0x301274={};if(_0x11d1f5[_0xa549('0x33')][_0xa549('0x30')]&&_0x11d1f5[_0xa549('0x33')]['type']==='from'){_0x301274['from']=_0x11d1f5[_0xa549('0xad')]['id'];}else{_0x301274['id']=_0x11d1f5['params']['id'];}var _0x5e90ff={'raw':![],'where':_0x301274},_0x1641ac={};_0x1641ac[_0xa549('0x31')]=_[_0xa549('0x6c')](db[_0xa549('0x2e')][_0xa549('0xae')]);_0x1641ac[_0xa549('0x33')]=_['keys'](_0x11d1f5[_0xa549('0x33')]);_0x1641ac[_0xa549('0x32')]=_[_0xa549('0x35')](_0x1641ac[_0xa549('0x31')],_0x1641ac[_0xa549('0x33')]);_0x5e90ff['attributes']=_[_0xa549('0x35')](_0x1641ac['model'],qs[_0xa549('0x36')](_0x11d1f5['query'][_0xa549('0x36')]));_0x5e90ff['attributes']=_0x5e90ff[_0xa549('0x34')]['length']?_0x5e90ff[_0xa549('0x34')]:_0x1641ac['model'];if(_0x11d1f5[_0xa549('0x33')][_0xa549('0xaf')]){_0x5e90ff[_0xa549('0xb0')]=[{'all':!![]}];}_0x5e90ff=_[_0xa549('0xb1')]({},_0x5e90ff,_0x11d1f5[_0xa549('0xb2')]);return db[_0xa549('0x2e')][_0xa549('0x55')](_0x5e90ff)['then'](handleEntityNotFound(_0x538715,null))[_0xa549('0x20')](respondWithResult(_0x538715,null))[_0xa549('0x2c')](handleError(_0x538715,null));};exports[_0xa549('0xb3')]=function(_0x2e8b7e,_0x20f270){return db[_0xa549('0x2e')][_0xa549('0xb3')](_0x2e8b7e['body'],{})['then'](respondWithResult(_0x20f270,0xc9))[_0xa549('0x2c')](handleError(_0x20f270,null));};exports[_0xa549('0x1f')]=function(_0x21824b,_0x1975a6){if(_0x21824b[_0xa549('0x6b')]['id']){delete _0x21824b[_0xa549('0x6b')]['id'];}return db[_0xa549('0x2e')]['find']({'where':{'id':_0x21824b[_0xa549('0xad')]['id']}})['then'](handleEntityNotFound(_0x1975a6,null))['then'](saveUpdates(_0x21824b[_0xa549('0x6b')],null))[_0xa549('0x20')](respondWithResult(_0x1975a6,null))['catch'](handleError(_0x1975a6,null));};exports['destroy']=function(_0x454798,_0x3aa872){return db[_0xa549('0x2e')]['find']({'where':{'id':_0x454798[_0xa549('0xad')]['id']}})[_0xa549('0x20')](handleEntityNotFound(_0x3aa872,null))[_0xa549('0x20')](removeEntity(_0x3aa872,null))['catch'](handleError(_0x3aa872,null));};exports[_0xa549('0xb4')]=function(_0x50e7bb,_0x46459d){return db[_0xa549('0x2e')]['describe']()[_0xa549('0x20')](respondWithResult(_0x46459d,null))['catch'](handleError(_0x46459d,null));};exports[_0xa549('0xb5')]=function(_0x50a2fd,_0x24341c,_0x3da4c9){return db['OpenchannelMessage'][_0xa549('0x55')]({'where':{'id':_0x50a2fd['params']['id']}})[_0xa549('0x20')](handleEntityNotFound(_0x24341c,null))[_0xa549('0x20')](function(_0x336172){if(_0x336172){return _0x336172['addMessage'](_0x50a2fd[_0xa549('0x6b')][_0xa549('0xb6')],_['omit'](_0x50a2fd[_0xa549('0x6b')],[_0xa549('0xb6'),'id'])||{});}})[_0xa549('0x20')](respondWithResult(_0x24341c,null))[_0xa549('0x2c')](handleError(_0x24341c,null));};exports['getMessages']=function(_0x5a1896,_0x5593c1,_0x2e562d){var _0x497814={'raw':![],'where':{}};var _0xbd1d69={};var _0x606534={'count':0x0,'rows':[]};return db[_0xa549('0x2e')][_0xa549('0xb7')]({'where':{'id':_0x5a1896[_0xa549('0xad')]['id']}})[_0xa549('0x20')](handleEntityNotFound(_0x5593c1,null))[_0xa549('0x20')](function(_0x2157b5){if(_0x2157b5){_0xbd1d69['model']=_[_0xa549('0x6c')](db[_0xa549('0xb8')]['rawAttributes']);_0xbd1d69[_0xa549('0x33')]=_[_0xa549('0x6c')](_0x5a1896[_0xa549('0x33')]);_0xbd1d69[_0xa549('0x32')]=_['intersection'](_0xbd1d69['model'],_0xbd1d69[_0xa549('0x33')]);_0x497814[_0xa549('0x34')]=_[_0xa549('0x35')](_0xbd1d69[_0xa549('0x31')],qs['fields'](_0x5a1896[_0xa549('0x33')][_0xa549('0x36')]));_0x497814['attributes']=_0x497814[_0xa549('0x34')][_0xa549('0x37')]?_0x497814['attributes']:_0xbd1d69[_0xa549('0x31')];if(!_0x5a1896[_0xa549('0x33')][_0xa549('0x38')](_0xa549('0x39'))){_0x497814[_0xa549('0x19')]=qs['limit'](_0x5a1896[_0xa549('0x33')][_0xa549('0x19')]);_0x497814['offset']=qs['offset'](_0x5a1896[_0xa549('0x33')][_0xa549('0x18')]);}_0x497814[_0xa549('0x8a')]=qs['sort'](_0x5a1896['query']['sort']);_0x497814[_0xa549('0x3b')]=qs[_0xa549('0x32')](_[_0xa549('0x3c')](_0x5a1896[_0xa549('0x33')],_0xbd1d69[_0xa549('0x32')]));_0x497814[_0xa549('0x3b')][_0xa549('0xa9')]=_0x2157b5['id'];if(_0x5a1896[_0xa549('0x33')][_0xa549('0x7d')]){_0x497814[_0xa549('0x3b')]=_[_0xa549('0xb1')](_0x497814[_0xa549('0x3b')],{'$or':_[_0xa549('0x27')](_0x497814[_0xa549('0x34')],function(_0x420d75){var _0x5397e4={};_0x5397e4[_0x420d75]={'$like':'%'+_0x5a1896[_0xa549('0x33')][_0xa549('0x7d')]+'%'};return _0x5397e4;})});}if(_0x5a1896[_0xa549('0x33')][_0xa549('0x75')]){var _0x42075f=_0x5a1896[_0xa549('0x33')][_0xa549('0x75')][_0xa549('0x65')](',');var _0x2b27ea={};_0x2b27ea[_0x42075f[0x0]]={'$gte':moment(_0x42075f[0x1])['format'](_0xa549('0xb9'))};_0x497814[_0xa549('0x3b')]=_[_0xa549('0xb1')](_0x497814[_0xa549('0x3b')],_0x2b27ea);}_0x497814=_[_0xa549('0xb1')]({},_0x497814,_0x5a1896[_0xa549('0xb2')]);return db[_0xa549('0xb8')][_0xa549('0x1a')]({'where':_0x497814[_0xa549('0x3b')]})[_0xa549('0x20')](function(_0x353913){_0x606534[_0xa549('0x1a')]=_0x353913;if(_0x5a1896['query'][_0xa549('0xaf')]){_0x497814[_0xa549('0xb0')]=[{'all':!![]}];}return db[_0xa549('0xb8')][_0xa549('0xba')](_0x497814);})[_0xa549('0x20')](function(_0x47dd03){_0x606534[_0xa549('0xab')]=_0x47dd03;return _0x606534;});}})[_0xa549('0x20')](respondWithFilteredResult(_0x5593c1,_0x497814))[_0xa549('0x2c')](handleError(_0x5593c1,null));};exports[_0xa549('0xbb')]=function(_0x56c77a,_0x1d11d4,_0x3f5807){return db[_0xa549('0x2e')][_0xa549('0x55')]({'where':{'id':_0x56c77a[_0xa549('0xad')]['id']}})[_0xa549('0x20')](handleEntityNotFound(_0x1d11d4,null))['then'](function(_0x954dd9){if(_0x954dd9){return _0x954dd9[_0xa549('0xbc')](_0x56c77a[_0xa549('0x6b')][_0xa549('0xb6')],_['omit'](_0x56c77a['body'],[_0xa549('0xb6'),'id'])||{})[_0xa549('0xbd')](function(){return db['Tag'][_0xa549('0xba')]({'attributes':['id',_0xa549('0x24'),_0xa549('0x3f')],'where':{'id':_0x56c77a[_0xa549('0x6b')][_0xa549('0xb6')]}});})[_0xa549('0x20')](function(_0x519fa0){socket[_0xa549('0xbe')]('openchannelInteractionTags:save',{'id':Number(_0x56c77a['params']['id']),'tags':_0x519fa0||[]});return{'id':Number(_0x56c77a['params']['id']),'tags':_0x519fa0||[]};});}})[_0xa549('0x20')](respondWithResult(_0x1d11d4,null))[_0xa549('0x2c')](handleError(_0x1d11d4,null));};exports[_0xa549('0xbf')]=function(_0x4b9509,_0x504346,_0x4479f8){return db[_0xa549('0x2e')][_0xa549('0x55')]({'where':{'id':_0x4b9509[_0xa549('0xad')]['id']}})[_0xa549('0x20')](handleEntityNotFound(_0x504346,null))[_0xa549('0x20')](function(_0x22fec4){if(_0x22fec4){return _0x22fec4[_0xa549('0xbf')](_0x4b9509[_0xa549('0x33')][_0xa549('0xb6')]);}})[_0xa549('0x20')](respondWithStatusCode(_0x504346,null))['catch'](handleError(_0x504346,null));};exports[_0xa549('0xc0')]=function(_0x15ede4,_0x5b1cf9){var _0xe1201c=moment()[_0xa549('0xc1')]()[_0xa549('0x95')]();var _0x952263=path['join'](config[_0xa549('0xc2')],_0xa549('0xc3'),_0xa549('0xc4'),_0xa549('0xc5'));var _0x32dd79=path[_0xa549('0xc6')](config[_0xa549('0xc2')],'server',_0xa549('0xc4'),'attachments');var _0x2a887a=path[_0xa549('0xc6')](_0x952263,_0xe1201c);var _0x6060d8=util['format'](_0xa549('0xc7'),_0x15ede4['params']['id'],_0xe1201c);var _0x1dc18d=path['join'](_0x952263,_0x6060d8);var _0x387af9=[];_0x387af9[_0xa549('0x2b')]({'model':db[_0xa549('0x68')],'as':'User','attributes':['id',_0xa549('0x28')],'raw':!![]});_0x387af9[_0xa549('0x2b')]({'model':db[_0xa549('0xc8')],'as':_0xa549('0x5b'),'attributes':['id',_0xa549('0xc9'),'lastName'],'raw':!![]});if(_0x15ede4[_0xa549('0x33')]['attachments']){_0x387af9[_0xa549('0x2b')]({'model':db[_0xa549('0xca')],'as':_0xa549('0xca'),'raw':!![]});}var _0x2e130a=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body','createdAt',_0xa549('0xcb'),_0xa549('0xcc'),_0xa549('0x79')],'include':_0x387af9}];_0x2e130a[_0xa549('0x2b')]({'model':db[_0xa549('0xcd')],'as':_0xa549('0xce'),'attributes':['id',_0xa549('0x24')]});_0x2e130a[_0xa549('0x2b')]({'model':db['User'],'as':'Owner','attributes':['id',_0xa549('0x28')]});return db[_0xa549('0x2e')]['find']({'where':{'id':_0x15ede4[_0xa549('0xad')]['id']},'include':_0x2e130a})['then'](handleEntityNotFound(_0x5b1cf9,null))['then'](function(_0x518d13){if(_0x518d13){var _0x1d1146=_0x518d13[_0xa549('0xcf')]({'plain':!![]});fs[_0xa549('0xd0')](_0x2a887a);var _0x15911b={'channel':_0xa549('0xd1'),'account':_0x1d1146[_0xa549('0xce')][_0xa549('0x24')],'agent':_0x1d1146['Owner']?_0x1d1146[_0xa549('0xd2')][_0xa549('0x28')]:_0xa549('0xd3'),'createdAt':moment(_0x1d1146[_0xa549('0x73')])[_0xa549('0xd4')](_0xa549('0xb9'))[_0xa549('0x95')](),'closedAt':_0x1d1146['closed']?moment(_0x1d1146[_0xa549('0xd5')])[_0xa549('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa549('0x95')]():'','disposition':_0x1d1146[_0xa549('0xd6')],'visibility':_0x1d1146[_0xa549('0xd7')]?'Public':_0xa549('0xd8'),'messages':_(_0x1d1146[_0xa549('0xd9')])[_0xa549('0x7d')]({'secret':![]})[_0xa549('0x27')](function(_0x3ff6b5){if(_0x3ff6b5[_0xa549('0xca')]){var _0xc29684=path[_0xa549('0xc6')](_0x32dd79,_0x3ff6b5[_0xa549('0xca')][_0xa549('0xda')]);if(fs[_0xa549('0xdb')](_0xc29684)){fs[_0xa549('0xdc')](_0xc29684)['pipe'](fs[_0xa549('0xdd')](path[_0xa549('0xc6')](_0x2a887a,_0x3ff6b5[_0xa549('0xca')][_0xa549('0xda')])));}}return{'date':moment(_0x3ff6b5[_0xa549('0x73')])['format'](_0xa549('0xb9'))[_0xa549('0x95')](),'sender':_0x3ff6b5['direction']===_0xa549('0xde')?_0x3ff6b5['User']?_0x3ff6b5[_0xa549('0x68')][_0xa549('0x28')]:'System':_0x3ff6b5['Contact'][_0xa549('0xc9')]+(_0x3ff6b5[_0xa549('0x5b')][_0xa549('0xdf')]?'\x20'+_0x3ff6b5[_0xa549('0x5b')]['lastName']:''),'body':_0x3ff6b5[_0xa549('0xca')]?_0x3ff6b5[_0xa549('0xca')][_0xa549('0xda')]:_0x3ff6b5[_0xa549('0x6b')],'direction':_0x3ff6b5[_0xa549('0xcb')]==='out'?'A':'C','secret':_0x3ff6b5[_0xa549('0xcc')],'read':_0x3ff6b5[_0xa549('0x79')],'attachment':_0x3ff6b5[_0xa549('0xca')]};})['value']()};return ejs[_0xa549('0xe0')](path[_0xa549('0xc6')](config[_0xa549('0xc2')],_0xa549('0xc3'),_0xa549('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x15911b})['then'](function(_0x572205){var _0x4242ae=path[_0xa549('0xc6')](_0x2a887a,_0xa549('0xe2')+_0x1d1146['id']+'-'+_0xe1201c+'.pdf');var _0x22f4d9={'path':_0x4242ae,'channel':_0xa549('0xd1'),'interactionId':_0x1d1146['id']};return pdf['createPdfFromHTML'](_0x572205,_0x22f4d9);})[_0xa549('0x20')](function(){return new BPromise(function(_0x5f52ae,_0x1b64ca){zipdir(_0x2a887a,{'saveTo':_0x1dc18d},function(_0x372df2,_0x1f72fe){if(_0x372df2)return _0x1b64ca(_0x372df2);return _0x5f52ae(_0x1f72fe);});})[_0xa549('0x20')](function(){return new BPromise(function(_0x948e54,_0x40b7d0){rimraf(_0x2a887a,function(_0x14efd4){if(_0x14efd4)_0x40b7d0(_0x14efd4);return _0x948e54();});});})['then'](function(){return _0x5b1cf9['download'](_0x1dc18d,_0x6060d8,function(_0x4e535c){if(_0x4e535c){console[_0xa549('0xe3')](_0xa549('0xe4'),_0x4e535c);}else{fs[_0xa549('0xe5')](_0x1dc18d);}});});});}else{return _0x5b1cf9[_0xa549('0xe6')](0xc8);}})[_0xa549('0x2c')](handleError(_0x5b1cf9,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 13b8e6b..b4d4c8e 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 _0xc848=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','Users'];(function(_0x2d5934,_0x1acc4f){var _0x5807c8=function(_0x326cc5){while(--_0x326cc5){_0x2d5934['push'](_0x2d5934['shift']());}};_0x5807c8(++_0x1acc4f);}(_0xc848,0xb3));var _0x8c84=function(_0x1b2dda,_0x54022d){_0x1b2dda=_0x1b2dda-0x0;var _0x4403e3=_0xc848[_0x1b2dda];return _0x4403e3;};'use strict';var EventEmitter=require(_0x8c84('0x0'));var OpenchannelInteraction=require(_0x8c84('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8c84('0x1'))['db'][_0x8c84('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8c84('0x3')](0x0);var events={'afterCreate':_0x8c84('0x4'),'afterUpdate':_0x8c84('0x5'),'afterDestroy':_0x8c84('0x6')};function emitEvent(_0x29abbc){return function(_0x85b4b4,_0x49e2e3,_0x41dc7a){_0x85b4b4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4686cd){_0x85b4b4['setDataValue'](_0x8c84('0x7'),_0x4686cd[_0x8c84('0x8')](function(_0x5e522a){return{'id':_0x5e522a['id']};}));return OpenchannelMessage[_0x8c84('0x9')]({'where':{'OpenchannelInteractionId':_0x85b4b4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x15e726){_0x85b4b4['setDataValue'](_0x8c84('0xa'),_0x15e726[_0x8c84('0xb')]);OpenchannelInteractionEvents[_0x8c84('0xc')](_0x29abbc+':'+_0x85b4b4['id'],_0x85b4b4);OpenchannelInteractionEvents[_0x8c84('0xc')](_0x29abbc,_0x85b4b4);_0x41dc7a(null);})[_0x8c84('0xd')](_0x41dc7a(null));};}for(var e in events){if(events[_0x8c84('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x8c84('0xf')](e,emitEvent(event));}}module[_0x8c84('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7531=['unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x6e76c2,_0x35c6fd){var _0x51c19a=function(_0x3297f8){while(--_0x3297f8){_0x6e76c2['push'](_0x6e76c2['shift']());}};_0x51c19a(++_0x35c6fd);}(_0x7531,0xea));var _0x1753=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7531[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x1753('0x0'))['db'][_0x1753('0x1')];var OpenchannelMessage=require(_0x1753('0x0'))['db'][_0x1753('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1753('0x3')](0x0);var events={'afterCreate':_0x1753('0x4'),'afterUpdate':_0x1753('0x5'),'afterDestroy':_0x1753('0x6')};function emitEvent(_0x11d397){return function(_0x318646,_0x33df90,_0xb27516){_0x318646[_0x1753('0x7')]({'attributes':['id'],'raw':!![]})[_0x1753('0x8')](function(_0x5ce872){_0x318646[_0x1753('0x9')](_0x1753('0xa'),_0x5ce872[_0x1753('0xb')](function(_0x412152){return{'id':_0x412152['id']};}));return OpenchannelMessage[_0x1753('0xc')]({'where':{'OpenchannelInteractionId':_0x318646['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2ea4e2){_0x318646[_0x1753('0x9')](_0x1753('0xd'),_0x2ea4e2[_0x1753('0xe')]);OpenchannelInteractionEvents[_0x1753('0xf')](_0x11d397+':'+_0x318646['id'],_0x318646);OpenchannelInteractionEvents['emit'](_0x11d397,_0x318646);_0xb27516(null);})['catch'](_0xb27516(null));};}for(var e in events){if(events[_0x1753('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x1753('0x11')](e,emitEvent(event));}}module[_0x1753('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5304398..02d3759 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 _0xc164=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x305980,_0x54b8de){var _0x179230=function(_0x314288){while(--_0x314288){_0x305980['push'](_0x305980['shift']());}};_0x179230(++_0x54b8de);}(_0xc164,0x18e));var _0x4c16=function(_0x592080,_0x518f15){_0x592080=_0x592080-0x0;var _0x3a86fb=_0xc164[_0x592080];return _0x3a86fb;};'use strict';var _=require('lodash');var util=require(_0x4c16('0x0'));var logger=require(_0x4c16('0x1'))(_0x4c16('0x2'));var moment=require(_0x4c16('0x3'));var BPromise=require(_0x4c16('0x4'));var rp=require(_0x4c16('0x5'));var fs=require('fs');var path=require(_0x4c16('0x6'));var rimraf=require(_0x4c16('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c16('0x8'));module[_0x4c16('0x9')]=function(_0x37810f,_0x45bcd5){return _0x37810f[_0x4c16('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x4c16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c16('0xc'),'collate':_0x4c16('0xd'),'hooks':{'beforeUpdate':function(_0x1fa2aa,_0x51ec36,_0x3ed462){if(_0x1fa2aa[_0x4c16('0xe')](_0x4c16('0xf'))){_0x1fa2aa[_0x4c16('0x10')]=moment()[_0x4c16('0x11')](_0x4c16('0x12'));}_0x3ed462(null,_0x1fa2aa);}}});}; \ No newline at end of file +var _0x8e7c=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23a7d2,_0x1f5d70){var _0x36020f=function(_0x2d07e6){while(--_0x2d07e6){_0x23a7d2['push'](_0x23a7d2['shift']());}};_0x36020f(++_0x1f5d70);}(_0x8e7c,0x90));var _0xc8e7=function(_0x1235d2,_0x404d33){_0x1235d2=_0x1235d2-0x0;var _0x5b0fdd=_0x8e7c[_0x1235d2];return _0x5b0fdd;};'use strict';var _=require(_0xc8e7('0x0'));var util=require(_0xc8e7('0x1'));var logger=require(_0xc8e7('0x2'))(_0xc8e7('0x3'));var moment=require(_0xc8e7('0x4'));var BPromise=require(_0xc8e7('0x5'));var rp=require(_0xc8e7('0x6'));var fs=require('fs');var path=require(_0xc8e7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8e7('0x8'));var attributes=require(_0xc8e7('0x9'));module[_0xc8e7('0xa')]=function(_0xd50521,_0x497ee6){return _0xd50521[_0xc8e7('0xb')](_0xc8e7('0xc'),attributes,{'tableName':_0xc8e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8e7('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x138231,_0x77e25b,_0x428989){if(_0x138231['changed'](_0xc8e7('0xf'))){_0x138231[_0xc8e7('0x10')]=moment()[_0xc8e7('0x11')](_0xc8e7('0x12'));}_0x428989(null,_0x138231);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 05e802a..e098786 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 _0x4540=['defaults','localhost','request','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_0x4540,0xde));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0454('0x0'));var moment=require(_0x0454('0x1'));var BPromise=require(_0x0454('0x2'));var rs=require(_0x0454('0x3'));var fs=require('fs');var Redis=require(_0x0454('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0454('0x5'));var logger=require(_0x0454('0x6'))(_0x0454('0x7'));var config=require(_0x0454('0x8'));var jayson=require(_0x0454('0x9'));var client=jayson[_0x0454('0xa')]['http']({'port':0x232a});config[_0x0454('0xb')]=_[_0x0454('0xc')](config[_0x0454('0xb')],{'host':_0x0454('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x45b2e2,_0x3a9c1c,_0x2fb9d9){return new BPromise(function(_0x3040ba,_0x41b72d){return client[_0x0454('0xe')](_0x45b2e2,_0x2fb9d9)['then'](function(_0x32e2af){logger[_0x0454('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a9c1c,'request\x20sent');logger[_0x0454('0x10')](_0x0454('0x11'),_0x3a9c1c,'request\x20sent',JSON[_0x0454('0x12')](_0x32e2af));if(_0x32e2af[_0x0454('0x13')]){if(_0x32e2af[_0x0454('0x13')][_0x0454('0x14')]===0x1f4){logger[_0x0454('0x13')](_0x0454('0x15'),_0x3a9c1c,_0x32e2af['error'][_0x0454('0x16')]);return _0x41b72d(_0x32e2af['error'][_0x0454('0x16')]);}logger[_0x0454('0x13')](_0x0454('0x15'),_0x3a9c1c,_0x32e2af[_0x0454('0x13')][_0x0454('0x16')]);return _0x3040ba(_0x32e2af[_0x0454('0x13')][_0x0454('0x16')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a9c1c,_0x0454('0x17'));_0x3040ba(_0x32e2af[_0x0454('0x18')][_0x0454('0x16')]);}})[_0x0454('0x19')](function(_0x538371){logger[_0x0454('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a9c1c,_0x538371);_0x41b72d(_0x538371);});});}exports['UpdateOpenchannelInteraction']=function(_0x3d7cf8){var _0x247a9d=this;return new Promise(function(_0x1bdcbf,_0x27df68){return db[_0x0454('0x1a')]['update'](_0x3d7cf8[_0x0454('0x1b')],{'raw':_0x3d7cf8[_0x0454('0x1c')]?_0x3d7cf8['options'][_0x0454('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7cf8[_0x0454('0x1c')]?_0x3d7cf8[_0x0454('0x1c')][_0x0454('0x1e')]||null:null,'attributes':_0x3d7cf8[_0x0454('0x1c')]?_0x3d7cf8[_0x0454('0x1c')][_0x0454('0x1f')]||null:null,'limit':_0x3d7cf8[_0x0454('0x1c')]?_0x3d7cf8[_0x0454('0x1c')]['limit']||null:null})[_0x0454('0x20')](function(_0x36e185){logger[_0x0454('0xf')]('UpdateOpenchannelInteraction',_0x3d7cf8);logger['debug'](_0x0454('0x21'),_0x3d7cf8,JSON[_0x0454('0x12')](_0x36e185));_0x1bdcbf(_0x36e185);})[_0x0454('0x19')](function(_0x5ef007){logger['error'](_0x0454('0x21'),_0x5ef007[_0x0454('0x16')],_0x3d7cf8);_0x27df68(_0x247a9d[_0x0454('0x13')](0x1f4,_0x5ef007[_0x0454('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x530aec){return new Promise(function(_0x20ca5f,_0x54606b){return db[_0x0454('0x1a')]['find']({'where':_0x530aec[_0x0454('0x1c')]?_0x530aec[_0x0454('0x1c')][_0x0454('0x1e')]||null:null})[_0x0454('0x20')](function(_0x1ad8e8){if(_0x1ad8e8){return _0x1ad8e8[_0x0454('0x22')](_0x530aec[_0x0454('0x1b')][_0x0454('0x23')],_[_0x0454('0x24')](_0x530aec[_0x0454('0x1b')],[_0x0454('0x23'),'id'])||{});}})[_0x0454('0x25')](function(_0x586801){logger['info'](_0x0454('0x26'),_0x530aec);logger[_0x0454('0x10')](_0x0454('0x26'),_0x530aec,JSON['stringify'](_0x586801));_0x20ca5f(_0x586801);})[_0x0454('0x19')](function(_0x5918ce){logger['error']('AddTags',_0x5918ce[_0x0454('0x16')],_0x530aec);_0x54606b(_this[_0x0454('0x13')](0x1f4,_0x5918ce[_0x0454('0x16')]));});});}; \ No newline at end of file +var _0x9600=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','find','addTags','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4692d2,_0x3a396b){var _0x341a51=function(_0x136724){while(--_0x136724){_0x4692d2['push'](_0x4692d2['shift']());}};_0x341a51(++_0x3a396b);}(_0x9600,0xea));var _0x0960=function(_0x5310b2,_0x8658a1){_0x5310b2=_0x5310b2-0x0;var _0x1cbe58=_0x9600[_0x5310b2];return _0x1cbe58;};'use strict';var _=require(_0x0960('0x0'));var util=require('util');var moment=require(_0x0960('0x1'));var BPromise=require('bluebird');var rs=require(_0x0960('0x2'));var fs=require('fs');var Redis=require(_0x0960('0x3'));var db=require(_0x0960('0x4'))['db'];var utils=require(_0x0960('0x5'));var logger=require('../../config/logger')(_0x0960('0x6'));var config=require(_0x0960('0x7'));var jayson=require(_0x0960('0x8'));var client=jayson[_0x0960('0x9')][_0x0960('0xa')]({'port':0x232a});config[_0x0960('0xb')]=_[_0x0960('0xc')](config[_0x0960('0xb')],{'host':_0x0960('0xd'),'port':0x18eb});var socket=require(_0x0960('0xe'))(new Redis(config[_0x0960('0xb')]));require(_0x0960('0xf'))[_0x0960('0x10')](socket);function respondWithRpcPromise(_0x481167,_0xbccd66,_0x31a1d1){return new BPromise(function(_0xa557b9,_0x464501){return client['request'](_0x481167,_0x31a1d1)[_0x0960('0x11')](function(_0x58a83e){logger[_0x0960('0x12')](_0x0960('0x13'),_0xbccd66,'request\x20sent');logger[_0x0960('0x14')](_0x0960('0x15'),_0xbccd66,_0x0960('0x16'),JSON[_0x0960('0x17')](_0x58a83e));if(_0x58a83e[_0x0960('0x18')]){if(_0x58a83e[_0x0960('0x18')][_0x0960('0x19')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xbccd66,_0x58a83e[_0x0960('0x18')]['message']);return _0x464501(_0x58a83e['error'][_0x0960('0x1a')]);}logger[_0x0960('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0xbccd66,_0x58a83e[_0x0960('0x18')]['message']);return _0xa557b9(_0x58a83e[_0x0960('0x18')][_0x0960('0x1a')]);}else{logger[_0x0960('0x12')](_0x0960('0x13'),_0xbccd66,_0x0960('0x16'));_0xa557b9(_0x58a83e['result']['message']);}})[_0x0960('0x1b')](function(_0x3dc699){logger[_0x0960('0x18')](_0x0960('0x13'),_0xbccd66,_0x3dc699);_0x464501(_0x3dc699);});});}exports[_0x0960('0x1c')]=function(_0x123bd7){var _0x34bfbb=this;return new Promise(function(_0x42232e,_0x76f312){return db['OpenchannelInteraction'][_0x0960('0x1d')](_0x123bd7[_0x0960('0x1e')],{'raw':_0x123bd7[_0x0960('0x1f')]?_0x123bd7['options'][_0x0960('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x123bd7[_0x0960('0x1f')]?_0x123bd7[_0x0960('0x1f')][_0x0960('0x21')]||null:null,'attributes':_0x123bd7['options']?_0x123bd7['options'][_0x0960('0x22')]||null:null,'limit':_0x123bd7[_0x0960('0x1f')]?_0x123bd7['options'][_0x0960('0x23')]||null:null})['then'](function(_0x2590a1){logger[_0x0960('0x12')](_0x0960('0x1c'),_0x123bd7);logger['debug'](_0x0960('0x1c'),_0x123bd7,JSON[_0x0960('0x17')](_0x2590a1));_0x42232e(_0x2590a1);})['catch'](function(_0x59bc0e){logger[_0x0960('0x18')]('UpdateOpenchannelInteraction',_0x59bc0e[_0x0960('0x1a')],_0x123bd7);_0x76f312(_0x34bfbb[_0x0960('0x18')](0x1f4,_0x59bc0e[_0x0960('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x136b95){return new Promise(function(_0x4e8be0,_0x4ea667){return db['OpenchannelInteraction'][_0x0960('0x24')]({'where':_0x136b95[_0x0960('0x1f')]?_0x136b95[_0x0960('0x1f')][_0x0960('0x21')]||null:null})[_0x0960('0x11')](function(_0x2cdcf0){if(_0x2cdcf0){return _0x2cdcf0[_0x0960('0x25')](_0x136b95['body']['ids'],_[_0x0960('0x26')](_0x136b95[_0x0960('0x1e')],['ids','id'])||{});}})['spread'](function(_0x3e0fca){logger[_0x0960('0x12')](_0x0960('0x27'),_0x136b95);logger[_0x0960('0x14')]('AddTags',_0x136b95,JSON[_0x0960('0x17')](_0x3e0fca));_0x4e8be0(_0x3e0fca);})[_0x0960('0x1b')](function(_0x185df3){logger[_0x0960('0x18')](_0x0960('0x27'),_0x185df3[_0x0960('0x1a')],_0x136b95);_0x4ea667(_this[_0x0960('0x18')](0x1f4,_0x185df3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 1e72ba5..9f154e8 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 _0x9c6c=['openchannelInteraction:','save','remove','update','emit','removeListener','length'];(function(_0x4e6336,_0x3949dd){var _0x4d57a6=function(_0x444342){while(--_0x444342){_0x4e6336['push'](_0x4e6336['shift']());}};_0x4d57a6(++_0x3949dd);}(_0x9c6c,0x17b));var _0xc9c6=function(_0x29ea9b,_0x3b62bc){_0x29ea9b=_0x29ea9b-0x0;var _0x36ea91=_0x9c6c[_0x29ea9b];return _0x36ea91;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xc9c6('0x0'),_0xc9c6('0x1'),_0xc9c6('0x2')];function createListener(_0x37334d,_0x310c00){return function(_0x4555cc){_0x310c00[_0xc9c6('0x3')](_0x37334d,_0x4555cc);};}function removeListener(_0x5768cf,_0x225bfa){return function(){OpenchannelInteractionEvents[_0xc9c6('0x4')](_0x5768cf,_0x225bfa);};}exports['register']=function(_0x289e4d){for(var _0x654f01=0x0,_0x415895=events[_0xc9c6('0x5')];_0x654f01<_0x415895;_0x654f01++){var _0x4246fb=events[_0x654f01];var _0x53ffa1=createListener(_0xc9c6('0x6')+_0x4246fb,_0x289e4d);OpenchannelInteractionEvents['on'](_0x4246fb,_0x53ffa1);}}; \ No newline at end of file +var _0x12bc=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x1fbeaf,_0x256fbd){var _0x13daa3=function(_0x295348){while(--_0x295348){_0x1fbeaf['push'](_0x1fbeaf['shift']());}};_0x13daa3(++_0x256fbd);}(_0x12bc,0x1ea));var _0xc12b=function(_0x5541f3,_0x266df7){_0x5541f3=_0x5541f3-0x0;var _0xe30f20=_0x12bc[_0x5541f3];return _0xe30f20;};'use strict';var OpenchannelInteractionEvents=require(_0xc12b('0x0'));var events=[_0xc12b('0x1'),_0xc12b('0x2'),_0xc12b('0x3')];function createListener(_0xce22a8,_0x16de9e){return function(_0x48fcde){_0x16de9e[_0xc12b('0x4')](_0xce22a8,_0x48fcde);};}function removeListener(_0x35d7e0,_0x4da85){return function(){OpenchannelInteractionEvents[_0xc12b('0x5')](_0x35d7e0,_0x4da85);};}exports[_0xc12b('0x6')]=function(_0x4f4a54){for(var _0x3bdcd1=0x0,_0x14a9f6=events[_0xc12b('0x7')];_0x3bdcd1<_0x14a9f6;_0x3bdcd1++){var _0x538b31=events[_0x3bdcd1];var _0x351a81=createListener(_0xc12b('0x8')+_0x538b31,_0x4f4a54);OpenchannelInteractionEvents['on'](_0x538b31,_0x351a81);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 55ff212..3b95f14 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2bf9ae,_0x270fda){var _0x23c251=function(_0x3be086){while(--_0x3be086){_0x2bf9ae['push'](_0x2bf9ae['shift']());}};_0x23c251(++_0x270fda);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x39443c,_0x25bf1f){var _0x39a016=function(_0x352fc3){while(--_0x352fc3){_0x39443c['push'](_0x39443c['shift']());}};_0x39a016(++_0x25bf1f);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 7f37e94..5fe7268 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 _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x872c5e,_0x3171fd){var _0x6484c1=function(_0x4e65c5){while(--_0x4e65c5){_0x872c5e['push'](_0x872c5e['shift']());}};_0x6484c1(++_0x3171fd);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x5aedbc,_0x41eab8){_0x5aedbc=_0x5aedbc-0x0;var _0xc9a701=_0xd0e4[_0x5aedbc];return _0xc9a701;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3ee7=['ENUM','out','DATE','STRING','TEXT','exports','BOOLEAN'];(function(_0x11a577,_0xcfd0be){var _0xe48c08=function(_0x5bebc7){while(--_0x5bebc7){_0x11a577['push'](_0x11a577['shift']());}};_0xe48c08(++_0xcfd0be);}(_0x3ee7,0x98));var _0x73ee=function(_0x32d456,_0x44b805){_0x32d456=_0x32d456-0x0;var _0x34f70d=_0x3ee7[_0x32d456];return _0x34f70d;};'use strict';var Sequelize=require('sequelize');module[_0x73ee('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x73ee('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x73ee('0x2')]('in',_0x73ee('0x3')),'defaultValue':_0x73ee('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x73ee('0x4')]},'providerName':{'type':Sequelize[_0x73ee('0x5')]},'providerResponse':{'type':Sequelize[_0x73ee('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index db1f80f..2f6e0bb 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 _0x6066=['length','hasOwnProperty','sort','filters','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','destroy','describe','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','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','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields'];(function(_0x209497,_0x10a31a){var _0x1879db=function(_0x16b2f9){while(--_0x16b2f9){_0x209497['push'](_0x209497['shift']());}};_0x1879db(++_0x10a31a);}(_0x6066,0x1c6));var _0x6606=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x6066[_0x4cf0b7];return _0x545f10;};'use strict';var emlformat=require(_0x6606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6606('0x1'));var jsonpatch=require(_0x6606('0x2'));var rp=require(_0x6606('0x3'));var moment=require(_0x6606('0x4'));var BPromise=require(_0x6606('0x5'));var Mustache=require(_0x6606('0x6'));var util=require(_0x6606('0x7'));var path=require(_0x6606('0x8'));var sox=require(_0x6606('0x9'));var csv=require(_0x6606('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6606('0xb'));var _=require(_0x6606('0xc'));var squel=require(_0x6606('0xd'));var crypto=require(_0x6606('0xe'));var jsforce=require(_0x6606('0xf'));var deskjs=require(_0x6606('0x10'));var toCsv=require(_0x6606('0xa'));var querystring=require(_0x6606('0x11'));var Papa=require(_0x6606('0x12'));var Redis=require('ioredis');var authService=require(_0x6606('0x13'));var qs=require(_0x6606('0x14'));var as=require(_0x6606('0x15'));var hardwareService=require(_0x6606('0x16'));var logger=require(_0x6606('0x17'))(_0x6606('0x18'));var utils=require(_0x6606('0x19'));var config=require(_0x6606('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6606('0x1b')]=_[_0x6606('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6606('0x1d'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x6606('0x1e')](socket);var jayson=require(_0x6606('0x1f'));var client=jayson[_0x6606('0x20')][_0x6606('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x6606('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x55f825,_0x3dcf03,_0x39c571,_0x58de81){return new BPromise(function(_0x8db8f4,_0x138888){var _0x198414=_0x58de81||client;return _0x198414['request'](_0x55f825,_0x39c571)[_0x6606('0x22')](function(_0x14e012){logger[_0x6606('0x23')](_0x6606('0x24'),_0x3dcf03,_0x6606('0x25'));logger[_0x6606('0x26')](_0x6606('0x27'),_0x3dcf03,_0x6606('0x25'),JSON[_0x6606('0x28')](_0x14e012));if(_0x14e012[_0x6606('0x29')]){if(_0x14e012['error'][_0x6606('0x2a')]===0x1f4){logger[_0x6606('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x3dcf03,_0x14e012[_0x6606('0x29')][_0x6606('0x2b')]);return _0x138888(_0x14e012[_0x6606('0x29')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3dcf03,_0x14e012[_0x6606('0x29')][_0x6606('0x2b')]);return _0x8db8f4(_0x14e012[_0x6606('0x29')][_0x6606('0x2b')]);}else{logger[_0x6606('0x23')](_0x6606('0x24'),_0x3dcf03,'request\x20sent');_0x8db8f4(_0x14e012['result'][_0x6606('0x2b')]);}})[_0x6606('0x2c')](function(_0x306f4c){logger[_0x6606('0x29')](_0x6606('0x24'),_0x3dcf03,_0x306f4c);_0x138888(_0x306f4c);});});}function respondWithStatusCode(_0x2c151e,_0x508a70){_0x508a70=_0x508a70||0xcc;return function(_0x1dc9e5){if(_0x1dc9e5){return _0x2c151e['sendStatus'](_0x508a70);}return _0x2c151e[_0x6606('0x2d')](_0x508a70)['end']();};}function respondWithResult(_0x807257,_0x3eaf5a){_0x3eaf5a=_0x3eaf5a||0xc8;return function(_0x210353){if(_0x210353){return _0x807257['status'](_0x3eaf5a)[_0x6606('0x2e')](_0x210353);}};}function respondWithFilteredResult(_0x31ef48,_0x4d8674){return function(_0x38133c){if(_0x38133c){var _0x22b6e9=typeof _0x4d8674[_0x6606('0x2f')]===_0x6606('0x30')&&typeof _0x4d8674['limit']===_0x6606('0x30');var _0x46deca=_0x38133c[_0x6606('0x31')];var _0x39780e=_0x22b6e9?0x0:_0x4d8674[_0x6606('0x2f')];var _0x46f943=_0x22b6e9?_0x38133c[_0x6606('0x31')]:_0x4d8674[_0x6606('0x2f')]+_0x4d8674[_0x6606('0x32')];var _0x119499;if(_0x46f943>=_0x46deca){_0x46f943=_0x46deca;_0x119499=0xc8;}else{_0x119499=0xce;}_0x31ef48['status'](_0x119499);return _0x31ef48[_0x6606('0x33')](_0x6606('0x34'),_0x39780e+'-'+_0x46f943+'/'+_0x46deca)[_0x6606('0x2e')](_0x38133c);}return null;};}function patchUpdates(_0x9fd3da){return function(_0x348676){try{jsonpatch['apply'](_0x348676,_0x9fd3da,!![]);}catch(_0x368cf6){return BPromise[_0x6606('0x35')](_0x368cf6);}return _0x348676[_0x6606('0x36')]();};}function saveUpdates(_0x1f1065,_0x3c0ecf){return function(_0x148f14){if(_0x148f14){return _0x148f14[_0x6606('0x37')](_0x1f1065)[_0x6606('0x22')](function(_0x52cc51){return _0x52cc51;});}return null;};}function removeEntity(_0x133bf0,_0x5f1b4b){return function(_0x4fcd83){if(_0x4fcd83){return _0x4fcd83['destroy']()[_0x6606('0x22')](function(){_0x133bf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e732,_0x24658a){return function(_0x51cd17){if(!_0x51cd17){_0x29e732['sendStatus'](0x194);}return _0x51cd17;};}function handleError(_0x213c91,_0x3cab1d){_0x3cab1d=_0x3cab1d||0x1f4;return function(_0x31dd20){logger[_0x6606('0x29')](_0x31dd20[_0x6606('0x38')]);if(_0x31dd20[_0x6606('0x39')]){delete _0x31dd20['name'];}_0x213c91['status'](_0x3cab1d)['send'](_0x31dd20);};}exports[_0x6606('0x3a')]=function(_0x335239,_0x4d5e98){var _0x5dbe1e={},_0x1d3e98={},_0x494515={'count':0x0,'rows':[]};var _0x115e16=_['map'](db[_0x6606('0x3b')][_0x6606('0x3c')],function(_0x4d187a){return{'name':_0x4d187a[_0x6606('0x3d')],'type':_0x4d187a[_0x6606('0x3e')][_0x6606('0x3f')]};});_0x1d3e98[_0x6606('0x40')]=_['map'](_0x115e16,_0x6606('0x39'));_0x1d3e98['query']=_[_0x6606('0x41')](_0x335239[_0x6606('0x42')]);_0x1d3e98['filters']=_[_0x6606('0x43')](_0x1d3e98[_0x6606('0x40')],_0x1d3e98[_0x6606('0x42')]);_0x5dbe1e[_0x6606('0x44')]=_[_0x6606('0x43')](_0x1d3e98[_0x6606('0x40')],qs['fields'](_0x335239[_0x6606('0x42')][_0x6606('0x45')]));_0x5dbe1e[_0x6606('0x44')]=_0x5dbe1e[_0x6606('0x44')][_0x6606('0x46')]?_0x5dbe1e[_0x6606('0x44')]:_0x1d3e98['model'];if(!_0x335239[_0x6606('0x42')][_0x6606('0x47')]('nolimit')){_0x5dbe1e[_0x6606('0x32')]=qs['limit'](_0x335239[_0x6606('0x42')]['limit']);_0x5dbe1e[_0x6606('0x2f')]=qs['offset'](_0x335239[_0x6606('0x42')]['offset']);}_0x5dbe1e['order']=qs[_0x6606('0x48')](_0x335239[_0x6606('0x42')][_0x6606('0x48')]);_0x5dbe1e['where']=qs['filters'](_['pick'](_0x335239['query'],_0x1d3e98[_0x6606('0x49')]),_0x115e16);if(_0x335239[_0x6606('0x42')][_0x6606('0x4a')]){_0x5dbe1e[_0x6606('0x4b')]=_[_0x6606('0x4c')](_0x5dbe1e['where'],{'$or':_[_0x6606('0x4d')](_0x115e16,function(_0x565d4a){if(_0x565d4a[_0x6606('0x3e')]!==_0x6606('0x4e')){var _0x2719fe={};_0x2719fe[_0x565d4a[_0x6606('0x39')]]={'$like':'%'+_0x335239[_0x6606('0x42')][_0x6606('0x4a')]+'%'};return _0x2719fe;}})});}_0x5dbe1e=_[_0x6606('0x4c')]({},_0x5dbe1e,_0x335239[_0x6606('0x4f')]);var _0x1bf46e={'where':_0x5dbe1e[_0x6606('0x4b')]};return db[_0x6606('0x3b')][_0x6606('0x31')](_0x1bf46e)['then'](function(_0x1dc876){_0x494515['count']=_0x1dc876;if(_0x335239[_0x6606('0x42')][_0x6606('0x50')]){_0x5dbe1e[_0x6606('0x51')]=[{'all':!![]}];}return db[_0x6606('0x3b')][_0x6606('0x52')](_0x5dbe1e);})[_0x6606('0x22')](function(_0x335e98){_0x494515[_0x6606('0x53')]=_0x335e98;return _0x494515;})[_0x6606('0x22')](respondWithFilteredResult(_0x4d5e98,_0x5dbe1e))[_0x6606('0x2c')](handleError(_0x4d5e98,null));};exports['show']=function(_0x5d653b,_0x23f4b3){var _0x16fdde={'raw':!![],'where':{'id':_0x5d653b[_0x6606('0x54')]['id']}},_0x420a64={};_0x420a64[_0x6606('0x40')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x420a64[_0x6606('0x42')]=_[_0x6606('0x41')](_0x5d653b[_0x6606('0x42')]);_0x420a64[_0x6606('0x49')]=_['intersection'](_0x420a64[_0x6606('0x40')],_0x420a64[_0x6606('0x42')]);_0x16fdde[_0x6606('0x44')]=_[_0x6606('0x43')](_0x420a64[_0x6606('0x40')],qs[_0x6606('0x45')](_0x5d653b[_0x6606('0x42')][_0x6606('0x45')]));_0x16fdde[_0x6606('0x44')]=_0x16fdde[_0x6606('0x44')][_0x6606('0x46')]?_0x16fdde[_0x6606('0x44')]:_0x420a64[_0x6606('0x40')];if(_0x5d653b[_0x6606('0x42')]['includeAll']){_0x16fdde[_0x6606('0x51')]=[{'all':!![]}];}_0x16fdde=_[_0x6606('0x4c')]({},_0x16fdde,_0x5d653b['options']);return db['OpenchannelMessage'][_0x6606('0x55')](_0x16fdde)['then'](handleEntityNotFound(_0x23f4b3,null))[_0x6606('0x22')](respondWithResult(_0x23f4b3,null))[_0x6606('0x2c')](handleError(_0x23f4b3,null));};exports[_0x6606('0x56')]=function(_0x4386c7,_0x20caa6){return db[_0x6606('0x3b')]['create'](_0x4386c7[_0x6606('0x57')],{})[_0x6606('0x22')](respondWithResult(_0x20caa6,0xc9))[_0x6606('0x2c')](handleError(_0x20caa6,null));};exports[_0x6606('0x37')]=function(_0x8dab6e,_0x42eb7c){if(_0x8dab6e[_0x6606('0x57')]['id']){delete _0x8dab6e[_0x6606('0x57')]['id'];}return db[_0x6606('0x3b')][_0x6606('0x55')]({'where':{'id':_0x8dab6e[_0x6606('0x54')]['id']}})[_0x6606('0x22')](handleEntityNotFound(_0x42eb7c,null))[_0x6606('0x22')](saveUpdates(_0x8dab6e[_0x6606('0x57')],null))['then'](respondWithResult(_0x42eb7c,null))[_0x6606('0x2c')](handleError(_0x42eb7c,null));};exports[_0x6606('0x58')]=function(_0x1f7160,_0xa4efa4){return db[_0x6606('0x3b')][_0x6606('0x55')]({'where':{'id':_0x1f7160[_0x6606('0x54')]['id']}})[_0x6606('0x22')](handleEntityNotFound(_0xa4efa4,null))[_0x6606('0x22')](removeEntity(_0xa4efa4,null))[_0x6606('0x2c')](handleError(_0xa4efa4,null));};exports['describe']=function(_0x456e85,_0x2b0739){return db[_0x6606('0x3b')][_0x6606('0x59')]()[_0x6606('0x22')](respondWithResult(_0x2b0739,null))[_0x6606('0x2c')](handleError(_0x2b0739,null));};var interaction_log=require(_0x6606('0x17'))('openchannel-interactions');exports['accept']=function(_0x2f6ae3,_0x27bb0a,_0x2b0747){var _0xcb7b84={'agent':{},'channel':_0x6606('0x5a')};if(_0x2f6ae3[_0x6606('0x57')]['id']){delete _0x2f6ae3[_0x6606('0x57')]['id'];}_0x2f6ae3[_0x6606('0x57')][_0x6606('0x5b')]=!![];_0x2f6ae3[_0x6606('0x57')][_0x6606('0x5c')]=moment()[_0x6606('0x5d')](_0x6606('0x5e'));_0x2f6ae3['body'][_0x6606('0x5f')]=_0x2f6ae3['body'][_0x6606('0x5f')]||_0x2f6ae3[_0x6606('0x60')]['id'];_0xcb7b84[_0x6606('0x61')]['id']=_0x2f6ae3[_0x6606('0x57')][_0x6606('0x5f')];return db[_0x6606('0x3b')][_0x6606('0x55')]({'where':{'id':_0x2f6ae3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27bb0a,null))['then'](saveUpdates(_0x2f6ae3['body'],null))[_0x6606('0x22')](function(_0x1ef854){if(_0x1ef854){_0xcb7b84[_0x6606('0x2b')]=_0x1ef854[_0x6606('0x62')]({'plain':!![]});return db[_0x6606('0x63')][_0x6606('0x55')]({'where':{'id':_0x1ef854[_0x6606('0x64')]}});}return null;})[_0x6606('0x22')](handleEntityNotFound(_0x27bb0a,null))['then'](function(_0x4162b2){if(_0x4162b2){return _0x4162b2[_0x6606('0x37')]({'UserId':_0x2f6ae3['body'][_0x6606('0x5f')],'read1stAt':_[_0x6606('0x65')](_0x4162b2[_0x6606('0x66')])?moment()['format'](_0x6606('0x5e')):undefined});}return null;})[_0x6606('0x22')](function(_0x5ab428){if(_0x5ab428){_0xcb7b84[_0x6606('0x67')]=_0x5ab428[_0x6606('0x62')]({'plain':!![]});interaction_log[_0x6606('0x23')](_0x6606('0x68'),_0x2f6ae3[_0x6606('0x60')]['id'],_0x2f6ae3[_0x6606('0x60')][_0x6606('0x39')],_0x2f6ae3[_0x6606('0x60')][_0x6606('0x69')],_0xcb7b84['interaction']['id'],_0x2f6ae3[_0x6606('0x57')]?JSON[_0x6606('0x28')](_0x2f6ae3['body']):_0x6606('0x6a'));return respondWithRpcPromise(_0x6606('0x6b'),'acceptMessage',_0xcb7b84);}return null;})['then'](function(_0x25df3e){var _0x36b199=_0x6606('0x6c')+_0x25df3e[_0x6606('0x2b')][_0x6606('0x6d')];return db[_0x6606('0x6e')]['query'](_0x36b199,{'type':db[_0x6606('0x6f')]['QueryTypes'][_0x6606('0x70')],'raw':!![]})[_0x6606('0x22')](function(_0x4f121e){return _0x4f121e;});})[_0x6606('0x22')](function(_0x25a94c){if(_0x25a94c){_0xcb7b84['message'][_0x6606('0x71')]=_0x25a94c[0x0];if(!_0x2f6ae3[_0x6606('0x57')][_0x6606('0x5f')])return;return db[_0x6606('0x72')][_0x6606('0x55')]({'where':{'id':_0x2f6ae3[_0x6606('0x57')]['UserId'],'role':_0x6606('0x61')},'attributes':['id',_0x6606('0x39'),_0x6606('0x73'),_0x6606('0x74'),_0x6606('0x75')],'raw':!![]});}return null;})[_0x6606('0x22')](function(_0x41768f){if(!_0x41768f)return null;_0xcb7b84[_0x6606('0x2b')][_0x6606('0x61')]=_0x41768f;return _0xcb7b84;})['then'](function(_0x23db17){if(_0x23db17){if(_0x2f6ae3[_0x6606('0x57')][_0x6606('0x76')]){_0xcb7b84[_0x6606('0x2b')][_0x6606('0x77')]=util['format'](_0x6606('0x78'),_0x2f6ae3['user'][_0x6606('0x39')]);_0xcb7b84[_0x6606('0x2b')][_0x6606('0x79')]=_0xcb7b84[_0x6606('0x79')];_0xcb7b84['message'][_0x6606('0x7a')]=_0xcb7b84[_0x6606('0x79')];_0xcb7b84[_0x6606('0x2b')]['event']=_0x6606('0x7b');return respondWithRpcPromise(_0x6606('0x7c'),_0x6606('0x7c'),{'event':_0x6606('0x7d'),'message':_0xcb7b84[_0x6606('0x2b')]},client9002)['then'](function(){return _0xcb7b84;});}return _0xcb7b84;}return null;})[_0x6606('0x22')](respondWithResult(_0x27bb0a,null))[_0x6606('0x2c')](handleError(_0x27bb0a,null));};var interaction_log=require(_0x6606('0x17'))(_0x6606('0x7e'));exports[_0x6606('0x35')]=function(_0x3ae574,_0x92ac7a,_0x392684){var _0xa4500f={'agent':{},'channel':_0x6606('0x5a')};if(_0x3ae574[_0x6606('0x57')]['id']){delete _0x3ae574[_0x6606('0x57')]['id'];}_0x3ae574[_0x6606('0x57')][_0x6606('0x5f')]=_0x3ae574[_0x6606('0x57')]['UserId']||_0x3ae574[_0x6606('0x60')]['id'];_0xa4500f[_0x6606('0x61')]['id']=_0x3ae574[_0x6606('0x57')][_0x6606('0x5f')];return db[_0x6606('0x3b')][_0x6606('0x55')]({'where':{'id':_0x3ae574[_0x6606('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x92ac7a,null))[_0x6606('0x22')](function(_0x2dd0ee){if(_0x2dd0ee){_0xa4500f[_0x6606('0x2b')]=_0x2dd0ee[_0x6606('0x62')]({'plain':!![]});return db[_0x6606('0x63')][_0x6606('0x55')]({'where':{'id':_0x2dd0ee[_0x6606('0x64')]}});}return null;})[_0x6606('0x22')](handleEntityNotFound(_0x92ac7a,null))[_0x6606('0x22')](function(_0x28bfb3){if(_0x28bfb3){_0xa4500f[_0x6606('0x67')]=_0x28bfb3[_0x6606('0x62')]({'plain':!![]});interaction_log[_0x6606('0x23')](_0x6606('0x7f'),_0x3ae574['user']['id'],_0x3ae574[_0x6606('0x60')]['name'],_0x3ae574[_0x6606('0x60')][_0x6606('0x69')],_0xa4500f[_0x6606('0x67')]['id'],_0x3ae574[_0x6606('0x57')]?JSON['stringify'](_0x3ae574[_0x6606('0x57')]):_0x6606('0x6a'));return respondWithRpcPromise('RejectMessage',_0x6606('0x80'),_0xa4500f);}return null;})[_0x6606('0x22')](function(_0x36f81a){var _0x1ddd0b=_0x6606('0x6c')+_0x36f81a[_0x6606('0x2b')]['ContactId'];return db[_0x6606('0x6e')]['query'](_0x1ddd0b,{'type':db[_0x6606('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6606('0x22')](function(_0x5d6963){return _0x5d6963;});})[_0x6606('0x22')](function(_0x41a05e){if(_0x41a05e){_0xa4500f['message'][_0x6606('0x71')]=_0x41a05e[0x0];if(!_0x3ae574[_0x6606('0x57')]['UserId'])return;return db[_0x6606('0x72')]['find']({'where':{'id':_0x3ae574[_0x6606('0x57')]['UserId'],'role':_0x6606('0x61')},'attributes':['id',_0x6606('0x39'),'fullname',_0x6606('0x74'),_0x6606('0x75')],'raw':!![]});}return null;})['then'](function(_0x3ef5bf){if(!_0x3ef5bf)return null;_0xa4500f[_0x6606('0x2b')][_0x6606('0x61')]=_0x3ef5bf;return _0xa4500f;})[_0x6606('0x22')](function(_0x2ade42){if(_0x2ade42){_0x2ade42[_0x6606('0x2b')][_0x6606('0x77')]=util[_0x6606('0x5d')]('SIP/%s',_0x3ae574[_0x6606('0x60')][_0x6606('0x39')]);_0x2ade42[_0x6606('0x2b')][_0x6606('0x79')]=_0xa4500f[_0x6606('0x79')];_0x2ade42[_0x6606('0x2b')]['motionChannel']=_0xa4500f['channel'];_0x2ade42[_0x6606('0x2b')][_0x6606('0x81')]=_0x6606('0x35');respondWithRpcPromise('EventManager',_0x6606('0x7c'),{'event':_0x6606('0x82'),'message':_0x2ade42[_0x6606('0x2b')]},client9002);return _0xa4500f;}return null;})[_0x6606('0x22')](respondWithResult(_0x92ac7a,null))[_0x6606('0x2c')](handleError(_0x92ac7a,null));}; \ No newline at end of file +var _0x188f=['pick','filter','where','merge','VIRTUAL','options','include','includeAll','find','create','body','params','destroy','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','get','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','interaction','rejectMessage','ContactId','event','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x188f,0x1a5));var _0xf188=function(_0x30f96,_0x42fa7d){_0x30f96=_0x30f96-0x0;var _0x1ba510=_0x188f[_0x30f96];return _0x1ba510;};'use strict';var emlformat=require(_0xf188('0x0'));var rimraf=require(_0xf188('0x1'));var zipdir=require(_0xf188('0x2'));var jsonpatch=require(_0xf188('0x3'));var rp=require(_0xf188('0x4'));var moment=require(_0xf188('0x5'));var BPromise=require(_0xf188('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf188('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf188('0x8'));var fs=require('fs');var fs_extra=require(_0xf188('0x9'));var _=require(_0xf188('0xa'));var squel=require(_0xf188('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf188('0xc'));var Papa=require(_0xf188('0xd'));var Redis=require('ioredis');var authService=require(_0xf188('0xe'));var qs=require(_0xf188('0xf'));var as=require(_0xf188('0x10'));var hardwareService=require(_0xf188('0x11'));var logger=require(_0xf188('0x12'))(_0xf188('0x13'));var utils=require(_0xf188('0x14'));var config=require(_0xf188('0x15'));var licenseUtil=require(_0xf188('0x16'));var db=require('../../mysqldb')['db'];config[_0xf188('0x17')]=_[_0xf188('0x18')](config['redis'],{'host':_0xf188('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf188('0x17')]));require(_0xf188('0x1a'))[_0xf188('0x1b')](socket);var jayson=require(_0xf188('0x1c'));var client=jayson[_0xf188('0x1d')][_0xf188('0x1e')]({'port':0x232c});var client9002=jayson[_0xf188('0x1d')][_0xf188('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x510c02,_0x14893c,_0x7fb0b,_0x284363){return new BPromise(function(_0x10cf99,_0x1c0b93){var _0x415a5f=_0x284363||client;return _0x415a5f[_0xf188('0x1f')](_0x510c02,_0x7fb0b)['then'](function(_0xbf4bbf){logger['info'](_0xf188('0x20'),_0x14893c,_0xf188('0x21'));logger['debug'](_0xf188('0x22'),_0x14893c,_0xf188('0x21'),JSON[_0xf188('0x23')](_0xbf4bbf));if(_0xbf4bbf[_0xf188('0x24')]){if(_0xbf4bbf[_0xf188('0x24')][_0xf188('0x25')]===0x1f4){logger[_0xf188('0x24')](_0xf188('0x20'),_0x14893c,_0xbf4bbf[_0xf188('0x24')][_0xf188('0x26')]);return _0x1c0b93(_0xbf4bbf['error'][_0xf188('0x26')]);}logger[_0xf188('0x24')](_0xf188('0x20'),_0x14893c,_0xbf4bbf[_0xf188('0x24')][_0xf188('0x26')]);return _0x10cf99(_0xbf4bbf['error']['message']);}else{logger[_0xf188('0x27')](_0xf188('0x20'),_0x14893c,'request\x20sent');_0x10cf99(_0xbf4bbf[_0xf188('0x28')][_0xf188('0x26')]);}})[_0xf188('0x29')](function(_0x1aacbc){logger[_0xf188('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x14893c,_0x1aacbc);_0x1c0b93(_0x1aacbc);});});}function respondWithStatusCode(_0x2d91ab,_0x2a38b7){_0x2a38b7=_0x2a38b7||0xcc;return function(_0x161b7c){if(_0x161b7c){return _0x2d91ab[_0xf188('0x2a')](_0x2a38b7);}return _0x2d91ab[_0xf188('0x2b')](_0x2a38b7)[_0xf188('0x2c')]();};}function respondWithResult(_0x318566,_0x45c62a){_0x45c62a=_0x45c62a||0xc8;return function(_0x2eeb66){if(_0x2eeb66){return _0x318566[_0xf188('0x2b')](_0x45c62a)['json'](_0x2eeb66);}};}function respondWithFilteredResult(_0x536b6b,_0x490dee){return function(_0xaeef08){if(_0xaeef08){var _0x4c1daf=typeof _0x490dee[_0xf188('0x2d')]===_0xf188('0x2e')&&typeof _0x490dee[_0xf188('0x2f')]===_0xf188('0x2e');var _0x10623f=_0xaeef08[_0xf188('0x30')];var _0xe676bb=_0x4c1daf?0x0:_0x490dee['offset'];var _0x3d8429=_0x4c1daf?_0xaeef08[_0xf188('0x30')]:_0x490dee['offset']+_0x490dee[_0xf188('0x2f')];var _0x21d45d;if(_0x3d8429>=_0x10623f){_0x3d8429=_0x10623f;_0x21d45d=0xc8;}else{_0x21d45d=0xce;}_0x536b6b[_0xf188('0x2b')](_0x21d45d);return _0x536b6b[_0xf188('0x31')]('Content-Range',_0xe676bb+'-'+_0x3d8429+'/'+_0x10623f)[_0xf188('0x32')](_0xaeef08);}return null;};}function patchUpdates(_0x2c8fff){return function(_0xcd94cf){try{jsonpatch[_0xf188('0x33')](_0xcd94cf,_0x2c8fff,!![]);}catch(_0x212e49){return BPromise[_0xf188('0x34')](_0x212e49);}return _0xcd94cf[_0xf188('0x35')]();};}function saveUpdates(_0x3f337b,_0xcf3206){return function(_0x27f1fc){if(_0x27f1fc){return _0x27f1fc['update'](_0x3f337b)[_0xf188('0x36')](function(_0x55fcd9){return _0x55fcd9;});}return null;};}function removeEntity(_0x349448,_0x36a26b){return function(_0x544d20){if(_0x544d20){return _0x544d20['destroy']()[_0xf188('0x36')](function(){_0x349448[_0xf188('0x2b')](0xcc)[_0xf188('0x2c')]();});}};}function handleEntityNotFound(_0x35df26,_0x3fb092){return function(_0x4d5cf4){if(!_0x4d5cf4){_0x35df26[_0xf188('0x2a')](0x194);}return _0x4d5cf4;};}function handleError(_0x353011,_0x4b305a){_0x4b305a=_0x4b305a||0x1f4;return function(_0x4606a0){logger[_0xf188('0x24')](_0x4606a0[_0xf188('0x37')]);if(_0x4606a0['name']){delete _0x4606a0[_0xf188('0x38')];}_0x353011[_0xf188('0x2b')](_0x4b305a)[_0xf188('0x39')](_0x4606a0);};}exports[_0xf188('0x3a')]=function(_0x44d03d,_0x160589){var _0x494624={},_0x140241={},_0x137968={'count':0x0,'rows':[]};var _0x13f665=_['map'](db[_0xf188('0x3b')][_0xf188('0x3c')],function(_0x1430d4){return{'name':_0x1430d4[_0xf188('0x3d')],'type':_0x1430d4[_0xf188('0x3e')][_0xf188('0x3f')]};});_0x140241['model']=_[_0xf188('0x40')](_0x13f665,_0xf188('0x38'));_0x140241[_0xf188('0x41')]=_[_0xf188('0x42')](_0x44d03d[_0xf188('0x41')]);_0x140241[_0xf188('0x43')]=_['intersection'](_0x140241[_0xf188('0x44')],_0x140241['query']);_0x494624[_0xf188('0x45')]=_[_0xf188('0x46')](_0x140241[_0xf188('0x44')],qs['fields'](_0x44d03d[_0xf188('0x41')][_0xf188('0x47')]));_0x494624[_0xf188('0x45')]=_0x494624[_0xf188('0x45')][_0xf188('0x48')]?_0x494624[_0xf188('0x45')]:_0x140241['model'];if(!_0x44d03d[_0xf188('0x41')][_0xf188('0x49')]('nolimit')){_0x494624[_0xf188('0x2f')]=qs['limit'](_0x44d03d[_0xf188('0x41')][_0xf188('0x2f')]);_0x494624['offset']=qs['offset'](_0x44d03d[_0xf188('0x41')][_0xf188('0x2d')]);}_0x494624['order']=qs['sort'](_0x44d03d[_0xf188('0x41')][_0xf188('0x4a')]);_0x494624['where']=qs[_0xf188('0x43')](_[_0xf188('0x4b')](_0x44d03d['query'],_0x140241[_0xf188('0x43')]),_0x13f665);if(_0x44d03d[_0xf188('0x41')][_0xf188('0x4c')]){_0x494624[_0xf188('0x4d')]=_[_0xf188('0x4e')](_0x494624[_0xf188('0x4d')],{'$or':_[_0xf188('0x40')](_0x13f665,function(_0x3a1944){if(_0x3a1944[_0xf188('0x3e')]!==_0xf188('0x4f')){var _0x34a4ec={};_0x34a4ec[_0x3a1944['name']]={'$like':'%'+_0x44d03d[_0xf188('0x41')][_0xf188('0x4c')]+'%'};return _0x34a4ec;}})});}_0x494624=_['merge']({},_0x494624,_0x44d03d[_0xf188('0x50')]);var _0x2eff34={'where':_0x494624[_0xf188('0x4d')]};return db[_0xf188('0x3b')][_0xf188('0x30')](_0x2eff34)['then'](function(_0x27d0de){_0x137968[_0xf188('0x30')]=_0x27d0de;if(_0x44d03d[_0xf188('0x41')]['includeAll']){_0x494624[_0xf188('0x51')]=[{'all':!![]}];}return db[_0xf188('0x3b')]['findAll'](_0x494624);})[_0xf188('0x36')](function(_0x1861e3){_0x137968['rows']=_0x1861e3;return _0x137968;})[_0xf188('0x36')](respondWithFilteredResult(_0x160589,_0x494624))['catch'](handleError(_0x160589,null));};exports['show']=function(_0x44489a,_0x4caff5){var _0x4dc845={'raw':!![],'where':{'id':_0x44489a['params']['id']}},_0x2536a8={};_0x2536a8[_0xf188('0x44')]=_['keys'](db[_0xf188('0x3b')]['rawAttributes']);_0x2536a8['query']=_['keys'](_0x44489a[_0xf188('0x41')]);_0x2536a8[_0xf188('0x43')]=_[_0xf188('0x46')](_0x2536a8['model'],_0x2536a8[_0xf188('0x41')]);_0x4dc845[_0xf188('0x45')]=_[_0xf188('0x46')](_0x2536a8[_0xf188('0x44')],qs[_0xf188('0x47')](_0x44489a[_0xf188('0x41')][_0xf188('0x47')]));_0x4dc845[_0xf188('0x45')]=_0x4dc845[_0xf188('0x45')]['length']?_0x4dc845[_0xf188('0x45')]:_0x2536a8[_0xf188('0x44')];if(_0x44489a[_0xf188('0x41')][_0xf188('0x52')]){_0x4dc845[_0xf188('0x51')]=[{'all':!![]}];}_0x4dc845=_[_0xf188('0x4e')]({},_0x4dc845,_0x44489a['options']);return db[_0xf188('0x3b')][_0xf188('0x53')](_0x4dc845)['then'](handleEntityNotFound(_0x4caff5,null))[_0xf188('0x36')](respondWithResult(_0x4caff5,null))['catch'](handleError(_0x4caff5,null));};exports[_0xf188('0x54')]=function(_0x2e1cb,_0x576e4a){return db[_0xf188('0x3b')]['create'](_0x2e1cb['body'],{})[_0xf188('0x36')](respondWithResult(_0x576e4a,0xc9))[_0xf188('0x29')](handleError(_0x576e4a,null));};exports['update']=function(_0x211a5e,_0x4b21b2){if(_0x211a5e[_0xf188('0x55')]['id']){delete _0x211a5e[_0xf188('0x55')]['id'];}return db[_0xf188('0x3b')][_0xf188('0x53')]({'where':{'id':_0x211a5e[_0xf188('0x56')]['id']}})[_0xf188('0x36')](handleEntityNotFound(_0x4b21b2,null))[_0xf188('0x36')](saveUpdates(_0x211a5e['body'],null))['then'](respondWithResult(_0x4b21b2,null))[_0xf188('0x29')](handleError(_0x4b21b2,null));};exports[_0xf188('0x57')]=function(_0x5a96d8,_0xe25131){return db[_0xf188('0x3b')][_0xf188('0x53')]({'where':{'id':_0x5a96d8[_0xf188('0x56')]['id']}})[_0xf188('0x36')](handleEntityNotFound(_0xe25131,null))[_0xf188('0x36')](removeEntity(_0xe25131,null))[_0xf188('0x29')](handleError(_0xe25131,null));};exports['describe']=function(_0x133ce5,_0x7fdf92){return db['OpenchannelMessage']['describe']()[_0xf188('0x36')](respondWithResult(_0x7fdf92,null))['catch'](handleError(_0x7fdf92,null));};var interaction_log=require(_0xf188('0x12'))(_0xf188('0x58'));exports[_0xf188('0x59')]=function(_0x46fb32,_0x1ef345,_0x4829bf){var _0x2da497={'agent':{},'channel':_0xf188('0x5a')};if(_0x46fb32[_0xf188('0x55')]['id']){delete _0x46fb32[_0xf188('0x55')]['id'];}_0x46fb32[_0xf188('0x55')][_0xf188('0x5b')]=!![];_0x46fb32[_0xf188('0x55')][_0xf188('0x5c')]=moment()[_0xf188('0x5d')](_0xf188('0x5e'));_0x46fb32['body']['UserId']=_0x46fb32['body'][_0xf188('0x5f')]||_0x46fb32[_0xf188('0x60')]['id'];_0x2da497[_0xf188('0x61')]['id']=_0x46fb32[_0xf188('0x55')][_0xf188('0x5f')];return db[_0xf188('0x3b')][_0xf188('0x53')]({'where':{'id':_0x46fb32[_0xf188('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ef345,null))[_0xf188('0x36')](saveUpdates(_0x46fb32['body'],null))[_0xf188('0x36')](function(_0xa00b58){if(_0xa00b58){_0x2da497['message']=_0xa00b58['get']({'plain':!![]});return db[_0xf188('0x62')][_0xf188('0x53')]({'where':{'id':_0xa00b58[_0xf188('0x63')]}});}return null;})[_0xf188('0x36')](handleEntityNotFound(_0x1ef345,null))[_0xf188('0x36')](function(_0x5d8f8e){if(_0x5d8f8e){return _0x5d8f8e['update']({'UserId':_0x46fb32[_0xf188('0x55')]['UserId'],'read1stAt':_['isNil'](_0x5d8f8e[_0xf188('0x64')])?moment()[_0xf188('0x5d')](_0xf188('0x5e')):undefined});}return null;})[_0xf188('0x36')](function(_0x3a9cbb){if(_0x3a9cbb){_0x2da497['interaction']=_0x3a9cbb[_0xf188('0x65')]({'plain':!![]});interaction_log[_0xf188('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46fb32[_0xf188('0x60')]['id'],_0x46fb32[_0xf188('0x60')][_0xf188('0x38')],_0x46fb32['user'][_0xf188('0x66')],_0x2da497['interaction']['id'],_0x46fb32[_0xf188('0x55')]?JSON['stringify'](_0x46fb32[_0xf188('0x55')]):_0xf188('0x67'));return respondWithRpcPromise('AcceptMessage',_0xf188('0x68'),_0x2da497);}return null;})[_0xf188('0x36')](function(_0x4493e1){var _0x5f0ff3=_0xf188('0x69')+_0x4493e1['message']['ContactId'];return db[_0xf188('0x6a')][_0xf188('0x41')](_0x5f0ff3,{'type':db[_0xf188('0x6b')]['QueryTypes'][_0xf188('0x6c')],'raw':!![]})['then'](function(_0x1a2892){return _0x1a2892;});})['then'](function(_0x46e216){if(_0x46e216){_0x2da497['message'][_0xf188('0x6d')]=_0x46e216[0x0];if(!_0x46fb32[_0xf188('0x55')][_0xf188('0x5f')])return;return db[_0xf188('0x6e')][_0xf188('0x53')]({'where':{'id':_0x46fb32[_0xf188('0x55')][_0xf188('0x5f')],'role':_0xf188('0x61')},'attributes':['id',_0xf188('0x38'),_0xf188('0x6f'),_0xf188('0x70'),_0xf188('0x71')],'raw':!![]});}return null;})[_0xf188('0x36')](function(_0x5dbff0){if(!_0x5dbff0)return null;_0x2da497[_0xf188('0x26')][_0xf188('0x61')]=_0x5dbff0;return _0x2da497;})[_0xf188('0x36')](function(_0x2b3d5e){if(_0x2b3d5e){if(_0x46fb32[_0xf188('0x55')]['manual']){_0x2da497[_0xf188('0x26')][_0xf188('0x72')]=util[_0xf188('0x5d')](_0xf188('0x73'),_0x46fb32[_0xf188('0x60')][_0xf188('0x38')]);_0x2da497[_0xf188('0x26')][_0xf188('0x74')]=_0x2da497[_0xf188('0x74')];_0x2da497['message'][_0xf188('0x75')]=_0x2da497[_0xf188('0x74')];_0x2da497['message']['event']='accept';return respondWithRpcPromise(_0xf188('0x76'),'EventManager',{'event':_0xf188('0x77'),'message':_0x2da497[_0xf188('0x26')]},client9002)[_0xf188('0x36')](function(){return _0x2da497;});}return _0x2da497;}return null;})['then'](respondWithResult(_0x1ef345,null))[_0xf188('0x29')](handleError(_0x1ef345,null));};var interaction_log=require(_0xf188('0x12'))('openchannel-interactions');exports[_0xf188('0x34')]=function(_0x54bc1a,_0x554f4f,_0x579d76){var _0x23682f={'agent':{},'channel':_0xf188('0x5a')};if(_0x54bc1a['body']['id']){delete _0x54bc1a[_0xf188('0x55')]['id'];}_0x54bc1a[_0xf188('0x55')]['UserId']=_0x54bc1a[_0xf188('0x55')][_0xf188('0x5f')]||_0x54bc1a[_0xf188('0x60')]['id'];_0x23682f[_0xf188('0x61')]['id']=_0x54bc1a[_0xf188('0x55')][_0xf188('0x5f')];return db['OpenchannelMessage'][_0xf188('0x53')]({'where':{'id':_0x54bc1a[_0xf188('0x56')]['id'],'UserId':null}})[_0xf188('0x36')](handleEntityNotFound(_0x554f4f,null))[_0xf188('0x36')](function(_0x3fc0ec){if(_0x3fc0ec){_0x23682f[_0xf188('0x26')]=_0x3fc0ec[_0xf188('0x65')]({'plain':!![]});return db[_0xf188('0x62')][_0xf188('0x53')]({'where':{'id':_0x3fc0ec[_0xf188('0x63')]}});}return null;})[_0xf188('0x36')](handleEntityNotFound(_0x554f4f,null))['then'](function(_0x5a4bd7){if(_0x5a4bd7){_0x23682f[_0xf188('0x78')]=_0x5a4bd7['get']({'plain':!![]});interaction_log[_0xf188('0x27')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54bc1a[_0xf188('0x60')]['id'],_0x54bc1a[_0xf188('0x60')][_0xf188('0x38')],_0x54bc1a['user']['role'],_0x23682f['interaction']['id'],_0x54bc1a['body']?JSON[_0xf188('0x23')](_0x54bc1a[_0xf188('0x55')]):_0xf188('0x67'));return respondWithRpcPromise('RejectMessage',_0xf188('0x79'),_0x23682f);}return null;})[_0xf188('0x36')](function(_0x470941){var _0x7c8fbf=_0xf188('0x69')+_0x470941[_0xf188('0x26')][_0xf188('0x7a')];return db['sequelize'][_0xf188('0x41')](_0x7c8fbf,{'type':db[_0xf188('0x6b')]['QueryTypes'][_0xf188('0x6c')],'raw':!![]})[_0xf188('0x36')](function(_0x4fd807){return _0x4fd807;});})['then'](function(_0x448646){if(_0x448646){_0x23682f[_0xf188('0x26')]['contact']=_0x448646[0x0];if(!_0x54bc1a[_0xf188('0x55')]['UserId'])return;return db[_0xf188('0x6e')][_0xf188('0x53')]({'where':{'id':_0x54bc1a['body']['UserId'],'role':_0xf188('0x61')},'attributes':['id','name',_0xf188('0x6f'),_0xf188('0x70'),_0xf188('0x71')],'raw':!![]});}return null;})['then'](function(_0x90aa2d){if(!_0x90aa2d)return null;_0x23682f[_0xf188('0x26')]['agent']=_0x90aa2d;return _0x23682f;})[_0xf188('0x36')](function(_0x155c60){if(_0x155c60){_0x155c60[_0xf188('0x26')][_0xf188('0x72')]=util['format'](_0xf188('0x73'),_0x54bc1a['user'][_0xf188('0x38')]);_0x155c60[_0xf188('0x26')]['channel']=_0x23682f[_0xf188('0x74')];_0x155c60[_0xf188('0x26')][_0xf188('0x75')]=_0x23682f[_0xf188('0x74')];_0x155c60[_0xf188('0x26')][_0xf188('0x7b')]='reject';respondWithRpcPromise(_0xf188('0x76'),_0xf188('0x76'),{'event':'rejectmessage','message':_0x155c60[_0xf188('0x26')]},client9002);return _0x23682f;}return null;})['then'](respondWithResult(_0x554f4f,null))['catch'](handleError(_0x554f4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8f7a40f..f45363e 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 _0xf357=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x431e8a,_0x1dc7f4){var _0x2d546d=function(_0x430166){while(--_0x430166){_0x431e8a['push'](_0x431e8a['shift']());}};_0x2d546d(++_0x1dc7f4);}(_0xf357,0x1bf));var _0x7f35=function(_0x273af1,_0x658b87){_0x273af1=_0x273af1-0x0;var _0x4c8e65=_0xf357[_0x273af1];return _0x4c8e65;};'use strict';var EventEmitter=require(_0x7f35('0x0'));var OpenchannelMessage=require(_0x7f35('0x1'))['db'][_0x7f35('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7f35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f35('0x4')};function emitEvent(_0x40de61){return function(_0x5048be,_0x243441,_0x5336eb){OpenchannelMessageEvents['emit'](_0x40de61+':'+_0x5048be['id'],_0x5048be);OpenchannelMessageEvents[_0x7f35('0x5')](_0x40de61,_0x5048be);_0x5336eb(null);};}for(var e in events){if(events[_0x7f35('0x6')](e)){var event=events[e];OpenchannelMessage[_0x7f35('0x7')](e,emitEvent(event));}}module[_0x7f35('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe458=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x280ff0,_0x5969c4){var _0x3494b6=function(_0x839e59){while(--_0x839e59){_0x280ff0['push'](_0x280ff0['shift']());}};_0x3494b6(++_0x5969c4);}(_0xe458,0x6c));var _0x8e45=function(_0x272f6b,_0x592336){_0x272f6b=_0x272f6b-0x0;var _0x4deb3b=_0xe458[_0x272f6b];return _0x4deb3b;};'use strict';var EventEmitter=require(_0x8e45('0x0'));var OpenchannelMessage=require(_0x8e45('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8e45('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e45('0x3'),'afterDestroy':_0x8e45('0x4')};function emitEvent(_0x942c83){return function(_0x236d56,_0x517d7e,_0x499820){OpenchannelMessageEvents['emit'](_0x942c83+':'+_0x236d56['id'],_0x236d56);OpenchannelMessageEvents[_0x8e45('0x5')](_0x942c83,_0x236d56);_0x499820(null);};}for(var e in events){if(events[_0x8e45('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8e45('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6246a04..8d42361 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 _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x34b7,0x196));var _0x734b=function(_0x14bf66,_0x3e1066){_0x14bf66=_0x14bf66-0x0;var _0xaf4bf7=_0x34b7[_0x14bf66];return _0xaf4bf7;};'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':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file +var _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x4531ce,_0x45026c){var _0x2505f0=function(_0x3d744c){while(--_0x3d744c){_0x4531ce['push'](_0x4531ce['shift']());}};_0x2505f0(++_0x45026c);}(_0x1a85,0x178));var _0x51a8=function(_0xa2049b,_0x7eeb1e){_0xa2049b=_0xa2049b-0x0;var _0x2fd615=_0x1a85[_0xa2049b];return _0x2fd615;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 495382e..6a3f0cf 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x5c92f7,_0x17381f){var _0x452cc1=function(_0x374c83){while(--_0x374c83){_0x5c92f7['push'](_0x5c92f7['shift']());}};_0x452cc1(++_0x17381f);}(_0xdb28,0x106));var _0x8db2=function(_0x31239b,_0x3e8ce2){_0x31239b=_0x31239b-0x0;var _0x3d030e=_0xdb28[_0x31239b];return _0x3d030e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x208d39,_0x318d89){var _0x3e4f4b=function(_0xade65b){while(--_0xade65b){_0x208d39['push'](_0x208d39['shift']());}};_0x3e4f4b(++_0x318d89);}(_0x1261,0x144));var _0x1126=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x1261[_0x26659f];return _0x42667f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0a6b2c0..5deb811 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 _0x0e4b=['length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener','register'];(function(_0x5deda9,_0xb06c05){var _0x453001=function(_0x35d17e){while(--_0x35d17e){_0x5deda9['push'](_0x5deda9['shift']());}};_0x453001(++_0xb06c05);}(_0x0e4b,0x15a));var _0xb0e4=function(_0x5853d6,_0x54d9ad){_0x5853d6=_0x5853d6-0x0;var _0x3f9030=_0x0e4b[_0x5853d6];return _0x3f9030;};'use strict';var OpenchannelMessageEvents=require(_0xb0e4('0x0'));var events=[_0xb0e4('0x1'),_0xb0e4('0x2'),'update'];function createListener(_0xe0bf29,_0x209552){return function(_0x399851){_0x209552[_0xb0e4('0x3')](_0xe0bf29,_0x399851);};}function removeListener(_0x256255,_0x5f72e5){return function(){OpenchannelMessageEvents[_0xb0e4('0x4')](_0x256255,_0x5f72e5);};}exports[_0xb0e4('0x5')]=function(_0x43325e){for(var _0x382f4d=0x0,_0x344ad5=events[_0xb0e4('0x6')];_0x382f4d<_0x344ad5;_0x382f4d++){var _0x1a8002=events[_0x382f4d];var _0x1a0d4c=createListener(_0xb0e4('0x7')+_0x1a8002,_0x43325e);OpenchannelMessageEvents['on'](_0x1a8002,_0x1a0d4c);}}; \ No newline at end of file +var _0x278f=['register','length','openchannelMessage:','./openchannelMessage.events','save','update','emit','removeListener'];(function(_0x51d4bd,_0x347b82){var _0x760d10=function(_0x3d9006){while(--_0x3d9006){_0x51d4bd['push'](_0x51d4bd['shift']());}};_0x760d10(++_0x347b82);}(_0x278f,0x12b));var _0xf278=function(_0xe8bada,_0x214fa0){_0xe8bada=_0xe8bada-0x0;var _0x16977a=_0x278f[_0xe8bada];return _0x16977a;};'use strict';var OpenchannelMessageEvents=require(_0xf278('0x0'));var events=[_0xf278('0x1'),'remove',_0xf278('0x2')];function createListener(_0x5188ff,_0x1807d9){return function(_0x4334ec){_0x1807d9[_0xf278('0x3')](_0x5188ff,_0x4334ec);};}function removeListener(_0x2fe4f2,_0x37e217){return function(){OpenchannelMessageEvents[_0xf278('0x4')](_0x2fe4f2,_0x37e217);};}exports[_0xf278('0x5')]=function(_0x4dfe3f){for(var _0x27c658=0x0,_0x89e73e=events[_0xf278('0x6')];_0x27c658<_0x89e73e;_0x27c658++){var _0x2ace34=events[_0x27c658];var _0x5b5a6f=createListener(_0xf278('0x7')+_0x2ace34,_0x4dfe3f);OpenchannelMessageEvents['on'](_0x2ace34,_0x5b5a6f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c335c2b..68abaa7 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 _0x6a0e=['removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','/describe','describe','get','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','destroy','delete'];(function(_0x18931f,_0x15ead5){var _0x40fd75=function(_0x24ce1e){while(--_0x24ce1e){_0x18931f['push'](_0x18931f['shift']());}};_0x40fd75(++_0x15ead5);}(_0x6a0e,0x17c));var _0xe6a0=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x6a0e[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0xe6a0('0x0'));var util=require(_0xe6a0('0x1'));var path=require(_0xe6a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6a0('0x3'));var router=express[_0xe6a0('0x4')]();var fs_extra=require(_0xe6a0('0x5'));var auth=require(_0xe6a0('0x6'));var interaction=require(_0xe6a0('0x7'));var config=require(_0xe6a0('0x8'));var controller=require(_0xe6a0('0x9'));router['get']('/',auth[_0xe6a0('0xa')](),controller['index']);router['get'](_0xe6a0('0xb'),auth[_0xe6a0('0xa')](),controller[_0xe6a0('0xc')]);router[_0xe6a0('0xd')](_0xe6a0('0xe'),auth[_0xe6a0('0xa')](),controller['show']);router[_0xe6a0('0xd')](_0xe6a0('0xf'),auth[_0xe6a0('0xa')](),controller[_0xe6a0('0x10')]);router[_0xe6a0('0xd')](_0xe6a0('0x11'),auth[_0xe6a0('0xa')](),controller['getTeams']);router[_0xe6a0('0xd')](_0xe6a0('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xe6a0('0xa')](),controller['create']);router[_0xe6a0('0x13')](_0xe6a0('0x11'),auth[_0xe6a0('0xa')](),controller[_0xe6a0('0x14')]);router['post'](_0xe6a0('0x12'),auth['isAuthenticated'](),controller[_0xe6a0('0x15')]);router[_0xe6a0('0x16')](_0xe6a0('0xe'),auth[_0xe6a0('0xa')](),controller['update']);router['delete'](_0xe6a0('0xe'),auth[_0xe6a0('0xa')](),controller[_0xe6a0('0x17')]);router[_0xe6a0('0x18')](_0xe6a0('0x11'),auth['isAuthenticated'](),controller[_0xe6a0('0x19')]);router['delete']('/:id/users',auth[_0xe6a0('0xa')](),controller[_0xe6a0('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xfa50=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x3194bb,_0x294f71){var _0x5d9ce0=function(_0x54a0b4){while(--_0x54a0b4){_0x3194bb['push'](_0x3194bb['shift']());}};_0x5d9ce0(++_0x294f71);}(_0xfa50,0x1ce));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0fa5('0x0'));var util=require(_0x0fa5('0x1'));var path=require(_0x0fa5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0fa5('0x3'));var router=express[_0x0fa5('0x4')]();var fs_extra=require(_0x0fa5('0x5'));var auth=require(_0x0fa5('0x6'));var interaction=require(_0x0fa5('0x7'));var config=require(_0x0fa5('0x8'));var controller=require(_0x0fa5('0x9'));router[_0x0fa5('0xa')]('/',auth[_0x0fa5('0xb')](),controller[_0x0fa5('0xc')]);router[_0x0fa5('0xa')](_0x0fa5('0xd'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0xe')]);router['get'](_0x0fa5('0xf'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x10')]);router[_0x0fa5('0xa')](_0x0fa5('0x11'),auth['isAuthenticated'](),controller[_0x0fa5('0x12')]);router[_0x0fa5('0xa')](_0x0fa5('0x13'),auth['isAuthenticated'](),controller[_0x0fa5('0x14')]);router['get'](_0x0fa5('0x15'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x16')]);router['post']('/',auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x17')]);router[_0x0fa5('0x18')](_0x0fa5('0x13'),auth[_0x0fa5('0xb')](),controller['addTeams']);router['post'](_0x0fa5('0x15'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x19')]);router[_0x0fa5('0x1a')](_0x0fa5('0xf'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x1b')]);router[_0x0fa5('0x1c')](_0x0fa5('0xf'),auth['isAuthenticated'](),controller[_0x0fa5('0x1d')]);router[_0x0fa5('0x1c')](_0x0fa5('0x13'),auth[_0x0fa5('0xb')](),controller[_0x0fa5('0x1e')]);router[_0x0fa5('0x1c')]('/:id/users',auth[_0x0fa5('0xb')](),controller['removeAgents']);module[_0x0fa5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 66529d6..ffc4cc9 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 _0x9caf=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x10e16d,_0x59d02d){var _0x49077c=function(_0xc278f8){while(--_0xc278f8){_0x10e16d['push'](_0x10e16d['shift']());}};_0x49077c(++_0x59d02d);}(_0x9caf,0x10e));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf9ca('0x0')]={'name':{'type':Sequelize[_0xf9ca('0x1')],'unique':_0xf9ca('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf9ca('0x1')]},'timeout':{'type':Sequelize[_0xf9ca('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf9ca('0x4')](_0xf9ca('0x5'),_0xf9ca('0x6'),_0xf9ca('0x7'))}}; \ No newline at end of file +var _0xe6ef=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x48397f,_0x378caa){var _0x2cfe6b=function(_0x499ef5){while(--_0x499ef5){_0x48397f['push'](_0x48397f['shift']());}};_0x2cfe6b(++_0x378caa);}(_0xe6ef,0x113));var _0xfe6e=function(_0x1dece9,_0x2cd405){_0x1dece9=_0x1dece9-0x0;var _0x449378=_0xe6ef[_0x1dece9];return _0x449378;};'use strict';var Sequelize=require(_0xfe6e('0x0'));module[_0xfe6e('0x1')]={'name':{'type':Sequelize[_0xfe6e('0x2')],'unique':_0xfe6e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe6e('0x2')]},'timeout':{'type':Sequelize[_0xfe6e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe6e('0x5')](_0xfe6e('0x6'),_0xfe6e('0x7'),_0xfe6e('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index aa5a191..0bb80fc 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 _0x6145=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','length','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5c5ba3,_0x37a4ee){var _0x2c672a=function(_0x1b7407){while(--_0x1b7407){_0x5c5ba3['push'](_0x5c5ba3['shift']());}};_0x2c672a(++_0x37a4ee);}(_0x6145,0x18d));var _0x5614=function(_0x4da443,_0x38d768){_0x4da443=_0x4da443-0x0;var _0x17c056=_0x6145[_0x4da443];return _0x17c056;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5614('0x0'));var zipdir=require(_0x5614('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5614('0x2'));var BPromise=require(_0x5614('0x3'));var Mustache=require(_0x5614('0x4'));var util=require(_0x5614('0x5'));var path=require('path');var sox=require(_0x5614('0x6'));var csv=require('to-csv');var ejs=require(_0x5614('0x7'));var fs=require('fs');var fs_extra=require(_0x5614('0x8'));var _=require(_0x5614('0x9'));var squel=require(_0x5614('0xa'));var crypto=require(_0x5614('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5614('0xc'));var toCsv=require(_0x5614('0xd'));var querystring=require(_0x5614('0xe'));var Papa=require(_0x5614('0xf'));var Redis=require(_0x5614('0x10'));var authService=require(_0x5614('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5614('0x12'));var hardwareService=require(_0x5614('0x13'));var logger=require(_0x5614('0x14'))('api');var utils=require(_0x5614('0x15'));var config=require(_0x5614('0x16'));var licenseUtil=require(_0x5614('0x17'));var db=require(_0x5614('0x18'))['db'];config[_0x5614('0x19')]=_[_0x5614('0x1a')](config[_0x5614('0x19')],{'host':_0x5614('0x1b'),'port':0x18eb});var socket=require(_0x5614('0x1c'))(new Redis(config[_0x5614('0x19')]));require('./openchannelQueue.socket')[_0x5614('0x1d')](socket);function respondWithStatusCode(_0x3973a1,_0x4e107b){_0x4e107b=_0x4e107b||0xcc;return function(_0x5e9266){if(_0x5e9266){return _0x3973a1[_0x5614('0x1e')](_0x4e107b);}return _0x3973a1[_0x5614('0x1f')](_0x4e107b)['end']();};}function respondWithResult(_0x3b7115,_0x472c19){_0x472c19=_0x472c19||0xc8;return function(_0x1866ea){if(_0x1866ea){return _0x3b7115[_0x5614('0x1f')](_0x472c19)[_0x5614('0x20')](_0x1866ea);}};}function respondWithFilteredResult(_0x15acd1,_0x5c8e7b){return function(_0x1cd422){if(_0x1cd422){var _0x513c85=typeof _0x5c8e7b[_0x5614('0x21')]===_0x5614('0x22')&&typeof _0x5c8e7b[_0x5614('0x23')]===_0x5614('0x22');var _0x2b7a5e=_0x1cd422[_0x5614('0x24')];var _0x53bdd2=_0x513c85?0x0:_0x5c8e7b[_0x5614('0x21')];var _0x12f7bd=_0x513c85?_0x1cd422[_0x5614('0x24')]:_0x5c8e7b[_0x5614('0x21')]+_0x5c8e7b['limit'];var _0x5f3ec3;if(_0x12f7bd>=_0x2b7a5e){_0x12f7bd=_0x2b7a5e;_0x5f3ec3=0xc8;}else{_0x5f3ec3=0xce;}_0x15acd1['status'](_0x5f3ec3);return _0x15acd1[_0x5614('0x25')](_0x5614('0x26'),_0x53bdd2+'-'+_0x12f7bd+'/'+_0x2b7a5e)[_0x5614('0x20')](_0x1cd422);}return null;};}function patchUpdates(_0xce4b3d){return function(_0x46e045){try{jsonpatch[_0x5614('0x27')](_0x46e045,_0xce4b3d,!![]);}catch(_0x3bf3dc){return BPromise[_0x5614('0x28')](_0x3bf3dc);}return _0x46e045[_0x5614('0x29')]();};}function saveUpdates(_0x49c223,_0x356150){return function(_0xe73a05){if(_0xe73a05){return _0xe73a05['update'](_0x49c223)[_0x5614('0x2a')](function(_0x1daaa5){return _0x1daaa5;});}return null;};}function removeEntity(_0x4e77b2,_0x18b7d9){return function(_0xff764c){if(_0xff764c){return _0xff764c[_0x5614('0x2b')]()[_0x5614('0x2a')](function(){var _0x2ddbee=_0xff764c[_0x5614('0x2c')]({'plain':!![]});var _0x5b1d00=_0x5614('0x2d');return db[_0x5614('0x2e')]['destroy']({'where':{'type':_0x5b1d00,'resourceId':_0x2ddbee['id']}})[_0x5614('0x2a')](function(){return _0xff764c;});})[_0x5614('0x2a')](function(){_0x4e77b2[_0x5614('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a05e7,_0x2d8040){return function(_0x12c2c0){if(!_0x12c2c0){_0x2a05e7[_0x5614('0x1e')](0x194);}return _0x12c2c0;};}function handleError(_0x5d3445,_0x99b4a7){_0x99b4a7=_0x99b4a7||0x1f4;return function(_0x3243e1){logger[_0x5614('0x2f')](_0x3243e1['stack']);if(_0x3243e1[_0x5614('0x30')]){delete _0x3243e1[_0x5614('0x30')];}_0x5d3445[_0x5614('0x1f')](_0x99b4a7)[_0x5614('0x31')](_0x3243e1);};}exports[_0x5614('0x32')]=function(_0xfd4977,_0x379a50){var _0xd75ac8={},_0x1ae093={},_0x37a493={'count':0x0,'rows':[]};var _0x2012aa=_['map'](db[_0x5614('0x33')][_0x5614('0x34')],function(_0x267b23){return{'name':_0x267b23[_0x5614('0x35')],'type':_0x267b23['type'][_0x5614('0x36')]};});_0x1ae093[_0x5614('0x37')]=_[_0x5614('0x38')](_0x2012aa,_0x5614('0x30'));_0x1ae093['query']=_[_0x5614('0x39')](_0xfd4977[_0x5614('0x3a')]);_0x1ae093[_0x5614('0x3b')]=_[_0x5614('0x3c')](_0x1ae093[_0x5614('0x37')],_0x1ae093[_0x5614('0x3a')]);_0xd75ac8['attributes']=_[_0x5614('0x3c')](_0x1ae093[_0x5614('0x37')],qs[_0x5614('0x3d')](_0xfd4977[_0x5614('0x3a')][_0x5614('0x3d')]));_0xd75ac8[_0x5614('0x3e')]=_0xd75ac8[_0x5614('0x3e')]['length']?_0xd75ac8['attributes']:_0x1ae093[_0x5614('0x37')];if(!_0xfd4977[_0x5614('0x3a')][_0x5614('0x3f')](_0x5614('0x40'))){_0xd75ac8['limit']=qs[_0x5614('0x23')](_0xfd4977[_0x5614('0x3a')][_0x5614('0x23')]);_0xd75ac8[_0x5614('0x21')]=qs[_0x5614('0x21')](_0xfd4977[_0x5614('0x3a')][_0x5614('0x21')]);}_0xd75ac8[_0x5614('0x41')]=qs['sort'](_0xfd4977[_0x5614('0x3a')][_0x5614('0x42')]);_0xd75ac8['where']=qs['filters'](_[_0x5614('0x43')](_0xfd4977[_0x5614('0x3a')],_0x1ae093['filters']),_0x2012aa);if(_0xfd4977['query'][_0x5614('0x44')]){_0xd75ac8[_0x5614('0x45')]=_[_0x5614('0x46')](_0xd75ac8[_0x5614('0x45')],{'$or':_[_0x5614('0x38')](_0x2012aa,function(_0x1a23c6){if(_0x1a23c6[_0x5614('0x47')]!=='VIRTUAL'){var _0x112283={};_0x112283[_0x1a23c6[_0x5614('0x30')]]={'$like':'%'+_0xfd4977[_0x5614('0x3a')][_0x5614('0x44')]+'%'};return _0x112283;}})});}_0xd75ac8=_['merge']({},_0xd75ac8,_0xfd4977[_0x5614('0x48')]);var _0xd3ac68={'where':_0xd75ac8[_0x5614('0x45')]};return db[_0x5614('0x33')][_0x5614('0x24')](_0xd3ac68)[_0x5614('0x2a')](function(_0x998346){_0x37a493[_0x5614('0x24')]=_0x998346;if(_0xfd4977['query'][_0x5614('0x49')]){_0xd75ac8[_0x5614('0x4a')]=[{'all':!![]}];}return db[_0x5614('0x33')][_0x5614('0x4b')](_0xd75ac8);})[_0x5614('0x2a')](function(_0x2ee36c){_0x37a493[_0x5614('0x4c')]=_0x2ee36c;return _0x37a493;})[_0x5614('0x2a')](respondWithFilteredResult(_0x379a50,_0xd75ac8))[_0x5614('0x4d')](handleError(_0x379a50,null));};exports[_0x5614('0x4e')]=function(_0x4d4620,_0x17821e){var _0x3c2fae={'raw':!![],'where':{'id':_0x4d4620[_0x5614('0x4f')]['id']}},_0x41e1c0={};_0x41e1c0['model']=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x41e1c0[_0x5614('0x3a')]=_['keys'](_0x4d4620[_0x5614('0x3a')]);_0x41e1c0[_0x5614('0x3b')]=_[_0x5614('0x3c')](_0x41e1c0[_0x5614('0x37')],_0x41e1c0[_0x5614('0x3a')]);_0x3c2fae[_0x5614('0x3e')]=_[_0x5614('0x3c')](_0x41e1c0[_0x5614('0x37')],qs[_0x5614('0x3d')](_0x4d4620['query']['fields']));_0x3c2fae[_0x5614('0x3e')]=_0x3c2fae[_0x5614('0x3e')]['length']?_0x3c2fae[_0x5614('0x3e')]:_0x41e1c0['model'];if(_0x4d4620[_0x5614('0x3a')][_0x5614('0x49')]){_0x3c2fae[_0x5614('0x4a')]=[{'all':!![]}];}_0x3c2fae=_[_0x5614('0x46')]({},_0x3c2fae,_0x4d4620[_0x5614('0x48')]);return db[_0x5614('0x33')][_0x5614('0x50')](_0x3c2fae)[_0x5614('0x2a')](handleEntityNotFound(_0x17821e,null))[_0x5614('0x2a')](respondWithResult(_0x17821e,null))['catch'](handleError(_0x17821e,null));};exports['create']=function(_0x4474c2,_0x40d434){return db['OpenchannelQueue'][_0x5614('0x51')](_0x4474c2['body'],{})[_0x5614('0x2a')](function(_0x4c231){var _0x3e6bfa=_0x4474c2[_0x5614('0x52')][_0x5614('0x2c')]({'plain':!![]});if(!_0x3e6bfa)throw new Error(_0x5614('0x53'));if(_0x3e6bfa[_0x5614('0x54')]===_0x5614('0x52')){var _0x155805=_0x4c231[_0x5614('0x2c')]({'plain':!![]});var _0x3b75f4=_0x5614('0x2d');return db[_0x5614('0x55')][_0x5614('0x50')]({'where':{'name':_0x3b75f4,'userProfileId':_0x3e6bfa['userProfileId']},'raw':!![]})[_0x5614('0x2a')](function(_0x1de21d){if(_0x1de21d&&_0x1de21d['autoAssociation']===0x0){return db[_0x5614('0x2e')][_0x5614('0x51')]({'name':_0x155805['name'],'resourceId':_0x155805['id'],'type':_0x1de21d[_0x5614('0x30')],'sectionId':_0x1de21d['id']},{})[_0x5614('0x2a')](function(){return _0x4c231;});}else{return _0x4c231;}})[_0x5614('0x4d')](function(_0x21587e){logger[_0x5614('0x2f')](_0x5614('0x56'),_0x21587e);throw _0x21587e;});}return _0x4c231;})['then'](respondWithResult(_0x40d434,0xc9))[_0x5614('0x4d')](handleError(_0x40d434,null));};exports[_0x5614('0x57')]=function(_0x1fd35f,_0x20efa5){if(_0x1fd35f[_0x5614('0x58')]['id']){delete _0x1fd35f[_0x5614('0x58')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x1fd35f[_0x5614('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20efa5,null))[_0x5614('0x2a')](saveUpdates(_0x1fd35f[_0x5614('0x58')],null))['then'](respondWithResult(_0x20efa5,null))[_0x5614('0x4d')](handleError(_0x20efa5,null));};exports[_0x5614('0x2b')]=function(_0x8f3a76,_0x32f6eb){return db[_0x5614('0x33')][_0x5614('0x50')]({'where':{'id':_0x8f3a76[_0x5614('0x4f')]['id']}})[_0x5614('0x2a')](handleEntityNotFound(_0x32f6eb,null))[_0x5614('0x2a')](removeEntity(_0x32f6eb,null))[_0x5614('0x4d')](handleError(_0x32f6eb,null));};exports[_0x5614('0x59')]=function(_0x3179bb,_0x1c8159){return db[_0x5614('0x33')][_0x5614('0x59')]()['then'](respondWithResult(_0x1c8159,null))[_0x5614('0x4d')](handleError(_0x1c8159,null));};exports[_0x5614('0x5a')]=function(_0x898fca,_0x32ebb4,_0x218c61){var _0x36a780={'raw':!![],'where':{}},_0x27f5ed={},_0x4197bb;return db[_0x5614('0x33')][_0x5614('0x5b')]({'where':{'id':_0x898fca[_0x5614('0x4f')]['id']}})[_0x5614('0x2a')](handleEntityNotFound(_0x32ebb4,null))[_0x5614('0x2a')](function(_0x38830d){if(_0x38830d){_0x4197bb=_0x38830d[_0x5614('0x2c')]({'plain':!![]});_0x27f5ed[_0x5614('0x37')]=_[_0x5614('0x39')](db['UserOpenchannelQueue']['rawAttributes']);_0x27f5ed[_0x5614('0x3a')]=_[_0x5614('0x39')](_0x898fca[_0x5614('0x3a')]);_0x27f5ed['filters']=_[_0x5614('0x3c')](_0x27f5ed[_0x5614('0x37')],_0x27f5ed[_0x5614('0x3a')]);_0x36a780[_0x5614('0x3e')]=_[_0x5614('0x3c')](_0x27f5ed[_0x5614('0x37')],qs[_0x5614('0x3d')](_0x898fca[_0x5614('0x3a')][_0x5614('0x3d')]));_0x36a780[_0x5614('0x3e')]=_0x36a780['attributes'][_0x5614('0x5c')]?_0x36a780[_0x5614('0x3e')]:_0x27f5ed[_0x5614('0x37')];if(!_0x898fca[_0x5614('0x3a')]['hasOwnProperty'](_0x5614('0x40'))){_0x36a780[_0x5614('0x23')]=qs[_0x5614('0x23')](_0x898fca[_0x5614('0x3a')]['limit']);_0x36a780['offset']=qs[_0x5614('0x21')](_0x898fca[_0x5614('0x3a')][_0x5614('0x21')]);}_0x36a780[_0x5614('0x41')]=qs[_0x5614('0x42')](_0x898fca['query']['sort']);_0x36a780[_0x5614('0x45')]=qs['filters'](_['pick'](_0x898fca[_0x5614('0x3a')],_0x27f5ed[_0x5614('0x3b')]));_0x36a780[_0x5614('0x45')]['OpenchannelQueueId']=_0x38830d['id'];if(_0x898fca['query'][_0x5614('0x44')]){_0x36a780[_0x5614('0x45')]=_[_0x5614('0x46')](_0x36a780[_0x5614('0x45')],{'$or':_[_0x5614('0x38')](_0x36a780[_0x5614('0x3e')],function(_0x44b5cf){var _0x1af0f7={};_0x1af0f7[_0x44b5cf]={'$like':'%'+_0x898fca[_0x5614('0x3a')][_0x5614('0x44')]+'%'};return _0x1af0f7;})});}_0x36a780=_['merge']({},_0x36a780,_0x898fca[_0x5614('0x48')]);return db[_0x5614('0x5d')][_0x5614('0x4b')](_0x36a780);}})['then'](function(_0x82ccd1){if(_0x82ccd1){return db[_0x5614('0x5e')][_0x5614('0x5f')]({'where':{'id':_[_0x5614('0x38')](_0x82ccd1,'UserId'),'role':_0x5614('0x60')},'attributes':['id',_0x5614('0x30'),_0x5614('0x61'),_0x5614('0x62'),_0x5614('0x63')]});}})[_0x5614('0x2a')](function(_0x7685ad){if(_0x7685ad){return{'count':_0x7685ad[_0x5614('0x24')],'rows':_[_0x5614('0x38')](_0x7685ad[_0x5614('0x4c')],function(_0x446307){return{'membername':_0x446307[_0x5614('0x30')],'UserId':_0x446307['id'],'queue_name':_0x4197bb['name'],'OpenchannelQueueId':_0x4197bb['id'],'interface':util[_0x5614('0x64')](_0x5614('0x65'),'SIP',_0x446307[_0x5614('0x30')]),'penalty':0x0,'paused':_0x446307['openchannelPause'],'createdAt':_0x446307[_0x5614('0x63')],'updatedAt':_0x446307['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5614('0x2a')](respondWithFilteredResult(_0x32ebb4,_0x36a780))[_0x5614('0x4d')](handleError(_0x32ebb4,null));};exports['getTeams']=function(_0x4bf03e,_0x2b5d41,_0xf5ce34){var _0x53f7ef={};var _0x284761={};var _0x1b370a;var _0x405e41;return db[_0x5614('0x33')][_0x5614('0x5b')]({'where':{'id':_0x4bf03e[_0x5614('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b5d41,null))[_0x5614('0x2a')](function(_0x19e7fb){if(_0x19e7fb){_0x1b370a=_0x19e7fb;_0x284761[_0x5614('0x37')]=_[_0x5614('0x39')](db['Team']['rawAttributes']);_0x284761[_0x5614('0x3a')]=_[_0x5614('0x39')](_0x4bf03e[_0x5614('0x3a')]);_0x284761[_0x5614('0x3b')]=_[_0x5614('0x3c')](_0x284761[_0x5614('0x37')],_0x284761[_0x5614('0x3a')]);_0x53f7ef[_0x5614('0x3e')]=_[_0x5614('0x3c')](_0x284761[_0x5614('0x37')],qs[_0x5614('0x3d')](_0x4bf03e['query'][_0x5614('0x3d')]));_0x53f7ef[_0x5614('0x3e')]=_0x53f7ef[_0x5614('0x3e')][_0x5614('0x5c')]?_0x53f7ef['attributes']:_0x284761[_0x5614('0x37')];_0x53f7ef['order']=qs[_0x5614('0x42')](_0x4bf03e[_0x5614('0x3a')][_0x5614('0x42')]);_0x53f7ef[_0x5614('0x45')]=qs[_0x5614('0x3b')](_[_0x5614('0x43')](_0x4bf03e[_0x5614('0x3a')],_0x284761[_0x5614('0x3b')]));if(_0x4bf03e[_0x5614('0x3a')]['filter']){_0x53f7ef['where']=_[_0x5614('0x46')](_0x53f7ef[_0x5614('0x45')],{'$or':_[_0x5614('0x38')](_0x53f7ef[_0x5614('0x3e')],function(_0x5456d6){var _0x59c26a={};_0x59c26a[_0x5456d6]={'$like':'%'+_0x4bf03e[_0x5614('0x3a')][_0x5614('0x44')]+'%'};return _0x59c26a;})});}_0x53f7ef=_[_0x5614('0x46')]({},_0x53f7ef,_0x4bf03e['options']);return _0x1b370a[_0x5614('0x66')](_0x53f7ef);}})[_0x5614('0x2a')](function(_0x1c5d77){if(_0x1c5d77){_0x405e41=_0x1c5d77[_0x5614('0x5c')];if(!_0x4bf03e[_0x5614('0x3a')][_0x5614('0x3f')]('nolimit')){_0x53f7ef[_0x5614('0x23')]=qs[_0x5614('0x23')](_0x4bf03e[_0x5614('0x3a')][_0x5614('0x23')]);_0x53f7ef[_0x5614('0x21')]=qs[_0x5614('0x21')](_0x4bf03e[_0x5614('0x3a')][_0x5614('0x21')]);}return _0x1b370a[_0x5614('0x66')](_0x53f7ef);}})[_0x5614('0x2a')](function(_0x41a827){if(_0x41a827){return _0x41a827?{'count':_0x405e41,'rows':_0x41a827}:null;}})[_0x5614('0x2a')](respondWithResult(_0x2b5d41,null))[_0x5614('0x4d')](handleError(_0x2b5d41,null));};exports[_0x5614('0x67')]=function(_0x224b6d,_0x2d49ca,_0x1df105){var _0x50bb56=_0x224b6d[_0x5614('0x58')][_0x5614('0x68')];return db[_0x5614('0x69')][_0x5614('0x4b')]({'where':{'id':_0x50bb56},'attributes':['id'],'include':[{'model':db[_0x5614('0x5e')],'as':_0x5614('0x6a'),'attributes':['id','name','online','voicePause',_0x5614('0x6b')],'raw':!![]}]})[_0x5614('0x2a')](function(_0x4e8088){if(_0x4e8088){var _0x4cc5ed=_[_0x5614('0x6c')](_0x4e8088,function(_0x56332d){var _0x3b8210=_0x56332d[_0x5614('0x2c')]({'plain':!![]});return _0x3b8210[_0x5614('0x6a')];});return db[_0x5614('0x33')]['find']({'where':{'id':_0x224b6d['params']['id']}})[_0x5614('0x2a')](function(_0x35b2fa){return db[_0x5614('0x6d')][_0x5614('0x6e')](function(_0x4b3f4b){return _0x35b2fa[_0x5614('0x67')](_0x50bb56,{'transaction':_0x4b3f4b})[_0x5614('0x2a')](function(){return BPromise[_0x5614('0x6f')](_0x4cc5ed,function(_0x4d9d63){return db[_0x5614('0x5d')]['findOrCreate']({'where':{'UserId':_0x4d9d63['id'],'OpenchannelQueueId':_0x224b6d['params']['id']},'transaction':_0x4b3f4b});});})['then'](function(){_0x4cc5ed[_0x5614('0x70')](function(_0x315a83){socket[_0x5614('0x71')]('userOpenchannelQueue:save',{'UserId':_0x315a83['id'],'OpenchannelQueueId':_0x35b2fa['id']});});});});});}})[_0x5614('0x2a')](respondWithStatusCode(_0x2d49ca,null))[_0x5614('0x4d')](handleError(_0x2d49ca,null));};exports[_0x5614('0x72')]=function(_0x347916,_0x5d225c,_0x8a55a5){return db['Team'][_0x5614('0x4b')]({'where':{'id':_0x347916[_0x5614('0x3a')][_0x5614('0x68')]},'attributes':['id'],'include':[{'model':db[_0x5614('0x5e')],'as':_0x5614('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5614('0x2a')](handleEntityNotFound(_0x5d225c,null))[_0x5614('0x2a')](function(_0x5da551){var _0x45c47e=_['map'](_0x5da551,'id');var _0x59afa3=[];var _0x546c7c=[];var _0x306b5b=squel['select']();_0x306b5b[_0x5614('0x73')](_0x5614('0x74'))[_0x5614('0x75')](_0x5614('0x76'),'tq')[_0x5614('0x77')](_0x5614('0x78'),'ut',_0x5614('0x79'))[_0x5614('0x45')](_0x5614('0x7a'),_0x347916[_0x5614('0x4f')]['id']);for(var _0x20c52a=0x0;_0x20c52a<_0x5da551[_0x5614('0x5c')];_0x20c52a+=0x1){let _0x11be24=_0x5da551[_0x20c52a];for(var _0x42040a=0x0;_0x42040a<_0x11be24[_0x5614('0x6a')][_0x5614('0x5c')];_0x42040a+=0x1){let _0x1f6543=_0x11be24['Agents'][_0x42040a];var _0x210be8=_0x306b5b[_0x5614('0x7b')]();_0x210be8['where'](_0x5614('0x7c'),_0x1f6543['id']);_0x546c7c[_0x5614('0x7d')](db[_0x5614('0x6d')][_0x5614('0x3a')](_0x210be8['toString'](),{'type':db[_0x5614('0x6d')]['QueryTypes'][_0x5614('0x7e')]})[_0x5614('0x2a')](function(_0x35a214){if(_0x35a214['length']===0x1){return _0x1f6543['id'];}else{var _0x5d1c08=_[_0x5614('0x7f')](_[_0x5614('0x38')](_0x35a214,_0x5614('0x80')),function(_0x37ce6b){return _[_0x5614('0x81')](_0x45c47e,_0x37ce6b);});if(_0x5d1c08){return _0x1f6543['id'];}}}));}}return BPromise[_0x5614('0x82')](_0x546c7c)[_0x5614('0x2a')](function(_0x3aadc0){_0x59afa3=_(_0x59afa3)['union'](_0x3aadc0)[_0x5614('0x83')]()['value']();return db['OpenchannelQueue'][_0x5614('0x50')]({'where':{'id':_0x347916[_0x5614('0x4f')]['id']}})[_0x5614('0x2a')](function(_0x2232d9){return db[_0x5614('0x6d')][_0x5614('0x6e')](function(_0x4ddee8){return _0x2232d9[_0x5614('0x72')](_0x347916[_0x5614('0x3a')][_0x5614('0x68')],{'transaction':_0x4ddee8})['then'](function(){if(!_[_0x5614('0x84')](_0x59afa3)){return _0x2232d9[_0x5614('0x85')](_0x59afa3,{'transaction':_0x4ddee8});}})['then'](function(){_0x59afa3[_0x5614('0x70')](function(_0x1db4f0){socket['emit'](_0x5614('0x86'),{'UserId':_0x1db4f0,'OpenchannelQueueId':_0x2232d9['id']});});});});});});})[_0x5614('0x2a')](respondWithStatusCode(_0x5d225c,null))[_0x5614('0x4d')](handleError(_0x5d225c,null));};exports[_0x5614('0x87')]=function(_0x2ce15a,_0x2f51ed,_0x4c8a76){return db[_0x5614('0x33')]['find']({'where':{'id':_0x2ce15a[_0x5614('0x4f')]['id']}})[_0x5614('0x2a')](handleEntityNotFound(_0x2f51ed,null))[_0x5614('0x2a')](function(_0x41e9f0){if(_0x41e9f0){return _0x41e9f0['addAgents'](_0x2ce15a[_0x5614('0x58')][_0x5614('0x68')],_[_0x5614('0x88')](_0x2ce15a[_0x5614('0x58')],['ids','id'])||{})[_0x5614('0x89')](function(_0x3d810e){for(var _0x4fe7d7=0x0;_0x4fe7d7<_0x2ce15a[_0x5614('0x58')][_0x5614('0x68')][_0x5614('0x5c')];_0x4fe7d7+=0x1){socket[_0x5614('0x71')](_0x5614('0x8a'),{'UserId':Number(_0x2ce15a[_0x5614('0x58')][_0x5614('0x68')][_0x4fe7d7]),'OpenchannelQueueId':Number(_0x2ce15a[_0x5614('0x4f')]['id'])});}return _0x3d810e;});}})[_0x5614('0x2a')](respondWithResult(_0x2f51ed,null))['catch'](handleError(_0x2f51ed,null));};exports[_0x5614('0x85')]=function(_0x43dfcb,_0x171b25,_0x527122){return db[_0x5614('0x33')][_0x5614('0x50')]({'where':{'id':_0x43dfcb['params']['id']}})[_0x5614('0x2a')](handleEntityNotFound(_0x171b25,null))[_0x5614('0x2a')](function(_0x500fbc){if(_0x500fbc){return _0x500fbc['removeAgents'](_0x43dfcb[_0x5614('0x3a')][_0x5614('0x68')])[_0x5614('0x2a')](function(){if(_['isArray'](_0x43dfcb['query']['ids'])){for(var _0x1a6ede=0x0;_0x1a6ede<_0x43dfcb[_0x5614('0x3a')]['ids'][_0x5614('0x5c')];_0x1a6ede+=0x1){socket[_0x5614('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x43dfcb[_0x5614('0x3a')][_0x5614('0x68')][_0x1a6ede]),'OpenchannelQueueId':Number(_0x43dfcb[_0x5614('0x4f')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x43dfcb[_0x5614('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x43dfcb[_0x5614('0x4f')]['id'])});}});}})[_0x5614('0x2a')](respondWithStatusCode(_0x171b25,null))[_0x5614('0x4d')](handleError(_0x171b25,null));};exports['getAgents']=function(_0x444ba0,_0x49cc88,_0x279df7){var _0x3202a8={};var _0x1c49b5={};var _0x452d9c;var _0x34d1a1;return db['OpenchannelQueue'][_0x5614('0x5b')]({'where':{'id':_0x444ba0[_0x5614('0x4f')]['id']}})[_0x5614('0x2a')](handleEntityNotFound(_0x49cc88,null))[_0x5614('0x2a')](function(_0x59cd3c){if(_0x59cd3c){_0x452d9c=_0x59cd3c;_0x1c49b5[_0x5614('0x37')]=_[_0x5614('0x39')](db[_0x5614('0x5e')]['rawAttributes']);_0x1c49b5[_0x5614('0x3a')]=_['keys'](_0x444ba0[_0x5614('0x3a')]);_0x1c49b5[_0x5614('0x3b')]=_['intersection'](_0x1c49b5[_0x5614('0x37')],_0x1c49b5['query']);_0x3202a8['attributes']=_[_0x5614('0x3c')](_0x1c49b5[_0x5614('0x37')],qs[_0x5614('0x3d')](_0x444ba0[_0x5614('0x3a')][_0x5614('0x3d')]));_0x3202a8[_0x5614('0x3e')]=_0x3202a8[_0x5614('0x3e')][_0x5614('0x5c')]?_0x3202a8[_0x5614('0x3e')]:_0x1c49b5[_0x5614('0x37')];_0x3202a8['order']=qs[_0x5614('0x42')](_0x444ba0[_0x5614('0x3a')][_0x5614('0x42')]);_0x3202a8[_0x5614('0x45')]=qs[_0x5614('0x3b')](_['pick'](_0x444ba0[_0x5614('0x3a')],_0x1c49b5[_0x5614('0x3b')]));if(_0x444ba0[_0x5614('0x3a')][_0x5614('0x44')]){_0x3202a8[_0x5614('0x45')]=_['merge'](_0x3202a8[_0x5614('0x45')],{'$or':_[_0x5614('0x38')](_0x3202a8[_0x5614('0x3e')],function(_0x298e0e){var _0x2dc323={};_0x2dc323[_0x298e0e]={'$like':'%'+_0x444ba0['query'][_0x5614('0x44')]+'%'};return _0x2dc323;})});}_0x3202a8=_[_0x5614('0x46')]({},_0x3202a8,_0x444ba0[_0x5614('0x48')]);return _0x452d9c[_0x5614('0x8b')](_0x3202a8);}})['then'](function(_0x1d7806){if(_0x1d7806){_0x34d1a1=_0x1d7806[_0x5614('0x5c')];if(!_0x444ba0[_0x5614('0x3a')][_0x5614('0x3f')](_0x5614('0x40'))){_0x3202a8[_0x5614('0x23')]=qs[_0x5614('0x23')](_0x444ba0[_0x5614('0x3a')]['limit']);_0x3202a8[_0x5614('0x21')]=qs[_0x5614('0x21')](_0x444ba0[_0x5614('0x3a')][_0x5614('0x21')]);}return _0x452d9c['getAgents'](_0x3202a8);}})[_0x5614('0x2a')](function(_0x4abf76){if(_0x4abf76){return _0x4abf76?{'count':_0x34d1a1,'rows':_0x4abf76}:null;}})[_0x5614('0x2a')](respondWithResult(_0x49cc88,null))[_0x5614('0x4d')](handleError(_0x49cc88,null));}; \ No newline at end of file +var _0x4b6c=['addTeams','ids','Agents','online','interface','flatMap','sequelize','each','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','describe','getMembers','findOne','UserOpenchannelQueue','sort','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','%s/%s','SIP','createdAt','Team','order','getTeams'];(function(_0x509771,_0x3b6a5d){var _0x1ed8fe=function(_0x23d971){while(--_0x23d971){_0x509771['push'](_0x509771['shift']());}};_0x1ed8fe(++_0x3b6a5d);}(_0x4b6c,0xad));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc4b6('0x0'));var rimraf=require(_0xc4b6('0x1'));var zipdir=require(_0xc4b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4b6('0x3'));var moment=require(_0xc4b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4b6('0x5'));var util=require(_0xc4b6('0x6'));var path=require(_0xc4b6('0x7'));var sox=require(_0xc4b6('0x8'));var csv=require('to-csv');var ejs=require(_0xc4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4b6('0xb'));var deskjs=require(_0xc4b6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4b6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc4b6('0xe'));var hardwareService=require(_0xc4b6('0xf'));var logger=require(_0xc4b6('0x10'))(_0xc4b6('0x11'));var utils=require('../../config/utils');var config=require(_0xc4b6('0x12'));var licenseUtil=require(_0xc4b6('0x13'));var db=require(_0xc4b6('0x14'))['db'];config[_0xc4b6('0x15')]=_['defaults'](config[_0xc4b6('0x15')],{'host':_0xc4b6('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4b6('0x15')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x290d5d,_0x25bff3){_0x25bff3=_0x25bff3||0xcc;return function(_0x3dbe29){if(_0x3dbe29){return _0x290d5d[_0xc4b6('0x17')](_0x25bff3);}return _0x290d5d[_0xc4b6('0x18')](_0x25bff3)[_0xc4b6('0x19')]();};}function respondWithResult(_0x35a423,_0x4a4411){_0x4a4411=_0x4a4411||0xc8;return function(_0x1afd2f){if(_0x1afd2f){return _0x35a423['status'](_0x4a4411)[_0xc4b6('0x1a')](_0x1afd2f);}};}function respondWithFilteredResult(_0x1a17ba,_0x292b20){return function(_0xd36b20){if(_0xd36b20){var _0x4afee8=typeof _0x292b20[_0xc4b6('0x1b')]===_0xc4b6('0x1c')&&typeof _0x292b20[_0xc4b6('0x1d')]===_0xc4b6('0x1c');var _0x5098f5=_0xd36b20[_0xc4b6('0x1e')];var _0x2385ab=_0x4afee8?0x0:_0x292b20['offset'];var _0x210ede=_0x4afee8?_0xd36b20['count']:_0x292b20['offset']+_0x292b20[_0xc4b6('0x1d')];var _0x2b86a8;if(_0x210ede>=_0x5098f5){_0x210ede=_0x5098f5;_0x2b86a8=0xc8;}else{_0x2b86a8=0xce;}_0x1a17ba[_0xc4b6('0x18')](_0x2b86a8);return _0x1a17ba[_0xc4b6('0x1f')](_0xc4b6('0x20'),_0x2385ab+'-'+_0x210ede+'/'+_0x5098f5)['json'](_0xd36b20);}return null;};}function patchUpdates(_0x15c256){return function(_0x5a3b2d){try{jsonpatch['apply'](_0x5a3b2d,_0x15c256,!![]);}catch(_0x2c230b){return BPromise['reject'](_0x2c230b);}return _0x5a3b2d['save']();};}function saveUpdates(_0x7e7775,_0x222ab3){return function(_0x4c5f21){if(_0x4c5f21){return _0x4c5f21[_0xc4b6('0x21')](_0x7e7775)[_0xc4b6('0x22')](function(_0x427bc1){return _0x427bc1;});}return null;};}function removeEntity(_0x316e85,_0x3da38a){return function(_0x37c4b7){if(_0x37c4b7){return _0x37c4b7[_0xc4b6('0x23')]()['then'](function(){var _0x4d94aa=_0x37c4b7[_0xc4b6('0x24')]({'plain':!![]});var _0x5ac25e=_0xc4b6('0x25');return db[_0xc4b6('0x26')]['destroy']({'where':{'type':_0x5ac25e,'resourceId':_0x4d94aa['id']}})[_0xc4b6('0x22')](function(){return _0x37c4b7;});})['then'](function(){_0x316e85[_0xc4b6('0x18')](0xcc)[_0xc4b6('0x19')]();});}};}function handleEntityNotFound(_0x1972ee,_0x2398e1){return function(_0x1e81fd){if(!_0x1e81fd){_0x1972ee['sendStatus'](0x194);}return _0x1e81fd;};}function handleError(_0x37f0f4,_0x7b0b9b){_0x7b0b9b=_0x7b0b9b||0x1f4;return function(_0xdfe868){logger[_0xc4b6('0x27')](_0xdfe868[_0xc4b6('0x28')]);if(_0xdfe868[_0xc4b6('0x29')]){delete _0xdfe868[_0xc4b6('0x29')];}_0x37f0f4[_0xc4b6('0x18')](_0x7b0b9b)[_0xc4b6('0x2a')](_0xdfe868);};}exports['index']=function(_0x21290e,_0x165d62){var _0x3100e1={},_0x35ed02={},_0x497980={'count':0x0,'rows':[]};var _0x1f24dc=_[_0xc4b6('0x2b')](db[_0xc4b6('0x2c')][_0xc4b6('0x2d')],function(_0x5ad644){return{'name':_0x5ad644[_0xc4b6('0x2e')],'type':_0x5ad644[_0xc4b6('0x2f')][_0xc4b6('0x30')]};});_0x35ed02[_0xc4b6('0x31')]=_['map'](_0x1f24dc,_0xc4b6('0x29'));_0x35ed02[_0xc4b6('0x32')]=_[_0xc4b6('0x33')](_0x21290e[_0xc4b6('0x32')]);_0x35ed02['filters']=_[_0xc4b6('0x34')](_0x35ed02[_0xc4b6('0x31')],_0x35ed02[_0xc4b6('0x32')]);_0x3100e1[_0xc4b6('0x35')]=_['intersection'](_0x35ed02[_0xc4b6('0x31')],qs[_0xc4b6('0x36')](_0x21290e[_0xc4b6('0x32')][_0xc4b6('0x36')]));_0x3100e1[_0xc4b6('0x35')]=_0x3100e1[_0xc4b6('0x35')][_0xc4b6('0x37')]?_0x3100e1[_0xc4b6('0x35')]:_0x35ed02[_0xc4b6('0x31')];if(!_0x21290e[_0xc4b6('0x32')][_0xc4b6('0x38')]('nolimit')){_0x3100e1[_0xc4b6('0x1d')]=qs[_0xc4b6('0x1d')](_0x21290e[_0xc4b6('0x32')]['limit']);_0x3100e1[_0xc4b6('0x1b')]=qs['offset'](_0x21290e['query'][_0xc4b6('0x1b')]);}_0x3100e1['order']=qs['sort'](_0x21290e['query']['sort']);_0x3100e1[_0xc4b6('0x39')]=qs[_0xc4b6('0x3a')](_[_0xc4b6('0x3b')](_0x21290e['query'],_0x35ed02[_0xc4b6('0x3a')]),_0x1f24dc);if(_0x21290e[_0xc4b6('0x32')][_0xc4b6('0x3c')]){_0x3100e1[_0xc4b6('0x39')]=_[_0xc4b6('0x3d')](_0x3100e1[_0xc4b6('0x39')],{'$or':_['map'](_0x1f24dc,function(_0x18bb48){if(_0x18bb48['type']!==_0xc4b6('0x3e')){var _0x58cf86={};_0x58cf86[_0x18bb48['name']]={'$like':'%'+_0x21290e[_0xc4b6('0x32')]['filter']+'%'};return _0x58cf86;}})});}_0x3100e1=_[_0xc4b6('0x3d')]({},_0x3100e1,_0x21290e['options']);var _0x15edbc={'where':_0x3100e1[_0xc4b6('0x39')]};return db[_0xc4b6('0x2c')][_0xc4b6('0x1e')](_0x15edbc)[_0xc4b6('0x22')](function(_0x9f2661){_0x497980[_0xc4b6('0x1e')]=_0x9f2661;if(_0x21290e[_0xc4b6('0x32')][_0xc4b6('0x3f')]){_0x3100e1[_0xc4b6('0x40')]=[{'all':!![]}];}return db[_0xc4b6('0x2c')][_0xc4b6('0x41')](_0x3100e1);})[_0xc4b6('0x22')](function(_0x5a849c){_0x497980[_0xc4b6('0x42')]=_0x5a849c;return _0x497980;})[_0xc4b6('0x22')](respondWithFilteredResult(_0x165d62,_0x3100e1))['catch'](handleError(_0x165d62,null));};exports[_0xc4b6('0x43')]=function(_0x3f111e,_0x3cbcd2){var _0x30023b={'raw':!![],'where':{'id':_0x3f111e[_0xc4b6('0x44')]['id']}},_0x4cd4f1={};_0x4cd4f1[_0xc4b6('0x31')]=_[_0xc4b6('0x33')](db[_0xc4b6('0x2c')]['rawAttributes']);_0x4cd4f1[_0xc4b6('0x32')]=_['keys'](_0x3f111e[_0xc4b6('0x32')]);_0x4cd4f1[_0xc4b6('0x3a')]=_['intersection'](_0x4cd4f1[_0xc4b6('0x31')],_0x4cd4f1[_0xc4b6('0x32')]);_0x30023b[_0xc4b6('0x35')]=_[_0xc4b6('0x34')](_0x4cd4f1[_0xc4b6('0x31')],qs['fields'](_0x3f111e[_0xc4b6('0x32')][_0xc4b6('0x36')]));_0x30023b['attributes']=_0x30023b[_0xc4b6('0x35')]['length']?_0x30023b[_0xc4b6('0x35')]:_0x4cd4f1['model'];if(_0x3f111e[_0xc4b6('0x32')][_0xc4b6('0x3f')]){_0x30023b['include']=[{'all':!![]}];}_0x30023b=_[_0xc4b6('0x3d')]({},_0x30023b,_0x3f111e[_0xc4b6('0x45')]);return db[_0xc4b6('0x2c')][_0xc4b6('0x46')](_0x30023b)[_0xc4b6('0x22')](handleEntityNotFound(_0x3cbcd2,null))[_0xc4b6('0x22')](respondWithResult(_0x3cbcd2,null))[_0xc4b6('0x47')](handleError(_0x3cbcd2,null));};exports['create']=function(_0x4e0cd9,_0x45142b){return db[_0xc4b6('0x2c')][_0xc4b6('0x48')](_0x4e0cd9['body'],{})['then'](function(_0x4a8b4a){var _0x40007f=_0x4e0cd9[_0xc4b6('0x49')][_0xc4b6('0x24')]({'plain':!![]});if(!_0x40007f)throw new Error(_0xc4b6('0x4a'));if(_0x40007f['role']===_0xc4b6('0x49')){var _0x261ba5=_0x4a8b4a[_0xc4b6('0x24')]({'plain':!![]});var _0x4f6cdf=_0xc4b6('0x25');return db[_0xc4b6('0x4b')][_0xc4b6('0x46')]({'where':{'name':_0x4f6cdf,'userProfileId':_0x40007f['userProfileId']},'raw':!![]})[_0xc4b6('0x22')](function(_0x21d1fd){if(_0x21d1fd&&_0x21d1fd['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x261ba5['name'],'resourceId':_0x261ba5['id'],'type':_0x21d1fd['name'],'sectionId':_0x21d1fd['id']},{})['then'](function(){return _0x4a8b4a;});}else{return _0x4a8b4a;}})[_0xc4b6('0x47')](function(_0x662135){logger[_0xc4b6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x662135);throw _0x662135;});}return _0x4a8b4a;})[_0xc4b6('0x22')](respondWithResult(_0x45142b,0xc9))['catch'](handleError(_0x45142b,null));};exports[_0xc4b6('0x21')]=function(_0x8f61b3,_0x2375cd){if(_0x8f61b3[_0xc4b6('0x4c')]['id']){delete _0x8f61b3[_0xc4b6('0x4c')]['id'];}return db[_0xc4b6('0x2c')][_0xc4b6('0x46')]({'where':{'id':_0x8f61b3[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x22')](handleEntityNotFound(_0x2375cd,null))[_0xc4b6('0x22')](saveUpdates(_0x8f61b3[_0xc4b6('0x4c')],null))['then'](respondWithResult(_0x2375cd,null))[_0xc4b6('0x47')](handleError(_0x2375cd,null));};exports[_0xc4b6('0x23')]=function(_0x5ce13d,_0x2df898){return db['OpenchannelQueue'][_0xc4b6('0x46')]({'where':{'id':_0x5ce13d[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x22')](handleEntityNotFound(_0x2df898,null))[_0xc4b6('0x22')](removeEntity(_0x2df898,null))[_0xc4b6('0x47')](handleError(_0x2df898,null));};exports[_0xc4b6('0x4d')]=function(_0x4cbdcb,_0x5e8531){return db[_0xc4b6('0x2c')][_0xc4b6('0x4d')]()[_0xc4b6('0x22')](respondWithResult(_0x5e8531,null))['catch'](handleError(_0x5e8531,null));};exports[_0xc4b6('0x4e')]=function(_0x57c943,_0x18f8e2,_0x25836a){var _0x3b79ac={'raw':!![],'where':{}},_0x489e76={},_0x4fc400;return db['OpenchannelQueue'][_0xc4b6('0x4f')]({'where':{'id':_0x57c943[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x22')](handleEntityNotFound(_0x18f8e2,null))[_0xc4b6('0x22')](function(_0x51dca2){if(_0x51dca2){_0x4fc400=_0x51dca2[_0xc4b6('0x24')]({'plain':!![]});_0x489e76[_0xc4b6('0x31')]=_[_0xc4b6('0x33')](db[_0xc4b6('0x50')][_0xc4b6('0x2d')]);_0x489e76[_0xc4b6('0x32')]=_['keys'](_0x57c943['query']);_0x489e76[_0xc4b6('0x3a')]=_['intersection'](_0x489e76[_0xc4b6('0x31')],_0x489e76[_0xc4b6('0x32')]);_0x3b79ac[_0xc4b6('0x35')]=_[_0xc4b6('0x34')](_0x489e76['model'],qs[_0xc4b6('0x36')](_0x57c943[_0xc4b6('0x32')][_0xc4b6('0x36')]));_0x3b79ac[_0xc4b6('0x35')]=_0x3b79ac[_0xc4b6('0x35')][_0xc4b6('0x37')]?_0x3b79ac['attributes']:_0x489e76[_0xc4b6('0x31')];if(!_0x57c943[_0xc4b6('0x32')]['hasOwnProperty']('nolimit')){_0x3b79ac[_0xc4b6('0x1d')]=qs[_0xc4b6('0x1d')](_0x57c943[_0xc4b6('0x32')]['limit']);_0x3b79ac[_0xc4b6('0x1b')]=qs['offset'](_0x57c943[_0xc4b6('0x32')][_0xc4b6('0x1b')]);}_0x3b79ac['order']=qs[_0xc4b6('0x51')](_0x57c943[_0xc4b6('0x32')]['sort']);_0x3b79ac[_0xc4b6('0x39')]=qs['filters'](_[_0xc4b6('0x3b')](_0x57c943[_0xc4b6('0x32')],_0x489e76[_0xc4b6('0x3a')]));_0x3b79ac[_0xc4b6('0x39')][_0xc4b6('0x52')]=_0x51dca2['id'];if(_0x57c943[_0xc4b6('0x32')][_0xc4b6('0x3c')]){_0x3b79ac[_0xc4b6('0x39')]=_[_0xc4b6('0x3d')](_0x3b79ac['where'],{'$or':_[_0xc4b6('0x2b')](_0x3b79ac[_0xc4b6('0x35')],function(_0x42d512){var _0x31b0b6={};_0x31b0b6[_0x42d512]={'$like':'%'+_0x57c943[_0xc4b6('0x32')][_0xc4b6('0x3c')]+'%'};return _0x31b0b6;})});}_0x3b79ac=_[_0xc4b6('0x3d')]({},_0x3b79ac,_0x57c943[_0xc4b6('0x45')]);return db[_0xc4b6('0x50')][_0xc4b6('0x41')](_0x3b79ac);}})[_0xc4b6('0x22')](function(_0x13847a){if(_0x13847a){return db[_0xc4b6('0x53')][_0xc4b6('0x54')]({'where':{'id':_[_0xc4b6('0x2b')](_0x13847a,_0xc4b6('0x55')),'role':_0xc4b6('0x56')},'attributes':['id','name',_0xc4b6('0x57'),_0xc4b6('0x58'),'createdAt']});}})[_0xc4b6('0x22')](function(_0x3a9677){if(_0x3a9677){return{'count':_0x3a9677['count'],'rows':_[_0xc4b6('0x2b')](_0x3a9677[_0xc4b6('0x42')],function(_0x5ac48c){return{'membername':_0x5ac48c['name'],'UserId':_0x5ac48c['id'],'queue_name':_0x4fc400[_0xc4b6('0x29')],'OpenchannelQueueId':_0x4fc400['id'],'interface':util['format'](_0xc4b6('0x59'),_0xc4b6('0x5a'),_0x5ac48c[_0xc4b6('0x29')]),'penalty':0x0,'paused':_0x5ac48c[_0xc4b6('0x57')],'createdAt':_0x5ac48c[_0xc4b6('0x5b')],'updatedAt':_0x5ac48c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc4b6('0x22')](respondWithFilteredResult(_0x18f8e2,_0x3b79ac))['catch'](handleError(_0x18f8e2,null));};exports['getTeams']=function(_0x14341d,_0x2f6c79,_0x5cc349){var _0x211bf6={};var _0x38960c={};var _0x318814;var _0x21bc3d;return db[_0xc4b6('0x2c')][_0xc4b6('0x4f')]({'where':{'id':_0x14341d['params']['id']}})['then'](handleEntityNotFound(_0x2f6c79,null))['then'](function(_0x36833b){if(_0x36833b){_0x318814=_0x36833b;_0x38960c[_0xc4b6('0x31')]=_[_0xc4b6('0x33')](db[_0xc4b6('0x5c')][_0xc4b6('0x2d')]);_0x38960c[_0xc4b6('0x32')]=_[_0xc4b6('0x33')](_0x14341d[_0xc4b6('0x32')]);_0x38960c['filters']=_[_0xc4b6('0x34')](_0x38960c[_0xc4b6('0x31')],_0x38960c[_0xc4b6('0x32')]);_0x211bf6[_0xc4b6('0x35')]=_[_0xc4b6('0x34')](_0x38960c[_0xc4b6('0x31')],qs['fields'](_0x14341d[_0xc4b6('0x32')][_0xc4b6('0x36')]));_0x211bf6[_0xc4b6('0x35')]=_0x211bf6[_0xc4b6('0x35')]['length']?_0x211bf6['attributes']:_0x38960c[_0xc4b6('0x31')];_0x211bf6[_0xc4b6('0x5d')]=qs[_0xc4b6('0x51')](_0x14341d[_0xc4b6('0x32')][_0xc4b6('0x51')]);_0x211bf6[_0xc4b6('0x39')]=qs[_0xc4b6('0x3a')](_[_0xc4b6('0x3b')](_0x14341d[_0xc4b6('0x32')],_0x38960c['filters']));if(_0x14341d[_0xc4b6('0x32')][_0xc4b6('0x3c')]){_0x211bf6[_0xc4b6('0x39')]=_[_0xc4b6('0x3d')](_0x211bf6[_0xc4b6('0x39')],{'$or':_[_0xc4b6('0x2b')](_0x211bf6[_0xc4b6('0x35')],function(_0x15763a){var _0x4e3492={};_0x4e3492[_0x15763a]={'$like':'%'+_0x14341d[_0xc4b6('0x32')][_0xc4b6('0x3c')]+'%'};return _0x4e3492;})});}_0x211bf6=_[_0xc4b6('0x3d')]({},_0x211bf6,_0x14341d[_0xc4b6('0x45')]);return _0x318814[_0xc4b6('0x5e')](_0x211bf6);}})[_0xc4b6('0x22')](function(_0x4656e4){if(_0x4656e4){_0x21bc3d=_0x4656e4['length'];if(!_0x14341d[_0xc4b6('0x32')]['hasOwnProperty']('nolimit')){_0x211bf6['limit']=qs['limit'](_0x14341d['query'][_0xc4b6('0x1d')]);_0x211bf6[_0xc4b6('0x1b')]=qs['offset'](_0x14341d[_0xc4b6('0x32')]['offset']);}return _0x318814['getTeams'](_0x211bf6);}})[_0xc4b6('0x22')](function(_0x1ae2c1){if(_0x1ae2c1){return _0x1ae2c1?{'count':_0x21bc3d,'rows':_0x1ae2c1}:null;}})['then'](respondWithResult(_0x2f6c79,null))[_0xc4b6('0x47')](handleError(_0x2f6c79,null));};exports[_0xc4b6('0x5f')]=function(_0x582527,_0x3acd7d,_0x55ef11){var _0xe8f111=_0x582527['body'][_0xc4b6('0x60')];return db['Team'][_0xc4b6('0x41')]({'where':{'id':_0xe8f111},'attributes':['id'],'include':[{'model':db[_0xc4b6('0x53')],'as':_0xc4b6('0x61'),'attributes':['id','name',_0xc4b6('0x62'),'voicePause',_0xc4b6('0x63')],'raw':!![]}]})[_0xc4b6('0x22')](function(_0x4ed447){if(_0x4ed447){var _0x5d0afd=_[_0xc4b6('0x64')](_0x4ed447,function(_0x2ebcde){var _0x119af0=_0x2ebcde['get']({'plain':!![]});return _0x119af0[_0xc4b6('0x61')];});return db[_0xc4b6('0x2c')][_0xc4b6('0x46')]({'where':{'id':_0x582527[_0xc4b6('0x44')]['id']}})[_0xc4b6('0x22')](function(_0xb1f735){return db[_0xc4b6('0x65')]['transaction'](function(_0x4a7846){return _0xb1f735[_0xc4b6('0x5f')](_0xe8f111,{'transaction':_0x4a7846})[_0xc4b6('0x22')](function(){return BPromise[_0xc4b6('0x66')](_0x5d0afd,function(_0x189e09){return db[_0xc4b6('0x50')]['findOrCreate']({'where':{'UserId':_0x189e09['id'],'OpenchannelQueueId':_0x582527[_0xc4b6('0x44')]['id']},'transaction':_0x4a7846});});})[_0xc4b6('0x22')](function(){_0x5d0afd[_0xc4b6('0x67')](function(_0x1dfe66){socket[_0xc4b6('0x68')](_0xc4b6('0x69'),{'UserId':_0x1dfe66['id'],'OpenchannelQueueId':_0xb1f735['id']});});});});});}})[_0xc4b6('0x22')](respondWithStatusCode(_0x3acd7d,null))[_0xc4b6('0x47')](handleError(_0x3acd7d,null));};exports['removeTeams']=function(_0x76aa7b,_0x5c9711,_0x349305){return db[_0xc4b6('0x5c')][_0xc4b6('0x41')]({'where':{'id':_0x76aa7b[_0xc4b6('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc4b6('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4b6('0x22')](handleEntityNotFound(_0x5c9711,null))[_0xc4b6('0x22')](function(_0x5973e7){var _0x978809=_[_0xc4b6('0x2b')](_0x5973e7,'id');var _0x1fb424=[];var _0x12ee15=[];var _0x2fa801=squel[_0xc4b6('0x6a')]();_0x2fa801[_0xc4b6('0x6b')](_0xc4b6('0x6c'))[_0xc4b6('0x6d')](_0xc4b6('0x6e'),'tq')[_0xc4b6('0x6f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc4b6('0x39')](_0xc4b6('0x70'),_0x76aa7b['params']['id']);for(var _0x12fa7d=0x0;_0x12fa7d<_0x5973e7['length'];_0x12fa7d+=0x1){let _0x1c7785=_0x5973e7[_0x12fa7d];for(var _0x1a39e8=0x0;_0x1a39e8<_0x1c7785[_0xc4b6('0x61')][_0xc4b6('0x37')];_0x1a39e8+=0x1){let _0x544377=_0x1c7785['Agents'][_0x1a39e8];var _0x56c228=_0x2fa801[_0xc4b6('0x71')]();_0x56c228[_0xc4b6('0x39')](_0xc4b6('0x72'),_0x544377['id']);_0x12ee15[_0xc4b6('0x73')](db[_0xc4b6('0x65')]['query'](_0x56c228['toString'](),{'type':db[_0xc4b6('0x65')][_0xc4b6('0x74')][_0xc4b6('0x75')]})[_0xc4b6('0x22')](function(_0x185487){if(_0x185487[_0xc4b6('0x37')]===0x1){return _0x544377['id'];}else{var _0x2d4c2c=_[_0xc4b6('0x76')](_['map'](_0x185487,'TeamId'),function(_0x4ceafc){return _[_0xc4b6('0x77')](_0x978809,_0x4ceafc);});if(_0x2d4c2c){return _0x544377['id'];}}}));}}return BPromise[_0xc4b6('0x78')](_0x12ee15)[_0xc4b6('0x22')](function(_0x417512){_0x1fb424=_(_0x1fb424)[_0xc4b6('0x79')](_0x417512)[_0xc4b6('0x7a')]()[_0xc4b6('0x7b')]();return db[_0xc4b6('0x2c')][_0xc4b6('0x46')]({'where':{'id':_0x76aa7b[_0xc4b6('0x44')]['id']}})['then'](function(_0x8c6b7){return db['sequelize'][_0xc4b6('0x7c')](function(_0x27345d){return _0x8c6b7[_0xc4b6('0x7d')](_0x76aa7b[_0xc4b6('0x32')][_0xc4b6('0x60')],{'transaction':_0x27345d})[_0xc4b6('0x22')](function(){if(!_[_0xc4b6('0x7e')](_0x1fb424)){return _0x8c6b7['removeAgents'](_0x1fb424,{'transaction':_0x27345d});}})[_0xc4b6('0x22')](function(){_0x1fb424[_0xc4b6('0x67')](function(_0x713647){socket[_0xc4b6('0x68')](_0xc4b6('0x7f'),{'UserId':_0x713647,'OpenchannelQueueId':_0x8c6b7['id']});});});});});});})[_0xc4b6('0x22')](respondWithStatusCode(_0x5c9711,null))['catch'](handleError(_0x5c9711,null));};exports['addAgents']=function(_0xdbeae,_0x4ff4af,_0x1d0e7d){return db[_0xc4b6('0x2c')][_0xc4b6('0x46')]({'where':{'id':_0xdbeae[_0xc4b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ff4af,null))[_0xc4b6('0x22')](function(_0x211169){if(_0x211169){return _0x211169[_0xc4b6('0x80')](_0xdbeae['body'][_0xc4b6('0x60')],_[_0xc4b6('0x81')](_0xdbeae[_0xc4b6('0x4c')],[_0xc4b6('0x60'),'id'])||{})[_0xc4b6('0x82')](function(_0x23b7b5){for(var _0x54d7e3=0x0;_0x54d7e3<_0xdbeae['body']['ids']['length'];_0x54d7e3+=0x1){socket[_0xc4b6('0x68')](_0xc4b6('0x69'),{'UserId':Number(_0xdbeae[_0xc4b6('0x4c')][_0xc4b6('0x60')][_0x54d7e3]),'OpenchannelQueueId':Number(_0xdbeae[_0xc4b6('0x44')]['id'])});}return _0x23b7b5;});}})[_0xc4b6('0x22')](respondWithResult(_0x4ff4af,null))[_0xc4b6('0x47')](handleError(_0x4ff4af,null));};exports[_0xc4b6('0x83')]=function(_0xd0cc75,_0xee45ac,_0x10cc46){return db[_0xc4b6('0x2c')][_0xc4b6('0x46')]({'where':{'id':_0xd0cc75[_0xc4b6('0x44')]['id']}})['then'](handleEntityNotFound(_0xee45ac,null))['then'](function(_0x3e4836){if(_0x3e4836){return _0x3e4836[_0xc4b6('0x83')](_0xd0cc75[_0xc4b6('0x32')][_0xc4b6('0x60')])[_0xc4b6('0x22')](function(){if(_[_0xc4b6('0x84')](_0xd0cc75[_0xc4b6('0x32')]['ids'])){for(var _0x45595a=0x0;_0x45595a<_0xd0cc75[_0xc4b6('0x32')]['ids'][_0xc4b6('0x37')];_0x45595a+=0x1){socket[_0xc4b6('0x68')](_0xc4b6('0x7f'),{'UserId':Number(_0xd0cc75[_0xc4b6('0x32')][_0xc4b6('0x60')][_0x45595a]),'OpenchannelQueueId':Number(_0xd0cc75[_0xc4b6('0x44')]['id'])});}}else{socket[_0xc4b6('0x68')](_0xc4b6('0x7f'),{'UserId':Number(_0xd0cc75['query'][_0xc4b6('0x60')]),'OpenchannelQueueId':Number(_0xd0cc75[_0xc4b6('0x44')]['id'])});}});}})[_0xc4b6('0x22')](respondWithStatusCode(_0xee45ac,null))[_0xc4b6('0x47')](handleError(_0xee45ac,null));};exports[_0xc4b6('0x85')]=function(_0x2b89dd,_0x3147a0,_0x2d3fd7){var _0x83ac82={};var _0x354ca5={};var _0x5dc468;var _0x607995;return db[_0xc4b6('0x2c')]['findOne']({'where':{'id':_0x2b89dd[_0xc4b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3147a0,null))[_0xc4b6('0x22')](function(_0x36edfa){if(_0x36edfa){_0x5dc468=_0x36edfa;_0x354ca5[_0xc4b6('0x31')]=_[_0xc4b6('0x33')](db[_0xc4b6('0x53')][_0xc4b6('0x2d')]);_0x354ca5['query']=_[_0xc4b6('0x33')](_0x2b89dd['query']);_0x354ca5[_0xc4b6('0x3a')]=_[_0xc4b6('0x34')](_0x354ca5[_0xc4b6('0x31')],_0x354ca5[_0xc4b6('0x32')]);_0x83ac82[_0xc4b6('0x35')]=_[_0xc4b6('0x34')](_0x354ca5[_0xc4b6('0x31')],qs[_0xc4b6('0x36')](_0x2b89dd['query'][_0xc4b6('0x36')]));_0x83ac82[_0xc4b6('0x35')]=_0x83ac82[_0xc4b6('0x35')][_0xc4b6('0x37')]?_0x83ac82[_0xc4b6('0x35')]:_0x354ca5[_0xc4b6('0x31')];_0x83ac82[_0xc4b6('0x5d')]=qs[_0xc4b6('0x51')](_0x2b89dd[_0xc4b6('0x32')][_0xc4b6('0x51')]);_0x83ac82[_0xc4b6('0x39')]=qs[_0xc4b6('0x3a')](_[_0xc4b6('0x3b')](_0x2b89dd['query'],_0x354ca5[_0xc4b6('0x3a')]));if(_0x2b89dd[_0xc4b6('0x32')]['filter']){_0x83ac82['where']=_[_0xc4b6('0x3d')](_0x83ac82[_0xc4b6('0x39')],{'$or':_[_0xc4b6('0x2b')](_0x83ac82['attributes'],function(_0x251b5e){var _0x53645f={};_0x53645f[_0x251b5e]={'$like':'%'+_0x2b89dd[_0xc4b6('0x32')][_0xc4b6('0x3c')]+'%'};return _0x53645f;})});}_0x83ac82=_[_0xc4b6('0x3d')]({},_0x83ac82,_0x2b89dd['options']);return _0x5dc468[_0xc4b6('0x85')](_0x83ac82);}})[_0xc4b6('0x22')](function(_0x398677){if(_0x398677){_0x607995=_0x398677[_0xc4b6('0x37')];if(!_0x2b89dd[_0xc4b6('0x32')][_0xc4b6('0x38')]('nolimit')){_0x83ac82[_0xc4b6('0x1d')]=qs['limit'](_0x2b89dd[_0xc4b6('0x32')]['limit']);_0x83ac82[_0xc4b6('0x1b')]=qs[_0xc4b6('0x1b')](_0x2b89dd[_0xc4b6('0x32')][_0xc4b6('0x1b')]);}return _0x5dc468[_0xc4b6('0x85')](_0x83ac82);}})[_0xc4b6('0x22')](function(_0x237350){if(_0x237350){return _0x237350?{'count':_0x607995,'rows':_0x237350}:null;}})[_0xc4b6('0x22')](respondWithResult(_0x3147a0,null))[_0xc4b6('0x47')](handleError(_0x3147a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c2d6080..e7aded5 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 _0x1ebd=['OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x507a88,_0x33cec8){var _0x175756=function(_0x10214b){while(--_0x10214b){_0x507a88['push'](_0x507a88['shift']());}};_0x175756(++_0x33cec8);}(_0x1ebd,0x1e7));var _0xd1eb=function(_0x5ebe0a,_0x562863){_0x5ebe0a=_0x5ebe0a-0x0;var _0x1c06e2=_0x1ebd[_0x5ebe0a];return _0x1c06e2;};'use strict';var EventEmitter=require(_0xd1eb('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xd1eb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd1eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd1eb('0x3')};function emitEvent(_0x44c506){return function(_0x120157,_0x59737c,_0x230228){OpenchannelQueueEvents[_0xd1eb('0x4')](_0x44c506+':'+_0x120157['id'],_0x120157);OpenchannelQueueEvents[_0xd1eb('0x4')](_0x44c506,_0x120157);_0x230228(null);};}for(var e in events){if(events[_0xd1eb('0x5')](e)){var event=events[e];OpenchannelQueue[_0xd1eb('0x6')](e,emitEvent(event));}}module[_0xd1eb('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1717=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1da6be,_0x5d4e33){var _0x1264cf=function(_0x65beb4){while(--_0x65beb4){_0x1da6be['push'](_0x1da6be['shift']());}};_0x1264cf(++_0x5d4e33);}(_0x1717,0xa6));var _0x7171=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x1717[_0x44039a];return _0x525de5;};'use strict';var EventEmitter=require(_0x7171('0x0'));var OpenchannelQueue=require(_0x7171('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7171('0x2')](0x0);var events={'afterCreate':_0x7171('0x3'),'afterUpdate':_0x7171('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa9ef6b){return function(_0x38ab9c,_0x48c9ec,_0x41515b){OpenchannelQueueEvents[_0x7171('0x5')](_0xa9ef6b+':'+_0x38ab9c['id'],_0x38ab9c);OpenchannelQueueEvents['emit'](_0xa9ef6b,_0x38ab9c);_0x41515b(null);};}for(var e in events){if(events[_0x7171('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x7171('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a90ff60..476706d 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 _0x626c=['api','moment','request-promise','path','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0x626c,0x1d4));var _0xc626=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x626c[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xc626('0x0'));var util=require(_0xc626('0x1'));var logger=require('../../config/logger')(_0xc626('0x2'));var moment=require(_0xc626('0x3'));var BPromise=require('bluebird');var rp=require(_0xc626('0x4'));var fs=require('fs');var path=require(_0xc626('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xc626('0x6')]=function(_0x5ce1c3,_0x2812e4){return _0x5ce1c3[_0xc626('0x7')](_0xc626('0x8'),attributes,{'tableName':_0xc626('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83a5=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x83221c,_0x3975ef){var _0x2fa1fc=function(_0x26d691){while(--_0x26d691){_0x83221c['push'](_0x83221c['shift']());}};_0x2fa1fc(++_0x3975ef);}(_0x83a5,0x6c));var _0x583a=function(_0x2cef62,_0x5e7680){_0x2cef62=_0x2cef62-0x0;var _0x3c25a9=_0x83a5[_0x2cef62];return _0x3c25a9;};'use strict';var _=require(_0x583a('0x0'));var util=require(_0x583a('0x1'));var logger=require(_0x583a('0x2'))('api');var moment=require(_0x583a('0x3'));var BPromise=require(_0x583a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x583a('0x5'));var rimraf=require(_0x583a('0x6'));var config=require(_0x583a('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x583a('0x8')]=function(_0x1ca1ca,_0x46b3a4){return _0x1ca1ca['define'](_0x583a('0x9'),attributes,{'tableName':_0x583a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ba98441..6c89a5b 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 _0xe785=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','find','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe785,0x1e0));var _0x5e78=function(_0x37bd65,_0xec0a35){_0x37bd65=_0x37bd65-0x0;var _0x5554d7=_0xe785[_0x37bd65];return _0x5554d7;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require(_0x5e78('0x2'));var BPromise=require(_0x5e78('0x3'));var rs=require(_0x5e78('0x4'));var fs=require('fs');var Redis=require(_0x5e78('0x5'));var db=require(_0x5e78('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e78('0x7'))(_0x5e78('0x8'));var config=require(_0x5e78('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5e78('0xa')]({'port':0x232a});config[_0x5e78('0xb')]=_[_0x5e78('0xc')](config[_0x5e78('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5e78('0xd'))[_0x5e78('0xe')](socket);function respondWithRpcPromise(_0xa4f4c,_0x222a5c,_0x4acf65){return new BPromise(function(_0x15558c,_0x52f4a2){return client[_0x5e78('0xf')](_0xa4f4c,_0x4acf65)[_0x5e78('0x10')](function(_0x412fe7){logger[_0x5e78('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x222a5c,_0x5e78('0x12'));logger[_0x5e78('0x13')](_0x5e78('0x14'),_0x222a5c,'request\x20sent',JSON[_0x5e78('0x15')](_0x412fe7));if(_0x412fe7['error']){if(_0x412fe7[_0x5e78('0x16')][_0x5e78('0x17')]===0x1f4){logger['error'](_0x5e78('0x18'),_0x222a5c,_0x412fe7['error']['message']);return _0x52f4a2(_0x412fe7['error'][_0x5e78('0x19')]);}logger[_0x5e78('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x222a5c,_0x412fe7['error'][_0x5e78('0x19')]);return _0x15558c(_0x412fe7[_0x5e78('0x16')]['message']);}else{logger[_0x5e78('0x11')](_0x5e78('0x18'),_0x222a5c,'request\x20sent');_0x15558c(_0x412fe7[_0x5e78('0x1a')][_0x5e78('0x19')]);}})['catch'](function(_0x768b39){logger['error'](_0x5e78('0x18'),_0x222a5c,_0x768b39);_0x52f4a2(_0x768b39);});});}exports[_0x5e78('0x1b')]=function(_0x22d536){var _0x24f718=this;return new Promise(function(_0x47f39e,_0x4f515c){return db[_0x5e78('0x1c')]['findAll']({'raw':_0x22d536['options']?_0x22d536[_0x5e78('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22d536['options']?_0x22d536[_0x5e78('0x1d')][_0x5e78('0x1e')]||null:null,'attributes':_0x22d536[_0x5e78('0x1d')]?_0x22d536[_0x5e78('0x1d')][_0x5e78('0x1f')]||null:null,'limit':_0x22d536[_0x5e78('0x1d')]?_0x22d536[_0x5e78('0x1d')][_0x5e78('0x20')]||null:null,'include':_0x22d536[_0x5e78('0x1d')]?_0x22d536[_0x5e78('0x1d')][_0x5e78('0x21')]?_[_0x5e78('0x22')](_0x22d536['options'][_0x5e78('0x21')],function(_0x419cd2){return{'model':db[_0x419cd2[_0x5e78('0x23')]],'as':_0x419cd2['as'],'attributes':_0x419cd2[_0x5e78('0x1f')],'include':_0x419cd2[_0x5e78('0x21')]?_[_0x5e78('0x22')](_0x419cd2[_0x5e78('0x21')],function(_0x129659){return{'model':db[_0x129659[_0x5e78('0x23')]],'as':_0x129659['as'],'attributes':_0x129659['attributes'],'include':_0x129659[_0x5e78('0x21')]?_[_0x5e78('0x22')](_0x129659['include'],function(_0xec304a){return{'model':db[_0xec304a[_0x5e78('0x23')]],'as':_0xec304a['as'],'attributes':_0xec304a[_0x5e78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5e78('0x10')](function(_0x328873){logger[_0x5e78('0x11')]('GetOpenchannelQueue',_0x22d536);logger[_0x5e78('0x13')](_0x5e78('0x1b'),_0x22d536,JSON['stringify'](_0x328873));_0x47f39e(_0x328873);})[_0x5e78('0x24')](function(_0xfb9d24){logger[_0x5e78('0x16')]('GetOpenchannelQueue',_0xfb9d24[_0x5e78('0x19')],_0x22d536);_0x4f515c(_0x24f718['error'](0x1f4,_0xfb9d24[_0x5e78('0x19')]));});});};exports[_0x5e78('0x25')]=function(_0x5b10f6){var _0x5cc4ae=this;return new Promise(function(_0x2ad234,_0x33b5d9){return db['OpenchannelQueue'][_0x5e78('0x26')]({'raw':_0x5b10f6[_0x5e78('0x1d')]?_0x5b10f6['options'][_0x5e78('0x27')]===undefined?!![]:![]:!![],'where':_0x5b10f6[_0x5e78('0x1d')]?_0x5b10f6[_0x5e78('0x1d')][_0x5e78('0x1e')]||null:null,'attributes':_0x5b10f6['options']?_0x5b10f6[_0x5e78('0x1d')][_0x5e78('0x1f')]||null:null,'include':_0x5b10f6[_0x5e78('0x1d')]?_0x5b10f6[_0x5e78('0x1d')][_0x5e78('0x21')]?_['map'](_0x5b10f6[_0x5e78('0x1d')][_0x5e78('0x21')],function(_0x464508){return{'model':db[_0x464508[_0x5e78('0x23')]],'as':_0x464508['as'],'attributes':_0x464508[_0x5e78('0x1f')],'include':_0x464508['include']?_[_0x5e78('0x22')](_0x464508[_0x5e78('0x21')],function(_0x24b30d){return{'model':db[_0x24b30d[_0x5e78('0x23')]],'as':_0x24b30d['as'],'attributes':_0x24b30d[_0x5e78('0x1f')],'include':_0x24b30d[_0x5e78('0x21')]?_[_0x5e78('0x22')](_0x24b30d[_0x5e78('0x21')],function(_0x10b68a){return{'model':db[_0x10b68a[_0x5e78('0x23')]],'as':_0x10b68a['as'],'attributes':_0x10b68a[_0x5e78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5e78('0x10')](function(_0x335895){logger['info']('ShowOpenchannelQueue',_0x5b10f6);logger[_0x5e78('0x13')](_0x5e78('0x25'),_0x5b10f6,JSON[_0x5e78('0x15')](_0x335895));_0x2ad234(_0x335895);})[_0x5e78('0x24')](function(_0xe49fd5){logger[_0x5e78('0x16')](_0x5e78('0x25'),_0xe49fd5[_0x5e78('0x19')],_0x5b10f6);_0x33b5d9(_0x5cc4ae[_0x5e78('0x16')](0x1f4,_0xe49fd5[_0x5e78('0x19')]));});});}; \ No newline at end of file +var _0x40dc=['OpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetOpenchannelQueue'];(function(_0x187783,_0x523c06){var _0x20cfcd=function(_0x53a715){while(--_0x53a715){_0x187783['push'](_0x187783['shift']());}};_0x20cfcd(++_0x523c06);}(_0x40dc,0xaf));var _0xc40d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc40d('0x0'));var util=require(_0xc40d('0x1'));var moment=require(_0xc40d('0x2'));var BPromise=require(_0xc40d('0x3'));var rs=require(_0xc40d('0x4'));var fs=require('fs');var Redis=require(_0xc40d('0x5'));var db=require(_0xc40d('0x6'))['db'];var utils=require(_0xc40d('0x7'));var logger=require(_0xc40d('0x8'))(_0xc40d('0x9'));var config=require(_0xc40d('0xa'));var jayson=require(_0xc40d('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xc40d('0xc')]=_[_0xc40d('0xd')](config[_0xc40d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc40d('0xe'))(new Redis(config[_0xc40d('0xc')]));require(_0xc40d('0xf'))[_0xc40d('0x10')](socket);function respondWithRpcPromise(_0x3ba2d3,_0x39ce30,_0x2914d0){return new BPromise(function(_0x3ab8a4,_0x89dd3){return client[_0xc40d('0x11')](_0x3ba2d3,_0x2914d0)[_0xc40d('0x12')](function(_0x124054){logger['info'](_0xc40d('0x13'),_0x39ce30,'request\x20sent');logger[_0xc40d('0x14')](_0xc40d('0x15'),_0x39ce30,_0xc40d('0x16'),JSON[_0xc40d('0x17')](_0x124054));if(_0x124054['error']){if(_0x124054[_0xc40d('0x18')][_0xc40d('0x19')]===0x1f4){logger['error'](_0xc40d('0x13'),_0x39ce30,_0x124054[_0xc40d('0x18')]['message']);return _0x89dd3(_0x124054[_0xc40d('0x18')][_0xc40d('0x1a')]);}logger[_0xc40d('0x18')](_0xc40d('0x13'),_0x39ce30,_0x124054[_0xc40d('0x18')][_0xc40d('0x1a')]);return _0x3ab8a4(_0x124054[_0xc40d('0x18')][_0xc40d('0x1a')]);}else{logger[_0xc40d('0x1b')](_0xc40d('0x13'),_0x39ce30,'request\x20sent');_0x3ab8a4(_0x124054['result'][_0xc40d('0x1a')]);}})[_0xc40d('0x1c')](function(_0x341081){logger['error'](_0xc40d('0x13'),_0x39ce30,_0x341081);_0x89dd3(_0x341081);});});}exports[_0xc40d('0x1d')]=function(_0x18fd2b){var _0x5eb64c=this;return new Promise(function(_0x26298d,_0xb76a23){return db[_0xc40d('0x1e')][_0xc40d('0x1f')]({'raw':_0x18fd2b[_0xc40d('0x20')]?_0x18fd2b['options'][_0xc40d('0x21')]===undefined?!![]:![]:!![],'where':_0x18fd2b[_0xc40d('0x20')]?_0x18fd2b['options']['where']||null:null,'attributes':_0x18fd2b[_0xc40d('0x20')]?_0x18fd2b[_0xc40d('0x20')][_0xc40d('0x22')]||null:null,'limit':_0x18fd2b[_0xc40d('0x20')]?_0x18fd2b[_0xc40d('0x20')]['limit']||null:null,'include':_0x18fd2b[_0xc40d('0x20')]?_0x18fd2b[_0xc40d('0x20')][_0xc40d('0x23')]?_[_0xc40d('0x24')](_0x18fd2b['options'][_0xc40d('0x23')],function(_0x1eb3bb){return{'model':db[_0x1eb3bb[_0xc40d('0x25')]],'as':_0x1eb3bb['as'],'attributes':_0x1eb3bb[_0xc40d('0x22')],'include':_0x1eb3bb[_0xc40d('0x23')]?_[_0xc40d('0x24')](_0x1eb3bb['include'],function(_0x321ef5){return{'model':db[_0x321ef5[_0xc40d('0x25')]],'as':_0x321ef5['as'],'attributes':_0x321ef5['attributes'],'include':_0x321ef5[_0xc40d('0x23')]?_[_0xc40d('0x24')](_0x321ef5[_0xc40d('0x23')],function(_0x37ea8b){return{'model':db[_0x37ea8b[_0xc40d('0x25')]],'as':_0x37ea8b['as'],'attributes':_0x37ea8b[_0xc40d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc40d('0x12')](function(_0x3b95c4){logger[_0xc40d('0x1b')]('GetOpenchannelQueue',_0x18fd2b);logger[_0xc40d('0x14')](_0xc40d('0x1d'),_0x18fd2b,JSON[_0xc40d('0x17')](_0x3b95c4));_0x26298d(_0x3b95c4);})[_0xc40d('0x1c')](function(_0x1fccff){logger[_0xc40d('0x18')](_0xc40d('0x1d'),_0x1fccff['message'],_0x18fd2b);_0xb76a23(_0x5eb64c['error'](0x1f4,_0x1fccff[_0xc40d('0x1a')]));});});};exports[_0xc40d('0x26')]=function(_0x29a212){var _0x49d000=this;return new Promise(function(_0x7c540f,_0x2220e8){return db[_0xc40d('0x1e')][_0xc40d('0x27')]({'raw':_0x29a212['options']?_0x29a212[_0xc40d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x29a212[_0xc40d('0x20')]?_0x29a212[_0xc40d('0x20')][_0xc40d('0x28')]||null:null,'attributes':_0x29a212[_0xc40d('0x20')]?_0x29a212['options'][_0xc40d('0x22')]||null:null,'include':_0x29a212[_0xc40d('0x20')]?_0x29a212[_0xc40d('0x20')][_0xc40d('0x23')]?_[_0xc40d('0x24')](_0x29a212[_0xc40d('0x20')][_0xc40d('0x23')],function(_0x2d6873){return{'model':db[_0x2d6873['model']],'as':_0x2d6873['as'],'attributes':_0x2d6873[_0xc40d('0x22')],'include':_0x2d6873[_0xc40d('0x23')]?_[_0xc40d('0x24')](_0x2d6873['include'],function(_0xde3396){return{'model':db[_0xde3396[_0xc40d('0x25')]],'as':_0xde3396['as'],'attributes':_0xde3396[_0xc40d('0x22')],'include':_0xde3396[_0xc40d('0x23')]?_[_0xc40d('0x24')](_0xde3396[_0xc40d('0x23')],function(_0x46b5e4){return{'model':db[_0x46b5e4[_0xc40d('0x25')]],'as':_0x46b5e4['as'],'attributes':_0x46b5e4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc40d('0x12')](function(_0x5c2f14){logger[_0xc40d('0x1b')]('ShowOpenchannelQueue',_0x29a212);logger[_0xc40d('0x14')](_0xc40d('0x26'),_0x29a212,JSON['stringify'](_0x5c2f14));_0x7c540f(_0x5c2f14);})[_0xc40d('0x1c')](function(_0xe6ed82){logger[_0xc40d('0x18')](_0xc40d('0x26'),_0xe6ed82['message'],_0x29a212);_0x2220e8(_0x49d000['error'](0x1f4,_0xe6ed82[_0xc40d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 166f419..bfd39eb 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 _0x6b6d=['update','removeListener','register','length','openchannelQueue:','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b6d,0x124));var _0xd6b6=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6b6d[_0x5a79e2];return _0x266c45;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xd6b6('0x0'),_0xd6b6('0x1'),_0xd6b6('0x2')];function createListener(_0x15a0c8,_0x2f01b8){return function(_0x37fc89){_0x2f01b8['emit'](_0x15a0c8,_0x37fc89);};}function removeListener(_0x51418c,_0x5aba17){return function(){OpenchannelQueueEvents[_0xd6b6('0x3')](_0x51418c,_0x5aba17);};}exports[_0xd6b6('0x4')]=function(_0x433760){for(var _0x2b97d0=0x0,_0xb8f5d9=events[_0xd6b6('0x5')];_0x2b97d0<_0xb8f5d9;_0x2b97d0++){var _0x989d13=events[_0x2b97d0];var _0x3d7c61=createListener(_0xd6b6('0x6')+_0x989d13,_0x433760);OpenchannelQueueEvents['on'](_0x989d13,_0x3d7c61);}}; \ No newline at end of file +var _0x4faa=['emit','register','length','./openchannelQueue.events','save'];(function(_0x2d8c37,_0x3976c1){var _0x2093dd=function(_0xfa783b){while(--_0xfa783b){_0x2d8c37['push'](_0x2d8c37['shift']());}};_0x2093dd(++_0x3976c1);}(_0x4faa,0x8f));var _0xa4fa=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4faa[_0xa1e3e3];return _0xc980e9;};'use strict';var OpenchannelQueueEvents=require(_0xa4fa('0x0'));var events=[_0xa4fa('0x1'),'remove','update'];function createListener(_0x51cdcd,_0x31bfa5){return function(_0x5e8738){_0x31bfa5[_0xa4fa('0x2')](_0x51cdcd,_0x5e8738);};}function removeListener(_0x3f38f6,_0x81af73){return function(){OpenchannelQueueEvents['removeListener'](_0x3f38f6,_0x81af73);};}exports[_0xa4fa('0x3')]=function(_0x144da4){for(var _0x3c045e=0x0,_0x46223b=events[_0xa4fa('0x4')];_0x3c045e<_0x46223b;_0x3c045e++){var _0x30f5eb=events[_0x3c045e];var _0x1c4b00=createListener('openchannelQueue:'+_0x30f5eb,_0x144da4);OpenchannelQueueEvents['on'](_0x30f5eb,_0x1c4b00);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 89bac65..9618d2f 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 _0x59d7=['express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','exports','multer','util','path'];(function(_0x255e87,_0x1df4e9){var _0x1c090c=function(_0x4e8151){while(--_0x4e8151){_0x255e87['push'](_0x255e87['shift']());}};_0x1c090c(++_0x1df4e9);}(_0x59d7,0xeb));var _0x759d=function(_0x2dd976,_0x1b5dc4){_0x2dd976=_0x2dd976-0x0;var _0x2265fd=_0x59d7[_0x2dd976];return _0x2265fd;};'use strict';var multer=require(_0x759d('0x0'));var util=require(_0x759d('0x1'));var path=require(_0x759d('0x2'));var timeout=require('connect-timeout');var express=require(_0x759d('0x3'));var router=express[_0x759d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x759d('0x5'));var config=require('../../config/environment');var controller=require(_0x759d('0x6'));router[_0x759d('0x7')]('/',auth[_0x759d('0x8')](),controller['index']);router[_0x759d('0x7')](_0x759d('0x9'),auth[_0x759d('0x8')](),controller[_0x759d('0xa')]);router['get'](_0x759d('0xb'),auth[_0x759d('0x8')](),controller['show']);router[_0x759d('0xc')]('/',auth['isAuthenticated'](),controller[_0x759d('0xd')]);router['put']('/:id',auth[_0x759d('0x8')](),controller[_0x759d('0xe')]);router[_0x759d('0xf')](_0x759d('0xb'),auth[_0x759d('0x8')](),controller['destroy']);module[_0x759d('0x10')]=router; \ No newline at end of file +var _0x1009=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete'];(function(_0xb4d947,_0x16b719){var _0x8c85d0=function(_0x2cb6fc){while(--_0x2cb6fc){_0xb4d947['push'](_0xb4d947['shift']());}};_0x8c85d0(++_0x16b719);}(_0x1009,0x152));var _0x9100=function(_0x20bfd0,_0x3a861a){_0x20bfd0=_0x20bfd0-0x0;var _0x584abe=_0x1009[_0x20bfd0];return _0x584abe;};'use strict';var multer=require('multer');var util=require(_0x9100('0x0'));var path=require(_0x9100('0x1'));var timeout=require(_0x9100('0x2'));var express=require(_0x9100('0x3'));var router=express[_0x9100('0x4')]();var fs_extra=require(_0x9100('0x5'));var auth=require(_0x9100('0x6'));var interaction=require(_0x9100('0x7'));var config=require(_0x9100('0x8'));var controller=require(_0x9100('0x9'));router[_0x9100('0xa')]('/',auth[_0x9100('0xb')](),controller['index']);router['get'](_0x9100('0xc'),auth[_0x9100('0xb')](),controller[_0x9100('0xd')]);router['get'](_0x9100('0xe'),auth['isAuthenticated'](),controller[_0x9100('0xf')]);router[_0x9100('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9100('0xb')](),controller[_0x9100('0x11')]);router[_0x9100('0x12')](_0x9100('0xe'),auth['isAuthenticated'](),controller[_0x9100('0x13')]);module[_0x9100('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d4e8fee..bcddf8d 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 _0x6cf2=['sequelize','exports','STRING','DATE'];(function(_0x13657e,_0x52cfdf){var _0x18bf36=function(_0x20e572){while(--_0x20e572){_0x13657e['push'](_0x13657e['shift']());}};_0x18bf36(++_0x52cfdf);}(_0x6cf2,0x7c));var _0x26cf=function(_0x510558,_0xc8ebf6){_0x510558=_0x510558-0x0;var _0x1f99fd=_0x6cf2[_0x510558];return _0x1f99fd;};'use strict';var moment=require('moment');var Sequelize=require(_0x26cf('0x0'));module[_0x26cf('0x1')]={'uniqueid':{'type':Sequelize[_0x26cf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x26cf('0x2')]},'joinAt':{'type':Sequelize[_0x26cf('0x3')]},'leaveAt':{'type':Sequelize[_0x26cf('0x3')]},'acceptAt':{'type':Sequelize[_0x26cf('0x3')]},'exitAt':{'type':Sequelize[_0x26cf('0x3')]},'reason':{'type':Sequelize[_0x26cf('0x2')]}}; \ No newline at end of file +var _0x9fba=['exports','STRING','DATE','moment'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x9fba,0x11f));var _0xa9fb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9fba[_0x334841];return _0x5beb4b;};'use strict';var moment=require(_0xa9fb('0x0'));var Sequelize=require('sequelize');module[_0xa9fb('0x1')]={'uniqueid':{'type':Sequelize[_0xa9fb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa9fb('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa9fb('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa9fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 121b57d..f8da80a 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 _0xd341=['undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json'];(function(_0x48571f,_0x4c86f4){var _0x495a93=function(_0x4928b7){while(--_0x4928b7){_0x48571f['push'](_0x48571f['shift']());}};_0x495a93(++_0x4c86f4);}(_0xd341,0xc8));var _0x1d34=function(_0x354744,_0x5ca071){_0x354744=_0x354744-0x0;var _0x4693ac=_0xd341[_0x354744];return _0x4693ac;};'use strict';var emlformat=require(_0x1d34('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d34('0x1'));var rp=require(_0x1d34('0x2'));var moment=require('moment');var BPromise=require(_0x1d34('0x3'));var Mustache=require('mustache');var util=require(_0x1d34('0x4'));var path=require('path');var sox=require(_0x1d34('0x5'));var csv=require(_0x1d34('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d34('0x7'));var _=require(_0x1d34('0x8'));var squel=require(_0x1d34('0x9'));var crypto=require(_0x1d34('0xa'));var jsforce=require(_0x1d34('0xb'));var deskjs=require(_0x1d34('0xc'));var toCsv=require(_0x1d34('0x6'));var querystring=require(_0x1d34('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1d34('0xe'));var qs=require(_0x1d34('0xf'));var as=require(_0x1d34('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d34('0x11'))(_0x1d34('0x12'));var utils=require(_0x1d34('0x13'));var config=require(_0x1d34('0x14'));var licenseUtil=require(_0x1d34('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219abe,_0xd90254){_0xd90254=_0xd90254||0xcc;return function(_0x5f5cf1){if(_0x5f5cf1){return _0x219abe[_0x1d34('0x16')](_0xd90254);}return _0x219abe['status'](_0xd90254)[_0x1d34('0x17')]();};}function respondWithResult(_0x3e8e44,_0x34b020){_0x34b020=_0x34b020||0xc8;return function(_0x320bb3){if(_0x320bb3){return _0x3e8e44['status'](_0x34b020)[_0x1d34('0x18')](_0x320bb3);}};}function respondWithFilteredResult(_0x23becd,_0x2e279e){return function(_0xd3abe4){if(_0xd3abe4){var _0x562135=typeof _0x2e279e['offset']===_0x1d34('0x19')&&typeof _0x2e279e[_0x1d34('0x1a')]===_0x1d34('0x19');var _0xe5be3c=_0xd3abe4[_0x1d34('0x1b')];var _0x225231=_0x562135?0x0:_0x2e279e[_0x1d34('0x1c')];var _0x18f35e=_0x562135?_0xd3abe4[_0x1d34('0x1b')]:_0x2e279e[_0x1d34('0x1c')]+_0x2e279e['limit'];var _0x9be6af;if(_0x18f35e>=_0xe5be3c){_0x18f35e=_0xe5be3c;_0x9be6af=0xc8;}else{_0x9be6af=0xce;}_0x23becd[_0x1d34('0x1d')](_0x9be6af);return _0x23becd[_0x1d34('0x1e')](_0x1d34('0x1f'),_0x225231+'-'+_0x18f35e+'/'+_0xe5be3c)[_0x1d34('0x18')](_0xd3abe4);}return null;};}function patchUpdates(_0x1c05ac){return function(_0x1d0197){try{jsonpatch[_0x1d34('0x20')](_0x1d0197,_0x1c05ac,!![]);}catch(_0x2b44c4){return BPromise[_0x1d34('0x21')](_0x2b44c4);}return _0x1d0197[_0x1d34('0x22')]();};}function saveUpdates(_0x11a866,_0x5b68b0){return function(_0xff4649){if(_0xff4649){return _0xff4649[_0x1d34('0x23')](_0x11a866)[_0x1d34('0x24')](function(_0x1e634f){return _0x1e634f;});}return null;};}function removeEntity(_0x511704,_0xadb579){return function(_0x211aa5){if(_0x211aa5){return _0x211aa5[_0x1d34('0x25')]()['then'](function(){_0x511704[_0x1d34('0x1d')](0xcc)[_0x1d34('0x17')]();});}};}function handleEntityNotFound(_0x43da72,_0x386656){return function(_0x2422ac){if(!_0x2422ac){_0x43da72[_0x1d34('0x16')](0x194);}return _0x2422ac;};}function handleError(_0x23ccae,_0x4f3b95){_0x4f3b95=_0x4f3b95||0x1f4;return function(_0x5bb5b1){logger[_0x1d34('0x26')](_0x5bb5b1[_0x1d34('0x27')]);if(_0x5bb5b1[_0x1d34('0x28')]){delete _0x5bb5b1[_0x1d34('0x28')];}_0x23ccae[_0x1d34('0x1d')](_0x4f3b95)[_0x1d34('0x29')](_0x5bb5b1);};}exports[_0x1d34('0x2a')]=function(_0x50f05a,_0x593e2e){var _0x102fb5={},_0x2b527c={},_0x1c1fd6={'count':0x0,'rows':[]};var _0x2fa1d9=_[_0x1d34('0x2b')](db['OpenchannelQueueReport'][_0x1d34('0x2c')],function(_0x230a54){return{'name':_0x230a54[_0x1d34('0x2d')],'type':_0x230a54[_0x1d34('0x2e')]['key']};});_0x2b527c[_0x1d34('0x2f')]=_[_0x1d34('0x2b')](_0x2fa1d9,_0x1d34('0x28'));_0x2b527c[_0x1d34('0x30')]=_[_0x1d34('0x31')](_0x50f05a[_0x1d34('0x30')]);_0x2b527c[_0x1d34('0x32')]=_['intersection'](_0x2b527c['model'],_0x2b527c['query']);_0x102fb5[_0x1d34('0x33')]=_[_0x1d34('0x34')](_0x2b527c[_0x1d34('0x2f')],qs[_0x1d34('0x35')](_0x50f05a[_0x1d34('0x30')][_0x1d34('0x35')]));_0x102fb5[_0x1d34('0x33')]=_0x102fb5[_0x1d34('0x33')]['length']?_0x102fb5[_0x1d34('0x33')]:_0x2b527c[_0x1d34('0x2f')];if(!_0x50f05a['query']['hasOwnProperty']('nolimit')){_0x102fb5[_0x1d34('0x1a')]=qs[_0x1d34('0x1a')](_0x50f05a[_0x1d34('0x30')]['limit']);_0x102fb5[_0x1d34('0x1c')]=qs[_0x1d34('0x1c')](_0x50f05a[_0x1d34('0x30')]['offset']);}_0x102fb5[_0x1d34('0x36')]=qs[_0x1d34('0x37')](_0x50f05a[_0x1d34('0x30')][_0x1d34('0x37')]);_0x102fb5[_0x1d34('0x38')]=qs[_0x1d34('0x32')](_[_0x1d34('0x39')](_0x50f05a[_0x1d34('0x30')],_0x2b527c['filters']),_0x2fa1d9);if(_0x50f05a[_0x1d34('0x30')][_0x1d34('0x3a')]){_0x102fb5[_0x1d34('0x38')]=_[_0x1d34('0x3b')](_0x102fb5[_0x1d34('0x38')],{'$or':_['map'](_0x2fa1d9,function(_0x382d7b){if(_0x382d7b[_0x1d34('0x2e')]!==_0x1d34('0x3c')){var _0x4a6f20={};_0x4a6f20[_0x382d7b[_0x1d34('0x28')]]={'$like':'%'+_0x50f05a[_0x1d34('0x30')][_0x1d34('0x3a')]+'%'};return _0x4a6f20;}})});}_0x102fb5=_['merge']({},_0x102fb5,_0x50f05a[_0x1d34('0x3d')]);var _0x370480={'where':_0x102fb5[_0x1d34('0x38')]};return db[_0x1d34('0x3e')][_0x1d34('0x1b')](_0x370480)[_0x1d34('0x24')](function(_0xb3a1af){_0x1c1fd6[_0x1d34('0x1b')]=_0xb3a1af;if(_0x50f05a[_0x1d34('0x30')][_0x1d34('0x3f')]){_0x102fb5[_0x1d34('0x40')]=[{'all':!![]}];}return db[_0x1d34('0x3e')][_0x1d34('0x41')](_0x102fb5);})[_0x1d34('0x24')](function(_0x52acb9){_0x1c1fd6[_0x1d34('0x42')]=_0x52acb9;return _0x1c1fd6;})[_0x1d34('0x24')](respondWithFilteredResult(_0x593e2e,_0x102fb5))[_0x1d34('0x43')](handleError(_0x593e2e,null));};exports[_0x1d34('0x44')]=function(_0x1afaa7,_0x108a7b){var _0x21a049={'raw':!![],'where':{'id':_0x1afaa7[_0x1d34('0x45')]['id']}},_0x45911e={};_0x45911e[_0x1d34('0x2f')]=_[_0x1d34('0x31')](db[_0x1d34('0x3e')][_0x1d34('0x2c')]);_0x45911e[_0x1d34('0x30')]=_['keys'](_0x1afaa7[_0x1d34('0x30')]);_0x45911e[_0x1d34('0x32')]=_[_0x1d34('0x34')](_0x45911e[_0x1d34('0x2f')],_0x45911e[_0x1d34('0x30')]);_0x21a049['attributes']=_[_0x1d34('0x34')](_0x45911e[_0x1d34('0x2f')],qs[_0x1d34('0x35')](_0x1afaa7['query'][_0x1d34('0x35')]));_0x21a049['attributes']=_0x21a049['attributes'][_0x1d34('0x46')]?_0x21a049['attributes']:_0x45911e[_0x1d34('0x2f')];if(_0x1afaa7[_0x1d34('0x30')]['includeAll']){_0x21a049[_0x1d34('0x40')]=[{'all':!![]}];}_0x21a049=_[_0x1d34('0x3b')]({},_0x21a049,_0x1afaa7[_0x1d34('0x3d')]);return db[_0x1d34('0x3e')][_0x1d34('0x47')](_0x21a049)['then'](handleEntityNotFound(_0x108a7b,null))[_0x1d34('0x24')](respondWithResult(_0x108a7b,null))[_0x1d34('0x43')](handleError(_0x108a7b,null));};exports[_0x1d34('0x48')]=function(_0x310398,_0x345968){return db['OpenchannelQueueReport'][_0x1d34('0x48')](_0x310398[_0x1d34('0x49')],{})[_0x1d34('0x24')](respondWithResult(_0x345968,0xc9))['catch'](handleError(_0x345968,null));};exports[_0x1d34('0x23')]=function(_0x217a18,_0xde0094){if(_0x217a18[_0x1d34('0x49')]['id']){delete _0x217a18[_0x1d34('0x49')]['id'];}return db[_0x1d34('0x3e')][_0x1d34('0x47')]({'where':{'id':_0x217a18[_0x1d34('0x45')]['id']}})['then'](handleEntityNotFound(_0xde0094,null))[_0x1d34('0x24')](saveUpdates(_0x217a18['body'],null))[_0x1d34('0x24')](respondWithResult(_0xde0094,null))[_0x1d34('0x43')](handleError(_0xde0094,null));};exports['destroy']=function(_0xd84067,_0x395063){return db[_0x1d34('0x3e')][_0x1d34('0x47')]({'where':{'id':_0xd84067['params']['id']}})[_0x1d34('0x24')](handleEntityNotFound(_0x395063,null))[_0x1d34('0x24')](removeEntity(_0x395063,null))[_0x1d34('0x43')](handleError(_0x395063,null));};exports['describe']=function(_0x287bc0,_0x203d1f){return db[_0x1d34('0x3e')][_0x1d34('0x4a')]()['then'](respondWithResult(_0x203d1f,null))[_0x1d34('0x43')](handleError(_0x203d1f,null));}; \ No newline at end of file +var _0x98bc=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','filter','merge','options','OpenchannelQueueReport','includeAll','include','rows','catch','params','rawAttributes','intersection','create','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x98bc,0x15b));var _0xc98b=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x98bc[_0x1d558c];return _0x15767d;};'use strict';var emlformat=require(_0xc98b('0x0'));var rimraf=require(_0xc98b('0x1'));var zipdir=require(_0xc98b('0x2'));var jsonpatch=require(_0xc98b('0x3'));var rp=require(_0xc98b('0x4'));var moment=require(_0xc98b('0x5'));var BPromise=require(_0xc98b('0x6'));var Mustache=require(_0xc98b('0x7'));var util=require('util');var path=require(_0xc98b('0x8'));var sox=require(_0xc98b('0x9'));var csv=require('to-csv');var ejs=require(_0xc98b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc98b('0xb'));var squel=require(_0xc98b('0xc'));var crypto=require(_0xc98b('0xd'));var jsforce=require(_0xc98b('0xe'));var deskjs=require(_0xc98b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc98b('0x10'));var Redis=require('ioredis');var authService=require(_0xc98b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc98b('0x12'));var logger=require(_0xc98b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc98b('0x14'));var licenseUtil=require(_0xc98b('0x15'));var db=require(_0xc98b('0x16'))['db'];function respondWithStatusCode(_0x3a4ff7,_0x4b289c){_0x4b289c=_0x4b289c||0xcc;return function(_0x8449b8){if(_0x8449b8){return _0x3a4ff7['sendStatus'](_0x4b289c);}return _0x3a4ff7['status'](_0x4b289c)['end']();};}function respondWithResult(_0x5610b4,_0x45af53){_0x45af53=_0x45af53||0xc8;return function(_0x129138){if(_0x129138){return _0x5610b4['status'](_0x45af53)[_0xc98b('0x17')](_0x129138);}};}function respondWithFilteredResult(_0x4b16e4,_0x5cad73){return function(_0x1234b2){if(_0x1234b2){var _0x23c172=typeof _0x5cad73[_0xc98b('0x18')]==='undefined'&&typeof _0x5cad73[_0xc98b('0x19')]===_0xc98b('0x1a');var _0xa61f65=_0x1234b2[_0xc98b('0x1b')];var _0x21d261=_0x23c172?0x0:_0x5cad73['offset'];var _0x1b1783=_0x23c172?_0x1234b2['count']:_0x5cad73[_0xc98b('0x18')]+_0x5cad73[_0xc98b('0x19')];var _0x589da3;if(_0x1b1783>=_0xa61f65){_0x1b1783=_0xa61f65;_0x589da3=0xc8;}else{_0x589da3=0xce;}_0x4b16e4[_0xc98b('0x1c')](_0x589da3);return _0x4b16e4[_0xc98b('0x1d')](_0xc98b('0x1e'),_0x21d261+'-'+_0x1b1783+'/'+_0xa61f65)[_0xc98b('0x17')](_0x1234b2);}return null;};}function patchUpdates(_0x18bb1d){return function(_0xc8562c){try{jsonpatch['apply'](_0xc8562c,_0x18bb1d,!![]);}catch(_0x10e9be){return BPromise[_0xc98b('0x1f')](_0x10e9be);}return _0xc8562c['save']();};}function saveUpdates(_0x5ce65e,_0xf4fea){return function(_0x3a3677){if(_0x3a3677){return _0x3a3677[_0xc98b('0x20')](_0x5ce65e)[_0xc98b('0x21')](function(_0x127b08){return _0x127b08;});}return null;};}function removeEntity(_0xc93be5,_0x314cdb){return function(_0x2c4d58){if(_0x2c4d58){return _0x2c4d58[_0xc98b('0x22')]()[_0xc98b('0x21')](function(){_0xc93be5[_0xc98b('0x1c')](0xcc)[_0xc98b('0x23')]();});}};}function handleEntityNotFound(_0x2fc4b0,_0x142016){return function(_0x265bfe){if(!_0x265bfe){_0x2fc4b0[_0xc98b('0x24')](0x194);}return _0x265bfe;};}function handleError(_0x4f4826,_0x3b5f00){_0x3b5f00=_0x3b5f00||0x1f4;return function(_0x94c4ae){logger[_0xc98b('0x25')](_0x94c4ae[_0xc98b('0x26')]);if(_0x94c4ae[_0xc98b('0x27')]){delete _0x94c4ae['name'];}_0x4f4826[_0xc98b('0x1c')](_0x3b5f00)[_0xc98b('0x28')](_0x94c4ae);};}exports['index']=function(_0x3f4aca,_0x1f53da){var _0x52763d={},_0x12ba8d={},_0x54566f={'count':0x0,'rows':[]};var _0x49fdc5=_[_0xc98b('0x29')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x595db0){return{'name':_0x595db0[_0xc98b('0x2a')],'type':_0x595db0[_0xc98b('0x2b')][_0xc98b('0x2c')]};});_0x12ba8d[_0xc98b('0x2d')]=_['map'](_0x49fdc5,_0xc98b('0x27'));_0x12ba8d[_0xc98b('0x2e')]=_[_0xc98b('0x2f')](_0x3f4aca['query']);_0x12ba8d[_0xc98b('0x30')]=_['intersection'](_0x12ba8d[_0xc98b('0x2d')],_0x12ba8d[_0xc98b('0x2e')]);_0x52763d[_0xc98b('0x31')]=_['intersection'](_0x12ba8d[_0xc98b('0x2d')],qs[_0xc98b('0x32')](_0x3f4aca['query'][_0xc98b('0x32')]));_0x52763d[_0xc98b('0x31')]=_0x52763d[_0xc98b('0x31')][_0xc98b('0x33')]?_0x52763d[_0xc98b('0x31')]:_0x12ba8d['model'];if(!_0x3f4aca[_0xc98b('0x2e')]['hasOwnProperty']('nolimit')){_0x52763d['limit']=qs[_0xc98b('0x19')](_0x3f4aca[_0xc98b('0x2e')][_0xc98b('0x19')]);_0x52763d[_0xc98b('0x18')]=qs[_0xc98b('0x18')](_0x3f4aca[_0xc98b('0x2e')][_0xc98b('0x18')]);}_0x52763d[_0xc98b('0x34')]=qs[_0xc98b('0x35')](_0x3f4aca['query']['sort']);_0x52763d[_0xc98b('0x36')]=qs[_0xc98b('0x30')](_['pick'](_0x3f4aca[_0xc98b('0x2e')],_0x12ba8d[_0xc98b('0x30')]),_0x49fdc5);if(_0x3f4aca['query'][_0xc98b('0x37')]){_0x52763d['where']=_[_0xc98b('0x38')](_0x52763d[_0xc98b('0x36')],{'$or':_[_0xc98b('0x29')](_0x49fdc5,function(_0x549ab8){if(_0x549ab8[_0xc98b('0x2b')]!=='VIRTUAL'){var _0x2839ba={};_0x2839ba[_0x549ab8[_0xc98b('0x27')]]={'$like':'%'+_0x3f4aca[_0xc98b('0x2e')]['filter']+'%'};return _0x2839ba;}})});}_0x52763d=_[_0xc98b('0x38')]({},_0x52763d,_0x3f4aca[_0xc98b('0x39')]);var _0xba15c5={'where':_0x52763d[_0xc98b('0x36')]};return db[_0xc98b('0x3a')][_0xc98b('0x1b')](_0xba15c5)[_0xc98b('0x21')](function(_0x26605c){_0x54566f[_0xc98b('0x1b')]=_0x26605c;if(_0x3f4aca['query'][_0xc98b('0x3b')]){_0x52763d[_0xc98b('0x3c')]=[{'all':!![]}];}return db[_0xc98b('0x3a')]['findAll'](_0x52763d);})[_0xc98b('0x21')](function(_0x1f78db){_0x54566f[_0xc98b('0x3d')]=_0x1f78db;return _0x54566f;})[_0xc98b('0x21')](respondWithFilteredResult(_0x1f53da,_0x52763d))[_0xc98b('0x3e')](handleError(_0x1f53da,null));};exports['show']=function(_0x4e43ae,_0xad53a){var _0x340747={'raw':!![],'where':{'id':_0x4e43ae[_0xc98b('0x3f')]['id']}},_0x3dabdf={};_0x3dabdf[_0xc98b('0x2d')]=_[_0xc98b('0x2f')](db[_0xc98b('0x3a')][_0xc98b('0x40')]);_0x3dabdf[_0xc98b('0x2e')]=_[_0xc98b('0x2f')](_0x4e43ae[_0xc98b('0x2e')]);_0x3dabdf[_0xc98b('0x30')]=_['intersection'](_0x3dabdf[_0xc98b('0x2d')],_0x3dabdf[_0xc98b('0x2e')]);_0x340747[_0xc98b('0x31')]=_[_0xc98b('0x41')](_0x3dabdf[_0xc98b('0x2d')],qs[_0xc98b('0x32')](_0x4e43ae['query'][_0xc98b('0x32')]));_0x340747[_0xc98b('0x31')]=_0x340747['attributes'][_0xc98b('0x33')]?_0x340747[_0xc98b('0x31')]:_0x3dabdf['model'];if(_0x4e43ae['query'][_0xc98b('0x3b')]){_0x340747[_0xc98b('0x3c')]=[{'all':!![]}];}_0x340747=_['merge']({},_0x340747,_0x4e43ae['options']);return db['OpenchannelQueueReport']['find'](_0x340747)[_0xc98b('0x21')](handleEntityNotFound(_0xad53a,null))[_0xc98b('0x21')](respondWithResult(_0xad53a,null))[_0xc98b('0x3e')](handleError(_0xad53a,null));};exports[_0xc98b('0x42')]=function(_0xc05d44,_0x3d56e9){return db['OpenchannelQueueReport'][_0xc98b('0x42')](_0xc05d44['body'],{})[_0xc98b('0x21')](respondWithResult(_0x3d56e9,0xc9))[_0xc98b('0x3e')](handleError(_0x3d56e9,null));};exports[_0xc98b('0x20')]=function(_0x35b48f,_0x533031){if(_0x35b48f[_0xc98b('0x43')]['id']){delete _0x35b48f[_0xc98b('0x43')]['id'];}return db[_0xc98b('0x3a')][_0xc98b('0x44')]({'where':{'id':_0x35b48f[_0xc98b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x533031,null))['then'](saveUpdates(_0x35b48f[_0xc98b('0x43')],null))[_0xc98b('0x21')](respondWithResult(_0x533031,null))[_0xc98b('0x3e')](handleError(_0x533031,null));};exports['destroy']=function(_0x53d904,_0x5bb01d){return db[_0xc98b('0x3a')][_0xc98b('0x44')]({'where':{'id':_0x53d904[_0xc98b('0x3f')]['id']}})[_0xc98b('0x21')](handleEntityNotFound(_0x5bb01d,null))['then'](removeEntity(_0x5bb01d,null))[_0xc98b('0x3e')](handleError(_0x5bb01d,null));};exports[_0xc98b('0x45')]=function(_0x267c08,_0x4c1764){return db[_0xc98b('0x3a')][_0xc98b('0x45')]()[_0xc98b('0x21')](respondWithResult(_0x4c1764,null))[_0xc98b('0x3e')](handleError(_0x4c1764,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e81bdc7..6ea6130 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x3a8953,_0x90a9fb){var _0xe3c639=function(_0x50d824){while(--_0x50d824){_0x3a8953['push'](_0x3a8953['shift']());}};_0xe3c639(++_0x90a9fb);}(_0x326f,0xd1));var _0xf326=function(_0x56cd39,_0x41c694){_0x56cd39=_0x56cd39-0x0;var _0x570754=_0x326f[_0x56cd39];return _0x570754;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x2bcc1d,_0x101e28){var _0xa89608=function(_0x39e168){while(--_0x39e168){_0x2bcc1d['push'](_0x2bcc1d['shift']());}};_0xa89608(++_0x101e28);}(_0xe14b,0x93));var _0xbe14=function(_0x5097da,_0x4029c9){_0x5097da=_0x5097da-0x0;var _0x144590=_0xe14b[_0x5097da];return _0x144590;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b2b5679..e04f7d2 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 _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash'];(function(_0x164435,_0x1b2536){var _0x5db537=function(_0x2d56b0){while(--_0x2d56b0){_0x164435['push'](_0x164435['shift']());}};_0x5db537(++_0x1b2536);}(_0x6cb4,0xff));var _0x46cb=function(_0x552008,_0x59da0b){_0x552008=_0x552008-0x0;var _0x7d5c8d=_0x6cb4[_0x552008];return _0x7d5c8d;};'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});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateOpenchannelQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0xaa5e=['UpdateOpenchannelQueueReport','update','body','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','debug','catch'];(function(_0x497934,_0x185d41){var _0x3156d9=function(_0x3d7cce){while(--_0x3d7cce){_0x497934['push'](_0x497934['shift']());}};_0x3156d9(++_0x185d41);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x32cf79,_0x4b166c){_0x32cf79=_0x32cf79-0x0;var _0x1119e4=_0xaa5e[_0x32cf79];return _0x1119e4;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});}exports['CreateOpenchannelQueueReport']=function(_0x1877a6){var _0x50256a=this;return new Promise(function(_0x222da7,_0x85fb44){return db[_0xeaa5('0x14')][_0xeaa5('0x15')](_0x1877a6['body'],{'raw':_0x1877a6[_0xeaa5('0x16')]?_0x1877a6[_0xeaa5('0x16')][_0xeaa5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x11ace2){logger[_0xeaa5('0x13')](_0xeaa5('0x18'),_0x1877a6);logger[_0xeaa5('0x19')](_0xeaa5('0x18'),_0x1877a6,JSON['stringify'](_0x11ace2));_0x222da7(_0x11ace2);})[_0xeaa5('0x1a')](function(_0x5f2d83){logger[_0xeaa5('0x10')](_0xeaa5('0x18'),_0x5f2d83[_0xeaa5('0x12')],_0x1877a6);_0x85fb44(_0x50256a[_0xeaa5('0x10')](0x1f4,_0x5f2d83[_0xeaa5('0x12')]));});});};exports[_0xeaa5('0x1b')]=function(_0x355dbd){var _0xee844c=this;return new Promise(function(_0xebce8c,_0x2c4003){return db[_0xeaa5('0x14')][_0xeaa5('0x1c')](_0x355dbd[_0xeaa5('0x1d')],{'raw':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['where']||null:null,'attributes':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')][_0xeaa5('0x1e')]||null:null,'limit':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['limit']||null:null})[_0xeaa5('0x1f')](function(_0x592fe1){logger[_0xeaa5('0x13')](_0xeaa5('0x1b'),_0x355dbd);logger[_0xeaa5('0x19')](_0xeaa5('0x1b'),_0x355dbd,JSON[_0xeaa5('0xf')](_0x592fe1));_0xebce8c(_0x592fe1);})[_0xeaa5('0x1a')](function(_0x5121b6){logger[_0xeaa5('0x10')](_0xeaa5('0x1b'),_0x5121b6['message'],_0x355dbd);_0x2c4003(_0xee844c[_0xeaa5('0x10')](0x1f4,_0x5121b6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ac1cb5e..2d495a8 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 _0xc676=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','put'];(function(_0xee02b8,_0x128c30){var _0x527bff=function(_0x13cfed){while(--_0x13cfed){_0xee02b8['push'](_0xee02b8['shift']());}};_0x527bff(++_0x128c30);}(_0xc676,0x101));var _0x6c67=function(_0x52f21b,_0x1cfe7f){_0x52f21b=_0x52f21b-0x0;var _0x549b61=_0xc676[_0x52f21b];return _0x549b61;};'use strict';var multer=require(_0x6c67('0x0'));var util=require(_0x6c67('0x1'));var path=require(_0x6c67('0x2'));var timeout=require(_0x6c67('0x3'));var express=require(_0x6c67('0x4'));var router=express[_0x6c67('0x5')]();var fs_extra=require(_0x6c67('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6c67('0x7'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x6c67('0x8')]('/',auth[_0x6c67('0x9')](),controller[_0x6c67('0xa')]);router[_0x6c67('0x8')](_0x6c67('0xb'),auth[_0x6c67('0x9')](),controller['describe']);router['get'](_0x6c67('0xc'),auth['isAuthenticated'](),controller[_0x6c67('0xd')]);router['post']('/',auth[_0x6c67('0x9')](),controller['create']);router[_0x6c67('0xe')](_0x6c67('0xc'),auth['isAuthenticated'](),controller[_0x6c67('0xf')]);router['delete'](_0x6c67('0xc'),auth[_0x6c67('0x9')](),controller['destroy']);module[_0x6c67('0x10')]=router; \ No newline at end of file +var _0xee4d=['destroy','util','express','Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','get','/describe','/:id','show','update'];(function(_0x10c96d,_0x4b7a53){var _0x58e63e=function(_0x403f54){while(--_0x403f54){_0x10c96d['push'](_0x10c96d['shift']());}};_0x58e63e(++_0x4b7a53);}(_0xee4d,0x16d));var _0xdee4=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xee4d[_0x28aea5];return _0x6a55f9;};'use strict';var multer=require('multer');var util=require(_0xdee4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdee4('0x1'));var router=express[_0xdee4('0x2')]();var fs_extra=require(_0xdee4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdee4('0x4'));var config=require('../../config/environment');var controller=require(_0xdee4('0x5'));router['get']('/',auth[_0xdee4('0x6')](),controller['index']);router[_0xdee4('0x7')](_0xdee4('0x8'),auth[_0xdee4('0x6')](),controller['describe']);router[_0xdee4('0x7')](_0xdee4('0x9'),auth[_0xdee4('0x6')](),controller[_0xdee4('0xa')]);router['post']('/',auth[_0xdee4('0x6')](),controller['create']);router['put'](_0xdee4('0x9'),auth[_0xdee4('0x6')](),controller[_0xdee4('0xb')]);router['delete'](_0xdee4('0x9'),auth['isAuthenticated'](),controller[_0xdee4('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2c09d33..d4f2598 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x995fd8,_0x25cc4d){var _0x1ed791=function(_0x3f8bc8){while(--_0x3f8bc8){_0x995fd8['push'](_0x995fd8['shift']());}};_0x1ed791(++_0x25cc4d);}(_0x008c,0x188));var _0xc008=function(_0x366647,_0xd7065c){_0x366647=_0x366647-0x0;var _0x54aed1=_0x008c[_0x366647];return _0x54aed1;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5eca6f,_0x76ec15){var _0x4c34b7=function(_0x52cbe1){while(--_0x52cbe1){_0x5eca6f['push'](_0x5eca6f['shift']());}};_0x4c34b7(++_0x76ec15);}(_0x008c,0x188));var _0xc008=function(_0x30c83b,_0x1773d9){_0x30c83b=_0x30c83b-0x0;var _0x14bbc9=_0x008c[_0x30c83b];return _0x14bbc9;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 33d34e5..39c475d 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 _0xf1bc=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf1bc,0x117));var _0xcf1b=function(_0x2ed354,_0x21731b){_0x2ed354=_0x2ed354-0x0;var _0x326730=_0xf1bc[_0x2ed354];return _0x326730;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf1b('0x0'));var zipdir=require(_0xcf1b('0x1'));var jsonpatch=require(_0xcf1b('0x2'));var rp=require(_0xcf1b('0x3'));var moment=require(_0xcf1b('0x4'));var BPromise=require(_0xcf1b('0x5'));var Mustache=require(_0xcf1b('0x6'));var util=require(_0xcf1b('0x7'));var path=require(_0xcf1b('0x8'));var sox=require('sox');var csv=require(_0xcf1b('0x9'));var ejs=require(_0xcf1b('0xa'));var fs=require('fs');var fs_extra=require(_0xcf1b('0xb'));var _=require(_0xcf1b('0xc'));var squel=require(_0xcf1b('0xd'));var crypto=require(_0xcf1b('0xe'));var jsforce=require(_0xcf1b('0xf'));var deskjs=require(_0xcf1b('0x10'));var toCsv=require(_0xcf1b('0x9'));var querystring=require(_0xcf1b('0x11'));var Papa=require('papaparse');var Redis=require(_0xcf1b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcf1b('0x13'));var as=require(_0xcf1b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf1b('0x15'))(_0xcf1b('0x16'));var utils=require(_0xcf1b('0x17'));var config=require(_0xcf1b('0x18'));var licenseUtil=require(_0xcf1b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4793e8,_0x52c7be){_0x52c7be=_0x52c7be||0xcc;return function(_0x462f60){if(_0x462f60){return _0x4793e8[_0xcf1b('0x1a')](_0x52c7be);}return _0x4793e8[_0xcf1b('0x1b')](_0x52c7be)[_0xcf1b('0x1c')]();};}function respondWithResult(_0x50932d,_0x1f9ac0){_0x1f9ac0=_0x1f9ac0||0xc8;return function(_0x3b6058){if(_0x3b6058){return _0x50932d[_0xcf1b('0x1b')](_0x1f9ac0)[_0xcf1b('0x1d')](_0x3b6058);}};}function respondWithFilteredResult(_0x468968,_0xb7508f){return function(_0x122d03){if(_0x122d03){var _0x87f1c=typeof _0xb7508f[_0xcf1b('0x1e')]===_0xcf1b('0x1f')&&typeof _0xb7508f[_0xcf1b('0x20')]===_0xcf1b('0x1f');var _0x162020=_0x122d03[_0xcf1b('0x21')];var _0x4243a8=_0x87f1c?0x0:_0xb7508f[_0xcf1b('0x1e')];var _0x6d81ce=_0x87f1c?_0x122d03[_0xcf1b('0x21')]:_0xb7508f['offset']+_0xb7508f['limit'];var _0x3d2ef2;if(_0x6d81ce>=_0x162020){_0x6d81ce=_0x162020;_0x3d2ef2=0xc8;}else{_0x3d2ef2=0xce;}_0x468968[_0xcf1b('0x1b')](_0x3d2ef2);return _0x468968['set'](_0xcf1b('0x22'),_0x4243a8+'-'+_0x6d81ce+'/'+_0x162020)['json'](_0x122d03);}return null;};}function patchUpdates(_0x2a2142){return function(_0x67b29f){try{jsonpatch[_0xcf1b('0x23')](_0x67b29f,_0x2a2142,!![]);}catch(_0x4c2c98){return BPromise[_0xcf1b('0x24')](_0x4c2c98);}return _0x67b29f[_0xcf1b('0x25')]();};}function saveUpdates(_0x7a41e4,_0x1f25e3){return function(_0x186499){if(_0x186499){return _0x186499['update'](_0x7a41e4)[_0xcf1b('0x26')](function(_0x32d945){return _0x32d945;});}return null;};}function removeEntity(_0x3720dc,_0x14af88){return function(_0x187ab4){if(_0x187ab4){return _0x187ab4['destroy']()[_0xcf1b('0x26')](function(){_0x3720dc[_0xcf1b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a2d6,_0x282bdc){return function(_0x9b3784){if(!_0x9b3784){_0x46a2d6[_0xcf1b('0x1a')](0x194);}return _0x9b3784;};}function handleError(_0x4df391,_0xc541c5){_0xc541c5=_0xc541c5||0x1f4;return function(_0x566828){logger[_0xcf1b('0x27')](_0x566828[_0xcf1b('0x28')]);if(_0x566828[_0xcf1b('0x29')]){delete _0x566828[_0xcf1b('0x29')];}_0x4df391[_0xcf1b('0x1b')](_0xc541c5)['send'](_0x566828);};}exports[_0xcf1b('0x2a')]=function(_0x580aba,_0x500ea5){var _0x1de133={},_0xccbbd={},_0x2ef0ae={'count':0x0,'rows':[]};var _0x1e9616=_[_0xcf1b('0x2b')](db['OpenchannelTransferReport'][_0xcf1b('0x2c')],function(_0x56094d){return{'name':_0x56094d['fieldName'],'type':_0x56094d[_0xcf1b('0x2d')][_0xcf1b('0x2e')]};});_0xccbbd[_0xcf1b('0x2f')]=_[_0xcf1b('0x2b')](_0x1e9616,_0xcf1b('0x29'));_0xccbbd[_0xcf1b('0x30')]=_[_0xcf1b('0x31')](_0x580aba['query']);_0xccbbd['filters']=_[_0xcf1b('0x32')](_0xccbbd[_0xcf1b('0x2f')],_0xccbbd[_0xcf1b('0x30')]);_0x1de133['attributes']=_['intersection'](_0xccbbd['model'],qs[_0xcf1b('0x33')](_0x580aba[_0xcf1b('0x30')][_0xcf1b('0x33')]));_0x1de133[_0xcf1b('0x34')]=_0x1de133[_0xcf1b('0x34')]['length']?_0x1de133[_0xcf1b('0x34')]:_0xccbbd[_0xcf1b('0x2f')];if(!_0x580aba['query'][_0xcf1b('0x35')](_0xcf1b('0x36'))){_0x1de133['limit']=qs['limit'](_0x580aba[_0xcf1b('0x30')][_0xcf1b('0x20')]);_0x1de133[_0xcf1b('0x1e')]=qs[_0xcf1b('0x1e')](_0x580aba[_0xcf1b('0x30')][_0xcf1b('0x1e')]);}_0x1de133[_0xcf1b('0x37')]=qs[_0xcf1b('0x38')](_0x580aba['query'][_0xcf1b('0x38')]);_0x1de133[_0xcf1b('0x39')]=qs[_0xcf1b('0x3a')](_[_0xcf1b('0x3b')](_0x580aba[_0xcf1b('0x30')],_0xccbbd['filters']),_0x1e9616);if(_0x580aba[_0xcf1b('0x30')][_0xcf1b('0x3c')]){_0x1de133['where']=_[_0xcf1b('0x3d')](_0x1de133[_0xcf1b('0x39')],{'$or':_[_0xcf1b('0x2b')](_0x1e9616,function(_0x325947){if(_0x325947[_0xcf1b('0x2d')]!==_0xcf1b('0x3e')){var _0x421255={};_0x421255[_0x325947[_0xcf1b('0x29')]]={'$like':'%'+_0x580aba[_0xcf1b('0x30')][_0xcf1b('0x3c')]+'%'};return _0x421255;}})});}_0x1de133=_['merge']({},_0x1de133,_0x580aba[_0xcf1b('0x3f')]);var _0x63743={'where':_0x1de133['where']};return db[_0xcf1b('0x40')]['count'](_0x63743)[_0xcf1b('0x26')](function(_0x52be46){_0x2ef0ae['count']=_0x52be46;if(_0x580aba['query'][_0xcf1b('0x41')]){_0x1de133[_0xcf1b('0x42')]=[{'all':!![]}];}return db[_0xcf1b('0x40')][_0xcf1b('0x43')](_0x1de133);})[_0xcf1b('0x26')](function(_0x4f2bf3){_0x2ef0ae['rows']=_0x4f2bf3;return _0x2ef0ae;})[_0xcf1b('0x26')](respondWithFilteredResult(_0x500ea5,_0x1de133))[_0xcf1b('0x44')](handleError(_0x500ea5,null));};exports[_0xcf1b('0x45')]=function(_0x4609cd,_0x5d4936){var _0x46861e={'raw':!![],'where':{'id':_0x4609cd[_0xcf1b('0x46')]['id']}},_0x541105={};_0x541105['model']=_[_0xcf1b('0x31')](db[_0xcf1b('0x40')][_0xcf1b('0x2c')]);_0x541105[_0xcf1b('0x30')]=_['keys'](_0x4609cd[_0xcf1b('0x30')]);_0x541105['filters']=_[_0xcf1b('0x32')](_0x541105['model'],_0x541105[_0xcf1b('0x30')]);_0x46861e[_0xcf1b('0x34')]=_[_0xcf1b('0x32')](_0x541105[_0xcf1b('0x2f')],qs[_0xcf1b('0x33')](_0x4609cd[_0xcf1b('0x30')][_0xcf1b('0x33')]));_0x46861e['attributes']=_0x46861e[_0xcf1b('0x34')][_0xcf1b('0x47')]?_0x46861e[_0xcf1b('0x34')]:_0x541105[_0xcf1b('0x2f')];if(_0x4609cd[_0xcf1b('0x30')][_0xcf1b('0x41')]){_0x46861e[_0xcf1b('0x42')]=[{'all':!![]}];}_0x46861e=_[_0xcf1b('0x3d')]({},_0x46861e,_0x4609cd['options']);return db[_0xcf1b('0x40')][_0xcf1b('0x48')](_0x46861e)[_0xcf1b('0x26')](handleEntityNotFound(_0x5d4936,null))[_0xcf1b('0x26')](respondWithResult(_0x5d4936,null))['catch'](handleError(_0x5d4936,null));};exports[_0xcf1b('0x49')]=function(_0x4b93ae,_0xcda560){return db['OpenchannelTransferReport'][_0xcf1b('0x49')](_0x4b93ae[_0xcf1b('0x4a')],{})[_0xcf1b('0x26')](respondWithResult(_0xcda560,0xc9))[_0xcf1b('0x44')](handleError(_0xcda560,null));};exports['update']=function(_0x7a2b00,_0x119e10){if(_0x7a2b00[_0xcf1b('0x4a')]['id']){delete _0x7a2b00[_0xcf1b('0x4a')]['id'];}return db[_0xcf1b('0x40')][_0xcf1b('0x48')]({'where':{'id':_0x7a2b00[_0xcf1b('0x46')]['id']}})[_0xcf1b('0x26')](handleEntityNotFound(_0x119e10,null))['then'](saveUpdates(_0x7a2b00[_0xcf1b('0x4a')],null))[_0xcf1b('0x26')](respondWithResult(_0x119e10,null))[_0xcf1b('0x44')](handleError(_0x119e10,null));};exports[_0xcf1b('0x4b')]=function(_0x41fde7,_0x1a68d1){return db[_0xcf1b('0x40')][_0xcf1b('0x48')]({'where':{'id':_0x41fde7[_0xcf1b('0x46')]['id']}})[_0xcf1b('0x26')](handleEntityNotFound(_0x1a68d1,null))[_0xcf1b('0x26')](removeEntity(_0x1a68d1,null))[_0xcf1b('0x44')](handleError(_0x1a68d1,null));};exports[_0xcf1b('0x4c')]=function(_0x10a9dd,_0xb7c4f6){return db['OpenchannelTransferReport'][_0xcf1b('0x4c')]()[_0xcf1b('0x26')](respondWithResult(_0xb7c4f6,null))[_0xcf1b('0x44')](handleError(_0xb7c4f6,null));}; \ No newline at end of file +var _0x177e=['describe','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','save','then','destroy','end','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','keys','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','length','include','catch','create','body','find'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x177e,0xd0));var _0xe177=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x177e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe177('0x0'));var util=require(_0xe177('0x1'));var path=require(_0xe177('0x2'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe177('0x3'));var fs=require('fs');var fs_extra=require(_0xe177('0x4'));var _=require(_0xe177('0x5'));var squel=require('squel');var crypto=require(_0xe177('0x6'));var jsforce=require(_0xe177('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe177('0x8'));var querystring=require(_0xe177('0x9'));var Papa=require(_0xe177('0xa'));var Redis=require(_0xe177('0xb'));var authService=require(_0xe177('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe177('0xd'));var hardwareService=require(_0xe177('0xe'));var logger=require(_0xe177('0xf'))(_0xe177('0x10'));var utils=require('../../config/utils');var config=require(_0xe177('0x11'));var licenseUtil=require(_0xe177('0x12'));var db=require(_0xe177('0x13'))['db'];function respondWithStatusCode(_0x1b73e8,_0x41117a){_0x41117a=_0x41117a||0xcc;return function(_0x12c669){if(_0x12c669){return _0x1b73e8[_0xe177('0x14')](_0x41117a);}return _0x1b73e8['status'](_0x41117a)['end']();};}function respondWithResult(_0x1ced00,_0x460a93){_0x460a93=_0x460a93||0xc8;return function(_0x2fa50e){if(_0x2fa50e){return _0x1ced00['status'](_0x460a93)[_0xe177('0x15')](_0x2fa50e);}};}function respondWithFilteredResult(_0x22c4bc,_0xf3ed3b){return function(_0x38d4b5){if(_0x38d4b5){var _0x61eb22=typeof _0xf3ed3b[_0xe177('0x16')]==='undefined'&&typeof _0xf3ed3b['limit']===_0xe177('0x17');var _0x590996=_0x38d4b5['count'];var _0x5c3cb6=_0x61eb22?0x0:_0xf3ed3b[_0xe177('0x16')];var _0x59cf0a=_0x61eb22?_0x38d4b5[_0xe177('0x18')]:_0xf3ed3b['offset']+_0xf3ed3b[_0xe177('0x19')];var _0x5a3c8b;if(_0x59cf0a>=_0x590996){_0x59cf0a=_0x590996;_0x5a3c8b=0xc8;}else{_0x5a3c8b=0xce;}_0x22c4bc[_0xe177('0x1a')](_0x5a3c8b);return _0x22c4bc[_0xe177('0x1b')]('Content-Range',_0x5c3cb6+'-'+_0x59cf0a+'/'+_0x590996)[_0xe177('0x15')](_0x38d4b5);}return null;};}function patchUpdates(_0x501cb7){return function(_0x13ee03){try{jsonpatch['apply'](_0x13ee03,_0x501cb7,!![]);}catch(_0x3bf72b){return BPromise['reject'](_0x3bf72b);}return _0x13ee03[_0xe177('0x1c')]();};}function saveUpdates(_0x8fa793,_0x390e45){return function(_0x53c458){if(_0x53c458){return _0x53c458['update'](_0x8fa793)[_0xe177('0x1d')](function(_0x155027){return _0x155027;});}return null;};}function removeEntity(_0x2c124d,_0xdbf075){return function(_0xf82a62){if(_0xf82a62){return _0xf82a62[_0xe177('0x1e')]()[_0xe177('0x1d')](function(){_0x2c124d[_0xe177('0x1a')](0xcc)[_0xe177('0x1f')]();});}};}function handleEntityNotFound(_0x1125e4,_0x10c1ce){return function(_0x15c191){if(!_0x15c191){_0x1125e4[_0xe177('0x14')](0x194);}return _0x15c191;};}function handleError(_0x1501dc,_0x5d3c39){_0x5d3c39=_0x5d3c39||0x1f4;return function(_0x5a8957){logger['error'](_0x5a8957[_0xe177('0x20')]);if(_0x5a8957[_0xe177('0x21')]){delete _0x5a8957['name'];}_0x1501dc['status'](_0x5d3c39)[_0xe177('0x22')](_0x5a8957);};}exports[_0xe177('0x23')]=function(_0x1c519b,_0x59d9f6){var _0x493df2={},_0xf6995b={},_0x1466ab={'count':0x0,'rows':[]};var _0x126d92=_['map'](db[_0xe177('0x24')][_0xe177('0x25')],function(_0x582d1b){return{'name':_0x582d1b[_0xe177('0x26')],'type':_0x582d1b['type'][_0xe177('0x27')]};});_0xf6995b[_0xe177('0x28')]=_[_0xe177('0x29')](_0x126d92,_0xe177('0x21'));_0xf6995b['query']=_[_0xe177('0x2a')](_0x1c519b[_0xe177('0x2b')]);_0xf6995b['filters']=_['intersection'](_0xf6995b['model'],_0xf6995b['query']);_0x493df2[_0xe177('0x2c')]=_['intersection'](_0xf6995b[_0xe177('0x28')],qs[_0xe177('0x2d')](_0x1c519b[_0xe177('0x2b')][_0xe177('0x2d')]));_0x493df2[_0xe177('0x2c')]=_0x493df2['attributes']['length']?_0x493df2[_0xe177('0x2c')]:_0xf6995b[_0xe177('0x28')];if(!_0x1c519b['query'][_0xe177('0x2e')]('nolimit')){_0x493df2[_0xe177('0x19')]=qs['limit'](_0x1c519b[_0xe177('0x2b')]['limit']);_0x493df2[_0xe177('0x16')]=qs[_0xe177('0x16')](_0x1c519b['query'][_0xe177('0x16')]);}_0x493df2[_0xe177('0x2f')]=qs[_0xe177('0x30')](_0x1c519b[_0xe177('0x2b')][_0xe177('0x30')]);_0x493df2[_0xe177('0x31')]=qs[_0xe177('0x32')](_[_0xe177('0x33')](_0x1c519b['query'],_0xf6995b[_0xe177('0x32')]),_0x126d92);if(_0x1c519b['query'][_0xe177('0x34')]){_0x493df2['where']=_[_0xe177('0x35')](_0x493df2[_0xe177('0x31')],{'$or':_[_0xe177('0x29')](_0x126d92,function(_0x2ecfbc){if(_0x2ecfbc['type']!==_0xe177('0x36')){var _0x173841={};_0x173841[_0x2ecfbc[_0xe177('0x21')]]={'$like':'%'+_0x1c519b[_0xe177('0x2b')][_0xe177('0x34')]+'%'};return _0x173841;}})});}_0x493df2=_['merge']({},_0x493df2,_0x1c519b[_0xe177('0x37')]);var _0x5d7129={'where':_0x493df2[_0xe177('0x31')]};return db[_0xe177('0x24')][_0xe177('0x18')](_0x5d7129)[_0xe177('0x1d')](function(_0x3f3489){_0x1466ab[_0xe177('0x18')]=_0x3f3489;if(_0x1c519b['query'][_0xe177('0x38')]){_0x493df2['include']=[{'all':!![]}];}return db[_0xe177('0x24')][_0xe177('0x39')](_0x493df2);})[_0xe177('0x1d')](function(_0x58a004){_0x1466ab[_0xe177('0x3a')]=_0x58a004;return _0x1466ab;})[_0xe177('0x1d')](respondWithFilteredResult(_0x59d9f6,_0x493df2))['catch'](handleError(_0x59d9f6,null));};exports[_0xe177('0x3b')]=function(_0x2d4ef5,_0x96d91c){var _0x224580={'raw':!![],'where':{'id':_0x2d4ef5[_0xe177('0x3c')]['id']}},_0x2e4adf={};_0x2e4adf[_0xe177('0x28')]=_[_0xe177('0x2a')](db['OpenchannelTransferReport'][_0xe177('0x25')]);_0x2e4adf[_0xe177('0x2b')]=_['keys'](_0x2d4ef5[_0xe177('0x2b')]);_0x2e4adf[_0xe177('0x32')]=_[_0xe177('0x3d')](_0x2e4adf[_0xe177('0x28')],_0x2e4adf[_0xe177('0x2b')]);_0x224580[_0xe177('0x2c')]=_[_0xe177('0x3d')](_0x2e4adf[_0xe177('0x28')],qs[_0xe177('0x2d')](_0x2d4ef5[_0xe177('0x2b')][_0xe177('0x2d')]));_0x224580[_0xe177('0x2c')]=_0x224580['attributes'][_0xe177('0x3e')]?_0x224580[_0xe177('0x2c')]:_0x2e4adf['model'];if(_0x2d4ef5[_0xe177('0x2b')][_0xe177('0x38')]){_0x224580[_0xe177('0x3f')]=[{'all':!![]}];}_0x224580=_['merge']({},_0x224580,_0x2d4ef5[_0xe177('0x37')]);return db[_0xe177('0x24')]['find'](_0x224580)['then'](handleEntityNotFound(_0x96d91c,null))['then'](respondWithResult(_0x96d91c,null))[_0xe177('0x40')](handleError(_0x96d91c,null));};exports[_0xe177('0x41')]=function(_0x1ab147,_0x55e089){return db['OpenchannelTransferReport'][_0xe177('0x41')](_0x1ab147[_0xe177('0x42')],{})[_0xe177('0x1d')](respondWithResult(_0x55e089,0xc9))[_0xe177('0x40')](handleError(_0x55e089,null));};exports['update']=function(_0x4d6eb2,_0x5ddf05){if(_0x4d6eb2[_0xe177('0x42')]['id']){delete _0x4d6eb2['body']['id'];}return db[_0xe177('0x24')]['find']({'where':{'id':_0x4d6eb2['params']['id']}})['then'](handleEntityNotFound(_0x5ddf05,null))[_0xe177('0x1d')](saveUpdates(_0x4d6eb2['body'],null))[_0xe177('0x1d')](respondWithResult(_0x5ddf05,null))[_0xe177('0x40')](handleError(_0x5ddf05,null));};exports[_0xe177('0x1e')]=function(_0x45645b,_0x2650e3){return db[_0xe177('0x24')][_0xe177('0x43')]({'where':{'id':_0x45645b[_0xe177('0x3c')]['id']}})[_0xe177('0x1d')](handleEntityNotFound(_0x2650e3,null))[_0xe177('0x1d')](removeEntity(_0x2650e3,null))[_0xe177('0x40')](handleError(_0x2650e3,null));};exports['describe']=function(_0x5a9a39,_0x8d57a6){return db[_0xe177('0x24')][_0xe177('0x44')]()[_0xe177('0x1d')](respondWithResult(_0x8d57a6,null))['catch'](handleError(_0x8d57a6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 882fa28..4529358 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 _0x556a=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x556a,0x10e));var _0xa556=function(_0x1dbe39,_0x34bb0f){_0x1dbe39=_0x1dbe39-0x0;var _0x507270=_0x556a[_0x1dbe39];return _0x507270;};'use strict';var _=require('lodash');var util=require(_0xa556('0x0'));var logger=require(_0xa556('0x1'))('api');var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rp=require(_0xa556('0x4'));var fs=require('fs');var path=require(_0xa556('0x5'));var rimraf=require(_0xa556('0x6'));var config=require(_0xa556('0x7'));var attributes=require(_0xa556('0x8'));module['exports']=function(_0x6f8a08,_0x7b9212){return _0x6f8a08[_0xa556('0x9')](_0xa556('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a47=['../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x8a47,0x68));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require('util');var logger=require(_0x78a4('0x1'))(_0x78a4('0x2'));var moment=require(_0x78a4('0x3'));var BPromise=require(_0x78a4('0x4'));var rp=require(_0x78a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x78a4('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x78a4('0x7')]=function(_0x2dc2a5,_0x17e719){return _0x2dc2a5['define'](_0x78a4('0x8'),attributes,{'tableName':_0x78a4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x78a4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a9a71d8..cdf8a9c 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 _0xe181=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xe181,0x68));var _0x1e18=function(_0xb5fb77,_0x2ec122){_0xb5fb77=_0xb5fb77-0x0;var _0x3f4101=_0xe181[_0xb5fb77];return _0x3f4101;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});} \ No newline at end of file +var _0x1a28=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c859f,_0x142f72){var _0x5455f2=function(_0x3d3d42){while(--_0x3d3d42){_0x5c859f['push'](_0x5c859f['shift']());}};_0x5455f2(++_0x142f72);}(_0x1a28,0x10e));var _0x81a2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x1a28[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var moment=require(_0x81a2('0x2'));var BPromise=require(_0x81a2('0x3'));var rs=require(_0x81a2('0x4'));var fs=require('fs');var Redis=require(_0x81a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x81a2('0x6'))(_0x81a2('0x7'));var config=require(_0x81a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x81a2('0x9')][_0x81a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597932,_0x1aa420,_0x2aa66f){return new BPromise(function(_0x453392,_0x4672ce){return client[_0x81a2('0xb')](_0x597932,_0x2aa66f)[_0x81a2('0xc')](function(_0x3f36f5){logger[_0x81a2('0xd')](_0x81a2('0xe'),_0x1aa420,'request\x20sent');logger[_0x81a2('0xf')](_0x81a2('0x10'),_0x1aa420,_0x81a2('0x11'),JSON[_0x81a2('0x12')](_0x3f36f5));if(_0x3f36f5[_0x81a2('0x13')]){if(_0x3f36f5['error'][_0x81a2('0x14')]===0x1f4){logger[_0x81a2('0x13')](_0x81a2('0xe'),_0x1aa420,_0x3f36f5[_0x81a2('0x13')][_0x81a2('0x15')]);return _0x4672ce(_0x3f36f5[_0x81a2('0x13')][_0x81a2('0x15')]);}logger[_0x81a2('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1aa420,_0x3f36f5[_0x81a2('0x13')]['message']);return _0x453392(_0x3f36f5[_0x81a2('0x13')][_0x81a2('0x15')]);}else{logger['info'](_0x81a2('0xe'),_0x1aa420,'request\x20sent');_0x453392(_0x3f36f5[_0x81a2('0x16')][_0x81a2('0x15')]);}})[_0x81a2('0x17')](function(_0x7da352){logger[_0x81a2('0x13')](_0x81a2('0xe'),_0x1aa420,_0x7da352);_0x4672ce(_0x7da352);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d25ad61..dd24c6d 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 _0x4197=['multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy'];(function(_0x227397,_0x3bf5a1){var _0x44611f=function(_0x2bb7a0){while(--_0x2bb7a0){_0x227397['push'](_0x227397['shift']());}};_0x44611f(++_0x3bf5a1);}(_0x4197,0x80));var _0x7419=function(_0x5dbb63,_0x2282db){_0x5dbb63=_0x5dbb63-0x0;var _0x2d31de=_0x4197[_0x5dbb63];return _0x2d31de;};'use strict';var multer=require(_0x7419('0x0'));var util=require(_0x7419('0x1'));var path=require('path');var timeout=require(_0x7419('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7419('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7419('0x4'));var config=require(_0x7419('0x5'));var controller=require(_0x7419('0x6'));router[_0x7419('0x7')]('/',auth['isAuthenticated'](),controller[_0x7419('0x8')]);router[_0x7419('0x7')](_0x7419('0x9'),auth[_0x7419('0xa')](),controller[_0x7419('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7419('0xc')]);router[_0x7419('0xd')](_0x7419('0x9'),auth[_0x7419('0xa')](),controller[_0x7419('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7419('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe40d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3f1fdc,_0x39133b){var _0x20850e=function(_0x57cb70){while(--_0x57cb70){_0x3f1fdc['push'](_0x3f1fdc['shift']());}};_0x20850e(++_0x39133b);}(_0xe40d,0x133));var _0xde40=function(_0x5627c4,_0x3edefb){_0x5627c4=_0x5627c4-0x0;var _0x57923e=_0xe40d[_0x5627c4];return _0x57923e;};'use strict';var multer=require(_0xde40('0x0'));var util=require(_0xde40('0x1'));var path=require(_0xde40('0x2'));var timeout=require(_0xde40('0x3'));var express=require(_0xde40('0x4'));var router=express[_0xde40('0x5')]();var fs_extra=require(_0xde40('0x6'));var auth=require(_0xde40('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xde40('0x8'));var controller=require(_0xde40('0x9'));router[_0xde40('0xa')]('/',auth['isAuthenticated'](),controller[_0xde40('0xb')]);router[_0xde40('0xa')](_0xde40('0xc'),auth[_0xde40('0xd')](),controller[_0xde40('0xe')]);router[_0xde40('0xf')]('/',auth['isAuthenticated'](),controller[_0xde40('0x10')]);router[_0xde40('0x11')](_0xde40('0xc'),auth[_0xde40('0xd')](),controller[_0xde40('0x12')]);router[_0xde40('0x13')](_0xde40('0xc'),auth['isAuthenticated'](),controller[_0xde40('0x14')]);module[_0xde40('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 f083cd9..dbc2e5b 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 _0x1844=['STRING','sequelize','exports'];(function(_0x2dc37d,_0x3393c0){var _0x5687bc=function(_0x267a8f){while(--_0x267a8f){_0x2dc37d['push'](_0x2dc37d['shift']());}};_0x5687bc(++_0x3393c0);}(_0x1844,0xd0));var _0x4184=function(_0x3be3b1,_0x4c209d){_0x3be3b1=_0x3be3b1-0x0;var _0x23f366=_0x1844[_0x3be3b1];return _0x23f366;};'use strict';var Sequelize=require(_0x4184('0x0'));module[_0x4184('0x1')]={'name':{'type':Sequelize[_0x4184('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4184('0x2')]}}; \ No newline at end of file +var _0x041a=['name','exports'];(function(_0x193585,_0x1bff48){var _0x12309d=function(_0x1681fd){while(--_0x1681fd){_0x193585['push'](_0x193585['shift']());}};_0x12309d(++_0x1bff48);}(_0x041a,0x111));var _0xa041=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0x041a[_0x12309b];return _0x482e4d;};'use strict';var Sequelize=require('sequelize');module[_0xa041('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa041('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0cbb8e3..c6f1ee5 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 _0xb776=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xb776,0x14e));var _0x6b77=function(_0x230838,_0xff8595){_0x230838=_0x230838-0x0;var _0x4f2950=_0xb776[_0x230838];return _0x4f2950;};'use strict';var emlformat=require(_0x6b77('0x0'));var rimraf=require(_0x6b77('0x1'));var zipdir=require(_0x6b77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b77('0x3'));var moment=require('moment');var BPromise=require(_0x6b77('0x4'));var Mustache=require(_0x6b77('0x5'));var util=require(_0x6b77('0x6'));var path=require(_0x6b77('0x7'));var sox=require(_0x6b77('0x8'));var csv=require(_0x6b77('0x9'));var ejs=require(_0x6b77('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b77('0xb'));var squel=require(_0x6b77('0xc'));var crypto=require(_0x6b77('0xd'));var jsforce=require(_0x6b77('0xe'));var deskjs=require(_0x6b77('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6b77('0x10'));var Papa=require(_0x6b77('0x11'));var Redis=require(_0x6b77('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6b77('0x13'));var as=require(_0x6b77('0x14'));var hardwareService=require(_0x6b77('0x15'));var logger=require('../../config/logger')(_0x6b77('0x16'));var utils=require(_0x6b77('0x17'));var config=require(_0x6b77('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b77('0x19'))['db'];function respondWithStatusCode(_0x1b564e,_0x21623d){_0x21623d=_0x21623d||0xcc;return function(_0x31db20){if(_0x31db20){return _0x1b564e[_0x6b77('0x1a')](_0x21623d);}return _0x1b564e['status'](_0x21623d)['end']();};}function respondWithResult(_0x85227,_0x48893c){_0x48893c=_0x48893c||0xc8;return function(_0x3d72f6){if(_0x3d72f6){return _0x85227[_0x6b77('0x1b')](_0x48893c)[_0x6b77('0x1c')](_0x3d72f6);}};}function respondWithFilteredResult(_0xa7811f,_0x3e9b33){return function(_0x8eb569){if(_0x8eb569){var _0x42b3a3=typeof _0x3e9b33[_0x6b77('0x1d')]===_0x6b77('0x1e')&&typeof _0x3e9b33['limit']===_0x6b77('0x1e');var _0x4b6736=_0x8eb569[_0x6b77('0x1f')];var _0xb5448f=_0x42b3a3?0x0:_0x3e9b33[_0x6b77('0x1d')];var _0x9104c=_0x42b3a3?_0x8eb569[_0x6b77('0x1f')]:_0x3e9b33['offset']+_0x3e9b33[_0x6b77('0x20')];var _0xb5ab42;if(_0x9104c>=_0x4b6736){_0x9104c=_0x4b6736;_0xb5ab42=0xc8;}else{_0xb5ab42=0xce;}_0xa7811f[_0x6b77('0x1b')](_0xb5ab42);return _0xa7811f[_0x6b77('0x21')](_0x6b77('0x22'),_0xb5448f+'-'+_0x9104c+'/'+_0x4b6736)[_0x6b77('0x1c')](_0x8eb569);}return null;};}function patchUpdates(_0x56bd49){return function(_0x1ea858){try{jsonpatch[_0x6b77('0x23')](_0x1ea858,_0x56bd49,!![]);}catch(_0x1f9057){return BPromise['reject'](_0x1f9057);}return _0x1ea858[_0x6b77('0x24')]();};}function saveUpdates(_0x53fd6c,_0x39cf0e){return function(_0x3849f1){if(_0x3849f1){return _0x3849f1['update'](_0x53fd6c)[_0x6b77('0x25')](function(_0x2f39e3){return _0x2f39e3;});}return null;};}function removeEntity(_0x31045d,_0x162b3f){return function(_0x37e4ea){if(_0x37e4ea){return _0x37e4ea[_0x6b77('0x26')]()['then'](function(){var _0x1505ff=_0x37e4ea['get']({'plain':!![]});var _0x338626=_0x6b77('0x27');return db[_0x6b77('0x28')]['destroy']({'where':{'type':_0x338626,'resourceId':_0x1505ff['id']}})['then'](function(){return _0x37e4ea;});})[_0x6b77('0x25')](function(){_0x31045d[_0x6b77('0x1b')](0xcc)[_0x6b77('0x29')]();});}};}function handleEntityNotFound(_0x7241cc,_0x357ac7){return function(_0x188de4){if(!_0x188de4){_0x7241cc[_0x6b77('0x1a')](0x194);}return _0x188de4;};}function handleError(_0x91d625,_0x4f1a89){_0x4f1a89=_0x4f1a89||0x1f4;return function(_0x5d86d8){logger[_0x6b77('0x2a')](_0x5d86d8[_0x6b77('0x2b')]);if(_0x5d86d8[_0x6b77('0x2c')]){delete _0x5d86d8['name'];}_0x91d625[_0x6b77('0x1b')](_0x4f1a89)[_0x6b77('0x2d')](_0x5d86d8);};}exports[_0x6b77('0x2e')]=function(_0x256a5b,_0x1725e8){var _0x16230b={},_0x11421d={},_0xd42fe2={'count':0x0,'rows':[]};var _0x5db202=_[_0x6b77('0x2f')](db[_0x6b77('0x30')][_0x6b77('0x31')],function(_0x4e955f){return{'name':_0x4e955f[_0x6b77('0x32')],'type':_0x4e955f[_0x6b77('0x33')]['key']};});_0x11421d[_0x6b77('0x34')]=_[_0x6b77('0x2f')](_0x5db202,_0x6b77('0x2c'));_0x11421d[_0x6b77('0x35')]=_[_0x6b77('0x36')](_0x256a5b[_0x6b77('0x35')]);_0x11421d[_0x6b77('0x37')]=_[_0x6b77('0x38')](_0x11421d[_0x6b77('0x34')],_0x11421d['query']);_0x16230b['attributes']=_[_0x6b77('0x38')](_0x11421d[_0x6b77('0x34')],qs[_0x6b77('0x39')](_0x256a5b['query'][_0x6b77('0x39')]));_0x16230b[_0x6b77('0x3a')]=_0x16230b['attributes'][_0x6b77('0x3b')]?_0x16230b['attributes']:_0x11421d[_0x6b77('0x34')];if(!_0x256a5b[_0x6b77('0x35')][_0x6b77('0x3c')](_0x6b77('0x3d'))){_0x16230b[_0x6b77('0x20')]=qs[_0x6b77('0x20')](_0x256a5b['query'][_0x6b77('0x20')]);_0x16230b[_0x6b77('0x1d')]=qs[_0x6b77('0x1d')](_0x256a5b[_0x6b77('0x35')]['offset']);}_0x16230b[_0x6b77('0x3e')]=qs[_0x6b77('0x3f')](_0x256a5b['query'][_0x6b77('0x3f')]);_0x16230b[_0x6b77('0x40')]=qs[_0x6b77('0x37')](_[_0x6b77('0x41')](_0x256a5b['query'],_0x11421d['filters']),_0x5db202);if(_0x256a5b[_0x6b77('0x35')]['filter']){_0x16230b['where']=_[_0x6b77('0x42')](_0x16230b[_0x6b77('0x40')],{'$or':_['map'](_0x5db202,function(_0x1a28c3){if(_0x1a28c3[_0x6b77('0x33')]!==_0x6b77('0x43')){var _0x2a0509={};_0x2a0509[_0x1a28c3[_0x6b77('0x2c')]]={'$like':'%'+_0x256a5b[_0x6b77('0x35')][_0x6b77('0x44')]+'%'};return _0x2a0509;}})});}_0x16230b=_['merge']({},_0x16230b,_0x256a5b[_0x6b77('0x45')]);var _0x4c3c3e={'where':_0x16230b[_0x6b77('0x40')]};return db['Pause'][_0x6b77('0x1f')](_0x4c3c3e)['then'](function(_0x292932){_0xd42fe2[_0x6b77('0x1f')]=_0x292932;if(_0x256a5b[_0x6b77('0x35')]['includeAll']){_0x16230b[_0x6b77('0x46')]=[{'all':!![]}];}return db['Pause'][_0x6b77('0x47')](_0x16230b);})['then'](function(_0x350112){_0xd42fe2[_0x6b77('0x48')]=_0x350112;return _0xd42fe2;})[_0x6b77('0x25')](respondWithFilteredResult(_0x1725e8,_0x16230b))[_0x6b77('0x49')](handleError(_0x1725e8,null));};exports[_0x6b77('0x4a')]=function(_0x3ebbbf,_0x506aeb){var _0xb80b25={'raw':!![],'where':{'id':_0x3ebbbf[_0x6b77('0x4b')]['id']}},_0x361777={};_0x361777['model']=_[_0x6b77('0x36')](db['Pause'][_0x6b77('0x31')]);_0x361777[_0x6b77('0x35')]=_[_0x6b77('0x36')](_0x3ebbbf['query']);_0x361777[_0x6b77('0x37')]=_[_0x6b77('0x38')](_0x361777['model'],_0x361777[_0x6b77('0x35')]);_0xb80b25['attributes']=_[_0x6b77('0x38')](_0x361777[_0x6b77('0x34')],qs[_0x6b77('0x39')](_0x3ebbbf[_0x6b77('0x35')][_0x6b77('0x39')]));_0xb80b25[_0x6b77('0x3a')]=_0xb80b25['attributes'][_0x6b77('0x3b')]?_0xb80b25[_0x6b77('0x3a')]:_0x361777['model'];if(_0x3ebbbf['query']['includeAll']){_0xb80b25[_0x6b77('0x46')]=[{'all':!![]}];}_0xb80b25=_[_0x6b77('0x42')]({},_0xb80b25,_0x3ebbbf['options']);return db['Pause'][_0x6b77('0x4c')](_0xb80b25)['then'](handleEntityNotFound(_0x506aeb,null))['then'](respondWithResult(_0x506aeb,null))[_0x6b77('0x49')](handleError(_0x506aeb,null));};exports[_0x6b77('0x4d')]=function(_0x14b60a,_0x57d154){return db[_0x6b77('0x30')][_0x6b77('0x4d')](_0x14b60a[_0x6b77('0x4e')],{})[_0x6b77('0x25')](function(_0x5f2ee8){var _0x16a6c2=_0x14b60a[_0x6b77('0x4f')]['get']({'plain':!![]});if(!_0x16a6c2)throw new Error(_0x6b77('0x50'));if(_0x16a6c2[_0x6b77('0x51')]==='user'){var _0x5ead55=_0x5f2ee8[_0x6b77('0x52')]({'plain':!![]});var _0x53585b=_0x6b77('0x27');return db[_0x6b77('0x53')][_0x6b77('0x4c')]({'where':{'name':_0x53585b,'userProfileId':_0x16a6c2[_0x6b77('0x54')]},'raw':!![]})['then'](function(_0x532fff){if(_0x532fff&&_0x532fff[_0x6b77('0x55')]===0x0){return db['UserProfileResource'][_0x6b77('0x4d')]({'name':_0x5ead55['name'],'resourceId':_0x5ead55['id'],'type':_0x532fff['name'],'sectionId':_0x532fff['id']},{})[_0x6b77('0x25')](function(){return _0x5f2ee8;});}else{return _0x5f2ee8;}})[_0x6b77('0x49')](function(_0x40757d){logger['error'](_0x6b77('0x56'),_0x40757d);throw _0x40757d;});}return _0x5f2ee8;})[_0x6b77('0x25')](respondWithResult(_0x57d154,0xc9))[_0x6b77('0x49')](handleError(_0x57d154,null));};exports['update']=function(_0x42bc18,_0x488c2c){if(_0x42bc18['body']['id']){delete _0x42bc18[_0x6b77('0x4e')]['id'];}return db[_0x6b77('0x30')]['find']({'where':{'id':_0x42bc18[_0x6b77('0x4b')]['id']}})[_0x6b77('0x25')](handleEntityNotFound(_0x488c2c,null))[_0x6b77('0x25')](saveUpdates(_0x42bc18[_0x6b77('0x4e')],null))['then'](respondWithResult(_0x488c2c,null))[_0x6b77('0x49')](handleError(_0x488c2c,null));};exports['destroy']=function(_0xc18be3,_0x540c81){return db[_0x6b77('0x30')]['find']({'where':{'id':_0xc18be3[_0x6b77('0x4b')]['id']}})[_0x6b77('0x25')](handleEntityNotFound(_0x540c81,null))[_0x6b77('0x25')](removeEntity(_0x540c81,null))['catch'](handleError(_0x540c81,null));}; \ No newline at end of file +var _0x1d8b=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','get','Pauses','UserProfileResource','sendStatus','error','name','send','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','includeAll','include','Pause','findAll','rows','catch','show','options'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1d8b,0xa5));var _0xb1d8=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1d8b[_0x1b7368];return _0x25d54c;};'use strict';var emlformat=require(_0xb1d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1d8('0x1'));var jsonpatch=require(_0xb1d8('0x2'));var rp=require(_0xb1d8('0x3'));var moment=require(_0xb1d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1d8('0x5'));var util=require(_0xb1d8('0x6'));var path=require(_0xb1d8('0x7'));var sox=require(_0xb1d8('0x8'));var csv=require(_0xb1d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1d8('0xa'));var _=require('lodash');var squel=require(_0xb1d8('0xb'));var crypto=require(_0xb1d8('0xc'));var jsforce=require(_0xb1d8('0xd'));var deskjs=require(_0xb1d8('0xe'));var toCsv=require(_0xb1d8('0x9'));var querystring=require(_0xb1d8('0xf'));var Papa=require(_0xb1d8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1d8('0x11'));var as=require(_0xb1d8('0x12'));var hardwareService=require(_0xb1d8('0x13'));var logger=require('../../config/logger')(_0xb1d8('0x14'));var utils=require(_0xb1d8('0x15'));var config=require(_0xb1d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1d8('0x17'))['db'];function respondWithStatusCode(_0x5b09d8,_0x33304b){_0x33304b=_0x33304b||0xcc;return function(_0x121376){if(_0x121376){return _0x5b09d8['sendStatus'](_0x33304b);}return _0x5b09d8[_0xb1d8('0x18')](_0x33304b)[_0xb1d8('0x19')]();};}function respondWithResult(_0x50630f,_0x4df25e){_0x4df25e=_0x4df25e||0xc8;return function(_0x3ec4b9){if(_0x3ec4b9){return _0x50630f['status'](_0x4df25e)['json'](_0x3ec4b9);}};}function respondWithFilteredResult(_0x393101,_0x431c09){return function(_0x4b3b57){if(_0x4b3b57){var _0x5015d7=typeof _0x431c09[_0xb1d8('0x1a')]==='undefined'&&typeof _0x431c09[_0xb1d8('0x1b')]==='undefined';var _0x1d502b=_0x4b3b57[_0xb1d8('0x1c')];var _0x12324f=_0x5015d7?0x0:_0x431c09['offset'];var _0xc82df0=_0x5015d7?_0x4b3b57[_0xb1d8('0x1c')]:_0x431c09[_0xb1d8('0x1a')]+_0x431c09[_0xb1d8('0x1b')];var _0x369859;if(_0xc82df0>=_0x1d502b){_0xc82df0=_0x1d502b;_0x369859=0xc8;}else{_0x369859=0xce;}_0x393101['status'](_0x369859);return _0x393101[_0xb1d8('0x1d')](_0xb1d8('0x1e'),_0x12324f+'-'+_0xc82df0+'/'+_0x1d502b)[_0xb1d8('0x1f')](_0x4b3b57);}return null;};}function patchUpdates(_0x11847e){return function(_0x55fdc3){try{jsonpatch[_0xb1d8('0x20')](_0x55fdc3,_0x11847e,!![]);}catch(_0x48bd6a){return BPromise['reject'](_0x48bd6a);}return _0x55fdc3[_0xb1d8('0x21')]();};}function saveUpdates(_0x4f9846,_0x3a3e3f){return function(_0x1113eb){if(_0x1113eb){return _0x1113eb[_0xb1d8('0x22')](_0x4f9846)[_0xb1d8('0x23')](function(_0x156c04){return _0x156c04;});}return null;};}function removeEntity(_0x370337,_0x40a1ec){return function(_0x38ed98){if(_0x38ed98){return _0x38ed98['destroy']()[_0xb1d8('0x23')](function(){var _0xdadf2d=_0x38ed98[_0xb1d8('0x24')]({'plain':!![]});var _0xcb5aca=_0xb1d8('0x25');return db[_0xb1d8('0x26')]['destroy']({'where':{'type':_0xcb5aca,'resourceId':_0xdadf2d['id']}})[_0xb1d8('0x23')](function(){return _0x38ed98;});})[_0xb1d8('0x23')](function(){_0x370337[_0xb1d8('0x18')](0xcc)[_0xb1d8('0x19')]();});}};}function handleEntityNotFound(_0x26b85b,_0x15f2f7){return function(_0x377650){if(!_0x377650){_0x26b85b[_0xb1d8('0x27')](0x194);}return _0x377650;};}function handleError(_0x11c792,_0x439f08){_0x439f08=_0x439f08||0x1f4;return function(_0x3203b3){logger[_0xb1d8('0x28')](_0x3203b3['stack']);if(_0x3203b3[_0xb1d8('0x29')]){delete _0x3203b3[_0xb1d8('0x29')];}_0x11c792['status'](_0x439f08)[_0xb1d8('0x2a')](_0x3203b3);};}exports['index']=function(_0x58f8c0,_0x34924a){var _0xd9e69a={},_0x2933bf={},_0x2d1232={'count':0x0,'rows':[]};var _0xf7b905=_[_0xb1d8('0x2b')](db['Pause']['rawAttributes'],function(_0x56061a){return{'name':_0x56061a['fieldName'],'type':_0x56061a[_0xb1d8('0x2c')][_0xb1d8('0x2d')]};});_0x2933bf[_0xb1d8('0x2e')]=_[_0xb1d8('0x2b')](_0xf7b905,'name');_0x2933bf[_0xb1d8('0x2f')]=_[_0xb1d8('0x30')](_0x58f8c0[_0xb1d8('0x2f')]);_0x2933bf['filters']=_[_0xb1d8('0x31')](_0x2933bf['model'],_0x2933bf[_0xb1d8('0x2f')]);_0xd9e69a[_0xb1d8('0x32')]=_['intersection'](_0x2933bf[_0xb1d8('0x2e')],qs[_0xb1d8('0x33')](_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x33')]));_0xd9e69a[_0xb1d8('0x32')]=_0xd9e69a[_0xb1d8('0x32')][_0xb1d8('0x34')]?_0xd9e69a[_0xb1d8('0x32')]:_0x2933bf[_0xb1d8('0x2e')];if(!_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x35')](_0xb1d8('0x36'))){_0xd9e69a['limit']=qs[_0xb1d8('0x1b')](_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x1b')]);_0xd9e69a[_0xb1d8('0x1a')]=qs[_0xb1d8('0x1a')](_0x58f8c0['query'][_0xb1d8('0x1a')]);}_0xd9e69a['order']=qs['sort'](_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x37')]);_0xd9e69a['where']=qs[_0xb1d8('0x38')](_[_0xb1d8('0x39')](_0x58f8c0[_0xb1d8('0x2f')],_0x2933bf[_0xb1d8('0x38')]),_0xf7b905);if(_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x3a')]){_0xd9e69a[_0xb1d8('0x3b')]=_[_0xb1d8('0x3c')](_0xd9e69a[_0xb1d8('0x3b')],{'$or':_[_0xb1d8('0x2b')](_0xf7b905,function(_0x3cfda6){if(_0x3cfda6[_0xb1d8('0x2c')]!=='VIRTUAL'){var _0x44088b={};_0x44088b[_0x3cfda6[_0xb1d8('0x29')]]={'$like':'%'+_0x58f8c0['query']['filter']+'%'};return _0x44088b;}})});}_0xd9e69a=_['merge']({},_0xd9e69a,_0x58f8c0['options']);var _0x2bf79d={'where':_0xd9e69a[_0xb1d8('0x3b')]};return db['Pause']['count'](_0x2bf79d)['then'](function(_0x3f68f3){_0x2d1232[_0xb1d8('0x1c')]=_0x3f68f3;if(_0x58f8c0[_0xb1d8('0x2f')][_0xb1d8('0x3d')]){_0xd9e69a[_0xb1d8('0x3e')]=[{'all':!![]}];}return db[_0xb1d8('0x3f')][_0xb1d8('0x40')](_0xd9e69a);})['then'](function(_0x4b059c){_0x2d1232[_0xb1d8('0x41')]=_0x4b059c;return _0x2d1232;})[_0xb1d8('0x23')](respondWithFilteredResult(_0x34924a,_0xd9e69a))[_0xb1d8('0x42')](handleError(_0x34924a,null));};exports[_0xb1d8('0x43')]=function(_0x1748f5,_0x47ac99){var _0x5703df={'raw':!![],'where':{'id':_0x1748f5['params']['id']}},_0x593311={};_0x593311['model']=_[_0xb1d8('0x30')](db['Pause']['rawAttributes']);_0x593311[_0xb1d8('0x2f')]=_[_0xb1d8('0x30')](_0x1748f5[_0xb1d8('0x2f')]);_0x593311[_0xb1d8('0x38')]=_[_0xb1d8('0x31')](_0x593311[_0xb1d8('0x2e')],_0x593311[_0xb1d8('0x2f')]);_0x5703df[_0xb1d8('0x32')]=_[_0xb1d8('0x31')](_0x593311[_0xb1d8('0x2e')],qs['fields'](_0x1748f5[_0xb1d8('0x2f')][_0xb1d8('0x33')]));_0x5703df[_0xb1d8('0x32')]=_0x5703df['attributes']['length']?_0x5703df[_0xb1d8('0x32')]:_0x593311[_0xb1d8('0x2e')];if(_0x1748f5[_0xb1d8('0x2f')][_0xb1d8('0x3d')]){_0x5703df[_0xb1d8('0x3e')]=[{'all':!![]}];}_0x5703df=_[_0xb1d8('0x3c')]({},_0x5703df,_0x1748f5[_0xb1d8('0x44')]);return db['Pause'][_0xb1d8('0x45')](_0x5703df)[_0xb1d8('0x23')](handleEntityNotFound(_0x47ac99,null))[_0xb1d8('0x23')](respondWithResult(_0x47ac99,null))[_0xb1d8('0x42')](handleError(_0x47ac99,null));};exports[_0xb1d8('0x46')]=function(_0x24a6c1,_0x789395){return db['Pause'][_0xb1d8('0x46')](_0x24a6c1[_0xb1d8('0x47')],{})[_0xb1d8('0x23')](function(_0x5c2290){var _0xe7a89e=_0x24a6c1[_0xb1d8('0x48')][_0xb1d8('0x24')]({'plain':!![]});if(!_0xe7a89e)throw new Error(_0xb1d8('0x49'));if(_0xe7a89e[_0xb1d8('0x4a')]==='user'){var _0x30d5d3=_0x5c2290[_0xb1d8('0x24')]({'plain':!![]});var _0x1a1ef3='Pauses';return db['UserProfileSection'][_0xb1d8('0x45')]({'where':{'name':_0x1a1ef3,'userProfileId':_0xe7a89e['userProfileId']},'raw':!![]})['then'](function(_0x517275){if(_0x517275&&_0x517275[_0xb1d8('0x4b')]===0x0){return db['UserProfileResource'][_0xb1d8('0x46')]({'name':_0x30d5d3[_0xb1d8('0x29')],'resourceId':_0x30d5d3['id'],'type':_0x517275[_0xb1d8('0x29')],'sectionId':_0x517275['id']},{})[_0xb1d8('0x23')](function(){return _0x5c2290;});}else{return _0x5c2290;}})['catch'](function(_0x2a6c1c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a6c1c);throw _0x2a6c1c;});}return _0x5c2290;})[_0xb1d8('0x23')](respondWithResult(_0x789395,0xc9))[_0xb1d8('0x42')](handleError(_0x789395,null));};exports[_0xb1d8('0x22')]=function(_0x5ab1d5,_0x219078){if(_0x5ab1d5[_0xb1d8('0x47')]['id']){delete _0x5ab1d5[_0xb1d8('0x47')]['id'];}return db[_0xb1d8('0x3f')][_0xb1d8('0x45')]({'where':{'id':_0x5ab1d5[_0xb1d8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x219078,null))[_0xb1d8('0x23')](saveUpdates(_0x5ab1d5[_0xb1d8('0x47')],null))[_0xb1d8('0x23')](respondWithResult(_0x219078,null))[_0xb1d8('0x42')](handleError(_0x219078,null));};exports[_0xb1d8('0x4d')]=function(_0x1f9c3d,_0x201038){return db[_0xb1d8('0x3f')][_0xb1d8('0x45')]({'where':{'id':_0x1f9c3d[_0xb1d8('0x4c')]['id']}})[_0xb1d8('0x23')](handleEntityNotFound(_0x201038,null))[_0xb1d8('0x23')](removeEntity(_0x201038,null))[_0xb1d8('0x42')](handleError(_0x201038,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 67c47ad..d97934c 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x21c839,_0x4e6093){var _0x28b51b=function(_0x2a76f4){while(--_0x2a76f4){_0x21c839['push'](_0x21c839['shift']());}};_0x28b51b(++_0x4e6093);}(_0xf494,0x1c6));var _0x4f49=function(_0x1552f8,_0x1aac52){_0x1552f8=_0x1552f8-0x0;var _0x19146b=_0xf494[_0x1552f8];return _0x19146b;};'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 +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x72d61b,_0x265116){var _0x4d7593=function(_0x244500){while(--_0x244500){_0x72d61b['push'](_0x72d61b['shift']());}};_0x4d7593(++_0x265116);}(_0x53ec,0x192));var _0xc53e=function(_0x1daaa4,_0x2a13f8){_0x1daaa4=_0x1daaa4-0x0;var _0x4d6a11=_0x53ec[_0x1daaa4];return _0x4d6a11;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),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 33832a9..faa074b 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xb846a0,_0x433f86){var _0x2ef244=function(_0x204c93){while(--_0x204c93){_0xb846a0['push'](_0xb846a0['shift']());}};_0x2ef244(++_0x433f86);}(_0x7a54,0x106));var _0x47a5=function(_0x24db2c,_0x3033b4){_0x24db2c=_0x24db2c-0x0;var _0x502826=_0x7a54[_0x24db2c];return _0x502826;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4aa6be,_0x2d5b51){var _0x2ce341=function(_0x38c52e){while(--_0x38c52e){_0x4aa6be['push'](_0x4aa6be['shift']());}};_0x2ce341(++_0x2d5b51);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ba88a,_0x30b1d8){_0x1ba88a=_0x1ba88a-0x0;var _0x5d0fe7=_0xb10b[_0x1ba88a];return _0x5d0fe7;};'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 5c874f7..327502c 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 _0xc6d8=['format','%s-%s%s','basename','extname','now','single','file','post','put','update','delete','exports','multer','path','express','fs-extra','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','diskStorage','root','originalname','replace'];(function(_0x518ca9,_0x3cfd59){var _0x591c0e=function(_0x113d1e){while(--_0x113d1e){_0x518ca9['push'](_0x518ca9['shift']());}};_0x591c0e(++_0x3cfd59);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2a05bf,_0x55e3a4){_0x2a05bf=_0x2a05bf-0x0;var _0x38a62e=_0xc6d8[_0x2a05bf];return _0x38a62e;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),controller['webhookGet']);router[_0x8c6d('0x6')](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller['show']);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xc')]);var upload=multer({'storage':multer[_0x8c6d('0xd')]({'destination':function(_0x43a7ab,_0x60cd5c,_0x392a6b){_0x392a6b(null,path['join'](config[_0x8c6d('0xe')],'server/files/plugins'));},'filename':function(_0x4c0878,_0x22d0fb,_0x890e85){_0x22d0fb[_0x8c6d('0xf')]=_0x22d0fb[_0x8c6d('0xf')][_0x8c6d('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x890e85(null,util[_0x8c6d('0x11')](_0x8c6d('0x12'),path[_0x8c6d('0x13')](_0x22d0fb[_0x8c6d('0xf')],path[_0x8c6d('0x14')](_0x22d0fb['originalname'])),Date[_0x8c6d('0x15')](),path['extname'](_0x22d0fb[_0x8c6d('0xf')])));}})});router['post']('/',upload[_0x8c6d('0x16')](_0x8c6d('0x17')),controller['upload']);router[_0x8c6d('0x18')](_0x8c6d('0x9'),controller['webhookPost']);router[_0x8c6d('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x8c6d('0x1a')]);router['delete'](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x1b')]);module[_0x8c6d('0x1c')]=router; \ No newline at end of file +var _0x4b19=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','webhookGet','/:id','show','isAuthenticated','download','diskStorage','root','server/files/plugins','originalname','replace','basename','post','single','file','/webhook','webhookPost','put','update','delete','multer'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x4b19,0x195));var _0x94b1=function(_0x5e2654,_0x458a2b){_0x5e2654=_0x5e2654-0x0;var _0x4780aa=_0x4b19[_0x5e2654];return _0x4780aa;};'use strict';var multer=require(_0x94b1('0x0'));var util=require('util');var path=require(_0x94b1('0x1'));var timeout=require(_0x94b1('0x2'));var express=require(_0x94b1('0x3'));var router=express['Router']();var fs_extra=require(_0x94b1('0x4'));var auth=require(_0x94b1('0x5'));var interaction=require(_0x94b1('0x6'));var config=require('../../config/environment');var controller=require(_0x94b1('0x7'));router[_0x94b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x94b1('0x9')]);router[_0x94b1('0x8')]('/webhook',controller[_0x94b1('0xa')]);router[_0x94b1('0x8')](_0x94b1('0xb'),auth['isAuthenticated'](),controller[_0x94b1('0xc')]);router['get']('/:id/download',auth[_0x94b1('0xd')](),controller[_0x94b1('0xe')]);var upload=multer({'storage':multer[_0x94b1('0xf')]({'destination':function(_0x8ddf47,_0x162995,_0x3aeb91){_0x3aeb91(null,path['join'](config[_0x94b1('0x10')],_0x94b1('0x11')));},'filename':function(_0x340a29,_0x2b378c,_0x5cbf96){_0x2b378c['originalname']=_0x2b378c[_0x94b1('0x12')][_0x94b1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5cbf96(null,util['format']('%s-%s%s',path[_0x94b1('0x14')](_0x2b378c[_0x94b1('0x12')],path['extname'](_0x2b378c[_0x94b1('0x12')])),Date['now'](),path['extname'](_0x2b378c[_0x94b1('0x12')])));}})});router[_0x94b1('0x15')]('/',upload[_0x94b1('0x16')](_0x94b1('0x17')),controller['upload']);router[_0x94b1('0x15')](_0x94b1('0x18'),controller[_0x94b1('0x19')]);router[_0x94b1('0x1a')](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1b')]);router['delete'](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9fa0d2a..543a293 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 _0x56a8=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x109183,_0x8cf58f){var _0xab2c0a=function(_0x518f6d){while(--_0x518f6d){_0x109183['push'](_0x109183['shift']());}};_0xab2c0a(++_0x8cf58f);}(_0x56a8,0x161));var _0x856a=function(_0x3a80a2,_0x3e6caa){_0x3a80a2=_0x3a80a2-0x0;var _0x3be3fb=_0x56a8[_0x3a80a2];return _0x3be3fb;};'use strict';var Sequelize=require(_0x856a('0x0'));module[_0x856a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x856a('0x2')]('html','script')},'description':{'type':Sequelize[_0x856a('0x3')]},'version':{'type':Sequelize[_0x856a('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x856a('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x856a('0x5')},'sidebar':{'type':Sequelize[_0x856a('0x2')](_0x856a('0x6'),_0x856a('0x7'),_0x856a('0x8'),_0x856a('0x9')),'defaultValue':_0x856a('0x8'),'comment':_0x856a('0xa')},'icon':{'type':Sequelize[_0x856a('0xb')]},'adminUrl':{'type':Sequelize[_0x856a('0xb')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x856a('0xb')]}}; \ No newline at end of file +var _0x4674=['TEXT','STRING','BOOLEAN','adminOnly','agentOnly','never','always','sequelize','ENUM','html','script'];(function(_0x2d7b77,_0x2476df){var _0x3e96ae=function(_0x44b916){while(--_0x44b916){_0x2d7b77['push'](_0x2d7b77['shift']());}};_0x3e96ae(++_0x2476df);}(_0x4674,0xcd));var _0x4467=function(_0x9e7ab5,_0x70b863){_0x9e7ab5=_0x9e7ab5-0x0;var _0x1d7ecb=_0x4674[_0x9e7ab5];return _0x1d7ecb;};'use strict';var Sequelize=require(_0x4467('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4467('0x1')](_0x4467('0x2'),_0x4467('0x3'))},'description':{'type':Sequelize[_0x4467('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x4467('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x4467('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4467('0x1')](_0x4467('0x7'),_0x4467('0x8'),'always',_0x4467('0x9')),'defaultValue':_0x4467('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4467('0x5')]},'adminUrl':{'type':Sequelize[_0x4467('0x5')]},'agentUrl':{'type':Sequelize[_0x4467('0x5')]},'scriptName':{'type':Sequelize[_0x4467('0x5')]},'scriptPath':{'type':Sequelize[_0x4467('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0d1b99c..81e675d 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 _0x5fd1=['apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','Plugin','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','dirname','attachments/**/*','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','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','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0x16f9c5,_0x1b3b45){var _0x11cd9e=function(_0x231cc4){while(--_0x231cc4){_0x16f9c5['push'](_0x16f9c5['shift']());}};_0x11cd9e(++_0x1b3b45);}(_0x5fd1,0x7f));var _0x15fd=function(_0x4992c5,_0x5682b5){_0x4992c5=_0x4992c5-0x0;var _0x1a5bb5=_0x5fd1[_0x4992c5];return _0x1a5bb5;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require(_0x15fd('0x1'));var zipdir=require(_0x15fd('0x2'));var jsonpatch=require(_0x15fd('0x3'));var rp=require('request-promise');var moment=require(_0x15fd('0x4'));var BPromise=require(_0x15fd('0x5'));var Mustache=require('mustache');var util=require(_0x15fd('0x6'));var path=require(_0x15fd('0x7'));var sox=require(_0x15fd('0x8'));var csv=require(_0x15fd('0x9'));var ejs=require(_0x15fd('0xa'));var fs=require('fs');var fs_extra=require(_0x15fd('0xb'));var _=require(_0x15fd('0xc'));var squel=require(_0x15fd('0xd'));var crypto=require(_0x15fd('0xe'));var jsforce=require(_0x15fd('0xf'));var deskjs=require(_0x15fd('0x10'));var toCsv=require(_0x15fd('0x9'));var querystring=require(_0x15fd('0x11'));var Papa=require(_0x15fd('0x12'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x15fd('0x13'));var authService=require(_0x15fd('0x14'));var qs=require(_0x15fd('0x15'));var as=require(_0x15fd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x17'));var utils=require(_0x15fd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x15fd('0x19'));var db=require(_0x15fd('0x1a'))['db'];config[_0x15fd('0x1b')]=_['defaults'](config[_0x15fd('0x1b')],{'host':_0x15fd('0x1c'),'port':0x18eb});var socket=require(_0x15fd('0x1d'))(new Redis(config[_0x15fd('0x1b')]));require(_0x15fd('0x1e'))[_0x15fd('0x1f')](socket);function respondWithStatusCode(_0x160102,_0x57f872){_0x57f872=_0x57f872||0xcc;return function(_0x85c348){if(_0x85c348){return _0x160102[_0x15fd('0x20')](_0x57f872);}return _0x160102[_0x15fd('0x21')](_0x57f872)['end']();};}function respondWithResult(_0x315cec,_0x128af3){_0x128af3=_0x128af3||0xc8;return function(_0x2523a0){if(_0x2523a0){return _0x315cec[_0x15fd('0x21')](_0x128af3)[_0x15fd('0x22')](_0x2523a0);}};}function respondWithFilteredResult(_0x1f69bc,_0x362276){return function(_0xc5cd33){if(_0xc5cd33){var _0x2274f3=typeof _0x362276['offset']===_0x15fd('0x23')&&typeof _0x362276[_0x15fd('0x24')]==='undefined';var _0x2ac563=_0xc5cd33[_0x15fd('0x25')];var _0x1f606c=_0x2274f3?0x0:_0x362276[_0x15fd('0x26')];var _0x16fc5f=_0x2274f3?_0xc5cd33[_0x15fd('0x25')]:_0x362276[_0x15fd('0x26')]+_0x362276['limit'];var _0x3310e2;if(_0x16fc5f>=_0x2ac563){_0x16fc5f=_0x2ac563;_0x3310e2=0xc8;}else{_0x3310e2=0xce;}_0x1f69bc[_0x15fd('0x21')](_0x3310e2);return _0x1f69bc[_0x15fd('0x27')]('Content-Range',_0x1f606c+'-'+_0x16fc5f+'/'+_0x2ac563)[_0x15fd('0x22')](_0xc5cd33);}return null;};}function patchUpdates(_0x3e0004){return function(_0x149b11){try{jsonpatch[_0x15fd('0x28')](_0x149b11,_0x3e0004,!![]);}catch(_0xc8e86d){return BPromise[_0x15fd('0x29')](_0xc8e86d);}return _0x149b11[_0x15fd('0x2a')]();};}function saveUpdates(_0x259578,_0x1093b6){return function(_0x4eeb28){if(_0x4eeb28){return _0x4eeb28[_0x15fd('0x2b')](_0x259578)[_0x15fd('0x2c')](function(_0x5069e7){return _0x5069e7;});}return null;};}function removeEntity(_0x378bb7,_0x30698a){return function(_0x4f53a7){if(_0x4f53a7){return _0x4f53a7[_0x15fd('0x2d')]()[_0x15fd('0x2c')](function(){var _0x4f19d8=_0x4f53a7[_0x15fd('0x2e')]({'plain':!![]});var _0xf9ef9d='Plugins';return db[_0x15fd('0x2f')]['destroy']({'where':{'type':_0xf9ef9d,'resourceId':_0x4f19d8['id']}})[_0x15fd('0x2c')](function(){return _0x4f53a7;});})['then'](function(){_0x378bb7[_0x15fd('0x21')](0xcc)[_0x15fd('0x30')]();});}};}function handleEntityNotFound(_0x14ef20,_0x59ed25){return function(_0x1c0923){if(!_0x1c0923){_0x14ef20['sendStatus'](0x194);}return _0x1c0923;};}function handleError(_0x375682,_0x57cf84){_0x57cf84=_0x57cf84||0x1f4;return function(_0x24fecc){logger[_0x15fd('0x31')](_0x24fecc[_0x15fd('0x32')]);if(_0x24fecc['name']){delete _0x24fecc[_0x15fd('0x33')];}_0x375682['status'](_0x57cf84)[_0x15fd('0x34')](_0x24fecc);};}exports[_0x15fd('0x35')]=function(_0xa00fe0,_0x281f1c){var _0x4bfdfb={},_0x316f34={},_0x5b0ecd={'count':0x0,'rows':[]};var _0x3f257b=_['map'](db[_0x15fd('0x36')][_0x15fd('0x37')],function(_0x293cb7){return{'name':_0x293cb7[_0x15fd('0x38')],'type':_0x293cb7['type']['key']};});_0x316f34[_0x15fd('0x39')]=_['map'](_0x3f257b,_0x15fd('0x33'));_0x316f34['query']=_[_0x15fd('0x3a')](_0xa00fe0[_0x15fd('0x3b')]);_0x316f34[_0x15fd('0x3c')]=_[_0x15fd('0x3d')](_0x316f34[_0x15fd('0x39')],_0x316f34[_0x15fd('0x3b')]);_0x4bfdfb[_0x15fd('0x3e')]=_[_0x15fd('0x3d')](_0x316f34[_0x15fd('0x39')],qs[_0x15fd('0x3f')](_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x3f')]));_0x4bfdfb['attributes']=_0x4bfdfb[_0x15fd('0x3e')][_0x15fd('0x40')]?_0x4bfdfb['attributes']:_0x316f34[_0x15fd('0x39')];if(!_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x41')](_0x15fd('0x42'))){_0x4bfdfb[_0x15fd('0x24')]=qs[_0x15fd('0x24')](_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x24')]);_0x4bfdfb[_0x15fd('0x26')]=qs['offset'](_0xa00fe0[_0x15fd('0x3b')]['offset']);}_0x4bfdfb[_0x15fd('0x43')]=qs[_0x15fd('0x44')](_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x44')]);_0x4bfdfb[_0x15fd('0x45')]=qs[_0x15fd('0x3c')](_[_0x15fd('0x46')](_0xa00fe0[_0x15fd('0x3b')],_0x316f34[_0x15fd('0x3c')]),_0x3f257b);if(_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x47')]){_0x4bfdfb[_0x15fd('0x45')]=_[_0x15fd('0x48')](_0x4bfdfb['where'],{'$or':_['map'](_0x3f257b,function(_0x41d286){if(_0x41d286[_0x15fd('0x49')]!==_0x15fd('0x4a')){var _0x1365b9={};_0x1365b9[_0x41d286[_0x15fd('0x33')]]={'$like':'%'+_0xa00fe0[_0x15fd('0x3b')][_0x15fd('0x47')]+'%'};return _0x1365b9;}})});}_0x4bfdfb=_['merge']({},_0x4bfdfb,_0xa00fe0[_0x15fd('0x4b')]);var _0x5e9a3e={'where':_0x4bfdfb[_0x15fd('0x45')]};return db[_0x15fd('0x36')]['count'](_0x5e9a3e)[_0x15fd('0x2c')](function(_0x18e348){_0x5b0ecd[_0x15fd('0x25')]=_0x18e348;if(_0xa00fe0[_0x15fd('0x3b')]['includeAll']){_0x4bfdfb[_0x15fd('0x4c')]=[{'all':!![]}];}return db[_0x15fd('0x36')][_0x15fd('0x4d')](_0x4bfdfb);})[_0x15fd('0x2c')](function(_0x15ff58){_0x5b0ecd['rows']=_0x15ff58;return _0x5b0ecd;})[_0x15fd('0x2c')](respondWithFilteredResult(_0x281f1c,_0x4bfdfb))[_0x15fd('0x4e')](handleError(_0x281f1c,null));};exports[_0x15fd('0x4f')]=function(_0x47692d,_0x19c474){var _0x5b1c96={'raw':!![],'where':{'id':_0x47692d[_0x15fd('0x50')]['id']}},_0xa2f69d={};_0xa2f69d[_0x15fd('0x39')]=_[_0x15fd('0x3a')](db['Plugin']['rawAttributes']);_0xa2f69d[_0x15fd('0x3b')]=_[_0x15fd('0x3a')](_0x47692d[_0x15fd('0x3b')]);_0xa2f69d[_0x15fd('0x3c')]=_[_0x15fd('0x3d')](_0xa2f69d[_0x15fd('0x39')],_0xa2f69d[_0x15fd('0x3b')]);_0x5b1c96[_0x15fd('0x3e')]=_['intersection'](_0xa2f69d['model'],qs[_0x15fd('0x3f')](_0x47692d[_0x15fd('0x3b')]['fields']));_0x5b1c96[_0x15fd('0x3e')]=_0x5b1c96[_0x15fd('0x3e')][_0x15fd('0x40')]?_0x5b1c96[_0x15fd('0x3e')]:_0xa2f69d[_0x15fd('0x39')];if(_0x47692d[_0x15fd('0x3b')][_0x15fd('0x51')]){_0x5b1c96[_0x15fd('0x4c')]=[{'all':!![]}];}_0x5b1c96=_[_0x15fd('0x48')]({},_0x5b1c96,_0x47692d[_0x15fd('0x4b')]);return db['Plugin'][_0x15fd('0x52')](_0x5b1c96)['then'](handleEntityNotFound(_0x19c474,null))[_0x15fd('0x2c')](respondWithResult(_0x19c474,null))[_0x15fd('0x4e')](handleError(_0x19c474,null));};exports[_0x15fd('0x53')]=function(_0x5c0080,_0x6539e8,_0x3d2092){return db[_0x15fd('0x36')][_0x15fd('0x52')]({'where':{'id':_0x5c0080[_0x15fd('0x50')]['id']},'attributes':[_0x15fd('0x33'),_0x15fd('0x7')],'raw':!![]})[_0x15fd('0x2c')](handleEntityNotFound(_0x6539e8,null))[_0x15fd('0x2c')](function(_0x23f83d){if(_0x23f83d){var _0x4398df=path[_0x15fd('0x54')](config['root'],_0x15fd('0x55'),util[_0x15fd('0x56')](_0x15fd('0x57'),path[_0x15fd('0x58')](_0x23f83d[_0x15fd('0x7')])));var _0x55e99a=fs[_0x15fd('0x59')](_0x4398df);var _0x5a5955=archiver(_0x15fd('0x5a'),{'zlib':{'level':0x9}});_0x5a5955['on'](_0x15fd('0x5b'),function(_0x2bbe2b){if(_0x2bbe2b[_0x15fd('0x5c')]===_0x15fd('0x5d')){logger[_0x15fd('0x31')](_0x2bbe2b);}else{throw new db['Sequelize'][(_0x15fd('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5a5955['on'](_0x15fd('0x31'),function(_0x4d707e){throw new db[(_0x15fd('0x5f'))][(_0x15fd('0x5e'))](_0x15fd('0x60'));});_0x5a5955[_0x15fd('0x61')](_0x55e99a);_0x5a5955['glob'](_0x15fd('0x62'),{'cwd':path[_0x15fd('0x54')](config[_0x15fd('0x63')],_0x15fd('0x55'),path[_0x15fd('0x64')](_0x23f83d['path'])),'ignore':[path[_0x15fd('0x54')](path[_0x15fd('0x58')](_0x23f83d['path']),'node_modules/**/*'),path['join'](path[_0x15fd('0x58')](_0x23f83d[_0x15fd('0x7')]),_0x15fd('0x65'))],'nodir':!![]})['finalize']();_0x55e99a['on'](_0x15fd('0x66'),function(){if(!fs['existsSync'](_0x4398df)){throw new db[(_0x15fd('0x5f'))][(_0x15fd('0x5e'))]('Plugin\x20not\x20found');}return _0x6539e8['download'](_0x4398df,util[_0x15fd('0x56')](_0x15fd('0x57'),path[_0x15fd('0x58')](_0x23f83d[_0x15fd('0x7')])),function(_0x5cedd4){if(_0x5cedd4){throw new db[(_0x15fd('0x5f'))][(_0x15fd('0x5e'))](_0x15fd('0x67'));}fs[_0x15fd('0x68')](_0x4398df);logger[_0x15fd('0x69')](_0x15fd('0x6a'));logger['info'](_0x15fd('0x6b'));});});}return null;})['catch'](handleError(_0x6539e8,null));};exports[_0x15fd('0x6c')]=function(_0x2582c8,_0x184012,_0x40615c){var _0x422a33=path[_0x15fd('0x58')](_0x2582c8['file'][_0x15fd('0x6d')],path['extname'](_0x2582c8[_0x15fd('0x6e')][_0x15fd('0x6d')]));var _0x152c1d=path[_0x15fd('0x54')](config[_0x15fd('0x63')],'server/files/plugins',_0x2582c8[_0x15fd('0x6e')]['filename']);var _0x14d363=path[_0x15fd('0x54')](config[_0x15fd('0x63')],'server/files/plugins',_0x422a33);logger[_0x15fd('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x152c1d);logger[_0x15fd('0x69')](_0x15fd('0x6f'),_0x14d363);try{fs[_0x15fd('0x70')](_0x152c1d,parseInt('0777',0x8));extract(_0x152c1d,{'dir':_0x14d363},function(_0xc0be89){if(_0xc0be89){logger[_0x15fd('0x31')](_0xc0be89);handleError(_0xc0be89,!![]);};var _0x42c088=fs['readdirSync'](_0x14d363);if(_0x42c088[_0x15fd('0x40')]>0x1){removeReferences(_0x152c1d,_0x14d363);logger['error']('Invalid\x20plugin\x20structure');return _0x40615c(new Error(_0x15fd('0x71')));}var _0x489c8c=fs[_0x15fd('0x72')](path[_0x15fd('0x54')](_0x14d363,_0x42c088[0x0]));if(_0x489c8c[_0x15fd('0x73')]()){removeReferences(_0x152c1d,_0x14d363);logger[_0x15fd('0x31')]('Invalid\x20plugin\x20structure');return _0x40615c(new Error(_0x15fd('0x71')));}if(_0x489c8c[_0x15fd('0x74')]()){var _0x48a5c6=fs['readdirSync'](path[_0x15fd('0x54')](_0x14d363,_0x42c088[0x0]));if(_0x48a5c6[_0x15fd('0x40')]===0x0){removeReferences(_0x152c1d,_0x14d363);logger[_0x15fd('0x31')](_0x15fd('0x71'));return _0x40615c(new Error(_0x15fd('0x71')));}var _0x4ecd7d=_0x48a5c6['some'](function(_0x2d7ce2){return _0x2d7ce2===_0x15fd('0x75');});if(!_0x4ecd7d){return _0x40615c(new Error(_0x15fd('0x76')));}var _0x35d95b=fs['readFileSync'](path[_0x15fd('0x54')](_0x14d363,_0x42c088[0x0],_0x15fd('0x75')));var _0x336033=JSON[_0x15fd('0x77')](_0x35d95b);if('undefined'==typeof _0x336033[_0x15fd('0x33')]){return _0x40615c(new Error(_0x15fd('0x78')));}if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x49')]){return _0x40615c(new Error(_0x15fd('0x79')));}if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7a')]){return _0x40615c(new Error(_0x15fd('0x7b')));}if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7c')]){return _0x40615c(new Error(_0x15fd('0x7d')));}if(_0x336033[_0x15fd('0x49')]===_0x15fd('0x7e')){if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')]){return _0x40615c(new Error(_0x15fd('0x80')));}if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')][_0x15fd('0x81')]&&_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')]['agent']){return _0x40615c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x336033[_0x15fd('0x49')]===_0x15fd('0x82')){if('undefined'==typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x83')]){return _0x40615c(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x15fd('0x23')==typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x84')]){return _0x40615c(new Error(_0x15fd('0x85')));}}else{return _0x40615c(new Error(_0x15fd('0x86')));}var _0x24adbf=_0x336033['name'];var _0x8572e6=_0x336033['description'];var _0x296cc1=_0x336033[_0x15fd('0x49')];var _0x5a416c=_0x336033[_0x15fd('0x87')]?_0x336033[_0x15fd('0x87')]:'always';var _0x4d11e4=_0x336033[_0x15fd('0x88')]?_0x336033[_0x15fd('0x88')]:_0x15fd('0x89');var _0x100e54='';var _0x1b14b4='';var _0x190fc7='';var _0x41c13a='';var _0x2d102a=_0x336033['version'];if(_0x296cc1==='html'){if(_0x15fd('0x23')!=typeof _0x336033['parameters'][_0x15fd('0x7f')][_0x15fd('0x81')]){var _0x14f479=_0x336033['parameters'][_0x15fd('0x7f')][_0x15fd('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x15fd('0x8a')](_0x14f479)){_0x100e54=path['join'](_0x15fd('0x8b'),_0x422a33,_0x42c088[0x0],_0x14f479);}else{_0x100e54=_0x14f479;}}else{logger[_0x15fd('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x15fd('0x23')!=typeof _0x336033[_0x15fd('0x7c')]['views'][_0x15fd('0x8c')]){var _0x337c81=_0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')][_0x15fd('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x337c81)){_0x1b14b4=path[_0x15fd('0x54')](_0x15fd('0x8b'),_0x422a33,_0x42c088[0x0],_0x337c81);}else{_0x1b14b4=_0x337c81;}}else{logger[_0x15fd('0x69')](_0x15fd('0x8d'));}}else if(_0x296cc1==='script'){_0x190fc7=_0x336033['parameters'][_0x15fd('0x83')];_0x41c13a=_0x336033[_0x15fd('0x7c')]['scriptPath'];if(_0x15fd('0x23')!=typeof _0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')]){if(_0x15fd('0x23')!=typeof _0x336033['parameters']['views'][_0x15fd('0x81')]){var _0x14f479=_0x336033[_0x15fd('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x14f479)){_0x100e54=path[_0x15fd('0x54')]('plugins',_0x422a33,_0x42c088[0x0],_0x14f479);}else{_0x100e54=_0x14f479;}}if(_0x15fd('0x23')!=typeof _0x336033[_0x15fd('0x7c')]['views'][_0x15fd('0x8c')]){var _0x337c81=_0x336033[_0x15fd('0x7c')][_0x15fd('0x7f')][_0x15fd('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x337c81)){_0x1b14b4=path[_0x15fd('0x54')](_0x15fd('0x8b'),_0x422a33,_0x42c088[0x0],_0x337c81);}else{_0x1b14b4=_0x337c81;}}}}var _0x5a980b={'name':_0x24adbf,'description':_0x8572e6,'path':path[_0x15fd('0x54')](_0x422a33,_0x42c088[0x0]),'type':_0x296cc1,'sidebar':_0x5a416c,'icon':_0x4d11e4,'adminUrl':_0x100e54,'agentUrl':_0x1b14b4,'scriptName':_0x190fc7,'scriptPath':_0x41c13a,'version':_0x2d102a};removeReferences(_0x152c1d,null);return db[_0x15fd('0x36')][_0x15fd('0x8e')](_0x5a980b)['then'](function(_0x16d8f4){var _0x1f9019={'role':_0x2582c8[_0x15fd('0x8f')][_0x15fd('0x90')],'userProfileId':_0x2582c8['body'][_0x15fd('0x91')]};if(!_0x1f9019)throw new Error(_0x15fd('0x92'));if(_0x1f9019[_0x15fd('0x90')]==='user'){var _0x1f497c=_0x16d8f4['get']({'plain':!![]});return db['UserProfileSection'][_0x15fd('0x52')]({'where':{'name':_0x15fd('0x93'),'userProfileId':_0x1f9019['userProfileId']},'raw':!![]})[_0x15fd('0x2c')](function(_0x4386a6){if(_0x4386a6&&_0x4386a6[_0x15fd('0x94')]===0x0){return db['UserProfileResource'][_0x15fd('0x8e')]({'name':_0x1f497c[_0x15fd('0x33')],'resourceId':_0x1f497c['id'],'type':_0x4386a6['name'],'sectionId':_0x4386a6['id']},{})[_0x15fd('0x2c')](function(){return _0x16d8f4;});}else{return _0x16d8f4;}})[_0x15fd('0x4e')](function(_0x1730e2){logger[_0x15fd('0x31')](_0x15fd('0x95'),_0x1730e2);throw _0x1730e2;});}return _0x16d8f4;})[_0x15fd('0x2c')](respondWithResult(_0x184012,null))[_0x15fd('0x4e')](handleError(_0x184012,null));}});}catch(_0x1c6aec){_0x184012[_0x15fd('0x21')](0x1f4)[_0x15fd('0x34')](_0x1c6aec);}};function removeReferences(_0x3d5f0c,_0x4af62c){try{if(_0x3d5f0c){fs[_0x15fd('0x68')](_0x3d5f0c);logger['info']('Zip\x20archive\x20removed');}if(_0x4af62c){rimraf(_0x4af62c,function(){});logger[_0x15fd('0x69')](_0x15fd('0x96'));}}catch(_0x3db0db){logger['error'](_0x3db0db);}}exports[_0x15fd('0x2b')]=function(_0x487ab7,_0x5ef9da,_0x22e6e1){return db['Plugin'][_0x15fd('0x52')]({'where':{'id':_0x487ab7['params']['id']}})[_0x15fd('0x2c')](handleEntityNotFound(_0x5ef9da,null))[_0x15fd('0x2c')](saveUpdates(_0x487ab7['body'],null))[_0x15fd('0x2c')](respondWithResult(_0x5ef9da,null))[_0x15fd('0x4e')](handleError(_0x5ef9da,null));};exports[_0x15fd('0x97')]=function(_0x4262c2,_0x1740d0,_0x2236b7){return db[_0x15fd('0x36')][_0x15fd('0x52')]({'where':{'id':_0x4262c2[_0x15fd('0x50')]['id']}})[_0x15fd('0x2c')](function(_0x332fde){if(_0x332fde){return _0x332fde[_0x15fd('0x2d')]();}})[_0x15fd('0x2c')](function(_0x3ef578){rimraf(path[_0x15fd('0x54')](config[_0x15fd('0x63')],_0x15fd('0x55'),path[_0x15fd('0x64')](_0x3ef578[_0x15fd('0x7')])),function(){});return _0x3ef578;})[_0x15fd('0x2c')](handleEntityNotFound(_0x1740d0,null))[_0x15fd('0x2c')](respondWithStatusCode(_0x1740d0,null))[_0x15fd('0x4e')](handleError(_0x1740d0,null));};exports['webhookGet']=function(_0x5bb018,_0x118413,_0x223a3b){return BPromise['resolve']()[_0x15fd('0x2c')](function(){if(!_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x7')]){throw new Error(_0x15fd('0x98'));}if(!_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x99')]){throw new Error(_0x15fd('0x9a'));}var _0x6d901b=_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x9b')]?_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x9b')]+':'+_0x5bb018['query'][_0x15fd('0x99')]:_0x15fd('0x9c')+_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x99')];var _0x41ecfc=_0x5bb018['query'][_0x15fd('0x22')]?_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x22')]:!![];var _0x882a2=_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x9d')]?_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x9d')]:null;var _0x2fef8b={'method':_0x5bb018[_0x15fd('0x9e')],'uri':util['format'](_0x15fd('0x9f'),_0x6d901b,_0x5bb018[_0x15fd('0x3b')][_0x15fd('0x7')]),'json':_0x41ecfc,'resolveWithFullResponse':!![],'encoding':_0x882a2,'qs':_0x5bb018['query']};if(_0x5bb018['headers']){_0x2fef8b[_0x15fd('0xa0')]=_0x5bb018['headers'];if(_0x2fef8b['headers'][_0x15fd('0xa1')]){delete _0x2fef8b[_0x15fd('0xa0')][_0x15fd('0xa1')];}}if(_0x2fef8b[_0x15fd('0xa0')]['content-type']){delete _0x2fef8b[_0x15fd('0xa0')][_0x15fd('0xa2')];}return rp(_0x2fef8b);})['then'](function(_0x5d548d){if(_0x5d548d){_0x118413['set'](_0x5d548d[_0x15fd('0xa0')]);logger[_0x15fd('0x69')](_0x5d548d[_0x15fd('0x8f')]);if(_[_0x15fd('0xa3')](_0x5bb018['query'][_0x15fd('0x7')],_0x15fd('0x53'))&&_0x5d548d['statusCode']==0x1f4){return _0x118413['sendStatus'](_0x5d548d[_0x15fd('0xa4')]);}else{return _0x118413[_0x15fd('0x21')](_0x5d548d[_0x15fd('0xa4')])[_0x15fd('0x34')](_0x5d548d['body']);}}else{return _0x118413[_0x15fd('0x20')](0xc8);}})['catch'](handleError(_0x118413,null));};exports[_0x15fd('0xa5')]=function(_0xae5ca,_0x500a5c,_0x264865){return BPromise[_0x15fd('0xa6')]()[_0x15fd('0x2c')](function(){if(!_0xae5ca['query'][_0x15fd('0x7')]){throw new Error(_0x15fd('0x98'));}if(!_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x99')]){throw new Error(_0x15fd('0x9a'));}var _0x59f8b7=_0xae5ca['query'][_0x15fd('0x9b')]?_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x9b')]+':'+_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x99')]:_0x15fd('0x9c')+_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x99')];var _0x36efe6=_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x22')]?_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x22')]:!![];var _0x5b1394=_0xae5ca[_0x15fd('0x3b')]['encoding']?_0xae5ca[_0x15fd('0x3b')][_0x15fd('0x9d')]:null;var _0x1982d1={'method':_0xae5ca[_0x15fd('0x9e')],'uri':util['format'](_0x15fd('0x9f'),_0x59f8b7,_0xae5ca['query']['path']),'json':_0x36efe6,'resolveWithFullResponse':!![],'encoding':_0x5b1394,'body':_0xae5ca[_0x15fd('0x8f')]};if(_0xae5ca[_0x15fd('0xa0')]){_0x1982d1[_0x15fd('0xa0')]=_0xae5ca[_0x15fd('0xa0')];if(_0x1982d1[_0x15fd('0xa0')]['content-length']){delete _0x1982d1[_0x15fd('0xa0')][_0x15fd('0xa1')];}}if(_0x1982d1[_0x15fd('0xa0')][_0x15fd('0xa2')]){delete _0x1982d1[_0x15fd('0xa0')][_0x15fd('0xa2')];}return rp(_0x1982d1);})[_0x15fd('0x2c')](function(_0x42483a){if(_0x42483a){_0x500a5c[_0x15fd('0x27')](_0x42483a[_0x15fd('0xa0')]);logger['info'](_0x42483a[_0x15fd('0x8f')]);return _0x500a5c[_0x15fd('0x21')](_0x42483a[_0x15fd('0xa4')])[_0x15fd('0x34')](_0x42483a[_0x15fd('0x8f')]);}else{return _0x500a5c[_0x15fd('0x20')](0xc8);}})['catch'](handleError(_0x500a5c,null));}; \ No newline at end of file +var _0xdac4=['fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Plugin','rows','catch','params','includeAll','include','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','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','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','role','userProfileId','user','UserProfileSection','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-type','set','endsWith','statusCode','webhookPost','method','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdac4,0x1c9));var _0x4dac=function(_0x352354,_0x37d9d0){_0x352354=_0x352354-0x0;var _0x36553e=_0xdac4[_0x352354];return _0x36553e;};'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(_0x4dac('0x0'));var moment=require(_0x4dac('0x1'));var BPromise=require(_0x4dac('0x2'));var Mustache=require(_0x4dac('0x3'));var util=require(_0x4dac('0x4'));var path=require(_0x4dac('0x5'));var sox=require(_0x4dac('0x6'));var csv=require(_0x4dac('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4dac('0x8'));var _=require(_0x4dac('0x9'));var squel=require(_0x4dac('0xa'));var crypto=require('crypto');var jsforce=require(_0x4dac('0xb'));var deskjs=require(_0x4dac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4dac('0xd'));var Papa=require(_0x4dac('0xe'));var extract=require(_0x4dac('0xf'));var rimraf=require(_0x4dac('0x10'));var archiver=require('archiver');var Redis=require(_0x4dac('0x11'));var authService=require(_0x4dac('0x12'));var qs=require(_0x4dac('0x13'));var as=require(_0x4dac('0x14'));var hardwareService=require(_0x4dac('0x15'));var logger=require(_0x4dac('0x16'))(_0x4dac('0x17'));var utils=require(_0x4dac('0x18'));var config=require(_0x4dac('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4dac('0x1a')]=_[_0x4dac('0x1b')](config[_0x4dac('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4dac('0x1c'))(new Redis(config[_0x4dac('0x1a')]));require(_0x4dac('0x1d'))[_0x4dac('0x1e')](socket);function respondWithStatusCode(_0x32d1df,_0x20fee5){_0x20fee5=_0x20fee5||0xcc;return function(_0x4ab887){if(_0x4ab887){return _0x32d1df[_0x4dac('0x1f')](_0x20fee5);}return _0x32d1df[_0x4dac('0x20')](_0x20fee5)[_0x4dac('0x21')]();};}function respondWithResult(_0x4108fa,_0x1e4210){_0x1e4210=_0x1e4210||0xc8;return function(_0x13dca4){if(_0x13dca4){return _0x4108fa[_0x4dac('0x20')](_0x1e4210)[_0x4dac('0x22')](_0x13dca4);}};}function respondWithFilteredResult(_0x35e607,_0x4b0d6f){return function(_0x5b690e){if(_0x5b690e){var _0x1375fe=typeof _0x4b0d6f[_0x4dac('0x23')]===_0x4dac('0x24')&&typeof _0x4b0d6f['limit']===_0x4dac('0x24');var _0x342610=_0x5b690e[_0x4dac('0x25')];var _0x28c30e=_0x1375fe?0x0:_0x4b0d6f[_0x4dac('0x23')];var _0x21acac=_0x1375fe?_0x5b690e[_0x4dac('0x25')]:_0x4b0d6f[_0x4dac('0x23')]+_0x4b0d6f[_0x4dac('0x26')];var _0x53ef9f;if(_0x21acac>=_0x342610){_0x21acac=_0x342610;_0x53ef9f=0xc8;}else{_0x53ef9f=0xce;}_0x35e607['status'](_0x53ef9f);return _0x35e607['set'](_0x4dac('0x27'),_0x28c30e+'-'+_0x21acac+'/'+_0x342610)[_0x4dac('0x22')](_0x5b690e);}return null;};}function patchUpdates(_0x4fac2d){return function(_0x8f50ce){try{jsonpatch[_0x4dac('0x28')](_0x8f50ce,_0x4fac2d,!![]);}catch(_0x14a8af){return BPromise[_0x4dac('0x29')](_0x14a8af);}return _0x8f50ce['save']();};}function saveUpdates(_0xcf7487,_0x3bd5cf){return function(_0x187727){if(_0x187727){return _0x187727[_0x4dac('0x2a')](_0xcf7487)[_0x4dac('0x2b')](function(_0x5e1b76){return _0x5e1b76;});}return null;};}function removeEntity(_0xc7a516,_0x372476){return function(_0x5b413d){if(_0x5b413d){return _0x5b413d[_0x4dac('0x2c')]()[_0x4dac('0x2b')](function(){var _0x5991f9=_0x5b413d[_0x4dac('0x2d')]({'plain':!![]});var _0x2b50cf=_0x4dac('0x2e');return db[_0x4dac('0x2f')][_0x4dac('0x2c')]({'where':{'type':_0x2b50cf,'resourceId':_0x5991f9['id']}})[_0x4dac('0x2b')](function(){return _0x5b413d;});})[_0x4dac('0x2b')](function(){_0xc7a516[_0x4dac('0x20')](0xcc)[_0x4dac('0x21')]();});}};}function handleEntityNotFound(_0x4761dd,_0x8dbb1b){return function(_0x50db5a){if(!_0x50db5a){_0x4761dd[_0x4dac('0x1f')](0x194);}return _0x50db5a;};}function handleError(_0x20a191,_0x1a4a71){_0x1a4a71=_0x1a4a71||0x1f4;return function(_0x56e894){logger[_0x4dac('0x30')](_0x56e894[_0x4dac('0x31')]);if(_0x56e894[_0x4dac('0x32')]){delete _0x56e894['name'];}_0x20a191[_0x4dac('0x20')](_0x1a4a71)[_0x4dac('0x33')](_0x56e894);};}exports['index']=function(_0x4cfcd4,_0x1543c1){var _0x85fabe={},_0x4e4a4e={},_0x1aaa49={'count':0x0,'rows':[]};var _0x104d95=_[_0x4dac('0x34')](db['Plugin'][_0x4dac('0x35')],function(_0xe1c4ec){return{'name':_0xe1c4ec[_0x4dac('0x36')],'type':_0xe1c4ec['type'][_0x4dac('0x37')]};});_0x4e4a4e[_0x4dac('0x38')]=_[_0x4dac('0x34')](_0x104d95,_0x4dac('0x32'));_0x4e4a4e[_0x4dac('0x39')]=_[_0x4dac('0x3a')](_0x4cfcd4[_0x4dac('0x39')]);_0x4e4a4e[_0x4dac('0x3b')]=_[_0x4dac('0x3c')](_0x4e4a4e['model'],_0x4e4a4e['query']);_0x85fabe[_0x4dac('0x3d')]=_['intersection'](_0x4e4a4e[_0x4dac('0x38')],qs[_0x4dac('0x3e')](_0x4cfcd4[_0x4dac('0x39')]['fields']));_0x85fabe['attributes']=_0x85fabe[_0x4dac('0x3d')][_0x4dac('0x3f')]?_0x85fabe[_0x4dac('0x3d')]:_0x4e4a4e[_0x4dac('0x38')];if(!_0x4cfcd4[_0x4dac('0x39')][_0x4dac('0x40')](_0x4dac('0x41'))){_0x85fabe[_0x4dac('0x26')]=qs['limit'](_0x4cfcd4[_0x4dac('0x39')][_0x4dac('0x26')]);_0x85fabe[_0x4dac('0x23')]=qs[_0x4dac('0x23')](_0x4cfcd4[_0x4dac('0x39')][_0x4dac('0x23')]);}_0x85fabe['order']=qs[_0x4dac('0x42')](_0x4cfcd4[_0x4dac('0x39')][_0x4dac('0x42')]);_0x85fabe['where']=qs[_0x4dac('0x3b')](_[_0x4dac('0x43')](_0x4cfcd4[_0x4dac('0x39')],_0x4e4a4e['filters']),_0x104d95);if(_0x4cfcd4[_0x4dac('0x39')][_0x4dac('0x44')]){_0x85fabe[_0x4dac('0x45')]=_[_0x4dac('0x46')](_0x85fabe[_0x4dac('0x45')],{'$or':_[_0x4dac('0x34')](_0x104d95,function(_0x4b4517){if(_0x4b4517['type']!==_0x4dac('0x47')){var _0x3f705d={};_0x3f705d[_0x4b4517[_0x4dac('0x32')]]={'$like':'%'+_0x4cfcd4[_0x4dac('0x39')]['filter']+'%'};return _0x3f705d;}})});}_0x85fabe=_['merge']({},_0x85fabe,_0x4cfcd4[_0x4dac('0x48')]);var _0x1a5eae={'where':_0x85fabe[_0x4dac('0x45')]};return db['Plugin'][_0x4dac('0x25')](_0x1a5eae)[_0x4dac('0x2b')](function(_0x3da21a){_0x1aaa49[_0x4dac('0x25')]=_0x3da21a;if(_0x4cfcd4[_0x4dac('0x39')]['includeAll']){_0x85fabe['include']=[{'all':!![]}];}return db[_0x4dac('0x49')]['findAll'](_0x85fabe);})[_0x4dac('0x2b')](function(_0x4b080e){_0x1aaa49[_0x4dac('0x4a')]=_0x4b080e;return _0x1aaa49;})[_0x4dac('0x2b')](respondWithFilteredResult(_0x1543c1,_0x85fabe))[_0x4dac('0x4b')](handleError(_0x1543c1,null));};exports['show']=function(_0x3f93e3,_0x4fcebe){var _0x2d2adc={'raw':!![],'where':{'id':_0x3f93e3[_0x4dac('0x4c')]['id']}},_0x27a76c={};_0x27a76c[_0x4dac('0x38')]=_[_0x4dac('0x3a')](db[_0x4dac('0x49')][_0x4dac('0x35')]);_0x27a76c[_0x4dac('0x39')]=_[_0x4dac('0x3a')](_0x3f93e3[_0x4dac('0x39')]);_0x27a76c[_0x4dac('0x3b')]=_[_0x4dac('0x3c')](_0x27a76c['model'],_0x27a76c[_0x4dac('0x39')]);_0x2d2adc[_0x4dac('0x3d')]=_[_0x4dac('0x3c')](_0x27a76c[_0x4dac('0x38')],qs[_0x4dac('0x3e')](_0x3f93e3[_0x4dac('0x39')][_0x4dac('0x3e')]));_0x2d2adc['attributes']=_0x2d2adc[_0x4dac('0x3d')][_0x4dac('0x3f')]?_0x2d2adc[_0x4dac('0x3d')]:_0x27a76c[_0x4dac('0x38')];if(_0x3f93e3[_0x4dac('0x39')][_0x4dac('0x4d')]){_0x2d2adc[_0x4dac('0x4e')]=[{'all':!![]}];}_0x2d2adc=_[_0x4dac('0x46')]({},_0x2d2adc,_0x3f93e3[_0x4dac('0x48')]);return db['Plugin'][_0x4dac('0x4f')](_0x2d2adc)['then'](handleEntityNotFound(_0x4fcebe,null))['then'](respondWithResult(_0x4fcebe,null))[_0x4dac('0x4b')](handleError(_0x4fcebe,null));};exports[_0x4dac('0x50')]=function(_0x4fd60f,_0x17bda1,_0x554524){return db[_0x4dac('0x49')][_0x4dac('0x4f')]({'where':{'id':_0x4fd60f[_0x4dac('0x4c')]['id']},'attributes':[_0x4dac('0x32'),_0x4dac('0x5')],'raw':!![]})[_0x4dac('0x2b')](handleEntityNotFound(_0x17bda1,null))[_0x4dac('0x2b')](function(_0x1b2d78){if(_0x1b2d78){var _0x41f326=path['join'](config[_0x4dac('0x51')],_0x4dac('0x52'),util[_0x4dac('0x53')](_0x4dac('0x54'),path[_0x4dac('0x55')](_0x1b2d78[_0x4dac('0x5')])));var _0x186e94=fs[_0x4dac('0x56')](_0x41f326);var _0x1d8244=archiver(_0x4dac('0x57'),{'zlib':{'level':0x9}});_0x1d8244['on'](_0x4dac('0x58'),function(_0x19ab91){if(_0x19ab91['code']==='ENOENT'){logger[_0x4dac('0x30')](_0x19ab91);}else{throw new db[(_0x4dac('0x59'))]['Error'](_0x4dac('0x5a'));}});_0x1d8244['on']('error',function(_0x38dee0){throw new db[(_0x4dac('0x59'))][(_0x4dac('0x5b'))](_0x4dac('0x5a'));});_0x1d8244[_0x4dac('0x5c')](_0x186e94);_0x1d8244[_0x4dac('0x5d')](_0x4dac('0x5e'),{'cwd':path[_0x4dac('0x5f')](config[_0x4dac('0x51')],_0x4dac('0x52'),path[_0x4dac('0x60')](_0x1b2d78[_0x4dac('0x5')])),'ignore':[path[_0x4dac('0x5f')](path[_0x4dac('0x55')](_0x1b2d78[_0x4dac('0x5')]),_0x4dac('0x61')),path[_0x4dac('0x5f')](path['basename'](_0x1b2d78[_0x4dac('0x5')]),_0x4dac('0x62'))],'nodir':!![]})[_0x4dac('0x63')]();_0x186e94['on'](_0x4dac('0x64'),function(){if(!fs[_0x4dac('0x65')](_0x41f326)){throw new db['Sequelize'][(_0x4dac('0x5b'))](_0x4dac('0x66'));}return _0x17bda1['download'](_0x41f326,util['format'](_0x4dac('0x54'),path[_0x4dac('0x55')](_0x1b2d78[_0x4dac('0x5')])),function(_0x433e25){if(_0x433e25){throw new db[(_0x4dac('0x59'))][(_0x4dac('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4dac('0x67')](_0x41f326);logger[_0x4dac('0x68')](_0x4dac('0x69'));logger[_0x4dac('0x68')](_0x4dac('0x6a'));});});}return null;})['catch'](handleError(_0x17bda1,null));};exports[_0x4dac('0x6b')]=function(_0x536112,_0xcd0a5a,_0x2a0066){var _0x23166f=path[_0x4dac('0x55')](_0x536112[_0x4dac('0x6c')][_0x4dac('0x6d')],path[_0x4dac('0x6e')](_0x536112[_0x4dac('0x6c')][_0x4dac('0x6d')]));var _0x59d9aa=path[_0x4dac('0x5f')](config[_0x4dac('0x51')],'server/files/plugins',_0x536112['file'][_0x4dac('0x6d')]);var _0x1b9de1=path['join'](config[_0x4dac('0x51')],_0x4dac('0x52'),_0x23166f);logger[_0x4dac('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x59d9aa);logger[_0x4dac('0x68')](_0x4dac('0x6f'),_0x1b9de1);try{fs[_0x4dac('0x70')](_0x59d9aa,parseInt(_0x4dac('0x71'),0x8));extract(_0x59d9aa,{'dir':_0x1b9de1},function(_0x3be095){if(_0x3be095){logger[_0x4dac('0x30')](_0x3be095);handleError(_0x3be095,!![]);};var _0x1c3902=fs[_0x4dac('0x72')](_0x1b9de1);if(_0x1c3902[_0x4dac('0x3f')]>0x1){removeReferences(_0x59d9aa,_0x1b9de1);logger['error'](_0x4dac('0x73'));return _0x2a0066(new Error(_0x4dac('0x73')));}var _0x451c24=fs[_0x4dac('0x74')](path['join'](_0x1b9de1,_0x1c3902[0x0]));if(_0x451c24[_0x4dac('0x75')]()){removeReferences(_0x59d9aa,_0x1b9de1);logger[_0x4dac('0x30')](_0x4dac('0x73'));return _0x2a0066(new Error(_0x4dac('0x73')));}if(_0x451c24[_0x4dac('0x76')]()){var _0x20d8cb=fs[_0x4dac('0x72')](path[_0x4dac('0x5f')](_0x1b9de1,_0x1c3902[0x0]));if(_0x20d8cb[_0x4dac('0x3f')]===0x0){removeReferences(_0x59d9aa,_0x1b9de1);logger[_0x4dac('0x30')]('Invalid\x20plugin\x20structure');return _0x2a0066(new Error('Invalid\x20plugin\x20structure'));}var _0x18f5eb=_0x20d8cb[_0x4dac('0x77')](function(_0x44c85c){return _0x44c85c===_0x4dac('0x78');});if(!_0x18f5eb){return _0x2a0066(new Error('Plugin\x20manifest\x20missing'));}var _0x1acbd6=fs[_0x4dac('0x79')](path[_0x4dac('0x5f')](_0x1b9de1,_0x1c3902[0x0],_0x4dac('0x78')));var _0x20aaf7=JSON[_0x4dac('0x7a')](_0x1acbd6);if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x32')]){return _0x2a0066(new Error(_0x4dac('0x7b')));}if('undefined'==typeof _0x20aaf7['type']){return _0x2a0066(new Error(_0x4dac('0x7c')));}if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7d')]){return _0x2a0066(new Error(_0x4dac('0x7e')));}if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7f')]){return _0x2a0066(new Error(_0x4dac('0x80')));}if(_0x20aaf7['type']===_0x4dac('0x81')){if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')]){return _0x2a0066(new Error(_0x4dac('0x83')));}if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')][_0x4dac('0x84')]&&_0x4dac('0x24')==typeof _0x20aaf7['parameters']['views'][_0x4dac('0x85')]){return _0x2a0066(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x20aaf7['type']==='script'){if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x86')]){return _0x2a0066(new Error(_0x4dac('0x87')));}if(_0x4dac('0x24')==typeof _0x20aaf7[_0x4dac('0x7f')]['scriptPath']){return _0x2a0066(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2a0066(new Error(_0x4dac('0x88')));}var _0x3d16eb=_0x20aaf7['name'];var _0xdd7ea6=_0x20aaf7['description'];var _0x2c9c3a=_0x20aaf7[_0x4dac('0x89')];var _0x4b6d0d=_0x20aaf7[_0x4dac('0x8a')]?_0x20aaf7[_0x4dac('0x8a')]:_0x4dac('0x8b');var _0x1d6d38=_0x20aaf7[_0x4dac('0x8c')]?_0x20aaf7[_0x4dac('0x8c')]:_0x4dac('0x8d');var _0x4ff202='';var _0x33b5c1='';var _0x1878ec='';var _0x43cf8c='';var _0x6997ab=_0x20aaf7['version'];if(_0x2c9c3a==='html'){if(_0x4dac('0x24')!=typeof _0x20aaf7[_0x4dac('0x7f')]['views'][_0x4dac('0x84')]){var _0x20f94b=_0x20aaf7[_0x4dac('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x20f94b)){_0x4ff202=path[_0x4dac('0x5f')](_0x4dac('0x8e'),_0x23166f,_0x1c3902[0x0],_0x20f94b);}else{_0x4ff202=_0x20f94b;}}else{logger[_0x4dac('0x68')](_0x4dac('0x8f'));}if(_0x4dac('0x24')!=typeof _0x20aaf7[_0x4dac('0x7f')]['views'][_0x4dac('0x85')]){var _0x3b6d42=_0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')][_0x4dac('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x4dac('0x90')](_0x3b6d42)){_0x33b5c1=path[_0x4dac('0x5f')](_0x4dac('0x8e'),_0x23166f,_0x1c3902[0x0],_0x3b6d42);}else{_0x33b5c1=_0x3b6d42;}}else{logger[_0x4dac('0x68')](_0x4dac('0x91'));}}else if(_0x2c9c3a===_0x4dac('0x92')){_0x1878ec=_0x20aaf7[_0x4dac('0x7f')]['scriptName'];_0x43cf8c=_0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x93')];if('undefined'!=typeof _0x20aaf7[_0x4dac('0x7f')]['views']){if('undefined'!=typeof _0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')]['admin']){var _0x20f94b=_0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')][_0x4dac('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x4dac('0x90')](_0x20f94b)){_0x4ff202=path[_0x4dac('0x5f')]('plugins',_0x23166f,_0x1c3902[0x0],_0x20f94b);}else{_0x4ff202=_0x20f94b;}}if(_0x4dac('0x24')!=typeof _0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')]['agent']){var _0x3b6d42=_0x20aaf7[_0x4dac('0x7f')][_0x4dac('0x82')][_0x4dac('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x4dac('0x90')](_0x3b6d42)){_0x33b5c1=path['join'](_0x4dac('0x8e'),_0x23166f,_0x1c3902[0x0],_0x3b6d42);}else{_0x33b5c1=_0x3b6d42;}}}}var _0xd6fcb7={'name':_0x3d16eb,'description':_0xdd7ea6,'path':path['join'](_0x23166f,_0x1c3902[0x0]),'type':_0x2c9c3a,'sidebar':_0x4b6d0d,'icon':_0x1d6d38,'adminUrl':_0x4ff202,'agentUrl':_0x33b5c1,'scriptName':_0x1878ec,'scriptPath':_0x43cf8c,'version':_0x6997ab};removeReferences(_0x59d9aa,null);return db['Plugin'][_0x4dac('0x94')](_0xd6fcb7)[_0x4dac('0x2b')](function(_0x40b6f6){var _0x3ca1a9={'role':_0x536112[_0x4dac('0x95')][_0x4dac('0x96')],'userProfileId':_0x536112[_0x4dac('0x95')][_0x4dac('0x97')]};if(!_0x3ca1a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ca1a9[_0x4dac('0x96')]===_0x4dac('0x98')){var _0x590f79=_0x40b6f6[_0x4dac('0x2d')]({'plain':!![]});return db[_0x4dac('0x99')][_0x4dac('0x4f')]({'where':{'name':_0x4dac('0x2e'),'userProfileId':_0x3ca1a9[_0x4dac('0x97')]},'raw':!![]})[_0x4dac('0x2b')](function(_0x4ac97b){if(_0x4ac97b&&_0x4ac97b['autoAssociation']===0x0){return db[_0x4dac('0x2f')][_0x4dac('0x94')]({'name':_0x590f79[_0x4dac('0x32')],'resourceId':_0x590f79['id'],'type':_0x4ac97b[_0x4dac('0x32')],'sectionId':_0x4ac97b['id']},{})[_0x4dac('0x2b')](function(){return _0x40b6f6;});}else{return _0x40b6f6;}})[_0x4dac('0x4b')](function(_0x97cdfa){logger[_0x4dac('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97cdfa);throw _0x97cdfa;});}return _0x40b6f6;})[_0x4dac('0x2b')](respondWithResult(_0xcd0a5a,null))[_0x4dac('0x4b')](handleError(_0xcd0a5a,null));}});}catch(_0x2fe0dd){_0xcd0a5a[_0x4dac('0x20')](0x1f4)['send'](_0x2fe0dd);}};function removeReferences(_0x1ec5a0,_0x15d5cb){try{if(_0x1ec5a0){fs['unlinkSync'](_0x1ec5a0);logger[_0x4dac('0x68')](_0x4dac('0x9a'));}if(_0x15d5cb){rimraf(_0x15d5cb,function(){});logger[_0x4dac('0x68')](_0x4dac('0x9b'));}}catch(_0x33fbe6){logger['error'](_0x33fbe6);}}exports[_0x4dac('0x2a')]=function(_0x14d142,_0x457f62,_0xa3bac6){return db[_0x4dac('0x49')]['find']({'where':{'id':_0x14d142[_0x4dac('0x4c')]['id']}})[_0x4dac('0x2b')](handleEntityNotFound(_0x457f62,null))[_0x4dac('0x2b')](saveUpdates(_0x14d142[_0x4dac('0x95')],null))[_0x4dac('0x2b')](respondWithResult(_0x457f62,null))['catch'](handleError(_0x457f62,null));};exports[_0x4dac('0x9c')]=function(_0xcd26c2,_0xfa2fcb,_0x4bf360){return db[_0x4dac('0x49')][_0x4dac('0x4f')]({'where':{'id':_0xcd26c2['params']['id']}})['then'](function(_0xb3c95a){if(_0xb3c95a){return _0xb3c95a[_0x4dac('0x2c')]();}})['then'](function(_0x2cf0d2){rimraf(path[_0x4dac('0x5f')](config['root'],_0x4dac('0x52'),path[_0x4dac('0x60')](_0x2cf0d2[_0x4dac('0x5')])),function(){});return _0x2cf0d2;})['then'](handleEntityNotFound(_0xfa2fcb,null))[_0x4dac('0x2b')](respondWithStatusCode(_0xfa2fcb,null))[_0x4dac('0x4b')](handleError(_0xfa2fcb,null));};exports[_0x4dac('0x9d')]=function(_0x2b7fb8,_0x3c39d8,_0x4cfb32){return BPromise[_0x4dac('0x9e')]()[_0x4dac('0x2b')](function(){if(!_0x2b7fb8['query']['path']){throw new Error(_0x4dac('0x9f'));}if(!_0x2b7fb8[_0x4dac('0x39')][_0x4dac('0xa0')]){throw new Error(_0x4dac('0xa1'));}var _0x18d203=_0x2b7fb8[_0x4dac('0x39')][_0x4dac('0xa2')]?_0x2b7fb8[_0x4dac('0x39')]['hostname']+':'+_0x2b7fb8[_0x4dac('0x39')][_0x4dac('0xa0')]:_0x4dac('0xa3')+_0x2b7fb8[_0x4dac('0x39')]['port'];var _0x337932=_0x2b7fb8['query'][_0x4dac('0x22')]?_0x2b7fb8[_0x4dac('0x39')]['json']:!![];var _0x3ddb4a=_0x2b7fb8[_0x4dac('0x39')][_0x4dac('0xa4')]?_0x2b7fb8[_0x4dac('0x39')][_0x4dac('0xa4')]:null;var _0x4a324a={'method':_0x2b7fb8['method'],'uri':util[_0x4dac('0x53')](_0x4dac('0xa5'),_0x18d203,_0x2b7fb8['query'][_0x4dac('0x5')]),'json':_0x337932,'resolveWithFullResponse':!![],'encoding':_0x3ddb4a,'qs':_0x2b7fb8['query']};if(_0x2b7fb8['headers']){_0x4a324a[_0x4dac('0xa6')]=_0x2b7fb8['headers'];if(_0x4a324a[_0x4dac('0xa6')]['content-length']){delete _0x4a324a[_0x4dac('0xa6')]['content-length'];}}if(_0x4a324a[_0x4dac('0xa6')][_0x4dac('0xa7')]){delete _0x4a324a[_0x4dac('0xa6')][_0x4dac('0xa7')];}return rp(_0x4a324a);})[_0x4dac('0x2b')](function(_0x21690f){if(_0x21690f){_0x3c39d8[_0x4dac('0xa8')](_0x21690f['headers']);logger[_0x4dac('0x68')](_0x21690f[_0x4dac('0x95')]);if(_[_0x4dac('0xa9')](_0x2b7fb8['query'][_0x4dac('0x5')],_0x4dac('0x50'))&&_0x21690f['statusCode']==0x1f4){return _0x3c39d8['sendStatus'](_0x21690f['statusCode']);}else{return _0x3c39d8[_0x4dac('0x20')](_0x21690f[_0x4dac('0xaa')])[_0x4dac('0x33')](_0x21690f['body']);}}else{return _0x3c39d8[_0x4dac('0x1f')](0xc8);}})[_0x4dac('0x4b')](handleError(_0x3c39d8,null));};exports[_0x4dac('0xab')]=function(_0x2794bb,_0x23afdb,_0x336047){return BPromise[_0x4dac('0x9e')]()['then'](function(){if(!_0x2794bb['query'][_0x4dac('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2794bb[_0x4dac('0x39')][_0x4dac('0xa0')]){throw new Error(_0x4dac('0xa1'));}var _0x3741d3=_0x2794bb['query'][_0x4dac('0xa2')]?_0x2794bb[_0x4dac('0x39')][_0x4dac('0xa2')]+':'+_0x2794bb['query']['port']:_0x4dac('0xa3')+_0x2794bb[_0x4dac('0x39')][_0x4dac('0xa0')];var _0x1d545d=_0x2794bb[_0x4dac('0x39')][_0x4dac('0x22')]?_0x2794bb[_0x4dac('0x39')][_0x4dac('0x22')]:!![];var _0x6e7d25=_0x2794bb[_0x4dac('0x39')][_0x4dac('0xa4')]?_0x2794bb[_0x4dac('0x39')][_0x4dac('0xa4')]:null;var _0x4dce03={'method':_0x2794bb[_0x4dac('0xac')],'uri':util[_0x4dac('0x53')]('%s%s',_0x3741d3,_0x2794bb[_0x4dac('0x39')][_0x4dac('0x5')]),'json':_0x1d545d,'resolveWithFullResponse':!![],'encoding':_0x6e7d25,'body':_0x2794bb['body']};if(_0x2794bb[_0x4dac('0xa6')]){_0x4dce03[_0x4dac('0xa6')]=_0x2794bb[_0x4dac('0xa6')];if(_0x4dce03[_0x4dac('0xa6')]['content-length']){delete _0x4dce03['headers']['content-length'];}}if(_0x4dce03[_0x4dac('0xa6')][_0x4dac('0xa7')]){delete _0x4dce03[_0x4dac('0xa6')]['content-type'];}return rp(_0x4dce03);})[_0x4dac('0x2b')](function(_0x80958a){if(_0x80958a){_0x23afdb[_0x4dac('0xa8')](_0x80958a[_0x4dac('0xa6')]);logger['info'](_0x80958a[_0x4dac('0x95')]);return _0x23afdb[_0x4dac('0x20')](_0x80958a[_0x4dac('0xaa')])[_0x4dac('0x33')](_0x80958a[_0x4dac('0x95')]);}else{return _0x23afdb[_0x4dac('0x1f')](0xc8);}})['catch'](handleError(_0x23afdb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 28c04e2..52a8eb1 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 _0x7fd6=['Plugin','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x2ff717,_0x13860f){var _0x2112fa=function(_0x2299d1){while(--_0x2299d1){_0x2ff717['push'](_0x2ff717['shift']());}};_0x2112fa(++_0x13860f);}(_0x7fd6,0x157));var _0x67fd=function(_0x280f02,_0x3b6eb8){_0x280f02=_0x280f02-0x0;var _0x1a1546=_0x7fd6[_0x280f02];return _0x1a1546;};'use strict';var EventEmitter=require(_0x67fd('0x0'));var Plugin=require('../../mysqldb')['db'][_0x67fd('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x67fd('0x2')](0x0);var events={'afterCreate':_0x67fd('0x3'),'afterUpdate':_0x67fd('0x4'),'afterDestroy':_0x67fd('0x5')};function emitEvent(_0xbdd0c0){return function(_0x4f52bc,_0x187f3e,_0x50238d){PluginEvents['emit'](_0xbdd0c0+':'+_0x4f52bc['id'],_0x4f52bc);PluginEvents['emit'](_0xbdd0c0,_0x4f52bc);_0x50238d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x67fd('0x6')](e,emitEvent(event));}}module[_0x67fd('0x7')]=PluginEvents; \ No newline at end of file +var _0x0b3d=['Plugin','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x15023f,_0x342b87){var _0x1d3400=function(_0x4408ac){while(--_0x4408ac){_0x15023f['push'](_0x15023f['shift']());}};_0x1d3400(++_0x342b87);}(_0x0b3d,0x76));var _0xd0b3=function(_0x18bf17,_0x32626e){_0x18bf17=_0x18bf17-0x0;var _0x7c4e02=_0x0b3d[_0x18bf17];return _0x7c4e02;};'use strict';var EventEmitter=require(_0xd0b3('0x0'));var Plugin=require('../../mysqldb')['db'][_0xd0b3('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd0b3('0x2'),'afterUpdate':'update','afterDestroy':_0xd0b3('0x3')};function emitEvent(_0x4edc24){return function(_0x372f08,_0x50faaa,_0x371869){PluginEvents[_0xd0b3('0x4')](_0x4edc24+':'+_0x372f08['id'],_0x372f08);PluginEvents['emit'](_0x4edc24,_0x372f08);_0x371869(null);};}for(var e in events){if(events[_0xd0b3('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd0b3('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5f8fba9..c99c42c 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 _0x92bc=['../../config/logger','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','Plugin','plugins','lodash','util'];(function(_0x554739,_0xccd826){var _0x519f19=function(_0x43f4c6){while(--_0x43f4c6){_0x554739['push'](_0x554739['shift']());}};_0x519f19(++_0xccd826);}(_0x92bc,0x106));var _0xc92b=function(_0x4edec3,_0x277c65){_0x4edec3=_0x4edec3-0x0;var _0x5a8e21=_0x92bc[_0x4edec3];return _0x5a8e21;};'use strict';var _=require(_0xc92b('0x0'));var util=require(_0xc92b('0x1'));var logger=require(_0xc92b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc92b('0x3'));var rp=require(_0xc92b('0x4'));var fs=require('fs');var path=require(_0xc92b('0x5'));var rimraf=require(_0xc92b('0x6'));var config=require('../../config/environment');var attributes=require(_0xc92b('0x7'));module[_0xc92b('0x8')]=function(_0x3dbb56,_0x51b6e7){return _0x3dbb56['define'](_0xc92b('0x9'),attributes,{'tableName':_0xc92b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b44=['../../config/environment','./plugin.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x16e864,_0x53692b){var _0x385160=function(_0x565215){while(--_0x565215){_0x16e864['push'](_0x16e864['shift']());}};_0x385160(++_0x53692b);}(_0x2b44,0x122));var _0x42b4=function(_0xf318ee,_0x335ff1){_0xf318ee=_0xf318ee-0x0;var _0x1f613f=_0x2b44[_0xf318ee];return _0x1f613f;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var logger=require(_0x42b4('0x2'))(_0x42b4('0x3'));var moment=require(_0x42b4('0x4'));var BPromise=require(_0x42b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42b4('0x6'));var config=require(_0x42b4('0x7'));var attributes=require(_0x42b4('0x8'));module[_0x42b4('0x9')]=function(_0x4cc6c5,_0xe54897){return _0x4cc6c5[_0x42b4('0xa')]('Plugin',attributes,{'tableName':'plugins','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 fcc7b6f..a7a53e5 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 _0x6b54=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3a6568,_0xd3df53){var _0x12b620=function(_0x17a52f){while(--_0x17a52f){_0x3a6568['push'](_0x3a6568['shift']());}};_0x12b620(++_0xd3df53);}(_0x6b54,0x176));var _0x46b5=function(_0x2e5782,_0x3d7d05){_0x2e5782=_0x2e5782-0x0;var _0x1b82c8=_0x6b54[_0x2e5782];return _0x1b82c8;};'use strict';var _=require(_0x46b5('0x0'));var util=require(_0x46b5('0x1'));var moment=require(_0x46b5('0x2'));var BPromise=require(_0x46b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46b5('0x4'));var db=require(_0x46b5('0x5'))['db'];var utils=require(_0x46b5('0x6'));var logger=require(_0x46b5('0x7'))(_0x46b5('0x8'));var config=require(_0x46b5('0x9'));var jayson=require(_0x46b5('0xa'));var client=jayson[_0x46b5('0xb')][_0x46b5('0xc')]({'port':0x232a});config[_0x46b5('0xd')]=_[_0x46b5('0xe')](config['redis'],{'host':_0x46b5('0xf'),'port':0x18eb});var socket=require(_0x46b5('0x10'))(new Redis(config[_0x46b5('0xd')]));require('./plugin.socket')[_0x46b5('0x11')](socket);function respondWithRpcPromise(_0x33009c,_0x2d74c6,_0x2ac172){return new BPromise(function(_0x5e1a37,_0x268807){return client[_0x46b5('0x12')](_0x33009c,_0x2ac172)[_0x46b5('0x13')](function(_0x3f4b03){logger[_0x46b5('0x14')](_0x46b5('0x15'),_0x2d74c6,_0x46b5('0x16'));logger[_0x46b5('0x17')](_0x46b5('0x18'),_0x2d74c6,_0x46b5('0x16'),JSON[_0x46b5('0x19')](_0x3f4b03));if(_0x3f4b03[_0x46b5('0x1a')]){if(_0x3f4b03[_0x46b5('0x1a')]['code']===0x1f4){logger[_0x46b5('0x1a')](_0x46b5('0x15'),_0x2d74c6,_0x3f4b03[_0x46b5('0x1a')][_0x46b5('0x1b')]);return _0x268807(_0x3f4b03[_0x46b5('0x1a')][_0x46b5('0x1b')]);}logger[_0x46b5('0x1a')](_0x46b5('0x15'),_0x2d74c6,_0x3f4b03['error']['message']);return _0x5e1a37(_0x3f4b03[_0x46b5('0x1a')][_0x46b5('0x1b')]);}else{logger[_0x46b5('0x14')]('Plugin,\x20%s,\x20%s',_0x2d74c6,_0x46b5('0x16'));_0x5e1a37(_0x3f4b03['result'][_0x46b5('0x1b')]);}})[_0x46b5('0x1c')](function(_0x745068){logger['error']('Plugin,\x20%s,\x20%s',_0x2d74c6,_0x745068);_0x268807(_0x745068);});});}exports[_0x46b5('0x1d')]=function(_0x34cf16){var _0x37ecd9=this;return new Promise(function(_0xc383cd,_0x2a57ca){return db[_0x46b5('0x1e')][_0x46b5('0x1f')](_0x34cf16[_0x46b5('0x20')],{'raw':_0x34cf16[_0x46b5('0x21')]?_0x34cf16[_0x46b5('0x21')][_0x46b5('0x22')]===undefined?!![]:![]:!![]})[_0x46b5('0x13')](function(_0x540fa3){logger[_0x46b5('0x14')](_0x46b5('0x1d'),_0x34cf16);logger[_0x46b5('0x17')](_0x46b5('0x1d'),_0x34cf16,JSON['stringify'](_0x540fa3));_0xc383cd(_0x540fa3);})[_0x46b5('0x1c')](function(_0x2b95e3){logger['error'](_0x46b5('0x1d'),_0x2b95e3[_0x46b5('0x1b')],_0x34cf16);_0x2a57ca(_0x37ecd9['error'](0x1f4,_0x2b95e3['message']));});});}; \ No newline at end of file +var _0xa18a=['request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','catch','CreatePlugin','Plugin','create','body','options','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x8b2271,_0x2f7364){var _0x5cfb4e=function(_0xf6ebb2){while(--_0xf6ebb2){_0x8b2271['push'](_0x8b2271['shift']());}};_0x5cfb4e(++_0x2f7364);}(_0xa18a,0x13c));var _0xaa18=function(_0x3747f1,_0x3e5372){_0x3747f1=_0x3747f1-0x0;var _0x421f36=_0xa18a[_0x3747f1];return _0x421f36;};'use strict';var _=require(_0xaa18('0x0'));var util=require('util');var moment=require(_0xaa18('0x1'));var BPromise=require(_0xaa18('0x2'));var rs=require(_0xaa18('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa18('0x4'))['db'];var utils=require(_0xaa18('0x5'));var logger=require(_0xaa18('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaa18('0x7'));var client=jayson[_0xaa18('0x8')]['http']({'port':0x232a});config['redis']=_[_0xaa18('0x9')](config['redis'],{'host':_0xaa18('0xa'),'port':0x18eb});var socket=require(_0xaa18('0xb'))(new Redis(config['redis']));require(_0xaa18('0xc'))[_0xaa18('0xd')](socket);function respondWithRpcPromise(_0x5b8d8f,_0x117136,_0x11c41d){return new BPromise(function(_0x32ec0b,_0x538c59){return client[_0xaa18('0xe')](_0x5b8d8f,_0x11c41d)['then'](function(_0x22ad91){logger[_0xaa18('0xf')]('Plugin,\x20%s,\x20%s',_0x117136,_0xaa18('0x10'));logger[_0xaa18('0x11')](_0xaa18('0x12'),_0x117136,_0xaa18('0x10'),JSON[_0xaa18('0x13')](_0x22ad91));if(_0x22ad91[_0xaa18('0x14')]){if(_0x22ad91[_0xaa18('0x14')]['code']===0x1f4){logger[_0xaa18('0x14')]('Plugin,\x20%s,\x20%s',_0x117136,_0x22ad91[_0xaa18('0x14')][_0xaa18('0x15')]);return _0x538c59(_0x22ad91['error'][_0xaa18('0x15')]);}logger[_0xaa18('0x14')](_0xaa18('0x16'),_0x117136,_0x22ad91[_0xaa18('0x14')]['message']);return _0x32ec0b(_0x22ad91[_0xaa18('0x14')]['message']);}else{logger[_0xaa18('0xf')]('Plugin,\x20%s,\x20%s',_0x117136,_0xaa18('0x10'));_0x32ec0b(_0x22ad91['result'][_0xaa18('0x15')]);}})[_0xaa18('0x17')](function(_0x5e02dd){logger[_0xaa18('0x14')](_0xaa18('0x16'),_0x117136,_0x5e02dd);_0x538c59(_0x5e02dd);});});}exports[_0xaa18('0x18')]=function(_0x4f111c){var _0x565935=this;return new Promise(function(_0x4eb25e,_0x2e070b){return db[_0xaa18('0x19')][_0xaa18('0x1a')](_0x4f111c[_0xaa18('0x1b')],{'raw':_0x4f111c[_0xaa18('0x1c')]?_0x4f111c[_0xaa18('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xaa18('0x1d')](function(_0x175abc){logger['info'](_0xaa18('0x18'),_0x4f111c);logger['debug'](_0xaa18('0x18'),_0x4f111c,JSON['stringify'](_0x175abc));_0x4eb25e(_0x175abc);})[_0xaa18('0x17')](function(_0x4c8782){logger['error'](_0xaa18('0x18'),_0x4c8782[_0xaa18('0x15')],_0x4f111c);_0x2e070b(_0x565935[_0xaa18('0x14')](0x1f4,_0x4c8782[_0xaa18('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dd004a6..22c472c 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 _0xc97f=['emit','removeListener','register','length','plugin:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc97f,0x1a9));var _0xfc97=function(_0x1796e0,_0x1cd22a){_0x1796e0=_0x1796e0-0x0;var _0x1f7c22=_0xc97f[_0x1796e0];return _0x1f7c22;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xfc97('0x0'),_0xfc97('0x1'),'update'];function createListener(_0x3d33ef,_0x2eec0b){return function(_0x1caec4){_0x2eec0b[_0xfc97('0x2')](_0x3d33ef,_0x1caec4);};}function removeListener(_0x2b2826,_0x3dcbe3){return function(){PluginEvents[_0xfc97('0x3')](_0x2b2826,_0x3dcbe3);};}exports[_0xfc97('0x4')]=function(_0x436cfd){for(var _0x3f6faa=0x0,_0x12e752=events[_0xfc97('0x5')];_0x3f6faa<_0x12e752;_0x3f6faa++){var _0x2a8b44=events[_0x3f6faa];var _0x250b95=createListener(_0xfc97('0x6')+_0x2a8b44,_0x436cfd);PluginEvents['on'](_0x2a8b44,_0x250b95);}}; \ No newline at end of file +var _0x2990=['./plugin.events','save','remove','update','emit','register','plugin:'];(function(_0xf17da4,_0x38d993){var _0x411e22=function(_0x21b509){while(--_0x21b509){_0xf17da4['push'](_0xf17da4['shift']());}};_0x411e22(++_0x38d993);}(_0x2990,0x16c));var _0x0299=function(_0x4b5de3,_0x28118a){_0x4b5de3=_0x4b5de3-0x0;var _0x44e503=_0x2990[_0x4b5de3];return _0x44e503;};'use strict';var PluginEvents=require(_0x0299('0x0'));var events=[_0x0299('0x1'),_0x0299('0x2'),_0x0299('0x3')];function createListener(_0x479f05,_0x4fe1d6){return function(_0x17bada){_0x4fe1d6[_0x0299('0x4')](_0x479f05,_0x17bada);};}function removeListener(_0x17e524,_0x4faa27){return function(){PluginEvents['removeListener'](_0x17e524,_0x4faa27);};}exports[_0x0299('0x5')]=function(_0x1103d7){for(var _0x51c8c9=0x0,_0x5751b3=events['length'];_0x51c8c9<_0x5751b3;_0x51c8c9++){var _0x54a9d4=events[_0x51c8c9];var _0x1f0877=createListener(_0x0299('0x6')+_0x54a9d4,_0x1103d7);PluginEvents['on'](_0x54a9d4,_0x1f0877);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6abeed3..78199fc 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(_0xb63d33,_0x1652e4){var _0x29fbcd=function(_0x4c896c){while(--_0x4c896c){_0xb63d33['push'](_0xb63d33['shift']());}};_0x29fbcd(++_0x1652e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x55d821,_0x2736af){var _0x1a1e34=function(_0x28edd2){while(--_0x28edd2){_0x55d821['push'](_0x55d821['shift']());}};_0x1a1e34(++_0x2736af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 78c4fd4..606ced3 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 _0xe13a=['exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','reject','express','length','catch','show','describe','params','then','body','script','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xe13a,0x178));var _0xae13=function(_0x27853f,_0x3db82b){_0x27853f=_0x27853f-0x0;var _0x35b8a9=_0xe13a[_0x27853f];return _0x35b8a9;};'use strict';var _=require('lodash');var pm2=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var path=require(_0xae13('0x3'));var exec=require('child_process')[_0xae13('0x4')];var BPromise=require(_0xae13('0x5'));function handleEntityNotFound(_0x3ebbfe,_0x10abd7){return function(_0x28a89a){if(!_0x28a89a){_0x3ebbfe[_0xae13('0x6')](0x194);;}return _0x28a89a;};}function respondWithResult(_0x412a07,_0x3379ed){_0x3379ed=_0x3379ed||0xc8;return function(_0x341ba4){if(_0x341ba4){return _0x412a07['status'](_0x3379ed)[_0xae13('0x7')](_0x341ba4);}return null;};}function handleError(_0x2b2e1f,_0x27fefd){_0x27fefd=_0x27fefd||0x1f4;return function(_0x2a793f){logger[_0xae13('0x8')](_0x2a793f[_0xae13('0x9')]);if(_0x2a793f[_0xae13('0xa')]){delete _0x2a793f[_0xae13('0xa')];}_0x2b2e1f[_0xae13('0xb')](_0x27fefd)['send'](_0x2a793f);};}function execChildProcess(){return new BPromise(function(_0x404b0e,_0x83de98){exec(_0xae13('0xc'),function(_0x3a6d41,_0x14df2d,_0x3006f0){logger[_0xae13('0xd')](_0x14df2d);logger['info'](_0x3006f0);if(_0x3a6d41){logger[_0xae13('0x8')](_0x3a6d41);return _0x83de98(_0x3a6d41);}return _0x404b0e(_0x14df2d);});});}exports[_0xae13('0xe')]=function(_0x5c61bb,_0x589803){return pm2['list']()['then'](function(_0x52484b){if(_0x52484b){var _0x26ff3e=_[_0xae13('0xf')](_0x52484b,function(_0x44e141){return _0x44e141[_0xae13('0xa')]===_0xae13('0x10')||_0x44e141[_0xae13('0xa')]==='motion2';});return{'rows':_0x26ff3e,'count':_0x26ff3e[_0xae13('0x11')]};}return null;})['then'](respondWithResult(_0x589803,null))[_0xae13('0x12')](handleError(_0x589803,null));};exports[_0xae13('0x13')]=function(_0x207363,_0x118e52){return pm2[_0xae13('0x14')](_0x207363[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x118e52,null))[_0xae13('0x16')](handleEntityNotFound(_0x118e52,null))[_0xae13('0x12')](handleError(_0x118e52,null));};exports['create']=function(_0x4462a5,_0x50eb6c){if(_0x4462a5[_0xae13('0x17')][_0xae13('0xa')]&&_0x4462a5['body'][_0xae13('0x18')]){var _0x39d41c=path[_0xae13('0x19')](__dirname,_0xae13('0x1a'),_0x4462a5[_0xae13('0x17')][_0xae13('0x18')]);var _0x54b3b4=process['cwd']();process[_0xae13('0x1b')](path[_0xae13('0x1c')](_0x39d41c));return execChildProcess()['then'](function(_0x168b92){process['chdir'](_0x54b3b4);return pm2[_0xae13('0x1d')]({'name':_0x4462a5[_0xae13('0x17')][_0xae13('0xa')],'script':_0x39d41c});})['then'](function(_0x57124a){pm2['dump']();return _0x57124a[0x0];})[_0xae13('0x16')](respondWithResult(_0x50eb6c,0xc9))[_0xae13('0x12')](handleError(_0x50eb6c,null));}else{return _0x50eb6c[_0xae13('0xb')](0x1f4)['send']({'message':_0xae13('0x1e')});}};exports['update']=function(_0x3d0d60,_0x5de054){if(_0x3d0d60[_0xae13('0x17')]['id']){delete _0x3d0d60[_0xae13('0x17')]['id'];}var _0x526e4e={'online':_0xae13('0x1f'),'stopped':_0xae13('0x20')};if(_0x526e4e[_0xae13('0x21')](_0x3d0d60[_0xae13('0x17')]['status'])){return pm2[_0x526e4e[_0x3d0d60[_0xae13('0x17')][_0xae13('0xb')]]](_0x3d0d60[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x5de054,0xc8))[_0xae13('0x12')](handleError(_0x5de054,null));}else{return _0x5de054[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':'Unknown\x20status'});}};exports[_0xae13('0x23')]=function(_0x591f94,_0xf6289c){if(_0x591f94[_0xae13('0x17')]['id']){delete _0x591f94[_0xae13('0x17')]['id'];}if(_0x591f94[_0xae13('0x15')]['id']){return pm2[_0xae13('0x24')](_0x591f94[_0xae13('0x15')]['id'])[_0xae13('0x16')](function(_0x48f0f6){pm2['dump']();return _0x48f0f6[0x0];})[_0xae13('0x16')](respondWithResult(_0xf6289c,null))[_0xae13('0x12')](handleError(_0xf6289c,null));}else{return _0xf6289c[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':_0xae13('0x25')});}}; \ No newline at end of file +var _0x2bc6=['json','error','stack','name','send','npm\x20install','info','then','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','bluebird','status'];(function(_0x4f1af9,_0xc95c63){var _0x11a60e=function(_0x19de7f){while(--_0x19de7f){_0x4f1af9['push'](_0x4f1af9['shift']());}};_0x11a60e(++_0xc95c63);}(_0x2bc6,0x163));var _0x62bc=function(_0x35909c,_0x27fa56){_0x35909c=_0x35909c-0x0;var _0x45abd5=_0x2bc6[_0x35909c];return _0x45abd5;};'use strict';var _=require(_0x62bc('0x0'));var pm2=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var path=require('path');var exec=require('child_process')['exec'];var BPromise=require(_0x62bc('0x3'));function handleEntityNotFound(_0x576608,_0x2a1959){return function(_0x2b12de){if(!_0x2b12de){_0x576608['sendStatus'](0x194);;}return _0x2b12de;};}function respondWithResult(_0x3cce26,_0x450cb6){_0x450cb6=_0x450cb6||0xc8;return function(_0x40af10){if(_0x40af10){return _0x3cce26[_0x62bc('0x4')](_0x450cb6)[_0x62bc('0x5')](_0x40af10);}return null;};}function handleError(_0x3f625c,_0x5bedeb){_0x5bedeb=_0x5bedeb||0x1f4;return function(_0x441722){logger[_0x62bc('0x6')](_0x441722[_0x62bc('0x7')]);if(_0x441722[_0x62bc('0x8')]){delete _0x441722['name'];}_0x3f625c[_0x62bc('0x4')](_0x5bedeb)[_0x62bc('0x9')](_0x441722);};}function execChildProcess(){return new BPromise(function(_0x1e3a57,_0x546acc){exec(_0x62bc('0xa'),function(_0x22e6c8,_0x256784,_0x444910){logger[_0x62bc('0xb')](_0x256784);logger[_0x62bc('0xb')](_0x444910);if(_0x22e6c8){logger[_0x62bc('0x6')](_0x22e6c8);return _0x546acc(_0x22e6c8);}return _0x1e3a57(_0x256784);});});}exports['index']=function(_0x2a96ae,_0x28390b){return pm2['list']()[_0x62bc('0xc')](function(_0x10230f){if(_0x10230f){var _0xc14ac9=_['reject'](_0x10230f,function(_0x263424){return _0x263424[_0x62bc('0x8')]==='express'||_0x263424['name']===_0x62bc('0xd');});return{'rows':_0xc14ac9,'count':_0xc14ac9[_0x62bc('0xe')]};}return null;})['then'](respondWithResult(_0x28390b,null))[_0x62bc('0xf')](handleError(_0x28390b,null));};exports[_0x62bc('0x10')]=function(_0xc1211c,_0x1e2405){return pm2[_0x62bc('0x11')](_0xc1211c[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x1e2405,null))[_0x62bc('0xc')](handleEntityNotFound(_0x1e2405,null))[_0x62bc('0xf')](handleError(_0x1e2405,null));};exports['create']=function(_0x5dd6f0,_0x2b2e5f){if(_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')]&&_0x5dd6f0['body'][_0x62bc('0x14')]){var _0x495f99=path[_0x62bc('0x15')](__dirname,_0x62bc('0x16'),_0x5dd6f0[_0x62bc('0x13')]['script']);var _0x3b8644=process[_0x62bc('0x17')]();process[_0x62bc('0x18')](path[_0x62bc('0x19')](_0x495f99));return execChildProcess()[_0x62bc('0xc')](function(_0x3b2eb0){process['chdir'](_0x3b8644);return pm2[_0x62bc('0x1a')]({'name':_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')],'script':_0x495f99});})[_0x62bc('0xc')](function(_0x117ebc){pm2['dump']();return _0x117ebc[0x0];})['then'](respondWithResult(_0x2b2e5f,0xc9))[_0x62bc('0xf')](handleError(_0x2b2e5f,null));}else{return _0x2b2e5f['status'](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x1b')});}};exports[_0x62bc('0x1c')]=function(_0x4a72d6,_0x3d55df){if(_0x4a72d6[_0x62bc('0x13')]['id']){delete _0x4a72d6[_0x62bc('0x13')]['id'];}var _0x5c03ac={'online':'restart','stopped':_0x62bc('0x1d')};if(_0x5c03ac[_0x62bc('0x1e')](_0x4a72d6[_0x62bc('0x13')]['status'])){return pm2[_0x5c03ac[_0x4a72d6[_0x62bc('0x13')][_0x62bc('0x4')]]](_0x4a72d6[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x3d55df,0xc8))['catch'](handleError(_0x3d55df,null));}else{return _0x3d55df[_0x62bc('0x4')](0x1f4)['send']({'message':_0x62bc('0x1f')});}};exports[_0x62bc('0x20')]=function(_0x32048f,_0x2dd7fd){if(_0x32048f[_0x62bc('0x13')]['id']){delete _0x32048f[_0x62bc('0x13')]['id'];}if(_0x32048f[_0x62bc('0x12')]['id']){return pm2[_0x62bc('0x21')](_0x32048f[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](function(_0x156f95){pm2[_0x62bc('0x22')]();return _0x156f95[0x0];})[_0x62bc('0xc')](respondWithResult(_0x2dd7fd,null))[_0x62bc('0xf')](handleError(_0x2dd7fd,null));}else{return _0x2dd7fd[_0x62bc('0x4')](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 91ee305..afd8732 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 _0x0e5a=['get','/queues','isAuthenticated','getQueues','express','Router'];(function(_0x2529ca,_0x368695){var _0x33479a=function(_0x245ed7){while(--_0x245ed7){_0x2529ca['push'](_0x2529ca['shift']());}};_0x33479a(++_0x368695);}(_0x0e5a,0x70));var _0xa0e5=function(_0x4ce2c1,_0xc800ec){_0x4ce2c1=_0x4ce2c1-0x0;var _0x2357f7=_0x0e5a[_0x4ce2c1];return _0x2357f7;};'use strict';var express=require(_0xa0e5('0x0'));var router=express[_0xa0e5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0xa0e5('0x2')](_0xa0e5('0x3'),auth[_0xa0e5('0x4')](),controller[_0xa0e5('0x5')]);module['exports']=router; \ No newline at end of file +var _0x5acc=['exports','express','Router','get','/queues','isAuthenticated'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x5acc,0x1ed));var _0xc5ac=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5acc[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xc5ac('0x0'));var router=express[_0xc5ac('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0xc5ac('0x2')](_0xc5ac('0x3'),auth[_0xc5ac('0x4')](),controller['getQueues']);module[_0xc5ac('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 76fe04d..26dabb0 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 _0x48d9=['lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','limit','status','set','Content-Range','json','stack','name','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','available','waiting','talking','outbound','push','pTalking','dialActive','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','map','agents','paused','loggedInDb','originated','pick','filter','queue','length','busy','connectedlinenum','internal','toString','find','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','QueueId','getQueues','chat','sms','openchannel','whatsapp','resolve','query','includes','channel','toLowerCase','Invalid\x20channel','rawAttributes','fieldName','type','key','getOptions','role','userProfileId','QueueCampaigns','getResources','count','rows','all','util'];(function(_0x11f8b6,_0x4b2518){var _0x5ca321=function(_0x4406cd){while(--_0x4406cd){_0x11f8b6['push'](_0x11f8b6['shift']());}};_0x5ca321(++_0x4b2518);}(_0x48d9,0x113));var _0x948d=function(_0x1980ce,_0x2d82bb){_0x1980ce=_0x1980ce-0x0;var _0xdf809e=_0x48d9[_0x1980ce];return _0xdf809e;};'use strict';var util=require(_0x948d('0x0'));var _=require(_0x948d('0x1'));var jayson=require(_0x948d('0x2'));var qs=require(_0x948d('0x3'));var logger=require(_0x948d('0x4'))('api');var db=require(_0x948d('0x5'))['db'];var amiClient=jayson[_0x948d('0x6')][_0x948d('0x7')]({'port':0x232a});var routingClient=jayson[_0x948d('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0x4344af,_0x4c845d){return function(_0x4f50a3){if(_0x4f50a3){var _0x54dae4=typeof _0x4c845d[_0x948d('0x8')]==='undefined'&&typeof _0x4c845d[_0x948d('0x9')]==='undefined';var _0x51d00e=_0x4f50a3['count'];var _0x285d8d=_0x54dae4?0x0:_0x4c845d[_0x948d('0x8')];var _0x335159=_0x54dae4?_0x4f50a3['count']:_0x4c845d[_0x948d('0x8')]+_0x4c845d[_0x948d('0x9')];var _0x11a9b1;if(_0x335159>=_0x51d00e){_0x335159=_0x51d00e;_0x11a9b1=0xc8;}else{_0x11a9b1=0xce;}_0x4344af[_0x948d('0xa')](_0x11a9b1);return _0x4344af[_0x948d('0xb')](_0x948d('0xc'),_0x285d8d+'-'+_0x335159+'/'+_0x51d00e)[_0x948d('0xd')](_0x4f50a3);}return null;};}function handleError(_0x282981,_0x29b82d){_0x29b82d=_0x29b82d||0x1f4;return function(_0x5ab22f){logger['error'](_0x5ab22f[_0x948d('0xe')]);if(_0x5ab22f[_0x948d('0xf')]){delete _0x5ab22f['name'];}_0x282981['status'](_0x29b82d)['send'](_0x5ab22f);};}function getRealtimeAgents(){return new Promise(function(_0x3d092e,_0x44406b){return amiClient[_0x948d('0x10')](_0x948d('0x11'),{})[_0x948d('0x12')](function(_0x3fbb26){if(_0x3fbb26[_0x948d('0x13')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x80c01=_0x3fbb26[_0x948d('0x14')];return routingClient[_0x948d('0x10')](_0x948d('0x11'),{})[_0x948d('0x12')](function(_0xfc51c0){if(_0xfc51c0[_0x948d('0x13')])throw new Error(_0x948d('0x15'));var _0x21a0a8=_0xfc51c0['result'];return _0x3d092e(_[_0x948d('0x16')]({},_0x80c01,_0x21a0a8));});})[_0x948d('0x17')](function(_0xfc49f0){_0x44406b(_0xfc49f0);});});}function getRealtimeQueues(_0xb7b1ad,_0x2174ed){return new Promise(function(_0x1eb339,_0x1be540){var _0x2e0275=_0x2174ed===_0x948d('0x18')?amiClient:routingClient;return _0x2e0275[_0x948d('0x10')](_[_0x948d('0x19')](_0x2174ed)+_0x948d('0x1a'),_0xb7b1ad)[_0x948d('0x12')](function(_0xe7eb05){if(_0xe7eb05['error'])throw new Error(util['format'](_0x948d('0x1b'),_0x2174ed));return _0x1eb339(_0xe7eb05['result']);})[_0x948d('0x17')](function(_0x1313e5){_0x1be540(_0x1313e5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x470818,_0x364b1c){return amiClient['request'](_0x948d('0x1c'),{})[_0x948d('0x12')](function(_0x3269f1){if(_0x3269f1[_0x948d('0x13')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x470818(_0x3269f1[_0x948d('0x14')]);})[_0x948d('0x17')](function(_0x175a1a){_0x364b1c(_0x175a1a);});});}function initializeQueues(_0x359127,_0x466c88,_0x5043d9,_0x3436a6){var _0x19b05f=['loggedIn',_0x948d('0x1d'),_0x948d('0x1e'),_0x948d('0x1f'),'paused'];if(_0x5043d9===_0x948d('0x18')&&_0x3436a6===_0x948d('0x20')){_0x19b05f[_0x948d('0x21')](_0x948d('0x22'),'originated','message',_0x948d('0x23'),'dialMethod','Trunk',_0x948d('0x24'),'startProgressive',_0x948d('0x25'),_0x948d('0x26'),_0x948d('0x27'),_0x948d('0x28'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x948d('0x29'),_0x948d('0x2a'),_0x948d('0x2b'),'predictiveIntervalAnsweredCalls',_0x948d('0x2c'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x948d('0x2d'));}return _0x359127[_0x948d('0x2e')](function(_0x1f5f48){var _0x227d81=_0x1f5f48['get']({'plain':!![]});_0x227d81[_0x948d('0x2f')]=[];_0x227d81[_0x948d('0x30')]=0x0;_0x227d81[_0x948d('0x31')]=0x0;_0x227d81['loggedIn']=0x0;_0x227d81['available']=0x0;_0x227d81[_0x948d('0x1e')]=0x0;if(_0x5043d9===_0x948d('0x18')){_0x227d81[_0x948d('0x1f')]=0x0;_0x227d81['busy']=0x0;if(_0x3436a6===_0x948d('0x20')){_0x227d81[_0x948d('0x22')]=0x0;_0x227d81[_0x948d('0x32')]=0x0;}}var _0x3f6533=_['find'](_0x466c88,['id',_0x227d81['id']]);if(_0x3f6533)_[_0x948d('0x16')](_0x227d81,_[_0x948d('0x33')](_0x3f6533,_0x19b05f));return _0x227d81;});}function updateAgentVoiceStatus(_0x5c469b,_0x1af233,_0x101204){var _0x14af4a=_[_0x948d('0x34')](_0x101204,[_0x948d('0x35'),_0x1af233[_0x948d('0xf')]]);if(_0x14af4a[_0x948d('0x36')]===0x0)return _0x5c469b[_0x948d('0x37')]=!![];if(_['some'](_0x14af4a,[_0x948d('0x38'),_0x5c469b[_0x948d('0x39')][_0x948d('0x3a')]()]))return _0x5c469b['talking']=!![];if(!_0x5c469b[_0x948d('0x1f')])return _0x5c469b[_0x948d('0x37')]=!![];}function getVoiceQueueAgents(_0x4e97b0,_0x2ee4a7,_0x5d5656,_0x5666bb){var _0x486e6f=_[_0x948d('0x3b')](_0x2ee4a7,['id',_0x4e97b0['id']]);if(!_0x486e6f)return _0x4e97b0;return _0x486e6f['getMembers']({'raw':!![]})[_0x948d('0x12')](function(_0x4938bf){for(var _0x584319=0x0;_0x584319<_0x4938bf[_0x948d('0x36')];_0x584319++){var _0x270f22=_[_0x948d('0x3b')](_0x5d5656,['id',_0x4938bf[_0x584319][_0x948d('0x3c')]]);if(!_0x270f22){_0x270f22={'id':_0x4938bf[_0x584319][_0x948d('0x3c')],'name':_0x4938bf[_0x584319][_0x948d('0x3c')],'accountcode':'','online':![]};}var _0x1ee7fe={'id':_0x270f22['id'],'name':_0x270f22['name'],'internal':_0x270f22[_0x948d('0x3d')],'online':Boolean(_0x270f22[_0x948d('0x3e')]),'paused':Boolean(_0x4938bf[_0x584319]['paused'])};if(_0x270f22[_0x948d('0x3f')]==='talking')updateAgentVoiceStatus(_0x1ee7fe,_0x4e97b0,_0x5666bb);if(_0x1ee7fe[_0x948d('0x3e')])_0x4e97b0[_0x948d('0x31')]++;if(_0x1ee7fe[_0x948d('0x37')])_0x4e97b0['busy']++;if(_0x1ee7fe[_0x948d('0x30')]&&!_0x1ee7fe[_0x948d('0x37')]&&!_0x1ee7fe[_0x948d('0x1f')])_0x4e97b0[_0x948d('0x30')]++;_0x4e97b0[_0x948d('0x2f')][_0x948d('0x21')](_0x1ee7fe);}return _0x4e97b0;});}function getQueueAgents(_0x46041d,_0x34035b,_0x3fe9de){var _0x5399c6=_0x948d('0x40')+_[_0x948d('0x19')](_0x3fe9de)+_0x948d('0x41');var _0x3754d8=_0x3fe9de+_0x948d('0x42');return db[_0x5399c6][_0x948d('0x43')]({'where':{[_['startCase'](_0x3fe9de)+_0x948d('0x44')]:_0x46041d['id']},'raw':!![]})[_0x948d('0x12')](function(_0x373e08){for(var _0x22779d=0x0;_0x22779d<_0x373e08[_0x948d('0x36')];_0x22779d++){var _0x278161=_['find'](_0x34035b,['id',_0x373e08[_0x22779d][_0x948d('0x3c')]]);if(!_0x278161){_0x278161={'id':_0x373e08[_0x22779d][_0x948d('0x3c')],'name':_0x373e08[_0x22779d][_0x948d('0x3c')],'online':![],['pauseField']:![]};}var _0x5c191f={'id':_0x278161['id'],'name':_0x278161[_0x948d('0xf')],'online':Boolean(_0x278161[_0x948d('0x3e')]),'paused':Boolean(_0x278161[_0x3754d8])};if(_0x5c191f[_0x948d('0x3e')])_0x46041d['loggedInDb']++;_0x46041d['agents']['push'](_0x5c191f);}return _0x46041d;});}exports[_0x948d('0x45')]=function(_0x208f5c,_0x44b5e7){var _0x366ab7=['mail',_0x948d('0x46'),_0x948d('0x47'),_0x948d('0x48'),'fax',_0x948d('0x49'),_0x948d('0x18')];var _0xe49b4d={'count':0x0,'rows':[]},_0x551d2d={},_0x42d576,_0x23937a,_0x477ac0,_0xb881de,_0x31f955;Promise[_0x948d('0x4a')]()['then'](function(){if(_0x208f5c[_0x948d('0x4b')]['channel']){if(!_[_0x948d('0x4c')](_0x366ab7,_0x208f5c[_0x948d('0x4b')][_0x948d('0x4d')][_0x948d('0x4e')]()))throw new Error(_0x948d('0x4f'));_0x42d576=_0x208f5c[_0x948d('0x4b')][_0x948d('0x4d')][_0x948d('0x4e')]();}var _0x2367b3=_[_0x948d('0x19')](_0x42d576)+'Queue';var _0x29ead4=_[_0x948d('0x2e')](db[_0x2367b3][_0x948d('0x50')],function(_0x472655){return{'name':_0x472655[_0x948d('0x51')],'type':_0x472655[_0x948d('0x52')][_0x948d('0x53')]};});_0x551d2d=qs[_0x948d('0x54')](_0x29ead4,_0x208f5c);if(_0x208f5c['user'][_0x948d('0x55')]==='user'){var _0x1fbb68={'params':{'id':_0x208f5c['user'][_0x948d('0x56')]},'query':{'section':_0x42d576==='voice'&&_0x208f5c['query'][_0x948d('0x52')]==='outbound'?_0x948d('0x57'):_[_0x948d('0x19')](_0x42d576)+'Queues','type':_0x208f5c[_0x948d('0x4b')][_0x948d('0x52')],'nolimit':!![],'sort':'name','filter':_0x208f5c[_0x948d('0x4b')][_0x948d('0x34')]}};return db['UserProfile'][_0x948d('0x58')](_0x1fbb68);}return db[_0x2367b3]['findAndCountAll'](_0x551d2d);})[_0x948d('0x12')](function(_0x5829b3){_0xe49b4d[_0x948d('0x59')]=_0x5829b3[_0x948d('0x59')];_0x23937a=_0x5829b3[_0x948d('0x5a')];return getRealtimeQueues(_0x208f5c,_0x42d576);})[_0x948d('0x12')](function(_0x2e302a){_0xb881de=_0x2e302a[_0x948d('0x5a')];return getRealtimeAgents();})[_0x948d('0x12')](function(_0x2c0de8){_0x477ac0=_0x2c0de8['rows'];if(_0x42d576!=_0x948d('0x18'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x4791b9){_0x31f955=_0x4791b9?_0x4791b9[_0x948d('0x5a')]:[];return initializeQueues(_0x23937a,_0xb881de,_0x42d576,_0x208f5c['query'][_0x948d('0x52')]);})[_0x948d('0x12')](function(_0x42d124){var _0x44d6b3=_0x42d124[_0x948d('0x2e')](function(_0x561256){if(_0x42d576===_0x948d('0x18'))return getVoiceQueueAgents(_0x561256,_0x23937a,_0x477ac0,_0x31f955);else return getQueueAgents(_0x561256,_0x477ac0,_0x42d576);});return Promise[_0x948d('0x5b')](_0x44d6b3);})['then'](function(_0x2a79ed){_0xe49b4d['rows']=_0x2a79ed;return _0xe49b4d;})['then'](respondWithFilteredResult(_0x44b5e7,_0x551d2d))[_0x948d('0x17')](handleError(_0x44b5e7,null));}; \ No newline at end of file +var _0x24fe=['talking','outbound','push','pTalking','originated','message','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','agents','paused','loggedInDb','find','merge','pick','filter','queue','length','busy','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','QueueId','getQueues','mail','chat','openchannel','fax','resolve','includes','query','channel','toLowerCase','Invalid\x20channel','map','rawAttributes','fieldName','user','userProfileId','type','QueueCampaigns','Queues','UserProfile','getResources','findAndCountAll','rows','all','util','jayson/promise','../../config/logger','api','../../mysqldb','client','http','undefined','offset','count','status','set','Content-Range','json','error','name','send','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting'];(function(_0x5354f1,_0x4109e5){var _0x22fd1b=function(_0x15d674){while(--_0x15d674){_0x5354f1['push'](_0x5354f1['shift']());}};_0x22fd1b(++_0x4109e5);}(_0x24fe,0x10b));var _0xe24f=function(_0x160c3d,_0x2eb120){_0x160c3d=_0x160c3d-0x0;var _0x4fa3cb=_0x24fe[_0x160c3d];return _0x4fa3cb;};'use strict';var util=require(_0xe24f('0x0'));var _=require('lodash');var jayson=require(_0xe24f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xe24f('0x2'))(_0xe24f('0x3'));var db=require(_0xe24f('0x4'))['db'];var amiClient=jayson[_0xe24f('0x5')][_0xe24f('0x6')]({'port':0x232a});var routingClient=jayson[_0xe24f('0x5')][_0xe24f('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2d19ae,_0x2ca94f){return function(_0x14dac4){if(_0x14dac4){var _0x84be7b=typeof _0x2ca94f['offset']===_0xe24f('0x7')&&typeof _0x2ca94f['limit']===_0xe24f('0x7');var _0x52ce43=_0x14dac4['count'];var _0x5c853d=_0x84be7b?0x0:_0x2ca94f[_0xe24f('0x8')];var _0x182bcc=_0x84be7b?_0x14dac4[_0xe24f('0x9')]:_0x2ca94f['offset']+_0x2ca94f['limit'];var _0x3cbc14;if(_0x182bcc>=_0x52ce43){_0x182bcc=_0x52ce43;_0x3cbc14=0xc8;}else{_0x3cbc14=0xce;}_0x2d19ae[_0xe24f('0xa')](_0x3cbc14);return _0x2d19ae[_0xe24f('0xb')](_0xe24f('0xc'),_0x5c853d+'-'+_0x182bcc+'/'+_0x52ce43)[_0xe24f('0xd')](_0x14dac4);}return null;};}function handleError(_0x41878a,_0x845b6){_0x845b6=_0x845b6||0x1f4;return function(_0x4ed874){logger[_0xe24f('0xe')](_0x4ed874['stack']);if(_0x4ed874[_0xe24f('0xf')]){delete _0x4ed874[_0xe24f('0xf')];}_0x41878a['status'](_0x845b6)[_0xe24f('0x10')](_0x4ed874);};}function getRealtimeAgents(){return new Promise(function(_0x5e03b4,_0x4970a5){return amiClient['request'](_0xe24f('0x11'),{})[_0xe24f('0x12')](function(_0x156b9e){if(_0x156b9e[_0xe24f('0xe')])throw new Error(_0xe24f('0x13'));var _0x42a12b=_0x156b9e[_0xe24f('0x14')];return routingClient[_0xe24f('0x15')](_0xe24f('0x11'),{})['then'](function(_0xe3b800){if(_0xe3b800[_0xe24f('0xe')])throw new Error(_0xe24f('0x16'));var _0xde8979=_0xe3b800[_0xe24f('0x14')];return _0x5e03b4(_['merge']({},_0x42a12b,_0xde8979));});})['catch'](function(_0x3a62a4){_0x4970a5(_0x3a62a4);});});}function getRealtimeQueues(_0x4a972f,_0x1b6fa5){return new Promise(function(_0x5e9a5b,_0x636fee){var _0x139ca7=_0x1b6fa5===_0xe24f('0x17')?amiClient:routingClient;return _0x139ca7[_0xe24f('0x15')](_[_0xe24f('0x18')](_0x1b6fa5)+'Queues',_0x4a972f)[_0xe24f('0x12')](function(_0x2eb6aa){if(_0x2eb6aa[_0xe24f('0xe')])throw new Error(util[_0xe24f('0x19')](_0xe24f('0x1a'),_0x1b6fa5));return _0x5e9a5b(_0x2eb6aa[_0xe24f('0x14')]);})[_0xe24f('0x1b')](function(_0x26a294){_0x636fee(_0x26a294);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1cf950,_0x2dc098){return amiClient[_0xe24f('0x15')](_0xe24f('0x1c'),{})['then'](function(_0x25985f){if(_0x25985f[_0xe24f('0xe')])throw new Error(_0xe24f('0x1d'));return _0x1cf950(_0x25985f[_0xe24f('0x14')]);})['catch'](function(_0x539e84){_0x2dc098(_0x539e84);});});}function initializeQueues(_0x801a08,_0x27bbdc,_0x47becf,_0x275468){var _0x41ad0b=[_0xe24f('0x1e'),_0xe24f('0x1f'),_0xe24f('0x20'),_0xe24f('0x21'),'paused'];if(_0x47becf===_0xe24f('0x17')&&_0x275468===_0xe24f('0x22')){_0x41ad0b[_0xe24f('0x23')](_0xe24f('0x24'),_0xe24f('0x25'),_0xe24f('0x26'),'dialActive','dialMethod','Trunk',_0xe24f('0x27'),_0xe24f('0x28'),_0xe24f('0x29'),_0xe24f('0x2a'),_0xe24f('0x2b'),_0xe24f('0x2c'),_0xe24f('0x2d'),'dialPredictiveIntervalMaxThreshold',_0xe24f('0x2e'),'predictiveIntervalAvailable',_0xe24f('0x2f'),_0xe24f('0x30'),'predictiveIntervalDroppedCallsTimeout',_0xe24f('0x31'),_0xe24f('0x32'),'predictiveIntervalAvgTalktime');}return _0x801a08['map'](function(_0x18a77f){var _0x4845cd=_0x18a77f[_0xe24f('0x33')]({'plain':!![]});_0x4845cd[_0xe24f('0x34')]=[];_0x4845cd[_0xe24f('0x35')]=0x0;_0x4845cd[_0xe24f('0x36')]=0x0;_0x4845cd['loggedIn']=0x0;_0x4845cd['available']=0x0;_0x4845cd[_0xe24f('0x20')]=0x0;if(_0x47becf===_0xe24f('0x17')){_0x4845cd[_0xe24f('0x21')]=0x0;_0x4845cd['busy']=0x0;if(_0x275468===_0xe24f('0x22')){_0x4845cd['pTalking']=0x0;_0x4845cd[_0xe24f('0x25')]=0x0;}}var _0x223ed3=_[_0xe24f('0x37')](_0x27bbdc,['id',_0x4845cd['id']]);if(_0x223ed3)_[_0xe24f('0x38')](_0x4845cd,_[_0xe24f('0x39')](_0x223ed3,_0x41ad0b));return _0x4845cd;});}function updateAgentVoiceStatus(_0x24bc42,_0x589554,_0x4904f7){var _0x1c5439=_[_0xe24f('0x3a')](_0x4904f7,[_0xe24f('0x3b'),_0x589554[_0xe24f('0xf')]]);if(_0x1c5439[_0xe24f('0x3c')]===0x0)return _0x24bc42[_0xe24f('0x3d')]=!![];if(_[_0xe24f('0x3e')](_0x1c5439,[_0xe24f('0x3f'),_0x24bc42[_0xe24f('0x40')][_0xe24f('0x41')]()]))return _0x24bc42[_0xe24f('0x21')]=!![];if(!_0x24bc42[_0xe24f('0x21')])return _0x24bc42[_0xe24f('0x3d')]=!![];}function getVoiceQueueAgents(_0x5f1c73,_0x5a368d,_0x2e22d0,_0x50a7b6){var _0x202280=_[_0xe24f('0x37')](_0x5a368d,['id',_0x5f1c73['id']]);if(!_0x202280)return _0x5f1c73;return _0x202280[_0xe24f('0x42')]({'raw':!![]})[_0xe24f('0x12')](function(_0x2d6f39){for(var _0x1cfda1=0x0;_0x1cfda1<_0x2d6f39[_0xe24f('0x3c')];_0x1cfda1++){var _0x356cba=_['find'](_0x2e22d0,['id',_0x2d6f39[_0x1cfda1][_0xe24f('0x43')]]);if(!_0x356cba){_0x356cba={'id':_0x2d6f39[_0x1cfda1][_0xe24f('0x43')],'name':_0x2d6f39[_0x1cfda1][_0xe24f('0x43')],'accountcode':'','online':![]};}var _0x108895={'id':_0x356cba['id'],'name':_0x356cba[_0xe24f('0xf')],'internal':_0x356cba[_0xe24f('0x44')],'online':Boolean(_0x356cba[_0xe24f('0x45')]),'paused':Boolean(_0x2d6f39[_0x1cfda1][_0xe24f('0x35')])};if(_0x356cba[_0xe24f('0x46')]===_0xe24f('0x21'))updateAgentVoiceStatus(_0x108895,_0x5f1c73,_0x50a7b6);if(_0x108895['online'])_0x5f1c73[_0xe24f('0x36')]++;if(_0x108895[_0xe24f('0x3d')])_0x5f1c73[_0xe24f('0x3d')]++;if(_0x108895[_0xe24f('0x35')]&&!_0x108895[_0xe24f('0x3d')]&&!_0x108895[_0xe24f('0x21')])_0x5f1c73['paused']++;_0x5f1c73[_0xe24f('0x34')]['push'](_0x108895);}return _0x5f1c73;});}function getQueueAgents(_0x4c57e5,_0x3c44d0,_0x3f1e74){var _0x31ddee=_0xe24f('0x47')+_[_0xe24f('0x18')](_0x3f1e74)+_0xe24f('0x48');var _0x26eca7=_0x3f1e74+_0xe24f('0x49');return db[_0x31ddee][_0xe24f('0x4a')]({'where':{[_[_0xe24f('0x18')](_0x3f1e74)+_0xe24f('0x4b')]:_0x4c57e5['id']},'raw':!![]})[_0xe24f('0x12')](function(_0x2f3a9d){for(var _0x1615ef=0x0;_0x1615ef<_0x2f3a9d[_0xe24f('0x3c')];_0x1615ef++){var _0xb39016=_[_0xe24f('0x37')](_0x3c44d0,['id',_0x2f3a9d[_0x1615ef]['UserId']]);if(!_0xb39016){_0xb39016={'id':_0x2f3a9d[_0x1615ef]['UserId'],'name':_0x2f3a9d[_0x1615ef][_0xe24f('0x43')],'online':![],['pauseField']:![]};}var _0x5146c7={'id':_0xb39016['id'],'name':_0xb39016[_0xe24f('0xf')],'online':Boolean(_0xb39016[_0xe24f('0x45')]),'paused':Boolean(_0xb39016[_0x26eca7])};if(_0x5146c7['online'])_0x4c57e5[_0xe24f('0x36')]++;_0x4c57e5['agents'][_0xe24f('0x23')](_0x5146c7);}return _0x4c57e5;});}exports[_0xe24f('0x4c')]=function(_0x846ca9,_0x417623){var _0x1671ac=[_0xe24f('0x4d'),_0xe24f('0x4e'),'sms',_0xe24f('0x4f'),_0xe24f('0x50'),'whatsapp','voice'];var _0x5ed1fb={'count':0x0,'rows':[]},_0x39cd67={},_0x50b13f,_0x29079c,_0x2bc37e,_0x5f7054,_0x383dc5;Promise[_0xe24f('0x51')]()['then'](function(){if(_0x846ca9['query']['channel']){if(!_[_0xe24f('0x52')](_0x1671ac,_0x846ca9[_0xe24f('0x53')][_0xe24f('0x54')][_0xe24f('0x55')]()))throw new Error(_0xe24f('0x56'));_0x50b13f=_0x846ca9[_0xe24f('0x53')]['channel'][_0xe24f('0x55')]();}var _0x2ac282=_[_0xe24f('0x18')](_0x50b13f)+_0xe24f('0x48');var _0x156cfb=_[_0xe24f('0x57')](db[_0x2ac282][_0xe24f('0x58')],function(_0x1f3f9a){return{'name':_0x1f3f9a[_0xe24f('0x59')],'type':_0x1f3f9a['type']['key']};});_0x39cd67=qs['getOptions'](_0x156cfb,_0x846ca9);if(_0x846ca9[_0xe24f('0x5a')]['role']===_0xe24f('0x5a')){var _0x24afb6={'params':{'id':_0x846ca9['user'][_0xe24f('0x5b')]},'query':{'section':_0x50b13f===_0xe24f('0x17')&&_0x846ca9[_0xe24f('0x53')][_0xe24f('0x5c')]===_0xe24f('0x22')?_0xe24f('0x5d'):_[_0xe24f('0x18')](_0x50b13f)+_0xe24f('0x5e'),'type':_0x846ca9['query'][_0xe24f('0x5c')],'nolimit':!![],'sort':_0xe24f('0xf'),'filter':_0x846ca9['query'][_0xe24f('0x3a')]}};return db[_0xe24f('0x5f')][_0xe24f('0x60')](_0x24afb6);}return db[_0x2ac282][_0xe24f('0x61')](_0x39cd67);})[_0xe24f('0x12')](function(_0x9d402d){_0x5ed1fb[_0xe24f('0x9')]=_0x9d402d[_0xe24f('0x9')];_0x29079c=_0x9d402d[_0xe24f('0x62')];return getRealtimeQueues(_0x846ca9,_0x50b13f);})[_0xe24f('0x12')](function(_0x2de16c){_0x5f7054=_0x2de16c[_0xe24f('0x62')];return getRealtimeAgents();})[_0xe24f('0x12')](function(_0x177461){_0x2bc37e=_0x177461['rows'];if(_0x50b13f!=_0xe24f('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0xe24f('0x12')](function(_0x4fbcaa){_0x383dc5=_0x4fbcaa?_0x4fbcaa[_0xe24f('0x62')]:[];return initializeQueues(_0x29079c,_0x5f7054,_0x50b13f,_0x846ca9[_0xe24f('0x53')][_0xe24f('0x5c')]);})['then'](function(_0x3fe80c){var _0x300b75=_0x3fe80c[_0xe24f('0x57')](function(_0x3f3f48){if(_0x50b13f===_0xe24f('0x17'))return getVoiceQueueAgents(_0x3f3f48,_0x29079c,_0x2bc37e,_0x383dc5);else return getQueueAgents(_0x3f3f48,_0x2bc37e,_0x50b13f);});return Promise[_0xe24f('0x63')](_0x300b75);})[_0xe24f('0x12')](function(_0x16182c){_0x5ed1fb[_0xe24f('0x62')]=_0x16182c;return _0x5ed1fb;})[_0xe24f('0x12')](respondWithFilteredResult(_0x417623,_0x39cd67))[_0xe24f('0x1b')](handleError(_0x417623,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dc4b9a2..cf962aa 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x526f32,_0x22a205){var _0x4fe8af=function(_0x2c06f8){while(--_0x2c06f8){_0x526f32['push'](_0x526f32['shift']());}};_0x4fe8af(++_0x22a205);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3973da,_0x3e8345){var _0x455279=function(_0x5efe40){while(--_0x5efe40){_0x3973da['push'](_0x3973da['shift']());}};_0x455279(++_0x3e8345);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 374f98a..c032fad 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 _0x9206=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x218720,_0x543fd4){var _0x363d72=function(_0x3b1983){while(--_0x3b1983){_0x218720['push'](_0x218720['shift']());}};_0x363d72(++_0x543fd4);}(_0x9206,0x176));var _0x6920=function(_0x4eede9,_0x550882){_0x4eede9=_0x4eede9-0x0;var _0x477b17=_0x9206[_0x4eede9];return _0x477b17;};'use strict';var Sequelize=require(_0x6920('0x0'));module[_0x6920('0x1')]={'state':{'type':Sequelize[_0x6920('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6920('0x3')]},'scheduledat':{'type':Sequelize[_0x6920('0x4')]},'uniqueid':{'type':Sequelize[_0x6920('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6920('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6920('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed54=['exports','INTEGER','STRING','DATE'];(function(_0x6ca047,_0x24d941){var _0x23e656=function(_0x3af335){while(--_0x3af335){_0x6ca047['push'](_0x6ca047['shift']());}};_0x23e656(++_0x24d941);}(_0xed54,0xfc));var _0x4ed5=function(_0xa07c97,_0x3fabb6){_0xa07c97=_0xa07c97-0x0;var _0x242cc6=_0xed54[_0xa07c97];return _0x242cc6;};'use strict';var Sequelize=require('sequelize');module[_0x4ed5('0x0')]={'state':{'type':Sequelize[_0x4ed5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4ed5('0x2')]},'scheduledat':{'type':Sequelize[_0x4ed5('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4ed5('0x3')]},'responsetime':{'type':Sequelize[_0x4ed5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4ed5('0x2')]},'membername':{'type':Sequelize[_0x4ed5('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 135ba1c..c8879f7 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 _0x433d=['moment','request-promise','../../config/environment','exports','ReportAgentPreview','lodash','util','../../config/logger'];(function(_0x5e414b,_0x45d9b0){var _0x1af19b=function(_0x29ce55){while(--_0x29ce55){_0x5e414b['push'](_0x5e414b['shift']());}};_0x1af19b(++_0x45d9b0);}(_0x433d,0xa5));var _0xd433=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x433d[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0xd433('0x0'));var util=require(_0xd433('0x1'));var logger=require(_0xd433('0x2'))('api');var moment=require(_0xd433('0x3'));var BPromise=require('bluebird');var rp=require(_0xd433('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd433('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0xd433('0x6')]=function(_0x983e44,_0x4bb67e){return _0x983e44['define'](_0xd433('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe358=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','ReportAgentPreview','lodash'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0xe358,0x19d));var _0x8e35=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xe358[_0x41382c];return _0x4da35b;};'use strict';var _=require(_0x8e35('0x0'));var util=require('util');var logger=require(_0x8e35('0x1'))(_0x8e35('0x2'));var moment=require('moment');var BPromise=require(_0x8e35('0x3'));var rp=require(_0x8e35('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e35('0x5'));var config=require(_0x8e35('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x8e35('0x7')]=function(_0x246e34,_0x404fdb){return _0x246e34['define'](_0x8e35('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 8736da8..b85ffa9 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 _0x1dae=['result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x461d00,_0x45153e){var _0x2310f4=function(_0x482317){while(--_0x482317){_0x461d00['push'](_0x461d00['shift']());}};_0x2310f4(++_0x45153e);}(_0x1dae,0x16f));var _0xe1da=function(_0x19bbf6,_0x42a143){_0x19bbf6=_0x19bbf6-0x0;var _0x531a26=_0x1dae[_0x19bbf6];return _0x531a26;};'use strict';var _=require(_0xe1da('0x0'));var util=require(_0xe1da('0x1'));var moment=require('moment');var BPromise=require(_0xe1da('0x2'));var rs=require(_0xe1da('0x3'));var fs=require('fs');var Redis=require(_0xe1da('0x4'));var db=require(_0xe1da('0x5'))['db'];var utils=require(_0xe1da('0x6'));var logger=require('../../config/logger')(_0xe1da('0x7'));var config=require(_0xe1da('0x8'));var jayson=require(_0xe1da('0x9'));var client=jayson[_0xe1da('0xa')][_0xe1da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bc785,_0xb1e9c6,_0x345095){return new BPromise(function(_0x2db8dd,_0x7b15f5){return client[_0xe1da('0xc')](_0x4bc785,_0x345095)[_0xe1da('0xd')](function(_0x4abdaa){logger[_0xe1da('0xe')](_0xe1da('0xf'),_0xb1e9c6,_0xe1da('0x10'));logger[_0xe1da('0x11')](_0xe1da('0x12'),_0xb1e9c6,_0xe1da('0x10'),JSON[_0xe1da('0x13')](_0x4abdaa));if(_0x4abdaa[_0xe1da('0x14')]){if(_0x4abdaa[_0xe1da('0x14')][_0xe1da('0x15')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xb1e9c6,_0x4abdaa[_0xe1da('0x14')][_0xe1da('0x16')]);return _0x7b15f5(_0x4abdaa[_0xe1da('0x14')][_0xe1da('0x16')]);}logger[_0xe1da('0x14')](_0xe1da('0xf'),_0xb1e9c6,_0x4abdaa[_0xe1da('0x14')][_0xe1da('0x16')]);return _0x2db8dd(_0x4abdaa[_0xe1da('0x14')]['message']);}else{logger[_0xe1da('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0xb1e9c6,_0xe1da('0x10'));_0x2db8dd(_0x4abdaa[_0xe1da('0x17')]['message']);}})[_0xe1da('0x18')](function(_0x46168a){logger[_0xe1da('0x14')](_0xe1da('0xf'),_0xb1e9c6,_0x46168a);_0x7b15f5(_0x46168a);});});}exports[_0xe1da('0x19')]=function(_0x512392){var _0x1a0fa0=this;return new Promise(function(_0x14401e,_0x539a64){return db[_0xe1da('0x1a')][_0xe1da('0x1b')](_0x512392['body'],{'raw':_0x512392[_0xe1da('0x1c')]?_0x512392[_0xe1da('0x1c')][_0xe1da('0x1d')]===undefined?!![]:![]:!![]})[_0xe1da('0xd')](function(_0x4f0ae5){logger[_0xe1da('0xe')](_0xe1da('0x19'),_0x512392);logger[_0xe1da('0x11')]('CreateReportAgentPreview',_0x512392,JSON['stringify'](_0x4f0ae5));_0x14401e(_0x4f0ae5);})[_0xe1da('0x18')](function(_0x482a1e){logger[_0xe1da('0x14')]('CreateReportAgentPreview',_0x482a1e[_0xe1da('0x16')],_0x512392);_0x539a64(_0x1a0fa0[_0xe1da('0x14')](0x1f4,_0x482a1e[_0xe1da('0x16')]));});});}; \ No newline at end of file +var _0x7240=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x27e633,_0x43f7bb){var _0x4110ad=function(_0x3e41f8){while(--_0x3e41f8){_0x27e633['push'](_0x27e633['shift']());}};_0x4110ad(++_0x43f7bb);}(_0x7240,0xc7));var _0x0724=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x7240[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x0724('0x0'));var util=require(_0x0724('0x1'));var moment=require(_0x0724('0x2'));var BPromise=require(_0x0724('0x3'));var rs=require(_0x0724('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0724('0x5'))['db'];var utils=require(_0x0724('0x6'));var logger=require(_0x0724('0x7'))(_0x0724('0x8'));var config=require(_0x0724('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0724('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443381,_0xdc8811,_0x681adb){return new BPromise(function(_0x43db95,_0x3271cf){return client[_0x0724('0xb')](_0x443381,_0x681adb)[_0x0724('0xc')](function(_0x2481b2){logger[_0x0724('0xd')](_0x0724('0xe'),_0xdc8811,_0x0724('0xf'));logger[_0x0724('0x10')](_0x0724('0x11'),_0xdc8811,_0x0724('0xf'),JSON['stringify'](_0x2481b2));if(_0x2481b2[_0x0724('0x12')]){if(_0x2481b2[_0x0724('0x12')][_0x0724('0x13')]===0x1f4){logger[_0x0724('0x12')](_0x0724('0xe'),_0xdc8811,_0x2481b2[_0x0724('0x12')][_0x0724('0x14')]);return _0x3271cf(_0x2481b2[_0x0724('0x12')]['message']);}logger[_0x0724('0x12')](_0x0724('0xe'),_0xdc8811,_0x2481b2['error'][_0x0724('0x14')]);return _0x43db95(_0x2481b2[_0x0724('0x12')]['message']);}else{logger[_0x0724('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xdc8811,_0x0724('0xf'));_0x43db95(_0x2481b2[_0x0724('0x15')][_0x0724('0x14')]);}})[_0x0724('0x16')](function(_0x24b361){logger[_0x0724('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xdc8811,_0x24b361);_0x3271cf(_0x24b361);});});}exports[_0x0724('0x17')]=function(_0x4fe863){var _0x1b3fd9=this;return new Promise(function(_0x55288c,_0x369c4e){return db[_0x0724('0x18')][_0x0724('0x19')](_0x4fe863[_0x0724('0x1a')],{'raw':_0x4fe863[_0x0724('0x1b')]?_0x4fe863[_0x0724('0x1b')][_0x0724('0x1c')]===undefined?!![]:![]:!![]})[_0x0724('0xc')](function(_0x220065){logger[_0x0724('0xd')](_0x0724('0x17'),_0x4fe863);logger[_0x0724('0x10')](_0x0724('0x17'),_0x4fe863,JSON[_0x0724('0x1d')](_0x220065));_0x55288c(_0x220065);})[_0x0724('0x16')](function(_0x2ba6ef){logger[_0x0724('0x12')]('CreateReportAgentPreview',_0x2ba6ef[_0x0724('0x14')],_0x4fe863);_0x369c4e(_0x1b3fd9['error'](0x1f4,_0x2ba6ef[_0x0724('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a351246..87fb351 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 _0xf63b=['/chat/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','agents','put','/agents/:id/capacity','telephones','/trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0xf63b,0xd2));var _0xbf63=function(_0xf282ff,_0x16798e){_0xf282ff=_0xf282ff-0x0;var _0x2e3fe4=_0xf63b[_0xf282ff];return _0x2e3fe4;};'use strict';var multer=require(_0xbf63('0x0'));var util=require(_0xbf63('0x1'));var path=require(_0xbf63('0x2'));var express=require(_0xbf63('0x3'));var router=express[_0xbf63('0x4')]();var auth=require(_0xbf63('0x5'));var controller=require('./rpc.controller');router[_0xbf63('0x6')](_0xbf63('0x7'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x9')]);router[_0xbf63('0x6')](_0xbf63('0xa'),auth[_0xbf63('0x8')](),controller[_0xbf63('0xb')]);router[_0xbf63('0x6')](_0xbf63('0xc'),auth[_0xbf63('0x8')](),controller[_0xbf63('0xd')]);router[_0xbf63('0x6')](_0xbf63('0xe'),auth[_0xbf63('0x8')](),controller['voiceQueues']);router[_0xbf63('0x6')](_0xbf63('0xf'),auth[_0xbf63('0x8')](),controller['chatQueues']);router['get']('/mail/queues',auth[_0xbf63('0x8')](),controller['mailQueues']);router[_0xbf63('0x6')](_0xbf63('0x10'),auth[_0xbf63('0x8')](),controller['mailAccounts']);router[_0xbf63('0x6')](_0xbf63('0x11'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x12')]);router['get'](_0xbf63('0x13'),auth[_0xbf63('0x8')](),controller['smsQueues']);router[_0xbf63('0x6')](_0xbf63('0x14'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x15')]);router[_0xbf63('0x6')]('/fax/queues',auth[_0xbf63('0x8')](),controller[_0xbf63('0x16')]);router['get'](_0xbf63('0x17'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x18')]);router['get']('/voice/queues/channels',auth[_0xbf63('0x8')](),controller[_0xbf63('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xbf63('0x1a')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xbf63('0x1b')]);router[_0xbf63('0x6')](_0xbf63('0x1c'),auth['isAuthenticated'](),controller[_0xbf63('0x1d')]);router[_0xbf63('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xbf63('0x1e')]);router['put'](_0xbf63('0x1f'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x20')]);router[_0xbf63('0x6')](_0xbf63('0x21'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x22')]);router['get']('/outbound/channels',auth[_0xbf63('0x8')](),controller['outboundChannels']);router['get']('/agents',auth[_0xbf63('0x8')](),controller[_0xbf63('0x23')]);router[_0xbf63('0x24')](_0xbf63('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xbf63('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0xbf63('0x26')]);router[_0xbf63('0x6')](_0xbf63('0x27'),auth[_0xbf63('0x8')](),controller['trunks']);router[_0xbf63('0x6')](_0xbf63('0x28'),auth['isAuthenticated'](),controller['campaigns']);router[_0xbf63('0x6')]('/fax/accounts',auth[_0xbf63('0x8')](),controller[_0xbf63('0x29')]);router[_0xbf63('0x6')](_0xbf63('0x2a'),auth['isAuthenticated'](),controller[_0xbf63('0x2b')]);router['get'](_0xbf63('0x2c'),auth[_0xbf63('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xbf63('0x6')](_0xbf63('0x2d'),auth[_0xbf63('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xbf63('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xbf63('0x8')](),controller[_0xbf63('0x2e')]);router[_0xbf63('0x6')]('/sms/queues/waitinginteractions',auth[_0xbf63('0x8')](),controller[_0xbf63('0x2f')]);router[_0xbf63('0x6')](_0xbf63('0x30'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x31')]);router['get'](_0xbf63('0x32'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x33')]);router[_0xbf63('0x34')](_0xbf63('0x35'),auth['isAuthenticated'](),controller[_0xbf63('0x36')](_0xbf63('0x37')));router[_0xbf63('0x6')](_0xbf63('0x38'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x39')]);router[_0xbf63('0x34')](_0xbf63('0x3a'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x36')](_0xbf63('0x3b')));router[_0xbf63('0x6')](_0xbf63('0x3c'),auth[_0xbf63('0x8')](),controller['showChatQueues']);router[_0xbf63('0x34')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xbf63('0x3d')));router[_0xbf63('0x6')](_0xbf63('0x3e'),auth[_0xbf63('0x8')](),controller['showFaxQueues']);router['post'](_0xbf63('0x3f'),auth['isAuthenticated'](),controller[_0xbf63('0x36')](_0xbf63('0x40')));router[_0xbf63('0x6')](_0xbf63('0x41'),auth[_0xbf63('0x8')](),controller['showOpenchannelQueues']);router['post'](_0xbf63('0x42'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x36')](_0xbf63('0x43')));router[_0xbf63('0x34')](_0xbf63('0x44'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x36')](_0xbf63('0x45')));router['get'](_0xbf63('0x46'),auth[_0xbf63('0x8')](),controller['showSmsQueues']);router['get'](_0xbf63('0x47'),auth[_0xbf63('0x8')](),controller['showWhatsappQueues']);router['post'](_0xbf63('0x48'),auth[_0xbf63('0x8')](),controller[_0xbf63('0x49')]);module[_0xbf63('0x4a')]=router; \ No newline at end of file +var _0xfe37=['/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','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','multer','util','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','isAuthenticated','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xfe37,0xe5));var _0x7fe3=function(_0x4e0242,_0x16dd06){_0x4e0242=_0x4e0242-0x0;var _0x3a2eed=_0xfe37[_0x4e0242];return _0x3a2eed;};'use strict';var multer=require(_0x7fe3('0x0'));var util=require(_0x7fe3('0x1'));var path=require('path');var express=require('express');var router=express[_0x7fe3('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x7fe3('0x3'));router[_0x7fe3('0x4')](_0x7fe3('0x5'),auth['isAuthenticated'](),controller[_0x7fe3('0x6')]);router[_0x7fe3('0x4')](_0x7fe3('0x7'),auth['isAuthenticated'](),controller[_0x7fe3('0x8')]);router[_0x7fe3('0x4')](_0x7fe3('0x9'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x7fe3('0x4')](_0x7fe3('0xa'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x7fe3('0x4')](_0x7fe3('0xb'),auth['isAuthenticated'](),controller[_0x7fe3('0xc')]);router[_0x7fe3('0x4')](_0x7fe3('0xd'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0xf')]);router[_0x7fe3('0x4')](_0x7fe3('0x10'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x11')]);router[_0x7fe3('0x4')](_0x7fe3('0x12'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x13')]);router[_0x7fe3('0x4')](_0x7fe3('0x14'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x15')]);router[_0x7fe3('0x4')]('/whatsapp/queues',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x16')]);router[_0x7fe3('0x4')](_0x7fe3('0x17'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x18')]);router['get'](_0x7fe3('0x19'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x7fe3('0x4')](_0x7fe3('0x1a'),auth['isAuthenticated'](),controller[_0x7fe3('0x1b')]);router[_0x7fe3('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x7fe3('0xe')](),controller['voiceQueuesChannel']);router['get'](_0x7fe3('0x1c'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x1d')]);router['get'](_0x7fe3('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x7fe3('0x4')](_0x7fe3('0x1f'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x20')]);router[_0x7fe3('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x7fe3('0x22')]);router[_0x7fe3('0x4')]('/outbound',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x23')]);router[_0x7fe3('0x4')](_0x7fe3('0x24'),auth['isAuthenticated'](),controller[_0x7fe3('0x25')]);router[_0x7fe3('0x4')](_0x7fe3('0x26'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x27')]);router[_0x7fe3('0x21')](_0x7fe3('0x28'),auth['isAuthenticated'](),controller[_0x7fe3('0x29')]);router[_0x7fe3('0x4')]('/telephones',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x2a')]);router[_0x7fe3('0x4')](_0x7fe3('0x2b'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x2c')]);router['get'](_0x7fe3('0x2d'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x2e')]);router[_0x7fe3('0x4')](_0x7fe3('0x2f'),auth[_0x7fe3('0xe')](),controller['faxAccounts']);router[_0x7fe3('0x4')](_0x7fe3('0x30'),auth['isAuthenticated'](),controller[_0x7fe3('0x31')]);router['get'](_0x7fe3('0x32'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x33')]);router[_0x7fe3('0x4')](_0x7fe3('0x34'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x35')]);router[_0x7fe3('0x4')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x7fe3('0x36')]);router[_0x7fe3('0x4')](_0x7fe3('0x37'),auth['isAuthenticated'](),controller[_0x7fe3('0x38')]);router[_0x7fe3('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x39')]);router['get'](_0x7fe3('0x3a'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x3b')]);router[_0x7fe3('0x3c')](_0x7fe3('0x3d'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x3e')](_0x7fe3('0x3f')));router['get'](_0x7fe3('0x40'),auth[_0x7fe3('0xe')](),controller['showMailQueues']);router[_0x7fe3('0x3c')](_0x7fe3('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0x7fe3('0x42')));router[_0x7fe3('0x4')](_0x7fe3('0x43'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x44')]);router[_0x7fe3('0x3c')]('/fax/queues/:id/notify',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x3e')](_0x7fe3('0x45')));router['get']('/fax/queues/:id',auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x46')]);router[_0x7fe3('0x3c')](_0x7fe3('0x47'),auth['isAuthenticated'](),controller[_0x7fe3('0x3e')](_0x7fe3('0x48')));router['get'](_0x7fe3('0x49'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x4a')]);router[_0x7fe3('0x3c')](_0x7fe3('0x4b'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x3e')](_0x7fe3('0x4c')));router['post'](_0x7fe3('0x4d'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x3e')](_0x7fe3('0x4e')));router['get'](_0x7fe3('0x4f'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x50')]);router[_0x7fe3('0x4')](_0x7fe3('0x51'),auth[_0x7fe3('0xe')](),controller[_0x7fe3('0x52')]);router['post'](_0x7fe3('0x53'),auth[_0x7fe3('0xe')](),controller['agentNotify']);module[_0x7fe3('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1b0728a..1c0c605 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 _0x425d=['http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','query','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns','ChatQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client'];(function(_0x356816,_0x4f043f){var _0x333425=function(_0x424b67){while(--_0x424b67){_0x356816['push'](_0x356816['shift']());}};_0x333425(++_0x4f043f);}(_0x425d,0x1e0));var _0xd425=function(_0x460352,_0x4ad275){_0x460352=_0x460352-0x0;var _0x207524=_0x425d[_0x460352];return _0x207524;};'use strict';var BPromise=require(_0xd425('0x0'));var moment=require('moment');var _=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var db=require(_0xd425('0x3'))['db'];var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var jayson=require(_0xd425('0x6'));var amiClient=jayson[_0xd425('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232b});var routingClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){var _0x262b02=_0x50b061?_0x50b061:amiClient;return _0x262b02[_0xd425('0x9')](_0x1d97d9,_0x1d2ed0)[_0xd425('0xa')](function(_0x2beb20){if(_0x2beb20[_0xd425('0xb')]){if(_0x2beb20[_0xd425('0xb')][_0xd425('0xc')]===0x1f4){return _0x374c3d(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}return _0xb6ba8e(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}else{_0xb6ba8e(_0x2beb20[_0xd425('0xe')]);}})[_0xd425('0xf')](function(_0x2385a5){_0x374c3d(_0x2385a5);});});}function respondWithResult(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xc8;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x10')](_0x3cacf7)['json'](_0x3b5de8);}return _0x9bb611[_0xd425('0x11')](0x194);};}function handleError(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0x1f4;return function(_0x5d3d60){logger[_0xd425('0xb')](_0x5d3d60[_0xd425('0x12')]);if(_0x5d3d60[_0xd425('0x13')]){delete _0x5d3d60[_0xd425('0x13')];}_0x17a498[_0xd425('0x10')](_0x336dc3)['send'](_0x5d3d60);};}function findById(_0x278626){return function(_0x471267){if(!_[_0xd425('0x14')](_0x278626)&&!_[_0xd425('0x14')](_0x471267)&&!_['isNil'](_0x471267[_0xd425('0x15')])){return _[_0xd425('0x16')](_0x471267[_0xd425('0x15')],function(_0x1155bc){return _0x1155bc['id']==_0x278626;});}return null;};}exports['voiceChannels']=function(_0x58a0c1,_0x5debc3){return respondWithRpcPromise('VoiceChannels',_0x58a0c1[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x5debc3,null))[_0xd425('0xf')](handleError(_0x5debc3,null));};exports['voiceChannelMixMonitor']=function(_0x355af0,_0x7e982e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd425('0x18')](_0x355af0[_0xd425('0x17')],_0x355af0[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x7e982e,null))[_0xd425('0xf')](handleError(_0x7e982e,null));};exports[_0xd425('0x1a')]=function(_0x2480a0,_0x3500bb){return respondWithRpcPromise(_0xd425('0x1b'),_[_0xd425('0x18')](_0x2480a0[_0xd425('0x17')],_0x2480a0[_0xd425('0x19')]))['then'](respondWithResult(_0x3500bb,null))[_0xd425('0xf')](handleError(_0x3500bb,null));};exports[_0xd425('0x1c')]=function(_0x398985,_0x1908a5){return respondWithRpcPromise(_0xd425('0x1d'),_0x398985[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x1908a5,null))['catch'](handleError(_0x1908a5,null));};exports[_0xd425('0x1e')]=function(_0x177de2,_0x1d8861){return respondWithRpcPromise('VoiceQueues',_0x177de2[_0xd425('0x17')])[_0xd425('0xa')](findById(_0x177de2[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x1d8861,null))[_0xd425('0xf')](handleError(_0x1d8861,null));};exports[_0xd425('0x1f')]=function(_0x2fd17a,_0x37b63c){return respondWithRpcPromise(_0xd425('0x20'),_[_0xd425('0x18')](_0x2fd17a['body'],_0x2fd17a[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x37b63c,null))[_0xd425('0xf')](handleError(_0x37b63c,null));};exports[_0xd425('0x21')]=function(_0x3275b1,_0x1abf33){return respondWithRpcPromise(_0xd425('0x22'),_[_0xd425('0x18')](_0x3275b1[_0xd425('0x17')],_0x3275b1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x1abf33,null))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x23')]=function(_0x2a2a9b,_0x3120a4){return respondWithRpcPromise(_0xd425('0x24'),_0x2a2a9b[_0xd425('0x17')])['then'](respondWithResult(_0x3120a4,null))[_0xd425('0xf')](handleError(_0x3120a4,null));};exports[_0xd425('0x25')]=function(_0x4cfcd1,_0x574962){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd425('0x18')](_0x4cfcd1[_0xd425('0x17')],_0x4cfcd1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x574962,null))['catch'](handleError(_0x574962,null));};exports[_0xd425('0x26')]=function(_0x1d4414,_0x30a9dc){return respondWithRpcPromise(_0xd425('0x27'),_[_0xd425('0x18')](_0x1d4414[_0xd425('0x17')],_0x1d4414[_0xd425('0x19')]))['then'](respondWithResult(_0x30a9dc,null))[_0xd425('0xf')](handleError(_0x30a9dc,null));};exports['voiceQueuesChannelRedirect']=function(_0x22df81,_0x29cca9){return respondWithRpcPromise(_0xd425('0x28'),_['merge'](_0x22df81[_0xd425('0x17')],_0x22df81[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x29cca9,null))[_0xd425('0xf')](handleError(_0x29cca9,null));};exports['outbound']=function(_0x1d38fa,_0x3cf540){return respondWithRpcPromise('Outbound',_0x1d38fa['query'])['then'](respondWithResult(_0x3cf540,null))[_0xd425('0xf')](handleError(_0x3cf540,null));};exports[_0xd425('0x29')]=function(_0x1f30c1,_0x588688){return respondWithRpcPromise('OutboundChannels',_0x1f30c1['query'])[_0xd425('0xa')](respondWithResult(_0x588688,null))[_0xd425('0xf')](handleError(_0x588688,null));};exports[_0xd425('0x2a')]=function(_0x1d5017,_0xa9fd7c){var _0x14f3be;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'])[_0xd425('0xa')](function(_0x3c88a8){_0x14f3be=_0x3c88a8;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'],routingClient);})[_0xd425('0xa')](function(_0x2dffc7){return _[_0xd425('0x18')]({},_0x2dffc7,_0x14f3be);})['then'](respondWithResult(_0xa9fd7c,null))[_0xd425('0xf')](handleError(_0xa9fd7c,null));};exports[_0xd425('0x2c')]=function(_0x1c5ba6,_0x2d7a2f){if(_0x1c5ba6['body']&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]&&_0x1c5ba6[_0xd425('0x2f')]&&_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]){for(var _0x2f6bf7 in _0x1c5ba6[_0xd425('0x2d')]['interaction']){if(_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]['hasOwnProperty'](_0x2f6bf7)){db[_0xd425('0x30')]['findAll']({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6['user'][_0xd425('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c5ba6[_0xd425('0x2d')]['interaction'][_0x2f6bf7]&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')]?{'$notIn':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7]}:{'$ne':null}}})['then'](function(_0x2e4b21){var _0x5f3cfd=moment()[_0xd425('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x78ed9b=0x0,_0x16f61c=_0x2e4b21[_0xd425('0x31')];_0x78ed9b<_0x16f61c;_0x78ed9b+=0x1){_0x2e4b21[_0x78ed9b][_0xd425('0x33')]({'exitAt':_0x5f3cfd});}});for(var _0x624543=0x0;_0x624543<_0x1c5ba6['body'][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')];_0x624543+=0x1){db[_0xd425('0x30')][_0xd425('0x34')]({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')]['name'],'type':_0xd425('0x35'),'uniqueid':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0x624543],'exitAt':null},'defaults':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')],'interface':_[_0xd425('0x14')](_0x1c5ba6['user'][_0xd425('0x36')])?util[_0xd425('0x32')]('SIP/%s',_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]):_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x36')],'type':'INTERACTION','enterAt':moment()[_0xd425('0x32')](_0xd425('0x37')),'role':_0xd425('0x38'),'internal':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x39')],'uniqueid':_0x1c5ba6['body']['interaction'][_0x2f6bf7][_0x624543]}});}}}}return respondWithRpcPromise(_0xd425('0x3a'),{'id':_0x1c5ba6['params']['id'],'capacity':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x3b')]},routingClient)['then'](respondWithResult(_0x2d7a2f,null))[_0xd425('0xf')](handleError(_0x2d7a2f,null));};exports['telephones']=function(_0x48d5b8,_0x39f588){return respondWithRpcPromise(_0xd425('0x3c'),_0x48d5b8[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x39f588,null))[_0xd425('0xf')](handleError(_0x39f588,null));};exports[_0xd425('0x3d')]=function(_0xeb3586,_0x4118fe){return respondWithRpcPromise('Trunks',_0xeb3586[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x4118fe,null))[_0xd425('0xf')](handleError(_0x4118fe,null));};exports[_0xd425('0x3e')]=function(_0x7b1080,_0x1c80c2){return respondWithRpcPromise(_0xd425('0x3f'),_0x7b1080[_0xd425('0x17')])['then'](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['chatQueues']=function(_0x145e76,_0x2c5d01){return respondWithRpcPromise(_0xd425('0x40'),_0x145e76[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x2c5d01,null))['catch'](handleError(_0x2c5d01,null));};exports['showChatQueues']=function(_0x5e1294,_0x254b8b){return respondWithRpcPromise(_0xd425('0x40'),_0x5e1294['query'],routingClient)[_0xd425('0xa')](findById(_0x5e1294[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x254b8b,null))['catch'](handleError(_0x254b8b,null));};exports['mailQueues']=function(_0x599cb5,_0x49d75e){return respondWithRpcPromise('MailQueues',_0x599cb5['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x49d75e,null))[_0xd425('0xf')](handleError(_0x49d75e,null));};exports[_0xd425('0x41')]=function(_0x5b2323,_0x3395d8){return respondWithRpcPromise('MailQueues',_0x5b2323[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5b2323[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x3395d8,null))[_0xd425('0xf')](handleError(_0x3395d8,null));};exports[_0xd425('0x42')]=function(_0xa21f7c,_0x3ca6a6){return respondWithRpcPromise(_0xd425('0x43'),_0xa21f7c['query'],mailClient)[_0xd425('0xa')](respondWithResult(_0x3ca6a6,null))[_0xd425('0xf')](handleError(_0x3ca6a6,null));};exports[_0xd425('0x44')]=function(_0xf22906,_0x5c4df8){return respondWithRpcPromise('OpenchannelQueues',_0xf22906[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5c4df8,null))[_0xd425('0xf')](handleError(_0x5c4df8,null));};exports[_0xd425('0x45')]=function(_0x464ed1,_0x2e0f00){return respondWithRpcPromise(_0xd425('0x46'),_0x464ed1[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x464ed1[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x2e0f00,null))[_0xd425('0xf')](handleError(_0x2e0f00,null));};exports[_0xd425('0x47')]=function(_0x28979e,_0x5e72db){return respondWithRpcPromise(_0xd425('0x48'),_0x28979e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5e72db,null))['catch'](handleError(_0x5e72db,null));};exports['showSmsQueues']=function(_0x5ade1a,_0x403cb3){return respondWithRpcPromise(_0xd425('0x48'),_0x5ade1a[_0xd425('0x17')],routingClient)['then'](findById(_0x5ade1a[_0xd425('0x19')]['id']))['then'](respondWithResult(_0x403cb3,null))[_0xd425('0xf')](handleError(_0x403cb3,null));};exports[_0xd425('0x49')]=function(_0x21d26e,_0x5113fc){return respondWithRpcPromise(_0xd425('0x4a'),_0x21d26e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5113fc,null))[_0xd425('0xf')](handleError(_0x5113fc,null));};exports[_0xd425('0x4b')]=function(_0x43b1a9,_0x38a762){return respondWithRpcPromise(_0xd425('0x4a'),_0x43b1a9[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x43b1a9[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x38a762,null))[_0xd425('0xf')](handleError(_0x38a762,null));};exports[_0xd425('0x4c')]=function(_0x445f98,_0x443126){return respondWithRpcPromise(_0xd425('0x4d'),_0x445f98[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};exports[_0xd425('0x4e')]=function(_0x5c333a,_0x135048){return respondWithRpcPromise(_0xd425('0x4d'),_0x5c333a[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5c333a['params']['id']))[_0xd425('0xa')](respondWithResult(_0x135048,null))[_0xd425('0xf')](handleError(_0x135048,null));};exports[_0xd425('0x4f')]=function(_0x689332,_0x2536bd){return respondWithRpcPromise(_0xd425('0x50'),_0x689332['query'])['then'](respondWithResult(_0x2536bd,null))[_0xd425('0xf')](handleError(_0x2536bd,null));};exports[_0xd425('0x51')]=function(_0x5e76f5,_0x174081){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e76f5[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x174081,null))[_0xd425('0xf')](handleError(_0x174081,null));};exports[_0xd425('0x52')]=function(_0x376134,_0x2514fa){return respondWithRpcPromise(_0xd425('0x53'),_0x376134['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x2514fa,null))[_0xd425('0xf')](handleError(_0x2514fa,null));};exports[_0xd425('0x54')]=function(_0x233efa,_0xfcba08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x233efa[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0xfcba08,null))['catch'](handleError(_0xfcba08,null));};exports[_0xd425('0x55')]=function(_0x4599b0,_0x48bed3){return respondWithRpcPromise(_0xd425('0x56'),_0x4599b0[_0xd425('0x17')],routingClient)[_0xd425('0xa')](function(_0xd923bb){if(_0x4599b0[_0xd425('0x17')]['type']!==undefined){var _0x454cce=_(_0xd923bb['rows'])[_0xd425('0x57')]([_0x4599b0[_0xd425('0x17')]['type'],_0x4599b0[_0xd425('0x19')]['id']])[_0xd425('0x58')](_0xd425('0x59'))[_0xd425('0x5a')]()['value']();return _0xd923bb['rows'][_0xd425('0x57')](function(_0x2312c1){return _0x454cce[_0xd425('0x5b')](_0x2312c1['queue_id'])>-0x1;});}else{return _0xd923bb[_0xd425('0x15')][_0xd425('0x57')](function(_0x5b932c){return _0x5b932c[_0xd425('0x59')]===parseInt(_0x4599b0['params']['id']);});}})[_0xd425('0xa')](respondWithResult(_0x48bed3,null))[_0xd425('0xf')](handleError(_0x48bed3,null));};exports[_0xd425('0x5c')]=function(_0x2493e7,_0x5750dc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2493e7[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5750dc,null))['catch'](handleError(_0x5750dc,null));};exports[_0xd425('0x5d')]=function(_0x389099,_0x51c9ad){return respondWithRpcPromise(_0xd425('0x5e'),_0x389099[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x51c9ad,null))[_0xd425('0xf')](handleError(_0x51c9ad,null));};exports[_0xd425('0x5f')]=function(_0xf251e6,_0x302066){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xf251e6['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x302066,null))['catch'](handleError(_0x302066,null));};exports[_0xd425('0x60')]=function(_0x236030){return function(_0x58cad5,_0x244789){var _0x1c1c77,_0x5dac05;var _0x592c40=_[_0xd425('0x61')](_0x236030);var _0x242ed8=_0x236030===_0xd425('0x62')?_0xd425('0x63'):_0xd425('0x64');return db[_0x592c40+_0xd425('0x65')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x58cad5[_0xd425('0x19')]['id']}})['then'](function(_0x2cff42){if(_[_0xd425('0x14')](_0x2cff42)){throw new Error(_0x592c40+'\x20Queue\x20not\x20found');}_0x1c1c77=_0x2cff42;return db[_0x592c40+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x58cad5[_0xd425('0x2d')][_0xd425('0x68')]},'include':[{'model':db[_0x592c40+_0xd425('0x69')],'as':_0xd425('0x69')},{'model':db[_0x592c40+_0x242ed8],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0x334062){if(_[_0xd425('0x14')](_0x334062)){throw new Error(_0x592c40+_0xd425('0x6a'));}_0x5dac05=_0x334062;return _0x334062['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd425('0xa')](function(){var _0x498e81={'uniqueid':_0x236030+'.'+_0x5dac05['id']+'.'+_0x5dac05['Interaction']['id'],'FromUserId':_0x58cad5[_0xd425('0x2f')]['id'],'type':'queue'};_0x498e81[_0x592c40+_0xd425('0x6b')]=_0x5dac05['id'];_0x498e81[_0x592c40+_0xd425('0x6c')]=_0x5dac05[_0xd425('0x69')]['id'];_0x498e81[_0xd425('0x6d')+_0x592c40+_0x242ed8+'Id']=_0x5dac05[_0xd425('0x64')]['id'];_0x498e81['To'+_0x592c40+_0xd425('0x6e')]=_0x1c1c77['id'];return db[_0x592c40+_0xd425('0x6f')]['create'](_0x498e81);})[_0xd425('0xa')](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x236030,'interaction':_0x5dac05[_0xd425('0x69')],'message':_0x5dac05,'account':_0x5dac05[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x71'),'appdata':_0x1c1c77['name']+','+(_0x5dac05[_0xd425('0x64')][_0xd425('0x72')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})[_0xd425('0xa')](respondWithResult(_0x244789,null))[_0xd425('0xf')](handleError(_0x244789,null));};};exports[_0xd425('0x74')]=function(_0x409612,_0x4147eb){var _0x433e5d,_0x334226;if(_[_0xd425('0x14')](_0x409612[_0xd425('0x2d')]['channel'])){throw new Error(_0xd425('0x75'));}var _0x5d8a47=_0x409612[_0xd425('0x2d')][_0xd425('0x76')];var _0x1c03d6=_[_0xd425('0x61')](_0x5d8a47);var _0xf06395=_0x5d8a47==='chat'?_0xd425('0x63'):_0xd425('0x64');return db[_0xd425('0x77')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x409612[_0xd425('0x19')]['id'],'role':_0xd425('0x38')}})[_0xd425('0xa')](function(_0x568a83){if(_[_0xd425('0x14')](_0x568a83)){throw new Error('Agent\x20not\x20found');}_0x433e5d=_0x568a83;return db[_0x1c03d6+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x409612['body'][_0xd425('0x68')]},'include':[{'model':db[_0x1c03d6+_0xd425('0x69')],'as':'Interaction'},{'model':db[_0x1c03d6+_0xf06395],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0xca2955){if(_[_0xd425('0x14')](_0xca2955)){throw new Error(_0x1c03d6+_0xd425('0x6a'));}_0x334226=_0xca2955;return _0xca2955[_0xd425('0x78')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3f1a48={'uniqueid':_0x5d8a47+'.'+_0x334226['id']+'.'+_0x334226['Interaction']['id'],'FromUserId':_0x409612[_0xd425('0x2f')]['id'],'type':'queue','ToUserId':_0x433e5d['id']};_0x3f1a48[_0x1c03d6+_0xd425('0x6b')]=_0x334226['id'];_0x3f1a48[_0x1c03d6+_0xd425('0x6c')]=_0x334226[_0xd425('0x69')]['id'];_0x3f1a48[_0xd425('0x6d')+_0x1c03d6+_0xf06395+'Id']=_0x334226['Account']['id'];return db[_0x1c03d6+'TransferReport']['create'](_0x3f1a48);})['then'](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x5d8a47,'interaction':_0x334226['Interaction'],'message':_0x334226,'account':_0x334226[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x38'),'appdata':_0x433e5d[_0xd425('0x13')]+','+(_0x334226[_0xd425('0x64')][_0xd425('0x79')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})['then'](respondWithResult(_0x4147eb,null))[_0xd425('0xf')](handleError(_0x4147eb,null));}; \ No newline at end of file +var _0x55ca=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','agentNotify','channel','Website','User','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','../../config/logger','api','client','http','request','error','code','message','result','catch','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','params','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions'];(function(_0x515f78,_0x3b69be){var _0x506f6c=function(_0x14da41){while(--_0x14da41){_0x515f78['push'](_0x515f78['shift']());}};_0x506f6c(++_0x3b69be);}(_0x55ca,0x126));var _0xa55c=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x55ca[_0x13ac10];return _0x28eda2;};'use strict';var BPromise=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0xa55c('0x2'))(_0xa55c('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232a});var mailClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232b});var routingClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){var _0x291996=_0x2121fd?_0x2121fd:amiClient;return _0x291996[_0xa55c('0x6')](_0x36b623,_0x4d0624)['then'](function(_0x5849ad){if(_0x5849ad[_0xa55c('0x7')]){if(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x8')]===0x1f4){return _0x57e069(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}return _0x2537f0(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}else{_0x2537f0(_0x5849ad[_0xa55c('0xa')]);}})[_0xa55c('0xb')](function(_0x15eec8){_0x57e069(_0x15eec8);});});}function respondWithResult(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xc8;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['status'](_0x59d84a)['json'](_0x2a35be);}return _0x5d47ff['sendStatus'](0x194);};}function handleError(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0x1f4;return function(_0x462cd6){logger[_0xa55c('0x7')](_0x462cd6[_0xa55c('0xc')]);if(_0x462cd6[_0xa55c('0xd')]){delete _0x462cd6['name'];}_0x18ee85[_0xa55c('0xe')](_0x3930e4)[_0xa55c('0xf')](_0x462cd6);};}function findById(_0x25934f){return function(_0x31e10d){if(!_[_0xa55c('0x10')](_0x25934f)&&!_[_0xa55c('0x10')](_0x31e10d)&&!_[_0xa55c('0x10')](_0x31e10d[_0xa55c('0x11')])){return _[_0xa55c('0x12')](_0x31e10d['rows'],function(_0x3d4c9e){return _0x3d4c9e['id']==_0x25934f;});}return null;};}exports[_0xa55c('0x13')]=function(_0x461284,_0x358b61){return respondWithRpcPromise(_0xa55c('0x14'),_0x461284[_0xa55c('0x15')])['then'](respondWithResult(_0x358b61,null))['catch'](handleError(_0x358b61,null));};exports[_0xa55c('0x16')]=function(_0x3776ac,_0xade4c4){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa55c('0x17')](_0x3776ac[_0xa55c('0x15')],_0x3776ac['params']))[_0xa55c('0x18')](respondWithResult(_0xade4c4,null))[_0xa55c('0xb')](handleError(_0xade4c4,null));};exports[_0xa55c('0x19')]=function(_0x1965f1,_0x234372){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa55c('0x17')](_0x1965f1['query'],_0x1965f1['params']))['then'](respondWithResult(_0x234372,null))[_0xa55c('0xb')](handleError(_0x234372,null));};exports['voiceQueues']=function(_0x3ecbe7,_0x190757){return respondWithRpcPromise(_0xa55c('0x1a'),_0x3ecbe7[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x190757,null))[_0xa55c('0xb')](handleError(_0x190757,null));};exports[_0xa55c('0x1b')]=function(_0x11e7f7,_0x192df2){return respondWithRpcPromise(_0xa55c('0x1a'),_0x11e7f7[_0xa55c('0x15')])['then'](findById(_0x11e7f7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x192df2,null))[_0xa55c('0xb')](handleError(_0x192df2,null));};exports[_0xa55c('0x1d')]=function(_0x5d940d,_0x1377b0){return respondWithRpcPromise(_0xa55c('0x1e'),_[_0xa55c('0x17')](_0x5d940d[_0xa55c('0x1f')],_0x5d940d[_0xa55c('0x1c')]))[_0xa55c('0x18')](respondWithResult(_0x1377b0,null))['catch'](handleError(_0x1377b0,null));};exports[_0xa55c('0x20')]=function(_0x490b7d,_0x35c9c2){return respondWithRpcPromise(_0xa55c('0x21'),_[_0xa55c('0x17')](_0x490b7d[_0xa55c('0x15')],_0x490b7d['params']))[_0xa55c('0x18')](respondWithResult(_0x35c9c2,null))[_0xa55c('0xb')](handleError(_0x35c9c2,null));};exports[_0xa55c('0x22')]=function(_0x20da31,_0x10f4b7){return respondWithRpcPromise(_0xa55c('0x23'),_0x20da31[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x10f4b7,null))[_0xa55c('0xb')](handleError(_0x10f4b7,null));};exports[_0xa55c('0x24')]=function(_0x197099,_0x4eb7c4){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xa55c('0x17')](_0x197099[_0xa55c('0x15')],_0x197099['params']))[_0xa55c('0x18')](respondWithResult(_0x4eb7c4,null))[_0xa55c('0xb')](handleError(_0x4eb7c4,null));};exports[_0xa55c('0x25')]=function(_0x1839ac,_0x30d4f8){return respondWithRpcPromise(_0xa55c('0x26'),_[_0xa55c('0x17')](_0x1839ac[_0xa55c('0x15')],_0x1839ac[_0xa55c('0x1c')]))['then'](respondWithResult(_0x30d4f8,null))['catch'](handleError(_0x30d4f8,null));};exports['voiceQueuesChannelRedirect']=function(_0x3fd75f,_0x18e00e){return respondWithRpcPromise(_0xa55c('0x27'),_['merge'](_0x3fd75f[_0xa55c('0x15')],_0x3fd75f['params']))[_0xa55c('0x18')](respondWithResult(_0x18e00e,null))['catch'](handleError(_0x18e00e,null));};exports[_0xa55c('0x28')]=function(_0x39267c,_0x3c0ec1){return respondWithRpcPromise('Outbound',_0x39267c[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x3c0ec1,null))['catch'](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x29')]=function(_0x194e78,_0x4d9083){return respondWithRpcPromise('OutboundChannels',_0x194e78[_0xa55c('0x15')])['then'](respondWithResult(_0x4d9083,null))[_0xa55c('0xb')](handleError(_0x4d9083,null));};exports[_0xa55c('0x2a')]=function(_0x5427bf,_0x542d76){var _0x5e50b6;return respondWithRpcPromise('Agents',_0x5427bf[_0xa55c('0x15')])[_0xa55c('0x18')](function(_0x429336){_0x5e50b6=_0x429336;return respondWithRpcPromise(_0xa55c('0x2b'),_0x5427bf[_0xa55c('0x15')],routingClient);})['then'](function(_0x3d52d8){return _[_0xa55c('0x17')]({},_0x3d52d8,_0x5e50b6);})[_0xa55c('0x18')](respondWithResult(_0x542d76,null))[_0xa55c('0xb')](handleError(_0x542d76,null));};exports[_0xa55c('0x2c')]=function(_0x23cef5,_0x554620){if(_0x23cef5[_0xa55c('0x1f')]&&_0x23cef5['body']['interaction']&&_0x23cef5[_0xa55c('0x2d')]&&_0x23cef5[_0xa55c('0x2d')]['name']){for(var _0x2bd98b in _0x23cef5['body']['interaction']){if(_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0xa55c('0x2f')](_0x2bd98b)){db['MemberReport'][_0xa55c('0x30')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')]['name'],'type':_0xa55c('0x31'),'exitAt':null,'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b]&&_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b][_0xa55c('0x32')]?{'$notIn':_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b]}:{'$ne':null}}})[_0xa55c('0x18')](function(_0x187e09){var _0x204767=moment()['format'](_0xa55c('0x33'));for(var _0x582901=0x0,_0x2f9717=_0x187e09[_0xa55c('0x32')];_0x582901<_0x2f9717;_0x582901+=0x1){_0x187e09[_0x582901][_0xa55c('0x34')]({'exitAt':_0x204767});}});for(var _0x51d663=0x0;_0x51d663<_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b]['length'];_0x51d663+=0x1){db[_0xa55c('0x35')][_0xa55c('0x36')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5['user'][_0xa55c('0xd')],'type':_0xa55c('0x31'),'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b][_0x51d663],'exitAt':null},'defaults':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')],'interface':_[_0xa55c('0x10')](_0x23cef5['user'][_0xa55c('0x37')])?util['format'](_0xa55c('0x38'),_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')]):_0x23cef5['user'][_0xa55c('0x37')],'type':_0xa55c('0x31'),'enterAt':moment()['format'](_0xa55c('0x33')),'role':_0xa55c('0x39'),'internal':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0x3a')],'uniqueid':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b][_0x51d663]}});}}}}return respondWithRpcPromise(_0xa55c('0x3b'),{'id':_0x23cef5[_0xa55c('0x1c')]['id'],'capacity':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x3c')]},routingClient)['then'](respondWithResult(_0x554620,null))[_0xa55c('0xb')](handleError(_0x554620,null));};exports[_0xa55c('0x3d')]=function(_0x216de8,_0x4f73b6){return respondWithRpcPromise(_0xa55c('0x3e'),_0x216de8[_0xa55c('0x15')])['then'](respondWithResult(_0x4f73b6,null))[_0xa55c('0xb')](handleError(_0x4f73b6,null));};exports['trunks']=function(_0x2b6a0e,_0x228df4){return respondWithRpcPromise(_0xa55c('0x3f'),_0x2b6a0e[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x228df4,null))['catch'](handleError(_0x228df4,null));};exports[_0xa55c('0x40')]=function(_0x4607ca,_0x4b85cc){return respondWithRpcPromise(_0xa55c('0x41'),_0x4607ca[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4b85cc,null))[_0xa55c('0xb')](handleError(_0x4b85cc,null));};exports['chatQueues']=function(_0x4def35,_0x267965){return respondWithRpcPromise(_0xa55c('0x42'),_0x4def35[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x267965,null))['catch'](handleError(_0x267965,null));};exports[_0xa55c('0x43')]=function(_0x5ce463,_0x2742e4){return respondWithRpcPromise(_0xa55c('0x42'),_0x5ce463[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x5ce463[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x2742e4,null))[_0xa55c('0xb')](handleError(_0x2742e4,null));};exports['mailQueues']=function(_0x23f67f,_0x157afe){return respondWithRpcPromise(_0xa55c('0x44'),_0x23f67f[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x157afe,null))[_0xa55c('0xb')](handleError(_0x157afe,null));};exports[_0xa55c('0x45')]=function(_0x53e2be,_0x450567){return respondWithRpcPromise(_0xa55c('0x44'),_0x53e2be[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x53e2be[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x450567,null))[_0xa55c('0xb')](handleError(_0x450567,null));};exports[_0xa55c('0x46')]=function(_0x28bac4,_0x20e53c){return respondWithRpcPromise(_0xa55c('0x47'),_0x28bac4['query'],mailClient)[_0xa55c('0x18')](respondWithResult(_0x20e53c,null))[_0xa55c('0xb')](handleError(_0x20e53c,null));};exports[_0xa55c('0x48')]=function(_0x16d9b2,_0x3ba56d){return respondWithRpcPromise('OpenchannelQueues',_0x16d9b2[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x3ba56d,null))[_0xa55c('0xb')](handleError(_0x3ba56d,null));};exports['showOpenchannelQueues']=function(_0x3495a7,_0x5a8897){return respondWithRpcPromise(_0xa55c('0x49'),_0x3495a7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x3495a7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x5a8897,null))[_0xa55c('0xb')](handleError(_0x5a8897,null));};exports[_0xa55c('0x4a')]=function(_0x2f2226,_0x14b515){return respondWithRpcPromise(_0xa55c('0x4b'),_0x2f2226['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14b515,null))[_0xa55c('0xb')](handleError(_0x14b515,null));};exports['showSmsQueues']=function(_0x18b928,_0x2b8b88){return respondWithRpcPromise(_0xa55c('0x4b'),_0x18b928[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x18b928[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x2b8b88,null))[_0xa55c('0xb')](handleError(_0x2b8b88,null));};exports['whatsappQueues']=function(_0x1dfaf7,_0x475131){return respondWithRpcPromise(_0xa55c('0x4c'),_0x1dfaf7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x475131,null))[_0xa55c('0xb')](handleError(_0x475131,null));};exports[_0xa55c('0x4d')]=function(_0x4249c1,_0x25d5a1){return respondWithRpcPromise('WhatsappQueues',_0x4249c1[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x4249c1[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x25d5a1,null))[_0xa55c('0xb')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x4e')]=function(_0x3ea755,_0x3606b2){return respondWithRpcPromise(_0xa55c('0x4f'),_0x3ea755[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x3606b2,null))['catch'](handleError(_0x3606b2,null));};exports[_0xa55c('0x50')]=function(_0x531eee,_0x1228a4){return respondWithRpcPromise(_0xa55c('0x4f'),_0x531eee[_0xa55c('0x15')],routingClient)['then'](findById(_0x531eee['params']['id']))[_0xa55c('0x18')](respondWithResult(_0x1228a4,null))[_0xa55c('0xb')](handleError(_0x1228a4,null));};exports[_0xa55c('0x51')]=function(_0x42529f,_0x4c7ee1){return respondWithRpcPromise(_0xa55c('0x52'),_0x42529f[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4c7ee1,null))[_0xa55c('0xb')](handleError(_0x4c7ee1,null));};exports[_0xa55c('0x53')]=function(_0x500968,_0x4b090c){return respondWithRpcPromise(_0xa55c('0x54'),_0x500968[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x4b090c,null))[_0xa55c('0xb')](handleError(_0x4b090c,null));};exports[_0xa55c('0x55')]=function(_0x4b2032,_0x14febc){return respondWithRpcPromise(_0xa55c('0x56'),_0x4b2032['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14febc,null))[_0xa55c('0xb')](handleError(_0x14febc,null));};exports[_0xa55c('0x57')]=function(_0x4dcb93,_0x1521d5){return respondWithRpcPromise(_0xa55c('0x58'),_0x4dcb93[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x1521d5,null))[_0xa55c('0xb')](handleError(_0x1521d5,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x25bd5b,_0x2e2cf6){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x25bd5b['query'],routingClient)[_0xa55c('0x18')](function(_0x4e1cbd){if(_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')]!==undefined){var _0x2f13db=_(_0x4e1cbd[_0xa55c('0x11')])[_0xa55c('0x5a')]([_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')],_0x25bd5b[_0xa55c('0x1c')]['id']])[_0xa55c('0x5b')]('queue_id')[_0xa55c('0x5c')]()[_0xa55c('0x5d')]();return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x4f0a26){return _0x2f13db[_0xa55c('0x5e')](_0x4f0a26[_0xa55c('0x5f')])>-0x1;});}else{return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x5d766e){return _0x5d766e['queue_id']===parseInt(_0x25bd5b[_0xa55c('0x1c')]['id']);});}})[_0xa55c('0x18')](respondWithResult(_0x2e2cf6,null))[_0xa55c('0xb')](handleError(_0x2e2cf6,null));};exports[_0xa55c('0x60')]=function(_0x5e87cb,_0x55ee0d){return respondWithRpcPromise(_0xa55c('0x61'),_0x5e87cb[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x55ee0d,null))[_0xa55c('0xb')](handleError(_0x55ee0d,null));};exports[_0xa55c('0x62')]=function(_0x346060,_0x239269){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x346060[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x239269,null))[_0xa55c('0xb')](handleError(_0x239269,null));};exports['faxQueuesWaitingInteractions']=function(_0x36ded7,_0x313cdc){return respondWithRpcPromise(_0xa55c('0x63'),_0x36ded7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x313cdc,null))[_0xa55c('0xb')](handleError(_0x313cdc,null));};exports[_0xa55c('0x64')]=function(_0x2c71ca){return function(_0x576a1b,_0x59414d){var _0x14cb74,_0x2948b1;var _0xc2ad5c=_[_0xa55c('0x65')](_0x2c71ca);var _0x1622cb=_0x2c71ca===_0xa55c('0x66')?'Website':_0xa55c('0x67');return db[_0xc2ad5c+_0xa55c('0x68')][_0xa55c('0x69')]({'raw':!![],'where':{'id':_0x576a1b[_0xa55c('0x1c')]['id']}})[_0xa55c('0x18')](function(_0x3b1cd7){if(_[_0xa55c('0x10')](_0x3b1cd7)){throw new Error(_0xc2ad5c+_0xa55c('0x6a'));}_0x14cb74=_0x3b1cd7;return db[_0xc2ad5c+'Message'][_0xa55c('0x69')]({'where':{'id':_0x576a1b[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0xc2ad5c+_0xa55c('0x6c')],'as':_0xa55c('0x6c')},{'model':db[_0xc2ad5c+_0x1622cb],'as':'Account'}]});})[_0xa55c('0x18')](function(_0x2ab1f2){if(_['isNil'](_0x2ab1f2)){throw new Error(_0xc2ad5c+'\x20Message\x20not\x20found');}_0x2948b1=_0x2ab1f2;return _0x2ab1f2[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa55c('0x18')](function(){var _0x5c2229={'uniqueid':_0x2c71ca+'.'+_0x2948b1['id']+'.'+_0x2948b1['Interaction']['id'],'FromUserId':_0x576a1b['user']['id'],'type':'queue'};_0x5c2229[_0xc2ad5c+_0xa55c('0x6e')]=_0x2948b1['id'];_0x5c2229[_0xc2ad5c+_0xa55c('0x6f')]=_0x2948b1[_0xa55c('0x6c')]['id'];_0x5c2229[_0xa55c('0x70')+_0xc2ad5c+_0x1622cb+'Id']=_0x2948b1[_0xa55c('0x67')]['id'];_0x5c2229['To'+_0xc2ad5c+_0xa55c('0x71')]=_0x14cb74['id'];return db[_0xc2ad5c+'TransferReport'][_0xa55c('0x72')](_0x5c2229);})[_0xa55c('0x18')](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x2c71ca,'interaction':_0x2948b1[_0xa55c('0x6c')],'message':_0x2948b1,'account':_0x2948b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x74'),'appdata':_0x14cb74[_0xa55c('0xd')]+','+(_0x2948b1[_0xa55c('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})['then'](respondWithResult(_0x59414d,null))['catch'](handleError(_0x59414d,null));};};exports[_0xa55c('0x76')]=function(_0x413b45,_0x1e298d){var _0x249b0c,_0x2544c1;if(_[_0xa55c('0x10')](_0x413b45[_0xa55c('0x1f')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x71bd0d=_0x413b45[_0xa55c('0x1f')][_0xa55c('0x77')];var _0x1f4bc8=_[_0xa55c('0x65')](_0x71bd0d);var _0x2a0805=_0x71bd0d===_0xa55c('0x66')?_0xa55c('0x78'):_0xa55c('0x67');return db[_0xa55c('0x79')]['findOne']({'raw':!![],'where':{'id':_0x413b45[_0xa55c('0x1c')]['id'],'role':_0xa55c('0x39')}})['then'](function(_0xb9708){if(_['isNil'](_0xb9708)){throw new Error(_0xa55c('0x7a'));}_0x249b0c=_0xb9708;return db[_0x1f4bc8+_0xa55c('0x7b')][_0xa55c('0x69')]({'where':{'id':_0x413b45[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0x1f4bc8+'Interaction'],'as':_0xa55c('0x6c')},{'model':db[_0x1f4bc8+_0x2a0805],'as':_0xa55c('0x67')}]});})[_0xa55c('0x18')](function(_0x376c1f){if(_[_0xa55c('0x10')](_0x376c1f)){throw new Error(_0x1f4bc8+_0xa55c('0x7c'));}_0x2544c1=_0x376c1f;return _0x376c1f[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x49a307={'uniqueid':_0x71bd0d+'.'+_0x2544c1['id']+'.'+_0x2544c1['Interaction']['id'],'FromUserId':_0x413b45[_0xa55c('0x2d')]['id'],'type':'queue','ToUserId':_0x249b0c['id']};_0x49a307[_0x1f4bc8+_0xa55c('0x6e')]=_0x2544c1['id'];_0x49a307[_0x1f4bc8+_0xa55c('0x6f')]=_0x2544c1[_0xa55c('0x6c')]['id'];_0x49a307[_0xa55c('0x70')+_0x1f4bc8+_0x2a0805+'Id']=_0x2544c1[_0xa55c('0x67')]['id'];return db[_0x1f4bc8+'TransferReport'][_0xa55c('0x72')](_0x49a307);})['then'](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x71bd0d,'interaction':_0x2544c1[_0xa55c('0x6c')],'message':_0x2544c1,'account':_0x2544c1[_0xa55c('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x39'),'appdata':_0x249b0c['name']+','+(_0x2544c1[_0xa55c('0x67')][_0xa55c('0x7d')]||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})[_0xa55c('0x18')](respondWithResult(_0x1e298d,null))[_0xa55c('0xb')](handleError(_0x1e298d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index dc2d7b8..399d254 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 _0x56f6=['../../config/environment','get','isAuthenticated','show','/:id/run','run','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4748d1,_0x49d5dd){var _0x5082db=function(_0x846a49){while(--_0x846a49){_0x4748d1['push'](_0x4748d1['shift']());}};_0x5082db(++_0x49d5dd);}(_0x56f6,0x133));var _0x656f=function(_0xc8d904,_0x5ccc90){_0xc8d904=_0xc8d904-0x0;var _0x31412b=_0x56f6[_0xc8d904];return _0x31412b;};'use strict';var multer=require(_0x656f('0x0'));var util=require('util');var path=require(_0x656f('0x1'));var timeout=require(_0x656f('0x2'));var express=require(_0x656f('0x3'));var router=express[_0x656f('0x4')]();var fs_extra=require(_0x656f('0x5'));var auth=require(_0x656f('0x6'));var interaction=require(_0x656f('0x7'));var config=require(_0x656f('0x8'));var controller=require('./schedule.controller');router[_0x656f('0x9')]('/',auth[_0x656f('0xa')](),controller['index']);router[_0x656f('0x9')]('/:id',auth[_0x656f('0xa')](),controller[_0x656f('0xb')]);router['get'](_0x656f('0xc'),auth[_0x656f('0xa')](),controller[_0x656f('0xd')]);router[_0x656f('0xe')]('/',auth[_0x656f('0xa')](),controller[_0x656f('0xf')]);router['put'](_0x656f('0x10'),auth[_0x656f('0xa')](),controller[_0x656f('0x11')]);router[_0x656f('0x12')]('/:id',auth[_0x656f('0xa')](),controller[_0x656f('0x13')]);module[_0x656f('0x14')]=router; \ No newline at end of file +var _0x04f0=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','index','get','/:id','isAuthenticated','show','/:id/run','run','post','create','put','destroy','exports','multer','util','path'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x04f0,0xb1));var _0x004f=function(_0x3b8730,_0x52de55){_0x3b8730=_0x3b8730-0x0;var _0x429444=_0x04f0[_0x3b8730];return _0x429444;};'use strict';var multer=require(_0x004f('0x0'));var util=require(_0x004f('0x1'));var path=require(_0x004f('0x2'));var timeout=require(_0x004f('0x3'));var express=require('express');var router=express[_0x004f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x004f('0x5'));var interaction=require(_0x004f('0x6'));var config=require('../../config/environment');var controller=require(_0x004f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x004f('0x8')]);router[_0x004f('0x9')](_0x004f('0xa'),auth[_0x004f('0xb')](),controller[_0x004f('0xc')]);router['get'](_0x004f('0xd'),auth[_0x004f('0xb')](),controller[_0x004f('0xe')]);router[_0x004f('0xf')]('/',auth[_0x004f('0xb')](),controller[_0x004f('0x10')]);router[_0x004f('0x11')](_0x004f('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x004f('0x12')]);module[_0x004f('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a53eca2..8d682ed 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 _0x1b75=['custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','days','hours','minutes','csv','pdf','xlsx'];(function(_0x55e683,_0x38d576){var _0xc90953=function(_0x413de4){while(--_0x413de4){_0x55e683['push'](_0x55e683['shift']());}};_0xc90953(++_0x38d576);}(_0x1b75,0xed));var _0x51b7=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x1b75[_0x296144];return _0x5329b1;};'use strict';var Sequelize=require(_0x51b7('0x0'));module[_0x51b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x51b7('0x2')]},'active':{'type':Sequelize[_0x51b7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x51b7('0x4')},'startAt':{'type':Sequelize[_0x51b7('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x51b7('0x6')](_0x51b7('0x7'),_0x51b7('0x8'),'months','weeks',_0x51b7('0x9'),_0x51b7('0xa'),_0x51b7('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x51b7('0x6')](_0x51b7('0xc'),_0x51b7('0xd'),_0x51b7('0xe')),'allowNull':![],'defaultValue':_0x51b7('0xc')},'type':{'type':Sequelize[_0x51b7('0x6')](_0x51b7('0xf'),_0x51b7('0x10')),'allowNull':![],'defaultValue':_0x51b7('0xf')},'sendMail':{'type':Sequelize[_0x51b7('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x51b7('0x11')]},'bcc':{'type':Sequelize[_0x51b7('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x51b7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf0e1=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','minutes','pdf','xlsx','csv','custom','default','TEXT','exports'];(function(_0x164671,_0x27362a){var _0x2d74a2=function(_0x3b4bd2){while(--_0x3b4bd2){_0x164671['push'](_0x164671['shift']());}};_0x2d74a2(++_0x27362a);}(_0xf0e1,0xfb));var _0x1f0e=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0xf0e1[_0x471a85];return _0x5f2039;};'use strict';var Sequelize=require('sequelize');module[_0x1f0e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1f0e('0x1')]},'active':{'type':Sequelize[_0x1f0e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1f0e('0x1')],'allowNull':![],'defaultValue':_0x1f0e('0x3')},'startAt':{'type':Sequelize[_0x1f0e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1f0e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1f0e('0x6')](_0x1f0e('0x7'),_0x1f0e('0x8'),'months',_0x1f0e('0x9'),_0x1f0e('0xa'),'hours',_0x1f0e('0xb')),'allowNull':![],'defaultValue':_0x1f0e('0xa')},'output':{'type':Sequelize[_0x1f0e('0x6')]('csv',_0x1f0e('0xc'),_0x1f0e('0xd')),'allowNull':![],'defaultValue':_0x1f0e('0xe')},'type':{'type':Sequelize[_0x1f0e('0x6')](_0x1f0e('0xf'),_0x1f0e('0x10')),'allowNull':![],'defaultValue':_0x1f0e('0xf')},'sendMail':{'type':Sequelize[_0x1f0e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1f0e('0x1')]},'cc':{'type':Sequelize[_0x1f0e('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x1f0e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 15fad57..357ec29 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 _0xe3c3=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Scheduler','then','sendStatus','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x250278,_0x392868){var _0x2049dc=function(_0x219f38){while(--_0x219f38){_0x250278['push'](_0x250278['shift']());}};_0x2049dc(++_0x392868);}(_0xe3c3,0x148));var _0x3e3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe3c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e3c('0x0'));var zipdir=require(_0x3e3c('0x1'));var jsonpatch=require(_0x3e3c('0x2'));var rp=require(_0x3e3c('0x3'));var moment=require('moment');var BPromise=require(_0x3e3c('0x4'));var Mustache=require(_0x3e3c('0x5'));var util=require(_0x3e3c('0x6'));var path=require('path');var sox=require(_0x3e3c('0x7'));var csv=require(_0x3e3c('0x8'));var ejs=require(_0x3e3c('0x9'));var fs=require('fs');var fs_extra=require(_0x3e3c('0xa'));var _=require('lodash');var squel=require(_0x3e3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e3c('0xc'));var deskjs=require(_0x3e3c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3e3c('0xe'));var Papa=require('papaparse');var Redis=require(_0x3e3c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3e3c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e3c('0x11'))(_0x3e3c('0x12'));var utils=require('../../config/utils');var config=require(_0x3e3c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e3c('0x14'))['db'];function respondWithStatusCode(_0x592887,_0x25f3d1){_0x25f3d1=_0x25f3d1||0xcc;return function(_0x49fa6b){if(_0x49fa6b){return _0x592887['sendStatus'](_0x25f3d1);}return _0x592887[_0x3e3c('0x15')](_0x25f3d1)['end']();};}function respondWithResult(_0x1ea3e1,_0x1e7626){_0x1e7626=_0x1e7626||0xc8;return function(_0x308942){if(_0x308942){return _0x1ea3e1['status'](_0x1e7626)[_0x3e3c('0x16')](_0x308942);}};}function respondWithFilteredResult(_0x923fe8,_0x571fd0){return function(_0x554452){if(_0x554452){var _0x45d98c=typeof _0x571fd0['offset']===_0x3e3c('0x17')&&typeof _0x571fd0[_0x3e3c('0x18')]===_0x3e3c('0x17');var _0x45c9cf=_0x554452[_0x3e3c('0x19')];var _0x195634=_0x45d98c?0x0:_0x571fd0['offset'];var _0x45de8c=_0x45d98c?_0x554452[_0x3e3c('0x19')]:_0x571fd0[_0x3e3c('0x1a')]+_0x571fd0[_0x3e3c('0x18')];var _0x1b6757;if(_0x45de8c>=_0x45c9cf){_0x45de8c=_0x45c9cf;_0x1b6757=0xc8;}else{_0x1b6757=0xce;}_0x923fe8[_0x3e3c('0x15')](_0x1b6757);return _0x923fe8[_0x3e3c('0x1b')](_0x3e3c('0x1c'),_0x195634+'-'+_0x45de8c+'/'+_0x45c9cf)[_0x3e3c('0x16')](_0x554452);}return null;};}function patchUpdates(_0x1222b2){return function(_0xf726ae){try{jsonpatch[_0x3e3c('0x1d')](_0xf726ae,_0x1222b2,!![]);}catch(_0x503282){return BPromise[_0x3e3c('0x1e')](_0x503282);}return _0xf726ae[_0x3e3c('0x1f')]();};}function saveUpdates(_0x59a7ea,_0x26d183){return function(_0x52590e){if(_0x52590e){return _0x52590e[_0x3e3c('0x20')](_0x59a7ea)['then'](function(_0x400c34){return _0x400c34;});}return null;};}function removeEntity(_0x17a7fa,_0x30c5f5){return function(_0x1a0b42){if(_0x1a0b42){return _0x1a0b42[_0x3e3c('0x21')]()['then'](function(){var _0x2d9688=_0x1a0b42[_0x3e3c('0x22')]({'plain':!![]});var _0x55da8b=_0x3e3c('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x55da8b,'resourceId':_0x2d9688['id']}})['then'](function(){return _0x1a0b42;});})[_0x3e3c('0x24')](function(){_0x17a7fa[_0x3e3c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x362162,_0x6236f3){return function(_0x40ca71){if(!_0x40ca71){_0x362162[_0x3e3c('0x25')](0x194);}return _0x40ca71;};}function handleError(_0x652ec0,_0x6ee7da){_0x6ee7da=_0x6ee7da||0x1f4;return function(_0x40606d){logger['error'](_0x40606d['stack']);if(_0x40606d['name']){delete _0x40606d[_0x3e3c('0x26')];}_0x652ec0[_0x3e3c('0x15')](_0x6ee7da)[_0x3e3c('0x27')](_0x40606d);};}exports[_0x3e3c('0x28')]=function(_0x2fa2bb,_0x21f914){var _0x2b2e81={},_0x4f3de3={},_0x219b44={'count':0x0,'rows':[]};var _0x4cd0a2=_[_0x3e3c('0x29')](db[_0x3e3c('0x2a')][_0x3e3c('0x2b')],function(_0x59d333){return{'name':_0x59d333[_0x3e3c('0x2c')],'type':_0x59d333['type'][_0x3e3c('0x2d')]};});_0x4f3de3[_0x3e3c('0x2e')]=_[_0x3e3c('0x29')](_0x4cd0a2,_0x3e3c('0x26'));_0x4f3de3['query']=_[_0x3e3c('0x2f')](_0x2fa2bb['query']);_0x4f3de3['filters']=_['intersection'](_0x4f3de3[_0x3e3c('0x2e')],_0x4f3de3[_0x3e3c('0x30')]);_0x2b2e81[_0x3e3c('0x31')]=_[_0x3e3c('0x32')](_0x4f3de3[_0x3e3c('0x2e')],qs[_0x3e3c('0x33')](_0x2fa2bb[_0x3e3c('0x30')][_0x3e3c('0x33')]));_0x2b2e81[_0x3e3c('0x31')]=_0x2b2e81[_0x3e3c('0x31')][_0x3e3c('0x34')]?_0x2b2e81[_0x3e3c('0x31')]:_0x4f3de3[_0x3e3c('0x2e')];if(!_0x2fa2bb[_0x3e3c('0x30')]['hasOwnProperty'](_0x3e3c('0x35'))){_0x2b2e81['limit']=qs[_0x3e3c('0x18')](_0x2fa2bb['query'][_0x3e3c('0x18')]);_0x2b2e81[_0x3e3c('0x1a')]=qs[_0x3e3c('0x1a')](_0x2fa2bb[_0x3e3c('0x30')]['offset']);}_0x2b2e81[_0x3e3c('0x36')]=qs[_0x3e3c('0x37')](_0x2fa2bb[_0x3e3c('0x30')][_0x3e3c('0x37')]);_0x2b2e81[_0x3e3c('0x38')]=qs[_0x3e3c('0x39')](_[_0x3e3c('0x3a')](_0x2fa2bb['query'],_0x4f3de3[_0x3e3c('0x39')]),_0x4cd0a2);if(_0x2fa2bb['query'][_0x3e3c('0x3b')]){_0x2b2e81['where']=_['merge'](_0x2b2e81['where'],{'$or':_[_0x3e3c('0x29')](_0x4cd0a2,function(_0x2ef529){if(_0x2ef529[_0x3e3c('0x3c')]!=='VIRTUAL'){var _0x468aff={};_0x468aff[_0x2ef529[_0x3e3c('0x26')]]={'$like':'%'+_0x2fa2bb[_0x3e3c('0x30')][_0x3e3c('0x3b')]+'%'};return _0x468aff;}})});}_0x2b2e81=_['merge']({},_0x2b2e81,_0x2fa2bb[_0x3e3c('0x3d')]);var _0x1fa869={'where':_0x2b2e81['where']};return db[_0x3e3c('0x2a')][_0x3e3c('0x19')](_0x1fa869)['then'](function(_0x5575d9){_0x219b44[_0x3e3c('0x19')]=_0x5575d9;if(_0x2fa2bb[_0x3e3c('0x30')][_0x3e3c('0x3e')]){_0x2b2e81[_0x3e3c('0x3f')]=[{'all':!![]}];}return db[_0x3e3c('0x2a')][_0x3e3c('0x40')](_0x2b2e81);})['then'](function(_0x521043){_0x219b44[_0x3e3c('0x41')]=_0x521043;return _0x219b44;})[_0x3e3c('0x24')](respondWithFilteredResult(_0x21f914,_0x2b2e81))[_0x3e3c('0x42')](handleError(_0x21f914,null));};exports[_0x3e3c('0x43')]=function(_0xd9f449,_0x4aa83b){var _0x3d1a75={'raw':![],'where':{'id':_0xd9f449['params']['id']}},_0xf43fcc={};_0xf43fcc[_0x3e3c('0x2e')]=_[_0x3e3c('0x2f')](db['Schedule']['rawAttributes']);_0xf43fcc[_0x3e3c('0x30')]=_[_0x3e3c('0x2f')](_0xd9f449[_0x3e3c('0x30')]);_0xf43fcc['filters']=_[_0x3e3c('0x32')](_0xf43fcc[_0x3e3c('0x2e')],_0xf43fcc[_0x3e3c('0x30')]);_0x3d1a75[_0x3e3c('0x31')]=_[_0x3e3c('0x32')](_0xf43fcc[_0x3e3c('0x2e')],qs[_0x3e3c('0x33')](_0xd9f449[_0x3e3c('0x30')][_0x3e3c('0x33')]));_0x3d1a75['attributes']=_0x3d1a75['attributes'][_0x3e3c('0x34')]?_0x3d1a75[_0x3e3c('0x31')]:_0xf43fcc[_0x3e3c('0x2e')];if(_0xd9f449['query']['includeAll']){_0x3d1a75[_0x3e3c('0x3f')]=[{'all':!![]}];}_0x3d1a75=_[_0x3e3c('0x44')]({},_0x3d1a75,_0xd9f449[_0x3e3c('0x3d')]);return db[_0x3e3c('0x2a')][_0x3e3c('0x45')](_0x3d1a75)[_0x3e3c('0x24')](handleEntityNotFound(_0x4aa83b,null))[_0x3e3c('0x24')](respondWithResult(_0x4aa83b,null))['catch'](handleError(_0x4aa83b,null));};exports[_0x3e3c('0x46')]=function(_0x234e84,_0x265cec){return db[_0x3e3c('0x2a')]['create'](_0x234e84[_0x3e3c('0x47')],{})['then'](function(_0x2351b1){var _0x2f8a4d=_0x234e84[_0x3e3c('0x48')][_0x3e3c('0x22')]({'plain':!![]});if(!_0x2f8a4d)throw new Error(_0x3e3c('0x49'));if(_0x2f8a4d['role']==='user'){var _0x10b80e=_0x2351b1[_0x3e3c('0x22')]({'plain':!![]});var _0x529fd1=_0x3e3c('0x23');return db[_0x3e3c('0x4a')][_0x3e3c('0x45')]({'where':{'name':_0x529fd1,'userProfileId':_0x2f8a4d[_0x3e3c('0x4b')]},'raw':!![]})[_0x3e3c('0x24')](function(_0x5d8d5d){if(_0x5d8d5d&&_0x5d8d5d[_0x3e3c('0x4c')]===0x0){return db[_0x3e3c('0x4d')][_0x3e3c('0x46')]({'name':_0x10b80e[_0x3e3c('0x26')],'resourceId':_0x10b80e['id'],'type':_0x5d8d5d['name'],'sectionId':_0x5d8d5d['id']},{})[_0x3e3c('0x24')](function(){return _0x2351b1;});}else{return _0x2351b1;}})[_0x3e3c('0x42')](function(_0x15f5a0){logger[_0x3e3c('0x4e')](_0x3e3c('0x4f'),_0x15f5a0);throw _0x15f5a0;});}return _0x2351b1;})[_0x3e3c('0x24')](respondWithResult(_0x265cec,0xc9))[_0x3e3c('0x42')](handleError(_0x265cec,null));};exports['update']=function(_0xecceac,_0x5a43f0){if(_0xecceac[_0x3e3c('0x47')]['id']){delete _0xecceac[_0x3e3c('0x47')]['id'];}return db[_0x3e3c('0x2a')][_0x3e3c('0x45')]({'where':{'id':_0xecceac[_0x3e3c('0x50')]['id']}})[_0x3e3c('0x24')](handleEntityNotFound(_0x5a43f0,null))['then'](saveUpdates(_0xecceac[_0x3e3c('0x47')],null))[_0x3e3c('0x24')](respondWithResult(_0x5a43f0,null))[_0x3e3c('0x42')](handleError(_0x5a43f0,null));};exports['destroy']=function(_0x268179,_0x529089){return db[_0x3e3c('0x2a')][_0x3e3c('0x45')]({'where':{'id':_0x268179[_0x3e3c('0x50')]['id']}})[_0x3e3c('0x24')](handleEntityNotFound(_0x529089,null))[_0x3e3c('0x24')](removeEntity(_0x529089,null))['catch'](handleError(_0x529089,null));};exports[_0x3e3c('0x51')]=function(_0x20fbe6,_0x5a360f,_0x9e9a63){var _0x232b64=require(_0x3e3c('0x52'));return db[_0x3e3c('0x2a')]['find']({'where':{'id':_0x20fbe6[_0x3e3c('0x50')]['id']},'raw':!![]})[_0x3e3c('0x24')](handleEntityNotFound(_0x5a360f,null))['then'](function(){_0x232b64['run'](_0x20fbe6[_0x3e3c('0x50')]['id']);})[_0x3e3c('0x24')](respondWithStatusCode(_0x5a360f,null))['catch'](handleError(_0x5a360f,null));}; \ No newline at end of file +var _0x3a1d=['body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','eml-format','rimraf','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','get','Scheduler','UserProfileResource','end','sendStatus','stack','name','send','Schedule','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create'];(function(_0x3e2a23,_0x6c980){var _0x281753=function(_0x4a3a6b){while(--_0x4a3a6b){_0x3e2a23['push'](_0x3e2a23['shift']());}};_0x281753(++_0x6c980);}(_0x3a1d,0xb0));var _0xd3a1=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x3a1d[_0x50e7e0];return _0x1a0307;};'use strict';var emlformat=require(_0xd3a1('0x0'));var rimraf=require(_0xd3a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd3a1('0x2'));var moment=require(_0xd3a1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3a1('0x4'));var path=require('path');var sox=require(_0xd3a1('0x5'));var csv=require(_0xd3a1('0x6'));var ejs=require(_0xd3a1('0x7'));var fs=require('fs');var fs_extra=require(_0xd3a1('0x8'));var _=require(_0xd3a1('0x9'));var squel=require(_0xd3a1('0xa'));var crypto=require('crypto');var jsforce=require(_0xd3a1('0xb'));var deskjs=require(_0xd3a1('0xc'));var toCsv=require(_0xd3a1('0x6'));var querystring=require(_0xd3a1('0xd'));var Papa=require('papaparse');var Redis=require(_0xd3a1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd3a1('0xf'));var hardwareService=require(_0xd3a1('0x10'));var logger=require(_0xd3a1('0x11'))('api');var utils=require(_0xd3a1('0x12'));var config=require(_0xd3a1('0x13'));var licenseUtil=require(_0xd3a1('0x14'));var db=require(_0xd3a1('0x15'))['db'];function respondWithStatusCode(_0x15bcf7,_0xeecd09){_0xeecd09=_0xeecd09||0xcc;return function(_0x5c7f50){if(_0x5c7f50){return _0x15bcf7['sendStatus'](_0xeecd09);}return _0x15bcf7[_0xd3a1('0x16')](_0xeecd09)['end']();};}function respondWithResult(_0x4db497,_0x413137){_0x413137=_0x413137||0xc8;return function(_0x3da4e1){if(_0x3da4e1){return _0x4db497['status'](_0x413137)[_0xd3a1('0x17')](_0x3da4e1);}};}function respondWithFilteredResult(_0x35ac74,_0x4b12cf){return function(_0x4c11a0){if(_0x4c11a0){var _0x575f6f=typeof _0x4b12cf[_0xd3a1('0x18')]===_0xd3a1('0x19')&&typeof _0x4b12cf[_0xd3a1('0x1a')]==='undefined';var _0x40586f=_0x4c11a0['count'];var _0x1b0836=_0x575f6f?0x0:_0x4b12cf[_0xd3a1('0x18')];var _0x42fac9=_0x575f6f?_0x4c11a0['count']:_0x4b12cf[_0xd3a1('0x18')]+_0x4b12cf[_0xd3a1('0x1a')];var _0x33acf4;if(_0x42fac9>=_0x40586f){_0x42fac9=_0x40586f;_0x33acf4=0xc8;}else{_0x33acf4=0xce;}_0x35ac74['status'](_0x33acf4);return _0x35ac74['set'](_0xd3a1('0x1b'),_0x1b0836+'-'+_0x42fac9+'/'+_0x40586f)['json'](_0x4c11a0);}return null;};}function patchUpdates(_0x555ba3){return function(_0x3ac4a2){try{jsonpatch[_0xd3a1('0x1c')](_0x3ac4a2,_0x555ba3,!![]);}catch(_0x31237d){return BPromise[_0xd3a1('0x1d')](_0x31237d);}return _0x3ac4a2[_0xd3a1('0x1e')]();};}function saveUpdates(_0x288647,_0x10ab04){return function(_0x589599){if(_0x589599){return _0x589599['update'](_0x288647)['then'](function(_0x21bec8){return _0x21bec8;});}return null;};}function removeEntity(_0x19c536,_0xcf3473){return function(_0x14e6de){if(_0x14e6de){return _0x14e6de[_0xd3a1('0x1f')]()[_0xd3a1('0x20')](function(){var _0xd40266=_0x14e6de[_0xd3a1('0x21')]({'plain':!![]});var _0x516a55=_0xd3a1('0x22');return db[_0xd3a1('0x23')]['destroy']({'where':{'type':_0x516a55,'resourceId':_0xd40266['id']}})[_0xd3a1('0x20')](function(){return _0x14e6de;});})[_0xd3a1('0x20')](function(){_0x19c536[_0xd3a1('0x16')](0xcc)[_0xd3a1('0x24')]();});}};}function handleEntityNotFound(_0x20e8c9,_0x4237a4){return function(_0x51a26e){if(!_0x51a26e){_0x20e8c9[_0xd3a1('0x25')](0x194);}return _0x51a26e;};}function handleError(_0x3c598a,_0x332816){_0x332816=_0x332816||0x1f4;return function(_0x11f4fb){logger['error'](_0x11f4fb[_0xd3a1('0x26')]);if(_0x11f4fb[_0xd3a1('0x27')]){delete _0x11f4fb[_0xd3a1('0x27')];}_0x3c598a['status'](_0x332816)[_0xd3a1('0x28')](_0x11f4fb);};}exports['index']=function(_0x1e012e,_0x4c0bd1){var _0x2d1cde={},_0x4d03f5={},_0x37b8c3={'count':0x0,'rows':[]};var _0x24e2f6=_['map'](db[_0xd3a1('0x29')][_0xd3a1('0x2a')],function(_0x3a07c0){return{'name':_0x3a07c0[_0xd3a1('0x2b')],'type':_0x3a07c0['type'][_0xd3a1('0x2c')]};});_0x4d03f5[_0xd3a1('0x2d')]=_[_0xd3a1('0x2e')](_0x24e2f6,_0xd3a1('0x27'));_0x4d03f5[_0xd3a1('0x2f')]=_['keys'](_0x1e012e[_0xd3a1('0x2f')]);_0x4d03f5[_0xd3a1('0x30')]=_[_0xd3a1('0x31')](_0x4d03f5[_0xd3a1('0x2d')],_0x4d03f5[_0xd3a1('0x2f')]);_0x2d1cde[_0xd3a1('0x32')]=_[_0xd3a1('0x31')](_0x4d03f5[_0xd3a1('0x2d')],qs[_0xd3a1('0x33')](_0x1e012e['query'][_0xd3a1('0x33')]));_0x2d1cde[_0xd3a1('0x32')]=_0x2d1cde[_0xd3a1('0x32')][_0xd3a1('0x34')]?_0x2d1cde[_0xd3a1('0x32')]:_0x4d03f5['model'];if(!_0x1e012e[_0xd3a1('0x2f')][_0xd3a1('0x35')](_0xd3a1('0x36'))){_0x2d1cde[_0xd3a1('0x1a')]=qs[_0xd3a1('0x1a')](_0x1e012e[_0xd3a1('0x2f')][_0xd3a1('0x1a')]);_0x2d1cde['offset']=qs['offset'](_0x1e012e['query'][_0xd3a1('0x18')]);}_0x2d1cde[_0xd3a1('0x37')]=qs[_0xd3a1('0x38')](_0x1e012e[_0xd3a1('0x2f')][_0xd3a1('0x38')]);_0x2d1cde['where']=qs[_0xd3a1('0x30')](_[_0xd3a1('0x39')](_0x1e012e['query'],_0x4d03f5[_0xd3a1('0x30')]),_0x24e2f6);if(_0x1e012e[_0xd3a1('0x2f')]['filter']){_0x2d1cde[_0xd3a1('0x3a')]=_[_0xd3a1('0x3b')](_0x2d1cde['where'],{'$or':_['map'](_0x24e2f6,function(_0x494982){if(_0x494982[_0xd3a1('0x3c')]!==_0xd3a1('0x3d')){var _0x56b940={};_0x56b940[_0x494982[_0xd3a1('0x27')]]={'$like':'%'+_0x1e012e[_0xd3a1('0x2f')]['filter']+'%'};return _0x56b940;}})});}_0x2d1cde=_[_0xd3a1('0x3b')]({},_0x2d1cde,_0x1e012e[_0xd3a1('0x3e')]);var _0x4dadd6={'where':_0x2d1cde[_0xd3a1('0x3a')]};return db[_0xd3a1('0x29')][_0xd3a1('0x3f')](_0x4dadd6)[_0xd3a1('0x20')](function(_0x18c883){_0x37b8c3['count']=_0x18c883;if(_0x1e012e[_0xd3a1('0x2f')][_0xd3a1('0x40')]){_0x2d1cde[_0xd3a1('0x41')]=[{'all':!![]}];}return db[_0xd3a1('0x29')][_0xd3a1('0x42')](_0x2d1cde);})['then'](function(_0x516cb6){_0x37b8c3[_0xd3a1('0x43')]=_0x516cb6;return _0x37b8c3;})[_0xd3a1('0x20')](respondWithFilteredResult(_0x4c0bd1,_0x2d1cde))[_0xd3a1('0x44')](handleError(_0x4c0bd1,null));};exports[_0xd3a1('0x45')]=function(_0x433664,_0x10d13a){var _0x4c5c6c={'raw':![],'where':{'id':_0x433664[_0xd3a1('0x46')]['id']}},_0x587fae={};_0x587fae[_0xd3a1('0x2d')]=_[_0xd3a1('0x47')](db['Schedule']['rawAttributes']);_0x587fae['query']=_[_0xd3a1('0x47')](_0x433664[_0xd3a1('0x2f')]);_0x587fae[_0xd3a1('0x30')]=_['intersection'](_0x587fae[_0xd3a1('0x2d')],_0x587fae[_0xd3a1('0x2f')]);_0x4c5c6c[_0xd3a1('0x32')]=_['intersection'](_0x587fae[_0xd3a1('0x2d')],qs[_0xd3a1('0x33')](_0x433664[_0xd3a1('0x2f')][_0xd3a1('0x33')]));_0x4c5c6c['attributes']=_0x4c5c6c['attributes']['length']?_0x4c5c6c[_0xd3a1('0x32')]:_0x587fae['model'];if(_0x433664[_0xd3a1('0x2f')][_0xd3a1('0x40')]){_0x4c5c6c[_0xd3a1('0x41')]=[{'all':!![]}];}_0x4c5c6c=_[_0xd3a1('0x3b')]({},_0x4c5c6c,_0x433664[_0xd3a1('0x3e')]);return db[_0xd3a1('0x29')]['find'](_0x4c5c6c)['then'](handleEntityNotFound(_0x10d13a,null))['then'](respondWithResult(_0x10d13a,null))[_0xd3a1('0x44')](handleError(_0x10d13a,null));};exports[_0xd3a1('0x48')]=function(_0x47c877,_0x1b4490){return db[_0xd3a1('0x29')][_0xd3a1('0x48')](_0x47c877[_0xd3a1('0x49')],{})['then'](function(_0x2e35d6){var _0x4c4456=_0x47c877[_0xd3a1('0x4a')][_0xd3a1('0x21')]({'plain':!![]});if(!_0x4c4456)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c4456[_0xd3a1('0x4b')]==='user'){var _0x111d3a=_0x2e35d6[_0xd3a1('0x21')]({'plain':!![]});var _0x1b6c84=_0xd3a1('0x22');return db[_0xd3a1('0x4c')][_0xd3a1('0x4d')]({'where':{'name':_0x1b6c84,'userProfileId':_0x4c4456[_0xd3a1('0x4e')]},'raw':!![]})[_0xd3a1('0x20')](function(_0x3692f1){if(_0x3692f1&&_0x3692f1[_0xd3a1('0x4f')]===0x0){return db[_0xd3a1('0x23')][_0xd3a1('0x48')]({'name':_0x111d3a[_0xd3a1('0x27')],'resourceId':_0x111d3a['id'],'type':_0x3692f1[_0xd3a1('0x27')],'sectionId':_0x3692f1['id']},{})[_0xd3a1('0x20')](function(){return _0x2e35d6;});}else{return _0x2e35d6;}})[_0xd3a1('0x44')](function(_0x1ce324){logger[_0xd3a1('0x50')](_0xd3a1('0x51'),_0x1ce324);throw _0x1ce324;});}return _0x2e35d6;})[_0xd3a1('0x20')](respondWithResult(_0x1b4490,0xc9))[_0xd3a1('0x44')](handleError(_0x1b4490,null));};exports['update']=function(_0x5d055f,_0x176295){if(_0x5d055f['body']['id']){delete _0x5d055f[_0xd3a1('0x49')]['id'];}return db[_0xd3a1('0x29')]['find']({'where':{'id':_0x5d055f[_0xd3a1('0x46')]['id']}})[_0xd3a1('0x20')](handleEntityNotFound(_0x176295,null))[_0xd3a1('0x20')](saveUpdates(_0x5d055f['body'],null))['then'](respondWithResult(_0x176295,null))[_0xd3a1('0x44')](handleError(_0x176295,null));};exports[_0xd3a1('0x1f')]=function(_0x18f178,_0x3e631f){return db[_0xd3a1('0x29')][_0xd3a1('0x4d')]({'where':{'id':_0x18f178['params']['id']}})[_0xd3a1('0x20')](handleEntityNotFound(_0x3e631f,null))[_0xd3a1('0x20')](removeEntity(_0x3e631f,null))[_0xd3a1('0x44')](handleError(_0x3e631f,null));};exports['run']=function(_0x24a9f0,_0xc4f06a,_0x48f1c1){var _0x4ffb55=require(_0xd3a1('0x52'));return db['Schedule'][_0xd3a1('0x4d')]({'where':{'id':_0x24a9f0[_0xd3a1('0x46')]['id']},'raw':!![]})[_0xd3a1('0x20')](handleEntityNotFound(_0xc4f06a,null))[_0xd3a1('0x20')](function(){_0x4ffb55['run'](_0x24a9f0['params']['id']);})[_0xd3a1('0x20')](respondWithStatusCode(_0xc4f06a,null))[_0xd3a1('0x44')](handleError(_0xc4f06a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b4c8325..f856446 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 _0x0e53=['./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12bfd7,_0x1343d9){var _0x302bcc=function(_0x4d5f47){while(--_0x4d5f47){_0x12bfd7['push'](_0x12bfd7['shift']());}};_0x302bcc(++_0x1343d9);}(_0x0e53,0xac));var _0x30e5=function(_0x522875,_0x959481){_0x522875=_0x522875-0x0;var _0x5e17a6=_0x0e53[_0x522875];return _0x5e17a6;};'use strict';var _=require(_0x30e5('0x0'));var util=require(_0x30e5('0x1'));var logger=require(_0x30e5('0x2'))(_0x30e5('0x3'));var moment=require(_0x30e5('0x4'));var BPromise=require(_0x30e5('0x5'));var rp=require(_0x30e5('0x6'));var fs=require('fs');var path=require(_0x30e5('0x7'));var rimraf=require(_0x30e5('0x8'));var config=require(_0x30e5('0x9'));var attributes=require(_0x30e5('0xa'));module[_0x30e5('0xb')]=function(_0x105d12,_0x3879f5){return _0x105d12['define'](_0x30e5('0xc'),attributes,{'tableName':_0x30e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ba=['../../config/logger','api','moment','bluebird','path','../../config/environment','./schedule.attributes','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4ba,0xfb));var _0xac4b=function(_0x132a9a,_0x4da489){_0x132a9a=_0x132a9a-0x0;var _0x9dd201=_0xc4ba[_0x132a9a];return _0x9dd201;};'use strict';var _=require(_0xac4b('0x0'));var util=require('util');var logger=require(_0xac4b('0x1'))(_0xac4b('0x2'));var moment=require(_0xac4b('0x3'));var BPromise=require(_0xac4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac4b('0x5'));var rimraf=require('rimraf');var config=require(_0xac4b('0x6'));var attributes=require(_0xac4b('0x7'));module[_0xac4b('0x8')]=function(_0x2104a7,_0x4ff2e7){return _0x2104a7['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 4956492..c11baec 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 _0xdc08=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2eb1c9,_0xb3aa5){var _0x1fb365=function(_0x45dc4e){while(--_0x45dc4e){_0x2eb1c9['push'](_0x2eb1c9['shift']());}};_0x1fb365(++_0xb3aa5);}(_0xdc08,0x11b));var _0x8dc0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdc08[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x8dc0('0x0'));var util=require('util');var moment=require(_0x8dc0('0x1'));var BPromise=require('bluebird');var rs=require(_0x8dc0('0x2'));var fs=require('fs');var Redis=require(_0x8dc0('0x3'));var db=require(_0x8dc0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8dc0('0x5'))(_0x8dc0('0x6'));var config=require(_0x8dc0('0x7'));var jayson=require(_0x8dc0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13b778,_0x3ece53,_0x30ba33){return new BPromise(function(_0x26b63a,_0x29d71b){return client['request'](_0x13b778,_0x30ba33)[_0x8dc0('0x9')](function(_0x44bb49){logger[_0x8dc0('0xa')](_0x8dc0('0xb'),_0x3ece53,_0x8dc0('0xc'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x3ece53,_0x8dc0('0xc'),JSON[_0x8dc0('0xd')](_0x44bb49));if(_0x44bb49[_0x8dc0('0xe')]){if(_0x44bb49[_0x8dc0('0xe')][_0x8dc0('0xf')]===0x1f4){logger[_0x8dc0('0xe')](_0x8dc0('0xb'),_0x3ece53,_0x44bb49[_0x8dc0('0xe')]['message']);return _0x29d71b(_0x44bb49[_0x8dc0('0xe')][_0x8dc0('0x10')]);}logger[_0x8dc0('0xe')](_0x8dc0('0xb'),_0x3ece53,_0x44bb49[_0x8dc0('0xe')][_0x8dc0('0x10')]);return _0x26b63a(_0x44bb49[_0x8dc0('0xe')][_0x8dc0('0x10')]);}else{logger['info'](_0x8dc0('0xb'),_0x3ece53,'request\x20sent');_0x26b63a(_0x44bb49[_0x8dc0('0x11')][_0x8dc0('0x10')]);}})['catch'](function(_0x79b88a){logger[_0x8dc0('0xe')](_0x8dc0('0xb'),_0x3ece53,_0x79b88a);_0x29d71b(_0x79b88a);});});} \ No newline at end of file +var _0x5206=['jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x291b24,_0x1c27e6){var _0x26bb43=function(_0x1cfe0f){while(--_0x1cfe0f){_0x291b24['push'](_0x291b24['shift']());}};_0x26bb43(++_0x1c27e6);}(_0x5206,0xc7));var _0x6520=function(_0x4017a3,_0x4cf6da){_0x4017a3=_0x4017a3-0x0;var _0x3c603a=_0x5206[_0x4017a3];return _0x3c603a;};'use strict';var _=require(_0x6520('0x0'));var util=require(_0x6520('0x1'));var moment=require('moment');var BPromise=require(_0x6520('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6520('0x3'));var db=require(_0x6520('0x4'))['db'];var utils=require(_0x6520('0x5'));var logger=require('../../config/logger')(_0x6520('0x6'));var config=require(_0x6520('0x7'));var jayson=require(_0x6520('0x8'));var client=jayson[_0x6520('0x9')][_0x6520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4825ca,_0x667abd,_0x455295){return new BPromise(function(_0x11f1f6,_0x252beb){return client[_0x6520('0xb')](_0x4825ca,_0x455295)[_0x6520('0xc')](function(_0x1c4f5e){logger[_0x6520('0xd')](_0x6520('0xe'),_0x667abd,'request\x20sent');logger[_0x6520('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x667abd,_0x6520('0x10'),JSON[_0x6520('0x11')](_0x1c4f5e));if(_0x1c4f5e[_0x6520('0x12')]){if(_0x1c4f5e[_0x6520('0x12')][_0x6520('0x13')]===0x1f4){logger[_0x6520('0x12')](_0x6520('0xe'),_0x667abd,_0x1c4f5e[_0x6520('0x12')][_0x6520('0x14')]);return _0x252beb(_0x1c4f5e[_0x6520('0x12')][_0x6520('0x14')]);}logger['error'](_0x6520('0xe'),_0x667abd,_0x1c4f5e[_0x6520('0x12')][_0x6520('0x14')]);return _0x11f1f6(_0x1c4f5e[_0x6520('0x12')]['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x667abd,'request\x20sent');_0x11f1f6(_0x1c4f5e[_0x6520('0x15')][_0x6520('0x14')]);}})[_0x6520('0x16')](function(_0x1fa03c){logger[_0x6520('0x12')](_0x6520('0xe'),_0x667abd,_0x1fa03c);_0x252beb(_0x1fa03c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d9c7eeb..ac49812 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 _0x9b46=['isAuthenticated','index','describe','/:id','show','download','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./screenRecording.controller','get'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9b46,0xe8));var _0x69b4=function(_0x5da449,_0x462a67){_0x5da449=_0x5da449-0x0;var _0x2463cb=_0x9b46[_0x5da449];return _0x2463cb;};'use strict';var multer=require('multer');var util=require(_0x69b4('0x0'));var path=require('path');var timeout=require(_0x69b4('0x1'));var express=require(_0x69b4('0x2'));var router=express[_0x69b4('0x3')]();var fs_extra=require(_0x69b4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x69b4('0x5'));var controller=require(_0x69b4('0x6'));router[_0x69b4('0x7')]('/',auth[_0x69b4('0x8')](),controller[_0x69b4('0x9')]);router[_0x69b4('0x7')]('/describe',auth[_0x69b4('0x8')](),controller[_0x69b4('0xa')]);router['get'](_0x69b4('0xb'),auth['isAuthenticated'](),controller[_0x69b4('0xc')]);router['get']('/:id/download',auth[_0x69b4('0x8')](),controller[_0x69b4('0xd')]);router['post']('/',auth[_0x69b4('0x8')](),controller[_0x69b4('0xe')]);router[_0x69b4('0xf')](_0x69b4('0xb'),auth[_0x69b4('0x8')](),controller[_0x69b4('0x10')]);router[_0x69b4('0x11')](_0x69b4('0xb'),auth[_0x69b4('0x8')](),controller[_0x69b4('0x12')]);module[_0x69b4('0x13')]=router; \ No newline at end of file +var _0x613c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x2ca99d,_0xb8fb38){var _0x3f9ced=function(_0x3202b9){while(--_0x3202b9){_0x2ca99d['push'](_0x2ca99d['shift']());}};_0x3f9ced(++_0xb8fb38);}(_0x613c,0xd9));var _0xc613=function(_0x3bb8dc,_0x35b8e7){_0x3bb8dc=_0x3bb8dc-0x0;var _0xef7793=_0x613c[_0x3bb8dc];return _0xef7793;};'use strict';var multer=require(_0xc613('0x0'));var util=require(_0xc613('0x1'));var path=require('path');var timeout=require(_0xc613('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc613('0x3'));var auth=require(_0xc613('0x4'));var interaction=require(_0xc613('0x5'));var config=require(_0xc613('0x6'));var controller=require('./screenRecording.controller');router[_0xc613('0x7')]('/',auth[_0xc613('0x8')](),controller[_0xc613('0x9')]);router[_0xc613('0x7')]('/describe',auth[_0xc613('0x8')](),controller[_0xc613('0xa')]);router[_0xc613('0x7')](_0xc613('0xb'),auth[_0xc613('0x8')](),controller[_0xc613('0xc')]);router['get'](_0xc613('0xd'),auth[_0xc613('0x8')](),controller['download']);router[_0xc613('0xe')]('/',auth['isAuthenticated'](),controller[_0xc613('0xf')]);router[_0xc613('0x10')](_0xc613('0xb'),auth[_0xc613('0x8')](),controller[_0xc613('0x11')]);router['delete'](_0xc613('0xb'),auth[_0xc613('0x8')](),controller[_0xc613('0x12')]);module[_0xc613('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 78ed1d0..7c8c902 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 _0x1c77=['value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','startedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0x1c77,0xed));var _0x71c7=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0x1c77[_0x28014d];return _0x2572cc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x71c7('0x0'));var path=require(_0x71c7('0x1'));var config=require(_0x71c7('0x2'));module[_0x71c7('0x3')]={'format':{'type':Sequelize[_0x71c7('0x4')],'get':function(){return this['getDataValue'](_0x71c7('0x5'))?path[_0x71c7('0x6')](this[_0x71c7('0x7')](_0x71c7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x71c7('0x8')]},'channel':{'type':Sequelize[_0x71c7('0x8')]},'value':{'type':Sequelize[_0x71c7('0x8')],'set':function(_0x57fb10){var _0x57bbb6=_0x57fb10[_0x71c7('0x9')](/\\/g,'/');this[_0x71c7('0xa')](_0x71c7('0x5'),_0x57bbb6);}},'rating':{'type':Sequelize[_0x71c7('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1f5fc9){this['setDataValue']('startedAt',moment()[_0x71c7('0xc')](_0x1f5fc9,'ms'));this[_0x71c7('0xa')](_0x71c7('0xd'),moment());this[_0x71c7('0xa')](_0x71c7('0xe'),_0x1f5fc9);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0xf')))[_0x71c7('0x10')](_0x71c7('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x71c7('0x12')],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0xd')))[_0x71c7('0x10')](_0x71c7('0x11'))[_0x71c7('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x71c7('0x14')))[_0x71c7('0x10')](_0x71c7('0x11'))[_0x71c7('0x13')]();}},'updatedAt':{'type':Sequelize[_0x71c7('0x12')],'get':function(){return moment(this[_0x71c7('0x7')](_0x71c7('0x15')))[_0x71c7('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x71c7('0x13')]();}}}; \ No newline at end of file +var _0xa7b5=['DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration'];(function(_0x424896,_0x174978){var _0x62ace2=function(_0x57d5d){while(--_0x57d5d){_0x424896['push'](_0x424896['shift']());}};_0x62ace2(++_0x174978);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x4c6320,_0x3f623b){_0x4c6320=_0x4c6320-0x0;var _0x16e49e=_0xa7b5[_0x4c6320];return _0x16e49e;};'use strict';var Sequelize=require(_0x5a7b('0x0'));var moment=require('moment');var path=require(_0x5a7b('0x1'));var config=require('../../config/environment');module[_0x5a7b('0x2')]={'format':{'type':Sequelize[_0x5a7b('0x3')],'get':function(){return this[_0x5a7b('0x4')](_0x5a7b('0x5'))?path[_0x5a7b('0x6')](this[_0x5a7b('0x4')](_0x5a7b('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x5a7b('0x7')]},'channel':{'type':Sequelize[_0x5a7b('0x7')]},'value':{'type':Sequelize[_0x5a7b('0x7')],'set':function(_0x1f8f95){var _0x493ae6=_0x1f8f95[_0x5a7b('0x8')](/\\/g,'/');this[_0x5a7b('0x9')](_0x5a7b('0x5'),_0x493ae6);}},'rating':{'type':Sequelize[_0x5a7b('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5a7b('0xa')],'set':function(_0x4070ee){this['setDataValue']('startedAt',moment()[_0x5a7b('0xb')](_0x4070ee,'ms'));this['setDataValue'](_0x5a7b('0xc'),moment());this[_0x5a7b('0x9')](_0x5a7b('0xd'),_0x4070ee);}},'startedAt':{'type':Sequelize[_0x5a7b('0xe')],'get':function(){return moment(this[_0x5a7b('0x4')](_0x5a7b('0xf')))[_0x5a7b('0x10')](_0x5a7b('0x11'))[_0x5a7b('0x12')]();}},'closedAt':{'type':Sequelize[_0x5a7b('0xe')],'get':function(){return moment(this[_0x5a7b('0x4')]('closedAt'))[_0x5a7b('0x10')](_0x5a7b('0x11'))[_0x5a7b('0x12')]();}},'createdAt':{'type':Sequelize[_0x5a7b('0xe')],'get':function(){return moment(this['getDataValue'](_0x5a7b('0x13')))[_0x5a7b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x5a7b('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5a7b('0x4')]('updatedAt'))[_0x5a7b('0x10')](_0x5a7b('0x11'))[_0x5a7b('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 86262af..137dabb 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 _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4ef992,_0x3d79bc){var _0x2c2934=function(_0x580a00){while(--_0x580a00){_0x4ef992['push'](_0x4ef992['shift']());}};_0x2c2934(++_0x3d79bc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x5fc3[_0x1d1219];return _0x5b5b89;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x57e892,_0x250c61){var _0xcdbd4f=function(_0x4102d8){while(--_0x4102d8){_0x57e892['push'](_0x57e892['shift']());}};_0xcdbd4f(++_0x250c61);}(_0xe5b3,0x133));var _0x3e5b=function(_0x389388,_0x2f7044){_0x389388=_0x389388-0x0;var _0x42fe24=_0xe5b3[_0x389388];return _0x42fe24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d79ad22..b77807a 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 _0x5574=['ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','exports','define'];(function(_0x402baa,_0x713d8d){var _0x11fcaa=function(_0x598088){while(--_0x598088){_0x402baa['push'](_0x402baa['shift']());}};_0x11fcaa(++_0x713d8d);}(_0x5574,0x19d));var _0x4557=function(_0x275788,_0x306c8b){_0x275788=_0x275788-0x0;var _0x9629bd=_0x5574[_0x275788];return _0x9629bd;};'use strict';var _=require(_0x4557('0x0'));var util=require(_0x4557('0x1'));var logger=require('../../config/logger')(_0x4557('0x2'));var moment=require(_0x4557('0x3'));var BPromise=require(_0x4557('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('./screenRecording.attributes');module[_0x4557('0x5')]=function(_0x129dd3,_0x2a052e){return _0x129dd3[_0x4557('0x6')](_0x4557('0x7'),attributes,{'tableName':_0x4557('0x8'),'paranoid':![],'indexes':[{'name':_0x4557('0x9'),'fields':[_0x4557('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d39=['moment','bluebird','request-promise','path','exports','define','screen_recordings','interactionid','lodash','util','api'];(function(_0x419593,_0x26836b){var _0x387cc4=function(_0x11d96e){while(--_0x11d96e){_0x419593['push'](_0x419593['shift']());}};_0x387cc4(++_0x26836b);}(_0x2d39,0xd9));var _0x92d3=function(_0x38e278,_0x346263){_0x38e278=_0x38e278-0x0;var _0x48a4bc=_0x2d39[_0x38e278];return _0x48a4bc;};'use strict';var _=require(_0x92d3('0x0'));var util=require(_0x92d3('0x1'));var logger=require('../../config/logger')(_0x92d3('0x2'));var moment=require(_0x92d3('0x3'));var BPromise=require(_0x92d3('0x4'));var rp=require(_0x92d3('0x5'));var fs=require('fs');var path=require(_0x92d3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x92d3('0x7')]=function(_0x505459,_0x37131b){return _0x505459[_0x92d3('0x8')]('ScreenRecording',attributes,{'tableName':_0x92d3('0x9'),'paranoid':![],'indexes':[{'name':_0x92d3('0xa'),'fields':[_0x92d3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 35159f0..c95fa15 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 _0xc0b8=['info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3bffee,_0x56efd6){var _0x432971=function(_0x456c1e){while(--_0x456c1e){_0x3bffee['push'](_0x3bffee['shift']());}};_0x432971(++_0x56efd6);}(_0xc0b8,0xd0));var _0x8c0b=function(_0x370ab6,_0x5626ef){_0x370ab6=_0x370ab6-0x0;var _0x53855c=_0xc0b8[_0x370ab6];return _0x53855c;};'use strict';var _=require(_0x8c0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c0b('0x1'));var rs=require(_0x8c0b('0x2'));var fs=require('fs');var Redis=require(_0x8c0b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c0b('0x4'));var logger=require(_0x8c0b('0x5'))(_0x8c0b('0x6'));var config=require(_0x8c0b('0x7'));var jayson=require(_0x8c0b('0x8'));var client=jayson['client'][_0x8c0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bd4f,_0x362eb2,_0x20da1a){return new BPromise(function(_0x481fe1,_0x3e1c49){return client[_0x8c0b('0xa')](_0x6bd4f,_0x20da1a)[_0x8c0b('0xb')](function(_0x52c74b){logger[_0x8c0b('0xc')](_0x8c0b('0xd'),_0x362eb2,'request\x20sent');logger[_0x8c0b('0xe')](_0x8c0b('0xf'),_0x362eb2,'request\x20sent',JSON['stringify'](_0x52c74b));if(_0x52c74b[_0x8c0b('0x10')]){if(_0x52c74b[_0x8c0b('0x10')]['code']===0x1f4){logger[_0x8c0b('0x10')](_0x8c0b('0xd'),_0x362eb2,_0x52c74b['error']['message']);return _0x3e1c49(_0x52c74b[_0x8c0b('0x10')]['message']);}logger[_0x8c0b('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x362eb2,_0x52c74b[_0x8c0b('0x10')][_0x8c0b('0x11')]);return _0x481fe1(_0x52c74b[_0x8c0b('0x10')][_0x8c0b('0x11')]);}else{logger[_0x8c0b('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x362eb2,_0x8c0b('0x12'));_0x481fe1(_0x52c74b['result']['message']);}})[_0x8c0b('0x13')](function(_0x218213){logger[_0x8c0b('0x10')](_0x8c0b('0xd'),_0x362eb2,_0x218213);_0x3e1c49(_0x218213);});});} \ No newline at end of file +var _0x01ee=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash'];(function(_0x1525ee,_0x5c3b3a){var _0x43beda=function(_0x45f968){while(--_0x45f968){_0x1525ee['push'](_0x1525ee['shift']());}};_0x43beda(++_0x5c3b3a);}(_0x01ee,0xd1));var _0xe01e=function(_0x5e315e,_0xe5b411){_0x5e315e=_0x5e315e-0x0;var _0x15acdb=_0x01ee[_0x5e315e];return _0x15acdb;};'use strict';var _=require(_0xe01e('0x0'));var util=require(_0xe01e('0x1'));var moment=require('moment');var BPromise=require(_0xe01e('0x2'));var rs=require(_0xe01e('0x3'));var fs=require('fs');var Redis=require(_0xe01e('0x4'));var db=require(_0xe01e('0x5'))['db'];var utils=require(_0xe01e('0x6'));var logger=require(_0xe01e('0x7'))(_0xe01e('0x8'));var config=require(_0xe01e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe01e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x64da61,_0x4ca84e,_0x48f1b7){return new BPromise(function(_0x4bd226,_0x32f6e1){return client[_0xe01e('0xb')](_0x64da61,_0x48f1b7)[_0xe01e('0xc')](function(_0x489336){logger[_0xe01e('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x4ca84e,'request\x20sent');logger[_0xe01e('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4ca84e,'request\x20sent',JSON['stringify'](_0x489336));if(_0x489336['error']){if(_0x489336[_0xe01e('0xf')][_0xe01e('0x10')]===0x1f4){logger[_0xe01e('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x4ca84e,_0x489336[_0xe01e('0xf')]['message']);return _0x32f6e1(_0x489336[_0xe01e('0xf')][_0xe01e('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x4ca84e,_0x489336['error'][_0xe01e('0x11')]);return _0x4bd226(_0x489336[_0xe01e('0xf')][_0xe01e('0x11')]);}else{logger[_0xe01e('0xd')](_0xe01e('0x12'),_0x4ca84e,'request\x20sent');_0x4bd226(_0x489336[_0xe01e('0x13')][_0xe01e('0x11')]);}})[_0xe01e('0x14')](function(_0x8f6fa7){logger[_0xe01e('0xf')](_0xe01e('0x12'),_0x4ca84e,_0x8f6fa7);_0x32f6e1(_0x8f6fa7);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 34b6022..0e20d27 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 _0x23ca=['root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','addLogoLogin','preferred','favicon','originalname','/:id/favicon','addFavicon','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join'];(function(_0x196e57,_0x36eada){var _0x3f3013=function(_0x5365f9){while(--_0x5365f9){_0x196e57['push'](_0x196e57['shift']());}};_0x3f3013(++_0x36eada);}(_0x23ca,0xee));var _0xa23c=function(_0x271900,_0x58e287){_0x271900=_0x271900-0x0;var _0x4a2836=_0x23ca[_0x271900];return _0x4a2836;};'use strict';var multer=require(_0xa23c('0x0'));var util=require(_0xa23c('0x1'));var path=require('path');var timeout=require(_0xa23c('0x2'));var express=require(_0xa23c('0x3'));var router=express[_0xa23c('0x4')]();var fs_extra=require(_0xa23c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa23c('0x6'));var config=require(_0xa23c('0x7'));var controller=require(_0xa23c('0x8'));router[_0xa23c('0x9')]('/',auth[_0xa23c('0xa')](),controller[_0xa23c('0xb')]);router[_0xa23c('0x9')](_0xa23c('0xc'),controller[_0xa23c('0xd')]);router[_0xa23c('0x9')]('/:id',controller[_0xa23c('0xe')]);router[_0xa23c('0x9')](_0xa23c('0xf'),controller[_0xa23c('0x10')]);router['get'](_0xa23c('0x11'),controller[_0xa23c('0x12')]);router['get'](_0xa23c('0x13'),controller[_0xa23c('0x14')]);router[_0xa23c('0x9')](_0xa23c('0x15'),controller[_0xa23c('0x16')]);router[_0xa23c('0x9')]('/:id/favicon',controller[_0xa23c('0x17')]);var upload=multer({'storage':multer[_0xa23c('0x18')]({'destination':function(_0x414646,_0x5b3b16,_0x32116a){_0x32116a(null,path[_0xa23c('0x19')](config[_0xa23c('0x1a')],_0xa23c('0x1b')));},'filename':function(_0x17ae07,_0x5b4a5b,_0x2d14c3){_0x2d14c3(null,util[_0xa23c('0x1c')](_0xa23c('0x1d'),_0xa23c('0x1e'),path[_0xa23c('0x1f')](_0x5b4a5b['originalname'])));}})});router[_0xa23c('0x20')]('/:id/logo',upload[_0xa23c('0x21')](_0xa23c('0x22')),controller[_0xa23c('0x23')]);var upload=multer({'storage':multer[_0xa23c('0x18')]({'destination':function(_0xc4dade,_0x5b8710,_0x45e821){_0x45e821(null,path[_0xa23c('0x19')](config[_0xa23c('0x1a')],_0xa23c('0x1b')));},'filename':function(_0x5db83a,_0x3618ec,_0x441a30){_0x441a30(null,util[_0xa23c('0x1c')](_0xa23c('0x1d'),'logologin',path['extname'](_0x3618ec['originalname'])));}})});router[_0xa23c('0x20')](_0xa23c('0x11'),upload[_0xa23c('0x21')]('file'),controller[_0xa23c('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b7bb3,_0x29a223,_0x245080){_0x245080(null,path[_0xa23c('0x19')](config[_0xa23c('0x1a')],_0xa23c('0x1b')));},'filename':function(_0x1acbbc,_0x154f65,_0x48705a){_0x48705a(null,util[_0xa23c('0x1c')]('%s%s',_0xa23c('0x25'),path['extname'](_0x154f65['originalname'])));}})});router[_0xa23c('0x20')](_0xa23c('0x15'),upload[_0xa23c('0x21')](_0xa23c('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xa23c('0x18')]({'destination':function(_0x518456,_0x26ba4d,_0x4d6640){_0x4d6640(null,path[_0xa23c('0x19')](config['root'],_0xa23c('0x1b')));},'filename':function(_0x513e61,_0xd7da2f,_0x1fd60d){_0x1fd60d(null,util[_0xa23c('0x1c')]('%s%s',_0xa23c('0x26'),path['extname'](_0xd7da2f[_0xa23c('0x27')])));}})});router[_0xa23c('0x20')](_0xa23c('0x28'),upload[_0xa23c('0x21')](_0xa23c('0x22')),controller[_0xa23c('0x29')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa23c('0x2a')]);module[_0xa23c('0x2b')]=router; \ No newline at end of file +var _0xabb7=['addPreferred','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','join','logologin','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabb7,0xe1));var _0x7abb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabb7[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7abb('0x0'));var util=require(_0x7abb('0x1'));var path=require(_0x7abb('0x2'));var timeout=require(_0x7abb('0x3'));var express=require(_0x7abb('0x4'));var router=express[_0x7abb('0x5')]();var fs_extra=require(_0x7abb('0x6'));var auth=require(_0x7abb('0x7'));var interaction=require(_0x7abb('0x8'));var config=require(_0x7abb('0x9'));var controller=require(_0x7abb('0xa'));router['get']('/',auth[_0x7abb('0xb')](),controller[_0x7abb('0xc')]);router[_0x7abb('0xd')](_0x7abb('0xe'),controller[_0x7abb('0xf')]);router[_0x7abb('0xd')](_0x7abb('0x10'),controller['show']);router[_0x7abb('0xd')](_0x7abb('0x11'),controller[_0x7abb('0x12')]);router['get'](_0x7abb('0x13'),controller[_0x7abb('0x14')]);router[_0x7abb('0xd')](_0x7abb('0x15'),controller['gdpr']);router[_0x7abb('0xd')](_0x7abb('0x16'),controller[_0x7abb('0x17')]);router[_0x7abb('0xd')](_0x7abb('0x18'),controller[_0x7abb('0x19')]);var upload=multer({'storage':multer[_0x7abb('0x1a')]({'destination':function(_0x435f9c,_0x4e10d7,_0x46fe47){_0x46fe47(null,path['join'](config[_0x7abb('0x1b')],_0x7abb('0x1c')));},'filename':function(_0x2a1345,_0x3facdd,_0x22e95f){_0x22e95f(null,util[_0x7abb('0x1d')](_0x7abb('0x1e'),_0x7abb('0x1f'),path[_0x7abb('0x20')](_0x3facdd[_0x7abb('0x21')])));}})});router['post'](_0x7abb('0x11'),upload[_0x7abb('0x22')](_0x7abb('0x23')),controller['addLogo']);var upload=multer({'storage':multer[_0x7abb('0x1a')]({'destination':function(_0x107251,_0x7bd13d,_0x8d1b44){_0x8d1b44(null,path[_0x7abb('0x24')](config['root'],_0x7abb('0x1c')));},'filename':function(_0x18c51e,_0x287476,_0x3fb5e9){_0x3fb5e9(null,util[_0x7abb('0x1d')](_0x7abb('0x1e'),_0x7abb('0x25'),path[_0x7abb('0x20')](_0x287476[_0x7abb('0x21')])));}})});router[_0x7abb('0x26')]('/:id/logo_login',upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7abb('0x1a')]({'destination':function(_0x8a39a1,_0x2a6b92,_0x493137){_0x493137(null,path[_0x7abb('0x24')](config[_0x7abb('0x1b')],_0x7abb('0x1c')));},'filename':function(_0x2ce0d4,_0x2b814c,_0x47955b){_0x47955b(null,util[_0x7abb('0x1d')](_0x7abb('0x1e'),'preferred',path[_0x7abb('0x20')](_0x2b814c['originalname'])));}})});router[_0x7abb('0x26')]('/:id/preferred',upload[_0x7abb('0x22')](_0x7abb('0x23')),controller[_0x7abb('0x27')]);var upload=multer({'storage':multer[_0x7abb('0x1a')]({'destination':function(_0x84897b,_0x2259ab,_0x1609d5){_0x1609d5(null,path[_0x7abb('0x24')](config[_0x7abb('0x1b')],_0x7abb('0x1c')));},'filename':function(_0x5069a9,_0x67c909,_0x197259){_0x197259(null,util['format'](_0x7abb('0x1e'),_0x7abb('0x28'),path[_0x7abb('0x20')](_0x67c909['originalname'])));}})});router['post']('/:id/favicon',upload[_0x7abb('0x22')](_0x7abb('0x23')),controller['addFavicon']);router[_0x7abb('0x29')](_0x7abb('0x10'),auth[_0x7abb('0xb')](),controller[_0x7abb('0x2a')]);module[_0x7abb('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7d2eb5d..eed720c 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 _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0xadb5,0xad));var _0x5adb=function(_0x17d96d,_0x1c9d98){_0x17d96d=_0x17d96d-0x0;var _0x3af740=_0xadb5[_0x17d96d];return _0x3af740;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0xadb5,0xad));var _0x5adb=function(_0x169f5c,_0x345a65){_0x169f5c=_0x169f5c-0x0;var _0x12d10e=_0xadb5[_0x169f5c];return _0x12d10e;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4293b7a..811a4a4 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 _0xb6a6=['getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','Setting','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultFavicon','existsSync','root','toLower','logo','join','default_logo.svg','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','default','gdpr','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','default_favicon.ico'];(function(_0x36cce4,_0x341c47){var _0x24f295=function(_0x1ea29a){while(--_0x1ea29a){_0x36cce4['push'](_0x36cce4['shift']());}};_0x24f295(++_0x341c47);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x49b37a,_0x427650){_0x49b37a=_0x49b37a-0x0;var _0x59f6d5=_0xb6a6[_0x49b37a];return _0x59f6d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b6a('0x0'));var zipdir=require(_0x6b6a('0x1'));var jsonpatch=require(_0x6b6a('0x2'));var rp=require(_0x6b6a('0x3'));var moment=require('moment');var BPromise=require(_0x6b6a('0x4'));var Mustache=require(_0x6b6a('0x5'));var util=require(_0x6b6a('0x6'));var path=require(_0x6b6a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b6a('0x8'));var fs=require('fs');var fs_extra=require(_0x6b6a('0x9'));var _=require(_0x6b6a('0xa'));var squel=require(_0x6b6a('0xb'));var crypto=require(_0x6b6a('0xc'));var jsforce=require(_0x6b6a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b6a('0xe'));var Papa=require(_0x6b6a('0xf'));var Redis=require(_0x6b6a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b6a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b6a('0x12'));var logger=require(_0x6b6a('0x13'))(_0x6b6a('0x14'));var utils=require(_0x6b6a('0x15'));var config=require(_0x6b6a('0x16'));var licenseUtil=require(_0x6b6a('0x17'));var db=require(_0x6b6a('0x18'))['db'];var jayson=require(_0x6b6a('0x19'));var client=jayson['client'][_0x6b6a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc5b64a,_0x36b04e,_0x3b78ba,_0x36d13c){return new BPromise(function(_0x56dc36,_0xdc8bca){var _0x12c6e5=_0x36d13c||client;return _0x12c6e5['request'](_0xc5b64a,_0x3b78ba)[_0x6b6a('0x1b')](function(_0x138677){logger[_0x6b6a('0x1c')](_0x6b6a('0x1d'),_0x36b04e,_0x6b6a('0x1e'));logger[_0x6b6a('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x36b04e,_0x6b6a('0x1e'),JSON['stringify'](_0x138677));if(_0x138677[_0x6b6a('0x20')]){if(_0x138677[_0x6b6a('0x20')][_0x6b6a('0x21')]===0x1f4){logger[_0x6b6a('0x20')](_0x6b6a('0x1d'),_0x36b04e,_0x138677['error'][_0x6b6a('0x22')]);return _0xdc8bca(_0x138677[_0x6b6a('0x20')]['message']);}logger[_0x6b6a('0x20')]('Setting,\x20%s,\x20%s',_0x36b04e,_0x138677[_0x6b6a('0x20')]['message']);return _0x56dc36(_0x138677[_0x6b6a('0x20')][_0x6b6a('0x22')]);}else{logger[_0x6b6a('0x1c')](_0x6b6a('0x1d'),_0x36b04e,_0x6b6a('0x1e'));_0x56dc36(_0x138677[_0x6b6a('0x23')][_0x6b6a('0x22')]);}})[_0x6b6a('0x24')](function(_0x580489){logger[_0x6b6a('0x20')](_0x6b6a('0x1d'),_0x36b04e,_0x580489);_0xdc8bca(_0x580489);});});}function respondWithStatusCode(_0x4b78c5,_0x29e830){_0x29e830=_0x29e830||0xcc;return function(_0x4a6f5f){if(_0x4a6f5f){return _0x4b78c5[_0x6b6a('0x25')](_0x29e830);}return _0x4b78c5['status'](_0x29e830)['end']();};}function respondWithResult(_0x4dc7d6,_0x4001b2){_0x4001b2=_0x4001b2||0xc8;return function(_0x1c1861){if(_0x1c1861){return _0x4dc7d6[_0x6b6a('0x26')](_0x4001b2)[_0x6b6a('0x27')](_0x1c1861);}};}function respondWithFilteredResult(_0x4a9950,_0x32a9af){return function(_0x1811c4){if(_0x1811c4){var _0xc7691d=typeof _0x32a9af[_0x6b6a('0x28')]===_0x6b6a('0x29')&&typeof _0x32a9af[_0x6b6a('0x2a')]===_0x6b6a('0x29');var _0x4132ae=_0x1811c4['count'];var _0x584948=_0xc7691d?0x0:_0x32a9af[_0x6b6a('0x28')];var _0x2324c9=_0xc7691d?_0x1811c4[_0x6b6a('0x2b')]:_0x32a9af[_0x6b6a('0x28')]+_0x32a9af[_0x6b6a('0x2a')];var _0x4e1ed6;if(_0x2324c9>=_0x4132ae){_0x2324c9=_0x4132ae;_0x4e1ed6=0xc8;}else{_0x4e1ed6=0xce;}_0x4a9950['status'](_0x4e1ed6);return _0x4a9950['set'](_0x6b6a('0x2c'),_0x584948+'-'+_0x2324c9+'/'+_0x4132ae)[_0x6b6a('0x27')](_0x1811c4);}return null;};}function patchUpdates(_0x38c2aa){return function(_0x9bb1f5){try{jsonpatch[_0x6b6a('0x2d')](_0x9bb1f5,_0x38c2aa,!![]);}catch(_0x2b4b07){return BPromise[_0x6b6a('0x2e')](_0x2b4b07);}return _0x9bb1f5[_0x6b6a('0x2f')]();};}function saveUpdates(_0x5cbabb,_0x487cbc){return function(_0x1ea875){if(_0x1ea875){return _0x1ea875[_0x6b6a('0x30')](_0x5cbabb)[_0x6b6a('0x1b')](function(_0x2c29bc){return _0x2c29bc;});}return null;};}function removeEntity(_0x35c566,_0x18c33c){return function(_0x5c801c){if(_0x5c801c){return _0x5c801c[_0x6b6a('0x31')]()[_0x6b6a('0x1b')](function(){_0x35c566[_0x6b6a('0x26')](0xcc)[_0x6b6a('0x32')]();});}};}function handleEntityNotFound(_0x253876,_0x5a13dc){return function(_0x10bac5){if(!_0x10bac5){_0x253876['sendStatus'](0x194);}return _0x10bac5;};}function handleError(_0x29b648,_0x10a9d0){_0x10a9d0=_0x10a9d0||0x1f4;return function(_0x37b046){logger[_0x6b6a('0x20')](_0x37b046[_0x6b6a('0x33')]);if(_0x37b046[_0x6b6a('0x34')]){delete _0x37b046['name'];}_0x29b648['status'](_0x10a9d0)[_0x6b6a('0x35')](_0x37b046);};}exports['index']=function(_0x5e95bc,_0x352c60){var _0x2d3aeb={},_0x18b489={},_0x4cfc95={'count':0x0,'rows':[]};var _0x98ab08=_[_0x6b6a('0x36')](db[_0x6b6a('0x37')]['rawAttributes'],function(_0x13b1ac){return{'name':_0x13b1ac['fieldName'],'type':_0x13b1ac['type'][_0x6b6a('0x38')]};});_0x18b489[_0x6b6a('0x39')]=_['map'](_0x98ab08,_0x6b6a('0x34'));_0x18b489[_0x6b6a('0x3a')]=_[_0x6b6a('0x3b')](_0x5e95bc[_0x6b6a('0x3a')]);_0x18b489[_0x6b6a('0x3c')]=_['intersection'](_0x18b489['model'],_0x18b489[_0x6b6a('0x3a')]);_0x2d3aeb[_0x6b6a('0x3d')]=_[_0x6b6a('0x3e')](_0x18b489['model'],qs[_0x6b6a('0x3f')](_0x5e95bc[_0x6b6a('0x3a')][_0x6b6a('0x3f')]));_0x2d3aeb['attributes']=_0x2d3aeb[_0x6b6a('0x3d')][_0x6b6a('0x40')]?_0x2d3aeb[_0x6b6a('0x3d')]:_0x18b489[_0x6b6a('0x39')];if(!_0x5e95bc[_0x6b6a('0x3a')]['hasOwnProperty'](_0x6b6a('0x41'))){_0x2d3aeb[_0x6b6a('0x2a')]=qs[_0x6b6a('0x2a')](_0x5e95bc[_0x6b6a('0x3a')]['limit']);_0x2d3aeb[_0x6b6a('0x28')]=qs[_0x6b6a('0x28')](_0x5e95bc[_0x6b6a('0x3a')][_0x6b6a('0x28')]);}_0x2d3aeb[_0x6b6a('0x42')]=qs[_0x6b6a('0x43')](_0x5e95bc[_0x6b6a('0x3a')]['sort']);_0x2d3aeb[_0x6b6a('0x44')]=qs['filters'](_[_0x6b6a('0x45')](_0x5e95bc['query'],_0x18b489[_0x6b6a('0x3c')]),_0x98ab08);if(_0x5e95bc['query']['filter']){_0x2d3aeb['where']=_[_0x6b6a('0x46')](_0x2d3aeb[_0x6b6a('0x44')],{'$or':_[_0x6b6a('0x36')](_0x98ab08,function(_0x1d930f){if(_0x1d930f[_0x6b6a('0x47')]!=='VIRTUAL'){var _0x52482a={};_0x52482a[_0x1d930f['name']]={'$like':'%'+_0x5e95bc['query']['filter']+'%'};return _0x52482a;}})});}_0x2d3aeb=_[_0x6b6a('0x46')]({},_0x2d3aeb,_0x5e95bc[_0x6b6a('0x48')]);var _0x27558e={'where':_0x2d3aeb[_0x6b6a('0x44')]};return db[_0x6b6a('0x37')][_0x6b6a('0x2b')](_0x27558e)[_0x6b6a('0x1b')](function(_0x160fff){_0x4cfc95['count']=_0x160fff;if(_0x5e95bc['query'][_0x6b6a('0x49')]){_0x2d3aeb[_0x6b6a('0x4a')]=[{'all':!![]}];}return db[_0x6b6a('0x37')][_0x6b6a('0x4b')](_0x2d3aeb);})[_0x6b6a('0x1b')](function(_0x1a573a){_0x4cfc95[_0x6b6a('0x4c')]=_0x1a573a;return _0x4cfc95;})[_0x6b6a('0x1b')](respondWithFilteredResult(_0x352c60,_0x2d3aeb))[_0x6b6a('0x24')](handleError(_0x352c60,null));};exports[_0x6b6a('0x4d')]=function(_0x4fc797,_0x483f52){var _0x2362bd={'raw':![],'where':{'id':_0x4fc797[_0x6b6a('0x4e')]['id']}},_0x528ffc={};_0x528ffc[_0x6b6a('0x39')]=_[_0x6b6a('0x3b')](db[_0x6b6a('0x37')][_0x6b6a('0x4f')]);_0x528ffc['query']=_[_0x6b6a('0x3b')](_0x4fc797[_0x6b6a('0x3a')]);_0x528ffc[_0x6b6a('0x3c')]=_[_0x6b6a('0x3e')](_0x528ffc[_0x6b6a('0x39')],_0x528ffc[_0x6b6a('0x3a')]);_0x2362bd[_0x6b6a('0x3d')]=_[_0x6b6a('0x3e')](_0x528ffc['model'],qs[_0x6b6a('0x3f')](_0x4fc797[_0x6b6a('0x3a')][_0x6b6a('0x3f')]));_0x2362bd[_0x6b6a('0x3d')]=_0x2362bd[_0x6b6a('0x3d')][_0x6b6a('0x40')]?_0x2362bd[_0x6b6a('0x3d')]:_0x528ffc['model'];if(_0x4fc797[_0x6b6a('0x3a')][_0x6b6a('0x49')]){_0x2362bd[_0x6b6a('0x4a')]=[{'all':!![]}];}_0x2362bd=_[_0x6b6a('0x46')]({},_0x2362bd,_0x4fc797[_0x6b6a('0x48')]);return db[_0x6b6a('0x37')]['find'](_0x2362bd)['then'](handleEntityNotFound(_0x483f52,null))[_0x6b6a('0x1b')](respondWithResult(_0x483f52,null))['catch'](handleError(_0x483f52,null));};exports[_0x6b6a('0x30')]=function(_0x30c117,_0x45b85d){if(_0x30c117['body']['id']){delete _0x30c117['body']['id'];}return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0x30c117['params']['id']}})[_0x6b6a('0x1b')](handleEntityNotFound(_0x45b85d,null))[_0x6b6a('0x1b')](saveUpdates(_0x30c117[_0x6b6a('0x51')],null))[_0x6b6a('0x1b')](respondWithResult(_0x45b85d,null))['catch'](handleError(_0x45b85d,null));};exports[_0x6b6a('0x52')]=function(_0x52d96c,_0x407246,_0x5680af){if(_0x52d96c['file']&&_0x52d96c[_0x6b6a('0x53')][_0x6b6a('0x54')]){_0x52d96c[_0x6b6a('0x51')]['logo']=_0x52d96c['file'][_0x6b6a('0x54')];}return db[_0x6b6a('0x37')][_0x6b6a('0x50')]({'where':{'id':_0x52d96c[_0x6b6a('0x4e')]['id']}})[_0x6b6a('0x1b')](handleEntityNotFound(_0x407246,null))[_0x6b6a('0x1b')](saveUpdates(_0x52d96c['body'],null))[_0x6b6a('0x1b')](respondWithResult(_0x407246,null))[_0x6b6a('0x24')](handleError(_0x407246,null));};exports[_0x6b6a('0x55')]=function(_0xb69230,_0x499b72,_0xa67430){if(_0xb69230['file']&&_0xb69230['file']['filename']){_0xb69230[_0x6b6a('0x51')][_0x6b6a('0x56')]=_0xb69230['file'][_0x6b6a('0x54')];}return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0xb69230[_0x6b6a('0x4e')]['id']}})[_0x6b6a('0x1b')](handleEntityNotFound(_0x499b72,null))[_0x6b6a('0x1b')](saveUpdates(_0xb69230['body'],null))['then'](respondWithResult(_0x499b72,null))[_0x6b6a('0x24')](handleError(_0x499b72,null));};var utilLicense=require(_0x6b6a('0x17'));exports[_0x6b6a('0x57')]=function(_0xc0009d,_0x302714,_0x329c2e){var _0x558522=_0x6b6a('0x58');var _0x4bcb9e={'custom':![]};return utilLicense[_0x6b6a('0x59')]()[_0x6b6a('0x1b')](function(_0x4f4411){if(_0x4f4411){_0x4bcb9e=_0x4f4411;}return db[_0x6b6a('0x37')][_0x6b6a('0x50')]({'where':{'id':_0xc0009d['params']['id']},'attributes':['logo',_0x6b6a('0x56'),_0x6b6a('0x5a'),_0x6b6a('0x5b'),_0x6b6a('0x5c'),'defaultLoginLogo','defaultPreferred',_0x6b6a('0x5d')],'raw':!![]});})[_0x6b6a('0x1b')](handleEntityNotFound(_0x302714,null))[_0x6b6a('0x1b')](function(_0x2f638a){if(_0x2f638a){var _0x123c4c=_0x2f638a['logo']&&fs[_0x6b6a('0x5e')](path['join'](config[_0x6b6a('0x5f')],_0x558522,_[_0x6b6a('0x60')](_0x2f638a[_0x6b6a('0x61')])))?path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x558522,_[_0x6b6a('0x60')](_0x2f638a[_0x6b6a('0x61')])):path['join'](config[_0x6b6a('0x5f')],_0x558522,_[_0x6b6a('0x60')](_0x6b6a('0x63')));var _0x19b639='default'+_['upperFirst']('logo');if(_0x2f638a[_0x19b639]||!_0x4bcb9e[_0x6b6a('0x64')]){_0x123c4c=path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x558522,_[_0x6b6a('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x123c4c)){throw new db[(_0x6b6a('0x65'))][(_0x6b6a('0x66'))](_[_0x6b6a('0x67')]('logo')+_0x6b6a('0x68'));}return _0x302714[_0x6b6a('0x69')](_0x123c4c);}})['catch'](handleError(_0x302714,null));};var utilLicense=require(_0x6b6a('0x17'));exports[_0x6b6a('0x6a')]=function(_0x392ceb,_0x558ffb,_0x3f7a92){var _0x273530=_0x6b6a('0x58');var _0x5b396e={'custom':![]};return utilLicense[_0x6b6a('0x59')]()[_0x6b6a('0x1b')](function(_0x69955d){if(_0x69955d){_0x5b396e=_0x69955d;}return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0x392ceb['params']['id']},'attributes':[_0x6b6a('0x61'),'loginLogo','preferred','favicon',_0x6b6a('0x5c'),'defaultLoginLogo',_0x6b6a('0x6b'),_0x6b6a('0x5d')],'raw':!![]});})[_0x6b6a('0x1b')](handleEntityNotFound(_0x558ffb,null))[_0x6b6a('0x1b')](function(_0x2a939b){if(_0x2a939b){var _0x49c7f2=_0x2a939b[_0x6b6a('0x56')]&&fs['existsSync'](path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x273530,_[_0x6b6a('0x60')](_0x2a939b[_0x6b6a('0x56')])))?path['join'](config[_0x6b6a('0x5f')],_0x273530,_[_0x6b6a('0x60')](_0x2a939b[_0x6b6a('0x56')])):path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x273530,_['toLower'](_0x6b6a('0x6c')));var _0x2062bc=_0x6b6a('0x6d')+_[_0x6b6a('0x67')](_0x6b6a('0x56'));if(_0x2a939b[_0x2062bc]||!_0x5b396e['custom']){_0x49c7f2=path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x273530,_[_0x6b6a('0x60')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x49c7f2)){throw new db[(_0x6b6a('0x65'))][(_0x6b6a('0x66'))](_[_0x6b6a('0x67')](_0x6b6a('0x56'))+_0x6b6a('0x68'));}return _0x558ffb[_0x6b6a('0x69')](_0x49c7f2);}})[_0x6b6a('0x24')](handleError(_0x558ffb,null));};exports[_0x6b6a('0x6e')]=function(_0x408d3c,_0x302219){return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0x408d3c[_0x6b6a('0x4e')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x302219,null))[_0x6b6a('0x24')](handleError(_0x302219,null));};exports[_0x6b6a('0x6f')]=function(_0x23be13,_0x446533,_0x2438cd){if(_0x23be13[_0x6b6a('0x53')]&&_0x23be13['file'][_0x6b6a('0x54')]){_0x23be13[_0x6b6a('0x51')][_0x6b6a('0x5a')]=_0x23be13['file'][_0x6b6a('0x54')];}return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0x23be13[_0x6b6a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x446533,null))['then'](saveUpdates(_0x23be13[_0x6b6a('0x51')],null))[_0x6b6a('0x1b')](respondWithResult(_0x446533,null))['catch'](handleError(_0x446533,null));};var utilLicense=require(_0x6b6a('0x17'));exports[_0x6b6a('0x70')]=function(_0x4aa0e4,_0x2c0317,_0x37d365){var _0x5eaf78=_0x6b6a('0x58');var _0x599d08={'custom':![]};return utilLicense[_0x6b6a('0x59')]()[_0x6b6a('0x1b')](function(_0x37e969){if(_0x37e969){_0x599d08=_0x37e969;}return db[_0x6b6a('0x37')][_0x6b6a('0x50')]({'where':{'id':_0x4aa0e4['params']['id']},'attributes':[_0x6b6a('0x61'),'loginLogo',_0x6b6a('0x5a'),_0x6b6a('0x5b'),_0x6b6a('0x5c'),_0x6b6a('0x71'),_0x6b6a('0x6b'),_0x6b6a('0x5d')],'raw':!![]});})[_0x6b6a('0x1b')](handleEntityNotFound(_0x2c0317,null))[_0x6b6a('0x1b')](function(_0xd79373){if(_0xd79373){var _0x2ee60a=_0xd79373['preferred']&&fs[_0x6b6a('0x5e')](path['join'](config[_0x6b6a('0x5f')],_0x5eaf78,_[_0x6b6a('0x60')](_0xd79373[_0x6b6a('0x5a')])))?path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x5eaf78,_[_0x6b6a('0x60')](_0xd79373[_0x6b6a('0x5a')])):path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0x5eaf78,_[_0x6b6a('0x60')](_0x6b6a('0x72')));var _0x54445c=_0x6b6a('0x6d')+_[_0x6b6a('0x67')](_0x6b6a('0x5a'));if(_0xd79373[_0x54445c]||!_0x599d08[_0x6b6a('0x64')]||!_0x599d08['preferred']){_0x2ee60a=path['join'](config[_0x6b6a('0x5f')],_0x5eaf78,_[_0x6b6a('0x60')](_0x6b6a('0x72')));}if(!fs[_0x6b6a('0x5e')](_0x2ee60a)){throw new db[(_0x6b6a('0x65'))][(_0x6b6a('0x66'))](_[_0x6b6a('0x67')](_0x6b6a('0x5a'))+'\x20not\x20found');}return _0x2c0317[_0x6b6a('0x69')](_0x2ee60a);}})[_0x6b6a('0x24')](handleError(_0x2c0317,null));};exports[_0x6b6a('0x73')]=function(_0x3708c3,_0xcaa1ae,_0x4e89b2){if(_0x3708c3[_0x6b6a('0x53')]&&_0x3708c3[_0x6b6a('0x53')][_0x6b6a('0x54')]){_0x3708c3['body'][_0x6b6a('0x5b')]=_0x3708c3[_0x6b6a('0x53')][_0x6b6a('0x54')];}return db['Setting'][_0x6b6a('0x50')]({'where':{'id':_0x3708c3[_0x6b6a('0x4e')]['id']}})[_0x6b6a('0x1b')](handleEntityNotFound(_0xcaa1ae,null))[_0x6b6a('0x1b')](saveUpdates(_0x3708c3[_0x6b6a('0x51')],null))['then'](respondWithResult(_0xcaa1ae,null))[_0x6b6a('0x24')](handleError(_0xcaa1ae,null));};var utilLicense=require(_0x6b6a('0x17'));exports['getFavicon']=function(_0x4b1035,_0x433eed,_0x18c45b){var _0xcd6d0c=_0x6b6a('0x58');var _0x171790={'custom':![]};return utilLicense[_0x6b6a('0x59')]()['then'](function(_0x5744af){if(_0x5744af){_0x171790=_0x5744af;}return db[_0x6b6a('0x37')][_0x6b6a('0x50')]({'where':{'id':_0x4b1035[_0x6b6a('0x4e')]['id']},'attributes':['logo',_0x6b6a('0x56'),_0x6b6a('0x5a'),_0x6b6a('0x5b'),_0x6b6a('0x5c'),_0x6b6a('0x71'),_0x6b6a('0x6b'),_0x6b6a('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x433eed,null))[_0x6b6a('0x1b')](function(_0x50191a){if(_0x50191a){var _0x159fe1=_0x50191a[_0x6b6a('0x5b')]&&fs[_0x6b6a('0x5e')](path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0xcd6d0c,_[_0x6b6a('0x60')](_0x50191a[_0x6b6a('0x5b')])))?path['join'](config[_0x6b6a('0x5f')],_0xcd6d0c,_[_0x6b6a('0x60')](_0x50191a[_0x6b6a('0x5b')])):path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0xcd6d0c,_['toLower'](_0x6b6a('0x74')));var _0x50101a=_0x6b6a('0x6d')+_[_0x6b6a('0x67')]('favicon');if(_0x50191a[_0x50101a]||!_0x171790['custom']){_0x159fe1=path[_0x6b6a('0x62')](config[_0x6b6a('0x5f')],_0xcd6d0c,_[_0x6b6a('0x60')](_0x6b6a('0x74')));}if(!fs[_0x6b6a('0x5e')](_0x159fe1)){throw new db['Sequelize']['ValidationError'](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x433eed['download'](_0x159fe1);}})[_0x6b6a('0x24')](handleError(_0x433eed,null));};exports[_0x6b6a('0x75')]=function(_0x1f5add,_0x419b7f){var _0x230b25={'offset':moment()['utcOffset']()};_0x230b25[_0x6b6a('0x76')]=moment()[_0x6b6a('0x77')](_0x230b25['offset'])[_0x6b6a('0x78')](_0x6b6a('0x79'));return _0x419b7f[_0x6b6a('0x26')](0xc8)[_0x6b6a('0x35')](_0x230b25);}; \ No newline at end of file +var _0xa43d=['fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','upperFirst','custom','toLower','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','default','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','format','rimraf','zip-dir'];(function(_0x458848,_0x2dcecd){var _0x20469e=function(_0x41de26){while(--_0x41de26){_0x458848['push'](_0x458848['shift']());}};_0x20469e(++_0x2dcecd);}(_0xa43d,0x172));var _0xda43=function(_0x3abdf8,_0x1d1aef){_0x3abdf8=_0x3abdf8-0x0;var _0xd62e3d=_0xa43d[_0x3abdf8];return _0xd62e3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda43('0x0'));var zipdir=require(_0xda43('0x1'));var jsonpatch=require(_0xda43('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda43('0x3'));var Mustache=require('mustache');var util=require(_0xda43('0x4'));var path=require('path');var sox=require(_0xda43('0x5'));var csv=require(_0xda43('0x6'));var ejs=require(_0xda43('0x7'));var fs=require('fs');var fs_extra=require(_0xda43('0x8'));var _=require(_0xda43('0x9'));var squel=require(_0xda43('0xa'));var crypto=require(_0xda43('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda43('0xc'));var toCsv=require(_0xda43('0x6'));var querystring=require(_0xda43('0xd'));var Papa=require(_0xda43('0xe'));var Redis=require(_0xda43('0xf'));var authService=require(_0xda43('0x10'));var qs=require(_0xda43('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda43('0x12'));var logger=require(_0xda43('0x13'))(_0xda43('0x14'));var utils=require('../../config/utils');var config=require(_0xda43('0x15'));var licenseUtil=require(_0xda43('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xda43('0x17'));var client=jayson[_0xda43('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eab98,_0x4cc92e,_0x3af04b,_0x8b4a0f){return new BPromise(function(_0x13908b,_0x3b240b){var _0x1a7ae3=_0x8b4a0f||client;return _0x1a7ae3[_0xda43('0x19')](_0x3eab98,_0x3af04b)[_0xda43('0x1a')](function(_0x16e8fe){logger[_0xda43('0x1b')](_0xda43('0x1c'),_0x4cc92e,_0xda43('0x1d'));logger[_0xda43('0x1e')](_0xda43('0x1f'),_0x4cc92e,_0xda43('0x1d'),JSON[_0xda43('0x20')](_0x16e8fe));if(_0x16e8fe[_0xda43('0x21')]){if(_0x16e8fe['error'][_0xda43('0x22')]===0x1f4){logger[_0xda43('0x21')]('Setting,\x20%s,\x20%s',_0x4cc92e,_0x16e8fe[_0xda43('0x21')]['message']);return _0x3b240b(_0x16e8fe['error'][_0xda43('0x23')]);}logger[_0xda43('0x21')]('Setting,\x20%s,\x20%s',_0x4cc92e,_0x16e8fe[_0xda43('0x21')][_0xda43('0x23')]);return _0x13908b(_0x16e8fe[_0xda43('0x21')][_0xda43('0x23')]);}else{logger[_0xda43('0x1b')]('Setting,\x20%s,\x20%s',_0x4cc92e,_0xda43('0x1d'));_0x13908b(_0x16e8fe[_0xda43('0x24')][_0xda43('0x23')]);}})[_0xda43('0x25')](function(_0x471b78){logger[_0xda43('0x21')](_0xda43('0x1c'),_0x4cc92e,_0x471b78);_0x3b240b(_0x471b78);});});}function respondWithStatusCode(_0x16a3f8,_0xac4bf1){_0xac4bf1=_0xac4bf1||0xcc;return function(_0x514925){if(_0x514925){return _0x16a3f8['sendStatus'](_0xac4bf1);}return _0x16a3f8[_0xda43('0x26')](_0xac4bf1)['end']();};}function respondWithResult(_0x5512b2,_0x1b22ba){_0x1b22ba=_0x1b22ba||0xc8;return function(_0x3439b3){if(_0x3439b3){return _0x5512b2[_0xda43('0x26')](_0x1b22ba)[_0xda43('0x27')](_0x3439b3);}};}function respondWithFilteredResult(_0x22dcb8,_0x29db73){return function(_0x3c8d86){if(_0x3c8d86){var _0x25a604=typeof _0x29db73[_0xda43('0x28')]===_0xda43('0x29')&&typeof _0x29db73[_0xda43('0x2a')]===_0xda43('0x29');var _0x5eeb9f=_0x3c8d86[_0xda43('0x2b')];var _0xf956e4=_0x25a604?0x0:_0x29db73[_0xda43('0x28')];var _0x3c0b7e=_0x25a604?_0x3c8d86['count']:_0x29db73[_0xda43('0x28')]+_0x29db73['limit'];var _0x5bde8f;if(_0x3c0b7e>=_0x5eeb9f){_0x3c0b7e=_0x5eeb9f;_0x5bde8f=0xc8;}else{_0x5bde8f=0xce;}_0x22dcb8['status'](_0x5bde8f);return _0x22dcb8['set'](_0xda43('0x2c'),_0xf956e4+'-'+_0x3c0b7e+'/'+_0x5eeb9f)[_0xda43('0x27')](_0x3c8d86);}return null;};}function patchUpdates(_0x400ddf){return function(_0xd1bc55){try{jsonpatch[_0xda43('0x2d')](_0xd1bc55,_0x400ddf,!![]);}catch(_0x49ff55){return BPromise[_0xda43('0x2e')](_0x49ff55);}return _0xd1bc55[_0xda43('0x2f')]();};}function saveUpdates(_0x5cd84c,_0x5e1776){return function(_0x19c5ee){if(_0x19c5ee){return _0x19c5ee[_0xda43('0x30')](_0x5cd84c)[_0xda43('0x1a')](function(_0x154420){return _0x154420;});}return null;};}function removeEntity(_0x5702c7,_0x492b23){return function(_0x28c315){if(_0x28c315){return _0x28c315[_0xda43('0x31')]()[_0xda43('0x1a')](function(){_0x5702c7[_0xda43('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ddcb2,_0x52284a){return function(_0x4e4479){if(!_0x4e4479){_0x2ddcb2[_0xda43('0x32')](0x194);}return _0x4e4479;};}function handleError(_0x5abd34,_0x113a96){_0x113a96=_0x113a96||0x1f4;return function(_0x514730){logger[_0xda43('0x21')](_0x514730[_0xda43('0x33')]);if(_0x514730[_0xda43('0x34')]){delete _0x514730[_0xda43('0x34')];}_0x5abd34['status'](_0x113a96)[_0xda43('0x35')](_0x514730);};}exports[_0xda43('0x36')]=function(_0x3a7c06,_0x5aa18a){var _0x3a76dd={},_0x3ffd03={},_0x1dbdea={'count':0x0,'rows':[]};var _0x402025=_[_0xda43('0x37')](db[_0xda43('0x38')][_0xda43('0x39')],function(_0x38eda0){return{'name':_0x38eda0[_0xda43('0x3a')],'type':_0x38eda0['type'][_0xda43('0x3b')]};});_0x3ffd03[_0xda43('0x3c')]=_[_0xda43('0x37')](_0x402025,_0xda43('0x34'));_0x3ffd03[_0xda43('0x3d')]=_[_0xda43('0x3e')](_0x3a7c06[_0xda43('0x3d')]);_0x3ffd03[_0xda43('0x3f')]=_['intersection'](_0x3ffd03['model'],_0x3ffd03[_0xda43('0x3d')]);_0x3a76dd[_0xda43('0x40')]=_[_0xda43('0x41')](_0x3ffd03[_0xda43('0x3c')],qs[_0xda43('0x42')](_0x3a7c06['query']['fields']));_0x3a76dd['attributes']=_0x3a76dd['attributes'][_0xda43('0x43')]?_0x3a76dd[_0xda43('0x40')]:_0x3ffd03[_0xda43('0x3c')];if(!_0x3a7c06[_0xda43('0x3d')][_0xda43('0x44')]('nolimit')){_0x3a76dd['limit']=qs[_0xda43('0x2a')](_0x3a7c06[_0xda43('0x3d')]['limit']);_0x3a76dd[_0xda43('0x28')]=qs[_0xda43('0x28')](_0x3a7c06['query'][_0xda43('0x28')]);}_0x3a76dd[_0xda43('0x45')]=qs[_0xda43('0x46')](_0x3a7c06[_0xda43('0x3d')][_0xda43('0x46')]);_0x3a76dd['where']=qs[_0xda43('0x3f')](_[_0xda43('0x47')](_0x3a7c06[_0xda43('0x3d')],_0x3ffd03[_0xda43('0x3f')]),_0x402025);if(_0x3a7c06['query'][_0xda43('0x48')]){_0x3a76dd[_0xda43('0x49')]=_[_0xda43('0x4a')](_0x3a76dd[_0xda43('0x49')],{'$or':_[_0xda43('0x37')](_0x402025,function(_0x104e3b){if(_0x104e3b[_0xda43('0x4b')]!==_0xda43('0x4c')){var _0xe6fdf0={};_0xe6fdf0[_0x104e3b['name']]={'$like':'%'+_0x3a7c06[_0xda43('0x3d')]['filter']+'%'};return _0xe6fdf0;}})});}_0x3a76dd=_['merge']({},_0x3a76dd,_0x3a7c06['options']);var _0x16b0e0={'where':_0x3a76dd[_0xda43('0x49')]};return db[_0xda43('0x38')][_0xda43('0x2b')](_0x16b0e0)[_0xda43('0x1a')](function(_0x557966){_0x1dbdea[_0xda43('0x2b')]=_0x557966;if(_0x3a7c06[_0xda43('0x3d')][_0xda43('0x4d')]){_0x3a76dd[_0xda43('0x4e')]=[{'all':!![]}];}return db[_0xda43('0x38')][_0xda43('0x4f')](_0x3a76dd);})[_0xda43('0x1a')](function(_0x1b7566){_0x1dbdea[_0xda43('0x50')]=_0x1b7566;return _0x1dbdea;})[_0xda43('0x1a')](respondWithFilteredResult(_0x5aa18a,_0x3a76dd))[_0xda43('0x25')](handleError(_0x5aa18a,null));};exports[_0xda43('0x51')]=function(_0x15a0a8,_0x1c8013){var _0x17ca65={'raw':![],'where':{'id':_0x15a0a8[_0xda43('0x52')]['id']}},_0x2768b6={};_0x2768b6[_0xda43('0x3c')]=_[_0xda43('0x3e')](db[_0xda43('0x38')][_0xda43('0x39')]);_0x2768b6[_0xda43('0x3d')]=_[_0xda43('0x3e')](_0x15a0a8['query']);_0x2768b6[_0xda43('0x3f')]=_[_0xda43('0x41')](_0x2768b6[_0xda43('0x3c')],_0x2768b6[_0xda43('0x3d')]);_0x17ca65[_0xda43('0x40')]=_['intersection'](_0x2768b6[_0xda43('0x3c')],qs[_0xda43('0x42')](_0x15a0a8[_0xda43('0x3d')]['fields']));_0x17ca65['attributes']=_0x17ca65['attributes'][_0xda43('0x43')]?_0x17ca65[_0xda43('0x40')]:_0x2768b6['model'];if(_0x15a0a8[_0xda43('0x3d')][_0xda43('0x4d')]){_0x17ca65[_0xda43('0x4e')]=[{'all':!![]}];}_0x17ca65=_['merge']({},_0x17ca65,_0x15a0a8[_0xda43('0x53')]);return db[_0xda43('0x38')][_0xda43('0x54')](_0x17ca65)[_0xda43('0x1a')](handleEntityNotFound(_0x1c8013,null))['then'](respondWithResult(_0x1c8013,null))['catch'](handleError(_0x1c8013,null));};exports['update']=function(_0x44d8ea,_0x300bf2){if(_0x44d8ea[_0xda43('0x55')]['id']){delete _0x44d8ea[_0xda43('0x55')]['id'];}return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0x44d8ea[_0xda43('0x52')]['id']}})['then'](handleEntityNotFound(_0x300bf2,null))['then'](saveUpdates(_0x44d8ea[_0xda43('0x55')],null))[_0xda43('0x1a')](respondWithResult(_0x300bf2,null))[_0xda43('0x25')](handleError(_0x300bf2,null));};exports[_0xda43('0x56')]=function(_0x3ab665,_0x2f05a3,_0x36a927){if(_0x3ab665[_0xda43('0x57')]&&_0x3ab665[_0xda43('0x57')]['filename']){_0x3ab665['body'][_0xda43('0x58')]=_0x3ab665['file'][_0xda43('0x59')];}return db['Setting'][_0xda43('0x54')]({'where':{'id':_0x3ab665['params']['id']}})[_0xda43('0x1a')](handleEntityNotFound(_0x2f05a3,null))[_0xda43('0x1a')](saveUpdates(_0x3ab665[_0xda43('0x55')],null))[_0xda43('0x1a')](respondWithResult(_0x2f05a3,null))[_0xda43('0x25')](handleError(_0x2f05a3,null));};exports[_0xda43('0x5a')]=function(_0x5149b6,_0x2a65fc,_0x1109c7){if(_0x5149b6[_0xda43('0x57')]&&_0x5149b6[_0xda43('0x57')][_0xda43('0x59')]){_0x5149b6[_0xda43('0x55')][_0xda43('0x5b')]=_0x5149b6[_0xda43('0x57')][_0xda43('0x59')];}return db['Setting']['find']({'where':{'id':_0x5149b6[_0xda43('0x52')]['id']}})[_0xda43('0x1a')](handleEntityNotFound(_0x2a65fc,null))[_0xda43('0x1a')](saveUpdates(_0x5149b6[_0xda43('0x55')],null))['then'](respondWithResult(_0x2a65fc,null))['catch'](handleError(_0x2a65fc,null));};var utilLicense=require(_0xda43('0x16'));exports[_0xda43('0x5c')]=function(_0x47b9f6,_0x4c3bc5,_0x1295a9){var _0x3d84dd='server/files/images/logos';var _0xb28f66={'custom':![]};return utilLicense[_0xda43('0x5d')]()[_0xda43('0x1a')](function(_0x205673){if(_0x205673){_0xb28f66=_0x205673;}return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0x47b9f6[_0xda43('0x52')]['id']},'attributes':[_0xda43('0x58'),_0xda43('0x5b'),_0xda43('0x5e'),_0xda43('0x5f'),_0xda43('0x60'),_0xda43('0x61'),_0xda43('0x62'),_0xda43('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x4c3bc5,null))['then'](function(_0x37ac4b){if(_0x37ac4b){var _0x15d2c0=_0x37ac4b['logo']&&fs[_0xda43('0x64')](path[_0xda43('0x65')](config['root'],_0x3d84dd,_['toLower'](_0x37ac4b[_0xda43('0x58')])))?path[_0xda43('0x65')](config[_0xda43('0x66')],_0x3d84dd,_['toLower'](_0x37ac4b[_0xda43('0x58')])):path['join'](config[_0xda43('0x66')],_0x3d84dd,_['toLower']('default_logo.svg'));var _0x3e91bc='default'+_[_0xda43('0x67')](_0xda43('0x58'));if(_0x37ac4b[_0x3e91bc]||!_0xb28f66[_0xda43('0x68')]){_0x15d2c0=path[_0xda43('0x65')](config[_0xda43('0x66')],_0x3d84dd,_[_0xda43('0x69')](_0xda43('0x6a')));}if(!fs['existsSync'](_0x15d2c0)){throw new db[(_0xda43('0x6b'))][(_0xda43('0x6c'))](_[_0xda43('0x67')](_0xda43('0x58'))+_0xda43('0x6d'));}return _0x4c3bc5[_0xda43('0x6e')](_0x15d2c0);}})[_0xda43('0x25')](handleError(_0x4c3bc5,null));};var utilLicense=require(_0xda43('0x16'));exports['getLogoLogin']=function(_0x5d285f,_0x4aef7b,_0x5977c3){var _0xb54ece=_0xda43('0x6f');var _0x230204={'custom':![]};return utilLicense[_0xda43('0x5d')]()['then'](function(_0x11d1b9){if(_0x11d1b9){_0x230204=_0x11d1b9;}return db['Setting'][_0xda43('0x54')]({'where':{'id':_0x5d285f['params']['id']},'attributes':[_0xda43('0x58'),'loginLogo','preferred','favicon',_0xda43('0x60'),_0xda43('0x61'),_0xda43('0x62'),_0xda43('0x63')],'raw':!![]});})[_0xda43('0x1a')](handleEntityNotFound(_0x4aef7b,null))[_0xda43('0x1a')](function(_0x405ce6){if(_0x405ce6){var _0x5234f4=_0x405ce6[_0xda43('0x5b')]&&fs[_0xda43('0x64')](path['join'](config[_0xda43('0x66')],_0xb54ece,_[_0xda43('0x69')](_0x405ce6[_0xda43('0x5b')])))?path[_0xda43('0x65')](config[_0xda43('0x66')],_0xb54ece,_['toLower'](_0x405ce6[_0xda43('0x5b')])):path[_0xda43('0x65')](config[_0xda43('0x66')],_0xb54ece,_[_0xda43('0x69')]('default_loginLogo.svg'));var _0x3bfb93=_0xda43('0x70')+_['upperFirst'](_0xda43('0x5b'));if(_0x405ce6[_0x3bfb93]||!_0x230204[_0xda43('0x68')]){_0x5234f4=path['join'](config['root'],_0xb54ece,_[_0xda43('0x69')](_0xda43('0x71')));}if(!fs['existsSync'](_0x5234f4)){throw new db[(_0xda43('0x6b'))][(_0xda43('0x6c'))](_[_0xda43('0x67')](_0xda43('0x5b'))+_0xda43('0x6d'));}return _0x4aef7b[_0xda43('0x6e')](_0x5234f4);}})[_0xda43('0x25')](handleError(_0x4aef7b,null));};exports['gdpr']=function(_0x2a65d6,_0xa83db6){return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0x2a65d6[_0xda43('0x52')]['id']},'attributes':[_0xda43('0x72')]})['then'](respondWithResult(_0xa83db6,null))[_0xda43('0x25')](handleError(_0xa83db6,null));};exports[_0xda43('0x73')]=function(_0x3dca0b,_0x42182a,_0x1eeefb){if(_0x3dca0b[_0xda43('0x57')]&&_0x3dca0b[_0xda43('0x57')]['filename']){_0x3dca0b[_0xda43('0x55')]['preferred']=_0x3dca0b['file']['filename'];}return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0x3dca0b[_0xda43('0x52')]['id']}})[_0xda43('0x1a')](handleEntityNotFound(_0x42182a,null))[_0xda43('0x1a')](saveUpdates(_0x3dca0b['body'],null))[_0xda43('0x1a')](respondWithResult(_0x42182a,null))[_0xda43('0x25')](handleError(_0x42182a,null));};var utilLicense=require('../../config/license/util');exports[_0xda43('0x74')]=function(_0x1510de,_0x5f139f,_0x2aadfb){var _0x1d6d71=_0xda43('0x6f');var _0x2f06d4={'custom':![]};return utilLicense[_0xda43('0x5d')]()[_0xda43('0x1a')](function(_0x11d935){if(_0x11d935){_0x2f06d4=_0x11d935;}return db['Setting'][_0xda43('0x54')]({'where':{'id':_0x1510de[_0xda43('0x52')]['id']},'attributes':[_0xda43('0x58'),_0xda43('0x5b'),_0xda43('0x5e'),_0xda43('0x5f'),_0xda43('0x60'),_0xda43('0x61'),_0xda43('0x62'),'defaultFavicon'],'raw':!![]});})[_0xda43('0x1a')](handleEntityNotFound(_0x5f139f,null))['then'](function(_0x27a632){if(_0x27a632){var _0x2dd021=_0x27a632[_0xda43('0x5e')]&&fs[_0xda43('0x64')](path['join'](config[_0xda43('0x66')],_0x1d6d71,_['toLower'](_0x27a632[_0xda43('0x5e')])))?path[_0xda43('0x65')](config[_0xda43('0x66')],_0x1d6d71,_[_0xda43('0x69')](_0x27a632[_0xda43('0x5e')])):path[_0xda43('0x65')](config[_0xda43('0x66')],_0x1d6d71,_[_0xda43('0x69')](_0xda43('0x75')));var _0x5dcef6=_0xda43('0x70')+_[_0xda43('0x67')](_0xda43('0x5e'));if(_0x27a632[_0x5dcef6]||!_0x2f06d4[_0xda43('0x68')]||!_0x2f06d4[_0xda43('0x5e')]){_0x2dd021=path[_0xda43('0x65')](config[_0xda43('0x66')],_0x1d6d71,_[_0xda43('0x69')]('default_preferred.png'));}if(!fs[_0xda43('0x64')](_0x2dd021)){throw new db['Sequelize']['ValidationError'](_[_0xda43('0x67')](_0xda43('0x5e'))+_0xda43('0x6d'));}return _0x5f139f[_0xda43('0x6e')](_0x2dd021);}})['catch'](handleError(_0x5f139f,null));};exports[_0xda43('0x76')]=function(_0x4011a7,_0x2f7647,_0x318ff4){if(_0x4011a7[_0xda43('0x57')]&&_0x4011a7[_0xda43('0x57')][_0xda43('0x59')]){_0x4011a7['body'][_0xda43('0x5f')]=_0x4011a7[_0xda43('0x57')][_0xda43('0x59')];}return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0x4011a7[_0xda43('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f7647,null))[_0xda43('0x1a')](saveUpdates(_0x4011a7[_0xda43('0x55')],null))[_0xda43('0x1a')](respondWithResult(_0x2f7647,null))[_0xda43('0x25')](handleError(_0x2f7647,null));};var utilLicense=require('../../config/license/util');exports[_0xda43('0x77')]=function(_0xc26635,_0x5acca8,_0x136199){var _0x565633=_0xda43('0x6f');var _0x3b218f={'custom':![]};return utilLicense[_0xda43('0x5d')]()[_0xda43('0x1a')](function(_0x2d7ce7){if(_0x2d7ce7){_0x3b218f=_0x2d7ce7;}return db[_0xda43('0x38')][_0xda43('0x54')]({'where':{'id':_0xc26635[_0xda43('0x52')]['id']},'attributes':['logo',_0xda43('0x5b'),_0xda43('0x5e'),'favicon','defaultLogo',_0xda43('0x61'),'defaultPreferred',_0xda43('0x63')],'raw':!![]});})[_0xda43('0x1a')](handleEntityNotFound(_0x5acca8,null))['then'](function(_0x150019){if(_0x150019){var _0x4e9d62=_0x150019[_0xda43('0x5f')]&&fs['existsSync'](path[_0xda43('0x65')](config[_0xda43('0x66')],_0x565633,_[_0xda43('0x69')](_0x150019[_0xda43('0x5f')])))?path[_0xda43('0x65')](config[_0xda43('0x66')],_0x565633,_[_0xda43('0x69')](_0x150019[_0xda43('0x5f')])):path['join'](config[_0xda43('0x66')],_0x565633,_[_0xda43('0x69')]('default_favicon.ico'));var _0x3bb3bb=_0xda43('0x70')+_[_0xda43('0x67')](_0xda43('0x5f'));if(_0x150019[_0x3bb3bb]||!_0x3b218f[_0xda43('0x68')]){_0x4e9d62=path[_0xda43('0x65')](config[_0xda43('0x66')],_0x565633,_['toLower'](_0xda43('0x78')));}if(!fs[_0xda43('0x64')](_0x4e9d62)){throw new db[(_0xda43('0x6b'))][(_0xda43('0x6c'))](_[_0xda43('0x67')](_0xda43('0x5f'))+_0xda43('0x6d'));}return _0x5acca8[_0xda43('0x6e')](_0x4e9d62);}})[_0xda43('0x25')](handleError(_0x5acca8,null));};exports[_0xda43('0x79')]=function(_0x2182b9,_0x25bb06){var _0x3fa763={'offset':moment()['utcOffset']()};_0x3fa763[_0xda43('0x7a')]=moment()['utcOffset'](_0x3fa763['offset'])[_0xda43('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x25bb06[_0xda43('0x26')](0xc8)[_0xda43('0x35')](_0x3fa763);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 43ef0b6..02c2274 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(_0x56fdef,_0x1ae654){var _0x478c52=function(_0x494afd){while(--_0x494afd){_0x56fdef['push'](_0x56fdef['shift']());}};_0x478c52(++_0x1ae654);}(_0x34e8,0x12c));var _0x834e=function(_0x21e183,_0x24e01b){_0x21e183=_0x21e183-0x0;var _0x6b407a=_0x34e8[_0x21e183];return _0x6b407a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x55ca,0x126));var _0xa55c=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x55ca[_0x513254];return _0x384c92;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 11e296d..e48dc15 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 _0x0775=['find','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting'];(function(_0x31b522,_0x4e51ed){var _0x3db6ff=function(_0x49e2ef){while(--_0x49e2ef){_0x31b522['push'](_0x31b522['shift']());}};_0x3db6ff(++_0x4e51ed);}(_0x0775,0xce));var _0x5077=function(_0x5da055,_0x42100e){_0x5da055=_0x5da055-0x0;var _0x21d37c=_0x0775[_0x5da055];return _0x21d37c;};'use strict';var _=require(_0x5077('0x0'));var util=require(_0x5077('0x1'));var moment=require('moment');var BPromise=require(_0x5077('0x2'));var rs=require(_0x5077('0x3'));var fs=require('fs');var Redis=require(_0x5077('0x4'));var db=require(_0x5077('0x5'))['db'];var utils=require(_0x5077('0x6'));var logger=require(_0x5077('0x7'))('rpc');var config=require(_0x5077('0x8'));var jayson=require(_0x5077('0x9'));var client=jayson[_0x5077('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b14cf,_0x3a85c4,_0xd35ffe){return new BPromise(function(_0x16fb88,_0x458c64){return client[_0x5077('0xb')](_0x2b14cf,_0xd35ffe)[_0x5077('0xc')](function(_0x295655){logger[_0x5077('0xd')](_0x5077('0xe'),_0x3a85c4,_0x5077('0xf'));logger[_0x5077('0x10')](_0x5077('0x11'),_0x3a85c4,_0x5077('0xf'),JSON['stringify'](_0x295655));if(_0x295655[_0x5077('0x12')]){if(_0x295655[_0x5077('0x12')][_0x5077('0x13')]===0x1f4){logger[_0x5077('0x12')](_0x5077('0xe'),_0x3a85c4,_0x295655[_0x5077('0x12')][_0x5077('0x14')]);return _0x458c64(_0x295655[_0x5077('0x12')]['message']);}logger[_0x5077('0x12')](_0x5077('0xe'),_0x3a85c4,_0x295655[_0x5077('0x12')][_0x5077('0x14')]);return _0x16fb88(_0x295655['error'][_0x5077('0x14')]);}else{logger[_0x5077('0xd')](_0x5077('0xe'),_0x3a85c4,_0x5077('0xf'));_0x16fb88(_0x295655[_0x5077('0x15')][_0x5077('0x14')]);}})[_0x5077('0x16')](function(_0x25b5b0){logger[_0x5077('0x12')](_0x5077('0xe'),_0x3a85c4,_0x25b5b0);_0x458c64(_0x25b5b0);});});}exports[_0x5077('0x17')]=function(_0x51df51){var _0x39a6e2=this;return new Promise(function(_0x2888b7,_0x487e0c){return db[_0x5077('0x18')][_0x5077('0x19')]({'raw':_0x51df51[_0x5077('0x1a')]?_0x51df51[_0x5077('0x1a')][_0x5077('0x1b')]===undefined?!![]:![]:!![],'where':_0x51df51[_0x5077('0x1a')]?_0x51df51[_0x5077('0x1a')][_0x5077('0x1c')]||null:null,'attributes':_0x51df51[_0x5077('0x1a')]?_0x51df51['options'][_0x5077('0x1d')]||null:null,'include':_0x51df51[_0x5077('0x1a')]?_0x51df51[_0x5077('0x1a')][_0x5077('0x1e')]?_['map'](_0x51df51[_0x5077('0x1a')]['include'],function(_0x39f1c4){return{'model':db[_0x39f1c4[_0x5077('0x1f')]],'as':_0x39f1c4['as'],'attributes':_0x39f1c4[_0x5077('0x1d')],'include':_0x39f1c4[_0x5077('0x1e')]?_[_0x5077('0x20')](_0x39f1c4[_0x5077('0x1e')],function(_0x28ad04){return{'model':db[_0x28ad04[_0x5077('0x1f')]],'as':_0x28ad04['as'],'attributes':_0x28ad04[_0x5077('0x1d')],'include':_0x28ad04['include']?_[_0x5077('0x20')](_0x28ad04[_0x5077('0x1e')],function(_0x38c5d9){return{'model':db[_0x38c5d9[_0x5077('0x1f')]],'as':_0x38c5d9['as'],'attributes':_0x38c5d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x5077('0xc')](function(_0x2a7942){logger[_0x5077('0xd')](_0x5077('0x17'),_0x51df51);logger[_0x5077('0x10')](_0x5077('0x17'),_0x51df51,JSON['stringify'](_0x2a7942));_0x2888b7(_0x2a7942);})['catch'](function(_0x2a6d2c){logger[_0x5077('0x12')](_0x5077('0x17'),_0x2a6d2c[_0x5077('0x14')],_0x51df51);_0x487e0c(_0x39a6e2[_0x5077('0x12')](0x1f4,_0x2a6d2c['message']));});});}; \ No newline at end of file +var _0x16c5=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','ShowSetting','Setting','options','where','attributes','include','map','model','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3694af,_0x2a4dd3){var _0x4118e0=function(_0x4e93d8){while(--_0x4e93d8){_0x3694af['push'](_0x3694af['shift']());}};_0x4118e0(++_0x2a4dd3);}(_0x16c5,0x1c3));var _0x516c=function(_0x1e5f9c,_0x315418){_0x1e5f9c=_0x1e5f9c-0x0;var _0x286a62=_0x16c5[_0x1e5f9c];return _0x286a62;};'use strict';var _=require(_0x516c('0x0'));var util=require(_0x516c('0x1'));var moment=require(_0x516c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x516c('0x3'));var db=require(_0x516c('0x4'))['db'];var utils=require(_0x516c('0x5'));var logger=require(_0x516c('0x6'))(_0x516c('0x7'));var config=require(_0x516c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x516c('0x9')][_0x516c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1764a7,_0x2b430f,_0x22bae2){return new BPromise(function(_0x5f3c1d,_0x15b768){return client[_0x516c('0xb')](_0x1764a7,_0x22bae2)[_0x516c('0xc')](function(_0x44bead){logger[_0x516c('0xd')]('Setting,\x20%s,\x20%s',_0x2b430f,_0x516c('0xe'));logger['debug'](_0x516c('0xf'),_0x2b430f,_0x516c('0xe'),JSON[_0x516c('0x10')](_0x44bead));if(_0x44bead[_0x516c('0x11')]){if(_0x44bead[_0x516c('0x11')]['code']===0x1f4){logger[_0x516c('0x11')]('Setting,\x20%s,\x20%s',_0x2b430f,_0x44bead['error'][_0x516c('0x12')]);return _0x15b768(_0x44bead[_0x516c('0x11')]['message']);}logger[_0x516c('0x11')](_0x516c('0x13'),_0x2b430f,_0x44bead[_0x516c('0x11')][_0x516c('0x12')]);return _0x5f3c1d(_0x44bead[_0x516c('0x11')][_0x516c('0x12')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2b430f,_0x516c('0xe'));_0x5f3c1d(_0x44bead[_0x516c('0x14')][_0x516c('0x12')]);}})[_0x516c('0x15')](function(_0x2864ac){logger['error'](_0x516c('0x13'),_0x2b430f,_0x2864ac);_0x15b768(_0x2864ac);});});}exports[_0x516c('0x16')]=function(_0x527b5c){var _0x32f64f=this;return new Promise(function(_0x4db17d,_0x27a7dc){return db[_0x516c('0x17')]['find']({'raw':_0x527b5c[_0x516c('0x18')]?_0x527b5c[_0x516c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x527b5c[_0x516c('0x18')]?_0x527b5c[_0x516c('0x18')][_0x516c('0x19')]||null:null,'attributes':_0x527b5c[_0x516c('0x18')]?_0x527b5c['options'][_0x516c('0x1a')]||null:null,'include':_0x527b5c[_0x516c('0x18')]?_0x527b5c[_0x516c('0x18')][_0x516c('0x1b')]?_[_0x516c('0x1c')](_0x527b5c[_0x516c('0x18')][_0x516c('0x1b')],function(_0x1c79a0){return{'model':db[_0x1c79a0[_0x516c('0x1d')]],'as':_0x1c79a0['as'],'attributes':_0x1c79a0[_0x516c('0x1a')],'include':_0x1c79a0['include']?_[_0x516c('0x1c')](_0x1c79a0['include'],function(_0x128da9){return{'model':db[_0x128da9[_0x516c('0x1d')]],'as':_0x128da9['as'],'attributes':_0x128da9[_0x516c('0x1a')],'include':_0x128da9[_0x516c('0x1b')]?_[_0x516c('0x1c')](_0x128da9[_0x516c('0x1b')],function(_0x38d08b){return{'model':db[_0x38d08b[_0x516c('0x1d')]],'as':_0x38d08b['as'],'attributes':_0x38d08b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e8e9){logger[_0x516c('0xd')]('ShowSetting',_0x527b5c);logger[_0x516c('0x1e')](_0x516c('0x16'),_0x527b5c,JSON[_0x516c('0x10')](_0x18e8e9));_0x4db17d(_0x18e8e9);})[_0x516c('0x15')](function(_0x56343f){logger[_0x516c('0x11')](_0x516c('0x16'),_0x56343f[_0x516c('0x12')],_0x527b5c);_0x27a7dc(_0x32f64f[_0x516c('0x11')](0x1f4,_0x56343f[_0x516c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 430f91c..e5b98da 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x402ce9,_0x2b5343){var _0x44e437=function(_0x205250){while(--_0x205250){_0x402ce9['push'](_0x402ce9['shift']());}};_0x44e437(++_0x2b5343);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f6959,_0x116ca1){_0x4f6959=_0x4f6959-0x0;var _0x33d978=_0x1cb9[_0x4f6959];return _0x33d978;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3bc5da4..627fc11 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 _0xbcee=['clicksend','plivo','bandwidth','csc','infobip','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','exports','STRING','twilio','skebby','connectel'];(function(_0x20f6cc,_0x368286){var _0x22a83d=function(_0x1f68b6){while(--_0x1f68b6){_0x20f6cc['push'](_0x20f6cc['shift']());}};_0x22a83d(++_0x368286);}(_0xbcee,0xa4));var _0xebce=function(_0x1fd5ae,_0x1cd96c){_0x1fd5ae=_0x1fd5ae-0x0;var _0x5173a5=_0xbcee[_0x1fd5ae];return _0x5173a5;};'use strict';var Sequelize=require(_0xebce('0x0'));var rs=require('randomstring');module[_0xebce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xebce('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xebce('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xebce('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xebce('0x2')]},'type':{'type':Sequelize['ENUM'](_0xebce('0x3'),_0xebce('0x4'),_0xebce('0x5'),_0xebce('0x6'),_0xebce('0x7'),'clickatell',_0xebce('0x8'),_0xebce('0x9'),_0xebce('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xebce('0x2')]},'authId':{'type':Sequelize[_0xebce('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xebce('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0xebce('0x2')]},'password':{'type':Sequelize[_0xebce('0x2')]},'apiKey':{'type':Sequelize[_0xebce('0x2')]},'applicationId':{'type':Sequelize[_0xebce('0x2')]},'accountId':{'type':Sequelize[_0xebce('0x2')]},'senderString':{'type':Sequelize[_0xebce('0x2')]},'deliveryReport':{'type':Sequelize[_0xebce('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xebce('0x2')]},'notificationTemplate':{'type':Sequelize[_0xebce('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xebce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xebce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xebce('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xebce('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xebce('0xe')],'comment':_0xebce('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f7877){if(!_0x3f7877)this[_0xebce('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x3f7877);}}}; \ No newline at end of file +var _0x4cd9=['clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate','ENUM','twilio','skebby','connectel'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x4cd9,0x111));var _0x94cd=function(_0x4bde1e,_0x2b957e){_0x4bde1e=_0x4bde1e-0x0;var _0x787b7=_0x4cd9[_0x4bde1e];return _0x787b7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x94cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x94cd('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x94cd('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x94cd('0x2')]();}},'phone':{'type':Sequelize[_0x94cd('0x1')]},'type':{'type':Sequelize[_0x94cd('0x3')](_0x94cd('0x4'),_0x94cd('0x5'),_0x94cd('0x6'),_0x94cd('0x7'),_0x94cd('0x8'),_0x94cd('0x9'),_0x94cd('0xa'),_0x94cd('0xb'),_0x94cd('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x94cd('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x94cd('0x1')]},'smsMethod':{'type':Sequelize[_0x94cd('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x94cd('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x94cd('0x1')]},'applicationId':{'type':Sequelize[_0x94cd('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x94cd('0x1')]},'deliveryReport':{'type':Sequelize[_0x94cd('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x94cd('0x1')]},'notificationTemplate':{'type':Sequelize[_0x94cd('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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x94cd('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x94cd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x94cd('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x94cd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x94cd('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x94cd('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x94cd('0xd')],'defaultValue':![],'comment':_0x94cd('0x10'),'set':function(_0x405b57){if(!_0x405b57)this[_0x94cd('0x11')](_0x94cd('0x12'),null);this['setDataValue'](_0x94cd('0x13'),_0x405b57);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c3cd50a..c436920 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 _0x2f1e=['Body','messageId','MessageSid','skebby','from','sender','text','connectel','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','defaults','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','SmsMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','\x0a','addApplications','findOne','sequelize','transaction','findAndCountAll','priority','getApplications','CmContact','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','localhost','register','client','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','removeDispositions','ids','CannedAnswer','includeAll','removeAnswers','notify','SmsApplication','Applications','account','applications','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x2f1e,0x13b));var _0xe2f1=function(_0x77853f,_0xf6ee23){_0x77853f=_0x77853f-0x0;var _0x49270f=_0x2f1e[_0x77853f];return _0x49270f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2f1('0x0'));var zipdir=require(_0xe2f1('0x1'));var jsonpatch=require(_0xe2f1('0x2'));var rp=require(_0xe2f1('0x3'));var moment=require(_0xe2f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe2f1('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe2f1('0x6'));var csv=require('to-csv');var ejs=require(_0xe2f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2f1('0x8'));var squel=require(_0xe2f1('0x9'));var crypto=require(_0xe2f1('0xa'));var jsforce=require(_0xe2f1('0xb'));var deskjs=require(_0xe2f1('0xc'));var toCsv=require(_0xe2f1('0xd'));var querystring=require('querystring');var Papa=require(_0xe2f1('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe2f1('0xf'));var as=require(_0xe2f1('0x10'));var hardwareService=require(_0xe2f1('0x11'));var logger=require(_0xe2f1('0x12'))(_0xe2f1('0x13'));var utils=require(_0xe2f1('0x14'));var config=require(_0xe2f1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe2f1('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xe2f1('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe2f1('0x18')]['http']({'port':0x232c});function respondWithRpcPromise(_0x9b482c,_0x2b377a,_0x1b84f5,_0x23c252){return new BPromise(function(_0xd3d277,_0x1e3ec7){var _0xc727e5=_0x23c252||client;return _0xc727e5[_0xe2f1('0x19')](_0x9b482c,_0x1b84f5)[_0xe2f1('0x1a')](function(_0x34c17c){logger[_0xe2f1('0x1b')](_0xe2f1('0x1c'),_0x2b377a,'request\x20sent');logger[_0xe2f1('0x1d')](_0xe2f1('0x1e'),_0x2b377a,_0xe2f1('0x1f'),JSON[_0xe2f1('0x20')](_0x34c17c));if(_0x34c17c['error']){if(_0x34c17c[_0xe2f1('0x21')][_0xe2f1('0x22')]===0x1f4){logger[_0xe2f1('0x21')](_0xe2f1('0x1c'),_0x2b377a,_0x34c17c[_0xe2f1('0x21')][_0xe2f1('0x23')]);return _0x1e3ec7(_0x34c17c[_0xe2f1('0x21')][_0xe2f1('0x23')]);}logger['error'](_0xe2f1('0x1c'),_0x2b377a,_0x34c17c['error'][_0xe2f1('0x23')]);return _0xd3d277(_0x34c17c[_0xe2f1('0x21')][_0xe2f1('0x23')]);}else{logger[_0xe2f1('0x1b')](_0xe2f1('0x1c'),_0x2b377a,_0xe2f1('0x1f'));_0xd3d277(_0x34c17c[_0xe2f1('0x24')][_0xe2f1('0x23')]);}})[_0xe2f1('0x25')](function(_0x589306){logger[_0xe2f1('0x21')](_0xe2f1('0x1c'),_0x2b377a,_0x589306);_0x1e3ec7(_0x589306);});});}function respondWithStatusCode(_0x37e7e7,_0x34d516){_0x34d516=_0x34d516||0xcc;return function(_0x3077ca){if(_0x3077ca){return _0x37e7e7[_0xe2f1('0x26')](_0x34d516);}return _0x37e7e7[_0xe2f1('0x27')](_0x34d516)[_0xe2f1('0x28')]();};}function respondWithResult(_0x613a7c,_0x24175f){_0x24175f=_0x24175f||0xc8;return function(_0x4fc5e4){if(_0x4fc5e4){return _0x613a7c[_0xe2f1('0x27')](_0x24175f)[_0xe2f1('0x29')](_0x4fc5e4);}};}function respondWithFilteredResult(_0x48ae77,_0x139754){return function(_0x1a5120){if(_0x1a5120){var _0x129906=typeof _0x139754['offset']===_0xe2f1('0x2a')&&typeof _0x139754[_0xe2f1('0x2b')]==='undefined';var _0x40f9e2=_0x1a5120['count'];var _0x4ba8bb=_0x129906?0x0:_0x139754['offset'];var _0x4b45a4=_0x129906?_0x1a5120[_0xe2f1('0x2c')]:_0x139754['offset']+_0x139754[_0xe2f1('0x2b')];var _0x1c6ede;if(_0x4b45a4>=_0x40f9e2){_0x4b45a4=_0x40f9e2;_0x1c6ede=0xc8;}else{_0x1c6ede=0xce;}_0x48ae77[_0xe2f1('0x27')](_0x1c6ede);return _0x48ae77[_0xe2f1('0x2d')](_0xe2f1('0x2e'),_0x4ba8bb+'-'+_0x4b45a4+'/'+_0x40f9e2)['json'](_0x1a5120);}return null;};}function patchUpdates(_0xd0e7e8){return function(_0x5719ab){try{jsonpatch['apply'](_0x5719ab,_0xd0e7e8,!![]);}catch(_0x162b33){return BPromise[_0xe2f1('0x2f')](_0x162b33);}return _0x5719ab[_0xe2f1('0x30')]();};}function saveUpdates(_0x282cdd,_0x2882ad){return function(_0x5b7e45){if(_0x5b7e45){return _0x5b7e45[_0xe2f1('0x31')](_0x282cdd)[_0xe2f1('0x1a')](function(_0x18ceb0){return _0x18ceb0;});}return null;};}function removeEntity(_0x1d62d,_0x1eb34e){return function(_0x2b6a06){if(_0x2b6a06){return _0x2b6a06[_0xe2f1('0x32')]()[_0xe2f1('0x1a')](function(){var _0x3a9e3f=_0x2b6a06[_0xe2f1('0x33')]({'plain':!![]});var _0x5a1606=_0xe2f1('0x34');return db['UserProfileResource'][_0xe2f1('0x32')]({'where':{'type':_0x5a1606,'resourceId':_0x3a9e3f['id']}})[_0xe2f1('0x1a')](function(){return _0x2b6a06;});})[_0xe2f1('0x1a')](function(){_0x1d62d[_0xe2f1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5840e8,_0xb478c7){return function(_0x2771bc){if(!_0x2771bc){_0x5840e8[_0xe2f1('0x26')](0x194);}return _0x2771bc;};}function handleError(_0x43d041,_0x378e62){_0x378e62=_0x378e62||0x1f4;return function(_0x4f5fc1){logger[_0xe2f1('0x21')](_0x4f5fc1[_0xe2f1('0x35')]);if(_0x4f5fc1[_0xe2f1('0x36')]){delete _0x4f5fc1[_0xe2f1('0x36')];}_0x43d041['status'](_0x378e62)[_0xe2f1('0x37')](_0x4f5fc1);};}exports[_0xe2f1('0x38')]=function(_0x30f968,_0x562f20){var _0x2270a1={'include':[{'model':db[_0xe2f1('0x39')],'as':_0xe2f1('0x3a')}]},_0x3f7c0f={},_0x106725={'count':0x0,'rows':[]};var _0x57e2c9=_[_0xe2f1('0x3b')](db[_0xe2f1('0x3c')][_0xe2f1('0x3d')],function(_0x185f65){return{'name':_0x185f65['fieldName'],'type':_0x185f65[_0xe2f1('0x3e')]['key']};});_0x3f7c0f[_0xe2f1('0x3f')]=_[_0xe2f1('0x3b')](_0x57e2c9,_0xe2f1('0x36'));_0x3f7c0f['query']=_[_0xe2f1('0x40')](_0x30f968[_0xe2f1('0x41')]);_0x3f7c0f[_0xe2f1('0x42')]=_[_0xe2f1('0x43')](_0x3f7c0f[_0xe2f1('0x3f')],_0x3f7c0f[_0xe2f1('0x41')]);_0x2270a1[_0xe2f1('0x44')]=_[_0xe2f1('0x43')](_0x3f7c0f[_0xe2f1('0x3f')],qs[_0xe2f1('0x45')](_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x2270a1[_0xe2f1('0x44')]=_0x2270a1[_0xe2f1('0x44')]['length']?_0x2270a1[_0xe2f1('0x44')]:_0x3f7c0f['model'];if(!_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x46')](_0xe2f1('0x47'))){_0x2270a1[_0xe2f1('0x2b')]=qs[_0xe2f1('0x2b')](_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x2b')]);_0x2270a1[_0xe2f1('0x48')]=qs['offset'](_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x48')]);}_0x2270a1[_0xe2f1('0x49')]=qs[_0xe2f1('0x4a')](_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x4a')]);_0x2270a1[_0xe2f1('0x4b')]=qs[_0xe2f1('0x42')](_[_0xe2f1('0x4c')](_0x30f968[_0xe2f1('0x41')],_0x3f7c0f[_0xe2f1('0x42')]),_0x57e2c9);if(_0x30f968[_0xe2f1('0x41')]['filter']){_0x2270a1['where']=_[_0xe2f1('0x4d')](_0x2270a1[_0xe2f1('0x4b')],{'$or':_[_0xe2f1('0x3b')](_0x57e2c9,function(_0x2f7aad){if(_0x2f7aad[_0xe2f1('0x3e')]!==_0xe2f1('0x4e')){var _0xbbb114={};_0xbbb114[_0x2f7aad[_0xe2f1('0x36')]]={'$like':'%'+_0x30f968[_0xe2f1('0x41')][_0xe2f1('0x4f')]+'%'};return _0xbbb114;}})});}_0x2270a1=_['merge']({},_0x2270a1,_0x30f968[_0xe2f1('0x50')]);var _0x2da7ca={'where':_0x2270a1[_0xe2f1('0x4b')]};return db['SmsAccount'][_0xe2f1('0x2c')](_0x2da7ca)['then'](function(_0xf9cba3){_0x106725[_0xe2f1('0x2c')]=_0xf9cba3;if(_0x30f968[_0xe2f1('0x41')]['includeAll']){_0x2270a1[_0xe2f1('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0xe2f1('0x52')](_0x2270a1);})[_0xe2f1('0x1a')](function(_0x11b227){_0x106725[_0xe2f1('0x53')]=_0x11b227;return _0x106725;})[_0xe2f1('0x1a')](respondWithFilteredResult(_0x562f20,_0x2270a1))[_0xe2f1('0x25')](handleError(_0x562f20,null));};exports[_0xe2f1('0x54')]=function(_0x3a4733,_0x1008b8){var _0x4a6f99={'raw':![],'where':{'id':_0x3a4733['params']['id']},'include':[{'model':db['Pause'],'as':_0xe2f1('0x3a')}]},_0x23a294={};_0x23a294['model']=_[_0xe2f1('0x40')](db[_0xe2f1('0x3c')][_0xe2f1('0x3d')]);_0x23a294['query']=_[_0xe2f1('0x40')](_0x3a4733['query']);_0x23a294[_0xe2f1('0x42')]=_['intersection'](_0x23a294[_0xe2f1('0x3f')],_0x23a294['query']);_0x4a6f99[_0xe2f1('0x44')]=_['intersection'](_0x23a294[_0xe2f1('0x3f')],qs['fields'](_0x3a4733[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x4a6f99['attributes']=_0x4a6f99[_0xe2f1('0x44')]['length']?_0x4a6f99[_0xe2f1('0x44')]:_0x23a294[_0xe2f1('0x3f')];if(_0x3a4733[_0xe2f1('0x41')]['includeAll']){_0x4a6f99[_0xe2f1('0x51')]=[{'all':!![]}];}_0x4a6f99=_[_0xe2f1('0x4d')]({},_0x4a6f99,_0x3a4733[_0xe2f1('0x50')]);return db[_0xe2f1('0x3c')][_0xe2f1('0x55')](_0x4a6f99)['then'](handleEntityNotFound(_0x1008b8,null))[_0xe2f1('0x1a')](respondWithResult(_0x1008b8,null))['catch'](handleError(_0x1008b8,null));};exports['create']=function(_0x2c3f15,_0x222eb8){return db[_0xe2f1('0x3c')][_0xe2f1('0x56')](_0x2c3f15[_0xe2f1('0x57')],{})[_0xe2f1('0x1a')](function(_0x586bd4){var _0x1b3fa5=_0x2c3f15['user'][_0xe2f1('0x33')]({'plain':!![]});if(!_0x1b3fa5)throw new Error(_0xe2f1('0x58'));if(_0x1b3fa5[_0xe2f1('0x59')]==='user'){var _0x1668af=_0x586bd4['get']({'plain':!![]});var _0x37a0f0=_0xe2f1('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x37a0f0,'userProfileId':_0x1b3fa5[_0xe2f1('0x5a')]},'raw':!![]})[_0xe2f1('0x1a')](function(_0x2a1974){if(_0x2a1974&&_0x2a1974[_0xe2f1('0x5b')]===0x0){return db[_0xe2f1('0x5c')][_0xe2f1('0x56')]({'name':_0x1668af[_0xe2f1('0x36')],'resourceId':_0x1668af['id'],'type':_0x2a1974[_0xe2f1('0x36')],'sectionId':_0x2a1974['id']},{})['then'](function(){return _0x586bd4;});}else{return _0x586bd4;}})[_0xe2f1('0x25')](function(_0x269b8e){logger[_0xe2f1('0x21')](_0xe2f1('0x5d'),_0x269b8e);throw _0x269b8e;});}return _0x586bd4;})[_0xe2f1('0x1a')](respondWithResult(_0x222eb8,0xc9))['catch'](handleError(_0x222eb8,null));};exports[_0xe2f1('0x31')]=function(_0x403b33,_0x3b40e0){if(_0x403b33[_0xe2f1('0x57')]['id']){delete _0x403b33[_0xe2f1('0x57')]['id'];}return db['SmsAccount'][_0xe2f1('0x55')]({'where':{'id':_0x403b33[_0xe2f1('0x5e')]['id']},'include':[{'model':db[_0xe2f1('0x39')],'as':_0xe2f1('0x3a')}]})[_0xe2f1('0x1a')](handleEntityNotFound(_0x3b40e0,null))[_0xe2f1('0x1a')](saveUpdates(_0x403b33[_0xe2f1('0x57')],null))[_0xe2f1('0x1a')](respondWithResult(_0x3b40e0,null))[_0xe2f1('0x25')](handleError(_0x3b40e0,null));};exports[_0xe2f1('0x32')]=function(_0x47c289,_0x5a307c){return db[_0xe2f1('0x3c')][_0xe2f1('0x55')]({'where':{'id':_0x47c289[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x5a307c,null))[_0xe2f1('0x1a')](removeEntity(_0x5a307c,null))[_0xe2f1('0x25')](handleError(_0x5a307c,null));};exports[_0xe2f1('0x5f')]=function(_0x31e251,_0x559ecb){return db[_0xe2f1('0x3c')][_0xe2f1('0x5f')]()[_0xe2f1('0x1a')](respondWithResult(_0x559ecb,null))['catch'](handleError(_0x559ecb,null));};exports[_0xe2f1('0x60')]=function(_0x15a3d0,_0x20cbd6,_0x11c837){if(_0x15a3d0['body']['id']){delete _0x15a3d0[_0xe2f1('0x57')]['id'];}return db['SmsAccount'][_0xe2f1('0x55')]({'where':{'id':_0x15a3d0['params']['id']}})['then'](handleEntityNotFound(_0x20cbd6,null))[_0xe2f1('0x1a')](function(_0xfd4dfe){if(_0xfd4dfe){_0x15a3d0['body'][_0xe2f1('0x61')]=_0xfd4dfe['id'];return db[_0xe2f1('0x62')]['create'](_0x15a3d0[_0xe2f1('0x57')]);}})[_0xe2f1('0x1a')](respondWithResult(_0x20cbd6,null))[_0xe2f1('0x25')](handleError(_0x20cbd6,null));};exports[_0xe2f1('0x63')]=function(_0x215c5a,_0x91f2df,_0x33d13a){var _0x2cddb4={'raw':![],'where':{}};var _0x2b656={};var _0x2eaaae={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x215c5a[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x91f2df,null))[_0xe2f1('0x1a')](function(_0x414c24){if(_0x414c24){_0x2b656['model']=_[_0xe2f1('0x40')](db[_0xe2f1('0x62')][_0xe2f1('0x3d')]);_0x2b656[_0xe2f1('0x41')]=_['keys'](_0x215c5a[_0xe2f1('0x41')]);_0x2b656[_0xe2f1('0x42')]=_['intersection'](_0x2b656[_0xe2f1('0x3f')],_0x2b656['query']);_0x2cddb4[_0xe2f1('0x44')]=_[_0xe2f1('0x43')](_0x2b656['model'],qs[_0xe2f1('0x45')](_0x215c5a[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x2cddb4[_0xe2f1('0x44')]=_0x2cddb4['attributes'][_0xe2f1('0x64')]?_0x2cddb4[_0xe2f1('0x44')]:_0x2b656[_0xe2f1('0x3f')];if(!_0x215c5a[_0xe2f1('0x41')][_0xe2f1('0x46')]('nolimit')){_0x2cddb4[_0xe2f1('0x2b')]=qs[_0xe2f1('0x2b')](_0x215c5a['query']['limit']);_0x2cddb4[_0xe2f1('0x48')]=qs[_0xe2f1('0x48')](_0x215c5a['query'][_0xe2f1('0x48')]);}_0x2cddb4[_0xe2f1('0x49')]=qs['sort'](_0x215c5a[_0xe2f1('0x41')][_0xe2f1('0x4a')]);_0x2cddb4[_0xe2f1('0x4b')]=qs['filters'](_[_0xe2f1('0x4c')](_0x215c5a['query'],_0x2b656['filters']));_0x2cddb4[_0xe2f1('0x4b')][_0xe2f1('0x61')]=_0x414c24['id'];if(_0x215c5a[_0xe2f1('0x41')]['filter']){_0x2cddb4[_0xe2f1('0x4b')]=_[_0xe2f1('0x4d')](_0x2cddb4[_0xe2f1('0x4b')],{'$or':_[_0xe2f1('0x3b')](_0x2cddb4[_0xe2f1('0x44')],function(_0x5a5ea6){var _0x2001f6={};_0x2001f6[_0x5a5ea6]={'$like':'%'+_0x215c5a['query'][_0xe2f1('0x4f')]+'%'};return _0x2001f6;})});}_0x2cddb4=_[_0xe2f1('0x4d')]({},_0x2cddb4,_0x215c5a[_0xe2f1('0x50')]);return db[_0xe2f1('0x62')][_0xe2f1('0x2c')]({'where':_0x2cddb4[_0xe2f1('0x4b')]})[_0xe2f1('0x1a')](function(_0x42c06e){_0x2eaaae['count']=_0x42c06e;if(_0x215c5a[_0xe2f1('0x41')]['includeAll']){_0x2cddb4[_0xe2f1('0x51')]=[{'all':!![]}];}return db[_0xe2f1('0x62')][_0xe2f1('0x52')](_0x2cddb4);})[_0xe2f1('0x1a')](function(_0x1f16cd){_0x2eaaae[_0xe2f1('0x53')]=_0x1f16cd;return _0x2eaaae;});}})['then'](respondWithFilteredResult(_0x91f2df,_0x2cddb4))['catch'](handleError(_0x91f2df,null));};exports[_0xe2f1('0x65')]=function(_0x4308d7,_0x5efd26,_0x345164){return db[_0xe2f1('0x3c')]['find']({'where':{'id':_0x4308d7[_0xe2f1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5efd26,null))[_0xe2f1('0x1a')](function(_0x53ee28){if(_0x53ee28){return _0x53ee28[_0xe2f1('0x65')](_0x4308d7[_0xe2f1('0x41')][_0xe2f1('0x66')]);}})[_0xe2f1('0x1a')](respondWithStatusCode(_0x5efd26,null))[_0xe2f1('0x25')](handleError(_0x5efd26,null));};exports['addAnswer']=function(_0x461b39,_0x365e4d,_0x21e499){if(_0x461b39[_0xe2f1('0x57')]['id']){delete _0x461b39[_0xe2f1('0x57')]['id'];}return db[_0xe2f1('0x3c')]['find']({'where':{'id':_0x461b39[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x365e4d,null))[_0xe2f1('0x1a')](function(_0x136dd5){if(_0x136dd5){_0x461b39[_0xe2f1('0x57')][_0xe2f1('0x61')]=_0x136dd5['id'];return db[_0xe2f1('0x67')][_0xe2f1('0x56')](_0x461b39[_0xe2f1('0x57')]);}})['then'](respondWithResult(_0x365e4d,null))[_0xe2f1('0x25')](handleError(_0x365e4d,null));};exports['getAnswers']=function(_0x28f45b,_0x3d9f19,_0x14cd9b){var _0x4313fb={'raw':![],'where':{}};var _0x3d5dea={};var _0x5c37db={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x28f45b[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x3d9f19,null))[_0xe2f1('0x1a')](function(_0x544dba){if(_0x544dba){_0x3d5dea[_0xe2f1('0x3f')]=_['keys'](db['CannedAnswer'][_0xe2f1('0x3d')]);_0x3d5dea[_0xe2f1('0x41')]=_[_0xe2f1('0x40')](_0x28f45b[_0xe2f1('0x41')]);_0x3d5dea[_0xe2f1('0x42')]=_['intersection'](_0x3d5dea[_0xe2f1('0x3f')],_0x3d5dea['query']);_0x4313fb[_0xe2f1('0x44')]=_[_0xe2f1('0x43')](_0x3d5dea[_0xe2f1('0x3f')],qs[_0xe2f1('0x45')](_0x28f45b[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x4313fb[_0xe2f1('0x44')]=_0x4313fb['attributes'][_0xe2f1('0x64')]?_0x4313fb[_0xe2f1('0x44')]:_0x3d5dea['model'];if(!_0x28f45b['query'][_0xe2f1('0x46')]('nolimit')){_0x4313fb[_0xe2f1('0x2b')]=qs['limit'](_0x28f45b[_0xe2f1('0x41')]['limit']);_0x4313fb[_0xe2f1('0x48')]=qs[_0xe2f1('0x48')](_0x28f45b[_0xe2f1('0x41')]['offset']);}_0x4313fb[_0xe2f1('0x49')]=qs[_0xe2f1('0x4a')](_0x28f45b[_0xe2f1('0x41')]['sort']);_0x4313fb[_0xe2f1('0x4b')]=qs[_0xe2f1('0x42')](_[_0xe2f1('0x4c')](_0x28f45b['query'],_0x3d5dea[_0xe2f1('0x42')]));_0x4313fb[_0xe2f1('0x4b')][_0xe2f1('0x61')]=_0x544dba['id'];if(_0x28f45b[_0xe2f1('0x41')][_0xe2f1('0x4f')]){_0x4313fb[_0xe2f1('0x4b')]=_[_0xe2f1('0x4d')](_0x4313fb[_0xe2f1('0x4b')],{'$or':_['map'](_0x4313fb[_0xe2f1('0x44')],function(_0x40fe08){var _0x8e6da9={};_0x8e6da9[_0x40fe08]={'$like':'%'+_0x28f45b[_0xe2f1('0x41')][_0xe2f1('0x4f')]+'%'};return _0x8e6da9;})});}_0x4313fb=_['merge']({},_0x4313fb,_0x28f45b['options']);return db[_0xe2f1('0x67')][_0xe2f1('0x2c')]({'where':_0x4313fb['where']})[_0xe2f1('0x1a')](function(_0x12136f){_0x5c37db[_0xe2f1('0x2c')]=_0x12136f;if(_0x28f45b[_0xe2f1('0x41')][_0xe2f1('0x68')]){_0x4313fb[_0xe2f1('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe2f1('0x52')](_0x4313fb);})[_0xe2f1('0x1a')](function(_0x368fab){_0x5c37db[_0xe2f1('0x53')]=_0x368fab;return _0x5c37db;});}})[_0xe2f1('0x1a')](respondWithFilteredResult(_0x3d9f19,_0x4313fb))[_0xe2f1('0x25')](handleError(_0x3d9f19,null));};exports[_0xe2f1('0x69')]=function(_0x1f1ade,_0x5b0fe2,_0x5c0891){return db['SmsAccount'][_0xe2f1('0x55')]({'where':{'id':_0x1f1ade['params']['id']}})['then'](handleEntityNotFound(_0x5b0fe2,null))[_0xe2f1('0x1a')](function(_0x231a93){if(_0x231a93){return _0x231a93[_0xe2f1('0x69')](_0x1f1ade[_0xe2f1('0x41')][_0xe2f1('0x66')]);}})[_0xe2f1('0x1a')](respondWithStatusCode(_0x5b0fe2,null))['catch'](handleError(_0x5b0fe2,null));};exports[_0xe2f1('0x6a')]=function(_0x2f4687,_0x27743e,_0x166d1c){var _0x49eeeb={'channel':'sms'};var _0x2a2944=[];var _0x565f7f=[];var _0x1591b7={};return db[_0xe2f1('0x3c')][_0xe2f1('0x55')]({'where':{'id':_0x2f4687['params']['id']},'include':[{'model':db[_0xe2f1('0x6b')],'as':_0xe2f1('0x6c')}]})['then'](handleEntityNotFound(_0x27743e,null))[_0xe2f1('0x1a')](function(_0x22d10a){_0x49eeeb[_0xe2f1('0x6d')]=_0x22d10a;_0x49eeeb[_0xe2f1('0x6e')]=_['orderBy'](_0x22d10a[_0xe2f1('0x6c')],['priority'],['asc']);if(_0x49eeeb['account']['Applications']){delete _0x49eeeb[_0xe2f1('0x6d')][_0xe2f1('0x6c')];}return db['CmContact'][_0xe2f1('0x5f')]();})['then'](function(_0x18a45a){if(!_0x18a45a){throw new db[(_0xe2f1('0x6f'))][(_0xe2f1('0x70'))](_0xe2f1('0x71'));}_0x2a2944=_[_0xe2f1('0x72')](_[_0xe2f1('0x40')](_0x18a45a),[_0xe2f1('0x73'),_0xe2f1('0x74')]);_0x565f7f=_[_0xe2f1('0x72')](_[_0xe2f1('0x40')](_0x18a45a),[_0xe2f1('0x73'),'updatedAt',_0xe2f1('0x75'),_0xe2f1('0x76')]);_0x49eeeb[_0xe2f1('0x57')]={'mapKey':_0xe2f1('0x77')};if(_0x49eeeb[_0xe2f1('0x6d')][_0xe2f1('0x3e')]){switch(_0x49eeeb[_0xe2f1('0x6d')][_0xe2f1('0x3e')]){case'twilio':_0x49eeeb[_0xe2f1('0x57')]['from']=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x78')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x79')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7a')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x7b')];break;case _0xe2f1('0x7c'):_0x49eeeb['body'][_0xe2f1('0x7d')]='+'+_0x2f4687['body'][_0xe2f1('0x7e')];_0x49eeeb[_0xe2f1('0x57')]['body']=_0x2f4687['body'][_0xe2f1('0x7f')];break;case _0xe2f1('0x80'):_0x49eeeb[_0xe2f1('0x57')]['from']=_0x2f4687[_0xe2f1('0x57')]['from'];_0x49eeeb['body'][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')]['message'];break;case'clicksend':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')]['from'];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')]['body'];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7a')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x81')];break;case _0xe2f1('0x82'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x78')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x83')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7a')]=_0x2f4687[_0xe2f1('0x57')]['MessageUUID'];break;case _0xe2f1('0x84'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]='+'+_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x85')][0x0][_0xe2f1('0x7d')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x85')][0x0]['text'];_0x49eeeb[_0xe2f1('0x57')]['messageId']=_0x2f4687[_0xe2f1('0x57')]['results'][0x0][_0xe2f1('0x7a')];break;case _0xe2f1('0x86'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x87')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687['body'][_0xe2f1('0x88')]['message'];break;case _0xe2f1('0x89'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x8a')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x7f')];_0x49eeeb['body'][_0xe2f1('0x7a')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x8b')];break;case _0xe2f1('0x8c'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7a')]=_0x2f4687[_0xe2f1('0x57')][0x0][_0xe2f1('0x23')]['id'];_0x49eeeb['body'][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')][0x0][_0xe2f1('0x23')]['from'];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][0x0]['message']['text'];break;case _0xe2f1('0x8d'):_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x7d')];_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x23')];_0x49eeeb[_0xe2f1('0x57')]['messageId']=_0x2f4687[_0xe2f1('0x57')][_0xe2f1('0x8e')];break;}}if(_0x49eeeb['body']['id']){delete _0x49eeeb['body']['id'];}if(_[_0xe2f1('0x8f')](_0x49eeeb['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xe2f1('0x90'));}if(_[_0xe2f1('0x8f')](_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')])||_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')]===''){throw new db[(_0xe2f1('0x6f'))][(_0xe2f1('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x91')])){throw new db[(_0xe2f1('0x6f'))]['ValidationError'](_0xe2f1('0x92')+_0x565f7f);}if(!_[_0xe2f1('0x93')](_0x565f7f,_0x49eeeb['body'][_0xe2f1('0x91')])){throw new db[(_0xe2f1('0x6f'))][(_0xe2f1('0x70'))](_0xe2f1('0x94')+_0x565f7f);}_0x1591b7[_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x91')]]=_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')];return db[_0xe2f1('0x95')]['find']({'where':{'id':_0x49eeeb['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xe2f1('0x96'),'where':_0x1591b7,'limit':0x1,'order':[[_0xe2f1('0x74'),_0xe2f1('0x97')]]}]});})[_0xe2f1('0x1a')](handleEntityNotFound(_0x27743e,null))['then'](function(_0x10af78){if(_0x10af78){_0x49eeeb['list']=_['omit'](_0x10af78,['Contacts']);if(_0x10af78[_0xe2f1('0x96')][_0xe2f1('0x64')]){return _0x10af78[_0xe2f1('0x96')][0x0];}var _0x300065=_[_0xe2f1('0x98')](_0x49eeeb[_0xe2f1('0x57')],{'firstName':_0x49eeeb[_0xe2f1('0x57')]['from'],'ListId':_0x10af78['id']});_0x300065[_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x91')]]=_0x49eeeb['body']['from'];return db['CmContact'][_0xe2f1('0x56')](_0x300065,{'fields':_0x2a2944,'raw':!![]});}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x27743e,null))[_0xe2f1('0x1a')](function(_0x619294){if(_0x619294){_0x49eeeb[_0xe2f1('0x99')]=_0x619294;var _0x47c9ee={'ContactId':_0x619294['id'],'phone':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')],'SmsAccountId':_0x2f4687[_0xe2f1('0x5e')]['id']};var _0x1ca5e1={'ContactId':_0x619294['id'],'SmsAccountId':_0x2f4687['params']['id'],'closed':![]};return db[_0xe2f1('0x9a')]['find']({'where':_0x1ca5e1})[_0xe2f1('0x1a')](function(_0x2c3c27){if(_0x2c3c27){return[_0x2c3c27,![]];}return db['SmsInteraction'][_0xe2f1('0x56')](_0x47c9ee)[_0xe2f1('0x1a')](function(_0x233061){return[_0x233061,!![]];});});}})[_0xe2f1('0x9b')](function(_0xda9512,_0x2dc5f8){_0x49eeeb['interaction']=_0xda9512[_0xe2f1('0x33')]({'plain':!![]});_0x49eeeb[_0xe2f1('0x9c')][_0xe2f1('0x9d')]=![];if(_0x2dc5f8){if(_0x49eeeb['account']['autoclose']){_0x49eeeb['applications'][_0xe2f1('0x9e')]({'id':0x0,'priority':_0x49eeeb[_0xe2f1('0x6e')][_0xe2f1('0x64')]+0x1,'app':_0xe2f1('0x9f'),'appdata':_0xe2f1('0xa0'),'interval':'*,*,*,*'});}_0x49eeeb[_0xe2f1('0x9c')]['created']=!![];}return db[_0xe2f1('0xa1')][_0xe2f1('0x56')]({'phone':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7d')],'messageId':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x7a')],'body':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0x57')],'SmsAccountId':_0x2f4687[_0xe2f1('0x5e')]['id'],'SmsInteractionId':_0xda9512['id'],'direction':'in','ContactId':_0xda9512['ContactId'],'AttachmentId':_0x49eeeb[_0xe2f1('0x57')][_0xe2f1('0xa2')]});})[_0xe2f1('0x1a')](function(_0x54bcb9){_0x49eeeb[_0xe2f1('0x23')]=_0x54bcb9;if(_0x49eeeb[_0xe2f1('0x9c')][_0xe2f1('0xa3')]){return db[_0xe2f1('0xa4')][_0xe2f1('0x55')]({'attributes':['id',_0xe2f1('0x36')],'where':{'id':_0x49eeeb[_0xe2f1('0x9c')][_0xe2f1('0xa3')]}})[_0xe2f1('0x1a')](function(_0x1589e8){if(_0x1589e8){_0x49eeeb['applications'][_0xe2f1('0xa5')]({'id':0x0,'priority':0x0,'app':_0xe2f1('0xa6'),'appdata':_0x1589e8[_0xe2f1('0x36')]+','+(_0x49eeeb[_0xe2f1('0x6d')]['waitForTheAssignedAgent']||0xa),'interval':_0xe2f1('0xa7')});}return respondWithRpcPromise('Start',_0xe2f1('0xa8'),_0x49eeeb);});}return respondWithRpcPromise(_0xe2f1('0xa9'),_0xe2f1('0xa8'),_0x49eeeb);})[_0xe2f1('0x1a')](function(_0x300a30){if(_0x300a30){var _0x5d76fb=0xc8;var _0x409bb5=_0xe2f1('0xaa');logger[_0xe2f1('0x1b')](_0xe2f1('0x1e'),_0x409bb5,_0x5d76fb,'entity\x20found');logger[_0xe2f1('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x409bb5,_0x5d76fb,_0xe2f1('0xab'),JSON[_0xe2f1('0x20')](_0x300a30));if(_0x49eeeb['account'][_0xe2f1('0x3e')]===_0xe2f1('0xac')){return _0x27743e[_0xe2f1('0x27')](_0x5d76fb)[_0xe2f1('0x2d')](_0xe2f1('0xad'),_0xe2f1('0xae'))['send'](_0xe2f1('0xaf'));}else{return _0x27743e[_0xe2f1('0x27')](_0x5d76fb)[_0xe2f1('0x29')](_0x300a30);}}})[_0xe2f1('0x25')](handleError(_0x27743e,null));};exports[_0xe2f1('0xb0')]=function(_0x2c6565,_0x34c492,_0x5a3875){return db[_0xe2f1('0x3c')][_0xe2f1('0xb1')]({'where':{'id':_0x2c6565[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x34c492,null))[_0xe2f1('0x1a')](function(_0x4e3b17){if(_0x4e3b17){return db[_0xe2f1('0xb2')][_0xe2f1('0xb3')](function(_0x55f8a9){return db[_0xe2f1('0x6b')][_0xe2f1('0x32')]({'where':{'SmsAccountId':_0x2c6565[_0xe2f1('0x5e')]['id']},'transaction':_0x55f8a9})['then'](function(_0x158a77){var _0x2703ca=_['map'](_0x2c6565['body'],function(_0x2d6b7a){_0x2d6b7a[_0xe2f1('0x61')]=_0x2c6565['params']['id'];return _0x2d6b7a;});return db[_0xe2f1('0x6b')]['bulkCreate'](_0x2703ca,{'transaction':_0x55f8a9});});})[_0xe2f1('0x1a')](function(){return db[_0xe2f1('0x6b')][_0xe2f1('0xb4')]({'where':{'SmsAccountId':_0x2c6565[_0xe2f1('0x5e')]['id']},'order':_0xe2f1('0xb5')});});}})['then'](respondWithResult(_0x34c492,null))[_0xe2f1('0x25')](handleError(_0x34c492,null));};exports[_0xe2f1('0xb6')]=function(_0x382720,_0x40f725,_0x2c7cdf){var _0x18adaf={};var _0x1b599e={};var _0x1b580b;var _0x29e187;return db[_0xe2f1('0x3c')][_0xe2f1('0xb1')]({'where':{'id':_0x382720['params']['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x40f725,null))['then'](function(_0x5b8384){if(_0x5b8384){_0x1b580b=_0x5b8384;_0x1b599e[_0xe2f1('0x3f')]=_['keys'](db[_0xe2f1('0x6b')][_0xe2f1('0x3d')]);_0x1b599e[_0xe2f1('0x41')]=_['keys'](_0x382720['query']);_0x1b599e['filters']=_[_0xe2f1('0x43')](_0x1b599e[_0xe2f1('0x3f')],_0x1b599e['query']);_0x18adaf[_0xe2f1('0x44')]=_['intersection'](_0x1b599e[_0xe2f1('0x3f')],qs['fields'](_0x382720[_0xe2f1('0x41')]['fields']));_0x18adaf[_0xe2f1('0x44')]=_0x18adaf[_0xe2f1('0x44')][_0xe2f1('0x64')]?_0x18adaf[_0xe2f1('0x44')]:_0x1b599e[_0xe2f1('0x3f')];_0x18adaf[_0xe2f1('0x49')]=qs['sort'](_0x382720[_0xe2f1('0x41')][_0xe2f1('0x4a')]);_0x18adaf[_0xe2f1('0x4b')]=qs['filters'](_[_0xe2f1('0x4c')](_0x382720[_0xe2f1('0x41')],_0x1b599e[_0xe2f1('0x42')]));if(_0x382720[_0xe2f1('0x41')][_0xe2f1('0x4f')]){_0x18adaf['where']=_[_0xe2f1('0x4d')](_0x18adaf[_0xe2f1('0x4b')],{'$or':_[_0xe2f1('0x3b')](_0x18adaf[_0xe2f1('0x44')],function(_0x524f7c){var _0x39e51c={};_0x39e51c[_0x524f7c]={'$like':'%'+_0x382720[_0xe2f1('0x41')][_0xe2f1('0x4f')]+'%'};return _0x39e51c;})});}_0x18adaf=_[_0xe2f1('0x4d')]({},_0x18adaf,_0x382720[_0xe2f1('0x50')]);return _0x1b580b[_0xe2f1('0xb6')](_0x18adaf);}})['then'](function(_0x49f14f){if(_0x49f14f){_0x29e187=_0x49f14f[_0xe2f1('0x64')];if(!_0x382720[_0xe2f1('0x41')][_0xe2f1('0x46')]('nolimit')){_0x18adaf[_0xe2f1('0x2b')]=qs[_0xe2f1('0x2b')](_0x382720['query'][_0xe2f1('0x2b')]);_0x18adaf[_0xe2f1('0x48')]=qs[_0xe2f1('0x48')](_0x382720[_0xe2f1('0x41')][_0xe2f1('0x48')]);}return _0x1b580b[_0xe2f1('0xb6')](_0x18adaf);}})[_0xe2f1('0x1a')](function(_0x51c35b){if(_0x51c35b){return _0x51c35b?{'count':_0x29e187,'rows':_0x51c35b}:null;}})[_0xe2f1('0x1a')](respondWithResult(_0x40f725,null))[_0xe2f1('0x25')](handleError(_0x40f725,null));};exports['getInteractions']=function(_0x965628,_0x728eea,_0x3d1827){var _0x8cd9b2={'raw':![],'where':{}};var _0x37b287={};var _0x52fb00={'count':0x0,'rows':[]};return db[_0xe2f1('0x3c')][_0xe2f1('0xb1')]({'where':{'id':_0x965628[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x728eea,null))[_0xe2f1('0x1a')](function(_0xf5fbfa){if(_0xf5fbfa){_0x37b287[_0xe2f1('0x3f')]=_['keys'](db[_0xe2f1('0x9a')]['rawAttributes']);_0x37b287[_0xe2f1('0x41')]=_[_0xe2f1('0x40')](_0x965628[_0xe2f1('0x41')]);_0x37b287[_0xe2f1('0x42')]=_[_0xe2f1('0x43')](_0x37b287[_0xe2f1('0x3f')],_0x37b287[_0xe2f1('0x41')]);_0x8cd9b2['attributes']=_[_0xe2f1('0x43')](_0x37b287[_0xe2f1('0x3f')],qs[_0xe2f1('0x45')](_0x965628[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x8cd9b2[_0xe2f1('0x44')]=_0x8cd9b2[_0xe2f1('0x44')][_0xe2f1('0x64')]?_0x8cd9b2[_0xe2f1('0x44')]:_0x37b287['model'];if(!_0x965628['query'][_0xe2f1('0x46')](_0xe2f1('0x47'))){_0x8cd9b2[_0xe2f1('0x2b')]=qs[_0xe2f1('0x2b')](_0x965628[_0xe2f1('0x41')][_0xe2f1('0x2b')]);_0x8cd9b2['offset']=qs[_0xe2f1('0x48')](_0x965628[_0xe2f1('0x41')][_0xe2f1('0x48')]);}_0x8cd9b2[_0xe2f1('0x49')]=qs[_0xe2f1('0x4a')](_0x965628[_0xe2f1('0x41')]['sort']);_0x8cd9b2['where']=qs[_0xe2f1('0x42')](_['pick'](_0x965628[_0xe2f1('0x41')],_0x37b287[_0xe2f1('0x42')]));_0x8cd9b2[_0xe2f1('0x4b')][_0xe2f1('0x61')]=_0xf5fbfa['id'];if(_0x965628[_0xe2f1('0x41')][_0xe2f1('0x4f')]){_0x8cd9b2[_0xe2f1('0x4b')]=_['merge'](_0x8cd9b2['where'],{'$or':_[_0xe2f1('0x3b')](_0x8cd9b2[_0xe2f1('0x44')],function(_0x3d0bdf){var _0x4222d0={};_0x4222d0[_0x3d0bdf]={'$like':'%'+_0x965628[_0xe2f1('0x41')]['filter']+'%'};return _0x4222d0;})});}_0x8cd9b2=_['merge']({},_0x8cd9b2,_0x965628[_0xe2f1('0x50')]);return db[_0xe2f1('0x9a')][_0xe2f1('0x2c')]({'where':_0x8cd9b2[_0xe2f1('0x4b')]})[_0xe2f1('0x1a')](function(_0x229fde){_0x52fb00[_0xe2f1('0x2c')]=_0x229fde;if(_0x965628[_0xe2f1('0x41')][_0xe2f1('0x68')]){_0x8cd9b2[_0xe2f1('0x51')]=[{'model':db[_0xe2f1('0xb7')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xe2f1('0x36'),_0xe2f1('0xb8'),_0xe2f1('0xb9')],'required':![]},{'model':db[_0xe2f1('0xba')],'as':_0xe2f1('0xbb'),'attributes':['id',_0xe2f1('0x36'),'color'],'where':_0x965628[_0xe2f1('0x41')][_0xe2f1('0xbc')]?{'id':_0x965628[_0xe2f1('0x41')]['tag']}:undefined,'required':_0x965628['query'][_0xe2f1('0xbc')]?!![]:![]}];}return db[_0xe2f1('0x9a')]['findAll'](_0x8cd9b2);})['then'](function(_0x587f25){_0x52fb00[_0xe2f1('0x53')]=_0x587f25;return _0x52fb00;});}})[_0xe2f1('0x1a')](respondWithFilteredResult(_0x728eea,_0x8cd9b2))[_0xe2f1('0x25')](handleError(_0x728eea,null));};exports[_0xe2f1('0x37')]=function(_0x13bf4c,_0x7947b,_0x219343){var _0x1e4771,_0x56338f,_0x87f7f7;if(_[_0xe2f1('0x8f')](_0x13bf4c[_0xe2f1('0x57')]['body'])||_0x13bf4c[_0xe2f1('0x57')]['body']===''){throw new db[(_0xe2f1('0x6f'))][(_0xe2f1('0x70'))](_0xe2f1('0xbd'));}if(_[_0xe2f1('0x8f')](_0x13bf4c[_0xe2f1('0x57')]['to'])){throw new db[(_0xe2f1('0x6f'))][(_0xe2f1('0x70'))](_0xe2f1('0xbe'));}_0x1e4771=_0x13bf4c['body']['to'];return db['SmsAccount'][_0xe2f1('0x55')]({'where':{'id':_0x13bf4c[_0xe2f1('0x5e')]['id']},'include':[{'model':db[_0xe2f1('0x95')],'as':_0xe2f1('0xbf'),'include':[{'model':db[_0xe2f1('0xb7')],'as':_0xe2f1('0x96'),'where':{'mobile':_0x1e4771},'limit':0x1,'order':[[_0xe2f1('0x74'),_0xe2f1('0x97')]]}]}]})[_0xe2f1('0x1a')](handleEntityNotFound(_0x7947b,null))[_0xe2f1('0x1a')](function(_0x18fdf2){if(_0x18fdf2&&_0x18fdf2[_0xe2f1('0xbf')]){_0x56338f=_0x18fdf2[_0xe2f1('0x33')]({'plain':!![]});if(_0x56338f[_0xe2f1('0xbf')]&&_0x56338f[_0xe2f1('0xbf')]['Contacts'][_0xe2f1('0x64')]){return _0x56338f[_0xe2f1('0xbf')][_0xe2f1('0x96')][0x0];}return db[_0xe2f1('0xb7')]['create'](_['defaults'](_0x13bf4c[_0xe2f1('0x57')],{'firstName':_0x1e4771,'mobile':_0x1e4771,'phone':_0x1e4771,'ListId':_0x56338f[_0xe2f1('0x76')]}));}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x7947b,null))[_0xe2f1('0x1a')](function(_0xd74213){if(_0xd74213){_0x87f7f7=_0xd74213;return db[_0xe2f1('0x9a')][_0xe2f1('0x55')]({'where':{'ContactId':_0x87f7f7['id'],'closed':![],'SmsAccountId':_0x56338f['id']}})[_0xe2f1('0x1a')](function(_0x44f2ca){if(_0x44f2ca){return[_0x44f2ca,![]];}return db['SmsInteraction']['create']({'UserId':_0x13bf4c[_0xe2f1('0xc0')]['id'],'ContactId':_0x87f7f7['id'],'SmsAccountId':_0x56338f['id'],'phone':_0x1e4771,'firstMsgDirection':_0xe2f1('0xc1'),'Messages':[_['merge'](_0x13bf4c['body'],{'read':![],'body':_0x13bf4c[_0xe2f1('0x57')][_0xe2f1('0x57')],'phone':_0x1e4771,'SmsAccountId':_0x56338f['id'],'UserId':_0x13bf4c[_0xe2f1('0xc0')]['id'],'ContactId':_0x87f7f7['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe2f1('0xc2')}]})['then'](function(_0x11e4f9){return[_0x11e4f9,!![]];});});}})['spread'](function(_0x1689bc,_0x36b312){if(_0x36b312){return _0x1689bc;}return db[_0xe2f1('0xa1')][_0xe2f1('0x56')](_[_0xe2f1('0x4d')](_0x13bf4c[_0xe2f1('0x57')],{'read':![],'body':_0x13bf4c[_0xe2f1('0x57')][_0xe2f1('0x57')],'phone':_0x1e4771,'SmsAccountId':_0x56338f['id'],'SmsInteractionId':_0x1689bc['id'],'UserId':_0x13bf4c[_0xe2f1('0xc0')]['id'],'ContactId':_0x87f7f7['id']}))[_0xe2f1('0x1a')](function(_0x463576){_0x1689bc[_0xe2f1('0xc3')]['Messages']=[];_0x1689bc['dataValues'][_0xe2f1('0xc2')]['push'](_0x463576[_0xe2f1('0xc3')]);return _0x1689bc;});})['then'](respondWithResult(_0x7947b,null))['catch'](handleError(_0x7947b,null));};exports[_0xe2f1('0x27')]=function(_0x382866,_0x4f7504,_0x1e1df3){if(_0x382866[_0xe2f1('0x57')]['id']){delete _0x382866[_0xe2f1('0x57')]['id'];}var _0x554218,_0x534914,_0x361f74;return db[_0xe2f1('0x3c')][_0xe2f1('0x55')]({'where':{'id':_0x382866[_0xe2f1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4f7504,null))['then'](function(_0x257711){if(_0x257711){_0x361f74=_0x257711;logger[_0xe2f1('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe2f1('0x27'),_0xe2f1('0xc4'),_0x257711[_0xe2f1('0x3e')],util[_0xe2f1('0xc5')](_0x382866[_0xe2f1('0x57')],{'showHidden':![],'depth':null}));switch(_0x257711[_0xe2f1('0x3e')]){case _0xe2f1('0x7c'):if(_0x382866[_0xe2f1('0x57')][_0xe2f1('0xc6')]&&_0x382866[_0xe2f1('0x57')][_0xe2f1('0x27')]){_0x534914=_0x382866[_0xe2f1('0x57')][_0xe2f1('0x27')];return db['SmsMessage'][_0xe2f1('0x55')]({'where':{'messageId':_0x382866[_0xe2f1('0x57')]['skebby_dispatch_id']}});}break;case _0xe2f1('0x80'):if(_0x382866['body'][_0xe2f1('0xc7')]&&_0x382866[_0xe2f1('0x57')][_0xe2f1('0xc8')]){_0x534914=_0x382866[_0xe2f1('0x57')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x382866['body'][_0xe2f1('0xc7')]}});}break;case _0xe2f1('0xc9'):if(_0x382866[_0xe2f1('0x57')][_0xe2f1('0x81')]&&_0x382866[_0xe2f1('0x57')][_0xe2f1('0xca')]){_0x534914=_0x382866['body'][_0xe2f1('0xca')];return db[_0xe2f1('0xa1')]['find']({'where':{'messageId':_0x382866[_0xe2f1('0x57')][_0xe2f1('0x81')]}});}break;case _0xe2f1('0x84'):var _0x53a314=_0x382866[_0xe2f1('0x57')][_0xe2f1('0x85')][0x0];if(_0x53a314['messageId']&&_0x53a314[_0xe2f1('0x27')][_0xe2f1('0xcb')]===_0xe2f1('0xcc')){_0x534914=_0x53a314['status']['groupName'];return db[_0xe2f1('0xa1')]['find']({'where':{'messageId':_0x53a314[_0xe2f1('0x7a')]}});}break;case _0xe2f1('0x89'):if(_0x382866[_0xe2f1('0x57')][_0xe2f1('0x7a')]&&_0x382866['body'][_0xe2f1('0x27')]){_0x534914=_0x382866[_0xe2f1('0x57')][_0xe2f1('0x27')];return db[_0xe2f1('0xa1')][_0xe2f1('0x55')]({'where':{'messageId':_0x382866[_0xe2f1('0x57')][_0xe2f1('0x7a')]}});}break;case _0xe2f1('0x8c'):if(_0x382866[_0xe2f1('0x57')][0x0]['message']['id']){_0x534914=_0x382866[_0xe2f1('0x57')][0x0][_0xe2f1('0x3e')];return db[_0xe2f1('0xa1')][_0xe2f1('0x55')]({'where':{'messageId':_0x382866['body'][0x0]['message']['id']}});}break;case _0xe2f1('0x8d'):if(_0x382866[_0xe2f1('0x57')]['redif']&&_0x382866[_0xe2f1('0x57')][_0xe2f1('0x27')]){_0x534914=_0x382866['body']['status'];return db[_0xe2f1('0xa1')][_0xe2f1('0x55')]({'where':{'messageId':_0x382866[_0xe2f1('0x57')]['redif']}});}break;}}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x4f7504,null))['then'](function(_0x3464e5){if(_0x3464e5){_0x554218=_0x3464e5;switch(_0x361f74[_0xe2f1('0x3e')]){case _0xe2f1('0x7c'):if(_0x534914===_0xe2f1('0xcc')){return _0x554218['update']({'read':!![]});}else{logger[_0xe2f1('0x21')](_0xe2f1('0x1e'),_0xe2f1('0x27'),_0xe2f1('0x7c'),util[_0xe2f1('0xc5')](_0x382866['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x534914==='1'){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe2f1('0x7c'),util[_0xe2f1('0xc5')](_0x382866[_0xe2f1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xe2f1('0xc9'):if(!_0x382866[_0xe2f1('0x57')]['error_code']&&_0x534914>=0xc8&&_0x534914<=0xce){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe2f1('0xc9'),util['inspect'](_0x382866['body'],{'showHidden':![],'depth':null}));}break;case _0xe2f1('0x84'):var _0x5f50ef=_0x382866[_0xe2f1('0x57')][_0xe2f1('0x85')][0x0];if(_0x5f50ef[_0xe2f1('0x27')][_0xe2f1('0xcb')]===_0xe2f1('0xcc')){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger['error'](_0xe2f1('0x1e'),_0xe2f1('0x27'),'infobip',util[_0xe2f1('0xc5')](_0x382866[_0xe2f1('0x57')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x534914==_0xe2f1('0xcd')||_0x534914==_0xe2f1('0xce')){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')](_0xe2f1('0x1e'),_0xe2f1('0x27'),_0xe2f1('0x89'),util[_0xe2f1('0xc5')](_0x382866[_0xe2f1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xe2f1('0x8c'):if(_0x534914==_0xe2f1('0xcf')){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe2f1('0x27'),_0xe2f1('0x8c'),util['inspect'](_0x382866['body'],{'showHidden':![],'depth':null}));}break;case _0xe2f1('0x8d'):if(_0x534914===_0xe2f1('0xd0')||_0x534914===_0xe2f1('0xd1')){return _0x554218[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe2f1('0x27'),_0xe2f1('0x8d'),util['inspect'](_0x382866[_0xe2f1('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x554218;}})[_0xe2f1('0x1a')](respondWithResult(_0x4f7504,null))[_0xe2f1('0x25')](handleError(_0x4f7504,null));};exports['statusGet']=function(_0x1b4306,_0x563053,_0x3afae5){var _0x47ef81,_0x50995a,_0x4e94c2;return db['SmsAccount'][_0xe2f1('0x55')]({'where':{'id':_0x1b4306[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x563053,null))['then'](function(_0x503b48){if(_0x503b48){_0x4e94c2=_0x503b48;logger['debug'](_0xe2f1('0x1e'),_0xe2f1('0x27'),_0xe2f1('0xc4'),_0x503b48['type'],util['inspect'](_0x1b4306['query'],{'showHidden':![],'depth':null}));switch(_0x503b48[_0xe2f1('0x3e')]){case _0xe2f1('0x86'):if(_0x1b4306['query'][_0xe2f1('0xd2')]&&_0x1b4306[_0xe2f1('0x41')][_0xe2f1('0xd3')]){_0x50995a=_0x1b4306['query']['state'];return db[_0xe2f1('0xa1')][_0xe2f1('0x55')]({'where':{'messageId':_0x1b4306['query'][_0xe2f1('0xd2')]}});}break;}}})['then'](handleEntityNotFound(_0x563053,null))['then'](function(_0x5e87f3){if(_0x5e87f3){_0x47ef81=_0x5e87f3;switch(_0x4e94c2[_0xe2f1('0x3e')]){case'csc':if(_0x50995a==='2'||_0x50995a==='6'){return _0x47ef81[_0xe2f1('0x31')]({'read':!![]});}else{logger[_0xe2f1('0x21')](_0xe2f1('0x1e'),_0xe2f1('0x27'),_0xe2f1('0x86'),util[_0xe2f1('0xc5')](_0x1b4306[_0xe2f1('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x47ef81;}})[_0xe2f1('0x1a')](respondWithResult(_0x563053,null))['catch'](handleError(_0x563053,null));};exports[_0xe2f1('0xd4')]=function(_0x327727,_0x74c18b,_0x2a0f45){return db[_0xe2f1('0x3c')][_0xe2f1('0x55')]({'where':{'id':_0x327727[_0xe2f1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x74c18b,null))[_0xe2f1('0x1a')](function(_0x3f0426){if(_0x3f0426){return _0x3f0426['addAgents'](_0x327727[_0xe2f1('0x57')][_0xe2f1('0x66')],_['omit'](_0x327727[_0xe2f1('0x57')],['ids','id'])||{})['spread'](function(_0x1ab33f){for(var _0x301a84=0x0;_0x301a84<_0x327727[_0xe2f1('0x57')][_0xe2f1('0x66')][_0xe2f1('0x64')];_0x301a84+=0x1){socket[_0xe2f1('0xd5')]('userSmsAccount:save',{'UserId':Number(_0x327727[_0xe2f1('0x57')][_0xe2f1('0x66')][_0x301a84]),'SmsAccountId':Number(_0x327727[_0xe2f1('0x5e')]['id'])});}return _0x1ab33f;});}})[_0xe2f1('0x1a')](respondWithResult(_0x74c18b,null))[_0xe2f1('0x25')](handleError(_0x74c18b,null));};exports[_0xe2f1('0xd6')]=function(_0x494113,_0xda1d55,_0x5e2675){return db[_0xe2f1('0x3c')][_0xe2f1('0x55')]({'where':{'id':_0x494113[_0xe2f1('0x5e')]['id']}})['then'](handleEntityNotFound(_0xda1d55,null))[_0xe2f1('0x1a')](function(_0x658147){if(_0x658147){return _0x658147[_0xe2f1('0xd6')](_0x494113[_0xe2f1('0x41')][_0xe2f1('0x66')])[_0xe2f1('0x1a')](function(){if(_[_0xe2f1('0xd7')](_0x494113['query']['ids'])){for(var _0x49df06=0x0;_0x49df06<_0x494113[_0xe2f1('0x41')][_0xe2f1('0x66')]['length'];_0x49df06+=0x1){socket[_0xe2f1('0xd5')]('userSmsAccount:remove',{'UserId':Number(_0x494113['query'][_0xe2f1('0x66')][_0x49df06]),'SmsAccountId':Number(_0x494113[_0xe2f1('0x5e')]['id'])});}}else{socket[_0xe2f1('0xd5')](_0xe2f1('0xd8'),{'UserId':Number(_0x494113['query'][_0xe2f1('0x66')]),'SmsAccountId':Number(_0x494113[_0xe2f1('0x5e')]['id'])});}});}})[_0xe2f1('0x1a')](respondWithStatusCode(_0xda1d55,null))[_0xe2f1('0x25')](handleError(_0xda1d55,null));};exports[_0xe2f1('0xd9')]=function(_0x5cd6cd,_0x541167,_0x43b9cc){var _0x314a98={};var _0x4a90b9={};var _0x964061;var _0x1a6f2f;return db['SmsAccount']['findOne']({'where':{'id':_0x5cd6cd[_0xe2f1('0x5e')]['id']}})[_0xe2f1('0x1a')](handleEntityNotFound(_0x541167,null))[_0xe2f1('0x1a')](function(_0x1e8ff2){if(_0x1e8ff2){_0x964061=_0x1e8ff2;_0x4a90b9[_0xe2f1('0x3f')]=_['keys'](db[_0xe2f1('0xa4')][_0xe2f1('0x3d')]);_0x4a90b9[_0xe2f1('0x41')]=_[_0xe2f1('0x40')](_0x5cd6cd[_0xe2f1('0x41')]);_0x4a90b9['filters']=_[_0xe2f1('0x43')](_0x4a90b9['model'],_0x4a90b9[_0xe2f1('0x41')]);_0x314a98[_0xe2f1('0x44')]=_[_0xe2f1('0x43')](_0x4a90b9[_0xe2f1('0x3f')],qs[_0xe2f1('0x45')](_0x5cd6cd[_0xe2f1('0x41')][_0xe2f1('0x45')]));_0x314a98['attributes']=_0x314a98[_0xe2f1('0x44')][_0xe2f1('0x64')]?_0x314a98[_0xe2f1('0x44')]:_0x4a90b9[_0xe2f1('0x3f')];_0x314a98[_0xe2f1('0x49')]=qs['sort'](_0x5cd6cd['query'][_0xe2f1('0x4a')]);_0x314a98[_0xe2f1('0x4b')]=qs[_0xe2f1('0x42')](_[_0xe2f1('0x4c')](_0x5cd6cd['query'],_0x4a90b9['filters']));if(_0x5cd6cd[_0xe2f1('0x41')][_0xe2f1('0x4f')]){_0x314a98['where']=_[_0xe2f1('0x4d')](_0x314a98[_0xe2f1('0x4b')],{'$or':_[_0xe2f1('0x3b')](_0x314a98[_0xe2f1('0x44')],function(_0xa0aff0){var _0xfcfdfe={};_0xfcfdfe[_0xa0aff0]={'$like':'%'+_0x5cd6cd['query'][_0xe2f1('0x4f')]+'%'};return _0xfcfdfe;})});}_0x314a98=_[_0xe2f1('0x4d')]({},_0x314a98,_0x5cd6cd['options']);return _0x964061['getAgents'](_0x314a98);}})['then'](function(_0x20a435){if(_0x20a435){_0x1a6f2f=_0x20a435['length'];if(!_0x5cd6cd[_0xe2f1('0x41')][_0xe2f1('0x46')](_0xe2f1('0x47'))){_0x314a98[_0xe2f1('0x2b')]=qs[_0xe2f1('0x2b')](_0x5cd6cd[_0xe2f1('0x41')]['limit']);_0x314a98[_0xe2f1('0x48')]=qs['offset'](_0x5cd6cd['query'][_0xe2f1('0x48')]);}return _0x964061['getAgents'](_0x314a98);}})['then'](function(_0x9363c6){if(_0x9363c6){return _0x9363c6?{'count':_0x1a6f2f,'rows':_0x9363c6}:null;}})[_0xe2f1('0x1a')](respondWithResult(_0x541167,null))[_0xe2f1('0x25')](handleError(_0x541167,null));}; \ No newline at end of file +var _0x1ff2=['Contact','Owner','fullname','internal','Tag','Tags','tag','List','DESC','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','rows','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','type','from','Body','messageId','MessageSid','skebby','text','connectel','message_id','plivo','From','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Sequelize','CmList','Contacts','list','omit','contact','SmsInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions'];(function(_0x1c0317,_0xe5db44){var _0x4b1632=function(_0x57ef03){while(--_0x57ef03){_0x1c0317['push'](_0x1c0317['shift']());}};_0x4b1632(++_0xe5db44);}(_0x1ff2,0x1eb));var _0x21ff=function(_0x2156ce,_0x54b939){_0x2156ce=_0x2156ce-0x0;var _0x38914b=_0x1ff2[_0x2156ce];return _0x38914b;};'use strict';var emlformat=require(_0x21ff('0x0'));var rimraf=require(_0x21ff('0x1'));var zipdir=require(_0x21ff('0x2'));var jsonpatch=require(_0x21ff('0x3'));var rp=require(_0x21ff('0x4'));var moment=require(_0x21ff('0x5'));var BPromise=require(_0x21ff('0x6'));var Mustache=require(_0x21ff('0x7'));var util=require(_0x21ff('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21ff('0x9'));var fs=require('fs');var fs_extra=require(_0x21ff('0xa'));var _=require(_0x21ff('0xb'));var squel=require(_0x21ff('0xc'));var crypto=require(_0x21ff('0xd'));var jsforce=require(_0x21ff('0xe'));var deskjs=require(_0x21ff('0xf'));var toCsv=require(_0x21ff('0x10'));var querystring=require('querystring');var Papa=require(_0x21ff('0x11'));var Redis=require(_0x21ff('0x12'));var authService=require(_0x21ff('0x13'));var qs=require(_0x21ff('0x14'));var as=require(_0x21ff('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21ff('0x16'))(_0x21ff('0x17'));var utils=require(_0x21ff('0x18'));var config=require(_0x21ff('0x19'));var licenseUtil=require(_0x21ff('0x1a'));var db=require(_0x21ff('0x1b'))['db'];config[_0x21ff('0x1c')]=_[_0x21ff('0x1d')](config[_0x21ff('0x1c')],{'host':_0x21ff('0x1e'),'port':0x18eb});var socket=require(_0x21ff('0x1f'))(new Redis(config[_0x21ff('0x1c')]));require(_0x21ff('0x20'))[_0x21ff('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x21ff('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x29d0fd,_0x2b3836,_0x5e3e4a,_0xe5088f){return new BPromise(function(_0x4735d9,_0x35f367){var _0x37e11a=_0xe5088f||client;return _0x37e11a['request'](_0x29d0fd,_0x5e3e4a)['then'](function(_0x51ea06){logger[_0x21ff('0x23')](_0x21ff('0x24'),_0x2b3836,_0x21ff('0x25'));logger[_0x21ff('0x26')](_0x21ff('0x27'),_0x2b3836,_0x21ff('0x25'),JSON['stringify'](_0x51ea06));if(_0x51ea06[_0x21ff('0x28')]){if(_0x51ea06[_0x21ff('0x28')][_0x21ff('0x29')]===0x1f4){logger[_0x21ff('0x28')](_0x21ff('0x24'),_0x2b3836,_0x51ea06['error'][_0x21ff('0x2a')]);return _0x35f367(_0x51ea06['error'][_0x21ff('0x2a')]);}logger[_0x21ff('0x28')](_0x21ff('0x24'),_0x2b3836,_0x51ea06[_0x21ff('0x28')][_0x21ff('0x2a')]);return _0x4735d9(_0x51ea06[_0x21ff('0x28')][_0x21ff('0x2a')]);}else{logger[_0x21ff('0x23')](_0x21ff('0x24'),_0x2b3836,'request\x20sent');_0x4735d9(_0x51ea06[_0x21ff('0x2b')]['message']);}})[_0x21ff('0x2c')](function(_0x1c9cf9){logger[_0x21ff('0x28')](_0x21ff('0x24'),_0x2b3836,_0x1c9cf9);_0x35f367(_0x1c9cf9);});});}function respondWithStatusCode(_0x3066fe,_0x4b5871){_0x4b5871=_0x4b5871||0xcc;return function(_0x89508b){if(_0x89508b){return _0x3066fe[_0x21ff('0x2d')](_0x4b5871);}return _0x3066fe['status'](_0x4b5871)[_0x21ff('0x2e')]();};}function respondWithResult(_0x4901fd,_0x5d2260){_0x5d2260=_0x5d2260||0xc8;return function(_0xc792b0){if(_0xc792b0){return _0x4901fd[_0x21ff('0x2f')](_0x5d2260)[_0x21ff('0x30')](_0xc792b0);}};}function respondWithFilteredResult(_0x4ad55d,_0x4ef297){return function(_0x5b2329){if(_0x5b2329){var _0x2f80e1=typeof _0x4ef297[_0x21ff('0x31')]===_0x21ff('0x32')&&typeof _0x4ef297[_0x21ff('0x33')]==='undefined';var _0x2a492f=_0x5b2329[_0x21ff('0x34')];var _0xde0b43=_0x2f80e1?0x0:_0x4ef297[_0x21ff('0x31')];var _0x11dbd8=_0x2f80e1?_0x5b2329['count']:_0x4ef297[_0x21ff('0x31')]+_0x4ef297[_0x21ff('0x33')];var _0xda08b4;if(_0x11dbd8>=_0x2a492f){_0x11dbd8=_0x2a492f;_0xda08b4=0xc8;}else{_0xda08b4=0xce;}_0x4ad55d['status'](_0xda08b4);return _0x4ad55d[_0x21ff('0x35')](_0x21ff('0x36'),_0xde0b43+'-'+_0x11dbd8+'/'+_0x2a492f)[_0x21ff('0x30')](_0x5b2329);}return null;};}function patchUpdates(_0x1d5b89){return function(_0x194c05){try{jsonpatch['apply'](_0x194c05,_0x1d5b89,!![]);}catch(_0x156c7e){return BPromise[_0x21ff('0x37')](_0x156c7e);}return _0x194c05['save']();};}function saveUpdates(_0x358118,_0x4f180a){return function(_0x5d6890){if(_0x5d6890){return _0x5d6890[_0x21ff('0x38')](_0x358118)[_0x21ff('0x39')](function(_0x5731e1){return _0x5731e1;});}return null;};}function removeEntity(_0x56d565,_0x1d4227){return function(_0x4f0f4e){if(_0x4f0f4e){return _0x4f0f4e[_0x21ff('0x3a')]()['then'](function(){var _0x5d070a=_0x4f0f4e[_0x21ff('0x3b')]({'plain':!![]});var _0x1d8652='SmsAccounts';return db['UserProfileResource'][_0x21ff('0x3a')]({'where':{'type':_0x1d8652,'resourceId':_0x5d070a['id']}})[_0x21ff('0x39')](function(){return _0x4f0f4e;});})['then'](function(){_0x56d565[_0x21ff('0x2f')](0xcc)[_0x21ff('0x2e')]();});}};}function handleEntityNotFound(_0x43f063,_0x291265){return function(_0x2283b6){if(!_0x2283b6){_0x43f063['sendStatus'](0x194);}return _0x2283b6;};}function handleError(_0xbca21b,_0x34fc8a){_0x34fc8a=_0x34fc8a||0x1f4;return function(_0x51bfec){logger[_0x21ff('0x28')](_0x51bfec[_0x21ff('0x3c')]);if(_0x51bfec[_0x21ff('0x3d')]){delete _0x51bfec[_0x21ff('0x3d')];}_0xbca21b[_0x21ff('0x2f')](_0x34fc8a)[_0x21ff('0x3e')](_0x51bfec);};}exports[_0x21ff('0x3f')]=function(_0x1fd3f9,_0x3a6558){var _0x552b21={'include':[{'model':db[_0x21ff('0x40')],'as':_0x21ff('0x41')}]},_0x9a9d93={},_0x122ea9={'count':0x0,'rows':[]};var _0x4d7c3e=_[_0x21ff('0x42')](db[_0x21ff('0x43')][_0x21ff('0x44')],function(_0x3189cc){return{'name':_0x3189cc['fieldName'],'type':_0x3189cc['type']['key']};});_0x9a9d93[_0x21ff('0x45')]=_[_0x21ff('0x42')](_0x4d7c3e,_0x21ff('0x3d'));_0x9a9d93[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x1fd3f9[_0x21ff('0x46')]);_0x9a9d93['filters']=_['intersection'](_0x9a9d93['model'],_0x9a9d93[_0x21ff('0x46')]);_0x552b21[_0x21ff('0x48')]=_['intersection'](_0x9a9d93[_0x21ff('0x45')],qs[_0x21ff('0x49')](_0x1fd3f9[_0x21ff('0x46')][_0x21ff('0x49')]));_0x552b21[_0x21ff('0x48')]=_0x552b21[_0x21ff('0x48')][_0x21ff('0x4a')]?_0x552b21['attributes']:_0x9a9d93['model'];if(!_0x1fd3f9['query'][_0x21ff('0x4b')](_0x21ff('0x4c'))){_0x552b21['limit']=qs[_0x21ff('0x33')](_0x1fd3f9[_0x21ff('0x46')][_0x21ff('0x33')]);_0x552b21['offset']=qs[_0x21ff('0x31')](_0x1fd3f9[_0x21ff('0x46')]['offset']);}_0x552b21[_0x21ff('0x4d')]=qs['sort'](_0x1fd3f9[_0x21ff('0x46')][_0x21ff('0x4e')]);_0x552b21[_0x21ff('0x4f')]=qs[_0x21ff('0x50')](_['pick'](_0x1fd3f9[_0x21ff('0x46')],_0x9a9d93[_0x21ff('0x50')]),_0x4d7c3e);if(_0x1fd3f9['query']['filter']){_0x552b21[_0x21ff('0x4f')]=_[_0x21ff('0x51')](_0x552b21[_0x21ff('0x4f')],{'$or':_[_0x21ff('0x42')](_0x4d7c3e,function(_0x219ac9){if(_0x219ac9['type']!==_0x21ff('0x52')){var _0x2a69a6={};_0x2a69a6[_0x219ac9[_0x21ff('0x3d')]]={'$like':'%'+_0x1fd3f9[_0x21ff('0x46')][_0x21ff('0x53')]+'%'};return _0x2a69a6;}})});}_0x552b21=_[_0x21ff('0x51')]({},_0x552b21,_0x1fd3f9[_0x21ff('0x54')]);var _0x1f682e={'where':_0x552b21[_0x21ff('0x4f')]};return db[_0x21ff('0x43')]['count'](_0x1f682e)[_0x21ff('0x39')](function(_0xb98703){_0x122ea9[_0x21ff('0x34')]=_0xb98703;if(_0x1fd3f9[_0x21ff('0x46')][_0x21ff('0x55')]){_0x552b21['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x552b21);})['then'](function(_0x35ff86){_0x122ea9[_0x21ff('0x56')]=_0x35ff86;return _0x122ea9;})[_0x21ff('0x39')](respondWithFilteredResult(_0x3a6558,_0x552b21))[_0x21ff('0x2c')](handleError(_0x3a6558,null));};exports[_0x21ff('0x57')]=function(_0x40e9b7,_0x534e79){var _0x1cc9fb={'raw':![],'where':{'id':_0x40e9b7[_0x21ff('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x21ff('0x41')}]},_0x54cd21={};_0x54cd21[_0x21ff('0x45')]=_[_0x21ff('0x47')](db[_0x21ff('0x43')]['rawAttributes']);_0x54cd21[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x40e9b7['query']);_0x54cd21['filters']=_[_0x21ff('0x59')](_0x54cd21[_0x21ff('0x45')],_0x54cd21[_0x21ff('0x46')]);_0x1cc9fb[_0x21ff('0x48')]=_['intersection'](_0x54cd21[_0x21ff('0x45')],qs[_0x21ff('0x49')](_0x40e9b7['query'][_0x21ff('0x49')]));_0x1cc9fb['attributes']=_0x1cc9fb[_0x21ff('0x48')][_0x21ff('0x4a')]?_0x1cc9fb['attributes']:_0x54cd21[_0x21ff('0x45')];if(_0x40e9b7[_0x21ff('0x46')]['includeAll']){_0x1cc9fb['include']=[{'all':!![]}];}_0x1cc9fb=_[_0x21ff('0x51')]({},_0x1cc9fb,_0x40e9b7['options']);return db[_0x21ff('0x43')][_0x21ff('0x5a')](_0x1cc9fb)[_0x21ff('0x39')](handleEntityNotFound(_0x534e79,null))[_0x21ff('0x39')](respondWithResult(_0x534e79,null))['catch'](handleError(_0x534e79,null));};exports['create']=function(_0x39a3fe,_0x431dc3){return db[_0x21ff('0x43')][_0x21ff('0x5b')](_0x39a3fe[_0x21ff('0x5c')],{})[_0x21ff('0x39')](function(_0x13c114){var _0x256439=_0x39a3fe[_0x21ff('0x5d')][_0x21ff('0x3b')]({'plain':!![]});if(!_0x256439)throw new Error(_0x21ff('0x5e'));if(_0x256439[_0x21ff('0x5f')]===_0x21ff('0x5d')){var _0x52addf=_0x13c114[_0x21ff('0x3b')]({'plain':!![]});var _0x21e4ed=_0x21ff('0x60');return db[_0x21ff('0x61')][_0x21ff('0x5a')]({'where':{'name':_0x21e4ed,'userProfileId':_0x256439[_0x21ff('0x62')]},'raw':!![]})[_0x21ff('0x39')](function(_0xbea1e2){if(_0xbea1e2&&_0xbea1e2[_0x21ff('0x63')]===0x0){return db[_0x21ff('0x64')][_0x21ff('0x5b')]({'name':_0x52addf[_0x21ff('0x3d')],'resourceId':_0x52addf['id'],'type':_0xbea1e2[_0x21ff('0x3d')],'sectionId':_0xbea1e2['id']},{})['then'](function(){return _0x13c114;});}else{return _0x13c114;}})[_0x21ff('0x2c')](function(_0x57f397){logger['error'](_0x21ff('0x65'),_0x57f397);throw _0x57f397;});}return _0x13c114;})['then'](respondWithResult(_0x431dc3,0xc9))['catch'](handleError(_0x431dc3,null));};exports[_0x21ff('0x38')]=function(_0x4db540,_0x497c54){if(_0x4db540['body']['id']){delete _0x4db540[_0x21ff('0x5c')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x4db540[_0x21ff('0x58')]['id']},'include':[{'model':db[_0x21ff('0x40')],'as':_0x21ff('0x41')}]})[_0x21ff('0x39')](handleEntityNotFound(_0x497c54,null))[_0x21ff('0x39')](saveUpdates(_0x4db540['body'],null))[_0x21ff('0x39')](respondWithResult(_0x497c54,null))[_0x21ff('0x2c')](handleError(_0x497c54,null));};exports[_0x21ff('0x3a')]=function(_0xcd23c,_0x5cdd78){return db['SmsAccount']['find']({'where':{'id':_0xcd23c['params']['id']}})['then'](handleEntityNotFound(_0x5cdd78,null))[_0x21ff('0x39')](removeEntity(_0x5cdd78,null))[_0x21ff('0x2c')](handleError(_0x5cdd78,null));};exports['describe']=function(_0x474932,_0x57480c){return db[_0x21ff('0x43')][_0x21ff('0x66')]()[_0x21ff('0x39')](respondWithResult(_0x57480c,null))[_0x21ff('0x2c')](handleError(_0x57480c,null));};exports[_0x21ff('0x67')]=function(_0x3e3304,_0x55501d,_0x3e1471){if(_0x3e3304[_0x21ff('0x5c')]['id']){delete _0x3e3304[_0x21ff('0x5c')]['id'];}return db[_0x21ff('0x43')][_0x21ff('0x5a')]({'where':{'id':_0x3e3304[_0x21ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x55501d,null))['then'](function(_0x53fe45){if(_0x53fe45){_0x3e3304[_0x21ff('0x5c')][_0x21ff('0x68')]=_0x53fe45['id'];return db[_0x21ff('0x69')]['create'](_0x3e3304['body']);}})['then'](respondWithResult(_0x55501d,null))[_0x21ff('0x2c')](handleError(_0x55501d,null));};exports[_0x21ff('0x6a')]=function(_0x1c893a,_0x3b8cd1,_0x13a1c7){var _0x4b89a7={'raw':![],'where':{}};var _0x5d5d19={};var _0x31e9a2={'count':0x0,'rows':[]};return db[_0x21ff('0x43')][_0x21ff('0x6b')]({'where':{'id':_0x1c893a['params']['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x3b8cd1,null))[_0x21ff('0x39')](function(_0x50fa53){if(_0x50fa53){_0x5d5d19['model']=_[_0x21ff('0x47')](db[_0x21ff('0x69')]['rawAttributes']);_0x5d5d19[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x1c893a[_0x21ff('0x46')]);_0x5d5d19[_0x21ff('0x50')]=_[_0x21ff('0x59')](_0x5d5d19[_0x21ff('0x45')],_0x5d5d19['query']);_0x4b89a7[_0x21ff('0x48')]=_['intersection'](_0x5d5d19[_0x21ff('0x45')],qs['fields'](_0x1c893a[_0x21ff('0x46')][_0x21ff('0x49')]));_0x4b89a7[_0x21ff('0x48')]=_0x4b89a7[_0x21ff('0x48')]['length']?_0x4b89a7[_0x21ff('0x48')]:_0x5d5d19[_0x21ff('0x45')];if(!_0x1c893a[_0x21ff('0x46')][_0x21ff('0x4b')](_0x21ff('0x4c'))){_0x4b89a7[_0x21ff('0x33')]=qs['limit'](_0x1c893a['query'][_0x21ff('0x33')]);_0x4b89a7[_0x21ff('0x31')]=qs[_0x21ff('0x31')](_0x1c893a[_0x21ff('0x46')][_0x21ff('0x31')]);}_0x4b89a7[_0x21ff('0x4d')]=qs[_0x21ff('0x4e')](_0x1c893a[_0x21ff('0x46')][_0x21ff('0x4e')]);_0x4b89a7[_0x21ff('0x4f')]=qs[_0x21ff('0x50')](_['pick'](_0x1c893a['query'],_0x5d5d19[_0x21ff('0x50')]));_0x4b89a7[_0x21ff('0x4f')][_0x21ff('0x68')]=_0x50fa53['id'];if(_0x1c893a[_0x21ff('0x46')]['filter']){_0x4b89a7['where']=_[_0x21ff('0x51')](_0x4b89a7[_0x21ff('0x4f')],{'$or':_['map'](_0x4b89a7['attributes'],function(_0x376a40){var _0x518737={};_0x518737[_0x376a40]={'$like':'%'+_0x1c893a[_0x21ff('0x46')][_0x21ff('0x53')]+'%'};return _0x518737;})});}_0x4b89a7=_['merge']({},_0x4b89a7,_0x1c893a[_0x21ff('0x54')]);return db['Disposition'][_0x21ff('0x34')]({'where':_0x4b89a7[_0x21ff('0x4f')]})[_0x21ff('0x39')](function(_0x1ee9dd){_0x31e9a2['count']=_0x1ee9dd;if(_0x1c893a[_0x21ff('0x46')]['includeAll']){_0x4b89a7[_0x21ff('0x6c')]=[{'all':!![]}];}return db[_0x21ff('0x69')]['findAll'](_0x4b89a7);})[_0x21ff('0x39')](function(_0xb333c7){_0x31e9a2['rows']=_0xb333c7;return _0x31e9a2;});}})[_0x21ff('0x39')](respondWithFilteredResult(_0x3b8cd1,_0x4b89a7))[_0x21ff('0x2c')](handleError(_0x3b8cd1,null));};exports['removeDispositions']=function(_0x413f38,_0x4f1436,_0x52daa3){return db[_0x21ff('0x43')]['find']({'where':{'id':_0x413f38[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x4f1436,null))[_0x21ff('0x39')](function(_0x1414c2){if(_0x1414c2){return _0x1414c2[_0x21ff('0x6d')](_0x413f38[_0x21ff('0x46')][_0x21ff('0x6e')]);}})[_0x21ff('0x39')](respondWithStatusCode(_0x4f1436,null))[_0x21ff('0x2c')](handleError(_0x4f1436,null));};exports[_0x21ff('0x6f')]=function(_0x3a4c3c,_0x5c0801,_0x13f55e){if(_0x3a4c3c['body']['id']){delete _0x3a4c3c[_0x21ff('0x5c')]['id'];}return db[_0x21ff('0x43')]['find']({'where':{'id':_0x3a4c3c[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x5c0801,null))[_0x21ff('0x39')](function(_0x202b10){if(_0x202b10){_0x3a4c3c['body'][_0x21ff('0x68')]=_0x202b10['id'];return db[_0x21ff('0x70')][_0x21ff('0x5b')](_0x3a4c3c[_0x21ff('0x5c')]);}})[_0x21ff('0x39')](respondWithResult(_0x5c0801,null))['catch'](handleError(_0x5c0801,null));};exports[_0x21ff('0x71')]=function(_0x4f9939,_0x299d1b,_0x14a140){var _0x259e82={'raw':![],'where':{}};var _0x282415={};var _0x495400={'count':0x0,'rows':[]};return db[_0x21ff('0x43')]['findOne']({'where':{'id':_0x4f9939[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x299d1b,null))[_0x21ff('0x39')](function(_0x33dd8c){if(_0x33dd8c){_0x282415['model']=_['keys'](db[_0x21ff('0x70')][_0x21ff('0x44')]);_0x282415[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x4f9939[_0x21ff('0x46')]);_0x282415[_0x21ff('0x50')]=_['intersection'](_0x282415[_0x21ff('0x45')],_0x282415['query']);_0x259e82[_0x21ff('0x48')]=_[_0x21ff('0x59')](_0x282415[_0x21ff('0x45')],qs[_0x21ff('0x49')](_0x4f9939[_0x21ff('0x46')][_0x21ff('0x49')]));_0x259e82[_0x21ff('0x48')]=_0x259e82['attributes'][_0x21ff('0x4a')]?_0x259e82[_0x21ff('0x48')]:_0x282415[_0x21ff('0x45')];if(!_0x4f9939[_0x21ff('0x46')][_0x21ff('0x4b')](_0x21ff('0x4c'))){_0x259e82[_0x21ff('0x33')]=qs[_0x21ff('0x33')](_0x4f9939[_0x21ff('0x46')][_0x21ff('0x33')]);_0x259e82[_0x21ff('0x31')]=qs[_0x21ff('0x31')](_0x4f9939[_0x21ff('0x46')][_0x21ff('0x31')]);}_0x259e82[_0x21ff('0x4d')]=qs[_0x21ff('0x4e')](_0x4f9939[_0x21ff('0x46')][_0x21ff('0x4e')]);_0x259e82['where']=qs['filters'](_[_0x21ff('0x72')](_0x4f9939['query'],_0x282415[_0x21ff('0x50')]));_0x259e82[_0x21ff('0x4f')]['SmsAccountId']=_0x33dd8c['id'];if(_0x4f9939[_0x21ff('0x46')][_0x21ff('0x53')]){_0x259e82['where']=_[_0x21ff('0x51')](_0x259e82['where'],{'$or':_[_0x21ff('0x42')](_0x259e82[_0x21ff('0x48')],function(_0x5984a2){var _0x252dad={};_0x252dad[_0x5984a2]={'$like':'%'+_0x4f9939[_0x21ff('0x46')][_0x21ff('0x53')]+'%'};return _0x252dad;})});}_0x259e82=_[_0x21ff('0x51')]({},_0x259e82,_0x4f9939['options']);return db[_0x21ff('0x70')][_0x21ff('0x34')]({'where':_0x259e82['where']})['then'](function(_0x256b5f){_0x495400[_0x21ff('0x34')]=_0x256b5f;if(_0x4f9939[_0x21ff('0x46')][_0x21ff('0x55')]){_0x259e82[_0x21ff('0x6c')]=[{'all':!![]}];}return db[_0x21ff('0x70')]['findAll'](_0x259e82);})[_0x21ff('0x39')](function(_0x26a840){_0x495400[_0x21ff('0x56')]=_0x26a840;return _0x495400;});}})[_0x21ff('0x39')](respondWithFilteredResult(_0x299d1b,_0x259e82))['catch'](handleError(_0x299d1b,null));};exports['removeAnswers']=function(_0x2710ce,_0x3ae77f,_0x5066b3){return db[_0x21ff('0x43')]['find']({'where':{'id':_0x2710ce[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x3ae77f,null))['then'](function(_0x256645){if(_0x256645){return _0x256645[_0x21ff('0x73')](_0x2710ce['query'][_0x21ff('0x6e')]);}})[_0x21ff('0x39')](respondWithStatusCode(_0x3ae77f,null))[_0x21ff('0x2c')](handleError(_0x3ae77f,null));};exports[_0x21ff('0x74')]=function(_0x1f6370,_0x3bbacc,_0x4a8998){var _0x3f8683={'channel':_0x21ff('0x75')};var _0x4aad39=[];var _0x52220b=[];var _0x37b04f={};return db[_0x21ff('0x43')]['find']({'where':{'id':_0x1f6370['params']['id']},'include':[{'model':db[_0x21ff('0x76')],'as':'Applications'}]})[_0x21ff('0x39')](handleEntityNotFound(_0x3bbacc,null))[_0x21ff('0x39')](function(_0x50139c){_0x3f8683[_0x21ff('0x77')]=_0x50139c;_0x3f8683[_0x21ff('0x78')]=_[_0x21ff('0x79')](_0x50139c[_0x21ff('0x7a')],[_0x21ff('0x7b')],[_0x21ff('0x7c')]);if(_0x3f8683[_0x21ff('0x77')][_0x21ff('0x7a')]){delete _0x3f8683[_0x21ff('0x77')][_0x21ff('0x7a')];}return db[_0x21ff('0x7d')][_0x21ff('0x66')]();})[_0x21ff('0x39')](function(_0x2a8ff1){if(!_0x2a8ff1){throw new db['Sequelize'][(_0x21ff('0x7e'))]('no\x20available\x20attributes');}_0x4aad39=_['difference'](_[_0x21ff('0x47')](_0x2a8ff1),[_0x21ff('0x7f'),_0x21ff('0x80')]);_0x52220b=_[_0x21ff('0x81')](_[_0x21ff('0x47')](_0x2a8ff1),[_0x21ff('0x7f'),'updatedAt',_0x21ff('0x82'),_0x21ff('0x83')]);_0x3f8683['body']={'mapKey':_0x21ff('0x84')};if(_0x3f8683[_0x21ff('0x77')][_0x21ff('0x85')]){switch(_0x3f8683['account'][_0x21ff('0x85')]){case'twilio':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')]=_0x1f6370['body']['From'];_0x3f8683['body'][_0x21ff('0x5c')]=_0x1f6370['body'][_0x21ff('0x87')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')]=_0x1f6370['body'][_0x21ff('0x89')];break;case _0x21ff('0x8a'):_0x3f8683['body'][_0x21ff('0x86')]='+'+_0x1f6370['body']['sender'];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x8b')];break;case _0x21ff('0x8c'):_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x86')];_0x3f8683[_0x21ff('0x5c')]['body']=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x2a')];break;case'clicksend':_0x3f8683[_0x21ff('0x5c')]['from']=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x86')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]=_0x1f6370[_0x21ff('0x5c')]['body'];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x8d')];break;case _0x21ff('0x8e'):_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x8f')];_0x3f8683['body'][_0x21ff('0x5c')]=_0x1f6370[_0x21ff('0x5c')]['Text'];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x90')];break;case _0x21ff('0x91'):_0x3f8683[_0x21ff('0x5c')]['from']='+'+_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x92')][0x0][_0x21ff('0x86')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]=_0x1f6370['body']['results'][0x0][_0x21ff('0x8b')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')]=_0x1f6370['body'][_0x21ff('0x92')][0x0][_0x21ff('0x88')];break;case _0x21ff('0x93'):_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')]=_0x1f6370[_0x21ff('0x5c')]['originatingAddress'];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x94')][_0x21ff('0x2a')];break;case _0x21ff('0x95'):_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')]=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x96')];_0x3f8683['body'][_0x21ff('0x5c')]=_0x1f6370['body'][_0x21ff('0x8b')];_0x3f8683['body']['messageId']=_0x1f6370[_0x21ff('0x5c')][_0x21ff('0x97')];break;case _0x21ff('0x98'):_0x3f8683[_0x21ff('0x5c')]['messageId']=_0x1f6370[_0x21ff('0x5c')][0x0]['message']['id'];_0x3f8683[_0x21ff('0x5c')]['from']=_0x1f6370[_0x21ff('0x5c')][0x0][_0x21ff('0x2a')][_0x21ff('0x86')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]=_0x1f6370[_0x21ff('0x5c')][0x0][_0x21ff('0x2a')]['text'];break;case'intelepeer':_0x3f8683[_0x21ff('0x5c')]['from']=_0x1f6370[_0x21ff('0x5c')]['from'];_0x3f8683['body'][_0x21ff('0x5c')]=_0x1f6370['body'][_0x21ff('0x2a')];_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')]=_0x1f6370['body'][_0x21ff('0x99')];break;}}if(_0x3f8683[_0x21ff('0x5c')]['id']){delete _0x3f8683[_0x21ff('0x5c')]['id'];}if(_[_0x21ff('0x9a')](_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')])){throw new db['Sequelize']['ValidationError'](_0x21ff('0x9b'));}if(_[_0x21ff('0x9a')](_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')])||_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')]===''){throw new db['Sequelize'][(_0x21ff('0x7e'))](_0x21ff('0x9c'));}if(_['isNil'](_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x9d')])){throw new db['Sequelize'][(_0x21ff('0x7e'))](_0x21ff('0x9e')+_0x52220b);}if(!_[_0x21ff('0x9f')](_0x52220b,_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x9d')])){throw new db[(_0x21ff('0xa0'))][(_0x21ff('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52220b);}_0x37b04f[_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x9d')]]=_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')];return db[_0x21ff('0xa1')]['find']({'where':{'id':_0x3f8683[_0x21ff('0x77')]['ListId']},'include':[{'model':db[_0x21ff('0x7d')],'as':_0x21ff('0xa2'),'where':_0x37b04f,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x3bbacc,null))['then'](function(_0x5420de){if(_0x5420de){_0x3f8683[_0x21ff('0xa3')]=_[_0x21ff('0xa4')](_0x5420de,[_0x21ff('0xa2')]);if(_0x5420de['Contacts']['length']){return _0x5420de['Contacts'][0x0];}var _0x298bfa=_[_0x21ff('0x1d')](_0x3f8683[_0x21ff('0x5c')],{'firstName':_0x3f8683[_0x21ff('0x5c')]['from'],'ListId':_0x5420de['id']});_0x298bfa[_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x9d')]]=_0x3f8683['body']['from'];return db[_0x21ff('0x7d')][_0x21ff('0x5b')](_0x298bfa,{'fields':_0x4aad39,'raw':!![]});}})[_0x21ff('0x39')](handleEntityNotFound(_0x3bbacc,null))['then'](function(_0x54a9b8){if(_0x54a9b8){_0x3f8683[_0x21ff('0xa5')]=_0x54a9b8;var _0x44524f={'ContactId':_0x54a9b8['id'],'phone':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')],'SmsAccountId':_0x1f6370['params']['id']};var _0x355903={'ContactId':_0x54a9b8['id'],'SmsAccountId':_0x1f6370[_0x21ff('0x58')]['id'],'closed':![]};return db[_0x21ff('0xa6')]['find']({'where':_0x355903})[_0x21ff('0x39')](function(_0x15dbff){if(_0x15dbff){return[_0x15dbff,![]];}return db[_0x21ff('0xa6')]['create'](_0x44524f)['then'](function(_0x1dcf1c){return[_0x1dcf1c,!![]];});});}})['spread'](function(_0x4ad4a3,_0x296b9c){_0x3f8683[_0x21ff('0xa7')]=_0x4ad4a3[_0x21ff('0x3b')]({'plain':!![]});_0x3f8683[_0x21ff('0xa7')][_0x21ff('0xa8')]=![];if(_0x296b9c){if(_0x3f8683[_0x21ff('0x77')][_0x21ff('0xa9')]){_0x3f8683[_0x21ff('0x78')]['push']({'id':0x0,'priority':_0x3f8683['applications'][_0x21ff('0x4a')]+0x1,'app':_0x21ff('0xaa'),'appdata':_0x21ff('0xab'),'interval':_0x21ff('0xac')});}_0x3f8683['interaction'][_0x21ff('0xa8')]=!![];}return db[_0x21ff('0xad')][_0x21ff('0x5b')]({'phone':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x86')],'messageId':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x88')],'body':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0x5c')],'SmsAccountId':_0x1f6370[_0x21ff('0x58')]['id'],'SmsInteractionId':_0x4ad4a3['id'],'direction':'in','ContactId':_0x4ad4a3[_0x21ff('0xae')],'AttachmentId':_0x3f8683[_0x21ff('0x5c')][_0x21ff('0xaf')]});})[_0x21ff('0x39')](function(_0x4f6397){_0x3f8683[_0x21ff('0x2a')]=_0x4f6397;if(_0x3f8683[_0x21ff('0xa7')][_0x21ff('0xb0')]){return db[_0x21ff('0xb1')]['find']({'attributes':['id',_0x21ff('0x3d')],'where':{'id':_0x3f8683['interaction'][_0x21ff('0xb0')]}})['then'](function(_0x4ec553){if(_0x4ec553){_0x3f8683[_0x21ff('0x78')][_0x21ff('0xb2')]({'id':0x0,'priority':0x0,'app':_0x21ff('0xb3'),'appdata':_0x4ec553[_0x21ff('0x3d')]+','+(_0x3f8683['account']['waitForTheAssignedAgent']||0xa),'interval':_0x21ff('0xac')});}return respondWithRpcPromise(_0x21ff('0xb4'),_0x21ff('0xb5'),_0x3f8683);});}return respondWithRpcPromise('Start',_0x21ff('0xb5'),_0x3f8683);})[_0x21ff('0x39')](function(_0x39c5da){if(_0x39c5da){var _0xd09bbd=0xc8;var _0x4b00b0=_0x21ff('0xb6');logger[_0x21ff('0x23')](_0x21ff('0x27'),_0x4b00b0,_0xd09bbd,_0x21ff('0xb7'));logger[_0x21ff('0x26')](_0x21ff('0xb8'),_0x4b00b0,_0xd09bbd,_0x21ff('0xb7'),JSON['stringify'](_0x39c5da));if(_0x3f8683['account'][_0x21ff('0x85')]===_0x21ff('0xb9')){return _0x3bbacc['status'](_0xd09bbd)['set']('Content-Type',_0x21ff('0xba'))[_0x21ff('0x3e')]('\x0a');}else{return _0x3bbacc['status'](_0xd09bbd)[_0x21ff('0x30')](_0x39c5da);}}})[_0x21ff('0x2c')](handleError(_0x3bbacc,null));};exports[_0x21ff('0xbb')]=function(_0x3d563b,_0x244315,_0x56979a){return db['SmsAccount']['findOne']({'where':{'id':_0x3d563b[_0x21ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x244315,null))['then'](function(_0x3fc3c0){if(_0x3fc3c0){return db[_0x21ff('0xbc')]['transaction'](function(_0x230a47){return db['SmsApplication'][_0x21ff('0x3a')]({'where':{'SmsAccountId':_0x3d563b['params']['id']},'transaction':_0x230a47})[_0x21ff('0x39')](function(_0x55b917){var _0x27eeaf=_[_0x21ff('0x42')](_0x3d563b['body'],function(_0x346264){_0x346264['SmsAccountId']=_0x3d563b[_0x21ff('0x58')]['id'];return _0x346264;});return db['SmsApplication'][_0x21ff('0xbd')](_0x27eeaf,{'transaction':_0x230a47});});})[_0x21ff('0x39')](function(){return db[_0x21ff('0x76')][_0x21ff('0xbe')]({'where':{'SmsAccountId':_0x3d563b['params']['id']},'order':_0x21ff('0x7b')});});}})['then'](respondWithResult(_0x244315,null))[_0x21ff('0x2c')](handleError(_0x244315,null));};exports[_0x21ff('0xbf')]=function(_0x50da79,_0x469e3d,_0x507f9f){var _0x28de38={};var _0x1c57ba={};var _0x3318b6;var _0x32146b;return db['SmsAccount']['findOne']({'where':{'id':_0x50da79['params']['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x469e3d,null))[_0x21ff('0x39')](function(_0x549231){if(_0x549231){_0x3318b6=_0x549231;_0x1c57ba[_0x21ff('0x45')]=_[_0x21ff('0x47')](db[_0x21ff('0x76')][_0x21ff('0x44')]);_0x1c57ba[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x50da79[_0x21ff('0x46')]);_0x1c57ba[_0x21ff('0x50')]=_['intersection'](_0x1c57ba[_0x21ff('0x45')],_0x1c57ba['query']);_0x28de38['attributes']=_[_0x21ff('0x59')](_0x1c57ba[_0x21ff('0x45')],qs[_0x21ff('0x49')](_0x50da79[_0x21ff('0x46')][_0x21ff('0x49')]));_0x28de38[_0x21ff('0x48')]=_0x28de38[_0x21ff('0x48')][_0x21ff('0x4a')]?_0x28de38['attributes']:_0x1c57ba['model'];_0x28de38[_0x21ff('0x4d')]=qs[_0x21ff('0x4e')](_0x50da79[_0x21ff('0x46')][_0x21ff('0x4e')]);_0x28de38[_0x21ff('0x4f')]=qs[_0x21ff('0x50')](_[_0x21ff('0x72')](_0x50da79[_0x21ff('0x46')],_0x1c57ba[_0x21ff('0x50')]));if(_0x50da79[_0x21ff('0x46')][_0x21ff('0x53')]){_0x28de38[_0x21ff('0x4f')]=_[_0x21ff('0x51')](_0x28de38[_0x21ff('0x4f')],{'$or':_[_0x21ff('0x42')](_0x28de38[_0x21ff('0x48')],function(_0x418142){var _0x2d2673={};_0x2d2673[_0x418142]={'$like':'%'+_0x50da79[_0x21ff('0x46')]['filter']+'%'};return _0x2d2673;})});}_0x28de38=_[_0x21ff('0x51')]({},_0x28de38,_0x50da79[_0x21ff('0x54')]);return _0x3318b6['getApplications'](_0x28de38);}})[_0x21ff('0x39')](function(_0x40500a){if(_0x40500a){_0x32146b=_0x40500a[_0x21ff('0x4a')];if(!_0x50da79[_0x21ff('0x46')][_0x21ff('0x4b')](_0x21ff('0x4c'))){_0x28de38['limit']=qs[_0x21ff('0x33')](_0x50da79[_0x21ff('0x46')][_0x21ff('0x33')]);_0x28de38[_0x21ff('0x31')]=qs['offset'](_0x50da79[_0x21ff('0x46')]['offset']);}return _0x3318b6[_0x21ff('0xbf')](_0x28de38);}})[_0x21ff('0x39')](function(_0x1b461a){if(_0x1b461a){return _0x1b461a?{'count':_0x32146b,'rows':_0x1b461a}:null;}})['then'](respondWithResult(_0x469e3d,null))[_0x21ff('0x2c')](handleError(_0x469e3d,null));};exports[_0x21ff('0xc0')]=function(_0x1e4b43,_0x3c32a8,_0x23856f){var _0x3d657a={'raw':![],'where':{}};var _0x5180c2={};var _0x5c8b82={'count':0x0,'rows':[]};return db[_0x21ff('0x43')]['findOne']({'where':{'id':_0x1e4b43[_0x21ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x3c32a8,null))['then'](function(_0x467125){if(_0x467125){_0x5180c2[_0x21ff('0x45')]=_['keys'](db[_0x21ff('0xa6')][_0x21ff('0x44')]);_0x5180c2[_0x21ff('0x46')]=_[_0x21ff('0x47')](_0x1e4b43[_0x21ff('0x46')]);_0x5180c2[_0x21ff('0x50')]=_[_0x21ff('0x59')](_0x5180c2['model'],_0x5180c2['query']);_0x3d657a[_0x21ff('0x48')]=_[_0x21ff('0x59')](_0x5180c2['model'],qs[_0x21ff('0x49')](_0x1e4b43[_0x21ff('0x46')][_0x21ff('0x49')]));_0x3d657a[_0x21ff('0x48')]=_0x3d657a[_0x21ff('0x48')][_0x21ff('0x4a')]?_0x3d657a[_0x21ff('0x48')]:_0x5180c2[_0x21ff('0x45')];if(!_0x1e4b43['query']['hasOwnProperty'](_0x21ff('0x4c'))){_0x3d657a[_0x21ff('0x33')]=qs[_0x21ff('0x33')](_0x1e4b43[_0x21ff('0x46')][_0x21ff('0x33')]);_0x3d657a[_0x21ff('0x31')]=qs[_0x21ff('0x31')](_0x1e4b43['query'][_0x21ff('0x31')]);}_0x3d657a[_0x21ff('0x4d')]=qs[_0x21ff('0x4e')](_0x1e4b43['query'][_0x21ff('0x4e')]);_0x3d657a[_0x21ff('0x4f')]=qs['filters'](_[_0x21ff('0x72')](_0x1e4b43[_0x21ff('0x46')],_0x5180c2[_0x21ff('0x50')]));_0x3d657a[_0x21ff('0x4f')][_0x21ff('0x68')]=_0x467125['id'];if(_0x1e4b43['query']['filter']){_0x3d657a[_0x21ff('0x4f')]=_[_0x21ff('0x51')](_0x3d657a[_0x21ff('0x4f')],{'$or':_[_0x21ff('0x42')](_0x3d657a[_0x21ff('0x48')],function(_0x207051){var _0x4a1007={};_0x4a1007[_0x207051]={'$like':'%'+_0x1e4b43[_0x21ff('0x46')]['filter']+'%'};return _0x4a1007;})});}_0x3d657a=_[_0x21ff('0x51')]({},_0x3d657a,_0x1e4b43[_0x21ff('0x54')]);return db[_0x21ff('0xa6')][_0x21ff('0x34')]({'where':_0x3d657a[_0x21ff('0x4f')]})[_0x21ff('0x39')](function(_0xf25c17){_0x5c8b82[_0x21ff('0x34')]=_0xf25c17;if(_0x1e4b43[_0x21ff('0x46')][_0x21ff('0x55')]){_0x3d657a['include']=[{'model':db[_0x21ff('0x7d')],'as':_0x21ff('0xc1'),'required':![]},{'model':db[_0x21ff('0xb1')],'as':_0x21ff('0xc2'),'attributes':[_0x21ff('0x3d'),_0x21ff('0xc3'),_0x21ff('0xc4')],'required':![]},{'model':db[_0x21ff('0xc5')],'as':_0x21ff('0xc6'),'attributes':['id','name','color'],'where':_0x1e4b43['query'][_0x21ff('0xc7')]?{'id':_0x1e4b43[_0x21ff('0x46')][_0x21ff('0xc7')]}:undefined,'required':_0x1e4b43['query'][_0x21ff('0xc7')]?!![]:![]}];}return db[_0x21ff('0xa6')]['findAll'](_0x3d657a);})[_0x21ff('0x39')](function(_0x5547ef){_0x5c8b82[_0x21ff('0x56')]=_0x5547ef;return _0x5c8b82;});}})[_0x21ff('0x39')](respondWithFilteredResult(_0x3c32a8,_0x3d657a))[_0x21ff('0x2c')](handleError(_0x3c32a8,null));};exports['send']=function(_0x32f254,_0x28910f,_0x174263){var _0x1b0e7e,_0x39e556,_0x254bac;if(_[_0x21ff('0x9a')](_0x32f254['body'][_0x21ff('0x5c')])||_0x32f254[_0x21ff('0x5c')]['body']===''){throw new db['Sequelize'][(_0x21ff('0x7e'))](_0x21ff('0x9c'));}if(_[_0x21ff('0x9a')](_0x32f254['body']['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x1b0e7e=_0x32f254[_0x21ff('0x5c')]['to'];return db[_0x21ff('0x43')]['find']({'where':{'id':_0x32f254[_0x21ff('0x58')]['id']},'include':[{'model':db[_0x21ff('0xa1')],'as':_0x21ff('0xc8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x1b0e7e},'limit':0x1,'order':[['updatedAt',_0x21ff('0xc9')]]}]}]})[_0x21ff('0x39')](handleEntityNotFound(_0x28910f,null))[_0x21ff('0x39')](function(_0x4868e5){if(_0x4868e5&&_0x4868e5['List']){_0x39e556=_0x4868e5[_0x21ff('0x3b')]({'plain':!![]});if(_0x39e556[_0x21ff('0xc8')]&&_0x39e556[_0x21ff('0xc8')][_0x21ff('0xa2')][_0x21ff('0x4a')]){return _0x39e556[_0x21ff('0xc8')][_0x21ff('0xa2')][0x0];}return db[_0x21ff('0x7d')][_0x21ff('0x5b')](_[_0x21ff('0x1d')](_0x32f254[_0x21ff('0x5c')],{'firstName':_0x1b0e7e,'mobile':_0x1b0e7e,'phone':_0x1b0e7e,'ListId':_0x39e556[_0x21ff('0x83')]}));}})[_0x21ff('0x39')](handleEntityNotFound(_0x28910f,null))[_0x21ff('0x39')](function(_0x433886){if(_0x433886){_0x254bac=_0x433886;return db['SmsInteraction']['find']({'where':{'ContactId':_0x254bac['id'],'closed':![],'SmsAccountId':_0x39e556['id']}})[_0x21ff('0x39')](function(_0xd9178d){if(_0xd9178d){return[_0xd9178d,![]];}return db[_0x21ff('0xa6')]['create']({'UserId':_0x32f254[_0x21ff('0x5d')]['id'],'ContactId':_0x254bac['id'],'SmsAccountId':_0x39e556['id'],'phone':_0x1b0e7e,'firstMsgDirection':'out','Messages':[_[_0x21ff('0x51')](_0x32f254[_0x21ff('0x5c')],{'read':![],'body':_0x32f254[_0x21ff('0x5c')][_0x21ff('0x5c')],'phone':_0x1b0e7e,'SmsAccountId':_0x39e556['id'],'UserId':_0x32f254['user']['id'],'ContactId':_0x254bac['id']})]},{'include':[{'model':db[_0x21ff('0xad')],'as':_0x21ff('0xca')}]})[_0x21ff('0x39')](function(_0xe6322e){return[_0xe6322e,!![]];});});}})[_0x21ff('0xcb')](function(_0x1b33f4,_0x210fc3){if(_0x210fc3){return _0x1b33f4;}return db['SmsMessage'][_0x21ff('0x5b')](_['merge'](_0x32f254[_0x21ff('0x5c')],{'read':![],'body':_0x32f254[_0x21ff('0x5c')][_0x21ff('0x5c')],'phone':_0x1b0e7e,'SmsAccountId':_0x39e556['id'],'SmsInteractionId':_0x1b33f4['id'],'UserId':_0x32f254[_0x21ff('0x5d')]['id'],'ContactId':_0x254bac['id']}))[_0x21ff('0x39')](function(_0x129caf){_0x1b33f4[_0x21ff('0xcc')]['Messages']=[];_0x1b33f4[_0x21ff('0xcc')][_0x21ff('0xca')]['push'](_0x129caf[_0x21ff('0xcc')]);return _0x1b33f4;});})[_0x21ff('0x39')](respondWithResult(_0x28910f,null))[_0x21ff('0x2c')](handleError(_0x28910f,null));};exports[_0x21ff('0x2f')]=function(_0x17b1ef,_0x143fb4,_0x5dfea7){if(_0x17b1ef[_0x21ff('0x5c')]['id']){delete _0x17b1ef[_0x21ff('0x5c')]['id'];}var _0x505502,_0x118370,_0xaf74c8;return db[_0x21ff('0x43')][_0x21ff('0x5a')]({'where':{'id':_0x17b1ef[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x143fb4,null))[_0x21ff('0x39')](function(_0x53dbbb){if(_0x53dbbb){_0xaf74c8=_0x53dbbb;logger[_0x21ff('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x21ff('0xcd'),_0x53dbbb['type'],util[_0x21ff('0xce')](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));switch(_0x53dbbb[_0x21ff('0x85')]){case _0x21ff('0x8a'):if(_0x17b1ef[_0x21ff('0x5c')]['skebby_dispatch_id']&&_0x17b1ef[_0x21ff('0x5c')]['status']){_0x118370=_0x17b1ef['body'][_0x21ff('0x2f')];return db[_0x21ff('0xad')]['find']({'where':{'messageId':_0x17b1ef['body'][_0x21ff('0xcf')]}});}break;case'connectel':if(_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0xd0')]&&_0x17b1ef[_0x21ff('0x5c')]['statusInt']){_0x118370=_0x17b1ef[_0x21ff('0x5c')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x17b1ef['body']['requestid']}});}break;case _0x21ff('0xd1'):if(_0x17b1ef['body'][_0x21ff('0x8d')]&&_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0xd2')]){_0x118370=_0x17b1ef['body'][_0x21ff('0xd2')];return db[_0x21ff('0xad')][_0x21ff('0x5a')]({'where':{'messageId':_0x17b1ef[_0x21ff('0x5c')]['message_id']}});}break;case'infobip':var _0x1977da=_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x92')][0x0];if(_0x1977da[_0x21ff('0x88')]&&_0x1977da[_0x21ff('0x2f')][_0x21ff('0xd3')]==='DELIVERED'){_0x118370=_0x1977da[_0x21ff('0x2f')]['groupName'];return db[_0x21ff('0xad')][_0x21ff('0x5a')]({'where':{'messageId':_0x1977da['messageId']}});}break;case _0x21ff('0x95'):if(_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x88')]&&_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x2f')]){_0x118370=_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x2f')];return db[_0x21ff('0xad')][_0x21ff('0x5a')]({'where':{'messageId':_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x88')]}});}break;case _0x21ff('0x98'):if(_0x17b1ef['body'][0x0][_0x21ff('0x2a')]['id']){_0x118370=_0x17b1ef[_0x21ff('0x5c')][0x0][_0x21ff('0x85')];return db['SmsMessage'][_0x21ff('0x5a')]({'where':{'messageId':_0x17b1ef[_0x21ff('0x5c')][0x0][_0x21ff('0x2a')]['id']}});}break;case _0x21ff('0xd4'):if(_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0xd5')]&&_0x17b1ef['body'][_0x21ff('0x2f')]){_0x118370=_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x2f')];return db[_0x21ff('0xad')][_0x21ff('0x5a')]({'where':{'messageId':_0x17b1ef[_0x21ff('0x5c')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x143fb4,null))[_0x21ff('0x39')](function(_0x464e85){if(_0x464e85){_0x505502=_0x464e85;switch(_0xaf74c8[_0x21ff('0x85')]){case _0x21ff('0x8a'):if(_0x118370===_0x21ff('0xd6')){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger['error'](_0x21ff('0x27'),_0x21ff('0x2f'),_0x21ff('0x8a'),util[_0x21ff('0xce')](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x21ff('0x8c'):if(_0x118370==='1'){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger[_0x21ff('0x28')](_0x21ff('0x27'),_0x21ff('0x2f'),'skebby',util['inspect'](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x21ff('0xd1'):if(!_0x17b1ef['body'][_0x21ff('0xd7')]&&_0x118370>=0xc8&&_0x118370<=0xce){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger['error'](_0x21ff('0x27'),_0x21ff('0x2f'),_0x21ff('0xd1'),util['inspect'](_0x17b1ef['body'],{'showHidden':![],'depth':null}));}break;case _0x21ff('0x91'):var _0xad8246=_0x17b1ef[_0x21ff('0x5c')][_0x21ff('0x92')][0x0];if(_0xad8246[_0x21ff('0x2f')]['groupName']===_0x21ff('0xd6')){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger[_0x21ff('0x28')](_0x21ff('0x27'),_0x21ff('0x2f'),'infobip',util[_0x21ff('0xce')](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x21ff('0x95'):if(_0x118370=='DELIVERED_TO_GATEWAY'||_0x118370==_0x21ff('0xd8')){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger[_0x21ff('0x28')](_0x21ff('0x27'),_0x21ff('0x2f'),_0x21ff('0x95'),util[_0x21ff('0xce')](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x21ff('0x98'):if(_0x118370==_0x21ff('0xd9')){return _0x505502[_0x21ff('0x38')]({'read':!![]});}else{logger[_0x21ff('0x28')](_0x21ff('0x27'),'status',_0x21ff('0x98'),util['inspect'](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x21ff('0xd4'):if(_0x118370===_0x21ff('0xda')||_0x118370==='ACCEPTD'){return _0x505502['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x21ff('0x2f'),_0x21ff('0xd4'),util[_0x21ff('0xce')](_0x17b1ef[_0x21ff('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x505502;}})['then'](respondWithResult(_0x143fb4,null))[_0x21ff('0x2c')](handleError(_0x143fb4,null));};exports['statusGet']=function(_0x133b2a,_0x18e687,_0x1d25c3){var _0x43ff04,_0x47f075,_0x2f442e;return db[_0x21ff('0x43')][_0x21ff('0x5a')]({'where':{'id':_0x133b2a[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x18e687,null))[_0x21ff('0x39')](function(_0x2ffc73){if(_0x2ffc73){_0x2f442e=_0x2ffc73;logger[_0x21ff('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x21ff('0x2f'),_0x21ff('0xcd'),_0x2ffc73[_0x21ff('0x85')],util[_0x21ff('0xce')](_0x133b2a[_0x21ff('0x46')],{'showHidden':![],'depth':null}));switch(_0x2ffc73['type']){case _0x21ff('0x93'):if(_0x133b2a['query'][_0x21ff('0xdb')]&&_0x133b2a[_0x21ff('0x46')]['state']){_0x47f075=_0x133b2a['query'][_0x21ff('0xdc')];return db[_0x21ff('0xad')][_0x21ff('0x5a')]({'where':{'messageId':_0x133b2a['query'][_0x21ff('0xdb')]}});}break;}}})[_0x21ff('0x39')](handleEntityNotFound(_0x18e687,null))[_0x21ff('0x39')](function(_0x1494a6){if(_0x1494a6){_0x43ff04=_0x1494a6;switch(_0x2f442e[_0x21ff('0x85')]){case'csc':if(_0x47f075==='2'||_0x47f075==='6'){return _0x43ff04['update']({'read':!![]});}else{logger[_0x21ff('0x28')](_0x21ff('0x27'),_0x21ff('0x2f'),_0x21ff('0x93'),util[_0x21ff('0xce')](_0x133b2a[_0x21ff('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x43ff04;}})['then'](respondWithResult(_0x18e687,null))[_0x21ff('0x2c')](handleError(_0x18e687,null));};exports[_0x21ff('0xdd')]=function(_0x405956,_0x4beddb,_0x1c05dc){return db[_0x21ff('0x43')]['find']({'where':{'id':_0x405956[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x4beddb,null))[_0x21ff('0x39')](function(_0x5437ef){if(_0x5437ef){return _0x5437ef[_0x21ff('0xdd')](_0x405956[_0x21ff('0x5c')][_0x21ff('0x6e')],_[_0x21ff('0xa4')](_0x405956[_0x21ff('0x5c')],[_0x21ff('0x6e'),'id'])||{})[_0x21ff('0xcb')](function(_0x28f338){for(var _0x4f21f5=0x0;_0x4f21f5<_0x405956['body'][_0x21ff('0x6e')]['length'];_0x4f21f5+=0x1){socket[_0x21ff('0xde')](_0x21ff('0xdf'),{'UserId':Number(_0x405956[_0x21ff('0x5c')]['ids'][_0x4f21f5]),'SmsAccountId':Number(_0x405956[_0x21ff('0x58')]['id'])});}return _0x28f338;});}})['then'](respondWithResult(_0x4beddb,null))['catch'](handleError(_0x4beddb,null));};exports[_0x21ff('0xe0')]=function(_0x2cb7be,_0x3d97a0,_0x4c4cfb){return db['SmsAccount'][_0x21ff('0x5a')]({'where':{'id':_0x2cb7be[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x3d97a0,null))[_0x21ff('0x39')](function(_0xdab702){if(_0xdab702){return _0xdab702[_0x21ff('0xe0')](_0x2cb7be[_0x21ff('0x46')][_0x21ff('0x6e')])[_0x21ff('0x39')](function(){if(_[_0x21ff('0xe1')](_0x2cb7be[_0x21ff('0x46')][_0x21ff('0x6e')])){for(var _0xa3ccab=0x0;_0xa3ccab<_0x2cb7be[_0x21ff('0x46')][_0x21ff('0x6e')]['length'];_0xa3ccab+=0x1){socket['emit'](_0x21ff('0xe2'),{'UserId':Number(_0x2cb7be['query'][_0x21ff('0x6e')][_0xa3ccab]),'SmsAccountId':Number(_0x2cb7be[_0x21ff('0x58')]['id'])});}}else{socket['emit'](_0x21ff('0xe2'),{'UserId':Number(_0x2cb7be[_0x21ff('0x46')][_0x21ff('0x6e')]),'SmsAccountId':Number(_0x2cb7be[_0x21ff('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d97a0,null))[_0x21ff('0x2c')](handleError(_0x3d97a0,null));};exports['getAgents']=function(_0xd587d5,_0x47db9e,_0x13f692){var _0x3fe703={};var _0x5997c4={};var _0x34c867;var _0x7431c0;return db[_0x21ff('0x43')][_0x21ff('0x6b')]({'where':{'id':_0xd587d5[_0x21ff('0x58')]['id']}})[_0x21ff('0x39')](handleEntityNotFound(_0x47db9e,null))['then'](function(_0x37c4ba){if(_0x37c4ba){_0x34c867=_0x37c4ba;_0x5997c4[_0x21ff('0x45')]=_[_0x21ff('0x47')](db[_0x21ff('0xb1')][_0x21ff('0x44')]);_0x5997c4[_0x21ff('0x46')]=_['keys'](_0xd587d5[_0x21ff('0x46')]);_0x5997c4[_0x21ff('0x50')]=_['intersection'](_0x5997c4[_0x21ff('0x45')],_0x5997c4['query']);_0x3fe703['attributes']=_[_0x21ff('0x59')](_0x5997c4[_0x21ff('0x45')],qs[_0x21ff('0x49')](_0xd587d5[_0x21ff('0x46')][_0x21ff('0x49')]));_0x3fe703[_0x21ff('0x48')]=_0x3fe703[_0x21ff('0x48')][_0x21ff('0x4a')]?_0x3fe703[_0x21ff('0x48')]:_0x5997c4[_0x21ff('0x45')];_0x3fe703[_0x21ff('0x4d')]=qs[_0x21ff('0x4e')](_0xd587d5['query'][_0x21ff('0x4e')]);_0x3fe703['where']=qs[_0x21ff('0x50')](_[_0x21ff('0x72')](_0xd587d5['query'],_0x5997c4['filters']));if(_0xd587d5[_0x21ff('0x46')][_0x21ff('0x53')]){_0x3fe703[_0x21ff('0x4f')]=_['merge'](_0x3fe703[_0x21ff('0x4f')],{'$or':_['map'](_0x3fe703[_0x21ff('0x48')],function(_0x30858e){var _0x1a58b5={};_0x1a58b5[_0x30858e]={'$like':'%'+_0xd587d5[_0x21ff('0x46')][_0x21ff('0x53')]+'%'};return _0x1a58b5;})});}_0x3fe703=_[_0x21ff('0x51')]({},_0x3fe703,_0xd587d5[_0x21ff('0x54')]);return _0x34c867[_0x21ff('0xe3')](_0x3fe703);}})[_0x21ff('0x39')](function(_0x2b0fb3){if(_0x2b0fb3){_0x7431c0=_0x2b0fb3[_0x21ff('0x4a')];if(!_0xd587d5[_0x21ff('0x46')][_0x21ff('0x4b')](_0x21ff('0x4c'))){_0x3fe703[_0x21ff('0x33')]=qs[_0x21ff('0x33')](_0xd587d5[_0x21ff('0x46')]['limit']);_0x3fe703[_0x21ff('0x31')]=qs[_0x21ff('0x31')](_0xd587d5['query'][_0x21ff('0x31')]);}return _0x34c867[_0x21ff('0xe3')](_0x3fe703);}})[_0x21ff('0x39')](function(_0x1b5efd){if(_0x1b5efd){return _0x1b5efd?{'count':_0x7431c0,'rows':_0x1b5efd}:null;}})[_0x21ff('0x39')](respondWithResult(_0x47db9e,null))[_0x21ff('0x2c')](handleError(_0x47db9e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5c14fc9..1c07b90 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 _0x8a2a=['SmsAccount','save','update','remove','emit','exports','events'];(function(_0x183919,_0x4c30ee){var _0x19da5f=function(_0x55ff44){while(--_0x55ff44){_0x183919['push'](_0x183919['shift']());}};_0x19da5f(++_0x4c30ee);}(_0x8a2a,0xe6));var _0xa8a2=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x8a2a[_0x593564];return _0x211a89;};'use strict';var EventEmitter=require(_0xa8a2('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xa8a2('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8a2('0x2'),'afterUpdate':_0xa8a2('0x3'),'afterDestroy':_0xa8a2('0x4')};function emitEvent(_0x3c771d){return function(_0x4f1c14,_0x28e9,_0x43d4a1){SmsAccountEvents[_0xa8a2('0x5')](_0x3c771d+':'+_0x4f1c14['id'],_0x4f1c14);SmsAccountEvents[_0xa8a2('0x5')](_0x3c771d,_0x4f1c14);_0x43d4a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa8a2('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x76d2=['hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x1da0d1,_0x56a820){var _0x107fb9=function(_0x219149){while(--_0x219149){_0x1da0d1['push'](_0x1da0d1['shift']());}};_0x107fb9(++_0x56a820);}(_0x76d2,0x1ba));var _0x276d=function(_0xb393cf,_0xb5361f){_0xb393cf=_0xb393cf-0x0;var _0x185f43=_0x76d2[_0xb393cf];return _0x185f43;};'use strict';var EventEmitter=require(_0x276d('0x0'));var SmsAccount=require(_0x276d('0x1'))['db'][_0x276d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x276d('0x3')](0x0);var events={'afterCreate':_0x276d('0x4'),'afterUpdate':_0x276d('0x5'),'afterDestroy':_0x276d('0x6')};function emitEvent(_0x6e8fc){return function(_0x54013f,_0x3890b6,_0x47e9a2){SmsAccountEvents[_0x276d('0x7')](_0x6e8fc+':'+_0x54013f['id'],_0x54013f);SmsAccountEvents[_0x276d('0x7')](_0x6e8fc,_0x54013f);_0x47e9a2(null);};}for(var e in events){if(events[_0x276d('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3ec4616..3034afe 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 _0xdfc6=['exports','sms_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes'];(function(_0x12eadf,_0x5bbe33){var _0x98875e=function(_0x16b898){while(--_0x16b898){_0x12eadf['push'](_0x12eadf['shift']());}};_0x98875e(++_0x5bbe33);}(_0xdfc6,0x124));var _0x6dfc=function(_0x3334aa,_0x46f21f){_0x3334aa=_0x3334aa-0x0;var _0x1cc4f2=_0xdfc6[_0x3334aa];return _0x1cc4f2;};'use strict';var _=require(_0x6dfc('0x0'));var util=require(_0x6dfc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6dfc('0x2'));var BPromise=require(_0x6dfc('0x3'));var rp=require(_0x6dfc('0x4'));var fs=require('fs');var path=require(_0x6dfc('0x5'));var rimraf=require('rimraf');var config=require(_0x6dfc('0x6'));var attributes=require(_0x6dfc('0x7'));module[_0x6dfc('0x8')]=function(_0x297c0d,_0x231071){return _0x297c0d['define']('SmsAccount',attributes,{'tableName':_0x6dfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eeb=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','api','moment'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x2eeb,0x80));var _0xb2ee=function(_0x3295fe,_0x3420ee){_0x3295fe=_0x3295fe-0x0;var _0x567b95=_0x2eeb[_0x3295fe];return _0x567b95;};'use strict';var _=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var logger=require('../../config/logger')(_0xb2ee('0x2'));var moment=require(_0xb2ee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2ee('0x4'));var rimraf=require(_0xb2ee('0x5'));var config=require(_0xb2ee('0x6'));var attributes=require(_0xb2ee('0x7'));module[_0xb2ee('0x8')]=function(_0x418055,_0x561bdd){return _0x418055['define'](_0xb2ee('0x9'),attributes,{'tableName':_0xb2ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 2941f74..9f7f39e 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 _0x7dd9=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','SmsAccount','find','options','raw','attributes','include','model','map','ShowSmsAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3c58af,_0x4d82af){var _0x2d3ad3=function(_0x468a11){while(--_0x468a11){_0x3c58af['push'](_0x3c58af['shift']());}};_0x2d3ad3(++_0x4d82af);}(_0x7dd9,0x1ce));var _0x97dd=function(_0x2bb0ff,_0x22c9e2){_0x2bb0ff=_0x2bb0ff-0x0;var _0x497825=_0x7dd9[_0x2bb0ff];return _0x497825;};'use strict';var _=require(_0x97dd('0x0'));var util=require(_0x97dd('0x1'));var moment=require(_0x97dd('0x2'));var BPromise=require(_0x97dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97dd('0x4'));var db=require(_0x97dd('0x5'))['db'];var utils=require(_0x97dd('0x6'));var logger=require(_0x97dd('0x7'))(_0x97dd('0x8'));var config=require(_0x97dd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x97dd('0xa')][_0x97dd('0xb')]({'port':0x232a});config[_0x97dd('0xc')]=_[_0x97dd('0xd')](config[_0x97dd('0xc')],{'host':_0x97dd('0xe'),'port':0x18eb});var socket=require(_0x97dd('0xf'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x97dd('0x10')](socket);function respondWithRpcPromise(_0x4e2881,_0x20bec7,_0x5cb013){return new BPromise(function(_0x1c9172,_0x24bce3){return client[_0x97dd('0x11')](_0x4e2881,_0x5cb013)[_0x97dd('0x12')](function(_0x2eb3e7){logger[_0x97dd('0x13')]('SmsAccount,\x20%s,\x20%s',_0x20bec7,_0x97dd('0x14'));logger[_0x97dd('0x15')](_0x97dd('0x16'),_0x20bec7,_0x97dd('0x14'),JSON[_0x97dd('0x17')](_0x2eb3e7));if(_0x2eb3e7[_0x97dd('0x18')]){if(_0x2eb3e7[_0x97dd('0x18')][_0x97dd('0x19')]===0x1f4){logger[_0x97dd('0x18')](_0x97dd('0x1a'),_0x20bec7,_0x2eb3e7[_0x97dd('0x18')][_0x97dd('0x1b')]);return _0x24bce3(_0x2eb3e7['error']['message']);}logger[_0x97dd('0x18')](_0x97dd('0x1a'),_0x20bec7,_0x2eb3e7[_0x97dd('0x18')][_0x97dd('0x1b')]);return _0x1c9172(_0x2eb3e7[_0x97dd('0x18')][_0x97dd('0x1b')]);}else{logger[_0x97dd('0x13')](_0x97dd('0x1a'),_0x20bec7,_0x97dd('0x14'));_0x1c9172(_0x2eb3e7[_0x97dd('0x1c')][_0x97dd('0x1b')]);}})[_0x97dd('0x1d')](function(_0x2f0e51){logger[_0x97dd('0x18')]('SmsAccount,\x20%s,\x20%s',_0x20bec7,_0x2f0e51);_0x24bce3(_0x2f0e51);});});}exports['ShowSmsAccount']=function(_0x2de304){var _0x3ab0ad=this;return new Promise(function(_0x358e07,_0x45bdd7){return db[_0x97dd('0x1e')][_0x97dd('0x1f')]({'raw':_0x2de304[_0x97dd('0x20')]?_0x2de304['options'][_0x97dd('0x21')]===undefined?!![]:![]:!![],'where':_0x2de304['options']?_0x2de304['options']['where']||null:null,'attributes':_0x2de304['options']?_0x2de304[_0x97dd('0x20')][_0x97dd('0x22')]||null:null,'include':_0x2de304[_0x97dd('0x20')]?_0x2de304[_0x97dd('0x20')][_0x97dd('0x23')]?_['map'](_0x2de304[_0x97dd('0x20')][_0x97dd('0x23')],function(_0x8de051){return{'model':db[_0x8de051[_0x97dd('0x24')]],'as':_0x8de051['as'],'attributes':_0x8de051[_0x97dd('0x22')],'include':_0x8de051[_0x97dd('0x23')]?_['map'](_0x8de051['include'],function(_0x31f79c){return{'model':db[_0x31f79c['model']],'as':_0x31f79c['as'],'attributes':_0x31f79c['attributes'],'include':_0x31f79c[_0x97dd('0x23')]?_[_0x97dd('0x25')](_0x31f79c[_0x97dd('0x23')],function(_0x372130){return{'model':db[_0x372130['model']],'as':_0x372130['as'],'attributes':_0x372130['attributes']};}):[]};}):[]};}):[]:[]})[_0x97dd('0x12')](function(_0x21a917){logger['info']('ShowSmsAccount',_0x2de304);logger[_0x97dd('0x15')](_0x97dd('0x26'),_0x2de304,JSON[_0x97dd('0x17')](_0x21a917));_0x358e07(_0x21a917);})['catch'](function(_0x4adc8c){logger[_0x97dd('0x18')](_0x97dd('0x26'),_0x4adc8c[_0x97dd('0x1b')],_0x2de304);_0x45bdd7(_0x3ab0ad[_0x97dd('0x18')](0x1f4,_0x4adc8c[_0x97dd('0x1b')]));});});}; \ No newline at end of file +var _0xb279=['include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','SmsAccount,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes'];(function(_0x5cb637,_0x4ab734){var _0x2b671f=function(_0x20a11a){while(--_0x20a11a){_0x5cb637['push'](_0x5cb637['shift']());}};_0x2b671f(++_0x4ab734);}(_0xb279,0x15a));var _0x9b27=function(_0x3aa961,_0x44607a){_0x3aa961=_0x3aa961-0x0;var _0x3dedbd=_0xb279[_0x3aa961];return _0x3dedbd;};'use strict';var _=require(_0x9b27('0x0'));var util=require(_0x9b27('0x1'));var moment=require(_0x9b27('0x2'));var BPromise=require(_0x9b27('0x3'));var rs=require(_0x9b27('0x4'));var fs=require('fs');var Redis=require(_0x9b27('0x5'));var db=require(_0x9b27('0x6'))['db'];var utils=require(_0x9b27('0x7'));var logger=require(_0x9b27('0x8'))(_0x9b27('0x9'));var config=require('../../config/environment');var jayson=require(_0x9b27('0xa'));var client=jayson[_0x9b27('0xb')][_0x9b27('0xc')]({'port':0x232a});config['redis']=_[_0x9b27('0xd')](config[_0x9b27('0xe')],{'host':_0x9b27('0xf'),'port':0x18eb});var socket=require(_0x9b27('0x10'))(new Redis(config[_0x9b27('0xe')]));require('./smsAccount.socket')[_0x9b27('0x11')](socket);function respondWithRpcPromise(_0x5a57c9,_0x573460,_0x35f7de){return new BPromise(function(_0x41c3da,_0x157ca7){return client['request'](_0x5a57c9,_0x35f7de)[_0x9b27('0x12')](function(_0x1f388e){logger['info'](_0x9b27('0x13'),_0x573460,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x573460,'request\x20sent',JSON[_0x9b27('0x14')](_0x1f388e));if(_0x1f388e['error']){if(_0x1f388e['error'][_0x9b27('0x15')]===0x1f4){logger[_0x9b27('0x16')](_0x9b27('0x13'),_0x573460,_0x1f388e[_0x9b27('0x16')][_0x9b27('0x17')]);return _0x157ca7(_0x1f388e[_0x9b27('0x16')][_0x9b27('0x17')]);}logger[_0x9b27('0x16')](_0x9b27('0x13'),_0x573460,_0x1f388e[_0x9b27('0x16')]['message']);return _0x41c3da(_0x1f388e[_0x9b27('0x16')][_0x9b27('0x17')]);}else{logger[_0x9b27('0x18')]('SmsAccount,\x20%s,\x20%s',_0x573460,_0x9b27('0x19'));_0x41c3da(_0x1f388e[_0x9b27('0x1a')][_0x9b27('0x17')]);}})['catch'](function(_0x399248){logger['error'](_0x9b27('0x13'),_0x573460,_0x399248);_0x157ca7(_0x399248);});});}exports[_0x9b27('0x1b')]=function(_0x42deab){var _0xbdcc75=this;return new Promise(function(_0x379153,_0x16a258){return db[_0x9b27('0x1c')][_0x9b27('0x1d')]({'raw':_0x42deab[_0x9b27('0x1e')]?_0x42deab[_0x9b27('0x1e')][_0x9b27('0x1f')]===undefined?!![]:![]:!![],'where':_0x42deab[_0x9b27('0x1e')]?_0x42deab['options'][_0x9b27('0x20')]||null:null,'attributes':_0x42deab[_0x9b27('0x1e')]?_0x42deab[_0x9b27('0x1e')][_0x9b27('0x21')]||null:null,'include':_0x42deab['options']?_0x42deab[_0x9b27('0x1e')][_0x9b27('0x22')]?_[_0x9b27('0x23')](_0x42deab[_0x9b27('0x1e')][_0x9b27('0x22')],function(_0x184212){return{'model':db[_0x184212[_0x9b27('0x24')]],'as':_0x184212['as'],'attributes':_0x184212[_0x9b27('0x21')],'include':_0x184212[_0x9b27('0x22')]?_[_0x9b27('0x23')](_0x184212[_0x9b27('0x22')],function(_0x16e83d){return{'model':db[_0x16e83d[_0x9b27('0x24')]],'as':_0x16e83d['as'],'attributes':_0x16e83d[_0x9b27('0x21')],'include':_0x16e83d['include']?_[_0x9b27('0x23')](_0x16e83d['include'],function(_0x8bfa07){return{'model':db[_0x8bfa07[_0x9b27('0x24')]],'as':_0x8bfa07['as'],'attributes':_0x8bfa07[_0x9b27('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9b27('0x12')](function(_0x203cf9){logger['info'](_0x9b27('0x1b'),_0x42deab);logger[_0x9b27('0x25')](_0x9b27('0x1b'),_0x42deab,JSON[_0x9b27('0x14')](_0x203cf9));_0x379153(_0x203cf9);})['catch'](function(_0x5c5e0e){logger['error'](_0x9b27('0x1b'),_0x5c5e0e['message'],_0x42deab);_0x16a258(_0xbdcc75[_0x9b27('0x16')](0x1f4,_0x5c5e0e[_0x9b27('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 12c46ea..06d0d82 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 364b449..08af07c 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3d1c95,_0x10ced8){var _0x2c17c5=function(_0x3d7415){while(--_0x3d7415){_0x3d1c95['push'](_0x3d1c95['shift']());}};_0x2c17c5(++_0x10ced8);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4cd92a,_0x226fe6){var _0x4543f2=function(_0x52ddab){while(--_0x52ddab){_0x4cd92a['push'](_0x4cd92a['shift']());}};_0x4543f2(++_0x226fe6);}(_0xedd9,0xfc));var _0x9edd=function(_0x433650,_0x2780ed){_0x433650=_0x433650-0x0;var _0x13ce1d=_0xedd9[_0x433650];return _0x13ce1d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 483bce5..4826bfe 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 _0x4420=['STRING','noop','TEXT','sequelize','exports'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x4420,0x1e3));var _0x0442=function(_0x4cb9b8,_0x549cd1){_0x4cb9b8=_0x4cb9b8-0x0;var _0xdf5570=_0x4420[_0x4cb9b8];return _0xdf5570;};'use strict';var Sequelize=require(_0x0442('0x0'));module[_0x0442('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0442('0x2')],'allowNull':![],'defaultValue':_0x0442('0x3')},'appdata':{'type':Sequelize[_0x0442('0x4')]()},'description':{'type':Sequelize[_0x0442('0x2')]},'interval':{'type':Sequelize[_0x0442('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2b30=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b30,0x171));var _0x02b3=function(_0x37f715,_0xc656fd){_0x37f715=_0x37f715-0x0;var _0x43db5f=_0x2b30[_0x37f715];return _0x43db5f;};'use strict';var Sequelize=require(_0x02b3('0x0'));module[_0x02b3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x02b3('0x2')],'allowNull':![],'defaultValue':_0x02b3('0x3')},'appdata':{'type':Sequelize[_0x02b3('0x4')]()},'description':{'type':Sequelize[_0x02b3('0x2')]},'interval':{'type':Sequelize[_0x02b3('0x2')],'defaultValue':_0x02b3('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 76f84b9..bfee0b5 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 _0x3501=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','includeAll','include','rows','show','params','find','create','body','catch','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x535e64,_0x2c9b4b){var _0x2014c6=function(_0x4fd573){while(--_0x4fd573){_0x535e64['push'](_0x535e64['shift']());}};_0x2014c6(++_0x2c9b4b);}(_0x3501,0x124));var _0x1350=function(_0x950c48,_0x3acdaf){_0x950c48=_0x950c48-0x0;var _0x20398c=_0x3501[_0x950c48];return _0x20398c;};'use strict';var emlformat=require(_0x1350('0x0'));var rimraf=require(_0x1350('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1350('0x2'));var rp=require(_0x1350('0x3'));var moment=require('moment');var BPromise=require(_0x1350('0x4'));var Mustache=require(_0x1350('0x5'));var util=require(_0x1350('0x6'));var path=require(_0x1350('0x7'));var sox=require('sox');var csv=require(_0x1350('0x8'));var ejs=require(_0x1350('0x9'));var fs=require('fs');var fs_extra=require(_0x1350('0xa'));var _=require(_0x1350('0xb'));var squel=require(_0x1350('0xc'));var crypto=require(_0x1350('0xd'));var jsforce=require(_0x1350('0xe'));var deskjs=require(_0x1350('0xf'));var toCsv=require(_0x1350('0x8'));var querystring=require('querystring');var Papa=require(_0x1350('0x10'));var Redis=require(_0x1350('0x11'));var authService=require(_0x1350('0x12'));var qs=require(_0x1350('0x13'));var as=require(_0x1350('0x14'));var hardwareService=require(_0x1350('0x15'));var logger=require(_0x1350('0x16'))(_0x1350('0x17'));var utils=require(_0x1350('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1350('0x19'));var db=require(_0x1350('0x1a'))['db'];function respondWithStatusCode(_0x23a4ed,_0x4d3fdc){_0x4d3fdc=_0x4d3fdc||0xcc;return function(_0x14dc12){if(_0x14dc12){return _0x23a4ed[_0x1350('0x1b')](_0x4d3fdc);}return _0x23a4ed[_0x1350('0x1c')](_0x4d3fdc)[_0x1350('0x1d')]();};}function respondWithResult(_0x1e9225,_0x4102e5){_0x4102e5=_0x4102e5||0xc8;return function(_0x3ca54a){if(_0x3ca54a){return _0x1e9225['status'](_0x4102e5)[_0x1350('0x1e')](_0x3ca54a);}};}function respondWithFilteredResult(_0xf42e8b,_0x26cb60){return function(_0x7ae518){if(_0x7ae518){var _0x559df6=typeof _0x26cb60[_0x1350('0x1f')]===_0x1350('0x20')&&typeof _0x26cb60[_0x1350('0x21')]==='undefined';var _0x45a5f7=_0x7ae518[_0x1350('0x22')];var _0x22fffd=_0x559df6?0x0:_0x26cb60['offset'];var _0x5b5e1c=_0x559df6?_0x7ae518['count']:_0x26cb60[_0x1350('0x1f')]+_0x26cb60[_0x1350('0x21')];var _0xeaead;if(_0x5b5e1c>=_0x45a5f7){_0x5b5e1c=_0x45a5f7;_0xeaead=0xc8;}else{_0xeaead=0xce;}_0xf42e8b[_0x1350('0x1c')](_0xeaead);return _0xf42e8b['set'](_0x1350('0x23'),_0x22fffd+'-'+_0x5b5e1c+'/'+_0x45a5f7)[_0x1350('0x1e')](_0x7ae518);}return null;};}function patchUpdates(_0x4c5b16){return function(_0x52a330){try{jsonpatch[_0x1350('0x24')](_0x52a330,_0x4c5b16,!![]);}catch(_0x2abcae){return BPromise[_0x1350('0x25')](_0x2abcae);}return _0x52a330[_0x1350('0x26')]();};}function saveUpdates(_0x27fec7,_0x154cb5){return function(_0x4a1dc1){if(_0x4a1dc1){return _0x4a1dc1[_0x1350('0x27')](_0x27fec7)[_0x1350('0x28')](function(_0x17ff93){return _0x17ff93;});}return null;};}function removeEntity(_0x353e70,_0x7c6cfc){return function(_0x33b405){if(_0x33b405){return _0x33b405['destroy']()[_0x1350('0x28')](function(){_0x353e70[_0x1350('0x1c')](0xcc)[_0x1350('0x1d')]();});}};}function handleEntityNotFound(_0xd34c7b,_0x80ee59){return function(_0x43bc9a){if(!_0x43bc9a){_0xd34c7b[_0x1350('0x1b')](0x194);}return _0x43bc9a;};}function handleError(_0x1cf6d1,_0x2fdd1b){_0x2fdd1b=_0x2fdd1b||0x1f4;return function(_0x551b22){logger['error'](_0x551b22['stack']);if(_0x551b22[_0x1350('0x29')]){delete _0x551b22[_0x1350('0x29')];}_0x1cf6d1[_0x1350('0x1c')](_0x2fdd1b)[_0x1350('0x2a')](_0x551b22);};}exports['index']=function(_0x59c1ce,_0x482f7d){var _0x54f677={},_0x2d20b5={},_0x1adc6f={'count':0x0,'rows':[]};var _0xed520e=_[_0x1350('0x2b')](db['SmsApplication'][_0x1350('0x2c')],function(_0x1d139a){return{'name':_0x1d139a['fieldName'],'type':_0x1d139a[_0x1350('0x2d')][_0x1350('0x2e')]};});_0x2d20b5[_0x1350('0x2f')]=_[_0x1350('0x2b')](_0xed520e,_0x1350('0x29'));_0x2d20b5[_0x1350('0x30')]=_[_0x1350('0x31')](_0x59c1ce['query']);_0x2d20b5[_0x1350('0x32')]=_[_0x1350('0x33')](_0x2d20b5['model'],_0x2d20b5['query']);_0x54f677[_0x1350('0x34')]=_[_0x1350('0x33')](_0x2d20b5[_0x1350('0x2f')],qs[_0x1350('0x35')](_0x59c1ce['query'][_0x1350('0x35')]));_0x54f677[_0x1350('0x34')]=_0x54f677[_0x1350('0x34')][_0x1350('0x36')]?_0x54f677['attributes']:_0x2d20b5['model'];if(!_0x59c1ce[_0x1350('0x30')][_0x1350('0x37')]('nolimit')){_0x54f677[_0x1350('0x21')]=qs[_0x1350('0x21')](_0x59c1ce['query'][_0x1350('0x21')]);_0x54f677[_0x1350('0x1f')]=qs[_0x1350('0x1f')](_0x59c1ce['query'][_0x1350('0x1f')]);}_0x54f677[_0x1350('0x38')]=qs[_0x1350('0x39')](_0x59c1ce['query'][_0x1350('0x39')]);_0x54f677[_0x1350('0x3a')]=qs[_0x1350('0x32')](_[_0x1350('0x3b')](_0x59c1ce[_0x1350('0x30')],_0x2d20b5[_0x1350('0x32')]),_0xed520e);if(_0x59c1ce['query'][_0x1350('0x3c')]){_0x54f677[_0x1350('0x3a')]=_[_0x1350('0x3d')](_0x54f677[_0x1350('0x3a')],{'$or':_[_0x1350('0x2b')](_0xed520e,function(_0x38f236){if(_0x38f236['type']!==_0x1350('0x3e')){var _0x3f4221={};_0x3f4221[_0x38f236['name']]={'$like':'%'+_0x59c1ce[_0x1350('0x30')][_0x1350('0x3c')]+'%'};return _0x3f4221;}})});}_0x54f677=_[_0x1350('0x3d')]({},_0x54f677,_0x59c1ce[_0x1350('0x3f')]);var _0x1db359={'where':_0x54f677[_0x1350('0x3a')]};return db[_0x1350('0x40')][_0x1350('0x22')](_0x1db359)[_0x1350('0x28')](function(_0x1f7fbf){_0x1adc6f[_0x1350('0x22')]=_0x1f7fbf;if(_0x59c1ce[_0x1350('0x30')][_0x1350('0x41')]){_0x54f677[_0x1350('0x42')]=[{'all':!![]}];}return db[_0x1350('0x40')]['findAll'](_0x54f677);})[_0x1350('0x28')](function(_0x199fc6){_0x1adc6f[_0x1350('0x43')]=_0x199fc6;return _0x1adc6f;})[_0x1350('0x28')](respondWithFilteredResult(_0x482f7d,_0x54f677))['catch'](handleError(_0x482f7d,null));};exports[_0x1350('0x44')]=function(_0x52963d,_0x1f644c){var _0x215cc4={'raw':!![],'where':{'id':_0x52963d[_0x1350('0x45')]['id']}},_0x81826={};_0x81826['model']=_[_0x1350('0x31')](db['SmsApplication']['rawAttributes']);_0x81826[_0x1350('0x30')]=_['keys'](_0x52963d[_0x1350('0x30')]);_0x81826[_0x1350('0x32')]=_['intersection'](_0x81826[_0x1350('0x2f')],_0x81826[_0x1350('0x30')]);_0x215cc4[_0x1350('0x34')]=_[_0x1350('0x33')](_0x81826['model'],qs['fields'](_0x52963d['query'][_0x1350('0x35')]));_0x215cc4['attributes']=_0x215cc4['attributes'][_0x1350('0x36')]?_0x215cc4[_0x1350('0x34')]:_0x81826[_0x1350('0x2f')];if(_0x52963d['query'][_0x1350('0x41')]){_0x215cc4[_0x1350('0x42')]=[{'all':!![]}];}_0x215cc4=_[_0x1350('0x3d')]({},_0x215cc4,_0x52963d[_0x1350('0x3f')]);return db['SmsApplication'][_0x1350('0x46')](_0x215cc4)[_0x1350('0x28')](handleEntityNotFound(_0x1f644c,null))['then'](respondWithResult(_0x1f644c,null))['catch'](handleError(_0x1f644c,null));};exports[_0x1350('0x47')]=function(_0x2649ff,_0x2115a4){return db[_0x1350('0x40')][_0x1350('0x47')](_0x2649ff[_0x1350('0x48')],{})[_0x1350('0x28')](respondWithResult(_0x2115a4,0xc9))[_0x1350('0x49')](handleError(_0x2115a4,null));};exports[_0x1350('0x27')]=function(_0x35fbd4,_0x272fcc){if(_0x35fbd4[_0x1350('0x48')]['id']){delete _0x35fbd4[_0x1350('0x48')]['id'];}return db[_0x1350('0x40')]['find']({'where':{'id':_0x35fbd4['params']['id']}})[_0x1350('0x28')](handleEntityNotFound(_0x272fcc,null))[_0x1350('0x28')](saveUpdates(_0x35fbd4['body'],null))[_0x1350('0x28')](respondWithResult(_0x272fcc,null))['catch'](handleError(_0x272fcc,null));};exports[_0x1350('0x4a')]=function(_0x2849e2,_0x4e0889){return db[_0x1350('0x40')][_0x1350('0x46')]({'where':{'id':_0x2849e2[_0x1350('0x45')]['id']}})[_0x1350('0x28')](handleEntityNotFound(_0x4e0889,null))['then'](removeEntity(_0x4e0889,null))[_0x1350('0x49')](handleError(_0x4e0889,null));}; \ No newline at end of file +var _0x02c1=['sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','update','then','error','stack','name','send','index','SmsApplication','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit'];(function(_0x26211a,_0x5d912d){var _0x4b70a8=function(_0x43efba){while(--_0x43efba){_0x26211a['push'](_0x26211a['shift']());}};_0x4b70a8(++_0x5d912d);}(_0x02c1,0xe2));var _0x102c=function(_0x55bdea,_0x1dab6e){_0x55bdea=_0x55bdea-0x0;var _0x398194=_0x02c1[_0x55bdea];return _0x398194;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x102c('0x0'));var zipdir=require(_0x102c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x102c('0x2'));var moment=require('moment');var BPromise=require(_0x102c('0x3'));var Mustache=require(_0x102c('0x4'));var util=require(_0x102c('0x5'));var path=require(_0x102c('0x6'));var sox=require(_0x102c('0x7'));var csv=require(_0x102c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x102c('0x9'));var _=require(_0x102c('0xa'));var squel=require(_0x102c('0xb'));var crypto=require(_0x102c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x102c('0xd'));var toCsv=require(_0x102c('0x8'));var querystring=require(_0x102c('0xe'));var Papa=require(_0x102c('0xf'));var Redis=require('ioredis');var authService=require(_0x102c('0x10'));var qs=require(_0x102c('0x11'));var as=require(_0x102c('0x12'));var hardwareService=require(_0x102c('0x13'));var logger=require(_0x102c('0x14'))(_0x102c('0x15'));var utils=require(_0x102c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x102c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x908a20,_0xbdc9fe){_0xbdc9fe=_0xbdc9fe||0xcc;return function(_0x3e16f5){if(_0x3e16f5){return _0x908a20[_0x102c('0x18')](_0xbdc9fe);}return _0x908a20[_0x102c('0x19')](_0xbdc9fe)[_0x102c('0x1a')]();};}function respondWithResult(_0x3fb277,_0x3f69a6){_0x3f69a6=_0x3f69a6||0xc8;return function(_0x431572){if(_0x431572){return _0x3fb277['status'](_0x3f69a6)[_0x102c('0x1b')](_0x431572);}};}function respondWithFilteredResult(_0x4b112a,_0x518bc6){return function(_0x118ba9){if(_0x118ba9){var _0x1a82f0=typeof _0x518bc6[_0x102c('0x1c')]===_0x102c('0x1d')&&typeof _0x518bc6[_0x102c('0x1e')]===_0x102c('0x1d');var _0x36428c=_0x118ba9[_0x102c('0x1f')];var _0x3500b3=_0x1a82f0?0x0:_0x518bc6['offset'];var _0x59fd8e=_0x1a82f0?_0x118ba9[_0x102c('0x1f')]:_0x518bc6['offset']+_0x518bc6[_0x102c('0x1e')];var _0x579764;if(_0x59fd8e>=_0x36428c){_0x59fd8e=_0x36428c;_0x579764=0xc8;}else{_0x579764=0xce;}_0x4b112a[_0x102c('0x19')](_0x579764);return _0x4b112a['set']('Content-Range',_0x3500b3+'-'+_0x59fd8e+'/'+_0x36428c)[_0x102c('0x1b')](_0x118ba9);}return null;};}function patchUpdates(_0x2192d4){return function(_0x51c3ca){try{jsonpatch['apply'](_0x51c3ca,_0x2192d4,!![]);}catch(_0x4051ab){return BPromise['reject'](_0x4051ab);}return _0x51c3ca['save']();};}function saveUpdates(_0x1018cd,_0xdaa7c7){return function(_0x4d56dc){if(_0x4d56dc){return _0x4d56dc[_0x102c('0x20')](_0x1018cd)[_0x102c('0x21')](function(_0x472d60){return _0x472d60;});}return null;};}function removeEntity(_0x3b3739,_0x2c6680){return function(_0x2bf061){if(_0x2bf061){return _0x2bf061['destroy']()[_0x102c('0x21')](function(){_0x3b3739[_0x102c('0x19')](0xcc)[_0x102c('0x1a')]();});}};}function handleEntityNotFound(_0x9bc439,_0x51110b){return function(_0x12d109){if(!_0x12d109){_0x9bc439['sendStatus'](0x194);}return _0x12d109;};}function handleError(_0x33c206,_0xa2620c){_0xa2620c=_0xa2620c||0x1f4;return function(_0xebf3e6){logger[_0x102c('0x22')](_0xebf3e6[_0x102c('0x23')]);if(_0xebf3e6['name']){delete _0xebf3e6[_0x102c('0x24')];}_0x33c206[_0x102c('0x19')](_0xa2620c)[_0x102c('0x25')](_0xebf3e6);};}exports[_0x102c('0x26')]=function(_0x243995,_0x49ec98){var _0x1b0d7c={},_0x38a138={},_0x4665ca={'count':0x0,'rows':[]};var _0x9ffd2=_['map'](db[_0x102c('0x27')]['rawAttributes'],function(_0x5259c0){return{'name':_0x5259c0['fieldName'],'type':_0x5259c0[_0x102c('0x28')][_0x102c('0x29')]};});_0x38a138[_0x102c('0x2a')]=_['map'](_0x9ffd2,'name');_0x38a138[_0x102c('0x2b')]=_[_0x102c('0x2c')](_0x243995['query']);_0x38a138[_0x102c('0x2d')]=_[_0x102c('0x2e')](_0x38a138[_0x102c('0x2a')],_0x38a138[_0x102c('0x2b')]);_0x1b0d7c[_0x102c('0x2f')]=_['intersection'](_0x38a138[_0x102c('0x2a')],qs[_0x102c('0x30')](_0x243995['query'][_0x102c('0x30')]));_0x1b0d7c['attributes']=_0x1b0d7c[_0x102c('0x2f')]['length']?_0x1b0d7c[_0x102c('0x2f')]:_0x38a138[_0x102c('0x2a')];if(!_0x243995[_0x102c('0x2b')]['hasOwnProperty'](_0x102c('0x31'))){_0x1b0d7c[_0x102c('0x1e')]=qs['limit'](_0x243995[_0x102c('0x2b')]['limit']);_0x1b0d7c['offset']=qs['offset'](_0x243995['query'][_0x102c('0x1c')]);}_0x1b0d7c['order']=qs['sort'](_0x243995[_0x102c('0x2b')][_0x102c('0x32')]);_0x1b0d7c[_0x102c('0x33')]=qs[_0x102c('0x2d')](_['pick'](_0x243995[_0x102c('0x2b')],_0x38a138['filters']),_0x9ffd2);if(_0x243995[_0x102c('0x2b')][_0x102c('0x34')]){_0x1b0d7c[_0x102c('0x33')]=_[_0x102c('0x35')](_0x1b0d7c['where'],{'$or':_[_0x102c('0x36')](_0x9ffd2,function(_0x4dae7c){if(_0x4dae7c[_0x102c('0x28')]!==_0x102c('0x37')){var _0x4968b5={};_0x4968b5[_0x4dae7c[_0x102c('0x24')]]={'$like':'%'+_0x243995[_0x102c('0x2b')][_0x102c('0x34')]+'%'};return _0x4968b5;}})});}_0x1b0d7c=_[_0x102c('0x35')]({},_0x1b0d7c,_0x243995[_0x102c('0x38')]);var _0x50eef2={'where':_0x1b0d7c[_0x102c('0x33')]};return db['SmsApplication'][_0x102c('0x1f')](_0x50eef2)[_0x102c('0x21')](function(_0x35eb5d){_0x4665ca['count']=_0x35eb5d;if(_0x243995[_0x102c('0x2b')][_0x102c('0x39')]){_0x1b0d7c[_0x102c('0x3a')]=[{'all':!![]}];}return db[_0x102c('0x27')][_0x102c('0x3b')](_0x1b0d7c);})['then'](function(_0x55d7bc){_0x4665ca[_0x102c('0x3c')]=_0x55d7bc;return _0x4665ca;})[_0x102c('0x21')](respondWithFilteredResult(_0x49ec98,_0x1b0d7c))[_0x102c('0x3d')](handleError(_0x49ec98,null));};exports[_0x102c('0x3e')]=function(_0xb968e3,_0x17e8a4){var _0x327623={'raw':!![],'where':{'id':_0xb968e3[_0x102c('0x3f')]['id']}},_0x55bb98={};_0x55bb98['model']=_['keys'](db[_0x102c('0x27')][_0x102c('0x40')]);_0x55bb98['query']=_[_0x102c('0x2c')](_0xb968e3[_0x102c('0x2b')]);_0x55bb98[_0x102c('0x2d')]=_[_0x102c('0x2e')](_0x55bb98[_0x102c('0x2a')],_0x55bb98[_0x102c('0x2b')]);_0x327623[_0x102c('0x2f')]=_[_0x102c('0x2e')](_0x55bb98['model'],qs[_0x102c('0x30')](_0xb968e3['query'][_0x102c('0x30')]));_0x327623[_0x102c('0x2f')]=_0x327623['attributes'][_0x102c('0x41')]?_0x327623['attributes']:_0x55bb98[_0x102c('0x2a')];if(_0xb968e3[_0x102c('0x2b')][_0x102c('0x39')]){_0x327623[_0x102c('0x3a')]=[{'all':!![]}];}_0x327623=_[_0x102c('0x35')]({},_0x327623,_0xb968e3[_0x102c('0x38')]);return db[_0x102c('0x27')]['find'](_0x327623)['then'](handleEntityNotFound(_0x17e8a4,null))[_0x102c('0x21')](respondWithResult(_0x17e8a4,null))[_0x102c('0x3d')](handleError(_0x17e8a4,null));};exports[_0x102c('0x42')]=function(_0x51021a,_0x70d753){return db[_0x102c('0x27')][_0x102c('0x42')](_0x51021a[_0x102c('0x43')],{})[_0x102c('0x21')](respondWithResult(_0x70d753,0xc9))[_0x102c('0x3d')](handleError(_0x70d753,null));};exports[_0x102c('0x20')]=function(_0x5d4b03,_0x1943ee){if(_0x5d4b03[_0x102c('0x43')]['id']){delete _0x5d4b03[_0x102c('0x43')]['id'];}return db[_0x102c('0x27')]['find']({'where':{'id':_0x5d4b03[_0x102c('0x3f')]['id']}})[_0x102c('0x21')](handleEntityNotFound(_0x1943ee,null))[_0x102c('0x21')](saveUpdates(_0x5d4b03[_0x102c('0x43')],null))[_0x102c('0x21')](respondWithResult(_0x1943ee,null))['catch'](handleError(_0x1943ee,null));};exports['destroy']=function(_0x531a5e,_0x3d46bf){return db[_0x102c('0x27')][_0x102c('0x44')]({'where':{'id':_0x531a5e[_0x102c('0x3f')]['id']}})[_0x102c('0x21')](handleEntityNotFound(_0x3d46bf,null))[_0x102c('0x21')](removeEntity(_0x3d46bf,null))[_0x102c('0x3d')](handleError(_0x3d46bf,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 75dec05..955b706 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 _0x2b1f=['path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x7d197f,_0x2a36c3){var _0x276720=function(_0x21b2c2){while(--_0x21b2c2){_0x7d197f['push'](_0x7d197f['shift']());}};_0x276720(++_0x2a36c3);}(_0x2b1f,0x182));var _0xf2b1=function(_0x5428f5,_0x363285){_0x5428f5=_0x5428f5-0x0;var _0xf745ce=_0x2b1f[_0x5428f5];return _0xf745ce;};'use strict';var _=require(_0xf2b1('0x0'));var util=require(_0xf2b1('0x1'));var logger=require(_0xf2b1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2b1('0x4'));var rimraf=require(_0xf2b1('0x5'));var config=require(_0xf2b1('0x6'));var attributes=require('./smsApplication.attributes');module[_0xf2b1('0x7')]=function(_0x1d28f0,_0x5df82d){return _0x1d28f0[_0xf2b1('0x8')](_0xf2b1('0x9'),attributes,{'tableName':_0xf2b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2b1('0xb'),'collate':_0xf2b1('0xc')});}; \ No newline at end of file +var _0x621f=['moment','bluebird','request-promise','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','api'];(function(_0x5713b5,_0x423f83){var _0x2f795d=function(_0x392aea){while(--_0x392aea){_0x5713b5['push'](_0x5713b5['shift']());}};_0x2f795d(++_0x423f83);}(_0x621f,0xed));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require('util');var logger=require(_0xf621('0x1'))(_0xf621('0x2'));var moment=require(_0xf621('0x3'));var BPromise=require(_0xf621('0x4'));var rp=require(_0xf621('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf621('0x6'));module[_0xf621('0x7')]=function(_0x36b87d,_0x1e3d0b){return _0x36b87d[_0xf621('0x8')](_0xf621('0x9'),attributes,{'tableName':_0xf621('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf621('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ebb268a..38cb2bc 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 _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x6f75,0x71));var _0x56f7=function(_0x1c3d7a,_0x545560){_0x1c3d7a=_0x1c3d7a-0x0;var _0x3a0683=_0x6f75[_0x1c3d7a];return _0x3a0683;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('SmsApplication,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file +var _0xbdc2=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x556700,_0x2d01b5){var _0x39fbc1=function(_0x133a3a){while(--_0x133a3a){_0x556700['push'](_0x556700['shift']());}};_0x39fbc1(++_0x2d01b5);}(_0xbdc2,0x148));var _0x2bdc=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xbdc2[_0x243217];return _0x478029;};'use strict';var _=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var moment=require(_0x2bdc('0x2'));var BPromise=require(_0x2bdc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bdc('0x4'))['db'];var utils=require(_0x2bdc('0x5'));var logger=require('../../config/logger')(_0x2bdc('0x6'));var config=require(_0x2bdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2bdc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29bed6,_0x9e129f,_0x39475e){return new BPromise(function(_0x3506af,_0x120ca1){return client[_0x2bdc('0x9')](_0x29bed6,_0x39475e)[_0x2bdc('0xa')](function(_0x1dd7c9){logger[_0x2bdc('0xb')](_0x2bdc('0xc'),_0x9e129f,_0x2bdc('0xd'));logger[_0x2bdc('0xe')](_0x2bdc('0xf'),_0x9e129f,'request\x20sent',JSON[_0x2bdc('0x10')](_0x1dd7c9));if(_0x1dd7c9['error']){if(_0x1dd7c9[_0x2bdc('0x11')][_0x2bdc('0x12')]===0x1f4){logger[_0x2bdc('0x11')]('SmsApplication,\x20%s,\x20%s',_0x9e129f,_0x1dd7c9[_0x2bdc('0x11')]['message']);return _0x120ca1(_0x1dd7c9[_0x2bdc('0x11')][_0x2bdc('0x13')]);}logger[_0x2bdc('0x11')](_0x2bdc('0xc'),_0x9e129f,_0x1dd7c9[_0x2bdc('0x11')][_0x2bdc('0x13')]);return _0x3506af(_0x1dd7c9[_0x2bdc('0x11')]['message']);}else{logger[_0x2bdc('0xb')](_0x2bdc('0xc'),_0x9e129f,_0x2bdc('0xd'));_0x3506af(_0x1dd7c9['result'][_0x2bdc('0x13')]);}})['catch'](function(_0x426720){logger['error'](_0x2bdc('0xc'),_0x9e129f,_0x426720);_0x120ca1(_0x426720);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c952b79..dee3659 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 _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x24638e,_0x5b2bc7){var _0x2d401e=function(_0x373ce4){while(--_0x373ce4){_0x24638e['push'](_0x24638e['shift']());}};_0x2d401e(++_0x5b2bc7);}(_0x7708,0x188));var _0x8770=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7708[_0x411add];return _0x238242;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0x8f4c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x51ad08,_0x1dda9a){var _0x41684a=function(_0x191eb4){while(--_0x191eb4){_0x51ad08['push'](_0x51ad08['shift']());}};_0x41684a(++_0x1dda9a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x17d095,_0x281068){_0x17d095=_0x17d095-0x0;var _0x3a51e2=_0x8f4c[_0x17d095];return _0x3a51e2;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./smsInteraction.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/download',auth[_0xc8f4('0xd')](),controller['download']);router[_0xc8f4('0x11')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x11')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),'smsinteraction:addtags'),controller[_0xc8f4('0x17')]);router[_0xc8f4('0x18')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')]('sms',_0xc8f4('0x19')),controller['update']);router['delete'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),_0xc8f4('0x1a')),controller[_0xc8f4('0x1b')]);router[_0xc8f4('0x1c')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1d')]);module[_0xc8f4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3d4a017..1a715bd 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 _0x56a4=['ENUM','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x44624e,_0xe4f8fb){var _0x4a83c2=function(_0x475d2b){while(--_0x475d2b){_0x44624e['push'](_0x44624e['shift']());}};_0x4a83c2(++_0xe4f8fb);}(_0x56a4,0x11b));var _0x456a=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x56a4[_0x4191af];return _0x27bebf;};'use strict';var Sequelize=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));module['exports']={'closed':{'type':Sequelize[_0x456a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x456a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x456a('0x4')]},'note':{'type':Sequelize[_0x456a('0x4')]},'phone':{'type':Sequelize[_0x456a('0x4')]},'read1stAt':{'type':Sequelize[_0x456a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x456a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x456a('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x456a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xcddd=['BOOLEAN','DATE','STRING','ENUM','sequelize','moment','exports'];(function(_0x40af61,_0x17b208){var _0x4c6604=function(_0x25a896){while(--_0x25a896){_0x40af61['push'](_0x40af61['shift']());}};_0x4c6604(++_0x17b208);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x4fb5ce,_0x2750b2){_0x4fb5ce=_0x4fb5ce-0x0;var _0x325dc7=_0xcddd[_0x4fb5ce];return _0x325dc7;};'use strict';var Sequelize=require(_0xdcdd('0x0'));var moment=require(_0xdcdd('0x1'));module[_0xdcdd('0x2')]={'closed':{'type':Sequelize[_0xdcdd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdcdd('0x4')]},'disposition':{'type':Sequelize[_0xdcdd('0x5')]},'secondDisposition':{'type':Sequelize[_0xdcdd('0x5')]},'thirdDisposition':{'type':Sequelize[_0xdcdd('0x5')]},'note':{'type':Sequelize[_0xdcdd('0x5')]},'phone':{'type':Sequelize[_0xdcdd('0x5')]},'read1stAt':{'type':Sequelize[_0xdcdd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdcdd('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdcdd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xdcdd('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdcdd('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 a3be14f..fbcf5cb 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 _0x7e37=['downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../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','./smsInteraction.socket','register','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','catch','index','SmsInteraction','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','length','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)','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?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','isEmpty','forEach','concat','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','filter','$gte','addTags','setTags','spread','findAll','emit','smsInteractionTags:save','removeTags','download','unix','server','files','tmp','join','attachments','format','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','views'];(function(_0x29456b,_0xd16b9d){var _0xbfffd6=function(_0x68150c){while(--_0x68150c){_0x29456b['push'](_0x29456b['shift']());}};_0xbfffd6(++_0xd16b9d);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x77e3('0x0'));var rimraf=require(_0x77e3('0x1'));var zipdir=require(_0x77e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77e3('0x3'));var BPromise=require(_0x77e3('0x4'));var Mustache=require(_0x77e3('0x5'));var util=require(_0x77e3('0x6'));var path=require(_0x77e3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x77e3('0x8'));var fs=require('fs');var fs_extra=require(_0x77e3('0x9'));var _=require(_0x77e3('0xa'));var squel=require(_0x77e3('0xb'));var crypto=require(_0x77e3('0xc'));var jsforce=require(_0x77e3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x77e3('0xe'));var querystring=require(_0x77e3('0xf'));var Papa=require(_0x77e3('0x10'));var Redis=require('ioredis');var authService=require(_0x77e3('0x11'));var qs=require(_0x77e3('0x12'));var as=require(_0x77e3('0x13'));var pdf=require(_0x77e3('0x14'));var hardwareService=require(_0x77e3('0x15'));var logger=require(_0x77e3('0x16'))(_0x77e3('0x17'));var utils=require('../../config/utils');var config=require(_0x77e3('0x18'));var licenseUtil=require(_0x77e3('0x19'));var db=require(_0x77e3('0x1a'))['db'];config[_0x77e3('0x1b')]=_[_0x77e3('0x1c')](config[_0x77e3('0x1b')],{'host':_0x77e3('0x1d'),'port':0x18eb});var socket=require(_0x77e3('0x1e'))(new Redis(config[_0x77e3('0x1b')]));require(_0x77e3('0x1f'))[_0x77e3('0x20')](socket);function respondWithStatusCode(_0x562558,_0x519247){_0x519247=_0x519247||0xcc;return function(_0x1b7d8f){if(_0x1b7d8f){return _0x562558['sendStatus'](_0x519247);}return _0x562558['status'](_0x519247)[_0x77e3('0x21')]();};}function respondWithResult(_0x174ea6,_0x254127){_0x254127=_0x254127||0xc8;return function(_0x3d2090){if(_0x3d2090){return _0x174ea6['status'](_0x254127)['json'](_0x3d2090);}};}function respondWithFilteredResult(_0x2e2edd,_0x35b769){return function(_0x3a8f6b){if(_0x3a8f6b){var _0x53a834=typeof _0x35b769[_0x77e3('0x22')]===_0x77e3('0x23')&&typeof _0x35b769[_0x77e3('0x24')]===_0x77e3('0x23');var _0x37aec5=_0x3a8f6b[_0x77e3('0x25')];var _0x3f3562=_0x53a834?0x0:_0x35b769[_0x77e3('0x22')];var _0x10dcfb=_0x53a834?_0x3a8f6b[_0x77e3('0x25')]:_0x35b769[_0x77e3('0x22')]+_0x35b769['limit'];var _0xd7e626;if(_0x10dcfb>=_0x37aec5){_0x10dcfb=_0x37aec5;_0xd7e626=0xc8;}else{_0xd7e626=0xce;}_0x2e2edd[_0x77e3('0x26')](_0xd7e626);return _0x2e2edd[_0x77e3('0x27')](_0x77e3('0x28'),_0x3f3562+'-'+_0x10dcfb+'/'+_0x37aec5)['json'](_0x3a8f6b);}return null;};}function patchUpdates(_0x50d519){return function(_0x2e860f){try{jsonpatch[_0x77e3('0x29')](_0x2e860f,_0x50d519,!![]);}catch(_0x382b78){return BPromise[_0x77e3('0x2a')](_0x382b78);}return _0x2e860f[_0x77e3('0x2b')]();};}function saveUpdates(_0x572309,_0x44ae6a){return function(_0x3c4a74){if(_0x3c4a74){return _0x3c4a74[_0x77e3('0x2c')](_0x572309)[_0x77e3('0x2d')](function(_0x358c03){return _0x358c03;});}return null;};}function removeEntity(_0x22f8fd,_0x262d4b){return function(_0x3590c7){if(_0x3590c7){return _0x3590c7[_0x77e3('0x2e')]()[_0x77e3('0x2d')](function(){_0x22f8fd[_0x77e3('0x26')](0xcc)[_0x77e3('0x21')]();});}};}function handleEntityNotFound(_0x1bd342,_0x467063){return function(_0x12ea20){if(!_0x12ea20){_0x1bd342[_0x77e3('0x2f')](0x194);}return _0x12ea20;};}function handleError(_0x1ac90d,_0x5e65fc){_0x5e65fc=_0x5e65fc||0x1f4;return function(_0x9b3d3f){logger[_0x77e3('0x30')](_0x9b3d3f[_0x77e3('0x31')]);if(_0x9b3d3f['name']){delete _0x9b3d3f[_0x77e3('0x32')];}_0x1ac90d['status'](_0x5e65fc)[_0x77e3('0x33')](_0x9b3d3f);};}function getInteractionUsers(_0x2be6e4,_0x279e9f){return new BPromise(function(_0xd8e317,_0x118470){try{if(_0x279e9f[_0x2be6e4['id']]){_0x2be6e4[_0x77e3('0x34')]=_[_0x77e3('0x35')](_0x279e9f[_0x2be6e4['id']],function(_0x2fdb63){return{'id':_0x2fdb63['id'],'fullname':_0x2fdb63[_0x77e3('0x36')]};});}}catch(_0x304aa0){_0x118470(_0x304aa0);}_0xd8e317(_0x2be6e4);});}function getInteractionTags(_0x567ec8,_0x1d2a73){return new BPromise(function(_0x2e56d6,_0x13ca2c){try{if(_0x567ec8['TagIds']){_0x567ec8[_0x77e3('0x37')]=[];_0x567ec8[_0x77e3('0x38')][_0x77e3('0x39')](',')['forEach'](function(_0x5628d4){_0x567ec8[_0x77e3('0x37')]['push'](_0x1d2a73[_0x5628d4]);});}delete _0x567ec8[_0x77e3('0x38')];}catch(_0x204d7e){_0x13ca2c(_0x204d7e);}_0x2e56d6(_0x567ec8);});}function updateSmsInteraction(_0x4d7c83,_0x33676a,_0xa01713){return new BPromise(function(_0x2e8dc0,_0x4566a6){return getInteractionUsers(_0x4d7c83,_0xa01713)[_0x77e3('0x2d')](function(_0x5e0cb0){return getInteractionTags(_0x5e0cb0,_0x33676a);})[_0x77e3('0x2d')](function(_0x205052){_0x2e8dc0(_0x205052);})[_0x77e3('0x3a')](function(_0x158851){_0x4566a6(_0x158851);});});}exports[_0x77e3('0x3b')]=function(_0x1bbf7,_0x2743ad){var _0x1e62e0={},_0x420067={},_0x3ee77e={'count':0x0,'rows':[]};var _0x26d1f9=_[_0x77e3('0x35')](db[_0x77e3('0x3c')]['rawAttributes'],function(_0x1f16b7){return{'name':_0x1f16b7['fieldName'],'type':_0x1f16b7[_0x77e3('0x3d')][_0x77e3('0x3e')]};});_0x420067['model']=_[_0x77e3('0x35')](_0x26d1f9,_0x77e3('0x32'));_0x420067[_0x77e3('0x3f')]=_[_0x77e3('0x40')](_0x1bbf7[_0x77e3('0x3f')]);_0x420067[_0x77e3('0x41')]=_['intersection'](_0x420067[_0x77e3('0x42')],_0x420067[_0x77e3('0x3f')]);_0x1e62e0[_0x77e3('0x43')]=_[_0x77e3('0x44')](_0x420067['model'],qs[_0x77e3('0x45')](_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x45')]));_0x1e62e0[_0x77e3('0x43')]=_0x1e62e0['attributes']['length']?_0x1e62e0['attributes']:_0x420067[_0x77e3('0x42')];if(!_0x1bbf7['query'][_0x77e3('0x46')]('nolimit')){_0x1e62e0[_0x77e3('0x24')]=qs[_0x77e3('0x24')](_0x1bbf7[_0x77e3('0x3f')]['limit']);_0x1e62e0[_0x77e3('0x22')]=qs['offset'](_0x1bbf7[_0x77e3('0x3f')]['offset']);}_0x1e62e0[_0x77e3('0x47')]=qs['sort'](_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x48')]);_0x1e62e0[_0x77e3('0x49')]=qs['filters'](_[_0x77e3('0x4a')](_0x1bbf7['query'],_0x420067[_0x77e3('0x41')]),_0x26d1f9);var _0x579dfc=[];var _0x52e75b=squel[_0x77e3('0x4b')]()['field']('id')[_0x77e3('0x4c')]('name')[_0x77e3('0x4c')](_0x77e3('0x4d'))[_0x77e3('0x4e')](_0x77e3('0x4f'));var _0x99e778=squel[_0x77e3('0x4b')]()[_0x77e3('0x4c')](_0x77e3('0x50'))[_0x77e3('0x4c')](_0x77e3('0x51'))[_0x77e3('0x4c')](_0x77e3('0x52'))['from'](_0x77e3('0x53'),'ui')[_0x77e3('0x54')]('users','u',_0x77e3('0x55'));var _0x778572=squel[_0x77e3('0x4b')]()[_0x77e3('0x4e')](_0x77e3('0x56'),'i')['left_join'](_0x77e3('0x57'),'c',_0x77e3('0x58'))['left_join']('users','o',_0x77e3('0x59'))[_0x77e3('0x54')](_0x77e3('0x5a'),'a','a.id\x20=\x20i.SmsAccountId')[_0x77e3('0x54')](_0x77e3('0x5b'),'me',_0x77e3('0x5c'))['left_join'](_0x77e3('0x5d'),'it',_0x77e3('0x5e'))[_0x77e3('0x54')](_0x77e3('0x4f'),'t',_0x77e3('0x5f'));var _0x395835=squel['expr']();var _0x28e173=[];var _0x37662b=squel[_0x77e3('0x60')]();var _0x574e72;if(_0x1bbf7[_0x77e3('0x3f')]['search']){_0x574e72=as[_0x77e3('0x61')](_0x1bbf7[_0x77e3('0x3f')]['search']);var _0x33f9aa=_0x574e72['sqlOperator'];for(var _0x2accf7=0x0;_0x2accf7<_0x574e72[_0x77e3('0x62')][_0x77e3('0x63')];_0x2accf7++){var _0x20aa65=_0x574e72[_0x77e3('0x62')][_0x2accf7];var _0x19230f='i';var _0x4d20c0=_[_0x77e3('0x64')](_0x26d1f9,[_0x77e3('0x32'),_0x20aa65[_0x77e3('0x4c')]]);if(!_0x4d20c0){switch(_0x20aa65[_0x77e3('0x4c')]){case _0x77e3('0x65'):if(_0x20aa65[_0x77e3('0x66')]==0x1){_0x778572[_0x77e3('0x67')]('`'+_0x20aa65[_0x77e3('0x4c')]+_0x77e3('0x68'));}else{_0x778572[_0x77e3('0x67')]('`'+_0x20aa65[_0x77e3('0x4c')]+_0x77e3('0x69'));}break;case _0x77e3('0x6a'):if(_0x20aa65[_0x77e3('0x6b')]===_0x77e3('0x6c')){if(_0x20aa65[_0x77e3('0x66')][_0x77e3('0x39')]('\x20')[_0x77e3('0x63')]>0x1){_0x395835[_0x33f9aa](_0x77e3('0x6d'),qs['getFullTextValue'](_0x20aa65[_0x77e3('0x66')]),null);}else{var _0x44f2db='%'+_0x20aa65[_0x77e3('0x66')]+'%';_0x395835[_0x33f9aa](_0x77e3('0x6e'),_0x44f2db,_0x44f2db,_0x44f2db);}}else{_0x4d20c0=_[_0x77e3('0x64')](_0x26d1f9,[_0x77e3('0x32'),_0x77e3('0x6f')]);_0x20aa65['field']='ContactId';_0x3a07fd=as[_0x77e3('0x70')](_0x19230f,_0x4d20c0[_0x77e3('0x3d')],_0x20aa65);_0x395835[_0x33f9aa](_0x3a07fd['text'],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x71')],_0x3a07fd[_0x77e3('0x66')]['end']);}break;case _0x77e3('0x72'):var _0x24fe38=_0x20aa65['value'][_0x77e3('0x39')](',')[_0x77e3('0x35')](function(_0x8b0ebd){return Number(_0x8b0ebd);});_0x24fe38['forEach'](function(_0x4c6d42){_0x37662b['or'](_0x77e3('0x73'),'%,'+_0x4c6d42+',%');});_0x28e173=_['union'](_0x28e173,_0x24fe38);break;case _0x77e3('0x74'):if(_0x20aa65[_0x77e3('0x6b')]===_0x77e3('0x6c')){_0x395835[_0x33f9aa](_0x77e3('0x75'),'%'+_0x20aa65['value']+'%',null);}else{_0x4d20c0=_['find'](_0x26d1f9,['name',_0x77e3('0x76')]);_0x20aa65[_0x77e3('0x4c')]=_0x77e3('0x76');_0x3a07fd=as[_0x77e3('0x70')](_0x19230f,_0x4d20c0['type'],_0x20aa65);_0x395835[_0x33f9aa](_0x3a07fd[_0x77e3('0x77')],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x71')],_0x3a07fd['value'][_0x77e3('0x21')]);}break;case _0x77e3('0x78'):_0x3a07fd=as[_0x77e3('0x70')]('me',null,_0x20aa65);_0x395835[_0x33f9aa](_0x3a07fd[_0x77e3('0x77')],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x71')],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x21')]);break;}}else{var _0x3a07fd=as[_0x77e3('0x70')](_0x19230f,_0x4d20c0['type'],_0x20aa65);_0x395835[_0x33f9aa](_0x3a07fd[_0x77e3('0x77')],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x71')],_0x3a07fd[_0x77e3('0x66')][_0x77e3('0x21')]);}}}else{var _0x2e220d=_(_0x1bbf7[_0x77e3('0x3f')])[_0x77e3('0x40')]()[_0x77e3('0x35')](function(_0x45f93a){return _[_0x77e3('0x79')](_0x26d1f9,[_0x77e3('0x32'),_0x45f93a])?_0x45f93a:undefined;})['compact']()[_0x77e3('0x66')]();if(!_[_0x77e3('0x7a')](_0x2e220d)){_0x2e220d[_0x77e3('0x7b')](function(_0xafc8d){if(_0xafc8d==='SmsAccountId'){_0x778572[_0x77e3('0x49')]('i.SmsAccountId\x20IN\x20?',[][_0x77e3('0x7c')](_0x1bbf7[_0x77e3('0x3f')][_0xafc8d]));}else if(_0xafc8d==='createdAt'){var _0x2e64ab=JSON['parse'](_0x1bbf7[_0x77e3('0x3f')][_0xafc8d])['$gte'];var _0x308a03=JSON['parse'](_0x1bbf7[_0x77e3('0x3f')][_0xafc8d])['$lte'];_0x778572['where'](_0x77e3('0x7d'),_0x2e64ab,_0x308a03);}else{if(_0x1bbf7['query'][_0xafc8d]===_0x77e3('0x7e')){_0x778572[_0x77e3('0x49')]('i.'+_0xafc8d+_0x77e3('0x7f'));}else{_0x778572[_0x77e3('0x49')]('i.'+_0xafc8d+_0x77e3('0x80'),_0x1bbf7[_0x77e3('0x3f')][_0xafc8d]);}}});}if(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x81')]){if(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x81')]==0x1){_0x778572[_0x77e3('0x67')](_0x77e3('0x82'));}else{_0x778572[_0x77e3('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x83')]){_0x28e173=_[_0x77e3('0x84')](_0x1bbf7[_0x77e3('0x3f')]['tag'])?_0x1bbf7['query'][_0x77e3('0x83')]:new Array(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x83')]);_0x28e173[_0x77e3('0x7b')](function(_0x54df4e){_0x37662b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x54df4e+',%');});}if(_0x1bbf7[_0x77e3('0x3f')]['filter']){var _0x46da29=_0x1bbf7[_0x77e3('0x3f')]['filter'][_0x77e3('0x85')]('\x5c','\x5c\x5c')[_0x77e3('0x85')](/'/g,'\x27\x27');if(qs[_0x77e3('0x86')](_0x46da29)){_0x395835['or'](_0x77e3('0x87'),_0x46da29+'%')['or']('i.phone\x20LIKE\x20?',_0x46da29+'%');}else{_0x395835['or'](_0x77e3('0x88'),qs[_0x77e3('0x89')](_0x46da29))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x46da29+'%');}}}_0x778572['where'](_0x395835);_0x778572[_0x77e3('0x8a')]('i.id');var _0x26c124={'type':db[_0x77e3('0x8b')][_0x77e3('0x8c')]['SELECT'],'raw':!![]};var _0x345b7b=_0x778572['clone']();_0x345b7b[_0x77e3('0x4c')](_0x77e3('0x8d'));_0x345b7b['field'](_0x77e3('0x8e'),_0x77e3('0x65'));if(_0x1e62e0['order']){_0x1e62e0['order'][_0x77e3('0x7b')](function(_0x2c2ed7){var _0x13d8e0=_0x2c2ed7[0x0]===_0x77e3('0x8f')?_0x2c2ed7[0x0]:'i.'+_0x2c2ed7[0x0];_0x778572['order'](_0x13d8e0,_0x2c2ed7[0x1]===_0x77e3('0x90')?![]:!![]);});}if(!_[_0x77e3('0x7a')](_0x28e173)){_0x778572[_0x77e3('0x67')](_0x37662b);_0x345b7b[_0x77e3('0x49')](_0x77e3('0x91'),_0x28e173);}BPromise[_0x77e3('0x92')]()['then'](function(){if(!_0x574e72){if(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x93')])return;_0x345b7b[_0x77e3('0x49')](_0x77e3('0x94'));_0x778572[_0x77e3('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1bbf7[_0x77e3('0x95')][_0x77e3('0x96')]!==_0x77e3('0x97'))return;return _0x1bbf7[_0x77e3('0x95')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x61744a){if(_[_0x77e3('0x7a')](_0x61744a)){_0x345b7b[_0x77e3('0x49')]('i.SmsAccountId\x20IS\x20NULL');_0x778572[_0x77e3('0x49')](_0x77e3('0x98'));}else{_0x345b7b[_0x77e3('0x49')](_0x77e3('0x99'),_[_0x77e3('0x35')](_0x61744a,'id'));_0x778572[_0x77e3('0x49')](_0x77e3('0x99'),_[_0x77e3('0x35')](_0x61744a,'id'));}});})['then'](function(){if(_0x1bbf7[_0x77e3('0x95')][_0x77e3('0x96')]===_0x77e3('0x97')&&!_0x574e72&&!_0x1bbf7['query'][_0x77e3('0x93')])return[];return db[_0x77e3('0x9a')][_0x77e3('0x3f')](_0x345b7b[_0x77e3('0x9b')](),_0x26c124);})[_0x77e3('0x2d')](function(_0x311468){_0x3ee77e[_0x77e3('0x25')]=_0x311468[_0x77e3('0x63')];if(_0x3ee77e[_0x77e3('0x25')]===0x0)return[];return db['sequelize'][_0x77e3('0x3f')](_0x52e75b[_0x77e3('0x9b')](),_0x26c124)[_0x77e3('0x2d')](function(_0x485a51){_0x579dfc=_[_0x77e3('0x9c')](_0x485a51,'id');_0x26c124=_[_0x77e3('0x9d')](_0x26c124,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bbf7[_0x77e3('0x3f')][_0x77e3('0x45')]){_0x1e62e0['attributes']['forEach'](function(_0x31ae14){_0x778572[_0x77e3('0x4c')]('i.'+_0x31ae14);});}else{_0x778572[_0x77e3('0x4c')](_0x77e3('0x8e'),_0x77e3('0x65'));_0x778572[_0x77e3('0x4c')](_0x77e3('0x9e'),_0x77e3('0x9f'));_0x778572[_0x77e3('0x4c')](_0x77e3('0xa0'),'Account.mandatoryDisposition');_0x778572[_0x77e3('0x4c')](_0x77e3('0xa1'),'contactName');_0x778572['field'](_0x77e3('0xa2'));_0x778572[_0x77e3('0x4c')](_0x77e3('0xa3'),_0x77e3('0xa4'));_0x778572[_0x77e3('0x4c')]('c.lastName',_0x77e3('0xa5'));_0x778572['field'](_0x77e3('0xa6'),'Contact.email');_0x778572[_0x77e3('0x4c')](_0x77e3('0xa7'),_0x77e3('0xa8'));_0x778572[_0x77e3('0x4c')]('c.mobile',_0x77e3('0xa9'));_0x778572['field'](_0x77e3('0xaa'),'Contact.fax');_0x778572[_0x77e3('0x4c')]('o.fullname',_0x77e3('0xab'));_0x778572[_0x77e3('0x4c')](_0x77e3('0xac'),_0x77e3('0xad'));_0x778572[_0x77e3('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x77e3('0x38'));}if(_0x1e62e0[_0x77e3('0x24')])_0x778572[_0x77e3('0x24')](_0x1e62e0[_0x77e3('0x24')]);if(_0x1e62e0['offset'])_0x778572[_0x77e3('0x22')](_0x1e62e0[_0x77e3('0x22')]);return db[_0x77e3('0x9a')][_0x77e3('0x3f')](_0x778572[_0x77e3('0x9b')](),_0x26c124);})['then'](function(_0x4c4da4){if(_0x4c4da4['length']>0x0)_0x99e778[_0x77e3('0x49')](_0x77e3('0xae'),_[_0x77e3('0x35')](_0x4c4da4,'id'));return db[_0x77e3('0x9a')]['query'](_0x99e778[_0x77e3('0x9b')](),_0x26c124)[_0x77e3('0x2d')](function(_0x1fef27){var _0x28aff0=_[_0x77e3('0xaf')](_0x1fef27,_0x77e3('0xb0'));var _0x355cef=[];_0x4c4da4['forEach'](function(_0x8b6010){_0x355cef[_0x77e3('0xb1')](updateSmsInteraction(_0x8b6010,_0x579dfc,_0x28aff0));});return BPromise[_0x77e3('0xb2')](_0x355cef);});});})['then'](function(_0x20627f){_0x3ee77e[_0x77e3('0xb3')]=_0x20627f;return _0x3ee77e;})[_0x77e3('0x2d')](respondWithFilteredResult(_0x2743ad,_0x1e62e0))[_0x77e3('0x3a')](handleError(_0x2743ad,null));};exports[_0x77e3('0xb4')]=function(_0x1efdb1,_0x51c89d){var _0xf1d0d2={'raw':![],'where':{'id':_0x1efdb1['params']['id']}},_0x37fabc={};_0x37fabc['model']=_[_0x77e3('0x40')](db[_0x77e3('0x3c')][_0x77e3('0xb5')]);_0x37fabc['query']=_['keys'](_0x1efdb1[_0x77e3('0x3f')]);_0x37fabc[_0x77e3('0x41')]=_[_0x77e3('0x44')](_0x37fabc['model'],_0x37fabc[_0x77e3('0x3f')]);_0xf1d0d2['attributes']=_[_0x77e3('0x44')](_0x37fabc['model'],qs['fields'](_0x1efdb1[_0x77e3('0x3f')]['fields']));_0xf1d0d2['attributes']=_0xf1d0d2[_0x77e3('0x43')][_0x77e3('0x63')]?_0xf1d0d2[_0x77e3('0x43')]:_0x37fabc['model'];if(_0x1efdb1[_0x77e3('0x3f')][_0x77e3('0xb6')]){_0xf1d0d2[_0x77e3('0xb7')]=[{'all':!![]}];}_0xf1d0d2=_['merge']({},_0xf1d0d2,_0x1efdb1[_0x77e3('0xb8')]);return db[_0x77e3('0x3c')][_0x77e3('0x64')](_0xf1d0d2)['then'](handleEntityNotFound(_0x51c89d,null))[_0x77e3('0x2d')](respondWithResult(_0x51c89d,null))[_0x77e3('0x3a')](handleError(_0x51c89d,null));};exports[_0x77e3('0xb9')]=function(_0x45aa1c,_0x20d454){return db[_0x77e3('0x3c')][_0x77e3('0xb9')](_0x45aa1c['body'],{})[_0x77e3('0x2d')](respondWithResult(_0x20d454,0xc9))[_0x77e3('0x3a')](handleError(_0x20d454,null));};exports['update']=function(_0xa0112,_0x235e2f){if(_0xa0112[_0x77e3('0x78')]['id']){delete _0xa0112[_0x77e3('0x78')]['id'];}return db[_0x77e3('0x3c')][_0x77e3('0x64')]({'where':{'id':_0xa0112[_0x77e3('0xba')]['id']}})[_0x77e3('0x2d')](handleEntityNotFound(_0x235e2f,null))[_0x77e3('0x2d')](saveUpdates(_0xa0112[_0x77e3('0x78')],null))['then'](respondWithResult(_0x235e2f,null))[_0x77e3('0x3a')](handleError(_0x235e2f,null));};exports[_0x77e3('0x2e')]=function(_0x847b4c,_0x5e05ed){return db[_0x77e3('0x3c')][_0x77e3('0x64')]({'where':{'id':_0x847b4c[_0x77e3('0xba')]['id']}})['then'](handleEntityNotFound(_0x5e05ed,null))['then'](removeEntity(_0x5e05ed,null))[_0x77e3('0x3a')](handleError(_0x5e05ed,null));};exports[_0x77e3('0xbb')]=function(_0xd23581,_0xeefb7e){return db[_0x77e3('0x3c')][_0x77e3('0xbb')]()[_0x77e3('0x2d')](respondWithResult(_0xeefb7e,null))['catch'](handleError(_0xeefb7e,null));};exports[_0x77e3('0xbc')]=function(_0x17784a,_0x5b1dfc,_0xa17f31){return db[_0x77e3('0xbd')][_0x77e3('0x64')]({'where':{'id':_0x17784a['params']['id']}})[_0x77e3('0x2d')](handleEntityNotFound(_0x5b1dfc,null))[_0x77e3('0x2d')](function(_0x1800e1){if(_0x1800e1){return _0x1800e1[_0x77e3('0xbc')](_0x17784a[_0x77e3('0x78')][_0x77e3('0xbe')],_['omit'](_0x17784a[_0x77e3('0x78')],[_0x77e3('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x5b1dfc,null))['catch'](handleError(_0x5b1dfc,null));};exports[_0x77e3('0xbf')]=function(_0x21ecb8,_0x27a3f7,_0x2b296b){var _0x16ac11={'raw':![],'where':{}};var _0x3822fd={};var _0xa3d993={'count':0x0,'rows':[]};return db[_0x77e3('0x3c')][_0x77e3('0xc0')]({'where':{'id':_0x21ecb8[_0x77e3('0xba')]['id']}})[_0x77e3('0x2d')](handleEntityNotFound(_0x27a3f7,null))['then'](function(_0xb32c34){if(_0xb32c34){_0x3822fd[_0x77e3('0x42')]=_[_0x77e3('0x40')](db[_0x77e3('0xbd')][_0x77e3('0xb5')]);_0x3822fd[_0x77e3('0x3f')]=_[_0x77e3('0x40')](_0x21ecb8[_0x77e3('0x3f')]);_0x3822fd[_0x77e3('0x41')]=_['intersection'](_0x3822fd[_0x77e3('0x42')],_0x3822fd[_0x77e3('0x3f')]);_0x16ac11['attributes']=_[_0x77e3('0x44')](_0x3822fd[_0x77e3('0x42')],qs[_0x77e3('0x45')](_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0x45')]));_0x16ac11[_0x77e3('0x43')]=_0x16ac11[_0x77e3('0x43')][_0x77e3('0x63')]?_0x16ac11[_0x77e3('0x43')]:_0x3822fd[_0x77e3('0x42')];if(!_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0x46')]('nolimit')){_0x16ac11[_0x77e3('0x24')]=qs[_0x77e3('0x24')](_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0x24')]);_0x16ac11[_0x77e3('0x22')]=qs[_0x77e3('0x22')](_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0x22')]);}_0x16ac11[_0x77e3('0x47')]=qs[_0x77e3('0x48')](_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0x48')]);_0x16ac11['where']=qs[_0x77e3('0x41')](_['pick'](_0x21ecb8[_0x77e3('0x3f')],_0x3822fd[_0x77e3('0x41')]));_0x16ac11[_0x77e3('0x49')]['SmsInteractionId']=_0xb32c34['id'];if(_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0xc1')]){_0x16ac11[_0x77e3('0x49')]=_[_0x77e3('0x9d')](_0x16ac11['where'],{'$or':_[_0x77e3('0x35')](_0x16ac11[_0x77e3('0x43')],function(_0x347186){var _0x4bb706={};_0x4bb706[_0x347186]={'$like':'%'+_0x21ecb8['query'][_0x77e3('0xc1')]+'%'};return _0x4bb706;})});}if(_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0xc2')]){var _0x351430=_0x21ecb8[_0x77e3('0x3f')][_0x77e3('0xc2')][_0x77e3('0x39')](',');var _0x179956={};_0x179956[_0x351430[0x0]]={'$gte':moment(_0x351430[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x16ac11['where']=_[_0x77e3('0x9d')](_0x16ac11[_0x77e3('0x49')],_0x179956);}_0x16ac11=_['merge']({},_0x16ac11,_0x21ecb8[_0x77e3('0xb8')]);return db[_0x77e3('0xbd')][_0x77e3('0x25')]({'where':_0x16ac11[_0x77e3('0x49')]})[_0x77e3('0x2d')](function(_0x13f9ab){_0xa3d993[_0x77e3('0x25')]=_0x13f9ab;if(_0x21ecb8['query'][_0x77e3('0xb6')]){_0x16ac11[_0x77e3('0xb7')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x16ac11);})[_0x77e3('0x2d')](function(_0x53871e){_0xa3d993['rows']=_0x53871e;return _0xa3d993;});}})['then'](respondWithFilteredResult(_0x27a3f7,_0x16ac11))[_0x77e3('0x3a')](handleError(_0x27a3f7,null));};exports[_0x77e3('0xc3')]=function(_0x2bf798,_0x30c365,_0x1b7775){return db[_0x77e3('0x3c')]['find']({'where':{'id':_0x2bf798['params']['id']}})[_0x77e3('0x2d')](handleEntityNotFound(_0x30c365,null))['then'](function(_0x4a322d){if(_0x4a322d){return _0x4a322d[_0x77e3('0xc4')](_0x2bf798['body']['ids'],_['omit'](_0x2bf798[_0x77e3('0x78')],[_0x77e3('0xbe'),'id'])||{})[_0x77e3('0xc5')](function(){return db[_0x77e3('0x72')][_0x77e3('0xc6')]({'attributes':['id',_0x77e3('0x32'),_0x77e3('0x4d')],'where':{'id':_0x2bf798[_0x77e3('0x78')][_0x77e3('0xbe')]}});})[_0x77e3('0x2d')](function(_0x3744bf){socket[_0x77e3('0xc7')](_0x77e3('0xc8'),{'id':Number(_0x2bf798[_0x77e3('0xba')]['id']),'tags':_0x3744bf||[]});return{'id':Number(_0x2bf798[_0x77e3('0xba')]['id']),'tags':_0x3744bf||[]};});}})[_0x77e3('0x2d')](respondWithResult(_0x30c365,null))[_0x77e3('0x3a')](handleError(_0x30c365,null));};exports[_0x77e3('0xc9')]=function(_0x2c92c6,_0x1fa576,_0x284e64){return db[_0x77e3('0x3c')][_0x77e3('0x64')]({'where':{'id':_0x2c92c6[_0x77e3('0xba')]['id']}})[_0x77e3('0x2d')](handleEntityNotFound(_0x1fa576,null))[_0x77e3('0x2d')](function(_0x587763){if(_0x587763){return _0x587763[_0x77e3('0xc9')](_0x2c92c6[_0x77e3('0x3f')][_0x77e3('0xbe')]);}})[_0x77e3('0x2d')](respondWithStatusCode(_0x1fa576,null))[_0x77e3('0x3a')](handleError(_0x1fa576,null));};exports[_0x77e3('0xca')]=function(_0x1ec7e4,_0xf71fb4){var _0x4b0955=moment()[_0x77e3('0xcb')]()['toString']();var _0x508fad=path['join'](config['root'],_0x77e3('0xcc'),_0x77e3('0xcd'),_0x77e3('0xce'));var _0x526b93=path[_0x77e3('0xcf')](config['root'],_0x77e3('0xcc'),_0x77e3('0xcd'),_0x77e3('0xd0'));var _0x50088b=path[_0x77e3('0xcf')](_0x508fad,_0x4b0955);var _0x257ae6=util[_0x77e3('0xd1')]('transcript-%d-%s.zip',_0x1ec7e4[_0x77e3('0xba')]['id'],_0x4b0955);var _0x4034a9=path[_0x77e3('0xcf')](_0x508fad,_0x257ae6);var _0x5d71ed=[];_0x5d71ed[_0x77e3('0xb1')]({'model':db[_0x77e3('0x74')],'as':_0x77e3('0x74'),'attributes':['id','fullname'],'raw':!![]});_0x5d71ed['push']({'model':db[_0x77e3('0xd2')],'as':_0x77e3('0x6a'),'attributes':['id',_0x77e3('0xd3'),_0x77e3('0xd4')],'raw':!![]});var _0x3d61e3=[{'model':db['SmsMessage'],'as':_0x77e3('0xd5'),'attributes':['id','body',_0x77e3('0xd6'),_0x77e3('0xd7'),_0x77e3('0xd8'),_0x77e3('0x81')],'include':_0x5d71ed}];_0x3d61e3[_0x77e3('0xb1')]({'model':db[_0x77e3('0xd9')],'as':_0x77e3('0xda'),'attributes':['id','name']});_0x3d61e3[_0x77e3('0xb1')]({'model':db[_0x77e3('0x74')],'as':_0x77e3('0xdb'),'attributes':['id',_0x77e3('0x36')]});return db[_0x77e3('0x3c')][_0x77e3('0x64')]({'where':{'id':_0x1ec7e4[_0x77e3('0xba')]['id']},'include':_0x3d61e3})[_0x77e3('0x2d')](handleEntityNotFound(_0xf71fb4,null))['then'](function(_0x5c72f1){if(_0x5c72f1){var _0x179ca8=_0x5c72f1[_0x77e3('0xdc')]({'plain':!![]});fs[_0x77e3('0xdd')](_0x50088b);var _0x5609bf={'channel':_0x77e3('0xde'),'account':_0x179ca8[_0x77e3('0xda')][_0x77e3('0x32')],'agent':_0x179ca8[_0x77e3('0xdb')]?_0x179ca8[_0x77e3('0xdb')][_0x77e3('0x36')]:_0x77e3('0xdf'),'createdAt':moment(_0x179ca8[_0x77e3('0xd6')])[_0x77e3('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x77e3('0x9b')](),'closedAt':_0x179ca8['closed']?moment(_0x179ca8[_0x77e3('0xe0')])[_0x77e3('0xd1')](_0x77e3('0xe1'))[_0x77e3('0x9b')]():'','disposition':_0x179ca8[_0x77e3('0xe2')],'messages':_(_0x179ca8[_0x77e3('0xd5')])[_0x77e3('0xc1')]({'secret':![]})[_0x77e3('0x35')](function(_0xc50f2c){return{'date':moment(_0xc50f2c[_0x77e3('0xd6')])[_0x77e3('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x77e3('0x9b')](),'sender':_0xc50f2c[_0x77e3('0xd7')]==='out'?_0xc50f2c['User']?_0xc50f2c['User'][_0x77e3('0x36')]:'System':_0xc50f2c['Contact']['firstName']+(_0xc50f2c[_0x77e3('0x6a')][_0x77e3('0xd4')]?'\x20'+_0xc50f2c[_0x77e3('0x6a')][_0x77e3('0xd4')]:''),'body':_0xc50f2c[_0x77e3('0x78')],'direction':_0xc50f2c[_0x77e3('0xd7')]===_0x77e3('0xe3')?'A':'C','secret':_0xc50f2c[_0x77e3('0xd8')],'read':_0xc50f2c[_0x77e3('0x81')]};})['value']()};return ejs['renderFile'](path['join'](config['root'],_0x77e3('0xcc'),_0x77e3('0xe4'),_0x77e3('0xe5')),{'interaction':_0x5609bf})[_0x77e3('0x2d')](function(_0x5e422d){var _0x3f446c=path[_0x77e3('0xcf')](_0x50088b,_0x77e3('0xe6')+_0x179ca8['id']+'-'+_0x4b0955+_0x77e3('0xe7'));var _0x519bee={'path':_0x3f446c,'channel':_0x77e3('0xde'),'interactionId':_0x179ca8['id']};return pdf[_0x77e3('0xe8')](_0x5e422d,_0x519bee);})[_0x77e3('0x2d')](function(){return new BPromise(function(_0x1abfa2,_0x1525aa){zipdir(_0x50088b,{'saveTo':_0x4034a9},function(_0x3080f6,_0x10c1f7){if(_0x3080f6)return _0x1525aa(_0x3080f6);return _0x1abfa2(_0x10c1f7);});})[_0x77e3('0x2d')](function(){return new BPromise(function(_0x19a2b2,_0x5578c2){rimraf(_0x50088b,function(_0x24a11d){if(_0x24a11d)_0x5578c2(_0x24a11d);return _0x19a2b2();});});})['then'](function(){return _0xf71fb4[_0x77e3('0xca')](_0x4034a9,_0x257ae6,function(_0x28b924){if(_0x28b924){console[_0x77e3('0xe9')](_0x77e3('0xea'),_0x28b924);}else{fs[_0x77e3('0xeb')](_0x4034a9);}});});});}else{return _0xf71fb4[_0x77e3('0x2f')](0xc8);}})[_0x77e3('0x3a')](handleError(_0xf71fb4,null));}; \ No newline at end of file +var _0x3d2a=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','name','Users','map','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','u.id','ui.SmsInteractionId','users','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','includeAll','include','create','update','describe','addMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','SmsMessage','addTags','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','fullname','CmContact','firstName','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','closed','Messages','System','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x310e02,_0x472a9d){var _0x5c9ef2=function(_0x393a18){while(--_0x393a18){_0x310e02['push'](_0x310e02['shift']());}};_0x5c9ef2(++_0x472a9d);}(_0x3d2a,0xdf));var _0xa3d2=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x3d2a[_0x3fb5eb];return _0x481291;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3d2('0x0'));var zipdir=require(_0xa3d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3d2('0x2'));var moment=require(_0xa3d2('0x3'));var BPromise=require(_0xa3d2('0x4'));var Mustache=require('mustache');var util=require(_0xa3d2('0x5'));var path=require('path');var sox=require(_0xa3d2('0x6'));var csv=require(_0xa3d2('0x7'));var ejs=require(_0xa3d2('0x8'));var fs=require('fs');var fs_extra=require(_0xa3d2('0x9'));var _=require(_0xa3d2('0xa'));var squel=require(_0xa3d2('0xb'));var crypto=require(_0xa3d2('0xc'));var jsforce=require(_0xa3d2('0xd'));var deskjs=require(_0xa3d2('0xe'));var toCsv=require(_0xa3d2('0x7'));var querystring=require(_0xa3d2('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3d2('0x10'));var authService=require(_0xa3d2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa3d2('0x12'));var hardwareService=require(_0xa3d2('0x13'));var logger=require('../../config/logger')(_0xa3d2('0x14'));var utils=require(_0xa3d2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa3d2('0x16')](config[_0xa3d2('0x17')],{'host':_0xa3d2('0x18'),'port':0x18eb});var socket=require(_0xa3d2('0x19'))(new Redis(config['redis']));require(_0xa3d2('0x1a'))['register'](socket);function respondWithStatusCode(_0x3af096,_0xed2a2e){_0xed2a2e=_0xed2a2e||0xcc;return function(_0x2e8134){if(_0x2e8134){return _0x3af096[_0xa3d2('0x1b')](_0xed2a2e);}return _0x3af096['status'](_0xed2a2e)['end']();};}function respondWithResult(_0x40d006,_0x288e52){_0x288e52=_0x288e52||0xc8;return function(_0x13a669){if(_0x13a669){return _0x40d006[_0xa3d2('0x1c')](_0x288e52)['json'](_0x13a669);}};}function respondWithFilteredResult(_0x51db00,_0x66cff9){return function(_0x34f66d){if(_0x34f66d){var _0x41370c=typeof _0x66cff9[_0xa3d2('0x1d')]===_0xa3d2('0x1e')&&typeof _0x66cff9[_0xa3d2('0x1f')]===_0xa3d2('0x1e');var _0x2e3b0e=_0x34f66d[_0xa3d2('0x20')];var _0x28ded9=_0x41370c?0x0:_0x66cff9[_0xa3d2('0x1d')];var _0x226eb8=_0x41370c?_0x34f66d[_0xa3d2('0x20')]:_0x66cff9['offset']+_0x66cff9['limit'];var _0x2e6921;if(_0x226eb8>=_0x2e3b0e){_0x226eb8=_0x2e3b0e;_0x2e6921=0xc8;}else{_0x2e6921=0xce;}_0x51db00[_0xa3d2('0x1c')](_0x2e6921);return _0x51db00[_0xa3d2('0x21')](_0xa3d2('0x22'),_0x28ded9+'-'+_0x226eb8+'/'+_0x2e3b0e)[_0xa3d2('0x23')](_0x34f66d);}return null;};}function patchUpdates(_0xe0d324){return function(_0x4c8ae4){try{jsonpatch['apply'](_0x4c8ae4,_0xe0d324,!![]);}catch(_0x3627a9){return BPromise[_0xa3d2('0x24')](_0x3627a9);}return _0x4c8ae4[_0xa3d2('0x25')]();};}function saveUpdates(_0x531f47,_0x2fb181){return function(_0x35f4ab){if(_0x35f4ab){return _0x35f4ab['update'](_0x531f47)[_0xa3d2('0x26')](function(_0x28b437){return _0x28b437;});}return null;};}function removeEntity(_0x513741,_0x3afede){return function(_0x14987d){if(_0x14987d){return _0x14987d[_0xa3d2('0x27')]()[_0xa3d2('0x26')](function(){_0x513741['status'](0xcc)[_0xa3d2('0x28')]();});}};}function handleEntityNotFound(_0x4854d4,_0x260775){return function(_0xe463ae){if(!_0xe463ae){_0x4854d4[_0xa3d2('0x1b')](0x194);}return _0xe463ae;};}function handleError(_0x22fe18,_0x558b66){_0x558b66=_0x558b66||0x1f4;return function(_0x4e1413){logger[_0xa3d2('0x29')](_0x4e1413['stack']);if(_0x4e1413[_0xa3d2('0x2a')]){delete _0x4e1413['name'];}_0x22fe18[_0xa3d2('0x1c')](_0x558b66)['send'](_0x4e1413);};}function getInteractionUsers(_0x4a4eef,_0x51e547){return new BPromise(function(_0x5da012,_0x55d8f3){try{if(_0x51e547[_0x4a4eef['id']]){_0x4a4eef[_0xa3d2('0x2b')]=_[_0xa3d2('0x2c')](_0x51e547[_0x4a4eef['id']],function(_0xac7950){return{'id':_0xac7950['id'],'fullname':_0xac7950['fullname']};});}}catch(_0x4008ac){_0x55d8f3(_0x4008ac);}_0x5da012(_0x4a4eef);});}function getInteractionTags(_0x13a133,_0x17e541){return new BPromise(function(_0x2e0e5c,_0x5726ad){try{if(_0x13a133[_0xa3d2('0x2d')]){_0x13a133['Tags']=[];_0x13a133['TagIds']['split'](',')['forEach'](function(_0x31e24e){_0x13a133[_0xa3d2('0x2e')][_0xa3d2('0x2f')](_0x17e541[_0x31e24e]);});}delete _0x13a133[_0xa3d2('0x2d')];}catch(_0x5aad4f){_0x5726ad(_0x5aad4f);}_0x2e0e5c(_0x13a133);});}function updateSmsInteraction(_0x25fe0b,_0x16a055,_0x3af52c){return new BPromise(function(_0x4951db,_0x3a6f29){return getInteractionUsers(_0x25fe0b,_0x3af52c)[_0xa3d2('0x26')](function(_0x5d0cd5){return getInteractionTags(_0x5d0cd5,_0x16a055);})[_0xa3d2('0x26')](function(_0x59f200){_0x4951db(_0x59f200);})[_0xa3d2('0x30')](function(_0x41b085){_0x3a6f29(_0x41b085);});});}exports[_0xa3d2('0x31')]=function(_0x2581b8,_0x2aad09){var _0x5d63c6={},_0x28deb6={},_0x154737={'count':0x0,'rows':[]};var _0x4806ad=_[_0xa3d2('0x2c')](db[_0xa3d2('0x32')][_0xa3d2('0x33')],function(_0x322cc4){return{'name':_0x322cc4['fieldName'],'type':_0x322cc4[_0xa3d2('0x34')]['key']};});_0x28deb6[_0xa3d2('0x35')]=_['map'](_0x4806ad,_0xa3d2('0x2a'));_0x28deb6[_0xa3d2('0x36')]=_[_0xa3d2('0x37')](_0x2581b8[_0xa3d2('0x36')]);_0x28deb6[_0xa3d2('0x38')]=_['intersection'](_0x28deb6[_0xa3d2('0x35')],_0x28deb6[_0xa3d2('0x36')]);_0x5d63c6[_0xa3d2('0x39')]=_[_0xa3d2('0x3a')](_0x28deb6[_0xa3d2('0x35')],qs['fields'](_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x3b')]));_0x5d63c6[_0xa3d2('0x39')]=_0x5d63c6[_0xa3d2('0x39')]['length']?_0x5d63c6[_0xa3d2('0x39')]:_0x28deb6['model'];if(!_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x3c')](_0xa3d2('0x3d'))){_0x5d63c6[_0xa3d2('0x1f')]=qs[_0xa3d2('0x1f')](_0x2581b8['query'][_0xa3d2('0x1f')]);_0x5d63c6['offset']=qs[_0xa3d2('0x1d')](_0x2581b8['query'][_0xa3d2('0x1d')]);}_0x5d63c6[_0xa3d2('0x3e')]=qs[_0xa3d2('0x3f')](_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x3f')]);_0x5d63c6['where']=qs[_0xa3d2('0x38')](_[_0xa3d2('0x40')](_0x2581b8[_0xa3d2('0x36')],_0x28deb6['filters']),_0x4806ad);var _0xdc2751=[];var _0x5695a7=squel['select']()[_0xa3d2('0x41')]('id')[_0xa3d2('0x41')](_0xa3d2('0x2a'))[_0xa3d2('0x41')](_0xa3d2('0x42'))[_0xa3d2('0x43')](_0xa3d2('0x44'));var _0x5139b4=squel['select']()[_0xa3d2('0x41')](_0xa3d2('0x45'))[_0xa3d2('0x41')]('u.fullname')[_0xa3d2('0x41')](_0xa3d2('0x46'))[_0xa3d2('0x43')]('user_has_sms_interactions','ui')['left_join'](_0xa3d2('0x47'),'u','u.id\x20=\x20ui.UserId');var _0x299c4c=squel[_0xa3d2('0x48')]()['from'](_0xa3d2('0x49'),'i')['left_join'](_0xa3d2('0x4a'),'c',_0xa3d2('0x4b'))['left_join'](_0xa3d2('0x47'),'o',_0xa3d2('0x4c'))[_0xa3d2('0x4d')](_0xa3d2('0x4e'),'a',_0xa3d2('0x4f'))[_0xa3d2('0x4d')](_0xa3d2('0x50'),'me',_0xa3d2('0x51'))[_0xa3d2('0x4d')](_0xa3d2('0x52'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xa3d2('0x4d')](_0xa3d2('0x44'),'t',_0xa3d2('0x53'));var _0x5efb21=squel[_0xa3d2('0x54')]();var _0x505f03=[];var _0x2801ee=squel[_0xa3d2('0x54')]();var _0x10478e;if(_0x2581b8['query'][_0xa3d2('0x55')]){_0x10478e=as[_0xa3d2('0x56')](_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x55')]);var _0x418d1f=_0x10478e[_0xa3d2('0x57')];for(var _0x406f81=0x0;_0x406f81<_0x10478e['conditions'][_0xa3d2('0x58')];_0x406f81++){var _0x3e041d=_0x10478e[_0xa3d2('0x59')][_0x406f81];var _0x505a2f='i';var _0x451505=_[_0xa3d2('0x5a')](_0x4806ad,['name',_0x3e041d[_0xa3d2('0x41')]]);if(!_0x451505){switch(_0x3e041d[_0xa3d2('0x41')]){case _0xa3d2('0x5b'):if(_0x3e041d['value']==0x1){_0x299c4c[_0xa3d2('0x5c')]('`'+_0x3e041d[_0xa3d2('0x41')]+_0xa3d2('0x5d'));}else{_0x299c4c[_0xa3d2('0x5c')]('`'+_0x3e041d['field']+_0xa3d2('0x5e'));}break;case _0xa3d2('0x5f'):if(_0x3e041d[_0xa3d2('0x60')]===_0xa3d2('0x61')){if(_0x3e041d[_0xa3d2('0x62')][_0xa3d2('0x63')]('\x20')[_0xa3d2('0x58')]>0x1){_0x5efb21[_0x418d1f](_0xa3d2('0x64'),qs[_0xa3d2('0x65')](_0x3e041d[_0xa3d2('0x62')]),null);}else{var _0x5929a9='%'+_0x3e041d[_0xa3d2('0x62')]+'%';_0x5efb21[_0x418d1f](_0xa3d2('0x66'),_0x5929a9,_0x5929a9,_0x5929a9);}}else{_0x451505=_[_0xa3d2('0x5a')](_0x4806ad,[_0xa3d2('0x2a'),_0xa3d2('0x67')]);_0x3e041d[_0xa3d2('0x41')]=_0xa3d2('0x67');_0x1b6265=as[_0xa3d2('0x68')](_0x505a2f,_0x451505[_0xa3d2('0x34')],_0x3e041d);_0x5efb21[_0x418d1f](_0x1b6265[_0xa3d2('0x69')],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x6a')],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x28')]);}break;case'Tag':var _0xa1e431=_0x3e041d['value'][_0xa3d2('0x63')](',')[_0xa3d2('0x2c')](function(_0x27a8da){return Number(_0x27a8da);});_0xa1e431[_0xa3d2('0x6b')](function(_0x4f02e4){_0x2801ee['or'](_0xa3d2('0x6c'),'%,'+_0x4f02e4+',%');});_0x505f03=_['union'](_0x505f03,_0xa1e431);break;case _0xa3d2('0x6d'):if(_0x3e041d[_0xa3d2('0x60')]===_0xa3d2('0x61')){_0x5efb21[_0x418d1f](_0xa3d2('0x6e'),'%'+_0x3e041d[_0xa3d2('0x62')]+'%',null);}else{_0x451505=_[_0xa3d2('0x5a')](_0x4806ad,[_0xa3d2('0x2a'),'UserId']);_0x3e041d[_0xa3d2('0x41')]=_0xa3d2('0x6f');_0x1b6265=as['buildExpression'](_0x505a2f,_0x451505[_0xa3d2('0x34')],_0x3e041d);_0x5efb21[_0x418d1f](_0x1b6265[_0xa3d2('0x69')],_0x1b6265[_0xa3d2('0x62')]['start'],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x28')]);}break;case _0xa3d2('0x70'):_0x1b6265=as[_0xa3d2('0x68')]('me',null,_0x3e041d);_0x5efb21[_0x418d1f](_0x1b6265['text'],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x6a')],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x28')]);break;}}else{var _0x1b6265=as['buildExpression'](_0x505a2f,_0x451505[_0xa3d2('0x34')],_0x3e041d);_0x5efb21[_0x418d1f](_0x1b6265[_0xa3d2('0x69')],_0x1b6265[_0xa3d2('0x62')][_0xa3d2('0x6a')],_0x1b6265['value']['end']);}}}else{var _0x389321=_(_0x2581b8[_0xa3d2('0x36')])[_0xa3d2('0x37')]()[_0xa3d2('0x2c')](function(_0x48f0a9){return _[_0xa3d2('0x71')](_0x4806ad,[_0xa3d2('0x2a'),_0x48f0a9])?_0x48f0a9:undefined;})[_0xa3d2('0x72')]()[_0xa3d2('0x62')]();if(!_[_0xa3d2('0x73')](_0x389321)){_0x389321[_0xa3d2('0x6b')](function(_0x531340){if(_0x531340===_0xa3d2('0x74')){_0x299c4c[_0xa3d2('0x75')](_0xa3d2('0x76'),[][_0xa3d2('0x77')](_0x2581b8['query'][_0x531340]));}else if(_0x531340===_0xa3d2('0x78')){var _0x2be64e=JSON['parse'](_0x2581b8[_0xa3d2('0x36')][_0x531340])[_0xa3d2('0x79')];var _0x2159ee=JSON[_0xa3d2('0x7a')](_0x2581b8['query'][_0x531340])[_0xa3d2('0x7b')];_0x299c4c['where'](_0xa3d2('0x7c'),_0x2be64e,_0x2159ee);}else{if(_0x2581b8[_0xa3d2('0x36')][_0x531340]==='null'){_0x299c4c[_0xa3d2('0x75')]('i.'+_0x531340+_0xa3d2('0x7d'));}else{_0x299c4c[_0xa3d2('0x75')]('i.'+_0x531340+_0xa3d2('0x7e'),_0x2581b8['query'][_0x531340]);}}});}if(_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x7f')]){if(_0x2581b8['query'][_0xa3d2('0x7f')]==0x1){_0x299c4c[_0xa3d2('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x299c4c[_0xa3d2('0x5c')](_0xa3d2('0x80'));}}if(_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x81')]){_0x505f03=_[_0xa3d2('0x82')](_0x2581b8[_0xa3d2('0x36')]['tag'])?_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x81')]:new Array(_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x81')]);_0x505f03[_0xa3d2('0x6b')](function(_0x159586){_0x2801ee['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x159586+',%');});}if(_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x83')]){var _0x22afc9=_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x83')]['replace']('\x5c','\x5c\x5c')[_0xa3d2('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x22afc9)){_0x5efb21['or'](_0xa3d2('0x85'),_0x22afc9+'%')['or'](_0xa3d2('0x86'),_0x22afc9+'%');}else{_0x5efb21['or'](_0xa3d2('0x87'),qs[_0xa3d2('0x65')](_0x22afc9))['or'](_0xa3d2('0x88'),_0x22afc9+'%');}}}_0x299c4c[_0xa3d2('0x75')](_0x5efb21);_0x299c4c[_0xa3d2('0x89')](_0xa3d2('0x8a'));var _0x4f2340={'type':db[_0xa3d2('0x8b')]['QueryTypes'][_0xa3d2('0x8c')],'raw':!![]};var _0x2516ec=_0x299c4c['clone']();_0x2516ec[_0xa3d2('0x41')]('i.id');_0x2516ec[_0xa3d2('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa3d2('0x5b'));if(_0x5d63c6[_0xa3d2('0x3e')]){_0x5d63c6[_0xa3d2('0x3e')][_0xa3d2('0x6b')](function(_0x24f453){var _0x37de9f=_0x24f453[0x0]===_0xa3d2('0x8d')?_0x24f453[0x0]:'i.'+_0x24f453[0x0];_0x299c4c[_0xa3d2('0x3e')](_0x37de9f,_0x24f453[0x1]===_0xa3d2('0x8e')?![]:!![]);});}if(!_[_0xa3d2('0x73')](_0x505f03)){_0x299c4c[_0xa3d2('0x5c')](_0x2801ee);_0x2516ec[_0xa3d2('0x75')](_0xa3d2('0x8f'),_0x505f03);}BPromise[_0xa3d2('0x90')]()[_0xa3d2('0x26')](function(){if(!_0x10478e){if(_0x2581b8[_0xa3d2('0x36')]['SmsAccountId'])return;_0x2516ec[_0xa3d2('0x75')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x299c4c[_0xa3d2('0x75')](_0xa3d2('0x91'));return;}if(_0x2581b8[_0xa3d2('0x92')]['role']!==_0xa3d2('0x93'))return;return _0x2581b8[_0xa3d2('0x92')][_0xa3d2('0x94')]({'attributes':['id'],'raw':!![]})[_0xa3d2('0x26')](function(_0x32ed71){if(_['isEmpty'](_0x32ed71)){_0x2516ec[_0xa3d2('0x75')](_0xa3d2('0x95'));_0x299c4c[_0xa3d2('0x75')](_0xa3d2('0x95'));}else{_0x2516ec[_0xa3d2('0x75')](_0xa3d2('0x76'),_[_0xa3d2('0x2c')](_0x32ed71,'id'));_0x299c4c[_0xa3d2('0x75')](_0xa3d2('0x76'),_[_0xa3d2('0x2c')](_0x32ed71,'id'));}});})['then'](function(){if(_0x2581b8[_0xa3d2('0x92')]['role']==='agent'&&!_0x10478e&&!_0x2581b8[_0xa3d2('0x36')][_0xa3d2('0x74')])return[];return db['sequelize']['query'](_0x2516ec[_0xa3d2('0x96')](),_0x4f2340);})[_0xa3d2('0x26')](function(_0x5bb17e){_0x154737[_0xa3d2('0x20')]=_0x5bb17e[_0xa3d2('0x58')];if(_0x154737['count']===0x0)return[];return db['sequelize'][_0xa3d2('0x36')](_0x5695a7[_0xa3d2('0x96')](),_0x4f2340)['then'](function(_0x24707e){_0xdc2751=_['keyBy'](_0x24707e,'id');_0x4f2340=_[_0xa3d2('0x97')](_0x4f2340,{'model':db[_0xa3d2('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2581b8['query'][_0xa3d2('0x3b')]){_0x5d63c6[_0xa3d2('0x39')][_0xa3d2('0x6b')](function(_0x331b2f){_0x299c4c[_0xa3d2('0x41')]('i.'+_0x331b2f);});}else{_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0x98'),_0xa3d2('0x5b'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0x99'),_0xa3d2('0x9a'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0x9b'),_0xa3d2('0x9c'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0x9d'),_0xa3d2('0x8d'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0x9e'));_0x299c4c['field'](_0xa3d2('0x9f'),_0xa3d2('0xa0'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xa1'),_0xa3d2('0xa2'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xa3'),_0xa3d2('0xa4'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xa5'),'Contact.phone');_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xa6'),'Contact.mobile');_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xa7'),_0xa3d2('0xa8'));_0x299c4c['field']('o.fullname',_0xa3d2('0xa9'));_0x299c4c[_0xa3d2('0x41')](_0xa3d2('0xaa'),_0xa3d2('0xab'));_0x299c4c['field'](_0xa3d2('0xac'),_0xa3d2('0x2d'));}if(_0x5d63c6['limit'])_0x299c4c[_0xa3d2('0x1f')](_0x5d63c6[_0xa3d2('0x1f')]);if(_0x5d63c6[_0xa3d2('0x1d')])_0x299c4c[_0xa3d2('0x1d')](_0x5d63c6['offset']);return db[_0xa3d2('0xad')]['query'](_0x299c4c[_0xa3d2('0x96')](),_0x4f2340);})['then'](function(_0x151b2f){if(_0x151b2f[_0xa3d2('0x58')]>0x0)_0x5139b4[_0xa3d2('0x75')](_0xa3d2('0xae'),_[_0xa3d2('0x2c')](_0x151b2f,'id'));return db['sequelize'][_0xa3d2('0x36')](_0x5139b4['toString'](),_0x4f2340)[_0xa3d2('0x26')](function(_0xed0058){var _0x158eac=_['groupBy'](_0xed0058,_0xa3d2('0xaf'));var _0x4b331f=[];_0x151b2f[_0xa3d2('0x6b')](function(_0x51dfa0){_0x4b331f[_0xa3d2('0x2f')](updateSmsInteraction(_0x51dfa0,_0xdc2751,_0x158eac));});return BPromise[_0xa3d2('0xb0')](_0x4b331f);});});})['then'](function(_0x5e1d55){_0x154737[_0xa3d2('0xb1')]=_0x5e1d55;return _0x154737;})[_0xa3d2('0x26')](respondWithFilteredResult(_0x2aad09,_0x5d63c6))[_0xa3d2('0x30')](handleError(_0x2aad09,null));};exports[_0xa3d2('0xb2')]=function(_0x59f851,_0x113be5){var _0x3ae01c={'raw':![],'where':{'id':_0x59f851[_0xa3d2('0xb3')]['id']}},_0x1c5c98={};_0x1c5c98[_0xa3d2('0x35')]=_['keys'](db[_0xa3d2('0x32')]['rawAttributes']);_0x1c5c98['query']=_['keys'](_0x59f851[_0xa3d2('0x36')]);_0x1c5c98['filters']=_[_0xa3d2('0x3a')](_0x1c5c98[_0xa3d2('0x35')],_0x1c5c98[_0xa3d2('0x36')]);_0x3ae01c[_0xa3d2('0x39')]=_[_0xa3d2('0x3a')](_0x1c5c98['model'],qs['fields'](_0x59f851[_0xa3d2('0x36')][_0xa3d2('0x3b')]));_0x3ae01c[_0xa3d2('0x39')]=_0x3ae01c[_0xa3d2('0x39')][_0xa3d2('0x58')]?_0x3ae01c[_0xa3d2('0x39')]:_0x1c5c98[_0xa3d2('0x35')];if(_0x59f851[_0xa3d2('0x36')][_0xa3d2('0xb4')]){_0x3ae01c[_0xa3d2('0xb5')]=[{'all':!![]}];}_0x3ae01c=_[_0xa3d2('0x97')]({},_0x3ae01c,_0x59f851['options']);return db['SmsInteraction'][_0xa3d2('0x5a')](_0x3ae01c)[_0xa3d2('0x26')](handleEntityNotFound(_0x113be5,null))[_0xa3d2('0x26')](respondWithResult(_0x113be5,null))['catch'](handleError(_0x113be5,null));};exports[_0xa3d2('0xb6')]=function(_0x243561,_0x57c230){return db[_0xa3d2('0x32')][_0xa3d2('0xb6')](_0x243561[_0xa3d2('0x70')],{})['then'](respondWithResult(_0x57c230,0xc9))[_0xa3d2('0x30')](handleError(_0x57c230,null));};exports[_0xa3d2('0xb7')]=function(_0x149dde,_0x31474e){if(_0x149dde['body']['id']){delete _0x149dde[_0xa3d2('0x70')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x149dde[_0xa3d2('0xb3')]['id']}})[_0xa3d2('0x26')](handleEntityNotFound(_0x31474e,null))[_0xa3d2('0x26')](saveUpdates(_0x149dde[_0xa3d2('0x70')],null))[_0xa3d2('0x26')](respondWithResult(_0x31474e,null))['catch'](handleError(_0x31474e,null));};exports['destroy']=function(_0x2fb6b9,_0x581520){return db[_0xa3d2('0x32')][_0xa3d2('0x5a')]({'where':{'id':_0x2fb6b9['params']['id']}})[_0xa3d2('0x26')](handleEntityNotFound(_0x581520,null))['then'](removeEntity(_0x581520,null))['catch'](handleError(_0x581520,null));};exports[_0xa3d2('0xb8')]=function(_0x2e5f37,_0x48e6a0){return db[_0xa3d2('0x32')][_0xa3d2('0xb8')]()[_0xa3d2('0x26')](respondWithResult(_0x48e6a0,null))[_0xa3d2('0x30')](handleError(_0x48e6a0,null));};exports[_0xa3d2('0xb9')]=function(_0x453f9c,_0x3524bf,_0x2ba513){return db['SmsMessage'][_0xa3d2('0x5a')]({'where':{'id':_0x453f9c[_0xa3d2('0xb3')]['id']}})[_0xa3d2('0x26')](handleEntityNotFound(_0x3524bf,null))[_0xa3d2('0x26')](function(_0x202593){if(_0x202593){return _0x202593[_0xa3d2('0xb9')](_0x453f9c[_0xa3d2('0x70')]['ids'],_[_0xa3d2('0xba')](_0x453f9c[_0xa3d2('0x70')],[_0xa3d2('0xbb'),'id'])||{});}})[_0xa3d2('0x26')](respondWithResult(_0x3524bf,null))[_0xa3d2('0x30')](handleError(_0x3524bf,null));};exports[_0xa3d2('0xbc')]=function(_0x50b86a,_0x3e91c4,_0x344369){var _0x492ca8={'raw':![],'where':{}};var _0x3d8682={};var _0x3d72a7={'count':0x0,'rows':[]};return db[_0xa3d2('0x32')][_0xa3d2('0xbd')]({'where':{'id':_0x50b86a[_0xa3d2('0xb3')]['id']}})[_0xa3d2('0x26')](handleEntityNotFound(_0x3e91c4,null))[_0xa3d2('0x26')](function(_0x2697b2){if(_0x2697b2){_0x3d8682['model']=_[_0xa3d2('0x37')](db['SmsMessage'][_0xa3d2('0x33')]);_0x3d8682[_0xa3d2('0x36')]=_[_0xa3d2('0x37')](_0x50b86a[_0xa3d2('0x36')]);_0x3d8682[_0xa3d2('0x38')]=_[_0xa3d2('0x3a')](_0x3d8682[_0xa3d2('0x35')],_0x3d8682[_0xa3d2('0x36')]);_0x492ca8[_0xa3d2('0x39')]=_['intersection'](_0x3d8682[_0xa3d2('0x35')],qs['fields'](_0x50b86a[_0xa3d2('0x36')][_0xa3d2('0x3b')]));_0x492ca8[_0xa3d2('0x39')]=_0x492ca8[_0xa3d2('0x39')][_0xa3d2('0x58')]?_0x492ca8[_0xa3d2('0x39')]:_0x3d8682[_0xa3d2('0x35')];if(!_0x50b86a[_0xa3d2('0x36')][_0xa3d2('0x3c')](_0xa3d2('0x3d'))){_0x492ca8[_0xa3d2('0x1f')]=qs['limit'](_0x50b86a['query'][_0xa3d2('0x1f')]);_0x492ca8[_0xa3d2('0x1d')]=qs[_0xa3d2('0x1d')](_0x50b86a[_0xa3d2('0x36')]['offset']);}_0x492ca8['order']=qs[_0xa3d2('0x3f')](_0x50b86a['query'][_0xa3d2('0x3f')]);_0x492ca8[_0xa3d2('0x75')]=qs[_0xa3d2('0x38')](_[_0xa3d2('0x40')](_0x50b86a[_0xa3d2('0x36')],_0x3d8682[_0xa3d2('0x38')]));_0x492ca8[_0xa3d2('0x75')]['SmsInteractionId']=_0x2697b2['id'];if(_0x50b86a['query']['filter']){_0x492ca8[_0xa3d2('0x75')]=_['merge'](_0x492ca8[_0xa3d2('0x75')],{'$or':_[_0xa3d2('0x2c')](_0x492ca8[_0xa3d2('0x39')],function(_0x1b6c29){var _0x4bbce4={};_0x4bbce4[_0x1b6c29]={'$like':'%'+_0x50b86a['query'][_0xa3d2('0x83')]+'%'};return _0x4bbce4;})});}if(_0x50b86a[_0xa3d2('0x36')][_0xa3d2('0x79')]){var _0x304461=_0x50b86a[_0xa3d2('0x36')][_0xa3d2('0x79')][_0xa3d2('0x63')](',');var _0x5d70e4={};_0x5d70e4[_0x304461[0x0]]={'$gte':moment(_0x304461[0x1])[_0xa3d2('0xbe')](_0xa3d2('0xbf'))};_0x492ca8[_0xa3d2('0x75')]=_['merge'](_0x492ca8[_0xa3d2('0x75')],_0x5d70e4);}_0x492ca8=_[_0xa3d2('0x97')]({},_0x492ca8,_0x50b86a[_0xa3d2('0xc0')]);return db[_0xa3d2('0xc1')][_0xa3d2('0x20')]({'where':_0x492ca8[_0xa3d2('0x75')]})[_0xa3d2('0x26')](function(_0x53fb81){_0x3d72a7['count']=_0x53fb81;if(_0x50b86a[_0xa3d2('0x36')][_0xa3d2('0xb4')]){_0x492ca8[_0xa3d2('0xb5')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x492ca8);})[_0xa3d2('0x26')](function(_0x2a1771){_0x3d72a7['rows']=_0x2a1771;return _0x3d72a7;});}})[_0xa3d2('0x26')](respondWithFilteredResult(_0x3e91c4,_0x492ca8))[_0xa3d2('0x30')](handleError(_0x3e91c4,null));};exports[_0xa3d2('0xc2')]=function(_0x2d9748,_0x133377,_0x450cc7){return db[_0xa3d2('0x32')][_0xa3d2('0x5a')]({'where':{'id':_0x2d9748['params']['id']}})[_0xa3d2('0x26')](handleEntityNotFound(_0x133377,null))[_0xa3d2('0x26')](function(_0x2c5538){if(_0x2c5538){return _0x2c5538[_0xa3d2('0xc3')](_0x2d9748[_0xa3d2('0x70')][_0xa3d2('0xbb')],_[_0xa3d2('0xba')](_0x2d9748[_0xa3d2('0x70')],[_0xa3d2('0xbb'),'id'])||{})['spread'](function(){return db[_0xa3d2('0xc4')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x2d9748[_0xa3d2('0x70')][_0xa3d2('0xbb')]}});})['then'](function(_0x228d39){socket[_0xa3d2('0xc5')](_0xa3d2('0xc6'),{'id':Number(_0x2d9748[_0xa3d2('0xb3')]['id']),'tags':_0x228d39||[]});return{'id':Number(_0x2d9748['params']['id']),'tags':_0x228d39||[]};});}})[_0xa3d2('0x26')](respondWithResult(_0x133377,null))[_0xa3d2('0x30')](handleError(_0x133377,null));};exports[_0xa3d2('0xc7')]=function(_0x1ffba4,_0x2b38fe,_0x371dd1){return db[_0xa3d2('0x32')][_0xa3d2('0x5a')]({'where':{'id':_0x1ffba4[_0xa3d2('0xb3')]['id']}})['then'](handleEntityNotFound(_0x2b38fe,null))[_0xa3d2('0x26')](function(_0x1b13d8){if(_0x1b13d8){return _0x1b13d8[_0xa3d2('0xc7')](_0x1ffba4[_0xa3d2('0x36')][_0xa3d2('0xbb')]);}})['then'](respondWithStatusCode(_0x2b38fe,null))[_0xa3d2('0x30')](handleError(_0x2b38fe,null));};exports[_0xa3d2('0xc8')]=function(_0x1189f2,_0x41f902){var _0x2403e4=moment()[_0xa3d2('0xc9')]()[_0xa3d2('0x96')]();var _0x300f51=path[_0xa3d2('0xca')](config[_0xa3d2('0xcb')],_0xa3d2('0xcc'),_0xa3d2('0xcd'),_0xa3d2('0xce'));var _0x5703b9=path[_0xa3d2('0xca')](config[_0xa3d2('0xcb')],_0xa3d2('0xcc'),_0xa3d2('0xcd'),'attachments');var _0x7c0b0c=path['join'](_0x300f51,_0x2403e4);var _0x5a7242=util['format'](_0xa3d2('0xcf'),_0x1189f2[_0xa3d2('0xb3')]['id'],_0x2403e4);var _0x2aa826=path[_0xa3d2('0xca')](_0x300f51,_0x5a7242);var _0x4552dc=[];_0x4552dc['push']({'model':db[_0xa3d2('0x6d')],'as':_0xa3d2('0x6d'),'attributes':['id',_0xa3d2('0xd0')],'raw':!![]});_0x4552dc[_0xa3d2('0x2f')]({'model':db[_0xa3d2('0xd1')],'as':_0xa3d2('0x5f'),'attributes':['id',_0xa3d2('0xd2'),'lastName'],'raw':!![]});var _0x3d6a69=[{'model':db[_0xa3d2('0xc1')],'as':'Messages','attributes':['id',_0xa3d2('0x70'),_0xa3d2('0x78'),_0xa3d2('0xd3'),_0xa3d2('0xd4'),_0xa3d2('0x7f')],'include':_0x4552dc}];_0x3d6a69[_0xa3d2('0x2f')]({'model':db[_0xa3d2('0xd5')],'as':'Account','attributes':['id',_0xa3d2('0x2a')]});_0x3d6a69[_0xa3d2('0x2f')]({'model':db['User'],'as':_0xa3d2('0xd6'),'attributes':['id','fullname']});return db[_0xa3d2('0x32')]['find']({'where':{'id':_0x1189f2['params']['id']},'include':_0x3d6a69})[_0xa3d2('0x26')](handleEntityNotFound(_0x41f902,null))[_0xa3d2('0x26')](function(_0x4dc5a6){if(_0x4dc5a6){var _0x52cdc2=_0x4dc5a6[_0xa3d2('0xd7')]({'plain':!![]});fs[_0xa3d2('0xd8')](_0x7c0b0c);var _0x1ebbb1={'channel':_0xa3d2('0xd9'),'account':_0x52cdc2[_0xa3d2('0xda')][_0xa3d2('0x2a')],'agent':_0x52cdc2[_0xa3d2('0xd6')]?_0x52cdc2[_0xa3d2('0xd6')][_0xa3d2('0xd0')]:_0xa3d2('0xdb'),'createdAt':moment(_0x52cdc2['createdAt'])[_0xa3d2('0xbe')](_0xa3d2('0xbf'))[_0xa3d2('0x96')](),'closedAt':_0x52cdc2[_0xa3d2('0xdc')]?moment(_0x52cdc2['closedAt'])[_0xa3d2('0xbe')](_0xa3d2('0xbf'))[_0xa3d2('0x96')]():'','disposition':_0x52cdc2['disposition'],'messages':_(_0x52cdc2[_0xa3d2('0xdd')])[_0xa3d2('0x83')]({'secret':![]})[_0xa3d2('0x2c')](function(_0x1e511a){return{'date':moment(_0x1e511a[_0xa3d2('0x78')])[_0xa3d2('0xbe')](_0xa3d2('0xbf'))['toString'](),'sender':_0x1e511a['direction']==='out'?_0x1e511a[_0xa3d2('0x6d')]?_0x1e511a[_0xa3d2('0x6d')][_0xa3d2('0xd0')]:_0xa3d2('0xde'):_0x1e511a[_0xa3d2('0x5f')]['firstName']+(_0x1e511a[_0xa3d2('0x5f')][_0xa3d2('0xdf')]?'\x20'+_0x1e511a[_0xa3d2('0x5f')][_0xa3d2('0xdf')]:''),'body':_0x1e511a['body'],'direction':_0x1e511a[_0xa3d2('0xd3')]==='out'?'A':'C','secret':_0x1e511a[_0xa3d2('0xd4')],'read':_0x1e511a[_0xa3d2('0x7f')]};})[_0xa3d2('0x62')]()};return ejs[_0xa3d2('0xe0')](path[_0xa3d2('0xca')](config[_0xa3d2('0xcb')],_0xa3d2('0xcc'),_0xa3d2('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x1ebbb1})[_0xa3d2('0x26')](function(_0x5d9b2e){var _0x30293e=path[_0xa3d2('0xca')](_0x7c0b0c,_0xa3d2('0xe2')+_0x52cdc2['id']+'-'+_0x2403e4+_0xa3d2('0xe3'));var _0x394743={'path':_0x30293e,'channel':_0xa3d2('0xd9'),'interactionId':_0x52cdc2['id']};return pdf[_0xa3d2('0xe4')](_0x5d9b2e,_0x394743);})['then'](function(){return new BPromise(function(_0x512afb,_0x1480a4){zipdir(_0x7c0b0c,{'saveTo':_0x2aa826},function(_0xd261f5,_0x5b0b55){if(_0xd261f5)return _0x1480a4(_0xd261f5);return _0x512afb(_0x5b0b55);});})[_0xa3d2('0x26')](function(){return new BPromise(function(_0x58ce77,_0x176b8a){rimraf(_0x7c0b0c,function(_0xa7a727){if(_0xa7a727)_0x176b8a(_0xa7a727);return _0x58ce77();});});})['then'](function(){return _0x41f902[_0xa3d2('0xc8')](_0x2aa826,_0x5a7242,function(_0x5806eb){if(_0x5806eb){console[_0xa3d2('0xe5')](_0xa3d2('0xe6'),_0x5806eb);}else{fs[_0xa3d2('0xe7')](_0x2aa826);}});});});}else{return _0x41f902[_0xa3d2('0x1b')](0xc8);}})[_0xa3d2('0x30')](handleError(_0x41f902,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 64061ce..7114cb2 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 _0xb78e=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x57f327,_0x29c3b0){var _0x2f2354=function(_0x3417ba){while(--_0x3417ba){_0x57f327['push'](_0x57f327['shift']());}};_0x2f2354(++_0x29c3b0);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5eab5f,_0x339d4e){_0x5eab5f=_0x5eab5f-0x0;var _0x7dd2eb=_0xb78e[_0x5eab5f];return _0x7dd2eb;};'use strict';var EventEmitter=require(_0xeb78('0x0'));var SmsInteraction=require(_0xeb78('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xeb78('0x1'))['db'][_0xeb78('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb78('0x3')](0x0);var events={'afterCreate':_0xeb78('0x4'),'afterUpdate':_0xeb78('0x5'),'afterDestroy':_0xeb78('0x6')};function emitEvent(_0x13ef9d){return function(_0x1bdf83,_0x57ec6b,_0x3c35e7){_0x1bdf83[_0xeb78('0x7')]({'attributes':['id'],'raw':!![]})[_0xeb78('0x8')](function(_0x30c884){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xa'),_0x30c884[_0xeb78('0xb')](function(_0x573406){return{'id':_0x573406['id']};}));return SmsMessage[_0xeb78('0xc')]({'where':{'SmsInteractionId':_0x1bdf83['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb78('0x8')](function(_0xa1ca82){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xd'),_0xa1ca82[_0xeb78('0xe')]);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d+':'+_0x1bdf83['id'],_0x1bdf83);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d,_0x1bdf83);_0x3c35e7(null);})[_0xeb78('0x10')](_0x3c35e7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xeb78('0x11')](e,emitEvent(event));}}module[_0xeb78('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x318643,_0x8ac50e){var _0x59bf55=function(_0x100e61){while(--_0x100e61){_0x318643['push'](_0x318643['shift']());}};_0x59bf55(++_0x8ac50e);}(_0x0598,0x92));var _0x8059=function(_0x5e782e,_0x5ead47){_0x5e782e=_0x5e782e-0x0;var _0xaf5eda=_0x0598[_0x5e782e];return _0xaf5eda;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 605a3fe..4ea0c38 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 _0x89cd=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','rimraf'];(function(_0x20e4a2,_0x4e0465){var _0xf4397b=function(_0x2d0c94){while(--_0x2d0c94){_0x20e4a2['push'](_0x20e4a2['shift']());}};_0xf4397b(++_0x4e0465);}(_0x89cd,0x6a));var _0xd89c=function(_0x25b439,_0xb20872){_0x25b439=_0x25b439-0x0;var _0xbf2210=_0x89cd[_0x25b439];return _0xbf2210;};'use strict';var _=require(_0xd89c('0x0'));var util=require(_0xd89c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd89c('0x2'));var BPromise=require(_0xd89c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd89c('0x4'));var rimraf=require(_0xd89c('0x5'));var config=require(_0xd89c('0x6'));var attributes=require(_0xd89c('0x7'));module[_0xd89c('0x8')]=function(_0x514950,_0x3ba8a0){return _0x514950[_0xd89c('0x9')](_0xd89c('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47fbac,_0x158577,_0x2bdd8e){if(_0x47fbac[_0xd89c('0xb')]('closed')){_0x47fbac[_0xd89c('0xc')]=moment()['format'](_0xd89c('0xd'));}_0x2bdd8e(null,_0x47fbac);}}});}; \ No newline at end of file +var _0x5992=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path'];(function(_0x278365,_0x6f3a5d){var _0x3820c6=function(_0x498452){while(--_0x498452){_0x278365['push'](_0x278365['shift']());}};_0x3820c6(++_0x6f3a5d);}(_0x5992,0x82));var _0x2599=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x5992[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0x2599('0x0'));var logger=require(_0x2599('0x1'))('api');var moment=require(_0x2599('0x2'));var BPromise=require('bluebird');var rp=require(_0x2599('0x3'));var fs=require('fs');var path=require(_0x2599('0x4'));var rimraf=require(_0x2599('0x5'));var config=require(_0x2599('0x6'));var attributes=require(_0x2599('0x7'));module[_0x2599('0x8')]=function(_0x181641,_0x30c5a7){return _0x181641[_0x2599('0x9')](_0x2599('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20b81d,_0x49363a,_0x3d58b2){if(_0x20b81d['changed'](_0x2599('0xb'))){_0x20b81d[_0x2599('0xc')]=moment()[_0x2599('0xd')](_0x2599('0xe'));}_0x3d58b2(null,_0x20b81d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5abf2d3..fb715c6 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 _0xaa8e=['stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','then','info','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xaa8e,0x191));var _0xeaa8=function(_0x2f032f,_0x478129){_0x2f032f=_0x2f032f-0x0;var _0x8fab71=_0xaa8e[_0x2f032f];return _0x8fab71;};'use strict';var _=require(_0xeaa8('0x0'));var util=require(_0xeaa8('0x1'));var moment=require(_0xeaa8('0x2'));var BPromise=require(_0xeaa8('0x3'));var rs=require(_0xeaa8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeaa8('0x5'))('rpc');var config=require(_0xeaa8('0x6'));var jayson=require(_0xeaa8('0x7'));var client=jayson[_0xeaa8('0x8')][_0xeaa8('0x9')]({'port':0x232a});config[_0xeaa8('0xa')]=_[_0xeaa8('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeaa8('0xc'))(new Redis(config[_0xeaa8('0xa')]));require(_0xeaa8('0xd'))[_0xeaa8('0xe')](socket);function respondWithRpcPromise(_0x223c85,_0x484208,_0x656396){return new BPromise(function(_0x415567,_0x1639d9){return client[_0xeaa8('0xf')](_0x223c85,_0x656396)['then'](function(_0x460a0b){logger['info'](_0xeaa8('0x10'),_0x484208,'request\x20sent');logger[_0xeaa8('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x484208,_0xeaa8('0x12'),JSON[_0xeaa8('0x13')](_0x460a0b));if(_0x460a0b[_0xeaa8('0x14')]){if(_0x460a0b['error'][_0xeaa8('0x15')]===0x1f4){logger[_0xeaa8('0x14')](_0xeaa8('0x10'),_0x484208,_0x460a0b[_0xeaa8('0x14')][_0xeaa8('0x16')]);return _0x1639d9(_0x460a0b[_0xeaa8('0x14')][_0xeaa8('0x16')]);}logger['error'](_0xeaa8('0x10'),_0x484208,_0x460a0b[_0xeaa8('0x14')]['message']);return _0x415567(_0x460a0b[_0xeaa8('0x14')][_0xeaa8('0x16')]);}else{logger['info'](_0xeaa8('0x10'),_0x484208,'request\x20sent');_0x415567(_0x460a0b[_0xeaa8('0x17')][_0xeaa8('0x16')]);}})[_0xeaa8('0x18')](function(_0x163378){logger[_0xeaa8('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x484208,_0x163378);_0x1639d9(_0x163378);});});}exports[_0xeaa8('0x19')]=function(_0x35a76c){var _0x477563=this;return new Promise(function(_0x4db5e4,_0x3a7cff){return db[_0xeaa8('0x1a')]['update'](_0x35a76c[_0xeaa8('0x1b')],{'raw':_0x35a76c[_0xeaa8('0x1c')]?_0x35a76c[_0xeaa8('0x1c')][_0xeaa8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35a76c[_0xeaa8('0x1c')]?_0x35a76c[_0xeaa8('0x1c')][_0xeaa8('0x1e')]||null:null,'attributes':_0x35a76c[_0xeaa8('0x1c')]?_0x35a76c[_0xeaa8('0x1c')][_0xeaa8('0x1f')]||null:null,'limit':_0x35a76c[_0xeaa8('0x1c')]?_0x35a76c[_0xeaa8('0x1c')][_0xeaa8('0x20')]||null:null})[_0xeaa8('0x21')](function(_0x2f850e){logger[_0xeaa8('0x22')](_0xeaa8('0x19'),_0x35a76c);logger[_0xeaa8('0x11')](_0xeaa8('0x19'),_0x35a76c,JSON[_0xeaa8('0x13')](_0x2f850e));_0x4db5e4(_0x2f850e);})[_0xeaa8('0x18')](function(_0x41e9eb){logger[_0xeaa8('0x14')]('UpdateSmsInteraction',_0x41e9eb[_0xeaa8('0x16')],_0x35a76c);_0x3a7cff(_0x477563[_0xeaa8('0x14')](0x1f4,_0x41e9eb['message']));});});};exports[_0xeaa8('0x23')]=function(_0x53e9e7){return new Promise(function(_0x265597,_0x60ae49){return db[_0xeaa8('0x1a')][_0xeaa8('0x24')]({'where':_0x53e9e7['options']?_0x53e9e7[_0xeaa8('0x1c')]['where']||null:null})[_0xeaa8('0x21')](function(_0x2f069a){if(_0x2f069a){return _0x2f069a[_0xeaa8('0x25')](_0x53e9e7[_0xeaa8('0x1b')]['ids'],_[_0xeaa8('0x26')](_0x53e9e7[_0xeaa8('0x1b')],[_0xeaa8('0x27'),'id'])||{});}})[_0xeaa8('0x28')](function(_0x3860a3){logger[_0xeaa8('0x22')](_0xeaa8('0x29'),_0x53e9e7);logger[_0xeaa8('0x11')](_0xeaa8('0x29'),_0x53e9e7,JSON['stringify'](_0x3860a3));_0x265597(_0x3860a3);})[_0xeaa8('0x18')](function(_0x1a938c){logger[_0xeaa8('0x14')](_0xeaa8('0x29'),_0x1a938c[_0xeaa8('0x16')],_0x53e9e7);_0x60ae49(_this[_0xeaa8('0x14')](0x1f4,_0x1a938c['message']));});});}; \ No newline at end of file +var _0xcf3c=['limit','catch','AddTagsToSmsInteraction','find','where','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateSmsInteraction','options','raw'];(function(_0x4aaae5,_0x22d814){var _0x1c02a9=function(_0x4960cc){while(--_0x4960cc){_0x4aaae5['push'](_0x4aaae5['shift']());}};_0x1c02a9(++_0x22d814);}(_0xcf3c,0x142));var _0xccf3=function(_0x1cc081,_0xef781d){_0x1cc081=_0x1cc081-0x0;var _0x36f9fc=_0xcf3c[_0x1cc081];return _0x36f9fc;};'use strict';var _=require(_0xccf3('0x0'));var util=require('util');var moment=require(_0xccf3('0x1'));var BPromise=require(_0xccf3('0x2'));var rs=require(_0xccf3('0x3'));var fs=require('fs');var Redis=require(_0xccf3('0x4'));var db=require(_0xccf3('0x5'))['db'];var utils=require(_0xccf3('0x6'));var logger=require('../../config/logger')(_0xccf3('0x7'));var config=require(_0xccf3('0x8'));var jayson=require(_0xccf3('0x9'));var client=jayson[_0xccf3('0xa')][_0xccf3('0xb')]({'port':0x232a});config[_0xccf3('0xc')]=_[_0xccf3('0xd')](config[_0xccf3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xccf3('0xe'))(new Redis(config[_0xccf3('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3f2fb4,_0x45911f,_0x7876cf){return new BPromise(function(_0x255c31,_0x398305){return client[_0xccf3('0xf')](_0x3f2fb4,_0x7876cf)[_0xccf3('0x10')](function(_0x4e2d0a){logger[_0xccf3('0x11')](_0xccf3('0x12'),_0x45911f,_0xccf3('0x13'));logger[_0xccf3('0x14')](_0xccf3('0x15'),_0x45911f,'request\x20sent',JSON[_0xccf3('0x16')](_0x4e2d0a));if(_0x4e2d0a['error']){if(_0x4e2d0a[_0xccf3('0x17')]['code']===0x1f4){logger[_0xccf3('0x17')](_0xccf3('0x12'),_0x45911f,_0x4e2d0a['error'][_0xccf3('0x18')]);return _0x398305(_0x4e2d0a[_0xccf3('0x17')][_0xccf3('0x18')]);}logger[_0xccf3('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x45911f,_0x4e2d0a['error']['message']);return _0x255c31(_0x4e2d0a[_0xccf3('0x17')][_0xccf3('0x18')]);}else{logger[_0xccf3('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x45911f,'request\x20sent');_0x255c31(_0x4e2d0a[_0xccf3('0x19')][_0xccf3('0x18')]);}})['catch'](function(_0x1bf4b5){logger[_0xccf3('0x17')](_0xccf3('0x12'),_0x45911f,_0x1bf4b5);_0x398305(_0x1bf4b5);});});}exports[_0xccf3('0x1a')]=function(_0x414786){var _0x1fe20e=this;return new Promise(function(_0x1a3b26,_0x3ae81a){return db['SmsInteraction']['update'](_0x414786['body'],{'raw':_0x414786['options']?_0x414786[_0xccf3('0x1b')][_0xccf3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414786[_0xccf3('0x1b')]?_0x414786[_0xccf3('0x1b')]['where']||null:null,'attributes':_0x414786[_0xccf3('0x1b')]?_0x414786[_0xccf3('0x1b')]['attributes']||null:null,'limit':_0x414786[_0xccf3('0x1b')]?_0x414786[_0xccf3('0x1b')][_0xccf3('0x1d')]||null:null})[_0xccf3('0x10')](function(_0x394906){logger[_0xccf3('0x11')](_0xccf3('0x1a'),_0x414786);logger['debug'](_0xccf3('0x1a'),_0x414786,JSON['stringify'](_0x394906));_0x1a3b26(_0x394906);})[_0xccf3('0x1e')](function(_0x222576){logger[_0xccf3('0x17')](_0xccf3('0x1a'),_0x222576[_0xccf3('0x18')],_0x414786);_0x3ae81a(_0x1fe20e[_0xccf3('0x17')](0x1f4,_0x222576[_0xccf3('0x18')]));});});};exports[_0xccf3('0x1f')]=function(_0x3c6393){return new Promise(function(_0x1b2d62,_0x34b806){return db['SmsInteraction'][_0xccf3('0x20')]({'where':_0x3c6393[_0xccf3('0x1b')]?_0x3c6393[_0xccf3('0x1b')][_0xccf3('0x21')]||null:null})[_0xccf3('0x10')](function(_0x3c729c){if(_0x3c729c){return _0x3c729c['addTags'](_0x3c6393[_0xccf3('0x22')][_0xccf3('0x23')],_[_0xccf3('0x24')](_0x3c6393['body'],[_0xccf3('0x23'),'id'])||{});}})[_0xccf3('0x25')](function(_0x20edf7){logger['info'](_0xccf3('0x26'),_0x3c6393);logger[_0xccf3('0x14')]('AddTags',_0x3c6393,JSON[_0xccf3('0x16')](_0x20edf7));_0x1b2d62(_0x20edf7);})['catch'](function(_0x2a5608){logger['error'](_0xccf3('0x26'),_0x2a5608[_0xccf3('0x18')],_0x3c6393);_0x34b806(_this[_0xccf3('0x17')](0x1f4,_0x2a5608['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6e9347e..34cba64 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 _0x54d2=['remove','update','removeListener','register','length','./smsInteraction.events','save'];(function(_0x50115a,_0x5cfd49){var _0x4714d7=function(_0x2f47bf){while(--_0x2f47bf){_0x50115a['push'](_0x50115a['shift']());}};_0x4714d7(++_0x5cfd49);}(_0x54d2,0x75));var _0x254d=function(_0x2033da,_0x4501d9){_0x2033da=_0x2033da-0x0;var _0x5e9104=_0x54d2[_0x2033da];return _0x5e9104;};'use strict';var SmsInteractionEvents=require(_0x254d('0x0'));var events=[_0x254d('0x1'),_0x254d('0x2'),_0x254d('0x3')];function createListener(_0x32a527,_0x17474e){return function(_0x17575e){_0x17474e['emit'](_0x32a527,_0x17575e);};}function removeListener(_0x120544,_0x1edb53){return function(){SmsInteractionEvents[_0x254d('0x4')](_0x120544,_0x1edb53);};}exports[_0x254d('0x5')]=function(_0x33faa9){for(var _0x317132=0x0,_0xa89d81=events[_0x254d('0x6')];_0x317132<_0xa89d81;_0x317132++){var _0x366448=events[_0x317132];var _0x21567f=createListener('smsInteraction:'+_0x366448,_0x33faa9);SmsInteractionEvents['on'](_0x366448,_0x21567f);}}; \ No newline at end of file +var _0x8f18=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0x8f18,0x143));var _0x88f1=function(_0x4e4a0a,_0x15d7f5){_0x4e4a0a=_0x4e4a0a-0x0;var _0x4f2b82=_0x8f18[_0x4e4a0a];return _0x4f2b82;};'use strict';var SmsInteractionEvents=require(_0x88f1('0x0'));var events=[_0x88f1('0x1'),_0x88f1('0x2'),_0x88f1('0x3')];function createListener(_0x211fa0,_0x1cf4a0){return function(_0x4283cb){_0x1cf4a0[_0x88f1('0x4')](_0x211fa0,_0x4283cb);};}function removeListener(_0x3be90a,_0x35649e){return function(){SmsInteractionEvents['removeListener'](_0x3be90a,_0x35649e);};}exports[_0x88f1('0x5')]=function(_0x5cb630){for(var _0x11733d=0x0,_0x59a33f=events['length'];_0x11733d<_0x59a33f;_0x11733d++){var _0xfbd1e3=events[_0x11733d];var _0x48d005=createListener(_0x88f1('0x6')+_0xfbd1e3,_0x5cb630);SmsInteractionEvents['on'](_0xfbd1e3,_0x48d005);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cc05429..6ac167b 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 _0xf0b0=['sms','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','tracked'];(function(_0x3f8e20,_0x1daf92){var _0x54b65e=function(_0x4cf6b8){while(--_0x4cf6b8){_0x3f8e20['push'](_0x3f8e20['shift']());}};_0x54b65e(++_0x1daf92);}(_0xf0b0,0x143));var _0x0f0b=function(_0x4cd618,_0x5b82ba){_0x4cd618=_0x4cd618-0x0;var _0xd8e142=_0xf0b0[_0x4cd618];return _0xd8e142;};'use strict';var multer=require('multer');var util=require(_0x0f0b('0x0'));var path=require(_0x0f0b('0x1'));var timeout=require(_0x0f0b('0x2'));var express=require('express');var router=express[_0x0f0b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0f0b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f0b('0x5'));var controller=require(_0x0f0b('0x6'));router[_0x0f0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f0b('0x8')]);router[_0x0f0b('0x7')]('/describe',auth[_0x0f0b('0x9')](),controller[_0x0f0b('0xa')]);router[_0x0f0b('0x7')](_0x0f0b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x0f0b('0xc')](_0x0f0b('0xd'),'smsmessage:create'),controller['create']);router[_0x0f0b('0xe')](_0x0f0b('0xf'),controller[_0x0f0b('0x10')]);router[_0x0f0b('0x11')](_0x0f0b('0xb'),auth[_0x0f0b('0x9')](),controller['update']);router[_0x0f0b('0x11')](_0x0f0b('0x12'),auth[_0x0f0b('0x9')](),controller[_0x0f0b('0x13')]);router[_0x0f0b('0x11')](_0x0f0b('0x14'),auth[_0x0f0b('0x9')](),controller[_0x0f0b('0x15')]);router[_0x0f0b('0x16')](_0x0f0b('0xb'),auth[_0x0f0b('0x9')](),controller[_0x0f0b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2f68=['post','sms','status','put','accept','/:id/reject','reject','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','show'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2f68,0x12b));var _0x82f6=function(_0x2c70d3,_0x10d931){_0x2c70d3=_0x2c70d3-0x0;var _0x2eea4c=_0x2f68[_0x2c70d3];return _0x2eea4c;};'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[_0x82f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x82f6('0x5'));var interaction=require(_0x82f6('0x6'));var config=require(_0x82f6('0x7'));var controller=require(_0x82f6('0x8'));router[_0x82f6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82f6('0x9')]('/describe',auth[_0x82f6('0xa')](),controller[_0x82f6('0xb')]);router[_0x82f6('0x9')]('/:id',auth[_0x82f6('0xa')](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')]('/',auth[_0x82f6('0xa')](),interaction['tracked'](_0x82f6('0xe'),'smsmessage:create'),controller['create']);router[_0x82f6('0xd')]('/:id/status',controller[_0x82f6('0xf')]);router[_0x82f6('0x10')]('/:id',auth[_0x82f6('0xa')](),controller['update']);router[_0x82f6('0x10')]('/:id/accept',auth['isAuthenticated'](),controller[_0x82f6('0x11')]);router[_0x82f6('0x10')](_0x82f6('0x12'),auth[_0x82f6('0xa')](),controller[_0x82f6('0x13')]);router[_0x82f6('0x14')](_0x82f6('0x15'),auth[_0x82f6('0xa')](),controller[_0x82f6('0x16')]);module[_0x82f6('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 7a4fb8d..73bb63e 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 _0xd45e=['STRING','DATE','exports','TEXT','BOOLEAN','out'];(function(_0x2f8729,_0x33dd93){var _0x3b8ea7=function(_0x4d1c88){while(--_0x4d1c88){_0x2f8729['push'](_0x2f8729['shift']());}};_0x3b8ea7(++_0x33dd93);}(_0xd45e,0x182));var _0xed45=function(_0x486ce3,_0x4d81c3){_0x486ce3=_0x486ce3-0x0;var _0x438c92=_0xd45e[_0x486ce3];return _0x438c92;};'use strict';var Sequelize=require('sequelize');module[_0xed45('0x0')]={'body':{'type':Sequelize[_0xed45('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xed45('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xed45('0x3')),'defaultValue':_0xed45('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xed45('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xed45('0x5')]},'secret':{'type':Sequelize[_0xed45('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4491=['TEXT','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4491,0x1bb));var _0x1449=function(_0x30f57a,_0x2a84d2){_0x30f57a=_0x30f57a-0x0;var _0x6de3e8=_0x4491[_0x30f57a];return _0x6de3e8;};'use strict';var Sequelize=require(_0x1449('0x0'));module['exports']={'body':{'type':Sequelize[_0x1449('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1449('0x3')]('in',_0x1449('0x4')),'defaultValue':_0x1449('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1449('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1449('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1449('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 37b317e..ff81d2b 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 _0xb1d8=['SmsMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteractionId','isNil','read1stAt','interaction','get','user','role','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','Sequelize','User','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','index'];(function(_0x5f3ee6,_0x56e6f2){var _0xc40096=function(_0x398c7e){while(--_0x398c7e){_0x5f3ee6['push'](_0x5f3ee6['shift']());}};_0xc40096(++_0x56e6f2);}(_0xb1d8,0xef));var _0x8b1d=function(_0x5db72e,_0x2d9450){_0x5db72e=_0x5db72e-0x0;var _0x17e00e=_0xb1d8[_0x5db72e];return _0x17e00e;};'use strict';var emlformat=require(_0x8b1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b1d('0x1'));var jsonpatch=require(_0x8b1d('0x2'));var rp=require('request-promise');var moment=require(_0x8b1d('0x3'));var BPromise=require(_0x8b1d('0x4'));var Mustache=require(_0x8b1d('0x5'));var util=require(_0x8b1d('0x6'));var path=require(_0x8b1d('0x7'));var sox=require(_0x8b1d('0x8'));var csv=require(_0x8b1d('0x9'));var ejs=require(_0x8b1d('0xa'));var fs=require('fs');var fs_extra=require(_0x8b1d('0xb'));var _=require(_0x8b1d('0xc'));var squel=require(_0x8b1d('0xd'));var crypto=require(_0x8b1d('0xe'));var jsforce=require(_0x8b1d('0xf'));var deskjs=require(_0x8b1d('0x10'));var toCsv=require(_0x8b1d('0x9'));var querystring=require(_0x8b1d('0x11'));var Papa=require('papaparse');var Redis=require(_0x8b1d('0x12'));var authService=require(_0x8b1d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8b1d('0x14'));var hardwareService=require(_0x8b1d('0x15'));var logger=require(_0x8b1d('0x16'))('api');var utils=require(_0x8b1d('0x17'));var config=require(_0x8b1d('0x18'));var licenseUtil=require(_0x8b1d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8b1d('0x1a')](config[_0x8b1d('0x1b')],{'host':_0x8b1d('0x1c'),'port':0x18eb});var socket=require(_0x8b1d('0x1d'))(new Redis(config[_0x8b1d('0x1b')]));require(_0x8b1d('0x1e'))[_0x8b1d('0x1f')](socket);var jayson=require(_0x8b1d('0x20'));var client=jayson[_0x8b1d('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x8b1d('0x21')][_0x8b1d('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x231913,_0x174ad9,_0x21b88a,_0x55b8d1){return new BPromise(function(_0x3929ea,_0x3010ef){var _0x4eb0e8=_0x55b8d1||client;return _0x4eb0e8[_0x8b1d('0x23')](_0x231913,_0x21b88a)['then'](function(_0x1aa5b6){logger[_0x8b1d('0x24')](_0x8b1d('0x25'),_0x174ad9,_0x8b1d('0x26'));logger[_0x8b1d('0x27')](_0x8b1d('0x28'),_0x174ad9,'request\x20sent',JSON['stringify'](_0x1aa5b6));if(_0x1aa5b6[_0x8b1d('0x29')]){if(_0x1aa5b6[_0x8b1d('0x29')]['code']===0x1f4){logger[_0x8b1d('0x29')](_0x8b1d('0x25'),_0x174ad9,_0x1aa5b6[_0x8b1d('0x29')][_0x8b1d('0x2a')]);return _0x3010ef(_0x1aa5b6['error'][_0x8b1d('0x2a')]);}logger[_0x8b1d('0x29')](_0x8b1d('0x25'),_0x174ad9,_0x1aa5b6[_0x8b1d('0x29')][_0x8b1d('0x2a')]);return _0x3929ea(_0x1aa5b6[_0x8b1d('0x29')][_0x8b1d('0x2a')]);}else{logger[_0x8b1d('0x24')](_0x8b1d('0x25'),_0x174ad9,_0x8b1d('0x26'));_0x3929ea(_0x1aa5b6[_0x8b1d('0x2b')][_0x8b1d('0x2a')]);}})[_0x8b1d('0x2c')](function(_0x1950e5){logger[_0x8b1d('0x29')](_0x8b1d('0x25'),_0x174ad9,_0x1950e5);_0x3010ef(_0x1950e5);});});}function respondWithStatusCode(_0x363420,_0x3c7b1d){_0x3c7b1d=_0x3c7b1d||0xcc;return function(_0x3a9747){if(_0x3a9747){return _0x363420['sendStatus'](_0x3c7b1d);}return _0x363420['status'](_0x3c7b1d)[_0x8b1d('0x2d')]();};}function respondWithResult(_0x4a0c0b,_0x2f7d86){_0x2f7d86=_0x2f7d86||0xc8;return function(_0x41efd2){if(_0x41efd2){return _0x4a0c0b['status'](_0x2f7d86)[_0x8b1d('0x2e')](_0x41efd2);}};}function respondWithFilteredResult(_0x561efd,_0xd8a66a){return function(_0x5f47a2){if(_0x5f47a2){var _0x34f876=typeof _0xd8a66a[_0x8b1d('0x2f')]===_0x8b1d('0x30')&&typeof _0xd8a66a['limit']===_0x8b1d('0x30');var _0x2a6ec6=_0x5f47a2[_0x8b1d('0x31')];var _0xbd2852=_0x34f876?0x0:_0xd8a66a[_0x8b1d('0x2f')];var _0x44edbb=_0x34f876?_0x5f47a2[_0x8b1d('0x31')]:_0xd8a66a[_0x8b1d('0x2f')]+_0xd8a66a['limit'];var _0x8611f3;if(_0x44edbb>=_0x2a6ec6){_0x44edbb=_0x2a6ec6;_0x8611f3=0xc8;}else{_0x8611f3=0xce;}_0x561efd[_0x8b1d('0x32')](_0x8611f3);return _0x561efd[_0x8b1d('0x33')](_0x8b1d('0x34'),_0xbd2852+'-'+_0x44edbb+'/'+_0x2a6ec6)['json'](_0x5f47a2);}return null;};}function patchUpdates(_0x41b687){return function(_0x15f1ae){try{jsonpatch[_0x8b1d('0x35')](_0x15f1ae,_0x41b687,!![]);}catch(_0x52e811){return BPromise[_0x8b1d('0x36')](_0x52e811);}return _0x15f1ae['save']();};}function saveUpdates(_0x2e218d,_0x591959){return function(_0x14a449){if(_0x14a449){return _0x14a449[_0x8b1d('0x37')](_0x2e218d)[_0x8b1d('0x38')](function(_0x4b9ac3){return _0x4b9ac3;});}return null;};}function removeEntity(_0x46024f,_0x583b37){return function(_0x158ab9){if(_0x158ab9){return _0x158ab9[_0x8b1d('0x39')]()[_0x8b1d('0x38')](function(){_0x46024f[_0x8b1d('0x32')](0xcc)[_0x8b1d('0x2d')]();});}};}function handleEntityNotFound(_0x3a5550,_0x1dcb2d){return function(_0x55294c){if(!_0x55294c){_0x3a5550['sendStatus'](0x194);}return _0x55294c;};}function handleError(_0x5270c2,_0x3516a4){_0x3516a4=_0x3516a4||0x1f4;return function(_0x478ebc){logger[_0x8b1d('0x29')](_0x478ebc[_0x8b1d('0x3a')]);if(_0x478ebc[_0x8b1d('0x3b')]){delete _0x478ebc[_0x8b1d('0x3b')];}_0x5270c2[_0x8b1d('0x32')](_0x3516a4)['send'](_0x478ebc);};}exports[_0x8b1d('0x3c')]=function(_0x401d56,_0x52cdd8){var _0x55ba94={},_0x2937d3={},_0x5523f9={'count':0x0,'rows':[]};var _0x5bae41=_['map'](db[_0x8b1d('0x3d')][_0x8b1d('0x3e')],function(_0xd32697){return{'name':_0xd32697[_0x8b1d('0x3f')],'type':_0xd32697[_0x8b1d('0x40')][_0x8b1d('0x41')]};});_0x2937d3[_0x8b1d('0x42')]=_[_0x8b1d('0x43')](_0x5bae41,_0x8b1d('0x3b'));_0x2937d3[_0x8b1d('0x44')]=_['keys'](_0x401d56[_0x8b1d('0x44')]);_0x2937d3[_0x8b1d('0x45')]=_[_0x8b1d('0x46')](_0x2937d3[_0x8b1d('0x42')],_0x2937d3[_0x8b1d('0x44')]);_0x55ba94['attributes']=_['intersection'](_0x2937d3[_0x8b1d('0x42')],qs[_0x8b1d('0x47')](_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x47')]));_0x55ba94[_0x8b1d('0x48')]=_0x55ba94[_0x8b1d('0x48')][_0x8b1d('0x49')]?_0x55ba94['attributes']:_0x2937d3[_0x8b1d('0x42')];if(!_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x4a')](_0x8b1d('0x4b'))){_0x55ba94[_0x8b1d('0x4c')]=qs[_0x8b1d('0x4c')](_0x401d56['query'][_0x8b1d('0x4c')]);_0x55ba94['offset']=qs[_0x8b1d('0x2f')](_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x2f')]);}_0x55ba94[_0x8b1d('0x4d')]=qs[_0x8b1d('0x4e')](_0x401d56[_0x8b1d('0x44')]['sort']);_0x55ba94[_0x8b1d('0x4f')]=qs['filters'](_[_0x8b1d('0x50')](_0x401d56[_0x8b1d('0x44')],_0x2937d3[_0x8b1d('0x45')]),_0x5bae41);if(_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x51')]){_0x55ba94[_0x8b1d('0x4f')]=_[_0x8b1d('0x52')](_0x55ba94[_0x8b1d('0x4f')],{'$or':_[_0x8b1d('0x43')](_0x5bae41,function(_0x1b4472){if(_0x1b4472[_0x8b1d('0x40')]!=='VIRTUAL'){var _0x3e5b0f={};_0x3e5b0f[_0x1b4472[_0x8b1d('0x3b')]]={'$like':'%'+_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x51')]+'%'};return _0x3e5b0f;}})});}_0x55ba94=_[_0x8b1d('0x52')]({},_0x55ba94,_0x401d56['options']);var _0x2f61ce={'where':_0x55ba94[_0x8b1d('0x4f')]};return db[_0x8b1d('0x3d')][_0x8b1d('0x31')](_0x2f61ce)[_0x8b1d('0x38')](function(_0x39c5a5){_0x5523f9[_0x8b1d('0x31')]=_0x39c5a5;if(_0x401d56[_0x8b1d('0x44')][_0x8b1d('0x53')]){_0x55ba94[_0x8b1d('0x54')]=[{'all':!![]}];}return db[_0x8b1d('0x3d')][_0x8b1d('0x55')](_0x55ba94);})[_0x8b1d('0x38')](function(_0x482830){_0x5523f9[_0x8b1d('0x56')]=_0x482830;return _0x5523f9;})[_0x8b1d('0x38')](respondWithFilteredResult(_0x52cdd8,_0x55ba94))['catch'](handleError(_0x52cdd8,null));};exports[_0x8b1d('0x57')]=function(_0x420cbf,_0x64d5a0){var _0x417e42={'raw':!![],'where':{'id':_0x420cbf[_0x8b1d('0x58')]['id']}},_0x3eb732={};_0x3eb732[_0x8b1d('0x42')]=_['keys'](db[_0x8b1d('0x3d')][_0x8b1d('0x3e')]);_0x3eb732[_0x8b1d('0x44')]=_[_0x8b1d('0x59')](_0x420cbf[_0x8b1d('0x44')]);_0x3eb732[_0x8b1d('0x45')]=_['intersection'](_0x3eb732[_0x8b1d('0x42')],_0x3eb732[_0x8b1d('0x44')]);_0x417e42[_0x8b1d('0x48')]=_[_0x8b1d('0x46')](_0x3eb732['model'],qs[_0x8b1d('0x47')](_0x420cbf[_0x8b1d('0x44')][_0x8b1d('0x47')]));_0x417e42[_0x8b1d('0x48')]=_0x417e42[_0x8b1d('0x48')]['length']?_0x417e42[_0x8b1d('0x48')]:_0x3eb732['model'];if(_0x420cbf['query'][_0x8b1d('0x53')]){_0x417e42['include']=[{'all':!![]}];}_0x417e42=_['merge']({},_0x417e42,_0x420cbf['options']);return db[_0x8b1d('0x3d')][_0x8b1d('0x5a')](_0x417e42)[_0x8b1d('0x38')](handleEntityNotFound(_0x64d5a0,null))[_0x8b1d('0x38')](respondWithResult(_0x64d5a0,null))[_0x8b1d('0x2c')](handleError(_0x64d5a0,null));};exports['create']=function(_0x41746e,_0x1fbf1d){return db[_0x8b1d('0x3d')][_0x8b1d('0x5b')](_0x41746e['body'],{})[_0x8b1d('0x38')](respondWithResult(_0x1fbf1d,0xc9))['catch'](handleError(_0x1fbf1d,null));};exports[_0x8b1d('0x37')]=function(_0x49eb62,_0x2a3ebb){if(_0x49eb62['body']['id']){delete _0x49eb62['body']['id'];}return db[_0x8b1d('0x3d')][_0x8b1d('0x5a')]({'where':{'id':_0x49eb62['params']['id']}})[_0x8b1d('0x38')](handleEntityNotFound(_0x2a3ebb,null))[_0x8b1d('0x38')](saveUpdates(_0x49eb62[_0x8b1d('0x5c')],null))['then'](respondWithResult(_0x2a3ebb,null))[_0x8b1d('0x2c')](handleError(_0x2a3ebb,null));};exports['destroy']=function(_0x5dda9f,_0x56af30){return db[_0x8b1d('0x3d')][_0x8b1d('0x5a')]({'where':{'id':_0x5dda9f[_0x8b1d('0x58')]['id']}})[_0x8b1d('0x38')](handleEntityNotFound(_0x56af30,null))['then'](removeEntity(_0x56af30,null))['catch'](handleError(_0x56af30,null));};exports[_0x8b1d('0x5d')]=function(_0x23b191,_0x47530e){return db[_0x8b1d('0x3d')][_0x8b1d('0x5d')]()[_0x8b1d('0x38')](respondWithResult(_0x47530e,null))['catch'](handleError(_0x47530e,null));};var interaction_log=require('../../config/logger')(_0x8b1d('0x5e'));exports[_0x8b1d('0x5f')]=function(_0x5c35dd,_0x5b215d,_0x3e42cb){var _0x51f736={'agent':{},'channel':_0x8b1d('0x60')};if(_0x5c35dd['body']['id']){delete _0x5c35dd[_0x8b1d('0x5c')]['id'];}_0x5c35dd[_0x8b1d('0x5c')]['read']=!![];_0x5c35dd[_0x8b1d('0x5c')]['readAt']=moment()[_0x8b1d('0x61')](_0x8b1d('0x62'));_0x5c35dd['body'][_0x8b1d('0x63')]=_0x5c35dd[_0x8b1d('0x5c')][_0x8b1d('0x63')]||_0x5c35dd['user']['id'];_0x51f736[_0x8b1d('0x64')]['id']=_0x5c35dd[_0x8b1d('0x5c')][_0x8b1d('0x63')];return db[_0x8b1d('0x3d')][_0x8b1d('0x5a')]({'where':{'id':_0x5c35dd[_0x8b1d('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b215d,null))['then'](saveUpdates(_0x5c35dd[_0x8b1d('0x5c')],null))[_0x8b1d('0x38')](function(_0xc82f01){if(_0xc82f01){_0x51f736[_0x8b1d('0x2a')]=_0xc82f01['get']({'plain':!![]});return db['SmsInteraction'][_0x8b1d('0x5a')]({'where':{'id':_0xc82f01[_0x8b1d('0x65')]}});}return null;})[_0x8b1d('0x38')](handleEntityNotFound(_0x5b215d,null))[_0x8b1d('0x38')](function(_0x11367b){if(_0x11367b){return _0x11367b[_0x8b1d('0x37')]({'UserId':_0x5c35dd['body'][_0x8b1d('0x63')],'read1stAt':_[_0x8b1d('0x66')](_0x11367b[_0x8b1d('0x67')])?moment()[_0x8b1d('0x61')](_0x8b1d('0x62')):undefined});}return null;})[_0x8b1d('0x38')](function(_0x1ce1ea){if(_0x1ce1ea){_0x51f736[_0x8b1d('0x68')]=_0x1ce1ea[_0x8b1d('0x69')]({'plain':!![]});interaction_log[_0x8b1d('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c35dd[_0x8b1d('0x6a')]['id'],_0x5c35dd[_0x8b1d('0x6a')][_0x8b1d('0x3b')],_0x5c35dd[_0x8b1d('0x6a')][_0x8b1d('0x6b')],_0x51f736[_0x8b1d('0x68')]['id'],_0x5c35dd['body']?JSON['stringify'](_0x5c35dd['body']):'null');return respondWithRpcPromise(_0x8b1d('0x6c'),_0x8b1d('0x6d'),_0x51f736);}return null;})[_0x8b1d('0x38')](function(_0x559a64){var _0x3ef68a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x559a64[_0x8b1d('0x2a')][_0x8b1d('0x6e')];return db[_0x8b1d('0x6f')][_0x8b1d('0x44')](_0x3ef68a,{'type':db['Sequelize'][_0x8b1d('0x70')][_0x8b1d('0x71')],'raw':!![]})[_0x8b1d('0x38')](function(_0xe5a9b){return _0xe5a9b;});})[_0x8b1d('0x38')](function(_0x5d0cd4){if(_0x5d0cd4){_0x51f736['message'][_0x8b1d('0x72')]=_0x5d0cd4[0x0];if(!_0x5c35dd['body']['UserId'])return;return db['User'][_0x8b1d('0x5a')]({'where':{'id':_0x5c35dd[_0x8b1d('0x5c')][_0x8b1d('0x63')],'role':'agent'},'attributes':['id','name',_0x8b1d('0x73'),_0x8b1d('0x74'),_0x8b1d('0x75')],'raw':!![]});}return null;})[_0x8b1d('0x38')](function(_0x2f0fde){if(!_0x2f0fde)return null;_0x51f736[_0x8b1d('0x2a')][_0x8b1d('0x64')]=_0x2f0fde;return _0x51f736;})[_0x8b1d('0x38')](function(_0x2ba15f){if(_0x2ba15f){if(_0x5c35dd[_0x8b1d('0x5c')][_0x8b1d('0x76')]){_0x51f736['message'][_0x8b1d('0x77')]=util[_0x8b1d('0x61')](_0x8b1d('0x78'),_0x5c35dd[_0x8b1d('0x6a')][_0x8b1d('0x3b')]);_0x51f736['message'][_0x8b1d('0x79')]=_0x51f736[_0x8b1d('0x79')];_0x51f736['message'][_0x8b1d('0x7a')]=_0x51f736['channel'];_0x51f736[_0x8b1d('0x2a')][_0x8b1d('0x7b')]=_0x8b1d('0x5f');return respondWithRpcPromise(_0x8b1d('0x7c'),_0x8b1d('0x7c'),{'event':'acceptmessage','message':_0x51f736[_0x8b1d('0x2a')]},client9002)[_0x8b1d('0x38')](function(){return _0x51f736;});}return _0x51f736;}return null;})[_0x8b1d('0x38')](respondWithResult(_0x5b215d,null))['catch'](handleError(_0x5b215d,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x8b1d('0x36')]=function(_0xa0bb05,_0x7d5dcf,_0x23e116){var _0x209207={'agent':{},'channel':_0x8b1d('0x60')};if(_0xa0bb05['body']['id']){delete _0xa0bb05['body']['id'];}_0xa0bb05[_0x8b1d('0x5c')][_0x8b1d('0x63')]=_0xa0bb05[_0x8b1d('0x5c')][_0x8b1d('0x63')]||_0xa0bb05[_0x8b1d('0x6a')]['id'];_0x209207['agent']['id']=_0xa0bb05[_0x8b1d('0x5c')]['UserId'];return db[_0x8b1d('0x3d')]['find']({'where':{'id':_0xa0bb05[_0x8b1d('0x58')]['id'],'UserId':null}})[_0x8b1d('0x38')](handleEntityNotFound(_0x7d5dcf,null))['then'](function(_0x24b77c){if(_0x24b77c){_0x209207[_0x8b1d('0x2a')]=_0x24b77c[_0x8b1d('0x69')]({'plain':!![]});return db[_0x8b1d('0x7d')][_0x8b1d('0x5a')]({'where':{'id':_0x24b77c[_0x8b1d('0x65')]}});}return null;})[_0x8b1d('0x38')](handleEntityNotFound(_0x7d5dcf,null))[_0x8b1d('0x38')](function(_0x3be79f){if(_0x3be79f){_0x209207['interaction']=_0x3be79f[_0x8b1d('0x69')]({'plain':!![]});interaction_log[_0x8b1d('0x24')](_0x8b1d('0x7e'),_0xa0bb05[_0x8b1d('0x6a')]['id'],_0xa0bb05[_0x8b1d('0x6a')]['name'],_0xa0bb05['user'][_0x8b1d('0x6b')],_0x209207[_0x8b1d('0x68')]['id'],_0xa0bb05['body']?JSON[_0x8b1d('0x7f')](_0xa0bb05[_0x8b1d('0x5c')]):'null');return respondWithRpcPromise(_0x8b1d('0x80'),_0x8b1d('0x81'),_0x209207);}return null;})[_0x8b1d('0x38')](function(_0x53293c){var _0x2ac7e5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53293c['message'][_0x8b1d('0x6e')];return db[_0x8b1d('0x6f')]['query'](_0x2ac7e5,{'type':db[_0x8b1d('0x82')][_0x8b1d('0x70')][_0x8b1d('0x71')],'raw':!![]})[_0x8b1d('0x38')](function(_0x460eac){return _0x460eac;});})['then'](function(_0x326c62){if(_0x326c62){_0x209207['message'][_0x8b1d('0x72')]=_0x326c62[0x0];if(!_0xa0bb05[_0x8b1d('0x5c')][_0x8b1d('0x63')])return;return db[_0x8b1d('0x83')][_0x8b1d('0x5a')]({'where':{'id':_0xa0bb05[_0x8b1d('0x5c')][_0x8b1d('0x63')],'role':'agent'},'attributes':['id',_0x8b1d('0x3b'),_0x8b1d('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x8b1d('0x38')](function(_0x414e08){if(!_0x414e08)return null;_0x209207[_0x8b1d('0x2a')]['agent']=_0x414e08;return _0x209207;})[_0x8b1d('0x38')](function(_0x6fe04){if(_0x6fe04){_0x6fe04[_0x8b1d('0x2a')]['interface']=util['format'](_0x8b1d('0x78'),_0xa0bb05[_0x8b1d('0x6a')][_0x8b1d('0x3b')]);_0x6fe04[_0x8b1d('0x2a')][_0x8b1d('0x79')]=_0x209207[_0x8b1d('0x79')];_0x6fe04[_0x8b1d('0x2a')][_0x8b1d('0x7a')]=_0x209207[_0x8b1d('0x79')];_0x6fe04['message']['event']=_0x8b1d('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x8b1d('0x84'),'message':_0x6fe04[_0x8b1d('0x2a')]},client9002);return _0x209207;}return null;})['then'](respondWithResult(_0x7d5dcf,null))[_0x8b1d('0x2c')](handleError(_0x7d5dcf,null));};exports[_0x8b1d('0x32')]=function(_0x4e4fcb,_0x3d2924,_0x18b1cc){if(_0x4e4fcb['body']['id']){delete _0x4e4fcb[_0x8b1d('0x5c')]['id'];}var _0x240a7a;return db[_0x8b1d('0x3d')][_0x8b1d('0x5a')]({'where':{'id':_0x4e4fcb[_0x8b1d('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d2924,null))[_0x8b1d('0x38')](function(_0x1fcee9){if(_0x1fcee9){_0x240a7a=_0x1fcee9;return db['SmsAccount'][_0x8b1d('0x5a')]({'where':{'id':_0x1fcee9[_0x8b1d('0x85')]}});}})['then'](handleEntityNotFound(_0x3d2924,null))['then'](function(_0x24558f){if(_0x24558f){logger[_0x8b1d('0x27')](_0x8b1d('0x28'),_0x8b1d('0x32'),_0x8b1d('0x86'),_0x24558f[_0x8b1d('0x40')],util[_0x8b1d('0x87')](_0x4e4fcb[_0x8b1d('0x5c')],{'showHidden':![],'depth':null}));switch(_0x24558f[_0x8b1d('0x40')]){case _0x8b1d('0x88'):if(_0x4e4fcb[_0x8b1d('0x5c')][_0x8b1d('0x89')]&&_0x4e4fcb['body']['MessageSid']===_0x240a7a[_0x8b1d('0x8a')]){return _0x240a7a['update']({'read':!![]});}else{logger[_0x8b1d('0x29')](_0x8b1d('0x8b'),'status',_0x8b1d('0x88'),util['inspect'](_0x4e4fcb[_0x8b1d('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4e4fcb[_0x8b1d('0x5c')]['MessageUUID']&&_0x4e4fcb[_0x8b1d('0x5c')][_0x8b1d('0x8c')]===_0x240a7a['messageId']&&_[_0x8b1d('0x8d')]([_0x8b1d('0x8e'),_0x8b1d('0x8f')],_0x4e4fcb[_0x8b1d('0x5c')][_0x8b1d('0x90')])>=0x0){return _0x240a7a[_0x8b1d('0x37')]({'read':!![]});}else{logger[_0x8b1d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8b1d('0x32'),_0x8b1d('0x91'),util['inspect'](_0x4e4fcb[_0x8b1d('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x59ba0c=_0x4e4fcb[_0x8b1d('0x5c')][_0x8b1d('0x92')][0x0];if(_0x59ba0c[_0x8b1d('0x32')][_0x8b1d('0x93')]===_0x8b1d('0x94')){return _0x240a7a[_0x8b1d('0x37')]({'read':!![]});}else{logger[_0x8b1d('0x29')](_0x8b1d('0x8b'),_0x8b1d('0x32'),_0x8b1d('0x95'),util['inspect'](_0x4e4fcb[_0x8b1d('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x240a7a;}})['then'](respondWithResult(_0x3d2924,null))[_0x8b1d('0x2c')](handleError(_0x3d2924,null));}; \ No newline at end of file +var _0xdf55=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','SmsMessage','includeAll','include','rows','catch','show','params','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdf55,0x83));var _0x5df5=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0xdf55[_0x3ccac1];return _0x10b20b;};'use strict';var emlformat=require(_0x5df5('0x0'));var rimraf=require(_0x5df5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5df5('0x2'));var rp=require(_0x5df5('0x3'));var moment=require('moment');var BPromise=require(_0x5df5('0x4'));var Mustache=require(_0x5df5('0x5'));var util=require(_0x5df5('0x6'));var path=require('path');var sox=require(_0x5df5('0x7'));var csv=require(_0x5df5('0x8'));var ejs=require(_0x5df5('0x9'));var fs=require('fs');var fs_extra=require(_0x5df5('0xa'));var _=require(_0x5df5('0xb'));var squel=require(_0x5df5('0xc'));var crypto=require(_0x5df5('0xd'));var jsforce=require(_0x5df5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df5('0x8'));var querystring=require(_0x5df5('0xf'));var Papa=require(_0x5df5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5df5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df5('0x12'));var logger=require(_0x5df5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df5('0x14'));var licenseUtil=require(_0x5df5('0x15'));var db=require(_0x5df5('0x16'))['db'];config[_0x5df5('0x17')]=_[_0x5df5('0x18')](config[_0x5df5('0x17')],{'host':_0x5df5('0x19'),'port':0x18eb});var socket=require(_0x5df5('0x1a'))(new Redis(config[_0x5df5('0x17')]));require(_0x5df5('0x1b'))['register'](socket);var jayson=require(_0x5df5('0x1c'));var client=jayson['client'][_0x5df5('0x1d')]({'port':0x232c});var client9002=jayson[_0x5df5('0x1e')][_0x5df5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3657c8,_0x282d53,_0x4e74c4,_0x27b3fb){return new BPromise(function(_0x457205,_0x591a19){var _0x9a52c9=_0x27b3fb||client;return _0x9a52c9[_0x5df5('0x1f')](_0x3657c8,_0x4e74c4)[_0x5df5('0x20')](function(_0x44f700){logger[_0x5df5('0x21')]('SmsMessage,\x20%s,\x20%s',_0x282d53,'request\x20sent');logger[_0x5df5('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x282d53,_0x5df5('0x23'),JSON[_0x5df5('0x24')](_0x44f700));if(_0x44f700[_0x5df5('0x25')]){if(_0x44f700[_0x5df5('0x25')][_0x5df5('0x26')]===0x1f4){logger['error'](_0x5df5('0x27'),_0x282d53,_0x44f700[_0x5df5('0x25')][_0x5df5('0x28')]);return _0x591a19(_0x44f700[_0x5df5('0x25')][_0x5df5('0x28')]);}logger[_0x5df5('0x25')]('SmsMessage,\x20%s,\x20%s',_0x282d53,_0x44f700[_0x5df5('0x25')][_0x5df5('0x28')]);return _0x457205(_0x44f700[_0x5df5('0x25')][_0x5df5('0x28')]);}else{logger['info'](_0x5df5('0x27'),_0x282d53,_0x5df5('0x23'));_0x457205(_0x44f700[_0x5df5('0x29')]['message']);}})['catch'](function(_0x532923){logger[_0x5df5('0x25')](_0x5df5('0x27'),_0x282d53,_0x532923);_0x591a19(_0x532923);});});}function respondWithStatusCode(_0x4292a0,_0xa7f4b3){_0xa7f4b3=_0xa7f4b3||0xcc;return function(_0x1baf52){if(_0x1baf52){return _0x4292a0[_0x5df5('0x2a')](_0xa7f4b3);}return _0x4292a0[_0x5df5('0x2b')](_0xa7f4b3)[_0x5df5('0x2c')]();};}function respondWithResult(_0x52fbe3,_0x18bb61){_0x18bb61=_0x18bb61||0xc8;return function(_0x4fc1a1){if(_0x4fc1a1){return _0x52fbe3[_0x5df5('0x2b')](_0x18bb61)[_0x5df5('0x2d')](_0x4fc1a1);}};}function respondWithFilteredResult(_0x5bc181,_0x3854d0){return function(_0x4945c6){if(_0x4945c6){var _0xd2b213=typeof _0x3854d0['offset']===_0x5df5('0x2e')&&typeof _0x3854d0['limit']===_0x5df5('0x2e');var _0x5793f5=_0x4945c6[_0x5df5('0x2f')];var _0x47bebb=_0xd2b213?0x0:_0x3854d0[_0x5df5('0x30')];var _0x485484=_0xd2b213?_0x4945c6[_0x5df5('0x2f')]:_0x3854d0[_0x5df5('0x30')]+_0x3854d0[_0x5df5('0x31')];var _0x2d53e5;if(_0x485484>=_0x5793f5){_0x485484=_0x5793f5;_0x2d53e5=0xc8;}else{_0x2d53e5=0xce;}_0x5bc181[_0x5df5('0x2b')](_0x2d53e5);return _0x5bc181[_0x5df5('0x32')](_0x5df5('0x33'),_0x47bebb+'-'+_0x485484+'/'+_0x5793f5)['json'](_0x4945c6);}return null;};}function patchUpdates(_0x4965a0){return function(_0x3275e9){try{jsonpatch[_0x5df5('0x34')](_0x3275e9,_0x4965a0,!![]);}catch(_0x3bbd2b){return BPromise[_0x5df5('0x35')](_0x3bbd2b);}return _0x3275e9[_0x5df5('0x36')]();};}function saveUpdates(_0x2decd5,_0x4989a4){return function(_0x14218e){if(_0x14218e){return _0x14218e[_0x5df5('0x37')](_0x2decd5)[_0x5df5('0x20')](function(_0x3a6b75){return _0x3a6b75;});}return null;};}function removeEntity(_0x5e8d50,_0x14ee6b){return function(_0x4e7561){if(_0x4e7561){return _0x4e7561[_0x5df5('0x38')]()[_0x5df5('0x20')](function(){_0x5e8d50['status'](0xcc)[_0x5df5('0x2c')]();});}};}function handleEntityNotFound(_0x59e9d6,_0x151e4c){return function(_0x44a6d9){if(!_0x44a6d9){_0x59e9d6[_0x5df5('0x2a')](0x194);}return _0x44a6d9;};}function handleError(_0x120eaf,_0x54e822){_0x54e822=_0x54e822||0x1f4;return function(_0x1d8e49){logger[_0x5df5('0x25')](_0x1d8e49[_0x5df5('0x39')]);if(_0x1d8e49[_0x5df5('0x3a')]){delete _0x1d8e49['name'];}_0x120eaf[_0x5df5('0x2b')](_0x54e822)[_0x5df5('0x3b')](_0x1d8e49);};}exports[_0x5df5('0x3c')]=function(_0x18b597,_0x46c501){var _0x47f34f={},_0x25c8b3={},_0x560422={'count':0x0,'rows':[]};var _0x33da21=_[_0x5df5('0x3d')](db['SmsMessage'][_0x5df5('0x3e')],function(_0x217844){return{'name':_0x217844['fieldName'],'type':_0x217844[_0x5df5('0x3f')][_0x5df5('0x40')]};});_0x25c8b3[_0x5df5('0x41')]=_[_0x5df5('0x3d')](_0x33da21,_0x5df5('0x3a'));_0x25c8b3[_0x5df5('0x42')]=_[_0x5df5('0x43')](_0x18b597[_0x5df5('0x42')]);_0x25c8b3['filters']=_['intersection'](_0x25c8b3[_0x5df5('0x41')],_0x25c8b3['query']);_0x47f34f[_0x5df5('0x44')]=_[_0x5df5('0x45')](_0x25c8b3['model'],qs[_0x5df5('0x46')](_0x18b597[_0x5df5('0x42')][_0x5df5('0x46')]));_0x47f34f[_0x5df5('0x44')]=_0x47f34f[_0x5df5('0x44')][_0x5df5('0x47')]?_0x47f34f[_0x5df5('0x44')]:_0x25c8b3[_0x5df5('0x41')];if(!_0x18b597['query'][_0x5df5('0x48')]('nolimit')){_0x47f34f[_0x5df5('0x31')]=qs[_0x5df5('0x31')](_0x18b597[_0x5df5('0x42')][_0x5df5('0x31')]);_0x47f34f[_0x5df5('0x30')]=qs['offset'](_0x18b597[_0x5df5('0x42')][_0x5df5('0x30')]);}_0x47f34f[_0x5df5('0x49')]=qs['sort'](_0x18b597[_0x5df5('0x42')][_0x5df5('0x4a')]);_0x47f34f['where']=qs[_0x5df5('0x4b')](_[_0x5df5('0x4c')](_0x18b597[_0x5df5('0x42')],_0x25c8b3[_0x5df5('0x4b')]),_0x33da21);if(_0x18b597['query'][_0x5df5('0x4d')]){_0x47f34f[_0x5df5('0x4e')]=_['merge'](_0x47f34f[_0x5df5('0x4e')],{'$or':_[_0x5df5('0x3d')](_0x33da21,function(_0x35927b){if(_0x35927b['type']!==_0x5df5('0x4f')){var _0x3842d0={};_0x3842d0[_0x35927b[_0x5df5('0x3a')]]={'$like':'%'+_0x18b597[_0x5df5('0x42')]['filter']+'%'};return _0x3842d0;}})});}_0x47f34f=_[_0x5df5('0x50')]({},_0x47f34f,_0x18b597[_0x5df5('0x51')]);var _0x2eb30e={'where':_0x47f34f[_0x5df5('0x4e')]};return db[_0x5df5('0x52')]['count'](_0x2eb30e)['then'](function(_0x9e2e75){_0x560422['count']=_0x9e2e75;if(_0x18b597[_0x5df5('0x42')][_0x5df5('0x53')]){_0x47f34f[_0x5df5('0x54')]=[{'all':!![]}];}return db[_0x5df5('0x52')]['findAll'](_0x47f34f);})[_0x5df5('0x20')](function(_0x31483f){_0x560422[_0x5df5('0x55')]=_0x31483f;return _0x560422;})[_0x5df5('0x20')](respondWithFilteredResult(_0x46c501,_0x47f34f))[_0x5df5('0x56')](handleError(_0x46c501,null));};exports[_0x5df5('0x57')]=function(_0x5ad720,_0x1bf1e2){var _0x51fd67={'raw':!![],'where':{'id':_0x5ad720[_0x5df5('0x58')]['id']}},_0x279f6b={};_0x279f6b[_0x5df5('0x41')]=_['keys'](db[_0x5df5('0x52')]['rawAttributes']);_0x279f6b[_0x5df5('0x42')]=_['keys'](_0x5ad720[_0x5df5('0x42')]);_0x279f6b[_0x5df5('0x4b')]=_[_0x5df5('0x45')](_0x279f6b['model'],_0x279f6b[_0x5df5('0x42')]);_0x51fd67[_0x5df5('0x44')]=_['intersection'](_0x279f6b[_0x5df5('0x41')],qs[_0x5df5('0x46')](_0x5ad720[_0x5df5('0x42')][_0x5df5('0x46')]));_0x51fd67[_0x5df5('0x44')]=_0x51fd67[_0x5df5('0x44')][_0x5df5('0x47')]?_0x51fd67['attributes']:_0x279f6b[_0x5df5('0x41')];if(_0x5ad720['query'][_0x5df5('0x53')]){_0x51fd67[_0x5df5('0x54')]=[{'all':!![]}];}_0x51fd67=_[_0x5df5('0x50')]({},_0x51fd67,_0x5ad720[_0x5df5('0x51')]);return db[_0x5df5('0x52')][_0x5df5('0x59')](_0x51fd67)[_0x5df5('0x20')](handleEntityNotFound(_0x1bf1e2,null))[_0x5df5('0x20')](respondWithResult(_0x1bf1e2,null))['catch'](handleError(_0x1bf1e2,null));};exports[_0x5df5('0x5a')]=function(_0xdfd74,_0x151af5){return db[_0x5df5('0x52')][_0x5df5('0x5a')](_0xdfd74['body'],{})[_0x5df5('0x20')](respondWithResult(_0x151af5,0xc9))['catch'](handleError(_0x151af5,null));};exports['update']=function(_0x3c05b2,_0x3c7d5e){if(_0x3c05b2[_0x5df5('0x5b')]['id']){delete _0x3c05b2[_0x5df5('0x5b')]['id'];}return db[_0x5df5('0x52')][_0x5df5('0x59')]({'where':{'id':_0x3c05b2['params']['id']}})[_0x5df5('0x20')](handleEntityNotFound(_0x3c7d5e,null))[_0x5df5('0x20')](saveUpdates(_0x3c05b2['body'],null))['then'](respondWithResult(_0x3c7d5e,null))[_0x5df5('0x56')](handleError(_0x3c7d5e,null));};exports[_0x5df5('0x38')]=function(_0x9a168c,_0x4672c5){return db[_0x5df5('0x52')][_0x5df5('0x59')]({'where':{'id':_0x9a168c['params']['id']}})['then'](handleEntityNotFound(_0x4672c5,null))['then'](removeEntity(_0x4672c5,null))[_0x5df5('0x56')](handleError(_0x4672c5,null));};exports[_0x5df5('0x5c')]=function(_0x57e3ea,_0x42288c){return db[_0x5df5('0x52')][_0x5df5('0x5c')]()[_0x5df5('0x20')](respondWithResult(_0x42288c,null))[_0x5df5('0x56')](handleError(_0x42288c,null));};var interaction_log=require(_0x5df5('0x13'))(_0x5df5('0x5d'));exports[_0x5df5('0x5e')]=function(_0x463268,_0x59ecf7,_0x302792){var _0x10286e={'agent':{},'channel':_0x5df5('0x5f')};if(_0x463268[_0x5df5('0x5b')]['id']){delete _0x463268[_0x5df5('0x5b')]['id'];}_0x463268[_0x5df5('0x5b')][_0x5df5('0x60')]=!![];_0x463268[_0x5df5('0x5b')][_0x5df5('0x61')]=moment()[_0x5df5('0x62')](_0x5df5('0x63'));_0x463268[_0x5df5('0x5b')]['UserId']=_0x463268[_0x5df5('0x5b')][_0x5df5('0x64')]||_0x463268['user']['id'];_0x10286e[_0x5df5('0x65')]['id']=_0x463268[_0x5df5('0x5b')][_0x5df5('0x64')];return db[_0x5df5('0x52')]['find']({'where':{'id':_0x463268[_0x5df5('0x58')]['id'],'UserId':null}})[_0x5df5('0x20')](handleEntityNotFound(_0x59ecf7,null))['then'](saveUpdates(_0x463268['body'],null))[_0x5df5('0x20')](function(_0x21b665){if(_0x21b665){_0x10286e[_0x5df5('0x28')]=_0x21b665['get']({'plain':!![]});return db['SmsInteraction'][_0x5df5('0x59')]({'where':{'id':_0x21b665[_0x5df5('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x59ecf7,null))[_0x5df5('0x20')](function(_0x1b3785){if(_0x1b3785){return _0x1b3785[_0x5df5('0x37')]({'UserId':_0x463268[_0x5df5('0x5b')][_0x5df5('0x64')],'read1stAt':_['isNil'](_0x1b3785[_0x5df5('0x67')])?moment()[_0x5df5('0x62')](_0x5df5('0x63')):undefined});}return null;})[_0x5df5('0x20')](function(_0x4e6e48){if(_0x4e6e48){_0x10286e[_0x5df5('0x68')]=_0x4e6e48['get']({'plain':!![]});interaction_log[_0x5df5('0x21')](_0x5df5('0x69'),_0x463268['user']['id'],_0x463268[_0x5df5('0x6a')]['name'],_0x463268[_0x5df5('0x6a')]['role'],_0x10286e[_0x5df5('0x68')]['id'],_0x463268[_0x5df5('0x5b')]?JSON[_0x5df5('0x24')](_0x463268[_0x5df5('0x5b')]):_0x5df5('0x6b'));return respondWithRpcPromise(_0x5df5('0x6c'),'acceptMessage',_0x10286e);}return null;})[_0x5df5('0x20')](function(_0x643ee9){var _0x30a019='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x643ee9[_0x5df5('0x28')][_0x5df5('0x6d')];return db[_0x5df5('0x6e')][_0x5df5('0x42')](_0x30a019,{'type':db[_0x5df5('0x6f')][_0x5df5('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x4160f4){return _0x4160f4;});})[_0x5df5('0x20')](function(_0x3d1df1){if(_0x3d1df1){_0x10286e[_0x5df5('0x28')][_0x5df5('0x71')]=_0x3d1df1[0x0];if(!_0x463268['body'][_0x5df5('0x64')])return;return db[_0x5df5('0x72')][_0x5df5('0x59')]({'where':{'id':_0x463268['body'][_0x5df5('0x64')],'role':_0x5df5('0x65')},'attributes':['id',_0x5df5('0x3a'),_0x5df5('0x73'),_0x5df5('0x74'),_0x5df5('0x75')],'raw':!![]});}return null;})[_0x5df5('0x20')](function(_0xec54b7){if(!_0xec54b7)return null;_0x10286e[_0x5df5('0x28')]['agent']=_0xec54b7;return _0x10286e;})[_0x5df5('0x20')](function(_0xc67e6d){if(_0xc67e6d){if(_0x463268[_0x5df5('0x5b')]['manual']){_0x10286e[_0x5df5('0x28')][_0x5df5('0x76')]=util['format'](_0x5df5('0x77'),_0x463268[_0x5df5('0x6a')][_0x5df5('0x3a')]);_0x10286e['message'][_0x5df5('0x78')]=_0x10286e['channel'];_0x10286e[_0x5df5('0x28')][_0x5df5('0x79')]=_0x10286e[_0x5df5('0x78')];_0x10286e[_0x5df5('0x28')][_0x5df5('0x7a')]=_0x5df5('0x5e');return respondWithRpcPromise('EventManager',_0x5df5('0x7b'),{'event':_0x5df5('0x7c'),'message':_0x10286e['message']},client9002)[_0x5df5('0x20')](function(){return _0x10286e;});}return _0x10286e;}return null;})['then'](respondWithResult(_0x59ecf7,null))['catch'](handleError(_0x59ecf7,null));};var interaction_log=require(_0x5df5('0x13'))('sms-interactions');exports[_0x5df5('0x35')]=function(_0x19c839,_0x311dc0,_0x1f3f81){var _0x453238={'agent':{},'channel':_0x5df5('0x5f')};if(_0x19c839['body']['id']){delete _0x19c839[_0x5df5('0x5b')]['id'];}_0x19c839[_0x5df5('0x5b')][_0x5df5('0x64')]=_0x19c839['body'][_0x5df5('0x64')]||_0x19c839[_0x5df5('0x6a')]['id'];_0x453238['agent']['id']=_0x19c839[_0x5df5('0x5b')][_0x5df5('0x64')];return db[_0x5df5('0x52')][_0x5df5('0x59')]({'where':{'id':_0x19c839[_0x5df5('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x311dc0,null))[_0x5df5('0x20')](function(_0x563f22){if(_0x563f22){_0x453238[_0x5df5('0x28')]=_0x563f22['get']({'plain':!![]});return db[_0x5df5('0x7d')][_0x5df5('0x59')]({'where':{'id':_0x563f22[_0x5df5('0x66')]}});}return null;})[_0x5df5('0x20')](handleEntityNotFound(_0x311dc0,null))[_0x5df5('0x20')](function(_0x53ead8){if(_0x53ead8){_0x453238['interaction']=_0x53ead8[_0x5df5('0x7e')]({'plain':!![]});interaction_log[_0x5df5('0x21')](_0x5df5('0x7f'),_0x19c839[_0x5df5('0x6a')]['id'],_0x19c839[_0x5df5('0x6a')]['name'],_0x19c839[_0x5df5('0x6a')][_0x5df5('0x80')],_0x453238[_0x5df5('0x68')]['id'],_0x19c839[_0x5df5('0x5b')]?JSON[_0x5df5('0x24')](_0x19c839[_0x5df5('0x5b')]):_0x5df5('0x6b'));return respondWithRpcPromise(_0x5df5('0x81'),_0x5df5('0x82'),_0x453238);}return null;})[_0x5df5('0x20')](function(_0x1bff6c){var _0x535fee='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1bff6c['message'][_0x5df5('0x6d')];return db[_0x5df5('0x6e')]['query'](_0x535fee,{'type':db[_0x5df5('0x6f')][_0x5df5('0x70')][_0x5df5('0x83')],'raw':!![]})[_0x5df5('0x20')](function(_0x7a8c7d){return _0x7a8c7d;});})[_0x5df5('0x20')](function(_0x36d8ee){if(_0x36d8ee){_0x453238['message'][_0x5df5('0x71')]=_0x36d8ee[0x0];if(!_0x19c839[_0x5df5('0x5b')][_0x5df5('0x64')])return;return db[_0x5df5('0x72')][_0x5df5('0x59')]({'where':{'id':_0x19c839[_0x5df5('0x5b')][_0x5df5('0x64')],'role':'agent'},'attributes':['id',_0x5df5('0x3a'),_0x5df5('0x73'),_0x5df5('0x74'),_0x5df5('0x75')],'raw':!![]});}return null;})[_0x5df5('0x20')](function(_0x41110a){if(!_0x41110a)return null;_0x453238[_0x5df5('0x28')][_0x5df5('0x65')]=_0x41110a;return _0x453238;})['then'](function(_0x4594d2){if(_0x4594d2){_0x4594d2[_0x5df5('0x28')]['interface']=util[_0x5df5('0x62')](_0x5df5('0x77'),_0x19c839[_0x5df5('0x6a')][_0x5df5('0x3a')]);_0x4594d2[_0x5df5('0x28')]['channel']=_0x453238[_0x5df5('0x78')];_0x4594d2[_0x5df5('0x28')][_0x5df5('0x79')]=_0x453238['channel'];_0x4594d2['message'][_0x5df5('0x7a')]=_0x5df5('0x35');respondWithRpcPromise(_0x5df5('0x7b'),_0x5df5('0x7b'),{'event':_0x5df5('0x84'),'message':_0x4594d2[_0x5df5('0x28')]},client9002);return _0x453238;}return null;})['then'](respondWithResult(_0x311dc0,null))['catch'](handleError(_0x311dc0,null));};exports['status']=function(_0x1aae8d,_0x373de6,_0x314c24){if(_0x1aae8d['body']['id']){delete _0x1aae8d[_0x5df5('0x5b')]['id'];}var _0x5c399e;return db[_0x5df5('0x52')][_0x5df5('0x59')]({'where':{'id':_0x1aae8d['params']['id']}})[_0x5df5('0x20')](handleEntityNotFound(_0x373de6,null))[_0x5df5('0x20')](function(_0x5e4192){if(_0x5e4192){_0x5c399e=_0x5e4192;return db[_0x5df5('0x85')][_0x5df5('0x59')]({'where':{'id':_0x5e4192[_0x5df5('0x86')]}});}})[_0x5df5('0x20')](handleEntityNotFound(_0x373de6,null))['then'](function(_0x553507){if(_0x553507){logger[_0x5df5('0x22')](_0x5df5('0x87'),_0x5df5('0x2b'),'received\x20delivery\x20report\x20from',_0x553507[_0x5df5('0x3f')],util[_0x5df5('0x88')](_0x1aae8d[_0x5df5('0x5b')],{'showHidden':![],'depth':null}));switch(_0x553507[_0x5df5('0x3f')]){case _0x5df5('0x89'):if(_0x1aae8d['body'][_0x5df5('0x8a')]&&_0x1aae8d[_0x5df5('0x5b')][_0x5df5('0x8a')]===_0x5c399e[_0x5df5('0x8b')]){return _0x5c399e[_0x5df5('0x37')]({'read':!![]});}else{logger[_0x5df5('0x25')](_0x5df5('0x8c'),_0x5df5('0x2b'),_0x5df5('0x89'),util[_0x5df5('0x88')](_0x1aae8d['body'],{'showHidden':![],'depth':null}));}break;case _0x5df5('0x8d'):if(_0x1aae8d[_0x5df5('0x5b')]['MessageUUID']&&_0x1aae8d[_0x5df5('0x5b')][_0x5df5('0x8e')]===_0x5c399e['messageId']&&_[_0x5df5('0x8f')]([_0x5df5('0x90'),_0x5df5('0x91')],_0x1aae8d[_0x5df5('0x5b')]['Status'])>=0x0){return _0x5c399e[_0x5df5('0x37')]({'read':!![]});}else{logger[_0x5df5('0x25')](_0x5df5('0x8c'),_0x5df5('0x2b'),'plivio',util[_0x5df5('0x88')](_0x1aae8d[_0x5df5('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5df5('0x92'):var _0x13dd4d=_0x1aae8d[_0x5df5('0x5b')]['results'][0x0];if(_0x13dd4d[_0x5df5('0x2b')][_0x5df5('0x93')]===_0x5df5('0x94')){return _0x5c399e[_0x5df5('0x37')]({'read':!![]});}else{logger[_0x5df5('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5df5('0x2b'),_0x5df5('0x92'),util[_0x5df5('0x88')](_0x1aae8d['body'],{'showHidden':![],'depth':null}));}break;}return _0x5c399e;}})['then'](respondWithResult(_0x373de6,null))[_0x5df5('0x56')](handleError(_0x373de6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 88536cb..7636a60 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 _0xf4b3=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3e1797,_0x2858f1){var _0x520f32=function(_0x2dacdf){while(--_0x2dacdf){_0x3e1797['push'](_0x3e1797['shift']());}};_0x520f32(++_0x2858f1);}(_0xf4b3,0xaa));var _0x3f4b=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0xf4b3[_0x2715cf];return _0x1bdcb8;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x3f4b('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3f4b('0x1')](0x0);var events={'afterCreate':_0x3f4b('0x2'),'afterUpdate':_0x3f4b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d403e){return function(_0x18bae2,_0x5322d8,_0x5928e2){SmsMessageEvents['emit'](_0x2d403e+':'+_0x18bae2['id'],_0x18bae2);SmsMessageEvents[_0x3f4b('0x4')](_0x2d403e,_0x18bae2);_0x5928e2(null);};}for(var e in events){if(events[_0x3f4b('0x5')](e)){var event=events[e];SmsMessage[_0x3f4b('0x6')](e,emitEvent(event));}}module[_0x3f4b('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xb551=['hook','exports','../../mysqldb','save','update','remove','hasOwnProperty'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb551,0x18a));var _0x1b55=function(_0x368fac,_0x3ff552){_0x368fac=_0x368fac-0x0;var _0x2b699a=_0xb551[_0x368fac];return _0x2b699a;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1b55('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b55('0x1'),'afterUpdate':_0x1b55('0x2'),'afterDestroy':_0x1b55('0x3')};function emitEvent(_0x563812){return function(_0x1b7ff8,_0x385aeb,_0x20739d){SmsMessageEvents['emit'](_0x563812+':'+_0x1b7ff8['id'],_0x1b7ff8);SmsMessageEvents['emit'](_0x563812,_0x1b7ff8);_0x20739d(null);};}for(var e in events){if(events[_0x1b55('0x4')](e)){var event=events[e];SmsMessage[_0x1b55('0x5')](e,emitEvent(event));}}module[_0x1b55('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 27d3b04..b574fe7 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 _0xfdab=['messages','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','length','createHash','md5','digest','hex','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','Bearer\x20','code','message','refid','status','intelepeer','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','password','smsMethod','sender','login?username=','username','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','plivo','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xfdab,0x1e3));var _0xbfda=function(_0x2f9138,_0x493638){_0x2f9138=_0x2f9138-0x0;var _0x21e94e=_0xfdab[_0x2f9138];return _0x21e94e;};'use strict';var _=require('lodash');var util=require(_0xbfda('0x0'));var logger=require(_0xbfda('0x1'))('api');var moment=require(_0xbfda('0x2'));var BPromise=require(_0xbfda('0x3'));var rp=require(_0xbfda('0x4'));var fs=require('fs');var path=require(_0xbfda('0x5'));var rimraf=require(_0xbfda('0x6'));var config=require(_0xbfda('0x7'));var attributes=require('./smsMessage.attributes');module[_0xbfda('0x8')]=function(_0x3c058e,_0x43819d){return _0x3c058e['define'](_0xbfda('0x9'),attributes,{'tableName':_0xbfda('0xa'),'paranoid':![],'indexes':[{'name':_0xbfda('0xb'),'fields':[_0xbfda('0xb')]},{'name':_0xbfda('0xc'),'fields':[_0xbfda('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x593d02,_0xe9621d,_0x40a84f){var _0x34a274=_0x3c058e[_0xbfda('0xe')];var _0x19d6f1=_0x593d02['get']({'plain':!![]});if(_0x19d6f1[_0xbfda('0xf')][_0xbfda('0x10')]()==='in'||_0x19d6f1[_0xbfda('0xf')][_0xbfda('0x10')]()==='out'&&!_0x19d6f1[_0xbfda('0x11')]&&!_[_0xbfda('0x12')](_0x19d6f1[_0xbfda('0x13')])&&!_['isNil'](_0x19d6f1[_0xbfda('0x14')])){_0x34a274[_0xbfda('0x15')]['findOne']({'where':{'id':_0x19d6f1['SmsInteractionId']}})[_0xbfda('0x16')](function(_0x373ea9){if(_0x373ea9){_0x373ea9[_0xbfda('0x17')]({'lastMsgAt':_0x19d6f1[_0xbfda('0x18')],'lastMsgDirection':_0x19d6f1['direction'][_0xbfda('0x10')]()});}})[_0xbfda('0x19')](function(_0x2b917a){console[_0xbfda('0x1a')](_0x2b917a);});}if(_0x19d6f1[_0xbfda('0xf')]===_0xbfda('0x1b')&&!_0x19d6f1[_0xbfda('0x11')]){var _0x51f3e2;_0x34a274[_0xbfda('0x1c')][_0xbfda('0x1d')]({'where':{'id':_0x19d6f1[_0xbfda('0x1e')]},'raw':!![]})[_0xbfda('0x16')](function(_0x323efa){_0x51f3e2=_0x323efa;if(_0x51f3e2&&_0x51f3e2[_0xbfda('0x1f')]){switch(_0x51f3e2[_0xbfda('0x1f')]){case _0xbfda('0x20'):var _0x1dc011=require(_0xbfda('0x20'));if(_0x51f3e2[_0xbfda('0x21')]&&_0x51f3e2[_0xbfda('0x22')]&&_0x51f3e2[_0xbfda('0x23')]){var _0x13a91d=new _0x1dc011(_0x51f3e2[_0xbfda('0x21')],_0x51f3e2[_0xbfda('0x22')]);_0x13a91d['messages']['create']({'body':_0x19d6f1['body'],'to':_0x19d6f1[_0xbfda('0x23')],'from':_0x51f3e2[_0xbfda('0x23')],'statusCallback':_0x51f3e2['remote']+_0xbfda('0x24')+_0x19d6f1['id']+_0xbfda('0x25')+_0x51f3e2[_0xbfda('0x26')]})[_0xbfda('0x16')](function(_0x9a7833){if(_0x9a7833['sid']){return _0x593d02[_0xbfda('0x17')]({'messageId':_0x9a7833[_0xbfda('0x27')]});}})['catch'](function(_0x434a98){logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x20'),util[_0xbfda('0x2a')](_0x434a98,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')](_0xbfda('0x28'),'afterCreate',_0xbfda('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xbfda('0x2b'):var _0x2589f8='https://api.skebby.it/API/v1.0/REST/';if(_0x51f3e2['username']&&_0x51f3e2[_0xbfda('0x2c')]){var _0x42a4da={'recipient':[_0x19d6f1[_0xbfda('0x23')]],'message':_0x19d6f1['body'],'message_type':_0x51f3e2[_0xbfda('0x2d')]};if(_0x51f3e2['smsMethod']&&_0x51f3e2[_0xbfda('0x2d')]!=='SI'){_0x42a4da[_0xbfda('0x2e')]=_0x51f3e2['phone'];}var _0x3deaca={'url':_0x2589f8+_0xbfda('0x2f')+_0x51f3e2[_0xbfda('0x30')]+'&password='+_0x51f3e2[_0xbfda('0x2c')],'method':_0xbfda('0x31')};rp(_0x3deaca)[_0xbfda('0x16')](function(_0x3cf587){var _0x4c4b1b=_0x3cf587[_0xbfda('0x32')](';');var _0x185e4f={'user_key':_0x4c4b1b[0x0],'session_key':_0x4c4b1b[0x1]};_0x3deaca={'url':_0x2589f8+'sms','method':_0xbfda('0x33'),'headers':{'user_key':_0x185e4f[_0xbfda('0x34')],'Session_key':_0x185e4f[_0xbfda('0x35')]},'json':!![],'body':_0x42a4da};return rp(_0x3deaca);})['then'](function(_0x138c6c){if(_0x138c6c[_0xbfda('0x36')]>=0x1){var _0x5030db={'messageId':_0x138c6c[_0xbfda('0x37')]};if(_0x51f3e2[_0xbfda('0x2d')]!=='GP'||!_0x51f3e2[_0xbfda('0x38')]){_0x5030db['read']=!![];}return _0x593d02['update'](_0x5030db);}else{return logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x2b'),util['inspect'](_0x138c6c,{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x4d98c3){return logger['error'](_0xbfda('0x28'),'afterCreate','skebby',util[_0xbfda('0x2a')](_0x4d98c3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0xbfda('0x39'));}break;case _0xbfda('0x3a'):if(_0x51f3e2[_0xbfda('0x22')]){var _0x4d57ff={'recipient':_0x19d6f1[_0xbfda('0x23')],'message':_0x19d6f1[_0xbfda('0xd')],'sender':_0x51f3e2[_0xbfda('0x3b')]||_0x51f3e2[_0xbfda('0x23')],'authorization':_0x51f3e2[_0xbfda('0x22')]};var _0xe9621d={'method':_0xbfda('0x33'),'uri':_0xbfda('0x3c'),'body':_0x4d57ff,'json':!![]};rp(_0xe9621d)[_0xbfda('0x16')](function(_0x51923b){var _0xc9b8e5={'messageId':_0x51923b['requestid']};if(!_0x51f3e2[_0xbfda('0x38')]){_0xc9b8e5[_0xbfda('0x3d')]=!![];}return _0x593d02[_0xbfda('0x17')](_0xc9b8e5);})[_0xbfda('0x19')](function(_0x54f34e){logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x3a'),util['inspect'](_0x54f34e,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xbfda('0x3e'):if(_0x51f3e2[_0xbfda('0x30')]&&_0x51f3e2[_0xbfda('0x2c')]){var _0x4d57ff={'messages':[{'source':'xCALLY\x20Motion','to':_0x19d6f1[_0xbfda('0x23')],'body':_0x19d6f1[_0xbfda('0xd')],'from':_0x51f3e2[_0xbfda('0x3b')]||_0x51f3e2['phone']}]};var _0x4a83cf=util[_0xbfda('0x3f')](_0xbfda('0x40'),_0x51f3e2[_0xbfda('0x30')],_0x51f3e2['password']);var _0xe9621d={'method':_0xbfda('0x33'),'uri':_0xbfda('0x41'),'body':_0x4d57ff,'headers':{'Authorization':util[_0xbfda('0x3f')](_0xbfda('0x42'),new Buffer(_0x4a83cf)[_0xbfda('0x43')](_0xbfda('0x44')))},'json':!![]};rp(_0xe9621d)[_0xbfda('0x16')](function(_0x476d4a){if(_0x476d4a[_0xbfda('0x45')]>=0xc8&&_0x476d4a[_0xbfda('0x45')]<=0xce){if(_0x476d4a['data']&&_0x476d4a['data'][_0xbfda('0x46')]>0x0){var _0xe7298a=_['head'](_0x476d4a[_0xbfda('0x47')]['messages']);var _0x5bf782={'messageId':_0xe7298a[_0xbfda('0x48')]};if(!_0x51f3e2[_0xbfda('0x38')]){_0x5bf782[_0xbfda('0x3d')]=!![];}return _0x593d02[_0xbfda('0x17')](_0x5bf782);}else{logger['error'](_0xbfda('0x28'),'afterCreate',_0xbfda('0x49'),util[_0xbfda('0x2a')](_0x476d4a,{'showHidden':![],'depth':null}));}}else{logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x49'),util['inspect'](_0x476d4a,{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x29011e){logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),'clickSend',util['inspect'](_0x29011e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x49'),_0xbfda('0x39'));}break;case _0xbfda('0x4a'):if(_0x51f3e2[_0xbfda('0x4b')]&&_0x51f3e2[_0xbfda('0x22')]){var _0x4d57ff={'dst':_0x19d6f1[_0xbfda('0x23')],'text':_0x19d6f1[_0xbfda('0xd')],'src':_0x51f3e2['senderString']||_0x51f3e2['phone'],'url':_0x51f3e2['remote']+_0xbfda('0x24')+_0x19d6f1['id']+_0xbfda('0x25')+_0x51f3e2[_0xbfda('0x26')]};var _0x4a83cf=util[_0xbfda('0x3f')]('%s:%s',_0x51f3e2[_0xbfda('0x4b')],_0x51f3e2[_0xbfda('0x22')]);var _0xe9621d={'method':_0xbfda('0x33'),'uri':util[_0xbfda('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x51f3e2[_0xbfda('0x4b')]),'body':_0x4d57ff,'headers':{'Authorization':util[_0xbfda('0x3f')](_0xbfda('0x42'),new Buffer(_0x4a83cf)['toString'](_0xbfda('0x44')))},'json':!![]};rp(_0xe9621d)[_0xbfda('0x16')](function(_0x564986){var _0x23d543={'messageId':_0x564986['message_uuid'][0x0]};return _0x593d02[_0xbfda('0x17')](_0x23d543);})['catch'](function(_0x49d380){logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x4a'),util[_0xbfda('0x2a')](_0x49d380,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),'plivo',_0xbfda('0x4c'));}break;case _0xbfda('0x4d'):if(_0x51f3e2[_0xbfda('0x30')]&&_0x51f3e2[_0xbfda('0x2c')]){if(_0x51f3e2['baseUrl']){var _0x226380={'method':_0xbfda('0x33'),'uri':_0x51f3e2[_0xbfda('0x4e')]+_0xbfda('0x4f'),'body':{'username':_0x51f3e2[_0xbfda('0x30')],'password':_0x51f3e2[_0xbfda('0x2c')]},'json':!![]};return rp(_0x226380)[_0xbfda('0x16')](function(_0x4f2257){var _0x43dcd0={'method':'POST','uri':_0x51f3e2['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x51f3e2[_0xbfda('0x23')],'destinations':[{'to':_0x19d6f1[_0xbfda('0x23')]}],'text':_0x19d6f1[_0xbfda('0xd')],'notifyUrl':_0x51f3e2['remote']+'/api/sms/messages/'+_0x19d6f1['id']+'/status?token='+_0x51f3e2[_0xbfda('0x26')],'notifyContentType':_0xbfda('0x50'),'callbackData':_0x51f3e2[_0xbfda('0x23')]+';'+_0x19d6f1[_0xbfda('0xd')]}]},'headers':{'Authorization':_0xbfda('0x51')+_0x4f2257['token']},'json':!![]};return rp(_0x43dcd0)[_0xbfda('0x16')](function(_0x16ec54){if(_0x16ec54[_0xbfda('0x52')]){var _0x208aae={'messageId':_0x16ec54['messages'][0x0][_0xbfda('0xb')]};if(!_0x51f3e2[_0xbfda('0x38')]){_0x208aae['read']=!![];}return _0x593d02[_0xbfda('0x17')](_0x208aae);}else{return logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),'infobip',util['inspect'](_0x16ec54,{'showHidden':![],'depth':null}));}});})[_0xbfda('0x19')](function(_0x2f4c26){return logger[_0xbfda('0x1a')](_0xbfda('0x28'),'afterCreate',_0xbfda('0x4d'),util[_0xbfda('0x2a')](_0x2f4c26,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),'infobip',_0xbfda('0x53'));}}else{logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x4d'),_0xbfda('0x39'));}break;case _0xbfda('0x54'):var _0x2577d9=require('crypto');if(_0x51f3e2[_0xbfda('0x55')]){var _0x3738bd={};_0x3738bd[_0xbfda('0x56')]=_0x51f3e2['username'];_0x3738bd[_0xbfda('0x23')]=_0x19d6f1[_0xbfda('0x23')];_0x3738bd[_0xbfda('0x2e')]=_0x51f3e2[_0xbfda('0x23')];_0x3738bd[_0xbfda('0x57')]=_0x19d6f1[_0xbfda('0xd')];_0x3738bd[_0xbfda('0x58')]=+new Date();var _0x2b976e='';var _0xad6c35='';var _0x2683fd=Object['keys'](_0x3738bd);_0x2683fd['sort']();for(var _0x1c624e=0x0;_0x1c624e<_0x2683fd[_0xbfda('0x59')];_0x1c624e++){if(_0x2b976e!=''){_0x2b976e+='&';}_0x2b976e+=_0x2683fd[_0x1c624e]+'='+encodeURIComponent(_0x3738bd[_0x2683fd[_0x1c624e]]);_0xad6c35+=_0x3738bd[_0x2683fd[_0x1c624e]];}_0xad6c35+=_0x51f3e2[_0xbfda('0x55')];_0xad6c35=_0x2577d9[_0xbfda('0x5a')](_0xbfda('0x5b'))[_0xbfda('0x17')](_0xad6c35)[_0xbfda('0x5c')](_0xbfda('0x5d'));if(_0x2b976e!==''){_0x2b976e+='&';}_0x2b976e+='signature='+_0xad6c35;var _0x3deaca={'method':_0xbfda('0x31'),'uri':_0x51f3e2[_0xbfda('0x4e')]+_0xbfda('0x5e')+_0x2b976e,'json':!![]};return rp(_0x3deaca)['then'](function(_0x229aea){var _0x5c4d57=Object[_0xbfda('0x5f')](_0x229aea);if(_0x229aea[_0x5c4d57[0x0]]['error']&&parseInt(_0x229aea[_0x5c4d57[0x0]]['error'])===0x0){var _0x31c224={'messageId':_0x229aea[_0x5c4d57[0x0]][_0xbfda('0x60')]};if(!_0x51f3e2[_0xbfda('0x38')]){_0x31c224[_0xbfda('0x3d')]=!![];}return _0x593d02[_0xbfda('0x17')](_0x31c224);}else{return logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),'csc',util[_0xbfda('0x2a')](_0x229aea[_0xbfda('0x1a')],{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x405d86){return logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbfda('0x54'),util['inspect'](_0x405d86,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x54'),_0xbfda('0x61'));}break;case _0xbfda('0x62'):if(_0x51f3e2[_0xbfda('0x55')]){var _0x467b8e={'method':_0xbfda('0x33'),'uri':_0xbfda('0x63'),'headers':{'Authorization':_0x51f3e2[_0xbfda('0x55')]},'body':{'content':_0x19d6f1[_0xbfda('0xd')],'to':[_0x19d6f1[_0xbfda('0x23')]],'from':_0x51f3e2[_0xbfda('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0xbfda('0x64')},'json':!![]};rp(_0x467b8e)[_0xbfda('0x16')](function(_0x531708){if(!_0x531708[_0xbfda('0x1a')]){var _0x197af1={'messageId':_0x531708[_0xbfda('0x52')][0x0][_0xbfda('0x65')]};if(!_0x51f3e2['deliveryReport']){_0x197af1[_0xbfda('0x3d')]=!![];}return _0x593d02[_0xbfda('0x17')](_0x197af1);}else{return logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x62'),util[_0xbfda('0x2a')](_0x531708['error'],{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x2029b3){return logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x62'),util[_0xbfda('0x2a')](_0x2029b3,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x62'),'Missing\x20parameters:\x20apiKey');}break;case _0xbfda('0x66'):if(_0x51f3e2[_0xbfda('0x30')]&&_0x51f3e2['password']){var _0x4a83cf=util[_0xbfda('0x3f')](_0xbfda('0x40'),_0x51f3e2[_0xbfda('0x30')],_0x51f3e2[_0xbfda('0x2c')]);var _0xe9621d={'method':_0xbfda('0x33'),'uri':_0xbfda('0x67')+_0x51f3e2[_0xbfda('0x68')]+'/messages','body':{'to':[_0x19d6f1[_0xbfda('0x23')]],'text':_0x19d6f1[_0xbfda('0xd')],'from':_0x51f3e2[_0xbfda('0x23')],'applicationId':_0x51f3e2[_0xbfda('0x69')]},'headers':{'Authorization':util[_0xbfda('0x3f')](_0xbfda('0x42'),new Buffer(_0x4a83cf)[_0xbfda('0x43')]('base64'))},'json':!![]};rp(_0xe9621d)[_0xbfda('0x16')](function(_0x3f5159){if(_0x3f5159['id']){var _0x843b0f={'messageId':_0x3f5159['id']};return _0x593d02[_0xbfda('0x17')](_0x843b0f);}else{logger[_0xbfda('0x1a')](_0xbfda('0x28'),'afterCreate',_0xbfda('0x66'),util['inspect'](_0x3f5159,{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x5a5539){logger[_0xbfda('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfda('0x29'),_0xbfda('0x66'),util[_0xbfda('0x2a')](_0x5a5539,{'showHidden':![],'depth':null}));});}else{logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),'bandwidth',_0xbfda('0x39'));}break;case'intelepeer':if(_0x51f3e2[_0xbfda('0x55')]){var _0x132c80={};var _0x3deaca={'method':_0xbfda('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xbfda('0x6a')+_0x51f3e2['apiKey'],'Content-Type':_0xbfda('0x50')},'body':{'from':_0x51f3e2[_0xbfda('0x23')],'to':_0x19d6f1[_0xbfda('0x23')],'text':_0x19d6f1[_0xbfda('0xd')]},'json':!![]};return rp(_0x3deaca)['then'](function(_0x17367b){if(_0x17367b[_0xbfda('0x6b')]==0xca){_0x132c80[_0xbfda('0x6c')]=_0x17367b;var _0x20a2b4={'method':_0xbfda('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xbfda('0x6a')+_0x51f3e2[_0xbfda('0x55')],'Content-Type':_0xbfda('0x50')},'body':{'refid':_0x132c80[_0xbfda('0x6c')][_0xbfda('0x6d')]},'json':!![]};return rp(_0x20a2b4)[_0xbfda('0x16')](function(_0x203c6a){_0x132c80[_0xbfda('0x6e')]=_0x203c6a;var _0x5cec75={'messageId':_0x132c80[_0xbfda('0x6c')][_0xbfda('0x6d')],'read':!![]};return _0x593d02[_0xbfda('0x17')](_0x5cec75);});}else{return logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x6f'),util[_0xbfda('0x2a')](_0x17367b,{'showHidden':![],'depth':null}));}})[_0xbfda('0x19')](function(_0x2c3ea0){return logger[_0xbfda('0x1a')](_0xbfda('0x28'),_0xbfda('0x29'),_0xbfda('0x6f'),util['inspect'](_0x2c3ea0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xbfda('0x28'),_0xbfda('0x29'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x40a84f();});}else{_0x40a84f();}}},'charset':_0xbfda('0x70'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf2c5=['clickSend','plivo','authId','format','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','sender','text','sort','length','createHash','digest','hex','signature=','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','password','GET','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id'];(function(_0xb8d9cf,_0x455825){var _0x5a2d3b=function(_0x3fc1a0){while(--_0x3fc1a0){_0xb8d9cf['push'](_0xb8d9cf['shift']());}};_0x5a2d3b(++_0x455825);}(_0xf2c5,0xa9));var _0x5f2c=function(_0x25713b,_0x47d6b3){_0x25713b=_0x25713b-0x0;var _0x27ce9e=_0xf2c5[_0x25713b];return _0x27ce9e;};'use strict';var _=require(_0x5f2c('0x0'));var util=require(_0x5f2c('0x1'));var logger=require(_0x5f2c('0x2'))('api');var moment=require(_0x5f2c('0x3'));var BPromise=require(_0x5f2c('0x4'));var rp=require(_0x5f2c('0x5'));var fs=require('fs');var path=require(_0x5f2c('0x6'));var rimraf=require('rimraf');var config=require(_0x5f2c('0x7'));var attributes=require(_0x5f2c('0x8'));module['exports']=function(_0x4a7ade,_0x2b1098){return _0x4a7ade[_0x5f2c('0x9')](_0x5f2c('0xa'),attributes,{'tableName':_0x5f2c('0xb'),'paranoid':![],'indexes':[{'name':_0x5f2c('0xc'),'fields':[_0x5f2c('0xc')]},{'name':_0x5f2c('0xd'),'fields':[_0x5f2c('0xe')],'type':_0x5f2c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16ec64,_0x8eb656,_0x282056){var _0x5de1ca=_0x4a7ade[_0x5f2c('0x10')];var _0x357340=_0x16ec64['get']({'plain':!![]});if(_0x357340[_0x5f2c('0x11')][_0x5f2c('0x12')]()==='in'||_0x357340[_0x5f2c('0x11')][_0x5f2c('0x12')]()===_0x5f2c('0x13')&&!_0x357340[_0x5f2c('0x14')]&&!_['isNil'](_0x357340[_0x5f2c('0x15')])&&!_[_0x5f2c('0x16')](_0x357340['SmsInteractionId'])){_0x5de1ca[_0x5f2c('0x17')][_0x5f2c('0x18')]({'where':{'id':_0x357340[_0x5f2c('0x19')]}})[_0x5f2c('0x1a')](function(_0xbbcdff){if(_0xbbcdff){_0xbbcdff[_0x5f2c('0x1b')]({'lastMsgAt':_0x357340[_0x5f2c('0x1c')],'lastMsgDirection':_0x357340[_0x5f2c('0x11')]['toLowerCase']()});}})[_0x5f2c('0x1d')](function(_0x111fe6){console['error'](_0x111fe6);});}if(_0x357340[_0x5f2c('0x11')]===_0x5f2c('0x13')&&!_0x357340[_0x5f2c('0x14')]){var _0x907e97;_0x5de1ca[_0x5f2c('0x1e')][_0x5f2c('0x1f')]({'where':{'id':_0x357340[_0x5f2c('0x20')]},'raw':!![]})[_0x5f2c('0x1a')](function(_0x40fb5f){_0x907e97=_0x40fb5f;if(_0x907e97&&_0x907e97[_0x5f2c('0x21')]){switch(_0x907e97['type']){case _0x5f2c('0x22'):var _0x5d020e=require(_0x5f2c('0x22'));if(_0x907e97[_0x5f2c('0x23')]&&_0x907e97[_0x5f2c('0x24')]&&_0x907e97[_0x5f2c('0x25')]){var _0x2cdbe3=new _0x5d020e(_0x907e97[_0x5f2c('0x23')],_0x907e97[_0x5f2c('0x24')]);_0x2cdbe3[_0x5f2c('0x26')][_0x5f2c('0x27')]({'body':_0x357340['body'],'to':_0x357340[_0x5f2c('0x25')],'from':_0x907e97[_0x5f2c('0x25')],'statusCallback':_0x907e97[_0x5f2c('0x28')]+_0x5f2c('0x29')+_0x357340['id']+_0x5f2c('0x2a')+_0x907e97[_0x5f2c('0x2b')]})[_0x5f2c('0x1a')](function(_0xa657f9){if(_0xa657f9['sid']){return _0x16ec64[_0x5f2c('0x1b')]({'messageId':_0xa657f9['sid']});}})[_0x5f2c('0x1d')](function(_0x45c0a1){logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x22'),util['inspect'](_0x45c0a1,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5f2c('0x2f'):var _0x458750=_0x5f2c('0x30');if(_0x907e97[_0x5f2c('0x31')]&&_0x907e97['password']){var _0x189807={'recipient':[_0x357340['phone']],'message':_0x357340[_0x5f2c('0xe')],'message_type':_0x907e97[_0x5f2c('0x32')]};if(_0x907e97[_0x5f2c('0x32')]&&_0x907e97['smsMethod']!=='SI'){_0x189807['sender']=_0x907e97[_0x5f2c('0x25')];}var _0x44b68b={'url':_0x458750+_0x5f2c('0x33')+_0x907e97['username']+'&password='+_0x907e97[_0x5f2c('0x34')],'method':_0x5f2c('0x35')};rp(_0x44b68b)['then'](function(_0x586ecf){var _0x6f320b=_0x586ecf['split'](';');var _0x5499a2={'user_key':_0x6f320b[0x0],'session_key':_0x6f320b[0x1]};_0x44b68b={'url':_0x458750+'sms','method':_0x5f2c('0x36'),'headers':{'user_key':_0x5499a2[_0x5f2c('0x37')],'Session_key':_0x5499a2[_0x5f2c('0x38')]},'json':!![],'body':_0x189807};return rp(_0x44b68b);})[_0x5f2c('0x1a')](function(_0x17bb48){if(_0x17bb48[_0x5f2c('0x39')]>=0x1){var _0x5983fc={'messageId':_0x17bb48[_0x5f2c('0x3a')]};if(_0x907e97['smsMethod']!=='GP'||!_0x907e97[_0x5f2c('0x3b')]){_0x5983fc[_0x5f2c('0x3c')]=!![];}return _0x16ec64['update'](_0x5983fc);}else{return logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),'skebby',util['inspect'](_0x17bb48,{'showHidden':![],'depth':null}));}})[_0x5f2c('0x1d')](function(_0x1506fd){return logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x2f'),util[_0x5f2c('0x3d')](_0x1506fd,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5f2c('0x3e'):if(_0x907e97[_0x5f2c('0x24')]){var _0x54ea95={'recipient':_0x357340['phone'],'message':_0x357340['body'],'sender':_0x907e97[_0x5f2c('0x3f')]||_0x907e97['phone'],'authorization':_0x907e97[_0x5f2c('0x24')]};var _0x8eb656={'method':_0x5f2c('0x36'),'uri':_0x5f2c('0x40'),'body':_0x54ea95,'json':!![]};rp(_0x8eb656)[_0x5f2c('0x1a')](function(_0x66625b){var _0x151865={'messageId':_0x66625b[_0x5f2c('0x41')]};if(!_0x907e97['deliveryReport']){_0x151865[_0x5f2c('0x3c')]=!![];}return _0x16ec64[_0x5f2c('0x1b')](_0x151865);})[_0x5f2c('0x1d')](function(_0x128067){logger['error'](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x3e'),util[_0x5f2c('0x3d')](_0x128067,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),'connectel',_0x5f2c('0x42'));}break;case _0x5f2c('0x43'):if(_0x907e97['username']&&_0x907e97[_0x5f2c('0x34')]){var _0x54ea95={'messages':[{'source':_0x5f2c('0x44'),'to':_0x357340[_0x5f2c('0x25')],'body':_0x357340['body'],'from':_0x907e97['senderString']||_0x907e97[_0x5f2c('0x25')]}]};var _0x589931=util['format']('%s:%s',_0x907e97[_0x5f2c('0x31')],_0x907e97[_0x5f2c('0x34')]);var _0x8eb656={'method':_0x5f2c('0x36'),'uri':_0x5f2c('0x45'),'body':_0x54ea95,'headers':{'Authorization':util['format'](_0x5f2c('0x46'),new Buffer(_0x589931)[_0x5f2c('0x47')](_0x5f2c('0x48')))},'json':!![]};rp(_0x8eb656)[_0x5f2c('0x1a')](function(_0x4d7f9d){if(_0x4d7f9d[_0x5f2c('0x49')]>=0xc8&&_0x4d7f9d['http_code']<=0xce){if(_0x4d7f9d[_0x5f2c('0x4a')]&&_0x4d7f9d[_0x5f2c('0x4a')]['queued_count']>0x0){var _0x2e1fa2=_[_0x5f2c('0x4b')](_0x4d7f9d[_0x5f2c('0x4a')][_0x5f2c('0x26')]);var _0x3d3946={'messageId':_0x2e1fa2[_0x5f2c('0x4c')]};if(!_0x907e97['deliveryReport']){_0x3d3946[_0x5f2c('0x3c')]=!![];}return _0x16ec64[_0x5f2c('0x1b')](_0x3d3946);}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x4d'),util[_0x5f2c('0x3d')](_0x4d7f9d,{'showHidden':![],'depth':null}));}}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x4d'),util[_0x5f2c('0x3d')](_0x4d7f9d,{'showHidden':![],'depth':null}));}})[_0x5f2c('0x1d')](function(_0x3d0da7){logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x4d'),util['inspect'](_0x3d0da7,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5f2c('0x4e'):if(_0x907e97[_0x5f2c('0x4f')]&&_0x907e97['authToken']){var _0x54ea95={'dst':_0x357340[_0x5f2c('0x25')],'text':_0x357340[_0x5f2c('0xe')],'src':_0x907e97[_0x5f2c('0x3f')]||_0x907e97['phone'],'url':_0x907e97[_0x5f2c('0x28')]+_0x5f2c('0x29')+_0x357340['id']+'/status?token='+_0x907e97[_0x5f2c('0x2b')]};var _0x589931=util[_0x5f2c('0x50')](_0x5f2c('0x51'),_0x907e97['authId'],_0x907e97[_0x5f2c('0x24')]);var _0x8eb656={'method':_0x5f2c('0x36'),'uri':util[_0x5f2c('0x50')]('https://api.plivo.com/v1/Account/%s/Message/',_0x907e97[_0x5f2c('0x4f')]),'body':_0x54ea95,'headers':{'Authorization':util[_0x5f2c('0x50')]('Basic\x20%s',new Buffer(_0x589931)[_0x5f2c('0x47')](_0x5f2c('0x48')))},'json':!![]};rp(_0x8eb656)[_0x5f2c('0x1a')](function(_0x10bb60){var _0x9077d3={'messageId':_0x10bb60[_0x5f2c('0x52')][0x0]};return _0x16ec64['update'](_0x9077d3);})[_0x5f2c('0x1d')](function(_0x723993){logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x4e'),util[_0x5f2c('0x3d')](_0x723993,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x4e'),_0x5f2c('0x53'));}break;case _0x5f2c('0x54'):if(_0x907e97['username']&&_0x907e97[_0x5f2c('0x34')]){if(_0x907e97[_0x5f2c('0x55')]){var _0x191c84={'method':_0x5f2c('0x36'),'uri':_0x907e97[_0x5f2c('0x55')]+'/auth/1/session','body':{'username':_0x907e97[_0x5f2c('0x31')],'password':_0x907e97[_0x5f2c('0x34')]},'json':!![]};return rp(_0x191c84)[_0x5f2c('0x1a')](function(_0x726d4d){var _0x396606={'method':_0x5f2c('0x36'),'uri':_0x907e97[_0x5f2c('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x907e97[_0x5f2c('0x25')],'destinations':[{'to':_0x357340['phone']}],'text':_0x357340[_0x5f2c('0xe')],'notifyUrl':_0x907e97[_0x5f2c('0x28')]+'/api/sms/messages/'+_0x357340['id']+_0x5f2c('0x2a')+_0x907e97[_0x5f2c('0x2b')],'notifyContentType':_0x5f2c('0x56'),'callbackData':_0x907e97[_0x5f2c('0x25')]+';'+_0x357340[_0x5f2c('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x726d4d[_0x5f2c('0x2b')]},'json':!![]};return rp(_0x396606)[_0x5f2c('0x1a')](function(_0xc4adf8){if(_0xc4adf8['messages']){var _0x322b95={'messageId':_0xc4adf8[_0x5f2c('0x26')][0x0][_0x5f2c('0xc')]};if(!_0x907e97[_0x5f2c('0x3b')]){_0x322b95[_0x5f2c('0x3c')]=!![];}return _0x16ec64[_0x5f2c('0x1b')](_0x322b95);}else{return logger['error'](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x54'),util[_0x5f2c('0x3d')](_0xc4adf8,{'showHidden':![],'depth':null}));}});})[_0x5f2c('0x1d')](function(_0x59c3c6){return logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x54'),util[_0x5f2c('0x3d')](_0x59c3c6,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x54'),_0x5f2c('0x57'));}break;case _0x5f2c('0x58'):var _0xbca830=require(_0x5f2c('0x59'));if(_0x907e97[_0x5f2c('0x5a')]){var _0x140e2f={};_0x140e2f[_0x5f2c('0x5b')]=_0x907e97['username'];_0x140e2f[_0x5f2c('0x25')]=_0x357340[_0x5f2c('0x25')];_0x140e2f[_0x5f2c('0x5c')]=_0x907e97[_0x5f2c('0x25')];_0x140e2f[_0x5f2c('0x5d')]=_0x357340[_0x5f2c('0xe')];_0x140e2f['timestamp']=+new Date();var _0x1285ea='';var _0x25971d='';var _0x58ffb7=Object['keys'](_0x140e2f);_0x58ffb7[_0x5f2c('0x5e')]();for(var _0x3f221d=0x0;_0x3f221d<_0x58ffb7[_0x5f2c('0x5f')];_0x3f221d++){if(_0x1285ea!=''){_0x1285ea+='&';}_0x1285ea+=_0x58ffb7[_0x3f221d]+'='+encodeURIComponent(_0x140e2f[_0x58ffb7[_0x3f221d]]);_0x25971d+=_0x140e2f[_0x58ffb7[_0x3f221d]];}_0x25971d+=_0x907e97[_0x5f2c('0x5a')];_0x25971d=_0xbca830[_0x5f2c('0x60')]('md5')[_0x5f2c('0x1b')](_0x25971d)[_0x5f2c('0x61')](_0x5f2c('0x62'));if(_0x1285ea!==''){_0x1285ea+='&';}_0x1285ea+=_0x5f2c('0x63')+_0x25971d;var _0x44b68b={'method':'GET','uri':_0x907e97['baseUrl']+'/external/get/send.php?'+_0x1285ea,'json':!![]};return rp(_0x44b68b)[_0x5f2c('0x1a')](function(_0x1a3e79){var _0x1d8c76=Object[_0x5f2c('0x64')](_0x1a3e79);if(_0x1a3e79[_0x1d8c76[0x0]]['error']&&parseInt(_0x1a3e79[_0x1d8c76[0x0]][_0x5f2c('0x2c')])===0x0){var _0x7fd103={'messageId':_0x1a3e79[_0x1d8c76[0x0]][_0x5f2c('0x65')]};if(!_0x907e97['deliveryReport']){_0x7fd103[_0x5f2c('0x3c')]=!![];}return _0x16ec64[_0x5f2c('0x1b')](_0x7fd103);}else{return logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5f2c('0x58'),util['inspect'](_0x1a3e79[_0x5f2c('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xd100db){return logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),_0x5f2c('0x58'),util['inspect'](_0xd100db,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0x5f2c('0x66'):if(_0x907e97[_0x5f2c('0x5a')]){var _0xe93d25={'method':_0x5f2c('0x36'),'uri':_0x5f2c('0x67'),'headers':{'Authorization':_0x907e97['apiKey']},'body':{'content':_0x357340[_0x5f2c('0xe')],'to':[_0x357340[_0x5f2c('0x25')]],'from':_0x907e97[_0x5f2c('0x25')],'binary':![],'clientMessageId':_0x5f2c('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0xe93d25)['then'](function(_0x2b9180){if(!_0x2b9180[_0x5f2c('0x2c')]){var _0x1314b6={'messageId':_0x2b9180[_0x5f2c('0x26')][0x0][_0x5f2c('0x69')]};if(!_0x907e97[_0x5f2c('0x3b')]){_0x1314b6['read']=!![];}return _0x16ec64[_0x5f2c('0x1b')](_0x1314b6);}else{return logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),_0x5f2c('0x66'),util[_0x5f2c('0x3d')](_0x2b9180[_0x5f2c('0x2c')],{'showHidden':![],'depth':null}));}})[_0x5f2c('0x1d')](function(_0x46b380){return logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),'clickatell',util[_0x5f2c('0x3d')](_0x46b380,{'showHidden':![],'depth':null}));});}else{logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x66'),_0x5f2c('0x6a'));}break;case'bandwidth':if(_0x907e97['username']&&_0x907e97[_0x5f2c('0x34')]){var _0x589931=util[_0x5f2c('0x50')](_0x5f2c('0x51'),_0x907e97[_0x5f2c('0x31')],_0x907e97[_0x5f2c('0x34')]);var _0x8eb656={'method':'POST','uri':_0x5f2c('0x6b')+_0x907e97['accountId']+_0x5f2c('0x6c'),'body':{'to':[_0x357340[_0x5f2c('0x25')]],'text':_0x357340[_0x5f2c('0xe')],'from':_0x907e97[_0x5f2c('0x25')],'applicationId':_0x907e97[_0x5f2c('0x6d')]},'headers':{'Authorization':util[_0x5f2c('0x50')]('Basic\x20%s',new Buffer(_0x589931)['toString']('base64'))},'json':!![]};rp(_0x8eb656)[_0x5f2c('0x1a')](function(_0x59e77b){if(_0x59e77b['id']){var _0xb2fac4={'messageId':_0x59e77b['id']};return _0x16ec64['update'](_0xb2fac4);}else{logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),_0x5f2c('0x6e'),util[_0x5f2c('0x3d')](_0x59e77b,{'showHidden':![],'depth':null}));}})[_0x5f2c('0x1d')](function(_0x38412b){logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x6e'),util[_0x5f2c('0x3d')](_0x38412b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5f2c('0x2d'),_0x5f2c('0x2e'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x5f2c('0x6f'):if(_0x907e97['apiKey']){var _0xc34db5={};var _0x44b68b={'method':'POST','uri':_0x5f2c('0x70'),'headers':{'Authorization':_0x5f2c('0x71')+_0x907e97[_0x5f2c('0x5a')],'Content-Type':_0x5f2c('0x56')},'body':{'from':_0x907e97['phone'],'to':_0x357340[_0x5f2c('0x25')],'text':_0x357340['body']},'json':!![]};return rp(_0x44b68b)['then'](function(_0x100891){if(_0x100891[_0x5f2c('0x72')]==0xca){_0xc34db5[_0x5f2c('0x73')]=_0x100891;var _0x4114cb={'method':_0x5f2c('0x36'),'uri':_0x5f2c('0x74'),'headers':{'Authorization':_0x5f2c('0x71')+_0x907e97[_0x5f2c('0x5a')],'Content-Type':_0x5f2c('0x56')},'body':{'refid':_0xc34db5[_0x5f2c('0x73')][_0x5f2c('0x75')]},'json':!![]};return rp(_0x4114cb)['then'](function(_0x5ae2df){_0xc34db5[_0x5f2c('0x76')]=_0x5ae2df;var _0x2e594d={'messageId':_0xc34db5[_0x5f2c('0x73')]['refid'],'read':!![]};return _0x16ec64['update'](_0x2e594d);});}else{return logger[_0x5f2c('0x2c')](_0x5f2c('0x2d'),_0x5f2c('0x2e'),_0x5f2c('0x6f'),util[_0x5f2c('0x3d')](_0x100891,{'showHidden':![],'depth':null}));}})[_0x5f2c('0x1d')](function(_0x2ee0df){return logger[_0x5f2c('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5f2c('0x2e'),_0x5f2c('0x6f'),util[_0x5f2c('0x3d')](_0x2ee0df,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x5f2c('0x2d'),'afterCreate',_0x5f2c('0x6f'),_0x5f2c('0x77'));}break;}}})[_0x5f2c('0x78')](function(){_0x282056();});}else{_0x282056();}}},'charset':_0x5f2c('0x79'),'collate':_0x5f2c('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f9e1b71..1c8cbbd 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 _0x9635=['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','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSmsMessage','create','options'];(function(_0xb0b385,_0xae92b5){var _0x65e9ad=function(_0x5d4bf3){while(--_0x5d4bf3){_0xb0b385['push'](_0xb0b385['shift']());}};_0x65e9ad(++_0xae92b5);}(_0x9635,0xab));var _0x5963=function(_0x301a04,_0x55fb83){_0x301a04=_0x301a04-0x0;var _0x37f888=_0x9635[_0x301a04];return _0x37f888;};'use strict';var _=require(_0x5963('0x0'));var util=require(_0x5963('0x1'));var moment=require(_0x5963('0x2'));var BPromise=require(_0x5963('0x3'));var rs=require(_0x5963('0x4'));var fs=require('fs');var Redis=require(_0x5963('0x5'));var db=require(_0x5963('0x6'))['db'];var utils=require(_0x5963('0x7'));var logger=require(_0x5963('0x8'))(_0x5963('0x9'));var config=require(_0x5963('0xa'));var jayson=require(_0x5963('0xb'));var client=jayson[_0x5963('0xc')][_0x5963('0xd')]({'port':0x232a});config[_0x5963('0xe')]=_[_0x5963('0xf')](config[_0x5963('0xe')],{'host':_0x5963('0x10'),'port':0x18eb});var socket=require(_0x5963('0x11'))(new Redis(config[_0x5963('0xe')]));require(_0x5963('0x12'))['register'](socket);function respondWithRpcPromise(_0x42350e,_0x47cd21,_0x5ac9de){return new BPromise(function(_0x3252cd,_0x2e0189){return client[_0x5963('0x13')](_0x42350e,_0x5ac9de)[_0x5963('0x14')](function(_0xb1a496){logger['info'](_0x5963('0x15'),_0x47cd21,_0x5963('0x16'));logger[_0x5963('0x17')](_0x5963('0x18'),_0x47cd21,_0x5963('0x16'),JSON['stringify'](_0xb1a496));if(_0xb1a496[_0x5963('0x19')]){if(_0xb1a496[_0x5963('0x19')][_0x5963('0x1a')]===0x1f4){logger[_0x5963('0x19')]('SmsMessage,\x20%s,\x20%s',_0x47cd21,_0xb1a496['error'][_0x5963('0x1b')]);return _0x2e0189(_0xb1a496[_0x5963('0x19')][_0x5963('0x1b')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x47cd21,_0xb1a496[_0x5963('0x19')][_0x5963('0x1b')]);return _0x3252cd(_0xb1a496[_0x5963('0x19')]['message']);}else{logger[_0x5963('0x1c')](_0x5963('0x15'),_0x47cd21,_0x5963('0x16'));_0x3252cd(_0xb1a496[_0x5963('0x1d')][_0x5963('0x1b')]);}})['catch'](function(_0x57c569){logger[_0x5963('0x19')](_0x5963('0x15'),_0x47cd21,_0x57c569);_0x2e0189(_0x57c569);});});}exports[_0x5963('0x1e')]=function(_0x117a10){var _0xbcde7=this;return new Promise(function(_0x12b15c,_0x198e8f){return db['SmsMessage'][_0x5963('0x1f')](_0x117a10['body'],{'raw':_0x117a10[_0x5963('0x20')]?_0x117a10[_0x5963('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x5963('0x14')](function(_0x14358d){logger[_0x5963('0x1c')](_0x5963('0x1e'),_0x117a10);logger[_0x5963('0x17')]('CreateSmsMessage',_0x117a10,JSON['stringify'](_0x14358d));_0x12b15c(_0x14358d);})[_0x5963('0x21')](function(_0x54e208){logger['error'](_0x5963('0x1e'),_0x54e208[_0x5963('0x1b')],_0x117a10);_0x198e8f(_0xbcde7['error'](0x1f4,_0x54e208['message']));});});}; \ No newline at end of file +var _0x2eca=['message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x3c4f93,_0x24be5c){var _0x56d097=function(_0x30ad6e){while(--_0x30ad6e){_0x3c4f93['push'](_0x3c4f93['shift']());}};_0x56d097(++_0x24be5c);}(_0x2eca,0x144));var _0xa2ec=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0x2eca[_0x441db3];return _0x16c05d;};'use strict';var _=require(_0xa2ec('0x0'));var util=require(_0xa2ec('0x1'));var moment=require(_0xa2ec('0x2'));var BPromise=require(_0xa2ec('0x3'));var rs=require(_0xa2ec('0x4'));var fs=require('fs');var Redis=require(_0xa2ec('0x5'));var db=require(_0xa2ec('0x6'))['db'];var utils=require(_0xa2ec('0x7'));var logger=require(_0xa2ec('0x8'))(_0xa2ec('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2ec('0xa')][_0xa2ec('0xb')]({'port':0x232a});config[_0xa2ec('0xc')]=_[_0xa2ec('0xd')](config['redis'],{'host':_0xa2ec('0xe'),'port':0x18eb});var socket=require(_0xa2ec('0xf'))(new Redis(config[_0xa2ec('0xc')]));require(_0xa2ec('0x10'))[_0xa2ec('0x11')](socket);function respondWithRpcPromise(_0x34af41,_0x291f53,_0x7f1656){return new BPromise(function(_0x3a4204,_0x158283){return client[_0xa2ec('0x12')](_0x34af41,_0x7f1656)[_0xa2ec('0x13')](function(_0x440fc6){logger['info'](_0xa2ec('0x14'),_0x291f53,'request\x20sent');logger[_0xa2ec('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x291f53,_0xa2ec('0x16'),JSON[_0xa2ec('0x17')](_0x440fc6));if(_0x440fc6[_0xa2ec('0x18')]){if(_0x440fc6[_0xa2ec('0x18')][_0xa2ec('0x19')]===0x1f4){logger['error'](_0xa2ec('0x14'),_0x291f53,_0x440fc6['error'][_0xa2ec('0x1a')]);return _0x158283(_0x440fc6['error'][_0xa2ec('0x1a')]);}logger[_0xa2ec('0x18')](_0xa2ec('0x14'),_0x291f53,_0x440fc6[_0xa2ec('0x18')][_0xa2ec('0x1a')]);return _0x3a4204(_0x440fc6[_0xa2ec('0x18')][_0xa2ec('0x1a')]);}else{logger[_0xa2ec('0x1b')](_0xa2ec('0x14'),_0x291f53,_0xa2ec('0x16'));_0x3a4204(_0x440fc6[_0xa2ec('0x1c')][_0xa2ec('0x1a')]);}})[_0xa2ec('0x1d')](function(_0x2b9d63){logger[_0xa2ec('0x18')](_0xa2ec('0x14'),_0x291f53,_0x2b9d63);_0x158283(_0x2b9d63);});});}exports[_0xa2ec('0x1e')]=function(_0x3dee7c){var _0x2cac6e=this;return new Promise(function(_0x39636f,_0x37c6fb){return db[_0xa2ec('0x1f')][_0xa2ec('0x20')](_0x3dee7c[_0xa2ec('0x21')],{'raw':_0x3dee7c['options']?_0x3dee7c[_0xa2ec('0x22')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x21ab79){logger[_0xa2ec('0x1b')](_0xa2ec('0x1e'),_0x3dee7c);logger['debug'](_0xa2ec('0x1e'),_0x3dee7c,JSON['stringify'](_0x21ab79));_0x39636f(_0x21ab79);})['catch'](function(_0x4ca0a5){logger[_0xa2ec('0x18')](_0xa2ec('0x1e'),_0x4ca0a5[_0xa2ec('0x1a')],_0x3dee7c);_0x37c6fb(_0x2cac6e[_0xa2ec('0x18')](0x1f4,_0x4ca0a5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 639987b..88d2485 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 _0x5e64=['length','./smsMessage.events','save','update','emit','removeListener','register'];(function(_0x19cccf,_0x55b5ee){var _0x211fb5=function(_0x816770){while(--_0x816770){_0x19cccf['push'](_0x19cccf['shift']());}};_0x211fb5(++_0x55b5ee);}(_0x5e64,0xe1));var _0x45e6=function(_0x284998,_0x4c8733){_0x284998=_0x284998-0x0;var _0x1db6d6=_0x5e64[_0x284998];return _0x1db6d6;};'use strict';var SmsMessageEvents=require(_0x45e6('0x0'));var events=[_0x45e6('0x1'),'remove',_0x45e6('0x2')];function createListener(_0x2b8887,_0x3a1871){return function(_0x52221e){_0x3a1871[_0x45e6('0x3')](_0x2b8887,_0x52221e);};}function removeListener(_0x594144,_0x2ecc67){return function(){SmsMessageEvents[_0x45e6('0x4')](_0x594144,_0x2ecc67);};}exports[_0x45e6('0x5')]=function(_0x24408c){for(var _0x4add01=0x0,_0xdbac2c=events[_0x45e6('0x6')];_0x4add01<_0xdbac2c;_0x4add01++){var _0x564f9c=events[_0x4add01];var _0x5aa658=createListener('smsMessage:'+_0x564f9c,_0x24408c);SmsMessageEvents['on'](_0x564f9c,_0x5aa658);}}; \ No newline at end of file +var _0xd0dc=['emit','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x153ebe,_0x248c17){var _0x485fe8=function(_0x1a88ec){while(--_0x1a88ec){_0x153ebe['push'](_0x153ebe['shift']());}};_0x485fe8(++_0x248c17);}(_0xd0dc,0xc1));var _0xcd0d=function(_0x312a7f,_0x509e83){_0x312a7f=_0x312a7f-0x0;var _0x2fb5ba=_0xd0dc[_0x312a7f];return _0x2fb5ba;};'use strict';var SmsMessageEvents=require(_0xcd0d('0x0'));var events=[_0xcd0d('0x1'),_0xcd0d('0x2'),'update'];function createListener(_0x4b8e02,_0x52f930){return function(_0x5dbcbe){_0x52f930[_0xcd0d('0x3')](_0x4b8e02,_0x5dbcbe);};}function removeListener(_0x35d0a6,_0x13c2f0){return function(){SmsMessageEvents['removeListener'](_0x35d0a6,_0x13c2f0);};}exports[_0xcd0d('0x4')]=function(_0x45e5b0){for(var _0x1e2cf3=0x0,_0x4aa68f=events[_0xcd0d('0x5')];_0x1e2cf3<_0x4aa68f;_0x1e2cf3++){var _0x151175=events[_0x1e2cf3];var _0x203765=createListener(_0xcd0d('0x6')+_0x151175,_0x45e5b0);SmsMessageEvents['on'](_0x151175,_0x203765);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 90019b3..51be340 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 _0x1938=['destroy','delete','removeTeams','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update'];(function(_0x1ed368,_0x89545f){var _0x514bad=function(_0x4e2bcf){while(--_0x4e2bcf){_0x1ed368['push'](_0x1ed368['shift']());}};_0x514bad(++_0x89545f);}(_0x1938,0xc1));var _0x8193=function(_0x11f46b,_0x10109b){_0x11f46b=_0x11f46b-0x0;var _0x324159=_0x1938[_0x11f46b];return _0x324159;};'use strict';var multer=require(_0x8193('0x0'));var util=require(_0x8193('0x1'));var path=require(_0x8193('0x2'));var timeout=require('connect-timeout');var express=require(_0x8193('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8193('0x4'));var interaction=require(_0x8193('0x5'));var config=require(_0x8193('0x6'));var controller=require(_0x8193('0x7'));router['get']('/',auth[_0x8193('0x8')](),controller[_0x8193('0x9')]);router[_0x8193('0xa')]('/describe',auth[_0x8193('0x8')](),controller[_0x8193('0xb')]);router['get'](_0x8193('0xc'),auth[_0x8193('0x8')](),controller['show']);router[_0x8193('0xa')](_0x8193('0xd'),auth[_0x8193('0x8')](),controller[_0x8193('0xe')]);router[_0x8193('0xa')](_0x8193('0xf'),auth[_0x8193('0x8')](),controller[_0x8193('0x10')]);router[_0x8193('0xa')](_0x8193('0x11'),auth['isAuthenticated'](),controller[_0x8193('0x12')]);router[_0x8193('0x13')]('/',auth['isAuthenticated'](),controller[_0x8193('0x14')]);router[_0x8193('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x8193('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x8193('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8193('0x16')]);router['delete'](_0x8193('0xc'),auth[_0x8193('0x8')](),controller[_0x8193('0x17')]);router[_0x8193('0x18')](_0x8193('0xf'),auth[_0x8193('0x8')](),controller[_0x8193('0x19')]);router[_0x8193('0x18')]('/:id/users',auth[_0x8193('0x8')](),controller[_0x8193('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x5c06=['get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller'];(function(_0x134ad3,_0x165e06){var _0x1ca07e=function(_0x401063){while(--_0x401063){_0x134ad3['push'](_0x134ad3['shift']());}};_0x1ca07e(++_0x165e06);}(_0x5c06,0x6c));var _0x65c0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5c06[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x65c0('0x0'));var util=require('util');var path=require(_0x65c0('0x1'));var timeout=require(_0x65c0('0x2'));var express=require(_0x65c0('0x3'));var router=express['Router']();var fs_extra=require(_0x65c0('0x4'));var auth=require(_0x65c0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65c0('0x6'));var controller=require(_0x65c0('0x7'));router[_0x65c0('0x8')]('/',auth[_0x65c0('0x9')](),controller[_0x65c0('0xa')]);router['get'](_0x65c0('0xb'),auth['isAuthenticated'](),controller[_0x65c0('0xc')]);router[_0x65c0('0x8')](_0x65c0('0xd'),auth[_0x65c0('0x9')](),controller['show']);router['get'](_0x65c0('0xe'),auth[_0x65c0('0x9')](),controller[_0x65c0('0xf')]);router[_0x65c0('0x8')](_0x65c0('0x10'),auth[_0x65c0('0x9')](),controller[_0x65c0('0x11')]);router[_0x65c0('0x8')](_0x65c0('0x12'),auth[_0x65c0('0x9')](),controller[_0x65c0('0x13')]);router[_0x65c0('0x14')]('/',auth[_0x65c0('0x9')](),controller[_0x65c0('0x15')]);router[_0x65c0('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x65c0('0x16')]);router[_0x65c0('0x14')]('/:id/users',auth[_0x65c0('0x9')](),controller[_0x65c0('0x17')]);router['put'](_0x65c0('0xd'),auth[_0x65c0('0x9')](),controller[_0x65c0('0x18')]);router[_0x65c0('0x19')](_0x65c0('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x65c0('0x19')](_0x65c0('0x10'),auth[_0x65c0('0x9')](),controller[_0x65c0('0x1a')]);router[_0x65c0('0x19')](_0x65c0('0x12'),auth[_0x65c0('0x9')](),controller[_0x65c0('0x1b')]);module[_0x65c0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d804d3c..b9f8c39 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 _0x63a6=['exports','name','STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x343471,_0x3aa054){var _0x451d1b=function(_0x12ff6c){while(--_0x12ff6c){_0x343471['push'](_0x343471['shift']());}};_0x451d1b(++_0x3aa054);}(_0x63a6,0x1b1));var _0x663a=function(_0xd95342,_0xb75bf6){_0xd95342=_0xd95342-0x0;var _0x54d694=_0x63a6[_0xd95342];return _0x54d694;};'use strict';var Sequelize=require(_0x663a('0x0'));module[_0x663a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x663a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x663a('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x663a('0x4')](_0x663a('0x5'),'beepall',_0x663a('0x6'))}}; \ No newline at end of file +var _0xc3f5=['INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x4e7c1c,_0x56eafd){var _0x47adb2=function(_0x346135){while(--_0x346135){_0x4e7c1c['push'](_0x4e7c1c['shift']());}};_0x47adb2(++_0x56eafd);}(_0xc3f5,0x71));var _0x5c3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc3f5[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5c3f('0x0'));module[_0x5c3f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5c3f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c3f('0x3')](_0x5c3f('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index cd1dbf6..a014871 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 _0xb714=['filters','merge','filter','options','includeAll','include','findAll','show','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','rows','format','%s/%s','SIP','createdAt','Team','getTeams','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userSmsQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x25a53f,_0x280976){var _0x1c1dd6=function(_0x2ebd64){while(--_0x2ebd64){_0x25a53f['push'](_0x25a53f['shift']());}};_0x1c1dd6(++_0x280976);}(_0xb714,0x1eb));var _0x4b71=function(_0x5e8d8b,_0x3defdb){_0x5e8d8b=_0x5e8d8b-0x0;var _0xc38051=_0xb714[_0x5e8d8b];return _0xc38051;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b71('0x0'));var zipdir=require(_0x4b71('0x1'));var jsonpatch=require(_0x4b71('0x2'));var rp=require(_0x4b71('0x3'));var moment=require(_0x4b71('0x4'));var BPromise=require(_0x4b71('0x5'));var Mustache=require(_0x4b71('0x6'));var util=require(_0x4b71('0x7'));var path=require('path');var sox=require(_0x4b71('0x8'));var csv=require(_0x4b71('0x9'));var ejs=require(_0x4b71('0xa'));var fs=require('fs');var fs_extra=require(_0x4b71('0xb'));var _=require('lodash');var squel=require(_0x4b71('0xc'));var crypto=require(_0x4b71('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4b71('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4b71('0x11'));var as=require(_0x4b71('0x12'));var hardwareService=require(_0x4b71('0x13'));var logger=require(_0x4b71('0x14'))(_0x4b71('0x15'));var utils=require(_0x4b71('0x16'));var config=require(_0x4b71('0x17'));var licenseUtil=require(_0x4b71('0x18'));var db=require('../../mysqldb')['db'];config[_0x4b71('0x19')]=_[_0x4b71('0x1a')](config[_0x4b71('0x19')],{'host':_0x4b71('0x1b'),'port':0x18eb});var socket=require(_0x4b71('0x1c'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x4b71('0x1d')](socket);function respondWithStatusCode(_0x5b1b3e,_0x5a2392){_0x5a2392=_0x5a2392||0xcc;return function(_0x5e7213){if(_0x5e7213){return _0x5b1b3e[_0x4b71('0x1e')](_0x5a2392);}return _0x5b1b3e['status'](_0x5a2392)[_0x4b71('0x1f')]();};}function respondWithResult(_0x24099a,_0x233356){_0x233356=_0x233356||0xc8;return function(_0x4b139c){if(_0x4b139c){return _0x24099a[_0x4b71('0x20')](_0x233356)[_0x4b71('0x21')](_0x4b139c);}};}function respondWithFilteredResult(_0x17b210,_0x565cfe){return function(_0xcaa973){if(_0xcaa973){var _0x23fc2b=typeof _0x565cfe[_0x4b71('0x22')]===_0x4b71('0x23')&&typeof _0x565cfe[_0x4b71('0x24')]===_0x4b71('0x23');var _0x3d68df=_0xcaa973[_0x4b71('0x25')];var _0x31a149=_0x23fc2b?0x0:_0x565cfe['offset'];var _0x10a979=_0x23fc2b?_0xcaa973['count']:_0x565cfe[_0x4b71('0x22')]+_0x565cfe[_0x4b71('0x24')];var _0x2337d0;if(_0x10a979>=_0x3d68df){_0x10a979=_0x3d68df;_0x2337d0=0xc8;}else{_0x2337d0=0xce;}_0x17b210[_0x4b71('0x20')](_0x2337d0);return _0x17b210[_0x4b71('0x26')]('Content-Range',_0x31a149+'-'+_0x10a979+'/'+_0x3d68df)[_0x4b71('0x21')](_0xcaa973);}return null;};}function patchUpdates(_0x11cbbf){return function(_0x2bf139){try{jsonpatch['apply'](_0x2bf139,_0x11cbbf,!![]);}catch(_0x23d208){return BPromise['reject'](_0x23d208);}return _0x2bf139[_0x4b71('0x27')]();};}function saveUpdates(_0x3b1acf,_0x5f5012){return function(_0x24bb2f){if(_0x24bb2f){return _0x24bb2f[_0x4b71('0x28')](_0x3b1acf)[_0x4b71('0x29')](function(_0x4f66e6){return _0x4f66e6;});}return null;};}function removeEntity(_0x4a9398,_0x41b53f){return function(_0x14353e){if(_0x14353e){return _0x14353e[_0x4b71('0x2a')]()[_0x4b71('0x29')](function(){var _0x3e90c3=_0x14353e['get']({'plain':!![]});var _0x13ef6a=_0x4b71('0x2b');return db[_0x4b71('0x2c')][_0x4b71('0x2a')]({'where':{'type':_0x13ef6a,'resourceId':_0x3e90c3['id']}})[_0x4b71('0x29')](function(){return _0x14353e;});})[_0x4b71('0x29')](function(){_0x4a9398[_0x4b71('0x20')](0xcc)[_0x4b71('0x1f')]();});}};}function handleEntityNotFound(_0x454cad,_0x4deb52){return function(_0x59b88f){if(!_0x59b88f){_0x454cad[_0x4b71('0x1e')](0x194);}return _0x59b88f;};}function handleError(_0x3866b9,_0x14cc36){_0x14cc36=_0x14cc36||0x1f4;return function(_0x450eb7){logger['error'](_0x450eb7[_0x4b71('0x2d')]);if(_0x450eb7[_0x4b71('0x2e')]){delete _0x450eb7[_0x4b71('0x2e')];}_0x3866b9['status'](_0x14cc36)[_0x4b71('0x2f')](_0x450eb7);};}exports[_0x4b71('0x30')]=function(_0x5c611d,_0xaea2b4){var _0x58a8bc={},_0x57ff1c={},_0x5ae622={'count':0x0,'rows':[]};var _0x256ca8=_[_0x4b71('0x31')](db[_0x4b71('0x32')][_0x4b71('0x33')],function(_0x4511d5){return{'name':_0x4511d5['fieldName'],'type':_0x4511d5[_0x4b71('0x34')][_0x4b71('0x35')]};});_0x57ff1c[_0x4b71('0x36')]=_['map'](_0x256ca8,'name');_0x57ff1c['query']=_[_0x4b71('0x37')](_0x5c611d[_0x4b71('0x38')]);_0x57ff1c['filters']=_[_0x4b71('0x39')](_0x57ff1c['model'],_0x57ff1c[_0x4b71('0x38')]);_0x58a8bc[_0x4b71('0x3a')]=_[_0x4b71('0x39')](_0x57ff1c[_0x4b71('0x36')],qs[_0x4b71('0x3b')](_0x5c611d[_0x4b71('0x38')][_0x4b71('0x3b')]));_0x58a8bc[_0x4b71('0x3a')]=_0x58a8bc[_0x4b71('0x3a')][_0x4b71('0x3c')]?_0x58a8bc[_0x4b71('0x3a')]:_0x57ff1c['model'];if(!_0x5c611d[_0x4b71('0x38')][_0x4b71('0x3d')]('nolimit')){_0x58a8bc[_0x4b71('0x24')]=qs[_0x4b71('0x24')](_0x5c611d[_0x4b71('0x38')][_0x4b71('0x24')]);_0x58a8bc[_0x4b71('0x22')]=qs[_0x4b71('0x22')](_0x5c611d[_0x4b71('0x38')][_0x4b71('0x22')]);}_0x58a8bc['order']=qs[_0x4b71('0x3e')](_0x5c611d[_0x4b71('0x38')][_0x4b71('0x3e')]);_0x58a8bc[_0x4b71('0x3f')]=qs['filters'](_[_0x4b71('0x40')](_0x5c611d[_0x4b71('0x38')],_0x57ff1c[_0x4b71('0x41')]),_0x256ca8);if(_0x5c611d[_0x4b71('0x38')]['filter']){_0x58a8bc['where']=_[_0x4b71('0x42')](_0x58a8bc[_0x4b71('0x3f')],{'$or':_[_0x4b71('0x31')](_0x256ca8,function(_0x305048){if(_0x305048[_0x4b71('0x34')]!=='VIRTUAL'){var _0x5a663c={};_0x5a663c[_0x305048[_0x4b71('0x2e')]]={'$like':'%'+_0x5c611d['query'][_0x4b71('0x43')]+'%'};return _0x5a663c;}})});}_0x58a8bc=_[_0x4b71('0x42')]({},_0x58a8bc,_0x5c611d[_0x4b71('0x44')]);var _0x1d8043={'where':_0x58a8bc[_0x4b71('0x3f')]};return db['SmsQueue'][_0x4b71('0x25')](_0x1d8043)['then'](function(_0xbfe9f7){_0x5ae622[_0x4b71('0x25')]=_0xbfe9f7;if(_0x5c611d[_0x4b71('0x38')][_0x4b71('0x45')]){_0x58a8bc[_0x4b71('0x46')]=[{'all':!![]}];}return db['SmsQueue'][_0x4b71('0x47')](_0x58a8bc);})[_0x4b71('0x29')](function(_0x22df53){_0x5ae622['rows']=_0x22df53;return _0x5ae622;})[_0x4b71('0x29')](respondWithFilteredResult(_0xaea2b4,_0x58a8bc))['catch'](handleError(_0xaea2b4,null));};exports[_0x4b71('0x48')]=function(_0x5bbe33,_0x966a15){var _0x7af4e2={'raw':!![],'where':{'id':_0x5bbe33[_0x4b71('0x49')]['id']}},_0x38f620={};_0x38f620[_0x4b71('0x36')]=_[_0x4b71('0x37')](db[_0x4b71('0x32')][_0x4b71('0x33')]);_0x38f620[_0x4b71('0x38')]=_[_0x4b71('0x37')](_0x5bbe33['query']);_0x38f620[_0x4b71('0x41')]=_[_0x4b71('0x39')](_0x38f620['model'],_0x38f620[_0x4b71('0x38')]);_0x7af4e2[_0x4b71('0x3a')]=_['intersection'](_0x38f620[_0x4b71('0x36')],qs[_0x4b71('0x3b')](_0x5bbe33['query']['fields']));_0x7af4e2['attributes']=_0x7af4e2[_0x4b71('0x3a')]['length']?_0x7af4e2[_0x4b71('0x3a')]:_0x38f620[_0x4b71('0x36')];if(_0x5bbe33[_0x4b71('0x38')][_0x4b71('0x45')]){_0x7af4e2[_0x4b71('0x46')]=[{'all':!![]}];}_0x7af4e2=_[_0x4b71('0x42')]({},_0x7af4e2,_0x5bbe33[_0x4b71('0x44')]);return db[_0x4b71('0x32')][_0x4b71('0x4a')](_0x7af4e2)[_0x4b71('0x29')](handleEntityNotFound(_0x966a15,null))[_0x4b71('0x29')](respondWithResult(_0x966a15,null))[_0x4b71('0x4b')](handleError(_0x966a15,null));};exports['create']=function(_0x3d4775,_0x21b4fc){return db[_0x4b71('0x32')]['create'](_0x3d4775[_0x4b71('0x4c')],{})[_0x4b71('0x29')](function(_0x467b88){var _0x4b55c3=_0x3d4775[_0x4b71('0x4d')]['get']({'plain':!![]});if(!_0x4b55c3)throw new Error(_0x4b71('0x4e'));if(_0x4b55c3[_0x4b71('0x4f')]===_0x4b71('0x4d')){var _0x3be60c=_0x467b88[_0x4b71('0x50')]({'plain':!![]});var _0x1e311f=_0x4b71('0x2b');return db[_0x4b71('0x51')][_0x4b71('0x4a')]({'where':{'name':_0x1e311f,'userProfileId':_0x4b55c3['userProfileId']},'raw':!![]})['then'](function(_0x50b6de){if(_0x50b6de&&_0x50b6de['autoAssociation']===0x0){return db[_0x4b71('0x2c')]['create']({'name':_0x3be60c[_0x4b71('0x2e')],'resourceId':_0x3be60c['id'],'type':_0x50b6de[_0x4b71('0x2e')],'sectionId':_0x50b6de['id']},{})[_0x4b71('0x29')](function(){return _0x467b88;});}else{return _0x467b88;}})['catch'](function(_0x5f5eaf){logger['error'](_0x4b71('0x52'),_0x5f5eaf);throw _0x5f5eaf;});}return _0x467b88;})[_0x4b71('0x29')](respondWithResult(_0x21b4fc,0xc9))['catch'](handleError(_0x21b4fc,null));};exports[_0x4b71('0x28')]=function(_0xe4fa6d,_0x5922e4){if(_0xe4fa6d[_0x4b71('0x4c')]['id']){delete _0xe4fa6d['body']['id'];}return db[_0x4b71('0x32')][_0x4b71('0x4a')]({'where':{'id':_0xe4fa6d[_0x4b71('0x49')]['id']}})['then'](handleEntityNotFound(_0x5922e4,null))['then'](saveUpdates(_0xe4fa6d[_0x4b71('0x4c')],null))[_0x4b71('0x29')](respondWithResult(_0x5922e4,null))[_0x4b71('0x4b')](handleError(_0x5922e4,null));};exports['destroy']=function(_0x4461e4,_0xff35ff){return db[_0x4b71('0x32')][_0x4b71('0x4a')]({'where':{'id':_0x4461e4[_0x4b71('0x49')]['id']}})['then'](handleEntityNotFound(_0xff35ff,null))[_0x4b71('0x29')](removeEntity(_0xff35ff,null))[_0x4b71('0x4b')](handleError(_0xff35ff,null));};exports[_0x4b71('0x53')]=function(_0x5e032b,_0x15fe4b){return db['SmsQueue'][_0x4b71('0x53')]()[_0x4b71('0x29')](respondWithResult(_0x15fe4b,null))[_0x4b71('0x4b')](handleError(_0x15fe4b,null));};exports[_0x4b71('0x54')]=function(_0x2830db,_0xf6ec9a,_0x3d215e){var _0x54c0cf={'raw':!![],'where':{}},_0x4307f6={},_0x7187f2;return db[_0x4b71('0x32')][_0x4b71('0x55')]({'where':{'id':_0x2830db[_0x4b71('0x49')]['id']}})['then'](handleEntityNotFound(_0xf6ec9a,null))['then'](function(_0x105fc2){if(_0x105fc2){_0x7187f2=_0x105fc2[_0x4b71('0x50')]({'plain':!![]});_0x4307f6[_0x4b71('0x36')]=_['keys'](db[_0x4b71('0x56')][_0x4b71('0x33')]);_0x4307f6['query']=_['keys'](_0x2830db[_0x4b71('0x38')]);_0x4307f6['filters']=_[_0x4b71('0x39')](_0x4307f6[_0x4b71('0x36')],_0x4307f6[_0x4b71('0x38')]);_0x54c0cf['attributes']=_['intersection'](_0x4307f6[_0x4b71('0x36')],qs[_0x4b71('0x3b')](_0x2830db[_0x4b71('0x38')]['fields']));_0x54c0cf[_0x4b71('0x3a')]=_0x54c0cf[_0x4b71('0x3a')][_0x4b71('0x3c')]?_0x54c0cf[_0x4b71('0x3a')]:_0x4307f6[_0x4b71('0x36')];if(!_0x2830db[_0x4b71('0x38')][_0x4b71('0x3d')]('nolimit')){_0x54c0cf[_0x4b71('0x24')]=qs['limit'](_0x2830db['query'][_0x4b71('0x24')]);_0x54c0cf[_0x4b71('0x22')]=qs[_0x4b71('0x22')](_0x2830db['query']['offset']);}_0x54c0cf[_0x4b71('0x57')]=qs['sort'](_0x2830db[_0x4b71('0x38')]['sort']);_0x54c0cf[_0x4b71('0x3f')]=qs[_0x4b71('0x41')](_[_0x4b71('0x40')](_0x2830db[_0x4b71('0x38')],_0x4307f6['filters']));_0x54c0cf[_0x4b71('0x3f')][_0x4b71('0x58')]=_0x105fc2['id'];if(_0x2830db[_0x4b71('0x38')][_0x4b71('0x43')]){_0x54c0cf[_0x4b71('0x3f')]=_[_0x4b71('0x42')](_0x54c0cf['where'],{'$or':_[_0x4b71('0x31')](_0x54c0cf['attributes'],function(_0x33964e){var _0x33ab19={};_0x33ab19[_0x33964e]={'$like':'%'+_0x2830db[_0x4b71('0x38')]['filter']+'%'};return _0x33ab19;})});}_0x54c0cf=_[_0x4b71('0x42')]({},_0x54c0cf,_0x2830db[_0x4b71('0x44')]);return db[_0x4b71('0x56')]['findAll'](_0x54c0cf);}})[_0x4b71('0x29')](function(_0x273645){if(_0x273645){return db[_0x4b71('0x59')][_0x4b71('0x5a')]({'where':{'id':_[_0x4b71('0x31')](_0x273645,'UserId'),'role':_0x4b71('0x5b')},'attributes':['id',_0x4b71('0x2e'),_0x4b71('0x5c'),_0x4b71('0x5d'),'createdAt']});}})[_0x4b71('0x29')](function(_0x14601a){if(_0x14601a){return{'count':_0x14601a[_0x4b71('0x25')],'rows':_[_0x4b71('0x31')](_0x14601a[_0x4b71('0x5e')],function(_0x37436f){return{'membername':_0x37436f[_0x4b71('0x2e')],'UserId':_0x37436f['id'],'queue_name':_0x7187f2[_0x4b71('0x2e')],'SmsQueueId':_0x7187f2['id'],'interface':util[_0x4b71('0x5f')](_0x4b71('0x60'),_0x4b71('0x61'),_0x37436f[_0x4b71('0x2e')]),'penalty':0x0,'paused':_0x37436f[_0x4b71('0x5c')],'createdAt':_0x37436f[_0x4b71('0x62')],'updatedAt':_0x37436f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b71('0x29')](respondWithFilteredResult(_0xf6ec9a,_0x54c0cf))['catch'](handleError(_0xf6ec9a,null));};exports['getTeams']=function(_0x2d22dd,_0x1d135a,_0x5964d1){var _0x4387ca={};var _0x3c549b={};var _0x1a8eea;var _0x241edb;return db[_0x4b71('0x32')]['findOne']({'where':{'id':_0x2d22dd[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](handleEntityNotFound(_0x1d135a,null))['then'](function(_0x19b761){if(_0x19b761){_0x1a8eea=_0x19b761;_0x3c549b[_0x4b71('0x36')]=_[_0x4b71('0x37')](db[_0x4b71('0x63')][_0x4b71('0x33')]);_0x3c549b[_0x4b71('0x38')]=_['keys'](_0x2d22dd[_0x4b71('0x38')]);_0x3c549b[_0x4b71('0x41')]=_[_0x4b71('0x39')](_0x3c549b[_0x4b71('0x36')],_0x3c549b[_0x4b71('0x38')]);_0x4387ca[_0x4b71('0x3a')]=_[_0x4b71('0x39')](_0x3c549b[_0x4b71('0x36')],qs[_0x4b71('0x3b')](_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x3b')]));_0x4387ca[_0x4b71('0x3a')]=_0x4387ca[_0x4b71('0x3a')][_0x4b71('0x3c')]?_0x4387ca['attributes']:_0x3c549b[_0x4b71('0x36')];_0x4387ca[_0x4b71('0x57')]=qs[_0x4b71('0x3e')](_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x3e')]);_0x4387ca['where']=qs[_0x4b71('0x41')](_[_0x4b71('0x40')](_0x2d22dd[_0x4b71('0x38')],_0x3c549b[_0x4b71('0x41')]));if(_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x43')]){_0x4387ca['where']=_[_0x4b71('0x42')](_0x4387ca['where'],{'$or':_[_0x4b71('0x31')](_0x4387ca[_0x4b71('0x3a')],function(_0x3fd973){var _0x386bde={};_0x386bde[_0x3fd973]={'$like':'%'+_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x43')]+'%'};return _0x386bde;})});}_0x4387ca=_[_0x4b71('0x42')]({},_0x4387ca,_0x2d22dd[_0x4b71('0x44')]);return _0x1a8eea[_0x4b71('0x64')](_0x4387ca);}})[_0x4b71('0x29')](function(_0xd5d41){if(_0xd5d41){_0x241edb=_0xd5d41[_0x4b71('0x3c')];if(!_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x3d')](_0x4b71('0x65'))){_0x4387ca['limit']=qs[_0x4b71('0x24')](_0x2d22dd[_0x4b71('0x38')][_0x4b71('0x24')]);_0x4387ca['offset']=qs[_0x4b71('0x22')](_0x2d22dd[_0x4b71('0x38')]['offset']);}return _0x1a8eea[_0x4b71('0x64')](_0x4387ca);}})['then'](function(_0x34f8ec){if(_0x34f8ec){return _0x34f8ec?{'count':_0x241edb,'rows':_0x34f8ec}:null;}})['then'](respondWithResult(_0x1d135a,null))[_0x4b71('0x4b')](handleError(_0x1d135a,null));};exports[_0x4b71('0x66')]=function(_0x4f6123,_0x102aed,_0x17950c){var _0x1a83e5=_0x4f6123[_0x4b71('0x4c')]['ids'];return db[_0x4b71('0x63')][_0x4b71('0x47')]({'where':{'id':_0x1a83e5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b71('0x67'),'attributes':['id','name',_0x4b71('0x68'),_0x4b71('0x69'),_0x4b71('0x6a')],'raw':!![]}]})[_0x4b71('0x29')](function(_0x30aa3f){if(_0x30aa3f){var _0x244d4a=_[_0x4b71('0x6b')](_0x30aa3f,function(_0x4221b2){var _0x2de791=_0x4221b2[_0x4b71('0x50')]({'plain':!![]});return _0x2de791['Agents'];});return db[_0x4b71('0x32')][_0x4b71('0x4a')]({'where':{'id':_0x4f6123[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](function(_0x303702){return db[_0x4b71('0x6c')][_0x4b71('0x6d')](function(_0x4ce18d){return _0x303702[_0x4b71('0x66')](_0x1a83e5,{'transaction':_0x4ce18d})[_0x4b71('0x29')](function(){return BPromise[_0x4b71('0x6e')](_0x244d4a,function(_0x4a660c){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4a660c['id'],'SmsQueueId':_0x4f6123['params']['id']},'transaction':_0x4ce18d});});})[_0x4b71('0x29')](function(){_0x244d4a['forEach'](function(_0x1179ca){socket[_0x4b71('0x6f')](_0x4b71('0x70'),{'UserId':_0x1179ca['id'],'SmsQueueId':_0x303702['id']});});});});});}})[_0x4b71('0x29')](respondWithStatusCode(_0x102aed,null))[_0x4b71('0x4b')](handleError(_0x102aed,null));};exports[_0x4b71('0x71')]=function(_0x499329,_0x3258aa,_0xd72af2){return db[_0x4b71('0x63')]['findAll']({'where':{'id':_0x499329[_0x4b71('0x38')][_0x4b71('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4b71('0x29')](handleEntityNotFound(_0x3258aa,null))[_0x4b71('0x29')](function(_0x5d3cfb){var _0x14deba=_[_0x4b71('0x31')](_0x5d3cfb,'id');var _0x3fa4af=[];var _0x241221=[];var _0x35339e=squel[_0x4b71('0x73')]();_0x35339e[_0x4b71('0x74')]('tq.TeamId')[_0x4b71('0x75')]('team_has_sms_queues','tq')[_0x4b71('0x76')](_0x4b71('0x77'),'ut',_0x4b71('0x78'))[_0x4b71('0x3f')](_0x4b71('0x79'),_0x499329[_0x4b71('0x49')]['id']);for(var _0x520612=0x0;_0x520612<_0x5d3cfb['length'];_0x520612+=0x1){let _0x73d0a4=_0x5d3cfb[_0x520612];for(var _0x4b4990=0x0;_0x4b4990<_0x73d0a4[_0x4b71('0x67')]['length'];_0x4b4990+=0x1){let _0xb74251=_0x73d0a4[_0x4b71('0x67')][_0x4b4990];var _0x27e40b=_0x35339e[_0x4b71('0x7a')]();_0x27e40b[_0x4b71('0x3f')](_0x4b71('0x7b'),_0xb74251['id']);_0x241221[_0x4b71('0x7c')](db['sequelize']['query'](_0x27e40b[_0x4b71('0x7d')](),{'type':db[_0x4b71('0x6c')]['QueryTypes']['SELECT']})[_0x4b71('0x29')](function(_0x271030){if(_0x271030[_0x4b71('0x3c')]===0x1){return _0xb74251['id'];}else{var _0x55f86a=_[_0x4b71('0x7e')](_[_0x4b71('0x31')](_0x271030,_0x4b71('0x7f')),function(_0x5723e1){return _[_0x4b71('0x80')](_0x14deba,_0x5723e1);});if(_0x55f86a){return _0xb74251['id'];}}}));}}return BPromise[_0x4b71('0x81')](_0x241221)['then'](function(_0x41ecc4){_0x3fa4af=_(_0x3fa4af)[_0x4b71('0x82')](_0x41ecc4)['compact']()[_0x4b71('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x499329[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](function(_0x3386f4){return db[_0x4b71('0x6c')]['transaction'](function(_0x2d8970){return _0x3386f4['removeTeams'](_0x499329[_0x4b71('0x38')][_0x4b71('0x72')],{'transaction':_0x2d8970})[_0x4b71('0x29')](function(){if(!_['isEmpty'](_0x3fa4af)){return _0x3386f4[_0x4b71('0x84')](_0x3fa4af,{'transaction':_0x2d8970});}})[_0x4b71('0x29')](function(){_0x3fa4af[_0x4b71('0x85')](function(_0x5938bc){socket[_0x4b71('0x6f')](_0x4b71('0x86'),{'UserId':_0x5938bc,'SmsQueueId':_0x3386f4['id']});});});});});});})[_0x4b71('0x29')](respondWithStatusCode(_0x3258aa,null))['catch'](handleError(_0x3258aa,null));};exports[_0x4b71('0x87')]=function(_0x5ea540,_0x4d9c79,_0x3a5ef5){return db['SmsQueue'][_0x4b71('0x4a')]({'where':{'id':_0x5ea540[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](handleEntityNotFound(_0x4d9c79,null))['then'](function(_0x402b62){if(_0x402b62){return _0x402b62[_0x4b71('0x87')](_0x5ea540[_0x4b71('0x4c')][_0x4b71('0x72')],_[_0x4b71('0x88')](_0x5ea540[_0x4b71('0x4c')],['ids','id'])||{})[_0x4b71('0x89')](function(_0x141da0){for(var _0x8588f=0x0;_0x8588f<_0x5ea540[_0x4b71('0x4c')]['ids']['length'];_0x8588f+=0x1){socket[_0x4b71('0x6f')]('userSmsQueue:save',{'UserId':Number(_0x5ea540[_0x4b71('0x4c')][_0x4b71('0x72')][_0x8588f]),'SmsQueueId':Number(_0x5ea540[_0x4b71('0x49')]['id'])});}return _0x141da0;});}})[_0x4b71('0x29')](respondWithResult(_0x4d9c79,null))[_0x4b71('0x4b')](handleError(_0x4d9c79,null));};exports[_0x4b71('0x84')]=function(_0x47cada,_0x1ece7f,_0x2e5243){return db[_0x4b71('0x32')][_0x4b71('0x4a')]({'where':{'id':_0x47cada[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](handleEntityNotFound(_0x1ece7f,null))[_0x4b71('0x29')](function(_0x458294){if(_0x458294){return _0x458294[_0x4b71('0x84')](_0x47cada[_0x4b71('0x38')][_0x4b71('0x72')])[_0x4b71('0x29')](function(){if(_['isArray'](_0x47cada['query']['ids'])){for(var _0x150042=0x0;_0x150042<_0x47cada['query']['ids'][_0x4b71('0x3c')];_0x150042+=0x1){socket[_0x4b71('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x47cada[_0x4b71('0x38')][_0x4b71('0x72')][_0x150042]),'SmsQueueId':Number(_0x47cada['params']['id'])});}}else{socket['emit'](_0x4b71('0x86'),{'UserId':Number(_0x47cada[_0x4b71('0x38')][_0x4b71('0x72')]),'SmsQueueId':Number(_0x47cada[_0x4b71('0x49')]['id'])});}});}})[_0x4b71('0x29')](respondWithStatusCode(_0x1ece7f,null))[_0x4b71('0x4b')](handleError(_0x1ece7f,null));};exports['getAgents']=function(_0x384a2e,_0x218c77,_0x3579ef){var _0x2f7bb1={};var _0x211814={};var _0x34cb2e;var _0x1a4f28;return db[_0x4b71('0x32')][_0x4b71('0x55')]({'where':{'id':_0x384a2e[_0x4b71('0x49')]['id']}})[_0x4b71('0x29')](handleEntityNotFound(_0x218c77,null))['then'](function(_0x172e58){if(_0x172e58){_0x34cb2e=_0x172e58;_0x211814[_0x4b71('0x36')]=_[_0x4b71('0x37')](db[_0x4b71('0x59')][_0x4b71('0x33')]);_0x211814['query']=_[_0x4b71('0x37')](_0x384a2e[_0x4b71('0x38')]);_0x211814['filters']=_[_0x4b71('0x39')](_0x211814[_0x4b71('0x36')],_0x211814[_0x4b71('0x38')]);_0x2f7bb1[_0x4b71('0x3a')]=_[_0x4b71('0x39')](_0x211814[_0x4b71('0x36')],qs[_0x4b71('0x3b')](_0x384a2e[_0x4b71('0x38')][_0x4b71('0x3b')]));_0x2f7bb1[_0x4b71('0x3a')]=_0x2f7bb1['attributes'][_0x4b71('0x3c')]?_0x2f7bb1['attributes']:_0x211814[_0x4b71('0x36')];_0x2f7bb1[_0x4b71('0x57')]=qs[_0x4b71('0x3e')](_0x384a2e[_0x4b71('0x38')]['sort']);_0x2f7bb1['where']=qs[_0x4b71('0x41')](_[_0x4b71('0x40')](_0x384a2e['query'],_0x211814[_0x4b71('0x41')]));if(_0x384a2e['query'][_0x4b71('0x43')]){_0x2f7bb1[_0x4b71('0x3f')]=_[_0x4b71('0x42')](_0x2f7bb1[_0x4b71('0x3f')],{'$or':_[_0x4b71('0x31')](_0x2f7bb1[_0x4b71('0x3a')],function(_0x45a2be){var _0x51cf83={};_0x51cf83[_0x45a2be]={'$like':'%'+_0x384a2e[_0x4b71('0x38')][_0x4b71('0x43')]+'%'};return _0x51cf83;})});}_0x2f7bb1=_[_0x4b71('0x42')]({},_0x2f7bb1,_0x384a2e[_0x4b71('0x44')]);return _0x34cb2e[_0x4b71('0x8a')](_0x2f7bb1);}})[_0x4b71('0x29')](function(_0x4c6ae3){if(_0x4c6ae3){_0x1a4f28=_0x4c6ae3[_0x4b71('0x3c')];if(!_0x384a2e['query'][_0x4b71('0x3d')](_0x4b71('0x65'))){_0x2f7bb1[_0x4b71('0x24')]=qs[_0x4b71('0x24')](_0x384a2e[_0x4b71('0x38')][_0x4b71('0x24')]);_0x2f7bb1[_0x4b71('0x22')]=qs['offset'](_0x384a2e[_0x4b71('0x38')][_0x4b71('0x22')]);}return _0x34cb2e[_0x4b71('0x8a')](_0x2f7bb1);}})['then'](function(_0xfe2bb9){if(_0xfe2bb9){return _0xfe2bb9?{'count':_0x1a4f28,'rows':_0xfe2bb9}:null;}})['then'](respondWithResult(_0x218c77,null))[_0x4b71('0x4b')](handleError(_0x218c77,null));}; \ No newline at end of file +var _0x0309=['includes','union','isEmpty','removeAgents','userSmsQueue:remove','addAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','sendStatus','error','stack','name','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','SmsQueueId','User','UserId','agent','smsPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','ids','online','voicePause','interface','flatMap','transaction','addTeams','each','UserSmsQueue','forEach','emit','removeTeams','Agents','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT'];(function(_0x5e7176,_0xc0a402){var _0x40ca1d=function(_0x9f25b2){while(--_0x9f25b2){_0x5e7176['push'](_0x5e7176['shift']());}};_0x40ca1d(++_0xc0a402);}(_0x0309,0x8d));var _0x9030=function(_0x522bcf,_0x290caf){_0x522bcf=_0x522bcf-0x0;var _0x4b5453=_0x0309[_0x522bcf];return _0x4b5453;};'use strict';var emlformat=require(_0x9030('0x0'));var rimraf=require(_0x9030('0x1'));var zipdir=require(_0x9030('0x2'));var jsonpatch=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var moment=require('moment');var BPromise=require(_0x9030('0x5'));var Mustache=require(_0x9030('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9030('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9030('0x8'));var squel=require('squel');var crypto=require(_0x9030('0x9'));var jsforce=require(_0x9030('0xa'));var deskjs=require(_0x9030('0xb'));var toCsv=require(_0x9030('0xc'));var querystring=require(_0x9030('0xd'));var Papa=require(_0x9030('0xe'));var Redis=require(_0x9030('0xf'));var authService=require(_0x9030('0x10'));var qs=require(_0x9030('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9030('0x12'));var logger=require('../../config/logger')(_0x9030('0x13'));var utils=require(_0x9030('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9030('0x15'));var db=require('../../mysqldb')['db'];config[_0x9030('0x16')]=_['defaults'](config[_0x9030('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9030('0x17'))(new Redis(config[_0x9030('0x16')]));require(_0x9030('0x18'))[_0x9030('0x19')](socket);function respondWithStatusCode(_0x551021,_0x5a879a){_0x5a879a=_0x5a879a||0xcc;return function(_0x5f0f25){if(_0x5f0f25){return _0x551021['sendStatus'](_0x5a879a);}return _0x551021[_0x9030('0x1a')](_0x5a879a)[_0x9030('0x1b')]();};}function respondWithResult(_0x4b8351,_0x3895d0){_0x3895d0=_0x3895d0||0xc8;return function(_0xccfccb){if(_0xccfccb){return _0x4b8351['status'](_0x3895d0)[_0x9030('0x1c')](_0xccfccb);}};}function respondWithFilteredResult(_0x4bc394,_0x43016c){return function(_0x4960fd){if(_0x4960fd){var _0x5802bd=typeof _0x43016c[_0x9030('0x1d')]===_0x9030('0x1e')&&typeof _0x43016c[_0x9030('0x1f')]===_0x9030('0x1e');var _0x42207a=_0x4960fd[_0x9030('0x20')];var _0x3207ad=_0x5802bd?0x0:_0x43016c['offset'];var _0x19ef2a=_0x5802bd?_0x4960fd[_0x9030('0x20')]:_0x43016c[_0x9030('0x1d')]+_0x43016c[_0x9030('0x1f')];var _0x56c9a5;if(_0x19ef2a>=_0x42207a){_0x19ef2a=_0x42207a;_0x56c9a5=0xc8;}else{_0x56c9a5=0xce;}_0x4bc394[_0x9030('0x1a')](_0x56c9a5);return _0x4bc394['set']('Content-Range',_0x3207ad+'-'+_0x19ef2a+'/'+_0x42207a)[_0x9030('0x1c')](_0x4960fd);}return null;};}function patchUpdates(_0x350ef3){return function(_0x55d3a7){try{jsonpatch[_0x9030('0x21')](_0x55d3a7,_0x350ef3,!![]);}catch(_0x2c26ed){return BPromise[_0x9030('0x22')](_0x2c26ed);}return _0x55d3a7[_0x9030('0x23')]();};}function saveUpdates(_0x2cb254,_0x3fd61d){return function(_0x359900){if(_0x359900){return _0x359900[_0x9030('0x24')](_0x2cb254)[_0x9030('0x25')](function(_0x46f19c){return _0x46f19c;});}return null;};}function removeEntity(_0x1ae92e,_0x53dbc2){return function(_0xe7e11a){if(_0xe7e11a){return _0xe7e11a[_0x9030('0x26')]()['then'](function(){var _0x1761ee=_0xe7e11a['get']({'plain':!![]});var _0x249b66=_0x9030('0x27');return db[_0x9030('0x28')]['destroy']({'where':{'type':_0x249b66,'resourceId':_0x1761ee['id']}})[_0x9030('0x25')](function(){return _0xe7e11a;});})['then'](function(){_0x1ae92e['status'](0xcc)[_0x9030('0x1b')]();});}};}function handleEntityNotFound(_0x3af16a,_0x1afa08){return function(_0x5328c5){if(!_0x5328c5){_0x3af16a[_0x9030('0x29')](0x194);}return _0x5328c5;};}function handleError(_0x5245a7,_0x494a77){_0x494a77=_0x494a77||0x1f4;return function(_0x51da2a){logger[_0x9030('0x2a')](_0x51da2a[_0x9030('0x2b')]);if(_0x51da2a[_0x9030('0x2c')]){delete _0x51da2a['name'];}_0x5245a7[_0x9030('0x1a')](_0x494a77)['send'](_0x51da2a);};}exports[_0x9030('0x2d')]=function(_0xbed7eb,_0x1f6355){var _0xcff932={},_0x546d55={},_0x4a5c20={'count':0x0,'rows':[]};var _0x43b6c2=_['map'](db[_0x9030('0x2e')][_0x9030('0x2f')],function(_0x239c50){return{'name':_0x239c50[_0x9030('0x30')],'type':_0x239c50[_0x9030('0x31')][_0x9030('0x32')]};});_0x546d55[_0x9030('0x33')]=_['map'](_0x43b6c2,'name');_0x546d55[_0x9030('0x34')]=_[_0x9030('0x35')](_0xbed7eb['query']);_0x546d55[_0x9030('0x36')]=_[_0x9030('0x37')](_0x546d55[_0x9030('0x33')],_0x546d55[_0x9030('0x34')]);_0xcff932[_0x9030('0x38')]=_[_0x9030('0x37')](_0x546d55[_0x9030('0x33')],qs['fields'](_0xbed7eb[_0x9030('0x34')][_0x9030('0x39')]));_0xcff932[_0x9030('0x38')]=_0xcff932['attributes'][_0x9030('0x3a')]?_0xcff932[_0x9030('0x38')]:_0x546d55[_0x9030('0x33')];if(!_0xbed7eb[_0x9030('0x34')][_0x9030('0x3b')](_0x9030('0x3c'))){_0xcff932['limit']=qs[_0x9030('0x1f')](_0xbed7eb['query']['limit']);_0xcff932['offset']=qs['offset'](_0xbed7eb['query'][_0x9030('0x1d')]);}_0xcff932[_0x9030('0x3d')]=qs[_0x9030('0x3e')](_0xbed7eb[_0x9030('0x34')][_0x9030('0x3e')]);_0xcff932[_0x9030('0x3f')]=qs[_0x9030('0x36')](_[_0x9030('0x40')](_0xbed7eb[_0x9030('0x34')],_0x546d55[_0x9030('0x36')]),_0x43b6c2);if(_0xbed7eb['query']['filter']){_0xcff932[_0x9030('0x3f')]=_[_0x9030('0x41')](_0xcff932['where'],{'$or':_[_0x9030('0x42')](_0x43b6c2,function(_0x1dcd29){if(_0x1dcd29[_0x9030('0x31')]!=='VIRTUAL'){var _0x1d436b={};_0x1d436b[_0x1dcd29[_0x9030('0x2c')]]={'$like':'%'+_0xbed7eb[_0x9030('0x34')][_0x9030('0x43')]+'%'};return _0x1d436b;}})});}_0xcff932=_[_0x9030('0x41')]({},_0xcff932,_0xbed7eb[_0x9030('0x44')]);var _0x5236a8={'where':_0xcff932[_0x9030('0x3f')]};return db[_0x9030('0x2e')][_0x9030('0x20')](_0x5236a8)[_0x9030('0x25')](function(_0x5c95ec){_0x4a5c20['count']=_0x5c95ec;if(_0xbed7eb[_0x9030('0x34')][_0x9030('0x45')]){_0xcff932[_0x9030('0x46')]=[{'all':!![]}];}return db[_0x9030('0x2e')][_0x9030('0x47')](_0xcff932);})[_0x9030('0x25')](function(_0x2b14cd){_0x4a5c20[_0x9030('0x48')]=_0x2b14cd;return _0x4a5c20;})[_0x9030('0x25')](respondWithFilteredResult(_0x1f6355,_0xcff932))[_0x9030('0x49')](handleError(_0x1f6355,null));};exports[_0x9030('0x4a')]=function(_0x33836e,_0x1f0e49){var _0x218c51={'raw':!![],'where':{'id':_0x33836e[_0x9030('0x4b')]['id']}},_0x1d9211={};_0x1d9211['model']=_['keys'](db[_0x9030('0x2e')]['rawAttributes']);_0x1d9211[_0x9030('0x34')]=_[_0x9030('0x35')](_0x33836e[_0x9030('0x34')]);_0x1d9211[_0x9030('0x36')]=_['intersection'](_0x1d9211[_0x9030('0x33')],_0x1d9211[_0x9030('0x34')]);_0x218c51[_0x9030('0x38')]=_['intersection'](_0x1d9211[_0x9030('0x33')],qs[_0x9030('0x39')](_0x33836e['query']['fields']));_0x218c51['attributes']=_0x218c51[_0x9030('0x38')][_0x9030('0x3a')]?_0x218c51[_0x9030('0x38')]:_0x1d9211[_0x9030('0x33')];if(_0x33836e[_0x9030('0x34')]['includeAll']){_0x218c51[_0x9030('0x46')]=[{'all':!![]}];}_0x218c51=_[_0x9030('0x41')]({},_0x218c51,_0x33836e[_0x9030('0x44')]);return db[_0x9030('0x2e')][_0x9030('0x4c')](_0x218c51)['then'](handleEntityNotFound(_0x1f0e49,null))[_0x9030('0x25')](respondWithResult(_0x1f0e49,null))['catch'](handleError(_0x1f0e49,null));};exports[_0x9030('0x4d')]=function(_0x4df4d5,_0x3023b9){return db[_0x9030('0x2e')][_0x9030('0x4d')](_0x4df4d5[_0x9030('0x4e')],{})[_0x9030('0x25')](function(_0x55c8b8){var _0x524da6=_0x4df4d5[_0x9030('0x4f')][_0x9030('0x50')]({'plain':!![]});if(!_0x524da6)throw new Error(_0x9030('0x51'));if(_0x524da6[_0x9030('0x52')]===_0x9030('0x4f')){var _0x587e6a=_0x55c8b8[_0x9030('0x50')]({'plain':!![]});var _0x52d097=_0x9030('0x27');return db[_0x9030('0x53')]['find']({'where':{'name':_0x52d097,'userProfileId':_0x524da6['userProfileId']},'raw':!![]})[_0x9030('0x25')](function(_0x3e6c7c){if(_0x3e6c7c&&_0x3e6c7c[_0x9030('0x54')]===0x0){return db[_0x9030('0x28')][_0x9030('0x4d')]({'name':_0x587e6a[_0x9030('0x2c')],'resourceId':_0x587e6a['id'],'type':_0x3e6c7c[_0x9030('0x2c')],'sectionId':_0x3e6c7c['id']},{})[_0x9030('0x25')](function(){return _0x55c8b8;});}else{return _0x55c8b8;}})[_0x9030('0x49')](function(_0x5c030b){logger[_0x9030('0x2a')](_0x9030('0x55'),_0x5c030b);throw _0x5c030b;});}return _0x55c8b8;})['then'](respondWithResult(_0x3023b9,0xc9))[_0x9030('0x49')](handleError(_0x3023b9,null));};exports[_0x9030('0x24')]=function(_0x4acda3,_0x59d701){if(_0x4acda3[_0x9030('0x4e')]['id']){delete _0x4acda3[_0x9030('0x4e')]['id'];}return db[_0x9030('0x2e')][_0x9030('0x4c')]({'where':{'id':_0x4acda3[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](handleEntityNotFound(_0x59d701,null))[_0x9030('0x25')](saveUpdates(_0x4acda3['body'],null))[_0x9030('0x25')](respondWithResult(_0x59d701,null))[_0x9030('0x49')](handleError(_0x59d701,null));};exports['destroy']=function(_0x196b71,_0x419693){return db[_0x9030('0x2e')]['find']({'where':{'id':_0x196b71[_0x9030('0x4b')]['id']}})['then'](handleEntityNotFound(_0x419693,null))['then'](removeEntity(_0x419693,null))['catch'](handleError(_0x419693,null));};exports['describe']=function(_0x595e04,_0x2e7742){return db[_0x9030('0x2e')]['describe']()[_0x9030('0x25')](respondWithResult(_0x2e7742,null))[_0x9030('0x49')](handleError(_0x2e7742,null));};exports[_0x9030('0x56')]=function(_0x1049e3,_0x5f1af9,_0x44d0b3){var _0x4b21f0={'raw':!![],'where':{}},_0x919d6f={},_0x8fe0d1;return db[_0x9030('0x2e')][_0x9030('0x57')]({'where':{'id':_0x1049e3[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](handleEntityNotFound(_0x5f1af9,null))[_0x9030('0x25')](function(_0x1bb35a){if(_0x1bb35a){_0x8fe0d1=_0x1bb35a[_0x9030('0x50')]({'plain':!![]});_0x919d6f[_0x9030('0x33')]=_[_0x9030('0x35')](db['UserSmsQueue'][_0x9030('0x2f')]);_0x919d6f[_0x9030('0x34')]=_[_0x9030('0x35')](_0x1049e3[_0x9030('0x34')]);_0x919d6f[_0x9030('0x36')]=_[_0x9030('0x37')](_0x919d6f[_0x9030('0x33')],_0x919d6f['query']);_0x4b21f0[_0x9030('0x38')]=_[_0x9030('0x37')](_0x919d6f[_0x9030('0x33')],qs[_0x9030('0x39')](_0x1049e3[_0x9030('0x34')][_0x9030('0x39')]));_0x4b21f0[_0x9030('0x38')]=_0x4b21f0[_0x9030('0x38')][_0x9030('0x3a')]?_0x4b21f0[_0x9030('0x38')]:_0x919d6f[_0x9030('0x33')];if(!_0x1049e3[_0x9030('0x34')]['hasOwnProperty'](_0x9030('0x3c'))){_0x4b21f0['limit']=qs['limit'](_0x1049e3[_0x9030('0x34')][_0x9030('0x1f')]);_0x4b21f0[_0x9030('0x1d')]=qs[_0x9030('0x1d')](_0x1049e3[_0x9030('0x34')][_0x9030('0x1d')]);}_0x4b21f0[_0x9030('0x3d')]=qs[_0x9030('0x3e')](_0x1049e3[_0x9030('0x34')][_0x9030('0x3e')]);_0x4b21f0[_0x9030('0x3f')]=qs['filters'](_[_0x9030('0x40')](_0x1049e3[_0x9030('0x34')],_0x919d6f[_0x9030('0x36')]));_0x4b21f0[_0x9030('0x3f')][_0x9030('0x58')]=_0x1bb35a['id'];if(_0x1049e3[_0x9030('0x34')][_0x9030('0x43')]){_0x4b21f0['where']=_[_0x9030('0x41')](_0x4b21f0[_0x9030('0x3f')],{'$or':_[_0x9030('0x42')](_0x4b21f0[_0x9030('0x38')],function(_0x2a514f){var _0x1aa600={};_0x1aa600[_0x2a514f]={'$like':'%'+_0x1049e3[_0x9030('0x34')][_0x9030('0x43')]+'%'};return _0x1aa600;})});}_0x4b21f0=_[_0x9030('0x41')]({},_0x4b21f0,_0x1049e3[_0x9030('0x44')]);return db['UserSmsQueue'][_0x9030('0x47')](_0x4b21f0);}})[_0x9030('0x25')](function(_0x507b0c){if(_0x507b0c){return db[_0x9030('0x59')]['findAndCountAll']({'where':{'id':_[_0x9030('0x42')](_0x507b0c,_0x9030('0x5a')),'role':_0x9030('0x5b')},'attributes':['id',_0x9030('0x2c'),_0x9030('0x5c'),'updatedAt','createdAt']});}})[_0x9030('0x25')](function(_0x24fc5a){if(_0x24fc5a){return{'count':_0x24fc5a[_0x9030('0x20')],'rows':_['map'](_0x24fc5a[_0x9030('0x48')],function(_0x17f841){return{'membername':_0x17f841[_0x9030('0x2c')],'UserId':_0x17f841['id'],'queue_name':_0x8fe0d1[_0x9030('0x2c')],'SmsQueueId':_0x8fe0d1['id'],'interface':util[_0x9030('0x5d')](_0x9030('0x5e'),_0x9030('0x5f'),_0x17f841[_0x9030('0x2c')]),'penalty':0x0,'paused':_0x17f841[_0x9030('0x5c')],'createdAt':_0x17f841[_0x9030('0x60')],'updatedAt':_0x17f841[_0x9030('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9030('0x25')](respondWithFilteredResult(_0x5f1af9,_0x4b21f0))[_0x9030('0x49')](handleError(_0x5f1af9,null));};exports[_0x9030('0x62')]=function(_0x1ca0b4,_0x1fc740,_0x43bd91){var _0xb58e93={};var _0x83d2c9={};var _0x22eb68;var _0x283d35;return db['SmsQueue'][_0x9030('0x57')]({'where':{'id':_0x1ca0b4[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](handleEntityNotFound(_0x1fc740,null))[_0x9030('0x25')](function(_0x1ccbe2){if(_0x1ccbe2){_0x22eb68=_0x1ccbe2;_0x83d2c9['model']=_[_0x9030('0x35')](db[_0x9030('0x63')]['rawAttributes']);_0x83d2c9[_0x9030('0x34')]=_[_0x9030('0x35')](_0x1ca0b4[_0x9030('0x34')]);_0x83d2c9['filters']=_[_0x9030('0x37')](_0x83d2c9['model'],_0x83d2c9[_0x9030('0x34')]);_0xb58e93[_0x9030('0x38')]=_['intersection'](_0x83d2c9[_0x9030('0x33')],qs[_0x9030('0x39')](_0x1ca0b4[_0x9030('0x34')][_0x9030('0x39')]));_0xb58e93['attributes']=_0xb58e93['attributes'][_0x9030('0x3a')]?_0xb58e93[_0x9030('0x38')]:_0x83d2c9['model'];_0xb58e93[_0x9030('0x3d')]=qs[_0x9030('0x3e')](_0x1ca0b4['query'][_0x9030('0x3e')]);_0xb58e93[_0x9030('0x3f')]=qs['filters'](_[_0x9030('0x40')](_0x1ca0b4[_0x9030('0x34')],_0x83d2c9[_0x9030('0x36')]));if(_0x1ca0b4[_0x9030('0x34')]['filter']){_0xb58e93[_0x9030('0x3f')]=_[_0x9030('0x41')](_0xb58e93['where'],{'$or':_['map'](_0xb58e93[_0x9030('0x38')],function(_0x3384aa){var _0x5d0837={};_0x5d0837[_0x3384aa]={'$like':'%'+_0x1ca0b4[_0x9030('0x34')][_0x9030('0x43')]+'%'};return _0x5d0837;})});}_0xb58e93=_['merge']({},_0xb58e93,_0x1ca0b4[_0x9030('0x44')]);return _0x22eb68[_0x9030('0x62')](_0xb58e93);}})[_0x9030('0x25')](function(_0xb365){if(_0xb365){_0x283d35=_0xb365[_0x9030('0x3a')];if(!_0x1ca0b4[_0x9030('0x34')]['hasOwnProperty'](_0x9030('0x3c'))){_0xb58e93[_0x9030('0x1f')]=qs[_0x9030('0x1f')](_0x1ca0b4['query'][_0x9030('0x1f')]);_0xb58e93[_0x9030('0x1d')]=qs['offset'](_0x1ca0b4[_0x9030('0x34')][_0x9030('0x1d')]);}return _0x22eb68[_0x9030('0x62')](_0xb58e93);}})['then'](function(_0x963f57){if(_0x963f57){return _0x963f57?{'count':_0x283d35,'rows':_0x963f57}:null;}})[_0x9030('0x25')](respondWithResult(_0x1fc740,null))['catch'](handleError(_0x1fc740,null));};exports['addTeams']=function(_0x2ea62f,_0x883903,_0x167b1d){var _0x160558=_0x2ea62f['body'][_0x9030('0x64')];return db[_0x9030('0x63')][_0x9030('0x47')]({'where':{'id':_0x160558},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9030('0x2c'),_0x9030('0x65'),_0x9030('0x66'),_0x9030('0x67')],'raw':!![]}]})[_0x9030('0x25')](function(_0x5eca1a){if(_0x5eca1a){var _0x39630b=_[_0x9030('0x68')](_0x5eca1a,function(_0x4a9283){var _0x473fac=_0x4a9283[_0x9030('0x50')]({'plain':!![]});return _0x473fac['Agents'];});return db[_0x9030('0x2e')][_0x9030('0x4c')]({'where':{'id':_0x2ea62f[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](function(_0x5264e2){return db['sequelize'][_0x9030('0x69')](function(_0x14b1e7){return _0x5264e2[_0x9030('0x6a')](_0x160558,{'transaction':_0x14b1e7})['then'](function(){return BPromise[_0x9030('0x6b')](_0x39630b,function(_0x5cfd25){return db[_0x9030('0x6c')]['findOrCreate']({'where':{'UserId':_0x5cfd25['id'],'SmsQueueId':_0x2ea62f[_0x9030('0x4b')]['id']},'transaction':_0x14b1e7});});})['then'](function(){_0x39630b[_0x9030('0x6d')](function(_0x57bfb5){socket[_0x9030('0x6e')]('userSmsQueue:save',{'UserId':_0x57bfb5['id'],'SmsQueueId':_0x5264e2['id']});});});});});}})['then'](respondWithStatusCode(_0x883903,null))[_0x9030('0x49')](handleError(_0x883903,null));};exports[_0x9030('0x6f')]=function(_0x50c4e9,_0x2ba8de,_0x5b3e7e){return db[_0x9030('0x63')][_0x9030('0x47')]({'where':{'id':_0x50c4e9[_0x9030('0x34')][_0x9030('0x64')]},'attributes':['id'],'include':[{'model':db[_0x9030('0x59')],'as':_0x9030('0x70'),'attributes':['id'],'raw':!![]}]})[_0x9030('0x25')](handleEntityNotFound(_0x2ba8de,null))[_0x9030('0x25')](function(_0x1ac9f5){var _0x636237=_[_0x9030('0x42')](_0x1ac9f5,'id');var _0x39d157=[];var _0x40f3b2=[];var _0x2c1286=squel[_0x9030('0x71')]();_0x2c1286[_0x9030('0x72')](_0x9030('0x73'))[_0x9030('0x74')](_0x9030('0x75'),'tq')[_0x9030('0x76')](_0x9030('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9030('0x3f')](_0x9030('0x78'),_0x50c4e9['params']['id']);for(var _0x155d65=0x0;_0x155d65<_0x1ac9f5[_0x9030('0x3a')];_0x155d65+=0x1){let _0xbb392e=_0x1ac9f5[_0x155d65];for(var _0x3b67ad=0x0;_0x3b67ad<_0xbb392e['Agents'][_0x9030('0x3a')];_0x3b67ad+=0x1){let _0x53c562=_0xbb392e[_0x9030('0x70')][_0x3b67ad];var _0x2337ac=_0x2c1286['clone']();_0x2337ac['where'](_0x9030('0x79'),_0x53c562['id']);_0x40f3b2[_0x9030('0x7a')](db['sequelize'][_0x9030('0x34')](_0x2337ac[_0x9030('0x7b')](),{'type':db[_0x9030('0x7c')][_0x9030('0x7d')][_0x9030('0x7e')]})[_0x9030('0x25')](function(_0x424e96){if(_0x424e96[_0x9030('0x3a')]===0x1){return _0x53c562['id'];}else{var _0x5d48f6=_['every'](_[_0x9030('0x42')](_0x424e96,'TeamId'),function(_0x1edea8){return _[_0x9030('0x7f')](_0x636237,_0x1edea8);});if(_0x5d48f6){return _0x53c562['id'];}}}));}}return BPromise['all'](_0x40f3b2)[_0x9030('0x25')](function(_0x2d46d7){_0x39d157=_(_0x39d157)[_0x9030('0x80')](_0x2d46d7)['compact']()['value']();return db[_0x9030('0x2e')][_0x9030('0x4c')]({'where':{'id':_0x50c4e9[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](function(_0x1db9f0){return db[_0x9030('0x7c')][_0x9030('0x69')](function(_0x31cf00){return _0x1db9f0['removeTeams'](_0x50c4e9['query']['ids'],{'transaction':_0x31cf00})[_0x9030('0x25')](function(){if(!_[_0x9030('0x81')](_0x39d157)){return _0x1db9f0[_0x9030('0x82')](_0x39d157,{'transaction':_0x31cf00});}})[_0x9030('0x25')](function(){_0x39d157[_0x9030('0x6d')](function(_0x2bcb05){socket[_0x9030('0x6e')](_0x9030('0x83'),{'UserId':_0x2bcb05,'SmsQueueId':_0x1db9f0['id']});});});});});});})[_0x9030('0x25')](respondWithStatusCode(_0x2ba8de,null))[_0x9030('0x49')](handleError(_0x2ba8de,null));};exports[_0x9030('0x84')]=function(_0xf3758c,_0x596c7c,_0x3b8ad6){return db[_0x9030('0x2e')][_0x9030('0x4c')]({'where':{'id':_0xf3758c[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](handleEntityNotFound(_0x596c7c,null))[_0x9030('0x25')](function(_0x4b6643){if(_0x4b6643){return _0x4b6643[_0x9030('0x84')](_0xf3758c['body']['ids'],_['omit'](_0xf3758c['body'],['ids','id'])||{})['spread'](function(_0x2e9d30){for(var _0x10481=0x0;_0x10481<_0xf3758c['body'][_0x9030('0x64')][_0x9030('0x3a')];_0x10481+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0xf3758c[_0x9030('0x4e')]['ids'][_0x10481]),'SmsQueueId':Number(_0xf3758c[_0x9030('0x4b')]['id'])});}return _0x2e9d30;});}})['then'](respondWithResult(_0x596c7c,null))[_0x9030('0x49')](handleError(_0x596c7c,null));};exports[_0x9030('0x82')]=function(_0x34d849,_0x4a2db6,_0x53a9ef){return db['SmsQueue']['find']({'where':{'id':_0x34d849[_0x9030('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a2db6,null))[_0x9030('0x25')](function(_0x3eaebd){if(_0x3eaebd){return _0x3eaebd[_0x9030('0x82')](_0x34d849[_0x9030('0x34')][_0x9030('0x64')])['then'](function(){if(_['isArray'](_0x34d849[_0x9030('0x34')][_0x9030('0x64')])){for(var _0x4491fa=0x0;_0x4491fa<_0x34d849['query'][_0x9030('0x64')][_0x9030('0x3a')];_0x4491fa+=0x1){socket[_0x9030('0x6e')](_0x9030('0x83'),{'UserId':Number(_0x34d849[_0x9030('0x34')][_0x9030('0x64')][_0x4491fa]),'SmsQueueId':Number(_0x34d849[_0x9030('0x4b')]['id'])});}}else{socket[_0x9030('0x6e')](_0x9030('0x83'),{'UserId':Number(_0x34d849[_0x9030('0x34')][_0x9030('0x64')]),'SmsQueueId':Number(_0x34d849['params']['id'])});}});}})[_0x9030('0x25')](respondWithStatusCode(_0x4a2db6,null))['catch'](handleError(_0x4a2db6,null));};exports[_0x9030('0x85')]=function(_0x115379,_0x2c5c43,_0x2d1847){var _0x552759={};var _0x8dd5b9={};var _0x424db7;var _0xbb6017;return db[_0x9030('0x2e')][_0x9030('0x57')]({'where':{'id':_0x115379[_0x9030('0x4b')]['id']}})[_0x9030('0x25')](handleEntityNotFound(_0x2c5c43,null))[_0x9030('0x25')](function(_0x273fbc){if(_0x273fbc){_0x424db7=_0x273fbc;_0x8dd5b9[_0x9030('0x33')]=_[_0x9030('0x35')](db[_0x9030('0x59')][_0x9030('0x2f')]);_0x8dd5b9[_0x9030('0x34')]=_[_0x9030('0x35')](_0x115379[_0x9030('0x34')]);_0x8dd5b9[_0x9030('0x36')]=_[_0x9030('0x37')](_0x8dd5b9[_0x9030('0x33')],_0x8dd5b9[_0x9030('0x34')]);_0x552759[_0x9030('0x38')]=_[_0x9030('0x37')](_0x8dd5b9[_0x9030('0x33')],qs['fields'](_0x115379[_0x9030('0x34')][_0x9030('0x39')]));_0x552759[_0x9030('0x38')]=_0x552759[_0x9030('0x38')][_0x9030('0x3a')]?_0x552759['attributes']:_0x8dd5b9['model'];_0x552759['order']=qs[_0x9030('0x3e')](_0x115379['query'][_0x9030('0x3e')]);_0x552759['where']=qs[_0x9030('0x36')](_['pick'](_0x115379[_0x9030('0x34')],_0x8dd5b9['filters']));if(_0x115379[_0x9030('0x34')][_0x9030('0x43')]){_0x552759['where']=_[_0x9030('0x41')](_0x552759[_0x9030('0x3f')],{'$or':_[_0x9030('0x42')](_0x552759[_0x9030('0x38')],function(_0x42527a){var _0x2aadf5={};_0x2aadf5[_0x42527a]={'$like':'%'+_0x115379[_0x9030('0x34')]['filter']+'%'};return _0x2aadf5;})});}_0x552759=_[_0x9030('0x41')]({},_0x552759,_0x115379[_0x9030('0x44')]);return _0x424db7[_0x9030('0x85')](_0x552759);}})[_0x9030('0x25')](function(_0x5ef1b4){if(_0x5ef1b4){_0xbb6017=_0x5ef1b4['length'];if(!_0x115379['query'][_0x9030('0x3b')]('nolimit')){_0x552759['limit']=qs[_0x9030('0x1f')](_0x115379[_0x9030('0x34')]['limit']);_0x552759[_0x9030('0x1d')]=qs[_0x9030('0x1d')](_0x115379[_0x9030('0x34')][_0x9030('0x1d')]);}return _0x424db7[_0x9030('0x85')](_0x552759);}})[_0x9030('0x25')](function(_0x1e7737){if(_0x1e7737){return _0x1e7737?{'count':_0xbb6017,'rows':_0x1e7737}:null;}})['then'](respondWithResult(_0x2c5c43,null))[_0x9030('0x49')](handleError(_0x2c5c43,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f22d49e..ca86eda 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 _0x184d=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x375c0b,_0x567d67){var _0x4c4bec=function(_0x560ca1){while(--_0x560ca1){_0x375c0b['push'](_0x375c0b['shift']());}};_0x4c4bec(++_0x567d67);}(_0x184d,0x1b8));var _0xd184=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x184d[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xd184('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd184('0x1')](0x0);var events={'afterCreate':_0xd184('0x2'),'afterUpdate':_0xd184('0x3'),'afterDestroy':_0xd184('0x4')};function emitEvent(_0x4e5fe1){return function(_0x4e5af7,_0x1e6827,_0x335f1c){SmsQueueEvents['emit'](_0x4e5fe1+':'+_0x4e5af7['id'],_0x4e5af7);SmsQueueEvents[_0xd184('0x5')](_0x4e5fe1,_0x4e5af7);_0x335f1c(null);};}for(var e in events){if(events[_0xd184('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xd184('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x353b=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x353b,0x1a8));var _0xb353=function(_0x29982b,_0x594e0){_0x29982b=_0x29982b-0x0;var _0xb1f0a9=_0x353b[_0x29982b];return _0xb1f0a9;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb353('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb353('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb353('0x2'),'afterDestroy':_0xb353('0x3')};function emitEvent(_0x19816f){return function(_0x3891ae,_0x472a41,_0x339d18){SmsQueueEvents[_0xb353('0x4')](_0x19816f+':'+_0x3891ae['id'],_0x3891ae);SmsQueueEvents[_0xb353('0x4')](_0x19816f,_0x3891ae);_0x339d18(null);};}for(var e in events){if(events[_0xb353('0x5')](e)){var event=events[e];SmsQueue[_0xb353('0x6')](e,emitEvent(event));}}module[_0xb353('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 868c1db..5b77e72 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 _0xb8c3=['moment','bluebird','request-promise','path','rimraf','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x40b981,_0x48b308){var _0x58696b=function(_0x892e46){while(--_0x892e46){_0x40b981['push'](_0x40b981['shift']());}};_0x58696b(++_0x48b308);}(_0xb8c3,0x127));var _0x3b8c=function(_0x320401,_0x4836fb){_0x320401=_0x320401-0x0;var _0x3ec105=_0xb8c3[_0x320401];return _0x3ec105;};'use strict';var _=require(_0x3b8c('0x0'));var util=require(_0x3b8c('0x1'));var logger=require(_0x3b8c('0x2'))(_0x3b8c('0x3'));var moment=require(_0x3b8c('0x4'));var BPromise=require(_0x3b8c('0x5'));var rp=require(_0x3b8c('0x6'));var fs=require('fs');var path=require(_0x3b8c('0x7'));var rimraf=require(_0x3b8c('0x8'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x3b8c('0x9')]=function(_0x8fbc18,_0x1c00cd){return _0x8fbc18[_0x3b8c('0xa')](_0x3b8c('0xb'),attributes,{'tableName':_0x3b8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc40a=['../../config/logger','bluebird','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc40a,0x148));var _0xac40=function(_0x3d962b,_0x4c7d80){_0x3d962b=_0x3d962b-0x0;var _0x4cdc0e=_0xc40a[_0x3d962b];return _0x4cdc0e;};'use strict';var _=require(_0xac40('0x0'));var util=require(_0xac40('0x1'));var logger=require(_0xac40('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac40('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac40('0x4'));var config=require('../../config/environment');var attributes=require(_0xac40('0x5'));module[_0xac40('0x6')]=function(_0xfa9745,_0x30207c){return _0xfa9745[_0xac40('0x7')](_0xac40('0x8'),attributes,{'tableName':_0xac40('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 271076f..4b7899a 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 _0x6c9d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','include','map','model','ShowSmsQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x692282,_0x279660){var _0x172aa8=function(_0x5bd982){while(--_0x5bd982){_0x692282['push'](_0x692282['shift']());}};_0x172aa8(++_0x279660);}(_0x6c9d,0x78));var _0xd6c9=function(_0x1bbad0,_0x34e914){_0x1bbad0=_0x1bbad0-0x0;var _0x463383=_0x6c9d[_0x1bbad0];return _0x463383;};'use strict';var _=require(_0xd6c9('0x0'));var util=require('util');var moment=require(_0xd6c9('0x1'));var BPromise=require(_0xd6c9('0x2'));var rs=require(_0xd6c9('0x3'));var fs=require('fs');var Redis=require(_0xd6c9('0x4'));var db=require(_0xd6c9('0x5'))['db'];var utils=require(_0xd6c9('0x6'));var logger=require(_0xd6c9('0x7'))(_0xd6c9('0x8'));var config=require(_0xd6c9('0x9'));var jayson=require(_0xd6c9('0xa'));var client=jayson[_0xd6c9('0xb')]['http']({'port':0x232a});config[_0xd6c9('0xc')]=_[_0xd6c9('0xd')](config['redis'],{'host':_0xd6c9('0xe'),'port':0x18eb});var socket=require(_0xd6c9('0xf'))(new Redis(config[_0xd6c9('0xc')]));require(_0xd6c9('0x10'))[_0xd6c9('0x11')](socket);function respondWithRpcPromise(_0x2acc3c,_0x200e08,_0x232459){return new BPromise(function(_0x59d00d,_0x45fa0f){return client[_0xd6c9('0x12')](_0x2acc3c,_0x232459)[_0xd6c9('0x13')](function(_0x15eeab){logger['info'](_0xd6c9('0x14'),_0x200e08,_0xd6c9('0x15'));logger[_0xd6c9('0x16')](_0xd6c9('0x17'),_0x200e08,'request\x20sent',JSON[_0xd6c9('0x18')](_0x15eeab));if(_0x15eeab[_0xd6c9('0x19')]){if(_0x15eeab[_0xd6c9('0x19')][_0xd6c9('0x1a')]===0x1f4){logger[_0xd6c9('0x19')]('SmsQueue,\x20%s,\x20%s',_0x200e08,_0x15eeab[_0xd6c9('0x19')]['message']);return _0x45fa0f(_0x15eeab[_0xd6c9('0x19')][_0xd6c9('0x1b')]);}logger[_0xd6c9('0x19')](_0xd6c9('0x14'),_0x200e08,_0x15eeab[_0xd6c9('0x19')][_0xd6c9('0x1b')]);return _0x59d00d(_0x15eeab[_0xd6c9('0x19')][_0xd6c9('0x1b')]);}else{logger[_0xd6c9('0x1c')](_0xd6c9('0x14'),_0x200e08,_0xd6c9('0x15'));_0x59d00d(_0x15eeab[_0xd6c9('0x1d')][_0xd6c9('0x1b')]);}})[_0xd6c9('0x1e')](function(_0x350f5a){logger[_0xd6c9('0x19')]('SmsQueue,\x20%s,\x20%s',_0x200e08,_0x350f5a);_0x45fa0f(_0x350f5a);});});}exports[_0xd6c9('0x1f')]=function(_0x5ad3cd){var _0x50faa5=this;return new Promise(function(_0x2eb781,_0x287588){return db[_0xd6c9('0x20')][_0xd6c9('0x21')]({'raw':_0x5ad3cd['options']?_0x5ad3cd['options'][_0xd6c9('0x22')]===undefined?!![]:![]:!![],'where':_0x5ad3cd[_0xd6c9('0x23')]?_0x5ad3cd[_0xd6c9('0x23')]['where']||null:null,'attributes':_0x5ad3cd[_0xd6c9('0x23')]?_0x5ad3cd[_0xd6c9('0x23')][_0xd6c9('0x24')]||null:null,'limit':_0x5ad3cd[_0xd6c9('0x23')]?_0x5ad3cd['options']['limit']||null:null,'include':_0x5ad3cd[_0xd6c9('0x23')]?_0x5ad3cd[_0xd6c9('0x23')][_0xd6c9('0x25')]?_[_0xd6c9('0x26')](_0x5ad3cd[_0xd6c9('0x23')]['include'],function(_0x2d526a){return{'model':db[_0x2d526a[_0xd6c9('0x27')]],'as':_0x2d526a['as'],'attributes':_0x2d526a['attributes'],'include':_0x2d526a[_0xd6c9('0x25')]?_[_0xd6c9('0x26')](_0x2d526a[_0xd6c9('0x25')],function(_0x355007){return{'model':db[_0x355007[_0xd6c9('0x27')]],'as':_0x355007['as'],'attributes':_0x355007[_0xd6c9('0x24')],'include':_0x355007[_0xd6c9('0x25')]?_[_0xd6c9('0x26')](_0x355007['include'],function(_0x761117){return{'model':db[_0x761117['model']],'as':_0x761117['as'],'attributes':_0x761117[_0xd6c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd6c9('0x13')](function(_0x39067b){logger['info'](_0xd6c9('0x1f'),_0x5ad3cd);logger[_0xd6c9('0x16')](_0xd6c9('0x1f'),_0x5ad3cd,JSON[_0xd6c9('0x18')](_0x39067b));_0x2eb781(_0x39067b);})[_0xd6c9('0x1e')](function(_0x186062){logger[_0xd6c9('0x19')](_0xd6c9('0x1f'),_0x186062['message'],_0x5ad3cd);_0x287588(_0x50faa5[_0xd6c9('0x19')](0x1f4,_0x186062[_0xd6c9('0x1b')]));});});};exports[_0xd6c9('0x28')]=function(_0x1f9bc0){var _0x4d9717=this;return new Promise(function(_0x9f4203,_0x25f353){return db[_0xd6c9('0x20')]['find']({'raw':_0x1f9bc0[_0xd6c9('0x23')]?_0x1f9bc0[_0xd6c9('0x23')][_0xd6c9('0x22')]===undefined?!![]:![]:!![],'where':_0x1f9bc0[_0xd6c9('0x23')]?_0x1f9bc0[_0xd6c9('0x23')][_0xd6c9('0x29')]||null:null,'attributes':_0x1f9bc0[_0xd6c9('0x23')]?_0x1f9bc0[_0xd6c9('0x23')][_0xd6c9('0x24')]||null:null,'include':_0x1f9bc0[_0xd6c9('0x23')]?_0x1f9bc0[_0xd6c9('0x23')]['include']?_[_0xd6c9('0x26')](_0x1f9bc0['options']['include'],function(_0x26965b){return{'model':db[_0x26965b['model']],'as':_0x26965b['as'],'attributes':_0x26965b['attributes'],'include':_0x26965b[_0xd6c9('0x25')]?_[_0xd6c9('0x26')](_0x26965b['include'],function(_0x38ea38){return{'model':db[_0x38ea38[_0xd6c9('0x27')]],'as':_0x38ea38['as'],'attributes':_0x38ea38['attributes'],'include':_0x38ea38[_0xd6c9('0x25')]?_[_0xd6c9('0x26')](_0x38ea38[_0xd6c9('0x25')],function(_0x34d44a){return{'model':db[_0x34d44a[_0xd6c9('0x27')]],'as':_0x34d44a['as'],'attributes':_0x34d44a[_0xd6c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd6c9('0x13')](function(_0x25f207){logger[_0xd6c9('0x1c')]('ShowSmsQueue',_0x1f9bc0);logger['debug'](_0xd6c9('0x28'),_0x1f9bc0,JSON[_0xd6c9('0x18')](_0x25f207));_0x9f4203(_0x25f207);})[_0xd6c9('0x1e')](function(_0x2f5f68){logger['error'](_0xd6c9('0x28'),_0x2f5f68[_0xd6c9('0x1b')],_0x1f9bc0);_0x25f353(_0x4d9717[_0xd6c9('0x19')](0x1f4,_0x2f5f68[_0xd6c9('0x1b')]));});});}; \ No newline at end of file +var _0xc746=['stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','attributes','limit','include','model','map','GetSmsQueue','find','ShowSmsQueue','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x36b5f7,_0x24170d){var _0x1f4816=function(_0x4eb90f){while(--_0x4eb90f){_0x36b5f7['push'](_0x36b5f7['shift']());}};_0x1f4816(++_0x24170d);}(_0xc746,0x13a));var _0x6c74=function(_0x4dba6d,_0x22f3c5){_0x4dba6d=_0x4dba6d-0x0;var _0x446f38=_0xc746[_0x4dba6d];return _0x446f38;};'use strict';var _=require('lodash');var util=require(_0x6c74('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c74('0x1'))['db'];var utils=require(_0x6c74('0x2'));var logger=require(_0x6c74('0x3'))(_0x6c74('0x4'));var config=require('../../config/environment');var jayson=require(_0x6c74('0x5'));var client=jayson[_0x6c74('0x6')][_0x6c74('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6c74('0x8'),'port':0x18eb});var socket=require(_0x6c74('0x9'))(new Redis(config[_0x6c74('0xa')]));require(_0x6c74('0xb'))[_0x6c74('0xc')](socket);function respondWithRpcPromise(_0x5184c2,_0x33324c,_0x2d837d){return new BPromise(function(_0x70db2e,_0x47aea6){return client['request'](_0x5184c2,_0x2d837d)[_0x6c74('0xd')](function(_0x42fbe7){logger[_0x6c74('0xe')](_0x6c74('0xf'),_0x33324c,_0x6c74('0x10'));logger[_0x6c74('0x11')](_0x6c74('0x12'),_0x33324c,_0x6c74('0x10'),JSON[_0x6c74('0x13')](_0x42fbe7));if(_0x42fbe7[_0x6c74('0x14')]){if(_0x42fbe7['error'][_0x6c74('0x15')]===0x1f4){logger[_0x6c74('0x14')](_0x6c74('0xf'),_0x33324c,_0x42fbe7[_0x6c74('0x14')][_0x6c74('0x16')]);return _0x47aea6(_0x42fbe7[_0x6c74('0x14')][_0x6c74('0x16')]);}logger['error'](_0x6c74('0xf'),_0x33324c,_0x42fbe7[_0x6c74('0x14')][_0x6c74('0x16')]);return _0x70db2e(_0x42fbe7['error'][_0x6c74('0x16')]);}else{logger[_0x6c74('0xe')](_0x6c74('0xf'),_0x33324c,'request\x20sent');_0x70db2e(_0x42fbe7[_0x6c74('0x17')][_0x6c74('0x16')]);}})[_0x6c74('0x18')](function(_0x3ef6f2){logger['error'](_0x6c74('0xf'),_0x33324c,_0x3ef6f2);_0x47aea6(_0x3ef6f2);});});}exports['GetSmsQueue']=function(_0x142d2f){var _0x3c5eae=this;return new Promise(function(_0x384a30,_0x265338){return db[_0x6c74('0x19')][_0x6c74('0x1a')]({'raw':_0x142d2f[_0x6c74('0x1b')]?_0x142d2f[_0x6c74('0x1b')][_0x6c74('0x1c')]===undefined?!![]:![]:!![],'where':_0x142d2f[_0x6c74('0x1b')]?_0x142d2f[_0x6c74('0x1b')]['where']||null:null,'attributes':_0x142d2f[_0x6c74('0x1b')]?_0x142d2f['options'][_0x6c74('0x1d')]||null:null,'limit':_0x142d2f[_0x6c74('0x1b')]?_0x142d2f[_0x6c74('0x1b')][_0x6c74('0x1e')]||null:null,'include':_0x142d2f[_0x6c74('0x1b')]?_0x142d2f['options']['include']?_['map'](_0x142d2f[_0x6c74('0x1b')][_0x6c74('0x1f')],function(_0x33283c){return{'model':db[_0x33283c[_0x6c74('0x20')]],'as':_0x33283c['as'],'attributes':_0x33283c[_0x6c74('0x1d')],'include':_0x33283c[_0x6c74('0x1f')]?_[_0x6c74('0x21')](_0x33283c[_0x6c74('0x1f')],function(_0x439c19){return{'model':db[_0x439c19[_0x6c74('0x20')]],'as':_0x439c19['as'],'attributes':_0x439c19[_0x6c74('0x1d')],'include':_0x439c19[_0x6c74('0x1f')]?_[_0x6c74('0x21')](_0x439c19['include'],function(_0x3db715){return{'model':db[_0x3db715[_0x6c74('0x20')]],'as':_0x3db715['as'],'attributes':_0x3db715['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c74('0xd')](function(_0x472d95){logger[_0x6c74('0xe')](_0x6c74('0x22'),_0x142d2f);logger[_0x6c74('0x11')](_0x6c74('0x22'),_0x142d2f,JSON[_0x6c74('0x13')](_0x472d95));_0x384a30(_0x472d95);})[_0x6c74('0x18')](function(_0x4745c8){logger[_0x6c74('0x14')](_0x6c74('0x22'),_0x4745c8[_0x6c74('0x16')],_0x142d2f);_0x265338(_0x3c5eae['error'](0x1f4,_0x4745c8[_0x6c74('0x16')]));});});};exports['ShowSmsQueue']=function(_0x13ebf2){var _0x12af52=this;return new Promise(function(_0x335d3d,_0x2068ea){return db['SmsQueue'][_0x6c74('0x23')]({'raw':_0x13ebf2[_0x6c74('0x1b')]?_0x13ebf2[_0x6c74('0x1b')][_0x6c74('0x1c')]===undefined?!![]:![]:!![],'where':_0x13ebf2[_0x6c74('0x1b')]?_0x13ebf2[_0x6c74('0x1b')]['where']||null:null,'attributes':_0x13ebf2[_0x6c74('0x1b')]?_0x13ebf2['options'][_0x6c74('0x1d')]||null:null,'include':_0x13ebf2['options']?_0x13ebf2[_0x6c74('0x1b')][_0x6c74('0x1f')]?_['map'](_0x13ebf2[_0x6c74('0x1b')][_0x6c74('0x1f')],function(_0x1a79df){return{'model':db[_0x1a79df[_0x6c74('0x20')]],'as':_0x1a79df['as'],'attributes':_0x1a79df[_0x6c74('0x1d')],'include':_0x1a79df[_0x6c74('0x1f')]?_[_0x6c74('0x21')](_0x1a79df['include'],function(_0x106160){return{'model':db[_0x106160[_0x6c74('0x20')]],'as':_0x106160['as'],'attributes':_0x106160[_0x6c74('0x1d')],'include':_0x106160[_0x6c74('0x1f')]?_[_0x6c74('0x21')](_0x106160[_0x6c74('0x1f')],function(_0x3b8145){return{'model':db[_0x3b8145[_0x6c74('0x20')]],'as':_0x3b8145['as'],'attributes':_0x3b8145['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a84f2){logger[_0x6c74('0xe')]('ShowSmsQueue',_0x13ebf2);logger[_0x6c74('0x11')](_0x6c74('0x24'),_0x13ebf2,JSON[_0x6c74('0x13')](_0x4a84f2));_0x335d3d(_0x4a84f2);})[_0x6c74('0x18')](function(_0x2255cd){logger[_0x6c74('0x14')](_0x6c74('0x24'),_0x2255cd['message'],_0x13ebf2);_0x2068ea(_0x12af52[_0x6c74('0x14')](0x1f4,_0x2255cd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 35b865c..5bc3a8b 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 _0x3b5c=['./smsQueue.events','save','update','emit','removeListener','register','smsQueue:'];(function(_0x128ee7,_0xbfbe00){var _0x38450a=function(_0x570931){while(--_0x570931){_0x128ee7['push'](_0x128ee7['shift']());}};_0x38450a(++_0xbfbe00);}(_0x3b5c,0x70));var _0xc3b5=function(_0x44fbaf,_0x230ff1){_0x44fbaf=_0x44fbaf-0x0;var _0x79df97=_0x3b5c[_0x44fbaf];return _0x79df97;};'use strict';var SmsQueueEvents=require(_0xc3b5('0x0'));var events=[_0xc3b5('0x1'),'remove',_0xc3b5('0x2')];function createListener(_0x2de3e2,_0x1dd5ff){return function(_0x67678e){_0x1dd5ff[_0xc3b5('0x3')](_0x2de3e2,_0x67678e);};}function removeListener(_0x36239b,_0x10def1){return function(){SmsQueueEvents[_0xc3b5('0x4')](_0x36239b,_0x10def1);};}exports[_0xc3b5('0x5')]=function(_0x28c307){for(var _0xdde321=0x0,_0x49899f=events['length'];_0xdde321<_0x49899f;_0xdde321++){var _0x203388=events[_0xdde321];var _0x5dbf03=createListener(_0xc3b5('0x6')+_0x203388,_0x28c307);SmsQueueEvents['on'](_0x203388,_0x5dbf03);}}; \ No newline at end of file +var _0x0eef=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0eef,0x11c));var _0xf0ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0eef[_0x2641f9];return _0x585741;};'use strict';var SmsQueueEvents=require(_0xf0ee('0x0'));var events=[_0xf0ee('0x1'),_0xf0ee('0x2'),_0xf0ee('0x3')];function createListener(_0x43d964,_0xae579a){return function(_0x1a7ce6){_0xae579a[_0xf0ee('0x4')](_0x43d964,_0x1a7ce6);};}function removeListener(_0x1bf7ca,_0x560dfa){return function(){SmsQueueEvents[_0xf0ee('0x5')](_0x1bf7ca,_0x560dfa);};}exports[_0xf0ee('0x6')]=function(_0x2a71a9){for(var _0x9a9401=0x0,_0x100a6a=events[_0xf0ee('0x7')];_0x9a9401<_0x100a6a;_0x9a9401++){var _0x917155=events[_0x9a9401];var _0x46f9bf=createListener(_0xf0ee('0x8')+_0x917155,_0x2a71a9);SmsQueueEvents['on'](_0x917155,_0x46f9bf);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f7b5b89..f5f894a 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 _0x1561=['isAuthenticated','describe','/:id','show','create','put','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe'];(function(_0x354ab1,_0xec5b21){var _0x9918a1=function(_0x1becca){while(--_0x1becca){_0x354ab1['push'](_0x354ab1['shift']());}};_0x9918a1(++_0xec5b21);}(_0x1561,0x1bd));var _0x1156=function(_0x433b43,_0x52bda0){_0x433b43=_0x433b43-0x0;var _0x18e14c=_0x1561[_0x433b43];return _0x18e14c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1156('0x0'));var timeout=require(_0x1156('0x1'));var express=require(_0x1156('0x2'));var router=express[_0x1156('0x3')]();var fs_extra=require(_0x1156('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1156('0x5'));var config=require(_0x1156('0x6'));var controller=require(_0x1156('0x7'));router[_0x1156('0x8')]('/',auth['isAuthenticated'](),controller[_0x1156('0x9')]);router['get'](_0x1156('0xa'),auth[_0x1156('0xb')](),controller[_0x1156('0xc')]);router[_0x1156('0x8')](_0x1156('0xd'),auth['isAuthenticated'](),controller[_0x1156('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1156('0xf')]);router[_0x1156('0x10')]('/:id',auth[_0x1156('0xb')](),controller['update']);router[_0x1156('0x11')]('/:id',auth[_0x1156('0xb')](),controller[_0x1156('0x12')]);module['exports']=router; \ No newline at end of file +var _0x179d=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x4aeda4,_0x3e4a3d){var _0x5cf127=function(_0x1b5dfa){while(--_0x1b5dfa){_0x4aeda4['push'](_0x4aeda4['shift']());}};_0x5cf127(++_0x3e4a3d);}(_0x179d,0x85));var _0xd179=function(_0x4b6b50,_0x1cb504){_0x4b6b50=_0x4b6b50-0x0;var _0x553c6d=_0x179d[_0x4b6b50];return _0x553c6d;};'use strict';var multer=require('multer');var util=require(_0xd179('0x0'));var path=require(_0xd179('0x1'));var timeout=require(_0xd179('0x2'));var express=require('express');var router=express[_0xd179('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd179('0x4'));var config=require(_0xd179('0x5'));var controller=require(_0xd179('0x6'));router[_0xd179('0x7')]('/',auth[_0xd179('0x8')](),controller[_0xd179('0x9')]);router[_0xd179('0x7')](_0xd179('0xa'),auth[_0xd179('0x8')](),controller[_0xd179('0xb')]);router[_0xd179('0x7')](_0xd179('0xc'),auth['isAuthenticated'](),controller[_0xd179('0xd')]);router[_0xd179('0xe')]('/',auth['isAuthenticated'](),controller[_0xd179('0xf')]);router[_0xd179('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd179('0x11')]('/:id',auth[_0xd179('0x8')](),controller[_0xd179('0x12')]);module[_0xd179('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 51afccf..c15ddd6 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 _0x6e80=['DATE','moment','sequelize','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6e80,0x1cd));var _0x06e8=function(_0x588f0b,_0x169ae8){_0x588f0b=_0x588f0b-0x0;var _0x38370a=_0x6e80[_0x588f0b];return _0x38370a;};'use strict';var moment=require(_0x06e8('0x0'));var Sequelize=require(_0x06e8('0x1'));module[_0x06e8('0x2')]={'uniqueid':{'type':Sequelize[_0x06e8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x06e8('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x06e8('0x4')]},'acceptAt':{'type':Sequelize[_0x06e8('0x4')]},'exitAt':{'type':Sequelize[_0x06e8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf70=['STRING','DATE','moment','sequelize'];(function(_0x32d8f6,_0x153146){var _0x4d6740=function(_0x5e41a6){while(--_0x5e41a6){_0x32d8f6['push'](_0x32d8f6['shift']());}};_0x4d6740(++_0x153146);}(_0xaf70,0x17a));var _0x0af7=function(_0x18d9e8,_0x5c87e9){_0x18d9e8=_0x18d9e8-0x0;var _0x4198f1=_0xaf70[_0x18d9e8];return _0x4198f1;};'use strict';var moment=require(_0x0af7('0x0'));var Sequelize=require(_0x0af7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0af7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0af7('0x2')]},'joinAt':{'type':Sequelize[_0x0af7('0x3')]},'leaveAt':{'type':Sequelize[_0x0af7('0x3')]},'acceptAt':{'type':Sequelize[_0x0af7('0x3')]},'exitAt':{'type':Sequelize[_0x0af7('0x3')]},'reason':{'type':Sequelize[_0x0af7('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ec969ae..a36291b 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 _0x8646=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x28e6b3,_0x45e7cf){var _0x24e0e8=function(_0x4282e1){while(--_0x4282e1){_0x28e6b3['push'](_0x28e6b3['shift']());}};_0x24e0e8(++_0x45e7cf);}(_0x8646,0x1d2));var _0x6864=function(_0x362564,_0x1a2d1c){_0x362564=_0x362564-0x0;var _0x2333df=_0x8646[_0x362564];return _0x2333df;};'use strict';var emlformat=require(_0x6864('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6864('0x1'));var jsonpatch=require(_0x6864('0x2'));var rp=require(_0x6864('0x3'));var moment=require(_0x6864('0x4'));var BPromise=require(_0x6864('0x5'));var Mustache=require(_0x6864('0x6'));var util=require(_0x6864('0x7'));var path=require('path');var sox=require(_0x6864('0x8'));var csv=require(_0x6864('0x9'));var ejs=require(_0x6864('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6864('0xb'));var squel=require(_0x6864('0xc'));var crypto=require('crypto');var jsforce=require(_0x6864('0xd'));var deskjs=require(_0x6864('0xe'));var toCsv=require(_0x6864('0x9'));var querystring=require(_0x6864('0xf'));var Papa=require(_0x6864('0x10'));var Redis=require(_0x6864('0x11'));var authService=require(_0x6864('0x12'));var qs=require(_0x6864('0x13'));var as=require(_0x6864('0x14'));var hardwareService=require(_0x6864('0x15'));var logger=require(_0x6864('0x16'))(_0x6864('0x17'));var utils=require(_0x6864('0x18'));var config=require(_0x6864('0x19'));var licenseUtil=require(_0x6864('0x1a'));var db=require(_0x6864('0x1b'))['db'];function respondWithStatusCode(_0x2fdaaa,_0x2b487a){_0x2b487a=_0x2b487a||0xcc;return function(_0x5dbedf){if(_0x5dbedf){return _0x2fdaaa[_0x6864('0x1c')](_0x2b487a);}return _0x2fdaaa[_0x6864('0x1d')](_0x2b487a)[_0x6864('0x1e')]();};}function respondWithResult(_0x44c484,_0x20ed06){_0x20ed06=_0x20ed06||0xc8;return function(_0x19f1e8){if(_0x19f1e8){return _0x44c484[_0x6864('0x1d')](_0x20ed06)[_0x6864('0x1f')](_0x19f1e8);}};}function respondWithFilteredResult(_0x5373da,_0x2f6e60){return function(_0x33aee2){if(_0x33aee2){var _0x39e481=typeof _0x2f6e60[_0x6864('0x20')]===_0x6864('0x21')&&typeof _0x2f6e60[_0x6864('0x22')]===_0x6864('0x21');var _0x283378=_0x33aee2[_0x6864('0x23')];var _0x56d085=_0x39e481?0x0:_0x2f6e60[_0x6864('0x20')];var _0x3c58dc=_0x39e481?_0x33aee2[_0x6864('0x23')]:_0x2f6e60['offset']+_0x2f6e60[_0x6864('0x22')];var _0x5f1ca7;if(_0x3c58dc>=_0x283378){_0x3c58dc=_0x283378;_0x5f1ca7=0xc8;}else{_0x5f1ca7=0xce;}_0x5373da[_0x6864('0x1d')](_0x5f1ca7);return _0x5373da['set'](_0x6864('0x24'),_0x56d085+'-'+_0x3c58dc+'/'+_0x283378)[_0x6864('0x1f')](_0x33aee2);}return null;};}function patchUpdates(_0x3e3b52){return function(_0x20785d){try{jsonpatch[_0x6864('0x25')](_0x20785d,_0x3e3b52,!![]);}catch(_0x485bbe){return BPromise[_0x6864('0x26')](_0x485bbe);}return _0x20785d[_0x6864('0x27')]();};}function saveUpdates(_0x4f24a0,_0xa4235b){return function(_0x14b5a7){if(_0x14b5a7){return _0x14b5a7[_0x6864('0x28')](_0x4f24a0)[_0x6864('0x29')](function(_0x5cd4a3){return _0x5cd4a3;});}return null;};}function removeEntity(_0x4727cd,_0x17a26d){return function(_0x42f8a4){if(_0x42f8a4){return _0x42f8a4[_0x6864('0x2a')]()[_0x6864('0x29')](function(){_0x4727cd[_0x6864('0x1d')](0xcc)[_0x6864('0x1e')]();});}};}function handleEntityNotFound(_0x2d4415,_0x3e76a8){return function(_0xf95183){if(!_0xf95183){_0x2d4415[_0x6864('0x1c')](0x194);}return _0xf95183;};}function handleError(_0x277feb,_0x2aa44b){_0x2aa44b=_0x2aa44b||0x1f4;return function(_0x652218){logger[_0x6864('0x2b')](_0x652218[_0x6864('0x2c')]);if(_0x652218[_0x6864('0x2d')]){delete _0x652218[_0x6864('0x2d')];}_0x277feb[_0x6864('0x1d')](_0x2aa44b)['send'](_0x652218);};}exports[_0x6864('0x2e')]=function(_0x18c502,_0x38100c){var _0x548ee5={},_0x471d13={},_0x263616={'count':0x0,'rows':[]};var _0x1c23d0=_['map'](db[_0x6864('0x2f')][_0x6864('0x30')],function(_0x473e41){return{'name':_0x473e41[_0x6864('0x31')],'type':_0x473e41[_0x6864('0x32')][_0x6864('0x33')]};});_0x471d13[_0x6864('0x34')]=_[_0x6864('0x35')](_0x1c23d0,_0x6864('0x2d'));_0x471d13[_0x6864('0x36')]=_[_0x6864('0x37')](_0x18c502['query']);_0x471d13[_0x6864('0x38')]=_[_0x6864('0x39')](_0x471d13['model'],_0x471d13['query']);_0x548ee5['attributes']=_['intersection'](_0x471d13[_0x6864('0x34')],qs[_0x6864('0x3a')](_0x18c502[_0x6864('0x36')][_0x6864('0x3a')]));_0x548ee5[_0x6864('0x3b')]=_0x548ee5['attributes']['length']?_0x548ee5[_0x6864('0x3b')]:_0x471d13['model'];if(!_0x18c502['query'][_0x6864('0x3c')](_0x6864('0x3d'))){_0x548ee5['limit']=qs[_0x6864('0x22')](_0x18c502[_0x6864('0x36')][_0x6864('0x22')]);_0x548ee5[_0x6864('0x20')]=qs[_0x6864('0x20')](_0x18c502[_0x6864('0x36')]['offset']);}_0x548ee5[_0x6864('0x3e')]=qs['sort'](_0x18c502['query'][_0x6864('0x3f')]);_0x548ee5[_0x6864('0x40')]=qs['filters'](_[_0x6864('0x41')](_0x18c502[_0x6864('0x36')],_0x471d13[_0x6864('0x38')]),_0x1c23d0);if(_0x18c502[_0x6864('0x36')][_0x6864('0x42')]){_0x548ee5[_0x6864('0x40')]=_['merge'](_0x548ee5['where'],{'$or':_[_0x6864('0x35')](_0x1c23d0,function(_0x1db4ee){if(_0x1db4ee[_0x6864('0x32')]!==_0x6864('0x43')){var _0x9b2a53={};_0x9b2a53[_0x1db4ee[_0x6864('0x2d')]]={'$like':'%'+_0x18c502[_0x6864('0x36')][_0x6864('0x42')]+'%'};return _0x9b2a53;}})});}_0x548ee5=_[_0x6864('0x44')]({},_0x548ee5,_0x18c502[_0x6864('0x45')]);var _0x1291ef={'where':_0x548ee5['where']};return db[_0x6864('0x2f')][_0x6864('0x23')](_0x1291ef)[_0x6864('0x29')](function(_0x3fc170){_0x263616[_0x6864('0x23')]=_0x3fc170;if(_0x18c502[_0x6864('0x36')][_0x6864('0x46')]){_0x548ee5[_0x6864('0x47')]=[{'all':!![]}];}return db[_0x6864('0x2f')][_0x6864('0x48')](_0x548ee5);})[_0x6864('0x29')](function(_0xd671fb){_0x263616[_0x6864('0x49')]=_0xd671fb;return _0x263616;})[_0x6864('0x29')](respondWithFilteredResult(_0x38100c,_0x548ee5))[_0x6864('0x4a')](handleError(_0x38100c,null));};exports[_0x6864('0x4b')]=function(_0x2e0d44,_0x586222){var _0x406db3={'raw':!![],'where':{'id':_0x2e0d44[_0x6864('0x4c')]['id']}},_0x26f638={};_0x26f638['model']=_['keys'](db['SmsQueueReport'][_0x6864('0x30')]);_0x26f638[_0x6864('0x36')]=_['keys'](_0x2e0d44[_0x6864('0x36')]);_0x26f638[_0x6864('0x38')]=_[_0x6864('0x39')](_0x26f638[_0x6864('0x34')],_0x26f638[_0x6864('0x36')]);_0x406db3[_0x6864('0x3b')]=_['intersection'](_0x26f638[_0x6864('0x34')],qs[_0x6864('0x3a')](_0x2e0d44[_0x6864('0x36')][_0x6864('0x3a')]));_0x406db3[_0x6864('0x3b')]=_0x406db3[_0x6864('0x3b')][_0x6864('0x4d')]?_0x406db3[_0x6864('0x3b')]:_0x26f638[_0x6864('0x34')];if(_0x2e0d44[_0x6864('0x36')][_0x6864('0x46')]){_0x406db3[_0x6864('0x47')]=[{'all':!![]}];}_0x406db3=_[_0x6864('0x44')]({},_0x406db3,_0x2e0d44['options']);return db[_0x6864('0x2f')][_0x6864('0x4e')](_0x406db3)[_0x6864('0x29')](handleEntityNotFound(_0x586222,null))['then'](respondWithResult(_0x586222,null))[_0x6864('0x4a')](handleError(_0x586222,null));};exports[_0x6864('0x4f')]=function(_0xdd8266,_0x7e1396){return db[_0x6864('0x2f')][_0x6864('0x4f')](_0xdd8266[_0x6864('0x50')],{})['then'](respondWithResult(_0x7e1396,0xc9))['catch'](handleError(_0x7e1396,null));};exports[_0x6864('0x28')]=function(_0xfb0dc3,_0x647a07){if(_0xfb0dc3[_0x6864('0x50')]['id']){delete _0xfb0dc3[_0x6864('0x50')]['id'];}return db[_0x6864('0x2f')][_0x6864('0x4e')]({'where':{'id':_0xfb0dc3[_0x6864('0x4c')]['id']}})[_0x6864('0x29')](handleEntityNotFound(_0x647a07,null))[_0x6864('0x29')](saveUpdates(_0xfb0dc3[_0x6864('0x50')],null))[_0x6864('0x29')](respondWithResult(_0x647a07,null))[_0x6864('0x4a')](handleError(_0x647a07,null));};exports[_0x6864('0x2a')]=function(_0x4f68c4,_0x225f93){return db[_0x6864('0x2f')]['find']({'where':{'id':_0x4f68c4[_0x6864('0x4c')]['id']}})[_0x6864('0x29')](handleEntityNotFound(_0x225f93,null))[_0x6864('0x29')](removeEntity(_0x225f93,null))[_0x6864('0x4a')](handleError(_0x225f93,null));};exports[_0x6864('0x51')]=function(_0x54c863,_0x12728f){return db[_0x6864('0x2f')]['describe']()[_0x6864('0x29')](respondWithResult(_0x12728f,null))[_0x6864('0x4a')](handleError(_0x12728f,null));}; \ No newline at end of file +var _0x049c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x049c,0xd1));var _0xc049=function(_0x2c81ce,_0x39921f){_0x2c81ce=_0x2c81ce-0x0;var _0x1dc54a=_0x049c[_0x2c81ce];return _0x1dc54a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc049('0x0'));var jsonpatch=require(_0xc049('0x1'));var rp=require(_0xc049('0x2'));var moment=require(_0xc049('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc049('0x4'));var path=require('path');var sox=require(_0xc049('0x5'));var csv=require('to-csv');var ejs=require(_0xc049('0x6'));var fs=require('fs');var fs_extra=require(_0xc049('0x7'));var _=require(_0xc049('0x8'));var squel=require(_0xc049('0x9'));var crypto=require(_0xc049('0xa'));var jsforce=require(_0xc049('0xb'));var deskjs=require(_0xc049('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc049('0xd'));var Redis=require(_0xc049('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc049('0xf'));var as=require(_0xc049('0x10'));var hardwareService=require(_0xc049('0x11'));var logger=require(_0xc049('0x12'))('api');var utils=require(_0xc049('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc049('0x14'))['db'];function respondWithStatusCode(_0x4eee7a,_0x49c2a2){_0x49c2a2=_0x49c2a2||0xcc;return function(_0x171545){if(_0x171545){return _0x4eee7a[_0xc049('0x15')](_0x49c2a2);}return _0x4eee7a[_0xc049('0x16')](_0x49c2a2)['end']();};}function respondWithResult(_0x2ec8f5,_0x332588){_0x332588=_0x332588||0xc8;return function(_0x3516e5){if(_0x3516e5){return _0x2ec8f5[_0xc049('0x16')](_0x332588)[_0xc049('0x17')](_0x3516e5);}};}function respondWithFilteredResult(_0x47c90e,_0x2ed19e){return function(_0x31fd4c){if(_0x31fd4c){var _0x192278=typeof _0x2ed19e[_0xc049('0x18')]===_0xc049('0x19')&&typeof _0x2ed19e['limit']==='undefined';var _0x4981e4=_0x31fd4c['count'];var _0x1b1465=_0x192278?0x0:_0x2ed19e[_0xc049('0x18')];var _0x3e82aa=_0x192278?_0x31fd4c[_0xc049('0x1a')]:_0x2ed19e[_0xc049('0x18')]+_0x2ed19e[_0xc049('0x1b')];var _0x477a4d;if(_0x3e82aa>=_0x4981e4){_0x3e82aa=_0x4981e4;_0x477a4d=0xc8;}else{_0x477a4d=0xce;}_0x47c90e[_0xc049('0x16')](_0x477a4d);return _0x47c90e[_0xc049('0x1c')](_0xc049('0x1d'),_0x1b1465+'-'+_0x3e82aa+'/'+_0x4981e4)[_0xc049('0x17')](_0x31fd4c);}return null;};}function patchUpdates(_0x341b08){return function(_0x381c45){try{jsonpatch[_0xc049('0x1e')](_0x381c45,_0x341b08,!![]);}catch(_0x36aa5f){return BPromise['reject'](_0x36aa5f);}return _0x381c45[_0xc049('0x1f')]();};}function saveUpdates(_0x224536,_0x4a1789){return function(_0x387ff4){if(_0x387ff4){return _0x387ff4[_0xc049('0x20')](_0x224536)[_0xc049('0x21')](function(_0x5f5773){return _0x5f5773;});}return null;};}function removeEntity(_0x1047ab,_0x3426a9){return function(_0x315246){if(_0x315246){return _0x315246[_0xc049('0x22')]()['then'](function(){_0x1047ab[_0xc049('0x16')](0xcc)[_0xc049('0x23')]();});}};}function handleEntityNotFound(_0x40f6e8,_0x4c6beb){return function(_0x52c71a){if(!_0x52c71a){_0x40f6e8[_0xc049('0x15')](0x194);}return _0x52c71a;};}function handleError(_0x3cf522,_0x5ef717){_0x5ef717=_0x5ef717||0x1f4;return function(_0x16d174){logger['error'](_0x16d174[_0xc049('0x24')]);if(_0x16d174[_0xc049('0x25')]){delete _0x16d174['name'];}_0x3cf522['status'](_0x5ef717)[_0xc049('0x26')](_0x16d174);};}exports[_0xc049('0x27')]=function(_0x1d8c82,_0x1b081d){var _0x547d2a={},_0xf7c03e={},_0xe38cd3={'count':0x0,'rows':[]};var _0xad15d=_[_0xc049('0x28')](db[_0xc049('0x29')][_0xc049('0x2a')],function(_0x2bbb6a){return{'name':_0x2bbb6a[_0xc049('0x2b')],'type':_0x2bbb6a[_0xc049('0x2c')][_0xc049('0x2d')]};});_0xf7c03e['model']=_[_0xc049('0x28')](_0xad15d,_0xc049('0x25'));_0xf7c03e[_0xc049('0x2e')]=_[_0xc049('0x2f')](_0x1d8c82['query']);_0xf7c03e['filters']=_[_0xc049('0x30')](_0xf7c03e[_0xc049('0x31')],_0xf7c03e[_0xc049('0x2e')]);_0x547d2a['attributes']=_['intersection'](_0xf7c03e[_0xc049('0x31')],qs[_0xc049('0x32')](_0x1d8c82[_0xc049('0x2e')][_0xc049('0x32')]));_0x547d2a['attributes']=_0x547d2a[_0xc049('0x33')][_0xc049('0x34')]?_0x547d2a[_0xc049('0x33')]:_0xf7c03e[_0xc049('0x31')];if(!_0x1d8c82[_0xc049('0x2e')][_0xc049('0x35')](_0xc049('0x36'))){_0x547d2a[_0xc049('0x1b')]=qs[_0xc049('0x1b')](_0x1d8c82['query'][_0xc049('0x1b')]);_0x547d2a[_0xc049('0x18')]=qs[_0xc049('0x18')](_0x1d8c82[_0xc049('0x2e')][_0xc049('0x18')]);}_0x547d2a[_0xc049('0x37')]=qs[_0xc049('0x38')](_0x1d8c82[_0xc049('0x2e')][_0xc049('0x38')]);_0x547d2a[_0xc049('0x39')]=qs[_0xc049('0x3a')](_[_0xc049('0x3b')](_0x1d8c82['query'],_0xf7c03e[_0xc049('0x3a')]),_0xad15d);if(_0x1d8c82[_0xc049('0x2e')][_0xc049('0x3c')]){_0x547d2a[_0xc049('0x39')]=_[_0xc049('0x3d')](_0x547d2a[_0xc049('0x39')],{'$or':_['map'](_0xad15d,function(_0x34d936){if(_0x34d936[_0xc049('0x2c')]!==_0xc049('0x3e')){var _0x38dcb3={};_0x38dcb3[_0x34d936[_0xc049('0x25')]]={'$like':'%'+_0x1d8c82[_0xc049('0x2e')][_0xc049('0x3c')]+'%'};return _0x38dcb3;}})});}_0x547d2a=_[_0xc049('0x3d')]({},_0x547d2a,_0x1d8c82[_0xc049('0x3f')]);var _0x395723={'where':_0x547d2a[_0xc049('0x39')]};return db['SmsQueueReport'][_0xc049('0x1a')](_0x395723)[_0xc049('0x21')](function(_0x3ea3f7){_0xe38cd3[_0xc049('0x1a')]=_0x3ea3f7;if(_0x1d8c82[_0xc049('0x2e')][_0xc049('0x40')]){_0x547d2a[_0xc049('0x41')]=[{'all':!![]}];}return db[_0xc049('0x29')][_0xc049('0x42')](_0x547d2a);})['then'](function(_0x25112b){_0xe38cd3[_0xc049('0x43')]=_0x25112b;return _0xe38cd3;})[_0xc049('0x21')](respondWithFilteredResult(_0x1b081d,_0x547d2a))['catch'](handleError(_0x1b081d,null));};exports[_0xc049('0x44')]=function(_0x424164,_0x46ba61){var _0x33e1f1={'raw':!![],'where':{'id':_0x424164[_0xc049('0x45')]['id']}},_0x2a7602={};_0x2a7602['model']=_['keys'](db[_0xc049('0x29')][_0xc049('0x2a')]);_0x2a7602[_0xc049('0x2e')]=_[_0xc049('0x2f')](_0x424164[_0xc049('0x2e')]);_0x2a7602[_0xc049('0x3a')]=_[_0xc049('0x30')](_0x2a7602[_0xc049('0x31')],_0x2a7602[_0xc049('0x2e')]);_0x33e1f1[_0xc049('0x33')]=_[_0xc049('0x30')](_0x2a7602['model'],qs[_0xc049('0x32')](_0x424164[_0xc049('0x2e')][_0xc049('0x32')]));_0x33e1f1[_0xc049('0x33')]=_0x33e1f1[_0xc049('0x33')][_0xc049('0x34')]?_0x33e1f1[_0xc049('0x33')]:_0x2a7602[_0xc049('0x31')];if(_0x424164[_0xc049('0x2e')]['includeAll']){_0x33e1f1[_0xc049('0x41')]=[{'all':!![]}];}_0x33e1f1=_[_0xc049('0x3d')]({},_0x33e1f1,_0x424164['options']);return db[_0xc049('0x29')]['find'](_0x33e1f1)['then'](handleEntityNotFound(_0x46ba61,null))[_0xc049('0x21')](respondWithResult(_0x46ba61,null))['catch'](handleError(_0x46ba61,null));};exports['create']=function(_0x2be67e,_0x525c74){return db[_0xc049('0x29')][_0xc049('0x46')](_0x2be67e[_0xc049('0x47')],{})[_0xc049('0x21')](respondWithResult(_0x525c74,0xc9))[_0xc049('0x48')](handleError(_0x525c74,null));};exports[_0xc049('0x20')]=function(_0x1331d3,_0x3a8626){if(_0x1331d3[_0xc049('0x47')]['id']){delete _0x1331d3[_0xc049('0x47')]['id'];}return db[_0xc049('0x29')]['find']({'where':{'id':_0x1331d3[_0xc049('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a8626,null))[_0xc049('0x21')](saveUpdates(_0x1331d3['body'],null))[_0xc049('0x21')](respondWithResult(_0x3a8626,null))[_0xc049('0x48')](handleError(_0x3a8626,null));};exports[_0xc049('0x22')]=function(_0x3c5c1a,_0x4988c9){return db[_0xc049('0x29')][_0xc049('0x49')]({'where':{'id':_0x3c5c1a[_0xc049('0x45')]['id']}})[_0xc049('0x21')](handleEntityNotFound(_0x4988c9,null))[_0xc049('0x21')](removeEntity(_0x4988c9,null))[_0xc049('0x48')](handleError(_0x4988c9,null));};exports[_0xc049('0x4a')]=function(_0x164ec3,_0x85cb43){return db[_0xc049('0x29')]['describe']()[_0xc049('0x21')](respondWithResult(_0x85cb43,null))['catch'](handleError(_0x85cb43,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7ce665a..59f3bf3 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x5ae3d6,_0x281c00){var _0x271490=function(_0x1f82f6){while(--_0x1f82f6){_0x5ae3d6['push'](_0x5ae3d6['shift']());}};_0x271490(++_0x281c00);}(_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 +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x3cb6d8,_0x19ff85){var _0x5c7088=function(_0x731044){while(--_0x731044){_0x3cb6d8['push'](_0x3cb6d8['shift']());}};_0x5c7088(++_0x19ff85);}(_0x70e0,0x17b));var _0x070e=function(_0x1bad84,_0x2a46b7){_0x1bad84=_0x1bad84-0x0;var _0x39bd01=_0x70e0[_0x1bad84];return _0x39bd01;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index df10e67..1a5894a 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 _0x460f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','body','options','then','debug','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','SmsQueueReport','update','raw','where','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x460f,0x127));var _0xf460=function(_0x2a41bf,_0x9e9f1f){_0x2a41bf=_0x2a41bf-0x0;var _0x5e872e=_0x460f[_0x2a41bf];return _0x5e872e;};'use strict';var _=require(_0xf460('0x0'));var util=require(_0xf460('0x1'));var moment=require('moment');var BPromise=require(_0xf460('0x2'));var rs=require(_0xf460('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf460('0x4'))['db'];var utils=require(_0xf460('0x5'));var logger=require('../../config/logger')(_0xf460('0x6'));var config=require(_0xf460('0x7'));var jayson=require(_0xf460('0x8'));var client=jayson[_0xf460('0x9')][_0xf460('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f30b,_0x3f1608,_0x4fa638){return new BPromise(function(_0xc77a0a,_0x313f5a){return client[_0xf460('0xb')](_0x36f30b,_0x4fa638)['then'](function(_0x54b86d){logger['info'](_0xf460('0xc'),_0x3f1608,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3f1608,_0xf460('0xd'),JSON['stringify'](_0x54b86d));if(_0x54b86d[_0xf460('0xe')]){if(_0x54b86d['error'][_0xf460('0xf')]===0x1f4){logger[_0xf460('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3f1608,_0x54b86d[_0xf460('0xe')]['message']);return _0x313f5a(_0x54b86d[_0xf460('0xe')][_0xf460('0x10')]);}logger[_0xf460('0xe')](_0xf460('0xc'),_0x3f1608,_0x54b86d[_0xf460('0xe')][_0xf460('0x10')]);return _0xc77a0a(_0x54b86d['error'][_0xf460('0x10')]);}else{logger[_0xf460('0x11')](_0xf460('0xc'),_0x3f1608,'request\x20sent');_0xc77a0a(_0x54b86d['result'][_0xf460('0x10')]);}})[_0xf460('0x12')](function(_0x4da661){logger[_0xf460('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3f1608,_0x4da661);_0x313f5a(_0x4da661);});});}exports['CreateSmsQueueReport']=function(_0x44fc14){var _0x12297c=this;return new Promise(function(_0x390a59,_0x5a6173){return db['SmsQueueReport']['create'](_0x44fc14[_0xf460('0x13')],{'raw':_0x44fc14[_0xf460('0x14')]?_0x44fc14[_0xf460('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xf460('0x15')](function(_0x529565){logger['info']('CreateSmsQueueReport',_0x44fc14);logger[_0xf460('0x16')](_0xf460('0x17'),_0x44fc14,JSON[_0xf460('0x18')](_0x529565));_0x390a59(_0x529565);})[_0xf460('0x12')](function(_0x4e0692){logger[_0xf460('0xe')]('CreateSmsQueueReport',_0x4e0692['message'],_0x44fc14);_0x5a6173(_0x12297c[_0xf460('0xe')](0x1f4,_0x4e0692[_0xf460('0x10')]));});});};exports[_0xf460('0x19')]=function(_0x2759f0){var _0x37aaad=this;return new Promise(function(_0x288647,_0x417d85){return db[_0xf460('0x1a')][_0xf460('0x1b')](_0x2759f0['body'],{'raw':_0x2759f0[_0xf460('0x14')]?_0x2759f0[_0xf460('0x14')][_0xf460('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2759f0[_0xf460('0x14')]?_0x2759f0[_0xf460('0x14')][_0xf460('0x1d')]||null:null,'attributes':_0x2759f0[_0xf460('0x14')]?_0x2759f0[_0xf460('0x14')]['attributes']||null:null,'limit':_0x2759f0[_0xf460('0x14')]?_0x2759f0['options']['limit']||null:null})[_0xf460('0x15')](function(_0xa2d25e){logger[_0xf460('0x11')]('UpdateSmsQueueReport',_0x2759f0);logger[_0xf460('0x16')](_0xf460('0x19'),_0x2759f0,JSON[_0xf460('0x18')](_0xa2d25e));_0x288647(_0xa2d25e);})[_0xf460('0x12')](function(_0x3d8ef6){logger['error'](_0xf460('0x19'),_0x3d8ef6[_0xf460('0x10')],_0x2759f0);_0x417d85(_0x37aaad[_0xf460('0xe')](0x1f4,_0x3d8ef6[_0xf460('0x10')]));});});}; \ No newline at end of file +var _0xeb31=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','where','limit'];(function(_0x5238d2,_0x5a5e2a){var _0x26d3e2=function(_0x5b1cbf){while(--_0x5b1cbf){_0x5238d2['push'](_0x5238d2['shift']());}};_0x26d3e2(++_0x5a5e2a);}(_0xeb31,0xf8));var _0x1eb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb31[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1eb3('0x0'));var util=require(_0x1eb3('0x1'));var moment=require(_0x1eb3('0x2'));var BPromise=require('bluebird');var rs=require(_0x1eb3('0x3'));var fs=require('fs');var Redis=require(_0x1eb3('0x4'));var db=require(_0x1eb3('0x5'))['db'];var utils=require(_0x1eb3('0x6'));var logger=require(_0x1eb3('0x7'))('rpc');var config=require(_0x1eb3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1eb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3f81,_0x5e0735,_0x25ea26){return new BPromise(function(_0x29bc1f,_0x5a33cd){return client[_0x1eb3('0xa')](_0x5a3f81,_0x25ea26)[_0x1eb3('0xb')](function(_0x4d6215){logger[_0x1eb3('0xc')](_0x1eb3('0xd'),_0x5e0735,_0x1eb3('0xe'));logger[_0x1eb3('0xf')](_0x1eb3('0x10'),_0x5e0735,_0x1eb3('0xe'),JSON[_0x1eb3('0x11')](_0x4d6215));if(_0x4d6215[_0x1eb3('0x12')]){if(_0x4d6215[_0x1eb3('0x12')][_0x1eb3('0x13')]===0x1f4){logger['error'](_0x1eb3('0xd'),_0x5e0735,_0x4d6215[_0x1eb3('0x12')]['message']);return _0x5a33cd(_0x4d6215[_0x1eb3('0x12')][_0x1eb3('0x14')]);}logger[_0x1eb3('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x5e0735,_0x4d6215['error'][_0x1eb3('0x14')]);return _0x29bc1f(_0x4d6215[_0x1eb3('0x12')][_0x1eb3('0x14')]);}else{logger['info'](_0x1eb3('0xd'),_0x5e0735,'request\x20sent');_0x29bc1f(_0x4d6215[_0x1eb3('0x15')][_0x1eb3('0x14')]);}})[_0x1eb3('0x16')](function(_0x3cab3a){logger[_0x1eb3('0x12')](_0x1eb3('0xd'),_0x5e0735,_0x3cab3a);_0x5a33cd(_0x3cab3a);});});}exports[_0x1eb3('0x17')]=function(_0x39c1d7){var _0x2075ce=this;return new Promise(function(_0x2ca2fa,_0x1c12d1){return db[_0x1eb3('0x18')]['create'](_0x39c1d7[_0x1eb3('0x19')],{'raw':_0x39c1d7[_0x1eb3('0x1a')]?_0x39c1d7['options'][_0x1eb3('0x1b')]===undefined?!![]:![]:!![]})[_0x1eb3('0xb')](function(_0x65d8b8){logger[_0x1eb3('0xc')](_0x1eb3('0x17'),_0x39c1d7);logger['debug']('CreateSmsQueueReport',_0x39c1d7,JSON[_0x1eb3('0x11')](_0x65d8b8));_0x2ca2fa(_0x65d8b8);})[_0x1eb3('0x16')](function(_0x5e538f){logger[_0x1eb3('0x12')](_0x1eb3('0x17'),_0x5e538f[_0x1eb3('0x14')],_0x39c1d7);_0x1c12d1(_0x2075ce[_0x1eb3('0x12')](0x1f4,_0x5e538f['message']));});});};exports[_0x1eb3('0x1c')]=function(_0x33b33b){var _0x1d5e71=this;return new Promise(function(_0x1afc5f,_0x14ccc3){return db[_0x1eb3('0x18')]['update'](_0x33b33b['body'],{'raw':_0x33b33b[_0x1eb3('0x1a')]?_0x33b33b[_0x1eb3('0x1a')][_0x1eb3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b33b[_0x1eb3('0x1a')]?_0x33b33b[_0x1eb3('0x1a')][_0x1eb3('0x1d')]||null:null,'attributes':_0x33b33b[_0x1eb3('0x1a')]?_0x33b33b[_0x1eb3('0x1a')]['attributes']||null:null,'limit':_0x33b33b['options']?_0x33b33b[_0x1eb3('0x1a')][_0x1eb3('0x1e')]||null:null})[_0x1eb3('0xb')](function(_0x5e2788){logger[_0x1eb3('0xc')]('UpdateSmsQueueReport',_0x33b33b);logger[_0x1eb3('0xf')]('UpdateSmsQueueReport',_0x33b33b,JSON[_0x1eb3('0x11')](_0x5e2788));_0x1afc5f(_0x5e2788);})[_0x1eb3('0x16')](function(_0x47c038){logger['error']('UpdateSmsQueueReport',_0x47c038[_0x1eb3('0x14')],_0x33b33b);_0x14ccc3(_0x1d5e71[_0x1eb3('0x12')](0x1f4,_0x47c038[_0x1eb3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9ac4eb2..221e366 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 _0x33c5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x33c5,0xe6));var _0x533c=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x33c5[_0x3987a1];return _0xe2596e;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);router[_0x533c('0xf')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/:id',auth[_0x533c('0x9')](),controller[_0x533c('0x12')]);router[_0x533c('0x13')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2413cb,_0x170870){var _0x216efd=function(_0x3d324a){while(--_0x3d324a){_0x2413cb['push'](_0x2413cb['shift']());}};_0x216efd(++_0x170870);}(_0xe5b3,0x133));var _0x3e5b=function(_0x245b3b,_0x161dff){_0x245b3b=_0x245b3b-0x0;var _0x249d89=_0xe5b3[_0x245b3b];return _0x249d89;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a4b2638..b1ddeff 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5eb4bb,_0xbd4598){var _0x12d25b=function(_0x4f0ccd){while(--_0x4f0ccd){_0x5eb4bb['push'](_0x5eb4bb['shift']());}};_0x12d25b(++_0xbd4598);}(_0x008c,0x188));var _0xc008=function(_0x2e8775,_0x310049){_0x2e8775=_0x2e8775-0x0;var _0x4cbf35=_0x008c[_0x2e8775];return _0x4cbf35;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3d0fb4,_0x4e5464){var _0xea699f=function(_0x3f863d){while(--_0x3f863d){_0x3d0fb4['push'](_0x3d0fb4['shift']());}};_0xea699f(++_0x4e5464);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 383a123..6ceeeb9 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 _0x5415=['nolimit','order','sort','where','filter','merge','map','options','include','rows','catch','show','SmsTransferReport','length','includeAll','find','create','body','params','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x4152c0,_0x276353){var _0x4c4f34=function(_0x592150){while(--_0x592150){_0x4152c0['push'](_0x4152c0['shift']());}};_0x4c4f34(++_0x276353);}(_0x5415,0x1ee));var _0x5541=function(_0x11f06c,_0x4a6611){_0x11f06c=_0x11f06c-0x0;var _0x432f2a=_0x5415[_0x11f06c];return _0x432f2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5541('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5541('0x1'));var moment=require('moment');var BPromise=require(_0x5541('0x2'));var Mustache=require(_0x5541('0x3'));var util=require(_0x5541('0x4'));var path=require(_0x5541('0x5'));var sox=require(_0x5541('0x6'));var csv=require(_0x5541('0x7'));var ejs=require(_0x5541('0x8'));var fs=require('fs');var fs_extra=require(_0x5541('0x9'));var _=require(_0x5541('0xa'));var squel=require(_0x5541('0xb'));var crypto=require('crypto');var jsforce=require(_0x5541('0xc'));var deskjs=require(_0x5541('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5541('0xe'));var Papa=require(_0x5541('0xf'));var Redis=require(_0x5541('0x10'));var authService=require(_0x5541('0x11'));var qs=require(_0x5541('0x12'));var as=require(_0x5541('0x13'));var hardwareService=require(_0x5541('0x14'));var logger=require(_0x5541('0x15'))(_0x5541('0x16'));var utils=require(_0x5541('0x17'));var config=require(_0x5541('0x18'));var licenseUtil=require(_0x5541('0x19'));var db=require(_0x5541('0x1a'))['db'];function respondWithStatusCode(_0x3656b3,_0x199928){_0x199928=_0x199928||0xcc;return function(_0x2d6270){if(_0x2d6270){return _0x3656b3['sendStatus'](_0x199928);}return _0x3656b3[_0x5541('0x1b')](_0x199928)[_0x5541('0x1c')]();};}function respondWithResult(_0x2d4f31,_0x5b5d61){_0x5b5d61=_0x5b5d61||0xc8;return function(_0x3b3693){if(_0x3b3693){return _0x2d4f31['status'](_0x5b5d61)[_0x5541('0x1d')](_0x3b3693);}};}function respondWithFilteredResult(_0x288ea0,_0x5129d9){return function(_0xf94988){if(_0xf94988){var _0x35ce91=typeof _0x5129d9['offset']===_0x5541('0x1e')&&typeof _0x5129d9[_0x5541('0x1f')]===_0x5541('0x1e');var _0x2a1a89=_0xf94988[_0x5541('0x20')];var _0x46c522=_0x35ce91?0x0:_0x5129d9[_0x5541('0x21')];var _0x7b8bd0=_0x35ce91?_0xf94988['count']:_0x5129d9[_0x5541('0x21')]+_0x5129d9[_0x5541('0x1f')];var _0x5d9d8f;if(_0x7b8bd0>=_0x2a1a89){_0x7b8bd0=_0x2a1a89;_0x5d9d8f=0xc8;}else{_0x5d9d8f=0xce;}_0x288ea0[_0x5541('0x1b')](_0x5d9d8f);return _0x288ea0[_0x5541('0x22')](_0x5541('0x23'),_0x46c522+'-'+_0x7b8bd0+'/'+_0x2a1a89)[_0x5541('0x1d')](_0xf94988);}return null;};}function patchUpdates(_0x179774){return function(_0x2ba441){try{jsonpatch[_0x5541('0x24')](_0x2ba441,_0x179774,!![]);}catch(_0x37406b){return BPromise[_0x5541('0x25')](_0x37406b);}return _0x2ba441[_0x5541('0x26')]();};}function saveUpdates(_0x1fd47b,_0x514789){return function(_0x12633c){if(_0x12633c){return _0x12633c[_0x5541('0x27')](_0x1fd47b)[_0x5541('0x28')](function(_0x49e472){return _0x49e472;});}return null;};}function removeEntity(_0x379a56,_0x3c3ac8){return function(_0x5e7c1d){if(_0x5e7c1d){return _0x5e7c1d[_0x5541('0x29')]()[_0x5541('0x28')](function(){_0x379a56[_0x5541('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b4b3c,_0x2e8a4b){return function(_0x9c6655){if(!_0x9c6655){_0x5b4b3c[_0x5541('0x2a')](0x194);}return _0x9c6655;};}function handleError(_0x4a0f06,_0xfb0421){_0xfb0421=_0xfb0421||0x1f4;return function(_0x4a2cc6){logger[_0x5541('0x2b')](_0x4a2cc6[_0x5541('0x2c')]);if(_0x4a2cc6[_0x5541('0x2d')]){delete _0x4a2cc6[_0x5541('0x2d')];}_0x4a0f06[_0x5541('0x1b')](_0xfb0421)[_0x5541('0x2e')](_0x4a2cc6);};}exports[_0x5541('0x2f')]=function(_0x2ea526,_0x5d8a7d){var _0x365323={},_0x1b8f64={},_0x502828={'count':0x0,'rows':[]};var _0x5d8e0d=_['map'](db['SmsTransferReport'][_0x5541('0x30')],function(_0x5a15ff){return{'name':_0x5a15ff['fieldName'],'type':_0x5a15ff[_0x5541('0x31')][_0x5541('0x32')]};});_0x1b8f64[_0x5541('0x33')]=_['map'](_0x5d8e0d,_0x5541('0x2d'));_0x1b8f64[_0x5541('0x34')]=_[_0x5541('0x35')](_0x2ea526['query']);_0x1b8f64[_0x5541('0x36')]=_[_0x5541('0x37')](_0x1b8f64[_0x5541('0x33')],_0x1b8f64[_0x5541('0x34')]);_0x365323[_0x5541('0x38')]=_['intersection'](_0x1b8f64[_0x5541('0x33')],qs[_0x5541('0x39')](_0x2ea526['query'][_0x5541('0x39')]));_0x365323[_0x5541('0x38')]=_0x365323[_0x5541('0x38')]['length']?_0x365323[_0x5541('0x38')]:_0x1b8f64[_0x5541('0x33')];if(!_0x2ea526[_0x5541('0x34')][_0x5541('0x3a')](_0x5541('0x3b'))){_0x365323['limit']=qs[_0x5541('0x1f')](_0x2ea526['query'][_0x5541('0x1f')]);_0x365323[_0x5541('0x21')]=qs['offset'](_0x2ea526[_0x5541('0x34')][_0x5541('0x21')]);}_0x365323[_0x5541('0x3c')]=qs[_0x5541('0x3d')](_0x2ea526[_0x5541('0x34')]['sort']);_0x365323[_0x5541('0x3e')]=qs[_0x5541('0x36')](_['pick'](_0x2ea526['query'],_0x1b8f64[_0x5541('0x36')]),_0x5d8e0d);if(_0x2ea526['query'][_0x5541('0x3f')]){_0x365323[_0x5541('0x3e')]=_[_0x5541('0x40')](_0x365323['where'],{'$or':_[_0x5541('0x41')](_0x5d8e0d,function(_0x53f1e0){if(_0x53f1e0['type']!=='VIRTUAL'){var _0x2237f1={};_0x2237f1[_0x53f1e0[_0x5541('0x2d')]]={'$like':'%'+_0x2ea526[_0x5541('0x34')][_0x5541('0x3f')]+'%'};return _0x2237f1;}})});}_0x365323=_[_0x5541('0x40')]({},_0x365323,_0x2ea526[_0x5541('0x42')]);var _0x1ae7e9={'where':_0x365323[_0x5541('0x3e')]};return db['SmsTransferReport']['count'](_0x1ae7e9)[_0x5541('0x28')](function(_0x34411b){_0x502828[_0x5541('0x20')]=_0x34411b;if(_0x2ea526[_0x5541('0x34')]['includeAll']){_0x365323[_0x5541('0x43')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x365323);})['then'](function(_0x2b11f4){_0x502828[_0x5541('0x44')]=_0x2b11f4;return _0x502828;})['then'](respondWithFilteredResult(_0x5d8a7d,_0x365323))[_0x5541('0x45')](handleError(_0x5d8a7d,null));};exports[_0x5541('0x46')]=function(_0x408b10,_0x128aa7){var _0x2b9c0a={'raw':!![],'where':{'id':_0x408b10['params']['id']}},_0x4926fe={};_0x4926fe[_0x5541('0x33')]=_['keys'](db[_0x5541('0x47')]['rawAttributes']);_0x4926fe[_0x5541('0x34')]=_['keys'](_0x408b10[_0x5541('0x34')]);_0x4926fe['filters']=_[_0x5541('0x37')](_0x4926fe[_0x5541('0x33')],_0x4926fe[_0x5541('0x34')]);_0x2b9c0a[_0x5541('0x38')]=_['intersection'](_0x4926fe[_0x5541('0x33')],qs[_0x5541('0x39')](_0x408b10[_0x5541('0x34')]['fields']));_0x2b9c0a[_0x5541('0x38')]=_0x2b9c0a[_0x5541('0x38')][_0x5541('0x48')]?_0x2b9c0a['attributes']:_0x4926fe[_0x5541('0x33')];if(_0x408b10[_0x5541('0x34')][_0x5541('0x49')]){_0x2b9c0a[_0x5541('0x43')]=[{'all':!![]}];}_0x2b9c0a=_[_0x5541('0x40')]({},_0x2b9c0a,_0x408b10['options']);return db[_0x5541('0x47')][_0x5541('0x4a')](_0x2b9c0a)[_0x5541('0x28')](handleEntityNotFound(_0x128aa7,null))['then'](respondWithResult(_0x128aa7,null))[_0x5541('0x45')](handleError(_0x128aa7,null));};exports['create']=function(_0x5fc7d3,_0x4e9b61){return db[_0x5541('0x47')][_0x5541('0x4b')](_0x5fc7d3[_0x5541('0x4c')],{})['then'](respondWithResult(_0x4e9b61,0xc9))['catch'](handleError(_0x4e9b61,null));};exports['update']=function(_0x37b56e,_0x2340e7){if(_0x37b56e[_0x5541('0x4c')]['id']){delete _0x37b56e[_0x5541('0x4c')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x37b56e[_0x5541('0x4d')]['id']}})[_0x5541('0x28')](handleEntityNotFound(_0x2340e7,null))['then'](saveUpdates(_0x37b56e[_0x5541('0x4c')],null))[_0x5541('0x28')](respondWithResult(_0x2340e7,null))[_0x5541('0x45')](handleError(_0x2340e7,null));};exports[_0x5541('0x29')]=function(_0x70802c,_0x52e6f4){return db[_0x5541('0x47')][_0x5541('0x4a')]({'where':{'id':_0x70802c[_0x5541('0x4d')]['id']}})[_0x5541('0x28')](handleEntityNotFound(_0x52e6f4,null))[_0x5541('0x28')](removeEntity(_0x52e6f4,null))[_0x5541('0x45')](handleError(_0x52e6f4,null));};exports[_0x5541('0x4e')]=function(_0x637d70,_0x1519fb){return db[_0x5541('0x47')][_0x5541('0x4e')]()['then'](respondWithResult(_0x1519fb,null))[_0x5541('0x45')](handleError(_0x1519fb,null));}; \ No newline at end of file +var _0xb396=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','params','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4bcd16,_0x519256){var _0x61c0fb=function(_0x46fe6e){while(--_0x46fe6e){_0x4bcd16['push'](_0x4bcd16['shift']());}};_0x61c0fb(++_0x519256);}(_0xb396,0x168));var _0x6b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb396[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b39('0x0'));var jsonpatch=require(_0x6b39('0x1'));var rp=require(_0x6b39('0x2'));var moment=require(_0x6b39('0x3'));var BPromise=require(_0x6b39('0x4'));var Mustache=require(_0x6b39('0x5'));var util=require(_0x6b39('0x6'));var path=require('path');var sox=require(_0x6b39('0x7'));var csv=require(_0x6b39('0x8'));var ejs=require(_0x6b39('0x9'));var fs=require('fs');var fs_extra=require(_0x6b39('0xa'));var _=require(_0x6b39('0xb'));var squel=require(_0x6b39('0xc'));var crypto=require(_0x6b39('0xd'));var jsforce=require(_0x6b39('0xe'));var deskjs=require(_0x6b39('0xf'));var toCsv=require(_0x6b39('0x8'));var querystring=require(_0x6b39('0x10'));var Papa=require(_0x6b39('0x11'));var Redis=require(_0x6b39('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6b39('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b39('0x14'));var utils=require(_0x6b39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b39('0x16'));var db=require(_0x6b39('0x17'))['db'];function respondWithStatusCode(_0x24a562,_0x30dc63){_0x30dc63=_0x30dc63||0xcc;return function(_0x30d11b){if(_0x30d11b){return _0x24a562[_0x6b39('0x18')](_0x30dc63);}return _0x24a562['status'](_0x30dc63)[_0x6b39('0x19')]();};}function respondWithResult(_0x4078ab,_0x401fad){_0x401fad=_0x401fad||0xc8;return function(_0x40ed5d){if(_0x40ed5d){return _0x4078ab[_0x6b39('0x1a')](_0x401fad)['json'](_0x40ed5d);}};}function respondWithFilteredResult(_0x5112cf,_0x2f1f68){return function(_0x327e8f){if(_0x327e8f){var _0x54013c=typeof _0x2f1f68[_0x6b39('0x1b')]===_0x6b39('0x1c')&&typeof _0x2f1f68[_0x6b39('0x1d')]===_0x6b39('0x1c');var _0x9f23a7=_0x327e8f['count'];var _0x315728=_0x54013c?0x0:_0x2f1f68[_0x6b39('0x1b')];var _0x44ced6=_0x54013c?_0x327e8f[_0x6b39('0x1e')]:_0x2f1f68[_0x6b39('0x1b')]+_0x2f1f68[_0x6b39('0x1d')];var _0x4ef674;if(_0x44ced6>=_0x9f23a7){_0x44ced6=_0x9f23a7;_0x4ef674=0xc8;}else{_0x4ef674=0xce;}_0x5112cf['status'](_0x4ef674);return _0x5112cf['set'](_0x6b39('0x1f'),_0x315728+'-'+_0x44ced6+'/'+_0x9f23a7)['json'](_0x327e8f);}return null;};}function patchUpdates(_0x2d0467){return function(_0x18273a){try{jsonpatch[_0x6b39('0x20')](_0x18273a,_0x2d0467,!![]);}catch(_0x334d10){return BPromise[_0x6b39('0x21')](_0x334d10);}return _0x18273a[_0x6b39('0x22')]();};}function saveUpdates(_0x197482,_0x11e546){return function(_0x40395f){if(_0x40395f){return _0x40395f[_0x6b39('0x23')](_0x197482)[_0x6b39('0x24')](function(_0x4826e8){return _0x4826e8;});}return null;};}function removeEntity(_0x4310f4,_0x474d8b){return function(_0x47d763){if(_0x47d763){return _0x47d763['destroy']()['then'](function(){_0x4310f4['status'](0xcc)[_0x6b39('0x19')]();});}};}function handleEntityNotFound(_0x565166,_0x2ad135){return function(_0x4dcd76){if(!_0x4dcd76){_0x565166[_0x6b39('0x18')](0x194);}return _0x4dcd76;};}function handleError(_0x13f79a,_0x135ac5){_0x135ac5=_0x135ac5||0x1f4;return function(_0x27bca8){logger['error'](_0x27bca8[_0x6b39('0x25')]);if(_0x27bca8[_0x6b39('0x26')]){delete _0x27bca8[_0x6b39('0x26')];}_0x13f79a[_0x6b39('0x1a')](_0x135ac5)[_0x6b39('0x27')](_0x27bca8);};}exports[_0x6b39('0x28')]=function(_0x3e7ef6,_0x6e5de5){var _0x21e4f2={},_0x408b86={},_0x471110={'count':0x0,'rows':[]};var _0x509673=_[_0x6b39('0x29')](db[_0x6b39('0x2a')][_0x6b39('0x2b')],function(_0x158d28){return{'name':_0x158d28[_0x6b39('0x2c')],'type':_0x158d28[_0x6b39('0x2d')][_0x6b39('0x2e')]};});_0x408b86[_0x6b39('0x2f')]=_[_0x6b39('0x29')](_0x509673,'name');_0x408b86[_0x6b39('0x30')]=_[_0x6b39('0x31')](_0x3e7ef6[_0x6b39('0x30')]);_0x408b86[_0x6b39('0x32')]=_[_0x6b39('0x33')](_0x408b86[_0x6b39('0x2f')],_0x408b86[_0x6b39('0x30')]);_0x21e4f2[_0x6b39('0x34')]=_[_0x6b39('0x33')](_0x408b86['model'],qs[_0x6b39('0x35')](_0x3e7ef6[_0x6b39('0x30')][_0x6b39('0x35')]));_0x21e4f2['attributes']=_0x21e4f2[_0x6b39('0x34')][_0x6b39('0x36')]?_0x21e4f2[_0x6b39('0x34')]:_0x408b86[_0x6b39('0x2f')];if(!_0x3e7ef6[_0x6b39('0x30')]['hasOwnProperty']('nolimit')){_0x21e4f2['limit']=qs[_0x6b39('0x1d')](_0x3e7ef6['query']['limit']);_0x21e4f2[_0x6b39('0x1b')]=qs[_0x6b39('0x1b')](_0x3e7ef6[_0x6b39('0x30')][_0x6b39('0x1b')]);}_0x21e4f2[_0x6b39('0x37')]=qs[_0x6b39('0x38')](_0x3e7ef6['query']['sort']);_0x21e4f2['where']=qs['filters'](_[_0x6b39('0x39')](_0x3e7ef6[_0x6b39('0x30')],_0x408b86[_0x6b39('0x32')]),_0x509673);if(_0x3e7ef6[_0x6b39('0x30')][_0x6b39('0x3a')]){_0x21e4f2['where']=_[_0x6b39('0x3b')](_0x21e4f2['where'],{'$or':_[_0x6b39('0x29')](_0x509673,function(_0x2db849){if(_0x2db849[_0x6b39('0x2d')]!==_0x6b39('0x3c')){var _0x5a29f6={};_0x5a29f6[_0x2db849[_0x6b39('0x26')]]={'$like':'%'+_0x3e7ef6['query']['filter']+'%'};return _0x5a29f6;}})});}_0x21e4f2=_[_0x6b39('0x3b')]({},_0x21e4f2,_0x3e7ef6[_0x6b39('0x3d')]);var _0x4684d3={'where':_0x21e4f2[_0x6b39('0x3e')]};return db[_0x6b39('0x2a')][_0x6b39('0x1e')](_0x4684d3)[_0x6b39('0x24')](function(_0x1babb6){_0x471110[_0x6b39('0x1e')]=_0x1babb6;if(_0x3e7ef6[_0x6b39('0x30')][_0x6b39('0x3f')]){_0x21e4f2['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x6b39('0x40')](_0x21e4f2);})[_0x6b39('0x24')](function(_0x3f9be5){_0x471110[_0x6b39('0x41')]=_0x3f9be5;return _0x471110;})[_0x6b39('0x24')](respondWithFilteredResult(_0x6e5de5,_0x21e4f2))[_0x6b39('0x42')](handleError(_0x6e5de5,null));};exports[_0x6b39('0x43')]=function(_0x1f36f9,_0xaece58){var _0x2a5244={'raw':!![],'where':{'id':_0x1f36f9[_0x6b39('0x44')]['id']}},_0x678353={};_0x678353[_0x6b39('0x2f')]=_['keys'](db['SmsTransferReport'][_0x6b39('0x2b')]);_0x678353['query']=_[_0x6b39('0x31')](_0x1f36f9['query']);_0x678353[_0x6b39('0x32')]=_[_0x6b39('0x33')](_0x678353[_0x6b39('0x2f')],_0x678353['query']);_0x2a5244[_0x6b39('0x34')]=_[_0x6b39('0x33')](_0x678353[_0x6b39('0x2f')],qs['fields'](_0x1f36f9[_0x6b39('0x30')][_0x6b39('0x35')]));_0x2a5244[_0x6b39('0x34')]=_0x2a5244['attributes'][_0x6b39('0x36')]?_0x2a5244['attributes']:_0x678353['model'];if(_0x1f36f9['query']['includeAll']){_0x2a5244['include']=[{'all':!![]}];}_0x2a5244=_['merge']({},_0x2a5244,_0x1f36f9[_0x6b39('0x3d')]);return db['SmsTransferReport']['find'](_0x2a5244)[_0x6b39('0x24')](handleEntityNotFound(_0xaece58,null))[_0x6b39('0x24')](respondWithResult(_0xaece58,null))['catch'](handleError(_0xaece58,null));};exports[_0x6b39('0x45')]=function(_0x173ca6,_0x184324){return db[_0x6b39('0x2a')]['create'](_0x173ca6[_0x6b39('0x46')],{})[_0x6b39('0x24')](respondWithResult(_0x184324,0xc9))['catch'](handleError(_0x184324,null));};exports[_0x6b39('0x23')]=function(_0x43abdf,_0x1941eb){if(_0x43abdf[_0x6b39('0x46')]['id']){delete _0x43abdf['body']['id'];}return db[_0x6b39('0x2a')][_0x6b39('0x47')]({'where':{'id':_0x43abdf[_0x6b39('0x44')]['id']}})[_0x6b39('0x24')](handleEntityNotFound(_0x1941eb,null))[_0x6b39('0x24')](saveUpdates(_0x43abdf[_0x6b39('0x46')],null))[_0x6b39('0x24')](respondWithResult(_0x1941eb,null))['catch'](handleError(_0x1941eb,null));};exports['destroy']=function(_0x5ac03b,_0x32cf99){return db[_0x6b39('0x2a')][_0x6b39('0x47')]({'where':{'id':_0x5ac03b[_0x6b39('0x44')]['id']}})[_0x6b39('0x24')](handleEntityNotFound(_0x32cf99,null))[_0x6b39('0x24')](removeEntity(_0x32cf99,null))[_0x6b39('0x42')](handleError(_0x32cf99,null));};exports[_0x6b39('0x48')]=function(_0x304667,_0x30bf86){return db[_0x6b39('0x2a')][_0x6b39('0x48')]()[_0x6b39('0x24')](respondWithResult(_0x30bf86,null))['catch'](handleError(_0x30bf86,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 02c8ebe..a624ff3 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 _0x0a16=['exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x13b931,_0x17b351){var _0x1ef366=function(_0x52c884){while(--_0x52c884){_0x13b931['push'](_0x13b931['shift']());}};_0x1ef366(++_0x17b351);}(_0x0a16,0x10e));var _0x60a1=function(_0x1346f2,_0x38f203){_0x1346f2=_0x1346f2-0x0;var _0x1769d2=_0x0a16[_0x1346f2];return _0x1769d2;};'use strict';var _=require(_0x60a1('0x0'));var util=require(_0x60a1('0x1'));var logger=require(_0x60a1('0x2'))(_0x60a1('0x3'));var moment=require(_0x60a1('0x4'));var BPromise=require('bluebird');var rp=require(_0x60a1('0x5'));var fs=require('fs');var path=require(_0x60a1('0x6'));var rimraf=require(_0x60a1('0x7'));var config=require(_0x60a1('0x8'));var attributes=require(_0x60a1('0x9'));module[_0x60a1('0xa')]=function(_0x170ea6,_0x537fb7){return _0x170ea6['define'](_0x60a1('0xb'),attributes,{'tableName':_0x60a1('0xc'),'paranoid':![],'indexes':[{'name':_0x60a1('0xd'),'fields':[_0x60a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd6=['lodash','util','api','moment','request-promise','path','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0cd6,0x113));var _0x60cd=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x0cd6[_0x25d2fb];return _0x1ded53;};'use strict';var _=require(_0x60cd('0x0'));var util=require(_0x60cd('0x1'));var logger=require('../../config/logger')(_0x60cd('0x2'));var moment=require(_0x60cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x60cd('0x4'));var fs=require('fs');var path=require(_0x60cd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60cd('0x6'));module[_0x60cd('0x7')]=function(_0x22f155,_0x4e3293){return _0x22f155[_0x60cd('0x8')]('SmsTransferReport',attributes,{'tableName':_0x60cd('0x9'),'paranoid':![],'indexes':[{'name':_0x60cd('0xa'),'fields':[_0x60cd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 96c7eba..5101614 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 _0x0a9f=['ioredis','../../config/utils','client','http','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x37028d,_0x4991ec){var _0x45f201=function(_0x2626de){while(--_0x2626de){_0x37028d['push'](_0x37028d['shift']());}};_0x45f201(++_0x4991ec);}(_0x0a9f,0x64));var _0xf0a9=function(_0x4afc2c,_0x336a88){_0x4afc2c=_0x4afc2c-0x0;var _0x164084=_0x0a9f[_0x4afc2c];return _0x164084;};'use strict';var _=require('lodash');var util=require(_0xf0a9('0x0'));var moment=require(_0xf0a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0a9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0a9('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0a9('0x4')][_0xf0a9('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4e9fa6,_0x63889e,_0x4d14e0){return new BPromise(function(_0x798586,_0x399cf8){return client['request'](_0x4e9fa6,_0x4d14e0)[_0xf0a9('0x6')](function(_0x27c500){logger[_0xf0a9('0x7')]('SmsTransferReport,\x20%s,\x20%s',_0x63889e,_0xf0a9('0x8'));logger['debug'](_0xf0a9('0x9'),_0x63889e,_0xf0a9('0x8'),JSON[_0xf0a9('0xa')](_0x27c500));if(_0x27c500[_0xf0a9('0xb')]){if(_0x27c500['error'][_0xf0a9('0xc')]===0x1f4){logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x27c500[_0xf0a9('0xb')]['message']);return _0x399cf8(_0x27c500['error'][_0xf0a9('0xe')]);}logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x27c500[_0xf0a9('0xb')][_0xf0a9('0xe')]);return _0x798586(_0x27c500[_0xf0a9('0xb')][_0xf0a9('0xe')]);}else{logger['info'](_0xf0a9('0xd'),_0x63889e,_0xf0a9('0x8'));_0x798586(_0x27c500[_0xf0a9('0xf')]['message']);}})[_0xf0a9('0x10')](function(_0x5ea7ad){logger[_0xf0a9('0xb')](_0xf0a9('0xd'),_0x63889e,_0x5ea7ad);_0x399cf8(_0x5ea7ad);});});} \ No newline at end of file +var _0x75a2=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x75a2,0x187));var _0x275a=function(_0x1eb2bd,_0x5d1980){_0x1eb2bd=_0x1eb2bd-0x0;var _0x2b59f5=_0x75a2[_0x1eb2bd];return _0x2b59f5;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require('bluebird');var rs=require(_0x275a('0x3'));var fs=require('fs');var Redis=require(_0x275a('0x4'));var db=require(_0x275a('0x5'))['db'];var utils=require(_0x275a('0x6'));var logger=require('../../config/logger')(_0x275a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32f0cb,_0x12cad9,_0x17ad5e){return new BPromise(function(_0x38b303,_0x525950){return client['request'](_0x32f0cb,_0x17ad5e)[_0x275a('0x8')](function(_0x46f9c7){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x12cad9,'request\x20sent');logger[_0x275a('0x9')](_0x275a('0xa'),_0x12cad9,_0x275a('0xb'),JSON[_0x275a('0xc')](_0x46f9c7));if(_0x46f9c7[_0x275a('0xd')]){if(_0x46f9c7[_0x275a('0xd')][_0x275a('0xe')]===0x1f4){logger[_0x275a('0xd')](_0x275a('0xf'),_0x12cad9,_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);return _0x525950(_0x46f9c7['error'][_0x275a('0x10')]);}logger[_0x275a('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x12cad9,_0x46f9c7['error'][_0x275a('0x10')]);return _0x38b303(_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);}else{logger[_0x275a('0x11')](_0x275a('0xf'),_0x12cad9,_0x275a('0xb'));_0x38b303(_0x46f9c7[_0x275a('0x12')][_0x275a('0x10')]);}})[_0x275a('0x13')](function(_0x58e54d){logger['error'](_0x275a('0xf'),_0x12cad9,_0x58e54d);_0x525950(_0x58e54d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5059754..ed04c50 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 _0x7257=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0x7257,0x1ac));var _0x7725=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0x7257[_0x3feb8a];return _0x4523ca;};'use strict';var multer=require(_0x7725('0x0'));var util=require(_0x7725('0x1'));var path=require(_0x7725('0x2'));var timeout=require(_0x7725('0x3'));var express=require(_0x7725('0x4'));var router=express[_0x7725('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7725('0x6'));var interaction=require(_0x7725('0x7'));var config=require(_0x7725('0x8'));var controller=require(_0x7725('0x9'));router[_0x7725('0xa')]('/',auth['isAuthenticated'](),controller[_0x7725('0xb')]);router['get'](_0x7725('0xc'),auth[_0x7725('0xd')](),controller[_0x7725('0xe')]);router['get'](_0x7725('0xf'),auth[_0x7725('0xd')](),controller[_0x7725('0x10')]);var upload=multer({'storage':multer[_0x7725('0x11')]({'destination':function(_0x1b5c28,_0x4bd810,_0x725c43){_0x725c43(null,path[_0x7725('0x12')](config[_0x7725('0x13')],_0x7725('0x14')));},'filename':function(_0x128fa4,_0x256e26,_0xa0b2ba){_0x256e26[_0x7725('0x15')]=_0x256e26[_0x7725('0x15')][_0x7725('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa0b2ba(null,util['format'](_0x7725('0x17'),path[_0x7725('0x18')](_0x256e26[_0x7725('0x15')],path[_0x7725('0x19')](_0x256e26[_0x7725('0x15')])),Date[_0x7725('0x1a')](),path[_0x7725('0x19')](_0x256e26['originalname'])));}})});router[_0x7725('0x1b')]('/',upload['single']('file'),controller['create']);router[_0x7725('0x1c')](_0x7725('0xc'),auth[_0x7725('0xd')](),controller[_0x7725('0x1d')]);router['delete'](_0x7725('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0x7725('0x1e')]=router; \ No newline at end of file +var _0xef2e=['get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xef2e,0x141));var _0xeef2=function(_0x36585d,_0x24d96e){_0x36585d=_0x36585d-0x0;var _0x450532=_0xef2e[_0x36585d];return _0x450532;};'use strict';var multer=require('multer');var util=require(_0xeef2('0x0'));var path=require(_0xeef2('0x1'));var timeout=require(_0xeef2('0x2'));var express=require(_0xeef2('0x3'));var router=express[_0xeef2('0x4')]();var fs_extra=require(_0xeef2('0x5'));var auth=require(_0xeef2('0x6'));var interaction=require(_0xeef2('0x7'));var config=require(_0xeef2('0x8'));var controller=require('./sound.controller');router[_0xeef2('0x9')]('/',auth[_0xeef2('0xa')](),controller[_0xeef2('0xb')]);router['get'](_0xeef2('0xc'),auth['isAuthenticated'](),controller[_0xeef2('0xd')]);router[_0xeef2('0x9')](_0xeef2('0xe'),auth[_0xeef2('0xa')](),controller[_0xeef2('0xf')]);var upload=multer({'storage':multer[_0xeef2('0x10')]({'destination':function(_0x457005,_0x164277,_0x4d3112){_0x4d3112(null,path[_0xeef2('0x11')](config[_0xeef2('0x12')],_0xeef2('0x13')));},'filename':function(_0x246615,_0x2deb85,_0xb04ac7){_0x2deb85[_0xeef2('0x14')]=_0x2deb85[_0xeef2('0x14')][_0xeef2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb04ac7(null,util[_0xeef2('0x16')](_0xeef2('0x17'),path['basename'](_0x2deb85[_0xeef2('0x14')],path[_0xeef2('0x18')](_0x2deb85[_0xeef2('0x14')])),Date[_0xeef2('0x19')](),path[_0xeef2('0x18')](_0x2deb85['originalname'])));}})});router[_0xeef2('0x1a')]('/',upload['single'](_0xeef2('0x1b')),controller[_0xeef2('0x1c')]);router[_0xeef2('0x1d')](_0xeef2('0xc'),auth['isAuthenticated'](),controller[_0xeef2('0x1e')]);router[_0xeef2('0x1f')](_0xeef2('0xc'),auth[_0xeef2('0xa')](),controller[_0xeef2('0x1f')]);module[_0xeef2('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c6a7b15..3f93afa 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 _0x0962=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x4f8434,_0x562ed5){var _0x5bd5e4=function(_0x3adab6){while(--_0x3adab6){_0x4f8434['push'](_0x4f8434['shift']());}};_0x5bd5e4(++_0x562ed5);}(_0x0962,0x15d));var _0x2096=function(_0x495796,_0x5ef094){_0x495796=_0x495796-0x0;var _0x202d3=_0x0962[_0x495796];return _0x202d3;};'use strict';var Sequelize=require(_0x2096('0x0'));module[_0x2096('0x1')]={'name':{'type':Sequelize[_0x2096('0x2')],'unique':_0x2096('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2096('0x2')]},'display_name':{'type':Sequelize[_0x2096('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2096('0x2')]},'original_duration':{'type':Sequelize[_0x2096('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2096('0x5')]},'original_channelCount':{'type':Sequelize[_0x2096('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2096('0x6')]},'converted_format':{'type':Sequelize[_0x2096('0x2')]},'converted_duration':{'type':Sequelize[_0x2096('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2096('0x5')]},'converted_channelCount':{'type':Sequelize[_0x2096('0x6')]},'converted_bitRate':{'type':Sequelize[_0x2096('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2096('0x6')]}}; \ No newline at end of file +var _0xe546=['BIGINT','INTEGER','FLOAT','STRING','name'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xe546,0xe4));var _0x6e54=function(_0x15d1f7,_0x597509){_0x15d1f7=_0x15d1f7-0x0;var _0x4245ec=_0xe546[_0x15d1f7];return _0x4245ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e54('0x0')],'unique':_0x6e54('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x6e54('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x6e54('0x0')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x6e54('0x2')]},'original_channelCount':{'type':Sequelize[_0x6e54('0x3')]},'original_bitRate':{'type':Sequelize[_0x6e54('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x6e54('0x0')]},'converted_duration':{'type':Sequelize[_0x6e54('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x6e54('0x2')]},'converted_channelCount':{'type':Sequelize[_0x6e54('0x3')]},'converted_bitRate':{'type':Sequelize[_0x6e54('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8e9e5d4..83453da 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 _0x48a3=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','length','find','download','save_name','existsSync','join','server/files/sounds/converted','converted_format','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_bitRate','converted_sampleRate','chmodSync','role','userProfileId','user','get','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','delete','original_format','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x29d9e8,_0x1b43cf){var _0x37c793=function(_0x4f714f){while(--_0x4f714f){_0x29d9e8['push'](_0x29d9e8['shift']());}};_0x37c793(++_0x1b43cf);}(_0x48a3,0x71));var _0x348a=function(_0x27f995,_0x518925){_0x27f995=_0x27f995-0x0;var _0x5961fe=_0x48a3[_0x27f995];return _0x5961fe;};'use strict';var emlformat=require(_0x348a('0x0'));var rimraf=require(_0x348a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x348a('0x2'));var moment=require(_0x348a('0x3'));var BPromise=require(_0x348a('0x4'));var Mustache=require(_0x348a('0x5'));var util=require(_0x348a('0x6'));var path=require(_0x348a('0x7'));var sox=require(_0x348a('0x8'));var csv=require('to-csv');var ejs=require(_0x348a('0x9'));var fs=require('fs');var fs_extra=require(_0x348a('0xa'));var _=require(_0x348a('0xb'));var squel=require(_0x348a('0xc'));var crypto=require(_0x348a('0xd'));var jsforce=require(_0x348a('0xe'));var deskjs=require(_0x348a('0xf'));var toCsv=require(_0x348a('0x10'));var querystring=require(_0x348a('0x11'));var Papa=require(_0x348a('0x12'));var Redis=require(_0x348a('0x13'));var authService=require(_0x348a('0x14'));var qs=require(_0x348a('0x15'));var as=require(_0x348a('0x16'));var hardwareService=require(_0x348a('0x17'));var logger=require(_0x348a('0x18'))(_0x348a('0x19'));var utils=require(_0x348a('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31f5bf,_0x2555e3){_0x2555e3=_0x2555e3||0xcc;return function(_0x488b33){if(_0x488b33){return _0x31f5bf['sendStatus'](_0x2555e3);}return _0x31f5bf[_0x348a('0x1b')](_0x2555e3)[_0x348a('0x1c')]();};}function respondWithResult(_0x18e3d9,_0x2e9713){_0x2e9713=_0x2e9713||0xc8;return function(_0x40c47b){if(_0x40c47b){return _0x18e3d9[_0x348a('0x1b')](_0x2e9713)[_0x348a('0x1d')](_0x40c47b);}};}function respondWithFilteredResult(_0x428640,_0x16034c){return function(_0x5c3283){if(_0x5c3283){var _0xc129be=typeof _0x16034c[_0x348a('0x1e')]===_0x348a('0x1f')&&typeof _0x16034c[_0x348a('0x20')]===_0x348a('0x1f');var _0x4bcc99=_0x5c3283['count'];var _0x2f1d46=_0xc129be?0x0:_0x16034c[_0x348a('0x1e')];var _0x2443d2=_0xc129be?_0x5c3283[_0x348a('0x21')]:_0x16034c[_0x348a('0x1e')]+_0x16034c[_0x348a('0x20')];var _0x136948;if(_0x2443d2>=_0x4bcc99){_0x2443d2=_0x4bcc99;_0x136948=0xc8;}else{_0x136948=0xce;}_0x428640[_0x348a('0x1b')](_0x136948);return _0x428640[_0x348a('0x22')](_0x348a('0x23'),_0x2f1d46+'-'+_0x2443d2+'/'+_0x4bcc99)['json'](_0x5c3283);}return null;};}function patchUpdates(_0x56503f){return function(_0x24ab24){try{jsonpatch[_0x348a('0x24')](_0x24ab24,_0x56503f,!![]);}catch(_0x1c2bc9){return BPromise[_0x348a('0x25')](_0x1c2bc9);}return _0x24ab24[_0x348a('0x26')]();};}function saveUpdates(_0x5e3daf,_0xa3ed89){return function(_0x19ab61){if(_0x19ab61){return _0x19ab61['update'](_0x5e3daf)[_0x348a('0x27')](function(_0x1cd82c){return _0x1cd82c;});}return null;};}function removeEntity(_0x5ee4ea,_0x4278bf){return function(_0x1d4497){if(_0x1d4497){return _0x1d4497[_0x348a('0x28')]()[_0x348a('0x27')](function(){var _0x34d814=_0x1d4497['get']({'plain':!![]});var _0x59a482='Sounds';return db[_0x348a('0x29')][_0x348a('0x28')]({'where':{'type':_0x59a482,'resourceId':_0x34d814['id']}})[_0x348a('0x27')](function(){return _0x1d4497;});})[_0x348a('0x27')](function(){_0x5ee4ea[_0x348a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x456e2e,_0x1df02c){return function(_0xd33cb6){if(!_0xd33cb6){_0x456e2e[_0x348a('0x2a')](0x194);}return _0xd33cb6;};}function handleError(_0x1e9af8,_0x455c8d){_0x455c8d=_0x455c8d||0x1f4;return function(_0x28fb33){logger[_0x348a('0x2b')](_0x28fb33[_0x348a('0x2c')]);if(_0x28fb33['name']){delete _0x28fb33[_0x348a('0x2d')];}_0x1e9af8[_0x348a('0x1b')](_0x455c8d)[_0x348a('0x2e')](_0x28fb33);};}exports[_0x348a('0x2f')]=function(_0x433314,_0x8ae152){var _0xa24042={},_0x298556={},_0x40a599={'count':0x0,'rows':[]};var _0x1798fd=_[_0x348a('0x30')](db[_0x348a('0x31')][_0x348a('0x32')],function(_0x255a88){return{'name':_0x255a88[_0x348a('0x33')],'type':_0x255a88[_0x348a('0x34')]['key']};});_0x298556[_0x348a('0x35')]=_['map'](_0x1798fd,_0x348a('0x2d'));_0x298556[_0x348a('0x36')]=_[_0x348a('0x37')](_0x433314[_0x348a('0x36')]);_0x298556[_0x348a('0x38')]=_['intersection'](_0x298556[_0x348a('0x35')],_0x298556[_0x348a('0x36')]);_0xa24042[_0x348a('0x39')]=_['intersection'](_0x298556[_0x348a('0x35')],qs[_0x348a('0x3a')](_0x433314['query']['fields']));_0xa24042[_0x348a('0x39')]=_0xa24042['attributes']['length']?_0xa24042[_0x348a('0x39')]:_0x298556[_0x348a('0x35')];if(!_0x433314['query'][_0x348a('0x3b')]('nolimit')){_0xa24042[_0x348a('0x20')]=qs[_0x348a('0x20')](_0x433314[_0x348a('0x36')]['limit']);_0xa24042[_0x348a('0x1e')]=qs[_0x348a('0x1e')](_0x433314[_0x348a('0x36')][_0x348a('0x1e')]);}_0xa24042['order']=qs[_0x348a('0x3c')](_0x433314['query'][_0x348a('0x3c')]);_0xa24042[_0x348a('0x3d')]=qs[_0x348a('0x38')](_[_0x348a('0x3e')](_0x433314['query'],_0x298556[_0x348a('0x38')]),_0x1798fd);if(_0x433314['query'][_0x348a('0x3f')]){_0xa24042[_0x348a('0x3d')]=_[_0x348a('0x40')](_0xa24042[_0x348a('0x3d')],{'$or':_['map'](_0x1798fd,function(_0x1b8a1f){if(_0x1b8a1f[_0x348a('0x34')]!==_0x348a('0x41')){var _0x1ad165={};_0x1ad165[_0x1b8a1f[_0x348a('0x2d')]]={'$like':'%'+_0x433314[_0x348a('0x36')][_0x348a('0x3f')]+'%'};return _0x1ad165;}})});}_0xa24042=_[_0x348a('0x40')]({},_0xa24042,_0x433314[_0x348a('0x42')]);var _0x327ceb={'where':_0xa24042[_0x348a('0x3d')]};return db[_0x348a('0x31')][_0x348a('0x21')](_0x327ceb)[_0x348a('0x27')](function(_0x47ea63){_0x40a599[_0x348a('0x21')]=_0x47ea63;if(_0x433314[_0x348a('0x36')]['includeAll']){_0xa24042[_0x348a('0x43')]=[{'all':!![]}];}return db[_0x348a('0x31')][_0x348a('0x44')](_0xa24042);})[_0x348a('0x27')](function(_0x1b7895){_0x40a599[_0x348a('0x45')]=_0x1b7895;return _0x40a599;})[_0x348a('0x27')](respondWithFilteredResult(_0x8ae152,_0xa24042))[_0x348a('0x46')](handleError(_0x8ae152,null));};exports[_0x348a('0x47')]=function(_0x15aabb,_0x20a6a0){var _0x39f6c6={'raw':!![],'where':{'id':_0x15aabb[_0x348a('0x48')]['id']}},_0x3fed5b={};_0x3fed5b[_0x348a('0x35')]=_['keys'](db[_0x348a('0x31')][_0x348a('0x32')]);_0x3fed5b[_0x348a('0x36')]=_['keys'](_0x15aabb['query']);_0x3fed5b[_0x348a('0x38')]=_['intersection'](_0x3fed5b[_0x348a('0x35')],_0x3fed5b['query']);_0x39f6c6[_0x348a('0x39')]=_[_0x348a('0x49')](_0x3fed5b['model'],qs[_0x348a('0x3a')](_0x15aabb[_0x348a('0x36')][_0x348a('0x3a')]));_0x39f6c6[_0x348a('0x39')]=_0x39f6c6[_0x348a('0x39')][_0x348a('0x4a')]?_0x39f6c6[_0x348a('0x39')]:_0x3fed5b[_0x348a('0x35')];if(_0x15aabb[_0x348a('0x36')]['includeAll']){_0x39f6c6[_0x348a('0x43')]=[{'all':!![]}];}_0x39f6c6=_[_0x348a('0x40')]({},_0x39f6c6,_0x15aabb[_0x348a('0x42')]);return db[_0x348a('0x31')][_0x348a('0x4b')](_0x39f6c6)[_0x348a('0x27')](handleEntityNotFound(_0x20a6a0,null))['then'](respondWithResult(_0x20a6a0,null))[_0x348a('0x46')](handleError(_0x20a6a0,null));};exports[_0x348a('0x4c')]=function(_0x607ccd,_0x686301,_0x20b96a){return db[_0x348a('0x31')][_0x348a('0x4b')]({'where':{'id':_0x607ccd[_0x348a('0x48')]['id']},'attributes':[_0x348a('0x2d'),_0x348a('0x4d'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x686301,null))[_0x348a('0x27')](function(_0x4c95be){if(_0x4c95be){if(!fs[_0x348a('0x4e')](path[_0x348a('0x4f')](config['root'],_0x348a('0x50'),_0x4c95be[_0x348a('0x4d')]+'.'+_0x4c95be[_0x348a('0x51')]))){throw new db['Sequelize']['ValidationError'](_0x348a('0x52'));}return _0x686301[_0x348a('0x4c')](path[_0x348a('0x4f')](config[_0x348a('0x53')],_0x348a('0x50'),util[_0x348a('0x54')](_0x348a('0x55'),_0x4c95be['save_name'],_0x4c95be[_0x348a('0x51')])),util[_0x348a('0x54')](_0x348a('0x55'),_0x4c95be[_0x348a('0x2d')],_0x4c95be[_0x348a('0x51')]));}return null;})[_0x348a('0x46')](handleError(_0x686301,null));};exports[_0x348a('0x56')]=function(_0x47813c,_0x41a6f4,_0x214376){var _0x24b0f6={'name':path[_0x348a('0x57')](_0x47813c[_0x348a('0x58')][_0x348a('0x59')],path['extname'](_0x47813c['file'][_0x348a('0x59')])),'save_name':path[_0x348a('0x57')](_0x47813c[_0x348a('0x58')][_0x348a('0x5a')],path['extname'](_0x47813c[_0x348a('0x58')][_0x348a('0x5a')])),'original_format':path[_0x348a('0x5b')](_0x47813c[_0x348a('0x58')][_0x348a('0x59')])[_0x348a('0x5c')](0x1),'converted_format':'wav'};var _0x5d0872=path['join'](config[_0x348a('0x53')],_0x348a('0x5d'),_0x47813c[_0x348a('0x58')][_0x348a('0x5a')]);var _0x47ecd6=path[_0x348a('0x4f')](config['root'],_0x348a('0x50'),util[_0x348a('0x54')](_0x348a('0x55'),path[_0x348a('0x57')](_0x47813c[_0x348a('0x58')]['filename'],path[_0x348a('0x5b')](_0x47813c['file'][_0x348a('0x5a')])),_0x24b0f6['converted_format']));logger[_0x348a('0x5e')](_0x348a('0x5f'),_0x5d0872);logger['info'](_0x348a('0x60'),_0x47ecd6);try{fs['chmodSync'](_0x5d0872,parseInt(_0x348a('0x61'),0x8));var _0x27e1f6=sox['transcode'](_0x5d0872,_0x47ecd6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27e1f6['on'](_0x348a('0x2b'),function(_0x2dd673){fs[_0x348a('0x62')](_0x5d0872);_0x41a6f4[_0x348a('0x1b')](0x1f4)[_0x348a('0x2e')](_0x2dd673);});_0x27e1f6['on'](_0x348a('0x63'),function(_0x59f280){_0x24b0f6[_0x348a('0x64')]=isNaN(_0x59f280[_0x348a('0x65')])?null:_0x59f280[_0x348a('0x65')]*0x3e8;_0x24b0f6['original_sampleCount']=isNaN(_0x59f280[_0x348a('0x66')])?null:_0x59f280[_0x348a('0x66')];_0x24b0f6[_0x348a('0x67')]=isNaN(_0x59f280[_0x348a('0x68')])?null:_0x59f280['channelCount'];_0x24b0f6['original_bitRate']=isNaN(_0x59f280[_0x348a('0x69')])?null:_0x59f280[_0x348a('0x69')];_0x24b0f6[_0x348a('0x6a')]=isNaN(_0x59f280[_0x348a('0x6b')])?null:_0x59f280[_0x348a('0x6b')];});_0x27e1f6['on'](_0x348a('0x6c'),function(_0x122fd9){_0x24b0f6['converted_duration']=isNaN(_0x122fd9[_0x348a('0x65')])?null:_0x122fd9[_0x348a('0x65')]*0x3e8;_0x24b0f6['converted_sampleCount']=isNaN(_0x122fd9[_0x348a('0x66')])?null:_0x122fd9[_0x348a('0x66')];_0x24b0f6['converted_channelCount']=isNaN(_0x122fd9['channelCount'])?null:_0x122fd9['channelCount'];_0x24b0f6[_0x348a('0x6d')]=isNaN(_0x122fd9[_0x348a('0x69')])?null:_0x122fd9['bitRate'];_0x24b0f6[_0x348a('0x6e')]=isNaN(_0x122fd9[_0x348a('0x6b')])?null:_0x122fd9[_0x348a('0x6b')];});_0x27e1f6['on'](_0x348a('0x1c'),function(){fs[_0x348a('0x6f')](_0x47ecd6,parseInt('0777',0x8));return db[_0x348a('0x31')]['create'](_0x24b0f6)[_0x348a('0x27')](function(_0x1cbd57){var _0x77e5d8={'role':_0x47813c['body'][_0x348a('0x70')],'userProfileId':_0x47813c['body'][_0x348a('0x71')]};if(!_0x77e5d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x77e5d8[_0x348a('0x70')]===_0x348a('0x72')){var _0x56a74f=_0x1cbd57[_0x348a('0x73')]({'plain':!![]});return db[_0x348a('0x74')][_0x348a('0x4b')]({'where':{'name':_0x348a('0x75'),'userProfileId':_0x77e5d8[_0x348a('0x71')]},'raw':!![]})['then'](function(_0x41c8cd){if(_0x41c8cd&&_0x41c8cd['autoAssociation']===0x0){return db[_0x348a('0x29')][_0x348a('0x56')]({'name':_0x56a74f[_0x348a('0x2d')],'resourceId':_0x56a74f['id'],'type':_0x41c8cd['name'],'sectionId':_0x41c8cd['id']},{})['then'](function(){return _0x1cbd57;});}else{return _0x1cbd57;}})[_0x348a('0x46')](function(_0x47b7e5){logger[_0x348a('0x2b')](_0x348a('0x76'),_0x47b7e5);throw _0x47b7e5;});}return _0x1cbd57;})[_0x348a('0x27')](respondWithResult(_0x41a6f4,null))['catch'](handleError(_0x41a6f4,null));});_0x27e1f6['start']();}catch(_0xb0bd61){_0x41a6f4[_0x348a('0x1b')](0x1f4)['send'](_0xb0bd61);}};exports[_0x348a('0x77')]=function(_0x1635f4,_0x25622e,_0x1be2c3){return db['Sound'][_0x348a('0x4b')]({'where':{'id':_0x1635f4[_0x348a('0x48')]['id']}})[_0x348a('0x27')](handleEntityNotFound(_0x25622e,null))[_0x348a('0x27')](saveUpdates(_[_0x348a('0x3e')](_0x1635f4[_0x348a('0x78')],['name','description']),null))['then'](respondWithResult(_0x25622e,null))[_0x348a('0x46')](handleError(_0x25622e,null));};exports[_0x348a('0x79')]=function(_0x59bc80,_0x5ad4c1,_0x28a3a3){return db['Sound'][_0x348a('0x4b')]({'where':{'id':_0x59bc80[_0x348a('0x48')]['id']}})[_0x348a('0x27')](function(_0x2ee993){if(_0x2ee993){return _0x2ee993[_0x348a('0x28')]();}})['then'](function(_0x423757){var _0x2a9c92=path[_0x348a('0x4f')](config[_0x348a('0x53')],_0x348a('0x5d'),util['format'](_0x348a('0x55'),_0x423757['save_name'],_0x423757[_0x348a('0x7a')]));var _0x53bc96=path[_0x348a('0x4f')](config[_0x348a('0x53')],_0x348a('0x50'),util[_0x348a('0x54')](_0x348a('0x55'),_0x423757[_0x348a('0x4d')],_0x423757[_0x348a('0x51')]));fs[_0x348a('0x62')](_0x2a9c92);fs[_0x348a('0x62')](_0x53bc96);return _0x423757;})[_0x348a('0x27')](function(_0x2a9c87){if(_0x2a9c87){return _0x5ad4c1['status'](0xcc)[_0x348a('0x1c')]();}})[_0x348a('0x27')](handleEntityNotFound(_0x5ad4c1,null))[_0x348a('0x46')](handleError(_0x5ad4c1,null));}; \ No newline at end of file +var _0xb42d=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Sound','includeAll','rows','show','params','keys','options','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','catch','basename','file','originalname','extname','substring','wav','server/files/sounds/original','filename','Sound\x20upload\x20filepath:\x20%s','info','0777','transcode','unlinkSync','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','Sounds','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields'];(function(_0x38e9f4,_0xbad497){var _0xb0c52d=function(_0x21ae60){while(--_0x21ae60){_0x38e9f4['push'](_0x38e9f4['shift']());}};_0xb0c52d(++_0xbad497);}(_0xb42d,0xbf));var _0xdb42=function(_0x17bcc4,_0x287b25){_0x17bcc4=_0x17bcc4-0x0;var _0x47280e=_0xb42d[_0x17bcc4];return _0x47280e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb42('0x0'));var zipdir=require(_0xdb42('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb42('0x2'));var moment=require(_0xdb42('0x3'));var BPromise=require(_0xdb42('0x4'));var Mustache=require(_0xdb42('0x5'));var util=require(_0xdb42('0x6'));var path=require('path');var sox=require(_0xdb42('0x7'));var csv=require(_0xdb42('0x8'));var ejs=require(_0xdb42('0x9'));var fs=require('fs');var fs_extra=require(_0xdb42('0xa'));var _=require('lodash');var squel=require(_0xdb42('0xb'));var crypto=require(_0xdb42('0xc'));var jsforce=require(_0xdb42('0xd'));var deskjs=require(_0xdb42('0xe'));var toCsv=require(_0xdb42('0x8'));var querystring=require(_0xdb42('0xf'));var Papa=require(_0xdb42('0x10'));var Redis=require(_0xdb42('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdb42('0x12'));var as=require(_0xdb42('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb42('0x14'))(_0xdb42('0x15'));var utils=require(_0xdb42('0x16'));var config=require(_0xdb42('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb42('0x18'))['db'];function respondWithStatusCode(_0x19ac72,_0x378ea8){_0x378ea8=_0x378ea8||0xcc;return function(_0x592b26){if(_0x592b26){return _0x19ac72[_0xdb42('0x19')](_0x378ea8);}return _0x19ac72['status'](_0x378ea8)[_0xdb42('0x1a')]();};}function respondWithResult(_0x1a7cfd,_0x44e50e){_0x44e50e=_0x44e50e||0xc8;return function(_0x2e579b){if(_0x2e579b){return _0x1a7cfd[_0xdb42('0x1b')](_0x44e50e)[_0xdb42('0x1c')](_0x2e579b);}};}function respondWithFilteredResult(_0x30c89b,_0x6befb7){return function(_0x308e6e){if(_0x308e6e){var _0x102f14=typeof _0x6befb7[_0xdb42('0x1d')]===_0xdb42('0x1e')&&typeof _0x6befb7[_0xdb42('0x1f')]===_0xdb42('0x1e');var _0x3545bb=_0x308e6e['count'];var _0x2c2d1a=_0x102f14?0x0:_0x6befb7['offset'];var _0x5114dc=_0x102f14?_0x308e6e[_0xdb42('0x20')]:_0x6befb7['offset']+_0x6befb7[_0xdb42('0x1f')];var _0x4ffed6;if(_0x5114dc>=_0x3545bb){_0x5114dc=_0x3545bb;_0x4ffed6=0xc8;}else{_0x4ffed6=0xce;}_0x30c89b[_0xdb42('0x1b')](_0x4ffed6);return _0x30c89b[_0xdb42('0x21')](_0xdb42('0x22'),_0x2c2d1a+'-'+_0x5114dc+'/'+_0x3545bb)['json'](_0x308e6e);}return null;};}function patchUpdates(_0x303ea1){return function(_0x50bb3b){try{jsonpatch['apply'](_0x50bb3b,_0x303ea1,!![]);}catch(_0x3006d4){return BPromise['reject'](_0x3006d4);}return _0x50bb3b[_0xdb42('0x23')]();};}function saveUpdates(_0x14bffe,_0x189cc9){return function(_0x544b2c){if(_0x544b2c){return _0x544b2c[_0xdb42('0x24')](_0x14bffe)[_0xdb42('0x25')](function(_0x4bc573){return _0x4bc573;});}return null;};}function removeEntity(_0x593848,_0x5f5c1d){return function(_0x4091f1){if(_0x4091f1){return _0x4091f1['destroy']()[_0xdb42('0x25')](function(){var _0x4afd2d=_0x4091f1['get']({'plain':!![]});var _0x1aeea9=_0xdb42('0x26');return db[_0xdb42('0x27')][_0xdb42('0x28')]({'where':{'type':_0x1aeea9,'resourceId':_0x4afd2d['id']}})[_0xdb42('0x25')](function(){return _0x4091f1;});})[_0xdb42('0x25')](function(){_0x593848[_0xdb42('0x1b')](0xcc)[_0xdb42('0x1a')]();});}};}function handleEntityNotFound(_0x2cea5a,_0x3203b8){return function(_0x4e995f){if(!_0x4e995f){_0x2cea5a[_0xdb42('0x19')](0x194);}return _0x4e995f;};}function handleError(_0x42fcf6,_0x8d9ded){_0x8d9ded=_0x8d9ded||0x1f4;return function(_0x3902f8){logger[_0xdb42('0x29')](_0x3902f8[_0xdb42('0x2a')]);if(_0x3902f8['name']){delete _0x3902f8[_0xdb42('0x2b')];}_0x42fcf6[_0xdb42('0x1b')](_0x8d9ded)['send'](_0x3902f8);};}exports[_0xdb42('0x2c')]=function(_0x580fb8,_0x3e4f98){var _0x274e0e={},_0x19cbe7={},_0x47c912={'count':0x0,'rows':[]};var _0x35e5e9=_[_0xdb42('0x2d')](db['Sound'][_0xdb42('0x2e')],function(_0x542d7f){return{'name':_0x542d7f[_0xdb42('0x2f')],'type':_0x542d7f['type'][_0xdb42('0x30')]};});_0x19cbe7[_0xdb42('0x31')]=_[_0xdb42('0x2d')](_0x35e5e9,_0xdb42('0x2b'));_0x19cbe7['query']=_['keys'](_0x580fb8[_0xdb42('0x32')]);_0x19cbe7[_0xdb42('0x33')]=_[_0xdb42('0x34')](_0x19cbe7[_0xdb42('0x31')],_0x19cbe7['query']);_0x274e0e[_0xdb42('0x35')]=_[_0xdb42('0x34')](_0x19cbe7[_0xdb42('0x31')],qs[_0xdb42('0x36')](_0x580fb8[_0xdb42('0x32')][_0xdb42('0x36')]));_0x274e0e['attributes']=_0x274e0e[_0xdb42('0x35')][_0xdb42('0x37')]?_0x274e0e['attributes']:_0x19cbe7['model'];if(!_0x580fb8['query'][_0xdb42('0x38')](_0xdb42('0x39'))){_0x274e0e[_0xdb42('0x1f')]=qs[_0xdb42('0x1f')](_0x580fb8[_0xdb42('0x32')][_0xdb42('0x1f')]);_0x274e0e['offset']=qs['offset'](_0x580fb8[_0xdb42('0x32')][_0xdb42('0x1d')]);}_0x274e0e[_0xdb42('0x3a')]=qs['sort'](_0x580fb8['query'][_0xdb42('0x3b')]);_0x274e0e[_0xdb42('0x3c')]=qs[_0xdb42('0x33')](_[_0xdb42('0x3d')](_0x580fb8[_0xdb42('0x32')],_0x19cbe7[_0xdb42('0x33')]),_0x35e5e9);if(_0x580fb8[_0xdb42('0x32')][_0xdb42('0x3e')]){_0x274e0e[_0xdb42('0x3c')]=_[_0xdb42('0x3f')](_0x274e0e[_0xdb42('0x3c')],{'$or':_['map'](_0x35e5e9,function(_0x1df472){if(_0x1df472[_0xdb42('0x40')]!==_0xdb42('0x41')){var _0x103d8a={};_0x103d8a[_0x1df472[_0xdb42('0x2b')]]={'$like':'%'+_0x580fb8[_0xdb42('0x32')][_0xdb42('0x3e')]+'%'};return _0x103d8a;}})});}_0x274e0e=_[_0xdb42('0x3f')]({},_0x274e0e,_0x580fb8['options']);var _0x2dee7b={'where':_0x274e0e[_0xdb42('0x3c')]};return db[_0xdb42('0x42')][_0xdb42('0x20')](_0x2dee7b)[_0xdb42('0x25')](function(_0x249387){_0x47c912[_0xdb42('0x20')]=_0x249387;if(_0x580fb8[_0xdb42('0x32')][_0xdb42('0x43')]){_0x274e0e['include']=[{'all':!![]}];}return db[_0xdb42('0x42')]['findAll'](_0x274e0e);})[_0xdb42('0x25')](function(_0x2db787){_0x47c912[_0xdb42('0x44')]=_0x2db787;return _0x47c912;})[_0xdb42('0x25')](respondWithFilteredResult(_0x3e4f98,_0x274e0e))['catch'](handleError(_0x3e4f98,null));};exports[_0xdb42('0x45')]=function(_0x52bf6c,_0x18b15b){var _0x443400={'raw':!![],'where':{'id':_0x52bf6c[_0xdb42('0x46')]['id']}},_0x1c9607={};_0x1c9607[_0xdb42('0x31')]=_[_0xdb42('0x47')](db[_0xdb42('0x42')][_0xdb42('0x2e')]);_0x1c9607[_0xdb42('0x32')]=_[_0xdb42('0x47')](_0x52bf6c[_0xdb42('0x32')]);_0x1c9607['filters']=_['intersection'](_0x1c9607[_0xdb42('0x31')],_0x1c9607[_0xdb42('0x32')]);_0x443400[_0xdb42('0x35')]=_[_0xdb42('0x34')](_0x1c9607[_0xdb42('0x31')],qs[_0xdb42('0x36')](_0x52bf6c[_0xdb42('0x32')][_0xdb42('0x36')]));_0x443400[_0xdb42('0x35')]=_0x443400[_0xdb42('0x35')][_0xdb42('0x37')]?_0x443400['attributes']:_0x1c9607['model'];if(_0x52bf6c[_0xdb42('0x32')][_0xdb42('0x43')]){_0x443400['include']=[{'all':!![]}];}_0x443400=_[_0xdb42('0x3f')]({},_0x443400,_0x52bf6c[_0xdb42('0x48')]);return db['Sound']['find'](_0x443400)[_0xdb42('0x25')](handleEntityNotFound(_0x18b15b,null))['then'](respondWithResult(_0x18b15b,null))['catch'](handleError(_0x18b15b,null));};exports[_0xdb42('0x49')]=function(_0x4f64ff,_0x1e1dca,_0x2b82d0){return db[_0xdb42('0x42')][_0xdb42('0x4a')]({'where':{'id':_0x4f64ff[_0xdb42('0x46')]['id']},'attributes':[_0xdb42('0x2b'),_0xdb42('0x4b'),_0xdb42('0x4c')],'raw':!![]})[_0xdb42('0x25')](handleEntityNotFound(_0x1e1dca,null))[_0xdb42('0x25')](function(_0x466842){if(_0x466842){if(!fs[_0xdb42('0x4d')](path[_0xdb42('0x4e')](config[_0xdb42('0x4f')],_0xdb42('0x50'),_0x466842[_0xdb42('0x4b')]+'.'+_0x466842['converted_format']))){throw new db[(_0xdb42('0x51'))]['ValidationError'](_0xdb42('0x52'));}return _0x1e1dca[_0xdb42('0x49')](path[_0xdb42('0x4e')](config['root'],'server/files/sounds/converted',util[_0xdb42('0x53')](_0xdb42('0x54'),_0x466842[_0xdb42('0x4b')],_0x466842[_0xdb42('0x4c')])),util[_0xdb42('0x53')](_0xdb42('0x54'),_0x466842[_0xdb42('0x2b')],_0x466842[_0xdb42('0x4c')]));}return null;})[_0xdb42('0x55')](handleError(_0x1e1dca,null));};exports['create']=function(_0x69dbac,_0x54f721,_0x35ef3c){var _0x46db5b={'name':path[_0xdb42('0x56')](_0x69dbac[_0xdb42('0x57')]['originalname'],path['extname'](_0x69dbac[_0xdb42('0x57')][_0xdb42('0x58')])),'save_name':path[_0xdb42('0x56')](_0x69dbac[_0xdb42('0x57')]['filename'],path['extname'](_0x69dbac[_0xdb42('0x57')]['filename'])),'original_format':path[_0xdb42('0x59')](_0x69dbac['file']['originalname'])[_0xdb42('0x5a')](0x1),'converted_format':_0xdb42('0x5b')};var _0x1dd31b=path['join'](config['root'],_0xdb42('0x5c'),_0x69dbac[_0xdb42('0x57')][_0xdb42('0x5d')]);var _0x8b33df=path[_0xdb42('0x4e')](config['root'],_0xdb42('0x50'),util['format'](_0xdb42('0x54'),path[_0xdb42('0x56')](_0x69dbac[_0xdb42('0x57')]['filename'],path[_0xdb42('0x59')](_0x69dbac[_0xdb42('0x57')]['filename'])),_0x46db5b[_0xdb42('0x4c')]));logger['info'](_0xdb42('0x5e'),_0x1dd31b);logger[_0xdb42('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x8b33df);try{fs['chmodSync'](_0x1dd31b,parseInt(_0xdb42('0x60'),0x8));var _0x36cee1=sox[_0xdb42('0x61')](_0x1dd31b,_0x8b33df,{'sampleRate':0x1f40,'format':_0xdb42('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36cee1['on']('error',function(_0x59a95d){fs[_0xdb42('0x62')](_0x1dd31b);_0x54f721[_0xdb42('0x1b')](0x1f4)[_0xdb42('0x63')](_0x59a95d);});_0x36cee1['on']('src',function(_0x247d7b){_0x46db5b['original_duration']=isNaN(_0x247d7b[_0xdb42('0x64')])?null:_0x247d7b['duration']*0x3e8;_0x46db5b[_0xdb42('0x65')]=isNaN(_0x247d7b[_0xdb42('0x66')])?null:_0x247d7b[_0xdb42('0x66')];_0x46db5b[_0xdb42('0x67')]=isNaN(_0x247d7b[_0xdb42('0x68')])?null:_0x247d7b[_0xdb42('0x68')];_0x46db5b['original_bitRate']=isNaN(_0x247d7b[_0xdb42('0x69')])?null:_0x247d7b[_0xdb42('0x69')];_0x46db5b['original_sampleRate']=isNaN(_0x247d7b[_0xdb42('0x6a')])?null:_0x247d7b[_0xdb42('0x6a')];});_0x36cee1['on'](_0xdb42('0x6b'),function(_0x2a75e1){_0x46db5b['converted_duration']=isNaN(_0x2a75e1[_0xdb42('0x64')])?null:_0x2a75e1[_0xdb42('0x64')]*0x3e8;_0x46db5b[_0xdb42('0x6c')]=isNaN(_0x2a75e1[_0xdb42('0x66')])?null:_0x2a75e1[_0xdb42('0x66')];_0x46db5b['converted_channelCount']=isNaN(_0x2a75e1['channelCount'])?null:_0x2a75e1[_0xdb42('0x68')];_0x46db5b[_0xdb42('0x6d')]=isNaN(_0x2a75e1[_0xdb42('0x69')])?null:_0x2a75e1[_0xdb42('0x69')];_0x46db5b[_0xdb42('0x6e')]=isNaN(_0x2a75e1[_0xdb42('0x6a')])?null:_0x2a75e1[_0xdb42('0x6a')];});_0x36cee1['on'](_0xdb42('0x1a'),function(){fs[_0xdb42('0x6f')](_0x8b33df,parseInt('0777',0x8));return db[_0xdb42('0x42')]['create'](_0x46db5b)[_0xdb42('0x25')](function(_0x264d81){var _0x2339f3={'role':_0x69dbac[_0xdb42('0x70')][_0xdb42('0x71')],'userProfileId':_0x69dbac[_0xdb42('0x70')]['userProfileId']};if(!_0x2339f3)throw new Error(_0xdb42('0x72'));if(_0x2339f3['role']===_0xdb42('0x73')){var _0x35941d=_0x264d81[_0xdb42('0x74')]({'plain':!![]});return db[_0xdb42('0x75')][_0xdb42('0x4a')]({'where':{'name':_0xdb42('0x26'),'userProfileId':_0x2339f3['userProfileId']},'raw':!![]})[_0xdb42('0x25')](function(_0x35de88){if(_0x35de88&&_0x35de88[_0xdb42('0x76')]===0x0){return db[_0xdb42('0x27')]['create']({'name':_0x35941d[_0xdb42('0x2b')],'resourceId':_0x35941d['id'],'type':_0x35de88[_0xdb42('0x2b')],'sectionId':_0x35de88['id']},{})[_0xdb42('0x25')](function(){return _0x264d81;});}else{return _0x264d81;}})['catch'](function(_0x3f51cb){logger['error'](_0xdb42('0x77'),_0x3f51cb);throw _0x3f51cb;});}return _0x264d81;})[_0xdb42('0x25')](respondWithResult(_0x54f721,null))['catch'](handleError(_0x54f721,null));});_0x36cee1['start']();}catch(_0x3a8aff){_0x54f721['status'](0x1f4)[_0xdb42('0x63')](_0x3a8aff);}};exports[_0xdb42('0x24')]=function(_0x6d1a7d,_0x252415,_0x236866){return db[_0xdb42('0x42')]['find']({'where':{'id':_0x6d1a7d['params']['id']}})['then'](handleEntityNotFound(_0x252415,null))[_0xdb42('0x25')](saveUpdates(_[_0xdb42('0x3d')](_0x6d1a7d[_0xdb42('0x70')],['name',_0xdb42('0x78')]),null))['then'](respondWithResult(_0x252415,null))[_0xdb42('0x55')](handleError(_0x252415,null));};exports[_0xdb42('0x79')]=function(_0x5205c9,_0x54b4a3,_0x61fc94){return db[_0xdb42('0x42')]['find']({'where':{'id':_0x5205c9[_0xdb42('0x46')]['id']}})['then'](function(_0x1c65ce){if(_0x1c65ce){return _0x1c65ce[_0xdb42('0x28')]();}})[_0xdb42('0x25')](function(_0x4f9a05){var _0x5d0873=path[_0xdb42('0x4e')](config['root'],_0xdb42('0x5c'),util[_0xdb42('0x53')](_0xdb42('0x54'),_0x4f9a05[_0xdb42('0x4b')],_0x4f9a05[_0xdb42('0x7a')]));var _0x31f804=path[_0xdb42('0x4e')](config[_0xdb42('0x4f')],_0xdb42('0x50'),util[_0xdb42('0x53')](_0xdb42('0x54'),_0x4f9a05[_0xdb42('0x4b')],_0x4f9a05[_0xdb42('0x4c')]));fs['unlinkSync'](_0x5d0873);fs[_0xdb42('0x62')](_0x31f804);return _0x4f9a05;})['then'](function(_0x101e6a){if(_0x101e6a){return _0x54b4a3[_0xdb42('0x1b')](0xcc)[_0xdb42('0x1a')]();}})[_0xdb42('0x25')](handleEntityNotFound(_0x54b4a3,null))['catch'](handleError(_0x54b4a3,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d3c03fb..aaff602 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 _0xd006=['define','Sound','tools_sounds','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','exports'];(function(_0x2b2b70,_0x5a12e5){var _0x16e677=function(_0x438b35){while(--_0x438b35){_0x2b2b70['push'](_0x2b2b70['shift']());}};_0x16e677(++_0x5a12e5);}(_0xd006,0xb7));var _0x6d00=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0xd006[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0x6d00('0x0'));var util=require('util');var logger=require(_0x6d00('0x1'))(_0x6d00('0x2'));var moment=require(_0x6d00('0x3'));var BPromise=require(_0x6d00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d00('0x5'));var rimraf=require(_0x6d00('0x6'));var config=require('../../config/environment');var attributes=require(_0x6d00('0x7'));module[_0x6d00('0x8')]=function(_0x397d4d,_0x3eba14){return _0x397d4d[_0x6d00('0x9')](_0x6d00('0xa'),attributes,{'tableName':_0x6d00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad07=['define','Sound','lodash','../../config/logger','api','moment','path','../../config/environment','./sound.attributes'];(function(_0x412ff5,_0x47a49f){var _0x280aeb=function(_0x1c07f7){while(--_0x1c07f7){_0x412ff5['push'](_0x412ff5['shift']());}};_0x280aeb(++_0x47a49f);}(_0xad07,0xa4));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require('util');var logger=require(_0x7ad0('0x1'))(_0x7ad0('0x2'));var moment=require(_0x7ad0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ad0('0x4'));var rimraf=require('rimraf');var config=require(_0x7ad0('0x5'));var attributes=require(_0x7ad0('0x6'));module['exports']=function(_0x4f06c8,_0x2765cd){return _0x4f06c8[_0x7ad0('0x7')](_0x7ad0('0x8'),attributes,{'tableName':'tools_sounds','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 5b697e0..9486955 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 _0x9720=['where','attributes','include','map','model','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','result','find','options'];(function(_0x5ee507,_0x59e998){var _0x223caf=function(_0x39bfad){while(--_0x39bfad){_0x5ee507['push'](_0x5ee507['shift']());}};_0x223caf(++_0x59e998);}(_0x9720,0xd2));var _0x0972=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9720[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x0972('0x0'));var util=require(_0x0972('0x1'));var moment=require('moment');var BPromise=require(_0x0972('0x2'));var rs=require(_0x0972('0x3'));var fs=require('fs');var Redis=require(_0x0972('0x4'));var db=require(_0x0972('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0972('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0972('0x7'));var client=jayson['client'][_0x0972('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bfe10,_0x164863,_0x246c60){return new BPromise(function(_0x7d0f03,_0x37cb50){return client[_0x0972('0x9')](_0x4bfe10,_0x246c60)[_0x0972('0xa')](function(_0x20e291){logger['info'](_0x0972('0xb'),_0x164863,_0x0972('0xc'));logger[_0x0972('0xd')](_0x0972('0xe'),_0x164863,_0x0972('0xc'),JSON['stringify'](_0x20e291));if(_0x20e291[_0x0972('0xf')]){if(_0x20e291[_0x0972('0xf')][_0x0972('0x10')]===0x1f4){logger[_0x0972('0xf')](_0x0972('0xb'),_0x164863,_0x20e291['error']['message']);return _0x37cb50(_0x20e291[_0x0972('0xf')]['message']);}logger[_0x0972('0xf')](_0x0972('0xb'),_0x164863,_0x20e291[_0x0972('0xf')][_0x0972('0x11')]);return _0x7d0f03(_0x20e291[_0x0972('0xf')][_0x0972('0x11')]);}else{logger[_0x0972('0x12')]('Sound,\x20%s,\x20%s',_0x164863,'request\x20sent');_0x7d0f03(_0x20e291[_0x0972('0x13')][_0x0972('0x11')]);}})['catch'](function(_0x5ed8cf){logger[_0x0972('0xf')](_0x0972('0xb'),_0x164863,_0x5ed8cf);_0x37cb50(_0x5ed8cf);});});}exports['ShowSound']=function(_0x497cf1){var _0x221d4b=this;return new Promise(function(_0x1da626,_0x487d78){return db['Sound'][_0x0972('0x14')]({'raw':_0x497cf1[_0x0972('0x15')]?_0x497cf1[_0x0972('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x497cf1[_0x0972('0x15')]?_0x497cf1[_0x0972('0x15')][_0x0972('0x16')]||null:null,'attributes':_0x497cf1['options']?_0x497cf1[_0x0972('0x15')][_0x0972('0x17')]||null:null,'include':_0x497cf1[_0x0972('0x15')]?_0x497cf1[_0x0972('0x15')][_0x0972('0x18')]?_[_0x0972('0x19')](_0x497cf1['options'][_0x0972('0x18')],function(_0x33afca){return{'model':db[_0x33afca['model']],'as':_0x33afca['as'],'attributes':_0x33afca[_0x0972('0x17')],'include':_0x33afca[_0x0972('0x18')]?_['map'](_0x33afca[_0x0972('0x18')],function(_0x417770){return{'model':db[_0x417770[_0x0972('0x1a')]],'as':_0x417770['as'],'attributes':_0x417770[_0x0972('0x17')],'include':_0x417770['include']?_[_0x0972('0x19')](_0x417770[_0x0972('0x18')],function(_0x503ade){return{'model':db[_0x503ade[_0x0972('0x1a')]],'as':_0x503ade['as'],'attributes':_0x503ade[_0x0972('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0972('0xa')](function(_0x45dd83){logger[_0x0972('0x12')]('ShowSound',_0x497cf1);logger[_0x0972('0xd')](_0x0972('0x1b'),_0x497cf1,JSON['stringify'](_0x45dd83));_0x1da626(_0x45dd83);})[_0x0972('0x1c')](function(_0x53cbf5){logger[_0x0972('0xf')](_0x0972('0x1b'),_0x53cbf5[_0x0972('0x11')],_0x497cf1);_0x487d78(_0x221d4b[_0x0972('0xf')](0x1f4,_0x53cbf5[_0x0972('0x11')]));});});}; \ No newline at end of file +var _0x9444=['code','message','result','ShowSound','Sound','options','raw','include','map','attributes','model','info','stringify','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error'];(function(_0x20819e,_0x953317){var _0x5d0c3a=function(_0x160434){while(--_0x160434){_0x20819e['push'](_0x20819e['shift']());}};_0x5d0c3a(++_0x953317);}(_0x9444,0x12e));var _0x4944=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x9444[_0x18b5e8];return _0x25baed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4944('0x0'));var BPromise=require(_0x4944('0x1'));var rs=require(_0x4944('0x2'));var fs=require('fs');var Redis=require(_0x4944('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4944('0x4'));var logger=require(_0x4944('0x5'))(_0x4944('0x6'));var config=require(_0x4944('0x7'));var jayson=require(_0x4944('0x8'));var client=jayson[_0x4944('0x9')][_0x4944('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34d89a,_0x1b39cb,_0x466fe9){return new BPromise(function(_0x32335f,_0x35baeb){return client[_0x4944('0xb')](_0x34d89a,_0x466fe9)[_0x4944('0xc')](function(_0x2de6d9){logger['info'](_0x4944('0xd'),_0x1b39cb,_0x4944('0xe'));logger[_0x4944('0xf')](_0x4944('0x10'),_0x1b39cb,_0x4944('0xe'),JSON['stringify'](_0x2de6d9));if(_0x2de6d9[_0x4944('0x11')]){if(_0x2de6d9['error'][_0x4944('0x12')]===0x1f4){logger['error'](_0x4944('0xd'),_0x1b39cb,_0x2de6d9[_0x4944('0x11')][_0x4944('0x13')]);return _0x35baeb(_0x2de6d9[_0x4944('0x11')][_0x4944('0x13')]);}logger[_0x4944('0x11')](_0x4944('0xd'),_0x1b39cb,_0x2de6d9[_0x4944('0x11')][_0x4944('0x13')]);return _0x32335f(_0x2de6d9['error'][_0x4944('0x13')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x1b39cb,_0x4944('0xe'));_0x32335f(_0x2de6d9[_0x4944('0x14')]['message']);}})['catch'](function(_0x58c2a2){logger[_0x4944('0x11')](_0x4944('0xd'),_0x1b39cb,_0x58c2a2);_0x35baeb(_0x58c2a2);});});}exports[_0x4944('0x15')]=function(_0x3c17ff){var _0x12895b=this;return new Promise(function(_0x18ea8d,_0x311abc){return db[_0x4944('0x16')]['find']({'raw':_0x3c17ff[_0x4944('0x17')]?_0x3c17ff[_0x4944('0x17')][_0x4944('0x18')]===undefined?!![]:![]:!![],'where':_0x3c17ff['options']?_0x3c17ff[_0x4944('0x17')]['where']||null:null,'attributes':_0x3c17ff[_0x4944('0x17')]?_0x3c17ff[_0x4944('0x17')]['attributes']||null:null,'include':_0x3c17ff[_0x4944('0x17')]?_0x3c17ff['options'][_0x4944('0x19')]?_[_0x4944('0x1a')](_0x3c17ff['options']['include'],function(_0x5ce41d){return{'model':db[_0x5ce41d['model']],'as':_0x5ce41d['as'],'attributes':_0x5ce41d[_0x4944('0x1b')],'include':_0x5ce41d['include']?_[_0x4944('0x1a')](_0x5ce41d[_0x4944('0x19')],function(_0x36ebd5){return{'model':db[_0x36ebd5['model']],'as':_0x36ebd5['as'],'attributes':_0x36ebd5[_0x4944('0x1b')],'include':_0x36ebd5[_0x4944('0x19')]?_[_0x4944('0x1a')](_0x36ebd5[_0x4944('0x19')],function(_0x57924e){return{'model':db[_0x57924e[_0x4944('0x1c')]],'as':_0x57924e['as'],'attributes':_0x57924e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x29eb2d){logger[_0x4944('0x1d')](_0x4944('0x15'),_0x3c17ff);logger[_0x4944('0xf')](_0x4944('0x15'),_0x3c17ff,JSON[_0x4944('0x1e')](_0x29eb2d));_0x18ea8d(_0x29eb2d);})[_0x4944('0x1f')](function(_0x24a87e){logger[_0x4944('0x11')](_0x4944('0x15'),_0x24a87e[_0x4944('0x13')],_0x3c17ff);_0x311abc(_0x12895b[_0x4944('0x11')](0x1f4,_0x24a87e[_0x4944('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0e37ee9..ae0228a 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x11ec3d,_0x11a6b6){var _0x5784c5=function(_0x5ef682){while(--_0x5ef682){_0x11ec3d['push'](_0x11ec3d['shift']());}};_0x5784c5(++_0x11a6b6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0xa97d18,_0xc0e8e6){var _0x1ce994=function(_0xdd31f7){while(--_0xdd31f7){_0xa97d18['push'](_0xa97d18['shift']());}};_0x1ce994(++_0xc0e8e6);}(_0x14a0,0x8e));var _0x014a=function(_0x7f14eb,_0x293155){_0x7f14eb=_0x7f14eb-0x0;var _0x554bff=_0x14a0[_0x7f14eb];return _0x554bff;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f2503bb..1b304c8 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 _0xa687=['exports','STRING','TEXT','out'];(function(_0x4a7a05,_0x8e319c){var _0xab4e34=function(_0x399969){while(--_0x399969){_0x4a7a05['push'](_0x4a7a05['shift']());}};_0xab4e34(++_0x8e319c);}(_0xa687,0x144));var _0x7a68=function(_0x228d7c,_0xf01e7d){_0x228d7c=_0x228d7c-0x0;var _0x1ffa97=_0xa687[_0x228d7c];return _0x1ffa97;};'use strict';var Sequelize=require('sequelize');module[_0x7a68('0x0')]={'uniqueid':{'type':Sequelize[_0x7a68('0x1')]},'body':{'type':Sequelize[_0x7a68('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7a68('0x3')),'defaultValue':_0x7a68('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7a68('0x2')]}}; \ No newline at end of file +var _0xe5bc=['STRING','TEXT','ENUM','out','exports'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xe5bc,0x1ad));var _0xce5b=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xe5bc[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require('sequelize');module[_0xce5b('0x0')]={'uniqueid':{'type':Sequelize[_0xce5b('0x1')]},'body':{'type':Sequelize[_0xce5b('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xce5b('0x3')]('in',_0xce5b('0x4')),'defaultValue':_0xce5b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xce5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6943926..f6b72f5 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 _0xcd6f=['offset','status','set','Content-Range','reject','save','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','then','includeAll','include','rows','params','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','undefined','limit','count'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0xcd6f,0x73));var _0xfcd6=function(_0x344bf0,_0xae50c4){_0x344bf0=_0x344bf0-0x0;var _0x2ef27a=_0xcd6f[_0x344bf0];return _0x2ef27a;};'use strict';var emlformat=require(_0xfcd6('0x0'));var rimraf=require(_0xfcd6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcd6('0x2'));var rp=require('request-promise');var moment=require(_0xfcd6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfcd6('0x4'));var util=require(_0xfcd6('0x5'));var path=require('path');var sox=require(_0xfcd6('0x6'));var csv=require(_0xfcd6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcd6('0x8'));var _=require(_0xfcd6('0x9'));var squel=require(_0xfcd6('0xa'));var crypto=require(_0xfcd6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfcd6('0xc'));var toCsv=require(_0xfcd6('0x7'));var querystring=require(_0xfcd6('0xd'));var Papa=require(_0xfcd6('0xe'));var Redis=require('ioredis');var authService=require(_0xfcd6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfcd6('0x10'));var hardwareService=require(_0xfcd6('0x11'));var logger=require('../../config/logger')(_0xfcd6('0x12'));var utils=require(_0xfcd6('0x13'));var config=require(_0xfcd6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcd6('0x15'))['db'];function respondWithStatusCode(_0x1dec17,_0x4910c4){_0x4910c4=_0x4910c4||0xcc;return function(_0x2b8723){if(_0x2b8723){return _0x1dec17[_0xfcd6('0x16')](_0x4910c4);}return _0x1dec17['status'](_0x4910c4)['end']();};}function respondWithResult(_0x5a36e5,_0x45e1f4){_0x45e1f4=_0x45e1f4||0xc8;return function(_0x6df0d5){if(_0x6df0d5){return _0x5a36e5['status'](_0x45e1f4)[_0xfcd6('0x17')](_0x6df0d5);}};}function respondWithFilteredResult(_0xddc36b,_0x5f4aea){return function(_0x5c4e5d){if(_0x5c4e5d){var _0x499c74=typeof _0x5f4aea['offset']===_0xfcd6('0x18')&&typeof _0x5f4aea[_0xfcd6('0x19')]===_0xfcd6('0x18');var _0x1bfbc2=_0x5c4e5d['count'];var _0x275a6f=_0x499c74?0x0:_0x5f4aea['offset'];var _0x1eff7e=_0x499c74?_0x5c4e5d[_0xfcd6('0x1a')]:_0x5f4aea[_0xfcd6('0x1b')]+_0x5f4aea[_0xfcd6('0x19')];var _0x4a41fa;if(_0x1eff7e>=_0x1bfbc2){_0x1eff7e=_0x1bfbc2;_0x4a41fa=0xc8;}else{_0x4a41fa=0xce;}_0xddc36b[_0xfcd6('0x1c')](_0x4a41fa);return _0xddc36b[_0xfcd6('0x1d')](_0xfcd6('0x1e'),_0x275a6f+'-'+_0x1eff7e+'/'+_0x1bfbc2)[_0xfcd6('0x17')](_0x5c4e5d);}return null;};}function patchUpdates(_0x458b25){return function(_0x52bfc9){try{jsonpatch['apply'](_0x52bfc9,_0x458b25,!![]);}catch(_0x15c101){return BPromise[_0xfcd6('0x1f')](_0x15c101);}return _0x52bfc9[_0xfcd6('0x20')]();};}function saveUpdates(_0x245c37,_0x51168c){return function(_0x2b0664){if(_0x2b0664){return _0x2b0664['update'](_0x245c37)['then'](function(_0x3965b0){return _0x3965b0;});}return null;};}function removeEntity(_0x4d2a27,_0xe83980){return function(_0x47000b){if(_0x47000b){return _0x47000b[_0xfcd6('0x21')]()['then'](function(){_0x4d2a27[_0xfcd6('0x1c')](0xcc)[_0xfcd6('0x22')]();});}};}function handleEntityNotFound(_0x1a597c,_0x1eea83){return function(_0x38d8e0){if(!_0x38d8e0){_0x1a597c[_0xfcd6('0x16')](0x194);}return _0x38d8e0;};}function handleError(_0x3039ff,_0x9831b6){_0x9831b6=_0x9831b6||0x1f4;return function(_0x51dad7){logger[_0xfcd6('0x23')](_0x51dad7[_0xfcd6('0x24')]);if(_0x51dad7[_0xfcd6('0x25')]){delete _0x51dad7[_0xfcd6('0x25')];}_0x3039ff[_0xfcd6('0x1c')](_0x9831b6)[_0xfcd6('0x26')](_0x51dad7);};}exports[_0xfcd6('0x27')]=function(_0x33395e,_0x5587e3){var _0x2c9ac5={},_0x2324d9={},_0x454a6c={'count':0x0,'rows':[]};var _0x3e2c57=_[_0xfcd6('0x28')](db[_0xfcd6('0x29')][_0xfcd6('0x2a')],function(_0x3f9099){return{'name':_0x3f9099[_0xfcd6('0x2b')],'type':_0x3f9099[_0xfcd6('0x2c')]['key']};});_0x2324d9['model']=_['map'](_0x3e2c57,'name');_0x2324d9[_0xfcd6('0x2d')]=_[_0xfcd6('0x2e')](_0x33395e[_0xfcd6('0x2d')]);_0x2324d9[_0xfcd6('0x2f')]=_[_0xfcd6('0x30')](_0x2324d9[_0xfcd6('0x31')],_0x2324d9[_0xfcd6('0x2d')]);_0x2c9ac5[_0xfcd6('0x32')]=_[_0xfcd6('0x30')](_0x2324d9[_0xfcd6('0x31')],qs[_0xfcd6('0x33')](_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x33')]));_0x2c9ac5[_0xfcd6('0x32')]=_0x2c9ac5[_0xfcd6('0x32')][_0xfcd6('0x34')]?_0x2c9ac5[_0xfcd6('0x32')]:_0x2324d9[_0xfcd6('0x31')];if(!_0x33395e['query'][_0xfcd6('0x35')]('nolimit')){_0x2c9ac5[_0xfcd6('0x19')]=qs[_0xfcd6('0x19')](_0x33395e['query'][_0xfcd6('0x19')]);_0x2c9ac5[_0xfcd6('0x1b')]=qs['offset'](_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x1b')]);}_0x2c9ac5[_0xfcd6('0x36')]=qs[_0xfcd6('0x37')](_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x37')]);_0x2c9ac5['where']=qs[_0xfcd6('0x2f')](_[_0xfcd6('0x38')](_0x33395e[_0xfcd6('0x2d')],_0x2324d9[_0xfcd6('0x2f')]),_0x3e2c57);if(_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x39')]){_0x2c9ac5[_0xfcd6('0x3a')]=_[_0xfcd6('0x3b')](_0x2c9ac5['where'],{'$or':_[_0xfcd6('0x28')](_0x3e2c57,function(_0x4f6b77){if(_0x4f6b77[_0xfcd6('0x2c')]!=='VIRTUAL'){var _0x3c2e90={};_0x3c2e90[_0x4f6b77[_0xfcd6('0x25')]]={'$like':'%'+_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x39')]+'%'};return _0x3c2e90;}})});}_0x2c9ac5=_['merge']({},_0x2c9ac5,_0x33395e[_0xfcd6('0x3c')]);var _0xb505f0={'where':_0x2c9ac5[_0xfcd6('0x3a')]};return db[_0xfcd6('0x29')]['count'](_0xb505f0)[_0xfcd6('0x3d')](function(_0x5d2492){_0x454a6c[_0xfcd6('0x1a')]=_0x5d2492;if(_0x33395e[_0xfcd6('0x2d')][_0xfcd6('0x3e')]){_0x2c9ac5[_0xfcd6('0x3f')]=[{'all':!![]}];}return db[_0xfcd6('0x29')]['findAll'](_0x2c9ac5);})[_0xfcd6('0x3d')](function(_0x350075){_0x454a6c[_0xfcd6('0x40')]=_0x350075;return _0x454a6c;})[_0xfcd6('0x3d')](respondWithFilteredResult(_0x5587e3,_0x2c9ac5))['catch'](handleError(_0x5587e3,null));};exports['show']=function(_0x317680,_0x367746){var _0x2ccba8={'raw':!![],'where':{'id':_0x317680[_0xfcd6('0x41')]['id']}},_0x1d9c66={};_0x1d9c66[_0xfcd6('0x31')]=_[_0xfcd6('0x2e')](db['SquareMessage'][_0xfcd6('0x2a')]);_0x1d9c66['query']=_[_0xfcd6('0x2e')](_0x317680[_0xfcd6('0x2d')]);_0x1d9c66[_0xfcd6('0x2f')]=_[_0xfcd6('0x30')](_0x1d9c66[_0xfcd6('0x31')],_0x1d9c66[_0xfcd6('0x2d')]);_0x2ccba8[_0xfcd6('0x32')]=_[_0xfcd6('0x30')](_0x1d9c66['model'],qs['fields'](_0x317680[_0xfcd6('0x2d')][_0xfcd6('0x33')]));_0x2ccba8[_0xfcd6('0x32')]=_0x2ccba8[_0xfcd6('0x32')][_0xfcd6('0x34')]?_0x2ccba8[_0xfcd6('0x32')]:_0x1d9c66[_0xfcd6('0x31')];if(_0x317680[_0xfcd6('0x2d')][_0xfcd6('0x3e')]){_0x2ccba8['include']=[{'all':!![]}];}_0x2ccba8=_['merge']({},_0x2ccba8,_0x317680[_0xfcd6('0x3c')]);return db[_0xfcd6('0x29')][_0xfcd6('0x42')](_0x2ccba8)['then'](handleEntityNotFound(_0x367746,null))[_0xfcd6('0x3d')](respondWithResult(_0x367746,null))[_0xfcd6('0x43')](handleError(_0x367746,null));};exports[_0xfcd6('0x44')]=function(_0x490bab,_0x16ca91){return db[_0xfcd6('0x29')][_0xfcd6('0x44')](_0x490bab[_0xfcd6('0x45')],{})[_0xfcd6('0x3d')](respondWithResult(_0x16ca91,0xc9))[_0xfcd6('0x43')](handleError(_0x16ca91,null));};exports[_0xfcd6('0x46')]=function(_0x1dc9e4,_0x340d4b){if(_0x1dc9e4[_0xfcd6('0x45')]['id']){delete _0x1dc9e4[_0xfcd6('0x45')]['id'];}return db[_0xfcd6('0x29')][_0xfcd6('0x42')]({'where':{'id':_0x1dc9e4[_0xfcd6('0x41')]['id']}})[_0xfcd6('0x3d')](handleEntityNotFound(_0x340d4b,null))['then'](saveUpdates(_0x1dc9e4['body'],null))[_0xfcd6('0x3d')](respondWithResult(_0x340d4b,null))[_0xfcd6('0x43')](handleError(_0x340d4b,null));};exports['destroy']=function(_0x203321,_0x41856e){return db[_0xfcd6('0x29')][_0xfcd6('0x42')]({'where':{'id':_0x203321['params']['id']}})['then'](handleEntityNotFound(_0x41856e,null))['then'](removeEntity(_0x41856e,null))[_0xfcd6('0x43')](handleError(_0x41856e,null));}; \ No newline at end of file +var _0x4049=['show','params','rawAttributes','find','body','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','name','send','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','SquareMessage','findAll','rows','catch'];(function(_0x3f9b54,_0x35bb05){var _0x537027=function(_0x1678c5){while(--_0x1678c5){_0x3f9b54['push'](_0x3f9b54['shift']());}};_0x537027(++_0x35bb05);}(_0x4049,0x177));var _0x9404=function(_0x4b2b2c,_0x17cbcc){_0x4b2b2c=_0x4b2b2c-0x0;var _0x47c263=_0x4049[_0x4b2b2c];return _0x47c263;};'use strict';var emlformat=require(_0x9404('0x0'));var rimraf=require(_0x9404('0x1'));var zipdir=require(_0x9404('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9404('0x3'));var BPromise=require(_0x9404('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9404('0x5'));var sox=require('sox');var csv=require(_0x9404('0x6'));var ejs=require(_0x9404('0x7'));var fs=require('fs');var fs_extra=require(_0x9404('0x8'));var _=require(_0x9404('0x9'));var squel=require(_0x9404('0xa'));var crypto=require(_0x9404('0xb'));var jsforce=require(_0x9404('0xc'));var deskjs=require(_0x9404('0xd'));var toCsv=require(_0x9404('0x6'));var querystring=require(_0x9404('0xe'));var Papa=require(_0x9404('0xf'));var Redis=require(_0x9404('0x10'));var authService=require(_0x9404('0x11'));var qs=require(_0x9404('0x12'));var as=require(_0x9404('0x13'));var hardwareService=require(_0x9404('0x14'));var logger=require(_0x9404('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9404('0x16'));var licenseUtil=require(_0x9404('0x17'));var db=require(_0x9404('0x18'))['db'];function respondWithStatusCode(_0x3398bd,_0x34f5a0){_0x34f5a0=_0x34f5a0||0xcc;return function(_0x567bcc){if(_0x567bcc){return _0x3398bd['sendStatus'](_0x34f5a0);}return _0x3398bd[_0x9404('0x19')](_0x34f5a0)[_0x9404('0x1a')]();};}function respondWithResult(_0x15d49d,_0x927f73){_0x927f73=_0x927f73||0xc8;return function(_0x3d13e8){if(_0x3d13e8){return _0x15d49d[_0x9404('0x19')](_0x927f73)['json'](_0x3d13e8);}};}function respondWithFilteredResult(_0x75e18f,_0x4db206){return function(_0x42c863){if(_0x42c863){var _0x5e42c0=typeof _0x4db206['offset']===_0x9404('0x1b')&&typeof _0x4db206['limit']==='undefined';var _0x6583c8=_0x42c863[_0x9404('0x1c')];var _0x29f018=_0x5e42c0?0x0:_0x4db206[_0x9404('0x1d')];var _0x34068f=_0x5e42c0?_0x42c863[_0x9404('0x1c')]:_0x4db206[_0x9404('0x1d')]+_0x4db206[_0x9404('0x1e')];var _0x122231;if(_0x34068f>=_0x6583c8){_0x34068f=_0x6583c8;_0x122231=0xc8;}else{_0x122231=0xce;}_0x75e18f['status'](_0x122231);return _0x75e18f[_0x9404('0x1f')](_0x9404('0x20'),_0x29f018+'-'+_0x34068f+'/'+_0x6583c8)[_0x9404('0x21')](_0x42c863);}return null;};}function patchUpdates(_0x40d2db){return function(_0x465787){try{jsonpatch[_0x9404('0x22')](_0x465787,_0x40d2db,!![]);}catch(_0x46e447){return BPromise[_0x9404('0x23')](_0x46e447);}return _0x465787['save']();};}function saveUpdates(_0x3ea676,_0x241182){return function(_0x4e0953){if(_0x4e0953){return _0x4e0953['update'](_0x3ea676)[_0x9404('0x24')](function(_0x59eabb){return _0x59eabb;});}return null;};}function removeEntity(_0x50185a,_0x36ab65){return function(_0x48d713){if(_0x48d713){return _0x48d713[_0x9404('0x25')]()['then'](function(){_0x50185a[_0x9404('0x19')](0xcc)[_0x9404('0x1a')]();});}};}function handleEntityNotFound(_0x4eca2d,_0x3d41c5){return function(_0x3940aa){if(!_0x3940aa){_0x4eca2d[_0x9404('0x26')](0x194);}return _0x3940aa;};}function handleError(_0x224c67,_0x4173bb){_0x4173bb=_0x4173bb||0x1f4;return function(_0x419221){logger[_0x9404('0x27')](_0x419221['stack']);if(_0x419221[_0x9404('0x28')]){delete _0x419221[_0x9404('0x28')];}_0x224c67[_0x9404('0x19')](_0x4173bb)[_0x9404('0x29')](_0x419221);};}exports['index']=function(_0xddb0f9,_0x4a600a){var _0x4a3af7={},_0x1c2169={},_0x1b1a76={'count':0x0,'rows':[]};var _0x217f4e=_['map'](db['SquareMessage']['rawAttributes'],function(_0x26a2a8){return{'name':_0x26a2a8[_0x9404('0x2a')],'type':_0x26a2a8[_0x9404('0x2b')]['key']};});_0x1c2169[_0x9404('0x2c')]=_['map'](_0x217f4e,_0x9404('0x28'));_0x1c2169[_0x9404('0x2d')]=_[_0x9404('0x2e')](_0xddb0f9[_0x9404('0x2d')]);_0x1c2169[_0x9404('0x2f')]=_['intersection'](_0x1c2169[_0x9404('0x2c')],_0x1c2169['query']);_0x4a3af7[_0x9404('0x30')]=_[_0x9404('0x31')](_0x1c2169[_0x9404('0x2c')],qs[_0x9404('0x32')](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x32')]));_0x4a3af7[_0x9404('0x30')]=_0x4a3af7[_0x9404('0x30')][_0x9404('0x33')]?_0x4a3af7[_0x9404('0x30')]:_0x1c2169['model'];if(!_0xddb0f9[_0x9404('0x2d')][_0x9404('0x34')](_0x9404('0x35'))){_0x4a3af7[_0x9404('0x1e')]=qs['limit'](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x1e')]);_0x4a3af7['offset']=qs[_0x9404('0x1d')](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x1d')]);}_0x4a3af7[_0x9404('0x36')]=qs[_0x9404('0x37')](_0xddb0f9['query'][_0x9404('0x37')]);_0x4a3af7[_0x9404('0x38')]=qs[_0x9404('0x2f')](_[_0x9404('0x39')](_0xddb0f9[_0x9404('0x2d')],_0x1c2169['filters']),_0x217f4e);if(_0xddb0f9[_0x9404('0x2d')][_0x9404('0x3a')]){_0x4a3af7[_0x9404('0x38')]=_[_0x9404('0x3b')](_0x4a3af7[_0x9404('0x38')],{'$or':_[_0x9404('0x3c')](_0x217f4e,function(_0x28858e){if(_0x28858e[_0x9404('0x2b')]!==_0x9404('0x3d')){var _0x2558ca={};_0x2558ca[_0x28858e[_0x9404('0x28')]]={'$like':'%'+_0xddb0f9['query'][_0x9404('0x3a')]+'%'};return _0x2558ca;}})});}_0x4a3af7=_[_0x9404('0x3b')]({},_0x4a3af7,_0xddb0f9[_0x9404('0x3e')]);var _0x35c313={'where':_0x4a3af7[_0x9404('0x38')]};return db['SquareMessage'][_0x9404('0x1c')](_0x35c313)[_0x9404('0x24')](function(_0xfe145){_0x1b1a76[_0x9404('0x1c')]=_0xfe145;if(_0xddb0f9[_0x9404('0x2d')][_0x9404('0x3f')]){_0x4a3af7[_0x9404('0x40')]=[{'all':!![]}];}return db[_0x9404('0x41')][_0x9404('0x42')](_0x4a3af7);})['then'](function(_0x444975){_0x1b1a76[_0x9404('0x43')]=_0x444975;return _0x1b1a76;})['then'](respondWithFilteredResult(_0x4a600a,_0x4a3af7))[_0x9404('0x44')](handleError(_0x4a600a,null));};exports[_0x9404('0x45')]=function(_0x58c134,_0x351c96){var _0x2a07df={'raw':!![],'where':{'id':_0x58c134[_0x9404('0x46')]['id']}},_0x3bdafb={};_0x3bdafb[_0x9404('0x2c')]=_[_0x9404('0x2e')](db['SquareMessage'][_0x9404('0x47')]);_0x3bdafb[_0x9404('0x2d')]=_[_0x9404('0x2e')](_0x58c134[_0x9404('0x2d')]);_0x3bdafb[_0x9404('0x2f')]=_['intersection'](_0x3bdafb[_0x9404('0x2c')],_0x3bdafb[_0x9404('0x2d')]);_0x2a07df[_0x9404('0x30')]=_['intersection'](_0x3bdafb['model'],qs[_0x9404('0x32')](_0x58c134[_0x9404('0x2d')][_0x9404('0x32')]));_0x2a07df[_0x9404('0x30')]=_0x2a07df['attributes'][_0x9404('0x33')]?_0x2a07df[_0x9404('0x30')]:_0x3bdafb['model'];if(_0x58c134[_0x9404('0x2d')][_0x9404('0x3f')]){_0x2a07df[_0x9404('0x40')]=[{'all':!![]}];}_0x2a07df=_[_0x9404('0x3b')]({},_0x2a07df,_0x58c134[_0x9404('0x3e')]);return db[_0x9404('0x41')][_0x9404('0x48')](_0x2a07df)['then'](handleEntityNotFound(_0x351c96,null))['then'](respondWithResult(_0x351c96,null))[_0x9404('0x44')](handleError(_0x351c96,null));};exports['create']=function(_0x501a3d,_0x2186c2){return db[_0x9404('0x41')]['create'](_0x501a3d[_0x9404('0x49')],{})['then'](respondWithResult(_0x2186c2,0xc9))[_0x9404('0x44')](handleError(_0x2186c2,null));};exports['update']=function(_0x1bc451,_0x5641d5){if(_0x1bc451['body']['id']){delete _0x1bc451[_0x9404('0x49')]['id'];}return db[_0x9404('0x41')][_0x9404('0x48')]({'where':{'id':_0x1bc451[_0x9404('0x46')]['id']}})[_0x9404('0x24')](handleEntityNotFound(_0x5641d5,null))[_0x9404('0x24')](saveUpdates(_0x1bc451['body'],null))[_0x9404('0x24')](respondWithResult(_0x5641d5,null))[_0x9404('0x44')](handleError(_0x5641d5,null));};exports[_0x9404('0x25')]=function(_0x476d19,_0x3caa79){return db[_0x9404('0x41')][_0x9404('0x48')]({'where':{'id':_0x476d19[_0x9404('0x46')]['id']}})[_0x9404('0x24')](handleEntityNotFound(_0x3caa79,null))['then'](removeEntity(_0x3caa79,null))[_0x9404('0x44')](handleError(_0x3caa79,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4f7ae86..c046513 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 _0x48a6=['request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','api','moment','bluebird'];(function(_0x18d953,_0x5806c7){var _0x568a14=function(_0x3ec425){while(--_0x3ec425){_0x18d953['push'](_0x18d953['shift']());}};_0x568a14(++_0x5806c7);}(_0x48a6,0x17b));var _0x648a=function(_0x3359a7,_0x38ab8c){_0x3359a7=_0x3359a7-0x0;var _0x5b4f1a=_0x48a6[_0x3359a7];return _0x5b4f1a;};'use strict';var _=require('lodash');var util=require(_0x648a('0x0'));var logger=require(_0x648a('0x1'))(_0x648a('0x2'));var moment=require(_0x648a('0x3'));var BPromise=require(_0x648a('0x4'));var rp=require(_0x648a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x648a('0x6'));var config=require(_0x648a('0x7'));var attributes=require(_0x648a('0x8'));module[_0x648a('0x9')]=function(_0x4534f9,_0x1810f7){return _0x4534f9[_0x648a('0xa')]('SquareMessage',attributes,{'tableName':_0x648a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x061b=['square_messages','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x061b,0x15d));var _0xb061=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x061b[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0xb061('0x0'));var logger=require(_0xb061('0x1'))('api');var moment=require(_0xb061('0x2'));var BPromise=require(_0xb061('0x3'));var rp=require(_0xb061('0x4'));var fs=require('fs');var path=require(_0xb061('0x5'));var rimraf=require('rimraf');var config=require(_0xb061('0x6'));var attributes=require(_0xb061('0x7'));module[_0xb061('0x8')]=function(_0x185fc7,_0x598bef){return _0x185fc7[_0xb061('0x9')](_0xb061('0xa'),attributes,{'tableName':_0xb061('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 19da73d..3271f56 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 _0xb2b8=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','moment','bluebird'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xb2b8,0x6a));var _0x8b2b=function(_0x5d3950,_0x3588f2){_0x5d3950=_0x5d3950-0x0;var _0x68a8ee=_0xb2b8[_0x5d3950];return _0x68a8ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b2b('0x0'));var BPromise=require(_0x8b2b('0x1'));var rs=require(_0x8b2b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b2b('0x3'))['db'];var utils=require(_0x8b2b('0x4'));var logger=require(_0x8b2b('0x5'))(_0x8b2b('0x6'));var config=require(_0x8b2b('0x7'));var jayson=require(_0x8b2b('0x8'));var client=jayson[_0x8b2b('0x9')][_0x8b2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6dcf1c,_0x1f1962,_0x3ea1e9){return new BPromise(function(_0x52c6c1,_0x49967b){return client[_0x8b2b('0xb')](_0x6dcf1c,_0x3ea1e9)[_0x8b2b('0xc')](function(_0x1ddef7){logger[_0x8b2b('0xd')](_0x8b2b('0xe'),_0x1f1962,'request\x20sent');logger['debug'](_0x8b2b('0xf'),_0x1f1962,_0x8b2b('0x10'),JSON[_0x8b2b('0x11')](_0x1ddef7));if(_0x1ddef7[_0x8b2b('0x12')]){if(_0x1ddef7[_0x8b2b('0x12')]['code']===0x1f4){logger[_0x8b2b('0x12')](_0x8b2b('0xe'),_0x1f1962,_0x1ddef7[_0x8b2b('0x12')]['message']);return _0x49967b(_0x1ddef7[_0x8b2b('0x12')][_0x8b2b('0x13')]);}logger[_0x8b2b('0x12')](_0x8b2b('0xe'),_0x1f1962,_0x1ddef7['error'][_0x8b2b('0x13')]);return _0x52c6c1(_0x1ddef7[_0x8b2b('0x12')][_0x8b2b('0x13')]);}else{logger[_0x8b2b('0xd')](_0x8b2b('0xe'),_0x1f1962,_0x8b2b('0x10'));_0x52c6c1(_0x1ddef7[_0x8b2b('0x14')][_0x8b2b('0x13')]);}})[_0x8b2b('0x15')](function(_0x17c168){logger[_0x8b2b('0x12')](_0x8b2b('0xe'),_0x1f1962,_0x17c168);_0x49967b(_0x17c168);});});}exports[_0x8b2b('0x16')]=function(_0x53a150){var _0x472156=this;return new Promise(function(_0x24d9a5,_0x508393){return db[_0x8b2b('0x17')][_0x8b2b('0x18')](_0x53a150[_0x8b2b('0x19')],{'raw':_0x53a150[_0x8b2b('0x1a')]?_0x53a150[_0x8b2b('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2632d2){logger['info'](_0x8b2b('0x16'),_0x53a150);logger['debug'](_0x8b2b('0x16'),_0x53a150,JSON[_0x8b2b('0x11')](_0x2632d2));_0x24d9a5(_0x2632d2);})['catch'](function(_0x452084){logger[_0x8b2b('0x12')]('CreateSquareMessage',_0x452084[_0x8b2b('0x13')],_0x53a150);_0x508393(_0x472156[_0x8b2b('0x12')](0x1f4,_0x452084[_0x8b2b('0x13')]));});});}; \ No newline at end of file +var _0x7bac=['info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','create','body','options','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x59c89e,_0x273a9d){var _0x246672=function(_0x416c5d){while(--_0x416c5d){_0x59c89e['push'](_0x59c89e['shift']());}};_0x246672(++_0x273a9d);}(_0x7bac,0x65));var _0xc7ba=function(_0x4c6dc6,_0x2f4870){_0x4c6dc6=_0x4c6dc6-0x0;var _0x6e96ee=_0x7bac[_0x4c6dc6];return _0x6e96ee;};'use strict';var _=require(_0xc7ba('0x0'));var util=require(_0xc7ba('0x1'));var moment=require(_0xc7ba('0x2'));var BPromise=require(_0xc7ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7ba('0x4'));var db=require(_0xc7ba('0x5'))['db'];var utils=require(_0xc7ba('0x6'));var logger=require(_0xc7ba('0x7'))(_0xc7ba('0x8'));var config=require(_0xc7ba('0x9'));var jayson=require(_0xc7ba('0xa'));var client=jayson[_0xc7ba('0xb')][_0xc7ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56b03b,_0x30e4b8,_0x2bd742){return new BPromise(function(_0xf8b078,_0x192b06){return client[_0xc7ba('0xd')](_0x56b03b,_0x2bd742)[_0xc7ba('0xe')](function(_0x4f9481){logger[_0xc7ba('0xf')]('SquareMessage,\x20%s,\x20%s',_0x30e4b8,_0xc7ba('0x10'));logger[_0xc7ba('0x11')](_0xc7ba('0x12'),_0x30e4b8,_0xc7ba('0x10'),JSON['stringify'](_0x4f9481));if(_0x4f9481[_0xc7ba('0x13')]){if(_0x4f9481[_0xc7ba('0x13')][_0xc7ba('0x14')]===0x1f4){logger['error'](_0xc7ba('0x15'),_0x30e4b8,_0x4f9481[_0xc7ba('0x13')][_0xc7ba('0x16')]);return _0x192b06(_0x4f9481[_0xc7ba('0x13')]['message']);}logger[_0xc7ba('0x13')](_0xc7ba('0x15'),_0x30e4b8,_0x4f9481[_0xc7ba('0x13')][_0xc7ba('0x16')]);return _0xf8b078(_0x4f9481['error'][_0xc7ba('0x16')]);}else{logger['info'](_0xc7ba('0x15'),_0x30e4b8,_0xc7ba('0x10'));_0xf8b078(_0x4f9481['result']['message']);}})[_0xc7ba('0x17')](function(_0x4137cf){logger[_0xc7ba('0x13')](_0xc7ba('0x15'),_0x30e4b8,_0x4137cf);_0x192b06(_0x4137cf);});});}exports[_0xc7ba('0x18')]=function(_0x5b80cc){var _0x514025=this;return new Promise(function(_0x6c72eb,_0x16bbce){return db['SquareMessage'][_0xc7ba('0x19')](_0x5b80cc[_0xc7ba('0x1a')],{'raw':_0x5b80cc[_0xc7ba('0x1b')]?_0x5b80cc['options']['raw']===undefined?!![]:![]:!![]})[_0xc7ba('0xe')](function(_0x4bdf99){logger[_0xc7ba('0xf')](_0xc7ba('0x18'),_0x5b80cc);logger[_0xc7ba('0x11')](_0xc7ba('0x18'),_0x5b80cc,JSON[_0xc7ba('0x1c')](_0x4bdf99));_0x6c72eb(_0x4bdf99);})[_0xc7ba('0x17')](function(_0x20383c){logger['error'](_0xc7ba('0x18'),_0x20383c[_0xc7ba('0x16')],_0x5b80cc);_0x16bbce(_0x514025['error'](0x1f4,_0x20383c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 41e902d..0bc4bb9 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 _0xf657=['isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5f1456,_0x3f70da){var _0x4b6fd5=function(_0x350d4e){while(--_0x350d4e){_0x5f1456['push'](_0x5f1456['shift']());}};_0x4b6fd5(++_0x3f70da);}(_0xf657,0x171));var _0x7f65=function(_0x28f7e2,_0x19abf1){_0x28f7e2=_0x28f7e2-0x0;var _0x54e088=_0xf657[_0x28f7e2];return _0x54e088;};'use strict';var multer=require(_0x7f65('0x0'));var util=require(_0x7f65('0x1'));var path=require(_0x7f65('0x2'));var timeout=require(_0x7f65('0x3'));var express=require(_0x7f65('0x4'));var router=express[_0x7f65('0x5')]();var fs_extra=require(_0x7f65('0x6'));var auth=require(_0x7f65('0x7'));var interaction=require(_0x7f65('0x8'));var config=require(_0x7f65('0x9'));var controller=require('./squareOdbc.controller');router[_0x7f65('0xa')]('/',auth[_0x7f65('0xb')](),controller[_0x7f65('0xc')]);router[_0x7f65('0xa')](_0x7f65('0xd'),auth[_0x7f65('0xb')](),controller[_0x7f65('0xe')]);router[_0x7f65('0xa')]('/:id/test',auth[_0x7f65('0xb')](),timeout('15s'),controller['test']);router[_0x7f65('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7f65('0x10')](_0x7f65('0xd'),auth['isAuthenticated'](),controller[_0x7f65('0x11')]);router[_0x7f65('0x12')](_0x7f65('0xd'),auth[_0x7f65('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x664e=['../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ec532,_0x41b664){var _0x5dcfe5=function(_0x5988f6){while(--_0x5988f6){_0x2ec532['push'](_0x2ec532['shift']());}};_0x5dcfe5(++_0x41b664);}(_0x664e,0x1c6));var _0xe664=function(_0x308e81,_0x217890){_0x308e81=_0x308e81-0x0;var _0x112806=_0x664e[_0x308e81];return _0x112806;};'use strict';var multer=require(_0xe664('0x0'));var util=require('util');var path=require(_0xe664('0x1'));var timeout=require('connect-timeout');var express=require(_0xe664('0x2'));var router=express[_0xe664('0x3')]();var fs_extra=require(_0xe664('0x4'));var auth=require(_0xe664('0x5'));var interaction=require(_0xe664('0x6'));var config=require('../../config/environment');var controller=require(_0xe664('0x7'));router[_0xe664('0x8')]('/',auth[_0xe664('0x9')](),controller[_0xe664('0xa')]);router[_0xe664('0x8')](_0xe664('0xb'),auth[_0xe664('0x9')](),controller['show']);router[_0xe664('0x8')](_0xe664('0xc'),auth[_0xe664('0x9')](),timeout(_0xe664('0xd')),controller[_0xe664('0xe')]);router[_0xe664('0xf')]('/',auth[_0xe664('0x9')](),controller[_0xe664('0x10')]);router['put'](_0xe664('0xb'),auth[_0xe664('0x9')](),controller[_0xe664('0x11')]);router[_0xe664('0x12')]('/:id',auth[_0xe664('0x9')](),controller[_0xe664('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ff4dfc6..07b2bea 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 _0xa3d1=['sequelize','exports','STRING'];(function(_0x9ae0a3,_0x28a908){var _0x5df2af=function(_0x369ace){while(--_0x369ace){_0x9ae0a3['push'](_0x9ae0a3['shift']());}};_0x5df2af(++_0x28a908);}(_0xa3d1,0x126));var _0x1a3d=function(_0x35b353,_0x22d8c0){_0x35b353=_0x35b353-0x0;var _0x5436a6=_0xa3d1[_0x35b353];return _0x5436a6;};'use strict';var Sequelize=require(_0x1a3d('0x0'));module[_0x1a3d('0x1')]={'name':{'type':Sequelize[_0x1a3d('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x1a3d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdadd=['sequelize','STRING'];(function(_0x39b899,_0xffd0ef){var _0x39490f=function(_0x4388aa){while(--_0x4388aa){_0x39b899['push'](_0x39b899['shift']());}};_0x39490f(++_0xffd0ef);}(_0xdadd,0x1c8));var _0xddad=function(_0x4c0998,_0x165050){_0x4c0998=_0x4c0998-0x0;var _0x1110e2=_0xdadd[_0x4c0998];return _0x1110e2;};'use strict';var Sequelize=require(_0xddad('0x0'));module['exports']={'name':{'type':Sequelize[_0xddad('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xddad('0x1')]},'description':{'type':Sequelize[_0xddad('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a43ca15..33ad121 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 _0xbe04=['status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x55882b,_0x3f5979){var _0x46e0e0=function(_0x3db356){while(--_0x3db356){_0x55882b['push'](_0x55882b['shift']());}};_0x46e0e0(++_0x3f5979);}(_0xbe04,0x1aa));var _0x4be0=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0xbe04[_0x7275e9];return _0x17b99d;};'use strict';var emlformat=require(_0x4be0('0x0'));var rimraf=require(_0x4be0('0x1'));var zipdir=require(_0x4be0('0x2'));var jsonpatch=require(_0x4be0('0x3'));var rp=require(_0x4be0('0x4'));var moment=require(_0x4be0('0x5'));var BPromise=require(_0x4be0('0x6'));var Mustache=require(_0x4be0('0x7'));var util=require(_0x4be0('0x8'));var path=require(_0x4be0('0x9'));var sox=require(_0x4be0('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4be0('0xb'));var squel=require(_0x4be0('0xc'));var crypto=require(_0x4be0('0xd'));var jsforce=require(_0x4be0('0xe'));var deskjs=require(_0x4be0('0xf'));var toCsv=require(_0x4be0('0x10'));var querystring=require(_0x4be0('0x11'));var Papa=require(_0x4be0('0x12'));var Redis=require(_0x4be0('0x13'));var authService=require(_0x4be0('0x14'));var qs=require(_0x4be0('0x15'));var as=require(_0x4be0('0x16'));var hardwareService=require(_0x4be0('0x17'));var logger=require(_0x4be0('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x4be0('0x19'));var licenseUtil=require(_0x4be0('0x1a'));var db=require(_0x4be0('0x1b'))['db'];function respondWithStatusCode(_0x530e5a,_0x10e49a){_0x10e49a=_0x10e49a||0xcc;return function(_0x2d44f6){if(_0x2d44f6){return _0x530e5a[_0x4be0('0x1c')](_0x10e49a);}return _0x530e5a[_0x4be0('0x1d')](_0x10e49a)[_0x4be0('0x1e')]();};}function respondWithResult(_0x1fdafe,_0x2c0271){_0x2c0271=_0x2c0271||0xc8;return function(_0x23b15a){if(_0x23b15a){return _0x1fdafe['status'](_0x2c0271)[_0x4be0('0x1f')](_0x23b15a);}};}function respondWithFilteredResult(_0x7c0fa6,_0x685f4d){return function(_0x43d193){if(_0x43d193){var _0x2a1b2e=typeof _0x685f4d['offset']==='undefined'&&typeof _0x685f4d[_0x4be0('0x20')]==='undefined';var _0x3f80fb=_0x43d193[_0x4be0('0x21')];var _0x4327ba=_0x2a1b2e?0x0:_0x685f4d[_0x4be0('0x22')];var _0x3c5567=_0x2a1b2e?_0x43d193[_0x4be0('0x21')]:_0x685f4d[_0x4be0('0x22')]+_0x685f4d[_0x4be0('0x20')];var _0x727f20;if(_0x3c5567>=_0x3f80fb){_0x3c5567=_0x3f80fb;_0x727f20=0xc8;}else{_0x727f20=0xce;}_0x7c0fa6[_0x4be0('0x1d')](_0x727f20);return _0x7c0fa6[_0x4be0('0x23')](_0x4be0('0x24'),_0x4327ba+'-'+_0x3c5567+'/'+_0x3f80fb)[_0x4be0('0x1f')](_0x43d193);}return null;};}function patchUpdates(_0x3af55a){return function(_0x23e197){try{jsonpatch[_0x4be0('0x25')](_0x23e197,_0x3af55a,!![]);}catch(_0x24a73b){return BPromise['reject'](_0x24a73b);}return _0x23e197[_0x4be0('0x26')]();};}function saveUpdates(_0x12de57,_0x587a4f){return function(_0x36c41e){if(_0x36c41e){return _0x36c41e[_0x4be0('0x27')](_0x12de57)[_0x4be0('0x28')](function(_0x4b4a16){return _0x4b4a16;});}return null;};}function removeEntity(_0x4453f7,_0x2e8438){return function(_0x3f65af){if(_0x3f65af){return _0x3f65af['destroy']()[_0x4be0('0x28')](function(){var _0x47f18e=_0x3f65af[_0x4be0('0x29')]({'plain':!![]});var _0x5a9352=_0x4be0('0x2a');return db[_0x4be0('0x2b')][_0x4be0('0x2c')]({'where':{'type':_0x5a9352,'resourceId':_0x47f18e['id']}})[_0x4be0('0x28')](function(){return _0x3f65af;});})['then'](function(){_0x4453f7[_0x4be0('0x1d')](0xcc)[_0x4be0('0x1e')]();});}};}function handleEntityNotFound(_0x464a84,_0x129905){return function(_0x255e0f){if(!_0x255e0f){_0x464a84[_0x4be0('0x1c')](0x194);}return _0x255e0f;};}function handleError(_0x5f51b9,_0x47e6c3){_0x47e6c3=_0x47e6c3||0x1f4;return function(_0x14c676){logger[_0x4be0('0x2d')](_0x14c676[_0x4be0('0x2e')]);if(_0x14c676[_0x4be0('0x2f')]){delete _0x14c676[_0x4be0('0x2f')];}_0x5f51b9[_0x4be0('0x1d')](_0x47e6c3)[_0x4be0('0x30')](_0x14c676);};}exports[_0x4be0('0x31')]=function(_0xe90ff9,_0x221d75){var _0x452c90={},_0x31d9d8={},_0xb08e46={'count':0x0,'rows':[]};var _0x48a4eb=_[_0x4be0('0x32')](db['SquareOdbc'][_0x4be0('0x33')],function(_0x4cf3ca){return{'name':_0x4cf3ca[_0x4be0('0x34')],'type':_0x4cf3ca[_0x4be0('0x35')][_0x4be0('0x36')]};});_0x31d9d8[_0x4be0('0x37')]=_['map'](_0x48a4eb,_0x4be0('0x2f'));_0x31d9d8[_0x4be0('0x38')]=_[_0x4be0('0x39')](_0xe90ff9[_0x4be0('0x38')]);_0x31d9d8['filters']=_[_0x4be0('0x3a')](_0x31d9d8[_0x4be0('0x37')],_0x31d9d8['query']);_0x452c90[_0x4be0('0x3b')]=_[_0x4be0('0x3a')](_0x31d9d8[_0x4be0('0x37')],qs[_0x4be0('0x3c')](_0xe90ff9['query']['fields']));_0x452c90[_0x4be0('0x3b')]=_0x452c90['attributes'][_0x4be0('0x3d')]?_0x452c90[_0x4be0('0x3b')]:_0x31d9d8[_0x4be0('0x37')];if(!_0xe90ff9[_0x4be0('0x38')]['hasOwnProperty'](_0x4be0('0x3e'))){_0x452c90['limit']=qs[_0x4be0('0x20')](_0xe90ff9[_0x4be0('0x38')][_0x4be0('0x20')]);_0x452c90['offset']=qs[_0x4be0('0x22')](_0xe90ff9[_0x4be0('0x38')][_0x4be0('0x22')]);}_0x452c90['order']=qs[_0x4be0('0x3f')](_0xe90ff9[_0x4be0('0x38')]['sort']);_0x452c90[_0x4be0('0x40')]=qs[_0x4be0('0x41')](_[_0x4be0('0x42')](_0xe90ff9[_0x4be0('0x38')],_0x31d9d8['filters']),_0x48a4eb);if(_0xe90ff9[_0x4be0('0x38')]['filter']){_0x452c90[_0x4be0('0x40')]=_[_0x4be0('0x43')](_0x452c90[_0x4be0('0x40')],{'$or':_['map'](_0x48a4eb,function(_0x3b91d5){if(_0x3b91d5[_0x4be0('0x35')]!==_0x4be0('0x44')){var _0x1a869f={};_0x1a869f[_0x3b91d5['name']]={'$like':'%'+_0xe90ff9[_0x4be0('0x38')]['filter']+'%'};return _0x1a869f;}})});}_0x452c90=_['merge']({},_0x452c90,_0xe90ff9[_0x4be0('0x45')]);var _0x135194={'where':_0x452c90['where']};return db[_0x4be0('0x46')][_0x4be0('0x21')](_0x135194)['then'](function(_0x10ee9e){_0xb08e46['count']=_0x10ee9e;if(_0xe90ff9[_0x4be0('0x38')][_0x4be0('0x47')]){_0x452c90[_0x4be0('0x48')]=[{'all':!![]}];}return db[_0x4be0('0x46')][_0x4be0('0x49')](_0x452c90);})[_0x4be0('0x28')](function(_0x459c10){_0xb08e46[_0x4be0('0x4a')]=_0x459c10;return _0xb08e46;})[_0x4be0('0x28')](respondWithFilteredResult(_0x221d75,_0x452c90))[_0x4be0('0x4b')](handleError(_0x221d75,null));};exports['show']=function(_0x4dcd99,_0x48d2d3){var _0x51902f={'raw':!![],'where':{'id':_0x4dcd99[_0x4be0('0x4c')]['id']}},_0x5b77c6={};_0x5b77c6['model']=_['keys'](db['SquareOdbc'][_0x4be0('0x33')]);_0x5b77c6[_0x4be0('0x38')]=_[_0x4be0('0x39')](_0x4dcd99['query']);_0x5b77c6[_0x4be0('0x41')]=_[_0x4be0('0x3a')](_0x5b77c6['model'],_0x5b77c6[_0x4be0('0x38')]);_0x51902f[_0x4be0('0x3b')]=_[_0x4be0('0x3a')](_0x5b77c6[_0x4be0('0x37')],qs[_0x4be0('0x3c')](_0x4dcd99['query']['fields']));_0x51902f[_0x4be0('0x3b')]=_0x51902f[_0x4be0('0x3b')][_0x4be0('0x3d')]?_0x51902f[_0x4be0('0x3b')]:_0x5b77c6[_0x4be0('0x37')];if(_0x4dcd99[_0x4be0('0x38')][_0x4be0('0x47')]){_0x51902f[_0x4be0('0x48')]=[{'all':!![]}];}_0x51902f=_['merge']({},_0x51902f,_0x4dcd99[_0x4be0('0x45')]);return db[_0x4be0('0x46')][_0x4be0('0x4d')](_0x51902f)[_0x4be0('0x28')](handleEntityNotFound(_0x48d2d3,null))['then'](respondWithResult(_0x48d2d3,null))[_0x4be0('0x4b')](handleError(_0x48d2d3,null));};exports[_0x4be0('0x4e')]=function(_0x2e6abd,_0x17bdbb){return db[_0x4be0('0x46')][_0x4be0('0x4e')](_0x2e6abd['body'],{})[_0x4be0('0x28')](function(_0x35477e){var _0x97a644=_0x2e6abd['user'][_0x4be0('0x29')]({'plain':!![]});if(!_0x97a644)throw new Error(_0x4be0('0x4f'));if(_0x97a644[_0x4be0('0x50')]===_0x4be0('0x51')){var _0xf86794=_0x35477e['get']({'plain':!![]});var _0x171bb3='ODBC';return db[_0x4be0('0x52')][_0x4be0('0x4d')]({'where':{'name':_0x171bb3,'userProfileId':_0x97a644[_0x4be0('0x53')]},'raw':!![]})[_0x4be0('0x28')](function(_0x21681a){if(_0x21681a&&_0x21681a['autoAssociation']===0x0){return db['UserProfileResource'][_0x4be0('0x4e')]({'name':_0xf86794[_0x4be0('0x2f')],'resourceId':_0xf86794['id'],'type':_0x21681a[_0x4be0('0x2f')],'sectionId':_0x21681a['id']},{})[_0x4be0('0x28')](function(){return _0x35477e;});}else{return _0x35477e;}})[_0x4be0('0x4b')](function(_0x490484){logger[_0x4be0('0x2d')](_0x4be0('0x54'),_0x490484);throw _0x490484;});}return _0x35477e;})[_0x4be0('0x28')](respondWithResult(_0x17bdbb,0xc9))[_0x4be0('0x4b')](handleError(_0x17bdbb,null));};exports['update']=function(_0x54dc72,_0x59e2a7){if(_0x54dc72[_0x4be0('0x55')]['id']){delete _0x54dc72['body']['id'];}return db['SquareOdbc'][_0x4be0('0x4d')]({'where':{'id':_0x54dc72[_0x4be0('0x4c')]['id']}})[_0x4be0('0x28')](handleEntityNotFound(_0x59e2a7,null))['then'](saveUpdates(_0x54dc72[_0x4be0('0x55')],null))[_0x4be0('0x28')](respondWithResult(_0x59e2a7,null))[_0x4be0('0x4b')](handleError(_0x59e2a7,null));};exports[_0x4be0('0x2c')]=function(_0x1e0d82,_0x2a07c5){return db[_0x4be0('0x46')][_0x4be0('0x4d')]({'where':{'id':_0x1e0d82['params']['id']}})[_0x4be0('0x28')](handleEntityNotFound(_0x2a07c5,null))[_0x4be0('0x28')](removeEntity(_0x2a07c5,null))[_0x4be0('0x4b')](handleError(_0x2a07c5,null));};exports[_0x4be0('0x56')]=function(_0x43cd14,_0x71a09a,_0x382e7d){var _0x51d323;return db[_0x4be0('0x46')][_0x4be0('0x4d')]({'where':{'id':_0x43cd14[_0x4be0('0x4c')]['id']},'attributes':['id',_0x4be0('0x57')]})[_0x4be0('0x28')](handleEntityNotFound(_0x71a09a,null))[_0x4be0('0x28')](function(_0x20ee19){if(_0x20ee19){var _0xcf410b=require(_0x4be0('0x58'))();_0xcf410b[_0x4be0('0x59')](_0x20ee19[_0x4be0('0x57')]);_0xcf410b[_0x4be0('0x5a')]();return _0x20ee19;}})[_0x4be0('0x28')](respondWithResult(_0x71a09a,null))[_0x4be0('0x4b')](handleError(_0x71a09a,null));}; \ No newline at end of file +var _0x0f39=['odbc','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','params','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x0f39,0x141));var _0x90f3=function(_0x2e83cf,_0x2fdd4b){_0x2e83cf=_0x2e83cf-0x0;var _0x958981=_0x0f39[_0x2e83cf];return _0x958981;};'use strict';var emlformat=require(_0x90f3('0x0'));var rimraf=require(_0x90f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90f3('0x2'));var rp=require('request-promise');var moment=require(_0x90f3('0x3'));var BPromise=require(_0x90f3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90f3('0x5'));var sox=require('sox');var csv=require(_0x90f3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90f3('0x7'));var _=require(_0x90f3('0x8'));var squel=require(_0x90f3('0x9'));var crypto=require(_0x90f3('0xa'));var jsforce=require(_0x90f3('0xb'));var deskjs=require(_0x90f3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x90f3('0xd'));var Redis=require('ioredis');var authService=require(_0x90f3('0xe'));var qs=require(_0x90f3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x90f3('0x10'))(_0x90f3('0x11'));var utils=require(_0x90f3('0x12'));var config=require(_0x90f3('0x13'));var licenseUtil=require(_0x90f3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9f70,_0x111b87){_0x111b87=_0x111b87||0xcc;return function(_0x81bb3c){if(_0x81bb3c){return _0x1e9f70['sendStatus'](_0x111b87);}return _0x1e9f70['status'](_0x111b87)[_0x90f3('0x15')]();};}function respondWithResult(_0x3ec44d,_0x1f95d0){_0x1f95d0=_0x1f95d0||0xc8;return function(_0x1bcf3f){if(_0x1bcf3f){return _0x3ec44d[_0x90f3('0x16')](_0x1f95d0)[_0x90f3('0x17')](_0x1bcf3f);}};}function respondWithFilteredResult(_0x109e2e,_0x181ab1){return function(_0x29175a){if(_0x29175a){var _0xebc93b=typeof _0x181ab1['offset']===_0x90f3('0x18')&&typeof _0x181ab1[_0x90f3('0x19')]===_0x90f3('0x18');var _0x235ea7=_0x29175a[_0x90f3('0x1a')];var _0x441ce6=_0xebc93b?0x0:_0x181ab1[_0x90f3('0x1b')];var _0x4bbe38=_0xebc93b?_0x29175a[_0x90f3('0x1a')]:_0x181ab1[_0x90f3('0x1b')]+_0x181ab1['limit'];var _0xacf9c;if(_0x4bbe38>=_0x235ea7){_0x4bbe38=_0x235ea7;_0xacf9c=0xc8;}else{_0xacf9c=0xce;}_0x109e2e['status'](_0xacf9c);return _0x109e2e[_0x90f3('0x1c')](_0x90f3('0x1d'),_0x441ce6+'-'+_0x4bbe38+'/'+_0x235ea7)[_0x90f3('0x17')](_0x29175a);}return null;};}function patchUpdates(_0x49cef5){return function(_0x3341b7){try{jsonpatch['apply'](_0x3341b7,_0x49cef5,!![]);}catch(_0x341f3e){return BPromise[_0x90f3('0x1e')](_0x341f3e);}return _0x3341b7['save']();};}function saveUpdates(_0x1da01f,_0x2ea824){return function(_0x1aa421){if(_0x1aa421){return _0x1aa421[_0x90f3('0x1f')](_0x1da01f)[_0x90f3('0x20')](function(_0x30c1be){return _0x30c1be;});}return null;};}function removeEntity(_0x26d755,_0xa2c05){return function(_0x30307c){if(_0x30307c){return _0x30307c[_0x90f3('0x21')]()[_0x90f3('0x20')](function(){var _0x22caea=_0x30307c[_0x90f3('0x22')]({'plain':!![]});var _0xa4b011='ODBC';return db[_0x90f3('0x23')][_0x90f3('0x21')]({'where':{'type':_0xa4b011,'resourceId':_0x22caea['id']}})[_0x90f3('0x20')](function(){return _0x30307c;});})['then'](function(){_0x26d755[_0x90f3('0x16')](0xcc)[_0x90f3('0x15')]();});}};}function handleEntityNotFound(_0x419d0a,_0x4e16ff){return function(_0x3dcb21){if(!_0x3dcb21){_0x419d0a[_0x90f3('0x24')](0x194);}return _0x3dcb21;};}function handleError(_0x4676b2,_0x3ea65c){_0x3ea65c=_0x3ea65c||0x1f4;return function(_0x50cf91){logger[_0x90f3('0x25')](_0x50cf91[_0x90f3('0x26')]);if(_0x50cf91['name']){delete _0x50cf91['name'];}_0x4676b2['status'](_0x3ea65c)[_0x90f3('0x27')](_0x50cf91);};}exports[_0x90f3('0x28')]=function(_0x5c2579,_0x532d56){var _0x8b589d={},_0x17a235={},_0x317488={'count':0x0,'rows':[]};var _0x346701=_[_0x90f3('0x29')](db[_0x90f3('0x2a')][_0x90f3('0x2b')],function(_0x318249){return{'name':_0x318249[_0x90f3('0x2c')],'type':_0x318249[_0x90f3('0x2d')][_0x90f3('0x2e')]};});_0x17a235[_0x90f3('0x2f')]=_[_0x90f3('0x29')](_0x346701,_0x90f3('0x30'));_0x17a235[_0x90f3('0x31')]=_[_0x90f3('0x32')](_0x5c2579[_0x90f3('0x31')]);_0x17a235[_0x90f3('0x33')]=_[_0x90f3('0x34')](_0x17a235['model'],_0x17a235['query']);_0x8b589d['attributes']=_[_0x90f3('0x34')](_0x17a235[_0x90f3('0x2f')],qs[_0x90f3('0x35')](_0x5c2579[_0x90f3('0x31')][_0x90f3('0x35')]));_0x8b589d[_0x90f3('0x36')]=_0x8b589d[_0x90f3('0x36')]['length']?_0x8b589d[_0x90f3('0x36')]:_0x17a235[_0x90f3('0x2f')];if(!_0x5c2579[_0x90f3('0x31')]['hasOwnProperty'](_0x90f3('0x37'))){_0x8b589d[_0x90f3('0x19')]=qs[_0x90f3('0x19')](_0x5c2579[_0x90f3('0x31')][_0x90f3('0x19')]);_0x8b589d['offset']=qs[_0x90f3('0x1b')](_0x5c2579[_0x90f3('0x31')]['offset']);}_0x8b589d['order']=qs[_0x90f3('0x38')](_0x5c2579[_0x90f3('0x31')][_0x90f3('0x38')]);_0x8b589d[_0x90f3('0x39')]=qs[_0x90f3('0x33')](_[_0x90f3('0x3a')](_0x5c2579['query'],_0x17a235['filters']),_0x346701);if(_0x5c2579[_0x90f3('0x31')][_0x90f3('0x3b')]){_0x8b589d[_0x90f3('0x39')]=_['merge'](_0x8b589d[_0x90f3('0x39')],{'$or':_['map'](_0x346701,function(_0x4af2d0){if(_0x4af2d0['type']!==_0x90f3('0x3c')){var _0x587af8={};_0x587af8[_0x4af2d0[_0x90f3('0x30')]]={'$like':'%'+_0x5c2579[_0x90f3('0x31')][_0x90f3('0x3b')]+'%'};return _0x587af8;}})});}_0x8b589d=_[_0x90f3('0x3d')]({},_0x8b589d,_0x5c2579[_0x90f3('0x3e')]);var _0x191809={'where':_0x8b589d[_0x90f3('0x39')]};return db[_0x90f3('0x2a')][_0x90f3('0x1a')](_0x191809)[_0x90f3('0x20')](function(_0xaa459e){_0x317488[_0x90f3('0x1a')]=_0xaa459e;if(_0x5c2579[_0x90f3('0x31')][_0x90f3('0x3f')]){_0x8b589d['include']=[{'all':!![]}];}return db[_0x90f3('0x2a')]['findAll'](_0x8b589d);})[_0x90f3('0x20')](function(_0x45f8c1){_0x317488['rows']=_0x45f8c1;return _0x317488;})[_0x90f3('0x20')](respondWithFilteredResult(_0x532d56,_0x8b589d))[_0x90f3('0x40')](handleError(_0x532d56,null));};exports['show']=function(_0x354527,_0x3a7eda){var _0x4cdecd={'raw':!![],'where':{'id':_0x354527[_0x90f3('0x41')]['id']}},_0x2ab3d5={};_0x2ab3d5[_0x90f3('0x2f')]=_[_0x90f3('0x32')](db[_0x90f3('0x2a')][_0x90f3('0x2b')]);_0x2ab3d5[_0x90f3('0x31')]=_[_0x90f3('0x32')](_0x354527['query']);_0x2ab3d5[_0x90f3('0x33')]=_['intersection'](_0x2ab3d5[_0x90f3('0x2f')],_0x2ab3d5[_0x90f3('0x31')]);_0x4cdecd[_0x90f3('0x36')]=_[_0x90f3('0x34')](_0x2ab3d5[_0x90f3('0x2f')],qs[_0x90f3('0x35')](_0x354527[_0x90f3('0x31')]['fields']));_0x4cdecd[_0x90f3('0x36')]=_0x4cdecd[_0x90f3('0x36')][_0x90f3('0x42')]?_0x4cdecd['attributes']:_0x2ab3d5[_0x90f3('0x2f')];if(_0x354527[_0x90f3('0x31')][_0x90f3('0x3f')]){_0x4cdecd[_0x90f3('0x43')]=[{'all':!![]}];}_0x4cdecd=_[_0x90f3('0x3d')]({},_0x4cdecd,_0x354527[_0x90f3('0x3e')]);return db[_0x90f3('0x2a')]['find'](_0x4cdecd)[_0x90f3('0x20')](handleEntityNotFound(_0x3a7eda,null))[_0x90f3('0x20')](respondWithResult(_0x3a7eda,null))[_0x90f3('0x40')](handleError(_0x3a7eda,null));};exports['create']=function(_0x53dea7,_0x143573){return db['SquareOdbc'][_0x90f3('0x44')](_0x53dea7['body'],{})[_0x90f3('0x20')](function(_0x49b4e0){var _0x3dc4dc=_0x53dea7[_0x90f3('0x45')][_0x90f3('0x22')]({'plain':!![]});if(!_0x3dc4dc)throw new Error(_0x90f3('0x46'));if(_0x3dc4dc[_0x90f3('0x47')]===_0x90f3('0x45')){var _0x232a26=_0x49b4e0[_0x90f3('0x22')]({'plain':!![]});var _0x45bb19=_0x90f3('0x48');return db['UserProfileSection'][_0x90f3('0x49')]({'where':{'name':_0x45bb19,'userProfileId':_0x3dc4dc['userProfileId']},'raw':!![]})[_0x90f3('0x20')](function(_0x71d7fd){if(_0x71d7fd&&_0x71d7fd[_0x90f3('0x4a')]===0x0){return db[_0x90f3('0x23')][_0x90f3('0x44')]({'name':_0x232a26[_0x90f3('0x30')],'resourceId':_0x232a26['id'],'type':_0x71d7fd[_0x90f3('0x30')],'sectionId':_0x71d7fd['id']},{})['then'](function(){return _0x49b4e0;});}else{return _0x49b4e0;}})[_0x90f3('0x40')](function(_0xbb38fd){logger[_0x90f3('0x25')](_0x90f3('0x4b'),_0xbb38fd);throw _0xbb38fd;});}return _0x49b4e0;})[_0x90f3('0x20')](respondWithResult(_0x143573,0xc9))[_0x90f3('0x40')](handleError(_0x143573,null));};exports[_0x90f3('0x1f')]=function(_0x2fd9d1,_0x129727){if(_0x2fd9d1[_0x90f3('0x4c')]['id']){delete _0x2fd9d1[_0x90f3('0x4c')]['id'];}return db['SquareOdbc'][_0x90f3('0x49')]({'where':{'id':_0x2fd9d1[_0x90f3('0x41')]['id']}})[_0x90f3('0x20')](handleEntityNotFound(_0x129727,null))[_0x90f3('0x20')](saveUpdates(_0x2fd9d1[_0x90f3('0x4c')],null))[_0x90f3('0x20')](respondWithResult(_0x129727,null))[_0x90f3('0x40')](handleError(_0x129727,null));};exports[_0x90f3('0x21')]=function(_0x4a4780,_0x244181){return db[_0x90f3('0x2a')][_0x90f3('0x49')]({'where':{'id':_0x4a4780[_0x90f3('0x41')]['id']}})[_0x90f3('0x20')](handleEntityNotFound(_0x244181,null))[_0x90f3('0x20')](removeEntity(_0x244181,null))[_0x90f3('0x40')](handleError(_0x244181,null));};exports[_0x90f3('0x4d')]=function(_0x156567,_0xfe6da4,_0x2b87d6){var _0x535306;return db[_0x90f3('0x2a')]['find']({'where':{'id':_0x156567[_0x90f3('0x41')]['id']},'attributes':['id',_0x90f3('0x4e')]})[_0x90f3('0x20')](handleEntityNotFound(_0xfe6da4,null))[_0x90f3('0x20')](function(_0x293d71){if(_0x293d71){var _0x425106=require(_0x90f3('0x4f'))();_0x425106['openSync'](_0x293d71[_0x90f3('0x4e')]);_0x425106['closeSync']();return _0x293d71;}})[_0x90f3('0x20')](respondWithResult(_0xfe6da4,null))[_0x90f3('0x40')](handleError(_0xfe6da4,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index acbbc74..cb53884 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 _0xf831=['request-promise','path','rimraf','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3fabba,_0x540f2a){var _0x4a19e3=function(_0xb91fd2){while(--_0xb91fd2){_0x3fabba['push'](_0x3fabba['shift']());}};_0x4a19e3(++_0x540f2a);}(_0xf831,0x1c1));var _0x1f83=function(_0x31579b,_0x1bc990){_0x31579b=_0x31579b-0x0;var _0x4708bb=_0xf831[_0x31579b];return _0x4708bb;};'use strict';var _=require(_0x1f83('0x0'));var util=require(_0x1f83('0x1'));var logger=require(_0x1f83('0x2'))(_0x1f83('0x3'));var moment=require(_0x1f83('0x4'));var BPromise=require(_0x1f83('0x5'));var rp=require(_0x1f83('0x6'));var fs=require('fs');var path=require(_0x1f83('0x7'));var rimraf=require(_0x1f83('0x8'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x1f83('0x9')]=function(_0x5b1e9f,_0x1935b2){return _0x5b1e9f[_0x1f83('0xa')](_0x1f83('0xb'),attributes,{'tableName':_0x1f83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xada4=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0xada4,0x96));var _0x4ada=function(_0x19d104,_0x2667e5){_0x19d104=_0x19d104-0x0;var _0x454533=_0xada4[_0x19d104];return _0x454533;};'use strict';var _=require(_0x4ada('0x0'));var util=require(_0x4ada('0x1'));var logger=require(_0x4ada('0x2'))('api');var moment=require(_0x4ada('0x3'));var BPromise=require(_0x4ada('0x4'));var rp=require(_0x4ada('0x5'));var fs=require('fs');var path=require(_0x4ada('0x6'));var rimraf=require(_0x4ada('0x7'));var config=require(_0x4ada('0x8'));var attributes=require(_0x4ada('0x9'));module[_0x4ada('0xa')]=function(_0x295759,_0x134495){return _0x295759[_0x4ada('0xb')](_0x4ada('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index feaad7f..187153a 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 _0x3743=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareOdbc','SquareOdbc','options','where','attributes','include','map','model','then','stringify','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x3743,0xeb));var _0x3374=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x3743[_0x476c7];return _0x47ae56;};'use strict';var _=require('lodash');var util=require(_0x3374('0x0'));var moment=require(_0x3374('0x1'));var BPromise=require('bluebird');var rs=require(_0x3374('0x2'));var fs=require('fs');var Redis=require(_0x3374('0x3'));var db=require(_0x3374('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3374('0x5'))(_0x3374('0x6'));var config=require(_0x3374('0x7'));var jayson=require(_0x3374('0x8'));var client=jayson[_0x3374('0x9')][_0x3374('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16e2da,_0x39e3aa,_0x3bc379){return new BPromise(function(_0x35795c,_0x49c1e3){return client['request'](_0x16e2da,_0x3bc379)['then'](function(_0x1ff673){logger[_0x3374('0xb')](_0x3374('0xc'),_0x39e3aa,_0x3374('0xd'));logger[_0x3374('0xe')](_0x3374('0xf'),_0x39e3aa,_0x3374('0xd'),JSON['stringify'](_0x1ff673));if(_0x1ff673[_0x3374('0x10')]){if(_0x1ff673[_0x3374('0x10')]['code']===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x39e3aa,_0x1ff673[_0x3374('0x10')][_0x3374('0x11')]);return _0x49c1e3(_0x1ff673['error'][_0x3374('0x11')]);}logger[_0x3374('0x10')](_0x3374('0xc'),_0x39e3aa,_0x1ff673['error'][_0x3374('0x11')]);return _0x35795c(_0x1ff673[_0x3374('0x10')]['message']);}else{logger[_0x3374('0xb')](_0x3374('0xc'),_0x39e3aa,'request\x20sent');_0x35795c(_0x1ff673[_0x3374('0x12')][_0x3374('0x11')]);}})[_0x3374('0x13')](function(_0x11e0b7){logger[_0x3374('0x10')](_0x3374('0xc'),_0x39e3aa,_0x11e0b7);_0x49c1e3(_0x11e0b7);});});}exports[_0x3374('0x14')]=function(_0x1fcb62){var _0x5685bc=this;return new Promise(function(_0x52addd,_0x399a1c){return db[_0x3374('0x15')]['find']({'raw':_0x1fcb62[_0x3374('0x16')]?_0x1fcb62[_0x3374('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1fcb62[_0x3374('0x16')]?_0x1fcb62[_0x3374('0x16')][_0x3374('0x17')]||null:null,'attributes':_0x1fcb62[_0x3374('0x16')]?_0x1fcb62[_0x3374('0x16')][_0x3374('0x18')]||null:null,'include':_0x1fcb62[_0x3374('0x16')]?_0x1fcb62[_0x3374('0x16')][_0x3374('0x19')]?_[_0x3374('0x1a')](_0x1fcb62['options'][_0x3374('0x19')],function(_0x125d4a){return{'model':db[_0x125d4a[_0x3374('0x1b')]],'as':_0x125d4a['as'],'attributes':_0x125d4a['attributes'],'include':_0x125d4a[_0x3374('0x19')]?_[_0x3374('0x1a')](_0x125d4a[_0x3374('0x19')],function(_0x254d73){return{'model':db[_0x254d73[_0x3374('0x1b')]],'as':_0x254d73['as'],'attributes':_0x254d73[_0x3374('0x18')],'include':_0x254d73[_0x3374('0x19')]?_['map'](_0x254d73[_0x3374('0x19')],function(_0x16623c){return{'model':db[_0x16623c[_0x3374('0x1b')]],'as':_0x16623c['as'],'attributes':_0x16623c[_0x3374('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3374('0x1c')](function(_0x57db10){logger[_0x3374('0xb')](_0x3374('0x14'),_0x1fcb62);logger[_0x3374('0xe')](_0x3374('0x14'),_0x1fcb62,JSON[_0x3374('0x1d')](_0x57db10));_0x52addd(_0x57db10);})['catch'](function(_0x27e0ed){logger['error'](_0x3374('0x14'),_0x27e0ed[_0x3374('0x11')],_0x1fcb62);_0x399a1c(_0x5685bc[_0x3374('0x10')](0x1f4,_0x27e0ed[_0x3374('0x11')]));});});}; \ No newline at end of file +var _0xa77d=['../../mysqldb','../../config/logger','jayson/promise','http','request','request\x20sent','debug','error','code','message','SquareOdbc,\x20%s,\x20%s','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','stringify','lodash','util','bluebird'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xa77d,0x13c));var _0xda77=function(_0x1fe937,_0x5a5a63){_0x1fe937=_0x1fe937-0x0;var _0x2a6f0d=_0xa77d[_0x1fe937];return _0x2a6f0d;};'use strict';var _=require(_0xda77('0x0'));var util=require(_0xda77('0x1'));var moment=require('moment');var BPromise=require(_0xda77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda77('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xda77('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda77('0x5'));var client=jayson['client'][_0xda77('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49d2cd,_0x59f4a3,_0x15c779){return new BPromise(function(_0x2668bb,_0x2966d2){return client[_0xda77('0x7')](_0x49d2cd,_0x15c779)['then'](function(_0x5c692b){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x59f4a3,_0xda77('0x8'));logger[_0xda77('0x9')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x59f4a3,'request\x20sent',JSON['stringify'](_0x5c692b));if(_0x5c692b[_0xda77('0xa')]){if(_0x5c692b[_0xda77('0xa')][_0xda77('0xb')]===0x1f4){logger[_0xda77('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x59f4a3,_0x5c692b['error'][_0xda77('0xc')]);return _0x2966d2(_0x5c692b[_0xda77('0xa')][_0xda77('0xc')]);}logger[_0xda77('0xa')](_0xda77('0xd'),_0x59f4a3,_0x5c692b['error'][_0xda77('0xc')]);return _0x2668bb(_0x5c692b[_0xda77('0xa')][_0xda77('0xc')]);}else{logger[_0xda77('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x59f4a3,_0xda77('0x8'));_0x2668bb(_0x5c692b[_0xda77('0xf')][_0xda77('0xc')]);}})[_0xda77('0x10')](function(_0x401315){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x59f4a3,_0x401315);_0x2966d2(_0x401315);});});}exports[_0xda77('0x11')]=function(_0x502f5c){var _0x3c4405=this;return new Promise(function(_0x3d0816,_0x5aead1){return db[_0xda77('0x12')][_0xda77('0x13')]({'raw':_0x502f5c[_0xda77('0x14')]?_0x502f5c[_0xda77('0x14')][_0xda77('0x15')]===undefined?!![]:![]:!![],'where':_0x502f5c['options']?_0x502f5c[_0xda77('0x14')][_0xda77('0x16')]||null:null,'attributes':_0x502f5c['options']?_0x502f5c['options'][_0xda77('0x17')]||null:null,'include':_0x502f5c['options']?_0x502f5c[_0xda77('0x14')][_0xda77('0x18')]?_[_0xda77('0x19')](_0x502f5c[_0xda77('0x14')][_0xda77('0x18')],function(_0xc71d5){return{'model':db[_0xc71d5[_0xda77('0x1a')]],'as':_0xc71d5['as'],'attributes':_0xc71d5['attributes'],'include':_0xc71d5[_0xda77('0x18')]?_['map'](_0xc71d5['include'],function(_0xb7087a){return{'model':db[_0xb7087a[_0xda77('0x1a')]],'as':_0xb7087a['as'],'attributes':_0xb7087a['attributes'],'include':_0xb7087a[_0xda77('0x18')]?_[_0xda77('0x19')](_0xb7087a[_0xda77('0x18')],function(_0x3eecab){return{'model':db[_0x3eecab[_0xda77('0x1a')]],'as':_0x3eecab['as'],'attributes':_0x3eecab[_0xda77('0x17')]};}):[]};}):[]};}):[]:[]})[_0xda77('0x1b')](function(_0x14b655){logger['info'](_0xda77('0x11'),_0x502f5c);logger[_0xda77('0x9')](_0xda77('0x11'),_0x502f5c,JSON[_0xda77('0x1c')](_0x14b655));_0x3d0816(_0x14b655);})['catch'](function(_0x5bc8f1){logger[_0xda77('0xa')](_0xda77('0x11'),_0x5bc8f1[_0xda77('0xc')],_0x502f5c);_0x5aead1(_0x3c4405[_0xda77('0xa')](0x1f4,_0x5bc8f1[_0xda77('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a582052..a1a26c8 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 _0x84a0=['connect-timeout','Router','fs-extra','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','/:id/users','getUsers','post','addUsers','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x84a0,0x66));var _0x084a=function(_0x3ee0bd,_0x52269e){_0x3ee0bd=_0x3ee0bd-0x0;var _0x472796=_0x84a0[_0x3ee0bd];return _0x472796;};'use strict';var multer=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var path=require(_0x084a('0x2'));var timeout=require(_0x084a('0x3'));var express=require('express');var router=express[_0x084a('0x4')]();var fs_extra=require(_0x084a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x084a('0x6'));var controller=require(_0x084a('0x7'));router['get']('/',auth[_0x084a('0x8')](),controller[_0x084a('0x9')]);router[_0x084a('0xa')](_0x084a('0xb'),auth[_0x084a('0x8')](),controller['show']);router[_0x084a('0xa')](_0x084a('0xc'),auth[_0x084a('0x8')](),controller[_0x084a('0xd')]);router[_0x084a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x084a('0xe')](_0x084a('0xc'),auth[_0x084a('0x8')](),controller[_0x084a('0xf')]);router[_0x084a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x084a('0x11')]);router[_0x084a('0x12')](_0x084a('0xb'),auth[_0x084a('0x8')](),controller[_0x084a('0x13')]);router[_0x084a('0x12')](_0x084a('0xc'),auth[_0x084a('0x8')](),controller['removeUsers']);module[_0x084a('0x14')]=router; \ No newline at end of file +var _0x49a1=['delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','/:id','update'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x49a1,0x190));var _0x149a=function(_0x592416,_0x2c75e9){_0x592416=_0x592416-0x0;var _0x3005fa=_0x49a1[_0x592416];return _0x3005fa;};'use strict';var multer=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var path=require(_0x149a('0x2'));var timeout=require(_0x149a('0x3'));var express=require(_0x149a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x149a('0x5'));var config=require(_0x149a('0x6'));var controller=require('./squareProject.controller');router[_0x149a('0x7')]('/',auth[_0x149a('0x8')](),controller['index']);router[_0x149a('0x7')]('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0x9')]);router['get'](_0x149a('0xa'),auth[_0x149a('0x8')](),controller[_0x149a('0xb')]);router[_0x149a('0xc')]('/',auth[_0x149a('0x8')](),controller[_0x149a('0xd')]);router['post']('/:id/users',auth[_0x149a('0x8')](),controller[_0x149a('0xe')]);router[_0x149a('0xf')](_0x149a('0x10'),auth[_0x149a('0x8')](),controller[_0x149a('0x11')]);router[_0x149a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x149a('0x13')]);router['delete'](_0x149a('0xa'),auth[_0x149a('0x8')](),controller[_0x149a('0x14')]);module[_0x149a('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 19b192e..c8ca8b6 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 _0x5799=['DATE','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','utf8','getDataValue','production'];(function(_0x360396,_0x165e8c){var _0x43bd14=function(_0x23664a){while(--_0x23664a){_0x360396['push'](_0x360396['shift']());}};_0x43bd14(++_0x165e8c);}(_0x5799,0x91));var _0x9579=function(_0x127183,_0x4f7797){_0x127183=_0x127183-0x0;var _0x103360=_0x5799[_0x127183];return _0x103360;};'use strict';var Sequelize=require('sequelize');module[_0x9579('0x0')]={'name':{'type':Sequelize[_0x9579('0x1')],'unique':_0x9579('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x9579('0x3')]},'preproduction':{'type':Sequelize[_0x9579('0x4')](_0x9579('0x5')),'get':function(){if(this['getDataValue'](_0x9579('0x6'))){return this['getDataValue']('preproduction')[_0x9579('0x7')](_0x9579('0x8'));}}},'production':{'type':Sequelize[_0x9579('0x4')](_0x9579('0x5')),'get':function(){if(this[_0x9579('0x9')](_0x9579('0xa'))){return this['getDataValue']('production')['toString'](_0x9579('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x9579('0xb')]}}; \ No newline at end of file +var _0xf0c3=['utf8','production','DATE','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','toString'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xf0c3,0x142));var _0x3f0c=function(_0x32ea66,_0x20ada8){_0x32ea66=_0x32ea66-0x0;var _0x30cb45=_0xf0c3[_0x32ea66];return _0x30cb45;};'use strict';var Sequelize=require(_0x3f0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f0c('0x1')],'unique':_0x3f0c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3f0c('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x3f0c('0x3')](_0x3f0c('0x4')),'get':function(){if(this[_0x3f0c('0x5')](_0x3f0c('0x6'))){return this[_0x3f0c('0x5')]('preproduction')[_0x3f0c('0x7')](_0x3f0c('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x3f0c('0x4')),'get':function(){if(this['getDataValue'](_0x3f0c('0x9'))){return this[_0x3f0c('0x5')](_0x3f0c('0x9'))['toString'](_0x3f0c('0x8'));}}},'savedAt':{'type':Sequelize[_0x3f0c('0xa')]},'publishedAt':{'type':Sequelize[_0x3f0c('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3882c1f..cc73403 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 _0xc0bd=['limit','set','save','then','destroy','get','SquareProjects','UserProfileResource','status','stack','name','send','index','map','SquareProject','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','role','user','autoAssociation','error','update','params','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','offset','undefined','count'];(function(_0x282530,_0x5a31b2){var _0x266c57=function(_0x4a0df2){while(--_0x4a0df2){_0x282530['push'](_0x282530['shift']());}};_0x266c57(++_0x5a31b2);}(_0xc0bd,0x95));var _0xdc0b=function(_0x3a0b6c,_0x6d2497){_0x3a0b6c=_0x3a0b6c-0x0;var _0x50db44=_0xc0bd[_0x3a0b6c];return _0x50db44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdc0b('0x0'));var jsonpatch=require(_0xdc0b('0x1'));var rp=require('request-promise');var moment=require(_0xdc0b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdc0b('0x3'));var util=require(_0xdc0b('0x4'));var path=require(_0xdc0b('0x5'));var sox=require('sox');var csv=require(_0xdc0b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc0b('0x7'));var _=require('lodash');var squel=require(_0xdc0b('0x8'));var crypto=require(_0xdc0b('0x9'));var jsforce=require(_0xdc0b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdc0b('0x6'));var querystring=require(_0xdc0b('0xb'));var Papa=require(_0xdc0b('0xc'));var Redis=require('ioredis');var authService=require(_0xdc0b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdc0b('0xe'));var hardwareService=require(_0xdc0b('0xf'));var logger=require(_0xdc0b('0x10'))(_0xdc0b('0x11'));var utils=require(_0xdc0b('0x12'));var config=require(_0xdc0b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc0b('0x14'))['db'];config[_0xdc0b('0x15')]=_[_0xdc0b('0x16')](config['redis'],{'host':_0xdc0b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc0b('0x15')]));require(_0xdc0b('0x18'))[_0xdc0b('0x19')](socket);function respondWithStatusCode(_0x43df01,_0x5b402f){_0x5b402f=_0x5b402f||0xcc;return function(_0xf37777){if(_0xf37777){return _0x43df01[_0xdc0b('0x1a')](_0x5b402f);}return _0x43df01['status'](_0x5b402f)[_0xdc0b('0x1b')]();};}function respondWithResult(_0xcb8a7e,_0x342d39){_0x342d39=_0x342d39||0xc8;return function(_0x552b58){if(_0x552b58){return _0xcb8a7e['status'](_0x342d39)['json'](_0x552b58);}};}function respondWithFilteredResult(_0x16e0f4,_0x11a9e2){return function(_0x499474){if(_0x499474){var _0x193984=typeof _0x11a9e2[_0xdc0b('0x1c')]===_0xdc0b('0x1d')&&typeof _0x11a9e2['limit']===_0xdc0b('0x1d');var _0xedce8e=_0x499474['count'];var _0x2663c7=_0x193984?0x0:_0x11a9e2[_0xdc0b('0x1c')];var _0x270b72=_0x193984?_0x499474[_0xdc0b('0x1e')]:_0x11a9e2[_0xdc0b('0x1c')]+_0x11a9e2[_0xdc0b('0x1f')];var _0x31b194;if(_0x270b72>=_0xedce8e){_0x270b72=_0xedce8e;_0x31b194=0xc8;}else{_0x31b194=0xce;}_0x16e0f4['status'](_0x31b194);return _0x16e0f4[_0xdc0b('0x20')]('Content-Range',_0x2663c7+'-'+_0x270b72+'/'+_0xedce8e)['json'](_0x499474);}return null;};}function patchUpdates(_0x5a74b9){return function(_0x3177ba){try{jsonpatch['apply'](_0x3177ba,_0x5a74b9,!![]);}catch(_0x6ed67b){return BPromise['reject'](_0x6ed67b);}return _0x3177ba[_0xdc0b('0x21')]();};}function saveUpdates(_0x33cf3b,_0xc20715){return function(_0x1773f6){if(_0x1773f6){return _0x1773f6['update'](_0x33cf3b)[_0xdc0b('0x22')](function(_0x544f47){return _0x544f47;});}return null;};}function removeEntity(_0x460316,_0x442c74){return function(_0x14a4dc){if(_0x14a4dc){return _0x14a4dc[_0xdc0b('0x23')]()[_0xdc0b('0x22')](function(){var _0x56d99d=_0x14a4dc[_0xdc0b('0x24')]({'plain':!![]});var _0x36ff16=_0xdc0b('0x25');return db[_0xdc0b('0x26')][_0xdc0b('0x23')]({'where':{'type':_0x36ff16,'resourceId':_0x56d99d['id']}})[_0xdc0b('0x22')](function(){return _0x14a4dc;});})[_0xdc0b('0x22')](function(){_0x460316[_0xdc0b('0x27')](0xcc)[_0xdc0b('0x1b')]();});}};}function handleEntityNotFound(_0xb2453d,_0x13995f){return function(_0x163b82){if(!_0x163b82){_0xb2453d[_0xdc0b('0x1a')](0x194);}return _0x163b82;};}function handleError(_0xaaa82,_0x4add56){_0x4add56=_0x4add56||0x1f4;return function(_0x43fb14){logger['error'](_0x43fb14[_0xdc0b('0x28')]);if(_0x43fb14[_0xdc0b('0x29')]){delete _0x43fb14[_0xdc0b('0x29')];}_0xaaa82[_0xdc0b('0x27')](_0x4add56)[_0xdc0b('0x2a')](_0x43fb14);};}exports[_0xdc0b('0x2b')]=function(_0x4db752,_0x4ecce0){var _0x1eef0f={},_0x17e45c={},_0x2c1f4d={'count':0x0,'rows':[]};var _0x204a53=_[_0xdc0b('0x2c')](db[_0xdc0b('0x2d')][_0xdc0b('0x2e')],function(_0xeeafe9){return{'name':_0xeeafe9['fieldName'],'type':_0xeeafe9[_0xdc0b('0x2f')][_0xdc0b('0x30')]};});_0x17e45c['model']=_[_0xdc0b('0x2c')](_0x204a53,'name');_0x17e45c[_0xdc0b('0x31')]=_[_0xdc0b('0x32')](_0x4db752[_0xdc0b('0x31')]);_0x17e45c['filters']=_['intersection'](_0x17e45c[_0xdc0b('0x33')],_0x17e45c[_0xdc0b('0x31')]);_0x1eef0f['attributes']=_[_0xdc0b('0x34')](_0x17e45c[_0xdc0b('0x33')],qs[_0xdc0b('0x35')](_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x35')]));_0x1eef0f[_0xdc0b('0x36')]=_0x1eef0f[_0xdc0b('0x36')][_0xdc0b('0x37')]?_0x1eef0f['attributes']:_0x17e45c[_0xdc0b('0x33')];if(!_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x38')](_0xdc0b('0x39'))){_0x1eef0f[_0xdc0b('0x1f')]=qs[_0xdc0b('0x1f')](_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x1f')]);_0x1eef0f[_0xdc0b('0x1c')]=qs[_0xdc0b('0x1c')](_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x1c')]);}_0x1eef0f[_0xdc0b('0x3a')]=qs['sort'](_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x3b')]);_0x1eef0f[_0xdc0b('0x3c')]=qs[_0xdc0b('0x3d')](_[_0xdc0b('0x3e')](_0x4db752['query'],_0x17e45c[_0xdc0b('0x3d')]),_0x204a53);if(_0x4db752[_0xdc0b('0x31')][_0xdc0b('0x3f')]){_0x1eef0f[_0xdc0b('0x3c')]=_[_0xdc0b('0x40')](_0x1eef0f[_0xdc0b('0x3c')],{'$or':_[_0xdc0b('0x2c')](_0x204a53,function(_0x3d6974){if(_0x3d6974[_0xdc0b('0x2f')]!==_0xdc0b('0x41')){var _0x4a22d1={};_0x4a22d1[_0x3d6974[_0xdc0b('0x29')]]={'$like':'%'+_0x4db752['query']['filter']+'%'};return _0x4a22d1;}})});}_0x1eef0f=_[_0xdc0b('0x40')]({},_0x1eef0f,_0x4db752['options']);var _0x5b9771={'where':_0x1eef0f[_0xdc0b('0x3c')]};return db[_0xdc0b('0x2d')][_0xdc0b('0x1e')](_0x5b9771)[_0xdc0b('0x22')](function(_0x431309){_0x2c1f4d[_0xdc0b('0x1e')]=_0x431309;if(_0x4db752['query'][_0xdc0b('0x42')]){_0x1eef0f[_0xdc0b('0x43')]=[{'all':!![]}];}return db[_0xdc0b('0x2d')][_0xdc0b('0x44')](_0x1eef0f);})[_0xdc0b('0x22')](function(_0x32eb4c){_0x2c1f4d[_0xdc0b('0x45')]=_0x32eb4c;return _0x2c1f4d;})[_0xdc0b('0x22')](respondWithFilteredResult(_0x4ecce0,_0x1eef0f))[_0xdc0b('0x46')](handleError(_0x4ecce0,null));};exports[_0xdc0b('0x47')]=function(_0x4439c7,_0x1a1b64){var _0x3185b3={'raw':![],'where':{'id':_0x4439c7['params']['id']}},_0x203c13={};_0x203c13[_0xdc0b('0x33')]=_['keys'](db['SquareProject']['rawAttributes']);_0x203c13['query']=_[_0xdc0b('0x32')](_0x4439c7[_0xdc0b('0x31')]);_0x203c13[_0xdc0b('0x3d')]=_[_0xdc0b('0x34')](_0x203c13[_0xdc0b('0x33')],_0x203c13[_0xdc0b('0x31')]);_0x3185b3[_0xdc0b('0x36')]=_[_0xdc0b('0x34')](_0x203c13[_0xdc0b('0x33')],qs[_0xdc0b('0x35')](_0x4439c7[_0xdc0b('0x31')][_0xdc0b('0x35')]));_0x3185b3['attributes']=_0x3185b3[_0xdc0b('0x36')][_0xdc0b('0x37')]?_0x3185b3[_0xdc0b('0x36')]:_0x203c13[_0xdc0b('0x33')];if(_0x4439c7[_0xdc0b('0x31')][_0xdc0b('0x42')]){_0x3185b3[_0xdc0b('0x43')]=[{'all':!![]}];}_0x3185b3=_[_0xdc0b('0x40')]({},_0x3185b3,_0x4439c7[_0xdc0b('0x48')]);return db['SquareProject'][_0xdc0b('0x49')](_0x3185b3)[_0xdc0b('0x22')](handleEntityNotFound(_0x1a1b64,null))[_0xdc0b('0x22')](respondWithResult(_0x1a1b64,null))[_0xdc0b('0x46')](handleError(_0x1a1b64,null));};exports[_0xdc0b('0x4a')]=function(_0x1b0371,_0x16ec26){return db['SquareProject']['create'](_0x1b0371[_0xdc0b('0x4b')],{})[_0xdc0b('0x22')](function(_0x3bc36c){var _0x176a23=_0x1b0371['user']['get']({'plain':!![]});if(!_0x176a23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176a23[_0xdc0b('0x4c')]===_0xdc0b('0x4d')){var _0x306b0c=_0x3bc36c[_0xdc0b('0x24')]({'plain':!![]});var _0x365560=_0xdc0b('0x25');return db['UserProfileSection'][_0xdc0b('0x49')]({'where':{'name':_0x365560,'userProfileId':_0x176a23['userProfileId']},'raw':!![]})[_0xdc0b('0x22')](function(_0x4ce8a4){if(_0x4ce8a4&&_0x4ce8a4[_0xdc0b('0x4e')]===0x0){return db[_0xdc0b('0x26')][_0xdc0b('0x4a')]({'name':_0x306b0c['name'],'resourceId':_0x306b0c['id'],'type':_0x4ce8a4[_0xdc0b('0x29')],'sectionId':_0x4ce8a4['id']},{})[_0xdc0b('0x22')](function(){return _0x3bc36c;});}else{return _0x3bc36c;}})[_0xdc0b('0x46')](function(_0xfb9c19){logger[_0xdc0b('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb9c19);throw _0xfb9c19;});}return _0x3bc36c;})[_0xdc0b('0x22')](respondWithResult(_0x16ec26,0xc9))[_0xdc0b('0x46')](handleError(_0x16ec26,null));};exports[_0xdc0b('0x50')]=function(_0x3281e9,_0xbfd7ca){if(_0x3281e9[_0xdc0b('0x4b')]['id']){delete _0x3281e9[_0xdc0b('0x4b')]['id'];}return db[_0xdc0b('0x2d')][_0xdc0b('0x49')]({'where':{'id':_0x3281e9['params']['id']}})[_0xdc0b('0x22')](handleEntityNotFound(_0xbfd7ca,null))[_0xdc0b('0x22')](saveUpdates(_0x3281e9[_0xdc0b('0x4b')],null))['then'](respondWithResult(_0xbfd7ca,null))[_0xdc0b('0x46')](handleError(_0xbfd7ca,null));};exports[_0xdc0b('0x23')]=function(_0x781e67,_0x1d0451){return db[_0xdc0b('0x2d')]['find']({'where':{'id':_0x781e67[_0xdc0b('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d0451,null))['then'](removeEntity(_0x1d0451,null))[_0xdc0b('0x46')](handleError(_0x1d0451,null));};exports[_0xdc0b('0x52')]=function(_0x12b8cc,_0x2b51f5,_0x3a1e50){return db[_0xdc0b('0x2d')][_0xdc0b('0x49')]({'where':{'id':_0x12b8cc[_0xdc0b('0x51')]['id']}})[_0xdc0b('0x22')](handleEntityNotFound(_0x2b51f5,null))[_0xdc0b('0x22')](function(_0x103ac1){if(_0x103ac1){return _0x103ac1[_0xdc0b('0x52')](_0x12b8cc['body'][_0xdc0b('0x53')],_['omit'](_0x12b8cc['body'],[_0xdc0b('0x53'),'id'])||{});}})['then'](respondWithResult(_0x2b51f5,null))[_0xdc0b('0x46')](handleError(_0x2b51f5,null));};exports[_0xdc0b('0x54')]=function(_0x413411,_0x586c8a,_0x38790d){return db['SquareProject'][_0xdc0b('0x49')]({'where':{'id':_0x413411[_0xdc0b('0x51')]['id']}})[_0xdc0b('0x22')](handleEntityNotFound(_0x586c8a,null))[_0xdc0b('0x22')](function(_0x493bb3){if(_0x493bb3){return _0x493bb3['removeUsers'](_0x413411['query'][_0xdc0b('0x53')])[_0xdc0b('0x22')](function(){if(_['isArray'](_0x413411[_0xdc0b('0x31')][_0xdc0b('0x53')])){for(var _0x33e640=0x0;_0x33e640<_0x413411[_0xdc0b('0x31')][_0xdc0b('0x53')]['length'];_0x33e640+=0x1){socket[_0xdc0b('0x55')]('userSquareProject:remove',{'UserId':Number(_0x413411['query']['ids'][_0x33e640]),'SquareProjectId':Number(_0x413411[_0xdc0b('0x51')]['id'])});}}else{socket[_0xdc0b('0x55')](_0xdc0b('0x56'),{'UserId':Number(_0x413411[_0xdc0b('0x31')][_0xdc0b('0x53')]),'SquareProjectId':Number(_0x413411[_0xdc0b('0x51')]['id'])});}});}})[_0xdc0b('0x22')](respondWithStatusCode(_0x586c8a,null))[_0xdc0b('0x46')](handleError(_0x586c8a,null));};exports[_0xdc0b('0x57')]=function(_0x4f8a47,_0x590f03,_0x515c5c){var _0x5ec6c8={};var _0x4e00e3={};var _0x27ec6a;var _0x5e28ea;return db[_0xdc0b('0x2d')][_0xdc0b('0x58')]({'where':{'id':_0x4f8a47[_0xdc0b('0x51')]['id']}})[_0xdc0b('0x22')](handleEntityNotFound(_0x590f03,null))[_0xdc0b('0x22')](function(_0x2d9615){if(_0x2d9615){_0x27ec6a=_0x2d9615;_0x4e00e3[_0xdc0b('0x33')]=_['keys'](db[_0xdc0b('0x59')][_0xdc0b('0x2e')]);_0x4e00e3['query']=_[_0xdc0b('0x32')](_0x4f8a47[_0xdc0b('0x31')]);_0x4e00e3[_0xdc0b('0x3d')]=_[_0xdc0b('0x34')](_0x4e00e3[_0xdc0b('0x33')],_0x4e00e3[_0xdc0b('0x31')]);_0x5ec6c8['attributes']=_[_0xdc0b('0x34')](_0x4e00e3['model'],qs[_0xdc0b('0x35')](_0x4f8a47['query'][_0xdc0b('0x35')]));_0x5ec6c8['attributes']=_0x5ec6c8['attributes'][_0xdc0b('0x37')]?_0x5ec6c8['attributes']:_0x4e00e3['model'];_0x5ec6c8[_0xdc0b('0x3a')]=qs[_0xdc0b('0x3b')](_0x4f8a47['query'][_0xdc0b('0x3b')]);_0x5ec6c8[_0xdc0b('0x3c')]=qs[_0xdc0b('0x3d')](_[_0xdc0b('0x3e')](_0x4f8a47[_0xdc0b('0x31')],_0x4e00e3[_0xdc0b('0x3d')]));if(_0x4f8a47[_0xdc0b('0x31')][_0xdc0b('0x3f')]){_0x5ec6c8[_0xdc0b('0x3c')]=_[_0xdc0b('0x40')](_0x5ec6c8['where'],{'$or':_[_0xdc0b('0x2c')](_0x5ec6c8[_0xdc0b('0x36')],function(_0x2f5eb6){var _0xe287bf={};_0xe287bf[_0x2f5eb6]={'$like':'%'+_0x4f8a47['query']['filter']+'%'};return _0xe287bf;})});}_0x5ec6c8=_[_0xdc0b('0x40')]({},_0x5ec6c8,_0x4f8a47[_0xdc0b('0x48')]);return _0x27ec6a['getUsers'](_0x5ec6c8);}})[_0xdc0b('0x22')](function(_0x422654){if(_0x422654){_0x5e28ea=_0x422654[_0xdc0b('0x37')];if(!_0x4f8a47['query'][_0xdc0b('0x38')](_0xdc0b('0x39'))){_0x5ec6c8[_0xdc0b('0x1f')]=qs[_0xdc0b('0x1f')](_0x4f8a47[_0xdc0b('0x31')][_0xdc0b('0x1f')]);_0x5ec6c8['offset']=qs[_0xdc0b('0x1c')](_0x4f8a47[_0xdc0b('0x31')][_0xdc0b('0x1c')]);}return _0x27ec6a['getUsers'](_0x5ec6c8);}})['then'](function(_0x38e996){if(_0x38e996){return _0x38e996?{'count':_0x5e28ea,'rows':_0x38e996}:null;}})[_0xdc0b('0x22')](respondWithResult(_0x590f03,null))[_0xdc0b('0x46')](handleError(_0x590f03,null));}; \ No newline at end of file +var _0x302f=['localhost','socket.io-emitter','register','status','json','offset','undefined','count','Content-Range','reject','save','then','destroy','get','SquareProjects','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SquareProject','fieldName','type','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','query','order','sort','pick','filter','merge','where','options','includeAll','include','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','rawAttributes','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults'];(function(_0xabbd65,_0x546d99){var _0x1d005a=function(_0x11694e){while(--_0x11694e){_0xabbd65['push'](_0xabbd65['shift']());}};_0x1d005a(++_0x546d99);}(_0x302f,0xf3));var _0xf302=function(_0x505f37,_0x318725){_0x505f37=_0x505f37-0x0;var _0x30092a=_0x302f[_0x505f37];return _0x30092a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf302('0x0'));var rp=require(_0xf302('0x1'));var moment=require(_0xf302('0x2'));var BPromise=require(_0xf302('0x3'));var Mustache=require(_0xf302('0x4'));var util=require(_0xf302('0x5'));var path=require(_0xf302('0x6'));var sox=require(_0xf302('0x7'));var csv=require(_0xf302('0x8'));var ejs=require(_0xf302('0x9'));var fs=require('fs');var fs_extra=require(_0xf302('0xa'));var _=require('lodash');var squel=require(_0xf302('0xb'));var crypto=require(_0xf302('0xc'));var jsforce=require(_0xf302('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf302('0xe'));var authService=require(_0xf302('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf302('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf302('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf302('0x12'));var db=require('../../mysqldb')['db'];config[_0xf302('0x13')]=_[_0xf302('0x14')](config[_0xf302('0x13')],{'host':_0xf302('0x15'),'port':0x18eb});var socket=require(_0xf302('0x16'))(new Redis(config[_0xf302('0x13')]));require('./squareProject.socket')[_0xf302('0x17')](socket);function respondWithStatusCode(_0x41e435,_0x5066fd){_0x5066fd=_0x5066fd||0xcc;return function(_0x307cb2){if(_0x307cb2){return _0x41e435['sendStatus'](_0x5066fd);}return _0x41e435['status'](_0x5066fd)['end']();};}function respondWithResult(_0xb095e1,_0x1e2204){_0x1e2204=_0x1e2204||0xc8;return function(_0x530726){if(_0x530726){return _0xb095e1[_0xf302('0x18')](_0x1e2204)[_0xf302('0x19')](_0x530726);}};}function respondWithFilteredResult(_0x4f9370,_0x15bc88){return function(_0x1d7b41){if(_0x1d7b41){var _0x333719=typeof _0x15bc88[_0xf302('0x1a')]===_0xf302('0x1b')&&typeof _0x15bc88['limit']==='undefined';var _0x20d9e8=_0x1d7b41[_0xf302('0x1c')];var _0x56e0be=_0x333719?0x0:_0x15bc88[_0xf302('0x1a')];var _0x3c473b=_0x333719?_0x1d7b41['count']:_0x15bc88[_0xf302('0x1a')]+_0x15bc88['limit'];var _0x47679c;if(_0x3c473b>=_0x20d9e8){_0x3c473b=_0x20d9e8;_0x47679c=0xc8;}else{_0x47679c=0xce;}_0x4f9370['status'](_0x47679c);return _0x4f9370['set'](_0xf302('0x1d'),_0x56e0be+'-'+_0x3c473b+'/'+_0x20d9e8)['json'](_0x1d7b41);}return null;};}function patchUpdates(_0x4200b9){return function(_0x2c8e10){try{jsonpatch['apply'](_0x2c8e10,_0x4200b9,!![]);}catch(_0x58fc40){return BPromise[_0xf302('0x1e')](_0x58fc40);}return _0x2c8e10[_0xf302('0x1f')]();};}function saveUpdates(_0x2496a9,_0x309696){return function(_0x156bb9){if(_0x156bb9){return _0x156bb9['update'](_0x2496a9)[_0xf302('0x20')](function(_0x3784e2){return _0x3784e2;});}return null;};}function removeEntity(_0x20a1d4,_0x13363f){return function(_0x409f3c){if(_0x409f3c){return _0x409f3c[_0xf302('0x21')]()[_0xf302('0x20')](function(){var _0x458094=_0x409f3c[_0xf302('0x22')]({'plain':!![]});var _0x5bab06=_0xf302('0x23');return db[_0xf302('0x24')][_0xf302('0x21')]({'where':{'type':_0x5bab06,'resourceId':_0x458094['id']}})[_0xf302('0x20')](function(){return _0x409f3c;});})[_0xf302('0x20')](function(){_0x20a1d4[_0xf302('0x18')](0xcc)[_0xf302('0x25')]();});}};}function handleEntityNotFound(_0xe72054,_0x460e8d){return function(_0x50eb42){if(!_0x50eb42){_0xe72054[_0xf302('0x26')](0x194);}return _0x50eb42;};}function handleError(_0x11659f,_0x10420d){_0x10420d=_0x10420d||0x1f4;return function(_0x14cf28){logger[_0xf302('0x27')](_0x14cf28[_0xf302('0x28')]);if(_0x14cf28['name']){delete _0x14cf28[_0xf302('0x29')];}_0x11659f[_0xf302('0x18')](_0x10420d)[_0xf302('0x2a')](_0x14cf28);};}exports[_0xf302('0x2b')]=function(_0x1daab5,_0x22d728){var _0x41a95f={},_0x191bc1={},_0x1161bc={'count':0x0,'rows':[]};var _0x513f1f=_[_0xf302('0x2c')](db[_0xf302('0x2d')]['rawAttributes'],function(_0x746693){return{'name':_0x746693[_0xf302('0x2e')],'type':_0x746693[_0xf302('0x2f')]['key']};});_0x191bc1[_0xf302('0x30')]=_[_0xf302('0x2c')](_0x513f1f,_0xf302('0x29'));_0x191bc1['query']=_[_0xf302('0x31')](_0x1daab5['query']);_0x191bc1[_0xf302('0x32')]=_[_0xf302('0x33')](_0x191bc1['model'],_0x191bc1['query']);_0x41a95f[_0xf302('0x34')]=_['intersection'](_0x191bc1[_0xf302('0x30')],qs[_0xf302('0x35')](_0x1daab5['query'][_0xf302('0x35')]));_0x41a95f['attributes']=_0x41a95f['attributes'][_0xf302('0x36')]?_0x41a95f[_0xf302('0x34')]:_0x191bc1['model'];if(!_0x1daab5['query'][_0xf302('0x37')](_0xf302('0x38'))){_0x41a95f[_0xf302('0x39')]=qs[_0xf302('0x39')](_0x1daab5[_0xf302('0x3a')]['limit']);_0x41a95f[_0xf302('0x1a')]=qs['offset'](_0x1daab5[_0xf302('0x3a')][_0xf302('0x1a')]);}_0x41a95f[_0xf302('0x3b')]=qs[_0xf302('0x3c')](_0x1daab5[_0xf302('0x3a')][_0xf302('0x3c')]);_0x41a95f['where']=qs[_0xf302('0x32')](_[_0xf302('0x3d')](_0x1daab5['query'],_0x191bc1[_0xf302('0x32')]),_0x513f1f);if(_0x1daab5[_0xf302('0x3a')][_0xf302('0x3e')]){_0x41a95f['where']=_[_0xf302('0x3f')](_0x41a95f[_0xf302('0x40')],{'$or':_['map'](_0x513f1f,function(_0x5385ac){if(_0x5385ac[_0xf302('0x2f')]!=='VIRTUAL'){var _0x1b216d={};_0x1b216d[_0x5385ac[_0xf302('0x29')]]={'$like':'%'+_0x1daab5['query'][_0xf302('0x3e')]+'%'};return _0x1b216d;}})});}_0x41a95f=_[_0xf302('0x3f')]({},_0x41a95f,_0x1daab5[_0xf302('0x41')]);var _0x5309dc={'where':_0x41a95f['where']};return db['SquareProject'][_0xf302('0x1c')](_0x5309dc)[_0xf302('0x20')](function(_0x57f8c5){_0x1161bc[_0xf302('0x1c')]=_0x57f8c5;if(_0x1daab5[_0xf302('0x3a')][_0xf302('0x42')]){_0x41a95f[_0xf302('0x43')]=[{'all':!![]}];}return db[_0xf302('0x2d')]['findAll'](_0x41a95f);})['then'](function(_0x26eef2){_0x1161bc['rows']=_0x26eef2;return _0x1161bc;})[_0xf302('0x20')](respondWithFilteredResult(_0x22d728,_0x41a95f))[_0xf302('0x44')](handleError(_0x22d728,null));};exports['show']=function(_0x230626,_0xf720c4){var _0x452e3c={'raw':![],'where':{'id':_0x230626['params']['id']}},_0x3492e1={};_0x3492e1[_0xf302('0x30')]=_[_0xf302('0x31')](db[_0xf302('0x2d')]['rawAttributes']);_0x3492e1[_0xf302('0x3a')]=_[_0xf302('0x31')](_0x230626[_0xf302('0x3a')]);_0x3492e1[_0xf302('0x32')]=_[_0xf302('0x33')](_0x3492e1[_0xf302('0x30')],_0x3492e1['query']);_0x452e3c['attributes']=_['intersection'](_0x3492e1[_0xf302('0x30')],qs[_0xf302('0x35')](_0x230626['query']['fields']));_0x452e3c[_0xf302('0x34')]=_0x452e3c['attributes']['length']?_0x452e3c['attributes']:_0x3492e1[_0xf302('0x30')];if(_0x230626[_0xf302('0x3a')][_0xf302('0x42')]){_0x452e3c[_0xf302('0x43')]=[{'all':!![]}];}_0x452e3c=_['merge']({},_0x452e3c,_0x230626[_0xf302('0x41')]);return db['SquareProject'][_0xf302('0x45')](_0x452e3c)['then'](handleEntityNotFound(_0xf720c4,null))[_0xf302('0x20')](respondWithResult(_0xf720c4,null))[_0xf302('0x44')](handleError(_0xf720c4,null));};exports['create']=function(_0x4a4bfc,_0x58a1ed){return db[_0xf302('0x2d')][_0xf302('0x46')](_0x4a4bfc[_0xf302('0x47')],{})[_0xf302('0x20')](function(_0x3f3c38){var _0x216783=_0x4a4bfc[_0xf302('0x48')][_0xf302('0x22')]({'plain':!![]});if(!_0x216783)throw new Error(_0xf302('0x49'));if(_0x216783[_0xf302('0x4a')]===_0xf302('0x48')){var _0x4ea61f=_0x3f3c38[_0xf302('0x22')]({'plain':!![]});var _0x5075fc=_0xf302('0x23');return db[_0xf302('0x4b')]['find']({'where':{'name':_0x5075fc,'userProfileId':_0x216783[_0xf302('0x4c')]},'raw':!![]})[_0xf302('0x20')](function(_0x422b8b){if(_0x422b8b&&_0x422b8b['autoAssociation']===0x0){return db[_0xf302('0x24')][_0xf302('0x46')]({'name':_0x4ea61f[_0xf302('0x29')],'resourceId':_0x4ea61f['id'],'type':_0x422b8b[_0xf302('0x29')],'sectionId':_0x422b8b['id']},{})[_0xf302('0x20')](function(){return _0x3f3c38;});}else{return _0x3f3c38;}})[_0xf302('0x44')](function(_0x3a74cb){logger[_0xf302('0x27')](_0xf302('0x4d'),_0x3a74cb);throw _0x3a74cb;});}return _0x3f3c38;})[_0xf302('0x20')](respondWithResult(_0x58a1ed,0xc9))['catch'](handleError(_0x58a1ed,null));};exports[_0xf302('0x4e')]=function(_0x170031,_0x5a8229){if(_0x170031['body']['id']){delete _0x170031[_0xf302('0x47')]['id'];}return db[_0xf302('0x2d')][_0xf302('0x45')]({'where':{'id':_0x170031['params']['id']}})[_0xf302('0x20')](handleEntityNotFound(_0x5a8229,null))[_0xf302('0x20')](saveUpdates(_0x170031[_0xf302('0x47')],null))['then'](respondWithResult(_0x5a8229,null))[_0xf302('0x44')](handleError(_0x5a8229,null));};exports[_0xf302('0x21')]=function(_0x10db59,_0x39d01a){return db[_0xf302('0x2d')]['find']({'where':{'id':_0x10db59['params']['id']}})[_0xf302('0x20')](handleEntityNotFound(_0x39d01a,null))[_0xf302('0x20')](removeEntity(_0x39d01a,null))[_0xf302('0x44')](handleError(_0x39d01a,null));};exports['addUsers']=function(_0x2a5eb4,_0x1c82d2,_0x2df91c){return db['SquareProject'][_0xf302('0x45')]({'where':{'id':_0x2a5eb4[_0xf302('0x4f')]['id']}})[_0xf302('0x20')](handleEntityNotFound(_0x1c82d2,null))[_0xf302('0x20')](function(_0x37f8ed){if(_0x37f8ed){return _0x37f8ed['addUsers'](_0x2a5eb4[_0xf302('0x47')][_0xf302('0x50')],_['omit'](_0x2a5eb4[_0xf302('0x47')],[_0xf302('0x50'),'id'])||{});}})[_0xf302('0x20')](respondWithResult(_0x1c82d2,null))[_0xf302('0x44')](handleError(_0x1c82d2,null));};exports[_0xf302('0x51')]=function(_0x2e846e,_0x56b1f2,_0x3862c6){return db[_0xf302('0x2d')][_0xf302('0x45')]({'where':{'id':_0x2e846e[_0xf302('0x4f')]['id']}})[_0xf302('0x20')](handleEntityNotFound(_0x56b1f2,null))[_0xf302('0x20')](function(_0x2aae5f){if(_0x2aae5f){return _0x2aae5f[_0xf302('0x51')](_0x2e846e[_0xf302('0x3a')][_0xf302('0x50')])[_0xf302('0x20')](function(){if(_['isArray'](_0x2e846e[_0xf302('0x3a')][_0xf302('0x50')])){for(var _0x503cdc=0x0;_0x503cdc<_0x2e846e[_0xf302('0x3a')][_0xf302('0x50')][_0xf302('0x36')];_0x503cdc+=0x1){socket[_0xf302('0x52')](_0xf302('0x53'),{'UserId':Number(_0x2e846e[_0xf302('0x3a')][_0xf302('0x50')][_0x503cdc]),'SquareProjectId':Number(_0x2e846e['params']['id'])});}}else{socket[_0xf302('0x52')](_0xf302('0x53'),{'UserId':Number(_0x2e846e[_0xf302('0x3a')][_0xf302('0x50')]),'SquareProjectId':Number(_0x2e846e[_0xf302('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x56b1f2,null))['catch'](handleError(_0x56b1f2,null));};exports[_0xf302('0x54')]=function(_0x2376de,_0x3dcd2c,_0x30fa65){var _0x5a2f0f={};var _0x41600f={};var _0x1e9be1;var _0x396f4d;return db[_0xf302('0x2d')][_0xf302('0x55')]({'where':{'id':_0x2376de[_0xf302('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3dcd2c,null))[_0xf302('0x20')](function(_0x53f601){if(_0x53f601){_0x1e9be1=_0x53f601;_0x41600f[_0xf302('0x30')]=_[_0xf302('0x31')](db[_0xf302('0x56')][_0xf302('0x57')]);_0x41600f['query']=_[_0xf302('0x31')](_0x2376de[_0xf302('0x3a')]);_0x41600f[_0xf302('0x32')]=_['intersection'](_0x41600f[_0xf302('0x30')],_0x41600f['query']);_0x5a2f0f['attributes']=_[_0xf302('0x33')](_0x41600f[_0xf302('0x30')],qs['fields'](_0x2376de[_0xf302('0x3a')][_0xf302('0x35')]));_0x5a2f0f[_0xf302('0x34')]=_0x5a2f0f[_0xf302('0x34')][_0xf302('0x36')]?_0x5a2f0f[_0xf302('0x34')]:_0x41600f[_0xf302('0x30')];_0x5a2f0f[_0xf302('0x3b')]=qs[_0xf302('0x3c')](_0x2376de[_0xf302('0x3a')][_0xf302('0x3c')]);_0x5a2f0f[_0xf302('0x40')]=qs[_0xf302('0x32')](_['pick'](_0x2376de[_0xf302('0x3a')],_0x41600f[_0xf302('0x32')]));if(_0x2376de[_0xf302('0x3a')][_0xf302('0x3e')]){_0x5a2f0f['where']=_[_0xf302('0x3f')](_0x5a2f0f['where'],{'$or':_[_0xf302('0x2c')](_0x5a2f0f[_0xf302('0x34')],function(_0x2c96a4){var _0x36d10e={};_0x36d10e[_0x2c96a4]={'$like':'%'+_0x2376de[_0xf302('0x3a')][_0xf302('0x3e')]+'%'};return _0x36d10e;})});}_0x5a2f0f=_['merge']({},_0x5a2f0f,_0x2376de[_0xf302('0x41')]);return _0x1e9be1[_0xf302('0x54')](_0x5a2f0f);}})['then'](function(_0x4a3229){if(_0x4a3229){_0x396f4d=_0x4a3229[_0xf302('0x36')];if(!_0x2376de[_0xf302('0x3a')]['hasOwnProperty']('nolimit')){_0x5a2f0f[_0xf302('0x39')]=qs['limit'](_0x2376de[_0xf302('0x3a')][_0xf302('0x39')]);_0x5a2f0f['offset']=qs['offset'](_0x2376de[_0xf302('0x3a')][_0xf302('0x1a')]);}return _0x1e9be1[_0xf302('0x54')](_0x5a2f0f);}})['then'](function(_0x55f019){if(_0x55f019){return _0x55f019?{'count':_0x396f4d,'rows':_0x55f019}:null;}})['then'](respondWithResult(_0x3dcd2c,null))['catch'](handleError(_0x3dcd2c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c71efe5..081295d 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 _0xf4bb=['update','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xf4bb,0x7b));var _0xbf4b=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf4bb[_0xdc37a1];return _0x99b4fe;};'use strict';var EventEmitter=require(_0xbf4b('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xbf4b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf4b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4b('0x3'),'afterDestroy':_0xbf4b('0x4')};function emitEvent(_0x59f161){return function(_0xaa791f,_0x6a95ba,_0x46be36){SquareProjectEvents[_0xbf4b('0x5')](_0x59f161+':'+_0xaa791f['id'],_0xaa791f);SquareProjectEvents[_0xbf4b('0x5')](_0x59f161,_0xaa791f);_0x46be36(null);};}for(var e in events){if(events[_0xbf4b('0x6')](e)){var event=events[e];SquareProject[_0xbf4b('0x7')](e,emitEvent(event));}}module[_0xbf4b('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x8eb8=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x343111,_0x258b52){var _0x3ebe57=function(_0x4e217e){while(--_0x4e217e){_0x343111['push'](_0x343111['shift']());}};_0x3ebe57(++_0x258b52);}(_0x8eb8,0x16c));var _0x88eb=function(_0x3b5b1c,_0x38b583){_0x3b5b1c=_0x3b5b1c-0x0;var _0x4db5b2=_0x8eb8[_0x3b5b1c];return _0x4db5b2;};'use strict';var EventEmitter=require(_0x88eb('0x0'));var SquareProject=require(_0x88eb('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x88eb('0x2')](0x0);var events={'afterCreate':_0x88eb('0x3'),'afterUpdate':_0x88eb('0x4'),'afterDestroy':_0x88eb('0x5')};function emitEvent(_0x6f4e5e){return function(_0x5d4c77,_0x4c5939,_0x23b99e){SquareProjectEvents[_0x88eb('0x6')](_0x6f4e5e+':'+_0x5d4c77['id'],_0x5d4c77);SquareProjectEvents['emit'](_0x6f4e5e,_0x5d4c77);_0x23b99e(null);};}for(var e in events){if(events[_0x88eb('0x7')](e)){var event=events[e];SquareProject[_0x88eb('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6870bf1..e2c5605 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 _0xafe5=['SquareProject','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define'];(function(_0x1de2a9,_0x23b34e){var _0x262bc9=function(_0x387d3f){while(--_0x387d3f){_0x1de2a9['push'](_0x1de2a9['shift']());}};_0x262bc9(++_0x23b34e);}(_0xafe5,0x1b0));var _0x5afe=function(_0x2364ef,_0x18706b){_0x2364ef=_0x2364ef-0x0;var _0x5555aa=_0xafe5[_0x2364ef];return _0x5555aa;};'use strict';var _=require('lodash');var util=require(_0x5afe('0x0'));var logger=require(_0x5afe('0x1'))(_0x5afe('0x2'));var moment=require('moment');var BPromise=require(_0x5afe('0x3'));var rp=require(_0x5afe('0x4'));var fs=require('fs');var path=require(_0x5afe('0x5'));var rimraf=require(_0x5afe('0x6'));var config=require(_0x5afe('0x7'));var attributes=require(_0x5afe('0x8'));module['exports']=function(_0x23e1e8,_0x16dccf){return _0x23e1e8[_0x5afe('0x9')](_0x5afe('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e181f,_0x4400b1,_0x4db4a){if(_0x3e181f['changed'](_0x5afe('0xb'))){_0x3e181f[_0x5afe('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3e181f['changed'](_0x5afe('0xd'))){_0x3e181f[_0x5afe('0xe')]=moment()[_0x5afe('0xf')](_0x5afe('0x10'));}_0x4db4a(null,_0x3e181f);}}});}; \ No newline at end of file +var _0x1ff9=['changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x32d57c,_0x4b33d9){var _0xb3fdf8=function(_0x5f162f){while(--_0x5f162f){_0x32d57c['push'](_0x32d57c['shift']());}};_0xb3fdf8(++_0x4b33d9);}(_0x1ff9,0x192));var _0x91ff=function(_0x51308d,_0x42cf02){_0x51308d=_0x51308d-0x0;var _0x37cde8=_0x1ff9[_0x51308d];return _0x37cde8;};'use strict';var _=require(_0x91ff('0x0'));var util=require(_0x91ff('0x1'));var logger=require(_0x91ff('0x2'))(_0x91ff('0x3'));var moment=require('moment');var BPromise=require(_0x91ff('0x4'));var rp=require(_0x91ff('0x5'));var fs=require('fs');var path=require(_0x91ff('0x6'));var rimraf=require(_0x91ff('0x7'));var config=require(_0x91ff('0x8'));var attributes=require(_0x91ff('0x9'));module[_0x91ff('0xa')]=function(_0x4910ad,_0x13fa13){return _0x4910ad[_0x91ff('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a05ad,_0x25d97e,_0x1fa619){if(_0x5a05ad[_0x91ff('0xc')](_0x91ff('0xd'))){_0x5a05ad[_0x91ff('0xe')]=moment()[_0x91ff('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5a05ad[_0x91ff('0xc')](_0x91ff('0x10'))){_0x5a05ad['publishedAt']=moment()[_0x91ff('0xf')](_0x91ff('0x11'));}_0x1fa619(null,_0x5a05ad);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 18864a2..8004199 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 _0x3ad5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','lodash'];(function(_0x4a363f,_0x36480a){var _0x391de0=function(_0x55a220){while(--_0x55a220){_0x4a363f['push'](_0x4a363f['shift']());}};_0x391de0(++_0x36480a);}(_0x3ad5,0xe9));var _0x53ad=function(_0x10b0b9,_0x41adbc){_0x10b0b9=_0x10b0b9-0x0;var _0x398df6=_0x3ad5[_0x10b0b9];return _0x398df6;};'use strict';var _=require(_0x53ad('0x0'));var util=require('util');var moment=require(_0x53ad('0x1'));var BPromise=require(_0x53ad('0x2'));var rs=require(_0x53ad('0x3'));var fs=require('fs');var Redis=require(_0x53ad('0x4'));var db=require(_0x53ad('0x5'))['db'];var utils=require(_0x53ad('0x6'));var logger=require(_0x53ad('0x7'))(_0x53ad('0x8'));var config=require(_0x53ad('0x9'));var jayson=require(_0x53ad('0xa'));var client=jayson['client'][_0x53ad('0xb')]({'port':0x232a});config[_0x53ad('0xc')]=_[_0x53ad('0xd')](config[_0x53ad('0xc')],{'host':_0x53ad('0xe'),'port':0x18eb});var socket=require(_0x53ad('0xf'))(new Redis(config[_0x53ad('0xc')]));require(_0x53ad('0x10'))['register'](socket);function respondWithRpcPromise(_0x450798,_0x1e0e95,_0x190d42){return new BPromise(function(_0xb8f62c,_0x44b4d5){return client['request'](_0x450798,_0x190d42)['then'](function(_0x40fc29){logger['info'](_0x53ad('0x11'),_0x1e0e95,_0x53ad('0x12'));logger[_0x53ad('0x13')](_0x53ad('0x14'),_0x1e0e95,_0x53ad('0x12'),JSON[_0x53ad('0x15')](_0x40fc29));if(_0x40fc29[_0x53ad('0x16')]){if(_0x40fc29['error'][_0x53ad('0x17')]===0x1f4){logger[_0x53ad('0x16')](_0x53ad('0x11'),_0x1e0e95,_0x40fc29[_0x53ad('0x16')][_0x53ad('0x18')]);return _0x44b4d5(_0x40fc29[_0x53ad('0x16')][_0x53ad('0x18')]);}logger[_0x53ad('0x16')](_0x53ad('0x11'),_0x1e0e95,_0x40fc29[_0x53ad('0x16')][_0x53ad('0x18')]);return _0xb8f62c(_0x40fc29[_0x53ad('0x16')][_0x53ad('0x18')]);}else{logger[_0x53ad('0x19')]('SquareProject,\x20%s,\x20%s',_0x1e0e95,_0x53ad('0x12'));_0xb8f62c(_0x40fc29[_0x53ad('0x1a')][_0x53ad('0x18')]);}})[_0x53ad('0x1b')](function(_0x3a2d81){logger['error']('SquareProject,\x20%s,\x20%s',_0x1e0e95,_0x3a2d81);_0x44b4d5(_0x3a2d81);});});}exports[_0x53ad('0x1c')]=function(_0x5285ff){var _0x5532e0=this;return new Promise(function(_0xa1920c,_0x2c2881){return db[_0x53ad('0x1d')][_0x53ad('0x1e')]({'raw':_0x5285ff[_0x53ad('0x1f')]?_0x5285ff[_0x53ad('0x1f')][_0x53ad('0x20')]===undefined?!![]:![]:!![],'where':_0x5285ff[_0x53ad('0x1f')]?_0x5285ff[_0x53ad('0x1f')][_0x53ad('0x21')]||null:null,'attributes':_0x5285ff[_0x53ad('0x1f')]?_0x5285ff['options'][_0x53ad('0x22')]||null:null,'include':_0x5285ff[_0x53ad('0x1f')]?_0x5285ff[_0x53ad('0x1f')][_0x53ad('0x23')]?_[_0x53ad('0x24')](_0x5285ff['options'][_0x53ad('0x23')],function(_0x231f2c){return{'model':db[_0x231f2c[_0x53ad('0x25')]],'as':_0x231f2c['as'],'attributes':_0x231f2c[_0x53ad('0x22')],'include':_0x231f2c['include']?_['map'](_0x231f2c[_0x53ad('0x23')],function(_0x156dba){return{'model':db[_0x156dba[_0x53ad('0x25')]],'as':_0x156dba['as'],'attributes':_0x156dba[_0x53ad('0x22')],'include':_0x156dba[_0x53ad('0x23')]?_['map'](_0x156dba[_0x53ad('0x23')],function(_0x43824c){return{'model':db[_0x43824c[_0x53ad('0x25')]],'as':_0x43824c['as'],'attributes':_0x43824c[_0x53ad('0x22')]};}):[]};}):[]};}):[]:[]})[_0x53ad('0x26')](function(_0x54b6be){logger[_0x53ad('0x19')](_0x53ad('0x1c'),_0x5285ff);logger['debug'](_0x53ad('0x1c'),_0x5285ff,JSON[_0x53ad('0x15')](_0x54b6be));_0xa1920c(_0x54b6be);})[_0x53ad('0x1b')](function(_0x229373){logger[_0x53ad('0x16')](_0x53ad('0x1c'),_0x229373[_0x53ad('0x18')],_0x5285ff);_0x2c2881(_0x5532e0[_0x53ad('0x16')](0x1f4,_0x229373['message']));});});}; \ No newline at end of file +var _0x20de=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','ioredis'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0x20de,0x151));var _0xe20d=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x20de[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xe20d('0x0'));var util=require(_0xe20d('0x1'));var moment=require(_0xe20d('0x2'));var BPromise=require(_0xe20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20d('0x4'));var db=require(_0xe20d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe20d('0x6'))(_0xe20d('0x7'));var config=require(_0xe20d('0x8'));var jayson=require(_0xe20d('0x9'));var client=jayson[_0xe20d('0xa')][_0xe20d('0xb')]({'port':0x232a});config[_0xe20d('0xc')]=_[_0xe20d('0xd')](config[_0xe20d('0xc')],{'host':_0xe20d('0xe'),'port':0x18eb});var socket=require(_0xe20d('0xf'))(new Redis(config[_0xe20d('0xc')]));require(_0xe20d('0x10'))[_0xe20d('0x11')](socket);function respondWithRpcPromise(_0x9cfe21,_0x6b8337,_0x329048){return new BPromise(function(_0x2366bd,_0x116cce){return client['request'](_0x9cfe21,_0x329048)[_0xe20d('0x12')](function(_0x541771){logger[_0xe20d('0x13')]('SquareProject,\x20%s,\x20%s',_0x6b8337,_0xe20d('0x14'));logger[_0xe20d('0x15')](_0xe20d('0x16'),_0x6b8337,_0xe20d('0x14'),JSON[_0xe20d('0x17')](_0x541771));if(_0x541771[_0xe20d('0x18')]){if(_0x541771[_0xe20d('0x18')]['code']===0x1f4){logger['error'](_0xe20d('0x19'),_0x6b8337,_0x541771[_0xe20d('0x18')][_0xe20d('0x1a')]);return _0x116cce(_0x541771['error'][_0xe20d('0x1a')]);}logger[_0xe20d('0x18')](_0xe20d('0x19'),_0x6b8337,_0x541771[_0xe20d('0x18')][_0xe20d('0x1a')]);return _0x2366bd(_0x541771[_0xe20d('0x18')][_0xe20d('0x1a')]);}else{logger[_0xe20d('0x13')](_0xe20d('0x19'),_0x6b8337,_0xe20d('0x14'));_0x2366bd(_0x541771['result'][_0xe20d('0x1a')]);}})[_0xe20d('0x1b')](function(_0x5c1cea){logger[_0xe20d('0x18')]('SquareProject,\x20%s,\x20%s',_0x6b8337,_0x5c1cea);_0x116cce(_0x5c1cea);});});}exports[_0xe20d('0x1c')]=function(_0x3e73b2){var _0x4694a9=this;return new Promise(function(_0x14b3e4,_0xeaa78e){return db[_0xe20d('0x1d')][_0xe20d('0x1e')]({'raw':_0x3e73b2[_0xe20d('0x1f')]?_0x3e73b2['options'][_0xe20d('0x20')]===undefined?!![]:![]:!![],'where':_0x3e73b2[_0xe20d('0x1f')]?_0x3e73b2[_0xe20d('0x1f')][_0xe20d('0x21')]||null:null,'attributes':_0x3e73b2[_0xe20d('0x1f')]?_0x3e73b2[_0xe20d('0x1f')][_0xe20d('0x22')]||null:null,'include':_0x3e73b2[_0xe20d('0x1f')]?_0x3e73b2[_0xe20d('0x1f')]['include']?_[_0xe20d('0x23')](_0x3e73b2[_0xe20d('0x1f')][_0xe20d('0x24')],function(_0x536c29){return{'model':db[_0x536c29[_0xe20d('0x25')]],'as':_0x536c29['as'],'attributes':_0x536c29[_0xe20d('0x22')],'include':_0x536c29['include']?_[_0xe20d('0x23')](_0x536c29[_0xe20d('0x24')],function(_0x2bfe8b){return{'model':db[_0x2bfe8b[_0xe20d('0x25')]],'as':_0x2bfe8b['as'],'attributes':_0x2bfe8b[_0xe20d('0x22')],'include':_0x2bfe8b[_0xe20d('0x24')]?_[_0xe20d('0x23')](_0x2bfe8b[_0xe20d('0x24')],function(_0x4ca87b){return{'model':db[_0x4ca87b['model']],'as':_0x4ca87b['as'],'attributes':_0x4ca87b[_0xe20d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe20d('0x12')](function(_0x54bb86){logger['info'](_0xe20d('0x1c'),_0x3e73b2);logger[_0xe20d('0x15')]('ShowSquareProject',_0x3e73b2,JSON[_0xe20d('0x17')](_0x54bb86));_0x14b3e4(_0x54bb86);})[_0xe20d('0x1b')](function(_0x408934){logger[_0xe20d('0x18')](_0xe20d('0x1c'),_0x408934['message'],_0x3e73b2);_0xeaa78e(_0x4694a9['error'](0x1f4,_0x408934[_0xe20d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 59791f0..8408093 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 _0x0ad1=['length','squareProject:','./squareProject.events','save','update','emit','register'];(function(_0x41aac8,_0x22e0ac){var _0x52bd10=function(_0x3fa915){while(--_0x3fa915){_0x41aac8['push'](_0x41aac8['shift']());}};_0x52bd10(++_0x22e0ac);}(_0x0ad1,0xcd));var _0x10ad=function(_0x5f5512,_0x4e17fe){_0x5f5512=_0x5f5512-0x0;var _0x11a869=_0x0ad1[_0x5f5512];return _0x11a869;};'use strict';var SquareProjectEvents=require(_0x10ad('0x0'));var events=[_0x10ad('0x1'),'remove',_0x10ad('0x2')];function createListener(_0x1395d7,_0x50de1e){return function(_0x34e8ba){_0x50de1e[_0x10ad('0x3')](_0x1395d7,_0x34e8ba);};}function removeListener(_0x2bc681,_0x2aff62){return function(){SquareProjectEvents['removeListener'](_0x2bc681,_0x2aff62);};}exports[_0x10ad('0x4')]=function(_0x46bda8){for(var _0x42e373=0x0,_0x302223=events[_0x10ad('0x5')];_0x42e373<_0x302223;_0x42e373++){var _0x5a8fa1=events[_0x42e373];var _0x256ebb=createListener(_0x10ad('0x6')+_0x5a8fa1,_0x46bda8);SquareProjectEvents['on'](_0x5a8fa1,_0x256ebb);}}; \ No newline at end of file +var _0xb952=['length','squareProject:','./squareProject.events','save','emit','register'];(function(_0x3563d5,_0xaba01f){var _0x2fc31f=function(_0x3bb66e){while(--_0x3bb66e){_0x3563d5['push'](_0x3563d5['shift']());}};_0x2fc31f(++_0xaba01f);}(_0xb952,0x1a0));var _0x2b95=function(_0x3d6454,_0x3a1897){_0x3d6454=_0x3d6454-0x0;var _0x5317f2=_0xb952[_0x3d6454];return _0x5317f2;};'use strict';var SquareProjectEvents=require(_0x2b95('0x0'));var events=[_0x2b95('0x1'),'remove','update'];function createListener(_0x16fa4b,_0xdbe00f){return function(_0x449be4){_0xdbe00f[_0x2b95('0x2')](_0x16fa4b,_0x449be4);};}function removeListener(_0x5b510c,_0x144d85){return function(){SquareProjectEvents['removeListener'](_0x5b510c,_0x144d85);};}exports[_0x2b95('0x3')]=function(_0x4b5231){for(var _0x291633=0x0,_0x11c31a=events[_0x2b95('0x4')];_0x291633<_0x11c31a;_0x291633++){var _0x2747fc=events[_0x291633];var _0xa551ff=createListener(_0x2b95('0x5')+_0x2747fc,_0x4b5231);SquareProjectEvents['on'](_0x2747fc,_0xa551ff);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2373eb8..b831bfb 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x2d04ff,_0xc310b7){var _0x19b9ec=function(_0x2b9fe6){while(--_0x2b9fe6){_0x2d04ff['push'](_0x2d04ff['shift']());}};_0x19b9ec(++_0xc310b7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x46177e,_0x113b81){var _0x6fe960=function(_0x1edc83){while(--_0x1edc83){_0x46177e['push'](_0x46177e['shift']());}};_0x6fe960(++_0x113b81);}(_0xe14b,0x93));var _0xbe14=function(_0x574460,_0x200d62){_0x574460=_0x574460-0x0;var _0x5707a1=_0xe14b[_0x574460];return _0x5707a1;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 2c54597..11bd53f 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 _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x1a1873,_0x4b2540){var _0x4c2908=function(_0x8fb6e7){while(--_0x8fb6e7){_0x1a1873['push'](_0x1a1873['shift']());}};_0x4c2908(++_0x4b2540);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file +var _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x4c099b,_0x5a5710){var _0x562c2b=function(_0xca6403){while(--_0xca6403){_0x4c099b['push'](_0x4c099b['shift']());}};_0x562c2b(++_0x5a5710);}(_0xe14b,0x93));var _0xbe14=function(_0x1ccda6,_0x554407){_0x1ccda6=_0x1ccda6-0x0;var _0xccf550=_0xe14b[_0x1ccda6];return _0xccf550;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4aa40bc..42d17f1 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 _0x0be5=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map','VIRTUAL','SquareRecording','includeAll','findAll','show','params','include','find','catch','create','body','download','uniqueid','savePath','filename','format','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','send','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','count','set','apply','reject','save','update','then','error','name','index'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0be5,0x183));var _0x50be=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x0be5[_0x879e31];return _0x3467e8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x50be('0x0'));var jsonpatch=require(_0x50be('0x1'));var rp=require(_0x50be('0x2'));var moment=require(_0x50be('0x3'));var BPromise=require(_0x50be('0x4'));var Mustache=require(_0x50be('0x5'));var util=require(_0x50be('0x6'));var path=require(_0x50be('0x7'));var sox=require('sox');var csv=require(_0x50be('0x8'));var ejs=require(_0x50be('0x9'));var fs=require('fs');var fs_extra=require(_0x50be('0xa'));var _=require(_0x50be('0xb'));var squel=require(_0x50be('0xc'));var crypto=require('crypto');var jsforce=require(_0x50be('0xd'));var deskjs=require(_0x50be('0xe'));var toCsv=require(_0x50be('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x50be('0xf'));var qs=require(_0x50be('0x10'));var as=require(_0x50be('0x11'));var hardwareService=require(_0x50be('0x12'));var logger=require(_0x50be('0x13'))(_0x50be('0x14'));var utils=require(_0x50be('0x15'));var config=require(_0x50be('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb54e,_0x2b49bb){_0x2b49bb=_0x2b49bb||0xcc;return function(_0x2b49c4){if(_0x2b49c4){return _0x5eb54e['sendStatus'](_0x2b49bb);}return _0x5eb54e[_0x50be('0x17')](_0x2b49bb)[_0x50be('0x18')]();};}function respondWithResult(_0x5b6cda,_0x42a1cf){_0x42a1cf=_0x42a1cf||0xc8;return function(_0x4e0127){if(_0x4e0127){return _0x5b6cda[_0x50be('0x17')](_0x42a1cf)[_0x50be('0x19')](_0x4e0127);}};}function respondWithFilteredResult(_0x11b319,_0x4aaee8){return function(_0x499f18){if(_0x499f18){var _0x180087=typeof _0x4aaee8[_0x50be('0x1a')]==='undefined'&&typeof _0x4aaee8[_0x50be('0x1b')]==='undefined';var _0x927d7=_0x499f18[_0x50be('0x1c')];var _0x18a203=_0x180087?0x0:_0x4aaee8[_0x50be('0x1a')];var _0x49ca09=_0x180087?_0x499f18[_0x50be('0x1c')]:_0x4aaee8[_0x50be('0x1a')]+_0x4aaee8[_0x50be('0x1b')];var _0x3d6453;if(_0x49ca09>=_0x927d7){_0x49ca09=_0x927d7;_0x3d6453=0xc8;}else{_0x3d6453=0xce;}_0x11b319[_0x50be('0x17')](_0x3d6453);return _0x11b319[_0x50be('0x1d')]('Content-Range',_0x18a203+'-'+_0x49ca09+'/'+_0x927d7)['json'](_0x499f18);}return null;};}function patchUpdates(_0x2ac621){return function(_0x33b5e5){try{jsonpatch[_0x50be('0x1e')](_0x33b5e5,_0x2ac621,!![]);}catch(_0x27c785){return BPromise[_0x50be('0x1f')](_0x27c785);}return _0x33b5e5[_0x50be('0x20')]();};}function saveUpdates(_0x1e40b3,_0x5075d0){return function(_0x4b433a){if(_0x4b433a){return _0x4b433a[_0x50be('0x21')](_0x1e40b3)[_0x50be('0x22')](function(_0x4a15bf){return _0x4a15bf;});}return null;};}function removeEntity(_0x202971,_0x2a8134){return function(_0x43f73f){if(_0x43f73f){return _0x43f73f['destroy']()[_0x50be('0x22')](function(){_0x202971[_0x50be('0x17')](0xcc)[_0x50be('0x18')]();});}};}function handleEntityNotFound(_0x4dc87a,_0x13e889){return function(_0xe7897a){if(!_0xe7897a){_0x4dc87a['sendStatus'](0x194);}return _0xe7897a;};}function handleError(_0x17fa2c,_0x1fa49c){_0x1fa49c=_0x1fa49c||0x1f4;return function(_0x49dc04){logger[_0x50be('0x23')](_0x49dc04['stack']);if(_0x49dc04[_0x50be('0x24')]){delete _0x49dc04[_0x50be('0x24')];}_0x17fa2c[_0x50be('0x17')](_0x1fa49c)['send'](_0x49dc04);};}exports[_0x50be('0x25')]=function(_0x12062e,_0x98f96e){var _0x631898={},_0x29837a={},_0x391092={'count':0x0,'rows':[]};var _0x494ff2=_['map'](db['SquareRecording'][_0x50be('0x26')],function(_0x171723){return{'name':_0x171723['fieldName'],'type':_0x171723[_0x50be('0x27')][_0x50be('0x28')]};});_0x29837a[_0x50be('0x29')]=_['map'](_0x494ff2,_0x50be('0x24'));_0x29837a[_0x50be('0x2a')]=_[_0x50be('0x2b')](_0x12062e[_0x50be('0x2a')]);_0x29837a[_0x50be('0x2c')]=_[_0x50be('0x2d')](_0x29837a[_0x50be('0x29')],_0x29837a[_0x50be('0x2a')]);_0x631898[_0x50be('0x2e')]=_[_0x50be('0x2d')](_0x29837a[_0x50be('0x29')],qs[_0x50be('0x2f')](_0x12062e[_0x50be('0x2a')][_0x50be('0x2f')]));_0x631898[_0x50be('0x2e')]=_0x631898[_0x50be('0x2e')][_0x50be('0x30')]?_0x631898[_0x50be('0x2e')]:_0x29837a[_0x50be('0x29')];if(!_0x12062e[_0x50be('0x2a')]['hasOwnProperty']('nolimit')){_0x631898['limit']=qs[_0x50be('0x1b')](_0x12062e[_0x50be('0x2a')][_0x50be('0x1b')]);_0x631898[_0x50be('0x1a')]=qs[_0x50be('0x1a')](_0x12062e[_0x50be('0x2a')][_0x50be('0x1a')]);}_0x631898[_0x50be('0x31')]=qs[_0x50be('0x32')](_0x12062e['query']['sort']);_0x631898[_0x50be('0x33')]=qs['filters'](_[_0x50be('0x34')](_0x12062e[_0x50be('0x2a')],_0x29837a[_0x50be('0x2c')]),_0x494ff2);if(_0x12062e['query'][_0x50be('0x35')]){_0x631898[_0x50be('0x33')]=_[_0x50be('0x36')](_0x631898[_0x50be('0x33')],{'$or':_[_0x50be('0x37')](_0x494ff2,function(_0x305a82){if(_0x305a82[_0x50be('0x27')]!==_0x50be('0x38')){var _0x5112a4={};_0x5112a4[_0x305a82[_0x50be('0x24')]]={'$like':'%'+_0x12062e[_0x50be('0x2a')]['filter']+'%'};return _0x5112a4;}})});}_0x631898=_[_0x50be('0x36')]({},_0x631898,_0x12062e['options']);var _0x3d0290={'where':_0x631898[_0x50be('0x33')]};return db[_0x50be('0x39')][_0x50be('0x1c')](_0x3d0290)[_0x50be('0x22')](function(_0x490cb1){_0x391092[_0x50be('0x1c')]=_0x490cb1;if(_0x12062e[_0x50be('0x2a')][_0x50be('0x3a')]){_0x631898['include']=[{'all':!![]}];}return db['SquareRecording'][_0x50be('0x3b')](_0x631898);})[_0x50be('0x22')](function(_0x36d334){_0x391092['rows']=_0x36d334;return _0x391092;})[_0x50be('0x22')](respondWithFilteredResult(_0x98f96e,_0x631898))['catch'](handleError(_0x98f96e,null));};exports[_0x50be('0x3c')]=function(_0x572ac7,_0x2a5e63){var _0x3bf146={'raw':!![],'where':{'id':_0x572ac7[_0x50be('0x3d')]['id']}},_0x376fc0={};_0x376fc0['model']=_[_0x50be('0x2b')](db[_0x50be('0x39')][_0x50be('0x26')]);_0x376fc0[_0x50be('0x2a')]=_[_0x50be('0x2b')](_0x572ac7[_0x50be('0x2a')]);_0x376fc0['filters']=_[_0x50be('0x2d')](_0x376fc0['model'],_0x376fc0[_0x50be('0x2a')]);_0x3bf146['attributes']=_['intersection'](_0x376fc0[_0x50be('0x29')],qs[_0x50be('0x2f')](_0x572ac7[_0x50be('0x2a')]['fields']));_0x3bf146[_0x50be('0x2e')]=_0x3bf146[_0x50be('0x2e')]['length']?_0x3bf146[_0x50be('0x2e')]:_0x376fc0[_0x50be('0x29')];if(_0x572ac7[_0x50be('0x2a')]['includeAll']){_0x3bf146[_0x50be('0x3e')]=[{'all':!![]}];}_0x3bf146=_[_0x50be('0x36')]({},_0x3bf146,_0x572ac7['options']);return db['SquareRecording'][_0x50be('0x3f')](_0x3bf146)[_0x50be('0x22')](handleEntityNotFound(_0x2a5e63,null))[_0x50be('0x22')](respondWithResult(_0x2a5e63,null))[_0x50be('0x40')](handleError(_0x2a5e63,null));};exports[_0x50be('0x41')]=function(_0x37b171,_0x5e286c){return db[_0x50be('0x39')]['create'](_0x37b171[_0x50be('0x42')],{})[_0x50be('0x22')](respondWithResult(_0x5e286c,0xc9))['catch'](handleError(_0x5e286c,null));};exports['update']=function(_0x4365af,_0x14c8a7){if(_0x4365af[_0x50be('0x42')]['id']){delete _0x4365af[_0x50be('0x42')]['id'];}return db['SquareRecording'][_0x50be('0x3f')]({'where':{'id':_0x4365af[_0x50be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x14c8a7,null))[_0x50be('0x22')](saveUpdates(_0x4365af[_0x50be('0x42')],null))['then'](respondWithResult(_0x14c8a7,null))[_0x50be('0x40')](handleError(_0x14c8a7,null));};exports[_0x50be('0x43')]=function(_0x2d8896,_0xf60356,_0x5bc106){var _0x3ab892=require('../../components/encryptor');var _0x238d08=![];var _0x1d87f3={};if(_0x2d8896[_0x50be('0x2a')][_0x50be('0x27')]&&_0x2d8896[_0x50be('0x2a')][_0x50be('0x27')]===_0x50be('0x44')){_0x1d87f3['uniqueid']=_0x2d8896['params']['id'];}else{_0x1d87f3['id']=_0x2d8896['params']['id'];}return db[_0x50be('0x39')][_0x50be('0x3f')]({'where':_0x1d87f3,'attributes':['id',_0x50be('0x45'),_0x50be('0x46')],'raw':!![]})[_0x50be('0x22')](handleEntityNotFound(_0xf60356,null))['then'](function(_0x539c0d){if(_0x539c0d){var _0x580b81=_0x539c0d[_0x50be('0x45')];var _0x147f0a=util[_0x50be('0x47')]('%s.cypher',_0x580b81);if(fs[_0x50be('0x48')](_0x147f0a)){_0x238d08=!![];return _0x3ab892['decryptFile'](_0x147f0a,_0x580b81,config['secrets']['recording'])['then'](function(){return _0x539c0d;});}return _0x539c0d;}})['then'](function(_0x297b99){if(_0x297b99){var _0xeebb66=_0x297b99[_0x50be('0x45')];if(!fs[_0x50be('0x48')](_0xeebb66)){throw new db[(_0x50be('0x49'))][(_0x50be('0x4a'))](_0x50be('0x4b'));}if(_0x297b99[_0x50be('0x46')]){return _0xf60356['download'](_0xeebb66,_0x297b99[_0x50be('0x46')]+path['extname'](_0xeebb66),function(){if(_0x238d08){fs[_0x50be('0x4c')](_0xeebb66);}});}else{return _0xf60356[_0x50be('0x43')](_0xeebb66,function(_0x3a98e5){if(_0x238d08){fs['unlink'](_0xeebb66);}});}}})[_0x50be('0x40')](function(_0x2ab537){if(_0x2ab537['message']===_0x50be('0x4b')){_0xf60356[_0x50be('0x17')](0x194)[_0x50be('0x4d')]('Not\x20found');}else{return handleError(_0xf60356,null);}});};exports['destroy']=function(_0xc112fd,_0x50f301){return db['SquareRecording'][_0x50be('0x3f')]({'where':{'id':_0xc112fd[_0x50be('0x3d')]['id']}})[_0x50be('0x22')](function(_0x443d95){if(_['isNil'](_0x443d95)){throw new ReferenceError(_0x50be('0x4e'));}return _0x443d95;})[_0x50be('0x22')](function(_0x448aaa){var _0x543c98=_0x448aaa['savePath'];logger['info'](_0x50be('0x4f'),_0x543c98);if(!_[_0x50be('0x50')](_0x448aaa['savePath'])&&fs[_0x50be('0x48')](_0x543c98)){logger[_0x50be('0x51')](_0x50be('0x52')+_0x543c98+_0x50be('0x53'));fs['unlinkSync'](_0x543c98);}_0x543c98=_0x543c98+'.cypher';if(!_['isNil'](_0x448aaa[_0x50be('0x45')])&&fs['existsSync'](_0x543c98)){logger['info'](_0x50be('0x52')+_0x543c98+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x50be('0x54')](_0x543c98);}return _0x448aaa;})[_0x50be('0x22')](function(_0x57808f){if(!_0x57808f)throw new InternalError();return _0x57808f['destroy']();})[_0x50be('0x22')](function(){_0x50f301[_0x50be('0x17')](0xcc)[_0x50be('0x18')]();})[_0x50be('0x40')](handleError(_0x50f301,null));}; \ No newline at end of file +var _0xa208=['uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','length','catch','create','body','find','params','download','../../components/encryptor'];(function(_0x57cc49,_0x44ab4b){var _0x5dc398=function(_0x22c9ea){while(--_0x22c9ea){_0x57cc49['push'](_0x57cc49['shift']());}};_0x5dc398(++_0x44ab4b);}(_0xa208,0xd8));var _0x8a20=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa208[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x8a20('0x0'));var rimraf=require(_0x8a20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a20('0x2'));var rp=require(_0x8a20('0x3'));var moment=require('moment');var BPromise=require(_0x8a20('0x4'));var Mustache=require(_0x8a20('0x5'));var util=require(_0x8a20('0x6'));var path=require('path');var sox=require(_0x8a20('0x7'));var csv=require(_0x8a20('0x8'));var ejs=require(_0x8a20('0x9'));var fs=require('fs');var fs_extra=require(_0x8a20('0xa'));var _=require('lodash');var squel=require(_0x8a20('0xb'));var crypto=require(_0x8a20('0xc'));var jsforce=require(_0x8a20('0xd'));var deskjs=require(_0x8a20('0xe'));var toCsv=require(_0x8a20('0x8'));var querystring=require(_0x8a20('0xf'));var Papa=require(_0x8a20('0x10'));var Redis=require(_0x8a20('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8a20('0x12'));var as=require(_0x8a20('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8a20('0x14'));var config=require(_0x8a20('0x15'));var licenseUtil=require(_0x8a20('0x16'));var db=require(_0x8a20('0x17'))['db'];function respondWithStatusCode(_0x23465f,_0x26fd70){_0x26fd70=_0x26fd70||0xcc;return function(_0x430ec3){if(_0x430ec3){return _0x23465f[_0x8a20('0x18')](_0x26fd70);}return _0x23465f[_0x8a20('0x19')](_0x26fd70)[_0x8a20('0x1a')]();};}function respondWithResult(_0x54bc62,_0x5e7587){_0x5e7587=_0x5e7587||0xc8;return function(_0x125164){if(_0x125164){return _0x54bc62[_0x8a20('0x19')](_0x5e7587)[_0x8a20('0x1b')](_0x125164);}};}function respondWithFilteredResult(_0x29fbb0,_0x231e0d){return function(_0x1e6985){if(_0x1e6985){var _0x51fac3=typeof _0x231e0d[_0x8a20('0x1c')]==='undefined'&&typeof _0x231e0d[_0x8a20('0x1d')]===_0x8a20('0x1e');var _0x3a6b1b=_0x1e6985['count'];var _0x3be66d=_0x51fac3?0x0:_0x231e0d[_0x8a20('0x1c')];var _0x5784e6=_0x51fac3?_0x1e6985[_0x8a20('0x1f')]:_0x231e0d['offset']+_0x231e0d['limit'];var _0xb25623;if(_0x5784e6>=_0x3a6b1b){_0x5784e6=_0x3a6b1b;_0xb25623=0xc8;}else{_0xb25623=0xce;}_0x29fbb0[_0x8a20('0x19')](_0xb25623);return _0x29fbb0[_0x8a20('0x20')](_0x8a20('0x21'),_0x3be66d+'-'+_0x5784e6+'/'+_0x3a6b1b)[_0x8a20('0x1b')](_0x1e6985);}return null;};}function patchUpdates(_0x697853){return function(_0x2dfb4d){try{jsonpatch[_0x8a20('0x22')](_0x2dfb4d,_0x697853,!![]);}catch(_0x18395a){return BPromise[_0x8a20('0x23')](_0x18395a);}return _0x2dfb4d[_0x8a20('0x24')]();};}function saveUpdates(_0x93d0dc,_0x5e22f2){return function(_0x153a84){if(_0x153a84){return _0x153a84[_0x8a20('0x25')](_0x93d0dc)[_0x8a20('0x26')](function(_0x356353){return _0x356353;});}return null;};}function removeEntity(_0x16ab2e,_0x41c18f){return function(_0x3778bc){if(_0x3778bc){return _0x3778bc[_0x8a20('0x27')]()[_0x8a20('0x26')](function(){_0x16ab2e[_0x8a20('0x19')](0xcc)[_0x8a20('0x1a')]();});}};}function handleEntityNotFound(_0x141729,_0x139faf){return function(_0xe0958f){if(!_0xe0958f){_0x141729[_0x8a20('0x18')](0x194);}return _0xe0958f;};}function handleError(_0x132d69,_0xec16a8){_0xec16a8=_0xec16a8||0x1f4;return function(_0x342bcb){logger['error'](_0x342bcb[_0x8a20('0x28')]);if(_0x342bcb[_0x8a20('0x29')]){delete _0x342bcb[_0x8a20('0x29')];}_0x132d69[_0x8a20('0x19')](_0xec16a8)[_0x8a20('0x2a')](_0x342bcb);};}exports[_0x8a20('0x2b')]=function(_0x272564,_0x49f558){var _0x8c8f23={},_0x4ee86c={},_0xc3261b={'count':0x0,'rows':[]};var _0x2864f0=_['map'](db[_0x8a20('0x2c')][_0x8a20('0x2d')],function(_0x4f032d){return{'name':_0x4f032d[_0x8a20('0x2e')],'type':_0x4f032d[_0x8a20('0x2f')][_0x8a20('0x30')]};});_0x4ee86c[_0x8a20('0x31')]=_[_0x8a20('0x32')](_0x2864f0,_0x8a20('0x29'));_0x4ee86c[_0x8a20('0x33')]=_[_0x8a20('0x34')](_0x272564['query']);_0x4ee86c['filters']=_['intersection'](_0x4ee86c[_0x8a20('0x31')],_0x4ee86c[_0x8a20('0x33')]);_0x8c8f23['attributes']=_[_0x8a20('0x35')](_0x4ee86c[_0x8a20('0x31')],qs[_0x8a20('0x36')](_0x272564[_0x8a20('0x33')]['fields']));_0x8c8f23[_0x8a20('0x37')]=_0x8c8f23[_0x8a20('0x37')]['length']?_0x8c8f23['attributes']:_0x4ee86c['model'];if(!_0x272564[_0x8a20('0x33')][_0x8a20('0x38')](_0x8a20('0x39'))){_0x8c8f23[_0x8a20('0x1d')]=qs['limit'](_0x272564[_0x8a20('0x33')]['limit']);_0x8c8f23['offset']=qs['offset'](_0x272564['query'][_0x8a20('0x1c')]);}_0x8c8f23[_0x8a20('0x3a')]=qs[_0x8a20('0x3b')](_0x272564[_0x8a20('0x33')][_0x8a20('0x3b')]);_0x8c8f23[_0x8a20('0x3c')]=qs[_0x8a20('0x3d')](_[_0x8a20('0x3e')](_0x272564[_0x8a20('0x33')],_0x4ee86c[_0x8a20('0x3d')]),_0x2864f0);if(_0x272564['query'][_0x8a20('0x3f')]){_0x8c8f23[_0x8a20('0x3c')]=_['merge'](_0x8c8f23[_0x8a20('0x3c')],{'$or':_[_0x8a20('0x32')](_0x2864f0,function(_0x17ca86){if(_0x17ca86['type']!==_0x8a20('0x40')){var _0x1803f8={};_0x1803f8[_0x17ca86[_0x8a20('0x29')]]={'$like':'%'+_0x272564[_0x8a20('0x33')]['filter']+'%'};return _0x1803f8;}})});}_0x8c8f23=_[_0x8a20('0x41')]({},_0x8c8f23,_0x272564[_0x8a20('0x42')]);var _0xaeb8e={'where':_0x8c8f23[_0x8a20('0x3c')]};return db[_0x8a20('0x2c')][_0x8a20('0x1f')](_0xaeb8e)[_0x8a20('0x26')](function(_0x126eef){_0xc3261b[_0x8a20('0x1f')]=_0x126eef;if(_0x272564['query'][_0x8a20('0x43')]){_0x8c8f23[_0x8a20('0x44')]=[{'all':!![]}];}return db['SquareRecording'][_0x8a20('0x45')](_0x8c8f23);})[_0x8a20('0x26')](function(_0x33dea7){_0xc3261b['rows']=_0x33dea7;return _0xc3261b;})[_0x8a20('0x26')](respondWithFilteredResult(_0x49f558,_0x8c8f23))['catch'](handleError(_0x49f558,null));};exports['show']=function(_0x41ea03,_0x2f7e90){var _0x1e9b5e={'raw':!![],'where':{'id':_0x41ea03['params']['id']}},_0x3af670={};_0x3af670[_0x8a20('0x31')]=_['keys'](db['SquareRecording'][_0x8a20('0x2d')]);_0x3af670[_0x8a20('0x33')]=_[_0x8a20('0x34')](_0x41ea03[_0x8a20('0x33')]);_0x3af670[_0x8a20('0x3d')]=_[_0x8a20('0x35')](_0x3af670[_0x8a20('0x31')],_0x3af670[_0x8a20('0x33')]);_0x1e9b5e[_0x8a20('0x37')]=_[_0x8a20('0x35')](_0x3af670[_0x8a20('0x31')],qs[_0x8a20('0x36')](_0x41ea03[_0x8a20('0x33')]['fields']));_0x1e9b5e[_0x8a20('0x37')]=_0x1e9b5e[_0x8a20('0x37')][_0x8a20('0x46')]?_0x1e9b5e[_0x8a20('0x37')]:_0x3af670[_0x8a20('0x31')];if(_0x41ea03[_0x8a20('0x33')][_0x8a20('0x43')]){_0x1e9b5e[_0x8a20('0x44')]=[{'all':!![]}];}_0x1e9b5e=_['merge']({},_0x1e9b5e,_0x41ea03['options']);return db[_0x8a20('0x2c')]['find'](_0x1e9b5e)['then'](handleEntityNotFound(_0x2f7e90,null))[_0x8a20('0x26')](respondWithResult(_0x2f7e90,null))[_0x8a20('0x47')](handleError(_0x2f7e90,null));};exports['create']=function(_0x204091,_0x4e4db7){return db[_0x8a20('0x2c')][_0x8a20('0x48')](_0x204091[_0x8a20('0x49')],{})[_0x8a20('0x26')](respondWithResult(_0x4e4db7,0xc9))[_0x8a20('0x47')](handleError(_0x4e4db7,null));};exports['update']=function(_0x38c686,_0x158a5a){if(_0x38c686[_0x8a20('0x49')]['id']){delete _0x38c686[_0x8a20('0x49')]['id'];}return db['SquareRecording'][_0x8a20('0x4a')]({'where':{'id':_0x38c686[_0x8a20('0x4b')]['id']}})['then'](handleEntityNotFound(_0x158a5a,null))[_0x8a20('0x26')](saveUpdates(_0x38c686['body'],null))[_0x8a20('0x26')](respondWithResult(_0x158a5a,null))[_0x8a20('0x47')](handleError(_0x158a5a,null));};exports[_0x8a20('0x4c')]=function(_0x9f3a8,_0x25ab75,_0x56c64e){var _0x5ebae2=require(_0x8a20('0x4d'));var _0x3342d0=![];var _0x16cd3a={};if(_0x9f3a8[_0x8a20('0x33')][_0x8a20('0x2f')]&&_0x9f3a8[_0x8a20('0x33')][_0x8a20('0x2f')]===_0x8a20('0x4e')){_0x16cd3a[_0x8a20('0x4e')]=_0x9f3a8['params']['id'];}else{_0x16cd3a['id']=_0x9f3a8['params']['id'];}return db[_0x8a20('0x2c')][_0x8a20('0x4a')]({'where':_0x16cd3a,'attributes':['id',_0x8a20('0x4f'),_0x8a20('0x50')],'raw':!![]})[_0x8a20('0x26')](handleEntityNotFound(_0x25ab75,null))[_0x8a20('0x26')](function(_0x184c2a){if(_0x184c2a){var _0x244fd9=_0x184c2a[_0x8a20('0x4f')];var _0x1bc8bb=util[_0x8a20('0x51')](_0x8a20('0x52'),_0x244fd9);if(fs[_0x8a20('0x53')](_0x1bc8bb)){_0x3342d0=!![];return _0x5ebae2[_0x8a20('0x54')](_0x1bc8bb,_0x244fd9,config['secrets']['recording'])[_0x8a20('0x26')](function(){return _0x184c2a;});}return _0x184c2a;}})['then'](function(_0x418098){if(_0x418098){var _0x3a3c8f=_0x418098[_0x8a20('0x4f')];if(!fs['existsSync'](_0x3a3c8f)){throw new db['Sequelize']['ValidationError'](_0x8a20('0x55'));}if(_0x418098[_0x8a20('0x50')]){return _0x25ab75[_0x8a20('0x4c')](_0x3a3c8f,_0x418098[_0x8a20('0x50')]+path[_0x8a20('0x56')](_0x3a3c8f),function(){if(_0x3342d0){fs[_0x8a20('0x57')](_0x3a3c8f);}});}else{return _0x25ab75['download'](_0x3a3c8f,function(_0x5627ac){if(_0x3342d0){fs[_0x8a20('0x57')](_0x3a3c8f);}});}}})[_0x8a20('0x47')](function(_0x4f5cf1){if(_0x4f5cf1[_0x8a20('0x58')]===_0x8a20('0x55')){_0x25ab75[_0x8a20('0x19')](0x194)[_0x8a20('0x2a')](_0x8a20('0x59'));}else{return handleError(_0x25ab75,null);}});};exports['destroy']=function(_0x5c059a,_0x3b5f7c){return db['SquareRecording']['find']({'where':{'id':_0x5c059a[_0x8a20('0x4b')]['id']}})[_0x8a20('0x26')](function(_0x56ad2b){if(_[_0x8a20('0x5a')](_0x56ad2b)){throw new ReferenceError(_0x8a20('0x5b'));}return _0x56ad2b;})[_0x8a20('0x26')](function(_0x435808){var _0x45b412=_0x435808[_0x8a20('0x4f')];logger[_0x8a20('0x5c')](_0x8a20('0x5d'),_0x45b412);if(!_['isNil'](_0x435808[_0x8a20('0x4f')])&&fs[_0x8a20('0x53')](_0x45b412)){logger['info'](_0x8a20('0x5e')+_0x45b412+_0x8a20('0x5f'));fs[_0x8a20('0x60')](_0x45b412);}_0x45b412=_0x45b412+_0x8a20('0x61');if(!_[_0x8a20('0x5a')](_0x435808[_0x8a20('0x4f')])&&fs[_0x8a20('0x53')](_0x45b412)){logger[_0x8a20('0x5c')](_0x8a20('0x5e')+_0x45b412+_0x8a20('0x5f'));fs[_0x8a20('0x60')](_0x45b412);}return _0x435808;})[_0x8a20('0x26')](function(_0xec530f){if(!_0xec530f)throw new InternalError();return _0xec530f[_0x8a20('0x27')]();})[_0x8a20('0x26')](function(){_0x3b5f7c[_0x8a20('0x19')](0xcc)[_0x8a20('0x1a')]();})[_0x8a20('0x47')](handleError(_0x3b5f7c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 082df09..aeddc3b 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 _0x3c8e=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x348761,_0x11d8d1){var _0x2c2685=function(_0x2b33d1){while(--_0x2b33d1){_0x348761['push'](_0x348761['shift']());}};_0x2c2685(++_0x11d8d1);}(_0x3c8e,0x89));var _0xe3c8=function(_0x2793da,_0x4c219a){_0x2793da=_0x2793da-0x0;var _0x322c5a=_0x3c8e[_0x2793da];return _0x322c5a;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe3c8('0x2'));var BPromise=require(_0xe3c8('0x3'));var rp=require(_0xe3c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var attributes=require(_0xe3c8('0x7'));module[_0xe3c8('0x8')]=function(_0x4bb874,_0x2a5362){return _0x4bb874[_0xe3c8('0x9')](_0xe3c8('0xa'),attributes,{'tableName':_0xe3c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dc0=['SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','define'];(function(_0x2eafa9,_0x3f015c){var _0x48785e=function(_0x16dfc4){while(--_0x16dfc4){_0x2eafa9['push'](_0x2eafa9['shift']());}};_0x48785e(++_0x3f015c);}(_0x6dc0,0xb6));var _0x06dc=function(_0x8ea1e,_0x34158a){_0x8ea1e=_0x8ea1e-0x0;var _0x1009b9=_0x6dc0[_0x8ea1e];return _0x1009b9;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var logger=require(_0x06dc('0x2'))('api');var moment=require(_0x06dc('0x3'));var BPromise=require(_0x06dc('0x4'));var rp=require(_0x06dc('0x5'));var fs=require('fs');var path=require(_0x06dc('0x6'));var rimraf=require('rimraf');var config=require(_0x06dc('0x7'));var attributes=require(_0x06dc('0x8'));module['exports']=function(_0x2454b0,_0x491195){return _0x2454b0[_0x06dc('0x9')](_0x06dc('0xa'),attributes,{'tableName':_0x06dc('0xb'),'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 7e6a111..61b62ee 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 _0x52e8=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x35fb7c,_0x4ee512){var _0x3b319e=function(_0x381eaa){while(--_0x381eaa){_0x35fb7c['push'](_0x35fb7c['shift']());}};_0x3b319e(++_0x4ee512);}(_0x52e8,0xe5));var _0x852e=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x52e8[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0x852e('0x0'));var util=require(_0x852e('0x1'));var moment=require(_0x852e('0x2'));var BPromise=require(_0x852e('0x3'));var rs=require(_0x852e('0x4'));var fs=require('fs');var Redis=require(_0x852e('0x5'));var db=require(_0x852e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x852e('0x7'))(_0x852e('0x8'));var config=require('../../config/environment');var jayson=require(_0x852e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f81b1,_0x3283c8,_0x1311a6){return new BPromise(function(_0x1c77b7,_0x57d38f){return client[_0x852e('0xa')](_0x3f81b1,_0x1311a6)[_0x852e('0xb')](function(_0x5432e0){logger[_0x852e('0xc')](_0x852e('0xd'),_0x3283c8,_0x852e('0xe'));logger[_0x852e('0xf')](_0x852e('0x10'),_0x3283c8,_0x852e('0xe'),JSON[_0x852e('0x11')](_0x5432e0));if(_0x5432e0['error']){if(_0x5432e0[_0x852e('0x12')]['code']===0x1f4){logger['error'](_0x852e('0xd'),_0x3283c8,_0x5432e0[_0x852e('0x12')]['message']);return _0x57d38f(_0x5432e0[_0x852e('0x12')]['message']);}logger[_0x852e('0x12')](_0x852e('0xd'),_0x3283c8,_0x5432e0[_0x852e('0x12')]['message']);return _0x1c77b7(_0x5432e0['error'][_0x852e('0x13')]);}else{logger[_0x852e('0xc')](_0x852e('0xd'),_0x3283c8,_0x852e('0xe'));_0x1c77b7(_0x5432e0[_0x852e('0x14')][_0x852e('0x13')]);}})[_0x852e('0x15')](function(_0x39b5e2){logger[_0x852e('0x12')](_0x852e('0xd'),_0x3283c8,_0x39b5e2);_0x57d38f(_0x39b5e2);});});}exports[_0x852e('0x16')]=function(_0x364118){var _0x5aee66=this;return new Promise(function(_0x5b4b2e,_0x5c651f){return db[_0x852e('0x17')][_0x852e('0x18')](_0x364118['body'],{'raw':_0x364118[_0x852e('0x19')]?_0x364118[_0x852e('0x19')][_0x852e('0x1a')]===undefined?!![]:![]:!![]})[_0x852e('0xb')](function(_0x6daf97){logger['info']('CreateSquareRecording',_0x364118);logger['debug'](_0x852e('0x16'),_0x364118,JSON[_0x852e('0x11')](_0x6daf97));_0x5b4b2e(_0x6daf97);})[_0x852e('0x15')](function(_0x2c61bd){logger[_0x852e('0x12')](_0x852e('0x16'),_0x2c61bd[_0x852e('0x13')],_0x364118);_0x5c651f(_0x5aee66[_0x852e('0x12')](0x1f4,_0x2c61bd[_0x852e('0x13')]));});});}; \ No newline at end of file +var _0x37e8=['rpc','../../config/environment','jayson/promise','client','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareRecording','SquareRecording','create','options','raw','then','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0xdf7d68,_0x6f13f3){var _0x326e86=function(_0x5a3470){while(--_0x5a3470){_0xdf7d68['push'](_0xdf7d68['shift']());}};_0x326e86(++_0x6f13f3);}(_0x37e8,0xe5));var _0x837e=function(_0x4b43a6,_0x47ac36){_0x4b43a6=_0x4b43a6-0x0;var _0x15fbc6=_0x37e8[_0x4b43a6];return _0x15fbc6;};'use strict';var _=require('lodash');var util=require(_0x837e('0x0'));var moment=require(_0x837e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x837e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x837e('0x3'));var logger=require(_0x837e('0x4'))(_0x837e('0x5'));var config=require(_0x837e('0x6'));var jayson=require(_0x837e('0x7'));var client=jayson[_0x837e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d65c,_0x33db98,_0x1d75e5){return new BPromise(function(_0x3cb57a,_0x4c52d5){return client[_0x837e('0x9')](_0x38d65c,_0x1d75e5)['then'](function(_0x231fa6){logger['info'](_0x837e('0xa'),_0x33db98,_0x837e('0xb'));logger[_0x837e('0xc')](_0x837e('0xd'),_0x33db98,_0x837e('0xb'),JSON[_0x837e('0xe')](_0x231fa6));if(_0x231fa6['error']){if(_0x231fa6[_0x837e('0xf')][_0x837e('0x10')]===0x1f4){logger[_0x837e('0xf')](_0x837e('0xa'),_0x33db98,_0x231fa6[_0x837e('0xf')][_0x837e('0x11')]);return _0x4c52d5(_0x231fa6[_0x837e('0xf')]['message']);}logger[_0x837e('0xf')]('SquareRecording,\x20%s,\x20%s',_0x33db98,_0x231fa6['error'][_0x837e('0x11')]);return _0x3cb57a(_0x231fa6[_0x837e('0xf')][_0x837e('0x11')]);}else{logger[_0x837e('0x12')]('SquareRecording,\x20%s,\x20%s',_0x33db98,_0x837e('0xb'));_0x3cb57a(_0x231fa6['result'][_0x837e('0x11')]);}})[_0x837e('0x13')](function(_0x377d8b){logger[_0x837e('0xf')](_0x837e('0xa'),_0x33db98,_0x377d8b);_0x4c52d5(_0x377d8b);});});}exports[_0x837e('0x14')]=function(_0x15269c){var _0x3a68b3=this;return new Promise(function(_0x2c8617,_0x66fc51){return db[_0x837e('0x15')][_0x837e('0x16')](_0x15269c['body'],{'raw':_0x15269c['options']?_0x15269c[_0x837e('0x17')][_0x837e('0x18')]===undefined?!![]:![]:!![]})[_0x837e('0x19')](function(_0x38823b){logger['info'](_0x837e('0x14'),_0x15269c);logger['debug'](_0x837e('0x14'),_0x15269c,JSON[_0x837e('0xe')](_0x38823b));_0x2c8617(_0x38823b);})[_0x837e('0x13')](function(_0x35dd01){logger[_0x837e('0xf')](_0x837e('0x14'),_0x35dd01[_0x837e('0x11')],_0x15269c);_0x66fc51(_0x3a68b3[_0x837e('0xf')](0x1f4,_0x35dd01[_0x837e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 251069a..245d428 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x290f77,_0x5e7aaf){var _0x42106b=function(_0x21b30a){while(--_0x21b30a){_0x290f77['push'](_0x290f77['shift']());}};_0x42106b(++_0x5e7aaf);}(_0xe706,0xa3));var _0x6e70=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0xe706[_0x4d579b];return _0x288145;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f462750..480dee5 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 _0x898f=['STRING','DATE','sequelize'];(function(_0x198ab3,_0x2c9896){var _0x1906a7=function(_0x48a827){while(--_0x48a827){_0x198ab3['push'](_0x198ab3['shift']());}};_0x1906a7(++_0x2c9896);}(_0x898f,0x1be));var _0xf898=function(_0x25413a,_0x43c868){_0x25413a=_0x25413a-0x0;var _0x26d152=_0x898f[_0x25413a];return _0x26d152;};'use strict';var Sequelize=require(_0xf898('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xf898('0x1')]},'channel':{'type':Sequelize[_0xf898('0x1')]},'language':{'type':Sequelize[_0xf898('0x1')]},'type':{'type':Sequelize[_0xf898('0x1')]},'uniqueid':{'type':Sequelize[_0xf898('0x1')]},'version':{'type':Sequelize[_0xf898('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf898('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf898('0x1')]},'callington':{'type':Sequelize[_0xf898('0x1')]},'callingtns':{'type':Sequelize[_0xf898('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf898('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf898('0x1')]},'priority':{'type':Sequelize[_0xf898('0x1')]},'enhanced':{'type':Sequelize[_0xf898('0x1')]},'accountcode':{'type':Sequelize[_0xf898('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf898('0x1')]},'joinAt':{'type':Sequelize[_0xf898('0x2')]},'leaveAt':{'type':Sequelize[_0xf898('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x188c=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x188c,0xc1));var _0xc188=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x188c[_0x36d203];return _0x2f9e62;};'use strict';var Sequelize=require(_0xc188('0x0'));module[_0xc188('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xc188('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc188('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc188('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xc188('0x2')]},'callerid':{'type':Sequelize[_0xc188('0x2')]},'calleridname':{'type':Sequelize[_0xc188('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc188('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc188('0x2')]},'dnid':{'type':Sequelize[_0xc188('0x2')]},'rdnis':{'type':Sequelize[_0xc188('0x2')]},'context':{'type':Sequelize[_0xc188('0x2')]},'extension':{'type':Sequelize[_0xc188('0x2')]},'priority':{'type':Sequelize[_0xc188('0x2')]},'enhanced':{'type':Sequelize[_0xc188('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xc188('0x2')]},'project_name':{'type':Sequelize[_0xc188('0x2')]},'joinAt':{'type':Sequelize[_0xc188('0x3')]},'leaveAt':{'type':Sequelize[_0xc188('0x3')]},'bot':{'type':Sequelize[_0xc188('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 6070382..e87ddfd 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 _0x10ba=['stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareReport','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x39cc8f,_0xb60cd8){var _0x15e616=function(_0x513d9e){while(--_0x513d9e){_0x39cc8f['push'](_0x39cc8f['shift']());}};_0x15e616(++_0xb60cd8);}(_0x10ba,0xbf));var _0xa10b=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x10ba[_0x114b7c];return _0x47185f;};'use strict';var emlformat=require(_0xa10b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa10b('0x1'));var jsonpatch=require(_0xa10b('0x2'));var rp=require('request-promise');var moment=require(_0xa10b('0x3'));var BPromise=require(_0xa10b('0x4'));var Mustache=require(_0xa10b('0x5'));var util=require(_0xa10b('0x6'));var path=require('path');var sox=require(_0xa10b('0x7'));var csv=require('to-csv');var ejs=require(_0xa10b('0x8'));var fs=require('fs');var fs_extra=require(_0xa10b('0x9'));var _=require(_0xa10b('0xa'));var squel=require(_0xa10b('0xb'));var crypto=require(_0xa10b('0xc'));var jsforce=require(_0xa10b('0xd'));var deskjs=require(_0xa10b('0xe'));var toCsv=require(_0xa10b('0xf'));var querystring=require(_0xa10b('0x10'));var Papa=require(_0xa10b('0x11'));var Redis=require(_0xa10b('0x12'));var authService=require(_0xa10b('0x13'));var qs=require(_0xa10b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa10b('0x15'));var logger=require(_0xa10b('0x16'))(_0xa10b('0x17'));var utils=require('../../config/utils');var config=require(_0xa10b('0x18'));var licenseUtil=require(_0xa10b('0x19'));var db=require(_0xa10b('0x1a'))['db'];function respondWithStatusCode(_0x433c17,_0x3f0ef){_0x3f0ef=_0x3f0ef||0xcc;return function(_0x544dc2){if(_0x544dc2){return _0x433c17[_0xa10b('0x1b')](_0x3f0ef);}return _0x433c17[_0xa10b('0x1c')](_0x3f0ef)[_0xa10b('0x1d')]();};}function respondWithResult(_0x4f1c43,_0x41acc9){_0x41acc9=_0x41acc9||0xc8;return function(_0x3439be){if(_0x3439be){return _0x4f1c43[_0xa10b('0x1c')](_0x41acc9)[_0xa10b('0x1e')](_0x3439be);}};}function respondWithFilteredResult(_0x40d30a,_0x5374d4){return function(_0x3a2d27){if(_0x3a2d27){var _0x29a542=typeof _0x5374d4[_0xa10b('0x1f')]===_0xa10b('0x20')&&typeof _0x5374d4[_0xa10b('0x21')]===_0xa10b('0x20');var _0x34671d=_0x3a2d27[_0xa10b('0x22')];var _0x48b9be=_0x29a542?0x0:_0x5374d4['offset'];var _0x2e40c1=_0x29a542?_0x3a2d27[_0xa10b('0x22')]:_0x5374d4[_0xa10b('0x1f')]+_0x5374d4['limit'];var _0x38f11e;if(_0x2e40c1>=_0x34671d){_0x2e40c1=_0x34671d;_0x38f11e=0xc8;}else{_0x38f11e=0xce;}_0x40d30a['status'](_0x38f11e);return _0x40d30a['set'](_0xa10b('0x23'),_0x48b9be+'-'+_0x2e40c1+'/'+_0x34671d)[_0xa10b('0x1e')](_0x3a2d27);}return null;};}function patchUpdates(_0x22166d){return function(_0x37085f){try{jsonpatch[_0xa10b('0x24')](_0x37085f,_0x22166d,!![]);}catch(_0x4d0695){return BPromise[_0xa10b('0x25')](_0x4d0695);}return _0x37085f[_0xa10b('0x26')]();};}function saveUpdates(_0x29996c,_0x1b2ca5){return function(_0x1c1c7d){if(_0x1c1c7d){return _0x1c1c7d[_0xa10b('0x27')](_0x29996c)['then'](function(_0x3f1b94){return _0x3f1b94;});}return null;};}function removeEntity(_0x58aa37,_0x4d4c94){return function(_0x703f6d){if(_0x703f6d){return _0x703f6d[_0xa10b('0x28')]()[_0xa10b('0x29')](function(){_0x58aa37['status'](0xcc)[_0xa10b('0x1d')]();});}};}function handleEntityNotFound(_0x245cd2,_0x444332){return function(_0x411b62){if(!_0x411b62){_0x245cd2[_0xa10b('0x1b')](0x194);}return _0x411b62;};}function handleError(_0x5a242b,_0xaf424c){_0xaf424c=_0xaf424c||0x1f4;return function(_0x594aab){logger[_0xa10b('0x2a')](_0x594aab[_0xa10b('0x2b')]);if(_0x594aab[_0xa10b('0x2c')]){delete _0x594aab['name'];}_0x5a242b['status'](_0xaf424c)['send'](_0x594aab);};}exports[_0xa10b('0x2d')]=function(_0x2f5aed,_0x329d6b){var _0x421722={},_0x580002={},_0x4f047d={'count':0x0,'rows':[]};var _0x980b31=_[_0xa10b('0x2e')](db['SquareReport'][_0xa10b('0x2f')],function(_0x513928){return{'name':_0x513928['fieldName'],'type':_0x513928[_0xa10b('0x30')]['key']};});_0x580002[_0xa10b('0x31')]=_[_0xa10b('0x2e')](_0x980b31,_0xa10b('0x2c'));_0x580002[_0xa10b('0x32')]=_[_0xa10b('0x33')](_0x2f5aed['query']);_0x580002[_0xa10b('0x34')]=_[_0xa10b('0x35')](_0x580002[_0xa10b('0x31')],_0x580002['query']);_0x421722[_0xa10b('0x36')]=_[_0xa10b('0x35')](_0x580002[_0xa10b('0x31')],qs[_0xa10b('0x37')](_0x2f5aed[_0xa10b('0x32')]['fields']));_0x421722[_0xa10b('0x36')]=_0x421722[_0xa10b('0x36')][_0xa10b('0x38')]?_0x421722[_0xa10b('0x36')]:_0x580002['model'];if(!_0x2f5aed['query'][_0xa10b('0x39')](_0xa10b('0x3a'))){_0x421722['limit']=qs[_0xa10b('0x21')](_0x2f5aed[_0xa10b('0x32')][_0xa10b('0x21')]);_0x421722[_0xa10b('0x1f')]=qs[_0xa10b('0x1f')](_0x2f5aed[_0xa10b('0x32')][_0xa10b('0x1f')]);}_0x421722[_0xa10b('0x3b')]=qs['sort'](_0x2f5aed[_0xa10b('0x32')][_0xa10b('0x3c')]);_0x421722[_0xa10b('0x3d')]=qs[_0xa10b('0x34')](_[_0xa10b('0x3e')](_0x2f5aed[_0xa10b('0x32')],_0x580002[_0xa10b('0x34')]),_0x980b31);if(_0x2f5aed[_0xa10b('0x32')]['filter']){_0x421722[_0xa10b('0x3d')]=_[_0xa10b('0x3f')](_0x421722[_0xa10b('0x3d')],{'$or':_[_0xa10b('0x2e')](_0x980b31,function(_0x487e27){if(_0x487e27[_0xa10b('0x30')]!==_0xa10b('0x40')){var _0x5c2376={};_0x5c2376[_0x487e27[_0xa10b('0x2c')]]={'$like':'%'+_0x2f5aed['query'][_0xa10b('0x41')]+'%'};return _0x5c2376;}})});}_0x421722=_[_0xa10b('0x3f')]({},_0x421722,_0x2f5aed[_0xa10b('0x42')]);var _0xb55efb={'where':_0x421722[_0xa10b('0x3d')]};return db[_0xa10b('0x43')][_0xa10b('0x22')](_0xb55efb)[_0xa10b('0x29')](function(_0x54a891){_0x4f047d[_0xa10b('0x22')]=_0x54a891;if(_0x2f5aed[_0xa10b('0x32')][_0xa10b('0x44')]){_0x421722['include']=[{'all':!![]}];}return db[_0xa10b('0x43')]['findAll'](_0x421722);})['then'](function(_0x4da8b2){_0x4f047d[_0xa10b('0x45')]=_0x4da8b2;return _0x4f047d;})[_0xa10b('0x29')](respondWithFilteredResult(_0x329d6b,_0x421722))[_0xa10b('0x46')](handleError(_0x329d6b,null));};exports[_0xa10b('0x47')]=function(_0x16f1b7,_0x1b3b15){var _0x572db1={'raw':!![],'where':{'id':_0x16f1b7[_0xa10b('0x48')]['id']}},_0x66d7e5={};_0x66d7e5['model']=_[_0xa10b('0x33')](db[_0xa10b('0x43')][_0xa10b('0x2f')]);_0x66d7e5[_0xa10b('0x32')]=_['keys'](_0x16f1b7[_0xa10b('0x32')]);_0x66d7e5['filters']=_['intersection'](_0x66d7e5[_0xa10b('0x31')],_0x66d7e5['query']);_0x572db1['attributes']=_['intersection'](_0x66d7e5[_0xa10b('0x31')],qs[_0xa10b('0x37')](_0x16f1b7['query'][_0xa10b('0x37')]));_0x572db1[_0xa10b('0x36')]=_0x572db1[_0xa10b('0x36')][_0xa10b('0x38')]?_0x572db1[_0xa10b('0x36')]:_0x66d7e5[_0xa10b('0x31')];if(_0x16f1b7[_0xa10b('0x32')][_0xa10b('0x44')]){_0x572db1[_0xa10b('0x49')]=[{'all':!![]}];}_0x572db1=_['merge']({},_0x572db1,_0x16f1b7['options']);return db[_0xa10b('0x43')][_0xa10b('0x4a')](_0x572db1)[_0xa10b('0x29')](handleEntityNotFound(_0x1b3b15,null))[_0xa10b('0x29')](respondWithResult(_0x1b3b15,null))[_0xa10b('0x46')](handleError(_0x1b3b15,null));};exports['create']=function(_0x5dd1ec,_0x565cc4){return db[_0xa10b('0x43')][_0xa10b('0x4b')](_0x5dd1ec[_0xa10b('0x4c')],{})[_0xa10b('0x29')](respondWithResult(_0x565cc4,0xc9))[_0xa10b('0x46')](handleError(_0x565cc4,null));};exports[_0xa10b('0x27')]=function(_0x3c974f,_0x40273a){if(_0x3c974f[_0xa10b('0x4c')]['id']){delete _0x3c974f[_0xa10b('0x4c')]['id'];}return db[_0xa10b('0x43')][_0xa10b('0x4a')]({'where':{'id':_0x3c974f['params']['id']}})['then'](handleEntityNotFound(_0x40273a,null))[_0xa10b('0x29')](saveUpdates(_0x3c974f[_0xa10b('0x4c')],null))[_0xa10b('0x29')](respondWithResult(_0x40273a,null))[_0xa10b('0x46')](handleError(_0x40273a,null));};exports['destroy']=function(_0x143fa2,_0x46f7ce){return db[_0xa10b('0x43')][_0xa10b('0x4a')]({'where':{'id':_0x143fa2['params']['id']}})[_0xa10b('0x29')](handleEntityNotFound(_0x46f7ce,null))[_0xa10b('0x29')](removeEntity(_0x46f7ce,null))[_0xa10b('0x46')](handleError(_0x46f7ce,null));};exports[_0xa10b('0x4d')]=function(_0x39bb93,_0x3a0fb0){return db[_0xa10b('0x43')][_0xa10b('0x4d')]()[_0xa10b('0x29')](respondWithResult(_0x3a0fb0,null))[_0xa10b('0x46')](handleError(_0x3a0fb0,null));}; \ No newline at end of file +var _0x353b=['catch','create','update','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','then','destroy','error','name','index','SquareReport','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find'];(function(_0x2ea3a4,_0x4d12f4){var _0x1d6cd5=function(_0x1d26a7){while(--_0x1d26a7){_0x2ea3a4['push'](_0x2ea3a4['shift']());}};_0x1d6cd5(++_0x4d12f4);}(_0x353b,0xd4));var _0xb353=function(_0x7a42d9,_0x5a0c72){_0x7a42d9=_0x7a42d9-0x0;var _0x278b78=_0x353b[_0x7a42d9];return _0x278b78;};'use strict';var emlformat=require(_0xb353('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb353('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb353('0x2'));var moment=require(_0xb353('0x3'));var BPromise=require(_0xb353('0x4'));var Mustache=require('mustache');var util=require(_0xb353('0x5'));var path=require(_0xb353('0x6'));var sox=require(_0xb353('0x7'));var csv=require(_0xb353('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb353('0x9'));var _=require(_0xb353('0xa'));var squel=require('squel');var crypto=require(_0xb353('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb353('0xc'));var toCsv=require(_0xb353('0x8'));var querystring=require(_0xb353('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb353('0xe'));var qs=require(_0xb353('0xf'));var as=require(_0xb353('0x10'));var hardwareService=require(_0xb353('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb353('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb353('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29cd6c,_0x1755d7){_0x1755d7=_0x1755d7||0xcc;return function(_0x3d6627){if(_0x3d6627){return _0x29cd6c[_0xb353('0x14')](_0x1755d7);}return _0x29cd6c[_0xb353('0x15')](_0x1755d7)[_0xb353('0x16')]();};}function respondWithResult(_0x442f8a,_0x4ce561){_0x4ce561=_0x4ce561||0xc8;return function(_0x4075ce){if(_0x4075ce){return _0x442f8a[_0xb353('0x15')](_0x4ce561)[_0xb353('0x17')](_0x4075ce);}};}function respondWithFilteredResult(_0x3c06d2,_0x415113){return function(_0x50e616){if(_0x50e616){var _0x3e5592=typeof _0x415113[_0xb353('0x18')]===_0xb353('0x19')&&typeof _0x415113['limit']===_0xb353('0x19');var _0x2a1810=_0x50e616['count'];var _0x3be97f=_0x3e5592?0x0:_0x415113[_0xb353('0x18')];var _0x232f9f=_0x3e5592?_0x50e616[_0xb353('0x1a')]:_0x415113['offset']+_0x415113['limit'];var _0x44dd37;if(_0x232f9f>=_0x2a1810){_0x232f9f=_0x2a1810;_0x44dd37=0xc8;}else{_0x44dd37=0xce;}_0x3c06d2['status'](_0x44dd37);return _0x3c06d2[_0xb353('0x1b')](_0xb353('0x1c'),_0x3be97f+'-'+_0x232f9f+'/'+_0x2a1810)[_0xb353('0x17')](_0x50e616);}return null;};}function patchUpdates(_0x3dded7){return function(_0x50bb37){try{jsonpatch['apply'](_0x50bb37,_0x3dded7,!![]);}catch(_0x597671){return BPromise[_0xb353('0x1d')](_0x597671);}return _0x50bb37['save']();};}function saveUpdates(_0x4ac555,_0x2aa331){return function(_0x21b639){if(_0x21b639){return _0x21b639['update'](_0x4ac555)[_0xb353('0x1e')](function(_0x5d8dd4){return _0x5d8dd4;});}return null;};}function removeEntity(_0x9b689c,_0x4568f7){return function(_0x58ca62){if(_0x58ca62){return _0x58ca62[_0xb353('0x1f')]()['then'](function(){_0x9b689c[_0xb353('0x15')](0xcc)[_0xb353('0x16')]();});}};}function handleEntityNotFound(_0x16f6c7,_0x5da96e){return function(_0x35d59f){if(!_0x35d59f){_0x16f6c7[_0xb353('0x14')](0x194);}return _0x35d59f;};}function handleError(_0x165a42,_0x5c229a){_0x5c229a=_0x5c229a||0x1f4;return function(_0x1ad105){logger[_0xb353('0x20')](_0x1ad105['stack']);if(_0x1ad105[_0xb353('0x21')]){delete _0x1ad105[_0xb353('0x21')];}_0x165a42['status'](_0x5c229a)['send'](_0x1ad105);};}exports[_0xb353('0x22')]=function(_0x3a3db0,_0x41eecb){var _0x139007={},_0x17427e={},_0x20c788={'count':0x0,'rows':[]};var _0x3299f5=_['map'](db[_0xb353('0x23')]['rawAttributes'],function(_0x23ddb0){return{'name':_0x23ddb0[_0xb353('0x24')],'type':_0x23ddb0[_0xb353('0x25')]['key']};});_0x17427e[_0xb353('0x26')]=_[_0xb353('0x27')](_0x3299f5,_0xb353('0x21'));_0x17427e['query']=_['keys'](_0x3a3db0[_0xb353('0x28')]);_0x17427e[_0xb353('0x29')]=_['intersection'](_0x17427e[_0xb353('0x26')],_0x17427e[_0xb353('0x28')]);_0x139007[_0xb353('0x2a')]=_[_0xb353('0x2b')](_0x17427e[_0xb353('0x26')],qs[_0xb353('0x2c')](_0x3a3db0['query'][_0xb353('0x2c')]));_0x139007[_0xb353('0x2a')]=_0x139007[_0xb353('0x2a')][_0xb353('0x2d')]?_0x139007[_0xb353('0x2a')]:_0x17427e[_0xb353('0x26')];if(!_0x3a3db0['query'][_0xb353('0x2e')](_0xb353('0x2f'))){_0x139007[_0xb353('0x30')]=qs['limit'](_0x3a3db0[_0xb353('0x28')]['limit']);_0x139007[_0xb353('0x18')]=qs[_0xb353('0x18')](_0x3a3db0['query'][_0xb353('0x18')]);}_0x139007[_0xb353('0x31')]=qs[_0xb353('0x32')](_0x3a3db0[_0xb353('0x28')]['sort']);_0x139007[_0xb353('0x33')]=qs[_0xb353('0x29')](_['pick'](_0x3a3db0[_0xb353('0x28')],_0x17427e[_0xb353('0x29')]),_0x3299f5);if(_0x3a3db0['query'][_0xb353('0x34')]){_0x139007['where']=_[_0xb353('0x35')](_0x139007['where'],{'$or':_[_0xb353('0x27')](_0x3299f5,function(_0x1c8fd4){if(_0x1c8fd4['type']!==_0xb353('0x36')){var _0x1ade7b={};_0x1ade7b[_0x1c8fd4[_0xb353('0x21')]]={'$like':'%'+_0x3a3db0['query'][_0xb353('0x34')]+'%'};return _0x1ade7b;}})});}_0x139007=_[_0xb353('0x35')]({},_0x139007,_0x3a3db0[_0xb353('0x37')]);var _0x4f0dbf={'where':_0x139007['where']};return db['SquareReport']['count'](_0x4f0dbf)[_0xb353('0x1e')](function(_0x529318){_0x20c788[_0xb353('0x1a')]=_0x529318;if(_0x3a3db0[_0xb353('0x28')][_0xb353('0x38')]){_0x139007[_0xb353('0x39')]=[{'all':!![]}];}return db[_0xb353('0x23')][_0xb353('0x3a')](_0x139007);})['then'](function(_0x13d175){_0x20c788[_0xb353('0x3b')]=_0x13d175;return _0x20c788;})['then'](respondWithFilteredResult(_0x41eecb,_0x139007))['catch'](handleError(_0x41eecb,null));};exports['show']=function(_0x129bc7,_0x514400){var _0x16e4c4={'raw':!![],'where':{'id':_0x129bc7[_0xb353('0x3c')]['id']}},_0x1c68cf={};_0x1c68cf['model']=_[_0xb353('0x3d')](db[_0xb353('0x23')][_0xb353('0x3e')]);_0x1c68cf[_0xb353('0x28')]=_[_0xb353('0x3d')](_0x129bc7['query']);_0x1c68cf[_0xb353('0x29')]=_[_0xb353('0x2b')](_0x1c68cf[_0xb353('0x26')],_0x1c68cf[_0xb353('0x28')]);_0x16e4c4[_0xb353('0x2a')]=_['intersection'](_0x1c68cf[_0xb353('0x26')],qs[_0xb353('0x2c')](_0x129bc7[_0xb353('0x28')][_0xb353('0x2c')]));_0x16e4c4['attributes']=_0x16e4c4[_0xb353('0x2a')][_0xb353('0x2d')]?_0x16e4c4[_0xb353('0x2a')]:_0x1c68cf[_0xb353('0x26')];if(_0x129bc7[_0xb353('0x28')][_0xb353('0x38')]){_0x16e4c4['include']=[{'all':!![]}];}_0x16e4c4=_[_0xb353('0x35')]({},_0x16e4c4,_0x129bc7[_0xb353('0x37')]);return db[_0xb353('0x23')][_0xb353('0x3f')](_0x16e4c4)[_0xb353('0x1e')](handleEntityNotFound(_0x514400,null))[_0xb353('0x1e')](respondWithResult(_0x514400,null))[_0xb353('0x40')](handleError(_0x514400,null));};exports[_0xb353('0x41')]=function(_0x142b9d,_0x3c9ee0){return db[_0xb353('0x23')][_0xb353('0x41')](_0x142b9d['body'],{})[_0xb353('0x1e')](respondWithResult(_0x3c9ee0,0xc9))[_0xb353('0x40')](handleError(_0x3c9ee0,null));};exports[_0xb353('0x42')]=function(_0x34983c,_0x578fef){if(_0x34983c['body']['id']){delete _0x34983c[_0xb353('0x43')]['id'];}return db['SquareReport'][_0xb353('0x3f')]({'where':{'id':_0x34983c['params']['id']}})[_0xb353('0x1e')](handleEntityNotFound(_0x578fef,null))[_0xb353('0x1e')](saveUpdates(_0x34983c['body'],null))[_0xb353('0x1e')](respondWithResult(_0x578fef,null))['catch'](handleError(_0x578fef,null));};exports[_0xb353('0x1f')]=function(_0x2a51b4,_0x34b164){return db[_0xb353('0x23')]['find']({'where':{'id':_0x2a51b4[_0xb353('0x3c')]['id']}})[_0xb353('0x1e')](handleEntityNotFound(_0x34b164,null))['then'](removeEntity(_0x34b164,null))[_0xb353('0x40')](handleError(_0x34b164,null));};exports[_0xb353('0x44')]=function(_0x5efc52,_0x4af176){return db[_0xb353('0x23')][_0xb353('0x44')]()[_0xb353('0x1e')](respondWithResult(_0x4af176,null))[_0xb353('0x40')](handleError(_0x4af176,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 691f7ca..c007b7a 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 _0x16b6=['../../config/environment','define','SquareReport','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x26cf1d,_0x28697d){var _0x511098=function(_0x14e79e){while(--_0x14e79e){_0x26cf1d['push'](_0x26cf1d['shift']());}};_0x511098(++_0x28697d);}(_0x16b6,0x76));var _0x616b=function(_0xc197eb,_0x35dc61){_0xc197eb=_0xc197eb-0x0;var _0x4be264=_0x16b6[_0xc197eb];return _0x4be264;};'use strict';var _=require(_0x616b('0x0'));var util=require('util');var logger=require(_0x616b('0x1'))(_0x616b('0x2'));var moment=require(_0x616b('0x3'));var BPromise=require(_0x616b('0x4'));var rp=require(_0x616b('0x5'));var fs=require('fs');var path=require(_0x616b('0x6'));var rimraf=require(_0x616b('0x7'));var config=require(_0x616b('0x8'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x471feb,_0x91f37c){return _0x471feb[_0x616b('0x9')](_0x616b('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x616b('0xb'),'fields':['uniqueid',_0x616b('0xc')]},{'name':'leaveAt','fields':[_0x616b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1aeb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','leaveAt','lodash','util'];(function(_0x460494,_0x529a0b){var _0x3d6e05=function(_0x43d029){while(--_0x43d029){_0x460494['push'](_0x460494['shift']());}};_0x3d6e05(++_0x529a0b);}(_0x1aeb,0x14e));var _0xb1ae=function(_0x99096c,_0x898397){_0x99096c=_0x99096c-0x0;var _0x481d3b=_0x1aeb[_0x99096c];return _0x481d3b;};'use strict';var _=require(_0xb1ae('0x0'));var util=require(_0xb1ae('0x1'));var logger=require(_0xb1ae('0x2'))(_0xb1ae('0x3'));var moment=require(_0xb1ae('0x4'));var BPromise=require(_0xb1ae('0x5'));var rp=require(_0xb1ae('0x6'));var fs=require('fs');var path=require(_0xb1ae('0x7'));var rimraf=require(_0xb1ae('0x8'));var config=require(_0xb1ae('0x9'));var attributes=require(_0xb1ae('0xa'));module[_0xb1ae('0xb')]=function(_0x1bf097,_0x4fa66b){return _0x1bf097[_0xb1ae('0xc')](_0xb1ae('0xd'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xb1ae('0xe'),'fields':['uniqueid','project_name']},{'name':_0xb1ae('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 183029e..6f8b833 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 _0x9fe4=['client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','SquareReport','create','body','options','raw','CreateSquareReport','debug','catch','UpdateSquareReport','update','attributes','limit','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4be016,_0x4c1fea){var _0x4001d6=function(_0x45b1fb){while(--_0x45b1fb){_0x4be016['push'](_0x4be016['shift']());}};_0x4001d6(++_0x4c1fea);}(_0x9fe4,0x125));var _0x49fe=function(_0x33e7a5,_0x5704eb){_0x33e7a5=_0x33e7a5-0x0;var _0x17b494=_0x9fe4[_0x33e7a5];return _0x17b494;};'use strict';var _=require('lodash');var util=require(_0x49fe('0x0'));var moment=require(_0x49fe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x49fe('0x2'));var logger=require(_0x49fe('0x3'))(_0x49fe('0x4'));var config=require(_0x49fe('0x5'));var jayson=require(_0x49fe('0x6'));var client=jayson[_0x49fe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287e8b,_0x2fb026,_0x43ac60){return new BPromise(function(_0x1e3d4f,_0x46d536){return client[_0x49fe('0x8')](_0x287e8b,_0x43ac60)[_0x49fe('0x9')](function(_0x34d45){logger['info'](_0x49fe('0xa'),_0x2fb026,_0x49fe('0xb'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x2fb026,'request\x20sent',JSON[_0x49fe('0xc')](_0x34d45));if(_0x34d45[_0x49fe('0xd')]){if(_0x34d45[_0x49fe('0xd')][_0x49fe('0xe')]===0x1f4){logger[_0x49fe('0xd')](_0x49fe('0xa'),_0x2fb026,_0x34d45['error'][_0x49fe('0xf')]);return _0x46d536(_0x34d45[_0x49fe('0xd')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x2fb026,_0x34d45[_0x49fe('0xd')][_0x49fe('0xf')]);return _0x1e3d4f(_0x34d45[_0x49fe('0xd')]['message']);}else{logger[_0x49fe('0x10')]('SquareReport,\x20%s,\x20%s',_0x2fb026,_0x49fe('0xb'));_0x1e3d4f(_0x34d45[_0x49fe('0x11')][_0x49fe('0xf')]);}})['catch'](function(_0x3822b6){logger['error']('SquareReport,\x20%s,\x20%s',_0x2fb026,_0x3822b6);_0x46d536(_0x3822b6);});});}exports['CreateSquareReport']=function(_0x5b33e1){var _0x1b194d=this;return new Promise(function(_0x57cc4b,_0x2c18a3){return db[_0x49fe('0x12')][_0x49fe('0x13')](_0x5b33e1[_0x49fe('0x14')],{'raw':_0x5b33e1['options']?_0x5b33e1[_0x49fe('0x15')][_0x49fe('0x16')]===undefined?!![]:![]:!![]})[_0x49fe('0x9')](function(_0x227a66){logger[_0x49fe('0x10')](_0x49fe('0x17'),_0x5b33e1);logger[_0x49fe('0x18')](_0x49fe('0x17'),_0x5b33e1,JSON['stringify'](_0x227a66));_0x57cc4b(_0x227a66);})[_0x49fe('0x19')](function(_0x4d6797){logger[_0x49fe('0xd')](_0x49fe('0x17'),_0x4d6797[_0x49fe('0xf')],_0x5b33e1);_0x2c18a3(_0x1b194d['error'](0x1f4,_0x4d6797['message']));});});};exports[_0x49fe('0x1a')]=function(_0x4f6be1){var _0x1e419d=this;return new Promise(function(_0x55ae79,_0x1b726c){return db['SquareReport'][_0x49fe('0x1b')](_0x4f6be1['body'],{'raw':_0x4f6be1[_0x49fe('0x15')]?_0x4f6be1['options'][_0x49fe('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6be1[_0x49fe('0x15')]?_0x4f6be1[_0x49fe('0x15')]['where']||null:null,'attributes':_0x4f6be1['options']?_0x4f6be1[_0x49fe('0x15')][_0x49fe('0x1c')]||null:null,'limit':_0x4f6be1[_0x49fe('0x15')]?_0x4f6be1[_0x49fe('0x15')][_0x49fe('0x1d')]||null:null})['then'](function(_0x4f5a60){logger[_0x49fe('0x10')](_0x49fe('0x1a'),_0x4f6be1);logger[_0x49fe('0x18')](_0x49fe('0x1a'),_0x4f6be1,JSON[_0x49fe('0xc')](_0x4f5a60));_0x55ae79(_0x4f5a60);})[_0x49fe('0x19')](function(_0x4c3b39){logger['error']('UpdateSquareReport',_0x4c3b39['message'],_0x4f6be1);_0x1b726c(_0x1e419d[_0x49fe('0xd')](0x1f4,_0x4c3b39[_0x49fe('0xf')]));});});}; \ No newline at end of file +var _0xff07=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','create','body','options','raw','then','catch','SquareReport','update','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','info','SquareReport,\x20%s,\x20%s'];(function(_0x5a3ab8,_0x5c9511){var _0x1a0ffa=function(_0x679894){while(--_0x679894){_0x5a3ab8['push'](_0x5a3ab8['shift']());}};_0x1a0ffa(++_0x5c9511);}(_0xff07,0x1f3));var _0x7ff0=function(_0x4c2bdc,_0x5915d7){_0x4c2bdc=_0x4c2bdc-0x0;var _0x5a3222=_0xff07[_0x4c2bdc];return _0x5a3222;};'use strict';var _=require(_0x7ff0('0x0'));var util=require(_0x7ff0('0x1'));var moment=require(_0x7ff0('0x2'));var BPromise=require(_0x7ff0('0x3'));var rs=require(_0x7ff0('0x4'));var fs=require('fs');var Redis=require(_0x7ff0('0x5'));var db=require(_0x7ff0('0x6'))['db'];var utils=require(_0x7ff0('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ff0('0x8')][_0x7ff0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd581,_0x54aa02,_0x125012){return new BPromise(function(_0x8ae2d7,_0x58b791){return client[_0x7ff0('0xa')](_0x2fd581,_0x125012)['then'](function(_0x4001c4){logger[_0x7ff0('0xb')](_0x7ff0('0xc'),_0x54aa02,_0x7ff0('0xd'));logger[_0x7ff0('0xe')](_0x7ff0('0xf'),_0x54aa02,_0x7ff0('0xd'),JSON[_0x7ff0('0x10')](_0x4001c4));if(_0x4001c4[_0x7ff0('0x11')]){if(_0x4001c4[_0x7ff0('0x11')][_0x7ff0('0x12')]===0x1f4){logger[_0x7ff0('0x11')]('SquareReport,\x20%s,\x20%s',_0x54aa02,_0x4001c4[_0x7ff0('0x11')][_0x7ff0('0x13')]);return _0x58b791(_0x4001c4['error'][_0x7ff0('0x13')]);}logger[_0x7ff0('0x11')]('SquareReport,\x20%s,\x20%s',_0x54aa02,_0x4001c4[_0x7ff0('0x11')]['message']);return _0x8ae2d7(_0x4001c4[_0x7ff0('0x11')][_0x7ff0('0x13')]);}else{logger['info'](_0x7ff0('0xc'),_0x54aa02,_0x7ff0('0xd'));_0x8ae2d7(_0x4001c4[_0x7ff0('0x14')][_0x7ff0('0x13')]);}})['catch'](function(_0x109535){logger[_0x7ff0('0x11')]('SquareReport,\x20%s,\x20%s',_0x54aa02,_0x109535);_0x58b791(_0x109535);});});}exports[_0x7ff0('0x15')]=function(_0x27067c){var _0x26ca11=this;return new Promise(function(_0x4413da,_0x5aae4c){return db['SquareReport'][_0x7ff0('0x16')](_0x27067c[_0x7ff0('0x17')],{'raw':_0x27067c[_0x7ff0('0x18')]?_0x27067c['options'][_0x7ff0('0x19')]===undefined?!![]:![]:!![]})[_0x7ff0('0x1a')](function(_0x4aba3f){logger[_0x7ff0('0xb')](_0x7ff0('0x15'),_0x27067c);logger[_0x7ff0('0xe')](_0x7ff0('0x15'),_0x27067c,JSON[_0x7ff0('0x10')](_0x4aba3f));_0x4413da(_0x4aba3f);})[_0x7ff0('0x1b')](function(_0x897d19){logger[_0x7ff0('0x11')](_0x7ff0('0x15'),_0x897d19['message'],_0x27067c);_0x5aae4c(_0x26ca11[_0x7ff0('0x11')](0x1f4,_0x897d19['message']));});});};exports['UpdateSquareReport']=function(_0x5bfd8e){var _0x701ddc=this;return new Promise(function(_0x281a65,_0x43214c){return db[_0x7ff0('0x1c')][_0x7ff0('0x1d')](_0x5bfd8e[_0x7ff0('0x17')],{'raw':_0x5bfd8e['options']?_0x5bfd8e[_0x7ff0('0x18')][_0x7ff0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bfd8e[_0x7ff0('0x18')]?_0x5bfd8e['options'][_0x7ff0('0x1e')]||null:null,'attributes':_0x5bfd8e[_0x7ff0('0x18')]?_0x5bfd8e[_0x7ff0('0x18')]['attributes']||null:null,'limit':_0x5bfd8e[_0x7ff0('0x18')]?_0x5bfd8e[_0x7ff0('0x18')]['limit']||null:null})[_0x7ff0('0x1a')](function(_0x37b7ed){logger[_0x7ff0('0xb')](_0x7ff0('0x1f'),_0x5bfd8e);logger[_0x7ff0('0xe')]('UpdateSquareReport',_0x5bfd8e,JSON[_0x7ff0('0x10')](_0x37b7ed));_0x281a65(_0x37b7ed);})[_0x7ff0('0x1b')](function(_0x73836c){logger[_0x7ff0('0x11')](_0x7ff0('0x1f'),_0x73836c[_0x7ff0('0x13')],_0x5bfd8e);_0x43214c(_0x701ddc[_0x7ff0('0x11')](0x1f4,_0x73836c[_0x7ff0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d22f652..0c462f1 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 _0x8331=['update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put'];(function(_0x15dc92,_0x45a995){var _0x21a6bb=function(_0x440ecd){while(--_0x440ecd){_0x15dc92['push'](_0x15dc92['shift']());}};_0x21a6bb(++_0x45a995);}(_0x8331,0x1a7));var _0x1833=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x8331[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0x1833('0x0'));var util=require(_0x1833('0x1'));var path=require('path');var timeout=require(_0x1833('0x2'));var express=require(_0x1833('0x3'));var router=express['Router']();var fs_extra=require(_0x1833('0x4'));var auth=require(_0x1833('0x5'));var interaction=require(_0x1833('0x6'));var config=require(_0x1833('0x7'));var controller=require(_0x1833('0x8'));router['get']('/',auth[_0x1833('0x9')](),controller[_0x1833('0xa')]);router[_0x1833('0xb')](_0x1833('0xc'),auth[_0x1833('0x9')](),controller[_0x1833('0xd')]);router[_0x1833('0xb')](_0x1833('0xe'),auth[_0x1833('0x9')](),controller[_0x1833('0xf')]);router['post']('/',auth[_0x1833('0x9')](),controller[_0x1833('0x10')]);router[_0x1833('0x11')](_0x1833('0xe'),auth[_0x1833('0x9')](),controller[_0x1833('0x12')]);router[_0x1833('0x13')]('/:id',auth[_0x1833('0x9')](),controller[_0x1833('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbdc5=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get','isAuthenticated','show'];(function(_0x325d36,_0x7c6b84){var _0x27193e=function(_0x1d4790){while(--_0x1d4790){_0x325d36['push'](_0x325d36['shift']());}};_0x27193e(++_0x7c6b84);}(_0xbdc5,0x8c));var _0x5bdc=function(_0xe05a51,_0x573bf3){_0xe05a51=_0xe05a51-0x0;var _0x1f87e5=_0xbdc5[_0xe05a51];return _0x1f87e5;};'use strict';var multer=require(_0x5bdc('0x0'));var util=require(_0x5bdc('0x1'));var path=require(_0x5bdc('0x2'));var timeout=require(_0x5bdc('0x3'));var express=require(_0x5bdc('0x4'));var router=express[_0x5bdc('0x5')]();var fs_extra=require(_0x5bdc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bdc('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5bdc('0x8')]);router[_0x5bdc('0x9')]('/describe',auth[_0x5bdc('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5bdc('0xb')]);router[_0x5bdc('0xc')]('/',auth[_0x5bdc('0xa')](),controller['create']);router[_0x5bdc('0xd')](_0x5bdc('0xe'),auth['isAuthenticated'](),controller[_0x5bdc('0xf')]);router[_0x5bdc('0x10')]('/:id',auth[_0x5bdc('0xa')](),controller[_0x5bdc('0x11')]);module[_0x5bdc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c35d5ba..4239885 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 _0x6c78=['TEXT','sequelize','STRING'];(function(_0xe8192f,_0x1f14ab){var _0x53716f=function(_0x185435){while(--_0x185435){_0xe8192f['push'](_0xe8192f['shift']());}};_0x53716f(++_0x1f14ab);}(_0x6c78,0x94));var _0x86c7=function(_0x68e89a,_0x31e8a1){_0x68e89a=_0x68e89a-0x0;var _0x205252=_0x6c78[_0x68e89a];return _0x205252;};'use strict';var Sequelize=require(_0x86c7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x86c7('0x1')]},'node':{'type':Sequelize[_0x86c7('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x86c7('0x2')]},'project_name':{'type':Sequelize[_0x86c7('0x1')]},'callerid':{'type':Sequelize[_0x86c7('0x1')]}}; \ No newline at end of file +var _0xafdb=['exports','STRING','TEXT','sequelize'];(function(_0x69fa12,_0x12f4eb){var _0x497313=function(_0x1236f9){while(--_0x1236f9){_0x69fa12['push'](_0x69fa12['shift']());}};_0x497313(++_0x12f4eb);}(_0xafdb,0x77));var _0xbafd=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xafdb[_0x4226d6];return _0x19655b;};'use strict';var Sequelize=require(_0xbafd('0x0'));module[_0xbafd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xbafd('0x2')]},'application':{'type':Sequelize[_0xbafd('0x2')]},'data':{'type':Sequelize[_0xbafd('0x3')]},'project_name':{'type':Sequelize[_0xbafd('0x2')]},'callerid':{'type':Sequelize[_0xbafd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 10da966..6cb723c 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 _0x3e9c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','offset','count','Content-Range','apply','save','destroy','then','name','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','params','catch','create','body','update','find','describe'];(function(_0x5147b0,_0x34e6ad){var _0x2eb7f7=function(_0x4739c7){while(--_0x4739c7){_0x5147b0['push'](_0x5147b0['shift']());}};_0x2eb7f7(++_0x34e6ad);}(_0x3e9c,0x92));var _0xc3e9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3e9c[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xc3e9('0x0'));var rimraf=require(_0xc3e9('0x1'));var zipdir=require(_0xc3e9('0x2'));var jsonpatch=require(_0xc3e9('0x3'));var rp=require(_0xc3e9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc3e9('0x5'));var util=require(_0xc3e9('0x6'));var path=require(_0xc3e9('0x7'));var sox=require(_0xc3e9('0x8'));var csv=require(_0xc3e9('0x9'));var ejs=require(_0xc3e9('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e9('0xb'));var _=require(_0xc3e9('0xc'));var squel=require(_0xc3e9('0xd'));var crypto=require('crypto');var jsforce=require(_0xc3e9('0xe'));var deskjs=require(_0xc3e9('0xf'));var toCsv=require(_0xc3e9('0x9'));var querystring=require(_0xc3e9('0x10'));var Papa=require('papaparse');var Redis=require(_0xc3e9('0x11'));var authService=require(_0xc3e9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc3e9('0x13'));var hardwareService=require(_0xc3e9('0x14'));var logger=require('../../config/logger')(_0xc3e9('0x15'));var utils=require(_0xc3e9('0x16'));var config=require(_0xc3e9('0x17'));var licenseUtil=require(_0xc3e9('0x18'));var db=require(_0xc3e9('0x19'))['db'];function respondWithStatusCode(_0x1504eb,_0x3a4015){_0x3a4015=_0x3a4015||0xcc;return function(_0x1c1f28){if(_0x1c1f28){return _0x1504eb[_0xc3e9('0x1a')](_0x3a4015);}return _0x1504eb['status'](_0x3a4015)[_0xc3e9('0x1b')]();};}function respondWithResult(_0x16c6c6,_0x368e7a){_0x368e7a=_0x368e7a||0xc8;return function(_0xe752cc){if(_0xe752cc){return _0x16c6c6[_0xc3e9('0x1c')](_0x368e7a)[_0xc3e9('0x1d')](_0xe752cc);}};}function respondWithFilteredResult(_0x3d0127,_0x2bd155){return function(_0x5b52dc){if(_0x5b52dc){var _0x1c3e00=typeof _0x2bd155['offset']==='undefined'&&typeof _0x2bd155[_0xc3e9('0x1e')]===_0xc3e9('0x1f');var _0x2f70af=_0x5b52dc['count'];var _0x36cf18=_0x1c3e00?0x0:_0x2bd155[_0xc3e9('0x20')];var _0x55b80e=_0x1c3e00?_0x5b52dc[_0xc3e9('0x21')]:_0x2bd155['offset']+_0x2bd155['limit'];var _0x4ddf74;if(_0x55b80e>=_0x2f70af){_0x55b80e=_0x2f70af;_0x4ddf74=0xc8;}else{_0x4ddf74=0xce;}_0x3d0127['status'](_0x4ddf74);return _0x3d0127['set'](_0xc3e9('0x22'),_0x36cf18+'-'+_0x55b80e+'/'+_0x2f70af)[_0xc3e9('0x1d')](_0x5b52dc);}return null;};}function patchUpdates(_0x13bf2e){return function(_0x540246){try{jsonpatch[_0xc3e9('0x23')](_0x540246,_0x13bf2e,!![]);}catch(_0x21a4e6){return BPromise['reject'](_0x21a4e6);}return _0x540246[_0xc3e9('0x24')]();};}function saveUpdates(_0x25a067,_0x4d1605){return function(_0x4fcf10){if(_0x4fcf10){return _0x4fcf10['update'](_0x25a067)['then'](function(_0x5893b1){return _0x5893b1;});}return null;};}function removeEntity(_0x4bd041,_0x1b3ef3){return function(_0x107915){if(_0x107915){return _0x107915[_0xc3e9('0x25')]()[_0xc3e9('0x26')](function(){_0x4bd041[_0xc3e9('0x1c')](0xcc)[_0xc3e9('0x1b')]();});}};}function handleEntityNotFound(_0x49d777,_0x21964f){return function(_0x5c66f3){if(!_0x5c66f3){_0x49d777[_0xc3e9('0x1a')](0x194);}return _0x5c66f3;};}function handleError(_0x12f665,_0x227e22){_0x227e22=_0x227e22||0x1f4;return function(_0x353c10){logger['error'](_0x353c10['stack']);if(_0x353c10['name']){delete _0x353c10[_0xc3e9('0x27')];}_0x12f665[_0xc3e9('0x1c')](_0x227e22)['send'](_0x353c10);};}exports['index']=function(_0x1e6db9,_0x15d367){var _0x9fb72e={},_0x2b9432={},_0x6bf191={'count':0x0,'rows':[]};var _0x3a99be=_[_0xc3e9('0x28')](db['SquareDetailsReport'][_0xc3e9('0x29')],function(_0x14ec11){return{'name':_0x14ec11[_0xc3e9('0x2a')],'type':_0x14ec11[_0xc3e9('0x2b')][_0xc3e9('0x2c')]};});_0x2b9432[_0xc3e9('0x2d')]=_[_0xc3e9('0x28')](_0x3a99be,_0xc3e9('0x27'));_0x2b9432['query']=_[_0xc3e9('0x2e')](_0x1e6db9['query']);_0x2b9432[_0xc3e9('0x2f')]=_[_0xc3e9('0x30')](_0x2b9432[_0xc3e9('0x2d')],_0x2b9432[_0xc3e9('0x31')]);_0x9fb72e['attributes']=_[_0xc3e9('0x30')](_0x2b9432[_0xc3e9('0x2d')],qs[_0xc3e9('0x32')](_0x1e6db9[_0xc3e9('0x31')]['fields']));_0x9fb72e['attributes']=_0x9fb72e[_0xc3e9('0x33')][_0xc3e9('0x34')]?_0x9fb72e['attributes']:_0x2b9432['model'];if(!_0x1e6db9['query'][_0xc3e9('0x35')]('nolimit')){_0x9fb72e[_0xc3e9('0x1e')]=qs[_0xc3e9('0x1e')](_0x1e6db9[_0xc3e9('0x31')]['limit']);_0x9fb72e[_0xc3e9('0x20')]=qs[_0xc3e9('0x20')](_0x1e6db9[_0xc3e9('0x31')][_0xc3e9('0x20')]);}_0x9fb72e[_0xc3e9('0x36')]=qs[_0xc3e9('0x37')](_0x1e6db9[_0xc3e9('0x31')][_0xc3e9('0x37')]);_0x9fb72e[_0xc3e9('0x38')]=qs[_0xc3e9('0x2f')](_['pick'](_0x1e6db9[_0xc3e9('0x31')],_0x2b9432[_0xc3e9('0x2f')]),_0x3a99be);if(_0x1e6db9['query'][_0xc3e9('0x39')]){_0x9fb72e[_0xc3e9('0x38')]=_[_0xc3e9('0x3a')](_0x9fb72e[_0xc3e9('0x38')],{'$or':_[_0xc3e9('0x28')](_0x3a99be,function(_0x6e4993){if(_0x6e4993[_0xc3e9('0x2b')]!==_0xc3e9('0x3b')){var _0xa0ea8d={};_0xa0ea8d[_0x6e4993[_0xc3e9('0x27')]]={'$like':'%'+_0x1e6db9[_0xc3e9('0x31')][_0xc3e9('0x39')]+'%'};return _0xa0ea8d;}})});}_0x9fb72e=_['merge']({},_0x9fb72e,_0x1e6db9[_0xc3e9('0x3c')]);var _0x563411={'where':_0x9fb72e[_0xc3e9('0x38')]};return db[_0xc3e9('0x3d')][_0xc3e9('0x21')](_0x563411)[_0xc3e9('0x26')](function(_0x44e37a){_0x6bf191[_0xc3e9('0x21')]=_0x44e37a;if(_0x1e6db9[_0xc3e9('0x31')][_0xc3e9('0x3e')]){_0x9fb72e[_0xc3e9('0x3f')]=[{'all':!![]}];}return db[_0xc3e9('0x3d')][_0xc3e9('0x40')](_0x9fb72e);})['then'](function(_0x1ce94d){_0x6bf191[_0xc3e9('0x41')]=_0x1ce94d;return _0x6bf191;})[_0xc3e9('0x26')](respondWithFilteredResult(_0x15d367,_0x9fb72e))['catch'](handleError(_0x15d367,null));};exports['show']=function(_0x1cfc3b,_0x3a6ba7){var _0x274756={'raw':!![],'where':{'id':_0x1cfc3b[_0xc3e9('0x42')]['id']}},_0x195a8f={};_0x195a8f[_0xc3e9('0x2d')]=_[_0xc3e9('0x2e')](db[_0xc3e9('0x3d')][_0xc3e9('0x29')]);_0x195a8f[_0xc3e9('0x31')]=_['keys'](_0x1cfc3b['query']);_0x195a8f[_0xc3e9('0x2f')]=_[_0xc3e9('0x30')](_0x195a8f[_0xc3e9('0x2d')],_0x195a8f[_0xc3e9('0x31')]);_0x274756[_0xc3e9('0x33')]=_[_0xc3e9('0x30')](_0x195a8f[_0xc3e9('0x2d')],qs['fields'](_0x1cfc3b[_0xc3e9('0x31')][_0xc3e9('0x32')]));_0x274756[_0xc3e9('0x33')]=_0x274756[_0xc3e9('0x33')]['length']?_0x274756[_0xc3e9('0x33')]:_0x195a8f[_0xc3e9('0x2d')];if(_0x1cfc3b[_0xc3e9('0x31')][_0xc3e9('0x3e')]){_0x274756[_0xc3e9('0x3f')]=[{'all':!![]}];}_0x274756=_[_0xc3e9('0x3a')]({},_0x274756,_0x1cfc3b[_0xc3e9('0x3c')]);return db[_0xc3e9('0x3d')]['find'](_0x274756)[_0xc3e9('0x26')](handleEntityNotFound(_0x3a6ba7,null))[_0xc3e9('0x26')](respondWithResult(_0x3a6ba7,null))[_0xc3e9('0x43')](handleError(_0x3a6ba7,null));};exports['create']=function(_0x50d38d,_0x5aab50){return db[_0xc3e9('0x3d')][_0xc3e9('0x44')](_0x50d38d[_0xc3e9('0x45')],{})[_0xc3e9('0x26')](respondWithResult(_0x5aab50,0xc9))[_0xc3e9('0x43')](handleError(_0x5aab50,null));};exports[_0xc3e9('0x46')]=function(_0x11d9b1,_0x20ce5a){if(_0x11d9b1['body']['id']){delete _0x11d9b1[_0xc3e9('0x45')]['id'];}return db[_0xc3e9('0x3d')][_0xc3e9('0x47')]({'where':{'id':_0x11d9b1[_0xc3e9('0x42')]['id']}})[_0xc3e9('0x26')](handleEntityNotFound(_0x20ce5a,null))['then'](saveUpdates(_0x11d9b1['body'],null))[_0xc3e9('0x26')](respondWithResult(_0x20ce5a,null))[_0xc3e9('0x43')](handleError(_0x20ce5a,null));};exports[_0xc3e9('0x25')]=function(_0x527dfd,_0x33b66a){return db[_0xc3e9('0x3d')]['find']({'where':{'id':_0x527dfd[_0xc3e9('0x42')]['id']}})['then'](handleEntityNotFound(_0x33b66a,null))[_0xc3e9('0x26')](removeEntity(_0x33b66a,null))[_0xc3e9('0x43')](handleError(_0x33b66a,null));};exports['describe']=function(_0x40dc3b,_0x32998f){return db[_0xc3e9('0x3d')][_0xc3e9('0x48')]()[_0xc3e9('0x26')](respondWithResult(_0x32998f,null))[_0xc3e9('0x43')](handleError(_0x32998f,null));}; \ No newline at end of file +var _0x38b6=['limit','count','Content-Range','apply','save','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x3428ee,_0x4d9716){var _0x4e653c=function(_0x354c59){while(--_0x354c59){_0x3428ee['push'](_0x3428ee['shift']());}};_0x4e653c(++_0x4d9716);}(_0x38b6,0x14f));var _0x638b=function(_0x2c246c,_0x361329){_0x2c246c=_0x2c246c-0x0;var _0x38bb3f=_0x38b6[_0x2c246c];return _0x38bb3f;};'use strict';var emlformat=require(_0x638b('0x0'));var rimraf=require(_0x638b('0x1'));var zipdir=require(_0x638b('0x2'));var jsonpatch=require(_0x638b('0x3'));var rp=require(_0x638b('0x4'));var moment=require('moment');var BPromise=require(_0x638b('0x5'));var Mustache=require(_0x638b('0x6'));var util=require(_0x638b('0x7'));var path=require(_0x638b('0x8'));var sox=require('sox');var csv=require(_0x638b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x638b('0xa'));var _=require(_0x638b('0xb'));var squel=require(_0x638b('0xc'));var crypto=require(_0x638b('0xd'));var jsforce=require(_0x638b('0xe'));var deskjs=require(_0x638b('0xf'));var toCsv=require(_0x638b('0x9'));var querystring=require(_0x638b('0x10'));var Papa=require(_0x638b('0x11'));var Redis=require(_0x638b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x638b('0x13'));var as=require(_0x638b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x638b('0x15'))('api');var utils=require(_0x638b('0x16'));var config=require(_0x638b('0x17'));var licenseUtil=require(_0x638b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7a57,_0x8dc350){_0x8dc350=_0x8dc350||0xcc;return function(_0x1eca3d){if(_0x1eca3d){return _0x3b7a57[_0x638b('0x19')](_0x8dc350);}return _0x3b7a57[_0x638b('0x1a')](_0x8dc350)[_0x638b('0x1b')]();};}function respondWithResult(_0x138bb2,_0xe1417f){_0xe1417f=_0xe1417f||0xc8;return function(_0x26e14c){if(_0x26e14c){return _0x138bb2[_0x638b('0x1a')](_0xe1417f)[_0x638b('0x1c')](_0x26e14c);}};}function respondWithFilteredResult(_0x482f86,_0x2926f5){return function(_0x49bbca){if(_0x49bbca){var _0xd160de=typeof _0x2926f5[_0x638b('0x1d')]==='undefined'&&typeof _0x2926f5[_0x638b('0x1e')]==='undefined';var _0x470e32=_0x49bbca[_0x638b('0x1f')];var _0x56a77d=_0xd160de?0x0:_0x2926f5[_0x638b('0x1d')];var _0x448422=_0xd160de?_0x49bbca[_0x638b('0x1f')]:_0x2926f5[_0x638b('0x1d')]+_0x2926f5['limit'];var _0x4bb0ce;if(_0x448422>=_0x470e32){_0x448422=_0x470e32;_0x4bb0ce=0xc8;}else{_0x4bb0ce=0xce;}_0x482f86[_0x638b('0x1a')](_0x4bb0ce);return _0x482f86['set'](_0x638b('0x20'),_0x56a77d+'-'+_0x448422+'/'+_0x470e32)[_0x638b('0x1c')](_0x49bbca);}return null;};}function patchUpdates(_0x2adbb6){return function(_0x43b8da){try{jsonpatch[_0x638b('0x21')](_0x43b8da,_0x2adbb6,!![]);}catch(_0x280699){return BPromise['reject'](_0x280699);}return _0x43b8da[_0x638b('0x22')]();};}function saveUpdates(_0x11b693,_0x4fe457){return function(_0x3ea866){if(_0x3ea866){return _0x3ea866['update'](_0x11b693)[_0x638b('0x23')](function(_0x2a46b7){return _0x2a46b7;});}return null;};}function removeEntity(_0x5a168e,_0x22331c){return function(_0x33b2ca){if(_0x33b2ca){return _0x33b2ca['destroy']()[_0x638b('0x23')](function(){_0x5a168e[_0x638b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca741,_0x49babf){return function(_0x40eebd){if(!_0x40eebd){_0x5ca741[_0x638b('0x19')](0x194);}return _0x40eebd;};}function handleError(_0x52cf9a,_0x5ccaa0){_0x5ccaa0=_0x5ccaa0||0x1f4;return function(_0x957efc){logger[_0x638b('0x24')](_0x957efc['stack']);if(_0x957efc[_0x638b('0x25')]){delete _0x957efc[_0x638b('0x25')];}_0x52cf9a['status'](_0x5ccaa0)[_0x638b('0x26')](_0x957efc);};}exports[_0x638b('0x27')]=function(_0x1b0251,_0x4c64a0){var _0x17215c={},_0x286aa6={},_0x3b8abb={'count':0x0,'rows':[]};var _0x50b50c=_['map'](db[_0x638b('0x28')][_0x638b('0x29')],function(_0x234dfa){return{'name':_0x234dfa[_0x638b('0x2a')],'type':_0x234dfa[_0x638b('0x2b')][_0x638b('0x2c')]};});_0x286aa6[_0x638b('0x2d')]=_[_0x638b('0x2e')](_0x50b50c,_0x638b('0x25'));_0x286aa6[_0x638b('0x2f')]=_[_0x638b('0x30')](_0x1b0251[_0x638b('0x2f')]);_0x286aa6[_0x638b('0x31')]=_[_0x638b('0x32')](_0x286aa6[_0x638b('0x2d')],_0x286aa6[_0x638b('0x2f')]);_0x17215c[_0x638b('0x33')]=_[_0x638b('0x32')](_0x286aa6[_0x638b('0x2d')],qs[_0x638b('0x34')](_0x1b0251[_0x638b('0x2f')]['fields']));_0x17215c[_0x638b('0x33')]=_0x17215c[_0x638b('0x33')][_0x638b('0x35')]?_0x17215c[_0x638b('0x33')]:_0x286aa6[_0x638b('0x2d')];if(!_0x1b0251['query'][_0x638b('0x36')](_0x638b('0x37'))){_0x17215c[_0x638b('0x1e')]=qs[_0x638b('0x1e')](_0x1b0251[_0x638b('0x2f')]['limit']);_0x17215c[_0x638b('0x1d')]=qs[_0x638b('0x1d')](_0x1b0251[_0x638b('0x2f')][_0x638b('0x1d')]);}_0x17215c['order']=qs[_0x638b('0x38')](_0x1b0251[_0x638b('0x2f')][_0x638b('0x38')]);_0x17215c[_0x638b('0x39')]=qs['filters'](_[_0x638b('0x3a')](_0x1b0251['query'],_0x286aa6[_0x638b('0x31')]),_0x50b50c);if(_0x1b0251['query'][_0x638b('0x3b')]){_0x17215c[_0x638b('0x39')]=_[_0x638b('0x3c')](_0x17215c[_0x638b('0x39')],{'$or':_['map'](_0x50b50c,function(_0x39b657){if(_0x39b657[_0x638b('0x2b')]!=='VIRTUAL'){var _0x57951e={};_0x57951e[_0x39b657[_0x638b('0x25')]]={'$like':'%'+_0x1b0251[_0x638b('0x2f')][_0x638b('0x3b')]+'%'};return _0x57951e;}})});}_0x17215c=_['merge']({},_0x17215c,_0x1b0251['options']);var _0x54f9d6={'where':_0x17215c[_0x638b('0x39')]};return db[_0x638b('0x28')][_0x638b('0x1f')](_0x54f9d6)[_0x638b('0x23')](function(_0x355f54){_0x3b8abb[_0x638b('0x1f')]=_0x355f54;if(_0x1b0251[_0x638b('0x2f')][_0x638b('0x3d')]){_0x17215c[_0x638b('0x3e')]=[{'all':!![]}];}return db[_0x638b('0x28')][_0x638b('0x3f')](_0x17215c);})[_0x638b('0x23')](function(_0x1174c4){_0x3b8abb[_0x638b('0x40')]=_0x1174c4;return _0x3b8abb;})[_0x638b('0x23')](respondWithFilteredResult(_0x4c64a0,_0x17215c))[_0x638b('0x41')](handleError(_0x4c64a0,null));};exports['show']=function(_0x233736,_0x4c02c2){var _0x24d5be={'raw':!![],'where':{'id':_0x233736['params']['id']}},_0x20eb8f={};_0x20eb8f[_0x638b('0x2d')]=_['keys'](db[_0x638b('0x28')][_0x638b('0x29')]);_0x20eb8f[_0x638b('0x2f')]=_[_0x638b('0x30')](_0x233736[_0x638b('0x2f')]);_0x20eb8f['filters']=_[_0x638b('0x32')](_0x20eb8f[_0x638b('0x2d')],_0x20eb8f[_0x638b('0x2f')]);_0x24d5be[_0x638b('0x33')]=_[_0x638b('0x32')](_0x20eb8f['model'],qs[_0x638b('0x34')](_0x233736['query'][_0x638b('0x34')]));_0x24d5be[_0x638b('0x33')]=_0x24d5be[_0x638b('0x33')][_0x638b('0x35')]?_0x24d5be[_0x638b('0x33')]:_0x20eb8f[_0x638b('0x2d')];if(_0x233736['query'][_0x638b('0x3d')]){_0x24d5be[_0x638b('0x3e')]=[{'all':!![]}];}_0x24d5be=_[_0x638b('0x3c')]({},_0x24d5be,_0x233736[_0x638b('0x42')]);return db['SquareDetailsReport'][_0x638b('0x43')](_0x24d5be)[_0x638b('0x23')](handleEntityNotFound(_0x4c02c2,null))[_0x638b('0x23')](respondWithResult(_0x4c02c2,null))['catch'](handleError(_0x4c02c2,null));};exports[_0x638b('0x44')]=function(_0x2d8795,_0x360eb9){return db['SquareDetailsReport'][_0x638b('0x44')](_0x2d8795[_0x638b('0x45')],{})[_0x638b('0x23')](respondWithResult(_0x360eb9,0xc9))['catch'](handleError(_0x360eb9,null));};exports[_0x638b('0x46')]=function(_0x905429,_0x4a9603){if(_0x905429[_0x638b('0x45')]['id']){delete _0x905429[_0x638b('0x45')]['id'];}return db[_0x638b('0x28')][_0x638b('0x43')]({'where':{'id':_0x905429['params']['id']}})[_0x638b('0x23')](handleEntityNotFound(_0x4a9603,null))[_0x638b('0x23')](saveUpdates(_0x905429[_0x638b('0x45')],null))['then'](respondWithResult(_0x4a9603,null))[_0x638b('0x41')](handleError(_0x4a9603,null));};exports[_0x638b('0x47')]=function(_0x80dd60,_0x2cb05d){return db['SquareDetailsReport'][_0x638b('0x43')]({'where':{'id':_0x80dd60['params']['id']}})[_0x638b('0x23')](handleEntityNotFound(_0x2cb05d,null))[_0x638b('0x23')](removeEntity(_0x2cb05d,null))[_0x638b('0x41')](handleError(_0x2cb05d,null));};exports[_0x638b('0x48')]=function(_0x38cf58,_0xb0e906){return db[_0x638b('0x28')]['describe']()['then'](respondWithResult(_0xb0e906,null))[_0x638b('0x41')](handleError(_0xb0e906,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7cbda11..8fd1f76 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 _0xa81a=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0xa81a,0xf1));var _0xaa81=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0xa81a[_0x57c9c7];return _0x48ad8b;};'use strict';var _=require(_0xaa81('0x0'));var util=require(_0xaa81('0x1'));var logger=require(_0xaa81('0x2'))(_0xaa81('0x3'));var moment=require('moment');var BPromise=require(_0xaa81('0x4'));var rp=require(_0xaa81('0x5'));var fs=require('fs');var path=require(_0xaa81('0x6'));var rimraf=require(_0xaa81('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa81('0x8'));module['exports']=function(_0x540418,_0x4d168c){return _0x540418[_0xaa81('0x9')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fa=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5cb54b,_0x5b038c){var _0xaeb5c4=function(_0x10ab41){while(--_0x10ab41){_0x5cb54b['push'](_0x5cb54b['shift']());}};_0xaeb5c4(++_0x5b038c);}(_0xb5fa,0x119));var _0xab5f=function(_0x2cd6c9,_0x112eba){_0x2cd6c9=_0x2cd6c9-0x0;var _0x2c1c41=_0xb5fa[_0x2cd6c9];return _0x2c1c41;};'use strict';var _=require(_0xab5f('0x0'));var util=require('util');var logger=require(_0xab5f('0x1'))(_0xab5f('0x2'));var moment=require(_0xab5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xab5f('0x4'));var fs=require('fs');var path=require(_0xab5f('0x5'));var rimraf=require('rimraf');var config=require(_0xab5f('0x6'));var attributes=require(_0xab5f('0x7'));module[_0xab5f('0x8')]=function(_0x3b24e2,_0x547408){return _0x3b24e2[_0xab5f('0x9')](_0xab5f('0xa'),attributes,{'tableName':_0xab5f('0xb'),'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 f74524d..0c8e036 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 _0xe9e8=['info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x3285ba,_0x10f59f){_0x3285ba=_0x3285ba-0x0;var _0x5454bd=_0xe9e8[_0x3285ba];return _0x5454bd;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});}exports['CreateSquareDetailsReport']=function(_0x42f8e8){var _0x40f4fd=this;return new Promise(function(_0x41cdc0,_0x28584b){return db[_0x8e9e('0x18')][_0x8e9e('0x19')](_0x42f8e8[_0x8e9e('0x1a')],{'raw':_0x42f8e8['options']?_0x42f8e8[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8e9e('0x1c')](function(_0x19a890){logger['info'](_0x8e9e('0x1d'),_0x42f8e8);logger[_0x8e9e('0xf')](_0x8e9e('0x1d'),_0x42f8e8,JSON[_0x8e9e('0x12')](_0x19a890));_0x41cdc0(_0x19a890);})[_0x8e9e('0x17')](function(_0x6a311b){logger[_0x8e9e('0x13')](_0x8e9e('0x1d'),_0x6a311b['message'],_0x42f8e8);_0x28584b(_0x40f4fd['error'](0x1f4,_0x6a311b[_0x8e9e('0x15')]));});});}; \ No newline at end of file +var _0x97c1=['create','body','options','raw','then','CreateSquareDetailsReport','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareDetailsReport'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['CreateSquareDetailsReport']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')](_0x372311[_0x197c('0x15')],{'raw':_0x372311['options']?_0x372311[_0x197c('0x16')][_0x197c('0x17')]===undefined?!![]:![]:!![]})[_0x197c('0x18')](function(_0x5c278a){logger[_0x197c('0xa')](_0x197c('0x19'),_0x372311);logger[_0x197c('0x1a')](_0x197c('0x19'),_0x372311,JSON[_0x197c('0xe')](_0x5c278a));_0x50ac52(_0x5c278a);})[_0x197c('0x12')](function(_0x362bbf){logger[_0x197c('0xf')](_0x197c('0x19'),_0x362bbf[_0x197c('0x10')],_0x372311);_0x1725d9(_0x47aaa9[_0x197c('0xf')](0x1f4,_0x362bbf[_0x197c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 825398e..bd95450 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 _0x776f=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x18ed36,_0x40cfaf){var _0x174738=function(_0x5882e7){while(--_0x5882e7){_0x18ed36['push'](_0x18ed36['shift']());}};_0x174738(++_0x40cfaf);}(_0x776f,0x68));var _0xf776=function(_0x3ead55,_0x22bc51){_0x3ead55=_0x3ead55-0x0;var _0x3ea16d=_0x776f[_0x3ead55];return _0x3ea16d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf776('0x0'));var controller=require(_0xf776('0x1'));router[_0xf776('0x2')]('/',auth[_0xf776('0x3')](),controller[_0xf776('0x4')]);router['get'](_0xf776('0x5'),auth['isAuthenticated'](),controller[_0xf776('0x6')]);module[_0xf776('0x7')]=router; \ No newline at end of file +var _0x3f2c=['express','../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x216ebe,_0x317409){var _0x418f92=function(_0x4bcaa7){while(--_0x4bcaa7){_0x216ebe['push'](_0x216ebe['shift']());}};_0x418f92(++_0x317409);}(_0x3f2c,0x1e0));var _0xc3f2=function(_0x162a4d,_0x590294){_0x162a4d=_0x162a4d-0x0;var _0x9b66a9=_0x3f2c[_0x162a4d];return _0x9b66a9;};'use strict';var express=require(_0xc3f2('0x0'));var router=express['Router']();var auth=require(_0xc3f2('0x1'));var controller=require('./system.controller');router[_0xc3f2('0x2')]('/',auth[_0xc3f2('0x3')](),controller[_0xc3f2('0x4')]);router[_0xc3f2('0x2')](_0xc3f2('0x5'),auth['isAuthenticated'](),controller[_0xc3f2('0x6')]);module[_0xc3f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 904cea1..f57e8d0 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 _0x40b7=['send','index','getAllData','then','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x45ec71,_0x31ca8b){var _0x386f82=function(_0x3023ce){while(--_0x3023ce){_0x45ec71['push'](_0x45ec71['shift']());}};_0x386f82(++_0x31ca8b);}(_0x40b7,0x1e2));var _0x740b=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x40b7[_0x220f3f];return _0x1f170e;};'use strict';var info=require(_0x740b('0x0'));var exec=require(_0x740b('0x1'))[_0x740b('0x2')];var logger=require(_0x740b('0x3'))(_0x740b('0x4'));var util=require('util');var BPromise=require(_0x740b('0x5'));var _=require(_0x740b('0x6'));function handleError(_0x300794,_0x3bef04,_0x252c6b){_0x3bef04=_0x3bef04||0x1f4;return function(_0xd7f37e){logger['error'](_0x740b('0x7'),_0x252c6b,_0x3bef04,util[_0x740b('0x8')](_0xd7f37e,{'showHidden':![],'depth':null}));delete _0xd7f37e[_0x740b('0x9')];_0x300794[_0x740b('0xa')](_0x3bef04)[_0x740b('0xb')](_0xd7f37e);};}exports[_0x740b('0xc')]=function(_0x7295ea,_0x238f65){return info[_0x740b('0xd')]()[_0x740b('0xe')](function(_0x11e891){return _0x238f65[_0x740b('0xa')](0xc8)[_0x740b('0xf')](_0x11e891);})['catch'](function(_0x2c2fe2){return _0x238f65[_0x740b('0xa')](0x1f4)[_0x740b('0xf')](_0x2c2fe2);});};exports[_0x740b('0x10')]=function(_0x1a8825,_0x26f527){var _0x5d085f=[_0x740b('0x11')];return new BPromise(function(_0x290988,_0x3b3fba){return exec(util['format'](_0x740b('0x12'),_0x1a8825[_0x740b('0x13')][_0x740b('0x14')]),function(_0x48b519,_0x4e21cf,_0x89a7ab){if(_0x48b519){return _0x3b3fba(_0x48b519);}return _0x290988(_0x4e21cf);});})[_0x740b('0xe')](function(_0x3d113d){var _0x2be391=![];var _0x16c2e4=_0x3d113d[_0x740b('0x15')](/\n/);for(var _0x5ddf98=0x0,_0x5905b2=_0x5d085f[_0x740b('0x16')];_0x5ddf98<_0x5905b2,_0x2be391===![];_0x5ddf98+=0x1){if(_0x3d113d[_0x740b('0x17')](_0x5d085f[_0x5ddf98])>=0x0){_0x2be391=!![];}}if(!_0x2be391){throw new Error(util[_0x740b('0x18')](_0x740b('0x19'),_0x1a8825[_0x740b('0x13')][_0x740b('0x14')]));}process[_0x740b('0x1a')](_0x1a8825[_0x740b('0x13')][_0x740b('0x14')],_0x740b('0x1b'));return _0x26f527[_0x740b('0xa')](0xc8)[_0x740b('0xf')]({'message':util[_0x740b('0x18')](_0x740b('0x1c'),_0x1a8825[_0x740b('0x13')][_0x740b('0x14')])});})['catch'](handleError(_0x26f527,null,_0x740b('0x10')));}; \ No newline at end of file +var _0x0595=['catch','child_process','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','params'];(function(_0x13d71e,_0x1ab6a1){var _0x2dc8aa=function(_0x466e63){while(--_0x466e63){_0x13d71e['push'](_0x13d71e['shift']());}};_0x2dc8aa(++_0x1ab6a1);}(_0x0595,0x1c9));var _0x5059=function(_0x562143,_0xcde680){_0x562143=_0x562143-0x0;var _0x9d943e=_0x0595[_0x562143];return _0x9d943e;};'use strict';var info=require('systeminformation');var exec=require(_0x5059('0x0'))[_0x5059('0x1')];var logger=require(_0x5059('0x2'))('api');var util=require(_0x5059('0x3'));var BPromise=require('bluebird');var _=require(_0x5059('0x4'));function handleError(_0x2ef2f,_0x15fa8e,_0x3ce742){_0x15fa8e=_0x15fa8e||0x1f4;return function(_0x1b6aae){logger[_0x5059('0x5')](_0x5059('0x6'),_0x3ce742,_0x15fa8e,util['inspect'](_0x1b6aae,{'showHidden':![],'depth':null}));delete _0x1b6aae['name'];_0x2ef2f[_0x5059('0x7')](_0x15fa8e)[_0x5059('0x8')](_0x1b6aae);};}exports[_0x5059('0x9')]=function(_0x408dcc,_0x32d2cb){return info[_0x5059('0xa')]()['then'](function(_0x2facba){return _0x32d2cb['status'](0xc8)[_0x5059('0xb')](_0x2facba);})['catch'](function(_0x56e8d1){return _0x32d2cb[_0x5059('0x7')](0x1f4)[_0x5059('0xb')](_0x56e8d1);});};exports[_0x5059('0xc')]=function(_0x12acf8,_0x19757b){var _0x1ae235=[_0x5059('0xd')];return new BPromise(function(_0x5ed8cc,_0x41e809){return exec(util[_0x5059('0xe')](_0x5059('0xf'),_0x12acf8['params']['pid']),function(_0x5ef255,_0x41e6f4,_0x16ac81){if(_0x5ef255){return _0x41e809(_0x5ef255);}return _0x5ed8cc(_0x41e6f4);});})[_0x5059('0x10')](function(_0x609e85){var _0x3af417=![];var _0x178145=_0x609e85[_0x5059('0x11')](/\n/);for(var _0x1bc4ec=0x0,_0xb6e935=_0x1ae235[_0x5059('0x12')];_0x1bc4ec<_0xb6e935,_0x3af417===![];_0x1bc4ec+=0x1){if(_0x609e85['indexOf'](_0x1ae235[_0x1bc4ec])>=0x0){_0x3af417=!![];}}if(!_0x3af417){throw new Error(util[_0x5059('0xe')](_0x5059('0x13'),_0x12acf8['params'][_0x5059('0x14')]));}process['kill'](_0x12acf8['params'][_0x5059('0x14')],_0x5059('0x15'));return _0x19757b[_0x5059('0x7')](0xc8)[_0x5059('0xb')]({'message':util[_0x5059('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x12acf8[_0x5059('0x16')][_0x5059('0x14')])});})[_0x5059('0x17')](handleError(_0x19757b,null,_0x5059('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7ba983f..b1949a7 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 _0xf8e9=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x43fdc1,_0x3fccd8){var _0x5c3907=function(_0xd846c){while(--_0xd846c){_0x43fdc1['push'](_0x43fdc1['shift']());}};_0x5c3907(++_0x3fccd8);}(_0xf8e9,0x120));var _0x9f8e=function(_0x4a73de,_0x24be84){_0x4a73de=_0x4a73de-0x0;var _0x143d8b=_0xf8e9[_0x4a73de];return _0x143d8b;};'use strict';var multer=require(_0x9f8e('0x0'));var util=require(_0x9f8e('0x1'));var path=require(_0x9f8e('0x2'));var timeout=require(_0x9f8e('0x3'));var express=require(_0x9f8e('0x4'));var router=express[_0x9f8e('0x5')]();var fs_extra=require(_0x9f8e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f8e('0x7'));var config=require(_0x9f8e('0x8'));var controller=require(_0x9f8e('0x9'));router[_0x9f8e('0xa')]('/',auth[_0x9f8e('0xb')](),controller[_0x9f8e('0xc')]);router[_0x9f8e('0xa')](_0x9f8e('0xd'),auth[_0x9f8e('0xb')](),controller['show']);router[_0x9f8e('0xe')]('/',auth[_0x9f8e('0xb')](),controller[_0x9f8e('0xf')]);router['put']('/:id',auth[_0x9f8e('0xb')](),controller[_0x9f8e('0x10')]);router[_0x9f8e('0x11')](_0x9f8e('0xd'),auth[_0x9f8e('0xb')](),controller[_0x9f8e('0x12')]);module[_0x9f8e('0x13')]=router; \ No newline at end of file +var _0x68a5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x519ced,_0x176b5d){var _0x448522=function(_0x4d94f6){while(--_0x4d94f6){_0x519ced['push'](_0x519ced['shift']());}};_0x448522(++_0x176b5d);}(_0x68a5,0xfc));var _0x568a=function(_0x224a43,_0x3c8942){_0x224a43=_0x224a43-0x0;var _0x151c4e=_0x68a5[_0x224a43];return _0x151c4e;};'use strict';var multer=require(_0x568a('0x0'));var util=require('util');var path=require(_0x568a('0x1'));var timeout=require(_0x568a('0x2'));var express=require('express');var router=express[_0x568a('0x3')]();var fs_extra=require(_0x568a('0x4'));var auth=require(_0x568a('0x5'));var interaction=require(_0x568a('0x6'));var config=require('../../config/environment');var controller=require(_0x568a('0x7'));router['get']('/',auth[_0x568a('0x8')](),controller[_0x568a('0x9')]);router[_0x568a('0xa')](_0x568a('0xb'),auth['isAuthenticated'](),controller[_0x568a('0xc')]);router['post']('/',auth[_0x568a('0x8')](),controller[_0x568a('0xd')]);router[_0x568a('0xe')](_0x568a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x568a('0xf')](_0x568a('0xb'),auth['isAuthenticated'](),controller[_0x568a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index da1c974..1a166e5 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 _0xbee0=['STRING','name','#0091EA','exports'];(function(_0x5f478b,_0x3ebe92){var _0x3da4ef=function(_0x5de72c){while(--_0x5de72c){_0x5f478b['push'](_0x5f478b['shift']());}};_0x3da4ef(++_0x3ebe92);}(_0xbee0,0x147));var _0x0bee=function(_0x224235,_0x2f303e){_0x224235=_0x224235-0x0;var _0x15d9e9=_0xbee0[_0x224235];return _0x15d9e9;};'use strict';var Sequelize=require('sequelize');module[_0x0bee('0x0')]={'name':{'type':Sequelize[_0x0bee('0x1')],'unique':_0x0bee('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0bee('0x1')],'defaultValue':_0x0bee('0x3')},'description':{'type':Sequelize[_0x0bee('0x1')]}}; \ No newline at end of file +var _0x7948=['exports','STRING','name','#0091EA','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7948,0x185));var _0x8794=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x7948[_0x421c56];return _0x49b244;};'use strict';var Sequelize=require(_0x8794('0x0'));module[_0x8794('0x1')]={'name':{'type':Sequelize[_0x8794('0x2')],'unique':_0x8794('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8794('0x2')],'defaultValue':_0x8794('0x4')},'description':{'type':Sequelize[_0x8794('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a90746a..1bd29c3 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 _0x750a=['filter','options','Tag','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x6e7fc0,_0x18b91e){var _0xf69948=function(_0x707782){while(--_0x707782){_0x6e7fc0['push'](_0x6e7fc0['shift']());}};_0xf69948(++_0x18b91e);}(_0x750a,0x140));var _0xa750=function(_0x3aaf5d,_0x2b5189){_0x3aaf5d=_0x3aaf5d-0x0;var _0x522b20=_0x750a[_0x3aaf5d];return _0x522b20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['Tag'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['Tag'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['Tag']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));}; \ No newline at end of file +var _0xfc03=['Tag','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','create','role','user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map'];(function(_0x3cea34,_0x459157){var _0x131d11=function(_0x5a4d9c){while(--_0x5a4d9c){_0x3cea34['push'](_0x3cea34['shift']());}};_0x131d11(++_0x459157);}(_0xfc03,0x16f));var _0x3fc0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc03[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){var _0x35a3e2=_0x2f423e[_0x3fc0('0x28')]({'plain':!![]});var _0x1abe10=_0x3fc0('0x29');return db[_0x3fc0('0x2a')][_0x3fc0('0x27')]({'where':{'type':_0x1abe10,'resourceId':_0x35a3e2['id']}})[_0x3fc0('0x26')](function(){return _0x2f423e;});})['then'](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1d9932,_0x35c34c){return function(_0x5a9179){if(!_0x5a9179){_0x1d9932[_0x3fc0('0x18')](0x194);}return _0x5a9179;};}function handleError(_0x197dfa,_0x126515){_0x126515=_0x126515||0x1f4;return function(_0x2645b4){logger['error'](_0x2645b4[_0x3fc0('0x2b')]);if(_0x2645b4[_0x3fc0('0x2c')]){delete _0x2645b4[_0x3fc0('0x2c')];}_0x197dfa[_0x3fc0('0x1a')](_0x126515)[_0x3fc0('0x2d')](_0x2645b4);};}exports[_0x3fc0('0x2e')]=function(_0x485f0c,_0xd9ecae){var _0x2351c8={},_0x181948={},_0x21a074={'count':0x0,'rows':[]};var _0x3f1a75=_[_0x3fc0('0x2f')](db[_0x3fc0('0x30')][_0x3fc0('0x31')],function(_0x4d6551){return{'name':_0x4d6551['fieldName'],'type':_0x4d6551[_0x3fc0('0x32')]['key']};});_0x181948[_0x3fc0('0x33')]=_[_0x3fc0('0x2f')](_0x3f1a75,_0x3fc0('0x2c'));_0x181948[_0x3fc0('0x34')]=_[_0x3fc0('0x35')](_0x485f0c['query']);_0x181948['filters']=_[_0x3fc0('0x36')](_0x181948[_0x3fc0('0x33')],_0x181948[_0x3fc0('0x34')]);_0x2351c8[_0x3fc0('0x37')]=_[_0x3fc0('0x36')](_0x181948['model'],qs[_0x3fc0('0x38')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x38')]));_0x2351c8['attributes']=_0x2351c8[_0x3fc0('0x37')][_0x3fc0('0x39')]?_0x2351c8[_0x3fc0('0x37')]:_0x181948[_0x3fc0('0x33')];if(!_0x485f0c['query'][_0x3fc0('0x3a')](_0x3fc0('0x3b'))){_0x2351c8['limit']=qs[_0x3fc0('0x1f')](_0x485f0c['query'][_0x3fc0('0x1f')]);_0x2351c8[_0x3fc0('0x1c')]=qs[_0x3fc0('0x1c')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x1c')]);}_0x2351c8[_0x3fc0('0x3c')]=qs[_0x3fc0('0x3d')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x3d')]);_0x2351c8[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_['pick'](_0x485f0c[_0x3fc0('0x34')],_0x181948[_0x3fc0('0x3f')]),_0x3f1a75);if(_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x40')]){_0x2351c8[_0x3fc0('0x3e')]=_[_0x3fc0('0x41')](_0x2351c8['where'],{'$or':_['map'](_0x3f1a75,function(_0x3af7ed){if(_0x3af7ed[_0x3fc0('0x32')]!==_0x3fc0('0x42')){var _0x3e285f={};_0x3e285f[_0x3af7ed[_0x3fc0('0x2c')]]={'$like':'%'+_0x485f0c['query']['filter']+'%'};return _0x3e285f;}})});}_0x2351c8=_['merge']({},_0x2351c8,_0x485f0c[_0x3fc0('0x43')]);var _0x39d65c={'where':_0x2351c8[_0x3fc0('0x3e')]};return db['Tag']['count'](_0x39d65c)[_0x3fc0('0x26')](function(_0x239dc5){_0x21a074[_0x3fc0('0x1e')]=_0x239dc5;if(_0x485f0c[_0x3fc0('0x34')]['includeAll']){_0x2351c8['include']=[{'all':!![]}];}return db[_0x3fc0('0x30')][_0x3fc0('0x44')](_0x2351c8);})['then'](function(_0x32768f){_0x21a074['rows']=_0x32768f;return _0x21a074;})[_0x3fc0('0x26')](respondWithFilteredResult(_0xd9ecae,_0x2351c8))[_0x3fc0('0x45')](handleError(_0xd9ecae,null));};exports[_0x3fc0('0x46')]=function(_0x90120f,_0x2d01e9){var _0x38e449={'raw':!![],'where':{'id':_0x90120f[_0x3fc0('0x47')]['id']}},_0x80dfee={};_0x80dfee['model']=_[_0x3fc0('0x35')](db['Tag'][_0x3fc0('0x31')]);_0x80dfee[_0x3fc0('0x34')]=_[_0x3fc0('0x35')](_0x90120f[_0x3fc0('0x34')]);_0x80dfee[_0x3fc0('0x3f')]=_['intersection'](_0x80dfee[_0x3fc0('0x33')],_0x80dfee[_0x3fc0('0x34')]);_0x38e449[_0x3fc0('0x37')]=_[_0x3fc0('0x36')](_0x80dfee['model'],qs[_0x3fc0('0x38')](_0x90120f['query'][_0x3fc0('0x38')]));_0x38e449[_0x3fc0('0x37')]=_0x38e449[_0x3fc0('0x37')][_0x3fc0('0x39')]?_0x38e449[_0x3fc0('0x37')]:_0x80dfee['model'];if(_0x90120f[_0x3fc0('0x34')][_0x3fc0('0x48')]){_0x38e449[_0x3fc0('0x49')]=[{'all':!![]}];}_0x38e449=_['merge']({},_0x38e449,_0x90120f[_0x3fc0('0x43')]);return db[_0x3fc0('0x30')]['find'](_0x38e449)[_0x3fc0('0x26')](handleEntityNotFound(_0x2d01e9,null))[_0x3fc0('0x26')](respondWithResult(_0x2d01e9,null))[_0x3fc0('0x45')](handleError(_0x2d01e9,null));};exports['create']=function(_0x5e5c73,_0x3a35ac){return db[_0x3fc0('0x30')][_0x3fc0('0x4a')](_0x5e5c73['body'],{})[_0x3fc0('0x26')](function(_0x527569){var _0x40dbf3=_0x5e5c73['user']['get']({'plain':!![]});if(!_0x40dbf3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40dbf3[_0x3fc0('0x4b')]===_0x3fc0('0x4c')){var _0x141b4c=_0x527569[_0x3fc0('0x28')]({'plain':!![]});var _0x1e0c43=_0x3fc0('0x29');return db['UserProfileSection'][_0x3fc0('0x4d')]({'where':{'name':_0x1e0c43,'userProfileId':_0x40dbf3[_0x3fc0('0x4e')]},'raw':!![]})['then'](function(_0x550463){if(_0x550463&&_0x550463[_0x3fc0('0x4f')]===0x0){return db[_0x3fc0('0x2a')][_0x3fc0('0x4a')]({'name':_0x141b4c[_0x3fc0('0x2c')],'resourceId':_0x141b4c['id'],'type':_0x550463[_0x3fc0('0x2c')],'sectionId':_0x550463['id']},{})[_0x3fc0('0x26')](function(){return _0x527569;});}else{return _0x527569;}})[_0x3fc0('0x45')](function(_0x2da185){logger[_0x3fc0('0x50')](_0x3fc0('0x51'),_0x2da185);throw _0x2da185;});}return _0x527569;})[_0x3fc0('0x26')](respondWithResult(_0x3a35ac,0xc9))[_0x3fc0('0x45')](handleError(_0x3a35ac,null));};exports['update']=function(_0x24be72,_0xda5d3e){if(_0x24be72[_0x3fc0('0x52')]['id']){delete _0x24be72[_0x3fc0('0x52')]['id'];}return db[_0x3fc0('0x30')]['find']({'where':{'id':_0x24be72[_0x3fc0('0x47')]['id']}})['then'](handleEntityNotFound(_0xda5d3e,null))[_0x3fc0('0x26')](saveUpdates(_0x24be72[_0x3fc0('0x52')],null))[_0x3fc0('0x26')](respondWithResult(_0xda5d3e,null))[_0x3fc0('0x45')](handleError(_0xda5d3e,null));};exports['destroy']=function(_0x1656c7,_0xd903e3){return db[_0x3fc0('0x30')][_0x3fc0('0x4d')]({'where':{'id':_0x1656c7[_0x3fc0('0x47')]['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0xd903e3,null))['then'](removeEntity(_0xd903e3,null))[_0x3fc0('0x45')](handleError(_0xd903e3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 42abfcb..86797f2 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 _0x7f2b=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x7ce8,_0x1e4919){var _0x3fd933=function(_0x1f161c){while(--_0x1f161c){_0x7ce8['push'](_0x7ce8['shift']());}};_0x3fd933(++_0x1e4919);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x5abb52,_0x14660b){_0x5abb52=_0x5abb52-0x0;var _0x13d418=_0x7f2b[_0x5abb52];return _0x13d418;};'use strict';var _=require(_0xb7f2('0x0'));var util=require(_0xb7f2('0x1'));var logger=require(_0xb7f2('0x2'))(_0xb7f2('0x3'));var moment=require(_0xb7f2('0x4'));var BPromise=require(_0xb7f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f2('0x6'));var rimraf=require('rimraf');var config=require(_0xb7f2('0x7'));var attributes=require(_0xb7f2('0x8'));module[_0xb7f2('0x9')]=function(_0x550f7c,_0x1e7c59){return _0x550f7c[_0xb7f2('0xa')](_0xb7f2('0xb'),attributes,{'tableName':_0xb7f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61bf=['rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x423f6a,_0x2b2377){var _0x174dba=function(_0x414760){while(--_0x414760){_0x423f6a['push'](_0x423f6a['shift']());}};_0x174dba(++_0x2b2377);}(_0x61bf,0x96));var _0xf61b=function(_0x240503,_0x166674){_0x240503=_0x240503-0x0;var _0x14dfc2=_0x61bf[_0x240503];return _0x14dfc2;};'use strict';var _=require(_0xf61b('0x0'));var util=require(_0xf61b('0x1'));var logger=require(_0xf61b('0x2'))(_0xf61b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf61b('0x4'));var fs=require('fs');var path=require(_0xf61b('0x5'));var rimraf=require(_0xf61b('0x6'));var config=require(_0xf61b('0x7'));var attributes=require(_0xf61b('0x8'));module['exports']=function(_0x27890a,_0x2ea32b){return _0x27890a[_0xf61b('0x9')](_0xf61b('0xa'),attributes,{'tableName':_0xf61b('0xb'),'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 7720075..306897e 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 _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','Tag,\x20%s,\x20%s','message','catch','util'];(function(_0x4e0d55,_0x275a62){var _0x20fbd4=function(_0x1ced36){while(--_0x1ced36){_0x4e0d55['push'](_0x4e0d55['shift']());}};_0x20fbd4(++_0x275a62);}(_0xedd9,0xfc));var _0x9edd=function(_0x15ca84,_0x3e76d9){_0x15ca84=_0x15ca84-0x0;var _0x4753b1=_0xedd9[_0x15ca84];return _0x4753b1;};'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')]('Tag,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Tag,\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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x413e00,_0x4be1e8){var _0x1d17f2=function(_0x511cc4){while(--_0x511cc4){_0x413e00['push'](_0x413e00['shift']());}};_0x1d17f2(++_0x4be1e8);}(_0x6aa7,0x178));var _0x76aa=function(_0x3a32cb,_0x32e29b){_0x3a32cb=_0x3a32cb-0x0;var _0x1cda41=_0x6aa7[_0x3a32cb];return _0x1cda41;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 06fe68e..c8c852f 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 ad9a8c6..d5ba71e 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 _0x0713=['STRING','name'];(function(_0x45f5ba,_0x1656f4){var _0x389ef4=function(_0x54d3d6){while(--_0x54d3d6){_0x45f5ba['push'](_0x45f5ba['shift']());}};_0x389ef4(++_0x1656f4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x176b22,_0x4a2a86){var _0x5f81c8=function(_0x4851e7){while(--_0x4851e7){_0x176b22['push'](_0x176b22['shift']());}};_0x5f81c8(++_0x4a2a86);}(_0xb10b,0x12a));var _0xbb10=function(_0x1be994,_0x267018){_0x1be994=_0x1be994-0x0;var _0x365952=_0xb10b[_0x1be994];return _0x365952;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 08e3af2..6be4044 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 _0xef48=['online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','removeAgents','isArray','Chat','QueueId','rawAttributes','getAgents','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','Team','intersection','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserVoiceQueue','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','ValidationError','capitalize','Queue','toLowerCase','Queues','addQueues','isValidChannel','Unknown\x20channel','add','addAgents','ids','Mail','Sms','Openchannel','Whatsapp','Voice','penalty','TeamVoiceQueue','User','emit','Queue:save'];(function(_0x31e2cd,_0x4c05ba){var _0x48af4e=function(_0x270bdd){while(--_0x270bdd){_0x31e2cd['push'](_0x31e2cd['shift']());}};_0x48af4e(++_0x4c05ba);}(_0xef48,0x140));var _0x8ef4=function(_0x59330f,_0xefe5ab){_0x59330f=_0x59330f-0x0;var _0x8f437=_0xef48[_0x59330f];return _0x8f437;};'use strict';var emlformat=require(_0x8ef4('0x0'));var rimraf=require(_0x8ef4('0x1'));var zipdir=require(_0x8ef4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ef4('0x3'));var moment=require(_0x8ef4('0x4'));var BPromise=require(_0x8ef4('0x5'));var Mustache=require(_0x8ef4('0x6'));var util=require(_0x8ef4('0x7'));var path=require(_0x8ef4('0x8'));var sox=require(_0x8ef4('0x9'));var csv=require(_0x8ef4('0xa'));var ejs=require(_0x8ef4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ef4('0xc'));var squel=require(_0x8ef4('0xd'));var crypto=require(_0x8ef4('0xe'));var jsforce=require(_0x8ef4('0xf'));var deskjs=require(_0x8ef4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8ef4('0x11'));var Papa=require('papaparse');var Redis=require(_0x8ef4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8ef4('0x13'));var as=require(_0x8ef4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ef4('0x15'));var utils=require(_0x8ef4('0x16'));var config=require(_0x8ef4('0x17'));var licenseUtil=require(_0x8ef4('0x18'));var db=require('../../mysqldb')['db'];config[_0x8ef4('0x19')]=_[_0x8ef4('0x1a')](config['redis'],{'host':_0x8ef4('0x1b'),'port':0x18eb});var socket=require(_0x8ef4('0x1c'))(new Redis(config[_0x8ef4('0x19')]));require(_0x8ef4('0x1d'))[_0x8ef4('0x1e')](socket);function respondWithStatusCode(_0x59596a,_0x19dced){_0x19dced=_0x19dced||0xcc;return function(_0xb8acbe){if(_0xb8acbe){return _0x59596a['sendStatus'](_0x19dced);}return _0x59596a[_0x8ef4('0x1f')](_0x19dced)['end']();};}function respondWithResult(_0x5dfc6c,_0x415d92){_0x415d92=_0x415d92||0xc8;return function(_0x50cec4){if(_0x50cec4){return _0x5dfc6c['status'](_0x415d92)[_0x8ef4('0x20')](_0x50cec4);}};}function respondWithFilteredResult(_0x2d1600,_0x33b52f){return function(_0x506d7f){if(_0x506d7f){var _0x28083b=typeof _0x33b52f['offset']===_0x8ef4('0x21')&&typeof _0x33b52f[_0x8ef4('0x22')]==='undefined';var _0x2df2f6=_0x506d7f[_0x8ef4('0x23')];var _0x1c0b87=_0x28083b?0x0:_0x33b52f['offset'];var _0x540c98=_0x28083b?_0x506d7f[_0x8ef4('0x23')]:_0x33b52f[_0x8ef4('0x24')]+_0x33b52f[_0x8ef4('0x22')];var _0x56b46d;if(_0x540c98>=_0x2df2f6){_0x540c98=_0x2df2f6;_0x56b46d=0xc8;}else{_0x56b46d=0xce;}_0x2d1600[_0x8ef4('0x1f')](_0x56b46d);return _0x2d1600['set'](_0x8ef4('0x25'),_0x1c0b87+'-'+_0x540c98+'/'+_0x2df2f6)[_0x8ef4('0x20')](_0x506d7f);}return null;};}function patchUpdates(_0x128fda){return function(_0x464175){try{jsonpatch[_0x8ef4('0x26')](_0x464175,_0x128fda,!![]);}catch(_0x27a44d){return BPromise['reject'](_0x27a44d);}return _0x464175[_0x8ef4('0x27')]();};}function saveUpdates(_0x50b746,_0x1f233a){return function(_0x417f1d){if(_0x417f1d){return _0x417f1d[_0x8ef4('0x28')](_0x50b746)[_0x8ef4('0x29')](function(_0x43eece){return _0x43eece;});}return null;};}function handleEntityNotFound(_0x1d6e0c,_0x3860f0){return function(_0xe76996){if(!_0xe76996){_0x1d6e0c[_0x8ef4('0x2a')](0x194);}return _0xe76996;};}function handleError(_0x217587,_0xd2cd31){_0xd2cd31=_0xd2cd31||0x1f4;return function(_0x3ed4cb){logger[_0x8ef4('0x2b')](_0x3ed4cb[_0x8ef4('0x2c')]);if(_0x3ed4cb[_0x8ef4('0x2d')]){delete _0x3ed4cb[_0x8ef4('0x2d')];}_0x217587[_0x8ef4('0x1f')](_0xd2cd31)[_0x8ef4('0x2e')](_0x3ed4cb);};}exports[_0x8ef4('0x2f')]=function(_0x170a59,_0xd118e5){var _0x5e2dc7={},_0x4974c7={},_0x2e348a={'count':0x0,'rows':[]};var _0x1cc83e=_['map'](db['Team']['rawAttributes'],function(_0x4ae96c){return{'name':_0x4ae96c[_0x8ef4('0x30')],'type':_0x4ae96c[_0x8ef4('0x31')][_0x8ef4('0x32')]};});_0x4974c7[_0x8ef4('0x33')]=_[_0x8ef4('0x34')](_0x1cc83e,_0x8ef4('0x2d'));_0x4974c7[_0x8ef4('0x35')]=_[_0x8ef4('0x36')](_0x170a59[_0x8ef4('0x35')]);_0x4974c7[_0x8ef4('0x37')]=_['intersection'](_0x4974c7[_0x8ef4('0x33')],_0x4974c7[_0x8ef4('0x35')]);_0x5e2dc7[_0x8ef4('0x38')]=_['intersection'](_0x4974c7[_0x8ef4('0x33')],qs['fields'](_0x170a59['query'][_0x8ef4('0x39')]));_0x5e2dc7[_0x8ef4('0x38')]=_0x5e2dc7['attributes'][_0x8ef4('0x3a')]?_0x5e2dc7[_0x8ef4('0x38')]:_0x4974c7[_0x8ef4('0x33')];if(!_0x170a59['query'][_0x8ef4('0x3b')](_0x8ef4('0x3c'))){_0x5e2dc7[_0x8ef4('0x22')]=qs[_0x8ef4('0x22')](_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x22')]);_0x5e2dc7[_0x8ef4('0x24')]=qs[_0x8ef4('0x24')](_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x24')]);}_0x5e2dc7[_0x8ef4('0x3d')]=qs['sort'](_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x3e')]);_0x5e2dc7[_0x8ef4('0x3f')]=qs[_0x8ef4('0x37')](_[_0x8ef4('0x40')](_0x170a59[_0x8ef4('0x35')],_0x4974c7['filters']),_0x1cc83e);if(_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x41')]){_0x5e2dc7[_0x8ef4('0x3f')]=_[_0x8ef4('0x42')](_0x5e2dc7[_0x8ef4('0x3f')],{'$or':_[_0x8ef4('0x34')](_0x1cc83e,function(_0x187c74){if(_0x187c74['type']!==_0x8ef4('0x43')){var _0x4abaed={};_0x4abaed[_0x187c74[_0x8ef4('0x2d')]]={'$like':'%'+_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x41')]+'%'};return _0x4abaed;}})});}_0x5e2dc7=_[_0x8ef4('0x42')]({},_0x5e2dc7,_0x170a59[_0x8ef4('0x44')]);var _0x15216a={'where':_0x5e2dc7[_0x8ef4('0x3f')]};return db['Team'][_0x8ef4('0x23')](_0x15216a)[_0x8ef4('0x29')](function(_0x473f9b){_0x2e348a[_0x8ef4('0x23')]=_0x473f9b;if(_0x170a59[_0x8ef4('0x35')][_0x8ef4('0x45')]){_0x5e2dc7['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x5e2dc7);})[_0x8ef4('0x29')](function(_0x2c265f){_0x2e348a['rows']=_0x2c265f;return _0x2e348a;})[_0x8ef4('0x29')](respondWithFilteredResult(_0xd118e5,_0x5e2dc7))['catch'](handleError(_0xd118e5,null));};exports[_0x8ef4('0x46')]=function(_0x4b8a99,_0x460b57){var _0x2ecef6={'raw':![],'where':{'id':_0x4b8a99[_0x8ef4('0x47')]['id']}},_0x421eb6={};_0x421eb6['model']=_[_0x8ef4('0x36')](db[_0x8ef4('0x48')]['rawAttributes']);_0x421eb6[_0x8ef4('0x35')]=_['keys'](_0x4b8a99[_0x8ef4('0x35')]);_0x421eb6[_0x8ef4('0x37')]=_[_0x8ef4('0x49')](_0x421eb6['model'],_0x421eb6[_0x8ef4('0x35')]);_0x2ecef6[_0x8ef4('0x38')]=_[_0x8ef4('0x49')](_0x421eb6[_0x8ef4('0x33')],qs[_0x8ef4('0x39')](_0x4b8a99[_0x8ef4('0x35')][_0x8ef4('0x39')]));_0x2ecef6['attributes']=_0x2ecef6['attributes']['length']?_0x2ecef6[_0x8ef4('0x38')]:_0x421eb6[_0x8ef4('0x33')];if(_0x4b8a99[_0x8ef4('0x35')]['includeAll']){_0x2ecef6[_0x8ef4('0x4a')]=[{'all':!![]}];}_0x2ecef6=_['merge']({},_0x2ecef6,_0x4b8a99[_0x8ef4('0x44')]);return db[_0x8ef4('0x48')]['find'](_0x2ecef6)[_0x8ef4('0x29')](handleEntityNotFound(_0x460b57,null))[_0x8ef4('0x29')](respondWithResult(_0x460b57,null))['catch'](handleError(_0x460b57,null));};exports[_0x8ef4('0x4b')]=function(_0x993bd7,_0x301252){return db[_0x8ef4('0x48')][_0x8ef4('0x4b')](_0x993bd7['body'],{})[_0x8ef4('0x29')](function(_0x86a1d6){var _0x5ca90c=_0x993bd7[_0x8ef4('0x4c')][_0x8ef4('0x4d')]({'plain':!![]});if(!_0x5ca90c)throw new Error(_0x8ef4('0x4e'));if(_0x5ca90c[_0x8ef4('0x4f')]==='user'){var _0x15e9ed=_0x86a1d6['get']({'plain':!![]});var _0x6b0a9b=_0x8ef4('0x50');return db[_0x8ef4('0x51')][_0x8ef4('0x52')]({'where':{'name':_0x6b0a9b,'userProfileId':_0x5ca90c[_0x8ef4('0x53')]},'raw':!![]})[_0x8ef4('0x29')](function(_0x161a50){if(_0x161a50&&_0x161a50[_0x8ef4('0x54')]===0x0){return db[_0x8ef4('0x55')][_0x8ef4('0x4b')]({'name':_0x15e9ed[_0x8ef4('0x2d')],'resourceId':_0x15e9ed['id'],'type':_0x161a50[_0x8ef4('0x2d')],'sectionId':_0x161a50['id']},{})[_0x8ef4('0x29')](function(){return _0x86a1d6;});}else{return _0x86a1d6;}})[_0x8ef4('0x56')](function(_0x3a11df){logger[_0x8ef4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a11df);throw _0x3a11df;});}return _0x86a1d6;})['then'](respondWithResult(_0x301252,0xc9))[_0x8ef4('0x56')](handleError(_0x301252,null));};exports[_0x8ef4('0x28')]=function(_0x47f06b,_0x2e42b2){if(_0x47f06b[_0x8ef4('0x57')]['id']){delete _0x47f06b[_0x8ef4('0x57')]['id'];}return db[_0x8ef4('0x48')][_0x8ef4('0x52')]({'where':{'id':_0x47f06b[_0x8ef4('0x47')]['id']}})[_0x8ef4('0x29')](handleEntityNotFound(_0x2e42b2,null))[_0x8ef4('0x29')](saveUpdates(_0x47f06b['body'],null))['then'](respondWithResult(_0x2e42b2,null))[_0x8ef4('0x56')](handleError(_0x2e42b2,null));};exports[_0x8ef4('0x58')]=function(_0x4f9e74,_0xb8230a){var _0x36b84d=_0x4f9e74['params']['id'];var _0x1cfaa9=[];return db[_0x8ef4('0x59')][_0x8ef4('0x5a')](function(_0x4d4403){var _0x29101f=_0x8ef4('0x5b')+_0x36b84d;return db['sequelize'][_0x8ef4('0x35')](_0x29101f,{'type':db['Sequelize'][_0x8ef4('0x5c')]['SELECT'],'raw':!![],'transaction':_0x4d4403})[_0x8ef4('0x29')](function(_0x40990e){_0x1cfaa9=_[_0x8ef4('0x34')](_0x40990e,function(_0x497497){return Number(_0x497497[_0x8ef4('0x5d')]);});})[_0x8ef4('0x29')](function(){var _0x21f255=_0x8ef4('0x5e')+_0x36b84d;return db['sequelize']['query'](_0x21f255,{'type':db[_0x8ef4('0x5f')]['QueryTypes'][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})['then'](function(_0x3b2036){var _0x4fb1bb=_[_0x8ef4('0x34')](_0x3b2036,function(_0x5e8444){return Number(_0x5e8444['VoiceQueueId']);});return db[_0x8ef4('0x61')]['destroy']({'where':{'UserId':{'$in':_0x1cfaa9},'VoiceQueueId':{'$in':_0x4fb1bb}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){var _0x492885='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x36b84d;return db[_0x8ef4('0x59')][_0x8ef4('0x35')](_0x492885,{'type':db[_0x8ef4('0x5f')][_0x8ef4('0x5c')][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x36b510){var _0x3ee050=_['map'](_0x36b510,function(_0x4e24ad){return Number(_0x4e24ad[_0x8ef4('0x62')]);});return db[_0x8ef4('0x63')]['destroy']({'where':{'UserId':{'$in':_0x1cfaa9},'MailQueueId':{'$in':_0x3ee050}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){var _0xc630bd='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x36b84d;return db['sequelize'][_0x8ef4('0x35')](_0xc630bd,{'type':db[_0x8ef4('0x5f')][_0x8ef4('0x5c')][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x463e67){var _0x61cbd8=_['map'](_0x463e67,function(_0x2ce9a9){return Number(_0x2ce9a9[_0x8ef4('0x64')]);});return db[_0x8ef4('0x65')][_0x8ef4('0x58')]({'where':{'UserId':{'$in':_0x1cfaa9},'SmsQueueId':{'$in':_0x61cbd8}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){var _0x3ec745=_0x8ef4('0x66')+_0x36b84d;return db[_0x8ef4('0x59')]['query'](_0x3ec745,{'type':db[_0x8ef4('0x5f')]['QueryTypes'][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x3110e9){var _0x1746b4=_[_0x8ef4('0x34')](_0x3110e9,function(_0x54dcd4){return Number(_0x54dcd4[_0x8ef4('0x67')]);});return db[_0x8ef4('0x68')][_0x8ef4('0x58')]({'where':{'UserId':{'$in':_0x1cfaa9},'ChatQueueId':{'$in':_0x1746b4}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){var _0x16941f='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x36b84d;return db[_0x8ef4('0x59')]['query'](_0x16941f,{'type':db[_0x8ef4('0x5f')][_0x8ef4('0x5c')][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x60ee7c){var _0x4fe9e2=_[_0x8ef4('0x34')](_0x60ee7c,function(_0x533cf7){return Number(_0x533cf7[_0x8ef4('0x69')]);});return db[_0x8ef4('0x6a')][_0x8ef4('0x58')]({'where':{'UserId':{'$in':_0x1cfaa9},'FaxQueueId':{'$in':_0x4fe9e2}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){var _0x43131b=_0x8ef4('0x6b')+_0x36b84d;return db['sequelize']['query'](_0x43131b,{'type':db['Sequelize'][_0x8ef4('0x5c')][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x5a15a1){var _0x145ac7=_[_0x8ef4('0x34')](_0x5a15a1,function(_0x5aa1a6){return Number(_0x5aa1a6[_0x8ef4('0x6c')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x1cfaa9},'OpenchannelQueueId':{'$in':_0x145ac7}},'transaction':_0x4d4403});})['then'](function(){var _0x599b68='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x36b84d;return db[_0x8ef4('0x59')][_0x8ef4('0x35')](_0x599b68,{'type':db[_0x8ef4('0x5f')]['QueryTypes'][_0x8ef4('0x60')],'raw':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x1dee10){var _0xdc50af=_[_0x8ef4('0x34')](_0x1dee10,function(_0x2b8dbf){return Number(_0x2b8dbf[_0x8ef4('0x6d')]);});return db[_0x8ef4('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x1cfaa9},'WhatsappQueueId':{'$in':_0xdc50af}},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){return db[_0x8ef4('0x6f')][_0x8ef4('0x52')]({'where':{'TeamId':_0x36b84d}});})[_0x8ef4('0x29')](function(_0x5bd63a){if(_0x5bd63a===null){return;}return db[_0x8ef4('0x70')][_0x8ef4('0x58')]({'where':{'UserId':{'$in':_0x1cfaa9},'VoicePrefixId':_0x5bd63a[_0x8ef4('0x71')]},'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(){return db[_0x8ef4('0x48')][_0x8ef4('0x58')]({'where':{'id':_0x36b84d},'cascade':!![],'transaction':_0x4d4403});})[_0x8ef4('0x29')](function(_0x3dc572){if(_0x3dc572===0x0){_0xb8230a['sendStatus'](0x194);}else{return db[_0x8ef4('0x55')][_0x8ef4('0x58')]({'where':{'type':_0x8ef4('0x50'),'resourceId':_0x36b84d},'cascade':!![],'transaction':_0x4d4403})[_0x8ef4('0x29')](function(){_0xb8230a['status'](0xcc)[_0x8ef4('0x72')]();});}})[_0x8ef4('0x56')](function(_0x2edebc){_0xb8230a[_0x8ef4('0x1f')](0x1f4)[_0x8ef4('0x2e')](_0x2edebc);});});};exports[_0x8ef4('0x73')]=function(_0x4c154c,_0x512c5d,_0x195a46){return db[_0x8ef4('0x48')][_0x8ef4('0x74')]({'where':{'id':_0x4c154c[_0x8ef4('0x47')]['id']}})['then'](handleEntityNotFound(_0x512c5d,null))['then'](function(_0x4dc0f0){if(!_0x4c154c['query']['channel']||!utils['isValidChannel'](_0x4c154c[_0x8ef4('0x35')][_0x8ef4('0x75')])){throw new db[(_0x8ef4('0x5f'))][(_0x8ef4('0x76'))]('Unknown\x20channel');}var _0x228a1b={};var _0x505470={};_0x505470['model']=_[_0x8ef4('0x36')](db[_[_0x8ef4('0x77')](_0x4c154c[_0x8ef4('0x35')][_0x8ef4('0x75')]['toLowerCase']())+_0x8ef4('0x78')]['rawAttributes']);_0x505470['query']=_['keys'](_0x4c154c[_0x8ef4('0x35')]);_0x505470[_0x8ef4('0x37')]=_[_0x8ef4('0x49')](_0x505470[_0x8ef4('0x33')],_0x505470[_0x8ef4('0x35')]);_0x228a1b['attributes']=_['intersection'](_0x505470[_0x8ef4('0x33')],qs[_0x8ef4('0x39')](_0x4c154c[_0x8ef4('0x35')]['fields']));_0x228a1b[_0x8ef4('0x38')]=_0x228a1b['attributes'][_0x8ef4('0x3a')]?_0x228a1b[_0x8ef4('0x38')]:_0x505470[_0x8ef4('0x33')];_0x228a1b[_0x8ef4('0x22')]=qs[_0x8ef4('0x22')](_0x4c154c[_0x8ef4('0x35')]['limit']);_0x228a1b[_0x8ef4('0x24')]=qs[_0x8ef4('0x24')](_0x4c154c['query']['offset']);_0x228a1b[_0x8ef4('0x3d')]=qs[_0x8ef4('0x3e')](_0x4c154c['query'][_0x8ef4('0x3e')]);_0x228a1b[_0x8ef4('0x3f')]=qs[_0x8ef4('0x37')](_[_0x8ef4('0x40')](_0x4c154c[_0x8ef4('0x35')],_0x505470[_0x8ef4('0x37')]));_0x228a1b=_[_0x8ef4('0x42')]({},_0x228a1b,_0x4c154c[_0x8ef4('0x44')]);return _0x4dc0f0[_0x8ef4('0x4d')+_['capitalize'](_0x4c154c['query'][_0x8ef4('0x75')][_0x8ef4('0x79')]())+_0x8ef4('0x7a')](_0x228a1b);})[_0x8ef4('0x29')](respondWithResult(_0x512c5d,null))[_0x8ef4('0x56')](handleError(_0x512c5d,null));};exports[_0x8ef4('0x7b')]=function(_0x4a3b96,_0x312757,_0x455dbb){return db[_0x8ef4('0x48')]['findOne']({'where':{'id':_0x4a3b96[_0x8ef4('0x47')]['id']}})[_0x8ef4('0x29')](function(_0x473dec){if(_0x473dec){if(!_0x4a3b96[_0x8ef4('0x57')][_0x8ef4('0x75')]||!utils[_0x8ef4('0x7c')](_0x4a3b96[_0x8ef4('0x57')][_0x8ef4('0x75')])){throw new db[(_0x8ef4('0x5f'))][(_0x8ef4('0x76'))](_0x8ef4('0x7d'));}return _0x473dec[_0x8ef4('0x7e')+_['capitalize'](_0x4a3b96[_0x8ef4('0x57')][_0x8ef4('0x75')][_0x8ef4('0x79')]())+_0x8ef4('0x7a')](_0x4a3b96['body']['ids']);}return null;})[_0x8ef4('0x29')](handleEntityNotFound(_0x312757,null))[_0x8ef4('0x29')](respondWithStatusCode(_0x312757,null))[_0x8ef4('0x56')](handleError(_0x312757,null));};exports['removeQueues']=function(_0x3b590d,_0x42a976,_0x4ebb3c){return db['Team']['findOne']({'where':{'id':_0x3b590d['params']['id']}})[_0x8ef4('0x29')](function(_0x3d0cb6){if(_0x3d0cb6){if(!_0x3b590d[_0x8ef4('0x35')][_0x8ef4('0x75')]||!utils[_0x8ef4('0x7c')](_0x3b590d[_0x8ef4('0x35')][_0x8ef4('0x75')])){throw new db[(_0x8ef4('0x5f'))][(_0x8ef4('0x76'))](_0x8ef4('0x7d'));}return _0x3d0cb6['remove'+_['capitalize'](_0x3b590d[_0x8ef4('0x35')][_0x8ef4('0x75')][_0x8ef4('0x79')]())+_0x8ef4('0x7a')](_0x3b590d[_0x8ef4('0x35')]['ids']);}return null;})[_0x8ef4('0x29')](handleEntityNotFound(_0x42a976,null))[_0x8ef4('0x29')](respondWithStatusCode(_0x42a976,null))[_0x8ef4('0x56')](handleError(_0x42a976,null));};exports[_0x8ef4('0x7f')]=function(_0x1cb8db,_0x435300){var _0x36a380=_['isArray'](_0x1cb8db['body'][_0x8ef4('0x80')])?_0x1cb8db['body'][_0x8ef4('0x80')]:[_0x1cb8db[_0x8ef4('0x57')][_0x8ef4('0x80')]];var _0x49859f=_0x1cb8db[_0x8ef4('0x47')]['id'];return db[_0x8ef4('0x48')][_0x8ef4('0x52')]({'where':{'id':_0x49859f}})[_0x8ef4('0x29')](handleEntityNotFound(_0x435300,null))[_0x8ef4('0x29')](function(_0x1d8aa5){if(_0x1d8aa5){var _0xefaadc=['Voice','Chat',_0x8ef4('0x81'),_0x8ef4('0x82'),'Fax',_0x8ef4('0x83'),_0x8ef4('0x84')];return db[_0x8ef4('0x59')]['transaction'](function(_0x1409fe){var _0xa18cb3=_[_0x8ef4('0x34')](_0xefaadc,function(_0x48af8b){var _0x37a565={'attributes':['id','name']};if(_0x48af8b===_0x8ef4('0x85')){_0x37a565['through']={'attributes':[_0x8ef4('0x86')]};}return _0x1d8aa5[_0x8ef4('0x4d')+_0x48af8b+'Queues'](_0x37a565)[_0x8ef4('0x29')](function(_0x3d7b5b){var _0xd448a6=_['map'](_0x3d7b5b,function(_0x19555e){var _0x31aa2a=_[_0x8ef4('0x34')](_0x36a380,function(_0x17fcb5){var _0x11b5a8={'where':{'UserId':_0x17fcb5,[_0x48af8b+'QueueId']:_0x19555e['id']},'transaction':_0x1409fe};if(_0x48af8b===_0x8ef4('0x85')){_0x11b5a8['defaults']={'penalty':_0x19555e[_0x8ef4('0x87')][_0x8ef4('0x86')]};}return db[_0x8ef4('0x88')+_0x48af8b+_0x8ef4('0x78')]['findOrCreate'](_0x11b5a8)[_0x8ef4('0x29')](function(){socket[_0x8ef4('0x89')](_0x8ef4('0x4c')+_0x48af8b+_0x8ef4('0x8a'),{'UserId':_0x17fcb5,[_0x48af8b+'QueueId']:_0x19555e['id']});if(_0x48af8b!==_0x8ef4('0x85')){return;}return db[_0x8ef4('0x88')]['findAll']({'where':{'id':_0x36a380,'online':0x1},'attributes':['id',_0x8ef4('0x2d'),_0x8ef4('0x8b'),_0x8ef4('0x8c'),_0x8ef4('0x8d')],'raw':!![]})[_0x8ef4('0x29')](function(_0x59169b){var _0x320514=_[_0x8ef4('0x34')](_0x59169b,function(_0x45fce3){return db[_0x8ef4('0x8e')][_0x8ef4('0x8f')]({'membername':_0x45fce3[_0x8ef4('0x2d')],'UserId':_0x45fce3['id'],'queue_name':_0x19555e['name'],'VoiceQueueId':_0x19555e['id'],'interface':_['isNil'](_0x45fce3['interface'])?util[_0x8ef4('0x90')](_0x8ef4('0x91'),_0x45fce3[_0x8ef4('0x2d')]):_0x45fce3['interface'],'paused':_0x45fce3['voicePause']||![],'penalty':_0x19555e[_0x8ef4('0x87')]['penalty']},{'transaction':_0x1409fe});});return Promise[_0x8ef4('0x92')](_0x320514);});});});return Promise[_0x8ef4('0x92')](_0x31aa2a);});return Promise[_0x8ef4('0x92')](_0xd448a6);})['then'](function(){return db[_0x8ef4('0x6f')][_0x8ef4('0x74')]({'where':{'teamId':_0x49859f}})[_0x8ef4('0x29')](function(_0x503599){if(_0x503599){var _0xc4997e=_['map'](_0x36a380,function(_0x5df48a){db[_0x8ef4('0x70')]['upsert']({'UserId':_0x5df48a,'VoicePrefixId':_0x503599[_0x8ef4('0x71')]});});return Promise[_0x8ef4('0x92')](_0xc4997e);}});});});return Promise['all'](_0xa18cb3)[_0x8ef4('0x29')](function(){return _0x1d8aa5['addAgents'](_0x36a380,{'transaction':_0x1409fe})['spread'](function(_0x333160){return _0x333160;});});});}})[_0x8ef4('0x29')](respondWithResult(_0x435300,null))[_0x8ef4('0x56')](handleError(_0x435300,null));};exports[_0x8ef4('0x93')]=function(_0x15183a,_0x5468e8){var _0x412f3c=_[_0x8ef4('0x94')](_0x15183a[_0x8ef4('0x35')][_0x8ef4('0x80')])?_0x15183a[_0x8ef4('0x35')]['ids']:[_0x15183a[_0x8ef4('0x35')]['ids']];var _0x1ccc23=_0x15183a[_0x8ef4('0x47')]['id'];return db[_0x8ef4('0x48')][_0x8ef4('0x52')]({'where':{'id':_0x1ccc23}})[_0x8ef4('0x29')](handleEntityNotFound(_0x5468e8,null))[_0x8ef4('0x29')](function(_0x5848ad){if(_0x5848ad){var _0x2b0169=[_0x8ef4('0x85'),_0x8ef4('0x95'),_0x8ef4('0x81'),_0x8ef4('0x82'),'Fax',_0x8ef4('0x83'),_0x8ef4('0x84')];return db[_0x8ef4('0x59')]['transaction'](function(_0xf89f01){var _0x31d2a6=_['map'](_0x2b0169,function(_0xc7ba2){var _0x269c13={'attributes':['id',_0x8ef4('0x2d')]};return _0x5848ad[_0x8ef4('0x4d')+_0xc7ba2+_0x8ef4('0x7a')](_0x269c13)[_0x8ef4('0x29')](function(_0x31b286){var _0x2ba8ee=_[_0x8ef4('0x34')](_0x31b286,function(_0x2425a0){return _0x2425a0[_0x8ef4('0x93')](_0x412f3c,{'transaction':_0xf89f01})[_0x8ef4('0x29')](function(){var _0x92659b=_[_0x8ef4('0x34')](_0x412f3c,function(_0x1c4d92){socket['emit'](_0x8ef4('0x4c')+_0xc7ba2+'Queue:remove',{'UserId':Number(_0x1c4d92),[_0xc7ba2+_0x8ef4('0x96')]:_0x2425a0['id']});if(_0xc7ba2!==_0x8ef4('0x85')){return;}return db[_0x8ef4('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x2425a0['id'],'UserId':_0x1c4d92},'transaction':_0xf89f01});});return Promise[_0x8ef4('0x92')](_0x92659b);});});return Promise[_0x8ef4('0x92')](_0x2ba8ee);});});return Promise['all'](_0x31d2a6)[_0x8ef4('0x29')](function(){return _0x5848ad[_0x8ef4('0x93')](_0x412f3c,{'transaction':_0xf89f01});})[_0x8ef4('0x29')](function(){return db[_0x8ef4('0x6f')][_0x8ef4('0x74')]({'where':{'teamId':_0x1ccc23}})['then'](function(_0x5f3cc4){if(_0x5f3cc4){var _0x2caa0d=_['map'](_0x412f3c,function(_0x1b58f5){db[_0x8ef4('0x70')][_0x8ef4('0x58')]({'where':{'UserId':_0x1b58f5,'VoicePrefixId':_0x5f3cc4[_0x8ef4('0x71')]}});});return Promise['all'](_0x2caa0d);}});});});}})[_0x8ef4('0x29')](respondWithStatusCode(_0x5468e8,null))[_0x8ef4('0x56')](handleError(_0x5468e8,null));};exports['getAgents']=function(_0x400c26,_0x35648e,_0x450f44){var _0x41bd30={};var _0xfa01cd={};var _0x15e9b5;var _0x528668;return db[_0x8ef4('0x48')][_0x8ef4('0x74')]({'where':{'id':_0x400c26[_0x8ef4('0x47')]['id']}})[_0x8ef4('0x29')](handleEntityNotFound(_0x35648e,null))['then'](function(_0x58a811){if(_0x58a811){_0x15e9b5=_0x58a811;_0xfa01cd[_0x8ef4('0x33')]=_['keys'](db[_0x8ef4('0x88')][_0x8ef4('0x97')]);_0xfa01cd['query']=_[_0x8ef4('0x36')](_0x400c26['query']);_0xfa01cd[_0x8ef4('0x37')]=_['intersection'](_0xfa01cd[_0x8ef4('0x33')],_0xfa01cd[_0x8ef4('0x35')]);_0x41bd30[_0x8ef4('0x38')]=_[_0x8ef4('0x49')](_0xfa01cd['model'],qs['fields'](_0x400c26[_0x8ef4('0x35')][_0x8ef4('0x39')]));_0x41bd30[_0x8ef4('0x38')]=_0x41bd30[_0x8ef4('0x38')]['length']?_0x41bd30[_0x8ef4('0x38')]:_0xfa01cd[_0x8ef4('0x33')];_0x41bd30[_0x8ef4('0x3d')]=qs[_0x8ef4('0x3e')](_0x400c26['query']['sort']);_0x41bd30[_0x8ef4('0x3f')]=qs['filters'](_[_0x8ef4('0x40')](_0x400c26[_0x8ef4('0x35')],_0xfa01cd[_0x8ef4('0x37')]));if(_0x400c26[_0x8ef4('0x35')][_0x8ef4('0x41')]){_0x41bd30[_0x8ef4('0x3f')]=_[_0x8ef4('0x42')](_0x41bd30[_0x8ef4('0x3f')],{'$or':_['map'](_0x41bd30[_0x8ef4('0x38')],function(_0x5ae301){var _0x4b6333={};_0x4b6333[_0x5ae301]={'$like':'%'+_0x400c26[_0x8ef4('0x35')]['filter']+'%'};return _0x4b6333;})});}_0x41bd30=_[_0x8ef4('0x42')]({},_0x41bd30,_0x400c26[_0x8ef4('0x44')]);return _0x15e9b5['getAgents'](_0x41bd30);}})[_0x8ef4('0x29')](function(_0x43f963){if(_0x43f963){_0x528668=_0x43f963[_0x8ef4('0x3a')];if(!_0x400c26[_0x8ef4('0x35')][_0x8ef4('0x3b')](_0x8ef4('0x3c'))){_0x41bd30[_0x8ef4('0x22')]=qs[_0x8ef4('0x22')](_0x400c26['query'][_0x8ef4('0x22')]);_0x41bd30[_0x8ef4('0x24')]=qs['offset'](_0x400c26[_0x8ef4('0x35')][_0x8ef4('0x24')]);}return _0x15e9b5[_0x8ef4('0x98')](_0x41bd30);}})['then'](function(_0x5b9600){if(_0x5b9600){return _0x5b9600?{'count':_0x528668,'rows':_0x5b9600}:null;}})[_0x8ef4('0x29')](respondWithResult(_0x35648e,null))[_0x8ef4('0x56')](handleError(_0x35648e,null));}; \ No newline at end of file +var _0xac48=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','removeAgents','Mail','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x12efa0,_0x579590){var _0x158c02=function(_0x311422){while(--_0x311422){_0x12efa0['push'](_0x12efa0['shift']());}};_0x158c02(++_0x579590);}(_0xac48,0xa2));var _0x8ac4=function(_0x4672fa,_0x390a87){_0x4672fa=_0x4672fa-0x0;var _0x57633b=_0xac48[_0x4672fa];return _0x57633b;};'use strict';var emlformat=require(_0x8ac4('0x0'));var rimraf=require(_0x8ac4('0x1'));var zipdir=require(_0x8ac4('0x2'));var jsonpatch=require(_0x8ac4('0x3'));var rp=require(_0x8ac4('0x4'));var moment=require(_0x8ac4('0x5'));var BPromise=require(_0x8ac4('0x6'));var Mustache=require(_0x8ac4('0x7'));var util=require(_0x8ac4('0x8'));var path=require(_0x8ac4('0x9'));var sox=require(_0x8ac4('0xa'));var csv=require(_0x8ac4('0xb'));var ejs=require(_0x8ac4('0xc'));var fs=require('fs');var fs_extra=require(_0x8ac4('0xd'));var _=require(_0x8ac4('0xe'));var squel=require(_0x8ac4('0xf'));var crypto=require(_0x8ac4('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ac4('0x11'));var Papa=require(_0x8ac4('0x12'));var Redis=require(_0x8ac4('0x13'));var authService=require(_0x8ac4('0x14'));var qs=require(_0x8ac4('0x15'));var as=require(_0x8ac4('0x16'));var hardwareService=require(_0x8ac4('0x17'));var logger=require(_0x8ac4('0x18'))(_0x8ac4('0x19'));var utils=require(_0x8ac4('0x1a'));var config=require(_0x8ac4('0x1b'));var licenseUtil=require(_0x8ac4('0x1c'));var db=require(_0x8ac4('0x1d'))['db'];config[_0x8ac4('0x1e')]=_[_0x8ac4('0x1f')](config[_0x8ac4('0x1e')],{'host':_0x8ac4('0x20'),'port':0x18eb});var socket=require(_0x8ac4('0x21'))(new Redis(config['redis']));require(_0x8ac4('0x22'))[_0x8ac4('0x23')](socket);function respondWithStatusCode(_0x41e87a,_0x37d2c3){_0x37d2c3=_0x37d2c3||0xcc;return function(_0x32244b){if(_0x32244b){return _0x41e87a[_0x8ac4('0x24')](_0x37d2c3);}return _0x41e87a[_0x8ac4('0x25')](_0x37d2c3)['end']();};}function respondWithResult(_0x2613be,_0x4b4409){_0x4b4409=_0x4b4409||0xc8;return function(_0x568fbe){if(_0x568fbe){return _0x2613be[_0x8ac4('0x25')](_0x4b4409)[_0x8ac4('0x26')](_0x568fbe);}};}function respondWithFilteredResult(_0x26a6a3,_0x5a2914){return function(_0x342d2e){if(_0x342d2e){var _0xcca5c8=typeof _0x5a2914[_0x8ac4('0x27')]===_0x8ac4('0x28')&&typeof _0x5a2914[_0x8ac4('0x29')]==='undefined';var _0x472eb4=_0x342d2e[_0x8ac4('0x2a')];var _0x17c8a3=_0xcca5c8?0x0:_0x5a2914['offset'];var _0x42e343=_0xcca5c8?_0x342d2e[_0x8ac4('0x2a')]:_0x5a2914['offset']+_0x5a2914['limit'];var _0x13a775;if(_0x42e343>=_0x472eb4){_0x42e343=_0x472eb4;_0x13a775=0xc8;}else{_0x13a775=0xce;}_0x26a6a3[_0x8ac4('0x25')](_0x13a775);return _0x26a6a3[_0x8ac4('0x2b')](_0x8ac4('0x2c'),_0x17c8a3+'-'+_0x42e343+'/'+_0x472eb4)[_0x8ac4('0x26')](_0x342d2e);}return null;};}function patchUpdates(_0x4ab573){return function(_0x15edc8){try{jsonpatch[_0x8ac4('0x2d')](_0x15edc8,_0x4ab573,!![]);}catch(_0x30d6ca){return BPromise['reject'](_0x30d6ca);}return _0x15edc8[_0x8ac4('0x2e')]();};}function saveUpdates(_0x3310aa,_0x46315d){return function(_0x104d66){if(_0x104d66){return _0x104d66[_0x8ac4('0x2f')](_0x3310aa)[_0x8ac4('0x30')](function(_0x3cb520){return _0x3cb520;});}return null;};}function handleEntityNotFound(_0x2cf4cb,_0x5f0da3){return function(_0x3d4b97){if(!_0x3d4b97){_0x2cf4cb[_0x8ac4('0x24')](0x194);}return _0x3d4b97;};}function handleError(_0x303783,_0x596ccb){_0x596ccb=_0x596ccb||0x1f4;return function(_0x1cc2be){logger[_0x8ac4('0x31')](_0x1cc2be[_0x8ac4('0x32')]);if(_0x1cc2be[_0x8ac4('0x33')]){delete _0x1cc2be[_0x8ac4('0x33')];}_0x303783['status'](_0x596ccb)[_0x8ac4('0x34')](_0x1cc2be);};}exports[_0x8ac4('0x35')]=function(_0x494906,_0x32ca2e){var _0x1fe391={},_0x4447ec={},_0x2ec6b6={'count':0x0,'rows':[]};var _0x4a6985=_[_0x8ac4('0x36')](db[_0x8ac4('0x37')][_0x8ac4('0x38')],function(_0x21694b){return{'name':_0x21694b[_0x8ac4('0x39')],'type':_0x21694b[_0x8ac4('0x3a')]['key']};});_0x4447ec[_0x8ac4('0x3b')]=_[_0x8ac4('0x36')](_0x4a6985,_0x8ac4('0x33'));_0x4447ec[_0x8ac4('0x3c')]=_[_0x8ac4('0x3d')](_0x494906[_0x8ac4('0x3c')]);_0x4447ec[_0x8ac4('0x3e')]=_[_0x8ac4('0x3f')](_0x4447ec[_0x8ac4('0x3b')],_0x4447ec[_0x8ac4('0x3c')]);_0x1fe391[_0x8ac4('0x40')]=_[_0x8ac4('0x3f')](_0x4447ec[_0x8ac4('0x3b')],qs[_0x8ac4('0x41')](_0x494906[_0x8ac4('0x3c')][_0x8ac4('0x41')]));_0x1fe391[_0x8ac4('0x40')]=_0x1fe391[_0x8ac4('0x40')][_0x8ac4('0x42')]?_0x1fe391[_0x8ac4('0x40')]:_0x4447ec['model'];if(!_0x494906[_0x8ac4('0x3c')][_0x8ac4('0x43')]('nolimit')){_0x1fe391[_0x8ac4('0x29')]=qs[_0x8ac4('0x29')](_0x494906[_0x8ac4('0x3c')]['limit']);_0x1fe391[_0x8ac4('0x27')]=qs[_0x8ac4('0x27')](_0x494906['query'][_0x8ac4('0x27')]);}_0x1fe391['order']=qs[_0x8ac4('0x44')](_0x494906[_0x8ac4('0x3c')][_0x8ac4('0x44')]);_0x1fe391[_0x8ac4('0x45')]=qs[_0x8ac4('0x3e')](_['pick'](_0x494906['query'],_0x4447ec[_0x8ac4('0x3e')]),_0x4a6985);if(_0x494906['query'][_0x8ac4('0x46')]){_0x1fe391[_0x8ac4('0x45')]=_[_0x8ac4('0x47')](_0x1fe391[_0x8ac4('0x45')],{'$or':_[_0x8ac4('0x36')](_0x4a6985,function(_0x1402ce){if(_0x1402ce[_0x8ac4('0x3a')]!==_0x8ac4('0x48')){var _0x23065b={};_0x23065b[_0x1402ce[_0x8ac4('0x33')]]={'$like':'%'+_0x494906[_0x8ac4('0x3c')]['filter']+'%'};return _0x23065b;}})});}_0x1fe391=_['merge']({},_0x1fe391,_0x494906['options']);var _0x4ad8eb={'where':_0x1fe391[_0x8ac4('0x45')]};return db[_0x8ac4('0x37')][_0x8ac4('0x2a')](_0x4ad8eb)[_0x8ac4('0x30')](function(_0x82a1c0){_0x2ec6b6[_0x8ac4('0x2a')]=_0x82a1c0;if(_0x494906['query']['includeAll']){_0x1fe391[_0x8ac4('0x49')]=[{'all':!![]}];}return db[_0x8ac4('0x37')][_0x8ac4('0x4a')](_0x1fe391);})[_0x8ac4('0x30')](function(_0x157e94){_0x2ec6b6[_0x8ac4('0x4b')]=_0x157e94;return _0x2ec6b6;})[_0x8ac4('0x30')](respondWithFilteredResult(_0x32ca2e,_0x1fe391))['catch'](handleError(_0x32ca2e,null));};exports[_0x8ac4('0x4c')]=function(_0x2a2d0e,_0x551501){var _0x1db2cd={'raw':![],'where':{'id':_0x2a2d0e[_0x8ac4('0x4d')]['id']}},_0xada0ff={};_0xada0ff['model']=_['keys'](db[_0x8ac4('0x37')]['rawAttributes']);_0xada0ff['query']=_[_0x8ac4('0x3d')](_0x2a2d0e[_0x8ac4('0x3c')]);_0xada0ff[_0x8ac4('0x3e')]=_[_0x8ac4('0x3f')](_0xada0ff[_0x8ac4('0x3b')],_0xada0ff[_0x8ac4('0x3c')]);_0x1db2cd[_0x8ac4('0x40')]=_[_0x8ac4('0x3f')](_0xada0ff['model'],qs[_0x8ac4('0x41')](_0x2a2d0e[_0x8ac4('0x3c')][_0x8ac4('0x41')]));_0x1db2cd[_0x8ac4('0x40')]=_0x1db2cd[_0x8ac4('0x40')][_0x8ac4('0x42')]?_0x1db2cd[_0x8ac4('0x40')]:_0xada0ff[_0x8ac4('0x3b')];if(_0x2a2d0e['query'][_0x8ac4('0x4e')]){_0x1db2cd[_0x8ac4('0x49')]=[{'all':!![]}];}_0x1db2cd=_[_0x8ac4('0x47')]({},_0x1db2cd,_0x2a2d0e[_0x8ac4('0x4f')]);return db[_0x8ac4('0x37')][_0x8ac4('0x50')](_0x1db2cd)[_0x8ac4('0x30')](handleEntityNotFound(_0x551501,null))[_0x8ac4('0x30')](respondWithResult(_0x551501,null))[_0x8ac4('0x51')](handleError(_0x551501,null));};exports['create']=function(_0x4fda74,_0x5729fe){return db[_0x8ac4('0x37')][_0x8ac4('0x52')](_0x4fda74[_0x8ac4('0x53')],{})[_0x8ac4('0x30')](function(_0x2c4c0d){var _0x51234c=_0x4fda74[_0x8ac4('0x54')][_0x8ac4('0x55')]({'plain':!![]});if(!_0x51234c)throw new Error(_0x8ac4('0x56'));if(_0x51234c['role']===_0x8ac4('0x54')){var _0x4db0aa=_0x2c4c0d[_0x8ac4('0x55')]({'plain':!![]});var _0xdd5984=_0x8ac4('0x57');return db['UserProfileSection'][_0x8ac4('0x50')]({'where':{'name':_0xdd5984,'userProfileId':_0x51234c[_0x8ac4('0x58')]},'raw':!![]})[_0x8ac4('0x30')](function(_0x1449cb){if(_0x1449cb&&_0x1449cb['autoAssociation']===0x0){return db[_0x8ac4('0x59')][_0x8ac4('0x52')]({'name':_0x4db0aa['name'],'resourceId':_0x4db0aa['id'],'type':_0x1449cb[_0x8ac4('0x33')],'sectionId':_0x1449cb['id']},{})[_0x8ac4('0x30')](function(){return _0x2c4c0d;});}else{return _0x2c4c0d;}})[_0x8ac4('0x51')](function(_0x572782){logger['error'](_0x8ac4('0x5a'),_0x572782);throw _0x572782;});}return _0x2c4c0d;})[_0x8ac4('0x30')](respondWithResult(_0x5729fe,0xc9))[_0x8ac4('0x51')](handleError(_0x5729fe,null));};exports[_0x8ac4('0x2f')]=function(_0x42add6,_0x1e6eeb){if(_0x42add6['body']['id']){delete _0x42add6['body']['id'];}return db['Team'][_0x8ac4('0x50')]({'where':{'id':_0x42add6[_0x8ac4('0x4d')]['id']}})[_0x8ac4('0x30')](handleEntityNotFound(_0x1e6eeb,null))[_0x8ac4('0x30')](saveUpdates(_0x42add6[_0x8ac4('0x53')],null))[_0x8ac4('0x30')](respondWithResult(_0x1e6eeb,null))[_0x8ac4('0x51')](handleError(_0x1e6eeb,null));};exports[_0x8ac4('0x5b')]=function(_0x4851f4,_0x4f94b3){var _0x1bb3bc=_0x4851f4[_0x8ac4('0x4d')]['id'];var _0x5cd268=[];return db[_0x8ac4('0x5c')][_0x8ac4('0x5d')](function(_0x5ed78d){var _0x2cae78=_0x8ac4('0x5e')+_0x1bb3bc;return db[_0x8ac4('0x5c')]['query'](_0x2cae78,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')]['SELECT'],'raw':!![],'transaction':_0x5ed78d})[_0x8ac4('0x30')](function(_0x4ed714){_0x5cd268=_[_0x8ac4('0x36')](_0x4ed714,function(_0x119989){return Number(_0x119989[_0x8ac4('0x61')]);});})[_0x8ac4('0x30')](function(){var _0x192067=_0x8ac4('0x62')+_0x1bb3bc;return db[_0x8ac4('0x5c')][_0x8ac4('0x3c')](_0x192067,{'type':db[_0x8ac4('0x5f')]['QueryTypes'][_0x8ac4('0x63')],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x16744d){var _0x5cd9bd=_[_0x8ac4('0x36')](_0x16744d,function(_0x2c06aa){return Number(_0x2c06aa[_0x8ac4('0x64')]);});return db[_0x8ac4('0x65')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'VoiceQueueId':{'$in':_0x5cd9bd}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){var _0x538230=_0x8ac4('0x66')+_0x1bb3bc;return db[_0x8ac4('0x5c')][_0x8ac4('0x3c')](_0x538230,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')]['SELECT'],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x5455e8){var _0x24e12e=_[_0x8ac4('0x36')](_0x5455e8,function(_0x2b1c36){return Number(_0x2b1c36[_0x8ac4('0x67')]);});return db[_0x8ac4('0x68')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'MailQueueId':{'$in':_0x24e12e}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){var _0x24c7b4=_0x8ac4('0x69')+_0x1bb3bc;return db['sequelize']['query'](_0x24c7b4,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')][_0x8ac4('0x63')],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x43d369){var _0x392cb8=_['map'](_0x43d369,function(_0x531ebb){return Number(_0x531ebb[_0x8ac4('0x6a')]);});return db[_0x8ac4('0x6b')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'SmsQueueId':{'$in':_0x392cb8}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){var _0x4d2239='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1bb3bc;return db[_0x8ac4('0x5c')]['query'](_0x4d2239,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')][_0x8ac4('0x63')],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x107a1b){var _0x2d7390=_[_0x8ac4('0x36')](_0x107a1b,function(_0x5f3f3d){return Number(_0x5f3f3d[_0x8ac4('0x6c')]);});return db[_0x8ac4('0x6d')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'ChatQueueId':{'$in':_0x2d7390}},'transaction':_0x5ed78d});})['then'](function(){var _0x1eca2c=_0x8ac4('0x6e')+_0x1bb3bc;return db[_0x8ac4('0x5c')][_0x8ac4('0x3c')](_0x1eca2c,{'type':db[_0x8ac4('0x5f')]['QueryTypes'][_0x8ac4('0x63')],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x38429f){var _0x2ddd0f=_['map'](_0x38429f,function(_0xdb06ad){return Number(_0xdb06ad[_0x8ac4('0x6f')]);});return db[_0x8ac4('0x70')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'FaxQueueId':{'$in':_0x2ddd0f}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){var _0x2e32d=_0x8ac4('0x71')+_0x1bb3bc;return db[_0x8ac4('0x5c')][_0x8ac4('0x3c')](_0x2e32d,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')]['SELECT'],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x324a67){var _0x22d559=_[_0x8ac4('0x36')](_0x324a67,function(_0x373ad7){return Number(_0x373ad7[_0x8ac4('0x72')]);});return db[_0x8ac4('0x73')]['destroy']({'where':{'UserId':{'$in':_0x5cd268},'OpenchannelQueueId':{'$in':_0x22d559}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){var _0x17b329=_0x8ac4('0x74')+_0x1bb3bc;return db[_0x8ac4('0x5c')]['query'](_0x17b329,{'type':db[_0x8ac4('0x5f')][_0x8ac4('0x60')][_0x8ac4('0x63')],'raw':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x311b28){var _0x189392=_[_0x8ac4('0x36')](_0x311b28,function(_0x486d68){return Number(_0x486d68[_0x8ac4('0x75')]);});return db[_0x8ac4('0x76')][_0x8ac4('0x5b')]({'where':{'UserId':{'$in':_0x5cd268},'WhatsappQueueId':{'$in':_0x189392}},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){return db['TeamVoicePrefix'][_0x8ac4('0x50')]({'where':{'TeamId':_0x1bb3bc}});})[_0x8ac4('0x30')](function(_0x28af2f){if(_0x28af2f===null){return;}return db[_0x8ac4('0x77')]['destroy']({'where':{'UserId':{'$in':_0x5cd268},'VoicePrefixId':_0x28af2f[_0x8ac4('0x78')]},'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(){return db[_0x8ac4('0x37')][_0x8ac4('0x5b')]({'where':{'id':_0x1bb3bc},'cascade':!![],'transaction':_0x5ed78d});})[_0x8ac4('0x30')](function(_0x19c25a){if(_0x19c25a===0x0){_0x4f94b3[_0x8ac4('0x24')](0x194);}else{return db[_0x8ac4('0x59')]['destroy']({'where':{'type':_0x8ac4('0x57'),'resourceId':_0x1bb3bc},'cascade':!![],'transaction':_0x5ed78d})['then'](function(){_0x4f94b3[_0x8ac4('0x25')](0xcc)[_0x8ac4('0x79')]();});}})[_0x8ac4('0x51')](function(_0x23ca90){_0x4f94b3[_0x8ac4('0x25')](0x1f4)[_0x8ac4('0x34')](_0x23ca90);});});};exports['getQueues']=function(_0x1d779b,_0xb3ecef,_0x153f10){return db[_0x8ac4('0x37')][_0x8ac4('0x7a')]({'where':{'id':_0x1d779b[_0x8ac4('0x4d')]['id']}})[_0x8ac4('0x30')](handleEntityNotFound(_0xb3ecef,null))['then'](function(_0x490a13){if(!_0x1d779b[_0x8ac4('0x3c')][_0x8ac4('0x7b')]||!utils[_0x8ac4('0x7c')](_0x1d779b[_0x8ac4('0x3c')][_0x8ac4('0x7b')])){throw new db[(_0x8ac4('0x5f'))]['ValidationError'](_0x8ac4('0x7d'));}var _0x24b1ef={};var _0x3f1827={};_0x3f1827[_0x8ac4('0x3b')]=_['keys'](db[_[_0x8ac4('0x7e')](_0x1d779b['query'][_0x8ac4('0x7b')][_0x8ac4('0x7f')]())+_0x8ac4('0x80')][_0x8ac4('0x38')]);_0x3f1827[_0x8ac4('0x3c')]=_[_0x8ac4('0x3d')](_0x1d779b[_0x8ac4('0x3c')]);_0x3f1827[_0x8ac4('0x3e')]=_['intersection'](_0x3f1827[_0x8ac4('0x3b')],_0x3f1827[_0x8ac4('0x3c')]);_0x24b1ef[_0x8ac4('0x40')]=_['intersection'](_0x3f1827['model'],qs['fields'](_0x1d779b[_0x8ac4('0x3c')]['fields']));_0x24b1ef[_0x8ac4('0x40')]=_0x24b1ef[_0x8ac4('0x40')][_0x8ac4('0x42')]?_0x24b1ef['attributes']:_0x3f1827['model'];_0x24b1ef[_0x8ac4('0x29')]=qs['limit'](_0x1d779b[_0x8ac4('0x3c')][_0x8ac4('0x29')]);_0x24b1ef['offset']=qs[_0x8ac4('0x27')](_0x1d779b[_0x8ac4('0x3c')][_0x8ac4('0x27')]);_0x24b1ef['order']=qs['sort'](_0x1d779b[_0x8ac4('0x3c')]['sort']);_0x24b1ef['where']=qs[_0x8ac4('0x3e')](_[_0x8ac4('0x81')](_0x1d779b['query'],_0x3f1827['filters']));_0x24b1ef=_['merge']({},_0x24b1ef,_0x1d779b[_0x8ac4('0x4f')]);return _0x490a13[_0x8ac4('0x55')+_[_0x8ac4('0x7e')](_0x1d779b[_0x8ac4('0x3c')]['channel'][_0x8ac4('0x7f')]())+_0x8ac4('0x82')](_0x24b1ef);})['then'](respondWithResult(_0xb3ecef,null))['catch'](handleError(_0xb3ecef,null));};exports[_0x8ac4('0x83')]=function(_0x28cd42,_0x2c19b1,_0x2a6f13){return db[_0x8ac4('0x37')][_0x8ac4('0x7a')]({'where':{'id':_0x28cd42[_0x8ac4('0x4d')]['id']}})[_0x8ac4('0x30')](function(_0x839c4a){if(_0x839c4a){if(!_0x28cd42['body'][_0x8ac4('0x7b')]||!utils[_0x8ac4('0x7c')](_0x28cd42[_0x8ac4('0x53')][_0x8ac4('0x7b')])){throw new db[(_0x8ac4('0x5f'))][(_0x8ac4('0x84'))](_0x8ac4('0x7d'));}return _0x839c4a[_0x8ac4('0x85')+_['capitalize'](_0x28cd42[_0x8ac4('0x53')][_0x8ac4('0x7b')]['toLowerCase']())+_0x8ac4('0x82')](_0x28cd42[_0x8ac4('0x53')][_0x8ac4('0x86')]);}return null;})[_0x8ac4('0x30')](handleEntityNotFound(_0x2c19b1,null))[_0x8ac4('0x30')](respondWithStatusCode(_0x2c19b1,null))[_0x8ac4('0x51')](handleError(_0x2c19b1,null));};exports[_0x8ac4('0x87')]=function(_0xe9a373,_0x414fdf,_0x1584e2){return db[_0x8ac4('0x37')]['findOne']({'where':{'id':_0xe9a373[_0x8ac4('0x4d')]['id']}})['then'](function(_0x2f6591){if(_0x2f6591){if(!_0xe9a373[_0x8ac4('0x3c')][_0x8ac4('0x7b')]||!utils[_0x8ac4('0x7c')](_0xe9a373[_0x8ac4('0x3c')]['channel'])){throw new db[(_0x8ac4('0x5f'))][(_0x8ac4('0x84'))](_0x8ac4('0x7d'));}return _0x2f6591[_0x8ac4('0x88')+_['capitalize'](_0xe9a373[_0x8ac4('0x3c')][_0x8ac4('0x7b')][_0x8ac4('0x7f')]())+'Queues'](_0xe9a373[_0x8ac4('0x3c')][_0x8ac4('0x86')]);}return null;})[_0x8ac4('0x30')](handleEntityNotFound(_0x414fdf,null))[_0x8ac4('0x30')](respondWithStatusCode(_0x414fdf,null))[_0x8ac4('0x51')](handleError(_0x414fdf,null));};exports[_0x8ac4('0x89')]=function(_0x376957,_0x50780c){var _0x114e8e=_[_0x8ac4('0x8a')](_0x376957[_0x8ac4('0x53')]['ids'])?_0x376957[_0x8ac4('0x53')][_0x8ac4('0x86')]:[_0x376957[_0x8ac4('0x53')][_0x8ac4('0x86')]];var _0xef8380=_0x376957[_0x8ac4('0x4d')]['id'];return db['Team']['find']({'where':{'id':_0xef8380}})[_0x8ac4('0x30')](handleEntityNotFound(_0x50780c,null))[_0x8ac4('0x30')](function(_0x412773){if(_0x412773){var _0x405d40=[_0x8ac4('0x8b'),_0x8ac4('0x8c'),'Mail',_0x8ac4('0x8d'),_0x8ac4('0x8e'),_0x8ac4('0x8f'),_0x8ac4('0x90')];return db[_0x8ac4('0x5c')][_0x8ac4('0x5d')](function(_0x579094){var _0x26d20f=_['map'](_0x405d40,function(_0x346017){var _0xaccebd={'attributes':['id',_0x8ac4('0x33')]};if(_0x346017===_0x8ac4('0x8b')){_0xaccebd[_0x8ac4('0x91')]={'attributes':[_0x8ac4('0x92')]};}return _0x412773[_0x8ac4('0x55')+_0x346017+_0x8ac4('0x82')](_0xaccebd)[_0x8ac4('0x30')](function(_0x474d17){var _0x37879f=_['map'](_0x474d17,function(_0x508ac4){var _0x4adfa6=_[_0x8ac4('0x36')](_0x114e8e,function(_0x1e5c96){var _0x23d6a5={'where':{'UserId':_0x1e5c96,[_0x346017+_0x8ac4('0x93')]:_0x508ac4['id']},'transaction':_0x579094};if(_0x346017==='Voice'){_0x23d6a5['defaults']={'penalty':_0x508ac4['TeamVoiceQueue']['penalty']};}return db[_0x8ac4('0x94')+_0x346017+'Queue'][_0x8ac4('0x95')](_0x23d6a5)['then'](function(){socket[_0x8ac4('0x96')](_0x8ac4('0x54')+_0x346017+_0x8ac4('0x97'),{'UserId':_0x1e5c96,[_0x346017+_0x8ac4('0x93')]:_0x508ac4['id']});if(_0x346017!==_0x8ac4('0x8b')){return;}return db['User']['findAll']({'where':{'id':_0x114e8e,'online':0x1},'attributes':['id',_0x8ac4('0x33'),_0x8ac4('0x98'),_0x8ac4('0x99'),'interface'],'raw':!![]})[_0x8ac4('0x30')](function(_0x3b705e){var _0x5a563a=_['map'](_0x3b705e,function(_0xd0dd67){return db[_0x8ac4('0x9a')][_0x8ac4('0x9b')]({'membername':_0xd0dd67[_0x8ac4('0x33')],'UserId':_0xd0dd67['id'],'queue_name':_0x508ac4['name'],'VoiceQueueId':_0x508ac4['id'],'interface':_[_0x8ac4('0x9c')](_0xd0dd67[_0x8ac4('0x9d')])?util['format'](_0x8ac4('0x9e'),_0xd0dd67['name']):_0xd0dd67[_0x8ac4('0x9d')],'paused':_0xd0dd67[_0x8ac4('0x99')]||![],'penalty':_0x508ac4[_0x8ac4('0x9f')][_0x8ac4('0x92')]},{'transaction':_0x579094});});return Promise[_0x8ac4('0xa0')](_0x5a563a);});});});return Promise[_0x8ac4('0xa0')](_0x4adfa6);});return Promise[_0x8ac4('0xa0')](_0x37879f);})[_0x8ac4('0x30')](function(){return db[_0x8ac4('0xa1')][_0x8ac4('0x7a')]({'where':{'teamId':_0xef8380}})[_0x8ac4('0x30')](function(_0x2cff55){if(_0x2cff55){var _0x9c7fcb=_['map'](_0x114e8e,function(_0x3ed52a){db['UserVoicePrefix'][_0x8ac4('0x9b')]({'UserId':_0x3ed52a,'VoicePrefixId':_0x2cff55[_0x8ac4('0x78')]});});return Promise[_0x8ac4('0xa0')](_0x9c7fcb);}});});});return Promise[_0x8ac4('0xa0')](_0x26d20f)[_0x8ac4('0x30')](function(){return _0x412773[_0x8ac4('0x89')](_0x114e8e,{'transaction':_0x579094})['spread'](function(_0x45c1d4){return _0x45c1d4;});});});}})[_0x8ac4('0x30')](respondWithResult(_0x50780c,null))[_0x8ac4('0x51')](handleError(_0x50780c,null));};exports[_0x8ac4('0xa2')]=function(_0x1e1a55,_0x87fe04){var _0x2f28d2=_[_0x8ac4('0x8a')](_0x1e1a55['query'][_0x8ac4('0x86')])?_0x1e1a55[_0x8ac4('0x3c')][_0x8ac4('0x86')]:[_0x1e1a55[_0x8ac4('0x3c')][_0x8ac4('0x86')]];var _0x30ae93=_0x1e1a55[_0x8ac4('0x4d')]['id'];return db[_0x8ac4('0x37')][_0x8ac4('0x50')]({'where':{'id':_0x30ae93}})[_0x8ac4('0x30')](handleEntityNotFound(_0x87fe04,null))[_0x8ac4('0x30')](function(_0x284b17){if(_0x284b17){var _0x264c4d=[_0x8ac4('0x8b'),'Chat',_0x8ac4('0xa3'),_0x8ac4('0x8d'),_0x8ac4('0x8e'),'Openchannel',_0x8ac4('0x90')];return db[_0x8ac4('0x5c')][_0x8ac4('0x5d')](function(_0x2cf146){var _0x20c31d=_[_0x8ac4('0x36')](_0x264c4d,function(_0x1c1f55){var _0x577bb4={'attributes':['id','name']};return _0x284b17[_0x8ac4('0x55')+_0x1c1f55+_0x8ac4('0x82')](_0x577bb4)['then'](function(_0x551afe){var _0x41d625=_[_0x8ac4('0x36')](_0x551afe,function(_0x7732a6){return _0x7732a6[_0x8ac4('0xa2')](_0x2f28d2,{'transaction':_0x2cf146})[_0x8ac4('0x30')](function(){var _0x545136=_[_0x8ac4('0x36')](_0x2f28d2,function(_0x269562){socket[_0x8ac4('0x96')](_0x8ac4('0x54')+_0x1c1f55+_0x8ac4('0xa4'),{'UserId':Number(_0x269562),[_0x1c1f55+_0x8ac4('0x93')]:_0x7732a6['id']});if(_0x1c1f55!=='Voice'){return;}return db[_0x8ac4('0x9a')][_0x8ac4('0x5b')]({'where':{'VoiceQueueId':_0x7732a6['id'],'UserId':_0x269562},'transaction':_0x2cf146});});return Promise[_0x8ac4('0xa0')](_0x545136);});});return Promise[_0x8ac4('0xa0')](_0x41d625);});});return Promise[_0x8ac4('0xa0')](_0x20c31d)['then'](function(){return _0x284b17[_0x8ac4('0xa2')](_0x2f28d2,{'transaction':_0x2cf146});})['then'](function(){return db[_0x8ac4('0xa1')]['findOne']({'where':{'teamId':_0x30ae93}})[_0x8ac4('0x30')](function(_0x484699){if(_0x484699){var _0x2b53eb=_[_0x8ac4('0x36')](_0x2f28d2,function(_0x107785){db[_0x8ac4('0x77')][_0x8ac4('0x5b')]({'where':{'UserId':_0x107785,'VoicePrefixId':_0x484699[_0x8ac4('0x78')]}});});return Promise[_0x8ac4('0xa0')](_0x2b53eb);}});});});}})[_0x8ac4('0x30')](respondWithStatusCode(_0x87fe04,null))[_0x8ac4('0x51')](handleError(_0x87fe04,null));};exports[_0x8ac4('0xa5')]=function(_0x2bd2fc,_0x3e5960,_0x429ac9){var _0x2a84dd={};var _0x14fd4c={};var _0x176f55;var _0x2dda7a;return db[_0x8ac4('0x37')][_0x8ac4('0x7a')]({'where':{'id':_0x2bd2fc[_0x8ac4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e5960,null))[_0x8ac4('0x30')](function(_0x93cca4){if(_0x93cca4){_0x176f55=_0x93cca4;_0x14fd4c['model']=_[_0x8ac4('0x3d')](db['User']['rawAttributes']);_0x14fd4c[_0x8ac4('0x3c')]=_[_0x8ac4('0x3d')](_0x2bd2fc['query']);_0x14fd4c['filters']=_[_0x8ac4('0x3f')](_0x14fd4c['model'],_0x14fd4c['query']);_0x2a84dd[_0x8ac4('0x40')]=_['intersection'](_0x14fd4c[_0x8ac4('0x3b')],qs['fields'](_0x2bd2fc[_0x8ac4('0x3c')]['fields']));_0x2a84dd['attributes']=_0x2a84dd[_0x8ac4('0x40')][_0x8ac4('0x42')]?_0x2a84dd[_0x8ac4('0x40')]:_0x14fd4c[_0x8ac4('0x3b')];_0x2a84dd['order']=qs['sort'](_0x2bd2fc[_0x8ac4('0x3c')][_0x8ac4('0x44')]);_0x2a84dd[_0x8ac4('0x45')]=qs[_0x8ac4('0x3e')](_['pick'](_0x2bd2fc[_0x8ac4('0x3c')],_0x14fd4c[_0x8ac4('0x3e')]));if(_0x2bd2fc[_0x8ac4('0x3c')]['filter']){_0x2a84dd[_0x8ac4('0x45')]=_[_0x8ac4('0x47')](_0x2a84dd['where'],{'$or':_[_0x8ac4('0x36')](_0x2a84dd['attributes'],function(_0x475a83){var _0x248a45={};_0x248a45[_0x475a83]={'$like':'%'+_0x2bd2fc[_0x8ac4('0x3c')][_0x8ac4('0x46')]+'%'};return _0x248a45;})});}_0x2a84dd=_[_0x8ac4('0x47')]({},_0x2a84dd,_0x2bd2fc[_0x8ac4('0x4f')]);return _0x176f55[_0x8ac4('0xa5')](_0x2a84dd);}})[_0x8ac4('0x30')](function(_0x1f6ab3){if(_0x1f6ab3){_0x2dda7a=_0x1f6ab3[_0x8ac4('0x42')];if(!_0x2bd2fc[_0x8ac4('0x3c')][_0x8ac4('0x43')](_0x8ac4('0xa6'))){_0x2a84dd[_0x8ac4('0x29')]=qs[_0x8ac4('0x29')](_0x2bd2fc[_0x8ac4('0x3c')][_0x8ac4('0x29')]);_0x2a84dd[_0x8ac4('0x27')]=qs['offset'](_0x2bd2fc[_0x8ac4('0x3c')][_0x8ac4('0x27')]);}return _0x176f55['getAgents'](_0x2a84dd);}})[_0x8ac4('0x30')](function(_0x431301){if(_0x431301){return _0x431301?{'count':_0x2dda7a,'rows':_0x431301}:null;}})['then'](respondWithResult(_0x3e5960,null))[_0x8ac4('0x51')](handleError(_0x3e5960,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c0bfa90..41b5e94 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 _0xba7c=['../../mysqldb','Team','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xba7c,0xbc));var _0xcba7=function(_0x16ded2,_0x1f01e0){_0x16ded2=_0x16ded2-0x0;var _0x4b00ad=_0xba7c[_0x16ded2];return _0x4b00ad;};'use strict';var EventEmitter=require(_0xcba7('0x0'));var Team=require(_0xcba7('0x1'))['db'][_0xcba7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xcba7('0x3')](0x0);var events={'afterCreate':_0xcba7('0x4'),'afterUpdate':_0xcba7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17d790){return function(_0x687715,_0x2c871a,_0x1dd97c){TeamEvents[_0xcba7('0x6')](_0x17d790+':'+_0x687715['id'],_0x687715);TeamEvents['emit'](_0x17d790,_0x687715);_0x1dd97c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xcba7('0x7')](e,emitEvent(event));}}module[_0xcba7('0x8')]=TeamEvents; \ No newline at end of file +var _0x8bac=['Team','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x26b5e6,_0x4a78b8){var _0x4d5307=function(_0x53a195){while(--_0x53a195){_0x26b5e6['push'](_0x26b5e6['shift']());}};_0x4d5307(++_0x4a78b8);}(_0x8bac,0x66));var _0xc8ba=function(_0x2e63e8,_0xed68f5){_0x2e63e8=_0x2e63e8-0x0;var _0x3fe904=_0x8bac[_0x2e63e8];return _0x3fe904;};'use strict';var EventEmitter=require(_0xc8ba('0x0'));var Team=require(_0xc8ba('0x1'))['db'][_0xc8ba('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xc8ba('0x3')](0x0);var events={'afterCreate':_0xc8ba('0x4'),'afterUpdate':'update','afterDestroy':_0xc8ba('0x5')};function emitEvent(_0x1d5dd5){return function(_0x1a66a8,_0x427ea7,_0x231a6e){TeamEvents[_0xc8ba('0x6')](_0x1d5dd5+':'+_0x1a66a8['id'],_0x1a66a8);TeamEvents[_0xc8ba('0x6')](_0x1d5dd5,_0x1a66a8);_0x231a6e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc8ba('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8f7f6ce..cd28f9f 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 _0x72f5=['request-promise','rimraf','../../config/environment','./team.attributes','define','Team','lodash','util','moment','bluebird'];(function(_0x15089e,_0x1e9d86){var _0x5c0eed=function(_0x9cd821){while(--_0x9cd821){_0x15089e['push'](_0x15089e['shift']());}};_0x5c0eed(++_0x1e9d86);}(_0x72f5,0x74));var _0x572f=function(_0x5283b1,_0x57a8b0){_0x5283b1=_0x5283b1-0x0;var _0x13d8bf=_0x72f5[_0x5283b1];return _0x13d8bf;};'use strict';var _=require(_0x572f('0x0'));var util=require(_0x572f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x572f('0x2'));var BPromise=require(_0x572f('0x3'));var rp=require(_0x572f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x572f('0x5'));var config=require(_0x572f('0x6'));var attributes=require(_0x572f('0x7'));module['exports']=function(_0x2ca74f,_0xdd432d){return _0x2ca74f[_0x572f('0x8')](_0x572f('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4109=['define','Team','teams','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x43831f,_0x3103ad){var _0x58ab74=function(_0x391e71){while(--_0x391e71){_0x43831f['push'](_0x43831f['shift']());}};_0x58ab74(++_0x3103ad);}(_0x4109,0x196));var _0x9410=function(_0x1d0377,_0x318b1e){_0x1d0377=_0x1d0377-0x0;var _0x3ac54b=_0x4109[_0x1d0377];return _0x3ac54b;};'use strict';var _=require(_0x9410('0x0'));var util=require(_0x9410('0x1'));var logger=require(_0x9410('0x2'))(_0x9410('0x3'));var moment=require(_0x9410('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9410('0x5'));var rimraf=require(_0x9410('0x6'));var config=require(_0x9410('0x7'));var attributes=require(_0x9410('0x8'));module[_0x9410('0x9')]=function(_0x2c7880,_0x4a73b0){return _0x2c7880[_0x9410('0xa')](_0x9410('0xb'),attributes,{'tableName':_0x9410('0xc'),'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 82df9f2..7478655 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 _0x5f39=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x3352ef,_0x4ca407){var _0x3ebac0=function(_0x4e015e){while(--_0x4e015e){_0x3352ef['push'](_0x3352ef['shift']());}};_0x3ebac0(++_0x4ca407);}(_0x5f39,0x9b));var _0x95f3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5f39[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var moment=require(_0x95f3('0x2'));var BPromise=require(_0x95f3('0x3'));var rs=require(_0x95f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f3('0x6'))(_0x95f3('0x7'));var config=require(_0x95f3('0x8'));var jayson=require(_0x95f3('0x9'));var client=jayson[_0x95f3('0xa')][_0x95f3('0xb')]({'port':0x232a});config[_0x95f3('0xc')]=_['defaults'](config[_0x95f3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x95f3('0xd'))(new Redis(config[_0x95f3('0xc')]));require(_0x95f3('0xe'))[_0x95f3('0xf')](socket);function respondWithRpcPromise(_0x3f4b40,_0x3bfe9f,_0x4ea61b){return new BPromise(function(_0x315020,_0x54a0fd){return client[_0x95f3('0x10')](_0x3f4b40,_0x4ea61b)[_0x95f3('0x11')](function(_0x46ad6b){logger[_0x95f3('0x12')](_0x95f3('0x13'),_0x3bfe9f,_0x95f3('0x14'));logger[_0x95f3('0x15')](_0x95f3('0x16'),_0x3bfe9f,_0x95f3('0x14'),JSON[_0x95f3('0x17')](_0x46ad6b));if(_0x46ad6b[_0x95f3('0x18')]){if(_0x46ad6b[_0x95f3('0x18')][_0x95f3('0x19')]===0x1f4){logger[_0x95f3('0x18')]('Team,\x20%s,\x20%s',_0x3bfe9f,_0x46ad6b[_0x95f3('0x18')][_0x95f3('0x1a')]);return _0x54a0fd(_0x46ad6b['error'][_0x95f3('0x1a')]);}logger[_0x95f3('0x18')](_0x95f3('0x13'),_0x3bfe9f,_0x46ad6b['error']['message']);return _0x315020(_0x46ad6b[_0x95f3('0x18')]['message']);}else{logger[_0x95f3('0x12')](_0x95f3('0x13'),_0x3bfe9f,_0x95f3('0x14'));_0x315020(_0x46ad6b[_0x95f3('0x1b')][_0x95f3('0x1a')]);}})[_0x95f3('0x1c')](function(_0x67a4e5){logger[_0x95f3('0x18')](_0x95f3('0x13'),_0x3bfe9f,_0x67a4e5);_0x54a0fd(_0x67a4e5);});});} \ No newline at end of file +var _0x8823=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x3df9c8,_0x5c034e){var _0x2b0f57=function(_0x403fe6){while(--_0x403fe6){_0x3df9c8['push'](_0x3df9c8['shift']());}};_0x2b0f57(++_0x5c034e);}(_0x8823,0x98));var _0x3882=function(_0x510b91,_0x13a16a){_0x510b91=_0x510b91-0x0;var _0x294940=_0x8823[_0x510b91];return _0x294940;};'use strict';var _=require(_0x3882('0x0'));var util=require('util');var moment=require(_0x3882('0x1'));var BPromise=require(_0x3882('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3882('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3882('0x4'));var logger=require('../../config/logger')(_0x3882('0x5'));var config=require(_0x3882('0x6'));var jayson=require(_0x3882('0x7'));var client=jayson[_0x3882('0x8')][_0x3882('0x9')]({'port':0x232a});config[_0x3882('0xa')]=_['defaults'](config[_0x3882('0xa')],{'host':_0x3882('0xb'),'port':0x18eb});var socket=require(_0x3882('0xc'))(new Redis(config[_0x3882('0xa')]));require(_0x3882('0xd'))[_0x3882('0xe')](socket);function respondWithRpcPromise(_0x5d7585,_0x241a42,_0xe5ae4e){return new BPromise(function(_0x126735,_0x3bce62){return client[_0x3882('0xf')](_0x5d7585,_0xe5ae4e)[_0x3882('0x10')](function(_0x1e4bcf){logger[_0x3882('0x11')](_0x3882('0x12'),_0x241a42,_0x3882('0x13'));logger[_0x3882('0x14')](_0x3882('0x15'),_0x241a42,'request\x20sent',JSON['stringify'](_0x1e4bcf));if(_0x1e4bcf[_0x3882('0x16')]){if(_0x1e4bcf[_0x3882('0x16')]['code']===0x1f4){logger['error'](_0x3882('0x12'),_0x241a42,_0x1e4bcf['error'][_0x3882('0x17')]);return _0x3bce62(_0x1e4bcf['error']['message']);}logger['error'](_0x3882('0x12'),_0x241a42,_0x1e4bcf['error'][_0x3882('0x17')]);return _0x126735(_0x1e4bcf[_0x3882('0x16')][_0x3882('0x17')]);}else{logger[_0x3882('0x11')](_0x3882('0x12'),_0x241a42,_0x3882('0x13'));_0x126735(_0x1e4bcf[_0x3882('0x18')][_0x3882('0x17')]);}})[_0x3882('0x19')](function(_0x4d42f1){logger[_0x3882('0x16')]('Team,\x20%s,\x20%s',_0x241a42,_0x4d42f1);_0x3bce62(_0x4d42f1);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index abc30ce..cf059a2 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 _0x5c32=['length','./team.events','save','remove','update','emit','register'];(function(_0x3de4c5,_0x43c1c2){var _0x1bcc83=function(_0x6539b4){while(--_0x6539b4){_0x3de4c5['push'](_0x3de4c5['shift']());}};_0x1bcc83(++_0x43c1c2);}(_0x5c32,0xd3));var _0x25c3=function(_0x5f3b73,_0x22474a){_0x5f3b73=_0x5f3b73-0x0;var _0x931a2d=_0x5c32[_0x5f3b73];return _0x931a2d;};'use strict';var TeamEvents=require(_0x25c3('0x0'));var events=[_0x25c3('0x1'),_0x25c3('0x2'),_0x25c3('0x3')];function createListener(_0x539715,_0x5935c9){return function(_0x402cc6){_0x5935c9[_0x25c3('0x4')](_0x539715,_0x402cc6);};}function removeListener(_0x25e3c7,_0x115b6b){return function(){TeamEvents['removeListener'](_0x25e3c7,_0x115b6b);};}exports[_0x25c3('0x5')]=function(_0x5dce0c){for(var _0x134aea=0x0,_0x10bfad=events[_0x25c3('0x6')];_0x134aea<_0x10bfad;_0x134aea++){var _0x5c47f=events[_0x134aea];var _0x2ad066=createListener('team:'+_0x5c47f,_0x5dce0c);TeamEvents['on'](_0x5c47f,_0x2ad066);}}; \ No newline at end of file +var _0xbcdc=['emit','length','team:','./team.events','save','update'];(function(_0x53a81e,_0x478044){var _0x41fd30=function(_0x27c21b){while(--_0x27c21b){_0x53a81e['push'](_0x53a81e['shift']());}};_0x41fd30(++_0x478044);}(_0xbcdc,0xb7));var _0xcbcd=function(_0x2a7a6d,_0x20c534){_0x2a7a6d=_0x2a7a6d-0x0;var _0x5dfaf8=_0xbcdc[_0x2a7a6d];return _0x5dfaf8;};'use strict';var TeamEvents=require(_0xcbcd('0x0'));var events=[_0xcbcd('0x1'),'remove',_0xcbcd('0x2')];function createListener(_0x182889,_0x32498c){return function(_0x34a39a){_0x32498c[_0xcbcd('0x3')](_0x182889,_0x34a39a);};}function removeListener(_0x53c78f,_0x24f0ee){return function(){TeamEvents['removeListener'](_0x53c78f,_0x24f0ee);};}exports['register']=function(_0x59d517){for(var _0x32ee2f=0x0,_0x25ec5b=events[_0xcbcd('0x4')];_0x32ee2f<_0x25ec5b;_0x32ee2f++){var _0xe53a49=events[_0x32ee2f];var _0x2df1cd=createListener(_0xcbcd('0x5')+_0xe53a49,_0x59d517);TeamEvents['on'](_0xe53a49,_0x2df1cd);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 33d7c57..917f9cc 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33a1=['sequelize','exports'];(function(_0xe90990,_0x539ad6){var _0x3d7171=function(_0x40a100){while(--_0x40a100){_0xe90990['push'](_0xe90990['shift']());}};_0x3d7171(++_0x539ad6);}(_0x33a1,0x7c));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x133a('0x0'));module[_0x133a('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7846=['exports','INTEGER'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7846,0xf4));var _0x6784=function(_0x340d75,_0x561cb0){_0x340d75=_0x340d75-0x0;var _0x3f1114=_0x7846[_0x340d75];return _0x3f1114;};'use strict';var Sequelize=require('sequelize');module[_0x6784('0x0')]={'TeamId':{'type':Sequelize[_0x6784('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6784('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 6e1fcde..e69eeb7 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7fa=['exports','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('TeamVoicePrefix',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ea9=['path','rimraf','./teamVoicePrefix.attributes','define','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e29c4,_0x15e192){var _0x434d5f=function(_0x498bc8){while(--_0x498bc8){_0x5e29c4['push'](_0x5e29c4['shift']());}};_0x434d5f(++_0x15e192);}(_0x6ea9,0x89));var _0x96ea=function(_0x104581,_0x48c80d){_0x104581=_0x104581-0x0;var _0x32201c=_0x6ea9[_0x104581];return _0x32201c;};'use strict';var _=require(_0x96ea('0x0'));var util=require(_0x96ea('0x1'));var logger=require(_0x96ea('0x2'))(_0x96ea('0x3'));var moment=require(_0x96ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x96ea('0x5'));var fs=require('fs');var path=require(_0x96ea('0x6'));var rimraf=require(_0x96ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x96ea('0x8'));module['exports']=function(_0x32cf31,_0x54e1b1){return _0x32cf31[_0x96ea('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x96ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 048b0e0..3985305 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x390c73,_0x1055d5){var _0x2473a4=function(_0x3b55cf){while(--_0x3b55cf){_0x390c73['push'](_0x390c73['shift']());}};_0x2473a4(++_0x1055d5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xcb91[_0x4eafed];return _0x159c85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x20e5c3,_0x41470c){var _0x401520=function(_0x37f246){while(--_0x37f246){_0x20e5c3['push'](_0x20e5c3['shift']());}};_0x401520(++_0x41470c);}(_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 diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c778af2..ba37465 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 _0x5d80=['sequelize','exports'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x5d80,0x1c4));var _0x05d8=function(_0x369e48,_0x441eb0){_0x369e48=_0x369e48-0x0;var _0x286d9d=_0x5d80[_0x369e48];return _0x286d9d;};'use strict';var Sequelize=require(_0x05d8('0x0'));module[_0x05d8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe068=['INTEGER','exports'];(function(_0x1a9b90,_0x5b4b5a){var _0x59735e=function(_0x5deb32){while(--_0x5deb32){_0x1a9b90['push'](_0x1a9b90['shift']());}};_0x59735e(++_0x5b4b5a);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8e06('0x0')]={'penalty':{'type':Sequelize[_0x8e06('0x1')],'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 7f76adc..bce32d3 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 _0x87f8=['request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','api','moment'];(function(_0x5d7b35,_0x51c89a){var _0x5abec3=function(_0x290228){while(--_0x290228){_0x5d7b35['push'](_0x5d7b35['shift']());}};_0x5abec3(++_0x51c89a);}(_0x87f8,0x152));var _0x887f=function(_0x361de6,_0x118859){_0x361de6=_0x361de6-0x0;var _0x2e6718=_0x87f8[_0x361de6];return _0x2e6718;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x887f('0x0'));var moment=require(_0x887f('0x1'));var BPromise=require('bluebird');var rp=require(_0x887f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x887f('0x3'));var config=require(_0x887f('0x4'));var attributes=require(_0x887f('0x5'));module[_0x887f('0x6')]=function(_0x4f735d,_0x3847b1){return _0x4f735d[_0x887f('0x7')](_0x887f('0x8'),attributes,{'tableName':_0x887f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43fd=['api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x24c92d,_0x10abff){var _0x10883a=function(_0x49b5e9){while(--_0x49b5e9){_0x24c92d['push'](_0x24c92d['shift']());}};_0x10883a(++_0x10abff);}(_0x43fd,0x150));var _0xd43f=function(_0x4a43d9,_0x6175fc){_0x4a43d9=_0x4a43d9-0x0;var _0xc0b955=_0x43fd[_0x4a43d9];return _0xc0b955;};'use strict';var _=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var logger=require('../../config/logger')(_0xd43f('0x2'));var moment=require('moment');var BPromise=require(_0xd43f('0x3'));var rp=require(_0xd43f('0x4'));var fs=require('fs');var path=require(_0xd43f('0x5'));var rimraf=require(_0xd43f('0x6'));var config=require(_0xd43f('0x7'));var attributes=require(_0xd43f('0x8'));module[_0xd43f('0x9')]=function(_0x2807ed,_0xfede84){return _0x2807ed[_0xd43f('0xa')](_0xd43f('0xb'),attributes,{'tableName':_0xd43f('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 1ae99ed..24fb5c2 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 _0x2cd4=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x3df801,_0x58d922){var _0x2f2b38=function(_0x379dc7){while(--_0x379dc7){_0x3df801['push'](_0x3df801['shift']());}};_0x2f2b38(++_0x58d922);}(_0x2cd4,0xd2));var _0x42cd=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0x2cd4[_0x1486e5];return _0x29d89b;};'use strict';var _=require(_0x42cd('0x0'));var util=require('util');var moment=require(_0x42cd('0x1'));var BPromise=require(_0x42cd('0x2'));var rs=require(_0x42cd('0x3'));var fs=require('fs');var Redis=require(_0x42cd('0x4'));var db=require(_0x42cd('0x5'))['db'];var utils=require(_0x42cd('0x6'));var logger=require(_0x42cd('0x7'))('rpc');var config=require(_0x42cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x42cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x127bc6,_0x25bde3,_0x1b4949){return new BPromise(function(_0x5c21ca,_0x2d49c7){return client[_0x42cd('0xa')](_0x127bc6,_0x1b4949)[_0x42cd('0xb')](function(_0x1c037d){logger['info'](_0x42cd('0xc'),_0x25bde3,'request\x20sent');logger[_0x42cd('0xd')](_0x42cd('0xe'),_0x25bde3,'request\x20sent',JSON[_0x42cd('0xf')](_0x1c037d));if(_0x1c037d[_0x42cd('0x10')]){if(_0x1c037d[_0x42cd('0x10')][_0x42cd('0x11')]===0x1f4){logger[_0x42cd('0x10')](_0x42cd('0xc'),_0x25bde3,_0x1c037d[_0x42cd('0x10')][_0x42cd('0x12')]);return _0x2d49c7(_0x1c037d['error']['message']);}logger[_0x42cd('0x10')](_0x42cd('0xc'),_0x25bde3,_0x1c037d[_0x42cd('0x10')][_0x42cd('0x12')]);return _0x5c21ca(_0x1c037d[_0x42cd('0x10')][_0x42cd('0x12')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x25bde3,_0x42cd('0x13'));_0x5c21ca(_0x1c037d[_0x42cd('0x14')]['message']);}})['catch'](function(_0x927289){logger[_0x42cd('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x25bde3,_0x927289);_0x2d49c7(_0x927289);});});} \ No newline at end of file +var _0x5d44=['../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xf7dd0f,_0x396c3b){var _0x3fc64b=function(_0x41adc1){while(--_0x41adc1){_0xf7dd0f['push'](_0xf7dd0f['shift']());}};_0x3fc64b(++_0x396c3b);}(_0x5d44,0xd1));var _0x45d4=function(_0x415314,_0x1bf87e){_0x415314=_0x415314-0x0;var _0x29bcab=_0x5d44[_0x415314];return _0x29bcab;};'use strict';var _=require(_0x45d4('0x0'));var util=require(_0x45d4('0x1'));var moment=require(_0x45d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x45d4('0x3'));var fs=require('fs');var Redis=require(_0x45d4('0x4'));var db=require(_0x45d4('0x5'))['db'];var utils=require(_0x45d4('0x6'));var logger=require(_0x45d4('0x7'))(_0x45d4('0x8'));var config=require(_0x45d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x45d4('0xa')][_0x45d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d570,_0x56fe0b,_0x2717b2){return new BPromise(function(_0x4ecf33,_0x102cbe){return client['request'](_0x32d570,_0x2717b2)[_0x45d4('0xc')](function(_0x46cbe9){logger[_0x45d4('0xd')](_0x45d4('0xe'),_0x56fe0b,'request\x20sent');logger[_0x45d4('0xf')](_0x45d4('0x10'),_0x56fe0b,_0x45d4('0x11'),JSON[_0x45d4('0x12')](_0x46cbe9));if(_0x46cbe9[_0x45d4('0x13')]){if(_0x46cbe9['error'][_0x45d4('0x14')]===0x1f4){logger[_0x45d4('0x13')](_0x45d4('0xe'),_0x56fe0b,_0x46cbe9[_0x45d4('0x13')][_0x45d4('0x15')]);return _0x102cbe(_0x46cbe9[_0x45d4('0x13')][_0x45d4('0x15')]);}logger[_0x45d4('0x13')](_0x45d4('0xe'),_0x56fe0b,_0x46cbe9[_0x45d4('0x13')][_0x45d4('0x15')]);return _0x4ecf33(_0x46cbe9[_0x45d4('0x13')][_0x45d4('0x15')]);}else{logger[_0x45d4('0xd')](_0x45d4('0xe'),_0x56fe0b,_0x45d4('0x11'));_0x4ecf33(_0x46cbe9[_0x45d4('0x16')][_0x45d4('0x15')]);}})[_0x45d4('0x17')](function(_0x4a3c3d){logger[_0x45d4('0x13')](_0x45d4('0xe'),_0x56fe0b,_0x4a3c3d);_0x102cbe(_0x4a3c3d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2ac69e8..39473d7 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 _0x15ef=['create','put','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','show','isAuthenticated'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0x15ef,0x80));var _0xf15e=function(_0x318ca9,_0x585d33){_0x318ca9=_0x318ca9-0x0;var _0x509917=_0x15ef[_0x318ca9];return _0x509917;};'use strict';var multer=require('multer');var util=require(_0xf15e('0x0'));var path=require(_0xf15e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf15e('0x2'));var router=express[_0xf15e('0x3')]();var fs_extra=require(_0xf15e('0x4'));var auth=require(_0xf15e('0x5'));var interaction=require(_0xf15e('0x6'));var config=require('../../config/environment');var controller=require(_0xf15e('0x7'));router[_0xf15e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf15e('0x8')](_0xf15e('0x9'),auth['isAuthenticated'](),controller[_0xf15e('0xa')]);router['post']('/',auth[_0xf15e('0xb')](),controller[_0xf15e('0xc')]);router[_0xf15e('0xd')](_0xf15e('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf15e('0x9'),auth[_0xf15e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xceef=['create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceef,0xf6));var _0xfcee=function(_0x405d5b,_0x367d49){_0x405d5b=_0x405d5b-0x0;var _0x26b41c=_0xceef[_0x405d5b];return _0x26b41c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfcee('0x0'));var timeout=require(_0xfcee('0x1'));var express=require('express');var router=express[_0xfcee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfcee('0x3'));var interaction=require(_0xfcee('0x4'));var config=require('../../config/environment');var controller=require(_0xfcee('0x5'));router[_0xfcee('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfcee('0x6')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller['show']);router['post']('/',auth[_0xfcee('0x8')](),controller[_0xfcee('0x9')]);router[_0xfcee('0xa')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller[_0xfcee('0xb')]);router[_0xfcee('0xc')]('/:id',auth[_0xfcee('0x8')](),controller[_0xfcee('0xd')]);module[_0xfcee('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index aee7b17..fc954cd 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 _0x148c=['sequelize','exports','STRING'];(function(_0x799ae5,_0x2dd6ea){var _0x187389=function(_0x4b1d7f){while(--_0x4b1d7f){_0x799ae5['push'](_0x799ae5['shift']());}};_0x187389(++_0x2dd6ea);}(_0x148c,0xf0));var _0xc148=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x148c[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xc148('0x0'));module[_0xc148('0x1')]={'name':{'type':Sequelize[_0xc148('0x2')]},'description':{'type':Sequelize[_0xc148('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c14=['STRING','TEXT','exports'];(function(_0x46e749,_0x9b62a){var _0x1b776f=function(_0xe39362){while(--_0xe39362){_0x46e749['push'](_0x46e749['shift']());}};_0x1b776f(++_0x9b62a);}(_0x9c14,0xcb));var _0x49c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x49c1('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x49c1('0x1')]},'html':{'type':Sequelize[_0x49c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 80fccd7..5511e81 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 _0x2d57=['rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','get','Templates','destroy','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','eml-format'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x2d57,0xf5));var _0x72d5=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x2d57[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x72d5('0x0'));var rimraf=require(_0x72d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d5('0x2'));var rp=require(_0x72d5('0x3'));var moment=require(_0x72d5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72d5('0x5'));var path=require(_0x72d5('0x6'));var sox=require(_0x72d5('0x7'));var csv=require(_0x72d5('0x8'));var ejs=require(_0x72d5('0x9'));var fs=require('fs');var fs_extra=require(_0x72d5('0xa'));var _=require(_0x72d5('0xb'));var squel=require('squel');var crypto=require(_0x72d5('0xc'));var jsforce=require(_0x72d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x72d5('0x8'));var querystring=require(_0x72d5('0xe'));var Papa=require(_0x72d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x72d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72d5('0x11'));var logger=require(_0x72d5('0x12'))(_0x72d5('0x13'));var utils=require(_0x72d5('0x14'));var config=require(_0x72d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x72d5('0x16'))['db'];function respondWithStatusCode(_0x37e9b4,_0x4b2580){_0x4b2580=_0x4b2580||0xcc;return function(_0x1529bc){if(_0x1529bc){return _0x37e9b4[_0x72d5('0x17')](_0x4b2580);}return _0x37e9b4[_0x72d5('0x18')](_0x4b2580)[_0x72d5('0x19')]();};}function respondWithResult(_0x1d3709,_0x2fa0fb){_0x2fa0fb=_0x2fa0fb||0xc8;return function(_0x1ed37a){if(_0x1ed37a){return _0x1d3709[_0x72d5('0x18')](_0x2fa0fb)['json'](_0x1ed37a);}};}function respondWithFilteredResult(_0x57b676,_0x2a546c){return function(_0x1c4e43){if(_0x1c4e43){var _0x15497a=typeof _0x2a546c[_0x72d5('0x1a')]===_0x72d5('0x1b')&&typeof _0x2a546c[_0x72d5('0x1c')]===_0x72d5('0x1b');var _0x2473af=_0x1c4e43[_0x72d5('0x1d')];var _0x452728=_0x15497a?0x0:_0x2a546c[_0x72d5('0x1a')];var _0x29cfd1=_0x15497a?_0x1c4e43[_0x72d5('0x1d')]:_0x2a546c[_0x72d5('0x1a')]+_0x2a546c[_0x72d5('0x1c')];var _0x1d999d;if(_0x29cfd1>=_0x2473af){_0x29cfd1=_0x2473af;_0x1d999d=0xc8;}else{_0x1d999d=0xce;}_0x57b676[_0x72d5('0x18')](_0x1d999d);return _0x57b676[_0x72d5('0x1e')](_0x72d5('0x1f'),_0x452728+'-'+_0x29cfd1+'/'+_0x2473af)[_0x72d5('0x20')](_0x1c4e43);}return null;};}function patchUpdates(_0x49b21c){return function(_0x2b5883){try{jsonpatch['apply'](_0x2b5883,_0x49b21c,!![]);}catch(_0x30e30f){return BPromise[_0x72d5('0x21')](_0x30e30f);}return _0x2b5883[_0x72d5('0x22')]();};}function saveUpdates(_0x44dac5,_0x411d76){return function(_0x6ffd99){if(_0x6ffd99){return _0x6ffd99['update'](_0x44dac5)[_0x72d5('0x23')](function(_0xd449cf){return _0xd449cf;});}return null;};}function removeEntity(_0x4393b1,_0x57549d){return function(_0x43bf24){if(_0x43bf24){return _0x43bf24['destroy']()[_0x72d5('0x23')](function(){var _0x32a68e=_0x43bf24[_0x72d5('0x24')]({'plain':!![]});var _0x170bf6=_0x72d5('0x25');return db['UserProfileResource'][_0x72d5('0x26')]({'where':{'type':_0x170bf6,'resourceId':_0x32a68e['id']}})[_0x72d5('0x23')](function(){return _0x43bf24;});})[_0x72d5('0x23')](function(){_0x4393b1[_0x72d5('0x18')](0xcc)[_0x72d5('0x19')]();});}};}function handleEntityNotFound(_0x5b228c,_0x52bab0){return function(_0x5b31ed){if(!_0x5b31ed){_0x5b228c[_0x72d5('0x17')](0x194);}return _0x5b31ed;};}function handleError(_0x38142d,_0xaccd76){_0xaccd76=_0xaccd76||0x1f4;return function(_0x39d420){logger[_0x72d5('0x27')](_0x39d420[_0x72d5('0x28')]);if(_0x39d420[_0x72d5('0x29')]){delete _0x39d420[_0x72d5('0x29')];}_0x38142d[_0x72d5('0x18')](_0xaccd76)[_0x72d5('0x2a')](_0x39d420);};}exports['index']=function(_0x49d08a,_0x269640){var _0x1c38cc={},_0x36ef27={},_0x5719b6={'count':0x0,'rows':[]};var _0x502166=_[_0x72d5('0x2b')](db[_0x72d5('0x2c')][_0x72d5('0x2d')],function(_0x132378){return{'name':_0x132378[_0x72d5('0x2e')],'type':_0x132378[_0x72d5('0x2f')][_0x72d5('0x30')]};});_0x36ef27[_0x72d5('0x31')]=_[_0x72d5('0x2b')](_0x502166,_0x72d5('0x29'));_0x36ef27[_0x72d5('0x32')]=_[_0x72d5('0x33')](_0x49d08a['query']);_0x36ef27[_0x72d5('0x34')]=_[_0x72d5('0x35')](_0x36ef27[_0x72d5('0x31')],_0x36ef27[_0x72d5('0x32')]);_0x1c38cc[_0x72d5('0x36')]=_[_0x72d5('0x35')](_0x36ef27['model'],qs[_0x72d5('0x37')](_0x49d08a[_0x72d5('0x32')]['fields']));_0x1c38cc[_0x72d5('0x36')]=_0x1c38cc[_0x72d5('0x36')][_0x72d5('0x38')]?_0x1c38cc['attributes']:_0x36ef27[_0x72d5('0x31')];if(!_0x49d08a['query'][_0x72d5('0x39')](_0x72d5('0x3a'))){_0x1c38cc[_0x72d5('0x1c')]=qs[_0x72d5('0x1c')](_0x49d08a[_0x72d5('0x32')]['limit']);_0x1c38cc[_0x72d5('0x1a')]=qs[_0x72d5('0x1a')](_0x49d08a[_0x72d5('0x32')]['offset']);}_0x1c38cc[_0x72d5('0x3b')]=qs[_0x72d5('0x3c')](_0x49d08a[_0x72d5('0x32')][_0x72d5('0x3c')]);_0x1c38cc[_0x72d5('0x3d')]=qs[_0x72d5('0x34')](_[_0x72d5('0x3e')](_0x49d08a[_0x72d5('0x32')],_0x36ef27[_0x72d5('0x34')]),_0x502166);if(_0x49d08a[_0x72d5('0x32')][_0x72d5('0x3f')]){_0x1c38cc['where']=_[_0x72d5('0x40')](_0x1c38cc[_0x72d5('0x3d')],{'$or':_[_0x72d5('0x2b')](_0x502166,function(_0xe505d1){if(_0xe505d1[_0x72d5('0x2f')]!=='VIRTUAL'){var _0x511e24={};_0x511e24[_0xe505d1['name']]={'$like':'%'+_0x49d08a['query']['filter']+'%'};return _0x511e24;}})});}_0x1c38cc=_[_0x72d5('0x40')]({},_0x1c38cc,_0x49d08a['options']);var _0x281cec={'where':_0x1c38cc[_0x72d5('0x3d')]};return db[_0x72d5('0x2c')]['count'](_0x281cec)['then'](function(_0x314992){_0x5719b6[_0x72d5('0x1d')]=_0x314992;if(_0x49d08a[_0x72d5('0x32')][_0x72d5('0x41')]){_0x1c38cc[_0x72d5('0x42')]=[{'all':!![]}];}return db[_0x72d5('0x2c')]['findAll'](_0x1c38cc);})[_0x72d5('0x23')](function(_0x2e8462){_0x5719b6[_0x72d5('0x43')]=_0x2e8462;return _0x5719b6;})['then'](respondWithFilteredResult(_0x269640,_0x1c38cc))[_0x72d5('0x44')](handleError(_0x269640,null));};exports[_0x72d5('0x45')]=function(_0x323778,_0x14df74){var _0x2fef09={'raw':!![],'where':{'id':_0x323778[_0x72d5('0x46')]['id']}},_0xc9b670={};_0xc9b670[_0x72d5('0x31')]=_[_0x72d5('0x33')](db['Template'][_0x72d5('0x2d')]);_0xc9b670[_0x72d5('0x32')]=_['keys'](_0x323778[_0x72d5('0x32')]);_0xc9b670[_0x72d5('0x34')]=_[_0x72d5('0x35')](_0xc9b670['model'],_0xc9b670[_0x72d5('0x32')]);_0x2fef09[_0x72d5('0x36')]=_[_0x72d5('0x35')](_0xc9b670[_0x72d5('0x31')],qs['fields'](_0x323778[_0x72d5('0x32')][_0x72d5('0x37')]));_0x2fef09[_0x72d5('0x36')]=_0x2fef09['attributes'][_0x72d5('0x38')]?_0x2fef09[_0x72d5('0x36')]:_0xc9b670[_0x72d5('0x31')];if(_0x323778[_0x72d5('0x32')][_0x72d5('0x41')]){_0x2fef09[_0x72d5('0x42')]=[{'all':!![]}];}_0x2fef09=_[_0x72d5('0x40')]({},_0x2fef09,_0x323778['options']);return db[_0x72d5('0x2c')][_0x72d5('0x47')](_0x2fef09)['then'](handleEntityNotFound(_0x14df74,null))['then'](respondWithResult(_0x14df74,null))[_0x72d5('0x44')](handleError(_0x14df74,null));};exports[_0x72d5('0x48')]=function(_0x25ef09,_0x558a0e){return db[_0x72d5('0x2c')][_0x72d5('0x48')](_0x25ef09[_0x72d5('0x49')],{})[_0x72d5('0x23')](function(_0x346362){var _0xc2fe6b=_0x25ef09[_0x72d5('0x4a')][_0x72d5('0x24')]({'plain':!![]});if(!_0xc2fe6b)throw new Error(_0x72d5('0x4b'));if(_0xc2fe6b[_0x72d5('0x4c')]===_0x72d5('0x4a')){var _0x3570cd=_0x346362[_0x72d5('0x24')]({'plain':!![]});var _0x165f09=_0x72d5('0x25');return db[_0x72d5('0x4d')][_0x72d5('0x47')]({'where':{'name':_0x165f09,'userProfileId':_0xc2fe6b[_0x72d5('0x4e')]},'raw':!![]})[_0x72d5('0x23')](function(_0xc5cf7f){if(_0xc5cf7f&&_0xc5cf7f[_0x72d5('0x4f')]===0x0){return db[_0x72d5('0x50')]['create']({'name':_0x3570cd[_0x72d5('0x29')],'resourceId':_0x3570cd['id'],'type':_0xc5cf7f[_0x72d5('0x29')],'sectionId':_0xc5cf7f['id']},{})[_0x72d5('0x23')](function(){return _0x346362;});}else{return _0x346362;}})[_0x72d5('0x44')](function(_0x3bfac3){logger[_0x72d5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bfac3);throw _0x3bfac3;});}return _0x346362;})[_0x72d5('0x23')](respondWithResult(_0x558a0e,0xc9))[_0x72d5('0x44')](handleError(_0x558a0e,null));};exports[_0x72d5('0x51')]=function(_0x383f48,_0x58d0c1){if(_0x383f48[_0x72d5('0x49')]['id']){delete _0x383f48[_0x72d5('0x49')]['id'];}return db['Template'][_0x72d5('0x47')]({'where':{'id':_0x383f48['params']['id']}})[_0x72d5('0x23')](handleEntityNotFound(_0x58d0c1,null))[_0x72d5('0x23')](saveUpdates(_0x383f48['body'],null))[_0x72d5('0x23')](respondWithResult(_0x58d0c1,null))[_0x72d5('0x44')](handleError(_0x58d0c1,null));};exports[_0x72d5('0x26')]=function(_0xf132bf,_0x2f0828){return db['Template'][_0x72d5('0x47')]({'where':{'id':_0xf132bf['params']['id']}})['then'](handleEntityNotFound(_0x2f0828,null))[_0x72d5('0x23')](removeEntity(_0x2f0828,null))[_0x72d5('0x44')](handleError(_0x2f0828,null));}; \ No newline at end of file +var _0x8f7c=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Templates','UserProfileResource','end','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x8f7c,0x97));var _0xc8f7=function(_0xf29c93,_0x31af07){_0xf29c93=_0xf29c93-0x0;var _0x143296=_0x8f7c[_0xf29c93];return _0x143296;};'use strict';var emlformat=require(_0xc8f7('0x0'));var rimraf=require(_0xc8f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8f7('0x2'));var rp=require(_0xc8f7('0x3'));var moment=require(_0xc8f7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc8f7('0x5'));var path=require('path');var sox=require(_0xc8f7('0x6'));var csv=require(_0xc8f7('0x7'));var ejs=require(_0xc8f7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8f7('0x9'));var squel=require(_0xc8f7('0xa'));var crypto=require(_0xc8f7('0xb'));var jsforce=require(_0xc8f7('0xc'));var deskjs=require(_0xc8f7('0xd'));var toCsv=require(_0xc8f7('0x7'));var querystring=require(_0xc8f7('0xe'));var Papa=require(_0xc8f7('0xf'));var Redis=require('ioredis');var authService=require(_0xc8f7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8f7('0x11'));var logger=require(_0xc8f7('0x12'))(_0xc8f7('0x13'));var utils=require(_0xc8f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc8f7('0x15'));var db=require(_0xc8f7('0x16'))['db'];function respondWithStatusCode(_0x308e0c,_0x4bc760){_0x4bc760=_0x4bc760||0xcc;return function(_0x4d1a57){if(_0x4d1a57){return _0x308e0c[_0xc8f7('0x17')](_0x4bc760);}return _0x308e0c[_0xc8f7('0x18')](_0x4bc760)['end']();};}function respondWithResult(_0x329ae6,_0x5da923){_0x5da923=_0x5da923||0xc8;return function(_0x1d97cf){if(_0x1d97cf){return _0x329ae6[_0xc8f7('0x18')](_0x5da923)[_0xc8f7('0x19')](_0x1d97cf);}};}function respondWithFilteredResult(_0x81df32,_0x3efd0d){return function(_0x3994d5){if(_0x3994d5){var _0xa4f54e=typeof _0x3efd0d[_0xc8f7('0x1a')]===_0xc8f7('0x1b')&&typeof _0x3efd0d[_0xc8f7('0x1c')]==='undefined';var _0x298477=_0x3994d5[_0xc8f7('0x1d')];var _0x5f2129=_0xa4f54e?0x0:_0x3efd0d[_0xc8f7('0x1a')];var _0x4ac04f=_0xa4f54e?_0x3994d5['count']:_0x3efd0d[_0xc8f7('0x1a')]+_0x3efd0d['limit'];var _0x1ca233;if(_0x4ac04f>=_0x298477){_0x4ac04f=_0x298477;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x81df32[_0xc8f7('0x18')](_0x1ca233);return _0x81df32[_0xc8f7('0x1e')](_0xc8f7('0x1f'),_0x5f2129+'-'+_0x4ac04f+'/'+_0x298477)[_0xc8f7('0x19')](_0x3994d5);}return null;};}function patchUpdates(_0x34aaa5){return function(_0x529f16){try{jsonpatch[_0xc8f7('0x20')](_0x529f16,_0x34aaa5,!![]);}catch(_0x5c156e){return BPromise[_0xc8f7('0x21')](_0x5c156e);}return _0x529f16[_0xc8f7('0x22')]();};}function saveUpdates(_0x463196,_0x1c13f5){return function(_0x16d207){if(_0x16d207){return _0x16d207[_0xc8f7('0x23')](_0x463196)['then'](function(_0x2adad0){return _0x2adad0;});}return null;};}function removeEntity(_0x33e491,_0x3e90d4){return function(_0x37f5cd){if(_0x37f5cd){return _0x37f5cd[_0xc8f7('0x24')]()[_0xc8f7('0x25')](function(){var _0x8f8d6e=_0x37f5cd['get']({'plain':!![]});var _0x14e3bb=_0xc8f7('0x26');return db[_0xc8f7('0x27')]['destroy']({'where':{'type':_0x14e3bb,'resourceId':_0x8f8d6e['id']}})[_0xc8f7('0x25')](function(){return _0x37f5cd;});})[_0xc8f7('0x25')](function(){_0x33e491[_0xc8f7('0x18')](0xcc)[_0xc8f7('0x28')]();});}};}function handleEntityNotFound(_0x3ec2ea,_0x2955a6){return function(_0x50209f){if(!_0x50209f){_0x3ec2ea[_0xc8f7('0x17')](0x194);}return _0x50209f;};}function handleError(_0x3c5ab7,_0x1bbd2f){_0x1bbd2f=_0x1bbd2f||0x1f4;return function(_0x14cdec){logger[_0xc8f7('0x29')](_0x14cdec[_0xc8f7('0x2a')]);if(_0x14cdec[_0xc8f7('0x2b')]){delete _0x14cdec['name'];}_0x3c5ab7[_0xc8f7('0x18')](_0x1bbd2f)[_0xc8f7('0x2c')](_0x14cdec);};}exports[_0xc8f7('0x2d')]=function(_0xdc26a3,_0x134ea3){var _0x767dbe={},_0x318893={},_0x3b2ea0={'count':0x0,'rows':[]};var _0x5988a5=_['map'](db[_0xc8f7('0x2e')][_0xc8f7('0x2f')],function(_0x2ece22){return{'name':_0x2ece22[_0xc8f7('0x30')],'type':_0x2ece22[_0xc8f7('0x31')][_0xc8f7('0x32')]};});_0x318893[_0xc8f7('0x33')]=_[_0xc8f7('0x34')](_0x5988a5,_0xc8f7('0x2b'));_0x318893[_0xc8f7('0x35')]=_[_0xc8f7('0x36')](_0xdc26a3['query']);_0x318893[_0xc8f7('0x37')]=_['intersection'](_0x318893[_0xc8f7('0x33')],_0x318893[_0xc8f7('0x35')]);_0x767dbe['attributes']=_[_0xc8f7('0x38')](_0x318893['model'],qs[_0xc8f7('0x39')](_0xdc26a3['query'][_0xc8f7('0x39')]));_0x767dbe[_0xc8f7('0x3a')]=_0x767dbe[_0xc8f7('0x3a')][_0xc8f7('0x3b')]?_0x767dbe[_0xc8f7('0x3a')]:_0x318893[_0xc8f7('0x33')];if(!_0xdc26a3[_0xc8f7('0x35')][_0xc8f7('0x3c')](_0xc8f7('0x3d'))){_0x767dbe[_0xc8f7('0x1c')]=qs[_0xc8f7('0x1c')](_0xdc26a3[_0xc8f7('0x35')]['limit']);_0x767dbe[_0xc8f7('0x1a')]=qs[_0xc8f7('0x1a')](_0xdc26a3[_0xc8f7('0x35')][_0xc8f7('0x1a')]);}_0x767dbe[_0xc8f7('0x3e')]=qs['sort'](_0xdc26a3[_0xc8f7('0x35')][_0xc8f7('0x3f')]);_0x767dbe['where']=qs[_0xc8f7('0x37')](_[_0xc8f7('0x40')](_0xdc26a3[_0xc8f7('0x35')],_0x318893[_0xc8f7('0x37')]),_0x5988a5);if(_0xdc26a3[_0xc8f7('0x35')][_0xc8f7('0x41')]){_0x767dbe[_0xc8f7('0x42')]=_[_0xc8f7('0x43')](_0x767dbe['where'],{'$or':_[_0xc8f7('0x34')](_0x5988a5,function(_0x5f4c40){if(_0x5f4c40[_0xc8f7('0x31')]!==_0xc8f7('0x44')){var _0xc83991={};_0xc83991[_0x5f4c40['name']]={'$like':'%'+_0xdc26a3[_0xc8f7('0x35')]['filter']+'%'};return _0xc83991;}})});}_0x767dbe=_[_0xc8f7('0x43')]({},_0x767dbe,_0xdc26a3['options']);var _0x4ec22b={'where':_0x767dbe[_0xc8f7('0x42')]};return db[_0xc8f7('0x2e')][_0xc8f7('0x1d')](_0x4ec22b)[_0xc8f7('0x25')](function(_0xe82b27){_0x3b2ea0[_0xc8f7('0x1d')]=_0xe82b27;if(_0xdc26a3[_0xc8f7('0x35')][_0xc8f7('0x45')]){_0x767dbe[_0xc8f7('0x46')]=[{'all':!![]}];}return db[_0xc8f7('0x2e')][_0xc8f7('0x47')](_0x767dbe);})[_0xc8f7('0x25')](function(_0x4c6d35){_0x3b2ea0[_0xc8f7('0x48')]=_0x4c6d35;return _0x3b2ea0;})[_0xc8f7('0x25')](respondWithFilteredResult(_0x134ea3,_0x767dbe))[_0xc8f7('0x49')](handleError(_0x134ea3,null));};exports[_0xc8f7('0x4a')]=function(_0x47dc32,_0x52e09f){var _0x4341bb={'raw':!![],'where':{'id':_0x47dc32['params']['id']}},_0x5135b8={};_0x5135b8[_0xc8f7('0x33')]=_['keys'](db[_0xc8f7('0x2e')]['rawAttributes']);_0x5135b8[_0xc8f7('0x35')]=_[_0xc8f7('0x36')](_0x47dc32[_0xc8f7('0x35')]);_0x5135b8[_0xc8f7('0x37')]=_[_0xc8f7('0x38')](_0x5135b8['model'],_0x5135b8[_0xc8f7('0x35')]);_0x4341bb[_0xc8f7('0x3a')]=_[_0xc8f7('0x38')](_0x5135b8['model'],qs[_0xc8f7('0x39')](_0x47dc32[_0xc8f7('0x35')][_0xc8f7('0x39')]));_0x4341bb[_0xc8f7('0x3a')]=_0x4341bb[_0xc8f7('0x3a')]['length']?_0x4341bb['attributes']:_0x5135b8[_0xc8f7('0x33')];if(_0x47dc32[_0xc8f7('0x35')][_0xc8f7('0x45')]){_0x4341bb[_0xc8f7('0x46')]=[{'all':!![]}];}_0x4341bb=_[_0xc8f7('0x43')]({},_0x4341bb,_0x47dc32['options']);return db[_0xc8f7('0x2e')][_0xc8f7('0x4b')](_0x4341bb)['then'](handleEntityNotFound(_0x52e09f,null))[_0xc8f7('0x25')](respondWithResult(_0x52e09f,null))[_0xc8f7('0x49')](handleError(_0x52e09f,null));};exports[_0xc8f7('0x4c')]=function(_0x2ee7a3,_0x3ac86a){return db['Template'][_0xc8f7('0x4c')](_0x2ee7a3[_0xc8f7('0x4d')],{})[_0xc8f7('0x25')](function(_0x45237e){var _0x5dfb8e=_0x2ee7a3[_0xc8f7('0x4e')]['get']({'plain':!![]});if(!_0x5dfb8e)throw new Error(_0xc8f7('0x4f'));if(_0x5dfb8e[_0xc8f7('0x50')]===_0xc8f7('0x4e')){var _0x1aa087=_0x45237e[_0xc8f7('0x51')]({'plain':!![]});var _0x5517e2=_0xc8f7('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x5517e2,'userProfileId':_0x5dfb8e['userProfileId']},'raw':!![]})[_0xc8f7('0x25')](function(_0x30cc03){if(_0x30cc03&&_0x30cc03[_0xc8f7('0x52')]===0x0){return db[_0xc8f7('0x27')][_0xc8f7('0x4c')]({'name':_0x1aa087['name'],'resourceId':_0x1aa087['id'],'type':_0x30cc03['name'],'sectionId':_0x30cc03['id']},{})[_0xc8f7('0x25')](function(){return _0x45237e;});}else{return _0x45237e;}})['catch'](function(_0x50f2a3){logger[_0xc8f7('0x29')](_0xc8f7('0x53'),_0x50f2a3);throw _0x50f2a3;});}return _0x45237e;})[_0xc8f7('0x25')](respondWithResult(_0x3ac86a,0xc9))[_0xc8f7('0x49')](handleError(_0x3ac86a,null));};exports[_0xc8f7('0x23')]=function(_0x24e890,_0x310cbf){if(_0x24e890[_0xc8f7('0x4d')]['id']){delete _0x24e890[_0xc8f7('0x4d')]['id'];}return db[_0xc8f7('0x2e')][_0xc8f7('0x4b')]({'where':{'id':_0x24e890[_0xc8f7('0x54')]['id']}})[_0xc8f7('0x25')](handleEntityNotFound(_0x310cbf,null))[_0xc8f7('0x25')](saveUpdates(_0x24e890[_0xc8f7('0x4d')],null))[_0xc8f7('0x25')](respondWithResult(_0x310cbf,null))[_0xc8f7('0x49')](handleError(_0x310cbf,null));};exports[_0xc8f7('0x24')]=function(_0x2e6d0f,_0x3b3044){return db['Template']['find']({'where':{'id':_0x2e6d0f[_0xc8f7('0x54')]['id']}})[_0xc8f7('0x25')](handleEntityNotFound(_0x3b3044,null))[_0xc8f7('0x25')](removeEntity(_0x3b3044,null))[_0xc8f7('0x49')](handleError(_0x3b3044,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0aa1509..140d33b 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 _0xe663=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe663,0x1b8));var _0x3e66=function(_0x57427d,_0x57f92b){_0x57427d=_0x57427d-0x0;var _0xdecabd=_0xe663[_0x57427d];return _0xdecabd;};'use strict';var _=require(_0x3e66('0x0'));var util=require(_0x3e66('0x1'));var logger=require(_0x3e66('0x2'))(_0x3e66('0x3'));var moment=require(_0x3e66('0x4'));var BPromise=require(_0x3e66('0x5'));var rp=require(_0x3e66('0x6'));var fs=require('fs');var path=require(_0x3e66('0x7'));var rimraf=require(_0x3e66('0x8'));var config=require(_0x3e66('0x9'));var attributes=require(_0x3e66('0xa'));module['exports']=function(_0x5b7099,_0x425729){return _0x5b7099['define'](_0x3e66('0xb'),attributes,{'tableName':_0x3e66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabcc=['../../config/environment','./template.attributes','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x47b9cf,_0x1fdd93){var _0x4d4d58=function(_0x5e78ba){while(--_0x5e78ba){_0x47b9cf['push'](_0x47b9cf['shift']());}};_0x4d4d58(++_0x1fdd93);}(_0xabcc,0xa0));var _0xcabc=function(_0x47eaba,_0x14825c){_0x47eaba=_0x47eaba-0x0;var _0x4ce103=_0xabcc[_0x47eaba];return _0x4ce103;};'use strict';var _=require(_0xcabc('0x0'));var util=require('util');var logger=require(_0xcabc('0x1'))(_0xcabc('0x2'));var moment=require(_0xcabc('0x3'));var BPromise=require(_0xcabc('0x4'));var rp=require(_0xcabc('0x5'));var fs=require('fs');var path=require(_0xcabc('0x6'));var rimraf=require(_0xcabc('0x7'));var config=require(_0xcabc('0x8'));var attributes=require(_0xcabc('0x9'));module['exports']=function(_0x486b42,_0x47ab57){return _0x486b42['define'](_0xcabc('0xa'),attributes,{'tableName':_0xcabc('0xb'),'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 c0aa5db..f8fc074 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 _0xcdc5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','result','catch','Template','options','where','include','map','model','attributes','then','GetTemplate','util'];(function(_0x5e2c29,_0x53aabf){var _0xe0d919=function(_0x31bbd4){while(--_0x31bbd4){_0x5e2c29['push'](_0x5e2c29['shift']());}};_0xe0d919(++_0x53aabf);}(_0xcdc5,0x7f));var _0x5cdc=function(_0x99405c,_0x445476){_0x99405c=_0x99405c-0x0;var _0x3daed0=_0xcdc5[_0x99405c];return _0x3daed0;};'use strict';var _=require('lodash');var util=require(_0x5cdc('0x0'));var moment=require(_0x5cdc('0x1'));var BPromise=require(_0x5cdc('0x2'));var rs=require(_0x5cdc('0x3'));var fs=require('fs');var Redis=require(_0x5cdc('0x4'));var db=require(_0x5cdc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cdc('0x6'))(_0x5cdc('0x7'));var config=require(_0x5cdc('0x8'));var jayson=require(_0x5cdc('0x9'));var client=jayson[_0x5cdc('0xa')][_0x5cdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fd55a,_0x3fe1bc,_0x192f24){return new BPromise(function(_0x2240b9,_0x5707c3){return client[_0x5cdc('0xc')](_0x3fd55a,_0x192f24)['then'](function(_0x565989){logger[_0x5cdc('0xd')]('Template,\x20%s,\x20%s',_0x3fe1bc,'request\x20sent');logger[_0x5cdc('0xe')](_0x5cdc('0xf'),_0x3fe1bc,_0x5cdc('0x10'),JSON[_0x5cdc('0x11')](_0x565989));if(_0x565989[_0x5cdc('0x12')]){if(_0x565989['error']['code']===0x1f4){logger[_0x5cdc('0x12')](_0x5cdc('0x13'),_0x3fe1bc,_0x565989['error'][_0x5cdc('0x14')]);return _0x5707c3(_0x565989[_0x5cdc('0x12')][_0x5cdc('0x14')]);}logger[_0x5cdc('0x12')](_0x5cdc('0x13'),_0x3fe1bc,_0x565989['error'][_0x5cdc('0x14')]);return _0x2240b9(_0x565989[_0x5cdc('0x12')]['message']);}else{logger[_0x5cdc('0xd')](_0x5cdc('0x13'),_0x3fe1bc,'request\x20sent');_0x2240b9(_0x565989[_0x5cdc('0x15')][_0x5cdc('0x14')]);}})[_0x5cdc('0x16')](function(_0x32cf83){logger['error'](_0x5cdc('0x13'),_0x3fe1bc,_0x32cf83);_0x5707c3(_0x32cf83);});});}exports['GetTemplate']=function(_0x1daa04){var _0x35b384=this;return new Promise(function(_0x19b4bf,_0x4cbe4b){return db[_0x5cdc('0x17')]['findAll']({'raw':_0x1daa04[_0x5cdc('0x18')]?_0x1daa04[_0x5cdc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1daa04[_0x5cdc('0x18')]?_0x1daa04[_0x5cdc('0x18')][_0x5cdc('0x19')]||null:null,'attributes':_0x1daa04[_0x5cdc('0x18')]?_0x1daa04['options']['attributes']||null:null,'limit':_0x1daa04['options']?_0x1daa04[_0x5cdc('0x18')]['limit']||null:null,'include':_0x1daa04[_0x5cdc('0x18')]?_0x1daa04['options'][_0x5cdc('0x1a')]?_[_0x5cdc('0x1b')](_0x1daa04[_0x5cdc('0x18')]['include'],function(_0x541146){return{'model':db[_0x541146[_0x5cdc('0x1c')]],'as':_0x541146['as'],'attributes':_0x541146[_0x5cdc('0x1d')],'include':_0x541146[_0x5cdc('0x1a')]?_[_0x5cdc('0x1b')](_0x541146['include'],function(_0xbf35e7){return{'model':db[_0xbf35e7['model']],'as':_0xbf35e7['as'],'attributes':_0xbf35e7['attributes'],'include':_0xbf35e7[_0x5cdc('0x1a')]?_[_0x5cdc('0x1b')](_0xbf35e7['include'],function(_0x29451f){return{'model':db[_0x29451f[_0x5cdc('0x1c')]],'as':_0x29451f['as'],'attributes':_0x29451f[_0x5cdc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5cdc('0x1e')](function(_0x15b7f1){logger['info']('GetTemplate',_0x1daa04);logger['debug'](_0x5cdc('0x1f'),_0x1daa04,JSON['stringify'](_0x15b7f1));_0x19b4bf(_0x15b7f1);})[_0x5cdc('0x16')](function(_0x207654){logger['error']('GetTemplate',_0x207654[_0x5cdc('0x14')],_0x1daa04);_0x4cbe4b(_0x35b384['error'](0x1f4,_0x207654[_0x5cdc('0x14')]));});});}; \ No newline at end of file +var _0x49a2=['catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x49a2,0xf3));var _0x249a=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x49a2[_0xf6aec0];return _0x59a51b;};'use strict';var _=require(_0x249a('0x0'));var util=require('util');var moment=require(_0x249a('0x1'));var BPromise=require(_0x249a('0x2'));var rs=require(_0x249a('0x3'));var fs=require('fs');var Redis=require(_0x249a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x249a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x249a('0x6'));var client=jayson[_0x249a('0x7')][_0x249a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c3032,_0x43ba88,_0xf04c00){return new BPromise(function(_0x16a5a9,_0x50d906){return client[_0x249a('0x9')](_0x2c3032,_0xf04c00)[_0x249a('0xa')](function(_0x350dfc){logger[_0x249a('0xb')](_0x249a('0xc'),_0x43ba88,_0x249a('0xd'));logger[_0x249a('0xe')](_0x249a('0xf'),_0x43ba88,_0x249a('0xd'),JSON[_0x249a('0x10')](_0x350dfc));if(_0x350dfc[_0x249a('0x11')]){if(_0x350dfc[_0x249a('0x11')][_0x249a('0x12')]===0x1f4){logger[_0x249a('0x11')](_0x249a('0xc'),_0x43ba88,_0x350dfc[_0x249a('0x11')][_0x249a('0x13')]);return _0x50d906(_0x350dfc[_0x249a('0x11')][_0x249a('0x13')]);}logger[_0x249a('0x11')](_0x249a('0xc'),_0x43ba88,_0x350dfc[_0x249a('0x11')][_0x249a('0x13')]);return _0x16a5a9(_0x350dfc[_0x249a('0x11')][_0x249a('0x13')]);}else{logger[_0x249a('0xb')]('Template,\x20%s,\x20%s',_0x43ba88,_0x249a('0xd'));_0x16a5a9(_0x350dfc[_0x249a('0x14')]['message']);}})[_0x249a('0x15')](function(_0x1d9f30){logger[_0x249a('0x11')]('Template,\x20%s,\x20%s',_0x43ba88,_0x1d9f30);_0x50d906(_0x1d9f30);});});}exports[_0x249a('0x16')]=function(_0x5d7b56){var _0x3749db=this;return new Promise(function(_0x3a749b,_0x10b194){return db[_0x249a('0x17')][_0x249a('0x18')]({'raw':_0x5d7b56[_0x249a('0x19')]?_0x5d7b56['options'][_0x249a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d7b56[_0x249a('0x19')]?_0x5d7b56[_0x249a('0x19')][_0x249a('0x1b')]||null:null,'attributes':_0x5d7b56['options']?_0x5d7b56[_0x249a('0x19')][_0x249a('0x1c')]||null:null,'limit':_0x5d7b56[_0x249a('0x19')]?_0x5d7b56[_0x249a('0x19')][_0x249a('0x1d')]||null:null,'include':_0x5d7b56['options']?_0x5d7b56[_0x249a('0x19')][_0x249a('0x1e')]?_[_0x249a('0x1f')](_0x5d7b56[_0x249a('0x19')]['include'],function(_0x2c9d95){return{'model':db[_0x2c9d95[_0x249a('0x20')]],'as':_0x2c9d95['as'],'attributes':_0x2c9d95['attributes'],'include':_0x2c9d95['include']?_[_0x249a('0x1f')](_0x2c9d95[_0x249a('0x1e')],function(_0x485f2b){return{'model':db[_0x485f2b[_0x249a('0x20')]],'as':_0x485f2b['as'],'attributes':_0x485f2b[_0x249a('0x1c')],'include':_0x485f2b[_0x249a('0x1e')]?_[_0x249a('0x1f')](_0x485f2b[_0x249a('0x1e')],function(_0x562e0b){return{'model':db[_0x562e0b[_0x249a('0x20')]],'as':_0x562e0b['as'],'attributes':_0x562e0b[_0x249a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x249a('0xa')](function(_0x4e75ca){logger['info'](_0x249a('0x16'),_0x5d7b56);logger[_0x249a('0xe')]('GetTemplate',_0x5d7b56,JSON[_0x249a('0x10')](_0x4e75ca));_0x3a749b(_0x4e75ca);})[_0x249a('0x15')](function(_0x1d6d8c){logger[_0x249a('0x11')](_0x249a('0x16'),_0x1d6d8c[_0x249a('0x13')],_0x5d7b56);_0x10b194(_0x3749db[_0x249a('0x11')](0x1f4,_0x1d6d8c[_0x249a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index edae432..fbb101e 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 _0x7d11=['addAllCondition','addAnyCondition','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','create','post'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x7d11,0x95));var _0x17d1=function(_0xbe3fc7,_0x3c6aaf){_0xbe3fc7=_0xbe3fc7-0x0;var _0x27e59c=_0x7d11[_0xbe3fc7];return _0x27e59c;};'use strict';var multer=require('multer');var util=require(_0x17d1('0x0'));var path=require(_0x17d1('0x1'));var timeout=require(_0x17d1('0x2'));var express=require(_0x17d1('0x3'));var router=express[_0x17d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17d1('0x5'));var interaction=require(_0x17d1('0x6'));var config=require(_0x17d1('0x7'));var controller=require(_0x17d1('0x8'));router[_0x17d1('0x9')]('/',auth[_0x17d1('0xa')](),controller[_0x17d1('0xb')]);router[_0x17d1('0x9')](_0x17d1('0xc'),auth[_0x17d1('0xa')](),controller['show']);router[_0x17d1('0x9')](_0x17d1('0xd'),auth[_0x17d1('0xa')](),controller[_0x17d1('0xe')]);router[_0x17d1('0x9')](_0x17d1('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x17d1('0x9')](_0x17d1('0x10'),auth[_0x17d1('0xa')](),controller['getActions']);router['post']('/',auth[_0x17d1('0xa')](),controller[_0x17d1('0x11')]);router[_0x17d1('0x12')](_0x17d1('0xd'),auth[_0x17d1('0xa')](),controller[_0x17d1('0x13')]);router[_0x17d1('0x12')](_0x17d1('0xf'),auth[_0x17d1('0xa')](),controller[_0x17d1('0x14')]);router[_0x17d1('0x12')](_0x17d1('0x10'),auth['isAuthenticated'](),controller['addAction']);router['put'](_0x17d1('0xc'),auth[_0x17d1('0xa')](),controller[_0x17d1('0x15')]);router['delete'](_0x17d1('0xc'),auth[_0x17d1('0xa')](),controller[_0x17d1('0x16')]);module[_0x17d1('0x17')]=router; \ No newline at end of file +var _0x9672=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show'];(function(_0x30610a,_0x3c7d4b){var _0x479b2c=function(_0x22f12d){while(--_0x22f12d){_0x30610a['push'](_0x30610a['shift']());}};_0x479b2c(++_0x3c7d4b);}(_0x9672,0xee));var _0x2967=function(_0x7b50bf,_0x54b8b6){_0x7b50bf=_0x7b50bf-0x0;var _0x2589d8=_0x9672[_0x7b50bf];return _0x2589d8;};'use strict';var multer=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var path=require('path');var timeout=require(_0x2967('0x2'));var express=require(_0x2967('0x3'));var router=express[_0x2967('0x4')]();var fs_extra=require(_0x2967('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var controller=require(_0x2967('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2967('0x9')]);router[_0x2967('0xa')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0xd')]);router[_0x2967('0xa')](_0x2967('0xe'),auth[_0x2967('0xc')](),controller['getAllConditions']);router[_0x2967('0xa')](_0x2967('0xf'),auth[_0x2967('0xc')](),controller[_0x2967('0x10')]);router[_0x2967('0xa')](_0x2967('0x11'),auth['isAuthenticated'](),controller[_0x2967('0x12')]);router['post']('/',auth[_0x2967('0xc')](),controller['create']);router[_0x2967('0x13')](_0x2967('0xe'),auth['isAuthenticated'](),controller[_0x2967('0x14')]);router['post'](_0x2967('0xf'),auth[_0x2967('0xc')](),controller[_0x2967('0x15')]);router['post']('/:id/actions',auth[_0x2967('0xc')](),controller[_0x2967('0x16')]);router[_0x2967('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2967('0x18')]);router[_0x2967('0x19')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0x1a')]);module[_0x2967('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 56c84a1..c8d89fa 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 _0xa006=['BOOLEAN','sequelize','exports','STRING'];(function(_0x24fa8f,_0x750629){var _0x2f99d3=function(_0x1caa5c){while(--_0x1caa5c){_0x24fa8f['push'](_0x24fa8f['shift']());}};_0x2f99d3(++_0x750629);}(_0xa006,0x109));var _0x6a00=function(_0x44abca,_0x22af8e){_0x44abca=_0x44abca-0x0;var _0x312dd0=_0xa006[_0x44abca];return _0x312dd0;};'use strict';var Sequelize=require(_0x6a00('0x0'));module[_0x6a00('0x1')]={'name':{'type':Sequelize[_0x6a00('0x2')]},'channel':{'type':Sequelize[_0x6a00('0x2')]},'description':{'type':Sequelize[_0x6a00('0x2')]},'status':{'type':Sequelize[_0x6a00('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7d8e=['sequelize','exports','STRING'];(function(_0x2d55a1,_0x30cb10){var _0x39ed86=function(_0x1df22a){while(--_0x1df22a){_0x2d55a1['push'](_0x2d55a1['shift']());}};_0x39ed86(++_0x30cb10);}(_0x7d8e,0x7b));var _0xe7d8=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x7d8e[_0x8a7e38];return _0x228609;};'use strict';var Sequelize=require(_0xe7d8('0x0'));module[_0xe7d8('0x1')]={'name':{'type':Sequelize[_0xe7d8('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7d8('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 39d02fe..eaf5ff1 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 _0x08d8=['../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','map','Trigger','key','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','TriggerAnyId','Condition','findOne','order','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x32a0de,_0x3f6f5a){var _0x4a740c=function(_0x416080){while(--_0x416080){_0x32a0de['push'](_0x32a0de['shift']());}};_0x4a740c(++_0x3f6f5a);}(_0x08d8,0xa6));var _0x808d=function(_0x37b624,_0x28c3aa){_0x37b624=_0x37b624-0x0;var _0x44abd9=_0x08d8[_0x37b624];return _0x44abd9;};'use strict';var emlformat=require(_0x808d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x808d('0x1'));var jsonpatch=require(_0x808d('0x2'));var rp=require(_0x808d('0x3'));var moment=require(_0x808d('0x4'));var BPromise=require(_0x808d('0x5'));var Mustache=require(_0x808d('0x6'));var util=require('util');var path=require(_0x808d('0x7'));var sox=require('sox');var csv=require(_0x808d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x808d('0x9'));var squel=require(_0x808d('0xa'));var crypto=require(_0x808d('0xb'));var jsforce=require(_0x808d('0xc'));var deskjs=require(_0x808d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x808d('0xe'));var Papa=require(_0x808d('0xf'));var Redis=require(_0x808d('0x10'));var authService=require(_0x808d('0x11'));var qs=require(_0x808d('0x12'));var as=require(_0x808d('0x13'));var hardwareService=require(_0x808d('0x14'));var logger=require(_0x808d('0x15'))('api');var utils=require(_0x808d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x808d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b8d7,_0x3bfd33){_0x3bfd33=_0x3bfd33||0xcc;return function(_0x5e2f47){if(_0x5e2f47){return _0x18b8d7['sendStatus'](_0x3bfd33);}return _0x18b8d7[_0x808d('0x18')](_0x3bfd33)[_0x808d('0x19')]();};}function respondWithResult(_0xbdea17,_0x48e8fd){_0x48e8fd=_0x48e8fd||0xc8;return function(_0x8d695f){if(_0x8d695f){return _0xbdea17['status'](_0x48e8fd)[_0x808d('0x1a')](_0x8d695f);}};}function respondWithFilteredResult(_0x554b1d,_0x299e23){return function(_0x3b99f6){if(_0x3b99f6){var _0x4bcad3=typeof _0x299e23[_0x808d('0x1b')]===_0x808d('0x1c')&&typeof _0x299e23[_0x808d('0x1d')]==='undefined';var _0x417daf=_0x3b99f6[_0x808d('0x1e')];var _0x1dc61a=_0x4bcad3?0x0:_0x299e23['offset'];var _0x1755e1=_0x4bcad3?_0x3b99f6[_0x808d('0x1e')]:_0x299e23[_0x808d('0x1b')]+_0x299e23['limit'];var _0x4f4082;if(_0x1755e1>=_0x417daf){_0x1755e1=_0x417daf;_0x4f4082=0xc8;}else{_0x4f4082=0xce;}_0x554b1d['status'](_0x4f4082);return _0x554b1d[_0x808d('0x1f')](_0x808d('0x20'),_0x1dc61a+'-'+_0x1755e1+'/'+_0x417daf)[_0x808d('0x1a')](_0x3b99f6);}return null;};}function patchUpdates(_0x48a5c2){return function(_0x5a56f7){try{jsonpatch['apply'](_0x5a56f7,_0x48a5c2,!![]);}catch(_0x34e3f5){return BPromise[_0x808d('0x21')](_0x34e3f5);}return _0x5a56f7['save']();};}function saveUpdates(_0x3a31ea,_0x2457bd){return function(_0x38ecce){if(_0x38ecce){return _0x38ecce[_0x808d('0x22')](_0x3a31ea)[_0x808d('0x23')](function(_0x1d0b13){return _0x1d0b13;});}return null;};}function removeEntity(_0x2c039f,_0x420126){return function(_0x525d7c){if(_0x525d7c){return _0x525d7c[_0x808d('0x24')]()[_0x808d('0x23')](function(){var _0x55ea40=_0x525d7c[_0x808d('0x25')]({'plain':!![]});var _0x405f00=_0x808d('0x26');return db[_0x808d('0x27')][_0x808d('0x24')]({'where':{'type':_0x405f00,'resourceId':_0x55ea40['id']}})['then'](function(){return _0x525d7c;});})[_0x808d('0x23')](function(){_0x2c039f[_0x808d('0x18')](0xcc)[_0x808d('0x19')]();});}};}function handleEntityNotFound(_0x450d57,_0x204ee8){return function(_0x24bfd9){if(!_0x24bfd9){_0x450d57[_0x808d('0x28')](0x194);}return _0x24bfd9;};}function handleError(_0x31824b,_0x157bef){_0x157bef=_0x157bef||0x1f4;return function(_0x1e9e1b){logger[_0x808d('0x29')](_0x1e9e1b[_0x808d('0x2a')]);if(_0x1e9e1b[_0x808d('0x2b')]){delete _0x1e9e1b['name'];}_0x31824b['status'](_0x157bef)[_0x808d('0x2c')](_0x1e9e1b);};}exports[_0x808d('0x2d')]=function(_0x1b4d81,_0x37673e){var _0x59fd45={},_0x2f5e10={},_0x21e4c9={'count':0x0,'rows':[]};var _0x212bdf=_[_0x808d('0x2e')](db[_0x808d('0x2f')]['rawAttributes'],function(_0xe7bedc){return{'name':_0xe7bedc['fieldName'],'type':_0xe7bedc['type'][_0x808d('0x30')]};});_0x2f5e10['model']=_[_0x808d('0x2e')](_0x212bdf,_0x808d('0x2b'));_0x2f5e10[_0x808d('0x31')]=_['keys'](_0x1b4d81[_0x808d('0x31')]);_0x2f5e10[_0x808d('0x32')]=_['intersection'](_0x2f5e10[_0x808d('0x33')],_0x2f5e10[_0x808d('0x31')]);_0x59fd45['attributes']=_[_0x808d('0x34')](_0x2f5e10[_0x808d('0x33')],qs[_0x808d('0x35')](_0x1b4d81[_0x808d('0x31')]['fields']));_0x59fd45[_0x808d('0x36')]=_0x59fd45[_0x808d('0x36')][_0x808d('0x37')]?_0x59fd45['attributes']:_0x2f5e10['model'];if(!_0x1b4d81['query']['hasOwnProperty'](_0x808d('0x38'))){_0x59fd45[_0x808d('0x1d')]=qs['limit'](_0x1b4d81[_0x808d('0x31')]['limit']);_0x59fd45[_0x808d('0x1b')]=qs[_0x808d('0x1b')](_0x1b4d81[_0x808d('0x31')][_0x808d('0x1b')]);}_0x59fd45['order']=qs['sort'](_0x1b4d81[_0x808d('0x31')][_0x808d('0x39')]);_0x59fd45['where']=qs['filters'](_[_0x808d('0x3a')](_0x1b4d81[_0x808d('0x31')],_0x2f5e10['filters']),_0x212bdf);if(_0x1b4d81[_0x808d('0x31')][_0x808d('0x3b')]){_0x59fd45[_0x808d('0x3c')]=_[_0x808d('0x3d')](_0x59fd45['where'],{'$or':_[_0x808d('0x2e')](_0x212bdf,function(_0x17885b){if(_0x17885b[_0x808d('0x3e')]!=='VIRTUAL'){var _0x2166cc={};_0x2166cc[_0x17885b[_0x808d('0x2b')]]={'$like':'%'+_0x1b4d81[_0x808d('0x31')]['filter']+'%'};return _0x2166cc;}})});}_0x59fd45=_[_0x808d('0x3d')]({},_0x59fd45,_0x1b4d81[_0x808d('0x3f')]);var _0x3aaddd={'where':_0x59fd45[_0x808d('0x3c')]};return db[_0x808d('0x2f')][_0x808d('0x1e')](_0x3aaddd)[_0x808d('0x23')](function(_0x51efe2){_0x21e4c9[_0x808d('0x1e')]=_0x51efe2;if(_0x1b4d81[_0x808d('0x31')][_0x808d('0x40')]){_0x59fd45[_0x808d('0x41')]=[{'all':!![]}];}return db[_0x808d('0x2f')]['findAll'](_0x59fd45);})[_0x808d('0x23')](function(_0x50a016){_0x21e4c9[_0x808d('0x42')]=_0x50a016;return _0x21e4c9;})[_0x808d('0x23')](respondWithFilteredResult(_0x37673e,_0x59fd45))[_0x808d('0x43')](handleError(_0x37673e,null));};exports[_0x808d('0x44')]=function(_0x4cc044,_0x15a10c){var _0x40a044={'raw':![],'where':{'id':_0x4cc044[_0x808d('0x45')]['id']}},_0x1ba69c={};_0x1ba69c[_0x808d('0x33')]=_[_0x808d('0x46')](db[_0x808d('0x2f')][_0x808d('0x47')]);_0x1ba69c['query']=_['keys'](_0x4cc044[_0x808d('0x31')]);_0x1ba69c['filters']=_[_0x808d('0x34')](_0x1ba69c['model'],_0x1ba69c[_0x808d('0x31')]);_0x40a044['attributes']=_[_0x808d('0x34')](_0x1ba69c[_0x808d('0x33')],qs[_0x808d('0x35')](_0x4cc044['query'][_0x808d('0x35')]));_0x40a044[_0x808d('0x36')]=_0x40a044[_0x808d('0x36')]['length']?_0x40a044[_0x808d('0x36')]:_0x1ba69c[_0x808d('0x33')];if(_0x4cc044[_0x808d('0x31')][_0x808d('0x40')]){_0x40a044['include']=[{'all':!![]}];}_0x40a044=_['merge']({},_0x40a044,_0x4cc044['options']);return db['Trigger'][_0x808d('0x48')](_0x40a044)['then'](handleEntityNotFound(_0x15a10c,null))[_0x808d('0x23')](respondWithResult(_0x15a10c,null))[_0x808d('0x43')](handleError(_0x15a10c,null));};exports['create']=function(_0x51a4e1,_0xbc97f4){return db['Trigger'][_0x808d('0x49')](_0x51a4e1[_0x808d('0x4a')],{})['then'](function(_0x1b45c7){var _0xcb155f=_0x51a4e1[_0x808d('0x4b')][_0x808d('0x25')]({'plain':!![]});if(!_0xcb155f)throw new Error(_0x808d('0x4c'));if(_0xcb155f[_0x808d('0x4d')]===_0x808d('0x4b')){var _0x4531b7=_0x1b45c7[_0x808d('0x25')]({'plain':!![]});var _0x3eaefe=_0x808d('0x26');return db[_0x808d('0x4e')][_0x808d('0x48')]({'where':{'name':_0x3eaefe,'userProfileId':_0xcb155f['userProfileId']},'raw':!![]})[_0x808d('0x23')](function(_0x40917b){if(_0x40917b&&_0x40917b[_0x808d('0x4f')]===0x0){return db[_0x808d('0x27')][_0x808d('0x49')]({'name':_0x4531b7[_0x808d('0x2b')],'resourceId':_0x4531b7['id'],'type':_0x40917b[_0x808d('0x2b')],'sectionId':_0x40917b['id']},{})['then'](function(){return _0x1b45c7;});}else{return _0x1b45c7;}})['catch'](function(_0x52d3ec){logger[_0x808d('0x29')](_0x808d('0x50'),_0x52d3ec);throw _0x52d3ec;});}return _0x1b45c7;})['then'](respondWithResult(_0xbc97f4,0xc9))[_0x808d('0x43')](handleError(_0xbc97f4,null));};exports[_0x808d('0x22')]=function(_0x3ca394,_0x5f16f0){if(_0x3ca394[_0x808d('0x4a')]['id']){delete _0x3ca394[_0x808d('0x4a')]['id'];}return db[_0x808d('0x2f')][_0x808d('0x48')]({'where':{'id':_0x3ca394[_0x808d('0x45')]['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x5f16f0,null))[_0x808d('0x23')](saveUpdates(_0x3ca394[_0x808d('0x4a')],null))[_0x808d('0x23')](respondWithResult(_0x5f16f0,null))[_0x808d('0x43')](handleError(_0x5f16f0,null));};exports[_0x808d('0x24')]=function(_0x4cdc6d,_0x3d2521){return db['Trigger'][_0x808d('0x48')]({'where':{'id':_0x4cdc6d['params']['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x3d2521,null))[_0x808d('0x23')](removeEntity(_0x3d2521,null))[_0x808d('0x43')](handleError(_0x3d2521,null));};exports[_0x808d('0x51')]=function(_0x3048a6,_0x203189,_0x1025f3){if(_0x3048a6[_0x808d('0x4a')]['id']){delete _0x3048a6[_0x808d('0x4a')]['id'];}return db[_0x808d('0x2f')][_0x808d('0x48')]({'where':{'id':_0x3048a6['params']['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x203189,null))['then'](function(_0x48a6f4){if(_0x48a6f4){_0x3048a6['body']['TriggerAllId']=_0x48a6f4['id'];return db['Condition'][_0x808d('0x49')](_0x3048a6[_0x808d('0x4a')]);}})[_0x808d('0x23')](respondWithResult(_0x203189,null))[_0x808d('0x43')](handleError(_0x203189,null));};exports[_0x808d('0x52')]=function(_0x5a2f0a,_0x1f394f,_0x200141){if(_0x5a2f0a[_0x808d('0x4a')]['id']){delete _0x5a2f0a[_0x808d('0x4a')]['id'];}return db['Trigger'][_0x808d('0x48')]({'where':{'id':_0x5a2f0a[_0x808d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f394f,null))[_0x808d('0x23')](function(_0x5dd44b){if(_0x5dd44b){_0x5a2f0a[_0x808d('0x4a')][_0x808d('0x53')]=_0x5dd44b['id'];return db[_0x808d('0x54')][_0x808d('0x49')](_0x5a2f0a['body']);}})[_0x808d('0x23')](respondWithResult(_0x1f394f,null))[_0x808d('0x43')](handleError(_0x1f394f,null));};exports['getAllConditions']=function(_0x251c46,_0x363244,_0xf89c67){var _0x23578e={};var _0x4c3a6a={};var _0x3d05a8;var _0x3dbe1e;return db['Trigger'][_0x808d('0x55')]({'where':{'id':_0x251c46[_0x808d('0x45')]['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x363244,null))['then'](function(_0x41d185){if(_0x41d185){_0x3d05a8=_0x41d185;_0x4c3a6a[_0x808d('0x33')]=_[_0x808d('0x46')](db[_0x808d('0x54')][_0x808d('0x47')]);_0x4c3a6a[_0x808d('0x31')]=_[_0x808d('0x46')](_0x251c46[_0x808d('0x31')]);_0x4c3a6a[_0x808d('0x32')]=_[_0x808d('0x34')](_0x4c3a6a[_0x808d('0x33')],_0x4c3a6a[_0x808d('0x31')]);_0x23578e[_0x808d('0x36')]=_[_0x808d('0x34')](_0x4c3a6a[_0x808d('0x33')],qs[_0x808d('0x35')](_0x251c46[_0x808d('0x31')][_0x808d('0x35')]));_0x23578e[_0x808d('0x36')]=_0x23578e['attributes'][_0x808d('0x37')]?_0x23578e['attributes']:_0x4c3a6a[_0x808d('0x33')];_0x23578e[_0x808d('0x56')]=qs[_0x808d('0x39')](_0x251c46[_0x808d('0x31')][_0x808d('0x39')]);_0x23578e['where']=qs[_0x808d('0x32')](_['pick'](_0x251c46['query'],_0x4c3a6a[_0x808d('0x32')]));if(_0x251c46[_0x808d('0x31')]['filter']){_0x23578e['where']=_[_0x808d('0x3d')](_0x23578e[_0x808d('0x3c')],{'$or':_[_0x808d('0x2e')](_0x23578e[_0x808d('0x36')],function(_0x268f25){var _0x5014f9={};_0x5014f9[_0x268f25]={'$like':'%'+_0x251c46[_0x808d('0x31')][_0x808d('0x3b')]+'%'};return _0x5014f9;})});}_0x23578e=_[_0x808d('0x3d')]({},_0x23578e,_0x251c46[_0x808d('0x3f')]);return _0x3d05a8[_0x808d('0x57')](_0x23578e);}})[_0x808d('0x23')](function(_0x595b24){if(_0x595b24){_0x3dbe1e=_0x595b24[_0x808d('0x37')];if(!_0x251c46[_0x808d('0x31')][_0x808d('0x58')](_0x808d('0x38'))){_0x23578e[_0x808d('0x1d')]=qs['limit'](_0x251c46['query'][_0x808d('0x1d')]);_0x23578e[_0x808d('0x1b')]=qs['offset'](_0x251c46['query'][_0x808d('0x1b')]);}return _0x3d05a8['getAllConditions'](_0x23578e);}})['then'](function(_0x597cce){if(_0x597cce){return _0x597cce?{'count':_0x3dbe1e,'rows':_0x597cce}:null;}})[_0x808d('0x23')](respondWithResult(_0x363244,null))[_0x808d('0x43')](handleError(_0x363244,null));};exports[_0x808d('0x59')]=function(_0x10a7d8,_0x5cd324,_0x1b2391){var _0x569dd0={};var _0x437dba={};var _0x5b1fc7;var _0x26e84d;return db[_0x808d('0x2f')]['findOne']({'where':{'id':_0x10a7d8[_0x808d('0x45')]['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x5cd324,null))['then'](function(_0x32c2e2){if(_0x32c2e2){_0x5b1fc7=_0x32c2e2;_0x437dba[_0x808d('0x33')]=_['keys'](db['Condition'][_0x808d('0x47')]);_0x437dba['query']=_[_0x808d('0x46')](_0x10a7d8[_0x808d('0x31')]);_0x437dba[_0x808d('0x32')]=_['intersection'](_0x437dba[_0x808d('0x33')],_0x437dba[_0x808d('0x31')]);_0x569dd0[_0x808d('0x36')]=_[_0x808d('0x34')](_0x437dba[_0x808d('0x33')],qs[_0x808d('0x35')](_0x10a7d8['query']['fields']));_0x569dd0['attributes']=_0x569dd0[_0x808d('0x36')][_0x808d('0x37')]?_0x569dd0[_0x808d('0x36')]:_0x437dba['model'];_0x569dd0[_0x808d('0x56')]=qs[_0x808d('0x39')](_0x10a7d8[_0x808d('0x31')]['sort']);_0x569dd0[_0x808d('0x3c')]=qs[_0x808d('0x32')](_['pick'](_0x10a7d8[_0x808d('0x31')],_0x437dba['filters']));if(_0x10a7d8[_0x808d('0x31')][_0x808d('0x3b')]){_0x569dd0[_0x808d('0x3c')]=_['merge'](_0x569dd0['where'],{'$or':_['map'](_0x569dd0[_0x808d('0x36')],function(_0x5d48fc){var _0x464744={};_0x464744[_0x5d48fc]={'$like':'%'+_0x10a7d8[_0x808d('0x31')]['filter']+'%'};return _0x464744;})});}_0x569dd0=_[_0x808d('0x3d')]({},_0x569dd0,_0x10a7d8[_0x808d('0x3f')]);return _0x5b1fc7[_0x808d('0x59')](_0x569dd0);}})['then'](function(_0x1abc74){if(_0x1abc74){_0x26e84d=_0x1abc74[_0x808d('0x37')];if(!_0x10a7d8['query'][_0x808d('0x58')]('nolimit')){_0x569dd0['limit']=qs['limit'](_0x10a7d8[_0x808d('0x31')][_0x808d('0x1d')]);_0x569dd0[_0x808d('0x1b')]=qs['offset'](_0x10a7d8['query'][_0x808d('0x1b')]);}return _0x5b1fc7[_0x808d('0x59')](_0x569dd0);}})[_0x808d('0x23')](function(_0x24e1bc){if(_0x24e1bc){return _0x24e1bc?{'count':_0x26e84d,'rows':_0x24e1bc}:null;}})[_0x808d('0x23')](respondWithResult(_0x5cd324,null))['catch'](handleError(_0x5cd324,null));};exports[_0x808d('0x5a')]=function(_0x2b6444,_0x42d67f,_0x352ca2){if(_0x2b6444[_0x808d('0x4a')]['id']){delete _0x2b6444[_0x808d('0x4a')]['id'];}return db[_0x808d('0x2f')][_0x808d('0x48')]({'where':{'id':_0x2b6444['params']['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x42d67f,null))[_0x808d('0x23')](function(_0x17346e){if(_0x17346e){_0x2b6444['body'][_0x808d('0x5b')]=_0x17346e['id'];return db[_0x808d('0x5c')][_0x808d('0x49')](_0x2b6444[_0x808d('0x4a')]);}})['then'](respondWithResult(_0x42d67f,null))[_0x808d('0x43')](handleError(_0x42d67f,null));};exports[_0x808d('0x5d')]=function(_0x87bb57,_0x4333f3,_0x531fa7){var _0x4dfead={};var _0x4f69fa={};var _0x3c5743;var _0x471163;return db[_0x808d('0x2f')][_0x808d('0x55')]({'where':{'id':_0x87bb57[_0x808d('0x45')]['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x4333f3,null))[_0x808d('0x23')](function(_0x41c1af){if(_0x41c1af){_0x3c5743=_0x41c1af;_0x4f69fa[_0x808d('0x33')]=_[_0x808d('0x46')](db[_0x808d('0x5c')][_0x808d('0x47')]);_0x4f69fa[_0x808d('0x31')]=_[_0x808d('0x46')](_0x87bb57[_0x808d('0x31')]);_0x4f69fa['filters']=_[_0x808d('0x34')](_0x4f69fa['model'],_0x4f69fa['query']);_0x4dfead['attributes']=_[_0x808d('0x34')](_0x4f69fa[_0x808d('0x33')],qs[_0x808d('0x35')](_0x87bb57[_0x808d('0x31')][_0x808d('0x35')]));_0x4dfead[_0x808d('0x36')]=_0x4dfead[_0x808d('0x36')][_0x808d('0x37')]?_0x4dfead['attributes']:_0x4f69fa[_0x808d('0x33')];_0x4dfead[_0x808d('0x56')]=qs['sort'](_0x87bb57[_0x808d('0x31')]['sort']);_0x4dfead[_0x808d('0x3c')]=qs['filters'](_['pick'](_0x87bb57[_0x808d('0x31')],_0x4f69fa['filters']));if(_0x87bb57['query']['filter']){_0x4dfead['where']=_[_0x808d('0x3d')](_0x4dfead[_0x808d('0x3c')],{'$or':_[_0x808d('0x2e')](_0x4dfead[_0x808d('0x36')],function(_0x5c1dbe){var _0x20d6f2={};_0x20d6f2[_0x5c1dbe]={'$like':'%'+_0x87bb57[_0x808d('0x31')][_0x808d('0x3b')]+'%'};return _0x20d6f2;})});}_0x4dfead=_[_0x808d('0x3d')]({},_0x4dfead,_0x87bb57['options']);return _0x3c5743[_0x808d('0x5d')](_0x4dfead);}})['then'](function(_0xbe83c8){if(_0xbe83c8){_0x471163=_0xbe83c8[_0x808d('0x37')];if(!_0x87bb57['query']['hasOwnProperty']('nolimit')){_0x4dfead[_0x808d('0x1d')]=qs[_0x808d('0x1d')](_0x87bb57[_0x808d('0x31')][_0x808d('0x1d')]);_0x4dfead[_0x808d('0x1b')]=qs['offset'](_0x87bb57[_0x808d('0x31')][_0x808d('0x1b')]);}return _0x3c5743[_0x808d('0x5d')](_0x4dfead);}})[_0x808d('0x23')](function(_0x216291){if(_0x216291){return _0x216291?{'count':_0x471163,'rows':_0x216291}:null;}})[_0x808d('0x23')](respondWithResult(_0x4333f3,null))['catch'](handleError(_0x4333f3,null));}; \ No newline at end of file +var _0x7baf=['hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Triggers','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x27b56d,_0x4ab96a){var _0x443280=function(_0x1ce965){while(--_0x1ce965){_0x27b56d['push'](_0x27b56d['shift']());}};_0x443280(++_0x4ab96a);}(_0x7baf,0x1a9));var _0xf7ba=function(_0x42c560,_0x51587f){_0x42c560=_0x42c560-0x0;var _0x4c0730=_0x7baf[_0x42c560];return _0x4c0730;};'use strict';var emlformat=require(_0xf7ba('0x0'));var rimraf=require(_0xf7ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7ba('0x2'));var rp=require(_0xf7ba('0x3'));var moment=require(_0xf7ba('0x4'));var BPromise=require(_0xf7ba('0x5'));var Mustache=require(_0xf7ba('0x6'));var util=require(_0xf7ba('0x7'));var path=require(_0xf7ba('0x8'));var sox=require(_0xf7ba('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7ba('0xa'));var _=require(_0xf7ba('0xb'));var squel=require(_0xf7ba('0xc'));var crypto=require(_0xf7ba('0xd'));var jsforce=require(_0xf7ba('0xe'));var deskjs=require(_0xf7ba('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf7ba('0x10'));var Redis=require(_0xf7ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7ba('0x12'));var as=require(_0xf7ba('0x13'));var hardwareService=require(_0xf7ba('0x14'));var logger=require(_0xf7ba('0x15'))(_0xf7ba('0x16'));var utils=require('../../config/utils');var config=require(_0xf7ba('0x17'));var licenseUtil=require(_0xf7ba('0x18'));var db=require(_0xf7ba('0x19'))['db'];function respondWithStatusCode(_0x2416f7,_0x3dd6e9){_0x3dd6e9=_0x3dd6e9||0xcc;return function(_0xb90870){if(_0xb90870){return _0x2416f7[_0xf7ba('0x1a')](_0x3dd6e9);}return _0x2416f7[_0xf7ba('0x1b')](_0x3dd6e9)[_0xf7ba('0x1c')]();};}function respondWithResult(_0x5536b6,_0x415830){_0x415830=_0x415830||0xc8;return function(_0x578635){if(_0x578635){return _0x5536b6[_0xf7ba('0x1b')](_0x415830)[_0xf7ba('0x1d')](_0x578635);}};}function respondWithFilteredResult(_0x2978cf,_0x793abd){return function(_0x321dca){if(_0x321dca){var _0x18e418=typeof _0x793abd[_0xf7ba('0x1e')]===_0xf7ba('0x1f')&&typeof _0x793abd[_0xf7ba('0x20')]==='undefined';var _0xff2d20=_0x321dca[_0xf7ba('0x21')];var _0x222040=_0x18e418?0x0:_0x793abd[_0xf7ba('0x1e')];var _0x4b8945=_0x18e418?_0x321dca['count']:_0x793abd[_0xf7ba('0x1e')]+_0x793abd[_0xf7ba('0x20')];var _0x2441d1;if(_0x4b8945>=_0xff2d20){_0x4b8945=_0xff2d20;_0x2441d1=0xc8;}else{_0x2441d1=0xce;}_0x2978cf[_0xf7ba('0x1b')](_0x2441d1);return _0x2978cf['set'](_0xf7ba('0x22'),_0x222040+'-'+_0x4b8945+'/'+_0xff2d20)[_0xf7ba('0x1d')](_0x321dca);}return null;};}function patchUpdates(_0x730be4){return function(_0xf0b123){try{jsonpatch[_0xf7ba('0x23')](_0xf0b123,_0x730be4,!![]);}catch(_0x287289){return BPromise[_0xf7ba('0x24')](_0x287289);}return _0xf0b123['save']();};}function saveUpdates(_0x2fe8c1,_0x182b14){return function(_0x52355c){if(_0x52355c){return _0x52355c[_0xf7ba('0x25')](_0x2fe8c1)[_0xf7ba('0x26')](function(_0x2c5d97){return _0x2c5d97;});}return null;};}function removeEntity(_0xe7efcb,_0x5e9662){return function(_0x5711a1){if(_0x5711a1){return _0x5711a1[_0xf7ba('0x27')]()[_0xf7ba('0x26')](function(){var _0x1f9b32=_0x5711a1[_0xf7ba('0x28')]({'plain':!![]});var _0xd3b746=_0xf7ba('0x29');return db['UserProfileResource'][_0xf7ba('0x27')]({'where':{'type':_0xd3b746,'resourceId':_0x1f9b32['id']}})[_0xf7ba('0x26')](function(){return _0x5711a1;});})[_0xf7ba('0x26')](function(){_0xe7efcb[_0xf7ba('0x1b')](0xcc)[_0xf7ba('0x1c')]();});}};}function handleEntityNotFound(_0xe5662,_0x4960e2){return function(_0x5f27cf){if(!_0x5f27cf){_0xe5662['sendStatus'](0x194);}return _0x5f27cf;};}function handleError(_0x443bfc,_0xbf0fb3){_0xbf0fb3=_0xbf0fb3||0x1f4;return function(_0x46ba71){logger[_0xf7ba('0x2a')](_0x46ba71[_0xf7ba('0x2b')]);if(_0x46ba71[_0xf7ba('0x2c')]){delete _0x46ba71['name'];}_0x443bfc['status'](_0xbf0fb3)[_0xf7ba('0x2d')](_0x46ba71);};}exports[_0xf7ba('0x2e')]=function(_0x44bb3b,_0x5bb5e5){var _0x269447={},_0x35f0fd={},_0x19d905={'count':0x0,'rows':[]};var _0x4d6655=_['map'](db[_0xf7ba('0x2f')][_0xf7ba('0x30')],function(_0x562f0a){return{'name':_0x562f0a[_0xf7ba('0x31')],'type':_0x562f0a[_0xf7ba('0x32')][_0xf7ba('0x33')]};});_0x35f0fd[_0xf7ba('0x34')]=_['map'](_0x4d6655,_0xf7ba('0x2c'));_0x35f0fd['query']=_[_0xf7ba('0x35')](_0x44bb3b[_0xf7ba('0x36')]);_0x35f0fd[_0xf7ba('0x37')]=_[_0xf7ba('0x38')](_0x35f0fd[_0xf7ba('0x34')],_0x35f0fd[_0xf7ba('0x36')]);_0x269447[_0xf7ba('0x39')]=_[_0xf7ba('0x38')](_0x35f0fd[_0xf7ba('0x34')],qs['fields'](_0x44bb3b[_0xf7ba('0x36')][_0xf7ba('0x3a')]));_0x269447[_0xf7ba('0x39')]=_0x269447[_0xf7ba('0x39')][_0xf7ba('0x3b')]?_0x269447[_0xf7ba('0x39')]:_0x35f0fd[_0xf7ba('0x34')];if(!_0x44bb3b[_0xf7ba('0x36')][_0xf7ba('0x3c')](_0xf7ba('0x3d'))){_0x269447[_0xf7ba('0x20')]=qs[_0xf7ba('0x20')](_0x44bb3b['query'][_0xf7ba('0x20')]);_0x269447[_0xf7ba('0x1e')]=qs['offset'](_0x44bb3b['query'][_0xf7ba('0x1e')]);}_0x269447[_0xf7ba('0x3e')]=qs['sort'](_0x44bb3b[_0xf7ba('0x36')][_0xf7ba('0x3f')]);_0x269447['where']=qs['filters'](_[_0xf7ba('0x40')](_0x44bb3b['query'],_0x35f0fd[_0xf7ba('0x37')]),_0x4d6655);if(_0x44bb3b[_0xf7ba('0x36')]['filter']){_0x269447[_0xf7ba('0x41')]=_[_0xf7ba('0x42')](_0x269447[_0xf7ba('0x41')],{'$or':_[_0xf7ba('0x43')](_0x4d6655,function(_0x469a96){if(_0x469a96[_0xf7ba('0x32')]!==_0xf7ba('0x44')){var _0xc2d3c3={};_0xc2d3c3[_0x469a96[_0xf7ba('0x2c')]]={'$like':'%'+_0x44bb3b[_0xf7ba('0x36')][_0xf7ba('0x45')]+'%'};return _0xc2d3c3;}})});}_0x269447=_[_0xf7ba('0x42')]({},_0x269447,_0x44bb3b['options']);var _0x2285d4={'where':_0x269447['where']};return db[_0xf7ba('0x2f')][_0xf7ba('0x21')](_0x2285d4)['then'](function(_0x1729e8){_0x19d905[_0xf7ba('0x21')]=_0x1729e8;if(_0x44bb3b[_0xf7ba('0x36')][_0xf7ba('0x46')]){_0x269447['include']=[{'all':!![]}];}return db[_0xf7ba('0x2f')][_0xf7ba('0x47')](_0x269447);})[_0xf7ba('0x26')](function(_0x12811c){_0x19d905[_0xf7ba('0x48')]=_0x12811c;return _0x19d905;})[_0xf7ba('0x26')](respondWithFilteredResult(_0x5bb5e5,_0x269447))[_0xf7ba('0x49')](handleError(_0x5bb5e5,null));};exports[_0xf7ba('0x4a')]=function(_0x2da47c,_0x3d90fa){var _0x3bf4e7={'raw':![],'where':{'id':_0x2da47c[_0xf7ba('0x4b')]['id']}},_0x4bf9ef={};_0x4bf9ef[_0xf7ba('0x34')]=_['keys'](db[_0xf7ba('0x2f')]['rawAttributes']);_0x4bf9ef[_0xf7ba('0x36')]=_[_0xf7ba('0x35')](_0x2da47c['query']);_0x4bf9ef[_0xf7ba('0x37')]=_[_0xf7ba('0x38')](_0x4bf9ef[_0xf7ba('0x34')],_0x4bf9ef[_0xf7ba('0x36')]);_0x3bf4e7[_0xf7ba('0x39')]=_[_0xf7ba('0x38')](_0x4bf9ef[_0xf7ba('0x34')],qs['fields'](_0x2da47c[_0xf7ba('0x36')][_0xf7ba('0x3a')]));_0x3bf4e7['attributes']=_0x3bf4e7[_0xf7ba('0x39')][_0xf7ba('0x3b')]?_0x3bf4e7[_0xf7ba('0x39')]:_0x4bf9ef['model'];if(_0x2da47c[_0xf7ba('0x36')][_0xf7ba('0x46')]){_0x3bf4e7[_0xf7ba('0x4c')]=[{'all':!![]}];}_0x3bf4e7=_[_0xf7ba('0x42')]({},_0x3bf4e7,_0x2da47c[_0xf7ba('0x4d')]);return db[_0xf7ba('0x2f')][_0xf7ba('0x4e')](_0x3bf4e7)[_0xf7ba('0x26')](handleEntityNotFound(_0x3d90fa,null))[_0xf7ba('0x26')](respondWithResult(_0x3d90fa,null))['catch'](handleError(_0x3d90fa,null));};exports['create']=function(_0x4b4480,_0x3f9ede){return db[_0xf7ba('0x2f')][_0xf7ba('0x4f')](_0x4b4480[_0xf7ba('0x50')],{})[_0xf7ba('0x26')](function(_0x4d13a9){var _0x1e7549=_0x4b4480[_0xf7ba('0x51')][_0xf7ba('0x28')]({'plain':!![]});if(!_0x1e7549)throw new Error(_0xf7ba('0x52'));if(_0x1e7549[_0xf7ba('0x53')]===_0xf7ba('0x51')){var _0x111900=_0x4d13a9[_0xf7ba('0x28')]({'plain':!![]});var _0xca5c3a=_0xf7ba('0x29');return db[_0xf7ba('0x54')]['find']({'where':{'name':_0xca5c3a,'userProfileId':_0x1e7549[_0xf7ba('0x55')]},'raw':!![]})[_0xf7ba('0x26')](function(_0x135e75){if(_0x135e75&&_0x135e75['autoAssociation']===0x0){return db[_0xf7ba('0x56')][_0xf7ba('0x4f')]({'name':_0x111900['name'],'resourceId':_0x111900['id'],'type':_0x135e75['name'],'sectionId':_0x135e75['id']},{})[_0xf7ba('0x26')](function(){return _0x4d13a9;});}else{return _0x4d13a9;}})[_0xf7ba('0x49')](function(_0x57ae4f){logger['error'](_0xf7ba('0x57'),_0x57ae4f);throw _0x57ae4f;});}return _0x4d13a9;})[_0xf7ba('0x26')](respondWithResult(_0x3f9ede,0xc9))[_0xf7ba('0x49')](handleError(_0x3f9ede,null));};exports[_0xf7ba('0x25')]=function(_0x586d9e,_0x301a3c){if(_0x586d9e[_0xf7ba('0x50')]['id']){delete _0x586d9e[_0xf7ba('0x50')]['id'];}return db[_0xf7ba('0x2f')][_0xf7ba('0x4e')]({'where':{'id':_0x586d9e[_0xf7ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x301a3c,null))[_0xf7ba('0x26')](saveUpdates(_0x586d9e[_0xf7ba('0x50')],null))[_0xf7ba('0x26')](respondWithResult(_0x301a3c,null))['catch'](handleError(_0x301a3c,null));};exports[_0xf7ba('0x27')]=function(_0x4f14c1,_0xa1a7fb){return db[_0xf7ba('0x2f')][_0xf7ba('0x4e')]({'where':{'id':_0x4f14c1[_0xf7ba('0x4b')]['id']}})[_0xf7ba('0x26')](handleEntityNotFound(_0xa1a7fb,null))['then'](removeEntity(_0xa1a7fb,null))[_0xf7ba('0x49')](handleError(_0xa1a7fb,null));};exports['addAllCondition']=function(_0x129a65,_0x3a4190,_0x411297){if(_0x129a65['body']['id']){delete _0x129a65[_0xf7ba('0x50')]['id'];}return db['Trigger'][_0xf7ba('0x4e')]({'where':{'id':_0x129a65[_0xf7ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a4190,null))[_0xf7ba('0x26')](function(_0x1537b7){if(_0x1537b7){_0x129a65['body'][_0xf7ba('0x58')]=_0x1537b7['id'];return db[_0xf7ba('0x59')][_0xf7ba('0x4f')](_0x129a65[_0xf7ba('0x50')]);}})['then'](respondWithResult(_0x3a4190,null))[_0xf7ba('0x49')](handleError(_0x3a4190,null));};exports[_0xf7ba('0x5a')]=function(_0x5b4bcd,_0x4e9e07,_0x3ffc90){if(_0x5b4bcd['body']['id']){delete _0x5b4bcd['body']['id'];}return db[_0xf7ba('0x2f')]['find']({'where':{'id':_0x5b4bcd[_0xf7ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e9e07,null))[_0xf7ba('0x26')](function(_0x4a72c7){if(_0x4a72c7){_0x5b4bcd[_0xf7ba('0x50')][_0xf7ba('0x5b')]=_0x4a72c7['id'];return db[_0xf7ba('0x59')][_0xf7ba('0x4f')](_0x5b4bcd[_0xf7ba('0x50')]);}})[_0xf7ba('0x26')](respondWithResult(_0x4e9e07,null))['catch'](handleError(_0x4e9e07,null));};exports[_0xf7ba('0x5c')]=function(_0x11ef8e,_0x52336f,_0x19c1a3){var _0x18dad8={};var _0x1a8531={};var _0x5b8879;var _0x1d927d;return db[_0xf7ba('0x2f')]['findOne']({'where':{'id':_0x11ef8e['params']['id']}})[_0xf7ba('0x26')](handleEntityNotFound(_0x52336f,null))[_0xf7ba('0x26')](function(_0x3bf8f0){if(_0x3bf8f0){_0x5b8879=_0x3bf8f0;_0x1a8531[_0xf7ba('0x34')]=_[_0xf7ba('0x35')](db[_0xf7ba('0x59')][_0xf7ba('0x30')]);_0x1a8531[_0xf7ba('0x36')]=_['keys'](_0x11ef8e[_0xf7ba('0x36')]);_0x1a8531[_0xf7ba('0x37')]=_[_0xf7ba('0x38')](_0x1a8531[_0xf7ba('0x34')],_0x1a8531[_0xf7ba('0x36')]);_0x18dad8[_0xf7ba('0x39')]=_['intersection'](_0x1a8531[_0xf7ba('0x34')],qs[_0xf7ba('0x3a')](_0x11ef8e[_0xf7ba('0x36')]['fields']));_0x18dad8[_0xf7ba('0x39')]=_0x18dad8[_0xf7ba('0x39')][_0xf7ba('0x3b')]?_0x18dad8[_0xf7ba('0x39')]:_0x1a8531[_0xf7ba('0x34')];_0x18dad8[_0xf7ba('0x3e')]=qs[_0xf7ba('0x3f')](_0x11ef8e[_0xf7ba('0x36')]['sort']);_0x18dad8[_0xf7ba('0x41')]=qs[_0xf7ba('0x37')](_[_0xf7ba('0x40')](_0x11ef8e[_0xf7ba('0x36')],_0x1a8531[_0xf7ba('0x37')]));if(_0x11ef8e[_0xf7ba('0x36')][_0xf7ba('0x45')]){_0x18dad8['where']=_[_0xf7ba('0x42')](_0x18dad8['where'],{'$or':_['map'](_0x18dad8[_0xf7ba('0x39')],function(_0x3d64ae){var _0x147dc8={};_0x147dc8[_0x3d64ae]={'$like':'%'+_0x11ef8e[_0xf7ba('0x36')]['filter']+'%'};return _0x147dc8;})});}_0x18dad8=_[_0xf7ba('0x42')]({},_0x18dad8,_0x11ef8e[_0xf7ba('0x4d')]);return _0x5b8879['getAllConditions'](_0x18dad8);}})[_0xf7ba('0x26')](function(_0x132c4e){if(_0x132c4e){_0x1d927d=_0x132c4e[_0xf7ba('0x3b')];if(!_0x11ef8e['query']['hasOwnProperty']('nolimit')){_0x18dad8[_0xf7ba('0x20')]=qs[_0xf7ba('0x20')](_0x11ef8e[_0xf7ba('0x36')]['limit']);_0x18dad8[_0xf7ba('0x1e')]=qs[_0xf7ba('0x1e')](_0x11ef8e[_0xf7ba('0x36')][_0xf7ba('0x1e')]);}return _0x5b8879[_0xf7ba('0x5c')](_0x18dad8);}})[_0xf7ba('0x26')](function(_0x1729b0){if(_0x1729b0){return _0x1729b0?{'count':_0x1d927d,'rows':_0x1729b0}:null;}})[_0xf7ba('0x26')](respondWithResult(_0x52336f,null))[_0xf7ba('0x49')](handleError(_0x52336f,null));};exports[_0xf7ba('0x5d')]=function(_0x59e0a5,_0xbdd04a,_0x26ee98){var _0x176bc1={};var _0x52aab5={};var _0x3435b9;var _0x3ce8e1;return db[_0xf7ba('0x2f')][_0xf7ba('0x5e')]({'where':{'id':_0x59e0a5[_0xf7ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0xbdd04a,null))['then'](function(_0x312b88){if(_0x312b88){_0x3435b9=_0x312b88;_0x52aab5[_0xf7ba('0x34')]=_[_0xf7ba('0x35')](db[_0xf7ba('0x59')][_0xf7ba('0x30')]);_0x52aab5[_0xf7ba('0x36')]=_['keys'](_0x59e0a5[_0xf7ba('0x36')]);_0x52aab5['filters']=_[_0xf7ba('0x38')](_0x52aab5[_0xf7ba('0x34')],_0x52aab5[_0xf7ba('0x36')]);_0x176bc1[_0xf7ba('0x39')]=_[_0xf7ba('0x38')](_0x52aab5['model'],qs[_0xf7ba('0x3a')](_0x59e0a5[_0xf7ba('0x36')][_0xf7ba('0x3a')]));_0x176bc1[_0xf7ba('0x39')]=_0x176bc1[_0xf7ba('0x39')][_0xf7ba('0x3b')]?_0x176bc1['attributes']:_0x52aab5[_0xf7ba('0x34')];_0x176bc1[_0xf7ba('0x3e')]=qs['sort'](_0x59e0a5['query'][_0xf7ba('0x3f')]);_0x176bc1['where']=qs[_0xf7ba('0x37')](_[_0xf7ba('0x40')](_0x59e0a5['query'],_0x52aab5[_0xf7ba('0x37')]));if(_0x59e0a5['query'][_0xf7ba('0x45')]){_0x176bc1[_0xf7ba('0x41')]=_[_0xf7ba('0x42')](_0x176bc1[_0xf7ba('0x41')],{'$or':_[_0xf7ba('0x43')](_0x176bc1[_0xf7ba('0x39')],function(_0x31591c){var _0x9b1a67={};_0x9b1a67[_0x31591c]={'$like':'%'+_0x59e0a5['query']['filter']+'%'};return _0x9b1a67;})});}_0x176bc1=_[_0xf7ba('0x42')]({},_0x176bc1,_0x59e0a5[_0xf7ba('0x4d')]);return _0x3435b9[_0xf7ba('0x5d')](_0x176bc1);}})[_0xf7ba('0x26')](function(_0x373f0c){if(_0x373f0c){_0x3ce8e1=_0x373f0c[_0xf7ba('0x3b')];if(!_0x59e0a5['query'][_0xf7ba('0x3c')]('nolimit')){_0x176bc1['limit']=qs[_0xf7ba('0x20')](_0x59e0a5['query'][_0xf7ba('0x20')]);_0x176bc1['offset']=qs[_0xf7ba('0x1e')](_0x59e0a5['query']['offset']);}return _0x3435b9[_0xf7ba('0x5d')](_0x176bc1);}})['then'](function(_0x27a364){if(_0x27a364){return _0x27a364?{'count':_0x3ce8e1,'rows':_0x27a364}:null;}})[_0xf7ba('0x26')](respondWithResult(_0xbdd04a,null))[_0xf7ba('0x49')](handleError(_0xbdd04a,null));};exports['addAction']=function(_0xe9843,_0x27b444,_0x6c778a){if(_0xe9843[_0xf7ba('0x50')]['id']){delete _0xe9843['body']['id'];}return db[_0xf7ba('0x2f')][_0xf7ba('0x4e')]({'where':{'id':_0xe9843[_0xf7ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27b444,null))[_0xf7ba('0x26')](function(_0x3f979b){if(_0x3f979b){_0xe9843['body']['TriggerId']=_0x3f979b['id'];return db[_0xf7ba('0x5f')][_0xf7ba('0x4f')](_0xe9843[_0xf7ba('0x50')]);}})[_0xf7ba('0x26')](respondWithResult(_0x27b444,null))[_0xf7ba('0x49')](handleError(_0x27b444,null));};exports[_0xf7ba('0x60')]=function(_0x376082,_0xd7cbe4,_0x90337c){var _0x50db40={};var _0x16ae95={};var _0x2cffdc;var _0x4f1405;return db[_0xf7ba('0x2f')][_0xf7ba('0x5e')]({'where':{'id':_0x376082[_0xf7ba('0x4b')]['id']}})[_0xf7ba('0x26')](handleEntityNotFound(_0xd7cbe4,null))[_0xf7ba('0x26')](function(_0x78ee34){if(_0x78ee34){_0x2cffdc=_0x78ee34;_0x16ae95[_0xf7ba('0x34')]=_['keys'](db[_0xf7ba('0x5f')][_0xf7ba('0x30')]);_0x16ae95['query']=_[_0xf7ba('0x35')](_0x376082['query']);_0x16ae95[_0xf7ba('0x37')]=_['intersection'](_0x16ae95[_0xf7ba('0x34')],_0x16ae95[_0xf7ba('0x36')]);_0x50db40[_0xf7ba('0x39')]=_[_0xf7ba('0x38')](_0x16ae95[_0xf7ba('0x34')],qs['fields'](_0x376082['query'][_0xf7ba('0x3a')]));_0x50db40[_0xf7ba('0x39')]=_0x50db40[_0xf7ba('0x39')][_0xf7ba('0x3b')]?_0x50db40[_0xf7ba('0x39')]:_0x16ae95['model'];_0x50db40['order']=qs[_0xf7ba('0x3f')](_0x376082[_0xf7ba('0x36')][_0xf7ba('0x3f')]);_0x50db40[_0xf7ba('0x41')]=qs[_0xf7ba('0x37')](_[_0xf7ba('0x40')](_0x376082['query'],_0x16ae95['filters']));if(_0x376082[_0xf7ba('0x36')][_0xf7ba('0x45')]){_0x50db40[_0xf7ba('0x41')]=_['merge'](_0x50db40[_0xf7ba('0x41')],{'$or':_['map'](_0x50db40['attributes'],function(_0x47fdf0){var _0x566e04={};_0x566e04[_0x47fdf0]={'$like':'%'+_0x376082[_0xf7ba('0x36')][_0xf7ba('0x45')]+'%'};return _0x566e04;})});}_0x50db40=_['merge']({},_0x50db40,_0x376082['options']);return _0x2cffdc['getActions'](_0x50db40);}})[_0xf7ba('0x26')](function(_0x1b4458){if(_0x1b4458){_0x4f1405=_0x1b4458['length'];if(!_0x376082[_0xf7ba('0x36')]['hasOwnProperty'](_0xf7ba('0x3d'))){_0x50db40[_0xf7ba('0x20')]=qs[_0xf7ba('0x20')](_0x376082['query']['limit']);_0x50db40[_0xf7ba('0x1e')]=qs[_0xf7ba('0x1e')](_0x376082[_0xf7ba('0x36')][_0xf7ba('0x1e')]);}return _0x2cffdc[_0xf7ba('0x60')](_0x50db40);}})[_0xf7ba('0x26')](function(_0x5ac33d){if(_0x5ac33d){return _0x5ac33d?{'count':_0x4f1405,'rows':_0x5ac33d}:null;}})['then'](respondWithResult(_0xd7cbe4,null))[_0xf7ba('0x49')](handleError(_0xd7cbe4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 252f1e4..40227de 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 _0x0eec=['exports','define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x477ef6,_0x1e059d){var _0xdee967=function(_0x3a58e5){while(--_0x3a58e5){_0x477ef6['push'](_0x477ef6['shift']());}};_0xdee967(++_0x1e059d);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./trigger.attributes');module[_0xc0ee('0x8')]=function(_0x4db3d6,_0x218797){return _0x4db3d6[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c02=['./trigger.attributes','exports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x508867,_0x37c32b){var _0x50d219=function(_0x51c6ed){while(--_0x51c6ed){_0x508867['push'](_0x508867['shift']());}};_0x50d219(++_0x37c32b);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var fs=require('fs');var path=require(_0x20c0('0x5'));var rimraf=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var attributes=require(_0x20c0('0x8'));module[_0x20c0('0x9')]=function(_0x13312d,_0xd25ee8){return _0x13312d['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 0bd7e4c..5664baa 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 _0xafe2=['options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','findAll'];(function(_0x33cab0,_0x4dc044){var _0x4fbfb7=function(_0x4afd02){while(--_0x4afd02){_0x33cab0['push'](_0x33cab0['shift']());}};_0x4fbfb7(++_0x4dc044);}(_0xafe2,0x6d));var _0x2afe=function(_0x55b485,_0x29ad9a){_0x55b485=_0x55b485-0x0;var _0x3cb6b3=_0xafe2[_0x55b485];return _0x3cb6b3;};'use strict';var _=require('lodash');var util=require(_0x2afe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2afe('0x1'));var fs=require('fs');var Redis=require(_0x2afe('0x2'));var db=require(_0x2afe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2afe('0x4'))(_0x2afe('0x5'));var config=require(_0x2afe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2afe('0x7')][_0x2afe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5221de,_0x48041c,_0x252052){return new BPromise(function(_0x4e5f20,_0x54b8ab){return client[_0x2afe('0x9')](_0x5221de,_0x252052)[_0x2afe('0xa')](function(_0x3eaabf){logger[_0x2afe('0xb')](_0x2afe('0xc'),_0x48041c,'request\x20sent');logger[_0x2afe('0xd')](_0x2afe('0xe'),_0x48041c,_0x2afe('0xf'),JSON[_0x2afe('0x10')](_0x3eaabf));if(_0x3eaabf['error']){if(_0x3eaabf[_0x2afe('0x11')]['code']===0x1f4){logger[_0x2afe('0x11')](_0x2afe('0xc'),_0x48041c,_0x3eaabf['error'][_0x2afe('0x12')]);return _0x54b8ab(_0x3eaabf[_0x2afe('0x11')][_0x2afe('0x12')]);}logger[_0x2afe('0x11')]('Trigger,\x20%s,\x20%s',_0x48041c,_0x3eaabf[_0x2afe('0x11')][_0x2afe('0x12')]);return _0x4e5f20(_0x3eaabf['error'][_0x2afe('0x12')]);}else{logger[_0x2afe('0xb')](_0x2afe('0xc'),_0x48041c,_0x2afe('0xf'));_0x4e5f20(_0x3eaabf[_0x2afe('0x13')][_0x2afe('0x12')]);}})[_0x2afe('0x14')](function(_0x147353){logger[_0x2afe('0x11')](_0x2afe('0xc'),_0x48041c,_0x147353);_0x54b8ab(_0x147353);});});}exports[_0x2afe('0x15')]=function(_0x5be196){var _0x1aea92=this;return new Promise(function(_0x1b624d,_0x1890b8){return db['Trigger'][_0x2afe('0x16')]({'raw':_0x5be196[_0x2afe('0x17')]?_0x5be196[_0x2afe('0x17')][_0x2afe('0x18')]===undefined?!![]:![]:!![],'where':_0x5be196[_0x2afe('0x17')]?_0x5be196[_0x2afe('0x17')][_0x2afe('0x19')]||null:null,'attributes':_0x5be196[_0x2afe('0x17')]?_0x5be196['options'][_0x2afe('0x1a')]||null:null,'limit':_0x5be196['options']?_0x5be196[_0x2afe('0x17')][_0x2afe('0x1b')]||null:null,'include':_0x5be196[_0x2afe('0x17')]?_0x5be196['options'][_0x2afe('0x1c')]?_[_0x2afe('0x1d')](_0x5be196['options']['include'],function(_0x4a632e){return{'model':db[_0x4a632e[_0x2afe('0x1e')]],'as':_0x4a632e['as'],'attributes':_0x4a632e[_0x2afe('0x1a')],'include':_0x4a632e[_0x2afe('0x1c')]?_[_0x2afe('0x1d')](_0x4a632e[_0x2afe('0x1c')],function(_0x2f255f){return{'model':db[_0x2f255f[_0x2afe('0x1e')]],'as':_0x2f255f['as'],'attributes':_0x2f255f[_0x2afe('0x1a')],'include':_0x2f255f['include']?_[_0x2afe('0x1d')](_0x2f255f[_0x2afe('0x1c')],function(_0x108b60){return{'model':db[_0x108b60[_0x2afe('0x1e')]],'as':_0x108b60['as'],'attributes':_0x108b60[_0x2afe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2afe('0xa')](function(_0x6c8646){logger[_0x2afe('0xb')](_0x2afe('0x15'),_0x5be196);logger[_0x2afe('0xd')](_0x2afe('0x15'),_0x5be196,JSON['stringify'](_0x6c8646));_0x1b624d(_0x6c8646);})[_0x2afe('0x14')](function(_0x2d0ad7){logger[_0x2afe('0x11')]('GetTrigger',_0x2d0ad7[_0x2afe('0x12')],_0x5be196);_0x1890b8(_0x1aea92[_0x2afe('0x11')](0x1f4,_0x2d0ad7[_0x2afe('0x12')]));});});};exports[_0x2afe('0x1f')]=function(_0x2585a4){var _0x12df13=this;return new Promise(function(_0x37aba1,_0xc49932){return db['Trigger'][_0x2afe('0x20')]({'raw':_0x2585a4['options']?_0x2585a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2585a4[_0x2afe('0x17')]?_0x2585a4[_0x2afe('0x17')][_0x2afe('0x19')]||null:null,'attributes':_0x2585a4[_0x2afe('0x17')]?_0x2585a4['options']['attributes']||null:null,'include':_0x2585a4[_0x2afe('0x17')]?_0x2585a4[_0x2afe('0x17')]['include']?_[_0x2afe('0x1d')](_0x2585a4[_0x2afe('0x17')]['include'],function(_0x3e6681){return{'model':db[_0x3e6681[_0x2afe('0x1e')]],'as':_0x3e6681['as'],'attributes':_0x3e6681['attributes'],'include':_0x3e6681['include']?_[_0x2afe('0x1d')](_0x3e6681[_0x2afe('0x1c')],function(_0x2596e0){return{'model':db[_0x2596e0['model']],'as':_0x2596e0['as'],'attributes':_0x2596e0['attributes'],'include':_0x2596e0[_0x2afe('0x1c')]?_[_0x2afe('0x1d')](_0x2596e0[_0x2afe('0x1c')],function(_0x468135){return{'model':db[_0x468135[_0x2afe('0x1e')]],'as':_0x468135['as'],'attributes':_0x468135[_0x2afe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2afe('0xa')](function(_0x5a3fe5){logger['info'](_0x2afe('0x1f'),_0x2585a4);logger[_0x2afe('0xd')]('ShowTrigger',_0x2585a4,JSON['stringify'](_0x5a3fe5));_0x37aba1(_0x5a3fe5);})[_0x2afe('0x14')](function(_0xb45b4e){logger[_0x2afe('0x11')](_0x2afe('0x1f'),_0xb45b4e[_0x2afe('0x12')],_0x2585a4);_0xc49932(_0x12df13['error'](0x1f4,_0xb45b4e[_0x2afe('0x12')]));});});}; \ No newline at end of file +var _0x190a=['where','include','map','model','attributes','catch','ShowTrigger','Trigger','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','options','raw'];(function(_0x35aeb8,_0x41d01b){var _0xc8f75d=function(_0x1eab56){while(--_0x1eab56){_0x35aeb8['push'](_0x35aeb8['shift']());}};_0xc8f75d(++_0x41d01b);}(_0x190a,0xb3));var _0xa190=function(_0x3312f6,_0x248a41){_0x3312f6=_0x3312f6-0x0;var _0x4bbd09=_0x190a[_0x3312f6];return _0x4bbd09;};'use strict';var _=require(_0xa190('0x0'));var util=require('util');var moment=require(_0xa190('0x1'));var BPromise=require(_0xa190('0x2'));var rs=require(_0xa190('0x3'));var fs=require('fs');var Redis=require(_0xa190('0x4'));var db=require(_0xa190('0x5'))['db'];var utils=require(_0xa190('0x6'));var logger=require('../../config/logger')(_0xa190('0x7'));var config=require(_0xa190('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa190('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50f6eb,_0x2bd03e,_0x4cb699){return new BPromise(function(_0x380f92,_0x2a8764){return client[_0xa190('0xa')](_0x50f6eb,_0x4cb699)[_0xa190('0xb')](function(_0x2fe2c3){logger[_0xa190('0xc')]('Trigger,\x20%s,\x20%s',_0x2bd03e,_0xa190('0xd'));logger[_0xa190('0xe')](_0xa190('0xf'),_0x2bd03e,_0xa190('0xd'),JSON[_0xa190('0x10')](_0x2fe2c3));if(_0x2fe2c3[_0xa190('0x11')]){if(_0x2fe2c3['error'][_0xa190('0x12')]===0x1f4){logger[_0xa190('0x11')](_0xa190('0x13'),_0x2bd03e,_0x2fe2c3['error'][_0xa190('0x14')]);return _0x2a8764(_0x2fe2c3[_0xa190('0x11')][_0xa190('0x14')]);}logger[_0xa190('0x11')]('Trigger,\x20%s,\x20%s',_0x2bd03e,_0x2fe2c3[_0xa190('0x11')][_0xa190('0x14')]);return _0x380f92(_0x2fe2c3[_0xa190('0x11')][_0xa190('0x14')]);}else{logger[_0xa190('0xc')](_0xa190('0x13'),_0x2bd03e,_0xa190('0xd'));_0x380f92(_0x2fe2c3[_0xa190('0x15')][_0xa190('0x14')]);}})['catch'](function(_0x37ba99){logger[_0xa190('0x11')](_0xa190('0x13'),_0x2bd03e,_0x37ba99);_0x2a8764(_0x37ba99);});});}exports[_0xa190('0x16')]=function(_0x2509b5){var _0x243266=this;return new Promise(function(_0x3829bc,_0x247e05){return db['Trigger']['findAll']({'raw':_0x2509b5['options']?_0x2509b5[_0xa190('0x17')][_0xa190('0x18')]===undefined?!![]:![]:!![],'where':_0x2509b5[_0xa190('0x17')]?_0x2509b5[_0xa190('0x17')][_0xa190('0x19')]||null:null,'attributes':_0x2509b5['options']?_0x2509b5[_0xa190('0x17')]['attributes']||null:null,'limit':_0x2509b5[_0xa190('0x17')]?_0x2509b5[_0xa190('0x17')]['limit']||null:null,'include':_0x2509b5[_0xa190('0x17')]?_0x2509b5[_0xa190('0x17')][_0xa190('0x1a')]?_[_0xa190('0x1b')](_0x2509b5['options'][_0xa190('0x1a')],function(_0x495c55){return{'model':db[_0x495c55[_0xa190('0x1c')]],'as':_0x495c55['as'],'attributes':_0x495c55['attributes'],'include':_0x495c55[_0xa190('0x1a')]?_['map'](_0x495c55[_0xa190('0x1a')],function(_0x360b4c){return{'model':db[_0x360b4c[_0xa190('0x1c')]],'as':_0x360b4c['as'],'attributes':_0x360b4c[_0xa190('0x1d')],'include':_0x360b4c[_0xa190('0x1a')]?_[_0xa190('0x1b')](_0x360b4c[_0xa190('0x1a')],function(_0x4c719a){return{'model':db[_0x4c719a['model']],'as':_0x4c719a['as'],'attributes':_0x4c719a[_0xa190('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa190('0xb')](function(_0x127966){logger[_0xa190('0xc')]('GetTrigger',_0x2509b5);logger['debug'](_0xa190('0x16'),_0x2509b5,JSON[_0xa190('0x10')](_0x127966));_0x3829bc(_0x127966);})[_0xa190('0x1e')](function(_0x1d9696){logger[_0xa190('0x11')]('GetTrigger',_0x1d9696[_0xa190('0x14')],_0x2509b5);_0x247e05(_0x243266[_0xa190('0x11')](0x1f4,_0x1d9696['message']));});});};exports[_0xa190('0x1f')]=function(_0x4a5a78){var _0x55c2c0=this;return new Promise(function(_0x11a621,_0x29ac31){return db[_0xa190('0x20')][_0xa190('0x21')]({'raw':_0x4a5a78[_0xa190('0x17')]?_0x4a5a78['options'][_0xa190('0x18')]===undefined?!![]:![]:!![],'where':_0x4a5a78[_0xa190('0x17')]?_0x4a5a78[_0xa190('0x17')]['where']||null:null,'attributes':_0x4a5a78[_0xa190('0x17')]?_0x4a5a78['options'][_0xa190('0x1d')]||null:null,'include':_0x4a5a78[_0xa190('0x17')]?_0x4a5a78[_0xa190('0x17')][_0xa190('0x1a')]?_[_0xa190('0x1b')](_0x4a5a78[_0xa190('0x17')]['include'],function(_0x3179de){return{'model':db[_0x3179de[_0xa190('0x1c')]],'as':_0x3179de['as'],'attributes':_0x3179de[_0xa190('0x1d')],'include':_0x3179de[_0xa190('0x1a')]?_[_0xa190('0x1b')](_0x3179de['include'],function(_0x18967e){return{'model':db[_0x18967e[_0xa190('0x1c')]],'as':_0x18967e['as'],'attributes':_0x18967e[_0xa190('0x1d')],'include':_0x18967e[_0xa190('0x1a')]?_['map'](_0x18967e['include'],function(_0x8f0dad){return{'model':db[_0x8f0dad[_0xa190('0x1c')]],'as':_0x8f0dad['as'],'attributes':_0x8f0dad[_0xa190('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa190('0xb')](function(_0x1106b0){logger[_0xa190('0xc')](_0xa190('0x1f'),_0x4a5a78);logger[_0xa190('0xe')](_0xa190('0x1f'),_0x4a5a78,JSON[_0xa190('0x10')](_0x1106b0));_0x11a621(_0x1106b0);})[_0xa190('0x1e')](function(_0x32c71b){logger[_0xa190('0x11')](_0xa190('0x1f'),_0x32c71b[_0xa190('0x14')],_0x4a5a78);_0x29ac31(_0x55c2c0[_0xa190('0x11')](0x1f4,_0x32c71b['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a54976c..50b021d 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 _0xdd7a=['update','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','show','/:id/clone','clone','post','create','/:id'];(function(_0x3892f7,_0x4a50b0){var _0x545018=function(_0x5bce2d){while(--_0x5bce2d){_0x3892f7['push'](_0x3892f7['shift']());}};_0x545018(++_0x4a50b0);}(_0xdd7a,0xa5));var _0xadd7=function(_0x4eaa34,_0x494dd7){_0x4eaa34=_0x4eaa34-0x0;var _0x18c4b6=_0xdd7a[_0x4eaa34];return _0x18c4b6;};'use strict';var multer=require(_0xadd7('0x0'));var util=require(_0xadd7('0x1'));var path=require(_0xadd7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadd7('0x3')]();var fs_extra=require(_0xadd7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadd7('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xadd7('0x6')]('/',auth[_0xadd7('0x7')](),controller[_0xadd7('0x8')]);router[_0xadd7('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xadd7('0x9')]);router['post'](_0xadd7('0xa'),auth['isAuthenticated'](),controller[_0xadd7('0xb')]);router[_0xadd7('0xc')]('/',auth['isAuthenticated'](),controller[_0xadd7('0xd')]);router['put'](_0xadd7('0xe'),auth['isAuthenticated'](),controller[_0xadd7('0xf')]);router[_0xadd7('0x10')](_0xadd7('0xe'),auth[_0xadd7('0x7')](),controller['destroy']);module[_0xadd7('0x11')]=router; \ No newline at end of file +var _0xc5a9=['get','isAuthenticated','index','show','post','/:id/clone','create','/:id','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xc5a9,0x1bb));var _0x9c5a=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0xc5a9[_0x459423];return _0x42ed14;};'use strict';var multer=require('multer');var util=require(_0x9c5a('0x0'));var path=require('path');var timeout=require(_0x9c5a('0x1'));var express=require('express');var router=express[_0x9c5a('0x2')]();var fs_extra=require(_0x9c5a('0x3'));var auth=require(_0x9c5a('0x4'));var interaction=require(_0x9c5a('0x5'));var config=require('../../config/environment');var controller=require(_0x9c5a('0x6'));router[_0x9c5a('0x7')]('/',auth[_0x9c5a('0x8')](),controller[_0x9c5a('0x9')]);router['get']('/:id',auth[_0x9c5a('0x8')](),controller[_0x9c5a('0xa')]);router[_0x9c5a('0xb')](_0x9c5a('0xc'),auth[_0x9c5a('0x8')](),controller['clone']);router['post']('/',auth[_0x9c5a('0x8')](),controller[_0x9c5a('0xd')]);router['put'](_0x9c5a('0xe'),auth[_0x9c5a('0x8')](),controller['update']);router[_0x9c5a('0xf')](_0x9c5a('0xe'),auth[_0x9c5a('0x8')](),controller[_0x9c5a('0x10')]);module[_0x9c5a('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ed44649..b52221d 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 _0x0880=['ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','rfc2833','yes','update','outgoing','force_rport,comedia','nat','join','all'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0880,0x147));var _0x0088=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x0880[_0x540133];return _0x26b6e9;};'use strict';var Sequelize=require(_0x0088('0x0'));module[_0x0088('0x1')]={'name':{'type':Sequelize[_0x0088('0x2')],'allowNull':![],'unique':_0x0088('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0088('0x4')]('friend',_0x0088('0x5'),_0x0088('0x6')),'allowNull':![],'defaultValue':_0x0088('0x7')},'context':{'type':Sequelize[_0x0088('0x2')],'allowNull':![],'defaultValue':_0x0088('0x8')},'callingpres':{'type':Sequelize[_0x0088('0x4')]('ALLOWED_NOT_SCREENED',_0x0088('0x9'),'ALLOWED_FAILED_SCREEN',_0x0088('0xa'),_0x0088('0xb'),_0x0088('0xc'),_0x0088('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x0088('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x0088('0x2')]},'md5secret':{'type':Sequelize[_0x0088('0x2')]},'remotesecret':{'type':Sequelize[_0x0088('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x0088('0xe'),'set':function(_0x15670c){this[_0x0088('0xf')](_0x0088('0x10'),_0x15670c?_0x15670c['join'](','):null);},'get':function(){return this[_0x0088('0x11')]('transport')?this['getDataValue'](_0x0088('0x10'))[_0x0088('0x12')](','):null;},'comment':_0x0088('0x13')},'dtmfmode':{'type':Sequelize[_0x0088('0x4')]('rfc2833',_0x0088('0x14'),'shortinfo',_0x0088('0x15'),'auto'),'defaultValue':_0x0088('0x16')},'directmedia':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no','nonat',_0x0088('0x18'),_0x0088('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0088('0x2')]},'nat':{'type':Sequelize[_0x0088('0x2')],'defaultValue':_0x0088('0x1a'),'set':function(_0x27f503){this[_0x0088('0xf')](_0x0088('0x1b'),_0x27f503?_0x27f503[_0x0088('0x1c')](','):null);},'get':function(){return this['getDataValue'](_0x0088('0x1b'))?this[_0x0088('0x11')](_0x0088('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0088('0x2')]},'pickupgroup':{'type':Sequelize[_0x0088('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0088('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0088('0x2')],'defaultValue':_0x0088('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0088('0x1e'),'set':function(_0xcd75f5){this[_0x0088('0xf')](_0x0088('0x1f'),_0xcd75f5?_0xcd75f5[_0x0088('0x1c')](';'):_0x0088('0x1e'));},'get':function(){return this['getDataValue'](_0x0088('0x1f'))?this[_0x0088('0x11')](_0x0088('0x1f'))[_0x0088('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'insecure':{'type':Sequelize[_0x0088('0x2')],'defaultValue':_0x0088('0x20'),'set':function(_0x30339f){this[_0x0088('0xf')](_0x0088('0x21'),_0x30339f?_0x30339f[_0x0088('0x1c')](','):null);},'get':function(){return this[_0x0088('0x11')](_0x0088('0x21'))?this[_0x0088('0x11')]('insecure')[_0x0088('0x12')](','):null;},'comment':_0x0088('0x22')},'trustrpid':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no')},'accountcode':{'type':Sequelize[_0x0088('0x23')](0xb)},'setvar':{'type':Sequelize[_0x0088('0x2')]},'callerid':{'type':Sequelize[_0x0088('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x0088('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0088('0x2')]},'videosupport':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0088('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x0088('0x24'),_0x0088('0x25'),_0x0088('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x0088('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x27'),_0x0088('0x28')),'defaultValue':_0x0088('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x0088('0x2')]},'regexten':{'type':Sequelize[_0x0088('0x2')]},'fromdomain':{'type':Sequelize[_0x0088('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0088('0x23')](0x5)},'qualify':{'type':Sequelize[_0x0088('0x4')]('yes','no'),'defaultValue':_0x0088('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x0088('0x2')]},'defaultuser':{'type':Sequelize[_0x0088('0x2')]},'rtptimeout':{'type':Sequelize[_0x0088('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0088('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0088('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x0088('0x17'),'no',_0x0088('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0088('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x0088('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x0088('0x2')]},'contactdeny':{'type':Sequelize[_0x0088('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0088('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0088('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'icesupport':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no',_0x0088('0x2a'),_0x0088('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x0088('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x0088('0x2')]},'dtlscafile':{'type':Sequelize[_0x0088('0x2')]},'dtlscapath':{'type':Sequelize[_0x0088('0x2')]},'dtlssetup':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x2c'),_0x0088('0x2d'),_0x0088('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x0088('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0088('0x2')]},'recordofffeature':{'type':Sequelize[_0x0088('0x2')]},'call_limit':{'type':Sequelize[_0x0088('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x0088('0x4')](_0x0088('0x17'),'no')},'vmexten':{'type':Sequelize[_0x0088('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x0088('0x2')]},'parkinglot':{'type':Sequelize[_0x0088('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0088('0x2')],'defaultValue':_0x0088('0x2f')},'canreinvite':{'type':Sequelize[_0x0088('0x4')]('yes','no',_0x0088('0x30'),_0x0088('0x18'),_0x0088('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0088('0x2')]},'otherFields':{'type':Sequelize[_0x0088('0x2')]},'active':{'type':Sequelize[_0x0088('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0088('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb604=['STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','sequelize','exports','name','user','friend'];(function(_0x78bfeb,_0x49b60a){var _0xfedbf=function(_0x3becb7){while(--_0x3becb7){_0x78bfeb['push'](_0x78bfeb['shift']());}};_0xfedbf(++_0x49b60a);}(_0xb604,0xc3));var _0x4b60=function(_0x217657,_0x2246e9){_0x217657=_0x217657-0x0;var _0x115c80=_0xb604[_0x217657];return _0x115c80;};'use strict';var Sequelize=require(_0x4b60('0x0'));module[_0x4b60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x4b60('0x3'),'peer'),'allowNull':![],'defaultValue':_0x4b60('0x4')},'context':{'type':Sequelize[_0x4b60('0x5')],'allowNull':![],'defaultValue':_0x4b60('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x4b60('0x7'),_0x4b60('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x4b60('0x9'),_0x4b60('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x4b60('0x5')]},'secret':{'type':Sequelize[_0x4b60('0x5')]},'md5secret':{'type':Sequelize[_0x4b60('0x5')]},'remotesecret':{'type':Sequelize[_0x4b60('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x4b60('0xb'),'set':function(_0xfbfe1d){this['setDataValue'](_0x4b60('0xc'),_0xfbfe1d?_0xfbfe1d[_0x4b60('0xd')](','):null);},'get':function(){return this[_0x4b60('0xe')](_0x4b60('0xc'))?this[_0x4b60('0xe')]('transport')[_0x4b60('0xf')](','):null;},'comment':_0x4b60('0x10')},'dtmfmode':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x12'),_0x4b60('0x13'),_0x4b60('0x14'),_0x4b60('0x15'),_0x4b60('0x16')),'defaultValue':_0x4b60('0x12')},'directmedia':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no',_0x4b60('0x18'),_0x4b60('0x19'),_0x4b60('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4b60('0x5')]},'directmediadeny':{'type':Sequelize[_0x4b60('0x5')]},'nat':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':_0x4b60('0x1b'),'set':function(_0xd63bb1){this['setDataValue'](_0x4b60('0x1c'),_0xd63bb1?_0xd63bb1['join'](','):null);},'get':function(){return this[_0x4b60('0xe')](_0x4b60('0x1c'))?this[_0x4b60('0xe')](_0x4b60('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4b60('0x5')]},'namedcallgroup':{'type':Sequelize[_0x4b60('0x5')]},'pickupgroup':{'type':Sequelize[_0x4b60('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4b60('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':_0x4b60('0x1d')},'allow':{'type':Sequelize[_0x4b60('0x5')],'allowNull':![],'defaultValue':_0x4b60('0x1e'),'set':function(_0x501e82){this[_0x4b60('0x1f')](_0x4b60('0x20'),_0x501e82?_0x501e82[_0x4b60('0xd')](';'):_0x4b60('0x1e'));},'get':function(){return this['getDataValue'](_0x4b60('0x20'))?this[_0x4b60('0xe')]('allow')[_0x4b60('0xf')](';'):null;},'comment':_0x4b60('0x21')},'autoframing':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'insecure':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':'port,invite','set':function(_0x2a6831){this[_0x4b60('0x1f')](_0x4b60('0x22'),_0x2a6831?_0x2a6831[_0x4b60('0xd')](','):null);},'get':function(){return this['getDataValue'](_0x4b60('0x22'))?this[_0x4b60('0xe')](_0x4b60('0x22'))['split'](','):null;},'comment':_0x4b60('0x23')},'trustrpid':{'type':Sequelize[_0x4b60('0x11')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4b60('0x11')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4b60('0x24')](0xb)},'setvar':{'type':Sequelize[_0x4b60('0x5')]},'callerid':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':_0x4b60('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no'),'defaultValue':_0x4b60('0x17')},'busylevel':{'type':Sequelize[_0x4b60('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x4b60('0x5')]},'videosupport':{'type':Sequelize[_0x4b60('0x11')]('yes','no',_0x4b60('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no')},'mailbox':{'type':Sequelize[_0x4b60('0x5')]},'session_timers':{'type':Sequelize['ENUM'](_0x4b60('0x27'),'refuse',_0x4b60('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x4b60('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x29'),_0x4b60('0x2a')),'defaultValue':_0x4b60('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x4b60('0x5')]},'regexten':{'type':Sequelize[_0x4b60('0x5')]},'fromdomain':{'type':Sequelize[_0x4b60('0x5')]},'fromuser':{'type':Sequelize[_0x4b60('0x5')]},'port':{'type':Sequelize[_0x4b60('0x24')](0x5)},'qualify':{'type':Sequelize[_0x4b60('0x11')]('yes','no'),'defaultValue':_0x4b60('0x17')},'keepalive':{'type':Sequelize[_0x4b60('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x4b60('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4b60('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4b60('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no',_0x4b60('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4b60('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x4b60('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4b60('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x4b60('0x5')]},'contactdeny':{'type':Sequelize[_0x4b60('0x5')]},'contactacl':{'type':Sequelize[_0x4b60('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x4b60('0x5')]},'maxforwards':{'type':Sequelize[_0x4b60('0x24')](0xb)},'encryption':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x4b60('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no',_0x4b60('0x2c'),_0x4b60('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x4b60('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x4b60('0x5')]},'dtlscipher':{'type':Sequelize[_0x4b60('0x5')]},'dtlscafile':{'type':Sequelize[_0x4b60('0x5')]},'dtlscapath':{'type':Sequelize[_0x4b60('0x5')]},'dtlssetup':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x2e'),_0x4b60('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4b60('0x5')]},'usereqphone':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4b60('0x5')]},'recordofffeature':{'type':Sequelize[_0x4b60('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4b60('0x5')]},'mohinterpret':{'type':Sequelize[_0x4b60('0x5')]},'mohsuggest':{'type':Sequelize[_0x4b60('0x5')]},'parkinglot':{'type':Sequelize[_0x4b60('0x5')]},'description':{'type':Sequelize[_0x4b60('0x5')]},'host':{'type':Sequelize[_0x4b60('0x5')],'defaultValue':_0x4b60('0x30')},'canreinvite':{'type':Sequelize[_0x4b60('0x11')](_0x4b60('0x17'),'no',_0x4b60('0x18'),_0x4b60('0x19'),_0x4b60('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4b60('0x5')]},'otherFields':{'type':Sequelize[_0x4b60('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4b60('0x5')],'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 94254a7..1e21893 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 _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x590114,_0x2ca735){var _0x149e50=function(_0x3275fc){while(--_0x3275fc){_0x590114['push'](_0x590114['shift']());}};_0x149e50(++_0x2ca735);}(_0x008c,0x188));var _0xc008=function(_0x3948ec,_0x3dfb10){_0x3948ec=_0x3948ec-0x0;var _0x2ad8f4=_0x008c[_0x3948ec];return _0x2ad8f4;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file +var _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','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','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x612ce5,_0x3f9440){var _0x1558e8=function(_0x2cfe1a){while(--_0x2cfe1a){_0x612ce5['push'](_0x612ce5['shift']());}};_0x1558e8(++_0x3f9440);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fcd8cfa..4196094 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 _0x6a8f=['../../config/logger','moment','request-promise','../../config/environment','exports','define','Trunk','tools_trunks','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a8f,0x8f));var _0xf6a8=function(_0x5a0681,_0x5cbc10){_0x5a0681=_0x5a0681-0x0;var _0x2d3a74=_0x6a8f[_0x5a0681];return _0x2d3a74;};'use strict';var _=require('lodash');var util=require(_0xf6a8('0x0'));var logger=require(_0xf6a8('0x1'))('api');var moment=require(_0xf6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xf6a8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6a8('0x4'));var attributes=require('./trunk.attributes');module[_0xf6a8('0x5')]=function(_0x22cc2d,_0x263701){return _0x22cc2d[_0xf6a8('0x6')](_0xf6a8('0x7'),attributes,{'tableName':_0xf6a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3989=['request-promise','path','rimraf','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment'];(function(_0x4beb08,_0x38a1e4){var _0x56a591=function(_0x26d077){while(--_0x26d077){_0x4beb08['push'](_0x4beb08['shift']());}};_0x56a591(++_0x38a1e4);}(_0x3989,0x128));var _0x9398=function(_0x3a1fb4,_0x51f164){_0x3a1fb4=_0x3a1fb4-0x0;var _0xcc9cf4=_0x3989[_0x3a1fb4];return _0xcc9cf4;};'use strict';var _=require(_0x9398('0x0'));var util=require(_0x9398('0x1'));var logger=require(_0x9398('0x2'))('api');var moment=require(_0x9398('0x3'));var BPromise=require('bluebird');var rp=require(_0x9398('0x4'));var fs=require('fs');var path=require(_0x9398('0x5'));var rimraf=require(_0x9398('0x6'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module['exports']=function(_0x5bc05d,_0x2f14bf){return _0x5bc05d[_0x9398('0x7')](_0x9398('0x8'),attributes,{'tableName':_0x9398('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index cb95400..845ba7e 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 _0xccb5=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrunk','findAll','options','attributes','limit','include','map','model','Trunk','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xccb5,0x16c));var _0x5ccb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccb5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ccb('0x0'));var util=require(_0x5ccb('0x1'));var moment=require(_0x5ccb('0x2'));var BPromise=require(_0x5ccb('0x3'));var rs=require(_0x5ccb('0x4'));var fs=require('fs');var Redis=require(_0x5ccb('0x5'));var db=require(_0x5ccb('0x6'))['db'];var utils=require(_0x5ccb('0x7'));var logger=require(_0x5ccb('0x8'))(_0x5ccb('0x9'));var config=require(_0x5ccb('0xa'));var jayson=require(_0x5ccb('0xb'));var client=jayson[_0x5ccb('0xc')][_0x5ccb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3eb078,_0x48a199,_0x5e6d75){return new BPromise(function(_0x526d67,_0x246e93){return client[_0x5ccb('0xe')](_0x3eb078,_0x5e6d75)[_0x5ccb('0xf')](function(_0x1ae311){logger[_0x5ccb('0x10')](_0x5ccb('0x11'),_0x48a199,_0x5ccb('0x12'));logger[_0x5ccb('0x13')](_0x5ccb('0x14'),_0x48a199,_0x5ccb('0x12'),JSON[_0x5ccb('0x15')](_0x1ae311));if(_0x1ae311[_0x5ccb('0x16')]){if(_0x1ae311['error']['code']===0x1f4){logger[_0x5ccb('0x16')](_0x5ccb('0x11'),_0x48a199,_0x1ae311[_0x5ccb('0x16')][_0x5ccb('0x17')]);return _0x246e93(_0x1ae311['error']['message']);}logger[_0x5ccb('0x16')](_0x5ccb('0x11'),_0x48a199,_0x1ae311['error'][_0x5ccb('0x17')]);return _0x526d67(_0x1ae311[_0x5ccb('0x16')][_0x5ccb('0x17')]);}else{logger[_0x5ccb('0x10')](_0x5ccb('0x11'),_0x48a199,'request\x20sent');_0x526d67(_0x1ae311[_0x5ccb('0x18')][_0x5ccb('0x17')]);}})[_0x5ccb('0x19')](function(_0xe8b2fc){logger[_0x5ccb('0x16')](_0x5ccb('0x11'),_0x48a199,_0xe8b2fc);_0x246e93(_0xe8b2fc);});});}exports[_0x5ccb('0x1a')]=function(_0x174a10){var _0x54889f=this;return new Promise(function(_0x21077e,_0x5659b0){return db['Trunk'][_0x5ccb('0x1b')]({'raw':_0x174a10[_0x5ccb('0x1c')]?_0x174a10[_0x5ccb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x174a10[_0x5ccb('0x1c')]?_0x174a10[_0x5ccb('0x1c')]['where']||null:null,'attributes':_0x174a10[_0x5ccb('0x1c')]?_0x174a10[_0x5ccb('0x1c')][_0x5ccb('0x1d')]||null:null,'limit':_0x174a10[_0x5ccb('0x1c')]?_0x174a10['options'][_0x5ccb('0x1e')]||null:null,'include':_0x174a10[_0x5ccb('0x1c')]?_0x174a10[_0x5ccb('0x1c')][_0x5ccb('0x1f')]?_[_0x5ccb('0x20')](_0x174a10['options'][_0x5ccb('0x1f')],function(_0x1f4bc5){return{'model':db[_0x1f4bc5[_0x5ccb('0x21')]],'as':_0x1f4bc5['as'],'attributes':_0x1f4bc5[_0x5ccb('0x1d')],'include':_0x1f4bc5['include']?_[_0x5ccb('0x20')](_0x1f4bc5[_0x5ccb('0x1f')],function(_0x3025d3){return{'model':db[_0x3025d3[_0x5ccb('0x21')]],'as':_0x3025d3['as'],'attributes':_0x3025d3[_0x5ccb('0x1d')],'include':_0x3025d3[_0x5ccb('0x1f')]?_[_0x5ccb('0x20')](_0x3025d3[_0x5ccb('0x1f')],function(_0x40b58c){return{'model':db[_0x40b58c[_0x5ccb('0x21')]],'as':_0x40b58c['as'],'attributes':_0x40b58c[_0x5ccb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2ba6b){logger[_0x5ccb('0x10')](_0x5ccb('0x1a'),_0x174a10);logger[_0x5ccb('0x13')](_0x5ccb('0x1a'),_0x174a10,JSON['stringify'](_0xe2ba6b));_0x21077e(_0xe2ba6b);})[_0x5ccb('0x19')](function(_0x550743){logger[_0x5ccb('0x16')](_0x5ccb('0x1a'),_0x550743[_0x5ccb('0x17')],_0x174a10);_0x5659b0(_0x54889f[_0x5ccb('0x16')](0x1f4,_0x550743['message']));});});};exports['ShowTrunk']=function(_0x421e9a){var _0x4a202b=this;return new Promise(function(_0x231be3,_0x58c8a4){return db[_0x5ccb('0x22')][_0x5ccb('0x23')]({'raw':_0x421e9a[_0x5ccb('0x1c')]?_0x421e9a[_0x5ccb('0x1c')][_0x5ccb('0x24')]===undefined?!![]:![]:!![],'where':_0x421e9a[_0x5ccb('0x1c')]?_0x421e9a[_0x5ccb('0x1c')]['where']||null:null,'attributes':_0x421e9a['options']?_0x421e9a[_0x5ccb('0x1c')][_0x5ccb('0x1d')]||null:null,'include':_0x421e9a['options']?_0x421e9a[_0x5ccb('0x1c')]['include']?_[_0x5ccb('0x20')](_0x421e9a[_0x5ccb('0x1c')]['include'],function(_0x5e27f9){return{'model':db[_0x5e27f9[_0x5ccb('0x21')]],'as':_0x5e27f9['as'],'attributes':_0x5e27f9[_0x5ccb('0x1d')],'include':_0x5e27f9[_0x5ccb('0x1f')]?_['map'](_0x5e27f9[_0x5ccb('0x1f')],function(_0x465240){return{'model':db[_0x465240[_0x5ccb('0x21')]],'as':_0x465240['as'],'attributes':_0x465240[_0x5ccb('0x1d')],'include':_0x465240['include']?_[_0x5ccb('0x20')](_0x465240[_0x5ccb('0x1f')],function(_0x44b85f){return{'model':db[_0x44b85f[_0x5ccb('0x21')]],'as':_0x44b85f['as'],'attributes':_0x44b85f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ccb('0xf')](function(_0x505162){logger[_0x5ccb('0x10')](_0x5ccb('0x25'),_0x421e9a);logger[_0x5ccb('0x13')](_0x5ccb('0x25'),_0x421e9a,JSON[_0x5ccb('0x15')](_0x505162));_0x231be3(_0x505162);})['catch'](function(_0x415412){logger[_0x5ccb('0x16')](_0x5ccb('0x25'),_0x415412[_0x5ccb('0x17')],_0x421e9a);_0x58c8a4(_0x4a202b['error'](0x1f4,_0x415412['message']));});});}; \ No newline at end of file +var _0x01f9=['where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','attributes','include','map','model','debug','ShowTrunk','find','raw'];(function(_0x50408a,_0x53aea4){var _0x1b4cf0=function(_0x13ec43){while(--_0x13ec43){_0x50408a['push'](_0x50408a['shift']());}};_0x1b4cf0(++_0x53aea4);}(_0x01f9,0x18d));var _0x901f=function(_0x3b4d7a,_0x16a846){_0x3b4d7a=_0x3b4d7a-0x0;var _0x23ad89=_0x01f9[_0x3b4d7a];return _0x23ad89;};'use strict';var _=require(_0x901f('0x0'));var util=require(_0x901f('0x1'));var moment=require('moment');var BPromise=require(_0x901f('0x2'));var rs=require(_0x901f('0x3'));var fs=require('fs');var Redis=require(_0x901f('0x4'));var db=require(_0x901f('0x5'))['db'];var utils=require(_0x901f('0x6'));var logger=require(_0x901f('0x7'))(_0x901f('0x8'));var config=require('../../config/environment');var jayson=require(_0x901f('0x9'));var client=jayson[_0x901f('0xa')][_0x901f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18eae5,_0x23b69c,_0xdf5431){return new BPromise(function(_0x4742ce,_0x16bf7a){return client[_0x901f('0xc')](_0x18eae5,_0xdf5431)[_0x901f('0xd')](function(_0x42d0b2){logger[_0x901f('0xe')](_0x901f('0xf'),_0x23b69c,_0x901f('0x10'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x23b69c,_0x901f('0x10'),JSON[_0x901f('0x11')](_0x42d0b2));if(_0x42d0b2[_0x901f('0x12')]){if(_0x42d0b2[_0x901f('0x12')][_0x901f('0x13')]===0x1f4){logger['error'](_0x901f('0xf'),_0x23b69c,_0x42d0b2[_0x901f('0x12')][_0x901f('0x14')]);return _0x16bf7a(_0x42d0b2[_0x901f('0x12')][_0x901f('0x14')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x23b69c,_0x42d0b2[_0x901f('0x12')][_0x901f('0x14')]);return _0x4742ce(_0x42d0b2[_0x901f('0x12')][_0x901f('0x14')]);}else{logger[_0x901f('0xe')](_0x901f('0xf'),_0x23b69c,_0x901f('0x10'));_0x4742ce(_0x42d0b2[_0x901f('0x15')][_0x901f('0x14')]);}})[_0x901f('0x16')](function(_0x448591){logger[_0x901f('0x12')](_0x901f('0xf'),_0x23b69c,_0x448591);_0x16bf7a(_0x448591);});});}exports[_0x901f('0x17')]=function(_0x3f936f){var _0x47df34=this;return new Promise(function(_0x289678,_0x24fcbd){return db[_0x901f('0x18')][_0x901f('0x19')]({'raw':_0x3f936f[_0x901f('0x1a')]?_0x3f936f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f936f[_0x901f('0x1a')]?_0x3f936f['options']['where']||null:null,'attributes':_0x3f936f[_0x901f('0x1a')]?_0x3f936f[_0x901f('0x1a')][_0x901f('0x1b')]||null:null,'limit':_0x3f936f['options']?_0x3f936f[_0x901f('0x1a')]['limit']||null:null,'include':_0x3f936f[_0x901f('0x1a')]?_0x3f936f[_0x901f('0x1a')][_0x901f('0x1c')]?_[_0x901f('0x1d')](_0x3f936f['options'][_0x901f('0x1c')],function(_0x4c3499){return{'model':db[_0x4c3499['model']],'as':_0x4c3499['as'],'attributes':_0x4c3499[_0x901f('0x1b')],'include':_0x4c3499['include']?_[_0x901f('0x1d')](_0x4c3499[_0x901f('0x1c')],function(_0x306637){return{'model':db[_0x306637[_0x901f('0x1e')]],'as':_0x306637['as'],'attributes':_0x306637[_0x901f('0x1b')],'include':_0x306637[_0x901f('0x1c')]?_['map'](_0x306637[_0x901f('0x1c')],function(_0x55fa13){return{'model':db[_0x55fa13[_0x901f('0x1e')]],'as':_0x55fa13['as'],'attributes':_0x55fa13['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11b4cb){logger[_0x901f('0xe')](_0x901f('0x17'),_0x3f936f);logger[_0x901f('0x1f')](_0x901f('0x17'),_0x3f936f,JSON['stringify'](_0x11b4cb));_0x289678(_0x11b4cb);})[_0x901f('0x16')](function(_0x367b93){logger['error']('GetTrunk',_0x367b93[_0x901f('0x14')],_0x3f936f);_0x24fcbd(_0x47df34[_0x901f('0x12')](0x1f4,_0x367b93[_0x901f('0x14')]));});});};exports[_0x901f('0x20')]=function(_0xaa5e44){var _0x201e71=this;return new Promise(function(_0x474c07,_0x45d304){return db[_0x901f('0x18')][_0x901f('0x21')]({'raw':_0xaa5e44[_0x901f('0x1a')]?_0xaa5e44[_0x901f('0x1a')][_0x901f('0x22')]===undefined?!![]:![]:!![],'where':_0xaa5e44[_0x901f('0x1a')]?_0xaa5e44[_0x901f('0x1a')][_0x901f('0x23')]||null:null,'attributes':_0xaa5e44[_0x901f('0x1a')]?_0xaa5e44['options'][_0x901f('0x1b')]||null:null,'include':_0xaa5e44[_0x901f('0x1a')]?_0xaa5e44[_0x901f('0x1a')][_0x901f('0x1c')]?_[_0x901f('0x1d')](_0xaa5e44[_0x901f('0x1a')]['include'],function(_0x8e1b1){return{'model':db[_0x8e1b1[_0x901f('0x1e')]],'as':_0x8e1b1['as'],'attributes':_0x8e1b1['attributes'],'include':_0x8e1b1['include']?_[_0x901f('0x1d')](_0x8e1b1['include'],function(_0x2bd4af){return{'model':db[_0x2bd4af['model']],'as':_0x2bd4af['as'],'attributes':_0x2bd4af['attributes'],'include':_0x2bd4af[_0x901f('0x1c')]?_[_0x901f('0x1d')](_0x2bd4af[_0x901f('0x1c')],function(_0x407e8c){return{'model':db[_0x407e8c[_0x901f('0x1e')]],'as':_0x407e8c['as'],'attributes':_0x407e8c['attributes']};}):[]};}):[]};}):[]:[]})[_0x901f('0xd')](function(_0x56a38d){logger[_0x901f('0xe')](_0x901f('0x20'),_0xaa5e44);logger[_0x901f('0x1f')](_0x901f('0x20'),_0xaa5e44,JSON['stringify'](_0x56a38d));_0x474c07(_0x56a38d);})[_0x901f('0x16')](function(_0x416f10){logger['error'](_0x901f('0x20'),_0x416f10['message'],_0xaa5e44);_0x45d304(_0x201e71[_0x901f('0x12')](0x1f4,_0x416f10[_0x901f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 72af6c3..496b6e9 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 _0x5f03=['/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','getApiKey','addContacts','post','create','/create_many','diskStorage','root','format','%s-%s','single','file','addAvatar','/:id/login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','changePassword','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/square_projects','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x374b7f,_0x419e36){var _0x20f2a4=function(_0x5bc66f){while(--_0x5bc66f){_0x374b7f['push'](_0x374b7f['shift']());}};_0x20f2a4(++_0x419e36);}(_0x5f03,0x14a));var _0x35f0=function(_0x371fe7,_0x30e232){_0x371fe7=_0x371fe7-0x0;var _0x286e53=_0x5f03[_0x371fe7];return _0x286e53;};'use strict';var multer=require(_0x35f0('0x0'));var util=require(_0x35f0('0x1'));var path=require('path');var timeout=require(_0x35f0('0x2'));var express=require(_0x35f0('0x3'));var router=express[_0x35f0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x35f0('0x5'));var interaction=require(_0x35f0('0x6'));var config=require(_0x35f0('0x7'));var controller=require('./user.controller');router[_0x35f0('0x8')]('/',auth['isAuthenticated'](),controller[_0x35f0('0x9')]);router['get'](_0x35f0('0xa'),auth[_0x35f0('0xb')](),controller[_0x35f0('0xc')]);router[_0x35f0('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x35f0('0xd')]);router[_0x35f0('0x8')](_0x35f0('0xe'),auth[_0x35f0('0xb')](),controller[_0x35f0('0xf')]);router[_0x35f0('0x8')]('/:id',auth[_0x35f0('0xb')](),controller[_0x35f0('0x10')]);router['get'](_0x35f0('0x11'),controller[_0x35f0('0x12')]);router[_0x35f0('0x8')](_0x35f0('0x13'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x14')]);router[_0x35f0('0x8')](_0x35f0('0x15'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x16')]);router[_0x35f0('0x8')](_0x35f0('0x17'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x18')]);router[_0x35f0('0x8')]('/:id/queues_rt',auth[_0x35f0('0xb')](),controller[_0x35f0('0x19')]);router[_0x35f0('0x8')](_0x35f0('0x1a'),auth['isAuthenticated'](),controller[_0x35f0('0x1b')]);router[_0x35f0('0x8')]('/:id/recordings',auth[_0x35f0('0xb')](),controller['getRecordings']);router[_0x35f0('0x8')](_0x35f0('0x1c'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x1d')]);router[_0x35f0('0x8')]('/:id/chat/interactions',auth[_0x35f0('0xb')](),controller[_0x35f0('0x1e')]);router[_0x35f0('0x8')](_0x35f0('0x1f'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x20')]);router[_0x35f0('0x8')](_0x35f0('0x21'),auth['isAuthenticated'](),controller[_0x35f0('0x22')]);router[_0x35f0('0x8')](_0x35f0('0x23'),auth['isAuthenticated'](),controller[_0x35f0('0x24')]);router[_0x35f0('0x8')](_0x35f0('0x25'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x26')]);router['get'](_0x35f0('0x27'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x28')]);router[_0x35f0('0x8')](_0x35f0('0x29'),auth['isAuthenticated'](),controller[_0x35f0('0x2a')]);router[_0x35f0('0x8')](_0x35f0('0x2b'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x2c')]);router[_0x35f0('0x8')]('/:id/agents',auth[_0x35f0('0xb')](),controller[_0x35f0('0x2d')]);router[_0x35f0('0x8')](_0x35f0('0x2e'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x2f')]);router['get']('/:id/fax_accounts',auth[_0x35f0('0xb')](),controller[_0x35f0('0x30')]);router[_0x35f0('0x8')](_0x35f0('0x31'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x32')]);router[_0x35f0('0x8')]('/:id/openchannel_accounts',auth[_0x35f0('0xb')](),controller['getOpenchannelAccounts']);router[_0x35f0('0x8')](_0x35f0('0x33'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x35f0('0x8')](_0x35f0('0x34'),auth['isAuthenticated'](),controller[_0x35f0('0x35')]);router[_0x35f0('0x8')](_0x35f0('0x36'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x37')]);router[_0x35f0('0x8')]('/:id/square_projects',auth[_0x35f0('0xb')](),controller['getSquareProjects']);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x35f0('0x38')]);router[_0x35f0('0x8')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x35f0('0x39')]);router['post'](_0x35f0('0x15'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x3a')]);router[_0x35f0('0x3b')]('/',auth['isAuthenticated'](),controller[_0x35f0('0x3c')]);router[_0x35f0('0x3b')](_0x35f0('0x3d'),auth[_0x35f0('0xb')](),controller['bulkCreate']);router[_0x35f0('0x3b')](_0x35f0('0x17'),auth[_0x35f0('0xb')](),controller['addQueues']);var upload=multer({'storage':multer[_0x35f0('0x3e')]({'destination':function(_0x1557eb,_0x3ec729,_0x3b6d5b){_0x3b6d5b(null,path['join'](config[_0x35f0('0x3f')],'server/files/images/'));},'filename':function(_0x3b69cb,_0x381c4b,_0x2c45e9){_0x2c45e9(null,util[_0x35f0('0x40')](_0x35f0('0x41'),Date['now'](),_0x381c4b['originalname']));}})});router['post']('/:id/avatar',upload[_0x35f0('0x42')](_0x35f0('0x43')),controller[_0x35f0('0x44')]);router[_0x35f0('0x3b')](_0x35f0('0x45'),auth['isAuthenticated'](),controller['login']);router['post'](_0x35f0('0x46'),auth[_0x35f0('0xb')](),controller['logout']);router[_0x35f0('0x3b')](_0x35f0('0x47'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x48')]);router[_0x35f0('0x3b')](_0x35f0('0x49'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x4a')]);router[_0x35f0('0x3b')](_0x35f0('0x29'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x4b')]);router['post'](_0x35f0('0x4c'),auth['isAuthenticated'](),controller[_0x35f0('0x4d')]);router[_0x35f0('0x3b')](_0x35f0('0x4e'),auth['isAuthenticated'](),controller[_0x35f0('0x4f')]);router['post'](_0x35f0('0x50'),auth['isAuthenticated'](),controller[_0x35f0('0x51')]);router[_0x35f0('0x3b')](_0x35f0('0x52'),auth['isAuthenticated'](),controller[_0x35f0('0x53')]);router[_0x35f0('0x3b')](_0x35f0('0x54'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x55')]);router['post'](_0x35f0('0x56'),auth['isAuthenticated'](),controller[_0x35f0('0x57')]);router[_0x35f0('0x3b')](_0x35f0('0x58'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x59')]);router[_0x35f0('0x3b')]('/:id/mail_accounts',auth[_0x35f0('0xb')](),controller[_0x35f0('0x5a')]);router['post'](_0x35f0('0x5b'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x5c')]);router[_0x35f0('0x3b')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x35f0('0x5d')]);router[_0x35f0('0x3b')](_0x35f0('0x34'),auth['isAuthenticated'](),controller[_0x35f0('0x5e')]);router[_0x35f0('0x3b')](_0x35f0('0x36'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x5f')]);router[_0x35f0('0x3b')]('/:id/square_projects',auth[_0x35f0('0xb')](),controller['addSquareProjects']);router['post'](_0x35f0('0x60'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x61')]);router[_0x35f0('0x62')](_0x35f0('0x63'),auth['isAuthenticated'](),controller[_0x35f0('0x64')]);router[_0x35f0('0x62')](_0x35f0('0x65'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x66')]);router['delete'](_0x35f0('0x17'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x67')]);router['delete'](_0x35f0('0x29'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x68')]);router[_0x35f0('0x69')](_0x35f0('0x63'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x6a')]);router[_0x35f0('0x69')](_0x35f0('0x4c'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x6b')]);router[_0x35f0('0x69')](_0x35f0('0x4e'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x6c')]);router[_0x35f0('0x69')]('/:id/fax_interactions',auth[_0x35f0('0xb')](),controller[_0x35f0('0x6d')]);router[_0x35f0('0x69')](_0x35f0('0x52'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x6e')]);router[_0x35f0('0x69')](_0x35f0('0x54'),auth['isAuthenticated'](),controller[_0x35f0('0x6f')]);router['delete'](_0x35f0('0x56'),auth[_0x35f0('0xb')](),controller['removeWhatsappInteractions']);router[_0x35f0('0x69')](_0x35f0('0x58'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x70')]);router['delete'](_0x35f0('0x31'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x71')]);router[_0x35f0('0x69')]('/:id/openchannel_accounts',auth[_0x35f0('0xb')](),controller[_0x35f0('0x72')]);router[_0x35f0('0x69')](_0x35f0('0x33'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x73')]);router[_0x35f0('0x69')](_0x35f0('0x34'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x74')]);router[_0x35f0('0x69')](_0x35f0('0x36'),auth[_0x35f0('0xb')](),controller['removeWhatsappAccounts']);router[_0x35f0('0x69')](_0x35f0('0x75'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x76')]);router[_0x35f0('0x69')](_0x35f0('0x60'),auth[_0x35f0('0xb')](),controller[_0x35f0('0x77')]);module[_0x35f0('0x78')]=router; \ No newline at end of file +var _0x44bb=['addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./user.controller','isAuthenticated','/describe','describe','get','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts'];(function(_0x24ae03,_0x334660){var _0x38a29e=function(_0x25e64b){while(--_0x25e64b){_0x24ae03['push'](_0x24ae03['shift']());}};_0x38a29e(++_0x334660);}(_0x44bb,0x83));var _0xb44b=function(_0x591921,_0x5100df){_0x591921=_0x591921-0x0;var _0x568bec=_0x44bb[_0x591921];return _0x568bec;};'use strict';var multer=require(_0xb44b('0x0'));var util=require(_0xb44b('0x1'));var path=require(_0xb44b('0x2'));var timeout=require(_0xb44b('0x3'));var express=require('express');var router=express[_0xb44b('0x4')]();var fs_extra=require(_0xb44b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb44b('0x6'));var config=require('../../config/environment');var controller=require(_0xb44b('0x7'));router['get']('/',auth[_0xb44b('0x8')](),controller['index']);router['get'](_0xb44b('0x9'),auth[_0xb44b('0x8')](),controller[_0xb44b('0xa')]);router[_0xb44b('0xb')]('/whoami',auth[_0xb44b('0x8')](),controller[_0xb44b('0xc')]);router[_0xb44b('0xb')](_0xb44b('0xd'),auth[_0xb44b('0x8')](),controller[_0xb44b('0xe')]);router[_0xb44b('0xb')](_0xb44b('0xf'),auth[_0xb44b('0x8')](),controller['show']);router['get'](_0xb44b('0x10'),controller[_0xb44b('0x11')]);router[_0xb44b('0xb')]('/:id/open_tabs',auth[_0xb44b('0x8')](),controller['getOpenTabs']);router[_0xb44b('0xb')](_0xb44b('0x12'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x13')]);router[_0xb44b('0xb')]('/:id/queues',auth[_0xb44b('0x8')](),controller[_0xb44b('0x14')]);router[_0xb44b('0xb')]('/:id/queues_rt',auth[_0xb44b('0x8')](),controller[_0xb44b('0x15')]);router[_0xb44b('0xb')](_0xb44b('0x16'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x17')]);router[_0xb44b('0xb')](_0xb44b('0x18'),auth['isAuthenticated'](),controller[_0xb44b('0x19')]);router[_0xb44b('0xb')]('/:id/screen_recordings',auth[_0xb44b('0x8')](),controller[_0xb44b('0x1a')]);router[_0xb44b('0xb')](_0xb44b('0x1b'),auth['isAuthenticated'](),controller[_0xb44b('0x1c')]);router[_0xb44b('0xb')]('/:id/openchannel/interactions',auth[_0xb44b('0x8')](),controller[_0xb44b('0x1d')]);router[_0xb44b('0xb')](_0xb44b('0x1e'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x1f')]);router[_0xb44b('0xb')]('/:id/sms/interactions',auth[_0xb44b('0x8')](),controller[_0xb44b('0x20')]);router[_0xb44b('0xb')](_0xb44b('0x21'),auth['isAuthenticated'](),controller[_0xb44b('0x22')]);router[_0xb44b('0xb')](_0xb44b('0x23'),auth[_0xb44b('0x8')](),controller['getWhatsappInteractions']);router['get'](_0xb44b('0x24'),auth[_0xb44b('0x8')](),controller['getTeams']);router[_0xb44b('0xb')](_0xb44b('0x25'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x26')]);router[_0xb44b('0xb')](_0xb44b('0x27'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x28')]);router['get']('/:id/prefixes',auth[_0xb44b('0x8')](),controller['getVoicePrefixes']);router[_0xb44b('0xb')](_0xb44b('0x29'),auth[_0xb44b('0x8')](),controller['getFaxAccounts']);router[_0xb44b('0xb')]('/:id/mail_accounts',auth[_0xb44b('0x8')](),controller['getMailAccounts']);router[_0xb44b('0xb')](_0xb44b('0x2a'),auth['isAuthenticated'](),controller[_0xb44b('0x2b')]);router[_0xb44b('0xb')]('/:id/sms_accounts',auth[_0xb44b('0x8')](),controller[_0xb44b('0x2c')]);router[_0xb44b('0xb')]('/:id/chat_websites',auth[_0xb44b('0x8')](),controller['getChatWebsites']);router['get']('/:id/whatsapp_accounts',auth[_0xb44b('0x8')](),controller[_0xb44b('0x2d')]);router[_0xb44b('0xb')](_0xb44b('0x2e'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x2f')]);router['get'](_0xb44b('0x30'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x31')]);router[_0xb44b('0xb')](_0xb44b('0x32'),auth['isAuthenticated'](),controller[_0xb44b('0x33')]);router[_0xb44b('0x34')](_0xb44b('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0xb44b('0x34')]('/',auth[_0xb44b('0x8')](),controller['create']);router['post'](_0xb44b('0x35'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x36')]);router[_0xb44b('0x34')](_0xb44b('0x37'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x38')]);var upload=multer({'storage':multer[_0xb44b('0x39')]({'destination':function(_0x15723f,_0x44c322,_0x1eab78){_0x1eab78(null,path['join'](config[_0xb44b('0x3a')],_0xb44b('0x3b')));},'filename':function(_0x5395d9,_0x48c3c0,_0x3d1770){_0x3d1770(null,util[_0xb44b('0x3c')](_0xb44b('0x3d'),Date[_0xb44b('0x3e')](),_0x48c3c0[_0xb44b('0x3f')]));}})});router[_0xb44b('0x34')](_0xb44b('0x10'),upload[_0xb44b('0x40')](_0xb44b('0x41')),controller[_0xb44b('0x42')]);router[_0xb44b('0x34')](_0xb44b('0x43'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x44')]);router['post']('/:id/logout',auth[_0xb44b('0x8')](),controller[_0xb44b('0x45')]);router[_0xb44b('0x34')](_0xb44b('0x46'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x47')]);router[_0xb44b('0x34')](_0xb44b('0x48'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x49')]);router['post'](_0xb44b('0x24'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x4a')]);router['post'](_0xb44b('0x4b'),auth['isAuthenticated'](),controller[_0xb44b('0x4c')]);router[_0xb44b('0x34')](_0xb44b('0x4d'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x4e')]);router['post']('/:id/fax_interactions',auth[_0xb44b('0x8')](),controller['addFaxInteractions']);router[_0xb44b('0x34')](_0xb44b('0x4f'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x50')]);router[_0xb44b('0x34')](_0xb44b('0x51'),auth['isAuthenticated'](),controller[_0xb44b('0x52')]);router[_0xb44b('0x34')](_0xb44b('0x53'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post']('/:id/fax_accounts',auth[_0xb44b('0x8')](),controller['addFaxAccounts']);router[_0xb44b('0x34')](_0xb44b('0x54'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xb44b('0x34')](_0xb44b('0x2a'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x55')]);router[_0xb44b('0x34')]('/:id/sms_accounts',auth[_0xb44b('0x8')](),controller[_0xb44b('0x56')]);router[_0xb44b('0x34')]('/:id/chat_websites',auth[_0xb44b('0x8')](),controller[_0xb44b('0x57')]);router['post']('/:id/whatsapp_accounts',auth[_0xb44b('0x8')](),controller[_0xb44b('0x58')]);router[_0xb44b('0x34')](_0xb44b('0x2e'),auth['isAuthenticated'](),controller[_0xb44b('0x59')]);router[_0xb44b('0x34')](_0xb44b('0x32'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x5a')]);router[_0xb44b('0x5b')](_0xb44b('0xf'),auth['isAuthenticated'](),controller[_0xb44b('0x5c')]);router[_0xb44b('0x5b')]('/:id/password',auth[_0xb44b('0x8')](),controller[_0xb44b('0x5d')]);router[_0xb44b('0x5e')]('/:id/queues',auth[_0xb44b('0x8')](),controller[_0xb44b('0x5f')]);router[_0xb44b('0x5e')](_0xb44b('0x24'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x60')]);router[_0xb44b('0x5e')](_0xb44b('0xf'),auth[_0xb44b('0x8')](),controller['destroy']);router['delete'](_0xb44b('0x4b'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x61')]);router['delete'](_0xb44b('0x4d'),auth[_0xb44b('0x8')](),controller['removeMailInteractions']);router[_0xb44b('0x5e')](_0xb44b('0x62'),auth['isAuthenticated'](),controller[_0xb44b('0x63')]);router[_0xb44b('0x5e')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb44b('0x64')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0xb44b('0x53'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x65')]);router[_0xb44b('0x5e')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0xb44b('0x8')](),controller[_0xb44b('0x66')]);router['delete'](_0xb44b('0x2a'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x67')]);router[_0xb44b('0x5e')](_0xb44b('0x68'),auth[_0xb44b('0x8')](),controller['removeSmsAccounts']);router[_0xb44b('0x5e')](_0xb44b('0x69'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xb44b('0x5e')](_0xb44b('0x6a'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x6b')]);router[_0xb44b('0x5e')](_0xb44b('0x2e'),auth[_0xb44b('0x8')](),controller[_0xb44b('0x6c')]);router[_0xb44b('0x5e')](_0xb44b('0x32'),auth[_0xb44b('0x8')](),controller['removeApiKey']);module[_0xb44b('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e7f865c..9c80c68 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 _0xbdfd=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','update,nonat','TEXT','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','info','inband','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'];(function(_0x59a518,_0x42920b){var _0x442bf2=function(_0x3e309a){while(--_0x3e309a){_0x59a518['push'](_0x59a518['shift']());}};_0x442bf2(++_0x42920b);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xdbdf('0x0'));var moment=require('moment');var util=require('util');var _=require(_0xdbdf('0x1'));module[_0xdbdf('0x2')]={'name':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':![],'unique':_0xdbdf('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b8b14){this[_0xdbdf('0x5')](_0xdbdf('0x4'),_0x5b8b14);this['setDataValue'](_0xdbdf('0x6'),_0x5b8b14);},'comment':_0xdbdf('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x40096b){this[_0xdbdf('0x5')](_0xdbdf('0x8'),_0x40096b);this[_0xdbdf('0x5')](_0xdbdf('0x9'),util['format'](_0xdbdf('0xa'),_0x40096b,this[_0xdbdf('0xb')](_0xdbdf('0xc'))));}},'alias':{'type':Sequelize[_0xdbdf('0x3')]},'email':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':![],'unique':_0xdbdf('0xd'),'validate':{'isEmail':!![]},'set':function(_0x547b7b){if(_0x547b7b){this['setDataValue'](_0xdbdf('0xd'),_0x547b7b[_0xdbdf('0xe')]());}}},'role':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x10'),_0xdbdf('0x11'),_0xdbdf('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdbdf('0x3')],'defaultValue':_0xdbdf('0x13')},'internal':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':![],'unique':_0xdbdf('0xc'),'set':function(_0x24dfde){this[_0xdbdf('0x5')]('internal',_0x24dfde);this[_0xdbdf('0x5')](_0xdbdf('0x15'),_0x24dfde);this[_0xdbdf('0x5')](_0xdbdf('0x9'),util[_0xdbdf('0x16')]('\x22%s\x22\x20<%s>',this[_0xdbdf('0xb')](_0xdbdf('0x8')),_0x24dfde));}},'salt':{'type':Sequelize[_0xdbdf('0x3')]},'phone':{'type':Sequelize[_0xdbdf('0x3')]},'mobile':{'type':Sequelize[_0xdbdf('0x3')]},'address':{'type':Sequelize[_0xdbdf('0x3')]},'zipcode':{'type':Sequelize[_0xdbdf('0x3')]},'userpic':{'type':Sequelize[_0xdbdf('0x3')]},'city':{'type':Sequelize[_0xdbdf('0x3')]},'country':{'type':Sequelize[_0xdbdf('0x3')]},'online':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdbdf('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdbdf('0x3')],'defaultValue':_0xdbdf('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdbdf('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdbdf('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![],'defaultValue':_0xdbdf('0x1a')},'ipaddr':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xdbdf('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xdbdf('0x1b'),'user',_0xdbdf('0x1c')),'allowNull':!![],'defaultValue':_0xdbdf('0x1b')},'context':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![],'defaultValue':_0xdbdf('0x1d')},'callingpres':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x1e'),_0xdbdf('0x1f'),_0xdbdf('0x20'),_0xdbdf('0x21'),'PROHIB_NOT_SCREENED',_0xdbdf('0x22'),_0xdbdf('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdbdf('0x24'),'set':function(_0x3f0119){this['setDataValue'](_0xdbdf('0x25'),_0x3f0119?_0x3f0119[_0xdbdf('0x26')](','):null);},'get':function(){return this[_0xdbdf('0xb')](_0xdbdf('0x25'))?this[_0xdbdf('0xb')](_0xdbdf('0x25'))[_0xdbdf('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xdbdf('0x28'),'shortinfo',_0xdbdf('0x29'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no',_0xdbdf('0x2b'),_0xdbdf('0x2c'),_0xdbdf('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![],'defaultValue':_0xdbdf('0x2e'),'set':function(_0x3f4eec){this[_0xdbdf('0x5')](_0xdbdf('0x2f'),_0x3f4eec?_0x3f4eec[_0xdbdf('0x26')](','):null);},'get':function(){return this[_0xdbdf('0xb')]('nat')?this[_0xdbdf('0xb')](_0xdbdf('0x2f'))['split'](','):null;},'comment':_0xdbdf('0x30')},'callgroup':{'type':Sequelize[_0xdbdf('0x3')]},'namedcallgroup':{'type':Sequelize[_0xdbdf('0x3')]},'pickupgroup':{'type':Sequelize[_0xdbdf('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdbdf('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdbdf('0x31'),'set':function(_0x4a0b75){this[_0xdbdf('0x5')](_0xdbdf('0x32'),_0x4a0b75?_0x4a0b75[_0xdbdf('0x26')](';'):_0xdbdf('0x31'));},'get':function(){return this[_0xdbdf('0xb')](_0xdbdf('0x32'))?this['getDataValue']('allow')[_0xdbdf('0x27')](';'):null;},'comment':_0xdbdf('0x33')},'autoframing':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x32eb76){this['setDataValue'](_0xdbdf('0x34'),_0x32eb76?_0x32eb76[_0xdbdf('0x26')](','):null);},'get':function(){return this[_0xdbdf('0xb')](_0xdbdf('0x34'))?this[_0xdbdf('0xb')]('insecure')[_0xdbdf('0x27')](','):null;},'comment':_0xdbdf('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![],'defaultValue':_0xdbdf('0x36')},'amaflags':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdbdf('0xf')]('yes','no',_0xdbdf('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x38'),_0xdbdf('0x39'),_0xdbdf('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0xdbdf('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xdbdf('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdbdf('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no','fingerprint',_0xdbdf('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdbdf('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xdbdf('0x3e'),_0xdbdf('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdbdf('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdbdf('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdbdf('0xf')](_0xdbdf('0x2a'),'no',_0xdbdf('0x2b'),_0xdbdf('0x2c'),_0xdbdf('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdbdf('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xdbdf('0x18')]},'passwordResetAt':{'type':Sequelize[_0xdbdf('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdbdf('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x577928){this[_0xdbdf('0x5')]('showWebBar',_0x577928);var _0x9a1fe5=this[_0xdbdf('0x42')]({'plain':!![]});switch(_0x577928){case 0x0:case 0x1:var _0x4d1c3d=_0x9a1fe5['transport']?_['isArray'](_0x9a1fe5[_0xdbdf('0x25')])?_0x9a1fe5[_0xdbdf('0x25')]['join']():_0x9a1fe5[_0xdbdf('0x25')]:_0xdbdf('0x24');if(_0x4d1c3d===_0xdbdf('0x43')){_0x4d1c3d=_0xdbdf('0x24');}this[_0xdbdf('0x5')](_0xdbdf('0x25'),_0x4d1c3d);this[_0xdbdf('0x5')](_0xdbdf('0x44'),'no');this[_0xdbdf('0x5')](_0xdbdf('0x45'),null);this[_0xdbdf('0x5')](_0xdbdf('0x46'),null);this[_0xdbdf('0x5')](_0xdbdf('0x47'),null);this[_0xdbdf('0x5')](_0xdbdf('0x48'),null);this['setDataValue'](_0xdbdf('0x49'),null);this['setDataValue']('dtlssetup',null);this[_0xdbdf('0x5')](_0xdbdf('0x4a'),null);this[_0xdbdf('0x5')](_0xdbdf('0x4b'),null);this['setDataValue'](_0xdbdf('0x4c'),'no');break;case 0x2:this[_0xdbdf('0x5')](_0xdbdf('0x25'),_0xdbdf('0x43'));this[_0xdbdf('0x5')](_0xdbdf('0x44'),_0xdbdf('0x2a'));this['setDataValue'](_0xdbdf('0x45'),_0xdbdf('0x2a'));this[_0xdbdf('0x5')]('force_avp','yes');this[_0xdbdf('0x5')](_0xdbdf('0x47'),_0xdbdf('0x2a'));this[_0xdbdf('0x5')](_0xdbdf('0x48'),_0xdbdf('0x2a'));this[_0xdbdf('0x5')](_0xdbdf('0x49'),'no');this[_0xdbdf('0x5')]('dtlssetup',_0xdbdf('0x4d'));this['setDataValue']('dtlscertfile',_0x9a1fe5['dtlscertfile']||_0xdbdf('0x4e'));this[_0xdbdf('0x5')](_0xdbdf('0x4b'),_0x9a1fe5[_0xdbdf('0x4b')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xdbdf('0x41')],'set':function(_0x5c0d73){this[_0xdbdf('0x5')](_0xdbdf('0x4f'),_0x5c0d73?_0x5c0d73['join'](','):[]);},'get':function(){return this['getDataValue'](_0xdbdf('0x4f'))?_[_0xdbdf('0x50')](this[_0xdbdf('0xb')]('permissions')['split'](','),function(_0x1ed7cf){return parseInt(_0x1ed7cf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdbdf('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdbdf('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xdbdf('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdbdf('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xdbdf('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdbdf('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdbdf('0x51')],'get':function(){return this[_0xdbdf('0xb')](_0xdbdf('0x52'))?this[_0xdbdf('0xb')](_0xdbdf('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xdbdf('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdbdf('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![],'set':function(_0x203dec){if(typeof _0x203dec===_0xdbdf('0x53')){var _0x188202=_0x203dec==='1'?!![]:_0x203dec==='0'?![]:_0x203dec===_0xdbdf('0x54')?!![]:_0x203dec===_0xdbdf('0x55')?![]:![];this[_0xdbdf('0x5')](_0xdbdf('0x56'),_0x188202);}else{this['setDataValue'](_0xdbdf('0x56'),_0x203dec);}}},'blocked':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![],'set':function(_0x5dbcad){this[_0xdbdf('0x5')]('blocked',_0x5dbcad);if(_0x5dbcad===!![]){this[_0xdbdf('0x5')](_0xdbdf('0x57'),moment());this[_0xdbdf('0x5')](_0xdbdf('0x58'),0x0);}else{this['setDataValue'](_0xdbdf('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdbdf('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdbdf('0x14')](0x5)[_0xdbdf('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xdbdf('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xff16=['never','accept','refuse','uac','uas','fingerprint','certificate','passive','actpass','nonat','update,nonat','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','yes','update','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x53b843,_0x5d0cec){var _0x43b2f1=function(_0x216508){while(--_0x216508){_0x53b843['push'](_0x53b843['shift']());}};_0x43b2f1(++_0x5d0cec);}(_0xff16,0x7f));var _0x6ff1=function(_0x3f092f,_0x4042f4){_0x3f092f=_0x3f092f-0x0;var _0x1b3a00=_0xff16[_0x3f092f];return _0x1b3a00;};'use strict';var Sequelize=require(_0x6ff1('0x0'));var moment=require(_0x6ff1('0x1'));var util=require('util');var _=require(_0x6ff1('0x2'));module[_0x6ff1('0x3')]={'name':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':![],'unique':_0x6ff1('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f3c60){this[_0x6ff1('0x6')](_0x6ff1('0x5'),_0x3f3c60);this[_0x6ff1('0x6')]('defaultuser',_0x3f3c60);},'comment':_0x6ff1('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x133524){this[_0x6ff1('0x6')](_0x6ff1('0x8'),_0x133524);this[_0x6ff1('0x6')](_0x6ff1('0x9'),util[_0x6ff1('0xa')](_0x6ff1('0xb'),_0x133524,this[_0x6ff1('0xc')]('internal')));}},'alias':{'type':Sequelize[_0x6ff1('0x4')]},'email':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':![],'unique':_0x6ff1('0xd'),'validate':{'isEmail':!![]},'set':function(_0x425a21){if(_0x425a21){this[_0x6ff1('0x6')](_0x6ff1('0xd'),_0x425a21[_0x6ff1('0xe')]());}}},'role':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x10'),_0x6ff1('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x6ff1('0x12')},'internal':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':![],'unique':_0x6ff1('0x14'),'set':function(_0x543e07){this['setDataValue']('internal',_0x543e07);this[_0x6ff1('0x6')](_0x6ff1('0x15'),_0x543e07);this[_0x6ff1('0x6')](_0x6ff1('0x9'),util[_0x6ff1('0xa')](_0x6ff1('0xb'),this['getDataValue'](_0x6ff1('0x8')),_0x543e07));}},'salt':{'type':Sequelize[_0x6ff1('0x4')]},'phone':{'type':Sequelize[_0x6ff1('0x4')]},'mobile':{'type':Sequelize[_0x6ff1('0x4')]},'address':{'type':Sequelize[_0x6ff1('0x4')]},'zipcode':{'type':Sequelize[_0x6ff1('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6ff1('0x4')]},'country':{'type':Sequelize[_0x6ff1('0x4')]},'online':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6ff1('0x17')]},'voicePause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6ff1('0x4')],'defaultValue':_0x6ff1('0x18')},'lastPauseAt':{'type':Sequelize[_0x6ff1('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6ff1('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6ff1('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6ff1('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6ff1('0xf')]('friend',_0x6ff1('0x11'),_0x6ff1('0x19')),'allowNull':!![],'defaultValue':_0x6ff1('0x1a')},'context':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x1b'),_0x6ff1('0x1c'),_0x6ff1('0x1d'),_0x6ff1('0x1e'),'PROHIB_NOT_SCREENED',_0x6ff1('0x1f'),_0x6ff1('0x20'),_0x6ff1('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![],'defaultValue':_0x6ff1('0x22'),'set':function(_0x1a7906){this[_0x6ff1('0x6')](_0x6ff1('0x23'),_0x1a7906?_0x1a7906['join'](','):null);},'get':function(){return this['getDataValue'](_0x6ff1('0x23'))?this[_0x6ff1('0xc')](_0x6ff1('0x23'))[_0x6ff1('0x24')](','):null;},'comment':_0x6ff1('0x25')},'dtmfmode':{'type':Sequelize[_0x6ff1('0xf')]('rfc2833',_0x6ff1('0x26'),_0x6ff1('0x27'),_0x6ff1('0x28'),'auto'),'allowNull':!![],'defaultValue':_0x6ff1('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no','nonat',_0x6ff1('0x2b'),_0x6ff1('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![],'defaultValue':_0x6ff1('0x2d'),'set':function(_0x168746){this[_0x6ff1('0x6')]('nat',_0x168746?_0x168746[_0x6ff1('0x2e')](','):null);},'get':function(){return this['getDataValue'](_0x6ff1('0x2f'))?this['getDataValue']('nat')[_0x6ff1('0x24')](','):null;},'comment':_0x6ff1('0x30')},'callgroup':{'type':Sequelize[_0x6ff1('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6ff1('0x4')]},'pickupgroup':{'type':Sequelize[_0x6ff1('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6ff1('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6ff1('0x4')]},'disallow':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ff1('0x31'),'set':function(_0x4c41b9){this[_0x6ff1('0x6')](_0x6ff1('0x32'),_0x4c41b9?_0x4c41b9[_0x6ff1('0x2e')](';'):_0x6ff1('0x31'));},'get':function(){return this[_0x6ff1('0xc')](_0x6ff1('0x32'))?this['getDataValue'](_0x6ff1('0x32'))[_0x6ff1('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![],'set':function(_0x6bc8bb){this[_0x6ff1('0x6')](_0x6ff1('0x33'),_0x6bc8bb?_0x6bc8bb[_0x6ff1('0x2e')](','):null);},'get':function(){return this[_0x6ff1('0xc')](_0x6ff1('0x33'))?this['getDataValue'](_0x6ff1('0x33'))[_0x6ff1('0x24')](','):null;},'comment':_0x6ff1('0x34')},'trustrpid':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no',_0x6ff1('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x6ff1('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x36'),_0x6ff1('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x38'),_0x6ff1('0x39')),'allowNull':!![],'defaultValue':_0x6ff1('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x6ff1('0x2a')},'keepalive':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6ff1('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6ff1('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6ff1('0xf')]('yes','no',_0x6ff1('0x3a'),_0x6ff1('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6ff1('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6ff1('0xf')]('active',_0x6ff1('0x3c'),_0x6ff1('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6ff1('0xf')](_0x6ff1('0x2a'),'no',_0x6ff1('0x3e'),_0x6ff1('0x2b'),_0x6ff1('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6ff1('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x6ff1('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x0,'set':function(_0x316344){this['setDataValue'](_0x6ff1('0x40'),_0x316344);var _0x4ac7b2=this[_0x6ff1('0x41')]({'plain':!![]});switch(_0x316344){case 0x0:case 0x1:var _0x37d452=_0x4ac7b2[_0x6ff1('0x23')]?_['isArray'](_0x4ac7b2[_0x6ff1('0x23')])?_0x4ac7b2[_0x6ff1('0x23')][_0x6ff1('0x2e')]():_0x4ac7b2[_0x6ff1('0x23')]:_0x6ff1('0x22');if(_0x37d452===_0x6ff1('0x42')){_0x37d452=_0x6ff1('0x22');}this[_0x6ff1('0x6')]('transport',_0x37d452);this[_0x6ff1('0x6')](_0x6ff1('0x43'),'no');this[_0x6ff1('0x6')](_0x6ff1('0x44'),null);this[_0x6ff1('0x6')](_0x6ff1('0x45'),null);this[_0x6ff1('0x6')](_0x6ff1('0x46'),null);this[_0x6ff1('0x6')](_0x6ff1('0x47'),null);this['setDataValue'](_0x6ff1('0x48'),null);this['setDataValue'](_0x6ff1('0x49'),null);this[_0x6ff1('0x6')]('dtlscertfile',null);this['setDataValue'](_0x6ff1('0x4a'),null);this[_0x6ff1('0x6')](_0x6ff1('0x4b'),'no');break;case 0x2:this[_0x6ff1('0x6')](_0x6ff1('0x23'),_0x6ff1('0x42'));this[_0x6ff1('0x6')](_0x6ff1('0x43'),_0x6ff1('0x2a'));this[_0x6ff1('0x6')](_0x6ff1('0x44'),_0x6ff1('0x2a'));this['setDataValue'](_0x6ff1('0x45'),_0x6ff1('0x2a'));this['setDataValue']('icesupport',_0x6ff1('0x2a'));this['setDataValue'](_0x6ff1('0x47'),_0x6ff1('0x2a'));this[_0x6ff1('0x6')](_0x6ff1('0x48'),'no');this[_0x6ff1('0x6')]('dtlssetup',_0x6ff1('0x3d'));this[_0x6ff1('0x6')](_0x6ff1('0x4c'),_0x4ac7b2['dtlscertfile']||_0x6ff1('0x4d'));this['setDataValue'](_0x6ff1('0x4a'),_0x4ac7b2[_0x6ff1('0x4a')]||'/etc/pki/tls/private/motion.key');this[_0x6ff1('0x6')](_0x6ff1('0x4b'),_0x6ff1('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x37b27c){this[_0x6ff1('0x6')](_0x6ff1('0x4e'),_0x37b27c?_0x37b27c[_0x6ff1('0x2e')](','):[]);},'get':function(){return this[_0x6ff1('0xc')]('permissions')?_[_0x6ff1('0x4f')](this[_0x6ff1('0xc')](_0x6ff1('0x4e'))['split'](','),function(_0x4190fe){return parseInt(_0x4190fe,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6ff1('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6ff1('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6ff1('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6ff1('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6ff1('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6ff1('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6ff1('0x50')],'get':function(){return this[_0x6ff1('0xc')](_0x6ff1('0x51'))?this[_0x6ff1('0xc')](_0x6ff1('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6ff1('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6ff1('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![],'set':function(_0xb109aa){if(typeof _0xb109aa===_0x6ff1('0x52')){var _0x4eca12=_0xb109aa==='1'?!![]:_0xb109aa==='0'?![]:_0xb109aa===_0x6ff1('0x53')?!![]:_0xb109aa===_0x6ff1('0x54')?![]:![];this['setDataValue'](_0x6ff1('0x55'),_0x4eca12);}else{this[_0x6ff1('0x6')](_0x6ff1('0x55'),_0xb109aa);}}},'blocked':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![],'set':function(_0x147e28){this[_0x6ff1('0x6')](_0x6ff1('0x56'),_0x147e28);if(_0x147e28===!![]){this[_0x6ff1('0x6')](_0x6ff1('0x57'),moment());this[_0x6ff1('0x6')](_0x6ff1('0x58'),0x0);}else{this[_0x6ff1('0x6')](_0x6ff1('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x6ff1('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6ff1('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6ff1('0x13')](0x5)[_0x6ff1('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6ff1('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9a20e2f..b7db99d 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 _0x8952=['status','json','offset','undefined','limit','update','destroy','then','get','role','Users','user','agent','Telephones','telephone','ignore','map','value','includes','find','name','stack','send','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','count','query','includeAll','include','attributes','push','findAll','rows','openTabs','true','length','chat','sms','dataValues','fax','mail','openchannel','all','show','params','model','keys','filters','intersection','fields','merge','options','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','permissions','101','102','113','110','104','105','108','111','114','115','Unauthorized','admin','checkUserLimits','settingsEnabled','userProfileId','create','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','Agents','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','emit','capitalize','Queue:save','VoiceQueue','online','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','channel','isValidChannel','remove','Queues','isArray','QueueId','Queue:remove','voice','addAvatar','file','join','root','server/files/images/logos/default_profile.png','userpic','download','server/files/images/','getOpenTabs','whatsapp','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','sort','where','pick','filter','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','order','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','%s%s','Pause','Team','addTeams','getVoiceQueues','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','getChatQueues','Whatsapp','flatten','UserVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contained','$any','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','isEmpty','inbound','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','socket.io-emitter','redis','./user.socket','register','client','request','info','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','catch','sendStatus'];(function(_0x5d3b56,_0x4293bd){var _0xf17aab=function(_0x55ebcb){while(--_0x55ebcb){_0x5d3b56['push'](_0x5d3b56['shift']());}};_0xf17aab(++_0x4293bd);}(_0x8952,0x17e));var _0x2895=function(_0x274c81,_0x14138a){_0x274c81=_0x274c81-0x0;var _0x54a681=_0x8952[_0x274c81];return _0x54a681;};'use strict';var moment=require('moment');var BPromise=require(_0x2895('0x0'));var util=require(_0x2895('0x1'));var path=require(_0x2895('0x2'));var fs=require('fs');var _=require(_0x2895('0x3'));var squel=require(_0x2895('0x4'));var jayson=require('jayson/promise');var Redis=require(_0x2895('0x5'));var authService=require(_0x2895('0x6'));var qs=require(_0x2895('0x7'));var logger=require('../../config/logger')(_0x2895('0x8'));var utils=require(_0x2895('0x9'));var config=require(_0x2895('0xa'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require(_0x2895('0xb'))(new Redis(config[_0x2895('0xc')]));require(_0x2895('0xd'))[_0x2895('0xe')](socket);config[_0x2895('0xc')]=_['defaults'](config[_0x2895('0xc')],{'host':'localhost','port':0x18eb});var client=jayson[_0x2895('0xf')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x5e66fc,_0x56c5b9,_0x9bb58c,_0x1829a2){return new BPromise(function(_0x2d237f,_0x49c983){var _0x981298=_0x1829a2||client;return _0x981298[_0x2895('0x10')](_0x5e66fc,_0x9bb58c)['then'](function(_0x32574c){logger[_0x2895('0x11')]('User,\x20%s,\x20%s',_0x56c5b9,'request\x20sent');logger[_0x2895('0x12')](_0x2895('0x13'),_0x56c5b9,'request\x20sent',JSON[_0x2895('0x14')](_0x32574c));if(_0x32574c[_0x2895('0x15')]){if(_0x32574c[_0x2895('0x15')][_0x2895('0x16')]===0x1f4){logger[_0x2895('0x15')](_0x2895('0x17'),_0x56c5b9,_0x32574c[_0x2895('0x15')][_0x2895('0x18')]);return _0x49c983(_0x32574c[_0x2895('0x15')][_0x2895('0x18')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x56c5b9,_0x32574c[_0x2895('0x15')][_0x2895('0x18')]);return _0x2d237f(_0x32574c[_0x2895('0x15')][_0x2895('0x18')]);}else{logger[_0x2895('0x11')](_0x2895('0x17'),_0x56c5b9,'request\x20sent');_0x2d237f(_0x32574c['result']['message']);}})[_0x2895('0x19')](function(_0x12c2fb){logger[_0x2895('0x15')]('User,\x20%s,\x20%s',_0x56c5b9,_0x12c2fb);_0x49c983(_0x12c2fb);});});}function respondWithStatusCode(_0x2813a3,_0x190b79){_0x190b79=_0x190b79||0xcc;return function(_0x2743b5){if(_0x2743b5){return _0x2813a3[_0x2895('0x1a')](_0x190b79);}return _0x2813a3[_0x2895('0x1b')](_0x190b79)['end']();};}function respondWithResult(_0x30c6c3,_0x5e93a4){_0x5e93a4=_0x5e93a4||0xc8;return function(_0x5671fa){if(_0x5671fa){return _0x30c6c3[_0x2895('0x1b')](_0x5e93a4)[_0x2895('0x1c')](_0x5671fa);}};}function respondWithFilteredResult(_0x6f8ad4,_0x511286){return function(_0x4e884f){if(_0x4e884f){var _0x3a72fa=typeof _0x511286[_0x2895('0x1d')]===_0x2895('0x1e')&&typeof _0x511286['limit']===_0x2895('0x1e');var _0x3690ce=_0x4e884f['count'];var _0x293ad3=_0x3a72fa?0x0:_0x511286[_0x2895('0x1d')];var _0x2cd4df=_0x3a72fa?_0x4e884f['count']:_0x511286[_0x2895('0x1d')]+_0x511286[_0x2895('0x1f')];var _0x5eedfc;if(_0x2cd4df>=_0x3690ce){_0x2cd4df=_0x3690ce;_0x5eedfc=0xc8;}else{_0x5eedfc=0xce;}_0x6f8ad4[_0x2895('0x1b')](_0x5eedfc);return _0x6f8ad4['set']('Content-Range',_0x293ad3+'-'+_0x2cd4df+'/'+_0x3690ce)[_0x2895('0x1c')](_0x4e884f);}return null;};}function saveUpdates(_0x4ee2cc){return function(_0xfa4f85){if(_0xfa4f85){return _0xfa4f85[_0x2895('0x20')](_0x4ee2cc)['then'](function(_0x5574bf){return _0x5574bf;});}return null;};}function removeEntity(_0x32db49){return function(_0x30dc2f){if(_0x30dc2f){return _0x30dc2f[_0x2895('0x21')]()[_0x2895('0x22')](function(){var _0x14d150=_0x30dc2f[_0x2895('0x23')]({'plain':!![]});if(_0x14d150[_0x2895('0x24')]==='admin')return;var _0x133f86=[{'name':_0x2895('0x25'),'value':_0x2895('0x26'),'ignore':!![]},{'name':'Agents','value':_0x2895('0x27'),'ignore':![]},{'name':_0x2895('0x28'),'value':_0x2895('0x29'),'ignore':![]}];var _0x35a2e8=_(_0x133f86)['filter'](_0x2895('0x2a'))[_0x2895('0x2b')](_0x2895('0x2c'))[_0x2895('0x2c')]();if(_[_0x2895('0x2d')](_0x35a2e8,_0x14d150['role'])){return;}var _0x48b51d=_[_0x2895('0x2e')](_0x133f86,[_0x2895('0x2c'),_0x14d150['role']])[_0x2895('0x2f')];return db['UserProfileResource'][_0x2895('0x21')]({'where':{'type':_0x48b51d,'resourceId':_0x14d150['id']}})[_0x2895('0x22')](function(){return _0x30dc2f;});})['then'](function(){_0x32db49[_0x2895('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310d05){return function(_0x53399b){if(!_0x53399b){_0x310d05['sendStatus'](0x194);}return _0x53399b;};}function handleError(_0xa6fe9e,_0x1fa15c){_0x1fa15c=_0x1fa15c||0x1f4;return function(_0x30594f){logger['error'](_0x30594f[_0x2895('0x30')]);if(_0x30594f[_0x2895('0x2f')]){delete _0x30594f[_0x2895('0x2f')];}_0xa6fe9e[_0x2895('0x1b')](_0x1fa15c)[_0x2895('0x31')](_0x30594f);};}exports[_0x2895('0x32')]=function(_0xf44bda,_0x240230){var _0x76c172={},_0xa6b8c5={'count':0x0,'rows':[]};var _0x59b0e6=_(db[_0x2895('0x33')][_0x2895('0x34')])[_0x2895('0x2b')](function(_0x1e5788){return{'name':_0x1e5788[_0x2895('0x35')],'type':_0x1e5788[_0x2895('0x36')][_0x2895('0x37')]};})['filter'](function(_0x5e5858){return!_[_0x2895('0x2d')]([_0x2895('0x38'),_0x2895('0x39')],_0x5e5858[_0x2895('0x2f')]);})[_0x2895('0x2c')]();_0x76c172=qs[_0x2895('0x3a')](_0x59b0e6,_0xf44bda);var _0x493947={'where':_0x76c172['where']};return db[_0x2895('0x33')][_0x2895('0x3b')](_0x493947)['then'](function(_0x5afd22){_0xa6b8c5[_0x2895('0x3b')]=_0x5afd22;if(_0xf44bda[_0x2895('0x3c')][_0x2895('0x3d')]){_0x76c172[_0x2895('0x3e')]=[{'all':!![]}];}if(!_[_0x2895('0x2d')](_0x76c172[_0x2895('0x3f')],'id')){_0x76c172['attributes'][_0x2895('0x40')]('id');}return db[_0x2895('0x33')][_0x2895('0x41')](_0x76c172);})[_0x2895('0x22')](function(_0x4af6d6){_0xa6b8c5[_0x2895('0x42')]=_0x4af6d6;if(_0xf44bda[_0x2895('0x3c')][_0x2895('0x43')]===_0x2895('0x44')){var _0x564983=[];for(var _0x4ef9fe=0x0;_0x4ef9fe<_0xa6b8c5[_0x2895('0x42')][_0x2895('0x45')];_0x4ef9fe++){_0x564983[_0x2895('0x40')](get_open_tabs(_0x2895('0x46'),_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe]['dataValues']));_0x564983['push'](get_open_tabs(_0x2895('0x47'),_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe][_0x2895('0x48')]));_0x564983[_0x2895('0x40')](get_open_tabs(_0x2895('0x49'),_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe][_0x2895('0x48')]));_0x564983['push'](get_open_tabs(_0x2895('0x4a'),_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe][_0x2895('0x48')]));_0x564983[_0x2895('0x40')](get_open_tabs(_0x2895('0x4b'),_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe][_0x2895('0x48')]));_0x564983[_0x2895('0x40')](get_open_tabs('whatsapp',_0xa6b8c5[_0x2895('0x42')][_0x4ef9fe][_0x2895('0x48')]));}return BPromise[_0x2895('0x4c')](_0x564983)['then'](function(_0xc85aa1){return _0xa6b8c5;});}else{return _0xa6b8c5;}})[_0x2895('0x22')](respondWithFilteredResult(_0x240230,_0x76c172))['catch'](handleError(_0x240230,null));};exports[_0x2895('0x4d')]=function(_0x1b3fd5,_0x222c37){var _0x34a84c={'raw':![],'where':{'id':_0x1b3fd5[_0x2895('0x4e')]['id']}},_0x8acfb8={};_0x8acfb8[_0x2895('0x4f')]=_['differenceBy'](_[_0x2895('0x50')](db[_0x2895('0x33')]['rawAttributes']),['password','salt']);_0x8acfb8[_0x2895('0x3c')]=_[_0x2895('0x50')](_0x1b3fd5[_0x2895('0x3c')]);_0x8acfb8[_0x2895('0x51')]=_[_0x2895('0x52')](_0x8acfb8[_0x2895('0x4f')],_0x8acfb8[_0x2895('0x3c')]);_0x34a84c[_0x2895('0x3f')]=_[_0x2895('0x52')](_0x8acfb8[_0x2895('0x4f')],qs[_0x2895('0x53')](_0x1b3fd5[_0x2895('0x3c')][_0x2895('0x53')]));_0x34a84c[_0x2895('0x3f')]=_0x34a84c[_0x2895('0x3f')][_0x2895('0x45')]?_0x34a84c[_0x2895('0x3f')]:_0x8acfb8[_0x2895('0x4f')];if(_0x1b3fd5[_0x2895('0x3c')][_0x2895('0x3d')]){_0x34a84c[_0x2895('0x3e')]=[{'all':!![]}];}_0x34a84c=_[_0x2895('0x54')]({},_0x34a84c,_0x1b3fd5[_0x2895('0x55')]);if(!_[_0x2895('0x2d')](_0x34a84c[_0x2895('0x3f')],'id')){_0x34a84c[_0x2895('0x3f')][_0x2895('0x40')]('id');}return db[_0x2895('0x33')][_0x2895('0x2e')](_0x34a84c)[_0x2895('0x22')](handleEntityNotFound(_0x222c37,null))[_0x2895('0x22')](function(_0x4e6f1c){var _0xbc538a=[];values=_0x4e6f1c;if(_0x1b3fd5[_0x2895('0x3c')][_0x2895('0x43')]===_0x2895('0x44')){_0xbc538a[_0x2895('0x40')](get_open_tabs(_0x2895('0x46'),_0x4e6f1c['dataValues']));_0xbc538a[_0x2895('0x40')](get_open_tabs('sms',_0x4e6f1c[_0x2895('0x48')]));_0xbc538a[_0x2895('0x40')](get_open_tabs(_0x2895('0x4b'),_0x4e6f1c[_0x2895('0x48')]));_0xbc538a[_0x2895('0x40')](get_open_tabs('whatsapp',_0x4e6f1c['dataValues']));_0xbc538a[_0x2895('0x40')](get_open_tabs(_0x2895('0x49'),_0x4e6f1c[_0x2895('0x48')]));_0xbc538a['push'](get_open_tabs(_0x2895('0x4a'),_0x4e6f1c['dataValues']));return BPromise[_0x2895('0x4c')](_0xbc538a);}else{return values;}})['then'](function(_0x511b77){return values;})['then'](respondWithResult(_0x222c37,null))['catch'](handleError(_0x222c37,null));};exports[_0x2895('0x20')]=function(_0x2ff725,_0x402e00){if(_0x2ff725[_0x2895('0x56')]['id']){delete _0x2ff725[_0x2895('0x56')]['id'];}delete _0x2ff725[_0x2895('0x56')][_0x2895('0x24')];return db['User'][_0x2895('0x2e')]({'where':{'id':_0x2ff725[_0x2895('0x4e')]['id']}})['then'](handleEntityNotFound(_0x402e00,null))[_0x2895('0x22')](saveUpdates(_0x2ff725['body'],null))['then'](respondWithResult(_0x402e00,null))[_0x2895('0x19')](handleError(_0x402e00,null));};exports[_0x2895('0x57')]=function(_0x50299a,_0xf5be){return db[_0x2895('0x33')][_0x2895('0x57')]()[_0x2895('0x22')](respondWithResult(_0xf5be,null))['catch'](handleError(_0xf5be,null));};exports[_0x2895('0x58')]=function(_0x5db182,_0x409e2b){return db['User']['find']({'where':{'id':_0x5db182[_0x2895('0x4e')]['id']}})['then'](handleEntityNotFound(_0x409e2b,null))[_0x2895('0x22')](function(_0x39a28b){if(_0x39a28b){return _0x39a28b[_0x2895('0x58')](_0x5db182['body'][_0x2895('0x59')],_[_0x2895('0x5a')](_0x5db182['body'],['ids','id'])||{});}})[_0x2895('0x22')](respondWithResult(_0x409e2b,null))[_0x2895('0x19')](handleError(_0x409e2b,null));};function validateUser(_0x4b5b50){return new BPromise(function(_0x31505c,_0x53f9d8){if(_0x4b5b50['internal'])return _0x31505c(_0x4b5b50);return db[_0x2895('0x5b')][_0x2895('0x5c')](0x1)[_0x2895('0x22')](function(_0x57f120){if(_0x57f120[_0x2895('0x5d')])authService[_0x2895('0x5e')](_0x4b5b50[_0x2895('0x38')]);db[_0x2895('0x33')][_0x2895('0x5f')](_0x2895('0x60'))[_0x2895('0x22')](function(_0x5b2059){if(_[_0x2895('0x61')](_0x5b2059)){_0x4b5b50[_0x2895('0x60')]=_0x57f120[_0x2895('0x62')]||0x1;return;}if(_[_0x2895('0x61')](_0x57f120[_0x2895('0x62')])||_0x57f120[_0x2895('0x62')]===_0x5b2059){_0x4b5b50[_0x2895('0x60')]=_0x5b2059+0x1;return;}if(_0x57f120[_0x2895('0x62')]>_0x5b2059){_0x4b5b50['internal']=_0x57f120[_0x2895('0x62')];return;}return db[_0x2895('0x63')][_0x2895('0x3c')](_0x2895('0x64'),{'type':db[_0x2895('0x63')][_0x2895('0x65')][_0x2895('0x66')]})[_0x2895('0x22')](function(_0x35ae08){if(_0x35ae08&&_0x35ae08[_0x2895('0x45')]){for(var _0x53a270=0x0,_0x477385=_0x35ae08[_0x2895('0x45')];_0x53a270<_0x477385&&_[_0x2895('0x61')](_0x4b5b50[_0x2895('0x60')]);_0x53a270++){if(_0x57f120[_0x2895('0x62')]<=_0x35ae08[_0x53a270][_0x2895('0x67')]){_0x4b5b50[_0x2895('0x60')]=_0x35ae08[_0x53a270][_0x2895('0x67')];}else if(_0x57f120[_0x2895('0x62')]>_0x35ae08[_0x53a270][_0x2895('0x67')]&&_0x57f120['min_internal']<=_0x35ae08[_0x53a270]['to']){_0x4b5b50[_0x2895('0x60')]=_0x57f120[_0x2895('0x62')];}}}if(_[_0x2895('0x61')](_0x4b5b50[_0x2895('0x60')])){_0x4b5b50[_0x2895('0x60')]=_0x5b2059+0x1;}return _0x31505c(_0x4b5b50);});});})['catch'](function(_0x257331){_0x53f9d8(_0x257331);});});}function updateUser(_0x1ce803){return new BPromise(function(_0x4c569e,_0x5f3eb0){try{if(_0x1ce803['voicemail']){_0x1ce803[_0x2895('0x68')]=_0x1ce803[_0x2895('0x60')];_0x1ce803[_0x2895('0x69')]={'mailbox':_0x1ce803[_0x2895('0x60')],'password':_0x1ce803[_0x2895('0x38')],'fullname':_0x1ce803['fullname'],'email':_0x1ce803['email']};}if(_0x1ce803[_0x2895('0x24')]==='agent'){if(!_0x1ce803[_0x2895('0x6a')])_0x1ce803['permissions']=[_0x2895('0x6b'),_0x2895('0x6c'),'103',_0x2895('0x6d'),_0x2895('0x6e'),_0x2895('0x6f'),_0x2895('0x70'),'106','107',_0x2895('0x71'),'109','100',_0x2895('0x72'),_0x2895('0x73'),_0x2895('0x74')];}_0x4c569e(_0x1ce803);}catch(_0x33bea9){_0x5f3eb0(_0x33bea9);}});}exports['create']=function(_0x284c2c,_0x29e466){if(_0x284c2c[_0x2895('0x26')][_0x2895('0x24')]===_0x2895('0x27'))throw new Error(_0x2895('0x75'));if(_0x284c2c[_0x2895('0x56')][_0x2895('0x24')]===_0x2895('0x26')&&_0x284c2c[_0x2895('0x26')][_0x2895('0x24')]!==_0x2895('0x76')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x284c2c[_0x2895('0x56')][_0x2895('0x24')]===_0x2895('0x76')&&_0x284c2c['user'][_0x2895('0x24')]!==_0x2895('0x76')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2895('0x77')]([_0x284c2c[_0x2895('0x56')]])[_0x2895('0x22')](function(){return validateUser(_0x284c2c['body']);})[_0x2895('0x22')](function(_0x44b464){return updateUser(_0x44b464)[_0x2895('0x22')](function(_0x3fc6a1){if(_0x3fc6a1['role']===_0x2895('0x76')){_0x3fc6a1[_0x2895('0x78')]=_0x284c2c[_0x2895('0x26')]['settingsEnabled'];delete _0x3fc6a1[_0x2895('0x79')];}return _0x3fc6a1;});})['then'](function(_0x468c4e){return db[_0x2895('0x33')][_0x2895('0x7a')](_0x468c4e,{'include':[{'model':db[_0x2895('0x69')],'as':'VoiceMail'}]});})[_0x2895('0x22')](function(_0x46bbca){if(_0x284c2c[_0x2895('0x56')]['role']===_0x2895('0x26'))return _0x46bbca;if(_0x284c2c['user'][_0x2895('0x24')]!==_0x2895('0x26'))return _0x46bbca;return db['UserProfileSection']['find']({'where':{'name':_0x46bbca[_0x2895('0x24')]===_0x2895('0x27')?'Agents':_0x2895('0x28'),'userProfileId':_0x284c2c[_0x2895('0x26')]['userProfileId']},'raw':!![]})[_0x2895('0x22')](function(_0x2ca3a5){if(!_0x2ca3a5||_0x2ca3a5[_0x2895('0x7b')]!=0x0)return _0x46bbca;return db[_0x2895('0x7c')][_0x2895('0x7a')]({'name':_0x46bbca['name'],'resourceId':_0x46bbca['id'],'type':_0x2ca3a5[_0x2895('0x2f')],'sectionId':_0x2ca3a5['id']},{})[_0x2895('0x22')](function(){return _0x46bbca;});})[_0x2895('0x19')](function(_0x2210f1){logger[_0x2895('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2210f1);throw _0x2210f1;});})[_0x2895('0x22')](respondWithResult(_0x29e466,0xc9))[_0x2895('0x19')](handleError(_0x29e466,null));};exports[_0x2895('0x7d')]=function(_0x1cc5f6,_0x5d5048){var _0xd2fa85=_0x1cc5f6[_0x2895('0x56')];var _0x198c58=[];if(_0x1cc5f6[_0x2895('0x26')]['role']===_0x2895('0x27'))throw new Error(_0x2895('0x75'));if(_[_0x2895('0x7e')](_0xd2fa85,[_0x2895('0x24'),_0x2895('0x26')])&&_0x1cc5f6[_0x2895('0x26')]['role']!==_0x2895('0x76')){throw new Error(_0x2895('0x7f'));}if(_[_0x2895('0x7e')](_0xd2fa85,['role','admin'])&&_0x1cc5f6[_0x2895('0x26')][_0x2895('0x24')]!==_0x2895('0x76')){throw new Error(_0x2895('0x80'));}return licenseUtil[_0x2895('0x77')](_0xd2fa85)['then'](function(){return validateUser(_0xd2fa85[0x0]);})[_0x2895('0x22')](function(){for(var _0x837eef=0x1;_0x837eef<_0xd2fa85[_0x2895('0x45')];_0x837eef++){var _0x5da9af=_0xd2fa85[_0x837eef-0x1]['internal'];if(!_0xd2fa85[_0x837eef][_0x2895('0x60')])_0xd2fa85[_0x837eef][_0x2895('0x60')]=_0x5da9af+0x1;_0x198c58[_0x2895('0x40')](validateUser(_0xd2fa85[_0x837eef]));}return BPromise['all'](_0x198c58);})[_0x2895('0x22')](function(){_0x198c58=[];for(var _0x4fe84e=0x0;_0x4fe84e<_0xd2fa85[_0x2895('0x45')];_0x4fe84e++){_0x198c58[_0x2895('0x40')](updateUser(_0xd2fa85[_0x4fe84e]));}return BPromise['all'](_0x198c58);})[_0x2895('0x22')](function(){return BPromise[_0x2895('0x81')](_0xd2fa85,function(_0x71d436){return db[_0x2895('0x33')][_0x2895('0x7a')](_0x71d436,{'include':[{'model':db[_0x2895('0x69')],'as':_0x2895('0x69')}]})[_0x2895('0x22')](function(_0x2d6167){_0x71d436['id']=_0x2d6167['id'];return _0x71d436;});});})[_0x2895('0x22')](function(_0x32baef){if(_0x1cc5f6[_0x2895('0x56')][_0x2895('0x24')]===_0x2895('0x26'))return _0x32baef;if(_0x1cc5f6['user']['role']!=='user')return _0x32baef;var _0x4f47e2=_[_0x2895('0x7e')](_0x32baef,function(_0x858463){return _0x858463[_0x2895('0x24')]===_0x2895('0x27')||_0x858463[_0x2895('0x24')]===_0x2895('0x29');});if(!_0x4f47e2)return _0x32baef;return db[_0x2895('0x82')][_0x2895('0x41')]({'where':{'name':{'$or':[_0x2895('0x83'),_0x2895('0x28')]},'userProfileId':_0x1cc5f6[_0x2895('0x26')][_0x2895('0x79')]},'raw':!![]})[_0x2895('0x22')](function(_0x3124db){if(_['isEmpty'](_0x3124db)||!_[_0x2895('0x7e')](_0x3124db,[_0x2895('0x7b'),0x0]))return _0x32baef;_0x198c58=[];var _0x3122e1=_(_0x3124db)['map'](function(_0x4a3730){if(_0x4a3730[_0x2895('0x7b')]===0x1)return;return _0x4a3730[_0x2895('0x2f')]==='Agents'?_0x2895('0x27'):'telephone';})[_0x2895('0x84')]()[_0x2895('0x2c')]();for(var _0x35c735=0x0;_0x35c735<_0x32baef[_0x2895('0x45')];_0x35c735++){if(!_[_0x2895('0x2d')](_0x3122e1,_0x32baef[_0x35c735][_0x2895('0x24')]))return;var _0x28f401=_0x32baef[_0x35c735]['role']===_0x2895('0x27')?_0x2895('0x83'):'Telephones';_0x198c58[_0x2895('0x40')](db[_0x2895('0x7c')]['create']({'name':_0x32baef[_0x35c735][_0x2895('0x2f')],'resourceId':_0x32baef[_0x35c735]['id'],'type':_0x28f401,'sectionId':_[_0x2895('0x2e')](_0x3124db,[_0x2895('0x2f'),_0x28f401])['id']},{}));}return BPromise[_0x2895('0x4c')](_0x198c58);});})[_0x2895('0x22')](respondWithResult(_0x5d5048,0xc9))[_0x2895('0x19')](handleError(_0x5d5048,null));};exports[_0x2895('0x85')]=function(_0x8de9e6,_0xdbd16a){if(_0x8de9e6[_0x2895('0x56')]['id']){delete _0x8de9e6[_0x2895('0x56')]['id'];}return db[_0x2895('0x33')][_0x2895('0x2e')]({'where':{'id':_0x8de9e6[_0x2895('0x4e')]['id']}})['then'](function(_0x257949){if(!_0x257949)return null;if(_0x257949['id']===_0x8de9e6[_0x2895('0x26')]['id']){if(!_0x8de9e6[_0x2895('0x56')][_0x2895('0x86')]||!_0x8de9e6[_0x2895('0x56')][_0x2895('0x87')]){throw new db[(_0x2895('0x88'))]['ValidationError'](_0x2895('0x89'));}if(!_0x257949['authenticate'](_0x8de9e6[_0x2895('0x56')]['oldPassword'])){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x8b'));}if(_0x8de9e6[_0x2895('0x56')][_0x2895('0x86')]===_0x8de9e6['body'][_0x2895('0x87')]){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x8c'));}}else if(_0x8de9e6[_0x2895('0x26')][_0x2895('0x24')]===_0x2895('0x76')){if(!_0x8de9e6['body'][_0x2895('0x87')]){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x8d'));}}else if(_0x8de9e6['user'][_0x2895('0x24')]===_0x2895('0x26')){if(!_0x8de9e6[_0x2895('0x56')]['newPassword']){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x8d'));}if(_0x257949[_0x2895('0x24')]!==_0x2895('0x27')){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x75'));}}else{throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x75'));}return _0x257949;})[_0x2895('0x22')](handleEntityNotFound(_0xdbd16a,null))[_0x2895('0x22')](function(_0x1bdcde){return db[_0x2895('0x5b')][_0x2895('0x8e')]({'attributes':['id',_0x2895('0x5d'),_0x2895('0x8f'),_0x2895('0x90')]})['then'](function(_0x5e1f3c){if(_0x5e1f3c[_0x2895('0x5d')])authService[_0x2895('0x5e')](_0x8de9e6[_0x2895('0x56')][_0x2895('0x87')]);if(!_0x5e1f3c[_0x2895('0x8f')]||!_0x1bdcde[_0x2895('0x91')])return _0x1bdcde;authService['validatePasswordHistory'](_0x8de9e6['body']['newPassword'],_0x1bdcde[_0x2895('0x91')],_0x5e1f3c['passwordHistoryLimit']);return _0x1bdcde;})[_0x2895('0x22')](saveUpdates({'password':_0x8de9e6[_0x2895('0x56')][_0x2895('0x87')],'passwordResetAt':_0x8de9e6['user']['id']==_0x8de9e6[_0x2895('0x4e')]['id']?moment():null,'previousPasswords':authService[_0x2895('0x92')](_0x8de9e6[_0x2895('0x56')]['newPassword'],_0x1bdcde[_0x2895('0x91')])},null));})[_0x2895('0x22')](respondWithResult(_0xdbd16a,null))[_0x2895('0x19')](handleError(_0xdbd16a,null));};exports[_0x2895('0x93')]=function(_0x2187ce,_0x175202){var _0x34d49e=_0x2187ce[_0x2895('0x56')]['channel'];return db[_0x2895('0x33')][_0x2895('0x2e')]({'where':{'id':_0x2187ce[_0x2895('0x4e')]['id']},'attributes':['id',_0x2895('0x2f'),'role','online',_0x2895('0x94'),_0x2895('0x95'),_0x2895('0x96')]})[_0x2895('0x22')](handleEntityNotFound(_0x175202,null))[_0x2895('0x22')](function(_0x368a30){if(_0x368a30){if(!utils['isValidChannel'](_0x34d49e)){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x97'));}return _0x368a30[_0x2895('0x98')+_['capitalize'](_0x34d49e[_0x2895('0x99')]())+'Queues'](_0x2187ce['body']['ids'],{'penalty':_0x2187ce[_0x2895('0x56')]['penalty']||0x0})['spread'](function(_0x57b6ad){for(var _0x550d9a=0x0;_0x550d9a<_0x2187ce['body'][_0x2895('0x59')][_0x2895('0x45')];_0x550d9a+=0x1){var _0x25969b={'UserId':Number(_0x2187ce[_0x2895('0x4e')]['id'])};_0x25969b[_['capitalize'](_0x34d49e['toLowerCase']())+'QueueId']=Number(_0x2187ce[_0x2895('0x56')][_0x2895('0x59')][_0x550d9a]);socket[_0x2895('0x9a')](_0x2895('0x26')+_[_0x2895('0x9b')](_0x34d49e[_0x2895('0x99')]())+_0x2895('0x9c'),_0x25969b);}return _0x57b6ad;})[_0x2895('0x22')](function(){if(_0x34d49e==='voice'){return db[_0x2895('0x9d')][_0x2895('0x41')]({'where':{'id':_0x2187ce[_0x2895('0x56')]['ids']||[]},'raw':!![],'attributes':['id',_0x2895('0x2f')]});}})['then'](function(_0x15824e){var _0x2704a8=_0x368a30[_0x2895('0x23')]({'plain':!![]});var _0x1e7e56=[];if(_0x34d49e==='voice'&&_0x2704a8[_0x2895('0x24')]===_0x2895('0x27')&&_0x2704a8[_0x2895('0x9e')]){for(var _0x3fb18a=0x0;_0x3fb18a<_0x15824e[_0x2895('0x45')];_0x3fb18a+=0x1){_0x1e7e56['push']({'membername':_0x2704a8[_0x2895('0x2f')],'UserId':_0x2704a8['id'],'queue_name':_0x15824e[_0x3fb18a][_0x2895('0x2f')],'VoiceQueueId':_0x15824e[_0x3fb18a]['id'],'interface':_[_0x2895('0x61')](_0x2704a8[_0x2895('0x96')])?util[_0x2895('0x9f')](_0x2895('0xa0'),_0x2704a8['name']):_0x2704a8['interface'],'paused':_0x2704a8['voicePause']||![],'penalty':_0x2187ce[_0x2895('0x56')][_0x2895('0xa1')]||0x0});}return BPromise[_0x2895('0x81')](_0x1e7e56,function(_0x33a183){return db[_0x2895('0xa2')][_0x2895('0xa3')](_0x33a183);});}return _0x368a30;});}})[_0x2895('0x22')](respondWithStatusCode(_0x175202,null))[_0x2895('0x19')](handleError(_0x175202,null));};exports[_0x2895('0xa4')]=function(_0x451846,_0x168143){var _0x4eadd2;return db[_0x2895('0x33')]['find']({'where':{'id':_0x451846[_0x2895('0x4e')]['id']},'attributes':['id','name',_0x2895('0x24')]})[_0x2895('0x22')](handleEntityNotFound(_0x168143,null))['then'](function(_0x5eaa6c){if(_0x5eaa6c){_0x4eadd2=_0x5eaa6c;if(!_0x451846[_0x2895('0x3c')][_0x2895('0xa5')]||!utils[_0x2895('0xa6')](_0x451846[_0x2895('0x3c')][_0x2895('0xa5')])){throw new db[(_0x2895('0x88'))][(_0x2895('0x8a'))](_0x2895('0x97'));}return _0x5eaa6c[_0x2895('0xa7')+_[_0x2895('0x9b')](_0x451846[_0x2895('0x3c')][_0x2895('0xa5')][_0x2895('0x99')]())+_0x2895('0xa8')](_0x451846['query']['ids']);}})[_0x2895('0x22')](function(_0x4fc4bb){if(_[_0x2895('0xa9')](_0x451846[_0x2895('0x3c')][_0x2895('0x59')])){for(var _0xc48d94=0x0;_0xc48d94<_0x451846[_0x2895('0x3c')][_0x2895('0x59')][_0x2895('0x45')];_0xc48d94+=0x1){var _0x32edce={'UserId':Number(_0x451846[_0x2895('0x4e')]['id'])};_0x32edce[_[_0x2895('0x9b')](_0x451846['query'][_0x2895('0xa5')][_0x2895('0x99')]())+_0x2895('0xaa')]=Number(_0x451846['query'][_0x2895('0x59')][_0xc48d94]);socket[_0x2895('0x9a')](_0x2895('0x26')+_[_0x2895('0x9b')](_0x451846['query']['channel']['toLowerCase']())+_0x2895('0xab'),_0x32edce);}}else{var _0x32edce={'UserId':Number(_0x451846[_0x2895('0x4e')]['id'])};_0x32edce[_['capitalize'](_0x451846['query'][_0x2895('0xa5')]['toLowerCase']())+_0x2895('0xaa')]=Number(_0x451846[_0x2895('0x3c')]['ids']);socket[_0x2895('0x9a')](_0x2895('0x26')+_[_0x2895('0x9b')](_0x451846['query'][_0x2895('0xa5')][_0x2895('0x99')]())+_0x2895('0xab'),_0x32edce);}return _0x4fc4bb;})[_0x2895('0x22')](function(){if(_0x451846[_0x2895('0x3c')][_0x2895('0xa5')]===_0x2895('0xac')){return db['UserVoiceQueueRt'][_0x2895('0x21')]({'where':{'UserId':_0x451846[_0x2895('0x4e')]['id'],'VoiceQueueId':_0x451846['query'][_0x2895('0x59')]},'individualHooks':!![]})[_0x2895('0x22')](function(){return _0x4eadd2;});}return _0x4eadd2;})['then'](respondWithStatusCode(_0x168143,null))[_0x2895('0x19')](handleError(_0x168143,null));};exports[_0x2895('0xad')]=function(_0x454b83,_0x8cc03f){_0x454b83[_0x2895('0x56')]['userpic']=_0x454b83[_0x2895('0xae')]['filename'];return db[_0x2895('0x33')][_0x2895('0x2e')]({'where':{'id':_0x454b83['params']['id']}})['then'](handleEntityNotFound(_0x8cc03f,null))[_0x2895('0x22')](saveUpdates(_0x454b83[_0x2895('0x56')],null))[_0x2895('0x22')](respondWithResult(_0x8cc03f,null))['catch'](handleError(_0x8cc03f,null));};exports['getAvatar']=function(_0x51af9c,_0x3f852e){var _0x2e67e4=path[_0x2895('0xaf')](config[_0x2895('0xb0')],_0x2895('0xb1'));return db[_0x2895('0x33')][_0x2895('0x2e')]({'where':{'id':_0x51af9c['params']['id']},'attributes':['id',_0x2895('0xb2')],'raw':!![]})['then'](handleEntityNotFound(_0x3f852e,null))['then'](function(_0x563471){if(_0x563471){if(_[_0x2895('0x61')](_0x563471[_0x2895('0xb2')])){return _0x3f852e[_0x2895('0xb3')](_0x2e67e4);}else{if(!fs['existsSync'](path[_0x2895('0xaf')](config[_0x2895('0xb0')],_0x2895('0xb4'),_0x563471[_0x2895('0xb2')]))){return _0x3f852e[_0x2895('0xb3')](_0x2e67e4);}return _0x3f852e['download'](path[_0x2895('0xaf')](config[_0x2895('0xb0')],_0x2895('0xb4'),_0x563471['userpic']));}}})[_0x2895('0x19')](handleError(_0x3f852e,null));};exports[_0x2895('0xb5')]=function(_0x499295,_0xd3093d){return db[_0x2895('0x33')][_0x2895('0x2e')]({'where':{'id':_0x499295['params']['id']},'attributes':['id']})[_0x2895('0x22')](handleEntityNotFound(_0xd3093d,null))[_0x2895('0x22')](function(_0xbf4385){var _0x94c789=[];values=_0xbf4385[_0x2895('0x48')];_0x94c789[_0x2895('0x40')](get_open_tabs(_0x2895('0x46'),_0xbf4385['dataValues']));_0x94c789[_0x2895('0x40')](get_open_tabs(_0x2895('0x47'),_0xbf4385[_0x2895('0x48')]));_0x94c789['push'](get_open_tabs(_0x2895('0x4b'),_0xbf4385['dataValues']));_0x94c789['push'](get_open_tabs(_0x2895('0xb6'),_0xbf4385['dataValues']));_0x94c789[_0x2895('0x40')](get_open_tabs(_0x2895('0x49'),_0xbf4385[_0x2895('0x48')]));_0x94c789['push'](get_open_tabs('mail',_0xbf4385[_0x2895('0x48')]));return BPromise['all'](_0x94c789);})[_0x2895('0x22')](function(_0x1f089f){var _0x36af1b=[];if(_0x1f089f){for(var _0x41db95=0x0;_0x41db95=_0x1349c9){_0x4f6877=_0x1349c9;_0x3aa0bd=0xc8;}else{_0x3aa0bd=0xce;}_0x540020[_0x2254('0x25')](_0x3aa0bd);return _0x540020['set'](_0x2254('0x26'),_0x4a8274+'-'+_0x4f6877+'/'+_0x1349c9)[_0x2254('0x27')](_0x4f797d);}return null;};}function saveUpdates(_0x21285d){return function(_0x37af8b){if(_0x37af8b){return _0x37af8b[_0x2254('0x28')](_0x21285d)[_0x2254('0x15')](function(_0x3214a7){return _0x3214a7;});}return null;};}function removeEntity(_0x22e791){return function(_0x29975f){if(_0x29975f){return _0x29975f[_0x2254('0x29')]()[_0x2254('0x15')](function(){var _0xad7774=_0x29975f[_0x2254('0x2a')]({'plain':!![]});if(_0xad7774[_0x2254('0x2b')]===_0x2254('0x2c'))return;var _0x1b16c8=[{'name':_0x2254('0x2d'),'value':_0x2254('0x2e'),'ignore':!![]},{'name':_0x2254('0x2f'),'value':'agent','ignore':![]},{'name':_0x2254('0x30'),'value':_0x2254('0x31'),'ignore':![]}];var _0x765e8e=_(_0x1b16c8)[_0x2254('0x32')](_0x2254('0x33'))[_0x2254('0x34')](_0x2254('0x35'))[_0x2254('0x35')]();if(_[_0x2254('0x36')](_0x765e8e,_0xad7774['role'])){return;}var _0x835a0e=_[_0x2254('0x37')](_0x1b16c8,['value',_0xad7774[_0x2254('0x2b')]])[_0x2254('0x38')];return db[_0x2254('0x39')][_0x2254('0x29')]({'where':{'type':_0x835a0e,'resourceId':_0xad7774['id']}})['then'](function(){return _0x29975f;});})['then'](function(){_0x22e791[_0x2254('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d620a){return function(_0x10d749){if(!_0x10d749){_0x3d620a[_0x2254('0x3a')](0x194);}return _0x10d749;};}function handleError(_0x141ddc,_0x12428a){_0x12428a=_0x12428a||0x1f4;return function(_0x2707f4){logger[_0x2254('0x1a')](_0x2707f4['stack']);if(_0x2707f4[_0x2254('0x38')]){delete _0x2707f4[_0x2254('0x38')];}_0x141ddc[_0x2254('0x25')](_0x12428a)[_0x2254('0x3b')](_0x2707f4);};}exports[_0x2254('0x3c')]=function(_0x3f6007,_0x3e7ccb){var _0x24744a={},_0x122314={'count':0x0,'rows':[]};var _0x34543d=_(db['User'][_0x2254('0x3d')])[_0x2254('0x34')](function(_0x31d845){return{'name':_0x31d845[_0x2254('0x3e')],'type':_0x31d845['type'][_0x2254('0x3f')]};})[_0x2254('0x32')](function(_0x457625){return!_[_0x2254('0x36')]([_0x2254('0x40'),_0x2254('0x41')],_0x457625[_0x2254('0x38')]);})[_0x2254('0x35')]();_0x24744a=qs['getOptions'](_0x34543d,_0x3f6007);var _0x362ad1={'where':_0x24744a['where']};return db[_0x2254('0x42')][_0x2254('0x24')](_0x362ad1)[_0x2254('0x15')](function(_0x9f142b){_0x122314[_0x2254('0x24')]=_0x9f142b;if(_0x3f6007[_0x2254('0x43')][_0x2254('0x44')]){_0x24744a['include']=[{'all':!![]}];}if(!_[_0x2254('0x36')](_0x24744a[_0x2254('0x45')],'id')){_0x24744a[_0x2254('0x45')][_0x2254('0x46')]('id');}return db[_0x2254('0x42')]['findAll'](_0x24744a);})[_0x2254('0x15')](function(_0x1dec43){_0x122314[_0x2254('0x47')]=_0x1dec43;if(_0x3f6007[_0x2254('0x43')][_0x2254('0x48')]==='true'){var _0x12a227=[];for(var _0x47c933=0x0;_0x47c933<_0x122314[_0x2254('0x47')][_0x2254('0x49')];_0x47c933++){_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x4a'),_0x122314[_0x2254('0x47')][_0x47c933][_0x2254('0x4b')]));_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x4c'),_0x122314[_0x2254('0x47')][_0x47c933][_0x2254('0x4b')]));_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x4d'),_0x122314[_0x2254('0x47')][_0x47c933]['dataValues']));_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x4e'),_0x122314[_0x2254('0x47')][_0x47c933]['dataValues']));_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x4f'),_0x122314[_0x2254('0x47')][_0x47c933][_0x2254('0x4b')]));_0x12a227[_0x2254('0x46')](get_open_tabs(_0x2254('0x50'),_0x122314[_0x2254('0x47')][_0x47c933][_0x2254('0x4b')]));}return BPromise[_0x2254('0x51')](_0x12a227)['then'](function(_0x239ba0){return _0x122314;});}else{return _0x122314;}})[_0x2254('0x15')](respondWithFilteredResult(_0x3e7ccb,_0x24744a))[_0x2254('0x1f')](handleError(_0x3e7ccb,null));};exports[_0x2254('0x52')]=function(_0xbbc059,_0x1a203e){var _0x3396c2={'raw':![],'where':{'id':_0xbbc059[_0x2254('0x53')]['id']}},_0x438922={};_0x438922[_0x2254('0x54')]=_['differenceBy'](_[_0x2254('0x55')](db[_0x2254('0x42')]['rawAttributes']),[_0x2254('0x40'),_0x2254('0x41')]);_0x438922[_0x2254('0x43')]=_[_0x2254('0x55')](_0xbbc059['query']);_0x438922[_0x2254('0x56')]=_[_0x2254('0x57')](_0x438922['model'],_0x438922[_0x2254('0x43')]);_0x3396c2[_0x2254('0x45')]=_[_0x2254('0x57')](_0x438922[_0x2254('0x54')],qs['fields'](_0xbbc059[_0x2254('0x43')][_0x2254('0x58')]));_0x3396c2[_0x2254('0x45')]=_0x3396c2['attributes']['length']?_0x3396c2[_0x2254('0x45')]:_0x438922[_0x2254('0x54')];if(_0xbbc059['query'][_0x2254('0x44')]){_0x3396c2['include']=[{'all':!![]}];}_0x3396c2=_['merge']({},_0x3396c2,_0xbbc059[_0x2254('0x59')]);if(!_[_0x2254('0x36')](_0x3396c2[_0x2254('0x45')],'id')){_0x3396c2[_0x2254('0x45')][_0x2254('0x46')]('id');}return db['User']['find'](_0x3396c2)[_0x2254('0x15')](handleEntityNotFound(_0x1a203e,null))['then'](function(_0x10a8db){var _0x28a7c6=[];values=_0x10a8db;if(_0xbbc059[_0x2254('0x43')][_0x2254('0x48')]==='true'){_0x28a7c6[_0x2254('0x46')](get_open_tabs(_0x2254('0x4a'),_0x10a8db['dataValues']));_0x28a7c6['push'](get_open_tabs(_0x2254('0x4c'),_0x10a8db['dataValues']));_0x28a7c6[_0x2254('0x46')](get_open_tabs(_0x2254('0x4f'),_0x10a8db[_0x2254('0x4b')]));_0x28a7c6[_0x2254('0x46')](get_open_tabs(_0x2254('0x50'),_0x10a8db['dataValues']));_0x28a7c6['push'](get_open_tabs(_0x2254('0x4d'),_0x10a8db['dataValues']));_0x28a7c6[_0x2254('0x46')](get_open_tabs('mail',_0x10a8db['dataValues']));return BPromise['all'](_0x28a7c6);}else{return values;}})[_0x2254('0x15')](function(_0x448773){return values;})[_0x2254('0x15')](respondWithResult(_0x1a203e,null))[_0x2254('0x1f')](handleError(_0x1a203e,null));};exports[_0x2254('0x28')]=function(_0x1cf757,_0x14b1ba){if(_0x1cf757[_0x2254('0x5a')]['id']){delete _0x1cf757[_0x2254('0x5a')]['id'];}delete _0x1cf757[_0x2254('0x5a')][_0x2254('0x2b')];return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x1cf757[_0x2254('0x53')]['id']}})[_0x2254('0x15')](handleEntityNotFound(_0x14b1ba,null))[_0x2254('0x15')](saveUpdates(_0x1cf757[_0x2254('0x5a')],null))[_0x2254('0x15')](respondWithResult(_0x14b1ba,null))[_0x2254('0x1f')](handleError(_0x14b1ba,null));};exports['describe']=function(_0x329378,_0xae171c){return db[_0x2254('0x42')][_0x2254('0x5b')]()['then'](respondWithResult(_0xae171c,null))['catch'](handleError(_0xae171c,null));};exports[_0x2254('0x5c')]=function(_0x423c17,_0x1d73a3){return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x423c17['params']['id']}})[_0x2254('0x15')](handleEntityNotFound(_0x1d73a3,null))[_0x2254('0x15')](function(_0x639396){if(_0x639396){return _0x639396['addContacts'](_0x423c17['body'][_0x2254('0x5d')],_['omit'](_0x423c17[_0x2254('0x5a')],[_0x2254('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x1d73a3,null))[_0x2254('0x1f')](handleError(_0x1d73a3,null));};function validateUser(_0x1b154f){return new BPromise(function(_0x4d30a5,_0x1288b5){if(_0x1b154f[_0x2254('0x5e')])return _0x4d30a5(_0x1b154f);return db['Setting']['findById'](0x1)[_0x2254('0x15')](function(_0xa159a4){if(_0xa159a4['securePassword'])authService['validatePasswordPattern'](_0x1b154f[_0x2254('0x40')]);db['User'][_0x2254('0x5f')]('internal')[_0x2254('0x15')](function(_0x7bdd46){if(_[_0x2254('0x60')](_0x7bdd46)){_0x1b154f[_0x2254('0x5e')]=_0xa159a4['min_internal']||0x1;return;}if(_[_0x2254('0x60')](_0xa159a4['min_internal'])||_0xa159a4[_0x2254('0x61')]===_0x7bdd46){_0x1b154f[_0x2254('0x5e')]=_0x7bdd46+0x1;return;}if(_0xa159a4['min_internal']>_0x7bdd46){_0x1b154f[_0x2254('0x5e')]=_0xa159a4[_0x2254('0x61')];return;}return db['sequelize'][_0x2254('0x43')](_0x2254('0x62'),{'type':db[_0x2254('0x63')][_0x2254('0x64')]['SELECT']})[_0x2254('0x15')](function(_0x301db7){if(_0x301db7&&_0x301db7['length']){for(var _0x1ac8ff=0x0,_0x4469c7=_0x301db7['length'];_0x1ac8ff<_0x4469c7&&_[_0x2254('0x60')](_0x1b154f['internal']);_0x1ac8ff++){if(_0xa159a4[_0x2254('0x61')]<=_0x301db7[_0x1ac8ff]['from']){_0x1b154f[_0x2254('0x5e')]=_0x301db7[_0x1ac8ff][_0x2254('0x65')];}else if(_0xa159a4['min_internal']>_0x301db7[_0x1ac8ff][_0x2254('0x65')]&&_0xa159a4['min_internal']<=_0x301db7[_0x1ac8ff]['to']){_0x1b154f[_0x2254('0x5e')]=_0xa159a4[_0x2254('0x61')];}}}if(_[_0x2254('0x60')](_0x1b154f['internal'])){_0x1b154f[_0x2254('0x5e')]=_0x7bdd46+0x1;}return _0x4d30a5(_0x1b154f);});});})['catch'](function(_0x30966){_0x1288b5(_0x30966);});});}function updateUser(_0x33f29b){return new BPromise(function(_0x4d4891,_0x58d475){try{if(_0x33f29b[_0x2254('0x66')]){_0x33f29b[_0x2254('0x67')]=_0x33f29b[_0x2254('0x5e')];_0x33f29b[_0x2254('0x68')]={'mailbox':_0x33f29b['internal'],'password':_0x33f29b[_0x2254('0x40')],'fullname':_0x33f29b[_0x2254('0x69')],'email':_0x33f29b[_0x2254('0x6a')]};}if(_0x33f29b[_0x2254('0x2b')]==='agent'){if(!_0x33f29b[_0x2254('0x6b')])_0x33f29b[_0x2254('0x6b')]=['101',_0x2254('0x6c'),'103',_0x2254('0x6d'),'110','104','105',_0x2254('0x6e'),'107',_0x2254('0x6f'),_0x2254('0x70'),'100',_0x2254('0x71'),_0x2254('0x72'),_0x2254('0x73')];}_0x4d4891(_0x33f29b);}catch(_0x1a7c04){_0x58d475(_0x1a7c04);}});}exports[_0x2254('0x74')]=function(_0x2ed18e,_0x523b10){if(_0x2ed18e['user'][_0x2254('0x2b')]===_0x2254('0x75'))throw new Error(_0x2254('0x76'));if(_0x2ed18e[_0x2254('0x5a')][_0x2254('0x2b')]===_0x2254('0x2e')&&_0x2ed18e[_0x2254('0x2e')][_0x2254('0x2b')]!==_0x2254('0x2c')){throw new Error(_0x2254('0x77'));}if(_0x2ed18e['body'][_0x2254('0x2b')]===_0x2254('0x2c')&&_0x2ed18e['user'][_0x2254('0x2b')]!=='admin'){throw new Error(_0x2254('0x78'));}return licenseUtil[_0x2254('0x79')]([_0x2ed18e['body']])[_0x2254('0x15')](function(){return validateUser(_0x2ed18e['body']);})[_0x2254('0x15')](function(_0x2f66ba){return updateUser(_0x2f66ba)[_0x2254('0x15')](function(_0x1f7a48){if(_0x1f7a48['role']===_0x2254('0x2c')){_0x1f7a48[_0x2254('0x7a')]=_0x2ed18e[_0x2254('0x2e')][_0x2254('0x7a')];delete _0x1f7a48['userProfileId'];}return _0x1f7a48;});})[_0x2254('0x15')](function(_0x480eeb){return db['User'][_0x2254('0x74')](_0x480eeb,{'include':[{'model':db[_0x2254('0x68')],'as':'VoiceMail'}]});})['then'](function(_0x1f29ec){if(_0x2ed18e[_0x2254('0x5a')][_0x2254('0x2b')]===_0x2254('0x2e'))return _0x1f29ec;if(_0x2ed18e[_0x2254('0x2e')][_0x2254('0x2b')]!==_0x2254('0x2e'))return _0x1f29ec;return db[_0x2254('0x7b')][_0x2254('0x37')]({'where':{'name':_0x1f29ec['role']===_0x2254('0x75')?'Agents':_0x2254('0x30'),'userProfileId':_0x2ed18e['user'][_0x2254('0x7c')]},'raw':!![]})[_0x2254('0x15')](function(_0x2b0a45){if(!_0x2b0a45||_0x2b0a45['autoAssociation']!=0x0)return _0x1f29ec;return db[_0x2254('0x39')][_0x2254('0x74')]({'name':_0x1f29ec[_0x2254('0x38')],'resourceId':_0x1f29ec['id'],'type':_0x2b0a45[_0x2254('0x38')],'sectionId':_0x2b0a45['id']},{})[_0x2254('0x15')](function(){return _0x1f29ec;});})[_0x2254('0x1f')](function(_0x4783ab){logger[_0x2254('0x1a')](_0x2254('0x7d'),_0x4783ab);throw _0x4783ab;});})[_0x2254('0x15')](respondWithResult(_0x523b10,0xc9))[_0x2254('0x1f')](handleError(_0x523b10,null));};exports[_0x2254('0x7e')]=function(_0x70c30,_0x557e75){var _0x806221=_0x70c30['body'];var _0x64c4f5=[];if(_0x70c30[_0x2254('0x2e')][_0x2254('0x2b')]===_0x2254('0x75'))throw new Error(_0x2254('0x76'));if(_[_0x2254('0x7f')](_0x806221,[_0x2254('0x2b'),'user'])&&_0x70c30[_0x2254('0x2e')]['role']!==_0x2254('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2254('0x7f')](_0x806221,[_0x2254('0x2b'),_0x2254('0x2c')])&&_0x70c30['user'][_0x2254('0x2b')]!==_0x2254('0x2c')){throw new Error(_0x2254('0x80'));}return licenseUtil[_0x2254('0x79')](_0x806221)[_0x2254('0x15')](function(){return validateUser(_0x806221[0x0]);})[_0x2254('0x15')](function(){for(var _0x34185c=0x1;_0x34185c<_0x806221[_0x2254('0x49')];_0x34185c++){var _0x5e94b6=_0x806221[_0x34185c-0x1]['internal'];if(!_0x806221[_0x34185c][_0x2254('0x5e')])_0x806221[_0x34185c]['internal']=_0x5e94b6+0x1;_0x64c4f5[_0x2254('0x46')](validateUser(_0x806221[_0x34185c]));}return BPromise[_0x2254('0x51')](_0x64c4f5);})[_0x2254('0x15')](function(){_0x64c4f5=[];for(var _0x438c95=0x0;_0x438c95<_0x806221[_0x2254('0x49')];_0x438c95++){_0x64c4f5[_0x2254('0x46')](updateUser(_0x806221[_0x438c95]));}return BPromise[_0x2254('0x51')](_0x64c4f5);})['then'](function(){return BPromise[_0x2254('0x81')](_0x806221,function(_0x34ac83){return db[_0x2254('0x42')]['create'](_0x34ac83,{'include':[{'model':db[_0x2254('0x68')],'as':_0x2254('0x68')}]})[_0x2254('0x15')](function(_0x1426d6){_0x34ac83['id']=_0x1426d6['id'];return _0x34ac83;});});})[_0x2254('0x15')](function(_0x37ddcc){if(_0x70c30[_0x2254('0x5a')][_0x2254('0x2b')]===_0x2254('0x2e'))return _0x37ddcc;if(_0x70c30['user'][_0x2254('0x2b')]!==_0x2254('0x2e'))return _0x37ddcc;var _0x590b46=_['some'](_0x37ddcc,function(_0x30aa5c){return _0x30aa5c['role']===_0x2254('0x75')||_0x30aa5c[_0x2254('0x2b')]===_0x2254('0x31');});if(!_0x590b46)return _0x37ddcc;return db[_0x2254('0x7b')][_0x2254('0x82')]({'where':{'name':{'$or':[_0x2254('0x2f'),_0x2254('0x30')]},'userProfileId':_0x70c30[_0x2254('0x2e')]['userProfileId']},'raw':!![]})['then'](function(_0x2f74e4){if(_[_0x2254('0x83')](_0x2f74e4)||!_[_0x2254('0x7f')](_0x2f74e4,[_0x2254('0x84'),0x0]))return _0x37ddcc;_0x64c4f5=[];var _0x201da7=_(_0x2f74e4)['map'](function(_0x573b62){if(_0x573b62[_0x2254('0x84')]===0x1)return;return _0x573b62['name']===_0x2254('0x2f')?_0x2254('0x75'):_0x2254('0x31');})[_0x2254('0x85')]()[_0x2254('0x35')]();for(var _0x331cfc=0x0;_0x331cfc<_0x37ddcc[_0x2254('0x49')];_0x331cfc++){if(!_['includes'](_0x201da7,_0x37ddcc[_0x331cfc][_0x2254('0x2b')]))return;var _0x30e919=_0x37ddcc[_0x331cfc]['role']===_0x2254('0x75')?_0x2254('0x2f'):_0x2254('0x30');_0x64c4f5[_0x2254('0x46')](db[_0x2254('0x39')][_0x2254('0x74')]({'name':_0x37ddcc[_0x331cfc][_0x2254('0x38')],'resourceId':_0x37ddcc[_0x331cfc]['id'],'type':_0x30e919,'sectionId':_[_0x2254('0x37')](_0x2f74e4,[_0x2254('0x38'),_0x30e919])['id']},{}));}return BPromise[_0x2254('0x51')](_0x64c4f5);});})[_0x2254('0x15')](respondWithResult(_0x557e75,0xc9))['catch'](handleError(_0x557e75,null));};exports[_0x2254('0x86')]=function(_0x38bb67,_0x2c5f98){if(_0x38bb67[_0x2254('0x5a')]['id']){delete _0x38bb67[_0x2254('0x5a')]['id'];}return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x38bb67['params']['id']}})[_0x2254('0x15')](function(_0x3e937a){if(!_0x3e937a)return null;if(_0x3e937a['id']===_0x38bb67[_0x2254('0x2e')]['id']){if(!_0x38bb67['body'][_0x2254('0x87')]||!_0x38bb67[_0x2254('0x5a')][_0x2254('0x88')]){throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))](_0x2254('0x8b'));}if(!_0x3e937a['authenticate'](_0x38bb67[_0x2254('0x5a')][_0x2254('0x87')])){throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))](_0x2254('0x8c'));}if(_0x38bb67['body']['oldPassword']===_0x38bb67[_0x2254('0x5a')]['newPassword']){throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))](_0x2254('0x8d'));}}else if(_0x38bb67[_0x2254('0x2e')][_0x2254('0x2b')]===_0x2254('0x2c')){if(!_0x38bb67['body']['newPassword']){throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))](_0x2254('0x8e'));}}else if(_0x38bb67[_0x2254('0x2e')]['role']===_0x2254('0x2e')){if(!_0x38bb67[_0x2254('0x5a')][_0x2254('0x88')]){throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))](_0x2254('0x8e'));}if(_0x3e937a[_0x2254('0x2b')]!==_0x2254('0x75')){throw new db[(_0x2254('0x89'))]['ValidationError'](_0x2254('0x76'));}}else{throw new db[(_0x2254('0x89'))][(_0x2254('0x8a'))]('Unauthorized');}return _0x3e937a;})[_0x2254('0x15')](handleEntityNotFound(_0x2c5f98,null))[_0x2254('0x15')](function(_0x16ca50){return db['Setting']['findOne']({'attributes':['id',_0x2254('0x8f'),_0x2254('0x90'),_0x2254('0x91')]})[_0x2254('0x15')](function(_0x310fb6){if(_0x310fb6[_0x2254('0x8f')])authService[_0x2254('0x92')](_0x38bb67[_0x2254('0x5a')]['newPassword']);if(!_0x310fb6[_0x2254('0x90')]||!_0x16ca50[_0x2254('0x93')])return _0x16ca50;authService[_0x2254('0x94')](_0x38bb67[_0x2254('0x5a')][_0x2254('0x88')],_0x16ca50[_0x2254('0x93')],_0x310fb6['passwordHistoryLimit']);return _0x16ca50;})['then'](saveUpdates({'password':_0x38bb67[_0x2254('0x5a')]['newPassword'],'passwordResetAt':_0x38bb67['user']['id']==_0x38bb67[_0x2254('0x53')]['id']?moment():null,'previousPasswords':authService[_0x2254('0x95')](_0x38bb67[_0x2254('0x5a')][_0x2254('0x88')],_0x16ca50['previousPasswords'])},null));})['then'](respondWithResult(_0x2c5f98,null))[_0x2254('0x1f')](handleError(_0x2c5f98,null));};exports[_0x2254('0x96')]=function(_0x1cd8f8,_0x57700b){var _0x181f4a=_0x1cd8f8[_0x2254('0x5a')][_0x2254('0x97')];return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x1cd8f8[_0x2254('0x53')]['id']},'attributes':['id',_0x2254('0x38'),'role',_0x2254('0x98'),_0x2254('0x99'),_0x2254('0x9a'),_0x2254('0x9b')]})[_0x2254('0x15')](handleEntityNotFound(_0x57700b,null))[_0x2254('0x15')](function(_0x21fac0){if(_0x21fac0){if(!utils[_0x2254('0x9c')](_0x181f4a)){throw new db[(_0x2254('0x89'))]['ValidationError'](_0x2254('0x9d'));}return _0x21fac0[_0x2254('0x9e')+_[_0x2254('0x9f')](_0x181f4a[_0x2254('0xa0')]())+_0x2254('0xa1')](_0x1cd8f8[_0x2254('0x5a')]['ids'],{'penalty':_0x1cd8f8['body'][_0x2254('0xa2')]||0x0})['spread'](function(_0x34a26a){for(var _0x1ebf1f=0x0;_0x1ebf1f<_0x1cd8f8[_0x2254('0x5a')][_0x2254('0x5d')]['length'];_0x1ebf1f+=0x1){var _0x3cba5c={'UserId':Number(_0x1cd8f8[_0x2254('0x53')]['id'])};_0x3cba5c[_[_0x2254('0x9f')](_0x181f4a['toLowerCase']())+'QueueId']=Number(_0x1cd8f8[_0x2254('0x5a')]['ids'][_0x1ebf1f]);socket[_0x2254('0xa3')](_0x2254('0x2e')+_[_0x2254('0x9f')](_0x181f4a['toLowerCase']())+'Queue:save',_0x3cba5c);}return _0x34a26a;})[_0x2254('0x15')](function(){if(_0x181f4a===_0x2254('0xa4')){return db[_0x2254('0xa5')][_0x2254('0x82')]({'where':{'id':_0x1cd8f8[_0x2254('0x5a')]['ids']||[]},'raw':!![],'attributes':['id',_0x2254('0x38')]});}})[_0x2254('0x15')](function(_0x10d356){var _0x5d373=_0x21fac0[_0x2254('0x2a')]({'plain':!![]});var _0x30b354=[];if(_0x181f4a==='voice'&&_0x5d373[_0x2254('0x2b')]===_0x2254('0x75')&&_0x5d373['online']){for(var _0x3490aa=0x0;_0x3490aa<_0x10d356['length'];_0x3490aa+=0x1){_0x30b354[_0x2254('0x46')]({'membername':_0x5d373[_0x2254('0x38')],'UserId':_0x5d373['id'],'queue_name':_0x10d356[_0x3490aa]['name'],'VoiceQueueId':_0x10d356[_0x3490aa]['id'],'interface':_[_0x2254('0x60')](_0x5d373[_0x2254('0x9b')])?util[_0x2254('0xa6')](_0x2254('0xa7'),_0x5d373[_0x2254('0x38')]):_0x5d373[_0x2254('0x9b')],'paused':_0x5d373[_0x2254('0x9a')]||![],'penalty':_0x1cd8f8[_0x2254('0x5a')][_0x2254('0xa2')]||0x0});}return BPromise[_0x2254('0x81')](_0x30b354,function(_0x46259e){return db[_0x2254('0xa8')][_0x2254('0xa9')](_0x46259e);});}return _0x21fac0;});}})[_0x2254('0x15')](respondWithStatusCode(_0x57700b,null))['catch'](handleError(_0x57700b,null));};exports[_0x2254('0xaa')]=function(_0x4019fb,_0x52ba52){var _0x4e072b;return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x4019fb[_0x2254('0x53')]['id']},'attributes':['id',_0x2254('0x38'),'role']})[_0x2254('0x15')](handleEntityNotFound(_0x52ba52,null))['then'](function(_0x5042be){if(_0x5042be){_0x4e072b=_0x5042be;if(!_0x4019fb[_0x2254('0x43')][_0x2254('0x97')]||!utils[_0x2254('0x9c')](_0x4019fb[_0x2254('0x43')]['channel'])){throw new db[(_0x2254('0x89'))]['ValidationError'](_0x2254('0x9d'));}return _0x5042be[_0x2254('0xab')+_[_0x2254('0x9f')](_0x4019fb[_0x2254('0x43')][_0x2254('0x97')][_0x2254('0xa0')]())+_0x2254('0xa1')](_0x4019fb[_0x2254('0x43')][_0x2254('0x5d')]);}})[_0x2254('0x15')](function(_0x193809){if(_['isArray'](_0x4019fb[_0x2254('0x43')][_0x2254('0x5d')])){for(var _0x448322=0x0;_0x448322<_0x4019fb[_0x2254('0x43')][_0x2254('0x5d')][_0x2254('0x49')];_0x448322+=0x1){var _0x21e817={'UserId':Number(_0x4019fb[_0x2254('0x53')]['id'])};_0x21e817[_['capitalize'](_0x4019fb[_0x2254('0x43')][_0x2254('0x97')][_0x2254('0xa0')]())+_0x2254('0xac')]=Number(_0x4019fb[_0x2254('0x43')]['ids'][_0x448322]);socket[_0x2254('0xa3')](_0x2254('0x2e')+_['capitalize'](_0x4019fb[_0x2254('0x43')][_0x2254('0x97')][_0x2254('0xa0')]())+'Queue:remove',_0x21e817);}}else{var _0x21e817={'UserId':Number(_0x4019fb[_0x2254('0x53')]['id'])};_0x21e817[_['capitalize'](_0x4019fb[_0x2254('0x43')][_0x2254('0x97')][_0x2254('0xa0')]())+_0x2254('0xac')]=Number(_0x4019fb['query'][_0x2254('0x5d')]);socket[_0x2254('0xa3')](_0x2254('0x2e')+_[_0x2254('0x9f')](_0x4019fb['query'][_0x2254('0x97')][_0x2254('0xa0')]())+_0x2254('0xad'),_0x21e817);}return _0x193809;})['then'](function(){if(_0x4019fb[_0x2254('0x43')][_0x2254('0x97')]===_0x2254('0xa4')){return db[_0x2254('0xa8')][_0x2254('0x29')]({'where':{'UserId':_0x4019fb[_0x2254('0x53')]['id'],'VoiceQueueId':_0x4019fb[_0x2254('0x43')][_0x2254('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x4e072b;});}return _0x4e072b;})[_0x2254('0x15')](respondWithStatusCode(_0x52ba52,null))[_0x2254('0x1f')](handleError(_0x52ba52,null));};exports['addAvatar']=function(_0x1a1ff3,_0x1f8bc0){_0x1a1ff3[_0x2254('0x5a')][_0x2254('0xae')]=_0x1a1ff3[_0x2254('0xaf')][_0x2254('0xb0')];return db[_0x2254('0x42')]['find']({'where':{'id':_0x1a1ff3[_0x2254('0x53')]['id']}})[_0x2254('0x15')](handleEntityNotFound(_0x1f8bc0,null))[_0x2254('0x15')](saveUpdates(_0x1a1ff3[_0x2254('0x5a')],null))['then'](respondWithResult(_0x1f8bc0,null))[_0x2254('0x1f')](handleError(_0x1f8bc0,null));};exports[_0x2254('0xb1')]=function(_0x19ece2,_0x4fc1b4){var _0x5611e1=path[_0x2254('0xb2')](config[_0x2254('0xb3')],_0x2254('0xb4'));return db[_0x2254('0x42')][_0x2254('0x37')]({'where':{'id':_0x19ece2[_0x2254('0x53')]['id']},'attributes':['id',_0x2254('0xae')],'raw':!![]})[_0x2254('0x15')](handleEntityNotFound(_0x4fc1b4,null))[_0x2254('0x15')](function(_0x285aee){if(_0x285aee){if(_['isNil'](_0x285aee['userpic'])){return _0x4fc1b4[_0x2254('0xb5')](_0x5611e1);}else{if(!fs[_0x2254('0xb6')](path['join'](config['root'],_0x2254('0xb7'),_0x285aee[_0x2254('0xae')]))){return _0x4fc1b4[_0x2254('0xb5')](_0x5611e1);}return _0x4fc1b4['download'](path['join'](config[_0x2254('0xb3')],'server/files/images/',_0x285aee[_0x2254('0xae')]));}}})[_0x2254('0x1f')](handleError(_0x4fc1b4,null));};exports[_0x2254('0xb8')]=function(_0x12c084,_0x3a1db3){return db[_0x2254('0x42')]['find']({'where':{'id':_0x12c084[_0x2254('0x53')]['id']},'attributes':['id']})[_0x2254('0x15')](handleEntityNotFound(_0x3a1db3,null))[_0x2254('0x15')](function(_0xa5db88){var _0x5e7978=[];values=_0xa5db88[_0x2254('0x4b')];_0x5e7978[_0x2254('0x46')](get_open_tabs(_0x2254('0x4a'),_0xa5db88['dataValues']));_0x5e7978['push'](get_open_tabs(_0x2254('0x4c'),_0xa5db88[_0x2254('0x4b')]));_0x5e7978[_0x2254('0x46')](get_open_tabs(_0x2254('0x4f'),_0xa5db88[_0x2254('0x4b')]));_0x5e7978[_0x2254('0x46')](get_open_tabs(_0x2254('0x50'),_0xa5db88[_0x2254('0x4b')]));_0x5e7978[_0x2254('0x46')](get_open_tabs(_0x2254('0x4d'),_0xa5db88[_0x2254('0x4b')]));_0x5e7978[_0x2254('0x46')](get_open_tabs(_0x2254('0x4e'),_0xa5db88[_0x2254('0x4b')]));return BPromise['all'](_0x5e7978);})[_0x2254('0x15')](function(_0x41897d){var _0x35c8eb=[];if(_0x41897d){for(var _0x4a1ac6=0x0;_0x4a1ac6=_0x1f8522['agents']){throw new Error(_0x2c89('0x54'));}})[_0x2c89('0x11')](function(){if(_0x38e457){return db[_0x2c89('0x3f')]['destroy']({'where':{'membername':_0x38e457[_0x2c89('0x27')]},'individualHooks':!![]});}})[_0x2c89('0x11')](function(){if(_0x38e457){return _0x38e457['getVoiceQueues']({'raw':!![]});}})[_0x2c89('0x11')](function(_0x31bf83){if(_0x38e457){if(_0x31bf83){var _0x4fd781=[];_0x3a0d70=_0x31bf83;if(_0x3a0d70[_0x2c89('0x2b')]){for(var _0x4c848a=0x0;_0x4c848a<_0x3a0d70[_0x2c89('0x2b')];_0x4c848a++){_0x4fd781['push'](db[_0x2c89('0x3f')]['upsert']({'membername':_0x38e457['name'],'UserId':_0x38e457['id'],'queue_name':_0x3a0d70[_0x4c848a][_0x2c89('0x27')],'VoiceQueueId':_0x3a0d70[_0x4c848a]['id'],'interface':_0x5281bd,'paused':_0x38e457[_0x2c89('0x4e')]||![],'penalty':_0x3a0d70[_0x4c848a][_0x2c89('0x55')]||0x0}));}return BPromise['all'](_0x4fd781);}}}})[_0x2c89('0x11')](function(){if(_0x38e457){return db['MemberReport'][_0x2c89('0x2a')]({'where':{'membername':_0x38e457[_0x2c89('0x27')],'exitAt':null}});}})[_0x2c89('0x11')](function(_0x39a03e){if(_0x38e457){if(_0x39a03e&&_0x39a03e[_0x2c89('0x2b')]){var _0x360555=[];_0x39a03e['forEach'](function(_0x4d724c){_0x360555[_0x2c89('0x31')](_0x4d724c['update']({'exitAt':moment()[_0x2c89('0x2c')](_0x2c89('0x2d'))}));});return BPromise['all'](_0x360555);}}})[_0x2c89('0x11')](function(_0x468515){if(_0x38e457){var _0x5e75b2=[];var _0x14e168=[];var _0x2091e9=utils[_0x2c89('0x2f')]();var _0x5bf163={'membername':_0x38e457[_0x2c89('0x27')],'interface':_0x5281bd,'enterAt':moment()[_0x2c89('0x2c')](_0x2c89('0x2d')),'role':_0x38e457['role'],'internal':_0x38e457['internal']};_0x2091e9[_0x2c89('0x30')](function(_0x31cdcf){_0x5e75b2['push'](_['merge']({'channel':_0x31cdcf,'type':_0x2c89('0x56'),'data1':_0x2c89('0x57'),'data2':_0x5281bd},_0x5bf163));if(_0x38e457[_0x2c89('0x4e')]){_0x14e168[_0x2c89('0x31')](_[_0x2c89('0x58')]({'channel':_0x31cdcf,'type':'PAUSE','data1':_0x2c89('0x59')},_0x5bf163));}});return db[_0x2c89('0x3a')][_0x2c89('0x3b')](_0x5e75b2[_0x2c89('0x5a')](_0x14e168),{'individualHooks':!![]});}})['then'](function(){if(_0x38e457){return _0x38e457['update']({'online':!![],'lastLoginAt':moment()[_0x2c89('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x38e457[_0x2c89('0x4e')]||![],'mailPause':_0x38e457['loginInPause']||![],'chatPause':_0x38e457[_0x2c89('0x4e')]||![],'faxPause':_0x38e457['loginInPause']||![],'smsPause':_0x38e457[_0x2c89('0x4e')]||![],'openchannelPause':_0x38e457['loginInPause']||![],'pauseType':_0x38e457[_0x2c89('0x4e')]?_0x2c89('0x59'):null,'lastPauseAt':moment()[_0x2c89('0x2c')](_0x2c89('0x2d')),'interface':_0x5281bd});}})[_0x2c89('0x11')](function(_0x206a1b){_0x3d48b9(_0x206a1b);})[_0x2c89('0x1a')](function(_0x22a9bd){_0x58de4c(_0xc87e89['error'](0x1f4,_0x22a9bd['message']));});});}; \ No newline at end of file +var _0xfc66=['all','LogoutUser','destroy','LoginUser','phone','loginInPause','count','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','concat','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./user.socket','request','then','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','GetUser','findAll','options','raw','where','attributes','include','map','model','info','debug','catch','ShowUser','User','find','PauseUser','name','role','internal','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','interface','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','update','system','chat','sms','openchannel','whatsapp','set','%s%s','push'];(function(_0xcc46cd,_0x20417d){var _0x64ef7c=function(_0x19bbb4){while(--_0x19bbb4){_0xcc46cd['push'](_0xcc46cd['shift']());}};_0x64ef7c(++_0x20417d);}(_0xfc66,0x1d4));var _0x6fc6=function(_0x50a826,_0x397f71){_0x50a826=_0x50a826-0x0;var _0x3f2ae2=_0xfc66[_0x50a826];return _0x3f2ae2;};'use strict';var _=require('lodash');var util=require(_0x6fc6('0x0'));var moment=require(_0x6fc6('0x1'));var BPromise=require(_0x6fc6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6fc6('0x3'));var logger=require(_0x6fc6('0x4'))(_0x6fc6('0x5'));var config=require(_0x6fc6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6fc6('0x7')]['http']({'port':0x232a});config['redis']=_[_0x6fc6('0x8')](config['redis'],{'host':_0x6fc6('0x9'),'port':0x18eb});var socket=require(_0x6fc6('0xa'))(new Redis(config[_0x6fc6('0xb')]));require(_0x6fc6('0xc'))['register'](socket);function respondWithRpcPromise(_0x1fa6b1,_0xb8c52d,_0x4943e7){return new BPromise(function(_0x44c33d,_0x148ca5){return client[_0x6fc6('0xd')](_0x1fa6b1,_0x4943e7)[_0x6fc6('0xe')](function(_0x5dd684){logger['info']('User,\x20%s,\x20%s',_0xb8c52d,_0x6fc6('0xf'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0xb8c52d,_0x6fc6('0xf'),JSON[_0x6fc6('0x10')](_0x5dd684));if(_0x5dd684['error']){if(_0x5dd684[_0x6fc6('0x11')][_0x6fc6('0x12')]===0x1f4){logger[_0x6fc6('0x11')](_0x6fc6('0x13'),_0xb8c52d,_0x5dd684['error'][_0x6fc6('0x14')]);return _0x148ca5(_0x5dd684[_0x6fc6('0x11')]['message']);}logger[_0x6fc6('0x11')](_0x6fc6('0x13'),_0xb8c52d,_0x5dd684['error'][_0x6fc6('0x14')]);return _0x44c33d(_0x5dd684[_0x6fc6('0x11')][_0x6fc6('0x14')]);}else{logger['info'](_0x6fc6('0x13'),_0xb8c52d,_0x6fc6('0xf'));_0x44c33d(_0x5dd684[_0x6fc6('0x15')][_0x6fc6('0x14')]);}})['catch'](function(_0x53e773){logger['error'](_0x6fc6('0x13'),_0xb8c52d,_0x53e773);_0x148ca5(_0x53e773);});});}exports[_0x6fc6('0x16')]=function(_0x513ee5){var _0x375b11=this;return new Promise(function(_0x81d6ad,_0x8fdc15){return db['User'][_0x6fc6('0x17')]({'raw':_0x513ee5[_0x6fc6('0x18')]?_0x513ee5['options'][_0x6fc6('0x19')]===undefined?!![]:![]:!![],'where':_0x513ee5[_0x6fc6('0x18')]?_0x513ee5[_0x6fc6('0x18')][_0x6fc6('0x1a')]||null:null,'attributes':_0x513ee5['options']?_0x513ee5[_0x6fc6('0x18')][_0x6fc6('0x1b')]||null:null,'limit':_0x513ee5[_0x6fc6('0x18')]?_0x513ee5[_0x6fc6('0x18')]['limit']||null:null,'include':_0x513ee5['options']?_0x513ee5[_0x6fc6('0x18')][_0x6fc6('0x1c')]?_[_0x6fc6('0x1d')](_0x513ee5[_0x6fc6('0x18')][_0x6fc6('0x1c')],function(_0x9eb73e){return{'model':db[_0x9eb73e['model']],'as':_0x9eb73e['as'],'attributes':_0x9eb73e[_0x6fc6('0x1b')],'include':_0x9eb73e[_0x6fc6('0x1c')]?_['map'](_0x9eb73e['include'],function(_0x436545){return{'model':db[_0x436545['model']],'as':_0x436545['as'],'attributes':_0x436545[_0x6fc6('0x1b')],'include':_0x436545[_0x6fc6('0x1c')]?_[_0x6fc6('0x1d')](_0x436545[_0x6fc6('0x1c')],function(_0x1cd88f){return{'model':db[_0x1cd88f[_0x6fc6('0x1e')]],'as':_0x1cd88f['as'],'attributes':_0x1cd88f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fc6('0xe')](function(_0x1e63ab){logger[_0x6fc6('0x1f')](_0x6fc6('0x16'),_0x513ee5);logger[_0x6fc6('0x20')](_0x6fc6('0x16'),_0x513ee5,JSON[_0x6fc6('0x10')](_0x1e63ab));_0x81d6ad(_0x1e63ab);})[_0x6fc6('0x21')](function(_0x52e078){logger[_0x6fc6('0x11')]('GetUser',_0x52e078[_0x6fc6('0x14')],_0x513ee5);_0x8fdc15(_0x375b11[_0x6fc6('0x11')](0x1f4,_0x52e078[_0x6fc6('0x14')]));});});};exports[_0x6fc6('0x22')]=function(_0x273de3){var _0x37e8e7=this;return new Promise(function(_0x54e26b,_0x4a82ee){return db[_0x6fc6('0x23')][_0x6fc6('0x24')]({'raw':_0x273de3['options']?_0x273de3[_0x6fc6('0x18')][_0x6fc6('0x19')]===undefined?!![]:![]:!![],'where':_0x273de3[_0x6fc6('0x18')]?_0x273de3['options'][_0x6fc6('0x1a')]||null:null,'attributes':_0x273de3[_0x6fc6('0x18')]?_0x273de3['options']['attributes']||null:null,'include':_0x273de3['options']?_0x273de3[_0x6fc6('0x18')]['include']?_[_0x6fc6('0x1d')](_0x273de3[_0x6fc6('0x18')]['include'],function(_0x1ef2f5){return{'model':db[_0x1ef2f5[_0x6fc6('0x1e')]],'as':_0x1ef2f5['as'],'attributes':_0x1ef2f5['attributes'],'include':_0x1ef2f5[_0x6fc6('0x1c')]?_[_0x6fc6('0x1d')](_0x1ef2f5['include'],function(_0x2f92d0){return{'model':db[_0x2f92d0[_0x6fc6('0x1e')]],'as':_0x2f92d0['as'],'attributes':_0x2f92d0[_0x6fc6('0x1b')],'include':_0x2f92d0['include']?_[_0x6fc6('0x1d')](_0x2f92d0['include'],function(_0x59978f){return{'model':db[_0x59978f[_0x6fc6('0x1e')]],'as':_0x59978f['as'],'attributes':_0x59978f[_0x6fc6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6fc6('0xe')](function(_0x3884c8){logger[_0x6fc6('0x1f')](_0x6fc6('0x22'),_0x273de3);logger[_0x6fc6('0x20')](_0x6fc6('0x22'),_0x273de3,JSON[_0x6fc6('0x10')](_0x3884c8));_0x54e26b(_0x3884c8);})[_0x6fc6('0x21')](function(_0x52472c){logger['error'](_0x6fc6('0x22'),_0x52472c[_0x6fc6('0x14')],_0x273de3);_0x4a82ee(_0x37e8e7[_0x6fc6('0x11')](0x1f4,_0x52472c[_0x6fc6('0x14')]));});});};exports[_0x6fc6('0x25')]=function(_0x512df8){var _0x43b715=this;return new Promise(function(_0x2ebbfe,_0x515f5f){var _0x518fee;return db[_0x6fc6('0x23')]['find']({'where':_0x512df8[_0x6fc6('0x18')][_0x6fc6('0x1a')]||{},'attributes':['id',_0x6fc6('0x26'),_0x6fc6('0x27'),_0x6fc6('0x28'),'interface']})[_0x6fc6('0xe')](function(_0x3d50bc){if(_0x3d50bc){_0x518fee=_0x3d50bc;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x518fee['id']},'individualHooks':!![]});}})[_0x6fc6('0xe')](function(){if(_0x518fee){return db[_0x6fc6('0x29')][_0x6fc6('0x17')]({'where':{'membername':_0x518fee[_0x6fc6('0x26')],'type':_0x6fc6('0x2a'),'exitAt':null}});}})[_0x6fc6('0xe')](function(_0x23fb5b){if(_0x518fee){if(_0x23fb5b&&_0x23fb5b[_0x6fc6('0x2b')]){var _0x5ca8eb=moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d'));for(var _0x3c5156=0x0,_0x1cdb5c=_0x23fb5b[_0x6fc6('0x2b')];_0x3c5156<_0x1cdb5c;_0x3c5156++){_0x23fb5b[_0x3c5156][_0x6fc6('0x2e')]({'exitAt':_0x5ca8eb});}}}})[_0x6fc6('0xe')](function(){if(_0x518fee){var _0x2c5495=[];var _0x5ac4a8=utils[_0x6fc6('0x2f')]();_0x5ac4a8[_0x6fc6('0x30')](function(_0x37e82e){_0x2c5495['push']({'channel':_0x37e82e,'membername':_0x518fee[_0x6fc6('0x26')],'interface':_[_0x6fc6('0x31')](_0x518fee[_0x6fc6('0x32')])?util[_0x6fc6('0x2c')](_0x6fc6('0x33'),_0x518fee[_0x6fc6('0x26')]):_0x518fee[_0x6fc6('0x32')],'type':_0x6fc6('0x2a'),'enterAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d')),'data1':_0x512df8[_0x6fc6('0x34')]['type']||_0x6fc6('0x35'),'role':_0x518fee['role'],'internal':_0x518fee[_0x6fc6('0x28')],'uniqueid':_0x512df8[_0x6fc6('0x34')][_0x6fc6('0x36')]||null});});return db['MemberReport'][_0x6fc6('0x37')](_0x2c5495,{'individualHooks':!![]});}})[_0x6fc6('0xe')](function(){if(_0x518fee){return _0x518fee['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x512df8[_0x6fc6('0x34')][_0x6fc6('0x38')]||_0x6fc6('0x35'),'lastPauseAt':moment()['format'](_0x6fc6('0x2d'))});}})[_0x6fc6('0xe')](function(_0x398021){_0x2ebbfe(_0x398021);})[_0x6fc6('0x21')](function(_0x4ed146){_0x515f5f(_0x43b715[_0x6fc6('0x11')](0x1f4,_0x4ed146['message']));});});};exports[_0x6fc6('0x39')]=function(_0x207633){var _0x2a235d=this;return new Promise(function(_0x54f413,_0x48ad38){var _0x3d93f8;return db[_0x6fc6('0x23')][_0x6fc6('0x3a')]({'where':_0x207633[_0x6fc6('0x18')]['where']||{},'attributes':['id','name']})['then'](function(_0x56b4cf){if(_0x56b4cf){_0x3d93f8=_0x56b4cf;if(_0x207633['body'][_0x6fc6('0x3b')]&&!utils[_0x6fc6('0x3c')](_0x207633[_0x6fc6('0x34')][_0x6fc6('0x3b')])){throw new Error('Unknown\x20channel');}switch(_0x207633['body'][_0x6fc6('0x3b')]){case _0x6fc6('0x3d'):return db[_0x6fc6('0x3e')][_0x6fc6('0x3f')]({'paused':0x0},{'where':{'UserId':_0x3d93f8['id']}})[_0x6fc6('0xe')](function(){return db[_0x6fc6('0x29')][_0x6fc6('0x24')]({'where':{'channel':_0x207633[_0x6fc6('0x34')][_0x6fc6('0x3b')],'membername':_0x3d93f8['name'],'type':'PAUSE','exitAt':null}});})[_0x6fc6('0xe')](function(_0x3d0fd4){if(_0x3d0fd4){return _0x3d0fd4[_0x6fc6('0x3f')]({'exitAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d')),'data2':_0x6fc6('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3d93f8[_0x6fc6('0x3f')]({'voicePause':![]});});case'mail':case _0x6fc6('0x41'):case'fax':case _0x6fc6('0x42'):case _0x6fc6('0x43'):case _0x6fc6('0x44'):return db[_0x6fc6('0x29')][_0x6fc6('0x24')]({'where':{'channel':_0x207633[_0x6fc6('0x34')][_0x6fc6('0x3b')],'membername':_0x3d93f8[_0x6fc6('0x26')],'type':'PAUSE','exitAt':null}})[_0x6fc6('0xe')](function(_0x3e5e6f){return _0x3e5e6f[_0x6fc6('0x3f')]({'exitAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d')),'data2':_0x6fc6('0x40')},{'individualHooks':!![]});})[_0x6fc6('0xe')](function(){var _0xa9d7d0={};_[_0x6fc6('0x45')](_0xa9d7d0,util[_0x6fc6('0x2c')](_0x6fc6('0x46'),_0x207633[_0x6fc6('0x34')]['channel'],'Pause'),![]);return _0x3d93f8[_0x6fc6('0x3f')](_0xa9d7d0);});default:return db[_0x6fc6('0x3e')][_0x6fc6('0x3f')]({'paused':0x0},{'where':{'UserId':_0x3d93f8['id']}})[_0x6fc6('0xe')](function(){return db[_0x6fc6('0x29')][_0x6fc6('0x17')]({'where':{'membername':_0x3d93f8[_0x6fc6('0x26')],'type':_0x6fc6('0x2a'),'exitAt':null}});})['then'](function(_0x6e62f5){var _0x33a4b1=[];_0x6e62f5[_0x6fc6('0x30')](function(_0x156636){_0x33a4b1[_0x6fc6('0x47')](_0x156636[_0x6fc6('0x3f')]({'exitAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d')),'data2':_0x6fc6('0x40')}));});return BPromise[_0x6fc6('0x48')](_0x33a4b1);})[_0x6fc6('0xe')](function(){return _0x3d93f8[_0x6fc6('0x3f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x6fc6('0xe')](function(_0x42dbc9){_0x54f413(_0x42dbc9);})[_0x6fc6('0x21')](function(_0x1a7d8b){_0x48ad38(_0x2a235d['error'](0x1f4,_0x1a7d8b[_0x6fc6('0x14')]));});});};exports[_0x6fc6('0x49')]=function(_0x3572f7){var _0xdda356=this;return new Promise(function(_0x19473d,_0x4a740a){var _0x10c6d7;return db[_0x6fc6('0x23')]['findOne']({'where':_0x3572f7['options'][_0x6fc6('0x1a')]||{},'attributes':['id','name']})[_0x6fc6('0xe')](function(_0x134cbb){if(_0x134cbb){_0x10c6d7=_0x134cbb;return db[_0x6fc6('0x3e')][_0x6fc6('0x4a')]({'where':{'membername':_0x10c6d7[_0x6fc6('0x26')]},'individualHooks':!![]});}})[_0x6fc6('0xe')](function(){if(_0x10c6d7){return db[_0x6fc6('0x29')][_0x6fc6('0x17')]({'where':{'membername':_0x10c6d7[_0x6fc6('0x26')],'exitAt':null}});}})['then'](function(_0x139f4b){if(_0x10c6d7){if(_0x139f4b&&_0x139f4b['length']){var _0x57bf32=[];_0x139f4b[_0x6fc6('0x30')](function(_0x5daa09){_0x57bf32[_0x6fc6('0x47')](_0x5daa09['update']({'exitAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d'))}));});return BPromise['all'](_0x57bf32);}}})[_0x6fc6('0xe')](function(){if(_0x10c6d7){return _0x10c6d7['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x248f8a){_0x19473d(_0x248f8a);})[_0x6fc6('0x21')](function(_0x5bf425){_0x4a740a(_0xdda356[_0x6fc6('0x11')](0x1f4,_0x5bf425[_0x6fc6('0x14')]));});});};exports[_0x6fc6('0x4b')]=function(_0x63d20b){var _0x42969f=this;return new Promise(function(_0x5b3e34,_0x14d1bd){var _0x44a019;var _0x1dcc50;var _0x48c202;var _0x5d4930;return db[_0x6fc6('0x23')][_0x6fc6('0x3a')]({'where':_0x63d20b[_0x6fc6('0x18')]['where']||{},'attributes':['id',_0x6fc6('0x26'),_0x6fc6('0x27'),'mobile',_0x6fc6('0x4c'),_0x6fc6('0x28'),_0x6fc6('0x4d'),_0x6fc6('0x32')]})[_0x6fc6('0xe')](function(_0x3bb807){if(_0x3bb807){_0x44a019=_0x3bb807;_0x5d4930=_0x63d20b[_0x6fc6('0x34')][_0x6fc6('0x32')]?_0x63d20b[_0x6fc6('0x34')][_0x6fc6('0x32')]:util[_0x6fc6('0x2c')](_0x6fc6('0x33'),_0x44a019[_0x6fc6('0x26')]);return db[_0x6fc6('0x23')][_0x6fc6('0x4e')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x44a019['id']}}});}})[_0x6fc6('0xe')](function(_0x5b0f08){if(_0x5b0f08){_0x48c202=_0x5b0f08;return require(_0x6fc6('0x4f'))['getLicense']();}})[_0x6fc6('0xe')](function(_0x3e4dee){if(_0x3e4dee&&_0x3e4dee[_0x6fc6('0x50')]&&_0x48c202>=_0x3e4dee[_0x6fc6('0x50')]){throw new Error(_0x6fc6('0x51'));}})['then'](function(){if(_0x44a019){return db[_0x6fc6('0x3e')]['destroy']({'where':{'membername':_0x44a019[_0x6fc6('0x26')]},'individualHooks':!![]});}})[_0x6fc6('0xe')](function(){if(_0x44a019){return _0x44a019[_0x6fc6('0x52')]({'raw':!![]});}})[_0x6fc6('0xe')](function(_0xdce0c7){if(_0x44a019){if(_0xdce0c7){var _0x35f269=[];_0x1dcc50=_0xdce0c7;if(_0x1dcc50[_0x6fc6('0x2b')]){for(var _0x4d6c21=0x0;_0x4d6c21<_0x1dcc50['length'];_0x4d6c21++){_0x35f269[_0x6fc6('0x47')](db[_0x6fc6('0x3e')][_0x6fc6('0x53')]({'membername':_0x44a019['name'],'UserId':_0x44a019['id'],'queue_name':_0x1dcc50[_0x4d6c21]['name'],'VoiceQueueId':_0x1dcc50[_0x4d6c21]['id'],'interface':_0x5d4930,'paused':_0x44a019[_0x6fc6('0x4d')]||![],'penalty':_0x1dcc50[_0x4d6c21][_0x6fc6('0x54')]||0x0}));}return BPromise['all'](_0x35f269);}}}})['then'](function(){if(_0x44a019){return db[_0x6fc6('0x29')][_0x6fc6('0x17')]({'where':{'membername':_0x44a019[_0x6fc6('0x26')],'exitAt':null}});}})['then'](function(_0x34fd0d){if(_0x44a019){if(_0x34fd0d&&_0x34fd0d['length']){var _0x1999c6=[];_0x34fd0d[_0x6fc6('0x30')](function(_0x4b92e2){_0x1999c6[_0x6fc6('0x47')](_0x4b92e2[_0x6fc6('0x3f')]({'exitAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d'))}));});return BPromise['all'](_0x1999c6);}}})[_0x6fc6('0xe')](function(_0x2cf800){if(_0x44a019){var _0xf22fee=[];var _0x39d528=[];var _0x1c16f6=utils[_0x6fc6('0x2f')]();var _0x391bcf={'membername':_0x44a019['name'],'interface':_0x5d4930,'enterAt':moment()[_0x6fc6('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x44a019[_0x6fc6('0x27')],'internal':_0x44a019[_0x6fc6('0x28')]};_0x1c16f6[_0x6fc6('0x30')](function(_0x2bfa15){_0xf22fee['push'](_['merge']({'channel':_0x2bfa15,'type':_0x6fc6('0x55'),'data1':_0x6fc6('0x56'),'data2':_0x5d4930},_0x391bcf));if(_0x44a019[_0x6fc6('0x4d')]){_0x39d528[_0x6fc6('0x47')](_[_0x6fc6('0x57')]({'channel':_0x2bfa15,'type':'PAUSE','data1':_0x6fc6('0x58')},_0x391bcf));}});return db[_0x6fc6('0x29')]['bulkCreate'](_0xf22fee[_0x6fc6('0x59')](_0x39d528),{'individualHooks':!![]});}})[_0x6fc6('0xe')](function(){if(_0x44a019){return _0x44a019[_0x6fc6('0x3f')]({'online':!![],'lastLoginAt':moment()['format'](_0x6fc6('0x2d')),'voicePause':_0x44a019[_0x6fc6('0x4d')]||![],'mailPause':_0x44a019[_0x6fc6('0x4d')]||![],'chatPause':_0x44a019[_0x6fc6('0x4d')]||![],'faxPause':_0x44a019['loginInPause']||![],'smsPause':_0x44a019[_0x6fc6('0x4d')]||![],'openchannelPause':_0x44a019[_0x6fc6('0x4d')]||![],'pauseType':_0x44a019[_0x6fc6('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x6fc6('0x2c')](_0x6fc6('0x2d')),'interface':_0x5d4930});}})['then'](function(_0x3dafad){_0x5b3e34(_0x3dafad);})[_0x6fc6('0x21')](function(_0x1f087b){_0x14d1bd(_0x42969f[_0x6fc6('0x11')](0x1f4,_0x1f087b[_0x6fc6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bd6a175..e7c3a3b 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 _0x3f60=['register','length','remove','update','emit','removeListener'];(function(_0x2671b0,_0x5f0d50){var _0x1bf620=function(_0x378afd){while(--_0x378afd){_0x2671b0['push'](_0x2671b0['shift']());}};_0x1bf620(++_0x5f0d50);}(_0x3f60,0x1a6));var _0x03f6=function(_0x38a155,_0x2aa026){_0x38a155=_0x38a155-0x0;var _0x269403=_0x3f60[_0x38a155];return _0x269403;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x03f6('0x0'),_0x03f6('0x1')];function createListener(_0x2134f0,_0x3ae241){return function(_0x572b55){_0x3ae241[_0x03f6('0x2')](_0x2134f0,_0x572b55);};}function removeListener(_0x53c470,_0x130b65){return function(){UserEvents[_0x03f6('0x3')](_0x53c470,_0x130b65);};}exports[_0x03f6('0x4')]=function(_0x5839db){for(var _0x1ce3f7=0x0,_0xc9e61b=events[_0x03f6('0x5')];_0x1ce3f7<_0xc9e61b;_0x1ce3f7++){var _0x4faf25=events[_0x1ce3f7];var _0x1dd1ac=createListener('user:'+_0x4faf25,_0x5839db);UserEvents['on'](_0x4faf25,_0x1dd1ac);}}; \ No newline at end of file +var _0xfa43=['update','emit','register','length','user:','./user.events','remove'];(function(_0x5ae747,_0x5e807e){var _0x4e6b6c=function(_0x5bc3c5){while(--_0x5bc3c5){_0x5ae747['push'](_0x5ae747['shift']());}};_0x4e6b6c(++_0x5e807e);}(_0xfa43,0x178));var _0x3fa4=function(_0x89ae8e,_0x31b787){_0x89ae8e=_0x89ae8e-0x0;var _0x17d7d0=_0xfa43[_0x89ae8e];return _0x17d7d0;};'use strict';var UserEvents=require(_0x3fa4('0x0'));var events=['save',_0x3fa4('0x1'),_0x3fa4('0x2')];function createListener(_0x5db5b6,_0x695c7c){return function(_0x49a401){_0x695c7c[_0x3fa4('0x3')](_0x5db5b6,_0x49a401);};}function removeListener(_0xbaba93,_0x1cf259){return function(){UserEvents['removeListener'](_0xbaba93,_0x1cf259);};}exports[_0x3fa4('0x4')]=function(_0x34bf01){for(var _0x4e38f4=0x0,_0x1b067b=events[_0x3fa4('0x5')];_0x4e38f4<_0x1b067b;_0x4e38f4++){var _0x3d32f2=events[_0x4e38f4];var _0x4f3a6a=createListener(_0x3fa4('0x6')+_0x3d32f2,_0x34bf01);UserEvents['on'](_0x3d32f2,_0x4f3a6a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 66a203d..52dc5e9 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47e21e,_0xa9a0f6){var _0x1e9d0c=function(_0xe31d78){while(--_0xe31d78){_0x47e21e['push'](_0x47e21e['shift']());}};_0x1e9d0c(++_0xa9a0f6);}(_0x70e0,0x17b));var _0x070e=function(_0x446145,_0x385a80){_0x446145=_0x446145-0x0;var _0x262105=_0x70e0[_0x446145];return _0x262105;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ee304de..d8fecd1 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 _0x183e=['sequelize','exports','INTEGER'];(function(_0x56996b,_0x4e2176){var _0x22327d=function(_0x276698){while(--_0x276698){_0x56996b['push'](_0x56996b['shift']());}};_0x22327d(++_0x4e2176);}(_0x183e,0xfc));var _0xe183=function(_0x2a0d4c,_0x222800){_0x2a0d4c=_0x2a0d4c-0x0;var _0x2a73ea=_0x183e[_0x2a0d4c];return _0x2a73ea;};'use strict';var Sequelize=require(_0xe183('0x0'));module[_0xe183('0x1')]={'penalty':{'type':Sequelize[_0xe183('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd318=['sequelize','exports','INTEGER'];(function(_0x4f1737,_0x431b9f){var _0x173fcc=function(_0x452fd2){while(--_0x452fd2){_0x4f1737['push'](_0x4f1737['shift']());}};_0x173fcc(++_0x431b9f);}(_0xd318,0x75));var _0x8d31=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd318[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8d31('0x0'));module[_0x8d31('0x1')]={'penalty':{'type':Sequelize[_0x8d31('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2401029..55cb41a 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 _0x23bb=['api','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x3aef80,_0x12239f){var _0x8e2f9d=function(_0x5c3202){while(--_0x5c3202){_0x3aef80['push'](_0x3aef80['shift']());}};_0x8e2f9d(++_0x12239f);}(_0x23bb,0x183));var _0xb23b=function(_0x48209c,_0xeefee1){_0x48209c=_0x48209c-0x0;var _0x289d49=_0x23bb[_0x48209c];return _0x289d49;};'use strict';var _=require(_0xb23b('0x0'));var util=require(_0xb23b('0x1'));var logger=require(_0xb23b('0x2'))(_0xb23b('0x3'));var moment=require(_0xb23b('0x4'));var BPromise=require(_0xb23b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb23b('0x6'));var rimraf=require(_0xb23b('0x7'));var config=require(_0xb23b('0x8'));var attributes=require(_0xb23b('0x9'));module[_0xb23b('0xa')]=function(_0x27d0a3,_0x45d927){return _0x27d0a3[_0xb23b('0xb')]('UserChatQueue',attributes,{'tableName':_0xb23b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf61=['moment','bluebird','path','../../config/environment','define','user_has_chat_queues','util','api'];(function(_0x58032a,_0x466b28){var _0x24a4c5=function(_0x42f358){while(--_0x42f358){_0x58032a['push'](_0x58032a['shift']());}};_0x24a4c5(++_0x466b28);}(_0xaf61,0x96));var _0x1af6=function(_0x1e5008,_0x370329){_0x1e5008=_0x1e5008-0x0;var _0x55d11d=_0xaf61[_0x1e5008];return _0x55d11d;};'use strict';var _=require('lodash');var util=require(_0x1af6('0x0'));var logger=require('../../config/logger')(_0x1af6('0x1'));var moment=require(_0x1af6('0x2'));var BPromise=require(_0x1af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1af6('0x4'));var rimraf=require('rimraf');var config=require(_0x1af6('0x5'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x3785b7,_0x270f24){return _0x3785b7[_0x1af6('0x6')]('UserChatQueue',attributes,{'tableName':_0x1af6('0x7'),'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 287f2c4..bb4deb4 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 _0xeb48=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xeb48,0x127));var _0x8eb4=function(_0x478edf,_0x36a56){_0x478edf=_0x478edf-0x0;var _0x415f9d=_0xeb48[_0x478edf];return _0x415f9d;};'use strict';var _=require(_0x8eb4('0x0'));var util=require(_0x8eb4('0x1'));var moment=require(_0x8eb4('0x2'));var BPromise=require(_0x8eb4('0x3'));var rs=require(_0x8eb4('0x4'));var fs=require('fs');var Redis=require(_0x8eb4('0x5'));var db=require(_0x8eb4('0x6'))['db'];var utils=require(_0x8eb4('0x7'));var logger=require(_0x8eb4('0x8'))(_0x8eb4('0x9'));var config=require(_0x8eb4('0xa'));var jayson=require(_0x8eb4('0xb'));var client=jayson[_0x8eb4('0xc')][_0x8eb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3e2cc9,_0x2c2306,_0x492217){return new BPromise(function(_0x279c2b,_0x58340a){return client[_0x8eb4('0xe')](_0x3e2cc9,_0x492217)[_0x8eb4('0xf')](function(_0x10d914){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2c2306,_0x8eb4('0x10'));logger[_0x8eb4('0x11')](_0x8eb4('0x12'),_0x2c2306,_0x8eb4('0x10'),JSON[_0x8eb4('0x13')](_0x10d914));if(_0x10d914[_0x8eb4('0x14')]){if(_0x10d914[_0x8eb4('0x14')][_0x8eb4('0x15')]===0x1f4){logger[_0x8eb4('0x14')](_0x8eb4('0x16'),_0x2c2306,_0x10d914[_0x8eb4('0x14')][_0x8eb4('0x17')]);return _0x58340a(_0x10d914['error'][_0x8eb4('0x17')]);}logger[_0x8eb4('0x14')](_0x8eb4('0x16'),_0x2c2306,_0x10d914[_0x8eb4('0x14')][_0x8eb4('0x17')]);return _0x279c2b(_0x10d914[_0x8eb4('0x14')]['message']);}else{logger[_0x8eb4('0x18')]('UserChatQueue,\x20%s,\x20%s',_0x2c2306,_0x8eb4('0x10'));_0x279c2b(_0x10d914[_0x8eb4('0x19')][_0x8eb4('0x17')]);}})[_0x8eb4('0x1a')](function(_0x40f799){logger[_0x8eb4('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x2c2306,_0x40f799);_0x58340a(_0x40f799);});});} \ No newline at end of file +var _0x6171=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3e6342,_0x2deb66){var _0x4dfd78=function(_0xacecef){while(--_0xacecef){_0x3e6342['push'](_0x3e6342['shift']());}};_0x4dfd78(++_0x2deb66);}(_0x6171,0x131));var _0x1617=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x6171[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x1617('0x0'));var util=require(_0x1617('0x1'));var moment=require(_0x1617('0x2'));var BPromise=require(_0x1617('0x3'));var rs=require(_0x1617('0x4'));var fs=require('fs');var Redis=require(_0x1617('0x5'));var db=require(_0x1617('0x6'))['db'];var utils=require(_0x1617('0x7'));var logger=require(_0x1617('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1617('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48dcd4,_0x53a993,_0x141965){return new BPromise(function(_0x554b62,_0x3fbe9b){return client[_0x1617('0xa')](_0x48dcd4,_0x141965)['then'](function(_0x2dd2ee){logger[_0x1617('0xb')](_0x1617('0xc'),_0x53a993,'request\x20sent');logger[_0x1617('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x53a993,_0x1617('0xe'),JSON[_0x1617('0xf')](_0x2dd2ee));if(_0x2dd2ee[_0x1617('0x10')]){if(_0x2dd2ee[_0x1617('0x10')][_0x1617('0x11')]===0x1f4){logger['error'](_0x1617('0xc'),_0x53a993,_0x2dd2ee['error'][_0x1617('0x12')]);return _0x3fbe9b(_0x2dd2ee[_0x1617('0x10')][_0x1617('0x12')]);}logger[_0x1617('0x10')](_0x1617('0xc'),_0x53a993,_0x2dd2ee[_0x1617('0x10')]['message']);return _0x554b62(_0x2dd2ee[_0x1617('0x10')][_0x1617('0x12')]);}else{logger[_0x1617('0xb')](_0x1617('0xc'),_0x53a993,_0x1617('0xe'));_0x554b62(_0x2dd2ee['result'][_0x1617('0x12')]);}})[_0x1617('0x13')](function(_0x477335){logger[_0x1617('0x10')](_0x1617('0xc'),_0x53a993,_0x477335);_0x3fbe9b(_0x477335);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fbe1bbf..c5f16e5 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x373b56,_0x5a0a93){var _0x569eff=function(_0x1177fe){while(--_0x1177fe){_0x373b56['push'](_0x373b56['shift']());}};_0x569eff(++_0x5a0a93);}(_0xedd9,0xfc));var _0x9edd=function(_0x288a23,_0x2e0343){_0x288a23=_0x288a23-0x0;var _0x5668cf=_0xedd9[_0x288a23];return _0x5668cf;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x55d283,_0x46088e){var _0x3e6010=function(_0x228b56){while(--_0x228b56){_0x55d283['push'](_0x55d283['shift']());}};_0x3e6010(++_0x46088e);}(_0xe706,0xa3));var _0x6e70=function(_0x56ea12,_0x304238){_0x56ea12=_0x56ea12-0x0;var _0x4b9883=_0xe706[_0x56ea12];return _0x4b9883;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a7d9e4e..7f2fa20 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 _0xa73f=['INTEGER','STRING'];(function(_0x9d87e8,_0x443688){var _0x791a8c=function(_0x344eef){while(--_0x344eef){_0x9d87e8['push'](_0x9d87e8['shift']());}};_0x791a8c(++_0x443688);}(_0xa73f,0x144));var _0xfa73=function(_0x5e5cc7,_0x489170){_0x5e5cc7=_0x5e5cc7-0x0;var _0x326cd0=_0xa73f[_0x5e5cc7];return _0x326cd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xfa73('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfa73('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfa73('0x1')]}}; \ No newline at end of file +var _0xf639=['sequelize','INTEGER'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf639,0x12e));var _0x9f63=function(_0x2f9cbc,_0x42cf1b){_0x2f9cbc=_0x2f9cbc-0x0;var _0xd91e8=_0xf639[_0x2f9cbc];return _0xd91e8;};'use strict';var Sequelize=require(_0x9f63('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9f63('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9aa6738..47fe50a 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 _0x8abc=['define','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x3cbac0,_0x3b8726){var _0x125230=function(_0x434bf4){while(--_0x434bf4){_0x3cbac0['push'](_0x3cbac0['shift']());}};_0x125230(++_0x3b8726);}(_0x8abc,0x92));var _0xc8ab=function(_0x22f98b,_0x57edc7){_0x22f98b=_0x22f98b-0x0;var _0x4e0b5a=_0x8abc[_0x22f98b];return _0x4e0b5a;};'use strict';var _=require(_0xc8ab('0x0'));var util=require(_0xc8ab('0x1'));var logger=require(_0xc8ab('0x2'))(_0xc8ab('0x3'));var moment=require(_0xc8ab('0x4'));var BPromise=require(_0xc8ab('0x5'));var rp=require(_0xc8ab('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8ab('0x7'));var attributes=require(_0xc8ab('0x8'));module[_0xc8ab('0x9')]=function(_0xe8b704,_0x4ce7e4){return _0xe8b704[_0xc8ab('0xa')](_0xc8ab('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f2=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x50b658,_0xd3077f){var _0x484d1d=function(_0x15f39b){while(--_0x15f39b){_0x50b658['push'](_0x50b658['shift']());}};_0x484d1d(++_0xd3077f);}(_0x82f2,0x65));var _0x282f=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x82f2[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x282f('0x0'));var util=require(_0x282f('0x1'));var logger=require(_0x282f('0x2'))(_0x282f('0x3'));var moment=require(_0x282f('0x4'));var BPromise=require('bluebird');var rp=require(_0x282f('0x5'));var fs=require('fs');var path=require(_0x282f('0x6'));var rimraf=require(_0x282f('0x7'));var config=require(_0x282f('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x282f('0x9')]=function(_0x184fa8,_0x384bf8){return _0x184fa8[_0x282f('0xa')](_0x282f('0xb'),attributes,{'tableName':_0x282f('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 bd49527..f893a8c 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 _0x88c3=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ec09b,_0x12d654){var _0x5a8482=function(_0x3e250f){while(--_0x3e250f){_0x5ec09b['push'](_0x5ec09b['shift']());}};_0x5a8482(++_0x12d654);}(_0x88c3,0x71));var _0x388c=function(_0x188ac5,_0xc4fdbb){_0x188ac5=_0x188ac5-0x0;var _0x3534c3=_0x88c3[_0x188ac5];return _0x3534c3;};'use strict';var _=require(_0x388c('0x0'));var util=require(_0x388c('0x1'));var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rs=require(_0x388c('0x3'));var fs=require('fs');var Redis=require(_0x388c('0x4'));var db=require(_0x388c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x388c('0x6'))(_0x388c('0x7'));var config=require(_0x388c('0x8'));var jayson=require(_0x388c('0x9'));var client=jayson['client'][_0x388c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x207274,_0x28be59,_0x593aee){return new BPromise(function(_0x34eab8,_0x46bb30){return client[_0x388c('0xb')](_0x207274,_0x593aee)['then'](function(_0x25aaed){logger[_0x388c('0xc')](_0x388c('0xd'),_0x28be59,_0x388c('0xe'));logger[_0x388c('0xf')](_0x388c('0x10'),_0x28be59,'request\x20sent',JSON[_0x388c('0x11')](_0x25aaed));if(_0x25aaed['error']){if(_0x25aaed[_0x388c('0x12')]['code']===0x1f4){logger[_0x388c('0x12')](_0x388c('0xd'),_0x28be59,_0x25aaed[_0x388c('0x12')][_0x388c('0x13')]);return _0x46bb30(_0x25aaed[_0x388c('0x12')][_0x388c('0x13')]);}logger[_0x388c('0x12')](_0x388c('0xd'),_0x28be59,_0x25aaed[_0x388c('0x12')][_0x388c('0x13')]);return _0x34eab8(_0x25aaed[_0x388c('0x12')][_0x388c('0x13')]);}else{logger[_0x388c('0xc')](_0x388c('0xd'),_0x28be59,_0x388c('0xe'));_0x34eab8(_0x25aaed[_0x388c('0x14')][_0x388c('0x13')]);}})[_0x388c('0x15')](function(_0x289874){logger[_0x388c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x28be59,_0x289874);_0x46bb30(_0x289874);});});} \ No newline at end of file +var _0x873f=['jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x873f,0x122));var _0xf873=function(_0xc869,_0x48ac46){_0xc869=_0xc869-0x0;var _0x5dee4a=_0x873f[_0xc869];return _0x5dee4a;};'use strict';var _=require('lodash');var util=require(_0xf873('0x0'));var moment=require(_0xf873('0x1'));var BPromise=require(_0xf873('0x2'));var rs=require(_0xf873('0x3'));var fs=require('fs');var Redis=require(_0xf873('0x4'));var db=require(_0xf873('0x5'))['db'];var utils=require(_0xf873('0x6'));var logger=require('../../config/logger')(_0xf873('0x7'));var config=require(_0xf873('0x8'));var jayson=require(_0xf873('0x9'));var client=jayson[_0xf873('0xa')][_0xf873('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22fcd6,_0x75205a,_0x190fde){return new BPromise(function(_0x578d24,_0x42c0b4){return client[_0xf873('0xc')](_0x22fcd6,_0x190fde)['then'](function(_0xcbeb68){logger[_0xf873('0xd')](_0xf873('0xe'),_0x75205a,_0xf873('0xf'));logger[_0xf873('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x75205a,_0xf873('0xf'),JSON[_0xf873('0x11')](_0xcbeb68));if(_0xcbeb68[_0xf873('0x12')]){if(_0xcbeb68[_0xf873('0x12')][_0xf873('0x13')]===0x1f4){logger[_0xf873('0x12')](_0xf873('0xe'),_0x75205a,_0xcbeb68[_0xf873('0x12')][_0xf873('0x14')]);return _0x42c0b4(_0xcbeb68[_0xf873('0x12')][_0xf873('0x14')]);}logger['error'](_0xf873('0xe'),_0x75205a,_0xcbeb68['error'][_0xf873('0x14')]);return _0x578d24(_0xcbeb68[_0xf873('0x12')][_0xf873('0x14')]);}else{logger[_0xf873('0xd')](_0xf873('0xe'),_0x75205a,'request\x20sent');_0x578d24(_0xcbeb68[_0xf873('0x15')]['message']);}})[_0xf873('0x16')](function(_0x515162){logger[_0xf873('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x75205a,_0x515162);_0x42c0b4(_0x515162);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 26e805e..08efac6 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2859f0,_0xb9b291){var _0x3a4f66=function(_0x5f4836){while(--_0x5f4836){_0x2859f0['push'](_0x2859f0['shift']());}};_0x3a4f66(++_0xb9b291);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x20b1ca,_0xcaa99b){var _0x13a457=function(_0x49b381){while(--_0x49b381){_0x20b1ca['push'](_0x20b1ca['shift']());}};_0x13a457(++_0xcaa99b);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0505a47..0696749 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 _0xb459=['INTEGER','sequelize','exports'];(function(_0x633edb,_0x3bc47f){var _0x309460=function(_0x12fd72){while(--_0x12fd72){_0x633edb['push'](_0x633edb['shift']());}};_0x309460(++_0x3bc47f);}(_0xb459,0x178));var _0x9b45=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb459[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x9b45('0x0'));module[_0x9b45('0x1')]={'penalty':{'type':Sequelize[_0x9b45('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf88f=['exports','INTEGER','sequelize'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xf88f,0x1bb));var _0xff88=function(_0x50d2fa,_0x18cb02){_0x50d2fa=_0x50d2fa-0x0;var _0xa22395=_0xf88f[_0x50d2fa];return _0xa22395;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'penalty':{'type':Sequelize[_0xff88('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 9af7b19..b530258 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 _0xe23d=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util'];(function(_0x328d38,_0x5a7a82){var _0x1b99f6=function(_0x3de17c){while(--_0x3de17c){_0x328d38['push'](_0x328d38['shift']());}};_0x1b99f6(++_0x5a7a82);}(_0xe23d,0xf5));var _0xde23=function(_0x284a2a,_0x31008d){_0x284a2a=_0x284a2a-0x0;var _0x306235=_0xe23d[_0x284a2a];return _0x306235;};'use strict';var _=require(_0xde23('0x0'));var util=require(_0xde23('0x1'));var logger=require(_0xde23('0x2'))(_0xde23('0x3'));var moment=require(_0xde23('0x4'));var BPromise=require(_0xde23('0x5'));var rp=require(_0xde23('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde23('0x7'));var config=require(_0xde23('0x8'));var attributes=require(_0xde23('0x9'));module[_0xde23('0xa')]=function(_0x3ac425,_0x1acee4){return _0x3ac425[_0xde23('0xb')](_0xde23('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ce=['exports','UserMailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes'];(function(_0x5358ba,_0x4cfc24){var _0xf0ff1a=function(_0x29d182){while(--_0x29d182){_0x5358ba['push'](_0x5358ba['shift']());}};_0xf0ff1a(++_0x4cfc24);}(_0xd2ce,0x115));var _0xed2c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xd2ce[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require(_0xed2c('0x1'))(_0xed2c('0x2'));var moment=require(_0xed2c('0x3'));var BPromise=require(_0xed2c('0x4'));var rp=require(_0xed2c('0x5'));var fs=require('fs');var path=require(_0xed2c('0x6'));var rimraf=require(_0xed2c('0x7'));var config=require('../../config/environment');var attributes=require(_0xed2c('0x8'));module[_0xed2c('0x9')]=function(_0x237ab5,_0x1a19ca){return _0x237ab5['define'](_0xed2c('0xa'),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 e9c395f..82616c6 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(_0x2bbb1c,_0x3c4c6a){var _0x2b3d8c=function(_0x18e86d){while(--_0x18e86d){_0x2bbb1c['push'](_0x2bbb1c['shift']());}};_0x2b3d8c(++_0x3c4c6a);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c5bb9,_0xe76bce){var _0x20deec=function(_0xd775ab){while(--_0xd775ab){_0x3c5bb9['push'](_0x3c5bb9['shift']());}};_0x20deec(++_0xe76bce);}(_0xa41a,0x6b));var _0xaa41=function(_0x76625f,_0x49ac3b){_0x76625f=_0x76625f-0x0;var _0x5e9b25=_0xa41a[_0x76625f];return _0x5e9b25;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0a2e17b..5b72943 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 _0xf5a3=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports','multer','util'];(function(_0x4f8a23,_0xa81e04){var _0x2f9d55=function(_0x56ad10){while(--_0x56ad10){_0x4f8a23['push'](_0x4f8a23['shift']());}};_0x2f9d55(++_0xa81e04);}(_0xf5a3,0x18a));var _0x3f5a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf5a3[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x3f5a('0x0'));var util=require(_0x3f5a('0x1'));var path=require(_0x3f5a('0x2'));var timeout=require(_0x3f5a('0x3'));var express=require(_0x3f5a('0x4'));var router=express[_0x3f5a('0x5')]();var fs_extra=require(_0x3f5a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3f5a('0x7'));var config=require(_0x3f5a('0x8'));var controller=require('./userNotification.controller');router[_0x3f5a('0x9')]('/',auth[_0x3f5a('0xa')](),controller['sendUserNotification']);module[_0x3f5a('0xb')]=router; \ No newline at end of file +var _0xbde4=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbde4,0x69));var _0x4bde=function(_0x2a7c4e,_0x412876){_0x2a7c4e=_0x2a7c4e-0x0;var _0x4db2cb=_0xbde4[_0x2a7c4e];return _0x4db2cb;};'use strict';var multer=require(_0x4bde('0x0'));var util=require(_0x4bde('0x1'));var path=require(_0x4bde('0x2'));var timeout=require(_0x4bde('0x3'));var express=require(_0x4bde('0x4'));var router=express[_0x4bde('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4bde('0x6'));var interaction=require(_0x4bde('0x7'));var config=require(_0x4bde('0x8'));var controller=require(_0x4bde('0x9'));router[_0x4bde('0xa')]('/',auth[_0x4bde('0xb')](),controller['sendUserNotification']);module[_0x4bde('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0baefdf..eccf08f 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 _0x4e06=['STRING','TEXT','BOOLEAN','sequelize','exports'];(function(_0x490486,_0xd8363f){var _0x3eb33d=function(_0x1e3168){while(--_0x1e3168){_0x490486['push'](_0x490486['shift']());}};_0x3eb33d(++_0xd8363f);}(_0x4e06,0x189));var _0x64e0=function(_0x551666,_0x687957){_0x551666=_0x551666-0x0;var _0x4b37ff=_0x4e06[_0x551666];return _0x4b37ff;};'use strict';var Sequelize=require(_0x64e0('0x0'));module[_0x64e0('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x64e0('0x2')]},'recipientsId':{'type':Sequelize[_0x64e0('0x3')]},'recipientsDescription':{'type':Sequelize[_0x64e0('0x2')]},'beep':{'type':Sequelize[_0x64e0('0x4')]}}; \ No newline at end of file +var _0xc800=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xc800,0x7d));var _0x0c80=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xc800[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0x0c80('0x0'));module[_0x0c80('0x1')]={'body':{'type':Sequelize[_0x0c80('0x2')]},'senderName':{'type':Sequelize[_0x0c80('0x3')]},'recipientsId':{'type':Sequelize[_0x0c80('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0c80('0x3')]},'beep':{'type':Sequelize[_0x0c80('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index eea2c8c..e0cd208 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 _0x8627=['apply','reject','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','render','User','union','ids','queue','replace','Queue','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2447c7,_0x16650a){var _0x19d505=function(_0x4e256b){while(--_0x4e256b){_0x2447c7['push'](_0x2447c7['shift']());}};_0x19d505(++_0x16650a);}(_0x8627,0x16a));var _0x7862=function(_0x90b40e,_0x14a2a5){_0x90b40e=_0x90b40e-0x0;var _0x54c67a=_0x8627[_0x90b40e];return _0x54c67a;};'use strict';var emlformat=require(_0x7862('0x0'));var rimraf=require(_0x7862('0x1'));var zipdir=require(_0x7862('0x2'));var jsonpatch=require(_0x7862('0x3'));var rp=require(_0x7862('0x4'));var moment=require('moment');var BPromise=require(_0x7862('0x5'));var Mustache=require(_0x7862('0x6'));var util=require(_0x7862('0x7'));var path=require(_0x7862('0x8'));var sox=require(_0x7862('0x9'));var csv=require(_0x7862('0xa'));var ejs=require(_0x7862('0xb'));var fs=require('fs');var fs_extra=require(_0x7862('0xc'));var _=require(_0x7862('0xd'));var squel=require('squel');var crypto=require(_0x7862('0xe'));var jsforce=require(_0x7862('0xf'));var deskjs=require(_0x7862('0x10'));var toCsv=require(_0x7862('0xa'));var querystring=require('querystring');var Papa=require(_0x7862('0x11'));var Redis=require(_0x7862('0x12'));var authService=require(_0x7862('0x13'));var qs=require(_0x7862('0x14'));var as=require(_0x7862('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7862('0x16'))('api');var utils=require(_0x7862('0x17'));var config=require(_0x7862('0x18'));var licenseUtil=require(_0x7862('0x19'));var db=require('../../mysqldb')['db'];config[_0x7862('0x1a')]=_['defaults'](config[_0x7862('0x1a')],{'host':_0x7862('0x1b'),'port':0x18eb});var socket=require(_0x7862('0x1c'))(new Redis(config[_0x7862('0x1a')]));require(_0x7862('0x1d'))['register'](socket);function respondWithStatusCode(_0x506986,_0x5a36ab){_0x5a36ab=_0x5a36ab||0xcc;return function(_0x4c22b5){if(_0x4c22b5){return _0x506986[_0x7862('0x1e')](_0x5a36ab);}return _0x506986[_0x7862('0x1f')](_0x5a36ab)[_0x7862('0x20')]();};}function respondWithResult(_0x2d6b04,_0x503a3a){_0x503a3a=_0x503a3a||0xc8;return function(_0x28f15d){if(_0x28f15d){return _0x2d6b04[_0x7862('0x1f')](_0x503a3a)[_0x7862('0x21')](_0x28f15d);}};}function respondWithFilteredResult(_0x11c9cf,_0x5b2230){return function(_0x51e772){if(_0x51e772){var _0x5862b7=typeof _0x5b2230[_0x7862('0x22')]===_0x7862('0x23')&&typeof _0x5b2230[_0x7862('0x24')]===_0x7862('0x23');var _0x554ca7=_0x51e772[_0x7862('0x25')];var _0x5595e4=_0x5862b7?0x0:_0x5b2230['offset'];var _0x46b922=_0x5862b7?_0x51e772['count']:_0x5b2230['offset']+_0x5b2230[_0x7862('0x24')];var _0x15903c;if(_0x46b922>=_0x554ca7){_0x46b922=_0x554ca7;_0x15903c=0xc8;}else{_0x15903c=0xce;}_0x11c9cf[_0x7862('0x1f')](_0x15903c);return _0x11c9cf['set']('Content-Range',_0x5595e4+'-'+_0x46b922+'/'+_0x554ca7)[_0x7862('0x21')](_0x51e772);}return null;};}function patchUpdates(_0x179e69){return function(_0x179238){try{jsonpatch[_0x7862('0x26')](_0x179238,_0x179e69,!![]);}catch(_0x31ac04){return BPromise[_0x7862('0x27')](_0x31ac04);}return _0x179238['save']();};}function saveUpdates(_0x502ca4,_0x4d4bf2){return function(_0x5681e4){if(_0x5681e4){return _0x5681e4[_0x7862('0x28')](_0x502ca4)[_0x7862('0x29')](function(_0x158270){return _0x158270;});}return null;};}function removeEntity(_0x297832,_0xbd1e58){return function(_0x3ec312){if(_0x3ec312){return _0x3ec312[_0x7862('0x2a')]()[_0x7862('0x29')](function(){_0x297832['status'](0xcc)[_0x7862('0x20')]();});}};}function handleEntityNotFound(_0x4b8f5e,_0x44cec7){return function(_0x5d543e){if(!_0x5d543e){_0x4b8f5e[_0x7862('0x1e')](0x194);}return _0x5d543e;};}function handleError(_0x5f9d0d,_0x52cf0e){_0x52cf0e=_0x52cf0e||0x1f4;return function(_0x1739a1){logger[_0x7862('0x2b')](_0x1739a1[_0x7862('0x2c')]);if(_0x1739a1[_0x7862('0x2d')]){delete _0x1739a1[_0x7862('0x2d')];}_0x5f9d0d[_0x7862('0x1f')](_0x52cf0e)[_0x7862('0x2e')](_0x1739a1);};}exports[_0x7862('0x2f')]=function(_0x2f0139,_0x2d6703,_0x2e1b88){if(!_0x2f0139[_0x7862('0x30')][_0x7862('0x31')](_0x7862('0x32'))&&!_0x2f0139[_0x7862('0x30')]['hasOwnProperty'](_0x7862('0x33'))){throw new db[(_0x7862('0x34'))][(_0x7862('0x35'))](_0x7862('0x36'));}else{if(_0x2f0139[_0x7862('0x30')][_0x7862('0x31')](_0x7862('0x33'))&&!_0x2f0139[_0x7862('0x30')][_0x7862('0x31')](_0x7862('0x37'))){throw new db[(_0x7862('0x34'))][(_0x7862('0x35'))](_0x7862('0x38'));}if(!_0x2f0139[_0x7862('0x30')]['hasOwnProperty'](_0x7862('0x39'))){throw new db['Sequelize'][(_0x7862('0x35'))](_0x7862('0x3a'));}else{try{var _0x2f4769=JSON['parse'](_0x2f0139[_0x7862('0x30')]['recipients']);}catch(_0x1c7108){logger[_0x7862('0x2b')](_0x1c7108);throw new db['Sequelize'][(_0x7862('0x35'))](_0x7862('0x3b'));}var _0x412e87=['chatqueue',_0x7862('0x3c'),_0x7862('0x3d'),'openchannelqueue',_0x7862('0x3e'),_0x7862('0x3f'),'whatsappqueue',_0x7862('0x40'),_0x7862('0x41')];if(_[_0x7862('0x42')](_0x2f4769,function(_0x12a8f5){return!_[_0x7862('0x43')](_0x412e87,_0x12a8f5[_0x7862('0x44')][_0x7862('0x45')]());})){throw new db['Sequelize'][(_0x7862('0x35'))](_0x7862('0x46'));}}}var _0x2219c2={};_0x2219c2['senderName']=_0x2f0139[_0x7862('0x30')]['hasOwnProperty']('senderName')?_0x2f0139[_0x7862('0x30')][_0x7862('0x47')]:_0x2f0139[_0x7862('0x41')][_0x7862('0x48')];_0x2219c2[_0x7862('0x49')]=_['isEmpty'](_0x2f0139[_0x7862('0x30')]['recipientsDescription'])?null:_0x2f0139['body'][_0x7862('0x49')];_0x2219c2[_0x7862('0x4a')]=_0x2f0139[_0x7862('0x30')][_0x7862('0x4a')]||![];_0x2219c2[_0x7862('0x4b')]=_0x2f0139[_0x7862('0x41')]['id'];return getContent(_0x2f0139['body'])[_0x7862('0x29')](function(_0x144c9f){_0x2219c2[_0x7862('0x30')]=_0x144c9f;return getRecipients(_0x2f4769);})['then'](function(_0x292fab){_0x2219c2[_0x7862('0x4c')]=_[_0x7862('0x4d')](_0x292fab)['join'](',');return db[_0x7862('0x4e')][_0x7862('0x4f')](function(_0x1e5412){return db[_0x7862('0x50')]['create'](_0x2219c2,{'raw':!![],'transaction':_0x1e5412})[_0x7862('0x29')](function(_0x5935d3){var _0x4bb185={'sender':_0x2219c2[_0x7862('0x47')],'description':_0x2219c2['recipientsDescription'],'content':_0x2219c2[_0x7862('0x30')],'beep':_0x2219c2[_0x7862('0x4a')]};_0x292fab[_0x7862('0x51')](function(_0x46f52d){_0x4bb185[_0x7862('0x52')]=_0x46f52d;socket[_0x7862('0x53')](_0x7862('0x54'),_0x4bb185);});return _0x5935d3;});});})['then'](respondWithResult(_0x2d6703,0xc9))[_0x7862('0x55')](handleError(_0x2d6703,null));};function getContent(_0x12ca25){return new BPromise(function(_0x4004d8,_0x3a03a8){if(_0x12ca25['text']){_0x4004d8(_0x12ca25[_0x7862('0x32')]);return;}return db[_0x7862('0x56')][_0x7862('0x57')]({'attributes':[_0x7862('0x58')],'where':{'id':_0x12ca25[_0x7862('0x33')]},'raw':!![]})[_0x7862('0x29')](function(_0x39ef54){if(!_0x39ef54)throw new db[(_0x7862('0x34'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1b4fef=Mustache[_0x7862('0x59')](_0x39ef54[_0x7862('0x58')],_0x12ca25[_0x7862('0x37')]);_0x4004d8(_0x1b4fef);})[_0x7862('0x55')](function(_0x429b6b){_0x3a03a8(_0x429b6b);});});}function getRecipients(_0x3702b7){return new BPromise(function(_0x22d4c6,_0x16af16){var _0x461943=[];var _0x3b3838=[];_0x3702b7[_0x7862('0x51')](function(_0x20272d){var _0x218a00=_['startCase'](_0x20272d[_0x7862('0x44')][_0x7862('0x45')]());if(_0x218a00===_0x7862('0x5a')){_0x461943=_[_0x7862('0x5b')](_0x461943,_0x20272d[_0x7862('0x5c')]);}else{if(_[_0x7862('0x43')](_0x218a00,_0x7862('0x5d')))_0x218a00=_0x218a00[_0x7862('0x5e')]('queue',_0x7862('0x5f'));_0x20272d[_0x7862('0x5c')][_0x7862('0x51')](function(_0x56f4e8){_0x3b3838[_0x7862('0x60')](getAgents(_0x218a00,_0x56f4e8));});}});return BPromise[_0x7862('0x61')](_0x3b3838)[_0x7862('0x29')](function(_0x595629){_0x461943=_[_0x7862('0x5b')](_0x461943,_[_0x7862('0x62')](_0x595629));_0x22d4c6(_0x461943);})['catch'](function(_0x58260a){_0x16af16(_0x58260a);});});}function getAgents(_0x3adf98,_0x1eb219){return new BPromise(function(_0x28d9f7,_0x52a5ee){return db[_0x3adf98][_0x7862('0x57')]({'where':{'id':_0x1eb219}})[_0x7862('0x29')](function(_0x8b9594){return _0x8b9594['getAgents']({'attributes':['id'],'raw':!![]})[_0x7862('0x29')](function(_0x2c597c){var _0x6872d=_[_0x7862('0x63')](_0x2c597c,'id');_0x28d9f7(_0x6872d);});})[_0x7862('0x55')](function(_0x51b43f){_0x52a5ee(_0x51b43f);});});} \ No newline at end of file +var _0x7a4e=['zip-dir','request-promise','moment','mustache','util','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','then','sendStatus','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','parse','chatqueue','faxqueue','mailqueue','smsqueue','whatsappqueue','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','Queue','push','flatten','eml-format'];(function(_0x297220,_0x49bec5){var _0x532a3e=function(_0x117fd2){while(--_0x117fd2){_0x297220['push'](_0x297220['shift']());}};_0x532a3e(++_0x49bec5);}(_0x7a4e,0x1e4));var _0xe7a4=function(_0x11c3f7,_0x51be41){_0x11c3f7=_0x11c3f7-0x0;var _0x234af2=_0x7a4e[_0x11c3f7];return _0x234af2;};'use strict';var emlformat=require(_0xe7a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7a4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7a4('0x2'));var moment=require(_0xe7a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe7a4('0x4'));var util=require(_0xe7a4('0x5'));var path=require('path');var sox=require(_0xe7a4('0x6'));var csv=require(_0xe7a4('0x7'));var ejs=require(_0xe7a4('0x8'));var fs=require('fs');var fs_extra=require(_0xe7a4('0x9'));var _=require(_0xe7a4('0xa'));var squel=require(_0xe7a4('0xb'));var crypto=require(_0xe7a4('0xc'));var jsforce=require(_0xe7a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe7a4('0x7'));var querystring=require(_0xe7a4('0xe'));var Papa=require(_0xe7a4('0xf'));var Redis=require(_0xe7a4('0x10'));var authService=require(_0xe7a4('0x11'));var qs=require(_0xe7a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7a4('0x13'));var logger=require(_0xe7a4('0x14'))(_0xe7a4('0x15'));var utils=require(_0xe7a4('0x16'));var config=require(_0xe7a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7a4('0x18'))['db'];config[_0xe7a4('0x19')]=_[_0xe7a4('0x1a')](config[_0xe7a4('0x19')],{'host':_0xe7a4('0x1b'),'port':0x18eb});var socket=require(_0xe7a4('0x1c'))(new Redis(config['redis']));require(_0xe7a4('0x1d'))['register'](socket);function respondWithStatusCode(_0x193a89,_0x3e842a){_0x3e842a=_0x3e842a||0xcc;return function(_0x4088ef){if(_0x4088ef){return _0x193a89['sendStatus'](_0x3e842a);}return _0x193a89[_0xe7a4('0x1e')](_0x3e842a)[_0xe7a4('0x1f')]();};}function respondWithResult(_0x4ff7f4,_0x83f07a){_0x83f07a=_0x83f07a||0xc8;return function(_0x415e7){if(_0x415e7){return _0x4ff7f4[_0xe7a4('0x1e')](_0x83f07a)['json'](_0x415e7);}};}function respondWithFilteredResult(_0x5c9cc8,_0x1db9a8){return function(_0x4fff6e){if(_0x4fff6e){var _0x3cfa8f=typeof _0x1db9a8[_0xe7a4('0x20')]===_0xe7a4('0x21')&&typeof _0x1db9a8[_0xe7a4('0x22')]===_0xe7a4('0x21');var _0xc7fd47=_0x4fff6e[_0xe7a4('0x23')];var _0x16bd23=_0x3cfa8f?0x0:_0x1db9a8[_0xe7a4('0x20')];var _0x412859=_0x3cfa8f?_0x4fff6e[_0xe7a4('0x23')]:_0x1db9a8[_0xe7a4('0x20')]+_0x1db9a8[_0xe7a4('0x22')];var _0x5d3d77;if(_0x412859>=_0xc7fd47){_0x412859=_0xc7fd47;_0x5d3d77=0xc8;}else{_0x5d3d77=0xce;}_0x5c9cc8[_0xe7a4('0x1e')](_0x5d3d77);return _0x5c9cc8['set'](_0xe7a4('0x24'),_0x16bd23+'-'+_0x412859+'/'+_0xc7fd47)[_0xe7a4('0x25')](_0x4fff6e);}return null;};}function patchUpdates(_0x2d3888){return function(_0x2d5ab8){try{jsonpatch['apply'](_0x2d5ab8,_0x2d3888,!![]);}catch(_0x345141){return BPromise[_0xe7a4('0x26')](_0x345141);}return _0x2d5ab8[_0xe7a4('0x27')]();};}function saveUpdates(_0x24c6ef,_0x2b846a){return function(_0x39b504){if(_0x39b504){return _0x39b504['update'](_0x24c6ef)['then'](function(_0x5937a9){return _0x5937a9;});}return null;};}function removeEntity(_0x24a1f1,_0x56c464){return function(_0x5c2409){if(_0x5c2409){return _0x5c2409[_0xe7a4('0x28')]()[_0xe7a4('0x29')](function(){_0x24a1f1['status'](0xcc)[_0xe7a4('0x1f')]();});}};}function handleEntityNotFound(_0x2e18b7,_0x403026){return function(_0x40fae8){if(!_0x40fae8){_0x2e18b7[_0xe7a4('0x2a')](0x194);}return _0x40fae8;};}function handleError(_0x12265b,_0xace669){_0xace669=_0xace669||0x1f4;return function(_0x5ab30d){logger[_0xe7a4('0x2b')](_0x5ab30d[_0xe7a4('0x2c')]);if(_0x5ab30d[_0xe7a4('0x2d')]){delete _0x5ab30d[_0xe7a4('0x2d')];}_0x12265b[_0xe7a4('0x1e')](_0xace669)[_0xe7a4('0x2e')](_0x5ab30d);};}exports[_0xe7a4('0x2f')]=function(_0x28cac0,_0x29d384,_0x588aef){if(!_0x28cac0['body'][_0xe7a4('0x30')]('text')&&!_0x28cac0[_0xe7a4('0x31')]['hasOwnProperty'](_0xe7a4('0x32'))){throw new db['Sequelize'][(_0xe7a4('0x33'))](_0xe7a4('0x34'));}else{if(_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x30')](_0xe7a4('0x32'))&&!_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x30')](_0xe7a4('0x35'))){throw new db['Sequelize'][(_0xe7a4('0x33'))](_0xe7a4('0x36'));}if(!_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x30')](_0xe7a4('0x37'))){throw new db[(_0xe7a4('0x38'))][(_0xe7a4('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0xb4d074=JSON[_0xe7a4('0x39')](_0x28cac0[_0xe7a4('0x31')]['recipients']);}catch(_0x3b2a92){logger[_0xe7a4('0x2b')](_0x3b2a92);throw new db[(_0xe7a4('0x38'))][(_0xe7a4('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x35381d=[_0xe7a4('0x3a'),_0xe7a4('0x3b'),_0xe7a4('0x3c'),'openchannelqueue',_0xe7a4('0x3d'),'voicequeue',_0xe7a4('0x3e'),'team',_0xe7a4('0x3f')];if(_[_0xe7a4('0x40')](_0xb4d074,function(_0x592b34){return!_[_0xe7a4('0x41')](_0x35381d,_0x592b34['model'][_0xe7a4('0x42')]());})){throw new db[(_0xe7a4('0x38'))][(_0xe7a4('0x33'))](_0xe7a4('0x43'));}}}var _0x379380={};_0x379380[_0xe7a4('0x44')]=_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x30')]('senderName')?_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x44')]:_0x28cac0[_0xe7a4('0x3f')][_0xe7a4('0x45')];_0x379380[_0xe7a4('0x46')]=_['isEmpty'](_0x28cac0[_0xe7a4('0x31')]['recipientsDescription'])?null:_0x28cac0[_0xe7a4('0x31')][_0xe7a4('0x46')];_0x379380[_0xe7a4('0x47')]=_0x28cac0[_0xe7a4('0x31')]['beep']||![];_0x379380[_0xe7a4('0x48')]=_0x28cac0['user']['id'];return getContent(_0x28cac0[_0xe7a4('0x31')])['then'](function(_0x1d96ca){_0x379380[_0xe7a4('0x31')]=_0x1d96ca;return getRecipients(_0xb4d074);})[_0xe7a4('0x29')](function(_0x12619a){_0x379380[_0xe7a4('0x49')]=_[_0xe7a4('0x4a')](_0x12619a)[_0xe7a4('0x4b')](',');return db[_0xe7a4('0x4c')]['transaction'](function(_0x23c32b){return db[_0xe7a4('0x4d')]['create'](_0x379380,{'raw':!![],'transaction':_0x23c32b})[_0xe7a4('0x29')](function(_0x198f61){var _0x3aabc3={'sender':_0x379380[_0xe7a4('0x44')],'description':_0x379380[_0xe7a4('0x46')],'content':_0x379380[_0xe7a4('0x31')],'beep':_0x379380[_0xe7a4('0x47')]};_0x12619a[_0xe7a4('0x4e')](function(_0x26fc32){_0x3aabc3[_0xe7a4('0x4f')]=_0x26fc32;socket[_0xe7a4('0x50')](_0xe7a4('0x51'),_0x3aabc3);});return _0x198f61;});});})[_0xe7a4('0x29')](respondWithResult(_0x29d384,0xc9))[_0xe7a4('0x52')](handleError(_0x29d384,null));};function getContent(_0x5138a3){return new BPromise(function(_0x5aa181,_0x230fc4){if(_0x5138a3[_0xe7a4('0x53')]){_0x5aa181(_0x5138a3['text']);return;}return db[_0xe7a4('0x54')][_0xe7a4('0x55')]({'attributes':[_0xe7a4('0x56')],'where':{'id':_0x5138a3[_0xe7a4('0x32')]},'raw':!![]})[_0xe7a4('0x29')](function(_0xdcbcf3){if(!_0xdcbcf3)throw new db[(_0xe7a4('0x38'))]['ValidationError'](_0xe7a4('0x57'));var _0x147a58=Mustache[_0xe7a4('0x58')](_0xdcbcf3['html'],_0x5138a3['view']);_0x5aa181(_0x147a58);})[_0xe7a4('0x52')](function(_0x2f22c8){_0x230fc4(_0x2f22c8);});});}function getRecipients(_0x45ef97){return new BPromise(function(_0x31d741,_0x40dfc7){var _0x5270c2=[];var _0x40f365=[];_0x45ef97['forEach'](function(_0xcc52b8){var _0x3c33a5=_[_0xe7a4('0x59')](_0xcc52b8['model'][_0xe7a4('0x42')]());if(_0x3c33a5===_0xe7a4('0x5a')){_0x5270c2=_[_0xe7a4('0x5b')](_0x5270c2,_0xcc52b8[_0xe7a4('0x5c')]);}else{if(_[_0xe7a4('0x41')](_0x3c33a5,_0xe7a4('0x5d')))_0x3c33a5=_0x3c33a5['replace'](_0xe7a4('0x5d'),_0xe7a4('0x5e'));_0xcc52b8['ids'][_0xe7a4('0x4e')](function(_0x2bf12d){_0x40f365[_0xe7a4('0x5f')](getAgents(_0x3c33a5,_0x2bf12d));});}});return BPromise['all'](_0x40f365)[_0xe7a4('0x29')](function(_0x18f949){_0x5270c2=_[_0xe7a4('0x5b')](_0x5270c2,_[_0xe7a4('0x60')](_0x18f949));_0x31d741(_0x5270c2);})[_0xe7a4('0x52')](function(_0x45a036){_0x40dfc7(_0x45a036);});});}function getAgents(_0xe3f1ea,_0x357651){return new BPromise(function(_0x5b6466,_0x467ed9){return db[_0xe3f1ea][_0xe7a4('0x55')]({'where':{'id':_0x357651}})[_0xe7a4('0x29')](function(_0x21e0a5){return _0x21e0a5['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x457b74){var _0x34569a=_['map'](_0x457b74,'id');_0x5b6466(_0x34569a);});})['catch'](function(_0x335fa3){_0x467ed9(_0x335fa3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3f49093..41963f2 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 _0xba59=['setMaxListeners','remove','emit','events','../../mysqldb','UserNotification'];(function(_0x3d636a,_0x32af5c){var _0x1449e0=function(_0x4f31a2){while(--_0x4f31a2){_0x3d636a['push'](_0x3d636a['shift']());}};_0x1449e0(++_0x32af5c);}(_0xba59,0xe1));var _0x9ba5=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0xba59[_0x4ea6af];return _0x4cb1e6;};'use strict';var EventEmitter=require(_0x9ba5('0x0'));var UserNotification=require(_0x9ba5('0x1'))['db'][_0x9ba5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9ba5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9ba5('0x4')};function emitEvent(_0x488850){return function(_0x582d53,_0xca5a43,_0x2812b7){UserNotificationEvents[_0x9ba5('0x5')](_0x488850+':'+_0x582d53['id'],_0x582d53);UserNotificationEvents['emit'](_0x488850,_0x582d53);_0x2812b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x9999=['emit','hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x9999,0x73));var _0x9999=function(_0x1cf11f,_0x21a416){_0x1cf11f=_0x1cf11f-0x0;var _0x10c6b5=_0x9999[_0x1cf11f];return _0x10c6b5;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9999('0x0'))['db'][_0x9999('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9999('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9999('0x3'),'afterDestroy':_0x9999('0x4')};function emitEvent(_0x17c140){return function(_0x17f538,_0x22af47,_0x288289){UserNotificationEvents[_0x9999('0x5')](_0x17c140+':'+_0x17f538['id'],_0x17f538);UserNotificationEvents[_0x9999('0x5')](_0x17c140,_0x17f538);_0x288289(null);};}for(var e in events){if(events[_0x9999('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9999('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 1b46e59..c0447ba 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 _0xfa2b=['request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xfa2b,0x1bc));var _0xbfa2=function(_0x13a5f9,_0x66be8b){_0x13a5f9=_0x13a5f9-0x0;var _0x198bf2=_0xfa2b[_0x13a5f9];return _0x198bf2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbfa2('0x0'))(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rp=require(_0xbfa2('0x4'));var fs=require('fs');var path=require(_0xbfa2('0x5'));var rimraf=require('rimraf');var config=require(_0xbfa2('0x6'));var attributes=require(_0xbfa2('0x7'));module[_0xbfa2('0x8')]=function(_0x10d015,_0x55debb){return _0x10d015[_0xbfa2('0x9')](_0xbfa2('0xa'),attributes,{'tableName':_0xbfa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfa2('0xc'),'collate':_0xbfa2('0xd')});}; \ No newline at end of file +var _0xc0aa=['userNotifications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','UserNotification'];(function(_0x414658,_0x32591f){var _0x3f33b8=function(_0x1ce3f3){while(--_0x1ce3f3){_0x414658['push'](_0x414658['shift']());}};_0x3f33b8(++_0x32591f);}(_0xc0aa,0x15f));var _0xac0a=function(_0x542083,_0x48b819){_0x542083=_0x542083-0x0;var _0x3bca9e=_0xc0aa[_0x542083];return _0x3bca9e;};'use strict';var _=require('lodash');var util=require(_0xac0a('0x0'));var logger=require('../../config/logger')(_0xac0a('0x1'));var moment=require(_0xac0a('0x2'));var BPromise=require(_0xac0a('0x3'));var rp=require(_0xac0a('0x4'));var fs=require('fs');var path=require(_0xac0a('0x5'));var rimraf=require(_0xac0a('0x6'));var config=require(_0xac0a('0x7'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x3955cd,_0x1ebf58){return _0x3955cd['define'](_0xac0a('0x8'),attributes,{'tableName':_0xac0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac0a('0xa'),'collate':_0xac0a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index a840cd1..7c8aae1 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 _0xfac0=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x20b563,_0x1325a1){var _0x3803b1=function(_0x4a9ba9){while(--_0x4a9ba9){_0x20b563['push'](_0x20b563['shift']());}};_0x3803b1(++_0x1325a1);}(_0xfac0,0x1d8));var _0x0fac=function(_0xddda8a,_0x18e398){_0xddda8a=_0xddda8a-0x0;var _0x1fcb3d=_0xfac0[_0xddda8a];return _0x1fcb3d;};'use strict';var _=require('lodash');var util=require(_0x0fac('0x0'));var moment=require(_0x0fac('0x1'));var BPromise=require(_0x0fac('0x2'));var rs=require(_0x0fac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fac('0x4'))['db'];var utils=require(_0x0fac('0x5'));var logger=require('../../config/logger')(_0x0fac('0x6'));var config=require(_0x0fac('0x7'));var jayson=require(_0x0fac('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fac('0x9')]=_['defaults'](config[_0x0fac('0x9')],{'host':_0x0fac('0xa'),'port':0x18eb});var socket=require(_0x0fac('0xb'))(new Redis(config[_0x0fac('0x9')]));require(_0x0fac('0xc'))[_0x0fac('0xd')](socket);function respondWithRpcPromise(_0x2e99e1,_0x5dfc6e,_0x3badcb){return new BPromise(function(_0x4e4727,_0x24e193){return client[_0x0fac('0xe')](_0x2e99e1,_0x3badcb)[_0x0fac('0xf')](function(_0x39aa69){logger[_0x0fac('0x10')](_0x0fac('0x11'),_0x5dfc6e,_0x0fac('0x12'));logger['debug'](_0x0fac('0x13'),_0x5dfc6e,_0x0fac('0x12'),JSON['stringify'](_0x39aa69));if(_0x39aa69[_0x0fac('0x14')]){if(_0x39aa69[_0x0fac('0x14')][_0x0fac('0x15')]===0x1f4){logger[_0x0fac('0x14')](_0x0fac('0x11'),_0x5dfc6e,_0x39aa69[_0x0fac('0x14')]['message']);return _0x24e193(_0x39aa69[_0x0fac('0x14')][_0x0fac('0x16')]);}logger[_0x0fac('0x14')]('UserNotification,\x20%s,\x20%s',_0x5dfc6e,_0x39aa69[_0x0fac('0x14')][_0x0fac('0x16')]);return _0x4e4727(_0x39aa69[_0x0fac('0x14')][_0x0fac('0x16')]);}else{logger[_0x0fac('0x10')](_0x0fac('0x11'),_0x5dfc6e,_0x0fac('0x12'));_0x4e4727(_0x39aa69[_0x0fac('0x17')][_0x0fac('0x16')]);}})[_0x0fac('0x18')](function(_0x2859b8){logger['error'](_0x0fac('0x11'),_0x5dfc6e,_0x2859b8);_0x24e193(_0x2859b8);});});} \ No newline at end of file +var _0x4dd9=['request\x20sent','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0xdf582f,_0x4ffee0){var _0xc0b21d=function(_0x466e0b){while(--_0x466e0b){_0xdf582f['push'](_0xdf582f['shift']());}};_0xc0b21d(++_0x4ffee0);}(_0x4dd9,0x19d));var _0x94dd=function(_0x1a37b2,_0x584b3b){_0x1a37b2=_0x1a37b2-0x0;var _0x130c75=_0x4dd9[_0x1a37b2];return _0x130c75;};'use strict';var _=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var moment=require(_0x94dd('0x2'));var BPromise=require(_0x94dd('0x3'));var rs=require(_0x94dd('0x4'));var fs=require('fs');var Redis=require(_0x94dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x94dd('0x6'));var logger=require('../../config/logger')(_0x94dd('0x7'));var config=require(_0x94dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94dd('0x9')]['http']({'port':0x232a});config[_0x94dd('0xa')]=_[_0x94dd('0xb')](config[_0x94dd('0xa')],{'host':_0x94dd('0xc'),'port':0x18eb});var socket=require(_0x94dd('0xd'))(new Redis(config[_0x94dd('0xa')]));require(_0x94dd('0xe'))['register'](socket);function respondWithRpcPromise(_0x126c8f,_0x5952c2,_0x1db5c6){return new BPromise(function(_0x31429c,_0x53bdba){return client['request'](_0x126c8f,_0x1db5c6)[_0x94dd('0xf')](function(_0x166a8f){logger['info'](_0x94dd('0x10'),_0x5952c2,'request\x20sent');logger[_0x94dd('0x11')](_0x94dd('0x12'),_0x5952c2,_0x94dd('0x13'),JSON['stringify'](_0x166a8f));if(_0x166a8f[_0x94dd('0x14')]){if(_0x166a8f[_0x94dd('0x14')][_0x94dd('0x15')]===0x1f4){logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x5952c2,_0x166a8f[_0x94dd('0x14')]['message']);return _0x53bdba(_0x166a8f[_0x94dd('0x14')][_0x94dd('0x16')]);}logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x5952c2,_0x166a8f[_0x94dd('0x14')][_0x94dd('0x16')]);return _0x31429c(_0x166a8f[_0x94dd('0x14')][_0x94dd('0x16')]);}else{logger[_0x94dd('0x17')](_0x94dd('0x10'),_0x5952c2,_0x94dd('0x13'));_0x31429c(_0x166a8f['result'][_0x94dd('0x16')]);}})['catch'](function(_0x17b388){logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x5952c2,_0x17b388);_0x53bdba(_0x17b388);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index dc1c1bd..1feca8b 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 _0x47e2=['register','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x47e2,0x1c2));var _0x247e=function(_0x26f544,_0x3ef486){_0x26f544=_0x26f544-0x0;var _0x4ec784=_0x47e2[_0x26f544];return _0x4ec784;};'use strict';var UserNotificationEvents=require(_0x247e('0x0'));var events=[_0x247e('0x1'),_0x247e('0x2'),_0x247e('0x3')];function createListener(_0x1aa7ba,_0x587da0){return function(_0xe4a7da){_0x587da0[_0x247e('0x4')](_0x1aa7ba,_0xe4a7da);};}function removeListener(_0x207e54,_0x59c65b){return function(){UserNotificationEvents[_0x247e('0x5')](_0x207e54,_0x59c65b);};}exports[_0x247e('0x6')]=function(_0xf33dff){for(var _0x1d3663=0x0,_0x2970b1=events['length'];_0x1d3663<_0x2970b1;_0x1d3663++){var _0x36efdf=events[_0x1d3663];var _0x4d93da=createListener(_0x247e('0x7')+_0x36efdf,_0xf33dff);UserNotificationEvents['on'](_0x36efdf,_0x4d93da);}}; \ No newline at end of file +var _0x3bd5=['./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x455893,_0x909838){var _0x3851e8=function(_0x32ac8a){while(--_0x32ac8a){_0x455893['push'](_0x455893['shift']());}};_0x3851e8(++_0x909838);}(_0x3bd5,0xbd));var _0x53bd=function(_0x3f01a9,_0x3487ea){_0x3f01a9=_0x3f01a9-0x0;var _0x26ec34=_0x3bd5[_0x3f01a9];return _0x26ec34;};'use strict';var UserNotificationEvents=require(_0x53bd('0x0'));var events=[_0x53bd('0x1'),_0x53bd('0x2'),_0x53bd('0x3')];function createListener(_0x59e7de,_0x377527){return function(_0x4cb0f3){_0x377527[_0x53bd('0x4')](_0x59e7de,_0x4cb0f3);};}function removeListener(_0x45a8f8,_0x4b83ad){return function(){UserNotificationEvents[_0x53bd('0x5')](_0x45a8f8,_0x4b83ad);};}exports[_0x53bd('0x6')]=function(_0x46dd48){for(var _0x58d5ab=0x0,_0x4ceadb=events['length'];_0x58d5ab<_0x4ceadb;_0x58d5ab++){var _0x1e6ec4=events[_0x58d5ab];var _0x472d98=createListener('userNotification:'+_0x1e6ec4,_0x46dd48);UserNotificationEvents['on'](_0x1e6ec4,_0x472d98);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f00c955..6623024 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x30b2fd,_0x5537fb){var _0x48f68c=function(_0x40f438){while(--_0x40f438){_0x30b2fd['push'](_0x30b2fd['shift']());}};_0x48f68c(++_0x5537fb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1ee4d6,_0x52691d){var _0x485a99=function(_0x1e6838){while(--_0x1e6838){_0x1ee4d6['push'](_0x1ee4d6['shift']());}};_0x485a99(++_0x52691d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xcb91[_0x36d25e];return _0x4b95b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index dc9581f..90aac75 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 _0xd59d=['INTEGER','sequelize'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xd59d,0x81));var _0xdd59=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd59d[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xdd59('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdd59('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x106f=['sequelize','exports'];(function(_0x588cf2,_0x2e250a){var _0x437057=function(_0x3c75cb){while(--_0x3c75cb){_0x588cf2['push'](_0x588cf2['shift']());}};_0x437057(++_0x2e250a);}(_0x106f,0x162));var _0xf106=function(_0x428145,_0x4c46f4){_0x428145=_0x428145-0x0;var _0x56735e=_0x106f[_0x428145];return _0x56735e;};'use strict';var Sequelize=require(_0xf106('0x0'));module[_0xf106('0x1')]={'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 ce2b340..abfb931 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 _0xfa6e=['../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1d45c2,_0x4565b9){var _0x28b191=function(_0x50555c){while(--_0x50555c){_0x1d45c2['push'](_0x1d45c2['shift']());}};_0x28b191(++_0x4565b9);}(_0xfa6e,0x1f0));var _0xefa6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfa6e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xefa6('0x0'));var util=require(_0xefa6('0x1'));var logger=require(_0xefa6('0x2'))(_0xefa6('0x3'));var moment=require('moment');var BPromise=require(_0xefa6('0x4'));var rp=require(_0xefa6('0x5'));var fs=require('fs');var path=require(_0xefa6('0x6'));var rimraf=require(_0xefa6('0x7'));var config=require(_0xefa6('0x8'));var attributes=require(_0xefa6('0x9'));module['exports']=function(_0x5a82c3,_0x545198){return _0x5a82c3['define'](_0xefa6('0xa'),attributes,{'tableName':_0xefa6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d9=['lodash','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0xc91a95,_0x1e4a21){var _0x38bbec=function(_0x2a9f21){while(--_0x2a9f21){_0xc91a95['push'](_0xc91a95['shift']());}};_0x38bbec(++_0x1e4a21);}(_0x46d9,0x1ec));var _0x946d=function(_0x1f232a,_0xdfff04){_0x1f232a=_0x1f232a-0x0;var _0xddf20e=_0x46d9[_0x1f232a];return _0xddf20e;};'use strict';var _=require(_0x946d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x946d('0x1'));var moment=require(_0x946d('0x2'));var BPromise=require(_0x946d('0x3'));var rp=require(_0x946d('0x4'));var fs=require('fs');var path=require(_0x946d('0x5'));var rimraf=require(_0x946d('0x6'));var config=require('../../config/environment');var attributes=require(_0x946d('0x7'));module[_0x946d('0x8')]=function(_0x12251e,_0x1e9087){return _0x12251e[_0x946d('0x9')](_0x946d('0xa'),attributes,{'tableName':_0x946d('0xb'),'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 e572c61..654ea07 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 _0xabb2=['../../config/logger','rpc','jayson/promise','http','request','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5de9a4,_0x20c4a2){var _0x38cb89=function(_0x5d0bf9){while(--_0x5d0bf9){_0x5de9a4['push'](_0x5de9a4['shift']());}};_0x38cb89(++_0x20c4a2);}(_0xabb2,0xeb));var _0x2abb=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xabb2[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0x2abb('0x0'));var util=require(_0x2abb('0x1'));var moment=require(_0x2abb('0x2'));var BPromise=require(_0x2abb('0x3'));var rs=require(_0x2abb('0x4'));var fs=require('fs');var Redis=require(_0x2abb('0x5'));var db=require(_0x2abb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2abb('0x7'))(_0x2abb('0x8'));var config=require('../../config/environment');var jayson=require(_0x2abb('0x9'));var client=jayson['client'][_0x2abb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d700a,_0x4bf779,_0xfa9985){return new BPromise(function(_0x218970,_0x3d8e68){return client[_0x2abb('0xb')](_0x2d700a,_0xfa9985)['then'](function(_0x2d294f){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4bf779,_0x2abb('0xc'));logger[_0x2abb('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4bf779,_0x2abb('0xc'),JSON[_0x2abb('0xe')](_0x2d294f));if(_0x2d294f[_0x2abb('0xf')]){if(_0x2d294f[_0x2abb('0xf')][_0x2abb('0x10')]===0x1f4){logger[_0x2abb('0xf')](_0x2abb('0x11'),_0x4bf779,_0x2d294f[_0x2abb('0xf')][_0x2abb('0x12')]);return _0x3d8e68(_0x2d294f[_0x2abb('0xf')][_0x2abb('0x12')]);}logger['error'](_0x2abb('0x11'),_0x4bf779,_0x2d294f['error'][_0x2abb('0x12')]);return _0x218970(_0x2d294f[_0x2abb('0xf')][_0x2abb('0x12')]);}else{logger[_0x2abb('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4bf779,'request\x20sent');_0x218970(_0x2d294f[_0x2abb('0x14')][_0x2abb('0x12')]);}})[_0x2abb('0x15')](function(_0x2f99fb){logger[_0x2abb('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4bf779,_0x2f99fb);_0x3d8e68(_0x2f99fb);});});} \ No newline at end of file +var _0xd01d=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3cc6f4,_0xa34978){var _0x5eb574=function(_0x2b168e){while(--_0x2b168e){_0x3cc6f4['push'](_0x3cc6f4['shift']());}};_0x5eb574(++_0xa34978);}(_0xd01d,0x89));var _0xdd01=function(_0x1e622b,_0x2bc782){_0x1e622b=_0x1e622b-0x0;var _0x1dd8bb=_0xd01d[_0x1e622b];return _0x1dd8bb;};'use strict';var _=require(_0xdd01('0x0'));var util=require('util');var moment=require(_0xdd01('0x1'));var BPromise=require(_0xdd01('0x2'));var rs=require(_0xdd01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd01('0x4'));var logger=require(_0xdd01('0x5'))(_0xdd01('0x6'));var config=require(_0xdd01('0x7'));var jayson=require(_0xdd01('0x8'));var client=jayson[_0xdd01('0x9')][_0xdd01('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b6e8c,_0x54bd3c,_0x5735c9){return new BPromise(function(_0x4108d3,_0x210da9){return client[_0xdd01('0xb')](_0x7b6e8c,_0x5735c9)[_0xdd01('0xc')](function(_0x43fdac){logger[_0xdd01('0xd')](_0xdd01('0xe'),_0x54bd3c,_0xdd01('0xf'));logger['debug'](_0xdd01('0x10'),_0x54bd3c,'request\x20sent',JSON[_0xdd01('0x11')](_0x43fdac));if(_0x43fdac[_0xdd01('0x12')]){if(_0x43fdac['error'][_0xdd01('0x13')]===0x1f4){logger[_0xdd01('0x12')](_0xdd01('0xe'),_0x54bd3c,_0x43fdac[_0xdd01('0x12')][_0xdd01('0x14')]);return _0x210da9(_0x43fdac[_0xdd01('0x12')][_0xdd01('0x14')]);}logger[_0xdd01('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x54bd3c,_0x43fdac[_0xdd01('0x12')][_0xdd01('0x14')]);return _0x4108d3(_0x43fdac['error'][_0xdd01('0x14')]);}else{logger[_0xdd01('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x54bd3c,'request\x20sent');_0x4108d3(_0x43fdac[_0xdd01('0x15')][_0xdd01('0x14')]);}})[_0xdd01('0x16')](function(_0x2fd071){logger['error'](_0xdd01('0xe'),_0x54bd3c,_0x2fd071);_0x210da9(_0x2fd071);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bea5a95..49bfbf4 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 _0xf776=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addSections','put','update','removeSections','delete','removeResources'];(function(_0x45e12b,_0x264b6a){var _0x1c147e=function(_0x1a0665){while(--_0x1a0665){_0x45e12b['push'](_0x45e12b['shift']());}};_0x1c147e(++_0x264b6a);}(_0xf776,0x169));var _0x6f77=function(_0x57c9ed,_0x1d5916){_0x57c9ed=_0x57c9ed-0x0;var _0x37b84c=_0xf776[_0x57c9ed];return _0x37b84c;};'use strict';var multer=require(_0x6f77('0x0'));var util=require('util');var path=require(_0x6f77('0x1'));var timeout=require(_0x6f77('0x2'));var express=require('express');var router=express[_0x6f77('0x3')]();var fs_extra=require(_0x6f77('0x4'));var auth=require(_0x6f77('0x5'));var interaction=require(_0x6f77('0x6'));var config=require('../../config/environment');var controller=require(_0x6f77('0x7'));router['get']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0x9')]);router[_0x6f77('0xa')](_0x6f77('0xb'),auth['isAuthenticated'](),controller[_0x6f77('0xc')]);router['get'](_0x6f77('0xd'),auth[_0x6f77('0x8')](),controller[_0x6f77('0xe')]);router[_0x6f77('0xa')]('/:id/sections',auth[_0x6f77('0x8')](),controller[_0x6f77('0xf')]);router[_0x6f77('0xa')](_0x6f77('0x10'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x11')]);router['post']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0x12')]);router[_0x6f77('0x13')](_0x6f77('0x14'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x15')]);router[_0x6f77('0x13')](_0x6f77('0x16'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x17')]);router[_0x6f77('0x13')](_0x6f77('0x10'),auth['isAuthenticated'](),controller['addResources']);router[_0x6f77('0x18')](_0x6f77('0xd'),auth['isAuthenticated'](),controller[_0x6f77('0x19')]);router['delete'](_0x6f77('0xd'),auth[_0x6f77('0x8')](),controller['destroy']);router['delete'](_0x6f77('0x16'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x1a')]);router[_0x6f77('0x1b')](_0x6f77('0x10'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x1c')]);module[_0x6f77('0x1d')]=router; \ No newline at end of file +var _0xefbd=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','get','show','getSections','post','create','clone','/:id/sections','addSections','/:id/resources','addResources','put','/:id','update','delete','destroy','removeSections','exports','multer','util'];(function(_0x326260,_0x5c2b17){var _0x1f05c7=function(_0x522f70){while(--_0x522f70){_0x326260['push'](_0x326260['shift']());}};_0x1f05c7(++_0x5c2b17);}(_0xefbd,0x15a));var _0xdefb=function(_0x30713e,_0x2c4cbe){_0x30713e=_0x30713e-0x0;var _0x37d6c2=_0xefbd[_0x30713e];return _0x37d6c2;};'use strict';var multer=require(_0xdefb('0x0'));var util=require(_0xdefb('0x1'));var path=require('path');var timeout=require(_0xdefb('0x2'));var express=require('express');var router=express[_0xdefb('0x3')]();var fs_extra=require(_0xdefb('0x4'));var auth=require(_0xdefb('0x5'));var interaction=require(_0xdefb('0x6'));var config=require(_0xdefb('0x7'));var controller=require(_0xdefb('0x8'));router['get']('/',auth[_0xdefb('0x9')](),controller[_0xdefb('0xa')]);router['get'](_0xdefb('0xb'),auth[_0xdefb('0x9')](),controller['describe']);router[_0xdefb('0xc')]('/:id',auth[_0xdefb('0x9')](),controller[_0xdefb('0xd')]);router[_0xdefb('0xc')]('/:id/sections',auth[_0xdefb('0x9')](),controller[_0xdefb('0xe')]);router[_0xdefb('0xc')]('/:id/resources',auth[_0xdefb('0x9')](),controller['getResources']);router[_0xdefb('0xf')]('/',auth['isAuthenticated'](),controller[_0xdefb('0x10')]);router['post']('/:id/clone',auth[_0xdefb('0x9')](),controller[_0xdefb('0x11')]);router['post'](_0xdefb('0x12'),auth[_0xdefb('0x9')](),controller[_0xdefb('0x13')]);router[_0xdefb('0xf')](_0xdefb('0x14'),auth['isAuthenticated'](),controller[_0xdefb('0x15')]);router[_0xdefb('0x16')](_0xdefb('0x17'),auth[_0xdefb('0x9')](),controller[_0xdefb('0x18')]);router[_0xdefb('0x19')](_0xdefb('0x17'),auth[_0xdefb('0x9')](),controller[_0xdefb('0x1a')]);router[_0xdefb('0x19')](_0xdefb('0x12'),auth[_0xdefb('0x9')](),controller[_0xdefb('0x1b')]);router['delete'](_0xdefb('0x14'),auth['isAuthenticated'](),controller['removeResources']);module[_0xdefb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c89fdaa..cee02e5 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 _0xe703=['name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','STRING'];(function(_0x2526e3,_0x5f22f8){var _0xcf6f48=function(_0x284491){while(--_0x284491){_0x2526e3['push'](_0x2526e3['shift']());}};_0xcf6f48(++_0x5f22f8);}(_0xe703,0x18e));var _0x3e70=function(_0x56ccd2,_0x1fbef1){_0x56ccd2=_0x56ccd2-0x0;var _0x341819=_0xe703[_0x56ccd2];return _0x341819;};'use strict';var Sequelize=require(_0x3e70('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e70('0x1')],'allowNull':![],'unique':_0x3e70('0x2')},'crudPermissions':{'type':Sequelize[_0x3e70('0x1')],'set':function(_0x2d77dc){this['setDataValue'](_0x3e70('0x3'),_0x2d77dc?_0x2d77dc[_0x3e70('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x3e70('0x5')](_0x3e70('0x3'))[_0x3e70('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3e70('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3e70('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4c5e=['exports','STRING','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize'];(function(_0x1ef18c,_0x32dce7){var _0x367e82=function(_0x28a5fb){while(--_0x28a5fb){_0x1ef18c['push'](_0x1ef18c['shift']());}};_0x367e82(++_0x32dce7);}(_0x4c5e,0x170));var _0xe4c5=function(_0x592cb1,_0x15c8b4){_0x592cb1=_0x592cb1-0x0;var _0x18f79b=_0x4c5e[_0x592cb1];return _0x18f79b;};'use strict';var Sequelize=require(_0xe4c5('0x0'));module[_0xe4c5('0x1')]={'name':{'type':Sequelize[_0xe4c5('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xe4c5('0x2')],'set':function(_0x3df012){this[_0xe4c5('0x3')]('crudPermissions',_0x3df012?_0x3df012[_0xe4c5('0x4')](''):[]);},'get':function(){return this[_0xe4c5('0x5')](_0xe4c5('0x6'))?this[_0xe4c5('0x5')](_0xe4c5('0x6'))[_0xe4c5('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe4c5('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe4c5('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c3813e9..f8eed6f 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 _0xf4c9=['zip-dir','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','register','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','UserProfile','includeAll','include','rows','catch','show','keys','find','create','body','clone','get','omit','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','params','each','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId','Resources','describe','removeSections','ids','getSections','includes','enabled','subsections','push','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf'];(function(_0x3f1937,_0x37d49c){var _0x46733e=function(_0x32e9df){while(--_0x32e9df){_0x3f1937['push'](_0x3f1937['shift']());}};_0x46733e(++_0x37d49c);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf4c9[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f4c('0x3'));var moment=require('moment');var BPromise=require(_0x9f4c('0x4'));var Mustache=require(_0x9f4c('0x5'));var util=require(_0x9f4c('0x6'));var path=require('path');var sox=require(_0x9f4c('0x7'));var csv=require('to-csv');var ejs=require(_0x9f4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0x9'));var jsforce=require(_0x9f4c('0xa'));var deskjs=require(_0x9f4c('0xb'));var toCsv=require(_0x9f4c('0xc'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require('ioredis');var authService=require(_0x9f4c('0xf'));var qs=require(_0x9f4c('0x10'));var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require(_0x9f4c('0x13'))(_0x9f4c('0x14'));var utils=require(_0x9f4c('0x15'));var config=require(_0x9f4c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9f4c('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f4c('0x18'))(new Redis(config['redis']));require('./userProfile.socket')[_0x9f4c('0x19')](socket);function respondWithStatusCode(_0x4ce352,_0x4d68ff){_0x4d68ff=_0x4d68ff||0xcc;return function(_0x1bcf14){if(_0x1bcf14){return _0x4ce352['sendStatus'](_0x4d68ff);}return _0x4ce352[_0x9f4c('0x1a')](_0x4d68ff)[_0x9f4c('0x1b')]();};}function respondWithResult(_0x46abfe,_0x1059e1){_0x1059e1=_0x1059e1||0xc8;return function(_0x182295){if(_0x182295){return _0x46abfe[_0x9f4c('0x1a')](_0x1059e1)['json'](_0x182295);}};}function respondWithFilteredResult(_0x2be1ba,_0x1b5146){return function(_0x143335){if(_0x143335){var _0x30da19=typeof _0x1b5146[_0x9f4c('0x1c')]==='undefined'&&typeof _0x1b5146[_0x9f4c('0x1d')]===_0x9f4c('0x1e');var _0x8efbfe=_0x143335['count'];var _0x4a33c7=_0x30da19?0x0:_0x1b5146['offset'];var _0x53d301=_0x30da19?_0x143335[_0x9f4c('0x1f')]:_0x1b5146['offset']+_0x1b5146['limit'];var _0x603a8d;if(_0x53d301>=_0x8efbfe){_0x53d301=_0x8efbfe;_0x603a8d=0xc8;}else{_0x603a8d=0xce;}_0x2be1ba[_0x9f4c('0x1a')](_0x603a8d);return _0x2be1ba['set'](_0x9f4c('0x20'),_0x4a33c7+'-'+_0x53d301+'/'+_0x8efbfe)[_0x9f4c('0x21')](_0x143335);}return null;};}function patchUpdates(_0x57b636){return function(_0x27a175){try{jsonpatch['apply'](_0x27a175,_0x57b636,!![]);}catch(_0x5e6632){return BPromise[_0x9f4c('0x22')](_0x5e6632);}return _0x27a175['save']();};}function saveUpdates(_0xa4a8e9,_0x30d9f6){return function(_0x2a8729){if(_0x2a8729){return _0x2a8729[_0x9f4c('0x23')](_0xa4a8e9)[_0x9f4c('0x24')](function(_0x10c9a9){return _0x10c9a9;});}return null;};}function removeEntity(_0x53c2d3,_0x25b775){return function(_0x1c2417){if(_0x1c2417){return _0x1c2417[_0x9f4c('0x25')]()[_0x9f4c('0x24')](function(){_0x53c2d3[_0x9f4c('0x1a')](0xcc)[_0x9f4c('0x1b')]();});}};}function handleEntityNotFound(_0x945f00,_0xadd84c){return function(_0x3bcc3f){if(!_0x3bcc3f){_0x945f00[_0x9f4c('0x26')](0x194);}return _0x3bcc3f;};}function handleError(_0x4712c7,_0x4f0d37){_0x4f0d37=_0x4f0d37||0x1f4;return function(_0x168ed8){logger[_0x9f4c('0x27')](_0x168ed8[_0x9f4c('0x28')]);if(_0x168ed8[_0x9f4c('0x29')]){delete _0x168ed8[_0x9f4c('0x29')];}_0x4712c7[_0x9f4c('0x1a')](_0x4f0d37)[_0x9f4c('0x2a')](_0x168ed8);};}exports[_0x9f4c('0x2b')]=function(_0x20d2f4,_0x2158ac){var _0x4e9b77={},_0x4b6d91={},_0x52ef31={'count':0x0,'rows':[]};var _0x101c13=_[_0x9f4c('0x2c')](db['UserProfile'][_0x9f4c('0x2d')],function(_0x8cd2b3){return{'name':_0x8cd2b3[_0x9f4c('0x2e')],'type':_0x8cd2b3['type']['key']};});_0x4b6d91[_0x9f4c('0x2f')]=_[_0x9f4c('0x2c')](_0x101c13,'name');_0x4b6d91[_0x9f4c('0x30')]=_['keys'](_0x20d2f4['query']);_0x4b6d91[_0x9f4c('0x31')]=_[_0x9f4c('0x32')](_0x4b6d91[_0x9f4c('0x2f')],_0x4b6d91[_0x9f4c('0x30')]);_0x4e9b77[_0x9f4c('0x33')]=_[_0x9f4c('0x32')](_0x4b6d91['model'],qs[_0x9f4c('0x34')](_0x20d2f4[_0x9f4c('0x30')][_0x9f4c('0x34')]));_0x4e9b77[_0x9f4c('0x33')]=_0x4e9b77[_0x9f4c('0x33')][_0x9f4c('0x35')]?_0x4e9b77[_0x9f4c('0x33')]:_0x4b6d91[_0x9f4c('0x2f')];if(!_0x20d2f4[_0x9f4c('0x30')][_0x9f4c('0x36')](_0x9f4c('0x37'))){_0x4e9b77[_0x9f4c('0x1d')]=qs[_0x9f4c('0x1d')](_0x20d2f4['query'][_0x9f4c('0x1d')]);_0x4e9b77['offset']=qs[_0x9f4c('0x1c')](_0x20d2f4[_0x9f4c('0x30')][_0x9f4c('0x1c')]);}_0x4e9b77[_0x9f4c('0x38')]=qs[_0x9f4c('0x39')](_0x20d2f4[_0x9f4c('0x30')][_0x9f4c('0x39')]);_0x4e9b77[_0x9f4c('0x3a')]=qs[_0x9f4c('0x31')](_[_0x9f4c('0x3b')](_0x20d2f4[_0x9f4c('0x30')],_0x4b6d91[_0x9f4c('0x31')]),_0x101c13);if(_0x20d2f4['query'][_0x9f4c('0x3c')]){_0x4e9b77[_0x9f4c('0x3a')]=_[_0x9f4c('0x3d')](_0x4e9b77['where'],{'$or':_[_0x9f4c('0x2c')](_0x101c13,function(_0x380c08){if(_0x380c08[_0x9f4c('0x3e')]!=='VIRTUAL'){var _0xb58e5a={};_0xb58e5a[_0x380c08[_0x9f4c('0x29')]]={'$like':'%'+_0x20d2f4[_0x9f4c('0x30')][_0x9f4c('0x3c')]+'%'};return _0xb58e5a;}})});}_0x4e9b77=_[_0x9f4c('0x3d')]({},_0x4e9b77,_0x20d2f4[_0x9f4c('0x3f')]);var _0x44b920={'where':_0x4e9b77[_0x9f4c('0x3a')]};return db[_0x9f4c('0x40')][_0x9f4c('0x1f')](_0x44b920)['then'](function(_0x167363){_0x52ef31[_0x9f4c('0x1f')]=_0x167363;if(_0x20d2f4['query'][_0x9f4c('0x41')]){_0x4e9b77[_0x9f4c('0x42')]=[{'all':!![]}];}return db[_0x9f4c('0x40')]['findAll'](_0x4e9b77);})[_0x9f4c('0x24')](function(_0x4da3ed){_0x52ef31[_0x9f4c('0x43')]=_0x4da3ed;return _0x52ef31;})['then'](respondWithFilteredResult(_0x2158ac,_0x4e9b77))[_0x9f4c('0x44')](handleError(_0x2158ac,null));};exports[_0x9f4c('0x45')]=function(_0x10437e,_0x437558){var _0x3ee559={'raw':![],'where':{'id':_0x10437e['params']['id']}},_0x51553d={};_0x51553d[_0x9f4c('0x2f')]=_[_0x9f4c('0x46')](db[_0x9f4c('0x40')]['rawAttributes']);_0x51553d[_0x9f4c('0x30')]=_['keys'](_0x10437e['query']);_0x51553d[_0x9f4c('0x31')]=_['intersection'](_0x51553d[_0x9f4c('0x2f')],_0x51553d[_0x9f4c('0x30')]);_0x3ee559[_0x9f4c('0x33')]=_['intersection'](_0x51553d[_0x9f4c('0x2f')],qs['fields'](_0x10437e[_0x9f4c('0x30')][_0x9f4c('0x34')]));_0x3ee559[_0x9f4c('0x33')]=_0x3ee559[_0x9f4c('0x33')]['length']?_0x3ee559[_0x9f4c('0x33')]:_0x51553d['model'];if(_0x10437e[_0x9f4c('0x30')]['includeAll']){_0x3ee559[_0x9f4c('0x42')]=[{'all':!![]}];}_0x3ee559=_[_0x9f4c('0x3d')]({},_0x3ee559,_0x10437e['options']);return db[_0x9f4c('0x40')][_0x9f4c('0x47')](_0x3ee559)['then'](handleEntityNotFound(_0x437558,null))[_0x9f4c('0x24')](respondWithResult(_0x437558,null))['catch'](handleError(_0x437558,null));};exports[_0x9f4c('0x48')]=function(_0x384f47,_0x5b8fca){return db['UserProfile']['create'](_0x384f47[_0x9f4c('0x49')],{})[_0x9f4c('0x24')](respondWithResult(_0x5b8fca,0xc9))['catch'](handleError(_0x5b8fca,null));};exports[_0x9f4c('0x4a')]=function(_0x16e255,_0xf684a1){var _0x4e0d96={'where':{'id':_0x16e255['params']['id']}},_0x1c4eba={};_0x1c4eba[_0x9f4c('0x2f')]=_[_0x9f4c('0x46')](db['UserProfile']['rawAttributes']);_0x4e0d96[_0x9f4c('0x33')]=_[_0x9f4c('0x32')](_0x1c4eba['model'],qs[_0x9f4c('0x34')](_0x16e255[_0x9f4c('0x30')][_0x9f4c('0x34')]));_0x4e0d96['attributes']=_0x4e0d96['attributes'][_0x9f4c('0x35')]?_0x4e0d96[_0x9f4c('0x33')]:_0x1c4eba[_0x9f4c('0x2f')];if(_0x16e255[_0x9f4c('0x30')]['includeAll']){_0x4e0d96[_0x9f4c('0x42')]=[{'all':!![]}];}_0x4e0d96=_[_0x9f4c('0x3d')]({},_0x4e0d96,_0x16e255[_0x9f4c('0x3f')]);return db[_0x9f4c('0x40')][_0x9f4c('0x47')](_0x4e0d96)[_0x9f4c('0x24')](handleEntityNotFound(_0xf684a1,null))[_0x9f4c('0x24')](function(_0x1e88b0){if(_0x1e88b0){var _0x20ea33=_0x1e88b0[_0x9f4c('0x4b')]({'plain':!![]});_0x20ea33=qs[_0x9f4c('0x4c')](_0x20ea33,['id','createdAt',_0x9f4c('0x4d'),_0x9f4c('0x4e')]);_0x16e255[_0x9f4c('0x49')]=_[_0x9f4c('0x4c')](_0x16e255[_0x9f4c('0x49')],['id','createdAt','updatedAt']);return db[_0x9f4c('0x4f')]['transaction'](function(_0x1e10fa){return db['UserProfile'][_0x9f4c('0x48')](_[_0x9f4c('0x3d')](_0x20ea33,_0x16e255[_0x9f4c('0x49')]),{'include':_0x16e255[_0x9f4c('0x30')][_0x9f4c('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x1e10fa})[_0x9f4c('0x24')](function(_0x559c65){var _0x1a4384=_0x559c65[_0x9f4c('0x4b')]({'plain':!![]});return db[_0x9f4c('0x50')][_0x9f4c('0x51')]({'where':{'userProfileId':_0x16e255[_0x9f4c('0x52')]['id']},'raw':!![]})['then'](function(_0xfd42ef){if(_0xfd42ef){return BPromise[_0x9f4c('0x53')](_0xfd42ef,function(_0x3e4c79){return new BPromise(function(_0x1557c1,_0x13c74b){if(_0x3e4c79[_0x9f4c('0x54')]===null||_0x3e4c79[_0x9f4c('0x54')]===0x1)_0x1557c1(null);return db[_0x9f4c('0x55')][_0x9f4c('0x51')]({'where':{'sectionId':_0x3e4c79['id']},'raw':!![]})['then'](function(_0x173d28){var _0x2d6e11=_[_0x9f4c('0x2c')](_0x173d28,function(_0xbc4737){return qs[_0x9f4c('0x4c')](_0xbc4737,['id',_0x9f4c('0x56'),'updatedAt',_0x9f4c('0x57')]);});_0x1557c1(_0x2d6e11);})[_0x9f4c('0x44')](function(_0x99b425){_0x13c74b(_0x99b425);});})[_0x9f4c('0x24')](function(_0x34ce5d){var _0xa3daa8=qs['omit'](_0x3e4c79,['id','createdAt','updatedAt']);_0xa3daa8[_0x9f4c('0x58')]=_0x1a4384['id'];if(_0x34ce5d)_0xa3daa8[_0x9f4c('0x59')]=_0x34ce5d;return _0xa3daa8;})[_0x9f4c('0x24')](function(_0x4fe718){return db[_0x9f4c('0x50')][_0x9f4c('0x48')](_0x4fe718,{'include':[{'model':db[_0x9f4c('0x55')],'as':_0x9f4c('0x59')}],'raw':!![],'transaction':_0x1e10fa});});})[_0x9f4c('0x24')](function(){return _0x1a4384;});}});});});}})[_0x9f4c('0x24')](respondWithResult(_0xf684a1,0xc9))[_0x9f4c('0x44')](handleError(_0xf684a1,null));};exports[_0x9f4c('0x23')]=function(_0x2ecb9a,_0x10ba77){if(_0x2ecb9a['body']['id']){delete _0x2ecb9a[_0x9f4c('0x49')]['id'];}return db[_0x9f4c('0x40')][_0x9f4c('0x47')]({'where':{'id':_0x2ecb9a[_0x9f4c('0x52')]['id']}})['then'](handleEntityNotFound(_0x10ba77,null))['then'](saveUpdates(_0x2ecb9a['body'],null))[_0x9f4c('0x24')](respondWithResult(_0x10ba77,null))[_0x9f4c('0x44')](handleError(_0x10ba77,null));};exports['destroy']=function(_0x40847e,_0x5a3b8a){return db['UserProfile'][_0x9f4c('0x47')]({'where':{'id':_0x40847e['params']['id']}})[_0x9f4c('0x24')](handleEntityNotFound(_0x5a3b8a,null))[_0x9f4c('0x24')](removeEntity(_0x5a3b8a,null))['catch'](handleError(_0x5a3b8a,null));};exports[_0x9f4c('0x5a')]=function(_0x4c99dd,_0x5b8a31){return db[_0x9f4c('0x40')][_0x9f4c('0x5a')]()[_0x9f4c('0x24')](respondWithResult(_0x5b8a31,null))[_0x9f4c('0x44')](handleError(_0x5b8a31,null));};exports['addSections']=function(_0x33967a,_0x5514a1){var _0x5505f3=_0x33967a[_0x9f4c('0x49')];return db['UserProfile'][_0x9f4c('0x47')]({'where':{'id':_0x33967a[_0x9f4c('0x52')]['id']}})[_0x9f4c('0x24')](handleEntityNotFound(_0x5514a1,null))[_0x9f4c('0x24')](function(_0x240b8b){if(_0x240b8b){return db['sequelize']['transaction'](function(_0x5a73d6){return db[_0x9f4c('0x50')]['destroy']({'where':{'userProfileId':_0x33967a[_0x9f4c('0x52')]['id'],'sectionId':_[_0x9f4c('0x2c')](_0x5505f3,function(_0x4d8007){return _0x4d8007['sectionId'];})},'transaction':_0x5a73d6})[_0x9f4c('0x24')](function(){var _0x394d4d=_[_0x9f4c('0x2c')](_0x5505f3,function(_0x3dee3d){_0x3dee3d['userProfileId']=_0x33967a[_0x9f4c('0x52')]['id'];return _0x3dee3d;});var _0xd4367c=[];return BPromise[_0x9f4c('0x53')](_0x394d4d,function(_0x21b0db){return db['UserProfileSection']['create'](_0x21b0db,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5a73d6})['then'](function(_0x2b752d){_0xd4367c['push'](_0x2b752d[_0x9f4c('0x4b')]({'plain':!![]}));});})[_0x9f4c('0x24')](function(){return _0xd4367c;});});});}})['then'](function(_0x4e5f79){return _0x4e5f79;})[_0x9f4c('0x24')](respondWithResult(_0x5514a1,null))[_0x9f4c('0x44')](handleError(_0x5514a1,null));};exports[_0x9f4c('0x5b')]=function(_0x1c16b4,_0x5e67d7){var _0x737785;return db['UserProfile']['find']({'where':{'id':_0x1c16b4['params']['id']},'attributes':['id',_0x9f4c('0x29')]})[_0x9f4c('0x24')](handleEntityNotFound(_0x5e67d7,null))['then'](function(_0x2f29b8){if(_0x2f29b8){_0x737785=_0x2f29b8;return db[_0x9f4c('0x50')][_0x9f4c('0x25')]({'where':{'userProfileId':_0x1c16b4[_0x9f4c('0x52')]['id'],'sectionId':_0x1c16b4[_0x9f4c('0x30')][_0x9f4c('0x5c')]}});}})[_0x9f4c('0x24')](function(){return _0x737785;})[_0x9f4c('0x24')](respondWithStatusCode(_0x5e67d7,null))[_0x9f4c('0x44')](handleError(_0x5e67d7,null));};exports[_0x9f4c('0x5d')]=function(_0x35bec2,_0x187c52){var _0x289028=[];var _0x4804af=[];return db[_0x9f4c('0x50')][_0x9f4c('0x51')]({'where':{'userProfileId':_0x35bec2[_0x9f4c('0x52')]['id']},'raw':!![]})[_0x9f4c('0x24')](function(_0x3699c3){_0x289028=_['filter'](_0x3699c3,function(_0x218aed){return _0x218aed['enabled']===0x1||_[_0x9f4c('0x5e')]([0x3eb,0x709],_0x218aed[_0x9f4c('0x57')]);});if(!_['isEmpty'](_0x289028)){return _[_0x9f4c('0x2c')](_0x289028,function(_0x548f27){return _0x548f27['sectionId'];});}else{return;}})['then'](function(_0x5478b5){if(_0x5478b5)_0x4804af=_0x5478b5;if(_[_0x9f4c('0x5e')](_0x4804af,0x64)){var _0x2c043a=_[_0x9f4c('0x47')](_0x289028,{'sectionId':0x64});return hasDefaultDashboard(_0x2c043a)[_0x9f4c('0x24')](function(_0x4ec44c){return _[_0x9f4c('0x2c')](_0x289028,function(_0x36cbc6){if(_0x36cbc6[_0x9f4c('0x57')]===0x64){_0x36cbc6['subsections']=_0x4ec44c;}return _0x36cbc6;});});}else{return;}})[_0x9f4c('0x24')](function(_0x1ffbd6){if(_0x1ffbd6)_0x289028=_0x1ffbd6;if(_[_0x9f4c('0x5e')](_0x4804af,0x3eb)){var _0x4a06d3=_[_0x9f4c('0x47')](_0x289028,{'sectionId':0x3eb});return getCustomDashboards(_0x4a06d3)['then'](function(_0x5acefa){return _[_0x9f4c('0x2c')](_0x289028,function(_0x411d1b){if(_0x4a06d3[_0x9f4c('0x5f')]){if(_0x411d1b['sectionId']===0x3eb){_0x411d1b[_0x9f4c('0x60')]=_0x5acefa;}}else{if(_0x411d1b[_0x9f4c('0x57')]===0x64){_0x411d1b[_0x9f4c('0x60')]=_0x5acefa;}}return _0x411d1b;});});}else{return;}})['then'](function(_0x6eabc6){if(_0x6eabc6)_0x289028=_0x6eabc6;if(_[_0x9f4c('0x5e')](_0x4804af,0x709)){var _0x795824=_['find'](_0x289028,{'sectionId':0x709});return getPlugins(_0x795824)['then'](function(_0x283150){if(_0x795824[_0x9f4c('0x5f')]){return _[_0x9f4c('0x2c')](_0x289028,function(_0x5b5177){if(_0x5b5177[_0x9f4c('0x57')]===0x709){_0x5b5177[_0x9f4c('0x60')]=_0x283150;}return _0x5b5177;});}else{var _0x5271a0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x283150};var _0x3c4a01=_[_0x9f4c('0x2c')](_0x289028);_0x3c4a01[_0x9f4c('0x61')](_0x5271a0);return _0x3c4a01;}});}else{return;}})[_0x9f4c('0x24')](function(_0x5b53bb){if(_0x5b53bb)_0x289028=_0x5b53bb;return _[_0x9f4c('0x3c')](_0x289028,[_0x9f4c('0x5f'),0x1]);})[_0x9f4c('0x24')](respondWithResult(_0x187c52,null))[_0x9f4c('0x44')](handleError(_0x187c52,null));};function hasDefaultDashboard(_0x5ccb3d){var _0x34a952=[0x65];return new BPromise(function(_0x5eb438,_0x37df81){try{if(_0x5ccb3d[_0x9f4c('0x54')]){_0x5eb438(_0x34a952);}else{return db[_0x9f4c('0x55')][_0x9f4c('0x62')]({'where':{'sectionId':_0x5ccb3d['id']},'raw':!![]})[_0x9f4c('0x24')](function(_0x3e86dd){_0x3e86dd?_0x5eb438(_0x34a952):_0x5eb438();});}}catch(_0x349b1b){_0x37df81(_0x349b1b);}});}function getCustomDashboards(_0x1016d1){var _0x37bd0d=[];return new BPromise(function(_0x1b075c,_0x5ed4e9){try{if(_0x1016d1[_0x9f4c('0x54')]){return db['Dashboard'][_0x9f4c('0x51')]({'raw':!![]})[_0x9f4c('0x24')](function(_0x11ac6f){_0x11ac6f[_0x9f4c('0x63')](function(_0x14b0e7){_0x37bd0d[_0x9f4c('0x61')](_0x14b0e7['id']+0x1869f);});_0x1b075c(_0x37bd0d);});}else{return db[_0x9f4c('0x55')]['findAll']({'where':{'sectionId':_0x1016d1['id']},'raw':!![]})[_0x9f4c('0x24')](function(_0xfb532f){_0xfb532f['forEach'](function(_0x16c0e6){_0x37bd0d[_0x9f4c('0x61')](_0x16c0e6[_0x9f4c('0x64')]+0x1869f);});_0x1b075c(_0x37bd0d);});}}catch(_0x1f84c7){_0x5ed4e9(_0x1f84c7);}});}function getPlugins(_0x1d3ec5){var _0x14f4f3=[];return new BPromise(function(_0x44cc1f,_0x2927c6){try{if(_0x1d3ec5[_0x9f4c('0x54')]){return db['Plugin'][_0x9f4c('0x51')]({'raw':!![]})[_0x9f4c('0x24')](function(_0x46bcb8){_0x46bcb8[_0x9f4c('0x63')](function(_0x371e82){_0x14f4f3[_0x9f4c('0x61')](_0x371e82['id']+0x15b38);});_0x44cc1f(_0x14f4f3);});}else{return db[_0x9f4c('0x55')]['findAll']({'where':{'sectionId':_0x1d3ec5['id']},'raw':!![]})['then'](function(_0x471777){_0x471777[_0x9f4c('0x63')](function(_0x1eddab){_0x14f4f3[_0x9f4c('0x61')](_0x1eddab[_0x9f4c('0x64')]+0x15b38);});_0x44cc1f(_0x14f4f3);});}}catch(_0x4fc1b7){_0x2927c6(_0x4fc1b7);}});}exports[_0x9f4c('0x65')]=function(_0x15e7b0,_0x329409){return db[_0x9f4c('0x40')][_0x9f4c('0x47')]({'where':{'id':_0x15e7b0[_0x9f4c('0x52')]['id']}})[_0x9f4c('0x24')](handleEntityNotFound(_0x329409,null))['then'](function(_0x214e48){if(_0x214e48){return db[_0x9f4c('0x4f')]['transaction'](function(_0x2aa60f){return db[_0x9f4c('0x50')][_0x9f4c('0x51')]({'where':{'userProfileId':_0x15e7b0[_0x9f4c('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0x9f4c('0x24')](function(_0xcb283d){if(_0xcb283d){return db[_0x9f4c('0x50')][_0x9f4c('0x25')]({'where':{'userProfileId':_0x15e7b0['params']['id'],'id':_[_0x9f4c('0x2c')](_0xcb283d,function(_0x5b32e0){return _0x5b32e0['id'];})},'transaction':_0x2aa60f});}})[_0x9f4c('0x24')](function(_0x5a076f){var _0x5cc53d=_[_0x9f4c('0x2c')](_0x15e7b0[_0x9f4c('0x49')],function(_0x44e01a){_0x44e01a[_0x9f4c('0x58')]=_0x15e7b0[_0x9f4c('0x52')]['id'];return _0x44e01a;});return db[_0x9f4c('0x50')][_0x9f4c('0x66')](_0x5cc53d,{'raw':!![],'transaction':_0x2aa60f});})[_0x9f4c('0x24')](function(_0x116254){var _0x38a135=_[_0x9f4c('0x3c')](_[_0x9f4c('0x2c')](_0x116254,function(_0x3b9eee){return _0x3b9eee[_0x9f4c('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x38a135){return db[_0x9f4c('0x50')][_0x9f4c('0x51')]({'where':{'userProfileId':_0x15e7b0[_0x9f4c('0x52')]['id'],'sectionId':_[_0x9f4c('0x2c')](_0x38a135,function(_0x3a965a){return _0x3a965a[_0x9f4c('0x57')];})},'attributes':['id',_0x9f4c('0x57')],'raw':!![]})[_0x9f4c('0x24')](function(_0x37c513){var _0x42a29c=_[_0x9f4c('0x2c')](_0x15e7b0[_0x9f4c('0x49')],function(_0x29e563){_0x29e563[_0x9f4c('0x58')]=_0x15e7b0[_0x9f4c('0x52')]['id'];return _0x29e563;});return db[_0x9f4c('0x55')][_0x9f4c('0x66')](_0x42a29c,{'raw':!![],'transaction':_0x2aa60f});});}})[_0x9f4c('0x44')](handleError(_0x329409,null));});}})[_0x9f4c('0x24')](function(_0xdfb5e8){var _0x594f15=_[_0x9f4c('0x2c')](_0xdfb5e8,function(_0x598e2d){return _0x598e2d[_0x9f4c('0x4b')]({'plain':!![]});});})[_0x9f4c('0x24')](respondWithResult(_0x329409,null))[_0x9f4c('0x44')](handleError(_0x329409,null));};exports[_0x9f4c('0x67')]=function(_0x3a4124,_0x1bef4c,_0x228ec8){return db[_0x9f4c('0x40')][_0x9f4c('0x47')]({'where':{'id':_0x3a4124[_0x9f4c('0x52')]['id']}})[_0x9f4c('0x24')](handleEntityNotFound(_0x1bef4c,null))[_0x9f4c('0x24')](function(_0x5f4596){if(_0x5f4596){return _0x5f4596[_0x9f4c('0x67')](_0x3a4124[_0x9f4c('0x30')][_0x9f4c('0x5c')]);}})[_0x9f4c('0x24')](respondWithStatusCode(_0x1bef4c,null))[_0x9f4c('0x44')](handleError(_0x1bef4c,null));};exports[_0x9f4c('0x68')]=function(_0x1ea399,_0x3e655a){var _0x4e446d={};if(!_0x1ea399[_0x9f4c('0x30')][_0x9f4c('0x69')])throw new Error(_0x9f4c('0x6a'));if(!_0x1ea399[_0x9f4c('0x30')][_0x9f4c('0x36')](_0x9f4c('0x37'))){_0x4e446d[_0x9f4c('0x1d')]=qs['limit'](_0x1ea399['query'][_0x9f4c('0x1d')]);_0x4e446d['offset']=qs[_0x9f4c('0x1c')](_0x1ea399[_0x9f4c('0x30')][_0x9f4c('0x1c')]);}return db[_0x9f4c('0x40')][_0x9f4c('0x47')]({'where':{'id':_0x1ea399[_0x9f4c('0x52')]['id']}})[_0x9f4c('0x24')](function(_0x45e86b){if(!_0x45e86b)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1ea399[_0x9f4c('0x52')]['id']);return db[_0x9f4c('0x40')][_0x9f4c('0x68')](_0x1ea399);})[_0x9f4c('0x24')](respondWithFilteredResult(_0x3e655a,_0x4e446d))[_0x9f4c('0x44')](handleError(_0x3e655a,null));}; \ No newline at end of file +var _0x9c1d=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','options','includeAll','include','UserProfile','findAll','rows','catch','merge','find','create','body','params','length','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','addSections','userProfileId','each','push','removeSections','getSections','includes','isEmpty','subsections','enabled','forEach','resourceId','Plugin','addResources','bulkCreate','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status'];(function(_0x11de8b,_0x45cfe7){var _0x1bf521=function(_0x152952){while(--_0x152952){_0x11de8b['push'](_0x11de8b['shift']());}};_0x1bf521(++_0x45cfe7);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x11aaec,_0x3e5cff){_0x11aaec=_0x11aaec-0x0;var _0x11db30=_0x9c1d[_0x11aaec];return _0x11db30;};'use strict';var emlformat=require(_0xd9c1('0x0'));var rimraf=require(_0xd9c1('0x1'));var zipdir=require(_0xd9c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9c1('0x3'));var moment=require(_0xd9c1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd9c1('0x5'));var util=require(_0xd9c1('0x6'));var path=require('path');var sox=require(_0xd9c1('0x7'));var csv=require(_0xd9c1('0x8'));var ejs=require(_0xd9c1('0x9'));var fs=require('fs');var fs_extra=require(_0xd9c1('0xa'));var _=require(_0xd9c1('0xb'));var squel=require(_0xd9c1('0xc'));var crypto=require(_0xd9c1('0xd'));var jsforce=require(_0xd9c1('0xe'));var deskjs=require(_0xd9c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9c1('0x10'));var Papa=require(_0xd9c1('0x11'));var Redis=require(_0xd9c1('0x12'));var authService=require(_0xd9c1('0x13'));var qs=require(_0xd9c1('0x14'));var as=require(_0xd9c1('0x15'));var hardwareService=require(_0xd9c1('0x16'));var logger=require('../../config/logger')(_0xd9c1('0x17'));var utils=require(_0xd9c1('0x18'));var config=require(_0xd9c1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9c1('0x1a'))['db'];config['redis']=_[_0xd9c1('0x1b')](config[_0xd9c1('0x1c')],{'host':_0xd9c1('0x1d'),'port':0x18eb});var socket=require(_0xd9c1('0x1e'))(new Redis(config[_0xd9c1('0x1c')]));require(_0xd9c1('0x1f'))[_0xd9c1('0x20')](socket);function respondWithStatusCode(_0x13b927,_0xf95f06){_0xf95f06=_0xf95f06||0xcc;return function(_0x259305){if(_0x259305){return _0x13b927[_0xd9c1('0x21')](_0xf95f06);}return _0x13b927[_0xd9c1('0x22')](_0xf95f06)[_0xd9c1('0x23')]();};}function respondWithResult(_0x174ccd,_0xe47aa2){_0xe47aa2=_0xe47aa2||0xc8;return function(_0x5e500f){if(_0x5e500f){return _0x174ccd['status'](_0xe47aa2)[_0xd9c1('0x24')](_0x5e500f);}};}function respondWithFilteredResult(_0xf6c9b2,_0x1090a4){return function(_0x1a1542){if(_0x1a1542){var _0x10a586=typeof _0x1090a4[_0xd9c1('0x25')]===_0xd9c1('0x26')&&typeof _0x1090a4[_0xd9c1('0x27')]===_0xd9c1('0x26');var _0x55c310=_0x1a1542[_0xd9c1('0x28')];var _0x11611d=_0x10a586?0x0:_0x1090a4[_0xd9c1('0x25')];var _0x2aea78=_0x10a586?_0x1a1542[_0xd9c1('0x28')]:_0x1090a4[_0xd9c1('0x25')]+_0x1090a4['limit'];var _0x28f523;if(_0x2aea78>=_0x55c310){_0x2aea78=_0x55c310;_0x28f523=0xc8;}else{_0x28f523=0xce;}_0xf6c9b2[_0xd9c1('0x22')](_0x28f523);return _0xf6c9b2[_0xd9c1('0x29')]('Content-Range',_0x11611d+'-'+_0x2aea78+'/'+_0x55c310)['json'](_0x1a1542);}return null;};}function patchUpdates(_0x410be7){return function(_0x31cd40){try{jsonpatch[_0xd9c1('0x2a')](_0x31cd40,_0x410be7,!![]);}catch(_0x403d78){return BPromise[_0xd9c1('0x2b')](_0x403d78);}return _0x31cd40[_0xd9c1('0x2c')]();};}function saveUpdates(_0x27818f,_0x562efb){return function(_0x26df40){if(_0x26df40){return _0x26df40[_0xd9c1('0x2d')](_0x27818f)['then'](function(_0x5dc2ee){return _0x5dc2ee;});}return null;};}function removeEntity(_0x2245ca,_0x45b15d){return function(_0x5106e3){if(_0x5106e3){return _0x5106e3['destroy']()[_0xd9c1('0x2e')](function(){_0x2245ca[_0xd9c1('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dcc10,_0x298042){return function(_0x2d2f1c){if(!_0x2d2f1c){_0x4dcc10[_0xd9c1('0x21')](0x194);}return _0x2d2f1c;};}function handleError(_0x28bd8a,_0xc0192e){_0xc0192e=_0xc0192e||0x1f4;return function(_0x7373cb){logger[_0xd9c1('0x2f')](_0x7373cb['stack']);if(_0x7373cb[_0xd9c1('0x30')]){delete _0x7373cb[_0xd9c1('0x30')];}_0x28bd8a[_0xd9c1('0x22')](_0xc0192e)[_0xd9c1('0x31')](_0x7373cb);};}exports[_0xd9c1('0x32')]=function(_0xd6248b,_0x11c8b3){var _0x313f05={},_0x5a1a5c={},_0x5117d6={'count':0x0,'rows':[]};var _0x5923d9=_[_0xd9c1('0x33')](db['UserProfile'][_0xd9c1('0x34')],function(_0x3b92fb){return{'name':_0x3b92fb['fieldName'],'type':_0x3b92fb[_0xd9c1('0x35')][_0xd9c1('0x36')]};});_0x5a1a5c[_0xd9c1('0x37')]=_[_0xd9c1('0x33')](_0x5923d9,_0xd9c1('0x30'));_0x5a1a5c[_0xd9c1('0x38')]=_[_0xd9c1('0x39')](_0xd6248b[_0xd9c1('0x38')]);_0x5a1a5c[_0xd9c1('0x3a')]=_[_0xd9c1('0x3b')](_0x5a1a5c[_0xd9c1('0x37')],_0x5a1a5c[_0xd9c1('0x38')]);_0x313f05['attributes']=_['intersection'](_0x5a1a5c[_0xd9c1('0x37')],qs[_0xd9c1('0x3c')](_0xd6248b[_0xd9c1('0x38')]['fields']));_0x313f05[_0xd9c1('0x3d')]=_0x313f05[_0xd9c1('0x3d')]['length']?_0x313f05[_0xd9c1('0x3d')]:_0x5a1a5c[_0xd9c1('0x37')];if(!_0xd6248b['query']['hasOwnProperty'](_0xd9c1('0x3e'))){_0x313f05[_0xd9c1('0x27')]=qs[_0xd9c1('0x27')](_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x27')]);_0x313f05[_0xd9c1('0x25')]=qs['offset'](_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x25')]);}_0x313f05[_0xd9c1('0x3f')]=qs['sort'](_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x40')]);_0x313f05[_0xd9c1('0x41')]=qs[_0xd9c1('0x3a')](_[_0xd9c1('0x42')](_0xd6248b[_0xd9c1('0x38')],_0x5a1a5c[_0xd9c1('0x3a')]),_0x5923d9);if(_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x43')]){_0x313f05[_0xd9c1('0x41')]=_['merge'](_0x313f05[_0xd9c1('0x41')],{'$or':_[_0xd9c1('0x33')](_0x5923d9,function(_0x5ddcb6){if(_0x5ddcb6['type']!=='VIRTUAL'){var _0x26f67a={};_0x26f67a[_0x5ddcb6[_0xd9c1('0x30')]]={'$like':'%'+_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x43')]+'%'};return _0x26f67a;}})});}_0x313f05=_['merge']({},_0x313f05,_0xd6248b[_0xd9c1('0x44')]);var _0x418a64={'where':_0x313f05[_0xd9c1('0x41')]};return db['UserProfile']['count'](_0x418a64)[_0xd9c1('0x2e')](function(_0xbf9915){_0x5117d6[_0xd9c1('0x28')]=_0xbf9915;if(_0xd6248b[_0xd9c1('0x38')][_0xd9c1('0x45')]){_0x313f05[_0xd9c1('0x46')]=[{'all':!![]}];}return db[_0xd9c1('0x47')][_0xd9c1('0x48')](_0x313f05);})[_0xd9c1('0x2e')](function(_0x4f55a3){_0x5117d6[_0xd9c1('0x49')]=_0x4f55a3;return _0x5117d6;})[_0xd9c1('0x2e')](respondWithFilteredResult(_0x11c8b3,_0x313f05))[_0xd9c1('0x4a')](handleError(_0x11c8b3,null));};exports['show']=function(_0x587490,_0x1a830d){var _0x58316f={'raw':![],'where':{'id':_0x587490['params']['id']}},_0x43383d={};_0x43383d['model']=_[_0xd9c1('0x39')](db[_0xd9c1('0x47')][_0xd9c1('0x34')]);_0x43383d[_0xd9c1('0x38')]=_[_0xd9c1('0x39')](_0x587490[_0xd9c1('0x38')]);_0x43383d[_0xd9c1('0x3a')]=_[_0xd9c1('0x3b')](_0x43383d[_0xd9c1('0x37')],_0x43383d[_0xd9c1('0x38')]);_0x58316f[_0xd9c1('0x3d')]=_[_0xd9c1('0x3b')](_0x43383d[_0xd9c1('0x37')],qs[_0xd9c1('0x3c')](_0x587490[_0xd9c1('0x38')][_0xd9c1('0x3c')]));_0x58316f['attributes']=_0x58316f[_0xd9c1('0x3d')]['length']?_0x58316f['attributes']:_0x43383d[_0xd9c1('0x37')];if(_0x587490[_0xd9c1('0x38')][_0xd9c1('0x45')]){_0x58316f[_0xd9c1('0x46')]=[{'all':!![]}];}_0x58316f=_[_0xd9c1('0x4b')]({},_0x58316f,_0x587490[_0xd9c1('0x44')]);return db[_0xd9c1('0x47')][_0xd9c1('0x4c')](_0x58316f)[_0xd9c1('0x2e')](handleEntityNotFound(_0x1a830d,null))[_0xd9c1('0x2e')](respondWithResult(_0x1a830d,null))['catch'](handleError(_0x1a830d,null));};exports[_0xd9c1('0x4d')]=function(_0x5834e5,_0x4ae001){return db[_0xd9c1('0x47')][_0xd9c1('0x4d')](_0x5834e5[_0xd9c1('0x4e')],{})[_0xd9c1('0x2e')](respondWithResult(_0x4ae001,0xc9))[_0xd9c1('0x4a')](handleError(_0x4ae001,null));};exports['clone']=function(_0x40086a,_0x18b24a){var _0x550133={'where':{'id':_0x40086a[_0xd9c1('0x4f')]['id']}},_0x311595={};_0x311595[_0xd9c1('0x37')]=_[_0xd9c1('0x39')](db[_0xd9c1('0x47')]['rawAttributes']);_0x550133[_0xd9c1('0x3d')]=_[_0xd9c1('0x3b')](_0x311595[_0xd9c1('0x37')],qs[_0xd9c1('0x3c')](_0x40086a['query'][_0xd9c1('0x3c')]));_0x550133[_0xd9c1('0x3d')]=_0x550133[_0xd9c1('0x3d')][_0xd9c1('0x50')]?_0x550133[_0xd9c1('0x3d')]:_0x311595[_0xd9c1('0x37')];if(_0x40086a[_0xd9c1('0x38')][_0xd9c1('0x45')]){_0x550133[_0xd9c1('0x46')]=[{'all':!![]}];}_0x550133=_['merge']({},_0x550133,_0x40086a[_0xd9c1('0x44')]);return db[_0xd9c1('0x47')]['find'](_0x550133)[_0xd9c1('0x2e')](handleEntityNotFound(_0x18b24a,null))[_0xd9c1('0x2e')](function(_0x4038f9){if(_0x4038f9){var _0x168e70=_0x4038f9[_0xd9c1('0x51')]({'plain':!![]});_0x168e70=qs[_0xd9c1('0x52')](_0x168e70,['id',_0xd9c1('0x53'),_0xd9c1('0x54'),_0xd9c1('0x55')]);_0x40086a[_0xd9c1('0x4e')]=_['omit'](_0x40086a[_0xd9c1('0x4e')],['id',_0xd9c1('0x53'),_0xd9c1('0x54')]);return db[_0xd9c1('0x56')][_0xd9c1('0x57')](function(_0x2f9044){return db[_0xd9c1('0x47')][_0xd9c1('0x4d')](_[_0xd9c1('0x4b')](_0x168e70,_0x40086a[_0xd9c1('0x4e')]),{'include':_0x40086a['query'][_0xd9c1('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x2f9044})['then'](function(_0x38a9b3){var _0x37475b=_0x38a9b3[_0xd9c1('0x51')]({'plain':!![]});return db[_0xd9c1('0x58')]['findAll']({'where':{'userProfileId':_0x40086a[_0xd9c1('0x4f')]['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x2a9c79){if(_0x2a9c79){return BPromise['each'](_0x2a9c79,function(_0x34de0d){return new BPromise(function(_0x172816,_0x5a87e5){if(_0x34de0d[_0xd9c1('0x59')]===null||_0x34de0d[_0xd9c1('0x59')]===0x1)_0x172816(null);return db[_0xd9c1('0x5a')][_0xd9c1('0x48')]({'where':{'sectionId':_0x34de0d['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x6fb91){var _0x3ed406=_[_0xd9c1('0x33')](_0x6fb91,function(_0x4fa36f){return qs['omit'](_0x4fa36f,['id','createdAt',_0xd9c1('0x54'),_0xd9c1('0x5b')]);});_0x172816(_0x3ed406);})[_0xd9c1('0x4a')](function(_0x28e58e){_0x5a87e5(_0x28e58e);});})['then'](function(_0x969c4){var _0xe912b8=qs[_0xd9c1('0x52')](_0x34de0d,['id',_0xd9c1('0x53'),_0xd9c1('0x54')]);_0xe912b8['userProfileId']=_0x37475b['id'];if(_0x969c4)_0xe912b8[_0xd9c1('0x5c')]=_0x969c4;return _0xe912b8;})['then'](function(_0x2cc55e){return db[_0xd9c1('0x58')][_0xd9c1('0x4d')](_0x2cc55e,{'include':[{'model':db['UserProfileResource'],'as':_0xd9c1('0x5c')}],'raw':!![],'transaction':_0x2f9044});});})[_0xd9c1('0x2e')](function(){return _0x37475b;});}});});});}})[_0xd9c1('0x2e')](respondWithResult(_0x18b24a,0xc9))[_0xd9c1('0x4a')](handleError(_0x18b24a,null));};exports[_0xd9c1('0x2d')]=function(_0x1a4e7d,_0x1ff317){if(_0x1a4e7d[_0xd9c1('0x4e')]['id']){delete _0x1a4e7d['body']['id'];}return db[_0xd9c1('0x47')]['find']({'where':{'id':_0x1a4e7d[_0xd9c1('0x4f')]['id']}})[_0xd9c1('0x2e')](handleEntityNotFound(_0x1ff317,null))[_0xd9c1('0x2e')](saveUpdates(_0x1a4e7d[_0xd9c1('0x4e')],null))[_0xd9c1('0x2e')](respondWithResult(_0x1ff317,null))[_0xd9c1('0x4a')](handleError(_0x1ff317,null));};exports[_0xd9c1('0x5d')]=function(_0x15ae8c,_0x3fc82f){return db[_0xd9c1('0x47')][_0xd9c1('0x4c')]({'where':{'id':_0x15ae8c['params']['id']}})[_0xd9c1('0x2e')](handleEntityNotFound(_0x3fc82f,null))['then'](removeEntity(_0x3fc82f,null))[_0xd9c1('0x4a')](handleError(_0x3fc82f,null));};exports['describe']=function(_0x1c99a1,_0x4f8bc4){return db[_0xd9c1('0x47')][_0xd9c1('0x5e')]()[_0xd9c1('0x2e')](respondWithResult(_0x4f8bc4,null))[_0xd9c1('0x4a')](handleError(_0x4f8bc4,null));};exports[_0xd9c1('0x5f')]=function(_0x10b0ba,_0xc91efc){var _0x234484=_0x10b0ba[_0xd9c1('0x4e')];return db[_0xd9c1('0x47')][_0xd9c1('0x4c')]({'where':{'id':_0x10b0ba[_0xd9c1('0x4f')]['id']}})[_0xd9c1('0x2e')](handleEntityNotFound(_0xc91efc,null))[_0xd9c1('0x2e')](function(_0x1dfb52){if(_0x1dfb52){return db[_0xd9c1('0x56')]['transaction'](function(_0x3d80b6){return db[_0xd9c1('0x58')][_0xd9c1('0x5d')]({'where':{'userProfileId':_0x10b0ba[_0xd9c1('0x4f')]['id'],'sectionId':_[_0xd9c1('0x33')](_0x234484,function(_0x2484fc){return _0x2484fc[_0xd9c1('0x5b')];})},'transaction':_0x3d80b6})[_0xd9c1('0x2e')](function(){var _0x280e87=_['map'](_0x234484,function(_0x86facc){_0x86facc[_0xd9c1('0x60')]=_0x10b0ba['params']['id'];return _0x86facc;});var _0x3dc696=[];return BPromise[_0xd9c1('0x61')](_0x280e87,function(_0x3b9bf6){return db['UserProfileSection']['create'](_0x3b9bf6,{'include':[{'model':db[_0xd9c1('0x5a')],'as':_0xd9c1('0x5c')}],'raw':!![],'transaction':_0x3d80b6})[_0xd9c1('0x2e')](function(_0x133b29){_0x3dc696[_0xd9c1('0x62')](_0x133b29['get']({'plain':!![]}));});})[_0xd9c1('0x2e')](function(){return _0x3dc696;});});});}})[_0xd9c1('0x2e')](function(_0x2af121){return _0x2af121;})[_0xd9c1('0x2e')](respondWithResult(_0xc91efc,null))[_0xd9c1('0x4a')](handleError(_0xc91efc,null));};exports[_0xd9c1('0x63')]=function(_0x381b6a,_0x5de8a0){var _0x719c3b;return db[_0xd9c1('0x47')][_0xd9c1('0x4c')]({'where':{'id':_0x381b6a[_0xd9c1('0x4f')]['id']},'attributes':['id',_0xd9c1('0x30')]})[_0xd9c1('0x2e')](handleEntityNotFound(_0x5de8a0,null))[_0xd9c1('0x2e')](function(_0xd3c97a){if(_0xd3c97a){_0x719c3b=_0xd3c97a;return db[_0xd9c1('0x58')]['destroy']({'where':{'userProfileId':_0x381b6a[_0xd9c1('0x4f')]['id'],'sectionId':_0x381b6a['query']['ids']}});}})['then'](function(){return _0x719c3b;})[_0xd9c1('0x2e')](respondWithStatusCode(_0x5de8a0,null))[_0xd9c1('0x4a')](handleError(_0x5de8a0,null));};exports[_0xd9c1('0x64')]=function(_0x411ed1,_0x549184){var _0x2c3c78=[];var _0x28c154=[];return db[_0xd9c1('0x58')][_0xd9c1('0x48')]({'where':{'userProfileId':_0x411ed1['params']['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x5e1ac2){_0x2c3c78=_[_0xd9c1('0x43')](_0x5e1ac2,function(_0x3459f2){return _0x3459f2['enabled']===0x1||_[_0xd9c1('0x65')]([0x3eb,0x709],_0x3459f2['sectionId']);});if(!_[_0xd9c1('0x66')](_0x2c3c78)){return _[_0xd9c1('0x33')](_0x2c3c78,function(_0x2223eb){return _0x2223eb[_0xd9c1('0x5b')];});}else{return;}})[_0xd9c1('0x2e')](function(_0x34b44a){if(_0x34b44a)_0x28c154=_0x34b44a;if(_[_0xd9c1('0x65')](_0x28c154,0x64)){var _0x7fad7f=_['find'](_0x2c3c78,{'sectionId':0x64});return hasDefaultDashboard(_0x7fad7f)[_0xd9c1('0x2e')](function(_0x214210){return _['map'](_0x2c3c78,function(_0x21fd5c){if(_0x21fd5c[_0xd9c1('0x5b')]===0x64){_0x21fd5c[_0xd9c1('0x67')]=_0x214210;}return _0x21fd5c;});});}else{return;}})[_0xd9c1('0x2e')](function(_0x2118bd){if(_0x2118bd)_0x2c3c78=_0x2118bd;if(_['includes'](_0x28c154,0x3eb)){var _0x177ff0=_[_0xd9c1('0x4c')](_0x2c3c78,{'sectionId':0x3eb});return getCustomDashboards(_0x177ff0)[_0xd9c1('0x2e')](function(_0x1351ce){return _['map'](_0x2c3c78,function(_0x39baa9){if(_0x177ff0[_0xd9c1('0x68')]){if(_0x39baa9[_0xd9c1('0x5b')]===0x3eb){_0x39baa9[_0xd9c1('0x67')]=_0x1351ce;}}else{if(_0x39baa9['sectionId']===0x64){_0x39baa9['subsections']=_0x1351ce;}}return _0x39baa9;});});}else{return;}})[_0xd9c1('0x2e')](function(_0x599d6a){if(_0x599d6a)_0x2c3c78=_0x599d6a;if(_[_0xd9c1('0x65')](_0x28c154,0x709)){var _0x4bcd77=_[_0xd9c1('0x4c')](_0x2c3c78,{'sectionId':0x709});return getPlugins(_0x4bcd77)[_0xd9c1('0x2e')](function(_0x25aebe){if(_0x4bcd77['enabled']){return _[_0xd9c1('0x33')](_0x2c3c78,function(_0x113836){if(_0x113836['sectionId']===0x709){_0x113836[_0xd9c1('0x67')]=_0x25aebe;}return _0x113836;});}else{var _0x1ef7d0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25aebe};var _0x5bec38=_[_0xd9c1('0x33')](_0x2c3c78);_0x5bec38['push'](_0x1ef7d0);return _0x5bec38;}});}else{return;}})[_0xd9c1('0x2e')](function(_0x577cd9){if(_0x577cd9)_0x2c3c78=_0x577cd9;return _[_0xd9c1('0x43')](_0x2c3c78,[_0xd9c1('0x68'),0x1]);})[_0xd9c1('0x2e')](respondWithResult(_0x549184,null))['catch'](handleError(_0x549184,null));};function hasDefaultDashboard(_0x2c3dfe){var _0x223480=[0x65];return new BPromise(function(_0x3d10ea,_0x395126){try{if(_0x2c3dfe['autoAssociation']){_0x3d10ea(_0x223480);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2c3dfe['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x1b685b){_0x1b685b?_0x3d10ea(_0x223480):_0x3d10ea();});}}catch(_0x17b11e){_0x395126(_0x17b11e);}});}function getCustomDashboards(_0x4a7436){var _0x4db1e2=[];return new BPromise(function(_0x1c4124,_0x1a24b0){try{if(_0x4a7436[_0xd9c1('0x59')]){return db['Dashboard'][_0xd9c1('0x48')]({'raw':!![]})[_0xd9c1('0x2e')](function(_0x22f73c){_0x22f73c[_0xd9c1('0x69')](function(_0x4f566b){_0x4db1e2[_0xd9c1('0x62')](_0x4f566b['id']+0x1869f);});_0x1c4124(_0x4db1e2);});}else{return db[_0xd9c1('0x5a')][_0xd9c1('0x48')]({'where':{'sectionId':_0x4a7436['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x4dc0c8){_0x4dc0c8[_0xd9c1('0x69')](function(_0x2b9647){_0x4db1e2[_0xd9c1('0x62')](_0x2b9647[_0xd9c1('0x6a')]+0x1869f);});_0x1c4124(_0x4db1e2);});}}catch(_0x2701af){_0x1a24b0(_0x2701af);}});}function getPlugins(_0x541b72){var _0x7fa87=[];return new BPromise(function(_0x5419f3,_0x312984){try{if(_0x541b72[_0xd9c1('0x59')]){return db[_0xd9c1('0x6b')][_0xd9c1('0x48')]({'raw':!![]})['then'](function(_0x55eee1){_0x55eee1[_0xd9c1('0x69')](function(_0x14749d){_0x7fa87[_0xd9c1('0x62')](_0x14749d['id']+0x15b38);});_0x5419f3(_0x7fa87);});}else{return db[_0xd9c1('0x5a')][_0xd9c1('0x48')]({'where':{'sectionId':_0x541b72['id']},'raw':!![]})[_0xd9c1('0x2e')](function(_0x350fc0){_0x350fc0[_0xd9c1('0x69')](function(_0x56c58d){_0x7fa87['push'](_0x56c58d['resourceId']+0x15b38);});_0x5419f3(_0x7fa87);});}}catch(_0x439339){_0x312984(_0x439339);}});}exports[_0xd9c1('0x6c')]=function(_0x370b12,_0x42acc5){return db[_0xd9c1('0x47')][_0xd9c1('0x4c')]({'where':{'id':_0x370b12[_0xd9c1('0x4f')]['id']}})[_0xd9c1('0x2e')](handleEntityNotFound(_0x42acc5,null))[_0xd9c1('0x2e')](function(_0xb73034){if(_0xb73034){return db[_0xd9c1('0x56')][_0xd9c1('0x57')](function(_0x4ee431){return db[_0xd9c1('0x58')]['findAll']({'where':{'userProfileId':_0x370b12['params']['id']},'attributes':['id'],'raw':!![]})[_0xd9c1('0x2e')](function(_0x395acc){if(_0x395acc){return db[_0xd9c1('0x58')][_0xd9c1('0x5d')]({'where':{'userProfileId':_0x370b12['params']['id'],'id':_[_0xd9c1('0x33')](_0x395acc,function(_0x4e1cf6){return _0x4e1cf6['id'];})},'transaction':_0x4ee431});}})[_0xd9c1('0x2e')](function(_0x5bb5d3){var _0x2d0f4b=_[_0xd9c1('0x33')](_0x370b12[_0xd9c1('0x4e')],function(_0x42f1d2){_0x42f1d2[_0xd9c1('0x60')]=_0x370b12[_0xd9c1('0x4f')]['id'];return _0x42f1d2;});return db[_0xd9c1('0x58')][_0xd9c1('0x6d')](_0x2d0f4b,{'raw':!![],'transaction':_0x4ee431});})[_0xd9c1('0x2e')](function(_0x204699){var _0x11d835=_[_0xd9c1('0x43')](_['map'](_0x204699,function(_0x599c11){return _0x599c11[_0xd9c1('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x11d835){return db['UserProfileSection'][_0xd9c1('0x48')]({'where':{'userProfileId':_0x370b12['params']['id'],'sectionId':_['map'](_0x11d835,function(_0x6df4a7){return _0x6df4a7[_0xd9c1('0x5b')];})},'attributes':['id',_0xd9c1('0x5b')],'raw':!![]})[_0xd9c1('0x2e')](function(_0x58161b){var _0x3de592=_[_0xd9c1('0x33')](_0x370b12[_0xd9c1('0x4e')],function(_0x3b19ef){_0x3b19ef['userProfileId']=_0x370b12['params']['id'];return _0x3b19ef;});return db[_0xd9c1('0x5a')][_0xd9c1('0x6d')](_0x3de592,{'raw':!![],'transaction':_0x4ee431});});}})['catch'](handleError(_0x42acc5,null));});}})[_0xd9c1('0x2e')](function(_0xb0d713){var _0x4f4936=_[_0xd9c1('0x33')](_0xb0d713,function(_0x5902d7){return _0x5902d7['get']({'plain':!![]});});})[_0xd9c1('0x2e')](respondWithResult(_0x42acc5,null))[_0xd9c1('0x4a')](handleError(_0x42acc5,null));};exports['removeResources']=function(_0x564950,_0x7a6b9f,_0x139519){return db['UserProfile'][_0xd9c1('0x4c')]({'where':{'id':_0x564950[_0xd9c1('0x4f')]['id']}})[_0xd9c1('0x2e')](handleEntityNotFound(_0x7a6b9f,null))['then'](function(_0x5e2461){if(_0x5e2461){return _0x5e2461['removeResources'](_0x564950[_0xd9c1('0x38')]['ids']);}})[_0xd9c1('0x2e')](respondWithStatusCode(_0x7a6b9f,null))[_0xd9c1('0x4a')](handleError(_0x7a6b9f,null));};exports['getResources']=function(_0x18448f,_0x750de7){var _0x4ed163={};if(!_0x18448f[_0xd9c1('0x38')][_0xd9c1('0x6e')])throw new Error(_0xd9c1('0x6f'));if(!_0x18448f['query'][_0xd9c1('0x70')](_0xd9c1('0x3e'))){_0x4ed163['limit']=qs[_0xd9c1('0x27')](_0x18448f[_0xd9c1('0x38')][_0xd9c1('0x27')]);_0x4ed163[_0xd9c1('0x25')]=qs[_0xd9c1('0x25')](_0x18448f[_0xd9c1('0x38')][_0xd9c1('0x25')]);}return db[_0xd9c1('0x47')][_0xd9c1('0x4c')]({'where':{'id':_0x18448f[_0xd9c1('0x4f')]['id']}})[_0xd9c1('0x2e')](function(_0x456b0){if(!_0x456b0)throw new Error(_0xd9c1('0x71')+_0x18448f[_0xd9c1('0x4f')]['id']);return db['UserProfile'][_0xd9c1('0x72')](_0x18448f);})[_0xd9c1('0x2e')](respondWithFilteredResult(_0x750de7,_0x4ed163))[_0xd9c1('0x4a')](handleError(_0x750de7,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 81eafb7..8a1c863 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 _0xbedb=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x1e9c4d,_0x2a36c3){var _0x78a16c=function(_0x36ab8f){while(--_0x36ab8f){_0x1e9c4d['push'](_0x1e9c4d['shift']());}};_0x78a16c(++_0x2a36c3);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbbed('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xbbed('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbbed('0x2')](0x0);var events={'afterCreate':_0xbbed('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b6c41){return function(_0x1096c8,_0x6b20a4,_0x24d522){UserProfileEvents[_0xbbed('0x4')](_0x3b6c41+':'+_0x1096c8['id'],_0x1096c8);UserProfileEvents[_0xbbed('0x4')](_0x3b6c41,_0x1096c8);_0x24d522(null);};}for(var e in events){if(events[_0xbbed('0x5')](e)){var event=events[e];UserProfile[_0xbbed('0x6')](e,emitEvent(event));}}module[_0xbbed('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x4819=['save','update','remove','emit','exports','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x4819,0xcd));var _0x9481=function(_0x4e1ecc,_0x4497cf){_0x4e1ecc=_0x4e1ecc-0x0;var _0x5d9775=_0x4819[_0x4e1ecc];return _0x5d9775;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x9481('0x0'))['db'][_0x9481('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9481('0x2')](0x0);var events={'afterCreate':_0x9481('0x3'),'afterUpdate':_0x9481('0x4'),'afterDestroy':_0x9481('0x5')};function emitEvent(_0x40a703){return function(_0x14dc10,_0xc39edf,_0x16c617){UserProfileEvents['emit'](_0x40a703+':'+_0x14dc10['id'],_0x14dc10);UserProfileEvents[_0x9481('0x6')](_0x40a703,_0x14dc10);_0x16c617(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x9481('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 69609f7..209f721 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 _0x2a07=['chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueues','users','agents','telephones','admin','user','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','where','sequelize','query','OpenTabs','define','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','find','ignore','push','autoAssociation','all','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','AnalyticExtractedReport','includeAll','include','default','DefaultReports','custom','CustomReports','count','Tag','color','tag','rows','openTabs','true','chat','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0x2a07,0x74));var _0x72a0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2a07[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x72a0('0x0'));var attributes=require(_0x72a0('0x1'));var qs=require(_0x72a0('0x2'));var squel=require(_0x72a0('0x3'));module[_0x72a0('0x4')]=function(_0x548164){var _0x335b7c=_0x548164[_0x72a0('0x5')];function _0x135982(_0x45b155,_0x431f65){return new Promise(function(_0xce74c,_0x3ccf6d){if(!_0x431f65)return _0xce74c(null);var _0x20dab9=_0x431f65[_0x72a0('0x6')]?{[_0x431f65[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x431f65[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x45b155][_0x72a0('0x9')]({'where':_0x20dab9,'raw':!![]})[_0x72a0('0xa')](function(_0x2bc45b){_0x431f65['associatedResources']=_[_0x72a0('0xb')](_0x2bc45b,'id');_0xce74c(_0x431f65);})[_0x72a0('0xc')](function(_0x54abf6){_0x3ccf6d(_0x54abf6);});});}function _0x46fb8a(_0x194488,_0x1b85b1){return new Promise(function(_0x44d7cf,_0x975c27){var _0x516c08=_0x194488[_0x72a0('0x6')]?{[_0x194488[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x194488[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x194488[_0x72a0('0xd')]][_0x72a0('0x9')]({'where':_0x516c08,'raw':!![]})['then'](function(_0x4930c5){_0x1b85b1[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x4930c5,function(_0x19eaf9){return _0x19eaf9[_0x72a0('0xf')];});_0x44d7cf(_0x1b85b1);})[_0x72a0('0xc')](function(_0x3f3d62){_0x975c27(_0x3f3d62);});});}function _0x4ab55e(_0x30248e,_0x2e7552,_0x16ac70){if(!_0x2e7552)return Promise[_0x72a0('0x10')](null);return new Promise(function(_0x2d1e95,_0x54495e){return _0x335b7c[_0x72a0('0x11')][_0x72a0('0x9')]({'where':{'sectionId':_0x2e7552['id']},'raw':!![]})[_0x72a0('0xa')](function(_0x5b63c8){if(_0x30248e[_0x72a0('0x7')]&&_0x30248e[_0x72a0('0x7')]!=='id'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x5437df){return _0x5437df[_0x30248e[_0x72a0('0x7')]];});}else{if(_0x16ac70==='AnalyticExtractedReport'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0xde058c){return{'id':_0xde058c['resourceId'],'type':_0xde058c[_0x72a0('0x12')]};});}else{_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x3d1965){return _0x3d1965['resourceId'];});}}_0x2d1e95(_0x2e7552);})[_0x72a0('0xc')](function(_0x390464){_0x54495e(_0x390464);});});}function _0x1ddd54(_0x23b918,_0x3022b0){var _0x174b1b={'parentSections':[]};switch(_0x23b918['toLowerCase']()){case'squareprojects':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x14');break;case _0x72a0('0x15'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x16');break;case _0x72a0('0x17'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x18');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x1a'),'field':'name','foreignKey':_0x72a0('0x1b')}];break;case _0x72a0('0x1c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1d');break;case _0x72a0('0x1e'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1f');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x20'),'field':'id','foreignKey':_0x72a0('0x21')}];break;case'lists':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x22');break;case _0x72a0('0x23'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x24');break;case _0x72a0('0x25'):_0x174b1b[_0x72a0('0x13')]='CmCustomField';break;case _0x72a0('0x26'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x27');break;case _0x72a0('0x28'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x29');break;case _0x72a0('0x2a'):_0x174b1b[_0x72a0('0x13')]='FaxQueue';break;case _0x72a0('0x2b'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2c');break;case'inboundroutes':case _0x72a0('0x2d'):case'outboundroutes':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2e');break;case _0x72a0('0x2f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x30');break;case _0x72a0('0x31'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x32');break;case _0x72a0('0x33'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x34');_0x174b1b[_0x72a0('0x19')]=[{'name':'Agents','field':_0x72a0('0xf'),'foreignKey':'membername','model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x37')]}},{'name':_0x72a0('0x38'),'field':_0x72a0('0xf'),'foreignKey':_0x72a0('0x39'),'model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':_0x72a0('0x12'),'value':[_0x72a0('0x3d')]}},{'name':_0x72a0('0x3e'),'field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':'type','value':[_0x72a0('0x3f')]}}];break;case'musiconholds':_0x174b1b['childModel']='VoiceMusicOnHold';break;case _0x72a0('0x40'):_0x174b1b['childModel']=_0x72a0('0x41');break;case _0x72a0('0x42'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x43');break;case'ivrcampaigns':_0x174b1b['childModel']='Campaign';break;case'mailqueues':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x44');break;case'mailaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x45');break;case'mailsubstatuses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x46');break;case _0x72a0('0x47'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x48');break;case _0x72a0('0x49'):_0x174b1b['childModel']=_0x72a0('0x4a');break;case'smsqueues':_0x174b1b[_0x72a0('0x13')]='SmsQueue';break;case _0x72a0('0x4b'):_0x174b1b[_0x72a0('0x13')]='SmsAccount';break;case _0x72a0('0x4c'):_0x174b1b['childModel']=_0x72a0('0x4d');break;case _0x72a0('0x4e'):_0x174b1b[_0x72a0('0x13')]='WhatsappAccount';break;case _0x72a0('0x4f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x50');break;case'voicequeues':case'queuecampaigns':_0x174b1b[_0x72a0('0x13')]='VoiceQueue';if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x51')},{'name':_0x72a0('0x3e')}];}break;case _0x72a0('0x52'):case _0x72a0('0x53'):case _0x72a0('0x54'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x35');if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':'Users','filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x55'),_0x72a0('0x56')]},'ignore':!![]},{'name':_0x72a0('0x57')},{'name':_0x72a0('0x38')}];}break;case _0x72a0('0x58'):_0x174b1b[_0x72a0('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x59');break;case _0x72a0('0x5a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5b');break;case _0x72a0('0x5c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5d');break;case _0x72a0('0x5e'):_0x174b1b[_0x72a0('0x13')]='DeskAccount';break;case _0x72a0('0x5f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x60');break;case _0x72a0('0x61'):_0x174b1b[_0x72a0('0x13')]='User';break;case _0x72a0('0x62'):_0x174b1b['childModel']='CannedAnswer';break;case _0x72a0('0x63'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x64');break;case _0x72a0('0x65'):_0x174b1b[_0x72a0('0x13')]='Dashboard';break;case _0x72a0('0x66'):_0x174b1b[_0x72a0('0x13')]='Interval';break;case'pauses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x67');break;case _0x72a0('0x68'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x69');break;case _0x72a0('0x6a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6b');break;case'tags':_0x174b1b[_0x72a0('0x13')]='Tag';break;case'templates':_0x174b1b['childModel']=_0x72a0('0x6c');break;case _0x72a0('0x6d'):_0x174b1b['childModel']=_0x72a0('0x6e');break;case'trunks':_0x174b1b[_0x72a0('0x13')]='Trunk';break;case'variables':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6f');break;case'plugins':_0x174b1b[_0x72a0('0x13')]='Plugin';break;case _0x72a0('0x70'):_0x174b1b['childModel']='AnalyticExtractedReport';_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x71'),'field':'id','foreignKey':_0x72a0('0x72')}];break;case'metrics':_0x174b1b['childModel']=_0x72a0('0x73');break;}return _0x174b1b;}function _0x48f178(_0x44b171,_0x36d604){var _0x1cea02=_0x44b171[_0x72a0('0x74')](0x0)[_0x72a0('0x75')]()+_0x44b171[_0x72a0('0x76')](0x1);var _0x41f7f6={'type':_0x335b7c[_0x72a0('0x77')][_0x72a0('0x78')][_0x72a0('0x79')],'raw':!![]};return new Promise(function(_0x32a0bb,_0x43ec4b){var _0x4d0774=squel[_0x72a0('0x7a')]()['field']('ui.'+_0x1cea02+'InteractionId','id')['field'](_0x72a0('0x7b'))[_0x72a0('0x7c')](_0x72a0('0x7d')+_0x44b171+'_interactions','ui')[_0x72a0('0x7e')]('ui.UserId\x20=\x20?',_0x36d604['id']);return _0x335b7c[_0x72a0('0x7f')][_0x72a0('0x80')](_0x4d0774['toString'](),_0x41f7f6)[_0x72a0('0xa')](function(_0x24e211){_0x36d604[_0x1cea02+_0x72a0('0x81')]=_0x24e211;_0x32a0bb(_0x24e211);})[_0x72a0('0xc')](function(_0x5e47c4){_0x43ec4b(_0x5e47c4);});});}return _0x548164[_0x72a0('0x82')]('UserProfile',attributes,{'tableName':_0x72a0('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2cb292){var _0x1df6fc={'raw':![],'where':{}};var _0x47fe64={};var _0x432656={'count':0x0,'rows':[]};var _0x3eb3b5=_0x2cb292[_0x72a0('0x80')][_0x72a0('0x84')];var _0x100277=_0x2cb292['query']['mergeResources']||![];var _0xa65d14=_0x1ddd54(_0x3eb3b5,_0x100277);if(!_0xa65d14['childModel'])throw new Error(_0x72a0('0x85')+_0x3eb3b5+'\x27');var _0x523bd0=[{'name':_0x3eb3b5}];if(!_[_0x72a0('0x86')](_0xa65d14[_0x72a0('0x19')]))_0x523bd0=_0xa65d14['parentSections'];var _0x1cfd1d=[];for(var _0x1b960e=0x0;_0x1b960e<_0x523bd0[_0x72a0('0x87')];_0x1b960e++){_0x1cfd1d['push'](_0x335b7c[_0x72a0('0x88')]['find']({'where':{'userProfileId':_0x2cb292[_0x72a0('0x89')]['id'],'name':_0x523bd0[_0x1b960e][_0x72a0('0xf')]},'raw':!![]}));}return Promise['all'](_0x1cfd1d)[_0x72a0('0xa')](function(_0x4b6e60){var _0x4c32db=_['filter'](_0x4b6e60,function(_0x28969a){return _0x28969a?_0x28969a:undefined;});var _0x4a0373=_[_0x72a0('0x6')](_0x523bd0,['ignore',!![]]);var _0x29fff7=_[_0x72a0('0x86')](_0x4c32db)&&_[_0x72a0('0x86')](_0x4a0373)?null:_['union'](_0x4a0373,_0x4c32db);if(!_0x29fff7)return null;var _0x1f8e98=[];for(var _0x420d8d=0x0;_0x420d8d<_0x29fff7[_0x72a0('0x87')];_0x420d8d++){var _0x28551a=_[_0x72a0('0x8a')](_0x523bd0,function(_0x58ef97){return _0x29fff7[_0x420d8d]?_0x58ef97[_0x72a0('0xf')]===_0x29fff7[_0x420d8d][_0x72a0('0xf')]:null;});if(_0x28551a){if(_0x29fff7[_0x420d8d][_0x72a0('0x8b')]){_0x1f8e98[_0x72a0('0x8c')](_0x135982(_0xa65d14['childModel'],_0x29fff7[_0x420d8d]));}else{if(!_0x29fff7[_0x420d8d][_0x72a0('0x8d')]){_0x1f8e98[_0x72a0('0x8c')](_0x4ab55e(_0x28551a,_0x29fff7[_0x420d8d],_0xa65d14['childModel']));}else{if(_0x28551a[_0x72a0('0xd')]){_0x1f8e98['push'](_0x46fb8a(_0x28551a,_0x29fff7[_0x420d8d]));}}}}}return Promise[_0x72a0('0x8e')](_0x1f8e98);})[_0x72a0('0xa')](function(_0xb17e09){var _0x1238a3=_0xb17e09;var _0x14f61a=null;if(_0x1238a3){_0x14f61a=_0x1238a3[_0x72a0('0x87')]===0x1?_0x1238a3[0x0]:null;}if(!_0x14f61a&&!_0x1238a3)return _0x432656;var _0x7450c7=_0x335b7c[_0xa65d14['childModel']]['rawAttributes'];_0x47fe64['model']=_[_0x72a0('0x8f')](_0x7450c7);_0x47fe64[_0x72a0('0x80')]=_[_0x72a0('0x8f')](_0x2cb292[_0x72a0('0x80')]);_0x47fe64[_0x72a0('0x90')]=_[_0x72a0('0x91')](_0x47fe64['model'],_0x47fe64[_0x72a0('0x80')]);_0x1df6fc[_0x72a0('0x92')]=_[_0x72a0('0x91')](_0x47fe64[_0x72a0('0xd')],qs[_0x72a0('0x93')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x93')]));_0x1df6fc['attributes']=_0x1df6fc[_0x72a0('0x92')][_0x72a0('0x87')]?_0x1df6fc[_0x72a0('0x92')]:_0x47fe64[_0x72a0('0xd')];if(!_0x2cb292[_0x72a0('0x80')][_0x72a0('0x94')]('nolimit')){_0x1df6fc[_0x72a0('0x95')]=qs['limit'](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x95')]);_0x1df6fc[_0x72a0('0x96')]=qs[_0x72a0('0x96')](_0x2cb292[_0x72a0('0x80')]['offset']);}_0x1df6fc[_0x72a0('0x97')]=qs[_0x72a0('0x98')](_0x2cb292['query'][_0x72a0('0x98')]);_0x1df6fc[_0x72a0('0x7e')]=qs[_0x72a0('0x90')](_[_0x72a0('0x99')](_0x2cb292['query'],_0x47fe64[_0x72a0('0x90')]));if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x9a')](_0x1df6fc[_0x72a0('0x7e')],{'$or':_[_0x72a0('0xb')](_0x7450c7,function(_0x1d2dfb){if(_0x1d2dfb[_0x72a0('0x12')][_0x72a0('0x9b')]!==_0x72a0('0x9c')){var _0x109e9e={};_0x109e9e[_0x1d2dfb['field']]={'$like':'%'+_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]+'%'};return _0x109e9e;}})});}var _0xe0411e=[];var _0x3cbbcd=null;var _0xada6ad={};if(_0x14f61a){_0x3cbbcd=_[_0x72a0('0x8a')](_0x523bd0,[_0x72a0('0xf'),_0x14f61a[_0x72a0('0xf')]]);if(_0x3cbbcd['field']){_0xada6ad={};if(_0xa65d14[_0x72a0('0x13')]==='AnalyticExtractedReport'){_0xada6ad[_0x3cbbcd['foreignKey']]=_[_0x72a0('0xb')](_0x14f61a['associatedResources'],'id');}else{_0xada6ad[_0x3cbbcd['foreignKey']]=_0x14f61a[_0x72a0('0xe')];}_0xe0411e['push'](_0xada6ad);}else{_0x1df6fc[_0x72a0('0x7e')]['id']=_0x14f61a[_0x72a0('0xe')];}}else{for(var _0xb4cdec=0x0;_0xb4cdec<_0x1238a3['length'];_0xb4cdec++){_0x3cbbcd=_[_0x72a0('0x8a')](_0x523bd0,[_0x72a0('0xf'),_0x1238a3[_0xb4cdec][_0x72a0('0xf')]]);if(_0x3cbbcd[_0x72a0('0x7')]){_0xada6ad={};_0xada6ad[_0x3cbbcd[_0x72a0('0x9d')]]=_0x1238a3[_0xb4cdec]['associatedResources'];_0xe0411e[_0x72a0('0x8c')](_0xada6ad);}else{if(!_0x1df6fc[_0x72a0('0x7e')]['id'])_0x1df6fc[_0x72a0('0x7e')]['id']=[];_0x1238a3[_0xb4cdec]['associatedResources'][_0x72a0('0x9e')](function(_0x2e3eb0){_0x1df6fc[_0x72a0('0x7e')]['id']['push'](_0x2e3eb0);});}}}if(!_[_0x72a0('0x86')](_0xe0411e)){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x9a')](_0x1df6fc[_0x72a0('0x7e')],{'$and':{'$or':_0xe0411e}});}_0x1df6fc=_[_0x72a0('0x9a')]({},_0x1df6fc,_0x2cb292[_0x72a0('0x9f')]);if(_0x14f61a&&!_0x14f61a[_0x72a0('0x8d')]&&_0xa65d14[_0x72a0('0x13')]===_0x72a0('0xa0')){if(_0x2cb292['query'][_0x72a0('0xa1')]){_0x1df6fc[_0x72a0('0xa2')]=[{'all':!![]}];}return _0x335b7c[_0xa65d14[_0x72a0('0x13')]][_0x72a0('0x9')](_0x1df6fc)[_0x72a0('0xa')](function(_0x5b72b7){var _0x311dcd=[];_0x5b72b7[_0x72a0('0x9e')](function(_0x1c95fc){var _0x4124e7;switch(_0x1c95fc['reportType']){case _0x72a0('0xa3'):_0x4124e7=_[_0x72a0('0x8a')](_0x14f61a[_0x72a0('0xe')],function(_0x59d3a7){return _0x59d3a7['id']===_0x1c95fc['reportId']&&_0x59d3a7[_0x72a0('0x12')]===_0x72a0('0xa4');});break;case _0x72a0('0xa5'):_0x4124e7=_[_0x72a0('0x8a')](_0x14f61a[_0x72a0('0xe')],function(_0x56e9c0){return _0x56e9c0['id']===_0x1c95fc['reportId']&&_0x56e9c0['type']===_0x72a0('0xa6');});break;}if(_0x4124e7)_0x311dcd['push'](_0x1c95fc);});_0x432656[_0x72a0('0xa7')]=_0x311dcd['length'];_0x432656['rows']=_0x311dcd;return _0x432656;});}else{return _0x335b7c[_0xa65d14['childModel']]['count']({'where':_0x1df6fc[_0x72a0('0x7e')]})[_0x72a0('0xa')](function(_0x153802){_0x432656[_0x72a0('0xa7')]=_0x153802;if(_0x2cb292['query'][_0x72a0('0xa1')]){if(_0xa65d14[_0x72a0('0x13')]==='CmContact'){_0x1df6fc[_0x72a0('0xa2')]=[{'model':_0x335b7c[_0x72a0('0xa8')],'as':'Tags','attributes':['id',_0x72a0('0xf'),_0x72a0('0xa9')],'required':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xaa')]?!![]:![]},{'model':_0x335b7c['Tag'],'as':'ThroughTags','attributes':['id',_0x72a0('0xf'),_0x72a0('0xa9')],'through':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xaa')]?{'attributes':[],'where':{'TagId':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xaa')]||undefined}}:{},'required':_0x2cb292['query']['tag']?!![]:![]}];}else{_0x1df6fc[_0x72a0('0xa2')]=[{'all':!![]}];}}return _0x335b7c[_0xa65d14[_0x72a0('0x13')]]['findAll'](_0x1df6fc);})[_0x72a0('0xa')](function(_0x3a8fee){_0x432656[_0x72a0('0xab')]=_0x3a8fee;if(_0x3eb3b5===_0x72a0('0x57')&&_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]===_0x72a0('0xad')){var _0x56bdf5=[];for(var _0x42e186=0x0;_0x42e186<_0x432656[_0x72a0('0xab')][_0x72a0('0x87')];_0x42e186++){_0x56bdf5['push'](_0x48f178(_0x72a0('0xae'),_0x432656[_0x72a0('0xab')][_0x42e186][_0x72a0('0xaf')]));_0x56bdf5[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb0'),_0x432656['rows'][_0x42e186][_0x72a0('0xaf')]));_0x56bdf5[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb1'),_0x432656[_0x72a0('0xab')][_0x42e186][_0x72a0('0xaf')]));_0x56bdf5[_0x72a0('0x8c')](_0x48f178('mail',_0x432656[_0x72a0('0xab')][_0x42e186][_0x72a0('0xaf')]));_0x56bdf5[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb2'),_0x432656[_0x72a0('0xab')][_0x42e186][_0x72a0('0xaf')]));_0x56bdf5[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb3'),_0x432656[_0x72a0('0xab')][_0x42e186]['dataValues']));}return Promise[_0x72a0('0x8e')](_0x56bdf5)['then'](function(){return _0x432656;});}return _0x432656;});}});}}});}; \ No newline at end of file +var _0xb091=['map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','Disposition','Dashboard','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','find','ignore','isEmpty','union','push','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','default','DefaultReports','custom','CustomReports','count','rows','include','Tag','Tags','color','tag','ThroughTags','openTabs','true','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','then','associatedResources'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xb091,0x16e));var _0x1b09=function(_0x2d16e0,_0x45c01f){_0x2d16e0=_0x2d16e0-0x0;var _0x17d74a=_0xb091[_0x2d16e0];return _0x17d74a;};'use strict';var _=require('lodash');var attributes=require(_0x1b09('0x0'));var qs=require(_0x1b09('0x1'));var squel=require(_0x1b09('0x2'));module[_0x1b09('0x3')]=function(_0x56c107){var _0xa6ef49=_0x56c107['models'];function _0x5aa3b0(_0x295863,_0x24d22c){return new Promise(function(_0x4e252c,_0xda8caa){if(!_0x24d22c)return _0x4e252c(null);var _0x5fa348=_0x24d22c[_0x1b09('0x4')]?{[_0x24d22c['filter'][_0x1b09('0x5')]]:_0x24d22c[_0x1b09('0x4')][_0x1b09('0x6')]}:undefined;return _0xa6ef49[_0x295863][_0x1b09('0x7')]({'where':_0x5fa348,'raw':!![]})[_0x1b09('0x8')](function(_0x3362e4){_0x24d22c[_0x1b09('0x9')]=_[_0x1b09('0xa')](_0x3362e4,'id');_0x4e252c(_0x24d22c);})[_0x1b09('0xb')](function(_0x36aa1b){_0xda8caa(_0x36aa1b);});});}function _0x14dac6(_0x5f31ac,_0x40082a){return new Promise(function(_0x894b73,_0x5690cb){var _0x4c28c4=_0x5f31ac[_0x1b09('0x4')]?{[_0x5f31ac[_0x1b09('0x4')][_0x1b09('0x5')]]:_0x5f31ac[_0x1b09('0x4')][_0x1b09('0x6')]}:undefined;return _0xa6ef49[_0x5f31ac[_0x1b09('0xc')]][_0x1b09('0x7')]({'where':_0x4c28c4,'raw':!![]})['then'](function(_0x37fdb2){_0x40082a['associatedResources']=_[_0x1b09('0xa')](_0x37fdb2,function(_0x27a731){return _0x27a731[_0x1b09('0xd')];});_0x894b73(_0x40082a);})[_0x1b09('0xb')](function(_0x10b7eb){_0x5690cb(_0x10b7eb);});});}function _0x1dc96b(_0x64689a,_0x33129b,_0x1196b2){if(!_0x33129b)return Promise[_0x1b09('0xe')](null);return new Promise(function(_0x311158,_0x231ef6){return _0xa6ef49[_0x1b09('0xf')]['findAll']({'where':{'sectionId':_0x33129b['id']},'raw':!![]})[_0x1b09('0x8')](function(_0x1c1ef9){if(_0x64689a['field']&&_0x64689a['field']!=='id'){_0x33129b[_0x1b09('0x9')]=_['map'](_0x1c1ef9,function(_0x267b5e){return _0x267b5e[_0x64689a['field']];});}else{if(_0x1196b2===_0x1b09('0x10')){_0x33129b[_0x1b09('0x9')]=_[_0x1b09('0xa')](_0x1c1ef9,function(_0x1e8f97){return{'id':_0x1e8f97[_0x1b09('0x11')],'type':_0x1e8f97[_0x1b09('0x12')]};});}else{_0x33129b[_0x1b09('0x9')]=_[_0x1b09('0xa')](_0x1c1ef9,function(_0x48b803){return _0x48b803['resourceId'];});}}_0x311158(_0x33129b);})[_0x1b09('0xb')](function(_0x41c786){_0x231ef6(_0x41c786);});});}function _0x4ce7dc(_0x3c0496,_0x11d0d5){var _0x6e132c={'parentSections':[]};switch(_0x3c0496[_0x1b09('0x13')]()){case'squareprojects':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x15');break;case'odbc':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x16');break;case'squarerecordings':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x17');_0x6e132c[_0x1b09('0x18')]=[{'name':_0x1b09('0x19'),'field':'name','foreignKey':_0x1b09('0x1a')}];break;case _0x1b09('0x1b'):_0x6e132c['childModel']=_0x1b09('0x1c');break;case _0x1b09('0x1d'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x1e');_0x6e132c[_0x1b09('0x18')]=[{'name':_0x1b09('0x1f'),'field':'id','foreignKey':_0x1b09('0x20')}];break;case'lists':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x21');break;case'companies':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x22');break;case _0x1b09('0x23'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x24');break;case'chatqueues':_0x6e132c[_0x1b09('0x14')]='ChatQueue';break;case _0x1b09('0x25'):_0x6e132c['childModel']=_0x1b09('0x26');break;case _0x1b09('0x27'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x28');break;case _0x1b09('0x29'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x2a');break;case _0x1b09('0x2b'):case _0x1b09('0x2c'):case _0x1b09('0x2d'):_0x6e132c['childModel']=_0x1b09('0x2e');break;case _0x1b09('0x2f'):_0x6e132c[_0x1b09('0x14')]='VoiceContext';break;case _0x1b09('0x30'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x31');break;case _0x1b09('0x32'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x33');_0x6e132c[_0x1b09('0x18')]=[{'name':_0x1b09('0x34'),'field':'name','foreignKey':_0x1b09('0x35'),'model':'User','filter':{'field':_0x1b09('0x36'),'value':['agent']}},{'name':_0x1b09('0x37'),'field':_0x1b09('0xd'),'foreignKey':_0x1b09('0x35'),'model':_0x1b09('0x38'),'filter':{'field':_0x1b09('0x36'),'value':[_0x1b09('0x39')]}},{'name':_0x1b09('0x3a'),'field':_0x1b09('0xd'),'foreignKey':_0x1b09('0x3b'),'model':_0x1b09('0x3c'),'filter':{'field':_0x1b09('0x12'),'value':[_0x1b09('0x3d')]}},{'name':_0x1b09('0x3e'),'field':'name','foreignKey':'queue','model':_0x1b09('0x3c'),'filter':{'field':_0x1b09('0x12'),'value':[_0x1b09('0x3f')]}}];break;case _0x1b09('0x40'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x41');break;case _0x1b09('0x42'):_0x6e132c[_0x1b09('0x14')]='VoiceChanSpy';break;case'voiceprefixes':_0x6e132c[_0x1b09('0x14')]='VoicePrefix';break;case _0x1b09('0x43'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x44');break;case'mailqueues':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x45');break;case _0x1b09('0x46'):_0x6e132c['childModel']=_0x1b09('0x47');break;case _0x1b09('0x48'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x49');break;case'openchannelqueues':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x4a');break;case'openchannelaccounts':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x4b');break;case'smsqueues':_0x6e132c['childModel']='SmsQueue';break;case'smsaccounts':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x4c');break;case _0x1b09('0x4d'):_0x6e132c['childModel']=_0x1b09('0x4e');break;case _0x1b09('0x4f'):_0x6e132c['childModel']=_0x1b09('0x50');break;case _0x1b09('0x51'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x52');break;case _0x1b09('0x53'):case _0x1b09('0x54'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x3c');if(_0x11d0d5){_0x6e132c[_0x1b09('0x18')]=[{'name':_0x1b09('0x3a')},{'name':'QueueCampaigns'}];}break;case _0x1b09('0x55'):case _0x1b09('0x56'):case _0x1b09('0x57'):_0x6e132c['childModel']=_0x1b09('0x38');if(_0x11d0d5){_0x6e132c['parentSections']=[{'name':_0x1b09('0x58'),'filter':{'field':_0x1b09('0x36'),'value':['admin',_0x1b09('0x59')]},'ignore':!![]},{'name':_0x1b09('0x34')},{'name':_0x1b09('0x37')}];}break;case _0x1b09('0x5a'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x5b');break;case'salesforceaccounts':_0x6e132c[_0x1b09('0x14')]='SalesforceAccount';break;case _0x1b09('0x5c'):_0x6e132c['childModel']='FreshdeskAccount';break;case _0x1b09('0x5d'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x5e');break;case _0x1b09('0x5f'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x60');break;case _0x1b09('0x61'):_0x6e132c[_0x1b09('0x14')]='ZohoAccount';break;case _0x1b09('0x62'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x38');break;case'cannedanswers':_0x6e132c['childModel']=_0x1b09('0x63');break;case'dispositions':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x64');break;case'customdashboards':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x65');break;case'intervals':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x66');break;case _0x1b09('0x67'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x68');break;case'scheduler':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x69');break;case _0x1b09('0x6a'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x6b');break;case _0x1b09('0x6c'):_0x6e132c[_0x1b09('0x14')]='Tag';break;case'templates':_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x6d');break;case _0x1b09('0x6e'):_0x6e132c['childModel']=_0x1b09('0x6f');break;case _0x1b09('0x70'):_0x6e132c[_0x1b09('0x14')]='Trunk';break;case _0x1b09('0x71'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x72');break;case _0x1b09('0x73'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x74');break;case _0x1b09('0x75'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x10');_0x6e132c[_0x1b09('0x18')]=[{'name':_0x1b09('0x76'),'field':'id','foreignKey':_0x1b09('0x77')}];break;case _0x1b09('0x78'):_0x6e132c[_0x1b09('0x14')]=_0x1b09('0x79');break;}return _0x6e132c;}function _0x4ca41c(_0x5766cb,_0x2cc31e){var _0x54efba=_0x5766cb[_0x1b09('0x7a')](0x0)[_0x1b09('0x7b')]()+_0x5766cb[_0x1b09('0x7c')](0x1);var _0x5b284f={'type':_0xa6ef49['Sequelize'][_0x1b09('0x7d')][_0x1b09('0x7e')],'raw':!![]};return new Promise(function(_0x5ad730,_0xbaf193){var _0x2f2388=squel[_0x1b09('0x7f')]()[_0x1b09('0x5')](_0x1b09('0x80')+_0x54efba+_0x1b09('0x81'),'id')[_0x1b09('0x5')]('ui.createdAt')[_0x1b09('0x82')]('user_has_'+_0x5766cb+_0x1b09('0x83'),'ui')[_0x1b09('0x84')](_0x1b09('0x85'),_0x2cc31e['id']);return _0xa6ef49[_0x1b09('0x86')][_0x1b09('0x87')](_0x2f2388[_0x1b09('0x88')](),_0x5b284f)[_0x1b09('0x8')](function(_0x44ffc1){_0x2cc31e[_0x54efba+_0x1b09('0x89')]=_0x44ffc1;_0x5ad730(_0x44ffc1);})[_0x1b09('0xb')](function(_0x391790){_0xbaf193(_0x391790);});});}return _0x56c107[_0x1b09('0x8a')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x14f94b){var _0x314411={'raw':![],'where':{}};var _0x7e199d={};var _0x4c3068={'count':0x0,'rows':[]};var _0x42fa10=_0x14f94b[_0x1b09('0x87')][_0x1b09('0x8b')];var _0x57bec1=_0x14f94b[_0x1b09('0x87')][_0x1b09('0x8c')]||![];var _0x187a11=_0x4ce7dc(_0x42fa10,_0x57bec1);if(!_0x187a11['childModel'])throw new Error(_0x1b09('0x8d')+_0x42fa10+'\x27');var _0x54c7c6=[{'name':_0x42fa10}];if(!_['isEmpty'](_0x187a11[_0x1b09('0x18')]))_0x54c7c6=_0x187a11[_0x1b09('0x18')];var _0x10e809=[];for(var _0x527f4e=0x0;_0x527f4e<_0x54c7c6[_0x1b09('0x8e')];_0x527f4e++){_0x10e809['push'](_0xa6ef49[_0x1b09('0x8f')][_0x1b09('0x90')]({'where':{'userProfileId':_0x14f94b['params']['id'],'name':_0x54c7c6[_0x527f4e][_0x1b09('0xd')]},'raw':!![]}));}return Promise['all'](_0x10e809)[_0x1b09('0x8')](function(_0x2a537d){var _0x52b5cf=_[_0x1b09('0x4')](_0x2a537d,function(_0x597a68){return _0x597a68?_0x597a68:undefined;});var _0x2472b4=_[_0x1b09('0x4')](_0x54c7c6,[_0x1b09('0x91'),!![]]);var _0x1a357d=_[_0x1b09('0x92')](_0x52b5cf)&&_['isEmpty'](_0x2472b4)?null:_[_0x1b09('0x93')](_0x2472b4,_0x52b5cf);if(!_0x1a357d)return null;var _0x150b7e=[];for(var _0x410138=0x0;_0x410138<_0x1a357d['length'];_0x410138++){var _0x701d0e=_[_0x1b09('0x90')](_0x54c7c6,function(_0x29cf4e){return _0x1a357d[_0x410138]?_0x29cf4e[_0x1b09('0xd')]===_0x1a357d[_0x410138][_0x1b09('0xd')]:null;});if(_0x701d0e){if(_0x1a357d[_0x410138]['ignore']){_0x150b7e[_0x1b09('0x94')](_0x5aa3b0(_0x187a11['childModel'],_0x1a357d[_0x410138]));}else{if(!_0x1a357d[_0x410138][_0x1b09('0x95')]){_0x150b7e[_0x1b09('0x94')](_0x1dc96b(_0x701d0e,_0x1a357d[_0x410138],_0x187a11[_0x1b09('0x14')]));}else{if(_0x701d0e[_0x1b09('0xc')]){_0x150b7e[_0x1b09('0x94')](_0x14dac6(_0x701d0e,_0x1a357d[_0x410138]));}}}}}return Promise[_0x1b09('0x96')](_0x150b7e);})[_0x1b09('0x8')](function(_0x3db691){var _0x4e74de=_0x3db691;var _0xdcd93e=null;if(_0x4e74de){_0xdcd93e=_0x4e74de[_0x1b09('0x8e')]===0x1?_0x4e74de[0x0]:null;}if(!_0xdcd93e&&!_0x4e74de)return _0x4c3068;var _0x58c56e=_0xa6ef49[_0x187a11[_0x1b09('0x14')]][_0x1b09('0x97')];_0x7e199d[_0x1b09('0xc')]=_[_0x1b09('0x98')](_0x58c56e);_0x7e199d[_0x1b09('0x87')]=_[_0x1b09('0x98')](_0x14f94b[_0x1b09('0x87')]);_0x7e199d[_0x1b09('0x99')]=_[_0x1b09('0x9a')](_0x7e199d['model'],_0x7e199d[_0x1b09('0x87')]);_0x314411[_0x1b09('0x9b')]=_[_0x1b09('0x9a')](_0x7e199d[_0x1b09('0xc')],qs[_0x1b09('0x9c')](_0x14f94b['query'][_0x1b09('0x9c')]));_0x314411[_0x1b09('0x9b')]=_0x314411['attributes'][_0x1b09('0x8e')]?_0x314411['attributes']:_0x7e199d[_0x1b09('0xc')];if(!_0x14f94b[_0x1b09('0x87')][_0x1b09('0x9d')]('nolimit')){_0x314411['limit']=qs['limit'](_0x14f94b[_0x1b09('0x87')][_0x1b09('0x9e')]);_0x314411[_0x1b09('0x9f')]=qs[_0x1b09('0x9f')](_0x14f94b[_0x1b09('0x87')][_0x1b09('0x9f')]);}_0x314411[_0x1b09('0xa0')]=qs[_0x1b09('0xa1')](_0x14f94b[_0x1b09('0x87')][_0x1b09('0xa1')]);_0x314411[_0x1b09('0x84')]=qs[_0x1b09('0x99')](_['pick'](_0x14f94b['query'],_0x7e199d[_0x1b09('0x99')]));if(_0x14f94b[_0x1b09('0x87')][_0x1b09('0x4')]){_0x314411[_0x1b09('0x84')]=_[_0x1b09('0xa2')](_0x314411[_0x1b09('0x84')],{'$or':_[_0x1b09('0xa')](_0x58c56e,function(_0x52f219){if(_0x52f219[_0x1b09('0x12')][_0x1b09('0xa3')]!==_0x1b09('0xa4')){var _0x4f777b={};_0x4f777b[_0x52f219[_0x1b09('0x5')]]={'$like':'%'+_0x14f94b[_0x1b09('0x87')][_0x1b09('0x4')]+'%'};return _0x4f777b;}})});}var _0x1de91c=[];var _0x2d95b1=null;var _0x4ae2a6={};if(_0xdcd93e){_0x2d95b1=_['find'](_0x54c7c6,[_0x1b09('0xd'),_0xdcd93e[_0x1b09('0xd')]]);if(_0x2d95b1['field']){_0x4ae2a6={};if(_0x187a11[_0x1b09('0x14')]==='AnalyticExtractedReport'){_0x4ae2a6[_0x2d95b1[_0x1b09('0xa5')]]=_[_0x1b09('0xa')](_0xdcd93e[_0x1b09('0x9')],'id');}else{_0x4ae2a6[_0x2d95b1['foreignKey']]=_0xdcd93e[_0x1b09('0x9')];}_0x1de91c['push'](_0x4ae2a6);}else{_0x314411['where']['id']=_0xdcd93e[_0x1b09('0x9')];}}else{for(var _0x4a9d0e=0x0;_0x4a9d0e<_0x4e74de['length'];_0x4a9d0e++){_0x2d95b1=_['find'](_0x54c7c6,[_0x1b09('0xd'),_0x4e74de[_0x4a9d0e][_0x1b09('0xd')]]);if(_0x2d95b1[_0x1b09('0x5')]){_0x4ae2a6={};_0x4ae2a6[_0x2d95b1[_0x1b09('0xa5')]]=_0x4e74de[_0x4a9d0e]['associatedResources'];_0x1de91c[_0x1b09('0x94')](_0x4ae2a6);}else{if(!_0x314411[_0x1b09('0x84')]['id'])_0x314411[_0x1b09('0x84')]['id']=[];_0x4e74de[_0x4a9d0e][_0x1b09('0x9')][_0x1b09('0xa6')](function(_0x4e1562){_0x314411[_0x1b09('0x84')]['id'][_0x1b09('0x94')](_0x4e1562);});}}}if(!_[_0x1b09('0x92')](_0x1de91c)){_0x314411[_0x1b09('0x84')]=_['merge'](_0x314411['where'],{'$and':{'$or':_0x1de91c}});}_0x314411=_['merge']({},_0x314411,_0x14f94b[_0x1b09('0xa7')]);if(_0xdcd93e&&!_0xdcd93e[_0x1b09('0x95')]&&_0x187a11[_0x1b09('0x14')]===_0x1b09('0x10')){if(_0x14f94b[_0x1b09('0x87')][_0x1b09('0xa8')]){_0x314411['include']=[{'all':!![]}];}return _0xa6ef49[_0x187a11[_0x1b09('0x14')]][_0x1b09('0x7')](_0x314411)['then'](function(_0x56be94){var _0x356d3a=[];_0x56be94[_0x1b09('0xa6')](function(_0x145a82){var _0x49a600;switch(_0x145a82['reportType']){case _0x1b09('0xa9'):_0x49a600=_['find'](_0xdcd93e[_0x1b09('0x9')],function(_0x52c640){return _0x52c640['id']===_0x145a82['reportId']&&_0x52c640[_0x1b09('0x12')]===_0x1b09('0xaa');});break;case _0x1b09('0xab'):_0x49a600=_['find'](_0xdcd93e[_0x1b09('0x9')],function(_0x29aeaf){return _0x29aeaf['id']===_0x145a82[_0x1b09('0x77')]&&_0x29aeaf[_0x1b09('0x12')]===_0x1b09('0xac');});break;}if(_0x49a600)_0x356d3a[_0x1b09('0x94')](_0x145a82);});_0x4c3068[_0x1b09('0xad')]=_0x356d3a['length'];_0x4c3068[_0x1b09('0xae')]=_0x356d3a;return _0x4c3068;});}else{return _0xa6ef49[_0x187a11['childModel']][_0x1b09('0xad')]({'where':_0x314411[_0x1b09('0x84')]})['then'](function(_0x20b050){_0x4c3068[_0x1b09('0xad')]=_0x20b050;if(_0x14f94b['query']['includeAll']){if(_0x187a11[_0x1b09('0x14')]===_0x1b09('0x1e')){_0x314411[_0x1b09('0xaf')]=[{'model':_0xa6ef49[_0x1b09('0xb0')],'as':_0x1b09('0xb1'),'attributes':['id',_0x1b09('0xd'),_0x1b09('0xb2')],'required':_0x14f94b[_0x1b09('0x87')][_0x1b09('0xb3')]?!![]:![]},{'model':_0xa6ef49[_0x1b09('0xb0')],'as':_0x1b09('0xb4'),'attributes':['id',_0x1b09('0xd'),_0x1b09('0xb2')],'through':_0x14f94b['query'][_0x1b09('0xb3')]?{'attributes':[],'where':{'TagId':_0x14f94b[_0x1b09('0x87')][_0x1b09('0xb3')]||undefined}}:{},'required':_0x14f94b[_0x1b09('0x87')][_0x1b09('0xb3')]?!![]:![]}];}else{_0x314411[_0x1b09('0xaf')]=[{'all':!![]}];}}return _0xa6ef49[_0x187a11[_0x1b09('0x14')]][_0x1b09('0x7')](_0x314411);})[_0x1b09('0x8')](function(_0x3c6ebe){_0x4c3068[_0x1b09('0xae')]=_0x3c6ebe;if(_0x42fa10===_0x1b09('0x34')&&_0x14f94b[_0x1b09('0x87')][_0x1b09('0xb5')]===_0x1b09('0xb6')){var _0x2ab5e5=[];for(var _0x590266=0x0;_0x590266<_0x4c3068['rows']['length'];_0x590266++){_0x2ab5e5['push'](_0x4ca41c('chat',_0x4c3068[_0x1b09('0xae')][_0x590266][_0x1b09('0xb7')]));_0x2ab5e5['push'](_0x4ca41c('sms',_0x4c3068[_0x1b09('0xae')][_0x590266][_0x1b09('0xb7')]));_0x2ab5e5[_0x1b09('0x94')](_0x4ca41c(_0x1b09('0xb8'),_0x4c3068[_0x1b09('0xae')][_0x590266][_0x1b09('0xb7')]));_0x2ab5e5[_0x1b09('0x94')](_0x4ca41c(_0x1b09('0xb9'),_0x4c3068[_0x1b09('0xae')][_0x590266]['dataValues']));_0x2ab5e5[_0x1b09('0x94')](_0x4ca41c(_0x1b09('0xba'),_0x4c3068[_0x1b09('0xae')][_0x590266]['dataValues']));_0x2ab5e5[_0x1b09('0x94')](_0x4ca41c(_0x1b09('0xbb'),_0x4c3068[_0x1b09('0xae')][_0x590266][_0x1b09('0xb7')]));}return Promise[_0x1b09('0x96')](_0x2ab5e5)[_0x1b09('0x8')](function(){return _0x4c3068;});}return _0x4c3068;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0883cf8..8558fef 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 _0x5496=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x5496,0x175));var _0x6549=function(_0x31b1dc,_0x40e0f9){_0x31b1dc=_0x31b1dc-0x0;var _0x4fd1c3=_0x5496[_0x31b1dc];return _0x4fd1c3;};'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});config[_0x6549('0xa')]=_['defaults'](config[_0x6549('0xa')],{'host':_0x6549('0xb'),'port':0x18eb});var socket=require(_0x6549('0xc'))(new Redis(config['redis']));require(_0x6549('0xd'))[_0x6549('0xe')](socket);function respondWithRpcPromise(_0x2ecce2,_0x135c2c,_0x1e5083){return new BPromise(function(_0x3e08a6,_0x50fa35){return client['request'](_0x2ecce2,_0x1e5083)[_0x6549('0xf')](function(_0xac828c){logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,_0x6549('0x12'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x135c2c,_0x6549('0x12'),JSON[_0x6549('0x13')](_0xac828c));if(_0xac828c['error']){if(_0xac828c[_0x6549('0x14')][_0x6549('0x15')]===0x1f4){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);return _0x50fa35(_0xac828c['error']['message']);}logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c['error'][_0x6549('0x16')]);return _0x3e08a6(_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);}else{logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,'request\x20sent');_0x3e08a6(_0xac828c['result'][_0x6549('0x16')]);}})['catch'](function(_0x56c15b){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0x56c15b);_0x50fa35(_0x56c15b);});});} \ No newline at end of file +var _0xa701=['UserProfile,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x342874,_0xae5304){var _0x503c39=function(_0xd68ca4){while(--_0xd68ca4){_0x342874['push'](_0x342874['shift']());}};_0x503c39(++_0xae5304);}(_0xa701,0xd4));var _0x1a70=function(_0x174cd9,_0x29f608){_0x174cd9=_0x174cd9-0x0;var _0x2206b8=_0xa701[_0x174cd9];return _0x2206b8;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var moment=require(_0x1a70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a70('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a70('0x3'))(_0x1a70('0x4'));var config=require(_0x1a70('0x5'));var jayson=require(_0x1a70('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a70('0x7')]=_[_0x1a70('0x8')](config[_0x1a70('0x7')],{'host':_0x1a70('0x9'),'port':0x18eb});var socket=require(_0x1a70('0xa'))(new Redis(config[_0x1a70('0x7')]));require(_0x1a70('0xb'))['register'](socket);function respondWithRpcPromise(_0xe69b9b,_0x121091,_0x17015c){return new BPromise(function(_0x471b1f,_0x5772d9){return client[_0x1a70('0xc')](_0xe69b9b,_0x17015c)[_0x1a70('0xd')](function(_0x1b29e7){logger['info']('UserProfile,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));logger['debug'](_0x1a70('0xf'),_0x121091,'request\x20sent',JSON[_0x1a70('0x10')](_0x1b29e7));if(_0x1b29e7['error']){if(_0x1b29e7[_0x1a70('0x11')]['code']===0x1f4){logger[_0x1a70('0x11')](_0x1a70('0x12'),_0x121091,_0x1b29e7[_0x1a70('0x11')][_0x1a70('0x13')]);return _0x5772d9(_0x1b29e7[_0x1a70('0x11')]['message']);}logger['error'](_0x1a70('0x12'),_0x121091,_0x1b29e7['error'][_0x1a70('0x13')]);return _0x471b1f(_0x1b29e7[_0x1a70('0x11')]['message']);}else{logger[_0x1a70('0x14')]('UserProfile,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));_0x471b1f(_0x1b29e7[_0x1a70('0x15')]['message']);}})[_0x1a70('0x16')](function(_0x35de3b){logger['error']('UserProfile,\x20%s,\x20%s',_0x121091,_0x35de3b);_0x5772d9(_0x35de3b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c07c4bc..5349278 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 _0xd104=['userProfile:','./userProfile.events','save','remove','emit','removeListener'];(function(_0x557f79,_0x1bd4f4){var _0x3a65a0=function(_0x57e03c){while(--_0x57e03c){_0x557f79['push'](_0x557f79['shift']());}};_0x3a65a0(++_0x1bd4f4);}(_0xd104,0x19f));var _0x4d10=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd104[_0x2dafbe];return _0x58a45a;};'use strict';var UserProfileEvents=require(_0x4d10('0x0'));var events=[_0x4d10('0x1'),_0x4d10('0x2'),'update'];function createListener(_0x130f64,_0x4ae664){return function(_0xe8cd8d){_0x4ae664[_0x4d10('0x3')](_0x130f64,_0xe8cd8d);};}function removeListener(_0x4c7201,_0x78c188){return function(){UserProfileEvents[_0x4d10('0x4')](_0x4c7201,_0x78c188);};}exports['register']=function(_0x58c5ad){for(var _0x4271bf=0x0,_0x5d655f=events['length'];_0x4271bf<_0x5d655f;_0x4271bf++){var _0x2a6188=events[_0x4271bf];var _0x5dcfe2=createListener(_0x4d10('0x5')+_0x2a6188,_0x58c5ad);UserProfileEvents['on'](_0x2a6188,_0x5dcfe2);}}; \ No newline at end of file +var _0x48d9=['userProfile:','./userProfile.events','remove','update','emit','removeListener','register'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x48d9,0x1ac));var _0x948d=function(_0x4800c8,_0x322ffa){_0x4800c8=_0x4800c8-0x0;var _0x450385=_0x48d9[_0x4800c8];return _0x450385;};'use strict';var UserProfileEvents=require(_0x948d('0x0'));var events=['save',_0x948d('0x1'),_0x948d('0x2')];function createListener(_0x562e11,_0x40501b){return function(_0xacf057){_0x40501b[_0x948d('0x3')](_0x562e11,_0xacf057);};}function removeListener(_0x2cd38a,_0x3b3e83){return function(){UserProfileEvents[_0x948d('0x4')](_0x2cd38a,_0x3b3e83);};}exports[_0x948d('0x5')]=function(_0x427118){for(var _0x2ca162=0x0,_0x786a2c=events['length'];_0x2ca162<_0x786a2c;_0x2ca162++){var _0x2a53a9=events[_0x2ca162];var _0x513d5c=createListener(_0x948d('0x6')+_0x2a53a9,_0x427118);UserProfileEvents['on'](_0x2a53a9,_0x513d5c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3cecf94..069f65a 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 _0xd86a=['get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x519ac8,_0x43a3ed){var _0x156114=function(_0x1c7554){while(--_0x1c7554){_0x519ac8['push'](_0x519ac8['shift']());}};_0x156114(++_0x43a3ed);}(_0xd86a,0x1c4));var _0xad86=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xd86a[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var path=require(_0xad86('0x2'));var timeout=require('connect-timeout');var express=require(_0xad86('0x3'));var router=express['Router']();var fs_extra=require(_0xad86('0x4'));var auth=require(_0xad86('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xad86('0x6'));var controller=require('./userProfileResource.controller');router[_0xad86('0x7')]('/',auth[_0xad86('0x8')](),controller[_0xad86('0x9')]);router[_0xad86('0x7')]('/describe',auth[_0xad86('0x8')](),controller[_0xad86('0xa')]);router[_0xad86('0x7')](_0xad86('0xb'),auth[_0xad86('0x8')](),controller['show']);router[_0xad86('0xc')]('/',auth[_0xad86('0x8')](),controller[_0xad86('0xd')]);router['put'](_0xad86('0xb'),auth[_0xad86('0x8')](),controller[_0xad86('0xe')]);router[_0xad86('0xf')](_0xad86('0xb'),auth[_0xad86('0x8')](),controller[_0xad86('0x10')]);module['exports']=router; \ No newline at end of file +var _0x72a5=['../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x72a5,0xaa));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x572a('0x0'));var util=require(_0x572a('0x1'));var path=require(_0x572a('0x2'));var timeout=require('connect-timeout');var express=require(_0x572a('0x3'));var router=express[_0x572a('0x4')]();var fs_extra=require(_0x572a('0x5'));var auth=require(_0x572a('0x6'));var interaction=require(_0x572a('0x7'));var config=require('../../config/environment');var controller=require(_0x572a('0x8'));router[_0x572a('0x9')]('/',auth[_0x572a('0xa')](),controller[_0x572a('0xb')]);router[_0x572a('0x9')](_0x572a('0xc'),auth[_0x572a('0xa')](),controller['describe']);router[_0x572a('0x9')]('/:id',auth[_0x572a('0xa')](),controller[_0x572a('0xd')]);router[_0x572a('0xe')]('/',auth['isAuthenticated'](),controller[_0x572a('0xf')]);router[_0x572a('0x10')](_0x572a('0x11'),auth[_0x572a('0xa')](),controller[_0x572a('0x12')]);router[_0x572a('0x13')](_0x572a('0x11'),auth[_0x572a('0xa')](),controller[_0x572a('0x14')]);module[_0x572a('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 76bf5ee..b6c2a85 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 _0x5ae4=['STRING','sequelize','exports'];(function(_0x9b6ada,_0x12db5b){var _0x10d76c=function(_0x433ed6){while(--_0x433ed6){_0x9b6ada['push'](_0x9b6ada['shift']());}};_0x10d76c(++_0x12db5b);}(_0x5ae4,0x121));var _0x45ae=function(_0x1c3b16,_0x2b0b12){_0x1c3b16=_0x1c3b16-0x0;var _0x2ed8b3=_0x5ae4[_0x1c3b16];return _0x2ed8b3;};'use strict';var Sequelize=require(_0x45ae('0x0'));module[_0x45ae('0x1')]={'name':{'type':Sequelize[_0x45ae('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x45ae('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x473e=['sequelize','exports','STRING','INTEGER'];(function(_0x53da09,_0x1ba494){var _0x39d223=function(_0x16e4e0){while(--_0x16e4e0){_0x53da09['push'](_0x53da09['shift']());}};_0x39d223(++_0x1ba494);}(_0x473e,0xb0));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe473('0x0'));module[_0xe473('0x1')]={'name':{'type':Sequelize[_0xe473('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe473('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe473('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ef16848..3d3b7c1 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 _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x55a7c2,_0x365314){var _0xd12715=function(_0x1ba366){while(--_0x1ba366){_0x55a7c2['push'](_0x55a7c2['shift']());}};_0xd12715(++_0x365314);}(_0x7880,0x1f4));var _0x0788=function(_0x41642e,_0x97f901){_0x41642e=_0x41642e-0x0;var _0x39ec15=_0x7880[_0x41642e];return _0x39ec15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','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'];(function(_0x208d8e,_0x2d6b7f){var _0x2b50d1=function(_0x4c537d){while(--_0x4c537d){_0x208d8e['push'](_0x208d8e['shift']());}};_0x2b50d1(++_0x2d6b7f);}(_0x90b1,0x1bb));var _0x190b=function(_0x47f19d,_0x30582c){_0x47f19d=_0x47f19d-0x0;var _0x1fc180=_0x90b1[_0x47f19d];return _0x1fc180;};'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['UserProfileResource'][_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['UserProfileResource']['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['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 447495f..1a289db 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 _0x66c0=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x66c0,0x117));var _0x066c=function(_0x5d4dd7,_0x81bdd2){_0x5d4dd7=_0x5d4dd7-0x0;var _0x96c53a=_0x66c0[_0x5d4dd7];return _0x96c53a;};'use strict';var _=require(_0x066c('0x0'));var util=require(_0x066c('0x1'));var logger=require(_0x066c('0x2'))(_0x066c('0x3'));var moment=require(_0x066c('0x4'));var BPromise=require('bluebird');var rp=require(_0x066c('0x5'));var fs=require('fs');var path=require(_0x066c('0x6'));var rimraf=require('rimraf');var config=require(_0x066c('0x7'));var attributes=require(_0x066c('0x8'));module[_0x066c('0x9')]=function(_0x5403e8,_0x34f6fc){return _0x5403e8['define'](_0x066c('0xa'),attributes,{'tableName':_0x066c('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x066c('0xc'),_0x066c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c90=['define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c90,0xd7));var _0x02c9=function(_0xdc6f31,_0x48ff1b){_0xdc6f31=_0xdc6f31-0x0;var _0x52ec6e=_0x2c90[_0xdc6f31];return _0x52ec6e;};'use strict';var _=require('lodash');var util=require(_0x02c9('0x0'));var logger=require(_0x02c9('0x1'))(_0x02c9('0x2'));var moment=require(_0x02c9('0x3'));var BPromise=require(_0x02c9('0x4'));var rp=require(_0x02c9('0x5'));var fs=require('fs');var path=require(_0x02c9('0x6'));var rimraf=require(_0x02c9('0x7'));var config=require(_0x02c9('0x8'));var attributes=require('./userProfileResource.attributes');module[_0x02c9('0x9')]=function(_0x57e93f,_0x2e62db){return _0x57e93f[_0x02c9('0xa')](_0x02c9('0xb'),attributes,{'tableName':_0x02c9('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x02c9('0xd'),_0x02c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1e9180f..618c4f3 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 _0x499d=['message','UserProfileResource,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x499d,0x1a1));var _0xd499=function(_0x177747,_0x5a230e){_0x177747=_0x177747-0x0;var _0x557db7=_0x499d[_0x177747];return _0x557db7;};'use strict';var _=require(_0xd499('0x0'));var util=require(_0xd499('0x1'));var moment=require('moment');var BPromise=require(_0xd499('0x2'));var rs=require(_0xd499('0x3'));var fs=require('fs');var Redis=require(_0xd499('0x4'));var db=require(_0xd499('0x5'))['db'];var utils=require(_0xd499('0x6'));var logger=require(_0xd499('0x7'))(_0xd499('0x8'));var config=require(_0xd499('0x9'));var jayson=require(_0xd499('0xa'));var client=jayson[_0xd499('0xb')][_0xd499('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2248b4,_0x5af739,_0x3a3ada){return new BPromise(function(_0x592e47,_0x112f8a){return client[_0xd499('0xd')](_0x2248b4,_0x3a3ada)['then'](function(_0x31bbd8){logger[_0xd499('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5af739,_0xd499('0xf'));logger['debug'](_0xd499('0x10'),_0x5af739,'request\x20sent',JSON[_0xd499('0x11')](_0x31bbd8));if(_0x31bbd8[_0xd499('0x12')]){if(_0x31bbd8['error'][_0xd499('0x13')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5af739,_0x31bbd8[_0xd499('0x12')]['message']);return _0x112f8a(_0x31bbd8[_0xd499('0x12')][_0xd499('0x14')]);}logger[_0xd499('0x12')](_0xd499('0x15'),_0x5af739,_0x31bbd8[_0xd499('0x12')]['message']);return _0x592e47(_0x31bbd8[_0xd499('0x12')][_0xd499('0x14')]);}else{logger[_0xd499('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5af739,'request\x20sent');_0x592e47(_0x31bbd8[_0xd499('0x16')][_0xd499('0x14')]);}})['catch'](function(_0x19187b){logger[_0xd499('0x12')](_0xd499('0x15'),_0x5af739,_0x19187b);_0x112f8a(_0x19187b);});});} \ No newline at end of file +var _0xac55=['stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xac55,0x8c));var _0x5ac5=function(_0x6e605b,_0x43b637){_0x6e605b=_0x6e605b-0x0;var _0x53794c=_0xac55[_0x6e605b];return _0x53794c;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x2'));var db=require(_0x5ac5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ac5('0x4'));var config=require(_0x5ac5('0x5'));var jayson=require(_0x5ac5('0x6'));var client=jayson[_0x5ac5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12564b,_0x4a0bc9,_0x55306e){return new BPromise(function(_0x23d3ee,_0x559ebf){return client['request'](_0x12564b,_0x55306e)[_0x5ac5('0x8')](function(_0x593955){logger[_0x5ac5('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x4a0bc9,_0x5ac5('0xa'));logger[_0x5ac5('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4a0bc9,_0x5ac5('0xa'),JSON[_0x5ac5('0xc')](_0x593955));if(_0x593955[_0x5ac5('0xd')]){if(_0x593955['error'][_0x5ac5('0xe')]===0x1f4){logger[_0x5ac5('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x4a0bc9,_0x593955[_0x5ac5('0xd')][_0x5ac5('0xf')]);return _0x559ebf(_0x593955[_0x5ac5('0xd')][_0x5ac5('0xf')]);}logger['error'](_0x5ac5('0x10'),_0x4a0bc9,_0x593955[_0x5ac5('0xd')][_0x5ac5('0xf')]);return _0x23d3ee(_0x593955[_0x5ac5('0xd')][_0x5ac5('0xf')]);}else{logger[_0x5ac5('0x9')](_0x5ac5('0x10'),_0x4a0bc9,_0x5ac5('0xa'));_0x23d3ee(_0x593955[_0x5ac5('0x11')][_0x5ac5('0xf')]);}})[_0x5ac5('0x12')](function(_0x4d4145){logger[_0x5ac5('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x4a0bc9,_0x4d4145);_0x559ebf(_0x4d4145);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b5693f5..935c802 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 _0xaa62=['show','post','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xaa62,0x1c7));var _0x2aa6=function(_0x1a988d,_0x2ee162){_0x1a988d=_0x1a988d-0x0;var _0x181387=_0xaa62[_0x1a988d];return _0x181387;};'use strict';var multer=require(_0x2aa6('0x0'));var util=require(_0x2aa6('0x1'));var path=require(_0x2aa6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2aa6('0x3')]();var fs_extra=require(_0x2aa6('0x4'));var auth=require(_0x2aa6('0x5'));var interaction=require(_0x2aa6('0x6'));var config=require(_0x2aa6('0x7'));var controller=require('./userProfileSection.controller');router[_0x2aa6('0x8')]('/',auth[_0x2aa6('0x9')](),controller['index']);router[_0x2aa6('0x8')](_0x2aa6('0xa'),auth[_0x2aa6('0x9')](),controller[_0x2aa6('0xb')]);router[_0x2aa6('0x8')](_0x2aa6('0xc'),auth['isAuthenticated'](),controller[_0x2aa6('0xd')]);router[_0x2aa6('0xe')]('/',auth[_0x2aa6('0x9')](),controller['create']);router['put'](_0x2aa6('0xc'),auth[_0x2aa6('0x9')](),controller['update']);router[_0x2aa6('0xf')](_0x2aa6('0xc'),auth[_0x2aa6('0x9')](),controller[_0x2aa6('0x10')]);module[_0x2aa6('0x11')]=router; \ No newline at end of file +var _0x2fe5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x2fe5,0x1cc));var _0x52fe=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fe5[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var path=require(_0x52fe('0x2'));var timeout=require(_0x52fe('0x3'));var express=require(_0x52fe('0x4'));var router=express[_0x52fe('0x5')]();var fs_extra=require(_0x52fe('0x6'));var auth=require(_0x52fe('0x7'));var interaction=require(_0x52fe('0x8'));var config=require('../../config/environment');var controller=require(_0x52fe('0x9'));router[_0x52fe('0xa')]('/',auth[_0x52fe('0xb')](),controller[_0x52fe('0xc')]);router['get'](_0x52fe('0xd'),auth[_0x52fe('0xb')](),controller[_0x52fe('0xe')]);router['get'](_0x52fe('0xf'),auth[_0x52fe('0xb')](),controller[_0x52fe('0x10')]);router[_0x52fe('0x11')]('/',auth[_0x52fe('0xb')](),controller[_0x52fe('0x12')]);router[_0x52fe('0x13')]('/:id',auth[_0x52fe('0xb')](),controller[_0x52fe('0x14')]);router['delete']('/:id',auth[_0x52fe('0xb')](),controller[_0x52fe('0x15')]);module[_0x52fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4e9d523..1fefe9e 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 _0x58a4=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3fcc60,_0x3192a9){var _0x496947=function(_0x15ceb6){while(--_0x15ceb6){_0x3fcc60['push'](_0x3fcc60['shift']());}};_0x496947(++_0x3192a9);}(_0x58a4,0xbf));var _0x458a=function(_0x41da6,_0x42431b){_0x41da6=_0x41da6-0x0;var _0x282340=_0x58a4[_0x41da6];return _0x282340;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'name':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x458a('0x2')],'set':function(_0x362079){this[_0x458a('0x5')](_0x458a('0x6'),_0x362079?_0x362079[_0x458a('0x7')](''):[]);},'get':function(){return this[_0x458a('0x8')]('crudPermissions')?this['getDataValue'](_0x458a('0x6'))[_0x458a('0x9')](''):[];}}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x405541,_0x2945cc){var _0x194a1e=function(_0x46fffe){while(--_0x46fffe){_0x405541['push'](_0x405541['shift']());}};_0x194a1e(++_0x2945cc);}(_0x63a5,0x18e));var _0x563a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x63a5[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 744f8f1..90fbd8e 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 _0x0a1d=['undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','status','end','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json'];(function(_0x22074d,_0x33df85){var _0x3a24ce=function(_0x1dfb83){while(--_0x1dfb83){_0x22074d['push'](_0x22074d['shift']());}};_0x3a24ce(++_0x33df85);}(_0x0a1d,0x109));var _0xd0a1=function(_0x816f15,_0x5aa695){_0x816f15=_0x816f15-0x0;var _0x454ee9=_0x0a1d[_0x816f15];return _0x454ee9;};'use strict';var emlformat=require(_0xd0a1('0x0'));var rimraf=require(_0xd0a1('0x1'));var zipdir=require(_0xd0a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd0a1('0x3'));var BPromise=require(_0xd0a1('0x4'));var Mustache=require(_0xd0a1('0x5'));var util=require(_0xd0a1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd0a1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0a1('0x8'));var _=require(_0xd0a1('0x9'));var squel=require('squel');var crypto=require(_0xd0a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd0a1('0xb'));var toCsv=require(_0xd0a1('0x7'));var querystring=require(_0xd0a1('0xc'));var Papa=require(_0xd0a1('0xd'));var Redis=require(_0xd0a1('0xe'));var authService=require(_0xd0a1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0a1('0x10'));var logger=require('../../config/logger')(_0xd0a1('0x11'));var utils=require(_0xd0a1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd0a1('0x13'));var db=require(_0xd0a1('0x14'))['db'];function respondWithStatusCode(_0x113909,_0xb62165){_0xb62165=_0xb62165||0xcc;return function(_0x1188c8){if(_0x1188c8){return _0x113909[_0xd0a1('0x15')](_0xb62165);}return _0x113909['status'](_0xb62165)['end']();};}function respondWithResult(_0x224f77,_0x3c5913){_0x3c5913=_0x3c5913||0xc8;return function(_0x1f58ae){if(_0x1f58ae){return _0x224f77['status'](_0x3c5913)[_0xd0a1('0x16')](_0x1f58ae);}};}function respondWithFilteredResult(_0x52415f,_0x10d518){return function(_0x20700a){if(_0x20700a){var _0x3b680e=typeof _0x10d518['offset']===_0xd0a1('0x17')&&typeof _0x10d518[_0xd0a1('0x18')]===_0xd0a1('0x17');var _0x51fc80=_0x20700a[_0xd0a1('0x19')];var _0x5ad6f2=_0x3b680e?0x0:_0x10d518[_0xd0a1('0x1a')];var _0x38b58e=_0x3b680e?_0x20700a['count']:_0x10d518['offset']+_0x10d518[_0xd0a1('0x18')];var _0x14defc;if(_0x38b58e>=_0x51fc80){_0x38b58e=_0x51fc80;_0x14defc=0xc8;}else{_0x14defc=0xce;}_0x52415f['status'](_0x14defc);return _0x52415f['set'](_0xd0a1('0x1b'),_0x5ad6f2+'-'+_0x38b58e+'/'+_0x51fc80)[_0xd0a1('0x16')](_0x20700a);}return null;};}function patchUpdates(_0x3b9701){return function(_0x3cff30){try{jsonpatch[_0xd0a1('0x1c')](_0x3cff30,_0x3b9701,!![]);}catch(_0x4c5ad8){return BPromise[_0xd0a1('0x1d')](_0x4c5ad8);}return _0x3cff30[_0xd0a1('0x1e')]();};}function saveUpdates(_0x25209e,_0x286ba3){return function(_0xd674d5){if(_0xd674d5){return _0xd674d5[_0xd0a1('0x1f')](_0x25209e)[_0xd0a1('0x20')](function(_0x539ae9){return _0x539ae9;});}return null;};}function removeEntity(_0x3d9023,_0x6e6468){return function(_0x256b16){if(_0x256b16){return _0x256b16[_0xd0a1('0x21')]()[_0xd0a1('0x20')](function(){_0x3d9023[_0xd0a1('0x22')](0xcc)[_0xd0a1('0x23')]();});}};}function handleEntityNotFound(_0x53533e,_0x11bfb2){return function(_0x125e8f){if(!_0x125e8f){_0x53533e['sendStatus'](0x194);}return _0x125e8f;};}function handleError(_0x59f3cf,_0x51cb93){_0x51cb93=_0x51cb93||0x1f4;return function(_0x30d9b3){logger[_0xd0a1('0x24')](_0x30d9b3[_0xd0a1('0x25')]);if(_0x30d9b3[_0xd0a1('0x26')]){delete _0x30d9b3['name'];}_0x59f3cf[_0xd0a1('0x22')](_0x51cb93)['send'](_0x30d9b3);};}exports[_0xd0a1('0x27')]=function(_0x1dbf9a,_0x3ddf39){var _0x5b093b={},_0x3ae0f1={},_0xad26e9={'count':0x0,'rows':[]};var _0x3489db=_[_0xd0a1('0x28')](db[_0xd0a1('0x29')][_0xd0a1('0x2a')],function(_0x3ab074){return{'name':_0x3ab074[_0xd0a1('0x2b')],'type':_0x3ab074[_0xd0a1('0x2c')]['key']};});_0x3ae0f1[_0xd0a1('0x2d')]=_[_0xd0a1('0x28')](_0x3489db,_0xd0a1('0x26'));_0x3ae0f1[_0xd0a1('0x2e')]=_[_0xd0a1('0x2f')](_0x1dbf9a[_0xd0a1('0x2e')]);_0x3ae0f1[_0xd0a1('0x30')]=_[_0xd0a1('0x31')](_0x3ae0f1[_0xd0a1('0x2d')],_0x3ae0f1[_0xd0a1('0x2e')]);_0x5b093b[_0xd0a1('0x32')]=_[_0xd0a1('0x31')](_0x3ae0f1[_0xd0a1('0x2d')],qs['fields'](_0x1dbf9a[_0xd0a1('0x2e')]['fields']));_0x5b093b[_0xd0a1('0x32')]=_0x5b093b[_0xd0a1('0x32')][_0xd0a1('0x33')]?_0x5b093b['attributes']:_0x3ae0f1[_0xd0a1('0x2d')];if(!_0x1dbf9a[_0xd0a1('0x2e')][_0xd0a1('0x34')](_0xd0a1('0x35'))){_0x5b093b[_0xd0a1('0x18')]=qs[_0xd0a1('0x18')](_0x1dbf9a['query'][_0xd0a1('0x18')]);_0x5b093b[_0xd0a1('0x1a')]=qs[_0xd0a1('0x1a')](_0x1dbf9a['query'][_0xd0a1('0x1a')]);}_0x5b093b[_0xd0a1('0x36')]=qs[_0xd0a1('0x37')](_0x1dbf9a[_0xd0a1('0x2e')][_0xd0a1('0x37')]);_0x5b093b[_0xd0a1('0x38')]=qs[_0xd0a1('0x30')](_[_0xd0a1('0x39')](_0x1dbf9a[_0xd0a1('0x2e')],_0x3ae0f1['filters']),_0x3489db);if(_0x1dbf9a[_0xd0a1('0x2e')][_0xd0a1('0x3a')]){_0x5b093b['where']=_[_0xd0a1('0x3b')](_0x5b093b[_0xd0a1('0x38')],{'$or':_['map'](_0x3489db,function(_0x149124){if(_0x149124[_0xd0a1('0x2c')]!==_0xd0a1('0x3c')){var _0x484d3b={};_0x484d3b[_0x149124[_0xd0a1('0x26')]]={'$like':'%'+_0x1dbf9a[_0xd0a1('0x2e')][_0xd0a1('0x3a')]+'%'};return _0x484d3b;}})});}_0x5b093b=_[_0xd0a1('0x3b')]({},_0x5b093b,_0x1dbf9a['options']);var _0x414c60={'where':_0x5b093b[_0xd0a1('0x38')]};return db[_0xd0a1('0x29')]['count'](_0x414c60)[_0xd0a1('0x20')](function(_0x1f0328){_0xad26e9[_0xd0a1('0x19')]=_0x1f0328;if(_0x1dbf9a[_0xd0a1('0x2e')][_0xd0a1('0x3d')]){_0x5b093b[_0xd0a1('0x3e')]=[{'all':!![]}];}return db[_0xd0a1('0x29')][_0xd0a1('0x3f')](_0x5b093b);})['then'](function(_0x6935f4){_0xad26e9[_0xd0a1('0x40')]=_0x6935f4;return _0xad26e9;})['then'](respondWithFilteredResult(_0x3ddf39,_0x5b093b))[_0xd0a1('0x41')](handleError(_0x3ddf39,null));};exports[_0xd0a1('0x42')]=function(_0x40e1bf,_0x3379f5){var _0x888d2={'raw':![],'where':{'id':_0x40e1bf[_0xd0a1('0x43')]['id']}},_0x3b898e={};_0x3b898e[_0xd0a1('0x2d')]=_['keys'](db[_0xd0a1('0x29')][_0xd0a1('0x2a')]);_0x3b898e[_0xd0a1('0x2e')]=_[_0xd0a1('0x2f')](_0x40e1bf[_0xd0a1('0x2e')]);_0x3b898e[_0xd0a1('0x30')]=_[_0xd0a1('0x31')](_0x3b898e[_0xd0a1('0x2d')],_0x3b898e['query']);_0x888d2[_0xd0a1('0x32')]=_[_0xd0a1('0x31')](_0x3b898e[_0xd0a1('0x2d')],qs['fields'](_0x40e1bf[_0xd0a1('0x2e')]['fields']));_0x888d2[_0xd0a1('0x32')]=_0x888d2[_0xd0a1('0x32')][_0xd0a1('0x33')]?_0x888d2[_0xd0a1('0x32')]:_0x3b898e['model'];if(_0x40e1bf[_0xd0a1('0x2e')]['includeAll']){_0x888d2['include']=[{'all':!![]}];}_0x888d2=_[_0xd0a1('0x3b')]({},_0x888d2,_0x40e1bf['options']);return db[_0xd0a1('0x29')]['find'](_0x888d2)[_0xd0a1('0x20')](handleEntityNotFound(_0x3379f5,null))[_0xd0a1('0x20')](respondWithResult(_0x3379f5,null))[_0xd0a1('0x41')](handleError(_0x3379f5,null));};exports[_0xd0a1('0x44')]=function(_0x146925,_0x30191b){return db[_0xd0a1('0x29')][_0xd0a1('0x44')](_0x146925[_0xd0a1('0x45')],{})[_0xd0a1('0x20')](respondWithResult(_0x30191b,0xc9))[_0xd0a1('0x41')](handleError(_0x30191b,null));};exports[_0xd0a1('0x1f')]=function(_0x4afb0d,_0x847027){if(_0x4afb0d[_0xd0a1('0x45')]['id']){delete _0x4afb0d[_0xd0a1('0x45')]['id'];}return db['UserProfileSection'][_0xd0a1('0x46')]({'where':{'id':_0x4afb0d['params']['id']}})[_0xd0a1('0x20')](handleEntityNotFound(_0x847027,null))['then'](saveUpdates(_0x4afb0d['body'],null))[_0xd0a1('0x20')](respondWithResult(_0x847027,null))['catch'](handleError(_0x847027,null));};exports[_0xd0a1('0x21')]=function(_0x2c131d,_0x4bae82){return db['UserProfileSection'][_0xd0a1('0x46')]({'where':{'id':_0x2c131d[_0xd0a1('0x43')]['id']}})[_0xd0a1('0x20')](handleEntityNotFound(_0x4bae82,null))[_0xd0a1('0x20')](removeEntity(_0x4bae82,null))[_0xd0a1('0x41')](handleError(_0x4bae82,null));};exports[_0xd0a1('0x47')]=function(_0x286360,_0x54480b){return db[_0xd0a1('0x29')][_0xd0a1('0x47')]()[_0xd0a1('0x20')](respondWithResult(_0x54480b,null))[_0xd0a1('0x41')](handleError(_0x54480b,null));}; \ No newline at end of file +var _0x9608=['findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','error','name','send','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','include'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9608,0xee));var _0x8960=function(_0xe8762b,_0x188a41){_0xe8762b=_0xe8762b-0x0;var _0x562d35=_0x9608[_0xe8762b];return _0x562d35;};'use strict';var emlformat=require(_0x8960('0x0'));var rimraf=require(_0x8960('0x1'));var zipdir=require(_0x8960('0x2'));var jsonpatch=require(_0x8960('0x3'));var rp=require(_0x8960('0x4'));var moment=require(_0x8960('0x5'));var BPromise=require(_0x8960('0x6'));var Mustache=require(_0x8960('0x7'));var util=require(_0x8960('0x8'));var path=require(_0x8960('0x9'));var sox=require('sox');var csv=require(_0x8960('0xa'));var ejs=require(_0x8960('0xb'));var fs=require('fs');var fs_extra=require(_0x8960('0xc'));var _=require(_0x8960('0xd'));var squel=require(_0x8960('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8960('0xf'));var toCsv=require(_0x8960('0xa'));var querystring=require(_0x8960('0x10'));var Papa=require(_0x8960('0x11'));var Redis=require(_0x8960('0x12'));var authService=require(_0x8960('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8960('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8960('0x15'))('api');var utils=require(_0x8960('0x16'));var config=require(_0x8960('0x17'));var licenseUtil=require(_0x8960('0x18'));var db=require(_0x8960('0x19'))['db'];function respondWithStatusCode(_0x43f938,_0x7beb0e){_0x7beb0e=_0x7beb0e||0xcc;return function(_0x149098){if(_0x149098){return _0x43f938[_0x8960('0x1a')](_0x7beb0e);}return _0x43f938[_0x8960('0x1b')](_0x7beb0e)[_0x8960('0x1c')]();};}function respondWithResult(_0x124d13,_0x323fd5){_0x323fd5=_0x323fd5||0xc8;return function(_0x472108){if(_0x472108){return _0x124d13[_0x8960('0x1b')](_0x323fd5)[_0x8960('0x1d')](_0x472108);}};}function respondWithFilteredResult(_0x54c685,_0x4ea0cf){return function(_0x1c4820){if(_0x1c4820){var _0x4d4a75=typeof _0x4ea0cf['offset']==='undefined'&&typeof _0x4ea0cf[_0x8960('0x1e')]===_0x8960('0x1f');var _0x29ece0=_0x1c4820[_0x8960('0x20')];var _0x51127d=_0x4d4a75?0x0:_0x4ea0cf[_0x8960('0x21')];var _0x37ed45=_0x4d4a75?_0x1c4820[_0x8960('0x20')]:_0x4ea0cf['offset']+_0x4ea0cf[_0x8960('0x1e')];var _0x135aa2;if(_0x37ed45>=_0x29ece0){_0x37ed45=_0x29ece0;_0x135aa2=0xc8;}else{_0x135aa2=0xce;}_0x54c685['status'](_0x135aa2);return _0x54c685[_0x8960('0x22')]('Content-Range',_0x51127d+'-'+_0x37ed45+'/'+_0x29ece0)[_0x8960('0x1d')](_0x1c4820);}return null;};}function patchUpdates(_0x2cbb23){return function(_0x4d9234){try{jsonpatch[_0x8960('0x23')](_0x4d9234,_0x2cbb23,!![]);}catch(_0xcddeac){return BPromise[_0x8960('0x24')](_0xcddeac);}return _0x4d9234['save']();};}function saveUpdates(_0x4a2b01,_0x308641){return function(_0x33ef14){if(_0x33ef14){return _0x33ef14[_0x8960('0x25')](_0x4a2b01)['then'](function(_0x2e60b2){return _0x2e60b2;});}return null;};}function removeEntity(_0x4a37fb,_0x46cd27){return function(_0xbfcbe9){if(_0xbfcbe9){return _0xbfcbe9['destroy']()['then'](function(){_0x4a37fb[_0x8960('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30acbe,_0x43afec){return function(_0x9f43a2){if(!_0x9f43a2){_0x30acbe[_0x8960('0x1a')](0x194);}return _0x9f43a2;};}function handleError(_0x1cd522,_0x4b7f82){_0x4b7f82=_0x4b7f82||0x1f4;return function(_0x41d0d0){logger[_0x8960('0x26')](_0x41d0d0['stack']);if(_0x41d0d0['name']){delete _0x41d0d0[_0x8960('0x27')];}_0x1cd522['status'](_0x4b7f82)[_0x8960('0x28')](_0x41d0d0);};}exports['index']=function(_0x294b72,_0x440341){var _0x3195c3={},_0x2dd2bd={},_0x4115d0={'count':0x0,'rows':[]};var _0x364f3f=_[_0x8960('0x29')](db[_0x8960('0x2a')][_0x8960('0x2b')],function(_0x29bd8e){return{'name':_0x29bd8e[_0x8960('0x2c')],'type':_0x29bd8e['type'][_0x8960('0x2d')]};});_0x2dd2bd[_0x8960('0x2e')]=_[_0x8960('0x29')](_0x364f3f,_0x8960('0x27'));_0x2dd2bd[_0x8960('0x2f')]=_[_0x8960('0x30')](_0x294b72[_0x8960('0x2f')]);_0x2dd2bd[_0x8960('0x31')]=_[_0x8960('0x32')](_0x2dd2bd[_0x8960('0x2e')],_0x2dd2bd[_0x8960('0x2f')]);_0x3195c3[_0x8960('0x33')]=_[_0x8960('0x32')](_0x2dd2bd[_0x8960('0x2e')],qs[_0x8960('0x34')](_0x294b72[_0x8960('0x2f')]['fields']));_0x3195c3[_0x8960('0x33')]=_0x3195c3[_0x8960('0x33')][_0x8960('0x35')]?_0x3195c3[_0x8960('0x33')]:_0x2dd2bd[_0x8960('0x2e')];if(!_0x294b72['query'][_0x8960('0x36')](_0x8960('0x37'))){_0x3195c3[_0x8960('0x1e')]=qs[_0x8960('0x1e')](_0x294b72[_0x8960('0x2f')][_0x8960('0x1e')]);_0x3195c3[_0x8960('0x21')]=qs[_0x8960('0x21')](_0x294b72[_0x8960('0x2f')][_0x8960('0x21')]);}_0x3195c3['order']=qs['sort'](_0x294b72['query'][_0x8960('0x38')]);_0x3195c3[_0x8960('0x39')]=qs[_0x8960('0x31')](_['pick'](_0x294b72[_0x8960('0x2f')],_0x2dd2bd[_0x8960('0x31')]),_0x364f3f);if(_0x294b72[_0x8960('0x2f')][_0x8960('0x3a')]){_0x3195c3[_0x8960('0x39')]=_[_0x8960('0x3b')](_0x3195c3[_0x8960('0x39')],{'$or':_[_0x8960('0x29')](_0x364f3f,function(_0x5b9261){if(_0x5b9261[_0x8960('0x3c')]!==_0x8960('0x3d')){var _0x17b53e={};_0x17b53e[_0x5b9261[_0x8960('0x27')]]={'$like':'%'+_0x294b72[_0x8960('0x2f')]['filter']+'%'};return _0x17b53e;}})});}_0x3195c3=_[_0x8960('0x3b')]({},_0x3195c3,_0x294b72[_0x8960('0x3e')]);var _0x49e326={'where':_0x3195c3['where']};return db['UserProfileSection'][_0x8960('0x20')](_0x49e326)[_0x8960('0x3f')](function(_0x4803e0){_0x4115d0[_0x8960('0x20')]=_0x4803e0;if(_0x294b72['query'][_0x8960('0x40')]){_0x3195c3[_0x8960('0x41')]=[{'all':!![]}];}return db[_0x8960('0x2a')][_0x8960('0x42')](_0x3195c3);})[_0x8960('0x3f')](function(_0x25f48e){_0x4115d0[_0x8960('0x43')]=_0x25f48e;return _0x4115d0;})[_0x8960('0x3f')](respondWithFilteredResult(_0x440341,_0x3195c3))[_0x8960('0x44')](handleError(_0x440341,null));};exports[_0x8960('0x45')]=function(_0xa0621d,_0x5d5744){var _0x3d23e4={'raw':![],'where':{'id':_0xa0621d[_0x8960('0x46')]['id']}},_0x23b9c1={};_0x23b9c1[_0x8960('0x2e')]=_[_0x8960('0x30')](db[_0x8960('0x2a')]['rawAttributes']);_0x23b9c1[_0x8960('0x2f')]=_[_0x8960('0x30')](_0xa0621d['query']);_0x23b9c1[_0x8960('0x31')]=_[_0x8960('0x32')](_0x23b9c1[_0x8960('0x2e')],_0x23b9c1[_0x8960('0x2f')]);_0x3d23e4[_0x8960('0x33')]=_[_0x8960('0x32')](_0x23b9c1[_0x8960('0x2e')],qs[_0x8960('0x34')](_0xa0621d[_0x8960('0x2f')][_0x8960('0x34')]));_0x3d23e4[_0x8960('0x33')]=_0x3d23e4[_0x8960('0x33')]['length']?_0x3d23e4[_0x8960('0x33')]:_0x23b9c1[_0x8960('0x2e')];if(_0xa0621d[_0x8960('0x2f')][_0x8960('0x40')]){_0x3d23e4[_0x8960('0x41')]=[{'all':!![]}];}_0x3d23e4=_['merge']({},_0x3d23e4,_0xa0621d[_0x8960('0x3e')]);return db[_0x8960('0x2a')][_0x8960('0x47')](_0x3d23e4)[_0x8960('0x3f')](handleEntityNotFound(_0x5d5744,null))[_0x8960('0x3f')](respondWithResult(_0x5d5744,null))[_0x8960('0x44')](handleError(_0x5d5744,null));};exports['create']=function(_0x266fc0,_0x5f5688){return db['UserProfileSection'][_0x8960('0x48')](_0x266fc0[_0x8960('0x49')],{})['then'](respondWithResult(_0x5f5688,0xc9))[_0x8960('0x44')](handleError(_0x5f5688,null));};exports['update']=function(_0x26491d,_0x1970fe){if(_0x26491d[_0x8960('0x49')]['id']){delete _0x26491d[_0x8960('0x49')]['id'];}return db[_0x8960('0x2a')]['find']({'where':{'id':_0x26491d[_0x8960('0x46')]['id']}})[_0x8960('0x3f')](handleEntityNotFound(_0x1970fe,null))[_0x8960('0x3f')](saveUpdates(_0x26491d[_0x8960('0x49')],null))[_0x8960('0x3f')](respondWithResult(_0x1970fe,null))[_0x8960('0x44')](handleError(_0x1970fe,null));};exports[_0x8960('0x4a')]=function(_0x221604,_0xc9b0e4){return db[_0x8960('0x2a')][_0x8960('0x47')]({'where':{'id':_0x221604[_0x8960('0x46')]['id']}})[_0x8960('0x3f')](handleEntityNotFound(_0xc9b0e4,null))[_0x8960('0x3f')](removeEntity(_0xc9b0e4,null))[_0x8960('0x44')](handleError(_0xc9b0e4,null));};exports[_0x8960('0x4b')]=function(_0x12f3c8,_0x3cbd24){return db[_0x8960('0x2a')]['describe']()[_0x8960('0x3f')](respondWithResult(_0x3cbd24,null))['catch'](handleError(_0x3cbd24,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8e77786..deee055 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 _0x14db=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x14db,0xe0));var _0xb14d=function(_0x527116,_0x1816ec){_0x527116=_0x527116-0x0;var _0xc836a2=_0x14db[_0x527116];return _0xc836a2;};'use strict';var _=require(_0xb14d('0x0'));var util=require(_0xb14d('0x1'));var logger=require(_0xb14d('0x2'))(_0xb14d('0x3'));var moment=require(_0xb14d('0x4'));var BPromise=require(_0xb14d('0x5'));var rp=require(_0xb14d('0x6'));var fs=require('fs');var path=require(_0xb14d('0x7'));var rimraf=require(_0xb14d('0x8'));var config=require(_0xb14d('0x9'));var attributes=require('./userProfileSection.attributes');module[_0xb14d('0xa')]=function(_0x541865,_0x125e57){return _0x541865[_0xb14d('0xb')](_0xb14d('0xc'),attributes,{'tableName':_0xb14d('0xd'),'paranoid':![],'indexes':[{'name':_0xb14d('0xe'),'fields':[_0xb14d('0xf'),_0xb14d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5580=['bluebird','request-promise','path','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger','moment'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x5580,0x1ea));var _0x0558=function(_0x1250cf,_0x5a2f82){_0x1250cf=_0x1250cf-0x0;var _0x37c58f=_0x5580[_0x1250cf];return _0x37c58f;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var logger=require(_0x0558('0x2'))('api');var moment=require(_0x0558('0x3'));var BPromise=require(_0x0558('0x4'));var rp=require(_0x0558('0x5'));var fs=require('fs');var path=require(_0x0558('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0558('0x7'));module[_0x0558('0x8')]=function(_0x3bd33a,_0x391e79){return _0x3bd33a[_0x0558('0x9')](_0x0558('0xa'),attributes,{'tableName':_0x0558('0xb'),'paranoid':![],'indexes':[{'name':_0x0558('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5683eb4..6831727 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 _0x5b52=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent'];(function(_0x2deaa7,_0x3e68d1){var _0x46145c=function(_0x3b9bca){while(--_0x3b9bca){_0x2deaa7['push'](_0x2deaa7['shift']());}};_0x46145c(++_0x3e68d1);}(_0x5b52,0x11d));var _0x25b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b52[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x25b5('0x0'));var util=require('util');var moment=require(_0x25b5('0x1'));var BPromise=require(_0x25b5('0x2'));var rs=require(_0x25b5('0x3'));var fs=require('fs');var Redis=require(_0x25b5('0x4'));var db=require(_0x25b5('0x5'))['db'];var utils=require(_0x25b5('0x6'));var logger=require(_0x25b5('0x7'))(_0x25b5('0x8'));var config=require(_0x25b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25b5('0xa')][_0x25b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19162a,_0x4f8b82,_0x4442a7){return new BPromise(function(_0x425af,_0x12b3cf){return client[_0x25b5('0xc')](_0x19162a,_0x4442a7)['then'](function(_0x55bd8a){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4f8b82,_0x25b5('0xd'));logger['debug'](_0x25b5('0xe'),_0x4f8b82,'request\x20sent',JSON[_0x25b5('0xf')](_0x55bd8a));if(_0x55bd8a['error']){if(_0x55bd8a[_0x25b5('0x10')][_0x25b5('0x11')]===0x1f4){logger[_0x25b5('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4f8b82,_0x55bd8a[_0x25b5('0x10')][_0x25b5('0x12')]);return _0x12b3cf(_0x55bd8a[_0x25b5('0x10')][_0x25b5('0x12')]);}logger['error'](_0x25b5('0x13'),_0x4f8b82,_0x55bd8a[_0x25b5('0x10')]['message']);return _0x425af(_0x55bd8a[_0x25b5('0x10')]['message']);}else{logger[_0x25b5('0x14')](_0x25b5('0x13'),_0x4f8b82,_0x25b5('0xd'));_0x425af(_0x55bd8a[_0x25b5('0x15')]['message']);}})[_0x25b5('0x16')](function(_0x310cda){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4f8b82,_0x310cda);_0x12b3cf(_0x310cda);});});} \ No newline at end of file +var _0xa633=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s'];(function(_0x24470c,_0x3198a2){var _0x3d6b17=function(_0x160a8a){while(--_0x160a8a){_0x24470c['push'](_0x24470c['shift']());}};_0x3d6b17(++_0x3198a2);}(_0xa633,0x15d));var _0x3a63=function(_0x25bf44,_0x4573b0){_0x25bf44=_0x25bf44-0x0;var _0x4a2dca=_0xa633[_0x25bf44];return _0x4a2dca;};'use strict';var _=require(_0x3a63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a63('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a63('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a63('0x3'))(_0x3a63('0x4'));var config=require(_0x3a63('0x5'));var jayson=require(_0x3a63('0x6'));var client=jayson[_0x3a63('0x7')][_0x3a63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7ebc45,_0x1f769d,_0x567ff5){return new BPromise(function(_0x574b7c,_0x77c6ff){return client[_0x3a63('0x9')](_0x7ebc45,_0x567ff5)[_0x3a63('0xa')](function(_0x1aa5db){logger['info'](_0x3a63('0xb'),_0x1f769d,_0x3a63('0xc'));logger['debug'](_0x3a63('0xd'),_0x1f769d,'request\x20sent',JSON[_0x3a63('0xe')](_0x1aa5db));if(_0x1aa5db[_0x3a63('0xf')]){if(_0x1aa5db['error']['code']===0x1f4){logger[_0x3a63('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1f769d,_0x1aa5db[_0x3a63('0xf')][_0x3a63('0x10')]);return _0x77c6ff(_0x1aa5db['error'][_0x3a63('0x10')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1f769d,_0x1aa5db['error'][_0x3a63('0x10')]);return _0x574b7c(_0x1aa5db[_0x3a63('0xf')][_0x3a63('0x10')]);}else{logger['info'](_0x3a63('0xb'),_0x1f769d,_0x3a63('0xc'));_0x574b7c(_0x1aa5db[_0x3a63('0x11')][_0x3a63('0x10')]);}})[_0x3a63('0x12')](function(_0x3c909a){logger[_0x3a63('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1f769d,_0x3c909a);_0x77c6ff(_0x3c909a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ac51434..bb0ff38 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b430a,_0x1aa926){var _0x40e162=function(_0x47ca1d){while(--_0x47ca1d){_0x2b430a['push'](_0x2b430a['shift']());}};_0x40e162(++_0x1aa926);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x43bcc1,_0x3eb3d4){var _0x5ba4e9=function(_0x594eba){while(--_0x594eba){_0x43bcc1['push'](_0x43bcc1['shift']());}};_0x5ba4e9(++_0x3eb3d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xcb91[_0x455150];return _0x12ca9c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7def802..b49426d 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 _0xa21d=['INTEGER','sequelize'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa21d,0x8b));var _0xda21=function(_0x104c10,_0x5d64c7){_0x104c10=_0x104c10-0x0;var _0x4fd695=_0xa21d[_0x104c10];return _0x4fd695;};'use strict';var Sequelize=require(_0xda21('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xda21('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc469=['INTEGER','sequelize','exports'];(function(_0x43b4da,_0x48517e){var _0x58a73a=function(_0x26a667){while(--_0x26a667){_0x43b4da['push'](_0x43b4da['shift']());}};_0x58a73a(++_0x48517e);}(_0xc469,0x1de));var _0x9c46=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xc469[_0x4cce65];return _0x4d1b45;};'use strict';var Sequelize=require(_0x9c46('0x0'));module[_0x9c46('0x1')]={'penalty':{'type':Sequelize[_0x9c46('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 9783b07..b89c046 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 _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x472a34,_0xc1d626){var _0x77e15c=function(_0x5bc3da){while(--_0x5bc3da){_0x472a34['push'](_0x472a34['shift']());}};_0x77e15c(++_0xc1d626);}(_0x4317,0x7c));var _0x7431=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4317[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x310ad9,_0x530ab5){var _0x53f73b=function(_0x4a89e9){while(--_0x4a89e9){_0x310ad9['push'](_0x310ad9['shift']());}};_0x53f73b(++_0x530ab5);}(_0x0295,0x1f0));var _0x5029=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x0295[_0x595bd1];return _0xd0344f;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 812cf3e..9e6c120 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 _0x8ef1=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x12759c,_0x498a0a){var _0xa90a15=function(_0x1bdfe3){while(--_0x1bdfe3){_0x12759c['push'](_0x12759c['shift']());}};_0xa90a15(++_0x498a0a);}(_0x8ef1,0x1a4));var _0x18ef=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x8ef1[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x18ef('0x0'));var util=require('util');var moment=require(_0x18ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x18ef('0x2'));var fs=require('fs');var Redis=require(_0x18ef('0x3'));var db=require(_0x18ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x18ef('0x5'))(_0x18ef('0x6'));var config=require(_0x18ef('0x7'));var jayson=require(_0x18ef('0x8'));var client=jayson['client'][_0x18ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52074a,_0x57f197,_0x5292e6){return new BPromise(function(_0x13eff5,_0x4c01a7){return client[_0x18ef('0xa')](_0x52074a,_0x5292e6)[_0x18ef('0xb')](function(_0x2eabe1){logger[_0x18ef('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x57f197,_0x18ef('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x57f197,_0x18ef('0xd'),JSON[_0x18ef('0xe')](_0x2eabe1));if(_0x2eabe1['error']){if(_0x2eabe1[_0x18ef('0xf')]['code']===0x1f4){logger[_0x18ef('0xf')](_0x18ef('0x10'),_0x57f197,_0x2eabe1['error'][_0x18ef('0x11')]);return _0x4c01a7(_0x2eabe1[_0x18ef('0xf')]['message']);}logger[_0x18ef('0xf')](_0x18ef('0x10'),_0x57f197,_0x2eabe1[_0x18ef('0xf')]['message']);return _0x13eff5(_0x2eabe1[_0x18ef('0xf')][_0x18ef('0x11')]);}else{logger[_0x18ef('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x57f197,_0x18ef('0xd'));_0x13eff5(_0x2eabe1[_0x18ef('0x12')]['message']);}})[_0x18ef('0x13')](function(_0x11a151){logger['error'](_0x18ef('0x10'),_0x57f197,_0x11a151);_0x4c01a7(_0x11a151);});});} \ No newline at end of file +var _0x6015=['then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x116685,_0x50713b){var _0xade6a5=function(_0x563f11){while(--_0x563f11){_0x116685['push'](_0x116685['shift']());}};_0xade6a5(++_0x50713b);}(_0x6015,0x94));var _0x5601=function(_0x5a326a,_0x43da35){_0x5a326a=_0x5a326a-0x0;var _0x4736c7=_0x6015[_0x5a326a];return _0x4736c7;};'use strict';var _=require('lodash');var util=require(_0x5601('0x0'));var moment=require(_0x5601('0x1'));var BPromise=require('bluebird');var rs=require(_0x5601('0x2'));var fs=require('fs');var Redis=require(_0x5601('0x3'));var db=require(_0x5601('0x4'))['db'];var utils=require(_0x5601('0x5'));var logger=require(_0x5601('0x6'))(_0x5601('0x7'));var config=require(_0x5601('0x8'));var jayson=require(_0x5601('0x9'));var client=jayson[_0x5601('0xa')][_0x5601('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16aed7,_0x23c58d,_0x32aca3){return new BPromise(function(_0x5c4bf8,_0x3b8994){return client[_0x5601('0xc')](_0x16aed7,_0x32aca3)[_0x5601('0xd')](function(_0x268ebe){logger[_0x5601('0xe')](_0x5601('0xf'),_0x23c58d,'request\x20sent');logger[_0x5601('0x10')](_0x5601('0x11'),_0x23c58d,_0x5601('0x12'),JSON['stringify'](_0x268ebe));if(_0x268ebe[_0x5601('0x13')]){if(_0x268ebe[_0x5601('0x13')][_0x5601('0x14')]===0x1f4){logger['error'](_0x5601('0xf'),_0x23c58d,_0x268ebe[_0x5601('0x13')][_0x5601('0x15')]);return _0x3b8994(_0x268ebe['error'][_0x5601('0x15')]);}logger[_0x5601('0x13')](_0x5601('0xf'),_0x23c58d,_0x268ebe[_0x5601('0x13')][_0x5601('0x15')]);return _0x5c4bf8(_0x268ebe[_0x5601('0x13')][_0x5601('0x15')]);}else{logger[_0x5601('0xe')](_0x5601('0xf'),_0x23c58d,_0x5601('0x12'));_0x5c4bf8(_0x268ebe['result']['message']);}})[_0x5601('0x16')](function(_0x564ea5){logger[_0x5601('0x13')](_0x5601('0xf'),_0x23c58d,_0x564ea5);_0x3b8994(_0x564ea5);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 896226c..8554f2d 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d9e=['exports','INTEGER','sequelize'];(function(_0x2d489a,_0x25ce3c){var _0x11b301=function(_0x2bc6f1){while(--_0x2bc6f1){_0x2d489a['push'](_0x2d489a['shift']());}};_0x11b301(++_0x25ce3c);}(_0x9d9e,0xb0));var _0xe9d9=function(_0x28d1cd,_0x192371){_0x28d1cd=_0x28d1cd-0x0;var _0xdcb892=_0x9d9e[_0x28d1cd];return _0xdcb892;};'use strict';var Sequelize=require(_0xe9d9('0x0'));module[_0xe9d9('0x1')]={'UserId':{'type':Sequelize[_0xe9d9('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7aa5=['INTEGER','sequelize','exports'];(function(_0x110a44,_0x3e37c8){var _0x5a4bb7=function(_0x5c98d7){while(--_0x5c98d7){_0x110a44['push'](_0x110a44['shift']());}};_0x5a4bb7(++_0x3e37c8);}(_0x7aa5,0x142));var _0x57aa=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x7aa5[_0x1fb1c1];return _0x1622df;};'use strict';var Sequelize=require(_0x57aa('0x0'));module[_0x57aa('0x1')]={'UserId':{'type':Sequelize[_0x57aa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x57aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2f648da..d9e8e5b 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4040f3,_0x18852b){var _0x93f85=function(_0x31a7de){while(--_0x31a7de){_0x4040f3['push'](_0x4040f3['shift']());}};_0x93f85(++_0x18852b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x249d76,_0x1a6778){var _0x246d84=function(_0x5cf920){while(--_0x5cf920){_0x249d76['push'](_0x249d76['shift']());}};_0x246d84(++_0x1a6778);}(_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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index b224c6b..42a9864 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x481d70,_0x3abcda){var _0x542e98=function(_0xae6a0a){while(--_0xae6a0a){_0x481d70['push'](_0x481d70['shift']());}};_0x542e98(++_0x3abcda);}(_0x70e0,0x17b));var _0x070e=function(_0x34010e,_0x182040){_0x34010e=_0x34010e-0x0;var _0x431719=_0x70e0[_0x34010e];return _0x431719;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b6879,_0x48199f){var _0x489bbd=function(_0x4dd899){while(--_0x4dd899){_0x5b6879['push'](_0x5b6879['shift']());}};_0x489bbd(++_0x48199f);}(_0x70e0,0x17b));var _0x070e=function(_0x1694fa,_0x58c4c7){_0x1694fa=_0x1694fa-0x0;var _0x110225=_0x70e0[_0x1694fa];return _0x110225;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b13e294..a4ff18d 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 _0x53c1=['sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x53c1,0x7e));var _0x153c=function(_0x31d727,_0x44a259){_0x31d727=_0x31d727-0x0;var _0x3fa29a=_0x53c1[_0x31d727];return _0x3fa29a;};'use strict';var Sequelize=require(_0x153c('0x0'));module[_0x153c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8db9=['sequelize','exports','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8db9,0x1c2));var _0x98db=function(_0x2d9568,_0x520b1b){_0x2d9568=_0x2d9568-0x0;var _0x5edbd1=_0x8db9[_0x2d9568];return _0x5edbd1;};'use strict';var Sequelize=require(_0x98db('0x0'));module[_0x98db('0x1')]={'penalty':{'type':Sequelize[_0x98db('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 57a1f19..73aa9d1 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 _0xa206=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util'];(function(_0x3e26cf,_0x39943d){var _0x258d3c=function(_0x4faf7e){while(--_0x4faf7e){_0x3e26cf['push'](_0x3e26cf['shift']());}};_0x258d3c(++_0x39943d);}(_0xa206,0x9b));var _0x6a20=function(_0x2c55b9,_0xd4f49e){_0x2c55b9=_0x2c55b9-0x0;var _0x4135ad=_0xa206[_0x2c55b9];return _0x4135ad;};'use strict';var _=require('lodash');var util=require(_0x6a20('0x0'));var logger=require(_0x6a20('0x1'))(_0x6a20('0x2'));var moment=require('moment');var BPromise=require(_0x6a20('0x3'));var rp=require(_0x6a20('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a20('0x5'));var config=require(_0x6a20('0x6'));var attributes=require(_0x6a20('0x7'));module[_0x6a20('0x8')]=function(_0x3e3200,_0x2bbf02){return _0x3e3200[_0x6a20('0x9')](_0x6a20('0xa'),attributes,{'tableName':_0x6a20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x599b10,_0x125f2d){var _0xa6a5e6=function(_0x28a06e){while(--_0x28a06e){_0x599b10['push'](_0x599b10['shift']());}};_0xa6a5e6(++_0x125f2d);}(_0x6c76,0x184));var _0x66c7=function(_0x9bf11a,_0x36d433){_0x9bf11a=_0x9bf11a-0x0;var _0x26032d=_0x6c76[_0x9bf11a];return _0x26032d;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2685989..6fd1cd5 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 _0xdc5d=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6706e4,_0x4166ea){var _0x4de3cf=function(_0x8b1522){while(--_0x8b1522){_0x6706e4['push'](_0x6706e4['shift']());}};_0x4de3cf(++_0x4166ea);}(_0xdc5d,0x9d));var _0xddc5=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xdc5d[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0xddc5('0x0'));var util=require(_0xddc5('0x1'));var moment=require(_0xddc5('0x2'));var BPromise=require(_0xddc5('0x3'));var rs=require(_0xddc5('0x4'));var fs=require('fs');var Redis=require(_0xddc5('0x5'));var db=require(_0xddc5('0x6'))['db'];var utils=require(_0xddc5('0x7'));var logger=require(_0xddc5('0x8'))('rpc');var config=require(_0xddc5('0x9'));var jayson=require(_0xddc5('0xa'));var client=jayson['client'][_0xddc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30b380,_0x33b045,_0x48d30f){return new BPromise(function(_0x150941,_0x56b328){return client[_0xddc5('0xc')](_0x30b380,_0x48d30f)['then'](function(_0x354eb2){logger[_0xddc5('0xd')](_0xddc5('0xe'),_0x33b045,_0xddc5('0xf'));logger[_0xddc5('0x10')](_0xddc5('0x11'),_0x33b045,_0xddc5('0xf'),JSON[_0xddc5('0x12')](_0x354eb2));if(_0x354eb2['error']){if(_0x354eb2[_0xddc5('0x13')][_0xddc5('0x14')]===0x1f4){logger[_0xddc5('0x13')](_0xddc5('0xe'),_0x33b045,_0x354eb2[_0xddc5('0x13')][_0xddc5('0x15')]);return _0x56b328(_0x354eb2['error']['message']);}logger[_0xddc5('0x13')](_0xddc5('0xe'),_0x33b045,_0x354eb2[_0xddc5('0x13')][_0xddc5('0x15')]);return _0x150941(_0x354eb2[_0xddc5('0x13')]['message']);}else{logger[_0xddc5('0xd')](_0xddc5('0xe'),_0x33b045,_0xddc5('0xf'));_0x150941(_0x354eb2['result'][_0xddc5('0x15')]);}})['catch'](function(_0x1c2601){logger[_0xddc5('0x13')](_0xddc5('0xe'),_0x33b045,_0x1c2601);_0x56b328(_0x1c2601);});});} \ No newline at end of file +var _0x697b=['../../config/logger','rpc','../../config/environment','client','then','info','debug','request\x20sent','stringify','code','error','UserVoiceQueue,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20bedf,_0x44afe8){var _0x3750d7=function(_0x59f268){while(--_0x59f268){_0x20bedf['push'](_0x20bedf['shift']());}};_0x3750d7(++_0x44afe8);}(_0x697b,0x1d9));var _0xb697=function(_0x2499cf,_0x196780){_0x2499cf=_0x2499cf-0x0;var _0x3dc078=_0x697b[_0x2499cf];return _0x3dc078;};'use strict';var _=require(_0xb697('0x0'));var util=require(_0xb697('0x1'));var moment=require('moment');var BPromise=require(_0xb697('0x2'));var rs=require(_0xb697('0x3'));var fs=require('fs');var Redis=require(_0xb697('0x4'));var db=require(_0xb697('0x5'))['db'];var utils=require(_0xb697('0x6'));var logger=require(_0xb697('0x7'))(_0xb697('0x8'));var config=require(_0xb697('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb697('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x390597,_0x6b1641,_0x28e114){return new BPromise(function(_0x189f19,_0x17723f){return client['request'](_0x390597,_0x28e114)[_0xb697('0xb')](function(_0x74bfc4){logger[_0xb697('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x6b1641,'request\x20sent');logger[_0xb697('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x6b1641,_0xb697('0xe'),JSON[_0xb697('0xf')](_0x74bfc4));if(_0x74bfc4['error']){if(_0x74bfc4['error'][_0xb697('0x10')]===0x1f4){logger[_0xb697('0x11')](_0xb697('0x12'),_0x6b1641,_0x74bfc4['error'][_0xb697('0x13')]);return _0x17723f(_0x74bfc4[_0xb697('0x11')][_0xb697('0x13')]);}logger[_0xb697('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x6b1641,_0x74bfc4[_0xb697('0x11')][_0xb697('0x13')]);return _0x189f19(_0x74bfc4[_0xb697('0x11')][_0xb697('0x13')]);}else{logger[_0xb697('0xc')](_0xb697('0x12'),_0x6b1641,_0xb697('0xe'));_0x189f19(_0x74bfc4['result'][_0xb697('0x13')]);}})['catch'](function(_0x1a2fac){logger[_0xb697('0x11')](_0xb697('0x12'),_0x6b1641,_0x1a2fac);_0x17723f(_0x1a2fac);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 375dda6..66ac067 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x551696,_0x9ae408){var _0x12b28c=function(_0x139499){while(--_0x139499){_0x551696['push'](_0x551696['shift']());}};_0x12b28c(++_0x9ae408);}(_0xedd9,0xfc));var _0x9edd=function(_0x250b29,_0x1d0a9f){_0x250b29=_0x250b29-0x0;var _0x173414=_0xedd9[_0x250b29];return _0x173414;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x120f00,_0x351169){var _0x405825=function(_0x43257c){while(--_0x43257c){_0x120f00['push'](_0x120f00['shift']());}};_0x405825(++_0x351169);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xcb91[_0x2d89ce];return _0x3fad10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4929c99..45882f6 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 _0xeb22=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0xeb22,0xb5));var _0x2eb2=function(_0x4fcf10,_0x2db1c9){_0x4fcf10=_0x4fcf10-0x0;var _0x474d90=_0xeb22[_0x4fcf10];return _0x474d90;};'use strict';var Sequelize=require(_0x2eb2('0x0'));module[_0x2eb2('0x1')]={'uniqueid':{'type':Sequelize[_0x2eb2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2eb2('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2eb2('0x3')},'UserId':{'type':Sequelize[_0x2eb2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2eb2('0x4')],'allowNull':![],'unique':_0x2eb2('0x5'),'comment':_0x2eb2('0x3')},'VoiceQueueId':{'type':Sequelize[_0x2eb2('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2eb2('0x4')],'allowNull':![],'unique':_0x2eb2('0x5'),'comment':_0x2eb2('0x3')},'penalty':{'type':Sequelize[_0x2eb2('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2eb2('0x3')}}; \ No newline at end of file +var _0x02cc=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x02cc,0xd4));var _0xc02c=function(_0x48c5e3,_0x31dbf0){_0x48c5e3=_0x48c5e3-0x0;var _0x9d9474=_0x02cc[_0x48c5e3];return _0x9d9474;};'use strict';var Sequelize=require(_0xc02c('0x0'));module[_0xc02c('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc02c('0x2')},'membername':{'type':Sequelize[_0xc02c('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc02c('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xc02c('0x2')},'VoiceQueueId':{'type':Sequelize[_0xc02c('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xc02c('0x3')],'allowNull':![],'unique':_0xc02c('0x5'),'comment':_0xc02c('0x2')},'penalty':{'type':Sequelize[_0xc02c('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc02c('0x4')](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 a99da18..9eb7c54 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 _0x5301=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3eac1a,_0x40caee){var _0xc52f8b=function(_0x1a6b8e){while(--_0x1a6b8e){_0x3eac1a['push'](_0x3eac1a['shift']());}};_0xc52f8b(++_0x40caee);}(_0x5301,0x186));var _0x1530=function(_0x18d1e5,_0x1f377b){_0x18d1e5=_0x18d1e5-0x0;var _0x223345=_0x5301[_0x18d1e5];return _0x223345;};'use strict';var EventEmitter=require(_0x1530('0x0'));var UserVoiceQueueRt=require(_0x1530('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1530('0x2')](0x0);var events={'afterCreate':_0x1530('0x3'),'afterUpdate':_0x1530('0x4'),'afterDestroy':_0x1530('0x5')};function emitEvent(_0x573da5){return function(_0x4f226d,_0x1313cd,_0x45e031){UserVoiceQueueRtEvents['emit'](_0x573da5+':'+_0x4f226d['id'],_0x4f226d);UserVoiceQueueRtEvents[_0x1530('0x6')](_0x573da5,_0x4f226d);_0x45e031(null);};}for(var e in events){if(events[_0x1530('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x1530('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0a6c=['UserVoiceQueueRt','setMaxListeners','update','emit','hook','../../mysqldb'];(function(_0x5a6744,_0x144876){var _0xff7177=function(_0x4b3e10){while(--_0x4b3e10){_0x5a6744['push'](_0x5a6744['shift']());}};_0xff7177(++_0x144876);}(_0x0a6c,0x14f));var _0xc0a6=function(_0x197db5,_0x1d30f1){_0x197db5=_0x197db5-0x0;var _0x2792e6=_0x0a6c[_0x197db5];return _0x2792e6;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc0a6('0x0'))['db'][_0xc0a6('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc0a6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0a6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5695c3){return function(_0x468829,_0x1ed373,_0x21c0d1){UserVoiceQueueRtEvents[_0xc0a6('0x4')](_0x5695c3+':'+_0x468829['id'],_0x468829);UserVoiceQueueRtEvents['emit'](_0x5695c3,_0x468829);_0x21c0d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc0a6('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f47c25d..fbab0c4 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 _0xb924=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x52b2f5,_0x2a1ab5){var _0x9655f7=function(_0x3588f4){while(--_0x3588f4){_0x52b2f5['push'](_0x52b2f5['shift']());}};_0x9655f7(++_0x2a1ab5);}(_0xb924,0x1e1));var _0x4b92=function(_0x3a7551,_0x1fd352){_0x3a7551=_0x3a7551-0x0;var _0x4997d6=_0xb924[_0x3a7551];return _0x4997d6;};'use strict';var _=require('lodash');var util=require(_0x4b92('0x0'));var logger=require('../../config/logger')(_0x4b92('0x1'));var moment=require(_0x4b92('0x2'));var BPromise=require(_0x4b92('0x3'));var rp=require(_0x4b92('0x4'));var fs=require('fs');var path=require(_0x4b92('0x5'));var rimraf=require(_0x4b92('0x6'));var config=require(_0x4b92('0x7'));var attributes=require(_0x4b92('0x8'));module[_0x4b92('0x9')]=function(_0x4978f3,_0x1617e0){return _0x4978f3[_0x4b92('0xa')](_0x4b92('0xb'),attributes,{'tableName':_0x4b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa947=['rimraf','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2cb064,_0x17d24b){var _0x19afe8=function(_0x2c0b8a){while(--_0x2c0b8a){_0x2cb064['push'](_0x2cb064['shift']());}};_0x19afe8(++_0x17d24b);}(_0xa947,0x16c));var _0x7a94=function(_0x22688a,_0x8bbddc){_0x22688a=_0x22688a-0x0;var _0x50c037=_0xa947[_0x22688a];return _0x50c037;};'use strict';var _=require(_0x7a94('0x0'));var util=require('util');var logger=require(_0x7a94('0x1'))(_0x7a94('0x2'));var moment=require(_0x7a94('0x3'));var BPromise=require(_0x7a94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a94('0x5'));var rimraf=require(_0x7a94('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x7a94('0x7')]=function(_0x18b8de,_0x2db8f0){return _0x18b8de[_0x7a94('0x8')](_0x7a94('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 0ac340d..ffb61f4 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 _0xce5f=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw'];(function(_0x5b8f56,_0x4c9e6f){var _0x71fcd7=function(_0x9bb3cf){while(--_0x9bb3cf){_0x5b8f56['push'](_0x5b8f56['shift']());}};_0x71fcd7(++_0x4c9e6f);}(_0xce5f,0x9b));var _0xfce5=function(_0x3f6542,_0xbd500a){_0x3f6542=_0x3f6542-0x0;var _0x484ea1=_0xce5f[_0x3f6542];return _0x484ea1;};'use strict';var _=require('lodash');var util=require(_0xfce5('0x0'));var moment=require('moment');var BPromise=require(_0xfce5('0x1'));var rs=require(_0xfce5('0x2'));var fs=require('fs');var Redis=require(_0xfce5('0x3'));var db=require(_0xfce5('0x4'))['db'];var utils=require(_0xfce5('0x5'));var logger=require(_0xfce5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfce5('0x7')][_0xfce5('0x8')]({'port':0x232a});config[_0xfce5('0x9')]=_[_0xfce5('0xa')](config[_0xfce5('0x9')],{'host':_0xfce5('0xb'),'port':0x18eb});var socket=require(_0xfce5('0xc'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xfce5('0xd')](socket);function respondWithRpcPromise(_0x357a01,_0x3fb1f0,_0x4fca5a){return new BPromise(function(_0x9d3c08,_0x17fdc9){return client[_0xfce5('0xe')](_0x357a01,_0x4fca5a)[_0xfce5('0xf')](function(_0x51a23d){logger[_0xfce5('0x10')](_0xfce5('0x11'),_0x3fb1f0,_0xfce5('0x12'));logger['debug'](_0xfce5('0x13'),_0x3fb1f0,'request\x20sent',JSON[_0xfce5('0x14')](_0x51a23d));if(_0x51a23d['error']){if(_0x51a23d[_0xfce5('0x15')][_0xfce5('0x16')]===0x1f4){logger[_0xfce5('0x15')](_0xfce5('0x11'),_0x3fb1f0,_0x51a23d[_0xfce5('0x15')]['message']);return _0x17fdc9(_0x51a23d[_0xfce5('0x15')]['message']);}logger['error'](_0xfce5('0x11'),_0x3fb1f0,_0x51a23d[_0xfce5('0x15')][_0xfce5('0x17')]);return _0x9d3c08(_0x51a23d['error']['message']);}else{logger[_0xfce5('0x10')](_0xfce5('0x11'),_0x3fb1f0,_0xfce5('0x12'));_0x9d3c08(_0x51a23d[_0xfce5('0x18')][_0xfce5('0x17')]);}})[_0xfce5('0x19')](function(_0x336a2c){logger['error'](_0xfce5('0x11'),_0x3fb1f0,_0x336a2c);_0x17fdc9(_0x336a2c);});});}exports[_0xfce5('0x1a')]=function(_0x1bd794){var _0x4d0147=this;return new Promise(function(_0x256359,_0x6adc0e){return db[_0xfce5('0x1b')]['findAll']({'raw':_0x1bd794[_0xfce5('0x1c')]?_0x1bd794[_0xfce5('0x1c')][_0xfce5('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bd794[_0xfce5('0x1c')]?_0x1bd794[_0xfce5('0x1c')][_0xfce5('0x1e')]||null:null,'attributes':[[db[_0xfce5('0x1f')]['fn'](_0xfce5('0x20'),db[_0xfce5('0x1f')]['fn']('IF',db[_0xfce5('0x1f')][_0xfce5('0x21')](_0xfce5('0x22')))),_0xfce5('0x23')]]})[_0xfce5('0xf')](function(_0x352d8e){logger['info']('GetVoiceQueueRtPauses',_0x1bd794);logger[_0xfce5('0x24')]('GetVoiceQueueRtPauses',_0x1bd794,JSON[_0xfce5('0x14')](_0x352d8e));_0x256359(_0x352d8e);})[_0xfce5('0x19')](function(_0x566a73){logger[_0xfce5('0x15')]('GetVoiceQueueRtPauses',_0x566a73[_0xfce5('0x17')],_0x1bd794);_0x6adc0e(_0x4d0147[_0xfce5('0x15')](0x1f4,_0x566a73[_0xfce5('0x17')]));});});}; \ No newline at end of file +var _0x1a7e=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a7e,0x1da));var _0xe1a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe1a7('0x0'));var moment=require(_0xe1a7('0x1'));var BPromise=require(_0xe1a7('0x2'));var rs=require(_0xe1a7('0x3'));var fs=require('fs');var Redis=require(_0xe1a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1a7('0x5'));var logger=require(_0xe1a7('0x6'))(_0xe1a7('0x7'));var config=require(_0xe1a7('0x8'));var jayson=require(_0xe1a7('0x9'));var client=jayson[_0xe1a7('0xa')][_0xe1a7('0xb')]({'port':0x232a});config['redis']=_[_0xe1a7('0xc')](config['redis'],{'host':_0xe1a7('0xd'),'port':0x18eb});var socket=require(_0xe1a7('0xe'))(new Redis(config[_0xe1a7('0xf')]));require(_0xe1a7('0x10'))['register'](socket);function respondWithRpcPromise(_0x2efdd4,_0x12cd45,_0x4e6249){return new BPromise(function(_0x22392e,_0x1b6ec1){return client['request'](_0x2efdd4,_0x4e6249)['then'](function(_0x41deb3){logger[_0xe1a7('0x11')](_0xe1a7('0x12'),_0x12cd45,_0xe1a7('0x13'));logger[_0xe1a7('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x12cd45,_0xe1a7('0x13'),JSON[_0xe1a7('0x15')](_0x41deb3));if(_0x41deb3[_0xe1a7('0x16')]){if(_0x41deb3[_0xe1a7('0x16')][_0xe1a7('0x17')]===0x1f4){logger['error'](_0xe1a7('0x12'),_0x12cd45,_0x41deb3[_0xe1a7('0x16')]['message']);return _0x1b6ec1(_0x41deb3[_0xe1a7('0x16')][_0xe1a7('0x18')]);}logger[_0xe1a7('0x16')](_0xe1a7('0x12'),_0x12cd45,_0x41deb3[_0xe1a7('0x16')]['message']);return _0x22392e(_0x41deb3[_0xe1a7('0x16')][_0xe1a7('0x18')]);}else{logger[_0xe1a7('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x12cd45,_0xe1a7('0x13'));_0x22392e(_0x41deb3['result'][_0xe1a7('0x18')]);}})[_0xe1a7('0x19')](function(_0xdd7e77){logger[_0xe1a7('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x12cd45,_0xdd7e77);_0x1b6ec1(_0xdd7e77);});});}exports[_0xe1a7('0x1a')]=function(_0x44355a){var _0x249389=this;return new Promise(function(_0x516e1a,_0x47abb8){return db[_0xe1a7('0x1b')][_0xe1a7('0x1c')]({'raw':_0x44355a[_0xe1a7('0x1d')]?_0x44355a[_0xe1a7('0x1d')][_0xe1a7('0x1e')]===undefined?!![]:![]:!![],'where':_0x44355a[_0xe1a7('0x1d')]?_0x44355a[_0xe1a7('0x1d')][_0xe1a7('0x1f')]||null:null,'attributes':[[db[_0xe1a7('0x20')]['fn']('COUNT',db[_0xe1a7('0x20')]['fn']('IF',db[_0xe1a7('0x20')][_0xe1a7('0x21')](_0xe1a7('0x22')))),_0xe1a7('0x23')]]})[_0xe1a7('0x24')](function(_0x4c3fcd){logger['info']('GetVoiceQueueRtPauses',_0x44355a);logger[_0xe1a7('0x14')]('GetVoiceQueueRtPauses',_0x44355a,JSON[_0xe1a7('0x15')](_0x4c3fcd));_0x516e1a(_0x4c3fcd);})[_0xe1a7('0x19')](function(_0x50f79a){logger[_0xe1a7('0x16')]('GetVoiceQueueRtPauses',_0x50f79a[_0xe1a7('0x18')],_0x44355a);_0x47abb8(_0x249389[_0xe1a7('0x16')](0x1f4,_0x50f79a['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cef23c8..4de1b08 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 _0x04f9=['emit','removeListener','length','userVoiceQueueRt:','save','remove','update'];(function(_0x1d6dea,_0x1f8978){var _0x1b5967=function(_0x4a95f6){while(--_0x4a95f6){_0x1d6dea['push'](_0x1d6dea['shift']());}};_0x1b5967(++_0x1f8978);}(_0x04f9,0xb3));var _0x904f=function(_0x3f78ba,_0x2d6a79){_0x3f78ba=_0x3f78ba-0x0;var _0x1d903a=_0x04f9[_0x3f78ba];return _0x1d903a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x904f('0x0'),_0x904f('0x1'),_0x904f('0x2')];function createListener(_0x563e97,_0x18baf7){return function(_0x81ba22){_0x18baf7[_0x904f('0x3')](_0x563e97,_0x81ba22);};}function removeListener(_0x8cc251,_0x243fb2){return function(){UserVoiceQueueRtEvents[_0x904f('0x4')](_0x8cc251,_0x243fb2);};}exports['register']=function(_0x4e5a0c){for(var _0x2bcb2a=0x0,_0x175c38=events[_0x904f('0x5')];_0x2bcb2a<_0x175c38;_0x2bcb2a++){var _0x34cbd7=events[_0x2bcb2a];var _0x506239=createListener(_0x904f('0x6')+_0x34cbd7,_0x4e5a0c);UserVoiceQueueRtEvents['on'](_0x34cbd7,_0x506239);}}; \ No newline at end of file +var _0x75a2=['length','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x217ac6,_0x2582a6){var _0x45bf78=function(_0x39c892){while(--_0x39c892){_0x217ac6['push'](_0x217ac6['shift']());}};_0x45bf78(++_0x2582a6);}(_0x75a2,0x187));var _0x275a=function(_0x3967ac,_0x876a01){_0x3967ac=_0x3967ac-0x0;var _0x25746b=_0x75a2[_0x3967ac];return _0x25746b;};'use strict';var UserVoiceQueueRtEvents=require(_0x275a('0x0'));var events=[_0x275a('0x1'),_0x275a('0x2'),'update'];function createListener(_0x2221c5,_0x116ea8){return function(_0x339ace){_0x116ea8[_0x275a('0x3')](_0x2221c5,_0x339ace);};}function removeListener(_0x5019d2,_0x251db9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5019d2,_0x251db9);};}exports['register']=function(_0x4ab56d){for(var _0x5ecd7b=0x0,_0x32f0cb=events[_0x275a('0x4')];_0x5ecd7b<_0x32f0cb;_0x5ecd7b++){var _0x17ad5e=events[_0x5ecd7b];var _0x38b303=createListener('userVoiceQueueRt:'+_0x17ad5e,_0x4ab56d);UserVoiceQueueRtEvents['on'](_0x17ad5e,_0x38b303);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7956a21..0561241 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5093d7,_0xd0452a){var _0x3d0a91=function(_0x1a9fcc){while(--_0x1a9fcc){_0x5093d7['push'](_0x5093d7['shift']());}};_0x3d0a91(++_0xd0452a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d4554,_0x3336ba){_0x5d4554=_0x5d4554-0x0;var _0x1fd075=_0xedd9[_0x5d4554];return _0x1fd075;};'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(_0x16b13d,_0x2faf09){var _0x1f1e77=function(_0x2c4d2a){while(--_0x2c4d2a){_0x16b13d['push'](_0x16b13d['shift']());}};_0x1f1e77(++_0x2faf09);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6cc11a2..db51ea9 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 _0x7166=['exports','sequelize'];(function(_0x2c4aef,_0x116fe2){var _0x3deaed=function(_0x131052){while(--_0x131052){_0x2c4aef['push'](_0x2c4aef['shift']());}};_0x3deaed(++_0x116fe2);}(_0x7166,0x127));var _0x6716=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x7166[_0x98db33];return _0x5ae63a;};'use strict';var Sequelize=require(_0x6716('0x0'));module[_0x6716('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeecc=['exports','sequelize'];(function(_0x19d22f,_0x22dc1d){var _0x2d2d8d=function(_0x612175){while(--_0x612175){_0x19d22f['push'](_0x19d22f['shift']());}};_0x2d2d8d(++_0x22dc1d);}(_0xeecc,0x121));var _0xceec=function(_0x5b5dc8,_0x5d34a8){_0x5b5dc8=_0x5b5dc8-0x0;var _0x47a2a4=_0xeecc[_0x5b5dc8];return _0x47a2a4;};'use strict';var Sequelize=require(_0xceec('0x0'));module[_0xceec('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 d6a2e91..a2cc732 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 _0xa3e1=['exports','define','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x26ac67,_0x1626d9){var _0x2240af=function(_0x180c62){while(--_0x180c62){_0x26ac67['push'](_0x26ac67['shift']());}};_0x2240af(++_0x1626d9);}(_0xa3e1,0xab));var _0x1a3e=function(_0x3e93c7,_0x9d5904){_0x3e93c7=_0x3e93c7-0x0;var _0xdba5b6=_0xa3e1[_0x3e93c7];return _0xdba5b6;};'use strict';var _=require(_0x1a3e('0x0'));var util=require('util');var logger=require(_0x1a3e('0x1'))(_0x1a3e('0x2'));var moment=require(_0x1a3e('0x3'));var BPromise=require(_0x1a3e('0x4'));var rp=require(_0x1a3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a3e('0x6'));var config=require(_0x1a3e('0x7'));var attributes=require(_0x1a3e('0x8'));module[_0x1a3e('0x9')]=function(_0x14e7ec,_0x1c5094){return _0x14e7ec[_0x1a3e('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x1a3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x445d=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x30a0f8,_0x2e17b8){var _0x4ae72c=function(_0x421f39){while(--_0x421f39){_0x30a0f8['push'](_0x30a0f8['shift']());}};_0x4ae72c(++_0x2e17b8);}(_0x445d,0x138));var _0xd445=function(_0x3b9eda,_0x1ef917){_0x3b9eda=_0x3b9eda-0x0;var _0xd935c4=_0x445d[_0x3b9eda];return _0xd935c4;};'use strict';var _=require(_0xd445('0x0'));var util=require(_0xd445('0x1'));var logger=require(_0xd445('0x2'))(_0xd445('0x3'));var moment=require(_0xd445('0x4'));var BPromise=require('bluebird');var rp=require(_0xd445('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd445('0x6'));var config=require(_0xd445('0x7'));var attributes=require(_0xd445('0x8'));module[_0xd445('0x9')]=function(_0x20cc0d,_0x5b7132){return _0x20cc0d['define'](_0xd445('0xa'),attributes,{'tableName':_0xd445('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7163bf1..1ff0454 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 _0x4ec3=['request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x1f214b,_0x2fc240){var _0x472309=function(_0x4bd9b8){while(--_0x4bd9b8){_0x1f214b['push'](_0x1f214b['shift']());}};_0x472309(++_0x2fc240);}(_0x4ec3,0x142));var _0x34ec=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x4ec3[_0xa9eaa0];return _0x30897a;};'use strict';var _=require(_0x34ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x34ec('0x1'));var fs=require('fs');var Redis=require(_0x34ec('0x2'));var db=require(_0x34ec('0x3'))['db'];var utils=require(_0x34ec('0x4'));var logger=require(_0x34ec('0x5'))(_0x34ec('0x6'));var config=require(_0x34ec('0x7'));var jayson=require(_0x34ec('0x8'));var client=jayson[_0x34ec('0x9')][_0x34ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x85b915,_0x1cba51,_0x286b43){return new BPromise(function(_0x4dd3e4,_0x1d92d3){return client[_0x34ec('0xb')](_0x85b915,_0x286b43)['then'](function(_0x5d4a0f){logger[_0x34ec('0xc')](_0x34ec('0xd'),_0x1cba51,_0x34ec('0xe'));logger[_0x34ec('0xf')](_0x34ec('0x10'),_0x1cba51,_0x34ec('0xe'),JSON[_0x34ec('0x11')](_0x5d4a0f));if(_0x5d4a0f[_0x34ec('0x12')]){if(_0x5d4a0f[_0x34ec('0x12')][_0x34ec('0x13')]===0x1f4){logger['error'](_0x34ec('0xd'),_0x1cba51,_0x5d4a0f[_0x34ec('0x12')][_0x34ec('0x14')]);return _0x1d92d3(_0x5d4a0f[_0x34ec('0x12')][_0x34ec('0x14')]);}logger[_0x34ec('0x12')](_0x34ec('0xd'),_0x1cba51,_0x5d4a0f[_0x34ec('0x12')][_0x34ec('0x14')]);return _0x4dd3e4(_0x5d4a0f[_0x34ec('0x12')][_0x34ec('0x14')]);}else{logger[_0x34ec('0xc')](_0x34ec('0xd'),_0x1cba51,_0x34ec('0xe'));_0x4dd3e4(_0x5d4a0f['result'][_0x34ec('0x14')]);}})['catch'](function(_0x59c0e1){logger[_0x34ec('0x12')](_0x34ec('0xd'),_0x1cba51,_0x59c0e1);_0x1d92d3(_0x59c0e1);});});} \ No newline at end of file +var _0xf283=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x49abe0,_0x4c2a8b){var _0xebc3a8=function(_0x53f824){while(--_0x53f824){_0x49abe0['push'](_0x49abe0['shift']());}};_0xebc3a8(++_0x4c2a8b);}(_0xf283,0x1c3));var _0x3f28=function(_0x34c14a,_0x4a8ff8){_0x34c14a=_0x34c14a-0x0;var _0xeb5c81=_0xf283[_0x34c14a];return _0xeb5c81;};'use strict';var _=require(_0x3f28('0x0'));var util=require(_0x3f28('0x1'));var moment=require(_0x3f28('0x2'));var BPromise=require(_0x3f28('0x3'));var rs=require(_0x3f28('0x4'));var fs=require('fs');var Redis=require(_0x3f28('0x5'));var db=require(_0x3f28('0x6'))['db'];var utils=require(_0x3f28('0x7'));var logger=require('../../config/logger')(_0x3f28('0x8'));var config=require(_0x3f28('0x9'));var jayson=require(_0x3f28('0xa'));var client=jayson['client'][_0x3f28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb4d0,_0x347fbd,_0xea826e){return new BPromise(function(_0x55295c,_0xa0fd51){return client['request'](_0x3bb4d0,_0xea826e)[_0x3f28('0xc')](function(_0xc93946){logger[_0x3f28('0xd')](_0x3f28('0xe'),_0x347fbd,_0x3f28('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x347fbd,'request\x20sent',JSON[_0x3f28('0x10')](_0xc93946));if(_0xc93946[_0x3f28('0x11')]){if(_0xc93946[_0x3f28('0x11')][_0x3f28('0x12')]===0x1f4){logger[_0x3f28('0x11')](_0x3f28('0xe'),_0x347fbd,_0xc93946[_0x3f28('0x11')][_0x3f28('0x13')]);return _0xa0fd51(_0xc93946[_0x3f28('0x11')][_0x3f28('0x13')]);}logger[_0x3f28('0x11')](_0x3f28('0xe'),_0x347fbd,_0xc93946[_0x3f28('0x11')]['message']);return _0x55295c(_0xc93946[_0x3f28('0x11')][_0x3f28('0x13')]);}else{logger[_0x3f28('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x347fbd,_0x3f28('0xf'));_0x55295c(_0xc93946[_0x3f28('0x14')][_0x3f28('0x13')]);}})[_0x3f28('0x15')](function(_0x2bac23){logger[_0x3f28('0x11')](_0x3f28('0xe'),_0x347fbd,_0x2bac23);_0xa0fd51(_0x2bac23);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f9b7345..90dff5a 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 _0x032a=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','put','/:id','update'];(function(_0x26f1da,_0x48dc4e){var _0x48018c=function(_0x2f64a7){while(--_0x2f64a7){_0x26f1da['push'](_0x26f1da['shift']());}};_0x48018c(++_0x48dc4e);}(_0x032a,0xf0));var _0xa032=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x032a[_0x230951];return _0xeb26b1;};'use strict';var multer=require('multer');var util=require(_0xa032('0x0'));var path=require('path');var timeout=require(_0xa032('0x1'));var express=require(_0xa032('0x2'));var router=express[_0xa032('0x3')]();var fs_extra=require(_0xa032('0x4'));var auth=require(_0xa032('0x5'));var interaction=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var controller=require(_0xa032('0x8'));router[_0xa032('0x9')]('/',auth[_0xa032('0xa')](),controller[_0xa032('0xb')]);router[_0xa032('0x9')]('/:id',auth[_0xa032('0xa')](),controller['show']);router['post']('/',auth[_0xa032('0xa')](),controller['create']);router[_0xa032('0xc')](_0xa032('0xd'),auth[_0xa032('0xa')](),controller[_0xa032('0xe')]);router[_0xa032('0xf')]('/:id',auth[_0xa032('0xa')](),controller[_0xa032('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc02d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b8ce9,_0x157372){var _0x3ed19e=function(_0xe002e){while(--_0xe002e){_0x2b8ce9['push'](_0x2b8ce9['shift']());}};_0x3ed19e(++_0x157372);}(_0xc02d,0x1aa));var _0xdc02=function(_0x5345e0,_0x1c93a4){_0x5345e0=_0x5345e0-0x0;var _0x35e35b=_0xc02d[_0x5345e0];return _0x35e35b;};'use strict';var multer=require('multer');var util=require(_0xdc02('0x0'));var path=require(_0xdc02('0x1'));var timeout=require(_0xdc02('0x2'));var express=require(_0xdc02('0x3'));var router=express[_0xdc02('0x4')]();var fs_extra=require(_0xdc02('0x5'));var auth=require(_0xdc02('0x6'));var interaction=require(_0xdc02('0x7'));var config=require(_0xdc02('0x8'));var controller=require(_0xdc02('0x9'));router[_0xdc02('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc02('0xb')]);router[_0xdc02('0xa')](_0xdc02('0xc'),auth[_0xdc02('0xd')](),controller['show']);router['post']('/',auth[_0xdc02('0xd')](),controller[_0xdc02('0xe')]);router[_0xdc02('0xf')]('/:id',auth[_0xdc02('0xd')](),controller['update']);router[_0xdc02('0x10')](_0xdc02('0xc'),auth[_0xdc02('0xd')](),controller[_0xdc02('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5b84a34..1909d6e 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 _0xf5cb=['exports','STRING','name','sequelize'];(function(_0x1a3512,_0x34d566){var _0x3260da=function(_0x1b5c9c){while(--_0x1b5c9c){_0x1a3512['push'](_0x1a3512['shift']());}};_0x3260da(++_0x34d566);}(_0xf5cb,0x117));var _0xbf5c=function(_0x5cb5df,_0x59388f){_0x5cb5df=_0x5cb5df-0x0;var _0x30cf67=_0xf5cb[_0x5cb5df];return _0x30cf67;};'use strict';var Sequelize=require(_0xbf5c('0x0'));module[_0xbf5c('0x1')]={'name':{'type':Sequelize[_0xbf5c('0x2')],'unique':_0xbf5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x615a=['exports','STRING','name'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x615a,0x8d));var _0xa615=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x615a[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require('sequelize');module[_0xa615('0x0')]={'name':{'type':Sequelize[_0xa615('0x1')],'unique':_0xa615('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa615('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bf09b83..4bab895 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 _0xb46c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','end','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0xb46c,0x13a));var _0xcb46=function(_0x5a28d3,_0x50a9b2){_0x5a28d3=_0x5a28d3-0x0;var _0x594693=_0xb46c[_0x5a28d3];return _0x594693;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb46('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb46('0x1'));var rp=require(_0xcb46('0x2'));var moment=require(_0xcb46('0x3'));var BPromise=require(_0xcb46('0x4'));var Mustache=require('mustache');var util=require(_0xcb46('0x5'));var path=require('path');var sox=require(_0xcb46('0x6'));var csv=require(_0xcb46('0x7'));var ejs=require(_0xcb46('0x8'));var fs=require('fs');var fs_extra=require(_0xcb46('0x9'));var _=require(_0xcb46('0xa'));var squel=require(_0xcb46('0xb'));var crypto=require(_0xcb46('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb46('0x7'));var querystring=require(_0xcb46('0xd'));var Papa=require(_0xcb46('0xe'));var Redis=require(_0xcb46('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcb46('0x10'));var as=require(_0xcb46('0x11'));var hardwareService=require(_0xcb46('0x12'));var logger=require(_0xcb46('0x13'))(_0xcb46('0x14'));var utils=require(_0xcb46('0x15'));var config=require(_0xcb46('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb46('0x17'))['db'];function respondWithStatusCode(_0x114b8f,_0x4914ba){_0x4914ba=_0x4914ba||0xcc;return function(_0x5ad84f){if(_0x5ad84f){return _0x114b8f[_0xcb46('0x18')](_0x4914ba);}return _0x114b8f[_0xcb46('0x19')](_0x4914ba)['end']();};}function respondWithResult(_0x43df08,_0x124473){_0x124473=_0x124473||0xc8;return function(_0x59486a){if(_0x59486a){return _0x43df08[_0xcb46('0x19')](_0x124473)['json'](_0x59486a);}};}function respondWithFilteredResult(_0x112d41,_0x29db3d){return function(_0x5b91a6){if(_0x5b91a6){var _0x439545=typeof _0x29db3d[_0xcb46('0x1a')]===_0xcb46('0x1b')&&typeof _0x29db3d[_0xcb46('0x1c')]===_0xcb46('0x1b');var _0x1ee7e2=_0x5b91a6[_0xcb46('0x1d')];var _0x5dd25a=_0x439545?0x0:_0x29db3d[_0xcb46('0x1a')];var _0x58d800=_0x439545?_0x5b91a6[_0xcb46('0x1d')]:_0x29db3d[_0xcb46('0x1a')]+_0x29db3d[_0xcb46('0x1c')];var _0x2103c9;if(_0x58d800>=_0x1ee7e2){_0x58d800=_0x1ee7e2;_0x2103c9=0xc8;}else{_0x2103c9=0xce;}_0x112d41[_0xcb46('0x19')](_0x2103c9);return _0x112d41[_0xcb46('0x1e')]('Content-Range',_0x5dd25a+'-'+_0x58d800+'/'+_0x1ee7e2)[_0xcb46('0x1f')](_0x5b91a6);}return null;};}function patchUpdates(_0x5a28d6){return function(_0x2be6de){try{jsonpatch[_0xcb46('0x20')](_0x2be6de,_0x5a28d6,!![]);}catch(_0x3b6c6c){return BPromise[_0xcb46('0x21')](_0x3b6c6c);}return _0x2be6de[_0xcb46('0x22')]();};}function saveUpdates(_0x507e97,_0x44707a){return function(_0x21d0eb){if(_0x21d0eb){return _0x21d0eb[_0xcb46('0x23')](_0x507e97)[_0xcb46('0x24')](function(_0x1e4a05){return _0x1e4a05;});}return null;};}function removeEntity(_0x516c21,_0x4ee530){return function(_0xba5ca0){if(_0xba5ca0){return _0xba5ca0[_0xcb46('0x25')]()[_0xcb46('0x24')](function(){var _0x43fb51=_0xba5ca0['get']({'plain':!![]});var _0x1830e1=_0xcb46('0x26');return db[_0xcb46('0x27')]['destroy']({'where':{'type':_0x1830e1,'resourceId':_0x43fb51['id']}})[_0xcb46('0x24')](function(){return _0xba5ca0;});})[_0xcb46('0x24')](function(){_0x516c21[_0xcb46('0x19')](0xcc)[_0xcb46('0x28')]();});}};}function handleEntityNotFound(_0x1a271a,_0x24ad80){return function(_0x5c4f8f){if(!_0x5c4f8f){_0x1a271a['sendStatus'](0x194);}return _0x5c4f8f;};}function handleError(_0x523fa7,_0x556784){_0x556784=_0x556784||0x1f4;return function(_0x48b29b){logger[_0xcb46('0x29')](_0x48b29b[_0xcb46('0x2a')]);if(_0x48b29b[_0xcb46('0x2b')]){delete _0x48b29b[_0xcb46('0x2b')];}_0x523fa7[_0xcb46('0x19')](_0x556784)['send'](_0x48b29b);};}exports[_0xcb46('0x2c')]=function(_0x4699dd,_0x4f08a8){var _0x489222={},_0x23eacf={},_0x89db76={'count':0x0,'rows':[]};var _0x32e4ce=_[_0xcb46('0x2d')](db[_0xcb46('0x2e')][_0xcb46('0x2f')],function(_0x374707){return{'name':_0x374707[_0xcb46('0x30')],'type':_0x374707[_0xcb46('0x31')][_0xcb46('0x32')]};});_0x23eacf['model']=_[_0xcb46('0x2d')](_0x32e4ce,'name');_0x23eacf[_0xcb46('0x33')]=_[_0xcb46('0x34')](_0x4699dd['query']);_0x23eacf[_0xcb46('0x35')]=_['intersection'](_0x23eacf[_0xcb46('0x36')],_0x23eacf[_0xcb46('0x33')]);_0x489222[_0xcb46('0x37')]=_['intersection'](_0x23eacf[_0xcb46('0x36')],qs[_0xcb46('0x38')](_0x4699dd['query'][_0xcb46('0x38')]));_0x489222['attributes']=_0x489222[_0xcb46('0x37')][_0xcb46('0x39')]?_0x489222['attributes']:_0x23eacf[_0xcb46('0x36')];if(!_0x4699dd[_0xcb46('0x33')][_0xcb46('0x3a')](_0xcb46('0x3b'))){_0x489222['limit']=qs['limit'](_0x4699dd[_0xcb46('0x33')][_0xcb46('0x1c')]);_0x489222['offset']=qs[_0xcb46('0x1a')](_0x4699dd['query']['offset']);}_0x489222[_0xcb46('0x3c')]=qs[_0xcb46('0x3d')](_0x4699dd[_0xcb46('0x33')][_0xcb46('0x3d')]);_0x489222[_0xcb46('0x3e')]=qs[_0xcb46('0x35')](_['pick'](_0x4699dd[_0xcb46('0x33')],_0x23eacf[_0xcb46('0x35')]),_0x32e4ce);if(_0x4699dd[_0xcb46('0x33')]['filter']){_0x489222[_0xcb46('0x3e')]=_[_0xcb46('0x3f')](_0x489222[_0xcb46('0x3e')],{'$or':_[_0xcb46('0x2d')](_0x32e4ce,function(_0x589c74){if(_0x589c74[_0xcb46('0x31')]!==_0xcb46('0x40')){var _0xc2a3e2={};_0xc2a3e2[_0x589c74[_0xcb46('0x2b')]]={'$like':'%'+_0x4699dd[_0xcb46('0x33')][_0xcb46('0x41')]+'%'};return _0xc2a3e2;}})});}_0x489222=_[_0xcb46('0x3f')]({},_0x489222,_0x4699dd['options']);var _0x5d6cd3={'where':_0x489222['where']};return db['Variable'][_0xcb46('0x1d')](_0x5d6cd3)[_0xcb46('0x24')](function(_0x46a860){_0x89db76[_0xcb46('0x1d')]=_0x46a860;if(_0x4699dd[_0xcb46('0x33')][_0xcb46('0x42')]){_0x489222[_0xcb46('0x43')]=[{'all':!![]}];}return db['Variable'][_0xcb46('0x44')](_0x489222);})[_0xcb46('0x24')](function(_0x522821){_0x89db76[_0xcb46('0x45')]=_0x522821;return _0x89db76;})['then'](respondWithFilteredResult(_0x4f08a8,_0x489222))[_0xcb46('0x46')](handleError(_0x4f08a8,null));};exports[_0xcb46('0x47')]=function(_0x13d59b,_0x1ef1d9){var _0x30a4b2={'raw':!![],'where':{'id':_0x13d59b[_0xcb46('0x48')]['id']}},_0x350991={};_0x350991['model']=_[_0xcb46('0x34')](db['Variable'][_0xcb46('0x2f')]);_0x350991[_0xcb46('0x33')]=_[_0xcb46('0x34')](_0x13d59b[_0xcb46('0x33')]);_0x350991[_0xcb46('0x35')]=_[_0xcb46('0x49')](_0x350991['model'],_0x350991['query']);_0x30a4b2[_0xcb46('0x37')]=_[_0xcb46('0x49')](_0x350991['model'],qs[_0xcb46('0x38')](_0x13d59b[_0xcb46('0x33')]['fields']));_0x30a4b2[_0xcb46('0x37')]=_0x30a4b2[_0xcb46('0x37')]['length']?_0x30a4b2['attributes']:_0x350991[_0xcb46('0x36')];if(_0x13d59b[_0xcb46('0x33')][_0xcb46('0x42')]){_0x30a4b2[_0xcb46('0x43')]=[{'all':!![]}];}_0x30a4b2=_[_0xcb46('0x3f')]({},_0x30a4b2,_0x13d59b[_0xcb46('0x4a')]);return db['Variable'][_0xcb46('0x4b')](_0x30a4b2)[_0xcb46('0x24')](handleEntityNotFound(_0x1ef1d9,null))[_0xcb46('0x24')](respondWithResult(_0x1ef1d9,null))[_0xcb46('0x46')](handleError(_0x1ef1d9,null));};exports[_0xcb46('0x4c')]=function(_0x4e35f2,_0x6938e4){return db[_0xcb46('0x2e')]['create'](_0x4e35f2[_0xcb46('0x4d')],{})[_0xcb46('0x24')](function(_0x571f59){var _0x1ae7a9=_0x4e35f2['user'][_0xcb46('0x4e')]({'plain':!![]});if(!_0x1ae7a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ae7a9['role']===_0xcb46('0x4f')){var _0x504c22=_0x571f59[_0xcb46('0x4e')]({'plain':!![]});var _0x438df2='Variables';return db['UserProfileSection'][_0xcb46('0x4b')]({'where':{'name':_0x438df2,'userProfileId':_0x1ae7a9[_0xcb46('0x50')]},'raw':!![]})[_0xcb46('0x24')](function(_0x374e48){if(_0x374e48&&_0x374e48[_0xcb46('0x51')]===0x0){return db[_0xcb46('0x27')]['create']({'name':_0x504c22[_0xcb46('0x2b')],'resourceId':_0x504c22['id'],'type':_0x374e48[_0xcb46('0x2b')],'sectionId':_0x374e48['id']},{})[_0xcb46('0x24')](function(){return _0x571f59;});}else{return _0x571f59;}})[_0xcb46('0x46')](function(_0x40a5d7){logger[_0xcb46('0x29')](_0xcb46('0x52'),_0x40a5d7);throw _0x40a5d7;});}return _0x571f59;})[_0xcb46('0x24')](respondWithResult(_0x6938e4,0xc9))[_0xcb46('0x46')](handleError(_0x6938e4,null));};exports['update']=function(_0xea079a,_0x4f2613){if(_0xea079a[_0xcb46('0x4d')]['id']){delete _0xea079a['body']['id'];}return db[_0xcb46('0x2e')][_0xcb46('0x4b')]({'where':{'id':_0xea079a[_0xcb46('0x48')]['id']}})[_0xcb46('0x24')](handleEntityNotFound(_0x4f2613,null))[_0xcb46('0x24')](saveUpdates(_0xea079a['body'],null))['then'](respondWithResult(_0x4f2613,null))[_0xcb46('0x46')](handleError(_0x4f2613,null));};exports[_0xcb46('0x25')]=function(_0x151624,_0x144615){return db['Variable'][_0xcb46('0x4b')]({'where':{'id':_0x151624[_0xcb46('0x48')]['id']}})['then'](handleEntityNotFound(_0x144615,null))[_0xcb46('0x24')](removeEntity(_0x144615,null))['catch'](handleError(_0x144615,null));}; \ No newline at end of file +var _0x7cb7=['type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','get','Variables','error','name','send','index','map','Variable','rawAttributes'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7cb7,0x176));var _0x77cb=function(_0x2131f3,_0x4ee7e7){_0x2131f3=_0x2131f3-0x0;var _0x598737=_0x7cb7[_0x2131f3];return _0x598737;};'use strict';var emlformat=require(_0x77cb('0x0'));var rimraf=require(_0x77cb('0x1'));var zipdir=require(_0x77cb('0x2'));var jsonpatch=require(_0x77cb('0x3'));var rp=require(_0x77cb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77cb('0x5'));var util=require(_0x77cb('0x6'));var path=require(_0x77cb('0x7'));var sox=require(_0x77cb('0x8'));var csv=require(_0x77cb('0x9'));var ejs=require(_0x77cb('0xa'));var fs=require('fs');var fs_extra=require(_0x77cb('0xb'));var _=require('lodash');var squel=require(_0x77cb('0xc'));var crypto=require(_0x77cb('0xd'));var jsforce=require(_0x77cb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x77cb('0xf'));var Papa=require(_0x77cb('0x10'));var Redis=require(_0x77cb('0x11'));var authService=require(_0x77cb('0x12'));var qs=require(_0x77cb('0x13'));var as=require(_0x77cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x77cb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77cb('0x16'));var db=require(_0x77cb('0x17'))['db'];function respondWithStatusCode(_0x950b11,_0x38a1d5){_0x38a1d5=_0x38a1d5||0xcc;return function(_0x261a55){if(_0x261a55){return _0x950b11[_0x77cb('0x18')](_0x38a1d5);}return _0x950b11[_0x77cb('0x19')](_0x38a1d5)[_0x77cb('0x1a')]();};}function respondWithResult(_0x4db9db,_0x4a045f){_0x4a045f=_0x4a045f||0xc8;return function(_0x23adb1){if(_0x23adb1){return _0x4db9db[_0x77cb('0x19')](_0x4a045f)[_0x77cb('0x1b')](_0x23adb1);}};}function respondWithFilteredResult(_0x267583,_0x4ad5e7){return function(_0x275ae6){if(_0x275ae6){var _0x5740fc=typeof _0x4ad5e7['offset']===_0x77cb('0x1c')&&typeof _0x4ad5e7[_0x77cb('0x1d')]===_0x77cb('0x1c');var _0x47f8c9=_0x275ae6[_0x77cb('0x1e')];var _0x4f6d96=_0x5740fc?0x0:_0x4ad5e7[_0x77cb('0x1f')];var _0x9b24b4=_0x5740fc?_0x275ae6[_0x77cb('0x1e')]:_0x4ad5e7['offset']+_0x4ad5e7['limit'];var _0x4452aa;if(_0x9b24b4>=_0x47f8c9){_0x9b24b4=_0x47f8c9;_0x4452aa=0xc8;}else{_0x4452aa=0xce;}_0x267583['status'](_0x4452aa);return _0x267583[_0x77cb('0x20')]('Content-Range',_0x4f6d96+'-'+_0x9b24b4+'/'+_0x47f8c9)[_0x77cb('0x1b')](_0x275ae6);}return null;};}function patchUpdates(_0x2b0f03){return function(_0x30aab7){try{jsonpatch['apply'](_0x30aab7,_0x2b0f03,!![]);}catch(_0x3df385){return BPromise[_0x77cb('0x21')](_0x3df385);}return _0x30aab7[_0x77cb('0x22')]();};}function saveUpdates(_0x2ed6d7,_0x5595b8){return function(_0xd7ec74){if(_0xd7ec74){return _0xd7ec74[_0x77cb('0x23')](_0x2ed6d7)['then'](function(_0x10dc6a){return _0x10dc6a;});}return null;};}function removeEntity(_0x5d60ca,_0x46215c){return function(_0x10c4c0){if(_0x10c4c0){return _0x10c4c0['destroy']()[_0x77cb('0x24')](function(){var _0x92fe1=_0x10c4c0[_0x77cb('0x25')]({'plain':!![]});var _0x11a90c=_0x77cb('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x11a90c,'resourceId':_0x92fe1['id']}})[_0x77cb('0x24')](function(){return _0x10c4c0;});})[_0x77cb('0x24')](function(){_0x5d60ca[_0x77cb('0x19')](0xcc)[_0x77cb('0x1a')]();});}};}function handleEntityNotFound(_0x486715,_0x5dae2b){return function(_0x1b895b){if(!_0x1b895b){_0x486715[_0x77cb('0x18')](0x194);}return _0x1b895b;};}function handleError(_0x5e7136,_0x46dc04){_0x46dc04=_0x46dc04||0x1f4;return function(_0x256fb6){logger[_0x77cb('0x27')](_0x256fb6['stack']);if(_0x256fb6[_0x77cb('0x28')]){delete _0x256fb6[_0x77cb('0x28')];}_0x5e7136[_0x77cb('0x19')](_0x46dc04)[_0x77cb('0x29')](_0x256fb6);};}exports[_0x77cb('0x2a')]=function(_0x5ba804,_0x1c0977){var _0x3b1f84={},_0x45f5d3={},_0x5a964e={'count':0x0,'rows':[]};var _0x1d89f4=_[_0x77cb('0x2b')](db[_0x77cb('0x2c')][_0x77cb('0x2d')],function(_0x52c68b){return{'name':_0x52c68b['fieldName'],'type':_0x52c68b[_0x77cb('0x2e')]['key']};});_0x45f5d3[_0x77cb('0x2f')]=_[_0x77cb('0x2b')](_0x1d89f4,'name');_0x45f5d3[_0x77cb('0x30')]=_['keys'](_0x5ba804['query']);_0x45f5d3[_0x77cb('0x31')]=_[_0x77cb('0x32')](_0x45f5d3[_0x77cb('0x2f')],_0x45f5d3[_0x77cb('0x30')]);_0x3b1f84['attributes']=_[_0x77cb('0x32')](_0x45f5d3['model'],qs['fields'](_0x5ba804[_0x77cb('0x30')][_0x77cb('0x33')]));_0x3b1f84[_0x77cb('0x34')]=_0x3b1f84['attributes']['length']?_0x3b1f84[_0x77cb('0x34')]:_0x45f5d3[_0x77cb('0x2f')];if(!_0x5ba804[_0x77cb('0x30')][_0x77cb('0x35')](_0x77cb('0x36'))){_0x3b1f84[_0x77cb('0x1d')]=qs[_0x77cb('0x1d')](_0x5ba804['query'][_0x77cb('0x1d')]);_0x3b1f84[_0x77cb('0x1f')]=qs[_0x77cb('0x1f')](_0x5ba804[_0x77cb('0x30')][_0x77cb('0x1f')]);}_0x3b1f84[_0x77cb('0x37')]=qs[_0x77cb('0x38')](_0x5ba804['query']['sort']);_0x3b1f84[_0x77cb('0x39')]=qs[_0x77cb('0x31')](_[_0x77cb('0x3a')](_0x5ba804['query'],_0x45f5d3['filters']),_0x1d89f4);if(_0x5ba804[_0x77cb('0x30')][_0x77cb('0x3b')]){_0x3b1f84['where']=_[_0x77cb('0x3c')](_0x3b1f84[_0x77cb('0x39')],{'$or':_[_0x77cb('0x2b')](_0x1d89f4,function(_0x24ad8d){if(_0x24ad8d['type']!==_0x77cb('0x3d')){var _0x8a24c4={};_0x8a24c4[_0x24ad8d[_0x77cb('0x28')]]={'$like':'%'+_0x5ba804['query'][_0x77cb('0x3b')]+'%'};return _0x8a24c4;}})});}_0x3b1f84=_[_0x77cb('0x3c')]({},_0x3b1f84,_0x5ba804[_0x77cb('0x3e')]);var _0x59bd34={'where':_0x3b1f84[_0x77cb('0x39')]};return db[_0x77cb('0x2c')][_0x77cb('0x1e')](_0x59bd34)[_0x77cb('0x24')](function(_0x4bfcc3){_0x5a964e['count']=_0x4bfcc3;if(_0x5ba804['query'][_0x77cb('0x3f')]){_0x3b1f84['include']=[{'all':!![]}];}return db[_0x77cb('0x2c')][_0x77cb('0x40')](_0x3b1f84);})[_0x77cb('0x24')](function(_0x2e5b37){_0x5a964e[_0x77cb('0x41')]=_0x2e5b37;return _0x5a964e;})[_0x77cb('0x24')](respondWithFilteredResult(_0x1c0977,_0x3b1f84))[_0x77cb('0x42')](handleError(_0x1c0977,null));};exports[_0x77cb('0x43')]=function(_0x202f17,_0x331e38){var _0x5996b4={'raw':!![],'where':{'id':_0x202f17['params']['id']}},_0x83b4fb={};_0x83b4fb['model']=_[_0x77cb('0x44')](db[_0x77cb('0x2c')][_0x77cb('0x2d')]);_0x83b4fb[_0x77cb('0x30')]=_[_0x77cb('0x44')](_0x202f17[_0x77cb('0x30')]);_0x83b4fb['filters']=_['intersection'](_0x83b4fb[_0x77cb('0x2f')],_0x83b4fb[_0x77cb('0x30')]);_0x5996b4[_0x77cb('0x34')]=_[_0x77cb('0x32')](_0x83b4fb[_0x77cb('0x2f')],qs[_0x77cb('0x33')](_0x202f17[_0x77cb('0x30')][_0x77cb('0x33')]));_0x5996b4[_0x77cb('0x34')]=_0x5996b4[_0x77cb('0x34')][_0x77cb('0x45')]?_0x5996b4[_0x77cb('0x34')]:_0x83b4fb[_0x77cb('0x2f')];if(_0x202f17[_0x77cb('0x30')][_0x77cb('0x3f')]){_0x5996b4[_0x77cb('0x46')]=[{'all':!![]}];}_0x5996b4=_[_0x77cb('0x3c')]({},_0x5996b4,_0x202f17[_0x77cb('0x3e')]);return db['Variable'][_0x77cb('0x47')](_0x5996b4)[_0x77cb('0x24')](handleEntityNotFound(_0x331e38,null))['then'](respondWithResult(_0x331e38,null))[_0x77cb('0x42')](handleError(_0x331e38,null));};exports[_0x77cb('0x48')]=function(_0x2257ae,_0x5a7984){return db['Variable'][_0x77cb('0x48')](_0x2257ae['body'],{})['then'](function(_0x316c3f){var _0x2e3336=_0x2257ae[_0x77cb('0x49')][_0x77cb('0x25')]({'plain':!![]});if(!_0x2e3336)throw new Error(_0x77cb('0x4a'));if(_0x2e3336[_0x77cb('0x4b')]==='user'){var _0x4a72ed=_0x316c3f[_0x77cb('0x25')]({'plain':!![]});var _0xceca7a='Variables';return db[_0x77cb('0x4c')][_0x77cb('0x47')]({'where':{'name':_0xceca7a,'userProfileId':_0x2e3336[_0x77cb('0x4d')]},'raw':!![]})['then'](function(_0x582d0f){if(_0x582d0f&&_0x582d0f[_0x77cb('0x4e')]===0x0){return db[_0x77cb('0x4f')][_0x77cb('0x48')]({'name':_0x4a72ed[_0x77cb('0x28')],'resourceId':_0x4a72ed['id'],'type':_0x582d0f[_0x77cb('0x28')],'sectionId':_0x582d0f['id']},{})['then'](function(){return _0x316c3f;});}else{return _0x316c3f;}})[_0x77cb('0x42')](function(_0x56ca18){logger[_0x77cb('0x27')](_0x77cb('0x50'),_0x56ca18);throw _0x56ca18;});}return _0x316c3f;})[_0x77cb('0x24')](respondWithResult(_0x5a7984,0xc9))[_0x77cb('0x42')](handleError(_0x5a7984,null));};exports[_0x77cb('0x23')]=function(_0x3d272d,_0x46679a){if(_0x3d272d[_0x77cb('0x51')]['id']){delete _0x3d272d['body']['id'];}return db['Variable'][_0x77cb('0x47')]({'where':{'id':_0x3d272d[_0x77cb('0x52')]['id']}})[_0x77cb('0x24')](handleEntityNotFound(_0x46679a,null))[_0x77cb('0x24')](saveUpdates(_0x3d272d[_0x77cb('0x51')],null))['then'](respondWithResult(_0x46679a,null))[_0x77cb('0x42')](handleError(_0x46679a,null));};exports[_0x77cb('0x53')]=function(_0x2f2b66,_0x4a0a4e){return db['Variable']['find']({'where':{'id':_0x2f2b66[_0x77cb('0x52')]['id']}})[_0x77cb('0x24')](handleEntityNotFound(_0x4a0a4e,null))[_0x77cb('0x24')](removeEntity(_0x4a0a4e,null))['catch'](handleError(_0x4a0a4e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c0f81ed..d93dcae 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 _0x93cf=['moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x52402c,_0x42d5ff){var _0x5a6882=function(_0x122417){while(--_0x122417){_0x52402c['push'](_0x52402c['shift']());}};_0x5a6882(++_0x42d5ff);}(_0x93cf,0x8c));var _0xf93c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x93cf[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xf93c('0x0'));var util=require(_0xf93c('0x1'));var logger=require(_0xf93c('0x2'))('api');var moment=require(_0xf93c('0x3'));var BPromise=require(_0xf93c('0x4'));var rp=require(_0xf93c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf93c('0x6'));var config=require(_0xf93c('0x7'));var attributes=require(_0xf93c('0x8'));module[_0xf93c('0x9')]=function(_0x20949b,_0x1fb356){return _0x20949b[_0xf93c('0xa')](_0xf93c('0xb'),attributes,{'tableName':_0xf93c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87d5=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define','tools_variables'];(function(_0x13a7f8,_0x5e62bd){var _0x285f0e=function(_0xecb3a0){while(--_0xecb3a0){_0x13a7f8['push'](_0x13a7f8['shift']());}};_0x285f0e(++_0x5e62bd);}(_0x87d5,0x82));var _0x587d=function(_0x5a828c,_0x5c50ae){_0x5a828c=_0x5a828c-0x0;var _0x1b126e=_0x87d5[_0x5a828c];return _0x1b126e;};'use strict';var _=require(_0x587d('0x0'));var util=require(_0x587d('0x1'));var logger=require(_0x587d('0x2'))('api');var moment=require(_0x587d('0x3'));var BPromise=require('bluebird');var rp=require(_0x587d('0x4'));var fs=require('fs');var path=require(_0x587d('0x5'));var rimraf=require(_0x587d('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x587d('0x7')]=function(_0x3953a9,_0x2525ed){return _0x3953a9[_0x587d('0x8')]('Variable',attributes,{'tableName':_0x587d('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 db9f874..88165ff 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x416978,_0x1aded4){var _0x5d7713=function(_0x5b80ba){while(--_0x5b80ba){_0x416978['push'](_0x416978['shift']());}};_0x5d7713(++_0x1aded4);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1613d9,_0x2f583e){_0x1613d9=_0x1613d9-0x0;var _0x1ab5e0=_0x7fbe[_0x1613d9];return _0x1ab5e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ 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(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xa41a,0x6b));var _0xaa41=function(_0x1a5fda,_0x20f270){_0x1a5fda=_0x1a5fda-0x0;var _0x1da3fa=_0xa41a[_0x1a5fda];return _0x1da3fa;};'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 e8fdf0c..6b4f566 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 _0x4dba=['../../components/auth/service','./version.controller','get','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart','/migrations','exports','Router'];(function(_0x4963e7,_0x27697c){var _0x5c4a71=function(_0x1015c6){while(--_0x1015c6){_0x4963e7['push'](_0x4963e7['shift']());}};_0x5c4a71(++_0x27697c);}(_0x4dba,0xdf));var _0xa4db=function(_0x3f5182,_0x5a3fc5){_0x3f5182=_0x3f5182-0x0;var _0xc7e3d0=_0x4dba[_0x3f5182];return _0xc7e3d0;};'use strict';var express=require('express');var router=express[_0xa4db('0x0')]();var auth=require(_0xa4db('0x1'));var controller=require(_0xa4db('0x2'));router['get']('/',controller['index']);router[_0xa4db('0x3')]('/fetch',auth[_0xa4db('0x4')](),auth['canUpdate'](),controller[_0xa4db('0x5')]);router['get'](_0xa4db('0x6'),auth[_0xa4db('0x4')](),auth[_0xa4db('0x7')](),controller[_0xa4db('0x8')]);router[_0xa4db('0x3')](_0xa4db('0x9'),auth[_0xa4db('0x4')](),auth[_0xa4db('0x7')](),controller[_0xa4db('0xa')]);router[_0xa4db('0x3')]('/restart',auth[_0xa4db('0x4')](),controller[_0xa4db('0xb')]);router[_0xa4db('0x3')](_0xa4db('0xc'),controller['migrations']);module[_0xa4db('0xd')]=router; \ No newline at end of file +var _0x688e=['canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','./version.controller','index','get','isAuthenticated'];(function(_0xc4815a,_0x3ddfe8){var _0x24e3e6=function(_0x27a998){while(--_0x27a998){_0xc4815a['push'](_0xc4815a['shift']());}};_0x24e3e6(++_0x3ddfe8);}(_0x688e,0xd9));var _0xe688=function(_0x3c098b,_0x19209e){_0x3c098b=_0x3c098b-0x0;var _0x40bb63=_0x688e[_0x3c098b];return _0x40bb63;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe688('0x0'));router['get']('/',controller[_0xe688('0x1')]);router[_0xe688('0x2')]('/fetch',auth[_0xe688('0x3')](),auth[_0xe688('0x4')](),controller['fetch']);router[_0xe688('0x2')](_0xe688('0x5'),auth[_0xe688('0x3')](),auth[_0xe688('0x4')](),controller[_0xe688('0x6')]);router[_0xe688('0x2')](_0xe688('0x7'),auth[_0xe688('0x3')](),auth['canUpdate'](),controller[_0xe688('0x8')]);router[_0xe688('0x2')](_0xe688('0x9'),auth[_0xe688('0x3')](),controller[_0xe688('0xa')]);router[_0xe688('0x2')](_0xe688('0xb'),controller[_0xe688('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3466010..46c1a4e 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 _0x4bd3=['../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','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','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','../../mysqldb','../../config/environment'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x4bd3,0x96));var _0x34bd=function(_0x13602c,_0x2e5218){_0x13602c=_0x13602c-0x0;var _0x730ea3=_0x4bd3[_0x13602c];return _0x730ea3;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x34bd('0x0'));var pkginfo=require(_0x34bd('0x1'))(module,_0x34bd('0x2'));var compareVersions=require(_0x34bd('0x3'));var exec=require('child_process')['exec'];var db=require(_0x34bd('0x4'))['db'];var config=require(_0x34bd('0x5'));var pm2=require(_0x34bd('0x6'));var logger=require(_0x34bd('0x7'))(_0x34bd('0x8'));var git=require('simple-git')(config[_0x34bd('0x9')]);exports[_0x34bd('0xa')]=function(_0x1fdeaa,_0x1c10ba){var _0x1464f8={'current':module[_0x34bd('0xb')]['version'],'phonebar':0x2};if(_0x1fdeaa[_0x34bd('0xc')]&&_0x1fdeaa[_0x34bd('0xc')][_0x34bd('0xd')]){return git[_0x34bd('0xe')]()[_0x34bd('0xf')](function(_0x58ed89,_0x8afe06){_0x1464f8[_0x34bd('0xd')]=(_0x58ed89?module[_0x34bd('0xb')][_0x34bd('0x2')]:_0x8afe06[_0x34bd('0xd')])||_0x34bd('0x10');return _0x1c10ba[_0x34bd('0x11')](0xc8)[_0x34bd('0x12')](_0x1464f8);});}else{return _0x1c10ba[_0x34bd('0x11')](0xc8)['json'](_0x1464f8);}};exports[_0x34bd('0xe')]=function(_0x4f8d30,_0x84b2dd){return git[_0x34bd('0xe')]([_0x34bd('0x13'),'master'],function(_0x364ad6){if(_0x364ad6){logger[_0x34bd('0x14')](_0x364ad6);return _0x84b2dd[_0x34bd('0x11')](0x1f4)[_0x34bd('0x12')](_0x364ad6);}logger[_0x34bd('0x15')]('git\x20fetch');return _0x84b2dd[_0x34bd('0x11')](0xc8)[_0x34bd('0x12')]({'output':_0x34bd('0x16')});});};exports['reset']=function(_0x4c944c,_0x11165a){return git[_0x34bd('0x17')]([_0x34bd('0x18'),'FETCH_HEAD'],function(_0x2e8a99){if(_0x2e8a99){logger['error'](_0x2e8a99);return _0x11165a[_0x34bd('0x11')](0x1f4)[_0x34bd('0x12')](_0x2e8a99);}logger[_0x34bd('0x15')](_0x34bd('0x19'));return _0x11165a[_0x34bd('0x11')](0xc8)[_0x34bd('0x12')]({'output':_0x34bd('0x1a')});});};exports['pull']=function(_0x4d2062,_0x5c1e76){exec(_0x34bd('0x1b'),function(_0x5a0d96,_0x409e90,_0x3a58b2){logger[_0x34bd('0x15')](_0x409e90);logger[_0x34bd('0x15')](_0x3a58b2);if(_0x5a0d96){logger[_0x34bd('0x14')](_0x5a0d96);return _0x5c1e76['status'](0x1f4)['json'](_0x5a0d96);}return _0x5c1e76[_0x34bd('0x11')](0xc8)[_0x34bd('0x12')]({'output':_0x409e90});});};exports['restart']=function(_0x374d16,_0x22932b){return pm2[_0x34bd('0x1c')](_0x34bd('0x1d'))[_0x34bd('0x1e')](function(_0x287acc){logger[_0x34bd('0x15')](_0x34bd('0x1f'),_0x287acc);return _0x22932b['status'](0xc8)[_0x34bd('0x12')]({'output':_0x34bd('0x20')});})[_0x34bd('0x21')](function(_0xce22a6){logger[_0x34bd('0x14')](_0xce22a6);return _0x22932b[_0x34bd('0x11')](0x1f4)[_0x34bd('0x12')](_0xce22a6);});};exports['migrations']=function(_0x6555a8,_0x17dd29){var _0x373896=fs[_0x34bd('0x22')](path[_0x34bd('0x23')](config['root'],'server',_0x34bd('0x24')));var _0x2b6fd8=[];for(var _0x55619c=0x0;_0x55619c<_0x373896[_0x34bd('0x25')];_0x55619c++){var _0x55882f=_0x373896[_0x55619c][_0x34bd('0x26')](_0x34bd('0x27'),'');if(compareVersions(module[_0x34bd('0xb')][_0x34bd('0x2')],_0x55882f)===-0x1){_0x2b6fd8[_0x34bd('0x28')](_0x55882f);}}if(_0x2b6fd8['length']){var _0x524bc7=_0x2b6fd8[_0x34bd('0x29')](compareVersions);var _0x5e86c1=new Umzug({'storage':_0x34bd('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0x34bd('0x2b'),'columnName':_0x34bd('0x2')},'migrations':{'params':[db[_0x34bd('0x2a')][_0x34bd('0x2c')](),db['sequelize'][_0x34bd('0x2d')],function(){throw new Error(_0x34bd('0x2e'));}],'path':path['join'](config['root'],'server',_0x34bd('0x24')),'pattern':/\.js$/}});_0x5e86c1['up']({'migrations':_[_0x34bd('0x2f')](_0x524bc7,function(_0x4f5dbe){return _0x4f5dbe+_0x34bd('0x27');})})['then'](function(){return _0x17dd29['status'](0xc8)[_0x34bd('0x12')]({'output':_0x34bd('0x30')+module['exports'][_0x34bd('0x2')]+_0x34bd('0x31')+_[_0x34bd('0x32')](_0x524bc7),'migrations':_[_0x34bd('0x23')](_0x524bc7)});})[_0x34bd('0x21')](function(_0x492db2){if(_0x492db2 instanceof db[_0x34bd('0x2a')]['UniqueConstraintError']){return _0x17dd29[_0x34bd('0x11')](0xc8)[_0x34bd('0x12')]({'output':_0x34bd('0x33')});}else{return _0x17dd29[_0x34bd('0x11')](0x1f4)[_0x34bd('0x12')](_0x492db2);}});}else{return _0x17dd29['status'](0xc8)['json']({'output':_0x34bd('0x33')});}}; \ No newline at end of file +var _0xc3c3=['join','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','then','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','info','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xc3c3,0x123));var _0x3c3c=function(_0x5c9a80,_0x3d9398){_0x5c9a80=_0x5c9a80-0x0;var _0x58fe8a=_0xc3c3[_0x5c9a80];return _0x58fe8a;};'use strict';var Umzug=require('umzug');var path=require(_0x3c3c('0x0'));var fs=require('fs');var _=require(_0x3c3c('0x1'));var pkginfo=require(_0x3c3c('0x2'))(module,_0x3c3c('0x3'));var compareVersions=require(_0x3c3c('0x4'));var exec=require(_0x3c3c('0x5'))[_0x3c3c('0x6')];var db=require(_0x3c3c('0x7'))['db'];var config=require(_0x3c3c('0x8'));var pm2=require(_0x3c3c('0x9'));var logger=require(_0x3c3c('0xa'))(_0x3c3c('0xb'));var git=require(_0x3c3c('0xc'))(config['root']);exports[_0x3c3c('0xd')]=function(_0x2dc33e,_0x3199c6){var _0x1fd452={'current':module[_0x3c3c('0xe')][_0x3c3c('0x3')],'phonebar':0x2};if(_0x2dc33e[_0x3c3c('0xf')]&&_0x2dc33e[_0x3c3c('0xf')][_0x3c3c('0x10')]){return git[_0x3c3c('0x11')]()[_0x3c3c('0x12')](function(_0x5757dc,_0x3e8734){_0x1fd452[_0x3c3c('0x10')]=(_0x5757dc?module[_0x3c3c('0xe')][_0x3c3c('0x3')]:_0x3e8734[_0x3c3c('0x10')])||_0x3c3c('0x13');return _0x3199c6[_0x3c3c('0x14')](0xc8)[_0x3c3c('0x15')](_0x1fd452);});}else{return _0x3199c6[_0x3c3c('0x14')](0xc8)[_0x3c3c('0x15')](_0x1fd452);}};exports[_0x3c3c('0x11')]=function(_0x3f25c9,_0x4f7226){return git[_0x3c3c('0x11')](['origin',_0x3c3c('0x16')],function(_0x4e6db1){if(_0x4e6db1){logger[_0x3c3c('0x17')](_0x4e6db1);return _0x4f7226['status'](0x1f4)[_0x3c3c('0x15')](_0x4e6db1);}logger['info'](_0x3c3c('0x18'));return _0x4f7226[_0x3c3c('0x14')](0xc8)['json']({'output':_0x3c3c('0x19')});});};exports[_0x3c3c('0x1a')]=function(_0x1f77d8,_0x3dac96){return git[_0x3c3c('0x1a')]([_0x3c3c('0x1b'),_0x3c3c('0x1c')],function(_0x5b8e8c){if(_0x5b8e8c){logger[_0x3c3c('0x17')](_0x5b8e8c);return _0x3dac96[_0x3c3c('0x14')](0x1f4)[_0x3c3c('0x15')](_0x5b8e8c);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3dac96[_0x3c3c('0x14')](0xc8)[_0x3c3c('0x15')]({'output':_0x3c3c('0x1d')});});};exports[_0x3c3c('0x1e')]=function(_0x5016c3,_0x412edc){exec('npm\x20install\x20--production',function(_0x56ae16,_0x831d4b,_0x4a0989){logger[_0x3c3c('0x1f')](_0x831d4b);logger[_0x3c3c('0x1f')](_0x4a0989);if(_0x56ae16){logger[_0x3c3c('0x17')](_0x56ae16);return _0x412edc[_0x3c3c('0x14')](0x1f4)['json'](_0x56ae16);}return _0x412edc[_0x3c3c('0x14')](0xc8)['json']({'output':_0x831d4b});});};exports[_0x3c3c('0x20')]=function(_0x1fbc21,_0xc11822){return pm2[_0x3c3c('0x20')](_0x3c3c('0x21'))['then'](function(_0x16eaa2){logger['info'](_0x3c3c('0x22'),_0x16eaa2);return _0xc11822[_0x3c3c('0x14')](0xc8)[_0x3c3c('0x15')]({'output':_0x3c3c('0x23')});})[_0x3c3c('0x24')](function(_0x322c11){logger['error'](_0x322c11);return _0xc11822['status'](0x1f4)[_0x3c3c('0x15')](_0x322c11);});};exports[_0x3c3c('0x25')]=function(_0x18c83e,_0x3a71d0){var _0xa42ca0=fs[_0x3c3c('0x26')](path[_0x3c3c('0x27')](config['root'],'server',_0x3c3c('0x25')));var _0x38fe42=[];for(var _0x109408=0x0;_0x109408<_0xa42ca0[_0x3c3c('0x28')];_0x109408++){var _0x1f5e71=_0xa42ca0[_0x109408][_0x3c3c('0x29')](_0x3c3c('0x2a'),'');if(compareVersions(module[_0x3c3c('0xe')]['version'],_0x1f5e71)===-0x1){_0x38fe42[_0x3c3c('0x2b')](_0x1f5e71);}}if(_0x38fe42[_0x3c3c('0x28')]){var _0x279863=_0x38fe42['sort'](compareVersions);var _0x154546=new Umzug({'storage':_0x3c3c('0x2c'),'storageOptions':{'model':db[_0x3c3c('0x2d')],'modelName':_0x3c3c('0x2d'),'columnName':_0x3c3c('0x3')},'migrations':{'params':[db[_0x3c3c('0x2c')][_0x3c3c('0x2e')](),db[_0x3c3c('0x2c')][_0x3c3c('0x2f')],function(){throw new Error(_0x3c3c('0x30'));}],'path':path[_0x3c3c('0x27')](config[_0x3c3c('0x31')],'server','migrations'),'pattern':/\.js$/}});_0x154546['up']({'migrations':_[_0x3c3c('0x32')](_0x279863,function(_0x21df27){return _0x21df27+_0x3c3c('0x2a');})})[_0x3c3c('0x33')](function(){return _0x3a71d0[_0x3c3c('0x14')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x3c3c('0x3')]+_0x3c3c('0x34')+_['last'](_0x279863),'migrations':_[_0x3c3c('0x27')](_0x279863)});})[_0x3c3c('0x24')](function(_0x8ddb5c){if(_0x8ddb5c instanceof db['sequelize'][_0x3c3c('0x35')]){return _0x3a71d0[_0x3c3c('0x14')](0xc8)[_0x3c3c('0x15')]({'output':_0x3c3c('0x36')});}else{return _0x3a71d0[_0x3c3c('0x14')](0x1f4)['json'](_0x8ddb5c);}});}else{return _0x3a71d0['status'](0xc8)[_0x3c3c('0x15')]({'output':_0x3c3c('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9a97254..de228dd 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 _0x5600=['/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated'];(function(_0x3d2bda,_0x21e76b){var _0x8d959f=function(_0x1d50c3){while(--_0x1d50c3){_0x3d2bda['push'](_0x3d2bda['shift']());}};_0x8d959f(++_0x21e76b);}(_0x5600,0x1ec));var _0x0560=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x5600[_0x576e2b];return _0x46461a;};'use strict';var multer=require('multer');var util=require(_0x0560('0x0'));var path=require('path');var timeout=require(_0x0560('0x1'));var express=require(_0x0560('0x2'));var router=express[_0x0560('0x3')]();var fs_extra=require(_0x0560('0x4'));var auth=require(_0x0560('0x5'));var interaction=require(_0x0560('0x6'));var config=require(_0x0560('0x7'));var controller=require(_0x0560('0x8'));router[_0x0560('0x9')]('/',auth['isAuthenticated'](),controller[_0x0560('0xa')]);router[_0x0560('0x9')]('/describe',auth[_0x0560('0xb')](),controller['describe']);router['get'](_0x0560('0xc'),auth['isAuthenticated'](),controller[_0x0560('0xd')]);router[_0x0560('0xe')]('/',auth[_0x0560('0xb')](),controller[_0x0560('0xf')]);router[_0x0560('0x10')](_0x0560('0xc'),auth[_0x0560('0xb')](),controller[_0x0560('0x11')]);router[_0x0560('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0560('0x13')]);module[_0x0560('0x14')]=router; \ No newline at end of file +var _0xcc04=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','describe','get','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5afb77,_0xdad1e1){var _0x477268=function(_0xb9202e){while(--_0xb9202e){_0x5afb77['push'](_0x5afb77['shift']());}};_0x477268(++_0xdad1e1);}(_0xcc04,0x19c));var _0x4cc0=function(_0x32ed6a,_0x1cd968){_0x32ed6a=_0x32ed6a-0x0;var _0x5d670c=_0xcc04[_0x32ed6a];return _0x5d670c;};'use strict';var multer=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var path=require(_0x4cc0('0x2'));var timeout=require(_0x4cc0('0x3'));var express=require(_0x4cc0('0x4'));var router=express['Router']();var fs_extra=require(_0x4cc0('0x5'));var auth=require(_0x4cc0('0x6'));var interaction=require(_0x4cc0('0x7'));var config=require(_0x4cc0('0x8'));var controller=require(_0x4cc0('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x4cc0('0xa')](),controller[_0x4cc0('0xb')]);router[_0x4cc0('0xc')](_0x4cc0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4cc0('0xe')]('/',auth[_0x4cc0('0xa')](),controller[_0x4cc0('0xf')]);router['put'](_0x4cc0('0xd'),auth[_0x4cc0('0xa')](),controller[_0x4cc0('0x10')]);router[_0x4cc0('0x11')]('/:id',auth[_0x4cc0('0xa')](),controller['destroy']);module[_0x4cc0('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 47626c2..87b74d6 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 _0xaa56=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xaa56,0xc6));var _0x6aa5=function(_0x25c4fb,_0x593784){_0x25c4fb=_0x25c4fb-0x0;var _0xc3ff6d=_0xaa56[_0x25c4fb];return _0xc3ff6d;};'use strict';var Sequelize=require('sequelize');module[_0x6aa5('0x0')]={'type':{'type':Sequelize[_0x6aa5('0x1')]},'uniqueid':{'type':Sequelize[_0x6aa5('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6aa5('0x1')]},'queue':{'type':Sequelize[_0x6aa5('0x1')]},'interface':{'type':Sequelize[_0x6aa5('0x1')]},'membername':{'type':Sequelize[_0x6aa5('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6aa5('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x6aa5('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x6aa5('0x2')]},'holdtime':{'type':Sequelize[_0x6aa5('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6aa5('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6aa5('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6aa5('0x3')]},'agentacw':{'type':Sequelize[_0x6aa5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6aa5('0x3')]},'reason':{'type':Sequelize[_0x6aa5('0x1')]},'lastevent':{'type':Sequelize[_0x6aa5('0x1')]},'channel':{'type':Sequelize[_0x6aa5('0x1')]},'channelstate':{'type':Sequelize[_0x6aa5('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6aa5('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6aa5('0x1')]},'connectedlinename':{'type':Sequelize[_0x6aa5('0x1')]},'language':{'type':Sequelize[_0x6aa5('0x1')]},'accountcode':{'type':Sequelize[_0x6aa5('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6aa5('0x1')]},'priority':{'type':Sequelize[_0x6aa5('0x1')]},'destchannel':{'type':Sequelize[_0x6aa5('0x1')]},'destchannelstate':{'type':Sequelize[_0x6aa5('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6aa5('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6aa5('0x1')]},'destlanguage':{'type':Sequelize[_0x6aa5('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6aa5('0x1')]},'destexten':{'type':Sequelize[_0x6aa5('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6aa5('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6aa5('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x6aa5('0x1')]},'transfer':{'type':Sequelize[_0x6aa5('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6aa5('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x6aa5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4f3c=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x16404a,_0x459beb){var _0x125955=function(_0x3e5109){while(--_0x3e5109){_0x16404a['push'](_0x16404a['shift']());}};_0x125955(++_0x459beb);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x3caeb5,_0x219363){_0x3caeb5=_0x3caeb5-0x0;var _0x5eca7e=_0x4f3c[_0x3caeb5];return _0x5eca7e;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'type':{'type':Sequelize[_0xc4f3('0x2')]},'uniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'calleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'calleridname':{'type':Sequelize[_0xc4f3('0x2')]},'queue':{'type':Sequelize[_0xc4f3('0x2')]},'interface':{'type':Sequelize[_0xc4f3('0x2')]},'membername':{'type':Sequelize[_0xc4f3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc4f3('0x3')]},'holdtime':{'type':Sequelize[_0xc4f3('0x4')]},'agentcomplete':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc4f3('0x4')]},'agentacw':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc4f3('0x4')]},'reason':{'type':Sequelize[_0xc4f3('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc4f3('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4f3('0x2')]},'accountcode':{'type':Sequelize[_0xc4f3('0x2')]},'context':{'type':Sequelize[_0xc4f3('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc4f3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'destcalleridname':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc4f3('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc4f3('0x2')]},'destcontext':{'type':Sequelize[_0xc4f3('0x2')]},'destexten':{'type':Sequelize[_0xc4f3('0x2')]},'destpriority':{'type':Sequelize[_0xc4f3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc4f3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc4f3('0x2')],'comment':_0xc4f3('0x6')},'transferexten':{'type':Sequelize[_0xc4f3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'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 fd1cd7b..9d862c4 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 e9cf428..1a06399 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 _0xab86=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x2539e6,_0x595d36){var _0xe83570=function(_0x2a8b2e){while(--_0x2a8b2e){_0x2539e6['push'](_0x2539e6['shift']());}};_0xe83570(++_0x595d36);}(_0xab86,0x13e));var _0x6ab8=function(_0x21f631,_0x4f8c2d){_0x21f631=_0x21f631-0x0;var _0xcfb7b0=_0xab86[_0x21f631];return _0xcfb7b0;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6ab8('0xb'),_0x6ab8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fda=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x2c4f2a,_0x17ccb4){_0x2c4f2a=_0x2c4f2a-0x0;var _0x1115a5=_0x0fda[_0x2c4f2a];return _0x1115a5;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa0fd('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f6e6d53..643c192 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 _0x28aa=['VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','stringify','UpdateVoiceAgentReport','update','raw','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x43a7b7,_0x555862){var _0x54f712=function(_0x236a72){while(--_0x236a72){_0x43a7b7['push'](_0x43a7b7['shift']());}};_0x54f712(++_0x555862);}(_0x28aa,0x1de));var _0xa28a=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x28aa[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0xa28a('0x0'));var util=require('util');var moment=require(_0xa28a('0x1'));var BPromise=require(_0xa28a('0x2'));var rs=require(_0xa28a('0x3'));var fs=require('fs');var Redis=require(_0xa28a('0x4'));var db=require(_0xa28a('0x5'))['db'];var utils=require(_0xa28a('0x6'));var logger=require(_0xa28a('0x7'))(_0xa28a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa28a('0x9'));var client=jayson[_0xa28a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ef346,_0x529eb5,_0x5ecd02){return new BPromise(function(_0x2e547f,_0x480317){return client['request'](_0x2ef346,_0x5ecd02)[_0xa28a('0xb')](function(_0x4ab138){logger[_0xa28a('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x529eb5,'request\x20sent');logger['debug'](_0xa28a('0xd'),_0x529eb5,_0xa28a('0xe'),JSON['stringify'](_0x4ab138));if(_0x4ab138[_0xa28a('0xf')]){if(_0x4ab138[_0xa28a('0xf')][_0xa28a('0x10')]===0x1f4){logger[_0xa28a('0xf')](_0xa28a('0x11'),_0x529eb5,_0x4ab138[_0xa28a('0xf')][_0xa28a('0x12')]);return _0x480317(_0x4ab138['error']['message']);}logger['error'](_0xa28a('0x11'),_0x529eb5,_0x4ab138[_0xa28a('0xf')][_0xa28a('0x12')]);return _0x2e547f(_0x4ab138['error']['message']);}else{logger[_0xa28a('0xc')](_0xa28a('0x11'),_0x529eb5,'request\x20sent');_0x2e547f(_0x4ab138[_0xa28a('0x13')]['message']);}})[_0xa28a('0x14')](function(_0xb0b330){logger[_0xa28a('0xf')](_0xa28a('0x11'),_0x529eb5,_0xb0b330);_0x480317(_0xb0b330);});});}exports[_0xa28a('0x15')]=function(_0x262cd5){var _0x2205ef=this;return new Promise(function(_0x5efa7c,_0x26b774){return db[_0xa28a('0x16')][_0xa28a('0x17')](_0x262cd5['body'],{'raw':_0x262cd5[_0xa28a('0x18')]?_0x262cd5[_0xa28a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa28a('0xb')](function(_0xf2c9a){logger[_0xa28a('0xc')](_0xa28a('0x15'),_0x262cd5);logger['debug'](_0xa28a('0x15'),_0x262cd5,JSON[_0xa28a('0x19')](_0xf2c9a));_0x5efa7c(_0xf2c9a);})[_0xa28a('0x14')](function(_0x57437e){logger[_0xa28a('0xf')](_0xa28a('0x15'),_0x57437e[_0xa28a('0x12')],_0x262cd5);_0x26b774(_0x2205ef[_0xa28a('0xf')](0x1f4,_0x57437e[_0xa28a('0x12')]));});});};exports[_0xa28a('0x1a')]=function(_0x175311){var _0x156af2=this;return new Promise(function(_0x51827b,_0x2786bc){return db[_0xa28a('0x16')][_0xa28a('0x1b')](_0x175311['body'],{'raw':_0x175311[_0xa28a('0x18')]?_0x175311['options'][_0xa28a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175311[_0xa28a('0x18')]?_0x175311['options'][_0xa28a('0x1d')]||null:null,'attributes':_0x175311[_0xa28a('0x18')]?_0x175311[_0xa28a('0x18')][_0xa28a('0x1e')]||null:null,'limit':_0x175311['options']?_0x175311[_0xa28a('0x18')][_0xa28a('0x1f')]||null:null})[_0xa28a('0xb')](function(_0x3b8f8a){logger[_0xa28a('0xc')](_0xa28a('0x1a'),_0x175311);logger[_0xa28a('0x20')](_0xa28a('0x1a'),_0x175311,JSON['stringify'](_0x3b8f8a));_0x51827b(_0x3b8f8a);})['catch'](function(_0x4fd715){logger['error'](_0xa28a('0x1a'),_0x4fd715[_0xa28a('0x12')],_0x175311);_0x2786bc(_0x156af2[_0xa28a('0xf')](0x1f4,_0x4fd715[_0xa28a('0x12')]));});});}; \ No newline at end of file +var _0x7f48=['UpdateVoiceAgentReport','attributes','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport'];(function(_0x43eb20,_0x3a8df7){var _0x2128fb=function(_0x5100ba){while(--_0x5100ba){_0x43eb20['push'](_0x43eb20['shift']());}};_0x2128fb(++_0x3a8df7);}(_0x7f48,0x189));var _0x87f4=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x7f48[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var moment=require('moment');var BPromise=require(_0x87f4('0x2'));var rs=require(_0x87f4('0x3'));var fs=require('fs');var Redis=require(_0x87f4('0x4'));var db=require(_0x87f4('0x5'))['db'];var utils=require(_0x87f4('0x6'));var logger=require(_0x87f4('0x7'))(_0x87f4('0x8'));var config=require(_0x87f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x87f4('0xa')][_0x87f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9af3f8,_0x1f5f4c,_0x2c4e32){return new BPromise(function(_0x341ff1,_0x528692){return client[_0x87f4('0xc')](_0x9af3f8,_0x2c4e32)[_0x87f4('0xd')](function(_0x2f9878){logger[_0x87f4('0xe')](_0x87f4('0xf'),_0x1f5f4c,_0x87f4('0x10'));logger[_0x87f4('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1f5f4c,'request\x20sent',JSON['stringify'](_0x2f9878));if(_0x2f9878[_0x87f4('0x12')]){if(_0x2f9878[_0x87f4('0x12')]['code']===0x1f4){logger[_0x87f4('0x12')](_0x87f4('0xf'),_0x1f5f4c,_0x2f9878[_0x87f4('0x12')]['message']);return _0x528692(_0x2f9878[_0x87f4('0x12')][_0x87f4('0x13')]);}logger[_0x87f4('0x12')](_0x87f4('0xf'),_0x1f5f4c,_0x2f9878['error'][_0x87f4('0x13')]);return _0x341ff1(_0x2f9878[_0x87f4('0x12')][_0x87f4('0x13')]);}else{logger['info'](_0x87f4('0xf'),_0x1f5f4c,_0x87f4('0x10'));_0x341ff1(_0x2f9878[_0x87f4('0x14')][_0x87f4('0x13')]);}})[_0x87f4('0x15')](function(_0x220747){logger[_0x87f4('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1f5f4c,_0x220747);_0x528692(_0x220747);});});}exports['CreateVoiceAgentReport']=function(_0x850b64){var _0x1f70d4=this;return new Promise(function(_0x304c28,_0xade380){return db[_0x87f4('0x16')]['create'](_0x850b64[_0x87f4('0x17')],{'raw':_0x850b64[_0x87f4('0x18')]?_0x850b64[_0x87f4('0x18')][_0x87f4('0x19')]===undefined?!![]:![]:!![]})[_0x87f4('0xd')](function(_0x539502){logger['info'](_0x87f4('0x1a'),_0x850b64);logger[_0x87f4('0x11')](_0x87f4('0x1a'),_0x850b64,JSON['stringify'](_0x539502));_0x304c28(_0x539502);})['catch'](function(_0x6dffa4){logger['error'](_0x87f4('0x1a'),_0x6dffa4[_0x87f4('0x13')],_0x850b64);_0xade380(_0x1f70d4[_0x87f4('0x12')](0x1f4,_0x6dffa4[_0x87f4('0x13')]));});});};exports[_0x87f4('0x1b')]=function(_0x208ee1){var _0x1d1039=this;return new Promise(function(_0xd880de,_0x455c72){return db['VoiceAgentReport']['update'](_0x208ee1[_0x87f4('0x17')],{'raw':_0x208ee1[_0x87f4('0x18')]?_0x208ee1[_0x87f4('0x18')][_0x87f4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x208ee1[_0x87f4('0x18')]?_0x208ee1[_0x87f4('0x18')]['where']||null:null,'attributes':_0x208ee1['options']?_0x208ee1['options'][_0x87f4('0x1c')]||null:null,'limit':_0x208ee1['options']?_0x208ee1['options']['limit']||null:null})[_0x87f4('0xd')](function(_0x5e837d){logger[_0x87f4('0xe')]('UpdateVoiceAgentReport',_0x208ee1);logger[_0x87f4('0x11')]('UpdateVoiceAgentReport',_0x208ee1,JSON[_0x87f4('0x1d')](_0x5e837d));_0xd880de(_0x5e837d);})[_0x87f4('0x15')](function(_0x1242be){logger[_0x87f4('0x12')](_0x87f4('0x1b'),_0x1242be[_0x87f4('0x13')],_0x208ee1);_0x455c72(_0x1d1039[_0x87f4('0x12')](0x1f4,_0x1242be[_0x87f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index eb8ba97..6be33ca 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 _0x5c12=['./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x5c12,0x188));var _0x25c1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5c12[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x25c1('0xc')]);router[_0x25c1('0xb')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);router['post']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller['update']);router[_0x25c1('0x11')](_0x25c1('0xd'),auth['isAuthenticated'](),controller[_0x25c1('0x12')]);module[_0x25c1('0x13')]=router; \ No newline at end of file +var _0xd13e=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x3f558f,_0x338b4c){var _0x4c8cf2=function(_0x98a9f){while(--_0x98a9f){_0x3f558f['push'](_0x3f558f['shift']());}};_0x4c8cf2(++_0x338b4c);}(_0xd13e,0x193));var _0xed13=function(_0x422e01,_0x1e3efb){_0x422e01=_0x422e01-0x0;var _0x37b8c8=_0xd13e[_0x422e01];return _0x37b8c8;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed13('0x8')](_0xed13('0x9'),auth[_0xed13('0xa')](),controller[_0xed13('0xb')]);router[_0xed13('0x8')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0xd')]);router[_0xed13('0xe')]('/',auth['isAuthenticated'](),controller[_0xed13('0xf')]);router[_0xed13('0x10')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x11')]);router['delete'](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x12')]);module[_0xed13('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 dc3bdd5..a597d95 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 _0x13b6=['INTEGER','sequelize','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','DATE'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x13b6,0x97));var _0x613b=function(_0x2147e7,_0x1790f2){_0x2147e7=_0x2147e7-0x0;var _0xf0402e=_0x13b6[_0x2147e7];return _0xf0402e;};'use strict';var Sequelize=require(_0x613b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x613b('0x1')]},'type':{'type':Sequelize[_0x613b('0x2')](_0x613b('0x3'),_0x613b('0x4'),'outbound',_0x613b('0x5'),_0x613b('0x6'),_0x613b('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x613b('0x1')]},'source':{'type':Sequelize[_0x613b('0x1')]},'destination':{'type':Sequelize[_0x613b('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x613b('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x613b('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x613b('0x8')]},'systemanswertime':{'type':Sequelize[_0x613b('0x8')]},'answertime':{'type':Sequelize[_0x613b('0x8')]},'endtime':{'type':Sequelize[_0x613b('0x8')]},'duration':{'type':Sequelize[_0x613b('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x613b('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x613b('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x613b('0x1')]},'note':{'type':Sequelize[_0x613b('0x1')]},'prefix':{'type':Sequelize[_0x613b('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x613b('0x1')]}}; \ No newline at end of file +var _0x066e=['DATE','INTEGER','sequelize','ENUM','inbound','internal','inbound-fax','outbound-fax','STRING','TEXT'];(function(_0xc4c071,_0x2d31de){var _0x2cc680=function(_0x3108d5){while(--_0x3108d5){_0xc4c071['push'](_0xc4c071['shift']());}};_0x2cc680(++_0x2d31de);}(_0x066e,0xca));var _0xe066=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x066e[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0xe066('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe066('0x1')](_0xe066('0x2'),_0xe066('0x3'),'outbound',_0xe066('0x4'),_0xe066('0x5'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe066('0x6')]},'source':{'type':Sequelize[_0xe066('0x6')]},'destination':{'type':Sequelize[_0xe066('0x6')]},'destinationcontext':{'type':Sequelize[_0xe066('0x6')]},'callerid':{'type':Sequelize[_0xe066('0x6')]},'channel':{'type':Sequelize[_0xe066('0x6')]},'destinationchannel':{'type':Sequelize[_0xe066('0x6')]},'lastapplication':{'type':Sequelize[_0xe066('0x6')]},'lastdata':{'type':Sequelize[_0xe066('0x7')]},'starttime':{'type':Sequelize[_0xe066('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe066('0x8')]},'endtime':{'type':Sequelize[_0xe066('0x8')]},'duration':{'type':Sequelize[_0xe066('0x9')]},'billableseconds':{'type':Sequelize[_0xe066('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe066('0x6')]},'amaflags':{'type':Sequelize[_0xe066('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe066('0x6')]},'note':{'type':Sequelize[_0xe066('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e3c9263..e20d0c6 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x3d2ba6,_0x273cbc){var _0x181427=function(_0x54057a){while(--_0x54057a){_0x3d2ba6['push'](_0x3d2ba6['shift']());}};_0x181427(++_0x273cbc);}(_0xdb28,0x106));var _0x8db2=function(_0x3c5add,_0x33a1d6){_0x3c5add=_0x3c5add-0x0;var _0x10c184=_0xdb28[_0x3c5add];return _0x10c184;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index be1f925..8a01b2f 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 _0xbf74=['request-promise','path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','util','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xbf74,0x75));var _0x4bf7=function(_0x3e4b70,_0x471cf3){_0x3e4b70=_0x3e4b70-0x0;var _0x486c81=_0xbf74[_0x3e4b70];return _0x486c81;};'use strict';var _=require('lodash');var util=require(_0x4bf7('0x0'));var logger=require('../../config/logger')(_0x4bf7('0x1'));var moment=require(_0x4bf7('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bf7('0x3'));var fs=require('fs');var path=require(_0x4bf7('0x4'));var rimraf=require(_0x4bf7('0x5'));var config=require('../../config/environment');var attributes=require(_0x4bf7('0x6'));module[_0x4bf7('0x7')]=function(_0x2d332b,_0x20d77b){return _0x2d332b['define'](_0x4bf7('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4bf7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7d0=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xa7d0,0x148));var _0x0a7d=function(_0x2d7e87,_0x6762ec){_0x2d7e87=_0x2d7e87-0x0;var _0x529a0a=_0xa7d0[_0x2d7e87];return _0x529a0a;};'use strict';var _=require(_0x0a7d('0x0'));var util=require(_0x0a7d('0x1'));var logger=require(_0x0a7d('0x2'))(_0x0a7d('0x3'));var moment=require(_0x0a7d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a7d('0x5'));var rimraf=require(_0x0a7d('0x6'));var config=require(_0x0a7d('0x7'));var attributes=require(_0x0a7d('0x8'));module[_0x0a7d('0x9')]=function(_0x15fabd,_0x22c962){return _0x15fabd[_0x0a7d('0xa')](_0x0a7d('0xb'),attributes,{'tableName':_0x0a7d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0a7d('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 fd18444..384892e 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 _0x7862=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7862,0x6a));var _0x2786=function(_0x2d3635,_0x3925f6){_0x2d3635=_0x2d3635-0x0;var _0x3fdd4c=_0x7862[_0x2d3635];return _0x3fdd4c;};'use strict';var _=require(_0x2786('0x0'));var util=require(_0x2786('0x1'));var moment=require(_0x2786('0x2'));var BPromise=require(_0x2786('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2786('0x4'));var db=require(_0x2786('0x5'))['db'];var utils=require(_0x2786('0x6'));var logger=require(_0x2786('0x7'))(_0x2786('0x8'));var config=require(_0x2786('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2786('0xa')][_0x2786('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ee46,_0x50ab73,_0x2db322){return new BPromise(function(_0x18c2d6,_0x21e06e){return client[_0x2786('0xc')](_0x27ee46,_0x2db322)[_0x2786('0xd')](function(_0x56994c){logger[_0x2786('0xe')](_0x2786('0xf'),_0x50ab73,_0x2786('0x10'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x50ab73,_0x2786('0x10'),JSON[_0x2786('0x11')](_0x56994c));if(_0x56994c['error']){if(_0x56994c[_0x2786('0x12')][_0x2786('0x13')]===0x1f4){logger[_0x2786('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x50ab73,_0x56994c['error'][_0x2786('0x14')]);return _0x21e06e(_0x56994c['error'][_0x2786('0x14')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x50ab73,_0x56994c[_0x2786('0x12')]['message']);return _0x18c2d6(_0x56994c[_0x2786('0x12')][_0x2786('0x14')]);}else{logger['info'](_0x2786('0xf'),_0x50ab73,_0x2786('0x10'));_0x18c2d6(_0x56994c[_0x2786('0x15')][_0x2786('0x14')]);}})[_0x2786('0x16')](function(_0x3b2e2a){logger[_0x2786('0x12')](_0x2786('0xf'),_0x50ab73,_0x3b2e2a);_0x21e06e(_0x3b2e2a);});});}exports[_0x2786('0x17')]=function(_0x4bec92){var _0x1028be=this;return new Promise(function(_0x4ac251,_0x2cffa0){return db[_0x2786('0x18')][_0x2786('0x19')]({'raw':_0x4bec92[_0x2786('0x1a')]?_0x4bec92[_0x2786('0x1a')][_0x2786('0x1b')]===undefined?!![]:![]:!![],'where':_0x4bec92[_0x2786('0x1a')]?_0x4bec92[_0x2786('0x1a')][_0x2786('0x1c')]||null:null,'attributes':_0x4bec92[_0x2786('0x1a')]?_0x4bec92[_0x2786('0x1a')][_0x2786('0x1d')]||null:null,'limit':_0x4bec92[_0x2786('0x1a')]?_0x4bec92[_0x2786('0x1a')][_0x2786('0x1e')]||null:null,'include':_0x4bec92[_0x2786('0x1a')]?_0x4bec92[_0x2786('0x1a')][_0x2786('0x1f')]?_[_0x2786('0x20')](_0x4bec92['options'][_0x2786('0x1f')],function(_0x3b3f0e){return{'model':db[_0x3b3f0e['model']],'as':_0x3b3f0e['as'],'attributes':_0x3b3f0e[_0x2786('0x1d')],'include':_0x3b3f0e[_0x2786('0x1f')]?_['map'](_0x3b3f0e[_0x2786('0x1f')],function(_0x246347){return{'model':db[_0x246347[_0x2786('0x21')]],'as':_0x246347['as'],'attributes':_0x246347[_0x2786('0x1d')],'include':_0x246347['include']?_[_0x2786('0x20')](_0x246347[_0x2786('0x1f')],function(_0x458ac9){return{'model':db[_0x458ac9['model']],'as':_0x458ac9['as'],'attributes':_0x458ac9[_0x2786('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7089){logger['info'](_0x2786('0x17'),_0x4bec92);logger[_0x2786('0x22')](_0x2786('0x17'),_0x4bec92,JSON['stringify'](_0x4c7089));_0x4ac251(_0x4c7089);})[_0x2786('0x16')](function(_0x2c8dc8){logger['error']('GetVoiceCallReport',_0x2c8dc8['message'],_0x4bec92);_0x2cffa0(_0x1028be['error'](0x1f4,_0x2c8dc8[_0x2786('0x14')]));});});};exports[_0x2786('0x23')]=function(_0x5ec787){var _0x23f6a0=this;return new Promise(function(_0xd87c65,_0x525b51){return db[_0x2786('0x18')][_0x2786('0x24')](_0x5ec787[_0x2786('0x25')],{'raw':_0x5ec787[_0x2786('0x1a')]?_0x5ec787[_0x2786('0x1a')][_0x2786('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5e18ba){logger[_0x2786('0xe')](_0x2786('0x23'),_0x5ec787);logger[_0x2786('0x22')]('CreateVoiceCallReport',_0x5ec787,JSON[_0x2786('0x11')](_0x5e18ba));_0xd87c65(_0x5e18ba);})['catch'](function(_0x1f6112){logger[_0x2786('0x12')](_0x2786('0x23'),_0x1f6112[_0x2786('0x14')],_0x5ec787);_0x525b51(_0x23f6a0['error'](0x1f4,_0x1f6112[_0x2786('0x14')]));});});};exports[_0x2786('0x26')]=function(_0x2b69ba){var _0x42b2a4=this;return new Promise(function(_0x167955,_0x4da3e6){return db[_0x2786('0x18')][_0x2786('0x27')](_0x2b69ba['body'],{'raw':_0x2b69ba[_0x2786('0x1a')]?_0x2b69ba['options'][_0x2786('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b69ba[_0x2786('0x1a')]?_0x2b69ba[_0x2786('0x1a')][_0x2786('0x1c')]||null:null,'attributes':_0x2b69ba['options']?_0x2b69ba['options'][_0x2786('0x1d')]||null:null,'limit':_0x2b69ba[_0x2786('0x1a')]?_0x2b69ba[_0x2786('0x1a')][_0x2786('0x1e')]||null:null})['then'](function(_0x27e0a5){logger[_0x2786('0xe')](_0x2786('0x26'),_0x2b69ba);logger[_0x2786('0x22')]('UpdateVoiceCallReport',_0x2b69ba,JSON[_0x2786('0x11')](_0x27e0a5));_0x167955(_0x27e0a5);})[_0x2786('0x16')](function(_0x6fcc10){logger[_0x2786('0x12')](_0x2786('0x26'),_0x6fcc10[_0x2786('0x14')],_0x2b69ba);_0x4da3e6(_0x42b2a4[_0x2786('0x12')](0x1f4,_0x6fcc10[_0x2786('0x14')]));});});}; \ No newline at end of file +var _0x7351=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','update','stringify','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1048fc,_0x11ea26){var _0x2cd0d9=function(_0x2e9a94){while(--_0x2e9a94){_0x1048fc['push'](_0x1048fc['shift']());}};_0x2cd0d9(++_0x11ea26);}(_0x7351,0x15b));var _0x1735=function(_0xfc0cd5,_0x253b36){_0xfc0cd5=_0xfc0cd5-0x0;var _0x4402f0=_0x7351[_0xfc0cd5];return _0x4402f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1735('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1735('0x1'));var db=require(_0x1735('0x2'))['db'];var utils=require(_0x1735('0x3'));var logger=require(_0x1735('0x4'))(_0x1735('0x5'));var config=require(_0x1735('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1735('0x7')][_0x1735('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14e25c,_0x1f4f20,_0x2c043d){return new BPromise(function(_0x325c53,_0x5c7b30){return client['request'](_0x14e25c,_0x2c043d)[_0x1735('0x9')](function(_0x2455b9){logger['info'](_0x1735('0xa'),_0x1f4f20,_0x1735('0xb'));logger[_0x1735('0xc')](_0x1735('0xd'),_0x1f4f20,_0x1735('0xb'),JSON['stringify'](_0x2455b9));if(_0x2455b9['error']){if(_0x2455b9[_0x1735('0xe')][_0x1735('0xf')]===0x1f4){logger[_0x1735('0xe')](_0x1735('0xa'),_0x1f4f20,_0x2455b9[_0x1735('0xe')][_0x1735('0x10')]);return _0x5c7b30(_0x2455b9[_0x1735('0xe')][_0x1735('0x10')]);}logger[_0x1735('0xe')](_0x1735('0xa'),_0x1f4f20,_0x2455b9[_0x1735('0xe')][_0x1735('0x10')]);return _0x325c53(_0x2455b9[_0x1735('0xe')][_0x1735('0x10')]);}else{logger[_0x1735('0x11')](_0x1735('0xa'),_0x1f4f20,_0x1735('0xb'));_0x325c53(_0x2455b9[_0x1735('0x12')][_0x1735('0x10')]);}})['catch'](function(_0xfbc428){logger[_0x1735('0xe')](_0x1735('0xa'),_0x1f4f20,_0xfbc428);_0x5c7b30(_0xfbc428);});});}exports['GetVoiceCallReport']=function(_0x34de3d){var _0x562937=this;return new Promise(function(_0x5080fb,_0x1ceee5){return db['VoiceCallReport']['findAll']({'raw':_0x34de3d[_0x1735('0x13')]?_0x34de3d['options'][_0x1735('0x14')]===undefined?!![]:![]:!![],'where':_0x34de3d[_0x1735('0x13')]?_0x34de3d['options'][_0x1735('0x15')]||null:null,'attributes':_0x34de3d[_0x1735('0x13')]?_0x34de3d[_0x1735('0x13')][_0x1735('0x16')]||null:null,'limit':_0x34de3d['options']?_0x34de3d[_0x1735('0x13')][_0x1735('0x17')]||null:null,'include':_0x34de3d[_0x1735('0x13')]?_0x34de3d[_0x1735('0x13')][_0x1735('0x18')]?_[_0x1735('0x19')](_0x34de3d[_0x1735('0x13')][_0x1735('0x18')],function(_0x2cd59c){return{'model':db[_0x2cd59c[_0x1735('0x1a')]],'as':_0x2cd59c['as'],'attributes':_0x2cd59c[_0x1735('0x16')],'include':_0x2cd59c[_0x1735('0x18')]?_[_0x1735('0x19')](_0x2cd59c[_0x1735('0x18')],function(_0x242d37){return{'model':db[_0x242d37[_0x1735('0x1a')]],'as':_0x242d37['as'],'attributes':_0x242d37['attributes'],'include':_0x242d37[_0x1735('0x18')]?_[_0x1735('0x19')](_0x242d37[_0x1735('0x18')],function(_0x4edacf){return{'model':db[_0x4edacf[_0x1735('0x1a')]],'as':_0x4edacf['as'],'attributes':_0x4edacf[_0x1735('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1735('0x9')](function(_0x556ddc){logger[_0x1735('0x11')](_0x1735('0x1b'),_0x34de3d);logger[_0x1735('0xc')](_0x1735('0x1b'),_0x34de3d,JSON['stringify'](_0x556ddc));_0x5080fb(_0x556ddc);})[_0x1735('0x1c')](function(_0x4e08c5){logger['error']('GetVoiceCallReport',_0x4e08c5[_0x1735('0x10')],_0x34de3d);_0x1ceee5(_0x562937['error'](0x1f4,_0x4e08c5[_0x1735('0x10')]));});});};exports[_0x1735('0x1d')]=function(_0x31888f){var _0x4425e4=this;return new Promise(function(_0xac315f,_0x46aeea){return db['VoiceCallReport'][_0x1735('0x1e')](_0x31888f[_0x1735('0x1f')],{'raw':_0x31888f[_0x1735('0x13')]?_0x31888f[_0x1735('0x13')][_0x1735('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x12c4de){logger[_0x1735('0x11')](_0x1735('0x1d'),_0x31888f);logger[_0x1735('0xc')](_0x1735('0x1d'),_0x31888f,JSON['stringify'](_0x12c4de));_0xac315f(_0x12c4de);})[_0x1735('0x1c')](function(_0xc701fb){logger[_0x1735('0xe')](_0x1735('0x1d'),_0xc701fb[_0x1735('0x10')],_0x31888f);_0x46aeea(_0x4425e4[_0x1735('0xe')](0x1f4,_0xc701fb[_0x1735('0x10')]));});});};exports[_0x1735('0x20')]=function(_0x8ee926){var _0x9c97b4=this;return new Promise(function(_0x46899f,_0x2905b9){return db[_0x1735('0x21')][_0x1735('0x22')](_0x8ee926[_0x1735('0x1f')],{'raw':_0x8ee926['options']?_0x8ee926[_0x1735('0x13')][_0x1735('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ee926['options']?_0x8ee926[_0x1735('0x13')][_0x1735('0x15')]||null:null,'attributes':_0x8ee926[_0x1735('0x13')]?_0x8ee926[_0x1735('0x13')]['attributes']||null:null,'limit':_0x8ee926[_0x1735('0x13')]?_0x8ee926[_0x1735('0x13')][_0x1735('0x17')]||null:null})[_0x1735('0x9')](function(_0xfbdbef){logger[_0x1735('0x11')](_0x1735('0x20'),_0x8ee926);logger[_0x1735('0xc')](_0x1735('0x20'),_0x8ee926,JSON[_0x1735('0x23')](_0xfbdbef));_0x46899f(_0xfbdbef);})['catch'](function(_0x2a2833){logger[_0x1735('0xe')](_0x1735('0x20'),_0x2a2833[_0x1735('0x10')],_0x8ee926);_0x2905b9(_0x9c97b4['error'](0x1f4,_0x2a2833[_0x1735('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 49ca4b8..4ea5eea 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 _0xd489=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x348153,_0x178005){var _0x5317b1=function(_0x4ef0ff){while(--_0x4ef0ff){_0x348153['push'](_0x348153['shift']());}};_0x5317b1(++_0x178005);}(_0xd489,0xac));var _0x9d48=function(_0x500aab,_0x384d9e){_0x500aab=_0x500aab-0x0;var _0x2891ab=_0xd489[_0x500aab];return _0x2891ab;};'use strict';var multer=require(_0x9d48('0x0'));var util=require(_0x9d48('0x1'));var path=require(_0x9d48('0x2'));var timeout=require(_0x9d48('0x3'));var express=require(_0x9d48('0x4'));var router=express[_0x9d48('0x5')]();var fs_extra=require(_0x9d48('0x6'));var auth=require(_0x9d48('0x7'));var interaction=require(_0x9d48('0x8'));var config=require(_0x9d48('0x9'));var controller=require(_0x9d48('0xa'));router[_0x9d48('0xb')]('/',auth[_0x9d48('0xc')](),controller[_0x9d48('0xd')]);router['get'](_0x9d48('0xe'),auth[_0x9d48('0xc')](),controller['show']);router[_0x9d48('0xf')]('/',auth[_0x9d48('0xc')](),controller[_0x9d48('0x10')]);router['put']('/:id',auth[_0x9d48('0xc')](),controller[_0x9d48('0x11')]);router['delete'](_0x9d48('0xe'),auth[_0x9d48('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x364e=['put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x364e,0x138));var _0xe364=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x364e[_0x4c440b];return _0x2d48cf;};'use strict';var multer=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var path=require('path');var timeout=require(_0xe364('0x2'));var express=require(_0xe364('0x3'));var router=express[_0xe364('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe364('0x5'));var interaction=require(_0xe364('0x6'));var config=require('../../config/environment');var controller=require(_0xe364('0x7'));router[_0xe364('0x8')]('/',auth[_0xe364('0x9')](),controller[_0xe364('0xa')]);router['get']('/:id',auth[_0xe364('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe364('0xb')]);router[_0xe364('0xc')]('/:id',auth[_0xe364('0x9')](),controller[_0xe364('0xd')]);router[_0xe364('0xe')](_0xe364('0xf'),auth[_0xe364('0x9')](),controller[_0xe364('0x10')]);module[_0xe364('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4fdadfa..fb14aa3 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 _0xdc79=['sequelize','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xdc79,0x198));var _0x9dc7=function(_0x4ad3b9,_0x20414a){_0x4ad3b9=_0x4ad3b9-0x0;var _0x143f6d=_0xdc79[_0x4ad3b9];return _0x143f6d;};'use strict';var Sequelize=require(_0x9dc7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9dc7('0x1')],'unique':_0x9dc7('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9dc7('0x1')],'set':function(_0x3b7e97){this[_0x9dc7('0x3')](_0x9dc7('0x4'),_0x3b7e97?_0x3b7e97['join'](''):[]);},'get':function(){return this[_0x9dc7('0x5')](_0x9dc7('0x4'))?this['getDataValue'](_0x9dc7('0x4'))[_0x9dc7('0x6')](''):[];}},'auth':{'type':Sequelize[_0x9dc7('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x9dc7('0x1')]},'record':{'type':Sequelize[_0x9dc7('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9dc7('0x1')]}}; \ No newline at end of file +var _0x2fc3=['BOOLEAN','STRING','join','getDataValue','options','split'];(function(_0x5a91aa,_0x2f2550){var _0x4350e0=function(_0xe646f7){while(--_0xe646f7){_0x5a91aa['push'](_0x5a91aa['shift']());}};_0x4350e0(++_0x2f2550);}(_0x2fc3,0xe5));var _0x32fc=function(_0x31904e,_0x46c5ab){_0x31904e=_0x31904e-0x0;var _0xd82c28=_0x2fc3[_0x31904e];return _0xd82c28;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32fc('0x0')]},'prefix':{'type':Sequelize[_0x32fc('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x53adc1){this['setDataValue']('options',_0x53adc1?_0x53adc1[_0x32fc('0x1')](''):[]);},'get':function(){return this[_0x32fc('0x2')](_0x32fc('0x3'))?this['getDataValue'](_0x32fc('0x3'))[_0x32fc('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x32fc('0x0')]},'record':{'type':Sequelize[_0x32fc('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x32fc('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 42581a5..8ba84ca 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 _0x1b32=['end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','VoiceChanSpy','findAll','rows','show','params','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1b32,0x85));var _0x21b3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1b32[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){var _0x4412f0=_0x3ee234[_0x21b3('0x26')]({'plain':!![]});var _0x2e3221='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x2e3221,'resourceId':_0x4412f0['id']}})[_0x21b3('0x24')](function(){return _0x3ee234;});})[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x27')]();});}};}function handleEntityNotFound(_0x18eba4,_0x58a356){return function(_0x170e78){if(!_0x170e78){_0x18eba4['sendStatus'](0x194);}return _0x170e78;};}function handleError(_0x16d012,_0x56063c){_0x56063c=_0x56063c||0x1f4;return function(_0x469e42){logger[_0x21b3('0x28')](_0x469e42[_0x21b3('0x29')]);if(_0x469e42['name']){delete _0x469e42[_0x21b3('0x2a')];}_0x16d012[_0x21b3('0x1a')](_0x56063c)[_0x21b3('0x2b')](_0x469e42);};}exports[_0x21b3('0x2c')]=function(_0x34663e,_0x210c49){var _0x2cc056={},_0x4bbec2={},_0x5c3f6f={'count':0x0,'rows':[]};var _0x2053d4=_[_0x21b3('0x2d')](db['VoiceChanSpy'][_0x21b3('0x2e')],function(_0xa04ac7){return{'name':_0xa04ac7[_0x21b3('0x2f')],'type':_0xa04ac7[_0x21b3('0x30')][_0x21b3('0x31')]};});_0x4bbec2[_0x21b3('0x32')]=_[_0x21b3('0x2d')](_0x2053d4,_0x21b3('0x2a'));_0x4bbec2[_0x21b3('0x33')]=_['keys'](_0x34663e['query']);_0x4bbec2[_0x21b3('0x34')]=_['intersection'](_0x4bbec2[_0x21b3('0x32')],_0x4bbec2[_0x21b3('0x33')]);_0x2cc056['attributes']=_[_0x21b3('0x35')](_0x4bbec2[_0x21b3('0x32')],qs[_0x21b3('0x36')](_0x34663e[_0x21b3('0x33')]['fields']));_0x2cc056[_0x21b3('0x37')]=_0x2cc056[_0x21b3('0x37')][_0x21b3('0x38')]?_0x2cc056[_0x21b3('0x37')]:_0x4bbec2['model'];if(!_0x34663e[_0x21b3('0x33')]['hasOwnProperty'](_0x21b3('0x39'))){_0x2cc056[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x34663e[_0x21b3('0x33')][_0x21b3('0x1e')]);_0x2cc056[_0x21b3('0x1c')]=qs[_0x21b3('0x1c')](_0x34663e['query']['offset']);}_0x2cc056[_0x21b3('0x3a')]=qs[_0x21b3('0x3b')](_0x34663e[_0x21b3('0x33')][_0x21b3('0x3b')]);_0x2cc056['where']=qs[_0x21b3('0x34')](_[_0x21b3('0x3c')](_0x34663e[_0x21b3('0x33')],_0x4bbec2[_0x21b3('0x34')]),_0x2053d4);if(_0x34663e[_0x21b3('0x33')][_0x21b3('0x3d')]){_0x2cc056[_0x21b3('0x3e')]=_[_0x21b3('0x3f')](_0x2cc056[_0x21b3('0x3e')],{'$or':_[_0x21b3('0x2d')](_0x2053d4,function(_0x36dd10){if(_0x36dd10['type']!==_0x21b3('0x40')){var _0x321050={};_0x321050[_0x36dd10['name']]={'$like':'%'+_0x34663e[_0x21b3('0x33')]['filter']+'%'};return _0x321050;}})});}_0x2cc056=_[_0x21b3('0x3f')]({},_0x2cc056,_0x34663e[_0x21b3('0x41')]);var _0x483f0c={'where':_0x2cc056['where']};return db['VoiceChanSpy'][_0x21b3('0x1f')](_0x483f0c)[_0x21b3('0x24')](function(_0x3e6501){_0x5c3f6f[_0x21b3('0x1f')]=_0x3e6501;if(_0x34663e['query']['includeAll']){_0x2cc056[_0x21b3('0x42')]=[{'all':!![]}];}return db[_0x21b3('0x43')][_0x21b3('0x44')](_0x2cc056);})[_0x21b3('0x24')](function(_0x306bf2){_0x5c3f6f[_0x21b3('0x45')]=_0x306bf2;return _0x5c3f6f;})[_0x21b3('0x24')](respondWithFilteredResult(_0x210c49,_0x2cc056))['catch'](handleError(_0x210c49,null));};exports[_0x21b3('0x46')]=function(_0x44cf7d,_0x164de9){var _0x282b05={'raw':![],'where':{'id':_0x44cf7d[_0x21b3('0x47')]['id']}},_0x119b43={};_0x119b43['model']=_['keys'](db[_0x21b3('0x43')][_0x21b3('0x2e')]);_0x119b43[_0x21b3('0x33')]=_['keys'](_0x44cf7d[_0x21b3('0x33')]);_0x119b43[_0x21b3('0x34')]=_[_0x21b3('0x35')](_0x119b43[_0x21b3('0x32')],_0x119b43[_0x21b3('0x33')]);_0x282b05[_0x21b3('0x37')]=_['intersection'](_0x119b43[_0x21b3('0x32')],qs[_0x21b3('0x36')](_0x44cf7d[_0x21b3('0x33')]['fields']));_0x282b05['attributes']=_0x282b05['attributes'][_0x21b3('0x38')]?_0x282b05[_0x21b3('0x37')]:_0x119b43[_0x21b3('0x32')];if(_0x44cf7d[_0x21b3('0x33')][_0x21b3('0x48')]){_0x282b05[_0x21b3('0x42')]=[{'all':!![]}];}_0x282b05=_[_0x21b3('0x3f')]({},_0x282b05,_0x44cf7d[_0x21b3('0x41')]);return db[_0x21b3('0x43')]['find'](_0x282b05)['then'](handleEntityNotFound(_0x164de9,null))['then'](respondWithResult(_0x164de9,null))[_0x21b3('0x49')](handleError(_0x164de9,null));};exports[_0x21b3('0x4a')]=function(_0x4046cd,_0x2e4add){return db[_0x21b3('0x43')][_0x21b3('0x4a')](_0x4046cd[_0x21b3('0x4b')],{})[_0x21b3('0x24')](function(_0x3590b0){var _0x46c106=_0x4046cd['user'][_0x21b3('0x26')]({'plain':!![]});if(!_0x46c106)throw new Error(_0x21b3('0x4c'));if(_0x46c106[_0x21b3('0x4d')]===_0x21b3('0x4e')){var _0x34509e=_0x3590b0[_0x21b3('0x26')]({'plain':!![]});var _0xf10700=_0x21b3('0x4f');return db[_0x21b3('0x50')]['find']({'where':{'name':_0xf10700,'userProfileId':_0x46c106[_0x21b3('0x51')]},'raw':!![]})[_0x21b3('0x24')](function(_0x3cfd1e){if(_0x3cfd1e&&_0x3cfd1e[_0x21b3('0x52')]===0x0){return db[_0x21b3('0x53')]['create']({'name':_0x34509e['name'],'resourceId':_0x34509e['id'],'type':_0x3cfd1e[_0x21b3('0x2a')],'sectionId':_0x3cfd1e['id']},{})[_0x21b3('0x24')](function(){return _0x3590b0;});}else{return _0x3590b0;}})[_0x21b3('0x49')](function(_0x1be6d3){logger[_0x21b3('0x28')](_0x21b3('0x54'),_0x1be6d3);throw _0x1be6d3;});}return _0x3590b0;})['then'](respondWithResult(_0x2e4add,0xc9))['catch'](handleError(_0x2e4add,null));};exports[_0x21b3('0x23')]=function(_0xc28070,_0x45eb49){if(_0xc28070[_0x21b3('0x4b')]['id']){delete _0xc28070['body']['id'];}return db[_0x21b3('0x43')]['find']({'where':{'id':_0xc28070[_0x21b3('0x47')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x45eb49,null))['then'](saveUpdates(_0xc28070['body'],null))[_0x21b3('0x24')](respondWithResult(_0x45eb49,null))[_0x21b3('0x49')](handleError(_0x45eb49,null));};exports[_0x21b3('0x25')]=function(_0xd3eb29,_0xc612b5){return db[_0x21b3('0x43')][_0x21b3('0x55')]({'where':{'id':_0xd3eb29['params']['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0xc612b5,null))[_0x21b3('0x24')](removeEntity(_0xc612b5,null))[_0x21b3('0x49')](handleError(_0xc612b5,null));}; \ No newline at end of file +var _0x6364=['sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','send','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3cc740,_0x27dfd9){var _0x3a1d3e=function(_0x351f58){while(--_0x351f58){_0x3cc740['push'](_0x3cc740['shift']());}};_0x3a1d3e(++_0x27dfd9);}(_0x6364,0x8f));var _0x4636=function(_0x2e687b,_0x2b3a40){_0x2e687b=_0x2e687b-0x0;var _0x404282=_0x6364[_0x2e687b];return _0x404282;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4636('0x0'));var jsonpatch=require(_0x4636('0x1'));var rp=require(_0x4636('0x2'));var moment=require(_0x4636('0x3'));var BPromise=require(_0x4636('0x4'));var Mustache=require(_0x4636('0x5'));var util=require(_0x4636('0x6'));var path=require(_0x4636('0x7'));var sox=require('sox');var csv=require(_0x4636('0x8'));var ejs=require(_0x4636('0x9'));var fs=require('fs');var fs_extra=require(_0x4636('0xa'));var _=require(_0x4636('0xb'));var squel=require(_0x4636('0xc'));var crypto=require('crypto');var jsforce=require(_0x4636('0xd'));var deskjs=require(_0x4636('0xe'));var toCsv=require(_0x4636('0x8'));var querystring=require(_0x4636('0xf'));var Papa=require('papaparse');var Redis=require(_0x4636('0x10'));var authService=require(_0x4636('0x11'));var qs=require(_0x4636('0x12'));var as=require(_0x4636('0x13'));var hardwareService=require(_0x4636('0x14'));var logger=require('../../config/logger')(_0x4636('0x15'));var utils=require(_0x4636('0x16'));var config=require(_0x4636('0x17'));var licenseUtil=require(_0x4636('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ee0e,_0xa30deb){_0xa30deb=_0xa30deb||0xcc;return function(_0x26a363){if(_0x26a363){return _0x13ee0e[_0x4636('0x19')](_0xa30deb);}return _0x13ee0e[_0x4636('0x1a')](_0xa30deb)['end']();};}function respondWithResult(_0x5d59c8,_0x1b0436){_0x1b0436=_0x1b0436||0xc8;return function(_0x3eaf7a){if(_0x3eaf7a){return _0x5d59c8[_0x4636('0x1a')](_0x1b0436)[_0x4636('0x1b')](_0x3eaf7a);}};}function respondWithFilteredResult(_0x495fb9,_0x1e432f){return function(_0x2abb29){if(_0x2abb29){var _0x20859a=typeof _0x1e432f[_0x4636('0x1c')]===_0x4636('0x1d')&&typeof _0x1e432f[_0x4636('0x1e')]==='undefined';var _0xc04acf=_0x2abb29[_0x4636('0x1f')];var _0x3362ca=_0x20859a?0x0:_0x1e432f[_0x4636('0x1c')];var _0x5495dc=_0x20859a?_0x2abb29[_0x4636('0x1f')]:_0x1e432f['offset']+_0x1e432f['limit'];var _0x30f410;if(_0x5495dc>=_0xc04acf){_0x5495dc=_0xc04acf;_0x30f410=0xc8;}else{_0x30f410=0xce;}_0x495fb9[_0x4636('0x1a')](_0x30f410);return _0x495fb9['set'](_0x4636('0x20'),_0x3362ca+'-'+_0x5495dc+'/'+_0xc04acf)[_0x4636('0x1b')](_0x2abb29);}return null;};}function patchUpdates(_0x5a014c){return function(_0x34afd3){try{jsonpatch[_0x4636('0x21')](_0x34afd3,_0x5a014c,!![]);}catch(_0x51a2ec){return BPromise[_0x4636('0x22')](_0x51a2ec);}return _0x34afd3[_0x4636('0x23')]();};}function saveUpdates(_0x3dc87e,_0x5ae7c8){return function(_0x441a89){if(_0x441a89){return _0x441a89['update'](_0x3dc87e)[_0x4636('0x24')](function(_0x469027){return _0x469027;});}return null;};}function removeEntity(_0x3cd3d7,_0x9b2338){return function(_0x281223){if(_0x281223){return _0x281223[_0x4636('0x25')]()[_0x4636('0x24')](function(){var _0x428098=_0x281223[_0x4636('0x26')]({'plain':!![]});var _0x3d74d5=_0x4636('0x27');return db[_0x4636('0x28')][_0x4636('0x25')]({'where':{'type':_0x3d74d5,'resourceId':_0x428098['id']}})[_0x4636('0x24')](function(){return _0x281223;});})[_0x4636('0x24')](function(){_0x3cd3d7[_0x4636('0x1a')](0xcc)[_0x4636('0x29')]();});}};}function handleEntityNotFound(_0x3a7f91,_0x2d4df5){return function(_0x378a45){if(!_0x378a45){_0x3a7f91['sendStatus'](0x194);}return _0x378a45;};}function handleError(_0x3f51aa,_0x4bd69a){_0x4bd69a=_0x4bd69a||0x1f4;return function(_0x8dd8cf){logger[_0x4636('0x2a')](_0x8dd8cf[_0x4636('0x2b')]);if(_0x8dd8cf['name']){delete _0x8dd8cf['name'];}_0x3f51aa['status'](_0x4bd69a)[_0x4636('0x2c')](_0x8dd8cf);};}exports['index']=function(_0x4e0bc0,_0x4e893d){var _0x272b59={},_0x5f0260={},_0x5a7701={'count':0x0,'rows':[]};var _0x247551=_['map'](db[_0x4636('0x2d')][_0x4636('0x2e')],function(_0x64a49){return{'name':_0x64a49[_0x4636('0x2f')],'type':_0x64a49[_0x4636('0x30')][_0x4636('0x31')]};});_0x5f0260[_0x4636('0x32')]=_['map'](_0x247551,_0x4636('0x33'));_0x5f0260[_0x4636('0x34')]=_['keys'](_0x4e0bc0[_0x4636('0x34')]);_0x5f0260['filters']=_[_0x4636('0x35')](_0x5f0260[_0x4636('0x32')],_0x5f0260['query']);_0x272b59[_0x4636('0x36')]=_[_0x4636('0x35')](_0x5f0260[_0x4636('0x32')],qs['fields'](_0x4e0bc0[_0x4636('0x34')][_0x4636('0x37')]));_0x272b59[_0x4636('0x36')]=_0x272b59[_0x4636('0x36')][_0x4636('0x38')]?_0x272b59['attributes']:_0x5f0260[_0x4636('0x32')];if(!_0x4e0bc0[_0x4636('0x34')][_0x4636('0x39')]('nolimit')){_0x272b59['limit']=qs[_0x4636('0x1e')](_0x4e0bc0[_0x4636('0x34')]['limit']);_0x272b59[_0x4636('0x1c')]=qs[_0x4636('0x1c')](_0x4e0bc0[_0x4636('0x34')]['offset']);}_0x272b59[_0x4636('0x3a')]=qs['sort'](_0x4e0bc0[_0x4636('0x34')][_0x4636('0x3b')]);_0x272b59[_0x4636('0x3c')]=qs[_0x4636('0x3d')](_[_0x4636('0x3e')](_0x4e0bc0[_0x4636('0x34')],_0x5f0260[_0x4636('0x3d')]),_0x247551);if(_0x4e0bc0[_0x4636('0x34')]['filter']){_0x272b59['where']=_[_0x4636('0x3f')](_0x272b59['where'],{'$or':_[_0x4636('0x40')](_0x247551,function(_0x5f29c0){if(_0x5f29c0[_0x4636('0x30')]!=='VIRTUAL'){var _0x4ade78={};_0x4ade78[_0x5f29c0[_0x4636('0x33')]]={'$like':'%'+_0x4e0bc0[_0x4636('0x34')][_0x4636('0x41')]+'%'};return _0x4ade78;}})});}_0x272b59=_[_0x4636('0x3f')]({},_0x272b59,_0x4e0bc0[_0x4636('0x42')]);var _0x1c2c0b={'where':_0x272b59['where']};return db['VoiceChanSpy'][_0x4636('0x1f')](_0x1c2c0b)[_0x4636('0x24')](function(_0xbf5ef1){_0x5a7701['count']=_0xbf5ef1;if(_0x4e0bc0[_0x4636('0x34')]['includeAll']){_0x272b59[_0x4636('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x4636('0x44')](_0x272b59);})['then'](function(_0x17176c){_0x5a7701[_0x4636('0x45')]=_0x17176c;return _0x5a7701;})[_0x4636('0x24')](respondWithFilteredResult(_0x4e893d,_0x272b59))[_0x4636('0x46')](handleError(_0x4e893d,null));};exports[_0x4636('0x47')]=function(_0x1768fb,_0x573447){var _0x47344a={'raw':![],'where':{'id':_0x1768fb[_0x4636('0x48')]['id']}},_0x34be34={};_0x34be34[_0x4636('0x32')]=_['keys'](db[_0x4636('0x2d')]['rawAttributes']);_0x34be34['query']=_[_0x4636('0x49')](_0x1768fb['query']);_0x34be34[_0x4636('0x3d')]=_[_0x4636('0x35')](_0x34be34[_0x4636('0x32')],_0x34be34[_0x4636('0x34')]);_0x47344a['attributes']=_[_0x4636('0x35')](_0x34be34[_0x4636('0x32')],qs[_0x4636('0x37')](_0x1768fb[_0x4636('0x34')]['fields']));_0x47344a[_0x4636('0x36')]=_0x47344a[_0x4636('0x36')][_0x4636('0x38')]?_0x47344a[_0x4636('0x36')]:_0x34be34['model'];if(_0x1768fb[_0x4636('0x34')][_0x4636('0x4a')]){_0x47344a[_0x4636('0x43')]=[{'all':!![]}];}_0x47344a=_[_0x4636('0x3f')]({},_0x47344a,_0x1768fb['options']);return db[_0x4636('0x2d')][_0x4636('0x4b')](_0x47344a)[_0x4636('0x24')](handleEntityNotFound(_0x573447,null))['then'](respondWithResult(_0x573447,null))[_0x4636('0x46')](handleError(_0x573447,null));};exports[_0x4636('0x4c')]=function(_0x29acb1,_0x193bc8){return db[_0x4636('0x2d')][_0x4636('0x4c')](_0x29acb1[_0x4636('0x4d')],{})[_0x4636('0x24')](function(_0x3d979e){var _0x865cf0=_0x29acb1[_0x4636('0x4e')][_0x4636('0x26')]({'plain':!![]});if(!_0x865cf0)throw new Error(_0x4636('0x4f'));if(_0x865cf0[_0x4636('0x50')]===_0x4636('0x4e')){var _0x1864d0=_0x3d979e[_0x4636('0x26')]({'plain':!![]});var _0x18f28a=_0x4636('0x27');return db[_0x4636('0x51')][_0x4636('0x4b')]({'where':{'name':_0x18f28a,'userProfileId':_0x865cf0[_0x4636('0x52')]},'raw':!![]})[_0x4636('0x24')](function(_0x50bd5d){if(_0x50bd5d&&_0x50bd5d[_0x4636('0x53')]===0x0){return db['UserProfileResource'][_0x4636('0x4c')]({'name':_0x1864d0['name'],'resourceId':_0x1864d0['id'],'type':_0x50bd5d[_0x4636('0x33')],'sectionId':_0x50bd5d['id']},{})[_0x4636('0x24')](function(){return _0x3d979e;});}else{return _0x3d979e;}})[_0x4636('0x46')](function(_0x65cf2){logger[_0x4636('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x65cf2);throw _0x65cf2;});}return _0x3d979e;})[_0x4636('0x24')](respondWithResult(_0x193bc8,0xc9))[_0x4636('0x46')](handleError(_0x193bc8,null));};exports['update']=function(_0x2cfc5e,_0x237ff9){if(_0x2cfc5e['body']['id']){delete _0x2cfc5e[_0x4636('0x4d')]['id'];}return db[_0x4636('0x2d')][_0x4636('0x4b')]({'where':{'id':_0x2cfc5e[_0x4636('0x48')]['id']}})[_0x4636('0x24')](handleEntityNotFound(_0x237ff9,null))['then'](saveUpdates(_0x2cfc5e['body'],null))[_0x4636('0x24')](respondWithResult(_0x237ff9,null))[_0x4636('0x46')](handleError(_0x237ff9,null));};exports[_0x4636('0x25')]=function(_0x30c2ac,_0x14ee0e){return db['VoiceChanSpy'][_0x4636('0x4b')]({'where':{'id':_0x30c2ac[_0x4636('0x48')]['id']}})[_0x4636('0x24')](handleEntityNotFound(_0x14ee0e,null))['then'](removeEntity(_0x14ee0e,null))[_0x4636('0x46')](handleError(_0x14ee0e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4bd1eee..e7eb6be 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 _0x063b=['ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','internal','User','findAll','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate'];(function(_0xf06a12,_0xc201a3){var _0x113577=function(_0x42d924){while(--_0x42d924){_0xf06a12['push'](_0xf06a12['shift']());}};_0x113577(++_0xc201a3);}(_0x063b,0x1cf));var _0xb063=function(_0x3a8e9a,_0x3b009f){_0x3a8e9a=_0x3a8e9a-0x0;var _0x273063=_0x063b[_0x3a8e9a];return _0x273063;};'use strict';var _=require(_0xb063('0x0'));var util=require('util');var BPromise=require(_0xb063('0x1'));var attributes=require(_0xb063('0x2'));var getUserApplications=function(_0x1d05a2,_0x22e188,_0x5c6e2e){var _0x4bb6e0=0x1;var _0x9a8a4e=[];var _0x43fc79={'context':_0x22e188[_0xb063('0x3')]||_0xb063('0x4'),'exten':util[_0xb063('0x5')](_0xb063('0x6'),_0x1d05a2[_0xb063('0x7')],_0x5c6e2e),'type':_0xb063('0x8'),'isApp':![],'ChanSpyId':_0x1d05a2['id'],'UserId':_0x22e188['id']};_0x9a8a4e[_0xb063('0x9')](_[_0xb063('0xa')]({'app':_0xb063('0xb'),'appdata':util[_0xb063('0x5')](_0xb063('0xc'),_0xb063('0xd')),'priority':_0x4bb6e0++},_0x43fc79));if(_0x1d05a2['record']){_0x9a8a4e[_0xb063('0x9')](_['merge']({'app':'MixMonitor','appdata':util[_0xb063('0x5')](_0xb063('0xe'),_0x1d05a2[_0xb063('0xf')]),'priority':_0x4bb6e0++},_0x43fc79));}if(_0x1d05a2[_0xb063('0x10')]){_0x9a8a4e[_0xb063('0x9')](_[_0xb063('0xa')]({'app':_0xb063('0x11'),'appdata':_0x1d05a2['password'],'priority':_0x4bb6e0++},_0x43fc79));}_0x9a8a4e[_0xb063('0x9')](_[_0xb063('0xa')]({'app':_0xb063('0x12'),'appdata':util[_0xb063('0x5')](_0xb063('0x13'),_0x22e188[_0xb063('0x14')],_0x1d05a2[_0xb063('0x15')]?_0x1d05a2[_0xb063('0x15')]['join'](''):''),'priority':_0x4bb6e0++},_0x43fc79));if(_0x1d05a2[_0xb063('0x16')]){_0x9a8a4e['push'](_[_0xb063('0xa')]({'app':_0xb063('0x17'),'priority':_0x4bb6e0++},_0x43fc79));}return _0x9a8a4e;};var getChanSpyApplications=function(_0x3a5437,_0x50df63){var _0x4d7939=[];for(var _0x4ebec5=0x0,_0x5b2ab4=0x1;_0x4ebec5<_0x50df63[_0xb063('0x18')];_0x4ebec5++,_0x5b2ab4=0x1){_0x4d7939=_0x4d7939['concat'](getUserApplications(_0x3a5437,_0x50df63[_0x4ebec5],_0x50df63[_0x4ebec5][_0xb063('0x19')]));if(_0x50df63[_0x4ebec5][_0xb063('0x19')]!=_0x50df63[_0x4ebec5]['name']){_0x4d7939=_0x4d7939['concat'](getUserApplications(_0x3a5437,_0x50df63[_0x4ebec5],_0x50df63[_0x4ebec5]['name']));}}return _0x4d7939;};var getChanSpyPromise=function(_0x5bac13,_0x5308a1){return new BPromise(function(_0x3f0a2a,_0x2f9d2c){return _0x5bac13[_0xb063('0x1a')][_0xb063('0x1b')]({'attributes':['id',_0xb063('0x14'),_0xb063('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb063('0x1c')](function(_0x510889){if(_0x510889){return _0x3f0a2a(getChanSpyApplications(_0x5308a1,_0x510889));}return _0x3f0a2a([]);})[_0xb063('0x1d')](function(_0x484e2f){_0x2f9d2c(_0x484e2f);});});};module['exports']=function(_0x435745,_0x2ced09){var _0x53eb8b=_0x435745[_0xb063('0x1e')];return _0x435745[_0xb063('0x1f')](_0xb063('0x20'),attributes,{'tableName':_0xb063('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd5d2,_0x19554d,_0x501b8b){return getChanSpyPromise(_0x53eb8b,_0x3dd5d2)[_0xb063('0x1c')](function(_0xb3a09d){if(_0xb3a09d&&_0xb3a09d[_0xb063('0x18')]){return _0x53eb8b[_0xb063('0x22')]['bulkCreate'](_0xb3a09d);}})[_0xb063('0x1c')](function(){_0x501b8b();})[_0xb063('0x1d')](function(_0x4204ce){_0x501b8b(_0x4204ce);});},'afterUpdate':function(_0x401419,_0x5a42da,_0x1582ed){return _0x53eb8b[_0xb063('0x22')][_0xb063('0x23')]({'where':{'ChanSpyId':_0x401419['id']}})[_0xb063('0x1c')](function(){return getChanSpyPromise(_0x53eb8b,_0x401419);})[_0xb063('0x1c')](function(_0x16723e){if(_0x16723e&&_0x16723e[_0xb063('0x18')]){return _0x53eb8b['VoiceExtension'][_0xb063('0x24')](_0x16723e);}})[_0xb063('0x1c')](function(){_0x1582ed();})[_0xb063('0x1d')](function(_0x5885b5){_0x1582ed(_0x5885b5);});},'afterDestroy':function(_0x173c4b,_0x112375,_0x40f7a7){return _0x53eb8b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x173c4b['id']}})[_0xb063('0x1c')](function(){_0x40f7a7();})[_0xb063('0x1d')](function(_0x45582d){_0x40f7a7(_0x45582d);});}}});}; \ No newline at end of file +var _0x075a=['system','merge','Set','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','User','findAll','catch','exports','models','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0xbed308,_0x3528d0){var _0x5123fc=function(_0x44844b){while(--_0x44844b){_0xbed308['push'](_0xbed308['shift']());}};_0x5123fc(++_0x3528d0);}(_0x075a,0x17d));var _0xa075=function(_0x2f1272,_0x399984){_0x2f1272=_0x2f1272-0x0;var _0x87ad25=_0x075a[_0x2f1272];return _0x87ad25;};'use strict';var _=require(_0xa075('0x0'));var util=require(_0xa075('0x1'));var BPromise=require(_0xa075('0x2'));var attributes=require(_0xa075('0x3'));var getUserApplications=function(_0xcd9dbc,_0x1a0c63,_0x3915f8){var _0x5af5ee=0x1;var _0x21c9b0=[];var _0x348954={'context':_0x1a0c63[_0xa075('0x4')]||_0xa075('0x5'),'exten':util[_0xa075('0x6')](_0xa075('0x7'),_0xcd9dbc[_0xa075('0x8')],_0x3915f8),'type':_0xa075('0x9'),'isApp':![],'ChanSpyId':_0xcd9dbc['id'],'UserId':_0x1a0c63['id']};_0x21c9b0['push'](_[_0xa075('0xa')]({'app':_0xa075('0xb'),'appdata':util[_0xa075('0x6')]('CDR(type)=%s',_0xa075('0xc')),'priority':_0x5af5ee++},_0x348954));if(_0xcd9dbc[_0xa075('0xd')]){_0x21c9b0[_0xa075('0xe')](_['merge']({'app':_0xa075('0xf'),'appdata':util[_0xa075('0x6')](_0xa075('0x10'),_0xcd9dbc['recordingFormat']),'priority':_0x5af5ee++},_0x348954));}if(_0xcd9dbc[_0xa075('0x11')]){_0x21c9b0[_0xa075('0xe')](_[_0xa075('0xa')]({'app':_0xa075('0x12'),'appdata':_0xcd9dbc[_0xa075('0x13')],'priority':_0x5af5ee++},_0x348954));}_0x21c9b0[_0xa075('0xe')](_[_0xa075('0xa')]({'app':_0xa075('0x14'),'appdata':util[_0xa075('0x6')](_0xa075('0x15'),_0x1a0c63[_0xa075('0x16')],_0xcd9dbc[_0xa075('0x17')]?_0xcd9dbc[_0xa075('0x17')][_0xa075('0x18')](''):''),'priority':_0x5af5ee++},_0x348954));if(_0xcd9dbc['record']){_0x21c9b0[_0xa075('0xe')](_[_0xa075('0xa')]({'app':_0xa075('0x19'),'priority':_0x5af5ee++},_0x348954));}return _0x21c9b0;};var getChanSpyApplications=function(_0x1f1c65,_0x482981){var _0x78f76a=[];for(var _0x2d3fdc=0x0,_0x55addb=0x1;_0x2d3fdc<_0x482981[_0xa075('0x1a')];_0x2d3fdc++,_0x55addb=0x1){_0x78f76a=_0x78f76a['concat'](getUserApplications(_0x1f1c65,_0x482981[_0x2d3fdc],_0x482981[_0x2d3fdc][_0xa075('0x1b')]));if(_0x482981[_0x2d3fdc][_0xa075('0x1b')]!=_0x482981[_0x2d3fdc]['name']){_0x78f76a=_0x78f76a['concat'](getUserApplications(_0x1f1c65,_0x482981[_0x2d3fdc],_0x482981[_0x2d3fdc]['name']));}}return _0x78f76a;};var getChanSpyPromise=function(_0x29a7bd,_0x26c61c){return new BPromise(function(_0x1e4402,_0x94847d){return _0x29a7bd[_0xa075('0x1c')][_0xa075('0x1d')]({'attributes':['id','name',_0xa075('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x4c3e3e){if(_0x4c3e3e){return _0x1e4402(getChanSpyApplications(_0x26c61c,_0x4c3e3e));}return _0x1e4402([]);})[_0xa075('0x1e')](function(_0xf7855){_0x94847d(_0xf7855);});});};module[_0xa075('0x1f')]=function(_0x5ee620,_0xe9f750){var _0x5b8424=_0x5ee620[_0xa075('0x20')];return _0x5ee620[_0xa075('0x21')](_0xa075('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b2b4c,_0x51d9ba,_0x512c19){return getChanSpyPromise(_0x5b8424,_0x4b2b4c)[_0xa075('0x23')](function(_0x3cccef){if(_0x3cccef&&_0x3cccef[_0xa075('0x1a')]){return _0x5b8424[_0xa075('0x24')][_0xa075('0x25')](_0x3cccef);}})[_0xa075('0x23')](function(){_0x512c19();})[_0xa075('0x1e')](function(_0x2b9e05){_0x512c19(_0x2b9e05);});},'afterUpdate':function(_0x169eb7,_0x3b91be,_0x4e5419){return _0x5b8424[_0xa075('0x24')][_0xa075('0x26')]({'where':{'ChanSpyId':_0x169eb7['id']}})[_0xa075('0x23')](function(){return getChanSpyPromise(_0x5b8424,_0x169eb7);})['then'](function(_0x48c064){if(_0x48c064&&_0x48c064['length']){return _0x5b8424[_0xa075('0x24')][_0xa075('0x25')](_0x48c064);}})[_0xa075('0x23')](function(){_0x4e5419();})[_0xa075('0x1e')](function(_0x245aed){_0x4e5419(_0x245aed);});},'afterDestroy':function(_0x55275d,_0x2ef599,_0x1cf847){return _0x5b8424[_0xa075('0x24')]['destroy']({'where':{'ChanSpyId':_0x55275d['id']}})['then'](function(){_0x1cf847();})['catch'](function(_0x357e8c){_0x1cf847(_0x357e8c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4ada7c5..e1b7e32 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(_0x11fcc2,_0x332c30){var _0xc9af50=function(_0x489d37){while(--_0x489d37){_0x11fcc2['push'](_0x11fcc2['shift']());}};_0xc9af50(++_0x332c30);}(_0x593e,0xcb));var _0xe593=function(_0x31663c,_0x8d8121){_0x31663c=_0x31663c-0x0;var _0x5a2b35=_0x593e[_0x31663c];return _0x5a2b35;};'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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','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','code','message','result','catch','lodash','util'];(function(_0x2f3103,_0x34ed85){var _0x58a697=function(_0x1d46a8){while(--_0x1d46a8){_0x2f3103['push'](_0x2f3103['shift']());}};_0x58a697(++_0x34ed85);}(_0x668b,0x140));var _0xb668=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x668b[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 108b01f..6fe4abf 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 _0x3632=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','util'];(function(_0x5651ef,_0x4fd99a){var _0x392fba=function(_0x14c7dd){while(--_0x14c7dd){_0x5651ef['push'](_0x5651ef['shift']());}};_0x392fba(++_0x4fd99a);}(_0x3632,0x168));var _0x2363=function(_0x2394c8,_0x1ad759){_0x2394c8=_0x2394c8-0x0;var _0x3a401a=_0x3632[_0x2394c8];return _0x3a401a;};'use strict';var multer=require('multer');var util=require(_0x2363('0x0'));var path=require(_0x2363('0x1'));var timeout=require(_0x2363('0x2'));var express=require('express');var router=express[_0x2363('0x3')]();var fs_extra=require(_0x2363('0x4'));var auth=require(_0x2363('0x5'));var interaction=require(_0x2363('0x6'));var config=require(_0x2363('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x2363('0x8')](),controller[_0x2363('0x9')]);router[_0x2363('0xa')](_0x2363('0xb'),auth[_0x2363('0x8')](),controller[_0x2363('0xc')]);router[_0x2363('0xd')]('/',auth['isAuthenticated'](),controller[_0x2363('0xe')]);router[_0x2363('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2363('0x10')]);router['delete'](_0x2363('0xb'),auth[_0x2363('0x8')](),controller[_0x2363('0x11')]);module[_0x2363('0x12')]=router; \ No newline at end of file +var _0xc513=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','delete','destroy','multer','path','express','Router'];(function(_0x565dff,_0x1c2a7c){var _0x12ca3c=function(_0x3bcb13){while(--_0x3bcb13){_0x565dff['push'](_0x565dff['shift']());}};_0x12ca3c(++_0x1c2a7c);}(_0xc513,0xb2));var _0x3c51=function(_0x27bd5f,_0x38b38a){_0x27bd5f=_0x27bd5f-0x0;var _0x2b8963=_0xc513[_0x27bd5f];return _0x2b8963;};'use strict';var multer=require(_0x3c51('0x0'));var util=require('util');var path=require(_0x3c51('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c51('0x2'));var router=express[_0x3c51('0x3')]();var fs_extra=require(_0x3c51('0x4'));var auth=require(_0x3c51('0x5'));var interaction=require(_0x3c51('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x3c51('0x7')]('/',auth[_0x3c51('0x8')](),controller['index']);router['get'](_0x3c51('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3c51('0xa')]('/',auth[_0x3c51('0x8')](),controller[_0x3c51('0xb')]);router['put']('/:id',auth[_0x3c51('0x8')](),controller['update']);router[_0x3c51('0xc')]('/:id',auth[_0x3c51('0x8')](),controller[_0x3c51('0xd')]);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 6929c46..7cfc036 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 _0x5cbb=['exports','STRING','sequelize'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x5cbb,0x1a3));var _0xb5cb=function(_0x2db068,_0x39132e){_0x2db068=_0x2db068-0x0;var _0x119c41=_0x5cbb[_0x2db068];return _0x119c41;};'use strict';var Sequelize=require(_0xb5cb('0x0'));module[_0xb5cb('0x1')]={'name':{'type':Sequelize[_0xb5cb('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb5cb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb5e=['STRING','exports'];(function(_0x733e23,_0x322d5b){var _0x8eb5f7=function(_0x3090ae){while(--_0x3090ae){_0x733e23['push'](_0x733e23['shift']());}};_0x8eb5f7(++_0x322d5b);}(_0xfb5e,0x89));var _0xefb5=function(_0x5dac46,_0x28e9dc){_0x5dac46=_0x5dac46-0x0;var _0x51095c=_0xfb5e[_0x5dac46];return _0x51095c;};'use strict';var Sequelize=require('sequelize');module[_0xefb5('0x0')]={'name':{'type':Sequelize[_0xefb5('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xefb5('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 58c6f2d..cb7063f 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 _0x865e=['readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','writeFileSync','chan_sip.so','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','type','filter','includeAll','findAll','rows','show','params','include','options','find','catch','create'];(function(_0xf91c38,_0x2b40e4){var _0x37b55d=function(_0x4ab40f){while(--_0x4ab40f){_0xf91c38['push'](_0xf91c38['shift']());}};_0x37b55d(++_0x2b40e4);}(_0x865e,0x147));var _0xe865=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x865e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xe865('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe865('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe865('0x2'));var moment=require(_0xe865('0x3'));var BPromise=require(_0xe865('0x4'));var Mustache=require(_0xe865('0x5'));var util=require(_0xe865('0x6'));var path=require(_0xe865('0x7'));var sox=require('sox');var csv=require(_0xe865('0x8'));var ejs=require(_0xe865('0x9'));var fs=require('fs');var fs_extra=require(_0xe865('0xa'));var _=require(_0xe865('0xb'));var squel=require(_0xe865('0xc'));var crypto=require(_0xe865('0xd'));var jsforce=require(_0xe865('0xe'));var deskjs=require(_0xe865('0xf'));var toCsv=require(_0xe865('0x8'));var querystring=require(_0xe865('0x10'));var Papa=require(_0xe865('0x11'));var Redis=require(_0xe865('0x12'));var authService=require(_0xe865('0x13'));var qs=require(_0xe865('0x14'));var as=require(_0xe865('0x15'));var hardwareService=require(_0xe865('0x16'));var logger=require(_0xe865('0x17'))('api');var utils=require(_0xe865('0x18'));var config=require(_0xe865('0x19'));var licenseUtil=require(_0xe865('0x1a'));var db=require(_0xe865('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe865('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x523aec,_0x54e41f,_0x2d38d3,_0x1d913d){return new BPromise(function(_0x4e32f3,_0x18d937){var _0x515d0d=_0x1d913d||client;return _0x515d0d[_0xe865('0x1d')](_0x523aec,_0x2d38d3)['then'](function(_0x3067a5){logger['info'](_0xe865('0x1e'),_0x54e41f,_0xe865('0x1f'));logger[_0xe865('0x20')](_0xe865('0x21'),_0x54e41f,_0xe865('0x1f'),JSON['stringify'](_0x3067a5));if(_0x3067a5[_0xe865('0x22')]){if(_0x3067a5[_0xe865('0x22')]['code']===0x1f4){logger[_0xe865('0x22')]('VoiceContext,\x20%s,\x20%s',_0x54e41f,_0x3067a5[_0xe865('0x22')][_0xe865('0x23')]);return _0x18d937(_0x3067a5[_0xe865('0x22')][_0xe865('0x23')]);}logger[_0xe865('0x22')](_0xe865('0x1e'),_0x54e41f,_0x3067a5[_0xe865('0x22')][_0xe865('0x23')]);return _0x4e32f3(_0x3067a5[_0xe865('0x22')][_0xe865('0x23')]);}else{logger['info'](_0xe865('0x1e'),_0x54e41f,'request\x20sent');_0x4e32f3(_0x3067a5[_0xe865('0x24')][_0xe865('0x23')]);}})['catch'](function(_0x59984d){logger[_0xe865('0x22')](_0xe865('0x1e'),_0x54e41f,_0x59984d);_0x18d937(_0x59984d);});});}function respondWithStatusCode(_0x309937,_0x54d009){_0x54d009=_0x54d009||0xcc;return function(_0x4cc140){if(_0x4cc140){return _0x309937[_0xe865('0x25')](_0x54d009);}return _0x309937['status'](_0x54d009)[_0xe865('0x26')]();};}function respondWithResult(_0x20709c,_0x385a83){_0x385a83=_0x385a83||0xc8;return function(_0x3d4600){if(_0x3d4600){return _0x20709c[_0xe865('0x27')](_0x385a83)[_0xe865('0x28')](_0x3d4600);}};}function respondWithFilteredResult(_0xafdf21,_0x391f55){return function(_0x1b56f0){if(_0x1b56f0){var _0x156bee=typeof _0x391f55[_0xe865('0x29')]===_0xe865('0x2a')&&typeof _0x391f55[_0xe865('0x2b')]===_0xe865('0x2a');var _0x1a5b6b=_0x1b56f0[_0xe865('0x2c')];var _0x4a42c1=_0x156bee?0x0:_0x391f55['offset'];var _0x4f7620=_0x156bee?_0x1b56f0[_0xe865('0x2c')]:_0x391f55[_0xe865('0x29')]+_0x391f55[_0xe865('0x2b')];var _0x56ddcb;if(_0x4f7620>=_0x1a5b6b){_0x4f7620=_0x1a5b6b;_0x56ddcb=0xc8;}else{_0x56ddcb=0xce;}_0xafdf21[_0xe865('0x27')](_0x56ddcb);return _0xafdf21[_0xe865('0x2d')]('Content-Range',_0x4a42c1+'-'+_0x4f7620+'/'+_0x1a5b6b)[_0xe865('0x28')](_0x1b56f0);}return null;};}function patchUpdates(_0x1c4fc6){return function(_0x338e6f){try{jsonpatch[_0xe865('0x2e')](_0x338e6f,_0x1c4fc6,!![]);}catch(_0x2ab6ce){return BPromise[_0xe865('0x2f')](_0x2ab6ce);}return _0x338e6f['save']();};}function saveUpdates(_0x521d39,_0x9257e8){return function(_0x5cb0f6){if(_0x5cb0f6){return _0x5cb0f6[_0xe865('0x30')](_0x521d39)[_0xe865('0x31')](function(_0xbc3a94){return _0xbc3a94;});}return null;};}function removeEntity(_0x1563ab,_0x2c600c){return function(_0x4ff994){if(_0x4ff994){return _0x4ff994[_0xe865('0x32')]()[_0xe865('0x31')](function(){var _0x4bddd0=_0x4ff994['get']({'plain':!![]});var _0x4387a8=_0xe865('0x33');return db[_0xe865('0x34')][_0xe865('0x32')]({'where':{'type':_0x4387a8,'resourceId':_0x4bddd0['id']}})[_0xe865('0x31')](function(){return _0x4ff994;});})[_0xe865('0x31')](function(){_0x1563ab['status'](0xcc)[_0xe865('0x26')]();});}};}function handleEntityNotFound(_0x1d4cc1,_0x21a20c){return function(_0x5ffc65){if(!_0x5ffc65){_0x1d4cc1[_0xe865('0x25')](0x194);}return _0x5ffc65;};}function handleError(_0x1a969e,_0x595687){_0x595687=_0x595687||0x1f4;return function(_0x2c823e){logger[_0xe865('0x22')](_0x2c823e[_0xe865('0x35')]);if(_0x2c823e['name']){delete _0x2c823e[_0xe865('0x36')];}_0x1a969e['status'](_0x595687)[_0xe865('0x37')](_0x2c823e);};}exports[_0xe865('0x38')]=function(_0x161bb7,_0x5c3e11){var _0x4cf685={},_0xfe55a6={},_0x11b54a={'count':0x0,'rows':[]};var _0x4a16f7=_[_0xe865('0x39')](db[_0xe865('0x3a')][_0xe865('0x3b')],function(_0x5ddd10){return{'name':_0x5ddd10['fieldName'],'type':_0x5ddd10['type']['key']};});_0xfe55a6[_0xe865('0x3c')]=_['map'](_0x4a16f7,_0xe865('0x36'));_0xfe55a6['query']=_[_0xe865('0x3d')](_0x161bb7[_0xe865('0x3e')]);_0xfe55a6['filters']=_[_0xe865('0x3f')](_0xfe55a6[_0xe865('0x3c')],_0xfe55a6[_0xe865('0x3e')]);_0x4cf685[_0xe865('0x40')]=_['intersection'](_0xfe55a6[_0xe865('0x3c')],qs['fields'](_0x161bb7[_0xe865('0x3e')][_0xe865('0x41')]));_0x4cf685[_0xe865('0x40')]=_0x4cf685[_0xe865('0x40')][_0xe865('0x42')]?_0x4cf685[_0xe865('0x40')]:_0xfe55a6['model'];if(!_0x161bb7[_0xe865('0x3e')]['hasOwnProperty']('nolimit')){_0x4cf685[_0xe865('0x2b')]=qs[_0xe865('0x2b')](_0x161bb7[_0xe865('0x3e')]['limit']);_0x4cf685[_0xe865('0x29')]=qs['offset'](_0x161bb7[_0xe865('0x3e')][_0xe865('0x29')]);}_0x4cf685[_0xe865('0x43')]=qs[_0xe865('0x44')](_0x161bb7[_0xe865('0x3e')][_0xe865('0x44')]);_0x4cf685[_0xe865('0x45')]=qs[_0xe865('0x46')](_[_0xe865('0x47')](_0x161bb7['query'],_0xfe55a6[_0xe865('0x46')]),_0x4a16f7);if(_0x161bb7[_0xe865('0x3e')]['filter']){_0x4cf685[_0xe865('0x45')]=_[_0xe865('0x48')](_0x4cf685[_0xe865('0x45')],{'$or':_['map'](_0x4a16f7,function(_0x16b91d){if(_0x16b91d[_0xe865('0x49')]!=='VIRTUAL'){var _0x548683={};_0x548683[_0x16b91d['name']]={'$like':'%'+_0x161bb7[_0xe865('0x3e')][_0xe865('0x4a')]+'%'};return _0x548683;}})});}_0x4cf685=_['merge']({},_0x4cf685,_0x161bb7['options']);var _0x34bff2={'where':_0x4cf685['where']};return db[_0xe865('0x3a')][_0xe865('0x2c')](_0x34bff2)['then'](function(_0x718331){_0x11b54a[_0xe865('0x2c')]=_0x718331;if(_0x161bb7[_0xe865('0x3e')][_0xe865('0x4b')]){_0x4cf685['include']=[{'all':!![]}];}return db[_0xe865('0x3a')][_0xe865('0x4c')](_0x4cf685);})[_0xe865('0x31')](function(_0x4280c6){_0x11b54a[_0xe865('0x4d')]=_0x4280c6;return _0x11b54a;})['then'](respondWithFilteredResult(_0x5c3e11,_0x4cf685))['catch'](handleError(_0x5c3e11,null));};exports[_0xe865('0x4e')]=function(_0x34f1ba,_0x58691e){var _0x559006={'raw':![],'where':{'id':_0x34f1ba[_0xe865('0x4f')]['id']}},_0x332dbe={};_0x332dbe[_0xe865('0x3c')]=_[_0xe865('0x3d')](db[_0xe865('0x3a')][_0xe865('0x3b')]);_0x332dbe['query']=_[_0xe865('0x3d')](_0x34f1ba[_0xe865('0x3e')]);_0x332dbe[_0xe865('0x46')]=_[_0xe865('0x3f')](_0x332dbe['model'],_0x332dbe[_0xe865('0x3e')]);_0x559006[_0xe865('0x40')]=_[_0xe865('0x3f')](_0x332dbe[_0xe865('0x3c')],qs[_0xe865('0x41')](_0x34f1ba[_0xe865('0x3e')][_0xe865('0x41')]));_0x559006[_0xe865('0x40')]=_0x559006[_0xe865('0x40')][_0xe865('0x42')]?_0x559006[_0xe865('0x40')]:_0x332dbe['model'];if(_0x34f1ba[_0xe865('0x3e')][_0xe865('0x4b')]){_0x559006[_0xe865('0x50')]=[{'all':!![]}];}_0x559006=_[_0xe865('0x48')]({},_0x559006,_0x34f1ba[_0xe865('0x51')]);return db['VoiceContext'][_0xe865('0x52')](_0x559006)[_0xe865('0x31')](handleEntityNotFound(_0x58691e,null))[_0xe865('0x31')](respondWithResult(_0x58691e,null))[_0xe865('0x53')](handleError(_0x58691e,null));};exports['create']=function(_0x2ab798,_0x1a6fe0,_0x411cb1){var _0x5d4fd8;return db[_0xe865('0x3a')][_0xe865('0x54')](_0x2ab798['body'],{'raw':!![]})['then'](function(_0xfb29d8){_0x5d4fd8=_0xfb29d8;return db[_0xe865('0x3a')][_0xe865('0x4c')]({'raw':!![]});})[_0xe865('0x31')](function(_0x226409){var _0x1f5c21=fs[_0xe865('0x55')](path[_0xe865('0x56')](config[_0xe865('0x57')],_0xe865('0x58')),_0xe865('0x59'));var _0x4b8017=ejs[_0xe865('0x5a')](_0x1f5c21,{'contexts':_0x226409||[]});fs['writeFileSync'](_0xe865('0x5b'),_0x4b8017);})[_0xe865('0x31')](function(){return respondWithRpcPromise(_0xe865('0x5c'),_0xe865('0x54'),{'module':'chan_sip.so'});})[_0xe865('0x31')](function(){var _0x535e54=_0x2ab798[_0xe865('0x5d')][_0xe865('0x5e')]({'plain':!![]});if(!_0x535e54)throw new Error(_0xe865('0x5f'));if(_0x535e54['role']===_0xe865('0x5d')){var _0x49f927=_0x5d4fd8['get']({'plain':!![]});return db[_0xe865('0x60')][_0xe865('0x52')]({'where':{'name':'Contexts','userProfileId':_0x535e54[_0xe865('0x61')]},'raw':!![]})[_0xe865('0x31')](function(_0x31ddfd){if(_0x31ddfd&&_0x31ddfd[_0xe865('0x62')]===0x0){return db['UserProfileResource'][_0xe865('0x54')]({'name':_0x49f927[_0xe865('0x36')],'resourceId':_0x49f927['id'],'type':_0x31ddfd[_0xe865('0x36')],'sectionId':_0x31ddfd['id']},{})[_0xe865('0x31')](function(){return _0x5d4fd8;});}else{return _0x5d4fd8;}})[_0xe865('0x53')](function(_0x5a2a64){logger[_0xe865('0x22')](_0xe865('0x63'),_0x5a2a64);throw _0x5a2a64;});}return _0x5d4fd8;})[_0xe865('0x31')](respondWithResult(_0x1a6fe0,0xc9))['catch'](handleError(_0x1a6fe0,null));};exports[_0xe865('0x30')]=function(_0x28fc4e,_0x5155d8,_0x41f751){var _0x1cd25d;return db[_0xe865('0x3a')][_0xe865('0x52')]({'where':{'id':_0x28fc4e[_0xe865('0x4f')]['id']}})[_0xe865('0x31')](handleEntityNotFound(_0x5155d8,null))[_0xe865('0x31')](saveUpdates(_0x28fc4e[_0xe865('0x64')],null))[_0xe865('0x31')](function(_0x546913){if(_0x546913){_0x1cd25d=_0x546913;return db[_0xe865('0x3a')]['findAll']({'raw':!![]});}})['then'](function(_0xa25dec){var _0x273086=fs['readFileSync'](path[_0xe865('0x56')](config[_0xe865('0x57')],_0xe865('0x58')),'utf8');var _0x2ecc58=ejs[_0xe865('0x5a')](_0x273086,{'contexts':_0xa25dec||[]});fs[_0xe865('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2ecc58);})[_0xe865('0x31')](function(){return respondWithRpcPromise(_0xe865('0x5c'),'update',{'module':_0xe865('0x66')});})[_0xe865('0x31')](function(){return _0x1cd25d;})['then'](respondWithResult(_0x5155d8,null))['catch'](handleError(_0x5155d8,null));};exports[_0xe865('0x32')]=function(_0x51bcf2,_0x5a1407,_0x1f580d){var _0x22d353;return db[_0xe865('0x3a')][_0xe865('0x52')]({'where':{'id':_0x51bcf2[_0xe865('0x4f')]['id']}})[_0xe865('0x31')](handleEntityNotFound(_0x5a1407,null))[_0xe865('0x31')](removeEntity(_0x5a1407,null))[_0xe865('0x31')](function(){return db[_0xe865('0x3a')]['findAll']({'raw':!![]});})[_0xe865('0x31')](function(_0x4bed5a){var _0x10aaa9=fs[_0xe865('0x55')](path[_0xe865('0x56')](config[_0xe865('0x57')],_0xe865('0x58')),'utf8');var _0x18502e=ejs[_0xe865('0x5a')](_0x10aaa9,{'contexts':_0x4bed5a});fs['writeFileSync'](_0xe865('0x5b'),_0x18502e);return respondWithRpcPromise(_0xe865('0x5c'),_0xe865('0x32'),{'module':_0xe865('0x66')});})[_0xe865('0x53')](handleError(_0x5a1407,null));}; \ No newline at end of file +var _0x363b=['sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','readFileSync','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','join','root','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x128173,_0x19f9e5){var _0x48866f=function(_0x3563ee){while(--_0x3563ee){_0x128173['push'](_0x128173['shift']());}};_0x48866f(++_0x19f9e5);}(_0x363b,0x1b0));var _0xb363=function(_0x5ed04a,_0x4e2a7b){_0x5ed04a=_0x5ed04a-0x0;var _0x2ad468=_0x363b[_0x5ed04a];return _0x2ad468;};'use strict';var emlformat=require(_0xb363('0x0'));var rimraf=require(_0xb363('0x1'));var zipdir=require(_0xb363('0x2'));var jsonpatch=require(_0xb363('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb363('0x4'));var Mustache=require(_0xb363('0x5'));var util=require(_0xb363('0x6'));var path=require(_0xb363('0x7'));var sox=require(_0xb363('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb363('0x9'));var _=require('lodash');var squel=require(_0xb363('0xa'));var crypto=require('crypto');var jsforce=require(_0xb363('0xb'));var deskjs=require(_0xb363('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb363('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb363('0xe'));var logger=require('../../config/logger')(_0xb363('0xf'));var utils=require(_0xb363('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb363('0x11'));var db=require(_0xb363('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb363('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x4ae841,_0x19a4cc,_0xe70b0a,_0x15182a){return new BPromise(function(_0x58f2d9,_0x4bd72b){var _0x57f87a=_0x15182a||client;return _0x57f87a['request'](_0x4ae841,_0xe70b0a)[_0xb363('0x14')](function(_0x24bfae){logger[_0xb363('0x15')](_0xb363('0x16'),_0x19a4cc,_0xb363('0x17'));logger[_0xb363('0x18')](_0xb363('0x19'),_0x19a4cc,_0xb363('0x17'),JSON[_0xb363('0x1a')](_0x24bfae));if(_0x24bfae[_0xb363('0x1b')]){if(_0x24bfae[_0xb363('0x1b')][_0xb363('0x1c')]===0x1f4){logger[_0xb363('0x1b')](_0xb363('0x16'),_0x19a4cc,_0x24bfae[_0xb363('0x1b')][_0xb363('0x1d')]);return _0x4bd72b(_0x24bfae['error'][_0xb363('0x1d')]);}logger[_0xb363('0x1b')](_0xb363('0x16'),_0x19a4cc,_0x24bfae['error']['message']);return _0x58f2d9(_0x24bfae[_0xb363('0x1b')][_0xb363('0x1d')]);}else{logger['info'](_0xb363('0x16'),_0x19a4cc,_0xb363('0x17'));_0x58f2d9(_0x24bfae[_0xb363('0x1e')][_0xb363('0x1d')]);}})[_0xb363('0x1f')](function(_0x141ac3){logger[_0xb363('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x19a4cc,_0x141ac3);_0x4bd72b(_0x141ac3);});});}function respondWithStatusCode(_0x88b338,_0x220884){_0x220884=_0x220884||0xcc;return function(_0x2ee14c){if(_0x2ee14c){return _0x88b338[_0xb363('0x20')](_0x220884);}return _0x88b338[_0xb363('0x21')](_0x220884)[_0xb363('0x22')]();};}function respondWithResult(_0x564ad2,_0x4d4631){_0x4d4631=_0x4d4631||0xc8;return function(_0x1627cb){if(_0x1627cb){return _0x564ad2[_0xb363('0x21')](_0x4d4631)[_0xb363('0x23')](_0x1627cb);}};}function respondWithFilteredResult(_0xedbc21,_0x3bf603){return function(_0x139016){if(_0x139016){var _0x26c4f5=typeof _0x3bf603[_0xb363('0x24')]===_0xb363('0x25')&&typeof _0x3bf603['limit']===_0xb363('0x25');var _0x5558aa=_0x139016['count'];var _0x16c1ce=_0x26c4f5?0x0:_0x3bf603[_0xb363('0x24')];var _0x573599=_0x26c4f5?_0x139016[_0xb363('0x26')]:_0x3bf603[_0xb363('0x24')]+_0x3bf603[_0xb363('0x27')];var _0x284cf3;if(_0x573599>=_0x5558aa){_0x573599=_0x5558aa;_0x284cf3=0xc8;}else{_0x284cf3=0xce;}_0xedbc21[_0xb363('0x21')](_0x284cf3);return _0xedbc21[_0xb363('0x28')](_0xb363('0x29'),_0x16c1ce+'-'+_0x573599+'/'+_0x5558aa)[_0xb363('0x23')](_0x139016);}return null;};}function patchUpdates(_0x2926ce){return function(_0x45f028){try{jsonpatch['apply'](_0x45f028,_0x2926ce,!![]);}catch(_0xfa555f){return BPromise[_0xb363('0x2a')](_0xfa555f);}return _0x45f028[_0xb363('0x2b')]();};}function saveUpdates(_0x38410b,_0x39135a){return function(_0x2a7458){if(_0x2a7458){return _0x2a7458[_0xb363('0x2c')](_0x38410b)[_0xb363('0x14')](function(_0x5009f9){return _0x5009f9;});}return null;};}function removeEntity(_0x5df5a6,_0x273dd6){return function(_0x71b5d8){if(_0x71b5d8){return _0x71b5d8[_0xb363('0x2d')]()[_0xb363('0x14')](function(){var _0x7eb6dd=_0x71b5d8[_0xb363('0x2e')]({'plain':!![]});var _0x649763=_0xb363('0x2f');return db[_0xb363('0x30')][_0xb363('0x2d')]({'where':{'type':_0x649763,'resourceId':_0x7eb6dd['id']}})['then'](function(){return _0x71b5d8;});})[_0xb363('0x14')](function(){_0x5df5a6[_0xb363('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313513,_0x42942f){return function(_0x263a23){if(!_0x263a23){_0x313513[_0xb363('0x20')](0x194);}return _0x263a23;};}function handleError(_0x4e0848,_0x535775){_0x535775=_0x535775||0x1f4;return function(_0x5c99d6){logger[_0xb363('0x1b')](_0x5c99d6[_0xb363('0x31')]);if(_0x5c99d6[_0xb363('0x32')]){delete _0x5c99d6[_0xb363('0x32')];}_0x4e0848['status'](_0x535775)[_0xb363('0x33')](_0x5c99d6);};}exports[_0xb363('0x34')]=function(_0x512c16,_0x2060eb){var _0xfcf11c={},_0x58ab35={},_0x4563b6={'count':0x0,'rows':[]};var _0x755353=_['map'](db[_0xb363('0x35')][_0xb363('0x36')],function(_0x41c399){return{'name':_0x41c399[_0xb363('0x37')],'type':_0x41c399['type'][_0xb363('0x38')]};});_0x58ab35[_0xb363('0x39')]=_[_0xb363('0x3a')](_0x755353,_0xb363('0x32'));_0x58ab35[_0xb363('0x3b')]=_[_0xb363('0x3c')](_0x512c16['query']);_0x58ab35[_0xb363('0x3d')]=_[_0xb363('0x3e')](_0x58ab35[_0xb363('0x39')],_0x58ab35[_0xb363('0x3b')]);_0xfcf11c[_0xb363('0x3f')]=_[_0xb363('0x3e')](_0x58ab35[_0xb363('0x39')],qs[_0xb363('0x40')](_0x512c16[_0xb363('0x3b')][_0xb363('0x40')]));_0xfcf11c[_0xb363('0x3f')]=_0xfcf11c[_0xb363('0x3f')][_0xb363('0x41')]?_0xfcf11c['attributes']:_0x58ab35[_0xb363('0x39')];if(!_0x512c16['query'][_0xb363('0x42')](_0xb363('0x43'))){_0xfcf11c[_0xb363('0x27')]=qs[_0xb363('0x27')](_0x512c16[_0xb363('0x3b')]['limit']);_0xfcf11c['offset']=qs[_0xb363('0x24')](_0x512c16[_0xb363('0x3b')][_0xb363('0x24')]);}_0xfcf11c['order']=qs[_0xb363('0x44')](_0x512c16[_0xb363('0x3b')]['sort']);_0xfcf11c[_0xb363('0x45')]=qs['filters'](_['pick'](_0x512c16[_0xb363('0x3b')],_0x58ab35[_0xb363('0x3d')]),_0x755353);if(_0x512c16[_0xb363('0x3b')][_0xb363('0x46')]){_0xfcf11c[_0xb363('0x45')]=_[_0xb363('0x47')](_0xfcf11c[_0xb363('0x45')],{'$or':_['map'](_0x755353,function(_0x4f07e7){if(_0x4f07e7[_0xb363('0x48')]!==_0xb363('0x49')){var _0x2dc81a={};_0x2dc81a[_0x4f07e7[_0xb363('0x32')]]={'$like':'%'+_0x512c16['query'][_0xb363('0x46')]+'%'};return _0x2dc81a;}})});}_0xfcf11c=_[_0xb363('0x47')]({},_0xfcf11c,_0x512c16[_0xb363('0x4a')]);var _0x5064ca={'where':_0xfcf11c['where']};return db[_0xb363('0x35')][_0xb363('0x26')](_0x5064ca)['then'](function(_0x5c93c9){_0x4563b6['count']=_0x5c93c9;if(_0x512c16[_0xb363('0x3b')][_0xb363('0x4b')]){_0xfcf11c['include']=[{'all':!![]}];}return db[_0xb363('0x35')][_0xb363('0x4c')](_0xfcf11c);})[_0xb363('0x14')](function(_0x1454fa){_0x4563b6[_0xb363('0x4d')]=_0x1454fa;return _0x4563b6;})[_0xb363('0x14')](respondWithFilteredResult(_0x2060eb,_0xfcf11c))[_0xb363('0x1f')](handleError(_0x2060eb,null));};exports[_0xb363('0x4e')]=function(_0x268625,_0x579dab){var _0x3577ae={'raw':![],'where':{'id':_0x268625['params']['id']}},_0x163dd7={};_0x163dd7['model']=_[_0xb363('0x3c')](db[_0xb363('0x35')][_0xb363('0x36')]);_0x163dd7[_0xb363('0x3b')]=_[_0xb363('0x3c')](_0x268625[_0xb363('0x3b')]);_0x163dd7[_0xb363('0x3d')]=_[_0xb363('0x3e')](_0x163dd7[_0xb363('0x39')],_0x163dd7[_0xb363('0x3b')]);_0x3577ae[_0xb363('0x3f')]=_[_0xb363('0x3e')](_0x163dd7[_0xb363('0x39')],qs[_0xb363('0x40')](_0x268625[_0xb363('0x3b')][_0xb363('0x40')]));_0x3577ae[_0xb363('0x3f')]=_0x3577ae['attributes'][_0xb363('0x41')]?_0x3577ae[_0xb363('0x3f')]:_0x163dd7[_0xb363('0x39')];if(_0x268625[_0xb363('0x3b')][_0xb363('0x4b')]){_0x3577ae[_0xb363('0x4f')]=[{'all':!![]}];}_0x3577ae=_[_0xb363('0x47')]({},_0x3577ae,_0x268625[_0xb363('0x4a')]);return db['VoiceContext'][_0xb363('0x50')](_0x3577ae)[_0xb363('0x14')](handleEntityNotFound(_0x579dab,null))[_0xb363('0x14')](respondWithResult(_0x579dab,null))[_0xb363('0x1f')](handleError(_0x579dab,null));};exports[_0xb363('0x51')]=function(_0x52b553,_0x13e050,_0x2525e0){var _0x30385a;return db[_0xb363('0x35')]['create'](_0x52b553['body'],{'raw':!![]})[_0xb363('0x14')](function(_0x14171e){_0x30385a=_0x14171e;return db[_0xb363('0x35')]['findAll']({'raw':!![]});})[_0xb363('0x14')](function(_0x1e9e3c){var _0x26ce84=fs[_0xb363('0x52')](path['join'](config['root'],_0xb363('0x53')),_0xb363('0x54'));var _0x432dcc=ejs[_0xb363('0x55')](_0x26ce84,{'contexts':_0x1e9e3c||[]});fs['writeFileSync'](_0xb363('0x56'),_0x432dcc);})[_0xb363('0x14')](function(){return respondWithRpcPromise(_0xb363('0x57'),_0xb363('0x51'),{'module':_0xb363('0x58')});})[_0xb363('0x14')](function(){var _0x465560=_0x52b553['user'][_0xb363('0x2e')]({'plain':!![]});if(!_0x465560)throw new Error(_0xb363('0x59'));if(_0x465560[_0xb363('0x5a')]===_0xb363('0x5b')){var _0x1cbf9b=_0x30385a['get']({'plain':!![]});return db[_0xb363('0x5c')]['find']({'where':{'name':_0xb363('0x2f'),'userProfileId':_0x465560['userProfileId']},'raw':!![]})['then'](function(_0x568cff){if(_0x568cff&&_0x568cff[_0xb363('0x5d')]===0x0){return db[_0xb363('0x30')][_0xb363('0x51')]({'name':_0x1cbf9b[_0xb363('0x32')],'resourceId':_0x1cbf9b['id'],'type':_0x568cff[_0xb363('0x32')],'sectionId':_0x568cff['id']},{})[_0xb363('0x14')](function(){return _0x30385a;});}else{return _0x30385a;}})[_0xb363('0x1f')](function(_0x584d25){logger[_0xb363('0x1b')](_0xb363('0x5e'),_0x584d25);throw _0x584d25;});}return _0x30385a;})[_0xb363('0x14')](respondWithResult(_0x13e050,0xc9))[_0xb363('0x1f')](handleError(_0x13e050,null));};exports[_0xb363('0x2c')]=function(_0x1c71c8,_0x2b9941,_0x3ee024){var _0x69d76a;return db['VoiceContext'][_0xb363('0x50')]({'where':{'id':_0x1c71c8[_0xb363('0x5f')]['id']}})[_0xb363('0x14')](handleEntityNotFound(_0x2b9941,null))[_0xb363('0x14')](saveUpdates(_0x1c71c8[_0xb363('0x60')],null))[_0xb363('0x14')](function(_0x3689e7){if(_0x3689e7){_0x69d76a=_0x3689e7;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xb363('0x14')](function(_0xa9df2c){var _0xb0a20a=fs[_0xb363('0x52')](path[_0xb363('0x61')](config[_0xb363('0x62')],_0xb363('0x53')),_0xb363('0x54'));var _0x282db4=ejs['render'](_0xb0a20a,{'contexts':_0xa9df2c||[]});fs[_0xb363('0x63')](_0xb363('0x56'),_0x282db4);})['then'](function(){return respondWithRpcPromise(_0xb363('0x57'),_0xb363('0x2c'),{'module':_0xb363('0x58')});})[_0xb363('0x14')](function(){return _0x69d76a;})[_0xb363('0x14')](respondWithResult(_0x2b9941,null))['catch'](handleError(_0x2b9941,null));};exports[_0xb363('0x2d')]=function(_0x4593a0,_0x452fb0,_0x55a43d){var _0x945b79;return db[_0xb363('0x35')][_0xb363('0x50')]({'where':{'id':_0x4593a0[_0xb363('0x5f')]['id']}})[_0xb363('0x14')](handleEntityNotFound(_0x452fb0,null))[_0xb363('0x14')](removeEntity(_0x452fb0,null))[_0xb363('0x14')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xb363('0x14')](function(_0x1bff30){var _0x1f7c64=fs['readFileSync'](path[_0xb363('0x61')](config['root'],_0xb363('0x53')),_0xb363('0x54'));var _0x47ab39=ejs[_0xb363('0x55')](_0x1f7c64,{'contexts':_0x1bff30});fs[_0xb363('0x63')](_0xb363('0x56'),_0x47ab39);return respondWithRpcPromise(_0xb363('0x57'),_0xb363('0x2d'),{'module':_0xb363('0x58')});})[_0xb363('0x1f')](handleError(_0x452fb0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9c7ffae..305e957 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 _0xf5e2=['define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xf5e2,0x163));var _0x2f5e=function(_0xe717ee,_0x6b2203){_0xe717ee=_0xe717ee-0x0;var _0x2e41e3=_0xf5e2[_0xe717ee];return _0x2e41e3;};'use strict';var _=require(_0x2f5e('0x0'));var util=require('util');var logger=require(_0x2f5e('0x1'))(_0x2f5e('0x2'));var moment=require(_0x2f5e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f5e('0x4'));var rimraf=require(_0x2f5e('0x5'));var config=require(_0x2f5e('0x6'));var attributes=require(_0x2f5e('0x7'));module['exports']=function(_0x3c7898,_0x285888){return _0x3c7898[_0x2f5e('0x8')](_0x2f5e('0x9'),attributes,{'tableName':_0x2f5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd4=['request-promise','path','rimraf','./voiceContext.attributes','exports','voice_contexts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x1dd4,0x95));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41dd('0x0'));var util=require('util');var logger=require(_0x41dd('0x1'))(_0x41dd('0x2'));var moment=require(_0x41dd('0x3'));var BPromise=require(_0x41dd('0x4'));var rp=require(_0x41dd('0x5'));var fs=require('fs');var path=require(_0x41dd('0x6'));var rimraf=require(_0x41dd('0x7'));var config=require('../../config/environment');var attributes=require(_0x41dd('0x8'));module[_0x41dd('0x9')]=function(_0x186073,_0x27cd63){return _0x186073['define']('VoiceContext',attributes,{'tableName':_0x41dd('0xa'),'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 e25378b..3f045de 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 _0x4c8c=['../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x4c8c,0x1b3));var _0xc4c8=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x4c8c[_0x34021d];return _0x16597b;};'use strict';var _=require(_0xc4c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4c8('0x1'));var rs=require(_0xc4c8('0x2'));var fs=require('fs');var Redis=require(_0xc4c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4c8('0x4'));var logger=require(_0xc4c8('0x5'))('rpc');var config=require(_0xc4c8('0x6'));var jayson=require(_0xc4c8('0x7'));var client=jayson['client'][_0xc4c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bee88,_0xb2b749,_0x4056ef){return new BPromise(function(_0x592ed9,_0x134144){return client[_0xc4c8('0x9')](_0x1bee88,_0x4056ef)['then'](function(_0x2b4513){logger[_0xc4c8('0xa')]('VoiceContext,\x20%s,\x20%s',_0xb2b749,_0xc4c8('0xb'));logger[_0xc4c8('0xc')](_0xc4c8('0xd'),_0xb2b749,_0xc4c8('0xb'),JSON[_0xc4c8('0xe')](_0x2b4513));if(_0x2b4513[_0xc4c8('0xf')]){if(_0x2b4513[_0xc4c8('0xf')][_0xc4c8('0x10')]===0x1f4){logger[_0xc4c8('0xf')]('VoiceContext,\x20%s,\x20%s',_0xb2b749,_0x2b4513[_0xc4c8('0xf')][_0xc4c8('0x11')]);return _0x134144(_0x2b4513[_0xc4c8('0xf')][_0xc4c8('0x11')]);}logger[_0xc4c8('0xf')](_0xc4c8('0x12'),_0xb2b749,_0x2b4513[_0xc4c8('0xf')][_0xc4c8('0x11')]);return _0x592ed9(_0x2b4513[_0xc4c8('0xf')]['message']);}else{logger[_0xc4c8('0xa')](_0xc4c8('0x12'),_0xb2b749,_0xc4c8('0xb'));_0x592ed9(_0x2b4513['result']['message']);}})[_0xc4c8('0x13')](function(_0x7fe08f){logger['error'](_0xc4c8('0x12'),_0xb2b749,_0x7fe08f);_0x134144(_0x7fe08f);});});} \ No newline at end of file +var _0x9584=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x250a41,_0x328b78){var _0x459feb=function(_0x554599){while(--_0x554599){_0x250a41['push'](_0x250a41['shift']());}};_0x459feb(++_0x328b78);}(_0x9584,0x1b9));var _0x4958=function(_0x5a3f0f,_0x35aad7){_0x5a3f0f=_0x5a3f0f-0x0;var _0x43391f=_0x9584[_0x5a3f0f];return _0x43391f;};'use strict';var _=require(_0x4958('0x0'));var util=require(_0x4958('0x1'));var moment=require(_0x4958('0x2'));var BPromise=require('bluebird');var rs=require(_0x4958('0x3'));var fs=require('fs');var Redis=require(_0x4958('0x4'));var db=require(_0x4958('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4958('0x6'))(_0x4958('0x7'));var config=require(_0x4958('0x8'));var jayson=require(_0x4958('0x9'));var client=jayson[_0x4958('0xa')][_0x4958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x527644,_0x1dfabd,_0x152103){return new BPromise(function(_0x27c0ff,_0x276ec8){return client[_0x4958('0xc')](_0x527644,_0x152103)[_0x4958('0xd')](function(_0xf399d6){logger[_0x4958('0xe')](_0x4958('0xf'),_0x1dfabd,_0x4958('0x10'));logger[_0x4958('0x11')](_0x4958('0x12'),_0x1dfabd,'request\x20sent',JSON[_0x4958('0x13')](_0xf399d6));if(_0xf399d6[_0x4958('0x14')]){if(_0xf399d6['error'][_0x4958('0x15')]===0x1f4){logger[_0x4958('0x14')](_0x4958('0xf'),_0x1dfabd,_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);return _0x276ec8(_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);}logger[_0x4958('0x14')](_0x4958('0xf'),_0x1dfabd,_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);return _0x27c0ff(_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x1dfabd,_0x4958('0x10'));_0x27c0ff(_0xf399d6[_0x4958('0x17')]['message']);}})['catch'](function(_0x442552){logger[_0x4958('0x14')]('VoiceContext,\x20%s,\x20%s',_0x1dfabd,_0x442552);_0x276ec8(_0x442552);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 68e3373..4a24dd5 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 _0x38bc=['../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x38bc,0x120));var _0xc38b=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x38bc[_0x35da42];return _0x370035;};'use strict';var multer=require(_0xc38b('0x0'));var util=require('util');var path=require(_0xc38b('0x1'));var timeout=require(_0xc38b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc38b('0x3'));var auth=require(_0xc38b('0x4'));var interaction=require(_0xc38b('0x5'));var config=require(_0xc38b('0x6'));var controller=require(_0xc38b('0x7'));router['get']('/',auth[_0xc38b('0x8')](),controller[_0xc38b('0x9')]);router[_0xc38b('0xa')](_0xc38b('0xb'),auth['isAuthenticated'](),controller[_0xc38b('0xc')]);router[_0xc38b('0xa')](_0xc38b('0xd'),auth[_0xc38b('0x8')](),controller[_0xc38b('0xe')]);router[_0xc38b('0xf')]('/',auth[_0xc38b('0x8')](),controller[_0xc38b('0x10')]);router[_0xc38b('0x11')](_0xc38b('0xd'),auth[_0xc38b('0x8')](),controller['update']);router[_0xc38b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc38b('0x13')]);module[_0xc38b('0x14')]=router; \ No newline at end of file +var _0x878f=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2edc4c,_0x3b27e9){var _0x3a496a=function(_0x270a4f){while(--_0x270a4f){_0x2edc4c['push'](_0x2edc4c['shift']());}};_0x3a496a(++_0x3b27e9);}(_0x878f,0x124));var _0xf878=function(_0xd02416,_0x40a97f){_0xd02416=_0xd02416-0x0;var _0x1f24a8=_0x878f[_0xd02416];return _0x1f24a8;};'use strict';var multer=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var path=require(_0xf878('0x2'));var timeout=require(_0xf878('0x3'));var express=require(_0xf878('0x4'));var router=express[_0xf878('0x5')]();var fs_extra=require(_0xf878('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth['isAuthenticated'](),controller[_0xf878('0xa')]);router[_0xf878('0x9')](_0xf878('0xb'),auth[_0xf878('0xc')](),controller['describe']);router[_0xf878('0x9')](_0xf878('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xe')]('/',auth[_0xf878('0xc')](),controller[_0xf878('0xf')]);router[_0xf878('0x10')](_0xf878('0xd'),auth[_0xf878('0xc')](),controller[_0xf878('0x11')]);router[_0xf878('0x12')](_0xf878('0xd'),auth[_0xf878('0xc')](),controller[_0xf878('0x13')]);module[_0xf878('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8c321a6..71e5070 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x2e75f7,_0x2291f6){var _0xa2fb71=function(_0xa5e657){while(--_0xa5e657){_0x2e75f7['push'](_0x2e75f7['shift']());}};_0xa2fb71(++_0x2291f6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x4b84[_0x40b493];return _0x548365;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x520f7e,_0x67518d){var _0x587f49=function(_0x226a93){while(--_0x226a93){_0x520f7e['push'](_0x520f7e['shift']());}};_0x587f49(++_0x67518d);}(_0x84ab,0x12f));var _0xb84a=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x84ab[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 40dba42..234a91d 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 _0xb110=['crypto','jsforce','desk.js','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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','VoiceDialReport','findAll','rows','show','includeAll','include','options','find','create','catch','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x57e9d2,_0x5c0f3f){var _0x32e848=function(_0x5d4752){while(--_0x5d4752){_0x57e9d2['push'](_0x57e9d2['shift']());}};_0x32e848(++_0x5c0f3f);}(_0xb110,0xdd));var _0x0b11=function(_0x1c5ffc,_0x2d4fc8){_0x1c5ffc=_0x1c5ffc-0x0;var _0x4d960d=_0xb110[_0x1c5ffc];return _0x4d960d;};'use strict';var emlformat=require(_0x0b11('0x0'));var rimraf=require(_0x0b11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b11('0x2'));var rp=require(_0x0b11('0x3'));var moment=require(_0x0b11('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b11('0x5'));var util=require(_0x0b11('0x6'));var path=require(_0x0b11('0x7'));var sox=require('sox');var csv=require(_0x0b11('0x8'));var ejs=require(_0x0b11('0x9'));var fs=require('fs');var fs_extra=require(_0x0b11('0xa'));var _=require(_0x0b11('0xb'));var squel=require(_0x0b11('0xc'));var crypto=require(_0x0b11('0xd'));var jsforce=require(_0x0b11('0xe'));var deskjs=require(_0x0b11('0xf'));var toCsv=require(_0x0b11('0x8'));var querystring=require('querystring');var Papa=require(_0x0b11('0x10'));var Redis=require(_0x0b11('0x11'));var authService=require(_0x0b11('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b11('0x13'));var hardwareService=require(_0x0b11('0x14'));var logger=require(_0x0b11('0x15'))('api');var utils=require(_0x0b11('0x16'));var config=require(_0x0b11('0x17'));var licenseUtil=require(_0x0b11('0x18'));var db=require(_0x0b11('0x19'))['db'];function respondWithStatusCode(_0x449a00,_0x2b48eb){_0x2b48eb=_0x2b48eb||0xcc;return function(_0x4830e1){if(_0x4830e1){return _0x449a00[_0x0b11('0x1a')](_0x2b48eb);}return _0x449a00[_0x0b11('0x1b')](_0x2b48eb)[_0x0b11('0x1c')]();};}function respondWithResult(_0x3e062d,_0x24e1a8){_0x24e1a8=_0x24e1a8||0xc8;return function(_0x4e8ef3){if(_0x4e8ef3){return _0x3e062d[_0x0b11('0x1b')](_0x24e1a8)[_0x0b11('0x1d')](_0x4e8ef3);}};}function respondWithFilteredResult(_0x4dc042,_0x3d5c44){return function(_0x98bb7){if(_0x98bb7){var _0x17eb17=typeof _0x3d5c44[_0x0b11('0x1e')]===_0x0b11('0x1f')&&typeof _0x3d5c44['limit']===_0x0b11('0x1f');var _0x1f49c2=_0x98bb7[_0x0b11('0x20')];var _0x400a13=_0x17eb17?0x0:_0x3d5c44[_0x0b11('0x1e')];var _0x3ddd47=_0x17eb17?_0x98bb7['count']:_0x3d5c44['offset']+_0x3d5c44[_0x0b11('0x21')];var _0xd0654;if(_0x3ddd47>=_0x1f49c2){_0x3ddd47=_0x1f49c2;_0xd0654=0xc8;}else{_0xd0654=0xce;}_0x4dc042['status'](_0xd0654);return _0x4dc042['set'](_0x0b11('0x22'),_0x400a13+'-'+_0x3ddd47+'/'+_0x1f49c2)['json'](_0x98bb7);}return null;};}function patchUpdates(_0x332f3e){return function(_0x26b56d){try{jsonpatch[_0x0b11('0x23')](_0x26b56d,_0x332f3e,!![]);}catch(_0x3a65c6){return BPromise[_0x0b11('0x24')](_0x3a65c6);}return _0x26b56d[_0x0b11('0x25')]();};}function saveUpdates(_0x4caf7a,_0x2cbe84){return function(_0x1e5a0a){if(_0x1e5a0a){return _0x1e5a0a[_0x0b11('0x26')](_0x4caf7a)[_0x0b11('0x27')](function(_0x2d55a4){return _0x2d55a4;});}return null;};}function removeEntity(_0x31cda8,_0x511ba7){return function(_0x9483d2){if(_0x9483d2){return _0x9483d2[_0x0b11('0x28')]()[_0x0b11('0x27')](function(){_0x31cda8[_0x0b11('0x1b')](0xcc)[_0x0b11('0x1c')]();});}};}function handleEntityNotFound(_0x363d99,_0x62b341){return function(_0x4f895a){if(!_0x4f895a){_0x363d99[_0x0b11('0x1a')](0x194);}return _0x4f895a;};}function handleError(_0x6e272e,_0x3e13f3){_0x3e13f3=_0x3e13f3||0x1f4;return function(_0x21de5d){logger[_0x0b11('0x29')](_0x21de5d[_0x0b11('0x2a')]);if(_0x21de5d[_0x0b11('0x2b')]){delete _0x21de5d[_0x0b11('0x2b')];}_0x6e272e[_0x0b11('0x1b')](_0x3e13f3)['send'](_0x21de5d);};}exports[_0x0b11('0x2c')]=function(_0x3b428b,_0x2b7428){var _0x4dc46c={},_0x4a082b={},_0x1deef5={'count':0x0,'rows':[]};var _0x590e69=_[_0x0b11('0x2d')](db['VoiceDialReport'][_0x0b11('0x2e')],function(_0x610e3e){return{'name':_0x610e3e[_0x0b11('0x2f')],'type':_0x610e3e[_0x0b11('0x30')][_0x0b11('0x31')]};});_0x4a082b[_0x0b11('0x32')]=_[_0x0b11('0x2d')](_0x590e69,_0x0b11('0x2b'));_0x4a082b[_0x0b11('0x33')]=_[_0x0b11('0x34')](_0x3b428b[_0x0b11('0x33')]);_0x4a082b[_0x0b11('0x35')]=_[_0x0b11('0x36')](_0x4a082b['model'],_0x4a082b['query']);_0x4dc46c[_0x0b11('0x37')]=_[_0x0b11('0x36')](_0x4a082b['model'],qs[_0x0b11('0x38')](_0x3b428b[_0x0b11('0x33')][_0x0b11('0x38')]));_0x4dc46c[_0x0b11('0x37')]=_0x4dc46c['attributes'][_0x0b11('0x39')]?_0x4dc46c[_0x0b11('0x37')]:_0x4a082b[_0x0b11('0x32')];if(!_0x3b428b[_0x0b11('0x33')][_0x0b11('0x3a')](_0x0b11('0x3b'))){_0x4dc46c['limit']=qs[_0x0b11('0x21')](_0x3b428b['query']['limit']);_0x4dc46c[_0x0b11('0x1e')]=qs[_0x0b11('0x1e')](_0x3b428b[_0x0b11('0x33')][_0x0b11('0x1e')]);}_0x4dc46c['order']=qs[_0x0b11('0x3c')](_0x3b428b['query']['sort']);_0x4dc46c[_0x0b11('0x3d')]=qs['filters'](_['pick'](_0x3b428b['query'],_0x4a082b[_0x0b11('0x35')]),_0x590e69);if(_0x3b428b[_0x0b11('0x33')][_0x0b11('0x3e')]){_0x4dc46c[_0x0b11('0x3d')]=_[_0x0b11('0x3f')](_0x4dc46c[_0x0b11('0x3d')],{'$or':_['map'](_0x590e69,function(_0x49e4a4){if(_0x49e4a4[_0x0b11('0x30')]!==_0x0b11('0x40')){var _0x1d48e3={};_0x1d48e3[_0x49e4a4['name']]={'$like':'%'+_0x3b428b[_0x0b11('0x33')][_0x0b11('0x3e')]+'%'};return _0x1d48e3;}})});}_0x4dc46c=_[_0x0b11('0x3f')]({},_0x4dc46c,_0x3b428b['options']);var _0x2b80d5={'where':_0x4dc46c[_0x0b11('0x3d')]};return db[_0x0b11('0x41')][_0x0b11('0x20')](_0x2b80d5)[_0x0b11('0x27')](function(_0x20832f){_0x1deef5[_0x0b11('0x20')]=_0x20832f;if(_0x3b428b[_0x0b11('0x33')]['includeAll']){_0x4dc46c['include']=[{'all':!![]}];}return db[_0x0b11('0x41')][_0x0b11('0x42')](_0x4dc46c);})[_0x0b11('0x27')](function(_0x38d93e){_0x1deef5[_0x0b11('0x43')]=_0x38d93e;return _0x1deef5;})[_0x0b11('0x27')](respondWithFilteredResult(_0x2b7428,_0x4dc46c))['catch'](handleError(_0x2b7428,null));};exports[_0x0b11('0x44')]=function(_0x24bf8a,_0x1f9865){var _0x190e98={'raw':!![],'where':{'id':_0x24bf8a['params']['id']}},_0xe4ac07={};_0xe4ac07[_0x0b11('0x32')]=_[_0x0b11('0x34')](db[_0x0b11('0x41')][_0x0b11('0x2e')]);_0xe4ac07[_0x0b11('0x33')]=_[_0x0b11('0x34')](_0x24bf8a[_0x0b11('0x33')]);_0xe4ac07[_0x0b11('0x35')]=_[_0x0b11('0x36')](_0xe4ac07[_0x0b11('0x32')],_0xe4ac07[_0x0b11('0x33')]);_0x190e98[_0x0b11('0x37')]=_['intersection'](_0xe4ac07[_0x0b11('0x32')],qs['fields'](_0x24bf8a[_0x0b11('0x33')][_0x0b11('0x38')]));_0x190e98[_0x0b11('0x37')]=_0x190e98[_0x0b11('0x37')][_0x0b11('0x39')]?_0x190e98[_0x0b11('0x37')]:_0xe4ac07[_0x0b11('0x32')];if(_0x24bf8a[_0x0b11('0x33')][_0x0b11('0x45')]){_0x190e98[_0x0b11('0x46')]=[{'all':!![]}];}_0x190e98=_['merge']({},_0x190e98,_0x24bf8a[_0x0b11('0x47')]);return db[_0x0b11('0x41')][_0x0b11('0x48')](_0x190e98)[_0x0b11('0x27')](handleEntityNotFound(_0x1f9865,null))[_0x0b11('0x27')](respondWithResult(_0x1f9865,null))['catch'](handleError(_0x1f9865,null));};exports[_0x0b11('0x49')]=function(_0x5cab48,_0x55d084){return db[_0x0b11('0x41')][_0x0b11('0x49')](_0x5cab48['body'],{})[_0x0b11('0x27')](respondWithResult(_0x55d084,0xc9))[_0x0b11('0x4a')](handleError(_0x55d084,null));};exports[_0x0b11('0x26')]=function(_0x40f904,_0x2b0fc7){if(_0x40f904[_0x0b11('0x4b')]['id']){delete _0x40f904[_0x0b11('0x4b')]['id'];}return db[_0x0b11('0x41')][_0x0b11('0x48')]({'where':{'id':_0x40f904[_0x0b11('0x4c')]['id']}})[_0x0b11('0x27')](handleEntityNotFound(_0x2b0fc7,null))['then'](saveUpdates(_0x40f904['body'],null))['then'](respondWithResult(_0x2b0fc7,null))[_0x0b11('0x4a')](handleError(_0x2b0fc7,null));};exports[_0x0b11('0x28')]=function(_0x494089,_0x573870){return db[_0x0b11('0x41')][_0x0b11('0x48')]({'where':{'id':_0x494089['params']['id']}})['then'](handleEntityNotFound(_0x573870,null))[_0x0b11('0x27')](removeEntity(_0x573870,null))['catch'](handleError(_0x573870,null));};exports[_0x0b11('0x4d')]=function(_0x25a620,_0x4147a9){return db[_0x0b11('0x41')]['describe']()['then'](respondWithResult(_0x4147a9,null))[_0x0b11('0x4a')](handleError(_0x4147a9,null));}; \ No newline at end of file +var _0xfdfc=['query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','findAll','rows','catch','params','intersection','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xfdfc,0xfc));var _0xcfdf=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xfdfc[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfdf('0x0'));var zipdir=require(_0xcfdf('0x1'));var jsonpatch=require(_0xcfdf('0x2'));var rp=require(_0xcfdf('0x3'));var moment=require('moment');var BPromise=require(_0xcfdf('0x4'));var Mustache=require(_0xcfdf('0x5'));var util=require(_0xcfdf('0x6'));var path=require(_0xcfdf('0x7'));var sox=require(_0xcfdf('0x8'));var csv=require(_0xcfdf('0x9'));var ejs=require(_0xcfdf('0xa'));var fs=require('fs');var fs_extra=require(_0xcfdf('0xb'));var _=require(_0xcfdf('0xc'));var squel=require(_0xcfdf('0xd'));var crypto=require('crypto');var jsforce=require(_0xcfdf('0xe'));var deskjs=require(_0xcfdf('0xf'));var toCsv=require(_0xcfdf('0x9'));var querystring=require(_0xcfdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xcfdf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcfdf('0x12'));var as=require(_0xcfdf('0x13'));var hardwareService=require(_0xcfdf('0x14'));var logger=require(_0xcfdf('0x15'))(_0xcfdf('0x16'));var utils=require(_0xcfdf('0x17'));var config=require(_0xcfdf('0x18'));var licenseUtil=require(_0xcfdf('0x19'));var db=require(_0xcfdf('0x1a'))['db'];function respondWithStatusCode(_0x4c2a1b,_0x478ef5){_0x478ef5=_0x478ef5||0xcc;return function(_0x1a3312){if(_0x1a3312){return _0x4c2a1b[_0xcfdf('0x1b')](_0x478ef5);}return _0x4c2a1b['status'](_0x478ef5)[_0xcfdf('0x1c')]();};}function respondWithResult(_0x3d65c6,_0x229f37){_0x229f37=_0x229f37||0xc8;return function(_0x2796f8){if(_0x2796f8){return _0x3d65c6[_0xcfdf('0x1d')](_0x229f37)['json'](_0x2796f8);}};}function respondWithFilteredResult(_0x21052d,_0x30a8ed){return function(_0x323470){if(_0x323470){var _0x2c1028=typeof _0x30a8ed['offset']==='undefined'&&typeof _0x30a8ed['limit']==='undefined';var _0x461cb5=_0x323470[_0xcfdf('0x1e')];var _0x448f3e=_0x2c1028?0x0:_0x30a8ed['offset'];var _0x4cf94d=_0x2c1028?_0x323470['count']:_0x30a8ed[_0xcfdf('0x1f')]+_0x30a8ed[_0xcfdf('0x20')];var _0x1a96e8;if(_0x4cf94d>=_0x461cb5){_0x4cf94d=_0x461cb5;_0x1a96e8=0xc8;}else{_0x1a96e8=0xce;}_0x21052d[_0xcfdf('0x1d')](_0x1a96e8);return _0x21052d[_0xcfdf('0x21')](_0xcfdf('0x22'),_0x448f3e+'-'+_0x4cf94d+'/'+_0x461cb5)[_0xcfdf('0x23')](_0x323470);}return null;};}function patchUpdates(_0x7bbf7b){return function(_0xbbc94c){try{jsonpatch[_0xcfdf('0x24')](_0xbbc94c,_0x7bbf7b,!![]);}catch(_0x10de27){return BPromise[_0xcfdf('0x25')](_0x10de27);}return _0xbbc94c['save']();};}function saveUpdates(_0x454d5f,_0x2339c4){return function(_0x487261){if(_0x487261){return _0x487261[_0xcfdf('0x26')](_0x454d5f)['then'](function(_0x4006e1){return _0x4006e1;});}return null;};}function removeEntity(_0x20b46b,_0x4c536f){return function(_0xd7ade){if(_0xd7ade){return _0xd7ade[_0xcfdf('0x27')]()[_0xcfdf('0x28')](function(){_0x20b46b['status'](0xcc)[_0xcfdf('0x1c')]();});}};}function handleEntityNotFound(_0xc7eac,_0x5ac857){return function(_0xa7e368){if(!_0xa7e368){_0xc7eac['sendStatus'](0x194);}return _0xa7e368;};}function handleError(_0x15da39,_0x2825f4){_0x2825f4=_0x2825f4||0x1f4;return function(_0x163b0d){logger[_0xcfdf('0x29')](_0x163b0d['stack']);if(_0x163b0d[_0xcfdf('0x2a')]){delete _0x163b0d[_0xcfdf('0x2a')];}_0x15da39[_0xcfdf('0x1d')](_0x2825f4)[_0xcfdf('0x2b')](_0x163b0d);};}exports[_0xcfdf('0x2c')]=function(_0x531f05,_0x50b8d6){var _0x1a7a1b={},_0x58415c={},_0x771ccd={'count':0x0,'rows':[]};var _0x5bb00c=_['map'](db[_0xcfdf('0x2d')][_0xcfdf('0x2e')],function(_0x1db67f){return{'name':_0x1db67f[_0xcfdf('0x2f')],'type':_0x1db67f[_0xcfdf('0x30')][_0xcfdf('0x31')]};});_0x58415c[_0xcfdf('0x32')]=_[_0xcfdf('0x33')](_0x5bb00c,'name');_0x58415c[_0xcfdf('0x34')]=_[_0xcfdf('0x35')](_0x531f05[_0xcfdf('0x34')]);_0x58415c['filters']=_['intersection'](_0x58415c[_0xcfdf('0x32')],_0x58415c[_0xcfdf('0x34')]);_0x1a7a1b[_0xcfdf('0x36')]=_['intersection'](_0x58415c[_0xcfdf('0x32')],qs[_0xcfdf('0x37')](_0x531f05['query']['fields']));_0x1a7a1b[_0xcfdf('0x36')]=_0x1a7a1b['attributes'][_0xcfdf('0x38')]?_0x1a7a1b['attributes']:_0x58415c[_0xcfdf('0x32')];if(!_0x531f05[_0xcfdf('0x34')]['hasOwnProperty'](_0xcfdf('0x39'))){_0x1a7a1b[_0xcfdf('0x20')]=qs[_0xcfdf('0x20')](_0x531f05[_0xcfdf('0x34')][_0xcfdf('0x20')]);_0x1a7a1b[_0xcfdf('0x1f')]=qs[_0xcfdf('0x1f')](_0x531f05[_0xcfdf('0x34')]['offset']);}_0x1a7a1b[_0xcfdf('0x3a')]=qs[_0xcfdf('0x3b')](_0x531f05[_0xcfdf('0x34')][_0xcfdf('0x3b')]);_0x1a7a1b[_0xcfdf('0x3c')]=qs[_0xcfdf('0x3d')](_[_0xcfdf('0x3e')](_0x531f05['query'],_0x58415c[_0xcfdf('0x3d')]),_0x5bb00c);if(_0x531f05[_0xcfdf('0x34')]['filter']){_0x1a7a1b[_0xcfdf('0x3c')]=_['merge'](_0x1a7a1b[_0xcfdf('0x3c')],{'$or':_['map'](_0x5bb00c,function(_0x5d750f){if(_0x5d750f[_0xcfdf('0x30')]!==_0xcfdf('0x3f')){var _0x377e86={};_0x377e86[_0x5d750f['name']]={'$like':'%'+_0x531f05['query']['filter']+'%'};return _0x377e86;}})});}_0x1a7a1b=_['merge']({},_0x1a7a1b,_0x531f05[_0xcfdf('0x40')]);var _0x1ee525={'where':_0x1a7a1b[_0xcfdf('0x3c')]};return db[_0xcfdf('0x2d')][_0xcfdf('0x1e')](_0x1ee525)['then'](function(_0x3fe79d){_0x771ccd[_0xcfdf('0x1e')]=_0x3fe79d;if(_0x531f05[_0xcfdf('0x34')][_0xcfdf('0x41')]){_0x1a7a1b['include']=[{'all':!![]}];}return db[_0xcfdf('0x2d')][_0xcfdf('0x42')](_0x1a7a1b);})[_0xcfdf('0x28')](function(_0x5bb6e3){_0x771ccd[_0xcfdf('0x43')]=_0x5bb6e3;return _0x771ccd;})[_0xcfdf('0x28')](respondWithFilteredResult(_0x50b8d6,_0x1a7a1b))[_0xcfdf('0x44')](handleError(_0x50b8d6,null));};exports['show']=function(_0x3591d2,_0x2e0ee8){var _0x1d3b95={'raw':!![],'where':{'id':_0x3591d2[_0xcfdf('0x45')]['id']}},_0x5b934b={};_0x5b934b[_0xcfdf('0x32')]=_[_0xcfdf('0x35')](db[_0xcfdf('0x2d')][_0xcfdf('0x2e')]);_0x5b934b[_0xcfdf('0x34')]=_['keys'](_0x3591d2[_0xcfdf('0x34')]);_0x5b934b[_0xcfdf('0x3d')]=_[_0xcfdf('0x46')](_0x5b934b[_0xcfdf('0x32')],_0x5b934b[_0xcfdf('0x34')]);_0x1d3b95['attributes']=_['intersection'](_0x5b934b[_0xcfdf('0x32')],qs[_0xcfdf('0x37')](_0x3591d2['query'][_0xcfdf('0x37')]));_0x1d3b95['attributes']=_0x1d3b95[_0xcfdf('0x36')][_0xcfdf('0x38')]?_0x1d3b95[_0xcfdf('0x36')]:_0x5b934b[_0xcfdf('0x32')];if(_0x3591d2[_0xcfdf('0x34')]['includeAll']){_0x1d3b95[_0xcfdf('0x47')]=[{'all':!![]}];}_0x1d3b95=_['merge']({},_0x1d3b95,_0x3591d2[_0xcfdf('0x40')]);return db[_0xcfdf('0x2d')][_0xcfdf('0x48')](_0x1d3b95)[_0xcfdf('0x28')](handleEntityNotFound(_0x2e0ee8,null))[_0xcfdf('0x28')](respondWithResult(_0x2e0ee8,null))[_0xcfdf('0x44')](handleError(_0x2e0ee8,null));};exports[_0xcfdf('0x49')]=function(_0x584753,_0x20109d){return db[_0xcfdf('0x2d')]['create'](_0x584753[_0xcfdf('0x4a')],{})[_0xcfdf('0x28')](respondWithResult(_0x20109d,0xc9))[_0xcfdf('0x44')](handleError(_0x20109d,null));};exports['update']=function(_0x3e168c,_0x13534a){if(_0x3e168c[_0xcfdf('0x4a')]['id']){delete _0x3e168c[_0xcfdf('0x4a')]['id'];}return db[_0xcfdf('0x2d')][_0xcfdf('0x48')]({'where':{'id':_0x3e168c[_0xcfdf('0x45')]['id']}})[_0xcfdf('0x28')](handleEntityNotFound(_0x13534a,null))['then'](saveUpdates(_0x3e168c[_0xcfdf('0x4a')],null))['then'](respondWithResult(_0x13534a,null))['catch'](handleError(_0x13534a,null));};exports[_0xcfdf('0x27')]=function(_0x3c9dbd,_0x1b37c3){return db[_0xcfdf('0x2d')][_0xcfdf('0x48')]({'where':{'id':_0x3c9dbd[_0xcfdf('0x45')]['id']}})[_0xcfdf('0x28')](handleEntityNotFound(_0x1b37c3,null))[_0xcfdf('0x28')](removeEntity(_0x1b37c3,null))[_0xcfdf('0x44')](handleError(_0x1b37c3,null));};exports[_0xcfdf('0x4b')]=function(_0x400012,_0x365fdc){return db['VoiceDialReport']['describe']()[_0xcfdf('0x28')](respondWithResult(_0x365fdc,null))[_0xcfdf('0x44')](handleError(_0x365fdc,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 45e3197..61a6a07 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 _0xa540=['uniqueid','lodash','../../config/logger','api','moment','rimraf','../../config/environment','exports','define','VoiceDialReport'];(function(_0x48bc10,_0x861fe9){var _0x240a7f=function(_0xf68758){while(--_0xf68758){_0x48bc10['push'](_0x48bc10['shift']());}};_0x240a7f(++_0x861fe9);}(_0xa540,0xd3));var _0x0a54=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa540[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var logger=require(_0x0a54('0x1'))(_0x0a54('0x2'));var moment=require(_0x0a54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a54('0x4'));var config=require(_0x0a54('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x0a54('0x6')]=function(_0x372681,_0x185102){return _0x372681[_0x0a54('0x7')](_0x0a54('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x0a54('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f91=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','../../config/logger','api','moment'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0x3f91,0x99));var _0x13f9=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3f91[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13f9('0x0'))(_0x13f9('0x1'));var moment=require(_0x13f9('0x2'));var BPromise=require('bluebird');var rp=require(_0x13f9('0x3'));var fs=require('fs');var path=require(_0x13f9('0x4'));var rimraf=require(_0x13f9('0x5'));var config=require(_0x13f9('0x6'));var attributes=require(_0x13f9('0x7'));module[_0x13f9('0x8')]=function(_0x5b6ad9,_0x537190){return _0x5b6ad9[_0x13f9('0x9')](_0x13f9('0xa'),attributes,{'tableName':_0x13f9('0xb'),'paranoid':![],'indexes':[{'fields':[_0x13f9('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 9a985f3..79a4432 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 _0xa677=['stringify','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x56368b,_0x30ead6){var _0x3d5979=function(_0x49ab3a){while(--_0x49ab3a){_0x56368b['push'](_0x56368b['shift']());}};_0x3d5979(++_0x30ead6);}(_0xa677,0x1f1));var _0x7a67=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xa677[_0x5a99db];return _0x3aad62;};'use strict';var _=require(_0x7a67('0x0'));var util=require(_0x7a67('0x1'));var moment=require(_0x7a67('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a67('0x3'));var db=require(_0x7a67('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a67('0x5'))(_0x7a67('0x6'));var config=require(_0x7a67('0x7'));var jayson=require(_0x7a67('0x8'));var client=jayson[_0x7a67('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7ad9f,_0x22d3f0,_0x5addd5){return new BPromise(function(_0x5831a1,_0x2fafd6){return client[_0x7a67('0xa')](_0xc7ad9f,_0x5addd5)['then'](function(_0x50477c){logger[_0x7a67('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x22d3f0,_0x7a67('0xc'));logger[_0x7a67('0xd')](_0x7a67('0xe'),_0x22d3f0,'request\x20sent',JSON[_0x7a67('0xf')](_0x50477c));if(_0x50477c[_0x7a67('0x10')]){if(_0x50477c[_0x7a67('0x10')]['code']===0x1f4){logger[_0x7a67('0x10')](_0x7a67('0x11'),_0x22d3f0,_0x50477c[_0x7a67('0x10')]['message']);return _0x2fafd6(_0x50477c[_0x7a67('0x10')][_0x7a67('0x12')]);}logger[_0x7a67('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x22d3f0,_0x50477c[_0x7a67('0x10')][_0x7a67('0x12')]);return _0x5831a1(_0x50477c['error']['message']);}else{logger[_0x7a67('0xb')](_0x7a67('0x11'),_0x22d3f0,_0x7a67('0xc'));_0x5831a1(_0x50477c['result'][_0x7a67('0x12')]);}})[_0x7a67('0x13')](function(_0x5225ad){logger[_0x7a67('0x10')](_0x7a67('0x11'),_0x22d3f0,_0x5225ad);_0x2fafd6(_0x5225ad);});});}exports[_0x7a67('0x14')]=function(_0x512541){var _0x4f9000=this;return new Promise(function(_0x46e411,_0x2975ba){return db[_0x7a67('0x15')][_0x7a67('0x16')](_0x512541[_0x7a67('0x17')],{'raw':_0x512541[_0x7a67('0x18')]?_0x512541[_0x7a67('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7a67('0x19')](function(_0x133e01){logger[_0x7a67('0xb')](_0x7a67('0x14'),_0x512541);logger[_0x7a67('0xd')]('CreateVoiceDialReport',_0x512541,JSON['stringify'](_0x133e01));_0x46e411(_0x133e01);})[_0x7a67('0x13')](function(_0x26e472){logger['error'](_0x7a67('0x14'),_0x26e472[_0x7a67('0x12')],_0x512541);_0x2975ba(_0x4f9000[_0x7a67('0x10')](0x1f4,_0x26e472[_0x7a67('0x12')]));});});};exports[_0x7a67('0x1a')]=function(_0x46260e){var _0x3a20d4=this;return new Promise(function(_0x3bfe12,_0x2194cd){return db[_0x7a67('0x15')][_0x7a67('0x1b')](_0x46260e[_0x7a67('0x17')],{'raw':_0x46260e['options']?_0x46260e[_0x7a67('0x18')][_0x7a67('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46260e[_0x7a67('0x18')]?_0x46260e['options'][_0x7a67('0x1d')]||null:null,'attributes':_0x46260e[_0x7a67('0x18')]?_0x46260e[_0x7a67('0x18')][_0x7a67('0x1e')]||null:null,'limit':_0x46260e['options']?_0x46260e[_0x7a67('0x18')][_0x7a67('0x1f')]||null:null})[_0x7a67('0x19')](function(_0x514aed){logger['info'](_0x7a67('0x1a'),_0x46260e);logger[_0x7a67('0xd')](_0x7a67('0x1a'),_0x46260e,JSON[_0x7a67('0xf')](_0x514aed));_0x3bfe12(_0x514aed);})[_0x7a67('0x13')](function(_0x14bd72){logger[_0x7a67('0x10')](_0x7a67('0x1a'),_0x14bd72[_0x7a67('0x12')],_0x46260e);_0x2194cd(_0x3a20d4[_0x7a67('0x10')](0x1f4,_0x14bd72[_0x7a67('0x12')]));});});}; \ No newline at end of file +var _0x1483=['UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x1483,0x85));var _0x3148=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x1483[_0x38b2d9];return _0x23a3e1;};'use strict';var _=require(_0x3148('0x0'));var util=require(_0x3148('0x1'));var moment=require('moment');var BPromise=require(_0x3148('0x2'));var rs=require(_0x3148('0x3'));var fs=require('fs');var Redis=require(_0x3148('0x4'));var db=require(_0x3148('0x5'))['db'];var utils=require(_0x3148('0x6'));var logger=require(_0x3148('0x7'))('rpc');var config=require(_0x3148('0x8'));var jayson=require(_0x3148('0x9'));var client=jayson['client'][_0x3148('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f43d,_0x15efe4,_0xafe15b){return new BPromise(function(_0x110dbf,_0x28f63a){return client[_0x3148('0xb')](_0x40f43d,_0xafe15b)['then'](function(_0x2c7a15){logger[_0x3148('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x15efe4,_0x3148('0xd'));logger[_0x3148('0xe')](_0x3148('0xf'),_0x15efe4,_0x3148('0xd'),JSON[_0x3148('0x10')](_0x2c7a15));if(_0x2c7a15[_0x3148('0x11')]){if(_0x2c7a15[_0x3148('0x11')]['code']===0x1f4){logger[_0x3148('0x11')](_0x3148('0x12'),_0x15efe4,_0x2c7a15[_0x3148('0x11')][_0x3148('0x13')]);return _0x28f63a(_0x2c7a15[_0x3148('0x11')][_0x3148('0x13')]);}logger[_0x3148('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x15efe4,_0x2c7a15['error'][_0x3148('0x13')]);return _0x110dbf(_0x2c7a15[_0x3148('0x11')][_0x3148('0x13')]);}else{logger[_0x3148('0xc')](_0x3148('0x12'),_0x15efe4,_0x3148('0xd'));_0x110dbf(_0x2c7a15['result'][_0x3148('0x13')]);}})[_0x3148('0x14')](function(_0x24acfc){logger[_0x3148('0x11')](_0x3148('0x12'),_0x15efe4,_0x24acfc);_0x28f63a(_0x24acfc);});});}exports[_0x3148('0x15')]=function(_0x2decaa){var _0x3f46f4=this;return new Promise(function(_0x48097a,_0x8afe5){return db[_0x3148('0x16')][_0x3148('0x17')](_0x2decaa[_0x3148('0x18')],{'raw':_0x2decaa[_0x3148('0x19')]?_0x2decaa[_0x3148('0x19')][_0x3148('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x19ef47){logger['info'](_0x3148('0x15'),_0x2decaa);logger[_0x3148('0xe')](_0x3148('0x15'),_0x2decaa,JSON[_0x3148('0x10')](_0x19ef47));_0x48097a(_0x19ef47);})[_0x3148('0x14')](function(_0x432070){logger['error'](_0x3148('0x15'),_0x432070[_0x3148('0x13')],_0x2decaa);_0x8afe5(_0x3f46f4['error'](0x1f4,_0x432070[_0x3148('0x13')]));});});};exports[_0x3148('0x1b')]=function(_0x3b3e68){var _0x58bdff=this;return new Promise(function(_0x3c5638,_0x592b7e){return db['VoiceDialReport'][_0x3148('0x1c')](_0x3b3e68[_0x3148('0x18')],{'raw':_0x3b3e68[_0x3148('0x19')]?_0x3b3e68[_0x3148('0x19')][_0x3148('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b3e68[_0x3148('0x19')]?_0x3b3e68[_0x3148('0x19')][_0x3148('0x1d')]||null:null,'attributes':_0x3b3e68[_0x3148('0x19')]?_0x3b3e68['options'][_0x3148('0x1e')]||null:null,'limit':_0x3b3e68[_0x3148('0x19')]?_0x3b3e68['options'][_0x3148('0x1f')]||null:null})['then'](function(_0x10fd93){logger['info'](_0x3148('0x1b'),_0x3b3e68);logger[_0x3148('0xe')](_0x3148('0x1b'),_0x3b3e68,JSON['stringify'](_0x10fd93));_0x3c5638(_0x10fd93);})[_0x3148('0x14')](function(_0x2ecd40){logger[_0x3148('0x11')](_0x3148('0x1b'),_0x2ecd40[_0x3148('0x13')],_0x3b3e68);_0x592b7e(_0x58bdff[_0x3148('0x11')](0x1f4,_0x2ecd40['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 832bb1e..c7bacef 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 _0xaca9=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete'];(function(_0x531c19,_0x488e29){var _0x335604=function(_0x536d39){while(--_0x536d39){_0x531c19['push'](_0x531c19['shift']());}};_0x335604(++_0x488e29);}(_0xaca9,0x65));var _0x9aca=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xaca9[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0x9aca('0x0'));var util=require(_0x9aca('0x1'));var path=require(_0x9aca('0x2'));var timeout=require(_0x9aca('0x3'));var express=require('express');var router=express[_0x9aca('0x4')]();var fs_extra=require(_0x9aca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9aca('0x6'));var config=require(_0x9aca('0x7'));var controller=require('./voiceExtension.controller');router[_0x9aca('0x8')]('/',auth['isAuthenticated'](),controller[_0x9aca('0x9')]);router[_0x9aca('0x8')](_0x9aca('0xa'),auth[_0x9aca('0xb')](),controller[_0x9aca('0xc')]);router[_0x9aca('0xd')]('/',auth['isAuthenticated'](),controller[_0x9aca('0xe')]);router[_0x9aca('0xd')]('/:id/applications',auth[_0x9aca('0xb')](),controller[_0x9aca('0xf')]);router[_0x9aca('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9aca('0x11')]);router[_0x9aca('0x12')](_0x9aca('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9aca('0x13')]=router; \ No newline at end of file +var _0x8fea=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8fea,0x1d1));var _0xa8fe=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0x8fea[_0x28278f];return _0x3d9f74;};'use strict';var multer=require(_0xa8fe('0x0'));var util=require(_0xa8fe('0x1'));var path=require(_0xa8fe('0x2'));var timeout=require(_0xa8fe('0x3'));var express=require(_0xa8fe('0x4'));var router=express[_0xa8fe('0x5')]();var fs_extra=require(_0xa8fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa8fe('0x7'));var config=require('../../config/environment');var controller=require(_0xa8fe('0x8'));router[_0xa8fe('0x9')]('/',auth[_0xa8fe('0xa')](),controller[_0xa8fe('0xb')]);router[_0xa8fe('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa8fe('0xc')]);router['post']('/',auth[_0xa8fe('0xa')](),controller[_0xa8fe('0xd')]);router[_0xa8fe('0xe')](_0xa8fe('0xf'),auth[_0xa8fe('0xa')](),controller[_0xa8fe('0x10')]);router[_0xa8fe('0x11')]('/:id',auth[_0xa8fe('0xa')](),controller[_0xa8fe('0x12')]);router[_0xa8fe('0x13')](_0xa8fe('0x14'),auth[_0xa8fe('0xa')](),controller[_0xa8fe('0x15')]);module[_0xa8fe('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 83ae61f..d040816 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 _0xd870=['inbound','outbound','internal','outbound-fax','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exports','STRING','compositeIndex','NoOp'];(function(_0x2d53e2,_0x5909b4){var _0x451597=function(_0xf8263){while(--_0xf8263){_0x2d53e2['push'](_0x2d53e2['shift']());}};_0x451597(++_0x5909b4);}(_0xd870,0xea));var _0x0d87=function(_0x2337fb,_0x3a47d8){_0x2337fb=_0x2337fb-0x0;var _0xd52f81=_0xd870[_0x2337fb];return _0xd52f81;};'use strict';var Sequelize=require('sequelize');module[_0x0d87('0x0')]={'context':{'type':Sequelize[_0x0d87('0x1')],'allowNull':![],'unique':_0x0d87('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0d87('0x1')],'allowNull':![],'unique':_0x0d87('0x2')},'priority':{'type':Sequelize[_0x0d87('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x0d87('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d87('0x1')],'allowNull':![],'defaultValue':_0x0d87('0x3')},'appdata':{'type':Sequelize[_0x0d87('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0d87('0x4'),_0x0d87('0x5'),_0x0d87('0x6'),'inbound-fax',_0x0d87('0x7'),'system',_0x0d87('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x0d87('0x1')]},'interval':{'type':Sequelize[_0x0d87('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x0d87('0x9')]},'isApp':{'type':Sequelize[_0x0d87('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d87('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d87('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0d87('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d87('0x9')]},'recordingFormat':{'type':Sequelize[_0x0d87('0x1')],'defaultValue':_0x0d87('0xb')},'answer':{'type':Sequelize[_0x0d87('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d87('0xc')],'get':function(_0x32a8df){return this[_0x0d87('0xd')]('exten');}},'alias':{'type':Sequelize[_0x0d87('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x7fbf=['inbound','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7fbf,0xaa));var _0xf7fb=function(_0x3a60dd,_0x3345f9){_0x3a60dd=_0x3a60dd-0x0;var _0x581cae=_0x7fbf[_0x3a60dd];return _0x581cae;};'use strict';var Sequelize=require(_0xf7fb('0x0'));module[_0xf7fb('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7fb('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf7fb('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xf7fb('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf7fb('0x3')],'allowNull':![],'defaultValue':_0xf7fb('0x4')},'appdata':{'type':Sequelize[_0xf7fb('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf7fb('0x5')](_0xf7fb('0x6'),'outbound','internal',_0xf7fb('0x7'),'outbound-fax',_0xf7fb('0x8'),_0xf7fb('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xf7fb('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf7fb('0xa')},'IntervalId':{'type':Sequelize[_0xf7fb('0xb')]},'isApp':{'type':Sequelize[_0xf7fb('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf7fb('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf7fb('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xf7fb('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf7fb('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xf7fb('0xd')},'answer':{'type':Sequelize[_0xf7fb('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf7fb('0xe')],'get':function(_0x1e7525){return this['getDataValue'](_0xf7fb('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index cf32b6d..53ac5ae 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 _0x2100=['destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','then','error','stack','send','fieldName','key','model','query','filters','intersection','attributes','length','order','sort','where','merge','VIRTUAL','options','VoiceExtension','rows','catch','show','params','keys','fields','includeAll','include','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','isApp','createRouting','log','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x21930b,_0x2b6d6c){var _0x32033d=function(_0x59cc72){while(--_0x59cc72){_0x21930b['push'](_0x21930b['shift']());}};_0x32033d(++_0x2b6d6c);}(_0x2100,0x9f));var _0x0210=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x2100[_0x406115];return _0xbbabdb;};'use strict';var _=require(_0x0210('0x0'));var Redis=require(_0x0210('0x1'));var qs=require(_0x0210('0x2'));var logger=require(_0x0210('0x3'))(_0x0210('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0210('0x5')]=_[_0x0210('0x6')](config[_0x0210('0x5')],{'host':_0x0210('0x7'),'port':0x18eb});var socket=require(_0x0210('0x8'))(new Redis(config[_0x0210('0x5')]));require(_0x0210('0x9'))[_0x0210('0xa')](socket);function respondWithStatusCode(_0x231401,_0x36a008){_0x36a008=_0x36a008||0xcc;return function(_0x48faf4){if(_0x48faf4){return _0x231401[_0x0210('0xb')](_0x36a008);}return _0x231401['status'](_0x36a008)[_0x0210('0xc')]();};}function respondWithResult(_0x3dc2c0,_0x22f04a){_0x22f04a=_0x22f04a||0xc8;return function(_0x11c6f2){if(_0x11c6f2){return _0x3dc2c0[_0x0210('0xd')](_0x22f04a)[_0x0210('0xe')](_0x11c6f2);}};}function respondWithFilteredResult(_0x80ad49,_0x1b42a3){return function(_0x31cc62){if(_0x31cc62){var _0x5a99f4=typeof _0x1b42a3[_0x0210('0xf')]===_0x0210('0x10')&&typeof _0x1b42a3[_0x0210('0x11')]==='undefined';var _0x5c26fd=_0x31cc62['count'];var _0x50de42=_0x5a99f4?0x0:_0x1b42a3[_0x0210('0xf')];var _0x14346f=_0x5a99f4?_0x31cc62[_0x0210('0x12')]:_0x1b42a3[_0x0210('0xf')]+_0x1b42a3[_0x0210('0x11')];var _0x518133;if(_0x14346f>=_0x5c26fd){_0x14346f=_0x5c26fd;_0x518133=0xc8;}else{_0x518133=0xce;}_0x80ad49[_0x0210('0xd')](_0x518133);return _0x80ad49[_0x0210('0x13')](_0x0210('0x14'),_0x50de42+'-'+_0x14346f+'/'+_0x5c26fd)[_0x0210('0xe')](_0x31cc62);}return null;};}function removeEntity(_0x2a6f79){return function(_0xa5e4ca){if(_0xa5e4ca){return _0xa5e4ca[_0x0210('0x15')]()['then'](function(){var _0xa1263a=_0xa5e4ca[_0x0210('0x16')]({'plain':!![]});var _0x355515=[{'name':_0x0210('0x17'),'value':_0x0210('0x18'),'ignore':![]},{'name':'OutboundRoutes','value':_0x0210('0x19'),'ignore':![]},{'name':_0x0210('0x1a'),'value':_0x0210('0x1b'),'ignore':![]}];var _0x53b1df=_(_0x355515)[_0x0210('0x1c')](_0x0210('0x1d'))[_0x0210('0x1e')](_0x0210('0x1f'))[_0x0210('0x1f')]();if(_['includes'](_0x53b1df,_0xa1263a[_0x0210('0x20')])){return;}var _0xc63c67=_[_0x0210('0x21')](_0x355515,['value',_0xa1263a[_0x0210('0x20')]])[_0x0210('0x22')];return db[_0x0210('0x23')][_0x0210('0x15')]({'where':{'type':_0xc63c67,'resourceId':_0xa1263a['id']}})[_0x0210('0x24')](function(){return _0xa5e4ca;});})[_0x0210('0x24')](function(){_0x2a6f79[_0x0210('0xd')](0xcc)[_0x0210('0xc')]();});}};}function handleEntityNotFound(_0xfd4bab){return function(_0x1c86d2){if(!_0x1c86d2){_0xfd4bab[_0x0210('0xb')](0x194);}return _0x1c86d2;};}function handleError(_0x22004f,_0xbd71bc){_0xbd71bc=_0xbd71bc||0x1f4;return function(_0x37a3be){logger[_0x0210('0x25')](_0x37a3be[_0x0210('0x26')]);if(_0x37a3be['name']){delete _0x37a3be[_0x0210('0x22')];}_0x22004f['status'](_0xbd71bc)[_0x0210('0x27')](_0x37a3be);};}exports['index']=function(_0x479281,_0x34f6e2){var _0x5c364b={},_0xfe0d79={},_0x4ca9ba={'count':0x0,'rows':[]};var _0x3ce5f7=_[_0x0210('0x1e')](db['VoiceExtension']['rawAttributes'],function(_0x530f82){return{'name':_0x530f82[_0x0210('0x28')],'type':_0x530f82['type'][_0x0210('0x29')]};});_0xfe0d79[_0x0210('0x2a')]=_[_0x0210('0x1e')](_0x3ce5f7,_0x0210('0x22'));_0xfe0d79[_0x0210('0x2b')]=_['keys'](_0x479281[_0x0210('0x2b')]);_0xfe0d79[_0x0210('0x2c')]=_[_0x0210('0x2d')](_0xfe0d79[_0x0210('0x2a')],_0xfe0d79[_0x0210('0x2b')]);_0x5c364b[_0x0210('0x2e')]=_[_0x0210('0x2d')](_0xfe0d79[_0x0210('0x2a')],qs['fields'](_0x479281[_0x0210('0x2b')]['fields']));_0x5c364b[_0x0210('0x2e')]=_0x5c364b[_0x0210('0x2e')][_0x0210('0x2f')]?_0x5c364b[_0x0210('0x2e')]:_0xfe0d79[_0x0210('0x2a')];if(!_0x479281[_0x0210('0x2b')]['hasOwnProperty']('nolimit')){_0x5c364b[_0x0210('0x11')]=qs[_0x0210('0x11')](_0x479281[_0x0210('0x2b')][_0x0210('0x11')]);_0x5c364b[_0x0210('0xf')]=qs[_0x0210('0xf')](_0x479281['query'][_0x0210('0xf')]);}_0x5c364b[_0x0210('0x30')]=qs[_0x0210('0x31')](_0x479281[_0x0210('0x2b')]['sort']);_0x5c364b['where']=qs[_0x0210('0x2c')](_['pick'](_0x479281[_0x0210('0x2b')],_0xfe0d79[_0x0210('0x2c')]),_0x3ce5f7);if(_0x479281[_0x0210('0x2b')][_0x0210('0x1c')]){_0x5c364b[_0x0210('0x32')]=_[_0x0210('0x33')](_0x5c364b['where'],{'$or':_['map'](_0x3ce5f7,function(_0x3eb3ba){if(_0x3eb3ba['type']!==_0x0210('0x34')){var _0x151507={};_0x151507[_0x3eb3ba[_0x0210('0x22')]]={'$like':'%'+_0x479281['query'][_0x0210('0x1c')]+'%'};return _0x151507;}})});}_0x5c364b=_[_0x0210('0x33')]({},_0x5c364b,_0x479281[_0x0210('0x35')]);var _0x11c4f9={'where':_0x5c364b['where']};return db[_0x0210('0x36')][_0x0210('0x12')](_0x11c4f9)[_0x0210('0x24')](function(_0x47f79e){_0x4ca9ba[_0x0210('0x12')]=_0x47f79e;if(_0x479281[_0x0210('0x2b')]['includeAll']){_0x5c364b['include']=[{'all':!![]}];}return db[_0x0210('0x36')]['findAll'](_0x5c364b);})[_0x0210('0x24')](function(_0x2e344f){_0x4ca9ba[_0x0210('0x37')]=_0x2e344f;return _0x4ca9ba;})[_0x0210('0x24')](respondWithFilteredResult(_0x34f6e2,_0x5c364b))[_0x0210('0x38')](handleError(_0x34f6e2,null));};exports[_0x0210('0x39')]=function(_0x2c5e34,_0x5f3ff6){var _0x21ba74={'raw':![],'where':{'id':_0x2c5e34[_0x0210('0x3a')]['id']}},_0x78eebc={};_0x78eebc['model']=_['keys'](db[_0x0210('0x36')]['rawAttributes']);_0x78eebc[_0x0210('0x2b')]=_[_0x0210('0x3b')](_0x2c5e34[_0x0210('0x2b')]);_0x78eebc[_0x0210('0x2c')]=_[_0x0210('0x2d')](_0x78eebc[_0x0210('0x2a')],_0x78eebc['query']);_0x21ba74[_0x0210('0x2e')]=_[_0x0210('0x2d')](_0x78eebc[_0x0210('0x2a')],qs['fields'](_0x2c5e34[_0x0210('0x2b')][_0x0210('0x3c')]));_0x21ba74['attributes']=_0x21ba74['attributes']['length']?_0x21ba74[_0x0210('0x2e')]:_0x78eebc[_0x0210('0x2a')];if(_0x2c5e34[_0x0210('0x2b')][_0x0210('0x3d')]){_0x21ba74[_0x0210('0x3e')]=[{'all':!![]}];}_0x21ba74=_[_0x0210('0x33')]({},_0x21ba74,_0x2c5e34['options']);return db[_0x0210('0x36')]['find'](_0x21ba74)[_0x0210('0x24')](handleEntityNotFound(_0x5f3ff6,null))[_0x0210('0x24')](respondWithResult(_0x5f3ff6,null))[_0x0210('0x38')](handleError(_0x5f3ff6,null));};exports['destroy']=function(_0x13274f,_0xf116f){return db[_0x0210('0x36')][_0x0210('0x21')]({'where':{'id':_0x13274f[_0x0210('0x3a')]['id']}})[_0x0210('0x24')](handleEntityNotFound(_0xf116f,null))[_0x0210('0x24')](removeEntity(_0xf116f,null))[_0x0210('0x38')](handleError(_0xf116f,null));};exports[_0x0210('0x3f')]=function(_0x41fcab,_0x3854cc){if(_0x41fcab[_0x0210('0x40')][_0x0210('0x20')]===_0x0210('0x19')&&!_[_0x0210('0x41')](_0x41fcab[_0x0210('0x40')]['exten'],'_')){_0x41fcab['body'][_0x0210('0x42')]='_'['concat'](_0x41fcab[_0x0210('0x40')][_0x0210('0x42')]);}return db[_0x0210('0x36')]['create'](_0x41fcab[_0x0210('0x40')],{'raw':![]})[_0x0210('0x24')](function(_0xffaa55){var _0x36859b=_0x41fcab[_0x0210('0x43')]['get']({'plain':!![]});if(!_0x36859b)throw new Error(_0x0210('0x44'));if(_0x36859b['role']===_0x0210('0x43')){var _0x298c55=_0xffaa55[_0x0210('0x16')]({'plain':!![]});var _0x21b292=[{'name':'InboundRoutes','value':_0x0210('0x18')},{'name':_0x0210('0x45'),'value':_0x0210('0x19')},{'name':'InternalRoutes','value':'internal'}];var _0x595f83=_[_0x0210('0x21')](_0x21b292,[_0x0210('0x1f'),_0x298c55[_0x0210('0x20')]])['name'];return db[_0x0210('0x46')][_0x0210('0x21')]({'where':{'name':_0x595f83,'userProfileId':_0x36859b[_0x0210('0x47')]},'raw':!![]})['then'](function(_0x32e690){if(_0x32e690&&_0x32e690['autoAssociation']===0x0){return db[_0x0210('0x23')]['create']({'name':_0x298c55[_0x0210('0x22')],'resourceId':_0x298c55['id'],'type':_0x32e690[_0x0210('0x22')],'sectionId':_0x32e690['id']},{})[_0x0210('0x24')](function(){return _0xffaa55;});}else{return _0xffaa55;}})[_0x0210('0x38')](function(_0x539229){logger[_0x0210('0x25')](_0x0210('0x48'),_0x539229);throw _0x539229;});}return _0xffaa55;})[_0x0210('0x24')](respondWithResult(_0x3854cc,0xc9))[_0x0210('0x38')](handleError(_0x3854cc,null));};exports['update']=function(_0x2402ba,_0x453f5){if(_0x2402ba[_0x0210('0x40')]['id']){delete _0x2402ba['body']['id'];}return db[_0x0210('0x36')][_0x0210('0x21')]({'where':{'id':_0x2402ba['params']['id']}})[_0x0210('0x24')](handleEntityNotFound(_0x453f5,null))[_0x0210('0x24')](function(_0x2d3038){if(_0x2d3038){return db[_0x0210('0x36')][_0x0210('0x49')](_[_0x0210('0x4a')](_0x2402ba[_0x0210('0x40')],[_0x0210('0x42'),_0x0210('0x4b'),_0x0210('0x4c'),_0x0210('0x4d'),_0x0210('0x4e'),_0x0210('0x4f'),_0x0210('0x50')]),{'where':{'context':_0x2d3038[_0x0210('0x4b')],'exten':_0x2d3038['exten']},'individualHooks':!![]})[_0x0210('0x24')](function(_0x368310){return _0x368310;});}return null;})[_0x0210('0x24')](respondWithStatusCode(_0x453f5,null))['catch'](handleError(_0x453f5,null));};exports[_0x0210('0x51')]=function(_0xb1d48c,_0x5bd0f2){return db['VoiceExtension'][_0x0210('0x52')]({'where':{'id':_0xb1d48c[_0x0210('0x3a')]['id']}})[_0x0210('0x24')](function(_0x2e6d92){if(_0x2e6d92){return db[_0x0210('0x53')]['transaction'](function(_0x4ececd){return db['VoiceExtension'][_0x0210('0x15')]({'where':{'VoiceExtensionId':_0xb1d48c[_0x0210('0x3a')]['id']},'transaction':_0x4ececd})['then'](function(){var _0xe11c45=_[_0x0210('0x1e')](_0xb1d48c['body'],function(_0x15bdff){_0x15bdff['VoiceExtensionId']=_0xb1d48c[_0x0210('0x3a')]['id'];_0x15bdff[_0x0210('0x54')]=!![];return _0x15bdff;});return _0x2e6d92[_0x0210('0x55')](_0xe11c45);})[_0x0210('0x24')](function(_0x5552db){console[_0x0210('0x56')]('LOG\x20~\x20.then\x20~\x20routing',_0x5552db);return db['VoiceExtension'][_0x0210('0x57')](_0x5552db,{'transaction':_0x4ececd});});})[_0x0210('0x24')](function(){return db['VoiceExtension'][_0x0210('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0xb1d48c[_0x0210('0x3a')]['id']},'order':_0x0210('0x59')});});}})[_0x0210('0x24')](respondWithResult(_0x5bd0f2,null))[_0x0210('0x38')](handleError(_0x5bd0f2,null));}; \ No newline at end of file +var _0x46c2=['update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','findOne','sequelize','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./voiceExtension.socket','register','sendStatus','end','offset','undefined','count','set','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','status','index','VoiceExtension','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','merge','options','include','rows','catch','show','params','keys','includeAll','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x445e2f,_0x29f35e){var _0x443f61=function(_0x4c7a70){while(--_0x4c7a70){_0x445e2f['push'](_0x445e2f['shift']());}};_0x443f61(++_0x29f35e);}(_0x46c2,0x180));var _0x246c=function(_0x5186be,_0x560353){_0x5186be=_0x5186be-0x0;var _0x2b278b=_0x46c2[_0x5186be];return _0x2b278b;};'use strict';var _=require(_0x246c('0x0'));var Redis=require(_0x246c('0x1'));var qs=require(_0x246c('0x2'));var logger=require(_0x246c('0x3'))(_0x246c('0x4'));var config=require(_0x246c('0x5'));var db=require(_0x246c('0x6'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x246c('0x7')]));require(_0x246c('0x8'))[_0x246c('0x9')](socket);function respondWithStatusCode(_0x1c584d,_0x5492f5){_0x5492f5=_0x5492f5||0xcc;return function(_0x356bda){if(_0x356bda){return _0x1c584d[_0x246c('0xa')](_0x5492f5);}return _0x1c584d['status'](_0x5492f5)[_0x246c('0xb')]();};}function respondWithResult(_0x29e920,_0x4ab007){_0x4ab007=_0x4ab007||0xc8;return function(_0x549764){if(_0x549764){return _0x29e920['status'](_0x4ab007)['json'](_0x549764);}};}function respondWithFilteredResult(_0x492ab9,_0x555622){return function(_0xf30d80){if(_0xf30d80){var _0x388a98=typeof _0x555622[_0x246c('0xc')]===_0x246c('0xd')&&typeof _0x555622['limit']==='undefined';var _0xa3849=_0xf30d80[_0x246c('0xe')];var _0x27be26=_0x388a98?0x0:_0x555622[_0x246c('0xc')];var _0x37cee3=_0x388a98?_0xf30d80[_0x246c('0xe')]:_0x555622[_0x246c('0xc')]+_0x555622['limit'];var _0x2dd446;if(_0x37cee3>=_0xa3849){_0x37cee3=_0xa3849;_0x2dd446=0xc8;}else{_0x2dd446=0xce;}_0x492ab9['status'](_0x2dd446);return _0x492ab9[_0x246c('0xf')]('Content-Range',_0x27be26+'-'+_0x37cee3+'/'+_0xa3849)[_0x246c('0x10')](_0xf30d80);}return null;};}function removeEntity(_0xf9e922){return function(_0x4ae7e1){if(_0x4ae7e1){return _0x4ae7e1[_0x246c('0x11')]()['then'](function(){var _0x4848aa=_0x4ae7e1[_0x246c('0x12')]({'plain':!![]});var _0x136563=[{'name':_0x246c('0x13'),'value':_0x246c('0x14'),'ignore':![]},{'name':_0x246c('0x15'),'value':_0x246c('0x16'),'ignore':![]},{'name':_0x246c('0x17'),'value':_0x246c('0x18'),'ignore':![]}];var _0x3fb06d=_(_0x136563)[_0x246c('0x19')](_0x246c('0x1a'))[_0x246c('0x1b')](_0x246c('0x1c'))[_0x246c('0x1c')]();if(_[_0x246c('0x1d')](_0x3fb06d,_0x4848aa[_0x246c('0x1e')])){return;}var _0x2734e2=_[_0x246c('0x1f')](_0x136563,[_0x246c('0x1c'),_0x4848aa[_0x246c('0x1e')]])[_0x246c('0x20')];return db[_0x246c('0x21')][_0x246c('0x11')]({'where':{'type':_0x2734e2,'resourceId':_0x4848aa['id']}})[_0x246c('0x22')](function(){return _0x4ae7e1;});})[_0x246c('0x22')](function(){_0xf9e922['status'](0xcc)[_0x246c('0xb')]();});}};}function handleEntityNotFound(_0x1802bc){return function(_0x2ca2bb){if(!_0x2ca2bb){_0x1802bc[_0x246c('0xa')](0x194);}return _0x2ca2bb;};}function handleError(_0x529071,_0x42c858){_0x42c858=_0x42c858||0x1f4;return function(_0x4544c9){logger[_0x246c('0x23')](_0x4544c9[_0x246c('0x24')]);if(_0x4544c9[_0x246c('0x20')]){delete _0x4544c9[_0x246c('0x20')];}_0x529071[_0x246c('0x25')](_0x42c858)['send'](_0x4544c9);};}exports[_0x246c('0x26')]=function(_0x2c4a49,_0x324fe3){var _0x4e3185={},_0x5259e8={},_0x4b7d5a={'count':0x0,'rows':[]};var _0x34dc8d=_[_0x246c('0x1b')](db[_0x246c('0x27')][_0x246c('0x28')],function(_0x28abb7){return{'name':_0x28abb7[_0x246c('0x29')],'type':_0x28abb7['type'][_0x246c('0x2a')]};});_0x5259e8[_0x246c('0x2b')]=_[_0x246c('0x1b')](_0x34dc8d,_0x246c('0x20'));_0x5259e8[_0x246c('0x2c')]=_['keys'](_0x2c4a49['query']);_0x5259e8['filters']=_[_0x246c('0x2d')](_0x5259e8[_0x246c('0x2b')],_0x5259e8[_0x246c('0x2c')]);_0x4e3185['attributes']=_[_0x246c('0x2d')](_0x5259e8[_0x246c('0x2b')],qs[_0x246c('0x2e')](_0x2c4a49[_0x246c('0x2c')]['fields']));_0x4e3185[_0x246c('0x2f')]=_0x4e3185[_0x246c('0x2f')]['length']?_0x4e3185[_0x246c('0x2f')]:_0x5259e8[_0x246c('0x2b')];if(!_0x2c4a49['query'][_0x246c('0x30')](_0x246c('0x31'))){_0x4e3185['limit']=qs['limit'](_0x2c4a49[_0x246c('0x2c')][_0x246c('0x32')]);_0x4e3185[_0x246c('0xc')]=qs[_0x246c('0xc')](_0x2c4a49['query'][_0x246c('0xc')]);}_0x4e3185[_0x246c('0x33')]=qs[_0x246c('0x34')](_0x2c4a49[_0x246c('0x2c')][_0x246c('0x34')]);_0x4e3185[_0x246c('0x35')]=qs[_0x246c('0x36')](_[_0x246c('0x37')](_0x2c4a49[_0x246c('0x2c')],_0x5259e8[_0x246c('0x36')]),_0x34dc8d);if(_0x2c4a49[_0x246c('0x2c')]['filter']){_0x4e3185['where']=_['merge'](_0x4e3185[_0x246c('0x35')],{'$or':_[_0x246c('0x1b')](_0x34dc8d,function(_0x1303fc){if(_0x1303fc[_0x246c('0x1e')]!==_0x246c('0x38')){var _0x50a1f4={};_0x50a1f4[_0x1303fc['name']]={'$like':'%'+_0x2c4a49[_0x246c('0x2c')]['filter']+'%'};return _0x50a1f4;}})});}_0x4e3185=_[_0x246c('0x39')]({},_0x4e3185,_0x2c4a49[_0x246c('0x3a')]);var _0xfed256={'where':_0x4e3185[_0x246c('0x35')]};return db[_0x246c('0x27')][_0x246c('0xe')](_0xfed256)[_0x246c('0x22')](function(_0x4425fa){_0x4b7d5a['count']=_0x4425fa;if(_0x2c4a49[_0x246c('0x2c')]['includeAll']){_0x4e3185[_0x246c('0x3b')]=[{'all':!![]}];}return db[_0x246c('0x27')]['findAll'](_0x4e3185);})[_0x246c('0x22')](function(_0x1b7546){_0x4b7d5a[_0x246c('0x3c')]=_0x1b7546;return _0x4b7d5a;})['then'](respondWithFilteredResult(_0x324fe3,_0x4e3185))[_0x246c('0x3d')](handleError(_0x324fe3,null));};exports[_0x246c('0x3e')]=function(_0x543f60,_0xd935c0){var _0x44124a={'raw':![],'where':{'id':_0x543f60[_0x246c('0x3f')]['id']}},_0x222e1a={};_0x222e1a[_0x246c('0x2b')]=_[_0x246c('0x40')](db[_0x246c('0x27')]['rawAttributes']);_0x222e1a[_0x246c('0x2c')]=_[_0x246c('0x40')](_0x543f60[_0x246c('0x2c')]);_0x222e1a['filters']=_[_0x246c('0x2d')](_0x222e1a[_0x246c('0x2b')],_0x222e1a[_0x246c('0x2c')]);_0x44124a[_0x246c('0x2f')]=_[_0x246c('0x2d')](_0x222e1a[_0x246c('0x2b')],qs['fields'](_0x543f60[_0x246c('0x2c')][_0x246c('0x2e')]));_0x44124a[_0x246c('0x2f')]=_0x44124a[_0x246c('0x2f')]['length']?_0x44124a['attributes']:_0x222e1a[_0x246c('0x2b')];if(_0x543f60[_0x246c('0x2c')][_0x246c('0x41')]){_0x44124a['include']=[{'all':!![]}];}_0x44124a=_[_0x246c('0x39')]({},_0x44124a,_0x543f60[_0x246c('0x3a')]);return db[_0x246c('0x27')]['find'](_0x44124a)[_0x246c('0x22')](handleEntityNotFound(_0xd935c0,null))[_0x246c('0x22')](respondWithResult(_0xd935c0,null))['catch'](handleError(_0xd935c0,null));};exports[_0x246c('0x11')]=function(_0x3f2de0,_0x5bf21a){return db[_0x246c('0x27')][_0x246c('0x1f')]({'where':{'id':_0x3f2de0['params']['id']}})['then'](handleEntityNotFound(_0x5bf21a,null))['then'](removeEntity(_0x5bf21a,null))['catch'](handleError(_0x5bf21a,null));};exports[_0x246c('0x42')]=function(_0xa2ab0b,_0x5295af){if(_0xa2ab0b[_0x246c('0x43')][_0x246c('0x1e')]===_0x246c('0x16')&&!_[_0x246c('0x44')](_0xa2ab0b[_0x246c('0x43')][_0x246c('0x45')],'_')){_0xa2ab0b[_0x246c('0x43')][_0x246c('0x45')]='_'[_0x246c('0x46')](_0xa2ab0b[_0x246c('0x43')][_0x246c('0x45')]);}return db[_0x246c('0x27')][_0x246c('0x42')](_0xa2ab0b[_0x246c('0x43')],{'raw':![]})[_0x246c('0x22')](function(_0xe6209c){var _0x167ef7=_0xa2ab0b['user'][_0x246c('0x12')]({'plain':!![]});if(!_0x167ef7)throw new Error(_0x246c('0x47'));if(_0x167ef7['role']===_0x246c('0x48')){var _0x23af88=_0xe6209c['get']({'plain':!![]});var _0x2e386c=[{'name':'InboundRoutes','value':_0x246c('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x246c('0x17'),'value':_0x246c('0x18')}];var _0x2cb8aa=_[_0x246c('0x1f')](_0x2e386c,[_0x246c('0x1c'),_0x23af88[_0x246c('0x1e')]])[_0x246c('0x20')];return db[_0x246c('0x49')]['find']({'where':{'name':_0x2cb8aa,'userProfileId':_0x167ef7['userProfileId']},'raw':!![]})[_0x246c('0x22')](function(_0x5c78d4){if(_0x5c78d4&&_0x5c78d4[_0x246c('0x4a')]===0x0){return db[_0x246c('0x21')][_0x246c('0x42')]({'name':_0x23af88[_0x246c('0x20')],'resourceId':_0x23af88['id'],'type':_0x5c78d4[_0x246c('0x20')],'sectionId':_0x5c78d4['id']},{})['then'](function(){return _0xe6209c;});}else{return _0xe6209c;}})[_0x246c('0x3d')](function(_0x4c3d33){logger[_0x246c('0x23')](_0x246c('0x4b'),_0x4c3d33);throw _0x4c3d33;});}return _0xe6209c;})[_0x246c('0x22')](respondWithResult(_0x5295af,0xc9))[_0x246c('0x3d')](handleError(_0x5295af,null));};exports[_0x246c('0x4c')]=function(_0x26a28d,_0x126d23){if(_0x26a28d[_0x246c('0x43')]['id']){delete _0x26a28d[_0x246c('0x43')]['id'];}return db[_0x246c('0x27')][_0x246c('0x1f')]({'where':{'id':_0x26a28d[_0x246c('0x3f')]['id']}})[_0x246c('0x22')](handleEntityNotFound(_0x126d23,null))[_0x246c('0x22')](function(_0x36f39a){if(_0x36f39a){return db[_0x246c('0x27')][_0x246c('0x4c')](_[_0x246c('0x37')](_0x26a28d[_0x246c('0x43')],['exten',_0x246c('0x4d'),_0x246c('0x4e'),_0x246c('0x4f'),'cutdigits',_0x246c('0x50'),_0x246c('0x51')]),{'where':{'context':_0x36f39a['context'],'exten':_0x36f39a[_0x246c('0x45')]},'individualHooks':!![]})['then'](function(_0xad43e4){return _0xad43e4;});}return null;})['then'](respondWithStatusCode(_0x126d23,null))['catch'](handleError(_0x126d23,null));};exports[_0x246c('0x52')]=function(_0x3e5304,_0x4fb20b){return db[_0x246c('0x27')][_0x246c('0x53')]({'where':{'id':_0x3e5304[_0x246c('0x3f')]['id']}})[_0x246c('0x22')](function(_0x2a87fd){if(_0x2a87fd){return db[_0x246c('0x54')]['transaction'](function(_0x1f7dbd){return db[_0x246c('0x27')][_0x246c('0x11')]({'where':{'VoiceExtensionId':_0x3e5304[_0x246c('0x3f')]['id']},'transaction':_0x1f7dbd})[_0x246c('0x22')](function(){var _0x373915=_[_0x246c('0x1b')](_0x3e5304[_0x246c('0x43')],function(_0x126a22){_0x126a22[_0x246c('0x55')]=_0x3e5304['params']['id'];_0x126a22[_0x246c('0x56')]=!![];return _0x126a22;});return _0x2a87fd[_0x246c('0x57')](_0x373915);})[_0x246c('0x22')](function(_0x5d2fc2){console[_0x246c('0x58')](_0x246c('0x59'),_0x5d2fc2);return db[_0x246c('0x27')]['bulkCreate'](_0x5d2fc2,{'transaction':_0x1f7dbd});});})[_0x246c('0x22')](function(){return db[_0x246c('0x27')][_0x246c('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3e5304[_0x246c('0x3f')]['id']},'order':_0x246c('0x5b')});});}})['then'](respondWithResult(_0x4fb20b,null))[_0x246c('0x3d')](handleError(_0x4fb20b,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3a2aedc..d697905 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 _0x89c1=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x294e11,_0x18dfd8){var _0xe1d81a=function(_0x1e68c6){while(--_0x1e68c6){_0x294e11['push'](_0x294e11['shift']());}};_0xe1d81a(++_0x18dfd8);}(_0x89c1,0xa3));var _0x189c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x89c1[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x189c('0x0'));var VoiceExtension=require(_0x189c('0x1'))['db'][_0x189c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x189c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x189c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5885fb){return function(_0x54d761,_0x27a559,_0x11c127){VoiceExtensionEvents['emit'](_0x5885fb+':'+_0x54d761['id'],_0x54d761);VoiceExtensionEvents[_0x189c('0x5')](_0x5885fb,_0x54d761);_0x11c127(null);};}for(var e in events){if(events[_0x189c('0x6')](e)){var event=events[e];VoiceExtension[_0x189c('0x7')](e,emitEvent(event));}}module[_0x189c('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb4dd=['VoiceExtension','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x4516fb,_0x5d9950){var _0x1d891c=function(_0x324800){while(--_0x324800){_0x4516fb['push'](_0x4516fb['shift']());}};_0x1d891c(++_0x5d9950);}(_0xb4dd,0x1a5));var _0xdb4d=function(_0x3656e8,_0x105208){_0x3656e8=_0x3656e8-0x0;var _0x5681b8=_0xb4dd[_0x3656e8];return _0x5681b8;};'use strict';var EventEmitter=require(_0xdb4d('0x0'));var VoiceExtension=require(_0xdb4d('0x1'))['db'][_0xdb4d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdb4d('0x3')](0x0);var events={'afterCreate':_0xdb4d('0x4'),'afterUpdate':_0xdb4d('0x5'),'afterDestroy':_0xdb4d('0x6')};function emitEvent(_0x4bf9a2){return function(_0x5e97c7,_0x5c6950,_0x183f73){VoiceExtensionEvents[_0xdb4d('0x7')](_0x4bf9a2+':'+_0x5e97c7['id'],_0x5e97c7);VoiceExtensionEvents[_0xdb4d('0x7')](_0x4bf9a2,_0x5e97c7);_0x183f73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xdb4d('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 e556fdc..7d54fba 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 _0x95d9=['exten','alias','NoOp','No\x20alias\x20set','context','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','length','intervals','IntervalId','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','push','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','VoiceExtension','get','last','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)='];(function(_0x401bd6,_0x1bd56d){var _0x41fc5c=function(_0x3ffe89){while(--_0x3ffe89){_0x401bd6['push'](_0x401bd6['shift']());}};_0x41fc5c(++_0x1bd56d);}(_0x95d9,0x97));var _0x995d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x95d9[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x995d('0x0'));var attributes=require(_0x995d('0x1'));module[_0x995d('0x2')]=function(_0xb29ff5){var _0x568331=_0xb29ff5[_0x995d('0x3')];function _0x3b9a11(_0x1932c3){var _0x5b44d3=0x2;var _0x225c17=[{'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0x6')+_0x1932c3[_0x995d('0x4')],'context':_0x1932c3['context'],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':_0x1932c3[_0x995d('0x8')]?_0x995d('0x5'):_0x995d('0x9'),'appdata':_0x1932c3[_0x995d('0x8')]?'CDR(routeAlias)='+_0x1932c3[_0x995d('0x8')]:_0x995d('0xa'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']}];if(_0x1932c3['type']==='inbound'){_0x225c17['push']({'type':_0x995d('0xc'),'app':_0x995d('0x5'),'appdata':_0x995d('0xd')+_0x1932c3['id'],'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']});}_0x225c17['push']({'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0xe'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':'Set','appdata':_0x995d('0xf'),'context':_0x1932c3['context'],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0x10'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']});return _0x225c17;}function _0x183e0c(_0xb99ec5){var _0x294efb=0x2;var _0x29a643=[{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x12'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0xb99ec5[_0x995d('0x8')]?_0x995d('0x5'):_0x995d('0x9'),'appdata':_0xb99ec5[_0x995d('0x8')]?'CDR(routeAlias)='+_0xb99ec5[_0x995d('0x8')]:_0x995d('0xa'),'context':_0xb99ec5['context'],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':'CDR(destination)='+(_0xb99ec5[_0x995d('0x13')]?'${EXTEN:'+_0xb99ec5[_0x995d('0x13')]+'}':_0x995d('0x14')),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0xd')+_0xb99ec5['id'],'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':'outbound','app':_0x995d('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x294efb+0x2)+'):Goto('+(_0x294efb+0x1)+')','context':_0xb99ec5['context'],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0xb99ec5[_0x995d('0x13')]?_0x995d('0x16')+_0xb99ec5['cutdigits']+'}':_0x995d('0x17'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0xe'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0xf'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x18')+_0xb99ec5['id'],'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']}];if(_0xb99ec5['hasOwnProperty'](_0x995d('0x19'))&&_0xb99ec5[_0x995d('0x19')]!==_0x995d('0x1a')){_0x29a643['push']({'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0x1b'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x1c')+_0xb99ec5[_0x995d('0x19')]||_0x995d('0x1d'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']});}return _0x29a643;}function _0x38430e(_0xffe49a,_0x383ea4){var _0x27e238=[{'name':_0x995d('0x1e'),'param':0x0},{'name':_0x995d('0x1f'),'param':0x1},{'name':_0x995d('0x20'),'param':0x2},{'name':_0x995d('0x21'),'param':0x3}];var _0x57ce35={};var _0x7c9b59=_0x383ea4[_0x995d('0x22')](',');var _0x2dcd8a=[];for(var _0x540139=0x0;_0x540139<_0x27e238['length'];_0x540139++){switch(_0x27e238[_0x540139]['name']){case'trunk':_0x57ce35[_0x995d('0x1e')]=_0x7c9b59[_0x27e238[_0x540139][_0x995d('0x23')]][_0x995d('0x22')]('/')[0x1];_0x57ce35[_0x995d('0x24')]=_0x7c9b59[_0x27e238[_0x540139]['param']][_0x995d('0x22')]('/')[0x2];_0x57ce35[_0x995d('0x25')]=_0x57ce35['phone']?_0x57ce35[_0x995d('0x24')][_0x995d('0x22')]('$')[0x0]:undefined;_0x57ce35[_0x995d('0x24')]=_0xffe49a[_0x995d('0x13')]?(_0x57ce35[_0x995d('0x25')]||'')+'${EXTEN:'+_0xffe49a[_0x995d('0x13')]+'}':(_0x57ce35['prefix']||'')+_0x995d('0x14');_0x2dcd8a[_0x27e238[_0x540139][_0x995d('0x23')]]=[_0x995d('0x26'),_0x57ce35[_0x995d('0x1e')],_0x57ce35[_0x995d('0x24')]][_0x995d('0x27')]('/');break;case _0x995d('0x20'):_0x57ce35[_0x995d('0x20')]=_0x7c9b59[_0x27e238[_0x540139]['param']];if(_0xffe49a[_0x995d('0x19')]!==_0x995d('0x1a')){if(_0x57ce35[_0x995d('0x20')]['indexOf'](_0x995d('0x28'))<0x0){_0x57ce35[_0x995d('0x20')]+=_0x995d('0x28');}}else{_0x57ce35[_0x995d('0x20')]=_0x57ce35[_0x995d('0x20')][_0x995d('0x29')](_0x995d('0x28'),'');}_0x2dcd8a[_0x27e238[_0x540139][_0x995d('0x23')]]=_0x57ce35['options'];break;default:_0x2dcd8a[_0x27e238[_0x540139]['param']]=_0x7c9b59[_0x27e238[_0x540139][_0x995d('0x23')]];}}return _0x2dcd8a[_0x995d('0x27')](',');}function _0x5e8485(_0x5efe57,_0x39815e,_0x17ec4c){return new Promise(function(_0xafb93d,_0x50c61e){var _0x1c6f2c=[];if(_[_0x995d('0x2a')](_0x39815e))return _0xafb93d(_0x1c6f2c);_0x568331[_0x995d('0x2b')][_0x995d('0x2c')]({'attributes':['id',_0x995d('0x2d'),'IntervalId'],'raw':!![]})['then'](function(_0x2bce82){for(var _0x37d47c=0x0,_0x1d81e1=0x0;_0x37d47c<_0x39815e[_0x995d('0x2e')];_0x37d47c++,_0x1d81e1=0x0){var _0x2f7192=_0x39815e[_0x37d47c];var _0x5d558d=[];var _0x1fe4c5=[];delete _0x2f7192['id'];if(_0x2f7192['interval']!=='*,*,*,*'){_0x2f7192[_0x995d('0x2f')]=[_0x2f7192[_0x995d('0x2d')]];}else{_0x2f7192[_0x995d('0x2f')]=_0x2f7192[_0x995d('0x30')]?_[_0x995d('0x31')](_[_0x995d('0x32')](_0x2bce82,{'IntervalId':_0x2f7192[_0x995d('0x30')]}),'interval'):[];}_0x2f7192[_0x995d('0xb')]=_0x5efe57[_0x995d('0xb')];_0x2f7192[_0x995d('0x7')]=_0x5efe57[_0x995d('0x7')];if(_0x2f7192[_0x995d('0x4')])_0x2f7192[_0x995d('0x4')]=_0x2f7192[_0x995d('0x4')][_0x995d('0x33')]();if(_0x5efe57[_0x995d('0x4')]==='outbound'){if(_0x2f7192[_0x995d('0x34')]('tag')&&_0x2f7192[_0x995d('0x35')]&&_0x2f7192[_0x995d('0x35')]!=='--'){_0x5d558d['push']({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'Set','appdata':_0x995d('0x36')+_0x2f7192[_0x995d('0x35')],'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':_0x995d('0x15'),'appdata':_0x995d('0x38')+(_0x2f7192[_0x995d('0x39')]?'Set(CALLERID(all)='+_0x2f7192[_0x995d('0x39')]+')':_0x995d('0x3a')),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192[_0x995d('0x2f')]['length']+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}else{if(_0x2f7192[_0x995d('0x34')](_0x995d('0x3b'))){if([_0x995d('0x3c'),'playback']['includes'](_0x2f7192[_0x995d('0x3d')][_0x995d('0x33')]())&&_0x2f7192[_0x995d('0x3e')]!=='custom'){if(_0x2f7192['answer']){_0x5d558d['push']({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'ExecIf','appdata':_0x995d('0x3f'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':_0x995d('0x5'),'appdata':_0x995d('0x40'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}else{_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')]['toLowerCase'](),'app':_0x995d('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57['exten'],'priority':_0x2f7192[_0x995d('0x2f')][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'Set','appdata':_0x995d('0x41'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57['exten'],'priority':_0x2f7192['intervals']['length']+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}}}}for(var _0x79f26a=0x0;_0x79f26a<_0x2f7192[_0x995d('0x2f')][_0x995d('0x2e')];_0x79f26a++){var _0x1c1722=_0x17ec4c+_0x2f7192['intervals']['length'];var _0x456c6c=_0x79f26a===_0x2f7192[_0x995d('0x2f')]['length']-0x1?_0x17ec4c+_0x5d558d['length']+_0x1fe4c5[_0x995d('0x2e')]+0x2:_0x17ec4c+_0x79f26a+0x1;_0x5d558d[_0x995d('0x42')](_0x79f26a,0x0,{'type':_0x5efe57[_0x995d('0x4')],'app':'GotoIfTime','appdata':_0x2f7192[_0x995d('0x2f')][_0x79f26a]+'?'+_0x5efe57[_0x995d('0xb')]+_0x995d('0x43')+_0x1c1722+':'+_0x5efe57['context']+_0x995d('0x43')+_0x456c6c,'exten':_0x5efe57[_0x995d('0x7')],'context':_0x5efe57['context'],'priority':_0x17ec4c+_0x79f26a,'VoiceExtensionId':_0x5efe57['id']});}if(_0x2f7192[_0x995d('0x3e')]===_0x995d('0x44'))_0x2f7192[_0x995d('0x45')]=_0x38430e(_0x5efe57,_0x2f7192[_0x995d('0x45')]);_0x2f7192['priority']=_0x5d558d[_0x995d('0x2e')]?_['last'](_0x5d558d)[_0x995d('0x46')]+0x1:_0x17ec4c;_0x1c6f2c=_[_0x995d('0x47')](_0x1c6f2c,_0x5d558d,[_0x2f7192],_0x1fe4c5);_0x17ec4c=_['last'](_0x1c6f2c)[_0x995d('0x46')]+0x1;}return _0xafb93d(_0x1c6f2c);})[_0x995d('0x48')](function(_0xf275fc){_0x50c61e(_0xf275fc);});});}return _0xb29ff5[_0x995d('0x49')](_0x995d('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf72ed3){var _0x20aee4=this[_0x995d('0x4b')]({'plain':!![]});var _0x3953fb=_0x20aee4[_0x995d('0x4')]===_0x995d('0x11')?_0x183e0c(_0x20aee4):_0x3b9a11(_0x20aee4);return _0x5e8485(_0x20aee4,_0xf72ed3,_[_0x995d('0x4c')](_0x3953fb)['priority']+0x1)[_0x995d('0x4d')](function(_0x4a8965){var _0x57b530=_[_0x995d('0x47')](_0x3953fb,_0x4a8965);_0x57b530[_0x995d('0x37')]({'type':_0x20aee4['type'],'app':_0x995d('0x4e'),'exten':_0x20aee4[_0x995d('0x7')],'context':_0x20aee4['context'],'priority':_[_0x995d('0x4c')](_0x57b530)[_0x995d('0x46')]+0x1,'VoiceExtensionId':_0x20aee4['id']});return _0x57b530;});}}});}; \ No newline at end of file +var _0x96aa=['callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','alias','Set','NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','name','param','prefix','phone','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','then','length','interval','intervals','filter','IntervalId','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x96aa,0x67));var _0xa96a=function(_0x1c90a9,_0x63d7c1){_0x1c90a9=_0x1c90a9-0x0;var _0xbddb89=_0x96aa[_0x1c90a9];return _0xbddb89;};'use strict';var _=require(_0xa96a('0x0'));var attributes=require(_0xa96a('0x1'));module['exports']=function(_0x4519b6){var _0x32bff8=_0x4519b6[_0xa96a('0x2')];function _0x12bbb7(_0x10a117){var _0x4911c8=0x2;var _0x1ce4a1=[{'type':_0x10a117[_0xa96a('0x3')],'app':'Set','appdata':_0xa96a('0x4')+_0x10a117[_0xa96a('0x3')],'context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117[_0xa96a('0x6')],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']},{'type':_0x10a117[_0xa96a('0x3')],'app':_0x10a117[_0xa96a('0x7')]?_0xa96a('0x8'):_0xa96a('0x9'),'appdata':_0x10a117[_0xa96a('0x7')]?_0xa96a('0xa')+_0x10a117[_0xa96a('0x7')]:'No\x20alias\x20set','context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117['exten'],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']}];if(_0x10a117[_0xa96a('0x3')]===_0xa96a('0xb')){_0x1ce4a1['push']({'type':_0xa96a('0xb'),'app':_0xa96a('0x8'),'appdata':_0xa96a('0xc')+_0x10a117['id'],'context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117[_0xa96a('0x6')],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']});}_0x1ce4a1[_0xa96a('0xd')]({'type':_0x10a117[_0xa96a('0x3')],'app':_0xa96a('0x8'),'appdata':_0xa96a('0xe'),'context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117[_0xa96a('0x6')],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']},{'type':_0x10a117[_0xa96a('0x3')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117['exten'],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']},{'type':_0x10a117[_0xa96a('0x3')],'app':'Set','appdata':_0xa96a('0xf'),'context':_0x10a117[_0xa96a('0x5')],'exten':_0x10a117[_0xa96a('0x6')],'priority':_0x4911c8++,'VoiceExtensionId':_0x10a117['id']});return _0x1ce4a1;}function _0x3372f9(_0x11503){var _0x16257d=0x2;var _0x5013f8=[{'type':_0xa96a('0x10'),'app':_0xa96a('0x8'),'appdata':'CDR(type)=outbound','context':_0x11503[_0xa96a('0x5')],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':_0x11503[_0xa96a('0x7')]?_0xa96a('0x8'):_0xa96a('0x9'),'appdata':_0x11503[_0xa96a('0x7')]?_0xa96a('0xa')+_0x11503[_0xa96a('0x7')]:'No\x20alias\x20set','context':_0x11503[_0xa96a('0x5')],'exten':_0x11503['exten'],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':'Set','appdata':_0xa96a('0x11')+(_0x11503[_0xa96a('0x12')]?'${EXTEN:'+_0x11503['cutdigits']+'}':_0xa96a('0x13')),'context':_0x11503[_0xa96a('0x5')],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':_0xa96a('0x8'),'appdata':_0xa96a('0xc')+_0x11503['id'],'context':_0x11503['context'],'exten':_0x11503['exten'],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':'ExecIf','appdata':_0xa96a('0x14')+(_0x16257d+0x2)+_0xa96a('0x15')+(_0x16257d+0x1)+')','context':_0x11503[_0xa96a('0x5')],'exten':_0x11503['exten'],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':'Set','appdata':_0x11503['cutdigits']?_0xa96a('0x16')+_0x11503['cutdigits']+'}':_0xa96a('0x17'),'context':_0x11503[_0xa96a('0x5')],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':'outbound','app':_0xa96a('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x11503['context'],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':'outbound','app':'Set','appdata':_0xa96a('0x18'),'context':_0x11503[_0xa96a('0x5')],'exten':_0x11503['exten'],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':_0xa96a('0x8'),'appdata':_0xa96a('0xf'),'context':_0x11503[_0xa96a('0x5')],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':'outbound','app':_0xa96a('0x8'),'appdata':_0xa96a('0x19')+_0x11503['id'],'context':_0x11503['context'],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']}];if(_0x11503[_0xa96a('0x1a')](_0xa96a('0x1b'))&&_0x11503[_0xa96a('0x1b')]!==_0xa96a('0x1c')){_0x5013f8[_0xa96a('0xd')]({'type':_0xa96a('0x10'),'app':'Set','appdata':_0xa96a('0x1d'),'context':_0x11503[_0xa96a('0x5')],'exten':_0x11503[_0xa96a('0x6')],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']},{'type':_0xa96a('0x10'),'app':_0xa96a('0x8'),'appdata':_0xa96a('0x1e')+_0x11503['recordingFormat']||'wav','context':_0x11503['context'],'exten':_0x11503['exten'],'priority':_0x16257d++,'VoiceExtensionId':_0x11503['id']});}return _0x5013f8;}function _0x1dd4b2(_0x1c86d2,_0x2f2d8){var _0x11f401=[{'name':_0xa96a('0x1f'),'param':0x0},{'name':_0xa96a('0x20'),'param':0x1},{'name':_0xa96a('0x21'),'param':0x2},{'name':_0xa96a('0x22'),'param':0x3}];var _0x282340={};var _0xddd3f8=_0x2f2d8[_0xa96a('0x23')](',');var _0x39ee3f=[];for(var _0x54fdb1=0x0;_0x54fdb1<_0x11f401['length'];_0x54fdb1++){switch(_0x11f401[_0x54fdb1][_0xa96a('0x24')]){case _0xa96a('0x1f'):_0x282340['trunk']=_0xddd3f8[_0x11f401[_0x54fdb1][_0xa96a('0x25')]]['split']('/')[0x1];_0x282340['phone']=_0xddd3f8[_0x11f401[_0x54fdb1][_0xa96a('0x25')]][_0xa96a('0x23')]('/')[0x2];_0x282340[_0xa96a('0x26')]=_0x282340[_0xa96a('0x27')]?_0x282340[_0xa96a('0x27')][_0xa96a('0x23')]('$')[0x0]:undefined;_0x282340[_0xa96a('0x27')]=_0x1c86d2[_0xa96a('0x12')]?(_0x282340[_0xa96a('0x26')]||'')+'${EXTEN:'+_0x1c86d2[_0xa96a('0x12')]+'}':(_0x282340[_0xa96a('0x26')]||'')+_0xa96a('0x13');_0x39ee3f[_0x11f401[_0x54fdb1]['param']]=['SIP',_0x282340['trunk'],_0x282340['phone']][_0xa96a('0x28')]('/');break;case _0xa96a('0x21'):_0x282340['options']=_0xddd3f8[_0x11f401[_0x54fdb1][_0xa96a('0x25')]];if(_0x1c86d2[_0xa96a('0x1b')]!==_0xa96a('0x1c')){if(_0x282340[_0xa96a('0x21')][_0xa96a('0x29')](_0xa96a('0x2a'))<0x0){_0x282340['options']+='U(xcally-mixmonitor-context)';}}else{_0x282340['options']=_0x282340[_0xa96a('0x21')][_0xa96a('0x2b')](_0xa96a('0x2a'),'');}_0x39ee3f[_0x11f401[_0x54fdb1]['param']]=_0x282340[_0xa96a('0x21')];break;default:_0x39ee3f[_0x11f401[_0x54fdb1][_0xa96a('0x25')]]=_0xddd3f8[_0x11f401[_0x54fdb1][_0xa96a('0x25')]];}}return _0x39ee3f['join'](',');}function _0x4589aa(_0x11bc5c,_0x715b94,_0x273242){return new Promise(function(_0x241379,_0x23778e){var _0x349414=[];if(_['isEmpty'](_0x715b94))return _0x241379(_0x349414);_0x32bff8[_0xa96a('0x2c')][_0xa96a('0x2d')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xa96a('0x2e')](function(_0x423800){for(var _0x5588ad=0x0,_0x544d9f=0x0;_0x5588ad<_0x715b94[_0xa96a('0x2f')];_0x5588ad++,_0x544d9f=0x0){var _0x3babc5=_0x715b94[_0x5588ad];var _0x362bc8=[];var _0x399aef=[];delete _0x3babc5['id'];if(_0x3babc5[_0xa96a('0x30')]!=='*,*,*,*'){_0x3babc5[_0xa96a('0x31')]=[_0x3babc5[_0xa96a('0x30')]];}else{_0x3babc5[_0xa96a('0x31')]=_0x3babc5['IntervalId']?_['map'](_[_0xa96a('0x32')](_0x423800,{'IntervalId':_0x3babc5[_0xa96a('0x33')]}),_0xa96a('0x30')):[];}_0x3babc5['context']=_0x11bc5c['context'];_0x3babc5[_0xa96a('0x6')]=_0x11bc5c[_0xa96a('0x6')];if(_0x3babc5[_0xa96a('0x3')])_0x3babc5[_0xa96a('0x3')]=_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')]();if(_0x11bc5c[_0xa96a('0x3')]===_0xa96a('0x10')){if(_0x3babc5[_0xa96a('0x1a')](_0xa96a('0x35'))&&_0x3babc5[_0xa96a('0x35')]&&_0x3babc5[_0xa96a('0x35')]!=='--'){_0x362bc8[_0xa96a('0xd')]({'type':_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')](),'app':'Set','appdata':_0xa96a('0x36')+_0x3babc5['tag'],'context':_0x11bc5c['context'],'exten':_0x11bc5c[_0xa96a('0x6')],'priority':_0x3babc5['intervals'][_0xa96a('0x2f')]+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});}_0x362bc8[_0xa96a('0xd')]({'type':_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')](),'app':_0xa96a('0x37'),'appdata':_0xa96a('0x38')+(_0x3babc5[_0xa96a('0x39')]?_0xa96a('0x3a')+_0x3babc5[_0xa96a('0x39')]+')':_0xa96a('0x3b')),'context':_0x11bc5c[_0xa96a('0x5')],'exten':_0x11bc5c['exten'],'priority':_0x3babc5[_0xa96a('0x31')][_0xa96a('0x2f')]+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});}else{if(_0x3babc5['hasOwnProperty'](_0xa96a('0x3c'))){if([_0xa96a('0x3d'),'playback'][_0xa96a('0x3e')](_0x3babc5['app'][_0xa96a('0x34')]())&&_0x3babc5[_0xa96a('0x3f')]!==_0xa96a('0x40')){if(_0x3babc5[_0xa96a('0x3c')]){_0x362bc8['push']({'type':_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')](),'app':'ExecIf','appdata':_0xa96a('0x41'),'context':_0x11bc5c[_0xa96a('0x5')],'exten':_0x11bc5c[_0xa96a('0x6')],'priority':_0x3babc5[_0xa96a('0x31')][_0xa96a('0x2f')]+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});_0x362bc8[_0xa96a('0xd')]({'type':_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')](),'app':_0xa96a('0x8'),'appdata':_0xa96a('0x42'),'context':_0x11bc5c['context'],'exten':_0x11bc5c[_0xa96a('0x6')],'priority':_0x3babc5['intervals'][_0xa96a('0x2f')]+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});}else{_0x362bc8[_0xa96a('0xd')]({'type':_0x3babc5['type']['toLowerCase'](),'app':_0xa96a('0x37'),'appdata':_0xa96a('0x43'),'context':_0x11bc5c[_0xa96a('0x5')],'exten':_0x11bc5c['exten'],'priority':_0x3babc5[_0xa96a('0x31')]['length']+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});_0x362bc8[_0xa96a('0xd')]({'type':_0x3babc5[_0xa96a('0x3')][_0xa96a('0x34')](),'app':_0xa96a('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x11bc5c[_0xa96a('0x5')],'exten':_0x11bc5c[_0xa96a('0x6')],'priority':_0x3babc5[_0xa96a('0x31')][_0xa96a('0x2f')]+_0x273242+_0x544d9f++,'VoiceExtensionId':_0x11bc5c['id']});}}}}for(var _0x342d0c=0x0;_0x342d0c<_0x3babc5['intervals'][_0xa96a('0x2f')];_0x342d0c++){var _0x1f49d7=_0x273242+_0x3babc5['intervals'][_0xa96a('0x2f')];var _0x3da092=_0x342d0c===_0x3babc5[_0xa96a('0x31')][_0xa96a('0x2f')]-0x1?_0x273242+_0x362bc8[_0xa96a('0x2f')]+_0x399aef['length']+0x2:_0x273242+_0x342d0c+0x1;_0x362bc8[_0xa96a('0x44')](_0x342d0c,0x0,{'type':_0x11bc5c[_0xa96a('0x3')],'app':_0xa96a('0x45'),'appdata':_0x3babc5[_0xa96a('0x31')][_0x342d0c]+'?'+_0x11bc5c[_0xa96a('0x5')]+_0xa96a('0x46')+_0x1f49d7+':'+_0x11bc5c[_0xa96a('0x5')]+_0xa96a('0x46')+_0x3da092,'exten':_0x11bc5c['exten'],'context':_0x11bc5c[_0xa96a('0x5')],'priority':_0x273242+_0x342d0c,'VoiceExtensionId':_0x11bc5c['id']});}if(_0x3babc5[_0xa96a('0x3f')]===_0xa96a('0x47'))_0x3babc5[_0xa96a('0x48')]=_0x1dd4b2(_0x11bc5c,_0x3babc5[_0xa96a('0x48')]);_0x3babc5[_0xa96a('0x49')]=_0x362bc8[_0xa96a('0x2f')]?_[_0xa96a('0x4a')](_0x362bc8)[_0xa96a('0x49')]+0x1:_0x273242;_0x349414=_[_0xa96a('0x4b')](_0x349414,_0x362bc8,[_0x3babc5],_0x399aef);_0x273242=_[_0xa96a('0x4a')](_0x349414)['priority']+0x1;}return _0x241379(_0x349414);})[_0xa96a('0x4c')](function(_0x33205b){_0x23778e(_0x33205b);});});}return _0x4519b6['define'](_0xa96a('0x4d'),attributes,{'tableName':_0xa96a('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4a9153){var _0x1481b4=this['get']({'plain':!![]});var _0x536eb7=_0x1481b4[_0xa96a('0x3')]==='outbound'?_0x3372f9(_0x1481b4):_0x12bbb7(_0x1481b4);return _0x4589aa(_0x1481b4,_0x4a9153,_[_0xa96a('0x4a')](_0x536eb7)[_0xa96a('0x49')]+0x1)[_0xa96a('0x2e')](function(_0x4e1bf1){var _0x18fa8f=_[_0xa96a('0x4b')](_0x536eb7,_0x4e1bf1);_0x18fa8f[_0xa96a('0xd')]({'type':_0x1481b4[_0xa96a('0x3')],'app':_0xa96a('0x4f'),'exten':_0x1481b4[_0xa96a('0x6')],'context':_0x1481b4[_0xa96a('0x5')],'priority':_[_0xa96a('0x4a')](_0x18fa8f)['priority']+0x1,'VoiceExtensionId':_0x1481b4['id']});return _0x18fa8f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c0327e1..2b14a94 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 _0xe599=['info','request\x20sent','debug','stringify','error','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0x506949,_0x499a33){var _0x55c335=function(_0x5d0f7a){while(--_0x5d0f7a){_0x506949['push'](_0x506949['shift']());}};_0x55c335(++_0x499a33);}(_0xe599,0x1e5));var _0x9e59=function(_0x386e1e,_0x173808){_0x386e1e=_0x386e1e-0x0;var _0x560932=_0xe599[_0x386e1e];return _0x560932;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require(_0x9e59('0x3'));var rs=require(_0x9e59('0x4'));var fs=require('fs');var Redis=require(_0x9e59('0x5'));var db=require(_0x9e59('0x6'))['db'];var utils=require(_0x9e59('0x7'));var logger=require(_0x9e59('0x8'))('rpc');var config=require(_0x9e59('0x9'));var jayson=require(_0x9e59('0xa'));var client=jayson['client'][_0x9e59('0xb')]({'port':0x232a});config['redis']=_[_0x9e59('0xc')](config[_0x9e59('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e59('0xe'))(new Redis(config[_0x9e59('0xd')]));require(_0x9e59('0xf'))[_0x9e59('0x10')](socket);function respondWithRpcPromise(_0x64d093,_0x14a5d7,_0x578fdc){return new BPromise(function(_0x312bc6,_0x5ba142){return client[_0x9e59('0x11')](_0x64d093,_0x578fdc)[_0x9e59('0x12')](function(_0x21c404){logger[_0x9e59('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'));logger[_0x9e59('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'),JSON[_0x9e59('0x16')](_0x21c404));if(_0x21c404[_0x9e59('0x17')]){if(_0x21c404[_0x9e59('0x17')]['code']===0x1f4){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);return _0x5ba142(_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);}logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404['error'][_0x9e59('0x19')]);return _0x312bc6(_0x21c404['error']['message']);}else{logger['info'](_0x9e59('0x18'),_0x14a5d7,_0x9e59('0x14'));_0x312bc6(_0x21c404['result'][_0x9e59('0x19')]);}})[_0x9e59('0x1a')](function(_0x40f315){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x40f315);_0x5ba142(_0x40f315);});});}exports[_0x9e59('0x1b')]=function(_0x3162f9){var _0x48fa20=this;return new Promise(function(_0x1ba8f9,_0x52022d){return db['VoiceExtension']['findAll']({'raw':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1d')]===undefined?!![]:![]:!![],'where':_0x3162f9['options']?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1e')]||null:null,'attributes':_0x3162f9['options']?_0x3162f9['options']['attributes']||null:null,'limit':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1f')]||null:null,'include':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')]['include']?_['map'](_0x3162f9['options'][_0x9e59('0x20')],function(_0x147b15){return{'model':db[_0x147b15[_0x9e59('0x21')]],'as':_0x147b15['as'],'attributes':_0x147b15[_0x9e59('0x22')],'include':_0x147b15[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x147b15['include'],function(_0x5d4be1){return{'model':db[_0x5d4be1[_0x9e59('0x21')]],'as':_0x5d4be1['as'],'attributes':_0x5d4be1[_0x9e59('0x22')],'include':_0x5d4be1[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x5d4be1[_0x9e59('0x20')],function(_0x17f4f5){return{'model':db[_0x17f4f5[_0x9e59('0x21')]],'as':_0x17f4f5['as'],'attributes':_0x17f4f5[_0x9e59('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e59('0x12')](function(_0x3d002f){logger[_0x9e59('0x13')](_0x9e59('0x1b'),_0x3162f9);logger[_0x9e59('0x15')]('GetVoiceExtension',_0x3162f9,JSON[_0x9e59('0x16')](_0x3d002f));_0x1ba8f9(_0x3d002f);})[_0x9e59('0x1a')](function(_0xced2df){logger[_0x9e59('0x17')](_0x9e59('0x1b'),_0xced2df[_0x9e59('0x19')],_0x3162f9);_0x52022d(_0x48fa20[_0x9e59('0x17')](0x1f4,_0xced2df[_0x9e59('0x19')]));});});}; \ No newline at end of file +var _0x496e=['findAll','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceExtension'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x496e,0x1a0));var _0xe496=function(_0x528ced,_0x5e6348){_0x528ced=_0x528ced-0x0;var _0x8ea2ef=_0x496e[_0x528ced];return _0x8ea2ef;};'use strict';var _=require('lodash');var util=require(_0xe496('0x0'));var moment=require(_0xe496('0x1'));var BPromise=require(_0xe496('0x2'));var rs=require(_0xe496('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe496('0x4'))('rpc');var config=require(_0xe496('0x5'));var jayson=require(_0xe496('0x6'));var client=jayson[_0xe496('0x7')][_0xe496('0x8')]({'port':0x232a});config[_0xe496('0x9')]=_[_0xe496('0xa')](config[_0xe496('0x9')],{'host':_0xe496('0xb'),'port':0x18eb});var socket=require(_0xe496('0xc'))(new Redis(config[_0xe496('0x9')]));require(_0xe496('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a4caa,_0x37c55b,_0x5ca4d4){return new BPromise(function(_0x2e679b,_0x44936f){return client[_0xe496('0xe')](_0x4a4caa,_0x5ca4d4)[_0xe496('0xf')](function(_0x19d4fa){logger[_0xe496('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x37c55b,'request\x20sent');logger[_0xe496('0x11')](_0xe496('0x12'),_0x37c55b,'request\x20sent',JSON[_0xe496('0x13')](_0x19d4fa));if(_0x19d4fa[_0xe496('0x14')]){if(_0x19d4fa[_0xe496('0x14')][_0xe496('0x15')]===0x1f4){logger['error'](_0xe496('0x16'),_0x37c55b,_0x19d4fa['error'][_0xe496('0x17')]);return _0x44936f(_0x19d4fa['error'][_0xe496('0x17')]);}logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x19d4fa[_0xe496('0x14')]['message']);return _0x2e679b(_0x19d4fa[_0xe496('0x14')][_0xe496('0x17')]);}else{logger['info'](_0xe496('0x16'),_0x37c55b,_0xe496('0x18'));_0x2e679b(_0x19d4fa[_0xe496('0x19')][_0xe496('0x17')]);}})[_0xe496('0x1a')](function(_0x25e42d){logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x25e42d);_0x44936f(_0x25e42d);});});}exports[_0xe496('0x1b')]=function(_0x1993cd){var _0x2f9856=this;return new Promise(function(_0x3f6436,_0x30927d){return db['VoiceExtension'][_0xe496('0x1c')]({'raw':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x1e')]===undefined?!![]:![]:!![],'where':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x1f')]||null:null,'attributes':_0x1993cd[_0xe496('0x1d')]?_0x1993cd['options'][_0xe496('0x20')]||null:null,'limit':_0x1993cd['options']?_0x1993cd['options'][_0xe496('0x21')]||null:null,'include':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x22')]?_[_0xe496('0x23')](_0x1993cd['options'][_0xe496('0x22')],function(_0x2d122e){return{'model':db[_0x2d122e[_0xe496('0x24')]],'as':_0x2d122e['as'],'attributes':_0x2d122e['attributes'],'include':_0x2d122e[_0xe496('0x22')]?_[_0xe496('0x23')](_0x2d122e[_0xe496('0x22')],function(_0x57dc9d){return{'model':db[_0x57dc9d[_0xe496('0x24')]],'as':_0x57dc9d['as'],'attributes':_0x57dc9d[_0xe496('0x20')],'include':_0x57dc9d[_0xe496('0x22')]?_[_0xe496('0x23')](_0x57dc9d[_0xe496('0x22')],function(_0x2c6ee6){return{'model':db[_0x2c6ee6[_0xe496('0x24')]],'as':_0x2c6ee6['as'],'attributes':_0x2c6ee6[_0xe496('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe496('0xf')](function(_0x1a7c5e){logger[_0xe496('0x10')](_0xe496('0x1b'),_0x1993cd);logger['debug'](_0xe496('0x1b'),_0x1993cd,JSON[_0xe496('0x13')](_0x1a7c5e));_0x3f6436(_0x1a7c5e);})[_0xe496('0x1a')](function(_0x3fa5bc){logger[_0xe496('0x14')](_0xe496('0x1b'),_0x3fa5bc['message'],_0x1993cd);_0x30927d(_0x2f9856[_0xe496('0x14')](0x1f4,_0x3fa5bc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1fa2791..ef8bf68 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x5e0a96,_0xfa1b94){var _0x40292e=function(_0x243a9f){while(--_0x243a9f){_0x5e0a96['push'](_0x5e0a96['shift']());}};_0x40292e(++_0xfa1b94);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x2a509a,_0x46989a){var _0x444d82=function(_0x444518){while(--_0x444518){_0x2a509a['push'](_0x2a509a['shift']());}};_0x444d82(++_0x46989a);}(_0x2ef3,0xba));var _0x32ef=function(_0x51ea17,_0x125b0a){_0x51ea17=_0x51ea17-0x0;var _0x9b99=_0x2ef3[_0x51ea17];return _0x9b99;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8d64801..8224a3a 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 _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x26caf7,_0x15be3e){var _0x1df494=function(_0x5e31ae){while(--_0x5e31ae){_0x26caf7['push'](_0x26caf7['shift']());}};_0x1df494(++_0x15be3e);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6d11=['put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post'];(function(_0x2b81db,_0xe9c3cb){var _0x1e0f1d=function(_0x63f3b2){while(--_0x63f3b2){_0x2b81db['push'](_0x2b81db['shift']());}};_0x1e0f1d(++_0xe9c3cb);}(_0x6d11,0xbf));var _0x16d1=function(_0x114b6d,_0x18865f){_0x114b6d=_0x114b6d-0x0;var _0x3fc999=_0x6d11[_0x114b6d];return _0x3fc999;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['get']('/:id/messages',auth[_0x16d1('0x8')](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')]('/',auth[_0x16d1('0x8')](),controller['create']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);router[_0x16d1('0xf')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 8b28047..262ad7d 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 _0xe0b5=['getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','INTEGER','VIRTUAL'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe0b5,0x173));var _0x5e0b=function(_0x5bdc48,_0x59b8fb){_0x5bdc48=_0x5bdc48-0x0;var _0x52d04e=_0xe0b5[_0x5bdc48];return _0x52d04e;};'use strict';var Sequelize=require(_0x5e0b('0x0'));module[_0x5e0b('0x1')]={'customer_id':{'type':Sequelize[_0x5e0b('0x2')]},'context':{'type':Sequelize[_0x5e0b('0x2')],'defaultValue':_0x5e0b('0x3'),'unique':_0x5e0b('0x4')},'mailbox':{'type':Sequelize[_0x5e0b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e0b('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x5e0b('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2fc204){this['setDataValue'](_0x5e0b('0x5'),typeof _0x2fc204===_0x5e0b('0x6')&&_0x2fc204[_0x5e0b('0x7')]()?_0x2fc204['trim']():null);}},'pager':{'type':Sequelize[_0x5e0b('0x2')]},'tz':{'type':Sequelize[_0x5e0b('0x2')],'defaultValue':_0x5e0b('0x8')},'attach':{'type':Sequelize[_0x5e0b('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x5e0b('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5e0b('0x2')]},'callback':{'type':Sequelize[_0x5e0b('0x2')]},'review':{'type':Sequelize[_0x5e0b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5e0b('0x9')](_0x5e0b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e0b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e0b('0x9')](_0x5e0b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5e0b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e0b('0x9')](_0x5e0b('0xa'),'no'),'defaultValue':_0x5e0b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5e0b('0x9')](_0x5e0b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5e0b('0x9')](_0x5e0b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x5e0b('0xa'),'no'),'defaultValue':_0x5e0b('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5e0b('0x2')]},'emailbody':{'type':Sequelize[_0x5e0b('0x2')]},'maxsecs':{'type':Sequelize[_0x5e0b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5e0b('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e0b('0xc')],'get':function(){return this[_0x5e0b('0xd')](_0x5e0b('0xe'))+_0x5e0b('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x4fcf=['yes','TINYINT(4)','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM'];(function(_0x5bc41f,_0x5cc4d3){var _0x19aa58=function(_0x43501f){while(--_0x43501f){_0x5bc41f['push'](_0x5bc41f['shift']());}};_0x19aa58(++_0x5cc4d3);}(_0x4fcf,0x137));var _0xf4fc=function(_0x5dbd30,_0x4cdbc1){_0x5dbd30=_0x5dbd30-0x0;var _0x18501e=_0x4fcf[_0x5dbd30];return _0x18501e;};'use strict';var Sequelize=require('sequelize');module[_0xf4fc('0x0')]={'customer_id':{'type':Sequelize[_0xf4fc('0x1')]},'context':{'type':Sequelize[_0xf4fc('0x1')],'defaultValue':_0xf4fc('0x2'),'unique':_0xf4fc('0x3')},'mailbox':{'type':Sequelize[_0xf4fc('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf4fc('0x1')]},'fullname':{'type':Sequelize[_0xf4fc('0x1')]},'email':{'type':Sequelize[_0xf4fc('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5c38ed){this['setDataValue'](_0xf4fc('0x4'),typeof _0x5c38ed===_0xf4fc('0x5')&&_0x5c38ed['trim']()?_0x5c38ed[_0xf4fc('0x6')]():null);}},'pager':{'type':Sequelize[_0xf4fc('0x1')]},'tz':{'type':Sequelize[_0xf4fc('0x1')],'defaultValue':_0xf4fc('0x7')},'attach':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xf4fc('0x8')]('yes','no'),'defaultValue':_0xf4fc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf4fc('0x1')]},'review':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf4fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf4fc('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xf4fc('0x9'),'no'),'defaultValue':_0xf4fc('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf4fc('0x8')](_0xf4fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf4fc('0x9'),'no'),'defaultValue':_0xf4fc('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf4fc('0x1')]},'emailbody':{'type':Sequelize[_0xf4fc('0x1')]},'maxsecs':{'type':Sequelize[_0xf4fc('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf4fc('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf4fc('0xc')](_0xf4fc('0xd'))+_0xf4fc('0xe')+this[_0xf4fc('0xc')](_0xf4fc('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3cc613d..1dcb6df 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 _0x0fd9=['ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x1eb201,_0x55ee0d){var _0x2a6f39=function(_0x45f0d5){while(--_0x45f0d5){_0x1eb201['push'](_0x1eb201['shift']());}};_0x2a6f39(++_0x55ee0d);}(_0x0fd9,0xa3));var _0x90fd=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x0fd9[_0x107f10];return _0x811cab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){var _0x52b066=_0x300262[_0x90fd('0x26')]({'plain':!![]});var _0x18d5b3=_0x90fd('0x27');return db[_0x90fd('0x28')][_0x90fd('0x29')]({'where':{'type':_0x18d5b3,'resourceId':_0x52b066['id']}})['then'](function(){return _0x300262;});})[_0x90fd('0x25')](function(){_0x3ad6c6[_0x90fd('0x19')](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x1cdc38,_0x1c3805){return function(_0x428bc2){if(!_0x428bc2){_0x1cdc38['sendStatus'](0x194);}return _0x428bc2;};}function handleError(_0x5671fc,_0xbf1c9b){_0xbf1c9b=_0xbf1c9b||0x1f4;return function(_0x170cfb){logger[_0x90fd('0x2a')](_0x170cfb[_0x90fd('0x2b')]);if(_0x170cfb[_0x90fd('0x2c')]){delete _0x170cfb['name'];}_0x5671fc['status'](_0xbf1c9b)[_0x90fd('0x2d')](_0x170cfb);};}exports[_0x90fd('0x2e')]=function(_0x228fbc,_0x3a0102){var _0x4a3ae4={},_0x59aede={},_0x12dea4={'count':0x0,'rows':[]};var _0x21a9cf=_[_0x90fd('0x2f')](db[_0x90fd('0x30')]['rawAttributes'],function(_0x2c5204){return{'name':_0x2c5204[_0x90fd('0x31')],'type':_0x2c5204[_0x90fd('0x32')][_0x90fd('0x33')]};});_0x59aede[_0x90fd('0x34')]=_[_0x90fd('0x2f')](_0x21a9cf,_0x90fd('0x2c'));_0x59aede[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x228fbc[_0x90fd('0x35')]);_0x59aede[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x59aede[_0x90fd('0x34')],_0x59aede[_0x90fd('0x35')]);_0x4a3ae4[_0x90fd('0x39')]=_[_0x90fd('0x38')](_0x59aede['model'],qs[_0x90fd('0x3a')](_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x4a3ae4[_0x90fd('0x39')]=_0x4a3ae4[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x4a3ae4[_0x90fd('0x39')]:_0x59aede[_0x90fd('0x34')];if(!_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3c')](_0x90fd('0x3d'))){_0x4a3ae4[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x228fbc['query'][_0x90fd('0x1c')]);_0x4a3ae4[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x228fbc[_0x90fd('0x35')]['offset']);}_0x4a3ae4[_0x90fd('0x3e')]=qs[_0x90fd('0x3f')](_0x228fbc[_0x90fd('0x35')]['sort']);_0x4a3ae4['where']=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x228fbc[_0x90fd('0x35')],_0x59aede[_0x90fd('0x37')]),_0x21a9cf);if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]){_0x4a3ae4[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x4a3ae4[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x21a9cf,function(_0x3265c6){if(_0x3265c6[_0x90fd('0x32')]!==_0x90fd('0x44')){var _0x47856d={};_0x47856d[_0x3265c6[_0x90fd('0x2c')]]={'$like':'%'+_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]+'%'};return _0x47856d;}})});}_0x4a3ae4=_[_0x90fd('0x43')]({},_0x4a3ae4,_0x228fbc['options']);var _0xa5f17={'where':_0x4a3ae4[_0x90fd('0x42')]};return db[_0x90fd('0x30')]['count'](_0xa5f17)['then'](function(_0x47b8c8){_0x12dea4[_0x90fd('0x1d')]=_0x47b8c8;if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x45')]){_0x4a3ae4[_0x90fd('0x46')]=[{'all':!![]}];}return db[_0x90fd('0x30')][_0x90fd('0x47')](_0x4a3ae4);})[_0x90fd('0x25')](function(_0x733d4d){_0x12dea4[_0x90fd('0x48')]=_0x733d4d;return _0x12dea4;})[_0x90fd('0x25')](respondWithFilteredResult(_0x3a0102,_0x4a3ae4))[_0x90fd('0x49')](handleError(_0x3a0102,null));};exports[_0x90fd('0x4a')]=function(_0x4cb682,_0x386a0e){var _0x311cbf={'raw':!![],'where':{'id':_0x4cb682['params']['id']}},_0x50b722={};_0x50b722[_0x90fd('0x34')]=_[_0x90fd('0x36')](db[_0x90fd('0x30')]['rawAttributes']);_0x50b722['query']=_[_0x90fd('0x36')](_0x4cb682[_0x90fd('0x35')]);_0x50b722['filters']=_['intersection'](_0x50b722[_0x90fd('0x34')],_0x50b722[_0x90fd('0x35')]);_0x311cbf['attributes']=_['intersection'](_0x50b722[_0x90fd('0x34')],qs[_0x90fd('0x3a')](_0x4cb682[_0x90fd('0x35')]['fields']));_0x311cbf[_0x90fd('0x39')]=_0x311cbf[_0x90fd('0x39')]['length']?_0x311cbf['attributes']:_0x50b722['model'];if(_0x4cb682[_0x90fd('0x35')][_0x90fd('0x45')]){_0x311cbf['include']=[{'all':!![]}];}_0x311cbf=_[_0x90fd('0x43')]({},_0x311cbf,_0x4cb682[_0x90fd('0x4b')]);return db[_0x90fd('0x30')][_0x90fd('0x4c')](_0x311cbf)[_0x90fd('0x25')](handleEntityNotFound(_0x386a0e,null))['then'](respondWithResult(_0x386a0e,null))['catch'](handleError(_0x386a0e,null));};exports[_0x90fd('0x4d')]=function(_0x326e4d,_0x125874){return db[_0x90fd('0x30')][_0x90fd('0x4d')](_0x326e4d[_0x90fd('0x4e')],{})[_0x90fd('0x25')](function(_0x277751){var _0x31b284=_0x326e4d[_0x90fd('0x4f')]['get']({'plain':!![]});if(!_0x31b284)throw new Error(_0x90fd('0x50'));if(_0x31b284[_0x90fd('0x51')]===_0x90fd('0x4f')){var _0x38021b=_0x277751['get']({'plain':!![]});var _0x4cf061=_0x90fd('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4cf061,'userProfileId':_0x31b284[_0x90fd('0x52')]},'raw':!![]})[_0x90fd('0x25')](function(_0x41f029){if(_0x41f029&&_0x41f029[_0x90fd('0x53')]===0x0){return db[_0x90fd('0x28')][_0x90fd('0x4d')]({'name':_0x38021b[_0x90fd('0x2c')],'resourceId':_0x38021b['id'],'type':_0x41f029['name'],'sectionId':_0x41f029['id']},{})['then'](function(){return _0x277751;});}else{return _0x277751;}})[_0x90fd('0x49')](function(_0x43d076){logger[_0x90fd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d076);throw _0x43d076;});}return _0x277751;})[_0x90fd('0x25')](respondWithResult(_0x125874,0xc9))[_0x90fd('0x49')](handleError(_0x125874,null));};exports[_0x90fd('0x24')]=function(_0x3494f7,_0x437abd){if(_0x3494f7[_0x90fd('0x4e')]['id']){delete _0x3494f7[_0x90fd('0x4e')]['id'];}return db[_0x90fd('0x30')]['find']({'where':{'id':_0x3494f7['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x437abd,null))[_0x90fd('0x25')](saveUpdates(_0x3494f7[_0x90fd('0x4e')],null))['then'](respondWithResult(_0x437abd,null))[_0x90fd('0x49')](handleError(_0x437abd,null));};exports[_0x90fd('0x29')]=function(_0x29b880,_0x24229f){return db[_0x90fd('0x30')][_0x90fd('0x4c')]({'where':{'id':_0x29b880['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x24229f,null))['then'](removeEntity(_0x24229f,null))[_0x90fd('0x49')](handleError(_0x24229f,null));};exports['getMessages']=function(_0x29b7ea,_0x461509,_0x2fb220){return db[_0x90fd('0x30')]['findOne']({'where':{'id':_0x29b7ea[_0x90fd('0x54')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x461509,null))[_0x90fd('0x25')](function(_0x40fea3){var _0x4586e9;var _0x15bca2={},_0x57acf6={};_0x57acf6['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x57acf6[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x29b7ea[_0x90fd('0x35')]);_0x57acf6[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x57acf6['model'],_0x57acf6['query']);_0x15bca2['attributes']=_[_0x90fd('0x38')](_0x57acf6[_0x90fd('0x34')],qs['fields'](_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x15bca2[_0x90fd('0x39')]=_0x15bca2[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x15bca2[_0x90fd('0x39')]:_0x57acf6[_0x90fd('0x34')];if(!_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3c')]('nolimit')){_0x15bca2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x29b7ea[_0x90fd('0x35')]['limit']);_0x15bca2['offset']=qs[_0x90fd('0x1e')](_0x29b7ea[_0x90fd('0x35')]['offset']);}_0x15bca2[_0x90fd('0x3e')]=qs['sort'](_0x29b7ea['query'][_0x90fd('0x3f')]);_0x15bca2[_0x90fd('0x42')]=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x29b7ea[_0x90fd('0x35')],_0x57acf6[_0x90fd('0x37')]));if(_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x41')]){_0x15bca2['where']=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x15bca2['attributes'],function(_0x2d0f4b){var _0x4636d5={};_0x4636d5[_0x2d0f4b]={'$like':'%'+_0x29b7ea['query']['filter']+'%'};return _0x4636d5;})});}_0x15bca2[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'mailboxuser':_0x40fea3['mailbox']});_0x15bca2=_[_0x90fd('0x43')]({},_0x15bca2,_0x29b7ea['options']);return db['VoiceMailMessage'][_0x90fd('0x55')](_0x15bca2)['then'](respondWithFilteredResult(_0x461509,_0x15bca2));})[_0x90fd('0x49')](handleError(_0x461509,null));}; \ No newline at end of file +var _0x04b8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x194801,_0x147ece){var _0x18c56c=function(_0x236640){while(--_0x236640){_0x194801['push'](_0x194801['shift']());}};_0x18c56c(++_0x147ece);}(_0x04b8,0x159));var _0x804b=function(_0x2e890e,_0x1a22b7){_0x2e890e=_0x2e890e-0x0;var _0x5d2b7f=_0x04b8[_0x2e890e];return _0x5d2b7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a4eb,_0x5303cc){_0x5303cc=_0x5303cc||0xcc;return function(_0x23ee57){if(_0x23ee57){return _0x15a4eb[_0x804b('0x18')](_0x5303cc);}return _0x15a4eb[_0x804b('0x19')](_0x5303cc)[_0x804b('0x1a')]();};}function respondWithResult(_0x581fbf,_0x215825){_0x215825=_0x215825||0xc8;return function(_0x1b01a7){if(_0x1b01a7){return _0x581fbf[_0x804b('0x19')](_0x215825)[_0x804b('0x1b')](_0x1b01a7);}};}function respondWithFilteredResult(_0x4ff1be,_0x2fd593){return function(_0x8ccbe0){if(_0x8ccbe0){var _0x5e1cfe=typeof _0x2fd593[_0x804b('0x1c')]==='undefined'&&typeof _0x2fd593[_0x804b('0x1d')]===_0x804b('0x1e');var _0x13662e=_0x8ccbe0[_0x804b('0x1f')];var _0x3a05c0=_0x5e1cfe?0x0:_0x2fd593['offset'];var _0x871d6c=_0x5e1cfe?_0x8ccbe0['count']:_0x2fd593[_0x804b('0x1c')]+_0x2fd593[_0x804b('0x1d')];var _0x42cceb;if(_0x871d6c>=_0x13662e){_0x871d6c=_0x13662e;_0x42cceb=0xc8;}else{_0x42cceb=0xce;}_0x4ff1be[_0x804b('0x19')](_0x42cceb);return _0x4ff1be['set'](_0x804b('0x20'),_0x3a05c0+'-'+_0x871d6c+'/'+_0x13662e)[_0x804b('0x1b')](_0x8ccbe0);}return null;};}function patchUpdates(_0x427166){return function(_0x11eaf6){try{jsonpatch[_0x804b('0x21')](_0x11eaf6,_0x427166,!![]);}catch(_0x267878){return BPromise[_0x804b('0x22')](_0x267878);}return _0x11eaf6[_0x804b('0x23')]();};}function saveUpdates(_0xaa9521,_0x2b7271){return function(_0x1acc48){if(_0x1acc48){return _0x1acc48['update'](_0xaa9521)[_0x804b('0x24')](function(_0x5a77e0){return _0x5a77e0;});}return null;};}function removeEntity(_0x5585f8,_0x44a921){return function(_0x367024){if(_0x367024){return _0x367024[_0x804b('0x25')]()[_0x804b('0x24')](function(){var _0x9080c2=_0x367024['get']({'plain':!![]});var _0x2de812=_0x804b('0x26');return db['UserProfileResource'][_0x804b('0x25')]({'where':{'type':_0x2de812,'resourceId':_0x9080c2['id']}})[_0x804b('0x24')](function(){return _0x367024;});})[_0x804b('0x24')](function(){_0x5585f8[_0x804b('0x19')](0xcc)[_0x804b('0x1a')]();});}};}function handleEntityNotFound(_0x5cc1dd,_0x456580){return function(_0x22f822){if(!_0x22f822){_0x5cc1dd[_0x804b('0x18')](0x194);}return _0x22f822;};}function handleError(_0xe145e,_0x3d1ecc){_0x3d1ecc=_0x3d1ecc||0x1f4;return function(_0x4a6079){logger[_0x804b('0x27')](_0x4a6079[_0x804b('0x28')]);if(_0x4a6079[_0x804b('0x29')]){delete _0x4a6079['name'];}_0xe145e[_0x804b('0x19')](_0x3d1ecc)[_0x804b('0x2a')](_0x4a6079);};}exports[_0x804b('0x2b')]=function(_0x57b8da,_0x408857){var _0x471c04={},_0x5e8f85={},_0x391376={'count':0x0,'rows':[]};var _0x37dd3e=_[_0x804b('0x2c')](db[_0x804b('0x2d')][_0x804b('0x2e')],function(_0x241c96){return{'name':_0x241c96['fieldName'],'type':_0x241c96[_0x804b('0x2f')][_0x804b('0x30')]};});_0x5e8f85[_0x804b('0x31')]=_[_0x804b('0x2c')](_0x37dd3e,_0x804b('0x29'));_0x5e8f85[_0x804b('0x32')]=_[_0x804b('0x33')](_0x57b8da[_0x804b('0x32')]);_0x5e8f85[_0x804b('0x34')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],_0x5e8f85[_0x804b('0x32')]);_0x471c04[_0x804b('0x36')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],qs[_0x804b('0x37')](_0x57b8da[_0x804b('0x32')][_0x804b('0x37')]));_0x471c04[_0x804b('0x36')]=_0x471c04[_0x804b('0x36')][_0x804b('0x38')]?_0x471c04[_0x804b('0x36')]:_0x5e8f85[_0x804b('0x31')];if(!_0x57b8da[_0x804b('0x32')][_0x804b('0x39')]('nolimit')){_0x471c04['limit']=qs['limit'](_0x57b8da[_0x804b('0x32')][_0x804b('0x1d')]);_0x471c04[_0x804b('0x1c')]=qs['offset'](_0x57b8da['query']['offset']);}_0x471c04[_0x804b('0x3a')]=qs[_0x804b('0x3b')](_0x57b8da[_0x804b('0x32')][_0x804b('0x3b')]);_0x471c04[_0x804b('0x3c')]=qs[_0x804b('0x34')](_[_0x804b('0x3d')](_0x57b8da[_0x804b('0x32')],_0x5e8f85[_0x804b('0x34')]),_0x37dd3e);if(_0x57b8da[_0x804b('0x32')][_0x804b('0x3e')]){_0x471c04[_0x804b('0x3c')]=_[_0x804b('0x3f')](_0x471c04['where'],{'$or':_[_0x804b('0x2c')](_0x37dd3e,function(_0x4654f4){if(_0x4654f4[_0x804b('0x2f')]!==_0x804b('0x40')){var _0x62cfee={};_0x62cfee[_0x4654f4['name']]={'$like':'%'+_0x57b8da['query'][_0x804b('0x3e')]+'%'};return _0x62cfee;}})});}_0x471c04=_[_0x804b('0x3f')]({},_0x471c04,_0x57b8da[_0x804b('0x41')]);var _0x5206f9={'where':_0x471c04[_0x804b('0x3c')]};return db['VoiceMail'][_0x804b('0x1f')](_0x5206f9)[_0x804b('0x24')](function(_0x20ccc7){_0x391376[_0x804b('0x1f')]=_0x20ccc7;if(_0x57b8da[_0x804b('0x32')][_0x804b('0x42')]){_0x471c04[_0x804b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x804b('0x44')](_0x471c04);})[_0x804b('0x24')](function(_0x1dcec8){_0x391376[_0x804b('0x45')]=_0x1dcec8;return _0x391376;})['then'](respondWithFilteredResult(_0x408857,_0x471c04))[_0x804b('0x46')](handleError(_0x408857,null));};exports[_0x804b('0x47')]=function(_0x1df519,_0x1c3d93){var _0x320aeb={'raw':!![],'where':{'id':_0x1df519[_0x804b('0x48')]['id']}},_0xbca498={};_0xbca498[_0x804b('0x31')]=_['keys'](db[_0x804b('0x2d')]['rawAttributes']);_0xbca498['query']=_['keys'](_0x1df519[_0x804b('0x32')]);_0xbca498['filters']=_[_0x804b('0x35')](_0xbca498[_0x804b('0x31')],_0xbca498[_0x804b('0x32')]);_0x320aeb[_0x804b('0x36')]=_['intersection'](_0xbca498[_0x804b('0x31')],qs[_0x804b('0x37')](_0x1df519[_0x804b('0x32')]['fields']));_0x320aeb[_0x804b('0x36')]=_0x320aeb[_0x804b('0x36')][_0x804b('0x38')]?_0x320aeb['attributes']:_0xbca498[_0x804b('0x31')];if(_0x1df519[_0x804b('0x32')][_0x804b('0x42')]){_0x320aeb[_0x804b('0x43')]=[{'all':!![]}];}_0x320aeb=_[_0x804b('0x3f')]({},_0x320aeb,_0x1df519[_0x804b('0x41')]);return db[_0x804b('0x2d')][_0x804b('0x49')](_0x320aeb)[_0x804b('0x24')](handleEntityNotFound(_0x1c3d93,null))[_0x804b('0x24')](respondWithResult(_0x1c3d93,null))[_0x804b('0x46')](handleError(_0x1c3d93,null));};exports[_0x804b('0x4a')]=function(_0x20862f,_0x2c1796){return db['VoiceMail']['create'](_0x20862f[_0x804b('0x4b')],{})[_0x804b('0x24')](function(_0x82fc71){var _0x53124f=_0x20862f[_0x804b('0x4c')]['get']({'plain':!![]});if(!_0x53124f)throw new Error(_0x804b('0x4d'));if(_0x53124f[_0x804b('0x4e')]===_0x804b('0x4c')){var _0x3ca9ff=_0x82fc71[_0x804b('0x4f')]({'plain':!![]});var _0x111e3f='Voicemails';return db['UserProfileSection'][_0x804b('0x49')]({'where':{'name':_0x111e3f,'userProfileId':_0x53124f[_0x804b('0x50')]},'raw':!![]})['then'](function(_0x5103b7){if(_0x5103b7&&_0x5103b7[_0x804b('0x51')]===0x0){return db[_0x804b('0x52')][_0x804b('0x4a')]({'name':_0x3ca9ff['name'],'resourceId':_0x3ca9ff['id'],'type':_0x5103b7[_0x804b('0x29')],'sectionId':_0x5103b7['id']},{})[_0x804b('0x24')](function(){return _0x82fc71;});}else{return _0x82fc71;}})['catch'](function(_0x2756de){logger['error'](_0x804b('0x53'),_0x2756de);throw _0x2756de;});}return _0x82fc71;})['then'](respondWithResult(_0x2c1796,0xc9))[_0x804b('0x46')](handleError(_0x2c1796,null));};exports[_0x804b('0x54')]=function(_0x47c835,_0x2f9360){if(_0x47c835['body']['id']){delete _0x47c835[_0x804b('0x4b')]['id'];}return db[_0x804b('0x2d')][_0x804b('0x49')]({'where':{'id':_0x47c835[_0x804b('0x48')]['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x2f9360,null))[_0x804b('0x24')](saveUpdates(_0x47c835[_0x804b('0x4b')],null))[_0x804b('0x24')](respondWithResult(_0x2f9360,null))[_0x804b('0x46')](handleError(_0x2f9360,null));};exports[_0x804b('0x25')]=function(_0x5d53f9,_0x53b91d){return db[_0x804b('0x2d')]['find']({'where':{'id':_0x5d53f9['params']['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x53b91d,null))[_0x804b('0x24')](removeEntity(_0x53b91d,null))[_0x804b('0x46')](handleError(_0x53b91d,null));};exports[_0x804b('0x55')]=function(_0x5a549f,_0x4f7cc4,_0x13fa81){return db[_0x804b('0x2d')][_0x804b('0x56')]({'where':{'id':_0x5a549f[_0x804b('0x48')]['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x4f7cc4,null))[_0x804b('0x24')](function(_0x24c9b0){var _0x3100aa;var _0x2c0ed4={},_0x3f0ca3={};_0x3f0ca3[_0x804b('0x31')]=_[_0x804b('0x33')](db[_0x804b('0x57')][_0x804b('0x2e')]);_0x3f0ca3[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5a549f['query']);_0x3f0ca3[_0x804b('0x34')]=_[_0x804b('0x35')](_0x3f0ca3['model'],_0x3f0ca3[_0x804b('0x32')]);_0x2c0ed4[_0x804b('0x36')]=_[_0x804b('0x35')](_0x3f0ca3[_0x804b('0x31')],qs['fields'](_0x5a549f[_0x804b('0x32')][_0x804b('0x37')]));_0x2c0ed4['attributes']=_0x2c0ed4[_0x804b('0x36')][_0x804b('0x38')]?_0x2c0ed4[_0x804b('0x36')]:_0x3f0ca3['model'];if(!_0x5a549f[_0x804b('0x32')][_0x804b('0x39')](_0x804b('0x58'))){_0x2c0ed4[_0x804b('0x1d')]=qs[_0x804b('0x1d')](_0x5a549f['query'][_0x804b('0x1d')]);_0x2c0ed4[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x5a549f[_0x804b('0x32')]['offset']);}_0x2c0ed4['order']=qs[_0x804b('0x3b')](_0x5a549f['query'][_0x804b('0x3b')]);_0x2c0ed4[_0x804b('0x3c')]=qs[_0x804b('0x34')](_[_0x804b('0x3d')](_0x5a549f[_0x804b('0x32')],_0x3f0ca3['filters']));if(_0x5a549f[_0x804b('0x32')][_0x804b('0x3e')]){_0x2c0ed4[_0x804b('0x3c')]=_['merge'](_0x2c0ed4[_0x804b('0x3c')],{'$or':_[_0x804b('0x2c')](_0x2c0ed4['attributes'],function(_0xb9deae){var _0x481bcd={};_0x481bcd[_0xb9deae]={'$like':'%'+_0x5a549f[_0x804b('0x32')][_0x804b('0x3e')]+'%'};return _0x481bcd;})});}_0x2c0ed4['where']=_[_0x804b('0x3f')](_0x2c0ed4[_0x804b('0x3c')],{'mailboxuser':_0x24c9b0[_0x804b('0x59')]});_0x2c0ed4=_['merge']({},_0x2c0ed4,_0x5a549f[_0x804b('0x41')]);return db['VoiceMailMessage'][_0x804b('0x5a')](_0x2c0ed4)[_0x804b('0x24')](respondWithFilteredResult(_0x4f7cc4,_0x2c0ed4));})[_0x804b('0x46')](handleError(_0x4f7cc4,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 92b9b54..1146e16 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 _0x8388=['define','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x9608ff,_0x4a1bea){var _0x2e89f8=function(_0x1f745f){while(--_0x1f745f){_0x9608ff['push'](_0x9608ff['shift']());}};_0x2e89f8(++_0x4a1bea);}(_0x8388,0x162));var _0x8838=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x8388[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var logger=require(_0x8838('0x2'))('api');var moment=require(_0x8838('0x3'));var BPromise=require(_0x8838('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8838('0x5'));var rimraf=require(_0x8838('0x6'));var config=require(_0x8838('0x7'));var attributes=require(_0x8838('0x8'));module[_0x8838('0x9')]=function(_0x4c8d5a,_0x3e8b40){return _0x4c8d5a[_0x8838('0xa')]('VoiceMail',attributes,{'tableName':_0x8838('0xb'),'paranoid':![],'indexes':[{'name':_0x8838('0xc'),'fields':['mailbox',_0x8838('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfcb=['bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment'];(function(_0x6a13ac,_0x14dbda){var _0xf1b2a5=function(_0xec7619){while(--_0xec7619){_0x6a13ac['push'](_0x6a13ac['shift']());}};_0xf1b2a5(++_0x14dbda);}(_0xbfcb,0x181));var _0xbbfc=function(_0x25c293,_0x403d8f){_0x25c293=_0x25c293-0x0;var _0x5da475=_0xbfcb[_0x25c293];return _0x5da475;};'use strict';var _=require(_0xbbfc('0x0'));var util=require(_0xbbfc('0x1'));var logger=require(_0xbbfc('0x2'))(_0xbbfc('0x3'));var moment=require(_0xbbfc('0x4'));var BPromise=require(_0xbbfc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbfc('0x6'));var config=require(_0xbbfc('0x7'));var attributes=require(_0xbbfc('0x8'));module[_0xbbfc('0x9')]=function(_0x3f2950,_0x3baf1d){return _0x3f2950[_0xbbfc('0xa')](_0xbbfc('0xb'),attributes,{'tableName':_0xbbfc('0xc'),'paranoid':![],'indexes':[{'name':_0xbbfc('0xd'),'fields':['mailbox',_0xbbfc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d4e0171..5d08a70 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 _0x191f=['result','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x191f,0x79));var _0xf191=function(_0x79aa02,_0x124f80){_0x79aa02=_0x79aa02-0x0;var _0x341211=_0x191f[_0x79aa02];return _0x341211;};'use strict';var _=require('lodash');var util=require(_0xf191('0x0'));var moment=require('moment');var BPromise=require(_0xf191('0x1'));var rs=require(_0xf191('0x2'));var fs=require('fs');var Redis=require(_0xf191('0x3'));var db=require(_0xf191('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf191('0x5'));var config=require('../../config/environment');var jayson=require(_0xf191('0x6'));var client=jayson[_0xf191('0x7')][_0xf191('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x589a3d,_0x4bc245,_0x23919d){return new BPromise(function(_0x383ded,_0x5abe35){return client[_0xf191('0x9')](_0x589a3d,_0x23919d)[_0xf191('0xa')](function(_0x1e4ece){logger['info'](_0xf191('0xb'),_0x4bc245,_0xf191('0xc'));logger[_0xf191('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4bc245,_0xf191('0xc'),JSON[_0xf191('0xe')](_0x1e4ece));if(_0x1e4ece['error']){if(_0x1e4ece[_0xf191('0xf')][_0xf191('0x10')]===0x1f4){logger['error'](_0xf191('0xb'),_0x4bc245,_0x1e4ece[_0xf191('0xf')][_0xf191('0x11')]);return _0x5abe35(_0x1e4ece['error'][_0xf191('0x11')]);}logger['error'](_0xf191('0xb'),_0x4bc245,_0x1e4ece[_0xf191('0xf')][_0xf191('0x11')]);return _0x383ded(_0x1e4ece[_0xf191('0xf')][_0xf191('0x11')]);}else{logger[_0xf191('0x12')]('VoiceMail,\x20%s,\x20%s',_0x4bc245,'request\x20sent');_0x383ded(_0x1e4ece[_0xf191('0x13')]['message']);}})['catch'](function(_0x4f7b38){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4bc245,_0x4f7b38);_0x5abe35(_0x4f7b38);});});} \ No newline at end of file +var _0x6241=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45a567,_0x312076){var _0x3ef084=function(_0x112ee3){while(--_0x112ee3){_0x45a567['push'](_0x45a567['shift']());}};_0x3ef084(++_0x312076);}(_0x6241,0x76));var _0x1624=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6241[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x1624('0x0'));var util=require(_0x1624('0x1'));var moment=require(_0x1624('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1624('0x3'));var db=require(_0x1624('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1624('0x5'))(_0x1624('0x6'));var config=require(_0x1624('0x7'));var jayson=require(_0x1624('0x8'));var client=jayson[_0x1624('0x9')][_0x1624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5077f6,_0x134a21,_0x304800){return new BPromise(function(_0x5179f3,_0xebcc8f){return client[_0x1624('0xb')](_0x5077f6,_0x304800)[_0x1624('0xc')](function(_0x126922){logger[_0x1624('0xd')](_0x1624('0xe'),_0x134a21,_0x1624('0xf'));logger[_0x1624('0x10')](_0x1624('0x11'),_0x134a21,'request\x20sent',JSON['stringify'](_0x126922));if(_0x126922[_0x1624('0x12')]){if(_0x126922[_0x1624('0x12')][_0x1624('0x13')]===0x1f4){logger[_0x1624('0x12')](_0x1624('0xe'),_0x134a21,_0x126922['error']['message']);return _0xebcc8f(_0x126922[_0x1624('0x12')]['message']);}logger[_0x1624('0x12')](_0x1624('0xe'),_0x134a21,_0x126922[_0x1624('0x12')][_0x1624('0x14')]);return _0x5179f3(_0x126922[_0x1624('0x12')][_0x1624('0x14')]);}else{logger[_0x1624('0xd')](_0x1624('0xe'),_0x134a21,_0x1624('0xf'));_0x5179f3(_0x126922['result'][_0x1624('0x14')]);}})[_0x1624('0x15')](function(_0x43e666){logger[_0x1624('0x12')](_0x1624('0xe'),_0x134a21,_0x43e666);_0xebcc8f(_0x43e666);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0c813b8..0f8d74c 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 _0x3a02=['multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/:id','show','/:id/download','download','isAuthenticated','create','put','delete','destroy','exports'];(function(_0x57ede0,_0x2c5e8c){var _0x60056=function(_0x588cd2){while(--_0x588cd2){_0x57ede0['push'](_0x57ede0['shift']());}};_0x60056(++_0x2c5e8c);}(_0x3a02,0xf7));var _0x23a0=function(_0x1757b0,_0x5caba1){_0x1757b0=_0x1757b0-0x0;var _0x3692d4=_0x3a02[_0x1757b0];return _0x3692d4;};'use strict';var multer=require(_0x23a0('0x0'));var util=require(_0x23a0('0x1'));var path=require(_0x23a0('0x2'));var timeout=require(_0x23a0('0x3'));var express=require(_0x23a0('0x4'));var router=express[_0x23a0('0x5')]();var fs_extra=require(_0x23a0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x23a0('0x7')]('/',auth['isAuthenticated'](),controller[_0x23a0('0x8')]);router['get'](_0x23a0('0x9'),auth['isAuthenticated'](),controller[_0x23a0('0xa')]);router['get'](_0x23a0('0xb'),auth['isAuthenticated'](),controller[_0x23a0('0xc')]);router['post']('/',auth[_0x23a0('0xd')](),controller[_0x23a0('0xe')]);router[_0x23a0('0xf')]('/:id',auth[_0x23a0('0xd')](),controller['update']);router[_0x23a0('0x10')]('/:id',auth[_0x23a0('0xd')](),controller[_0x23a0('0x11')]);module[_0x23a0('0x12')]=router; \ No newline at end of file +var _0xec1d=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xec1d,0xa8));var _0xdec1=function(_0x13b82c,_0x2f45c8){_0x13b82c=_0x13b82c-0x0;var _0x57d0cd=_0xec1d[_0x13b82c];return _0x57d0cd;};'use strict';var multer=require('multer');var util=require(_0xdec1('0x0'));var path=require(_0xdec1('0x1'));var timeout=require(_0xdec1('0x2'));var express=require(_0xdec1('0x3'));var router=express[_0xdec1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdec1('0x5'));var interaction=require(_0xdec1('0x6'));var config=require(_0xdec1('0x7'));var controller=require('./voiceMailMessage.controller');router[_0xdec1('0x8')]('/',auth[_0xdec1('0x9')](),controller[_0xdec1('0xa')]);router[_0xdec1('0x8')](_0xdec1('0xb'),auth[_0xdec1('0x9')](),controller[_0xdec1('0xc')]);router[_0xdec1('0x8')](_0xdec1('0xd'),auth['isAuthenticated'](),controller[_0xdec1('0xe')]);router[_0xdec1('0xf')]('/',auth[_0xdec1('0x9')](),controller[_0xdec1('0x10')]);router[_0xdec1('0x11')](_0xdec1('0xb'),auth['isAuthenticated'](),controller[_0xdec1('0x12')]);router[_0xdec1('0x13')](_0xdec1('0xb'),auth[_0xdec1('0x9')](),controller[_0xdec1('0x14')]);module[_0xdec1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6f3b650..267e438 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 _0x5abb=['getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','exports','VIRTUAL'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x5abb,0x186));var _0xb5ab=function(_0x124ae7,_0x35f564){_0x124ae7=_0x124ae7-0x0;var _0x1305e5=_0x5abb[_0x124ae7];return _0x1305e5;};'use strict';var Sequelize=require('sequelize');module[_0xb5ab('0x0')]={'name':{'type':Sequelize[_0xb5ab('0x1')],'get':function(_0x210f0e){return this[_0xb5ab('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb5ab('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xb5ab('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb5ab('0x4')],'defaultValue':''},'stamp':{'type':_0xb5ab('0x6'),'defaultValue':Sequelize[_0xb5ab('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x8ba2=['VIRTUAL','getDataValue','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x2aa041,_0x46d6f1){var _0x4d0c80=function(_0x39d32c){while(--_0x39d32c){_0x2aa041['push'](_0x2aa041['shift']());}};_0x4d0c80(++_0x46d6f1);}(_0x8ba2,0xb2));var _0x28ba=function(_0x17c497,_0x426b71){_0x17c497=_0x17c497-0x0;var _0x9b55a3=_0x8ba2[_0x17c497];return _0x9b55a3;};'use strict';var Sequelize=require(_0x28ba('0x0'));module[_0x28ba('0x1')]={'name':{'type':Sequelize[_0x28ba('0x2')],'get':function(_0x1097fb){return this[_0x28ba('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x28ba('0x5')](_0x28ba('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x28ba('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x28ba('0x7')](_0x28ba('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 9283394..b37f931 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 _0x9621=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','pick','filter','where','merge','options','VoiceMailMessage','includeAll','include','rows','catch','show','params','find','create','body','download','msg_id','recording','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','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','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy'];(function(_0x1abb64,_0x281460){var _0x3a1ce0=function(_0x4e0ec2){while(--_0x4e0ec2){_0x1abb64['push'](_0x1abb64['shift']());}};_0x3a1ce0(++_0x281460);}(_0x9621,0x11f));var _0x1962=function(_0x4114f5,_0x2dc981){_0x4114f5=_0x4114f5-0x0;var _0x153bda=_0x9621[_0x4114f5];return _0x153bda;};'use strict';var emlformat=require(_0x1962('0x0'));var rimraf=require(_0x1962('0x1'));var zipdir=require(_0x1962('0x2'));var jsonpatch=require(_0x1962('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1962('0x4'));var Mustache=require('mustache');var util=require(_0x1962('0x5'));var path=require(_0x1962('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1962('0x7'));var fs=require('fs');var fs_extra=require(_0x1962('0x8'));var _=require(_0x1962('0x9'));var squel=require(_0x1962('0xa'));var crypto=require(_0x1962('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1962('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1962('0xd'));var Papa=require(_0x1962('0xe'));var Redis=require('ioredis');var authService=require(_0x1962('0xf'));var qs=require(_0x1962('0x10'));var as=require(_0x1962('0x11'));var hardwareService=require(_0x1962('0x12'));var logger=require(_0x1962('0x13'))(_0x1962('0x14'));var utils=require(_0x1962('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1962('0x16'));var db=require(_0x1962('0x17'))['db'];function respondWithStatusCode(_0x266d49,_0x301229){_0x301229=_0x301229||0xcc;return function(_0x46a3ec){if(_0x46a3ec){return _0x266d49[_0x1962('0x18')](_0x301229);}return _0x266d49[_0x1962('0x19')](_0x301229)[_0x1962('0x1a')]();};}function respondWithResult(_0x472f06,_0xb8df7c){_0xb8df7c=_0xb8df7c||0xc8;return function(_0x1fa272){if(_0x1fa272){return _0x472f06[_0x1962('0x19')](_0xb8df7c)[_0x1962('0x1b')](_0x1fa272);}};}function respondWithFilteredResult(_0x53ec0a,_0x4f1bbd){return function(_0x2e2b7b){if(_0x2e2b7b){var _0x2a296e=typeof _0x4f1bbd[_0x1962('0x1c')]===_0x1962('0x1d')&&typeof _0x4f1bbd[_0x1962('0x1e')]===_0x1962('0x1d');var _0x410b1c=_0x2e2b7b[_0x1962('0x1f')];var _0x1ae4c2=_0x2a296e?0x0:_0x4f1bbd[_0x1962('0x1c')];var _0x2bc525=_0x2a296e?_0x2e2b7b[_0x1962('0x1f')]:_0x4f1bbd[_0x1962('0x1c')]+_0x4f1bbd[_0x1962('0x1e')];var _0x420101;if(_0x2bc525>=_0x410b1c){_0x2bc525=_0x410b1c;_0x420101=0xc8;}else{_0x420101=0xce;}_0x53ec0a[_0x1962('0x19')](_0x420101);return _0x53ec0a[_0x1962('0x20')]('Content-Range',_0x1ae4c2+'-'+_0x2bc525+'/'+_0x410b1c)[_0x1962('0x1b')](_0x2e2b7b);}return null;};}function patchUpdates(_0x31ac8a){return function(_0x5b61bd){try{jsonpatch['apply'](_0x5b61bd,_0x31ac8a,!![]);}catch(_0x286b5b){return BPromise[_0x1962('0x21')](_0x286b5b);}return _0x5b61bd['save']();};}function saveUpdates(_0x16cf28,_0x2ec2a8){return function(_0x3d419d){if(_0x3d419d){return _0x3d419d[_0x1962('0x22')](_0x16cf28)[_0x1962('0x23')](function(_0x447b32){return _0x447b32;});}return null;};}function removeEntity(_0x20d47d,_0x37a2e6){return function(_0x129fb6){if(_0x129fb6){return _0x129fb6[_0x1962('0x24')]()['then'](function(){_0x20d47d[_0x1962('0x19')](0xcc)[_0x1962('0x1a')]();});}};}function handleEntityNotFound(_0x4469bf,_0x3ebfac){return function(_0x20f62c){if(!_0x20f62c){_0x4469bf[_0x1962('0x18')](0x194);}return _0x20f62c;};}function handleError(_0x3973d7,_0xa5b496){_0xa5b496=_0xa5b496||0x1f4;return function(_0x45dedf){logger[_0x1962('0x25')](_0x45dedf[_0x1962('0x26')]);if(_0x45dedf[_0x1962('0x27')]){delete _0x45dedf[_0x1962('0x27')];}_0x3973d7[_0x1962('0x19')](_0xa5b496)[_0x1962('0x28')](_0x45dedf);};}exports[_0x1962('0x29')]=function(_0x35ac94,_0x33bfca){var _0x49b4ef={},_0x2061ad={},_0x57a029={'count':0x0,'rows':[]};var _0x5e008a=_[_0x1962('0x2a')](db['VoiceMailMessage'][_0x1962('0x2b')],function(_0x26a2e2){return{'name':_0x26a2e2[_0x1962('0x2c')],'type':_0x26a2e2[_0x1962('0x2d')][_0x1962('0x2e')]};});_0x2061ad['model']=_[_0x1962('0x2f')](_[_0x1962('0x2a')](_0x5e008a,_0x1962('0x27')),[_0x1962('0x27')]);_0x2061ad[_0x1962('0x30')]=_[_0x1962('0x31')](_0x35ac94[_0x1962('0x30')]);_0x2061ad[_0x1962('0x32')]=_[_0x1962('0x33')](_0x2061ad[_0x1962('0x34')],_0x2061ad[_0x1962('0x30')]);_0x49b4ef['attributes']=_['intersection'](_0x2061ad[_0x1962('0x34')],qs[_0x1962('0x35')](_0x35ac94[_0x1962('0x30')][_0x1962('0x35')]));_0x49b4ef[_0x1962('0x36')]=_0x49b4ef['attributes']['length']?_0x49b4ef[_0x1962('0x36')]:_0x2061ad[_0x1962('0x34')];if(!_0x35ac94[_0x1962('0x30')]['hasOwnProperty'](_0x1962('0x37'))){_0x49b4ef[_0x1962('0x1e')]=qs[_0x1962('0x1e')](_0x35ac94[_0x1962('0x30')]['limit']);_0x49b4ef[_0x1962('0x1c')]=qs[_0x1962('0x1c')](_0x35ac94['query'][_0x1962('0x1c')]);}_0x49b4ef['order']=qs[_0x1962('0x38')](_0x35ac94[_0x1962('0x30')]['sort']);_0x49b4ef['where']=qs[_0x1962('0x32')](_[_0x1962('0x39')](_0x35ac94['query'],_0x2061ad[_0x1962('0x32')]),_0x5e008a);if(_0x35ac94[_0x1962('0x30')][_0x1962('0x3a')]){_0x49b4ef[_0x1962('0x3b')]=_[_0x1962('0x3c')](_0x49b4ef[_0x1962('0x3b')],{'$or':_[_0x1962('0x2a')](_0x5e008a,function(_0x385c00){if(_0x385c00[_0x1962('0x2d')]!=='VIRTUAL'){var _0x514661={};_0x514661[_0x385c00[_0x1962('0x27')]]={'$like':'%'+_0x35ac94[_0x1962('0x30')][_0x1962('0x3a')]+'%'};return _0x514661;}})});}_0x49b4ef=_['merge']({},_0x49b4ef,_0x35ac94[_0x1962('0x3d')]);var _0x4448c5={'where':_0x49b4ef[_0x1962('0x3b')]};return db[_0x1962('0x3e')][_0x1962('0x1f')](_0x4448c5)[_0x1962('0x23')](function(_0x3af1db){_0x57a029[_0x1962('0x1f')]=_0x3af1db;if(_0x35ac94[_0x1962('0x30')][_0x1962('0x3f')]){_0x49b4ef[_0x1962('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x49b4ef);})[_0x1962('0x23')](function(_0x2ea132){_0x57a029[_0x1962('0x41')]=_0x2ea132;return _0x57a029;})[_0x1962('0x23')](respondWithFilteredResult(_0x33bfca,_0x49b4ef))[_0x1962('0x42')](handleError(_0x33bfca,null));};exports[_0x1962('0x43')]=function(_0x3e0597,_0x762ac7){var _0x276fa8={'raw':!![],'where':{'id':_0x3e0597[_0x1962('0x44')]['id']}},_0xbff5fb={};_0xbff5fb[_0x1962('0x34')]=_['keys'](db['VoiceMailMessage'][_0x1962('0x2b')]);_0xbff5fb[_0x1962('0x30')]=_[_0x1962('0x31')](_0x3e0597[_0x1962('0x30')]);_0xbff5fb['filters']=_[_0x1962('0x33')](_0xbff5fb[_0x1962('0x34')],_0xbff5fb[_0x1962('0x30')]);_0x276fa8[_0x1962('0x36')]=_[_0x1962('0x33')](_0xbff5fb['model'],qs[_0x1962('0x35')](_0x3e0597[_0x1962('0x30')][_0x1962('0x35')]));_0x276fa8[_0x1962('0x36')]=_0x276fa8[_0x1962('0x36')]['length']?_0x276fa8['attributes']:_0xbff5fb[_0x1962('0x34')];if(_0x3e0597[_0x1962('0x30')][_0x1962('0x3f')]){_0x276fa8[_0x1962('0x40')]=[{'all':!![]}];}_0x276fa8=_['merge']({},_0x276fa8,_0x3e0597[_0x1962('0x3d')]);return db['VoiceMailMessage'][_0x1962('0x45')](_0x276fa8)['then'](handleEntityNotFound(_0x762ac7,null))[_0x1962('0x23')](respondWithResult(_0x762ac7,null))[_0x1962('0x42')](handleError(_0x762ac7,null));};exports['create']=function(_0x22fd9e,_0x127d50){return db[_0x1962('0x3e')][_0x1962('0x46')](_0x22fd9e[_0x1962('0x47')],{})[_0x1962('0x23')](respondWithResult(_0x127d50,0xc9))['catch'](handleError(_0x127d50,null));};exports['update']=function(_0x447294,_0x3cea0e){if(_0x447294[_0x1962('0x47')]['id']){delete _0x447294[_0x1962('0x47')]['id'];}return db[_0x1962('0x3e')][_0x1962('0x45')]({'where':{'id':_0x447294[_0x1962('0x44')]['id']}})[_0x1962('0x23')](handleEntityNotFound(_0x3cea0e,null))[_0x1962('0x23')](saveUpdates(_0x447294[_0x1962('0x47')],null))[_0x1962('0x23')](respondWithResult(_0x3cea0e,null))['catch'](handleError(_0x3cea0e,null));};exports[_0x1962('0x24')]=function(_0x1ddc17,_0x1bfb6d){return db[_0x1962('0x3e')][_0x1962('0x45')]({'where':{'id':_0x1ddc17[_0x1962('0x44')]['id']}})[_0x1962('0x23')](handleEntityNotFound(_0x1bfb6d,null))[_0x1962('0x23')](removeEntity(_0x1bfb6d,null))[_0x1962('0x42')](handleError(_0x1bfb6d,null));};exports[_0x1962('0x48')]=function(_0xd8cdfb,_0x259b83,_0x44f85a){return db['VoiceMailMessage']['find']({'where':{'id':_0xd8cdfb[_0x1962('0x44')]['id']},'attributes':['id','recording',_0x1962('0x49')]})[_0x1962('0x23')](handleEntityNotFound(_0x259b83,null))['then'](function(_0x4b2a55){if(_0x4b2a55){if(!_0x4b2a55[_0x1962('0x4a')]){throw new db[(_0x1962('0x4b'))][(_0x1962('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x10d0ac={'Content-Type':'audio/wav','Content-Disposition':_0x1962('0x4d')};if(_0x4b2a55[_0x1962('0x49')]){_0x10d0ac[_0x1962('0x4e')]=_0x1962('0x4f')+_0x4b2a55[_0x1962('0x49')]+_0x1962('0x50');}_0x259b83[_0x1962('0x20')](_0x10d0ac);return _0x259b83[_0x1962('0x28')](new Buffer(_0x4b2a55['recording']));}})[_0x1962('0x42')](handleError(_0x259b83,null));}; \ No newline at end of file +var _0x663f=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','rawAttributes','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceMailMessage','findAll','rows','catch','keys','includeAll','include','find','body','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4c4fbe,_0x483482){var _0x39b3b9=function(_0x803f56){while(--_0x803f56){_0x4c4fbe['push'](_0x4c4fbe['shift']());}};_0x39b3b9(++_0x483482);}(_0x663f,0x17f));var _0xf663=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x663f[_0x4ed4d2];return _0x15ae2e;};'use strict';var emlformat=require(_0xf663('0x0'));var rimraf=require(_0xf663('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf663('0x2'));var moment=require(_0xf663('0x3'));var BPromise=require(_0xf663('0x4'));var Mustache=require(_0xf663('0x5'));var util=require(_0xf663('0x6'));var path=require(_0xf663('0x7'));var sox=require(_0xf663('0x8'));var csv=require(_0xf663('0x9'));var ejs=require(_0xf663('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf663('0xb'));var squel=require('squel');var crypto=require(_0xf663('0xc'));var jsforce=require(_0xf663('0xd'));var deskjs=require(_0xf663('0xe'));var toCsv=require(_0xf663('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf663('0xf'));var as=require(_0xf663('0x10'));var hardwareService=require(_0xf663('0x11'));var logger=require(_0xf663('0x12'))(_0xf663('0x13'));var utils=require(_0xf663('0x14'));var config=require(_0xf663('0x15'));var licenseUtil=require(_0xf663('0x16'));var db=require(_0xf663('0x17'))['db'];function respondWithStatusCode(_0x1d346a,_0x3e899d){_0x3e899d=_0x3e899d||0xcc;return function(_0x493ace){if(_0x493ace){return _0x1d346a[_0xf663('0x18')](_0x3e899d);}return _0x1d346a['status'](_0x3e899d)[_0xf663('0x19')]();};}function respondWithResult(_0x4f6577,_0x236e50){_0x236e50=_0x236e50||0xc8;return function(_0x49fc14){if(_0x49fc14){return _0x4f6577[_0xf663('0x1a')](_0x236e50)[_0xf663('0x1b')](_0x49fc14);}};}function respondWithFilteredResult(_0x43b9a8,_0x2f2869){return function(_0x356e5a){if(_0x356e5a){var _0x578982=typeof _0x2f2869[_0xf663('0x1c')]===_0xf663('0x1d')&&typeof _0x2f2869[_0xf663('0x1e')]===_0xf663('0x1d');var _0x157b22=_0x356e5a[_0xf663('0x1f')];var _0x531a29=_0x578982?0x0:_0x2f2869['offset'];var _0x8cf4ac=_0x578982?_0x356e5a[_0xf663('0x1f')]:_0x2f2869['offset']+_0x2f2869[_0xf663('0x1e')];var _0x2e70e9;if(_0x8cf4ac>=_0x157b22){_0x8cf4ac=_0x157b22;_0x2e70e9=0xc8;}else{_0x2e70e9=0xce;}_0x43b9a8[_0xf663('0x1a')](_0x2e70e9);return _0x43b9a8[_0xf663('0x20')](_0xf663('0x21'),_0x531a29+'-'+_0x8cf4ac+'/'+_0x157b22)[_0xf663('0x1b')](_0x356e5a);}return null;};}function patchUpdates(_0x1c4a93){return function(_0xa653d8){try{jsonpatch['apply'](_0xa653d8,_0x1c4a93,!![]);}catch(_0x3012a8){return BPromise[_0xf663('0x22')](_0x3012a8);}return _0xa653d8[_0xf663('0x23')]();};}function saveUpdates(_0x2a3757,_0x38927){return function(_0x5e7eb9){if(_0x5e7eb9){return _0x5e7eb9[_0xf663('0x24')](_0x2a3757)['then'](function(_0x305d8e){return _0x305d8e;});}return null;};}function removeEntity(_0x3289a1,_0x50798c){return function(_0x1a3c6e){if(_0x1a3c6e){return _0x1a3c6e[_0xf663('0x25')]()[_0xf663('0x26')](function(){_0x3289a1[_0xf663('0x1a')](0xcc)[_0xf663('0x19')]();});}};}function handleEntityNotFound(_0x5bb8dc,_0x1ee974){return function(_0x48f17b){if(!_0x48f17b){_0x5bb8dc[_0xf663('0x18')](0x194);}return _0x48f17b;};}function handleError(_0x4ca09b,_0x53d34b){_0x53d34b=_0x53d34b||0x1f4;return function(_0x56154c){logger[_0xf663('0x27')](_0x56154c['stack']);if(_0x56154c[_0xf663('0x28')]){delete _0x56154c[_0xf663('0x28')];}_0x4ca09b[_0xf663('0x1a')](_0x53d34b)[_0xf663('0x29')](_0x56154c);};}exports['index']=function(_0x667f4,_0x3afbc4){var _0x4b55e2={},_0x2a5d48={},_0x401142={'count':0x0,'rows':[]};var _0x1d3ee3=_[_0xf663('0x2a')](db['VoiceMailMessage'][_0xf663('0x2b')],function(_0x114279){return{'name':_0x114279['fieldName'],'type':_0x114279[_0xf663('0x2c')][_0xf663('0x2d')]};});_0x2a5d48[_0xf663('0x2e')]=_[_0xf663('0x2f')](_[_0xf663('0x2a')](_0x1d3ee3,'name'),['name']);_0x2a5d48[_0xf663('0x30')]=_['keys'](_0x667f4[_0xf663('0x30')]);_0x2a5d48[_0xf663('0x31')]=_[_0xf663('0x32')](_0x2a5d48[_0xf663('0x2e')],_0x2a5d48[_0xf663('0x30')]);_0x4b55e2[_0xf663('0x33')]=_[_0xf663('0x32')](_0x2a5d48[_0xf663('0x2e')],qs[_0xf663('0x34')](_0x667f4[_0xf663('0x30')][_0xf663('0x34')]));_0x4b55e2[_0xf663('0x33')]=_0x4b55e2[_0xf663('0x33')][_0xf663('0x35')]?_0x4b55e2[_0xf663('0x33')]:_0x2a5d48[_0xf663('0x2e')];if(!_0x667f4[_0xf663('0x30')]['hasOwnProperty'](_0xf663('0x36'))){_0x4b55e2[_0xf663('0x1e')]=qs[_0xf663('0x1e')](_0x667f4[_0xf663('0x30')][_0xf663('0x1e')]);_0x4b55e2[_0xf663('0x1c')]=qs[_0xf663('0x1c')](_0x667f4[_0xf663('0x30')][_0xf663('0x1c')]);}_0x4b55e2[_0xf663('0x37')]=qs[_0xf663('0x38')](_0x667f4[_0xf663('0x30')][_0xf663('0x38')]);_0x4b55e2[_0xf663('0x39')]=qs[_0xf663('0x31')](_[_0xf663('0x3a')](_0x667f4[_0xf663('0x30')],_0x2a5d48['filters']),_0x1d3ee3);if(_0x667f4[_0xf663('0x30')]['filter']){_0x4b55e2['where']=_[_0xf663('0x3b')](_0x4b55e2[_0xf663('0x39')],{'$or':_[_0xf663('0x2a')](_0x1d3ee3,function(_0x4d044f){if(_0x4d044f[_0xf663('0x2c')]!==_0xf663('0x3c')){var _0x305b81={};_0x305b81[_0x4d044f[_0xf663('0x28')]]={'$like':'%'+_0x667f4[_0xf663('0x30')]['filter']+'%'};return _0x305b81;}})});}_0x4b55e2=_[_0xf663('0x3b')]({},_0x4b55e2,_0x667f4[_0xf663('0x3d')]);var _0x4415e1={'where':_0x4b55e2[_0xf663('0x39')]};return db['VoiceMailMessage'][_0xf663('0x1f')](_0x4415e1)[_0xf663('0x26')](function(_0x139c8f){_0x401142[_0xf663('0x1f')]=_0x139c8f;if(_0x667f4[_0xf663('0x30')]['includeAll']){_0x4b55e2['include']=[{'all':!![]}];}return db[_0xf663('0x3e')][_0xf663('0x3f')](_0x4b55e2);})[_0xf663('0x26')](function(_0x560f83){_0x401142[_0xf663('0x40')]=_0x560f83;return _0x401142;})[_0xf663('0x26')](respondWithFilteredResult(_0x3afbc4,_0x4b55e2))[_0xf663('0x41')](handleError(_0x3afbc4,null));};exports['show']=function(_0x3668e9,_0x3a4d4e){var _0xdc89f8={'raw':!![],'where':{'id':_0x3668e9['params']['id']}},_0x207723={};_0x207723[_0xf663('0x2e')]=_[_0xf663('0x42')](db['VoiceMailMessage'][_0xf663('0x2b')]);_0x207723[_0xf663('0x30')]=_['keys'](_0x3668e9[_0xf663('0x30')]);_0x207723[_0xf663('0x31')]=_['intersection'](_0x207723[_0xf663('0x2e')],_0x207723[_0xf663('0x30')]);_0xdc89f8['attributes']=_['intersection'](_0x207723[_0xf663('0x2e')],qs[_0xf663('0x34')](_0x3668e9['query']['fields']));_0xdc89f8[_0xf663('0x33')]=_0xdc89f8[_0xf663('0x33')][_0xf663('0x35')]?_0xdc89f8[_0xf663('0x33')]:_0x207723[_0xf663('0x2e')];if(_0x3668e9['query'][_0xf663('0x43')]){_0xdc89f8[_0xf663('0x44')]=[{'all':!![]}];}_0xdc89f8=_[_0xf663('0x3b')]({},_0xdc89f8,_0x3668e9[_0xf663('0x3d')]);return db[_0xf663('0x3e')][_0xf663('0x45')](_0xdc89f8)[_0xf663('0x26')](handleEntityNotFound(_0x3a4d4e,null))['then'](respondWithResult(_0x3a4d4e,null))[_0xf663('0x41')](handleError(_0x3a4d4e,null));};exports['create']=function(_0x552fb5,_0x5a6385){return db['VoiceMailMessage']['create'](_0x552fb5['body'],{})[_0xf663('0x26')](respondWithResult(_0x5a6385,0xc9))['catch'](handleError(_0x5a6385,null));};exports[_0xf663('0x24')]=function(_0x3bd544,_0x11d74e){if(_0x3bd544[_0xf663('0x46')]['id']){delete _0x3bd544[_0xf663('0x46')]['id'];}return db[_0xf663('0x3e')][_0xf663('0x45')]({'where':{'id':_0x3bd544[_0xf663('0x47')]['id']}})['then'](handleEntityNotFound(_0x11d74e,null))[_0xf663('0x26')](saveUpdates(_0x3bd544[_0xf663('0x46')],null))['then'](respondWithResult(_0x11d74e,null))[_0xf663('0x41')](handleError(_0x11d74e,null));};exports[_0xf663('0x25')]=function(_0x5833ff,_0x5caabe){return db[_0xf663('0x3e')][_0xf663('0x45')]({'where':{'id':_0x5833ff[_0xf663('0x47')]['id']}})['then'](handleEntityNotFound(_0x5caabe,null))[_0xf663('0x26')](removeEntity(_0x5caabe,null))[_0xf663('0x41')](handleError(_0x5caabe,null));};exports[_0xf663('0x48')]=function(_0x2bdcf9,_0x7ad761,_0x388572){return db[_0xf663('0x3e')][_0xf663('0x45')]({'where':{'id':_0x2bdcf9['params']['id']},'attributes':['id','recording',_0xf663('0x49')]})['then'](handleEntityNotFound(_0x7ad761,null))[_0xf663('0x26')](function(_0x4b5416){if(_0x4b5416){if(!_0x4b5416[_0xf663('0x4a')]){throw new db[(_0xf663('0x4b'))][(_0xf663('0x4c'))](_0xf663('0x4d'));}var _0x4fbf1b={'Content-Type':'audio/wav','Content-Disposition':_0xf663('0x4e')};if(_0x4b5416[_0xf663('0x49')]){_0x4fbf1b[_0xf663('0x4f')]='attachment;\x20filename=\x22'+_0x4b5416[_0xf663('0x49')]+_0xf663('0x50');}_0x7ad761[_0xf663('0x20')](_0x4fbf1b);return _0x7ad761[_0xf663('0x29')](new Buffer(_0x4b5416[_0xf663('0x4a')]));}})[_0xf663('0x41')](handleError(_0x7ad761,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ba369ca..da17522 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 _0x744b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger'];(function(_0x1fd138,_0x3d9924){var _0x7cfcf7=function(_0x30fdf9){while(--_0x30fdf9){_0x1fd138['push'](_0x1fd138['shift']());}};_0x7cfcf7(++_0x3d9924);}(_0x744b,0xcf));var _0xb744=function(_0xec05a,_0xae2200){_0xec05a=_0xec05a-0x0;var _0x5911e2=_0x744b[_0xec05a];return _0x5911e2;};'use strict';var _=require(_0xb744('0x0'));var util=require(_0xb744('0x1'));var logger=require(_0xb744('0x2'))(_0xb744('0x3'));var moment=require(_0xb744('0x4'));var BPromise=require(_0xb744('0x5'));var rp=require(_0xb744('0x6'));var fs=require('fs');var path=require(_0xb744('0x7'));var rimraf=require(_0xb744('0x8'));var config=require(_0xb744('0x9'));var attributes=require(_0xb744('0xa'));module[_0xb744('0xb')]=function(_0x4a9728,_0x5288a3){return _0x4a9728[_0xb744('0xc')](_0xb744('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xb744('0xe'),'fields':[_0xb744('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xaf0e=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xaf0e,0x1d8));var _0xeaf0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaf0e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xeaf0('0x0'));var util=require('util');var logger=require(_0xeaf0('0x1'))(_0xeaf0('0x2'));var moment=require(_0xeaf0('0x3'));var BPromise=require(_0xeaf0('0x4'));var rp=require(_0xeaf0('0x5'));var fs=require('fs');var path=require(_0xeaf0('0x6'));var rimraf=require(_0xeaf0('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xeaf0('0x8')]=function(_0xec2ecb,_0xfadb97){return _0xec2ecb[_0xeaf0('0x9')](_0xeaf0('0xa'),attributes,{'tableName':_0xeaf0('0xb'),'paranoid':![],'indexes':[{'name':_0xeaf0('0xc'),'fields':[_0xeaf0('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f6e44c6..a74bfb7 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 _0x9540=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x1b5838,_0x25ec5b){var _0x213065=function(_0xde01bf){while(--_0xde01bf){_0x1b5838['push'](_0x1b5838['shift']());}};_0x213065(++_0x25ec5b);}(_0x9540,0x14a));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0954('0x0'));var util=require(_0x0954('0x1'));var moment=require(_0x0954('0x2'));var BPromise=require(_0x0954('0x3'));var rs=require(_0x0954('0x4'));var fs=require('fs');var Redis=require(_0x0954('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0954('0x6'));var logger=require(_0x0954('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0954('0x8'));var client=jayson[_0x0954('0x9')][_0x0954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7907,_0x1fcc7d,_0x2dec24){return new BPromise(function(_0x2bf7a0,_0x31fbc9){return client['request'](_0x4d7907,_0x2dec24)[_0x0954('0xb')](function(_0x5df0c7){logger[_0x0954('0xc')](_0x0954('0xd'),_0x1fcc7d,'request\x20sent');logger[_0x0954('0xe')](_0x0954('0xf'),_0x1fcc7d,_0x0954('0x10'),JSON[_0x0954('0x11')](_0x5df0c7));if(_0x5df0c7[_0x0954('0x12')]){if(_0x5df0c7[_0x0954('0x12')]['code']===0x1f4){logger[_0x0954('0x12')](_0x0954('0xd'),_0x1fcc7d,_0x5df0c7[_0x0954('0x12')][_0x0954('0x13')]);return _0x31fbc9(_0x5df0c7['error'][_0x0954('0x13')]);}logger[_0x0954('0x12')](_0x0954('0xd'),_0x1fcc7d,_0x5df0c7[_0x0954('0x12')]['message']);return _0x2bf7a0(_0x5df0c7[_0x0954('0x12')][_0x0954('0x13')]);}else{logger[_0x0954('0xc')](_0x0954('0xd'),_0x1fcc7d,_0x0954('0x10'));_0x2bf7a0(_0x5df0c7[_0x0954('0x14')][_0x0954('0x13')]);}})[_0x0954('0x15')](function(_0x372267){logger[_0x0954('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1fcc7d,_0x372267);_0x31fbc9(_0x372267);});});} \ No newline at end of file +var _0x9d67=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash'];(function(_0x3cdddf,_0x17119c){var _0x51e2d6=function(_0x16f1ea){while(--_0x16f1ea){_0x3cdddf['push'](_0x3cdddf['shift']());}};_0x51e2d6(++_0x17119c);}(_0x9d67,0x77));var _0x79d6=function(_0x5dcc3d,_0x365c26){_0x5dcc3d=_0x5dcc3d-0x0;var _0x79e198=_0x9d67[_0x5dcc3d];return _0x79e198;};'use strict';var _=require(_0x79d6('0x0'));var util=require(_0x79d6('0x1'));var moment=require(_0x79d6('0x2'));var BPromise=require(_0x79d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x79d6('0x4'));var logger=require(_0x79d6('0x5'))(_0x79d6('0x6'));var config=require(_0x79d6('0x7'));var jayson=require(_0x79d6('0x8'));var client=jayson['client'][_0x79d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d06a2,_0x58b4bd,_0x583e9f){return new BPromise(function(_0x23b1d5,_0x5e75d5){return client['request'](_0x2d06a2,_0x583e9f)[_0x79d6('0xa')](function(_0xb5eeb){logger[_0x79d6('0xb')](_0x79d6('0xc'),_0x58b4bd,'request\x20sent');logger[_0x79d6('0xd')](_0x79d6('0xe'),_0x58b4bd,'request\x20sent',JSON[_0x79d6('0xf')](_0xb5eeb));if(_0xb5eeb[_0x79d6('0x10')]){if(_0xb5eeb[_0x79d6('0x10')]['code']===0x1f4){logger[_0x79d6('0x10')](_0x79d6('0xc'),_0x58b4bd,_0xb5eeb[_0x79d6('0x10')][_0x79d6('0x11')]);return _0x5e75d5(_0xb5eeb[_0x79d6('0x10')]['message']);}logger[_0x79d6('0x10')](_0x79d6('0xc'),_0x58b4bd,_0xb5eeb[_0x79d6('0x10')][_0x79d6('0x11')]);return _0x23b1d5(_0xb5eeb[_0x79d6('0x10')][_0x79d6('0x11')]);}else{logger[_0x79d6('0xb')](_0x79d6('0xc'),_0x58b4bd,_0x79d6('0x12'));_0x23b1d5(_0xb5eeb['result'][_0x79d6('0x11')]);}})[_0x79d6('0x13')](function(_0x5ec929){logger[_0x79d6('0x10')](_0x79d6('0xc'),_0x58b4bd,_0x5ec929);_0x5e75d5(_0x5ec929);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 18a49a0..d913503 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 _0x1b10=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','getSounds','post','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound'];(function(_0x1ebfc7,_0x2797db){var _0x1627b8=function(_0x59ceee){while(--_0x59ceee){_0x1ebfc7['push'](_0x1ebfc7['shift']());}};_0x1627b8(++_0x2797db);}(_0x1b10,0xe6));var _0x01b1=function(_0x50e04d,_0x5e9c4e){_0x50e04d=_0x50e04d-0x0;var _0x448df3=_0x1b10[_0x50e04d];return _0x448df3;};'use strict';var multer=require(_0x01b1('0x0'));var util=require('util');var path=require(_0x01b1('0x1'));var timeout=require(_0x01b1('0x2'));var express=require(_0x01b1('0x3'));var router=express[_0x01b1('0x4')]();var fs_extra=require(_0x01b1('0x5'));var auth=require(_0x01b1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x01b1('0x7'));var controller=require(_0x01b1('0x8'));router[_0x01b1('0x9')]('/',auth['isAuthenticated'](),controller[_0x01b1('0xa')]);router[_0x01b1('0x9')](_0x01b1('0xb'),auth[_0x01b1('0xc')](),controller[_0x01b1('0xd')]);router[_0x01b1('0x9')]('/:id/sounds',auth[_0x01b1('0xc')](),controller[_0x01b1('0xe')]);router[_0x01b1('0xf')]('/',auth[_0x01b1('0xc')](),controller['create']);router['post'](_0x01b1('0x10'),auth[_0x01b1('0xc')](),controller[_0x01b1('0x11')]);router[_0x01b1('0x12')](_0x01b1('0xb'),auth[_0x01b1('0xc')](),controller[_0x01b1('0x13')]);router[_0x01b1('0x14')]('/:id',auth[_0x01b1('0xc')](),controller['destroy']);router[_0x01b1('0x14')](_0x01b1('0x15'),auth[_0x01b1('0xc')](),controller[_0x01b1('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa30a=['get','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x468cf2,_0x465b5f){var _0x19030d=function(_0x1823fa){while(--_0x1823fa){_0x468cf2['push'](_0x468cf2['shift']());}};_0x19030d(++_0x465b5f);}(_0xa30a,0xe7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xaa30('0x0'));var path=require(_0xaa30('0x1'));var timeout=require(_0xaa30('0x2'));var express=require(_0xaa30('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa30('0x4'));var interaction=require(_0xaa30('0x5'));var config=require(_0xaa30('0x6'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xaa30('0x7')](),controller[_0xaa30('0x8')]);router[_0xaa30('0x9')]('/:id',auth[_0xaa30('0x7')](),controller[_0xaa30('0xa')]);router['get'](_0xaa30('0xb'),auth[_0xaa30('0x7')](),controller[_0xaa30('0xc')]);router[_0xaa30('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa30('0xe')]);router[_0xaa30('0xd')](_0xaa30('0xb'),auth[_0xaa30('0x7')](),controller[_0xaa30('0xf')]);router[_0xaa30('0x10')](_0xaa30('0x11'),auth[_0xaa30('0x7')](),controller[_0xaa30('0x12')]);router['delete']('/:id',auth[_0xaa30('0x7')](),controller[_0xaa30('0x13')]);router[_0xaa30('0x14')](_0xaa30('0x15'),auth[_0xaa30('0x7')](),controller[_0xaa30('0x16')]);module[_0xaa30('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c9b3e9b..151ddd6 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 _0x3acc=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports'];(function(_0x14bad0,_0x4d9a4e){var _0x5f5275=function(_0x119420){while(--_0x119420){_0x14bad0['push'](_0x14bad0['shift']());}};_0x5f5275(++_0x4d9a4e);}(_0x3acc,0xb4));var _0xc3ac=function(_0x48da73,_0x4bca4a){_0x48da73=_0x48da73-0x0;var _0x657979=_0x3acc[_0x48da73];return _0x657979;};'use strict';var Sequelize=require(_0xc3ac('0x0'));module[_0xc3ac('0x1')]={'name':{'type':Sequelize[_0xc3ac('0x2')],'allowNull':![],'unique':_0xc3ac('0x3')},'mode':{'type':Sequelize[_0xc3ac('0x4')](_0xc3ac('0x5'),_0xc3ac('0x6'),_0xc3ac('0x7'),_0xc3ac('0x8'),_0xc3ac('0x9'),_0xc3ac('0xa')),'allowNull':!![],'defaultValue':_0xc3ac('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xc3ac('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc3ac('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc3ac('0x2')],'allowNull':!![],'defaultValue':_0xc3ac('0xb')},'format':{'type':Sequelize[_0xc3ac('0x2')],'allowNull':!![]},'stamp':{'type':_0xc3ac('0xc')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa780=['BOOLEAN','exports','STRING','ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0xa780,0x97));var _0x0a78=function(_0x582f8f,_0x271d59){_0x582f8f=_0x582f8f-0x0;var _0x14d725=_0xa780[_0x582f8f];return _0x14d725;};'use strict';var Sequelize=require('sequelize');module[_0x0a78('0x0')]={'name':{'type':Sequelize[_0x0a78('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x0a78('0x2')]('custom',_0x0a78('0x3'),_0x0a78('0x4'),_0x0a78('0x5'),'quietmp3',_0x0a78('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x0a78('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0a78('0x1')],'allowNull':!![],'defaultValue':_0x0a78('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x0a78('0x8')},'defaultEntry':{'type':Sequelize[_0x0a78('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 55303eb..b486dd2 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 _0xf410=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','merge','find','update','body','create','transaction','files','directory','join','root','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','ValidationError','removeSound','id2','Sound','getSounds','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x43faa3,_0x478c98){var _0x127d0a=function(_0x466111){while(--_0x466111){_0x43faa3['push'](_0x43faa3['shift']());}};_0x127d0a(++_0x478c98);}(_0xf410,0xdd));var _0x0f41=function(_0x4301b5,_0x642e7e){_0x4301b5=_0x4301b5-0x0;var _0xfedf16=_0xf410[_0x4301b5];return _0xfedf16;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f41('0x0'));var jsonpatch=require(_0x0f41('0x1'));var rp=require(_0x0f41('0x2'));var moment=require(_0x0f41('0x3'));var BPromise=require(_0x0f41('0x4'));var Mustache=require('mustache');var util=require(_0x0f41('0x5'));var path=require(_0x0f41('0x6'));var sox=require(_0x0f41('0x7'));var csv=require(_0x0f41('0x8'));var ejs=require(_0x0f41('0x9'));var fs=require('fs');var fs_extra=require(_0x0f41('0xa'));var _=require(_0x0f41('0xb'));var squel=require('squel');var crypto=require(_0x0f41('0xc'));var jsforce=require(_0x0f41('0xd'));var deskjs=require(_0x0f41('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f41('0xf'));var Papa=require(_0x0f41('0x10'));var Redis=require(_0x0f41('0x11'));var authService=require(_0x0f41('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f41('0x13'));var hardwareService=require(_0x0f41('0x14'));var logger=require(_0x0f41('0x15'))(_0x0f41('0x16'));var utils=require(_0x0f41('0x17'));var config=require(_0x0f41('0x18'));var licenseUtil=require(_0x0f41('0x19'));var db=require(_0x0f41('0x1a'))['db'];function respondWithStatusCode(_0x29a619,_0x15b98c){_0x15b98c=_0x15b98c||0xcc;return function(_0x550832){if(_0x550832){return _0x29a619[_0x0f41('0x1b')](_0x15b98c);}return _0x29a619[_0x0f41('0x1c')](_0x15b98c)[_0x0f41('0x1d')]();};}function respondWithResult(_0x31198a,_0x313ef8){_0x313ef8=_0x313ef8||0xc8;return function(_0x2c564f){if(_0x2c564f){return _0x31198a[_0x0f41('0x1c')](_0x313ef8)['json'](_0x2c564f);}};}function respondWithFilteredResult(_0x54cc2a,_0x1b04b5){return function(_0x2877b3){if(_0x2877b3){var _0x3d7d24=typeof _0x1b04b5[_0x0f41('0x1e')]===_0x0f41('0x1f')&&typeof _0x1b04b5[_0x0f41('0x20')]===_0x0f41('0x1f');var _0x32f195=_0x2877b3['count'];var _0x34f9f0=_0x3d7d24?0x0:_0x1b04b5[_0x0f41('0x1e')];var _0xd4e970=_0x3d7d24?_0x2877b3['count']:_0x1b04b5[_0x0f41('0x1e')]+_0x1b04b5[_0x0f41('0x20')];var _0xdaaf72;if(_0xd4e970>=_0x32f195){_0xd4e970=_0x32f195;_0xdaaf72=0xc8;}else{_0xdaaf72=0xce;}_0x54cc2a[_0x0f41('0x1c')](_0xdaaf72);return _0x54cc2a['set'](_0x0f41('0x21'),_0x34f9f0+'-'+_0xd4e970+'/'+_0x32f195)[_0x0f41('0x22')](_0x2877b3);}return null;};}function patchUpdates(_0x4c6756){return function(_0x1e2892){try{jsonpatch[_0x0f41('0x23')](_0x1e2892,_0x4c6756,!![]);}catch(_0x186e6c){return BPromise[_0x0f41('0x24')](_0x186e6c);}return _0x1e2892[_0x0f41('0x25')]();};}function saveUpdates(_0x3c44af,_0x3fcc49){return function(_0x57561e){if(_0x57561e){return _0x57561e['update'](_0x3c44af)[_0x0f41('0x26')](function(_0x521905){return _0x521905;});}return null;};}function removeEntity(_0x1385ff,_0x224825){return function(_0x6b6a1b){if(_0x6b6a1b){return _0x6b6a1b[_0x0f41('0x27')]()[_0x0f41('0x26')](function(){var _0x15bb2d=_0x6b6a1b['get']({'plain':!![]});var _0x28bca1='MusicOnHolds';return db[_0x0f41('0x28')]['destroy']({'where':{'type':_0x28bca1,'resourceId':_0x15bb2d['id']}})[_0x0f41('0x26')](function(){return _0x6b6a1b;});})[_0x0f41('0x26')](function(){_0x1385ff[_0x0f41('0x1c')](0xcc)[_0x0f41('0x1d')]();});}};}function handleEntityNotFound(_0x2c14c8,_0x24d882){return function(_0x2f53dd){if(!_0x2f53dd){_0x2c14c8[_0x0f41('0x1b')](0x194);}return _0x2f53dd;};}function handleError(_0x1a60b1,_0x4b3811){_0x4b3811=_0x4b3811||0x1f4;return function(_0x245728){logger[_0x0f41('0x29')](_0x245728[_0x0f41('0x2a')]);if(_0x245728[_0x0f41('0x2b')]){delete _0x245728[_0x0f41('0x2b')];}_0x1a60b1[_0x0f41('0x1c')](_0x4b3811)[_0x0f41('0x2c')](_0x245728);};}exports[_0x0f41('0x2d')]=function(_0x27d497,_0x5d3eeb){var _0x24a250={},_0x3e9c87={},_0x4355a8={'count':0x0,'rows':[]};var _0x2a25e9=_[_0x0f41('0x2e')](db[_0x0f41('0x2f')][_0x0f41('0x30')],function(_0x4ea189){return{'name':_0x4ea189[_0x0f41('0x31')],'type':_0x4ea189[_0x0f41('0x32')][_0x0f41('0x33')]};});_0x3e9c87[_0x0f41('0x34')]=_[_0x0f41('0x2e')](_0x2a25e9,_0x0f41('0x2b'));_0x3e9c87[_0x0f41('0x35')]=_[_0x0f41('0x36')](_0x27d497[_0x0f41('0x35')]);_0x3e9c87[_0x0f41('0x37')]=_[_0x0f41('0x38')](_0x3e9c87[_0x0f41('0x34')],_0x3e9c87['query']);_0x24a250['attributes']=_[_0x0f41('0x38')](_0x3e9c87['model'],qs[_0x0f41('0x39')](_0x27d497[_0x0f41('0x35')][_0x0f41('0x39')]));_0x24a250[_0x0f41('0x3a')]=_0x24a250['attributes'][_0x0f41('0x3b')]?_0x24a250[_0x0f41('0x3a')]:_0x3e9c87[_0x0f41('0x34')];if(!_0x27d497[_0x0f41('0x35')][_0x0f41('0x3c')](_0x0f41('0x3d'))){_0x24a250[_0x0f41('0x20')]=qs[_0x0f41('0x20')](_0x27d497[_0x0f41('0x35')][_0x0f41('0x20')]);_0x24a250[_0x0f41('0x1e')]=qs[_0x0f41('0x1e')](_0x27d497[_0x0f41('0x35')][_0x0f41('0x1e')]);}_0x24a250[_0x0f41('0x3e')]=qs[_0x0f41('0x3f')](_0x27d497['query'][_0x0f41('0x3f')]);delete _0x27d497[_0x0f41('0x35')][_0x0f41('0x3f')];_0x24a250[_0x0f41('0x40')]=qs[_0x0f41('0x37')](_[_0x0f41('0x41')](_0x27d497['query'],_0x3e9c87[_0x0f41('0x37')]),_0x2a25e9);if(_0x27d497['query'][_0x0f41('0x42')]){_0x24a250['where']=_['merge'](_0x24a250[_0x0f41('0x40')],{'$or':_['map'](_0x2a25e9,function(_0x30dc53){if(_0x30dc53['type']!==_0x0f41('0x43')){var _0xa6f06={};_0xa6f06[_0x30dc53[_0x0f41('0x2b')]]={'$like':'%'+_0x27d497[_0x0f41('0x35')][_0x0f41('0x42')]+'%'};return _0xa6f06;}})});}_0x24a250=_['merge']({},_0x24a250,_0x27d497[_0x0f41('0x44')]);var _0x37dec7={'where':_0x24a250[_0x0f41('0x40')]};return db[_0x0f41('0x2f')][_0x0f41('0x45')](_0x37dec7)[_0x0f41('0x26')](function(_0x4fb2af){_0x4355a8['count']=_0x4fb2af;if(_0x27d497[_0x0f41('0x35')][_0x0f41('0x46')]){_0x24a250['include']=[{'all':!![]}];}return db[_0x0f41('0x2f')][_0x0f41('0x47')](_0x24a250);})[_0x0f41('0x26')](function(_0x83acb){_0x4355a8[_0x0f41('0x48')]=_0x83acb;return _0x4355a8;})[_0x0f41('0x26')](respondWithFilteredResult(_0x5d3eeb,_0x24a250))[_0x0f41('0x49')](handleError(_0x5d3eeb,null));};exports[_0x0f41('0x4a')]=function(_0x3086e2,_0x596dd){var _0x3d15ab={'raw':![],'where':{'id':_0x3086e2[_0x0f41('0x4b')]['id']}},_0x29ab9a={};_0x29ab9a['model']=_['keys'](db[_0x0f41('0x2f')]['rawAttributes']);_0x29ab9a[_0x0f41('0x35')]=_['keys'](_0x3086e2[_0x0f41('0x35')]);_0x29ab9a['filters']=_[_0x0f41('0x38')](_0x29ab9a[_0x0f41('0x34')],_0x29ab9a[_0x0f41('0x35')]);_0x3d15ab[_0x0f41('0x3a')]=_[_0x0f41('0x38')](_0x29ab9a[_0x0f41('0x34')],qs[_0x0f41('0x39')](_0x3086e2[_0x0f41('0x35')][_0x0f41('0x39')]));_0x3d15ab[_0x0f41('0x3a')]=_0x3d15ab[_0x0f41('0x3a')][_0x0f41('0x3b')]?_0x3d15ab[_0x0f41('0x3a')]:_0x29ab9a['model'];if(_0x3086e2[_0x0f41('0x35')][_0x0f41('0x46')]){_0x3d15ab[_0x0f41('0x4c')]=[{'all':!![]}];}_0x3d15ab=_[_0x0f41('0x4d')]({},_0x3d15ab,_0x3086e2[_0x0f41('0x44')]);return db['VoiceMusicOnHold'][_0x0f41('0x4e')](_0x3d15ab)[_0x0f41('0x26')](handleEntityNotFound(_0x596dd,null))[_0x0f41('0x26')](respondWithResult(_0x596dd,null))[_0x0f41('0x49')](handleError(_0x596dd,null));};exports[_0x0f41('0x4f')]=function(_0x42f376,_0x1f2e28){if(_0x42f376['body']['id']){delete _0x42f376[_0x0f41('0x50')]['id'];}return db[_0x0f41('0x2f')][_0x0f41('0x4e')]({'where':{'id':_0x42f376['params']['id']}})[_0x0f41('0x26')](handleEntityNotFound(_0x1f2e28,null))['then'](saveUpdates(_0x42f376[_0x0f41('0x50')],null))[_0x0f41('0x26')](respondWithResult(_0x1f2e28,null))[_0x0f41('0x49')](handleError(_0x1f2e28,null));};exports[_0x0f41('0x51')]=function(_0x4af5d9,_0x2d1529,_0x3142a0){return db['sequelize'][_0x0f41('0x52')](function(_0x161127){if(_0x4af5d9['body']['mode']===_0x0f41('0x53')){_0x4af5d9[_0x0f41('0x50')][_0x0f41('0x54')]=path[_0x0f41('0x55')](config[_0x0f41('0x56')],'server/files/moh',_0x4af5d9['body'][_0x0f41('0x2b')]);}return db[_0x0f41('0x2f')][_0x0f41('0x51')](_0x4af5d9['body'],{'transaction':_0x161127})[_0x0f41('0x26')](function(_0x1343e0){if(_0x4af5d9[_0x0f41('0x50')]['mode']===_0x0f41('0x53')){fs[_0x0f41('0x57')](_0x1343e0[_0x0f41('0x54')],parseInt('0777',0x8));}var _0x4ec9e7=_0x4af5d9[_0x0f41('0x58')]['get']({'plain':!![]});if(!_0x4ec9e7)throw new Error(_0x0f41('0x59'));if(_0x4ec9e7[_0x0f41('0x5a')]===_0x0f41('0x58')){var _0x2e2948=_0x1343e0[_0x0f41('0x5b')]({'plain':!![]});return db['UserProfileSection'][_0x0f41('0x4e')]({'where':{'name':_0x0f41('0x5c'),'userProfileId':_0x4ec9e7[_0x0f41('0x5d')]},'raw':!![]})[_0x0f41('0x26')](function(_0x37b3e8){if(_0x37b3e8&&_0x37b3e8[_0x0f41('0x5e')]===0x0){return db[_0x0f41('0x28')][_0x0f41('0x51')]({'name':_0x2e2948[_0x0f41('0x2b')],'resourceId':_0x2e2948['id'],'type':_0x37b3e8[_0x0f41('0x2b')],'sectionId':_0x37b3e8['id']},{})['then'](function(){return _0x1343e0;});}else{return _0x1343e0;}})['catch'](function(_0x50ede5){logger['error'](_0x0f41('0x5f'),_0x50ede5);});}return _0x1343e0;});})[_0x0f41('0x26')](respondWithResult(_0x2d1529,0xc9))['catch'](handleError(_0x2d1529,null));};exports[_0x0f41('0x27')]=function(_0x2ab0f8,_0x4186fc,_0x41eb66){var _0x4b017a;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2ab0f8[_0x0f41('0x4b')]['id']}})[_0x0f41('0x26')](function(_0x2ed9b9){if(_0x2ed9b9){return db[_0x0f41('0x60')][_0x0f41('0x52')](function(_0x2d7cff){return _0x2ed9b9[_0x0f41('0x27')]({'transaction':_0x2d7cff,'raw':!![]})['then'](function(_0xa74245){if(_0xa74245[_0x0f41('0x54')]){fs[_0x0f41('0x61')](_0xa74245['directory'])['forEach'](function(_0x17e862){fs[_0x0f41('0x62')](path[_0x0f41('0x55')](_0xa74245[_0x0f41('0x54')],_0x17e862));});fs[_0x0f41('0x63')](_0xa74245[_0x0f41('0x54')]);}return _0xa74245;});})[_0x0f41('0x49')](function(_0x53f933){throw new db[(_0x0f41('0x64'))]['ValidationError'](_0x53f933[_0x0f41('0x65')]);});}})['then'](handleEntityNotFound(_0x4186fc,null))['then'](removeEntity(_0x4186fc,null))[_0x0f41('0x49')](handleError(_0x4186fc,null));};exports[_0x0f41('0x66')]=function(_0xda2d1,_0x26ecbf,_0x28660e){return db[_0x0f41('0x60')][_0x0f41('0x52')](function(_0x541230){var _0x25bbcf;return db[_0x0f41('0x2f')][_0x0f41('0x4e')]({'where':{'id':_0xda2d1['params']['id']}})[_0x0f41('0x26')](function(_0x3b195d){if(_0x3b195d){_0x25bbcf=_0x3b195d;return _0x3b195d[_0x0f41('0x66')](_0xda2d1['body']['id'],{'transaction':_0x541230});}})['then'](function(_0x1227ca){if(_0x1227ca){return db['Sound'][_0x0f41('0x67')]({'where':{'id':_0xda2d1[_0x0f41('0x50')]['id']},'attributes':['id',_0x0f41('0x2b'),_0x0f41('0x68'),_0x0f41('0x69'),_0x0f41('0x6a')],'raw':!![]});}})[_0x0f41('0x26')](function(_0x42a00c){if(_0x42a00c){var _0x2f69bc=path[_0x0f41('0x55')](config[_0x0f41('0x56')],_0x0f41('0x6b'),util['format'](_0x0f41('0x6c'),path[_0x0f41('0x6d')](_0x42a00c[_0x0f41('0x68')],path[_0x0f41('0x6e')](_0x42a00c[_0x0f41('0x68')])),_0x42a00c[_0x0f41('0x69')]));var _0x16bb4f=path[_0x0f41('0x55')](config[_0x0f41('0x56')],_0x0f41('0x6f'),_0x25bbcf[_0x0f41('0x2b')],util['format'](_0x0f41('0x6c'),_0x42a00c[_0x0f41('0x2b')],_0x42a00c[_0x0f41('0x69')]));fs['symlinkSync'](_0x2f69bc,_0x16bb4f);return _0x42a00c;}})[_0x0f41('0x49')](function(_0x4b42a6){throw new db['Sequelize'][(_0x0f41('0x70'))](_0x4b42a6[_0x0f41('0x65')]);});})[_0x0f41('0x26')](handleEntityNotFound(_0x26ecbf,null))[_0x0f41('0x26')](respondWithResult(_0x26ecbf,0xc9))[_0x0f41('0x49')](handleError(_0x26ecbf,null));};exports[_0x0f41('0x71')]=function(_0xc8d893,_0x48a412,_0x314d63){return db[_0x0f41('0x60')][_0x0f41('0x52')](function(_0x22411e){var _0xc9515a;return db[_0x0f41('0x2f')][_0x0f41('0x67')]({'where':{'id':_0xc8d893[_0x0f41('0x4b')]['id']}})[_0x0f41('0x26')](handleEntityNotFound(_0x48a412,null))[_0x0f41('0x26')](function(_0x2ffc73){if(_0x2ffc73){_0xc9515a=_0x2ffc73;return _0x2ffc73[_0x0f41('0x71')](_0xc8d893[_0x0f41('0x4b')][_0x0f41('0x72')]);}})[_0x0f41('0x26')](function(_0x10d2b4){if(_0x10d2b4){return db[_0x0f41('0x73')][_0x0f41('0x67')]({'where':{'id':_0xc8d893[_0x0f41('0x4b')]['id2']},'attributes':['id',_0x0f41('0x2b'),_0x0f41('0x68'),_0x0f41('0x69'),_0x0f41('0x6a')],'raw':!![]});}})['then'](function(_0x15c342){if(_0x15c342){fs['unlinkSync'](path['join'](_0xc9515a[_0x0f41('0x54')],util['format'](_0x0f41('0x6c'),_0x15c342[_0x0f41('0x2b')],_0x15c342[_0x0f41('0x69')])));return _0x15c342;}})['catch'](function(_0xf63e6a){throw new db['Sequelize'][(_0x0f41('0x70'))](_0xf63e6a[_0x0f41('0x65')]);});})[_0x0f41('0x26')](handleEntityNotFound(_0x48a412,null))['then'](respondWithStatusCode(_0x48a412,0xcc))['catch'](handleError(_0x48a412,null));};exports[_0x0f41('0x74')]=function(_0x30ebf5,_0x3426e5,_0x1da94f){var _0x1ff2c5={};var _0x4ae18f={};var _0x4a5eb5;var _0x2cbbb1;return db[_0x0f41('0x2f')][_0x0f41('0x67')]({'where':{'id':_0x30ebf5['params']['id']}})[_0x0f41('0x26')](handleEntityNotFound(_0x3426e5,null))[_0x0f41('0x26')](function(_0x320710){if(_0x320710){_0x4a5eb5=_0x320710;_0x4ae18f['model']=_[_0x0f41('0x36')](db[_0x0f41('0x73')]['rawAttributes']);_0x4ae18f[_0x0f41('0x35')]=_[_0x0f41('0x36')](_0x30ebf5['query']);_0x4ae18f[_0x0f41('0x37')]=_[_0x0f41('0x38')](_0x4ae18f[_0x0f41('0x34')],_0x4ae18f['query']);_0x1ff2c5['attributes']=_[_0x0f41('0x38')](_0x4ae18f['model'],qs[_0x0f41('0x39')](_0x30ebf5['query']['fields']));_0x1ff2c5[_0x0f41('0x3a')]=_0x1ff2c5[_0x0f41('0x3a')][_0x0f41('0x3b')]?_0x1ff2c5[_0x0f41('0x3a')]:_0x4ae18f[_0x0f41('0x34')];_0x1ff2c5[_0x0f41('0x3e')]=qs[_0x0f41('0x3f')](_0x30ebf5['query'][_0x0f41('0x3f')]);_0x1ff2c5[_0x0f41('0x40')]=qs['filters'](_[_0x0f41('0x41')](_0x30ebf5['query'],_0x4ae18f['filters']));if(_0x30ebf5[_0x0f41('0x35')][_0x0f41('0x42')]){_0x1ff2c5[_0x0f41('0x40')]=_['merge'](_0x1ff2c5['where'],{'$or':_['map'](_0x1ff2c5[_0x0f41('0x3a')],function(_0x1c8bdf){var _0x31e4b8={};_0x31e4b8[_0x1c8bdf]={'$like':'%'+_0x30ebf5[_0x0f41('0x35')][_0x0f41('0x42')]+'%'};return _0x31e4b8;})});}_0x1ff2c5=_['merge']({},_0x1ff2c5,_0x30ebf5[_0x0f41('0x44')]);return _0x4a5eb5[_0x0f41('0x74')](_0x1ff2c5);}})[_0x0f41('0x26')](function(_0x34bc65){if(_0x34bc65){_0x2cbbb1=_0x34bc65[_0x0f41('0x3b')];if(!_0x30ebf5[_0x0f41('0x35')][_0x0f41('0x3c')]('nolimit')){_0x1ff2c5[_0x0f41('0x20')]=qs['limit'](_0x30ebf5[_0x0f41('0x35')][_0x0f41('0x20')]);_0x1ff2c5[_0x0f41('0x1e')]=qs[_0x0f41('0x1e')](_0x30ebf5[_0x0f41('0x35')][_0x0f41('0x1e')]);}return _0x4a5eb5['getSounds'](_0x1ff2c5);}})[_0x0f41('0x26')](function(_0x421fe7){if(_0x421fe7){return _0x421fe7?{'count':_0x2cbbb1,'rows':_0x421fe7}:null;}})[_0x0f41('0x26')](respondWithResult(_0x3426e5,null))[_0x0f41('0x49')](handleError(_0x3426e5,null));}; \ No newline at end of file +var _0x9675=['hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../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','apply','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','length','includeAll','include','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','extname','format','symlinkSync','removeSound','id2','order','map','getSounds'];(function(_0x51ce3e,_0x4a1ed5){var _0x175562=function(_0x2e739d){while(--_0x2e739d){_0x51ce3e['push'](_0x51ce3e['shift']());}};_0x175562(++_0x4a1ed5);}(_0x9675,0x72));var _0x5967=function(_0x10c60b,_0x15c539){_0x10c60b=_0x10c60b-0x0;var _0x27f91c=_0x9675[_0x10c60b];return _0x27f91c;};'use strict';var emlformat=require(_0x5967('0x0'));var rimraf=require(_0x5967('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5967('0x2'));var rp=require(_0x5967('0x3'));var moment=require(_0x5967('0x4'));var BPromise=require(_0x5967('0x5'));var Mustache=require(_0x5967('0x6'));var util=require(_0x5967('0x7'));var path=require(_0x5967('0x8'));var sox=require(_0x5967('0x9'));var csv=require(_0x5967('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5967('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5967('0xc'));var jsforce=require(_0x5967('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5967('0xa'));var querystring=require(_0x5967('0xe'));var Papa=require(_0x5967('0xf'));var Redis=require(_0x5967('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5967('0x11'));var as=require(_0x5967('0x12'));var hardwareService=require(_0x5967('0x13'));var logger=require(_0x5967('0x14'))(_0x5967('0x15'));var utils=require(_0x5967('0x16'));var config=require(_0x5967('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5967('0x18'))['db'];function respondWithStatusCode(_0x5a8f08,_0x424cbf){_0x424cbf=_0x424cbf||0xcc;return function(_0x55f705){if(_0x55f705){return _0x5a8f08[_0x5967('0x19')](_0x424cbf);}return _0x5a8f08[_0x5967('0x1a')](_0x424cbf)[_0x5967('0x1b')]();};}function respondWithResult(_0xfe5d59,_0x3a62e5){_0x3a62e5=_0x3a62e5||0xc8;return function(_0x432326){if(_0x432326){return _0xfe5d59[_0x5967('0x1a')](_0x3a62e5)['json'](_0x432326);}};}function respondWithFilteredResult(_0x26bdcf,_0x299559){return function(_0x5ad622){if(_0x5ad622){var _0x57a9a8=typeof _0x299559[_0x5967('0x1c')]==='undefined'&&typeof _0x299559[_0x5967('0x1d')]===_0x5967('0x1e');var _0x551bfd=_0x5ad622[_0x5967('0x1f')];var _0x493713=_0x57a9a8?0x0:_0x299559['offset'];var _0x37292a=_0x57a9a8?_0x5ad622[_0x5967('0x1f')]:_0x299559[_0x5967('0x1c')]+_0x299559['limit'];var _0x3382a8;if(_0x37292a>=_0x551bfd){_0x37292a=_0x551bfd;_0x3382a8=0xc8;}else{_0x3382a8=0xce;}_0x26bdcf[_0x5967('0x1a')](_0x3382a8);return _0x26bdcf['set'](_0x5967('0x20'),_0x493713+'-'+_0x37292a+'/'+_0x551bfd)['json'](_0x5ad622);}return null;};}function patchUpdates(_0x5f1870){return function(_0x39b9cb){try{jsonpatch[_0x5967('0x21')](_0x39b9cb,_0x5f1870,!![]);}catch(_0x4f111e){return BPromise[_0x5967('0x22')](_0x4f111e);}return _0x39b9cb[_0x5967('0x23')]();};}function saveUpdates(_0x1a05d0,_0x417381){return function(_0x3b59c1){if(_0x3b59c1){return _0x3b59c1[_0x5967('0x24')](_0x1a05d0)['then'](function(_0x4e6675){return _0x4e6675;});}return null;};}function removeEntity(_0x85d0f6,_0x3e15f6){return function(_0x2378ee){if(_0x2378ee){return _0x2378ee[_0x5967('0x25')]()[_0x5967('0x26')](function(){var _0x7454cf=_0x2378ee[_0x5967('0x27')]({'plain':!![]});var _0x53a99e=_0x5967('0x28');return db[_0x5967('0x29')][_0x5967('0x25')]({'where':{'type':_0x53a99e,'resourceId':_0x7454cf['id']}})[_0x5967('0x26')](function(){return _0x2378ee;});})[_0x5967('0x26')](function(){_0x85d0f6[_0x5967('0x1a')](0xcc)[_0x5967('0x1b')]();});}};}function handleEntityNotFound(_0x40e411,_0x159871){return function(_0x4456b3){if(!_0x4456b3){_0x40e411[_0x5967('0x19')](0x194);}return _0x4456b3;};}function handleError(_0x49ae06,_0x14730a){_0x14730a=_0x14730a||0x1f4;return function(_0x1f3ae6){logger[_0x5967('0x2a')](_0x1f3ae6[_0x5967('0x2b')]);if(_0x1f3ae6[_0x5967('0x2c')]){delete _0x1f3ae6[_0x5967('0x2c')];}_0x49ae06[_0x5967('0x1a')](_0x14730a)['send'](_0x1f3ae6);};}exports['index']=function(_0x593f2c,_0x1e0a71){var _0x53c6ae={},_0x4e25ff={},_0x3f98f8={'count':0x0,'rows':[]};var _0x12e788=_['map'](db[_0x5967('0x2d')][_0x5967('0x2e')],function(_0x34bb7c){return{'name':_0x34bb7c[_0x5967('0x2f')],'type':_0x34bb7c[_0x5967('0x30')]['key']};});_0x4e25ff[_0x5967('0x31')]=_['map'](_0x12e788,_0x5967('0x2c'));_0x4e25ff[_0x5967('0x32')]=_[_0x5967('0x33')](_0x593f2c[_0x5967('0x32')]);_0x4e25ff[_0x5967('0x34')]=_['intersection'](_0x4e25ff[_0x5967('0x31')],_0x4e25ff[_0x5967('0x32')]);_0x53c6ae['attributes']=_[_0x5967('0x35')](_0x4e25ff[_0x5967('0x31')],qs[_0x5967('0x36')](_0x593f2c[_0x5967('0x32')][_0x5967('0x36')]));_0x53c6ae[_0x5967('0x37')]=_0x53c6ae[_0x5967('0x37')]['length']?_0x53c6ae[_0x5967('0x37')]:_0x4e25ff['model'];if(!_0x593f2c['query']['hasOwnProperty'](_0x5967('0x38'))){_0x53c6ae[_0x5967('0x1d')]=qs[_0x5967('0x1d')](_0x593f2c[_0x5967('0x32')][_0x5967('0x1d')]);_0x53c6ae[_0x5967('0x1c')]=qs[_0x5967('0x1c')](_0x593f2c[_0x5967('0x32')]['offset']);}_0x53c6ae['order']=qs[_0x5967('0x39')](_0x593f2c['query'][_0x5967('0x39')]);delete _0x593f2c[_0x5967('0x32')][_0x5967('0x39')];_0x53c6ae[_0x5967('0x3a')]=qs[_0x5967('0x34')](_[_0x5967('0x3b')](_0x593f2c[_0x5967('0x32')],_0x4e25ff[_0x5967('0x34')]),_0x12e788);if(_0x593f2c[_0x5967('0x32')][_0x5967('0x3c')]){_0x53c6ae['where']=_[_0x5967('0x3d')](_0x53c6ae['where'],{'$or':_['map'](_0x12e788,function(_0x2ff793){if(_0x2ff793[_0x5967('0x30')]!=='VIRTUAL'){var _0x3c7552={};_0x3c7552[_0x2ff793[_0x5967('0x2c')]]={'$like':'%'+_0x593f2c[_0x5967('0x32')][_0x5967('0x3c')]+'%'};return _0x3c7552;}})});}_0x53c6ae=_['merge']({},_0x53c6ae,_0x593f2c[_0x5967('0x3e')]);var _0x3a0f59={'where':_0x53c6ae[_0x5967('0x3a')]};return db[_0x5967('0x2d')]['count'](_0x3a0f59)['then'](function(_0x2ef494){_0x3f98f8[_0x5967('0x1f')]=_0x2ef494;if(_0x593f2c[_0x5967('0x32')]['includeAll']){_0x53c6ae['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x5967('0x3f')](_0x53c6ae);})[_0x5967('0x26')](function(_0x39a754){_0x3f98f8[_0x5967('0x40')]=_0x39a754;return _0x3f98f8;})[_0x5967('0x26')](respondWithFilteredResult(_0x1e0a71,_0x53c6ae))[_0x5967('0x41')](handleError(_0x1e0a71,null));};exports[_0x5967('0x42')]=function(_0x4b4742,_0x3176bf){var _0x816be5={'raw':![],'where':{'id':_0x4b4742['params']['id']}},_0x4fe863={};_0x4fe863['model']=_['keys'](db[_0x5967('0x2d')][_0x5967('0x2e')]);_0x4fe863[_0x5967('0x32')]=_['keys'](_0x4b4742[_0x5967('0x32')]);_0x4fe863['filters']=_[_0x5967('0x35')](_0x4fe863[_0x5967('0x31')],_0x4fe863['query']);_0x816be5[_0x5967('0x37')]=_[_0x5967('0x35')](_0x4fe863[_0x5967('0x31')],qs[_0x5967('0x36')](_0x4b4742[_0x5967('0x32')][_0x5967('0x36')]));_0x816be5['attributes']=_0x816be5[_0x5967('0x37')][_0x5967('0x43')]?_0x816be5['attributes']:_0x4fe863[_0x5967('0x31')];if(_0x4b4742['query'][_0x5967('0x44')]){_0x816be5[_0x5967('0x45')]=[{'all':!![]}];}_0x816be5=_[_0x5967('0x3d')]({},_0x816be5,_0x4b4742[_0x5967('0x3e')]);return db[_0x5967('0x2d')][_0x5967('0x46')](_0x816be5)[_0x5967('0x26')](handleEntityNotFound(_0x3176bf,null))['then'](respondWithResult(_0x3176bf,null))['catch'](handleError(_0x3176bf,null));};exports[_0x5967('0x24')]=function(_0x3eb952,_0x5a2caa){if(_0x3eb952[_0x5967('0x47')]['id']){delete _0x3eb952[_0x5967('0x47')]['id'];}return db['VoiceMusicOnHold'][_0x5967('0x46')]({'where':{'id':_0x3eb952[_0x5967('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a2caa,null))['then'](saveUpdates(_0x3eb952[_0x5967('0x47')],null))[_0x5967('0x26')](respondWithResult(_0x5a2caa,null))['catch'](handleError(_0x5a2caa,null));};exports[_0x5967('0x49')]=function(_0x106da3,_0x4327d3,_0x52ab6b){return db[_0x5967('0x4a')][_0x5967('0x4b')](function(_0x207864){if(_0x106da3[_0x5967('0x47')][_0x5967('0x4c')]===_0x5967('0x4d')){_0x106da3[_0x5967('0x47')][_0x5967('0x4e')]=path[_0x5967('0x4f')](config[_0x5967('0x50')],_0x5967('0x51'),_0x106da3[_0x5967('0x47')][_0x5967('0x2c')]);}return db[_0x5967('0x2d')][_0x5967('0x49')](_0x106da3[_0x5967('0x47')],{'transaction':_0x207864})[_0x5967('0x26')](function(_0x58d55b){if(_0x106da3[_0x5967('0x47')][_0x5967('0x4c')]==='files'){fs[_0x5967('0x52')](_0x58d55b[_0x5967('0x4e')],parseInt('0777',0x8));}var _0x463bbd=_0x106da3[_0x5967('0x53')][_0x5967('0x27')]({'plain':!![]});if(!_0x463bbd)throw new Error(_0x5967('0x54'));if(_0x463bbd[_0x5967('0x55')]===_0x5967('0x53')){var _0x1c0018=_0x58d55b[_0x5967('0x27')]({'plain':!![]});return db[_0x5967('0x56')][_0x5967('0x46')]({'where':{'name':_0x5967('0x28'),'userProfileId':_0x463bbd[_0x5967('0x57')]},'raw':!![]})[_0x5967('0x26')](function(_0x1a7300){if(_0x1a7300&&_0x1a7300[_0x5967('0x58')]===0x0){return db[_0x5967('0x29')][_0x5967('0x49')]({'name':_0x1c0018[_0x5967('0x2c')],'resourceId':_0x1c0018['id'],'type':_0x1a7300[_0x5967('0x2c')],'sectionId':_0x1a7300['id']},{})[_0x5967('0x26')](function(){return _0x58d55b;});}else{return _0x58d55b;}})[_0x5967('0x41')](function(_0x10d37a){logger['error'](_0x5967('0x59'),_0x10d37a);});}return _0x58d55b;});})[_0x5967('0x26')](respondWithResult(_0x4327d3,0xc9))[_0x5967('0x41')](handleError(_0x4327d3,null));};exports[_0x5967('0x25')]=function(_0x3dcd09,_0x2532e5,_0x3ecbae){var _0x4d5558;return db[_0x5967('0x2d')][_0x5967('0x46')]({'where':{'id':_0x3dcd09[_0x5967('0x48')]['id']}})[_0x5967('0x26')](function(_0x4c5085){if(_0x4c5085){return db[_0x5967('0x4a')][_0x5967('0x4b')](function(_0x2671b7){return _0x4c5085[_0x5967('0x25')]({'transaction':_0x2671b7,'raw':!![]})[_0x5967('0x26')](function(_0x23bf94){if(_0x23bf94[_0x5967('0x4e')]){fs[_0x5967('0x5a')](_0x23bf94['directory'])[_0x5967('0x5b')](function(_0x15e2fb){fs['unlinkSync'](path[_0x5967('0x4f')](_0x23bf94['directory'],_0x15e2fb));});fs[_0x5967('0x5c')](_0x23bf94[_0x5967('0x4e')]);}return _0x23bf94;});})[_0x5967('0x41')](function(_0x49fa71){throw new db[(_0x5967('0x5d'))][(_0x5967('0x5e'))](_0x49fa71[_0x5967('0x5f')]);});}})['then'](handleEntityNotFound(_0x2532e5,null))[_0x5967('0x26')](removeEntity(_0x2532e5,null))[_0x5967('0x41')](handleError(_0x2532e5,null));};exports[_0x5967('0x60')]=function(_0x4a8de9,_0x34e241,_0xb82532){return db[_0x5967('0x4a')][_0x5967('0x4b')](function(_0x53d273){var _0x39d93b;return db['VoiceMusicOnHold'][_0x5967('0x46')]({'where':{'id':_0x4a8de9['params']['id']}})[_0x5967('0x26')](function(_0x229ba8){if(_0x229ba8){_0x39d93b=_0x229ba8;return _0x229ba8[_0x5967('0x60')](_0x4a8de9['body']['id'],{'transaction':_0x53d273});}})[_0x5967('0x26')](function(_0x32a5a9){if(_0x32a5a9){return db[_0x5967('0x61')][_0x5967('0x62')]({'where':{'id':_0x4a8de9[_0x5967('0x47')]['id']},'attributes':['id','name',_0x5967('0x63'),_0x5967('0x64'),_0x5967('0x65')],'raw':!![]});}})[_0x5967('0x26')](function(_0x4a1a85){if(_0x4a1a85){var _0x2d8286=path[_0x5967('0x4f')](config[_0x5967('0x50')],_0x5967('0x66'),util['format'](_0x5967('0x67'),path['basename'](_0x4a1a85[_0x5967('0x63')],path[_0x5967('0x68')](_0x4a1a85[_0x5967('0x63')])),_0x4a1a85[_0x5967('0x64')]));var _0x2e5a8e=path[_0x5967('0x4f')](config[_0x5967('0x50')],'server/files/moh',_0x39d93b[_0x5967('0x2c')],util[_0x5967('0x69')](_0x5967('0x67'),_0x4a1a85[_0x5967('0x2c')],_0x4a1a85['converted_format']));fs[_0x5967('0x6a')](_0x2d8286,_0x2e5a8e);return _0x4a1a85;}})[_0x5967('0x41')](function(_0x4f9c18){throw new db[(_0x5967('0x5d'))][(_0x5967('0x5e'))](_0x4f9c18[_0x5967('0x5f')]);});})['then'](handleEntityNotFound(_0x34e241,null))[_0x5967('0x26')](respondWithResult(_0x34e241,0xc9))[_0x5967('0x41')](handleError(_0x34e241,null));};exports[_0x5967('0x6b')]=function(_0x3cf1bb,_0x26b955,_0x2e3269){return db[_0x5967('0x4a')][_0x5967('0x4b')](function(_0x2b1f85){var _0x5a3156;return db[_0x5967('0x2d')][_0x5967('0x62')]({'where':{'id':_0x3cf1bb[_0x5967('0x48')]['id']}})[_0x5967('0x26')](handleEntityNotFound(_0x26b955,null))['then'](function(_0x5067af){if(_0x5067af){_0x5a3156=_0x5067af;return _0x5067af['removeSound'](_0x3cf1bb['params'][_0x5967('0x6c')]);}})[_0x5967('0x26')](function(_0x558cf2){if(_0x558cf2){return db[_0x5967('0x61')][_0x5967('0x62')]({'where':{'id':_0x3cf1bb[_0x5967('0x48')][_0x5967('0x6c')]},'attributes':['id','name',_0x5967('0x63'),_0x5967('0x64'),'createdAt'],'raw':!![]});}})[_0x5967('0x26')](function(_0x3ebb5a){if(_0x3ebb5a){fs['unlinkSync'](path[_0x5967('0x4f')](_0x5a3156['directory'],util[_0x5967('0x69')](_0x5967('0x67'),_0x3ebb5a['name'],_0x3ebb5a[_0x5967('0x64')])));return _0x3ebb5a;}})['catch'](function(_0xf14031){throw new db[(_0x5967('0x5d'))]['ValidationError'](_0xf14031[_0x5967('0x5f')]);});})[_0x5967('0x26')](handleEntityNotFound(_0x26b955,null))[_0x5967('0x26')](respondWithStatusCode(_0x26b955,0xcc))[_0x5967('0x41')](handleError(_0x26b955,null));};exports['getSounds']=function(_0x3f8caa,_0x5d295d,_0x27c080){var _0x53f8cd={};var _0xdf1551={};var _0x33de01;var _0x89e51b;return db['VoiceMusicOnHold'][_0x5967('0x62')]({'where':{'id':_0x3f8caa[_0x5967('0x48')]['id']}})[_0x5967('0x26')](handleEntityNotFound(_0x5d295d,null))[_0x5967('0x26')](function(_0x3b57fb){if(_0x3b57fb){_0x33de01=_0x3b57fb;_0xdf1551[_0x5967('0x31')]=_[_0x5967('0x33')](db[_0x5967('0x61')][_0x5967('0x2e')]);_0xdf1551[_0x5967('0x32')]=_[_0x5967('0x33')](_0x3f8caa[_0x5967('0x32')]);_0xdf1551[_0x5967('0x34')]=_[_0x5967('0x35')](_0xdf1551[_0x5967('0x31')],_0xdf1551[_0x5967('0x32')]);_0x53f8cd[_0x5967('0x37')]=_[_0x5967('0x35')](_0xdf1551[_0x5967('0x31')],qs[_0x5967('0x36')](_0x3f8caa['query'][_0x5967('0x36')]));_0x53f8cd[_0x5967('0x37')]=_0x53f8cd[_0x5967('0x37')][_0x5967('0x43')]?_0x53f8cd[_0x5967('0x37')]:_0xdf1551[_0x5967('0x31')];_0x53f8cd[_0x5967('0x6d')]=qs[_0x5967('0x39')](_0x3f8caa[_0x5967('0x32')][_0x5967('0x39')]);_0x53f8cd[_0x5967('0x3a')]=qs[_0x5967('0x34')](_[_0x5967('0x3b')](_0x3f8caa[_0x5967('0x32')],_0xdf1551[_0x5967('0x34')]));if(_0x3f8caa[_0x5967('0x32')][_0x5967('0x3c')]){_0x53f8cd['where']=_[_0x5967('0x3d')](_0x53f8cd['where'],{'$or':_[_0x5967('0x6e')](_0x53f8cd[_0x5967('0x37')],function(_0x27fdde){var _0x5f4edd={};_0x5f4edd[_0x27fdde]={'$like':'%'+_0x3f8caa[_0x5967('0x32')][_0x5967('0x3c')]+'%'};return _0x5f4edd;})});}_0x53f8cd=_[_0x5967('0x3d')]({},_0x53f8cd,_0x3f8caa['options']);return _0x33de01[_0x5967('0x6f')](_0x53f8cd);}})[_0x5967('0x26')](function(_0x3cfdb3){if(_0x3cfdb3){_0x89e51b=_0x3cfdb3[_0x5967('0x43')];if(!_0x3f8caa[_0x5967('0x32')][_0x5967('0x70')](_0x5967('0x38'))){_0x53f8cd[_0x5967('0x1d')]=qs['limit'](_0x3f8caa[_0x5967('0x32')][_0x5967('0x1d')]);_0x53f8cd[_0x5967('0x1c')]=qs[_0x5967('0x1c')](_0x3f8caa[_0x5967('0x32')][_0x5967('0x1c')]);}return _0x33de01[_0x5967('0x6f')](_0x53f8cd);}})[_0x5967('0x26')](function(_0x4b9623){if(_0x4b9623){return _0x4b9623?{'count':_0x89e51b,'rows':_0x4b9623}:null;}})[_0x5967('0x26')](respondWithResult(_0x5d295d,null))[_0x5967('0x41')](handleError(_0x5d295d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 194dac1..683efca 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 _0xa3d5=['api','moment','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger'];(function(_0x260e93,_0x5bfbb6){var _0x4f1599=function(_0x504543){while(--_0x504543){_0x260e93['push'](_0x260e93['shift']());}};_0x4f1599(++_0x5bfbb6);}(_0xa3d5,0x18f));var _0x5a3d=function(_0x4a1412,_0x2b6ee8){_0x4a1412=_0x4a1412-0x0;var _0x2cc456=_0xa3d5[_0x4a1412];return _0x2cc456;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a3d('0x0'))(_0x5a3d('0x1'));var moment=require(_0x5a3d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a3d('0x3'));var rimraf=require(_0x5a3d('0x4'));var config=require(_0x5a3d('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x5a3d('0x6')]=function(_0x1a4de7,_0x98d869){return _0x1a4de7[_0x5a3d('0x7')](_0x5a3d('0x8'),attributes,{'tableName':_0x5a3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a4a=['api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x5ce1bd,_0x44b0f8){var _0x16f7ad=function(_0x21c319){while(--_0x21c319){_0x5ce1bd['push'](_0x5ce1bd['shift']());}};_0x16f7ad(++_0x44b0f8);}(_0x8a4a,0x1b5));var _0xa8a4=function(_0x1840b1,_0x2d021e){_0x1840b1=_0x1840b1-0x0;var _0x54ee73=_0x8a4a[_0x1840b1];return _0x54ee73;};'use strict';var _=require(_0xa8a4('0x0'));var util=require(_0xa8a4('0x1'));var logger=require(_0xa8a4('0x2'))(_0xa8a4('0x3'));var moment=require(_0xa8a4('0x4'));var BPromise=require('bluebird');var rp=require(_0xa8a4('0x5'));var fs=require('fs');var path=require(_0xa8a4('0x6'));var rimraf=require(_0xa8a4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa8a4('0x8'));module['exports']=function(_0x4b4d65,_0x3997dc){return _0x4b4d65[_0xa8a4('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xa8a4('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 eb821e5..2a9424c 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x21bbc8,_0x59247d){var _0x579cb6=function(_0x9b99c){while(--_0x9b99c){_0x21bbc8['push'](_0x21bbc8['shift']());}};_0x579cb6(++_0x59247d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x591f1a,_0x6acb2){var _0x619f58=function(_0x50a0c9){while(--_0x50a0c9){_0x591f1a['push'](_0x591f1a['shift']());}};_0x619f58(++_0x6acb2);}(_0x70e0,0x17b));var _0x070e=function(_0x11e701,_0x12ce16){_0x11e701=_0x11e701-0x0;var _0x4bb51f=_0x70e0[_0x11e701];return _0x4bb51f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 9bca50a..80e1ea5 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 _0x903b=['addAgents','put','update','delete','removeAgents','removeTeams','exports','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x297fe8,_0x2c9c7e){var _0x337023=function(_0x17eda0){while(--_0x17eda0){_0x297fe8['push'](_0x297fe8['shift']());}};_0x337023(++_0x2c9c7e);}(_0x903b,0x104));var _0xb903=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0x903b[_0x9e05d1];return _0x4f7e97;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb903('0x0'));var router=express[_0xb903('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb903('0x2'));var config=require(_0xb903('0x3'));var controller=require('./voicePrefix.controller');router[_0xb903('0x4')]('/',auth[_0xb903('0x5')](),controller[_0xb903('0x6')]);router[_0xb903('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xb903('0x7')]);router[_0xb903('0x4')](_0xb903('0x8'),auth[_0xb903('0x5')](),controller[_0xb903('0x9')]);router['get'](_0xb903('0xa'),auth[_0xb903('0x5')](),controller[_0xb903('0xb')]);router[_0xb903('0x4')](_0xb903('0xc'),auth[_0xb903('0x5')](),controller[_0xb903('0xd')]);router[_0xb903('0xe')]('/',auth['isAuthenticated'](),controller[_0xb903('0xf')]);router['post'](_0xb903('0xa'),auth['isAuthenticated'](),controller[_0xb903('0x10')]);router['post']('/:id/teams',auth[_0xb903('0x5')](),controller['addTeams']);router[_0xb903('0x11')](_0xb903('0x8'),auth[_0xb903('0x5')](),controller[_0xb903('0x12')]);router[_0xb903('0x13')](_0xb903('0x8'),auth[_0xb903('0x5')](),controller['destroy']);router[_0xb903('0x13')]('/:id/users',auth[_0xb903('0x5')](),controller[_0xb903('0x14')]);router['delete'](_0xb903('0xc'),auth[_0xb903('0x5')](),controller[_0xb903('0x15')]);module[_0xb903('0x16')]=router; \ No newline at end of file +var _0xfbaf=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xfbaf,0xcb));var _0xffba=function(_0x571b8,_0x26e178){_0x571b8=_0x571b8-0x0;var _0x357aca=_0xfbaf[_0x571b8];return _0x357aca;};'use strict';var multer=require(_0xffba('0x0'));var util=require(_0xffba('0x1'));var path=require('path');var timeout=require(_0xffba('0x2'));var express=require(_0xffba('0x3'));var router=express['Router']();var fs_extra=require(_0xffba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xffba('0x5'));var config=require(_0xffba('0x6'));var controller=require(_0xffba('0x7'));router[_0xffba('0x8')]('/',auth[_0xffba('0x9')](),controller[_0xffba('0xa')]);router[_0xffba('0x8')](_0xffba('0xb'),auth[_0xffba('0x9')](),controller[_0xffba('0xc')]);router[_0xffba('0x8')](_0xffba('0xd'),auth[_0xffba('0x9')](),controller['show']);router[_0xffba('0x8')](_0xffba('0xe'),auth[_0xffba('0x9')](),controller['getAgents']);router[_0xffba('0x8')](_0xffba('0xf'),auth[_0xffba('0x9')](),controller['getTeams']);router[_0xffba('0x10')]('/',auth[_0xffba('0x9')](),controller[_0xffba('0x11')]);router[_0xffba('0x10')](_0xffba('0xe'),auth['isAuthenticated'](),controller[_0xffba('0x12')]);router[_0xffba('0x10')](_0xffba('0xf'),auth[_0xffba('0x9')](),controller[_0xffba('0x13')]);router[_0xffba('0x14')](_0xffba('0xd'),auth['isAuthenticated'](),controller[_0xffba('0x15')]);router[_0xffba('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xffba('0x16')](_0xffba('0xe'),auth[_0xffba('0x9')](),controller[_0xffba('0x17')]);router[_0xffba('0x16')](_0xffba('0xf'),auth[_0xffba('0x9')](),controller[_0xffba('0x18')]);module[_0xffba('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9f827e6..3ef4858 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 _0x3a73=['getDataValue','STRING','INTEGER','sequelize','exports','name','VIRTUAL','system-'];(function(_0x3efeb0,_0x42b451){var _0xc72286=function(_0x4a2910){while(--_0x4a2910){_0x3efeb0['push'](_0x3efeb0['shift']());}};_0xc72286(++_0x42b451);}(_0x3a73,0xfb));var _0x33a7=function(_0xf155ef,_0x3eecee){_0xf155ef=_0xf155ef-0x0;var _0x459059=_0x3a73[_0xf155ef];return _0x459059;};'use strict';var Sequelize=require(_0x33a7('0x0'));module[_0x33a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x33a7('0x2')},'prefix':{'type':Sequelize[_0x33a7('0x3')],'get':function(_0x106d76){return _0x33a7('0x4')+this[_0x33a7('0x5')](_0x33a7('0x2'))+'-';}},'description':{'type':Sequelize[_0x33a7('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x33a7('0x7')]}}; \ No newline at end of file +var _0x9302=['system-','getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0x9302,0x153));var _0x2930=function(_0x59adec,_0x43b4e7){_0x59adec=_0x59adec-0x0;var _0xb5fada=_0x9302[_0x59adec];return _0xb5fada;};'use strict';var Sequelize=require(_0x2930('0x0'));module[_0x2930('0x1')]={'name':{'type':Sequelize[_0x2930('0x2')],'allowNull':![],'unique':_0x2930('0x3')},'prefix':{'type':Sequelize[_0x2930('0x4')],'get':function(_0x50c54d){return _0x2930('0x5')+this[_0x2930('0x6')](_0x2930('0x3'))+'-';}},'description':{'type':Sequelize[_0x2930('0x2')]},'callerIdAll':{'type':Sequelize[_0x2930('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2930('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 52e1c7a..da7b951 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 _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x373d,0x1e2));var _0xd373=function(_0x296d93,_0x27ee37){_0x296d93=_0x296d93-0x0;var _0xba3f66=_0x373d[_0x296d93];return _0xba3f66;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file +var _0xe511=['bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','prefix','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','Agents','online','voicePause','flatMap','addTeams','each','TeamVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','VoicePrefixes','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','query','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','include','findAll','rows','show','params','keys','fields','length','options','catch','destroy','describe','create','sequelize','transaction','body','VoiceExtension','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x4b824a,_0x275d05){_0x4b824a=_0x4b824a-0x0;var _0x3779ab=_0xe511[_0x4b824a];return _0x3779ab;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];config[_0x1e51('0x18')]=_['defaults'](config[_0x1e51('0x18')],{'host':_0x1e51('0x19'),'port':0x18eb});var socket=require(_0x1e51('0x1a'))(new Redis(config[_0x1e51('0x18')]));require(_0x1e51('0x1b'))[_0x1e51('0x1c')](socket);function respondWithStatusCode(_0x441c70,_0x467e77){_0x467e77=_0x467e77||0xcc;return function(_0x1cc62a){if(_0x1cc62a){return _0x441c70[_0x1e51('0x1d')](_0x467e77);}return _0x441c70['status'](_0x467e77)[_0x1e51('0x1e')]();};}function respondWithResult(_0x24db4f,_0x4526b4){_0x4526b4=_0x4526b4||0xc8;return function(_0x5857e2){if(_0x5857e2){return _0x24db4f[_0x1e51('0x1f')](_0x4526b4)['json'](_0x5857e2);}};}function respondWithFilteredResult(_0x53d222,_0x1f6f4e){return function(_0x27dcad){if(_0x27dcad){var _0x40ae4c=typeof _0x1f6f4e[_0x1e51('0x20')]===_0x1e51('0x21')&&typeof _0x1f6f4e[_0x1e51('0x22')]==='undefined';var _0x39449b=_0x27dcad['count'];var _0xea581d=_0x40ae4c?0x0:_0x1f6f4e[_0x1e51('0x20')];var _0x309a87=_0x40ae4c?_0x27dcad[_0x1e51('0x23')]:_0x1f6f4e['offset']+_0x1f6f4e['limit'];var _0x4e6a49;if(_0x309a87>=_0x39449b){_0x309a87=_0x39449b;_0x4e6a49=0xc8;}else{_0x4e6a49=0xce;}_0x53d222['status'](_0x4e6a49);return _0x53d222[_0x1e51('0x24')]('Content-Range',_0xea581d+'-'+_0x309a87+'/'+_0x39449b)[_0x1e51('0x25')](_0x27dcad);}return null;};}function patchUpdates(_0x28aacb){return function(_0x415154){try{jsonpatch[_0x1e51('0x26')](_0x415154,_0x28aacb,!![]);}catch(_0x23c85a){return BPromise[_0x1e51('0x27')](_0x23c85a);}return _0x415154[_0x1e51('0x28')]();};}function saveUpdates(_0x461d3d,_0x4bcdd3){return function(_0x4d04c0){if(_0x4d04c0){return _0x4d04c0[_0x1e51('0x29')](_0x461d3d)[_0x1e51('0x2a')](function(_0x2e42b1){return _0x2e42b1;});}return null;};}function removeEntity(_0x1386db,_0x505d79){return function(_0x54d031){if(_0x54d031){return _0x54d031['destroy']()[_0x1e51('0x2a')](function(){var _0x2a1561=_0x54d031[_0x1e51('0x2b')]({'plain':!![]});var _0x5412bc=_0x1e51('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5412bc,'resourceId':_0x2a1561['id']}})[_0x1e51('0x2a')](function(){return _0x54d031;});})['then'](function(){_0x1386db[_0x1e51('0x1f')](0xcc)[_0x1e51('0x1e')]();});}};}function handleEntityNotFound(_0x56722f,_0x3e6ef2){return function(_0x10ee23){if(!_0x10ee23){_0x56722f[_0x1e51('0x1d')](0x194);}return _0x10ee23;};}function handleError(_0x6862d1,_0x52538c){_0x52538c=_0x52538c||0x1f4;return function(_0x4cf046){logger['error'](_0x4cf046[_0x1e51('0x2d')]);if(_0x4cf046[_0x1e51('0x2e')]){delete _0x4cf046[_0x1e51('0x2e')];}_0x6862d1[_0x1e51('0x1f')](_0x52538c)[_0x1e51('0x2f')](_0x4cf046);};}exports[_0x1e51('0x30')]=function(_0x378206,_0x34701c){var _0x31b678={},_0x3167b6={},_0x27b550={'count':0x0,'rows':[]};var _0x54c84e=_[_0x1e51('0x31')](db[_0x1e51('0x32')][_0x1e51('0x33')],function(_0x12da89){return{'name':_0x12da89[_0x1e51('0x34')],'type':_0x12da89['type'][_0x1e51('0x35')]};});_0x3167b6['model']=_[_0x1e51('0x31')](_0x54c84e,_0x1e51('0x2e'));_0x3167b6[_0x1e51('0x36')]=_['keys'](_0x378206[_0x1e51('0x36')]);_0x3167b6['filters']=_[_0x1e51('0x37')](_0x3167b6['model'],_0x3167b6['query']);_0x31b678[_0x1e51('0x38')]=_[_0x1e51('0x37')](_0x3167b6[_0x1e51('0x39')],qs['fields'](_0x378206[_0x1e51('0x36')]['fields']));_0x31b678[_0x1e51('0x38')]=_0x31b678[_0x1e51('0x38')]['length']?_0x31b678[_0x1e51('0x38')]:_0x3167b6[_0x1e51('0x39')];if(!_0x378206[_0x1e51('0x36')][_0x1e51('0x3a')](_0x1e51('0x3b'))){_0x31b678[_0x1e51('0x22')]=qs['limit'](_0x378206['query'][_0x1e51('0x22')]);_0x31b678['offset']=qs[_0x1e51('0x20')](_0x378206[_0x1e51('0x36')][_0x1e51('0x20')]);}_0x31b678[_0x1e51('0x3c')]=qs[_0x1e51('0x3d')](_0x378206[_0x1e51('0x36')][_0x1e51('0x3d')]);_0x31b678[_0x1e51('0x3e')]=qs[_0x1e51('0x3f')](_[_0x1e51('0x40')](_0x378206[_0x1e51('0x36')],_0x3167b6['filters']),_0x54c84e);if(_0x378206[_0x1e51('0x36')]['filter']){_0x31b678[_0x1e51('0x3e')]=_[_0x1e51('0x41')](_0x31b678[_0x1e51('0x3e')],{'$or':_[_0x1e51('0x31')](_0x54c84e,function(_0x33e516){if(_0x33e516[_0x1e51('0x42')]!==_0x1e51('0x43')){var _0x27b3fd={};_0x27b3fd[_0x33e516[_0x1e51('0x2e')]]={'$like':'%'+_0x378206[_0x1e51('0x36')][_0x1e51('0x44')]+'%'};return _0x27b3fd;}})});}_0x31b678=_['merge']({},_0x31b678,_0x378206['options']);var _0x13da51={'where':_0x31b678[_0x1e51('0x3e')]};return db[_0x1e51('0x32')][_0x1e51('0x23')](_0x13da51)[_0x1e51('0x2a')](function(_0x1a9e0d){_0x27b550[_0x1e51('0x23')]=_0x1a9e0d;if(_0x378206[_0x1e51('0x36')]['includeAll']){_0x31b678[_0x1e51('0x45')]=[{'all':!![]}];}return db[_0x1e51('0x32')][_0x1e51('0x46')](_0x31b678);})[_0x1e51('0x2a')](function(_0xfd96a0){_0x27b550[_0x1e51('0x47')]=_0xfd96a0;return _0x27b550;})[_0x1e51('0x2a')](respondWithFilteredResult(_0x34701c,_0x31b678))['catch'](handleError(_0x34701c,null));};exports[_0x1e51('0x48')]=function(_0x232789,_0x51296e){var _0xfd6521={'raw':![],'where':{'id':_0x232789[_0x1e51('0x49')]['id']}},_0x38e4a7={};_0x38e4a7['model']=_[_0x1e51('0x4a')](db[_0x1e51('0x32')][_0x1e51('0x33')]);_0x38e4a7[_0x1e51('0x36')]=_[_0x1e51('0x4a')](_0x232789[_0x1e51('0x36')]);_0x38e4a7[_0x1e51('0x3f')]=_[_0x1e51('0x37')](_0x38e4a7[_0x1e51('0x39')],_0x38e4a7['query']);_0xfd6521[_0x1e51('0x38')]=_[_0x1e51('0x37')](_0x38e4a7['model'],qs[_0x1e51('0x4b')](_0x232789[_0x1e51('0x36')][_0x1e51('0x4b')]));_0xfd6521['attributes']=_0xfd6521[_0x1e51('0x38')][_0x1e51('0x4c')]?_0xfd6521[_0x1e51('0x38')]:_0x38e4a7['model'];if(_0x232789[_0x1e51('0x36')]['includeAll']){_0xfd6521['include']=[{'all':!![]}];}_0xfd6521=_['merge']({},_0xfd6521,_0x232789[_0x1e51('0x4d')]);return db[_0x1e51('0x32')]['find'](_0xfd6521)['then'](handleEntityNotFound(_0x51296e,null))[_0x1e51('0x2a')](respondWithResult(_0x51296e,null))[_0x1e51('0x4e')](handleError(_0x51296e,null));};exports[_0x1e51('0x4f')]=function(_0x233a5a,_0xf3377b){return db[_0x1e51('0x32')]['find']({'where':{'id':_0x233a5a[_0x1e51('0x49')]['id']}})['then'](handleEntityNotFound(_0xf3377b,null))[_0x1e51('0x2a')](removeEntity(_0xf3377b,null))[_0x1e51('0x4e')](handleError(_0xf3377b,null));};exports['describe']=function(_0x5ea040,_0x479fe6){return db[_0x1e51('0x32')][_0x1e51('0x50')]()[_0x1e51('0x2a')](respondWithResult(_0x479fe6,null))['catch'](handleError(_0x479fe6,null));};exports[_0x1e51('0x51')]=function(_0x1fe669,_0x4226da){var _0x2100d4;return db[_0x1e51('0x52')][_0x1e51('0x53')](function(_0x32fe1f){return db[_0x1e51('0x32')]['create'](_0x1fe669[_0x1e51('0x54')],{'transaction':_0x32fe1f})[_0x1e51('0x2a')](function(_0xeb77ad){_0x2100d4=_0xeb77ad[_0x1e51('0x2b')]({'plain':!![]});return db[_0x1e51('0x55')][_0x1e51('0x56')]({'where':{'id':_0x2100d4['VoiceExtensionId']},'raw':!![]})[_0x1e51('0x2a')](function(_0x4a2c1b){return createVoicePrefixExtensions(_0x2100d4,_0x4a2c1b,_0x32fe1f);});});})['then'](function(){var _0x4807b9=_0x1fe669[_0x1e51('0x57')][_0x1e51('0x2b')]({'plain':!![]});if(!_0x4807b9)throw new Error(_0x1e51('0x58'));if(_0x4807b9['role']===_0x1e51('0x57')){var _0x133576=_0x2100d4;return db[_0x1e51('0x59')]['find']({'where':{'name':_0x1e51('0x2c'),'userProfileId':_0x4807b9[_0x1e51('0x5a')]},'raw':!![]})[_0x1e51('0x2a')](function(_0x570193){if(_0x570193&&_0x570193[_0x1e51('0x5b')]===0x0){return db[_0x1e51('0x5c')][_0x1e51('0x51')]({'name':_0x133576[_0x1e51('0x2e')],'resourceId':_0x133576['id'],'type':_0x570193[_0x1e51('0x2e')],'sectionId':_0x570193['id']},{})[_0x1e51('0x2a')](function(){return _0x2100d4;});}else{return _0x2100d4;}})[_0x1e51('0x4e')](function(_0x607626){logger['error'](_0x1e51('0x5d'),_0x607626);throw _0x607626;});}return _0x2100d4;})[_0x1e51('0x2a')](respondWithResult(_0x4226da,null))['catch'](handleError(_0x4226da,null));};function Extension(_0x5a9d2a,_0x577b19,_0xa39f42,_0x686433){this[_0x1e51('0x5e')]=_0x1e51('0x5f');this[_0x1e51('0x60')]=_0x5a9d2a;this[_0x1e51('0x61')]=_0xa39f42;this[_0x1e51('0x42')]=_0x1e51('0x62');this[_0x1e51('0x63')]='Voice\x20Prefix\x20Extension';this['priority']=_0x577b19;this['appdata']=_0x686433;}function createVoicePrefixExtensions(_0x1d2daf,_0x4048a4,_0x50c202){return new BPromise(function(_0x4e1fa8,_0x1a7297){var _0x114657=new Extension(formatPrefixName(_0x1d2daf['prefix']),0x1,_0x1e51('0x64'),_0x1e51('0x65'));_0x114657[_0x1e51('0x66')]=_0x1d2daf['id'];return db[_0x1e51('0x55')][_0x1e51('0x51')](_0x114657,{'transaction':_0x50c202})[_0x1e51('0x2a')](function(_0x2199e5){var _0x31eae0=_0x2199e5[_0x1e51('0x2b')]({'plain':!![]});var _0x32863f=_['map'](addVoicePrefixExtensions(_0x1d2daf,_0x4048a4),function(_0x178baf){_0x178baf[_0x1e51('0x67')]=_0x31eae0['id'];_0x178baf[_0x1e51('0x66')]=_0x1d2daf['id'];return _0x178baf;});return db[_0x1e51('0x55')][_0x1e51('0x68')](_0x32863f,{'transaction':_0x50c202})[_0x1e51('0x2a')](function(_0x47cc50){if(!_0x47cc50){return _0x1a7297('Extensions\x20creation\x20failed');}else{return _0x4e1fa8(_0x47cc50);}})[_0x1e51('0x4e')](function(_0x1b0459){return _0x1a7297(_0x1b0459);});});;});};function addVoicePrefixExtensions(_0x19ec72,_0x13fb81){var _0x52a439=[];var _0x4bbe62=formatPrefixName(_0x19ec72['prefix']);_0x52a439[_0x1e51('0x69')](new Extension(_0x4bbe62,0x2,_0x1e51('0x6a'),_0x1e51('0x6b')+_0x19ec72[_0x1e51('0x2e')]));if(_0x19ec72[_0x1e51('0x6c')]){_0x52a439['push'](new Extension(_0x4bbe62,0x3,_0x1e51('0x6a'),_0x1e51('0x6d')+_0x19ec72[_0x1e51('0x6c')]));}else{_0x52a439['push'](new Extension(_0x4bbe62,0x3,_0x1e51('0x64'),_0x1e51('0x6e')));}_0x52a439[_0x1e51('0x69')](new Extension(_0x4bbe62,0x4,'goto',_0x13fb81[_0x1e51('0x5e')]+','+_0x1e51('0x6f')+(0x8+_0x19ec72['name']['length'])+'}'+','+0x1));return _0x52a439;}function formatPrefixName(_0x40d5e8){var _0x4d6d41='_';for(var _0x4464bf=0x0;_0x4464bf<_0x40d5e8['length'];_0x4464bf++){if(_0x40d5e8[_0x1e51('0x70')](_0x4464bf)=='-'){_0x4d6d41+=_0x40d5e8[_0x1e51('0x70')](_0x4464bf);}else{_0x4d6d41+='['+_0x40d5e8[_0x1e51('0x70')](_0x4464bf)+']';}}_0x4d6d41+='.';return _0x4d6d41;}exports[_0x1e51('0x29')]=function(_0x5142ed,_0x37f3e6,_0x4c9871){var _0x5eaa16=_0x5142ed[_0x1e51('0x54')];_0x5eaa16[_0x1e51('0x71')]=_0x1e51('0x72')+_0x5eaa16['name']+'-';return db[_0x1e51('0x52')][_0x1e51('0x53')](function(_0x15f15b){return db[_0x1e51('0x32')]['update'](_0x5eaa16,{'where':{'id':_0x5eaa16['id']},'transaction':_0x15f15b})[_0x1e51('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x5eaa16['id']},'transaction':_0x15f15b})[_0x1e51('0x2a')](function(){return db['VoiceExtension'][_0x1e51('0x56')]({'where':{'id':_0x5eaa16['VoiceExtensionId']},'raw':!![]})[_0x1e51('0x2a')](function(_0x486508){return createVoicePrefixExtensions(_0x5eaa16,_0x486508,_0x15f15b);});});});})[_0x1e51('0x2a')](function(){return db[_0x1e51('0x32')]['findById'](_0x5eaa16['id']);})[_0x1e51('0x2a')](respondWithResult(_0x37f3e6,null))['catch'](handleError(_0x37f3e6,null));};exports[_0x1e51('0x73')]=function(_0x6dc707,_0x1d2753,_0x18ed16){return db[_0x1e51('0x32')][_0x1e51('0x56')]({'where':{'id':_0x6dc707['params']['id']}})[_0x1e51('0x2a')](handleEntityNotFound(_0x1d2753,null))['then'](function(_0x5556ad){if(_0x5556ad){return _0x5556ad[_0x1e51('0x73')](_0x6dc707[_0x1e51('0x54')][_0x1e51('0x74')],_[_0x1e51('0x75')](_0x6dc707[_0x1e51('0x54')],[_0x1e51('0x74'),'id'])||{})[_0x1e51('0x76')](function(_0x51ef46){for(var _0x39dc12=0x0;_0x39dc12<_0x6dc707[_0x1e51('0x54')][_0x1e51('0x74')]['length'];_0x39dc12+=0x1){socket['emit'](_0x1e51('0x77'),{'UserId':Number(_0x6dc707[_0x1e51('0x54')]['ids'][_0x39dc12]),'VoicePrefixId':Number(_0x6dc707[_0x1e51('0x49')]['id'])});}return _0x51ef46;});}})[_0x1e51('0x2a')](respondWithResult(_0x1d2753,null))['catch'](handleError(_0x1d2753,null));};exports['removeAgents']=function(_0xe96651,_0x49263c,_0x16793c){return db[_0x1e51('0x32')][_0x1e51('0x56')]({'where':{'id':_0xe96651[_0x1e51('0x49')]['id']}})[_0x1e51('0x2a')](handleEntityNotFound(_0x49263c,null))['then'](function(_0x4e3460){if(_0x4e3460){return _0x4e3460[_0x1e51('0x78')](_0xe96651[_0x1e51('0x36')]['ids'])[_0x1e51('0x2a')](function(){if(_[_0x1e51('0x79')](_0xe96651['query'][_0x1e51('0x74')])){for(var _0x57ab4a=0x0;_0x57ab4a<_0xe96651[_0x1e51('0x36')]['ids']['length'];_0x57ab4a+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0xe96651['query']['ids'][_0x57ab4a]),'VoicePrefixId':Number(_0xe96651[_0x1e51('0x49')]['id'])});}}else{socket['emit'](_0x1e51('0x7a'),{'UserId':Number(_0xe96651['query'][_0x1e51('0x74')]),'VoicePrefixId':Number(_0xe96651[_0x1e51('0x49')]['id'])});}});}})[_0x1e51('0x2a')](respondWithStatusCode(_0x49263c,null))['catch'](handleError(_0x49263c,null));};exports[_0x1e51('0x7b')]=function(_0x3ed4b1,_0x4a2b44,_0x2efc56){var _0x49517c={};var _0x101bb9={};var _0x5c4452;var _0x2b4b49;return db[_0x1e51('0x32')][_0x1e51('0x7c')]({'where':{'id':_0x3ed4b1[_0x1e51('0x49')]['id']}})[_0x1e51('0x2a')](handleEntityNotFound(_0x4a2b44,null))[_0x1e51('0x2a')](function(_0x50e359){if(_0x50e359){_0x5c4452=_0x50e359;_0x101bb9[_0x1e51('0x39')]=_['keys'](db[_0x1e51('0x7d')][_0x1e51('0x33')]);_0x101bb9[_0x1e51('0x36')]=_[_0x1e51('0x4a')](_0x3ed4b1['query']);_0x101bb9['filters']=_['intersection'](_0x101bb9[_0x1e51('0x39')],_0x101bb9[_0x1e51('0x36')]);_0x49517c[_0x1e51('0x38')]=_[_0x1e51('0x37')](_0x101bb9['model'],qs[_0x1e51('0x4b')](_0x3ed4b1['query'][_0x1e51('0x4b')]));_0x49517c['attributes']=_0x49517c['attributes'][_0x1e51('0x4c')]?_0x49517c[_0x1e51('0x38')]:_0x101bb9['model'];_0x49517c[_0x1e51('0x3c')]=qs['sort'](_0x3ed4b1[_0x1e51('0x36')]['sort']);_0x49517c[_0x1e51('0x3e')]=qs[_0x1e51('0x3f')](_['pick'](_0x3ed4b1[_0x1e51('0x36')],_0x101bb9['filters']));if(_0x3ed4b1[_0x1e51('0x36')][_0x1e51('0x44')]){_0x49517c[_0x1e51('0x3e')]=_[_0x1e51('0x41')](_0x49517c['where'],{'$or':_[_0x1e51('0x31')](_0x49517c[_0x1e51('0x38')],function(_0x4698b1){var _0x4ff0ff={};_0x4ff0ff[_0x4698b1]={'$like':'%'+_0x3ed4b1['query'][_0x1e51('0x44')]+'%'};return _0x4ff0ff;})});}_0x49517c=_[_0x1e51('0x41')]({},_0x49517c,_0x3ed4b1[_0x1e51('0x4d')]);return _0x5c4452['getAgents'](_0x49517c);}})['then'](function(_0x552f34){if(_0x552f34){_0x2b4b49=_0x552f34[_0x1e51('0x4c')];if(!_0x3ed4b1[_0x1e51('0x36')][_0x1e51('0x3a')]('nolimit')){_0x49517c[_0x1e51('0x22')]=qs[_0x1e51('0x22')](_0x3ed4b1['query'][_0x1e51('0x22')]);_0x49517c[_0x1e51('0x20')]=qs[_0x1e51('0x20')](_0x3ed4b1['query'][_0x1e51('0x20')]);}return _0x5c4452['getAgents'](_0x49517c);}})[_0x1e51('0x2a')](function(_0x2c84a3){if(_0x2c84a3){return _0x2c84a3?{'count':_0x2b4b49,'rows':_0x2c84a3}:null;}})[_0x1e51('0x2a')](respondWithResult(_0x4a2b44,null))[_0x1e51('0x4e')](handleError(_0x4a2b44,null));};exports[_0x1e51('0x7e')]=function(_0x37a7ef,_0x37f26c,_0xa3225a){var _0x10370b={};var _0x5a6e2f={};var _0x5394e1;var _0x4a5daa;return db[_0x1e51('0x32')]['findOne']({'where':{'id':_0x37a7ef[_0x1e51('0x49')]['id']}})[_0x1e51('0x2a')](handleEntityNotFound(_0x37f26c,null))[_0x1e51('0x2a')](function(_0x3a546f){if(_0x3a546f){_0x5394e1=_0x3a546f;_0x5a6e2f[_0x1e51('0x39')]=_[_0x1e51('0x4a')](db[_0x1e51('0x7f')][_0x1e51('0x33')]);_0x5a6e2f[_0x1e51('0x36')]=_['keys'](_0x37a7ef[_0x1e51('0x36')]);_0x5a6e2f[_0x1e51('0x3f')]=_[_0x1e51('0x37')](_0x5a6e2f['model'],_0x5a6e2f[_0x1e51('0x36')]);_0x10370b[_0x1e51('0x38')]=_[_0x1e51('0x37')](_0x5a6e2f['model'],qs[_0x1e51('0x4b')](_0x37a7ef[_0x1e51('0x36')][_0x1e51('0x4b')]));_0x10370b[_0x1e51('0x38')]=_0x10370b[_0x1e51('0x38')]['length']?_0x10370b['attributes']:_0x5a6e2f[_0x1e51('0x39')];_0x10370b['order']=qs['sort'](_0x37a7ef[_0x1e51('0x36')][_0x1e51('0x3d')]);_0x10370b[_0x1e51('0x3e')]=qs[_0x1e51('0x3f')](_[_0x1e51('0x40')](_0x37a7ef[_0x1e51('0x36')],_0x5a6e2f[_0x1e51('0x3f')]));if(_0x37a7ef[_0x1e51('0x36')][_0x1e51('0x44')]){_0x10370b['where']=_[_0x1e51('0x41')](_0x10370b[_0x1e51('0x3e')],{'$or':_[_0x1e51('0x31')](_0x10370b['attributes'],function(_0x5e3a9a){var _0x121591={};_0x121591[_0x5e3a9a]={'$like':'%'+_0x37a7ef[_0x1e51('0x36')]['filter']+'%'};return _0x121591;})});}_0x10370b=_[_0x1e51('0x41')]({},_0x10370b,_0x37a7ef[_0x1e51('0x4d')]);return _0x5394e1['getTeams'](_0x10370b);}})[_0x1e51('0x2a')](function(_0x30f3f4){if(_0x30f3f4){_0x4a5daa=_0x30f3f4[_0x1e51('0x4c')];if(!_0x37a7ef['query'][_0x1e51('0x3a')](_0x1e51('0x3b'))){_0x10370b[_0x1e51('0x22')]=qs[_0x1e51('0x22')](_0x37a7ef[_0x1e51('0x36')][_0x1e51('0x22')]);_0x10370b[_0x1e51('0x20')]=qs[_0x1e51('0x20')](_0x37a7ef[_0x1e51('0x36')][_0x1e51('0x20')]);}return _0x5394e1['getTeams'](_0x10370b);}})['then'](function(_0x41147f){if(_0x41147f){return _0x41147f?{'count':_0x4a5daa,'rows':_0x41147f}:null;}})['then'](respondWithResult(_0x37f26c,null))['catch'](handleError(_0x37f26c,null));};exports['addTeams']=function(_0x251595,_0x53dbbb,_0x159c58){var _0x5494ac=_0x251595[_0x1e51('0x54')][_0x1e51('0x74')];var _0x4859cd;return db[_0x1e51('0x7f')]['findAll']({'where':{'id':_0x5494ac},'attributes':['id'],'include':[{'model':db[_0x1e51('0x7d')],'as':_0x1e51('0x80'),'attributes':['id','name',_0x1e51('0x81'),_0x1e51('0x82'),'interface'],'raw':!![]}]})['then'](function(_0x4e99dd){if(_0x4e99dd){_0x4859cd=_0x4e99dd;var _0x46bea7=_[_0x1e51('0x83')](_0x4e99dd,function(_0x3cc89b){var _0x543c71=_0x3cc89b['get']({'plain':!![]});return _0x543c71[_0x1e51('0x80')];});return db[_0x1e51('0x32')][_0x1e51('0x56')]({'where':{'id':_0x251595['params']['id']}})[_0x1e51('0x2a')](function(_0x20bcb6){return db[_0x1e51('0x52')][_0x1e51('0x53')](function(_0xb339a0){return _0x20bcb6[_0x1e51('0x84')](_0x5494ac,{'transaction':_0xb339a0})['then'](function(){return BPromise[_0x1e51('0x85')](_0x4859cd,function(_0x15ca94){return db[_0x1e51('0x86')]['upsert']({'TeamId':_0x15ca94['id'],'VoicePrefixId':_0x251595['params']['id']},{'transaction':_0xb339a0});});})[_0x1e51('0x2a')](function(){return BPromise['each'](_0x46bea7,function(_0x55c0e9){return db['UserVoicePrefix'][_0x1e51('0x87')]({'where':{'UserId':_0x55c0e9['id'],'VoicePrefixId':_0x251595[_0x1e51('0x49')]['id']},'transaction':_0xb339a0});});})[_0x1e51('0x2a')](function(){_0x46bea7[_0x1e51('0x88')](function(_0x4c5279){socket['emit']('userVoicePrefix:save',{'UserId':_0x4c5279['id'],'VoicePrefixId':_0x20bcb6['id']});});});});});}})[_0x1e51('0x2a')](respondWithStatusCode(_0x53dbbb,null))['catch'](handleError(_0x53dbbb,null));};exports[_0x1e51('0x89')]=function(_0x15ae93,_0x40146c,_0x419043){return db[_0x1e51('0x7f')][_0x1e51('0x46')]({'where':{'id':_0x15ae93[_0x1e51('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1e51('0x7d')],'as':_0x1e51('0x80'),'attributes':['id'],'raw':!![]}]})[_0x1e51('0x2a')](handleEntityNotFound(_0x40146c,null))[_0x1e51('0x2a')](function(_0x478a79){var _0xec29f4=_[_0x1e51('0x31')](_0x478a79,'id');var _0x57c3a2=[];var _0x2b12e9=[];var _0x2ab009=squel[_0x1e51('0x8a')]();_0x2ab009[_0x1e51('0x8b')](_0x1e51('0x8c'))[_0x1e51('0x8d')](_0x1e51('0x8e'),'tq')[_0x1e51('0x8f')](_0x1e51('0x90'),'ut',_0x1e51('0x91'))['where'](_0x1e51('0x92'),_0x15ae93[_0x1e51('0x49')]['id']);for(var _0x42f652=0x0;_0x42f652<_0x478a79[_0x1e51('0x4c')];_0x42f652+=0x1){let _0x131006=_0x478a79[_0x42f652];for(var _0xa5bef1=0x0;_0xa5bef1<_0x131006[_0x1e51('0x80')][_0x1e51('0x4c')];_0xa5bef1+=0x1){let _0x1e1c48=_0x131006[_0x1e51('0x80')][_0xa5bef1];var _0x12d430=_0x2ab009['clone']();_0x12d430[_0x1e51('0x3e')](_0x1e51('0x93'),_0x1e1c48['id']);_0x2b12e9['push'](db['sequelize'][_0x1e51('0x36')](_0x12d430[_0x1e51('0x94')](),{'type':db[_0x1e51('0x52')][_0x1e51('0x95')][_0x1e51('0x96')]})[_0x1e51('0x2a')](function(_0x51114b){if(_0x51114b['length']===0x1){return _0x1e1c48['id'];}else{var _0x290551=_[_0x1e51('0x97')](_['map'](_0x51114b,_0x1e51('0x98')),function(_0x4610e1){return _[_0x1e51('0x99')](_0xec29f4,_0x4610e1);});if(_0x290551){return _0x1e1c48['id'];}}}));}}return BPromise['all'](_0x2b12e9)[_0x1e51('0x2a')](function(_0x304999){_0x57c3a2=_(_0x57c3a2)[_0x1e51('0x9a')](_0x304999)['compact']()[_0x1e51('0x9b')]();return db[_0x1e51('0x32')][_0x1e51('0x56')]({'where':{'id':_0x15ae93[_0x1e51('0x49')]['id']}})['then'](function(_0x2773c3){return db[_0x1e51('0x52')]['transaction'](function(_0x237435){return _0x2773c3[_0x1e51('0x89')](_0x15ae93[_0x1e51('0x36')][_0x1e51('0x74')],{'transaction':_0x237435})['then'](function(){if(!_[_0x1e51('0x9c')](_0x57c3a2)){return _0x2773c3[_0x1e51('0x78')](_0x57c3a2,{'transaction':_0x237435});}})[_0x1e51('0x2a')](function(){_0x57c3a2[_0x1e51('0x88')](function(_0x43b66c){socket['emit'](_0x1e51('0x7a'),{'UserId':_0x43b66c,'VoicePrefixId':_0x2773c3['id']});});});});});});})[_0x1e51('0x2a')](respondWithStatusCode(_0x40146c,null))[_0x1e51('0x4e')](handleError(_0x40146c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 78aba2d..fdf66da 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 _0x56a3=['hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','save','remove','emit'];(function(_0x26c311,_0x26a54c){var _0x75f1b7=function(_0x15e470){while(--_0x15e470){_0x26c311['push'](_0x26c311['shift']());}};_0x75f1b7(++_0x26a54c);}(_0x56a3,0x152));var _0x356a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56a3[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x356a('0x0'));var VoicePrefix=require(_0x356a('0x1'))['db'][_0x356a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x356a('0x3'),'afterUpdate':'update','afterDestroy':_0x356a('0x4')};function emitEvent(_0x41435b){return function(_0x2801cb,_0x15e035,_0x320703){VoicePrefixEvents[_0x356a('0x5')](_0x41435b+':'+_0x2801cb['id'],_0x2801cb);VoicePrefixEvents[_0x356a('0x5')](_0x41435b,_0x2801cb);_0x320703(null);};}for(var e in events){if(events[_0x356a('0x6')](e)){var event=events[e];VoicePrefix[_0x356a('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4e75=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update'];(function(_0x2dc735,_0x5b3890){var _0x1c3693=function(_0x50dcda){while(--_0x50dcda){_0x2dc735['push'](_0x2dc735['shift']());}};_0x1c3693(++_0x5b3890);}(_0x4e75,0x19a));var _0x54e7=function(_0x5b80fc,_0x31de80){_0x5b80fc=_0x5b80fc-0x0;var _0x90097e=_0x4e75[_0x5b80fc];return _0x90097e;};'use strict';var EventEmitter=require(_0x54e7('0x0'));var VoicePrefix=require(_0x54e7('0x1'))['db'][_0x54e7('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x54e7('0x3'),'afterDestroy':_0x54e7('0x4')};function emitEvent(_0x21bd52){return function(_0x3bb184,_0x582fb3,_0x5bbc50){VoicePrefixEvents[_0x54e7('0x5')](_0x21bd52+':'+_0x3bb184['id'],_0x3bb184);VoicePrefixEvents[_0x54e7('0x5')](_0x21bd52,_0x3bb184);_0x5bbc50(null);};}for(var e in events){if(events[_0x54e7('0x6')](e)){var event=events[e];VoicePrefix[_0x54e7('0x7')](e,emitEvent(event));}}module[_0x54e7('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5181cc9..4a24d17 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 _0x1488=['./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x1488,0x100));var _0x8148=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x1488[_0x383158];return _0x507985;};'use strict';var _=require(_0x8148('0x0'));var util=require(_0x8148('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8148('0x2'));var BPromise=require(_0x8148('0x3'));var rp=require(_0x8148('0x4'));var fs=require('fs');var path=require(_0x8148('0x5'));var rimraf=require(_0x8148('0x6'));var config=require(_0x8148('0x7'));var attributes=require(_0x8148('0x8'));module['exports']=function(_0x5e1c3b,_0x3b6199){return _0x5e1c3b[_0x8148('0x9')](_0x8148('0xa'),attributes,{'tableName':_0x8148('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7740=['exports','define','VoicePrefix','voice_prefixes','util','api','moment','path','rimraf','../../config/environment'];(function(_0x12aa66,_0x2d35c1){var _0x53dfe9=function(_0x2ab011){while(--_0x2ab011){_0x12aa66['push'](_0x12aa66['shift']());}};_0x53dfe9(++_0x2d35c1);}(_0x7740,0xc2));var _0x0774=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x7740[_0x20fdc1];return _0x25397c;};'use strict';var _=require('lodash');var util=require(_0x0774('0x0'));var logger=require('../../config/logger')(_0x0774('0x1'));var moment=require(_0x0774('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0774('0x3'));var rimraf=require(_0x0774('0x4'));var config=require(_0x0774('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x0774('0x6')]=function(_0x320d8c,_0x418088){return _0x320d8c[_0x0774('0x7')](_0x0774('0x8'),attributes,{'tableName':_0x0774('0x9'),'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 6125cdc..970469d 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 _0x7958=['./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});config[_0x8795('0xc')]=_['defaults'](config[_0x8795('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8795('0xd'))(new Redis(config[_0x8795('0xc')]));require(_0x8795('0xe'))[_0x8795('0xf')](socket);function respondWithRpcPromise(_0x1bcd9c,_0x2191fb,_0x191cb0){return new BPromise(function(_0x441669,_0x416a3a){return client[_0x8795('0x10')](_0x1bcd9c,_0x191cb0)[_0x8795('0x11')](function(_0x2118ff){logger[_0x8795('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2191fb,_0x8795('0x13'));logger[_0x8795('0x14')](_0x8795('0x15'),_0x2191fb,_0x8795('0x13'),JSON[_0x8795('0x16')](_0x2118ff));if(_0x2118ff[_0x8795('0x17')]){if(_0x2118ff[_0x8795('0x17')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2191fb,_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);return _0x416a3a(_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);}logger[_0x8795('0x17')](_0x8795('0x19'),_0x2191fb,_0x2118ff[_0x8795('0x17')]['message']);return _0x441669(_0x2118ff[_0x8795('0x17')]['message']);}else{logger[_0x8795('0x12')](_0x8795('0x19'),_0x2191fb,_0x8795('0x13'));_0x441669(_0x2118ff[_0x8795('0x1a')][_0x8795('0x18')]);}})[_0x8795('0x1b')](function(_0x353290){logger['error'](_0x8795('0x19'),_0x2191fb,_0x353290);_0x416a3a(_0x353290);});});} \ No newline at end of file +var _0xc1db=['socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0xc1db,0x120));var _0xbc1d=function(_0x17290d,_0x5531e6){_0x17290d=_0x17290d-0x0;var _0x4d5916=_0xc1db[_0x17290d];return _0x4d5916;};'use strict';var _=require(_0xbc1d('0x0'));var util=require('util');var moment=require(_0xbc1d('0x1'));var BPromise=require(_0xbc1d('0x2'));var rs=require(_0xbc1d('0x3'));var fs=require('fs');var Redis=require(_0xbc1d('0x4'));var db=require(_0xbc1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc1d('0x6'))(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc1d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbc1d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc1d('0xb'))(new Redis(config[_0xbc1d('0xa')]));require('./voicePrefix.socket')[_0xbc1d('0xc')](socket);function respondWithRpcPromise(_0x4c2a66,_0x25dc8c,_0x23176d){return new BPromise(function(_0x51282b,_0x1c211f){return client[_0xbc1d('0xd')](_0x4c2a66,_0x23176d)[_0xbc1d('0xe')](function(_0x23f1b4){logger['info'](_0xbc1d('0xf'),_0x25dc8c,'request\x20sent');logger[_0xbc1d('0x10')](_0xbc1d('0x11'),_0x25dc8c,'request\x20sent',JSON[_0xbc1d('0x12')](_0x23f1b4));if(_0x23f1b4[_0xbc1d('0x13')]){if(_0x23f1b4['error'][_0xbc1d('0x14')]===0x1f4){logger[_0xbc1d('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x25dc8c,_0x23f1b4[_0xbc1d('0x13')]['message']);return _0x1c211f(_0x23f1b4[_0xbc1d('0x13')][_0xbc1d('0x15')]);}logger[_0xbc1d('0x13')](_0xbc1d('0xf'),_0x25dc8c,_0x23f1b4[_0xbc1d('0x13')][_0xbc1d('0x15')]);return _0x51282b(_0x23f1b4['error'][_0xbc1d('0x15')]);}else{logger['info'](_0xbc1d('0xf'),_0x25dc8c,_0xbc1d('0x16'));_0x51282b(_0x23f1b4['result']['message']);}})['catch'](function(_0x11f2ef){logger[_0xbc1d('0x13')](_0xbc1d('0xf'),_0x25dc8c,_0x11f2ef);_0x1c211f(_0x11f2ef);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0dedc7b..87aeff2 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 _0xd957=['register','length','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0xd957,0x153));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var VoicePrefixEvents=require(_0x7d95('0x0'));var events=[_0x7d95('0x1'),'remove',_0x7d95('0x2')];function createListener(_0x2035b7,_0x5d0023){return function(_0xf7608a){_0x5d0023[_0x7d95('0x3')](_0x2035b7,_0xf7608a);};}function removeListener(_0x291309,_0x9750e1){return function(){VoicePrefixEvents[_0x7d95('0x4')](_0x291309,_0x9750e1);};}exports[_0x7d95('0x5')]=function(_0x2de581){for(var _0x514355=0x0,_0x181ca5=events[_0x7d95('0x6')];_0x514355<_0x181ca5;_0x514355++){var _0x4f10ec=events[_0x514355];var _0xfd14f6=createListener(_0x7d95('0x7')+_0x4f10ec,_0x2de581);VoicePrefixEvents['on'](_0x4f10ec,_0xfd14f6);}}; \ No newline at end of file +var _0xbca8=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x4dd072,_0x515c74){var _0x45ee58=function(_0x2bf321){while(--_0x2bf321){_0x4dd072['push'](_0x4dd072['shift']());}};_0x45ee58(++_0x515c74);}(_0xbca8,0xcc));var _0x8bca=function(_0x216ef8,_0x99bf41){_0x216ef8=_0x216ef8-0x0;var _0x1ff674=_0xbca8[_0x216ef8];return _0x1ff674;};'use strict';var VoicePrefixEvents=require(_0x8bca('0x0'));var events=[_0x8bca('0x1'),_0x8bca('0x2'),_0x8bca('0x3')];function createListener(_0x17db5b,_0x51da56){return function(_0x129f58){_0x51da56[_0x8bca('0x4')](_0x17db5b,_0x129f58);};}function removeListener(_0x34d392,_0x5cafc7){return function(){VoicePrefixEvents['removeListener'](_0x34d392,_0x5cafc7);};}exports[_0x8bca('0x5')]=function(_0x2ecf60){for(var _0x318474=0x0,_0x348ddd=events['length'];_0x318474<_0x348ddd;_0x318474++){var _0x3fdccf=events[_0x318474];var _0x38e241=createListener(_0x8bca('0x6')+_0x3fdccf,_0x2ecf60);VoicePrefixEvents['on'](_0x3fdccf,_0x38e241);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6435075..aa5d0ca 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x190cfe,_0x16f92e){var _0x22716e=function(_0x52a77a){while(--_0x52a77a){_0x190cfe['push'](_0x190cfe['shift']());}};_0x22716e(++_0x16f92e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4ac41d,_0x797f24){var _0x5b9770=function(_0x164fe4){while(--_0x164fe4){_0x4ac41d['push'](_0x4ac41d['shift']());}};_0x5b9770(++_0x797f24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b4c220c..b92581c 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 _0x798c=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','all','once','setDataValue','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','wrapuptime','progressive','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','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5a2cca,_0x287e30){var _0x1619a8=function(_0x15409f){while(--_0x15409f){_0x5a2cca['push'](_0x5a2cca['shift']());}};_0x1619a8(++_0x287e30);}(_0x798c,0x1f3));var _0xc798=function(_0x559fac,_0x9017be){_0x559fac=_0x559fac-0x0;var _0xf3cf1c=_0x798c[_0x559fac];return _0xf3cf1c;};'use strict';var Sequelize=require(_0xc798('0x0'));module['exports']={'name':{'type':Sequelize[_0xc798('0x1')],'allowNull':![],'unique':_0xc798('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x4'),_0xc798('0x5')),'allowNull':![],'defaultValue':_0xc798('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xc798('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc798('0x3')]('rr',_0xc798('0x6'),_0xc798('0x7'),_0xc798('0x8'),_0xc798('0x9'),_0xc798('0xa'),_0xc798('0xb'),_0xc798('0xc'),_0xc798('0xd')),'allowNull':![],'defaultValue':_0xc798('0x6'),'set':function(_0x1c6b5f){this['setDataValue'](_0xc798('0xe'),_0x1c6b5f?_0x1c6b5f:_0xc798('0xa'));},'get':function(){var _0x51b0b7=this[_0xc798('0xf')](_0xc798('0x10'));var _0x4e53f7=this[_0xc798('0xf')](_0xc798('0x11'));var _0x1c7430=this['getDataValue']('strategy');if(_0x51b0b7===_0xc798('0x4')){return _0x1c7430;}if(_0x4e53f7===_0xc798('0x12')&&_0x1c7430===_0xc798('0xa')||_0x4e53f7===_0xc798('0x12')&&_0x1c7430==='roundrobin'){return _0x1c7430;}if(_0x4e53f7==='progressive'||_0x4e53f7===_0xc798('0x13')||_0x4e53f7===_0xc798('0x14')){return _0x1c7430;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc798('0x15')](0xb)},'timeout':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc798('0x1')]},'weight':{'type':Sequelize[_0xc798('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no',_0xc798('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xc798('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc798('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc798('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xc798('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc798('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc798('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc798('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc798('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc798('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc798('0x1')]},'queue_quantity1':{'type':Sequelize[_0xc798('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc798('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4bf7d2){this[_0xc798('0x19')](_0xc798('0x1a'),_0x4bf7d2?_0x4bf7d2['join'](','):[]);},'get':function(){return this[_0xc798('0xf')](_0xc798('0x1a'))?this[_0xc798('0xf')](_0xc798('0x1a'))[_0xc798('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xc798('0x1')],'defaultValue':_0xc798('0x16'),'set':function(_0x43125f){this['setDataValue']('joinempty',_0x43125f?_0x43125f[_0xc798('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xc798('0x1d'))?this[_0xc798('0xf')](_0xc798('0x1d'))[_0xc798('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc798('0x1')],'defaultValue':'no','set':function(_0x2aa84b){this[_0xc798('0x19')](_0xc798('0x1e'),_0x2aa84b?_0x2aa84b[_0xc798('0x1c')](','):undefined);},'get':function(){return this[_0xc798('0xf')](_0xc798('0x1e'))?this['getDataValue']('leavewhenempty')[_0xc798('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc798('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc798('0x1')]},'description':{'type':Sequelize[_0xc798('0x1')]},'acw':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':0x0,'set':function(_0x30e84c){this[_0xc798('0x19')]('acw',_0x30e84c);if(_0x30e84c){if(this[_0xc798('0xf')]('wrapuptime')<0x2){this[_0xc798('0x19')](_0xc798('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc798('0x3')]('preview','progressive',_0xc798('0x14'),_0xc798('0x13'),_0xc798('0x12')),'defaultValue':_0xc798('0x21'),'comment':_0xc798('0x22')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xc798('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xc798('0x15')](0x4)[_0xc798('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc798('0x24')},'dialPowerLevel':{'type':Sequelize[_0xc798('0x25')](0x2)[_0xc798('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc798('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x27'),_0xc798('0x28')),'defaultValue':_0xc798('0x28'),'comment':_0xc798('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc798('0x25')](0x2)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc798('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc798('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc798('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc798('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xc798('0x1')],'defaultValue':_0xc798('0x2d'),'comment':_0xc798('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc798('0x1')],'comment':_0xc798('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc798('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'comment':_0xc798('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)[_0xc798('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc798('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc798('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc798('0x1')],'defaultValue':_0xc798('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc798('0x3')](_0xc798('0x37'),_0xc798('0x38'),_0xc798('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':0x0,'comment':_0xc798('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0xc798('0x15')](0x9)[_0xc798('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc798('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xc798('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc798('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc798('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc798('0x15')](0x9)[_0xc798('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc798('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc798('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc798('0x15')](0x9)[_0xc798('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc798('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc798('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc798('0x15')](0x5)[_0xc798('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc798('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc798('0x15')](0x9)[_0xc798('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc798('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xc798('0x15')](0x5)[_0xc798('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc798('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':0x0,'comment':_0xc798('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc798('0x45'),'ASC'),'defaultValue':_0xc798('0x45')},'dialQueueProject2':{'type':Sequelize[_0xc798('0x1')],'comment':_0xc798('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc798('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc798('0x46')},'dialCutDigit':{'type':Sequelize[_0xc798('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc798('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)[_0xc798('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc798('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)[_0xc798('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc798('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc798('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc798('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc798('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc798('0x15')],'allowNull':!![],'comment':_0xc798('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':![],'comment':_0xc798('0x4f'),'set':function(_0x581bf6){if(!_0x581bf6)this[_0xc798('0x19')](_0xc798('0x50'),null);this[_0xc798('0x19')](_0xc798('0x51'),_0x581bf6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc798('0x15')](0x3)[_0xc798('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc798('0x1f')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0bae=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','inbound','ENUM','ringall','fewestcalls','rrmemory','linear','rrordered','setDataValue','getDataValue','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x42b73e,_0x2a8f82){var _0x5d86b6=function(_0x214f46){while(--_0x214f46){_0x42b73e['push'](_0x42b73e['shift']());}};_0x5d86b6(++_0x2a8f82);}(_0x0bae,0x147));var _0xe0ba=function(_0x818b4,_0x5b89e6){_0x818b4=_0x818b4-0x0;var _0x586c89=_0x0bae[_0x818b4];return _0x586c89;};'use strict';var Sequelize=require('sequelize');module[_0xe0ba('0x0')]={'name':{'type':Sequelize[_0xe0ba('0x1')],'allowNull':![],'unique':_0xe0ba('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe0ba('0x3'),'outbound'),'allowNull':![],'defaultValue':_0xe0ba('0x3')},'musiconhold':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe0ba('0x4')]('rr',_0xe0ba('0x5'),'leastrecent',_0xe0ba('0x6'),'random',_0xe0ba('0x7'),_0xe0ba('0x8'),'wrandom',_0xe0ba('0x9')),'allowNull':![],'defaultValue':_0xe0ba('0x5'),'set':function(_0x505019){this[_0xe0ba('0xa')]('strategy',_0x505019?_0x505019:'rrmemory');},'get':function(){var _0xb39225=this[_0xe0ba('0xb')]('type');var _0x4ecdec=this[_0xe0ba('0xb')](_0xe0ba('0xc'));var _0x31baca=this[_0xe0ba('0xb')]('strategy');if(_0xb39225==='inbound'){return _0x31baca;}if(_0x4ecdec===_0xe0ba('0xd')&&_0x31baca===_0xe0ba('0x7')||_0x4ecdec===_0xe0ba('0xd')&&_0x31baca==='roundrobin'){return _0x31baca;}if(_0x4ecdec===_0xe0ba('0xe')||_0x4ecdec===_0xe0ba('0xf')||_0x4ecdec===_0xe0ba('0x10')){return _0x31baca;}return null;}},'servicelevel':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe0ba('0x11')](0xb)},'timeout':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe0ba('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe0ba('0x4')]('yes','no'),'defaultValue':_0xe0ba('0x12')},'autopause':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no',_0xe0ba('0x13')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe0ba('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xe0ba('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe0ba('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no'),'defaultValue':_0xe0ba('0x12')},'announce_holdtime':{'type':Sequelize[_0xe0ba('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xe0ba('0x12'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe0ba('0x1')]},'queue_youarenext':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe0ba('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xe0ba('0x1')]},'queue_quantity2':{'type':Sequelize[_0xe0ba('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x47f781){this[_0xe0ba('0xa')]('periodic_announce',_0x47f781?_0x47f781[_0xe0ba('0x14')](','):[]);},'get':function(){return this['getDataValue'](_0xe0ba('0x15'))?this[_0xe0ba('0xb')](_0xe0ba('0x15'))[_0xe0ba('0x16')](','):[];}},'joinempty':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':'yes','set':function(_0x253523){this[_0xe0ba('0xa')](_0xe0ba('0x17'),_0x253523?_0x253523[_0xe0ba('0x14')](','):undefined);},'get':function(){return this[_0xe0ba('0xb')]('joinempty')?this['getDataValue'](_0xe0ba('0x17'))[_0xe0ba('0x16')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x30b195){this[_0xe0ba('0xa')]('leavewhenempty',_0x30b195?_0x30b195[_0xe0ba('0x14')](','):undefined);},'get':function(){return this[_0xe0ba('0xb')](_0xe0ba('0x18'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe0ba('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe0ba('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x47bb64){this[_0xe0ba('0xa')]('acw',_0x47bb64);if(_0x47bb64){if(this[_0xe0ba('0xb')](_0xe0ba('0x19'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe0ba('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe0ba('0x1a')],'defaultValue':0x0,'comment':_0xe0ba('0x1b')},'dialMethod':{'type':Sequelize['ENUM'](_0xe0ba('0x1c'),'progressive',_0xe0ba('0x10'),'predictive',_0xe0ba('0xd')),'defaultValue':_0xe0ba('0xe'),'comment':_0xe0ba('0x1d')},'dialLimitChannel':{'type':Sequelize[_0xe0ba('0x11')](0x4)[_0xe0ba('0x1e')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe0ba('0x1f')},'dialLimitQueue':{'type':Sequelize[_0xe0ba('0x11')](0x4)[_0xe0ba('0x1e')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe0ba('0x20')},'dialPowerLevel':{'type':Sequelize[_0xe0ba('0x21')](0x2)[_0xe0ba('0x1e')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x22'),'dropRate'),'defaultValue':_0xe0ba('0x23'),'comment':_0xe0ba('0x24')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe0ba('0x21')](0x2)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe0ba('0x25')},'dialPredictiveInterval':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe0ba('0x26')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe0ba('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe0ba('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':'tTxX','comment':_0xe0ba('0x27')},'dialQueueTimeout':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x28')},'dialQueueProject':{'type':Sequelize[_0xe0ba('0x1')],'comment':_0xe0ba('0x29')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x2a')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x2b')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x2c')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x2d')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xe0ba('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe0ba('0x30')},'dialTimezone':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':_0xe0ba('0x31')},'dialPrefix':{'type':Sequelize[_0xe0ba('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe0ba('0x4')](_0xe0ba('0x32'),_0xe0ba('0x33'),_0xe0ba('0x34')),'defaultValue':_0xe0ba('0x32')},'dialAMDActive':{'type':Sequelize[_0xe0ba('0x1a')],'defaultValue':0x0,'comment':_0xe0ba('0x35')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe0ba('0x1e')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe0ba('0x36')},'dialAMDGreeting':{'type':Sequelize[_0xe0ba('0x11')](0x9)[_0xe0ba('0x1e')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe0ba('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe0ba('0x11')](0x9)[_0xe0ba('0x1e')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe0ba('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe0ba('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0xe0ba('0x11')](0x9)[_0xe0ba('0x1e')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe0ba('0x11')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe0ba('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe0ba('0x11')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe0ba('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe0ba('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe0ba('0x11')](0x9)[_0xe0ba('0x1e')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe0ba('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe0ba('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xe0ba('0x1a')],'defaultValue':0x0,'comment':_0xe0ba('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xe0ba('0x3f'),_0xe0ba('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xe0ba('0x1')],'comment':_0xe0ba('0x29')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe0ba('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe0ba('0x1a')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xe0ba('0x1e')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe0ba('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe0ba('0x1e')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe0ba('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0ba('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe0ba('0x11')](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0ba('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe0ba('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe0ba('0x11')],'allowNull':!![],'comment':_0xe0ba('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe0ba('0x4c'),'set':function(_0x408142){if(!_0x408142)this[_0xe0ba('0xa')](_0xe0ba('0x4d'),null);this[_0xe0ba('0xa')](_0xe0ba('0x4e'),_0x408142);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe0ba('0x1e')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe0ba('0x11')](0x3)[_0xe0ba('0x1e')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6794340..f973484 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 _0xdda1=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','transaction','removeTeams','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','voicePause','all','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','count','status','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','type','value','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','keys','length','create','role','find','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','findOne','order','CmHopper','getHopperHistories','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from'];(function(_0x4a63fc,_0x167a02){var _0x30d4c3=function(_0x3eecb2){while(--_0x3eecb2){_0x4a63fc['push'](_0x4a63fc['shift']());}};_0x30d4c3(++_0x167a02);}(_0xdda1,0xef));var _0x1dda=function(_0x38b0f5,_0x131cd4){_0x38b0f5=_0x38b0f5-0x0;var _0x59fe6d=_0xdda1[_0x38b0f5];return _0x59fe6d;};'use strict';var emlformat=require(_0x1dda('0x0'));var rimraf=require(_0x1dda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1dda('0x2'));var rp=require(_0x1dda('0x3'));var moment=require(_0x1dda('0x4'));var BPromise=require(_0x1dda('0x5'));var Mustache=require(_0x1dda('0x6'));var util=require('util');var path=require(_0x1dda('0x7'));var sox=require(_0x1dda('0x8'));var csv=require(_0x1dda('0x9'));var ejs=require(_0x1dda('0xa'));var fs=require('fs');var fs_extra=require(_0x1dda('0xb'));var _=require('lodash');var squel=require(_0x1dda('0xc'));var crypto=require(_0x1dda('0xd'));var jsforce=require(_0x1dda('0xe'));var deskjs=require(_0x1dda('0xf'));var toCsv=require(_0x1dda('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1dda('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1dda('0x11'));var hardwareService=require(_0x1dda('0x12'));var logger=require(_0x1dda('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1dda('0x14'));var db=require(_0x1dda('0x15'))['db'];config[_0x1dda('0x16')]=_[_0x1dda('0x17')](config[_0x1dda('0x16')],{'host':_0x1dda('0x18'),'port':0x18eb});var socket=require(_0x1dda('0x19'))(new Redis(config[_0x1dda('0x16')]));require('./voiceQueue.socket')[_0x1dda('0x1a')](socket);function respondWithStatusCode(_0x44766c,_0x4c774b){_0x4c774b=_0x4c774b||0xcc;return function(_0x4a1a1f){if(_0x4a1a1f){return _0x44766c[_0x1dda('0x1b')](_0x4c774b);}return _0x44766c['status'](_0x4c774b)[_0x1dda('0x1c')]();};}function respondWithResult(_0x2c2e3e,_0x787b7d){_0x787b7d=_0x787b7d||0xc8;return function(_0x1265e2){if(_0x1265e2){return _0x2c2e3e['status'](_0x787b7d)[_0x1dda('0x1d')](_0x1265e2);}};}function respondWithFilteredResult(_0x197fe9,_0x29c213){return function(_0x30d036){if(_0x30d036){var _0x2ff5c0=typeof _0x29c213[_0x1dda('0x1e')]===_0x1dda('0x1f')&&typeof _0x29c213['limit']===_0x1dda('0x1f');var _0x30162c=_0x30d036[_0x1dda('0x20')];var _0x28cab=_0x2ff5c0?0x0:_0x29c213['offset'];var _0x4456ae=_0x2ff5c0?_0x30d036[_0x1dda('0x20')]:_0x29c213[_0x1dda('0x1e')]+_0x29c213['limit'];var _0x2c660f;if(_0x4456ae>=_0x30162c){_0x4456ae=_0x30162c;_0x2c660f=0xc8;}else{_0x2c660f=0xce;}_0x197fe9[_0x1dda('0x21')](_0x2c660f);return _0x197fe9['set'](_0x1dda('0x22'),_0x28cab+'-'+_0x4456ae+'/'+_0x30162c)[_0x1dda('0x1d')](_0x30d036);}return null;};}function patchUpdates(_0x30bb84){return function(_0x5281b1){try{jsonpatch['apply'](_0x5281b1,_0x30bb84,!![]);}catch(_0x52c421){return BPromise[_0x1dda('0x23')](_0x52c421);}return _0x5281b1[_0x1dda('0x24')]();};}function saveUpdates(_0x14befd,_0x2773a6){return function(_0x23f490){if(_0x23f490){return _0x23f490[_0x1dda('0x25')](_0x14befd)[_0x1dda('0x26')](function(_0x47fc72){return _0x47fc72;});}return null;};}function removeEntity(_0x47c81f,_0x39e94f){return function(_0x204cbb){if(_0x204cbb){return _0x204cbb[_0x1dda('0x27')]()[_0x1dda('0x26')](function(){var _0x44a14e=_0x204cbb[_0x1dda('0x28')]({'plain':!![]});var _0x44e3b2=[{'name':_0x1dda('0x29'),'value':_0x1dda('0x2a'),'ignore':![]},{'name':_0x1dda('0x2b'),'value':_0x1dda('0x2c'),'ignore':![]}];var _0x30f836=_(_0x44e3b2)[_0x1dda('0x2d')]('ignore')['map']('value')['value']();if(_['includes'](_0x30f836,_0x44a14e[_0x1dda('0x2e')])){return;}var _0x3dacca=_['find'](_0x44e3b2,[_0x1dda('0x2f'),_0x44a14e[_0x1dda('0x2e')]])[_0x1dda('0x30')];return db[_0x1dda('0x31')]['destroy']({'where':{'type':_0x3dacca,'resourceId':_0x44a14e['id']}})[_0x1dda('0x26')](function(){return _0x204cbb;});})[_0x1dda('0x26')](function(){_0x47c81f[_0x1dda('0x21')](0xcc)[_0x1dda('0x1c')]();});}};}function handleEntityNotFound(_0x43d192,_0x38c38c){return function(_0x57bd53){if(!_0x57bd53){_0x43d192[_0x1dda('0x1b')](0x194);}return _0x57bd53;};}function handleError(_0x52d5eb,_0x2dedfe){_0x2dedfe=_0x2dedfe||0x1f4;return function(_0x2bd169){logger[_0x1dda('0x32')](_0x2bd169[_0x1dda('0x33')]);if(_0x2bd169[_0x1dda('0x30')]){delete _0x2bd169[_0x1dda('0x30')];}_0x52d5eb[_0x1dda('0x21')](_0x2dedfe)[_0x1dda('0x34')](_0x2bd169);};}exports[_0x1dda('0x35')]=function(_0x106585,_0x454c5f){var _0xbee331={},_0x5935fc={},_0x44ba72={'count':0x0,'rows':[]};var _0x1859be=_[_0x1dda('0x36')](db['VoiceQueue'][_0x1dda('0x37')],function(_0x2b159b){return{'name':_0x2b159b[_0x1dda('0x38')],'type':_0x2b159b[_0x1dda('0x2e')][_0x1dda('0x39')]};});_0x5935fc[_0x1dda('0x3a')]=_[_0x1dda('0x36')](_0x1859be,_0x1dda('0x30'));_0x5935fc[_0x1dda('0x3b')]=_['keys'](_0x106585[_0x1dda('0x3b')]);_0x5935fc[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x5935fc[_0x1dda('0x3a')],_0x5935fc[_0x1dda('0x3b')]);_0xbee331[_0x1dda('0x3e')]=_['intersection'](_0x5935fc[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x106585[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0xbee331[_0x1dda('0x3e')]=_0xbee331[_0x1dda('0x3e')]['length']?_0xbee331['attributes']:_0x5935fc[_0x1dda('0x3a')];if(!_0x106585[_0x1dda('0x3b')][_0x1dda('0x40')](_0x1dda('0x41'))){_0xbee331[_0x1dda('0x42')]=qs['limit'](_0x106585['query'][_0x1dda('0x42')]);_0xbee331['offset']=qs[_0x1dda('0x1e')](_0x106585[_0x1dda('0x3b')][_0x1dda('0x1e')]);}_0xbee331['order']=qs[_0x1dda('0x43')](_0x106585[_0x1dda('0x3b')][_0x1dda('0x43')]);_0xbee331[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x106585[_0x1dda('0x3b')],_0x5935fc['filters']),_0x1859be);if(_0x106585[_0x1dda('0x3b')][_0x1dda('0x2d')]){_0xbee331['where']=_[_0x1dda('0x46')](_0xbee331['where'],{'$or':_[_0x1dda('0x36')](_0x1859be,function(_0x428c02){if(_0x428c02[_0x1dda('0x2e')]!=='VIRTUAL'){var _0x25aa86={};_0x25aa86[_0x428c02[_0x1dda('0x30')]]={'$like':'%'+_0x106585[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x25aa86;}})});}_0xbee331=_[_0x1dda('0x46')]({},_0xbee331,_0x106585[_0x1dda('0x47')]);var _0x349a1e={'where':_0xbee331[_0x1dda('0x44')]};return db[_0x1dda('0x48')][_0x1dda('0x20')](_0x349a1e)['then'](function(_0x32ac70){_0x44ba72[_0x1dda('0x20')]=_0x32ac70;if(_0x106585['query'][_0x1dda('0x49')]){_0xbee331[_0x1dda('0x4a')]=[{'all':!![]}];}return db[_0x1dda('0x48')][_0x1dda('0x4b')](_0xbee331);})[_0x1dda('0x26')](function(_0xcc2e9f){_0x44ba72[_0x1dda('0x4c')]=_0xcc2e9f;return _0x44ba72;})['then'](respondWithFilteredResult(_0x454c5f,_0xbee331))[_0x1dda('0x4d')](handleError(_0x454c5f,null));};exports[_0x1dda('0x4e')]=function(_0x19ef2a,_0x858edb){var _0x5e33bf={'raw':![],'where':{'id':_0x19ef2a[_0x1dda('0x4f')]['id']}},_0x1d7a2f={};_0x1d7a2f['model']=_[_0x1dda('0x50')](db[_0x1dda('0x48')][_0x1dda('0x37')]);_0x1d7a2f['query']=_[_0x1dda('0x50')](_0x19ef2a['query']);_0x1d7a2f[_0x1dda('0x3c')]=_['intersection'](_0x1d7a2f[_0x1dda('0x3a')],_0x1d7a2f[_0x1dda('0x3b')]);_0x5e33bf[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x1d7a2f[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x19ef2a['query']['fields']));_0x5e33bf[_0x1dda('0x3e')]=_0x5e33bf[_0x1dda('0x3e')][_0x1dda('0x51')]?_0x5e33bf['attributes']:_0x1d7a2f[_0x1dda('0x3a')];if(_0x19ef2a[_0x1dda('0x3b')]['includeAll']){_0x5e33bf[_0x1dda('0x4a')]=[{'all':!![]}];}_0x5e33bf=_[_0x1dda('0x46')]({},_0x5e33bf,_0x19ef2a['options']);return db[_0x1dda('0x48')]['find'](_0x5e33bf)[_0x1dda('0x26')](handleEntityNotFound(_0x858edb,null))[_0x1dda('0x26')](respondWithResult(_0x858edb,null))[_0x1dda('0x4d')](handleError(_0x858edb,null));};exports[_0x1dda('0x52')]=function(_0x1040d4,_0x594eae){return db[_0x1dda('0x48')]['create'](_0x1040d4['body'],{})[_0x1dda('0x26')](function(_0x48ea50){var _0x4e88da=_0x1040d4['user'][_0x1dda('0x28')]({'plain':!![]});if(!_0x4e88da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e88da[_0x1dda('0x53')]==='user'){var _0xaa9448=_0x48ea50[_0x1dda('0x28')]({'plain':!![]});var _0x1251ab=[{'name':_0x1dda('0x29'),'value':_0x1dda('0x2a')},{'name':_0x1dda('0x2b'),'value':_0x1dda('0x2c')}];var _0x39f41a=_[_0x1dda('0x54')](_0x1251ab,[_0x1dda('0x2f'),_0xaa9448[_0x1dda('0x2e')]])['name'];return db[_0x1dda('0x55')]['find']({'where':{'name':_0x39f41a,'userProfileId':_0x4e88da['userProfileId']},'raw':!![]})['then'](function(_0x418ec5){if(_0x418ec5&&_0x418ec5[_0x1dda('0x56')]===0x0){return db[_0x1dda('0x31')][_0x1dda('0x52')]({'name':_0xaa9448[_0x1dda('0x30')],'resourceId':_0xaa9448['id'],'type':_0x418ec5[_0x1dda('0x30')],'sectionId':_0x418ec5['id']},{})[_0x1dda('0x26')](function(){return _0x48ea50;});}else{return _0x48ea50;}})['catch'](function(_0x49b74b){logger[_0x1dda('0x32')](_0x1dda('0x57'),_0x49b74b);throw _0x49b74b;});}return _0x48ea50;})[_0x1dda('0x26')](respondWithResult(_0x594eae,0xc9))[_0x1dda('0x4d')](handleError(_0x594eae,null));};exports[_0x1dda('0x58')]=function(_0x5932f8,_0x5bb333){var _0xe76f88={'where':{'id':_0x5932f8[_0x1dda('0x4f')]['id']}},_0x2d6324={};_0x2d6324[_0x1dda('0x3a')]=_['keys'](db['VoiceQueue'][_0x1dda('0x37')]);_0xe76f88[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x2d6324[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x5932f8[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0xe76f88['attributes']=_0xe76f88[_0x1dda('0x3e')][_0x1dda('0x51')]?_0xe76f88[_0x1dda('0x3e')]:_0x2d6324[_0x1dda('0x3a')];if(_0x5932f8[_0x1dda('0x3b')]['includeAll']){_0xe76f88['include']=[{'all':!![]}];}_0xe76f88=_[_0x1dda('0x46')]({},_0xe76f88,_0x5932f8[_0x1dda('0x47')]);return db[_0x1dda('0x48')][_0x1dda('0x54')](_0xe76f88)[_0x1dda('0x26')](handleEntityNotFound(_0x5bb333,null))[_0x1dda('0x26')](function(_0x4d83f7){if(_0x4d83f7){var _0x1b62d4=_0x4d83f7[_0x1dda('0x28')]({'plain':!![]});_0x1b62d4=qs[_0x1dda('0x59')](_0x1b62d4,['id',_0x1dda('0x5a'),_0x1dda('0x5b')]);_0x5932f8[_0x1dda('0x5c')]=_['omit'](_0x5932f8[_0x1dda('0x5c')],['id',_0x1dda('0x5a'),_0x1dda('0x5b')]);return db[_0x1dda('0x48')][_0x1dda('0x52')](_['merge'](_0x1b62d4,_0x5932f8[_0x1dda('0x5c')]),{'include':_0x5932f8[_0x1dda('0x3b')][_0x1dda('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x2155d9){var _0x37a2b0=_0x5932f8[_0x1dda('0x5d')][_0x1dda('0x28')]({'plain':!![]});if(!_0x37a2b0)throw new Error(_0x1dda('0x5e'));if(_0x37a2b0['role']===_0x1dda('0x5d')){var _0x4861a7=_0x2155d9[_0x1dda('0x28')]({'plain':!![]});var _0x17ac8f=[{'name':'VoiceQueues','value':_0x1dda('0x2a')},{'name':_0x1dda('0x2b'),'value':_0x1dda('0x2c')}];var _0x5f153f=_[_0x1dda('0x54')](_0x17ac8f,[_0x1dda('0x2f'),_0x4861a7[_0x1dda('0x2e')]])['name'];return db[_0x1dda('0x55')][_0x1dda('0x54')]({'where':{'name':_0x5f153f,'userProfileId':_0x37a2b0[_0x1dda('0x5f')]},'raw':!![]})[_0x1dda('0x26')](function(_0x502d46){if(_0x502d46&&_0x502d46['autoAssociation']===0x0){return db[_0x1dda('0x31')][_0x1dda('0x52')]({'name':_0x4861a7[_0x1dda('0x30')],'resourceId':_0x4861a7['id'],'type':_0x502d46[_0x1dda('0x30')],'sectionId':_0x502d46['id']},{})[_0x1dda('0x26')](function(){return _0x2155d9;});}else{return _0x2155d9;}})[_0x1dda('0x4d')](function(_0x4cb778){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cb778);throw _0x4cb778;});}return _0x2155d9;});}})[_0x1dda('0x26')](respondWithResult(_0x5bb333,0xc9))['catch'](handleError(_0x5bb333,null));};exports[_0x1dda('0x25')]=function(_0x49c414,_0x4804a3){if(_0x49c414[_0x1dda('0x5c')]['id']){delete _0x49c414['body']['id'];}return db['VoiceQueue'][_0x1dda('0x54')]({'where':{'id':_0x49c414['params']['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x4804a3,null))['then'](saveUpdates(_0x49c414['body'],null))[_0x1dda('0x26')](respondWithResult(_0x4804a3,null))[_0x1dda('0x4d')](handleError(_0x4804a3,null));};exports[_0x1dda('0x27')]=function(_0x27edfb,_0x1a4d8c){return db[_0x1dda('0x48')]['find']({'where':{'id':_0x27edfb[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x1a4d8c,null))['then'](removeEntity(_0x1a4d8c,null))['catch'](handleError(_0x1a4d8c,null));};exports[_0x1dda('0x60')]=function(_0x1ebd18,_0x16ad89,_0x378635){var _0x211d47={'raw':![],'where':{}};var _0x4b0550={};var _0x5a38a7={'count':0x0,'rows':[]};return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0x1ebd18[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x16ad89,null))['then'](function(_0x2ea397){if(_0x2ea397){_0x4b0550[_0x1dda('0x3a')]=_[_0x1dda('0x50')](db['CmHopper'][_0x1dda('0x37')]);_0x4b0550['query']=_['keys'](_0x1ebd18[_0x1dda('0x3b')]);_0x4b0550[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x4b0550[_0x1dda('0x3a')],_0x4b0550[_0x1dda('0x3b')]);_0x211d47[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x4b0550[_0x1dda('0x3a')],qs['fields'](_0x1ebd18[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0x211d47[_0x1dda('0x3e')]=_0x211d47[_0x1dda('0x3e')][_0x1dda('0x51')]?_0x211d47[_0x1dda('0x3e')]:_0x4b0550[_0x1dda('0x3a')];if(!_0x1ebd18[_0x1dda('0x3b')][_0x1dda('0x40')](_0x1dda('0x41'))){_0x211d47[_0x1dda('0x42')]=qs['limit'](_0x1ebd18[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x211d47[_0x1dda('0x1e')]=qs['offset'](_0x1ebd18[_0x1dda('0x3b')][_0x1dda('0x1e')]);}_0x211d47[_0x1dda('0x62')]=qs['sort'](_0x1ebd18[_0x1dda('0x3b')]['sort']);_0x211d47[_0x1dda('0x44')]=qs['filters'](_['pick'](_0x1ebd18[_0x1dda('0x3b')],_0x4b0550[_0x1dda('0x3c')]));_0x211d47[_0x1dda('0x44')]['VoiceQueueId']=_0x2ea397['id'];if(_0x1ebd18['query'][_0x1dda('0x2d')]){_0x211d47[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0x211d47[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0x211d47[_0x1dda('0x3e')],function(_0x4428b6){var _0x6c643c={};_0x6c643c[_0x4428b6]={'$like':'%'+_0x1ebd18[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x6c643c;})});}_0x211d47=_[_0x1dda('0x46')]({},_0x211d47,_0x1ebd18['options']);return db[_0x1dda('0x63')][_0x1dda('0x20')]({'where':_0x211d47[_0x1dda('0x44')]})[_0x1dda('0x26')](function(_0x2ebb4d){_0x5a38a7['count']=_0x2ebb4d;if(_0x1ebd18['query']['includeAll']){_0x211d47[_0x1dda('0x4a')]=[{'all':!![]}];}return db[_0x1dda('0x63')][_0x1dda('0x4b')](_0x211d47);})[_0x1dda('0x26')](function(_0x4fffef){_0x5a38a7[_0x1dda('0x4c')]=_0x4fffef;return _0x5a38a7;});}})[_0x1dda('0x26')](respondWithFilteredResult(_0x16ad89,_0x211d47))['catch'](handleError(_0x16ad89,null));};exports[_0x1dda('0x64')]=function(_0x15205d,_0x5a77e8,_0x26b9b3){var _0x48d900={'raw':!![],'where':{}};var _0x4487fd={};var _0x21e927={'count':0x0,'rows':[]};return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0x15205d[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x5a77e8,null))[_0x1dda('0x26')](function(_0x1aa64a){if(_0x1aa64a){_0x4487fd[_0x1dda('0x3a')]=_['keys'](db['CmHopperHistory'][_0x1dda('0x37')]);_0x4487fd[_0x1dda('0x3b')]=_['keys'](_0x15205d[_0x1dda('0x3b')]);_0x4487fd['filters']=_[_0x1dda('0x3d')](_0x4487fd[_0x1dda('0x3a')],_0x4487fd['query']);_0x48d900[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x4487fd['model'],qs['fields'](_0x15205d[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0x48d900[_0x1dda('0x3e')]=_0x48d900[_0x1dda('0x3e')][_0x1dda('0x51')]?_0x48d900[_0x1dda('0x3e')]:_0x4487fd[_0x1dda('0x3a')];if(!_0x15205d[_0x1dda('0x3b')]['hasOwnProperty'](_0x1dda('0x41'))){_0x48d900[_0x1dda('0x42')]=qs['limit'](_0x15205d[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x48d900[_0x1dda('0x1e')]=qs['offset'](_0x15205d[_0x1dda('0x3b')][_0x1dda('0x1e')]);}_0x48d900['order']=qs['sort'](_0x15205d[_0x1dda('0x3b')][_0x1dda('0x43')]);_0x48d900[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x15205d['query'],_0x4487fd[_0x1dda('0x3c')]));_0x48d900[_0x1dda('0x44')][_0x1dda('0x65')]=_0x1aa64a['id'];if(_0x15205d['query'][_0x1dda('0x2d')]){_0x48d900['where']=_[_0x1dda('0x46')](_0x48d900['where'],{'$or':_[_0x1dda('0x36')](_0x48d900['attributes'],function(_0x5bb807){var _0x4c0a66={};_0x4c0a66[_0x5bb807]={'$like':'%'+_0x15205d[_0x1dda('0x3b')]['filter']+'%'};return _0x4c0a66;})});}_0x48d900=_[_0x1dda('0x46')]({},_0x48d900,_0x15205d[_0x1dda('0x47')]);return db[_0x1dda('0x66')][_0x1dda('0x20')]({'where':_0x48d900['where']})[_0x1dda('0x26')](function(_0x2dbb61){_0x21e927[_0x1dda('0x20')]=_0x2dbb61;if(_0x15205d['query'][_0x1dda('0x49')]){_0x48d900[_0x1dda('0x4a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1dda('0x4b')](_0x48d900);})[_0x1dda('0x26')](function(_0x4a8fea){_0x21e927[_0x1dda('0x4c')]=_0x4a8fea;return _0x21e927;});}})['then'](respondWithFilteredResult(_0x5a77e8,_0x48d900))['catch'](handleError(_0x5a77e8,null));};exports['getHopperFinals']=function(_0x5a87b2,_0x3443ec,_0x12f294){var _0x57e595={'raw':!![],'where':{}};var _0x3cbd80={};var _0xe0dc0f={'count':0x0,'rows':[]};return db[_0x1dda('0x48')]['findOne']({'where':{'id':_0x5a87b2[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x3443ec,null))[_0x1dda('0x26')](function(_0xb8d192){if(_0xb8d192){_0x3cbd80[_0x1dda('0x3a')]=_[_0x1dda('0x50')](db['CmHopperFinal']['rawAttributes']);_0x3cbd80[_0x1dda('0x3b')]=_[_0x1dda('0x50')](_0x5a87b2[_0x1dda('0x3b')]);_0x3cbd80[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x3cbd80[_0x1dda('0x3a')],_0x3cbd80[_0x1dda('0x3b')]);_0x57e595[_0x1dda('0x3e')]=_['intersection'](_0x3cbd80[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x5a87b2['query'][_0x1dda('0x3f')]));_0x57e595[_0x1dda('0x3e')]=_0x57e595[_0x1dda('0x3e')][_0x1dda('0x51')]?_0x57e595['attributes']:_0x3cbd80[_0x1dda('0x3a')];if(!_0x5a87b2['query']['hasOwnProperty'](_0x1dda('0x41'))){_0x57e595[_0x1dda('0x42')]=qs[_0x1dda('0x42')](_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x57e595['offset']=qs[_0x1dda('0x1e')](_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x1e')]);}_0x57e595[_0x1dda('0x62')]=qs[_0x1dda('0x43')](_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x43')]);_0x57e595[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x5a87b2[_0x1dda('0x3b')],_0x3cbd80['filters']));_0x57e595[_0x1dda('0x44')][_0x1dda('0x65')]=_0xb8d192['id'];if(_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x2d')]){_0x57e595['where']=_[_0x1dda('0x46')](_0x57e595[_0x1dda('0x44')],{'$or':_['map'](_0x57e595[_0x1dda('0x3e')],function(_0x50fdea){var _0x428bf9={};_0x428bf9[_0x50fdea]={'$like':'%'+_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x428bf9;})});}_0x57e595=_[_0x1dda('0x46')]({},_0x57e595,_0x5a87b2[_0x1dda('0x47')]);return db[_0x1dda('0x67')][_0x1dda('0x20')]({'where':_0x57e595[_0x1dda('0x44')]})[_0x1dda('0x26')](function(_0x1ad8ea){_0xe0dc0f[_0x1dda('0x20')]=_0x1ad8ea;if(_0x5a87b2[_0x1dda('0x3b')][_0x1dda('0x49')]){_0x57e595[_0x1dda('0x4a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1dda('0x4b')](_0x57e595);})[_0x1dda('0x26')](function(_0x334d51){_0xe0dc0f[_0x1dda('0x4c')]=_0x334d51;return _0xe0dc0f;});}})[_0x1dda('0x26')](respondWithFilteredResult(_0x3443ec,_0x57e595))['catch'](handleError(_0x3443ec,null));};exports[_0x1dda('0x68')]=function(_0xa7ba65,_0x321d48,_0x3b5a31){var _0x30d241={'raw':!![],'where':{}};var _0x196460={};var _0x245169={'count':0x0,'rows':[]};return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0xa7ba65[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x321d48,null))[_0x1dda('0x26')](function(_0x35cc34){if(_0x35cc34){_0x196460[_0x1dda('0x3a')]=_['keys'](db[_0x1dda('0x69')]['rawAttributes']);_0x196460[_0x1dda('0x3b')]=_['keys'](_0xa7ba65[_0x1dda('0x3b')]);_0x196460[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x196460[_0x1dda('0x3a')],_0x196460['query']);_0x30d241[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x196460[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0xa7ba65[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0x30d241['attributes']=_0x30d241['attributes']['length']?_0x30d241['attributes']:_0x196460[_0x1dda('0x3a')];if(!_0xa7ba65[_0x1dda('0x3b')]['hasOwnProperty'](_0x1dda('0x41'))){_0x30d241[_0x1dda('0x42')]=qs[_0x1dda('0x42')](_0xa7ba65[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x30d241[_0x1dda('0x1e')]=qs['offset'](_0xa7ba65['query'][_0x1dda('0x1e')]);}_0x30d241[_0x1dda('0x62')]=qs[_0x1dda('0x43')](_0xa7ba65[_0x1dda('0x3b')][_0x1dda('0x43')]);_0x30d241['where']=qs['filters'](_['pick'](_0xa7ba65[_0x1dda('0x3b')],_0x196460['filters']));_0x30d241[_0x1dda('0x44')][_0x1dda('0x65')]=_0x35cc34['id'];if(_0xa7ba65[_0x1dda('0x3b')][_0x1dda('0x2d')]){_0x30d241[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0x30d241[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0x30d241['attributes'],function(_0x1b3165){var _0x4563f4={};_0x4563f4[_0x1b3165]={'$like':'%'+_0xa7ba65[_0x1dda('0x3b')]['filter']+'%'};return _0x4563f4;})});}_0x30d241=_[_0x1dda('0x46')]({},_0x30d241,_0xa7ba65[_0x1dda('0x47')]);return db[_0x1dda('0x69')][_0x1dda('0x20')]({'where':_0x30d241[_0x1dda('0x44')]})[_0x1dda('0x26')](function(_0x47126a){_0x245169[_0x1dda('0x20')]=_0x47126a;if(_0xa7ba65[_0x1dda('0x3b')][_0x1dda('0x49')]){_0x30d241['include']=[{'all':!![]}];}return db[_0x1dda('0x69')][_0x1dda('0x4b')](_0x30d241);})['then'](function(_0x20dbe7){_0x245169[_0x1dda('0x4c')]=_0x20dbe7;return _0x245169;});}})['then'](respondWithFilteredResult(_0x321d48,_0x30d241))[_0x1dda('0x4d')](handleError(_0x321d48,null));};exports[_0x1dda('0x6a')]=function(_0x4a873d,_0x480da6,_0x3d061b){var _0xdc425c={};var _0x258aa9={};var _0x5c5177;var _0x2df9db;return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0x4a873d['params']['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x480da6,null))['then'](function(_0x38558a){if(_0x38558a){_0x5c5177=_0x38558a;_0x258aa9[_0x1dda('0x3a')]=_['keys'](db[_0x1dda('0x6b')][_0x1dda('0x37')]);_0x258aa9[_0x1dda('0x3b')]=_[_0x1dda('0x50')](_0x4a873d['query']);_0x258aa9[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x258aa9[_0x1dda('0x3a')],_0x258aa9[_0x1dda('0x3b')]);_0xdc425c[_0x1dda('0x3e')]=_['intersection'](_0x258aa9[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x4a873d['query'][_0x1dda('0x3f')]));_0xdc425c[_0x1dda('0x3e')]=_0xdc425c[_0x1dda('0x3e')][_0x1dda('0x51')]?_0xdc425c[_0x1dda('0x3e')]:_0x258aa9[_0x1dda('0x3a')];_0xdc425c[_0x1dda('0x62')]=qs['sort'](_0x4a873d[_0x1dda('0x3b')]['sort']);_0xdc425c[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x4a873d['query'],_0x258aa9['filters']));if(_0x4a873d[_0x1dda('0x3b')][_0x1dda('0x2d')]){_0xdc425c[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0xdc425c[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0xdc425c['attributes'],function(_0x1161d1){var _0x1f2083={};_0x1f2083[_0x1161d1]={'$like':'%'+_0x4a873d[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x1f2083;})});}_0xdc425c=_['merge']({},_0xdc425c,_0x4a873d['options']);return _0x5c5177[_0x1dda('0x6a')](_0xdc425c);}})['then'](function(_0x55091b){if(_0x55091b){_0x2df9db=_0x55091b[_0x1dda('0x51')];if(!_0x4a873d[_0x1dda('0x3b')][_0x1dda('0x40')](_0x1dda('0x41'))){_0xdc425c[_0x1dda('0x42')]=qs[_0x1dda('0x42')](_0x4a873d[_0x1dda('0x3b')][_0x1dda('0x42')]);_0xdc425c[_0x1dda('0x1e')]=qs['offset'](_0x4a873d[_0x1dda('0x3b')][_0x1dda('0x1e')]);}return _0x5c5177['getTeams'](_0xdc425c);}})[_0x1dda('0x26')](function(_0x5c571){if(_0x5c571){return _0x5c571?{'count':_0x2df9db,'rows':_0x5c571}:null;}})[_0x1dda('0x26')](respondWithResult(_0x480da6,null))[_0x1dda('0x4d')](handleError(_0x480da6,null));};exports[_0x1dda('0x6c')]=function(_0x29ce5c,_0x4f93e1,_0x98abd2){var _0x5dda9f=_0x29ce5c[_0x1dda('0x5c')][_0x1dda('0x6d')];var _0x38b68e=_[_0x1dda('0x36')](_0x5dda9f,'id');return db['Team'][_0x1dda('0x4b')]({'where':{'id':_0x38b68e},'attributes':['id'],'include':[{'model':db[_0x1dda('0x6e')],'as':_0x1dda('0x6f'),'attributes':['id','name',_0x1dda('0x70'),'voicePause',_0x1dda('0x71')],'raw':!![]}]})[_0x1dda('0x26')](function(_0x3e305a){if(_0x3e305a){var _0x8a5f6d=_['flatMap'](_0x3e305a,function(_0x118eeb){var _0x3459cd=_0x118eeb['get']({'plain':!![]});_0x3459cd[_0x1dda('0x6f')][_0x1dda('0x72')](function(_0x43698e){_0x43698e[_0x1dda('0x73')]=_[_0x1dda('0x54')](_0x5dda9f,{'id':_0x3459cd['id']})[_0x1dda('0x73')];});return _0x3459cd['Agents'];});return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x29ce5c[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](function(_0x99c854){return db[_0x1dda('0x74')]['transaction'](function(_0xb80c42){return _0x99c854[_0x1dda('0x6c')](_0x38b68e,{'transaction':_0xb80c42})['then'](function(){return BPromise[_0x1dda('0x75')](_0x5dda9f,function(_0x5e8552){return db[_0x1dda('0x76')][_0x1dda('0x77')]({'TeamId':_0x5e8552['id'],'VoiceQueueId':_0x29ce5c[_0x1dda('0x4f')]['id'],'penalty':_0x5e8552[_0x1dda('0x73')]},{'transaction':_0xb80c42});});})['then'](function(){return BPromise[_0x1dda('0x75')](_0x8a5f6d,function(_0x9689eb){return db['UserVoiceQueue'][_0x1dda('0x78')]({'where':{'UserId':_0x9689eb['id'],'VoiceQueueId':_0x29ce5c[_0x1dda('0x4f')]['id']},'defaults':{'penalty':_0x9689eb[_0x1dda('0x73')]},'transaction':_0xb80c42});});})[_0x1dda('0x26')](function(){return BPromise[_0x1dda('0x75')](_[_0x1dda('0x2d')](_0x8a5f6d,{'online':!![]}),function(_0x54b09c){return db['UserVoiceQueueRt'][_0x1dda('0x77')]({'membername':_0x54b09c['name'],'UserId':_0x54b09c['id'],'queue_name':_0x99c854[_0x1dda('0x30')],'VoiceQueueId':_0x99c854['id'],'interface':_[_0x1dda('0x79')](_0x54b09c['interface'])?util[_0x1dda('0x7a')](_0x1dda('0x7b'),_0x54b09c[_0x1dda('0x30')]):_0x54b09c[_0x1dda('0x71')],'paused':_0x54b09c['voicePause']||![],'penalty':_0x54b09c[_0x1dda('0x73')]},{'transaction':_0xb80c42});});})['then'](function(){_0x8a5f6d[_0x1dda('0x72')](function(_0x17d6ba){socket[_0x1dda('0x7c')]('userVoiceQueue:save',{'UserId':_0x17d6ba['id'],'VoiceQueueId':_0x99c854['id']});});});});});}})[_0x1dda('0x26')](respondWithStatusCode(_0x4f93e1,null))['catch'](handleError(_0x4f93e1,null));};exports['removeTeams']=function(_0x150093,_0xeedebb,_0xfd9094){return db[_0x1dda('0x6b')][_0x1dda('0x4b')]({'where':{'id':_0x150093[_0x1dda('0x3b')][_0x1dda('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x1dda('0x6e')],'as':_0x1dda('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x1dda('0x26')](handleEntityNotFound(_0xeedebb,null))[_0x1dda('0x26')](function(_0x201f02){var _0x44ae08=_[_0x1dda('0x36')](_0x201f02,'id');var _0x4b8697=[];var _0x47e4fd=[];var _0x5f5538=squel['select']();_0x5f5538[_0x1dda('0x7e')](_0x1dda('0x7f'))[_0x1dda('0x80')]('team_has_voice_queues','tq')[_0x1dda('0x81')](_0x1dda('0x82'),'ut',_0x1dda('0x83'))[_0x1dda('0x44')](_0x1dda('0x84'),_0x150093['params']['id']);for(var _0x479dbd=0x0;_0x479dbd<_0x201f02[_0x1dda('0x51')];_0x479dbd+=0x1){let _0x11a315=_0x201f02[_0x479dbd];for(var _0x30664d=0x0;_0x30664d<_0x11a315['Agents'][_0x1dda('0x51')];_0x30664d+=0x1){let _0x5b6108=_0x11a315[_0x1dda('0x6f')][_0x30664d];var _0xc6a28e=_0x5f5538[_0x1dda('0x58')]();_0xc6a28e[_0x1dda('0x44')](_0x1dda('0x85'),_0x5b6108['id']);_0x47e4fd[_0x1dda('0x86')](db[_0x1dda('0x74')][_0x1dda('0x3b')](_0xc6a28e[_0x1dda('0x87')](),{'type':db[_0x1dda('0x74')][_0x1dda('0x88')]['SELECT']})['then'](function(_0x4ef975){if(_0x4ef975['length']===0x1){return _0x5b6108['id'];}else{var _0x281d6b=_[_0x1dda('0x89')](_[_0x1dda('0x36')](_0x4ef975,_0x1dda('0x8a')),function(_0xb9208f){return _[_0x1dda('0x8b')](_0x44ae08,_0xb9208f);});if(_0x281d6b){return _0x5b6108['id'];}}}));}}return BPromise['all'](_0x47e4fd)[_0x1dda('0x26')](function(_0x41d59f){_0x4b8697=_(_0x4b8697)[_0x1dda('0x8c')](_0x41d59f)[_0x1dda('0x8d')]()['value']();return db[_0x1dda('0x48')]['find']({'where':{'id':_0x150093[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](function(_0x5b6618){return db['sequelize'][_0x1dda('0x8e')](function(_0x465d24){return _0x5b6618[_0x1dda('0x8f')](_0x150093[_0x1dda('0x3b')]['ids'],{'transaction':_0x465d24})[_0x1dda('0x26')](function(){if(!_[_0x1dda('0x90')](_0x4b8697)){return _0x5b6618[_0x1dda('0x91')](_0x4b8697,{'transaction':_0x465d24})[_0x1dda('0x26')](function(){return db[_0x1dda('0x92')][_0x1dda('0x27')]({'where':{'VoiceQueueId':_0x150093[_0x1dda('0x4f')]['id'],'UserId':_0x4b8697},'transaction':_0x465d24});});}})[_0x1dda('0x26')](function(){_0x4b8697[_0x1dda('0x72')](function(_0x12daa7){socket[_0x1dda('0x7c')](_0x1dda('0x93'),{'UserId':_0x12daa7,'VoiceQueueId':_0x5b6618['id']});});});});});});})['then'](respondWithStatusCode(_0xeedebb,null))['catch'](handleError(_0xeedebb,null));};exports['addAgents']=function(_0x32df8b,_0xf92ebe,_0x1e9b10){var _0x2e7d76,_0x2c4177;return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x32df8b[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0xf92ebe,null))[_0x1dda('0x26')](function(_0x6bc871){if(_0x6bc871){_0x2c4177=_0x6bc871;return _0x6bc871[_0x1dda('0x94')](_0x32df8b[_0x1dda('0x5c')][_0x1dda('0x7d')],_[_0x1dda('0x59')](_0x32df8b[_0x1dda('0x5c')],['ids','id'])||{})[_0x1dda('0x95')](function(_0x69e8e7){for(var _0x53e1eb=0x0;_0x53e1eb<_0x32df8b[_0x1dda('0x5c')][_0x1dda('0x7d')]['length'];_0x53e1eb+=0x1){socket[_0x1dda('0x7c')](_0x1dda('0x96'),{'UserId':Number(_0x32df8b[_0x1dda('0x5c')][_0x1dda('0x7d')][_0x53e1eb]),'VoiceQueueId':Number(_0x32df8b['params']['id'])});}return _0x69e8e7;});}})[_0x1dda('0x26')](function(_0x1b25d6){_0x2e7d76=_0x1b25d6||[];if(_0x2c4177){return db[_0x1dda('0x6e')][_0x1dda('0x4b')]({'where':{'id':_0x32df8b[_0x1dda('0x5c')]['ids']},'attributes':['id',_0x1dda('0x30'),_0x1dda('0x70'),_0x1dda('0x97'),_0x1dda('0x71')],'raw':!![]});}})[_0x1dda('0x26')](function(_0x1ba386){if(!_[_0x1dda('0x90')](_0x1ba386)){var _0x4a1003=[];for(var _0x459eca=0x0;_0x459eca<_0x1ba386[_0x1dda('0x51')];_0x459eca++){if(_0x1ba386[_0x459eca][_0x1dda('0x70')]){_0x4a1003['push'](db['UserVoiceQueueRt'][_0x1dda('0x77')]({'membername':_0x1ba386[_0x459eca]['name'],'UserId':_0x1ba386[_0x459eca]['id'],'queue_name':_0x2c4177[_0x1dda('0x30')],'VoiceQueueId':_0x2c4177['id'],'interface':_[_0x1dda('0x79')](_0x1ba386[_0x459eca][_0x1dda('0x71')])?util[_0x1dda('0x7a')](_0x1dda('0x7b'),_0x1ba386[_0x459eca][_0x1dda('0x30')]):_0x1ba386[_0x459eca][_0x1dda('0x71')],'paused':_0x1ba386[_0x459eca]['voicePause']||![],'penalty':_0x32df8b[_0x1dda('0x5c')][_0x1dda('0x73')]||0x0}));}}return BPromise[_0x1dda('0x98')](_0x4a1003);}})[_0x1dda('0x26')](function(){return _0x2e7d76;})[_0x1dda('0x26')](respondWithResult(_0xf92ebe,null))['catch'](handleError(_0xf92ebe,null));};exports[_0x1dda('0x91')]=function(_0x3d1b9d,_0x26219a,_0x463c2c){return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x3d1b9d[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x26219a,null))[_0x1dda('0x26')](function(_0x3fd1b5){if(_0x3fd1b5){return _0x3fd1b5['removeAgents'](_0x3d1b9d[_0x1dda('0x3b')][_0x1dda('0x7d')])[_0x1dda('0x26')](function(){if(_[_0x1dda('0x99')](_0x3d1b9d[_0x1dda('0x3b')][_0x1dda('0x7d')])){for(var _0x5cf78e=0x0;_0x5cf78e<_0x3d1b9d[_0x1dda('0x3b')][_0x1dda('0x7d')][_0x1dda('0x51')];_0x5cf78e+=0x1){socket[_0x1dda('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x3d1b9d[_0x1dda('0x3b')]['ids'][_0x5cf78e]),'VoiceQueueId':Number(_0x3d1b9d[_0x1dda('0x4f')]['id'])});}}else{socket[_0x1dda('0x7c')](_0x1dda('0x93'),{'UserId':Number(_0x3d1b9d[_0x1dda('0x3b')][_0x1dda('0x7d')]),'VoiceQueueId':Number(_0x3d1b9d[_0x1dda('0x4f')]['id'])});}});}})['then'](function(_0x3d7d65){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3d1b9d[_0x1dda('0x4f')]['id'],'UserId':_0x3d1b9d[_0x1dda('0x3b')][_0x1dda('0x7d')]}})[_0x1dda('0x26')](function(){return _0x3d7d65;});})[_0x1dda('0x26')](respondWithStatusCode(_0x26219a,null))['catch'](handleError(_0x26219a,null));};exports[_0x1dda('0x9a')]=function(_0x343b6d,_0x21208d,_0x33ec14){var _0xf86ee1={};var _0x218c66={};var _0x2b61ad;var _0x20d41a;return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0x343b6d['params']['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x21208d,null))['then'](function(_0x53ec91){if(_0x53ec91){_0x2b61ad=_0x53ec91;_0x218c66[_0x1dda('0x3a')]=_[_0x1dda('0x50')](db['User'][_0x1dda('0x37')]);_0x218c66[_0x1dda('0x3b')]=_[_0x1dda('0x50')](_0x343b6d['query']);_0x218c66['filters']=_[_0x1dda('0x3d')](_0x218c66[_0x1dda('0x3a')],_0x218c66[_0x1dda('0x3b')]);_0xf86ee1[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x218c66[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x343b6d['query'][_0x1dda('0x3f')]));_0xf86ee1['attributes']=_0xf86ee1[_0x1dda('0x3e')][_0x1dda('0x51')]?_0xf86ee1['attributes']:_0x218c66[_0x1dda('0x3a')];_0xf86ee1[_0x1dda('0x62')]=qs[_0x1dda('0x43')](_0x343b6d['query']['sort']);_0xf86ee1[_0x1dda('0x44')]=qs['filters'](_['pick'](_0x343b6d['query'],_0x218c66[_0x1dda('0x3c')]));if(_0x343b6d['query'][_0x1dda('0x2d')]){_0xf86ee1[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0xf86ee1[_0x1dda('0x44')],{'$or':_['map'](_0xf86ee1[_0x1dda('0x3e')],function(_0x338b2a){var _0x2eba02={};_0x2eba02[_0x338b2a]={'$like':'%'+_0x343b6d[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x2eba02;})});}_0xf86ee1=_[_0x1dda('0x46')]({},_0xf86ee1,_0x343b6d['options']);return _0x2b61ad[_0x1dda('0x9a')](_0xf86ee1);}})[_0x1dda('0x26')](function(_0x275e8c){if(_0x275e8c){_0x20d41a=_0x275e8c[_0x1dda('0x51')];if(!_0x343b6d[_0x1dda('0x3b')]['hasOwnProperty'](_0x1dda('0x41'))){_0xf86ee1[_0x1dda('0x42')]=qs['limit'](_0x343b6d['query'][_0x1dda('0x42')]);_0xf86ee1[_0x1dda('0x1e')]=qs['offset'](_0x343b6d['query'][_0x1dda('0x1e')]);}return _0x2b61ad[_0x1dda('0x9a')](_0xf86ee1);}})['then'](function(_0x1a4947){if(_0x1a4947){return _0x1a4947?{'count':_0x20d41a,'rows':_0x1a4947}:null;}})[_0x1dda('0x26')](respondWithResult(_0x21208d,null))[_0x1dda('0x4d')](handleError(_0x21208d,null));};exports[_0x1dda('0x9b')]=function(_0x5d60d2,_0x4f8a56,_0x2b6864){var _0x562788={};var _0x31da9f={};var _0x2e8f75;var _0x312f1a;return db['VoiceQueue'][_0x1dda('0x61')]({'where':{'id':_0x5d60d2[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x4f8a56,null))[_0x1dda('0x26')](function(_0x550dfb){if(_0x550dfb){_0x2e8f75=_0x550dfb;_0x31da9f['model']=_['keys'](db[_0x1dda('0x92')][_0x1dda('0x37')]);_0x31da9f[_0x1dda('0x3b')]=_[_0x1dda('0x50')](_0x5d60d2[_0x1dda('0x3b')]);_0x31da9f['filters']=_[_0x1dda('0x3d')](_0x31da9f[_0x1dda('0x3a')],_0x31da9f['query']);_0x562788[_0x1dda('0x3e')]=_[_0x1dda('0x3d')](_0x31da9f[_0x1dda('0x3a')],qs['fields'](_0x5d60d2[_0x1dda('0x3b')]['fields']));_0x562788[_0x1dda('0x3e')]=_0x562788[_0x1dda('0x3e')]['length']?_0x562788[_0x1dda('0x3e')]:_0x31da9f[_0x1dda('0x3a')];_0x562788['order']=qs[_0x1dda('0x43')](_0x5d60d2[_0x1dda('0x3b')]['sort']);_0x562788[_0x1dda('0x44')]=qs['filters'](_['pick'](_0x5d60d2['query'],_0x31da9f[_0x1dda('0x3c')]));if(_0x5d60d2['query'][_0x1dda('0x2d')]){_0x562788['where']=_[_0x1dda('0x46')](_0x562788[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0x562788[_0x1dda('0x3e')],function(_0x300aaf){var _0x3097f3={};_0x3097f3[_0x300aaf]={'$like':'%'+_0x5d60d2[_0x1dda('0x3b')][_0x1dda('0x2d')]+'%'};return _0x3097f3;})});}_0x562788=_['merge']({},_0x562788,_0x5d60d2[_0x1dda('0x47')]);return _0x2e8f75[_0x1dda('0x9b')](_0x562788);}})[_0x1dda('0x26')](function(_0x3e12d1){if(_0x3e12d1){_0x312f1a=_0x3e12d1['length'];if(!_0x5d60d2[_0x1dda('0x3b')]['hasOwnProperty']('nolimit')){_0x562788[_0x1dda('0x42')]=qs[_0x1dda('0x42')](_0x5d60d2[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x562788[_0x1dda('0x1e')]=qs['offset'](_0x5d60d2[_0x1dda('0x3b')][_0x1dda('0x1e')]);}return _0x2e8f75['getMembers'](_0x562788);}})[_0x1dda('0x26')](function(_0x3e7aae){return _0x3e7aae?{'count':_0x312f1a,'rows':_0x3e7aae}:null;})[_0x1dda('0x26')](respondWithResult(_0x4f8a56,null))[_0x1dda('0x4d')](handleError(_0x4f8a56,null));};exports[_0x1dda('0x9c')]=function(_0x394a9c,_0x4d2b42,_0x3a773b){var _0xe55963={};var _0x1cb2a5={};var _0x3ece8b;var _0x8ed5bb;return db['VoiceQueue'][_0x1dda('0x61')]({'where':{'id':_0x394a9c[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x4d2b42,null))[_0x1dda('0x26')](function(_0x572b2f){if(_0x572b2f){_0x3ece8b=_0x572b2f;_0x1cb2a5[_0x1dda('0x3a')]=_[_0x1dda('0x50')](db['CmList'][_0x1dda('0x37')]);_0x1cb2a5['query']=_[_0x1dda('0x50')](_0x394a9c[_0x1dda('0x3b')]);_0x1cb2a5['filters']=_[_0x1dda('0x3d')](_0x1cb2a5[_0x1dda('0x3a')],_0x1cb2a5['query']);_0xe55963[_0x1dda('0x3e')]=_['intersection'](_0x1cb2a5[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x394a9c[_0x1dda('0x3b')]['fields']));_0xe55963[_0x1dda('0x3e')]=_0xe55963[_0x1dda('0x3e')][_0x1dda('0x51')]?_0xe55963['attributes']:_0x1cb2a5[_0x1dda('0x3a')];_0xe55963['order']=qs[_0x1dda('0x43')](_0x394a9c[_0x1dda('0x3b')]['sort']);_0xe55963[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x394a9c[_0x1dda('0x3b')],_0x1cb2a5[_0x1dda('0x3c')]));if(_0x394a9c[_0x1dda('0x3b')][_0x1dda('0x2d')]){_0xe55963[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0xe55963[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0xe55963[_0x1dda('0x3e')],function(_0x1cfd09){var _0x26e4d8={};_0x26e4d8[_0x1cfd09]={'$like':'%'+_0x394a9c[_0x1dda('0x3b')]['filter']+'%'};return _0x26e4d8;})});}_0xe55963=_[_0x1dda('0x46')]({},_0xe55963,_0x394a9c[_0x1dda('0x47')]);return _0x3ece8b['getLists'](_0xe55963);}})[_0x1dda('0x26')](function(_0x53a7a9){if(_0x53a7a9){_0x8ed5bb=_0x53a7a9[_0x1dda('0x51')];if(!_0x394a9c[_0x1dda('0x3b')][_0x1dda('0x40')](_0x1dda('0x41'))){_0xe55963[_0x1dda('0x42')]=qs[_0x1dda('0x42')](_0x394a9c[_0x1dda('0x3b')][_0x1dda('0x42')]);_0xe55963['offset']=qs['offset'](_0x394a9c[_0x1dda('0x3b')][_0x1dda('0x1e')]);}return _0x3ece8b['getLists'](_0xe55963);}})[_0x1dda('0x26')](function(_0x325037){if(_0x325037){return _0x325037?{'count':_0x8ed5bb,'rows':_0x325037}:null;}})[_0x1dda('0x26')](respondWithResult(_0x4d2b42,null))[_0x1dda('0x4d')](handleError(_0x4d2b42,null));};exports['addLists']=function(_0x51df7c,_0x10bb21,_0x20bec6){var _0xdbbf2,_0x14a7e1;return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x51df7c[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x10bb21,null))[_0x1dda('0x26')](function(_0x1d427c){if(_0x1d427c){_0x14a7e1=_0x1d427c;return _0x1d427c[_0x1dda('0x9d')](_0x51df7c['body'][_0x1dda('0x7d')],_[_0x1dda('0x59')](_0x51df7c[_0x1dda('0x5c')],['ids','id'])||{});}return null;})[_0x1dda('0x95')](function(_0x172583){var _0x31b098;_0xdbbf2=_0x172583||[];var _0x4e8e42=[];if(_0x172583){for(var _0x4043af=0x0;_0x4043af<_0x172583[_0x1dda('0x51')];_0x4043af+=0x1){var _0x3ad837=_0x172583[_0x4043af][_0x1dda('0x28')]({'plain':!![]});_0x14a7e1[_0x1dda('0x9e')]=_0x51df7c['body']['dialCheckDuplicateType']?_0x51df7c[_0x1dda('0x5c')]['dialCheckDuplicateType']:_0x14a7e1[_0x1dda('0x9e')];switch(_0x14a7e1['dialCheckDuplicateType']){case _0x1dda('0x9f'):_0x31b098=squel[_0x1dda('0xa0')]()[_0x1dda('0xa1')](_0x1dda('0xa2'))[_0x1dda('0xa3')]([_0x1dda('0xa4'),_0x1dda('0xa5'),_0x1dda('0xa6'),_0x1dda('0xa7'),_0x1dda('0x65'),_0x1dda('0x5a'),_0x1dda('0x5b')],squel[_0x1dda('0xa8')]()[_0x1dda('0x7e')](_0x1dda('0xa4'),_0x1dda('0xa4'))[_0x1dda('0x7e')](_0x1dda('0xa9'),'scheduledAt')[_0x1dda('0x7e')]('id',_0x1dda('0xa6'))[_0x1dda('0x7e')](_0x3ad837[_0x1dda('0xaa')]['toString'](),'ListId')['field'](_0x51df7c['params']['id']['toString'](),_0x1dda('0x65'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5a'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5b'))[_0x1dda('0x80')](_0x1dda('0xab'))[_0x1dda('0x44')](_0x1dda('0xac'))[_0x1dda('0x44')](_0x1dda('0xad'),_0x3ad837[_0x1dda('0xaa')][_0x1dda('0x87')]())['where'](_0x1dda('0xae'))[_0x1dda('0x44')](_0x1dda('0xaf'),squel['select']()[_0x1dda('0x7e')](_0x1dda('0xb0'))[_0x1dda('0x80')](_0x1dda('0xb1'))['where'](_0x1dda('0x84'),_0x51df7c[_0x1dda('0x4f')]['id']['toString']()))['where'](_0x1dda('0xaf'),squel[_0x1dda('0xa8')]()['field'](_0x1dda('0xb2'))['from'](_0x1dda('0xa2'))[_0x1dda('0x44')](_0x1dda('0x84'),_0x51df7c[_0x1dda('0x4f')]['id'][_0x1dda('0x87')]())))[_0x1dda('0x87')]();break;case'onlyIfOpen':_0x31b098=squel[_0x1dda('0xa0')]()[_0x1dda('0xa1')](_0x1dda('0xa2'))[_0x1dda('0xa3')](['phone',_0x1dda('0xa5'),_0x1dda('0xa6'),'ListId','VoiceQueueId','createdAt',_0x1dda('0x5b')],squel[_0x1dda('0xa8')]()[_0x1dda('0x7e')](_0x1dda('0xa4'),_0x1dda('0xa4'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0xa5'))[_0x1dda('0x7e')]('id',_0x1dda('0xa6'))['field'](_0x3ad837[_0x1dda('0xaa')][_0x1dda('0x87')](),_0x1dda('0xa7'))[_0x1dda('0x7e')](_0x51df7c['params']['id'][_0x1dda('0x87')](),_0x1dda('0x65'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5a'))[_0x1dda('0x7e')](_0x1dda('0xa9'),'updatedAt')['from'](_0x1dda('0xab'))[_0x1dda('0x44')]('deletedAt\x20IS\x20NULL')[_0x1dda('0x44')](_0x1dda('0xad'),_0x3ad837[_0x1dda('0xaa')]['toString']())['where'](_0x1dda('0xae'))[_0x1dda('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1dda('0xa8')]()[_0x1dda('0x7e')](_0x1dda('0xb2'))['from'](_0x1dda('0xa2'))['where']('VoiceQueueId\x20=\x20?',_0x51df7c[_0x1dda('0x4f')]['id']['toString']())))['toString']();break;default:_0x31b098=squel[_0x1dda('0xa0')]()[_0x1dda('0xa1')](_0x1dda('0xa2'))[_0x1dda('0xa3')]([_0x1dda('0xa4'),_0x1dda('0xa5'),_0x1dda('0xa6'),_0x1dda('0xa7'),_0x1dda('0x65'),_0x1dda('0x5a'),_0x1dda('0x5b')],squel[_0x1dda('0xa8')]()['field'](_0x1dda('0xa4'),_0x1dda('0xa4'))[_0x1dda('0x7e')]('NOW()','scheduledAt')[_0x1dda('0x7e')]('id','ContactId')[_0x1dda('0x7e')](_0x3ad837[_0x1dda('0xaa')][_0x1dda('0x87')](),'ListId')[_0x1dda('0x7e')](_0x51df7c[_0x1dda('0x4f')]['id'][_0x1dda('0x87')](),_0x1dda('0x65'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5a'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5b'))[_0x1dda('0x80')](_0x1dda('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0x1dda('0x44')](_0x1dda('0xad'),_0x3ad837['CmListId'][_0x1dda('0x87')]())[_0x1dda('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x1dda('0x87')]();}_0x4e8e42['push'](db['sequelize'][_0x1dda('0x3b')](_0x31b098));}return BPromise[_0x1dda('0x98')](_0x4e8e42);}})[_0x1dda('0x26')](function(){return _0xdbbf2;})['then'](respondWithResult(_0x10bb21,null))['catch'](handleError(_0x10bb21,null));};exports[_0x1dda('0xb3')]=function(_0x130877,_0x129db5,_0x40f2e8){return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x130877[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x129db5,null))['then'](function(_0x2f2e63){if(_0x2f2e63){return _0x2f2e63[_0x1dda('0xb3')](_0x130877['query'][_0x1dda('0x7d')]);}})[_0x1dda('0x26')](function(_0x551c58){if(_0x551c58){return db[_0x1dda('0x63')][_0x1dda('0x27')]({'where':{'ListId':_0x130877[_0x1dda('0x3b')][_0x1dda('0x7d')],'VoiceQueueId':_0x130877[_0x1dda('0x4f')]['id']}})['then'](function(){return _0x551c58;});}})[_0x1dda('0x26')](respondWithStatusCode(_0x129db5,null))[_0x1dda('0x4d')](handleError(_0x129db5,null));};exports[_0x1dda('0xb4')]=function(_0x40289f,_0x4038ef,_0x2f855c){var _0x32fe24={};var _0x3cf54b={};var _0x5ec6b1;var _0x3117c4;return db[_0x1dda('0x48')][_0x1dda('0x61')]({'where':{'id':_0x40289f[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x4038ef,null))[_0x1dda('0x26')](function(_0x259ec3){if(_0x259ec3){_0x5ec6b1=_0x259ec3;_0x3cf54b['model']=_[_0x1dda('0x50')](db[_0x1dda('0xb5')][_0x1dda('0x37')]);_0x3cf54b[_0x1dda('0x3b')]=_[_0x1dda('0x50')](_0x40289f[_0x1dda('0x3b')]);_0x3cf54b[_0x1dda('0x3c')]=_[_0x1dda('0x3d')](_0x3cf54b[_0x1dda('0x3a')],_0x3cf54b[_0x1dda('0x3b')]);_0x32fe24['attributes']=_['intersection'](_0x3cf54b[_0x1dda('0x3a')],qs[_0x1dda('0x3f')](_0x40289f[_0x1dda('0x3b')][_0x1dda('0x3f')]));_0x32fe24[_0x1dda('0x3e')]=_0x32fe24[_0x1dda('0x3e')][_0x1dda('0x51')]?_0x32fe24[_0x1dda('0x3e')]:_0x3cf54b[_0x1dda('0x3a')];_0x32fe24[_0x1dda('0x62')]=qs['sort'](_0x40289f['query'][_0x1dda('0x43')]);_0x32fe24[_0x1dda('0x44')]=qs[_0x1dda('0x3c')](_[_0x1dda('0x45')](_0x40289f[_0x1dda('0x3b')],_0x3cf54b[_0x1dda('0x3c')]));if(_0x40289f[_0x1dda('0x3b')]['filter']){_0x32fe24[_0x1dda('0x44')]=_[_0x1dda('0x46')](_0x32fe24[_0x1dda('0x44')],{'$or':_[_0x1dda('0x36')](_0x32fe24[_0x1dda('0x3e')],function(_0x19ed49){var _0x454984={};_0x454984[_0x19ed49]={'$like':'%'+_0x40289f['query'][_0x1dda('0x2d')]+'%'};return _0x454984;})});}_0x32fe24=_[_0x1dda('0x46')]({},_0x32fe24,_0x40289f[_0x1dda('0x47')]);return _0x5ec6b1[_0x1dda('0xb4')](_0x32fe24);}})[_0x1dda('0x26')](function(_0x342bc4){if(_0x342bc4){_0x3117c4=_0x342bc4[_0x1dda('0x51')];if(!_0x40289f[_0x1dda('0x3b')][_0x1dda('0x40')](_0x1dda('0x41'))){_0x32fe24['limit']=qs[_0x1dda('0x42')](_0x40289f[_0x1dda('0x3b')][_0x1dda('0x42')]);_0x32fe24[_0x1dda('0x1e')]=qs[_0x1dda('0x1e')](_0x40289f[_0x1dda('0x3b')][_0x1dda('0x1e')]);}return _0x5ec6b1[_0x1dda('0xb4')](_0x32fe24);}})['then'](function(_0x31f31d){if(_0x31f31d){return _0x31f31d?{'count':_0x3117c4,'rows':_0x31f31d}:null;}})['then'](respondWithResult(_0x4038ef,null))[_0x1dda('0x4d')](handleError(_0x4038ef,null));};exports[_0x1dda('0xb6')]=function(_0xe13c30,_0x23294b,_0x2d6387){var _0x22f7a0,_0x3b4458;return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0xe13c30[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x23294b,null))[_0x1dda('0x26')](function(_0x56d34f){if(_0x56d34f){_0x3b4458=_0x56d34f;return _0x56d34f[_0x1dda('0xb6')](_0xe13c30[_0x1dda('0x5c')][_0x1dda('0x7d')],_['omit'](_0xe13c30[_0x1dda('0x5c')],['ids','id'])||{});}return null;})[_0x1dda('0x95')](function(_0x148cf0){var _0x216d4a;_0x22f7a0=_0x148cf0||[];var _0x5db9b4=[];if(_0x148cf0){for(var _0x3f25d2=0x0;_0x3f25d2<_0x148cf0[_0x1dda('0x51')];_0x3f25d2+=0x1){var _0x278bd1=_0x148cf0[_0x3f25d2][_0x1dda('0x28')]({'plain':!![]});_0x216d4a=squel[_0x1dda('0xa0')]()[_0x1dda('0xa1')]('cm_hopper_black')[_0x1dda('0xa3')]([_0x1dda('0xa4'),_0x1dda('0xa6'),_0x1dda('0xa7'),_0x1dda('0x65'),'createdAt',_0x1dda('0x5b')],squel['select']()[_0x1dda('0x7e')]('phone',_0x1dda('0xa4'))[_0x1dda('0x7e')]('id','ContactId')['field'](_0x278bd1[_0x1dda('0xaa')]['toString'](),'ListId')[_0x1dda('0x7e')](_0xe13c30['params']['id'][_0x1dda('0x87')](),'VoiceQueueId')[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5a'))[_0x1dda('0x7e')](_0x1dda('0xa9'),_0x1dda('0x5b'))[_0x1dda('0x80')]('cm_contacts')['where'](_0x1dda('0xac'))['where'](_0x1dda('0xad'),_0x278bd1[_0x1dda('0xaa')]['toString']())[_0x1dda('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5db9b4['push'](db[_0x1dda('0x74')][_0x1dda('0x3b')](_0x216d4a));}return BPromise[_0x1dda('0x98')](_0x5db9b4);}})[_0x1dda('0x26')](function(){return _0x22f7a0;})[_0x1dda('0x26')](respondWithResult(_0x23294b,null))['catch'](handleError(_0x23294b,null));};exports['removeBlackLists']=function(_0x413d28,_0x535a8e,_0x54726a){return db[_0x1dda('0x48')][_0x1dda('0x54')]({'where':{'id':_0x413d28['params']['id']}})[_0x1dda('0x26')](handleEntityNotFound(_0x535a8e,null))[_0x1dda('0x26')](function(_0x42b32f){if(_0x42b32f){return _0x42b32f[_0x1dda('0xb7')](_0x413d28[_0x1dda('0x3b')][_0x1dda('0x7d')]);}})[_0x1dda('0x26')](function(_0x1a0a46){if(_0x1a0a46){return db[_0x1dda('0x69')][_0x1dda('0x27')]({'where':{'ListId':_0x413d28[_0x1dda('0x3b')][_0x1dda('0x7d')],'VoiceQueueId':_0x413d28[_0x1dda('0x4f')]['id']}})[_0x1dda('0x26')](function(){return _0x1a0a46;});}})['then'](respondWithStatusCode(_0x535a8e,null))[_0x1dda('0x4d')](handleError(_0x535a8e,null));}; \ No newline at end of file +var _0x9d88=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','catch','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','VoiceQueues','params','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','flatMap','penalty','sequelize','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','all','union','compact','transaction','UserVoiceQueueRt','addAgents','omit','spread','isEmpty','online','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueue.socket','register','sendStatus'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9d88,0x9f));var _0x89d8=function(_0x2fafbf,_0x43253b){_0x2fafbf=_0x2fafbf-0x0;var _0x30a39d=_0x9d88[_0x2fafbf];return _0x30a39d;};'use strict';var emlformat=require(_0x89d8('0x0'));var rimraf=require(_0x89d8('0x1'));var zipdir=require(_0x89d8('0x2'));var jsonpatch=require(_0x89d8('0x3'));var rp=require(_0x89d8('0x4'));var moment=require(_0x89d8('0x5'));var BPromise=require(_0x89d8('0x6'));var Mustache=require(_0x89d8('0x7'));var util=require(_0x89d8('0x8'));var path=require(_0x89d8('0x9'));var sox=require(_0x89d8('0xa'));var csv=require('to-csv');var ejs=require(_0x89d8('0xb'));var fs=require('fs');var fs_extra=require(_0x89d8('0xc'));var _=require(_0x89d8('0xd'));var squel=require(_0x89d8('0xe'));var crypto=require(_0x89d8('0xf'));var jsforce=require(_0x89d8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89d8('0x11'));var Redis=require(_0x89d8('0x12'));var authService=require(_0x89d8('0x13'));var qs=require(_0x89d8('0x14'));var as=require(_0x89d8('0x15'));var hardwareService=require(_0x89d8('0x16'));var logger=require(_0x89d8('0x17'))(_0x89d8('0x18'));var utils=require('../../config/utils');var config=require(_0x89d8('0x19'));var licenseUtil=require(_0x89d8('0x1a'));var db=require(_0x89d8('0x1b'))['db'];config['redis']=_[_0x89d8('0x1c')](config[_0x89d8('0x1d')],{'host':_0x89d8('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89d8('0x1d')]));require(_0x89d8('0x1f'))[_0x89d8('0x20')](socket);function respondWithStatusCode(_0x176d2a,_0x3ce471){_0x3ce471=_0x3ce471||0xcc;return function(_0x6d6702){if(_0x6d6702){return _0x176d2a[_0x89d8('0x21')](_0x3ce471);}return _0x176d2a[_0x89d8('0x22')](_0x3ce471)[_0x89d8('0x23')]();};}function respondWithResult(_0x59ba6b,_0x16f309){_0x16f309=_0x16f309||0xc8;return function(_0x31f1b8){if(_0x31f1b8){return _0x59ba6b[_0x89d8('0x22')](_0x16f309)[_0x89d8('0x24')](_0x31f1b8);}};}function respondWithFilteredResult(_0x194eac,_0xda9ac4){return function(_0x56a678){if(_0x56a678){var _0x480297=typeof _0xda9ac4[_0x89d8('0x25')]===_0x89d8('0x26')&&typeof _0xda9ac4[_0x89d8('0x27')]===_0x89d8('0x26');var _0x26179c=_0x56a678['count'];var _0x55b3dc=_0x480297?0x0:_0xda9ac4[_0x89d8('0x25')];var _0x7dc15a=_0x480297?_0x56a678[_0x89d8('0x28')]:_0xda9ac4[_0x89d8('0x25')]+_0xda9ac4['limit'];var _0x3528cd;if(_0x7dc15a>=_0x26179c){_0x7dc15a=_0x26179c;_0x3528cd=0xc8;}else{_0x3528cd=0xce;}_0x194eac[_0x89d8('0x22')](_0x3528cd);return _0x194eac['set'](_0x89d8('0x29'),_0x55b3dc+'-'+_0x7dc15a+'/'+_0x26179c)[_0x89d8('0x24')](_0x56a678);}return null;};}function patchUpdates(_0x5e89cc){return function(_0x5dae71){try{jsonpatch[_0x89d8('0x2a')](_0x5dae71,_0x5e89cc,!![]);}catch(_0x1c266e){return BPromise[_0x89d8('0x2b')](_0x1c266e);}return _0x5dae71[_0x89d8('0x2c')]();};}function saveUpdates(_0x3e40a6,_0x2ea9da){return function(_0x37f738){if(_0x37f738){return _0x37f738[_0x89d8('0x2d')](_0x3e40a6)[_0x89d8('0x2e')](function(_0x42e943){return _0x42e943;});}return null;};}function removeEntity(_0x1e7551,_0x135cf3){return function(_0xfb111c){if(_0xfb111c){return _0xfb111c[_0x89d8('0x2f')]()['then'](function(){var _0x57dd27=_0xfb111c[_0x89d8('0x30')]({'plain':!![]});var _0x18a665=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x89d8('0x31'),'value':_0x89d8('0x32'),'ignore':![]}];var _0x27c330=_(_0x18a665)[_0x89d8('0x33')](_0x89d8('0x34'))[_0x89d8('0x35')](_0x89d8('0x36'))[_0x89d8('0x36')]();if(_[_0x89d8('0x37')](_0x27c330,_0x57dd27[_0x89d8('0x38')])){return;}var _0x2848b6=_[_0x89d8('0x39')](_0x18a665,[_0x89d8('0x36'),_0x57dd27[_0x89d8('0x38')]])[_0x89d8('0x3a')];return db[_0x89d8('0x3b')][_0x89d8('0x2f')]({'where':{'type':_0x2848b6,'resourceId':_0x57dd27['id']}})['then'](function(){return _0xfb111c;});})['then'](function(){_0x1e7551[_0x89d8('0x22')](0xcc)[_0x89d8('0x23')]();});}};}function handleEntityNotFound(_0x58e33c,_0x242145){return function(_0x49b6cd){if(!_0x49b6cd){_0x58e33c[_0x89d8('0x21')](0x194);}return _0x49b6cd;};}function handleError(_0x68f91c,_0x473953){_0x473953=_0x473953||0x1f4;return function(_0x49999c){logger[_0x89d8('0x3c')](_0x49999c[_0x89d8('0x3d')]);if(_0x49999c[_0x89d8('0x3a')]){delete _0x49999c[_0x89d8('0x3a')];}_0x68f91c[_0x89d8('0x22')](_0x473953)[_0x89d8('0x3e')](_0x49999c);};}exports[_0x89d8('0x3f')]=function(_0x2f5ee5,_0x43c843){var _0x42c218={},_0x47980f={},_0x1c5942={'count':0x0,'rows':[]};var _0x289139=_[_0x89d8('0x35')](db[_0x89d8('0x40')][_0x89d8('0x41')],function(_0x5a10f8){return{'name':_0x5a10f8[_0x89d8('0x42')],'type':_0x5a10f8[_0x89d8('0x38')][_0x89d8('0x43')]};});_0x47980f[_0x89d8('0x44')]=_['map'](_0x289139,_0x89d8('0x3a'));_0x47980f[_0x89d8('0x45')]=_[_0x89d8('0x46')](_0x2f5ee5[_0x89d8('0x45')]);_0x47980f['filters']=_[_0x89d8('0x47')](_0x47980f[_0x89d8('0x44')],_0x47980f[_0x89d8('0x45')]);_0x42c218[_0x89d8('0x48')]=_['intersection'](_0x47980f[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0x2f5ee5[_0x89d8('0x45')]['fields']));_0x42c218['attributes']=_0x42c218[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x42c218[_0x89d8('0x48')]:_0x47980f[_0x89d8('0x44')];if(!_0x2f5ee5[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x42c218[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x2f5ee5[_0x89d8('0x45')][_0x89d8('0x27')]);_0x42c218[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0x2f5ee5[_0x89d8('0x45')][_0x89d8('0x25')]);}_0x42c218[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x2f5ee5[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x42c218[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x2f5ee5[_0x89d8('0x45')],_0x47980f[_0x89d8('0x50')]),_0x289139);if(_0x2f5ee5['query'][_0x89d8('0x33')]){_0x42c218[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x42c218['where'],{'$or':_[_0x89d8('0x35')](_0x289139,function(_0x383e12){if(_0x383e12[_0x89d8('0x38')]!==_0x89d8('0x53')){var _0x3cb8f9={};_0x3cb8f9[_0x383e12[_0x89d8('0x3a')]]={'$like':'%'+_0x2f5ee5[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0x3cb8f9;}})});}_0x42c218=_['merge']({},_0x42c218,_0x2f5ee5[_0x89d8('0x54')]);var _0x46bc2f={'where':_0x42c218[_0x89d8('0x4f')]};return db[_0x89d8('0x40')][_0x89d8('0x28')](_0x46bc2f)[_0x89d8('0x2e')](function(_0x371e8f){_0x1c5942[_0x89d8('0x28')]=_0x371e8f;if(_0x2f5ee5['query'][_0x89d8('0x55')]){_0x42c218['include']=[{'all':!![]}];}return db[_0x89d8('0x40')][_0x89d8('0x56')](_0x42c218);})[_0x89d8('0x2e')](function(_0x3f5efe){_0x1c5942['rows']=_0x3f5efe;return _0x1c5942;})[_0x89d8('0x2e')](respondWithFilteredResult(_0x43c843,_0x42c218))[_0x89d8('0x57')](handleError(_0x43c843,null));};exports['show']=function(_0x4d1db0,_0x5dd720){var _0x4f8050={'raw':![],'where':{'id':_0x4d1db0['params']['id']}},_0x5e2128={};_0x5e2128[_0x89d8('0x44')]=_[_0x89d8('0x46')](db[_0x89d8('0x40')][_0x89d8('0x41')]);_0x5e2128['query']=_[_0x89d8('0x46')](_0x4d1db0[_0x89d8('0x45')]);_0x5e2128[_0x89d8('0x50')]=_['intersection'](_0x5e2128['model'],_0x5e2128[_0x89d8('0x45')]);_0x4f8050[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x5e2128['model'],qs[_0x89d8('0x49')](_0x4d1db0['query'][_0x89d8('0x49')]));_0x4f8050[_0x89d8('0x48')]=_0x4f8050[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x4f8050[_0x89d8('0x48')]:_0x5e2128[_0x89d8('0x44')];if(_0x4d1db0[_0x89d8('0x45')][_0x89d8('0x55')]){_0x4f8050[_0x89d8('0x58')]=[{'all':!![]}];}_0x4f8050=_[_0x89d8('0x52')]({},_0x4f8050,_0x4d1db0[_0x89d8('0x54')]);return db[_0x89d8('0x40')][_0x89d8('0x39')](_0x4f8050)[_0x89d8('0x2e')](handleEntityNotFound(_0x5dd720,null))['then'](respondWithResult(_0x5dd720,null))['catch'](handleError(_0x5dd720,null));};exports['create']=function(_0xa3e659,_0x3654af){return db['VoiceQueue'][_0x89d8('0x59')](_0xa3e659[_0x89d8('0x5a')],{})[_0x89d8('0x2e')](function(_0x57d719){var _0x59b4f3=_0xa3e659['user'][_0x89d8('0x30')]({'plain':!![]});if(!_0x59b4f3)throw new Error(_0x89d8('0x5b'));if(_0x59b4f3[_0x89d8('0x5c')]===_0x89d8('0x5d')){var _0x36fea8=_0x57d719[_0x89d8('0x30')]({'plain':!![]});var _0x10f833=[{'name':'VoiceQueues','value':_0x89d8('0x5e')},{'name':_0x89d8('0x31'),'value':_0x89d8('0x32')}];var _0x3d9766=_[_0x89d8('0x39')](_0x10f833,[_0x89d8('0x36'),_0x36fea8[_0x89d8('0x38')]])['name'];return db[_0x89d8('0x5f')][_0x89d8('0x39')]({'where':{'name':_0x3d9766,'userProfileId':_0x59b4f3[_0x89d8('0x60')]},'raw':!![]})[_0x89d8('0x2e')](function(_0x46dd42){if(_0x46dd42&&_0x46dd42[_0x89d8('0x61')]===0x0){return db['UserProfileResource'][_0x89d8('0x59')]({'name':_0x36fea8[_0x89d8('0x3a')],'resourceId':_0x36fea8['id'],'type':_0x46dd42['name'],'sectionId':_0x46dd42['id']},{})[_0x89d8('0x2e')](function(){return _0x57d719;});}else{return _0x57d719;}})['catch'](function(_0x23c77f){logger[_0x89d8('0x3c')](_0x89d8('0x62'),_0x23c77f);throw _0x23c77f;});}return _0x57d719;})[_0x89d8('0x2e')](respondWithResult(_0x3654af,0xc9))[_0x89d8('0x57')](handleError(_0x3654af,null));};exports['clone']=function(_0x359fda,_0x3ba832){var _0x5e5b95={'where':{'id':_0x359fda['params']['id']}},_0x1a9121={};_0x1a9121['model']=_['keys'](db[_0x89d8('0x40')]['rawAttributes']);_0x5e5b95[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x1a9121[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0x359fda['query'][_0x89d8('0x49')]));_0x5e5b95[_0x89d8('0x48')]=_0x5e5b95[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x5e5b95['attributes']:_0x1a9121[_0x89d8('0x44')];if(_0x359fda[_0x89d8('0x45')][_0x89d8('0x55')]){_0x5e5b95[_0x89d8('0x58')]=[{'all':!![]}];}_0x5e5b95=_['merge']({},_0x5e5b95,_0x359fda['options']);return db['VoiceQueue'][_0x89d8('0x39')](_0x5e5b95)[_0x89d8('0x2e')](handleEntityNotFound(_0x3ba832,null))[_0x89d8('0x2e')](function(_0x5bfc2b){if(_0x5bfc2b){var _0x319137=_0x5bfc2b[_0x89d8('0x30')]({'plain':!![]});_0x319137=qs['omit'](_0x319137,['id',_0x89d8('0x63'),'updatedAt']);_0x359fda['body']=_['omit'](_0x359fda[_0x89d8('0x5a')],['id',_0x89d8('0x63'),_0x89d8('0x64')]);return db[_0x89d8('0x40')][_0x89d8('0x59')](_[_0x89d8('0x52')](_0x319137,_0x359fda[_0x89d8('0x5a')]),{'include':_0x359fda['query'][_0x89d8('0x55')]?[{'all':!![]}]:undefined})['then'](function(_0x1593e4){var _0x56a8ae=_0x359fda[_0x89d8('0x5d')][_0x89d8('0x30')]({'plain':!![]});if(!_0x56a8ae)throw new Error(_0x89d8('0x5b'));if(_0x56a8ae['role']===_0x89d8('0x5d')){var _0x4f7f2c=_0x1593e4[_0x89d8('0x30')]({'plain':!![]});var _0x58cc7f=[{'name':_0x89d8('0x65'),'value':_0x89d8('0x5e')},{'name':_0x89d8('0x31'),'value':_0x89d8('0x32')}];var _0x2f4287=_[_0x89d8('0x39')](_0x58cc7f,[_0x89d8('0x36'),_0x4f7f2c['type']])[_0x89d8('0x3a')];return db[_0x89d8('0x5f')][_0x89d8('0x39')]({'where':{'name':_0x2f4287,'userProfileId':_0x56a8ae['userProfileId']},'raw':!![]})[_0x89d8('0x2e')](function(_0x15d1f8){if(_0x15d1f8&&_0x15d1f8[_0x89d8('0x61')]===0x0){return db['UserProfileResource'][_0x89d8('0x59')]({'name':_0x4f7f2c[_0x89d8('0x3a')],'resourceId':_0x4f7f2c['id'],'type':_0x15d1f8[_0x89d8('0x3a')],'sectionId':_0x15d1f8['id']},{})[_0x89d8('0x2e')](function(){return _0x1593e4;});}else{return _0x1593e4;}})[_0x89d8('0x57')](function(_0x131681){logger[_0x89d8('0x3c')](_0x89d8('0x62'),_0x131681);throw _0x131681;});}return _0x1593e4;});}})[_0x89d8('0x2e')](respondWithResult(_0x3ba832,0xc9))[_0x89d8('0x57')](handleError(_0x3ba832,null));};exports['update']=function(_0x3574fa,_0x5a45eb){if(_0x3574fa[_0x89d8('0x5a')]['id']){delete _0x3574fa['body']['id'];}return db[_0x89d8('0x40')]['find']({'where':{'id':_0x3574fa[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x5a45eb,null))[_0x89d8('0x2e')](saveUpdates(_0x3574fa[_0x89d8('0x5a')],null))[_0x89d8('0x2e')](respondWithResult(_0x5a45eb,null))[_0x89d8('0x57')](handleError(_0x5a45eb,null));};exports['destroy']=function(_0x4d3a2f,_0x32abf5){return db['VoiceQueue'][_0x89d8('0x39')]({'where':{'id':_0x4d3a2f[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x32abf5,null))[_0x89d8('0x2e')](removeEntity(_0x32abf5,null))[_0x89d8('0x57')](handleError(_0x32abf5,null));};exports[_0x89d8('0x67')]=function(_0x4fe1aa,_0x26d3ef,_0x8a841d){var _0x45c5e3={'raw':![],'where':{}};var _0x515cf3={};var _0x451a53={'count':0x0,'rows':[]};return db[_0x89d8('0x40')][_0x89d8('0x68')]({'where':{'id':_0x4fe1aa[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x26d3ef,null))[_0x89d8('0x2e')](function(_0x204965){if(_0x204965){_0x515cf3['model']=_['keys'](db[_0x89d8('0x69')][_0x89d8('0x41')]);_0x515cf3['query']=_[_0x89d8('0x46')](_0x4fe1aa[_0x89d8('0x45')]);_0x515cf3[_0x89d8('0x50')]=_['intersection'](_0x515cf3[_0x89d8('0x44')],_0x515cf3[_0x89d8('0x45')]);_0x45c5e3[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x515cf3[_0x89d8('0x44')],qs['fields'](_0x4fe1aa[_0x89d8('0x45')]['fields']));_0x45c5e3['attributes']=_0x45c5e3['attributes'][_0x89d8('0x4a')]?_0x45c5e3[_0x89d8('0x48')]:_0x515cf3['model'];if(!_0x4fe1aa[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x45c5e3[_0x89d8('0x27')]=qs['limit'](_0x4fe1aa['query'][_0x89d8('0x27')]);_0x45c5e3['offset']=qs[_0x89d8('0x25')](_0x4fe1aa[_0x89d8('0x45')][_0x89d8('0x25')]);}_0x45c5e3[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x4fe1aa[_0x89d8('0x45')]['sort']);_0x45c5e3[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x4fe1aa[_0x89d8('0x45')],_0x515cf3[_0x89d8('0x50')]));_0x45c5e3[_0x89d8('0x4f')][_0x89d8('0x6a')]=_0x204965['id'];if(_0x4fe1aa[_0x89d8('0x45')][_0x89d8('0x33')]){_0x45c5e3[_0x89d8('0x4f')]=_['merge'](_0x45c5e3[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x45c5e3[_0x89d8('0x48')],function(_0x4555a1){var _0x5b467={};_0x5b467[_0x4555a1]={'$like':'%'+_0x4fe1aa[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0x5b467;})});}_0x45c5e3=_['merge']({},_0x45c5e3,_0x4fe1aa['options']);return db['CmHopper']['count']({'where':_0x45c5e3[_0x89d8('0x4f')]})['then'](function(_0x1da547){_0x451a53['count']=_0x1da547;if(_0x4fe1aa[_0x89d8('0x45')][_0x89d8('0x55')]){_0x45c5e3[_0x89d8('0x58')]=[{'all':!![]}];}return db['CmHopper'][_0x89d8('0x56')](_0x45c5e3);})['then'](function(_0x3ec495){_0x451a53[_0x89d8('0x6b')]=_0x3ec495;return _0x451a53;});}})[_0x89d8('0x2e')](respondWithFilteredResult(_0x26d3ef,_0x45c5e3))[_0x89d8('0x57')](handleError(_0x26d3ef,null));};exports[_0x89d8('0x6c')]=function(_0xa4821f,_0x333a31,_0x2fdbb8){var _0x507635={'raw':!![],'where':{}};var _0x555e28={};var _0x42f53c={'count':0x0,'rows':[]};return db[_0x89d8('0x40')]['findOne']({'where':{'id':_0xa4821f[_0x89d8('0x66')]['id']}})['then'](handleEntityNotFound(_0x333a31,null))[_0x89d8('0x2e')](function(_0x52fa98){if(_0x52fa98){_0x555e28[_0x89d8('0x44')]=_[_0x89d8('0x46')](db[_0x89d8('0x6d')]['rawAttributes']);_0x555e28[_0x89d8('0x45')]=_['keys'](_0xa4821f['query']);_0x555e28['filters']=_['intersection'](_0x555e28[_0x89d8('0x44')],_0x555e28['query']);_0x507635[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x555e28[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0xa4821f[_0x89d8('0x45')][_0x89d8('0x49')]));_0x507635['attributes']=_0x507635[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x507635['attributes']:_0x555e28['model'];if(!_0xa4821f['query'][_0x89d8('0x4b')]('nolimit')){_0x507635['limit']=qs[_0x89d8('0x27')](_0xa4821f[_0x89d8('0x45')][_0x89d8('0x27')]);_0x507635[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0xa4821f['query'][_0x89d8('0x25')]);}_0x507635[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0xa4821f[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x507635[_0x89d8('0x4f')]=qs['filters'](_[_0x89d8('0x51')](_0xa4821f[_0x89d8('0x45')],_0x555e28[_0x89d8('0x50')]));_0x507635[_0x89d8('0x4f')][_0x89d8('0x6a')]=_0x52fa98['id'];if(_0xa4821f[_0x89d8('0x45')][_0x89d8('0x33')]){_0x507635[_0x89d8('0x4f')]=_['merge'](_0x507635['where'],{'$or':_[_0x89d8('0x35')](_0x507635[_0x89d8('0x48')],function(_0x300de9){var _0xb34f52={};_0xb34f52[_0x300de9]={'$like':'%'+_0xa4821f[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0xb34f52;})});}_0x507635=_[_0x89d8('0x52')]({},_0x507635,_0xa4821f[_0x89d8('0x54')]);return db[_0x89d8('0x6d')][_0x89d8('0x28')]({'where':_0x507635['where']})[_0x89d8('0x2e')](function(_0x213e7c){_0x42f53c[_0x89d8('0x28')]=_0x213e7c;if(_0xa4821f[_0x89d8('0x45')][_0x89d8('0x55')]){_0x507635[_0x89d8('0x58')]=[{'all':!![]}];}return db[_0x89d8('0x6d')][_0x89d8('0x56')](_0x507635);})[_0x89d8('0x2e')](function(_0x4f2dee){_0x42f53c['rows']=_0x4f2dee;return _0x42f53c;});}})[_0x89d8('0x2e')](respondWithFilteredResult(_0x333a31,_0x507635))[_0x89d8('0x57')](handleError(_0x333a31,null));};exports[_0x89d8('0x6e')]=function(_0x48c2ae,_0x34ee72,_0x21aa64){var _0x5be2e4={'raw':!![],'where':{}};var _0x230cdc={};var _0xec93d4={'count':0x0,'rows':[]};return db[_0x89d8('0x40')][_0x89d8('0x68')]({'where':{'id':_0x48c2ae[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x34ee72,null))[_0x89d8('0x2e')](function(_0x1949aa){if(_0x1949aa){_0x230cdc[_0x89d8('0x44')]=_[_0x89d8('0x46')](db[_0x89d8('0x6f')][_0x89d8('0x41')]);_0x230cdc[_0x89d8('0x45')]=_[_0x89d8('0x46')](_0x48c2ae[_0x89d8('0x45')]);_0x230cdc['filters']=_[_0x89d8('0x47')](_0x230cdc[_0x89d8('0x44')],_0x230cdc[_0x89d8('0x45')]);_0x5be2e4[_0x89d8('0x48')]=_['intersection'](_0x230cdc[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0x48c2ae[_0x89d8('0x45')][_0x89d8('0x49')]));_0x5be2e4[_0x89d8('0x48')]=_0x5be2e4['attributes'][_0x89d8('0x4a')]?_0x5be2e4[_0x89d8('0x48')]:_0x230cdc[_0x89d8('0x44')];if(!_0x48c2ae[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x5be2e4[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x48c2ae['query']['limit']);_0x5be2e4[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0x48c2ae[_0x89d8('0x45')]['offset']);}_0x5be2e4[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x48c2ae[_0x89d8('0x45')]['sort']);_0x5be2e4[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x48c2ae[_0x89d8('0x45')],_0x230cdc[_0x89d8('0x50')]));_0x5be2e4[_0x89d8('0x4f')][_0x89d8('0x6a')]=_0x1949aa['id'];if(_0x48c2ae[_0x89d8('0x45')][_0x89d8('0x33')]){_0x5be2e4[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x5be2e4[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x5be2e4[_0x89d8('0x48')],function(_0x576746){var _0x2f2d4b={};_0x2f2d4b[_0x576746]={'$like':'%'+_0x48c2ae[_0x89d8('0x45')]['filter']+'%'};return _0x2f2d4b;})});}_0x5be2e4=_[_0x89d8('0x52')]({},_0x5be2e4,_0x48c2ae[_0x89d8('0x54')]);return db[_0x89d8('0x6f')][_0x89d8('0x28')]({'where':_0x5be2e4[_0x89d8('0x4f')]})['then'](function(_0x1bd4f3){_0xec93d4[_0x89d8('0x28')]=_0x1bd4f3;if(_0x48c2ae['query'][_0x89d8('0x55')]){_0x5be2e4[_0x89d8('0x58')]=[{'all':!![]}];}return db[_0x89d8('0x6f')][_0x89d8('0x56')](_0x5be2e4);})[_0x89d8('0x2e')](function(_0x286f32){_0xec93d4[_0x89d8('0x6b')]=_0x286f32;return _0xec93d4;});}})[_0x89d8('0x2e')](respondWithFilteredResult(_0x34ee72,_0x5be2e4))[_0x89d8('0x57')](handleError(_0x34ee72,null));};exports['getHopperBlacks']=function(_0xc48233,_0x53b7df,_0x5453ee){var _0x5e85ee={'raw':!![],'where':{}};var _0x6285ef={};var _0x3a8e65={'count':0x0,'rows':[]};return db[_0x89d8('0x40')][_0x89d8('0x68')]({'where':{'id':_0xc48233[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x53b7df,null))[_0x89d8('0x2e')](function(_0x2becf4){if(_0x2becf4){_0x6285ef[_0x89d8('0x44')]=_[_0x89d8('0x46')](db['CmHopperBlack'][_0x89d8('0x41')]);_0x6285ef['query']=_['keys'](_0xc48233[_0x89d8('0x45')]);_0x6285ef[_0x89d8('0x50')]=_['intersection'](_0x6285ef['model'],_0x6285ef[_0x89d8('0x45')]);_0x5e85ee['attributes']=_[_0x89d8('0x47')](_0x6285ef[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0xc48233[_0x89d8('0x45')][_0x89d8('0x49')]));_0x5e85ee[_0x89d8('0x48')]=_0x5e85ee[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x5e85ee[_0x89d8('0x48')]:_0x6285ef[_0x89d8('0x44')];if(!_0xc48233[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x5e85ee[_0x89d8('0x27')]=qs['limit'](_0xc48233['query']['limit']);_0x5e85ee[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0xc48233[_0x89d8('0x45')][_0x89d8('0x25')]);}_0x5e85ee[_0x89d8('0x4d')]=qs['sort'](_0xc48233[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x5e85ee[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0xc48233[_0x89d8('0x45')],_0x6285ef[_0x89d8('0x50')]));_0x5e85ee[_0x89d8('0x4f')]['VoiceQueueId']=_0x2becf4['id'];if(_0xc48233[_0x89d8('0x45')][_0x89d8('0x33')]){_0x5e85ee['where']=_[_0x89d8('0x52')](_0x5e85ee[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x5e85ee[_0x89d8('0x48')],function(_0x4d7cee){var _0x44941d={};_0x44941d[_0x4d7cee]={'$like':'%'+_0xc48233[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0x44941d;})});}_0x5e85ee=_[_0x89d8('0x52')]({},_0x5e85ee,_0xc48233[_0x89d8('0x54')]);return db['CmHopperBlack'][_0x89d8('0x28')]({'where':_0x5e85ee[_0x89d8('0x4f')]})[_0x89d8('0x2e')](function(_0x23f80b){_0x3a8e65[_0x89d8('0x28')]=_0x23f80b;if(_0xc48233[_0x89d8('0x45')][_0x89d8('0x55')]){_0x5e85ee[_0x89d8('0x58')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x89d8('0x56')](_0x5e85ee);})[_0x89d8('0x2e')](function(_0x1f59d8){_0x3a8e65[_0x89d8('0x6b')]=_0x1f59d8;return _0x3a8e65;});}})[_0x89d8('0x2e')](respondWithFilteredResult(_0x53b7df,_0x5e85ee))[_0x89d8('0x57')](handleError(_0x53b7df,null));};exports[_0x89d8('0x70')]=function(_0x5c5c94,_0x5b173f,_0x3b05f1){var _0x5e081a={};var _0x16c0c0={};var _0xad34c6;var _0x5b837a;return db[_0x89d8('0x40')][_0x89d8('0x68')]({'where':{'id':_0x5c5c94[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x5b173f,null))['then'](function(_0x455f7d){if(_0x455f7d){_0xad34c6=_0x455f7d;_0x16c0c0[_0x89d8('0x44')]=_['keys'](db['Team']['rawAttributes']);_0x16c0c0['query']=_['keys'](_0x5c5c94[_0x89d8('0x45')]);_0x16c0c0[_0x89d8('0x50')]=_[_0x89d8('0x47')](_0x16c0c0[_0x89d8('0x44')],_0x16c0c0[_0x89d8('0x45')]);_0x5e081a[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x16c0c0[_0x89d8('0x44')],qs['fields'](_0x5c5c94[_0x89d8('0x45')][_0x89d8('0x49')]));_0x5e081a['attributes']=_0x5e081a[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x5e081a[_0x89d8('0x48')]:_0x16c0c0['model'];_0x5e081a[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x5c5c94['query'][_0x89d8('0x4e')]);_0x5e081a['where']=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x5c5c94[_0x89d8('0x45')],_0x16c0c0['filters']));if(_0x5c5c94['query'][_0x89d8('0x33')]){_0x5e081a[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x5e081a[_0x89d8('0x4f')],{'$or':_['map'](_0x5e081a[_0x89d8('0x48')],function(_0x185a91){var _0x39e9e6={};_0x39e9e6[_0x185a91]={'$like':'%'+_0x5c5c94['query'][_0x89d8('0x33')]+'%'};return _0x39e9e6;})});}_0x5e081a=_[_0x89d8('0x52')]({},_0x5e081a,_0x5c5c94[_0x89d8('0x54')]);return _0xad34c6[_0x89d8('0x70')](_0x5e081a);}})[_0x89d8('0x2e')](function(_0x32f8fe){if(_0x32f8fe){_0x5b837a=_0x32f8fe[_0x89d8('0x4a')];if(!_0x5c5c94[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x5e081a[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x5c5c94[_0x89d8('0x45')][_0x89d8('0x27')]);_0x5e081a[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0x5c5c94[_0x89d8('0x45')][_0x89d8('0x25')]);}return _0xad34c6[_0x89d8('0x70')](_0x5e081a);}})[_0x89d8('0x2e')](function(_0x3d0146){if(_0x3d0146){return _0x3d0146?{'count':_0x5b837a,'rows':_0x3d0146}:null;}})[_0x89d8('0x2e')](respondWithResult(_0x5b173f,null))['catch'](handleError(_0x5b173f,null));};exports[_0x89d8('0x71')]=function(_0x1e8ac6,_0x3cc276,_0x57b3e9){var _0x23fea1=_0x1e8ac6['body'][_0x89d8('0x72')];var _0x5de76c=_['map'](_0x23fea1,'id');return db[_0x89d8('0x73')][_0x89d8('0x56')]({'where':{'id':_0x5de76c},'attributes':['id'],'include':[{'model':db[_0x89d8('0x74')],'as':_0x89d8('0x75'),'attributes':['id',_0x89d8('0x3a'),'online',_0x89d8('0x76'),_0x89d8('0x77')],'raw':!![]}]})['then'](function(_0x4546d6){if(_0x4546d6){var _0x110350=_[_0x89d8('0x78')](_0x4546d6,function(_0x3a23d7){var _0x537ad6=_0x3a23d7[_0x89d8('0x30')]({'plain':!![]});_0x537ad6[_0x89d8('0x75')]['forEach'](function(_0x19685f){_0x19685f[_0x89d8('0x79')]=_[_0x89d8('0x39')](_0x23fea1,{'id':_0x537ad6['id']})[_0x89d8('0x79')];});return _0x537ad6[_0x89d8('0x75')];});return db[_0x89d8('0x40')][_0x89d8('0x39')]({'where':{'id':_0x1e8ac6[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](function(_0x23d125){return db[_0x89d8('0x7a')]['transaction'](function(_0x22049d){return _0x23d125[_0x89d8('0x71')](_0x5de76c,{'transaction':_0x22049d})[_0x89d8('0x2e')](function(){return BPromise[_0x89d8('0x7b')](_0x23fea1,function(_0x85b9ea){return db[_0x89d8('0x7c')]['upsert']({'TeamId':_0x85b9ea['id'],'VoiceQueueId':_0x1e8ac6[_0x89d8('0x66')]['id'],'penalty':_0x85b9ea[_0x89d8('0x79')]},{'transaction':_0x22049d});});})['then'](function(){return BPromise[_0x89d8('0x7b')](_0x110350,function(_0x598855){return db[_0x89d8('0x7d')][_0x89d8('0x7e')]({'where':{'UserId':_0x598855['id'],'VoiceQueueId':_0x1e8ac6[_0x89d8('0x66')]['id']},'defaults':{'penalty':_0x598855[_0x89d8('0x79')]},'transaction':_0x22049d});});})[_0x89d8('0x2e')](function(){return BPromise[_0x89d8('0x7b')](_[_0x89d8('0x33')](_0x110350,{'online':!![]}),function(_0x28f750){return db['UserVoiceQueueRt'][_0x89d8('0x7f')]({'membername':_0x28f750[_0x89d8('0x3a')],'UserId':_0x28f750['id'],'queue_name':_0x23d125['name'],'VoiceQueueId':_0x23d125['id'],'interface':_[_0x89d8('0x80')](_0x28f750['interface'])?util['format'](_0x89d8('0x81'),_0x28f750['name']):_0x28f750[_0x89d8('0x77')],'paused':_0x28f750[_0x89d8('0x76')]||![],'penalty':_0x28f750[_0x89d8('0x79')]},{'transaction':_0x22049d});});})['then'](function(){_0x110350[_0x89d8('0x82')](function(_0x8bbada){socket[_0x89d8('0x83')](_0x89d8('0x84'),{'UserId':_0x8bbada['id'],'VoiceQueueId':_0x23d125['id']});});});});});}})['then'](respondWithStatusCode(_0x3cc276,null))[_0x89d8('0x57')](handleError(_0x3cc276,null));};exports[_0x89d8('0x85')]=function(_0x5b402d,_0x40532d,_0x4cfacf){return db[_0x89d8('0x73')][_0x89d8('0x56')]({'where':{'id':_0x5b402d[_0x89d8('0x45')][_0x89d8('0x86')]},'attributes':['id'],'include':[{'model':db[_0x89d8('0x74')],'as':_0x89d8('0x75'),'attributes':['id'],'raw':!![]}]})[_0x89d8('0x2e')](handleEntityNotFound(_0x40532d,null))['then'](function(_0x4b9385){var _0x1ad0c6=_[_0x89d8('0x35')](_0x4b9385,'id');var _0x8c61f2=[];var _0x3ffe9a=[];var _0x435251=squel['select']();_0x435251[_0x89d8('0x87')](_0x89d8('0x88'))[_0x89d8('0x89')](_0x89d8('0x8a'),'tq')['join'](_0x89d8('0x8b'),'ut',_0x89d8('0x8c'))['where'](_0x89d8('0x8d'),_0x5b402d[_0x89d8('0x66')]['id']);for(var _0x1c731e=0x0;_0x1c731e<_0x4b9385[_0x89d8('0x4a')];_0x1c731e+=0x1){let _0x4f48cf=_0x4b9385[_0x1c731e];for(var _0x26028b=0x0;_0x26028b<_0x4f48cf[_0x89d8('0x75')]['length'];_0x26028b+=0x1){let _0x29aa96=_0x4f48cf[_0x89d8('0x75')][_0x26028b];var _0xa907c5=_0x435251[_0x89d8('0x8e')]();_0xa907c5['where'](_0x89d8('0x8f'),_0x29aa96['id']);_0x3ffe9a[_0x89d8('0x90')](db[_0x89d8('0x7a')][_0x89d8('0x45')](_0xa907c5[_0x89d8('0x91')](),{'type':db[_0x89d8('0x7a')]['QueryTypes']['SELECT']})[_0x89d8('0x2e')](function(_0x54d805){if(_0x54d805['length']===0x1){return _0x29aa96['id'];}else{var _0x381f5d=_[_0x89d8('0x92')](_['map'](_0x54d805,'TeamId'),function(_0x83ed7d){return _[_0x89d8('0x37')](_0x1ad0c6,_0x83ed7d);});if(_0x381f5d){return _0x29aa96['id'];}}}));}}return BPromise[_0x89d8('0x93')](_0x3ffe9a)['then'](function(_0x38c218){_0x8c61f2=_(_0x8c61f2)[_0x89d8('0x94')](_0x38c218)[_0x89d8('0x95')]()[_0x89d8('0x36')]();return db['VoiceQueue']['find']({'where':{'id':_0x5b402d['params']['id']}})['then'](function(_0x5b9f06){return db[_0x89d8('0x7a')][_0x89d8('0x96')](function(_0x121816){return _0x5b9f06['removeTeams'](_0x5b402d['query']['ids'],{'transaction':_0x121816})[_0x89d8('0x2e')](function(){if(!_['isEmpty'](_0x8c61f2)){return _0x5b9f06['removeAgents'](_0x8c61f2,{'transaction':_0x121816})[_0x89d8('0x2e')](function(){return db[_0x89d8('0x97')][_0x89d8('0x2f')]({'where':{'VoiceQueueId':_0x5b402d[_0x89d8('0x66')]['id'],'UserId':_0x8c61f2},'transaction':_0x121816});});}})['then'](function(){_0x8c61f2[_0x89d8('0x82')](function(_0x4e4ebe){socket[_0x89d8('0x83')]('userVoiceQueue:remove',{'UserId':_0x4e4ebe,'VoiceQueueId':_0x5b9f06['id']});});});});});});})[_0x89d8('0x2e')](respondWithStatusCode(_0x40532d,null))[_0x89d8('0x57')](handleError(_0x40532d,null));};exports[_0x89d8('0x98')]=function(_0x4403be,_0x7abd65,_0x2d190d){var _0x16915b,_0x48ad2f;return db['VoiceQueue'][_0x89d8('0x39')]({'where':{'id':_0x4403be[_0x89d8('0x66')]['id']}})['then'](handleEntityNotFound(_0x7abd65,null))[_0x89d8('0x2e')](function(_0x2d036d){if(_0x2d036d){_0x48ad2f=_0x2d036d;return _0x2d036d[_0x89d8('0x98')](_0x4403be['body'][_0x89d8('0x86')],_[_0x89d8('0x99')](_0x4403be['body'],[_0x89d8('0x86'),'id'])||{})[_0x89d8('0x9a')](function(_0x84a95){for(var _0x1f9ee4=0x0;_0x1f9ee4<_0x4403be['body'][_0x89d8('0x86')][_0x89d8('0x4a')];_0x1f9ee4+=0x1){socket[_0x89d8('0x83')](_0x89d8('0x84'),{'UserId':Number(_0x4403be[_0x89d8('0x5a')][_0x89d8('0x86')][_0x1f9ee4]),'VoiceQueueId':Number(_0x4403be['params']['id'])});}return _0x84a95;});}})[_0x89d8('0x2e')](function(_0x92548b){_0x16915b=_0x92548b||[];if(_0x48ad2f){return db[_0x89d8('0x74')][_0x89d8('0x56')]({'where':{'id':_0x4403be['body'][_0x89d8('0x86')]},'attributes':['id','name','online',_0x89d8('0x76'),'interface'],'raw':!![]});}})[_0x89d8('0x2e')](function(_0x5604af){if(!_[_0x89d8('0x9b')](_0x5604af)){var _0x321467=[];for(var _0x35aa1b=0x0;_0x35aa1b<_0x5604af[_0x89d8('0x4a')];_0x35aa1b++){if(_0x5604af[_0x35aa1b][_0x89d8('0x9c')]){_0x321467[_0x89d8('0x90')](db['UserVoiceQueueRt'][_0x89d8('0x7f')]({'membername':_0x5604af[_0x35aa1b]['name'],'UserId':_0x5604af[_0x35aa1b]['id'],'queue_name':_0x48ad2f[_0x89d8('0x3a')],'VoiceQueueId':_0x48ad2f['id'],'interface':_[_0x89d8('0x80')](_0x5604af[_0x35aa1b][_0x89d8('0x77')])?util['format'](_0x89d8('0x81'),_0x5604af[_0x35aa1b]['name']):_0x5604af[_0x35aa1b][_0x89d8('0x77')],'paused':_0x5604af[_0x35aa1b][_0x89d8('0x76')]||![],'penalty':_0x4403be[_0x89d8('0x5a')][_0x89d8('0x79')]||0x0}));}}return BPromise[_0x89d8('0x93')](_0x321467);}})[_0x89d8('0x2e')](function(){return _0x16915b;})[_0x89d8('0x2e')](respondWithResult(_0x7abd65,null))[_0x89d8('0x57')](handleError(_0x7abd65,null));};exports['removeAgents']=function(_0x31a594,_0x51b517,_0x3deeba){return db[_0x89d8('0x40')][_0x89d8('0x39')]({'where':{'id':_0x31a594[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x51b517,null))[_0x89d8('0x2e')](function(_0x226aba){if(_0x226aba){return _0x226aba[_0x89d8('0x9d')](_0x31a594['query'][_0x89d8('0x86')])[_0x89d8('0x2e')](function(){if(_[_0x89d8('0x9e')](_0x31a594[_0x89d8('0x45')][_0x89d8('0x86')])){for(var _0x332c94=0x0;_0x332c94<_0x31a594[_0x89d8('0x45')][_0x89d8('0x86')][_0x89d8('0x4a')];_0x332c94+=0x1){socket[_0x89d8('0x83')](_0x89d8('0x9f'),{'UserId':Number(_0x31a594[_0x89d8('0x45')][_0x89d8('0x86')][_0x332c94]),'VoiceQueueId':Number(_0x31a594['params']['id'])});}}else{socket[_0x89d8('0x83')](_0x89d8('0x9f'),{'UserId':Number(_0x31a594['query'][_0x89d8('0x86')]),'VoiceQueueId':Number(_0x31a594[_0x89d8('0x66')]['id'])});}});}})[_0x89d8('0x2e')](function(_0x4ab13d){return db[_0x89d8('0x97')][_0x89d8('0x2f')]({'where':{'VoiceQueueId':_0x31a594['params']['id'],'UserId':_0x31a594[_0x89d8('0x45')][_0x89d8('0x86')]}})[_0x89d8('0x2e')](function(){return _0x4ab13d;});})[_0x89d8('0x2e')](respondWithStatusCode(_0x51b517,null))[_0x89d8('0x57')](handleError(_0x51b517,null));};exports[_0x89d8('0xa0')]=function(_0x34c518,_0x2d5b22,_0x2c1b26){var _0x23db9e={};var _0x4e284b={};var _0x577706;var _0x5d5884;return db[_0x89d8('0x40')][_0x89d8('0x68')]({'where':{'id':_0x34c518['params']['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x2d5b22,null))[_0x89d8('0x2e')](function(_0x57a35b){if(_0x57a35b){_0x577706=_0x57a35b;_0x4e284b[_0x89d8('0x44')]=_[_0x89d8('0x46')](db[_0x89d8('0x74')]['rawAttributes']);_0x4e284b['query']=_[_0x89d8('0x46')](_0x34c518[_0x89d8('0x45')]);_0x4e284b[_0x89d8('0x50')]=_['intersection'](_0x4e284b[_0x89d8('0x44')],_0x4e284b[_0x89d8('0x45')]);_0x23db9e[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x4e284b[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0x34c518[_0x89d8('0x45')][_0x89d8('0x49')]));_0x23db9e[_0x89d8('0x48')]=_0x23db9e[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x23db9e[_0x89d8('0x48')]:_0x4e284b['model'];_0x23db9e[_0x89d8('0x4d')]=qs['sort'](_0x34c518['query']['sort']);_0x23db9e[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x34c518[_0x89d8('0x45')],_0x4e284b[_0x89d8('0x50')]));if(_0x34c518[_0x89d8('0x45')][_0x89d8('0x33')]){_0x23db9e['where']=_[_0x89d8('0x52')](_0x23db9e[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x23db9e[_0x89d8('0x48')],function(_0x3c7a0f){var _0x18cf62={};_0x18cf62[_0x3c7a0f]={'$like':'%'+_0x34c518[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0x18cf62;})});}_0x23db9e=_['merge']({},_0x23db9e,_0x34c518[_0x89d8('0x54')]);return _0x577706['getAgents'](_0x23db9e);}})['then'](function(_0x55e812){if(_0x55e812){_0x5d5884=_0x55e812[_0x89d8('0x4a')];if(!_0x34c518['query'][_0x89d8('0x4b')]('nolimit')){_0x23db9e[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x34c518[_0x89d8('0x45')][_0x89d8('0x27')]);_0x23db9e[_0x89d8('0x25')]=qs['offset'](_0x34c518[_0x89d8('0x45')][_0x89d8('0x25')]);}return _0x577706[_0x89d8('0xa0')](_0x23db9e);}})['then'](function(_0x594817){if(_0x594817){return _0x594817?{'count':_0x5d5884,'rows':_0x594817}:null;}})[_0x89d8('0x2e')](respondWithResult(_0x2d5b22,null))['catch'](handleError(_0x2d5b22,null));};exports[_0x89d8('0xa1')]=function(_0x586d55,_0x586e0d,_0x4c947e){var _0x72351a={};var _0x33f5fb={};var _0x35838b;var _0x146217;return db['VoiceQueue'][_0x89d8('0x68')]({'where':{'id':_0x586d55[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x586e0d,null))['then'](function(_0x5b54a1){if(_0x5b54a1){_0x35838b=_0x5b54a1;_0x33f5fb['model']=_[_0x89d8('0x46')](db[_0x89d8('0x97')][_0x89d8('0x41')]);_0x33f5fb['query']=_[_0x89d8('0x46')](_0x586d55[_0x89d8('0x45')]);_0x33f5fb[_0x89d8('0x50')]=_[_0x89d8('0x47')](_0x33f5fb[_0x89d8('0x44')],_0x33f5fb['query']);_0x72351a['attributes']=_[_0x89d8('0x47')](_0x33f5fb[_0x89d8('0x44')],qs[_0x89d8('0x49')](_0x586d55[_0x89d8('0x45')]['fields']));_0x72351a[_0x89d8('0x48')]=_0x72351a[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x72351a[_0x89d8('0x48')]:_0x33f5fb[_0x89d8('0x44')];_0x72351a[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x586d55[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x72351a['where']=qs['filters'](_[_0x89d8('0x51')](_0x586d55['query'],_0x33f5fb['filters']));if(_0x586d55[_0x89d8('0x45')][_0x89d8('0x33')]){_0x72351a[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x72351a[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x72351a[_0x89d8('0x48')],function(_0x2b579e){var _0x59cdc1={};_0x59cdc1[_0x2b579e]={'$like':'%'+_0x586d55['query'][_0x89d8('0x33')]+'%'};return _0x59cdc1;})});}_0x72351a=_['merge']({},_0x72351a,_0x586d55[_0x89d8('0x54')]);return _0x35838b['getMembers'](_0x72351a);}})[_0x89d8('0x2e')](function(_0x19e283){if(_0x19e283){_0x146217=_0x19e283[_0x89d8('0x4a')];if(!_0x586d55[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x72351a[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x586d55[_0x89d8('0x45')][_0x89d8('0x27')]);_0x72351a[_0x89d8('0x25')]=qs['offset'](_0x586d55[_0x89d8('0x45')][_0x89d8('0x25')]);}return _0x35838b[_0x89d8('0xa1')](_0x72351a);}})[_0x89d8('0x2e')](function(_0x281011){return _0x281011?{'count':_0x146217,'rows':_0x281011}:null;})['then'](respondWithResult(_0x586e0d,null))['catch'](handleError(_0x586e0d,null));};exports[_0x89d8('0xa2')]=function(_0x31cb3c,_0x815429,_0x2dfed7){var _0x1af65a={};var _0x2df07d={};var _0x5b2552;var _0xa09f2;return db[_0x89d8('0x40')]['findOne']({'where':{'id':_0x31cb3c[_0x89d8('0x66')]['id']}})['then'](handleEntityNotFound(_0x815429,null))[_0x89d8('0x2e')](function(_0xd90856){if(_0xd90856){_0x5b2552=_0xd90856;_0x2df07d['model']=_['keys'](db[_0x89d8('0xa3')]['rawAttributes']);_0x2df07d[_0x89d8('0x45')]=_[_0x89d8('0x46')](_0x31cb3c[_0x89d8('0x45')]);_0x2df07d[_0x89d8('0x50')]=_[_0x89d8('0x47')](_0x2df07d[_0x89d8('0x44')],_0x2df07d[_0x89d8('0x45')]);_0x1af65a[_0x89d8('0x48')]=_['intersection'](_0x2df07d['model'],qs['fields'](_0x31cb3c['query']['fields']));_0x1af65a[_0x89d8('0x48')]=_0x1af65a[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x1af65a[_0x89d8('0x48')]:_0x2df07d['model'];_0x1af65a[_0x89d8('0x4d')]=qs['sort'](_0x31cb3c[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x1af65a['where']=qs['filters'](_[_0x89d8('0x51')](_0x31cb3c[_0x89d8('0x45')],_0x2df07d[_0x89d8('0x50')]));if(_0x31cb3c[_0x89d8('0x45')][_0x89d8('0x33')]){_0x1af65a[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x1af65a[_0x89d8('0x4f')],{'$or':_[_0x89d8('0x35')](_0x1af65a[_0x89d8('0x48')],function(_0x3cc11b){var _0x4d5c4d={};_0x4d5c4d[_0x3cc11b]={'$like':'%'+_0x31cb3c[_0x89d8('0x45')][_0x89d8('0x33')]+'%'};return _0x4d5c4d;})});}_0x1af65a=_[_0x89d8('0x52')]({},_0x1af65a,_0x31cb3c[_0x89d8('0x54')]);return _0x5b2552['getLists'](_0x1af65a);}})[_0x89d8('0x2e')](function(_0x467c43){if(_0x467c43){_0xa09f2=_0x467c43[_0x89d8('0x4a')];if(!_0x31cb3c[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x1af65a['limit']=qs['limit'](_0x31cb3c[_0x89d8('0x45')][_0x89d8('0x27')]);_0x1af65a[_0x89d8('0x25')]=qs[_0x89d8('0x25')](_0x31cb3c[_0x89d8('0x45')]['offset']);}return _0x5b2552['getLists'](_0x1af65a);}})[_0x89d8('0x2e')](function(_0x199243){if(_0x199243){return _0x199243?{'count':_0xa09f2,'rows':_0x199243}:null;}})[_0x89d8('0x2e')](respondWithResult(_0x815429,null))[_0x89d8('0x57')](handleError(_0x815429,null));};exports['addLists']=function(_0x3479e0,_0x37b713,_0x1cc160){var _0x5c6049,_0x1fde69;return db['VoiceQueue']['find']({'where':{'id':_0x3479e0[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x37b713,null))[_0x89d8('0x2e')](function(_0xe2b989){if(_0xe2b989){_0x1fde69=_0xe2b989;return _0xe2b989[_0x89d8('0xa4')](_0x3479e0[_0x89d8('0x5a')]['ids'],_[_0x89d8('0x99')](_0x3479e0[_0x89d8('0x5a')],[_0x89d8('0x86'),'id'])||{});}return null;})[_0x89d8('0x9a')](function(_0x40096b){var _0x9a4525;_0x5c6049=_0x40096b||[];var _0x1a86a5=[];if(_0x40096b){for(var _0x1ba32d=0x0;_0x1ba32d<_0x40096b[_0x89d8('0x4a')];_0x1ba32d+=0x1){var _0x4ca566=_0x40096b[_0x1ba32d][_0x89d8('0x30')]({'plain':!![]});_0x1fde69[_0x89d8('0xa5')]=_0x3479e0[_0x89d8('0x5a')]['dialCheckDuplicateType']?_0x3479e0[_0x89d8('0x5a')][_0x89d8('0xa5')]:_0x1fde69[_0x89d8('0xa5')];switch(_0x1fde69[_0x89d8('0xa5')]){case _0x89d8('0xa6'):_0x9a4525=squel[_0x89d8('0xa7')]()[_0x89d8('0xa8')]('cm_hopper')[_0x89d8('0xa9')]([_0x89d8('0xaa'),_0x89d8('0xab'),_0x89d8('0xac'),_0x89d8('0xad'),_0x89d8('0x6a'),_0x89d8('0x63'),_0x89d8('0x64')],squel['select']()[_0x89d8('0x87')](_0x89d8('0xaa'),_0x89d8('0xaa'))[_0x89d8('0x87')](_0x89d8('0xae'),_0x89d8('0xab'))[_0x89d8('0x87')]('id',_0x89d8('0xac'))[_0x89d8('0x87')](_0x4ca566['CmListId'][_0x89d8('0x91')](),_0x89d8('0xad'))[_0x89d8('0x87')](_0x3479e0[_0x89d8('0x66')]['id']['toString'](),_0x89d8('0x6a'))['field'](_0x89d8('0xae'),_0x89d8('0x63'))[_0x89d8('0x87')](_0x89d8('0xae'),'updatedAt')[_0x89d8('0x89')]('cm_contacts')[_0x89d8('0x4f')](_0x89d8('0xaf'))[_0x89d8('0x4f')](_0x89d8('0xb0'),_0x4ca566[_0x89d8('0xb1')][_0x89d8('0x91')]())[_0x89d8('0x4f')](_0x89d8('0xb2'))['where'](_0x89d8('0xb3'),squel[_0x89d8('0xb4')]()[_0x89d8('0x87')](_0x89d8('0xb5'))[_0x89d8('0x89')](_0x89d8('0xb6'))[_0x89d8('0x4f')](_0x89d8('0x8d'),_0x3479e0['params']['id'][_0x89d8('0x91')]()))[_0x89d8('0x4f')](_0x89d8('0xb3'),squel[_0x89d8('0xb4')]()[_0x89d8('0x87')](_0x89d8('0xb7'))[_0x89d8('0x89')](_0x89d8('0xb8'))[_0x89d8('0x4f')](_0x89d8('0x8d'),_0x3479e0['params']['id']['toString']())))['toString']();break;case _0x89d8('0xb9'):_0x9a4525=squel[_0x89d8('0xa7')]()[_0x89d8('0xa8')](_0x89d8('0xb8'))['fromQuery']([_0x89d8('0xaa'),_0x89d8('0xab'),_0x89d8('0xac'),_0x89d8('0xad'),_0x89d8('0x6a'),'createdAt','updatedAt'],squel[_0x89d8('0xb4')]()[_0x89d8('0x87')](_0x89d8('0xaa'),_0x89d8('0xaa'))[_0x89d8('0x87')](_0x89d8('0xae'),'scheduledAt')[_0x89d8('0x87')]('id',_0x89d8('0xac'))[_0x89d8('0x87')](_0x4ca566[_0x89d8('0xb1')][_0x89d8('0x91')](),_0x89d8('0xad'))[_0x89d8('0x87')](_0x3479e0[_0x89d8('0x66')]['id'][_0x89d8('0x91')](),_0x89d8('0x6a'))[_0x89d8('0x87')](_0x89d8('0xae'),_0x89d8('0x63'))['field'](_0x89d8('0xae'),'updatedAt')[_0x89d8('0x89')](_0x89d8('0xba'))['where'](_0x89d8('0xaf'))[_0x89d8('0x4f')](_0x89d8('0xb0'),_0x4ca566[_0x89d8('0xb1')][_0x89d8('0x91')]())[_0x89d8('0x4f')](_0x89d8('0xb2'))['where'](_0x89d8('0xb3'),squel['select']()[_0x89d8('0x87')]('COALESCE(phone,\x27\x27)')[_0x89d8('0x89')](_0x89d8('0xb8'))[_0x89d8('0x4f')](_0x89d8('0x8d'),_0x3479e0[_0x89d8('0x66')]['id'][_0x89d8('0x91')]())))[_0x89d8('0x91')]();break;default:_0x9a4525=squel['insert']()['into'](_0x89d8('0xb8'))[_0x89d8('0xa9')](['phone','scheduledAt',_0x89d8('0xac'),_0x89d8('0xad'),_0x89d8('0x6a'),_0x89d8('0x63'),'updatedAt'],squel[_0x89d8('0xb4')]()['field'](_0x89d8('0xaa'),_0x89d8('0xaa'))[_0x89d8('0x87')](_0x89d8('0xae'),_0x89d8('0xab'))[_0x89d8('0x87')]('id','ContactId')[_0x89d8('0x87')](_0x4ca566[_0x89d8('0xb1')][_0x89d8('0x91')](),_0x89d8('0xad'))[_0x89d8('0x87')](_0x3479e0[_0x89d8('0x66')]['id'][_0x89d8('0x91')](),'VoiceQueueId')[_0x89d8('0x87')](_0x89d8('0xae'),'createdAt')[_0x89d8('0x87')](_0x89d8('0xae'),'updatedAt')[_0x89d8('0x89')](_0x89d8('0xba'))[_0x89d8('0x4f')]('deletedAt\x20IS\x20NULL')[_0x89d8('0x4f')](_0x89d8('0xb0'),_0x4ca566[_0x89d8('0xb1')][_0x89d8('0x91')]())['where'](_0x89d8('0xb2')))[_0x89d8('0x91')]();}_0x1a86a5[_0x89d8('0x90')](db[_0x89d8('0x7a')][_0x89d8('0x45')](_0x9a4525));}return BPromise[_0x89d8('0x93')](_0x1a86a5);}})['then'](function(){return _0x5c6049;})[_0x89d8('0x2e')](respondWithResult(_0x37b713,null))[_0x89d8('0x57')](handleError(_0x37b713,null));};exports[_0x89d8('0xbb')]=function(_0x26ae63,_0x72ecad,_0x5a7396){return db[_0x89d8('0x40')]['find']({'where':{'id':_0x26ae63['params']['id']}})[_0x89d8('0x2e')](handleEntityNotFound(_0x72ecad,null))['then'](function(_0x2fc978){if(_0x2fc978){return _0x2fc978['removeLists'](_0x26ae63[_0x89d8('0x45')][_0x89d8('0x86')]);}})[_0x89d8('0x2e')](function(_0x59ebe9){if(_0x59ebe9){return db[_0x89d8('0x69')]['destroy']({'where':{'ListId':_0x26ae63[_0x89d8('0x45')][_0x89d8('0x86')],'VoiceQueueId':_0x26ae63[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](function(){return _0x59ebe9;});}})[_0x89d8('0x2e')](respondWithStatusCode(_0x72ecad,null))[_0x89d8('0x57')](handleError(_0x72ecad,null));};exports[_0x89d8('0xbc')]=function(_0x59f5c8,_0x5bbc52,_0x48b073){var _0x5104a6={};var _0x468308={};var _0x47ee9d;var _0x26e14f;return db[_0x89d8('0x40')]['findOne']({'where':{'id':_0x59f5c8['params']['id']}})['then'](handleEntityNotFound(_0x5bbc52,null))[_0x89d8('0x2e')](function(_0x600895){if(_0x600895){_0x47ee9d=_0x600895;_0x468308[_0x89d8('0x44')]=_['keys'](db[_0x89d8('0xa3')]['rawAttributes']);_0x468308['query']=_[_0x89d8('0x46')](_0x59f5c8[_0x89d8('0x45')]);_0x468308['filters']=_['intersection'](_0x468308[_0x89d8('0x44')],_0x468308[_0x89d8('0x45')]);_0x5104a6[_0x89d8('0x48')]=_[_0x89d8('0x47')](_0x468308['model'],qs[_0x89d8('0x49')](_0x59f5c8['query'][_0x89d8('0x49')]));_0x5104a6[_0x89d8('0x48')]=_0x5104a6[_0x89d8('0x48')][_0x89d8('0x4a')]?_0x5104a6['attributes']:_0x468308[_0x89d8('0x44')];_0x5104a6[_0x89d8('0x4d')]=qs[_0x89d8('0x4e')](_0x59f5c8[_0x89d8('0x45')][_0x89d8('0x4e')]);_0x5104a6[_0x89d8('0x4f')]=qs[_0x89d8('0x50')](_[_0x89d8('0x51')](_0x59f5c8[_0x89d8('0x45')],_0x468308[_0x89d8('0x50')]));if(_0x59f5c8[_0x89d8('0x45')][_0x89d8('0x33')]){_0x5104a6[_0x89d8('0x4f')]=_[_0x89d8('0x52')](_0x5104a6['where'],{'$or':_['map'](_0x5104a6[_0x89d8('0x48')],function(_0x3ac06d){var _0x10d23e={};_0x10d23e[_0x3ac06d]={'$like':'%'+_0x59f5c8['query']['filter']+'%'};return _0x10d23e;})});}_0x5104a6=_[_0x89d8('0x52')]({},_0x5104a6,_0x59f5c8['options']);return _0x47ee9d[_0x89d8('0xbc')](_0x5104a6);}})[_0x89d8('0x2e')](function(_0x8e358c){if(_0x8e358c){_0x26e14f=_0x8e358c[_0x89d8('0x4a')];if(!_0x59f5c8[_0x89d8('0x45')][_0x89d8('0x4b')](_0x89d8('0x4c'))){_0x5104a6[_0x89d8('0x27')]=qs[_0x89d8('0x27')](_0x59f5c8[_0x89d8('0x45')][_0x89d8('0x27')]);_0x5104a6[_0x89d8('0x25')]=qs['offset'](_0x59f5c8[_0x89d8('0x45')]['offset']);}return _0x47ee9d[_0x89d8('0xbc')](_0x5104a6);}})[_0x89d8('0x2e')](function(_0x387f3e){if(_0x387f3e){return _0x387f3e?{'count':_0x26e14f,'rows':_0x387f3e}:null;}})[_0x89d8('0x2e')](respondWithResult(_0x5bbc52,null))['catch'](handleError(_0x5bbc52,null));};exports[_0x89d8('0xbd')]=function(_0x2e23f5,_0x59cefb,_0x44855d){var _0x27cc00,_0x7b8076;return db[_0x89d8('0x40')]['find']({'where':{'id':_0x2e23f5[_0x89d8('0x66')]['id']}})['then'](handleEntityNotFound(_0x59cefb,null))['then'](function(_0x54f8d0){if(_0x54f8d0){_0x7b8076=_0x54f8d0;return _0x54f8d0[_0x89d8('0xbd')](_0x2e23f5[_0x89d8('0x5a')]['ids'],_['omit'](_0x2e23f5['body'],[_0x89d8('0x86'),'id'])||{});}return null;})[_0x89d8('0x9a')](function(_0x143904){var _0x410d50;_0x27cc00=_0x143904||[];var _0x3f6cc5=[];if(_0x143904){for(var _0x48dced=0x0;_0x48dced<_0x143904[_0x89d8('0x4a')];_0x48dced+=0x1){var _0x1d1164=_0x143904[_0x48dced][_0x89d8('0x30')]({'plain':!![]});_0x410d50=squel[_0x89d8('0xa7')]()[_0x89d8('0xa8')](_0x89d8('0xbe'))[_0x89d8('0xa9')]([_0x89d8('0xaa'),'ContactId',_0x89d8('0xad'),'VoiceQueueId',_0x89d8('0x63'),_0x89d8('0x64')],squel['select']()[_0x89d8('0x87')]('phone',_0x89d8('0xaa'))[_0x89d8('0x87')]('id',_0x89d8('0xac'))['field'](_0x1d1164[_0x89d8('0xb1')][_0x89d8('0x91')](),'ListId')['field'](_0x2e23f5[_0x89d8('0x66')]['id'][_0x89d8('0x91')](),_0x89d8('0x6a'))[_0x89d8('0x87')](_0x89d8('0xae'),_0x89d8('0x63'))[_0x89d8('0x87')](_0x89d8('0xae'),_0x89d8('0x64'))['from'](_0x89d8('0xba'))['where'](_0x89d8('0xaf'))[_0x89d8('0x4f')](_0x89d8('0xb0'),_0x1d1164[_0x89d8('0xb1')][_0x89d8('0x91')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x89d8('0x91')]();_0x3f6cc5[_0x89d8('0x90')](db[_0x89d8('0x7a')][_0x89d8('0x45')](_0x410d50));}return BPromise[_0x89d8('0x93')](_0x3f6cc5);}})[_0x89d8('0x2e')](function(){return _0x27cc00;})[_0x89d8('0x2e')](respondWithResult(_0x59cefb,null))['catch'](handleError(_0x59cefb,null));};exports[_0x89d8('0xbf')]=function(_0x312ae0,_0x3acea9,_0x425ee7){return db['VoiceQueue'][_0x89d8('0x39')]({'where':{'id':_0x312ae0['params']['id']}})['then'](handleEntityNotFound(_0x3acea9,null))[_0x89d8('0x2e')](function(_0x167a4c){if(_0x167a4c){return _0x167a4c[_0x89d8('0xbf')](_0x312ae0[_0x89d8('0x45')][_0x89d8('0x86')]);}})[_0x89d8('0x2e')](function(_0x5ec4eb){if(_0x5ec4eb){return db[_0x89d8('0xc0')][_0x89d8('0x2f')]({'where':{'ListId':_0x312ae0[_0x89d8('0x45')][_0x89d8('0x86')],'VoiceQueueId':_0x312ae0[_0x89d8('0x66')]['id']}})[_0x89d8('0x2e')](function(){return _0x5ec4eb;});}})[_0x89d8('0x2e')](respondWithStatusCode(_0x3acea9,null))[_0x89d8('0x57')](handleError(_0x3acea9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e052e92..e42c90f 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 _0x7904=['VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0x7904,0x117));var _0x4790=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7904[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4790('0x0'))['db'][_0x4790('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4790('0x2')](0x0);var events={'afterCreate':_0x4790('0x3'),'afterUpdate':'update','afterDestroy':_0x4790('0x4')};function emitEvent(_0x520ce3){return function(_0x5cbe7a,_0x58f112,_0x3f8f45){VoiceQueueEvents[_0x4790('0x5')](_0x520ce3+':'+_0x5cbe7a['id'],_0x5cbe7a);VoiceQueueEvents[_0x4790('0x5')](_0x520ce3,_0x5cbe7a);_0x3f8f45(null);};}for(var e in events){if(events[_0x4790('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x79f9=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x1eb9fe,_0x532436){var _0x5271c8=function(_0x2950fc){while(--_0x2950fc){_0x1eb9fe['push'](_0x1eb9fe['shift']());}};_0x5271c8(++_0x532436);}(_0x79f9,0xf0));var _0x979f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79f9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x979f('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x979f('0x1')](0x0);var events={'afterCreate':_0x979f('0x2'),'afterUpdate':'update','afterDestroy':_0x979f('0x3')};function emitEvent(_0x19aef9){return function(_0x418ba9,_0x4b8a38,_0x1eb46a){VoiceQueueEvents[_0x979f('0x4')](_0x19aef9+':'+_0x418ba9['id'],_0x418ba9);VoiceQueueEvents[_0x979f('0x4')](_0x19aef9,_0x418ba9);_0x1eb46a(null);};}for(var e in events){if(events[_0x979f('0x5')](e)){var event=events[e];VoiceQueue[_0x979f('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e540862..99aaf9a 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x2dee5c,_0x2d91e8){var _0x4b22d9=function(_0x157a2b){while(--_0x157a2b){_0x2dee5c['push'](_0x2dee5c['shift']());}};_0x4b22d9(++_0x2d91e8);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x1c6664,_0x45566e){var _0x33124b=function(_0x2c04bb){while(--_0x2c04bb){_0x1c6664['push'](_0x1c6664['shift']());}};_0x33124b(++_0x45566e);}(_0x3e74,0x175));var _0x43e7=function(_0x243625,_0x1a0b90){_0x243625=_0x243625-0x0;var _0x2c3032=_0x3e74[_0x243625];return _0x2c3032;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0990894..a180bef 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 _0xb624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird'];(function(_0x31ef02,_0x517141){var _0x309387=function(_0x567796){while(--_0x567796){_0x31ef02['push'](_0x31ef02['shift']());}};_0x309387(++_0x517141);}(_0xb624,0xa8));var _0x4b62=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0xb624[_0x20259c];return _0x4d988e;};'use strict';var _=require(_0x4b62('0x0'));var util=require(_0x4b62('0x1'));var moment=require(_0x4b62('0x2'));var BPromise=require(_0x4b62('0x3'));var rs=require(_0x4b62('0x4'));var fs=require('fs');var Redis=require(_0x4b62('0x5'));var db=require(_0x4b62('0x6'))['db'];var utils=require(_0x4b62('0x7'));var logger=require(_0x4b62('0x8'))(_0x4b62('0x9'));var config=require(_0x4b62('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4b62('0xb')][_0x4b62('0xc')]({'port':0x232a});config[_0x4b62('0xd')]=_[_0x4b62('0xe')](config[_0x4b62('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b62('0xf'))(new Redis(config[_0x4b62('0xd')]));require(_0x4b62('0x10'))[_0x4b62('0x11')](socket);function respondWithRpcPromise(_0x155e97,_0x222b9c,_0x257c31){return new BPromise(function(_0x41fd34,_0x953c4a){return client[_0x4b62('0x12')](_0x155e97,_0x257c31)['then'](function(_0x2d21a5){logger[_0x4b62('0x13')](_0x4b62('0x14'),_0x222b9c,_0x4b62('0x15'));logger[_0x4b62('0x16')](_0x4b62('0x17'),_0x222b9c,'request\x20sent',JSON[_0x4b62('0x18')](_0x2d21a5));if(_0x2d21a5[_0x4b62('0x19')]){if(_0x2d21a5[_0x4b62('0x19')]['code']===0x1f4){logger[_0x4b62('0x19')](_0x4b62('0x14'),_0x222b9c,_0x2d21a5[_0x4b62('0x19')][_0x4b62('0x1a')]);return _0x953c4a(_0x2d21a5[_0x4b62('0x19')]['message']);}logger[_0x4b62('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x222b9c,_0x2d21a5[_0x4b62('0x19')][_0x4b62('0x1a')]);return _0x41fd34(_0x2d21a5[_0x4b62('0x19')][_0x4b62('0x1a')]);}else{logger['info'](_0x4b62('0x14'),_0x222b9c,_0x4b62('0x15'));_0x41fd34(_0x2d21a5[_0x4b62('0x1b')][_0x4b62('0x1a')]);}})['catch'](function(_0x1b62b1){logger['error'](_0x4b62('0x14'),_0x222b9c,_0x1b62b1);_0x953c4a(_0x1b62b1);});});}exports[_0x4b62('0x1c')]=function(_0x3dc3cd){var _0x59c7d3=this;return new Promise(function(_0x48c88e,_0x57199c){return db[_0x4b62('0x1d')][_0x4b62('0x1e')]({'raw':_0x3dc3cd[_0x4b62('0x1f')]?_0x3dc3cd[_0x4b62('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc3cd[_0x4b62('0x1f')]?_0x3dc3cd[_0x4b62('0x1f')][_0x4b62('0x20')]||null:null,'attributes':_0x3dc3cd[_0x4b62('0x1f')]?_0x3dc3cd[_0x4b62('0x1f')][_0x4b62('0x21')]||null:null,'limit':_0x3dc3cd[_0x4b62('0x1f')]?_0x3dc3cd['options'][_0x4b62('0x22')]||null:null,'include':_0x3dc3cd['options']?_0x3dc3cd['options'][_0x4b62('0x23')]?_[_0x4b62('0x24')](_0x3dc3cd[_0x4b62('0x1f')][_0x4b62('0x23')],function(_0x56a1c0){return{'model':db[_0x56a1c0[_0x4b62('0x25')]],'as':_0x56a1c0['as'],'attributes':_0x56a1c0[_0x4b62('0x21')],'include':_0x56a1c0[_0x4b62('0x23')]?_['map'](_0x56a1c0[_0x4b62('0x23')],function(_0x395813){return{'model':db[_0x395813['model']],'as':_0x395813['as'],'attributes':_0x395813[_0x4b62('0x21')],'include':_0x395813['include']?_['map'](_0x395813['include'],function(_0x131ebb){return{'model':db[_0x131ebb[_0x4b62('0x25')]],'as':_0x131ebb['as'],'attributes':_0x131ebb[_0x4b62('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4b62('0x26')](function(_0x584480){logger[_0x4b62('0x13')](_0x4b62('0x1c'),_0x3dc3cd);logger['debug'](_0x4b62('0x1c'),_0x3dc3cd,JSON[_0x4b62('0x18')](_0x584480));_0x48c88e(_0x584480);})[_0x4b62('0x27')](function(_0x46b58f){logger[_0x4b62('0x19')](_0x4b62('0x1c'),_0x46b58f[_0x4b62('0x1a')],_0x3dc3cd);_0x57199c(_0x59c7d3[_0x4b62('0x19')](0x1f4,_0x46b58f['message']));});});};exports[_0x4b62('0x28')]=function(_0x5bd605){var _0x3c1806=this;return new Promise(function(_0x2935fd,_0xc09241){return db[_0x4b62('0x1d')][_0x4b62('0x29')]({'raw':_0x5bd605[_0x4b62('0x1f')]?_0x5bd605[_0x4b62('0x1f')][_0x4b62('0x2a')]===undefined?!![]:![]:!![],'where':_0x5bd605[_0x4b62('0x1f')]?_0x5bd605[_0x4b62('0x1f')]['where']||null:null,'attributes':_0x5bd605[_0x4b62('0x1f')]?_0x5bd605[_0x4b62('0x1f')][_0x4b62('0x21')]||null:null,'include':_0x5bd605[_0x4b62('0x1f')]?_0x5bd605['options'][_0x4b62('0x23')]?_[_0x4b62('0x24')](_0x5bd605[_0x4b62('0x1f')]['include'],function(_0x33ab6c){return{'model':db[_0x33ab6c[_0x4b62('0x25')]],'as':_0x33ab6c['as'],'attributes':_0x33ab6c[_0x4b62('0x21')],'include':_0x33ab6c['include']?_[_0x4b62('0x24')](_0x33ab6c[_0x4b62('0x23')],function(_0x2e544c){return{'model':db[_0x2e544c[_0x4b62('0x25')]],'as':_0x2e544c['as'],'attributes':_0x2e544c['attributes'],'include':_0x2e544c['include']?_['map'](_0x2e544c[_0x4b62('0x23')],function(_0x20167c){return{'model':db[_0x20167c[_0x4b62('0x25')]],'as':_0x20167c['as'],'attributes':_0x20167c[_0x4b62('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447781){logger[_0x4b62('0x13')](_0x4b62('0x28'),_0x5bd605);logger[_0x4b62('0x16')](_0x4b62('0x28'),_0x5bd605,JSON[_0x4b62('0x18')](_0x447781));_0x2935fd(_0x447781);})[_0x4b62('0x27')](function(_0x21c188){logger[_0x4b62('0x19')](_0x4b62('0x28'),_0x21c188['message'],_0x5bd605);_0xc09241(_0x3c1806[_0x4b62('0x19')](0x1f4,_0x21c188[_0x4b62('0x1a')]));});});}; \ No newline at end of file +var _0x997f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','VoiceQueue,\x20%s,\x20%s','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes','limit','map','include','stringify','ShowVoiceQueue','raw','where','model','lodash','util','bluebird','randomstring'];(function(_0x301c53,_0x512ef0){var _0x131a63=function(_0x53727e){while(--_0x53727e){_0x301c53['push'](_0x301c53['shift']());}};_0x131a63(++_0x512ef0);}(_0x997f,0x8c));var _0xf997=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x997f[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0xf997('0x0'));var util=require(_0xf997('0x1'));var moment=require('moment');var BPromise=require(_0xf997('0x2'));var rs=require(_0xf997('0x3'));var fs=require('fs');var Redis=require(_0xf997('0x4'));var db=require(_0xf997('0x5'))['db'];var utils=require(_0xf997('0x6'));var logger=require(_0xf997('0x7'))('rpc');var config=require(_0xf997('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf997('0x9')]=_['defaults'](config[_0xf997('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf997('0xa'))(new Redis(config[_0xf997('0x9')]));require(_0xf997('0xb'))[_0xf997('0xc')](socket);function respondWithRpcPromise(_0x3f5590,_0x50f25d,_0x1d7821){return new BPromise(function(_0x17c1ba,_0x1face9){return client[_0xf997('0xd')](_0x3f5590,_0x1d7821)[_0xf997('0xe')](function(_0x36f22){logger[_0xf997('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x50f25d,'request\x20sent');logger[_0xf997('0x10')](_0xf997('0x11'),_0x50f25d,_0xf997('0x12'),JSON['stringify'](_0x36f22));if(_0x36f22[_0xf997('0x13')]){if(_0x36f22[_0xf997('0x13')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x50f25d,_0x36f22[_0xf997('0x13')][_0xf997('0x14')]);return _0x1face9(_0x36f22['error']['message']);}logger[_0xf997('0x13')](_0xf997('0x15'),_0x50f25d,_0x36f22[_0xf997('0x13')][_0xf997('0x14')]);return _0x17c1ba(_0x36f22[_0xf997('0x13')]['message']);}else{logger[_0xf997('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x50f25d,_0xf997('0x12'));_0x17c1ba(_0x36f22['result']['message']);}})[_0xf997('0x16')](function(_0x101168){logger[_0xf997('0x13')](_0xf997('0x15'),_0x50f25d,_0x101168);_0x1face9(_0x101168);});});}exports[_0xf997('0x17')]=function(_0x415112){var _0x4782f3=this;return new Promise(function(_0x13395a,_0x580343){return db[_0xf997('0x18')][_0xf997('0x19')]({'raw':_0x415112[_0xf997('0x1a')]?_0x415112['options']['raw']===undefined?!![]:![]:!![],'where':_0x415112[_0xf997('0x1a')]?_0x415112[_0xf997('0x1a')]['where']||null:null,'attributes':_0x415112['options']?_0x415112[_0xf997('0x1a')][_0xf997('0x1b')]||null:null,'limit':_0x415112['options']?_0x415112['options'][_0xf997('0x1c')]||null:null,'include':_0x415112['options']?_0x415112['options']['include']?_[_0xf997('0x1d')](_0x415112[_0xf997('0x1a')][_0xf997('0x1e')],function(_0x500f48){return{'model':db[_0x500f48['model']],'as':_0x500f48['as'],'attributes':_0x500f48[_0xf997('0x1b')],'include':_0x500f48[_0xf997('0x1e')]?_[_0xf997('0x1d')](_0x500f48['include'],function(_0x3e49f9){return{'model':db[_0x3e49f9['model']],'as':_0x3e49f9['as'],'attributes':_0x3e49f9[_0xf997('0x1b')],'include':_0x3e49f9[_0xf997('0x1e')]?_[_0xf997('0x1d')](_0x3e49f9[_0xf997('0x1e')],function(_0x4eb976){return{'model':db[_0x4eb976['model']],'as':_0x4eb976['as'],'attributes':_0x4eb976['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5598d1){logger[_0xf997('0xf')](_0xf997('0x17'),_0x415112);logger[_0xf997('0x10')](_0xf997('0x17'),_0x415112,JSON[_0xf997('0x1f')](_0x5598d1));_0x13395a(_0x5598d1);})[_0xf997('0x16')](function(_0x32579f){logger['error'](_0xf997('0x17'),_0x32579f['message'],_0x415112);_0x580343(_0x4782f3[_0xf997('0x13')](0x1f4,_0x32579f[_0xf997('0x14')]));});});};exports[_0xf997('0x20')]=function(_0x281bd9){var _0x45ebbe=this;return new Promise(function(_0x4e9142,_0x167998){return db[_0xf997('0x18')]['find']({'raw':_0x281bd9['options']?_0x281bd9[_0xf997('0x1a')][_0xf997('0x21')]===undefined?!![]:![]:!![],'where':_0x281bd9['options']?_0x281bd9[_0xf997('0x1a')][_0xf997('0x22')]||null:null,'attributes':_0x281bd9['options']?_0x281bd9['options'][_0xf997('0x1b')]||null:null,'include':_0x281bd9['options']?_0x281bd9[_0xf997('0x1a')]['include']?_[_0xf997('0x1d')](_0x281bd9[_0xf997('0x1a')][_0xf997('0x1e')],function(_0x4e9052){return{'model':db[_0x4e9052[_0xf997('0x23')]],'as':_0x4e9052['as'],'attributes':_0x4e9052[_0xf997('0x1b')],'include':_0x4e9052['include']?_[_0xf997('0x1d')](_0x4e9052[_0xf997('0x1e')],function(_0x9608ee){return{'model':db[_0x9608ee[_0xf997('0x23')]],'as':_0x9608ee['as'],'attributes':_0x9608ee[_0xf997('0x1b')],'include':_0x9608ee[_0xf997('0x1e')]?_[_0xf997('0x1d')](_0x9608ee[_0xf997('0x1e')],function(_0x8e286f){return{'model':db[_0x8e286f['model']],'as':_0x8e286f['as'],'attributes':_0x8e286f[_0xf997('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf997('0xe')](function(_0x35f302){logger[_0xf997('0xf')](_0xf997('0x20'),_0x281bd9);logger[_0xf997('0x10')]('ShowVoiceQueue',_0x281bd9,JSON['stringify'](_0x35f302));_0x4e9142(_0x35f302);})[_0xf997('0x16')](function(_0x32911f){logger[_0xf997('0x13')](_0xf997('0x20'),_0x32911f[_0xf997('0x14')],_0x281bd9);_0x167998(_0x45ebbe[_0xf997('0x13')](0x1f4,_0x32911f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 023fe62..4d51ab1 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 _0x90c1=['save','update','emit','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x3c601d,_0x1252ae){var _0x3da0e9=function(_0x3697ed){while(--_0x3697ed){_0x3c601d['push'](_0x3c601d['shift']());}};_0x3da0e9(++_0x1252ae);}(_0x90c1,0x187));var _0x190c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x90c1[_0x59ee6f];return _0x4c0979;};'use strict';var VoiceQueueEvents=require(_0x190c('0x0'));var events=[_0x190c('0x1'),'remove',_0x190c('0x2')];function createListener(_0x12aa7a,_0x51117e){return function(_0x500b56){_0x51117e[_0x190c('0x3')](_0x12aa7a,_0x500b56);};}function removeListener(_0xf9ee4a,_0x451f06){return function(){VoiceQueueEvents[_0x190c('0x4')](_0xf9ee4a,_0x451f06);};}exports['register']=function(_0xff9a7e){for(var _0x7ee02b=0x0,_0x13bac0=events[_0x190c('0x5')];_0x7ee02b<_0x13bac0;_0x7ee02b++){var _0x205cad=events[_0x7ee02b];var _0x39a1f0=createListener(_0x190c('0x6')+_0x205cad,_0xff9a7e);VoiceQueueEvents['on'](_0x205cad,_0x39a1f0);}}; \ No newline at end of file +var _0x33f9=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3870c6,_0x4b9ea3){var _0x456a8b=function(_0x4bc5e1){while(--_0x4bc5e1){_0x3870c6['push'](_0x3870c6['shift']());}};_0x456a8b(++_0x4b9ea3);}(_0x33f9,0x80));var _0x933f=function(_0x310f3d,_0x5b08ba){_0x310f3d=_0x310f3d-0x0;var _0xcedfb5=_0x33f9[_0x310f3d];return _0xcedfb5;};'use strict';var VoiceQueueEvents=require(_0x933f('0x0'));var events=[_0x933f('0x1'),_0x933f('0x2'),_0x933f('0x3')];function createListener(_0x803d98,_0x22f36c){return function(_0x17e64a){_0x22f36c[_0x933f('0x4')](_0x803d98,_0x17e64a);};}function removeListener(_0x4086a6,_0x58241c){return function(){VoiceQueueEvents[_0x933f('0x5')](_0x4086a6,_0x58241c);};}exports[_0x933f('0x6')]=function(_0x49faad){for(var _0x7a7dc8=0x0,_0x3b0413=events[_0x933f('0x7')];_0x7a7dc8<_0x3b0413;_0x7a7dc8++){var _0x2e33f9=events[_0x7a7dc8];var _0x3c9c26=createListener(_0x933f('0x8')+_0x2e33f9,_0x49faad);VoiceQueueEvents['on'](_0x2e33f9,_0x3c9c26);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index dcaf14b..ebf7d90 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 _0x647f=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x647f,0xf7));var _0xf647=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x647f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xf647('0x0'));var path=require(_0xf647('0x1'));var timeout=require(_0xf647('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf647('0x3'));var auth=require(_0xf647('0x4'));var interaction=require(_0xf647('0x5'));var config=require(_0xf647('0x6'));var controller=require(_0xf647('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf647('0x8')]);router[_0xf647('0x9')](_0xf647('0xa'),auth['isAuthenticated'](),controller[_0xf647('0xb')]);router[_0xf647('0x9')]('/index',auth[_0xf647('0xc')](),controller['getVoiceQueuesReport']);router[_0xf647('0x9')](_0xf647('0xd'),auth[_0xf647('0xc')](),controller[_0xf647('0xe')]);router[_0xf647('0xf')]('/',auth['isAuthenticated'](),controller[_0xf647('0x10')]);router[_0xf647('0x11')](_0xf647('0xd'),auth[_0xf647('0xc')](),controller['update']);router[_0xf647('0x12')](_0xf647('0xd'),auth[_0xf647('0xc')](),controller[_0xf647('0x13')]);module[_0xf647('0x14')]=router; \ No newline at end of file +var _0xc730=['index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xc730,0x10b));var _0x0c73=function(_0x281678,_0x1dce9c){_0x281678=_0x281678-0x0;var _0x144fff=_0xc730[_0x281678];return _0x144fff;};'use strict';var multer=require(_0x0c73('0x0'));var util=require(_0x0c73('0x1'));var path=require(_0x0c73('0x2'));var timeout=require(_0x0c73('0x3'));var express=require(_0x0c73('0x4'));var router=express[_0x0c73('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c73('0x6'));var controller=require(_0x0c73('0x7'));router[_0x0c73('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c73('0x9')]);router['get'](_0x0c73('0xa'),auth[_0x0c73('0xb')](),controller[_0x0c73('0xc')]);router[_0x0c73('0x8')](_0x0c73('0xd'),auth[_0x0c73('0xb')](),controller[_0x0c73('0xe')]);router[_0x0c73('0x8')](_0x0c73('0xf'),auth[_0x0c73('0xb')](),controller[_0x0c73('0x10')]);router[_0x0c73('0x11')]('/',auth[_0x0c73('0xb')](),controller['create']);router[_0x0c73('0x12')]('/:id',auth[_0x0c73('0xb')](),controller[_0x0c73('0x13')]);router[_0x0c73('0x14')](_0x0c73('0xf'),auth[_0x0c73('0xb')](),controller[_0x0c73('0x15')]);module[_0x0c73('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 662df14..5b0a185 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 _0x950a=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x12caf7,_0x3f5aae){var _0x49ca0e=function(_0x4e420a){while(--_0x4e420a){_0x12caf7['push'](_0x12caf7['shift']());}};_0x49ca0e(++_0x3f5aae);}(_0x950a,0x1b8));var _0xa950=function(_0x46ae4b,_0x195c41){_0x46ae4b=_0x46ae4b-0x0;var _0x8aea66=_0x950a[_0x46ae4b];return _0x8aea66;};'use strict';var Sequelize=require(_0xa950('0x0'));var moment=require(_0xa950('0x1'));module[_0xa950('0x2')]={'type':{'type':Sequelize[_0xa950('0x3')]},'uniqueid':{'type':Sequelize[_0xa950('0x3')]},'calleridnum':{'type':Sequelize[_0xa950('0x3')]},'calleridname':{'type':Sequelize[_0xa950('0x3')]},'queue':{'type':Sequelize[_0xa950('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xa950('0x4')],'set':function(_0xcbbd4){var _0x1e6c50=moment(_0xcbbd4);var _0x12b047=moment(this[_0xa950('0x5')](_0xa950('0x6')))[_0xa950('0x7')](_0xa950('0x8'));var _0xda95a1=_0x1e6c50[_0xa950('0x9')](_0x12b047,_0xa950('0xa'));this[_0xa950('0xb')](_0xa950('0xc'),_0xcbbd4);this[_0xa950('0xb')]('holdtime',_0xda95a1||null);}},'position':{'type':Sequelize[_0xa950('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa950('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa950('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa950('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa950('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa950('0xf')},'originalposition':{'type':Sequelize[_0xa950('0xd')]},'channel':{'type':Sequelize[_0xa950('0x3')]},'connectedlinenum':{'type':Sequelize[_0xa950('0x3')]},'connectedlinename':{'type':Sequelize[_0xa950('0x3')]},'accountcode':{'type':Sequelize[_0xa950('0x3')]},'context':{'type':Sequelize[_0xa950('0x3')]},'exten':{'type':Sequelize[_0xa950('0x3')]},'priority':{'type':Sequelize[_0xa950('0x3')]},'holdtime':{'type':Sequelize[_0xa950('0xd')]},'mohtime':{'type':Sequelize[_0xa950('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa950('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa950('0x3')]},'transfer':{'type':Sequelize[_0xa950('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xa950('0x10')},'transferexten':{'type':Sequelize[_0xa950('0x3')]},'transferuniqueid':{'type':Sequelize[_0xa950('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa950('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa950('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x05b9=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13239e,_0x1ff4d4){var _0x558aef=function(_0x4f73ad){while(--_0x4f73ad){_0x13239e['push'](_0x13239e['shift']());}};_0x558aef(++_0x1ff4d4);}(_0x05b9,0x15d));var _0x905b=function(_0x2f506e,_0x2bef86){_0x2f506e=_0x2f506e-0x0;var _0x1a67b2=_0x05b9[_0x2f506e];return _0x1a67b2;};'use strict';var Sequelize=require(_0x905b('0x0'));var moment=require(_0x905b('0x1'));module[_0x905b('0x2')]={'type':{'type':Sequelize[_0x905b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x905b('0x3')]},'calleridname':{'type':Sequelize[_0x905b('0x3')]},'queue':{'type':Sequelize[_0x905b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x905b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x905b('0x4')],'set':function(_0x34e787){var _0x472ef9=moment(_0x34e787);var _0x1f63d1=moment(this[_0x905b('0x5')]('queuecallerjoinAt'))[_0x905b('0x6')](_0x905b('0x7'));var _0xb34c7f=_0x472ef9[_0x905b('0x8')](_0x1f63d1,_0x905b('0x9'));this[_0x905b('0xa')](_0x905b('0xb'),_0x34e787);this['setDataValue'](_0x905b('0xc'),_0xb34c7f||null);}},'position':{'type':Sequelize[_0x905b('0xd')]},'count':{'type':Sequelize[_0x905b('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x905b('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x905b('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x905b('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x905b('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x905b('0x3')],'comment':_0x905b('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x905b('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x905b('0x3')]},'accountcode':{'type':Sequelize[_0x905b('0x3')]},'context':{'type':Sequelize[_0x905b('0x3')]},'exten':{'type':Sequelize[_0x905b('0x3')]},'priority':{'type':Sequelize[_0x905b('0x3')]},'holdtime':{'type':Sequelize[_0x905b('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x905b('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x905b('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x905b('0x3')],'comment':_0x905b('0x10')},'transferexten':{'type':Sequelize[_0x905b('0x3')]},'transferuniqueid':{'type':Sequelize[_0x905b('0x3')]},'disposition':{'type':Sequelize[_0x905b('0x3')]},'secondDisposition':{'type':Sequelize[_0x905b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x905b('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 a2472b6..b9497ae 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 _0x6b68=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','fields','find','catch','create','body','describe','getVoiceQueuesReport','length','order','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2420c0,_0x3c95b2){var _0x498ef4=function(_0x599d8b){while(--_0x599d8b){_0x2420c0['push'](_0x2420c0['shift']());}};_0x498ef4(++_0x3c95b2);}(_0x6b68,0x96));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x86b6('0x0'));var rimraf=require(_0x86b6('0x1'));var zipdir=require(_0x86b6('0x2'));var jsonpatch=require(_0x86b6('0x3'));var rp=require('request-promise');var moment=require(_0x86b6('0x4'));var BPromise=require(_0x86b6('0x5'));var Mustache=require(_0x86b6('0x6'));var util=require('util');var path=require(_0x86b6('0x7'));var sox=require(_0x86b6('0x8'));var csv=require(_0x86b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86b6('0xa'));var squel=require(_0x86b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x86b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x86b6('0x9'));var querystring=require(_0x86b6('0xd'));var Papa=require(_0x86b6('0xe'));var Redis=require(_0x86b6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x86b6('0x10'));var as=require(_0x86b6('0x11'));var hardwareService=require(_0x86b6('0x12'));var logger=require(_0x86b6('0x13'))(_0x86b6('0x14'));var utils=require(_0x86b6('0x15'));var config=require(_0x86b6('0x16'));var licenseUtil=require(_0x86b6('0x17'));var db=require('../../mysqldb')['db'];config[_0x86b6('0x18')]=_[_0x86b6('0x19')](config['redis'],{'host':_0x86b6('0x1a'),'port':0x18eb});var socket=require(_0x86b6('0x1b'))(new Redis(config[_0x86b6('0x18')]));require('./voiceQueueReport.socket')[_0x86b6('0x1c')](socket);function respondWithStatusCode(_0x2c00fa,_0x16a3ec){_0x16a3ec=_0x16a3ec||0xcc;return function(_0x309b7a){if(_0x309b7a){return _0x2c00fa[_0x86b6('0x1d')](_0x16a3ec);}return _0x2c00fa[_0x86b6('0x1e')](_0x16a3ec)['end']();};}function respondWithResult(_0x3ed9b6,_0x5c0f60){_0x5c0f60=_0x5c0f60||0xc8;return function(_0x11a938){if(_0x11a938){return _0x3ed9b6[_0x86b6('0x1e')](_0x5c0f60)[_0x86b6('0x1f')](_0x11a938);}};}function respondWithFilteredResult(_0xb22a6,_0x560b56){return function(_0x9dca25){if(_0x9dca25){var _0x2c8f21=typeof _0x560b56[_0x86b6('0x20')]===_0x86b6('0x21')&&typeof _0x560b56[_0x86b6('0x22')]===_0x86b6('0x21');var _0x4c799d=_0x9dca25[_0x86b6('0x23')];var _0x19bb95=_0x2c8f21?0x0:_0x560b56[_0x86b6('0x20')];var _0x4afead=_0x2c8f21?_0x9dca25[_0x86b6('0x23')]:_0x560b56[_0x86b6('0x20')]+_0x560b56['limit'];var _0x2c2fe0;if(_0x4afead>=_0x4c799d){_0x4afead=_0x4c799d;_0x2c2fe0=0xc8;}else{_0x2c2fe0=0xce;}_0xb22a6[_0x86b6('0x1e')](_0x2c2fe0);return _0xb22a6[_0x86b6('0x24')](_0x86b6('0x25'),_0x19bb95+'-'+_0x4afead+'/'+_0x4c799d)['json'](_0x9dca25);}return null;};}function patchUpdates(_0x401d93){return function(_0x2544d1){try{jsonpatch[_0x86b6('0x26')](_0x2544d1,_0x401d93,!![]);}catch(_0x40a37a){return BPromise[_0x86b6('0x27')](_0x40a37a);}return _0x2544d1[_0x86b6('0x28')]();};}function saveUpdates(_0x3d09e6,_0x4a0de9){return function(_0x337fea){if(_0x337fea){return _0x337fea[_0x86b6('0x29')](_0x3d09e6)[_0x86b6('0x2a')](function(_0x38084d){return _0x38084d;});}return null;};}function removeEntity(_0x47ef76,_0x1ff3dc){return function(_0x153d4c){if(_0x153d4c){return _0x153d4c[_0x86b6('0x2b')]()[_0x86b6('0x2a')](function(){_0x47ef76['status'](0xcc)[_0x86b6('0x2c')]();});}};}function handleEntityNotFound(_0xbf80a6,_0x139d6d){return function(_0x26f2c8){if(!_0x26f2c8){_0xbf80a6[_0x86b6('0x1d')](0x194);}return _0x26f2c8;};}function handleError(_0x5baad1,_0x5e15ab){_0x5e15ab=_0x5e15ab||0x1f4;return function(_0x3cfeb4){logger[_0x86b6('0x2d')](_0x3cfeb4[_0x86b6('0x2e')]);if(_0x3cfeb4[_0x86b6('0x2f')]){delete _0x3cfeb4[_0x86b6('0x2f')];}_0x5baad1['status'](_0x5e15ab)[_0x86b6('0x30')](_0x3cfeb4);};}exports['index']=function(_0x5955b5,_0x613c8){var _0x93582e={},_0x4ca3a2={},_0x17d73d={'count':0x0,'rows':[]};var _0x46e6e1=_[_0x86b6('0x31')](db[_0x86b6('0x32')][_0x86b6('0x33')],function(_0x3bce2e){return{'name':_0x3bce2e[_0x86b6('0x34')],'type':_0x3bce2e[_0x86b6('0x35')]['key']};});_0x4ca3a2[_0x86b6('0x36')]=_[_0x86b6('0x31')](_0x46e6e1,_0x86b6('0x2f'));_0x4ca3a2[_0x86b6('0x37')]=_[_0x86b6('0x38')](_0x5955b5[_0x86b6('0x37')]);_0x4ca3a2['filters']=_[_0x86b6('0x39')](_0x4ca3a2['model'],_0x4ca3a2[_0x86b6('0x37')]);_0x93582e[_0x86b6('0x3a')]=_[_0x86b6('0x39')](_0x4ca3a2[_0x86b6('0x36')],qs['fields'](_0x5955b5[_0x86b6('0x37')]['fields']));_0x93582e[_0x86b6('0x3a')]=_0x93582e[_0x86b6('0x3a')]['length']?_0x93582e['attributes']:_0x4ca3a2[_0x86b6('0x36')];if(!_0x5955b5[_0x86b6('0x37')][_0x86b6('0x3b')](_0x86b6('0x3c'))){_0x93582e[_0x86b6('0x22')]=qs[_0x86b6('0x22')](_0x5955b5[_0x86b6('0x37')][_0x86b6('0x22')]);_0x93582e['offset']=qs[_0x86b6('0x20')](_0x5955b5[_0x86b6('0x37')][_0x86b6('0x20')]);}_0x93582e['order']=qs[_0x86b6('0x3d')](_0x5955b5[_0x86b6('0x37')]['sort']);_0x93582e[_0x86b6('0x3e')]=qs[_0x86b6('0x3f')](_[_0x86b6('0x40')](_0x5955b5[_0x86b6('0x37')],_0x4ca3a2[_0x86b6('0x3f')]),_0x46e6e1);if(_0x5955b5[_0x86b6('0x37')][_0x86b6('0x41')]){_0x93582e[_0x86b6('0x3e')]=_['merge'](_0x93582e[_0x86b6('0x3e')],{'$or':_['map'](_0x46e6e1,function(_0x490321){if(_0x490321[_0x86b6('0x35')]!==_0x86b6('0x42')){var _0x1a5f34={};_0x1a5f34[_0x490321[_0x86b6('0x2f')]]={'$like':'%'+_0x5955b5[_0x86b6('0x37')][_0x86b6('0x41')]+'%'};return _0x1a5f34;}})});}_0x93582e=_[_0x86b6('0x43')]({},_0x93582e,_0x5955b5[_0x86b6('0x44')]);var _0x492d44={'where':_0x93582e[_0x86b6('0x3e')]};return db[_0x86b6('0x32')][_0x86b6('0x23')](_0x492d44)[_0x86b6('0x2a')](function(_0x26c7b4){_0x17d73d['count']=_0x26c7b4;if(_0x5955b5[_0x86b6('0x37')]['includeAll']){_0x93582e[_0x86b6('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x86b6('0x46')](_0x93582e);})[_0x86b6('0x2a')](function(_0x1910a9){_0x17d73d[_0x86b6('0x47')]=_0x1910a9;return _0x17d73d;})[_0x86b6('0x2a')](respondWithFilteredResult(_0x613c8,_0x93582e))['catch'](handleError(_0x613c8,null));};exports[_0x86b6('0x48')]=function(_0x4f6ec6,_0x1a8650){var _0x308ab8={'raw':![],'where':{'id':_0x4f6ec6[_0x86b6('0x49')]['id']}},_0x435f1a={};_0x435f1a['model']=_['keys'](db[_0x86b6('0x32')][_0x86b6('0x33')]);_0x435f1a[_0x86b6('0x37')]=_[_0x86b6('0x38')](_0x4f6ec6[_0x86b6('0x37')]);_0x435f1a[_0x86b6('0x3f')]=_['intersection'](_0x435f1a[_0x86b6('0x36')],_0x435f1a[_0x86b6('0x37')]);_0x308ab8[_0x86b6('0x3a')]=_[_0x86b6('0x39')](_0x435f1a[_0x86b6('0x36')],qs[_0x86b6('0x4a')](_0x4f6ec6[_0x86b6('0x37')][_0x86b6('0x4a')]));_0x308ab8['attributes']=_0x308ab8[_0x86b6('0x3a')]['length']?_0x308ab8[_0x86b6('0x3a')]:_0x435f1a[_0x86b6('0x36')];if(_0x4f6ec6[_0x86b6('0x37')]['includeAll']){_0x308ab8[_0x86b6('0x45')]=[{'all':!![]}];}_0x308ab8=_[_0x86b6('0x43')]({},_0x308ab8,_0x4f6ec6[_0x86b6('0x44')]);return db[_0x86b6('0x32')][_0x86b6('0x4b')](_0x308ab8)[_0x86b6('0x2a')](handleEntityNotFound(_0x1a8650,null))[_0x86b6('0x2a')](respondWithResult(_0x1a8650,null))[_0x86b6('0x4c')](handleError(_0x1a8650,null));};exports[_0x86b6('0x4d')]=function(_0x458898,_0x5901ca){return db[_0x86b6('0x32')][_0x86b6('0x4d')](_0x458898['body'],{})[_0x86b6('0x2a')](respondWithResult(_0x5901ca,0xc9))['catch'](handleError(_0x5901ca,null));};exports['update']=function(_0x24e6d1,_0x3aa0ef){if(_0x24e6d1[_0x86b6('0x4e')]['id']){delete _0x24e6d1[_0x86b6('0x4e')]['id'];}return db[_0x86b6('0x32')][_0x86b6('0x4b')]({'where':{'id':_0x24e6d1[_0x86b6('0x49')]['id']}})['then'](handleEntityNotFound(_0x3aa0ef,null))[_0x86b6('0x2a')](saveUpdates(_0x24e6d1[_0x86b6('0x4e')],null))['then'](respondWithResult(_0x3aa0ef,null))[_0x86b6('0x4c')](handleError(_0x3aa0ef,null));};exports[_0x86b6('0x2b')]=function(_0x1b6c32,_0x46153b){return db['VoiceQueueReport'][_0x86b6('0x4b')]({'where':{'id':_0x1b6c32[_0x86b6('0x49')]['id']}})['then'](handleEntityNotFound(_0x46153b,null))[_0x86b6('0x2a')](removeEntity(_0x46153b,null))['catch'](handleError(_0x46153b,null));};exports[_0x86b6('0x4f')]=function(_0x1f40be,_0x594c9f){return db[_0x86b6('0x32')][_0x86b6('0x4f')]()[_0x86b6('0x2a')](respondWithResult(_0x594c9f,null))['catch'](handleError(_0x594c9f,null));};exports[_0x86b6('0x50')]=function(_0x44888c,_0x102cd1){var _0xba4672={},_0x392fdc={},_0x17d708={'count':0x0,'rows':[]};_0x392fdc[_0x86b6('0x36')]=_['keys'](db[_0x86b6('0x32')][_0x86b6('0x33')]);_0x392fdc[_0x86b6('0x37')]=_[_0x86b6('0x38')](_0x44888c[_0x86b6('0x37')]);_0x392fdc[_0x86b6('0x3f')]=_[_0x86b6('0x39')](_0x392fdc[_0x86b6('0x36')],_0x392fdc[_0x86b6('0x37')]);_0xba4672[_0x86b6('0x3a')]=_[_0x86b6('0x39')](_0x392fdc[_0x86b6('0x36')],qs[_0x86b6('0x4a')](_0x44888c[_0x86b6('0x37')]['fields']));_0xba4672[_0x86b6('0x3a')]=_0xba4672[_0x86b6('0x3a')][_0x86b6('0x51')]?_0xba4672[_0x86b6('0x3a')]:_0x392fdc[_0x86b6('0x36')];if(!_0x44888c[_0x86b6('0x37')]['hasOwnProperty'](_0x86b6('0x3c'))){_0xba4672[_0x86b6('0x22')]=qs[_0x86b6('0x22')](_0x44888c[_0x86b6('0x37')][_0x86b6('0x22')]);_0xba4672[_0x86b6('0x20')]=qs[_0x86b6('0x20')](_0x44888c[_0x86b6('0x37')][_0x86b6('0x20')]);}_0xba4672[_0x86b6('0x52')]=qs['sort'](_0x44888c['query']['sort']);_0xba4672['where']=qs[_0x86b6('0x3f')](_['pick'](_0x44888c[_0x86b6('0x37')],_0x392fdc[_0x86b6('0x3f')]));if(_0x44888c[_0x86b6('0x37')]['filter']){_0xba4672[_0x86b6('0x3e')]=_[_0x86b6('0x43')](_0xba4672['where'],{'$or':_[_0x86b6('0x31')](_0xba4672['attributes'],function(_0xe5f255){var _0x333dc7={};_0x333dc7[_0xe5f255]={'$like':'%'+_0x44888c['query']['filter']+'%'};return _0x333dc7;})});}_0xba4672=_[_0x86b6('0x43')]({},_0xba4672,_0x44888c[_0x86b6('0x44')]);var _0x419973={'where':_0xba4672[_0x86b6('0x3e')]};return db[_0x86b6('0x32')][_0x86b6('0x23')](_0x419973)[_0x86b6('0x2a')](function(_0x5d6fa4){_0x17d708[_0x86b6('0x23')]=_0x5d6fa4;if(_0x44888c[_0x86b6('0x37')][_0x86b6('0x53')]){_0xba4672['include']=[{'all':!![]}];}return db[_0x86b6('0x32')][_0x86b6('0x46')](_0xba4672);})['then'](function(_0x3d7caa){_0x17d708[_0x86b6('0x47')]=_0x3d7caa;return _0x17d708;})[_0x86b6('0x2a')](respondWithFilteredResult(_0x102cd1,_0xba4672,'getVoiceQueuesReport'))['catch'](handleError(_0x102cd1,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x0df7=['VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','hasOwnProperty','pick','findAll','fast-json-patch','request-promise','moment','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','name','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge'];(function(_0x554d96,_0x552fb5){var _0x558b33=function(_0x45ef3d){while(--_0x45ef3d){_0x554d96['push'](_0x554d96['shift']());}};_0x558b33(++_0x552fb5);}(_0x0df7,0x13d));var _0x70df=function(_0x19a90a,_0x2e3aef){_0x19a90a=_0x19a90a-0x0;var _0x1abe5d=_0x0df7[_0x19a90a];return _0x1abe5d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x70df('0x0'));var rp=require(_0x70df('0x1'));var moment=require(_0x70df('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x70df('0x3'));var util=require(_0x70df('0x4'));var path=require(_0x70df('0x5'));var sox=require(_0x70df('0x6'));var csv=require(_0x70df('0x7'));var ejs=require(_0x70df('0x8'));var fs=require('fs');var fs_extra=require(_0x70df('0x9'));var _=require(_0x70df('0xa'));var squel=require(_0x70df('0xb'));var crypto=require(_0x70df('0xc'));var jsforce=require(_0x70df('0xd'));var deskjs=require(_0x70df('0xe'));var toCsv=require(_0x70df('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70df('0xf'));var qs=require(_0x70df('0x10'));var as=require(_0x70df('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70df('0x12'))(_0x70df('0x13'));var utils=require(_0x70df('0x14'));var config=require(_0x70df('0x15'));var licenseUtil=require(_0x70df('0x16'));var db=require('../../mysqldb')['db'];config[_0x70df('0x17')]=_[_0x70df('0x18')](config[_0x70df('0x17')],{'host':_0x70df('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x70df('0x1a')](socket);function respondWithStatusCode(_0x1b2617,_0x53abe5){_0x53abe5=_0x53abe5||0xcc;return function(_0x4ff4eb){if(_0x4ff4eb){return _0x1b2617[_0x70df('0x1b')](_0x53abe5);}return _0x1b2617[_0x70df('0x1c')](_0x53abe5)[_0x70df('0x1d')]();};}function respondWithResult(_0x4f4ed1,_0x3ed5e3){_0x3ed5e3=_0x3ed5e3||0xc8;return function(_0x39c97a){if(_0x39c97a){return _0x4f4ed1[_0x70df('0x1c')](_0x3ed5e3)[_0x70df('0x1e')](_0x39c97a);}};}function respondWithFilteredResult(_0x3c8042,_0x43c1d2){return function(_0x3f1729){if(_0x3f1729){var _0x264d87=typeof _0x43c1d2['offset']===_0x70df('0x1f')&&typeof _0x43c1d2[_0x70df('0x20')]===_0x70df('0x1f');var _0xb6374c=_0x3f1729[_0x70df('0x21')];var _0x24e602=_0x264d87?0x0:_0x43c1d2[_0x70df('0x22')];var _0x38641c=_0x264d87?_0x3f1729[_0x70df('0x21')]:_0x43c1d2[_0x70df('0x22')]+_0x43c1d2[_0x70df('0x20')];var _0xefad0;if(_0x38641c>=_0xb6374c){_0x38641c=_0xb6374c;_0xefad0=0xc8;}else{_0xefad0=0xce;}_0x3c8042[_0x70df('0x1c')](_0xefad0);return _0x3c8042[_0x70df('0x23')](_0x70df('0x24'),_0x24e602+'-'+_0x38641c+'/'+_0xb6374c)[_0x70df('0x1e')](_0x3f1729);}return null;};}function patchUpdates(_0x51e34d){return function(_0xa1b9c3){try{jsonpatch[_0x70df('0x25')](_0xa1b9c3,_0x51e34d,!![]);}catch(_0x163a19){return BPromise[_0x70df('0x26')](_0x163a19);}return _0xa1b9c3['save']();};}function saveUpdates(_0x2971cf,_0x2080d0){return function(_0x94eae9){if(_0x94eae9){return _0x94eae9[_0x70df('0x27')](_0x2971cf)['then'](function(_0x54e9e1){return _0x54e9e1;});}return null;};}function removeEntity(_0x837d56,_0x57c8aa){return function(_0x44790b){if(_0x44790b){return _0x44790b[_0x70df('0x28')]()[_0x70df('0x29')](function(){_0x837d56[_0x70df('0x1c')](0xcc)[_0x70df('0x1d')]();});}};}function handleEntityNotFound(_0x5d8e19,_0x5da392){return function(_0x7ace90){if(!_0x7ace90){_0x5d8e19[_0x70df('0x1b')](0x194);}return _0x7ace90;};}function handleError(_0x4e1958,_0x3145ad){_0x3145ad=_0x3145ad||0x1f4;return function(_0x26c84d){logger[_0x70df('0x2a')](_0x26c84d['stack']);if(_0x26c84d[_0x70df('0x2b')]){delete _0x26c84d['name'];}_0x4e1958['status'](_0x3145ad)['send'](_0x26c84d);};}exports[_0x70df('0x2c')]=function(_0x5aa037,_0xe04905){var _0x396a8e={},_0x1ce86d={},_0x78f533={'count':0x0,'rows':[]};var _0x2a44e0=_[_0x70df('0x2d')](db[_0x70df('0x2e')][_0x70df('0x2f')],function(_0x2d2f6f){return{'name':_0x2d2f6f['fieldName'],'type':_0x2d2f6f[_0x70df('0x30')][_0x70df('0x31')]};});_0x1ce86d[_0x70df('0x32')]=_[_0x70df('0x2d')](_0x2a44e0,_0x70df('0x2b'));_0x1ce86d[_0x70df('0x33')]=_[_0x70df('0x34')](_0x5aa037[_0x70df('0x33')]);_0x1ce86d[_0x70df('0x35')]=_[_0x70df('0x36')](_0x1ce86d[_0x70df('0x32')],_0x1ce86d[_0x70df('0x33')]);_0x396a8e[_0x70df('0x37')]=_['intersection'](_0x1ce86d[_0x70df('0x32')],qs[_0x70df('0x38')](_0x5aa037[_0x70df('0x33')][_0x70df('0x38')]));_0x396a8e['attributes']=_0x396a8e[_0x70df('0x37')]['length']?_0x396a8e[_0x70df('0x37')]:_0x1ce86d['model'];if(!_0x5aa037[_0x70df('0x33')]['hasOwnProperty'](_0x70df('0x39'))){_0x396a8e[_0x70df('0x20')]=qs[_0x70df('0x20')](_0x5aa037['query'][_0x70df('0x20')]);_0x396a8e[_0x70df('0x22')]=qs[_0x70df('0x22')](_0x5aa037[_0x70df('0x33')][_0x70df('0x22')]);}_0x396a8e[_0x70df('0x3a')]=qs[_0x70df('0x3b')](_0x5aa037[_0x70df('0x33')][_0x70df('0x3b')]);_0x396a8e[_0x70df('0x3c')]=qs[_0x70df('0x35')](_['pick'](_0x5aa037[_0x70df('0x33')],_0x1ce86d[_0x70df('0x35')]),_0x2a44e0);if(_0x5aa037[_0x70df('0x33')][_0x70df('0x3d')]){_0x396a8e[_0x70df('0x3c')]=_[_0x70df('0x3e')](_0x396a8e[_0x70df('0x3c')],{'$or':_['map'](_0x2a44e0,function(_0x2765b7){if(_0x2765b7[_0x70df('0x30')]!==_0x70df('0x3f')){var _0x307997={};_0x307997[_0x2765b7[_0x70df('0x2b')]]={'$like':'%'+_0x5aa037[_0x70df('0x33')][_0x70df('0x3d')]+'%'};return _0x307997;}})});}_0x396a8e=_[_0x70df('0x3e')]({},_0x396a8e,_0x5aa037[_0x70df('0x40')]);var _0x36afeb={'where':_0x396a8e[_0x70df('0x3c')]};return db[_0x70df('0x2e')][_0x70df('0x21')](_0x36afeb)[_0x70df('0x29')](function(_0x5f7e7a){_0x78f533[_0x70df('0x21')]=_0x5f7e7a;if(_0x5aa037[_0x70df('0x33')][_0x70df('0x41')]){_0x396a8e['include']=[{'all':!![]}];}return db[_0x70df('0x2e')]['findAll'](_0x396a8e);})[_0x70df('0x29')](function(_0x14daf6){_0x78f533[_0x70df('0x42')]=_0x14daf6;return _0x78f533;})[_0x70df('0x29')](respondWithFilteredResult(_0xe04905,_0x396a8e))['catch'](handleError(_0xe04905,null));};exports[_0x70df('0x43')]=function(_0x90ad08,_0x2f5344){var _0x23a5af={'raw':![],'where':{'id':_0x90ad08[_0x70df('0x44')]['id']}},_0x5b8d37={};_0x5b8d37[_0x70df('0x32')]=_['keys'](db['VoiceQueueReport'][_0x70df('0x2f')]);_0x5b8d37[_0x70df('0x33')]=_['keys'](_0x90ad08[_0x70df('0x33')]);_0x5b8d37[_0x70df('0x35')]=_['intersection'](_0x5b8d37[_0x70df('0x32')],_0x5b8d37[_0x70df('0x33')]);_0x23a5af[_0x70df('0x37')]=_[_0x70df('0x36')](_0x5b8d37['model'],qs['fields'](_0x90ad08['query'][_0x70df('0x38')]));_0x23a5af[_0x70df('0x37')]=_0x23a5af['attributes']['length']?_0x23a5af[_0x70df('0x37')]:_0x5b8d37['model'];if(_0x90ad08['query'][_0x70df('0x41')]){_0x23a5af[_0x70df('0x45')]=[{'all':!![]}];}_0x23a5af=_[_0x70df('0x3e')]({},_0x23a5af,_0x90ad08[_0x70df('0x40')]);return db[_0x70df('0x2e')]['find'](_0x23a5af)[_0x70df('0x29')](handleEntityNotFound(_0x2f5344,null))[_0x70df('0x29')](respondWithResult(_0x2f5344,null))[_0x70df('0x46')](handleError(_0x2f5344,null));};exports[_0x70df('0x47')]=function(_0x52a868,_0x2412e5){return db['VoiceQueueReport'][_0x70df('0x47')](_0x52a868[_0x70df('0x48')],{})[_0x70df('0x29')](respondWithResult(_0x2412e5,0xc9))[_0x70df('0x46')](handleError(_0x2412e5,null));};exports['update']=function(_0x4fe7f1,_0x31ed18){if(_0x4fe7f1[_0x70df('0x48')]['id']){delete _0x4fe7f1[_0x70df('0x48')]['id'];}return db[_0x70df('0x2e')]['find']({'where':{'id':_0x4fe7f1[_0x70df('0x44')]['id']}})[_0x70df('0x29')](handleEntityNotFound(_0x31ed18,null))[_0x70df('0x29')](saveUpdates(_0x4fe7f1[_0x70df('0x48')],null))['then'](respondWithResult(_0x31ed18,null))['catch'](handleError(_0x31ed18,null));};exports[_0x70df('0x28')]=function(_0x1b61b8,_0x1a4b37){return db['VoiceQueueReport']['find']({'where':{'id':_0x1b61b8[_0x70df('0x44')]['id']}})[_0x70df('0x29')](handleEntityNotFound(_0x1a4b37,null))['then'](removeEntity(_0x1a4b37,null))[_0x70df('0x46')](handleError(_0x1a4b37,null));};exports['describe']=function(_0x3109bf,_0x519c5d){return db[_0x70df('0x2e')]['describe']()[_0x70df('0x29')](respondWithResult(_0x519c5d,null))[_0x70df('0x46')](handleError(_0x519c5d,null));};exports['getVoiceQueuesReport']=function(_0x332d7f,_0x45f329){var _0x42173e={},_0x316c06={},_0x381ceb={'count':0x0,'rows':[]};_0x316c06['model']=_[_0x70df('0x34')](db[_0x70df('0x2e')][_0x70df('0x2f')]);_0x316c06[_0x70df('0x33')]=_['keys'](_0x332d7f['query']);_0x316c06[_0x70df('0x35')]=_[_0x70df('0x36')](_0x316c06[_0x70df('0x32')],_0x316c06[_0x70df('0x33')]);_0x42173e[_0x70df('0x37')]=_['intersection'](_0x316c06[_0x70df('0x32')],qs[_0x70df('0x38')](_0x332d7f[_0x70df('0x33')]['fields']));_0x42173e[_0x70df('0x37')]=_0x42173e[_0x70df('0x37')]['length']?_0x42173e[_0x70df('0x37')]:_0x316c06[_0x70df('0x32')];if(!_0x332d7f[_0x70df('0x33')][_0x70df('0x49')]('nolimit')){_0x42173e['limit']=qs[_0x70df('0x20')](_0x332d7f[_0x70df('0x33')][_0x70df('0x20')]);_0x42173e['offset']=qs[_0x70df('0x22')](_0x332d7f[_0x70df('0x33')]['offset']);}_0x42173e[_0x70df('0x3a')]=qs['sort'](_0x332d7f[_0x70df('0x33')][_0x70df('0x3b')]);_0x42173e['where']=qs[_0x70df('0x35')](_[_0x70df('0x4a')](_0x332d7f['query'],_0x316c06[_0x70df('0x35')]));if(_0x332d7f['query'][_0x70df('0x3d')]){_0x42173e[_0x70df('0x3c')]=_[_0x70df('0x3e')](_0x42173e['where'],{'$or':_['map'](_0x42173e[_0x70df('0x37')],function(_0x330fe7){var _0xa7ec8b={};_0xa7ec8b[_0x330fe7]={'$like':'%'+_0x332d7f[_0x70df('0x33')][_0x70df('0x3d')]+'%'};return _0xa7ec8b;})});}_0x42173e=_[_0x70df('0x3e')]({},_0x42173e,_0x332d7f[_0x70df('0x40')]);var _0x44b758={'where':_0x42173e[_0x70df('0x3c')]};return db[_0x70df('0x2e')]['count'](_0x44b758)[_0x70df('0x29')](function(_0x32cfc3){_0x381ceb['count']=_0x32cfc3;if(_0x332d7f['query'][_0x70df('0x41')]){_0x42173e[_0x70df('0x45')]=[{'all':!![]}];}return db[_0x70df('0x2e')][_0x70df('0x4b')](_0x42173e);})[_0x70df('0x29')](function(_0x1f5d82){_0x381ceb['rows']=_0x1f5d82;return _0x381ceb;})[_0x70df('0x29')](respondWithFilteredResult(_0x45f329,_0x42173e,'getVoiceQueuesReport'))['catch'](handleError(_0x45f329,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b8066b2..a61efbf 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 _0x786d=['hasOwnProperty','hook','VoiceQueueReport','setMaxListeners','update','emit'];(function(_0x3ea9da,_0xb6e69){var _0x57d495=function(_0x381e00){while(--_0x381e00){_0x3ea9da['push'](_0x3ea9da['shift']());}};_0x57d495(++_0xb6e69);}(_0x786d,0x1d6));var _0xd786=function(_0x288d86,_0x1e292e){_0x288d86=_0x288d86-0x0;var _0x22482f=_0x786d[_0x288d86];return _0x22482f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0xd786('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd786('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd786('0x2'),'afterDestroy':'remove'};function emitEvent(_0x424a25){return function(_0x204b21,_0x5ce946,_0x34d07d){VoiceQueueReportEvents['emit'](_0x424a25+':'+_0x204b21['id'],_0x204b21);VoiceQueueReportEvents[_0xd786('0x3')](_0x424a25,_0x204b21);_0x34d07d(null);};}for(var e in events){if(events[_0xd786('0x4')](e)){var event=events[e];VoiceQueueReport[_0xd786('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x39a7=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x39a7,0x1aa));var _0x739a=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0x39a7[_0x2336ea];return _0x216bf9;};'use strict';var EventEmitter=require(_0x739a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x739a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x739a('0x2')};function emitEvent(_0x131844){return function(_0x40ed90,_0x123956,_0x5420f4){VoiceQueueReportEvents[_0x739a('0x3')](_0x131844+':'+_0x40ed90['id'],_0x40ed90);VoiceQueueReportEvents[_0x739a('0x3')](_0x131844,_0x40ed90);_0x5420f4(null);};}for(var e in events){if(events[_0x739a('0x4')](e)){var event=events[e];VoiceQueueReport[_0x739a('0x5')](e,emitEvent(event));}}module[_0x739a('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index da3b407..71a7deb 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 _0x6ce6=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x266151,_0x12c083){var _0x4c2a3a=function(_0x2d730d){while(--_0x2d730d){_0x266151['push'](_0x266151['shift']());}};_0x4c2a3a(++_0x12c083);}(_0x6ce6,0x145));var _0x66ce=function(_0x29292e,_0x45dea0){_0x29292e=_0x29292e-0x0;var _0x5b6756=_0x6ce6[_0x29292e];return _0x5b6756;};'use strict';var _=require(_0x66ce('0x0'));var util=require(_0x66ce('0x1'));var logger=require(_0x66ce('0x2'))(_0x66ce('0x3'));var moment=require(_0x66ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x66ce('0x5'));var fs=require('fs');var path=require(_0x66ce('0x6'));var rimraf=require('rimraf');var config=require(_0x66ce('0x7'));var attributes=require(_0x66ce('0x8'));module[_0x66ce('0x9')]=function(_0x54627e,_0x50e99f){return _0x54627e[_0x66ce('0xa')](_0x66ce('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x66ce('0xc')]},{'fields':[_0x66ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29d4=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x57aa1a,_0xd85bfd){var _0x4374c9=function(_0x429024){while(--_0x429024){_0x57aa1a['push'](_0x57aa1a['shift']());}};_0x4374c9(++_0xd85bfd);}(_0x29d4,0x1a1));var _0x429d=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x29d4[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x429d('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3a72904..94d40a1 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 _0x244e=['../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','raw','options','where','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x244e,0x193));var _0xe244=function(_0x548d14,_0xd18a2f){_0x548d14=_0x548d14-0x0;var _0x22ed08=_0x244e[_0x548d14];return _0x22ed08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe244('0x0'));var BPromise=require('bluebird');var rs=require(_0xe244('0x1'));var fs=require('fs');var Redis=require(_0xe244('0x2'));var db=require(_0xe244('0x3'))['db'];var utils=require(_0xe244('0x4'));var logger=require(_0xe244('0x5'))(_0xe244('0x6'));var config=require(_0xe244('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe244('0x8')][_0xe244('0x9')]({'port':0x232a});config[_0xe244('0xa')]=_[_0xe244('0xb')](config['redis'],{'host':_0xe244('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe244('0xa')]));require('./voiceQueueReport.socket')[_0xe244('0xd')](socket);function respondWithRpcPromise(_0x28ea72,_0x423751,_0x217f37){return new BPromise(function(_0x39c4b5,_0x58cec0){return client[_0xe244('0xe')](_0x28ea72,_0x217f37)[_0xe244('0xf')](function(_0x1cf447){logger[_0xe244('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x423751,_0xe244('0x11'));logger[_0xe244('0x12')](_0xe244('0x13'),_0x423751,_0xe244('0x11'),JSON[_0xe244('0x14')](_0x1cf447));if(_0x1cf447[_0xe244('0x15')]){if(_0x1cf447[_0xe244('0x15')]['code']===0x1f4){logger[_0xe244('0x15')](_0xe244('0x16'),_0x423751,_0x1cf447[_0xe244('0x15')]['message']);return _0x58cec0(_0x1cf447[_0xe244('0x15')][_0xe244('0x17')]);}logger[_0xe244('0x15')](_0xe244('0x16'),_0x423751,_0x1cf447['error'][_0xe244('0x17')]);return _0x39c4b5(_0x1cf447[_0xe244('0x15')]['message']);}else{logger[_0xe244('0x10')](_0xe244('0x16'),_0x423751,'request\x20sent');_0x39c4b5(_0x1cf447[_0xe244('0x18')][_0xe244('0x17')]);}})[_0xe244('0x19')](function(_0x5a0f2a){logger[_0xe244('0x15')](_0xe244('0x16'),_0x423751,_0x5a0f2a);_0x58cec0(_0x5a0f2a);});});}exports[_0xe244('0x1a')]=function(_0x109a0a){var _0x32c591=this;return new Promise(function(_0x19a86b,_0x407c13){return db[_0xe244('0x1b')]['findAll']({'raw':_0x109a0a['options']?_0x109a0a['options'][_0xe244('0x1c')]===undefined?!![]:![]:!![],'where':_0x109a0a[_0xe244('0x1d')]?_0x109a0a[_0xe244('0x1d')][_0xe244('0x1e')]||null:null,'attributes':_0x109a0a[_0xe244('0x1d')]?_0x109a0a['options'][_0xe244('0x1f')]||null:null,'limit':_0x109a0a['options']?_0x109a0a[_0xe244('0x1d')][_0xe244('0x20')]||null:null,'include':_0x109a0a[_0xe244('0x1d')]?_0x109a0a[_0xe244('0x1d')]['include']?_['map'](_0x109a0a[_0xe244('0x1d')][_0xe244('0x21')],function(_0x1b3321){return{'model':db[_0x1b3321[_0xe244('0x22')]],'as':_0x1b3321['as'],'attributes':_0x1b3321[_0xe244('0x1f')],'include':_0x1b3321[_0xe244('0x21')]?_[_0xe244('0x23')](_0x1b3321['include'],function(_0x25d880){return{'model':db[_0x25d880['model']],'as':_0x25d880['as'],'attributes':_0x25d880[_0xe244('0x1f')],'include':_0x25d880[_0xe244('0x21')]?_[_0xe244('0x23')](_0x25d880[_0xe244('0x21')],function(_0x13511f){return{'model':db[_0x13511f[_0xe244('0x22')]],'as':_0x13511f['as'],'attributes':_0x13511f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe244('0xf')](function(_0x144498){logger[_0xe244('0x10')](_0xe244('0x1a'),_0x109a0a);logger['debug'](_0xe244('0x1a'),_0x109a0a,JSON['stringify'](_0x144498));_0x19a86b(_0x144498);})['catch'](function(_0x3c106b){logger['error'](_0xe244('0x1a'),_0x3c106b['message'],_0x109a0a);_0x407c13(_0x32c591[_0xe244('0x15')](0x1f4,_0x3c106b[_0xe244('0x17')]));});});};exports[_0xe244('0x24')]=function(_0x37901a){var _0x153040=this;return new Promise(function(_0x5ca127,_0x631d05){return db['VoiceQueueReport'][_0xe244('0x25')](_0x37901a[_0xe244('0x26')],{'raw':_0x37901a[_0xe244('0x1d')]?_0x37901a[_0xe244('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xe244('0xf')](function(_0x108089){logger[_0xe244('0x10')](_0xe244('0x24'),_0x37901a);logger[_0xe244('0x12')](_0xe244('0x24'),_0x37901a,JSON[_0xe244('0x14')](_0x108089));_0x5ca127(_0x108089);})[_0xe244('0x19')](function(_0x4362a6){logger[_0xe244('0x15')](_0xe244('0x24'),_0x4362a6[_0xe244('0x17')],_0x37901a);_0x631d05(_0x153040[_0xe244('0x15')](0x1f4,_0x4362a6['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x21cfba){var _0x24dbff=this;return new Promise(function(_0x1ee976,_0x27001a){return db[_0xe244('0x1b')][_0xe244('0x27')](_0x21cfba['body'],{'raw':_0x21cfba[_0xe244('0x1d')]?_0x21cfba[_0xe244('0x1d')][_0xe244('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21cfba['options']?_0x21cfba[_0xe244('0x1d')][_0xe244('0x1e')]||null:null,'attributes':_0x21cfba['options']?_0x21cfba[_0xe244('0x1d')][_0xe244('0x1f')]||null:null,'limit':_0x21cfba[_0xe244('0x1d')]?_0x21cfba['options'][_0xe244('0x20')]||null:null})['then'](function(_0x59e4bb){logger[_0xe244('0x10')]('UpdateVoiceQueueReport',_0x21cfba);logger[_0xe244('0x12')](_0xe244('0x28'),_0x21cfba,JSON[_0xe244('0x14')](_0x59e4bb));_0x1ee976(_0x59e4bb);})['catch'](function(_0x1ff71c){logger[_0xe244('0x15')](_0xe244('0x28'),_0x1ff71c['message'],_0x21cfba);_0x27001a(_0x24dbff[_0xe244('0x15')](0x1f4,_0x1ff71c[_0xe244('0x17')]));});});}; \ No newline at end of file +var _0x03bc=['where','attributes','include','map','model','GetVoiceQueueReport','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','findAll','options','raw'];(function(_0x2ff064,_0x194717){var _0x429dbb=function(_0x25039b){while(--_0x25039b){_0x2ff064['push'](_0x2ff064['shift']());}};_0x429dbb(++_0x194717);}(_0x03bc,0xbd));var _0xc03b=function(_0x53dbf7,_0x4953cc){_0x53dbf7=_0x53dbf7-0x0;var _0x543510=_0x03bc[_0x53dbf7];return _0x543510;};'use strict';var _=require(_0xc03b('0x0'));var util=require(_0xc03b('0x1'));var moment=require(_0xc03b('0x2'));var BPromise=require(_0xc03b('0x3'));var rs=require(_0xc03b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc03b('0x5'))['db'];var utils=require(_0xc03b('0x6'));var logger=require(_0xc03b('0x7'))(_0xc03b('0x8'));var config=require(_0xc03b('0x9'));var jayson=require(_0xc03b('0xa'));var client=jayson[_0xc03b('0xb')][_0xc03b('0xc')]({'port':0x232a});config[_0xc03b('0xd')]=_[_0xc03b('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc03b('0xf'))(new Redis(config[_0xc03b('0xd')]));require('./voiceQueueReport.socket')[_0xc03b('0x10')](socket);function respondWithRpcPromise(_0x17af40,_0x87d540,_0x53f365){return new BPromise(function(_0x5ded1a,_0x46fe90){return client[_0xc03b('0x11')](_0x17af40,_0x53f365)[_0xc03b('0x12')](function(_0x115f48){logger[_0xc03b('0x13')](_0xc03b('0x14'),_0x87d540,_0xc03b('0x15'));logger[_0xc03b('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x87d540,_0xc03b('0x15'),JSON[_0xc03b('0x17')](_0x115f48));if(_0x115f48['error']){if(_0x115f48[_0xc03b('0x18')][_0xc03b('0x19')]===0x1f4){logger['error'](_0xc03b('0x14'),_0x87d540,_0x115f48[_0xc03b('0x18')]['message']);return _0x46fe90(_0x115f48[_0xc03b('0x18')]['message']);}logger[_0xc03b('0x18')](_0xc03b('0x14'),_0x87d540,_0x115f48[_0xc03b('0x18')]['message']);return _0x5ded1a(_0x115f48[_0xc03b('0x18')][_0xc03b('0x1a')]);}else{logger[_0xc03b('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x87d540,_0xc03b('0x15'));_0x5ded1a(_0x115f48['result']['message']);}})[_0xc03b('0x1b')](function(_0x2337f7){logger[_0xc03b('0x18')](_0xc03b('0x14'),_0x87d540,_0x2337f7);_0x46fe90(_0x2337f7);});});}exports['GetVoiceQueueReport']=function(_0x2810e5){var _0x26ecb7=this;return new Promise(function(_0x4d4dfb,_0x4b1909){return db['VoiceQueueReport'][_0xc03b('0x1c')]({'raw':_0x2810e5[_0xc03b('0x1d')]?_0x2810e5['options'][_0xc03b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2810e5[_0xc03b('0x1d')]?_0x2810e5[_0xc03b('0x1d')][_0xc03b('0x1f')]||null:null,'attributes':_0x2810e5[_0xc03b('0x1d')]?_0x2810e5['options'][_0xc03b('0x20')]||null:null,'limit':_0x2810e5[_0xc03b('0x1d')]?_0x2810e5[_0xc03b('0x1d')]['limit']||null:null,'include':_0x2810e5['options']?_0x2810e5[_0xc03b('0x1d')][_0xc03b('0x21')]?_[_0xc03b('0x22')](_0x2810e5[_0xc03b('0x1d')][_0xc03b('0x21')],function(_0x35a870){return{'model':db[_0x35a870['model']],'as':_0x35a870['as'],'attributes':_0x35a870[_0xc03b('0x20')],'include':_0x35a870[_0xc03b('0x21')]?_['map'](_0x35a870[_0xc03b('0x21')],function(_0x3fbf5a){return{'model':db[_0x3fbf5a[_0xc03b('0x23')]],'as':_0x3fbf5a['as'],'attributes':_0x3fbf5a['attributes'],'include':_0x3fbf5a['include']?_['map'](_0x3fbf5a['include'],function(_0x551b4c){return{'model':db[_0x551b4c[_0xc03b('0x23')]],'as':_0x551b4c['as'],'attributes':_0x551b4c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc03b('0x12')](function(_0x19fe71){logger['info']('GetVoiceQueueReport',_0x2810e5);logger[_0xc03b('0x16')]('GetVoiceQueueReport',_0x2810e5,JSON['stringify'](_0x19fe71));_0x4d4dfb(_0x19fe71);})['catch'](function(_0x32a658){logger[_0xc03b('0x18')](_0xc03b('0x24'),_0x32a658[_0xc03b('0x1a')],_0x2810e5);_0x4b1909(_0x26ecb7[_0xc03b('0x18')](0x1f4,_0x32a658[_0xc03b('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x3e1f04){var _0x21af17=this;return new Promise(function(_0x1a861b,_0x33e0d0){return db[_0xc03b('0x25')][_0xc03b('0x26')](_0x3e1f04[_0xc03b('0x27')],{'raw':_0x3e1f04[_0xc03b('0x1d')]?_0x3e1f04[_0xc03b('0x1d')][_0xc03b('0x1e')]===undefined?!![]:![]:!![]})[_0xc03b('0x12')](function(_0x18dd10){logger[_0xc03b('0x13')](_0xc03b('0x28'),_0x3e1f04);logger['debug'](_0xc03b('0x28'),_0x3e1f04,JSON['stringify'](_0x18dd10));_0x1a861b(_0x18dd10);})['catch'](function(_0x269ab4){logger[_0xc03b('0x18')](_0xc03b('0x28'),_0x269ab4[_0xc03b('0x1a')],_0x3e1f04);_0x33e0d0(_0x21af17[_0xc03b('0x18')](0x1f4,_0x269ab4['message']));});});};exports[_0xc03b('0x29')]=function(_0x1864fd){var _0x2ef404=this;return new Promise(function(_0x4fa2b1,_0x2ded47){return db[_0xc03b('0x25')][_0xc03b('0x2a')](_0x1864fd[_0xc03b('0x27')],{'raw':_0x1864fd[_0xc03b('0x1d')]?_0x1864fd[_0xc03b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1864fd[_0xc03b('0x1d')]?_0x1864fd['options'][_0xc03b('0x1f')]||null:null,'attributes':_0x1864fd['options']?_0x1864fd[_0xc03b('0x1d')][_0xc03b('0x20')]||null:null,'limit':_0x1864fd[_0xc03b('0x1d')]?_0x1864fd[_0xc03b('0x1d')][_0xc03b('0x2b')]||null:null})['then'](function(_0x566bcd){logger[_0xc03b('0x13')](_0xc03b('0x29'),_0x1864fd);logger[_0xc03b('0x16')]('UpdateVoiceQueueReport',_0x1864fd,JSON[_0xc03b('0x17')](_0x566bcd));_0x4fa2b1(_0x566bcd);})[_0xc03b('0x1b')](function(_0x2ec5cb){logger[_0xc03b('0x18')](_0xc03b('0x29'),_0x2ec5cb[_0xc03b('0x1a')],_0x1864fd);_0x2ded47(_0x2ef404[_0xc03b('0x18')](0x1f4,_0x2ec5cb[_0xc03b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 392d42c..eb857cb 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 _0x330c=['remove','update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3a00f6,_0x1bf634){var _0x151ff5=function(_0x4d9e5b){while(--_0x4d9e5b){_0x3a00f6['push'](_0x3a00f6['shift']());}};_0x151ff5(++_0x1bf634);}(_0x330c,0x186));var _0xc330=function(_0x2309ef,_0x26c3d8){_0x2309ef=_0x2309ef-0x0;var _0x53b7c9=_0x330c[_0x2309ef];return _0x53b7c9;};'use strict';var VoiceQueueReportEvents=require(_0xc330('0x0'));var events=[_0xc330('0x1'),_0xc330('0x2'),_0xc330('0x3')];function createListener(_0x48e3fc,_0x17e47c){return function(_0x197a49){_0x17e47c[_0xc330('0x4')](_0x48e3fc,_0x197a49);};}function removeListener(_0x207daa,_0x3852b2){return function(){VoiceQueueReportEvents[_0xc330('0x5')](_0x207daa,_0x3852b2);};}exports['register']=function(_0x4f49fb){for(var _0x53d0ca=0x0,_0x1a6a2e=events[_0xc330('0x6')];_0x53d0ca<_0x1a6a2e;_0x53d0ca++){var _0x253c40=events[_0x53d0ca];var _0x114bf0=createListener(_0xc330('0x7')+_0x253c40,_0x4f49fb);VoiceQueueReportEvents['on'](_0x253c40,_0x114bf0);}}; \ No newline at end of file +var _0x9752=['emit','removeListener','register','voiceQueueReport:','save','remove','update'];(function(_0x218941,_0x1c1d5d){var _0x2b6ef3=function(_0x38004f){while(--_0x38004f){_0x218941['push'](_0x218941['shift']());}};_0x2b6ef3(++_0x1c1d5d);}(_0x9752,0x90));var _0x2975=function(_0x4f16f6,_0x10bf76){_0x4f16f6=_0x4f16f6-0x0;var _0x581759=_0x9752[_0x4f16f6];return _0x581759;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x2975('0x0'),_0x2975('0x1'),_0x2975('0x2')];function createListener(_0x339e5e,_0x586021){return function(_0xd14963){_0x586021[_0x2975('0x3')](_0x339e5e,_0xd14963);};}function removeListener(_0x3ab330,_0x43c0a8){return function(){VoiceQueueReportEvents[_0x2975('0x4')](_0x3ab330,_0x43c0a8);};}exports[_0x2975('0x5')]=function(_0x8d643d){for(var _0x288fbd=0x0,_0x3183f1=events['length'];_0x288fbd<_0x3183f1;_0x288fbd++){var _0x404fb1=events[_0x288fbd];var _0x309302=createListener(_0x2975('0x6')+_0x404fb1,_0x8d643d);VoiceQueueReportEvents['on'](_0x404fb1,_0x309302);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b0076bc..9a264e5 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 _0x61ea=['show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x3cc554,_0xb614e4){var _0x2dc3fd=function(_0x271f57){while(--_0x271f57){_0x3cc554['push'](_0x3cc554['shift']());}};_0x2dc3fd(++_0xb614e4);}(_0x61ea,0x1d5));var _0xa61e=function(_0x232e93,_0x19e2ee){_0x232e93=_0x232e93-0x0;var _0x139d04=_0x61ea[_0x232e93];return _0x139d04;};'use strict';var multer=require(_0xa61e('0x0'));var util=require(_0xa61e('0x1'));var path=require(_0xa61e('0x2'));var timeout=require(_0xa61e('0x3'));var express=require('express');var router=express[_0xa61e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa61e('0x5'));var config=require('../../config/environment');var controller=require(_0xa61e('0x6'));router[_0xa61e('0x7')]('/',auth[_0xa61e('0x8')](),controller[_0xa61e('0x9')]);router[_0xa61e('0x7')](_0xa61e('0xa'),auth[_0xa61e('0x8')](),controller[_0xa61e('0xb')]);router[_0xa61e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa61e('0xa'),auth[_0xa61e('0x8')](),controller[_0xa61e('0xd')]);router[_0xa61e('0xe')](_0xa61e('0xa'),auth[_0xa61e('0x8')](),controller[_0xa61e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x912c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','post','create','put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3aa4df,_0x18e70b){var _0x521505=function(_0x581b83){while(--_0x581b83){_0x3aa4df['push'](_0x3aa4df['shift']());}};_0x521505(++_0x18e70b);}(_0x912c,0x12d));var _0xc912=function(_0x16b561,_0x5a914f){_0x16b561=_0x16b561-0x0;var _0x22599f=_0x912c[_0x16b561];return _0x22599f;};'use strict';var multer=require('multer');var util=require(_0xc912('0x0'));var path=require(_0xc912('0x1'));var timeout=require(_0xc912('0x2'));var express=require(_0xc912('0x3'));var router=express['Router']();var fs_extra=require(_0xc912('0x4'));var auth=require(_0xc912('0x5'));var interaction=require(_0xc912('0x6'));var config=require(_0xc912('0x7'));var controller=require(_0xc912('0x8'));router['get']('/',auth[_0xc912('0x9')](),controller[_0xc912('0xa')]);router[_0xc912('0xb')]('/:id',auth[_0xc912('0x9')](),controller['show']);router[_0xc912('0xc')]('/',auth[_0xc912('0x9')](),controller[_0xc912('0xd')]);router[_0xc912('0xe')](_0xc912('0xf'),auth[_0xc912('0x9')](),controller['update']);router['delete'](_0xc912('0xf'),auth[_0xc912('0x9')](),controller[_0xc912('0x10')]);module[_0xc912('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 346933b..51c8a78 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 _0xa24b=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0xa24b,0x1cb));var _0xba24=function(_0x2da385,_0x408023){_0x2da385=_0x2da385-0x0;var _0xedba0f=_0xa24b[_0x2da385];return _0xedba0f;};'use strict';var Sequelize=require(_0xba24('0x0'));var moment=require(_0xba24('0x1'));module[_0xba24('0x2')]={'time':{'type':Sequelize[_0xba24('0x3')]},'callid':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xba24('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xba24('0x4')],'allowNull':![],'defaultValue':moment()[_0xba24('0x5')](_0xba24('0x6'))}}; \ No newline at end of file +var _0x1f11=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x1b42a8,_0x26e161){var _0x125b77=function(_0x15dcca){while(--_0x15dcca){_0x1b42a8['push'](_0x1b42a8['shift']());}};_0x125b77(++_0x26e161);}(_0x1f11,0x137));var _0x11f1=function(_0x397f04,_0x2d9ef5){_0x397f04=_0x397f04-0x0;var _0x249786=_0x1f11[_0x397f04];return _0x249786;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x11f1('0x0'));module['exports']={'time':{'type':Sequelize[_0x11f1('0x1')]},'callid':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x11f1('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x11f1('0x2')],'allowNull':![],'defaultValue':moment()['format'](_0x11f1('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index bb9999c..8e7bc8c 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 _0x26d0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa3514c,_0x9c937b){var _0x31f6a0=function(_0x1f276e){while(--_0x1f276e){_0xa3514c['push'](_0xa3514c['shift']());}};_0x31f6a0(++_0x9c937b);}(_0x26d0,0x1c0));var _0x026d=function(_0x5ebd30,_0x48be89){_0x5ebd30=_0x5ebd30-0x0;var _0x45244a=_0x26d0[_0x5ebd30];return _0x45244a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x026d('0x0'));var zipdir=require(_0x026d('0x1'));var jsonpatch=require(_0x026d('0x2'));var rp=require(_0x026d('0x3'));var moment=require(_0x026d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x026d('0x5'));var util=require(_0x026d('0x6'));var path=require(_0x026d('0x7'));var sox=require(_0x026d('0x8'));var csv=require(_0x026d('0x9'));var ejs=require(_0x026d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x026d('0xb'));var squel=require(_0x026d('0xc'));var crypto=require(_0x026d('0xd'));var jsforce=require(_0x026d('0xe'));var deskjs=require(_0x026d('0xf'));var toCsv=require(_0x026d('0x9'));var querystring=require(_0x026d('0x10'));var Papa=require('papaparse');var Redis=require(_0x026d('0x11'));var authService=require(_0x026d('0x12'));var qs=require(_0x026d('0x13'));var as=require(_0x026d('0x14'));var hardwareService=require(_0x026d('0x15'));var logger=require(_0x026d('0x16'))('api');var utils=require(_0x026d('0x17'));var config=require(_0x026d('0x18'));var licenseUtil=require(_0x026d('0x19'));var db=require(_0x026d('0x1a'))['db'];function respondWithStatusCode(_0x3039c7,_0x38be1b){_0x38be1b=_0x38be1b||0xcc;return function(_0x214b85){if(_0x214b85){return _0x3039c7[_0x026d('0x1b')](_0x38be1b);}return _0x3039c7[_0x026d('0x1c')](_0x38be1b)['end']();};}function respondWithResult(_0xf7652b,_0x834c36){_0x834c36=_0x834c36||0xc8;return function(_0x121fae){if(_0x121fae){return _0xf7652b[_0x026d('0x1c')](_0x834c36)[_0x026d('0x1d')](_0x121fae);}};}function respondWithFilteredResult(_0x1b9b00,_0x544c0e){return function(_0x276865){if(_0x276865){var _0x3b6b5e=typeof _0x544c0e['offset']===_0x026d('0x1e')&&typeof _0x544c0e['limit']===_0x026d('0x1e');var _0x58511f=_0x276865[_0x026d('0x1f')];var _0x2c607b=_0x3b6b5e?0x0:_0x544c0e[_0x026d('0x20')];var _0x101d76=_0x3b6b5e?_0x276865[_0x026d('0x1f')]:_0x544c0e[_0x026d('0x20')]+_0x544c0e[_0x026d('0x21')];var _0x393b9f;if(_0x101d76>=_0x58511f){_0x101d76=_0x58511f;_0x393b9f=0xc8;}else{_0x393b9f=0xce;}_0x1b9b00[_0x026d('0x1c')](_0x393b9f);return _0x1b9b00[_0x026d('0x22')](_0x026d('0x23'),_0x2c607b+'-'+_0x101d76+'/'+_0x58511f)['json'](_0x276865);}return null;};}function patchUpdates(_0x4a0032){return function(_0x3578a8){try{jsonpatch[_0x026d('0x24')](_0x3578a8,_0x4a0032,!![]);}catch(_0x376d89){return BPromise[_0x026d('0x25')](_0x376d89);}return _0x3578a8[_0x026d('0x26')]();};}function saveUpdates(_0x764f5,_0x52d36a){return function(_0x57817f){if(_0x57817f){return _0x57817f[_0x026d('0x27')](_0x764f5)[_0x026d('0x28')](function(_0x4a8880){return _0x4a8880;});}return null;};}function removeEntity(_0xa2fa40,_0x46df84){return function(_0x192c11){if(_0x192c11){return _0x192c11[_0x026d('0x29')]()[_0x026d('0x28')](function(){_0xa2fa40[_0x026d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55db4a,_0x1e0fb1){return function(_0x51b08e){if(!_0x51b08e){_0x55db4a['sendStatus'](0x194);}return _0x51b08e;};}function handleError(_0x55d6c0,_0x28a28b){_0x28a28b=_0x28a28b||0x1f4;return function(_0x49e673){logger[_0x026d('0x2a')](_0x49e673[_0x026d('0x2b')]);if(_0x49e673[_0x026d('0x2c')]){delete _0x49e673[_0x026d('0x2c')];}_0x55d6c0[_0x026d('0x1c')](_0x28a28b)[_0x026d('0x2d')](_0x49e673);};}exports[_0x026d('0x2e')]=function(_0x999ff1,_0x244cb3){var _0x26ba4d={},_0x11c705={},_0x2d4e8e={'count':0x0,'rows':[]};var _0x1883d2=_[_0x026d('0x2f')](db[_0x026d('0x30')][_0x026d('0x31')],function(_0x24dfeb){return{'name':_0x24dfeb['fieldName'],'type':_0x24dfeb[_0x026d('0x32')][_0x026d('0x33')]};});_0x11c705[_0x026d('0x34')]=_[_0x026d('0x2f')](_0x1883d2,'name');_0x11c705[_0x026d('0x35')]=_[_0x026d('0x36')](_0x999ff1[_0x026d('0x35')]);_0x11c705[_0x026d('0x37')]=_[_0x026d('0x38')](_0x11c705['model'],_0x11c705[_0x026d('0x35')]);_0x26ba4d[_0x026d('0x39')]=_[_0x026d('0x38')](_0x11c705['model'],qs[_0x026d('0x3a')](_0x999ff1[_0x026d('0x35')][_0x026d('0x3a')]));_0x26ba4d['attributes']=_0x26ba4d['attributes'][_0x026d('0x3b')]?_0x26ba4d[_0x026d('0x39')]:_0x11c705[_0x026d('0x34')];if(!_0x999ff1[_0x026d('0x35')][_0x026d('0x3c')](_0x026d('0x3d'))){_0x26ba4d[_0x026d('0x21')]=qs[_0x026d('0x21')](_0x999ff1[_0x026d('0x35')][_0x026d('0x21')]);_0x26ba4d[_0x026d('0x20')]=qs[_0x026d('0x20')](_0x999ff1['query'][_0x026d('0x20')]);}_0x26ba4d[_0x026d('0x3e')]=qs[_0x026d('0x3f')](_0x999ff1[_0x026d('0x35')][_0x026d('0x3f')]);_0x26ba4d['where']=qs['filters'](_['pick'](_0x999ff1[_0x026d('0x35')],_0x11c705['filters']),_0x1883d2);if(_0x999ff1[_0x026d('0x35')][_0x026d('0x40')]){_0x26ba4d[_0x026d('0x41')]=_[_0x026d('0x42')](_0x26ba4d[_0x026d('0x41')],{'$or':_['map'](_0x1883d2,function(_0x11514c){if(_0x11514c[_0x026d('0x32')]!=='VIRTUAL'){var _0x41dfa8={};_0x41dfa8[_0x11514c[_0x026d('0x2c')]]={'$like':'%'+_0x999ff1['query'][_0x026d('0x40')]+'%'};return _0x41dfa8;}})});}_0x26ba4d=_[_0x026d('0x42')]({},_0x26ba4d,_0x999ff1['options']);var _0x5d401e={'where':_0x26ba4d[_0x026d('0x41')]};return db[_0x026d('0x30')]['count'](_0x5d401e)[_0x026d('0x28')](function(_0x1f775f){_0x2d4e8e[_0x026d('0x1f')]=_0x1f775f;if(_0x999ff1[_0x026d('0x35')][_0x026d('0x43')]){_0x26ba4d[_0x026d('0x44')]=[{'all':!![]}];}return db[_0x026d('0x30')][_0x026d('0x45')](_0x26ba4d);})[_0x026d('0x28')](function(_0x9f55ce){_0x2d4e8e[_0x026d('0x46')]=_0x9f55ce;return _0x2d4e8e;})[_0x026d('0x28')](respondWithFilteredResult(_0x244cb3,_0x26ba4d))[_0x026d('0x47')](handleError(_0x244cb3,null));};exports[_0x026d('0x48')]=function(_0x35ba03,_0x5a995d){var _0x5e0feb={'raw':!![],'where':{'id':_0x35ba03[_0x026d('0x49')]['id']}},_0x5ec59c={};_0x5ec59c['model']=_[_0x026d('0x36')](db[_0x026d('0x30')]['rawAttributes']);_0x5ec59c[_0x026d('0x35')]=_[_0x026d('0x36')](_0x35ba03[_0x026d('0x35')]);_0x5ec59c[_0x026d('0x37')]=_['intersection'](_0x5ec59c[_0x026d('0x34')],_0x5ec59c[_0x026d('0x35')]);_0x5e0feb['attributes']=_['intersection'](_0x5ec59c['model'],qs[_0x026d('0x3a')](_0x35ba03['query']['fields']));_0x5e0feb[_0x026d('0x39')]=_0x5e0feb[_0x026d('0x39')][_0x026d('0x3b')]?_0x5e0feb[_0x026d('0x39')]:_0x5ec59c['model'];if(_0x35ba03[_0x026d('0x35')][_0x026d('0x43')]){_0x5e0feb['include']=[{'all':!![]}];}_0x5e0feb=_[_0x026d('0x42')]({},_0x5e0feb,_0x35ba03[_0x026d('0x4a')]);return db['VoiceQueuesLog'][_0x026d('0x4b')](_0x5e0feb)['then'](handleEntityNotFound(_0x5a995d,null))[_0x026d('0x28')](respondWithResult(_0x5a995d,null))[_0x026d('0x47')](handleError(_0x5a995d,null));};exports[_0x026d('0x4c')]=function(_0x380dc6,_0x5eae99){return db[_0x026d('0x30')][_0x026d('0x4c')](_0x380dc6[_0x026d('0x4d')],{})[_0x026d('0x28')](respondWithResult(_0x5eae99,0xc9))[_0x026d('0x47')](handleError(_0x5eae99,null));};exports[_0x026d('0x27')]=function(_0x2f867c,_0x92438f){if(_0x2f867c[_0x026d('0x4d')]['id']){delete _0x2f867c['body']['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x2f867c[_0x026d('0x49')]['id']}})[_0x026d('0x28')](handleEntityNotFound(_0x92438f,null))[_0x026d('0x28')](saveUpdates(_0x2f867c[_0x026d('0x4d')],null))[_0x026d('0x28')](respondWithResult(_0x92438f,null))[_0x026d('0x47')](handleError(_0x92438f,null));};exports[_0x026d('0x29')]=function(_0x3ddf1d,_0x5694d4){return db[_0x026d('0x30')][_0x026d('0x4b')]({'where':{'id':_0x3ddf1d['params']['id']}})[_0x026d('0x28')](handleEntityNotFound(_0x5694d4,null))[_0x026d('0x28')](removeEntity(_0x5694d4,null))[_0x026d('0x47')](handleError(_0x5694d4,null));}; \ No newline at end of file +var _0x1b87=['filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','catch','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','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/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x2d3733,_0xe82103){var _0x27008a=function(_0x2c12c8){while(--_0x2c12c8){_0x2d3733['push'](_0x2d3733['shift']());}};_0x27008a(++_0xe82103);}(_0x1b87,0xa3));var _0x71b8=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x1b87[_0x427d3a];return _0xe5c521;};'use strict';var emlformat=require(_0x71b8('0x0'));var rimraf=require(_0x71b8('0x1'));var zipdir=require(_0x71b8('0x2'));var jsonpatch=require(_0x71b8('0x3'));var rp=require(_0x71b8('0x4'));var moment=require(_0x71b8('0x5'));var BPromise=require(_0x71b8('0x6'));var Mustache=require(_0x71b8('0x7'));var util=require('util');var path=require('path');var sox=require(_0x71b8('0x8'));var csv=require(_0x71b8('0x9'));var ejs=require(_0x71b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71b8('0xb'));var squel=require('squel');var crypto=require(_0x71b8('0xc'));var jsforce=require(_0x71b8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x71b8('0xe'));var Papa=require(_0x71b8('0xf'));var Redis=require(_0x71b8('0x10'));var authService=require(_0x71b8('0x11'));var qs=require(_0x71b8('0x12'));var as=require(_0x71b8('0x13'));var hardwareService=require(_0x71b8('0x14'));var logger=require(_0x71b8('0x15'))(_0x71b8('0x16'));var utils=require(_0x71b8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x71b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5982f9,_0x36614d){_0x36614d=_0x36614d||0xcc;return function(_0x54a6cf){if(_0x54a6cf){return _0x5982f9[_0x71b8('0x19')](_0x36614d);}return _0x5982f9[_0x71b8('0x1a')](_0x36614d)[_0x71b8('0x1b')]();};}function respondWithResult(_0x53941f,_0x277549){_0x277549=_0x277549||0xc8;return function(_0x4c8ab3){if(_0x4c8ab3){return _0x53941f[_0x71b8('0x1a')](_0x277549)['json'](_0x4c8ab3);}};}function respondWithFilteredResult(_0x43468d,_0x5771c2){return function(_0x1c9866){if(_0x1c9866){var _0x553317=typeof _0x5771c2[_0x71b8('0x1c')]===_0x71b8('0x1d')&&typeof _0x5771c2[_0x71b8('0x1e')]===_0x71b8('0x1d');var _0x310c9c=_0x1c9866[_0x71b8('0x1f')];var _0xf2187f=_0x553317?0x0:_0x5771c2[_0x71b8('0x1c')];var _0x188f7b=_0x553317?_0x1c9866['count']:_0x5771c2[_0x71b8('0x1c')]+_0x5771c2[_0x71b8('0x1e')];var _0x1e78ea;if(_0x188f7b>=_0x310c9c){_0x188f7b=_0x310c9c;_0x1e78ea=0xc8;}else{_0x1e78ea=0xce;}_0x43468d['status'](_0x1e78ea);return _0x43468d[_0x71b8('0x20')](_0x71b8('0x21'),_0xf2187f+'-'+_0x188f7b+'/'+_0x310c9c)['json'](_0x1c9866);}return null;};}function patchUpdates(_0x8c8fe9){return function(_0x36451a){try{jsonpatch[_0x71b8('0x22')](_0x36451a,_0x8c8fe9,!![]);}catch(_0x4c32da){return BPromise[_0x71b8('0x23')](_0x4c32da);}return _0x36451a['save']();};}function saveUpdates(_0x6e0473,_0x25a1ab){return function(_0x2b4b86){if(_0x2b4b86){return _0x2b4b86[_0x71b8('0x24')](_0x6e0473)[_0x71b8('0x25')](function(_0x4f14e6){return _0x4f14e6;});}return null;};}function removeEntity(_0x496b8d,_0x12ebf3){return function(_0x714612){if(_0x714612){return _0x714612['destroy']()['then'](function(){_0x496b8d[_0x71b8('0x1a')](0xcc)[_0x71b8('0x1b')]();});}};}function handleEntityNotFound(_0x57e3b2,_0x5799e8){return function(_0x558764){if(!_0x558764){_0x57e3b2['sendStatus'](0x194);}return _0x558764;};}function handleError(_0x1ab846,_0xc6b39a){_0xc6b39a=_0xc6b39a||0x1f4;return function(_0x3bf328){logger[_0x71b8('0x26')](_0x3bf328[_0x71b8('0x27')]);if(_0x3bf328[_0x71b8('0x28')]){delete _0x3bf328[_0x71b8('0x28')];}_0x1ab846[_0x71b8('0x1a')](_0xc6b39a)[_0x71b8('0x29')](_0x3bf328);};}exports[_0x71b8('0x2a')]=function(_0x2d7421,_0x4610d2){var _0xe634e={},_0x37fd02={},_0x1c6d73={'count':0x0,'rows':[]};var _0x2e713f=_[_0x71b8('0x2b')](db[_0x71b8('0x2c')]['rawAttributes'],function(_0x545171){return{'name':_0x545171[_0x71b8('0x2d')],'type':_0x545171[_0x71b8('0x2e')]['key']};});_0x37fd02['model']=_[_0x71b8('0x2b')](_0x2e713f,_0x71b8('0x28'));_0x37fd02[_0x71b8('0x2f')]=_['keys'](_0x2d7421['query']);_0x37fd02['filters']=_[_0x71b8('0x30')](_0x37fd02['model'],_0x37fd02[_0x71b8('0x2f')]);_0xe634e[_0x71b8('0x31')]=_[_0x71b8('0x30')](_0x37fd02[_0x71b8('0x32')],qs[_0x71b8('0x33')](_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x33')]));_0xe634e[_0x71b8('0x31')]=_0xe634e[_0x71b8('0x31')][_0x71b8('0x34')]?_0xe634e[_0x71b8('0x31')]:_0x37fd02[_0x71b8('0x32')];if(!_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x35')](_0x71b8('0x36'))){_0xe634e[_0x71b8('0x1e')]=qs[_0x71b8('0x1e')](_0x2d7421[_0x71b8('0x2f')]['limit']);_0xe634e[_0x71b8('0x1c')]=qs[_0x71b8('0x1c')](_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x1c')]);}_0xe634e['order']=qs['sort'](_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x37')]);_0xe634e[_0x71b8('0x38')]=qs[_0x71b8('0x39')](_[_0x71b8('0x3a')](_0x2d7421[_0x71b8('0x2f')],_0x37fd02[_0x71b8('0x39')]),_0x2e713f);if(_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x3b')]){_0xe634e[_0x71b8('0x38')]=_[_0x71b8('0x3c')](_0xe634e[_0x71b8('0x38')],{'$or':_[_0x71b8('0x2b')](_0x2e713f,function(_0x1c0c2c){if(_0x1c0c2c[_0x71b8('0x2e')]!=='VIRTUAL'){var _0x4d1831={};_0x4d1831[_0x1c0c2c['name']]={'$like':'%'+_0x2d7421[_0x71b8('0x2f')][_0x71b8('0x3b')]+'%'};return _0x4d1831;}})});}_0xe634e=_[_0x71b8('0x3c')]({},_0xe634e,_0x2d7421[_0x71b8('0x3d')]);var _0x40e68b={'where':_0xe634e[_0x71b8('0x38')]};return db[_0x71b8('0x2c')]['count'](_0x40e68b)[_0x71b8('0x25')](function(_0x265d26){_0x1c6d73[_0x71b8('0x1f')]=_0x265d26;if(_0x2d7421['query'][_0x71b8('0x3e')]){_0xe634e['include']=[{'all':!![]}];}return db[_0x71b8('0x2c')][_0x71b8('0x3f')](_0xe634e);})[_0x71b8('0x25')](function(_0x528daa){_0x1c6d73[_0x71b8('0x40')]=_0x528daa;return _0x1c6d73;})[_0x71b8('0x25')](respondWithFilteredResult(_0x4610d2,_0xe634e))['catch'](handleError(_0x4610d2,null));};exports[_0x71b8('0x41')]=function(_0x28bd24,_0x2722b1){var _0x204f04={'raw':!![],'where':{'id':_0x28bd24[_0x71b8('0x42')]['id']}},_0x5e642b={};_0x5e642b[_0x71b8('0x32')]=_['keys'](db[_0x71b8('0x2c')][_0x71b8('0x43')]);_0x5e642b[_0x71b8('0x2f')]=_['keys'](_0x28bd24[_0x71b8('0x2f')]);_0x5e642b[_0x71b8('0x39')]=_['intersection'](_0x5e642b[_0x71b8('0x32')],_0x5e642b['query']);_0x204f04[_0x71b8('0x31')]=_['intersection'](_0x5e642b[_0x71b8('0x32')],qs['fields'](_0x28bd24[_0x71b8('0x2f')][_0x71b8('0x33')]));_0x204f04[_0x71b8('0x31')]=_0x204f04[_0x71b8('0x31')][_0x71b8('0x34')]?_0x204f04['attributes']:_0x5e642b[_0x71b8('0x32')];if(_0x28bd24['query'][_0x71b8('0x3e')]){_0x204f04[_0x71b8('0x44')]=[{'all':!![]}];}_0x204f04=_[_0x71b8('0x3c')]({},_0x204f04,_0x28bd24[_0x71b8('0x3d')]);return db[_0x71b8('0x2c')]['find'](_0x204f04)[_0x71b8('0x25')](handleEntityNotFound(_0x2722b1,null))[_0x71b8('0x25')](respondWithResult(_0x2722b1,null))[_0x71b8('0x45')](handleError(_0x2722b1,null));};exports[_0x71b8('0x46')]=function(_0x436ffb,_0x380c89){return db[_0x71b8('0x2c')][_0x71b8('0x46')](_0x436ffb[_0x71b8('0x47')],{})[_0x71b8('0x25')](respondWithResult(_0x380c89,0xc9))[_0x71b8('0x45')](handleError(_0x380c89,null));};exports[_0x71b8('0x24')]=function(_0x51f163,_0x58c19f){if(_0x51f163[_0x71b8('0x47')]['id']){delete _0x51f163[_0x71b8('0x47')]['id'];}return db['VoiceQueuesLog'][_0x71b8('0x48')]({'where':{'id':_0x51f163[_0x71b8('0x42')]['id']}})[_0x71b8('0x25')](handleEntityNotFound(_0x58c19f,null))[_0x71b8('0x25')](saveUpdates(_0x51f163[_0x71b8('0x47')],null))['then'](respondWithResult(_0x58c19f,null))['catch'](handleError(_0x58c19f,null));};exports[_0x71b8('0x49')]=function(_0x316b83,_0x57b6b5){return db['VoiceQueuesLog'][_0x71b8('0x48')]({'where':{'id':_0x316b83[_0x71b8('0x42')]['id']}})[_0x71b8('0x25')](handleEntityNotFound(_0x57b6b5,null))[_0x71b8('0x25')](removeEntity(_0x57b6b5,null))[_0x71b8('0x45')](handleError(_0x57b6b5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b3b4e9a..85b8430 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 _0xab09=['define','event','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xab09,0x6a));var _0x9ab0=function(_0x108a1c,_0x6c5bda){_0x108a1c=_0x108a1c-0x0;var _0x3e4e11=_0xab09[_0x108a1c];return _0x3e4e11;};'use strict';var _=require('lodash');var util=require(_0x9ab0('0x0'));var logger=require(_0x9ab0('0x1'))(_0x9ab0('0x2'));var moment=require(_0x9ab0('0x3'));var BPromise=require(_0x9ab0('0x4'));var rp=require(_0x9ab0('0x5'));var fs=require('fs');var path=require(_0x9ab0('0x6'));var rimraf=require(_0x9ab0('0x7'));var config=require(_0x9ab0('0x8'));var attributes=require(_0x9ab0('0x9'));module[_0x9ab0('0xa')]=function(_0x133968,_0x209fc3){return _0x133968[_0x9ab0('0xb')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x9ab0('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xc951=['event_dtm','event','dtm','util','../../config/logger','api','moment','request-promise','path','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0xc951,0x1a3));var _0x1c95=function(_0xecf3b1,_0x2c19c2){_0xecf3b1=_0xecf3b1-0x0;var _0x438953=_0xc951[_0xecf3b1];return _0x438953;};'use strict';var _=require('lodash');var util=require(_0x1c95('0x0'));var logger=require(_0x1c95('0x1'))(_0x1c95('0x2'));var moment=require(_0x1c95('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c95('0x4'));var fs=require('fs');var path=require(_0x1c95('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x1c95('0x6')]=function(_0x1c2648,_0x4cc66b){return _0x1c2648[_0x1c95('0x7')](_0x1c95('0x8'),attributes,{'tableName':_0x1c95('0x9'),'paranoid':![],'indexes':[{'name':_0x1c95('0xa'),'fields':[_0x1c95('0xb'),_0x1c95('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 1c1590e..5e69217 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 _0x23c5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x95307c,_0x55cc74){var _0x28b7c3=function(_0x3d6123){while(--_0x3d6123){_0x95307c['push'](_0x95307c['shift']());}};_0x28b7c3(++_0x55cc74);}(_0x23c5,0x128));var _0x523c=function(_0x3a007b,_0x4a491a){_0x3a007b=_0x3a007b-0x0;var _0x53a831=_0x23c5[_0x3a007b];return _0x53a831;};'use strict';var _=require(_0x523c('0x0'));var util=require(_0x523c('0x1'));var moment=require(_0x523c('0x2'));var BPromise=require('bluebird');var rs=require(_0x523c('0x3'));var fs=require('fs');var Redis=require(_0x523c('0x4'));var db=require(_0x523c('0x5'))['db'];var utils=require(_0x523c('0x6'));var logger=require(_0x523c('0x7'))(_0x523c('0x8'));var config=require(_0x523c('0x9'));var jayson=require(_0x523c('0xa'));var client=jayson['client'][_0x523c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3088a5,_0x17d841,_0x2d02ae){return new BPromise(function(_0x10f5cf,_0xfc6e68){return client['request'](_0x3088a5,_0x2d02ae)['then'](function(_0x11d20c){logger[_0x523c('0xc')](_0x523c('0xd'),_0x17d841,_0x523c('0xe'));logger['debug'](_0x523c('0xf'),_0x17d841,_0x523c('0xe'),JSON['stringify'](_0x11d20c));if(_0x11d20c[_0x523c('0x10')]){if(_0x11d20c[_0x523c('0x10')][_0x523c('0x11')]===0x1f4){logger[_0x523c('0x10')](_0x523c('0xd'),_0x17d841,_0x11d20c[_0x523c('0x10')][_0x523c('0x12')]);return _0xfc6e68(_0x11d20c[_0x523c('0x10')][_0x523c('0x12')]);}logger[_0x523c('0x10')](_0x523c('0xd'),_0x17d841,_0x11d20c[_0x523c('0x10')]['message']);return _0x10f5cf(_0x11d20c[_0x523c('0x10')][_0x523c('0x12')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x17d841,_0x523c('0xe'));_0x10f5cf(_0x11d20c['result'][_0x523c('0x12')]);}})[_0x523c('0x13')](function(_0x233a08){logger[_0x523c('0x10')](_0x523c('0xd'),_0x17d841,_0x233a08);_0xfc6e68(_0x233a08);});});} \ No newline at end of file +var _0x37d7=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x37d7,0x163));var _0x737d=function(_0x3e1415,_0x2ad5ee){_0x3e1415=_0x3e1415-0x0;var _0x2e1ec7=_0x37d7[_0x3e1415];return _0x2e1ec7;};'use strict';var _=require(_0x737d('0x0'));var util=require(_0x737d('0x1'));var moment=require(_0x737d('0x2'));var BPromise=require(_0x737d('0x3'));var rs=require(_0x737d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x737d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x737d('0x6'))(_0x737d('0x7'));var config=require(_0x737d('0x8'));var jayson=require(_0x737d('0x9'));var client=jayson[_0x737d('0xa')][_0x737d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4b4c4,_0x3ff31e,_0x242602){return new BPromise(function(_0x4fed8c,_0x21baba){return client[_0x737d('0xc')](_0xd4b4c4,_0x242602)['then'](function(_0x399096){logger[_0x737d('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3ff31e,_0x737d('0xe'));logger[_0x737d('0xf')](_0x737d('0x10'),_0x3ff31e,_0x737d('0xe'),JSON[_0x737d('0x11')](_0x399096));if(_0x399096[_0x737d('0x12')]){if(_0x399096['error'][_0x737d('0x13')]===0x1f4){logger[_0x737d('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3ff31e,_0x399096['error'][_0x737d('0x14')]);return _0x21baba(_0x399096[_0x737d('0x12')]['message']);}logger[_0x737d('0x12')](_0x737d('0x15'),_0x3ff31e,_0x399096[_0x737d('0x12')][_0x737d('0x14')]);return _0x4fed8c(_0x399096[_0x737d('0x12')][_0x737d('0x14')]);}else{logger['info'](_0x737d('0x15'),_0x3ff31e,'request\x20sent');_0x4fed8c(_0x399096[_0x737d('0x16')][_0x737d('0x14')]);}})[_0x737d('0x17')](function(_0x55b06c){logger['error'](_0x737d('0x15'),_0x3ff31e,_0x55b06c);_0x21baba(_0x55b06c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9e4d7d8..a4f86e5 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 _0x0bdf=['post','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','/describe','/:id','show','/:id/download','isAuthenticated','download','/:id/downloads','/:id/transcribe'];(function(_0x12e6c6,_0x375454){var _0x45c371=function(_0x4dbfa5){while(--_0x4dbfa5){_0x12e6c6['push'](_0x12e6c6['shift']());}};_0x45c371(++_0x375454);}(_0x0bdf,0x156));var _0xf0bd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0bdf[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xf0bd('0x0'));var util=require(_0xf0bd('0x1'));var path=require(_0xf0bd('0x2'));var timeout=require(_0xf0bd('0x3'));var express=require('express');var router=express[_0xf0bd('0x4')]();var fs_extra=require(_0xf0bd('0x5'));var auth=require(_0xf0bd('0x6'));var interaction=require(_0xf0bd('0x7'));var config=require('../../config/environment');var controller=require(_0xf0bd('0x8'));router[_0xf0bd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf0bd('0x9')](_0xf0bd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xf0bd('0x9')](_0xf0bd('0xb'),auth['isAuthenticated'](),controller[_0xf0bd('0xc')]);router[_0xf0bd('0x9')](_0xf0bd('0xd'),auth[_0xf0bd('0xe')](),controller[_0xf0bd('0xf')]);router['get'](_0xf0bd('0x10'),controller['downloads']);router[_0xf0bd('0x9')](_0xf0bd('0x11'),auth[_0xf0bd('0xe')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf0bd('0x12')](_0xf0bd('0x11'),auth['isAuthenticated'](),controller[_0xf0bd('0x13')]);router[_0xf0bd('0x14')](_0xf0bd('0xb'),auth[_0xf0bd('0xe')](),controller[_0xf0bd('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf0bd('0x16')]);module[_0xf0bd('0x17')]=router; \ No newline at end of file +var _0x7a7c=['isAuthenticated','/describe','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','/:id/transcribe','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x7a7c,0x1ab));var _0xc7a7=function(_0x444a8c,_0x4f8c59){_0x444a8c=_0x444a8c-0x0;var _0x18d87b=_0x7a7c[_0x444a8c];return _0x18d87b;};'use strict';var multer=require(_0xc7a7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc7a7('0x1'));var express=require(_0xc7a7('0x2'));var router=express[_0xc7a7('0x3')]();var fs_extra=require(_0xc7a7('0x4'));var auth=require(_0xc7a7('0x5'));var interaction=require(_0xc7a7('0x6'));var config=require(_0xc7a7('0x7'));var controller=require(_0xc7a7('0x8'));router[_0xc7a7('0x9')]('/',auth[_0xc7a7('0xa')](),controller['index']);router[_0xc7a7('0x9')](_0xc7a7('0xb'),auth[_0xc7a7('0xa')](),controller['describe']);router['get']('/:id',auth[_0xc7a7('0xa')](),controller['show']);router['get'](_0xc7a7('0xc'),auth[_0xc7a7('0xa')](),controller[_0xc7a7('0xd')]);router['get'](_0xc7a7('0xe'),controller[_0xc7a7('0xf')]);router[_0xc7a7('0x9')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xc7a7('0x10')]);router[_0xc7a7('0x11')]('/',auth[_0xc7a7('0xa')](),controller['create']);router[_0xc7a7('0x11')](_0xc7a7('0x12'),auth['isAuthenticated'](),controller['runTranscribe']);router['put'](_0xc7a7('0x13'),auth[_0xc7a7('0xa')](),controller[_0xc7a7('0x14')]);router[_0xc7a7('0x15')]('/:id',auth[_0xc7a7('0xa')](),controller[_0xc7a7('0x16')]);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 c83af08..6d51b2d 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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 80cae72..03ed3ed 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 _0xc962=['status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','create','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','ValidationError','filename','extname','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','Sequelize','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','body','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.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','desk.js','to-csv','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0xc962,0x1cc));var _0x2c96=function(_0x379401,_0x290107){_0x379401=_0x379401-0x0;var _0x40fdf5=_0xc962[_0x379401];return _0x40fdf5;};'use strict';var emlformat=require(_0x2c96('0x0'));var rimraf=require(_0x2c96('0x1'));var zipdir=require(_0x2c96('0x2'));var jsonpatch=require(_0x2c96('0x3'));var rp=require(_0x2c96('0x4'));var moment=require(_0x2c96('0x5'));var BPromise=require(_0x2c96('0x6'));var Mustache=require(_0x2c96('0x7'));var util=require(_0x2c96('0x8'));var path=require(_0x2c96('0x9'));var sox=require(_0x2c96('0xa'));var csv=require('to-csv');var ejs=require(_0x2c96('0xb'));var fs=require('fs');var fs_extra=require(_0x2c96('0xc'));var _=require(_0x2c96('0xd'));var squel=require(_0x2c96('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c96('0xf'));var toCsv=require(_0x2c96('0x10'));var querystring=require(_0x2c96('0x11'));var Papa=require('papaparse');var AWS=require(_0x2c96('0x12'));var uuidv4=require(_0x2c96('0x13'));var Redis=require(_0x2c96('0x14'));var authService=require(_0x2c96('0x15'));var qs=require(_0x2c96('0x16'));var as=require(_0x2c96('0x17'));var hardwareService=require(_0x2c96('0x18'));var logger=require(_0x2c96('0x19'))(_0x2c96('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c96('0x1b'))['db'];function respondWithStatusCode(_0x44e122,_0x2ae0eb){_0x2ae0eb=_0x2ae0eb||0xcc;return function(_0x21e877){if(_0x21e877){return _0x44e122[_0x2c96('0x1c')](_0x2ae0eb);}return _0x44e122[_0x2c96('0x1d')](_0x2ae0eb)[_0x2c96('0x1e')]();};}function respondWithResult(_0x4ae587,_0x3ac28f){_0x3ac28f=_0x3ac28f||0xc8;return function(_0x4a9c76){if(_0x4a9c76){return _0x4ae587[_0x2c96('0x1d')](_0x3ac28f)['json'](_0x4a9c76);}};}function respondWithFilteredResult(_0xca9b46,_0x91469c){return function(_0x5ea09d){if(_0x5ea09d){var _0x1cf676=typeof _0x91469c[_0x2c96('0x1f')]===_0x2c96('0x20')&&typeof _0x91469c[_0x2c96('0x21')]===_0x2c96('0x20');var _0x4c56ae=_0x5ea09d['count'];var _0x24bf9c=_0x1cf676?0x0:_0x91469c[_0x2c96('0x1f')];var _0xc50ac5=_0x1cf676?_0x5ea09d[_0x2c96('0x22')]:_0x91469c[_0x2c96('0x1f')]+_0x91469c[_0x2c96('0x21')];var _0x24bc00;if(_0xc50ac5>=_0x4c56ae){_0xc50ac5=_0x4c56ae;_0x24bc00=0xc8;}else{_0x24bc00=0xce;}_0xca9b46[_0x2c96('0x1d')](_0x24bc00);return _0xca9b46[_0x2c96('0x23')]('Content-Range',_0x24bf9c+'-'+_0xc50ac5+'/'+_0x4c56ae)[_0x2c96('0x24')](_0x5ea09d);}return null;};}function patchUpdates(_0x411ef1){return function(_0x464cde){try{jsonpatch[_0x2c96('0x25')](_0x464cde,_0x411ef1,!![]);}catch(_0x51dc21){return BPromise[_0x2c96('0x26')](_0x51dc21);}return _0x464cde[_0x2c96('0x27')]();};}function saveUpdates(_0x8ce1ce,_0x9be8f9){return function(_0x3687f9){if(_0x3687f9){return _0x3687f9[_0x2c96('0x28')](_0x8ce1ce)[_0x2c96('0x29')](function(_0x92f79c){return _0x92f79c;});}return null;};}function removeEntity(_0x591a89,_0x438756){return function(_0xe75de3){if(_0xe75de3){return _0xe75de3[_0x2c96('0x2a')]()['then'](function(){_0x591a89[_0x2c96('0x1d')](0xcc)[_0x2c96('0x1e')]();});}};}function handleEntityNotFound(_0x5da9ad,_0x48bf67){return function(_0x5d0937){if(!_0x5d0937){_0x5da9ad[_0x2c96('0x1c')](0x194);}return _0x5d0937;};}function handleError(_0x4b61db,_0x166660){_0x166660=_0x166660||0x1f4;return function(_0x2deab7){logger[_0x2c96('0x2b')](_0x2deab7[_0x2c96('0x2c')]);if(_0x2deab7[_0x2c96('0x2d')]){delete _0x2deab7[_0x2c96('0x2d')];}_0x4b61db[_0x2c96('0x1d')](_0x166660)[_0x2c96('0x2e')](_0x2deab7);};}exports[_0x2c96('0x2f')]=function(_0x57258d,_0x4dbde8){var _0x22878f={},_0x1621ee={},_0x148fd3={'count':0x0,'rows':[]};var _0xb98399=_[_0x2c96('0x30')](db[_0x2c96('0x31')][_0x2c96('0x32')],function(_0x120401){return{'name':_0x120401[_0x2c96('0x33')],'type':_0x120401['type'][_0x2c96('0x34')]};});_0x1621ee[_0x2c96('0x35')]=_[_0x2c96('0x36')](_[_0x2c96('0x30')](_0xb98399,_0x2c96('0x2d')),[_0x2c96('0x37')]);_0x1621ee['query']=_[_0x2c96('0x38')](_0x57258d[_0x2c96('0x39')]);_0x1621ee[_0x2c96('0x3a')]=_[_0x2c96('0x3b')](_0x1621ee['model'],_0x1621ee['query']);_0x22878f[_0x2c96('0x3c')]=_[_0x2c96('0x3b')](_0x1621ee[_0x2c96('0x35')],qs[_0x2c96('0x3d')](_0x57258d['query'][_0x2c96('0x3d')]));_0x22878f['attributes']=_0x22878f[_0x2c96('0x3c')][_0x2c96('0x3e')]?_0x22878f['attributes']:_0x1621ee['model'];if(!_0x57258d[_0x2c96('0x39')][_0x2c96('0x3f')](_0x2c96('0x40'))){_0x22878f[_0x2c96('0x21')]=qs[_0x2c96('0x21')](_0x57258d['query'][_0x2c96('0x21')]);_0x22878f[_0x2c96('0x1f')]=qs[_0x2c96('0x1f')](_0x57258d[_0x2c96('0x39')][_0x2c96('0x1f')]);}_0x22878f[_0x2c96('0x41')]=qs['sort'](_0x57258d[_0x2c96('0x39')]['sort']);_0x22878f[_0x2c96('0x42')]=qs[_0x2c96('0x3a')](_[_0x2c96('0x43')](_0x57258d[_0x2c96('0x39')],_0x1621ee['filters']),_0xb98399);if(_0x57258d[_0x2c96('0x39')][_0x2c96('0x44')]){_0x22878f['where']=_['merge'](_0x22878f[_0x2c96('0x42')],{'$or':_[_0x2c96('0x30')](_0xb98399,function(_0x435a65){if(_0x435a65[_0x2c96('0x45')]!=='VIRTUAL'){var _0x63d874={};_0x63d874[_0x435a65[_0x2c96('0x2d')]]={'$like':'%'+_0x57258d['query']['filter']+'%'};return _0x63d874;}})});}_0x22878f=_[_0x2c96('0x46')]({},_0x22878f,_0x57258d[_0x2c96('0x47')]);var _0x21d162={'where':_0x22878f['where']};return db[_0x2c96('0x31')][_0x2c96('0x22')](_0x21d162)[_0x2c96('0x29')](function(_0x4852f4){_0x148fd3[_0x2c96('0x22')]=_0x4852f4;if(_0x57258d['query'][_0x2c96('0x48')]){_0x22878f[_0x2c96('0x49')]=[{'all':!![]}];}return db[_0x2c96('0x31')][_0x2c96('0x4a')](_0x22878f);})[_0x2c96('0x29')](function(_0x1e7584){_0x148fd3[_0x2c96('0x4b')]=_0x1e7584;return _0x148fd3;})[_0x2c96('0x29')](respondWithFilteredResult(_0x4dbde8,_0x22878f))[_0x2c96('0x4c')](handleError(_0x4dbde8,null));};exports[_0x2c96('0x4d')]=function(_0x2bf52f,_0x19518e){var _0x793818={'raw':![],'where':{'id':_0x2bf52f[_0x2c96('0x4e')]['id']}},_0x1e2abb={};_0x1e2abb[_0x2c96('0x35')]=_[_0x2c96('0x38')](db[_0x2c96('0x31')][_0x2c96('0x32')]);_0x1e2abb[_0x2c96('0x39')]=_['keys'](_0x2bf52f[_0x2c96('0x39')]);_0x1e2abb[_0x2c96('0x3a')]=_[_0x2c96('0x3b')](_0x1e2abb['model'],_0x1e2abb[_0x2c96('0x39')]);_0x793818[_0x2c96('0x3c')]=_[_0x2c96('0x3b')](_0x1e2abb[_0x2c96('0x35')],qs[_0x2c96('0x3d')](_0x2bf52f[_0x2c96('0x39')]['fields']));_0x793818[_0x2c96('0x3c')]=_0x793818['attributes'][_0x2c96('0x3e')]?_0x793818[_0x2c96('0x3c')]:_0x1e2abb[_0x2c96('0x35')];if(_0x2bf52f[_0x2c96('0x39')][_0x2c96('0x48')]){_0x793818[_0x2c96('0x49')]=[{'all':!![]}];}_0x793818=_['merge']({},_0x793818,_0x2bf52f['options']);return db['VoiceRecording']['find'](_0x793818)[_0x2c96('0x29')](handleEntityNotFound(_0x19518e,null))['then'](respondWithResult(_0x19518e,null))['catch'](handleError(_0x19518e,null));};exports['create']=function(_0x2ba3aa,_0x4a1cda){return db[_0x2c96('0x31')][_0x2c96('0x4f')](_0x2ba3aa['body'],{})['then'](respondWithResult(_0x4a1cda,0xc9))[_0x2c96('0x4c')](handleError(_0x4a1cda,null));};exports[_0x2c96('0x28')]=function(_0x9a12d1,_0x45d4e7){if(_0x9a12d1['body']['id']){delete _0x9a12d1['body']['id'];}return db[_0x2c96('0x31')][_0x2c96('0x50')]({'where':{'id':_0x9a12d1[_0x2c96('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45d4e7,null))[_0x2c96('0x29')](saveUpdates(_0x9a12d1['body'],null))[_0x2c96('0x29')](respondWithResult(_0x45d4e7,null))[_0x2c96('0x4c')](handleError(_0x45d4e7,null));};exports[_0x2c96('0x51')]=function(_0x553559,_0x4c2e82){return db['VoiceRecording'][_0x2c96('0x51')]()[_0x2c96('0x29')](respondWithResult(_0x4c2e82,null))[_0x2c96('0x4c')](handleError(_0x4c2e82,null));};exports[_0x2c96('0x52')]=function(_0x125d5b,_0x5bcbc9,_0x5bf7cc){var _0x541fa6=require(_0x2c96('0x53'));var _0x1472c7=![];var _0x3e17f5={};if(_0x125d5b['query'][_0x2c96('0x45')]&&_0x125d5b['query'][_0x2c96('0x45')]===_0x2c96('0x54')){_0x3e17f5['uniqueid']=_0x125d5b[_0x2c96('0x4e')]['id'];}else{_0x3e17f5['id']=_0x125d5b[_0x2c96('0x4e')]['id'];}return db[_0x2c96('0x31')][_0x2c96('0x50')]({'where':_0x3e17f5,'attributes':['id',_0x2c96('0x55')],'raw':!![]})[_0x2c96('0x29')](handleEntityNotFound(_0x5bcbc9,null))[_0x2c96('0x29')](function(_0xb12b37){if(_0xb12b37){var _0x2927be=_0xb12b37[_0x2c96('0x55')];var _0x9b8bb3=util[_0x2c96('0x37')]('%s.cypher',_0x2927be);if(fs[_0x2c96('0x56')](_0x9b8bb3)){_0x1472c7=!![];return _0x541fa6[_0x2c96('0x57')](_0x9b8bb3,_0x2927be,config['secrets'][_0x2c96('0x58')])['then'](function(){return _0xb12b37;});}return _0xb12b37;}})[_0x2c96('0x29')](function(_0x25cb98){if(_0x25cb98){var _0x601891=_0x25cb98[_0x2c96('0x55')];if(!fs[_0x2c96('0x56')](_0x601891)){throw new db['Sequelize'][(_0x2c96('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x25cb98[_0x2c96('0x5a')]){return _0x5bcbc9[_0x2c96('0x52')](_0x601891,_0x25cb98[_0x2c96('0x5a')]+path[_0x2c96('0x5b')](_0x601891),function(){if(_0x1472c7){fs['unlink'](_0x601891);}});}else{return _0x5bcbc9['download'](_0x601891,function(_0x1265ec){if(_0x1472c7){fs['unlink'](_0x601891);}});}}})[_0x2c96('0x4c')](function(_0x3e09af){if(_0x3e09af[_0x2c96('0x5c')]==='VoiceRecording\x20not\x20found'){_0x5bcbc9[_0x2c96('0x1d')](0x194)['send'](_0x2c96('0x5d'));}else{return handleError(_0x5bcbc9,null);}});};exports[_0x2c96('0x5e')]=function(_0x178f53,_0xafa243,_0x197276){var _0x21f6ca=require(_0x2c96('0x53'));var _0x2b65a0=![];var _0x5d2cea={'$and':[db[_0x2c96('0x5f')]['where'](db[_0x2c96('0x5f')]['fn'](_0x2c96('0x60'),db[_0x2c96('0x5f')][_0x2c96('0x61')](_0x2c96('0x54'))),_0x178f53[_0x2c96('0x39')]['token'])]};if(_0x178f53[_0x2c96('0x39')][_0x2c96('0x45')]&&_0x178f53[_0x2c96('0x39')][_0x2c96('0x45')]==='uniqueid'){_0x5d2cea[_0x2c96('0x62')][_0x2c96('0x63')]({'uniqueid':_0x178f53[_0x2c96('0x4e')]['id']});}else{_0x5d2cea[_0x2c96('0x62')][_0x2c96('0x63')]({'id':_0x178f53['params']['id']});}return db[_0x2c96('0x31')][_0x2c96('0x50')]({'where':_0x5d2cea,'attributes':['id',_0x2c96('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0xafa243,null))[_0x2c96('0x29')](function(_0x17fd3f){if(_0x17fd3f){var _0x5d25a5=util[_0x2c96('0x37')]('%s.cypher',_0x17fd3f['value']);if(fs[_0x2c96('0x56')](_0x5d25a5)){_0x2b65a0=!![];return _0x21f6ca['decryptFile'](_0x5d25a5,_0x17fd3f['value'],config['secrets'][_0x2c96('0x58')])[_0x2c96('0x29')](function(){return _0x17fd3f;});}return _0x17fd3f;}})[_0x2c96('0x29')](function(_0x3ca9c9){if(_0x3ca9c9){if(!fs[_0x2c96('0x56')](_0x3ca9c9[_0x2c96('0x55')])){throw new db[(_0x2c96('0x64'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x3ca9c9['filename']){return _0xafa243[_0x2c96('0x52')](_0x3ca9c9[_0x2c96('0x55')],_0x3ca9c9[_0x2c96('0x5a')]+path[_0x2c96('0x5b')](_0x3ca9c9[_0x2c96('0x55')]),function(){if(_0x2b65a0){fs[_0x2c96('0x65')](_0x3ca9c9[_0x2c96('0x55')]);}});}else{return _0xafa243[_0x2c96('0x52')](_0x3ca9c9[_0x2c96('0x55')],function(_0x5bab62){if(_0x2b65a0){fs['unlink'](_0x3ca9c9[_0x2c96('0x55')]);}});}}})[_0x2c96('0x4c')](handleError(_0xafa243,null));};exports[_0x2c96('0x2a')]=function(_0x8de73f,_0x3bb5ba){return db[_0x2c96('0x31')][_0x2c96('0x50')]({'where':{'id':_0x8de73f[_0x2c96('0x4e')]['id']}})[_0x2c96('0x29')](function(_0x3a4a9a){if(_[_0x2c96('0x66')](_0x3a4a9a)){throw new ReferenceError(_0x2c96('0x67'));}return _0x3a4a9a;})[_0x2c96('0x29')](function(_0x2d3888){var _0x132d36=_0x2d3888[_0x2c96('0x55')];logger[_0x2c96('0x68')](_0x2c96('0x69'),_0x132d36);if(!_['isNil'](_0x2d3888['value'])&&fs['existsSync'](_0x132d36)){logger['info'](_0x2c96('0x6a')+_0x132d36+_0x2c96('0x6b'));fs[_0x2c96('0x6c')](_0x132d36);}_0x132d36=_0x132d36+_0x2c96('0x6d');if(!_[_0x2c96('0x66')](_0x2d3888[_0x2c96('0x55')])&&fs['existsSync'](_0x132d36)){logger[_0x2c96('0x68')](_0x2c96('0x6a')+_0x132d36+_0x2c96('0x6b'));fs['unlinkSync'](_0x132d36);}return _0x2d3888;})['then'](function(_0xe04d8a){if(!_0xe04d8a)throw new InternalError();return _0xe04d8a[_0x2c96('0x2a')]();})[_0x2c96('0x29')](function(){_0x3bb5ba['status'](0xcc)[_0x2c96('0x1e')]();})['catch'](handleError(_0x3bb5ba,null));};function getBucketslist(_0x14ff0b,_0x9b75fd,_0x551814){return new Promise(function(_0x1360b0,_0x20411d){var _0x4062c7=new AWS['S3']({'accessKeyId':_0x9b75fd,'secretAccessKey':_0x14ff0b,'region':_0x551814});_0x4062c7[_0x2c96('0x6e')]({},function(_0x1e1a99,_0x38ee62){if(_0x1e1a99){return _0x20411d(_0x1e1a99);}else{return _0x1360b0(_0x38ee62);}});});}function createBucket(_0x2f2a37,_0x2d25f6,_0x33aba8,_0x5b8e3d){return new Promise(function(_0x1096ee,_0x309316){var _0x2b5e55=new AWS['S3']({'accessKeyId':_0x2d25f6,'secretAccessKey':_0x2f2a37,'region':_0x33aba8});_0x2b5e55[_0x2c96('0x6f')]({'Bucket':_0x5b8e3d},function(_0x3d107b,_0x5dc92e){if(_0x3d107b){return _0x309316(_0x3d107b);}else{return _0x1096ee(_0x5dc92e);}});});}function uploadFile(_0x2431fe,_0x145d73,_0x1d97b8,_0x1aeb6b,_0x28f1cd,_0x5f1213){return new Promise(function(_0x4097fd,_0x420977){var _0x3eca03=new AWS['S3']({'accessKeyId':_0x145d73,'secretAccessKey':_0x2431fe,'region':_0x1d97b8});_0x3eca03[_0x2c96('0x70')]({'Bucket':_0x1aeb6b,'Key':_0x28f1cd,'Body':_0x5f1213},function(_0x486acd,_0x2ef3cb){if(_0x486acd){return _0x420977(_0x486acd);}else{return _0x4097fd(_0x2ef3cb);}});});}function startTranscribe(_0x39ffe3,_0x586cb9,_0x6beee2,_0x5699f6,_0x57b2e0,_0x56333e){return new Promise(function(_0x42b4f5,_0x5dffad){var _0x40f1c2=new AWS[(_0x2c96('0x71'))]({'accessKeyId':_0x586cb9,'secretAccessKey':_0x39ffe3,'region':_0x6beee2});_0x40f1c2[_0x2c96('0x72')]({'TranscriptionJobName':_0x5699f6,'LanguageCode':_0x57b2e0,'Media':{'MediaFileUri':_0x56333e}},function(_0x2a4a09,_0x254055){if(_0x2a4a09){return _0x5dffad(_0x2a4a09);}else{return _0x42b4f5(_0x254055);}});});}function transcribe(_0x2a63e1,_0x277f1b,_0x3d198d,_0x3cc2cc,_0x494af5,_0x1d7645,_0x4b507a){return new Promise(function(_0x15ad27,_0x4ba5e8){var _0x57d5b9={};logger[_0x2c96('0x68')](util[_0x2c96('0x37')](_0x2c96('0x73'),_0x2a63e1,_0x494af5));return uploadFile(_0x277f1b,_0x3d198d,_0x3cc2cc,_0x494af5,path[_0x2c96('0x74')](_0x1d7645),fs['readFileSync'](_0x1d7645))[_0x2c96('0x29')](function(_0x1f19c0){logger[_0x2c96('0x68')](util[_0x2c96('0x37')](_0x2c96('0x75'),_0x2a63e1,_0x494af5,_0x1f19c0['Location']));_0x57d5b9['bucket']=_0x1f19c0[_0x2c96('0x76')];_0x57d5b9[_0x2c96('0x77')]=_0x1f19c0[_0x2c96('0x78')];logger[_0x2c96('0x68')](util[_0x2c96('0x37')](_0x2c96('0x79'),_0x2a63e1));return startTranscribe(_0x277f1b,_0x3d198d,_0x3cc2cc,uuidv4(),_0x4b507a,_0x1f19c0[_0x2c96('0x78')]);})['then'](function(_0x13195a){logger[_0x2c96('0x68')](util['format'](_0x2c96('0x7a'),_0x2a63e1,_0x13195a['TranscriptionJob']['TranscriptionJobName']));_0x57d5b9[_0x2c96('0x7b')]=_0x13195a[_0x2c96('0x7c')][_0x2c96('0x7d')];_0x57d5b9[_0x2c96('0x7e')]=_0x13195a[_0x2c96('0x7c')][_0x2c96('0x7f')];return _0x15ad27(_0x57d5b9);})[_0x2c96('0x4c')](function(_0x57ceaa){return _0x4ba5e8(_0x57ceaa);});});}exports[_0x2c96('0x80')]=function(_0x98be63,_0x46c26d,_0x12ac6d){var _0x264027;var _0x24225e;var _0x781bc5;var _0x45edca=require(_0x2c96('0x53'));return db[_0x2c96('0x31')][_0x2c96('0x81')]({'where':{'id':_0x98be63[_0x2c96('0x4e')]['id']}})[_0x2c96('0x29')](function(_0x4d537a){if(_0x4d537a){var _0x100bb5=util[_0x2c96('0x37')](_0x2c96('0x82'),_0x4d537a[_0x2c96('0x55')]);if(fs[_0x2c96('0x56')](_0x100bb5)){cypher=!![];return _0x45edca['decryptFile'](_0x100bb5,_0x4d537a['value'],config[_0x2c96('0x83')][_0x2c96('0x58')])[_0x2c96('0x29')](function(){return _0x4d537a;});}return _0x4d537a;}})[_0x2c96('0x29')](function(_0x5c2b70){if(!_0x5c2b70){throw new db[(_0x2c96('0x64'))]['ValidationError'](_0x2c96('0x84'));}_0x24225e=_0x5c2b70;return db[_0x2c96('0x85')][_0x2c96('0x81')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x46c26d,null))[_0x2c96('0x29')](function(_0x54f327){if(_0x54f327){_0x264027=_0x54f327;if(!_0x264027[_0x2c96('0x86')]||!_0x264027[_0x2c96('0x87')]||!_0x264027[_0x2c96('0x88')]||!_0x264027[_0x2c96('0x89')]||!_0x264027[_0x2c96('0x8a')]){throw new db[(_0x2c96('0x64'))][(_0x2c96('0x59'))]('Transcribe\x20not\x20configured');}if(_0x98be63['body'][_0x2c96('0x8b')]&&(!_0x264027[_0x2c96('0x8c')]||!_0x264027[_0x2c96('0x8d')]||!_0x264027[_0x2c96('0x8e')]||!_0x264027['language']||!_0x264027[_0x2c96('0x8a')])){throw new db['Sequelize'][(_0x2c96('0x59'))](_0x2c96('0x8f'));}return db[_0x2c96('0x90')][_0x2c96('0x81')]({'where':{'id':_0x264027[_0x2c96('0x87')]}});}})[_0x2c96('0x29')](function(_0x2a40ec){if(!_0x2a40ec){throw new db[(_0x2c96('0x64'))][(_0x2c96('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2a40ec[_0x2c96('0x91')]||!_0x2a40ec[_0x2c96('0x92')]){throw new db['Sequelize'][(_0x2c96('0x59'))](_0x2c96('0x93'));}_0x781bc5=_0x2a40ec;return getBucketslist(_0x781bc5['data1'],_0x781bc5[_0x2c96('0x92')],_0x264027[_0x2c96('0x88')]);})[_0x2c96('0x29')](function(_0x4e1c81){if(_0x4e1c81&&_0x4e1c81[_0x2c96('0x94')]){var _0x539a23=_[_0x2c96('0x50')](_0x4e1c81['Buckets'],function(_0x334378){return _0x334378[_0x2c96('0x95')]===_0x264027['bucket'];});if(!_0x539a23){logger[_0x2c96('0x68')](util[_0x2c96('0x37')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x98be63[_0x2c96('0x4e')]['id'],_0x264027[_0x2c96('0x8a')]));return createBucket(_0x781bc5[_0x2c96('0x91')],_0x781bc5['data2'],_0x264027[_0x2c96('0x88')],_0x264027[_0x2c96('0x8a')]);}logger['info'](util['format'](_0x2c96('0x96'),_0x98be63[_0x2c96('0x4e')]['id'],_0x264027[_0x2c96('0x8a')]));return;}})[_0x2c96('0x29')](function(_0x2956fd){if(_0x24225e[_0x2c96('0x7e')]===_0x2c96('0x97')){return transcribe(_0x98be63[_0x2c96('0x4e')]['id'],_0x781bc5[_0x2c96('0x91')],_0x781bc5[_0x2c96('0x92')],_0x264027['transcribeRegion'],_0x264027['bucket'],_0x24225e[_0x2c96('0x55')],_0x264027[_0x2c96('0x89')]);}else{logger[_0x2c96('0x68')](util[_0x2c96('0x37')](_0x2c96('0x98'),_0x98be63[_0x2c96('0x4e')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x2c96('0x29')](function(_0x5ba389){if(_0x5ba389){_0x5ba389[_0x2c96('0x99')]=_0x98be63[_0x2c96('0x9a')][_0x2c96('0x8b')];return _0x24225e[_0x2c96('0x9b')](_0x5ba389);}})[_0x2c96('0x29')](respondWithResult(_0x46c26d,null))[_0x2c96('0x4c')](handleError(_0x46c26d,null));};function writeFile(_0x1dcf5a,_0x16f48a){return new Promise(function(_0xdfb0c8,_0x346d8e){fs[_0x2c96('0x9c')](_0x16f48a,_0x1dcf5a,function(_0x3530da,_0x3a4995){if(_0x3530da){return _0x346d8e(_0x3530da);}else{return _0xdfb0c8(_0x3a4995);}});});}exports[_0x2c96('0x9d')]=function(_0x4323ef,_0x497242,_0x40eb08){return db['VoiceRecording']['findOne']({'where':{'id':_0x4323ef[_0x2c96('0x4e')]['id']}})['then'](handleEntityNotFound(_0x497242))['then'](function(_0x4b9edc){if(_0x4b9edc&&_0x4b9edc[_0x2c96('0x9e')]){var _0x32f0b6=_0x4b9edc[_0x2c96('0x9e')];var _0x52d857=config[_0x2c96('0x9f')]+_0x2c96('0xa0')+_0x4b9edc['id']+_0x2c96('0xa1');if(fs['existsSync'](_0x52d857)){return _0x52d857;}return writeFile(_0x32f0b6,_0x52d857)[_0x2c96('0x29')](function(){return _0x52d857;});}else{throw new db[(_0x2c96('0x64'))][(_0x2c96('0x59'))](_0x2c96('0xa2'));}})[_0x2c96('0x29')](function(_0x5cb3ee){return _0x497242[_0x2c96('0x52')](_0x5cb3ee);})[_0x2c96('0x4c')](handleError(_0x497242));}; \ No newline at end of file +var _0x635e=['fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','VoiceRecording','fieldName','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','length','create','body','find','describe','download','../../components/encryptor','format','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','uniqueid','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','tempSentiment','updateAttributes','downloadTranscribe'];(function(_0x23a0b6,_0x1625ed){var _0x276250=function(_0x5bfd35){while(--_0x5bfd35){_0x23a0b6['push'](_0x23a0b6['shift']());}};_0x276250(++_0x1625ed);}(_0x635e,0x1d0));var _0xe635=function(_0x5af931,_0x185ad6){_0x5af931=_0x5af931-0x0;var _0x1e4c16=_0x635e[_0x5af931];return _0x1e4c16;};'use strict';var emlformat=require(_0xe635('0x0'));var rimraf=require(_0xe635('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe635('0x2'));var rp=require(_0xe635('0x3'));var moment=require(_0xe635('0x4'));var BPromise=require(_0xe635('0x5'));var Mustache=require(_0xe635('0x6'));var util=require(_0xe635('0x7'));var path=require('path');var sox=require(_0xe635('0x8'));var csv=require(_0xe635('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe635('0xa'));var _=require('lodash');var squel=require(_0xe635('0xb'));var crypto=require('crypto');var jsforce=require(_0xe635('0xc'));var deskjs=require(_0xe635('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xe635('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xe635('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe635('0x10'));var as=require(_0xe635('0x11'));var hardwareService=require(_0xe635('0x12'));var logger=require(_0xe635('0x13'))(_0xe635('0x14'));var utils=require(_0xe635('0x15'));var config=require(_0xe635('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2accf1,_0x3a2f10){_0x3a2f10=_0x3a2f10||0xcc;return function(_0x45f57e){if(_0x45f57e){return _0x2accf1['sendStatus'](_0x3a2f10);}return _0x2accf1[_0xe635('0x17')](_0x3a2f10)[_0xe635('0x18')]();};}function respondWithResult(_0x4ea34b,_0x21b7e8){_0x21b7e8=_0x21b7e8||0xc8;return function(_0x5cc83e){if(_0x5cc83e){return _0x4ea34b['status'](_0x21b7e8)[_0xe635('0x19')](_0x5cc83e);}};}function respondWithFilteredResult(_0x78b122,_0x17c9fe){return function(_0xfb48d){if(_0xfb48d){var _0x5ed789=typeof _0x17c9fe[_0xe635('0x1a')]===_0xe635('0x1b')&&typeof _0x17c9fe['limit']==='undefined';var _0x25c581=_0xfb48d['count'];var _0x20d16d=_0x5ed789?0x0:_0x17c9fe[_0xe635('0x1a')];var _0x2df2c7=_0x5ed789?_0xfb48d[_0xe635('0x1c')]:_0x17c9fe['offset']+_0x17c9fe['limit'];var _0x2f2d28;if(_0x2df2c7>=_0x25c581){_0x2df2c7=_0x25c581;_0x2f2d28=0xc8;}else{_0x2f2d28=0xce;}_0x78b122['status'](_0x2f2d28);return _0x78b122['set'](_0xe635('0x1d'),_0x20d16d+'-'+_0x2df2c7+'/'+_0x25c581)['json'](_0xfb48d);}return null;};}function patchUpdates(_0x500a85){return function(_0x322210){try{jsonpatch[_0xe635('0x1e')](_0x322210,_0x500a85,!![]);}catch(_0x26cb71){return BPromise[_0xe635('0x1f')](_0x26cb71);}return _0x322210[_0xe635('0x20')]();};}function saveUpdates(_0x12899d,_0x4add30){return function(_0x46df97){if(_0x46df97){return _0x46df97['update'](_0x12899d)['then'](function(_0x3a84f5){return _0x3a84f5;});}return null;};}function removeEntity(_0x307b92,_0x47e9d7){return function(_0x49327a){if(_0x49327a){return _0x49327a[_0xe635('0x21')]()[_0xe635('0x22')](function(){_0x307b92['status'](0xcc)[_0xe635('0x18')]();});}};}function handleEntityNotFound(_0x1e41c3,_0x1a914b){return function(_0x4a841b){if(!_0x4a841b){_0x1e41c3[_0xe635('0x23')](0x194);}return _0x4a841b;};}function handleError(_0xe2608e,_0x53e34d){_0x53e34d=_0x53e34d||0x1f4;return function(_0x2a713d){logger[_0xe635('0x24')](_0x2a713d[_0xe635('0x25')]);if(_0x2a713d[_0xe635('0x26')]){delete _0x2a713d[_0xe635('0x26')];}_0xe2608e[_0xe635('0x17')](_0x53e34d)[_0xe635('0x27')](_0x2a713d);};}exports['index']=function(_0x176671,_0x537036){var _0x1e8313={},_0x377d74={},_0x562045={'count':0x0,'rows':[]};var _0x1f1e7a=_[_0xe635('0x28')](db[_0xe635('0x29')]['rawAttributes'],function(_0x44e8c9){return{'name':_0x44e8c9[_0xe635('0x2a')],'type':_0x44e8c9['type'][_0xe635('0x2b')]};});_0x377d74['model']=_[_0xe635('0x2c')](_['map'](_0x1f1e7a,'name'),['format']);_0x377d74['query']=_[_0xe635('0x2d')](_0x176671[_0xe635('0x2e')]);_0x377d74[_0xe635('0x2f')]=_[_0xe635('0x30')](_0x377d74[_0xe635('0x31')],_0x377d74[_0xe635('0x2e')]);_0x1e8313['attributes']=_[_0xe635('0x30')](_0x377d74['model'],qs[_0xe635('0x32')](_0x176671['query'][_0xe635('0x32')]));_0x1e8313[_0xe635('0x33')]=_0x1e8313['attributes']['length']?_0x1e8313[_0xe635('0x33')]:_0x377d74[_0xe635('0x31')];if(!_0x176671['query'][_0xe635('0x34')](_0xe635('0x35'))){_0x1e8313[_0xe635('0x36')]=qs[_0xe635('0x36')](_0x176671[_0xe635('0x2e')][_0xe635('0x36')]);_0x1e8313['offset']=qs['offset'](_0x176671[_0xe635('0x2e')]['offset']);}_0x1e8313[_0xe635('0x37')]=qs[_0xe635('0x38')](_0x176671['query'][_0xe635('0x38')]);_0x1e8313[_0xe635('0x39')]=qs['filters'](_[_0xe635('0x3a')](_0x176671[_0xe635('0x2e')],_0x377d74[_0xe635('0x2f')]),_0x1f1e7a);if(_0x176671[_0xe635('0x2e')][_0xe635('0x3b')]){_0x1e8313[_0xe635('0x39')]=_[_0xe635('0x3c')](_0x1e8313['where'],{'$or':_[_0xe635('0x28')](_0x1f1e7a,function(_0x29009f){if(_0x29009f[_0xe635('0x3d')]!==_0xe635('0x3e')){var _0x1d9ae9={};_0x1d9ae9[_0x29009f[_0xe635('0x26')]]={'$like':'%'+_0x176671['query'][_0xe635('0x3b')]+'%'};return _0x1d9ae9;}})});}_0x1e8313=_['merge']({},_0x1e8313,_0x176671[_0xe635('0x3f')]);var _0x452d57={'where':_0x1e8313[_0xe635('0x39')]};return db[_0xe635('0x29')][_0xe635('0x1c')](_0x452d57)[_0xe635('0x22')](function(_0x240184){_0x562045['count']=_0x240184;if(_0x176671[_0xe635('0x2e')][_0xe635('0x40')]){_0x1e8313[_0xe635('0x41')]=[{'all':!![]}];}return db[_0xe635('0x29')][_0xe635('0x42')](_0x1e8313);})['then'](function(_0x3d1e1e){_0x562045['rows']=_0x3d1e1e;return _0x562045;})[_0xe635('0x22')](respondWithFilteredResult(_0x537036,_0x1e8313))[_0xe635('0x43')](handleError(_0x537036,null));};exports['show']=function(_0x2f285d,_0x1381cd){var _0x2f2d41={'raw':![],'where':{'id':_0x2f285d[_0xe635('0x44')]['id']}},_0x45e38a={};_0x45e38a[_0xe635('0x31')]=_[_0xe635('0x2d')](db['VoiceRecording'][_0xe635('0x45')]);_0x45e38a[_0xe635('0x2e')]=_[_0xe635('0x2d')](_0x2f285d[_0xe635('0x2e')]);_0x45e38a[_0xe635('0x2f')]=_[_0xe635('0x30')](_0x45e38a[_0xe635('0x31')],_0x45e38a[_0xe635('0x2e')]);_0x2f2d41[_0xe635('0x33')]=_['intersection'](_0x45e38a[_0xe635('0x31')],qs[_0xe635('0x32')](_0x2f285d[_0xe635('0x2e')][_0xe635('0x32')]));_0x2f2d41[_0xe635('0x33')]=_0x2f2d41[_0xe635('0x33')][_0xe635('0x46')]?_0x2f2d41[_0xe635('0x33')]:_0x45e38a[_0xe635('0x31')];if(_0x2f285d[_0xe635('0x2e')][_0xe635('0x40')]){_0x2f2d41['include']=[{'all':!![]}];}_0x2f2d41=_[_0xe635('0x3c')]({},_0x2f2d41,_0x2f285d['options']);return db[_0xe635('0x29')]['find'](_0x2f2d41)[_0xe635('0x22')](handleEntityNotFound(_0x1381cd,null))[_0xe635('0x22')](respondWithResult(_0x1381cd,null))['catch'](handleError(_0x1381cd,null));};exports[_0xe635('0x47')]=function(_0x52bfd6,_0x3b4234){return db[_0xe635('0x29')][_0xe635('0x47')](_0x52bfd6[_0xe635('0x48')],{})[_0xe635('0x22')](respondWithResult(_0x3b4234,0xc9))[_0xe635('0x43')](handleError(_0x3b4234,null));};exports['update']=function(_0x361db4,_0x3debe3){if(_0x361db4[_0xe635('0x48')]['id']){delete _0x361db4[_0xe635('0x48')]['id'];}return db[_0xe635('0x29')][_0xe635('0x49')]({'where':{'id':_0x361db4[_0xe635('0x44')]['id']}})[_0xe635('0x22')](handleEntityNotFound(_0x3debe3,null))[_0xe635('0x22')](saveUpdates(_0x361db4[_0xe635('0x48')],null))['then'](respondWithResult(_0x3debe3,null))[_0xe635('0x43')](handleError(_0x3debe3,null));};exports['describe']=function(_0x4c28ed,_0x3b6d59){return db[_0xe635('0x29')][_0xe635('0x4a')]()[_0xe635('0x22')](respondWithResult(_0x3b6d59,null))[_0xe635('0x43')](handleError(_0x3b6d59,null));};exports[_0xe635('0x4b')]=function(_0x31dba0,_0x2d7785,_0x320845){var _0xd69a61=require(_0xe635('0x4c'));var _0x6bbab8=![];var _0x4415e4={};if(_0x31dba0[_0xe635('0x2e')][_0xe635('0x3d')]&&_0x31dba0[_0xe635('0x2e')][_0xe635('0x3d')]==='uniqueid'){_0x4415e4['uniqueid']=_0x31dba0[_0xe635('0x44')]['id'];}else{_0x4415e4['id']=_0x31dba0['params']['id'];}return db[_0xe635('0x29')][_0xe635('0x49')]({'where':_0x4415e4,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x2d7785,null))[_0xe635('0x22')](function(_0x55229f){if(_0x55229f){var _0x368e4b=_0x55229f['value'];var _0x1e141c=util[_0xe635('0x4d')]('%s.cypher',_0x368e4b);if(fs[_0xe635('0x4e')](_0x1e141c)){_0x6bbab8=!![];return _0xd69a61[_0xe635('0x4f')](_0x1e141c,_0x368e4b,config[_0xe635('0x50')][_0xe635('0x51')])[_0xe635('0x22')](function(){return _0x55229f;});}return _0x55229f;}})['then'](function(_0x3e657a){if(_0x3e657a){var _0x1d6b81=_0x3e657a[_0xe635('0x52')];if(!fs[_0xe635('0x4e')](_0x1d6b81)){throw new db[(_0xe635('0x53'))][(_0xe635('0x54'))](_0xe635('0x55'));}if(_0x3e657a[_0xe635('0x56')]){return _0x2d7785[_0xe635('0x4b')](_0x1d6b81,_0x3e657a['filename']+path[_0xe635('0x57')](_0x1d6b81),function(){if(_0x6bbab8){fs[_0xe635('0x58')](_0x1d6b81);}});}else{return _0x2d7785[_0xe635('0x4b')](_0x1d6b81,function(_0x58bc72){if(_0x6bbab8){fs['unlink'](_0x1d6b81);}});}}})[_0xe635('0x43')](function(_0x4b2b2c){if(_0x4b2b2c[_0xe635('0x59')]===_0xe635('0x55')){_0x2d7785['status'](0x194)[_0xe635('0x27')](_0xe635('0x5a'));}else{return handleError(_0x2d7785,null);}});};exports[_0xe635('0x5b')]=function(_0x4bae3b,_0xae5ba6,_0x1e653f){var _0x1a2ac7=require('../../components/encryptor');var _0x55fb2d=![];var _0x1bf1ee={'$and':[db['sequelize'][_0xe635('0x39')](db[_0xe635('0x5c')]['fn'](_0xe635('0x5d'),db[_0xe635('0x5c')][_0xe635('0x5e')](_0xe635('0x5f'))),_0x4bae3b[_0xe635('0x2e')][_0xe635('0x60')])]};if(_0x4bae3b['query'][_0xe635('0x3d')]&&_0x4bae3b['query'][_0xe635('0x3d')]===_0xe635('0x5f')){_0x1bf1ee[_0xe635('0x61')][_0xe635('0x62')]({'uniqueid':_0x4bae3b[_0xe635('0x44')]['id']});}else{_0x1bf1ee['$and']['push']({'id':_0x4bae3b[_0xe635('0x44')]['id']});}return db[_0xe635('0x29')]['find']({'where':_0x1bf1ee,'attributes':['id',_0xe635('0x52')],'raw':!![]})[_0xe635('0x22')](handleEntityNotFound(_0xae5ba6,null))['then'](function(_0x4a5814){if(_0x4a5814){var _0x1c300e=util[_0xe635('0x4d')]('%s.cypher',_0x4a5814['value']);if(fs[_0xe635('0x4e')](_0x1c300e)){_0x55fb2d=!![];return _0x1a2ac7[_0xe635('0x4f')](_0x1c300e,_0x4a5814[_0xe635('0x52')],config[_0xe635('0x50')][_0xe635('0x51')])[_0xe635('0x22')](function(){return _0x4a5814;});}return _0x4a5814;}})[_0xe635('0x22')](function(_0x112448){if(_0x112448){if(!fs['existsSync'](_0x112448['value'])){throw new db['Sequelize'][(_0xe635('0x54'))](_0xe635('0x55'));}if(_0x112448[_0xe635('0x56')]){return _0xae5ba6['download'](_0x112448[_0xe635('0x52')],_0x112448[_0xe635('0x56')]+path[_0xe635('0x57')](_0x112448[_0xe635('0x52')]),function(){if(_0x55fb2d){fs['unlink'](_0x112448[_0xe635('0x52')]);}});}else{return _0xae5ba6[_0xe635('0x4b')](_0x112448[_0xe635('0x52')],function(_0x262ca8){if(_0x55fb2d){fs[_0xe635('0x58')](_0x112448[_0xe635('0x52')]);}});}}})[_0xe635('0x43')](handleError(_0xae5ba6,null));};exports[_0xe635('0x21')]=function(_0x29f42c,_0x5ac2c6){return db[_0xe635('0x29')]['find']({'where':{'id':_0x29f42c[_0xe635('0x44')]['id']}})['then'](function(_0x3c60a9){if(_[_0xe635('0x63')](_0x3c60a9)){throw new ReferenceError(_0xe635('0x64'));}return _0x3c60a9;})[_0xe635('0x22')](function(_0x38018b){var _0x78d303=_0x38018b[_0xe635('0x52')];logger[_0xe635('0x65')](_0xe635('0x66'),_0x78d303);if(!_['isNil'](_0x38018b[_0xe635('0x52')])&&fs['existsSync'](_0x78d303)){logger[_0xe635('0x65')]('File:\x20\x22'+_0x78d303+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe635('0x67')](_0x78d303);}_0x78d303=_0x78d303+'.cypher';if(!_['isNil'](_0x38018b[_0xe635('0x52')])&&fs[_0xe635('0x4e')](_0x78d303)){logger[_0xe635('0x65')](_0xe635('0x68')+_0x78d303+_0xe635('0x69'));fs[_0xe635('0x67')](_0x78d303);}return _0x38018b;})[_0xe635('0x22')](function(_0x218cef){if(!_0x218cef)throw new InternalError();return _0x218cef['destroy']();})[_0xe635('0x22')](function(){_0x5ac2c6['status'](0xcc)[_0xe635('0x18')]();})['catch'](handleError(_0x5ac2c6,null));};function getBucketslist(_0xfeae0f,_0x116bcf,_0x4f321d){return new Promise(function(_0x27e225,_0x2390c0){var _0xb1100c=new AWS['S3']({'accessKeyId':_0x116bcf,'secretAccessKey':_0xfeae0f,'region':_0x4f321d});_0xb1100c[_0xe635('0x6a')]({},function(_0x536c7a,_0x2bfaf1){if(_0x536c7a){return _0x2390c0(_0x536c7a);}else{return _0x27e225(_0x2bfaf1);}});});}function createBucket(_0x104993,_0x4f75aa,_0x2f54c4,_0x51c5b4){return new Promise(function(_0x1ecf0d,_0x583e9e){var _0xbbd6af=new AWS['S3']({'accessKeyId':_0x4f75aa,'secretAccessKey':_0x104993,'region':_0x2f54c4});_0xbbd6af['createBucket']({'Bucket':_0x51c5b4},function(_0x8b33bb,_0x518fad){if(_0x8b33bb){return _0x583e9e(_0x8b33bb);}else{return _0x1ecf0d(_0x518fad);}});});}function uploadFile(_0x4232b3,_0x3b78c5,_0x40749a,_0x84ea1,_0x56a32d,_0x3acbe9){return new Promise(function(_0x14cd67,_0x279e19){var _0x2568e8=new AWS['S3']({'accessKeyId':_0x3b78c5,'secretAccessKey':_0x4232b3,'region':_0x40749a});_0x2568e8['upload']({'Bucket':_0x84ea1,'Key':_0x56a32d,'Body':_0x3acbe9},function(_0x2ab2d6,_0x339cd3){if(_0x2ab2d6){return _0x279e19(_0x2ab2d6);}else{return _0x14cd67(_0x339cd3);}});});}function startTranscribe(_0x114353,_0x197cf7,_0x4c718a,_0x4d2823,_0x4d51cc,_0x4b6b1a){return new Promise(function(_0x2f3fc3,_0x5a2489){var _0x51967d=new AWS[(_0xe635('0x6b'))]({'accessKeyId':_0x197cf7,'secretAccessKey':_0x114353,'region':_0x4c718a});_0x51967d[_0xe635('0x6c')]({'TranscriptionJobName':_0x4d2823,'LanguageCode':_0x4d51cc,'Media':{'MediaFileUri':_0x4b6b1a}},function(_0x3d82a6,_0x1dd09){if(_0x3d82a6){return _0x5a2489(_0x3d82a6);}else{return _0x2f3fc3(_0x1dd09);}});});}function transcribe(_0x3b4a1f,_0x5561d3,_0x2011ea,_0x168a02,_0x33dca3,_0x54561d,_0xae8b2){return new Promise(function(_0xbc198b,_0x515e12){var _0x1cb3d6={};logger[_0xe635('0x65')](util[_0xe635('0x4d')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3b4a1f,_0x33dca3));return uploadFile(_0x5561d3,_0x2011ea,_0x168a02,_0x33dca3,path[_0xe635('0x6d')](_0x54561d),fs['readFileSync'](_0x54561d))[_0xe635('0x22')](function(_0x557c24){logger[_0xe635('0x65')](util['format'](_0xe635('0x6e'),_0x3b4a1f,_0x33dca3,_0x557c24[_0xe635('0x6f')]));_0x1cb3d6['bucket']=_0x557c24[_0xe635('0x70')];_0x1cb3d6[_0xe635('0x71')]=_0x557c24[_0xe635('0x6f')];logger['info'](util['format'](_0xe635('0x72'),_0x3b4a1f));return startTranscribe(_0x5561d3,_0x2011ea,_0x168a02,uuidv4(),_0xae8b2,_0x557c24[_0xe635('0x6f')]);})[_0xe635('0x22')](function(_0x169711){logger[_0xe635('0x65')](util[_0xe635('0x4d')](_0xe635('0x73'),_0x3b4a1f,_0x169711[_0xe635('0x74')][_0xe635('0x75')]));_0x1cb3d6['transcribeName']=_0x169711[_0xe635('0x74')][_0xe635('0x75')];_0x1cb3d6[_0xe635('0x76')]=_0x169711['TranscriptionJob'][_0xe635('0x77')];return _0xbc198b(_0x1cb3d6);})[_0xe635('0x43')](function(_0x2ec907){return _0x515e12(_0x2ec907);});});}exports[_0xe635('0x78')]=function(_0x5f4788,_0x3b6262,_0x4f2f2f){var _0x4dc04f;var _0x4d99b3;var _0x2090a3;var _0x1be26c=require(_0xe635('0x4c'));return db['VoiceRecording'][_0xe635('0x79')]({'where':{'id':_0x5f4788['params']['id']}})[_0xe635('0x22')](function(_0xc464ef){if(_0xc464ef){var _0x2ca34b=util[_0xe635('0x4d')](_0xe635('0x7a'),_0xc464ef[_0xe635('0x52')]);if(fs['existsSync'](_0x2ca34b)){cypher=!![];return _0x1be26c['decryptFile'](_0x2ca34b,_0xc464ef[_0xe635('0x52')],config['secrets']['recording'])[_0xe635('0x22')](function(){return _0xc464ef;});}return _0xc464ef;}})[_0xe635('0x22')](function(_0x31f617){if(!_0x31f617){throw new db['Sequelize'][(_0xe635('0x54'))](_0xe635('0x7b'));}_0x4d99b3=_0x31f617;return db[_0xe635('0x7c')][_0xe635('0x79')]({'where':{'id':0x1}});})[_0xe635('0x22')](handleEntityNotFound(_0x3b6262,null))[_0xe635('0x22')](function(_0x8c9557){if(_0x8c9557){_0x4dc04f=_0x8c9557;if(!_0x4dc04f[_0xe635('0x7d')]||!_0x4dc04f[_0xe635('0x7e')]||!_0x4dc04f['transcribeRegion']||!_0x4dc04f[_0xe635('0x7f')]||!_0x4dc04f[_0xe635('0x80')]){throw new db[(_0xe635('0x53'))][(_0xe635('0x54'))](_0xe635('0x81'));}if(_0x5f4788[_0xe635('0x48')][_0xe635('0x82')]&&(!_0x4dc04f[_0xe635('0x83')]||!_0x4dc04f[_0xe635('0x84')]||!_0x4dc04f[_0xe635('0x85')]||!_0x4dc04f[_0xe635('0x7f')]||!_0x4dc04f['bucket'])){throw new db[(_0xe635('0x53'))][(_0xe635('0x54'))](_0xe635('0x86'));}return db[_0xe635('0x87')][_0xe635('0x79')]({'where':{'id':_0x4dc04f['transcribeAccountId']}});}})['then'](function(_0x196dcf){if(!_0x196dcf){throw new db[(_0xe635('0x53'))]['ValidationError'](_0xe635('0x88'));}if(!_0x196dcf[_0xe635('0x89')]||!_0x196dcf[_0xe635('0x8a')]){throw new db['Sequelize']['ValidationError'](_0xe635('0x8b'));}_0x2090a3=_0x196dcf;return getBucketslist(_0x2090a3[_0xe635('0x89')],_0x2090a3[_0xe635('0x8a')],_0x4dc04f[_0xe635('0x8c')]);})['then'](function(_0x167358){if(_0x167358&&_0x167358[_0xe635('0x8d')]){var _0x263d2c=_[_0xe635('0x49')](_0x167358['Buckets'],function(_0x264e32){return _0x264e32[_0xe635('0x8e')]===_0x4dc04f[_0xe635('0x80')];});if(!_0x263d2c){logger[_0xe635('0x65')](util[_0xe635('0x4d')](_0xe635('0x8f'),_0x5f4788[_0xe635('0x44')]['id'],_0x4dc04f['bucket']));return createBucket(_0x2090a3[_0xe635('0x89')],_0x2090a3[_0xe635('0x8a')],_0x4dc04f['transcribeRegion'],_0x4dc04f[_0xe635('0x80')]);}logger['info'](util[_0xe635('0x4d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5f4788[_0xe635('0x44')]['id'],_0x4dc04f[_0xe635('0x80')]));return;}})[_0xe635('0x22')](function(_0xc0c6b0){if(_0x4d99b3['transcribeStatus']===_0xe635('0x90')){return transcribe(_0x5f4788[_0xe635('0x44')]['id'],_0x2090a3[_0xe635('0x89')],_0x2090a3[_0xe635('0x8a')],_0x4dc04f[_0xe635('0x8c')],_0x4dc04f[_0xe635('0x80')],_0x4d99b3[_0xe635('0x52')],_0x4dc04f[_0xe635('0x7f')]);}else{logger[_0xe635('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5f4788[_0xe635('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x424f7b){if(_0x424f7b){_0x424f7b[_0xe635('0x91')]=_0x5f4788['body'][_0xe635('0x82')];return _0x4d99b3[_0xe635('0x92')](_0x424f7b);}})['then'](respondWithResult(_0x3b6262,null))[_0xe635('0x43')](handleError(_0x3b6262,null));};function writeFile(_0x29cbc5,_0x10e0d9){return new Promise(function(_0x30aa8e,_0x337d32){fs['writeFile'](_0x10e0d9,_0x29cbc5,function(_0x3d28c8,_0xa207b5){if(_0x3d28c8){return _0x337d32(_0x3d28c8);}else{return _0x30aa8e(_0xa207b5);}});});}exports[_0xe635('0x93')]=function(_0x570b42,_0x3be0b0,_0x422627){return db['VoiceRecording'][_0xe635('0x79')]({'where':{'id':_0x570b42[_0xe635('0x44')]['id']}})[_0xe635('0x22')](handleEntityNotFound(_0x3be0b0))['then'](function(_0x4466d4){if(_0x4466d4&&_0x4466d4[_0xe635('0x94')]){var _0x1608db=_0x4466d4['fileText'];var _0x4ef2cd=config[_0xe635('0x95')]+_0xe635('0x96')+_0x4466d4['id']+_0xe635('0x97');if(fs[_0xe635('0x4e')](_0x4ef2cd)){return _0x4ef2cd;}return writeFile(_0x1608db,_0x4ef2cd)[_0xe635('0x22')](function(){return _0x4ef2cd;});}else{throw new db[(_0xe635('0x53'))][(_0xe635('0x54'))](_0xe635('0x98'));}})['then'](function(_0x427535){return _0x3be0b0[_0xe635('0x4b')](_0x427535);})[_0xe635('0x43')](handleError(_0x3be0b0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8d718b9..3c0099a 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 _0x31c4=['VoiceRecording','voice_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define'];(function(_0x4f71f4,_0x101c75){var _0x52ae00=function(_0x4af57e){while(--_0x4af57e){_0x4f71f4['push'](_0x4f71f4['shift']());}};_0x52ae00(++_0x101c75);}(_0x31c4,0x113));var _0x431c=function(_0x1b1bf2,_0x5e9b0f){_0x1b1bf2=_0x1b1bf2-0x0;var _0x401f75=_0x31c4[_0x1b1bf2];return _0x401f75;};'use strict';var _=require(_0x431c('0x0'));var util=require('util');var logger=require(_0x431c('0x1'))(_0x431c('0x2'));var moment=require(_0x431c('0x3'));var BPromise=require(_0x431c('0x4'));var rp=require(_0x431c('0x5'));var fs=require('fs');var path=require(_0x431c('0x6'));var rimraf=require(_0x431c('0x7'));var config=require('../../config/environment');var attributes=require(_0x431c('0x8'));module[_0x431c('0x9')]=function(_0x4f2628,_0x47532d){return _0x4f2628[_0x431c('0xa')](_0x431c('0xb'),attributes,{'tableName':_0x431c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x38c1=['uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x38c1,0x7f));var _0x138c=function(_0x9aaca8,_0x222c1a){_0x9aaca8=_0x9aaca8-0x0;var _0x1a77bd=_0x38c1[_0x9aaca8];return _0x1a77bd;};'use strict';var _=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var logger=require(_0x138c('0x2'))(_0x138c('0x3'));var moment=require(_0x138c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x138c('0x5'));var rimraf=require(_0x138c('0x6'));var config=require(_0x138c('0x7'));var attributes=require(_0x138c('0x8'));module[_0x138c('0x9')]=function(_0x29a6ec,_0x5473c5){return _0x29a6ec[_0x138c('0xa')](_0x138c('0xb'),attributes,{'tableName':_0x138c('0xc'),'paranoid':![],'indexes':[{'name':_0x138c('0xd'),'fields':[_0x138c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5345f7b..4fb5414 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','attributes','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','unlink','info','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26ddc7,_0x4551df){var _0x4774f4=function(_0x1b154c){while(--_0x1b154c){_0x26ddc7['push'](_0x26ddc7['shift']());}};_0x4774f4(++_0x4551df);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4d71e1,_0x437a37){_0x4d71e1=_0x4d71e1-0x0;var _0x33d218=_0xc2c7[_0x4d71e1];return _0x33d218;};'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')]('VoiceRecording,\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);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')](_0x14453f[_0x7c2c('0x18')],{'raw':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')]['where']||null:null,'attributes':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null})[_0x7c2c('0xc')](function(_0xa84620){logger['info'](_0x7c2c('0x15'),_0x14453f);logger['debug'](_0x7c2c('0x15'),_0x14453f,JSON['stringify'](_0xa84620));_0x17df4a(_0xa84620);})[_0x7c2c('0x1d')](function(_0x274c3b){logger[_0x7c2c('0x12')]('UpdateVoiceRecording',_0x274c3b['message'],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0x274c3b[_0x7c2c('0x14')]));});});};exports[_0x7c2c('0x1e')]=function(_0x150690){var _0x31d8f3=this;return new Promise(function(_0xa8e145,_0x3f4618){var _0x4b1dd0=require(_0x7c2c('0x1f'));var _0xf39941;return db[_0x7c2c('0x20')][_0x7c2c('0x21')]({'attributes':['id',_0x7c2c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7c2c('0xc')](function(_0xf2bfd1){_0xf39941=_0xf2bfd1;return db[_0x7c2c('0x16')][_0x7c2c('0x23')](_0x150690['body']);})[_0x7c2c('0xc')](function(_0x3a3730){if(_0xf39941[_0x7c2c('0x22')]&&fs[_0x7c2c('0x24')](_0x3a3730['value'])){var _0xcb98ba=util[_0x7c2c('0x25')](_0x7c2c('0x26'),_0x3a3730[_0x7c2c('0x27')]);return _0x4b1dd0[_0x7c2c('0x28')](_0x3a3730[_0x7c2c('0x27')],_0xcb98ba,config[_0x7c2c('0x29')]['recording'])[_0x7c2c('0xc')](function(){fs[_0x7c2c('0x2a')](_0x3a3730[_0x7c2c('0x27')]);logger[_0x7c2c('0x2b')](_0x7c2c('0x2c'));return _0x3a3730;});}return _0x3a3730;})['then'](function(_0x47ef3c){logger[_0x7c2c('0x2b')]('CreateVoiceRecording',_0x150690);logger['debug'](_0x7c2c('0x1e'),_0x150690,JSON[_0x7c2c('0x11')](_0x47ef3c));_0xa8e145(_0x47ef3c);})[_0x7c2c('0x1d')](function(_0x156c03){logger['error'](_0x7c2c('0x1e'),_0x156c03[_0x7c2c('0x14')],_0x150690);_0x3f4618(_0x31d8f3[_0x7c2c('0x12')](0x1f4,_0x156c03[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0xbff5=['catch','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','%s.cypher','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','options','raw','where','attributes','then','UpdateVoiceRecording','debug'];(function(_0x4c0155,_0x5b20db){var _0x1276db=function(_0x3ff813){while(--_0x3ff813){_0x4c0155['push'](_0x4c0155['shift']());}};_0x1276db(++_0x5b20db);}(_0xbff5,0x1bc));var _0x5bff=function(_0x1a2ff9,_0x5c00e5){_0x1a2ff9=_0x1a2ff9-0x0;var _0x5cca00=_0xbff5[_0x1a2ff9];return _0x5cca00;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['UpdateVoiceRecording']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['VoiceRecording'][_0x5bff('0x15')](_0xc9fbc3['body'],{'raw':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3['options'][_0x5bff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')]['limit']||null:null})[_0x5bff('0x1a')](function(_0x263cf5){logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0xc9fbc3);logger[_0x5bff('0x1c')](_0x5bff('0x1b'),_0xc9fbc3,JSON[_0x5bff('0xf')](_0x263cf5));_0x36653b(_0x263cf5);})[_0x5bff('0x1d')](function(_0x5e2ae8){logger['error'](_0x5bff('0x1b'),_0x5e2ae8['message'],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x5e2ae8[_0x5bff('0x12')]));});});};exports[_0x5bff('0x1e')]=function(_0x6f18f1){var _0xfa361d=this;return new Promise(function(_0x1140eb,_0x271f3c){var _0xedba9d=require('../../components/encryptor');var _0x4df57a;return db[_0x5bff('0x1f')][_0x5bff('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5bff('0x1a')](function(_0x588078){_0x4df57a=_0x588078;return db['VoiceRecording'][_0x5bff('0x21')](_0x6f18f1['body']);})[_0x5bff('0x1a')](function(_0x64e22){if(_0x4df57a[_0x5bff('0x22')]&&fs[_0x5bff('0x23')](_0x64e22['value'])){var _0x71783=util['format'](_0x5bff('0x24'),_0x64e22['value']);return _0xedba9d[_0x5bff('0x25')](_0x64e22[_0x5bff('0x26')],_0x71783,config[_0x5bff('0x27')][_0x5bff('0x28')])[_0x5bff('0x1a')](function(){fs[_0x5bff('0x29')](_0x64e22['value']);logger[_0x5bff('0x13')](_0x5bff('0x2a'));return _0x64e22;});}return _0x64e22;})[_0x5bff('0x1a')](function(_0x42fe4a){logger[_0x5bff('0x13')](_0x5bff('0x1e'),_0x6f18f1);logger[_0x5bff('0x1c')](_0x5bff('0x1e'),_0x6f18f1,JSON['stringify'](_0x42fe4a));_0x1140eb(_0x42fe4a);})[_0x5bff('0x1d')](function(_0x16042d){logger[_0x5bff('0x10')](_0x5bff('0x1e'),_0x16042d['message'],_0x6f18f1);_0x271f3c(_0xfa361d[_0x5bff('0x10')](0x1f4,_0x16042d[_0x5bff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 69b542c..51e03ac 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 _0x2f53=['post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0xb9f2fd,_0x24832d){var _0x5e0b6e=function(_0x72a0dd){while(--_0x72a0dd){_0xb9f2fd['push'](_0xb9f2fd['shift']());}};_0x5e0b6e(++_0x24832d);}(_0x2f53,0x156));var _0x32f5=function(_0x4eeeb1,_0x19ea0c){_0x4eeeb1=_0x4eeeb1-0x0;var _0x3e5682=_0x2f53[_0x4eeeb1];return _0x3e5682;};'use strict';var multer=require(_0x32f5('0x0'));var util=require(_0x32f5('0x1'));var path=require(_0x32f5('0x2'));var timeout=require(_0x32f5('0x3'));var express=require(_0x32f5('0x4'));var router=express[_0x32f5('0x5')]();var fs_extra=require(_0x32f5('0x6'));var auth=require(_0x32f5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x32f5('0x8'));var controller=require(_0x32f5('0x9'));router[_0x32f5('0xa')]('/',auth[_0x32f5('0xb')](),controller[_0x32f5('0xc')]);router[_0x32f5('0xa')](_0x32f5('0xd'),auth[_0x32f5('0xb')](),controller['describe']);router[_0x32f5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x32f5('0xe')]);router[_0x32f5('0xf')]('/',auth[_0x32f5('0xb')](),controller[_0x32f5('0x10')]);router[_0x32f5('0x11')](_0x32f5('0x12'),auth[_0x32f5('0xb')](),controller['update']);router[_0x32f5('0x13')](_0x32f5('0x12'),auth[_0x32f5('0xb')](),controller[_0x32f5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2022=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2022,0xf3));var _0x2202=function(_0x477a1,_0x212eb7){_0x477a1=_0x477a1-0x0;var _0x28b171=_0x2022[_0x477a1];return _0x28b171;};'use strict';var multer=require(_0x2202('0x0'));var util=require(_0x2202('0x1'));var path=require(_0x2202('0x2'));var timeout=require(_0x2202('0x3'));var express=require(_0x2202('0x4'));var router=express[_0x2202('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2202('0x6'));var config=require(_0x2202('0x7'));var controller=require(_0x2202('0x8'));router[_0x2202('0x9')]('/',auth[_0x2202('0xa')](),controller['index']);router[_0x2202('0x9')]('/describe',auth[_0x2202('0xa')](),controller[_0x2202('0xb')]);router[_0x2202('0x9')](_0x2202('0xc'),auth['isAuthenticated'](),controller[_0x2202('0xd')]);router[_0x2202('0xe')]('/',auth[_0x2202('0xa')](),controller['create']);router[_0x2202('0xf')](_0x2202('0xc'),auth[_0x2202('0xa')](),controller[_0x2202('0x10')]);router[_0x2202('0x11')](_0x2202('0xc'),auth['isAuthenticated'](),controller[_0x2202('0x12')]);module[_0x2202('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index dcc2e9b..6ff746a 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 _0x2f1f=['exports','STRING','ENUM','sequelize','moment'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x2f1f,0x1bb));var _0xf2f1=function(_0xa1d62,_0x2cc095){_0xa1d62=_0xa1d62-0x0;var _0x54e9fd=_0x2f1f[_0xa1d62];return _0x54e9fd;};'use strict';var Sequelize=require(_0xf2f1('0x0'));var moment=require(_0xf2f1('0x1'));module[_0xf2f1('0x2')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize[_0xf2f1('0x3')]},'transfererchannel':{'type':Sequelize[_0xf2f1('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xf2f1('0x3')]},'transferercalleridname':{'type':Sequelize[_0xf2f1('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xf2f1('0x3')]},'transferercontext':{'type':Sequelize[_0xf2f1('0x3')]},'transfererexten':{'type':Sequelize[_0xf2f1('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xf2f1('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xf2f1('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xf2f1('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf2f1('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf2f1('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xf2f1('0x3')]},'transfereecontext':{'type':Sequelize[_0xf2f1('0x3')]},'transfereeexten':{'type':Sequelize[_0xf2f1('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xf2f1('0x3')]},'isexternal':{'type':Sequelize[_0xf2f1('0x4')]('Yes','No')},'context':{'type':Sequelize[_0xf2f1('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0695=['blind','attended','STRING','moment','exports','ENUM'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0695,0xbd));var _0x5069=function(_0x2fd1cc,_0x4c4831){_0x2fd1cc=_0x2fd1cc-0x0;var _0x3cdc2c=_0x0695[_0x2fd1cc];return _0x3cdc2c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5069('0x0'));module[_0x5069('0x1')]={'type':{'type':Sequelize[_0x5069('0x2')](_0x5069('0x3'),_0x5069('0x4'))},'result':{'type':Sequelize[_0x5069('0x5')]},'transfererchannel':{'type':Sequelize[_0x5069('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x5069('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5069('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5069('0x5')]},'transferercontext':{'type':Sequelize[_0x5069('0x5')]},'transfererexten':{'type':Sequelize[_0x5069('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x5069('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x5069('0x5')]},'transfereecontext':{'type':Sequelize[_0x5069('0x5')]},'transfereeexten':{'type':Sequelize[_0x5069('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x5069('0x5')]},'isexternal':{'type':Sequelize[_0x5069('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 777c868..4ff1f6e 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 _0x285a=['to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','length','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x285a,0xd4));var _0xa285=function(_0x483ff7,_0x8332e3){_0x483ff7=_0x483ff7-0x0;var _0x52697b=_0x285a[_0x483ff7];return _0x52697b;};'use strict';var emlformat=require(_0xa285('0x0'));var rimraf=require(_0xa285('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa285('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa285('0x3'));var Mustache=require(_0xa285('0x4'));var util=require(_0xa285('0x5'));var path=require(_0xa285('0x6'));var sox=require('sox');var csv=require(_0xa285('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa285('0x8'));var _=require(_0xa285('0x9'));var squel=require(_0xa285('0xa'));var crypto=require(_0xa285('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa285('0x7'));var querystring=require(_0xa285('0xc'));var Papa=require(_0xa285('0xd'));var Redis=require(_0xa285('0xe'));var authService=require(_0xa285('0xf'));var qs=require(_0xa285('0x10'));var as=require(_0xa285('0x11'));var hardwareService=require(_0xa285('0x12'));var logger=require(_0xa285('0x13'))(_0xa285('0x14'));var utils=require(_0xa285('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa285('0x16'));var db=require(_0xa285('0x17'))['db'];function respondWithStatusCode(_0x2b8804,_0x31afa8){_0x31afa8=_0x31afa8||0xcc;return function(_0x3f8565){if(_0x3f8565){return _0x2b8804[_0xa285('0x18')](_0x31afa8);}return _0x2b8804[_0xa285('0x19')](_0x31afa8)[_0xa285('0x1a')]();};}function respondWithResult(_0x4df11c,_0x16c52c){_0x16c52c=_0x16c52c||0xc8;return function(_0x4fff1b){if(_0x4fff1b){return _0x4df11c[_0xa285('0x19')](_0x16c52c)[_0xa285('0x1b')](_0x4fff1b);}};}function respondWithFilteredResult(_0x27a29c,_0x1fedbb){return function(_0x362526){if(_0x362526){var _0x53c185=typeof _0x1fedbb[_0xa285('0x1c')]===_0xa285('0x1d')&&typeof _0x1fedbb[_0xa285('0x1e')]===_0xa285('0x1d');var _0x4f328e=_0x362526[_0xa285('0x1f')];var _0x5a8227=_0x53c185?0x0:_0x1fedbb['offset'];var _0xfda281=_0x53c185?_0x362526[_0xa285('0x1f')]:_0x1fedbb[_0xa285('0x1c')]+_0x1fedbb[_0xa285('0x1e')];var _0x16d6f9;if(_0xfda281>=_0x4f328e){_0xfda281=_0x4f328e;_0x16d6f9=0xc8;}else{_0x16d6f9=0xce;}_0x27a29c[_0xa285('0x19')](_0x16d6f9);return _0x27a29c['set']('Content-Range',_0x5a8227+'-'+_0xfda281+'/'+_0x4f328e)['json'](_0x362526);}return null;};}function patchUpdates(_0x471de2){return function(_0x301334){try{jsonpatch[_0xa285('0x20')](_0x301334,_0x471de2,!![]);}catch(_0x174ff7){return BPromise[_0xa285('0x21')](_0x174ff7);}return _0x301334[_0xa285('0x22')]();};}function saveUpdates(_0xcc53ed,_0x5b160e){return function(_0x1d6552){if(_0x1d6552){return _0x1d6552[_0xa285('0x23')](_0xcc53ed)[_0xa285('0x24')](function(_0x5bcd41){return _0x5bcd41;});}return null;};}function removeEntity(_0x14a8d8,_0x52b5ce){return function(_0x1859c4){if(_0x1859c4){return _0x1859c4['destroy']()[_0xa285('0x24')](function(){_0x14a8d8[_0xa285('0x19')](0xcc)[_0xa285('0x1a')]();});}};}function handleEntityNotFound(_0x5b18e2,_0x36ee04){return function(_0x4061e8){if(!_0x4061e8){_0x5b18e2[_0xa285('0x18')](0x194);}return _0x4061e8;};}function handleError(_0x2c3437,_0x3454f9){_0x3454f9=_0x3454f9||0x1f4;return function(_0x4e1226){logger['error'](_0x4e1226[_0xa285('0x25')]);if(_0x4e1226[_0xa285('0x26')]){delete _0x4e1226[_0xa285('0x26')];}_0x2c3437['status'](_0x3454f9)[_0xa285('0x27')](_0x4e1226);};}exports[_0xa285('0x28')]=function(_0x41e4cc,_0x5530d0){var _0x43db41={},_0x3e3db8={},_0x4bf869={'count':0x0,'rows':[]};var _0x1c8906=_[_0xa285('0x29')](db['VoiceTransferReport'][_0xa285('0x2a')],function(_0x5192d5){return{'name':_0x5192d5[_0xa285('0x2b')],'type':_0x5192d5[_0xa285('0x2c')][_0xa285('0x2d')]};});_0x3e3db8[_0xa285('0x2e')]=_[_0xa285('0x29')](_0x1c8906,_0xa285('0x26'));_0x3e3db8[_0xa285('0x2f')]=_[_0xa285('0x30')](_0x41e4cc['query']);_0x3e3db8[_0xa285('0x31')]=_[_0xa285('0x32')](_0x3e3db8[_0xa285('0x2e')],_0x3e3db8[_0xa285('0x2f')]);_0x43db41[_0xa285('0x33')]=_[_0xa285('0x32')](_0x3e3db8[_0xa285('0x2e')],qs[_0xa285('0x34')](_0x41e4cc[_0xa285('0x2f')][_0xa285('0x34')]));_0x43db41[_0xa285('0x33')]=_0x43db41[_0xa285('0x33')]['length']?_0x43db41[_0xa285('0x33')]:_0x3e3db8['model'];if(!_0x41e4cc[_0xa285('0x2f')][_0xa285('0x35')](_0xa285('0x36'))){_0x43db41[_0xa285('0x1e')]=qs[_0xa285('0x1e')](_0x41e4cc['query']['limit']);_0x43db41[_0xa285('0x1c')]=qs[_0xa285('0x1c')](_0x41e4cc['query'][_0xa285('0x1c')]);}_0x43db41[_0xa285('0x37')]=qs['sort'](_0x41e4cc[_0xa285('0x2f')]['sort']);_0x43db41[_0xa285('0x38')]=qs['filters'](_['pick'](_0x41e4cc[_0xa285('0x2f')],_0x3e3db8[_0xa285('0x31')]),_0x1c8906);if(_0x41e4cc['query'][_0xa285('0x39')]){_0x43db41['where']=_[_0xa285('0x3a')](_0x43db41[_0xa285('0x38')],{'$or':_['map'](_0x1c8906,function(_0x1e279e){if(_0x1e279e[_0xa285('0x2c')]!==_0xa285('0x3b')){var _0x341465={};_0x341465[_0x1e279e[_0xa285('0x26')]]={'$like':'%'+_0x41e4cc[_0xa285('0x2f')][_0xa285('0x39')]+'%'};return _0x341465;}})});}_0x43db41=_['merge']({},_0x43db41,_0x41e4cc[_0xa285('0x3c')]);var _0x3bc7cb={'where':_0x43db41[_0xa285('0x38')]};return db[_0xa285('0x3d')][_0xa285('0x1f')](_0x3bc7cb)[_0xa285('0x24')](function(_0x3e99f4){_0x4bf869[_0xa285('0x1f')]=_0x3e99f4;if(_0x41e4cc[_0xa285('0x2f')][_0xa285('0x3e')]){_0x43db41[_0xa285('0x3f')]=[{'all':!![]}];}return db[_0xa285('0x3d')][_0xa285('0x40')](_0x43db41);})[_0xa285('0x24')](function(_0x432729){_0x4bf869[_0xa285('0x41')]=_0x432729;return _0x4bf869;})['then'](respondWithFilteredResult(_0x5530d0,_0x43db41))[_0xa285('0x42')](handleError(_0x5530d0,null));};exports['show']=function(_0x23aaf6,_0x4c2f8b){var _0x3fed3={'raw':!![],'where':{'id':_0x23aaf6['params']['id']}},_0x32a810={};_0x32a810[_0xa285('0x2e')]=_[_0xa285('0x30')](db['VoiceTransferReport'][_0xa285('0x2a')]);_0x32a810[_0xa285('0x2f')]=_[_0xa285('0x30')](_0x23aaf6['query']);_0x32a810['filters']=_[_0xa285('0x32')](_0x32a810[_0xa285('0x2e')],_0x32a810['query']);_0x3fed3[_0xa285('0x33')]=_[_0xa285('0x32')](_0x32a810[_0xa285('0x2e')],qs[_0xa285('0x34')](_0x23aaf6[_0xa285('0x2f')][_0xa285('0x34')]));_0x3fed3[_0xa285('0x33')]=_0x3fed3[_0xa285('0x33')][_0xa285('0x43')]?_0x3fed3[_0xa285('0x33')]:_0x32a810[_0xa285('0x2e')];if(_0x23aaf6['query']['includeAll']){_0x3fed3[_0xa285('0x3f')]=[{'all':!![]}];}_0x3fed3=_[_0xa285('0x3a')]({},_0x3fed3,_0x23aaf6[_0xa285('0x3c')]);return db[_0xa285('0x3d')][_0xa285('0x44')](_0x3fed3)[_0xa285('0x24')](handleEntityNotFound(_0x4c2f8b,null))[_0xa285('0x24')](respondWithResult(_0x4c2f8b,null))['catch'](handleError(_0x4c2f8b,null));};exports[_0xa285('0x45')]=function(_0x979fcf,_0x499621){return db['VoiceTransferReport']['create'](_0x979fcf[_0xa285('0x46')],{})['then'](respondWithResult(_0x499621,0xc9))[_0xa285('0x42')](handleError(_0x499621,null));};exports['update']=function(_0x3375ae,_0x2d4fb8){if(_0x3375ae[_0xa285('0x46')]['id']){delete _0x3375ae['body']['id'];}return db[_0xa285('0x3d')][_0xa285('0x44')]({'where':{'id':_0x3375ae['params']['id']}})[_0xa285('0x24')](handleEntityNotFound(_0x2d4fb8,null))[_0xa285('0x24')](saveUpdates(_0x3375ae[_0xa285('0x46')],null))[_0xa285('0x24')](respondWithResult(_0x2d4fb8,null))[_0xa285('0x42')](handleError(_0x2d4fb8,null));};exports[_0xa285('0x47')]=function(_0x5023d3,_0x5533f9){return db[_0xa285('0x3d')]['find']({'where':{'id':_0x5023d3['params']['id']}})[_0xa285('0x24')](handleEntityNotFound(_0x5533f9,null))[_0xa285('0x24')](removeEntity(_0x5533f9,null))[_0xa285('0x42')](handleError(_0x5533f9,null));};exports[_0xa285('0x48')]=function(_0x3a6e98,_0x32a5e0){return db[_0xa285('0x3d')][_0xa285('0x48')]()[_0xa285('0x24')](respondWithResult(_0x32a5e0,null))['catch'](handleError(_0x32a5e0,null));}; \ No newline at end of file +var _0x556a=['hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','findAll','show','params','includeAll','VoiceTransferReport','find','catch','create','body','describe','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','index','map','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','length'];(function(_0x54fa4c,_0xd2fe3c){var _0x2d78f2=function(_0x309d4b){while(--_0x309d4b){_0x54fa4c['push'](_0x54fa4c['shift']());}};_0x2d78f2(++_0xd2fe3c);}(_0x556a,0x187));var _0xa556=function(_0x4fa7d9,_0x250589){_0x4fa7d9=_0x4fa7d9-0x0;var _0x200612=_0x556a[_0x4fa7d9];return _0x200612;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa556('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa556('0x1'));var moment=require('moment');var BPromise=require(_0xa556('0x2'));var Mustache=require(_0xa556('0x3'));var util=require(_0xa556('0x4'));var path=require('path');var sox=require(_0xa556('0x5'));var csv=require(_0xa556('0x6'));var ejs=require(_0xa556('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa556('0x8'));var squel=require(_0xa556('0x9'));var crypto=require(_0xa556('0xa'));var jsforce=require(_0xa556('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa556('0x6'));var querystring=require(_0xa556('0xc'));var Papa=require(_0xa556('0xd'));var Redis=require(_0xa556('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa556('0xf'));var as=require(_0xa556('0x10'));var hardwareService=require(_0xa556('0x11'));var logger=require('../../config/logger')(_0xa556('0x12'));var utils=require(_0xa556('0x13'));var config=require(_0xa556('0x14'));var licenseUtil=require(_0xa556('0x15'));var db=require(_0xa556('0x16'))['db'];function respondWithStatusCode(_0x57921f,_0x2264bf){_0x2264bf=_0x2264bf||0xcc;return function(_0x1a5af9){if(_0x1a5af9){return _0x57921f[_0xa556('0x17')](_0x2264bf);}return _0x57921f['status'](_0x2264bf)[_0xa556('0x18')]();};}function respondWithResult(_0x22ac97,_0x11ad94){_0x11ad94=_0x11ad94||0xc8;return function(_0x5972b7){if(_0x5972b7){return _0x22ac97[_0xa556('0x19')](_0x11ad94)[_0xa556('0x1a')](_0x5972b7);}};}function respondWithFilteredResult(_0x4b9baf,_0x1ac005){return function(_0x39c322){if(_0x39c322){var _0x8f3b43=typeof _0x1ac005[_0xa556('0x1b')]==='undefined'&&typeof _0x1ac005[_0xa556('0x1c')]===_0xa556('0x1d');var _0x11c21d=_0x39c322[_0xa556('0x1e')];var _0x3622db=_0x8f3b43?0x0:_0x1ac005[_0xa556('0x1b')];var _0xc420f4=_0x8f3b43?_0x39c322[_0xa556('0x1e')]:_0x1ac005[_0xa556('0x1b')]+_0x1ac005[_0xa556('0x1c')];var _0x105e4c;if(_0xc420f4>=_0x11c21d){_0xc420f4=_0x11c21d;_0x105e4c=0xc8;}else{_0x105e4c=0xce;}_0x4b9baf['status'](_0x105e4c);return _0x4b9baf[_0xa556('0x1f')](_0xa556('0x20'),_0x3622db+'-'+_0xc420f4+'/'+_0x11c21d)[_0xa556('0x1a')](_0x39c322);}return null;};}function patchUpdates(_0x156599){return function(_0xfa610e){try{jsonpatch[_0xa556('0x21')](_0xfa610e,_0x156599,!![]);}catch(_0x36cf37){return BPromise[_0xa556('0x22')](_0x36cf37);}return _0xfa610e[_0xa556('0x23')]();};}function saveUpdates(_0x354c13,_0x488375){return function(_0x45b176){if(_0x45b176){return _0x45b176[_0xa556('0x24')](_0x354c13)[_0xa556('0x25')](function(_0x2ce7ce){return _0x2ce7ce;});}return null;};}function removeEntity(_0x292648,_0x32153a){return function(_0x4dedfd){if(_0x4dedfd){return _0x4dedfd['destroy']()['then'](function(){_0x292648['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3baadc,_0x2ec16c){return function(_0x21dc31){if(!_0x21dc31){_0x3baadc[_0xa556('0x17')](0x194);}return _0x21dc31;};}function handleError(_0x4feec2,_0x54e0d0){_0x54e0d0=_0x54e0d0||0x1f4;return function(_0x54d7e8){logger[_0xa556('0x26')](_0x54d7e8[_0xa556('0x27')]);if(_0x54d7e8['name']){delete _0x54d7e8['name'];}_0x4feec2[_0xa556('0x19')](_0x54e0d0)['send'](_0x54d7e8);};}exports[_0xa556('0x28')]=function(_0x59f677,_0x25831c){var _0x320195={},_0x991eb5={},_0x5eedd5={'count':0x0,'rows':[]};var _0x56bdbb=_[_0xa556('0x29')](db['VoiceTransferReport']['rawAttributes'],function(_0x49ed38){return{'name':_0x49ed38[_0xa556('0x2a')],'type':_0x49ed38[_0xa556('0x2b')][_0xa556('0x2c')]};});_0x991eb5[_0xa556('0x2d')]=_['map'](_0x56bdbb,_0xa556('0x2e'));_0x991eb5['query']=_[_0xa556('0x2f')](_0x59f677['query']);_0x991eb5['filters']=_[_0xa556('0x30')](_0x991eb5[_0xa556('0x2d')],_0x991eb5[_0xa556('0x31')]);_0x320195[_0xa556('0x32')]=_[_0xa556('0x30')](_0x991eb5[_0xa556('0x2d')],qs[_0xa556('0x33')](_0x59f677[_0xa556('0x31')][_0xa556('0x33')]));_0x320195[_0xa556('0x32')]=_0x320195[_0xa556('0x32')][_0xa556('0x34')]?_0x320195[_0xa556('0x32')]:_0x991eb5[_0xa556('0x2d')];if(!_0x59f677[_0xa556('0x31')][_0xa556('0x35')](_0xa556('0x36'))){_0x320195[_0xa556('0x1c')]=qs[_0xa556('0x1c')](_0x59f677[_0xa556('0x31')]['limit']);_0x320195['offset']=qs['offset'](_0x59f677[_0xa556('0x31')][_0xa556('0x1b')]);}_0x320195[_0xa556('0x37')]=qs[_0xa556('0x38')](_0x59f677[_0xa556('0x31')][_0xa556('0x38')]);_0x320195['where']=qs['filters'](_[_0xa556('0x39')](_0x59f677[_0xa556('0x31')],_0x991eb5[_0xa556('0x3a')]),_0x56bdbb);if(_0x59f677[_0xa556('0x31')][_0xa556('0x3b')]){_0x320195['where']=_[_0xa556('0x3c')](_0x320195[_0xa556('0x3d')],{'$or':_[_0xa556('0x29')](_0x56bdbb,function(_0x650f97){if(_0x650f97[_0xa556('0x2b')]!==_0xa556('0x3e')){var _0x20ae1c={};_0x20ae1c[_0x650f97[_0xa556('0x2e')]]={'$like':'%'+_0x59f677[_0xa556('0x31')][_0xa556('0x3b')]+'%'};return _0x20ae1c;}})});}_0x320195=_[_0xa556('0x3c')]({},_0x320195,_0x59f677[_0xa556('0x3f')]);var _0x3d9a76={'where':_0x320195[_0xa556('0x3d')]};return db['VoiceTransferReport'][_0xa556('0x1e')](_0x3d9a76)[_0xa556('0x25')](function(_0x555ebc){_0x5eedd5['count']=_0x555ebc;if(_0x59f677['query']['includeAll']){_0x320195['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xa556('0x40')](_0x320195);})['then'](function(_0x45ad9c){_0x5eedd5['rows']=_0x45ad9c;return _0x5eedd5;})[_0xa556('0x25')](respondWithFilteredResult(_0x25831c,_0x320195))['catch'](handleError(_0x25831c,null));};exports[_0xa556('0x41')]=function(_0x3c29c8,_0x52c581){var _0x25f27f={'raw':!![],'where':{'id':_0x3c29c8[_0xa556('0x42')]['id']}},_0x3848f7={};_0x3848f7['model']=_[_0xa556('0x2f')](db['VoiceTransferReport']['rawAttributes']);_0x3848f7[_0xa556('0x31')]=_['keys'](_0x3c29c8[_0xa556('0x31')]);_0x3848f7[_0xa556('0x3a')]=_[_0xa556('0x30')](_0x3848f7['model'],_0x3848f7[_0xa556('0x31')]);_0x25f27f['attributes']=_[_0xa556('0x30')](_0x3848f7['model'],qs[_0xa556('0x33')](_0x3c29c8[_0xa556('0x31')][_0xa556('0x33')]));_0x25f27f[_0xa556('0x32')]=_0x25f27f[_0xa556('0x32')][_0xa556('0x34')]?_0x25f27f[_0xa556('0x32')]:_0x3848f7[_0xa556('0x2d')];if(_0x3c29c8[_0xa556('0x31')][_0xa556('0x43')]){_0x25f27f['include']=[{'all':!![]}];}_0x25f27f=_['merge']({},_0x25f27f,_0x3c29c8[_0xa556('0x3f')]);return db[_0xa556('0x44')][_0xa556('0x45')](_0x25f27f)[_0xa556('0x25')](handleEntityNotFound(_0x52c581,null))[_0xa556('0x25')](respondWithResult(_0x52c581,null))[_0xa556('0x46')](handleError(_0x52c581,null));};exports[_0xa556('0x47')]=function(_0x2e51a7,_0x127f96){return db[_0xa556('0x44')][_0xa556('0x47')](_0x2e51a7['body'],{})[_0xa556('0x25')](respondWithResult(_0x127f96,0xc9))['catch'](handleError(_0x127f96,null));};exports['update']=function(_0x4aed9e,_0x54eebe){if(_0x4aed9e[_0xa556('0x48')]['id']){delete _0x4aed9e[_0xa556('0x48')]['id'];}return db[_0xa556('0x44')][_0xa556('0x45')]({'where':{'id':_0x4aed9e[_0xa556('0x42')]['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x54eebe,null))[_0xa556('0x25')](saveUpdates(_0x4aed9e['body'],null))[_0xa556('0x25')](respondWithResult(_0x54eebe,null))['catch'](handleError(_0x54eebe,null));};exports['destroy']=function(_0x39f50e,_0x190663){return db[_0xa556('0x44')][_0xa556('0x45')]({'where':{'id':_0x39f50e['params']['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x190663,null))['then'](removeEntity(_0x190663,null))[_0xa556('0x46')](handleError(_0x190663,null));};exports[_0xa556('0x49')]=function(_0x1907b2,_0x3d9be6){return db[_0xa556('0x44')]['describe']()[_0xa556('0x25')](respondWithResult(_0x3d9be6,null))[_0xa556('0x46')](handleError(_0x3d9be6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1be849f..b2b559c 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 _0xca26=['../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x69752e,_0x2579f6){var _0x506a36=function(_0x1793bc){while(--_0x1793bc){_0x69752e['push'](_0x69752e['shift']());}};_0x506a36(++_0x2579f6);}(_0xca26,0x1cd));var _0x6ca2=function(_0x29dc61,_0xfa5fec){_0x29dc61=_0x29dc61-0x0;var _0x2eb2d6=_0xca26[_0x29dc61];return _0x2eb2d6;};'use strict';var _=require('lodash');var util=require(_0x6ca2('0x0'));var logger=require(_0x6ca2('0x1'))(_0x6ca2('0x2'));var moment=require(_0x6ca2('0x3'));var BPromise=require(_0x6ca2('0x4'));var rp=require(_0x6ca2('0x5'));var fs=require('fs');var path=require(_0x6ca2('0x6'));var rimraf=require('rimraf');var config=require(_0x6ca2('0x7'));var attributes=require(_0x6ca2('0x8'));module[_0x6ca2('0x9')]=function(_0x510100,_0x577a69){return _0x510100[_0x6ca2('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x6ca2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31dd=['moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','../../config/logger'];(function(_0xfa3bbd,_0x2e97cf){var _0x2dd3ab=function(_0x2abae6){while(--_0x2abae6){_0xfa3bbd['push'](_0xfa3bbd['shift']());}};_0x2dd3ab(++_0x2e97cf);}(_0x31dd,0x1e2));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd31d('0x0'));var logger=require(_0xd31d('0x1'))('api');var moment=require(_0xd31d('0x2'));var BPromise=require(_0xd31d('0x3'));var rp=require(_0xd31d('0x4'));var fs=require('fs');var path=require(_0xd31d('0x5'));var rimraf=require(_0xd31d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd31d('0x7'));module[_0xd31d('0x8')]=function(_0x249d2e,_0x292b88){return _0x249d2e['define'](_0xd31d('0x9'),attributes,{'tableName':_0xd31d('0xa'),'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 62483e8..7a1272f 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 _0x95ae=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x58ed93,_0x5979dd){var _0x38244c=function(_0x58728d){while(--_0x58728d){_0x58ed93['push'](_0x58ed93['shift']());}};_0x38244c(++_0x5979dd);}(_0x95ae,0x1cb));var _0xe95a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x95ae[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe95a('0x0'));var util=require(_0xe95a('0x1'));var moment=require(_0xe95a('0x2'));var BPromise=require(_0xe95a('0x3'));var rs=require(_0xe95a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe95a('0x5'))['db'];var utils=require(_0xe95a('0x6'));var logger=require(_0xe95a('0x7'))(_0xe95a('0x8'));var config=require(_0xe95a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe95a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ce1f,_0x5c7535,_0xb1145c){return new BPromise(function(_0x5cea99,_0x55f6f4){return client[_0xe95a('0xb')](_0x54ce1f,_0xb1145c)['then'](function(_0x5bbac0){logger[_0xe95a('0xc')](_0xe95a('0xd'),_0x5c7535,_0xe95a('0xe'));logger[_0xe95a('0xf')](_0xe95a('0x10'),_0x5c7535,_0xe95a('0xe'),JSON[_0xe95a('0x11')](_0x5bbac0));if(_0x5bbac0[_0xe95a('0x12')]){if(_0x5bbac0[_0xe95a('0x12')][_0xe95a('0x13')]===0x1f4){logger[_0xe95a('0x12')](_0xe95a('0xd'),_0x5c7535,_0x5bbac0[_0xe95a('0x12')][_0xe95a('0x14')]);return _0x55f6f4(_0x5bbac0[_0xe95a('0x12')][_0xe95a('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5c7535,_0x5bbac0[_0xe95a('0x12')]['message']);return _0x5cea99(_0x5bbac0['error'][_0xe95a('0x14')]);}else{logger[_0xe95a('0xc')](_0xe95a('0xd'),_0x5c7535,'request\x20sent');_0x5cea99(_0x5bbac0['result'][_0xe95a('0x14')]);}})[_0xe95a('0x15')](function(_0x1d0170){logger[_0xe95a('0x12')](_0xe95a('0xd'),_0x5c7535,_0x1d0170);_0x55f6f4(_0x1d0170);});});}exports[_0xe95a('0x16')]=function(_0xa42a91){var _0x4d68d2=this;return new Promise(function(_0x3b346a,_0x45ebd0){return db[_0xe95a('0x17')][_0xe95a('0x18')](_0xa42a91[_0xe95a('0x19')],{'raw':_0xa42a91[_0xe95a('0x1a')]?_0xa42a91[_0xe95a('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a7bf7){logger[_0xe95a('0xc')](_0xe95a('0x16'),_0xa42a91);logger['debug'](_0xe95a('0x16'),_0xa42a91,JSON[_0xe95a('0x11')](_0x1a7bf7));_0x3b346a(_0x1a7bf7);})[_0xe95a('0x15')](function(_0x3a0bb2){logger[_0xe95a('0x12')]('CreateVoiceTransferReport',_0x3a0bb2[_0xe95a('0x14')],_0xa42a91);_0x45ebd0(_0x4d68d2[_0xe95a('0x12')](0x1f4,_0x3a0bb2[_0xe95a('0x14')]));});});}; \ No newline at end of file +var _0xa781=['message','result','VoiceTransferReport','create','raw','CreateVoiceTransferReport','debug','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa781,0xe9));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a78('0x0'));var util=require('util');var moment=require(_0x1a78('0x1'));var BPromise=require(_0x1a78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a78('0x3'))['db'];var utils=require(_0x1a78('0x4'));var logger=require(_0x1a78('0x5'))(_0x1a78('0x6'));var config=require(_0x1a78('0x7'));var jayson=require(_0x1a78('0x8'));var client=jayson[_0x1a78('0x9')][_0x1a78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51edbd,_0x107d3c,_0x1bcb83){return new BPromise(function(_0x54a0ac,_0x4837ff){return client['request'](_0x51edbd,_0x1bcb83)[_0x1a78('0xb')](function(_0x15d198){logger[_0x1a78('0xc')](_0x1a78('0xd'),_0x107d3c,_0x1a78('0xe'));logger['debug'](_0x1a78('0xf'),_0x107d3c,_0x1a78('0xe'),JSON['stringify'](_0x15d198));if(_0x15d198[_0x1a78('0x10')]){if(_0x15d198[_0x1a78('0x10')]['code']===0x1f4){logger['error'](_0x1a78('0xd'),_0x107d3c,_0x15d198[_0x1a78('0x10')][_0x1a78('0x11')]);return _0x4837ff(_0x15d198[_0x1a78('0x10')][_0x1a78('0x11')]);}logger[_0x1a78('0x10')](_0x1a78('0xd'),_0x107d3c,_0x15d198[_0x1a78('0x10')]['message']);return _0x54a0ac(_0x15d198[_0x1a78('0x10')][_0x1a78('0x11')]);}else{logger['info'](_0x1a78('0xd'),_0x107d3c,'request\x20sent');_0x54a0ac(_0x15d198[_0x1a78('0x12')][_0x1a78('0x11')]);}})['catch'](function(_0x2be9d5){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x107d3c,_0x2be9d5);_0x4837ff(_0x2be9d5);});});}exports['CreateVoiceTransferReport']=function(_0x568fd1){var _0x1b4fdb=this;return new Promise(function(_0x2e4e79,_0xa09ad9){return db[_0x1a78('0x13')][_0x1a78('0x14')](_0x568fd1['body'],{'raw':_0x568fd1['options']?_0x568fd1['options'][_0x1a78('0x15')]===undefined?!![]:![]:!![]})[_0x1a78('0xb')](function(_0x3cefbc){logger[_0x1a78('0xc')](_0x1a78('0x16'),_0x568fd1);logger[_0x1a78('0x17')](_0x1a78('0x16'),_0x568fd1,JSON['stringify'](_0x3cefbc));_0x2e4e79(_0x3cefbc);})[_0x1a78('0x18')](function(_0x2dac76){logger['error'](_0x1a78('0x16'),_0x2dac76[_0x1a78('0x11')],_0x568fd1);_0xa09ad9(_0x1b4fdb[_0x1a78('0x10')](0x1f4,_0x2dac76['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d4e1dad..6d03962 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 _0xc70c=['/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','canUpdate','originate','/hangup','/answer'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xc70c,0x195));var _0xcc70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc70c[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0xcc70('0x0'));var router=express[_0xcc70('0x1')]();var auth=require(_0xcc70('0x2'));var controller=require('./webbar.controller');router[_0xcc70('0x3')]('/originate',auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller[_0xcc70('0x6')]);router[_0xcc70('0x3')](_0xcc70('0x7'),auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller['hangup']);router[_0xcc70('0x3')](_0xcc70('0x8'),auth[_0xcc70('0x4')](),auth['canUpdate'](),controller['answer']);router[_0xcc70('0x3')](_0xcc70('0x9'),auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller[_0xcc70('0xa')]);router[_0xcc70('0x3')](_0xcc70('0xb'),auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller[_0xcc70('0xc')]);router[_0xcc70('0x3')](_0xcc70('0xd'),auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller[_0xcc70('0xe')]);router[_0xcc70('0x3')](_0xcc70('0xf'),auth[_0xcc70('0x4')](),auth[_0xcc70('0x5')](),controller[_0xcc70('0x10')]);module[_0xcc70('0x11')]=router; \ No newline at end of file +var _0xe2bb=['/answer','answer','/hold','hold','/unhold','calls','/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','originate','/hangup','isAuthenticated','canUpdate','hangup'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xe2bb,0x14b));var _0xbe2b=function(_0x401022,_0x89023e){_0x401022=_0x401022-0x0;var _0x285bf1=_0xe2bb[_0x401022];return _0x285bf1;};'use strict';var express=require(_0xbe2b('0x0'));var router=express[_0xbe2b('0x1')]();var auth=require(_0xbe2b('0x2'));var controller=require(_0xbe2b('0x3'));router[_0xbe2b('0x4')](_0xbe2b('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xbe2b('0x6')]);router[_0xbe2b('0x4')](_0xbe2b('0x7'),auth[_0xbe2b('0x8')](),auth[_0xbe2b('0x9')](),controller[_0xbe2b('0xa')]);router[_0xbe2b('0x4')](_0xbe2b('0xb'),auth[_0xbe2b('0x8')](),auth[_0xbe2b('0x9')](),controller[_0xbe2b('0xc')]);router['post'](_0xbe2b('0xd'),auth[_0xbe2b('0x8')](),auth[_0xbe2b('0x9')](),controller[_0xbe2b('0xe')]);router[_0xbe2b('0x4')](_0xbe2b('0xf'),auth[_0xbe2b('0x8')](),auth['canUpdate'](),controller['unhold']);router[_0xbe2b('0x4')]('/calls',auth[_0xbe2b('0x8')](),auth[_0xbe2b('0x9')](),controller[_0xbe2b('0x10')]);router[_0xbe2b('0x4')](_0xbe2b('0x11'),auth[_0xbe2b('0x8')](),auth['canUpdate'](),controller['transfer']);module[_0xbe2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 93b8790..8b162e1 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 _0x9b87=['transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','status','send','name','NotFound','request','then','error','message','result','User','findOne','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','callbackUrl','info','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','validate','sessionId','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','filter','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required'];(function(_0xbcb3a,_0x3f34b7){var _0x4d3a1b=function(_0x56d9d2){while(--_0x56d9d2){_0xbcb3a['push'](_0xbcb3a['shift']());}};_0x4d3a1b(++_0x3f34b7);}(_0x9b87,0x8e));var _0x79b8=function(_0x3571cd,_0x10e024){_0x3571cd=_0x3571cd-0x0;var _0x730576=_0x9b87[_0x3571cd];return _0x730576;};'use strict';var path=require(_0x79b8('0x0'));var fs=require('fs');var _=require(_0x79b8('0x1'));var db=require(_0x79b8('0x2'))['db'];var config=require(_0x79b8('0x3'));var util=require(_0x79b8('0x4'));var BPromise=require(_0x79b8('0x5'));var jayson=require(_0x79b8('0x6'));var amiClient=jayson[_0x79b8('0x7')][_0x79b8('0x8')]({'port':0x232a});var logger=require(_0x79b8('0x9'))(_0x79b8('0xa'));var Redis=require(_0x79b8('0xb'));config[_0x79b8('0xc')]=_[_0x79b8('0xd')](config[_0x79b8('0xc')],{'host':_0x79b8('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x79b8('0xf')]},'callNumber':{'type':_0x79b8('0x10'),'required':[!![],_0x79b8('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x79b8('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x79b8('0x12'),'required':[!![],_0x79b8('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x79b8('0xf')]},'sessionId':{'type':_0x79b8('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x79b8('0x12'),'required':[!![],_0x79b8('0xf')]},'sessionId':{'type':_0x79b8('0x10'),'required':[!![],_0x79b8('0x13')]},'transferNumber':{'type':_0x79b8('0x10'),'required':[!![],_0x79b8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x79b8('0x12'),'required':[!![],_0x79b8('0xf')]},'sessionId':{'type':_0x79b8('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x79b8('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x79b8('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x79b8('0x12'),'required':[!![],_0x79b8('0xf')]}});function emit(_0x5ddab5,_0x3e3de3,_0x49e40b){logger['info'](_0x5ddab5,_0x3e3de3,JSON[_0x79b8('0x15')](_0x49e40b));io['to'](_0x5ddab5)[_0x79b8('0x16')](_0x3e3de3,_0x49e40b);}function handleError(_0x9e0342){return function(_0x2ae2d5){console[_0x79b8('0x17')](_0x79b8('0x18'),_0x2ae2d5,_0x2ae2d5 instanceof RangeError);logger['error'](_0x2ae2d5[_0x79b8('0x19')]);if(_0x2ae2d5 instanceof RangeError){if(_0x2ae2d5['name']){delete _0x2ae2d5['name'];}_0x9e0342[_0x79b8('0x1a')](0x194)[_0x79b8('0x1b')](_0x2ae2d5);}else{if(_0x2ae2d5[_0x79b8('0x1c')]){delete _0x2ae2d5[_0x79b8('0x1c')];}_0x9e0342[_0x79b8('0x1a')](0x1f4)[_0x79b8('0x1b')](_0x2ae2d5);}};}function checkError(){return function(_0x3611c3){if(!_0x3611c3){throw new RangeError(_0x79b8('0x1d'));}return _0x3611c3;};}function respondWithRpcPromise(_0x2e1a65,_0x48ba32){return new BPromise(function(_0x3e9d83,_0x255207){var _0x4dbfcf=amiClient;return _0x4dbfcf[_0x79b8('0x1e')](_0x2e1a65,_0x48ba32)[_0x79b8('0x1f')](function(_0x54c605){if(_0x54c605[_0x79b8('0x20')]){if(_0x54c605['error']['code']===0x1f4){return _0x255207(_0x54c605[_0x79b8('0x20')][_0x79b8('0x21')]);}return _0x3e9d83(_0x54c605[_0x79b8('0x20')][_0x79b8('0x21')]);}else{_0x3e9d83(_0x54c605[_0x79b8('0x22')]);}})['catch'](function(_0x35db24){_0x255207(_0x35db24);});});}function getAgent(_0x338a7b){return db[_0x79b8('0x23')][_0x79b8('0x24')]({'where':{'id':_0x338a7b,'role':'agent'}})[_0x79b8('0x1f')](checkError());}function getAgentCheckSession(_0x2b6fad,_0x14a4d6){return new BPromise(function(_0x4aa92c,_0x43a09e){var _0x4a4ef6=respondWithRpcPromise(_0x79b8('0x25'));var _0x2942e9=getAgent(_0x2b6fad);Promise[_0x79b8('0x26')]([_0x4a4ef6,_0x2942e9])[_0x79b8('0x1f')](function(_0x4f51d1){var _0x434ecd=_0x4f51d1[0x0];var _0x5a24fd=_0x4f51d1[0x1];var _0x169597=_['filter'](_0x434ecd[_0x79b8('0x27')],function(_0x1090d2){return _0x1090d2[_0x79b8('0x28')]==_0x5a24fd['id']&&_0x1090d2['sessionId']==_0x14a4d6;});if(_0x169597[_0x79b8('0x29')]==0x1){_0x4aa92c(_0x5a24fd);}else{_0x43a09e(new RangeError(_0x79b8('0x2a')+_0x14a4d6+_0x79b8('0x2b')));}});});}exports[_0x79b8('0x2c')]=function(_0x4df203,_0x4cb644){logger['info']('originate\x20fired:',_0x4df203[_0x79b8('0x2d')]);var _0x38b521=originateValidation['validate'](_0x4df203[_0x79b8('0x2d')]);if(_0x38b521['length']>0x0){return _0x4cb644['status'](0x190)[_0x79b8('0x2e')](_0x38b521);}var _0x4823f5=_0x4df203[_0x79b8('0x2d')][_0x79b8('0x2f')];var _0x567d18=_0x4df203[_0x79b8('0x2d')][_0x79b8('0x30')];var _0x97dead=_0x4df203[_0x79b8('0x2d')][_0x79b8('0x31')];var _0x3d7214=_0x4df203['body'][_0x79b8('0x32')];return getAgent(_0x4823f5)[_0x79b8('0x1f')](function(_0x3b248e){logger[_0x79b8('0x33')](_0x79b8('0x34'),_0x3b248e[_0x79b8('0x1c')]);emit(util[_0x79b8('0x35')](_0x79b8('0x36'),_0x3b248e[_0x79b8('0x1c')]),_0x79b8('0x37'),{'callNumber':_0x567d18,'callerId':_0x97dead,'callbackUrl':_0x3d7214});return _0x4cb644[_0x79b8('0x1a')](0xc8)['json']({'error':![],'message':_0x79b8('0x38')});})[_0x79b8('0x39')](handleError(_0x4cb644));};exports[_0x79b8('0x3a')]=function(_0x51cde9,_0x3cbf9b){logger[_0x79b8('0x33')](_0x79b8('0x3b'),_0x51cde9[_0x79b8('0x2d')]);var _0x183b80=hangupValidation[_0x79b8('0x3c')](_0x51cde9['body']);if(_0x183b80[_0x79b8('0x29')]>0x0){return _0x3cbf9b['status'](0x190)['json'](_0x183b80);}var _0x1eeb29=_0x51cde9['body']['userId'];var _0x3ff5fe=_0x51cde9[_0x79b8('0x2d')][_0x79b8('0x3d')];return getAgent(_0x1eeb29)[_0x79b8('0x1f')](function(_0x43d795){logger[_0x79b8('0x33')](_0x79b8('0x34'),_0x43d795[_0x79b8('0x1c')]);emit(util[_0x79b8('0x35')](_0x79b8('0x36'),_0x43d795[_0x79b8('0x1c')]),_0x79b8('0x3e'),{'sessionId':_0x3ff5fe});return _0x3cbf9b[_0x79b8('0x1a')](0xc8)['json']({'error':![],'message':_0x79b8('0x3f')});})[_0x79b8('0x39')](handleError(_0x3cbf9b));};exports['answer']=function(_0x3c4ce7,_0x44ccca){logger['info'](_0x79b8('0x40'),_0x3c4ce7[_0x79b8('0x2d')]);var _0x2ddad8=answerValidation[_0x79b8('0x3c')](_0x3c4ce7[_0x79b8('0x2d')]);if(_0x2ddad8[_0x79b8('0x29')]>0x0){return _0x44ccca[_0x79b8('0x1a')](0x190)[_0x79b8('0x2e')](_0x2ddad8);}var _0xb10351=_0x3c4ce7[_0x79b8('0x2d')][_0x79b8('0x2f')];var _0x379217=_0x3c4ce7['body']['sessionId'];return getAgent(_0xb10351)[_0x79b8('0x1f')](function(_0x124cfb){logger[_0x79b8('0x33')](_0x79b8('0x34'),_0x124cfb['name']);emit(util[_0x79b8('0x35')](_0x79b8('0x36'),_0x124cfb[_0x79b8('0x1c')]),_0x79b8('0x41'),{'sessionId':_0x379217});return _0x44ccca['status'](0xc8)[_0x79b8('0x2e')]({'error':![],'message':_0x79b8('0x42')});})[_0x79b8('0x39')](handleError(_0x44ccca));};exports[_0x79b8('0x43')]=function(_0x49d365,_0x3117b8){logger[_0x79b8('0x33')](_0x79b8('0x44'),_0x49d365[_0x79b8('0x2d')]);var _0x354ddc=holdValidation[_0x79b8('0x3c')](_0x49d365['body']);if(_0x354ddc[_0x79b8('0x29')]>0x0){return _0x3117b8[_0x79b8('0x1a')](0x190)[_0x79b8('0x2e')](_0x354ddc);}var _0xc89e93=_0x49d365['body']['userId'];var _0xd15531=_0x49d365[_0x79b8('0x2d')][_0x79b8('0x3d')];return getAgent(_0xc89e93)[_0x79b8('0x1f')](function(_0x32e7ea){logger[_0x79b8('0x33')](_0x79b8('0x34'),_0x32e7ea[_0x79b8('0x1c')]);emit(util[_0x79b8('0x35')]('user:%s',_0x32e7ea[_0x79b8('0x1c')]),_0x79b8('0x45'),{'sessionId':_0xd15531});return _0x3117b8[_0x79b8('0x1a')](0xc8)['json']({'error':![],'message':_0x79b8('0x46')});})['catch'](handleError(_0x3117b8));};exports['unhold']=function(_0x24ebb2,_0x252c2c){logger[_0x79b8('0x33')](_0x79b8('0x47'),_0x24ebb2['body']);var _0x5d2fae=unholdValidation[_0x79b8('0x3c')](_0x24ebb2[_0x79b8('0x2d')]);if(_0x5d2fae[_0x79b8('0x29')]>0x0){return _0x252c2c[_0x79b8('0x1a')](0x190)[_0x79b8('0x2e')](_0x5d2fae);}var _0xcfb9c2=_0x24ebb2[_0x79b8('0x2d')][_0x79b8('0x2f')];var _0x26d69e=_0x24ebb2[_0x79b8('0x2d')][_0x79b8('0x3d')];return getAgent(_0xcfb9c2)[_0x79b8('0x1f')](function(_0x125361){logger[_0x79b8('0x33')]('entityFound:',_0x125361[_0x79b8('0x1c')]);emit(util[_0x79b8('0x35')](_0x79b8('0x36'),_0x125361[_0x79b8('0x1c')]),'webbar:unhold',{'sessionId':_0x26d69e});return _0x252c2c['status'](0xc8)[_0x79b8('0x2e')]({'error':![],'message':_0x79b8('0x48')});})[_0x79b8('0x39')](handleError(_0x252c2c));};exports[_0x79b8('0x49')]=function(_0x5a39cb,_0x34e57f){logger[_0x79b8('0x33')]('calls\x20fired:',_0x34e57f[_0x79b8('0x2d')]);var _0x43efcf=callsValidation[_0x79b8('0x3c')](_0x5a39cb['body']);if(_0x43efcf[_0x79b8('0x29')]>0x0){return _0x34e57f['status'](0x190)[_0x79b8('0x2e')](_0x43efcf);}var _0x3a85bd=_0x5a39cb[_0x79b8('0x2d')][_0x79b8('0x2f')];var _0xdffe64=respondWithRpcPromise(_0x79b8('0x25'));var _0x3f22ea=getAgent(_0x3a85bd);return Promise[_0x79b8('0x26')]([_0xdffe64,_0x3f22ea])[_0x79b8('0x1f')](function(_0x17e421){var _0x549e7c=_0x17e421[0x0];var _0x1dfcbd=_0x17e421[0x1];var _0x4c8916=_[_0x79b8('0x4a')](_0x549e7c['rows'],function(_0x284fc3){return _0x284fc3[_0x79b8('0x28')]==_0x1dfcbd['id'];});return _0x34e57f[_0x79b8('0x1a')](0xc8)[_0x79b8('0x2e')]({'count':_0x4c8916[_0x79b8('0x29')],'rows':_0x4c8916});})[_0x79b8('0x39')](handleError(_0x34e57f));};exports[_0x79b8('0x4b')]=function(_0x57d73d,_0x1c6ac5){logger[_0x79b8('0x33')](_0x79b8('0x4c'),_0x57d73d[_0x79b8('0x2d')]);var _0x27131e=conferenceValidation[_0x79b8('0x3c')](_0x57d73d['body']);if(_0x27131e[_0x79b8('0x29')]>0x0){return _0x1c6ac5[_0x79b8('0x1a')](0x190)['json'](_0x27131e);}var _0x319043=_0x57d73d['body'][_0x79b8('0x2f')];return getAgent(_0x319043)[_0x79b8('0x1f')](function(_0x5bcdde){logger[_0x79b8('0x33')](_0x79b8('0x34'),_0x5bcdde['name']);emit(util[_0x79b8('0x35')]('user:%s',_0x5bcdde[_0x79b8('0x1c')]),'webbar:conference');return _0x1c6ac5[_0x79b8('0x1a')](0xc8)[_0x79b8('0x2e')]({'error':![],'message':_0x79b8('0x4d')});})[_0x79b8('0x39')](handleError(_0x1c6ac5));};exports[_0x79b8('0x4e')]=function(_0x234855,_0x529129){logger[_0x79b8('0x33')](_0x79b8('0x4f'),_0x234855['body']);var _0x5b4443=transferValidation[_0x79b8('0x3c')](_0x234855[_0x79b8('0x2d')]);if(_0x5b4443['length']>0x0){return _0x529129[_0x79b8('0x1a')](0x190)[_0x79b8('0x2e')](_0x5b4443);}var _0x2daf0a=_0x234855['body'][_0x79b8('0x2f')];var _0x1f98ea=_0x234855[_0x79b8('0x2d')][_0x79b8('0x3d')];var _0x41b63e=_0x234855[_0x79b8('0x2d')]['transferNumber'];return getAgent(_0x2daf0a)[_0x79b8('0x1f')](function(_0x1e2516){logger[_0x79b8('0x33')]('entityFound:',_0x1e2516[_0x79b8('0x1c')]);emit(util[_0x79b8('0x35')](_0x79b8('0x36'),_0x1e2516['name']),_0x79b8('0x50'),{'sessionId':_0x1f98ea,'transferNumber':_0x41b63e});return _0x529129[_0x79b8('0x1a')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x79b8('0x39')](handleError(_0x529129));}; \ No newline at end of file +var _0xe812=['webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','entityFound:','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','lodash','../../mysqldb','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','format','user:%s'];(function(_0x107ff6,_0x4ccaef){var _0x27ae63=function(_0x25f590){while(--_0x25f590){_0x107ff6['push'](_0x107ff6['shift']());}};_0x27ae63(++_0x4ccaef);}(_0xe812,0x1f2));var _0x2e81=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe812[_0x167cc1];return _0x10bc4b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x2e81('0x0'));var db=require(_0x2e81('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x2e81('0x2'));var jayson=require(_0x2e81('0x3'));var amiClient=jayson['client'][_0x2e81('0x4')]({'port':0x232a});var logger=require(_0x2e81('0x5'))('webbarapi');var Redis=require(_0x2e81('0x6'));config[_0x2e81('0x7')]=_['defaults'](config[_0x2e81('0x7')],{'host':_0x2e81('0x8'),'port':0x18eb});var io=require(_0x2e81('0x9'))(new Redis(config['redis']));var Schema=require(_0x2e81('0xa'));var originateValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'callNumber':{'type':_0x2e81('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x2e81('0xd')},'callbackUrl':{'type':_0x2e81('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2e81('0xd'),'required':[!![],_0x2e81('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2e81('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xc4d315,_0x258749,_0x52b5e4){logger[_0x2e81('0xf')](_0xc4d315,_0x258749,JSON['stringify'](_0x52b5e4));io['to'](_0xc4d315)[_0x2e81('0x10')](_0x258749,_0x52b5e4);}function handleError(_0xaa8034){return function(_0x4c1b11){console[_0x2e81('0x11')](_0x2e81('0x12'),_0x4c1b11,_0x4c1b11 instanceof RangeError);logger[_0x2e81('0x13')](_0x4c1b11[_0x2e81('0x14')]);if(_0x4c1b11 instanceof RangeError){if(_0x4c1b11[_0x2e81('0x15')]){delete _0x4c1b11[_0x2e81('0x15')];}_0xaa8034[_0x2e81('0x16')](0x194)[_0x2e81('0x17')](_0x4c1b11);}else{if(_0x4c1b11[_0x2e81('0x15')]){delete _0x4c1b11[_0x2e81('0x15')];}_0xaa8034['status'](0x1f4)[_0x2e81('0x17')](_0x4c1b11);}};}function checkError(){return function(_0x23957a){if(!_0x23957a){throw new RangeError(_0x2e81('0x18'));}return _0x23957a;};}function respondWithRpcPromise(_0x65be57,_0x11daeb){return new BPromise(function(_0x386721,_0x18b9be){var _0x39ffa8=amiClient;return _0x39ffa8['request'](_0x65be57,_0x11daeb)[_0x2e81('0x19')](function(_0x49e9f1){if(_0x49e9f1[_0x2e81('0x13')]){if(_0x49e9f1['error'][_0x2e81('0x1a')]===0x1f4){return _0x18b9be(_0x49e9f1['error']['message']);}return _0x386721(_0x49e9f1[_0x2e81('0x13')][_0x2e81('0x1b')]);}else{_0x386721(_0x49e9f1['result']);}})[_0x2e81('0x1c')](function(_0x19b1a9){_0x18b9be(_0x19b1a9);});});}function getAgent(_0x1c4547){return db[_0x2e81('0x1d')][_0x2e81('0x1e')]({'where':{'id':_0x1c4547,'role':_0x2e81('0x1f')}})[_0x2e81('0x19')](checkError());}function getAgentCheckSession(_0x4669aa,_0x1b34db){return new BPromise(function(_0x1bf5a6,_0x3c0066){var _0xc0720f=respondWithRpcPromise(_0x2e81('0x20'));var _0x3ec91d=getAgent(_0x4669aa);Promise['all']([_0xc0720f,_0x3ec91d])['then'](function(_0xfc7ce3){var _0x38cbc2=_0xfc7ce3[0x0];var _0x20ef21=_0xfc7ce3[0x1];var _0x1eb8f6=_[_0x2e81('0x21')](_0x38cbc2[_0x2e81('0x22')],function(_0x243b20){return _0x243b20[_0x2e81('0x23')]==_0x20ef21['id']&&_0x243b20[_0x2e81('0x24')]==_0x1b34db;});if(_0x1eb8f6[_0x2e81('0x25')]==0x1){_0x1bf5a6(_0x20ef21);}else{_0x3c0066(new RangeError(_0x2e81('0x26')+_0x1b34db+'\x20not\x20found!'));}});});}exports[_0x2e81('0x27')]=function(_0x115b08,_0x1d0437){logger[_0x2e81('0xf')](_0x2e81('0x28'),_0x115b08[_0x2e81('0x29')]);var _0x2fad97=originateValidation[_0x2e81('0xa')](_0x115b08[_0x2e81('0x29')]);if(_0x2fad97[_0x2e81('0x25')]>0x0){return _0x1d0437[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x2fad97);}var _0x1c24f1=_0x115b08[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x1be530=_0x115b08[_0x2e81('0x29')]['callNumber'];var _0x371e5d=_0x115b08[_0x2e81('0x29')]['callerId'];var _0x215d57=_0x115b08[_0x2e81('0x29')]['callbackUrl'];return getAgent(_0x1c24f1)[_0x2e81('0x19')](function(_0x36ccb7){logger[_0x2e81('0xf')]('entityFound:',_0x36ccb7[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')](_0x2e81('0x2d'),_0x36ccb7[_0x2e81('0x15')]),_0x2e81('0x2e'),{'callNumber':_0x1be530,'callerId':_0x371e5d,'callbackUrl':_0x215d57});return _0x1d0437['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x1d0437));};exports[_0x2e81('0x2f')]=function(_0x5493d7,_0x4c7ff6){logger[_0x2e81('0xf')](_0x2e81('0x30'),_0x5493d7[_0x2e81('0x29')]);var _0x50e75f=hangupValidation[_0x2e81('0xa')](_0x5493d7[_0x2e81('0x29')]);if(_0x50e75f[_0x2e81('0x25')]>0x0){return _0x4c7ff6[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x50e75f);}var _0x4b0a7f=_0x5493d7['body'][_0x2e81('0x2b')];var _0x35a2e5=_0x5493d7[_0x2e81('0x29')]['sessionId'];return getAgent(_0x4b0a7f)[_0x2e81('0x19')](function(_0x44d10c){logger[_0x2e81('0xf')]('entityFound:',_0x44d10c[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')](_0x2e81('0x2d'),_0x44d10c[_0x2e81('0x15')]),_0x2e81('0x31'),{'sessionId':_0x35a2e5});return _0x4c7ff6[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x32')});})['catch'](handleError(_0x4c7ff6));};exports['answer']=function(_0xfb706a,_0x507936){logger[_0x2e81('0xf')](_0x2e81('0x33'),_0xfb706a[_0x2e81('0x29')]);var _0x42154f=answerValidation[_0x2e81('0xa')](_0xfb706a[_0x2e81('0x29')]);if(_0x42154f['length']>0x0){return _0x507936['status'](0x190)[_0x2e81('0x2a')](_0x42154f);}var _0x2bc2a7=_0xfb706a[_0x2e81('0x29')]['userId'];var _0x4499b7=_0xfb706a[_0x2e81('0x29')]['sessionId'];return getAgent(_0x2bc2a7)[_0x2e81('0x19')](function(_0x4b5c2d){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x4b5c2d[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')]('user:%s',_0x4b5c2d[_0x2e81('0x15')]),'webbar:answer',{'sessionId':_0x4499b7});return _0x507936[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0x2e81('0x1c')](handleError(_0x507936));};exports[_0x2e81('0x35')]=function(_0x15ec68,_0x3cee87){logger[_0x2e81('0xf')](_0x2e81('0x36'),_0x15ec68[_0x2e81('0x29')]);var _0x4cd20c=holdValidation[_0x2e81('0xa')](_0x15ec68['body']);if(_0x4cd20c['length']>0x0){return _0x3cee87[_0x2e81('0x16')](0x190)['json'](_0x4cd20c);}var _0x551ad0=_0x15ec68[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x36aae0=_0x15ec68['body']['sessionId'];return getAgent(_0x551ad0)[_0x2e81('0x19')](function(_0x1dd4d7){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x1dd4d7['name']);emit(util['format'](_0x2e81('0x2d'),_0x1dd4d7[_0x2e81('0x15')]),'webbar:hold',{'sessionId':_0x36aae0});return _0x3cee87['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x37')});})['catch'](handleError(_0x3cee87));};exports[_0x2e81('0x38')]=function(_0x33a4d7,_0x25b243){logger[_0x2e81('0xf')](_0x2e81('0x39'),_0x33a4d7['body']);var _0x7a56f1=unholdValidation[_0x2e81('0xa')](_0x33a4d7[_0x2e81('0x29')]);if(_0x7a56f1[_0x2e81('0x25')]>0x0){return _0x25b243['status'](0x190)['json'](_0x7a56f1);}var _0x1f5024=_0x33a4d7[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x127d1b=_0x33a4d7[_0x2e81('0x29')]['sessionId'];return getAgent(_0x1f5024)[_0x2e81('0x19')](function(_0x7b48bf){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x7b48bf[_0x2e81('0x15')]);emit(util['format'](_0x2e81('0x2d'),_0x7b48bf[_0x2e81('0x15')]),'webbar:unhold',{'sessionId':_0x127d1b});return _0x25b243['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':'unhold\x20executed!'});})[_0x2e81('0x1c')](handleError(_0x25b243));};exports[_0x2e81('0x3a')]=function(_0xba3975,_0x40d8a4){logger[_0x2e81('0xf')](_0x2e81('0x3b'),_0x40d8a4[_0x2e81('0x29')]);var _0x1570c1=callsValidation['validate'](_0xba3975[_0x2e81('0x29')]);if(_0x1570c1['length']>0x0){return _0x40d8a4[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x1570c1);}var _0x56135f=_0xba3975[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x56b2d0=respondWithRpcPromise(_0x2e81('0x20'));var _0x5c3b81=getAgent(_0x56135f);return Promise[_0x2e81('0x3c')]([_0x56b2d0,_0x5c3b81])[_0x2e81('0x19')](function(_0x12ae3b){var _0x3980ce=_0x12ae3b[0x0];var _0x4584b5=_0x12ae3b[0x1];var _0x4659c8=_[_0x2e81('0x21')](_0x3980ce[_0x2e81('0x22')],function(_0x4fe65c){return _0x4fe65c[_0x2e81('0x23')]==_0x4584b5['id'];});return _0x40d8a4[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'count':_0x4659c8[_0x2e81('0x25')],'rows':_0x4659c8});})[_0x2e81('0x1c')](handleError(_0x40d8a4));};exports[_0x2e81('0x3d')]=function(_0x176147,_0x8a1f0f){logger[_0x2e81('0xf')](_0x2e81('0x3e'),_0x176147[_0x2e81('0x29')]);var _0x1a92be=conferenceValidation[_0x2e81('0xa')](_0x176147[_0x2e81('0x29')]);if(_0x1a92be[_0x2e81('0x25')]>0x0){return _0x8a1f0f['status'](0x190)['json'](_0x1a92be);}var _0x354e39=_0x176147[_0x2e81('0x29')][_0x2e81('0x2b')];return getAgent(_0x354e39)[_0x2e81('0x19')](function(_0x45b114){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x45b114[_0x2e81('0x15')]);emit(util['format']('user:%s',_0x45b114[_0x2e81('0x15')]),_0x2e81('0x3f'));return _0x8a1f0f['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x40')});})[_0x2e81('0x1c')](handleError(_0x8a1f0f));};exports[_0x2e81('0x41')]=function(_0x1f4805,_0x85a455){logger[_0x2e81('0xf')](_0x2e81('0x42'),_0x1f4805['body']);var _0x143f60=transferValidation['validate'](_0x1f4805[_0x2e81('0x29')]);if(_0x143f60[_0x2e81('0x25')]>0x0){return _0x85a455[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x143f60);}var _0xafbd8c=_0x1f4805[_0x2e81('0x29')][_0x2e81('0x2b')];var _0xd0861=_0x1f4805[_0x2e81('0x29')][_0x2e81('0x24')];var _0x12ce2a=_0x1f4805[_0x2e81('0x29')]['transferNumber'];return getAgent(_0xafbd8c)[_0x2e81('0x19')](function(_0x3b1754){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x3b1754[_0x2e81('0x15')]);emit(util['format'](_0x2e81('0x2d'),_0x3b1754[_0x2e81('0x15')]),'webbar:transfer',{'sessionId':_0xd0861,'transferNumber':_0x12ce2a});return _0x85a455[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x43')});})[_0x2e81('0x1c')](handleError(_0x85a455));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8f820b8..06af1bd 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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x285a42,_0x395ef3){var _0x35c8c4=function(_0x2ced4d){while(--_0x2ced4d){_0x285a42['push'](_0x285a42['shift']());}};_0x35c8c4(++_0x395ef3);}(_0x430c,0x1a1));var _0xc430=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x430c[_0x26462c];return _0x509a42;};'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('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4dfa62,_0x52abb4){_0x4dfa62=_0x4dfa62-0x0;var _0x7111fe=_0x5f2f[_0x4dfa62];return _0x7111fe;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/canned_answers',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['get'](_0xf5f2('0x13'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);router[_0xf5f2('0x9')](_0xf5f2('0x15'),auth[_0xf5f2('0xa')](),controller['getApplications']);router[_0xf5f2('0x16')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x18')]);router[_0xf5f2('0x16')](_0xf5f2('0x19'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1b')]);router[_0xf5f2('0x16')](_0xf5f2('0x15'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x16')](_0xf5f2('0x1d'),controller[_0xf5f2('0x1e')]);router[_0xf5f2('0x16')]('/:id/send',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1f')]);router['put']('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x20')]);router['delete'](_0xf5f2('0xe'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x22')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x23')]);router[_0xf5f2('0x22')](_0xf5f2('0x19'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x24')]);router['delete']('/:id/users',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x25')]);module[_0xf5f2('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 24d028e..37b654f 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 _0xcde2=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0xcde2,0x9a));var _0x2cde=function(_0x183ee7,_0xbd1ef1){_0x183ee7=_0x183ee7-0x0;var _0x275fc7=_0xcde2[_0x183ee7];return _0x275fc7;};'use strict';var Sequelize=require(_0x2cde('0x0'));var rs=require(_0x2cde('0x1'));module[_0x2cde('0x2')]={'name':{'type':Sequelize[_0x2cde('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2cde('0x3')],'defaultValue':function(){return rs[_0x2cde('0x4')]();}},'phone':{'type':Sequelize[_0x2cde('0x3')]},'type':{'type':Sequelize[_0x2cde('0x5')](_0x2cde('0x6'),_0x2cde('0x7'))},'accountSid':{'type':Sequelize[_0x2cde('0x3')]},'baseUrl':{'type':Sequelize[_0x2cde('0x3')]},'authToken':{'type':Sequelize[_0x2cde('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2cde('0x8')],'defaultValue':function(){return _0x2cde('0x9');}},'notificationSound':{'type':Sequelize[_0x2cde('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2cde('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2cde('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2cde('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2cde('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2cde('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cde('0xb')],'comment':_0x2cde('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x2cde('0xa')],'defaultValue':![],'comment':_0x2cde('0xd'),'set':function(_0x22d085){if(!_0x22d085){this[_0x2cde('0xe')](_0x2cde('0xf'),null);}this[_0x2cde('0xe')]('mandatoryDisposition',_0x22d085);}},'description':{'type':Sequelize[_0x2cde('0x3')]}}; \ No newline at end of file +var _0xfee6=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x31c4bb,_0x49b855){var _0x3a1550=function(_0x103158){while(--_0x103158){_0x31c4bb['push'](_0x31c4bb['shift']());}};_0x3a1550(++_0x49b855);}(_0xfee6,0x8a));var _0x6fee=function(_0x40ee59,_0x3916f7){_0x40ee59=_0x40ee59-0x0;var _0x241773=_0xfee6[_0x40ee59];return _0x241773;};'use strict';var Sequelize=require(_0x6fee('0x0'));var rs=require(_0x6fee('0x1'));module[_0x6fee('0x2')]={'name':{'type':Sequelize[_0x6fee('0x3')],'unique':_0x6fee('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6fee('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6fee('0x3')],'defaultValue':function(){return rs[_0x6fee('0x5')]();}},'phone':{'type':Sequelize[_0x6fee('0x3')]},'type':{'type':Sequelize[_0x6fee('0x6')](_0x6fee('0x7'),_0x6fee('0x8'))},'accountSid':{'type':Sequelize[_0x6fee('0x3')]},'baseUrl':{'type':Sequelize[_0x6fee('0x3')]},'authToken':{'type':Sequelize[_0x6fee('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6fee('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6fee('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fee('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6fee('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6fee('0xb')],'comment':_0x6fee('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x6fee('0xa')],'defaultValue':![],'comment':_0x6fee('0xd'),'set':function(_0x2ea35a){if(!_0x2ea35a){this[_0x6fee('0xe')](_0x6fee('0xf'),null);}this[_0x6fee('0xe')](_0x6fee('0x10'),_0x2ea35a);}},'description':{'type':Sequelize[_0x6fee('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 825b27e..ac153f9 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 _0xa461=['info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','params','keys','length','includeAll','include','find','create','body','user','role','WhatsappAccounts','userProfileId','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','replace','whatsapp:','messageId','MessageSid','from','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','WhatsappMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','then'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xa461,0x150));var _0x1a46=function(_0x3f44ee,_0x42814d){_0x3f44ee=_0x3f44ee-0x0;var _0x5a6731=_0xa461[_0x3f44ee];return _0x5a6731;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a46('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a46('0x1'));var rp=require(_0x1a46('0x2'));var moment=require(_0x1a46('0x3'));var BPromise=require(_0x1a46('0x4'));var Mustache=require(_0x1a46('0x5'));var util=require(_0x1a46('0x6'));var path=require(_0x1a46('0x7'));var sox=require(_0x1a46('0x8'));var csv=require(_0x1a46('0x9'));var ejs=require(_0x1a46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a46('0xb'));var squel=require(_0x1a46('0xc'));var crypto=require(_0x1a46('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a46('0x9'));var querystring=require(_0x1a46('0xe'));var Papa=require(_0x1a46('0xf'));var Redis=require(_0x1a46('0x10'));var authService=require(_0x1a46('0x11'));var qs=require(_0x1a46('0x12'));var as=require(_0x1a46('0x13'));var hardwareService=require(_0x1a46('0x14'));var logger=require(_0x1a46('0x15'))(_0x1a46('0x16'));var utils=require(_0x1a46('0x17'));var config=require(_0x1a46('0x18'));var licenseUtil=require(_0x1a46('0x19'));var db=require(_0x1a46('0x1a'))['db'];config[_0x1a46('0x1b')]=_[_0x1a46('0x1c')](config[_0x1a46('0x1b')],{'host':_0x1a46('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a46('0x1e'))[_0x1a46('0x1f')](socket);var jayson=require(_0x1a46('0x20'));var client=jayson['client'][_0x1a46('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x2e1d9a,_0xedf686,_0x20e52f,_0x1c2a73){return new BPromise(function(_0x32455f,_0x1ca2da){var _0x27d54a=_0x1c2a73||client;return _0x27d54a[_0x1a46('0x22')](_0x2e1d9a,_0x20e52f)[_0x1a46('0x23')](function(_0x3f0c36){logger[_0x1a46('0x24')](_0x1a46('0x25'),_0xedf686,'request\x20sent');logger['debug'](_0x1a46('0x26'),_0xedf686,_0x1a46('0x27'),JSON[_0x1a46('0x28')](_0x3f0c36));if(_0x3f0c36[_0x1a46('0x29')]){if(_0x3f0c36[_0x1a46('0x29')]['code']===0x1f4){logger[_0x1a46('0x29')](_0x1a46('0x25'),_0xedf686,_0x3f0c36['error'][_0x1a46('0x2a')]);return _0x1ca2da(_0x3f0c36[_0x1a46('0x29')][_0x1a46('0x2a')]);}logger[_0x1a46('0x29')](_0x1a46('0x25'),_0xedf686,_0x3f0c36[_0x1a46('0x29')][_0x1a46('0x2a')]);return _0x32455f(_0x3f0c36[_0x1a46('0x29')][_0x1a46('0x2a')]);}else{logger[_0x1a46('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0xedf686,_0x1a46('0x27'));_0x32455f(_0x3f0c36['result']['message']);}})[_0x1a46('0x2b')](function(_0x2fcd51){logger['error'](_0x1a46('0x25'),_0xedf686,_0x2fcd51);_0x1ca2da(_0x2fcd51);});});}function respondWithStatusCode(_0x14f5f7,_0x464937){_0x464937=_0x464937||0xcc;return function(_0x361052){if(_0x361052){return _0x14f5f7[_0x1a46('0x2c')](_0x464937);}return _0x14f5f7[_0x1a46('0x2d')](_0x464937)[_0x1a46('0x2e')]();};}function respondWithResult(_0x343f4e,_0x50464f){_0x50464f=_0x50464f||0xc8;return function(_0x325e25){if(_0x325e25){return _0x343f4e[_0x1a46('0x2d')](_0x50464f)[_0x1a46('0x2f')](_0x325e25);}};}function respondWithFilteredResult(_0x16574e,_0x415e78){return function(_0x45d6ba){if(_0x45d6ba){var _0x584380=typeof _0x415e78[_0x1a46('0x30')]==='undefined'&&typeof _0x415e78[_0x1a46('0x31')]===_0x1a46('0x32');var _0x15b589=_0x45d6ba[_0x1a46('0x33')];var _0x72c1fa=_0x584380?0x0:_0x415e78['offset'];var _0x14f4da=_0x584380?_0x45d6ba[_0x1a46('0x33')]:_0x415e78[_0x1a46('0x30')]+_0x415e78[_0x1a46('0x31')];var _0x23cd12;if(_0x14f4da>=_0x15b589){_0x14f4da=_0x15b589;_0x23cd12=0xc8;}else{_0x23cd12=0xce;}_0x16574e[_0x1a46('0x2d')](_0x23cd12);return _0x16574e[_0x1a46('0x34')]('Content-Range',_0x72c1fa+'-'+_0x14f4da+'/'+_0x15b589)[_0x1a46('0x2f')](_0x45d6ba);}return null;};}function patchUpdates(_0x596d74){return function(_0x5a7a2a){try{jsonpatch[_0x1a46('0x35')](_0x5a7a2a,_0x596d74,!![]);}catch(_0x517185){return BPromise[_0x1a46('0x36')](_0x517185);}return _0x5a7a2a[_0x1a46('0x37')]();};}function saveUpdates(_0x1cebd1,_0x35aaf4){return function(_0x429529){if(_0x429529){return _0x429529[_0x1a46('0x38')](_0x1cebd1)[_0x1a46('0x23')](function(_0x52e34b){return _0x52e34b;});}return null;};}function removeEntity(_0x1feae2,_0x15083d){return function(_0x234c10){if(_0x234c10){return _0x234c10['destroy']()[_0x1a46('0x23')](function(){var _0x457de2=_0x234c10[_0x1a46('0x39')]({'plain':!![]});var _0x1f7150='WhatsappAccounts';return db[_0x1a46('0x3a')][_0x1a46('0x3b')]({'where':{'type':_0x1f7150,'resourceId':_0x457de2['id']}})[_0x1a46('0x23')](function(){return _0x234c10;});})[_0x1a46('0x23')](function(){_0x1feae2[_0x1a46('0x2d')](0xcc)[_0x1a46('0x2e')]();});}};}function handleEntityNotFound(_0x53af29,_0x3a2cb1){return function(_0xa80460){if(!_0xa80460){_0x53af29[_0x1a46('0x2c')](0x194);}return _0xa80460;};}function handleError(_0x271bd8,_0x19ab63){_0x19ab63=_0x19ab63||0x1f4;return function(_0x42f330){logger['error'](_0x42f330[_0x1a46('0x3c')]);if(_0x42f330[_0x1a46('0x3d')]){delete _0x42f330[_0x1a46('0x3d')];}_0x271bd8[_0x1a46('0x2d')](_0x19ab63)[_0x1a46('0x3e')](_0x42f330);};}exports[_0x1a46('0x3f')]=function(_0x4ce225,_0x126437){var _0x4cf2e4={'include':[{'model':db['Pause'],'as':_0x1a46('0x40')}]},_0x216822={},_0x4cca97={'count':0x0,'rows':[]};var _0x2ddaf8=_[_0x1a46('0x41')](db[_0x1a46('0x42')][_0x1a46('0x43')],function(_0x22f0c9){return{'name':_0x22f0c9['fieldName'],'type':_0x22f0c9['type'][_0x1a46('0x44')]};});_0x216822[_0x1a46('0x45')]=_[_0x1a46('0x41')](_0x2ddaf8,'name');_0x216822[_0x1a46('0x46')]=_['keys'](_0x4ce225[_0x1a46('0x46')]);_0x216822[_0x1a46('0x47')]=_[_0x1a46('0x48')](_0x216822[_0x1a46('0x45')],_0x216822[_0x1a46('0x46')]);_0x4cf2e4[_0x1a46('0x49')]=_[_0x1a46('0x48')](_0x216822[_0x1a46('0x45')],qs[_0x1a46('0x4a')](_0x4ce225[_0x1a46('0x46')][_0x1a46('0x4a')]));_0x4cf2e4[_0x1a46('0x49')]=_0x4cf2e4[_0x1a46('0x49')]['length']?_0x4cf2e4['attributes']:_0x216822[_0x1a46('0x45')];if(!_0x4ce225[_0x1a46('0x46')][_0x1a46('0x4b')](_0x1a46('0x4c'))){_0x4cf2e4['limit']=qs[_0x1a46('0x31')](_0x4ce225['query'][_0x1a46('0x31')]);_0x4cf2e4['offset']=qs[_0x1a46('0x30')](_0x4ce225['query'][_0x1a46('0x30')]);}_0x4cf2e4[_0x1a46('0x4d')]=qs[_0x1a46('0x4e')](_0x4ce225[_0x1a46('0x46')][_0x1a46('0x4e')]);_0x4cf2e4[_0x1a46('0x4f')]=qs[_0x1a46('0x47')](_[_0x1a46('0x50')](_0x4ce225[_0x1a46('0x46')],_0x216822[_0x1a46('0x47')]),_0x2ddaf8);if(_0x4ce225[_0x1a46('0x46')][_0x1a46('0x51')]){_0x4cf2e4['where']=_[_0x1a46('0x52')](_0x4cf2e4[_0x1a46('0x4f')],{'$or':_['map'](_0x2ddaf8,function(_0x33a9bd){if(_0x33a9bd[_0x1a46('0x53')]!==_0x1a46('0x54')){var _0x13fe44={};_0x13fe44[_0x33a9bd['name']]={'$like':'%'+_0x4ce225[_0x1a46('0x46')][_0x1a46('0x51')]+'%'};return _0x13fe44;}})});}_0x4cf2e4=_['merge']({},_0x4cf2e4,_0x4ce225[_0x1a46('0x55')]);var _0x334ccc={'where':_0x4cf2e4[_0x1a46('0x4f')]};return db['WhatsappAccount'][_0x1a46('0x33')](_0x334ccc)[_0x1a46('0x23')](function(_0x3946c2){_0x4cca97[_0x1a46('0x33')]=_0x3946c2;if(_0x4ce225['query']['includeAll']){_0x4cf2e4['include']=[{'all':!![]}];}return db[_0x1a46('0x42')][_0x1a46('0x56')](_0x4cf2e4);})['then'](function(_0x6075ab){_0x4cca97[_0x1a46('0x57')]=_0x6075ab;return _0x4cca97;})[_0x1a46('0x23')](respondWithFilteredResult(_0x126437,_0x4cf2e4))['catch'](handleError(_0x126437,null));};exports['show']=function(_0x18ecde,_0x4c5e90){var _0xc71562={'raw':![],'where':{'id':_0x18ecde[_0x1a46('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x1a46('0x40')}]},_0x2d6529={};_0x2d6529[_0x1a46('0x45')]=_[_0x1a46('0x59')](db['WhatsappAccount'][_0x1a46('0x43')]);_0x2d6529[_0x1a46('0x46')]=_[_0x1a46('0x59')](_0x18ecde[_0x1a46('0x46')]);_0x2d6529[_0x1a46('0x47')]=_['intersection'](_0x2d6529[_0x1a46('0x45')],_0x2d6529[_0x1a46('0x46')]);_0xc71562['attributes']=_[_0x1a46('0x48')](_0x2d6529[_0x1a46('0x45')],qs[_0x1a46('0x4a')](_0x18ecde[_0x1a46('0x46')][_0x1a46('0x4a')]));_0xc71562[_0x1a46('0x49')]=_0xc71562[_0x1a46('0x49')][_0x1a46('0x5a')]?_0xc71562[_0x1a46('0x49')]:_0x2d6529[_0x1a46('0x45')];if(_0x18ecde['query'][_0x1a46('0x5b')]){_0xc71562[_0x1a46('0x5c')]=[{'all':!![]}];}_0xc71562=_[_0x1a46('0x52')]({},_0xc71562,_0x18ecde[_0x1a46('0x55')]);return db[_0x1a46('0x42')][_0x1a46('0x5d')](_0xc71562)[_0x1a46('0x23')](handleEntityNotFound(_0x4c5e90,null))['then'](respondWithResult(_0x4c5e90,null))[_0x1a46('0x2b')](handleError(_0x4c5e90,null));};exports[_0x1a46('0x5e')]=function(_0x59f31d,_0x375113){return db['WhatsappAccount'][_0x1a46('0x5e')](_0x59f31d[_0x1a46('0x5f')],{})[_0x1a46('0x23')](function(_0x3f41c3){var _0x41f7f5=_0x59f31d[_0x1a46('0x60')][_0x1a46('0x39')]({'plain':!![]});if(!_0x41f7f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41f7f5[_0x1a46('0x61')]===_0x1a46('0x60')){var _0x4bdc32=_0x3f41c3[_0x1a46('0x39')]({'plain':!![]});var _0x22eb6c=_0x1a46('0x62');return db['UserProfileSection'][_0x1a46('0x5d')]({'where':{'name':_0x22eb6c,'userProfileId':_0x41f7f5[_0x1a46('0x63')]},'raw':!![]})[_0x1a46('0x23')](function(_0x38b1a5){if(_0x38b1a5&&_0x38b1a5['autoAssociation']===0x0){return db[_0x1a46('0x3a')][_0x1a46('0x5e')]({'name':_0x4bdc32[_0x1a46('0x3d')],'resourceId':_0x4bdc32['id'],'type':_0x38b1a5['name'],'sectionId':_0x38b1a5['id']},{})[_0x1a46('0x23')](function(){return _0x3f41c3;});}else{return _0x3f41c3;}})[_0x1a46('0x2b')](function(_0xf11e8f){logger[_0x1a46('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf11e8f);throw _0xf11e8f;});}return _0x3f41c3;})[_0x1a46('0x23')](respondWithResult(_0x375113,0xc9))['catch'](handleError(_0x375113,null));};exports[_0x1a46('0x38')]=function(_0x5e7d1c,_0x558485){if(_0x5e7d1c['body']['id']){delete _0x5e7d1c[_0x1a46('0x5f')]['id'];}return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x5e7d1c[_0x1a46('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x1a46('0x40')}]})['then'](handleEntityNotFound(_0x558485,null))[_0x1a46('0x23')](saveUpdates(_0x5e7d1c[_0x1a46('0x5f')],null))[_0x1a46('0x23')](respondWithResult(_0x558485,null))[_0x1a46('0x2b')](handleError(_0x558485,null));};exports[_0x1a46('0x3b')]=function(_0x520e1d,_0x3612a6){return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x520e1d[_0x1a46('0x58')]['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x3612a6,null))[_0x1a46('0x23')](removeEntity(_0x3612a6,null))[_0x1a46('0x2b')](handleError(_0x3612a6,null));};exports['describe']=function(_0xa8ea6f,_0x43afc1){return db[_0x1a46('0x42')]['describe']()['then'](respondWithResult(_0x43afc1,null))[_0x1a46('0x2b')](handleError(_0x43afc1,null));};exports[_0x1a46('0x64')]=function(_0x328fc0,_0xe088a8,_0x3105e0){if(_0x328fc0[_0x1a46('0x5f')]['id']){delete _0x328fc0[_0x1a46('0x5f')]['id'];}return db['WhatsappAccount'][_0x1a46('0x5d')]({'where':{'id':_0x328fc0[_0x1a46('0x58')]['id']}})['then'](handleEntityNotFound(_0xe088a8,null))[_0x1a46('0x23')](function(_0x58507b){if(_0x58507b){_0x328fc0[_0x1a46('0x5f')][_0x1a46('0x65')]=_0x58507b['id'];return db[_0x1a46('0x66')][_0x1a46('0x5e')](_0x328fc0[_0x1a46('0x5f')]);}})[_0x1a46('0x23')](respondWithResult(_0xe088a8,null))[_0x1a46('0x2b')](handleError(_0xe088a8,null));};exports[_0x1a46('0x67')]=function(_0x763bca,_0x1e4492,_0x3834cd){var _0x26084a={'raw':![],'where':{}};var _0x406de6={};var _0x2993b3={'count':0x0,'rows':[]};return db[_0x1a46('0x42')][_0x1a46('0x68')]({'where':{'id':_0x763bca['params']['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x1e4492,null))[_0x1a46('0x23')](function(_0x8455a0){if(_0x8455a0){_0x406de6[_0x1a46('0x45')]=_['keys'](db[_0x1a46('0x66')][_0x1a46('0x43')]);_0x406de6['query']=_[_0x1a46('0x59')](_0x763bca[_0x1a46('0x46')]);_0x406de6[_0x1a46('0x47')]=_[_0x1a46('0x48')](_0x406de6[_0x1a46('0x45')],_0x406de6['query']);_0x26084a[_0x1a46('0x49')]=_[_0x1a46('0x48')](_0x406de6[_0x1a46('0x45')],qs[_0x1a46('0x4a')](_0x763bca[_0x1a46('0x46')][_0x1a46('0x4a')]));_0x26084a[_0x1a46('0x49')]=_0x26084a[_0x1a46('0x49')][_0x1a46('0x5a')]?_0x26084a[_0x1a46('0x49')]:_0x406de6[_0x1a46('0x45')];if(!_0x763bca[_0x1a46('0x46')]['hasOwnProperty'](_0x1a46('0x4c'))){_0x26084a[_0x1a46('0x31')]=qs[_0x1a46('0x31')](_0x763bca[_0x1a46('0x46')]['limit']);_0x26084a[_0x1a46('0x30')]=qs[_0x1a46('0x30')](_0x763bca[_0x1a46('0x46')][_0x1a46('0x30')]);}_0x26084a[_0x1a46('0x4d')]=qs['sort'](_0x763bca[_0x1a46('0x46')]['sort']);_0x26084a[_0x1a46('0x4f')]=qs[_0x1a46('0x47')](_[_0x1a46('0x50')](_0x763bca['query'],_0x406de6[_0x1a46('0x47')]));_0x26084a['where'][_0x1a46('0x65')]=_0x8455a0['id'];if(_0x763bca['query'][_0x1a46('0x51')]){_0x26084a[_0x1a46('0x4f')]=_[_0x1a46('0x52')](_0x26084a['where'],{'$or':_['map'](_0x26084a[_0x1a46('0x49')],function(_0x3e2442){var _0x1e97c8={};_0x1e97c8[_0x3e2442]={'$like':'%'+_0x763bca['query'][_0x1a46('0x51')]+'%'};return _0x1e97c8;})});}_0x26084a=_[_0x1a46('0x52')]({},_0x26084a,_0x763bca[_0x1a46('0x55')]);return db[_0x1a46('0x66')][_0x1a46('0x33')]({'where':_0x26084a[_0x1a46('0x4f')]})[_0x1a46('0x23')](function(_0x1dcf4f){_0x2993b3['count']=_0x1dcf4f;if(_0x763bca[_0x1a46('0x46')][_0x1a46('0x5b')]){_0x26084a[_0x1a46('0x5c')]=[{'all':!![]}];}return db[_0x1a46('0x66')][_0x1a46('0x56')](_0x26084a);})[_0x1a46('0x23')](function(_0x4e8009){_0x2993b3['rows']=_0x4e8009;return _0x2993b3;});}})['then'](respondWithFilteredResult(_0x1e4492,_0x26084a))[_0x1a46('0x2b')](handleError(_0x1e4492,null));};exports[_0x1a46('0x69')]=function(_0x5e30af,_0x4b93fe,_0xdbd2bc){return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x5e30af[_0x1a46('0x58')]['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x4b93fe,null))['then'](function(_0x111d91){if(_0x111d91){return _0x111d91[_0x1a46('0x69')](_0x5e30af[_0x1a46('0x46')][_0x1a46('0x6a')]);}})['then'](respondWithStatusCode(_0x4b93fe,null))['catch'](handleError(_0x4b93fe,null));};exports[_0x1a46('0x6b')]=function(_0x20f694,_0x30c2a2,_0x4d0b94){if(_0x20f694[_0x1a46('0x5f')]['id']){delete _0x20f694[_0x1a46('0x5f')]['id'];}return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x20f694[_0x1a46('0x58')]['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x30c2a2,null))[_0x1a46('0x23')](function(_0x45cf8f){if(_0x45cf8f){_0x20f694[_0x1a46('0x5f')]['WhatsappAccountId']=_0x45cf8f['id'];return db[_0x1a46('0x6c')][_0x1a46('0x5e')](_0x20f694[_0x1a46('0x5f')]);}})['then'](respondWithResult(_0x30c2a2,null))[_0x1a46('0x2b')](handleError(_0x30c2a2,null));};exports['getAnswers']=function(_0x4b81b6,_0x3d97b6,_0x25078d){var _0x315aec={'raw':![],'where':{}};var _0x1f03b7={};var _0x1e238e={'count':0x0,'rows':[]};return db[_0x1a46('0x42')]['findOne']({'where':{'id':_0x4b81b6[_0x1a46('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d97b6,null))[_0x1a46('0x23')](function(_0x336c33){if(_0x336c33){_0x1f03b7['model']=_['keys'](db['CannedAnswer'][_0x1a46('0x43')]);_0x1f03b7[_0x1a46('0x46')]=_[_0x1a46('0x59')](_0x4b81b6['query']);_0x1f03b7[_0x1a46('0x47')]=_[_0x1a46('0x48')](_0x1f03b7[_0x1a46('0x45')],_0x1f03b7[_0x1a46('0x46')]);_0x315aec[_0x1a46('0x49')]=_[_0x1a46('0x48')](_0x1f03b7[_0x1a46('0x45')],qs[_0x1a46('0x4a')](_0x4b81b6[_0x1a46('0x46')][_0x1a46('0x4a')]));_0x315aec[_0x1a46('0x49')]=_0x315aec[_0x1a46('0x49')]['length']?_0x315aec[_0x1a46('0x49')]:_0x1f03b7[_0x1a46('0x45')];if(!_0x4b81b6[_0x1a46('0x46')][_0x1a46('0x4b')](_0x1a46('0x4c'))){_0x315aec[_0x1a46('0x31')]=qs[_0x1a46('0x31')](_0x4b81b6[_0x1a46('0x46')][_0x1a46('0x31')]);_0x315aec[_0x1a46('0x30')]=qs['offset'](_0x4b81b6['query'][_0x1a46('0x30')]);}_0x315aec[_0x1a46('0x4d')]=qs[_0x1a46('0x4e')](_0x4b81b6['query'][_0x1a46('0x4e')]);_0x315aec[_0x1a46('0x4f')]=qs[_0x1a46('0x47')](_[_0x1a46('0x50')](_0x4b81b6['query'],_0x1f03b7[_0x1a46('0x47')]));_0x315aec[_0x1a46('0x4f')][_0x1a46('0x65')]=_0x336c33['id'];if(_0x4b81b6[_0x1a46('0x46')]['filter']){_0x315aec[_0x1a46('0x4f')]=_['merge'](_0x315aec['where'],{'$or':_[_0x1a46('0x41')](_0x315aec[_0x1a46('0x49')],function(_0x3586d7){var _0x18f910={};_0x18f910[_0x3586d7]={'$like':'%'+_0x4b81b6[_0x1a46('0x46')]['filter']+'%'};return _0x18f910;})});}_0x315aec=_['merge']({},_0x315aec,_0x4b81b6[_0x1a46('0x55')]);return db[_0x1a46('0x6c')]['count']({'where':_0x315aec[_0x1a46('0x4f')]})[_0x1a46('0x23')](function(_0x3db42e){_0x1e238e[_0x1a46('0x33')]=_0x3db42e;if(_0x4b81b6[_0x1a46('0x46')]['includeAll']){_0x315aec['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x315aec);})[_0x1a46('0x23')](function(_0x2d7532){_0x1e238e[_0x1a46('0x57')]=_0x2d7532;return _0x1e238e;});}})['then'](respondWithFilteredResult(_0x3d97b6,_0x315aec))['catch'](handleError(_0x3d97b6,null));};exports[_0x1a46('0x6d')]=function(_0x3a9486,_0x3ea959,_0x4c1902){return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x3a9486[_0x1a46('0x58')]['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x3ea959,null))[_0x1a46('0x23')](function(_0x38ce40){if(_0x38ce40){return _0x38ce40[_0x1a46('0x6d')](_0x3a9486[_0x1a46('0x46')][_0x1a46('0x6a')]);}})[_0x1a46('0x23')](respondWithStatusCode(_0x3ea959,null))[_0x1a46('0x2b')](handleError(_0x3ea959,null));};exports[_0x1a46('0x6e')]=function(_0x9ed3f,_0x354d90,_0x2a44b9){return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x9ed3f[_0x1a46('0x58')]['id']}})[_0x1a46('0x23')](handleEntityNotFound(_0x354d90,null))[_0x1a46('0x23')](function(_0x3af157){if(_0x3af157){return _0x3af157[_0x1a46('0x6e')](_0x9ed3f[_0x1a46('0x5f')][_0x1a46('0x6a')],_[_0x1a46('0x6f')](_0x9ed3f[_0x1a46('0x5f')],[_0x1a46('0x6a'),'id'])||{})[_0x1a46('0x70')](function(_0x24d512){for(var _0xbee4d4=0x0;_0xbee4d4<_0x9ed3f[_0x1a46('0x5f')][_0x1a46('0x6a')][_0x1a46('0x5a')];_0xbee4d4+=0x1){socket[_0x1a46('0x71')](_0x1a46('0x72'),{'UserId':Number(_0x9ed3f[_0x1a46('0x5f')][_0x1a46('0x6a')][_0xbee4d4]),'WhatsappAccountId':Number(_0x9ed3f[_0x1a46('0x58')]['id'])});}return _0x24d512;});}})[_0x1a46('0x23')](respondWithResult(_0x354d90,null))[_0x1a46('0x2b')](handleError(_0x354d90,null));};exports[_0x1a46('0x73')]=function(_0x583a79,_0x27b2c5,_0x487833){return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x583a79['params']['id']}})['then'](handleEntityNotFound(_0x27b2c5,null))[_0x1a46('0x23')](function(_0x4f33ba){if(_0x4f33ba){return _0x4f33ba[_0x1a46('0x73')](_0x583a79[_0x1a46('0x46')][_0x1a46('0x6a')])[_0x1a46('0x23')](function(){if(_[_0x1a46('0x74')](_0x583a79['query'][_0x1a46('0x6a')])){for(var _0x6cf32b=0x0;_0x6cf32b<_0x583a79[_0x1a46('0x46')]['ids'][_0x1a46('0x5a')];_0x6cf32b+=0x1){socket[_0x1a46('0x71')](_0x1a46('0x75'),{'UserId':Number(_0x583a79[_0x1a46('0x46')]['ids'][_0x6cf32b]),'WhatsappAccountId':Number(_0x583a79['params']['id'])});}}else{socket['emit'](_0x1a46('0x75'),{'UserId':Number(_0x583a79[_0x1a46('0x46')]['ids']),'WhatsappAccountId':Number(_0x583a79[_0x1a46('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x27b2c5,null))[_0x1a46('0x2b')](handleError(_0x27b2c5,null));};exports[_0x1a46('0x76')]=function(_0x10cf48,_0x4f5d11,_0x51b458){var _0x2e3a0e={};var _0x5864f7={};var _0x14dd91;var _0x5bea0b;return db[_0x1a46('0x42')][_0x1a46('0x68')]({'where':{'id':_0x10cf48['params']['id']}})['then'](handleEntityNotFound(_0x4f5d11,null))[_0x1a46('0x23')](function(_0x3be2d8){if(_0x3be2d8){_0x14dd91=_0x3be2d8;_0x5864f7[_0x1a46('0x45')]=_[_0x1a46('0x59')](db['User'][_0x1a46('0x43')]);_0x5864f7[_0x1a46('0x46')]=_[_0x1a46('0x59')](_0x10cf48[_0x1a46('0x46')]);_0x5864f7[_0x1a46('0x47')]=_[_0x1a46('0x48')](_0x5864f7['model'],_0x5864f7[_0x1a46('0x46')]);_0x2e3a0e['attributes']=_[_0x1a46('0x48')](_0x5864f7['model'],qs[_0x1a46('0x4a')](_0x10cf48[_0x1a46('0x46')][_0x1a46('0x4a')]));_0x2e3a0e[_0x1a46('0x49')]=_0x2e3a0e[_0x1a46('0x49')][_0x1a46('0x5a')]?_0x2e3a0e['attributes']:_0x5864f7['model'];_0x2e3a0e[_0x1a46('0x4d')]=qs['sort'](_0x10cf48[_0x1a46('0x46')][_0x1a46('0x4e')]);_0x2e3a0e[_0x1a46('0x4f')]=qs[_0x1a46('0x47')](_[_0x1a46('0x50')](_0x10cf48[_0x1a46('0x46')],_0x5864f7['filters']));if(_0x10cf48[_0x1a46('0x46')]['filter']){_0x2e3a0e[_0x1a46('0x4f')]=_[_0x1a46('0x52')](_0x2e3a0e[_0x1a46('0x4f')],{'$or':_[_0x1a46('0x41')](_0x2e3a0e['attributes'],function(_0xd46f4d){var _0x238823={};_0x238823[_0xd46f4d]={'$like':'%'+_0x10cf48[_0x1a46('0x46')][_0x1a46('0x51')]+'%'};return _0x238823;})});}_0x2e3a0e=_['merge']({},_0x2e3a0e,_0x10cf48[_0x1a46('0x55')]);return _0x14dd91[_0x1a46('0x76')](_0x2e3a0e);}})[_0x1a46('0x23')](function(_0x61bc26){if(_0x61bc26){_0x5bea0b=_0x61bc26['length'];if(!_0x10cf48[_0x1a46('0x46')][_0x1a46('0x4b')](_0x1a46('0x4c'))){_0x2e3a0e['limit']=qs['limit'](_0x10cf48[_0x1a46('0x46')][_0x1a46('0x31')]);_0x2e3a0e[_0x1a46('0x30')]=qs[_0x1a46('0x30')](_0x10cf48[_0x1a46('0x46')][_0x1a46('0x30')]);}return _0x14dd91['getAgents'](_0x2e3a0e);}})[_0x1a46('0x23')](function(_0xaf53c7){if(_0xaf53c7){return _0xaf53c7?{'count':_0x5bea0b,'rows':_0xaf53c7}:null;}})[_0x1a46('0x23')](respondWithResult(_0x4f5d11,null))[_0x1a46('0x2b')](handleError(_0x4f5d11,null));};exports[_0x1a46('0x77')]=function(_0x5d273d,_0x17adeb,_0x4645e4){return db[_0x1a46('0x42')][_0x1a46('0x68')]({'where':{'id':_0x5d273d[_0x1a46('0x58')]['id']}})['then'](handleEntityNotFound(_0x17adeb,null))[_0x1a46('0x23')](function(_0x2722f3){if(_0x2722f3){return db[_0x1a46('0x78')][_0x1a46('0x79')](function(_0x466372){return db[_0x1a46('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x5d273d[_0x1a46('0x58')]['id']},'transaction':_0x466372})[_0x1a46('0x23')](function(_0x255efd){var _0xfcf2ff=_[_0x1a46('0x41')](_0x5d273d['body'],function(_0x3235fd){_0x3235fd['WhatsappAccountId']=_0x5d273d[_0x1a46('0x58')]['id'];return _0x3235fd;});return db[_0x1a46('0x7a')]['bulkCreate'](_0xfcf2ff,{'transaction':_0x466372});});})[_0x1a46('0x23')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x5d273d[_0x1a46('0x58')]['id']},'order':_0x1a46('0x7b')});});}})[_0x1a46('0x23')](respondWithResult(_0x17adeb,null))[_0x1a46('0x2b')](handleError(_0x17adeb,null));};exports[_0x1a46('0x7c')]=function(_0x9bf57a,_0x114a83,_0x423994){var _0x47884b={};var _0x1e145d={};var _0x1a0a23;var _0x3dd65a;return db[_0x1a46('0x42')][_0x1a46('0x68')]({'where':{'id':_0x9bf57a[_0x1a46('0x58')]['id']}})['then'](handleEntityNotFound(_0x114a83,null))[_0x1a46('0x23')](function(_0x347f79){if(_0x347f79){_0x1a0a23=_0x347f79;_0x1e145d[_0x1a46('0x45')]=_[_0x1a46('0x59')](db['WhatsappApplication'][_0x1a46('0x43')]);_0x1e145d[_0x1a46('0x46')]=_[_0x1a46('0x59')](_0x9bf57a[_0x1a46('0x46')]);_0x1e145d[_0x1a46('0x47')]=_[_0x1a46('0x48')](_0x1e145d[_0x1a46('0x45')],_0x1e145d[_0x1a46('0x46')]);_0x47884b[_0x1a46('0x49')]=_[_0x1a46('0x48')](_0x1e145d['model'],qs['fields'](_0x9bf57a['query'][_0x1a46('0x4a')]));_0x47884b[_0x1a46('0x49')]=_0x47884b[_0x1a46('0x49')][_0x1a46('0x5a')]?_0x47884b[_0x1a46('0x49')]:_0x1e145d[_0x1a46('0x45')];_0x47884b[_0x1a46('0x4d')]=qs[_0x1a46('0x4e')](_0x9bf57a[_0x1a46('0x46')][_0x1a46('0x4e')]);_0x47884b[_0x1a46('0x4f')]=qs[_0x1a46('0x47')](_[_0x1a46('0x50')](_0x9bf57a['query'],_0x1e145d['filters']));if(_0x9bf57a[_0x1a46('0x46')][_0x1a46('0x51')]){_0x47884b[_0x1a46('0x4f')]=_[_0x1a46('0x52')](_0x47884b[_0x1a46('0x4f')],{'$or':_[_0x1a46('0x41')](_0x47884b[_0x1a46('0x49')],function(_0x4c6d39){var _0x245fd6={};_0x245fd6[_0x4c6d39]={'$like':'%'+_0x9bf57a[_0x1a46('0x46')]['filter']+'%'};return _0x245fd6;})});}_0x47884b=_[_0x1a46('0x52')]({},_0x47884b,_0x9bf57a[_0x1a46('0x55')]);return _0x1a0a23[_0x1a46('0x7c')](_0x47884b);}})['then'](function(_0x1ba7b8){if(_0x1ba7b8){_0x3dd65a=_0x1ba7b8[_0x1a46('0x5a')];if(!_0x9bf57a['query'][_0x1a46('0x4b')](_0x1a46('0x4c'))){_0x47884b[_0x1a46('0x31')]=qs[_0x1a46('0x31')](_0x9bf57a['query'][_0x1a46('0x31')]);_0x47884b['offset']=qs[_0x1a46('0x30')](_0x9bf57a[_0x1a46('0x46')]['offset']);}return _0x1a0a23[_0x1a46('0x7c')](_0x47884b);}})[_0x1a46('0x23')](function(_0x44a68a){if(_0x44a68a){return _0x44a68a?{'count':_0x3dd65a,'rows':_0x44a68a}:null;}})[_0x1a46('0x23')](respondWithResult(_0x114a83,null))['catch'](handleError(_0x114a83,null));};exports[_0x1a46('0x7d')]=function(_0x213c1c,_0xcef463,_0x4fe04b){var _0x48b57b={'channel':_0x1a46('0x7e')};var _0x50a189=[];var _0x3ffa16=[];var _0x2bd37f={};return db[_0x1a46('0x42')][_0x1a46('0x5d')]({'where':{'id':_0x213c1c[_0x1a46('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1a46('0x7f')}]})[_0x1a46('0x23')](handleEntityNotFound(_0xcef463,null))[_0x1a46('0x23')](function(_0x3bc859){_0x48b57b['account']=_0x3bc859;if(_0x48b57b[_0x1a46('0x80')]&&_0x48b57b['account'][_0x1a46('0x53')]===_0x1a46('0x81')&&_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x82')]){if(_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x82')]['length']===0x0)return;if(_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x82')][0x0][_0x1a46('0x83')]!=='read')return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x213c1c['body'][_0x1a46('0x82')][0x0][_0x1a46('0x84')]},{'where':{'messageId':_0x213c1c[_0x1a46('0x5f')]['statuses'][0x0][_0x1a46('0x85')]},'individualHooks':!![]})[_0x1a46('0x23')](function(_0x17d909){return _0xcef463['status'](0xc8)['json'](_0x17d909);});}_0x48b57b[_0x1a46('0x86')]=_[_0x1a46('0x87')](_0x3bc859[_0x1a46('0x7f')],[_0x1a46('0x7b')],[_0x1a46('0x88')]);if(_0x48b57b[_0x1a46('0x80')][_0x1a46('0x7f')]){delete _0x48b57b[_0x1a46('0x80')][_0x1a46('0x7f')];}return db[_0x1a46('0x89')]['describe']()[_0x1a46('0x23')](function(_0x15b369){if(!_0x15b369){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))](_0x1a46('0x8c'));}_0x50a189=_[_0x1a46('0x8d')](_[_0x1a46('0x59')](_0x15b369),[_0x1a46('0x8e'),'updatedAt']);_0x3ffa16=_[_0x1a46('0x8d')](_[_0x1a46('0x59')](_0x15b369),[_0x1a46('0x8e'),_0x1a46('0x8f'),'CompanyId',_0x1a46('0x90')]);_0x48b57b[_0x1a46('0x5f')]={'mapKey':'mobile'};if(_0x48b57b[_0x1a46('0x80')]&&_0x48b57b[_0x1a46('0x80')][_0x1a46('0x53')]===_0x1a46('0x91')){_0x48b57b[_0x1a46('0x5f')]['from']=_0x213c1c[_0x1a46('0x5f')]['From'][_0x1a46('0x92')](_0x1a46('0x93'),'');_0x48b57b[_0x1a46('0x5f')]['body']=_0x213c1c[_0x1a46('0x5f')]['Body'];_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x94')]=_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x95')];}if(_0x48b57b['account']&&_0x48b57b[_0x1a46('0x80')][_0x1a46('0x53')]==='sinch'){_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x96')]=_0x213c1c[_0x1a46('0x5f')]['notifications'][0x0][_0x1a46('0x96')];_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x5f')]=_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x97')][0x0][_0x1a46('0x2a')]['body'];_0x48b57b['body'][_0x1a46('0x94')]=_0x213c1c[_0x1a46('0x5f')][_0x1a46('0x97')][0x0][_0x1a46('0x85')];}if(_0x48b57b[_0x1a46('0x5f')]['id']){delete _0x48b57b[_0x1a46('0x5f')]['id'];}if(_[_0x1a46('0x98')](_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x96')])){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))]('from\x20is\x20mandatory');}if(_[_0x1a46('0x98')](_0x48b57b[_0x1a46('0x5f')]['body'])||_0x48b57b['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x1a46('0x99'));}if(_[_0x1a46('0x98')](_0x48b57b[_0x1a46('0x5f')]['mapKey'])){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))](_0x1a46('0x9a')+_0x3ffa16);}if(!_[_0x1a46('0x9b')](_0x3ffa16,_0x48b57b['body']['mapKey'])){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ffa16);}_0x2bd37f[_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x9c')]]=_0x48b57b['body'][_0x1a46('0x96')];return db[_0x1a46('0x9d')]['find']({'where':{'id':_0x48b57b[_0x1a46('0x80')][_0x1a46('0x90')]},'include':[{'model':db[_0x1a46('0x89')],'as':_0x1a46('0x9e'),'where':_0x2bd37f,'limit':0x1,'order':[[_0x1a46('0x8f'),'DESC']]}]});})[_0x1a46('0x23')](handleEntityNotFound(_0xcef463,null))['then'](function(_0x1d1295){if(_0x1d1295){_0x48b57b['list']=_[_0x1a46('0x6f')](_0x1d1295,[_0x1a46('0x9e')]);if(_0x1d1295['Contacts'][_0x1a46('0x5a')]){return _0x1d1295[_0x1a46('0x9e')][0x0];}var _0x58f694=_[_0x1a46('0x1c')](_0x48b57b[_0x1a46('0x5f')],{'firstName':_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x96')],'ListId':_0x1d1295['id']});_0x58f694[_0x48b57b[_0x1a46('0x5f')]['mapKey']]=_0x48b57b[_0x1a46('0x5f')]['from'];return db[_0x1a46('0x89')][_0x1a46('0x5e')](_0x58f694,{'fields':_0x50a189,'raw':!![]});}})['then'](handleEntityNotFound(_0xcef463,null))[_0x1a46('0x23')](function(_0x16bf3b){if(_0x16bf3b){_0x48b57b[_0x1a46('0x9f')]=_0x16bf3b;var _0x46778e={'ContactId':_0x16bf3b['id'],'phone':_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x96')],'WhatsappAccountId':_0x213c1c[_0x1a46('0x58')]['id']};var _0x154537={'ContactId':_0x16bf3b['id'],'WhatsappAccountId':_0x213c1c[_0x1a46('0x58')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x1a46('0x5d')]({'where':_0x154537})[_0x1a46('0x23')](function(_0xbedc85){if(_0xbedc85){return[_0xbedc85,![]];}return db[_0x1a46('0xa0')][_0x1a46('0x5e')](_0x46778e)[_0x1a46('0x23')](function(_0x50d7c7){return[_0x50d7c7,!![]];});});}})['spread'](function(_0x231c8b,_0x2bb21e){_0x48b57b[_0x1a46('0xa1')]=_0x231c8b[_0x1a46('0x39')]({'plain':!![]});_0x48b57b[_0x1a46('0xa1')][_0x1a46('0xa2')]=![];if(_0x2bb21e){if(_0x48b57b[_0x1a46('0x80')][_0x1a46('0xa3')]){_0x48b57b[_0x1a46('0x86')][_0x1a46('0xa4')]({'id':0x0,'priority':_0x48b57b[_0x1a46('0x86')][_0x1a46('0x5a')]+0x1,'app':_0x1a46('0xa5'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x48b57b['interaction'][_0x1a46('0xa2')]=!![];}return db[_0x1a46('0xa6')][_0x1a46('0x5e')]({'phone':_0x48b57b[_0x1a46('0x5f')]['from'],'messageId':_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x94')],'body':_0x48b57b[_0x1a46('0x5f')][_0x1a46('0x5f')],'WhatsappAccountId':_0x213c1c[_0x1a46('0x58')]['id'],'WhatsappInteractionId':_0x231c8b['id'],'direction':'in','ContactId':_0x231c8b['ContactId'],'AttachmentId':_0x48b57b[_0x1a46('0x5f')][_0x1a46('0xa7')]});})[_0x1a46('0x23')](function(_0x1f62e5){_0x48b57b['message']=_0x1f62e5;if(_0x48b57b[_0x1a46('0xa1')]['UserId']){return db[_0x1a46('0xa8')][_0x1a46('0x5d')]({'attributes':['id',_0x1a46('0x3d')],'where':{'id':_0x48b57b[_0x1a46('0xa1')][_0x1a46('0xa9')]}})['then'](function(_0x4485a3){if(_0x4485a3){_0x48b57b[_0x1a46('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1a46('0xaa'),'appdata':_0x4485a3['name']+','+(_0x48b57b[_0x1a46('0x80')][_0x1a46('0xab')]||0xa),'interval':_0x1a46('0xac')});}return respondWithRpcPromise(_0x1a46('0xad'),_0x1a46('0xae'),_0x48b57b);});}return respondWithRpcPromise(_0x1a46('0xad'),_0x1a46('0xae'),_0x48b57b);})[_0x1a46('0x23')](function(_0x30dd5a){if(_0x30dd5a){var _0x2711da=0xc8;var _0x6e1880=_0x1a46('0xaf');logger[_0x1a46('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6e1880,_0x2711da,_0x1a46('0xb0'));logger[_0x1a46('0xb1')](_0x1a46('0xb2'),_0x6e1880,_0x2711da,_0x1a46('0xb0'),JSON[_0x1a46('0x28')](_0x30dd5a));if(_0x48b57b['account'][_0x1a46('0x53')]===_0x1a46('0x91')){return _0xcef463[_0x1a46('0x2d')](_0x2711da)[_0x1a46('0x34')](_0x1a46('0xb3'),'text/xml')[_0x1a46('0x3e')](_0x1a46('0xb4'));}else{return _0xcef463[_0x1a46('0x2d')](_0x2711da)[_0x1a46('0x2f')](_0x30dd5a);}}});})[_0x1a46('0x2b')](handleError(_0xcef463,null));};exports[_0x1a46('0x3e')]=function(_0x277f30,_0xe5433f,_0x5bdce8){var _0x294d91,_0x29a541,_0x541a68;if(_[_0x1a46('0x98')](_0x277f30[_0x1a46('0x5f')][_0x1a46('0x5f')])||_0x277f30['body']['body']===''){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1a46('0x98')](_0x277f30[_0x1a46('0x5f')]['to'])){throw new db[(_0x1a46('0x8a'))][(_0x1a46('0x8b'))](_0x1a46('0xb5'));}_0x294d91=_0x277f30[_0x1a46('0x5f')]['to'];return db[_0x1a46('0x42')]['find']({'where':{'id':_0x277f30[_0x1a46('0x58')]['id']},'include':[{'model':db[_0x1a46('0x9d')],'as':_0x1a46('0xb6'),'include':[{'model':db[_0x1a46('0x89')],'as':_0x1a46('0x9e'),'where':{'mobile':_0x294d91},'limit':0x1,'order':[[_0x1a46('0x8f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xe5433f,null))[_0x1a46('0x23')](function(_0x1c9fbf){if(_0x1c9fbf&&_0x1c9fbf['List']){_0x29a541=_0x1c9fbf[_0x1a46('0x39')]({'plain':!![]});if(_0x29a541[_0x1a46('0xb6')]&&_0x29a541[_0x1a46('0xb6')][_0x1a46('0x9e')][_0x1a46('0x5a')]){return _0x29a541['List'][_0x1a46('0x9e')][0x0];}return db[_0x1a46('0x89')][_0x1a46('0x5e')](_[_0x1a46('0x1c')](_0x277f30[_0x1a46('0x5f')],{'firstName':_0x294d91,'mobile':_0x294d91,'phone':_0x294d91,'ListId':_0x29a541['ListId']}));}})[_0x1a46('0x23')](handleEntityNotFound(_0xe5433f,null))[_0x1a46('0x23')](function(_0x52ca8f){if(_0x52ca8f){_0x541a68=_0x52ca8f;return db[_0x1a46('0xa0')][_0x1a46('0x5d')]({'where':{'ContactId':_0x541a68['id'],'closed':![],'WhatsappAccountId':_0x29a541['id']}})[_0x1a46('0x23')](function(_0x8acc63){if(_0x8acc63){return[_0x8acc63,![]];}return db['WhatsappInteraction'][_0x1a46('0x5e')]({'UserId':_0x277f30[_0x1a46('0x60')]['id'],'ContactId':_0x541a68['id'],'WhatsappAccountId':_0x29a541['id'],'phone':_0x294d91,'firstMsgDirection':_0x1a46('0xb7'),'Messages':[_['merge'](_0x277f30['body'],{'read':![],'body':_0x277f30[_0x1a46('0x5f')]['body'],'phone':_0x294d91,'WhatsappAccountId':_0x29a541['id'],'UserId':_0x277f30[_0x1a46('0x60')]['id'],'ContactId':_0x541a68['id']})]},{'include':[{'model':db[_0x1a46('0xa6')],'as':_0x1a46('0xb8')}]})['then'](function(_0x34e257){return[_0x34e257,!![]];});});}})[_0x1a46('0x70')](function(_0x54d519,_0x4201a4){if(_0x4201a4){return _0x54d519;}return db['WhatsappMessage']['create'](_[_0x1a46('0x52')](_0x277f30[_0x1a46('0x5f')],{'read':![],'body':_0x277f30[_0x1a46('0x5f')]['body'],'phone':_0x294d91,'WhatsappAccountId':_0x29a541['id'],'WhatsappInteractionId':_0x54d519['id'],'UserId':_0x277f30['user']['id'],'ContactId':_0x541a68['id']}))[_0x1a46('0x23')](function(_0x42f385){_0x54d519[_0x1a46('0xb9')][_0x1a46('0xb8')]=[];_0x54d519[_0x1a46('0xb9')][_0x1a46('0xb8')]['push'](_0x42f385[_0x1a46('0xb9')]);return _0x54d519;});})[_0x1a46('0x23')](respondWithResult(_0xe5433f,null))[_0x1a46('0x2b')](handleError(_0xe5433f,null));}; \ No newline at end of file +var _0x283d=['ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','getAgents','User','order','sequelize','transaction','WhatsappApplication','priority','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','message_id','asc','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','applications','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','map','WhatsappAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','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','params','describe','addDisposition','Disposition','pick','removeDispositions','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','findOne','removeAnswers'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x283d,0x1d1));var _0xd283=function(_0x480526,_0x39dc56){_0x480526=_0x480526-0x0;var _0x572669=_0x283d[_0x480526];return _0x572669;};'use strict';var emlformat=require(_0xd283('0x0'));var rimraf=require(_0xd283('0x1'));var zipdir=require(_0xd283('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd283('0x3'));var moment=require(_0xd283('0x4'));var BPromise=require(_0xd283('0x5'));var Mustache=require(_0xd283('0x6'));var util=require(_0xd283('0x7'));var path=require(_0xd283('0x8'));var sox=require(_0xd283('0x9'));var csv=require(_0xd283('0xa'));var ejs=require(_0xd283('0xb'));var fs=require('fs');var fs_extra=require(_0xd283('0xc'));var _=require(_0xd283('0xd'));var squel=require(_0xd283('0xe'));var crypto=require(_0xd283('0xf'));var jsforce=require(_0xd283('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd283('0xa'));var querystring=require('querystring');var Papa=require(_0xd283('0x11'));var Redis=require(_0xd283('0x12'));var authService=require(_0xd283('0x13'));var qs=require(_0xd283('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd283('0x15'));var logger=require('../../config/logger')(_0xd283('0x16'));var utils=require(_0xd283('0x17'));var config=require(_0xd283('0x18'));var licenseUtil=require(_0xd283('0x19'));var db=require(_0xd283('0x1a'))['db'];config[_0xd283('0x1b')]=_[_0xd283('0x1c')](config[_0xd283('0x1b')],{'host':_0xd283('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd283('0x1e'))[_0xd283('0x1f')](socket);var jayson=require(_0xd283('0x20'));var client=jayson[_0xd283('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1aeecb,_0x1b39db,_0x26dc3c,_0x17f328){return new BPromise(function(_0x6f8b7c,_0x1c6cdd){var _0xf4d0e9=_0x17f328||client;return _0xf4d0e9['request'](_0x1aeecb,_0x26dc3c)[_0xd283('0x22')](function(_0x2b1f19){logger[_0xd283('0x23')](_0xd283('0x24'),_0x1b39db,_0xd283('0x25'));logger['debug'](_0xd283('0x26'),_0x1b39db,'request\x20sent',JSON[_0xd283('0x27')](_0x2b1f19));if(_0x2b1f19[_0xd283('0x28')]){if(_0x2b1f19[_0xd283('0x28')][_0xd283('0x29')]===0x1f4){logger[_0xd283('0x28')](_0xd283('0x24'),_0x1b39db,_0x2b1f19['error']['message']);return _0x1c6cdd(_0x2b1f19['error'][_0xd283('0x2a')]);}logger[_0xd283('0x28')](_0xd283('0x24'),_0x1b39db,_0x2b1f19[_0xd283('0x28')][_0xd283('0x2a')]);return _0x6f8b7c(_0x2b1f19['error'][_0xd283('0x2a')]);}else{logger[_0xd283('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x1b39db,_0xd283('0x25'));_0x6f8b7c(_0x2b1f19[_0xd283('0x2b')][_0xd283('0x2a')]);}})[_0xd283('0x2c')](function(_0x520cb3){logger[_0xd283('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x1b39db,_0x520cb3);_0x1c6cdd(_0x520cb3);});});}function respondWithStatusCode(_0x11517a,_0xaf3c3f){_0xaf3c3f=_0xaf3c3f||0xcc;return function(_0x3cec75){if(_0x3cec75){return _0x11517a['sendStatus'](_0xaf3c3f);}return _0x11517a[_0xd283('0x2d')](_0xaf3c3f)[_0xd283('0x2e')]();};}function respondWithResult(_0x277832,_0x15dd2c){_0x15dd2c=_0x15dd2c||0xc8;return function(_0x18dd46){if(_0x18dd46){return _0x277832[_0xd283('0x2d')](_0x15dd2c)[_0xd283('0x2f')](_0x18dd46);}};}function respondWithFilteredResult(_0x14c3d5,_0x43377d){return function(_0x3bae3b){if(_0x3bae3b){var _0x24504a=typeof _0x43377d[_0xd283('0x30')]==='undefined'&&typeof _0x43377d[_0xd283('0x31')]==='undefined';var _0x55c7ae=_0x3bae3b['count'];var _0x3abc16=_0x24504a?0x0:_0x43377d['offset'];var _0x50a26b=_0x24504a?_0x3bae3b['count']:_0x43377d[_0xd283('0x30')]+_0x43377d[_0xd283('0x31')];var _0x4694a7;if(_0x50a26b>=_0x55c7ae){_0x50a26b=_0x55c7ae;_0x4694a7=0xc8;}else{_0x4694a7=0xce;}_0x14c3d5[_0xd283('0x2d')](_0x4694a7);return _0x14c3d5['set'](_0xd283('0x32'),_0x3abc16+'-'+_0x50a26b+'/'+_0x55c7ae)[_0xd283('0x2f')](_0x3bae3b);}return null;};}function patchUpdates(_0x2d606d){return function(_0x148d54){try{jsonpatch[_0xd283('0x33')](_0x148d54,_0x2d606d,!![]);}catch(_0x12bf01){return BPromise[_0xd283('0x34')](_0x12bf01);}return _0x148d54[_0xd283('0x35')]();};}function saveUpdates(_0x3dba4c,_0x206f5f){return function(_0xe9a271){if(_0xe9a271){return _0xe9a271[_0xd283('0x36')](_0x3dba4c)[_0xd283('0x22')](function(_0x24c23d){return _0x24c23d;});}return null;};}function removeEntity(_0x1f0aee,_0x4f1fa3){return function(_0x1bc87c){if(_0x1bc87c){return _0x1bc87c[_0xd283('0x37')]()[_0xd283('0x22')](function(){var _0x4ae074=_0x1bc87c[_0xd283('0x38')]({'plain':!![]});var _0x133f3a=_0xd283('0x39');return db[_0xd283('0x3a')][_0xd283('0x37')]({'where':{'type':_0x133f3a,'resourceId':_0x4ae074['id']}})[_0xd283('0x22')](function(){return _0x1bc87c;});})['then'](function(){_0x1f0aee[_0xd283('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269689,_0x4fa3b0){return function(_0x68fef9){if(!_0x68fef9){_0x269689[_0xd283('0x3b')](0x194);}return _0x68fef9;};}function handleError(_0x5b6a39,_0x380dae){_0x380dae=_0x380dae||0x1f4;return function(_0x2f5352){logger[_0xd283('0x28')](_0x2f5352[_0xd283('0x3c')]);if(_0x2f5352[_0xd283('0x3d')]){delete _0x2f5352[_0xd283('0x3d')];}_0x5b6a39[_0xd283('0x2d')](_0x380dae)['send'](_0x2f5352);};}exports[_0xd283('0x3e')]=function(_0x560c2b,_0x435843){var _0x242961={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x534165={},_0x5992ce={'count':0x0,'rows':[]};var _0x516bef=_[_0xd283('0x3f')](db[_0xd283('0x40')]['rawAttributes'],function(_0x588908){return{'name':_0x588908[_0xd283('0x41')],'type':_0x588908[_0xd283('0x42')]['key']};});_0x534165[_0xd283('0x43')]=_[_0xd283('0x3f')](_0x516bef,_0xd283('0x3d'));_0x534165[_0xd283('0x44')]=_[_0xd283('0x45')](_0x560c2b['query']);_0x534165[_0xd283('0x46')]=_[_0xd283('0x47')](_0x534165[_0xd283('0x43')],_0x534165[_0xd283('0x44')]);_0x242961[_0xd283('0x48')]=_[_0xd283('0x47')](_0x534165[_0xd283('0x43')],qs[_0xd283('0x49')](_0x560c2b[_0xd283('0x44')][_0xd283('0x49')]));_0x242961[_0xd283('0x48')]=_0x242961['attributes'][_0xd283('0x4a')]?_0x242961[_0xd283('0x48')]:_0x534165['model'];if(!_0x560c2b[_0xd283('0x44')][_0xd283('0x4b')](_0xd283('0x4c'))){_0x242961[_0xd283('0x31')]=qs[_0xd283('0x31')](_0x560c2b[_0xd283('0x44')]['limit']);_0x242961[_0xd283('0x30')]=qs['offset'](_0x560c2b[_0xd283('0x44')][_0xd283('0x30')]);}_0x242961['order']=qs[_0xd283('0x4d')](_0x560c2b[_0xd283('0x44')][_0xd283('0x4d')]);_0x242961['where']=qs['filters'](_['pick'](_0x560c2b['query'],_0x534165[_0xd283('0x46')]),_0x516bef);if(_0x560c2b[_0xd283('0x44')][_0xd283('0x4e')]){_0x242961[_0xd283('0x4f')]=_[_0xd283('0x50')](_0x242961[_0xd283('0x4f')],{'$or':_[_0xd283('0x3f')](_0x516bef,function(_0x71fea2){if(_0x71fea2[_0xd283('0x42')]!==_0xd283('0x51')){var _0x2d0188={};_0x2d0188[_0x71fea2[_0xd283('0x3d')]]={'$like':'%'+_0x560c2b[_0xd283('0x44')]['filter']+'%'};return _0x2d0188;}})});}_0x242961=_[_0xd283('0x50')]({},_0x242961,_0x560c2b[_0xd283('0x52')]);var _0x27df53={'where':_0x242961['where']};return db[_0xd283('0x40')][_0xd283('0x53')](_0x27df53)['then'](function(_0x5e53bf){_0x5992ce[_0xd283('0x53')]=_0x5e53bf;if(_0x560c2b['query'][_0xd283('0x54')]){_0x242961[_0xd283('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xd283('0x56')](_0x242961);})[_0xd283('0x22')](function(_0x2c5bfe){_0x5992ce[_0xd283('0x57')]=_0x2c5bfe;return _0x5992ce;})['then'](respondWithFilteredResult(_0x435843,_0x242961))[_0xd283('0x2c')](handleError(_0x435843,null));};exports[_0xd283('0x58')]=function(_0x4f3f69,_0x2eeb0b){var _0x551efb={'raw':![],'where':{'id':_0x4f3f69['params']['id']},'include':[{'model':db[_0xd283('0x59')],'as':_0xd283('0x5a')}]},_0x76a5ff={};_0x76a5ff[_0xd283('0x43')]=_[_0xd283('0x45')](db[_0xd283('0x40')][_0xd283('0x5b')]);_0x76a5ff[_0xd283('0x44')]=_[_0xd283('0x45')](_0x4f3f69[_0xd283('0x44')]);_0x76a5ff['filters']=_[_0xd283('0x47')](_0x76a5ff[_0xd283('0x43')],_0x76a5ff[_0xd283('0x44')]);_0x551efb[_0xd283('0x48')]=_[_0xd283('0x47')](_0x76a5ff[_0xd283('0x43')],qs[_0xd283('0x49')](_0x4f3f69['query'][_0xd283('0x49')]));_0x551efb[_0xd283('0x48')]=_0x551efb[_0xd283('0x48')][_0xd283('0x4a')]?_0x551efb['attributes']:_0x76a5ff[_0xd283('0x43')];if(_0x4f3f69[_0xd283('0x44')][_0xd283('0x54')]){_0x551efb[_0xd283('0x55')]=[{'all':!![]}];}_0x551efb=_[_0xd283('0x50')]({},_0x551efb,_0x4f3f69[_0xd283('0x52')]);return db[_0xd283('0x40')][_0xd283('0x5c')](_0x551efb)['then'](handleEntityNotFound(_0x2eeb0b,null))[_0xd283('0x22')](respondWithResult(_0x2eeb0b,null))[_0xd283('0x2c')](handleError(_0x2eeb0b,null));};exports[_0xd283('0x5d')]=function(_0x5671db,_0xb266fe){return db[_0xd283('0x40')][_0xd283('0x5d')](_0x5671db[_0xd283('0x5e')],{})[_0xd283('0x22')](function(_0x487ddd){var _0x3b2f00=_0x5671db['user'][_0xd283('0x38')]({'plain':!![]});if(!_0x3b2f00)throw new Error(_0xd283('0x5f'));if(_0x3b2f00[_0xd283('0x60')]===_0xd283('0x61')){var _0x203ddf=_0x487ddd[_0xd283('0x38')]({'plain':!![]});var _0x242862=_0xd283('0x39');return db[_0xd283('0x62')][_0xd283('0x5c')]({'where':{'name':_0x242862,'userProfileId':_0x3b2f00[_0xd283('0x63')]},'raw':!![]})[_0xd283('0x22')](function(_0x491348){if(_0x491348&&_0x491348[_0xd283('0x64')]===0x0){return db[_0xd283('0x3a')][_0xd283('0x5d')]({'name':_0x203ddf['name'],'resourceId':_0x203ddf['id'],'type':_0x491348[_0xd283('0x3d')],'sectionId':_0x491348['id']},{})[_0xd283('0x22')](function(){return _0x487ddd;});}else{return _0x487ddd;}})[_0xd283('0x2c')](function(_0x449bd8){logger[_0xd283('0x28')](_0xd283('0x65'),_0x449bd8);throw _0x449bd8;});}return _0x487ddd;})[_0xd283('0x22')](respondWithResult(_0xb266fe,0xc9))[_0xd283('0x2c')](handleError(_0xb266fe,null));};exports['update']=function(_0x53c326,_0x49da66){if(_0x53c326['body']['id']){delete _0x53c326['body']['id'];}return db['WhatsappAccount'][_0xd283('0x5c')]({'where':{'id':_0x53c326[_0xd283('0x66')]['id']},'include':[{'model':db[_0xd283('0x59')],'as':'mandatoryDispositionPause'}]})[_0xd283('0x22')](handleEntityNotFound(_0x49da66,null))[_0xd283('0x22')](saveUpdates(_0x53c326['body'],null))['then'](respondWithResult(_0x49da66,null))[_0xd283('0x2c')](handleError(_0x49da66,null));};exports['destroy']=function(_0xfbae4b,_0x5726ad){return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0xfbae4b[_0xd283('0x66')]['id']}})['then'](handleEntityNotFound(_0x5726ad,null))[_0xd283('0x22')](removeEntity(_0x5726ad,null))['catch'](handleError(_0x5726ad,null));};exports[_0xd283('0x67')]=function(_0x23c41b,_0x4f681f){return db[_0xd283('0x40')]['describe']()[_0xd283('0x22')](respondWithResult(_0x4f681f,null))[_0xd283('0x2c')](handleError(_0x4f681f,null));};exports[_0xd283('0x68')]=function(_0x47791d,_0xadb1f0,_0x43cbc5){if(_0x47791d[_0xd283('0x5e')]['id']){delete _0x47791d[_0xd283('0x5e')]['id'];}return db[_0xd283('0x40')]['find']({'where':{'id':_0x47791d[_0xd283('0x66')]['id']}})[_0xd283('0x22')](handleEntityNotFound(_0xadb1f0,null))['then'](function(_0x1723ba){if(_0x1723ba){_0x47791d[_0xd283('0x5e')]['WhatsappAccountId']=_0x1723ba['id'];return db[_0xd283('0x69')][_0xd283('0x5d')](_0x47791d['body']);}})['then'](respondWithResult(_0xadb1f0,null))[_0xd283('0x2c')](handleError(_0xadb1f0,null));};exports['getDispositions']=function(_0x250102,_0x16bf75,_0x5245d1){var _0x2cfe67={'raw':![],'where':{}};var _0x3d1ea8={};var _0x3896bb={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x250102[_0xd283('0x66')]['id']}})[_0xd283('0x22')](handleEntityNotFound(_0x16bf75,null))[_0xd283('0x22')](function(_0x282e0b){if(_0x282e0b){_0x3d1ea8[_0xd283('0x43')]=_[_0xd283('0x45')](db[_0xd283('0x69')][_0xd283('0x5b')]);_0x3d1ea8[_0xd283('0x44')]=_[_0xd283('0x45')](_0x250102[_0xd283('0x44')]);_0x3d1ea8[_0xd283('0x46')]=_[_0xd283('0x47')](_0x3d1ea8[_0xd283('0x43')],_0x3d1ea8[_0xd283('0x44')]);_0x2cfe67[_0xd283('0x48')]=_['intersection'](_0x3d1ea8[_0xd283('0x43')],qs[_0xd283('0x49')](_0x250102[_0xd283('0x44')][_0xd283('0x49')]));_0x2cfe67[_0xd283('0x48')]=_0x2cfe67[_0xd283('0x48')][_0xd283('0x4a')]?_0x2cfe67['attributes']:_0x3d1ea8[_0xd283('0x43')];if(!_0x250102['query'][_0xd283('0x4b')](_0xd283('0x4c'))){_0x2cfe67[_0xd283('0x31')]=qs[_0xd283('0x31')](_0x250102['query'][_0xd283('0x31')]);_0x2cfe67[_0xd283('0x30')]=qs['offset'](_0x250102[_0xd283('0x44')][_0xd283('0x30')]);}_0x2cfe67['order']=qs[_0xd283('0x4d')](_0x250102[_0xd283('0x44')]['sort']);_0x2cfe67[_0xd283('0x4f')]=qs[_0xd283('0x46')](_[_0xd283('0x6a')](_0x250102['query'],_0x3d1ea8['filters']));_0x2cfe67['where']['WhatsappAccountId']=_0x282e0b['id'];if(_0x250102[_0xd283('0x44')]['filter']){_0x2cfe67[_0xd283('0x4f')]=_['merge'](_0x2cfe67[_0xd283('0x4f')],{'$or':_[_0xd283('0x3f')](_0x2cfe67[_0xd283('0x48')],function(_0x424a96){var _0x3c9175={};_0x3c9175[_0x424a96]={'$like':'%'+_0x250102['query']['filter']+'%'};return _0x3c9175;})});}_0x2cfe67=_[_0xd283('0x50')]({},_0x2cfe67,_0x250102[_0xd283('0x52')]);return db[_0xd283('0x69')]['count']({'where':_0x2cfe67[_0xd283('0x4f')]})['then'](function(_0x4f160e){_0x3896bb['count']=_0x4f160e;if(_0x250102[_0xd283('0x44')]['includeAll']){_0x2cfe67['include']=[{'all':!![]}];}return db[_0xd283('0x69')][_0xd283('0x56')](_0x2cfe67);})[_0xd283('0x22')](function(_0x374065){_0x3896bb['rows']=_0x374065;return _0x3896bb;});}})[_0xd283('0x22')](respondWithFilteredResult(_0x16bf75,_0x2cfe67))[_0xd283('0x2c')](handleError(_0x16bf75,null));};exports[_0xd283('0x6b')]=function(_0x4b182a,_0x1dc54d,_0x1d1595){return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0x4b182a[_0xd283('0x66')]['id']}})[_0xd283('0x22')](handleEntityNotFound(_0x1dc54d,null))['then'](function(_0x1d5b4a){if(_0x1d5b4a){return _0x1d5b4a[_0xd283('0x6b')](_0x4b182a[_0xd283('0x44')]['ids']);}})[_0xd283('0x22')](respondWithStatusCode(_0x1dc54d,null))[_0xd283('0x2c')](handleError(_0x1dc54d,null));};exports[_0xd283('0x6c')]=function(_0x47d9a5,_0x45a6d2,_0xa828bb){if(_0x47d9a5[_0xd283('0x5e')]['id']){delete _0x47d9a5[_0xd283('0x5e')]['id'];}return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0x47d9a5['params']['id']}})[_0xd283('0x22')](handleEntityNotFound(_0x45a6d2,null))[_0xd283('0x22')](function(_0x31e6d0){if(_0x31e6d0){_0x47d9a5['body'][_0xd283('0x6d')]=_0x31e6d0['id'];return db[_0xd283('0x6e')][_0xd283('0x5d')](_0x47d9a5['body']);}})[_0xd283('0x22')](respondWithResult(_0x45a6d2,null))[_0xd283('0x2c')](handleError(_0x45a6d2,null));};exports[_0xd283('0x6f')]=function(_0x5c1bd8,_0x4f0530,_0x47b12f){var _0x1ac6f6={'raw':![],'where':{}};var _0x248b95={};var _0x41893e={'count':0x0,'rows':[]};return db[_0xd283('0x40')][_0xd283('0x70')]({'where':{'id':_0x5c1bd8[_0xd283('0x66')]['id']}})['then'](handleEntityNotFound(_0x4f0530,null))[_0xd283('0x22')](function(_0x5c727c){if(_0x5c727c){_0x248b95['model']=_[_0xd283('0x45')](db[_0xd283('0x6e')]['rawAttributes']);_0x248b95[_0xd283('0x44')]=_[_0xd283('0x45')](_0x5c1bd8['query']);_0x248b95[_0xd283('0x46')]=_[_0xd283('0x47')](_0x248b95[_0xd283('0x43')],_0x248b95[_0xd283('0x44')]);_0x1ac6f6['attributes']=_['intersection'](_0x248b95[_0xd283('0x43')],qs['fields'](_0x5c1bd8[_0xd283('0x44')][_0xd283('0x49')]));_0x1ac6f6[_0xd283('0x48')]=_0x1ac6f6[_0xd283('0x48')]['length']?_0x1ac6f6[_0xd283('0x48')]:_0x248b95[_0xd283('0x43')];if(!_0x5c1bd8[_0xd283('0x44')][_0xd283('0x4b')](_0xd283('0x4c'))){_0x1ac6f6['limit']=qs[_0xd283('0x31')](_0x5c1bd8[_0xd283('0x44')][_0xd283('0x31')]);_0x1ac6f6[_0xd283('0x30')]=qs['offset'](_0x5c1bd8[_0xd283('0x44')][_0xd283('0x30')]);}_0x1ac6f6['order']=qs['sort'](_0x5c1bd8[_0xd283('0x44')][_0xd283('0x4d')]);_0x1ac6f6[_0xd283('0x4f')]=qs[_0xd283('0x46')](_[_0xd283('0x6a')](_0x5c1bd8[_0xd283('0x44')],_0x248b95[_0xd283('0x46')]));_0x1ac6f6[_0xd283('0x4f')]['WhatsappAccountId']=_0x5c727c['id'];if(_0x5c1bd8[_0xd283('0x44')][_0xd283('0x4e')]){_0x1ac6f6[_0xd283('0x4f')]=_[_0xd283('0x50')](_0x1ac6f6[_0xd283('0x4f')],{'$or':_['map'](_0x1ac6f6[_0xd283('0x48')],function(_0x38477e){var _0x3bf9ca={};_0x3bf9ca[_0x38477e]={'$like':'%'+_0x5c1bd8['query'][_0xd283('0x4e')]+'%'};return _0x3bf9ca;})});}_0x1ac6f6=_[_0xd283('0x50')]({},_0x1ac6f6,_0x5c1bd8[_0xd283('0x52')]);return db[_0xd283('0x6e')][_0xd283('0x53')]({'where':_0x1ac6f6[_0xd283('0x4f')]})[_0xd283('0x22')](function(_0x4eafd1){_0x41893e[_0xd283('0x53')]=_0x4eafd1;if(_0x5c1bd8[_0xd283('0x44')]['includeAll']){_0x1ac6f6['include']=[{'all':!![]}];}return db[_0xd283('0x6e')]['findAll'](_0x1ac6f6);})['then'](function(_0xb1b733){_0x41893e[_0xd283('0x57')]=_0xb1b733;return _0x41893e;});}})[_0xd283('0x22')](respondWithFilteredResult(_0x4f0530,_0x1ac6f6))[_0xd283('0x2c')](handleError(_0x4f0530,null));};exports['removeAnswers']=function(_0x2b2e1e,_0x6abc95,_0x223bf9){return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0x2b2e1e[_0xd283('0x66')]['id']}})['then'](handleEntityNotFound(_0x6abc95,null))[_0xd283('0x22')](function(_0x126985){if(_0x126985){return _0x126985[_0xd283('0x71')](_0x2b2e1e['query'][_0xd283('0x72')]);}})['then'](respondWithStatusCode(_0x6abc95,null))[_0xd283('0x2c')](handleError(_0x6abc95,null));};exports[_0xd283('0x73')]=function(_0x11217a,_0xb6c36f,_0xb2a669){return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0x11217a[_0xd283('0x66')]['id']}})[_0xd283('0x22')](handleEntityNotFound(_0xb6c36f,null))[_0xd283('0x22')](function(_0x2e5cd4){if(_0x2e5cd4){return _0x2e5cd4[_0xd283('0x73')](_0x11217a[_0xd283('0x5e')][_0xd283('0x72')],_[_0xd283('0x74')](_0x11217a[_0xd283('0x5e')],[_0xd283('0x72'),'id'])||{})[_0xd283('0x75')](function(_0x3f46f3){for(var _0x2b90e3=0x0;_0x2b90e3<_0x11217a[_0xd283('0x5e')]['ids'][_0xd283('0x4a')];_0x2b90e3+=0x1){socket['emit'](_0xd283('0x76'),{'UserId':Number(_0x11217a[_0xd283('0x5e')][_0xd283('0x72')][_0x2b90e3]),'WhatsappAccountId':Number(_0x11217a['params']['id'])});}return _0x3f46f3;});}})[_0xd283('0x22')](respondWithResult(_0xb6c36f,null))['catch'](handleError(_0xb6c36f,null));};exports[_0xd283('0x77')]=function(_0x5dd174,_0x986df3,_0x449a90){return db['WhatsappAccount'][_0xd283('0x5c')]({'where':{'id':_0x5dd174[_0xd283('0x66')]['id']}})[_0xd283('0x22')](handleEntityNotFound(_0x986df3,null))['then'](function(_0x5f274c){if(_0x5f274c){return _0x5f274c[_0xd283('0x77')](_0x5dd174['query'][_0xd283('0x72')])['then'](function(){if(_[_0xd283('0x78')](_0x5dd174[_0xd283('0x44')]['ids'])){for(var _0x42901e=0x0;_0x42901e<_0x5dd174['query']['ids'][_0xd283('0x4a')];_0x42901e+=0x1){socket[_0xd283('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x5dd174[_0xd283('0x44')]['ids'][_0x42901e]),'WhatsappAccountId':Number(_0x5dd174[_0xd283('0x66')]['id'])});}}else{socket[_0xd283('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x5dd174[_0xd283('0x44')]['ids']),'WhatsappAccountId':Number(_0x5dd174['params']['id'])});}});}})[_0xd283('0x22')](respondWithStatusCode(_0x986df3,null))[_0xd283('0x2c')](handleError(_0x986df3,null));};exports[_0xd283('0x7a')]=function(_0x2ae7fb,_0x2c9596,_0x40d84d){var _0x4e6d74={};var _0x1b9e32={};var _0x5aaf1a;var _0x21c05c;return db[_0xd283('0x40')][_0xd283('0x70')]({'where':{'id':_0x2ae7fb[_0xd283('0x66')]['id']}})['then'](handleEntityNotFound(_0x2c9596,null))[_0xd283('0x22')](function(_0x453817){if(_0x453817){_0x5aaf1a=_0x453817;_0x1b9e32[_0xd283('0x43')]=_['keys'](db[_0xd283('0x7b')][_0xd283('0x5b')]);_0x1b9e32[_0xd283('0x44')]=_[_0xd283('0x45')](_0x2ae7fb['query']);_0x1b9e32[_0xd283('0x46')]=_['intersection'](_0x1b9e32[_0xd283('0x43')],_0x1b9e32[_0xd283('0x44')]);_0x4e6d74['attributes']=_['intersection'](_0x1b9e32['model'],qs['fields'](_0x2ae7fb[_0xd283('0x44')][_0xd283('0x49')]));_0x4e6d74[_0xd283('0x48')]=_0x4e6d74[_0xd283('0x48')][_0xd283('0x4a')]?_0x4e6d74[_0xd283('0x48')]:_0x1b9e32[_0xd283('0x43')];_0x4e6d74[_0xd283('0x7c')]=qs[_0xd283('0x4d')](_0x2ae7fb[_0xd283('0x44')][_0xd283('0x4d')]);_0x4e6d74[_0xd283('0x4f')]=qs['filters'](_[_0xd283('0x6a')](_0x2ae7fb[_0xd283('0x44')],_0x1b9e32['filters']));if(_0x2ae7fb[_0xd283('0x44')][_0xd283('0x4e')]){_0x4e6d74[_0xd283('0x4f')]=_[_0xd283('0x50')](_0x4e6d74[_0xd283('0x4f')],{'$or':_['map'](_0x4e6d74[_0xd283('0x48')],function(_0x460901){var _0x4f26c5={};_0x4f26c5[_0x460901]={'$like':'%'+_0x2ae7fb['query'][_0xd283('0x4e')]+'%'};return _0x4f26c5;})});}_0x4e6d74=_[_0xd283('0x50')]({},_0x4e6d74,_0x2ae7fb[_0xd283('0x52')]);return _0x5aaf1a[_0xd283('0x7a')](_0x4e6d74);}})[_0xd283('0x22')](function(_0x2b447f){if(_0x2b447f){_0x21c05c=_0x2b447f[_0xd283('0x4a')];if(!_0x2ae7fb['query'][_0xd283('0x4b')](_0xd283('0x4c'))){_0x4e6d74[_0xd283('0x31')]=qs[_0xd283('0x31')](_0x2ae7fb[_0xd283('0x44')][_0xd283('0x31')]);_0x4e6d74[_0xd283('0x30')]=qs[_0xd283('0x30')](_0x2ae7fb[_0xd283('0x44')][_0xd283('0x30')]);}return _0x5aaf1a[_0xd283('0x7a')](_0x4e6d74);}})[_0xd283('0x22')](function(_0x22bdc4){if(_0x22bdc4){return _0x22bdc4?{'count':_0x21c05c,'rows':_0x22bdc4}:null;}})[_0xd283('0x22')](respondWithResult(_0x2c9596,null))['catch'](handleError(_0x2c9596,null));};exports['addApplications']=function(_0x1c133b,_0x12b533,_0x32c26a){return db[_0xd283('0x40')][_0xd283('0x70')]({'where':{'id':_0x1c133b[_0xd283('0x66')]['id']}})['then'](handleEntityNotFound(_0x12b533,null))[_0xd283('0x22')](function(_0x19f2c6){if(_0x19f2c6){return db[_0xd283('0x7d')][_0xd283('0x7e')](function(_0x207444){return db['WhatsappApplication'][_0xd283('0x37')]({'where':{'WhatsappAccountId':_0x1c133b['params']['id']},'transaction':_0x207444})[_0xd283('0x22')](function(_0x5406dc){var _0x4180d8=_[_0xd283('0x3f')](_0x1c133b['body'],function(_0x47feb1){_0x47feb1[_0xd283('0x6d')]=_0x1c133b[_0xd283('0x66')]['id'];return _0x47feb1;});return db['WhatsappApplication']['bulkCreate'](_0x4180d8,{'transaction':_0x207444});});})[_0xd283('0x22')](function(){return db[_0xd283('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1c133b[_0xd283('0x66')]['id']},'order':_0xd283('0x80')});});}})[_0xd283('0x22')](respondWithResult(_0x12b533,null))[_0xd283('0x2c')](handleError(_0x12b533,null));};exports[_0xd283('0x81')]=function(_0x173e7e,_0x13bb96,_0x246fbf){var _0x201e59={};var _0x30ef3f={};var _0xe96eff;var _0x5db434;return db[_0xd283('0x40')]['findOne']({'where':{'id':_0x173e7e['params']['id']}})['then'](handleEntityNotFound(_0x13bb96,null))[_0xd283('0x22')](function(_0x4ddd42){if(_0x4ddd42){_0xe96eff=_0x4ddd42;_0x30ef3f['model']=_['keys'](db[_0xd283('0x7f')]['rawAttributes']);_0x30ef3f['query']=_[_0xd283('0x45')](_0x173e7e[_0xd283('0x44')]);_0x30ef3f[_0xd283('0x46')]=_[_0xd283('0x47')](_0x30ef3f[_0xd283('0x43')],_0x30ef3f[_0xd283('0x44')]);_0x201e59['attributes']=_[_0xd283('0x47')](_0x30ef3f[_0xd283('0x43')],qs[_0xd283('0x49')](_0x173e7e[_0xd283('0x44')][_0xd283('0x49')]));_0x201e59[_0xd283('0x48')]=_0x201e59[_0xd283('0x48')][_0xd283('0x4a')]?_0x201e59[_0xd283('0x48')]:_0x30ef3f[_0xd283('0x43')];_0x201e59[_0xd283('0x7c')]=qs[_0xd283('0x4d')](_0x173e7e[_0xd283('0x44')]['sort']);_0x201e59[_0xd283('0x4f')]=qs[_0xd283('0x46')](_['pick'](_0x173e7e[_0xd283('0x44')],_0x30ef3f[_0xd283('0x46')]));if(_0x173e7e[_0xd283('0x44')][_0xd283('0x4e')]){_0x201e59[_0xd283('0x4f')]=_[_0xd283('0x50')](_0x201e59[_0xd283('0x4f')],{'$or':_['map'](_0x201e59[_0xd283('0x48')],function(_0x3cd1ff){var _0x3e1f1f={};_0x3e1f1f[_0x3cd1ff]={'$like':'%'+_0x173e7e[_0xd283('0x44')][_0xd283('0x4e')]+'%'};return _0x3e1f1f;})});}_0x201e59=_[_0xd283('0x50')]({},_0x201e59,_0x173e7e[_0xd283('0x52')]);return _0xe96eff['getApplications'](_0x201e59);}})[_0xd283('0x22')](function(_0x2b6318){if(_0x2b6318){_0x5db434=_0x2b6318[_0xd283('0x4a')];if(!_0x173e7e[_0xd283('0x44')][_0xd283('0x4b')](_0xd283('0x4c'))){_0x201e59[_0xd283('0x31')]=qs[_0xd283('0x31')](_0x173e7e[_0xd283('0x44')]['limit']);_0x201e59[_0xd283('0x30')]=qs[_0xd283('0x30')](_0x173e7e[_0xd283('0x44')][_0xd283('0x30')]);}return _0xe96eff['getApplications'](_0x201e59);}})[_0xd283('0x22')](function(_0x4cc0e4){if(_0x4cc0e4){return _0x4cc0e4?{'count':_0x5db434,'rows':_0x4cc0e4}:null;}})[_0xd283('0x22')](respondWithResult(_0x13bb96,null))['catch'](handleError(_0x13bb96,null));};exports[_0xd283('0x82')]=function(_0xa952c1,_0x23997c,_0x4fb45b){var _0x4c7675={'channel':_0xd283('0x83')};var _0x541f2c=[];var _0x14d034=[];var _0x11fce8={};return db[_0xd283('0x40')][_0xd283('0x5c')]({'where':{'id':_0xa952c1['params']['id']},'include':[{'model':db[_0xd283('0x7f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x23997c,null))[_0xd283('0x22')](function(_0xf34413){_0x4c7675[_0xd283('0x84')]=_0xf34413;if(_0x4c7675['account']&&_0x4c7675['account'][_0xd283('0x42')]===_0xd283('0x85')&&_0xa952c1[_0xd283('0x5e')][_0xd283('0x86')]){if(_0xa952c1[_0xd283('0x5e')][_0xd283('0x86')]['length']===0x0)return;if(_0xa952c1[_0xd283('0x5e')][_0xd283('0x86')][0x0]['state']!==_0xd283('0x87'))return;return db[_0xd283('0x88')][_0xd283('0x36')]({'read':!![],'readAt':_0xa952c1[_0xd283('0x5e')][_0xd283('0x86')][0x0]['timestamp']},{'where':{'messageId':_0xa952c1['body'][_0xd283('0x86')][0x0][_0xd283('0x89')]},'individualHooks':!![]})[_0xd283('0x22')](function(_0x50ecd7){return _0x23997c['status'](0xc8)[_0xd283('0x2f')](_0x50ecd7);});}_0x4c7675['applications']=_['orderBy'](_0xf34413['Applications'],[_0xd283('0x80')],[_0xd283('0x8a')]);if(_0x4c7675[_0xd283('0x84')][_0xd283('0x8b')]){delete _0x4c7675['account'][_0xd283('0x8b')];}return db[_0xd283('0x8c')][_0xd283('0x67')]()[_0xd283('0x22')](function(_0x117ccb){if(!_0x117ccb){throw new db['Sequelize'][(_0xd283('0x8d'))](_0xd283('0x8e'));}_0x541f2c=_[_0xd283('0x8f')](_[_0xd283('0x45')](_0x117ccb),[_0xd283('0x90'),_0xd283('0x91')]);_0x14d034=_[_0xd283('0x8f')](_['keys'](_0x117ccb),[_0xd283('0x90'),_0xd283('0x91'),_0xd283('0x92'),_0xd283('0x93')]);_0x4c7675['body']={'mapKey':'mobile'};if(_0x4c7675[_0xd283('0x84')]&&_0x4c7675[_0xd283('0x84')]['type']===_0xd283('0x94')){_0x4c7675[_0xd283('0x5e')]['from']=_0xa952c1[_0xd283('0x5e')]['From'][_0xd283('0x95')](_0xd283('0x96'),'');_0x4c7675['body'][_0xd283('0x5e')]=_0xa952c1[_0xd283('0x5e')][_0xd283('0x97')];_0x4c7675[_0xd283('0x5e')][_0xd283('0x98')]=_0xa952c1['body'][_0xd283('0x99')];}if(_0x4c7675['account']&&_0x4c7675['account']['type']===_0xd283('0x85')){_0x4c7675['body'][_0xd283('0x9a')]=_0xa952c1['body'][_0xd283('0x9b')][0x0]['from'];_0x4c7675['body'][_0xd283('0x5e')]=_0xa952c1[_0xd283('0x5e')][_0xd283('0x9b')][0x0]['message'][_0xd283('0x5e')];_0x4c7675[_0xd283('0x5e')][_0xd283('0x98')]=_0xa952c1[_0xd283('0x5e')][_0xd283('0x9b')][0x0][_0xd283('0x89')];}if(_0x4c7675['body']['id']){delete _0x4c7675[_0xd283('0x5e')]['id'];}if(_[_0xd283('0x9c')](_0x4c7675[_0xd283('0x5e')][_0xd283('0x9a')])){throw new db[(_0xd283('0x9d'))]['ValidationError'](_0xd283('0x9e'));}if(_['isNil'](_0x4c7675[_0xd283('0x5e')][_0xd283('0x5e')])||_0x4c7675['body'][_0xd283('0x5e')]===''){throw new db[(_0xd283('0x9d'))]['ValidationError'](_0xd283('0x9f'));}if(_[_0xd283('0x9c')](_0x4c7675[_0xd283('0x5e')][_0xd283('0xa0')])){throw new db['Sequelize']['ValidationError'](_0xd283('0xa1')+_0x14d034);}if(!_['includes'](_0x14d034,_0x4c7675['body'][_0xd283('0xa0')])){throw new db[(_0xd283('0x9d'))]['ValidationError'](_0xd283('0xa2')+_0x14d034);}_0x11fce8[_0x4c7675[_0xd283('0x5e')][_0xd283('0xa0')]]=_0x4c7675['body'][_0xd283('0x9a')];return db[_0xd283('0xa3')]['find']({'where':{'id':_0x4c7675[_0xd283('0x84')][_0xd283('0x93')]},'include':[{'model':db[_0xd283('0x8c')],'as':_0xd283('0xa4'),'where':_0x11fce8,'limit':0x1,'order':[[_0xd283('0x91'),_0xd283('0xa5')]]}]});})[_0xd283('0x22')](handleEntityNotFound(_0x23997c,null))['then'](function(_0x357899){if(_0x357899){_0x4c7675[_0xd283('0xa6')]=_[_0xd283('0x74')](_0x357899,['Contacts']);if(_0x357899[_0xd283('0xa4')][_0xd283('0x4a')]){return _0x357899[_0xd283('0xa4')][0x0];}var _0xaa4109=_[_0xd283('0x1c')](_0x4c7675[_0xd283('0x5e')],{'firstName':_0x4c7675['body'][_0xd283('0x9a')],'ListId':_0x357899['id']});_0xaa4109[_0x4c7675[_0xd283('0x5e')][_0xd283('0xa0')]]=_0x4c7675[_0xd283('0x5e')][_0xd283('0x9a')];return db[_0xd283('0x8c')][_0xd283('0x5d')](_0xaa4109,{'fields':_0x541f2c,'raw':!![]});}})[_0xd283('0x22')](handleEntityNotFound(_0x23997c,null))['then'](function(_0x51a226){if(_0x51a226){_0x4c7675[_0xd283('0xa7')]=_0x51a226;var _0x5b6f5b={'ContactId':_0x51a226['id'],'phone':_0x4c7675['body'][_0xd283('0x9a')],'WhatsappAccountId':_0xa952c1[_0xd283('0x66')]['id']};var _0x373ea2={'ContactId':_0x51a226['id'],'WhatsappAccountId':_0xa952c1['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xd283('0x5c')]({'where':_0x373ea2})[_0xd283('0x22')](function(_0xa2b3d1){if(_0xa2b3d1){return[_0xa2b3d1,![]];}return db[_0xd283('0xa8')][_0xd283('0x5d')](_0x5b6f5b)[_0xd283('0x22')](function(_0x553ac7){return[_0x553ac7,!![]];});});}})[_0xd283('0x75')](function(_0x3f794a,_0xb6095f){_0x4c7675[_0xd283('0xa9')]=_0x3f794a[_0xd283('0x38')]({'plain':!![]});_0x4c7675[_0xd283('0xa9')]['created']=![];if(_0xb6095f){if(_0x4c7675[_0xd283('0x84')]['autoclose']){_0x4c7675[_0xd283('0xaa')]['push']({'id':0x0,'priority':_0x4c7675['applications'][_0xd283('0x4a')]+0x1,'app':_0xd283('0xab'),'appdata':_0xd283('0xac'),'interval':_0xd283('0xad')});}_0x4c7675['interaction'][_0xd283('0xae')]=!![];}return db['WhatsappMessage'][_0xd283('0x5d')]({'phone':_0x4c7675[_0xd283('0x5e')][_0xd283('0x9a')],'messageId':_0x4c7675[_0xd283('0x5e')][_0xd283('0x98')],'body':_0x4c7675[_0xd283('0x5e')][_0xd283('0x5e')],'WhatsappAccountId':_0xa952c1[_0xd283('0x66')]['id'],'WhatsappInteractionId':_0x3f794a['id'],'direction':'in','ContactId':_0x3f794a[_0xd283('0xaf')],'AttachmentId':_0x4c7675[_0xd283('0x5e')]['AttachmentId']});})[_0xd283('0x22')](function(_0x354e2b){_0x4c7675[_0xd283('0x2a')]=_0x354e2b;if(_0x4c7675['interaction']['UserId']){return db['User'][_0xd283('0x5c')]({'attributes':['id',_0xd283('0x3d')],'where':{'id':_0x4c7675['interaction'][_0xd283('0xb0')]}})[_0xd283('0x22')](function(_0x3d9ecf){if(_0x3d9ecf){_0x4c7675['applications'][_0xd283('0xb1')]({'id':0x0,'priority':0x0,'app':_0xd283('0xb2'),'appdata':_0x3d9ecf[_0xd283('0x3d')]+','+(_0x4c7675[_0xd283('0x84')][_0xd283('0xb3')]||0xa),'interval':_0xd283('0xad')});}return respondWithRpcPromise(_0xd283('0xb4'),_0xd283('0xb5'),_0x4c7675);});}return respondWithRpcPromise(_0xd283('0xb4'),_0xd283('0xb5'),_0x4c7675);})[_0xd283('0x22')](function(_0xffdd39){if(_0xffdd39){var _0x3470bd=0xc8;var _0x325e89='receiveMessage';logger[_0xd283('0x23')](_0xd283('0x26'),_0x325e89,_0x3470bd,'entity\x20found');logger['debug'](_0xd283('0xb6'),_0x325e89,_0x3470bd,_0xd283('0xb7'),JSON[_0xd283('0x27')](_0xffdd39));if(_0x4c7675[_0xd283('0x84')]['type']==='twilio'){return _0x23997c[_0xd283('0x2d')](_0x3470bd)['set'](_0xd283('0xb8'),_0xd283('0xb9'))[_0xd283('0xba')](_0xd283('0xbb'));}else{return _0x23997c[_0xd283('0x2d')](_0x3470bd)['json'](_0xffdd39);}}});})[_0xd283('0x2c')](handleError(_0x23997c,null));};exports['send']=function(_0x39653a,_0x1e280d,_0x45fd04){var _0x1abce1,_0x1732aa,_0x3be19f;if(_[_0xd283('0x9c')](_0x39653a[_0xd283('0x5e')][_0xd283('0x5e')])||_0x39653a[_0xd283('0x5e')][_0xd283('0x5e')]===''){throw new db['Sequelize'][(_0xd283('0x8d'))](_0xd283('0x9f'));}if(_[_0xd283('0x9c')](_0x39653a['body']['to'])){throw new db[(_0xd283('0x9d'))][(_0xd283('0x8d'))]('to\x20is\x20mandatory');}_0x1abce1=_0x39653a['body']['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x39653a[_0xd283('0x66')]['id']},'include':[{'model':db[_0xd283('0xa3')],'as':'List','include':[{'model':db[_0xd283('0x8c')],'as':_0xd283('0xa4'),'where':{'mobile':_0x1abce1},'limit':0x1,'order':[[_0xd283('0x91'),_0xd283('0xa5')]]}]}]})[_0xd283('0x22')](handleEntityNotFound(_0x1e280d,null))[_0xd283('0x22')](function(_0x556cbf){if(_0x556cbf&&_0x556cbf[_0xd283('0xbc')]){_0x1732aa=_0x556cbf[_0xd283('0x38')]({'plain':!![]});if(_0x1732aa[_0xd283('0xbc')]&&_0x1732aa[_0xd283('0xbc')][_0xd283('0xa4')][_0xd283('0x4a')]){return _0x1732aa['List']['Contacts'][0x0];}return db[_0xd283('0x8c')][_0xd283('0x5d')](_[_0xd283('0x1c')](_0x39653a[_0xd283('0x5e')],{'firstName':_0x1abce1,'mobile':_0x1abce1,'phone':_0x1abce1,'ListId':_0x1732aa[_0xd283('0x93')]}));}})[_0xd283('0x22')](handleEntityNotFound(_0x1e280d,null))['then'](function(_0x51c423){if(_0x51c423){_0x3be19f=_0x51c423;return db['WhatsappInteraction'][_0xd283('0x5c')]({'where':{'ContactId':_0x3be19f['id'],'closed':![],'WhatsappAccountId':_0x1732aa['id']}})[_0xd283('0x22')](function(_0x23b34b){if(_0x23b34b){return[_0x23b34b,![]];}return db[_0xd283('0xa8')][_0xd283('0x5d')]({'UserId':_0x39653a[_0xd283('0x61')]['id'],'ContactId':_0x3be19f['id'],'WhatsappAccountId':_0x1732aa['id'],'phone':_0x1abce1,'firstMsgDirection':_0xd283('0xbd'),'Messages':[_[_0xd283('0x50')](_0x39653a[_0xd283('0x5e')],{'read':![],'body':_0x39653a[_0xd283('0x5e')][_0xd283('0x5e')],'phone':_0x1abce1,'WhatsappAccountId':_0x1732aa['id'],'UserId':_0x39653a[_0xd283('0x61')]['id'],'ContactId':_0x3be19f['id']})]},{'include':[{'model':db[_0xd283('0x88')],'as':_0xd283('0xbe')}]})[_0xd283('0x22')](function(_0x18f960){return[_0x18f960,!![]];});});}})[_0xd283('0x75')](function(_0x452cc4,_0x5106ea){if(_0x5106ea){return _0x452cc4;}return db[_0xd283('0x88')][_0xd283('0x5d')](_['merge'](_0x39653a[_0xd283('0x5e')],{'read':![],'body':_0x39653a['body'][_0xd283('0x5e')],'phone':_0x1abce1,'WhatsappAccountId':_0x1732aa['id'],'WhatsappInteractionId':_0x452cc4['id'],'UserId':_0x39653a['user']['id'],'ContactId':_0x3be19f['id']}))[_0xd283('0x22')](function(_0x49d342){_0x452cc4['dataValues']['Messages']=[];_0x452cc4[_0xd283('0xbf')][_0xd283('0xbe')][_0xd283('0xc0')](_0x49d342['dataValues']);return _0x452cc4;});})[_0xd283('0x22')](respondWithResult(_0x1e280d,null))['catch'](handleError(_0x1e280d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6ccdf7c..b6c17b1 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 _0x397e=['update','remove','emit','events','../../mysqldb','setMaxListeners','save'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x397e,0x15a));var _0xe397=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x397e[_0x22e47a];return _0x15a12a;};'use strict';var EventEmitter=require(_0xe397('0x0'));var WhatsappAccount=require(_0xe397('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe397('0x2')](0x0);var events={'afterCreate':_0xe397('0x3'),'afterUpdate':_0xe397('0x4'),'afterDestroy':_0xe397('0x5')};function emitEvent(_0x5371d7){return function(_0x44a2d8,_0x4c0dd7,_0x1ab12e){WhatsappAccountEvents[_0xe397('0x6')](_0x5371d7+':'+_0x44a2d8['id'],_0x44a2d8);WhatsappAccountEvents['emit'](_0x5371d7,_0x44a2d8);_0x1ab12e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x617e=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x617e,0x193));var _0xe617=function(_0x32b691,_0x3dcf40){_0x32b691=_0x32b691-0x0;var _0x33a54e=_0x617e[_0x32b691];return _0x33a54e;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe617('0x0'))['db'][_0xe617('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe617('0x2')](0x0);var events={'afterCreate':_0xe617('0x3'),'afterUpdate':_0xe617('0x4'),'afterDestroy':_0xe617('0x5')};function emitEvent(_0x294bea){return function(_0x33b332,_0x40512d,_0x30abd9){WhatsappAccountEvents[_0xe617('0x6')](_0x294bea+':'+_0x33b332['id'],_0x33b332);WhatsappAccountEvents[_0xe617('0x6')](_0x294bea,_0x33b332);_0x30abd9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xe617('0x7')](e,emitEvent(event));}}module[_0xe617('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a19547a..dd1fe5e 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 _0x9e65=['define','WhatsappAccount','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e65,0xd1));var _0x59e6=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0x9e65[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0x59e6('0x0'));var util=require('util');var logger=require(_0x59e6('0x1'))(_0x59e6('0x2'));var moment=require('moment');var BPromise=require(_0x59e6('0x3'));var rp=require(_0x59e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59e6('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x59e6('0x6')]=function(_0x3d9b5e,_0xec9812){return _0x3d9b5e[_0x59e6('0x7')](_0x59e6('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c44=['path','rimraf','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x1c44,0x1be));var _0x41c4=function(_0x595198,_0x3de3a1){_0x595198=_0x595198-0x0;var _0x5720d4=_0x1c44[_0x595198];return _0x5720d4;};'use strict';var _=require(_0x41c4('0x0'));var util=require(_0x41c4('0x1'));var logger=require(_0x41c4('0x2'))(_0x41c4('0x3'));var moment=require(_0x41c4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41c4('0x5'));var rimraf=require(_0x41c4('0x6'));var config=require(_0x41c4('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x41c4('0x8')]=function(_0x491819,_0x16b296){return _0x491819['define'](_0x41c4('0x9'),attributes,{'tableName':_0x41c4('0xa'),'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 936c0a7..cae2dc6 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 _0xebb0=['options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount'];(function(_0x23bd07,_0x47c45d){var _0x19cc09=function(_0x90bef9){while(--_0x90bef9){_0x23bd07['push'](_0x23bd07['shift']());}};_0x19cc09(++_0x47c45d);}(_0xebb0,0xe0));var _0x0ebb=function(_0x563db8,_0xd567f9){_0x563db8=_0x563db8-0x0;var _0x5b79ec=_0xebb0[_0x563db8];return _0x5b79ec;};'use strict';var _=require(_0x0ebb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ebb('0x1'));var rs=require(_0x0ebb('0x2'));var fs=require('fs');var Redis=require(_0x0ebb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ebb('0x4'));var logger=require(_0x0ebb('0x5'))(_0x0ebb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ebb('0x7')][_0x0ebb('0x8')]({'port':0x232a});config[_0x0ebb('0x9')]=_[_0x0ebb('0xa')](config[_0x0ebb('0x9')],{'host':_0x0ebb('0xb'),'port':0x18eb});var socket=require(_0x0ebb('0xc'))(new Redis(config[_0x0ebb('0x9')]));require(_0x0ebb('0xd'))[_0x0ebb('0xe')](socket);function respondWithRpcPromise(_0x574856,_0x5d3927,_0x3ade79){return new BPromise(function(_0x21de10,_0x512e91){return client[_0x0ebb('0xf')](_0x574856,_0x3ade79)[_0x0ebb('0x10')](function(_0x1fce75){logger[_0x0ebb('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x5d3927,_0x0ebb('0x12'));logger['debug'](_0x0ebb('0x13'),_0x5d3927,_0x0ebb('0x12'),JSON[_0x0ebb('0x14')](_0x1fce75));if(_0x1fce75['error']){if(_0x1fce75[_0x0ebb('0x15')][_0x0ebb('0x16')]===0x1f4){logger[_0x0ebb('0x15')](_0x0ebb('0x17'),_0x5d3927,_0x1fce75[_0x0ebb('0x15')]['message']);return _0x512e91(_0x1fce75['error'][_0x0ebb('0x18')]);}logger[_0x0ebb('0x15')](_0x0ebb('0x17'),_0x5d3927,_0x1fce75[_0x0ebb('0x15')][_0x0ebb('0x18')]);return _0x21de10(_0x1fce75[_0x0ebb('0x15')][_0x0ebb('0x18')]);}else{logger[_0x0ebb('0x11')](_0x0ebb('0x17'),_0x5d3927,_0x0ebb('0x12'));_0x21de10(_0x1fce75[_0x0ebb('0x19')][_0x0ebb('0x18')]);}})[_0x0ebb('0x1a')](function(_0x28ed29){logger[_0x0ebb('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5d3927,_0x28ed29);_0x512e91(_0x28ed29);});});}exports['ShowWhatsappAccount']=function(_0x1aca69){var _0x495dff=this;return new Promise(function(_0x3a6c40,_0x4804dc){return db[_0x0ebb('0x1b')]['find']({'raw':_0x1aca69['options']?_0x1aca69[_0x0ebb('0x1c')][_0x0ebb('0x1d')]===undefined?!![]:![]:!![],'where':_0x1aca69[_0x0ebb('0x1c')]?_0x1aca69[_0x0ebb('0x1c')][_0x0ebb('0x1e')]||null:null,'attributes':_0x1aca69['options']?_0x1aca69[_0x0ebb('0x1c')][_0x0ebb('0x1f')]||null:null,'include':_0x1aca69['options']?_0x1aca69[_0x0ebb('0x1c')][_0x0ebb('0x20')]?_[_0x0ebb('0x21')](_0x1aca69['options']['include'],function(_0x364408){return{'model':db[_0x364408[_0x0ebb('0x22')]],'as':_0x364408['as'],'attributes':_0x364408[_0x0ebb('0x1f')],'include':_0x364408[_0x0ebb('0x20')]?_[_0x0ebb('0x21')](_0x364408[_0x0ebb('0x20')],function(_0x581e2f){return{'model':db[_0x581e2f['model']],'as':_0x581e2f['as'],'attributes':_0x581e2f['attributes'],'include':_0x581e2f['include']?_[_0x0ebb('0x21')](_0x581e2f[_0x0ebb('0x20')],function(_0x40f954){return{'model':db[_0x40f954[_0x0ebb('0x22')]],'as':_0x40f954['as'],'attributes':_0x40f954[_0x0ebb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0ebb('0x10')](function(_0x5b3e57){logger[_0x0ebb('0x11')](_0x0ebb('0x23'),_0x1aca69);logger['debug'](_0x0ebb('0x23'),_0x1aca69,JSON[_0x0ebb('0x14')](_0x5b3e57));_0x3a6c40(_0x5b3e57);})[_0x0ebb('0x1a')](function(_0x128de9){logger[_0x0ebb('0x15')](_0x0ebb('0x23'),_0x128de9[_0x0ebb('0x18')],_0x1aca69);_0x4804dc(_0x495dff[_0x0ebb('0x15')](0x1f4,_0x128de9[_0x0ebb('0x18')]));});});}; \ No newline at end of file +var _0x0a9e=['localhost','socket.io-emitter','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x45fb8f,_0x46da98){var _0x3d906b=function(_0x228ab0){while(--_0x228ab0){_0x45fb8f['push'](_0x45fb8f['shift']());}};_0x3d906b(++_0x46da98);}(_0x0a9e,0x1bb));var _0xe0a9=function(_0x662668,_0x2ea071){_0x662668=_0x662668-0x0;var _0x5e8181=_0x0a9e[_0x662668];return _0x5e8181;};'use strict';var _=require(_0xe0a9('0x0'));var util=require(_0xe0a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0a9('0x2'));var fs=require('fs');var Redis=require(_0xe0a9('0x3'));var db=require(_0xe0a9('0x4'))['db'];var utils=require(_0xe0a9('0x5'));var logger=require('../../config/logger')(_0xe0a9('0x6'));var config=require(_0xe0a9('0x7'));var jayson=require(_0xe0a9('0x8'));var client=jayson[_0xe0a9('0x9')][_0xe0a9('0xa')]({'port':0x232a});config[_0xe0a9('0xb')]=_[_0xe0a9('0xc')](config[_0xe0a9('0xb')],{'host':_0xe0a9('0xd'),'port':0x18eb});var socket=require(_0xe0a9('0xe'))(new Redis(config[_0xe0a9('0xb')]));require(_0xe0a9('0xf'))[_0xe0a9('0x10')](socket);function respondWithRpcPromise(_0x860ce3,_0x25a51e,_0x3d98e6){return new BPromise(function(_0x23307c,_0x2e7d53){return client['request'](_0x860ce3,_0x3d98e6)[_0xe0a9('0x11')](function(_0x100cff){logger['info'](_0xe0a9('0x12'),_0x25a51e,_0xe0a9('0x13'));logger[_0xe0a9('0x14')](_0xe0a9('0x15'),_0x25a51e,_0xe0a9('0x13'),JSON[_0xe0a9('0x16')](_0x100cff));if(_0x100cff[_0xe0a9('0x17')]){if(_0x100cff[_0xe0a9('0x17')][_0xe0a9('0x18')]===0x1f4){logger[_0xe0a9('0x17')](_0xe0a9('0x12'),_0x25a51e,_0x100cff[_0xe0a9('0x17')][_0xe0a9('0x19')]);return _0x2e7d53(_0x100cff[_0xe0a9('0x17')][_0xe0a9('0x19')]);}logger[_0xe0a9('0x17')](_0xe0a9('0x12'),_0x25a51e,_0x100cff[_0xe0a9('0x17')]['message']);return _0x23307c(_0x100cff[_0xe0a9('0x17')]['message']);}else{logger[_0xe0a9('0x1a')](_0xe0a9('0x12'),_0x25a51e,'request\x20sent');_0x23307c(_0x100cff[_0xe0a9('0x1b')][_0xe0a9('0x19')]);}})[_0xe0a9('0x1c')](function(_0x4f1be2){logger['error'](_0xe0a9('0x12'),_0x25a51e,_0x4f1be2);_0x2e7d53(_0x4f1be2);});});}exports[_0xe0a9('0x1d')]=function(_0x5ce3ca){var _0x19ca2a=this;return new Promise(function(_0x51c150,_0x30fa01){return db[_0xe0a9('0x1e')][_0xe0a9('0x1f')]({'raw':_0x5ce3ca['options']?_0x5ce3ca[_0xe0a9('0x20')][_0xe0a9('0x21')]===undefined?!![]:![]:!![],'where':_0x5ce3ca[_0xe0a9('0x20')]?_0x5ce3ca['options'][_0xe0a9('0x22')]||null:null,'attributes':_0x5ce3ca['options']?_0x5ce3ca[_0xe0a9('0x20')][_0xe0a9('0x23')]||null:null,'include':_0x5ce3ca[_0xe0a9('0x20')]?_0x5ce3ca[_0xe0a9('0x20')][_0xe0a9('0x24')]?_['map'](_0x5ce3ca['options'][_0xe0a9('0x24')],function(_0x2e9b20){return{'model':db[_0x2e9b20['model']],'as':_0x2e9b20['as'],'attributes':_0x2e9b20[_0xe0a9('0x23')],'include':_0x2e9b20[_0xe0a9('0x24')]?_[_0xe0a9('0x25')](_0x2e9b20[_0xe0a9('0x24')],function(_0x3b22c8){return{'model':db[_0x3b22c8['model']],'as':_0x3b22c8['as'],'attributes':_0x3b22c8[_0xe0a9('0x23')],'include':_0x3b22c8['include']?_['map'](_0x3b22c8[_0xe0a9('0x24')],function(_0xeade09){return{'model':db[_0xeade09['model']],'as':_0xeade09['as'],'attributes':_0xeade09[_0xe0a9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe0a9('0x11')](function(_0x1a3ced){logger[_0xe0a9('0x1a')](_0xe0a9('0x1d'),_0x5ce3ca);logger['debug'](_0xe0a9('0x1d'),_0x5ce3ca,JSON[_0xe0a9('0x16')](_0x1a3ced));_0x51c150(_0x1a3ced);})['catch'](function(_0x18c2c2){logger[_0xe0a9('0x17')]('ShowWhatsappAccount',_0x18c2c2['message'],_0x5ce3ca);_0x30fa01(_0x19ca2a[_0xe0a9('0x17')](0x1f4,_0x18c2c2[_0xe0a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 459eca9..56dc55d 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 _0x3a2e=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove'];(function(_0x3ae38e,_0x3aaa14){var _0x483595=function(_0x5c55ff){while(--_0x5c55ff){_0x3ae38e['push'](_0x3ae38e['shift']());}};_0x483595(++_0x3aaa14);}(_0x3a2e,0x18d));var _0xe3a2=function(_0x5debc4,_0x2b9895){_0x5debc4=_0x5debc4-0x0;var _0x2e78a5=_0x3a2e[_0x5debc4];return _0x2e78a5;};'use strict';var WhatsappAccountEvents=require(_0xe3a2('0x0'));var events=['save',_0xe3a2('0x1'),'update'];function createListener(_0x36d27d,_0x2ddb88){return function(_0x3bbd9e){_0x2ddb88[_0xe3a2('0x2')](_0x36d27d,_0x3bbd9e);};}function removeListener(_0x394c9f,_0x915a82){return function(){WhatsappAccountEvents[_0xe3a2('0x3')](_0x394c9f,_0x915a82);};}exports[_0xe3a2('0x4')]=function(_0x9d540e){for(var _0xba01a7=0x0,_0x6b0586=events[_0xe3a2('0x5')];_0xba01a7<_0x6b0586;_0xba01a7++){var _0x5f1d98=events[_0xba01a7];var _0xf5817c=createListener(_0xe3a2('0x6')+_0x5f1d98,_0x9d540e);WhatsappAccountEvents['on'](_0x5f1d98,_0xf5817c);}}; \ No newline at end of file +var _0x96d7=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','emit'];(function(_0x35809f,_0x37203f){var _0x3d05e8=function(_0x200a79){while(--_0x200a79){_0x35809f['push'](_0x35809f['shift']());}};_0x3d05e8(++_0x37203f);}(_0x96d7,0x124));var _0x796d=function(_0x4377a8,_0x4c25be){_0x4377a8=_0x4377a8-0x0;var _0x4edd55=_0x96d7[_0x4377a8];return _0x4edd55;};'use strict';var WhatsappAccountEvents=require(_0x796d('0x0'));var events=['save','remove','update'];function createListener(_0x396f51,_0xd47325){return function(_0x1e13b9){_0xd47325[_0x796d('0x1')](_0x396f51,_0x1e13b9);};}function removeListener(_0x400d2d,_0x53887a){return function(){WhatsappAccountEvents[_0x796d('0x2')](_0x400d2d,_0x53887a);};}exports[_0x796d('0x3')]=function(_0x4d0a52){for(var _0x1d93c8=0x0,_0x2b9b6f=events[_0x796d('0x4')];_0x1d93c8<_0x2b9b6f;_0x1d93c8++){var _0x2a9ba8=events[_0x1d93c8];var _0x21e8cf=createListener(_0x796d('0x5')+_0x2a9ba8,_0x4d0a52);WhatsappAccountEvents['on'](_0x2a9ba8,_0x21e8cf);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cef776a..2ec1303 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 _0xa20e=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','create','put','isAuthenticated','update','delete','exports'];(function(_0x5136be,_0x48b356){var _0x2f5ce2=function(_0x5eb125){while(--_0x5eb125){_0x5136be['push'](_0x5136be['shift']());}};_0x2f5ce2(++_0x48b356);}(_0xa20e,0xc6));var _0xea20=function(_0x2458f0,_0xf805c){_0x2458f0=_0x2458f0-0x0;var _0x2b4fd9=_0xa20e[_0x2458f0];return _0x2b4fd9;};'use strict';var multer=require(_0xea20('0x0'));var util=require(_0xea20('0x1'));var path=require(_0xea20('0x2'));var timeout=require(_0xea20('0x3'));var express=require(_0xea20('0x4'));var router=express[_0xea20('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea20('0x6'));var interaction=require(_0xea20('0x7'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0xea20('0x8')]('/',auth['isAuthenticated'](),controller[_0xea20('0x9')]);router[_0xea20('0x8')](_0xea20('0xa'),auth['isAuthenticated'](),controller[_0xea20('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea20('0xc')]);router[_0xea20('0xd')](_0xea20('0xa'),auth[_0xea20('0xe')](),controller[_0xea20('0xf')]);router[_0xea20('0x10')](_0xea20('0xa'),auth[_0xea20('0xe')](),controller['destroy']);module[_0xea20('0x11')]=router; \ No newline at end of file +var _0xa6d0=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','destroy','exports'];(function(_0x95c6cf,_0x119fae){var _0x217671=function(_0x3697ec){while(--_0x3697ec){_0x95c6cf['push'](_0x95c6cf['shift']());}};_0x217671(++_0x119fae);}(_0xa6d0,0xaa));var _0x0a6d=function(_0x36cf33,_0x185bbd){_0x36cf33=_0x36cf33-0x0;var _0x764cac=_0xa6d0[_0x36cf33];return _0x764cac;};'use strict';var multer=require(_0x0a6d('0x0'));var util=require('util');var path=require(_0x0a6d('0x1'));var timeout=require(_0x0a6d('0x2'));var express=require(_0x0a6d('0x3'));var router=express[_0x0a6d('0x4')]();var fs_extra=require(_0x0a6d('0x5'));var auth=require(_0x0a6d('0x6'));var interaction=require(_0x0a6d('0x7'));var config=require('../../config/environment');var controller=require(_0x0a6d('0x8'));router[_0x0a6d('0x9')]('/',auth[_0x0a6d('0xa')](),controller[_0x0a6d('0xb')]);router['get'](_0x0a6d('0xc'),auth[_0x0a6d('0xa')](),controller[_0x0a6d('0xd')]);router[_0x0a6d('0xe')]('/',auth[_0x0a6d('0xa')](),controller['create']);router['put'](_0x0a6d('0xc'),auth[_0x0a6d('0xa')](),controller['update']);router['delete'](_0x0a6d('0xc'),auth['isAuthenticated'](),controller[_0x0a6d('0xf')]);module[_0x0a6d('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7f79e2d..d47b27e 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 _0x0648=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x17917e,_0x224276){var _0xb77908=function(_0x59e129){while(--_0x59e129){_0x17917e['push'](_0x17917e['shift']());}};_0xb77908(++_0x224276);}(_0x0648,0x147));var _0x8064=function(_0x256066,_0x190013){_0x256066=_0x256066-0x0;var _0x430acc=_0x0648[_0x256066];return _0x430acc;};'use strict';var Sequelize=require(_0x8064('0x0'));module[_0x8064('0x1')]={'priority':{'type':Sequelize[_0x8064('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8064('0x3')],'allowNull':![],'defaultValue':_0x8064('0x4')},'appdata':{'type':Sequelize[_0x8064('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8064('0x6')}}; \ No newline at end of file +var _0xa345=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0xd09aa,_0x1a3a80){var _0x3da989=function(_0x5b4750){while(--_0x5b4750){_0xd09aa['push'](_0xd09aa['shift']());}};_0x3da989(++_0x1a3a80);}(_0xa345,0x1cf));var _0x5a34=function(_0x35ed15,_0x4256f9){_0x35ed15=_0x35ed15-0x0;var _0x5e9001=_0xa345[_0x35ed15];return _0x5e9001;};'use strict';var Sequelize=require(_0x5a34('0x0'));module[_0x5a34('0x1')]={'priority':{'type':Sequelize[_0x5a34('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5a34('0x3')]()},'description':{'type':Sequelize[_0x5a34('0x4')]},'interval':{'type':Sequelize[_0x5a34('0x4')],'defaultValue':_0x5a34('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 25e77cb..fc9cfa0 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 _0x4f2f=['filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','WhatsappApplication','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x196c94,_0x58fa96){var _0x4f7e3f=function(_0x19f1d5){while(--_0x19f1d5){_0x196c94['push'](_0x196c94['shift']());}};_0x4f7e3f(++_0x58fa96);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x4f2f[_0x387777];return _0x3f84c0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf4f2('0x0'));var jsonpatch=require(_0xf4f2('0x1'));var rp=require('request-promise');var moment=require(_0xf4f2('0x2'));var BPromise=require(_0xf4f2('0x3'));var Mustache=require(_0xf4f2('0x4'));var util=require(_0xf4f2('0x5'));var path=require(_0xf4f2('0x6'));var sox=require(_0xf4f2('0x7'));var csv=require(_0xf4f2('0x8'));var ejs=require(_0xf4f2('0x9'));var fs=require('fs');var fs_extra=require(_0xf4f2('0xa'));var _=require(_0xf4f2('0xb'));var squel=require(_0xf4f2('0xc'));var crypto=require('crypto');var jsforce=require(_0xf4f2('0xd'));var deskjs=require(_0xf4f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf4f2('0xf'));var Papa=require(_0xf4f2('0x10'));var Redis=require(_0xf4f2('0x11'));var authService=require(_0xf4f2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf4f2('0x13'));var utils=require(_0xf4f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf4f2('0x15'));var db=require(_0xf4f2('0x16'))['db'];function respondWithStatusCode(_0x4e6996,_0x3398c7){_0x3398c7=_0x3398c7||0xcc;return function(_0x551b1c){if(_0x551b1c){return _0x4e6996[_0xf4f2('0x17')](_0x3398c7);}return _0x4e6996[_0xf4f2('0x18')](_0x3398c7)[_0xf4f2('0x19')]();};}function respondWithResult(_0x4e2b1c,_0x18e47d){_0x18e47d=_0x18e47d||0xc8;return function(_0x260164){if(_0x260164){return _0x4e2b1c[_0xf4f2('0x18')](_0x18e47d)[_0xf4f2('0x1a')](_0x260164);}};}function respondWithFilteredResult(_0x53a476,_0x31a15a){return function(_0x29caef){if(_0x29caef){var _0x418b9a=typeof _0x31a15a[_0xf4f2('0x1b')]===_0xf4f2('0x1c')&&typeof _0x31a15a['limit']===_0xf4f2('0x1c');var _0x4b1331=_0x29caef['count'];var _0x499b44=_0x418b9a?0x0:_0x31a15a['offset'];var _0x496f92=_0x418b9a?_0x29caef[_0xf4f2('0x1d')]:_0x31a15a['offset']+_0x31a15a[_0xf4f2('0x1e')];var _0xfcc2c2;if(_0x496f92>=_0x4b1331){_0x496f92=_0x4b1331;_0xfcc2c2=0xc8;}else{_0xfcc2c2=0xce;}_0x53a476[_0xf4f2('0x18')](_0xfcc2c2);return _0x53a476[_0xf4f2('0x1f')](_0xf4f2('0x20'),_0x499b44+'-'+_0x496f92+'/'+_0x4b1331)['json'](_0x29caef);}return null;};}function patchUpdates(_0xe9649){return function(_0x28becf){try{jsonpatch[_0xf4f2('0x21')](_0x28becf,_0xe9649,!![]);}catch(_0x588861){return BPromise[_0xf4f2('0x22')](_0x588861);}return _0x28becf[_0xf4f2('0x23')]();};}function saveUpdates(_0x1d822f,_0x493f1b){return function(_0x149e1a){if(_0x149e1a){return _0x149e1a['update'](_0x1d822f)[_0xf4f2('0x24')](function(_0x4365ab){return _0x4365ab;});}return null;};}function removeEntity(_0x55089a,_0x38db0f){return function(_0x4d36dc){if(_0x4d36dc){return _0x4d36dc[_0xf4f2('0x25')]()['then'](function(){_0x55089a[_0xf4f2('0x18')](0xcc)[_0xf4f2('0x19')]();});}};}function handleEntityNotFound(_0x520595,_0x541c7c){return function(_0x1baf92){if(!_0x1baf92){_0x520595['sendStatus'](0x194);}return _0x1baf92;};}function handleError(_0x271755,_0x39d2d1){_0x39d2d1=_0x39d2d1||0x1f4;return function(_0x1b7246){logger[_0xf4f2('0x26')](_0x1b7246[_0xf4f2('0x27')]);if(_0x1b7246[_0xf4f2('0x28')]){delete _0x1b7246[_0xf4f2('0x28')];}_0x271755[_0xf4f2('0x18')](_0x39d2d1)[_0xf4f2('0x29')](_0x1b7246);};}exports[_0xf4f2('0x2a')]=function(_0x5b3dfc,_0x5a2b8b){var _0x174510={},_0x272ed9={},_0x49d327={'count':0x0,'rows':[]};var _0x3782c6=_['map'](db[_0xf4f2('0x2b')]['rawAttributes'],function(_0x53cf23){return{'name':_0x53cf23[_0xf4f2('0x2c')],'type':_0x53cf23[_0xf4f2('0x2d')][_0xf4f2('0x2e')]};});_0x272ed9[_0xf4f2('0x2f')]=_[_0xf4f2('0x30')](_0x3782c6,_0xf4f2('0x28'));_0x272ed9[_0xf4f2('0x31')]=_[_0xf4f2('0x32')](_0x5b3dfc[_0xf4f2('0x31')]);_0x272ed9['filters']=_[_0xf4f2('0x33')](_0x272ed9[_0xf4f2('0x2f')],_0x272ed9[_0xf4f2('0x31')]);_0x174510['attributes']=_[_0xf4f2('0x33')](_0x272ed9[_0xf4f2('0x2f')],qs[_0xf4f2('0x34')](_0x5b3dfc[_0xf4f2('0x31')]['fields']));_0x174510[_0xf4f2('0x35')]=_0x174510[_0xf4f2('0x35')][_0xf4f2('0x36')]?_0x174510[_0xf4f2('0x35')]:_0x272ed9[_0xf4f2('0x2f')];if(!_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x37')](_0xf4f2('0x38'))){_0x174510['limit']=qs[_0xf4f2('0x1e')](_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x1e')]);_0x174510[_0xf4f2('0x1b')]=qs[_0xf4f2('0x1b')](_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x1b')]);}_0x174510['order']=qs['sort'](_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x39')]);_0x174510[_0xf4f2('0x3a')]=qs[_0xf4f2('0x3b')](_['pick'](_0x5b3dfc[_0xf4f2('0x31')],_0x272ed9[_0xf4f2('0x3b')]),_0x3782c6);if(_0x5b3dfc['query'][_0xf4f2('0x3c')]){_0x174510[_0xf4f2('0x3a')]=_[_0xf4f2('0x3d')](_0x174510[_0xf4f2('0x3a')],{'$or':_[_0xf4f2('0x30')](_0x3782c6,function(_0x1725f2){if(_0x1725f2[_0xf4f2('0x2d')]!==_0xf4f2('0x3e')){var _0x2b4c47={};_0x2b4c47[_0x1725f2['name']]={'$like':'%'+_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x3c')]+'%'};return _0x2b4c47;}})});}_0x174510=_['merge']({},_0x174510,_0x5b3dfc['options']);var _0x4a9a29={'where':_0x174510['where']};return db[_0xf4f2('0x2b')][_0xf4f2('0x1d')](_0x4a9a29)['then'](function(_0x5b7f49){_0x49d327[_0xf4f2('0x1d')]=_0x5b7f49;if(_0x5b3dfc[_0xf4f2('0x31')][_0xf4f2('0x3f')]){_0x174510['include']=[{'all':!![]}];}return db[_0xf4f2('0x2b')][_0xf4f2('0x40')](_0x174510);})[_0xf4f2('0x24')](function(_0x573c30){_0x49d327[_0xf4f2('0x41')]=_0x573c30;return _0x49d327;})['then'](respondWithFilteredResult(_0x5a2b8b,_0x174510))[_0xf4f2('0x42')](handleError(_0x5a2b8b,null));};exports[_0xf4f2('0x43')]=function(_0x2aaf93,_0x3007d5){var _0x3d786c={'raw':!![],'where':{'id':_0x2aaf93['params']['id']}},_0x5d44be={};_0x5d44be[_0xf4f2('0x2f')]=_['keys'](db[_0xf4f2('0x2b')][_0xf4f2('0x44')]);_0x5d44be[_0xf4f2('0x31')]=_['keys'](_0x2aaf93['query']);_0x5d44be['filters']=_[_0xf4f2('0x33')](_0x5d44be[_0xf4f2('0x2f')],_0x5d44be[_0xf4f2('0x31')]);_0x3d786c[_0xf4f2('0x35')]=_[_0xf4f2('0x33')](_0x5d44be[_0xf4f2('0x2f')],qs[_0xf4f2('0x34')](_0x2aaf93[_0xf4f2('0x31')]['fields']));_0x3d786c[_0xf4f2('0x35')]=_0x3d786c[_0xf4f2('0x35')][_0xf4f2('0x36')]?_0x3d786c[_0xf4f2('0x35')]:_0x5d44be[_0xf4f2('0x2f')];if(_0x2aaf93[_0xf4f2('0x31')][_0xf4f2('0x3f')]){_0x3d786c['include']=[{'all':!![]}];}_0x3d786c=_['merge']({},_0x3d786c,_0x2aaf93['options']);return db[_0xf4f2('0x2b')][_0xf4f2('0x45')](_0x3d786c)[_0xf4f2('0x24')](handleEntityNotFound(_0x3007d5,null))[_0xf4f2('0x24')](respondWithResult(_0x3007d5,null))[_0xf4f2('0x42')](handleError(_0x3007d5,null));};exports['create']=function(_0x3b52c4,_0x1f0ae5){return db[_0xf4f2('0x2b')][_0xf4f2('0x46')](_0x3b52c4[_0xf4f2('0x47')],{})[_0xf4f2('0x24')](respondWithResult(_0x1f0ae5,0xc9))[_0xf4f2('0x42')](handleError(_0x1f0ae5,null));};exports[_0xf4f2('0x48')]=function(_0x7ebf2d,_0x23cc2e){if(_0x7ebf2d[_0xf4f2('0x47')]['id']){delete _0x7ebf2d[_0xf4f2('0x47')]['id'];}return db[_0xf4f2('0x2b')]['find']({'where':{'id':_0x7ebf2d[_0xf4f2('0x49')]['id']}})[_0xf4f2('0x24')](handleEntityNotFound(_0x23cc2e,null))['then'](saveUpdates(_0x7ebf2d[_0xf4f2('0x47')],null))[_0xf4f2('0x24')](respondWithResult(_0x23cc2e,null))[_0xf4f2('0x42')](handleError(_0x23cc2e,null));};exports[_0xf4f2('0x25')]=function(_0x15e133,_0xcb558){return db[_0xf4f2('0x2b')][_0xf4f2('0x45')]({'where':{'id':_0x15e133['params']['id']}})['then'](handleEntityNotFound(_0xcb558,null))[_0xf4f2('0x24')](removeEntity(_0xcb558,null))[_0xf4f2('0x42')](handleError(_0xcb558,null));}; \ No newline at end of file +var _0x471a=['Content-Range','apply','reject','save','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x471a,0x18d));var _0xa471=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0x471a[_0xd4d369];return _0x293e5d;};'use strict';var emlformat=require(_0xa471('0x0'));var rimraf=require(_0xa471('0x1'));var zipdir=require(_0xa471('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa471('0x3'));var moment=require(_0xa471('0x4'));var BPromise=require(_0xa471('0x5'));var Mustache=require(_0xa471('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa471('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa471('0x8'));var crypto=require(_0xa471('0x9'));var jsforce=require(_0xa471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa471('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa471('0xb'));var authService=require(_0xa471('0xc'));var qs=require(_0xa471('0xd'));var as=require(_0xa471('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa471('0xf'))(_0xa471('0x10'));var utils=require(_0xa471('0x11'));var config=require(_0xa471('0x12'));var licenseUtil=require(_0xa471('0x13'));var db=require(_0xa471('0x14'))['db'];function respondWithStatusCode(_0x5703c9,_0x2ae2a2){_0x2ae2a2=_0x2ae2a2||0xcc;return function(_0x4f1a44){if(_0x4f1a44){return _0x5703c9[_0xa471('0x15')](_0x2ae2a2);}return _0x5703c9['status'](_0x2ae2a2)[_0xa471('0x16')]();};}function respondWithResult(_0x115541,_0x501375){_0x501375=_0x501375||0xc8;return function(_0x39c025){if(_0x39c025){return _0x115541[_0xa471('0x17')](_0x501375)[_0xa471('0x18')](_0x39c025);}};}function respondWithFilteredResult(_0x531451,_0x31bcb7){return function(_0x1ed20c){if(_0x1ed20c){var _0x16e5bf=typeof _0x31bcb7[_0xa471('0x19')]===_0xa471('0x1a')&&typeof _0x31bcb7['limit']===_0xa471('0x1a');var _0x35f2f3=_0x1ed20c[_0xa471('0x1b')];var _0x5e5225=_0x16e5bf?0x0:_0x31bcb7['offset'];var _0x23fb08=_0x16e5bf?_0x1ed20c['count']:_0x31bcb7[_0xa471('0x19')]+_0x31bcb7['limit'];var _0x5e56dc;if(_0x23fb08>=_0x35f2f3){_0x23fb08=_0x35f2f3;_0x5e56dc=0xc8;}else{_0x5e56dc=0xce;}_0x531451[_0xa471('0x17')](_0x5e56dc);return _0x531451[_0xa471('0x1c')](_0xa471('0x1d'),_0x5e5225+'-'+_0x23fb08+'/'+_0x35f2f3)[_0xa471('0x18')](_0x1ed20c);}return null;};}function patchUpdates(_0x45ff30){return function(_0x6b230){try{jsonpatch[_0xa471('0x1e')](_0x6b230,_0x45ff30,!![]);}catch(_0x554610){return BPromise[_0xa471('0x1f')](_0x554610);}return _0x6b230[_0xa471('0x20')]();};}function saveUpdates(_0x398f23,_0x49ea0b){return function(_0x3e0972){if(_0x3e0972){return _0x3e0972['update'](_0x398f23)[_0xa471('0x21')](function(_0x2b7755){return _0x2b7755;});}return null;};}function removeEntity(_0x56a34e,_0x21b9e5){return function(_0x41a855){if(_0x41a855){return _0x41a855['destroy']()[_0xa471('0x21')](function(){_0x56a34e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188d6a,_0x2b1d3c){return function(_0x56682a){if(!_0x56682a){_0x188d6a['sendStatus'](0x194);}return _0x56682a;};}function handleError(_0x165504,_0x2d2a91){_0x2d2a91=_0x2d2a91||0x1f4;return function(_0x5009cf){logger[_0xa471('0x22')](_0x5009cf[_0xa471('0x23')]);if(_0x5009cf[_0xa471('0x24')]){delete _0x5009cf[_0xa471('0x24')];}_0x165504['status'](_0x2d2a91)[_0xa471('0x25')](_0x5009cf);};}exports[_0xa471('0x26')]=function(_0x5a3f99,_0x3851d9){var _0x3bb318={},_0x469b08={},_0x3961b5={'count':0x0,'rows':[]};var _0x5d4441=_[_0xa471('0x27')](db[_0xa471('0x28')]['rawAttributes'],function(_0x4eb527){return{'name':_0x4eb527[_0xa471('0x29')],'type':_0x4eb527[_0xa471('0x2a')][_0xa471('0x2b')]};});_0x469b08[_0xa471('0x2c')]=_[_0xa471('0x27')](_0x5d4441,'name');_0x469b08[_0xa471('0x2d')]=_[_0xa471('0x2e')](_0x5a3f99[_0xa471('0x2d')]);_0x469b08[_0xa471('0x2f')]=_[_0xa471('0x30')](_0x469b08[_0xa471('0x2c')],_0x469b08[_0xa471('0x2d')]);_0x3bb318[_0xa471('0x31')]=_[_0xa471('0x30')](_0x469b08['model'],qs[_0xa471('0x32')](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x32')]));_0x3bb318[_0xa471('0x31')]=_0x3bb318[_0xa471('0x31')]['length']?_0x3bb318[_0xa471('0x31')]:_0x469b08[_0xa471('0x2c')];if(!_0x5a3f99[_0xa471('0x2d')][_0xa471('0x33')](_0xa471('0x34'))){_0x3bb318[_0xa471('0x35')]=qs['limit'](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x35')]);_0x3bb318[_0xa471('0x19')]=qs[_0xa471('0x19')](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x19')]);}_0x3bb318['order']=qs[_0xa471('0x36')](_0x5a3f99['query']['sort']);_0x3bb318[_0xa471('0x37')]=qs[_0xa471('0x2f')](_[_0xa471('0x38')](_0x5a3f99[_0xa471('0x2d')],_0x469b08[_0xa471('0x2f')]),_0x5d4441);if(_0x5a3f99['query'][_0xa471('0x39')]){_0x3bb318[_0xa471('0x37')]=_[_0xa471('0x3a')](_0x3bb318[_0xa471('0x37')],{'$or':_[_0xa471('0x27')](_0x5d4441,function(_0xcf1361){if(_0xcf1361[_0xa471('0x2a')]!=='VIRTUAL'){var _0x2aefbf={};_0x2aefbf[_0xcf1361[_0xa471('0x24')]]={'$like':'%'+_0x5a3f99['query']['filter']+'%'};return _0x2aefbf;}})});}_0x3bb318=_[_0xa471('0x3a')]({},_0x3bb318,_0x5a3f99[_0xa471('0x3b')]);var _0x2d98f0={'where':_0x3bb318[_0xa471('0x37')]};return db[_0xa471('0x28')][_0xa471('0x1b')](_0x2d98f0)[_0xa471('0x21')](function(_0xcc3f85){_0x3961b5[_0xa471('0x1b')]=_0xcc3f85;if(_0x5a3f99['query'][_0xa471('0x3c')]){_0x3bb318['include']=[{'all':!![]}];}return db[_0xa471('0x28')][_0xa471('0x3d')](_0x3bb318);})[_0xa471('0x21')](function(_0x19eb6e){_0x3961b5[_0xa471('0x3e')]=_0x19eb6e;return _0x3961b5;})[_0xa471('0x21')](respondWithFilteredResult(_0x3851d9,_0x3bb318))[_0xa471('0x3f')](handleError(_0x3851d9,null));};exports['show']=function(_0xc932ae,_0x2d848a){var _0x50668b={'raw':!![],'where':{'id':_0xc932ae[_0xa471('0x40')]['id']}},_0x38ec90={};_0x38ec90['model']=_['keys'](db[_0xa471('0x28')][_0xa471('0x41')]);_0x38ec90[_0xa471('0x2d')]=_[_0xa471('0x2e')](_0xc932ae[_0xa471('0x2d')]);_0x38ec90[_0xa471('0x2f')]=_[_0xa471('0x30')](_0x38ec90[_0xa471('0x2c')],_0x38ec90[_0xa471('0x2d')]);_0x50668b[_0xa471('0x31')]=_[_0xa471('0x30')](_0x38ec90[_0xa471('0x2c')],qs['fields'](_0xc932ae[_0xa471('0x2d')][_0xa471('0x32')]));_0x50668b[_0xa471('0x31')]=_0x50668b[_0xa471('0x31')][_0xa471('0x42')]?_0x50668b['attributes']:_0x38ec90[_0xa471('0x2c')];if(_0xc932ae['query'][_0xa471('0x3c')]){_0x50668b['include']=[{'all':!![]}];}_0x50668b=_[_0xa471('0x3a')]({},_0x50668b,_0xc932ae[_0xa471('0x3b')]);return db[_0xa471('0x28')][_0xa471('0x43')](_0x50668b)[_0xa471('0x21')](handleEntityNotFound(_0x2d848a,null))['then'](respondWithResult(_0x2d848a,null))[_0xa471('0x3f')](handleError(_0x2d848a,null));};exports['create']=function(_0x2fb716,_0x39e2d8){return db[_0xa471('0x28')][_0xa471('0x44')](_0x2fb716[_0xa471('0x45')],{})['then'](respondWithResult(_0x39e2d8,0xc9))[_0xa471('0x3f')](handleError(_0x39e2d8,null));};exports['update']=function(_0x5c0efe,_0x2cf4a9){if(_0x5c0efe['body']['id']){delete _0x5c0efe['body']['id'];}return db[_0xa471('0x28')]['find']({'where':{'id':_0x5c0efe[_0xa471('0x40')]['id']}})[_0xa471('0x21')](handleEntityNotFound(_0x2cf4a9,null))['then'](saveUpdates(_0x5c0efe[_0xa471('0x45')],null))[_0xa471('0x21')](respondWithResult(_0x2cf4a9,null))[_0xa471('0x3f')](handleError(_0x2cf4a9,null));};exports[_0xa471('0x46')]=function(_0x3e486f,_0x21323b){return db[_0xa471('0x28')]['find']({'where':{'id':_0x3e486f[_0xa471('0x40')]['id']}})[_0xa471('0x21')](handleEntityNotFound(_0x21323b,null))[_0xa471('0x21')](removeEntity(_0x21323b,null))['catch'](handleError(_0x21323b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ceb23a4..b338b87 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications'];(function(_0x26a6ba,_0x2f4d06){var _0x23f2db=function(_0x52e0d1){while(--_0x52e0d1){_0x26a6ba['push'](_0x26a6ba['shift']());}};_0x23f2db(++_0x2f4d06);}(_0x0a12,0xb8));var _0x20a1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0a12[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('WhatsappApplication',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0a52=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path'];(function(_0x394734,_0x1e9bce){var _0x5d38d6=function(_0x4a49d3){while(--_0x4a49d3){_0x394734['push'](_0x394734['shift']());}};_0x5d38d6(++_0x1e9bce);}(_0x0a52,0xe4));var _0x20a5=function(_0x1dbc84,_0xffa93e){_0x1dbc84=_0x1dbc84-0x0;var _0x5be2c3=_0x0a52[_0x1dbc84];return _0x5be2c3;};'use strict';var _=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var logger=require('../../config/logger')(_0x20a5('0x2'));var moment=require(_0x20a5('0x3'));var BPromise=require(_0x20a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a5('0x5'));var rimraf=require(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var attributes=require(_0x20a5('0x8'));module[_0x20a5('0x9')]=function(_0x1fcc72,_0x4acc66){return _0x1fcc72['define'](_0x20a5('0xa'),attributes,{'tableName':_0x20a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x20a5('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ed35a3f..6a97f39 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x58fc2b,_0x368286){var _0x3937ce=function(_0x25a86e){while(--_0x25a86e){_0x58fc2b['push'](_0x58fc2b['shift']());}};_0x3937ce(++_0x368286);}(_0x81bd,0x7c));var _0xd81b=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x81bd[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4ffb3d,_0x152a2d){var _0x53794a=function(_0x42edbd){while(--_0x42edbd){_0x4ffb3d['push'](_0x4ffb3d['shift']());}};_0x53794a(++_0x152a2d);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5d3679,_0x3911a8){_0x5d3679=_0x5d3679-0x0;var _0x23a806=_0x4c4e[_0x5d3679];return _0x23a806;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dfee069..2591d92 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 _0xe944=['whatsapp','whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xe944,0x174));var _0x4e94=function(_0x1f5be8,_0x294c8c){_0x1f5be8=_0x1f5be8-0x0;var _0x46cfd4=_0xe944[_0x1f5be8];return _0x46cfd4;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e94('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e94('0x3'));var controller=require(_0x4e94('0x4'));router[_0x4e94('0x5')]('/',auth[_0x4e94('0x6')](),controller['index']);router[_0x4e94('0x5')](_0x4e94('0x7'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x8')]);router['get'](_0x4e94('0x9'),auth['isAuthenticated'](),controller[_0x4e94('0xa')]);router[_0x4e94('0x5')](_0x4e94('0xb'),auth[_0x4e94('0x6')](),controller['getMessages']);router[_0x4e94('0x5')](_0x4e94('0xc'),auth[_0x4e94('0x6')](),controller[_0x4e94('0xd')]);router[_0x4e94('0xe')]('/',auth[_0x4e94('0x6')](),controller[_0x4e94('0xf')]);router['post']('/:id/messages',auth[_0x4e94('0x6')](),controller[_0x4e94('0x10')]);router[_0x4e94('0xe')](_0x4e94('0x11'),auth[_0x4e94('0x6')](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x13')),controller[_0x4e94('0x14')]);router[_0x4e94('0x15')](_0x4e94('0x9'),auth[_0x4e94('0x6')](),interaction[_0x4e94('0x16')](_0x4e94('0x12'),_0x4e94('0x17')),controller[_0x4e94('0x18')]);router[_0x4e94('0x19')](_0x4e94('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x1a')),controller[_0x4e94('0x1b')]);router[_0x4e94('0x19')](_0x4e94('0x11'),auth['isAuthenticated'](),controller[_0x4e94('0x1c')]);module[_0x4e94('0x1d')]=router; \ No newline at end of file +var _0x56a4=['create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsapp','whatsappinteraction:destroy','removeTags','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x56a4,0x11b));var _0x456a=function(_0x532b5b,_0xce6ec8){_0x532b5b=_0x532b5b-0x0;var _0x169ff9=_0x56a4[_0x532b5b];return _0x169ff9;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/describe',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0x8')]('/:id',auth[_0x456a('0xa')](),controller['show']);router[_0x456a('0x8')](_0x456a('0xc'),auth[_0x456a('0xa')](),controller[_0x456a('0xd')]);router[_0x456a('0x8')](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0xf')]);router[_0x456a('0x10')]('/',auth[_0x456a('0xa')](),controller[_0x456a('0x11')]);router['post'](_0x456a('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x456a('0x10')](_0x456a('0x12'),auth[_0x456a('0xa')](),interaction[_0x456a('0x13')]('whatsapp',_0x456a('0x14')),controller[_0x456a('0x15')]);router[_0x456a('0x16')](_0x456a('0x17'),auth[_0x456a('0xa')](),interaction[_0x456a('0x13')]('whatsapp',_0x456a('0x18')),controller[_0x456a('0x19')]);router[_0x456a('0x1a')](_0x456a('0x17'),auth['isAuthenticated'](),interaction[_0x456a('0x13')](_0x456a('0x1b'),_0x456a('0x1c')),controller['destroy']);router[_0x456a('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x456a('0x1d')]);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 0ac825f..78de2a0 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 _0x2bae=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0xdfdff5,_0x323b16){var _0x430453=function(_0x5a495e){while(--_0x5a495e){_0xdfdff5['push'](_0xdfdff5['shift']());}};_0x430453(++_0x323b16);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));var moment=require(_0xe2ba('0x1'));module[_0xe2ba('0x2')]={'closed':{'type':Sequelize[_0xe2ba('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe2ba('0x4')]},'disposition':{'type':Sequelize[_0xe2ba('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe2ba('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe2ba('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe2ba('0x6')]('in',_0xe2ba('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe2ba('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe2ba('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe2ba('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0967=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x470f3b,_0x1af0e8){var _0xa509a2=function(_0xa609d){while(--_0xa609d){_0x470f3b['push'](_0x470f3b['shift']());}};_0xa509a2(++_0x1af0e8);}(_0x0967,0x100));var _0x7096=function(_0x3a397a,_0x3a5ecc){_0x3a397a=_0x3a397a-0x0;var _0x20cc04=_0x0967[_0x3a397a];return _0x20cc04;};'use strict';var Sequelize=require(_0x7096('0x0'));var moment=require('moment');module[_0x7096('0x1')]={'closed':{'type':Sequelize[_0x7096('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7096('0x3')]},'disposition':{'type':Sequelize[_0x7096('0x4')]},'secondDisposition':{'type':Sequelize[_0x7096('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7096('0x4')]},'note':{'type':Sequelize[_0x7096('0x4')]},'phone':{'type':Sequelize[_0x7096('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7096('0x5')]('in',_0x7096('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7096('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7096('0x5')]('in',_0x7096('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7096('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 b0287f0..7e545ee 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 _0x089f=['../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','catch','WhatsappInteraction','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','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','body','buildExpression','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','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)','groupBy','WhatsappInteractionId','rows','show','params','rawAttributes','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','ids','omit','nolimit','findAll','addTags','setTags','spread','Tag','emit','removeTags','download','unix','join','root','server','files','format','firstName','lastName','attachments','Attachment','Messages','secret','WhatsappAccount','Account','Owner','fullname','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','System','direction','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x2ee974,_0x1cceb5){var _0x20c5fb=function(_0xc54e84){while(--_0xc54e84){_0x2ee974['push'](_0x2ee974['shift']());}};_0x20c5fb(++_0x1cceb5);}(_0x089f,0x1c7));var _0xf089=function(_0xb81894,_0x157b63){_0xb81894=_0xb81894-0x0;var _0x2f6e8b=_0x089f[_0xb81894];return _0x2f6e8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf089('0x0'));var zipdir=require(_0xf089('0x1'));var jsonpatch=require(_0xf089('0x2'));var rp=require(_0xf089('0x3'));var moment=require(_0xf089('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf089('0x5'));var util=require(_0xf089('0x6'));var path=require(_0xf089('0x7'));var sox=require('sox');var csv=require(_0xf089('0x8'));var ejs=require(_0xf089('0x9'));var fs=require('fs');var fs_extra=require(_0xf089('0xa'));var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require(_0xf089('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf089('0x8'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf089('0x13'));var hardwareService=require(_0xf089('0x14'));var logger=require(_0xf089('0x15'))('api');var utils=require(_0xf089('0x16'));var config=require(_0xf089('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf089('0x18')]=_[_0xf089('0x19')](config['redis'],{'host':_0xf089('0x1a'),'port':0x18eb});var socket=require(_0xf089('0x1b'))(new Redis(config[_0xf089('0x18')]));require(_0xf089('0x1c'))['register'](socket);function respondWithStatusCode(_0x329719,_0x4e6438){_0x4e6438=_0x4e6438||0xcc;return function(_0x2d5f2b){if(_0x2d5f2b){return _0x329719['sendStatus'](_0x4e6438);}return _0x329719[_0xf089('0x1d')](_0x4e6438)['end']();};}function respondWithResult(_0x3bc27b,_0x250d5e){_0x250d5e=_0x250d5e||0xc8;return function(_0x157371){if(_0x157371){return _0x3bc27b[_0xf089('0x1d')](_0x250d5e)[_0xf089('0x1e')](_0x157371);}};}function respondWithFilteredResult(_0x57f2a7,_0x7fbed5){return function(_0x4e714a){if(_0x4e714a){var _0x407263=typeof _0x7fbed5[_0xf089('0x1f')]==='undefined'&&typeof _0x7fbed5[_0xf089('0x20')]===_0xf089('0x21');var _0x5eadfe=_0x4e714a[_0xf089('0x22')];var _0xc0c340=_0x407263?0x0:_0x7fbed5[_0xf089('0x1f')];var _0x2ab659=_0x407263?_0x4e714a[_0xf089('0x22')]:_0x7fbed5[_0xf089('0x1f')]+_0x7fbed5[_0xf089('0x20')];var _0x290cb8;if(_0x2ab659>=_0x5eadfe){_0x2ab659=_0x5eadfe;_0x290cb8=0xc8;}else{_0x290cb8=0xce;}_0x57f2a7[_0xf089('0x1d')](_0x290cb8);return _0x57f2a7[_0xf089('0x23')]('Content-Range',_0xc0c340+'-'+_0x2ab659+'/'+_0x5eadfe)[_0xf089('0x1e')](_0x4e714a);}return null;};}function patchUpdates(_0x31050f){return function(_0x46c1cf){try{jsonpatch[_0xf089('0x24')](_0x46c1cf,_0x31050f,!![]);}catch(_0x599b04){return BPromise[_0xf089('0x25')](_0x599b04);}return _0x46c1cf[_0xf089('0x26')]();};}function saveUpdates(_0x94df4d,_0x22f2f2){return function(_0x3a78fc){if(_0x3a78fc){return _0x3a78fc['update'](_0x94df4d)[_0xf089('0x27')](function(_0x598a4e){return _0x598a4e;});}return null;};}function removeEntity(_0x38078a,_0x372a7a){return function(_0x5ad3d4){if(_0x5ad3d4){return _0x5ad3d4[_0xf089('0x28')]()['then'](function(){_0x38078a['status'](0xcc)[_0xf089('0x29')]();});}};}function handleEntityNotFound(_0x220746,_0x2ffff6){return function(_0x3a4957){if(!_0x3a4957){_0x220746[_0xf089('0x2a')](0x194);}return _0x3a4957;};}function handleError(_0x52e6ac,_0x210147){_0x210147=_0x210147||0x1f4;return function(_0x531dd2){logger[_0xf089('0x2b')](_0x531dd2[_0xf089('0x2c')]);if(_0x531dd2[_0xf089('0x2d')]){delete _0x531dd2[_0xf089('0x2d')];}_0x52e6ac[_0xf089('0x1d')](_0x210147)[_0xf089('0x2e')](_0x531dd2);};}function getInteractionUsers(_0x3268ca,_0x29eb23){return new BPromise(function(_0x281fee,_0x2df2bb){try{if(_0x29eb23[_0x3268ca['id']]){_0x3268ca[_0xf089('0x2f')]=_[_0xf089('0x30')](_0x29eb23[_0x3268ca['id']],function(_0x5b85a4){return{'id':_0x5b85a4['id'],'fullname':_0x5b85a4['fullname']};});}}catch(_0x44036f){_0x2df2bb(_0x44036f);}_0x281fee(_0x3268ca);});}function getInteractionTags(_0x41741b,_0x3fcd88){return new BPromise(function(_0x26ec9c,_0x33f2d8){try{if(_0x41741b['TagIds']){_0x41741b['Tags']=[];_0x41741b[_0xf089('0x31')][_0xf089('0x32')](',')[_0xf089('0x33')](function(_0x6c58c7){_0x41741b[_0xf089('0x34')][_0xf089('0x35')](_0x3fcd88[_0x6c58c7]);});}delete _0x41741b[_0xf089('0x31')];}catch(_0x29bd70){_0x33f2d8(_0x29bd70);}_0x26ec9c(_0x41741b);});}function updateWhatsappInteraction(_0x41d699,_0x488746,_0x228e7e){return new BPromise(function(_0x5becf3,_0x12e975){return getInteractionUsers(_0x41d699,_0x228e7e)[_0xf089('0x27')](function(_0x5a5ab0){return getInteractionTags(_0x5a5ab0,_0x488746);})[_0xf089('0x27')](function(_0x1f49da){_0x5becf3(_0x1f49da);})[_0xf089('0x36')](function(_0x440798){_0x12e975(_0x440798);});});}exports['index']=function(_0x2108ca,_0x4d8b0c){var _0x3332f8={},_0x5ac407={},_0x5b51ba={'count':0x0,'rows':[]};var _0x4ef6c1=_[_0xf089('0x30')](db[_0xf089('0x37')]['rawAttributes'],function(_0x5f13f0){return{'name':_0x5f13f0['fieldName'],'type':_0x5f13f0[_0xf089('0x38')][_0xf089('0x39')]};});_0x5ac407[_0xf089('0x3a')]=_[_0xf089('0x30')](_0x4ef6c1,'name');_0x5ac407[_0xf089('0x3b')]=_[_0xf089('0x3c')](_0x2108ca[_0xf089('0x3b')]);_0x5ac407['filters']=_[_0xf089('0x3d')](_0x5ac407['model'],_0x5ac407[_0xf089('0x3b')]);_0x3332f8[_0xf089('0x3e')]=_[_0xf089('0x3d')](_0x5ac407[_0xf089('0x3a')],qs[_0xf089('0x3f')](_0x2108ca[_0xf089('0x3b')][_0xf089('0x3f')]));_0x3332f8[_0xf089('0x3e')]=_0x3332f8[_0xf089('0x3e')][_0xf089('0x40')]?_0x3332f8['attributes']:_0x5ac407[_0xf089('0x3a')];if(!_0x2108ca[_0xf089('0x3b')][_0xf089('0x41')]('nolimit')){_0x3332f8['limit']=qs[_0xf089('0x20')](_0x2108ca[_0xf089('0x3b')][_0xf089('0x20')]);_0x3332f8['offset']=qs[_0xf089('0x1f')](_0x2108ca[_0xf089('0x3b')]['offset']);}_0x3332f8[_0xf089('0x42')]=qs[_0xf089('0x43')](_0x2108ca['query'][_0xf089('0x43')]);_0x3332f8['where']=qs[_0xf089('0x44')](_[_0xf089('0x45')](_0x2108ca[_0xf089('0x3b')],_0x5ac407[_0xf089('0x44')]),_0x4ef6c1);var _0x35d038=[];var _0x5b823e=squel[_0xf089('0x46')]()[_0xf089('0x47')]('id')['field'](_0xf089('0x2d'))[_0xf089('0x47')](_0xf089('0x48'))[_0xf089('0x49')](_0xf089('0x4a'));var _0x1ae115=squel[_0xf089('0x46')]()['field']('u.id')['field'](_0xf089('0x4b'))[_0xf089('0x47')](_0xf089('0x4c'))[_0xf089('0x49')]('user_has_whatsapp_interactions','ui')[_0xf089('0x4d')]('users','u',_0xf089('0x4e'));var _0x108086=squel[_0xf089('0x46')]()['from'](_0xf089('0x4f'),'i')[_0xf089('0x4d')]('cm_contacts','c',_0xf089('0x50'))[_0xf089('0x4d')](_0xf089('0x51'),'o',_0xf089('0x52'))['left_join'](_0xf089('0x53'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xf089('0x54'),'me',_0xf089('0x55'))['left_join'](_0xf089('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3add84=squel[_0xf089('0x57')]();var _0x5e6ed0=[];var _0x33aad3=squel[_0xf089('0x57')]();var _0x30d9e1;if(_0x2108ca[_0xf089('0x3b')][_0xf089('0x58')]){_0x30d9e1=as[_0xf089('0x59')](_0x2108ca[_0xf089('0x3b')]['search']);var _0x334ed9=_0x30d9e1[_0xf089('0x5a')];for(var _0xc9fb1a=0x0;_0xc9fb1a<_0x30d9e1[_0xf089('0x5b')]['length'];_0xc9fb1a++){var _0x2d8c4e=_0x30d9e1[_0xf089('0x5b')][_0xc9fb1a];var _0x26989a='i';var _0xb14c2c=_[_0xf089('0x5c')](_0x4ef6c1,[_0xf089('0x2d'),_0x2d8c4e[_0xf089('0x47')]]);if(!_0xb14c2c){switch(_0x2d8c4e['field']){case'unreadMessages':if(_0x2d8c4e['value']==0x1){_0x108086[_0xf089('0x5d')]('`'+_0x2d8c4e[_0xf089('0x47')]+'`\x20=\x200');}else{_0x108086['having']('`'+_0x2d8c4e[_0xf089('0x47')]+_0xf089('0x5e'));}break;case _0xf089('0x5f'):if(_0x2d8c4e[_0xf089('0x60')]===_0xf089('0x61')){if(_0x2d8c4e[_0xf089('0x62')][_0xf089('0x32')]('\x20')['length']>0x1){_0x3add84[_0x334ed9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf089('0x63')](_0x2d8c4e[_0xf089('0x62')]),null);}else{var _0x411820='%'+_0x2d8c4e['value']+'%';_0x3add84[_0x334ed9](_0xf089('0x64'),_0x411820,_0x411820,_0x411820);}}else{_0xb14c2c=_[_0xf089('0x5c')](_0x4ef6c1,[_0xf089('0x2d'),_0xf089('0x65')]);_0x2d8c4e[_0xf089('0x47')]='ContactId';_0x441dba=as['buildExpression'](_0x26989a,_0xb14c2c[_0xf089('0x38')],_0x2d8c4e);_0x3add84[_0x334ed9](_0x441dba[_0xf089('0x66')],_0x441dba[_0xf089('0x62')]['start'],_0x441dba['value'][_0xf089('0x29')]);}break;case'Tag':var _0x26b5e7=_0x2d8c4e[_0xf089('0x62')][_0xf089('0x32')](',')['map'](function(_0x8dff33){return Number(_0x8dff33);});_0x26b5e7['forEach'](function(_0x477728){_0x33aad3['or'](_0xf089('0x67'),'%,'+_0x477728+',%');});_0x5e6ed0=_[_0xf089('0x68')](_0x5e6ed0,_0x26b5e7);break;case _0xf089('0x69'):if(_0x2d8c4e['operator']==='$substring'){_0x3add84[_0x334ed9](_0xf089('0x6a'),'%'+_0x2d8c4e['value']+'%',null);}else{_0xb14c2c=_[_0xf089('0x5c')](_0x4ef6c1,['name','UserId']);_0x2d8c4e[_0xf089('0x47')]=_0xf089('0x6b');_0x441dba=as['buildExpression'](_0x26989a,_0xb14c2c['type'],_0x2d8c4e);_0x3add84[_0x334ed9](_0x441dba[_0xf089('0x66')],_0x441dba['value'][_0xf089('0x6c')],_0x441dba[_0xf089('0x62')][_0xf089('0x29')]);}break;case _0xf089('0x6d'):_0x441dba=as[_0xf089('0x6e')]('me',null,_0x2d8c4e);_0x3add84[_0x334ed9](_0x441dba[_0xf089('0x66')],_0x441dba['value'][_0xf089('0x6c')],_0x441dba[_0xf089('0x62')]['end']);break;}}else{var _0x441dba=as[_0xf089('0x6e')](_0x26989a,_0xb14c2c[_0xf089('0x38')],_0x2d8c4e);_0x3add84[_0x334ed9](_0x441dba[_0xf089('0x66')],_0x441dba[_0xf089('0x62')][_0xf089('0x6c')],_0x441dba[_0xf089('0x62')][_0xf089('0x29')]);}}}else{var _0x1ac5cf=_(_0x2108ca[_0xf089('0x3b')])[_0xf089('0x3c')]()[_0xf089('0x30')](function(_0x2adbe0){return _[_0xf089('0x6f')](_0x4ef6c1,[_0xf089('0x2d'),_0x2adbe0])?_0x2adbe0:undefined;})[_0xf089('0x70')]()['value']();if(!_['isEmpty'](_0x1ac5cf)){_0x1ac5cf[_0xf089('0x33')](function(_0xce06d8){if(_0xce06d8===_0xf089('0x71')){_0x108086[_0xf089('0x72')](_0xf089('0x73'),[][_0xf089('0x74')](_0x2108ca['query'][_0xce06d8]));}else if(_0xce06d8===_0xf089('0x75')){var _0x12913c=JSON[_0xf089('0x76')](_0x2108ca['query'][_0xce06d8])[_0xf089('0x77')];var _0x108ea3=JSON[_0xf089('0x76')](_0x2108ca[_0xf089('0x3b')][_0xce06d8])['$lte'];_0x108086[_0xf089('0x72')](_0xf089('0x78'),_0x12913c,_0x108ea3);}else{if(_0x2108ca[_0xf089('0x3b')][_0xce06d8]===_0xf089('0x79')){_0x108086[_0xf089('0x72')]('i.'+_0xce06d8+_0xf089('0x7a'));}else{_0x108086['where']('i.'+_0xce06d8+'\x20=\x20?',_0x2108ca[_0xf089('0x3b')][_0xce06d8]);}}});}if(_0x2108ca[_0xf089('0x3b')][_0xf089('0x7b')]){if(_0x2108ca[_0xf089('0x3b')]['read']==0x1){_0x108086[_0xf089('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x108086[_0xf089('0x5d')](_0xf089('0x7c'));}}if(_0x2108ca[_0xf089('0x3b')][_0xf089('0x7d')]){_0x5e6ed0=_[_0xf089('0x7e')](_0x2108ca['query'][_0xf089('0x7d')])?_0x2108ca['query'][_0xf089('0x7d')]:new Array(_0x2108ca[_0xf089('0x3b')][_0xf089('0x7d')]);_0x5e6ed0['forEach'](function(_0x2a7bc7){_0x33aad3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a7bc7+',%');});}if(_0x2108ca[_0xf089('0x3b')][_0xf089('0x7f')]){var _0x1e5594=_0x2108ca[_0xf089('0x3b')]['filter'][_0xf089('0x80')]('\x5c','\x5c\x5c')[_0xf089('0x80')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1e5594)){_0x3add84['or']('i.id\x20LIKE\x20?',_0x1e5594+'%')['or'](_0xf089('0x81'),_0x1e5594+'%');}else{_0x3add84['or'](_0xf089('0x82'),qs['getFullTextValue'](_0x1e5594))['or'](_0xf089('0x83'),_0x1e5594+'%');}}}_0x108086['where'](_0x3add84);_0x108086['group'](_0xf089('0x84'));var _0x1b74d4={'type':db[_0xf089('0x85')][_0xf089('0x86')][_0xf089('0x87')],'raw':!![]};var _0x4db27=_0x108086['clone']();_0x4db27['field'](_0xf089('0x84'));_0x4db27['field'](_0xf089('0x88'),'unreadMessages');if(_0x3332f8['order']){_0x3332f8['order'][_0xf089('0x33')](function(_0x34bf2f){var _0x49eb29=_0x34bf2f[0x0]===_0xf089('0x89')?_0x34bf2f[0x0]:'i.'+_0x34bf2f[0x0];_0x108086['order'](_0x49eb29,_0x34bf2f[0x1]===_0xf089('0x8a')?![]:!![]);});}if(!_[_0xf089('0x8b')](_0x5e6ed0)){_0x108086[_0xf089('0x5d')](_0x33aad3);_0x4db27[_0xf089('0x72')](_0xf089('0x8c'),_0x5e6ed0);}BPromise[_0xf089('0x8d')]()['then'](function(){if(!_0x30d9e1){if(_0x2108ca[_0xf089('0x3b')][_0xf089('0x71')])return;_0x4db27[_0xf089('0x72')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x108086[_0xf089('0x72')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2108ca[_0xf089('0x8e')]['role']!==_0xf089('0x8f'))return;return _0x2108ca[_0xf089('0x8e')][_0xf089('0x90')]({'attributes':['id'],'raw':!![]})[_0xf089('0x27')](function(_0x3e7f38){if(_[_0xf089('0x8b')](_0x3e7f38)){_0x4db27[_0xf089('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x108086['where'](_0xf089('0x91'));}else{_0x4db27[_0xf089('0x72')](_0xf089('0x73'),_[_0xf089('0x30')](_0x3e7f38,'id'));_0x108086[_0xf089('0x72')](_0xf089('0x73'),_[_0xf089('0x30')](_0x3e7f38,'id'));}});})[_0xf089('0x27')](function(){if(_0x2108ca[_0xf089('0x8e')][_0xf089('0x92')]===_0xf089('0x8f')&&!_0x30d9e1&&!_0x2108ca[_0xf089('0x3b')][_0xf089('0x71')])return[];return db[_0xf089('0x93')][_0xf089('0x3b')](_0x4db27[_0xf089('0x94')](),_0x1b74d4);})['then'](function(_0x5e5f53){_0x5b51ba[_0xf089('0x22')]=_0x5e5f53[_0xf089('0x40')];if(_0x5b51ba[_0xf089('0x22')]===0x0)return[];return db[_0xf089('0x93')][_0xf089('0x3b')](_0x5b823e['toString'](),_0x1b74d4)[_0xf089('0x27')](function(_0x295453){_0x35d038=_[_0xf089('0x95')](_0x295453,'id');_0x1b74d4=_[_0xf089('0x96')](_0x1b74d4,{'model':db[_0xf089('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2108ca['query']['fields']){_0x3332f8[_0xf089('0x3e')]['forEach'](function(_0x4c4e28){_0x108086[_0xf089('0x47')]('i.'+_0x4c4e28);});}else{_0x108086[_0xf089('0x47')](_0xf089('0x88'),_0xf089('0x97'));_0x108086[_0xf089('0x47')](_0xf089('0x98'),_0xf089('0x99'));_0x108086[_0xf089('0x47')](_0xf089('0x9a'),_0xf089('0x9b'));_0x108086[_0xf089('0x47')](_0xf089('0x9c'),_0xf089('0x89'));_0x108086['field'](_0xf089('0x9d'));_0x108086[_0xf089('0x47')](_0xf089('0x9e'),_0xf089('0x9f'));_0x108086[_0xf089('0x47')]('c.lastName',_0xf089('0xa0'));_0x108086[_0xf089('0x47')](_0xf089('0xa1'),_0xf089('0xa2'));_0x108086[_0xf089('0x47')](_0xf089('0xa3'),_0xf089('0xa4'));_0x108086[_0xf089('0x47')](_0xf089('0xa5'),_0xf089('0xa6'));_0x108086[_0xf089('0x47')]('c.fax',_0xf089('0xa7'));_0x108086[_0xf089('0x47')](_0xf089('0xa8'),_0xf089('0xa9'));_0x108086['field'](_0xf089('0xaa'),_0xf089('0xab'));_0x108086['field'](_0xf089('0xac'),'TagIds');}if(_0x3332f8[_0xf089('0x20')])_0x108086[_0xf089('0x20')](_0x3332f8[_0xf089('0x20')]);if(_0x3332f8[_0xf089('0x1f')])_0x108086[_0xf089('0x1f')](_0x3332f8[_0xf089('0x1f')]);return db['sequelize'][_0xf089('0x3b')](_0x108086[_0xf089('0x94')](),_0x1b74d4);})[_0xf089('0x27')](function(_0xdb09c6){if(_0xdb09c6[_0xf089('0x40')]>0x0)_0x1ae115[_0xf089('0x72')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xf089('0x30')](_0xdb09c6,'id'));return db[_0xf089('0x93')]['query'](_0x1ae115[_0xf089('0x94')](),_0x1b74d4)['then'](function(_0x262be0){var _0x4d9dd5=_[_0xf089('0xad')](_0x262be0,_0xf089('0xae'));var _0x24ca31=[];_0xdb09c6[_0xf089('0x33')](function(_0x4fcb46){_0x24ca31[_0xf089('0x35')](updateWhatsappInteraction(_0x4fcb46,_0x35d038,_0x4d9dd5));});return BPromise['all'](_0x24ca31);});});})[_0xf089('0x27')](function(_0x41353f){_0x5b51ba[_0xf089('0xaf')]=_0x41353f;return _0x5b51ba;})[_0xf089('0x27')](respondWithFilteredResult(_0x4d8b0c,_0x3332f8))['catch'](handleError(_0x4d8b0c,null));};exports[_0xf089('0xb0')]=function(_0x2c817d,_0x1cf382){var _0x30c357={'raw':![],'where':{'id':_0x2c817d[_0xf089('0xb1')]['id']}},_0x300345={};_0x300345['model']=_[_0xf089('0x3c')](db[_0xf089('0x37')][_0xf089('0xb2')]);_0x300345[_0xf089('0x3b')]=_[_0xf089('0x3c')](_0x2c817d['query']);_0x300345[_0xf089('0x44')]=_['intersection'](_0x300345[_0xf089('0x3a')],_0x300345[_0xf089('0x3b')]);_0x30c357[_0xf089('0x3e')]=_[_0xf089('0x3d')](_0x300345[_0xf089('0x3a')],qs['fields'](_0x2c817d[_0xf089('0x3b')][_0xf089('0x3f')]));_0x30c357['attributes']=_0x30c357[_0xf089('0x3e')][_0xf089('0x40')]?_0x30c357[_0xf089('0x3e')]:_0x300345[_0xf089('0x3a')];if(_0x2c817d['query'][_0xf089('0xb3')]){_0x30c357[_0xf089('0xb4')]=[{'all':!![]}];}_0x30c357=_[_0xf089('0x96')]({},_0x30c357,_0x2c817d[_0xf089('0xb5')]);return db[_0xf089('0x37')][_0xf089('0x5c')](_0x30c357)[_0xf089('0x27')](handleEntityNotFound(_0x1cf382,null))[_0xf089('0x27')](respondWithResult(_0x1cf382,null))['catch'](handleError(_0x1cf382,null));};exports[_0xf089('0xb6')]=function(_0x449c03,_0x186554){return db[_0xf089('0x37')][_0xf089('0xb6')](_0x449c03['body'],{})[_0xf089('0x27')](respondWithResult(_0x186554,0xc9))[_0xf089('0x36')](handleError(_0x186554,null));};exports[_0xf089('0xb7')]=function(_0x7912ab,_0xe5b915){if(_0x7912ab[_0xf089('0x6d')]['id']){delete _0x7912ab[_0xf089('0x6d')]['id'];}return db[_0xf089('0x37')][_0xf089('0x5c')]({'where':{'id':_0x7912ab['params']['id']}})[_0xf089('0x27')](handleEntityNotFound(_0xe5b915,null))['then'](saveUpdates(_0x7912ab[_0xf089('0x6d')],null))[_0xf089('0x27')](respondWithResult(_0xe5b915,null))[_0xf089('0x36')](handleError(_0xe5b915,null));};exports[_0xf089('0x28')]=function(_0x218749,_0x1219ad){return db['WhatsappInteraction'][_0xf089('0x5c')]({'where':{'id':_0x218749['params']['id']}})['then'](handleEntityNotFound(_0x1219ad,null))[_0xf089('0x27')](removeEntity(_0x1219ad,null))[_0xf089('0x36')](handleError(_0x1219ad,null));};exports[_0xf089('0xb8')]=function(_0x4f60f3,_0x287140){return db[_0xf089('0x37')][_0xf089('0xb8')]()[_0xf089('0x27')](respondWithResult(_0x287140,null))[_0xf089('0x36')](handleError(_0x287140,null));};exports[_0xf089('0xb9')]=function(_0x2e0bb6,_0x4639f9,_0x4b6756){return db[_0xf089('0xba')]['find']({'where':{'id':_0x2e0bb6[_0xf089('0xb1')]['id']}})[_0xf089('0x27')](handleEntityNotFound(_0x4639f9,null))[_0xf089('0x27')](function(_0x4d2c59){if(_0x4d2c59){return _0x4d2c59[_0xf089('0xb9')](_0x2e0bb6[_0xf089('0x6d')][_0xf089('0xbb')],_[_0xf089('0xbc')](_0x2e0bb6[_0xf089('0x6d')],['ids','id'])||{});}})['then'](respondWithResult(_0x4639f9,null))['catch'](handleError(_0x4639f9,null));};exports['getMessages']=function(_0xfabe38,_0x367edb,_0x547e97){var _0x4d467f={'raw':![],'where':{}};var _0x3e1043={};var _0x12f956={'count':0x0,'rows':[]};return db[_0xf089('0x37')]['findOne']({'where':{'id':_0xfabe38[_0xf089('0xb1')]['id']}})['then'](handleEntityNotFound(_0x367edb,null))[_0xf089('0x27')](function(_0x5a5f22){if(_0x5a5f22){_0x3e1043['model']=_[_0xf089('0x3c')](db['WhatsappMessage'][_0xf089('0xb2')]);_0x3e1043[_0xf089('0x3b')]=_['keys'](_0xfabe38['query']);_0x3e1043['filters']=_['intersection'](_0x3e1043['model'],_0x3e1043[_0xf089('0x3b')]);_0x4d467f[_0xf089('0x3e')]=_[_0xf089('0x3d')](_0x3e1043[_0xf089('0x3a')],qs[_0xf089('0x3f')](_0xfabe38[_0xf089('0x3b')][_0xf089('0x3f')]));_0x4d467f[_0xf089('0x3e')]=_0x4d467f[_0xf089('0x3e')][_0xf089('0x40')]?_0x4d467f[_0xf089('0x3e')]:_0x3e1043[_0xf089('0x3a')];if(!_0xfabe38['query'][_0xf089('0x41')](_0xf089('0xbd'))){_0x4d467f[_0xf089('0x20')]=qs[_0xf089('0x20')](_0xfabe38[_0xf089('0x3b')]['limit']);_0x4d467f[_0xf089('0x1f')]=qs[_0xf089('0x1f')](_0xfabe38[_0xf089('0x3b')][_0xf089('0x1f')]);}_0x4d467f['order']=qs[_0xf089('0x43')](_0xfabe38[_0xf089('0x3b')][_0xf089('0x43')]);_0x4d467f[_0xf089('0x72')]=qs[_0xf089('0x44')](_[_0xf089('0x45')](_0xfabe38['query'],_0x3e1043['filters']));_0x4d467f[_0xf089('0x72')][_0xf089('0xae')]=_0x5a5f22['id'];if(_0xfabe38['query'][_0xf089('0x7f')]){_0x4d467f[_0xf089('0x72')]=_[_0xf089('0x96')](_0x4d467f[_0xf089('0x72')],{'$or':_[_0xf089('0x30')](_0x4d467f['attributes'],function(_0x47c9db){var _0x23d954={};_0x23d954[_0x47c9db]={'$like':'%'+_0xfabe38[_0xf089('0x3b')][_0xf089('0x7f')]+'%'};return _0x23d954;})});}if(_0xfabe38[_0xf089('0x3b')][_0xf089('0x77')]){var _0x3f2003=_0xfabe38['query'][_0xf089('0x77')][_0xf089('0x32')](',');var _0x56f30b={};_0x56f30b[_0x3f2003[0x0]]={'$gte':moment(_0x3f2003[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4d467f[_0xf089('0x72')]=_[_0xf089('0x96')](_0x4d467f[_0xf089('0x72')],_0x56f30b);}_0x4d467f=_['merge']({},_0x4d467f,_0xfabe38[_0xf089('0xb5')]);return db[_0xf089('0xba')][_0xf089('0x22')]({'where':_0x4d467f[_0xf089('0x72')]})['then'](function(_0x39952a){_0x12f956[_0xf089('0x22')]=_0x39952a;if(_0xfabe38[_0xf089('0x3b')]['includeAll']){_0x4d467f['include']=[{'all':!![]}];}return db[_0xf089('0xba')][_0xf089('0xbe')](_0x4d467f);})[_0xf089('0x27')](function(_0x1ca043){_0x12f956[_0xf089('0xaf')]=_0x1ca043;return _0x12f956;});}})[_0xf089('0x27')](respondWithFilteredResult(_0x367edb,_0x4d467f))[_0xf089('0x36')](handleError(_0x367edb,null));};exports[_0xf089('0xbf')]=function(_0x222877,_0x2458a8,_0x4e542d){return db[_0xf089('0x37')][_0xf089('0x5c')]({'where':{'id':_0x222877[_0xf089('0xb1')]['id']}})[_0xf089('0x27')](handleEntityNotFound(_0x2458a8,null))[_0xf089('0x27')](function(_0x191eb4){if(_0x191eb4){return _0x191eb4[_0xf089('0xc0')](_0x222877[_0xf089('0x6d')][_0xf089('0xbb')],_[_0xf089('0xbc')](_0x222877['body'],[_0xf089('0xbb'),'id'])||{})[_0xf089('0xc1')](function(){return db[_0xf089('0xc2')][_0xf089('0xbe')]({'attributes':['id',_0xf089('0x2d'),'color'],'where':{'id':_0x222877[_0xf089('0x6d')][_0xf089('0xbb')]}});})[_0xf089('0x27')](function(_0x299dda){socket[_0xf089('0xc3')]('whatsappInteractionTags:save',{'id':Number(_0x222877[_0xf089('0xb1')]['id']),'tags':_0x299dda||[]});return{'id':Number(_0x222877['params']['id']),'tags':_0x299dda||[]};});}})[_0xf089('0x27')](respondWithResult(_0x2458a8,null))[_0xf089('0x36')](handleError(_0x2458a8,null));};exports[_0xf089('0xc4')]=function(_0xd08ec9,_0x4fc816,_0x1e2547){return db[_0xf089('0x37')][_0xf089('0x5c')]({'where':{'id':_0xd08ec9[_0xf089('0xb1')]['id']}})[_0xf089('0x27')](handleEntityNotFound(_0x4fc816,null))[_0xf089('0x27')](function(_0x1b8d3d){if(_0x1b8d3d){return _0x1b8d3d[_0xf089('0xc4')](_0xd08ec9[_0xf089('0x3b')][_0xf089('0xbb')]);}})[_0xf089('0x27')](respondWithStatusCode(_0x4fc816,null))[_0xf089('0x36')](handleError(_0x4fc816,null));};exports[_0xf089('0xc5')]=function(_0x3394e2,_0x375487){var _0x426371=moment()[_0xf089('0xc6')]()[_0xf089('0x94')]();var _0x285b31=path[_0xf089('0xc7')](config['root'],'server','files','tmp');var _0x33b040=path[_0xf089('0xc7')](config[_0xf089('0xc8')],_0xf089('0xc9'),_0xf089('0xca'),'attachments');var _0x2aeea2=path['join'](_0x285b31,_0x426371);var _0x100300=util[_0xf089('0xcb')]('transcript-%d-%s.zip',_0x3394e2['params']['id'],_0x426371);var _0x1fd642=path[_0xf089('0xc7')](_0x285b31,_0x100300);var _0x189c75=[];_0x189c75[_0xf089('0x35')]({'model':db['User'],'as':_0xf089('0x69'),'attributes':['id','fullname'],'raw':!![]});_0x189c75[_0xf089('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf089('0xcc'),_0xf089('0xcd')],'raw':!![]});if(_0x3394e2[_0xf089('0x3b')][_0xf089('0xce')]){_0x189c75['push']({'model':db[_0xf089('0xcf')],'as':_0xf089('0xcf'),'raw':!![]});}var _0x15bbca=[{'model':db[_0xf089('0xba')],'as':_0xf089('0xd0'),'attributes':['id',_0xf089('0x6d'),'createdAt','direction',_0xf089('0xd1'),_0xf089('0x7b')],'include':_0x189c75}];_0x15bbca['push']({'model':db[_0xf089('0xd2')],'as':_0xf089('0xd3'),'attributes':['id','name']});_0x15bbca[_0xf089('0x35')]({'model':db[_0xf089('0x69')],'as':_0xf089('0xd4'),'attributes':['id',_0xf089('0xd5')]});return db[_0xf089('0x37')][_0xf089('0x5c')]({'where':{'id':_0x3394e2[_0xf089('0xb1')]['id']},'include':_0x15bbca})[_0xf089('0x27')](handleEntityNotFound(_0x375487,null))[_0xf089('0x27')](function(_0x2f99dd){if(_0x2f99dd){var _0x559a4c=_0x2f99dd['get']({'plain':!![]});fs[_0xf089('0xd6')](_0x2aeea2);var _0x1fcf68={'channel':_0xf089('0xd7'),'account':_0x559a4c['Account']['name'],'agent':_0x559a4c[_0xf089('0xd4')]?_0x559a4c[_0xf089('0xd4')]['fullname']:_0xf089('0xd8'),'createdAt':moment(_0x559a4c['createdAt'])[_0xf089('0xcb')](_0xf089('0xd9'))[_0xf089('0x94')](),'closedAt':_0x559a4c[_0xf089('0xda')]?moment(_0x559a4c[_0xf089('0xdb')])[_0xf089('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf089('0x94')]():'','disposition':_0x559a4c[_0xf089('0xdc')],'messages':_(_0x559a4c[_0xf089('0xd0')])[_0xf089('0x7f')]({'secret':![]})[_0xf089('0x30')](function(_0x217948){if(_0x217948['Attachment']){var _0x54d816=path[_0xf089('0xc7')](_0x33b040,_0x217948['Attachment'][_0xf089('0xdd')]);if(fs[_0xf089('0xde')](_0x54d816)){fs['createReadStream'](_0x54d816)[_0xf089('0xdf')](fs[_0xf089('0xe0')](path[_0xf089('0xc7')](_0x2aeea2,_0x217948['Attachment'][_0xf089('0xdd')])));}}return{'date':moment(_0x217948[_0xf089('0x75')])[_0xf089('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf089('0x94')](),'sender':_0x217948['direction']==='out'?_0x217948['User']?_0x217948[_0xf089('0x69')][_0xf089('0xd5')]:_0xf089('0xe1'):_0x217948['Contact'][_0xf089('0xcc')]+(_0x217948[_0xf089('0x5f')]['lastName']?'\x20'+_0x217948[_0xf089('0x5f')]['lastName']:''),'body':_0x217948[_0xf089('0xcf')]?_0x217948['Attachment'][_0xf089('0xdd')]:_0x217948[_0xf089('0x6d')],'direction':_0x217948[_0xf089('0xe2')]===_0xf089('0xe3')?'A':'C','secret':_0x217948[_0xf089('0xd1')],'read':_0x217948[_0xf089('0x7b')],'attachment':_0x217948['Attachment']};})['value']()};return ejs[_0xf089('0xe4')](path[_0xf089('0xc7')](config['root'],_0xf089('0xc9'),_0xf089('0xe5'),_0xf089('0xe6')),{'interaction':_0x1fcf68})[_0xf089('0x27')](function(_0x30bcee){var _0x5dc505=path[_0xf089('0xc7')](_0x2aeea2,_0xf089('0xe7')+_0x559a4c['id']+'-'+_0x426371+_0xf089('0xe8'));var _0x1565db={'path':_0x5dc505,'channel':_0xf089('0xd7'),'interactionId':_0x559a4c['id']};return pdf[_0xf089('0xe9')](_0x30bcee,_0x1565db);})['then'](function(){return new BPromise(function(_0x4496ff,_0x401194){zipdir(_0x2aeea2,{'saveTo':_0x1fd642},function(_0x412557,_0x9e41ea){if(_0x412557)return _0x401194(_0x412557);return _0x4496ff(_0x9e41ea);});})['then'](function(){return new BPromise(function(_0x3fecd7,_0x2610ad){rimraf(_0x2aeea2,function(_0x2bb954){if(_0x2bb954)_0x2610ad(_0x2bb954);return _0x3fecd7();});});})[_0xf089('0x27')](function(){return _0x375487[_0xf089('0xc5')](_0x1fd642,_0x100300,function(_0x367161){if(_0x367161){console[_0xf089('0xea')]('err',_0x367161);}else{fs[_0xf089('0xeb')](_0x1fd642);}});});});}else{return _0x375487[_0xf089('0x2a')](0xc8);}})[_0xf089('0x36')](handleError(_0x375487,null));}; \ No newline at end of file +var _0x1bb2=['role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','rows','catch','show','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','pick','WhatsappInteractionId','merge','findAll','setTags','spread','emit','download','unix','files','tmp','root','attachments','join','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','createReadStream','pipe','out','System','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','Users','fullname','Tags','TagIds','split','forEach','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','select','field','color','from','u.id','u.fullname','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\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)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL'];(function(_0x2c8b66,_0x32c316){var _0x82b303=function(_0x1cf916){while(--_0x1cf916){_0x2c8b66['push'](_0x2c8b66['shift']());}};_0x82b303(++_0x32c316);}(_0x1bb2,0x152));var _0x21bb=function(_0x1f4e39,_0xa2aa6a){_0x1f4e39=_0x1f4e39-0x0;var _0x1b8001=_0x1bb2[_0x1f4e39];return _0x1b8001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21bb('0x0'));var zipdir=require(_0x21bb('0x1'));var jsonpatch=require(_0x21bb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21bb('0x3'));var Mustache=require(_0x21bb('0x4'));var util=require(_0x21bb('0x5'));var path=require(_0x21bb('0x6'));var sox=require(_0x21bb('0x7'));var csv=require(_0x21bb('0x8'));var ejs=require(_0x21bb('0x9'));var fs=require('fs');var fs_extra=require(_0x21bb('0xa'));var _=require(_0x21bb('0xb'));var squel=require(_0x21bb('0xc'));var crypto=require(_0x21bb('0xd'));var jsforce=require(_0x21bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21bb('0x8'));var querystring=require('querystring');var Papa=require(_0x21bb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21bb('0x10'));var as=require(_0x21bb('0x11'));var pdf=require(_0x21bb('0x12'));var hardwareService=require(_0x21bb('0x13'));var logger=require(_0x21bb('0x14'))(_0x21bb('0x15'));var utils=require(_0x21bb('0x16'));var config=require(_0x21bb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x21bb('0x18'))['db'];config[_0x21bb('0x19')]=_['defaults'](config[_0x21bb('0x19')],{'host':_0x21bb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21bb('0x19')]));require(_0x21bb('0x1b'))[_0x21bb('0x1c')](socket);function respondWithStatusCode(_0x3fd2d9,_0x5a66d5){_0x5a66d5=_0x5a66d5||0xcc;return function(_0x2eaa36){if(_0x2eaa36){return _0x3fd2d9['sendStatus'](_0x5a66d5);}return _0x3fd2d9['status'](_0x5a66d5)[_0x21bb('0x1d')]();};}function respondWithResult(_0x1ef9a5,_0x2a8656){_0x2a8656=_0x2a8656||0xc8;return function(_0x465f5e){if(_0x465f5e){return _0x1ef9a5[_0x21bb('0x1e')](_0x2a8656)[_0x21bb('0x1f')](_0x465f5e);}};}function respondWithFilteredResult(_0x3497cf,_0x15fc36){return function(_0x4393d8){if(_0x4393d8){var _0x17ee1d=typeof _0x15fc36[_0x21bb('0x20')]==='undefined'&&typeof _0x15fc36[_0x21bb('0x21')]===_0x21bb('0x22');var _0x436ea6=_0x4393d8['count'];var _0x46b5f7=_0x17ee1d?0x0:_0x15fc36[_0x21bb('0x20')];var _0x271a9f=_0x17ee1d?_0x4393d8[_0x21bb('0x23')]:_0x15fc36[_0x21bb('0x20')]+_0x15fc36[_0x21bb('0x21')];var _0x171ec6;if(_0x271a9f>=_0x436ea6){_0x271a9f=_0x436ea6;_0x171ec6=0xc8;}else{_0x171ec6=0xce;}_0x3497cf[_0x21bb('0x1e')](_0x171ec6);return _0x3497cf[_0x21bb('0x24')](_0x21bb('0x25'),_0x46b5f7+'-'+_0x271a9f+'/'+_0x436ea6)[_0x21bb('0x1f')](_0x4393d8);}return null;};}function patchUpdates(_0xf209cd){return function(_0x5ed52b){try{jsonpatch[_0x21bb('0x26')](_0x5ed52b,_0xf209cd,!![]);}catch(_0x2b2bc3){return BPromise[_0x21bb('0x27')](_0x2b2bc3);}return _0x5ed52b['save']();};}function saveUpdates(_0x35a313,_0x53a3bf){return function(_0x303960){if(_0x303960){return _0x303960[_0x21bb('0x28')](_0x35a313)[_0x21bb('0x29')](function(_0x3239e2){return _0x3239e2;});}return null;};}function removeEntity(_0x112412,_0x14c336){return function(_0x4db3ad){if(_0x4db3ad){return _0x4db3ad[_0x21bb('0x2a')]()[_0x21bb('0x29')](function(){_0x112412[_0x21bb('0x1e')](0xcc)[_0x21bb('0x1d')]();});}};}function handleEntityNotFound(_0x5ddcd6,_0x44d720){return function(_0x26c46a){if(!_0x26c46a){_0x5ddcd6[_0x21bb('0x2b')](0x194);}return _0x26c46a;};}function handleError(_0x1dff25,_0xc6ae64){_0xc6ae64=_0xc6ae64||0x1f4;return function(_0x2c09d6){logger[_0x21bb('0x2c')](_0x2c09d6[_0x21bb('0x2d')]);if(_0x2c09d6['name']){delete _0x2c09d6[_0x21bb('0x2e')];}_0x1dff25[_0x21bb('0x1e')](_0xc6ae64)['send'](_0x2c09d6);};}function getInteractionUsers(_0x75418b,_0x38857e){return new BPromise(function(_0x15ca00,_0x58166a){try{if(_0x38857e[_0x75418b['id']]){_0x75418b[_0x21bb('0x2f')]=_['map'](_0x38857e[_0x75418b['id']],function(_0x2ca209){return{'id':_0x2ca209['id'],'fullname':_0x2ca209[_0x21bb('0x30')]};});}}catch(_0xa113b0){_0x58166a(_0xa113b0);}_0x15ca00(_0x75418b);});}function getInteractionTags(_0x3c58d5,_0x5713d8){return new BPromise(function(_0x32b374,_0x24dac3){try{if(_0x3c58d5['TagIds']){_0x3c58d5[_0x21bb('0x31')]=[];_0x3c58d5[_0x21bb('0x32')][_0x21bb('0x33')](',')[_0x21bb('0x34')](function(_0x1ea462){_0x3c58d5[_0x21bb('0x31')]['push'](_0x5713d8[_0x1ea462]);});}delete _0x3c58d5[_0x21bb('0x32')];}catch(_0x2bf5bc){_0x24dac3(_0x2bf5bc);}_0x32b374(_0x3c58d5);});}function updateWhatsappInteraction(_0x50bde9,_0x45015b,_0x68cbd5){return new BPromise(function(_0x54ef55,_0xe74f9a){return getInteractionUsers(_0x50bde9,_0x68cbd5)[_0x21bb('0x29')](function(_0x27b83d){return getInteractionTags(_0x27b83d,_0x45015b);})[_0x21bb('0x29')](function(_0x58e25a){_0x54ef55(_0x58e25a);})['catch'](function(_0x2b8d0d){_0xe74f9a(_0x2b8d0d);});});}exports['index']=function(_0x41a772,_0x59aedf){var _0x2a50d7={},_0x37bfcf={},_0x420495={'count':0x0,'rows':[]};var _0x7a0ab8=_[_0x21bb('0x35')](db['WhatsappInteraction']['rawAttributes'],function(_0xee3a6b){return{'name':_0xee3a6b[_0x21bb('0x36')],'type':_0xee3a6b[_0x21bb('0x37')][_0x21bb('0x38')]};});_0x37bfcf[_0x21bb('0x39')]=_['map'](_0x7a0ab8,'name');_0x37bfcf[_0x21bb('0x3a')]=_[_0x21bb('0x3b')](_0x41a772[_0x21bb('0x3a')]);_0x37bfcf['filters']=_[_0x21bb('0x3c')](_0x37bfcf['model'],_0x37bfcf[_0x21bb('0x3a')]);_0x2a50d7[_0x21bb('0x3d')]=_[_0x21bb('0x3c')](_0x37bfcf['model'],qs['fields'](_0x41a772[_0x21bb('0x3a')][_0x21bb('0x3e')]));_0x2a50d7[_0x21bb('0x3d')]=_0x2a50d7[_0x21bb('0x3d')]['length']?_0x2a50d7[_0x21bb('0x3d')]:_0x37bfcf[_0x21bb('0x39')];if(!_0x41a772['query']['hasOwnProperty']('nolimit')){_0x2a50d7[_0x21bb('0x21')]=qs[_0x21bb('0x21')](_0x41a772[_0x21bb('0x3a')][_0x21bb('0x21')]);_0x2a50d7[_0x21bb('0x20')]=qs[_0x21bb('0x20')](_0x41a772[_0x21bb('0x3a')][_0x21bb('0x20')]);}_0x2a50d7[_0x21bb('0x3f')]=qs['sort'](_0x41a772[_0x21bb('0x3a')][_0x21bb('0x40')]);_0x2a50d7[_0x21bb('0x41')]=qs['filters'](_['pick'](_0x41a772['query'],_0x37bfcf[_0x21bb('0x42')]),_0x7a0ab8);var _0x4d890e=[];var _0x27c5e6=squel[_0x21bb('0x43')]()[_0x21bb('0x44')]('id')['field'](_0x21bb('0x2e'))['field'](_0x21bb('0x45'))[_0x21bb('0x46')]('tools_tags');var _0xa6c4c5=squel[_0x21bb('0x43')]()[_0x21bb('0x44')](_0x21bb('0x47'))[_0x21bb('0x44')](_0x21bb('0x48'))[_0x21bb('0x44')]('ui.WhatsappInteractionId')[_0x21bb('0x46')]('user_has_whatsapp_interactions','ui')['left_join']('users','u',_0x21bb('0x49'));var _0x826525=squel[_0x21bb('0x43')]()[_0x21bb('0x46')](_0x21bb('0x4a'),'i')[_0x21bb('0x4b')](_0x21bb('0x4c'),'c',_0x21bb('0x4d'))[_0x21bb('0x4b')](_0x21bb('0x4e'),'o',_0x21bb('0x4f'))['left_join'](_0x21bb('0x50'),'a',_0x21bb('0x51'))[_0x21bb('0x4b')](_0x21bb('0x52'),'me',_0x21bb('0x53'))[_0x21bb('0x4b')](_0x21bb('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x21bb('0x4b')](_0x21bb('0x55'),'t',_0x21bb('0x56'));var _0x20e7ad=squel[_0x21bb('0x57')]();var _0x522a79=[];var _0x216fe5=squel[_0x21bb('0x57')]();var _0x2f40ba;if(_0x41a772[_0x21bb('0x3a')]['search']){_0x2f40ba=as[_0x21bb('0x58')](_0x41a772['query'][_0x21bb('0x59')]);var _0x4330f5=_0x2f40ba[_0x21bb('0x5a')];for(var _0x4749ad=0x0;_0x4749ad<_0x2f40ba[_0x21bb('0x5b')]['length'];_0x4749ad++){var _0x481711=_0x2f40ba[_0x21bb('0x5b')][_0x4749ad];var _0x14ad52='i';var _0x229f01=_[_0x21bb('0x5c')](_0x7a0ab8,[_0x21bb('0x2e'),_0x481711[_0x21bb('0x44')]]);if(!_0x229f01){switch(_0x481711[_0x21bb('0x44')]){case _0x21bb('0x5d'):if(_0x481711[_0x21bb('0x5e')]==0x1){_0x826525[_0x21bb('0x5f')]('`'+_0x481711[_0x21bb('0x44')]+'`\x20=\x200');}else{_0x826525[_0x21bb('0x5f')]('`'+_0x481711[_0x21bb('0x44')]+_0x21bb('0x60'));}break;case _0x21bb('0x61'):if(_0x481711[_0x21bb('0x62')]===_0x21bb('0x63')){if(_0x481711['value'][_0x21bb('0x33')]('\x20')[_0x21bb('0x64')]>0x1){_0x20e7ad[_0x4330f5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x21bb('0x65')](_0x481711['value']),null);}else{var _0x17d525='%'+_0x481711[_0x21bb('0x5e')]+'%';_0x20e7ad[_0x4330f5](_0x21bb('0x66'),_0x17d525,_0x17d525,_0x17d525);}}else{_0x229f01=_['find'](_0x7a0ab8,[_0x21bb('0x2e'),_0x21bb('0x67')]);_0x481711[_0x21bb('0x44')]=_0x21bb('0x67');_0x8e7c21=as[_0x21bb('0x68')](_0x14ad52,_0x229f01[_0x21bb('0x37')],_0x481711);_0x20e7ad[_0x4330f5](_0x8e7c21[_0x21bb('0x69')],_0x8e7c21[_0x21bb('0x5e')][_0x21bb('0x6a')],_0x8e7c21['value'][_0x21bb('0x1d')]);}break;case _0x21bb('0x6b'):var _0x217030=_0x481711[_0x21bb('0x5e')][_0x21bb('0x33')](',')[_0x21bb('0x35')](function(_0x59cf25){return Number(_0x59cf25);});_0x217030['forEach'](function(_0x14e2f5){_0x216fe5['or'](_0x21bb('0x6c'),'%,'+_0x14e2f5+',%');});_0x522a79=_[_0x21bb('0x6d')](_0x522a79,_0x217030);break;case _0x21bb('0x6e'):if(_0x481711['operator']==='$substring'){_0x20e7ad[_0x4330f5](_0x21bb('0x6f'),'%'+_0x481711['value']+'%',null);}else{_0x229f01=_['find'](_0x7a0ab8,[_0x21bb('0x2e'),_0x21bb('0x70')]);_0x481711[_0x21bb('0x44')]=_0x21bb('0x70');_0x8e7c21=as[_0x21bb('0x68')](_0x14ad52,_0x229f01[_0x21bb('0x37')],_0x481711);_0x20e7ad[_0x4330f5](_0x8e7c21[_0x21bb('0x69')],_0x8e7c21['value'][_0x21bb('0x6a')],_0x8e7c21[_0x21bb('0x5e')][_0x21bb('0x1d')]);}break;case'body':_0x8e7c21=as['buildExpression']('me',null,_0x481711);_0x20e7ad[_0x4330f5](_0x8e7c21[_0x21bb('0x69')],_0x8e7c21[_0x21bb('0x5e')][_0x21bb('0x6a')],_0x8e7c21[_0x21bb('0x5e')]['end']);break;}}else{var _0x8e7c21=as['buildExpression'](_0x14ad52,_0x229f01['type'],_0x481711);_0x20e7ad[_0x4330f5](_0x8e7c21[_0x21bb('0x69')],_0x8e7c21[_0x21bb('0x5e')][_0x21bb('0x6a')],_0x8e7c21[_0x21bb('0x5e')]['end']);}}}else{var _0x4145fe=_(_0x41a772['query'])[_0x21bb('0x3b')]()[_0x21bb('0x35')](function(_0x162aa3){return _[_0x21bb('0x71')](_0x7a0ab8,[_0x21bb('0x2e'),_0x162aa3])?_0x162aa3:undefined;})[_0x21bb('0x72')]()[_0x21bb('0x5e')]();if(!_[_0x21bb('0x73')](_0x4145fe)){_0x4145fe['forEach'](function(_0x19bdc3){if(_0x19bdc3===_0x21bb('0x74')){_0x826525[_0x21bb('0x41')]('i.WhatsappAccountId\x20IN\x20?',[][_0x21bb('0x75')](_0x41a772['query'][_0x19bdc3]));}else if(_0x19bdc3===_0x21bb('0x76')){var _0x16f213=JSON[_0x21bb('0x77')](_0x41a772['query'][_0x19bdc3])[_0x21bb('0x78')];var _0x2b4724=JSON[_0x21bb('0x77')](_0x41a772[_0x21bb('0x3a')][_0x19bdc3])[_0x21bb('0x79')];_0x826525['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16f213,_0x2b4724);}else{if(_0x41a772[_0x21bb('0x3a')][_0x19bdc3]===_0x21bb('0x7a')){_0x826525[_0x21bb('0x41')]('i.'+_0x19bdc3+_0x21bb('0x7b'));}else{_0x826525[_0x21bb('0x41')]('i.'+_0x19bdc3+'\x20=\x20?',_0x41a772[_0x21bb('0x3a')][_0x19bdc3]);}}});}if(_0x41a772[_0x21bb('0x3a')][_0x21bb('0x7c')]){if(_0x41a772[_0x21bb('0x3a')]['read']==0x1){_0x826525[_0x21bb('0x5f')](_0x21bb('0x7d'));}else{_0x826525[_0x21bb('0x5f')](_0x21bb('0x7e'));}}if(_0x41a772['query']['tag']){_0x522a79=_[_0x21bb('0x7f')](_0x41a772[_0x21bb('0x3a')][_0x21bb('0x80')])?_0x41a772['query'][_0x21bb('0x80')]:new Array(_0x41a772[_0x21bb('0x3a')][_0x21bb('0x80')]);_0x522a79[_0x21bb('0x34')](function(_0x2b1cf4){_0x216fe5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b1cf4+',%');});}if(_0x41a772[_0x21bb('0x3a')]['filter']){var _0x551967=_0x41a772[_0x21bb('0x3a')][_0x21bb('0x81')][_0x21bb('0x82')]('\x5c','\x5c\x5c')[_0x21bb('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x551967)){_0x20e7ad['or'](_0x21bb('0x83'),_0x551967+'%')['or']('i.phone\x20LIKE\x20?',_0x551967+'%');}else{_0x20e7ad['or'](_0x21bb('0x84'),qs[_0x21bb('0x65')](_0x551967))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x551967+'%');}}}_0x826525[_0x21bb('0x41')](_0x20e7ad);_0x826525[_0x21bb('0x85')]('i.id');var _0xfac262={'type':db['Sequelize'][_0x21bb('0x86')][_0x21bb('0x87')],'raw':!![]};var _0x16a378=_0x826525[_0x21bb('0x88')]();_0x16a378[_0x21bb('0x44')](_0x21bb('0x89'));_0x16a378['field'](_0x21bb('0x8a'),'unreadMessages');if(_0x2a50d7['order']){_0x2a50d7[_0x21bb('0x3f')]['forEach'](function(_0x1fc242){var _0x2cd902=_0x1fc242[0x0]===_0x21bb('0x8b')?_0x1fc242[0x0]:'i.'+_0x1fc242[0x0];_0x826525[_0x21bb('0x3f')](_0x2cd902,_0x1fc242[0x1]===_0x21bb('0x8c')?![]:!![]);});}if(!_[_0x21bb('0x73')](_0x522a79)){_0x826525[_0x21bb('0x5f')](_0x216fe5);_0x16a378[_0x21bb('0x41')](_0x21bb('0x8d'),_0x522a79);}BPromise[_0x21bb('0x8e')]()[_0x21bb('0x29')](function(){if(!_0x2f40ba){if(_0x41a772[_0x21bb('0x3a')][_0x21bb('0x74')])return;_0x16a378[_0x21bb('0x41')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x826525[_0x21bb('0x41')](_0x21bb('0x8f'));return;}if(_0x41a772['user'][_0x21bb('0x90')]!==_0x21bb('0x91'))return;return _0x41a772[_0x21bb('0x92')][_0x21bb('0x93')]({'attributes':['id'],'raw':!![]})[_0x21bb('0x29')](function(_0x45a47a){if(_[_0x21bb('0x73')](_0x45a47a)){_0x16a378['where'](_0x21bb('0x94'));_0x826525[_0x21bb('0x41')](_0x21bb('0x94'));}else{_0x16a378[_0x21bb('0x41')](_0x21bb('0x95'),_['map'](_0x45a47a,'id'));_0x826525['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x21bb('0x35')](_0x45a47a,'id'));}});})[_0x21bb('0x29')](function(){if(_0x41a772['user'][_0x21bb('0x90')]==='agent'&&!_0x2f40ba&&!_0x41a772[_0x21bb('0x3a')]['WhatsappAccountId'])return[];return db[_0x21bb('0x96')][_0x21bb('0x3a')](_0x16a378[_0x21bb('0x97')](),_0xfac262);})[_0x21bb('0x29')](function(_0x2751a8){_0x420495[_0x21bb('0x23')]=_0x2751a8['length'];if(_0x420495[_0x21bb('0x23')]===0x0)return[];return db[_0x21bb('0x96')][_0x21bb('0x3a')](_0x27c5e6[_0x21bb('0x97')](),_0xfac262)[_0x21bb('0x29')](function(_0x10b6c3){_0x4d890e=_[_0x21bb('0x98')](_0x10b6c3,'id');_0xfac262=_['merge'](_0xfac262,{'model':db[_0x21bb('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41a772['query']['fields']){_0x2a50d7['attributes'][_0x21bb('0x34')](function(_0x300387){_0x826525['field']('i.'+_0x300387);});}else{_0x826525[_0x21bb('0x44')](_0x21bb('0x8a'),_0x21bb('0x5d'));_0x826525[_0x21bb('0x44')](_0x21bb('0x9a'),_0x21bb('0x9b'));_0x826525[_0x21bb('0x44')](_0x21bb('0x9c'),_0x21bb('0x9d'));_0x826525['field'](_0x21bb('0x9e'),_0x21bb('0x8b'));_0x826525[_0x21bb('0x44')](_0x21bb('0x9f'));_0x826525[_0x21bb('0x44')](_0x21bb('0xa0'),'Contact.firstName');_0x826525[_0x21bb('0x44')]('c.lastName',_0x21bb('0xa1'));_0x826525[_0x21bb('0x44')]('c.email',_0x21bb('0xa2'));_0x826525[_0x21bb('0x44')](_0x21bb('0xa3'),_0x21bb('0xa4'));_0x826525['field'](_0x21bb('0xa5'),'Contact.mobile');_0x826525['field'](_0x21bb('0xa6'),'Contact.fax');_0x826525[_0x21bb('0x44')](_0x21bb('0xa7'),'Owner.fullname');_0x826525[_0x21bb('0x44')](_0x21bb('0xa8'),_0x21bb('0xa9'));_0x826525[_0x21bb('0x44')](_0x21bb('0xaa'),_0x21bb('0x32'));}if(_0x2a50d7[_0x21bb('0x21')])_0x826525[_0x21bb('0x21')](_0x2a50d7[_0x21bb('0x21')]);if(_0x2a50d7[_0x21bb('0x20')])_0x826525[_0x21bb('0x20')](_0x2a50d7[_0x21bb('0x20')]);return db[_0x21bb('0x96')][_0x21bb('0x3a')](_0x826525['toString'](),_0xfac262);})[_0x21bb('0x29')](function(_0x462291){if(_0x462291[_0x21bb('0x64')]>0x0)_0xa6c4c5['where'](_0x21bb('0xab'),_[_0x21bb('0x35')](_0x462291,'id'));return db['sequelize'][_0x21bb('0x3a')](_0xa6c4c5[_0x21bb('0x97')](),_0xfac262)[_0x21bb('0x29')](function(_0x2fa1ba){var _0x343384=_[_0x21bb('0xac')](_0x2fa1ba,'WhatsappInteractionId');var _0x295ab3=[];_0x462291[_0x21bb('0x34')](function(_0xc4f3f0){_0x295ab3[_0x21bb('0xad')](updateWhatsappInteraction(_0xc4f3f0,_0x4d890e,_0x343384));});return BPromise[_0x21bb('0xae')](_0x295ab3);});});})[_0x21bb('0x29')](function(_0x5d5fb4){_0x420495[_0x21bb('0xaf')]=_0x5d5fb4;return _0x420495;})[_0x21bb('0x29')](respondWithFilteredResult(_0x59aedf,_0x2a50d7))[_0x21bb('0xb0')](handleError(_0x59aedf,null));};exports[_0x21bb('0xb1')]=function(_0x33a233,_0x5aa874){var _0x271cda={'raw':![],'where':{'id':_0x33a233[_0x21bb('0xb2')]['id']}},_0x124a86={};_0x124a86[_0x21bb('0x39')]=_['keys'](db[_0x21bb('0x99')][_0x21bb('0xb3')]);_0x124a86['query']=_[_0x21bb('0x3b')](_0x33a233[_0x21bb('0x3a')]);_0x124a86[_0x21bb('0x42')]=_[_0x21bb('0x3c')](_0x124a86[_0x21bb('0x39')],_0x124a86[_0x21bb('0x3a')]);_0x271cda[_0x21bb('0x3d')]=_[_0x21bb('0x3c')](_0x124a86[_0x21bb('0x39')],qs[_0x21bb('0x3e')](_0x33a233['query'][_0x21bb('0x3e')]));_0x271cda['attributes']=_0x271cda['attributes'][_0x21bb('0x64')]?_0x271cda[_0x21bb('0x3d')]:_0x124a86['model'];if(_0x33a233[_0x21bb('0x3a')][_0x21bb('0xb4')]){_0x271cda[_0x21bb('0xb5')]=[{'all':!![]}];}_0x271cda=_['merge']({},_0x271cda,_0x33a233[_0x21bb('0xb6')]);return db[_0x21bb('0x99')][_0x21bb('0x5c')](_0x271cda)['then'](handleEntityNotFound(_0x5aa874,null))[_0x21bb('0x29')](respondWithResult(_0x5aa874,null))[_0x21bb('0xb0')](handleError(_0x5aa874,null));};exports[_0x21bb('0xb7')]=function(_0x11ef72,_0xaafc99){return db[_0x21bb('0x99')][_0x21bb('0xb7')](_0x11ef72[_0x21bb('0xb8')],{})[_0x21bb('0x29')](respondWithResult(_0xaafc99,0xc9))[_0x21bb('0xb0')](handleError(_0xaafc99,null));};exports[_0x21bb('0x28')]=function(_0x213678,_0x6da778){if(_0x213678[_0x21bb('0xb8')]['id']){delete _0x213678[_0x21bb('0xb8')]['id'];}return db[_0x21bb('0x99')][_0x21bb('0x5c')]({'where':{'id':_0x213678[_0x21bb('0xb2')]['id']}})[_0x21bb('0x29')](handleEntityNotFound(_0x6da778,null))[_0x21bb('0x29')](saveUpdates(_0x213678['body'],null))[_0x21bb('0x29')](respondWithResult(_0x6da778,null))[_0x21bb('0xb0')](handleError(_0x6da778,null));};exports['destroy']=function(_0xb18803,_0x57efc0){return db[_0x21bb('0x99')][_0x21bb('0x5c')]({'where':{'id':_0xb18803[_0x21bb('0xb2')]['id']}})[_0x21bb('0x29')](handleEntityNotFound(_0x57efc0,null))[_0x21bb('0x29')](removeEntity(_0x57efc0,null))['catch'](handleError(_0x57efc0,null));};exports['describe']=function(_0x4654c0,_0x130086){return db[_0x21bb('0x99')][_0x21bb('0xb9')]()[_0x21bb('0x29')](respondWithResult(_0x130086,null))['catch'](handleError(_0x130086,null));};exports[_0x21bb('0xba')]=function(_0x1f4fd4,_0x26c6c4,_0x357707){return db[_0x21bb('0xbb')][_0x21bb('0x5c')]({'where':{'id':_0x1f4fd4[_0x21bb('0xb2')]['id']}})[_0x21bb('0x29')](handleEntityNotFound(_0x26c6c4,null))[_0x21bb('0x29')](function(_0x1f7cdd){if(_0x1f7cdd){return _0x1f7cdd[_0x21bb('0xba')](_0x1f4fd4['body'][_0x21bb('0xbc')],_[_0x21bb('0xbd')](_0x1f4fd4[_0x21bb('0xb8')],[_0x21bb('0xbc'),'id'])||{});}})[_0x21bb('0x29')](respondWithResult(_0x26c6c4,null))['catch'](handleError(_0x26c6c4,null));};exports[_0x21bb('0xbe')]=function(_0x4742ae,_0x17d8d0,_0x5ef5dd){var _0x36152a={'raw':![],'where':{}};var _0x3e38f1={};var _0x154e6d={'count':0x0,'rows':[]};return db[_0x21bb('0x99')][_0x21bb('0xbf')]({'where':{'id':_0x4742ae['params']['id']}})[_0x21bb('0x29')](handleEntityNotFound(_0x17d8d0,null))['then'](function(_0x1c7ad6){if(_0x1c7ad6){_0x3e38f1[_0x21bb('0x39')]=_['keys'](db[_0x21bb('0xbb')]['rawAttributes']);_0x3e38f1[_0x21bb('0x3a')]=_[_0x21bb('0x3b')](_0x4742ae[_0x21bb('0x3a')]);_0x3e38f1[_0x21bb('0x42')]=_[_0x21bb('0x3c')](_0x3e38f1[_0x21bb('0x39')],_0x3e38f1[_0x21bb('0x3a')]);_0x36152a[_0x21bb('0x3d')]=_['intersection'](_0x3e38f1[_0x21bb('0x39')],qs[_0x21bb('0x3e')](_0x4742ae['query']['fields']));_0x36152a[_0x21bb('0x3d')]=_0x36152a[_0x21bb('0x3d')][_0x21bb('0x64')]?_0x36152a['attributes']:_0x3e38f1[_0x21bb('0x39')];if(!_0x4742ae[_0x21bb('0x3a')][_0x21bb('0xc0')](_0x21bb('0xc1'))){_0x36152a[_0x21bb('0x21')]=qs[_0x21bb('0x21')](_0x4742ae[_0x21bb('0x3a')][_0x21bb('0x21')]);_0x36152a[_0x21bb('0x20')]=qs[_0x21bb('0x20')](_0x4742ae[_0x21bb('0x3a')][_0x21bb('0x20')]);}_0x36152a[_0x21bb('0x3f')]=qs['sort'](_0x4742ae['query'][_0x21bb('0x40')]);_0x36152a[_0x21bb('0x41')]=qs[_0x21bb('0x42')](_[_0x21bb('0xc2')](_0x4742ae[_0x21bb('0x3a')],_0x3e38f1[_0x21bb('0x42')]));_0x36152a[_0x21bb('0x41')][_0x21bb('0xc3')]=_0x1c7ad6['id'];if(_0x4742ae[_0x21bb('0x3a')][_0x21bb('0x81')]){_0x36152a[_0x21bb('0x41')]=_[_0x21bb('0xc4')](_0x36152a[_0x21bb('0x41')],{'$or':_[_0x21bb('0x35')](_0x36152a[_0x21bb('0x3d')],function(_0x516c0b){var _0x1284e4={};_0x1284e4[_0x516c0b]={'$like':'%'+_0x4742ae[_0x21bb('0x3a')][_0x21bb('0x81')]+'%'};return _0x1284e4;})});}if(_0x4742ae[_0x21bb('0x3a')][_0x21bb('0x78')]){var _0x4685ac=_0x4742ae['query'][_0x21bb('0x78')]['split'](',');var _0x594c8f={};_0x594c8f[_0x4685ac[0x0]]={'$gte':moment(_0x4685ac[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x36152a[_0x21bb('0x41')]=_[_0x21bb('0xc4')](_0x36152a[_0x21bb('0x41')],_0x594c8f);}_0x36152a=_[_0x21bb('0xc4')]({},_0x36152a,_0x4742ae[_0x21bb('0xb6')]);return db[_0x21bb('0xbb')][_0x21bb('0x23')]({'where':_0x36152a[_0x21bb('0x41')]})[_0x21bb('0x29')](function(_0x4388d6){_0x154e6d[_0x21bb('0x23')]=_0x4388d6;if(_0x4742ae[_0x21bb('0x3a')][_0x21bb('0xb4')]){_0x36152a[_0x21bb('0xb5')]=[{'all':!![]}];}return db[_0x21bb('0xbb')][_0x21bb('0xc5')](_0x36152a);})[_0x21bb('0x29')](function(_0x2c6df6){_0x154e6d[_0x21bb('0xaf')]=_0x2c6df6;return _0x154e6d;});}})['then'](respondWithFilteredResult(_0x17d8d0,_0x36152a))[_0x21bb('0xb0')](handleError(_0x17d8d0,null));};exports['addTags']=function(_0x1a0b35,_0x1b4e1a,_0x2ac8d9){return db[_0x21bb('0x99')][_0x21bb('0x5c')]({'where':{'id':_0x1a0b35['params']['id']}})[_0x21bb('0x29')](handleEntityNotFound(_0x1b4e1a,null))[_0x21bb('0x29')](function(_0x121d1e){if(_0x121d1e){return _0x121d1e[_0x21bb('0xc6')](_0x1a0b35['body'][_0x21bb('0xbc')],_['omit'](_0x1a0b35[_0x21bb('0xb8')],[_0x21bb('0xbc'),'id'])||{})[_0x21bb('0xc7')](function(){return db[_0x21bb('0x6b')][_0x21bb('0xc5')]({'attributes':['id',_0x21bb('0x2e'),_0x21bb('0x45')],'where':{'id':_0x1a0b35[_0x21bb('0xb8')][_0x21bb('0xbc')]}});})[_0x21bb('0x29')](function(_0x298b8e){socket[_0x21bb('0xc8')]('whatsappInteractionTags:save',{'id':Number(_0x1a0b35[_0x21bb('0xb2')]['id']),'tags':_0x298b8e||[]});return{'id':Number(_0x1a0b35[_0x21bb('0xb2')]['id']),'tags':_0x298b8e||[]};});}})[_0x21bb('0x29')](respondWithResult(_0x1b4e1a,null))[_0x21bb('0xb0')](handleError(_0x1b4e1a,null));};exports['removeTags']=function(_0x2da693,_0x30d618,_0x1e29ca){return db[_0x21bb('0x99')][_0x21bb('0x5c')]({'where':{'id':_0x2da693[_0x21bb('0xb2')]['id']}})['then'](handleEntityNotFound(_0x30d618,null))[_0x21bb('0x29')](function(_0x379c08){if(_0x379c08){return _0x379c08['removeTags'](_0x2da693[_0x21bb('0x3a')][_0x21bb('0xbc')]);}})[_0x21bb('0x29')](respondWithStatusCode(_0x30d618,null))[_0x21bb('0xb0')](handleError(_0x30d618,null));};exports[_0x21bb('0xc9')]=function(_0x5d0d0b,_0x357186){var _0x431119=moment()[_0x21bb('0xca')]()['toString']();var _0x3b374f=path['join'](config['root'],'server',_0x21bb('0xcb'),_0x21bb('0xcc'));var _0x47bfc1=path['join'](config[_0x21bb('0xcd')],'server',_0x21bb('0xcb'),_0x21bb('0xce'));var _0x202182=path['join'](_0x3b374f,_0x431119);var _0xe4a8f7=util['format']('transcript-%d-%s.zip',_0x5d0d0b[_0x21bb('0xb2')]['id'],_0x431119);var _0x36c666=path[_0x21bb('0xcf')](_0x3b374f,_0xe4a8f7);var _0x534219=[];_0x534219['push']({'model':db[_0x21bb('0x6e')],'as':_0x21bb('0x6e'),'attributes':['id',_0x21bb('0x30')],'raw':!![]});_0x534219[_0x21bb('0xad')]({'model':db[_0x21bb('0xd0')],'as':'Contact','attributes':['id',_0x21bb('0xd1'),_0x21bb('0xd2')],'raw':!![]});if(_0x5d0d0b['query'][_0x21bb('0xce')]){_0x534219['push']({'model':db[_0x21bb('0xd3')],'as':_0x21bb('0xd3'),'raw':!![]});}var _0x11f98d=[{'model':db[_0x21bb('0xbb')],'as':_0x21bb('0xd4'),'attributes':['id','body','createdAt',_0x21bb('0xd5'),_0x21bb('0xd6'),'read'],'include':_0x534219}];_0x11f98d[_0x21bb('0xad')]({'model':db[_0x21bb('0xd7')],'as':_0x21bb('0xd8'),'attributes':['id','name']});_0x11f98d[_0x21bb('0xad')]({'model':db[_0x21bb('0x6e')],'as':'Owner','attributes':['id',_0x21bb('0x30')]});return db[_0x21bb('0x99')]['find']({'where':{'id':_0x5d0d0b[_0x21bb('0xb2')]['id']},'include':_0x11f98d})[_0x21bb('0x29')](handleEntityNotFound(_0x357186,null))[_0x21bb('0x29')](function(_0xfe2803){if(_0xfe2803){var _0x11ac73=_0xfe2803[_0x21bb('0xd9')]({'plain':!![]});fs[_0x21bb('0xda')](_0x202182);var _0x62359d={'channel':_0x21bb('0xdb'),'account':_0x11ac73[_0x21bb('0xd8')][_0x21bb('0x2e')],'agent':_0x11ac73['Owner']?_0x11ac73[_0x21bb('0xdc')][_0x21bb('0x30')]:_0x21bb('0xdd'),'createdAt':moment(_0x11ac73['createdAt'])[_0x21bb('0xde')]('YYYY-MM-DD\x20HH:mm:ss')[_0x21bb('0x97')](),'closedAt':_0x11ac73['closed']?moment(_0x11ac73[_0x21bb('0xdf')])[_0x21bb('0xde')](_0x21bb('0xe0'))[_0x21bb('0x97')]():'','disposition':_0x11ac73[_0x21bb('0xe1')],'messages':_(_0x11ac73[_0x21bb('0xd4')])[_0x21bb('0x81')]({'secret':![]})[_0x21bb('0x35')](function(_0x369a78){if(_0x369a78[_0x21bb('0xd3')]){var _0x5ac94b=path[_0x21bb('0xcf')](_0x47bfc1,_0x369a78[_0x21bb('0xd3')][_0x21bb('0xe2')]);if(fs[_0x21bb('0xe3')](_0x5ac94b)){fs[_0x21bb('0xe4')](_0x5ac94b)[_0x21bb('0xe5')](fs['createWriteStream'](path[_0x21bb('0xcf')](_0x202182,_0x369a78[_0x21bb('0xd3')][_0x21bb('0xe2')])));}}return{'date':moment(_0x369a78[_0x21bb('0x76')])[_0x21bb('0xde')](_0x21bb('0xe0'))[_0x21bb('0x97')](),'sender':_0x369a78[_0x21bb('0xd5')]===_0x21bb('0xe6')?_0x369a78[_0x21bb('0x6e')]?_0x369a78[_0x21bb('0x6e')][_0x21bb('0x30')]:_0x21bb('0xe7'):_0x369a78[_0x21bb('0x61')][_0x21bb('0xd1')]+(_0x369a78[_0x21bb('0x61')][_0x21bb('0xd2')]?'\x20'+_0x369a78[_0x21bb('0x61')][_0x21bb('0xd2')]:''),'body':_0x369a78[_0x21bb('0xd3')]?_0x369a78['Attachment'][_0x21bb('0xe2')]:_0x369a78['body'],'direction':_0x369a78[_0x21bb('0xd5')]===_0x21bb('0xe6')?'A':'C','secret':_0x369a78['secret'],'read':_0x369a78[_0x21bb('0x7c')],'attachment':_0x369a78[_0x21bb('0xd3')]};})[_0x21bb('0x5e')]()};return ejs[_0x21bb('0xe8')](path[_0x21bb('0xcf')](config['root'],_0x21bb('0xe9'),_0x21bb('0xea'),_0x21bb('0xeb')),{'interaction':_0x62359d})[_0x21bb('0x29')](function(_0x10d97a){var _0xcf6dc3=path['join'](_0x202182,_0x21bb('0xec')+_0x11ac73['id']+'-'+_0x431119+_0x21bb('0xed'));var _0x4dc3fc={'path':_0xcf6dc3,'channel':_0x21bb('0xdb'),'interactionId':_0x11ac73['id']};return pdf['createPdfFromHTML'](_0x10d97a,_0x4dc3fc);})['then'](function(){return new BPromise(function(_0x561683,_0x4c4f92){zipdir(_0x202182,{'saveTo':_0x36c666},function(_0x1b7f63,_0x4cf718){if(_0x1b7f63)return _0x4c4f92(_0x1b7f63);return _0x561683(_0x4cf718);});})['then'](function(){return new BPromise(function(_0x4c0d29,_0x13ae5f){rimraf(_0x202182,function(_0x577b01){if(_0x577b01)_0x13ae5f(_0x577b01);return _0x4c0d29();});});})[_0x21bb('0x29')](function(){return _0x357186[_0x21bb('0xc9')](_0x36c666,_0xe4a8f7,function(_0x1fe06e){if(_0x1fe06e){console[_0x21bb('0xee')](_0x21bb('0xef'),_0x1fe06e);}else{fs[_0x21bb('0xf0')](_0x36c666);}});});});}else{return _0x357186[_0x21bb('0x2b')](0xc8);}})[_0x21bb('0xb0')](handleError(_0x357186,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4f3156b..d83b034 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 _0x6f7a=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x568978,_0x5bf2a7){var _0x473ebf=function(_0x36bb41){while(--_0x36bb41){_0x568978['push'](_0x568978['shift']());}};_0x473ebf(++_0x5bf2a7);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3da79d,_0x45587e){_0x3da79d=_0x3da79d-0x0;var _0x2c280c=_0x6f7a[_0x3da79d];return _0x2c280c;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var WhatsappInteraction=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var WhatsappMessage=require(_0xa6f7('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':_0xa6f7('0x4'),'afterUpdate':_0xa6f7('0x5'),'afterDestroy':_0xa6f7('0x6')};function emitEvent(_0x22e529){return function(_0x1f5922,_0x35f8f0,_0x20cccd){_0x1f5922[_0xa6f7('0x7')]({'attributes':['id'],'raw':!![]})[_0xa6f7('0x8')](function(_0x1a06d1){_0x1f5922['setDataValue']('Users',_0x1a06d1[_0xa6f7('0x9')](function(_0x2674c9){return{'id':_0x2674c9['id']};}));return WhatsappMessage[_0xa6f7('0xa')]({'where':{'WhatsappInteractionId':_0x1f5922['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6f7('0x8')](function(_0x23bb05){_0x1f5922['setDataValue']('unreadMessages',_0x23bb05[_0xa6f7('0xb')]);WhatsappInteractionEvents[_0xa6f7('0xc')](_0x22e529+':'+_0x1f5922['id'],_0x1f5922);WhatsappInteractionEvents['emit'](_0x22e529,_0x1f5922);_0x20cccd(null);})[_0xa6f7('0xd')](_0x20cccd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xa6f7('0xe')](e,emitEvent(event));}}module[_0xa6f7('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xdbfc=['save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x3198a5,_0x2f4188){var _0x4c259a=function(_0x3fde32){while(--_0x3fde32){_0x3198a5['push'](_0x3198a5['shift']());}};_0x4c259a(++_0x2f4188);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x32f164,_0x30008d){_0x32f164=_0x32f164-0x0;var _0x1ab806=_0xdbfc[_0x32f164];return _0x1ab806;};'use strict';var EventEmitter=require(_0xcdbf('0x0'));var WhatsappInteraction=require(_0xcdbf('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xcdbf('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xcdbf('0x3')](0x0);var events={'afterCreate':_0xcdbf('0x4'),'afterUpdate':_0xcdbf('0x5'),'afterDestroy':_0xcdbf('0x6')};function emitEvent(_0x1c2ce4){return function(_0xed183,_0x56f671,_0x3ffa10){_0xed183[_0xcdbf('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x369d61){_0xed183[_0xcdbf('0x8')](_0xcdbf('0x9'),_0x369d61[_0xcdbf('0xa')](function(_0x59cb76){return{'id':_0x59cb76['id']};}));return WhatsappMessage[_0xcdbf('0xb')]({'where':{'WhatsappInteractionId':_0xed183['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcdbf('0xc')](function(_0x4088ce){_0xed183[_0xcdbf('0x8')](_0xcdbf('0xd'),_0x4088ce['length']);WhatsappInteractionEvents[_0xcdbf('0xe')](_0x1c2ce4+':'+_0xed183['id'],_0xed183);WhatsappInteractionEvents['emit'](_0x1c2ce4,_0xed183);_0x3ffa10(null);})[_0xcdbf('0xf')](_0x3ffa10(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xcdbf('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 365605b..c3ab9a2 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 _0xd755=['rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd755,0x109));var _0x5d75=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0xd755[_0x57db49];return _0xd0636f;};'use strict';var _=require(_0x5d75('0x0'));var util=require(_0x5d75('0x1'));var logger=require(_0x5d75('0x2'))(_0x5d75('0x3'));var moment=require('moment');var BPromise=require(_0x5d75('0x4'));var rp=require(_0x5d75('0x5'));var fs=require('fs');var path=require(_0x5d75('0x6'));var rimraf=require(_0x5d75('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d75('0x8'));module[_0x5d75('0x9')]=function(_0x1e77a5,_0x28bcfc){return _0x1e77a5[_0x5d75('0xa')](_0x5d75('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3def3a,_0x4c4391,_0x3d7a9a){if(_0x3def3a[_0x5d75('0xc')](_0x5d75('0xd'))){_0x3def3a[_0x5d75('0xe')]=moment()['format'](_0x5d75('0xf'));}_0x3d7a9a(null,_0x3def3a);}}});}; \ No newline at end of file +var _0x00fe=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','lodash'];(function(_0x32e77f,_0x14464d){var _0x47e651=function(_0x3c318e){while(--_0x3c318e){_0x32e77f['push'](_0x32e77f['shift']());}};_0x47e651(++_0x14464d);}(_0x00fe,0x179));var _0xe00f=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x00fe[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0xe00f('0x0'));var util=require('util');var logger=require(_0xe00f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe00f('0x2'));var rp=require(_0xe00f('0x3'));var fs=require('fs');var path=require(_0xe00f('0x4'));var rimraf=require(_0xe00f('0x5'));var config=require(_0xe00f('0x6'));var attributes=require(_0xe00f('0x7'));module[_0xe00f('0x8')]=function(_0x30527e,_0x254d16){return _0x30527e[_0xe00f('0x9')](_0xe00f('0xa'),attributes,{'tableName':_0xe00f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5981b2,_0xbb6cb6,_0x303492){if(_0x5981b2[_0xe00f('0xc')]('closed')){_0x5981b2[_0xe00f('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x303492(null,_0x5981b2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d074b1d..40f0059 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 _0x74e4=['update','body','options','raw','where','then','find','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction'];(function(_0x4f4def,_0x57758b){var _0x111b7f=function(_0x3e1443){while(--_0x3e1443){_0x4f4def['push'](_0x4f4def['shift']());}};_0x111b7f(++_0x57758b);}(_0x74e4,0x197));var _0x474e=function(_0x1aceff,_0x37d43c){_0x1aceff=_0x1aceff-0x0;var _0x4a9e4a=_0x74e4[_0x1aceff];return _0x4a9e4a;};'use strict';var _=require(_0x474e('0x0'));var util=require(_0x474e('0x1'));var moment=require(_0x474e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x474e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x474e('0x4'));var logger=require(_0x474e('0x5'))('rpc');var config=require(_0x474e('0x6'));var jayson=require(_0x474e('0x7'));var client=jayson[_0x474e('0x8')][_0x474e('0x9')]({'port':0x232a});config[_0x474e('0xa')]=_['defaults'](config[_0x474e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x474e('0xb'))(new Redis(config[_0x474e('0xa')]));require('./whatsappInteraction.socket')[_0x474e('0xc')](socket);function respondWithRpcPromise(_0x4b3adb,_0x2cddec,_0x599721){return new BPromise(function(_0x1d970c,_0x1ce024){return client[_0x474e('0xd')](_0x4b3adb,_0x599721)['then'](function(_0x566797){logger[_0x474e('0xe')](_0x474e('0xf'),_0x2cddec,_0x474e('0x10'));logger[_0x474e('0x11')](_0x474e('0x12'),_0x2cddec,_0x474e('0x10'),JSON[_0x474e('0x13')](_0x566797));if(_0x566797[_0x474e('0x14')]){if(_0x566797[_0x474e('0x14')]['code']===0x1f4){logger[_0x474e('0x14')](_0x474e('0xf'),_0x2cddec,_0x566797['error'][_0x474e('0x15')]);return _0x1ce024(_0x566797[_0x474e('0x14')]['message']);}logger[_0x474e('0x14')](_0x474e('0xf'),_0x2cddec,_0x566797[_0x474e('0x14')][_0x474e('0x15')]);return _0x1d970c(_0x566797[_0x474e('0x14')][_0x474e('0x15')]);}else{logger[_0x474e('0xe')](_0x474e('0xf'),_0x2cddec,'request\x20sent');_0x1d970c(_0x566797[_0x474e('0x16')][_0x474e('0x15')]);}})[_0x474e('0x17')](function(_0x1bc7be){logger[_0x474e('0x14')](_0x474e('0xf'),_0x2cddec,_0x1bc7be);_0x1ce024(_0x1bc7be);});});}exports[_0x474e('0x18')]=function(_0x50c6de){var _0x475cb2=this;return new Promise(function(_0x3b3af0,_0x2cc1c5){return db['WhatsappInteraction'][_0x474e('0x19')](_0x50c6de[_0x474e('0x1a')],{'raw':_0x50c6de[_0x474e('0x1b')]?_0x50c6de['options'][_0x474e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c6de[_0x474e('0x1b')]?_0x50c6de[_0x474e('0x1b')][_0x474e('0x1d')]||null:null,'attributes':_0x50c6de[_0x474e('0x1b')]?_0x50c6de['options']['attributes']||null:null,'limit':_0x50c6de[_0x474e('0x1b')]?_0x50c6de[_0x474e('0x1b')]['limit']||null:null})[_0x474e('0x1e')](function(_0x4245e4){logger[_0x474e('0xe')]('UpdateWhatsappInteraction',_0x50c6de);logger[_0x474e('0x11')](_0x474e('0x18'),_0x50c6de,JSON[_0x474e('0x13')](_0x4245e4));_0x3b3af0(_0x4245e4);})[_0x474e('0x17')](function(_0x41ad77){logger[_0x474e('0x14')](_0x474e('0x18'),_0x41ad77[_0x474e('0x15')],_0x50c6de);_0x2cc1c5(_0x475cb2[_0x474e('0x14')](0x1f4,_0x41ad77[_0x474e('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3e41be){return new Promise(function(_0x51f7c2,_0x571ffd){return db['WhatsappInteraction'][_0x474e('0x1f')]({'where':_0x3e41be['options']?_0x3e41be[_0x474e('0x1b')][_0x474e('0x1d')]||null:null})[_0x474e('0x1e')](function(_0x4c98cf){if(_0x4c98cf){return _0x4c98cf['addTags'](_0x3e41be[_0x474e('0x1a')][_0x474e('0x20')],_[_0x474e('0x21')](_0x3e41be[_0x474e('0x1a')],[_0x474e('0x20'),'id'])||{});}})[_0x474e('0x22')](function(_0x19473b){logger['info'](_0x474e('0x23'),_0x3e41be);logger['debug']('AddTags',_0x3e41be,JSON[_0x474e('0x13')](_0x19473b));_0x51f7c2(_0x19473b);})[_0x474e('0x17')](function(_0x41a211){logger[_0x474e('0x14')]('AddTags',_0x41a211['message'],_0x3e41be);_0x571ffd(_this[_0x474e('0x14')](0x1f4,_0x41a211[_0x474e('0x15')]));});});}; \ No newline at end of file +var _0xd229=['rpc','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','ids','omit','spread','AddTags','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x47a0b0,_0xe18865){var _0x4e9dd6=function(_0x3cb34a){while(--_0x3cb34a){_0x47a0b0['push'](_0x47a0b0['shift']());}};_0x4e9dd6(++_0xe18865);}(_0xd229,0x77));var _0x9d22=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xd229[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x9d22('0x0'));var util=require(_0x9d22('0x1'));var moment=require('moment');var BPromise=require(_0x9d22('0x2'));var rs=require(_0x9d22('0x3'));var fs=require('fs');var Redis=require(_0x9d22('0x4'));var db=require(_0x9d22('0x5'))['db'];var utils=require(_0x9d22('0x6'));var logger=require('../../config/logger')(_0x9d22('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d22('0x8'));var client=jayson[_0x9d22('0x9')][_0x9d22('0xa')]({'port':0x232a});config[_0x9d22('0xb')]=_['defaults'](config[_0x9d22('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d22('0xc'))(new Redis(config[_0x9d22('0xb')]));require(_0x9d22('0xd'))[_0x9d22('0xe')](socket);function respondWithRpcPromise(_0x3d363,_0xf75d70,_0x3bea32){return new BPromise(function(_0x1213b3,_0x1dfdf1){return client[_0x9d22('0xf')](_0x3d363,_0x3bea32)[_0x9d22('0x10')](function(_0xa46d9f){logger[_0x9d22('0x11')](_0x9d22('0x12'),_0xf75d70,_0x9d22('0x13'));logger['debug'](_0x9d22('0x14'),_0xf75d70,_0x9d22('0x13'),JSON[_0x9d22('0x15')](_0xa46d9f));if(_0xa46d9f[_0x9d22('0x16')]){if(_0xa46d9f['error'][_0x9d22('0x17')]===0x1f4){logger['error'](_0x9d22('0x12'),_0xf75d70,_0xa46d9f[_0x9d22('0x16')][_0x9d22('0x18')]);return _0x1dfdf1(_0xa46d9f[_0x9d22('0x16')][_0x9d22('0x18')]);}logger[_0x9d22('0x16')](_0x9d22('0x12'),_0xf75d70,_0xa46d9f[_0x9d22('0x16')][_0x9d22('0x18')]);return _0x1213b3(_0xa46d9f['error'][_0x9d22('0x18')]);}else{logger[_0x9d22('0x11')](_0x9d22('0x12'),_0xf75d70,_0x9d22('0x13'));_0x1213b3(_0xa46d9f[_0x9d22('0x19')][_0x9d22('0x18')]);}})[_0x9d22('0x1a')](function(_0x141141){logger[_0x9d22('0x16')](_0x9d22('0x12'),_0xf75d70,_0x141141);_0x1dfdf1(_0x141141);});});}exports['UpdateWhatsappInteraction']=function(_0x3f6160){var _0x38559e=this;return new Promise(function(_0x57007d,_0x5a7be8){return db['WhatsappInteraction'][_0x9d22('0x1b')](_0x3f6160[_0x9d22('0x1c')],{'raw':_0x3f6160[_0x9d22('0x1d')]?_0x3f6160[_0x9d22('0x1d')][_0x9d22('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6160[_0x9d22('0x1d')]?_0x3f6160[_0x9d22('0x1d')][_0x9d22('0x1f')]||null:null,'attributes':_0x3f6160[_0x9d22('0x1d')]?_0x3f6160['options'][_0x9d22('0x20')]||null:null,'limit':_0x3f6160[_0x9d22('0x1d')]?_0x3f6160[_0x9d22('0x1d')][_0x9d22('0x21')]||null:null})[_0x9d22('0x10')](function(_0x3eab82){logger[_0x9d22('0x11')](_0x9d22('0x22'),_0x3f6160);logger['debug'](_0x9d22('0x22'),_0x3f6160,JSON[_0x9d22('0x15')](_0x3eab82));_0x57007d(_0x3eab82);})[_0x9d22('0x1a')](function(_0x13a341){logger['error'](_0x9d22('0x22'),_0x13a341[_0x9d22('0x18')],_0x3f6160);_0x5a7be8(_0x38559e[_0x9d22('0x16')](0x1f4,_0x13a341[_0x9d22('0x18')]));});});};exports[_0x9d22('0x23')]=function(_0x583466){return new Promise(function(_0x1091e3,_0x35a5c1){return db[_0x9d22('0x24')]['find']({'where':_0x583466[_0x9d22('0x1d')]?_0x583466[_0x9d22('0x1d')][_0x9d22('0x1f')]||null:null})[_0x9d22('0x10')](function(_0xc2954){if(_0xc2954){return _0xc2954['addTags'](_0x583466[_0x9d22('0x1c')][_0x9d22('0x25')],_[_0x9d22('0x26')](_0x583466[_0x9d22('0x1c')],[_0x9d22('0x25'),'id'])||{});}})[_0x9d22('0x27')](function(_0x1a4d1a){logger[_0x9d22('0x11')](_0x9d22('0x28'),_0x583466);logger[_0x9d22('0x29')]('AddTags',_0x583466,JSON['stringify'](_0x1a4d1a));_0x1091e3(_0x1a4d1a);})[_0x9d22('0x1a')](function(_0x206675){logger[_0x9d22('0x16')](_0x9d22('0x28'),_0x206675[_0x9d22('0x18')],_0x583466);_0x35a5c1(_this[_0x9d22('0x16')](0x1f4,_0x206675[_0x9d22('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1f0b16f..3e14e82 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 _0x7493=['length','whatsappInteraction:','save','remove','emit','removeListener','register'];(function(_0x46ac4d,_0x46fa04){var _0x2cb141=function(_0x139602){while(--_0x139602){_0x46ac4d['push'](_0x46ac4d['shift']());}};_0x2cb141(++_0x46fa04);}(_0x7493,0x1a6));var _0x3749=function(_0x36adf0,_0x1c5ba0){_0x36adf0=_0x36adf0-0x0;var _0x26c05d=_0x7493[_0x36adf0];return _0x26c05d;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x3749('0x0'),_0x3749('0x1'),'update'];function createListener(_0x3b2c45,_0x4a90b4){return function(_0x307f3c){_0x4a90b4[_0x3749('0x2')](_0x3b2c45,_0x307f3c);};}function removeListener(_0xc8a67a,_0xa9197){return function(){WhatsappInteractionEvents[_0x3749('0x3')](_0xc8a67a,_0xa9197);};}exports[_0x3749('0x4')]=function(_0x358446){for(var _0x46d006=0x0,_0x389a41=events[_0x3749('0x5')];_0x46d006<_0x389a41;_0x46d006++){var _0x2b8669=events[_0x46d006];var _0x33f632=createListener(_0x3749('0x6')+_0x2b8669,_0x358446);WhatsappInteractionEvents['on'](_0x2b8669,_0x33f632);}}; \ No newline at end of file +var _0x08e4=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4bac1c,_0x3fc345){var _0x40b4db=function(_0x4f7e86){while(--_0x4f7e86){_0x4bac1c['push'](_0x4bac1c['shift']());}};_0x40b4db(++_0x3fc345);}(_0x08e4,0x13c));var _0x408e=function(_0x4a374a,_0x45da83){_0x4a374a=_0x4a374a-0x0;var _0x2158b4=_0x08e4[_0x4a374a];return _0x2158b4;};'use strict';var WhatsappInteractionEvents=require(_0x408e('0x0'));var events=[_0x408e('0x1'),'remove','update'];function createListener(_0x5aef52,_0x4ffa5f){return function(_0x566ab0){_0x4ffa5f[_0x408e('0x2')](_0x5aef52,_0x566ab0);};}function removeListener(_0x22e2e5,_0x5ec61e){return function(){WhatsappInteractionEvents[_0x408e('0x3')](_0x22e2e5,_0x5ec61e);};}exports['register']=function(_0xb565d7){for(var _0x150644=0x0,_0x25e8cf=events[_0x408e('0x4')];_0x150644<_0x25e8cf;_0x150644++){var _0x76822e=events[_0x150644];var _0x12157d=createListener(_0x408e('0x5')+_0x76822e,_0xb565d7);WhatsappInteractionEvents['on'](_0x76822e,_0x12157d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index eab2820..ec790f3 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 _0x17d2=['reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','/:id','isAuthenticated','show','post','tracked','whatsapp','create','status','update','put','/:id/reject'];(function(_0x445243,_0x2e82ad){var _0x1859c6=function(_0x1b9caa){while(--_0x1b9caa){_0x445243['push'](_0x445243['shift']());}};_0x1859c6(++_0x2e82ad);}(_0x17d2,0x1cf));var _0x217d=function(_0x5ab8e2,_0x129665){_0x5ab8e2=_0x5ab8e2-0x0;var _0x4b0ecd=_0x17d2[_0x5ab8e2];return _0x4b0ecd;};'use strict';var multer=require(_0x217d('0x0'));var util=require(_0x217d('0x1'));var path=require(_0x217d('0x2'));var timeout=require('connect-timeout');var express=require(_0x217d('0x3'));var router=express[_0x217d('0x4')]();var fs_extra=require(_0x217d('0x5'));var auth=require(_0x217d('0x6'));var interaction=require(_0x217d('0x7'));var config=require(_0x217d('0x8'));var controller=require(_0x217d('0x9'));router[_0x217d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x217d('0xa')](_0x217d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x217d('0xc'),auth[_0x217d('0xd')](),controller[_0x217d('0xe')]);router[_0x217d('0xf')]('/',auth[_0x217d('0xd')](),interaction[_0x217d('0x10')](_0x217d('0x11'),'whatsappmessage:create'),controller[_0x217d('0x12')]);router[_0x217d('0xf')]('/:id/status',controller[_0x217d('0x13')]);router['put']('/:id',auth[_0x217d('0xd')](),controller[_0x217d('0x14')]);router['put']('/:id/accept',auth[_0x217d('0xd')](),controller['accept']);router[_0x217d('0x15')](_0x217d('0x16'),auth['isAuthenticated'](),controller[_0x217d('0x17')]);router[_0x217d('0x18')](_0x217d('0xc'),auth[_0x217d('0xd')](),controller[_0x217d('0x19')]);module[_0x217d('0x1a')]=router; \ No newline at end of file +var _0x7d40=['index','describe','get','/:id','show','tracked','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept','reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated'];(function(_0x2a7982,_0x3a4ade){var _0x5e0db5=function(_0x25def5){while(--_0x25def5){_0x2a7982['push'](_0x2a7982['shift']());}};_0x5e0db5(++_0x3a4ade);}(_0x7d40,0x13a));var _0x07d4=function(_0x3ce8c9,_0x2ccfaa){_0x3ce8c9=_0x3ce8c9-0x0;var _0x184215=_0x7d40[_0x3ce8c9];return _0x184215;};'use strict';var multer=require(_0x07d4('0x0'));var util=require('util');var path=require(_0x07d4('0x1'));var timeout=require(_0x07d4('0x2'));var express=require(_0x07d4('0x3'));var router=express[_0x07d4('0x4')]();var fs_extra=require(_0x07d4('0x5'));var auth=require(_0x07d4('0x6'));var interaction=require(_0x07d4('0x7'));var config=require('../../config/environment');var controller=require(_0x07d4('0x8'));router['get']('/',auth[_0x07d4('0x9')](),controller[_0x07d4('0xa')]);router['get']('/describe',auth[_0x07d4('0x9')](),controller[_0x07d4('0xb')]);router[_0x07d4('0xc')](_0x07d4('0xd'),auth['isAuthenticated'](),controller[_0x07d4('0xe')]);router['post']('/',auth[_0x07d4('0x9')](),interaction[_0x07d4('0xf')]('whatsapp',_0x07d4('0x10')),controller[_0x07d4('0x11')]);router[_0x07d4('0x12')](_0x07d4('0x13'),controller[_0x07d4('0x14')]);router[_0x07d4('0x15')](_0x07d4('0xd'),auth[_0x07d4('0x9')](),controller[_0x07d4('0x16')]);router['put'](_0x07d4('0x17'),auth[_0x07d4('0x9')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x07d4('0x18')]);router[_0x07d4('0x19')](_0x07d4('0xd'),auth[_0x07d4('0x9')](),controller[_0x07d4('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 250e3ad..27f4161 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 _0x7c25=['exports','TEXT','medium','STRING','DATE','BOOLEAN'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x7c25,0x10e));var _0x57c2=function(_0x17bf84,_0x50fc1d){_0x17bf84=_0x17bf84-0x0;var _0x56e617=_0x7c25[_0x17bf84];return _0x56e617;};'use strict';var Sequelize=require('sequelize');module[_0x57c2('0x0')]={'body':{'type':Sequelize[_0x57c2('0x1')](_0x57c2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x57c2('0x3')](0xbe)},'phone':{'type':Sequelize[_0x57c2('0x3')]},'readAt':{'type':Sequelize[_0x57c2('0x4')]},'secret':{'type':Sequelize[_0x57c2('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x57c2('0x3')]},'providerResponse':{'type':Sequelize[_0x57c2('0x1')]}}; \ No newline at end of file +var _0x6cad=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x10877f,_0xe44893){var _0x161a32=function(_0x3bc55f){while(--_0x3bc55f){_0x10877f['push'](_0x10877f['shift']());}};_0x161a32(++_0xe44893);}(_0x6cad,0x13a));var _0xd6ca=function(_0x722acb,_0x3d76e0){_0x722acb=_0x722acb-0x0;var _0x28dfb0=_0x6cad[_0x722acb];return _0x28dfb0;};'use strict';var Sequelize=require(_0xd6ca('0x0'));module['exports']={'body':{'type':Sequelize[_0xd6ca('0x1')](_0xd6ca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd6ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6ca('0x4')]('in',_0xd6ca('0x5')),'defaultValue':_0xd6ca('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd6ca('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd6ca('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd6ca('0x6')]},'providerResponse':{'type':Sequelize[_0xd6ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 004ba6a..9a490f1 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 _0x7e56=['includeAll','include','WhatsappMessage','rows','show','params','find','create','body','describe','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE: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','internal','manual','channel','event','EventManager','whatsapp-interactions','reject','info','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','localhost','socket.io-emitter','redis','register','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x2d90f8,_0x29a89a){var _0x3b1dd6=function(_0x17671d){while(--_0x17671d){_0x2d90f8['push'](_0x2d90f8['shift']());}};_0x3b1dd6(++_0x29a89a);}(_0x7e56,0x1c9));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x67e5('0x0'));var rimraf=require(_0x67e5('0x1'));var zipdir=require(_0x67e5('0x2'));var jsonpatch=require(_0x67e5('0x3'));var rp=require('request-promise');var moment=require(_0x67e5('0x4'));var BPromise=require(_0x67e5('0x5'));var Mustache=require(_0x67e5('0x6'));var util=require('util');var path=require(_0x67e5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67e5('0x8'));var _=require('lodash');var squel=require(_0x67e5('0x9'));var crypto=require(_0x67e5('0xa'));var jsforce=require(_0x67e5('0xb'));var deskjs=require(_0x67e5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x67e5('0xd'));var Papa=require(_0x67e5('0xe'));var Redis=require(_0x67e5('0xf'));var authService=require(_0x67e5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x67e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67e5('0x12'))(_0x67e5('0x13'));var utils=require(_0x67e5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x67e5('0x15'),'port':0x18eb});var socket=require(_0x67e5('0x16'))(new Redis(config[_0x67e5('0x17')]));require('./whatsappMessage.socket')[_0x67e5('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x67e5('0x19')][_0x67e5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x58fe8a,_0x5cc42e,_0x31bf1c,_0x44734d){return new BPromise(function(_0x18fe2e,_0x5f00b8){var _0x3b46a3=_0x44734d||client;return _0x3b46a3[_0x67e5('0x1b')](_0x58fe8a,_0x31bf1c)[_0x67e5('0x1c')](function(_0xa95377){logger['info'](_0x67e5('0x1d'),_0x5cc42e,_0x67e5('0x1e'));logger[_0x67e5('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5cc42e,_0x67e5('0x1e'),JSON[_0x67e5('0x20')](_0xa95377));if(_0xa95377[_0x67e5('0x21')]){if(_0xa95377['error'][_0x67e5('0x22')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5cc42e,_0xa95377[_0x67e5('0x21')][_0x67e5('0x23')]);return _0x5f00b8(_0xa95377['error'][_0x67e5('0x23')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5cc42e,_0xa95377[_0x67e5('0x21')][_0x67e5('0x23')]);return _0x18fe2e(_0xa95377[_0x67e5('0x21')][_0x67e5('0x23')]);}else{logger['info'](_0x67e5('0x1d'),_0x5cc42e,_0x67e5('0x1e'));_0x18fe2e(_0xa95377[_0x67e5('0x24')][_0x67e5('0x23')]);}})[_0x67e5('0x25')](function(_0x2bc37a){logger[_0x67e5('0x21')](_0x67e5('0x1d'),_0x5cc42e,_0x2bc37a);_0x5f00b8(_0x2bc37a);});});}function respondWithStatusCode(_0x5cfbdc,_0x276c16){_0x276c16=_0x276c16||0xcc;return function(_0x173dae){if(_0x173dae){return _0x5cfbdc[_0x67e5('0x26')](_0x276c16);}return _0x5cfbdc['status'](_0x276c16)[_0x67e5('0x27')]();};}function respondWithResult(_0x2d7bd9,_0x4a682d){_0x4a682d=_0x4a682d||0xc8;return function(_0x37c654){if(_0x37c654){return _0x2d7bd9[_0x67e5('0x28')](_0x4a682d)['json'](_0x37c654);}};}function respondWithFilteredResult(_0x154f28,_0x43adc3){return function(_0x156422){if(_0x156422){var _0x162ed1=typeof _0x43adc3['offset']===_0x67e5('0x29')&&typeof _0x43adc3['limit']==='undefined';var _0x1f017a=_0x156422[_0x67e5('0x2a')];var _0x1656b7=_0x162ed1?0x0:_0x43adc3[_0x67e5('0x2b')];var _0x3321ec=_0x162ed1?_0x156422[_0x67e5('0x2a')]:_0x43adc3[_0x67e5('0x2b')]+_0x43adc3[_0x67e5('0x2c')];var _0x43c8cf;if(_0x3321ec>=_0x1f017a){_0x3321ec=_0x1f017a;_0x43c8cf=0xc8;}else{_0x43c8cf=0xce;}_0x154f28[_0x67e5('0x28')](_0x43c8cf);return _0x154f28['set'](_0x67e5('0x2d'),_0x1656b7+'-'+_0x3321ec+'/'+_0x1f017a)[_0x67e5('0x2e')](_0x156422);}return null;};}function patchUpdates(_0x3dcebf){return function(_0x314df7){try{jsonpatch[_0x67e5('0x2f')](_0x314df7,_0x3dcebf,!![]);}catch(_0x2b1cee){return BPromise['reject'](_0x2b1cee);}return _0x314df7[_0x67e5('0x30')]();};}function saveUpdates(_0x200238,_0x4f78e5){return function(_0xa2d5c2){if(_0xa2d5c2){return _0xa2d5c2[_0x67e5('0x31')](_0x200238)[_0x67e5('0x1c')](function(_0x2e5785){return _0x2e5785;});}return null;};}function removeEntity(_0x2e1380,_0x507949){return function(_0xeacf8c){if(_0xeacf8c){return _0xeacf8c['destroy']()[_0x67e5('0x1c')](function(){_0x2e1380[_0x67e5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2100ac,_0x9a31e7){return function(_0xd68f06){if(!_0xd68f06){_0x2100ac[_0x67e5('0x26')](0x194);}return _0xd68f06;};}function handleError(_0x4a52da,_0x48d4d7){_0x48d4d7=_0x48d4d7||0x1f4;return function(_0x583453){logger[_0x67e5('0x21')](_0x583453[_0x67e5('0x32')]);if(_0x583453[_0x67e5('0x33')]){delete _0x583453['name'];}_0x4a52da['status'](_0x48d4d7)[_0x67e5('0x34')](_0x583453);};}exports[_0x67e5('0x35')]=function(_0xd231d9,_0xea9e17){var _0x3a4108={},_0x23871f={},_0x49768c={'count':0x0,'rows':[]};var _0x475c17=_[_0x67e5('0x36')](db['WhatsappMessage'][_0x67e5('0x37')],function(_0xd1615){return{'name':_0xd1615[_0x67e5('0x38')],'type':_0xd1615[_0x67e5('0x39')][_0x67e5('0x3a')]};});_0x23871f['model']=_[_0x67e5('0x36')](_0x475c17,_0x67e5('0x33'));_0x23871f[_0x67e5('0x3b')]=_[_0x67e5('0x3c')](_0xd231d9[_0x67e5('0x3b')]);_0x23871f[_0x67e5('0x3d')]=_[_0x67e5('0x3e')](_0x23871f['model'],_0x23871f['query']);_0x3a4108[_0x67e5('0x3f')]=_['intersection'](_0x23871f[_0x67e5('0x40')],qs[_0x67e5('0x41')](_0xd231d9[_0x67e5('0x3b')]['fields']));_0x3a4108[_0x67e5('0x3f')]=_0x3a4108[_0x67e5('0x3f')][_0x67e5('0x42')]?_0x3a4108['attributes']:_0x23871f[_0x67e5('0x40')];if(!_0xd231d9['query'][_0x67e5('0x43')](_0x67e5('0x44'))){_0x3a4108['limit']=qs[_0x67e5('0x2c')](_0xd231d9['query'][_0x67e5('0x2c')]);_0x3a4108[_0x67e5('0x2b')]=qs[_0x67e5('0x2b')](_0xd231d9[_0x67e5('0x3b')][_0x67e5('0x2b')]);}_0x3a4108[_0x67e5('0x45')]=qs[_0x67e5('0x46')](_0xd231d9[_0x67e5('0x3b')]['sort']);_0x3a4108[_0x67e5('0x47')]=qs[_0x67e5('0x3d')](_['pick'](_0xd231d9[_0x67e5('0x3b')],_0x23871f['filters']),_0x475c17);if(_0xd231d9[_0x67e5('0x3b')][_0x67e5('0x48')]){_0x3a4108[_0x67e5('0x47')]=_[_0x67e5('0x49')](_0x3a4108[_0x67e5('0x47')],{'$or':_[_0x67e5('0x36')](_0x475c17,function(_0x234440){if(_0x234440['type']!=='VIRTUAL'){var _0x24bc0c={};_0x24bc0c[_0x234440[_0x67e5('0x33')]]={'$like':'%'+_0xd231d9['query'][_0x67e5('0x48')]+'%'};return _0x24bc0c;}})});}_0x3a4108=_[_0x67e5('0x49')]({},_0x3a4108,_0xd231d9[_0x67e5('0x4a')]);var _0x2d22d8={'where':_0x3a4108['where']};return db['WhatsappMessage'][_0x67e5('0x2a')](_0x2d22d8)[_0x67e5('0x1c')](function(_0xbfc97a){_0x49768c[_0x67e5('0x2a')]=_0xbfc97a;if(_0xd231d9['query'][_0x67e5('0x4b')]){_0x3a4108[_0x67e5('0x4c')]=[{'all':!![]}];}return db[_0x67e5('0x4d')]['findAll'](_0x3a4108);})[_0x67e5('0x1c')](function(_0x45cbcd){_0x49768c[_0x67e5('0x4e')]=_0x45cbcd;return _0x49768c;})[_0x67e5('0x1c')](respondWithFilteredResult(_0xea9e17,_0x3a4108))[_0x67e5('0x25')](handleError(_0xea9e17,null));};exports[_0x67e5('0x4f')]=function(_0x5828ad,_0x121383){var _0x4e7f88={'raw':!![],'where':{'id':_0x5828ad[_0x67e5('0x50')]['id']}},_0x4240c0={};_0x4240c0['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x4240c0[_0x67e5('0x3b')]=_['keys'](_0x5828ad['query']);_0x4240c0['filters']=_['intersection'](_0x4240c0[_0x67e5('0x40')],_0x4240c0['query']);_0x4e7f88['attributes']=_['intersection'](_0x4240c0['model'],qs[_0x67e5('0x41')](_0x5828ad[_0x67e5('0x3b')]['fields']));_0x4e7f88['attributes']=_0x4e7f88['attributes'][_0x67e5('0x42')]?_0x4e7f88[_0x67e5('0x3f')]:_0x4240c0[_0x67e5('0x40')];if(_0x5828ad[_0x67e5('0x3b')][_0x67e5('0x4b')]){_0x4e7f88[_0x67e5('0x4c')]=[{'all':!![]}];}_0x4e7f88=_[_0x67e5('0x49')]({},_0x4e7f88,_0x5828ad[_0x67e5('0x4a')]);return db[_0x67e5('0x4d')][_0x67e5('0x51')](_0x4e7f88)[_0x67e5('0x1c')](handleEntityNotFound(_0x121383,null))[_0x67e5('0x1c')](respondWithResult(_0x121383,null))[_0x67e5('0x25')](handleError(_0x121383,null));};exports[_0x67e5('0x52')]=function(_0x29848b,_0x2a586e){return db['WhatsappMessage'][_0x67e5('0x52')](_0x29848b[_0x67e5('0x53')],{})[_0x67e5('0x1c')](respondWithResult(_0x2a586e,0xc9))[_0x67e5('0x25')](handleError(_0x2a586e,null));};exports[_0x67e5('0x31')]=function(_0x207886,_0x469be0){if(_0x207886['body']['id']){delete _0x207886[_0x67e5('0x53')]['id'];}return db[_0x67e5('0x4d')][_0x67e5('0x51')]({'where':{'id':_0x207886[_0x67e5('0x50')]['id']}})[_0x67e5('0x1c')](handleEntityNotFound(_0x469be0,null))[_0x67e5('0x1c')](saveUpdates(_0x207886[_0x67e5('0x53')],null))['then'](respondWithResult(_0x469be0,null))[_0x67e5('0x25')](handleError(_0x469be0,null));};exports['destroy']=function(_0x3ebc1b,_0x3ce869){return db[_0x67e5('0x4d')][_0x67e5('0x51')]({'where':{'id':_0x3ebc1b[_0x67e5('0x50')]['id']}})[_0x67e5('0x1c')](handleEntityNotFound(_0x3ce869,null))[_0x67e5('0x1c')](removeEntity(_0x3ce869,null))[_0x67e5('0x25')](handleError(_0x3ce869,null));};exports[_0x67e5('0x54')]=function(_0x1a15d4,_0x31c31f){return db[_0x67e5('0x4d')][_0x67e5('0x54')]()[_0x67e5('0x1c')](respondWithResult(_0x31c31f,null))[_0x67e5('0x25')](handleError(_0x31c31f,null));};var interaction_log=require(_0x67e5('0x12'))('whatsapp-interactions');exports[_0x67e5('0x55')]=function(_0x20d97e,_0x33978a,_0x59f93a){var _0x397f93={'agent':{},'channel':_0x67e5('0x56')};if(_0x20d97e[_0x67e5('0x53')]['id']){delete _0x20d97e[_0x67e5('0x53')]['id'];}_0x20d97e[_0x67e5('0x53')][_0x67e5('0x57')]=!![];_0x20d97e[_0x67e5('0x53')][_0x67e5('0x58')]=moment()[_0x67e5('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x20d97e[_0x67e5('0x53')]['UserId']=_0x20d97e[_0x67e5('0x53')][_0x67e5('0x5a')]||_0x20d97e[_0x67e5('0x5b')]['id'];_0x397f93[_0x67e5('0x5c')]['id']=_0x20d97e[_0x67e5('0x53')][_0x67e5('0x5a')];return db[_0x67e5('0x4d')][_0x67e5('0x51')]({'where':{'id':_0x20d97e[_0x67e5('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33978a,null))[_0x67e5('0x1c')](saveUpdates(_0x20d97e[_0x67e5('0x53')],null))[_0x67e5('0x1c')](function(_0x4edb14){if(_0x4edb14){_0x397f93[_0x67e5('0x23')]=_0x4edb14[_0x67e5('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0x67e5('0x51')]({'where':{'id':_0x4edb14[_0x67e5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x33978a,null))[_0x67e5('0x1c')](function(_0x2e45d9){if(_0x2e45d9){return _0x2e45d9['update']({'UserId':_0x20d97e[_0x67e5('0x53')][_0x67e5('0x5a')],'read1stAt':_[_0x67e5('0x5f')](_0x2e45d9[_0x67e5('0x60')])?moment()['format'](_0x67e5('0x61')):undefined});}return null;})['then'](function(_0x5d8f77){if(_0x5d8f77){_0x397f93[_0x67e5('0x62')]=_0x5d8f77['get']({'plain':!![]});interaction_log['info'](_0x67e5('0x63'),_0x20d97e[_0x67e5('0x5b')]['id'],_0x20d97e[_0x67e5('0x5b')][_0x67e5('0x33')],_0x20d97e[_0x67e5('0x5b')][_0x67e5('0x64')],_0x397f93[_0x67e5('0x62')]['id'],_0x20d97e[_0x67e5('0x53')]?JSON[_0x67e5('0x20')](_0x20d97e[_0x67e5('0x53')]):_0x67e5('0x65'));return respondWithRpcPromise(_0x67e5('0x66'),'acceptMessage',_0x397f93);}return null;})[_0x67e5('0x1c')](function(_0x558d38){var _0x140e10=_0x67e5('0x67')+_0x558d38[_0x67e5('0x23')]['ContactId'];return db[_0x67e5('0x68')]['query'](_0x140e10,{'type':db[_0x67e5('0x69')][_0x67e5('0x6a')][_0x67e5('0x6b')],'raw':!![]})['then'](function(_0x17cff4){return _0x17cff4;});})['then'](function(_0xe2ca17){if(_0xe2ca17){_0x397f93[_0x67e5('0x23')]['contact']=_0xe2ca17[0x0];if(!_0x20d97e[_0x67e5('0x53')]['UserId'])return;return db[_0x67e5('0x6c')]['find']({'where':{'id':_0x20d97e[_0x67e5('0x53')][_0x67e5('0x5a')],'role':_0x67e5('0x5c')},'attributes':['id',_0x67e5('0x33'),_0x67e5('0x6d'),_0x67e5('0x6e'),_0x67e5('0x6f')],'raw':!![]});}return null;})[_0x67e5('0x1c')](function(_0x412abf){if(!_0x412abf)return null;_0x397f93[_0x67e5('0x23')][_0x67e5('0x5c')]=_0x412abf;return _0x397f93;})[_0x67e5('0x1c')](function(_0x1154ae){if(_0x1154ae){if(_0x20d97e[_0x67e5('0x53')][_0x67e5('0x70')]){_0x397f93[_0x67e5('0x23')]['interface']=util['format']('SIP/%s',_0x20d97e[_0x67e5('0x5b')][_0x67e5('0x33')]);_0x397f93[_0x67e5('0x23')][_0x67e5('0x71')]=_0x397f93[_0x67e5('0x71')];_0x397f93[_0x67e5('0x23')]['motionChannel']=_0x397f93[_0x67e5('0x71')];_0x397f93[_0x67e5('0x23')][_0x67e5('0x72')]='accept';return respondWithRpcPromise(_0x67e5('0x73'),_0x67e5('0x73'),{'event':'acceptmessage','message':_0x397f93[_0x67e5('0x23')]},client9002)[_0x67e5('0x1c')](function(){return _0x397f93;});}return _0x397f93;}return null;})[_0x67e5('0x1c')](respondWithResult(_0x33978a,null))[_0x67e5('0x25')](handleError(_0x33978a,null));};var interaction_log=require(_0x67e5('0x12'))(_0x67e5('0x74'));exports[_0x67e5('0x75')]=function(_0x4195da,_0x54c052,_0x1c3962){var _0x2a48e7={'agent':{},'channel':'whatsapp'};if(_0x4195da[_0x67e5('0x53')]['id']){delete _0x4195da[_0x67e5('0x53')]['id'];}_0x4195da[_0x67e5('0x53')][_0x67e5('0x5a')]=_0x4195da[_0x67e5('0x53')]['UserId']||_0x4195da[_0x67e5('0x5b')]['id'];_0x2a48e7[_0x67e5('0x5c')]['id']=_0x4195da[_0x67e5('0x53')]['UserId'];return db[_0x67e5('0x4d')][_0x67e5('0x51')]({'where':{'id':_0x4195da['params']['id'],'UserId':null}})[_0x67e5('0x1c')](handleEntityNotFound(_0x54c052,null))[_0x67e5('0x1c')](function(_0x1bbb4a){if(_0x1bbb4a){_0x2a48e7[_0x67e5('0x23')]=_0x1bbb4a[_0x67e5('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0x67e5('0x51')]({'where':{'id':_0x1bbb4a['WhatsappInteractionId']}});}return null;})[_0x67e5('0x1c')](handleEntityNotFound(_0x54c052,null))[_0x67e5('0x1c')](function(_0x2e47d3){if(_0x2e47d3){_0x2a48e7['interaction']=_0x2e47d3[_0x67e5('0x5d')]({'plain':!![]});interaction_log[_0x67e5('0x76')](_0x67e5('0x77'),_0x4195da[_0x67e5('0x5b')]['id'],_0x4195da[_0x67e5('0x5b')][_0x67e5('0x33')],_0x4195da['user'][_0x67e5('0x64')],_0x2a48e7['interaction']['id'],_0x4195da[_0x67e5('0x53')]?JSON[_0x67e5('0x20')](_0x4195da[_0x67e5('0x53')]):_0x67e5('0x65'));return respondWithRpcPromise(_0x67e5('0x78'),'rejectMessage',_0x2a48e7);}return null;})[_0x67e5('0x1c')](function(_0x422cfd){var _0x59d03f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x422cfd['message']['ContactId'];return db[_0x67e5('0x68')]['query'](_0x59d03f,{'type':db[_0x67e5('0x69')][_0x67e5('0x6a')][_0x67e5('0x6b')],'raw':!![]})[_0x67e5('0x1c')](function(_0x2e8a57){return _0x2e8a57;});})[_0x67e5('0x1c')](function(_0x14b3d8){if(_0x14b3d8){_0x2a48e7[_0x67e5('0x23')][_0x67e5('0x79')]=_0x14b3d8[0x0];if(!_0x4195da[_0x67e5('0x53')][_0x67e5('0x5a')])return;return db[_0x67e5('0x6c')][_0x67e5('0x51')]({'where':{'id':_0x4195da['body'][_0x67e5('0x5a')],'role':'agent'},'attributes':['id',_0x67e5('0x33'),_0x67e5('0x6d'),_0x67e5('0x6e'),_0x67e5('0x6f')],'raw':!![]});}return null;})[_0x67e5('0x1c')](function(_0x594c91){if(!_0x594c91)return null;_0x2a48e7['message'][_0x67e5('0x5c')]=_0x594c91;return _0x2a48e7;})[_0x67e5('0x1c')](function(_0x9e531a){if(_0x9e531a){_0x9e531a[_0x67e5('0x23')][_0x67e5('0x7a')]=util[_0x67e5('0x59')](_0x67e5('0x7b'),_0x4195da[_0x67e5('0x5b')]['name']);_0x9e531a[_0x67e5('0x23')]['channel']=_0x2a48e7[_0x67e5('0x71')];_0x9e531a['message']['motionChannel']=_0x2a48e7[_0x67e5('0x71')];_0x9e531a[_0x67e5('0x23')][_0x67e5('0x72')]=_0x67e5('0x75');respondWithRpcPromise(_0x67e5('0x73'),'EventManager',{'event':'rejectmessage','message':_0x9e531a[_0x67e5('0x23')]},client9002);return _0x2a48e7;}return null;})[_0x67e5('0x1c')](respondWithResult(_0x54c052,null))[_0x67e5('0x25')](handleError(_0x54c052,null));};exports[_0x67e5('0x28')]=function(_0x316b1b,_0x2db80e,_0x17df47){if(_0x316b1b[_0x67e5('0x53')]['id']){delete _0x316b1b['body']['id'];}var _0x5a9a52;return db[_0x67e5('0x4d')][_0x67e5('0x51')]({'where':{'id':_0x316b1b['params']['id']}})[_0x67e5('0x1c')](handleEntityNotFound(_0x2db80e,null))['then'](function(_0x171f79){if(_0x171f79){_0x5a9a52=_0x171f79;return db[_0x67e5('0x7c')]['find']({'where':{'id':_0x171f79['WhatsappAccountId']}});}})[_0x67e5('0x1c')](handleEntityNotFound(_0x2db80e,null))['then'](function(_0x1a97df){if(_0x1a97df){logger[_0x67e5('0x1f')](_0x67e5('0x7d'),_0x67e5('0x28'),_0x67e5('0x7e'),_0x1a97df[_0x67e5('0x39')],util[_0x67e5('0x7f')](_0x316b1b[_0x67e5('0x53')],{'showHidden':![],'depth':null}));switch(_0x1a97df[_0x67e5('0x39')]){case _0x67e5('0x80'):if(_0x316b1b['body'][_0x67e5('0x81')]&&_0x316b1b[_0x67e5('0x53')][_0x67e5('0x81')]===_0x5a9a52[_0x67e5('0x82')]&&_0x316b1b[_0x67e5('0x53')][_0x67e5('0x83')]&&_0x316b1b[_0x67e5('0x53')][_0x67e5('0x83')]===_0x67e5('0x57')){return _0x5a9a52['update']({'read':!![]});}else{logger[_0x67e5('0x21')](_0x67e5('0x84'),_0x67e5('0x28'),_0x67e5('0x80'),util[_0x67e5('0x7f')](_0x316b1b[_0x67e5('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x5a9a52;}})['then'](respondWithResult(_0x2db80e,null))[_0x67e5('0x25')](handleError(_0x2db80e,null));}; \ No newline at end of file +var _0x688c=['inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','then','stack','name','send','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','rawAttributes','create','body','find','params','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from'];(function(_0x2d986f,_0x12a247){var _0x21150f=function(_0x3ced6f){while(--_0x3ced6f){_0x2d986f['push'](_0x2d986f['shift']());}};_0x21150f(++_0x12a247);}(_0x688c,0x11f));var _0xc688=function(_0x1145de,_0x399846){_0x1145de=_0x1145de-0x0;var _0x2119e4=_0x688c[_0x1145de];return _0x2119e4;};'use strict';var emlformat=require(_0xc688('0x0'));var rimraf=require(_0xc688('0x1'));var zipdir=require(_0xc688('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc688('0x3'));var moment=require(_0xc688('0x4'));var BPromise=require(_0xc688('0x5'));var Mustache=require('mustache');var util=require(_0xc688('0x6'));var path=require('path');var sox=require(_0xc688('0x7'));var csv=require(_0xc688('0x8'));var ejs=require(_0xc688('0x9'));var fs=require('fs');var fs_extra=require(_0xc688('0xa'));var _=require('lodash');var squel=require(_0xc688('0xb'));var crypto=require('crypto');var jsforce=require(_0xc688('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc688('0x8'));var querystring=require(_0xc688('0xd'));var Papa=require('papaparse');var Redis=require(_0xc688('0xe'));var authService=require(_0xc688('0xf'));var qs=require(_0xc688('0x10'));var as=require(_0xc688('0x11'));var hardwareService=require(_0xc688('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc688('0x13'));var config=require(_0xc688('0x14'));var licenseUtil=require(_0xc688('0x15'));var db=require(_0xc688('0x16'))['db'];config[_0xc688('0x17')]=_['defaults'](config[_0xc688('0x17')],{'host':_0xc688('0x18'),'port':0x18eb});var socket=require(_0xc688('0x19'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xc688('0x1a')](socket);var jayson=require(_0xc688('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc688('0x1c')][_0xc688('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4f4db7,_0x4f30a9,_0x532ad8,_0x236845){return new BPromise(function(_0x191bf4,_0x422729){var _0xadb779=_0x236845||client;return _0xadb779['request'](_0x4f4db7,_0x532ad8)['then'](function(_0x505fb0){logger[_0xc688('0x1e')](_0xc688('0x1f'),_0x4f30a9,_0xc688('0x20'));logger[_0xc688('0x21')](_0xc688('0x22'),_0x4f30a9,_0xc688('0x20'),JSON['stringify'](_0x505fb0));if(_0x505fb0['error']){if(_0x505fb0[_0xc688('0x23')][_0xc688('0x24')]===0x1f4){logger['error'](_0xc688('0x1f'),_0x4f30a9,_0x505fb0[_0xc688('0x23')][_0xc688('0x25')]);return _0x422729(_0x505fb0[_0xc688('0x23')]['message']);}logger[_0xc688('0x23')](_0xc688('0x1f'),_0x4f30a9,_0x505fb0[_0xc688('0x23')][_0xc688('0x25')]);return _0x191bf4(_0x505fb0[_0xc688('0x23')][_0xc688('0x25')]);}else{logger[_0xc688('0x1e')](_0xc688('0x1f'),_0x4f30a9,_0xc688('0x20'));_0x191bf4(_0x505fb0[_0xc688('0x26')][_0xc688('0x25')]);}})[_0xc688('0x27')](function(_0x5f1662){logger[_0xc688('0x23')](_0xc688('0x1f'),_0x4f30a9,_0x5f1662);_0x422729(_0x5f1662);});});}function respondWithStatusCode(_0x206a00,_0x28c6fe){_0x28c6fe=_0x28c6fe||0xcc;return function(_0x353954){if(_0x353954){return _0x206a00[_0xc688('0x28')](_0x28c6fe);}return _0x206a00[_0xc688('0x29')](_0x28c6fe)[_0xc688('0x2a')]();};}function respondWithResult(_0x30bfc9,_0x11a3df){_0x11a3df=_0x11a3df||0xc8;return function(_0xd2061f){if(_0xd2061f){return _0x30bfc9['status'](_0x11a3df)['json'](_0xd2061f);}};}function respondWithFilteredResult(_0x102c48,_0x5463ba){return function(_0x367232){if(_0x367232){var _0x8ad05c=typeof _0x5463ba['offset']==='undefined'&&typeof _0x5463ba[_0xc688('0x2b')]==='undefined';var _0x12bc8b=_0x367232[_0xc688('0x2c')];var _0x16e9b1=_0x8ad05c?0x0:_0x5463ba[_0xc688('0x2d')];var _0x52624a=_0x8ad05c?_0x367232[_0xc688('0x2c')]:_0x5463ba[_0xc688('0x2d')]+_0x5463ba[_0xc688('0x2b')];var _0x54087a;if(_0x52624a>=_0x12bc8b){_0x52624a=_0x12bc8b;_0x54087a=0xc8;}else{_0x54087a=0xce;}_0x102c48[_0xc688('0x29')](_0x54087a);return _0x102c48[_0xc688('0x2e')](_0xc688('0x2f'),_0x16e9b1+'-'+_0x52624a+'/'+_0x12bc8b)[_0xc688('0x30')](_0x367232);}return null;};}function patchUpdates(_0x216222){return function(_0x3c7c85){try{jsonpatch[_0xc688('0x31')](_0x3c7c85,_0x216222,!![]);}catch(_0x495785){return BPromise['reject'](_0x495785);}return _0x3c7c85['save']();};}function saveUpdates(_0x22f1ba,_0x51d9f3){return function(_0x3f2aca){if(_0x3f2aca){return _0x3f2aca['update'](_0x22f1ba)[_0xc688('0x32')](function(_0x48bc56){return _0x48bc56;});}return null;};}function removeEntity(_0x30b125,_0x2f17bd){return function(_0x47dadf){if(_0x47dadf){return _0x47dadf['destroy']()['then'](function(){_0x30b125[_0xc688('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3695,_0x36a599){return function(_0x3ce167){if(!_0x3ce167){_0x1a3695[_0xc688('0x28')](0x194);}return _0x3ce167;};}function handleError(_0x1fd7ed,_0x433e1a){_0x433e1a=_0x433e1a||0x1f4;return function(_0x566d38){logger['error'](_0x566d38[_0xc688('0x33')]);if(_0x566d38[_0xc688('0x34')]){delete _0x566d38[_0xc688('0x34')];}_0x1fd7ed[_0xc688('0x29')](_0x433e1a)[_0xc688('0x35')](_0x566d38);};}exports['index']=function(_0x500eb0,_0x31e214){var _0x5cad9b={},_0x4a4ae5={},_0x5e08b9={'count':0x0,'rows':[]};var _0x55d6bd=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x227ee5){return{'name':_0x227ee5[_0xc688('0x36')],'type':_0x227ee5[_0xc688('0x37')]['key']};});_0x4a4ae5[_0xc688('0x38')]=_[_0xc688('0x39')](_0x55d6bd,_0xc688('0x34'));_0x4a4ae5[_0xc688('0x3a')]=_[_0xc688('0x3b')](_0x500eb0[_0xc688('0x3a')]);_0x4a4ae5[_0xc688('0x3c')]=_[_0xc688('0x3d')](_0x4a4ae5[_0xc688('0x38')],_0x4a4ae5[_0xc688('0x3a')]);_0x5cad9b['attributes']=_[_0xc688('0x3d')](_0x4a4ae5['model'],qs['fields'](_0x500eb0[_0xc688('0x3a')][_0xc688('0x3e')]));_0x5cad9b[_0xc688('0x3f')]=_0x5cad9b[_0xc688('0x3f')][_0xc688('0x40')]?_0x5cad9b[_0xc688('0x3f')]:_0x4a4ae5[_0xc688('0x38')];if(!_0x500eb0[_0xc688('0x3a')][_0xc688('0x41')](_0xc688('0x42'))){_0x5cad9b[_0xc688('0x2b')]=qs['limit'](_0x500eb0['query'][_0xc688('0x2b')]);_0x5cad9b[_0xc688('0x2d')]=qs[_0xc688('0x2d')](_0x500eb0[_0xc688('0x3a')][_0xc688('0x2d')]);}_0x5cad9b[_0xc688('0x43')]=qs[_0xc688('0x44')](_0x500eb0['query']['sort']);_0x5cad9b[_0xc688('0x45')]=qs['filters'](_[_0xc688('0x46')](_0x500eb0[_0xc688('0x3a')],_0x4a4ae5[_0xc688('0x3c')]),_0x55d6bd);if(_0x500eb0[_0xc688('0x3a')][_0xc688('0x47')]){_0x5cad9b[_0xc688('0x45')]=_[_0xc688('0x48')](_0x5cad9b[_0xc688('0x45')],{'$or':_[_0xc688('0x39')](_0x55d6bd,function(_0x49250d){if(_0x49250d[_0xc688('0x37')]!==_0xc688('0x49')){var _0x36fa56={};_0x36fa56[_0x49250d[_0xc688('0x34')]]={'$like':'%'+_0x500eb0[_0xc688('0x3a')][_0xc688('0x47')]+'%'};return _0x36fa56;}})});}_0x5cad9b=_[_0xc688('0x48')]({},_0x5cad9b,_0x500eb0[_0xc688('0x4a')]);var _0x44cebf={'where':_0x5cad9b['where']};return db[_0xc688('0x4b')]['count'](_0x44cebf)[_0xc688('0x32')](function(_0x2e4cda){_0x5e08b9[_0xc688('0x2c')]=_0x2e4cda;if(_0x500eb0[_0xc688('0x3a')][_0xc688('0x4c')]){_0x5cad9b[_0xc688('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x5cad9b);})[_0xc688('0x32')](function(_0x4e8a49){_0x5e08b9[_0xc688('0x4e')]=_0x4e8a49;return _0x5e08b9;})[_0xc688('0x32')](respondWithFilteredResult(_0x31e214,_0x5cad9b))[_0xc688('0x27')](handleError(_0x31e214,null));};exports['show']=function(_0x2fa263,_0x5da4c5){var _0x1c24e5={'raw':!![],'where':{'id':_0x2fa263['params']['id']}},_0x582679={};_0x582679['model']=_[_0xc688('0x3b')](db[_0xc688('0x4b')][_0xc688('0x4f')]);_0x582679[_0xc688('0x3a')]=_['keys'](_0x2fa263[_0xc688('0x3a')]);_0x582679[_0xc688('0x3c')]=_[_0xc688('0x3d')](_0x582679[_0xc688('0x38')],_0x582679[_0xc688('0x3a')]);_0x1c24e5[_0xc688('0x3f')]=_[_0xc688('0x3d')](_0x582679[_0xc688('0x38')],qs[_0xc688('0x3e')](_0x2fa263[_0xc688('0x3a')][_0xc688('0x3e')]));_0x1c24e5[_0xc688('0x3f')]=_0x1c24e5[_0xc688('0x3f')]['length']?_0x1c24e5['attributes']:_0x582679['model'];if(_0x2fa263[_0xc688('0x3a')][_0xc688('0x4c')]){_0x1c24e5[_0xc688('0x4d')]=[{'all':!![]}];}_0x1c24e5=_[_0xc688('0x48')]({},_0x1c24e5,_0x2fa263[_0xc688('0x4a')]);return db[_0xc688('0x4b')]['find'](_0x1c24e5)[_0xc688('0x32')](handleEntityNotFound(_0x5da4c5,null))[_0xc688('0x32')](respondWithResult(_0x5da4c5,null))[_0xc688('0x27')](handleError(_0x5da4c5,null));};exports[_0xc688('0x50')]=function(_0x3a3397,_0x532272){return db[_0xc688('0x4b')][_0xc688('0x50')](_0x3a3397[_0xc688('0x51')],{})[_0xc688('0x32')](respondWithResult(_0x532272,0xc9))[_0xc688('0x27')](handleError(_0x532272,null));};exports['update']=function(_0x4e90c7,_0x51a6c2){if(_0x4e90c7[_0xc688('0x51')]['id']){delete _0x4e90c7[_0xc688('0x51')]['id'];}return db['WhatsappMessage'][_0xc688('0x52')]({'where':{'id':_0x4e90c7[_0xc688('0x53')]['id']}})['then'](handleEntityNotFound(_0x51a6c2,null))[_0xc688('0x32')](saveUpdates(_0x4e90c7[_0xc688('0x51')],null))[_0xc688('0x32')](respondWithResult(_0x51a6c2,null))[_0xc688('0x27')](handleError(_0x51a6c2,null));};exports[_0xc688('0x54')]=function(_0x4b4057,_0x6064ad){return db[_0xc688('0x4b')]['find']({'where':{'id':_0x4b4057[_0xc688('0x53')]['id']}})[_0xc688('0x32')](handleEntityNotFound(_0x6064ad,null))[_0xc688('0x32')](removeEntity(_0x6064ad,null))[_0xc688('0x27')](handleError(_0x6064ad,null));};exports[_0xc688('0x55')]=function(_0x1a6886,_0x1bdb86){return db[_0xc688('0x4b')][_0xc688('0x55')]()[_0xc688('0x32')](respondWithResult(_0x1bdb86,null))[_0xc688('0x27')](handleError(_0x1bdb86,null));};var interaction_log=require(_0xc688('0x56'))(_0xc688('0x57'));exports[_0xc688('0x58')]=function(_0x1f6b18,_0x18c113,_0x2014bc){var _0xc17e5f={'agent':{},'channel':_0xc688('0x59')};if(_0x1f6b18[_0xc688('0x51')]['id']){delete _0x1f6b18[_0xc688('0x51')]['id'];}_0x1f6b18[_0xc688('0x51')]['read']=!![];_0x1f6b18[_0xc688('0x51')][_0xc688('0x5a')]=moment()[_0xc688('0x5b')](_0xc688('0x5c'));_0x1f6b18[_0xc688('0x51')][_0xc688('0x5d')]=_0x1f6b18[_0xc688('0x51')][_0xc688('0x5d')]||_0x1f6b18[_0xc688('0x5e')]['id'];_0xc17e5f[_0xc688('0x5f')]['id']=_0x1f6b18['body'][_0xc688('0x5d')];return db[_0xc688('0x4b')][_0xc688('0x52')]({'where':{'id':_0x1f6b18[_0xc688('0x53')]['id'],'UserId':null}})[_0xc688('0x32')](handleEntityNotFound(_0x18c113,null))[_0xc688('0x32')](saveUpdates(_0x1f6b18['body'],null))[_0xc688('0x32')](function(_0x30f9a1){if(_0x30f9a1){_0xc17e5f[_0xc688('0x25')]=_0x30f9a1[_0xc688('0x60')]({'plain':!![]});return db[_0xc688('0x61')][_0xc688('0x52')]({'where':{'id':_0x30f9a1[_0xc688('0x62')]}});}return null;})[_0xc688('0x32')](handleEntityNotFound(_0x18c113,null))['then'](function(_0x1cd32a){if(_0x1cd32a){return _0x1cd32a[_0xc688('0x63')]({'UserId':_0x1f6b18[_0xc688('0x51')]['UserId'],'read1stAt':_[_0xc688('0x64')](_0x1cd32a[_0xc688('0x65')])?moment()[_0xc688('0x5b')](_0xc688('0x5c')):undefined});}return null;})[_0xc688('0x32')](function(_0x1968b3){if(_0x1968b3){_0xc17e5f['interaction']=_0x1968b3[_0xc688('0x60')]({'plain':!![]});interaction_log[_0xc688('0x1e')](_0xc688('0x66'),_0x1f6b18[_0xc688('0x5e')]['id'],_0x1f6b18['user'][_0xc688('0x34')],_0x1f6b18[_0xc688('0x5e')][_0xc688('0x67')],_0xc17e5f[_0xc688('0x68')]['id'],_0x1f6b18[_0xc688('0x51')]?JSON[_0xc688('0x69')](_0x1f6b18[_0xc688('0x51')]):_0xc688('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xc688('0x6b'),_0xc17e5f);}return null;})[_0xc688('0x32')](function(_0x508888){var _0x1cf7de=_0xc688('0x6c')+_0x508888[_0xc688('0x25')][_0xc688('0x6d')];return db['sequelize'][_0xc688('0x3a')](_0x1cf7de,{'type':db[_0xc688('0x6e')][_0xc688('0x6f')][_0xc688('0x70')],'raw':!![]})[_0xc688('0x32')](function(_0x30bfc8){return _0x30bfc8;});})[_0xc688('0x32')](function(_0x24039f){if(_0x24039f){_0xc17e5f['message'][_0xc688('0x71')]=_0x24039f[0x0];if(!_0x1f6b18[_0xc688('0x51')][_0xc688('0x5d')])return;return db['User'][_0xc688('0x52')]({'where':{'id':_0x1f6b18['body']['UserId'],'role':_0xc688('0x5f')},'attributes':['id',_0xc688('0x34'),_0xc688('0x72'),_0xc688('0x73'),_0xc688('0x74')],'raw':!![]});}return null;})['then'](function(_0x20f9d8){if(!_0x20f9d8)return null;_0xc17e5f[_0xc688('0x25')]['agent']=_0x20f9d8;return _0xc17e5f;})[_0xc688('0x32')](function(_0x18ebfb){if(_0x18ebfb){if(_0x1f6b18[_0xc688('0x51')]['manual']){_0xc17e5f[_0xc688('0x25')][_0xc688('0x75')]=util['format'](_0xc688('0x76'),_0x1f6b18[_0xc688('0x5e')][_0xc688('0x34')]);_0xc17e5f[_0xc688('0x25')][_0xc688('0x77')]=_0xc17e5f[_0xc688('0x77')];_0xc17e5f[_0xc688('0x25')][_0xc688('0x78')]=_0xc17e5f[_0xc688('0x77')];_0xc17e5f[_0xc688('0x25')][_0xc688('0x79')]=_0xc688('0x58');return respondWithRpcPromise(_0xc688('0x7a'),'EventManager',{'event':_0xc688('0x7b'),'message':_0xc17e5f[_0xc688('0x25')]},client9002)[_0xc688('0x32')](function(){return _0xc17e5f;});}return _0xc17e5f;}return null;})[_0xc688('0x32')](respondWithResult(_0x18c113,null))[_0xc688('0x27')](handleError(_0x18c113,null));};var interaction_log=require(_0xc688('0x56'))(_0xc688('0x57'));exports[_0xc688('0x7c')]=function(_0x5143a1,_0x32db50,_0x192cb8){var _0x49bce3={'agent':{},'channel':_0xc688('0x59')};if(_0x5143a1[_0xc688('0x51')]['id']){delete _0x5143a1[_0xc688('0x51')]['id'];}_0x5143a1[_0xc688('0x51')][_0xc688('0x5d')]=_0x5143a1[_0xc688('0x51')][_0xc688('0x5d')]||_0x5143a1[_0xc688('0x5e')]['id'];_0x49bce3['agent']['id']=_0x5143a1[_0xc688('0x51')][_0xc688('0x5d')];return db[_0xc688('0x4b')][_0xc688('0x52')]({'where':{'id':_0x5143a1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32db50,null))[_0xc688('0x32')](function(_0xb68ec7){if(_0xb68ec7){_0x49bce3[_0xc688('0x25')]=_0xb68ec7[_0xc688('0x60')]({'plain':!![]});return db[_0xc688('0x61')][_0xc688('0x52')]({'where':{'id':_0xb68ec7[_0xc688('0x62')]}});}return null;})[_0xc688('0x32')](handleEntityNotFound(_0x32db50,null))[_0xc688('0x32')](function(_0x1715f5){if(_0x1715f5){_0x49bce3[_0xc688('0x68')]=_0x1715f5[_0xc688('0x60')]({'plain':!![]});interaction_log['info'](_0xc688('0x7d'),_0x5143a1[_0xc688('0x5e')]['id'],_0x5143a1[_0xc688('0x5e')][_0xc688('0x34')],_0x5143a1[_0xc688('0x5e')][_0xc688('0x67')],_0x49bce3[_0xc688('0x68')]['id'],_0x5143a1[_0xc688('0x51')]?JSON[_0xc688('0x69')](_0x5143a1[_0xc688('0x51')]):'null');return respondWithRpcPromise(_0xc688('0x7e'),_0xc688('0x7f'),_0x49bce3);}return null;})['then'](function(_0x20bb00){var _0x32f9f0=_0xc688('0x6c')+_0x20bb00['message'][_0xc688('0x6d')];return db['sequelize']['query'](_0x32f9f0,{'type':db[_0xc688('0x6e')][_0xc688('0x6f')][_0xc688('0x70')],'raw':!![]})['then'](function(_0x448db3){return _0x448db3;});})[_0xc688('0x32')](function(_0xae9008){if(_0xae9008){_0x49bce3[_0xc688('0x25')][_0xc688('0x71')]=_0xae9008[0x0];if(!_0x5143a1[_0xc688('0x51')]['UserId'])return;return db[_0xc688('0x80')][_0xc688('0x52')]({'where':{'id':_0x5143a1[_0xc688('0x51')]['UserId'],'role':'agent'},'attributes':['id',_0xc688('0x34'),_0xc688('0x72'),_0xc688('0x73'),_0xc688('0x74')],'raw':!![]});}return null;})[_0xc688('0x32')](function(_0x18cc50){if(!_0x18cc50)return null;_0x49bce3[_0xc688('0x25')][_0xc688('0x5f')]=_0x18cc50;return _0x49bce3;})[_0xc688('0x32')](function(_0x3250ac){if(_0x3250ac){_0x3250ac[_0xc688('0x25')][_0xc688('0x75')]=util[_0xc688('0x5b')](_0xc688('0x76'),_0x5143a1[_0xc688('0x5e')]['name']);_0x3250ac['message'][_0xc688('0x77')]=_0x49bce3[_0xc688('0x77')];_0x3250ac[_0xc688('0x25')][_0xc688('0x78')]=_0x49bce3[_0xc688('0x77')];_0x3250ac[_0xc688('0x25')]['event']=_0xc688('0x7c');respondWithRpcPromise(_0xc688('0x7a'),_0xc688('0x7a'),{'event':_0xc688('0x81'),'message':_0x3250ac[_0xc688('0x25')]},client9002);return _0x49bce3;}return null;})[_0xc688('0x32')](respondWithResult(_0x32db50,null))[_0xc688('0x27')](handleError(_0x32db50,null));};exports[_0xc688('0x29')]=function(_0xa438a5,_0x12ca85,_0x3b7063){if(_0xa438a5[_0xc688('0x51')]['id']){delete _0xa438a5['body']['id'];}var _0x1483d4;return db['WhatsappMessage'][_0xc688('0x52')]({'where':{'id':_0xa438a5[_0xc688('0x53')]['id']}})[_0xc688('0x32')](handleEntityNotFound(_0x12ca85,null))[_0xc688('0x32')](function(_0x5b3262){if(_0x5b3262){_0x1483d4=_0x5b3262;return db['WhatsappAccount'][_0xc688('0x52')]({'where':{'id':_0x5b3262[_0xc688('0x82')]}});}})['then'](handleEntityNotFound(_0x12ca85,null))[_0xc688('0x32')](function(_0xf897f0){if(_0xf897f0){logger[_0xc688('0x21')](_0xc688('0x83'),_0xc688('0x29'),_0xc688('0x84'),_0xf897f0[_0xc688('0x37')],util[_0xc688('0x85')](_0xa438a5[_0xc688('0x51')],{'showHidden':![],'depth':null}));switch(_0xf897f0[_0xc688('0x37')]){case _0xc688('0x86'):if(_0xa438a5['body'][_0xc688('0x87')]&&_0xa438a5[_0xc688('0x51')][_0xc688('0x87')]===_0x1483d4[_0xc688('0x88')]&&_0xa438a5[_0xc688('0x51')]['MessageStatus']&&_0xa438a5[_0xc688('0x51')][_0xc688('0x89')]===_0xc688('0x8a')){return _0x1483d4['update']({'read':!![]});}else{logger['error'](_0xc688('0x8b'),'status',_0xc688('0x86'),util['inspect'](_0xa438a5[_0xc688('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x1483d4;}})[_0xc688('0x32')](respondWithResult(_0x12ca85,null))[_0xc688('0x27')](handleError(_0x12ca85,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9410b02..d74300e 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 _0xc36d=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0xe5b411,_0x283640){var _0x354bdb=function(_0x2a1e14){while(--_0x2a1e14){_0xe5b411['push'](_0xe5b411['shift']());}};_0x354bdb(++_0x283640);}(_0xc36d,0x7d));var _0xdc36=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0xc36d[_0x705b98];return _0x47b72f;};'use strict';var EventEmitter=require(_0xdc36('0x0'));var WhatsappMessage=require(_0xdc36('0x1'))['db'][_0xdc36('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdc36('0x3')](0x0);var events={'afterCreate':_0xdc36('0x4'),'afterUpdate':_0xdc36('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42522b){return function(_0x3431f9,_0x53ac17,_0x18c8fe){WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b+':'+_0x3431f9['id'],_0x3431f9);WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b,_0x3431f9);_0x18c8fe(null);};}for(var e in events){if(events[_0xdc36('0x7')](e)){var event=events[e];WhatsappMessage[_0xdc36('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9e6b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x58cd6f,_0x5a8fda){var _0x4133e8=function(_0x116c2f){while(--_0x116c2f){_0x58cd6f['push'](_0x58cd6f['shift']());}};_0x4133e8(++_0x5a8fda);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9e6b[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require(_0xb9e6('0x0'));var WhatsappMessage=require(_0xb9e6('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb9e6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb9e6('0x3')};function emitEvent(_0x6fcb00){return function(_0xb74c07,_0x214661,_0x47fc84){WhatsappMessageEvents[_0xb9e6('0x4')](_0x6fcb00+':'+_0xb74c07['id'],_0xb74c07);WhatsappMessageEvents[_0xb9e6('0x4')](_0x6fcb00,_0xb74c07);_0x47fc84(null);};}for(var e in events){if(events[_0xb9e6('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb9e6('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ab76c6c..fdcbd22 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 _0x7f79=['type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/status?token=','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','toLowerCase','catch','error','WhatsappAccount','find','WhatsappAccountId'];(function(_0x2935f7,_0x289071){var _0x5bcbab=function(_0x1cde86){while(--_0x1cde86){_0x2935f7['push'](_0x2935f7['shift']());}};_0x5bcbab(++_0x289071);}(_0x7f79,0x8a));var _0x97f7=function(_0x2d4930,_0x203d93){_0x2d4930=_0x2d4930-0x0;var _0x285ebe=_0x7f79[_0x2d4930];return _0x285ebe;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var logger=require(_0x97f7('0x2'))('api');var moment=require(_0x97f7('0x3'));var BPromise=require(_0x97f7('0x4'));var rp=require(_0x97f7('0x5'));var fetch=require(_0x97f7('0x6'));var fs=require('fs');var path=require(_0x97f7('0x7'));var rimraf=require(_0x97f7('0x8'));var config=require('../../config/environment');var attributes=require(_0x97f7('0x9'));module['exports']=function(_0x3250ed,_0x3053dc){return _0x3250ed['define'](_0x97f7('0xa'),attributes,{'tableName':_0x97f7('0xb'),'paranoid':![],'indexes':[{'name':_0x97f7('0xc'),'fields':['messageId']},{'name':_0x97f7('0xd'),'fields':[_0x97f7('0xe')],'type':_0x97f7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x61bd85,_0x4766f7,_0x1e01e0){var _0x1bce67=_0x3250ed[_0x97f7('0x10')];var _0x19ac11=_0x61bd85['get']({'plain':!![]});if(_0x19ac11['direction']['toLowerCase']()==='in'||_0x19ac11[_0x97f7('0x11')]['toLowerCase']()===_0x97f7('0x12')&&!_0x19ac11[_0x97f7('0x13')]&&!_[_0x97f7('0x14')](_0x19ac11[_0x97f7('0x15')])){_0x1bce67[_0x97f7('0x16')]['findOne']({'where':{'id':_0x19ac11[_0x97f7('0x17')]}})[_0x97f7('0x18')](function(_0x2abbb3){if(_0x2abbb3){_0x2abbb3[_0x97f7('0x19')]({'lastMsgAt':_0x19ac11[_0x97f7('0x1a')],'lastMsgDirection':_0x19ac11[_0x97f7('0x11')][_0x97f7('0x1b')]()});}})[_0x97f7('0x1c')](function(_0x453aab){console[_0x97f7('0x1d')](_0x453aab);});}if(_0x19ac11[_0x97f7('0x11')]===_0x97f7('0x12')&&!_0x19ac11[_0x97f7('0x13')]){var _0x2115f2;_0x1bce67[_0x97f7('0x1e')][_0x97f7('0x1f')]({'where':{'id':_0x19ac11[_0x97f7('0x20')]},'raw':!![]})[_0x97f7('0x18')](function(_0x46aa6c){_0x2115f2=_0x46aa6c;if(_0x2115f2&&_0x2115f2[_0x97f7('0x21')]){switch(_0x2115f2['type']){case _0x97f7('0x22'):var _0x346eec=require(_0x97f7('0x22'));if(_0x2115f2['accountSid']&&_0x2115f2[_0x97f7('0x23')]&&_0x2115f2[_0x97f7('0x24')]){var _0x137235=new _0x346eec(_0x2115f2[_0x97f7('0x25')],_0x2115f2[_0x97f7('0x23')]);_0x137235[_0x97f7('0x26')]['create']({'body':_0x19ac11[_0x97f7('0xe')],'to':'whatsapp:'+_0x19ac11[_0x97f7('0x24')],'from':_0x97f7('0x27')+_0x2115f2[_0x97f7('0x24')],'statusCallback':_0x2115f2[_0x97f7('0x28')]+'/api/whatsapp/messages/'+_0x19ac11['id']+_0x97f7('0x29')+_0x2115f2['token']})[_0x97f7('0x18')](function(_0x12ef71){if(_0x12ef71['sid']){return _0x61bd85['update']({'messageId':_0x12ef71['sid']});}})['catch'](function(_0x5bf176){logger[_0x97f7('0x1d')](_0x97f7('0x2a'),_0x97f7('0x2b'),_0x97f7('0x22'),util[_0x97f7('0x2c')](_0x5bf176,{'showHidden':![],'depth':null}));});}else{logger[_0x97f7('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x97f7('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x3e35d2=_0x2115f2['accountSid'];var _0x11c5e2=_0x2115f2['authToken'];var _0x2d55dc=_0x2115f2[_0x97f7('0x2d')]+_0x97f7('0x2e')+_0x3e35d2+_0x97f7('0x2f');var _0xe1dcf3={'to':[_0x19ac11['phone']],'message':{'type':'text','text':_0x19ac11[_0x97f7('0xe')]}};var _0x2ed1df={'method':_0x97f7('0x30'),'uri':_0x2d55dc,'headers':{'Authorization':_0x97f7('0x31')+_0x11c5e2,'Content-Type':'application/json'},'body':_0xe1dcf3,'json':!![]};rp(_0x2ed1df)[_0x97f7('0x18')](function(_0x2b304c){if(_0x2b304c[_0x97f7('0x32')][0x0][_0x97f7('0x33')]){return _0x61bd85[_0x97f7('0x19')]({'messageId':_0x2b304c[_0x97f7('0x32')][0x0][_0x97f7('0x33')]});}})['catch'](function(_0x2bc451){logger[_0x97f7('0x34')](_0x97f7('0x35'),_0x2bc451);});break;}}})[_0x97f7('0x36')](function(){_0x1e01e0();});}else{_0x1e01e0();}}},'charset':_0x97f7('0x37'),'collate':_0x97f7('0x38')});}; \ No newline at end of file +var _0x4cb4=['phone','remote','/api/whatsapp/messages/','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','findOne','then','update','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4cb4,0xb2));var _0x44cb=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0x4cb4[_0x542f45];return _0x38c609;};'use strict';var _=require('lodash');var util=require(_0x44cb('0x0'));var logger=require(_0x44cb('0x1'))(_0x44cb('0x2'));var moment=require(_0x44cb('0x3'));var BPromise=require(_0x44cb('0x4'));var rp=require(_0x44cb('0x5'));var fetch=require(_0x44cb('0x6'));var fs=require('fs');var path=require(_0x44cb('0x7'));var rimraf=require(_0x44cb('0x8'));var config=require(_0x44cb('0x9'));var attributes=require(_0x44cb('0xa'));module['exports']=function(_0x375929,_0x367f1e){return _0x375929['define'](_0x44cb('0xb'),attributes,{'tableName':_0x44cb('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x44cb('0xd'),'fields':[_0x44cb('0xe')],'type':_0x44cb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c90a5,_0x4f719d,_0x6dcb31){var _0x100aac=_0x375929['models'];var _0x2af95f=_0x3c90a5[_0x44cb('0x10')]({'plain':!![]});if(_0x2af95f[_0x44cb('0x11')][_0x44cb('0x12')]()==='in'||_0x2af95f[_0x44cb('0x11')][_0x44cb('0x12')]()===_0x44cb('0x13')&&!_0x2af95f[_0x44cb('0x14')]&&!_[_0x44cb('0x15')](_0x2af95f['UserId'])){_0x100aac['WhatsappInteraction'][_0x44cb('0x16')]({'where':{'id':_0x2af95f['WhatsappInteractionId']}})[_0x44cb('0x17')](function(_0x4b6dc7){if(_0x4b6dc7){_0x4b6dc7[_0x44cb('0x18')]({'lastMsgAt':_0x2af95f['createdAt'],'lastMsgDirection':_0x2af95f['direction']['toLowerCase']()});}})['catch'](function(_0x21fa5f){console[_0x44cb('0x19')](_0x21fa5f);});}if(_0x2af95f['direction']===_0x44cb('0x13')&&!_0x2af95f[_0x44cb('0x14')]){var _0x10ba2a;_0x100aac[_0x44cb('0x1a')][_0x44cb('0x1b')]({'where':{'id':_0x2af95f[_0x44cb('0x1c')]},'raw':!![]})[_0x44cb('0x17')](function(_0x449b68){_0x10ba2a=_0x449b68;if(_0x10ba2a&&_0x10ba2a['type']){switch(_0x10ba2a[_0x44cb('0x1d')]){case _0x44cb('0x1e'):var _0x40c686=require(_0x44cb('0x1e'));if(_0x10ba2a[_0x44cb('0x1f')]&&_0x10ba2a[_0x44cb('0x20')]&&_0x10ba2a['phone']){var _0x124309=new _0x40c686(_0x10ba2a[_0x44cb('0x1f')],_0x10ba2a[_0x44cb('0x20')]);_0x124309['messages'][_0x44cb('0x21')]({'body':_0x2af95f[_0x44cb('0xe')],'to':'whatsapp:'+_0x2af95f[_0x44cb('0x22')],'from':'whatsapp:'+_0x10ba2a[_0x44cb('0x22')],'statusCallback':_0x10ba2a[_0x44cb('0x23')]+_0x44cb('0x24')+_0x2af95f['id']+'/status?token='+_0x10ba2a['token']})['then'](function(_0x1fe367){if(_0x1fe367['sid']){return _0x3c90a5['update']({'messageId':_0x1fe367[_0x44cb('0x25')]});}})[_0x44cb('0x26')](function(_0x32e9f9){logger[_0x44cb('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x44cb('0x1e'),util['inspect'](_0x32e9f9,{'showHidden':![],'depth':null}));});}else{logger[_0x44cb('0x19')](_0x44cb('0x27'),_0x44cb('0x28'),_0x44cb('0x1e'),_0x44cb('0x29'));}break;case _0x44cb('0x2a'):var _0x395b25=_0x10ba2a[_0x44cb('0x1f')];var _0x311095=_0x10ba2a[_0x44cb('0x20')];var _0x11c506=_0x10ba2a['baseUrl']+'/whatsapp/v1/'+_0x395b25+_0x44cb('0x2b');var _0xbc9cb3={'to':[_0x2af95f[_0x44cb('0x22')]],'message':{'type':_0x44cb('0x2c'),'text':_0x2af95f[_0x44cb('0xe')]}};var _0x4c4878={'method':_0x44cb('0x2d'),'uri':_0x11c506,'headers':{'Authorization':_0x44cb('0x2e')+_0x311095,'Content-Type':'application/json'},'body':_0xbc9cb3,'json':!![]};rp(_0x4c4878)['then'](function(_0x90d812){if(_0x90d812[_0x44cb('0x2f')][0x0][_0x44cb('0x30')]){return _0x3c90a5[_0x44cb('0x18')]({'messageId':_0x90d812[_0x44cb('0x2f')][0x0]['message_id']});}})[_0x44cb('0x26')](function(_0x1ac33f){logger[_0x44cb('0x31')](_0x44cb('0x32'),_0x1ac33f);});break;}}})[_0x44cb('0x33')](function(){_0x6dcb31();});}else{_0x6dcb31();}}},'charset':'utf8mb4','collate':_0x44cb('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c6f346d..4304a87 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 _0x869d=['result','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','WhatsappMessage,\x20%s,\x20%s'];(function(_0x42b157,_0x3f1b39){var _0x247640=function(_0x497ada){while(--_0x497ada){_0x42b157['push'](_0x42b157['shift']());}};_0x247640(++_0x3f1b39);}(_0x869d,0xed));var _0xd869=function(_0x29bef7,_0x5127f0){_0x29bef7=_0x29bef7-0x0;var _0x1ba0c1=_0x869d[_0x29bef7];return _0x1ba0c1;};'use strict';var _=require(_0xd869('0x0'));var util=require(_0xd869('0x1'));var moment=require('moment');var BPromise=require(_0xd869('0x2'));var rs=require(_0xd869('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd869('0x4'))['db'];var utils=require(_0xd869('0x5'));var logger=require(_0xd869('0x6'))(_0xd869('0x7'));var config=require(_0xd869('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd869('0x9')][_0xd869('0xa')]({'port':0x232a});config[_0xd869('0xb')]=_[_0xd869('0xc')](config[_0xd869('0xb')],{'host':_0xd869('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd869('0xb')]));require(_0xd869('0xe'))[_0xd869('0xf')](socket);function respondWithRpcPromise(_0x490493,_0x58ec2b,_0x4779c4){return new BPromise(function(_0x1185ef,_0x340d91){return client[_0xd869('0x10')](_0x490493,_0x4779c4)[_0xd869('0x11')](function(_0x54b4e1){logger[_0xd869('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x58ec2b,_0xd869('0x13'));logger[_0xd869('0x14')](_0xd869('0x15'),_0x58ec2b,'request\x20sent',JSON[_0xd869('0x16')](_0x54b4e1));if(_0x54b4e1['error']){if(_0x54b4e1['error'][_0xd869('0x17')]===0x1f4){logger[_0xd869('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x58ec2b,_0x54b4e1[_0xd869('0x18')][_0xd869('0x19')]);return _0x340d91(_0x54b4e1[_0xd869('0x18')][_0xd869('0x19')]);}logger[_0xd869('0x18')](_0xd869('0x1a'),_0x58ec2b,_0x54b4e1['error'][_0xd869('0x19')]);return _0x1185ef(_0x54b4e1[_0xd869('0x18')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x58ec2b,_0xd869('0x13'));_0x1185ef(_0x54b4e1[_0xd869('0x1b')][_0xd869('0x19')]);}})['catch'](function(_0x144196){logger[_0xd869('0x18')](_0xd869('0x1a'),_0x58ec2b,_0x144196);_0x340d91(_0x144196);});});}exports[_0xd869('0x1c')]=function(_0x36972b){var _0xd7408e=this;return new Promise(function(_0x11d47b,_0x16b983){return db[_0xd869('0x1d')]['create'](_0x36972b[_0xd869('0x1e')],{'raw':_0x36972b[_0xd869('0x1f')]?_0x36972b[_0xd869('0x1f')][_0xd869('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x22dc53){logger[_0xd869('0x12')]('CreateWhatsappMessage',_0x36972b);logger['debug'](_0xd869('0x1c'),_0x36972b,JSON['stringify'](_0x22dc53));_0x11d47b(_0x22dc53);})['catch'](function(_0x55e786){logger[_0xd869('0x18')](_0xd869('0x1c'),_0x55e786[_0xd869('0x19')],_0x36972b);_0x16b983(_0xd7408e[_0xd869('0x18')](0x1f4,_0x55e786[_0xd869('0x19')]));});});}; \ No newline at end of file +var _0x29d7=['socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x21379b,_0x592b48){var _0x223a93=function(_0x402097){while(--_0x402097){_0x21379b['push'](_0x21379b['shift']());}};_0x223a93(++_0x592b48);}(_0x29d7,0x186));var _0x729d=function(_0x586eee,_0xcc477e){_0x586eee=_0x586eee-0x0;var _0xe88f21=_0x29d7[_0x586eee];return _0xe88f21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x729d('0x0'));var BPromise=require(_0x729d('0x1'));var rs=require(_0x729d('0x2'));var fs=require('fs');var Redis=require(_0x729d('0x3'));var db=require(_0x729d('0x4'))['db'];var utils=require(_0x729d('0x5'));var logger=require(_0x729d('0x6'))('rpc');var config=require(_0x729d('0x7'));var jayson=require(_0x729d('0x8'));var client=jayson['client'][_0x729d('0x9')]({'port':0x232a});config[_0x729d('0xa')]=_[_0x729d('0xb')](config['redis'],{'host':_0x729d('0xc'),'port':0x18eb});var socket=require(_0x729d('0xd'))(new Redis(config[_0x729d('0xa')]));require(_0x729d('0xe'))['register'](socket);function respondWithRpcPromise(_0x2481c1,_0x570dd5,_0x60f56d){return new BPromise(function(_0x1353a8,_0x5442f4){return client[_0x729d('0xf')](_0x2481c1,_0x60f56d)[_0x729d('0x10')](function(_0x3d02ae){logger[_0x729d('0x11')](_0x729d('0x12'),_0x570dd5,_0x729d('0x13'));logger[_0x729d('0x14')](_0x729d('0x15'),_0x570dd5,'request\x20sent',JSON['stringify'](_0x3d02ae));if(_0x3d02ae['error']){if(_0x3d02ae[_0x729d('0x16')][_0x729d('0x17')]===0x1f4){logger[_0x729d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x570dd5,_0x3d02ae[_0x729d('0x16')][_0x729d('0x18')]);return _0x5442f4(_0x3d02ae[_0x729d('0x16')][_0x729d('0x18')]);}logger[_0x729d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x570dd5,_0x3d02ae[_0x729d('0x16')][_0x729d('0x18')]);return _0x1353a8(_0x3d02ae[_0x729d('0x16')][_0x729d('0x18')]);}else{logger['info'](_0x729d('0x12'),_0x570dd5,_0x729d('0x13'));_0x1353a8(_0x3d02ae[_0x729d('0x19')][_0x729d('0x18')]);}})[_0x729d('0x1a')](function(_0x572f63){logger['error'](_0x729d('0x12'),_0x570dd5,_0x572f63);_0x5442f4(_0x572f63);});});}exports[_0x729d('0x1b')]=function(_0x3a0df6){var _0x694f84=this;return new Promise(function(_0x5af25e,_0x3119d3){return db[_0x729d('0x1c')]['create'](_0x3a0df6['body'],{'raw':_0x3a0df6[_0x729d('0x1d')]?_0x3a0df6[_0x729d('0x1d')][_0x729d('0x1e')]===undefined?!![]:![]:!![]})[_0x729d('0x10')](function(_0x1a60a1){logger[_0x729d('0x11')](_0x729d('0x1b'),_0x3a0df6);logger[_0x729d('0x14')](_0x729d('0x1b'),_0x3a0df6,JSON['stringify'](_0x1a60a1));_0x5af25e(_0x1a60a1);})[_0x729d('0x1a')](function(_0x1c3848){logger[_0x729d('0x16')](_0x729d('0x1b'),_0x1c3848[_0x729d('0x18')],_0x3a0df6);_0x3119d3(_0x694f84[_0x729d('0x16')](0x1f4,_0x1c3848[_0x729d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cff26b4..0bfc21f 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 _0x2454=['register','length','save','remove','update','emit','removeListener'];(function(_0x21dc0c,_0x64bb32){var _0x57d588=function(_0x62a3f4){while(--_0x62a3f4){_0x21dc0c['push'](_0x21dc0c['shift']());}};_0x57d588(++_0x64bb32);}(_0x2454,0x1d0));var _0x4245=function(_0x224fbf,_0x11bfca){_0x224fbf=_0x224fbf-0x0;var _0x5905c2=_0x2454[_0x224fbf];return _0x5905c2;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4245('0x0'),_0x4245('0x1'),_0x4245('0x2')];function createListener(_0x1fbfee,_0x47841b){return function(_0xddb56c){_0x47841b[_0x4245('0x3')](_0x1fbfee,_0xddb56c);};}function removeListener(_0x12ad31,_0x4eeda2){return function(){WhatsappMessageEvents[_0x4245('0x4')](_0x12ad31,_0x4eeda2);};}exports[_0x4245('0x5')]=function(_0xb72a5a){for(var _0x26a9e3=0x0,_0x4c90e2=events[_0x4245('0x6')];_0x26a9e3<_0x4c90e2;_0x26a9e3++){var _0xc5ea23=events[_0x26a9e3];var _0x95007e=createListener('whatsappMessage:'+_0xc5ea23,_0xb72a5a);WhatsappMessageEvents['on'](_0xc5ea23,_0x95007e);}}; \ No newline at end of file +var _0x4ae4=['update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae4,0x1a5));var _0x44ae=function(_0x2c55d1,_0x558f3d){_0x2c55d1=_0x2c55d1-0x0;var _0x5de2dd=_0x4ae4[_0x2c55d1];return _0x5de2dd;};'use strict';var WhatsappMessageEvents=require(_0x44ae('0x0'));var events=[_0x44ae('0x1'),_0x44ae('0x2'),_0x44ae('0x3')];function createListener(_0xd8eef,_0x21032c){return function(_0x1e5800){_0x21032c[_0x44ae('0x4')](_0xd8eef,_0x1e5800);};}function removeListener(_0x53da6c,_0x211755){return function(){WhatsappMessageEvents[_0x44ae('0x5')](_0x53da6c,_0x211755);};}exports[_0x44ae('0x6')]=function(_0x152868){for(var _0x46a5f1=0x0,_0x2a62b4=events['length'];_0x46a5f1<_0x2a62b4;_0x46a5f1++){var _0x4943c6=events[_0x46a5f1];var _0x337b04=createListener(_0x44ae('0x7')+_0x4943c6,_0x152868);WhatsappMessageEvents['on'](_0x4943c6,_0x337b04);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 87ad12a..8a9578f 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 _0x234b=['isAuthenticated','/:id','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','get'];(function(_0x1830a9,_0x1583bd){var _0x2b6166=function(_0x4cf0e6){while(--_0x4cf0e6){_0x1830a9['push'](_0x1830a9['shift']());}};_0x2b6166(++_0x1583bd);}(_0x234b,0xc6));var _0xb234=function(_0x2d52ad,_0x11d311){_0x2d52ad=_0x2d52ad-0x0;var _0x4f7ce1=_0x234b[_0x2d52ad];return _0x4f7ce1;};'use strict';var multer=require('multer');var util=require(_0xb234('0x0'));var path=require(_0xb234('0x1'));var timeout=require(_0xb234('0x2'));var express=require(_0xb234('0x3'));var router=express[_0xb234('0x4')]();var fs_extra=require(_0xb234('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb234('0x6'));var config=require('../../config/environment');var controller=require(_0xb234('0x7'));router[_0xb234('0x8')]('/',auth[_0xb234('0x9')](),controller['index']);router[_0xb234('0x8')]('/describe',auth[_0xb234('0x9')](),controller['describe']);router[_0xb234('0x8')](_0xb234('0xa'),auth[_0xb234('0x9')](),controller['show']);router[_0xb234('0x8')]('/:id/members',auth[_0xb234('0x9')](),controller[_0xb234('0xb')]);router[_0xb234('0x8')](_0xb234('0xc'),auth['isAuthenticated'](),controller[_0xb234('0xd')]);router[_0xb234('0x8')]('/:id/users',auth[_0xb234('0x9')](),controller['getAgents']);router[_0xb234('0xe')]('/',auth[_0xb234('0x9')](),controller['create']);router[_0xb234('0xe')](_0xb234('0xc'),auth[_0xb234('0x9')](),controller[_0xb234('0xf')]);router['post'](_0xb234('0x10'),auth[_0xb234('0x9')](),controller['addAgents']);router[_0xb234('0x11')](_0xb234('0xa'),auth[_0xb234('0x9')](),controller[_0xb234('0x12')]);router[_0xb234('0x13')](_0xb234('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xb234('0x13')](_0xb234('0xc'),auth[_0xb234('0x9')](),controller[_0xb234('0x14')]);router[_0xb234('0x13')](_0xb234('0x10'),auth[_0xb234('0x9')](),controller[_0xb234('0x15')]);module[_0xb234('0x16')]=router; \ No newline at end of file +var _0x3573=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer'];(function(_0x311f53,_0x4baa5d){var _0x266a80=function(_0x158a1a){while(--_0x158a1a){_0x311f53['push'](_0x311f53['shift']());}};_0x266a80(++_0x4baa5d);}(_0x3573,0x15e));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3357('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3357('0x1'));var express=require(_0x3357('0x2'));var router=express[_0x3357('0x3')]();var fs_extra=require(_0x3357('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3357('0x5'));var config=require(_0x3357('0x6'));var controller=require('./whatsappQueue.controller');router[_0x3357('0x7')]('/',auth[_0x3357('0x8')](),controller[_0x3357('0x9')]);router['get'](_0x3357('0xa'),auth['isAuthenticated'](),controller[_0x3357('0xb')]);router[_0x3357('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3357('0xc')]);router[_0x3357('0x7')](_0x3357('0xd'),auth[_0x3357('0x8')](),controller['getMembers']);router['get'](_0x3357('0xe'),auth[_0x3357('0x8')](),controller['getTeams']);router[_0x3357('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x3357('0xf')]);router[_0x3357('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0x3357('0x8')](),controller[_0x3357('0x11')]);router['post'](_0x3357('0x12'),auth[_0x3357('0x8')](),controller[_0x3357('0x13')]);router[_0x3357('0x14')](_0x3357('0x15'),auth[_0x3357('0x8')](),controller[_0x3357('0x16')]);router[_0x3357('0x17')]('/:id',auth[_0x3357('0x8')](),controller[_0x3357('0x18')]);router['delete'](_0x3357('0xe'),auth[_0x3357('0x8')](),controller['removeTeams']);router['delete'](_0x3357('0x12'),auth[_0x3357('0x8')](),controller[_0x3357('0x19')]);module[_0x3357('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d003b7c..56c32db 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 _0xf72b=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xf72b,0x1d9));var _0xbf72=function(_0x538977,_0x4c0389){_0x538977=_0x538977-0x0;var _0xa57c98=_0xf72b[_0x538977];return _0xa57c98;};'use strict';var Sequelize=require(_0xbf72('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf72('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbf72('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbf72('0x3')]('rrmemory',_0xbf72('0x4'),_0xbf72('0x5'))},'description':{'type':Sequelize[_0xbf72('0x1')]}}; \ No newline at end of file +var _0x7a2c=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x26931e,_0x16f950){var _0x36bb27=function(_0x1bbcef){while(--_0x1bbcef){_0x26931e['push'](_0x26931e['shift']());}};_0x36bb27(++_0x16f950);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x3c345a,_0x214d8d){_0x3c345a=_0x3c345a-0x0;var _0x70de58=_0x7a2c[_0x3c345a];return _0x70de58;};'use strict';var Sequelize=require(_0xc7a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7a2('0x1')],'unique':_0xc7a2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc7a2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc7a2('0x4')](_0xc7a2('0x5'),_0xc7a2('0x6'),_0xc7a2('0x7'))},'description':{'type':Sequelize[_0xc7a2('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 03b5a4f..b5ed1aa 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 _0x2890=['UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','findAll','Agents','online','interface','sequelize','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','User','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','get','UserProfileResource','error','stack','name','index','WhatsappQueue','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','body','role','user','WhatsappQueues','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x2890,0x1d6));var _0x0289=function(_0x48a984,_0x28e335){_0x48a984=_0x48a984-0x0;var _0x2e5583=_0x2890[_0x48a984];return _0x2e5583;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0289('0x0'));var zipdir=require(_0x0289('0x1'));var jsonpatch=require(_0x0289('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0289('0x3'));var Mustache=require(_0x0289('0x4'));var util=require(_0x0289('0x5'));var path=require(_0x0289('0x6'));var sox=require('sox');var csv=require(_0x0289('0x7'));var ejs=require(_0x0289('0x8'));var fs=require('fs');var fs_extra=require(_0x0289('0x9'));var _=require(_0x0289('0xa'));var squel=require('squel');var crypto=require(_0x0289('0xb'));var jsforce=require(_0x0289('0xc'));var deskjs=require(_0x0289('0xd'));var toCsv=require(_0x0289('0x7'));var querystring=require(_0x0289('0xe'));var Papa=require(_0x0289('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0289('0x10'));var hardwareService=require(_0x0289('0x11'));var logger=require('../../config/logger')(_0x0289('0x12'));var utils=require(_0x0289('0x13'));var config=require(_0x0289('0x14'));var licenseUtil=require(_0x0289('0x15'));var db=require('../../mysqldb')['db'];config[_0x0289('0x16')]=_[_0x0289('0x17')](config[_0x0289('0x16')],{'host':_0x0289('0x18'),'port':0x18eb});var socket=require(_0x0289('0x19'))(new Redis(config['redis']));require(_0x0289('0x1a'))[_0x0289('0x1b')](socket);function respondWithStatusCode(_0x40fe0a,_0x205473){_0x205473=_0x205473||0xcc;return function(_0x6a1443){if(_0x6a1443){return _0x40fe0a[_0x0289('0x1c')](_0x205473);}return _0x40fe0a[_0x0289('0x1d')](_0x205473)['end']();};}function respondWithResult(_0xe3f395,_0x41eb53){_0x41eb53=_0x41eb53||0xc8;return function(_0x1db89d){if(_0x1db89d){return _0xe3f395[_0x0289('0x1d')](_0x41eb53)[_0x0289('0x1e')](_0x1db89d);}};}function respondWithFilteredResult(_0x150cb3,_0x5c9030){return function(_0x27ca95){if(_0x27ca95){var _0x1e19f9=typeof _0x5c9030['offset']===_0x0289('0x1f')&&typeof _0x5c9030[_0x0289('0x20')]===_0x0289('0x1f');var _0x50054a=_0x27ca95[_0x0289('0x21')];var _0x4bfac4=_0x1e19f9?0x0:_0x5c9030[_0x0289('0x22')];var _0x3419c2=_0x1e19f9?_0x27ca95[_0x0289('0x21')]:_0x5c9030[_0x0289('0x22')]+_0x5c9030[_0x0289('0x20')];var _0x2da0e;if(_0x3419c2>=_0x50054a){_0x3419c2=_0x50054a;_0x2da0e=0xc8;}else{_0x2da0e=0xce;}_0x150cb3[_0x0289('0x1d')](_0x2da0e);return _0x150cb3[_0x0289('0x23')]('Content-Range',_0x4bfac4+'-'+_0x3419c2+'/'+_0x50054a)['json'](_0x27ca95);}return null;};}function patchUpdates(_0x2dcb22){return function(_0x296d26){try{jsonpatch[_0x0289('0x24')](_0x296d26,_0x2dcb22,!![]);}catch(_0x5e3aac){return BPromise['reject'](_0x5e3aac);}return _0x296d26['save']();};}function saveUpdates(_0x1eb04d,_0x50c4a4){return function(_0x5d06f3){if(_0x5d06f3){return _0x5d06f3[_0x0289('0x25')](_0x1eb04d)[_0x0289('0x26')](function(_0x4c81d9){return _0x4c81d9;});}return null;};}function removeEntity(_0x1015e4,_0x54dd68){return function(_0x57dd64){if(_0x57dd64){return _0x57dd64[_0x0289('0x27')]()[_0x0289('0x26')](function(){var _0x48e2d3=_0x57dd64[_0x0289('0x28')]({'plain':!![]});var _0x2ff848='WhatsappQueues';return db[_0x0289('0x29')]['destroy']({'where':{'type':_0x2ff848,'resourceId':_0x48e2d3['id']}})[_0x0289('0x26')](function(){return _0x57dd64;});})[_0x0289('0x26')](function(){_0x1015e4[_0x0289('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b11fa,_0xf8edd3){return function(_0x6ded2d){if(!_0x6ded2d){_0x1b11fa[_0x0289('0x1c')](0x194);}return _0x6ded2d;};}function handleError(_0x587092,_0x12849f){_0x12849f=_0x12849f||0x1f4;return function(_0x418933){logger[_0x0289('0x2a')](_0x418933[_0x0289('0x2b')]);if(_0x418933[_0x0289('0x2c')]){delete _0x418933['name'];}_0x587092[_0x0289('0x1d')](_0x12849f)['send'](_0x418933);};}exports[_0x0289('0x2d')]=function(_0x24e720,_0x253b44){var _0x21e79d={},_0x25b411={},_0x126757={'count':0x0,'rows':[]};var _0x2550c0=_['map'](db[_0x0289('0x2e')]['rawAttributes'],function(_0x27bf17){return{'name':_0x27bf17[_0x0289('0x2f')],'type':_0x27bf17[_0x0289('0x30')][_0x0289('0x31')]};});_0x25b411[_0x0289('0x32')]=_[_0x0289('0x33')](_0x2550c0,_0x0289('0x2c'));_0x25b411[_0x0289('0x34')]=_[_0x0289('0x35')](_0x24e720[_0x0289('0x34')]);_0x25b411[_0x0289('0x36')]=_[_0x0289('0x37')](_0x25b411['model'],_0x25b411['query']);_0x21e79d[_0x0289('0x38')]=_['intersection'](_0x25b411['model'],qs['fields'](_0x24e720['query'][_0x0289('0x39')]));_0x21e79d[_0x0289('0x38')]=_0x21e79d[_0x0289('0x38')][_0x0289('0x3a')]?_0x21e79d[_0x0289('0x38')]:_0x25b411[_0x0289('0x32')];if(!_0x24e720[_0x0289('0x34')][_0x0289('0x3b')](_0x0289('0x3c'))){_0x21e79d[_0x0289('0x20')]=qs['limit'](_0x24e720[_0x0289('0x34')][_0x0289('0x20')]);_0x21e79d[_0x0289('0x22')]=qs[_0x0289('0x22')](_0x24e720[_0x0289('0x34')][_0x0289('0x22')]);}_0x21e79d[_0x0289('0x3d')]=qs[_0x0289('0x3e')](_0x24e720['query'][_0x0289('0x3e')]);_0x21e79d['where']=qs['filters'](_[_0x0289('0x3f')](_0x24e720['query'],_0x25b411[_0x0289('0x36')]),_0x2550c0);if(_0x24e720[_0x0289('0x34')][_0x0289('0x40')]){_0x21e79d[_0x0289('0x41')]=_[_0x0289('0x42')](_0x21e79d[_0x0289('0x41')],{'$or':_['map'](_0x2550c0,function(_0x5bb540){if(_0x5bb540['type']!==_0x0289('0x43')){var _0x3efefa={};_0x3efefa[_0x5bb540['name']]={'$like':'%'+_0x24e720['query'][_0x0289('0x40')]+'%'};return _0x3efefa;}})});}_0x21e79d=_[_0x0289('0x42')]({},_0x21e79d,_0x24e720[_0x0289('0x44')]);var _0x3566fa={'where':_0x21e79d[_0x0289('0x41')]};return db[_0x0289('0x2e')][_0x0289('0x21')](_0x3566fa)[_0x0289('0x26')](function(_0x1edb3c){_0x126757['count']=_0x1edb3c;if(_0x24e720[_0x0289('0x34')][_0x0289('0x45')]){_0x21e79d['include']=[{'all':!![]}];}return db[_0x0289('0x2e')]['findAll'](_0x21e79d);})[_0x0289('0x26')](function(_0x193495){_0x126757[_0x0289('0x46')]=_0x193495;return _0x126757;})[_0x0289('0x26')](respondWithFilteredResult(_0x253b44,_0x21e79d))[_0x0289('0x47')](handleError(_0x253b44,null));};exports[_0x0289('0x48')]=function(_0x53d686,_0x47a54c){var _0x4ecf59={'raw':!![],'where':{'id':_0x53d686['params']['id']}},_0x2f9ef3={};_0x2f9ef3[_0x0289('0x32')]=_[_0x0289('0x35')](db[_0x0289('0x2e')][_0x0289('0x49')]);_0x2f9ef3[_0x0289('0x34')]=_[_0x0289('0x35')](_0x53d686[_0x0289('0x34')]);_0x2f9ef3[_0x0289('0x36')]=_[_0x0289('0x37')](_0x2f9ef3['model'],_0x2f9ef3[_0x0289('0x34')]);_0x4ecf59[_0x0289('0x38')]=_[_0x0289('0x37')](_0x2f9ef3[_0x0289('0x32')],qs[_0x0289('0x39')](_0x53d686[_0x0289('0x34')][_0x0289('0x39')]));_0x4ecf59[_0x0289('0x38')]=_0x4ecf59[_0x0289('0x38')][_0x0289('0x3a')]?_0x4ecf59[_0x0289('0x38')]:_0x2f9ef3['model'];if(_0x53d686[_0x0289('0x34')][_0x0289('0x45')]){_0x4ecf59['include']=[{'all':!![]}];}_0x4ecf59=_[_0x0289('0x42')]({},_0x4ecf59,_0x53d686[_0x0289('0x44')]);return db['WhatsappQueue']['find'](_0x4ecf59)[_0x0289('0x26')](handleEntityNotFound(_0x47a54c,null))[_0x0289('0x26')](respondWithResult(_0x47a54c,null))[_0x0289('0x47')](handleError(_0x47a54c,null));};exports['create']=function(_0x2c27b3,_0x5b2875){return db['WhatsappQueue']['create'](_0x2c27b3[_0x0289('0x4a')],{})[_0x0289('0x26')](function(_0xcba3e6){var _0x4884d8=_0x2c27b3['user'][_0x0289('0x28')]({'plain':!![]});if(!_0x4884d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4884d8[_0x0289('0x4b')]===_0x0289('0x4c')){var _0x7fb4e6=_0xcba3e6[_0x0289('0x28')]({'plain':!![]});var _0x3ba243=_0x0289('0x4d');return db[_0x0289('0x4e')][_0x0289('0x4f')]({'where':{'name':_0x3ba243,'userProfileId':_0x4884d8['userProfileId']},'raw':!![]})['then'](function(_0x57b418){if(_0x57b418&&_0x57b418[_0x0289('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x7fb4e6[_0x0289('0x2c')],'resourceId':_0x7fb4e6['id'],'type':_0x57b418['name'],'sectionId':_0x57b418['id']},{})[_0x0289('0x26')](function(){return _0xcba3e6;});}else{return _0xcba3e6;}})[_0x0289('0x47')](function(_0x3f164e){logger[_0x0289('0x2a')](_0x0289('0x51'),_0x3f164e);throw _0x3f164e;});}return _0xcba3e6;})[_0x0289('0x26')](respondWithResult(_0x5b2875,0xc9))[_0x0289('0x47')](handleError(_0x5b2875,null));};exports[_0x0289('0x25')]=function(_0x5ddf25,_0x29c0f5){if(_0x5ddf25[_0x0289('0x4a')]['id']){delete _0x5ddf25[_0x0289('0x4a')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x5ddf25[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0x29c0f5,null))['then'](saveUpdates(_0x5ddf25[_0x0289('0x4a')],null))['then'](respondWithResult(_0x29c0f5,null))[_0x0289('0x47')](handleError(_0x29c0f5,null));};exports[_0x0289('0x27')]=function(_0x580dc2,_0x158e82){return db['WhatsappQueue'][_0x0289('0x4f')]({'where':{'id':_0x580dc2[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0x158e82,null))[_0x0289('0x26')](removeEntity(_0x158e82,null))[_0x0289('0x47')](handleError(_0x158e82,null));};exports['describe']=function(_0x15e328,_0x16e289){return db[_0x0289('0x2e')][_0x0289('0x53')]()[_0x0289('0x26')](respondWithResult(_0x16e289,null))[_0x0289('0x47')](handleError(_0x16e289,null));};exports[_0x0289('0x54')]=function(_0x4968e8,_0x4e27aa,_0x29a0cc){var _0x5c66f3={'raw':!![],'where':{}},_0x1d892f={},_0x4dc4db;return db[_0x0289('0x2e')][_0x0289('0x55')]({'where':{'id':_0x4968e8[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0x4e27aa,null))[_0x0289('0x26')](function(_0x3ef94e){if(_0x3ef94e){_0x4dc4db=_0x3ef94e[_0x0289('0x28')]({'plain':!![]});_0x1d892f[_0x0289('0x32')]=_[_0x0289('0x35')](db[_0x0289('0x56')][_0x0289('0x49')]);_0x1d892f['query']=_[_0x0289('0x35')](_0x4968e8[_0x0289('0x34')]);_0x1d892f[_0x0289('0x36')]=_[_0x0289('0x37')](_0x1d892f[_0x0289('0x32')],_0x1d892f['query']);_0x5c66f3[_0x0289('0x38')]=_[_0x0289('0x37')](_0x1d892f[_0x0289('0x32')],qs[_0x0289('0x39')](_0x4968e8['query'][_0x0289('0x39')]));_0x5c66f3['attributes']=_0x5c66f3[_0x0289('0x38')][_0x0289('0x3a')]?_0x5c66f3['attributes']:_0x1d892f['model'];if(!_0x4968e8[_0x0289('0x34')]['hasOwnProperty'](_0x0289('0x3c'))){_0x5c66f3['limit']=qs[_0x0289('0x20')](_0x4968e8[_0x0289('0x34')][_0x0289('0x20')]);_0x5c66f3[_0x0289('0x22')]=qs['offset'](_0x4968e8[_0x0289('0x34')][_0x0289('0x22')]);}_0x5c66f3[_0x0289('0x3d')]=qs[_0x0289('0x3e')](_0x4968e8['query'][_0x0289('0x3e')]);_0x5c66f3['where']=qs[_0x0289('0x36')](_[_0x0289('0x3f')](_0x4968e8[_0x0289('0x34')],_0x1d892f[_0x0289('0x36')]));_0x5c66f3[_0x0289('0x41')][_0x0289('0x57')]=_0x3ef94e['id'];if(_0x4968e8['query'][_0x0289('0x40')]){_0x5c66f3[_0x0289('0x41')]=_[_0x0289('0x42')](_0x5c66f3[_0x0289('0x41')],{'$or':_[_0x0289('0x33')](_0x5c66f3[_0x0289('0x38')],function(_0x37cb14){var _0xcbf336={};_0xcbf336[_0x37cb14]={'$like':'%'+_0x4968e8[_0x0289('0x34')][_0x0289('0x40')]+'%'};return _0xcbf336;})});}_0x5c66f3=_[_0x0289('0x42')]({},_0x5c66f3,_0x4968e8[_0x0289('0x44')]);return db['UserWhatsappQueue']['findAll'](_0x5c66f3);}})[_0x0289('0x26')](function(_0x18905c){if(_0x18905c){return db['User'][_0x0289('0x58')]({'where':{'id':_[_0x0289('0x33')](_0x18905c,_0x0289('0x59')),'role':_0x0289('0x5a')},'attributes':['id',_0x0289('0x2c'),_0x0289('0x5b'),_0x0289('0x5c'),'createdAt']});}})[_0x0289('0x26')](function(_0x55070f){if(_0x55070f){return{'count':_0x55070f[_0x0289('0x21')],'rows':_[_0x0289('0x33')](_0x55070f[_0x0289('0x46')],function(_0x3e47ce){return{'membername':_0x3e47ce[_0x0289('0x2c')],'UserId':_0x3e47ce['id'],'queue_name':_0x4dc4db['name'],'WhatsappQueueId':_0x4dc4db['id'],'interface':util[_0x0289('0x5d')](_0x0289('0x5e'),_0x0289('0x5f'),_0x3e47ce[_0x0289('0x2c')]),'penalty':0x0,'paused':_0x3e47ce[_0x0289('0x5b')],'createdAt':_0x3e47ce[_0x0289('0x60')],'updatedAt':_0x3e47ce[_0x0289('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e27aa,_0x5c66f3))['catch'](handleError(_0x4e27aa,null));};exports[_0x0289('0x61')]=function(_0x58257e,_0x162c62,_0x3ce18c){var _0x38f036={};var _0xfef75d={};var _0x3df493;var _0x508452;return db['WhatsappQueue'][_0x0289('0x55')]({'where':{'id':_0x58257e[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0x162c62,null))[_0x0289('0x26')](function(_0x379317){if(_0x379317){_0x3df493=_0x379317;_0xfef75d['model']=_[_0x0289('0x35')](db[_0x0289('0x62')][_0x0289('0x49')]);_0xfef75d[_0x0289('0x34')]=_[_0x0289('0x35')](_0x58257e['query']);_0xfef75d[_0x0289('0x36')]=_[_0x0289('0x37')](_0xfef75d[_0x0289('0x32')],_0xfef75d[_0x0289('0x34')]);_0x38f036[_0x0289('0x38')]=_[_0x0289('0x37')](_0xfef75d[_0x0289('0x32')],qs['fields'](_0x58257e['query'][_0x0289('0x39')]));_0x38f036['attributes']=_0x38f036['attributes'][_0x0289('0x3a')]?_0x38f036['attributes']:_0xfef75d[_0x0289('0x32')];_0x38f036[_0x0289('0x3d')]=qs[_0x0289('0x3e')](_0x58257e['query']['sort']);_0x38f036[_0x0289('0x41')]=qs[_0x0289('0x36')](_[_0x0289('0x3f')](_0x58257e[_0x0289('0x34')],_0xfef75d[_0x0289('0x36')]));if(_0x58257e[_0x0289('0x34')][_0x0289('0x40')]){_0x38f036[_0x0289('0x41')]=_[_0x0289('0x42')](_0x38f036[_0x0289('0x41')],{'$or':_[_0x0289('0x33')](_0x38f036[_0x0289('0x38')],function(_0x3e7073){var _0x40e29a={};_0x40e29a[_0x3e7073]={'$like':'%'+_0x58257e[_0x0289('0x34')][_0x0289('0x40')]+'%'};return _0x40e29a;})});}_0x38f036=_[_0x0289('0x42')]({},_0x38f036,_0x58257e[_0x0289('0x44')]);return _0x3df493[_0x0289('0x61')](_0x38f036);}})['then'](function(_0x3e61e5){if(_0x3e61e5){_0x508452=_0x3e61e5[_0x0289('0x3a')];if(!_0x58257e['query'][_0x0289('0x3b')](_0x0289('0x3c'))){_0x38f036[_0x0289('0x20')]=qs['limit'](_0x58257e['query'][_0x0289('0x20')]);_0x38f036[_0x0289('0x22')]=qs['offset'](_0x58257e[_0x0289('0x34')]['offset']);}return _0x3df493[_0x0289('0x61')](_0x38f036);}})['then'](function(_0x17c7b6){if(_0x17c7b6){return _0x17c7b6?{'count':_0x508452,'rows':_0x17c7b6}:null;}})['then'](respondWithResult(_0x162c62,null))[_0x0289('0x47')](handleError(_0x162c62,null));};exports[_0x0289('0x63')]=function(_0x1c86c9,_0x3a12c2,_0x3401a9){var _0x5c1457=_0x1c86c9[_0x0289('0x4a')][_0x0289('0x64')];return db[_0x0289('0x62')][_0x0289('0x65')]({'where':{'id':_0x5c1457},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0289('0x66'),'attributes':['id',_0x0289('0x2c'),_0x0289('0x67'),'voicePause',_0x0289('0x68')],'raw':!![]}]})['then'](function(_0x9d2d66){if(_0x9d2d66){var _0x4bae66=_['flatMap'](_0x9d2d66,function(_0x584192){var _0xc4b954=_0x584192[_0x0289('0x28')]({'plain':!![]});return _0xc4b954[_0x0289('0x66')];});return db[_0x0289('0x2e')]['find']({'where':{'id':_0x1c86c9[_0x0289('0x52')]['id']}})[_0x0289('0x26')](function(_0x20149e){return db[_0x0289('0x69')]['transaction'](function(_0x228752){return _0x20149e[_0x0289('0x63')](_0x5c1457,{'transaction':_0x228752})[_0x0289('0x26')](function(){return BPromise[_0x0289('0x6a')](_0x4bae66,function(_0x54dd3d){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x54dd3d['id'],'WhatsappQueueId':_0x1c86c9['params']['id']},'transaction':_0x228752});});})[_0x0289('0x26')](function(){_0x4bae66['forEach'](function(_0x44d402){socket[_0x0289('0x6b')](_0x0289('0x6c'),{'UserId':_0x44d402['id'],'WhatsappQueueId':_0x20149e['id']});});});});});}})[_0x0289('0x26')](respondWithStatusCode(_0x3a12c2,null))[_0x0289('0x47')](handleError(_0x3a12c2,null));};exports[_0x0289('0x6d')]=function(_0x11d8c9,_0x155420,_0x2bd938){return db['Team']['findAll']({'where':{'id':_0x11d8c9[_0x0289('0x34')][_0x0289('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0289('0x26')](handleEntityNotFound(_0x155420,null))['then'](function(_0x517d09){var _0x1aa91e=_['map'](_0x517d09,'id');var _0x33b50d=[];var _0x2bed47=[];var _0x54b18c=squel[_0x0289('0x6e')]();_0x54b18c[_0x0289('0x6f')](_0x0289('0x70'))[_0x0289('0x71')](_0x0289('0x72'),'tq')[_0x0289('0x73')](_0x0289('0x74'),'ut',_0x0289('0x75'))[_0x0289('0x41')](_0x0289('0x76'),_0x11d8c9['params']['id']);for(var _0x33e3aa=0x0;_0x33e3aa<_0x517d09[_0x0289('0x3a')];_0x33e3aa+=0x1){let _0x19b5d7=_0x517d09[_0x33e3aa];for(var _0x423b58=0x0;_0x423b58<_0x19b5d7[_0x0289('0x66')][_0x0289('0x3a')];_0x423b58+=0x1){let _0x25eb97=_0x19b5d7[_0x0289('0x66')][_0x423b58];var _0x2d5595=_0x54b18c[_0x0289('0x77')]();_0x2d5595[_0x0289('0x41')](_0x0289('0x78'),_0x25eb97['id']);_0x2bed47[_0x0289('0x79')](db[_0x0289('0x69')]['query'](_0x2d5595[_0x0289('0x7a')](),{'type':db[_0x0289('0x69')][_0x0289('0x7b')][_0x0289('0x7c')]})[_0x0289('0x26')](function(_0x4ffb2f){if(_0x4ffb2f['length']===0x1){return _0x25eb97['id'];}else{var _0x59461b=_[_0x0289('0x7d')](_[_0x0289('0x33')](_0x4ffb2f,_0x0289('0x7e')),function(_0x4dd958){return _['includes'](_0x1aa91e,_0x4dd958);});if(_0x59461b){return _0x25eb97['id'];}}}));}}return BPromise['all'](_0x2bed47)[_0x0289('0x26')](function(_0xaad2c){_0x33b50d=_(_0x33b50d)[_0x0289('0x7f')](_0xaad2c)[_0x0289('0x80')]()['value']();return db[_0x0289('0x2e')]['find']({'where':{'id':_0x11d8c9[_0x0289('0x52')]['id']}})[_0x0289('0x26')](function(_0x587c96){return db[_0x0289('0x69')][_0x0289('0x81')](function(_0x5ff15c){return _0x587c96[_0x0289('0x6d')](_0x11d8c9[_0x0289('0x34')][_0x0289('0x64')],{'transaction':_0x5ff15c})['then'](function(){if(!_[_0x0289('0x82')](_0x33b50d)){return _0x587c96['removeAgents'](_0x33b50d,{'transaction':_0x5ff15c});}})[_0x0289('0x26')](function(){_0x33b50d[_0x0289('0x83')](function(_0x5ba253){socket['emit'](_0x0289('0x84'),{'UserId':_0x5ba253,'WhatsappQueueId':_0x587c96['id']});});});});});});})[_0x0289('0x26')](respondWithStatusCode(_0x155420,null))[_0x0289('0x47')](handleError(_0x155420,null));};exports[_0x0289('0x85')]=function(_0x34348e,_0x2bdfdb,_0x5bc0fc){return db['WhatsappQueue']['find']({'where':{'id':_0x34348e['params']['id']}})['then'](handleEntityNotFound(_0x2bdfdb,null))[_0x0289('0x26')](function(_0x143f3c){if(_0x143f3c){return _0x143f3c[_0x0289('0x85')](_0x34348e['body'][_0x0289('0x64')],_[_0x0289('0x86')](_0x34348e[_0x0289('0x4a')],[_0x0289('0x64'),'id'])||{})[_0x0289('0x87')](function(_0x52d525){for(var _0x1c4441=0x0;_0x1c4441<_0x34348e[_0x0289('0x4a')]['ids'][_0x0289('0x3a')];_0x1c4441+=0x1){socket[_0x0289('0x6b')]('userWhatsappQueue:save',{'UserId':Number(_0x34348e[_0x0289('0x4a')][_0x0289('0x64')][_0x1c4441]),'WhatsappQueueId':Number(_0x34348e['params']['id'])});}return _0x52d525;});}})[_0x0289('0x26')](respondWithResult(_0x2bdfdb,null))[_0x0289('0x47')](handleError(_0x2bdfdb,null));};exports[_0x0289('0x88')]=function(_0x194c7f,_0xff3f3c,_0xb05ac4){return db[_0x0289('0x2e')]['find']({'where':{'id':_0x194c7f[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0xff3f3c,null))[_0x0289('0x26')](function(_0x2f81ac){if(_0x2f81ac){return _0x2f81ac[_0x0289('0x88')](_0x194c7f[_0x0289('0x34')]['ids'])[_0x0289('0x26')](function(){if(_['isArray'](_0x194c7f['query'][_0x0289('0x64')])){for(var _0x493fa3=0x0;_0x493fa3<_0x194c7f[_0x0289('0x34')][_0x0289('0x64')][_0x0289('0x3a')];_0x493fa3+=0x1){socket[_0x0289('0x6b')]('userWhatsappQueue:remove',{'UserId':Number(_0x194c7f[_0x0289('0x34')][_0x0289('0x64')][_0x493fa3]),'WhatsappQueueId':Number(_0x194c7f[_0x0289('0x52')]['id'])});}}else{socket[_0x0289('0x6b')](_0x0289('0x84'),{'UserId':Number(_0x194c7f[_0x0289('0x34')][_0x0289('0x64')]),'WhatsappQueueId':Number(_0x194c7f[_0x0289('0x52')]['id'])});}});}})[_0x0289('0x26')](respondWithStatusCode(_0xff3f3c,null))[_0x0289('0x47')](handleError(_0xff3f3c,null));};exports[_0x0289('0x89')]=function(_0x47f963,_0x195124,_0x4db3ad){var _0x90b260={};var _0x3e38e2={};var _0x33a5e5;var _0x440a0c;return db[_0x0289('0x2e')][_0x0289('0x55')]({'where':{'id':_0x47f963[_0x0289('0x52')]['id']}})[_0x0289('0x26')](handleEntityNotFound(_0x195124,null))[_0x0289('0x26')](function(_0xa566b6){if(_0xa566b6){_0x33a5e5=_0xa566b6;_0x3e38e2[_0x0289('0x32')]=_[_0x0289('0x35')](db[_0x0289('0x8a')][_0x0289('0x49')]);_0x3e38e2['query']=_['keys'](_0x47f963['query']);_0x3e38e2[_0x0289('0x36')]=_[_0x0289('0x37')](_0x3e38e2['model'],_0x3e38e2[_0x0289('0x34')]);_0x90b260[_0x0289('0x38')]=_[_0x0289('0x37')](_0x3e38e2[_0x0289('0x32')],qs[_0x0289('0x39')](_0x47f963[_0x0289('0x34')][_0x0289('0x39')]));_0x90b260[_0x0289('0x38')]=_0x90b260[_0x0289('0x38')][_0x0289('0x3a')]?_0x90b260[_0x0289('0x38')]:_0x3e38e2[_0x0289('0x32')];_0x90b260[_0x0289('0x3d')]=qs[_0x0289('0x3e')](_0x47f963[_0x0289('0x34')][_0x0289('0x3e')]);_0x90b260[_0x0289('0x41')]=qs['filters'](_[_0x0289('0x3f')](_0x47f963['query'],_0x3e38e2[_0x0289('0x36')]));if(_0x47f963[_0x0289('0x34')][_0x0289('0x40')]){_0x90b260[_0x0289('0x41')]=_[_0x0289('0x42')](_0x90b260['where'],{'$or':_[_0x0289('0x33')](_0x90b260[_0x0289('0x38')],function(_0x198292){var _0x3dbbcf={};_0x3dbbcf[_0x198292]={'$like':'%'+_0x47f963[_0x0289('0x34')][_0x0289('0x40')]+'%'};return _0x3dbbcf;})});}_0x90b260=_[_0x0289('0x42')]({},_0x90b260,_0x47f963['options']);return _0x33a5e5['getAgents'](_0x90b260);}})[_0x0289('0x26')](function(_0x579127){if(_0x579127){_0x440a0c=_0x579127['length'];if(!_0x47f963[_0x0289('0x34')][_0x0289('0x3b')](_0x0289('0x3c'))){_0x90b260[_0x0289('0x20')]=qs[_0x0289('0x20')](_0x47f963[_0x0289('0x34')]['limit']);_0x90b260[_0x0289('0x22')]=qs['offset'](_0x47f963[_0x0289('0x34')][_0x0289('0x22')]);}return _0x33a5e5['getAgents'](_0x90b260);}})[_0x0289('0x26')](function(_0x34eef2){if(_0x34eef2){return _0x34eef2?{'count':_0x440a0c,'rows':_0x34eef2}:null;}})[_0x0289('0x26')](respondWithResult(_0x195124,null))['catch'](handleError(_0x195124,null));}; \ No newline at end of file +var _0x1037=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','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','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','order','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes'];(function(_0x491ec2,_0x540c00){var _0x1748db=function(_0x5a6258){while(--_0x5a6258){_0x491ec2['push'](_0x491ec2['shift']());}};_0x1748db(++_0x540c00);}(_0x1037,0xe2));var _0x7103=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x1037[_0x29632e];return _0x426e04;};'use strict';var emlformat=require(_0x7103('0x0'));var rimraf=require(_0x7103('0x1'));var zipdir=require(_0x7103('0x2'));var jsonpatch=require(_0x7103('0x3'));var rp=require(_0x7103('0x4'));var moment=require(_0x7103('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7103('0x6'));var util=require('util');var path=require(_0x7103('0x7'));var sox=require(_0x7103('0x8'));var csv=require('to-csv');var ejs=require(_0x7103('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7103('0xa'));var squel=require(_0x7103('0xb'));var crypto=require(_0x7103('0xc'));var jsforce=require(_0x7103('0xd'));var deskjs=require(_0x7103('0xe'));var toCsv=require(_0x7103('0xf'));var querystring=require(_0x7103('0x10'));var Papa=require(_0x7103('0x11'));var Redis=require('ioredis');var authService=require(_0x7103('0x12'));var qs=require(_0x7103('0x13'));var as=require(_0x7103('0x14'));var hardwareService=require(_0x7103('0x15'));var logger=require(_0x7103('0x16'))('api');var utils=require(_0x7103('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7103('0x18'));var db=require('../../mysqldb')['db'];config[_0x7103('0x19')]=_[_0x7103('0x1a')](config[_0x7103('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7103('0x1b'))(new Redis(config[_0x7103('0x19')]));require(_0x7103('0x1c'))[_0x7103('0x1d')](socket);function respondWithStatusCode(_0x4fb18e,_0x2664a3){_0x2664a3=_0x2664a3||0xcc;return function(_0x4c453b){if(_0x4c453b){return _0x4fb18e['sendStatus'](_0x2664a3);}return _0x4fb18e[_0x7103('0x1e')](_0x2664a3)['end']();};}function respondWithResult(_0xab564f,_0x135113){_0x135113=_0x135113||0xc8;return function(_0x115de6){if(_0x115de6){return _0xab564f[_0x7103('0x1e')](_0x135113)[_0x7103('0x1f')](_0x115de6);}};}function respondWithFilteredResult(_0x4ab072,_0x52a6bf){return function(_0x2367c6){if(_0x2367c6){var _0x467b85=typeof _0x52a6bf[_0x7103('0x20')]==='undefined'&&typeof _0x52a6bf['limit']===_0x7103('0x21');var _0x4ef3b9=_0x2367c6[_0x7103('0x22')];var _0x51cb50=_0x467b85?0x0:_0x52a6bf[_0x7103('0x20')];var _0x58f420=_0x467b85?_0x2367c6[_0x7103('0x22')]:_0x52a6bf[_0x7103('0x20')]+_0x52a6bf[_0x7103('0x23')];var _0x1c748f;if(_0x58f420>=_0x4ef3b9){_0x58f420=_0x4ef3b9;_0x1c748f=0xc8;}else{_0x1c748f=0xce;}_0x4ab072['status'](_0x1c748f);return _0x4ab072[_0x7103('0x24')](_0x7103('0x25'),_0x51cb50+'-'+_0x58f420+'/'+_0x4ef3b9)['json'](_0x2367c6);}return null;};}function patchUpdates(_0x3bd0f6){return function(_0x7fa74b){try{jsonpatch[_0x7103('0x26')](_0x7fa74b,_0x3bd0f6,!![]);}catch(_0x1aeaa2){return BPromise[_0x7103('0x27')](_0x1aeaa2);}return _0x7fa74b[_0x7103('0x28')]();};}function saveUpdates(_0x5a1fd6,_0x5a857f){return function(_0x2ed172){if(_0x2ed172){return _0x2ed172[_0x7103('0x29')](_0x5a1fd6)[_0x7103('0x2a')](function(_0xcbceac){return _0xcbceac;});}return null;};}function removeEntity(_0x5f3ee6,_0x4b1f3b){return function(_0x55713e){if(_0x55713e){return _0x55713e[_0x7103('0x2b')]()['then'](function(){var _0x4874ea=_0x55713e[_0x7103('0x2c')]({'plain':!![]});var _0x6ae64a=_0x7103('0x2d');return db[_0x7103('0x2e')][_0x7103('0x2b')]({'where':{'type':_0x6ae64a,'resourceId':_0x4874ea['id']}})[_0x7103('0x2a')](function(){return _0x55713e;});})[_0x7103('0x2a')](function(){_0x5f3ee6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a1207,_0x45b521){return function(_0xf208){if(!_0xf208){_0x2a1207[_0x7103('0x2f')](0x194);}return _0xf208;};}function handleError(_0x4c7c75,_0x5a6607){_0x5a6607=_0x5a6607||0x1f4;return function(_0x2ac01a){logger[_0x7103('0x30')](_0x2ac01a[_0x7103('0x31')]);if(_0x2ac01a[_0x7103('0x32')]){delete _0x2ac01a[_0x7103('0x32')];}_0x4c7c75[_0x7103('0x1e')](_0x5a6607)[_0x7103('0x33')](_0x2ac01a);};}exports[_0x7103('0x34')]=function(_0x1eb787,_0x26768a){var _0x473d4a={},_0x1374f3={},_0x327842={'count':0x0,'rows':[]};var _0x3050b3=_[_0x7103('0x35')](db[_0x7103('0x36')][_0x7103('0x37')],function(_0x1f2d79){return{'name':_0x1f2d79[_0x7103('0x38')],'type':_0x1f2d79[_0x7103('0x39')]['key']};});_0x1374f3[_0x7103('0x3a')]=_['map'](_0x3050b3,_0x7103('0x32'));_0x1374f3['query']=_[_0x7103('0x3b')](_0x1eb787['query']);_0x1374f3[_0x7103('0x3c')]=_[_0x7103('0x3d')](_0x1374f3[_0x7103('0x3a')],_0x1374f3[_0x7103('0x3e')]);_0x473d4a[_0x7103('0x3f')]=_[_0x7103('0x3d')](_0x1374f3[_0x7103('0x3a')],qs[_0x7103('0x40')](_0x1eb787['query'][_0x7103('0x40')]));_0x473d4a[_0x7103('0x3f')]=_0x473d4a['attributes'][_0x7103('0x41')]?_0x473d4a[_0x7103('0x3f')]:_0x1374f3[_0x7103('0x3a')];if(!_0x1eb787[_0x7103('0x3e')][_0x7103('0x42')](_0x7103('0x43'))){_0x473d4a['limit']=qs[_0x7103('0x23')](_0x1eb787[_0x7103('0x3e')][_0x7103('0x23')]);_0x473d4a[_0x7103('0x20')]=qs[_0x7103('0x20')](_0x1eb787[_0x7103('0x3e')]['offset']);}_0x473d4a['order']=qs[_0x7103('0x44')](_0x1eb787['query'][_0x7103('0x44')]);_0x473d4a[_0x7103('0x45')]=qs['filters'](_[_0x7103('0x46')](_0x1eb787['query'],_0x1374f3[_0x7103('0x3c')]),_0x3050b3);if(_0x1eb787['query'][_0x7103('0x47')]){_0x473d4a[_0x7103('0x45')]=_[_0x7103('0x48')](_0x473d4a[_0x7103('0x45')],{'$or':_[_0x7103('0x35')](_0x3050b3,function(_0x230fe9){if(_0x230fe9['type']!=='VIRTUAL'){var _0x26ad9b={};_0x26ad9b[_0x230fe9[_0x7103('0x32')]]={'$like':'%'+_0x1eb787[_0x7103('0x3e')][_0x7103('0x47')]+'%'};return _0x26ad9b;}})});}_0x473d4a=_[_0x7103('0x48')]({},_0x473d4a,_0x1eb787[_0x7103('0x49')]);var _0x40adf4={'where':_0x473d4a[_0x7103('0x45')]};return db[_0x7103('0x36')]['count'](_0x40adf4)[_0x7103('0x2a')](function(_0x438909){_0x327842[_0x7103('0x22')]=_0x438909;if(_0x1eb787[_0x7103('0x3e')][_0x7103('0x4a')]){_0x473d4a[_0x7103('0x4b')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x473d4a);})[_0x7103('0x2a')](function(_0x1e6ef0){_0x327842[_0x7103('0x4c')]=_0x1e6ef0;return _0x327842;})['then'](respondWithFilteredResult(_0x26768a,_0x473d4a))[_0x7103('0x4d')](handleError(_0x26768a,null));};exports[_0x7103('0x4e')]=function(_0x32bb42,_0x352518){var _0x438944={'raw':!![],'where':{'id':_0x32bb42['params']['id']}},_0x47556e={};_0x47556e[_0x7103('0x3a')]=_[_0x7103('0x3b')](db[_0x7103('0x36')][_0x7103('0x37')]);_0x47556e[_0x7103('0x3e')]=_['keys'](_0x32bb42[_0x7103('0x3e')]);_0x47556e[_0x7103('0x3c')]=_[_0x7103('0x3d')](_0x47556e[_0x7103('0x3a')],_0x47556e['query']);_0x438944[_0x7103('0x3f')]=_[_0x7103('0x3d')](_0x47556e[_0x7103('0x3a')],qs['fields'](_0x32bb42['query'][_0x7103('0x40')]));_0x438944[_0x7103('0x3f')]=_0x438944[_0x7103('0x3f')][_0x7103('0x41')]?_0x438944[_0x7103('0x3f')]:_0x47556e[_0x7103('0x3a')];if(_0x32bb42['query']['includeAll']){_0x438944[_0x7103('0x4b')]=[{'all':!![]}];}_0x438944=_[_0x7103('0x48')]({},_0x438944,_0x32bb42['options']);return db['WhatsappQueue'][_0x7103('0x4f')](_0x438944)[_0x7103('0x2a')](handleEntityNotFound(_0x352518,null))[_0x7103('0x2a')](respondWithResult(_0x352518,null))[_0x7103('0x4d')](handleError(_0x352518,null));};exports[_0x7103('0x50')]=function(_0x5a488b,_0x55d290){return db[_0x7103('0x36')][_0x7103('0x50')](_0x5a488b[_0x7103('0x51')],{})[_0x7103('0x2a')](function(_0x384e63){var _0x265439=_0x5a488b['user']['get']({'plain':!![]});if(!_0x265439)throw new Error(_0x7103('0x52'));if(_0x265439[_0x7103('0x53')]===_0x7103('0x54')){var _0x4a5d0a=_0x384e63['get']({'plain':!![]});var _0x3a8cef=_0x7103('0x2d');return db[_0x7103('0x55')][_0x7103('0x4f')]({'where':{'name':_0x3a8cef,'userProfileId':_0x265439[_0x7103('0x56')]},'raw':!![]})[_0x7103('0x2a')](function(_0x392309){if(_0x392309&&_0x392309[_0x7103('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a5d0a[_0x7103('0x32')],'resourceId':_0x4a5d0a['id'],'type':_0x392309[_0x7103('0x32')],'sectionId':_0x392309['id']},{})[_0x7103('0x2a')](function(){return _0x384e63;});}else{return _0x384e63;}})[_0x7103('0x4d')](function(_0x349b87){logger[_0x7103('0x30')](_0x7103('0x58'),_0x349b87);throw _0x349b87;});}return _0x384e63;})[_0x7103('0x2a')](respondWithResult(_0x55d290,0xc9))[_0x7103('0x4d')](handleError(_0x55d290,null));};exports[_0x7103('0x29')]=function(_0x53f38b,_0x43c542){if(_0x53f38b[_0x7103('0x51')]['id']){delete _0x53f38b['body']['id'];}return db[_0x7103('0x36')][_0x7103('0x4f')]({'where':{'id':_0x53f38b[_0x7103('0x59')]['id']}})[_0x7103('0x2a')](handleEntityNotFound(_0x43c542,null))[_0x7103('0x2a')](saveUpdates(_0x53f38b[_0x7103('0x51')],null))[_0x7103('0x2a')](respondWithResult(_0x43c542,null))[_0x7103('0x4d')](handleError(_0x43c542,null));};exports['destroy']=function(_0x261242,_0x31d7b8){return db['WhatsappQueue'][_0x7103('0x4f')]({'where':{'id':_0x261242['params']['id']}})[_0x7103('0x2a')](handleEntityNotFound(_0x31d7b8,null))['then'](removeEntity(_0x31d7b8,null))[_0x7103('0x4d')](handleError(_0x31d7b8,null));};exports[_0x7103('0x5a')]=function(_0x445e5a,_0x1f7657){return db['WhatsappQueue'][_0x7103('0x5a')]()['then'](respondWithResult(_0x1f7657,null))[_0x7103('0x4d')](handleError(_0x1f7657,null));};exports[_0x7103('0x5b')]=function(_0x4ca23e,_0x5d18e2,_0x1a56e5){var _0x40dedc={'raw':!![],'where':{}},_0x3c6ae9={},_0x1eaf9d;return db['WhatsappQueue'][_0x7103('0x5c')]({'where':{'id':_0x4ca23e[_0x7103('0x59')]['id']}})[_0x7103('0x2a')](handleEntityNotFound(_0x5d18e2,null))[_0x7103('0x2a')](function(_0x5d0313){if(_0x5d0313){_0x1eaf9d=_0x5d0313[_0x7103('0x2c')]({'plain':!![]});_0x3c6ae9[_0x7103('0x3a')]=_[_0x7103('0x3b')](db[_0x7103('0x5d')][_0x7103('0x37')]);_0x3c6ae9['query']=_[_0x7103('0x3b')](_0x4ca23e[_0x7103('0x3e')]);_0x3c6ae9[_0x7103('0x3c')]=_[_0x7103('0x3d')](_0x3c6ae9['model'],_0x3c6ae9[_0x7103('0x3e')]);_0x40dedc[_0x7103('0x3f')]=_[_0x7103('0x3d')](_0x3c6ae9[_0x7103('0x3a')],qs[_0x7103('0x40')](_0x4ca23e[_0x7103('0x3e')][_0x7103('0x40')]));_0x40dedc[_0x7103('0x3f')]=_0x40dedc['attributes'][_0x7103('0x41')]?_0x40dedc['attributes']:_0x3c6ae9[_0x7103('0x3a')];if(!_0x4ca23e[_0x7103('0x3e')][_0x7103('0x42')]('nolimit')){_0x40dedc['limit']=qs[_0x7103('0x23')](_0x4ca23e['query'][_0x7103('0x23')]);_0x40dedc['offset']=qs[_0x7103('0x20')](_0x4ca23e[_0x7103('0x3e')][_0x7103('0x20')]);}_0x40dedc['order']=qs[_0x7103('0x44')](_0x4ca23e[_0x7103('0x3e')]['sort']);_0x40dedc[_0x7103('0x45')]=qs['filters'](_[_0x7103('0x46')](_0x4ca23e['query'],_0x3c6ae9[_0x7103('0x3c')]));_0x40dedc[_0x7103('0x45')][_0x7103('0x5e')]=_0x5d0313['id'];if(_0x4ca23e['query'][_0x7103('0x47')]){_0x40dedc[_0x7103('0x45')]=_['merge'](_0x40dedc[_0x7103('0x45')],{'$or':_[_0x7103('0x35')](_0x40dedc[_0x7103('0x3f')],function(_0x8660c){var _0xcc2e2e={};_0xcc2e2e[_0x8660c]={'$like':'%'+_0x4ca23e[_0x7103('0x3e')]['filter']+'%'};return _0xcc2e2e;})});}_0x40dedc=_[_0x7103('0x48')]({},_0x40dedc,_0x4ca23e['options']);return db['UserWhatsappQueue'][_0x7103('0x5f')](_0x40dedc);}})[_0x7103('0x2a')](function(_0xe0231f){if(_0xe0231f){return db[_0x7103('0x60')][_0x7103('0x61')]({'where':{'id':_[_0x7103('0x35')](_0xe0231f,_0x7103('0x62')),'role':'agent'},'attributes':['id',_0x7103('0x32'),_0x7103('0x63'),_0x7103('0x64'),'createdAt']});}})[_0x7103('0x2a')](function(_0x1882c0){if(_0x1882c0){return{'count':_0x1882c0[_0x7103('0x22')],'rows':_[_0x7103('0x35')](_0x1882c0[_0x7103('0x4c')],function(_0x22f4bc){return{'membername':_0x22f4bc[_0x7103('0x32')],'UserId':_0x22f4bc['id'],'queue_name':_0x1eaf9d['name'],'WhatsappQueueId':_0x1eaf9d['id'],'interface':util[_0x7103('0x65')](_0x7103('0x66'),_0x7103('0x67'),_0x22f4bc[_0x7103('0x32')]),'penalty':0x0,'paused':_0x22f4bc['whatsappPause'],'createdAt':_0x22f4bc[_0x7103('0x68')],'updatedAt':_0x22f4bc[_0x7103('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7103('0x2a')](respondWithFilteredResult(_0x5d18e2,_0x40dedc))[_0x7103('0x4d')](handleError(_0x5d18e2,null));};exports[_0x7103('0x69')]=function(_0x11b8a3,_0x30f63c,_0x53cdb8){var _0x46da9f={};var _0x200c80={};var _0x5d6a4c;var _0x423417;return db[_0x7103('0x36')][_0x7103('0x5c')]({'where':{'id':_0x11b8a3[_0x7103('0x59')]['id']}})['then'](handleEntityNotFound(_0x30f63c,null))[_0x7103('0x2a')](function(_0x5f06b5){if(_0x5f06b5){_0x5d6a4c=_0x5f06b5;_0x200c80[_0x7103('0x3a')]=_[_0x7103('0x3b')](db[_0x7103('0x6a')]['rawAttributes']);_0x200c80[_0x7103('0x3e')]=_[_0x7103('0x3b')](_0x11b8a3[_0x7103('0x3e')]);_0x200c80[_0x7103('0x3c')]=_[_0x7103('0x3d')](_0x200c80['model'],_0x200c80['query']);_0x46da9f[_0x7103('0x3f')]=_[_0x7103('0x3d')](_0x200c80[_0x7103('0x3a')],qs[_0x7103('0x40')](_0x11b8a3[_0x7103('0x3e')][_0x7103('0x40')]));_0x46da9f[_0x7103('0x3f')]=_0x46da9f[_0x7103('0x3f')][_0x7103('0x41')]?_0x46da9f[_0x7103('0x3f')]:_0x200c80[_0x7103('0x3a')];_0x46da9f[_0x7103('0x6b')]=qs[_0x7103('0x44')](_0x11b8a3[_0x7103('0x3e')]['sort']);_0x46da9f['where']=qs[_0x7103('0x3c')](_[_0x7103('0x46')](_0x11b8a3[_0x7103('0x3e')],_0x200c80[_0x7103('0x3c')]));if(_0x11b8a3[_0x7103('0x3e')][_0x7103('0x47')]){_0x46da9f[_0x7103('0x45')]=_[_0x7103('0x48')](_0x46da9f[_0x7103('0x45')],{'$or':_['map'](_0x46da9f[_0x7103('0x3f')],function(_0x56dc12){var _0x9f8e49={};_0x9f8e49[_0x56dc12]={'$like':'%'+_0x11b8a3[_0x7103('0x3e')][_0x7103('0x47')]+'%'};return _0x9f8e49;})});}_0x46da9f=_[_0x7103('0x48')]({},_0x46da9f,_0x11b8a3[_0x7103('0x49')]);return _0x5d6a4c[_0x7103('0x69')](_0x46da9f);}})[_0x7103('0x2a')](function(_0x4394fe){if(_0x4394fe){_0x423417=_0x4394fe[_0x7103('0x41')];if(!_0x11b8a3[_0x7103('0x3e')][_0x7103('0x42')](_0x7103('0x43'))){_0x46da9f[_0x7103('0x23')]=qs[_0x7103('0x23')](_0x11b8a3['query']['limit']);_0x46da9f[_0x7103('0x20')]=qs['offset'](_0x11b8a3[_0x7103('0x3e')][_0x7103('0x20')]);}return _0x5d6a4c[_0x7103('0x69')](_0x46da9f);}})[_0x7103('0x2a')](function(_0x5e53b5){if(_0x5e53b5){return _0x5e53b5?{'count':_0x423417,'rows':_0x5e53b5}:null;}})[_0x7103('0x2a')](respondWithResult(_0x30f63c,null))[_0x7103('0x4d')](handleError(_0x30f63c,null));};exports[_0x7103('0x6c')]=function(_0x11de49,_0x4e0cb5,_0x16e405){var _0x14a2c3=_0x11de49['body'][_0x7103('0x6d')];return db['Team']['findAll']({'where':{'id':_0x14a2c3},'attributes':['id'],'include':[{'model':db[_0x7103('0x60')],'as':_0x7103('0x6e'),'attributes':['id',_0x7103('0x32'),_0x7103('0x6f'),'voicePause',_0x7103('0x70')],'raw':!![]}]})[_0x7103('0x2a')](function(_0x1b8eba){if(_0x1b8eba){var _0x51f523=_[_0x7103('0x71')](_0x1b8eba,function(_0x136ce7){var _0x55788d=_0x136ce7['get']({'plain':!![]});return _0x55788d['Agents'];});return db[_0x7103('0x36')]['find']({'where':{'id':_0x11de49['params']['id']}})['then'](function(_0x56bb28){return db[_0x7103('0x72')][_0x7103('0x73')](function(_0x18d44b){return _0x56bb28[_0x7103('0x6c')](_0x14a2c3,{'transaction':_0x18d44b})[_0x7103('0x2a')](function(){return BPromise['each'](_0x51f523,function(_0xbf1c10){return db[_0x7103('0x5d')][_0x7103('0x74')]({'where':{'UserId':_0xbf1c10['id'],'WhatsappQueueId':_0x11de49[_0x7103('0x59')]['id']},'transaction':_0x18d44b});});})['then'](function(){_0x51f523[_0x7103('0x75')](function(_0x5e56e6){socket[_0x7103('0x76')](_0x7103('0x77'),{'UserId':_0x5e56e6['id'],'WhatsappQueueId':_0x56bb28['id']});});});});});}})[_0x7103('0x2a')](respondWithStatusCode(_0x4e0cb5,null))[_0x7103('0x4d')](handleError(_0x4e0cb5,null));};exports['removeTeams']=function(_0x43042f,_0x5ec6e2,_0x2f7d13){return db[_0x7103('0x6a')][_0x7103('0x5f')]({'where':{'id':_0x43042f[_0x7103('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7103('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5ec6e2,null))[_0x7103('0x2a')](function(_0x314b31){var _0x50e672=_[_0x7103('0x35')](_0x314b31,'id');var _0x55346f=[];var _0x40e90b=[];var _0x1bbdb7=squel['select']();_0x1bbdb7[_0x7103('0x78')](_0x7103('0x79'))[_0x7103('0x7a')](_0x7103('0x7b'),'tq')[_0x7103('0x7c')](_0x7103('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7103('0x45')](_0x7103('0x7e'),_0x43042f[_0x7103('0x59')]['id']);for(var _0x3a7e8d=0x0;_0x3a7e8d<_0x314b31[_0x7103('0x41')];_0x3a7e8d+=0x1){let _0x8cd0a3=_0x314b31[_0x3a7e8d];for(var _0x49d5b8=0x0;_0x49d5b8<_0x8cd0a3[_0x7103('0x6e')][_0x7103('0x41')];_0x49d5b8+=0x1){let _0x145f99=_0x8cd0a3[_0x7103('0x6e')][_0x49d5b8];var _0x3837fd=_0x1bbdb7[_0x7103('0x7f')]();_0x3837fd[_0x7103('0x45')](_0x7103('0x80'),_0x145f99['id']);_0x40e90b['push'](db[_0x7103('0x72')][_0x7103('0x3e')](_0x3837fd[_0x7103('0x81')](),{'type':db[_0x7103('0x72')][_0x7103('0x82')]['SELECT']})['then'](function(_0xf0a4ac){if(_0xf0a4ac[_0x7103('0x41')]===0x1){return _0x145f99['id'];}else{var _0x1bce26=_[_0x7103('0x83')](_[_0x7103('0x35')](_0xf0a4ac,_0x7103('0x84')),function(_0x219f08){return _[_0x7103('0x85')](_0x50e672,_0x219f08);});if(_0x1bce26){return _0x145f99['id'];}}}));}}return BPromise[_0x7103('0x86')](_0x40e90b)['then'](function(_0x1ef575){_0x55346f=_(_0x55346f)[_0x7103('0x87')](_0x1ef575)[_0x7103('0x88')]()[_0x7103('0x89')]();return db[_0x7103('0x36')][_0x7103('0x4f')]({'where':{'id':_0x43042f['params']['id']}})[_0x7103('0x2a')](function(_0x5eceef){return db['sequelize'][_0x7103('0x73')](function(_0x2b24f1){return _0x5eceef['removeTeams'](_0x43042f[_0x7103('0x3e')][_0x7103('0x6d')],{'transaction':_0x2b24f1})['then'](function(){if(!_[_0x7103('0x8a')](_0x55346f)){return _0x5eceef[_0x7103('0x8b')](_0x55346f,{'transaction':_0x2b24f1});}})[_0x7103('0x2a')](function(){_0x55346f[_0x7103('0x75')](function(_0x233822){socket[_0x7103('0x76')](_0x7103('0x8c'),{'UserId':_0x233822,'WhatsappQueueId':_0x5eceef['id']});});});});});});})[_0x7103('0x2a')](respondWithStatusCode(_0x5ec6e2,null))['catch'](handleError(_0x5ec6e2,null));};exports[_0x7103('0x8d')]=function(_0x29b83f,_0x432405,_0xc55212){return db['WhatsappQueue']['find']({'where':{'id':_0x29b83f[_0x7103('0x59')]['id']}})['then'](handleEntityNotFound(_0x432405,null))[_0x7103('0x2a')](function(_0x415661){if(_0x415661){return _0x415661['addAgents'](_0x29b83f[_0x7103('0x51')][_0x7103('0x6d')],_['omit'](_0x29b83f[_0x7103('0x51')],['ids','id'])||{})[_0x7103('0x8e')](function(_0x18d50e){for(var _0x1a122e=0x0;_0x1a122e<_0x29b83f[_0x7103('0x51')][_0x7103('0x6d')][_0x7103('0x41')];_0x1a122e+=0x1){socket[_0x7103('0x76')](_0x7103('0x77'),{'UserId':Number(_0x29b83f[_0x7103('0x51')]['ids'][_0x1a122e]),'WhatsappQueueId':Number(_0x29b83f[_0x7103('0x59')]['id'])});}return _0x18d50e;});}})[_0x7103('0x2a')](respondWithResult(_0x432405,null))[_0x7103('0x4d')](handleError(_0x432405,null));};exports[_0x7103('0x8b')]=function(_0x172b8a,_0x375932,_0x542116){return db[_0x7103('0x36')][_0x7103('0x4f')]({'where':{'id':_0x172b8a[_0x7103('0x59')]['id']}})[_0x7103('0x2a')](handleEntityNotFound(_0x375932,null))[_0x7103('0x2a')](function(_0x332f06){if(_0x332f06){return _0x332f06[_0x7103('0x8b')](_0x172b8a[_0x7103('0x3e')]['ids'])['then'](function(){if(_[_0x7103('0x8f')](_0x172b8a[_0x7103('0x3e')][_0x7103('0x6d')])){for(var _0x2c859a=0x0;_0x2c859a<_0x172b8a['query'][_0x7103('0x6d')][_0x7103('0x41')];_0x2c859a+=0x1){socket[_0x7103('0x76')](_0x7103('0x8c'),{'UserId':Number(_0x172b8a[_0x7103('0x3e')]['ids'][_0x2c859a]),'WhatsappQueueId':Number(_0x172b8a[_0x7103('0x59')]['id'])});}}else{socket[_0x7103('0x76')](_0x7103('0x8c'),{'UserId':Number(_0x172b8a[_0x7103('0x3e')][_0x7103('0x6d')]),'WhatsappQueueId':Number(_0x172b8a[_0x7103('0x59')]['id'])});}});}})[_0x7103('0x2a')](respondWithStatusCode(_0x375932,null))[_0x7103('0x4d')](handleError(_0x375932,null));};exports[_0x7103('0x90')]=function(_0x28c371,_0x20a9fc,_0x22f9c7){var _0x5378ab={};var _0x1a0b01={};var _0x142e29;var _0xb1b19d;return db[_0x7103('0x36')][_0x7103('0x5c')]({'where':{'id':_0x28c371[_0x7103('0x59')]['id']}})[_0x7103('0x2a')](handleEntityNotFound(_0x20a9fc,null))['then'](function(_0x2f2289){if(_0x2f2289){_0x142e29=_0x2f2289;_0x1a0b01[_0x7103('0x3a')]=_[_0x7103('0x3b')](db[_0x7103('0x60')]['rawAttributes']);_0x1a0b01[_0x7103('0x3e')]=_[_0x7103('0x3b')](_0x28c371[_0x7103('0x3e')]);_0x1a0b01[_0x7103('0x3c')]=_[_0x7103('0x3d')](_0x1a0b01['model'],_0x1a0b01[_0x7103('0x3e')]);_0x5378ab['attributes']=_[_0x7103('0x3d')](_0x1a0b01['model'],qs['fields'](_0x28c371[_0x7103('0x3e')][_0x7103('0x40')]));_0x5378ab[_0x7103('0x3f')]=_0x5378ab[_0x7103('0x3f')][_0x7103('0x41')]?_0x5378ab[_0x7103('0x3f')]:_0x1a0b01[_0x7103('0x3a')];_0x5378ab[_0x7103('0x6b')]=qs[_0x7103('0x44')](_0x28c371['query'][_0x7103('0x44')]);_0x5378ab[_0x7103('0x45')]=qs[_0x7103('0x3c')](_[_0x7103('0x46')](_0x28c371['query'],_0x1a0b01[_0x7103('0x3c')]));if(_0x28c371['query'][_0x7103('0x47')]){_0x5378ab[_0x7103('0x45')]=_[_0x7103('0x48')](_0x5378ab[_0x7103('0x45')],{'$or':_[_0x7103('0x35')](_0x5378ab[_0x7103('0x3f')],function(_0x5b573a){var _0x7a4822={};_0x7a4822[_0x5b573a]={'$like':'%'+_0x28c371['query'][_0x7103('0x47')]+'%'};return _0x7a4822;})});}_0x5378ab=_[_0x7103('0x48')]({},_0x5378ab,_0x28c371['options']);return _0x142e29['getAgents'](_0x5378ab);}})[_0x7103('0x2a')](function(_0x260148){if(_0x260148){_0xb1b19d=_0x260148[_0x7103('0x41')];if(!_0x28c371[_0x7103('0x3e')][_0x7103('0x42')](_0x7103('0x43'))){_0x5378ab['limit']=qs[_0x7103('0x23')](_0x28c371['query']['limit']);_0x5378ab[_0x7103('0x20')]=qs[_0x7103('0x20')](_0x28c371[_0x7103('0x3e')][_0x7103('0x20')]);}return _0x142e29['getAgents'](_0x5378ab);}})[_0x7103('0x2a')](function(_0x199cf0){if(_0x199cf0){return _0x199cf0?{'count':_0xb1b19d,'rows':_0x199cf0}:null;}})[_0x7103('0x2a')](respondWithResult(_0x20a9fc,null))[_0x7103('0x4d')](handleError(_0x20a9fc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a1a6990..cf4aebb 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 _0xf5fe=['update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d528b,_0x173aa3){var _0x40b019=function(_0x543032){while(--_0x543032){_0x5d528b['push'](_0x5d528b['shift']());}};_0x40b019(++_0x173aa3);}(_0xf5fe,0xfc));var _0xef5f=function(_0x297b81,_0x284f46){_0x297b81=_0x297b81-0x0;var _0x199d01=_0xf5fe[_0x297b81];return _0x199d01;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xef5f('0x0'),'afterDestroy':_0xef5f('0x1')};function emitEvent(_0x1fee69){return function(_0x1b02cc,_0x50537d,_0x27d288){WhatsappQueueEvents[_0xef5f('0x2')](_0x1fee69+':'+_0x1b02cc['id'],_0x1b02cc);WhatsappQueueEvents[_0xef5f('0x2')](_0x1fee69,_0x1b02cc);_0x27d288(null);};}for(var e in events){if(events[_0xef5f('0x3')](e)){var event=events[e];WhatsappQueue[_0xef5f('0x4')](e,emitEvent(event));}}module[_0xef5f('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa265=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2f95b9,_0x56b270){var _0x2b31e2=function(_0x821258){while(--_0x821258){_0x2f95b9['push'](_0x2f95b9['shift']());}};_0x2b31e2(++_0x56b270);}(_0xa265,0x189));var _0x5a26=function(_0xc1d5b5,_0x5a2aba){_0xc1d5b5=_0xc1d5b5-0x0;var _0x451864=_0xa265[_0xc1d5b5];return _0x451864;};'use strict';var EventEmitter=require(_0x5a26('0x0'));var WhatsappQueue=require(_0x5a26('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5a26('0x2')](0x0);var events={'afterCreate':_0x5a26('0x3'),'afterUpdate':_0x5a26('0x4'),'afterDestroy':_0x5a26('0x5')};function emitEvent(_0x2567d9){return function(_0x25da3d,_0x4704cd,_0x5e11c7){WhatsappQueueEvents['emit'](_0x2567d9+':'+_0x25da3d['id'],_0x25da3d);WhatsappQueueEvents[_0x5a26('0x6')](_0x2567d9,_0x25da3d);_0x5e11c7(null);};}for(var e in events){if(events[_0x5a26('0x7')](e)){var event=events[e];WhatsappQueue[_0x5a26('0x8')](e,emitEvent(event));}}module[_0x5a26('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c728e6d..7e9e397 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 _0xe9a0=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','util'];(function(_0x807c1d,_0x4fdaad){var _0x30a1e0=function(_0x5eaca9){while(--_0x5eaca9){_0x807c1d['push'](_0x807c1d['shift']());}};_0x30a1e0(++_0x4fdaad);}(_0xe9a0,0x153));var _0x0e9a=function(_0xbd49d7,_0x3bb611){_0xbd49d7=_0xbd49d7-0x0;var _0x500238=_0xe9a0[_0xbd49d7];return _0x500238;};'use strict';var _=require('lodash');var util=require(_0x0e9a('0x0'));var logger=require(_0x0e9a('0x1'))('api');var moment=require(_0x0e9a('0x2'));var BPromise=require('bluebird');var rp=require(_0x0e9a('0x3'));var fs=require('fs');var path=require(_0x0e9a('0x4'));var rimraf=require(_0x0e9a('0x5'));var config=require(_0x0e9a('0x6'));var attributes=require(_0x0e9a('0x7'));module[_0x0e9a('0x8')]=function(_0x53ead8,_0x202284){return _0x53ead8['define']('WhatsappQueue',attributes,{'tableName':_0x0e9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca4=['moment','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','api'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x6ca4,0x14b));var _0x46ca=function(_0x238f5f,_0x10c60a){_0x238f5f=_0x238f5f-0x0;var _0x181f3f=_0x6ca4[_0x238f5f];return _0x181f3f;};'use strict';var _=require(_0x46ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x46ca('0x1'));var moment=require(_0x46ca('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46ca('0x3'));var rimraf=require(_0x46ca('0x4'));var config=require('../../config/environment');var attributes=require(_0x46ca('0x5'));module[_0x46ca('0x6')]=function(_0x5d16d0,_0x30b3f0){return _0x5d16d0[_0x46ca('0x7')](_0x46ca('0x8'),attributes,{'tableName':'whatsapp_queues','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 41a42ec..8656889 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 _0x1409=['redis','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','map','model','debug','catch','ShowWhatsappQueue','where','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter'];(function(_0x307f57,_0x2338f0){var _0xd20351=function(_0x165a21){while(--_0x165a21){_0x307f57['push'](_0x307f57['shift']());}};_0xd20351(++_0x2338f0);}(_0x1409,0x15c));var _0x9140=function(_0x34a8e9,_0x281403){_0x34a8e9=_0x34a8e9-0x0;var _0x3d8faa=_0x1409[_0x34a8e9];return _0x3d8faa;};'use strict';var _=require(_0x9140('0x0'));var util=require(_0x9140('0x1'));var moment=require(_0x9140('0x2'));var BPromise=require('bluebird');var rs=require(_0x9140('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9140('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9140('0x5'))('rpc');var config=require(_0x9140('0x6'));var jayson=require(_0x9140('0x7'));var client=jayson['client'][_0x9140('0x8')]({'port':0x232a});config['redis']=_[_0x9140('0x9')](config['redis'],{'host':_0x9140('0xa'),'port':0x18eb});var socket=require(_0x9140('0xb'))(new Redis(config[_0x9140('0xc')]));require(_0x9140('0xd'))['register'](socket);function respondWithRpcPromise(_0x313b23,_0x6fd8b4,_0x2adc4c){return new BPromise(function(_0x56d205,_0xd7bbd7){return client[_0x9140('0xe')](_0x313b23,_0x2adc4c)[_0x9140('0xf')](function(_0x540252){logger[_0x9140('0x10')](_0x9140('0x11'),_0x6fd8b4,_0x9140('0x12'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x6fd8b4,_0x9140('0x12'),JSON[_0x9140('0x13')](_0x540252));if(_0x540252[_0x9140('0x14')]){if(_0x540252[_0x9140('0x14')][_0x9140('0x15')]===0x1f4){logger[_0x9140('0x14')](_0x9140('0x11'),_0x6fd8b4,_0x540252[_0x9140('0x14')]['message']);return _0xd7bbd7(_0x540252[_0x9140('0x14')][_0x9140('0x16')]);}logger[_0x9140('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x6fd8b4,_0x540252['error'][_0x9140('0x16')]);return _0x56d205(_0x540252[_0x9140('0x14')][_0x9140('0x16')]);}else{logger[_0x9140('0x10')](_0x9140('0x11'),_0x6fd8b4,_0x9140('0x12'));_0x56d205(_0x540252['result'][_0x9140('0x16')]);}})['catch'](function(_0x49c77d){logger[_0x9140('0x14')](_0x9140('0x11'),_0x6fd8b4,_0x49c77d);_0xd7bbd7(_0x49c77d);});});}exports[_0x9140('0x17')]=function(_0x86c8c4){var _0x5df3dc=this;return new Promise(function(_0x2753e3,_0x3be018){return db[_0x9140('0x18')]['findAll']({'raw':_0x86c8c4[_0x9140('0x19')]?_0x86c8c4[_0x9140('0x19')][_0x9140('0x1a')]===undefined?!![]:![]:!![],'where':_0x86c8c4['options']?_0x86c8c4['options']['where']||null:null,'attributes':_0x86c8c4[_0x9140('0x19')]?_0x86c8c4[_0x9140('0x19')][_0x9140('0x1b')]||null:null,'limit':_0x86c8c4[_0x9140('0x19')]?_0x86c8c4[_0x9140('0x19')][_0x9140('0x1c')]||null:null,'include':_0x86c8c4[_0x9140('0x19')]?_0x86c8c4[_0x9140('0x19')][_0x9140('0x1d')]?_[_0x9140('0x1e')](_0x86c8c4[_0x9140('0x19')][_0x9140('0x1d')],function(_0x775f13){return{'model':db[_0x775f13[_0x9140('0x1f')]],'as':_0x775f13['as'],'attributes':_0x775f13[_0x9140('0x1b')],'include':_0x775f13['include']?_['map'](_0x775f13[_0x9140('0x1d')],function(_0x450bbd){return{'model':db[_0x450bbd[_0x9140('0x1f')]],'as':_0x450bbd['as'],'attributes':_0x450bbd[_0x9140('0x1b')],'include':_0x450bbd[_0x9140('0x1d')]?_[_0x9140('0x1e')](_0x450bbd[_0x9140('0x1d')],function(_0x5e3df0){return{'model':db[_0x5e3df0['model']],'as':_0x5e3df0['as'],'attributes':_0x5e3df0[_0x9140('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9140('0xf')](function(_0x2209a3){logger[_0x9140('0x10')](_0x9140('0x17'),_0x86c8c4);logger[_0x9140('0x20')]('GetWhatsappQueue',_0x86c8c4,JSON[_0x9140('0x13')](_0x2209a3));_0x2753e3(_0x2209a3);})[_0x9140('0x21')](function(_0x502be3){logger['error']('GetWhatsappQueue',_0x502be3['message'],_0x86c8c4);_0x3be018(_0x5df3dc[_0x9140('0x14')](0x1f4,_0x502be3[_0x9140('0x16')]));});});};exports[_0x9140('0x22')]=function(_0xafc7c1){var _0x3dc674=this;return new Promise(function(_0x44ae8f,_0x1fdead){return db[_0x9140('0x18')]['find']({'raw':_0xafc7c1[_0x9140('0x19')]?_0xafc7c1[_0x9140('0x19')][_0x9140('0x1a')]===undefined?!![]:![]:!![],'where':_0xafc7c1[_0x9140('0x19')]?_0xafc7c1[_0x9140('0x19')][_0x9140('0x23')]||null:null,'attributes':_0xafc7c1[_0x9140('0x19')]?_0xafc7c1[_0x9140('0x19')][_0x9140('0x1b')]||null:null,'include':_0xafc7c1[_0x9140('0x19')]?_0xafc7c1[_0x9140('0x19')][_0x9140('0x1d')]?_[_0x9140('0x1e')](_0xafc7c1['options']['include'],function(_0x4da998){return{'model':db[_0x4da998['model']],'as':_0x4da998['as'],'attributes':_0x4da998[_0x9140('0x1b')],'include':_0x4da998[_0x9140('0x1d')]?_['map'](_0x4da998[_0x9140('0x1d')],function(_0x1b19d6){return{'model':db[_0x1b19d6[_0x9140('0x1f')]],'as':_0x1b19d6['as'],'attributes':_0x1b19d6[_0x9140('0x1b')],'include':_0x1b19d6[_0x9140('0x1d')]?_[_0x9140('0x1e')](_0x1b19d6[_0x9140('0x1d')],function(_0xab91fe){return{'model':db[_0xab91fe[_0x9140('0x1f')]],'as':_0xab91fe['as'],'attributes':_0xab91fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xdf1346){logger[_0x9140('0x10')](_0x9140('0x22'),_0xafc7c1);logger[_0x9140('0x20')](_0x9140('0x22'),_0xafc7c1,JSON['stringify'](_0xdf1346));_0x44ae8f(_0xdf1346);})['catch'](function(_0x16f0f0){logger[_0x9140('0x14')](_0x9140('0x22'),_0x16f0f0[_0x9140('0x16')],_0xafc7c1);_0x1fdead(_0x3dc674[_0x9140('0x14')](0x1f4,_0x16f0f0[_0x9140('0x16')]));});});}; \ No newline at end of file +var _0xf3ca=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','include','map','model','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3f9869,_0x534743){var _0x5816e2=function(_0x4e75ce){while(--_0x4e75ce){_0x3f9869['push'](_0x3f9869['shift']());}};_0x5816e2(++_0x534743);}(_0xf3ca,0xd5));var _0xaf3c=function(_0x27d29e,_0x46ddcc){_0x27d29e=_0x27d29e-0x0;var _0x174321=_0xf3ca[_0x27d29e];return _0x174321;};'use strict';var _=require(_0xaf3c('0x0'));var util=require(_0xaf3c('0x1'));var moment=require(_0xaf3c('0x2'));var BPromise=require(_0xaf3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf3c('0x4'))['db'];var utils=require(_0xaf3c('0x5'));var logger=require(_0xaf3c('0x6'))(_0xaf3c('0x7'));var config=require(_0xaf3c('0x8'));var jayson=require(_0xaf3c('0x9'));var client=jayson['client'][_0xaf3c('0xa')]({'port':0x232a});config[_0xaf3c('0xb')]=_[_0xaf3c('0xc')](config[_0xaf3c('0xb')],{'host':_0xaf3c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf3c('0xb')]));require(_0xaf3c('0xe'))[_0xaf3c('0xf')](socket);function respondWithRpcPromise(_0x24ce62,_0x2726d1,_0x2bbb9f){return new BPromise(function(_0x42c56f,_0x5136a6){return client[_0xaf3c('0x10')](_0x24ce62,_0x2bbb9f)[_0xaf3c('0x11')](function(_0x5f0d24){logger[_0xaf3c('0x12')](_0xaf3c('0x13'),_0x2726d1,_0xaf3c('0x14'));logger[_0xaf3c('0x15')](_0xaf3c('0x16'),_0x2726d1,_0xaf3c('0x14'),JSON[_0xaf3c('0x17')](_0x5f0d24));if(_0x5f0d24[_0xaf3c('0x18')]){if(_0x5f0d24[_0xaf3c('0x18')]['code']===0x1f4){logger['error'](_0xaf3c('0x13'),_0x2726d1,_0x5f0d24[_0xaf3c('0x18')]['message']);return _0x5136a6(_0x5f0d24[_0xaf3c('0x18')][_0xaf3c('0x19')]);}logger['error'](_0xaf3c('0x13'),_0x2726d1,_0x5f0d24[_0xaf3c('0x18')][_0xaf3c('0x19')]);return _0x42c56f(_0x5f0d24['error'][_0xaf3c('0x19')]);}else{logger['info'](_0xaf3c('0x13'),_0x2726d1,'request\x20sent');_0x42c56f(_0x5f0d24['result'][_0xaf3c('0x19')]);}})[_0xaf3c('0x1a')](function(_0x335d66){logger['error'](_0xaf3c('0x13'),_0x2726d1,_0x335d66);_0x5136a6(_0x335d66);});});}exports[_0xaf3c('0x1b')]=function(_0xeab4c2){var _0x30cc48=this;return new Promise(function(_0x313d19,_0x391fa9){return db[_0xaf3c('0x1c')][_0xaf3c('0x1d')]({'raw':_0xeab4c2[_0xaf3c('0x1e')]?_0xeab4c2[_0xaf3c('0x1e')][_0xaf3c('0x1f')]===undefined?!![]:![]:!![],'where':_0xeab4c2[_0xaf3c('0x1e')]?_0xeab4c2[_0xaf3c('0x1e')]['where']||null:null,'attributes':_0xeab4c2[_0xaf3c('0x1e')]?_0xeab4c2['options'][_0xaf3c('0x20')]||null:null,'limit':_0xeab4c2[_0xaf3c('0x1e')]?_0xeab4c2[_0xaf3c('0x1e')]['limit']||null:null,'include':_0xeab4c2[_0xaf3c('0x1e')]?_0xeab4c2[_0xaf3c('0x1e')][_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0xeab4c2['options'][_0xaf3c('0x21')],function(_0x1e8ae7){return{'model':db[_0x1e8ae7[_0xaf3c('0x23')]],'as':_0x1e8ae7['as'],'attributes':_0x1e8ae7['attributes'],'include':_0x1e8ae7[_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0x1e8ae7['include'],function(_0x1cee87){return{'model':db[_0x1cee87['model']],'as':_0x1cee87['as'],'attributes':_0x1cee87['attributes'],'include':_0x1cee87['include']?_[_0xaf3c('0x22')](_0x1cee87[_0xaf3c('0x21')],function(_0x4e2e98){return{'model':db[_0x4e2e98[_0xaf3c('0x23')]],'as':_0x4e2e98['as'],'attributes':_0x4e2e98['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13ad7b){logger['info'](_0xaf3c('0x1b'),_0xeab4c2);logger[_0xaf3c('0x15')](_0xaf3c('0x1b'),_0xeab4c2,JSON[_0xaf3c('0x17')](_0x13ad7b));_0x313d19(_0x13ad7b);})[_0xaf3c('0x1a')](function(_0x3d562c){logger[_0xaf3c('0x18')](_0xaf3c('0x1b'),_0x3d562c[_0xaf3c('0x19')],_0xeab4c2);_0x391fa9(_0x30cc48[_0xaf3c('0x18')](0x1f4,_0x3d562c[_0xaf3c('0x19')]));});});};exports[_0xaf3c('0x24')]=function(_0x46436a){var _0x22d21f=this;return new Promise(function(_0x4d272e,_0x1b7918){return db[_0xaf3c('0x1c')][_0xaf3c('0x25')]({'raw':_0x46436a[_0xaf3c('0x1e')]?_0x46436a[_0xaf3c('0x1e')][_0xaf3c('0x1f')]===undefined?!![]:![]:!![],'where':_0x46436a['options']?_0x46436a[_0xaf3c('0x1e')][_0xaf3c('0x26')]||null:null,'attributes':_0x46436a[_0xaf3c('0x1e')]?_0x46436a[_0xaf3c('0x1e')][_0xaf3c('0x20')]||null:null,'include':_0x46436a[_0xaf3c('0x1e')]?_0x46436a[_0xaf3c('0x1e')]['include']?_[_0xaf3c('0x22')](_0x46436a[_0xaf3c('0x1e')][_0xaf3c('0x21')],function(_0x49fd8b){return{'model':db[_0x49fd8b['model']],'as':_0x49fd8b['as'],'attributes':_0x49fd8b[_0xaf3c('0x20')],'include':_0x49fd8b[_0xaf3c('0x21')]?_['map'](_0x49fd8b[_0xaf3c('0x21')],function(_0x16e01c){return{'model':db[_0x16e01c[_0xaf3c('0x23')]],'as':_0x16e01c['as'],'attributes':_0x16e01c[_0xaf3c('0x20')],'include':_0x16e01c[_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0x16e01c[_0xaf3c('0x21')],function(_0x257b54){return{'model':db[_0x257b54[_0xaf3c('0x23')]],'as':_0x257b54['as'],'attributes':_0x257b54[_0xaf3c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaf3c('0x11')](function(_0x6c63c4){logger[_0xaf3c('0x12')](_0xaf3c('0x24'),_0x46436a);logger[_0xaf3c('0x15')](_0xaf3c('0x24'),_0x46436a,JSON[_0xaf3c('0x17')](_0x6c63c4));_0x4d272e(_0x6c63c4);})[_0xaf3c('0x1a')](function(_0x3c7101){logger[_0xaf3c('0x18')](_0xaf3c('0x24'),_0x3c7101['message'],_0x46436a);_0x1b7918(_0x22d21f[_0xaf3c('0x18')](0x1f4,_0x3c7101['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a1de4af..a185e5b 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 _0x156a=['register','length','whatsappQueue:','remove','update','removeListener'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x156a,0xb7));var _0xa156=function(_0x280241,_0xbf1413){_0x280241=_0x280241-0x0;var _0x18ff79=_0x156a[_0x280241];return _0x18ff79;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xa156('0x0'),_0xa156('0x1')];function createListener(_0x50e2f5,_0x4b1150){return function(_0x1ad256){_0x4b1150['emit'](_0x50e2f5,_0x1ad256);};}function removeListener(_0xa816a3,_0x7abfd){return function(){WhatsappQueueEvents[_0xa156('0x2')](_0xa816a3,_0x7abfd);};}exports[_0xa156('0x3')]=function(_0x13fd24){for(var _0x5c673a=0x0,_0x1dba24=events[_0xa156('0x4')];_0x5c673a<_0x1dba24;_0x5c673a++){var _0x2707f0=events[_0x5c673a];var _0x2ebc21=createListener(_0xa156('0x5')+_0x2707f0,_0x13fd24);WhatsappQueueEvents['on'](_0x2707f0,_0x2ebc21);}}; \ No newline at end of file +var _0xc387=['length','save','update','emit','removeListener','register'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0xc387,0x139));var _0x7c38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc387[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x7c38('0x0'),'remove',_0x7c38('0x1')];function createListener(_0x4862c8,_0x4bd134){return function(_0xefe2fd){_0x4bd134[_0x7c38('0x2')](_0x4862c8,_0xefe2fd);};}function removeListener(_0x2bfe0f,_0x475838){return function(){WhatsappQueueEvents[_0x7c38('0x3')](_0x2bfe0f,_0x475838);};}exports[_0x7c38('0x4')]=function(_0x82f6b3){for(var _0x3804a6=0x0,_0x509024=events[_0x7c38('0x5')];_0x3804a6<_0x509024;_0x3804a6++){var _0x2384fd=events[_0x3804a6];var _0x5ac3fb=createListener('whatsappQueue:'+_0x2384fd,_0x82f6b3);WhatsappQueueEvents['on'](_0x2384fd,_0x5ac3fb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c20f638..499ed0e 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 _0x327f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x1bba09,_0x3b5dca){var _0x769d74=function(_0x2cc411){while(--_0x2cc411){_0x1bba09['push'](_0x1bba09['shift']());}};_0x769d74(++_0x3b5dca);}(_0x327f,0x18c));var _0xf327=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x327f[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xf327('0x0'));var util=require(_0xf327('0x1'));var path=require(_0xf327('0x2'));var timeout=require(_0xf327('0x3'));var express=require(_0xf327('0x4'));var router=express[_0xf327('0x5')]();var fs_extra=require(_0xf327('0x6'));var auth=require(_0xf327('0x7'));var interaction=require(_0xf327('0x8'));var config=require(_0xf327('0x9'));var controller=require(_0xf327('0xa'));router[_0xf327('0xb')]('/',auth[_0xf327('0xc')](),controller[_0xf327('0xd')]);router[_0xf327('0xb')](_0xf327('0xe'),auth[_0xf327('0xc')](),controller[_0xf327('0xf')]);router[_0xf327('0xb')](_0xf327('0x10'),auth[_0xf327('0xc')](),controller[_0xf327('0x11')]);router[_0xf327('0x12')]('/',auth[_0xf327('0xc')](),controller[_0xf327('0x13')]);router[_0xf327('0x14')]('/:id',auth[_0xf327('0xc')](),controller[_0xf327('0x15')]);router[_0xf327('0x16')](_0xf327('0x10'),auth[_0xf327('0xc')](),controller[_0xf327('0x17')]);module['exports']=router; \ No newline at end of file +var _0x76d3=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','index','get','isAuthenticated','describe','post','create','put','/:id','update','delete'];(function(_0x2d3b02,_0x54663b){var _0x49f7a0=function(_0x3b2ecb){while(--_0x3b2ecb){_0x2d3b02['push'](_0x2d3b02['shift']());}};_0x49f7a0(++_0x54663b);}(_0x76d3,0x66));var _0x376d=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x76d3[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x376d('0x0'));var path=require(_0x376d('0x1'));var timeout=require(_0x376d('0x2'));var express=require(_0x376d('0x3'));var router=express[_0x376d('0x4')]();var fs_extra=require(_0x376d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x376d('0x6'));var controller=require(_0x376d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x376d('0x8')]);router[_0x376d('0x9')]('/describe',auth[_0x376d('0xa')](),controller[_0x376d('0xb')]);router[_0x376d('0x9')]('/:id',auth[_0x376d('0xa')](),controller['show']);router[_0x376d('0xc')]('/',auth['isAuthenticated'](),controller[_0x376d('0xd')]);router[_0x376d('0xe')](_0x376d('0xf'),auth[_0x376d('0xa')](),controller[_0x376d('0x10')]);router[_0x376d('0x11')](_0x376d('0xf'),auth['isAuthenticated'](),controller[_0x376d('0x12')]);module[_0x376d('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 430b50f..45aedbc 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3009c0,_0x4f23b8){var _0x2de089=function(_0x304902){while(--_0x304902){_0x3009c0['push'](_0x3009c0['shift']());}};_0x2de089(++_0x4f23b8);}(_0x7a54,0x106));var _0x47a5=function(_0x131901,_0x311ffe){_0x131901=_0x131901-0x0;var _0x57afc9=_0x7a54[_0x131901];return _0x57afc9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x357ff3,_0xc093b8){var _0x4a2ea7=function(_0x2369b2){while(--_0x2369b2){_0x357ff3['push'](_0x357ff3['shift']());}};_0x4a2ea7(++_0xc093b8);}(_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 22e6254..e733736 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 _0x0abf=['intersection','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','include','findAll','catch','show','params'];(function(_0x20c1b8,_0x39e67c){var _0x58541f=function(_0x7c5cc8){while(--_0x7c5cc8){_0x20c1b8['push'](_0x20c1b8['shift']());}};_0x58541f(++_0x39e67c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){_0x36ad01['status'](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x4f0caf,_0x3eca32){return function(_0x16b979){if(!_0x16b979){_0x4f0caf['sendStatus'](0x194);}return _0x16b979;};}function handleError(_0x163078,_0x22671e){_0x22671e=_0x22671e||0x1f4;return function(_0x10bf5f){logger[_0xf0ab('0x26')](_0x10bf5f[_0xf0ab('0x27')]);if(_0x10bf5f['name']){delete _0x10bf5f[_0xf0ab('0x28')];}_0x163078['status'](_0x22671e)['send'](_0x10bf5f);};}exports[_0xf0ab('0x29')]=function(_0x4306c6,_0x1b223d){var _0x445160={},_0x43476c={},_0x174052={'count':0x0,'rows':[]};var _0x367302=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x21e8ac){return{'name':_0x21e8ac[_0xf0ab('0x2d')],'type':_0x21e8ac['type'][_0xf0ab('0x2e')]};});_0x43476c[_0xf0ab('0x2f')]=_['map'](_0x367302,'name');_0x43476c[_0xf0ab('0x30')]=_[_0xf0ab('0x31')](_0x4306c6[_0xf0ab('0x30')]);_0x43476c['filters']=_['intersection'](_0x43476c[_0xf0ab('0x2f')],_0x43476c['query']);_0x445160[_0xf0ab('0x32')]=_['intersection'](_0x43476c[_0xf0ab('0x2f')],qs[_0xf0ab('0x33')](_0x4306c6['query']['fields']));_0x445160[_0xf0ab('0x32')]=_0x445160[_0xf0ab('0x32')][_0xf0ab('0x34')]?_0x445160[_0xf0ab('0x32')]:_0x43476c[_0xf0ab('0x2f')];if(!_0x4306c6[_0xf0ab('0x30')][_0xf0ab('0x35')](_0xf0ab('0x36'))){_0x445160[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x4306c6[_0xf0ab('0x30')][_0xf0ab('0x1d')]);_0x445160[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x4306c6['query'][_0xf0ab('0x1b')]);}_0x445160[_0xf0ab('0x37')]=qs[_0xf0ab('0x38')](_0x4306c6['query'][_0xf0ab('0x38')]);_0x445160[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_['pick'](_0x4306c6[_0xf0ab('0x30')],_0x43476c['filters']),_0x367302);if(_0x4306c6[_0xf0ab('0x30')]['filter']){_0x445160[_0xf0ab('0x39')]=_[_0xf0ab('0x3b')](_0x445160[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x2a')](_0x367302,function(_0xcb0117){if(_0xcb0117[_0xf0ab('0x3c')]!=='VIRTUAL'){var _0x1adead={};_0x1adead[_0xcb0117[_0xf0ab('0x28')]]={'$like':'%'+_0x4306c6['query'][_0xf0ab('0x3d')]+'%'};return _0x1adead;}})});}_0x445160=_[_0xf0ab('0x3b')]({},_0x445160,_0x4306c6[_0xf0ab('0x3e')]);var _0x44988b={'where':_0x445160[_0xf0ab('0x39')]};return db[_0xf0ab('0x2b')][_0xf0ab('0x1e')](_0x44988b)['then'](function(_0x406a1d){_0x174052[_0xf0ab('0x1e')]=_0x406a1d;if(_0x4306c6[_0xf0ab('0x30')]['includeAll']){_0x445160[_0xf0ab('0x3f')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x40')](_0x445160);})[_0xf0ab('0x25')](function(_0x2b7ed5){_0x174052['rows']=_0x2b7ed5;return _0x174052;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x1b223d,_0x445160))[_0xf0ab('0x41')](handleError(_0x1b223d,null));};exports[_0xf0ab('0x42')]=function(_0x197955,_0x191caf){var _0x17a73={'raw':!![],'where':{'id':_0x197955[_0xf0ab('0x43')]['id']}},_0x45849c={};_0x45849c[_0xf0ab('0x2f')]=_[_0xf0ab('0x31')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x45849c[_0xf0ab('0x30')]=_['keys'](_0x197955['query']);_0x45849c[_0xf0ab('0x3a')]=_['intersection'](_0x45849c[_0xf0ab('0x2f')],_0x45849c[_0xf0ab('0x30')]);_0x17a73['attributes']=_[_0xf0ab('0x44')](_0x45849c[_0xf0ab('0x2f')],qs['fields'](_0x197955[_0xf0ab('0x30')][_0xf0ab('0x33')]));_0x17a73[_0xf0ab('0x32')]=_0x17a73[_0xf0ab('0x32')][_0xf0ab('0x34')]?_0x17a73[_0xf0ab('0x32')]:_0x45849c[_0xf0ab('0x2f')];if(_0x197955[_0xf0ab('0x30')][_0xf0ab('0x45')]){_0x17a73[_0xf0ab('0x3f')]=[{'all':!![]}];}_0x17a73=_[_0xf0ab('0x3b')]({},_0x17a73,_0x197955[_0xf0ab('0x3e')]);return db[_0xf0ab('0x2b')][_0xf0ab('0x46')](_0x17a73)['then'](handleEntityNotFound(_0x191caf,null))['then'](respondWithResult(_0x191caf,null))[_0xf0ab('0x41')](handleError(_0x191caf,null));};exports['create']=function(_0x4f6dd8,_0x4e57d3){return db[_0xf0ab('0x2b')][_0xf0ab('0x47')](_0x4f6dd8[_0xf0ab('0x48')],{})[_0xf0ab('0x25')](respondWithResult(_0x4e57d3,0xc9))[_0xf0ab('0x41')](handleError(_0x4e57d3,null));};exports[_0xf0ab('0x24')]=function(_0x472c1b,_0x1a0f21){if(_0x472c1b[_0xf0ab('0x48')]['id']){delete _0x472c1b[_0xf0ab('0x48')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x46')]({'where':{'id':_0x472c1b['params']['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x1a0f21,null))[_0xf0ab('0x25')](saveUpdates(_0x472c1b[_0xf0ab('0x48')],null))[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,null))[_0xf0ab('0x41')](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x49')]=function(_0x430921,_0x2e6c5e){return db['WhatsappQueueReport']['find']({'where':{'id':_0x430921['params']['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x2e6c5e,null))[_0xf0ab('0x25')](removeEntity(_0x2e6c5e,null))['catch'](handleError(_0x2e6c5e,null));};exports[_0xf0ab('0x4a')]=function(_0x22c7ae,_0x4edb01){return db[_0xf0ab('0x2b')][_0xf0ab('0x4a')]()[_0xf0ab('0x25')](respondWithResult(_0x4edb01,null))[_0xf0ab('0x41')](handleError(_0x4edb01,null));}; \ No newline at end of file +var _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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','undefined','set','apply','reject'];(function(_0x2c280a,_0x2105d2){var _0x48a760=function(_0x1bbd1d){while(--_0x1bbd1d){_0x2c280a['push'](_0x2c280a['shift']());}};_0x48a760(++_0x2105d2);}(_0x9348,0x10d));var _0x8934=function(_0x4f800e,_0x526855){_0x4f800e=_0x4f800e-0x0;var _0x3b6520=_0x9348[_0x4f800e];return _0x3b6520;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a91d9b3..8bb8196 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 _0x95d4=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1d0fa7,_0x1ad70f){var _0x5b2d91=function(_0x4ff922){while(--_0x4ff922){_0x1d0fa7['push'](_0x1d0fa7['shift']());}};_0x5b2d91(++_0x1ad70f);}(_0x95d4,0xbe));var _0x495d=function(_0x1198a7,_0x58ca47){_0x1198a7=_0x1198a7-0x0;var _0x34e937=_0x95d4[_0x1198a7];return _0x34e937;};'use strict';var _=require(_0x495d('0x0'));var util=require(_0x495d('0x1'));var logger=require(_0x495d('0x2'))(_0x495d('0x3'));var moment=require(_0x495d('0x4'));var BPromise=require(_0x495d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x495d('0x6'));var rimraf=require(_0x495d('0x7'));var config=require(_0x495d('0x8'));var attributes=require(_0x495d('0x9'));module['exports']=function(_0x5d74cd,_0x256b9b){return _0x5d74cd[_0x495d('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x495d('0xb'),'paranoid':![],'indexes':[{'name':_0x495d('0xc'),'fields':[_0x495d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd5f=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x23de5c,_0x87bd52){var _0x27413c=function(_0x5bba35){while(--_0x5bba35){_0x23de5c['push'](_0x23de5c['shift']());}};_0x27413c(++_0x87bd52);}(_0xcd5f,0x162));var _0xfcd5=function(_0x5bdaf0,_0x15b1a1){_0x5bdaf0=_0x5bdaf0-0x0;var _0x20e3e7=_0xcd5f[_0x5bdaf0];return _0x20e3e7;};'use strict';var _=require(_0xfcd5('0x0'));var util=require(_0xfcd5('0x1'));var logger=require('../../config/logger')(_0xfcd5('0x2'));var moment=require(_0xfcd5('0x3'));var BPromise=require(_0xfcd5('0x4'));var rp=require(_0xfcd5('0x5'));var fs=require('fs');var path=require(_0xfcd5('0x6'));var rimraf=require('rimraf');var config=require(_0xfcd5('0x7'));var attributes=require(_0xfcd5('0x8'));module[_0xfcd5('0x9')]=function(_0x465f13,_0x265c67){return _0x465f13[_0xfcd5('0xa')](_0xfcd5('0xb'),attributes,{'tableName':_0xfcd5('0xc'),'paranoid':![],'indexes':[{'name':_0xfcd5('0xd'),'fields':[_0xfcd5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index b48effb..0df343b 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 _0x3fce=['jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3fce,0xde));var _0xe3fc=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x3fce[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0xe3fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3fc('0x1'));var rs=require(_0xe3fc('0x2'));var fs=require('fs');var Redis=require(_0xe3fc('0x3'));var db=require(_0xe3fc('0x4'))['db'];var utils=require(_0xe3fc('0x5'));var logger=require(_0xe3fc('0x6'))(_0xe3fc('0x7'));var config=require(_0xe3fc('0x8'));var jayson=require(_0xe3fc('0x9'));var client=jayson[_0xe3fc('0xa')][_0xe3fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e090e,_0x21bad7,_0x15b073){return new BPromise(function(_0x578f76,_0x11c7d0){return client[_0xe3fc('0xc')](_0x1e090e,_0x15b073)[_0xe3fc('0xd')](function(_0x51922c){logger[_0xe3fc('0xe')](_0xe3fc('0xf'),_0x21bad7,'request\x20sent');logger[_0xe3fc('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x21bad7,_0xe3fc('0x11'),JSON['stringify'](_0x51922c));if(_0x51922c[_0xe3fc('0x12')]){if(_0x51922c[_0xe3fc('0x12')]['code']===0x1f4){logger['error'](_0xe3fc('0xf'),_0x21bad7,_0x51922c[_0xe3fc('0x12')][_0xe3fc('0x13')]);return _0x11c7d0(_0x51922c[_0xe3fc('0x12')][_0xe3fc('0x13')]);}logger[_0xe3fc('0x12')](_0xe3fc('0xf'),_0x21bad7,_0x51922c['error'][_0xe3fc('0x13')]);return _0x578f76(_0x51922c['error'][_0xe3fc('0x13')]);}else{logger['info'](_0xe3fc('0xf'),_0x21bad7,_0xe3fc('0x11'));_0x578f76(_0x51922c[_0xe3fc('0x14')][_0xe3fc('0x13')]);}})[_0xe3fc('0x15')](function(_0x1d17ba){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x21bad7,_0x1d17ba);_0x11c7d0(_0x1d17ba);});});}exports[_0xe3fc('0x16')]=function(_0x44e65f){var _0x16eecc=this;return new Promise(function(_0x7689c5,_0x324e16){return db['WhatsappQueueReport'][_0xe3fc('0x17')](_0x44e65f[_0xe3fc('0x18')],{'raw':_0x44e65f[_0xe3fc('0x19')]?_0x44e65f[_0xe3fc('0x19')][_0xe3fc('0x1a')]===undefined?!![]:![]:!![]})[_0xe3fc('0xd')](function(_0x275320){logger[_0xe3fc('0xe')]('CreateWhatsappQueueReport',_0x44e65f);logger[_0xe3fc('0x10')](_0xe3fc('0x16'),_0x44e65f,JSON[_0xe3fc('0x1b')](_0x275320));_0x7689c5(_0x275320);})[_0xe3fc('0x15')](function(_0xdd7a2c){logger[_0xe3fc('0x12')](_0xe3fc('0x16'),_0xdd7a2c[_0xe3fc('0x13')],_0x44e65f);_0x324e16(_0x16eecc[_0xe3fc('0x12')](0x1f4,_0xdd7a2c['message']));});});};exports[_0xe3fc('0x1c')]=function(_0x1ec355){var _0x5a81ef=this;return new Promise(function(_0x33a176,_0x4de311){return db['WhatsappQueueReport'][_0xe3fc('0x1d')](_0x1ec355[_0xe3fc('0x18')],{'raw':_0x1ec355['options']?_0x1ec355[_0xe3fc('0x19')][_0xe3fc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec355[_0xe3fc('0x19')]?_0x1ec355[_0xe3fc('0x19')][_0xe3fc('0x1e')]||null:null,'attributes':_0x1ec355['options']?_0x1ec355[_0xe3fc('0x19')][_0xe3fc('0x1f')]||null:null,'limit':_0x1ec355[_0xe3fc('0x19')]?_0x1ec355[_0xe3fc('0x19')][_0xe3fc('0x20')]||null:null})['then'](function(_0x55408b){logger[_0xe3fc('0xe')](_0xe3fc('0x1c'),_0x1ec355);logger['debug']('UpdateWhatsappQueueReport',_0x1ec355,JSON[_0xe3fc('0x1b')](_0x55408b));_0x33a176(_0x55408b);})[_0xe3fc('0x15')](function(_0x548e58){logger[_0xe3fc('0x12')](_0xe3fc('0x1c'),_0x548e58['message'],_0x1ec355);_0x4de311(_0x5a81ef['error'](0x1f4,_0x548e58['message']));});});}; \ No newline at end of file +var _0xcbdf=['WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','raw','limit','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2d4d6e,_0x35d715){var _0x30c329=function(_0x5928e8){while(--_0x5928e8){_0x2d4d6e['push'](_0x2d4d6e['shift']());}};_0x30c329(++_0x35d715);}(_0xcbdf,0x68));var _0xfcbd=function(_0x33bd92,_0x246002){_0x33bd92=_0x33bd92-0x0;var _0x53bb7a=_0xcbdf[_0x33bd92];return _0x53bb7a;};'use strict';var _=require('lodash');var util=require(_0xfcbd('0x0'));var moment=require(_0xfcbd('0x1'));var BPromise=require('bluebird');var rs=require(_0xfcbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcbd('0x3'))['db'];var utils=require(_0xfcbd('0x4'));var logger=require(_0xfcbd('0x5'))(_0xfcbd('0x6'));var config=require(_0xfcbd('0x7'));var jayson=require(_0xfcbd('0x8'));var client=jayson[_0xfcbd('0x9')][_0xfcbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fe19,_0x450792,_0x25ee66){return new BPromise(function(_0x5c6579,_0x541675){return client['request'](_0x11fe19,_0x25ee66)[_0xfcbd('0xb')](function(_0x638726){logger[_0xfcbd('0xc')](_0xfcbd('0xd'),_0x450792,_0xfcbd('0xe'));logger['debug'](_0xfcbd('0xf'),_0x450792,_0xfcbd('0xe'),JSON[_0xfcbd('0x10')](_0x638726));if(_0x638726['error']){if(_0x638726[_0xfcbd('0x11')]['code']===0x1f4){logger[_0xfcbd('0x11')](_0xfcbd('0xd'),_0x450792,_0x638726['error']['message']);return _0x541675(_0x638726[_0xfcbd('0x11')][_0xfcbd('0x12')]);}logger[_0xfcbd('0x11')](_0xfcbd('0xd'),_0x450792,_0x638726[_0xfcbd('0x11')][_0xfcbd('0x12')]);return _0x5c6579(_0x638726['error'][_0xfcbd('0x12')]);}else{logger['info'](_0xfcbd('0xd'),_0x450792,_0xfcbd('0xe'));_0x5c6579(_0x638726[_0xfcbd('0x13')][_0xfcbd('0x12')]);}})['catch'](function(_0x4a5c17){logger[_0xfcbd('0x11')](_0xfcbd('0xd'),_0x450792,_0x4a5c17);_0x541675(_0x4a5c17);});});}exports['CreateWhatsappQueueReport']=function(_0x2e9270){var _0x6aa44a=this;return new Promise(function(_0xf273a2,_0x5c253f){return db[_0xfcbd('0x14')][_0xfcbd('0x15')](_0x2e9270[_0xfcbd('0x16')],{'raw':_0x2e9270[_0xfcbd('0x17')]?_0x2e9270['options']['raw']===undefined?!![]:![]:!![]})[_0xfcbd('0xb')](function(_0xbb4fd1){logger[_0xfcbd('0xc')](_0xfcbd('0x18'),_0x2e9270);logger['debug'](_0xfcbd('0x18'),_0x2e9270,JSON[_0xfcbd('0x10')](_0xbb4fd1));_0xf273a2(_0xbb4fd1);})[_0xfcbd('0x19')](function(_0x24298d){logger[_0xfcbd('0x11')](_0xfcbd('0x18'),_0x24298d['message'],_0x2e9270);_0x5c253f(_0x6aa44a[_0xfcbd('0x11')](0x1f4,_0x24298d[_0xfcbd('0x12')]));});});};exports[_0xfcbd('0x1a')]=function(_0x4478eb){var _0x313b6d=this;return new Promise(function(_0x1a4be8,_0x1b8a61){return db[_0xfcbd('0x14')][_0xfcbd('0x1b')](_0x4478eb[_0xfcbd('0x16')],{'raw':_0x4478eb['options']?_0x4478eb[_0xfcbd('0x17')][_0xfcbd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4478eb[_0xfcbd('0x17')]?_0x4478eb[_0xfcbd('0x17')]['where']||null:null,'attributes':_0x4478eb[_0xfcbd('0x17')]?_0x4478eb[_0xfcbd('0x17')]['attributes']||null:null,'limit':_0x4478eb[_0xfcbd('0x17')]?_0x4478eb[_0xfcbd('0x17')][_0xfcbd('0x1d')]||null:null})[_0xfcbd('0xb')](function(_0x202bd6){logger[_0xfcbd('0xc')](_0xfcbd('0x1a'),_0x4478eb);logger[_0xfcbd('0x1e')](_0xfcbd('0x1a'),_0x4478eb,JSON[_0xfcbd('0x10')](_0x202bd6));_0x1a4be8(_0x202bd6);})[_0xfcbd('0x19')](function(_0x36476e){logger[_0xfcbd('0x11')](_0xfcbd('0x1a'),_0x36476e[_0xfcbd('0x12')],_0x4478eb);_0x1b8a61(_0x313b6d['error'](0x1f4,_0x36476e[_0xfcbd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 34e0a01..5ebcfe1 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 _0x21e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x594914,_0x4404c8){var _0x139a7c=function(_0x559324){while(--_0x559324){_0x594914['push'](_0x594914['shift']());}};_0x139a7c(++_0x4404c8);}(_0x21e6,0x154));var _0x621e=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x21e6[_0x229f5e];return _0x2d62ff;};'use strict';var multer=require(_0x621e('0x0'));var util=require('util');var path=require(_0x621e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x621e('0x2')]();var fs_extra=require(_0x621e('0x3'));var auth=require(_0x621e('0x4'));var interaction=require(_0x621e('0x5'));var config=require(_0x621e('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x621e('0x7')](),controller[_0x621e('0x8')]);router['get'](_0x621e('0x9'),auth[_0x621e('0x7')](),controller['describe']);router['get'](_0x621e('0xa'),auth[_0x621e('0x7')](),controller[_0x621e('0xb')]);router[_0x621e('0xc')]('/',auth[_0x621e('0x7')](),controller[_0x621e('0xd')]);router[_0x621e('0xe')](_0x621e('0xa'),auth[_0x621e('0x7')](),controller[_0x621e('0xf')]);router['delete'](_0x621e('0xa'),auth[_0x621e('0x7')](),controller[_0x621e('0x10')]);module[_0x621e('0x11')]=router; \ No newline at end of file +var _0x0430=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x35c899,_0x3c6df8){var _0x97627e=function(_0x38b28f){while(--_0x38b28f){_0x35c899['push'](_0x35c899['shift']());}};_0x97627e(++_0x3c6df8);}(_0x0430,0xa4));var _0x0043=function(_0x5b38ab,_0x34f642){_0x5b38ab=_0x5b38ab-0x0;var _0x26aca6=_0x0430[_0x5b38ab];return _0x26aca6;};'use strict';var multer=require(_0x0043('0x0'));var util=require(_0x0043('0x1'));var path=require(_0x0043('0x2'));var timeout=require(_0x0043('0x3'));var express=require(_0x0043('0x4'));var router=express[_0x0043('0x5')]();var fs_extra=require(_0x0043('0x6'));var auth=require(_0x0043('0x7'));var interaction=require(_0x0043('0x8'));var config=require(_0x0043('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0x0043('0xa')]('/',auth[_0x0043('0xb')](),controller[_0x0043('0xc')]);router['get'](_0x0043('0xd'),auth['isAuthenticated'](),controller[_0x0043('0xe')]);router[_0x0043('0xa')](_0x0043('0xf'),auth[_0x0043('0xb')](),controller[_0x0043('0x10')]);router[_0x0043('0x11')]('/',auth[_0x0043('0xb')](),controller['create']);router[_0x0043('0x12')](_0x0043('0xf'),auth[_0x0043('0xb')](),controller[_0x0043('0x13')]);router[_0x0043('0x14')](_0x0043('0xf'),auth['isAuthenticated'](),controller[_0x0043('0x15')]);module[_0x0043('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2d76240..a5a970b 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 _0xe61a=['sequelize','exports','ENUM','agent','queue','DATE'];(function(_0x1d46a6,_0x3ff83e){var _0x28c4f7=function(_0x16076f){while(--_0x16076f){_0x1d46a6['push'](_0x1d46a6['shift']());}};_0x28c4f7(++_0x3ff83e);}(_0xe61a,0x120));var _0xae61=function(_0x34fac4,_0x5c43c3){_0x34fac4=_0x34fac4-0x0;var _0x4ee329=_0xe61a[_0x34fac4];return _0x4ee329;};'use strict';var Sequelize=require(_0xae61('0x0'));module[_0xae61('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xae61('0x2')]('account',_0xae61('0x3'),_0xae61('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xae61('0x5')]}}; \ No newline at end of file +var _0xbc95=['sequelize','exports','STRING','ENUM','account'];(function(_0x959e8b,_0x33e2d7){var _0x2a2145=function(_0x28cb98){while(--_0x28cb98){_0x959e8b['push'](_0x959e8b['shift']());}};_0x2a2145(++_0x33e2d7);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x9b6f48,_0x583963){_0x9b6f48=_0x9b6f48-0x0;var _0x96a18d=_0xbc95[_0x9b6f48];return _0x96a18d;};'use strict';var Sequelize=require(_0x5bc9('0x0'));module[_0x5bc9('0x1')]={'uniqueid':{'type':Sequelize[_0x5bc9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bc9('0x3')](_0x5bc9('0x4'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8fd3c37..da554a7 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 _0xf8ea=['findAll','catch','params','include','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x36417b,_0xd3161f){var _0x2c0b6d=function(_0x28b31a){while(--_0x28b31a){_0x36417b['push'](_0x36417b['shift']());}};_0x2c0b6d(++_0xd3161f);}(_0xf8ea,0x1bf));var _0xaf8e=function(_0x193eb0,_0x9c21ba){_0x193eb0=_0x193eb0-0x0;var _0x5e6a4b=_0xf8ea[_0x193eb0];return _0x5e6a4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaf8e('0x0'));var jsonpatch=require(_0xaf8e('0x1'));var rp=require(_0xaf8e('0x2'));var moment=require('moment');var BPromise=require(_0xaf8e('0x3'));var Mustache=require('mustache');var util=require(_0xaf8e('0x4'));var path=require(_0xaf8e('0x5'));var sox=require(_0xaf8e('0x6'));var csv=require(_0xaf8e('0x7'));var ejs=require(_0xaf8e('0x8'));var fs=require('fs');var fs_extra=require(_0xaf8e('0x9'));var _=require(_0xaf8e('0xa'));var squel=require(_0xaf8e('0xb'));var crypto=require(_0xaf8e('0xc'));var jsforce=require(_0xaf8e('0xd'));var deskjs=require(_0xaf8e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf8e('0xf'));var Papa=require(_0xaf8e('0x10'));var Redis=require(_0xaf8e('0x11'));var authService=require(_0xaf8e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaf8e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf8e('0x14'));var utils=require(_0xaf8e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf8e('0x16'));var db=require(_0xaf8e('0x17'))['db'];function respondWithStatusCode(_0x4768d1,_0x20f462){_0x20f462=_0x20f462||0xcc;return function(_0x5eb9fa){if(_0x5eb9fa){return _0x4768d1[_0xaf8e('0x18')](_0x20f462);}return _0x4768d1['status'](_0x20f462)[_0xaf8e('0x19')]();};}function respondWithResult(_0x37bcca,_0x2af989){_0x2af989=_0x2af989||0xc8;return function(_0x12db5f){if(_0x12db5f){return _0x37bcca[_0xaf8e('0x1a')](_0x2af989)[_0xaf8e('0x1b')](_0x12db5f);}};}function respondWithFilteredResult(_0xd6e810,_0xc0297a){return function(_0x985bca){if(_0x985bca){var _0x1a54c4=typeof _0xc0297a['offset']==='undefined'&&typeof _0xc0297a[_0xaf8e('0x1c')]===_0xaf8e('0x1d');var _0xd857a2=_0x985bca[_0xaf8e('0x1e')];var _0x53325d=_0x1a54c4?0x0:_0xc0297a['offset'];var _0x5e5277=_0x1a54c4?_0x985bca[_0xaf8e('0x1e')]:_0xc0297a[_0xaf8e('0x1f')]+_0xc0297a[_0xaf8e('0x1c')];var _0x1a950a;if(_0x5e5277>=_0xd857a2){_0x5e5277=_0xd857a2;_0x1a950a=0xc8;}else{_0x1a950a=0xce;}_0xd6e810[_0xaf8e('0x1a')](_0x1a950a);return _0xd6e810[_0xaf8e('0x20')]('Content-Range',_0x53325d+'-'+_0x5e5277+'/'+_0xd857a2)[_0xaf8e('0x1b')](_0x985bca);}return null;};}function patchUpdates(_0x303d84){return function(_0x4b37c6){try{jsonpatch[_0xaf8e('0x21')](_0x4b37c6,_0x303d84,!![]);}catch(_0x22e9ff){return BPromise['reject'](_0x22e9ff);}return _0x4b37c6['save']();};}function saveUpdates(_0x786ffc,_0x333c29){return function(_0x3e6ee3){if(_0x3e6ee3){return _0x3e6ee3[_0xaf8e('0x22')](_0x786ffc)[_0xaf8e('0x23')](function(_0x4b0807){return _0x4b0807;});}return null;};}function removeEntity(_0x473aaf,_0xb9f891){return function(_0x351edc){if(_0x351edc){return _0x351edc[_0xaf8e('0x24')]()['then'](function(){_0x473aaf[_0xaf8e('0x1a')](0xcc)[_0xaf8e('0x19')]();});}};}function handleEntityNotFound(_0xfcd901,_0x169a7c){return function(_0x47cb96){if(!_0x47cb96){_0xfcd901[_0xaf8e('0x18')](0x194);}return _0x47cb96;};}function handleError(_0xe81a09,_0x3e9264){_0x3e9264=_0x3e9264||0x1f4;return function(_0x470a24){logger[_0xaf8e('0x25')](_0x470a24[_0xaf8e('0x26')]);if(_0x470a24[_0xaf8e('0x27')]){delete _0x470a24[_0xaf8e('0x27')];}_0xe81a09[_0xaf8e('0x1a')](_0x3e9264)[_0xaf8e('0x28')](_0x470a24);};}exports[_0xaf8e('0x29')]=function(_0x34dbc8,_0x36b369){var _0x277375={},_0x56b58b={},_0x210667={'count':0x0,'rows':[]};var _0x5d3330=_[_0xaf8e('0x2a')](db[_0xaf8e('0x2b')][_0xaf8e('0x2c')],function(_0x2e0d0f){return{'name':_0x2e0d0f[_0xaf8e('0x2d')],'type':_0x2e0d0f[_0xaf8e('0x2e')][_0xaf8e('0x2f')]};});_0x56b58b[_0xaf8e('0x30')]=_[_0xaf8e('0x2a')](_0x5d3330,'name');_0x56b58b['query']=_[_0xaf8e('0x31')](_0x34dbc8[_0xaf8e('0x32')]);_0x56b58b[_0xaf8e('0x33')]=_['intersection'](_0x56b58b['model'],_0x56b58b[_0xaf8e('0x32')]);_0x277375[_0xaf8e('0x34')]=_[_0xaf8e('0x35')](_0x56b58b[_0xaf8e('0x30')],qs[_0xaf8e('0x36')](_0x34dbc8[_0xaf8e('0x32')][_0xaf8e('0x36')]));_0x277375[_0xaf8e('0x34')]=_0x277375[_0xaf8e('0x34')][_0xaf8e('0x37')]?_0x277375[_0xaf8e('0x34')]:_0x56b58b['model'];if(!_0x34dbc8[_0xaf8e('0x32')]['hasOwnProperty'](_0xaf8e('0x38'))){_0x277375['limit']=qs[_0xaf8e('0x1c')](_0x34dbc8['query'][_0xaf8e('0x1c')]);_0x277375[_0xaf8e('0x1f')]=qs[_0xaf8e('0x1f')](_0x34dbc8[_0xaf8e('0x32')]['offset']);}_0x277375[_0xaf8e('0x39')]=qs[_0xaf8e('0x3a')](_0x34dbc8[_0xaf8e('0x32')][_0xaf8e('0x3a')]);_0x277375[_0xaf8e('0x3b')]=qs[_0xaf8e('0x33')](_['pick'](_0x34dbc8['query'],_0x56b58b['filters']),_0x5d3330);if(_0x34dbc8[_0xaf8e('0x32')]['filter']){_0x277375[_0xaf8e('0x3b')]=_[_0xaf8e('0x3c')](_0x277375['where'],{'$or':_[_0xaf8e('0x2a')](_0x5d3330,function(_0x3d61d1){if(_0x3d61d1[_0xaf8e('0x2e')]!==_0xaf8e('0x3d')){var _0x571116={};_0x571116[_0x3d61d1[_0xaf8e('0x27')]]={'$like':'%'+_0x34dbc8[_0xaf8e('0x32')][_0xaf8e('0x3e')]+'%'};return _0x571116;}})});}_0x277375=_['merge']({},_0x277375,_0x34dbc8['options']);var _0x2fbbb9={'where':_0x277375[_0xaf8e('0x3b')]};return db[_0xaf8e('0x2b')][_0xaf8e('0x1e')](_0x2fbbb9)['then'](function(_0x3a7578){_0x210667[_0xaf8e('0x1e')]=_0x3a7578;if(_0x34dbc8[_0xaf8e('0x32')][_0xaf8e('0x3f')]){_0x277375['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xaf8e('0x40')](_0x277375);})['then'](function(_0x38ed81){_0x210667['rows']=_0x38ed81;return _0x210667;})[_0xaf8e('0x23')](respondWithFilteredResult(_0x36b369,_0x277375))[_0xaf8e('0x41')](handleError(_0x36b369,null));};exports['show']=function(_0x4ce866,_0x8c76cd){var _0x424b1b={'raw':!![],'where':{'id':_0x4ce866[_0xaf8e('0x42')]['id']}},_0x118a37={};_0x118a37[_0xaf8e('0x30')]=_['keys'](db[_0xaf8e('0x2b')][_0xaf8e('0x2c')]);_0x118a37[_0xaf8e('0x32')]=_[_0xaf8e('0x31')](_0x4ce866[_0xaf8e('0x32')]);_0x118a37[_0xaf8e('0x33')]=_[_0xaf8e('0x35')](_0x118a37['model'],_0x118a37[_0xaf8e('0x32')]);_0x424b1b[_0xaf8e('0x34')]=_[_0xaf8e('0x35')](_0x118a37[_0xaf8e('0x30')],qs[_0xaf8e('0x36')](_0x4ce866[_0xaf8e('0x32')][_0xaf8e('0x36')]));_0x424b1b['attributes']=_0x424b1b[_0xaf8e('0x34')][_0xaf8e('0x37')]?_0x424b1b[_0xaf8e('0x34')]:_0x118a37[_0xaf8e('0x30')];if(_0x4ce866['query']['includeAll']){_0x424b1b[_0xaf8e('0x43')]=[{'all':!![]}];}_0x424b1b=_[_0xaf8e('0x3c')]({},_0x424b1b,_0x4ce866[_0xaf8e('0x44')]);return db[_0xaf8e('0x2b')][_0xaf8e('0x45')](_0x424b1b)[_0xaf8e('0x23')](handleEntityNotFound(_0x8c76cd,null))[_0xaf8e('0x23')](respondWithResult(_0x8c76cd,null))[_0xaf8e('0x41')](handleError(_0x8c76cd,null));};exports[_0xaf8e('0x46')]=function(_0x37a312,_0x826988){return db['WhatsappTransferReport'][_0xaf8e('0x46')](_0x37a312[_0xaf8e('0x47')],{})[_0xaf8e('0x23')](respondWithResult(_0x826988,0xc9))[_0xaf8e('0x41')](handleError(_0x826988,null));};exports[_0xaf8e('0x22')]=function(_0x47c16e,_0x97af22){if(_0x47c16e[_0xaf8e('0x47')]['id']){delete _0x47c16e['body']['id'];}return db[_0xaf8e('0x2b')]['find']({'where':{'id':_0x47c16e[_0xaf8e('0x42')]['id']}})[_0xaf8e('0x23')](handleEntityNotFound(_0x97af22,null))['then'](saveUpdates(_0x47c16e[_0xaf8e('0x47')],null))['then'](respondWithResult(_0x97af22,null))[_0xaf8e('0x41')](handleError(_0x97af22,null));};exports[_0xaf8e('0x24')]=function(_0x55b666,_0x12ab67){return db[_0xaf8e('0x2b')]['find']({'where':{'id':_0x55b666[_0xaf8e('0x42')]['id']}})[_0xaf8e('0x23')](handleEntityNotFound(_0x12ab67,null))['then'](removeEntity(_0x12ab67,null))[_0xaf8e('0x41')](handleError(_0x12ab67,null));};exports[_0xaf8e('0x48')]=function(_0xecab71,_0x48517b){return db[_0xaf8e('0x2b')][_0xaf8e('0x48')]()[_0xaf8e('0x23')](respondWithResult(_0x48517b,null))['catch'](handleError(_0x48517b,null));}; \ No newline at end of file +var _0x092f=['catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x3d71ea,_0x292819){var _0x2d5a84=function(_0xdf7806){while(--_0xdf7806){_0x3d71ea['push'](_0x3d71ea['shift']());}};_0x2d5a84(++_0x292819);}(_0x092f,0x1dc));var _0xf092=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x092f[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xf092('0x0'));var rimraf=require(_0xf092('0x1'));var zipdir=require(_0xf092('0x2'));var jsonpatch=require(_0xf092('0x3'));var rp=require(_0xf092('0x4'));var moment=require('moment');var BPromise=require(_0xf092('0x5'));var Mustache=require(_0xf092('0x6'));var util=require(_0xf092('0x7'));var path=require('path');var sox=require(_0xf092('0x8'));var csv=require('to-csv');var ejs=require(_0xf092('0x9'));var fs=require('fs');var fs_extra=require(_0xf092('0xa'));var _=require('lodash');var squel=require(_0xf092('0xb'));var crypto=require('crypto');var jsforce=require(_0xf092('0xc'));var deskjs=require(_0xf092('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf092('0xe'));var Papa=require(_0xf092('0xf'));var Redis=require('ioredis');var authService=require(_0xf092('0x10'));var qs=require(_0xf092('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf092('0x12'));var logger=require(_0xf092('0x13'))(_0xf092('0x14'));var utils=require(_0xf092('0x15'));var config=require(_0xf092('0x16'));var licenseUtil=require(_0xf092('0x17'));var db=require(_0xf092('0x18'))['db'];function respondWithStatusCode(_0x4c6fc5,_0x11ed85){_0x11ed85=_0x11ed85||0xcc;return function(_0x147dbe){if(_0x147dbe){return _0x4c6fc5[_0xf092('0x19')](_0x11ed85);}return _0x4c6fc5[_0xf092('0x1a')](_0x11ed85)['end']();};}function respondWithResult(_0x2fb9b,_0x341576){_0x341576=_0x341576||0xc8;return function(_0x4246f){if(_0x4246f){return _0x2fb9b[_0xf092('0x1a')](_0x341576)['json'](_0x4246f);}};}function respondWithFilteredResult(_0x5237a9,_0x17c102){return function(_0x4738c3){if(_0x4738c3){var _0x23df5d=typeof _0x17c102[_0xf092('0x1b')]===_0xf092('0x1c')&&typeof _0x17c102['limit']==='undefined';var _0x5736c5=_0x4738c3[_0xf092('0x1d')];var _0x2edb55=_0x23df5d?0x0:_0x17c102['offset'];var _0x1e94e7=_0x23df5d?_0x4738c3[_0xf092('0x1d')]:_0x17c102[_0xf092('0x1b')]+_0x17c102[_0xf092('0x1e')];var _0x2ff644;if(_0x1e94e7>=_0x5736c5){_0x1e94e7=_0x5736c5;_0x2ff644=0xc8;}else{_0x2ff644=0xce;}_0x5237a9[_0xf092('0x1a')](_0x2ff644);return _0x5237a9[_0xf092('0x1f')](_0xf092('0x20'),_0x2edb55+'-'+_0x1e94e7+'/'+_0x5736c5)[_0xf092('0x21')](_0x4738c3);}return null;};}function patchUpdates(_0x203ca6){return function(_0x424e5d){try{jsonpatch[_0xf092('0x22')](_0x424e5d,_0x203ca6,!![]);}catch(_0x6eb349){return BPromise[_0xf092('0x23')](_0x6eb349);}return _0x424e5d[_0xf092('0x24')]();};}function saveUpdates(_0x4462b1,_0x2aebfa){return function(_0x42062b){if(_0x42062b){return _0x42062b['update'](_0x4462b1)[_0xf092('0x25')](function(_0x219c86){return _0x219c86;});}return null;};}function removeEntity(_0x54d79a,_0x53f407){return function(_0x5ac7d2){if(_0x5ac7d2){return _0x5ac7d2[_0xf092('0x26')]()[_0xf092('0x25')](function(){_0x54d79a[_0xf092('0x1a')](0xcc)[_0xf092('0x27')]();});}};}function handleEntityNotFound(_0x5ee9ce,_0x2c4bfe){return function(_0x2573aa){if(!_0x2573aa){_0x5ee9ce['sendStatus'](0x194);}return _0x2573aa;};}function handleError(_0x3a120b,_0x5a0cdb){_0x5a0cdb=_0x5a0cdb||0x1f4;return function(_0x17db4f){logger[_0xf092('0x28')](_0x17db4f[_0xf092('0x29')]);if(_0x17db4f[_0xf092('0x2a')]){delete _0x17db4f[_0xf092('0x2a')];}_0x3a120b[_0xf092('0x1a')](_0x5a0cdb)[_0xf092('0x2b')](_0x17db4f);};}exports[_0xf092('0x2c')]=function(_0x4fa693,_0x5c9477){var _0x3f55c3={},_0x3f81d8={},_0x56bb4a={'count':0x0,'rows':[]};var _0x1e54b1=_['map'](db[_0xf092('0x2d')][_0xf092('0x2e')],function(_0x44fee2){return{'name':_0x44fee2[_0xf092('0x2f')],'type':_0x44fee2[_0xf092('0x30')][_0xf092('0x31')]};});_0x3f81d8[_0xf092('0x32')]=_[_0xf092('0x33')](_0x1e54b1,_0xf092('0x2a'));_0x3f81d8[_0xf092('0x34')]=_['keys'](_0x4fa693[_0xf092('0x34')]);_0x3f81d8[_0xf092('0x35')]=_[_0xf092('0x36')](_0x3f81d8[_0xf092('0x32')],_0x3f81d8[_0xf092('0x34')]);_0x3f55c3['attributes']=_[_0xf092('0x36')](_0x3f81d8[_0xf092('0x32')],qs[_0xf092('0x37')](_0x4fa693[_0xf092('0x34')][_0xf092('0x37')]));_0x3f55c3[_0xf092('0x38')]=_0x3f55c3[_0xf092('0x38')][_0xf092('0x39')]?_0x3f55c3[_0xf092('0x38')]:_0x3f81d8[_0xf092('0x32')];if(!_0x4fa693[_0xf092('0x34')][_0xf092('0x3a')]('nolimit')){_0x3f55c3[_0xf092('0x1e')]=qs[_0xf092('0x1e')](_0x4fa693[_0xf092('0x34')][_0xf092('0x1e')]);_0x3f55c3[_0xf092('0x1b')]=qs['offset'](_0x4fa693[_0xf092('0x34')][_0xf092('0x1b')]);}_0x3f55c3[_0xf092('0x3b')]=qs[_0xf092('0x3c')](_0x4fa693[_0xf092('0x34')][_0xf092('0x3c')]);_0x3f55c3[_0xf092('0x3d')]=qs[_0xf092('0x35')](_[_0xf092('0x3e')](_0x4fa693[_0xf092('0x34')],_0x3f81d8['filters']),_0x1e54b1);if(_0x4fa693[_0xf092('0x34')]['filter']){_0x3f55c3[_0xf092('0x3d')]=_[_0xf092('0x3f')](_0x3f55c3[_0xf092('0x3d')],{'$or':_['map'](_0x1e54b1,function(_0x6ca991){if(_0x6ca991[_0xf092('0x30')]!==_0xf092('0x40')){var _0x4fe7ea={};_0x4fe7ea[_0x6ca991[_0xf092('0x2a')]]={'$like':'%'+_0x4fa693['query'][_0xf092('0x41')]+'%'};return _0x4fe7ea;}})});}_0x3f55c3=_['merge']({},_0x3f55c3,_0x4fa693[_0xf092('0x42')]);var _0x404a0f={'where':_0x3f55c3[_0xf092('0x3d')]};return db['WhatsappTransferReport']['count'](_0x404a0f)[_0xf092('0x25')](function(_0x4300de){_0x56bb4a[_0xf092('0x1d')]=_0x4300de;if(_0x4fa693[_0xf092('0x34')][_0xf092('0x43')]){_0x3f55c3[_0xf092('0x44')]=[{'all':!![]}];}return db[_0xf092('0x2d')]['findAll'](_0x3f55c3);})[_0xf092('0x25')](function(_0x640708){_0x56bb4a[_0xf092('0x45')]=_0x640708;return _0x56bb4a;})[_0xf092('0x25')](respondWithFilteredResult(_0x5c9477,_0x3f55c3))[_0xf092('0x46')](handleError(_0x5c9477,null));};exports[_0xf092('0x47')]=function(_0x17bea2,_0x7613bc){var _0xeb25ff={'raw':!![],'where':{'id':_0x17bea2[_0xf092('0x48')]['id']}},_0x4ed70e={};_0x4ed70e[_0xf092('0x32')]=_['keys'](db[_0xf092('0x2d')]['rawAttributes']);_0x4ed70e[_0xf092('0x34')]=_['keys'](_0x17bea2[_0xf092('0x34')]);_0x4ed70e['filters']=_[_0xf092('0x36')](_0x4ed70e[_0xf092('0x32')],_0x4ed70e[_0xf092('0x34')]);_0xeb25ff[_0xf092('0x38')]=_[_0xf092('0x36')](_0x4ed70e[_0xf092('0x32')],qs[_0xf092('0x37')](_0x17bea2['query']['fields']));_0xeb25ff[_0xf092('0x38')]=_0xeb25ff[_0xf092('0x38')][_0xf092('0x39')]?_0xeb25ff[_0xf092('0x38')]:_0x4ed70e['model'];if(_0x17bea2['query'][_0xf092('0x43')]){_0xeb25ff[_0xf092('0x44')]=[{'all':!![]}];}_0xeb25ff=_[_0xf092('0x3f')]({},_0xeb25ff,_0x17bea2['options']);return db[_0xf092('0x2d')][_0xf092('0x49')](_0xeb25ff)[_0xf092('0x25')](handleEntityNotFound(_0x7613bc,null))[_0xf092('0x25')](respondWithResult(_0x7613bc,null))[_0xf092('0x46')](handleError(_0x7613bc,null));};exports[_0xf092('0x4a')]=function(_0x55eefe,_0x13e273){return db[_0xf092('0x2d')][_0xf092('0x4a')](_0x55eefe['body'],{})[_0xf092('0x25')](respondWithResult(_0x13e273,0xc9))[_0xf092('0x46')](handleError(_0x13e273,null));};exports[_0xf092('0x4b')]=function(_0x5ce82f,_0x5d8682){if(_0x5ce82f[_0xf092('0x4c')]['id']){delete _0x5ce82f[_0xf092('0x4c')]['id'];}return db[_0xf092('0x2d')][_0xf092('0x49')]({'where':{'id':_0x5ce82f[_0xf092('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d8682,null))[_0xf092('0x25')](saveUpdates(_0x5ce82f[_0xf092('0x4c')],null))[_0xf092('0x25')](respondWithResult(_0x5d8682,null))[_0xf092('0x46')](handleError(_0x5d8682,null));};exports[_0xf092('0x26')]=function(_0x3c6062,_0x6c3161){return db['WhatsappTransferReport']['find']({'where':{'id':_0x3c6062['params']['id']}})[_0xf092('0x25')](handleEntityNotFound(_0x6c3161,null))['then'](removeEntity(_0x6c3161,null))[_0xf092('0x46')](handleError(_0x6c3161,null));};exports[_0xf092('0x4d')]=function(_0x389295,_0x577d94){return db[_0xf092('0x2d')][_0xf092('0x4d')]()[_0xf092('0x25')](respondWithResult(_0x577d94,null))[_0xf092('0x46')](handleError(_0x577d94,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a965203..af10556 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 _0xc9ff=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util'];(function(_0x111605,_0x4ddc0b){var _0x335f67=function(_0x1c72b9){while(--_0x1c72b9){_0x111605['push'](_0x111605['shift']());}};_0x335f67(++_0x4ddc0b);}(_0xc9ff,0x1ed));var _0xfc9f=function(_0x31e3da,_0x1721a8){_0x31e3da=_0x31e3da-0x0;var _0x3a420a=_0xc9ff[_0x31e3da];return _0x3a420a;};'use strict';var _=require('lodash');var util=require(_0xfc9f('0x0'));var logger=require(_0xfc9f('0x1'))(_0xfc9f('0x2'));var moment=require(_0xfc9f('0x3'));var BPromise=require(_0xfc9f('0x4'));var rp=require(_0xfc9f('0x5'));var fs=require('fs');var path=require(_0xfc9f('0x6'));var rimraf=require(_0xfc9f('0x7'));var config=require(_0xfc9f('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x18adc9,_0x4ee8c2){return _0x18adc9[_0xfc9f('0x9')](_0xfc9f('0xa'),attributes,{'tableName':_0xfc9f('0xb'),'paranoid':![],'indexes':[{'name':_0xfc9f('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x852b=['api','moment','bluebird','request-promise','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x360f4a,_0x225a9c){var _0x61dbf5=function(_0x44bf5e){while(--_0x44bf5e){_0x360f4a['push'](_0x360f4a['shift']());}};_0x61dbf5(++_0x225a9c);}(_0x852b,0x1c4));var _0xb852=function(_0x36d95b,_0xf41d69){_0x36d95b=_0x36d95b-0x0;var _0x1bd582=_0x852b[_0x36d95b];return _0x1bd582;};'use strict';var _=require(_0xb852('0x0'));var util=require(_0xb852('0x1'));var logger=require(_0xb852('0x2'))(_0xb852('0x3'));var moment=require(_0xb852('0x4'));var BPromise=require(_0xb852('0x5'));var rp=require(_0xb852('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb852('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xb852('0x8')]=function(_0x5e72e1,_0x405004){return _0x5e72e1[_0xb852('0x9')](_0xb852('0xa'),attributes,{'tableName':_0xb852('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb852('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cc8ca7d..0f920fb 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 _0xb83b=['../../config/logger','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5dfb47,_0x5b158c){var _0x48c85a=function(_0x5d9ccf){while(--_0x5d9ccf){_0x5dfb47['push'](_0x5dfb47['shift']());}};_0x48c85a(++_0x5b158c);}(_0xb83b,0x163));var _0xbb83=function(_0x28b193,_0x2175ec){_0x28b193=_0x28b193-0x0;var _0x528352=_0xb83b[_0x28b193];return _0x528352;};'use strict';var _=require('lodash');var util=require(_0xbb83('0x0'));var moment=require(_0xbb83('0x1'));var BPromise=require(_0xbb83('0x2'));var rs=require(_0xbb83('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb83('0x4'))['db'];var utils=require(_0xbb83('0x5'));var logger=require(_0xbb83('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbb83('0x7'));var client=jayson[_0xbb83('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8de3,_0x11d7c2,_0x3ff76b){return new BPromise(function(_0x192237,_0x398789){return client['request'](_0x3f8de3,_0x3ff76b)[_0xbb83('0x9')](function(_0x2b21e0){logger[_0xbb83('0xa')](_0xbb83('0xb'),_0x11d7c2,'request\x20sent');logger['debug'](_0xbb83('0xc'),_0x11d7c2,_0xbb83('0xd'),JSON[_0xbb83('0xe')](_0x2b21e0));if(_0x2b21e0[_0xbb83('0xf')]){if(_0x2b21e0[_0xbb83('0xf')]['code']===0x1f4){logger[_0xbb83('0xf')](_0xbb83('0xb'),_0x11d7c2,_0x2b21e0[_0xbb83('0xf')][_0xbb83('0x10')]);return _0x398789(_0x2b21e0[_0xbb83('0xf')][_0xbb83('0x10')]);}logger['error'](_0xbb83('0xb'),_0x11d7c2,_0x2b21e0['error']['message']);return _0x192237(_0x2b21e0[_0xbb83('0xf')]['message']);}else{logger['info'](_0xbb83('0xb'),_0x11d7c2,_0xbb83('0xd'));_0x192237(_0x2b21e0[_0xbb83('0x11')][_0xbb83('0x10')]);}})[_0xbb83('0x12')](function(_0x23b992){logger[_0xbb83('0xf')](_0xbb83('0xb'),_0x11d7c2,_0x23b992);_0x398789(_0x23b992);});});} \ No newline at end of file +var _0xc90d=['request\x20sent','debug','WhatsappTransferReport,\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','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xc90d,0x134));var _0xdc90=function(_0x221a0f,_0x3970f6){_0x221a0f=_0x221a0f-0x0;var _0x30309e=_0xc90d[_0x221a0f];return _0x30309e;};'use strict';var _=require(_0xdc90('0x0'));var util=require(_0xdc90('0x1'));var moment=require(_0xdc90('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc90('0x3'));var fs=require('fs');var Redis=require(_0xdc90('0x4'));var db=require(_0xdc90('0x5'))['db'];var utils=require(_0xdc90('0x6'));var logger=require(_0xdc90('0x7'))(_0xdc90('0x8'));var config=require(_0xdc90('0x9'));var jayson=require(_0xdc90('0xa'));var client=jayson[_0xdc90('0xb')][_0xdc90('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x272a9f,_0x467ab8,_0x3715dc){return new BPromise(function(_0x8ad609,_0xfdbef1){return client[_0xdc90('0xd')](_0x272a9f,_0x3715dc)[_0xdc90('0xe')](function(_0x353218){logger[_0xdc90('0xf')](_0xdc90('0x10'),_0x467ab8,_0xdc90('0x11'));logger[_0xdc90('0x12')](_0xdc90('0x13'),_0x467ab8,'request\x20sent',JSON['stringify'](_0x353218));if(_0x353218[_0xdc90('0x14')]){if(_0x353218[_0xdc90('0x14')][_0xdc90('0x15')]===0x1f4){logger[_0xdc90('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x467ab8,_0x353218['error'][_0xdc90('0x16')]);return _0xfdbef1(_0x353218['error'][_0xdc90('0x16')]);}logger[_0xdc90('0x14')](_0xdc90('0x10'),_0x467ab8,_0x353218[_0xdc90('0x14')][_0xdc90('0x16')]);return _0x8ad609(_0x353218[_0xdc90('0x14')][_0xdc90('0x16')]);}else{logger['info'](_0xdc90('0x10'),_0x467ab8,_0xdc90('0x11'));_0x8ad609(_0x353218[_0xdc90('0x17')][_0xdc90('0x16')]);}})[_0xdc90('0x18')](function(_0x5cc492){logger[_0xdc90('0x14')](_0xdc90('0x10'),_0x467ab8,_0x5cc492);_0xfdbef1(_0x5cc492);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c7d2a7d..84b6d35 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x550b=['then','info','start','Online\x20apps:','map','filter','name','status','online','join','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen'];(function(_0x45c337,_0x193e93){var _0x5ca5e0=function(_0x2cd229){while(--_0x2cd229){_0x45c337['push'](_0x45c337['shift']());}};_0x5ca5e0(++_0x193e93);}(_0x550b,0x70));var _0xb550=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x550b[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0xb550('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xb550('0x1'));var config=require('./config/environment');var logger=require(_0xb550('0x2'))(_0xb550('0x3'));var pm2=require(_0xb550('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb550('0x5'));var chat=require(_0xb550('0x6'));var whatsapp=require(_0xb550('0x7'));var transcribe=require(_0xb550('0x8'));function main(){return mysqldb['db'][_0xb550('0x9')][_0xb550('0xa')]()['then'](function(){return rpc[_0xb550('0xb')]();})[_0xb550('0xc')](function(_0x12ae65){logger[_0xb550('0xd')](_0x12ae65);return chat[_0xb550('0xe')]();})[_0xb550('0xc')](function(){return whatsapp[_0xb550('0xe')]();})[_0xb550('0xc')](function(){return schedule[_0xb550('0xe')]();})[_0xb550('0xc')](function(){return transcribe['start']();})[_0xb550('0xc')](function(_0x1bf0a6){logger[_0xb550('0xd')](_0x1bf0a6);return pm2[_0xb550('0xe')](pm2Config);})[_0xb550('0xc')](function(_0x90d6d){logger[_0xb550('0xd')](_0xb550('0xf'),_[_0xb550('0x10')](_[_0xb550('0x11')](_0x90d6d,{'status':'online'}),_0xb550('0x12'))['join']());logger['info']('Offline\x20apps:',_[_0xb550('0x10')](_['filter'](_0x90d6d,function(_0x433872){return _0x433872[_0xb550('0x13')]!==_0xb550('0x14');}),'name')[_0xb550('0x15')]()||_0xb550('0x16'));config[_0xb550('0x17')]&&require(_0xb550('0x18'))[_0xb550('0x19')]();require(_0xb550('0x1a'))[_0xb550('0x19')]();})[_0xb550('0x1b')](function(_0x486843){logger[_0xb550('0x1c')](_0xb550('0x1d'),_0x486843);process[_0xb550('0x1e')](0x1);});}main(); \ No newline at end of file +var _0xc5eb=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','info','start','Online\x20apps:','online','join','map','status','None','seedDB','./config/seedDB','default','./config/license','catch'];(function(_0x403a1c,_0x3ba1ce){var _0x3f1045=function(_0x24e33c){while(--_0x24e33c){_0x403a1c['push'](_0x403a1c['shift']());}};_0x3f1045(++_0x3ba1ce);}(_0xc5eb,0x106));var _0xbc5e=function(_0x557cf8,_0x293a71){_0x557cf8=_0x557cf8-0x0;var _0x5a10bf=_0xc5eb[_0x557cf8];return _0x5a10bf;};'use strict';var _=require(_0xbc5e('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xbc5e('0x1'));var logger=require(_0xbc5e('0x2'))(_0xbc5e('0x3'));var pm2=require(_0xbc5e('0x4'));var pm2Config=require(_0xbc5e('0x5'));var schedule=require('./config/schedule');var chat=require(_0xbc5e('0x6'));var whatsapp=require(_0xbc5e('0x7'));var transcribe=require(_0xbc5e('0x8'));function main(){return mysqldb['db']['sequelize'][_0xbc5e('0x9')]()[_0xbc5e('0xa')](function(){return rpc['listen']();})[_0xbc5e('0xa')](function(_0x1d95db){logger[_0xbc5e('0xb')](_0x1d95db);return chat['start']();})['then'](function(){return whatsapp[_0xbc5e('0xc')]();})[_0xbc5e('0xa')](function(){return schedule['start']();})[_0xbc5e('0xa')](function(){return transcribe[_0xbc5e('0xc')]();})[_0xbc5e('0xa')](function(_0x274f41){logger[_0xbc5e('0xb')](_0x274f41);return pm2[_0xbc5e('0xc')](pm2Config);})[_0xbc5e('0xa')](function(_0x38e22c){logger[_0xbc5e('0xb')](_0xbc5e('0xd'),_['map'](_['filter'](_0x38e22c,{'status':_0xbc5e('0xe')}),'name')[_0xbc5e('0xf')]());logger[_0xbc5e('0xb')]('Offline\x20apps:',_[_0xbc5e('0x10')](_['filter'](_0x38e22c,function(_0x550157){return _0x550157[_0xbc5e('0x11')]!==_0xbc5e('0xe');}),'name')['join']()||_0xbc5e('0x12'));config[_0xbc5e('0x13')]&&require(_0xbc5e('0x14'))[_0xbc5e('0x15')]();require(_0xbc5e('0x16'))['default']();})[_0xbc5e('0x17')](function(_0x4391a9){logger['error'](_0xbc5e('0x18'),_0x4391a9);process[_0xbc5e('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 25a2f72..27e5fab 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 _0xd933=['downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','Basic','find','authenticate','status','Wrong\x20credentials.','user','Bearer','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','splice','unshift','encryptString','options','promisify','verify','toString','hex','floor','now','HS512','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','name','internal','email','userpic','permissions','md5secret','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd933,0xd9));var _0x3d93=function(_0x6c15ed,_0x44e928){_0x6c15ed=_0x6c15ed-0x0;var _0x493003=_0xd933[_0x6c15ed];return _0x493003;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x3d93('0x0'));var encryptor=require(_0x3d93('0x1'));var _=require(_0x3d93('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x3d93('0x3'));var compose=require(_0x3d93('0x4'));var basicAuth=require(_0x3d93('0x5'));var crypto=require(_0x3d93('0x6'));var BPromise=require(_0x3d93('0x7'));var util=require(_0x3d93('0x8'));var moment=require(_0x3d93('0x9'));var validateJwt=expressJwt({'secret':config[_0x3d93('0xa')][_0x3d93('0xb')]});var userAttributes=['id','role','fullname',_0x3d93('0xc'),_0x3d93('0xd'),_0x3d93('0xe'),_0x3d93('0xf'),_0x3d93('0x10'),_0x3d93('0x11'),'voicePause','chatPause',_0x3d93('0x12'),_0x3d93('0x13'),'smsPause',_0x3d93('0x14'),_0x3d93('0x15'),_0x3d93('0x16'),_0x3d93('0x17'),_0x3d93('0x18'),_0x3d93('0x19'),_0x3d93('0x1a'),_0x3d93('0x1b'),_0x3d93('0x1c'),_0x3d93('0x1d'),_0x3d93('0x1e'),_0x3d93('0x1f'),_0x3d93('0x20'),_0x3d93('0x21'),_0x3d93('0x22'),_0x3d93('0x23'),_0x3d93('0x24'),_0x3d93('0x25'),'phoneBarRemoteControlPort',_0x3d93('0x26'),_0x3d93('0x27'),'userProfileId',_0x3d93('0x28'),_0x3d93('0x29'),_0x3d93('0x2a'),_0x3d93('0x2b'),_0x3d93('0x2c'),'downloadAttachments',_0x3d93('0x2d'),_0x3d93('0x2e')];exports[_0x3d93('0x2f')]=function(){return this[_0x3d93('0x30')](!![])[_0x3d93('0x31')](function(_0x3a8348,_0x1f9fa8,_0x9835b){if(_0x3a8348['user']){_0x9835b();}else{return db[_0x3d93('0x32')][_0x3d93('0x33')]({'where':{'id':_0x3a8348[_0x3d93('0x34')]['id']},'attributes':['id',_0x3d93('0x35'),_0x3d93('0x36')],'raw':!![]})[_0x3d93('0x37')](function(_0x2428f8){if(_0x2428f8&&_0x2428f8[_0x3d93('0x35')]){return _0x1f9fa8['status'](_0x2428f8[_0x3d93('0x36')]===_0x3d93('0x38')?0x195:0x193)[_0x3d93('0x39')]({'message':_0x2428f8[_0x3d93('0x36')]===_0x3d93('0x38')?_0x3d93('0x3a'):_0x3d93('0x3b')});}else{_0x9835b();}})[_0x3d93('0x3c')](function(_0xa2557c){_0x9835b(_0xa2557c);});}});};exports[_0x3d93('0x30')]=function isAuthenticated(_0x228198){return compose()[_0x3d93('0x31')](function(_0x1a2901,_0x17fcbc,_0xa01eb0){var _0x3a7e47;if(_0x1a2901[_0x3d93('0x3d')]['authorization']){if(_[_0x3d93('0x3e')](_0x1a2901['headers'][_0x3d93('0x3f')],_0x3d93('0x40'))){var _0x1d6add=basicAuth(_0x1a2901);db['User'][_0x3d93('0x41')]({'where':{'name':_0x1d6add[_0x3d93('0xc')]}})[_0x3d93('0x37')](function(_0x5de0cd){if(!_0x5de0cd||!_0x5de0cd[_0x3d93('0x42')](_0x1d6add['pass'])){return _0x17fcbc[_0x3d93('0x43')](0x191)[_0x3d93('0x39')]({'message':_0x3d93('0x44')});}_0x1a2901[_0x3d93('0x45')]={'id':_0x5de0cd['id']};_0xa01eb0();})[_0x3d93('0x3c')](function(_0x21f1ce){_0xa01eb0(_0x21f1ce);});}else if(_[_0x3d93('0x3e')](_0x1a2901['headers']['authorization'],_0x3d93('0x46'))){validateJwt(_0x1a2901,_0x17fcbc,_0xa01eb0);}else{if(_0x228198){_0xa01eb0();}else{return _0x17fcbc[_0x3d93('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1a2901[_0x3d93('0x47')][_0x3d93('0x48')]){try{var _0x5a37ba={'audience':hardwareConf[_0x3d93('0x49')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1a2901[_0x3d93('0x47')]['apikey'],_0x5a37ba)[_0x3d93('0x37')](function(_0x28a092){return db[_0x3d93('0x4a')][_0x3d93('0x41')]({'where':{'id':_0x28a092[_0x3d93('0x4b')]}})['then'](function(_0x553390){_0x3a7e47=_0x553390;return db[_0x3d93('0x4c')][_0x3d93('0x33')]({'where':{'id':0x1},'attributes':[_0x3d93('0x4d'),_0x3d93('0x4e')],'raw':!![]});})[_0x3d93('0x37')](function(_0x382597){if(!_0x3a7e47||!_[_0x3d93('0x4f')](_0x3a7e47[_0x3d93('0x50')],_0x28a092[_0x3d93('0x51')])){return _0x17fcbc['status'](0x191)[_0x3d93('0x39')]({'message':_0x3d93('0x52')});}if(_0x3a7e47[_0x3d93('0x53')]){return _0x17fcbc[_0x3d93('0x43')](0x191)[_0x3d93('0x39')]({'message':_0x3d93('0x54')});}if(_0x3a7e47[_0x3d93('0x55')]){if(_0x382597[_0x3d93('0x4e')]>0x0){if(moment(_0x3a7e47[_0x3d93('0x56')])['add'](_0x382597[_0x3d93('0x4e')],_0x3d93('0x57'))>moment()){return _0x17fcbc[_0x3d93('0x43')](0x191)[_0x3d93('0x39')]({'message':_0x3d93('0x54')});}}else{return _0x17fcbc[_0x3d93('0x43')](0x191)[_0x3d93('0x39')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1a2901[_0x3d93('0x45')]={'id':_0x3a7e47['id']};_0xa01eb0();});})['catch'](function(){return _0x17fcbc[_0x3d93('0x43')](0x191)[_0x3d93('0x39')]({'message':_0x3d93('0x54')});});}catch(_0x2659ec){_0xa01eb0(_0x2659ec);}}else if(_0x228198){_0xa01eb0();}else{return _0x17fcbc[_0x3d93('0x43')](0x193)[_0x3d93('0x39')]({'message':_0x3d93('0x58')});}})[_0x3d93('0x31')](function(_0x2fefd4,_0x40eefa,_0x42d251){if(_0x2fefd4[_0x3d93('0x45')]){db['User'][_0x3d93('0x41')]({'where':{'id':_0x2fefd4['user']['id']},'attributes':userAttributes})[_0x3d93('0x37')](function(_0x1377f9){if(!_0x1377f9){return _0x40eefa['status'](0x194)[_0x3d93('0x39')]({'message':'User\x20not\x20found.'});}_0x2fefd4[_0x3d93('0x45')]=_0x1377f9;_0x42d251();})['catch'](function(_0x371d4e){_0x42d251(_0x371d4e);});}else if(_0x228198){_0x42d251();}else{return _0x40eefa[_0x3d93('0x43')](0x194)[_0x3d93('0x39')]({'message':_0x3d93('0x59')});}});};exports[_0x3d93('0x5a')]=function canUpdate(){return compose()[_0x3d93('0x31')](function(_0x3f9c05,_0x2f9595,_0x3f5429){return licenseUtil['getLicense']()['then'](function(_0x473241){if(_0x473241[_0x3d93('0x5b')]){_0x3f5429();}else{return _0x2f9595[_0x3d93('0x43')](0x193)[_0x3d93('0x39')]({'message':_0x3d93('0x5c')});}})['catch'](function(_0x3ab41d){_0x3f5429(_0x3ab41d);});});};exports[_0x3d93('0x5d')]=function(_0x38e964,_0x5ca5b7,_0x11f885){_0x38e964[_0x3d93('0x5d')]=!![];return _0x11f885();};exports['signToken']=function signToken(_0x4b26ed){return signJwt(_0x4b26ed);};exports[_0x3d93('0x5e')]=function(_0x385841,_0x198855){if(!_0x385841[_0x3d93('0x45')]){return _0x198855[_0x3d93('0x43')](0x194)[_0x3d93('0x39')]({'message':_0x3d93('0x5f')});}var _0x21faeb={'payload':{'id':_0x385841['user']['id'],'role':_0x385841['user'][_0x3d93('0x60')]},'options':{'expiresIn':0x15180}};return signJwt(_0x21faeb)['then'](function(_0x12588e){_0x198855[_0x3d93('0x61')](_0x3d93('0x62'),_0x12588e);_0x198855[_0x3d93('0x63')](_0x3d93('0x64'));})['catch'](function(_0x4965f5){return _0x198855['status'](0x1f4)[_0x3d93('0x65')](_0x4965f5);});};exports[_0x3d93('0x66')]=function(_0x228454){if(_[_0x3d93('0x67')](_0x228454[_0x3d93('0x50')])||_[_0x3d93('0x67')](_0x228454['apiKeyIat'])){return null;}else{return createJwt(_0x228454);}};exports[_0x3d93('0x68')]=function(_0x2364fa){_0x2364fa[_0x3d93('0x50')]=generateNonce();_0x2364fa[_0x3d93('0x69')]=generateIssuedAt();return createJwt(_0x2364fa);};exports[_0x3d93('0x6a')]=function(_0x2dfc7b,_0x5afd14){var _0x2c40ac=_0x2dfc7b[_0x3d93('0x47')][_0x3d93('0x48')];if(_0x2c40ac){var _0x585b5e={'nonce':_0x5afd14['apiKeyNonce'],'iat':_0x5afd14[_0x3d93('0x69')],'audience':hardwareConf[_0x3d93('0x49')](),'issuer':hardwareConf[_0x3d93('0x49')]()};return verifyJwt(_0x2c40ac,_0x585b5e)[_0x3d93('0x37')](function(){return generateApiKey(_0x5afd14);});}else{throw{'message':_0x3d93('0x6b')};}};exports['validatePasswordPattern']=function(_0x56e2b6){var _0x596ea6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x596ea6[_0x3d93('0x6c')](_0x56e2b6))throw new db['Sequelize'][(_0x3d93('0x6d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x3d93('0x6e')]=function(_0x30e827,_0x41bf04,_0x3327bb){var _0xaecf0e=encryptor[_0x3d93('0x6f')](_0x41bf04)['split'](',');for(var _0x594ddc=0x0;_0x594ddc<_0x3327bb;_0x594ddc++){if(!_0xaecf0e[_0x594ddc])break;if(_0x30e827['toLowerCase']()===_0xaecf0e[_0x594ddc][_0x3d93('0x70')]()){var _0x2e99f8=util[_0x3d93('0x71')](_0x3d93('0x72'),_0x3327bb);if(_0x3327bb===0x1){_0x2e99f8=_0x3d93('0x73');}throw new db[(_0x3d93('0x74'))][(_0x3d93('0x6d'))](_0x2e99f8);}}return;};exports[_0x3d93('0x75')]=function(_0x3d6a31,_0x53385c){var _0x491530=_0x53385c?encryptor['decryptString'](_0x53385c)[_0x3d93('0x76')](','):[];if(_0x491530['length']===0x5){_0x491530[_0x3d93('0x77')](-0x1,0x1);}_0x491530[_0x3d93('0x78')](_0x3d6a31);return encryptor[_0x3d93('0x79')](_0x491530['join'](','));};function signJwt(_0x110984){var _0x4acccc=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x4ee8a4=_0x110984['secret']||config[_0x3d93('0xa')]['session'];return new BPromise(function(_0x96ad85,_0x2fc2fb){_0x4acccc(_0x110984['payload'],_0x4ee8a4,_0x110984[_0x3d93('0x7a')])[_0x3d93('0x37')](function(_0x28d709){_0x96ad85(_0x28d709);})['catch'](function(_0x582dac){_0x2fc2fb(_0x582dac);});});}function verifyJwt(_0x454de1,_0x4fecff,_0x45a2e5){var _0x44264e=BPromise[_0x3d93('0x7b')](jwt[_0x3d93('0x7c')],{'context':jwt});var _0x1e0bbe=_0x45a2e5||config[_0x3d93('0xa')][_0x3d93('0xb')];return new BPromise(function(_0x50cf5f,_0x4ea09b){_0x44264e(_0x454de1,_0x1e0bbe,_0x4fecff)['then'](function(_0x3e0a06){_0x50cf5f(_0x3e0a06);})['catch'](function(_0x2bd8fe){_0x4ea09b(_0x2bd8fe);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x3d93('0x7d')](_0x3d93('0x7e'));}function generateIssuedAt(){return Math[_0x3d93('0x7f')](Date[_0x3d93('0x80')]()/0x3e8)[_0x3d93('0x7d')]();}function createJwt(_0x3a4a09){var _0x17f4c2={'payload':{'iat':_0x3a4a09[_0x3d93('0x69')],'nonce':_0x3a4a09[_0x3d93('0x50')]},'options':{'algorithm':_0x3d93('0x81'),'subject':_0x3a4a09['id'][_0x3d93('0x7d')](),'issuer':hardwareConf[_0x3d93('0x49')](),'audience':hardwareConf[_0x3d93('0x49')]()}};return signJwt(_0x17f4c2)[_0x3d93('0x37')](function(_0x3d8dcf){return{'iat':_0x3a4a09[_0x3d93('0x69')],'nonce':_0x3a4a09[_0x3d93('0x50')],'token':_0x3d8dcf};});} \ No newline at end of file +var _0x94b2=['sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','promisify','verify','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','then','closed','status','disposition','unmanaged','json','Unmanaged.','authorization','startsWith','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','headers','Bearer','query','getUuid'];(function(_0xe7d561,_0x146cef){var _0x4c27f0=function(_0x287ac7){while(--_0x287ac7){_0xe7d561['push'](_0xe7d561['shift']());}};_0x4c27f0(++_0x146cef);}(_0x94b2,0x12d));var _0x294b=function(_0x385d69,_0x43fa63){_0x385d69=_0x385d69-0x0;var _0x5d34e7=_0x94b2[_0x385d69];return _0x5d34e7;};'use strict';var db=require(_0x294b('0x0'))['db'];var config=require(_0x294b('0x1'));var hardwareConf=require(_0x294b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x294b('0x3'));var jwt=require(_0x294b('0x4'));var expressJwt=require(_0x294b('0x5'));var compose=require(_0x294b('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x294b('0x7'));var BPromise=require(_0x294b('0x8'));var util=require(_0x294b('0x9'));var moment=require(_0x294b('0xa'));var validateJwt=expressJwt({'secret':config[_0x294b('0xb')][_0x294b('0xc')]});var userAttributes=['id',_0x294b('0xd'),_0x294b('0xe'),'name',_0x294b('0xf'),_0x294b('0x10'),_0x294b('0x11'),_0x294b('0x12'),'md5secret','voicePause',_0x294b('0x13'),_0x294b('0x14'),_0x294b('0x15'),_0x294b('0x16'),'openchannelPause',_0x294b('0x17'),'showWebBar',_0x294b('0x18'),'lastPauseAt','crudPermissions',_0x294b('0x19'),_0x294b('0x1a'),_0x294b('0x1b'),_0x294b('0x1c'),_0x294b('0x1d'),_0x294b('0x1e'),_0x294b('0x1f'),_0x294b('0x20'),_0x294b('0x21'),'phoneBarExpires','phoneBarPrefixRequired',_0x294b('0x22'),_0x294b('0x23'),'hotdesk',_0x294b('0x24'),'userProfileId',_0x294b('0x25'),_0x294b('0x26'),_0x294b('0x27'),_0x294b('0x28'),'downloadOmnichannelInteractions',_0x294b('0x29'),_0x294b('0x2a'),_0x294b('0x2b')];exports[_0x294b('0x2c')]=function(){return this[_0x294b('0x2d')](!![])[_0x294b('0x2e')](function(_0x55b00e,_0x4223d7,_0x3b69ea){if(_0x55b00e[_0x294b('0x2f')]){_0x3b69ea();}else{return db[_0x294b('0x30')][_0x294b('0x31')]({'where':{'id':_0x55b00e[_0x294b('0x32')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x294b('0x33')](function(_0x1b2bd7){if(_0x1b2bd7&&_0x1b2bd7[_0x294b('0x34')]){return _0x4223d7[_0x294b('0x35')](_0x1b2bd7[_0x294b('0x36')]===_0x294b('0x37')?0x195:0x193)[_0x294b('0x38')]({'message':_0x1b2bd7[_0x294b('0x36')]===_0x294b('0x37')?_0x294b('0x39'):'Forbidden.'});}else{_0x3b69ea();}})['catch'](function(_0x3b6de9){_0x3b69ea(_0x3b6de9);});}});};exports[_0x294b('0x2d')]=function isAuthenticated(_0x1d7e01){return compose()[_0x294b('0x2e')](function(_0x4d8900,_0x3a1cd6,_0x210fa2){var _0x3f7703;if(_0x4d8900['headers'][_0x294b('0x3a')]){if(_[_0x294b('0x3b')](_0x4d8900['headers'][_0x294b('0x3a')],_0x294b('0x3c'))){var _0xaa1eea=basicAuth(_0x4d8900);db[_0x294b('0x3d')][_0x294b('0x3e')]({'where':{'name':_0xaa1eea[_0x294b('0x3f')]}})[_0x294b('0x33')](function(_0x5281db){if(!_0x5281db||!_0x5281db[_0x294b('0x40')](_0xaa1eea['pass'])){return _0x3a1cd6[_0x294b('0x35')](0x191)[_0x294b('0x38')]({'message':_0x294b('0x41')});}_0x4d8900['user']={'id':_0x5281db['id']};_0x210fa2();})[_0x294b('0x42')](function(_0x166e80){_0x210fa2(_0x166e80);});}else if(_[_0x294b('0x3b')](_0x4d8900[_0x294b('0x43')]['authorization'],_0x294b('0x44'))){validateJwt(_0x4d8900,_0x3a1cd6,_0x210fa2);}else{if(_0x1d7e01){_0x210fa2();}else{return _0x3a1cd6[_0x294b('0x35')](0x193)[_0x294b('0x38')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4d8900[_0x294b('0x45')]['apikey']){try{var _0x307468={'audience':hardwareConf[_0x294b('0x46')](),'issuer':hardwareConf[_0x294b('0x46')]()};verifyJwt(_0x4d8900['query']['apikey'],_0x307468)[_0x294b('0x33')](function(_0x912939){return db['User']['find']({'where':{'id':_0x912939[_0x294b('0x47')]}})[_0x294b('0x33')](function(_0x30d152){_0x3f7703=_0x30d152;return db['Setting'][_0x294b('0x31')]({'where':{'id':0x1},'attributes':[_0x294b('0x48'),'blockDuration'],'raw':!![]});})[_0x294b('0x33')](function(_0x3c2dda){if(!_0x3f7703||!_[_0x294b('0x49')](_0x3f7703[_0x294b('0x4a')],_0x912939[_0x294b('0x4b')])){return _0x3a1cd6['status'](0x191)[_0x294b('0x38')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3f7703[_0x294b('0x4c')]){return _0x3a1cd6[_0x294b('0x35')](0x191)[_0x294b('0x38')]({'message':_0x294b('0x4d')});}if(_0x3f7703[_0x294b('0x4e')]){if(_0x3c2dda[_0x294b('0x4f')]>0x0){if(moment(_0x3f7703[_0x294b('0x50')])[_0x294b('0x51')](_0x3c2dda[_0x294b('0x4f')],'minutes')>moment()){return _0x3a1cd6[_0x294b('0x35')](0x191)[_0x294b('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3a1cd6['status'](0x191)[_0x294b('0x38')]({'message':_0x294b('0x4d')});}}_0x4d8900['user']={'id':_0x3f7703['id']};_0x210fa2();});})[_0x294b('0x42')](function(){return _0x3a1cd6[_0x294b('0x35')](0x191)[_0x294b('0x38')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1d11f1){_0x210fa2(_0x1d11f1);}}else if(_0x1d7e01){_0x210fa2();}else{return _0x3a1cd6['status'](0x193)[_0x294b('0x38')]({'message':_0x294b('0x52')});}})[_0x294b('0x2e')](function(_0x58a75a,_0x23ad7e,_0x3a46a6){if(_0x58a75a['user']){db[_0x294b('0x3d')][_0x294b('0x3e')]({'where':{'id':_0x58a75a[_0x294b('0x2f')]['id']},'attributes':userAttributes})[_0x294b('0x33')](function(_0x5afaee){if(!_0x5afaee){return _0x23ad7e[_0x294b('0x35')](0x194)[_0x294b('0x38')]({'message':_0x294b('0x53')});}_0x58a75a[_0x294b('0x2f')]=_0x5afaee;_0x3a46a6();})['catch'](function(_0x360d6c){_0x3a46a6(_0x360d6c);});}else if(_0x1d7e01){_0x3a46a6();}else{return _0x23ad7e[_0x294b('0x35')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x294b('0x54')]=function canUpdate(){return compose()[_0x294b('0x2e')](function(_0x1fdeb8,_0x4fe9ce,_0x53e590){return licenseUtil['getLicense']()[_0x294b('0x33')](function(_0xc9ce5c){if(_0xc9ce5c['update']){_0x53e590();}else{return _0x4fe9ce[_0x294b('0x35')](0x193)['json']({'message':_0x294b('0x55')});}})[_0x294b('0x42')](function(_0x4ce885){_0x53e590(_0x4ce885);});});};exports['isMiddleware']=function(_0xa6bbf1,_0x5e7dee,_0x3252e0){_0xa6bbf1[_0x294b('0x56')]=!![];return _0x3252e0();};exports[_0x294b('0x57')]=function signToken(_0x139e9e){return signJwt(_0x139e9e);};exports[_0x294b('0x58')]=function(_0x5b7e88,_0x28d6a6){if(!_0x5b7e88[_0x294b('0x2f')]){return _0x28d6a6[_0x294b('0x35')](0x194)[_0x294b('0x38')]({'message':_0x294b('0x59')});}var _0x3ce061={'payload':{'id':_0x5b7e88[_0x294b('0x2f')]['id'],'role':_0x5b7e88[_0x294b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3ce061)['then'](function(_0x3053de){_0x28d6a6[_0x294b('0x5a')](_0x294b('0x5b'),_0x3053de);_0x28d6a6[_0x294b('0x5c')](_0x294b('0x5d'));})[_0x294b('0x42')](function(_0xd1bd7c){return _0x28d6a6[_0x294b('0x35')](0x1f4)['send'](_0xd1bd7c);});};exports[_0x294b('0x5e')]=function(_0x982075){if(_['isNil'](_0x982075['apiKeyNonce'])||_[_0x294b('0x5f')](_0x982075[_0x294b('0x60')])){return null;}else{return createJwt(_0x982075);}};exports[_0x294b('0x61')]=function(_0x150197){_0x150197['apiKeyNonce']=generateNonce();_0x150197[_0x294b('0x60')]=generateIssuedAt();return createJwt(_0x150197);};exports[_0x294b('0x62')]=function(_0x4c5567,_0x453468){var _0x1fd89c=_0x4c5567[_0x294b('0x45')]['apikey'];if(_0x1fd89c){var _0x3b873d={'nonce':_0x453468['apiKeyNonce'],'iat':_0x453468[_0x294b('0x60')],'audience':hardwareConf[_0x294b('0x46')](),'issuer':hardwareConf[_0x294b('0x46')]()};return verifyJwt(_0x1fd89c,_0x3b873d)[_0x294b('0x33')](function(){return generateApiKey(_0x453468);});}else{throw{'message':_0x294b('0x63')};}};exports[_0x294b('0x64')]=function(_0x544723){var _0x5b8118=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5b8118[_0x294b('0x65')](_0x544723))throw new db['Sequelize'][(_0x294b('0x66'))](_0x294b('0x67'));return;};exports['validatePasswordHistory']=function(_0x484a94,_0x4cf473,_0x311619){var _0x4aeaa1=encryptor[_0x294b('0x68')](_0x4cf473)[_0x294b('0x69')](',');for(var _0x1e073e=0x0;_0x1e073e<_0x311619;_0x1e073e++){if(!_0x4aeaa1[_0x1e073e])break;if(_0x484a94[_0x294b('0x6a')]()===_0x4aeaa1[_0x1e073e][_0x294b('0x6a')]()){var _0x1ef871=util[_0x294b('0x6b')](_0x294b('0x6c'),_0x311619);if(_0x311619===0x1){_0x1ef871=_0x294b('0x6d');}throw new db[(_0x294b('0x6e'))]['ValidationError'](_0x1ef871);}}return;};exports[_0x294b('0x6f')]=function(_0x33281b,_0x36636c){var _0xb43802=_0x36636c?encryptor[_0x294b('0x68')](_0x36636c)[_0x294b('0x69')](','):[];if(_0xb43802[_0x294b('0x70')]===0x5){_0xb43802['splice'](-0x1,0x1);}_0xb43802[_0x294b('0x71')](_0x33281b);return encryptor[_0x294b('0x72')](_0xb43802[_0x294b('0x73')](','));};function signJwt(_0x17f772){var _0x5f3d3e=BPromise['promisify'](jwt[_0x294b('0x74')],{'context':jwt});var _0xc8523a=_0x17f772[_0x294b('0x75')]||config[_0x294b('0xb')][_0x294b('0xc')];return new BPromise(function(_0x33114f,_0x3b0c1f){_0x5f3d3e(_0x17f772[_0x294b('0x76')],_0xc8523a,_0x17f772['options'])[_0x294b('0x33')](function(_0x550029){_0x33114f(_0x550029);})['catch'](function(_0x5c2863){_0x3b0c1f(_0x5c2863);});});}function verifyJwt(_0x332be6,_0x559697,_0xfd7cf0){var _0x1fb666=BPromise[_0x294b('0x77')](jwt[_0x294b('0x78')],{'context':jwt});var _0x533993=_0xfd7cf0||config[_0x294b('0xb')][_0x294b('0xc')];return new BPromise(function(_0x30617e,_0x20cfea){_0x1fb666(_0x332be6,_0x533993,_0x559697)[_0x294b('0x33')](function(_0x1e9dcd){_0x30617e(_0x1e9dcd);})[_0x294b('0x42')](function(_0x2ac490){_0x20cfea(_0x2ac490);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x294b('0x79')](_0x294b('0x7a'));}function generateIssuedAt(){return Math['floor'](Date[_0x294b('0x7b')]()/0x3e8)['toString']();}function createJwt(_0x1f4704){var _0x47e6f0={'payload':{'iat':_0x1f4704[_0x294b('0x60')],'nonce':_0x1f4704[_0x294b('0x4a')]},'options':{'algorithm':'HS512','subject':_0x1f4704['id'][_0x294b('0x79')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x294b('0x46')]()}};return signJwt(_0x47e6f0)[_0x294b('0x33')](function(_0x305994){return{'iat':_0x1f4704['apiKeyIat'],'nonce':_0x1f4704[_0x294b('0x4a')],'token':_0x305994};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 087ea88..f27eaf5 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 _0xcb64=['createWriteStream','createCipher','data','binary','write','end','unlink','decryptFile','createReadStream','createDecipher','update','final','close','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x4cfeee,_0x41c3b5){var _0x3877e9=function(_0x4b44db){while(--_0x4b44db){_0x4cfeee['push'](_0x4cfeee['shift']());}};_0x3877e9(++_0x41c3b5);}(_0xcb64,0x7b));var _0x4cb6=function(_0x36ea90,_0x2caf25){_0x36ea90=_0x36ea90-0x0;var _0x465dd9=_0xcb64[_0x36ea90];return _0x465dd9;};'use strict';var crypto=require(_0x4cb6('0x0'));var fs=require('fs');var BPromise=require(_0x4cb6('0x1'));var _=require(_0x4cb6('0x2'));var config=require('../../config/environment');var logger=require(_0x4cb6('0x3'))(_0x4cb6('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4cb6('0x5')][_0x4cb6('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x4cb6('0x7')};if(config[_0x4cb6('0x8')]&&config[_0x4cb6('0x8')][_0x4cb6('0x9')]){var isSupported=isAlgorithmSupported(config[_0x4cb6('0x8')][_0x4cb6('0x9')]);if(isSupported){fileOptions[_0x4cb6('0x9')]=config[_0x4cb6('0x8')][_0x4cb6('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4cb6('0xa')](',\x20');logger[_0x4cb6('0xb')](config[_0x4cb6('0x8')]['algorithm'],_0x4cb6('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x25b959){return AES_SUPPORTED_RX['test'](_0x25b959);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x4cb6('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x796555){return getSupportedCiphers()[_0x4cb6('0xe')](_0x796555)>-0x1;}function combineOptions(_0x110a19){var _0x46e9f7={};for(var _0x5014c3 in fileOptions){if(fileOptions[_0x4cb6('0xf')](_0x5014c3)){_0x46e9f7[_0x5014c3]=fileOptions[_0x5014c3];}}if(_0x110a19){for(var _0x536b70 in _0x110a19){if(_0x110a19['hasOwnProperty'](_0x536b70)){_0x46e9f7[_0x536b70]=_0x110a19[_0x536b70];}}}return _0x46e9f7;}exports[_0x4cb6('0x10')]=function(_0x5114fd,_0x3eaf6c,_0x54d9ca,_0x18aa4d){return new BPromise(function(_0x4fae7e,_0x76d05b){_0x18aa4d=combineOptions(_0x18aa4d);var _0x5cd2fa=new Buffer(_0x54d9ca);var _0x8d7e77=fs['createReadStream'](_0x5114fd);var _0x5960d9=fs[_0x4cb6('0x11')](_0x3eaf6c);var _0x3ccd90=crypto[_0x4cb6('0x12')](_0x18aa4d[_0x4cb6('0x9')],_0x5cd2fa);_0x8d7e77['on'](_0x4cb6('0x13'),function(_0x378d40){var _0x2197b8=new Buffer(_0x3ccd90['update'](_0x378d40),_0x4cb6('0x14'));_0x5960d9['write'](_0x2197b8);});_0x8d7e77['on']('end',function(){try{var _0x1c8a70=new Buffer(_0x3ccd90['final']('binary'),_0x4cb6('0x14'));_0x5960d9[_0x4cb6('0x15')](_0x1c8a70);_0x5960d9[_0x4cb6('0x16')]();_0x5960d9['on']('close',function(){return _0x4fae7e(_0x3eaf6c);});}catch(_0x24ba81){fs[_0x4cb6('0x17')](_0x3eaf6c);return _0x76d05b(_0x24ba81);}});});};exports[_0x4cb6('0x18')]=function(_0x527add,_0x861464,_0x2cc088,_0x222dc1){return new BPromise(function(_0x2637f0,_0x147621){_0x222dc1=combineOptions(_0x222dc1);var _0x369e55=new Buffer(_0x2cc088);var _0x39157c=fs[_0x4cb6('0x19')](_0x527add);var _0x3fd346=fs[_0x4cb6('0x11')](_0x861464);var _0x1482f8=crypto[_0x4cb6('0x1a')](_0x222dc1[_0x4cb6('0x9')],_0x369e55);_0x39157c['on'](_0x4cb6('0x13'),function(_0x31ccb0){var _0x490002=new Buffer(_0x1482f8[_0x4cb6('0x1b')](_0x31ccb0),_0x4cb6('0x14'));_0x3fd346[_0x4cb6('0x15')](_0x490002);});_0x39157c['on'](_0x4cb6('0x16'),function(){try{var _0x2125d3=new Buffer(_0x1482f8[_0x4cb6('0x1c')](_0x4cb6('0x14')),_0x4cb6('0x14'));_0x3fd346[_0x4cb6('0x15')](_0x2125d3);_0x3fd346[_0x4cb6('0x16')]();_0x3fd346['on'](_0x4cb6('0x1d'),function(){return _0x2637f0(_0x861464);});}catch(_0x58c6ec){fs[_0x4cb6('0x17')](_0x861464);return _0x147621(_0x58c6ec);}});});};exports[_0x4cb6('0x1e')]=function(_0x55442e,_0x3251d3,_0x55e5d2){var _0x235d6f=_0x55e5d2||stringOptions[_0x4cb6('0x9')];var _0x1295f1=_0x3251d3||stringOptions['secret'];var _0x3a92f2=crypto[_0x4cb6('0x12')](_0x235d6f,_0x1295f1);var _0x5678a4=_0x3a92f2['update'](_0x55442e,_0x4cb6('0x1f'),_0x4cb6('0x20'));_0x5678a4+=_0x3a92f2[_0x4cb6('0x1c')](_0x4cb6('0x20'));return _0x5678a4;};exports[_0x4cb6('0x21')]=function(_0xa8aa3,_0x72b498,_0x2434a5){var _0x4d6486=_0x2434a5||stringOptions[_0x4cb6('0x9')];var _0x49c47c=_0x72b498||stringOptions[_0x4cb6('0x22')];var _0x350d84=crypto[_0x4cb6('0x1a')](_0x4d6486,_0x49c47c);var _0x2a6a6d=_0x350d84['update'](_0xa8aa3,'base64',_0x4cb6('0x1f'));_0x2a6a6d+=_0x350d84[_0x4cb6('0x1c')](_0x4cb6('0x1f'));return _0x2a6a6d;}; \ No newline at end of file +var _0x6f34=['session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','createReadStream','createDecipher','close','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','app','secrets'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x6f34,0x95));var _0x46f3=function(_0x2dff62,_0x24d470){_0x2dff62=_0x2dff62-0x0;var _0x320961=_0x6f34[_0x2dff62];return _0x320961;};'use strict';var crypto=require(_0x46f3('0x0'));var fs=require('fs');var BPromise=require(_0x46f3('0x1'));var _=require(_0x46f3('0x2'));var config=require(_0x46f3('0x3'));var logger=require('../../config/logger')(_0x46f3('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x46f3('0x5')][_0x46f3('0x6')],'algorithm':_0x46f3('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x46f3('0x8')]&&config['encrypt'][_0x46f3('0x9')]){var isSupported=isAlgorithmSupported(config[_0x46f3('0x8')][_0x46f3('0x9')]);if(isSupported){fileOptions[_0x46f3('0x9')]=config[_0x46f3('0x8')][_0x46f3('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x46f3('0xa')](config[_0x46f3('0x8')][_0x46f3('0x9')],_0x46f3('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x4485dd){return AES_SUPPORTED_RX['test'](_0x4485dd);}function getSupportedCiphers(){return crypto[_0x46f3('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3ec917){return getSupportedCiphers()[_0x46f3('0xd')](_0x3ec917)>-0x1;}function combineOptions(_0x1161f2){var _0x3bc318={};for(var _0x38a2e7 in fileOptions){if(fileOptions['hasOwnProperty'](_0x38a2e7)){_0x3bc318[_0x38a2e7]=fileOptions[_0x38a2e7];}}if(_0x1161f2){for(var _0x1806a4 in _0x1161f2){if(_0x1161f2['hasOwnProperty'](_0x1806a4)){_0x3bc318[_0x1806a4]=_0x1161f2[_0x1806a4];}}}return _0x3bc318;}exports['encryptFile']=function(_0x5ab530,_0x312591,_0xcd68b3,_0x4e5d93){return new BPromise(function(_0x739aeb,_0x365152){_0x4e5d93=combineOptions(_0x4e5d93);var _0x21d165=new Buffer(_0xcd68b3);var _0x3b9622=fs['createReadStream'](_0x5ab530);var _0x55dee4=fs[_0x46f3('0xe')](_0x312591);var _0x54b8a2=crypto[_0x46f3('0xf')](_0x4e5d93[_0x46f3('0x9')],_0x21d165);_0x3b9622['on'](_0x46f3('0x10'),function(_0x5e1b7a){var _0x3d8a3b=new Buffer(_0x54b8a2[_0x46f3('0x11')](_0x5e1b7a),_0x46f3('0x12'));_0x55dee4[_0x46f3('0x13')](_0x3d8a3b);});_0x3b9622['on'](_0x46f3('0x14'),function(){try{var _0x407496=new Buffer(_0x54b8a2[_0x46f3('0x15')](_0x46f3('0x12')),'binary');_0x55dee4['write'](_0x407496);_0x55dee4['end']();_0x55dee4['on']('close',function(){return _0x739aeb(_0x312591);});}catch(_0x4e086d){fs[_0x46f3('0x16')](_0x312591);return _0x365152(_0x4e086d);}});});};exports['decryptFile']=function(_0x34f018,_0x18a652,_0x4e767d,_0x3e9741){return new BPromise(function(_0x2fef76,_0x503be9){_0x3e9741=combineOptions(_0x3e9741);var _0x2ce142=new Buffer(_0x4e767d);var _0x273047=fs[_0x46f3('0x17')](_0x34f018);var _0x1d1688=fs[_0x46f3('0xe')](_0x18a652);var _0x1831d7=crypto[_0x46f3('0x18')](_0x3e9741['algorithm'],_0x2ce142);_0x273047['on'](_0x46f3('0x10'),function(_0x23d4ae){var _0x5414b6=new Buffer(_0x1831d7[_0x46f3('0x11')](_0x23d4ae),_0x46f3('0x12'));_0x1d1688[_0x46f3('0x13')](_0x5414b6);});_0x273047['on']('end',function(){try{var _0x2b58d8=new Buffer(_0x1831d7[_0x46f3('0x15')](_0x46f3('0x12')),_0x46f3('0x12'));_0x1d1688[_0x46f3('0x13')](_0x2b58d8);_0x1d1688[_0x46f3('0x14')]();_0x1d1688['on'](_0x46f3('0x19'),function(){return _0x2fef76(_0x18a652);});}catch(_0x1f4743){fs[_0x46f3('0x16')](_0x18a652);return _0x503be9(_0x1f4743);}});});};exports[_0x46f3('0x1a')]=function(_0x8f8493,_0x7765e7,_0x580c9a){var _0x5aedff=_0x580c9a||stringOptions['algorithm'];var _0x26b5ff=_0x7765e7||stringOptions['secret'];var _0x582f2f=crypto[_0x46f3('0xf')](_0x5aedff,_0x26b5ff);var _0x3fa844=_0x582f2f[_0x46f3('0x11')](_0x8f8493,_0x46f3('0x1b'),'base64');_0x3fa844+=_0x582f2f[_0x46f3('0x15')](_0x46f3('0x1c'));return _0x3fa844;};exports[_0x46f3('0x1d')]=function(_0x41fb40,_0x4e3554,_0xb602a){var _0xfc1923=_0xb602a||stringOptions[_0x46f3('0x9')];var _0x10e382=_0x4e3554||stringOptions[_0x46f3('0x1e')];var _0x48184f=crypto[_0x46f3('0x18')](_0xfc1923,_0x10e382);var _0x1cdefb=_0x48184f[_0x46f3('0x11')](_0x41fb40,'base64','utf8');_0x1cdefb+=_0x48184f[_0x46f3('0x15')](_0x46f3('0x1b'));return _0x1cdefb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ec21428..4d9f674 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 _0x8c6d=['../../mysqldb','analytics','argv','savename','update','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','each','join','%s%d.%s','csv','%s.%s','zip','zip\x20finished','info','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','util','path','lodash','bluebird','rimraf'];(function(_0x51aac3,_0x5d18be){var _0x4bcb96=function(_0x1ab9c2){while(--_0x1ab9c2){_0x51aac3['push'](_0x51aac3['shift']());}};_0x4bcb96(++_0x5d18be);}(_0x8c6d,0x1a2));var _0xd8c6=function(_0xce50c3,_0x4a9e05){_0xce50c3=_0xce50c3-0x0;var _0x57afeb=_0x8c6d[_0xce50c3];return _0x57afeb;};'use strict';var util=require(_0xd8c6('0x0'));var path=require(_0xd8c6('0x1'));var _=require(_0xd8c6('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xd8c6('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd8c6('0x4'));var db=require(_0xd8c6('0x5'))['db'];var dbH=require(_0xd8c6('0x5'))['dbH'];var logger=require('../../config/logger')(_0xd8c6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xd8c6('0x7')][0x2]);var QUERY=process[_0xd8c6('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a6904,_0x58b881){var _0x575b4d={'status':_0x2a6904};var _0x467584={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58b881){_0x575b4d[_0xd8c6('0x8')]=_0x58b881;}return db['AnalyticExtractedReport'][_0xd8c6('0x9')](_0x575b4d,_0x467584);}function main(){var _0x43944d=0x1388;var _0x3917be;logger['info'](util[_0xd8c6('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd8c6('0xb')));return db[_0xd8c6('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd8c6('0xd'),_0xd8c6('0xe')]})[_0xd8c6('0xf')](function(_0x16a400){if(_0x16a400){_0x3917be=_0x16a400;_0x43944d=_0x3917be[_0xd8c6('0xe')]||0x1388;}})[_0xd8c6('0xf')](function(){return dbH[_0xd8c6('0x10')][_0xd8c6('0x11')](util[_0xd8c6('0xa')](_0xd8c6('0x12'),QUERY),{'type':dbH['sequelize'][_0xd8c6('0x13')][_0xd8c6('0x14')]});})[_0xd8c6('0xf')](function(_0x3e2b03){if(!_0x3e2b03[0x0][_0xd8c6('0x15')]){return analyticExtractedReport('Empty');}var _0x5f2c73=[];var _0x596835=0x0;if(_0x3917be['split']){if(_0x3e2b03&&_0x3e2b03[_0xd8c6('0x16')]){var _0x375d4b=_[_0xd8c6('0x17')](_0x3e2b03[0x0][_0xd8c6('0x15')]/_0x43944d);var _0x7ac84b=Number['isInteger'](_0x3e2b03[0x0][_0xd8c6('0x15')]/_0x43944d)?_0x3e2b03[0x0][_0xd8c6('0x15')]%_0x43944d:0x0;_0x375d4b[_0xd8c6('0x18')](function(_0x2ff23b){if(_0x2ff23b>0x0){_0x596835+=_0x43944d;}_0x5f2c73[_0xd8c6('0x19')](dbH[_0xd8c6('0x10')]['query'](util[_0xd8c6('0xa')](_0xd8c6('0x1a'),QUERY,_0x43944d,_0x596835),{'type':dbH[_0xd8c6('0x10')][_0xd8c6('0x13')][_0xd8c6('0x14')]}));});if(_0x7ac84b>0x0){_0x596835+=_0x43944d;_0x5f2c73[_0xd8c6('0x19')](dbH[_0xd8c6('0x10')][_0xd8c6('0x11')](util[_0xd8c6('0xa')](_0xd8c6('0x1a'),QUERY,_0x7ac84b,_0x596835),{'type':dbH[_0xd8c6('0x10')][_0xd8c6('0x13')][_0xd8c6('0x14')]}));}}}else{_0x5f2c73[_0xd8c6('0x19')](dbH[_0xd8c6('0x10')][_0xd8c6('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xd8c6('0x14')]}));}var _0x5e0d7e=path[_0xd8c6('0x1b')](PATH);var _0x8bfc3f=path[_0xd8c6('0x1c')](PATH,_0xd8c6('0x1d'));var _0xa0d38e=_0x3917be[_0xd8c6('0xd')]&&_0x5f2c73[_0xd8c6('0x16')]>0x1;var _0x22869d=[];if(!fs['existsSync'](path['join'](_0x5e0d7e,_0x8bfc3f))&&_0xa0d38e){fs[_0xd8c6('0x1e')](path['join'](_0x5e0d7e,_0x8bfc3f));}return BPromise[_0xd8c6('0x1f')](_0x5f2c73,function(_0x4d977e){_0x22869d[_0xd8c6('0x19')](_0x4d977e);})[_0xd8c6('0xf')](function(){for(var _0x2adea1=0x0;_0x2adea1<_0x22869d[_0xd8c6('0x16')];_0x2adea1+=0x1){var _0x1159df;var _0x1b6e25=_0x22869d[_0x2adea1];if(_0xa0d38e){_0x1159df=path[_0xd8c6('0x20')](_0x5e0d7e,_0x8bfc3f,util[_0xd8c6('0xa')](_0xd8c6('0x21'),_0x8bfc3f,_0x2adea1,_0xd8c6('0x22')));}else{_0x1159df=path[_0xd8c6('0x20')](_0x5e0d7e,util['format'](_0xd8c6('0x23'),_0x8bfc3f,'csv'));}fs['writeFileSync'](_0x1159df,csv(_0x1b6e25));}})[_0xd8c6('0xf')](function(){if(_0xa0d38e){return new Promise(function(_0x4b6f6e){zipdir(path[_0xd8c6('0x20')](_0x5e0d7e,_0x8bfc3f),{'saveTo':path[_0xd8c6('0x20')](_0x5e0d7e,util[_0xd8c6('0xa')](_0xd8c6('0x23'),_0x8bfc3f,_0xd8c6('0x24')))},function(_0x26987b,_0x63d94a){rimraf(path['join'](_0x5e0d7e,_0x8bfc3f),function(){});_0x4b6f6e(_0xd8c6('0x25'));});});}})[_0xd8c6('0xf')](function(){logger[_0xd8c6('0x26')](util[_0xd8c6('0xa')](_0xd8c6('0x27'),EXTRACTED_REPORT_ID,_0xd8c6('0xb')));return analyticExtractedReport(_0xd8c6('0x28'),_0xa0d38e?util['format']('%s.%s',_0x8bfc3f,_0xa0d38e?_0xd8c6('0x24'):_0xd8c6('0x22')):null);});})[_0xd8c6('0x29')](function(_0x3381aa){logger[_0xd8c6('0x26')](util['format'](_0xd8c6('0x2a'),EXTRACTED_REPORT_ID,_0xd8c6('0xb')),util[_0xd8c6('0x2b')](_0x3381aa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd8c6('0x2c'));})[_0xd8c6('0x2d')](function(){process[_0xd8c6('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe341=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','mkdirSync','join','%s%d.%s','csv','writeFileSync','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','finally','exit','util','path','lodash','to-csv'];(function(_0xaeba0c,_0x434a50){var _0x27dc03=function(_0x50b227){while(--_0x50b227){_0xaeba0c['push'](_0xaeba0c['shift']());}};_0x27dc03(++_0x434a50);}(_0xe341,0x1e6));var _0x1e34=function(_0x26603e,_0x5197dc){_0x26603e=_0x26603e-0x0;var _0x5e6452=_0xe341[_0x26603e];return _0x5e6452;};'use strict';var util=require(_0x1e34('0x0'));var path=require(_0x1e34('0x1'));var _=require(_0x1e34('0x2'));var csv=require(_0x1e34('0x3'));var fs=require('fs');var BPromise=require(_0x1e34('0x4'));var zipdir=require(_0x1e34('0x5'));var rimraf=require(_0x1e34('0x6'));var db=require(_0x1e34('0x7'))['db'];var dbH=require(_0x1e34('0x7'))[_0x1e34('0x8')];var logger=require(_0x1e34('0x9'))(_0x1e34('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x1e34('0xb')][0x2]);var QUERY=process[_0x1e34('0xb')][0x3];var PATH=process[_0x1e34('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x238442,_0x18dfa3){var _0x1a02e3={'status':_0x238442};var _0x555816={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18dfa3){_0x1a02e3[_0x1e34('0xc')]=_0x18dfa3;}return db[_0x1e34('0xd')][_0x1e34('0xe')](_0x1a02e3,_0x555816);}function main(){var _0x4192a1=0x1388;var _0x37c791;logger[_0x1e34('0xf')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1e34('0x10')));return db[_0x1e34('0x11')][_0x1e34('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1e34('0x13')]})[_0x1e34('0x14')](function(_0x4259dc){if(_0x4259dc){_0x37c791=_0x4259dc;_0x4192a1=_0x37c791[_0x1e34('0x13')]||0x1388;}})[_0x1e34('0x14')](function(){return dbH[_0x1e34('0x15')][_0x1e34('0x16')](util[_0x1e34('0x17')](_0x1e34('0x18'),QUERY),{'type':dbH['sequelize'][_0x1e34('0x19')][_0x1e34('0x1a')]});})[_0x1e34('0x14')](function(_0x381ae6){if(!_0x381ae6[0x0][_0x1e34('0x1b')]){return analyticExtractedReport('Empty');}var _0x5b1f5a=[];var _0x34a5cc=0x0;if(_0x37c791[_0x1e34('0x1c')]){if(_0x381ae6&&_0x381ae6[_0x1e34('0x1d')]){var _0x27836d=_[_0x1e34('0x1e')](_0x381ae6[0x0]['num']/_0x4192a1);var _0x2c92fc=Number[_0x1e34('0x1f')](_0x381ae6[0x0][_0x1e34('0x1b')]/_0x4192a1)?_0x381ae6[0x0][_0x1e34('0x1b')]%_0x4192a1:0x0;_0x27836d[_0x1e34('0x20')](function(_0x1852ae){if(_0x1852ae>0x0){_0x34a5cc+=_0x4192a1;}_0x5b1f5a[_0x1e34('0x21')](dbH[_0x1e34('0x15')]['query'](util[_0x1e34('0x17')](_0x1e34('0x22'),QUERY,_0x4192a1,_0x34a5cc),{'type':dbH[_0x1e34('0x15')][_0x1e34('0x19')][_0x1e34('0x1a')]}));});if(_0x2c92fc>0x0){_0x34a5cc+=_0x4192a1;_0x5b1f5a[_0x1e34('0x21')](dbH[_0x1e34('0x15')][_0x1e34('0x16')](util[_0x1e34('0x17')](_0x1e34('0x22'),QUERY,_0x2c92fc,_0x34a5cc),{'type':dbH[_0x1e34('0x15')][_0x1e34('0x19')][_0x1e34('0x1a')]}));}}}else{_0x5b1f5a[_0x1e34('0x21')](dbH[_0x1e34('0x15')][_0x1e34('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x1e34('0x1a')]}));}var _0x1f6336=path[_0x1e34('0x23')](PATH);var _0x57b06c=path[_0x1e34('0x24')](PATH,'.csv');var _0x1a1f32=_0x37c791[_0x1e34('0x1c')]&&_0x5b1f5a['length']>0x1;var _0x11ffda=[];if(!fs[_0x1e34('0x25')](path['join'](_0x1f6336,_0x57b06c))&&_0x1a1f32){fs[_0x1e34('0x26')](path[_0x1e34('0x27')](_0x1f6336,_0x57b06c));}return BPromise['each'](_0x5b1f5a,function(_0x52d959){_0x11ffda[_0x1e34('0x21')](_0x52d959);})[_0x1e34('0x14')](function(){for(var _0x38540c=0x0;_0x38540c<_0x11ffda[_0x1e34('0x1d')];_0x38540c+=0x1){var _0xea0da;var _0x375a96=_0x11ffda[_0x38540c];if(_0x1a1f32){_0xea0da=path[_0x1e34('0x27')](_0x1f6336,_0x57b06c,util[_0x1e34('0x17')](_0x1e34('0x28'),_0x57b06c,_0x38540c,_0x1e34('0x29')));}else{_0xea0da=path[_0x1e34('0x27')](_0x1f6336,util[_0x1e34('0x17')]('%s.%s',_0x57b06c,_0x1e34('0x29')));}fs[_0x1e34('0x2a')](_0xea0da,csv(_0x375a96));}})[_0x1e34('0x14')](function(){if(_0x1a1f32){return new Promise(function(_0x1e7a80){zipdir(path[_0x1e34('0x27')](_0x1f6336,_0x57b06c),{'saveTo':path[_0x1e34('0x27')](_0x1f6336,util[_0x1e34('0x17')](_0x1e34('0x2b'),_0x57b06c,'zip'))},function(_0x25df99,_0x5fc573){rimraf(path[_0x1e34('0x27')](_0x1f6336,_0x57b06c),function(){});_0x1e7a80('zip\x20finished');});});}})[_0x1e34('0x14')](function(){logger['info'](util[_0x1e34('0x17')](_0x1e34('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x1a1f32?util[_0x1e34('0x17')](_0x1e34('0x2b'),_0x57b06c,_0x1a1f32?'zip':_0x1e34('0x29')):null);});})[_0x1e34('0x2d')](function(_0x3de6bd){logger['info'](util[_0x1e34('0x17')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1e34('0x10')),util[_0x1e34('0x2e')](_0x3de6bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1e34('0x2f')](function(){process[_0x1e34('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8f4b6e4..1c603e1 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 _0xe62e=['body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','header','pageBreak','before','margin','\x20/\x20','Arial','black','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','basename','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto'];(function(_0x16dacd,_0x4d8722){var _0x1f8166=function(_0x539d5a){while(--_0x539d5a){_0x16dacd['push'](_0x16dacd['shift']());}};_0x1f8166(++_0x4d8722);}(_0xe62e,0x148));var _0xee62=function(_0x3342fb,_0x132777){_0x3342fb=_0x3342fb-0x0;var _0x17641d=_0xe62e[_0x3342fb];return _0x17641d;};'use strict';var _=require(_0xee62('0x0'));var fs=require('fs');var util=require(_0xee62('0x1'));var path=require(_0xee62('0x2'));var moment=require(_0xee62('0x3'));var htmlToPdfmake=require(_0xee62('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xee62('0x5'));var JSDOM=require(_0xee62('0x6'))[_0xee62('0x7')];var window=new JSDOM('')[_0xee62('0x8')];var BPromise=require(_0xee62('0x9'));var db=require(_0xee62('0xa'))['db'];var dbH=require('../../mysqldb')[_0xee62('0xb')];var logger=require(_0xee62('0xc'))(_0xee62('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xee62('0xe')][0x2]);var QUERY=process[_0xee62('0xe')][0x3];var PATH=process[_0xee62('0xe')][0x4];var NAME=process[_0xee62('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b1353,_0x44b238){var _0x448c5f={'status':_0x5b1353};var _0x3babf5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44b238){_0x448c5f[_0xee62('0xf')]=_0x44b238;}return db[_0xee62('0x10')][_0xee62('0x11')](_0x448c5f,_0x3babf5);}function getHeaders(_0x35d3ae){return _[_0xee62('0x12')](_0x35d3ae,function(_0x77e6db){return{'text':_0x77e6db,'style':'tableHeader'};});}function getRows(_0x1bf14c,_0x3586ea){return _[_0xee62('0x12')](_0x3586ea,function(_0x170229){return _(_0x170229)[_0xee62('0x13')](_0x1bf14c)['map'](function(_0x5c7782){return _0x5c7782?_[_0xee62('0x14')](_0x5c7782):'';})['value']();});}function createTable(_0x168b25,_0x520ebc){var _0x38a02={'widths':_[_0xee62('0x15')](Array(_0x168b25[_0xee62('0x16')]),0x91),'heights':function(_0x3fd8b6){return _0x3fd8b6===0x0?_0xee62('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x49073f=getHeaders(_0x168b25);_0x38a02[_0xee62('0x18')][_0xee62('0x19')](_0x49073f);var _0x42e42e=getRows(_0x168b25,_0x520ebc);_0x38a02[_0xee62('0x18')]=_0x38a02[_0xee62('0x18')][_0xee62('0x1a')](_0x42e42e);return _0x38a02;}function createTables(_0xe37024){var _0x54f3e9=[];var _0x550e13=_['chunk'](Object[_0xee62('0x1b')](_0xe37024[0x0]),0x5);_0x550e13[_0xee62('0x1c')](function(_0x134c4f){_0x54f3e9[_0xee62('0x19')](createTable(_0x134c4f,_0xe37024));});return _0x54f3e9;}function getPDFDocDefinition(_0x219f3f){var _0x217c17=util[_0xee62('0x1d')](_0xee62('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xee62('0x1d')](FORMAT));var _0x3aa7cd=[];for(var _0x4b7fef=0x0;_0x4b7fef<_0x219f3f[_0xee62('0x16')];_0x4b7fef++){var _0x9007c6=[];if(_0x4b7fef===0x0){_0x9007c6[_0xee62('0x19')]({'text':_0x217c17,'style':_0xee62('0x1f')});}var _0x37fdd1={'table':_0x219f3f[_0x4b7fef]};if(_0x4b7fef>0x0){_0x37fdd1[_0xee62('0x20')]=_0xee62('0x21');_0x37fdd1[_0xee62('0x22')]=[0x0,0x46,0x0,0x0];}_0x9007c6[_0xee62('0x19')](_0x37fdd1);_0x3aa7cd[_0xee62('0x19')](_0x9007c6);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3aa7cd,'footer':function(_0x29f584,_0x20ee5a){return{'text':_0x29f584[_0xee62('0x14')]()+_0xee62('0x23')+_0x20ee5a,'style':'footer'};},'defaultStyle':{'font':_0xee62('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xee62('0x25')},'footer':{'alignment':_0xee62('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2e08ce){var _0x503ba5=0x1388;var _0x285c09;if(!_0x2e08ce[0x0][_0xee62('0x27')]){return analyticExtractedReport(_0xee62('0x28'));}return db['Setting'][_0xee62('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee62('0x2a'),_0xee62('0x2b')]})[_0xee62('0x2c')](function(_0x4433f1){if(_0x4433f1){_0x285c09=_0x4433f1;_0x503ba5=_0x285c09[_0xee62('0x2b')]||0x3e8;}})[_0xee62('0x2c')](function(){var _0xf2aed7=[];var _0x56e250=0x0;if(_0x285c09[_0xee62('0x2a')]){if(_0x2e08ce&&_0x2e08ce[_0xee62('0x16')]){var _0x523d9b=_[_0xee62('0x2d')](_0x2e08ce[0x0][_0xee62('0x27')]/_0x503ba5);var _0x1f813e=Number[_0xee62('0x2e')](_0x2e08ce[0x0][_0xee62('0x27')]/_0x503ba5)?_0x2e08ce[0x0][_0xee62('0x27')]%_0x503ba5:0x0;_0x523d9b[_0xee62('0x1c')](function(_0x264d06){if(_0x264d06>0x0){_0x56e250+=_0x503ba5;}_0xf2aed7[_0xee62('0x19')](dbH[_0xee62('0x2f')][_0xee62('0x30')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x503ba5,_0x56e250),{'type':dbH['sequelize'][_0xee62('0x31')][_0xee62('0x32')]}));});if(_0x1f813e>0x0){_0x56e250+=_0x503ba5;_0xf2aed7[_0xee62('0x19')](dbH[_0xee62('0x2f')]['query'](util[_0xee62('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1f813e,_0x56e250),{'type':dbH[_0xee62('0x2f')]['QueryTypes'][_0xee62('0x32')]}));}}}else{_0xf2aed7[_0xee62('0x19')](dbH[_0xee62('0x2f')][_0xee62('0x30')](QUERY,{'type':dbH[_0xee62('0x2f')][_0xee62('0x31')][_0xee62('0x32')]}));}var _0x2bab74=path[_0xee62('0x33')](PATH);var _0x4fd718=path[_0xee62('0x34')](PATH,'.pdf');var _0x4cef23=_0x285c09['split']&&_0xf2aed7[_0xee62('0x16')]>0x1;var _0x4ed2af=[];if(!fs['existsSync'](path[_0xee62('0x35')](_0x2bab74,_0x4fd718))&&_0x4cef23){fs[_0xee62('0x36')](path['join'](_0x2bab74,_0x4fd718));}return BPromise[_0xee62('0x37')](_0xf2aed7,function(_0x4c7b81){_0x4ed2af[_0xee62('0x19')](_0x4c7b81);})[_0xee62('0x2c')](function(){var _0xc1f4c2=[];for(var _0xfffed3=0x0;_0xfffed3<_0x4ed2af[_0xee62('0x16')];_0xfffed3+=0x1){var _0xf638b3=_0x4ed2af[_0xfffed3];var _0x2226b=createTables(_[_0xee62('0x38')](_0xf638b3));var _0x390ff7;var _0x207859=getPDFDocDefinition(_0x2226b);var _0x3a0f21=getPDFPrinter();var _0x13bd34=_0x3a0f21[_0xee62('0x39')](_0x207859);if(_0x4cef23){_0x390ff7=path[_0xee62('0x35')](_0x2bab74,_0x4fd718,util[_0xee62('0x1d')](_0xee62('0x3a'),_0x4fd718,_0xfffed3,_0xee62('0x3b')));}else{_0x390ff7=path['join'](_0x2bab74,util['format']('%s.%s',_0x4fd718,_0xee62('0x3b')));}_0xc1f4c2[_0xee62('0x19')](writePDFDocument(_0x13bd34,_0x390ff7));}return Promise[_0xee62('0x3c')](_0xc1f4c2);})['then'](function(){if(_0x4cef23){return new Promise(function(_0x3bec58){zipdir(path[_0xee62('0x35')](_0x2bab74,_0x4fd718),{'saveTo':path[_0xee62('0x35')](_0x2bab74,util[_0xee62('0x1d')]('%s.%s',_0x4fd718,_0xee62('0x3d')))},function(){rimraf(path[_0xee62('0x35')](_0x2bab74,_0x4fd718),function(){});_0x3bec58(_0xee62('0x3e'));});});}})[_0xee62('0x2c')](function(){if(!_0x4cef23)return;rimraf(path[_0xee62('0x35')](_0x2bab74,_0x4fd718),function(){});})[_0xee62('0x2c')](function(){logger[_0xee62('0x3f')](util[_0xee62('0x1d')](_0xee62('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xee62('0x41'),_0x4cef23?util['format'](_0xee62('0x42'),_0x4fd718,_0x4cef23?'zip':_0xee62('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xee62('0x3f')](util['format'](_0xee62('0x43'),EXTRACTED_REPORT_ID,_0xee62('0x44')));return db[_0xee62('0x10')][_0xee62('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xee62('0x2c')](function(_0x551606){EXTRACTED_REPORT=_0x551606;return dbH['sequelize'][_0xee62('0x30')](util[_0xee62('0x1d')](_0xee62('0x46'),QUERY),{'type':dbH[_0xee62('0x2f')][_0xee62('0x31')][_0xee62('0x32')]});})[_0xee62('0x2c')](extractReport)[_0xee62('0x47')](function(_0x2612b5){logger[_0xee62('0x3f')](util[_0xee62('0x1d')](_0xee62('0x48'),EXTRACTED_REPORT_ID,_0xee62('0x44')),util[_0xee62('0x49')](_0x2612b5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xee62('0x4a'));})['finally'](function(){process[_0xee62('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x16552f=new PdfPrinter({'Arial':{'normal':__dirname+_0xee62('0x4c'),'bold':__dirname+_0xee62('0x4d'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x16552f;}function getPDFDocDefinitionFromHTML(_0x3e37a4,_0x356110){var _0x58f284=util[_0xee62('0x1d')](_0xee62('0x4e'),_0x356110['channel'],_0x356110[_0xee62('0x4f')]);var _0x469a17=moment()[_0xee62('0x1d')](_0xee62('0x50'))[_0xee62('0x14')]();var _0x53c7fd=htmlToPdfmake(_0x3e37a4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x53c7fd],'defaultStyle':{'font':_0xee62('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xee62('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xee62('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xee62('0x51')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xee62('0x1f')}];},'footer':function(_0x5b5d9d,_0x1394d7){return[{'text':util[_0xee62('0x1d')](_0xee62('0x52'),_0x58f284,_0x5b5d9d,_0x1394d7,_0x469a17),'style':_0xee62('0x53')}];}};}function writePDFDocument(_0x46d727,_0x3bc49f){return new Promise(function(_0x1ed0e3,_0x4edbeb){var _0x4e91f9=_0x46d727[_0xee62('0x54')](fs[_0xee62('0x55')](_0x3bc49f));_0x4e91f9['on'](_0xee62('0x56'),function(){_0x1ed0e3(_0xee62('0x56'));});_0x4e91f9['on']('error',function(_0xf298db){_0x4edbeb(_0xf298db);});_0x46d727['end']();});}exports[_0xee62('0x57')]=function(_0x547d7c,_0x8523f2){var _0x460f1a=getPDFPrinter();var _0x3a7da1=getPDFDocDefinitionFromHTML(_0x547d7c,_0x8523f2);var _0x2ee3b5=_0x460f1a['createPdfKitDocument'](_0x3a7da1);return writePDFDocument(_0x2ee3b5,_0x8523f2[_0xee62('0x2')])[_0xee62('0x47')](function(_0x31fbd7){throw _0x31fbd7;});}; \ No newline at end of file +var _0x1bb0=['zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','util','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','map','pick','toString','value','fill','length','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','push','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','splitSizePdf','then','split','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s'];(function(_0x6f8972,_0x343da7){var _0x5677d9=function(_0x5eb51f){while(--_0x5eb51f){_0x6f8972['push'](_0x6f8972['shift']());}};_0x5677d9(++_0x343da7);}(_0x1bb0,0x164));var _0x01bb=function(_0xf4ddd6,_0xc848fd){_0xf4ddd6=_0xf4ddd6-0x0;var _0x228c0d=_0x1bb0[_0xf4ddd6];return _0x228c0d;};'use strict';var _=require(_0x01bb('0x0'));var fs=require('fs');var util=require(_0x01bb('0x1'));var path=require('path');var moment=require(_0x01bb('0x2'));var htmlToPdfmake=require(_0x01bb('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x01bb('0x4'));var rimraf=require(_0x01bb('0x5'));var JSDOM=require(_0x01bb('0x6'))[_0x01bb('0x7')];var window=new JSDOM('')[_0x01bb('0x8')];var BPromise=require('bluebird');var db=require(_0x01bb('0x9'))['db'];var dbH=require('../../mysqldb')[_0x01bb('0xa')];var logger=require(_0x01bb('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x01bb('0xc')][0x2]);var QUERY=process[_0x01bb('0xc')][0x3];var PATH=process[_0x01bb('0xc')][0x4];var NAME=process[_0x01bb('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x260a11,_0x3986b6){var _0xd05329={'status':_0x260a11};var _0x59b991={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3986b6){_0xd05329['savename']=_0x3986b6;}return db['AnalyticExtractedReport']['update'](_0xd05329,_0x59b991);}function getHeaders(_0x28b7fa){return _[_0x01bb('0xd')](_0x28b7fa,function(_0x270964){return{'text':_0x270964,'style':'tableHeader'};});}function getRows(_0xf69a75,_0x4feaa8){return _[_0x01bb('0xd')](_0x4feaa8,function(_0x3cc204){return _(_0x3cc204)[_0x01bb('0xe')](_0xf69a75)[_0x01bb('0xd')](function(_0x28f34b){return _0x28f34b?_[_0x01bb('0xf')](_0x28f34b):'';})[_0x01bb('0x10')]();});}function createTable(_0x4a7f65,_0x330baf){var _0xb92b29={'widths':_[_0x01bb('0x11')](Array(_0x4a7f65[_0x01bb('0x12')]),0x91),'heights':function(_0x4eca95){return _0x4eca95===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x149266=getHeaders(_0x4a7f65);_0xb92b29['body']['push'](_0x149266);var _0x47bf57=getRows(_0x4a7f65,_0x330baf);_0xb92b29[_0x01bb('0x13')]=_0xb92b29[_0x01bb('0x13')][_0x01bb('0x14')](_0x47bf57);return _0xb92b29;}function createTables(_0x4dee29){var _0x44de97=[];var _0x36e2a9=_[_0x01bb('0x15')](Object[_0x01bb('0x16')](_0x4dee29[0x0]),0x5);_0x36e2a9[_0x01bb('0x17')](function(_0x2453f6){_0x44de97['push'](createTable(_0x2453f6,_0x4dee29));});return _0x44de97;}function getPDFDocDefinition(_0x23148c){var _0xa661c0=util[_0x01bb('0x18')](_0x01bb('0x19'),NAME,EXTRACTED_REPORT[_0x01bb('0x1a')],moment(EXTRACTED_REPORT['startDate'])[_0x01bb('0x18')](FORMAT),moment(EXTRACTED_REPORT[_0x01bb('0x1b')])[_0x01bb('0x18')](FORMAT));var _0x342f5a=[];for(var _0x31dc3b=0x0;_0x31dc3b<_0x23148c['length'];_0x31dc3b++){var _0x517afb=[];if(_0x31dc3b===0x0){_0x517afb[_0x01bb('0x1c')]({'text':_0xa661c0,'style':_0x01bb('0x1d')});}var _0xb0f3ba={'table':_0x23148c[_0x31dc3b]};if(_0x31dc3b>0x0){_0xb0f3ba[_0x01bb('0x1e')]=_0x01bb('0x1f');_0xb0f3ba[_0x01bb('0x20')]=[0x0,0x46,0x0,0x0];}_0x517afb[_0x01bb('0x1c')](_0xb0f3ba);_0x342f5a[_0x01bb('0x1c')](_0x517afb);}return{'pageSize':'A4','pageOrientation':_0x01bb('0x21'),'content':_0x342f5a,'footer':function(_0x2a491b,_0x3f807e){return{'text':_0x2a491b['toString']()+_0x01bb('0x22')+_0x3f807e,'style':_0x01bb('0x23')};},'defaultStyle':{'font':_0x01bb('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x01bb('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x126fc8){var _0x5e30e5=0x1388;var _0x283df7;if(!_0x126fc8[0x0][_0x01bb('0x26')]){return analyticExtractedReport(_0x01bb('0x27'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x01bb('0x28')]})[_0x01bb('0x29')](function(_0x382a21){if(_0x382a21){_0x283df7=_0x382a21;_0x5e30e5=_0x283df7[_0x01bb('0x28')]||0x3e8;}})[_0x01bb('0x29')](function(){var _0x1ab3fa=[];var _0x416cb6=0x0;if(_0x283df7[_0x01bb('0x2a')]){if(_0x126fc8&&_0x126fc8['length']){var _0x74a103=_['range'](_0x126fc8[0x0][_0x01bb('0x26')]/_0x5e30e5);var _0x6239bd=Number[_0x01bb('0x2b')](_0x126fc8[0x0]['num']/_0x5e30e5)?_0x126fc8[0x0][_0x01bb('0x26')]%_0x5e30e5:0x0;_0x74a103[_0x01bb('0x17')](function(_0x19175e){if(_0x19175e>0x0){_0x416cb6+=_0x5e30e5;}_0x1ab3fa['push'](dbH['sequelize'][_0x01bb('0x2c')](util[_0x01bb('0x18')](_0x01bb('0x2d'),QUERY,_0x5e30e5,_0x416cb6),{'type':dbH[_0x01bb('0x2e')]['QueryTypes'][_0x01bb('0x2f')]}));});if(_0x6239bd>0x0){_0x416cb6+=_0x5e30e5;_0x1ab3fa[_0x01bb('0x1c')](dbH[_0x01bb('0x2e')][_0x01bb('0x2c')](util[_0x01bb('0x18')](_0x01bb('0x2d'),QUERY,_0x6239bd,_0x416cb6),{'type':dbH[_0x01bb('0x2e')]['QueryTypes'][_0x01bb('0x2f')]}));}}}else{_0x1ab3fa[_0x01bb('0x1c')](dbH[_0x01bb('0x2e')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x3efdb0=path[_0x01bb('0x30')](PATH);var _0xee438f=path[_0x01bb('0x31')](PATH,_0x01bb('0x32'));var _0x5110b9=_0x283df7['split']&&_0x1ab3fa[_0x01bb('0x12')]>0x1;var _0x41882c=[];if(!fs[_0x01bb('0x33')](path[_0x01bb('0x34')](_0x3efdb0,_0xee438f))&&_0x5110b9){fs[_0x01bb('0x35')](path[_0x01bb('0x34')](_0x3efdb0,_0xee438f));}return BPromise['each'](_0x1ab3fa,function(_0x2421d2){_0x41882c[_0x01bb('0x1c')](_0x2421d2);})[_0x01bb('0x29')](function(){var _0x11cdf6=[];for(var _0x33c153=0x0;_0x33c153<_0x41882c[_0x01bb('0x12')];_0x33c153+=0x1){var _0xb909c8=_0x41882c[_0x33c153];var _0xbc3761=createTables(_[_0x01bb('0x36')](_0xb909c8));var _0x141b02;var _0x39ba68=getPDFDocDefinition(_0xbc3761);var _0xc5daf3=getPDFPrinter();var _0x3c8d2e=_0xc5daf3[_0x01bb('0x37')](_0x39ba68);if(_0x5110b9){_0x141b02=path[_0x01bb('0x34')](_0x3efdb0,_0xee438f,util[_0x01bb('0x18')](_0x01bb('0x38'),_0xee438f,_0x33c153,_0x01bb('0x39')));}else{_0x141b02=path[_0x01bb('0x34')](_0x3efdb0,util[_0x01bb('0x18')]('%s.%s',_0xee438f,_0x01bb('0x39')));}_0x11cdf6['push'](writePDFDocument(_0x3c8d2e,_0x141b02));}return Promise['all'](_0x11cdf6);})[_0x01bb('0x29')](function(){if(_0x5110b9){return new Promise(function(_0x2fa893){zipdir(path['join'](_0x3efdb0,_0xee438f),{'saveTo':path[_0x01bb('0x34')](_0x3efdb0,util['format'](_0x01bb('0x3a'),_0xee438f,_0x01bb('0x3b')))},function(){rimraf(path['join'](_0x3efdb0,_0xee438f),function(){});_0x2fa893(_0x01bb('0x3c'));});});}})[_0x01bb('0x29')](function(){if(!_0x5110b9)return;rimraf(path['join'](_0x3efdb0,_0xee438f),function(){});})[_0x01bb('0x29')](function(){logger[_0x01bb('0x3d')](util[_0x01bb('0x18')](_0x01bb('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x01bb('0x3f'),_0x5110b9?util['format']('%s.%s',_0xee438f,_0x5110b9?_0x01bb('0x3b'):_0x01bb('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x01bb('0x3d')](util[_0x01bb('0x18')](_0x01bb('0x40'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x01bb('0x41')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2f08f6){EXTRACTED_REPORT=_0x2f08f6;return dbH[_0x01bb('0x2e')][_0x01bb('0x2c')](util[_0x01bb('0x18')](_0x01bb('0x42'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x01bb('0x29')](extractReport)[_0x01bb('0x43')](function(_0x34a4b9){logger['info'](util[_0x01bb('0x18')](_0x01bb('0x44'),EXTRACTED_REPORT_ID,_0x01bb('0x45')),util[_0x01bb('0x46')](_0x34a4b9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x01bb('0x47'));})[_0x01bb('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5da4bf=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x01bb('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x01bb('0x4a')}});return _0x5da4bf;}function getPDFDocDefinitionFromHTML(_0x2fbd95,_0x54dc3b){var _0x48ab61=util[_0x01bb('0x18')]('%s\x20#%d',_0x54dc3b['channel'],_0x54dc3b['interactionId']);var _0x1923df=moment()[_0x01bb('0x18')]('YYYY-MM-DD')[_0x01bb('0xf')]();var _0x8e5a85=htmlToPdfmake(_0x2fbd95,{'window':window,'tableAutoSize':!![]});return{'content':[_0x8e5a85],'defaultStyle':{'font':_0x01bb('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x01bb('0x4b'),'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':_0x01bb('0x4b')}},'header':function(){return[{'text':_0x01bb('0x4c'),'style':'header'}];},'footer':function(_0x103bcb,_0x1ee12e){return[{'text':util[_0x01bb('0x18')](_0x01bb('0x4d'),_0x48ab61,_0x103bcb,_0x1ee12e,_0x1923df),'style':'footer'}];}};}function writePDFDocument(_0x234cb0,_0xb21197){return new Promise(function(_0x5af19e,_0x317bfa){var _0x203fdf=_0x234cb0[_0x01bb('0x4e')](fs[_0x01bb('0x4f')](_0xb21197));_0x203fdf['on']('finish',function(){_0x5af19e(_0x01bb('0x50'));});_0x203fdf['on']('error',function(_0x5baa60){_0x317bfa(_0x5baa60);});_0x234cb0[_0x01bb('0x51')]();});}exports[_0x01bb('0x52')]=function(_0x66a98,_0x5da7b1){var _0x209342=getPDFPrinter();var _0x6d9285=getPDFDocDefinitionFromHTML(_0x66a98,_0x5da7b1);var _0x41a6e0=_0x209342[_0x01bb('0x37')](_0x6d9285);return writePDFDocument(_0x41a6e0,_0x5da7b1['path'])['catch'](function(_0x16e90d){throw _0x16e90d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 6509a25..992ee6d 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 _0x7ff9=['join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','sequelize','query','QueryTypes','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','length','existsSync'];(function(_0x5c8aa5,_0x1662f4){var _0x4edb22=function(_0xafb6d8){while(--_0xafb6d8){_0x5c8aa5['push'](_0x5c8aa5['shift']());}};_0x4edb22(++_0x1662f4);}(_0x7ff9,0x78));var _0x97ff=function(_0x1ce5a0,_0x5dd0b6){_0x1ce5a0=_0x1ce5a0-0x0;var _0x153008=_0x7ff9[_0x1ce5a0];return _0x153008;};'use strict';var util=require(_0x97ff('0x0'));var path=require(_0x97ff('0x1'));var _=require(_0x97ff('0x2'));var fs=require('fs');var json2xls=require(_0x97ff('0x3'));var BPromise=require(_0x97ff('0x4'));var zipdir=require(_0x97ff('0x5'));var rimraf=require(_0x97ff('0x6'));var db=require(_0x97ff('0x7'))['db'];var dbH=require(_0x97ff('0x7'))['dbH'];var logger=require(_0x97ff('0x8'))(_0x97ff('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c249b,_0xb4a738){var _0x5e2228={'status':_0x1c249b};var _0x5bb638={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb4a738){_0x5e2228[_0x97ff('0xa')]=_0xb4a738;}return db[_0x97ff('0xb')][_0x97ff('0xc')](_0x5e2228,_0x5bb638);}function main(){var _0x4ce0e5=0x1388;var _0x5c5c08;logger[_0x97ff('0xd')](util[_0x97ff('0xe')](_0x97ff('0xf'),EXTRACTED_REPORT_ID,_0x97ff('0x10')));return db[_0x97ff('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x97ff('0x12'),'splitSizeXlsx']})[_0x97ff('0x13')](function(_0x5efad9){if(_0x5efad9){_0x5c5c08=_0x5efad9;_0x4ce0e5=_0x5c5c08['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x97ff('0x14')][_0x97ff('0x15')](util[_0x97ff('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x97ff('0x14')][_0x97ff('0x16')]['SELECT']});})[_0x97ff('0x13')](function(_0x4f3d67){if(!_0x4f3d67[0x0][_0x97ff('0x17')]){return analyticExtractedReport(_0x97ff('0x18'));}var _0x5db2b4=[];var _0x282102=0x0;if(_0x5c5c08[_0x97ff('0x12')]){if(_0x4f3d67&&_0x4f3d67['length']){var _0x482ef8=_[_0x97ff('0x19')](_0x4f3d67[0x0][_0x97ff('0x17')]/_0x4ce0e5);var _0x2edea4=Number[_0x97ff('0x1a')](_0x4f3d67[0x0][_0x97ff('0x17')]/_0x4ce0e5)?_0x4f3d67[0x0][_0x97ff('0x17')]%_0x4ce0e5:0x0;_0x482ef8[_0x97ff('0x1b')](function(_0x30e0c6){if(_0x30e0c6>0x0){_0x282102+=_0x4ce0e5;}_0x5db2b4[_0x97ff('0x1c')](dbH[_0x97ff('0x14')][_0x97ff('0x15')](util[_0x97ff('0xe')](_0x97ff('0x1d'),QUERY,_0x4ce0e5,_0x282102),{'type':dbH[_0x97ff('0x14')]['QueryTypes'][_0x97ff('0x1e')]}));});if(_0x2edea4>0x0){_0x282102+=_0x4ce0e5;_0x5db2b4[_0x97ff('0x1c')](dbH[_0x97ff('0x14')][_0x97ff('0x15')](util['format'](_0x97ff('0x1d'),QUERY,_0x2edea4,_0x282102),{'type':dbH[_0x97ff('0x14')][_0x97ff('0x16')][_0x97ff('0x1e')]}));}}}else{_0x5db2b4[_0x97ff('0x1c')](dbH['sequelize'][_0x97ff('0x15')](QUERY,{'type':dbH[_0x97ff('0x14')][_0x97ff('0x16')][_0x97ff('0x1e')]}));}var _0x3b4a20=path[_0x97ff('0x1f')](PATH);var _0x17f1a6=path[_0x97ff('0x20')](PATH,_0x97ff('0x21'));var _0xb90148=_0x5c5c08['split']&&_0x5db2b4[_0x97ff('0x22')]>0x1;var _0x2b4870=[];if(!fs[_0x97ff('0x23')](path[_0x97ff('0x24')](_0x3b4a20,_0x17f1a6))&&_0xb90148){fs[_0x97ff('0x25')](path[_0x97ff('0x24')](_0x3b4a20,_0x17f1a6));}return BPromise[_0x97ff('0x26')](_0x5db2b4,function(_0x2756b8){_0x2b4870[_0x97ff('0x1c')](_0x2756b8);})['then'](function(){for(var _0x18a9f6=0x0;_0x18a9f6<_0x2b4870[_0x97ff('0x22')];_0x18a9f6+=0x1){var _0x2fbe88;var _0x3980e2=_0x2b4870[_0x18a9f6];if(_0xb90148){_0x2fbe88=path[_0x97ff('0x24')](_0x3b4a20,_0x17f1a6,util[_0x97ff('0xe')](_0x97ff('0x27'),_0x17f1a6,_0x18a9f6,'xlsx'));}else{_0x2fbe88=path[_0x97ff('0x24')](_0x3b4a20,util[_0x97ff('0xe')]('%s.%s',_0x17f1a6,_0x97ff('0x28')));}fs[_0x97ff('0x29')](_0x2fbe88,json2xls(_0x3980e2),_0x97ff('0x2a'));}})['then'](function(){if(_0xb90148){return new Promise(function(_0x57e471){zipdir(path[_0x97ff('0x24')](_0x3b4a20,_0x17f1a6),{'saveTo':path[_0x97ff('0x24')](_0x3b4a20,util[_0x97ff('0xe')](_0x97ff('0x2b'),_0x17f1a6,'zip'))},function(_0xc4201,_0x1a075a){rimraf(path['join'](_0x3b4a20,_0x17f1a6),function(){});_0x57e471(_0x97ff('0x2c'));});});}})['then'](function(){logger[_0x97ff('0xd')](util[_0x97ff('0xe')](_0x97ff('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xb90148?util['format']('%s.%s',_0x17f1a6,_0xb90148?'zip':_0x97ff('0x28')):null);});})[_0x97ff('0x2e')](function(_0x376484){logger[_0x97ff('0xd')](util['format'](_0x97ff('0x2f'),EXTRACTED_REPORT_ID,_0x97ff('0x10')),util[_0x97ff('0x30')](_0x376484,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x97ff('0x31'));})[_0x97ff('0x32')](function(){process[_0x97ff('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1a05=['inspect','finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','then','splitSizeXlsx','sequelize','QueryTypes','num','split','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','existsSync','mkdirSync','join','each','push','%s%d.%s','%s.%s','xlsx','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x49e634,_0x29e51f){var _0x5a48d6=function(_0x36e172){while(--_0x36e172){_0x49e634['push'](_0x49e634['shift']());}};_0x5a48d6(++_0x29e51f);}(_0x1a05,0x153));var _0x51a0=function(_0x2f89f9,_0x42aea4){_0x2f89f9=_0x2f89f9-0x0;var _0x26e93c=_0x1a05[_0x2f89f9];return _0x26e93c;};'use strict';var util=require(_0x51a0('0x0'));var path=require(_0x51a0('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x51a0('0x2'));var BPromise=require(_0x51a0('0x3'));var zipdir=require(_0x51a0('0x4'));var rimraf=require(_0x51a0('0x5'));var db=require(_0x51a0('0x6'))['db'];var dbH=require(_0x51a0('0x6'))[_0x51a0('0x7')];var logger=require(_0x51a0('0x8'))(_0x51a0('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x51a0('0xa')][0x3];var PATH=process[_0x51a0('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4021ff,_0x1b4eb2){var _0x5b7db5={'status':_0x4021ff};var _0x1c3e49={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b4eb2){_0x5b7db5[_0x51a0('0xb')]=_0x1b4eb2;}return db['AnalyticExtractedReport'][_0x51a0('0xc')](_0x5b7db5,_0x1c3e49);}function main(){var _0x275935=0x1388;var _0x5461d9;logger[_0x51a0('0xd')](util[_0x51a0('0xe')](_0x51a0('0xf'),EXTRACTED_REPORT_ID,_0x51a0('0x10')));return db[_0x51a0('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x51a0('0x12')](function(_0x1c41cf){if(_0x1c41cf){_0x5461d9=_0x1c41cf;_0x275935=_0x5461d9[_0x51a0('0x13')]||0x1388;}})[_0x51a0('0x12')](function(){return dbH[_0x51a0('0x14')]['query'](util[_0x51a0('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x51a0('0x14')][_0x51a0('0x15')]['SELECT']});})['then'](function(_0x3c1866){if(!_0x3c1866[0x0][_0x51a0('0x16')]){return analyticExtractedReport('Empty');}var _0x275e90=[];var _0x516614=0x0;if(_0x5461d9[_0x51a0('0x17')]){if(_0x3c1866&&_0x3c1866[_0x51a0('0x18')]){var _0x199f44=_[_0x51a0('0x19')](_0x3c1866[0x0][_0x51a0('0x16')]/_0x275935);var _0x31a9e7=Number[_0x51a0('0x1a')](_0x3c1866[0x0][_0x51a0('0x16')]/_0x275935)?_0x3c1866[0x0][_0x51a0('0x16')]%_0x275935:0x0;_0x199f44[_0x51a0('0x1b')](function(_0x37ea2f){if(_0x37ea2f>0x0){_0x516614+=_0x275935;}_0x275e90['push'](dbH[_0x51a0('0x14')][_0x51a0('0x1c')](util[_0x51a0('0xe')](_0x51a0('0x1d'),QUERY,_0x275935,_0x516614),{'type':dbH['sequelize']['QueryTypes'][_0x51a0('0x1e')]}));});if(_0x31a9e7>0x0){_0x516614+=_0x275935;_0x275e90['push'](dbH[_0x51a0('0x14')]['query'](util['format'](_0x51a0('0x1d'),QUERY,_0x31a9e7,_0x516614),{'type':dbH['sequelize']['QueryTypes'][_0x51a0('0x1e')]}));}}}else{_0x275e90['push'](dbH['sequelize'][_0x51a0('0x1c')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x51a0('0x1e')]}));}var _0x1dbb57=path['dirname'](PATH);var _0x3f6d52=path[_0x51a0('0x1f')](PATH,_0x51a0('0x20'));var _0x5896c2=_0x5461d9[_0x51a0('0x17')]&&_0x275e90[_0x51a0('0x18')]>0x1;var _0x22148b=[];if(!fs[_0x51a0('0x21')](path['join'](_0x1dbb57,_0x3f6d52))&&_0x5896c2){fs[_0x51a0('0x22')](path[_0x51a0('0x23')](_0x1dbb57,_0x3f6d52));}return BPromise[_0x51a0('0x24')](_0x275e90,function(_0x1de7ba){_0x22148b[_0x51a0('0x25')](_0x1de7ba);})[_0x51a0('0x12')](function(){for(var _0x211364=0x0;_0x211364<_0x22148b[_0x51a0('0x18')];_0x211364+=0x1){var _0x445136;var _0x41563e=_0x22148b[_0x211364];if(_0x5896c2){_0x445136=path['join'](_0x1dbb57,_0x3f6d52,util[_0x51a0('0xe')](_0x51a0('0x26'),_0x3f6d52,_0x211364,'xlsx'));}else{_0x445136=path[_0x51a0('0x23')](_0x1dbb57,util['format'](_0x51a0('0x27'),_0x3f6d52,_0x51a0('0x28')));}fs['writeFileSync'](_0x445136,json2xls(_0x41563e),'binary');}})[_0x51a0('0x12')](function(){if(_0x5896c2){return new Promise(function(_0x17a070){zipdir(path['join'](_0x1dbb57,_0x3f6d52),{'saveTo':path['join'](_0x1dbb57,util[_0x51a0('0xe')](_0x51a0('0x27'),_0x3f6d52,'zip'))},function(_0x3a2428,_0x98178){rimraf(path[_0x51a0('0x23')](_0x1dbb57,_0x3f6d52),function(){});_0x17a070('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0x51a0('0xe')](_0x51a0('0x29'),EXTRACTED_REPORT_ID,_0x51a0('0x10')));return analyticExtractedReport(_0x51a0('0x2a'),_0x5896c2?util[_0x51a0('0xe')](_0x51a0('0x27'),_0x3f6d52,_0x5896c2?_0x51a0('0x2b'):_0x51a0('0x28')):null);});})['catch'](function(_0x202970){logger[_0x51a0('0xd')](util[_0x51a0('0xe')](_0x51a0('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x51a0('0x2d')](_0x202970,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x51a0('0x2e')](function(){process[_0x51a0('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e1e89aa..46d3954 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 _0x255c=['bulkCreate','sortBy','error','rewrite','lodash','Interval','findAll','then','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','VoiceExtensionId','inbound','type','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','map','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy'];(function(_0x44568e,_0x8cb4c3){var _0x172926=function(_0x682f3){while(--_0x682f3){_0x44568e['push'](_0x44568e['shift']());}};_0x172926(++_0x8cb4c3);}(_0x255c,0x8c));var _0xc255=function(_0x461fd5,_0x51747e){_0x461fd5=_0x461fd5-0x0;var _0x4e025b=_0x255c[_0x461fd5];return _0x4e025b;};'use strict';var _=require(_0xc255('0x0'));var util=require('util');function rewrite(_0x25a568,_0x311b42){var _0x108871=this;return _0x25a568['models'][_0xc255('0x1')][_0xc255('0x2')]({'raw':!![]})[_0xc255('0x3')](function(_0x44eb09){_0x108871['intervals']=_0x44eb09;return _0x25a568[_0xc255('0x4')][_0xc255('0x5')][_0xc255('0x2')]({'where':{'IntervalId':_0x311b42[_0xc255('0x6')]},'raw':!![]});})[_0xc255('0x3')](function(_0x4041d1){return _0x25a568['models'][_0xc255('0x5')][_0xc255('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x4041d1,_0xc255('0x7')))}},'order':[{'raw':_0xc255('0x8')}],'raw':!![]});})[_0xc255('0x3')](function(_0x494c89){var _0x2e1a55=_[_0xc255('0x9')](_0x494c89,{'priority':'1'});var _0xf39b74=_['filter'](_0x494c89,{'isApp':0x1});var _0x41a576=_[_0xc255('0xa')](_0xf39b74,_0xc255('0x7'));var _0x210cde=['queue',_0xc255('0xb')];var _0x8b646=[];var _0x26c052=[];for(var _0x15fdba in _0x41a576){if(_0x41a576[_0xc255('0xc')](_0x15fdba)){_0x108871[_0xc255('0xd')]=0x2;_0x108871[_0xc255('0xe')]=[];_0x108871[_0xc255('0xf')]=_[_0xc255('0x10')](_0x2e1a55,{'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')]});_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0]['type'],'app':_0xc255('0x12'),'appdata':util[_0xc255('0x13')]('CDR(type)=%s',_0x41a576[_0x15fdba][0x0]['type']),'context':_0x41a576[_0x15fdba][0x0]['context'],'exten':_0x41a576[_0x15fdba][0x0]['exten'],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});if(_0x41a576[_0x15fdba][0x0]['type']===_0xc255('0x15')){_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x17')+_0x41a576[_0x15fdba][0x0]['VoiceExtensionId'],'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});}else if(_0x41a576[_0x15fdba][0x0][_0xc255('0x16')]===_0xc255('0x19')){if(_0x108871['extension']){_0x108871[_0xc255('0xe')]['push']({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x1a')+(_0x108871[_0xc255('0xf')][_0xc255('0x1b')]?'${EXTEN:'+_0x108871[_0xc255('0xf')][_0xc255('0x1b')]+'}':'${EXTEN}'),'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});}_0x108871[_0xc255('0xe')]['push']({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x17')+_0x41a576[_0x15fdba][0x0][_0xc255('0x14')],'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});var _0x31dad0=_0x108871[_0xc255('0xd')]++;_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x31dad0+0x2)+_0xc255('0x1d')+(_0x31dad0+0x1)+')','context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0]['exten'],'priority':_0x31dad0,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});if(_0x108871[_0xc255('0xf')]){_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0]['type'],'app':_0xc255('0x12'),'appdata':_0x108871['extension'][_0xc255('0x1b')]?_0xc255('0x1e')+_0x108871[_0xc255('0xf')]['cutdigits']+'}':_0xc255('0x1f'),'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});}_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x20')+_0x41a576[_0x15fdba][0x0][_0xc255('0x14')],'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});if(_0x108871['extension']&&_0x108871['extension'][_0xc255('0xc')](_0xc255('0x21'))&&_0x108871['extension']['recordingFormat']!==_0xc255('0x22')){_0x108871['extensions'][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0]['type'],'app':_0xc255('0x12'),'appdata':_0xc255('0x23'),'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871['priority']++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':'Set','appdata':_0xc255('0x24')+_0x108871['extension']['recordingFormat']||'wav','context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871['priority']++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});}}_0x108871[_0xc255('0xe')]['push']({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x25'),'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871['priority']++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});_0x108871['extensions'][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':'Set','appdata':_0xc255('0x26'),'context':_0x41a576[_0x15fdba][0x0]['context'],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871['priority']++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});_0x108871['extensions']['push']({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x27'),'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'priority':_0x108871[_0xc255('0xd')]++,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});for(var _0x200a3c=0x0,_0x48ac8b=0x0;_0x200a3c<_0x41a576[_0x15fdba][_0xc255('0x28')];_0x200a3c+=0x1,_0x48ac8b=0x0){var _0x2fbbb1=_0x41a576[_0x15fdba][_0x200a3c];if(_0x2fbbb1['type']){_0x2fbbb1[_0xc255('0x16')]=_0x2fbbb1[_0xc255('0x16')][_0xc255('0x29')]();}var _0x53f6ae=[];var _0x4a7c12=[];delete _0x2fbbb1['id'];delete _0x2fbbb1[_0xc255('0x2a')];delete _0x2fbbb1['updatedAt'];var _0x41bcb7=_0x2fbbb1['interval']!==_0xc255('0x2b')?[_0x2fbbb1[_0xc255('0x2c')]]:_0x2fbbb1[_0xc255('0x6')]?_[_0xc255('0x2d')](_[_0xc255('0x9')](_0x108871[_0xc255('0x2e')],{'IntervalId':_0x2fbbb1[_0xc255('0x6')]}),_0xc255('0x2c')):[];if(_0x2fbbb1[_0xc255('0xc')](_0xc255('0x2f'))){if(_0x2fbbb1[_0xc255('0x2f')]&&_0x2fbbb1[_0xc255('0x2f')]!=='--'){_0x53f6ae[_0xc255('0x11')]({'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x30')+_0x2fbbb1[_0xc255('0x2f')],'context':_0x2fbbb1[_0xc255('0x18')],'exten':_0x2fbbb1[_0xc255('0x7')],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1[_0xc255('0x14')]});}}if(_0x2fbbb1[_0xc255('0x16')]===_0xc255('0x19')&&_0x2fbbb1[_0xc255('0xc')](_0xc255('0x31'))){if(_0x2fbbb1[_0xc255('0x31')]){_0x53f6ae['push']({'type':_0x2fbbb1[_0xc255('0x16')],'app':'ExecIf','appdata':_0xc255('0x32')+_0x2fbbb1[_0xc255('0x31')]+')','context':_0x2fbbb1[_0xc255('0x18')],'exten':_0x2fbbb1[_0xc255('0x7')],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1['VoiceExtensionId']});}else{_0x53f6ae['push']({'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x1c'),'appdata':_0xc255('0x33'),'context':_0x2fbbb1['context'],'exten':_0x2fbbb1[_0xc255('0x7')],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1['VoiceExtensionId']});}}if(_0x2fbbb1['hasOwnProperty'](_0xc255('0x34'))){if(_0x210cde[_0xc255('0x35')](_0x2fbbb1[_0xc255('0x36')][_0xc255('0x29')]())>=0x0&&_0x2fbbb1[_0xc255('0x37')]!=='custom'){if(_0x2fbbb1[_0xc255('0x34')]){_0x53f6ae[_0xc255('0x11')]({'type':_0x2fbbb1['type'],'app':_0xc255('0x1c'),'appdata':_0xc255('0x38'),'context':_0x2fbbb1[_0xc255('0x18')],'exten':_0x2fbbb1[_0xc255('0x7')],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1[_0xc255('0x14')]});_0x53f6ae[_0xc255('0x11')]({'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2fbbb1['context'],'exten':_0x2fbbb1['exten'],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1[_0xc255('0x14')]});}else{_0x53f6ae[_0xc255('0x11')]({'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2fbbb1['context'],'exten':_0x2fbbb1[_0xc255('0x7')],'priority':_0x41bcb7['length']+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1[_0xc255('0x14')]});_0x53f6ae['push']({'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x12'),'appdata':_0xc255('0x39'),'context':_0x2fbbb1[_0xc255('0x18')],'exten':_0x2fbbb1['exten'],'priority':_0x41bcb7[_0xc255('0x28')]+_0x108871[_0xc255('0xd')]+_0x48ac8b++,'VoiceExtensionId':_0x2fbbb1[_0xc255('0x14')]});}}}for(var _0x172443=0x0;_0x172443<_0x41bcb7['length'];_0x172443+=0x1){var _0x3a8a97=_0x108871[_0xc255('0xd')]+_0x41bcb7[_0xc255('0x28')];var _0x54c2eb=_0x172443===_0x41bcb7[_0xc255('0x28')]-0x1?_0x108871[_0xc255('0xd')]+_0x53f6ae[_0xc255('0x28')]+_0x4a7c12[_0xc255('0x28')]+0x2:_0x108871[_0xc255('0xd')]+_0x172443+0x1;_0x53f6ae[_0xc255('0x3a')](_0x172443,0x0,{'type':_0x2fbbb1[_0xc255('0x16')],'app':_0xc255('0x3b'),'appdata':_0x41bcb7[_0x172443]+'?'+_0x2fbbb1['context']+_0xc255('0x3c')+_0x3a8a97+':'+_0x2fbbb1['context']+_0xc255('0x3c')+_0x54c2eb,'exten':_0x2fbbb1[_0xc255('0x7')],'context':_0x2fbbb1[_0xc255('0x18')],'priority':_0x108871[_0xc255('0xd')]+_0x172443,'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});}_0x2fbbb1[_0xc255('0xd')]=_0x53f6ae[_0xc255('0x28')]?_[_0xc255('0x3d')](_0x53f6ae)[_0xc255('0xd')]+0x1:_0x108871[_0xc255('0xd')];_0x108871['priority']=(_0x4a7c12['length']?_[_0xc255('0x3d')](_0x4a7c12)[_0xc255('0xd')]:_0x2fbbb1[_0xc255('0xd')])+0x1;_0x108871[_0xc255('0xe')]=_[_0xc255('0x3e')](_0x108871['extensions'],_0x53f6ae,[_0x2fbbb1],_0x4a7c12);}_0x108871[_0xc255('0xe')][_0xc255('0x11')]({'type':_0x41a576[_0x15fdba][0x0][_0xc255('0x16')],'app':'Hangup','exten':_0x41a576[_0x15fdba][0x0][_0xc255('0x7')],'context':_0x41a576[_0x15fdba][0x0][_0xc255('0x18')],'priority':_0x108871[_0xc255('0xd')],'VoiceExtensionId':_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]});_0x8b646[_0xc255('0x11')](_0x41a576[_0x15fdba][0x0][_0xc255('0x14')]);_0x26c052=_[_0xc255('0x3e')](_0x26c052,_0x108871[_0xc255('0xe')]);}}return _0x25a568['transaction'](function(_0x5ebea1){return _0x25a568['models'][_0xc255('0x5')][_0xc255('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x8b646}},'transaction':_0x5ebea1})[_0xc255('0x3')](function(_0x48b772){return _0x25a568[_0xc255('0x4')][_0xc255('0x5')][_0xc255('0x40')](_[_0xc255('0x41')](_0x26c052,_0xc255('0xd')),{'transaction':_0x5ebea1});});});})['catch'](function(_0x4b1d81){console[_0xc255('0x42')](_0x4b1d81);});}exports[_0xc255('0x43')]=rewrite; \ No newline at end of file +var _0xc46e=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','find','extensions','push','Set','format','CDR(type)=%s','context','VoiceExtensionId','type','inbound','priority','extension','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','app','appType','custom','answer'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc46e,0x1ae));var _0xec46=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xc46e[_0x4c1ec2];return _0x3f6f1c;};'use strict';var _=require(_0xec46('0x0'));var util=require(_0xec46('0x1'));function rewrite(_0xb47f8c,_0x3b4224){var _0x19577c=this;return _0xb47f8c[_0xec46('0x2')]['Interval'][_0xec46('0x3')]({'raw':!![]})[_0xec46('0x4')](function(_0x488103){_0x19577c[_0xec46('0x5')]=_0x488103;return _0xb47f8c['models'][_0xec46('0x6')][_0xec46('0x3')]({'where':{'IntervalId':_0x3b4224['IntervalId']},'raw':!![]});})[_0xec46('0x4')](function(_0x2b6c9b){return _0xb47f8c['models'][_0xec46('0x6')][_0xec46('0x3')]({'where':{'exten':{'$in':_[_0xec46('0x7')](_['map'](_0x2b6c9b,_0xec46('0x8')))}},'order':[{'raw':_0xec46('0x9')}],'raw':!![]});})[_0xec46('0x4')](function(_0x27ca0a){var _0x21859d=_['filter'](_0x27ca0a,{'priority':'1'});var _0x5d99a5=_[_0xec46('0xa')](_0x27ca0a,{'isApp':0x1});var _0x190df6=_['groupBy'](_0x5d99a5,_0xec46('0x8'));var _0x155021=[_0xec46('0xb'),_0xec46('0xc')];var _0x953791=[];var _0xd48b4b=[];for(var _0x2ec5ff in _0x190df6){if(_0x190df6['hasOwnProperty'](_0x2ec5ff)){_0x19577c['priority']=0x2;_0x19577c['extensions']=[];_0x19577c['extension']=_[_0xec46('0xd')](_0x21859d,{'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')]});_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0]['type'],'app':_0xec46('0x10'),'appdata':util[_0xec46('0x11')](_0xec46('0x12'),_0x190df6[_0x2ec5ff][0x0]['type']),'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c['priority']++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});if(_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')]===_0xec46('0x16')){_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')],'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0]['VoiceExtensionId']});}else if(_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')]==='outbound'){if(_0x19577c[_0xec46('0x18')]){_0x19577c['extensions'][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':_0xec46('0x19')+(_0x19577c[_0xec46('0x18')][_0xec46('0x1a')]?'${EXTEN:'+_0x19577c[_0xec46('0x18')][_0xec46('0x1a')]+'}':_0xec46('0x1b')),'context':_0x190df6[_0x2ec5ff][0x0]['context'],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});}_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':_0xec46('0x1c')+_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')],'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0]['exten'],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});var _0x423fea=_0x19577c[_0xec46('0x17')]++;_0x19577c['extensions']['push']({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x1d'),'appdata':_0xec46('0x1e')+(_0x423fea+0x2)+_0xec46('0x1f')+(_0x423fea+0x1)+')','context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x423fea,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});if(_0x19577c[_0xec46('0x18')]){_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':'Set','appdata':_0x19577c['extension'][_0xec46('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x19577c['extension']['cutdigits']+'}':_0xec46('0x20'),'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c['priority']++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});}_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':_0xec46('0x21')+_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')],'context':_0x190df6[_0x2ec5ff][0x0]['context'],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});if(_0x19577c[_0xec46('0x18')]&&_0x19577c[_0xec46('0x18')][_0xec46('0x22')](_0xec46('0x23'))&&_0x19577c[_0xec46('0x18')][_0xec46('0x23')]!==_0xec46('0x24')){_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0]['exten'],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x19577c[_0xec46('0x18')]['recordingFormat']||_0xec46('0x25'),'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});}}_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':_0xec46('0x26'),'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});_0x19577c[_0xec46('0xe')][_0xec46('0xf')]({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':'Set','appdata':_0xec46('0x27'),'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});_0x19577c['extensions']['push']({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x10'),'appdata':'MONITOR_OPTIONS=ab','context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'exten':_0x190df6[_0x2ec5ff][0x0]['exten'],'priority':_0x19577c[_0xec46('0x17')]++,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0]['VoiceExtensionId']});for(var _0x4eae3e=0x0,_0x5d6cb1=0x0;_0x4eae3e<_0x190df6[_0x2ec5ff][_0xec46('0x28')];_0x4eae3e+=0x1,_0x5d6cb1=0x0){var _0x5af22b=_0x190df6[_0x2ec5ff][_0x4eae3e];if(_0x5af22b[_0xec46('0x15')]){_0x5af22b['type']=_0x5af22b[_0xec46('0x15')][_0xec46('0x29')]();}var _0x13ddb9=[];var _0x1adcd0=[];delete _0x5af22b['id'];delete _0x5af22b['createdAt'];delete _0x5af22b[_0xec46('0x2a')];var _0x370e9f=_0x5af22b[_0xec46('0x2b')]!==_0xec46('0x2c')?[_0x5af22b[_0xec46('0x2b')]]:_0x5af22b[_0xec46('0x2d')]?_['map'](_[_0xec46('0xa')](_0x19577c['intervals'],{'IntervalId':_0x5af22b[_0xec46('0x2d')]}),_0xec46('0x2b')):[];if(_0x5af22b[_0xec46('0x22')](_0xec46('0x2e'))){if(_0x5af22b[_0xec46('0x2e')]&&_0x5af22b[_0xec46('0x2e')]!=='--'){_0x13ddb9[_0xec46('0xf')]({'type':_0x5af22b[_0xec46('0x15')],'app':'Set','appdata':_0xec46('0x2f')+_0x5af22b['tag'],'context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b['exten'],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});}}if(_0x5af22b[_0xec46('0x15')]==='outbound'&&_0x5af22b[_0xec46('0x22')]('callerID')){if(_0x5af22b['callerID']){_0x13ddb9[_0xec46('0xf')]({'type':_0x5af22b[_0xec46('0x15')],'app':_0xec46('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5af22b[_0xec46('0x30')]+')','context':_0x5af22b['context'],'exten':_0x5af22b[_0xec46('0x8')],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});}else{_0x13ddb9['push']({'type':_0x5af22b[_0xec46('0x15')],'app':_0xec46('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b['exten'],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});}}if(_0x5af22b[_0xec46('0x22')]('answer')){if(_0x155021['indexOf'](_0x5af22b[_0xec46('0x31')][_0xec46('0x29')]())>=0x0&&_0x5af22b[_0xec46('0x32')]!==_0xec46('0x33')){if(_0x5af22b[_0xec46('0x34')]){_0x13ddb9[_0xec46('0xf')]({'type':_0x5af22b['type'],'app':_0xec46('0x1d'),'appdata':_0xec46('0x35'),'context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b[_0xec46('0x8')],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});_0x13ddb9[_0xec46('0xf')]({'type':_0x5af22b[_0xec46('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b[_0xec46('0x8')],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});}else{_0x13ddb9[_0xec46('0xf')]({'type':_0x5af22b[_0xec46('0x15')],'app':_0xec46('0x1d'),'appdata':_0xec46('0x36'),'context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b['exten'],'priority':_0x370e9f[_0xec46('0x28')]+_0x19577c['priority']+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});_0x13ddb9['push']({'type':_0x5af22b[_0xec46('0x15')],'app':'Set','appdata':_0xec46('0x37'),'context':_0x5af22b[_0xec46('0x13')],'exten':_0x5af22b[_0xec46('0x8')],'priority':_0x370e9f['length']+_0x19577c[_0xec46('0x17')]+_0x5d6cb1++,'VoiceExtensionId':_0x5af22b[_0xec46('0x14')]});}}}for(var _0x38cd7d=0x0;_0x38cd7d<_0x370e9f[_0xec46('0x28')];_0x38cd7d+=0x1){var _0x2257b7=_0x19577c['priority']+_0x370e9f['length'];var _0x3809a9=_0x38cd7d===_0x370e9f[_0xec46('0x28')]-0x1?_0x19577c[_0xec46('0x17')]+_0x13ddb9[_0xec46('0x28')]+_0x1adcd0[_0xec46('0x28')]+0x2:_0x19577c[_0xec46('0x17')]+_0x38cd7d+0x1;_0x13ddb9[_0xec46('0x38')](_0x38cd7d,0x0,{'type':_0x5af22b[_0xec46('0x15')],'app':_0xec46('0x39'),'appdata':_0x370e9f[_0x38cd7d]+'?'+_0x5af22b[_0xec46('0x13')]+_0xec46('0x3a')+_0x2257b7+':'+_0x5af22b['context']+_0xec46('0x3a')+_0x3809a9,'exten':_0x5af22b[_0xec46('0x8')],'context':_0x5af22b[_0xec46('0x13')],'priority':_0x19577c[_0xec46('0x17')]+_0x38cd7d,'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});}_0x5af22b[_0xec46('0x17')]=_0x13ddb9[_0xec46('0x28')]?_[_0xec46('0x3b')](_0x13ddb9)[_0xec46('0x17')]+0x1:_0x19577c['priority'];_0x19577c[_0xec46('0x17')]=(_0x1adcd0['length']?_[_0xec46('0x3b')](_0x1adcd0)[_0xec46('0x17')]:_0x5af22b[_0xec46('0x17')])+0x1;_0x19577c['extensions']=_[_0xec46('0x3c')](_0x19577c[_0xec46('0xe')],_0x13ddb9,[_0x5af22b],_0x1adcd0);}_0x19577c[_0xec46('0xe')]['push']({'type':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x15')],'app':_0xec46('0x3d'),'exten':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x8')],'context':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x13')],'priority':_0x19577c[_0xec46('0x17')],'VoiceExtensionId':_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]});_0x953791['push'](_0x190df6[_0x2ec5ff][0x0][_0xec46('0x14')]);_0xd48b4b=_[_0xec46('0x3c')](_0xd48b4b,_0x19577c[_0xec46('0xe')]);}}return _0xb47f8c[_0xec46('0x3e')](function(_0x3ee10b){return _0xb47f8c[_0xec46('0x2')]['VoiceExtension'][_0xec46('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x953791}},'transaction':_0x3ee10b})[_0xec46('0x4')](function(_0x23c333){return _0xb47f8c[_0xec46('0x2')][_0xec46('0x6')][_0xec46('0x40')](_[_0xec46('0x41')](_0xd48b4b,_0xec46('0x17')),{'transaction':_0x3ee10b});});});})[_0xec46('0x42')](function(_0x3e05cf){console[_0xec46('0x43')](_0x3e05cf);});}exports[_0xec46('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 647b8c5..c7d23ba 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 _0x8c7d=['dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','VoiceQueue','findAll','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','calleridnum','cm_hopper_final','id\x20IN\x20?','str','cm_hopper_black','outbound'];(function(_0x5415b2,_0x29c2bc){var _0x1ffc40=function(_0x5eb999){while(--_0x5eb999){_0x5415b2['push'](_0x5415b2['shift']());}};_0x1ffc40(++_0x29c2bc);}(_0x8c7d,0xfa));var _0xd8c7=function(_0x2818b6,_0x3f6f7f){_0x2818b6=_0x2818b6-0x0;var _0x4102f3=_0x8c7d[_0x2818b6];return _0x4102f3;};'use strict';var BPromise=require(_0xd8c7('0x0'));var util=require(_0xd8c7('0x1'));var _=require(_0xd8c7('0x2'));var fs=require('fs');var squel=require(_0xd8c7('0x3'));var Papa=require(_0xd8c7('0x4'));var Redis=require(_0xd8c7('0x5'));var db=require(_0xd8c7('0x6'))['db'];var config=require(_0xd8c7('0x7'));var logger=require(_0xd8c7('0x8'))('api');config['redis']=_[_0xd8c7('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd8c7('0xa'))(new Redis(config[_0xd8c7('0xb')]));require(_0xd8c7('0xc'))[_0xd8c7('0xd')](socket);try{if(!process[_0xd8c7('0xe')][0x2]||process[_0xd8c7('0xe')][0x2]===_0xd8c7('0xf')||process[_0xd8c7('0xe')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xd8c7('0xe')][0x2];if(!process[_0xd8c7('0xe')][0x3]||process[_0xd8c7('0xe')][0x3]==='undefined'||process[_0xd8c7('0xe')][0x3]===_0xd8c7('0x10')||!process['argv'][0x4]||process[_0xd8c7('0xe')][0x4]==='undefined'||process[_0xd8c7('0xe')][0x4]===_0xd8c7('0x10')){throw new Error(_0xd8c7('0x11'));}var FIELDS=_[_0xd8c7('0x12')](process[_0xd8c7('0xe')][0x3][_0xd8c7('0x13')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xd8c7('0xe')][0x5]===_0xd8c7('0xf')||process[_0xd8c7('0xe')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xd8c7('0xe')][0x6]!==_0xd8c7('0xf')&&process[_0xd8c7('0xe')][0x6]!==_0xd8c7('0x10')?process[_0xd8c7('0xe')][0x6]:null;var DUPLICATES=process[_0xd8c7('0xe')][0x7]&&process[_0xd8c7('0xe')][0x7]!==_0xd8c7('0xf')&&process[_0xd8c7('0xe')][0x7]!==_0xd8c7('0x10')?process['argv'][0x7]:null;if(!process[_0xd8c7('0xe')][0x8]||process['argv'][0x8]===_0xd8c7('0xf')||process[_0xd8c7('0xe')][0x8]===_0xd8c7('0x10')){throw new Error(_0xd8c7('0x14'));}var SOCKET_TIMESTAMP=process[_0xd8c7('0xe')][0x8];}catch(_0x23016d){logger[_0xd8c7('0x15')](_0x23016d);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(_0x30207e,_0x4482c1,_0x34874a,_0x3a3ce3){var _0x577d35={'message':_0x4482c1};_0x577d35[_0x30207e]=!![];if(_0x34874a){_0x577d35[_0xd8c7('0x16')]=_0x34874a;}if(_0x3a3ce3){_0x577d35[_0xd8c7('0x17')]=_0x3a3ce3;}return _0x577d35;}function isEmail(_0x55ce71){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))*$/[_0xd8c7('0x18')](_0x55ce71);}function checkRow(_0x20e390,_0x2020ff,_0x231293){return new BPromise(function(_0x376289,_0x58654f){if(_[_0xd8c7('0x19')](_0x20e390)){return _0x58654f(handleCheckRowError('error',_0xd8c7('0x1a'),null,_0x231293));}if(_0x20e390['errors']&&_0x20e390[_0xd8c7('0x1b')]['length']){var _0x7f97ca=_['map'](_0x20e390[_0xd8c7('0x1b')],_0xd8c7('0x1c'))[_0xd8c7('0x1d')](';');return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),_0x7f97ca,null,_0x231293));}var _0x1458b4={};for(var _0x3e9dea in FIELDS){if(FIELDS['hasOwnProperty'](_0x3e9dea)&&FIELDS[_0x3e9dea]){_0x1458b4[_0x3e9dea]=_0x20e390[_0xd8c7('0x1e')][0x0][FIELDS[_0x3e9dea]]||_0x20e390['data'][0x0]['\ufeff'+FIELDS[_0x3e9dea]];}}if(!_0x1458b4[_0xd8c7('0x1f')]){return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),'firstName\x20not\x20specified!',null,_0x231293));}if(!_0x1458b4['phone']){return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),_0xd8c7('0x20'),null,_0x231293));}if(_0x1458b4[_0xd8c7('0x21')]){var _0x3efd94=moment(_0x1458b4[_0xd8c7('0x21')],_0xd8c7('0x22'));if(!_0x3efd94[_0xd8c7('0x23')]()){return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),_0xd8c7('0x24'),null,_0x231293));}}if(_0x1458b4[_0xd8c7('0x25')]){if(!isEmail(_0x1458b4[_0xd8c7('0x25')])){return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),_0xd8c7('0x26'),null,_0x231293));}}_0x1458b4['ListId']=LISTID;_0x1458b4[_0xd8c7('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd8c7('0x28')]&&_0x2020ff){var _0x611971={};for(var _0x352e6f=0x0,_0x4bf5e0=DUPLICATES[_0xd8c7('0x28')];_0x352e6f<_0x4bf5e0;_0x352e6f+=0x1){_0x611971[DUPLICATES[_0x352e6f]]=_0x1458b4[DUPLICATES[_0x352e6f]];}var _0x4ee0df=_['find'](_0x2020ff,_0x611971);if(_0x4ee0df){return _0x58654f(handleCheckRowError(_0xd8c7('0x29'),_0xd8c7('0x2a'),_0x4ee0df,_0x231293));}}return db[_0xd8c7('0x2b')][_0xd8c7('0x2c')](_0x1458b4,{'raw':!![],'hooks':![],'fields':_[_0xd8c7('0x2d')](_0x1458b4)})[_0xd8c7('0x2e')](function(_0x1da0b9){if(DUPLICATES&&DUPLICATES[_0xd8c7('0x28')]&&_0x2020ff){_0x2020ff['push'](_[_0xd8c7('0x2f')](_0x1458b4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1da0b9['id'];return _0x376289();})[_0xd8c7('0x30')](function(_0x5bcef7){return _0x58654f(handleCheckRowError(_0xd8c7('0x15'),_0xd8c7('0x31')+(_0x5bcef7[_0xd8c7('0x1c')]||JSON[_0xd8c7('0x32')](_0x5bcef7)),null,_0x231293));});});}function checkHopper(){function _0x482012(){return function(_0x631b9a){logger[_0xd8c7('0x15')]('cmContact','checkHopper',util[_0xd8c7('0x33')](_0x631b9a,{'showHidden':![],'depth':null}));};}var _0x2c3898=function(_0x57dc26,_0x3e8dfd){var _0xa292c8=squel[_0xd8c7('0x34')]()[_0xd8c7('0x35')](_0xd8c7('0x36'))[_0xd8c7('0x37')]([_0xd8c7('0x38'),'scheduledAt','ContactId',_0xd8c7('0x39'),_0x3e8dfd,_0xd8c7('0x3a'),_0xd8c7('0x3b')],squel[_0xd8c7('0x3c')]()['field'](_0xd8c7('0x38'),'phone')[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3f'))[_0xd8c7('0x3d')]('id',_0xd8c7('0x40'))[_0xd8c7('0x3d')](LISTID[_0xd8c7('0x41')](),_0xd8c7('0x39'))['field'](_0x57dc26['id'][_0xd8c7('0x41')](),_0x3e8dfd)[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3a'))[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3b'))[_0xd8c7('0x42')](_0xd8c7('0x43'))[_0xd8c7('0x44')](_0xd8c7('0x45'))['where'](_0xd8c7('0x46'),LISTID[_0xd8c7('0x41')]())[_0xd8c7('0x44')](_0xd8c7('0x47'))[_0xd8c7('0x44')](_0xd8c7('0x48'),squel[_0xd8c7('0x3c')]()[_0xd8c7('0x3d')](_0xd8c7('0x38'))[_0xd8c7('0x42')](_0xd8c7('0x36'))['where'](_0x3e8dfd+_0xd8c7('0x49'),_0x57dc26['id'][_0xd8c7('0x41')]())))[_0xd8c7('0x41')]();return _0xa292c8;};var _0x570204=function(_0x342617,_0x36cb1a){var _0x1cee40=squel[_0xd8c7('0x34')]()[_0xd8c7('0x35')](_0xd8c7('0x36'))[_0xd8c7('0x37')]([_0xd8c7('0x38'),_0xd8c7('0x3f'),_0xd8c7('0x40'),'ListId',_0x36cb1a,_0xd8c7('0x3a'),'updatedAt'],squel['select']()[_0xd8c7('0x3d')](_0xd8c7('0x38'),'phone')[_0xd8c7('0x3d')](_0xd8c7('0x3e'),'scheduledAt')[_0xd8c7('0x3d')]('id','ContactId')[_0xd8c7('0x3d')](LISTID[_0xd8c7('0x41')](),'ListId')['field'](_0x342617['id'][_0xd8c7('0x41')](),_0x36cb1a)[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3a'))[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3b'))[_0xd8c7('0x42')]('cm_contacts')['where'](_0xd8c7('0x45'))[_0xd8c7('0x44')](_0xd8c7('0x46'),LISTID[_0xd8c7('0x41')]())[_0xd8c7('0x44')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xd8c7('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xd8c7('0x44')](_0xd8c7('0x48'),squel[_0xd8c7('0x3c')]()[_0xd8c7('0x3d')](_0xd8c7('0x4a'))[_0xd8c7('0x42')](_0xd8c7('0x4b'))[_0xd8c7('0x44')](_0x36cb1a+_0xd8c7('0x49'),_0x342617['id'][_0xd8c7('0x41')]()))[_0xd8c7('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd8c7('0x3d')]('phone')[_0xd8c7('0x42')]('cm_hopper')['where'](_0x36cb1a+'\x20=\x20?',_0x342617['id']['toString']())))[_0xd8c7('0x41')]();return _0x1cee40;};function _0x1767c1(_0x2f0068,_0x21dbd2){var _0x46d621=squel['insert']()[_0xd8c7('0x35')](_0xd8c7('0x36'))[_0xd8c7('0x37')](['phone','scheduledAt',_0xd8c7('0x40'),'ListId',_0x21dbd2,_0xd8c7('0x3a'),_0xd8c7('0x3b')],squel[_0xd8c7('0x3c')]()[_0xd8c7('0x3d')](_0xd8c7('0x38'),_0xd8c7('0x38'))[_0xd8c7('0x3d')](_0xd8c7('0x3e'),'scheduledAt')[_0xd8c7('0x3d')]('id','ContactId')[_0xd8c7('0x3d')](LISTID[_0xd8c7('0x41')](),'ListId')[_0xd8c7('0x3d')](_0x2f0068['id'][_0xd8c7('0x41')](),_0x21dbd2)[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3a'))[_0xd8c7('0x3d')](_0xd8c7('0x3e'),_0xd8c7('0x3b'))[_0xd8c7('0x42')]('cm_contacts')[_0xd8c7('0x44')](_0xd8c7('0x45'))[_0xd8c7('0x44')]('ListId\x20=\x20?',LISTID[_0xd8c7('0x41')]())['where'](_0xd8c7('0x4c'),squel[_0xd8c7('0x4d')](hopperContacts))['where'](_0xd8c7('0x47')))[_0xd8c7('0x41')]();return _0x46d621;}function _0x23e4e1(_0x601054,_0x18c45e){var _0x2cb735=squel[_0xd8c7('0x34')]()[_0xd8c7('0x35')](_0xd8c7('0x4e'))[_0xd8c7('0x37')](['phone',_0xd8c7('0x40'),_0xd8c7('0x39'),_0x18c45e,'createdAt',_0xd8c7('0x3b')],squel[_0xd8c7('0x3c')]()['field'](_0xd8c7('0x38'),_0xd8c7('0x38'))['field']('id',_0xd8c7('0x40'))[_0xd8c7('0x3d')](LISTID['toString'](),_0xd8c7('0x39'))[_0xd8c7('0x3d')](_0x601054['id'][_0xd8c7('0x41')](),_0x18c45e)['field']('NOW()',_0xd8c7('0x3a'))['field'](_0xd8c7('0x3e'),'updatedAt')[_0xd8c7('0x42')](_0xd8c7('0x43'))[_0xd8c7('0x44')](_0xd8c7('0x45'))[_0xd8c7('0x44')]('ListId\x20=\x20?',LISTID[_0xd8c7('0x41')]())[_0xd8c7('0x44')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xd8c7('0x44')](_0xd8c7('0x47')))[_0xd8c7('0x41')]();return _0x2cb735;}return db['VoiceQueue']['findAll']({'where':{'type':_0xd8c7('0x4f')},'attributes':['id',_0xd8c7('0x50')],'include':[{'model':db[_0xd8c7('0x51')],'as':_0xd8c7('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x2a179c){var _0x48f9f9=[];if(_0x2a179c){var _0x20284b;for(var _0x1d276d=0x0,_0x4b11a0;_0x1d276d<_0x2a179c[_0xd8c7('0x28')];_0x1d276d+=0x1){_0x4b11a0=_0x2a179c[_0x1d276d]['get']({'plain':!![]});switch(_0x4b11a0[_0xd8c7('0x50')]){case _0xd8c7('0x53'):_0x48f9f9['push'](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x570204(_0x4b11a0,_0xd8c7('0x56')))['then'](function(){})[_0xd8c7('0x30')](_0x482012()));break;case _0xd8c7('0x57'):_0x48f9f9[_0xd8c7('0x58')](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x2c3898(_0x4b11a0,'VoiceQueueId'))['then'](function(){})[_0xd8c7('0x30')](_0x482012()));break;default:_0x48f9f9[_0xd8c7('0x58')](db['sequelize'][_0xd8c7('0x55')](_0x1767c1(_0x4b11a0,_0xd8c7('0x56')))[_0xd8c7('0x2e')](function(){})['catch'](_0x482012()));}}}return _0x48f9f9;})[_0xd8c7('0x59')]()[_0xd8c7('0x2e')](function(){return db[_0xd8c7('0x5a')][_0xd8c7('0x5b')]({'where':{'type':_0xd8c7('0x4f')},'attributes':['id'],'include':[{'model':db[_0xd8c7('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd8c7('0x2e')](function(_0x1259b0){var _0xc1ef3f=[];if(_0x1259b0){var _0x2a7606;for(var _0x25e0e0=0x0,_0x115978;_0x25e0e0<_0x1259b0[_0xd8c7('0x28')];_0x25e0e0+=0x1){_0x115978=_0x1259b0[_0x25e0e0]['get']({'plain':!![]});_0xc1ef3f[_0xd8c7('0x58')](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x23e4e1(_0x115978,'VoiceQueueId'))[_0xd8c7('0x2e')](function(){})[_0xd8c7('0x30')](_0x482012()));}}return _0xc1ef3f;})[_0xd8c7('0x59')]();})[_0xd8c7('0x2e')](function(){return db[_0xd8c7('0x5c')]['findAll']({'attributes':['id',_0xd8c7('0x50')],'include':[{'model':db[_0xd8c7('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xd8c7('0x2e')](function(_0x111a78){var _0x93a337=[];if(_0x111a78){for(var _0x14017a=0x0,_0xef2fbc;_0x14017a<_0x111a78[_0xd8c7('0x28')];_0x14017a+=0x1){_0xef2fbc=_0x111a78[_0x14017a]['get']({'plain':!![]});switch(_0xef2fbc[_0xd8c7('0x50')]){case _0xd8c7('0x53'):_0x93a337[_0xd8c7('0x58')](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x570204(_0xef2fbc,_0xd8c7('0x5d')))[_0xd8c7('0x2e')](function(){})[_0xd8c7('0x30')](_0x482012()));break;case _0xd8c7('0x57'):_0x93a337[_0xd8c7('0x58')](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x2c3898(_0xef2fbc,_0xd8c7('0x5d')))[_0xd8c7('0x2e')](function(){})[_0xd8c7('0x30')](_0x482012()));break;default:_0x93a337[_0xd8c7('0x58')](db['sequelize'][_0xd8c7('0x55')](_0x1767c1(_0xef2fbc,_0xd8c7('0x5d')))[_0xd8c7('0x2e')](function(){})[_0xd8c7('0x30')](_0x482012()));}}}return _0x93a337;})[_0xd8c7('0x59')]();})['then'](function(){return db['Campaign'][_0xd8c7('0x5b')]({'attributes':['id'],'include':[{'model':db[_0xd8c7('0x51')],'as':_0xd8c7('0x5e'),'where':{'id':LISTID}}]})[_0xd8c7('0x2e')](function(_0x3e1273){var _0x324911=[];if(_0x3e1273){for(var _0x46d4b3=0x0,_0x14b1ab;_0x46d4b3<_0x3e1273[_0xd8c7('0x28')];_0x46d4b3+=0x1){_0x14b1ab=_0x3e1273[_0x46d4b3]['get']({'plain':!![]});_0x324911[_0xd8c7('0x58')](db[_0xd8c7('0x54')][_0xd8c7('0x55')](_0x23e4e1(_0x14b1ab,_0xd8c7('0x5d')))['then'](function(){})[_0xd8c7('0x30')](_0x482012()));}}return _0x324911;})[_0xd8c7('0x59')]();})[_0xd8c7('0x30')](function(_0x178f84){logger[_0xd8c7('0x15')](_0xd8c7('0x5f'),_0xd8c7('0x60'),_0x178f84['message']);});}var processPromises=function(_0x1bc513){return BPromise[_0xd8c7('0x59')](promises)[_0xd8c7('0x2e')](function(_0x395656){})[_0xd8c7('0x30')](function(_0x3d8cf1){logger[_0xd8c7('0x15')](_0xd8c7('0x61'),JSON['stringify'](_0x3d8cf1));})[_0xd8c7('0x62')](function(){socket[_0xd8c7('0x63')](_0xd8c7('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1bc513){return _0x1bc513[_0xd8c7('0x65')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xd8c7('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xd8c7('0x2e')](function(){socket[_0xd8c7('0x63')](_0xd8c7('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x59b031){logger[_0xd8c7('0x15')](_0xd8c7('0x66'),JSON[_0xd8c7('0x32')](_0x59b031));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xd8c7('0x67'));endCsv();});function main(){return BPromise[_0xd8c7('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd8c7('0x13')](',');return db[_0xd8c7('0x2b')][_0xd8c7('0x5b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd8c7('0x2e')](function(_0x556f94){var _0x2a81cc=fs[_0xd8c7('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd8c7('0x6a')](_0x2a81cc,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bae0c,_0x2b983f){total+=0x1;var _0x3edb97=total;promises[_0xd8c7('0x58')](checkRow(_0x4bae0c,_0x556f94,_0x3edb97)[_0xd8c7('0x2e')](function(){success+=0x1;})[_0xd8c7('0x30')](function(_0x42d182){if(_0x42d182[_0xd8c7('0x15')]){errors+=0x1;delete _0x42d182[_0xd8c7('0x15')];}else if(_0x42d182[_0xd8c7('0x29')]){duplicates+=0x1;delete _0x42d182['duplicate'];}rows[_0xd8c7('0x58')](_0x42d182);}));if(total%0xc8===0x0){_0x2b983f[_0xd8c7('0x6b')]();return processPromises(_0x2b983f);}},'complete':function(){return processPromises()[_0xd8c7('0x2e')](function(){logger[_0xd8c7('0x6c')](_0xd8c7('0x6d'));endCsv();});},'error':function(_0x5d43a4,_0x477f42){logger[_0xd8c7('0x6c')]('CSV\x20parse\x20error',JSON[_0xd8c7('0x32')](_0x5d43a4));endCsv();}});})[_0xd8c7('0x30')](function(_0x441984){logger[_0xd8c7('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd8c7('0x32')](_0x441984));});}main(); \ No newline at end of file +var _0x4298=['birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','insert','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','findAll','outbound','BlackLists','get','Campaign','CampaignId','all','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4298,0x131));var _0x8429=function(_0x575696,_0x43e437){_0x575696=_0x575696-0x0;var _0x55cc52=_0x4298[_0x575696];return _0x55cc52;};'use strict';var BPromise=require(_0x8429('0x0'));var util=require(_0x8429('0x1'));var _=require(_0x8429('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x8429('0x3'));var db=require(_0x8429('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x8429('0x5'))(_0x8429('0x6'));config[_0x8429('0x7')]=_[_0x8429('0x8')](config[_0x8429('0x7')],{'host':_0x8429('0x9'),'port':0x18eb});var socket=require(_0x8429('0xa'))(new Redis(config['redis']));require(_0x8429('0xb'))[_0x8429('0xc')](socket);try{if(!process[_0x8429('0xd')][0x2]||process[_0x8429('0xd')][0x2]===_0x8429('0xe')||process[_0x8429('0xd')][0x2]===_0x8429('0xf')){throw new Error(_0x8429('0x10'));}var FILEPATH=process[_0x8429('0xd')][0x2];if(!process[_0x8429('0xd')][0x3]||process[_0x8429('0xd')][0x3]===_0x8429('0xe')||process[_0x8429('0xd')][0x3]===_0x8429('0xf')||!process[_0x8429('0xd')][0x4]||process[_0x8429('0xd')][0x4]===_0x8429('0xe')||process['argv'][0x4]===_0x8429('0xf')){throw new Error(_0x8429('0x11'));}var FIELDS=_[_0x8429('0x12')](process[_0x8429('0xd')][0x3][_0x8429('0x13')](','),process[_0x8429('0xd')][0x4][_0x8429('0x13')](','));if(!process[_0x8429('0xd')][0x5]||process[_0x8429('0xd')][0x5]===_0x8429('0xe')||process[_0x8429('0xd')][0x5]===_0x8429('0xf')){throw new Error(_0x8429('0x14'));}var LISTID=process[_0x8429('0xd')][0x5];var COMPANYID=process[_0x8429('0xd')][0x6]&&process['argv'][0x6]!==_0x8429('0xe')&&process['argv'][0x6]!==_0x8429('0xf')?process[_0x8429('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x8429('0xe')&&process[_0x8429('0xd')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x8429('0xd')][0x8]||process[_0x8429('0xd')][0x8]===_0x8429('0xe')||process[_0x8429('0xd')][0x8]===_0x8429('0xf')){throw new Error(_0x8429('0x15'));}var SOCKET_TIMESTAMP=process[_0x8429('0xd')][0x8];}catch(_0x424fde){logger[_0x8429('0x16')](_0x424fde);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(_0x228a17,_0x545a4f,_0x2a2020,_0x1a782e){var _0x20fd21={'message':_0x545a4f};_0x20fd21[_0x228a17]=!![];if(_0x2a2020){_0x20fd21[_0x8429('0x17')]=_0x2a2020;}if(_0x1a782e){_0x20fd21['index']=_0x1a782e;}return _0x20fd21;}function isEmail(_0x4b17e9){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'](_0x4b17e9);}function checkRow(_0x4574f0,_0x1e6614,_0x339cf3){return new BPromise(function(_0x1a9be9,_0x2d759a){if(_[_0x8429('0x18')](_0x4574f0)){return _0x2d759a(handleCheckRowError('error',_0x8429('0x19'),null,_0x339cf3));}if(_0x4574f0['errors']&&_0x4574f0[_0x8429('0x1a')][_0x8429('0x1b')]){var _0x4f2e3a=_['map'](_0x4574f0[_0x8429('0x1a')],_0x8429('0x1c'))[_0x8429('0x1d')](';');return _0x2d759a(handleCheckRowError('error',_0x4f2e3a,null,_0x339cf3));}var _0x2fc386={};for(var _0x40948b in FIELDS){if(FIELDS[_0x8429('0x1e')](_0x40948b)&&FIELDS[_0x40948b]){_0x2fc386[_0x40948b]=_0x4574f0[_0x8429('0x1f')][0x0][FIELDS[_0x40948b]]||_0x4574f0[_0x8429('0x1f')][0x0]['\ufeff'+FIELDS[_0x40948b]];}}if(!_0x2fc386['firstName']){return _0x2d759a(handleCheckRowError(_0x8429('0x16'),_0x8429('0x20'),null,_0x339cf3));}if(!_0x2fc386[_0x8429('0x21')]){return _0x2d759a(handleCheckRowError(_0x8429('0x16'),_0x8429('0x22'),null,_0x339cf3));}if(_0x2fc386[_0x8429('0x23')]){var _0x22b73b=moment(_0x2fc386[_0x8429('0x23')],'YYYY-MM-DD');if(!_0x22b73b[_0x8429('0x24')]()){return _0x2d759a(handleCheckRowError(_0x8429('0x16'),_0x8429('0x25'),null,_0x339cf3));}}if(_0x2fc386[_0x8429('0x26')]){if(!isEmail(_0x2fc386[_0x8429('0x26')])){return _0x2d759a(handleCheckRowError(_0x8429('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x339cf3));}}_0x2fc386[_0x8429('0x27')]=LISTID;_0x2fc386[_0x8429('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8429('0x1b')]&&_0x1e6614){var _0x56fa81={};for(var _0x49523e=0x0,_0x163349=DUPLICATES['length'];_0x49523e<_0x163349;_0x49523e+=0x1){_0x56fa81[DUPLICATES[_0x49523e]]=_0x2fc386[DUPLICATES[_0x49523e]];}var _0x2775a9=_[_0x8429('0x29')](_0x1e6614,_0x56fa81);if(_0x2775a9){return _0x2d759a(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x2775a9,_0x339cf3));}}return db[_0x8429('0x2a')][_0x8429('0x2b')](_0x2fc386,{'raw':!![],'hooks':![],'fields':_[_0x8429('0x2c')](_0x2fc386)})[_0x8429('0x2d')](function(_0x1da869){if(DUPLICATES&&DUPLICATES[_0x8429('0x1b')]&&_0x1e6614){_0x1e6614[_0x8429('0x2e')](_[_0x8429('0x2f')](_0x2fc386,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1da869['id'];return _0x1a9be9();})[_0x8429('0x30')](function(_0x9dc8ff){return _0x2d759a(handleCheckRowError(_0x8429('0x16'),_0x8429('0x31')+(_0x9dc8ff[_0x8429('0x1c')]||JSON[_0x8429('0x32')](_0x9dc8ff)),null,_0x339cf3));});});}function checkHopper(){function _0x5739c7(){return function(_0x5ea371){logger[_0x8429('0x16')](_0x8429('0x33'),_0x8429('0x34'),util[_0x8429('0x35')](_0x5ea371,{'showHidden':![],'depth':null}));};}var _0x5069be=function(_0x603607,_0x5b823f){var _0x4b7100=squel['insert']()[_0x8429('0x36')]('cm_hopper')[_0x8429('0x37')](['phone','scheduledAt',_0x8429('0x38'),'ListId',_0x5b823f,_0x8429('0x39'),_0x8429('0x3a')],squel[_0x8429('0x3b')]()['field'](_0x8429('0x21'),'phone')[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x3e'))[_0x8429('0x3c')]('id',_0x8429('0x38'))[_0x8429('0x3c')](LISTID[_0x8429('0x3f')](),'ListId')[_0x8429('0x3c')](_0x603607['id']['toString'](),_0x5b823f)['field'](_0x8429('0x3d'),'createdAt')[_0x8429('0x3c')]('NOW()','updatedAt')['from'](_0x8429('0x40'))['where'](_0x8429('0x41'))[_0x8429('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x8429('0x42')](_0x8429('0x43'))[_0x8429('0x42')](_0x8429('0x44'),squel[_0x8429('0x3b')]()['field']('phone')[_0x8429('0x45')](_0x8429('0x46'))['where'](_0x5b823f+_0x8429('0x47'),_0x603607['id'][_0x8429('0x3f')]())))[_0x8429('0x3f')]();return _0x4b7100;};var _0x44e59d=function(_0x7d4990,_0x57dfa7){var _0xa5f547=squel[_0x8429('0x48')]()['into'](_0x8429('0x46'))[_0x8429('0x37')]([_0x8429('0x21'),'scheduledAt',_0x8429('0x38'),'ListId',_0x57dfa7,_0x8429('0x39'),_0x8429('0x3a')],squel[_0x8429('0x3b')]()[_0x8429('0x3c')](_0x8429('0x21'),_0x8429('0x21'))[_0x8429('0x3c')]('NOW()',_0x8429('0x3e'))[_0x8429('0x3c')]('id',_0x8429('0x38'))[_0x8429('0x3c')](LISTID[_0x8429('0x3f')](),_0x8429('0x27'))[_0x8429('0x3c')](_0x7d4990['id'][_0x8429('0x3f')](),_0x57dfa7)[_0x8429('0x3c')](_0x8429('0x3d'),'createdAt')[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x3a'))[_0x8429('0x45')]('cm_contacts')[_0x8429('0x42')]('deletedAt\x20IS\x20NULL')[_0x8429('0x42')](_0x8429('0x49'),LISTID[_0x8429('0x3f')]())[_0x8429('0x42')](_0x8429('0x4a'),squel[_0x8429('0x4b')](hopperContacts))[_0x8429('0x42')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x8429('0x44'),squel[_0x8429('0x3b')]()['field'](_0x8429('0x4c'))['from'](_0x8429('0x4d'))[_0x8429('0x42')](_0x57dfa7+_0x8429('0x47'),_0x7d4990['id'][_0x8429('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x8429('0x3b')]()[_0x8429('0x3c')](_0x8429('0x21'))[_0x8429('0x45')]('cm_hopper')[_0x8429('0x42')](_0x57dfa7+_0x8429('0x47'),_0x7d4990['id'][_0x8429('0x3f')]())))[_0x8429('0x3f')]();return _0xa5f547;};function _0x4831a4(_0x130654,_0x53f3b7){var _0x4f89ec=squel['insert']()[_0x8429('0x36')]('cm_hopper')['fromQuery']([_0x8429('0x21'),_0x8429('0x3e'),_0x8429('0x38'),_0x8429('0x27'),_0x53f3b7,_0x8429('0x39'),'updatedAt'],squel[_0x8429('0x3b')]()[_0x8429('0x3c')]('phone',_0x8429('0x21'))[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x3e'))['field']('id',_0x8429('0x38'))[_0x8429('0x3c')](LISTID[_0x8429('0x3f')](),_0x8429('0x27'))[_0x8429('0x3c')](_0x130654['id'][_0x8429('0x3f')](),_0x53f3b7)[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x39'))[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x3a'))[_0x8429('0x45')](_0x8429('0x40'))[_0x8429('0x42')](_0x8429('0x41'))['where'](_0x8429('0x49'),LISTID[_0x8429('0x3f')]())['where'](_0x8429('0x4a'),squel[_0x8429('0x4b')](hopperContacts))['where'](_0x8429('0x43')))[_0x8429('0x3f')]();return _0x4f89ec;}function _0x3626b1(_0x367e87,_0x1435c3){var _0x3f2342=squel[_0x8429('0x48')]()[_0x8429('0x36')](_0x8429('0x4e'))[_0x8429('0x37')]([_0x8429('0x21'),_0x8429('0x38'),_0x8429('0x27'),_0x1435c3,_0x8429('0x39'),_0x8429('0x3a')],squel['select']()[_0x8429('0x3c')](_0x8429('0x21'),_0x8429('0x21'))[_0x8429('0x3c')]('id',_0x8429('0x38'))[_0x8429('0x3c')](LISTID['toString'](),'ListId')[_0x8429('0x3c')](_0x367e87['id'][_0x8429('0x3f')](),_0x1435c3)[_0x8429('0x3c')](_0x8429('0x3d'),_0x8429('0x39'))[_0x8429('0x3c')](_0x8429('0x3d'),'updatedAt')[_0x8429('0x45')](_0x8429('0x40'))[_0x8429('0x42')]('deletedAt\x20IS\x20NULL')[_0x8429('0x42')](_0x8429('0x49'),LISTID[_0x8429('0x3f')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x8429('0x3f')]();return _0x3f2342;}return db[_0x8429('0x4f')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x8429('0x50')],'include':[{'model':db[_0x8429('0x51')],'as':_0x8429('0x52'),'where':{'id':LISTID}}]})[_0x8429('0x2d')](function(_0x3447ae){var _0x365dfd=[];if(_0x3447ae){var _0x3eb2e4;for(var _0x2c24f5=0x0,_0x10d638;_0x2c24f5<_0x3447ae['length'];_0x2c24f5+=0x1){_0x10d638=_0x3447ae[_0x2c24f5]['get']({'plain':!![]});switch(_0x10d638[_0x8429('0x50')]){case _0x8429('0x53'):_0x365dfd[_0x8429('0x2e')](db[_0x8429('0x54')][_0x8429('0x55')](_0x44e59d(_0x10d638,_0x8429('0x56')))[_0x8429('0x2d')](function(){})[_0x8429('0x30')](_0x5739c7()));break;case _0x8429('0x57'):_0x365dfd[_0x8429('0x2e')](db[_0x8429('0x54')][_0x8429('0x55')](_0x5069be(_0x10d638,'VoiceQueueId'))[_0x8429('0x2d')](function(){})[_0x8429('0x30')](_0x5739c7()));break;default:_0x365dfd[_0x8429('0x2e')](db[_0x8429('0x54')][_0x8429('0x55')](_0x4831a4(_0x10d638,_0x8429('0x56')))[_0x8429('0x2d')](function(){})['catch'](_0x5739c7()));}}}return _0x365dfd;})['all']()[_0x8429('0x2d')](function(){return db[_0x8429('0x4f')][_0x8429('0x58')]({'where':{'type':_0x8429('0x59')},'attributes':['id'],'include':[{'model':db[_0x8429('0x51')],'as':_0x8429('0x5a'),'where':{'id':LISTID}}]})[_0x8429('0x2d')](function(_0x1278c2){var _0x150122=[];if(_0x1278c2){var _0x236dc5;for(var _0xa3afd5=0x0,_0x546b16;_0xa3afd5<_0x1278c2[_0x8429('0x1b')];_0xa3afd5+=0x1){_0x546b16=_0x1278c2[_0xa3afd5][_0x8429('0x5b')]({'plain':!![]});_0x150122[_0x8429('0x2e')](db[_0x8429('0x54')][_0x8429('0x55')](_0x3626b1(_0x546b16,'VoiceQueueId'))[_0x8429('0x2d')](function(){})[_0x8429('0x30')](_0x5739c7()));}}return _0x150122;})['all']();})[_0x8429('0x2d')](function(){return db[_0x8429('0x5c')][_0x8429('0x58')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8429('0x51')],'as':_0x8429('0x52'),'where':{'id':LISTID}}]})[_0x8429('0x2d')](function(_0x454abc){var _0x7adc73=[];if(_0x454abc){for(var _0x13c19c=0x0,_0x541225;_0x13c19c<_0x454abc[_0x8429('0x1b')];_0x13c19c+=0x1){_0x541225=_0x454abc[_0x13c19c][_0x8429('0x5b')]({'plain':!![]});switch(_0x541225[_0x8429('0x50')]){case'always':_0x7adc73[_0x8429('0x2e')](db[_0x8429('0x54')]['query'](_0x44e59d(_0x541225,'CampaignId'))[_0x8429('0x2d')](function(){})[_0x8429('0x30')](_0x5739c7()));break;case'onlyIfOpen':_0x7adc73[_0x8429('0x2e')](db[_0x8429('0x54')]['query'](_0x5069be(_0x541225,'CampaignId'))['then'](function(){})[_0x8429('0x30')](_0x5739c7()));break;default:_0x7adc73[_0x8429('0x2e')](db['sequelize'][_0x8429('0x55')](_0x4831a4(_0x541225,_0x8429('0x5d')))[_0x8429('0x2d')](function(){})['catch'](_0x5739c7()));}}}return _0x7adc73;})[_0x8429('0x5e')]();})[_0x8429('0x2d')](function(){return db[_0x8429('0x5c')][_0x8429('0x58')]({'attributes':['id'],'include':[{'model':db[_0x8429('0x51')],'as':_0x8429('0x5a'),'where':{'id':LISTID}}]})[_0x8429('0x2d')](function(_0x446be4){var _0xfae00c=[];if(_0x446be4){for(var _0x1fd5c2=0x0,_0x28140f;_0x1fd5c2<_0x446be4['length'];_0x1fd5c2+=0x1){_0x28140f=_0x446be4[_0x1fd5c2]['get']({'plain':!![]});_0xfae00c[_0x8429('0x2e')](db[_0x8429('0x54')][_0x8429('0x55')](_0x3626b1(_0x28140f,_0x8429('0x5d')))[_0x8429('0x2d')](function(){})['catch'](_0x5739c7()));}}return _0xfae00c;})[_0x8429('0x5e')]();})[_0x8429('0x30')](function(_0x1487d1){logger[_0x8429('0x16')](_0x8429('0x5f'),_0x8429('0x60'),_0x1487d1[_0x8429('0x1c')]);});}var processPromises=function(_0x309d5e){return BPromise[_0x8429('0x5e')](promises)[_0x8429('0x2d')](function(_0x5337a4){})[_0x8429('0x30')](function(_0x3f7f2d){logger[_0x8429('0x16')](_0x8429('0x61'),JSON['stringify'](_0x3f7f2d));})[_0x8429('0x62')](function(){socket['emit'](_0x8429('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x309d5e){return _0x309d5e[_0x8429('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x8429('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x8429('0x65')](_0x8429('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8429('0x66')](FILEPATH);}catch(_0x2705ab){logger['error'](_0x8429('0x67'),JSON[_0x8429('0x32')](_0x2705ab));}finally{process['exit'](0x0);}});};process['on'](_0x8429('0x68'),function(){logger[_0x8429('0x69')](_0x8429('0x6a'));endCsv();});function main(){return BPromise[_0x8429('0x6b')]()[_0x8429('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8429('0x13')](',');return db[_0x8429('0x2a')][_0x8429('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8429('0x2d')](function(_0x321970){var _0x414d56=fs[_0x8429('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8429('0x6d')](_0x414d56,{'header':!![],'skipEmptyLines':!![],'step':function(_0x56c30d,_0x3f929f){total+=0x1;var _0x2d7388=total;promises[_0x8429('0x2e')](checkRow(_0x56c30d,_0x321970,_0x2d7388)[_0x8429('0x2d')](function(){success+=0x1;})[_0x8429('0x30')](function(_0x2ab59c){if(_0x2ab59c['error']){errors+=0x1;delete _0x2ab59c[_0x8429('0x16')];}else if(_0x2ab59c[_0x8429('0x6e')]){duplicates+=0x1;delete _0x2ab59c[_0x8429('0x6e')];}rows[_0x8429('0x2e')](_0x2ab59c);}));if(total%0xc8===0x0){_0x3f929f[_0x8429('0x6f')]();return processPromises(_0x3f929f);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x8429('0x70'));endCsv();});},'error':function(_0x2e28d6,_0x6f193b){logger[_0x8429('0x69')]('CSV\x20parse\x20error',JSON[_0x8429('0x32')](_0x2e28d6));endCsv();}});})[_0x8429('0x30')](function(_0x21a872){logger['error'](_0x8429('0x71'),JSON['stringify'](_0x21a872));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index fedb770..d4e87f0 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 _0x1088=['argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','squel','ioredis','../../../config/logger','import','redis','socket.io-emitter','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','fromQuery','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','error','message','exit','push','code','info','sequelize','spread','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','unlink','catch','complete'];(function(_0x405362,_0x9f3d26){var _0x2fbf6e=function(_0x19529a){while(--_0x19529a){_0x405362['push'](_0x405362['shift']());}};_0x2fbf6e(++_0x9f3d26);}(_0x1088,0x11f));var _0x8108=function(_0x3c7936,_0x4bf3ec){_0x3c7936=_0x3c7936-0x0;var _0x56df6c=_0x1088[_0x3c7936];return _0x56df6c;};'use strict';var fs=require('fs');var path=require(_0x8108('0x0'));var _=require('lodash');var Papa=require(_0x8108('0x1'));var util=require(_0x8108('0x2'));var BPromise=require(_0x8108('0x3'));var moment=require('moment');var squel=require(_0x8108('0x4'));var Redis=require(_0x8108('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x8108('0x6'))(_0x8108('0x7'));config['redis']=_['defaults'](config[_0x8108('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8108('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5322d7){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))*$/[_0x8108('0xa')](_0x5322d7);}function selectNotIn(_0x5f41c9,_0x53a5db,_0xe49286,_0x465f9b,_0x28de8a){return squel['select']()[_0x8108('0xb')](_0x8108('0xc'))[_0x8108('0xd')](_0x465f9b)[_0x8108('0xe')](_0x53a5db,null,_0x53a5db+_0x8108('0xf')+_0x465f9b+'.'+_0xe49286)['where'](_0x465f9b+'.'+_0xe49286+_0x8108('0x10')+_0x5f41c9+'.'+_0xe49286)[_0x8108('0x11')](_0x53a5db+_0x8108('0x12')+_0x28de8a[_0x8108('0xe')]()+')');}function insertCmHopper(_0x5da6f8,_0x2b3028,_0x576404,_0x30a361,_0x2a63d1){var _0x5a1464=['cm_contacts.phone',_0x8108('0x13'),_0x8108('0x14'),_0x8108('0x15'),_0x2b3028+'.'+_0x30a361,_0x8108('0x16'),_0x8108('0x17'),_0x8108('0x18'),_0x8108('0x19'),'\x22'+_0x2a63d1+'\x22'];return squel[_0x8108('0x1a')]()[_0x8108('0x1b')]('cm_hopper')['fromQuery']([_0x8108('0xc'),_0x8108('0x1c'),_0x8108('0x1d'),_0x8108('0x1e'),_0x30a361,_0x8108('0x1f'),_0x8108('0x20'),_0x8108('0x21'),_0x8108('0x22'),_0x8108('0x23')],squel[_0x8108('0x24')]()[_0x8108('0x25')](_0x5a1464)[_0x8108('0xd')](_0x2b3028)['join'](_0x8108('0x26'),null,_0x8108('0x27')+_0x2b3028+'.CmListId')[_0x8108('0xe')](_0x576404,null,_0x576404+_0x8108('0xf')+_0x2b3028+'.'+_0x30a361)[_0x8108('0x11')](_0x2b3028+_0x8108('0x28'),_0x5da6f8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x8108('0x29'),selectNotIn(_0x2b3028,_0x576404,_0x30a361,_0x8108('0x2a'),[_0x8108('0x2b'),_0x8108('0x2c')]))[_0x8108('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2b3028,_0x576404,_0x30a361,'cm_hopper',[_0x8108('0x2b')])))[_0x8108('0x2d')]();}function insertCmHopperBlack(_0x1de10d,_0xa485ef,_0x5534bf,_0x127c34){var _0x4831c1=[_0x8108('0x2e'),_0x8108('0x14'),'cm_contacts.ListId',_0xa485ef+'.'+_0x127c34,_0x8108('0x16'),'cm_contacts.updatedAt'];return squel[_0x8108('0x1a')]()[_0x8108('0x1b')](_0x8108('0x2f'))[_0x8108('0x30')]([_0x8108('0xc'),'ContactId',_0x8108('0x1e'),_0x127c34,_0x8108('0x1f'),_0x8108('0x20')],squel['select']()[_0x8108('0x25')](_0x4831c1)['from'](_0xa485ef)[_0x8108('0xe')](_0x8108('0x26'),null,_0x8108('0x27')+_0xa485ef+_0x8108('0x31'))[_0x8108('0xe')](_0x5534bf,null,_0x5534bf+_0x8108('0xf')+_0xa485ef+'.'+_0x127c34)[_0x8108('0x11')](_0xa485ef+'.CmListId\x20=\x20?',_0x1de10d)['where'](_0x8108('0x32'),NOW)[_0x8108('0x11')](_0x8108('0x29'),squel[_0x8108('0x24')]()[_0x8108('0xb')](_0x8108('0xc'))[_0x8108('0xd')](_0x8108('0x2f'))[_0x8108('0x11')](_0x8108('0x33'),_0x1de10d)[_0x8108('0x11')](_0x127c34+_0x8108('0x34'),_0xa485ef+'.'+_0x127c34)))[_0x8108('0x2d')]();}function insertCmContact(_0x368c4d,_0x43a7f0,_0x8f7dd3,_0x13f6ec){var _0x127a12=_[_0x8108('0x35')](_[_0x8108('0x36')](_0x13f6ec),['ListId',_0x8108('0x37'),_0x8108('0x1f'),_0x8108('0x20')]);return squel[_0x8108('0x1a')]()[_0x8108('0x1b')](_0x8108('0x26'))[_0x8108('0x30')](_0x127a12,squel[_0x8108('0x24')]()[_0x8108('0x25')](_0x127a12)[_0x8108('0xd')](_0x43a7f0)[_0x8108('0x11')]('('+_0x8f7dd3['join'](',')+_0x8108('0x38'),squel['select']()[_0x8108('0x25')](_0x8f7dd3)['from'](_0x8108('0x26'))['where'](_0x8108('0x33'),_0x368c4d)[_0x8108('0x11')](_0x8108('0x39')))[_0x8108('0x11')](_0x8108('0x3a'),squel['select']()[_0x8108('0xb')](_0x8108('0x3b'),_0x8108('0x3c'))['from'](_0x43a7f0)[_0x8108('0x3d')](_0x8f7dd3[_0x8108('0xe')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2006fe){logger[_0x8108('0x3e')](_0x2006fe[_0x8108('0x3f')]);process[_0x8108('0x40')](0x1);}function handleError(_0x1f78de,_0x15ddb6){stats['errors'][_0x8108('0x41')]({'name':_0x15ddb6[_0x8108('0x42')],'message':_0x15ddb6[_0x8108('0x3f')],'row':_0x1f78de});}function handleQuery(_0x583e61){logger[_0x8108('0x43')](_0x583e61);return db[_0x8108('0x44')]['query'](_0x583e61)[_0x8108('0x45')](function(_0x3b12dd){results['push'](_0x3b12dd);})['catch'](function(_0x37379d){logger[_0x8108('0x3e')](_0x37379d['message']);});}function main(_0x349542,_0x205665,_0x47e559,_0x34fb2f){logger['info'](_0x8108('0x46'),_0x349542,JSON[_0x8108('0x47')](_0x205665));process[_0x8108('0x48')](_0x8108('0x49'));var _0x4be936=_0x205665[_0x8108('0x4a')];var _0x4d68eb=_0x205665[_0x8108('0x4b')];var _0x57e05c=path[_0x8108('0xe')](config[_0x8108('0x4c')],_0x8108('0x4d'),_0x4d68eb+_0x8108('0x4e'));var _0x33aac8=_[_0x8108('0x36')](_0x4be936)[_0x8108('0xe')]();logger[_0x8108('0x43')](_0x8108('0x4f'),_0x33aac8);fs[_0x8108('0x50')](_0x57e05c,_0x33aac8+'\x0a');Papa[_0x8108('0x51')](fs[_0x8108('0x52')](_0x349542),{'header':!![],'skipEmptyLines':!![],'step':function(_0x20ecc2,_0x265c13){try{for(var _0x369631=0x0,_0x2f1602=[];_0x369631<_0x20ecc2[_0x8108('0x53')][_0x8108('0x54')];_0x369631++){stats[_0x8108('0x55')]+=0x1;if(_0x20ecc2[_0x8108('0x56')][_0x369631]){handleError(_0x20ecc2['data'][_0x369631],_0x20ecc2[_0x8108('0x56')][_0x369631]);}else{var _0x395437=[];for(var _0x2d006d in _0x4be936){if(_0x4be936['hasOwnProperty'](_0x2d006d)){if(_0x20ecc2['data'][_0x369631][_0x4be936[_0x2d006d]]){var _0x5ed195=_[_0x8108('0x57')](_0x20ecc2[_0x8108('0x53')][_0x369631][_0x4be936[_0x2d006d]][_0x8108('0x58')](/"/g,'\x27'));switch(_0x2d006d){case _0x8108('0x1c'):var _0x4d94b6=moment(_0x5ed195,_0x8108('0x59'),!![]);if(_0x4d94b6['isValid']()){_0x2f1602[_0x8108('0x41')]('\x22'+_0x5ed195+'\x22');}else{_0x395437['push'](_0x8108('0x5a'));}break;case _0x8108('0x21'):var _0x5f1b49=parseInt(_0x5ed195);_0x5ed195=_[_0x8108('0x5b')](_0x5f1b49)||_0x5f1b49<0x0||_0x5f1b49>0x4?_0x34fb2f?0x3:0x2:_0x5f1b49;_0x2f1602[_0x8108('0x41')]('\x22'+_0x5ed195+'\x22');break;case _0x8108('0x22'):var _0x145c03=parseInt(_0x5ed195);if(_['isNumber'](_0x145c03)&&_[_0x8108('0x5c')](_0x47e559,_0x145c03)){_0x2f1602[_0x8108('0x41')]('\x22'+_0x145c03+'\x22');}else{_0x395437[_0x8108('0x41')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x5ed195)){_0x2f1602[_0x8108('0x41')]('\x22'+_0x5ed195+'\x22');}else{_0x395437[_0x8108('0x41')](_0x8108('0x5d'));}break;case'dateOfBirth':var _0x1b0413=moment(_0x5ed195,_0x8108('0x5e'),!![]);if(_0x1b0413['isValid']()){_0x2f1602[_0x8108('0x41')]('\x22'+_0x5ed195+'\x22');}else{_0x395437['push'](_0x8108('0x5f'));}break;default:_0x2f1602['push']('\x22'+_0x5ed195+'\x22');}}else{switch(_0x2d006d){case _0x8108('0x60'):case'phone':_0x395437[_0x8108('0x41')](_0x2d006d+_0x8108('0x61'));break;default:_0x2f1602[_0x8108('0x41')]('\x22\x22');}}}}if(_0x395437[_0x8108('0x54')]){handleError(_0x20ecc2['data'][_0x369631],{'code':_0x8108('0x62'),'message':_0x395437['join']()});}else{fs[_0x8108('0x63')](_0x57e05c,_0x2f1602[_0x8108('0xe')]()+'\x0a');}_0x2f1602=[];}if(!(stats[_0x8108('0x55')]%0xc8)){socket[_0x8108('0x64')](_0x8108('0x65')+_0x4d68eb,stats);stats[_0x8108('0x56')]=[];}}if(stopped){logger[_0x8108('0x43')](_0x8108('0x66'));_0x265c13[_0x8108('0x67')]();}}catch(_0x2f6b13){handleError(_0x20ecc2[_0x8108('0x53')][_0x369631],{'code':'SystemError','message':_0x2f6b13[_0x8108('0x3f')]});logger['error'](_0x8108('0x68'),_0x2f6b13[_0x8108('0x3f')]);}},'complete':function(){try{var _0x1e0c00=[];var _0x17358a=_0x8108('0x26');if(_0x205665['duplicates']&&_0x205665[_0x8108('0x69')][_0x8108('0x54')]){_0x17358a=_0x8108('0x6a')+_0x4d68eb;_0x1e0c00['push'](_0x8108('0x6b')+_0x17358a+_0x8108('0x6c'));}var _0x29e6b5=util[_0x8108('0x6d')]('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',_0x57e05c,_0x17358a,_0x33aac8,_0x205665[_0x8108('0x1e')],_0x205665[_0x8108('0x37')]||null,NOW,NOW);if(_[_0x8108('0x6e')](_0x4be936[_0x8108('0x1c')])){_0x29e6b5+=_0x8108('0x6f');}_0x1e0c00[_0x8108('0x41')](_0x29e6b5);if(_0x205665['duplicates']&&_0x205665['duplicates'][_0x8108('0x54')]){_0x1e0c00['push'](insertCmContact(_0x205665['ListId'],_0x17358a,_0x205665[_0x8108('0x69')],_0x4be936));_0x1e0c00[_0x8108('0x41')](_0x8108('0x70')+_0x17358a+';');}_0x1e0c00[_0x8108('0x41')](insertCmHopper(_0x205665[_0x8108('0x1e')],_0x8108('0x71'),_0x8108('0x72'),'VoiceQueueId',_0x34fb2f));_0x1e0c00[_0x8108('0x41')](insertCmHopperBlack(_0x205665[_0x8108('0x1e')],_0x8108('0x73'),_0x8108('0x72'),'VoiceQueueId'));_0x1e0c00[_0x8108('0x41')](insertCmHopper(_0x205665[_0x8108('0x1e')],_0x8108('0x74'),'campaigns',_0x8108('0x75'),_0x34fb2f));_0x1e0c00[_0x8108('0x41')](insertCmHopperBlack(_0x205665['ListId'],_0x8108('0x76'),_0x8108('0x77'),'CampaignId'));BPromise[_0x8108('0x78')](_0x1e0c00,handleQuery)[_0x8108('0x79')](function(_0x2cceaf){stats[_0x8108('0x7a')]=!![];stats['affectedRows']=_0x205665[_0x8108('0x69')]&&_0x205665[_0x8108('0x69')][_0x8108('0x54')]?results[0x2][_0x8108('0x7b')]:results[0x0]['affectedRows'];socket[_0x8108('0x64')](_0x8108('0x65')+_0x4d68eb,stats);fs[_0x8108('0x7c')](_0x349542);fs[_0x8108('0x7c')](_0x57e05c);process[_0x8108('0x40')](0x0);})[_0x8108('0x7d')](function(_0x3f8830){logger[_0x8108('0x3e')](_0x3f8830['message']);process[_0x8108('0x40')](0x1);});}catch(_0x2ce1e8){logger['error'](_0x8108('0x7e'),_0x2ce1e8['message']);process[_0x8108('0x40')](0x1);}},'error':function(_0xb4875c,_0x113be1,_0x4eb577,_0x34ae24){throw new Error(_0x34ae24);}});}function validate(){if(process[_0x8108('0x7f')]&&process[_0x8108('0x7f')][_0x8108('0x54')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2c9054=path[_0x8108('0xe')](config[_0x8108('0x4c')],_0x8108('0x4d'),process['argv'][0x2]);if(!fs[_0x8108('0x80')](_0x2c9054)){throw new Error(_0x8108('0x81'));}var _0x387ae5={};try{_0x387ae5=JSON['parse'](process['argv'][0x3]);if(!_0x387ae5[_0x8108('0x4a')]){throw new Error(_0x8108('0x82'));}if(!_0x387ae5[_0x8108('0x4a')][_0x8108('0xc')]){throw new Error(_0x8108('0x83'));}if(!_0x387ae5[_0x8108('0x4a')][_0x8108('0x60')]){throw new Error(_0x8108('0x84'));}var _0xd44e55=0x0;if(_0x387ae5[_0x8108('0x4a')][_0x8108('0x22')]){_0xd44e55=0x1;}if(!_0x387ae5[_0x8108('0x1e')]){throw new Error(_0x8108('0x85'));}}catch(_0x51897c){throw new Error(_0x8108('0x86'));}var _0x3315d9=[];try{_0x3315d9=_['map'](JSON['parse'](process[_0x8108('0x7f')][0x4]),'id');}catch(_0x4c23cb){logger[_0x8108('0x43')](_0x8108('0x87'));}main(_0x2c9054,_0x387ae5,_0x3315d9,_0xd44e55);}validate();process['on'](_0x8108('0x88'),handleStop);process['on'](_0x8108('0x89'),handleUncaughtException); \ No newline at end of file +var _0xf2f9=['cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','into','fields','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','error','exit','push','code','message','sequelize','query','spread','stringify','binding','socket_timestamp','root','server/files/tmp','.csv','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','SystemError','step','duplicates','cm_contacts_','\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','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','catch','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone'];(function(_0x3bf991,_0x1073fe){var _0x4ef446=function(_0x59417c){while(--_0x59417c){_0x3bf991['push'](_0x3bf991['shift']());}};_0x4ef446(++_0x1073fe);}(_0xf2f9,0xec));var _0x9f2f=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xf2f9[_0x2a3c4d];return _0x55c390;};'use strict';var fs=require('fs');var path=require(_0x9f2f('0x0'));var _=require('lodash');var Papa=require(_0x9f2f('0x1'));var util=require(_0x9f2f('0x2'));var BPromise=require(_0x9f2f('0x3'));var moment=require(_0x9f2f('0x4'));var squel=require(_0x9f2f('0x5'));var Redis=require(_0x9f2f('0x6'));var db=require(_0x9f2f('0x7'))['db'];var config=require(_0x9f2f('0x8'));var logger=require(_0x9f2f('0x9'))(_0x9f2f('0xa'));config[_0x9f2f('0xb')]=_['defaults'](config[_0x9f2f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f2f('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x9f2f('0xc')](_0x9f2f('0xd'));function isEmail(_0x75e35d){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))*$/[_0x9f2f('0xe')](_0x75e35d);}function selectNotIn(_0x152e97,_0x2db314,_0x45b43f,_0x3c5e77,_0x25c86e){return squel[_0x9f2f('0xf')]()[_0x9f2f('0x10')]('phone')['from'](_0x3c5e77)[_0x9f2f('0x11')](_0x2db314,null,_0x2db314+_0x9f2f('0x12')+_0x3c5e77+'.'+_0x45b43f)['where'](_0x3c5e77+'.'+_0x45b43f+_0x9f2f('0x13')+_0x152e97+'.'+_0x45b43f)['where'](_0x2db314+_0x9f2f('0x14')+_0x25c86e[_0x9f2f('0x11')]()+')');}function insertCmHopper(_0x512dbd,_0x484ab1,_0x550513,_0x4846fd,_0x187344){var _0x22294a=[_0x9f2f('0x15'),_0x9f2f('0x16'),_0x9f2f('0x17'),_0x9f2f('0x18'),_0x484ab1+'.'+_0x4846fd,'cm_contacts.createdAt',_0x9f2f('0x19'),_0x9f2f('0x1a'),_0x9f2f('0x1b'),'\x22'+_0x187344+'\x22'];return squel[_0x9f2f('0x1c')]()['into'](_0x9f2f('0x1d'))[_0x9f2f('0x1e')]([_0x9f2f('0x1f'),_0x9f2f('0x20'),_0x9f2f('0x21'),_0x9f2f('0x22'),_0x4846fd,_0x9f2f('0x23'),_0x9f2f('0x24'),_0x9f2f('0x25'),'UserId',_0x9f2f('0x26')],squel['select']()['fields'](_0x22294a)[_0x9f2f('0x27')](_0x484ab1)['join'](_0x9f2f('0x28'),null,_0x9f2f('0x29')+_0x484ab1+_0x9f2f('0x2a'))[_0x9f2f('0x11')](_0x550513,null,_0x550513+'.id\x20=\x20'+_0x484ab1+'.'+_0x4846fd)['where'](_0x484ab1+_0x9f2f('0x2b'),_0x512dbd)[_0x9f2f('0x2c')](_0x9f2f('0x2d'),NOW)['where'](_0x9f2f('0x2e'),selectNotIn(_0x484ab1,_0x550513,_0x4846fd,_0x9f2f('0x1d'),[_0x9f2f('0x2f'),_0x9f2f('0x30')]))[_0x9f2f('0x2c')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x484ab1,_0x550513,_0x4846fd,_0x9f2f('0x1d'),['\x22always\x22'])))[_0x9f2f('0x31')]();}function insertCmHopperBlack(_0x374b1a,_0x49fede,_0x2001b9,_0x4dcaa9){var _0x5d43c7=['cm_contacts.phone','cm_contacts.id',_0x9f2f('0x18'),_0x49fede+'.'+_0x4dcaa9,_0x9f2f('0x32'),_0x9f2f('0x19')];return squel[_0x9f2f('0x1c')]()['into'](_0x9f2f('0x33'))['fromQuery']([_0x9f2f('0x1f'),_0x9f2f('0x21'),_0x9f2f('0x22'),_0x4dcaa9,_0x9f2f('0x23'),'updatedAt'],squel[_0x9f2f('0xf')]()['fields'](_0x5d43c7)[_0x9f2f('0x27')](_0x49fede)[_0x9f2f('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x49fede+_0x9f2f('0x2a'))['join'](_0x2001b9,null,_0x2001b9+_0x9f2f('0x12')+_0x49fede+'.'+_0x4dcaa9)[_0x9f2f('0x2c')](_0x49fede+_0x9f2f('0x2b'),_0x374b1a)[_0x9f2f('0x2c')](_0x9f2f('0x2d'),NOW)['where'](_0x9f2f('0x2e'),squel[_0x9f2f('0xf')]()['field'](_0x9f2f('0x1f'))[_0x9f2f('0x27')](_0x9f2f('0x33'))[_0x9f2f('0x2c')](_0x9f2f('0x34'),_0x374b1a)['where'](_0x4dcaa9+_0x9f2f('0x35'),_0x49fede+'.'+_0x4dcaa9)))[_0x9f2f('0x31')]();}function insertCmContact(_0xfdb8a,_0x22bed6,_0x2dd750,_0x260942){var _0xfab96f=_[_0x9f2f('0x36')](_[_0x9f2f('0x37')](_0x260942),[_0x9f2f('0x22'),_0x9f2f('0x38'),_0x9f2f('0x23'),_0x9f2f('0x24')]);return squel['insert']()[_0x9f2f('0x39')](_0x9f2f('0x28'))[_0x9f2f('0x1e')](_0xfab96f,squel[_0x9f2f('0xf')]()[_0x9f2f('0x3a')](_0xfab96f)[_0x9f2f('0x27')](_0x22bed6)[_0x9f2f('0x2c')]('('+_0x2dd750[_0x9f2f('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x9f2f('0xf')]()[_0x9f2f('0x3a')](_0x2dd750)[_0x9f2f('0x27')](_0x9f2f('0x28'))[_0x9f2f('0x2c')](_0x9f2f('0x34'),_0xfdb8a)['where'](_0x9f2f('0x3b')))[_0x9f2f('0x2c')]('id\x20IN\x20?',squel[_0x9f2f('0xf')]()[_0x9f2f('0x10')](_0x9f2f('0x3c'),_0x9f2f('0x3d'))['from'](_0x22bed6)[_0x9f2f('0x3e')](_0x2dd750[_0x9f2f('0x11')](','))))[_0x9f2f('0x31')]();}function handleStop(){logger[_0x9f2f('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x57cd1c){logger[_0x9f2f('0x40')](_0x57cd1c['message']);process[_0x9f2f('0x41')](0x1);}function handleError(_0x300925,_0x411ab2){stats['errors'][_0x9f2f('0x42')]({'name':_0x411ab2[_0x9f2f('0x43')],'message':_0x411ab2[_0x9f2f('0x44')],'row':_0x300925});}function handleQuery(_0x375814){logger['info'](_0x375814);return db[_0x9f2f('0x45')][_0x9f2f('0x46')](_0x375814)[_0x9f2f('0x47')](function(_0x754bd0){results[_0x9f2f('0x42')](_0x754bd0);})['catch'](function(_0x546ae4){logger['error'](_0x546ae4[_0x9f2f('0x44')]);});}function main(_0x4e9613,_0x3c0668,_0x1a3b0c,_0x2950a9){logger['info']('main',_0x4e9613,JSON[_0x9f2f('0x48')](_0x3c0668));process['send']('start');var _0x279a6a=_0x3c0668[_0x9f2f('0x49')];var _0x28fb0e=_0x3c0668[_0x9f2f('0x4a')];var _0x2dbbb8=path[_0x9f2f('0x11')](config[_0x9f2f('0x4b')],_0x9f2f('0x4c'),_0x28fb0e+_0x9f2f('0x4d'));var _0xc4f536=_[_0x9f2f('0x37')](_0x279a6a)[_0x9f2f('0x11')]();logger[_0x9f2f('0x3f')]('header',_0xc4f536);fs['writeFileSync'](_0x2dbbb8,_0xc4f536+'\x0a');Papa['parse'](fs[_0x9f2f('0x4e')](_0x4e9613),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b4580,_0x48e8a0){try{for(var _0x5e3010=0x0,_0x3efb69=[];_0x5e3010<_0x5b4580[_0x9f2f('0x4f')][_0x9f2f('0x50')];_0x5e3010++){stats[_0x9f2f('0x51')]+=0x1;if(_0x5b4580[_0x9f2f('0x52')][_0x5e3010]){handleError(_0x5b4580[_0x9f2f('0x4f')][_0x5e3010],_0x5b4580['errors'][_0x5e3010]);}else{var _0xc01b58=[];for(var _0x5c35ce in _0x279a6a){if(_0x279a6a[_0x9f2f('0x53')](_0x5c35ce)){if(_0x5b4580['data'][_0x5e3010][_0x279a6a[_0x5c35ce]]){var _0x55e0a2=_[_0x9f2f('0x54')](_0x5b4580[_0x9f2f('0x4f')][_0x5e3010][_0x279a6a[_0x5c35ce]][_0x9f2f('0x55')](/"/g,'\x27'));switch(_0x5c35ce){case _0x9f2f('0x20'):var _0x1e3caa=moment(_0x55e0a2,_0x9f2f('0xd'),!![]);if(_0x1e3caa['isValid']()){_0x3efb69[_0x9f2f('0x42')]('\x22'+_0x55e0a2+'\x22');}else{_0xc01b58[_0x9f2f('0x42')](_0x9f2f('0x56'));}break;case _0x9f2f('0x25'):var _0x31175c=parseInt(_0x55e0a2);_0x55e0a2=_[_0x9f2f('0x57')](_0x31175c)||_0x31175c<0x0||_0x31175c>0x4?_0x2950a9?0x3:0x2:_0x31175c;_0x3efb69[_0x9f2f('0x42')]('\x22'+_0x55e0a2+'\x22');break;case _0x9f2f('0x58'):var _0x384e68=parseInt(_0x55e0a2);if(_['isNumber'](_0x384e68)&&_[_0x9f2f('0x59')](_0x1a3b0c,_0x384e68)){_0x3efb69['push']('\x22'+_0x384e68+'\x22');}else{_0xc01b58['push'](_0x9f2f('0x5a'));}break;case _0x9f2f('0x5b'):if(isEmail(_0x55e0a2)){_0x3efb69['push']('\x22'+_0x55e0a2+'\x22');}else{_0xc01b58[_0x9f2f('0x42')](_0x9f2f('0x5c'));}break;case'dateOfBirth':var _0xc5584=moment(_0x55e0a2,_0x9f2f('0x5d'),!![]);if(_0xc5584[_0x9f2f('0x5e')]()){_0x3efb69[_0x9f2f('0x42')]('\x22'+_0x55e0a2+'\x22');}else{_0xc01b58[_0x9f2f('0x42')](_0x9f2f('0x5f'));}break;default:_0x3efb69[_0x9f2f('0x42')]('\x22'+_0x55e0a2+'\x22');}}else{switch(_0x5c35ce){case'firstName':case _0x9f2f('0x1f'):_0xc01b58[_0x9f2f('0x42')](_0x5c35ce+_0x9f2f('0x60'));break;default:_0x3efb69[_0x9f2f('0x42')]('\x22\x22');}}}}if(_0xc01b58[_0x9f2f('0x50')]){handleError(_0x5b4580[_0x9f2f('0x4f')][_0x5e3010],{'code':_0x9f2f('0x61'),'message':_0xc01b58['join']()});}else{fs[_0x9f2f('0x62')](_0x2dbbb8,_0x3efb69[_0x9f2f('0x11')]()+'\x0a');}_0x3efb69=[];}if(!(stats[_0x9f2f('0x51')]%0xc8)){socket['emit'](_0x9f2f('0x63')+_0x28fb0e,stats);stats[_0x9f2f('0x52')]=[];}}if(stopped){logger[_0x9f2f('0x3f')]('Abort\x20parser');_0x48e8a0['abort']();}}catch(_0x3df343){handleError(_0x5b4580[_0x9f2f('0x4f')][_0x5e3010],{'code':_0x9f2f('0x64'),'message':_0x3df343[_0x9f2f('0x44')]});logger['error'](_0x9f2f('0x65'),_0x3df343['message']);}},'complete':function(){try{var _0x50d89b=[];var _0x275c02=_0x9f2f('0x28');if(_0x3c0668[_0x9f2f('0x66')]&&_0x3c0668[_0x9f2f('0x66')][_0x9f2f('0x50')]){_0x275c02=_0x9f2f('0x67')+_0x28fb0e;_0x50d89b['push']('CREATE\x20TABLE\x20'+_0x275c02+_0x9f2f('0x68'));}var _0x5161fc=util[_0x9f2f('0xc')](_0x9f2f('0x69'),_0x2dbbb8,_0x275c02,_0xc4f536,_0x3c0668['ListId'],_0x3c0668[_0x9f2f('0x38')]||null,NOW,NOW);if(_['isNil'](_0x279a6a['scheduledat'])){_0x5161fc+=',\x20scheduledAt\x20=\x20NOW()';}_0x50d89b['push'](_0x5161fc);if(_0x3c0668[_0x9f2f('0x66')]&&_0x3c0668[_0x9f2f('0x66')][_0x9f2f('0x50')]){_0x50d89b[_0x9f2f('0x42')](insertCmContact(_0x3c0668[_0x9f2f('0x22')],_0x275c02,_0x3c0668[_0x9f2f('0x66')],_0x279a6a));_0x50d89b[_0x9f2f('0x42')]('DROP\x20TABLE\x20'+_0x275c02+';');}_0x50d89b['push'](insertCmHopper(_0x3c0668['ListId'],_0x9f2f('0x6a'),_0x9f2f('0x6b'),_0x9f2f('0x6c'),_0x2950a9));_0x50d89b[_0x9f2f('0x42')](insertCmHopperBlack(_0x3c0668[_0x9f2f('0x22')],_0x9f2f('0x6d'),_0x9f2f('0x6b'),_0x9f2f('0x6c')));_0x50d89b['push'](insertCmHopper(_0x3c0668[_0x9f2f('0x22')],_0x9f2f('0x6e'),_0x9f2f('0x6f'),_0x9f2f('0x70'),_0x2950a9));_0x50d89b[_0x9f2f('0x42')](insertCmHopperBlack(_0x3c0668['ListId'],_0x9f2f('0x71'),_0x9f2f('0x6f'),'CampaignId'));BPromise[_0x9f2f('0x72')](_0x50d89b,handleQuery)[_0x9f2f('0x73')](function(_0x5d901a){stats['finish']=!![];stats[_0x9f2f('0x74')]=_0x3c0668[_0x9f2f('0x66')]&&_0x3c0668['duplicates'][_0x9f2f('0x50')]?results[0x2][_0x9f2f('0x74')]:results[0x0][_0x9f2f('0x74')];socket['emit'](_0x9f2f('0x63')+_0x28fb0e,stats);fs[_0x9f2f('0x75')](_0x4e9613);fs['unlink'](_0x2dbbb8);process[_0x9f2f('0x41')](0x0);})[_0x9f2f('0x76')](function(_0x498955){logger[_0x9f2f('0x40')](_0x498955[_0x9f2f('0x44')]);process['exit'](0x1);});}catch(_0x205302){logger['error']('complete',_0x205302[_0x9f2f('0x44')]);process['exit'](0x1);}},'error':function(_0x2dab7a,_0x5a2d60,_0x3a31cf,_0x15f729){throw new Error(_0x15f729);}});}function validate(){if(process[_0x9f2f('0x77')]&&process['argv'][_0x9f2f('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0xd64ec1=path[_0x9f2f('0x11')](config[_0x9f2f('0x4b')],_0x9f2f('0x4c'),process[_0x9f2f('0x77')][0x2]);if(!fs[_0x9f2f('0x78')](_0xd64ec1)){throw new Error(_0x9f2f('0x79'));}var _0x4e8c5a={};try{_0x4e8c5a=JSON[_0x9f2f('0x7a')](process['argv'][0x3]);if(!_0x4e8c5a[_0x9f2f('0x49')]){throw new Error(_0x9f2f('0x7b'));}if(!_0x4e8c5a[_0x9f2f('0x49')][_0x9f2f('0x1f')]){throw new Error(_0x9f2f('0x7c'));}if(!_0x4e8c5a[_0x9f2f('0x49')][_0x9f2f('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1fdcac=0x0;if(_0x4e8c5a[_0x9f2f('0x49')]['UserId']){_0x1fdcac=0x1;}if(!_0x4e8c5a[_0x9f2f('0x22')]){throw new Error(_0x9f2f('0x7e'));}}catch(_0x5e771d){throw new Error('body\x20id\x20mandatory');}var _0x5b7479=[];try{_0x5b7479=_['map'](JSON[_0x9f2f('0x7a')](process[_0x9f2f('0x77')][0x4]),'id');}catch(_0x3cb5c0){logger['info'](_0x9f2f('0x7f'));}main(_0xd64ec1,_0x4e8c5a,_0x5b7479,_0x1fdcac);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9f2f('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b88dbc8..1f974f9 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 _0x2a56=['destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','***\x20Call\x20Info\x20***','Member\x20Name','membername','starttime','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','queue','calleridnum','outbound','getDescriptions','inbound','Caller\x20Number','keyValue','Caller\x20Name','calleridname','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name'];(function(_0x390a82,_0x1ded4a){var _0x405d19=function(_0x210223){while(--_0x210223){_0x390a82['push'](_0x390a82['shift']());}};_0x405d19(++_0x1ded4a);}(_0x2a56,0x198));var _0x62a5=function(_0xaae54,_0x25a90f){_0xaae54=_0xaae54-0x0;var _0x1cdf65=_0x2a56[_0xaae54];return _0x1cdf65;};'use strict';exports['getSubjects']=function(_0x43bf66,_0x5e82e7){var _0x333278=[{'type':_0x62a5('0x0'),'content':_0x62a5('0x1'),'variableName':null}];switch(_0x43bf66[_0x62a5('0x2')]()){case _0x62a5('0x3'):switch(_0x5e82e7[_0x62a5('0x2')]()){case'inbound':_0x333278[_0x62a5('0x4')]({'type':_0x62a5('0x5'),'content':'','variableName':_0x62a5('0x6')});_0x333278[_0x62a5('0x4')]({'type':_0x62a5('0x5'),'content':'','variableName':_0x62a5('0x7')});break;case _0x62a5('0x8'):_0x333278[_0x62a5('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x333278['push']({'type':_0x62a5('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x333278;};exports[_0x62a5('0x9')]=function(_0x5a7ed5,_0x134387){var _0x8945fc=[];switch(_0x5a7ed5['toLowerCase']()){case _0x62a5('0x3'):switch(_0x134387[_0x62a5('0x2')]()){case _0x62a5('0xa'):_0x8945fc=[{'type':_0x62a5('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x62a5('0xb'),'keyType':_0x62a5('0x5'),'variableName':'calleridnum'},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0xd'),'keyType':'variable','variableName':_0x62a5('0xe')},{'type':_0x62a5('0xc'),'content':'','key':'Call\x20To','keyType':_0x62a5('0x5'),'variableName':_0x62a5('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x6')},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0x10'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x11')},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0x12'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x13')},{'type':_0x62a5('0x0'),'content':_0x62a5('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x62a5('0x15'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x16')},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0x17'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x18')},{'type':_0x62a5('0x0'),'content':_0x62a5('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x62a5('0x1a'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x13')},{'type':'keyValue','content':'','key':_0x62a5('0x1b'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x1c')},{'type':'keyValue','content':'','key':_0x62a5('0x1d'),'keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x1e')},{'type':_0x62a5('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x62a5('0x5'),'variableName':_0x62a5('0x1f')},{'type':_0x62a5('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x62a5('0x20')}];break;case'outbound':_0x8945fc=[{'type':_0x62a5('0x0'),'content':_0x62a5('0x21'),'variableName':null},{'type':_0x62a5('0xc'),'content':'','key':'Called\x20Number','keyType':_0x62a5('0x5'),'keyContent':'','variableName':_0x62a5('0x18')},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0x22'),'keyType':'variable','keyContent':'','variableName':_0x62a5('0x23')},{'type':'keyValue','content':'','key':_0x62a5('0x10'),'keyType':'variable','keyContent':'','variableName':_0x62a5('0x11')},{'type':'keyValue','content':'','key':_0x62a5('0x12'),'keyType':_0x62a5('0x5'),'keyContent':'','variableName':_0x62a5('0x24')},{'type':_0x62a5('0x0'),'content':_0x62a5('0x19')},{'type':_0x62a5('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x62a5('0x5'),'keyContent':'','variableName':_0x62a5('0x25')},{'type':'keyValue','content':'','key':_0x62a5('0x26'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x62a5('0xc'),'content':'','key':_0x62a5('0x27'),'keyType':_0x62a5('0x5'),'keyContent':'','variableName':_0x62a5('0x28')},{'type':'keyValue','content':'','key':_0x62a5('0x29'),'keyType':_0x62a5('0x5'),'keyContent':'','variableName':_0x62a5('0x2a')}];break;}}return _0x8945fc;}; \ No newline at end of file +var _0x69b7=['Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime'];(function(_0x3a3ff1,_0x5eee91){var _0x427d8e=function(_0x7dd9d4){while(--_0x7dd9d4){_0x3a3ff1['push'](_0x3a3ff1['shift']());}};_0x427d8e(++_0x5eee91);}(_0x69b7,0xd2));var _0x769b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x69b7[_0x502c7d];return _0x30b7ed;};'use strict';exports[_0x769b('0x0')]=function(_0x27b940,_0x28435a){var _0x3ab21c=[{'type':'string','content':_0x769b('0x1'),'variableName':null}];switch(_0x27b940[_0x769b('0x2')]()){case'voice':switch(_0x28435a[_0x769b('0x2')]()){case _0x769b('0x3'):_0x3ab21c[_0x769b('0x4')]({'type':_0x769b('0x5'),'content':'','variableName':_0x769b('0x6')});_0x3ab21c['push']({'type':_0x769b('0x5'),'content':'','variableName':_0x769b('0x7')});break;case _0x769b('0x8'):_0x3ab21c['push']({'type':_0x769b('0x9'),'content':'Outbound\x20Call','variableName':null});_0x3ab21c[_0x769b('0x4')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x3ab21c;};exports[_0x769b('0xa')]=function(_0x1a3573,_0x5f6d68){var _0x208e0e=[];switch(_0x1a3573[_0x769b('0x2')]()){case'voice':switch(_0x5f6d68['toLowerCase']()){case _0x769b('0x3'):_0x208e0e=[{'type':_0x769b('0x9'),'content':_0x769b('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x769b('0xc'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x769b('0x7')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0xd'),'keyType':_0x769b('0x5'),'variableName':'calleridname'},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0xe'),'keyType':'variable','variableName':_0x769b('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x769b('0x5'),'variableName':_0x769b('0x6')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x10'),'keyType':_0x769b('0x5'),'variableName':_0x769b('0x11')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x12'),'keyType':_0x769b('0x5'),'variableName':_0x769b('0x13')},{'type':_0x769b('0x9'),'content':_0x769b('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x15'),'keyType':_0x769b('0x5'),'variableName':'destcalleridname'},{'type':_0x769b('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x769b('0x5'),'variableName':_0x769b('0x16')},{'type':_0x769b('0x9'),'content':_0x769b('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x769b('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0x769b('0x5'),'variableName':_0x769b('0x13')},{'type':_0x769b('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0x769b('0x5'),'variableName':'agentconnectAt'},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x18'),'keyType':'variable','variableName':_0x769b('0x19')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x1a'),'keyType':_0x769b('0x5'),'variableName':_0x769b('0x1b')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x1c'),'keyType':_0x769b('0x5'),'variableName':_0x769b('0x1d')}];break;case _0x769b('0x8'):_0x208e0e=[{'type':'string','content':_0x769b('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x769b('0x1e'),'keyType':_0x769b('0x5'),'keyContent':'','variableName':_0x769b('0x16')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x769b('0x20')},{'type':'keyValue','content':'','key':_0x769b('0x10'),'keyType':_0x769b('0x5'),'keyContent':'','variableName':_0x769b('0x11')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x12'),'keyType':_0x769b('0x5'),'keyContent':'','variableName':_0x769b('0x21')},{'type':'string','content':_0x769b('0x17')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x22'),'keyType':_0x769b('0x5'),'keyContent':'','variableName':_0x769b('0x23')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x24'),'keyType':_0x769b('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x25'),'keyType':'variable','keyContent':'','variableName':_0x769b('0x26')},{'type':_0x769b('0xc'),'content':'','key':_0x769b('0x27'),'keyType':'variable','keyContent':'','variableName':_0x769b('0x28')}];break;}}return _0x208e0e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0b0cc7a..9e4c97b 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 _0xb9b7=['catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','chat-interactions','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','then','update','info'];(function(_0x159b6b,_0x52d23f){var _0x2dceb3=function(_0x221fec){while(--_0x221fec){_0x159b6b['push'](_0x159b6b['shift']());}};_0x2dceb3(++_0x52d23f);}(_0xb9b7,0x192));var _0x7b9b=function(_0x26295e,_0x318bba){_0x26295e=_0x26295e-0x0;var _0x49183f=_0xb9b7[_0x26295e];return _0x49183f;};'use strict';var _=require(_0x7b9b('0x0'));var db=require(_0x7b9b('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x7b9b('0x2')),'mail':require(_0x7b9b('0x3'))(_0x7b9b('0x4')),'fax':require('../../config/logger')(_0x7b9b('0x5')),'sms':require(_0x7b9b('0x3'))('sms-interactions'),'chat':require(_0x7b9b('0x3'))(_0x7b9b('0x6')),'whatsapp':require(_0x7b9b('0x3'))('whatsapp-interactions')};function getInteractionId(_0x49078a,_0x2cc91c,_0x1d19d4){if(_0x49078a&&_0x49078a[_['upperFirst'](_0x1d19d4)+_0x7b9b('0x7')]){return _0x49078a[_['upperFirst'](_0x1d19d4)+_0x7b9b('0x7')];}else if(_0x49078a&&_0x49078a['id']){return _0x49078a['id'];}else if(_0x2cc91c&&_0x2cc91c['id']){return _0x2cc91c['id'];}else{return'unknown';}}function log(_0x406b28,_0x456a07,_0x1e951a,_0x16188,_0x3370f9,_0x39953b){loggers[_0x3370f9[_0x7b9b('0x8')]()][_0x406b28](_0x7b9b('0x9'),_0x39953b['toUpperCase'](),_0x456a07?_0x456a07['id']:null,_0x456a07?_0x456a07[_0x7b9b('0xa')]:null,_0x456a07?_0x456a07['role']:null,getInteractionId(_0x1e951a,_0x16188,_0x3370f9),_0x1e951a?JSON[_0x7b9b('0xb')](_0x1e951a):_0x7b9b('0xc'));}function updateUser(_0x3b3c4c,_0x5dc8b7,_0x3b9dfe,_0x16174d,_0x495149){db[_['upperFirst'](_0x16174d)+_0x7b9b('0xd')][_0x7b9b('0xe')]({'where':{'id':getInteractionId(_0x5dc8b7,_0x3b9dfe,_0x16174d)}})[_0x7b9b('0xf')](function(_0x2338f3){if(_0x2338f3){return _0x2338f3[_0x7b9b('0x10')]({'UserId':_0x3b3c4c?_0x3b3c4c['id']:null});}})[_0x7b9b('0xf')](function(_0x55ebac){if(_0x55ebac){log(_0x7b9b('0x11'),_0x3b3c4c,_0x5dc8b7,_0x3b9dfe,_0x16174d,_0x495149);}})[_0x7b9b('0x12')](function(){log(_0x7b9b('0x13'),_0x3b3c4c,_0x5dc8b7,_0x3b9dfe,_0x16174d,_0x495149);});}exports[_0x7b9b('0x14')]=function(_0x1116b5,_0x518daa){return function(_0x298263,_0x1802bf,_0x2b75ac){var _0xde7df5=_0x298263[_0x7b9b('0x15')];var _0x404225={};var _0x9d7ed4=_0x298263[_0x7b9b('0x16')];if(_0x404225){_0x404225=_[_0x7b9b('0x17')](_0x298263[_0x7b9b('0x18')]);_0x404225=_[_0x7b9b('0x19')](_0x404225,['body',_0x7b9b('0x1a'),_0x7b9b('0x1b'),_0x7b9b('0x1c'),_0x7b9b('0x1d')]);}updateUser(_0xde7df5,_0x404225,_0x9d7ed4,_0x1116b5,_0x518daa);_0x2b75ac(null);};}; \ No newline at end of file +var _0x0d31=['role','stringify','Interaction','findOne','update','then','info','catch','error','tracked','query','clone','body','omit','phone','fax','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0d31,0x6d));var _0x10d3=function(_0x4115c6,_0x3cc8be){_0x4115c6=_0x4115c6-0x0;var _0x3c675e=_0x0d31[_0x4115c6];return _0x3c675e;};'use strict';var _=require(_0x10d3('0x0'));var db=require(_0x10d3('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x10d3('0x2')),'mail':require('../../config/logger')(_0x10d3('0x3')),'fax':require(_0x10d3('0x4'))(_0x10d3('0x5')),'sms':require(_0x10d3('0x4'))(_0x10d3('0x6')),'chat':require(_0x10d3('0x4'))(_0x10d3('0x7')),'whatsapp':require(_0x10d3('0x4'))('whatsapp-interactions')};function getInteractionId(_0x1218d2,_0x574eca,_0x5248a8){if(_0x1218d2&&_0x1218d2[_[_0x10d3('0x8')](_0x5248a8)+'InteractionId']){return _0x1218d2[_[_0x10d3('0x8')](_0x5248a8)+_0x10d3('0x9')];}else if(_0x1218d2&&_0x1218d2['id']){return _0x1218d2['id'];}else if(_0x574eca&&_0x574eca['id']){return _0x574eca['id'];}else{return _0x10d3('0xa');}}function log(_0x42dd32,_0x5383cb,_0x6ebeb0,_0x446f83,_0x55d4be,_0x14354a){loggers[_0x55d4be[_0x10d3('0xb')]()][_0x42dd32](_0x10d3('0xc'),_0x14354a[_0x10d3('0xd')](),_0x5383cb?_0x5383cb['id']:null,_0x5383cb?_0x5383cb[_0x10d3('0xe')]:null,_0x5383cb?_0x5383cb[_0x10d3('0xf')]:null,getInteractionId(_0x6ebeb0,_0x446f83,_0x55d4be),_0x6ebeb0?JSON[_0x10d3('0x10')](_0x6ebeb0):'null');}function updateUser(_0x317282,_0x1bc549,_0x6c58d1,_0x548a68,_0x1680c0){db[_['upperFirst'](_0x548a68)+_0x10d3('0x11')][_0x10d3('0x12')]({'where':{'id':getInteractionId(_0x1bc549,_0x6c58d1,_0x548a68)}})['then'](function(_0x1a34cd){if(_0x1a34cd){return _0x1a34cd[_0x10d3('0x13')]({'UserId':_0x317282?_0x317282['id']:null});}})[_0x10d3('0x14')](function(_0x5251c1){if(_0x5251c1){log(_0x10d3('0x15'),_0x317282,_0x1bc549,_0x6c58d1,_0x548a68,_0x1680c0);}})[_0x10d3('0x16')](function(){log(_0x10d3('0x17'),_0x317282,_0x1bc549,_0x6c58d1,_0x548a68,_0x1680c0);});}exports[_0x10d3('0x18')]=function(_0x4e357b,_0x115e19){return function(_0x4ba6bc,_0x14c96e,_0x203ced){var _0x1ee9be=_0x4ba6bc['user'];var _0x5f3984={};var _0x426699=_0x4ba6bc[_0x10d3('0x19')];if(_0x5f3984){_0x5f3984=_[_0x10d3('0x1a')](_0x4ba6bc[_0x10d3('0x1b')]);_0x5f3984=_[_0x10d3('0x1c')](_0x5f3984,['body','html',_0x10d3('0x1d'),_0x10d3('0x1e'),'mobile']);}updateUser(_0x1ee9be,_0x5f3984,_0x426699,_0x4e357b,_0x115e19);_0x203ced(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 30d589b..79666e1 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 _0x668a=['split','createDecipher','aes-256-ctr','%s:%s:%s','update','utf8','use','License','findOne','then','count','status','json','format','catch','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x668a,0x17f));var _0xa668=function(_0x5c59d6,_0x4ebd6e){_0x5c59d6=_0x5c59d6-0x0;var _0x5904f1=_0x668a[_0x5c59d6];return _0x5904f1;};'use strict';var crypto=require(_0xa668('0x0'));var util=require(_0xa668('0x1'));var compose=require(_0xa668('0x2'));var db=require(_0xa668('0x3'))['db'];var config=require(_0xa668('0x4'));function getValueFromLicense(_0xce390a,_0x4903cf){if(_0xce390a&&_0x4903cf){if(_0x4903cf[_0xa668('0x5')]&&_0x4903cf[_0xa668('0x6')]){var _0x43fac6=_0x4903cf[_0xa668('0x5')];var _0xd7ef8c=_0x4903cf[_0xa668('0x6')];var _0x332c0c=_0x43fac6[_0xa668('0x7')]('-')[0x4];var _0x4121c8=_0x43fac6[_0xa668('0x7')]('-')[0x0];var _0x39575c=crypto[_0xa668('0x8')](_0xa668('0x9'),util['format'](_0xa668('0xa'),_0x332c0c,_0x43fac6,_0x4121c8));var _0xb708cc=_0x39575c[_0xa668('0xb')](_0xd7ef8c,'base64','utf8');_0xb708cc+=_0x39575c['final'](_0xa668('0xc'));var _0xb26172=JSON['parse'](_0xb708cc);return _0xb26172['hasOwnProperty'](_0xce390a)?_0xb26172[_0xce390a]:null;}}return null;}function isLimit(_0x2b162f,_0x1bbe60,_0x2fddac,_0x7875fc){var _0x5a7a43=_0x1bbe60;return compose()[_0xa668('0xd')](function(_0xb4b3cb,_0x1680ea,_0x199452){return db[_0xa668('0xe')][_0xa668('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xa668('0x10')](function(_0x830077){var _0x45ffb5=getValueFromLicense(_0x2b162f,_0x830077);return _0x45ffb5?_0x45ffb5:_0x5a7a43;})[_0xa668('0x10')](function(_0x3e9354){_0x5a7a43=_0x3e9354;return _0x2fddac[_0xa668('0x11')](_0x7875fc);})[_0xa668('0x10')](function(_0x91283d){if(_0x91283d>=_0x5a7a43){return _0x1680ea[_0xa668('0x12')](0x193)[_0xa668('0x13')]({'message':util[_0xa668('0x14')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2b162f)});}_0x199452();})[_0xa668('0x15')](function(_0x3012ba){_0x199452(_0x3012ba);});});}function isUserLimit(){return isLimit(_0xa668('0x16'),0x1,db[_0xa668('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xa668('0x18')}]}});}exports[_0xa668('0x19')]=isUserLimit; \ No newline at end of file +var _0xb90b=['admin','crypto','util','composable-middleware','../../mysqldb','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','hasOwnProperty','use','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users'];(function(_0x5f0d74,_0x55a31a){var _0x38f566=function(_0x18eafc){while(--_0x18eafc){_0x5f0d74['push'](_0x5f0d74['shift']());}};_0x38f566(++_0x55a31a);}(_0xb90b,0xa9));var _0xbb90=function(_0x3fe1b8,_0x3e1a18){_0x3fe1b8=_0x3fe1b8-0x0;var _0x5f0555=_0xb90b[_0x3fe1b8];return _0x5f0555;};'use strict';var crypto=require(_0xbb90('0x0'));var util=require(_0xbb90('0x1'));var compose=require(_0xbb90('0x2'));var db=require(_0xbb90('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4cfdf0,_0x58342a){if(_0x4cfdf0&&_0x58342a){if(_0x58342a['data1']&&_0x58342a[_0xbb90('0x4')]){var _0x5dd45c=_0x58342a[_0xbb90('0x5')];var _0x47ca05=_0x58342a['license'];var _0xd6f846=_0x5dd45c[_0xbb90('0x6')]('-')[0x4];var _0x19e0f6=_0x5dd45c['split']('-')[0x0];var _0x8bf0c6=crypto[_0xbb90('0x7')](_0xbb90('0x8'),util[_0xbb90('0x9')](_0xbb90('0xa'),_0xd6f846,_0x5dd45c,_0x19e0f6));var _0x3812b2=_0x8bf0c6[_0xbb90('0xb')](_0x47ca05,_0xbb90('0xc'),'utf8');_0x3812b2+=_0x8bf0c6[_0xbb90('0xd')]('utf8');var _0x468681=JSON[_0xbb90('0xe')](_0x3812b2);return _0x468681[_0xbb90('0xf')](_0x4cfdf0)?_0x468681[_0x4cfdf0]:null;}}return null;}function isLimit(_0x3c15b5,_0x32a881,_0x215568,_0x523a95){var _0x5d7c8e=_0x32a881;return compose()[_0xbb90('0x10')](function(_0x1aa684,_0x4e2506,_0x3223cf){return db['License'][_0xbb90('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x115f7c){var _0x3c8d5f=getValueFromLicense(_0x3c15b5,_0x115f7c);return _0x3c8d5f?_0x3c8d5f:_0x5d7c8e;})[_0xbb90('0x12')](function(_0x45ccd3){_0x5d7c8e=_0x45ccd3;return _0x215568[_0xbb90('0x13')](_0x523a95);})[_0xbb90('0x12')](function(_0x541ff9){if(_0x541ff9>=_0x5d7c8e){return _0x4e2506['status'](0x193)[_0xbb90('0x14')]({'message':util[_0xbb90('0x9')](_0xbb90('0x15'),_0x3c15b5)});}_0x3223cf();})['catch'](function(_0x338e47){_0x3223cf(_0x338e47);});});}function isUserLimit(){return isLimit(_0xbb90('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0xbb90('0x17')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5a43ae2..ee8a58a 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 _0x8d84=['parseSearch','[$or]','and','[$and]','split','length','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','$eq','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash'];(function(_0x422cae,_0x37d959){var _0x332129=function(_0x67c0ba){while(--_0x67c0ba){_0x422cae['push'](_0x422cae['shift']());}};_0x332129(++_0x37d959);}(_0x8d84,0x95));var _0x48d8=function(_0x9d9496,_0x3d33e9){_0x9d9496=_0x9d9496-0x0;var _0x141a5a=_0x8d84[_0x9d9496];return _0x141a5a;};'use strict';var _=require(_0x48d8('0x0'));var moment=require('moment');exports[_0x48d8('0x1')]=function(_0x3a756c){var _0x1379fc={'conditions':[]};_0x1379fc['sqlOperator']=_['startsWith'](_0x3a756c,_0x48d8('0x2'))?'or':_0x48d8('0x3');var _0x1a9c86=_0x3a756c['replace'](_0x48d8('0x4'),'')['replace'](_0x48d8('0x2'),'')[_0x48d8('0x5')]('||');for(var _0x16793a=0x0;_0x16793a<_0x1a9c86[_0x48d8('0x6')];_0x16793a++){var _0x2539fd=_0x1a9c86[_0x16793a]['split'](':=');var _0x47b571=_0x2539fd[0x0];var _0xcd749e=_0x2539fd['slice'](0x1);_0xcd749e[_0x48d8('0x7')](function(_0x1705af){var _0x1907b3=_0x1705af[_0x48d8('0x5')]('[')['shift']();var _0x4a26c1=_0x1705af[_0x48d8('0x8')](/\[(.*?)\]/g);_0x4a26c1['forEach'](function(_0x1da7c8){var _0x36ee2b=_0x1da7c8[_0x48d8('0x5')]('[')[_0x48d8('0x9')](function(_0x2b293d){return _0x2b293d[_0x48d8('0xa')](']')>-0x1;})[_0x48d8('0xb')](function(_0x3370b9){return _0x3370b9['split'](']')[0x0];})[0x0];_0x1379fc[_0x48d8('0xc')][_0x48d8('0xd')]({'field':_0x47b571,'operator':_0x1907b3,'value':_0x36ee2b});});});}return _0x1379fc;};exports[_0x48d8('0xe')]=function(_0x50b775,_0x15305d,_0x37a4b3){var _0x2931e4={};if(_0x15305d===_0x48d8('0xf')){if(_0x37a4b3['operator']==='$eq'){_0x37a4b3[_0x48d8('0x10')]=_0x48d8('0x11');_0x37a4b3[_0x48d8('0x12')]+=','+_0x37a4b3['value'];}else if(_[_0x48d8('0x13')]([_0x48d8('0x14'),_0x48d8('0x15')],_0x37a4b3[_0x48d8('0x10')])){_0x37a4b3[_0x48d8('0x12')]=moment(_0x37a4b3[_0x48d8('0x12')])[_0x48d8('0x16')](0x1,_0x48d8('0x17'))[_0x48d8('0x18')]('YYYY-MM-DD');}}if(_0x37a4b3[_0x48d8('0x19')]){_0x15305d=_0x37a4b3[_0x48d8('0x19')];_0x2931e4[_0x48d8('0x1a')]=_0x48d8('0x1b')+_0x50b775+'.'+_0x37a4b3[_0x48d8('0x1c')]+'\x20AS\x20'+_0x37a4b3[_0x48d8('0x19')]+')\x20'+parseOperator(_0x37a4b3[_0x48d8('0x10')]);}else{_0x2931e4[_0x48d8('0x1a')]=_0x50b775+'.'+_0x37a4b3[_0x48d8('0x1c')]+'\x20'+parseOperator(_0x37a4b3[_0x48d8('0x10')]);}if(_[_0x48d8('0x13')]([_0x48d8('0x1d'),_0x48d8('0x1e')],_0x37a4b3[_0x48d8('0x10')]))_0x2931e4[_0x48d8('0x1a')]='('+_0x2931e4['text']+_0x48d8('0x1f')+_0x50b775+'.'+_0x37a4b3[_0x48d8('0x1c')]+_0x48d8('0x20');_0x2931e4['value']=parseValue(_0x15305d,_0x37a4b3['operator'],_0x37a4b3['value']);return _0x2931e4;};function parseOperator(_0xfcbe19){var _0x2e09d5;switch(_0xfcbe19){case'$in':_0x2e09d5='IN\x20?';break;case _0x48d8('0x1e'):_0x2e09d5=_0x48d8('0x21');break;case _0x48d8('0x22'):_0x2e09d5='=\x20?';break;case _0x48d8('0x1d'):_0x2e09d5='<>\x20?';break;case'$substring':case _0x48d8('0x23'):case _0x48d8('0x24'):_0x2e09d5=_0x48d8('0x25');break;case _0x48d8('0x26'):_0x2e09d5='<\x20?';break;case'$gt':_0x2e09d5=_0x48d8('0x27');break;case _0x48d8('0x15'):_0x2e09d5=_0x48d8('0x28');break;case _0x48d8('0x29'):_0x2e09d5='>=\x20?';break;case _0x48d8('0x11'):_0x2e09d5=_0x48d8('0x2a');break;}return _0x2e09d5;}function parseValue(_0x77f41e,_0x26c2fe,_0x529bc0){var _0x1bd327={'start':undefined,'end':undefined};switch(_0x26c2fe){case'$in':case _0x48d8('0x1e'):_0x1bd327['start']=_0x529bc0[_0x48d8('0x5')](',');break;case'$substring':_0x1bd327[_0x48d8('0x2b')]='%'+_0x529bc0+'%';break;case _0x48d8('0x23'):_0x1bd327[_0x48d8('0x2b')]=_0x529bc0+'%';break;case _0x48d8('0x24'):_0x1bd327['start']='%'+_0x529bc0;break;case'$between':var _0x3bbf30=_0x529bc0[_0x48d8('0x5')](',');var _0x529bc0=_0x3bbf30[_0x48d8('0x2c')]();var _0x220b16=_0x3bbf30[_0x48d8('0x2d')]();if(_0x77f41e===_0x48d8('0xf')){_0x529bc0=moment(_0x529bc0)[_0x48d8('0x2e')](0x0,!![])['format']();_0x220b16=moment(_0x220b16)['utcOffset'](0x0,!![])['add'](0x17,_0x48d8('0x2f'))[_0x48d8('0x16')](0x3b,_0x48d8('0x30'))['add'](0x3b,_0x48d8('0x31'))[_0x48d8('0x18')]();}_0x1bd327={'start':_0x529bc0,'end':_0x220b16};break;default:_0x1bd327[_0x48d8('0x2b')]=_0x529bc0;break;}return _0x1bd327;} \ No newline at end of file +var _0x36e4=['<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','and','replace','[$and]','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','DATE','operator','$eq','$between','value','includes','$lte','add','format','castTo','field','text','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne'];(function(_0x5b7d97,_0x2b24b3){var _0xd99a4=function(_0x4a6c5f){while(--_0x4a6c5f){_0x5b7d97['push'](_0x5b7d97['shift']());}};_0xd99a4(++_0x2b24b3);}(_0x36e4,0xad));var _0x436e=function(_0x189360,_0xf00603){_0x189360=_0x189360-0x0;var _0x3e3477=_0x36e4[_0x189360];return _0x3e3477;};'use strict';var _=require(_0x436e('0x0'));var moment=require(_0x436e('0x1'));exports[_0x436e('0x2')]=function(_0x4391bb){var _0x1b1ad4={'conditions':[]};_0x1b1ad4['sqlOperator']=_['startsWith'](_0x4391bb,'[$or]')?'or':_0x436e('0x3');var _0x1ae9d2=_0x4391bb[_0x436e('0x4')](_0x436e('0x5'),'')[_0x436e('0x4')](_0x436e('0x6'),'')[_0x436e('0x7')]('||');for(var _0x488766=0x0;_0x488766<_0x1ae9d2[_0x436e('0x8')];_0x488766++){var _0x3b8273=_0x1ae9d2[_0x488766][_0x436e('0x7')](':=');var _0x464e8a=_0x3b8273[0x0];var _0x3fab61=_0x3b8273[_0x436e('0x9')](0x1);_0x3fab61[_0x436e('0xa')](function(_0xb001eb){var _0x235d02=_0xb001eb[_0x436e('0x7')]('[')[_0x436e('0xb')]();var _0x143a66=_0xb001eb[_0x436e('0xc')](/\[(.*?)\]/g);_0x143a66[_0x436e('0xa')](function(_0x3067e6){var _0x2e3d97=_0x3067e6[_0x436e('0x7')]('[')[_0x436e('0xd')](function(_0x183921){return _0x183921[_0x436e('0xe')](']')>-0x1;})['map'](function(_0x61eb05){return _0x61eb05[_0x436e('0x7')](']')[0x0];})[0x0];_0x1b1ad4[_0x436e('0xf')][_0x436e('0x10')]({'field':_0x464e8a,'operator':_0x235d02,'value':_0x2e3d97});});});}return _0x1b1ad4;};exports['buildExpression']=function(_0x19f8d4,_0xbbd700,_0x21831a){var _0x4b7fc2={};if(_0xbbd700===_0x436e('0x11')){if(_0x21831a[_0x436e('0x12')]===_0x436e('0x13')){_0x21831a[_0x436e('0x12')]=_0x436e('0x14');_0x21831a[_0x436e('0x15')]+=','+_0x21831a['value'];}else if(_[_0x436e('0x16')](['$gt',_0x436e('0x17')],_0x21831a[_0x436e('0x12')])){_0x21831a[_0x436e('0x15')]=moment(_0x21831a[_0x436e('0x15')])[_0x436e('0x18')](0x1,'days')[_0x436e('0x19')]('YYYY-MM-DD');}}if(_0x21831a['castTo']){_0xbbd700=_0x21831a[_0x436e('0x1a')];_0x4b7fc2['text']='CAST('+_0x19f8d4+'.'+_0x21831a[_0x436e('0x1b')]+'\x20AS\x20'+_0x21831a['castTo']+')\x20'+parseOperator(_0x21831a[_0x436e('0x12')]);}else{_0x4b7fc2[_0x436e('0x1c')]=_0x19f8d4+'.'+_0x21831a[_0x436e('0x1b')]+'\x20'+parseOperator(_0x21831a[_0x436e('0x12')]);}if(_[_0x436e('0x16')](['$ne','$notIn'],_0x21831a['operator']))_0x4b7fc2[_0x436e('0x1c')]='('+_0x4b7fc2[_0x436e('0x1c')]+'\x20OR\x20'+_0x19f8d4+'.'+_0x21831a['field']+'\x20IS\x20NULL)';_0x4b7fc2[_0x436e('0x15')]=parseValue(_0xbbd700,_0x21831a[_0x436e('0x12')],_0x21831a[_0x436e('0x15')]);return _0x4b7fc2;};function parseOperator(_0x556c0f){var _0x950b39;switch(_0x556c0f){case _0x436e('0x1d'):_0x950b39=_0x436e('0x1e');break;case _0x436e('0x1f'):_0x950b39=_0x436e('0x20');break;case _0x436e('0x13'):_0x950b39=_0x436e('0x21');break;case _0x436e('0x22'):_0x950b39=_0x436e('0x23');break;case _0x436e('0x24'):case _0x436e('0x25'):case _0x436e('0x26'):_0x950b39=_0x436e('0x27');break;case _0x436e('0x28'):_0x950b39=_0x436e('0x29');break;case _0x436e('0x2a'):_0x950b39=_0x436e('0x2b');break;case _0x436e('0x17'):_0x950b39=_0x436e('0x2c');break;case'$gte':_0x950b39=_0x436e('0x2d');break;case _0x436e('0x14'):_0x950b39=_0x436e('0x2e');break;}return _0x950b39;}function parseValue(_0x1d5d1a,_0x3e2500,_0x2c5f68){var _0x591fb1={'start':undefined,'end':undefined};switch(_0x3e2500){case _0x436e('0x1d'):case _0x436e('0x1f'):_0x591fb1[_0x436e('0x2f')]=_0x2c5f68[_0x436e('0x7')](',');break;case _0x436e('0x24'):_0x591fb1[_0x436e('0x2f')]='%'+_0x2c5f68+'%';break;case _0x436e('0x25'):_0x591fb1['start']=_0x2c5f68+'%';break;case _0x436e('0x26'):_0x591fb1['start']='%'+_0x2c5f68;break;case _0x436e('0x14'):var _0x2b850d=_0x2c5f68[_0x436e('0x7')](',');var _0x2c5f68=_0x2b850d[_0x436e('0xb')]();var _0x13e5c9=_0x2b850d[_0x436e('0x30')]();if(_0x1d5d1a==='DATE'){_0x2c5f68=moment(_0x2c5f68)[_0x436e('0x31')](0x0,!![])[_0x436e('0x19')]();_0x13e5c9=moment(_0x13e5c9)[_0x436e('0x31')](0x0,!![])[_0x436e('0x18')](0x17,'hours')[_0x436e('0x18')](0x3b,_0x436e('0x32'))[_0x436e('0x18')](0x3b,_0x436e('0x33'))[_0x436e('0x19')]();}_0x591fb1={'start':_0x2c5f68,'end':_0x13e5c9};break;default:_0x591fb1[_0x436e('0x2f')]=_0x2c5f68;break;}return _0x591fb1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 492cffa..e4a976f 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 _0x4e8a=['unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','getOptions','query','$id','model','keys','intersection','attributes','order','pick','filter','where','merge','VIRTUAL','lower','options','lodash','sequelize','moment','fields','split','filters','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','omit','isEmpty','length','isObject','isString'];(function(_0x4f953f,_0x293a9e){var _0x5e8713=function(_0xe99282){while(--_0xe99282){_0x4f953f['push'](_0x4f953f['shift']());}};_0x5e8713(++_0x293a9e);}(_0x4e8a,0x14b));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa4e8('0x0'));var sequelize=require(_0xa4e8('0x1'));var moment=require(_0xa4e8('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33870c){var _0x2937cc=['ne'];try{var _0x52381e=JSON['parse'](_0x33870c);var _0x50144b=Object['keys'](_0x52381e)[0x0];return _0x2937cc['includes'](_0x50144b);}catch(_0x51493e){return![];}}function getOperatorValue(_0x492700){var _0x3194fd=JSON['parse'](_0x492700);var _0x253195=Object['keys'](_0x3194fd)[0x0];var _0x6072ab=_0x3194fd[_0x253195];return{['$'+_0x253195]:_0x6072ab};}exports[_0xa4e8('0x3')]=function(_0xead4cb){var _0x59942c=null;if(_0xead4cb){_0x59942c=_0xead4cb[_0xa4e8('0x4')](',');}return _0x59942c;};exports[_0xa4e8('0x5')]=function(_0x4cae71,_0x49d716){var _0x426a11={};if(!_['isEmpty'](_0x4cae71)){_['forOwn'](_0x4cae71,function(_0x1797bb,_0x1c5a9a){try{if(_0x49d716){var _0x18945f=_['find'](_0x49d716,{'name':_0x1c5a9a})||{};if(hasSequelizeOperator(_0x1797bb)){_0x426a11[_0x1c5a9a]=getOperatorValue(_0x1797bb);}else if(_0x18945f[_0xa4e8('0x6')]===_0xa4e8('0x7')&&_[_0xa4e8('0x8')](_0x1797bb)){var _0x24dc91=JSON[_0xa4e8('0x9')](_0x1797bb);var _0x27d617={'$gte':moment(moment(_0x24dc91['$gte'])[_0xa4e8('0xa')](_0xa4e8('0xb')))[_0xa4e8('0xc')]()['format'](),'$lte':moment(moment(_0x24dc91[_0xa4e8('0xd')])[_0xa4e8('0xa')]('YYYY-MM-DD'))[_0xa4e8('0xc')]()[_0xa4e8('0xe')](0x1,'s')[_0xa4e8('0xa')]()};_0x426a11[_0x1c5a9a]=_0x27d617;}else if(_0x18945f[_0xa4e8('0xf')]===_0xa4e8('0x10')){_0x426a11[_0x1c5a9a]=_0x1797bb;}else{_0x426a11[_0x1c5a9a]=_[_0xa4e8('0x11')](_0x1797bb)?_0x1797bb:JSON['parse'](_0x1797bb);}}else{_0x426a11[_0x1c5a9a]=_['isArray'](_0x1797bb)?_0x1797bb:JSON['parse'](_0x1797bb);}}catch(_0x197f9f){_0x426a11[_0x1c5a9a]=_0x1797bb[_0xa4e8('0x4')](',');}});}return _0x426a11;};exports[_0xa4e8('0x12')]=function(_0x5143f7){_0x5143f7=parseInt(_0x5143f7,0xa);if(!_0x5143f7||_0x5143f7<0x0){_0x5143f7=LIMIT_VALUE;}return _0x5143f7;};exports[_0xa4e8('0x13')]=function(_0xa71968){_0xa71968=parseInt(_0xa71968,0xa);if(!_0xa71968||_0xa71968<0x0){_0xa71968=0x0;}return _0xa71968;};exports[_0xa4e8('0x14')]=function(_0x2bcf36){var _0x3250c8,_0x3bed9a=null;if(_0x2bcf36){_0x3250c8=_0x2bcf36['split'](',');_0x3bed9a=_[_0xa4e8('0x15')](_0x3250c8,function(_0x197ee8){if(_0x197ee8[_0xa4e8('0x16')]('-')===0x0){return[_0x197ee8===_0xa4e8('0x17')?sequelize[_0xa4e8('0x18')](sequelize['col']('priority'),_0xa4e8('0x19')):_0x197ee8[_0xa4e8('0x1a')](0x1),_0xa4e8('0x1b')];}else{return[_0x197ee8===_0xa4e8('0x17')?sequelize['cast'](sequelize[_0xa4e8('0x1c')](_0xa4e8('0x17')),_0xa4e8('0x19')):_0x197ee8,_0xa4e8('0x1d')];}});}return _0x3bed9a;};exports[_0xa4e8('0x1e')]=function(_0x4683da,_0x993d81){if(_[_0xa4e8('0x1f')](_0x4683da)){return _0x4683da;}if(_['isArray'](_0x4683da)){for(var _0x23e83c=0x0;_0x23e83c<_0x4683da[_0xa4e8('0x20')];_0x23e83c+=0x1){_0x4683da[_0x23e83c]=this[_0xa4e8('0x1e')](_0x4683da[_0x23e83c],_0x993d81);}return _0x4683da;}if(!_[_0xa4e8('0x21')](_0x4683da)){return _0x4683da;}if(_[_0xa4e8('0x22')](_0x993d81)){_0x993d81=[_0x993d81];}if(!_[_0xa4e8('0x11')](_0x993d81)){return _0x4683da;}for(var _0x585de2=0x0;_0x585de2<_0x993d81[_0xa4e8('0x20')];_0x585de2+=0x1){_[_0xa4e8('0x23')](_0x4683da,_0x993d81[_0x585de2]);}for(var _0x4a0614 in _0x4683da){if(_0x4683da['hasOwnProperty'](_0x4a0614)){_0x4683da[_0x4a0614]=this[_0xa4e8('0x1e')](_0x4683da[_0x4a0614],_0x993d81);}}return _0x4683da;};exports[_0xa4e8('0x24')]=function(_0x340146){return _0x340146[_0xa4e8('0x25')](RegExp(_0xa4e8('0x26')))?!![]:![];};exports[_0xa4e8('0x27')]=function(_0xd8e572){return _0xd8e572['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa4e8('0x28')]=function(_0x5b28ef){var _0x523236=[];_0x5b28ef[_0xa4e8('0x4')](/[ ,]+/)[_0xa4e8('0x29')](function(_0x5d5540){_0x5d5540=_0x5d5540[_0xa4e8('0x2a')](/([^:]")"+/g,'$1');_0x5d5540='+'+_0x5d5540+'*';if(_0x5d5540[_0xa4e8('0x2b')]('@'))_0x5d5540='\x22'+_0x5d5540+'\x22';_0x523236[_0xa4e8('0x2c')](_0x5d5540);});return _0x523236[_0xa4e8('0x2d')]('\x20');};exports[_0xa4e8('0x2e')]=function(_0xb72eb,_0x426c1c,_0x986df0){var _0x35d5e3={},_0x9c8f58={};if(_0x426c1c[_0xa4e8('0x2f')][_0xa4e8('0x30')]){_0x426c1c[_0xa4e8('0x2f')]['id']=_0x426c1c[_0xa4e8('0x2f')]['$id'];delete _0x426c1c[_0xa4e8('0x2f')][_0xa4e8('0x30')];}_0x35d5e3[_0xa4e8('0x31')]=_[_0xa4e8('0x15')](_0xb72eb,'name');_0x35d5e3[_0xa4e8('0x2f')]=_[_0xa4e8('0x32')](_0x426c1c[_0xa4e8('0x2f')]);_0x35d5e3['filters']=_[_0xa4e8('0x33')](_0x35d5e3[_0xa4e8('0x31')],_0x35d5e3[_0xa4e8('0x2f')]);_0x9c8f58[_0xa4e8('0x34')]=_[_0xa4e8('0x33')](_0x35d5e3[_0xa4e8('0x31')],this[_0xa4e8('0x3')](_0x426c1c['query']['fields']));_0x9c8f58[_0xa4e8('0x34')]=_0x9c8f58['attributes']['length']?_0x9c8f58[_0xa4e8('0x34')]:_0x35d5e3['model'];if(!_0x426c1c[_0xa4e8('0x2f')]['hasOwnProperty']('nolimit')){_0x9c8f58[_0xa4e8('0x12')]=this[_0xa4e8('0x12')](_0x426c1c[_0xa4e8('0x2f')][_0xa4e8('0x12')]);_0x9c8f58[_0xa4e8('0x13')]=this[_0xa4e8('0x13')](_0x426c1c[_0xa4e8('0x2f')][_0xa4e8('0x13')]);}_0x9c8f58[_0xa4e8('0x35')]=this[_0xa4e8('0x14')](_0x426c1c[_0xa4e8('0x2f')][_0xa4e8('0x14')]);_0x9c8f58['where']=this[_0xa4e8('0x5')](_[_0xa4e8('0x36')](_0x426c1c[_0xa4e8('0x2f')],_0x35d5e3['filters']),_0xb72eb);if(_0x426c1c['query'][_0xa4e8('0x37')]){_0x9c8f58[_0xa4e8('0x38')]=_[_0xa4e8('0x39')](_0x9c8f58[_0xa4e8('0x38')],{'$or':_['map'](_0xb72eb,function(_0x2a8858){if(_0x2a8858[_0xa4e8('0x6')]!==_0xa4e8('0x3a')){if(_0x986df0){return sequelize['where'](sequelize['fn'](_0xa4e8('0x3b'),sequelize[_0xa4e8('0x1c')](_0x2a8858[_0xa4e8('0xf')])),{'$like':sequelize['fn'](_0xa4e8('0x3b'),'%'+_0x426c1c[_0xa4e8('0x2f')]['filter']+'%')});}else{var _0x2153b4={};_0x2153b4[_0x2a8858[_0xa4e8('0xf')]]={'$like':'%'+_0x426c1c[_0xa4e8('0x2f')]['filter']+'%'};return _0x2153b4;}}})});}_0x9c8f58=_[_0xa4e8('0x39')]({},_0x9c8f58,_0x426c1c[_0xa4e8('0x3c')]);return _0x9c8f58;}; \ No newline at end of file +var _0xd734=['lower','col','filter','options','sequelize','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','DATE','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','indexOf','priority','cast','DESC','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','replace','join','query','$id','model','map','attributes','nolimit','where','pick','merge','VIRTUAL'];(function(_0x34ca92,_0x695326){var _0x45acc4=function(_0x53bc46){while(--_0x53bc46){_0x34ca92['push'](_0x34ca92['shift']());}};_0x45acc4(++_0x695326);}(_0xd734,0x6c));var _0x4d73=function(_0x34e012,_0x179222){_0x34e012=_0x34e012-0x0;var _0xca7d6e=_0xd734[_0x34e012];return _0xca7d6e;};'use strict';var _=require('lodash');var sequelize=require(_0x4d73('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3e4959){var _0x1f8f2d=['ne'];try{var _0x5eea99=JSON[_0x4d73('0x1')](_0x3e4959);var _0x529a7c=Object[_0x4d73('0x2')](_0x5eea99)[0x0];return _0x1f8f2d[_0x4d73('0x3')](_0x529a7c);}catch(_0x573769){return![];}}function getOperatorValue(_0x5360a){var _0x5e4e2e=JSON[_0x4d73('0x1')](_0x5360a);var _0x17f9d3=Object[_0x4d73('0x2')](_0x5e4e2e)[0x0];var _0x49a784=_0x5e4e2e[_0x17f9d3];return{['$'+_0x17f9d3]:_0x49a784};}exports[_0x4d73('0x4')]=function(_0x5a2f59){var _0xd2807=null;if(_0x5a2f59){_0xd2807=_0x5a2f59[_0x4d73('0x5')](',');}return _0xd2807;};exports[_0x4d73('0x6')]=function(_0x4372bb,_0x1520f3){var _0x19702b={};if(!_[_0x4d73('0x7')](_0x4372bb)){_[_0x4d73('0x8')](_0x4372bb,function(_0x110489,_0x513e6a){try{if(_0x1520f3){var _0x3ed792=_[_0x4d73('0x9')](_0x1520f3,{'name':_0x513e6a})||{};if(hasSequelizeOperator(_0x110489)){_0x19702b[_0x513e6a]=getOperatorValue(_0x110489);}else if(_0x3ed792['type']===_0x4d73('0xa')&&_['isPlainObject'](_0x110489)){var _0x400a21=JSON['parse'](_0x110489);var _0x3b64b5={'$gte':moment(moment(_0x400a21['$gte'])[_0x4d73('0xb')](_0x4d73('0xc')))[_0x4d73('0xd')]()[_0x4d73('0xb')](),'$lte':moment(moment(_0x400a21[_0x4d73('0xe')])[_0x4d73('0xb')](_0x4d73('0xc')))['utc']()[_0x4d73('0xf')](0x1,'s')[_0x4d73('0xb')]()};_0x19702b[_0x513e6a]=_0x3b64b5;}else if(_0x3ed792[_0x4d73('0x10')]==='uniqueid'){_0x19702b[_0x513e6a]=_0x110489;}else{_0x19702b[_0x513e6a]=_[_0x4d73('0x11')](_0x110489)?_0x110489:JSON[_0x4d73('0x1')](_0x110489);}}else{_0x19702b[_0x513e6a]=_[_0x4d73('0x11')](_0x110489)?_0x110489:JSON[_0x4d73('0x1')](_0x110489);}}catch(_0x238ed4){_0x19702b[_0x513e6a]=_0x110489[_0x4d73('0x5')](',');}});}return _0x19702b;};exports[_0x4d73('0x12')]=function(_0x230991){_0x230991=parseInt(_0x230991,0xa);if(!_0x230991||_0x230991<0x0){_0x230991=LIMIT_VALUE;}return _0x230991;};exports[_0x4d73('0x13')]=function(_0xc7bcec){_0xc7bcec=parseInt(_0xc7bcec,0xa);if(!_0xc7bcec||_0xc7bcec<0x0){_0xc7bcec=0x0;}return _0xc7bcec;};exports[_0x4d73('0x14')]=function(_0x213449){var _0x2fbcc6,_0x1e6a5e=null;if(_0x213449){_0x2fbcc6=_0x213449[_0x4d73('0x5')](',');_0x1e6a5e=_['map'](_0x2fbcc6,function(_0x8a06a2){if(_0x8a06a2[_0x4d73('0x15')]('-')===0x0){return[_0x8a06a2===_0x4d73('0x16')?sequelize[_0x4d73('0x17')](sequelize['col']('priority'),'unsigned'):_0x8a06a2['substr'](0x1),_0x4d73('0x18')];}else{return[_0x8a06a2===_0x4d73('0x16')?sequelize[_0x4d73('0x17')](sequelize['col'](_0x4d73('0x16')),_0x4d73('0x19')):_0x8a06a2,_0x4d73('0x1a')];}});}return _0x1e6a5e;};exports[_0x4d73('0x1b')]=function(_0x91ca3,_0x4af653){if(_[_0x4d73('0x7')](_0x91ca3)){return _0x91ca3;}if(_[_0x4d73('0x11')](_0x91ca3)){for(var _0x3f7466=0x0;_0x3f7466<_0x91ca3[_0x4d73('0x1c')];_0x3f7466+=0x1){_0x91ca3[_0x3f7466]=this[_0x4d73('0x1b')](_0x91ca3[_0x3f7466],_0x4af653);}return _0x91ca3;}if(!_[_0x4d73('0x1d')](_0x91ca3)){return _0x91ca3;}if(_[_0x4d73('0x1e')](_0x4af653)){_0x4af653=[_0x4af653];}if(!_[_0x4d73('0x11')](_0x4af653)){return _0x91ca3;}for(var _0x2d337c=0x0;_0x2d337c<_0x4af653[_0x4d73('0x1c')];_0x2d337c+=0x1){_[_0x4d73('0x1f')](_0x91ca3,_0x4af653[_0x2d337c]);}for(var _0x40ea1d in _0x91ca3){if(_0x91ca3[_0x4d73('0x20')](_0x40ea1d)){_0x91ca3[_0x40ea1d]=this[_0x4d73('0x1b')](_0x91ca3[_0x40ea1d],_0x4af653);}}return _0x91ca3;};exports[_0x4d73('0x21')]=function(_0x1ec33b){return _0x1ec33b['match'](RegExp(_0x4d73('0x22')))?!![]:![];};exports['isEmail']=function(_0x1f487b){return _0x1f487b[_0x4d73('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4bc4fe){var _0x2f59ae=[];_0x4bc4fe[_0x4d73('0x5')](/[ ,]+/)['forEach'](function(_0x5ded73){_0x5ded73=_0x5ded73[_0x4d73('0x24')](/([^:]")"+/g,'$1');_0x5ded73='+'+_0x5ded73+'*';if(_0x5ded73[_0x4d73('0x3')]('@'))_0x5ded73='\x22'+_0x5ded73+'\x22';_0x2f59ae['push'](_0x5ded73);});return _0x2f59ae[_0x4d73('0x25')]('\x20');};exports['getOptions']=function(_0x84d0cf,_0x439f01,_0xe6ab8b){var _0x2f6d9c={},_0x40d9ff={};if(_0x439f01[_0x4d73('0x26')][_0x4d73('0x27')]){_0x439f01[_0x4d73('0x26')]['id']=_0x439f01[_0x4d73('0x26')][_0x4d73('0x27')];delete _0x439f01[_0x4d73('0x26')][_0x4d73('0x27')];}_0x2f6d9c[_0x4d73('0x28')]=_[_0x4d73('0x29')](_0x84d0cf,'name');_0x2f6d9c[_0x4d73('0x26')]=_[_0x4d73('0x2')](_0x439f01[_0x4d73('0x26')]);_0x2f6d9c[_0x4d73('0x6')]=_['intersection'](_0x2f6d9c[_0x4d73('0x28')],_0x2f6d9c['query']);_0x40d9ff[_0x4d73('0x2a')]=_['intersection'](_0x2f6d9c[_0x4d73('0x28')],this[_0x4d73('0x4')](_0x439f01[_0x4d73('0x26')]['fields']));_0x40d9ff[_0x4d73('0x2a')]=_0x40d9ff[_0x4d73('0x2a')][_0x4d73('0x1c')]?_0x40d9ff[_0x4d73('0x2a')]:_0x2f6d9c[_0x4d73('0x28')];if(!_0x439f01[_0x4d73('0x26')][_0x4d73('0x20')](_0x4d73('0x2b'))){_0x40d9ff[_0x4d73('0x12')]=this[_0x4d73('0x12')](_0x439f01[_0x4d73('0x26')][_0x4d73('0x12')]);_0x40d9ff[_0x4d73('0x13')]=this[_0x4d73('0x13')](_0x439f01[_0x4d73('0x26')][_0x4d73('0x13')]);}_0x40d9ff['order']=this[_0x4d73('0x14')](_0x439f01[_0x4d73('0x26')][_0x4d73('0x14')]);_0x40d9ff[_0x4d73('0x2c')]=this['filters'](_[_0x4d73('0x2d')](_0x439f01[_0x4d73('0x26')],_0x2f6d9c[_0x4d73('0x6')]),_0x84d0cf);if(_0x439f01[_0x4d73('0x26')]['filter']){_0x40d9ff['where']=_[_0x4d73('0x2e')](_0x40d9ff[_0x4d73('0x2c')],{'$or':_[_0x4d73('0x29')](_0x84d0cf,function(_0x1a60d6){if(_0x1a60d6['type']!==_0x4d73('0x2f')){if(_0xe6ab8b){return sequelize['where'](sequelize['fn'](_0x4d73('0x30'),sequelize[_0x4d73('0x31')](_0x1a60d6[_0x4d73('0x10')])),{'$like':sequelize['fn'](_0x4d73('0x30'),'%'+_0x439f01[_0x4d73('0x26')][_0x4d73('0x32')]+'%')});}else{var _0x3af197={};_0x3af197[_0x1a60d6[_0x4d73('0x10')]]={'$like':'%'+_0x439f01[_0x4d73('0x26')][_0x4d73('0x32')]+'%'};return _0x3af197;}}})});}_0x40d9ff=_['merge']({},_0x40d9ff,_0x439f01[_0x4d73('0x33')]);return _0x40d9ff;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cfc4aec..a04a88b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd21f=['engine','html','renderFile','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','default','get','set','appPath','join','root','development','client','use','json\x20replacer','toISOString','static','views','/server/views'];(function(_0x1ed81e,_0x27b902){var _0x52ef00=function(_0x2eb25f){while(--_0x2eb25f){_0x1ed81e['push'](_0x1ed81e['shift']());}};_0x52ef00(++_0x27b902);}(_0xd21f,0x1d6));var _0xfd21=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xd21f[_0x448f8];return _0xa73126;};'use strict';var express=require(_0xfd21('0x0'));var favicon=require(_0xfd21('0x1'));var bodyParser=require(_0xfd21('0x2'));var methodOverride=require(_0xfd21('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xfd21('0x4'));var path=require(_0xfd21('0x5'));var passport=require(_0xfd21('0x6'));var cors=require(_0xfd21('0x7'));var moment=require(_0xfd21('0x8'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0xfd21('0x9')]=function(_0x301e63){var _0x3b5c3b=_0x301e63[_0xfd21('0xa')]('env');if(_0x3b5c3b==='production'){_0x301e63[_0xfd21('0xb')](_0xfd21('0xc'),path[_0xfd21('0xd')](config[_0xfd21('0xe')],'public'));}if(_0x3b5c3b===_0xfd21('0xf')||_0x3b5c3b==='test'){_0x301e63[_0xfd21('0xb')](_0xfd21('0xc'),path[_0xfd21('0xd')](config[_0xfd21('0xe')],_0xfd21('0x10')));_0x301e63[_0xfd21('0x11')](errorHandler());}_0x301e63[_0xfd21('0xb')](_0xfd21('0x12'),function(_0x20e494,_0x4b7812){if(this[_0x20e494]instanceof Date){_0x4b7812=this[_0x20e494][_0xfd21('0x13')]()['split']('.')[0x0]+'Z';}return _0x4b7812;});_0x301e63[_0xfd21('0x11')](express[_0xfd21('0x14')](_0x301e63[_0xfd21('0xa')](_0xfd21('0xc'))));_0x301e63[_0xfd21('0xb')](_0xfd21('0x15'),config[_0xfd21('0xe')]+_0xfd21('0x16'));_0x301e63[_0xfd21('0x17')](_0xfd21('0x18'),require('ejs')[_0xfd21('0x19')]);_0x301e63['set']('view\x20engine',_0xfd21('0x18'));_0x301e63['use'](bodyParser[_0xfd21('0x1a')]({'limit':'50mb','extended':!![]}));_0x301e63[_0xfd21('0x11')](bodyParser['json']({'limit':_0xfd21('0x1b')}));_0x301e63[_0xfd21('0x11')](cors());_0x301e63[_0xfd21('0x11')](methodOverride());_0x301e63['use'](cookieParser());_0x301e63[_0xfd21('0x11')](passport[_0xfd21('0x1c')]());}; \ No newline at end of file +var _0x17e5=['body-parser','method-override','cookie-parser','path','passport','cors','./environment','default','get','env','join','root','public','development','appPath','json\x20replacer','toISOString','split','use','static','set','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17e5,0x13e));var _0x517e=function(_0x199798,_0x45585a){_0x199798=_0x199798-0x0;var _0x55f707=_0x17e5[_0x199798];return _0x55f707;};'use strict';var express=require(_0x517e('0x0'));var favicon=require(_0x517e('0x1'));var bodyParser=require(_0x517e('0x2'));var methodOverride=require(_0x517e('0x3'));var cookieParser=require(_0x517e('0x4'));var errorHandler=require('errorhandler');var path=require(_0x517e('0x5'));var passport=require(_0x517e('0x6'));var cors=require(_0x517e('0x7'));var moment=require('moment');var config=require(_0x517e('0x8'));var db=require('../mysqldb')['db'];exports[_0x517e('0x9')]=function(_0x25b2e0){var _0xd48d1e=_0x25b2e0[_0x517e('0xa')](_0x517e('0xb'));if(_0xd48d1e==='production'){_0x25b2e0['set']('appPath',path[_0x517e('0xc')](config[_0x517e('0xd')],_0x517e('0xe')));}if(_0xd48d1e===_0x517e('0xf')||_0xd48d1e==='test'){_0x25b2e0['set'](_0x517e('0x10'),path['join'](config[_0x517e('0xd')],'client'));_0x25b2e0['use'](errorHandler());}_0x25b2e0['set'](_0x517e('0x11'),function(_0x312be2,_0x4639ca){if(this[_0x312be2]instanceof Date){_0x4639ca=this[_0x312be2][_0x517e('0x12')]()[_0x517e('0x13')]('.')[0x0]+'Z';}return _0x4639ca;});_0x25b2e0[_0x517e('0x14')](express[_0x517e('0x15')](_0x25b2e0[_0x517e('0xa')](_0x517e('0x10'))));_0x25b2e0[_0x517e('0x16')](_0x517e('0x17'),config[_0x517e('0xd')]+_0x517e('0x18'));_0x25b2e0[_0x517e('0x19')](_0x517e('0x1a'),require(_0x517e('0x1b'))[_0x517e('0x1c')]);_0x25b2e0['set']('view\x20engine',_0x517e('0x1a'));_0x25b2e0['use'](bodyParser[_0x517e('0x1d')]({'limit':_0x517e('0x1e'),'extended':!![]}));_0x25b2e0[_0x517e('0x14')](bodyParser[_0x517e('0x1f')]({'limit':_0x517e('0x1e')}));_0x25b2e0[_0x517e('0x14')](cors());_0x25b2e0[_0x517e('0x14')](methodOverride());_0x25b2e0[_0x517e('0x14')](cookieParser());_0x25b2e0[_0x517e('0x14')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ec1d4a9..22e3136 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 _0xb75e=['replace','hostname','macAddress','ipAddress','createHash','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','join','md5','update','digest','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x1e8137,_0xc636dc){var _0x17812a=function(_0x1b099f){while(--_0x1b099f){_0x1e8137['push'](_0x1e8137['shift']());}};_0x17812a(++_0xc636dc);}(_0xb75e,0x8e));var _0xeb75=function(_0x3fc139,_0x1f4381){_0x3fc139=_0x3fc139-0x0;var _0xbc27de=_0xb75e[_0x3fc139];return _0xbc27de;};'use strict';var _=require(_0xeb75('0x0'));var os=require('os');var crypto=require(_0xeb75('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xeb75('0x2'))[_0xeb75('0x3')];var config=require(_0xeb75('0x4'));function getInterfaces(){var _0x5a1cbb=[];var _0x4297b7=os[_0xeb75('0x5')]();var _0x4b3fd2=_[_0xeb75('0x6')](_['keys'](_0x4297b7));for(var _0x2df9df=0x0;_0x2df9df<_0x4b3fd2['length'];_0x2df9df++){var _0x2e07ef=_0x4297b7[_0x4b3fd2[_0x2df9df]][_0xeb75('0x7')](function(_0x2c6ab3){return _0x2c6ab3[_0xeb75('0x8')]===_0xeb75('0x9')&&_0x2c6ab3[_0xeb75('0xa')]===![];});_0x5a1cbb=_0x5a1cbb[_0xeb75('0xb')](_0x2e07ef);}return _0x5a1cbb;}function getFirstInterface(){var _0xc610ff=_[_0xeb75('0xc')](getInterfaces());return{'macAddress':_0xc610ff&&_0xc610ff[_0xeb75('0xd')]?_0xc610ff[_0xeb75('0xd')]:_0xeb75('0xe'),'ipAddress':_0xc610ff&&_0xc610ff[_0xeb75('0xf')]?_0xc610ff[_0xeb75('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2fcb13=_[_0xeb75('0x6')](os[_0xeb75('0x10')]()[_0xeb75('0x11')](function(_0x436ed5){return _0x436ed5['model'];}))[_0xeb75('0x12')](':');return crypto['createHash'](_0xeb75('0x13'))[_0xeb75('0x14')](_0x2fcb13)[_0xeb75('0x15')](_0xeb75('0x16'));}exports[_0xeb75('0x17')]=function(){var _0x3a5ac4=os['platform']();var _0x5db9ff=/[0-9a-f-]{36}/;if(config[_0xeb75('0x18')]&&_0x5db9ff['test'](config['licenseToken'])){return config[_0xeb75('0x18')];}else if(_0x3a5ac4===_0xeb75('0x19')){return exec(_0xeb75('0x1a'),{'encoding':_0xeb75('0x1b')})[_0xeb75('0x1c')]('\x0d\x0a','');}else{var _0x310e72=getFirstInterface();var _0x292d3c=getCPUhash();var _0x3cd335=_0x292d3c+'|'+os[_0xeb75('0x1d')]()+'|'+_0x310e72[_0xeb75('0x1e')]+'|'+_0x310e72[_0xeb75('0x1f')];var _0x1e7979=crypto[_0xeb75('0x20')](_0xeb75('0x13'))[_0xeb75('0x14')](_0x3cd335)[_0xeb75('0x15')]('hex');return _0x1e7979[_0xeb75('0x21')](0x0,0x8)+'-'+_0x1e7979['substring'](0x8,0xc)+'-'+_0x1e7979['substring'](0xc,0x10)+'-'+_0x1e7979[_0xeb75('0x21')](0x10,0x14)+'-'+_0x1e7979['substring'](0x14);}}; \ No newline at end of file +var _0xd5e7=['../environment','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','map','model','createHash','md5','update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync'];(function(_0x5bddf9,_0x5560ea){var _0xbd7e3d=function(_0x22bdbf){while(--_0x22bdbf){_0x5bddf9['push'](_0x5bddf9['shift']());}};_0xbd7e3d(++_0x5560ea);}(_0xd5e7,0xb0));var _0x7d5e=function(_0x36a3fa,_0x2cdee9){_0x36a3fa=_0x36a3fa-0x0;var _0x18d977=_0xd5e7[_0x36a3fa];return _0x18d977;};'use strict';var _=require(_0x7d5e('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x7d5e('0x1'));var exec=require(_0x7d5e('0x2'))[_0x7d5e('0x3')];var config=require(_0x7d5e('0x4'));function getInterfaces(){var _0x45a9ea=[];var _0xa0c757=os['networkInterfaces']();var _0x3ca347=_['orderBy'](_['keys'](_0xa0c757));for(var _0x454c52=0x0;_0x454c52<_0x3ca347['length'];_0x454c52++){var _0x3633af=_0xa0c757[_0x3ca347[_0x454c52]][_0x7d5e('0x5')](function(_0x5a9614){return _0x5a9614['family']===_0x7d5e('0x6')&&_0x5a9614['internal']===![];});_0x45a9ea=_0x45a9ea[_0x7d5e('0x7')](_0x3633af);}return _0x45a9ea;}function getFirstInterface(){var _0x2389ae=_[_0x7d5e('0x8')](getInterfaces());return{'macAddress':_0x2389ae&&_0x2389ae['mac']?_0x2389ae[_0x7d5e('0x9')]:_0x7d5e('0xa'),'ipAddress':_0x2389ae&&_0x2389ae['address']?_0x2389ae[_0x7d5e('0xb')]:_0x7d5e('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3fb0ac=_[_0x7d5e('0xd')](os[_0x7d5e('0xe')]()[_0x7d5e('0xf')](function(_0x32f365){return _0x32f365[_0x7d5e('0x10')];}))['join'](':');return crypto[_0x7d5e('0x11')](_0x7d5e('0x12'))[_0x7d5e('0x13')](_0x3fb0ac)[_0x7d5e('0x14')](_0x7d5e('0x15'));}exports[_0x7d5e('0x16')]=function(){var _0x40a928=os['platform']();var _0x1c7dc7=/[0-9a-f-]{36}/;if(config[_0x7d5e('0x17')]&&_0x1c7dc7[_0x7d5e('0x18')](config[_0x7d5e('0x17')])){return config[_0x7d5e('0x17')];}else if(_0x40a928==='win32'){return exec(_0x7d5e('0x19'),{'encoding':'utf8'})[_0x7d5e('0x1a')]('\x0d\x0a','');}else{var _0x3d71df=getFirstInterface();var _0x73d6df=getCPUhash();var _0x54b58e=_0x73d6df+'|'+os[_0x7d5e('0x1b')]()+'|'+_0x3d71df['macAddress']+'|'+_0x3d71df[_0x7d5e('0x1c')];var _0x4c93be=crypto[_0x7d5e('0x11')](_0x7d5e('0x12'))[_0x7d5e('0x13')](_0x54b58e)[_0x7d5e('0x14')]('hex');return _0x4c93be['substring'](0x0,0x8)+'-'+_0x4c93be[_0x7d5e('0x1d')](0x8,0xc)+'-'+_0x4c93be['substring'](0xc,0x10)+'-'+_0x4c93be['substring'](0x10,0x14)+'-'+_0x4c93be[_0x7d5e('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 28d9fec..4c1489d 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 _0x3f59=['then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','bluebird','pkginfo','version','../../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','GET','get','data1','data2'];(function(_0x26dd96,_0x1e70a6){var _0x1aa18f=function(_0x1e846){while(--_0x1e846){_0x26dd96['push'](_0x26dd96['shift']());}};_0x1aa18f(++_0x1e70a6);}(_0x3f59,0xcb));var _0x93f5=function(_0x25ff7a,_0x11dc37){_0x25ff7a=_0x25ff7a-0x0;var _0x25edcb=_0x3f59[_0x25ff7a];return _0x25edcb;};'use strict';var util=require(_0x93f5('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x93f5('0x1'));var pkginfo=require(_0x93f5('0x2'))(module,_0x93f5('0x3'));var db=require(_0x93f5('0x4'))['db'];var encryptor=require(_0x93f5('0x5'));var hardware=require(_0x93f5('0x6'));var logger=require(_0x93f5('0x7'))('license');var HOST=_0x93f5('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x42a3f1){return new BPromise(function(_0x49f365,_0x24813a){var _0x54fc40=util[_0x93f5('0x9')](_0x93f5('0xa'),HOST,_0x42a3f1,module[_0x93f5('0xb')][_0x93f5('0x3')]);if(oldToken){_0x54fc40=util['format'](_0x93f5('0xc'),HOST,_0x42a3f1,module[_0x93f5('0xb')][_0x93f5('0x3')],oldToken);}var _0x44e5c3={'uri':_0x54fc40,'method':_0x93f5('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x44e5c3)['then'](function(_0x5934af){_0x49f365(_0x5934af);})['catch'](function(_0x184470){_0x24813a(_0x184470);});});}function manageLicense(_0x4305b3,_0x59c49d){var _0x4bfa6b=_0x59c49d[_0x93f5('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4bfa6b[_0x93f5('0xf')]!==_0x4305b3&&!_0x4bfa6b[_0x93f5('0x10')]){oldToken=_0x4bfa6b[_0x93f5('0xf')];}httpRequest(_0x4305b3)[_0x93f5('0x11')](function(_0xb97906){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xb97906[_0x93f5('0x12')]){isOldTokenSent=![];if(!_0x4bfa6b[_0x93f5('0x13')]&&_0x4bfa6b[_0x93f5('0x13')]!=_0xb97906[_0x93f5('0x13')]||_0x4bfa6b[_0x93f5('0x13')]&&_0x4bfa6b[_0x93f5('0x10')]){logger[_0x93f5('0x14')](_0x93f5('0x15'));}if(_0x4bfa6b[_0x93f5('0x13')]&&!_0x4bfa6b[_0x93f5('0x10')]&&_0x4bfa6b[_0x93f5('0x13')]!=_0xb97906['license']){logger[_0x93f5('0x14')](_0x93f5('0x16'));}if(_0x4bfa6b[_0x93f5('0x13')]&&!_0x4bfa6b[_0x93f5('0x10')]&&_0x4bfa6b[_0x93f5('0x13')]==_0xb97906['license']){return _0x59c49d;}return _0x59c49d[_0x93f5('0x17')]({'data1':_0x4305b3,'data2':null,'license':_0xb97906[_0x93f5('0x13')]});}else{if(_0xb97906[_0x93f5('0x13')]||_0x4bfa6b[_0x93f5('0x13')]){if(!_0x4bfa6b['data2']){if(_0x4bfa6b[_0x93f5('0xf')]==_0x4305b3){GRAY_PERIOD_REASON=_0x93f5('0x18');logger[_0x93f5('0x14')](_0x93f5('0x19'));}else{GRAY_PERIOD_REASON=_0x93f5('0x1a');logger[_0x93f5('0x14')](_0x93f5('0x1b'),_0x4bfa6b['data1'],_0x4305b3);}logger[_0x93f5('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x93f5('0x1c')](),moment()['format'](_0x93f5('0x1d')));return _0x59c49d[_0x93f5('0x17')]({'data2':encryptor[_0x93f5('0x1e')](moment()[_0x93f5('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x93f5('0x1f')](_0x4bfa6b[_0x93f5('0x10')]),_0x93f5('0x20'))>DAYS){logger[_0x93f5('0x14')](_0x93f5('0x21'),moment()[_0x93f5('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x59c49d[_0x93f5('0x17')]({'data1':_0x4305b3,'data2':null,'license':null});}}}else{if(_0x4bfa6b[_0x93f5('0xf')]!=_0x4305b3){logger[_0x93f5('0x14')](_0x93f5('0x1b'),_0x4bfa6b[_0x93f5('0xf')],_0x4305b3);return _0x59c49d[_0x93f5('0x17')]({'data1':_0x4305b3,'data2':null,'license':null});}}}return _0x59c49d;})[_0x93f5('0x11')](function(_0x3a1656){_0x59c49d=_0x3a1656;})[_0x93f5('0x22')](function(_0x4517a7){logger['error'](_0x4517a7[_0x93f5('0x23')]);})[_0x93f5('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x93f5('0x25')](),_0x59c49d);},TIME);});}function defaultLicense(){var _0x8671b5=hardware[_0x93f5('0x25')]();if(_0x8671b5){return db[_0x93f5('0x26')][_0x93f5('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x8671b5}})[_0x93f5('0x28')](function(_0x18f5a6,_0x294159){logger['info'](_0x93f5('0x29'),_0x8671b5);manageLicense(_0x8671b5,_0x18f5a6);})[_0x93f5('0x22')](function(_0x115683){logger[_0x93f5('0x2a')](_0x115683[_0x93f5('0x23')]);});}}exports[_0x93f5('0x2b')]=defaultLicense; \ No newline at end of file +var _0x9d94=['encryptString','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','update','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase'];(function(_0x2545d0,_0x244efa){var _0x10e44c=function(_0xdf7181){while(--_0xdf7181){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10e44c(++_0x244efa);}(_0x9d94,0x192));var _0x49d9=function(_0x4a162f,_0x1bd935){_0x4a162f=_0x4a162f-0x0;var _0x74df47=_0x9d94[_0x4a162f];return _0x74df47;};'use strict';var util=require(_0x49d9('0x0'));var moment=require('moment');var rp=require(_0x49d9('0x1'));var BPromise=require(_0x49d9('0x2'));var pkginfo=require(_0x49d9('0x3'))(module,_0x49d9('0x4'));var db=require(_0x49d9('0x5'))['db'];var encryptor=require(_0x49d9('0x6'));var hardware=require(_0x49d9('0x7'));var logger=require(_0x49d9('0x8'))(_0x49d9('0x9'));var HOST=_0x49d9('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1f6df2){return new BPromise(function(_0x4094ea,_0x1c8471){var _0x4f2903=util[_0x49d9('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x1f6df2,module[_0x49d9('0xc')]['version']);if(oldToken){_0x4f2903=util[_0x49d9('0xb')](_0x49d9('0xd'),HOST,_0x1f6df2,module[_0x49d9('0xc')][_0x49d9('0x4')],oldToken);}var _0xc61bad={'uri':_0x4f2903,'method':_0x49d9('0xe'),'timeout':0xea60,'json':!![]};return rp(_0xc61bad)[_0x49d9('0xf')](function(_0x38d8b2){_0x4094ea(_0x38d8b2);})[_0x49d9('0x10')](function(_0x56e764){_0x1c8471(_0x56e764);});});}function manageLicense(_0x1ca261,_0x5c3ebb){var _0x5aadb5=_0x5c3ebb['get']({'plain':!![]});if(!isOldTokenSent&&_0x5aadb5[_0x49d9('0x11')]!==_0x1ca261&&!_0x5aadb5[_0x49d9('0x12')]){oldToken=_0x5aadb5[_0x49d9('0x11')];}httpRequest(_0x1ca261)[_0x49d9('0xf')](function(_0x1e6e70){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1e6e70[_0x49d9('0x13')]){isOldTokenSent=![];if(!_0x5aadb5['license']&&_0x5aadb5[_0x49d9('0x9')]!=_0x1e6e70['license']||_0x5aadb5[_0x49d9('0x9')]&&_0x5aadb5[_0x49d9('0x12')]){logger['info'](_0x49d9('0x14'));}if(_0x5aadb5[_0x49d9('0x9')]&&!_0x5aadb5[_0x49d9('0x12')]&&_0x5aadb5[_0x49d9('0x9')]!=_0x1e6e70[_0x49d9('0x9')]){logger[_0x49d9('0x15')](_0x49d9('0x16'));}if(_0x5aadb5['license']&&!_0x5aadb5[_0x49d9('0x12')]&&_0x5aadb5['license']==_0x1e6e70[_0x49d9('0x9')]){return _0x5c3ebb;}return _0x5c3ebb['update']({'data1':_0x1ca261,'data2':null,'license':_0x1e6e70[_0x49d9('0x9')]});}else{if(_0x1e6e70[_0x49d9('0x9')]||_0x5aadb5[_0x49d9('0x9')]){if(!_0x5aadb5[_0x49d9('0x12')]){if(_0x5aadb5[_0x49d9('0x11')]==_0x1ca261){GRAY_PERIOD_REASON=_0x49d9('0x17');logger[_0x49d9('0x15')](_0x49d9('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x49d9('0x15')](_0x49d9('0x19'),_0x5aadb5[_0x49d9('0x11')],_0x1ca261);}logger[_0x49d9('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x49d9('0x1a')](),moment()[_0x49d9('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x5c3ebb['update']({'data2':encryptor[_0x49d9('0x1b')](moment()[_0x49d9('0xb')](_0x49d9('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x5aadb5[_0x49d9('0x12')]),_0x49d9('0x1d'))>DAYS){logger[_0x49d9('0x15')](_0x49d9('0x1e'),moment()[_0x49d9('0xb')](_0x49d9('0x1c')));isOldTokenSent=![];return _0x5c3ebb[_0x49d9('0x1f')]({'data1':_0x1ca261,'data2':null,'license':null});}}}else{if(_0x5aadb5[_0x49d9('0x11')]!=_0x1ca261){logger[_0x49d9('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5aadb5[_0x49d9('0x11')],_0x1ca261);return _0x5c3ebb['update']({'data1':_0x1ca261,'data2':null,'license':null});}}}return _0x5c3ebb;})[_0x49d9('0xf')](function(_0x1f6d0f){_0x5c3ebb=_0x1f6d0f;})[_0x49d9('0x10')](function(_0x1117f3){logger[_0x49d9('0x20')](_0x1117f3[_0x49d9('0x21')]);})[_0x49d9('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x49d9('0x23')](),_0x5c3ebb);},TIME);});}function defaultLicense(){var _0x392086=hardware[_0x49d9('0x23')]();if(_0x392086){return db['License'][_0x49d9('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x392086}})[_0x49d9('0x25')](function(_0xc64b3d,_0x302f65){logger['info'](_0x49d9('0x26'),_0x392086);manageLicense(_0x392086,_0xc64b3d);})['catch'](function(_0x21ac2c){logger[_0x49d9('0x20')](_0x21ac2c[_0x49d9('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 46207c6..9680240 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 _0xbbe0=['message','User','findAll','sequelize','col','role','count','admin','user','telephone','users','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','decryptString','format','demo','machineUuid','gray','add','grayReason','disabled'];(function(_0x3cc7db,_0x36b9a5){var _0x3a9d0d=function(_0xbe0ce6){while(--_0xbe0ce6){_0x3cc7db['push'](_0x3cc7db['shift']());}};_0x3a9d0d(++_0x36b9a5);}(_0xbbe0,0x101));var _0x0bbe=function(_0x26781b,_0x2414b0){_0x26781b=_0x26781b-0x0;var _0x831da6=_0xbbe0[_0x26781b];return _0x831da6;};'use strict';var util=require(_0x0bbe('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x0bbe('0x1'));var hardware=require(_0x0bbe('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x0bbe('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0bbe('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0bbe('0x5'),'machineUuid':hardware[_0x0bbe('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0bbe('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x51e0dc){return new BPromise(function(_0x1af945,_0x100024){return db[_0x0bbe('0x7')]['find'](_['defaults'](_0x51e0dc,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4ae28c){return checkLicense(_0x4ae28c,null);})[_0x0bbe('0x8')](function(_0x13e367){_0x1af945(_0x13e367);return;})[_0x0bbe('0x9')](function(_0x3c79f7){_0x100024(_0x3c79f7);});});}function checkLicense(_0x334094,_0x33bb6a){if(!_0x334094){demoLicense[_0x0bbe('0xa')]=_0x334094[_0x0bbe('0xb')];return demoLicense;}try{var _0x119bd3=_0x33bb6a||_0x334094[_0x0bbe('0xc')];if(_['isEmpty'](_0x119bd3)){throw new Error(_0x0bbe('0xd'));}var _0x52f085=_0x334094[_0x0bbe('0xb')];var _0x2d9d5d=_0x334094[_0x0bbe('0xe')];var _0x20890c=_0x52f085['split']('-')[0x4];var _0x10201d=_0x52f085['split']('-')[0x0];var _0x470488=encryptor[_0x0bbe('0xf')](_0x119bd3,util[_0x0bbe('0x10')]('%s:%s:%s',_0x20890c,_0x52f085,_0x10201d));var _0x47f73c=JSON['parse'](_0x470488);_0x47f73c[_0x0bbe('0x11')]=![];_0x47f73c[_0x0bbe('0xa')]=_0x52f085;_0x47f73c[_0x0bbe('0x12')]=hardware[_0x0bbe('0x6')]();if(_0x2d9d5d){var _0x5be45e=encryptor['decryptString'](_0x2d9d5d);_0x47f73c[_0x0bbe('0x13')]=_0x5be45e;_0x47f73c['deadline']=moment(_0x5be45e)[_0x0bbe('0x14')](0x7,'days')[_0x0bbe('0x10')]();_0x47f73c[_0x0bbe('0x15')]=_0x47f73c[_0x0bbe('0xa')]!=_0x47f73c[_0x0bbe('0x12')]?'changed':_0x0bbe('0x16');}return _0x47f73c;}catch(_0x49b8f0){breakingLicense['uuid']=_0x334094['data1'];breakingLicense[_0x0bbe('0x17')]=_0x49b8f0['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x111113,_0x56d5ca){getLicense()[_0x0bbe('0x8')](function(_0x285757){return db[_0x0bbe('0x18')][_0x0bbe('0x19')]({'attributes':['role',[db[_0x0bbe('0x1a')]['fn']('COUNT',db[_0x0bbe('0x1a')][_0x0bbe('0x1b')](_0x0bbe('0x1c'))),_0x0bbe('0x1d')]],'group':_0x0bbe('0x1c'),'where':{'role':{'$or':[_0x0bbe('0x1e'),_0x0bbe('0x1f'),_0x0bbe('0x20')]}},'raw':!![]})[_0x0bbe('0x8')](function(_0xb9b658){var _0x302b8f={'user':_0x285757[_0x0bbe('0x21')]||0x0,'telephone':_0x285757['telephones']||0x0};_0xb9b658[_0x0bbe('0x22')](function(_0x574eff){var _0x56bdb6=_0x574eff[_0x0bbe('0x1c')]===_0x0bbe('0x1e')?'user':_0x574eff[_0x0bbe('0x1c')];_0x302b8f[_0x56bdb6]-=_0x574eff[_0x0bbe('0x1d')];if(_0x302b8f[_0x56bdb6]<0x0)_0x302b8f[_0x56bdb6]=0x0;});_0x111113(_0x302b8f);return;});})[_0x0bbe('0x9')](function(_0x25221f){_0x56d5ca(_0x25221f);});});}function checkUserLimits(_0xe9c7c3){return new BPromise(function(_0x54d850,_0x53da0b){getLimits()['then'](function(_0x3c61a0){var _0xe6a9d1=_[_0x0bbe('0x23')](_[_0x0bbe('0x24')](_0xe9c7c3,_0x0bbe('0x1c')),['admin',_0x0bbe('0x1f'),_0x0bbe('0x20')]);var _0x1877dc=(_0xe6a9d1[_0x0bbe('0x1e')]||0x0)+(_0xe6a9d1[_0x0bbe('0x1f')]||0x0);var _0x126bd6=_0xe6a9d1[_0x0bbe('0x20')]||0x0;if(_0x1877dc>_0x3c61a0[_0x0bbe('0x1f')])return _0x53da0b(_0x0bbe('0x25'));if(_0x126bd6>_0x3c61a0[_0x0bbe('0x20')])return _0x53da0b(_0x0bbe('0x26'));return _0x54d850();})['catch'](function(_0xa40f59){_0x53da0b(_0xa40f59);});});}module[_0x0bbe('0x27')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xae30=['data1','license','isEmpty','split','decryptString','parse','demo','uuid','deadline','format','machineUuid','changed','disabled','message','User','role','sequelize','COUNT','admin','user','telephone','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch'];(function(_0x12ec91,_0x26e8bc){var _0x40a94c=function(_0x193a91){while(--_0x193a91){_0x12ec91['push'](_0x12ec91['shift']());}};_0x40a94c(++_0x26e8bc);}(_0xae30,0xba));var _0x0ae3=function(_0x4cfd78,_0x52355e){_0x4cfd78=_0x4cfd78-0x0;var _0xf4a95a=_0xae30[_0x4cfd78];return _0xf4a95a;};'use strict';var util=require('util');var _=require(_0x0ae3('0x0'));var moment=require(_0x0ae3('0x1'));var BPromise=require(_0x0ae3('0x2'));var hardware=require(_0x0ae3('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x0ae3('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0ae3('0x5'),'machineUuid':hardware[_0x0ae3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0ae3('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0ae3('0x8'),'machineUuid':hardware[_0x0ae3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4914d0){return new BPromise(function(_0x4a09c2,_0x4edce5){return db[_0x0ae3('0x9')][_0x0ae3('0xa')](_[_0x0ae3('0xb')](_0x4914d0,{'raw':!![],'where':{'id':0x1}}))[_0x0ae3('0xc')](function(_0x21983f){return checkLicense(_0x21983f,null);})['then'](function(_0x11481a){_0x4a09c2(_0x11481a);return;})[_0x0ae3('0xd')](function(_0x5bdc37){_0x4edce5(_0x5bdc37);});});}function checkLicense(_0x4ef334,_0x23c1e6){if(!_0x4ef334){demoLicense['uuid']=_0x4ef334[_0x0ae3('0xe')];return demoLicense;}try{var _0x517e8b=_0x23c1e6||_0x4ef334[_0x0ae3('0xf')];if(_[_0x0ae3('0x10')](_0x517e8b)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5c16ac=_0x4ef334[_0x0ae3('0xe')];var _0x4ecd11=_0x4ef334['data2'];var _0x25b353=_0x5c16ac[_0x0ae3('0x11')]('-')[0x4];var _0x3b2d33=_0x5c16ac[_0x0ae3('0x11')]('-')[0x0];var _0x1101bc=encryptor[_0x0ae3('0x12')](_0x517e8b,util['format']('%s:%s:%s',_0x25b353,_0x5c16ac,_0x3b2d33));var _0x3b7f8c=JSON[_0x0ae3('0x13')](_0x1101bc);_0x3b7f8c[_0x0ae3('0x14')]=![];_0x3b7f8c[_0x0ae3('0x15')]=_0x5c16ac;_0x3b7f8c['machineUuid']=hardware[_0x0ae3('0x6')]();if(_0x4ecd11){var _0x5aa724=encryptor[_0x0ae3('0x12')](_0x4ecd11);_0x3b7f8c['gray']=_0x5aa724;_0x3b7f8c[_0x0ae3('0x16')]=moment(_0x5aa724)['add'](0x7,'days')[_0x0ae3('0x17')]();_0x3b7f8c['grayReason']=_0x3b7f8c[_0x0ae3('0x15')]!=_0x3b7f8c[_0x0ae3('0x18')]?_0x0ae3('0x19'):_0x0ae3('0x1a');}return _0x3b7f8c;}catch(_0x4de0e6){breakingLicense[_0x0ae3('0x15')]=_0x4ef334['data1'];breakingLicense[_0x0ae3('0x1b')]=_0x4de0e6['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2063ac,_0x17cc80){getLicense()[_0x0ae3('0xc')](function(_0x504a40){return db[_0x0ae3('0x1c')]['findAll']({'attributes':[_0x0ae3('0x1d'),[db[_0x0ae3('0x1e')]['fn'](_0x0ae3('0x1f'),db[_0x0ae3('0x1e')]['col'](_0x0ae3('0x1d'))),'count']],'group':_0x0ae3('0x1d'),'where':{'role':{'$or':[_0x0ae3('0x20'),_0x0ae3('0x21'),_0x0ae3('0x22')]}},'raw':!![]})[_0x0ae3('0xc')](function(_0x283f47){var _0x5aea14={'user':_0x504a40['users']||0x0,'telephone':_0x504a40['telephones']||0x0};_0x283f47[_0x0ae3('0x23')](function(_0x4f0e68){var _0xe98208=_0x4f0e68[_0x0ae3('0x1d')]==='admin'?_0x0ae3('0x21'):_0x4f0e68[_0x0ae3('0x1d')];_0x5aea14[_0xe98208]-=_0x4f0e68['count'];if(_0x5aea14[_0xe98208]<0x0)_0x5aea14[_0xe98208]=0x0;});_0x2063ac(_0x5aea14);return;});})[_0x0ae3('0xd')](function(_0x52fbb9){_0x17cc80(_0x52fbb9);});});}function checkUserLimits(_0x2d312c){return new BPromise(function(_0x350b0a,_0x34f605){getLimits()['then'](function(_0x8fbd05){var _0x3d9faa=_[_0x0ae3('0x24')](_[_0x0ae3('0x25')](_0x2d312c,_0x0ae3('0x1d')),[_0x0ae3('0x20'),_0x0ae3('0x21'),'telephone']);var _0x21b570=(_0x3d9faa[_0x0ae3('0x20')]||0x0)+(_0x3d9faa[_0x0ae3('0x21')]||0x0);var _0xa84e7b=_0x3d9faa[_0x0ae3('0x22')]||0x0;if(_0x21b570>_0x8fbd05[_0x0ae3('0x21')])return _0x34f605(_0x0ae3('0x26'));if(_0xa84e7b>_0x8fbd05[_0x0ae3('0x22')])return _0x34f605('License\x20limit\x20reached\x20for\x20telephones');return _0x350b0a();})[_0x0ae3('0xd')](function(_0x472f6f){_0x34f605(_0x472f6f);});});}module[_0x0ae3('0x27')]={'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 b3a611f..3ab2a22 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 _0x4cf8=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x3e2ae3,_0x22befb){var _0x46f6b3=function(_0x1fef4f){while(--_0x1fef4f){_0x3e2ae3['push'](_0x3e2ae3['shift']());}};_0x46f6b3(++_0x22befb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x4cf8[_0x57fcc0];return _0x5270df;};'use strict';module[_0x84cf('0x0')]={'DOMAIN':_0x84cf('0x1'),'SESSION_SECRET':_0x84cf('0x2'),'GOOGLE_ID':_0x84cf('0x3'),'GOOGLE_SECRET':_0x84cf('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb574=['app-id','secret','exports','http://localhost:9000'];(function(_0x472ccd,_0x249697){var _0x15440f=function(_0x1b44fa){while(--_0x1b44fa){_0x472ccd['push'](_0x472ccd['shift']());}};_0x15440f(++_0x249697);}(_0xb574,0x106));var _0x4b57=function(_0x161951,_0x2e6359){_0x161951=_0x161951-0x0;var _0x9e8192=_0xb574[_0x161951];return _0x9e8192;};'use strict';module[_0x4b57('0x0')]={'DOMAIN':_0x4b57('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4b57('0x2'),'GOOGLE_SECRET':_0x4b57('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 304e657..d9c9181 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b9=['winston','path','join','log','xcally','format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','%s-%s','error','File','info','Console','env','debugLevel'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x68b9,0xe6));var _0x968b=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0x68b9[_0x4a0f16];return _0x45d653;};'use strict';var moment=require('moment');var winston=require(_0x968b('0x0'));var util=require('util');var path=require(_0x968b('0x1'));var debugLevel='INFO';function filename(_0x20a75b,_0x45e6ea){return path[_0x968b('0x2')]('/var',_0x968b('0x3'),_0x968b('0x4'),util[_0x968b('0x5')]('%s-%s.log',_0x20a75b,_0x45e6ea));}function formatter(_0x537686,_0x5796f0){_0x5796f0[_0x968b('0x6')]=_0x5796f0[_0x968b('0x6')][_0x968b('0x7')](/@@{/g,_0x968b('0x8'))[_0x968b('0x7')](/}@@/g,_0x968b('0x9'))['replace'](/@{/g,'{{')[_0x968b('0x7')](/}@/g,'}}');return util[_0x968b('0x5')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x968b('0x5')](_0x968b('0xa')),_0x5796f0[_0x968b('0xb')][_0x968b('0xc')](),_0x537686,_0x5796f0['message']);}module[_0x968b('0xd')]=function(_0x4ee8ed){return new winston[(_0x968b('0xe'))]({'transports':[new winston[(_0x968b('0xf'))]['File']({'name':util[_0x968b('0x5')](_0x968b('0x10'),_0x4ee8ed,'error'),'filename':filename(_0x4ee8ed,_0x968b('0x11')),'level':_0x968b('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5c020a){return formatter(_0x4ee8ed,_0x5c020a);}}),new winston[(_0x968b('0xf'))][(_0x968b('0x12'))]({'name':util[_0x968b('0x5')](_0x968b('0x10'),_0x4ee8ed,_0x968b('0x13')),'filename':filename(_0x4ee8ed,_0x968b('0x13')),'level':_0x968b('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xdfcff7){return formatter(_0x4ee8ed,_0xdfcff7);}}),new winston['transports'][(_0x968b('0x14'))]({'level':process[_0x968b('0x15')][_0x968b('0x16')]||debugLevel,'json':![],'formatter':function(_0x16fb15){return formatter(_0x4ee8ed,_0x16fb15);}})]});}; \ No newline at end of file +var _0x94c6=['level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x39e1d4,_0x3c2ed7){var _0x380b2d=function(_0xb3a7ce){while(--_0xb3a7ce){_0x39e1d4['push'](_0x39e1d4['shift']());}};_0x380b2d(++_0x3c2ed7);}(_0x94c6,0xa2));var _0x694c=function(_0x5ec57f,_0x3d8560){_0x5ec57f=_0x5ec57f-0x0;var _0x456e84=_0x94c6[_0x5ec57f];return _0x456e84;};'use strict';var moment=require(_0x694c('0x0'));var winston=require(_0x694c('0x1'));var util=require(_0x694c('0x2'));var path=require(_0x694c('0x3'));var debugLevel=_0x694c('0x4');function filename(_0x205d39,_0x5f3c21){return path['join'](_0x694c('0x5'),'log',_0x694c('0x6'),util[_0x694c('0x7')](_0x694c('0x8'),_0x205d39,_0x5f3c21));}function formatter(_0xa8dfd2,_0x821c06){_0x821c06[_0x694c('0x9')]=_0x821c06['message'][_0x694c('0xa')](/@@{/g,'{{{')[_0x694c('0xa')](/}@@/g,_0x694c('0xb'))[_0x694c('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x694c('0x7')](_0x694c('0xc'),moment()[_0x694c('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x821c06[_0x694c('0xd')][_0x694c('0xe')](),_0xa8dfd2,_0x821c06[_0x694c('0x9')]);}module[_0x694c('0xf')]=function(_0xb7d172){return new winston[(_0x694c('0x10'))]({'transports':[new winston[(_0x694c('0x11'))][(_0x694c('0x12'))]({'name':util[_0x694c('0x7')](_0x694c('0x13'),_0xb7d172,_0x694c('0x14')),'filename':filename(_0xb7d172,_0x694c('0x14')),'level':_0x694c('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x197e19){return formatter(_0xb7d172,_0x197e19);}}),new winston[(_0x694c('0x11'))]['File']({'name':util[_0x694c('0x7')](_0x694c('0x13'),_0xb7d172,'info'),'filename':filename(_0xb7d172,_0x694c('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c1b8b){return formatter(_0xb7d172,_0x1c1b8b);}}),new winston[(_0x694c('0x11'))][(_0x694c('0x16'))]({'level':process[_0x694c('0x17')][_0x694c('0x18')]||debugLevel,'json':![],'formatter':function(_0x31492a){return formatter(_0xb7d172,_0x31492a);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 151fd92..77adca3 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 _0x27b8=['../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','path','ami','join'];(function(_0x233313,_0x26b110){var _0xfd320e=function(_0xf40d5){while(--_0xf40d5){_0x233313['push'](_0x233313['shift']());}};_0xfd320e(++_0x26b110);}(_0x27b8,0x135));var _0x827b=function(_0x3d46d8,_0x4a009e){_0x3d46d8=_0x3d46d8-0x0;var _0x2bf847=_0x27b8[_0x3d46d8];return _0x2bf847;};'use strict';var path=require(_0x827b('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x827b('0x1'),'script':path[_0x827b('0x2')](__dirname,_0x827b('0x3'))},{'name':'agi','script':path['join'](__dirname,_0x827b('0x4'))},{'name':_0x827b('0x5'),'script':path[_0x827b('0x2')](__dirname,_0x827b('0x6'))},{'name':_0x827b('0x7'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x827b('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0xe6c7=['join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','express','../../services/express/index.js','ami'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xe6c7,0x6b));var _0x7e6c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe6c7[_0x2c91e9];return _0x13f0ff;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x7e6c('0x0'),'script':path['join'](__dirname,_0x7e6c('0x1'))},{'name':_0x7e6c('0x2'),'script':path[_0x7e6c('0x3')](__dirname,_0x7e6c('0x4'))},{'name':'agi','script':path[_0x7e6c('0x3')](__dirname,_0x7e6c('0x5'))},{'name':_0x7e6c('0x6'),'script':path['join'](__dirname,_0x7e6c('0x7'))},{'name':_0x7e6c('0x8'),'script':path[_0x7e6c('0x3')](__dirname,_0x7e6c('0x9'))},{'name':'xdr','script':path[_0x7e6c('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x7e6c('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 78c8375..b20ff10 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 _0xe787=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe787,0x1c7));var _0x7e78=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xe787[_0x4a29a9];return _0x386570;};'use strict';var pm2=require(_0x7e78('0x0'));var BPromise=require(_0x7e78('0x1'));var config=require(_0x7e78('0x2'));function connect(){return new BPromise(function(_0x5b8d15,_0x35270b){return pm2['connect'](function(_0x149415){if(_0x149415){return _0x35270b(_0x149415);}return _0x5b8d15(_0x7e78('0x3'));});});};exports[_0x7e78('0x4')]=function(_0x4ef748){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x3cbaf2,_0x4d9135){return pm2['start'](_0x4ef748,function(_0x29ae56,_0x444437){if(_0x29ae56){return _0x4d9135(_0x29ae56);}pm2[_0x7e78('0x6')]();return _0x3cbaf2(_0x444437);});});});};exports[_0x7e78('0x7')]=function(_0x1ed3b0){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x1140eb,_0x2fae7b){return pm2[_0x7e78('0x7')](_0x1ed3b0,function(_0x4767d1,_0x851d0c){if(_0x4767d1){return _0x2fae7b(_0x4767d1);}pm2[_0x7e78('0x6')]();return _0x1140eb(_0x851d0c);});});});};exports[_0x7e78('0x8')]=function(_0x20feef){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x8638e9,_0x5726b9){return pm2[_0x7e78('0x8')](_0x20feef,function(_0x10a29c,_0xdc54d6){if(_0x10a29c){return _0x5726b9(_0x10a29c);}pm2['disconnect']();return _0x8638e9(_0xdc54d6);});});});};exports[_0x7e78('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x10ccde,_0x28cbc5){return pm2[_0x7e78('0x9')](function(_0x56ed8a,_0x24396d){if(_0x56ed8a){return _0x28cbc5(_0x56ed8a);}pm2[_0x7e78('0x6')]();return _0x10ccde(_0x24396d);});});});};exports[_0x7e78('0xa')]=function(_0x24cfc5){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x49817b,_0x30c0ed){return pm2[_0x7e78('0xa')](_0x24cfc5,function(_0x2b86ab,_0x3e3de5){if(_0x2b86ab){return _0x30c0ed(_0x2b86ab);}pm2[_0x7e78('0x6')]();return _0x49817b(_0x3e3de5);});});});};exports['delete']=function(_0x26424e){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x142078,_0x54fb4f){return pm2[_0x7e78('0xb')](_0x26424e,function(_0x1f10b6,_0x16b71){if(_0x1f10b6){return _0x54fb4f(_0x1f10b6);}pm2[_0x7e78('0x6')]();return _0x142078(_0x16b71);});});});};exports[_0x7e78('0xc')]=function(){return connect()[_0x7e78('0x5')](function(){return new BPromise(function(_0x21fa8c,_0x3aec59){return pm2['dump'](function(_0x15d332){if(_0x15d332){return _0x3aec59(_0x15d332);}return _0x21fa8c(_0x7e78('0xd'));});});});}; \ No newline at end of file +var _0x5613=['then','disconnect','stop','restart','list','describe','delete','saved','pm2','bluebird','./config','connected','start'];(function(_0x2ddf01,_0x44ec6e){var _0x1e2ac5=function(_0x4d016a){while(--_0x4d016a){_0x2ddf01['push'](_0x2ddf01['shift']());}};_0x1e2ac5(++_0x44ec6e);}(_0x5613,0x119));var _0x3561=function(_0x183d73,_0x5b8823){_0x183d73=_0x183d73-0x0;var _0x4429f3=_0x5613[_0x183d73];return _0x4429f3;};'use strict';var pm2=require(_0x3561('0x0'));var BPromise=require(_0x3561('0x1'));var config=require(_0x3561('0x2'));function connect(){return new BPromise(function(_0x24fab1,_0x15e1e1){return pm2['connect'](function(_0x5905cc){if(_0x5905cc){return _0x15e1e1(_0x5905cc);}return _0x24fab1(_0x3561('0x3'));});});};exports[_0x3561('0x4')]=function(_0x1bd737){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x2f5f36,_0x47c29d){return pm2[_0x3561('0x4')](_0x1bd737,function(_0x1a05b0,_0x3ed2c7){if(_0x1a05b0){return _0x47c29d(_0x1a05b0);}pm2[_0x3561('0x6')]();return _0x2f5f36(_0x3ed2c7);});});});};exports[_0x3561('0x7')]=function(_0x38a804){return connect()['then'](function(){return new BPromise(function(_0x1bd223,_0x551087){return pm2[_0x3561('0x7')](_0x38a804,function(_0x470b77,_0x2fbfa1){if(_0x470b77){return _0x551087(_0x470b77);}pm2[_0x3561('0x6')]();return _0x1bd223(_0x2fbfa1);});});});};exports['restart']=function(_0xf767c5){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x254d20,_0x44c865){return pm2[_0x3561('0x8')](_0xf767c5,function(_0x9df362,_0x308493){if(_0x9df362){return _0x44c865(_0x9df362);}pm2['disconnect']();return _0x254d20(_0x308493);});});});};exports[_0x3561('0x9')]=function(){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x551590,_0xe77e0a){return pm2['list'](function(_0x5a7ec3,_0x346d60){if(_0x5a7ec3){return _0xe77e0a(_0x5a7ec3);}pm2[_0x3561('0x6')]();return _0x551590(_0x346d60);});});});};exports[_0x3561('0xa')]=function(_0x2afc49){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x42e5ae,_0xf04d58){return pm2['describe'](_0x2afc49,function(_0x2e3440,_0x2bdb0c){if(_0x2e3440){return _0xf04d58(_0x2e3440);}pm2[_0x3561('0x6')]();return _0x42e5ae(_0x2bdb0c);});});});};exports['delete']=function(_0x4ac33a){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x313708,_0x3db5f8){return pm2[_0x3561('0xb')](_0x4ac33a,function(_0xbfc78d,_0x5cdd63){if(_0xbfc78d){return _0x3db5f8(_0xbfc78d);}pm2['disconnect']();return _0x313708(_0x5cdd63);});});});};exports['dump']=function(){return connect()[_0x3561('0x5')](function(){return new BPromise(function(_0x349da3,_0x57a37e){return pm2['dump'](function(_0x4f0560){if(_0x4f0560){return _0x57a37e(_0x4f0560);}return _0x349da3(_0x3561('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d07b63d..317628e 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 _0xf132=['lodash','moment','ioredis','../../mysqldb','localhost','socket.io-emitter','find','chatTimeout','subtract','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect'];(function(_0xc4a7e2,_0x2141d5){var _0x8ee8e=function(_0x3e9086){while(--_0x3e9086){_0xc4a7e2['push'](_0xc4a7e2['shift']());}};_0x8ee8e(++_0x2141d5);}(_0xf132,0x198));var _0x2f13=function(_0xe3f588,_0x140f9f){_0xe3f588=_0xe3f588-0x0;var _0x3d0e63=_0xf132[_0xe3f588];return _0x3d0e63;};'use strict';var _=require(_0x2f13('0x0'));var moment=require(_0x2f13('0x1'));var Redis=require(_0x2f13('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x2f13('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_['defaults'](config['redis'],{'host':_0x2f13('0x4'),'port':0x18eb});var io=require(_0x2f13('0x5'))(new Redis(config['redis']));function closeInteractions(){var _0x28f278=0x0;var _0x486ab0=[];return db['Setting'][_0x2f13('0x6')]({'raw':!![],'attributes':['id',_0x2f13('0x7')],'where':{'id':0x1}})['then'](function(_0x47a4c8){_0x28f278=_0x47a4c8[_0x2f13('0x7')];if(_0x28f278){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2f13('0x8')](_0x47a4c8[_0x2f13('0x7')],'minutes')}}});}else{return[];}})[_0x2f13('0x9')](function(_0x148d2b){if(_0x148d2b&&_0x148d2b['length']){_0x486ab0=_[_0x2f13('0xa')](_0x148d2b||[],'id');logger[_0x2f13('0xb')](_0x2f13('0xc'),_0x486ab0[_0x2f13('0xd')]());return db['ChatInteraction'][_0x2f13('0xe')]({'closeReason':_0x2f13('0xf'),'disposition':_0x2f13('0x10'),'closed':!![],'closedAt':moment()[_0x2f13('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x486ab0}});}})[_0x2f13('0x9')](function(){if(_0x486ab0&&_0x486ab0[_0x2f13('0x12')]){logger[_0x2f13('0xb')](_0x2f13('0x13'),_0x486ab0[_0x2f13('0xd')]());for(var _0x1c844a=0x0;_0x1c844a<_0x486ab0[_0x2f13('0x12')];_0x1c844a++){io[_0x2f13('0x14')]('chatInteraction:update',{'id':_0x486ab0[_0x1c844a],'closed':!![]});}}})[_0x2f13('0x15')](function(_0x31d5d6){logger[_0x2f13('0x16')]('[CHAT]\x20Error\x20closing\x20interactions',_0x31d5d6?util[_0x2f13('0x17')](_0x31d5d6,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfe3b=['Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x26957a,_0x14ace1){var _0x2fe020=function(_0x3334c6){while(--_0x3334c6){_0x26957a['push'](_0x26957a['shift']());}};_0x2fe020(++_0x14ace1);}(_0xfe3b,0x1a9));var _0xbfe3=function(_0x3068c8,_0x1f5504){_0x3068c8=_0x3068c8-0x0;var _0x40c6e4=_0xfe3b[_0x3068c8];return _0x40c6e4;};'use strict';var _=require(_0xbfe3('0x0'));var moment=require(_0xbfe3('0x1'));var Redis=require(_0xbfe3('0x2'));var util=require(_0xbfe3('0x3'));var config=require(_0xbfe3('0x4'));var db=require(_0xbfe3('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xbfe3('0x6')]=_['defaults'](config[_0xbfe3('0x6')],{'host':_0xbfe3('0x7'),'port':0x18eb});var io=require(_0xbfe3('0x8'))(new Redis(config[_0xbfe3('0x6')]));function closeInteractions(){var _0x2f70ef=0x0;var _0x5448fe=[];return db[_0xbfe3('0x9')]['find']({'raw':!![],'attributes':['id',_0xbfe3('0xa')],'where':{'id':0x1}})[_0xbfe3('0xb')](function(_0x3e8c32){_0x2f70ef=_0x3e8c32[_0xbfe3('0xa')];if(_0x2f70ef){return db[_0xbfe3('0xc')][_0xbfe3('0xd')]({'raw':!![],'attributes':['id',_0xbfe3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3e8c32[_0xbfe3('0xa')],'minutes')}}});}else{return[];}})[_0xbfe3('0xb')](function(_0x3b4d8f){if(_0x3b4d8f&&_0x3b4d8f[_0xbfe3('0xf')]){_0x5448fe=_[_0xbfe3('0x10')](_0x3b4d8f||[],'id');logger[_0xbfe3('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x5448fe[_0xbfe3('0x12')]());return db['ChatInteraction'][_0xbfe3('0x13')]({'closeReason':_0xbfe3('0x14'),'disposition':_0xbfe3('0x15'),'closed':!![],'closedAt':moment()[_0xbfe3('0x16')](_0xbfe3('0x17'))},{'where':{'id':_0x5448fe}});}})[_0xbfe3('0xb')](function(){if(_0x5448fe&&_0x5448fe['length']){logger[_0xbfe3('0x11')](_0xbfe3('0x18'),_0x5448fe[_0xbfe3('0x12')]());for(var _0x1bd948=0x0;_0x1bd948<_0x5448fe[_0xbfe3('0xf')];_0x1bd948++){io[_0xbfe3('0x19')](_0xbfe3('0x1a'),{'id':_0x5448fe[_0x1bd948],'closed':!![]});}}})['catch'](function(_0x5bf5a8){logger[_0xbfe3('0x1b')](_0xbfe3('0x1c'),_0x5bf5a8?util[_0xbfe3('0x1d')](_0x5bf5a8,{'showHidden':![],'depth':null}):'');});}exports[_0xbfe3('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 b2aeebe..904c551 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 _0x13cb=['exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update\x20cron','stop\x20cron','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length'];(function(_0x4c85d8,_0x5bb686){var _0xfa5225=function(_0x4b5f68){while(--_0x4b5f68){_0x4c85d8['push'](_0x4c85d8['shift']());}};_0xfa5225(++_0x5bb686);}(_0x13cb,0x1c9));var _0xb13c=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x13cb[_0x3a2e49];return _0x257140;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xb13c('0x0'));var _=require(_0xb13c('0x1'));var moment=require('moment');var CronJobManager=require(_0xb13c('0x2'));var jayson=require(_0xb13c('0x3'));var BPromise=require(_0xb13c('0x4'));var logger=require(_0xb13c('0x5'))(_0xb13c('0x6'));var db=require(_0xb13c('0x7'))['db'];var analyticCustomReportController=require(_0xb13c('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb13c('0x9')][_0xb13c('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xddc572,_0xac71a){return function(){logger[_0xb13c('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xddc572[_0xb13c('0xc')]);var _0x4f9907=!![];var _0x19b260={'tls':{'rejectUnauthorized':![]}};if(_0xddc572[_0xb13c('0xd')][_0xb13c('0xe')][_0xb13c('0xf')]){_0x19b260[_0xb13c('0xf')]=_0xddc572[_0xb13c('0xd')][_0xb13c('0xe')][_0xb13c('0xf')];}else{_0x19b260[_0xb13c('0x10')]=_0xddc572[_0xb13c('0xd')]['Smtp'][_0xb13c('0x10')];_0x19b260[_0xb13c('0x11')]=_0xddc572[_0xb13c('0xd')][_0xb13c('0xe')][_0xb13c('0x11')];_0x19b260[_0xb13c('0x12')]=_0xddc572['MailAccount'][_0xb13c('0xe')][_0xb13c('0x12')];}if(_0xddc572[_0xb13c('0xd')][_0xb13c('0xe')][_0xb13c('0x13')]){_0x19b260['auth']={'user':_0xddc572['MailAccount'][_0xb13c('0xe')]['user'],'pass':_0xddc572[_0xb13c('0xd')][_0xb13c('0xe')][_0xb13c('0x14')]};}var _0x3fdddd={'account':_0x19b260,'message':{'from':util[_0xb13c('0x15')](_0xb13c('0x16'),_0xddc572['MailAccount'][_0xb13c('0x17')],_0xddc572[_0xb13c('0xd')][_0xb13c('0xc')]||_0xddc572['MailAccount']['Smtp'][_0xb13c('0x18')]),'to':_0xddc572[_0xb13c('0xc')],'cc':_0xddc572['cc'],'bcc':_0xddc572[_0xb13c('0x19')],'subject':util['format'](_0xb13c('0x1a'),_0xac71a[_0xb13c('0x17')],_0xddc572[_0xb13c('0x1b')],_0xddc572[_0xb13c('0x1c')])}};var _0x44010c=path[_0xb13c('0x1d')](__dirname,_0xb13c('0x1e'));var _0x2c37aa=_0xac71a[_0xb13c('0x1f')];var _0x1da4ef=util[_0xb13c('0x15')]('%s.%s',path[_0xb13c('0x20')](_0xac71a[_0xb13c('0x1f')],path[_0xb13c('0x21')](_0xac71a[_0xb13c('0x1f')])),'zip');var _0x271c33=path[_0xb13c('0x1d')](_0x44010c,_0x2c37aa);var _0x321c18=path['join'](_0x44010c,_0x1da4ef);if(fs[_0xb13c('0x22')](_0x271c33)){_0xac71a[_0xb13c('0x23')]=_0xb13c('0x24');_0x3fdddd[_0xb13c('0x25')][_0xb13c('0x26')]=[{'filename':_0x2c37aa,'path':_0x271c33}];_0x3fdddd[_0xb13c('0x25')][_0xb13c('0x27')]=util['format'](_0xb13c('0x28'),JSON[_0xb13c('0x29')](_0xac71a,null,0x2));}else if(fs[_0xb13c('0x22')](_0x321c18)){_0xac71a[_0xb13c('0x23')]=_0xb13c('0x24');_0x3fdddd[_0xb13c('0x25')][_0xb13c('0x26')]=[{'filename':_0x1da4ef,'path':_0x321c18}];}else{_0x3fdddd[_0xb13c('0x25')][_0xb13c('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xddc572[_0xb13c('0x2a')]){_0x4f9907=![];logger[_0xb13c('0xb')](_0xb13c('0x2b'));}}if(_0x4f9907){return client[_0xb13c('0x2c')](_0xb13c('0x2d'),_0x3fdddd)['then'](function(_0x40bacd){if(_0x40bacd['error']){return logger[_0xb13c('0x2e')](_0xb13c('0x2f'),JSON['stringify'](_0x40bacd));}return logger[_0xb13c('0xb')](_0xb13c('0x30'));})[_0xb13c('0x31')](function(_0x278348){return logger['error'](_0xb13c('0x2f'),JSON['stringify'](_0x278348));});}};}function handleError(){return function(_0x4aaa71){return logger[_0xb13c('0x2e')](JSON[_0xb13c('0x29')](_0x4aaa71));};}function handleResult(_0x3357c3){return function(_0x46145a){logger[_0xb13c('0xb')](_0xb13c('0x32'),JSON['stringify'](_0x46145a));if(_0x3357c3[_0xb13c('0xd')]&&_0x3357c3[_0xb13c('0xd')][_0xb13c('0xe')]&&!_[_0xb13c('0x33')](_0x3357c3[_0xb13c('0xc')])){setTimeout(handleSendEmail(_0x3357c3,_0x46145a),0x3c*0x3e8);}};}function handleJob(_0x5e9ccf){return function(){try{if(_[_0xb13c('0x33')](_0x5e9ccf[_0xb13c('0x1b')])){return logger[_0xb13c('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb13c('0x33')](_0x5e9ccf[_0xb13c('0x1c')])){return logger[_0xb13c('0xb')](_0xb13c('0x34'));}var _0x217e30={'startDate':moment()['subtract'](_0x5e9ccf['subtractNumber'],_0x5e9ccf[_0xb13c('0x1c')])[_0xb13c('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb13c('0x15')](_0xb13c('0x35')),'type':_0xb13c('0x36'),'output':_0x5e9ccf['output'],'name':_0x5e9ccf['name']};if(!_[_0xb13c('0x33')](_0x5e9ccf[_0xb13c('0x37')])){logger[_0xb13c('0xb')](_0xb13c('0x38'),_0x5e9ccf[_0xb13c('0x37')]);return analyticDefaultReportController[_0xb13c('0x39')]({'id':_0x5e9ccf[_0xb13c('0x37')]},_0x217e30)[_0xb13c('0x3a')](handleResult(_0x5e9ccf))[_0xb13c('0x31')](handleError());}if(!_[_0xb13c('0x33')](_0x5e9ccf[_0xb13c('0x3b')])){logger[_0xb13c('0xb')](_0xb13c('0x3c'),_0x5e9ccf[_0xb13c('0x3b')]);return analyticCustomReportController[_0xb13c('0x39')]({'id':_0x5e9ccf[_0xb13c('0x3b')]},_0x217e30)[_0xb13c('0x3a')](handleResult(_0x5e9ccf))['catch'](handleError());}}catch(_0x26d55b){logger[_0xb13c('0x2e')](JSON[_0xb13c('0x29')](_0x26d55b));}return logger[_0xb13c('0xb')](_0xb13c('0x3d'));};}function getJobs(_0x8e1952){var _0x2cc027={};if(_0x8e1952){_0x2cc027['id']=_0x8e1952;}return db[_0xb13c('0x3e')]['findAll']({'where':_0x2cc027,'include':[{'model':db[_0xb13c('0xd')],'attributes':['id',_0xb13c('0x17'),'email'],'include':[{'model':db[_0xb13c('0x3f')],'as':'Smtp'}]}]})[_0xb13c('0x3a')](function(_0xb01f88){var _0xd64e56=_[_0xb13c('0x40')](manager[_0xb13c('0x41')]);var _0x579dc2=_['map'](_0xb01f88,function(_0x18a976){return _0x18a976['id'][_0xb13c('0x42')]();});var _0x3e043f=_[_0xb13c('0x43')](_0xb01f88,function(_0x31cc3c){return _0x31cc3c['id'][_0xb13c('0x42')]();});var _0x4d0bc5=_0x8e1952?_0x579dc2:_[_0xb13c('0x44')](_0x579dc2,_0xd64e56);var _0x350514=_[_0xb13c('0x45')](_0x579dc2,_0xd64e56);var _0x3ad727=_[_0xb13c('0x44')](_0xd64e56,_0x579dc2);var _0x1260d4;var _0xe8b4dc;for(_0x1260d4=0x0;_0x1260d4<_0x3ad727[_0xb13c('0x46')]&&!_0x8e1952;_0x1260d4+=0x1){_0xe8b4dc=_0x3ad727[_0x1260d4][_0xb13c('0x42')]();if(manager[_0xb13c('0x47')](_0xe8b4dc)){manager[_0xb13c('0x48')](_0xe8b4dc);manager[_0xb13c('0x49')](_0xe8b4dc);logger['info'](_0xb13c('0x4a'),_0xe8b4dc);}}logger['info']('toRun',JSON[_0xb13c('0x29')](_0x4d0bc5));for(_0x1260d4=0x0;_0x1260d4<_0x4d0bc5[_0xb13c('0x46')];_0x1260d4+=0x1){_0xe8b4dc=_0x4d0bc5[_0x1260d4]['toString']();logger[_0xb13c('0xb')]('index',_0xe8b4dc);if(_0x8e1952){logger[_0xb13c('0xb')](_0xb13c('0x4b'),_0x8e1952);logger['info'](JSON['stringify'](_0x3e043f[_0xe8b4dc]));BPromise[_0xb13c('0x4c')]()[_0xb13c('0x3a')](handleJob(_0x3e043f[_0xe8b4dc]));logger['info'](_0xb13c('0x4d'),_0x3e043f[_0xe8b4dc]['name'],_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]);}else if(_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]&&_0x3e043f[_0xe8b4dc][_0xb13c('0x4f')]&&moment()[_0xb13c('0x50')](_0x3e043f[_0xe8b4dc][_0xb13c('0x51')],_0x3e043f[_0xe8b4dc][_0xb13c('0x52')])){manager[_0xb13c('0x53')](_0xe8b4dc,_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')],handleJob(_0x3e043f[_0xe8b4dc]));manager[_0xb13c('0x54')](_0xe8b4dc);logger[_0xb13c('0xb')](_0xb13c('0x55'),_0x3e043f[_0xe8b4dc][_0xb13c('0x17')],_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]);}else if(manager[_0xb13c('0x47')](_0xe8b4dc)){manager[_0xb13c('0x48')](_0xe8b4dc);manager[_0xb13c('0x49')](_0xe8b4dc);logger[_0xb13c('0xb')]('stop\x20cron',_0x3e043f[_0xe8b4dc][_0xb13c('0x17')],_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]);}}for(_0x1260d4=0x0,_0xe8b4dc;_0x1260d4<_0x350514[_0xb13c('0x46')]&&!_0x8e1952;_0x1260d4+=0x1){_0xe8b4dc=_0x350514[_0x1260d4][_0xb13c('0x42')]();if(manager[_0xb13c('0x47')](_0xe8b4dc)){if(_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]&&_0x3e043f[_0xe8b4dc][_0xb13c('0x4f')]&&moment()['isBetween'](_0x3e043f[_0xe8b4dc][_0xb13c('0x51')],_0x3e043f[_0xe8b4dc][_0xb13c('0x52')])){manager['update'](_0xe8b4dc,_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')],handleJob(_0x3e043f[_0xe8b4dc]));logger[_0xb13c('0xb')](_0xb13c('0x56'),_0x3e043f[_0xe8b4dc]['name'],_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]);}else{manager[_0xb13c('0x48')](_0xe8b4dc);manager[_0xb13c('0x49')](_0xe8b4dc);logger[_0xb13c('0xb')](_0xb13c('0x57'),_0x3e043f[_0xe8b4dc][_0xb13c('0x17')],_0x3e043f[_0xe8b4dc][_0xb13c('0x4e')]);}}}})[_0xb13c('0x31')](function(_0x46e16a){logger['error'](JSON[_0xb13c('0x29')](_0x46e16a));});}exports['run']=function(_0x2b1199){return getJobs(_0x2b1199);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3b30=['jobs','map','toString','keyBy','intersection','length','exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','add','start','add\x20cron','stop','active','isBetween','endAt','stop\x20cron','run','util','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','%s.%s','savename','extname','Sent','message','attachments','format','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3b30,0xd0));var _0x03b3=function(_0x2f592d,_0x3f3808){_0x2f592d=_0x2f592d-0x0;var _0x5bc5be=_0x3b30[_0x2f592d];return _0x5bc5be;};'use strict';var fs=require('fs');var util=require(_0x03b3('0x0'));var path=require(_0x03b3('0x1'));var _=require(_0x03b3('0x2'));var moment=require(_0x03b3('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x03b3('0x4'));var BPromise=require('bluebird');var logger=require(_0x03b3('0x5'))(_0x03b3('0x6'));var db=require(_0x03b3('0x7'))['db'];var analyticCustomReportController=require(_0x03b3('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x03b3('0x9')][_0x03b3('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3b2dc1,_0x384205){return function(){logger[_0x03b3('0xb')](_0x03b3('0xc'),_0x3b2dc1[_0x03b3('0xd')]);var _0x4cbb56=!![];var _0x1ef941={'tls':{'rejectUnauthorized':![]}};if(_0x3b2dc1[_0x03b3('0xe')][_0x03b3('0xf')][_0x03b3('0x10')]){_0x1ef941['service']=_0x3b2dc1[_0x03b3('0xe')]['Smtp'][_0x03b3('0x10')];}else{_0x1ef941[_0x03b3('0x11')]=_0x3b2dc1[_0x03b3('0xe')]['Smtp']['host'];_0x1ef941['port']=_0x3b2dc1[_0x03b3('0xe')]['Smtp'][_0x03b3('0x12')];_0x1ef941[_0x03b3('0x13')]=_0x3b2dc1['MailAccount'][_0x03b3('0xf')][_0x03b3('0x13')];}if(_0x3b2dc1[_0x03b3('0xe')][_0x03b3('0xf')][_0x03b3('0x14')]){_0x1ef941[_0x03b3('0x15')]={'user':_0x3b2dc1[_0x03b3('0xe')][_0x03b3('0xf')]['user'],'pass':_0x3b2dc1[_0x03b3('0xe')][_0x03b3('0xf')]['pass']};}var _0x3141a1={'account':_0x1ef941,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3b2dc1[_0x03b3('0xe')]['name'],_0x3b2dc1[_0x03b3('0xe')][_0x03b3('0xd')]||_0x3b2dc1['MailAccount'][_0x03b3('0xf')][_0x03b3('0x16')]),'to':_0x3b2dc1['email'],'cc':_0x3b2dc1['cc'],'bcc':_0x3b2dc1[_0x03b3('0x17')],'subject':util['format'](_0x03b3('0x18'),_0x384205[_0x03b3('0x19')],_0x3b2dc1[_0x03b3('0x1a')],_0x3b2dc1['subtractUnit'])}};var _0x329d0b=path[_0x03b3('0x1b')](__dirname,_0x03b3('0x1c'));var _0x1cecb5=_0x384205['savename'];var _0x1ba6de=util['format'](_0x03b3('0x1d'),path['basename'](_0x384205[_0x03b3('0x1e')],path[_0x03b3('0x1f')](_0x384205[_0x03b3('0x1e')])),'zip');var _0x540d1e=path[_0x03b3('0x1b')](_0x329d0b,_0x1cecb5);var _0x2060dd=path[_0x03b3('0x1b')](_0x329d0b,_0x1ba6de);if(fs['existsSync'](_0x540d1e)){_0x384205['status']=_0x03b3('0x20');_0x3141a1[_0x03b3('0x21')][_0x03b3('0x22')]=[{'filename':_0x1cecb5,'path':_0x540d1e}];_0x3141a1[_0x03b3('0x21')]['text']=util[_0x03b3('0x23')](_0x03b3('0x24'),JSON[_0x03b3('0x25')](_0x384205,null,0x2));}else if(fs[_0x03b3('0x26')](_0x2060dd)){_0x384205[_0x03b3('0x27')]='Sent';_0x3141a1[_0x03b3('0x21')][_0x03b3('0x22')]=[{'filename':_0x1ba6de,'path':_0x2060dd}];}else{_0x3141a1[_0x03b3('0x21')][_0x03b3('0x28')]=_0x03b3('0x29');if(!_0x3b2dc1['sendIfEmpty']){_0x4cbb56=![];logger[_0x03b3('0xb')](_0x03b3('0x2a'));}}if(_0x4cbb56){return client[_0x03b3('0x2b')](_0x03b3('0x2c'),_0x3141a1)['then'](function(_0x378677){if(_0x378677[_0x03b3('0x2d')]){return logger['error'](_0x03b3('0x2e'),JSON[_0x03b3('0x25')](_0x378677));}return logger[_0x03b3('0xb')](_0x03b3('0x2f'));})[_0x03b3('0x30')](function(_0x3f909d){return logger[_0x03b3('0x2d')]('error\x20mail',JSON[_0x03b3('0x25')](_0x3f909d));});}};}function handleError(){return function(_0x23038b){return logger[_0x03b3('0x2d')](JSON[_0x03b3('0x25')](_0x23038b));};}function handleResult(_0x55e918){return function(_0x22de4c){logger[_0x03b3('0xb')](_0x03b3('0x31'),JSON[_0x03b3('0x25')](_0x22de4c));if(_0x55e918['MailAccount']&&_0x55e918[_0x03b3('0xe')][_0x03b3('0xf')]&&!_[_0x03b3('0x32')](_0x55e918[_0x03b3('0xd')])){setTimeout(handleSendEmail(_0x55e918,_0x22de4c),0x3c*0x3e8);}};}function handleJob(_0xd1885d){return function(){try{if(_[_0x03b3('0x32')](_0xd1885d[_0x03b3('0x1a')])){return logger[_0x03b3('0xb')](_0x03b3('0x33'));}if(_['isNil'](_0xd1885d[_0x03b3('0x34')])){return logger[_0x03b3('0xb')](_0x03b3('0x35'));}var _0x24c94f={'startDate':moment()[_0x03b3('0x36')](_0xd1885d[_0x03b3('0x1a')],_0xd1885d[_0x03b3('0x34')])[_0x03b3('0x23')](_0x03b3('0x37')),'endDate':moment()[_0x03b3('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x03b3('0x38'),'output':_0xd1885d[_0x03b3('0x39')],'name':_0xd1885d['name']};if(!_[_0x03b3('0x32')](_0xd1885d[_0x03b3('0x3a')])){logger['info'](_0x03b3('0x3b'),_0xd1885d['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0xd1885d[_0x03b3('0x3a')]},_0x24c94f)[_0x03b3('0x3c')](handleResult(_0xd1885d))[_0x03b3('0x30')](handleError());}if(!_['isNil'](_0xd1885d[_0x03b3('0x3d')])){logger[_0x03b3('0xb')](_0x03b3('0x3e'),_0xd1885d[_0x03b3('0x3d')]);return analyticCustomReportController['runReport']({'id':_0xd1885d[_0x03b3('0x3d')]},_0x24c94f)[_0x03b3('0x3c')](handleResult(_0xd1885d))['catch'](handleError());}}catch(_0x32e2be){logger[_0x03b3('0x2d')](JSON[_0x03b3('0x25')](_0x32e2be));}return logger[_0x03b3('0xb')](_0x03b3('0x3f'));};}function getJobs(_0x54e9ad){var _0x240ad6={};if(_0x54e9ad){_0x240ad6['id']=_0x54e9ad;}return db[_0x03b3('0x40')][_0x03b3('0x41')]({'where':_0x240ad6,'include':[{'model':db[_0x03b3('0xe')],'attributes':['id',_0x03b3('0x19'),_0x03b3('0xd')],'include':[{'model':db[_0x03b3('0x42')],'as':'Smtp'}]}]})['then'](function(_0x59bb14){var _0x530a0c=_[_0x03b3('0x43')](manager[_0x03b3('0x44')]);var _0x3819af=_[_0x03b3('0x45')](_0x59bb14,function(_0x222f54){return _0x222f54['id'][_0x03b3('0x46')]();});var _0x4ad85c=_[_0x03b3('0x47')](_0x59bb14,function(_0x17a703){return _0x17a703['id']['toString']();});var _0x398588=_0x54e9ad?_0x3819af:_['difference'](_0x3819af,_0x530a0c);var _0x54e61b=_[_0x03b3('0x48')](_0x3819af,_0x530a0c);var _0x58227e=_['difference'](_0x530a0c,_0x3819af);var _0x5a9d47;var _0x37d5cf;for(_0x5a9d47=0x0;_0x5a9d47<_0x58227e[_0x03b3('0x49')]&&!_0x54e9ad;_0x5a9d47+=0x1){_0x37d5cf=_0x58227e[_0x5a9d47][_0x03b3('0x46')]();if(manager[_0x03b3('0x4a')](_0x37d5cf)){manager['stop'](_0x37d5cf);manager[_0x03b3('0x4b')](_0x37d5cf);logger['info']('delete\x20cron',_0x37d5cf);}}logger[_0x03b3('0xb')](_0x03b3('0x4c'),JSON[_0x03b3('0x25')](_0x398588));for(_0x5a9d47=0x0;_0x5a9d47<_0x398588[_0x03b3('0x49')];_0x5a9d47+=0x1){_0x37d5cf=_0x398588[_0x5a9d47][_0x03b3('0x46')]();logger[_0x03b3('0xb')](_0x03b3('0x4d'),_0x37d5cf);if(_0x54e9ad){logger[_0x03b3('0xb')](_0x03b3('0x4e'),_0x54e9ad);logger['info'](JSON[_0x03b3('0x25')](_0x4ad85c[_0x37d5cf]));BPromise[_0x03b3('0x4f')]()[_0x03b3('0x3c')](handleJob(_0x4ad85c[_0x37d5cf]));logger[_0x03b3('0xb')](_0x03b3('0x50'),_0x4ad85c[_0x37d5cf][_0x03b3('0x19')],_0x4ad85c[_0x37d5cf][_0x03b3('0x51')]);}else if(_0x4ad85c[_0x37d5cf][_0x03b3('0x51')]&&_0x4ad85c[_0x37d5cf]['active']&&moment()['isBetween'](_0x4ad85c[_0x37d5cf][_0x03b3('0x52')],_0x4ad85c[_0x37d5cf]['endAt'])){manager[_0x03b3('0x53')](_0x37d5cf,_0x4ad85c[_0x37d5cf][_0x03b3('0x51')],handleJob(_0x4ad85c[_0x37d5cf]));manager[_0x03b3('0x54')](_0x37d5cf);logger[_0x03b3('0xb')](_0x03b3('0x55'),_0x4ad85c[_0x37d5cf][_0x03b3('0x19')],_0x4ad85c[_0x37d5cf][_0x03b3('0x51')]);}else if(manager[_0x03b3('0x4a')](_0x37d5cf)){manager[_0x03b3('0x56')](_0x37d5cf);manager[_0x03b3('0x4b')](_0x37d5cf);logger[_0x03b3('0xb')]('stop\x20cron',_0x4ad85c[_0x37d5cf][_0x03b3('0x19')],_0x4ad85c[_0x37d5cf][_0x03b3('0x51')]);}}for(_0x5a9d47=0x0,_0x37d5cf;_0x5a9d47<_0x54e61b['length']&&!_0x54e9ad;_0x5a9d47+=0x1){_0x37d5cf=_0x54e61b[_0x5a9d47][_0x03b3('0x46')]();if(manager[_0x03b3('0x4a')](_0x37d5cf)){if(_0x4ad85c[_0x37d5cf]['cron']&&_0x4ad85c[_0x37d5cf][_0x03b3('0x57')]&&moment()[_0x03b3('0x58')](_0x4ad85c[_0x37d5cf][_0x03b3('0x52')],_0x4ad85c[_0x37d5cf][_0x03b3('0x59')])){manager['update'](_0x37d5cf,_0x4ad85c[_0x37d5cf][_0x03b3('0x51')],handleJob(_0x4ad85c[_0x37d5cf]));logger[_0x03b3('0xb')]('update\x20cron',_0x4ad85c[_0x37d5cf]['name'],_0x4ad85c[_0x37d5cf]['cron']);}else{manager['stop'](_0x37d5cf);manager[_0x03b3('0x4b')](_0x37d5cf);logger[_0x03b3('0xb')](_0x03b3('0x5a'),_0x4ad85c[_0x37d5cf][_0x03b3('0x19')],_0x4ad85c[_0x37d5cf]['cron']);}}}})['catch'](function(_0x1a27da){logger[_0x03b3('0x2d')](JSON[_0x03b3('0x25')](_0x1a27da));});}exports[_0x03b3('0x5b')]=function(_0x2ada61){return getJobs(_0x2ada61);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 5d6ad0f..bde21c9 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 _0x75ea=['data2','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','TranscriptFileUri','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','Negative','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','lodash','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x75ea,0x7d));var _0xa75e=function(_0x4abf32,_0x1f4900){_0x4abf32=_0x4abf32-0x0;var _0x1793bc=_0x75ea[_0x4abf32];return _0x1793bc;};var _=require(_0xa75e('0x0'));var AWS=require(_0xa75e('0x1'));var rp=require('request-promise');var util=require(_0xa75e('0x2'));var BPromise=require(_0xa75e('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa75e('0x4'))(_0xa75e('0x5'));function getTranscriptionJob(_0x446097,_0x1255c3,_0x201f4b,_0x4d6703){return new Promise(function(_0x2a3364,_0x1f9627){var _0x1f666f=new AWS[(_0xa75e('0x6'))]({'accessKeyId':_0x1255c3,'secretAccessKey':_0x446097,'region':_0x201f4b});_0x1f666f[_0xa75e('0x7')]({'TranscriptionJobName':_0x4d6703},function(_0x31a28d,_0x351164){if(_0x31a28d){return _0x1f9627(_0x31a28d);}else{return _0x2a3364(_0x351164);}});});}function sentiment(_0x493f46,_0x4ecc87,_0x560baa,_0x5c2c35,_0x39aab0){return new Promise(function(_0x568154,_0x245dd2){var _0x495157=new AWS[(_0xa75e('0x8'))]({'accessKeyId':_0x4ecc87,'secretAccessKey':_0x493f46,'region':_0x560baa});_0x495157[_0xa75e('0x9')]({'Text':_0x5c2c35,'LanguageCode':_0x39aab0['substring'](0x0,0x2)},function(_0x20b79b,_0x259e8c){if(_0x20b79b){return _0x245dd2(_0x20b79b);}else{return _0x568154(_0x259e8c);}});});}function checkTranscribeJob(_0x38dce8,_0x35c81b,_0x46d808){var _0x3d01eb;return new BPromise(function(_0x164ccb,_0x242ade){logger[_0xa75e('0xa')](util['format'](_0xa75e('0xb'),_0x38dce8['id'],_0x38dce8['transcribeName']));return getTranscriptionJob(_0x46d808[_0xa75e('0xc')],_0x46d808[_0xa75e('0xd')],_0x35c81b['transcribeRegion'],_0x38dce8[_0xa75e('0xe')])[_0xa75e('0xf')](function(_0x1d78ce){logger['info'](util[_0xa75e('0x10')](_0xa75e('0x11'),_0x38dce8['id'],_0x38dce8[_0xa75e('0xe')],_0x1d78ce[_0xa75e('0x12')][_0xa75e('0x13')]));if(!_0x38dce8[_0xa75e('0x14')]){switch(_0x1d78ce[_0xa75e('0x12')][_0xa75e('0x13')]){case'COMPLETED':var _0x280491={'transcribeStatus':_0x1d78ce[_0xa75e('0x12')][_0xa75e('0x13')],'fileUri':_0x1d78ce['TranscriptionJob']['Transcript'][_0xa75e('0x15')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x38dce8['id']));return rp({'uri':_0x1d78ce[_0xa75e('0x12')]['Transcript'][_0xa75e('0x15')],'json':!![]})['then'](function(_0x32766b){logger[_0xa75e('0xa')](util[_0xa75e('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x38dce8['id']));if(_0x32766b&&_0x32766b[_0xa75e('0x16')]&&_0x32766b[_0xa75e('0x16')][_0xa75e('0x17')]&&_0x32766b['results'][_0xa75e('0x17')][_0xa75e('0x18')]){_0x280491[_0xa75e('0x14')]='';for(var _0x9add90=0x0;_0x9add90<_0x32766b[_0xa75e('0x16')][_0xa75e('0x17')][_0xa75e('0x18')];_0x9add90++){_0x280491[_0xa75e('0x14')]+=_0x32766b[_0xa75e('0x16')]['transcripts'][_0x9add90]['transcript']+'';}}return _0x38dce8[_0xa75e('0x19')](_0x280491);})[_0xa75e('0xf')](function(){logger['info'](util[_0xa75e('0x10')](_0xa75e('0x1a'),_0x38dce8['id']));if(!_0x38dce8[_0xa75e('0x1b')]){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x1e'));}if(!_0x35c81b['sentiment']||!_0x35c81b[_0xa75e('0x1f')]||!_0x35c81b[_0xa75e('0x20')]||!_0x35c81b[_0xa75e('0x21')]||!_0x35c81b[_0xa75e('0x22')]){throw new db[(_0xa75e('0x1c'))]['ValidationError'](_0xa75e('0x23'));}if(!_0x280491['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x35c81b[_0xa75e('0x1f')]===_0x46d808['id']){return _0x46d808;}else{return db[_0xa75e('0x24')][_0xa75e('0x25')]({'where':{'id':_settings[_0xa75e('0x1f')]}});}})[_0xa75e('0xf')](function(_0xf091d7){if(!_0xf091d7){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x26'));}if(!_0xf091d7[_0xa75e('0xc')]||!_0xf091d7[_0xa75e('0xd')]){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x3d01eb=_0xf091d7;logger[_0xa75e('0xa')](util[_0xa75e('0x10')](_0xa75e('0x27'),_0x38dce8['id']));return sentiment(_0x3d01eb[_0xa75e('0xc')],_0x3d01eb[_0xa75e('0xd')],_0x35c81b[_0xa75e('0x20')],_0x280491['fileText'],_0x35c81b['language']);})['then'](function(_0x2c560c){logger['info'](util['format'](_0xa75e('0x28'),_0x38dce8['id']));return _0x38dce8['update']({'sentiment':_0x2c560c[_0xa75e('0x29')],'sPositive':_0x2c560c[_0xa75e('0x2a')][_0xa75e('0x2b')],'sNegative':_0x2c560c[_0xa75e('0x2a')]['Negative'],'sMixed':_0x2c560c[_0xa75e('0x2a')][_0xa75e('0x2c')],'sNeutral':_0x2c560c[_0xa75e('0x2a')]['Neutral']});})['then'](function(){logger[_0xa75e('0xa')](util[_0xa75e('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x38dce8['id']));_0x164ccb();});case _0xa75e('0x2d'):return _0x38dce8[_0xa75e('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x1d78ce[_0xa75e('0x12')][_0xa75e('0x2e')]})['then'](function(){logger[_0xa75e('0xa')](util[_0xa75e('0x10')](_0xa75e('0x1a'),_0x38dce8['id']));_0x164ccb();});default:logger['info'](util[_0xa75e('0x10')](_0xa75e('0x2f'),_0x38dce8['id']));break;}}else{return BPromise[_0xa75e('0x30')]()[_0xa75e('0xf')](function(){if(!_0x38dce8[_0xa75e('0x1b')]){throw new db['Sequelize'][(_0xa75e('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x35c81b[_0xa75e('0x31')]||!_0x35c81b[_0xa75e('0x1f')]||!_0x35c81b[_0xa75e('0x20')]||!_0x35c81b[_0xa75e('0x21')]||!_0x35c81b[_0xa75e('0x22')]){throw new db['Sequelize'][(_0xa75e('0x1d'))](_0xa75e('0x23'));}if(!_0x38dce8[_0xa75e('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x35c81b[_0xa75e('0x1f')]===_0x46d808['id']){return _0x46d808;}else{return db[_0xa75e('0x24')]['findOne']({'where':{'id':_settings[_0xa75e('0x1f')]}});}})[_0xa75e('0xf')](function(_0x554179){if(!_0x554179){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x26'));}if(!_0x554179[_0xa75e('0xc')]||!_0x554179[_0xa75e('0xd')]){throw new db[(_0xa75e('0x1c'))]['ValidationError'](_0xa75e('0x32'));}_0x3d01eb=_0x554179;logger[_0xa75e('0xa')](util[_0xa75e('0x10')](_0xa75e('0x27'),_0x38dce8['id']));return sentiment(_0x3d01eb['data1'],_0x3d01eb['data2'],_0x35c81b['sentimentRegion'],_0x38dce8[_0xa75e('0x14')],_0x35c81b[_0xa75e('0x21')]);})[_0xa75e('0xf')](function(_0x355017){logger['info'](util[_0xa75e('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x38dce8['id']));return _0x38dce8[_0xa75e('0x19')]({'sentiment':_0x355017[_0xa75e('0x29')],'sPositive':_0x355017[_0xa75e('0x2a')]['Positive'],'sNegative':_0x355017[_0xa75e('0x2a')][_0xa75e('0x33')],'sMixed':_0x355017['SentimentScore'][_0xa75e('0x2c')],'sNeutral':_0x355017[_0xa75e('0x2a')][_0xa75e('0x34')],'transcribeStatus':_0xa75e('0x35')});})['then'](function(){logger[_0xa75e('0xa')](util[_0xa75e('0x10')](_0xa75e('0x1a'),_0x38dce8['id']));_0x164ccb();});}})[_0xa75e('0x36')](function(_0x5b184d){if(_0x5b184d){if(!_0x5b184d[_0xa75e('0x37')]||_0x5b184d['name']!==_0xa75e('0x38')){logger[_0xa75e('0x39')](util[_0xa75e('0x10')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x38dce8['id']),util[_0xa75e('0x3a')](_0x5b184d,{'showHidden':![],'depth':null}));}}_0x164ccb();});});}function checkTranscribe(){var _0x1f1861;var _0xc27aef;var _0x4cf713;return db[_0xa75e('0x3b')][_0xa75e('0x3c')]({'where':{'transcribeStatus':_0xa75e('0x3d')}})['then'](function(_0x24dd7a){if(!_0x24dd7a||!_0x24dd7a['length']){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x3e'));}_0x1f1861=_0x24dd7a;return db['Setting'][_0xa75e('0x25')]({'where':{'id':0x1}});})[_0xa75e('0xf')](function(_0x47f04e){if(!_0x47f04e){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x3f'));}_0xc27aef=_0x47f04e;if(!_0xc27aef[_0xa75e('0x5')]||!_0xc27aef[_0xa75e('0x40')]||!_0xc27aef[_0xa75e('0x41')]||!_0xc27aef[_0xa75e('0x21')]||!_0xc27aef[_0xa75e('0x22')]){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x42'));}return db[_0xa75e('0x24')]['findOne']({'where':{'id':_0xc27aef[_0xa75e('0x40')]}});})[_0xa75e('0xf')](function(_0x5b8480){if(!_0x5b8480){throw new db[(_0xa75e('0x1c'))]['ValidationError'](_0xa75e('0x26'));}if(!_0x5b8480[_0xa75e('0xc')]||!_0x5b8480[_0xa75e('0xd')]){throw new db[(_0xa75e('0x1c'))][(_0xa75e('0x1d'))](_0xa75e('0x32'));}_0x4cf713=_0x5b8480;var _0x62eedf=[];_0x1f1861['forEach'](function(_0x44a68e){_0x62eedf[_0xa75e('0x43')](checkTranscribeJob(_0x44a68e,_0xc27aef,_0x4cf713));});return BPromise[_0xa75e('0x44')](_0x62eedf);})[_0xa75e('0x36')](function(_0x23159e){if(_0x23159e){if(!_0x23159e[_0xa75e('0x37')]||_0x23159e[_0xa75e('0x37')]!=='SequelizeValidationError'){logger[_0xa75e('0x39')](util[_0xa75e('0x3a')](_0x23159e,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x983c=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','CloudProvider','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x983c,0xf3));var _0xc983=function(_0x43645f,_0x656278){_0x43645f=_0x43645f-0x0;var _0x36f9ab=_0x983c[_0x43645f];return _0x36f9ab;};var _=require(_0xc983('0x0'));var AWS=require(_0xc983('0x1'));var rp=require(_0xc983('0x2'));var util=require(_0xc983('0x3'));var BPromise=require(_0xc983('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xc983('0x5'))(_0xc983('0x6'));function getTranscriptionJob(_0x14b999,_0x2e8c5d,_0xdaae44,_0x290ca8){return new Promise(function(_0x3897b9,_0x541e6f){var _0x346933=new AWS[(_0xc983('0x7'))]({'accessKeyId':_0x2e8c5d,'secretAccessKey':_0x14b999,'region':_0xdaae44});_0x346933[_0xc983('0x8')]({'TranscriptionJobName':_0x290ca8},function(_0x11cd44,_0x52025a){if(_0x11cd44){return _0x541e6f(_0x11cd44);}else{return _0x3897b9(_0x52025a);}});});}function sentiment(_0x548063,_0x4fbf6f,_0x5ad672,_0x41255b,_0x4311dc){return new Promise(function(_0x1ed0e4,_0x4405c2){var _0x15d894=new AWS[(_0xc983('0x9'))]({'accessKeyId':_0x4fbf6f,'secretAccessKey':_0x548063,'region':_0x5ad672});_0x15d894[_0xc983('0xa')]({'Text':_0x41255b,'LanguageCode':_0x4311dc[_0xc983('0xb')](0x0,0x2)},function(_0x25a806,_0x5a8b47){if(_0x25a806){return _0x4405c2(_0x25a806);}else{return _0x1ed0e4(_0x5a8b47);}});});}function checkTranscribeJob(_0x160b3b,_0x2ae6f0,_0x28b2f1){var _0x1b4dd2;return new BPromise(function(_0xf61926,_0x346727){logger['info'](util[_0xc983('0xc')](_0xc983('0xd'),_0x160b3b['id'],_0x160b3b[_0xc983('0xe')]));return getTranscriptionJob(_0x28b2f1[_0xc983('0xf')],_0x28b2f1[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x11')],_0x160b3b['transcribeName'])[_0xc983('0x12')](function(_0x1a1e7d){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x14'),_0x160b3b['id'],_0x160b3b[_0xc983('0xe')],_0x1a1e7d[_0xc983('0x15')][_0xc983('0x16')]));if(!_0x160b3b[_0xc983('0x17')]){switch(_0x1a1e7d[_0xc983('0x15')]['TranscriptionJobStatus']){case'COMPLETED':var _0x43231d={'transcribeStatus':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x16')],'fileUri':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x18')][_0xc983('0x19')]};logger[_0xc983('0x13')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x160b3b['id']));return rp({'uri':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x18')][_0xc983('0x19')],'json':!![]})[_0xc983('0x12')](function(_0xfcf7b6){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x1a'),_0x160b3b['id']));if(_0xfcf7b6&&_0xfcf7b6[_0xc983('0x1b')]&&_0xfcf7b6[_0xc983('0x1b')][_0xc983('0x1c')]&&_0xfcf7b6[_0xc983('0x1b')]['transcripts']['length']){_0x43231d[_0xc983('0x17')]='';for(var _0x446c80=0x0;_0x446c80<_0xfcf7b6['results'][_0xc983('0x1c')]['length'];_0x446c80++){_0x43231d[_0xc983('0x17')]+=_0xfcf7b6[_0xc983('0x1b')][_0xc983('0x1c')][_0x446c80][_0xc983('0x1d')]+'';}}return _0x160b3b[_0xc983('0x1e')](_0x43231d);})['then'](function(){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));if(!_0x160b3b[_0xc983('0x20')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2ae6f0[_0xc983('0x23')]||!_0x2ae6f0[_0xc983('0x24')]||!_0x2ae6f0[_0xc983('0x25')]||!_0x2ae6f0['language']||!_0x2ae6f0[_0xc983('0x26')]){throw new db[(_0xc983('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x43231d['fileText']){throw new Error(_0xc983('0x27'));}if(_0x2ae6f0['sentimentAccountId']===_0x28b2f1['id']){return _0x28b2f1;}else{return db['CloudProvider'][_0xc983('0x28')]({'where':{'id':_settings[_0xc983('0x24')]}});}})['then'](function(_0x383f00){if(!_0x383f00){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x383f00[_0xc983('0xf')]||!_0x383f00[_0xc983('0x10')]){throw new db['Sequelize'][(_0xc983('0x22'))](_0xc983('0x29'));}_0x1b4dd2=_0x383f00;logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x160b3b['id']));return sentiment(_0x1b4dd2['data1'],_0x1b4dd2[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x25')],_0x43231d[_0xc983('0x17')],_0x2ae6f0['language']);})['then'](function(_0x3d45df){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x2a'),_0x160b3b['id']));return _0x160b3b[_0xc983('0x1e')]({'sentiment':_0x3d45df[_0xc983('0x2b')],'sPositive':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2d')],'sNegative':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2e')],'sMixed':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2f')],'sNeutral':_0x3d45df['SentimentScore']['Neutral']});})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});case'FAILED':return _0x160b3b['update']({'transcribeStatus':_0xc983('0x30'),'failureReason':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x31')]})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});default:logger[_0xc983('0x13')](util['format'](_0xc983('0x32'),_0x160b3b['id']));break;}}else{return BPromise[_0xc983('0x33')]()['then'](function(){if(!_0x160b3b[_0xc983('0x20')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x34'));}if(!_0x2ae6f0[_0xc983('0x23')]||!_0x2ae6f0[_0xc983('0x24')]||!_0x2ae6f0[_0xc983('0x25')]||!_0x2ae6f0[_0xc983('0x35')]||!_0x2ae6f0['bucket']){throw new db[(_0xc983('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x160b3b[_0xc983('0x17')]){throw new Error(_0xc983('0x27'));}if(_0x2ae6f0['sentimentAccountId']===_0x28b2f1['id']){return _0x28b2f1;}else{return db[_0xc983('0x36')][_0xc983('0x28')]({'where':{'id':_settings[_0xc983('0x24')]}});}})['then'](function(_0x2ea6cc){if(!_0x2ea6cc){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x37'));}if(!_0x2ea6cc[_0xc983('0xf')]||!_0x2ea6cc[_0xc983('0x10')]){throw new db[(_0xc983('0x21'))]['ValidationError'](_0xc983('0x29'));}_0x1b4dd2=_0x2ea6cc;logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x160b3b['id']));return sentiment(_0x1b4dd2[_0xc983('0xf')],_0x1b4dd2[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x25')],_0x160b3b['fileText'],_0x2ae6f0[_0xc983('0x35')]);})['then'](function(_0x1de54c){logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x160b3b['id']));return _0x160b3b[_0xc983('0x1e')]({'sentiment':_0x1de54c[_0xc983('0x2b')],'sPositive':_0x1de54c[_0xc983('0x2c')][_0xc983('0x2d')],'sNegative':_0x1de54c[_0xc983('0x2c')][_0xc983('0x2e')],'sMixed':_0x1de54c[_0xc983('0x2c')]['Mixed'],'sNeutral':_0x1de54c[_0xc983('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});}})[_0xc983('0x38')](function(_0x29235f){if(_0x29235f){if(!_0x29235f[_0xc983('0x39')]||_0x29235f[_0xc983('0x39')]!==_0xc983('0x3a')){logger[_0xc983('0x3b')](util[_0xc983('0xc')](_0xc983('0x3c'),_0x160b3b['id']),util[_0xc983('0x3d')](_0x29235f,{'showHidden':![],'depth':null}));}}_0xf61926();});});}function checkTranscribe(){var _0x3caa03;var _0x4ce197;var _0x40656b;return db[_0xc983('0x3e')][_0xc983('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc983('0x12')](function(_0x297a4d){if(!_0x297a4d||!_0x297a4d['length']){throw new db['Sequelize'][(_0xc983('0x22'))](_0xc983('0x40'));}_0x3caa03=_0x297a4d;return db[_0xc983('0x41')][_0xc983('0x28')]({'where':{'id':0x1}});})[_0xc983('0x12')](function(_0x41d0bf){if(!_0x41d0bf){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x42'));}_0x4ce197=_0x41d0bf;if(!_0x4ce197['transcribe']||!_0x4ce197[_0xc983('0x43')]||!_0x4ce197[_0xc983('0x11')]||!_0x4ce197[_0xc983('0x35')]||!_0x4ce197[_0xc983('0x26')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))]('Transcribe\x20not\x20configured');}return db[_0xc983('0x36')][_0xc983('0x28')]({'where':{'id':_0x4ce197[_0xc983('0x43')]}});})[_0xc983('0x12')](function(_0x2f3283){if(!_0x2f3283){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x37'));}if(!_0x2f3283[_0xc983('0xf')]||!_0x2f3283[_0xc983('0x10')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x29'));}_0x40656b=_0x2f3283;var _0x162921=[];_0x3caa03[_0xc983('0x44')](function(_0x40e8f3){_0x162921['push'](checkTranscribeJob(_0x40e8f3,_0x4ce197,_0x40656b));});return BPromise[_0xc983('0x45')](_0x162921);})[_0xc983('0x38')](function(_0x18a7c6){if(_0x18a7c6){if(!_0x18a7c6['name']||_0x18a7c6[_0xc983('0x39')]!==_0xc983('0x3a')){logger[_0xc983('0x3b')](util[_0xc983('0x3d')](_0x18a7c6,{'showHidden':![],'depth':null}));}}});}exports[_0xc983('0x46')]=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 f5b8f19..ae44a01 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 _0x3718=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','update','system','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x3718,0x14d));var _0x8371=function(_0x49250c,_0x5751dd){_0x49250c=_0x49250c-0x0;var _0x53c56c=_0x3718[_0x49250c];return _0x53c56c;};'use strict';var _=require(_0x8371('0x0'));var moment=require(_0x8371('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x8371('0x2'));var db=require(_0x8371('0x3'))['db'];var logger=require(_0x8371('0x4'))(_0x8371('0x5'));config[_0x8371('0x6')]=_[_0x8371('0x7')](config[_0x8371('0x6')],{'host':_0x8371('0x8'),'port':0x18eb});var io=require(_0x8371('0x9'))(new Redis(config[_0x8371('0x6')]));function closeInteractions(){var _0x2db2b3=[];return db[_0x8371('0xa')][_0x8371('0xb')]({'raw':!![],'attributes':['id',_0x8371('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8371('0xd')](0x18,_0x8371('0xe'))}}})[_0x8371('0xf')](function(_0x19116d){if(_0x19116d&&_0x19116d[_0x8371('0x10')]){_0x2db2b3=_[_0x8371('0x11')](_0x19116d||[],'id');logger[_0x8371('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2db2b3['join']());return db[_0x8371('0xa')][_0x8371('0x13')]({'closeReason':_0x8371('0x14'),'disposition':_0x8371('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2db2b3}});}})[_0x8371('0xf')](function(){if(_0x2db2b3&&_0x2db2b3['length']){logger[_0x8371('0x12')](_0x8371('0x16'),_0x2db2b3[_0x8371('0x17')]());for(var _0x33a2a5=0x0;_0x33a2a5<_0x2db2b3['length'];_0x33a2a5++){io[_0x8371('0x18')](_0x8371('0x19'),{'id':_0x2db2b3[_0x33a2a5],'closed':!![]});}}})[_0x8371('0x1a')](function(_0x301775){logger[_0x8371('0x1b')](_0x8371('0x1c'),_0x301775?util['inspect'](_0x301775,{'showHidden':![],'depth':null}):'');});}exports[_0x8371('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd900=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','info','join','update','system','format'];(function(_0x576811,_0x25ff72){var _0x4d66d6=function(_0x1b454e){while(--_0x1b454e){_0x576811['push'](_0x576811['shift']());}};_0x4d66d6(++_0x25ff72);}(_0xd900,0x116));var _0x0d90=function(_0x3738ad,_0x4e25ae){_0x3738ad=_0x3738ad-0x0;var _0x253a25=_0xd900[_0x3738ad];return _0x253a25;};'use strict';var _=require(_0x0d90('0x0'));var moment=require(_0x0d90('0x1'));var Redis=require(_0x0d90('0x2'));var util=require(_0x0d90('0x3'));var config=require(_0x0d90('0x4'));var db=require(_0x0d90('0x5'))['db'];var logger=require(_0x0d90('0x6'))(_0x0d90('0x7'));config[_0x0d90('0x8')]=_[_0x0d90('0x9')](config[_0x0d90('0x8')],{'host':_0x0d90('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x36512f=[];return db[_0x0d90('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x0d90('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0d90('0xd')](0x18,_0x0d90('0xe'))}}})[_0x0d90('0xf')](function(_0x1d174a){if(_0x1d174a&&_0x1d174a[_0x0d90('0x10')]){_0x36512f=_['map'](_0x1d174a||[],'id');logger[_0x0d90('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x36512f[_0x0d90('0x12')]());return db[_0x0d90('0xb')][_0x0d90('0x13')]({'closeReason':_0x0d90('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0d90('0x15')](_0x0d90('0x16'))},{'where':{'id':_0x36512f}});}})[_0x0d90('0xf')](function(){if(_0x36512f&&_0x36512f[_0x0d90('0x10')]){logger[_0x0d90('0x11')](_0x0d90('0x17'),_0x36512f['join']());for(var _0x1fa52a=0x0;_0x1fa52a<_0x36512f['length'];_0x1fa52a++){io['emit'](_0x0d90('0x18'),{'id':_0x36512f[_0x1fa52a],'closed':!![]});}}})[_0x0d90('0x19')](function(_0x1cd30b){logger[_0x0d90('0x1a')](_0x0d90('0x1b'),_0x1cd30b?util[_0x0d90('0x1c')](_0x1cd30b,{'showHidden':![],'depth':null}):'');});}exports[_0x0d90('0x1d')]=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 037e373..69aaa01 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86c4=['finished\x20populating','contacts1','destroy','CmHopper','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','then','bulkCreate','log'];(function(_0x53159e,_0x5bf73a){var _0x452a66=function(_0x35f4d2){while(--_0x35f4d2){_0x53159e['push'](_0x53159e['shift']());}};_0x452a66(++_0x5bf73a);}(_0x86c4,0x8c));var _0x486c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86c4[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x486c('0x0'));var db=require(_0x486c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x486c('0x2')]({'id':i,'firstName':_0x486c('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x486c('0x4')+i+_0x486c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x486c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x486c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x486c('0x6')](),'updatedAt':Date[_0x486c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x486c('0x2')]({'id':i,'firstName':_0x486c('0x3')+i,'lastName':_0x486c('0x7')+i,'phone':0xf879fb460+i,'email':_0x486c('0x4')+i+_0x486c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x486c('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x486c('0x6')](),'updatedAt':Date[_0x486c('0x6')]()});}db[_0x486c('0x8')]['destroy']({'where':{}})[_0x486c('0x9')](function(){return db['CmContact'][_0x486c('0xa')](contacts);})[_0x486c('0x9')](function(){console[_0x486c('0xb')](_0x486c('0xc'),_0x486c('0xd'));return db['CmHopper'][_0x486c('0xe')]({'where':{}});})['then'](function(){return db[_0x486c('0xf')][_0x486c('0xa')](hopper);})[_0x486c('0x9')](function(){console[_0x486c('0xb')](_0x486c('0xc'),_0x486c('0x10'));return db[_0x486c('0x8')][_0x486c('0xa')](contacts2);})[_0x486c('0x9')](function(){console['log']('finished\x20populating',_0x486c('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x486c('0x9')](function(){console['log'](_0x486c('0xc'),'hopper2');})[_0x486c('0x12')](function(_0x2f78c5){console[_0x486c('0xb')](_0x2f78c5);}); \ No newline at end of file +var _0xf5b1=['contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1'];(function(_0x46884f,_0x2b5c5a){var _0x78c6c0=function(_0x43ba0a){while(--_0x43ba0a){_0x46884f['push'](_0x46884f['shift']());}};_0x78c6c0(++_0x2b5c5a);}(_0xf5b1,0x1cb));var _0x1f5b=function(_0x549ebf,_0x5620ae){_0x549ebf=_0x549ebf-0x0;var _0x7b62c5=_0xf5b1[_0x549ebf];return _0x7b62c5;};'use strict';var util=require(_0x1f5b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1f5b('0x1')]({'id':i,'firstName':_0x1f5b('0x2')+i,'lastName':_0x1f5b('0x3')+i,'phone':0xf879fb460+i,'email':_0x1f5b('0x4')+i+_0x1f5b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1f5b('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1f5b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1f5b('0x1')]({'id':i,'firstName':_0x1f5b('0x2')+i,'lastName':_0x1f5b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1f5b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1f5b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1f5b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1f5b('0x6')]()});}db[_0x1f5b('0x7')][_0x1f5b('0x8')]({'where':{}})[_0x1f5b('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x1f5b('0xc'));return db[_0x1f5b('0xd')]['destroy']({'where':{}});})['then'](function(){return db[_0x1f5b('0xd')][_0x1f5b('0xe')](hopper);})[_0x1f5b('0x9')](function(){console[_0x1f5b('0xa')]('finished\x20populating',_0x1f5b('0xf'));return db['CmContact'][_0x1f5b('0xe')](contacts2);})[_0x1f5b('0x9')](function(){console[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x1f5b('0x10'));return db[_0x1f5b('0xd')][_0x1f5b('0xe')](hopper2);})['then'](function(){console[_0x1f5b('0xa')](_0x1f5b('0xb'),_0x1f5b('0x11'));})[_0x1f5b('0x12')](function(_0x22b5a7){console['log'](_0x22b5a7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d358512..b136817 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2634=['\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2634,0xc4));var _0x4263=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2634[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x4263('0x0'));var db=require(_0x4263('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x4263('0x2')](_0x4263('0x3'),_0x4263('0x4'),i),'fullname':util[_0x4263('0x2')](_0x4263('0x3'),_0x4263('0x4'),i),'email':util[_0x4263('0x2')](_0x4263('0x5'),_0x4263('0x4'),i),'role':'agent','password':_0x4263('0x6'),'internal':0xfa0+i,'type':_0x4263('0x7'),'transport':[_0x4263('0x8'),'ws','wss'],'disallow':[_0x4263('0x9')],'allow':[_0x4263('0xa')],'defaultuser':util[_0x4263('0x2')](_0x4263('0x3'),'agent',i),'encryption':'yes','avpf':_0x4263('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x4263('0xb'),'dtlsverify':'no','dtlscertfile':_0x4263('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x4263('0xd'),'callerid':util[_0x4263('0x2')](_0x4263('0xe'),util['format'](_0x4263('0x3'),_0x4263('0x4'),i),0xfa0+i)});}db[_0x4263('0xf')][_0x4263('0x10')](users)[_0x4263('0x11')](function(){console['log'](_0x4263('0x12'));})[_0x4263('0x13')](function(_0x5eb9a1){console[_0x4263('0x14')](_0x5eb9a1);}); \ No newline at end of file +var _0xdaed=['log','add\x20user','util','../mysqldb','agent','format','%s%s','%s%s@xcally.com','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xdaed,0x1dd));var _0xddae=function(_0x523ca0,_0x1f5a95){_0x523ca0=_0x523ca0-0x0;var _0x30afed=_0xdaed[_0x523ca0];return _0x30afed;};'use strict';var util=require(_0xddae('0x0'));var db=require(_0xddae('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0xddae('0x2'),i),'fullname':util[_0xddae('0x3')](_0xddae('0x4'),_0xddae('0x2'),i),'email':util['format'](_0xddae('0x5'),'agent',i),'role':_0xddae('0x2'),'password':'password','internal':0xfa0+i,'type':_0xddae('0x6'),'transport':[_0xddae('0x7'),'ws',_0xddae('0x8')],'disallow':[_0xddae('0x9')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0xddae('0x2'),i),'encryption':_0xddae('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xddae('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xddae('0xb'),'dtlsprivatekey':_0xddae('0xc'),'dtlssetup':_0xddae('0xd'),'callerid':util[_0xddae('0x3')]('\x22%s\x22\x20<%s>',util[_0xddae('0x3')](_0xddae('0x4'),_0xddae('0x2'),i),0xfa0+i)});}db[_0xddae('0xe')][_0xddae('0xf')](users)[_0xddae('0x10')](function(){console[_0xddae('0x11')](_0xddae('0x12'));})['catch'](function(_0x46bf59){console[_0xddae('0x11')](_0x46bf59);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7e839a1..bc645f1 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x723c=['SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueues','ChatQueue','getVoiceQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','remoteAddress','request','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','Agents','User','name','role','agent','telephone','type','ivr','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','%s:queue:%s','length','format','user:%s','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','FaxQueue'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x723c,0x1ad));var _0xc723=function(_0x1e9d2c,_0x30c005){_0x1e9d2c=_0x1e9d2c-0x0;var _0x216921=_0x723c[_0x1e9d2c];return _0x216921;};'use strict';var _=require('lodash');var util=require(_0xc723('0x0'));var BPromise=require(_0xc723('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xc723('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc723('0x3'),'model':db[_0xc723('0x4')],'attributes':['id',_0xc723('0x5'),_0xc723('0x6')],'raw':!![],'where':{'role':_0xc723('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc723('0x5')],'where':{'role':_0xc723('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xc723('0x5')],'where':{'role':_0xc723('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xc723('0x9')],'where':{'type':_0xc723('0xa')}};function getAssociatedResources(_0x5a93e3,_0xff63c2,_0x3d17ff){return db['UserProfileSection']['findOne']({'where':{'name':_0x5a93e3,'userProfileId':_0xff63c2},'raw':!![]})[_0xc723('0xb')](function(_0x28da7f){if(_0x28da7f){if(_0x28da7f[_0xc723('0xc')]){switch(_0x5a93e3){case _0xc723('0xd'):case'ChatQueues':case _0xc723('0xe'):case _0xc723('0xf'):case _0xc723('0x10'):case _0xc723('0x11'):case _0xc723('0x12'):return db[_0x3d17ff]['findAll'](queryQueues);case _0xc723('0x13'):return db[_0x3d17ff][_0xc723('0x14')](queryTelephones);case _0xc723('0x15'):return db[_0x3d17ff][_0xc723('0x14')](queryTrunks);case _0xc723('0x16'):return db[_0x3d17ff]['findAll'](queryCampaigns);}}else{return db[_0xc723('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x28da7f['id']},'raw':!![]})[_0xc723('0xb')](function(_0x110d83){if(_0x110d83){var _0x212a77={'where':{'id':_[_0xc723('0x18')](_0x110d83,_0xc723('0x19'))},'raw':!![]};switch(_0x3d17ff){case _0xc723('0x4'):_0x212a77[_0xc723('0x1a')][_0xc723('0x6')]='telephone';break;case _0xc723('0x1b'):_0x212a77[_0xc723('0x1a')][_0xc723('0x9')]=_0xc723('0xa');break;}return db[_0x3d17ff]['findAll'](_0x212a77);}else{return[];}});}}else{return[];}})['then'](function(_0x1984ab){return _0x1984ab;});}function joinOrLeaveQueues(_0x298470,_0x133798,_0xcae217,_0x1fbfe0){_0x298470[_0x133798](util['format'](_0xc723('0x1c'),_0xcae217,_0x1fbfe0[_0xc723('0x5')]));if(_0x1fbfe0[_0xc723('0x3')]){for(var _0x172cf0=0x0;_0x172cf0<_0x1fbfe0[_0xc723('0x3')][_0xc723('0x1d')];_0x172cf0+=0x1){_0x298470[_0x133798](util[_0xc723('0x1e')](_0xc723('0x1f'),_0x1fbfe0[_0xc723('0x3')][_0x172cf0][_0xc723('0x5')]));}}}function joinOrLeave(_0x31d41e,_0xf77cc5,_0x545309){var _0x16ae56;if(_0x31d41e['handshake'][_0xc723('0x20')]['id']){db[_0xc723('0x4')][_0xc723('0x21')]({'attributes':['id','name',_0xc723('0x6'),_0xc723('0x22')],'where':{'id':_0x31d41e['handshake']['query']['id']},'include':[{'model':db[_0xc723('0x23')],'as':_0xc723('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc723('0x25')],'as':_0xc723('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xc723('0x27')],'as':_0xc723('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xc723('0x29')],'as':_0xc723('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc723('0x2b')],'as':_0xc723('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xc723('0xb')](function(_0x49b188){if(_0x49b188){_0x16ae56=_0x49b188;_0x31d41e[_0xf77cc5](util[_0xc723('0x1e')](_0xc723('0x1f'),_0x49b188[_0xc723('0x5')]));var _0x5e1a1d=[];switch(_0x49b188['role']){case _0xc723('0x2d'):_0x31d41e[_0xf77cc5](_0xc723('0x2e'));_0x31d41e[_0xf77cc5](_0xc723('0x2f'));if(queryQueues['hasOwnProperty'](_0xc723('0x30'))){delete queryQueues[_0xc723('0x30')];}_0x5e1a1d[_0xc723('0x31')](db['VoiceQueue'][_0xc723('0x14')](queryQueues));_0x5e1a1d['push'](db['ChatQueue']['findAll'](queryQueues));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x32')]['findAll'](queryQueues));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x33')][_0xc723('0x14')](queryQueues));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x34')][_0xc723('0x14')](queryQueues));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x35')][_0xc723('0x14')](queryQueues));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x36')][_0xc723('0x14')](queryQueues));_0x5e1a1d['push'](db[_0xc723('0x4')]['findAll'](queryTelephones));_0x5e1a1d['push'](db[_0xc723('0x37')]['findAll'](queryTrunks));_0x5e1a1d['push'](db[_0xc723('0x1b')][_0xc723('0x14')](queryCampaigns));_0x5e1a1d[_0xc723('0x31')](db[_0xc723('0x4')]['findAll'](queryAgents));break;case _0xc723('0x38'):_0x31d41e[_0xf77cc5](_0xc723('0x2e'));_0x31d41e[_0xf77cc5](_0xc723('0x2f'));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0xd'),_0x49b188['userProfileId'],_0xc723('0x39')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0x3a'),_0x49b188[_0xc723('0x22')],_0xc723('0x3b')));_0x5e1a1d['push'](getAssociatedResources(_0xc723('0xe'),_0x49b188['userProfileId'],_0xc723('0x32')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0xf'),_0x49b188[_0xc723('0x22')],_0xc723('0x33')));_0x5e1a1d['push'](getAssociatedResources(_0xc723('0x10'),_0x49b188[_0xc723('0x22')],_0xc723('0x34')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0x11'),_0x49b188[_0xc723('0x22')],'OpenchannelQueue'));_0x5e1a1d['push'](getAssociatedResources(_0xc723('0x12'),_0x49b188[_0xc723('0x22')],_0xc723('0x36')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0x13'),_0x49b188['userProfileId'],_0xc723('0x4')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0x15'),_0x49b188[_0xc723('0x22')],_0xc723('0x37')));_0x5e1a1d[_0xc723('0x31')](getAssociatedResources(_0xc723('0x16'),_0x49b188[_0xc723('0x22')],_0xc723('0x1b')));_0x5e1a1d[_0xc723('0x31')](db['User']['findAll'](queryAgents));break;case'agent':_0x31d41e[_0xf77cc5](_0xc723('0x2e'));_0x31d41e[_0xf77cc5]('voice:outbound');_0x5e1a1d[_0xc723('0x31')](_0x49b188[_0xc723('0x3c')]({'attributes':['id',_0xc723('0x5')]}));_0x5e1a1d['push'](_0x49b188['getChatQueues']({'attributes':['id','name']}));_0x5e1a1d[_0xc723('0x31')](_0x49b188[_0xc723('0x3d')]({'attributes':['id',_0xc723('0x5')]}));_0x5e1a1d[_0xc723('0x31')](_0x49b188['getSmsQueues']({'attributes':['id',_0xc723('0x5')]}));_0x5e1a1d[_0xc723('0x31')](_0x49b188[_0xc723('0x3e')]({'attributes':['id',_0xc723('0x5')]}));_0x5e1a1d[_0xc723('0x31')](_0x49b188['getOpenchannelQueues']({'attributes':['id',_0xc723('0x5')]}));_0x5e1a1d[_0xc723('0x31')](_0x49b188[_0xc723('0x3f')]({'attributes':['id',_0xc723('0x5')]}));break;}return BPromise[_0xc723('0x40')](_0x5e1a1d);}})[_0xc723('0xb')](function(_0x389392){if(_0x389392&&_0x389392['length']){for(var _0x9f090=0x0;_0x9f090<_0x389392[_0xc723('0x1d')];_0x9f090+=0x1){for(var _0x42e0d4=0x0;_0x42e0d4<_0x389392[_0x9f090]['length'];_0x42e0d4+=0x1){switch(_0x9f090){case 0x0:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x41'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x1:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x42'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x2:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x43'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x3:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x44'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x4:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x45'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x5:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x46'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x6:joinOrLeaveQueues(_0x31d41e,_0xf77cc5,_0xc723('0x47'),_0x389392[_0x9f090][_0x42e0d4]);break;case 0x7:if(_0x16ae56[_0xc723('0x6')]!==_0xc723('0x7'))_0x31d41e[_0xf77cc5](util[_0xc723('0x1e')](_0xc723('0x48'),_0x389392[_0x9f090][_0x42e0d4][_0xc723('0x5')]));break;case 0x8:if(_0x16ae56['role']!=='agent')_0x31d41e[_0xf77cc5](util[_0xc723('0x1e')]('trunk:%s',_0x389392[_0x9f090][_0x42e0d4][_0xc723('0x5')]));break;case 0x9:if(_0x16ae56[_0xc723('0x6')]!==_0xc723('0x7'))_0x31d41e[_0xf77cc5](util[_0xc723('0x1e')]('campaign:%s:%s',_0x389392[_0x9f090][_0x42e0d4][_0xc723('0x9')],_0x389392[_0x9f090][_0x42e0d4][_0xc723('0x5')]));break;case 0xa:_0x31d41e[_0xf77cc5](util[_0xc723('0x1e')](_0xc723('0x1f'),_0x389392[_0x9f090][_0x42e0d4][_0xc723('0x5')]));break;}}}}})[_0xc723('0xb')](function(){if(_0xf77cc5===_0xc723('0x49')){var _0x5ad852=_[_0xc723('0x18')](_0x16ae56[_0xc723('0x24')],'id');return _0x16ae56[_0xc723('0x4a')](_0x5ad852)[_0xc723('0xb')](function(){for(var _0x4627a4=0x0;_0x4627a4<_0x5ad852[_0xc723('0x1d')];_0x4627a4+=0x1){_0x545309['emit'](_0xc723('0x4b'),{'ChatInteractionId':Number(_0x5ad852[_0x4627a4]),'UserId':Number(_0x16ae56['id'])});}});}})[_0xc723('0xb')](function(){if(_0xf77cc5===_0xc723('0x49')){var _0x56ba2f=_[_0xc723('0x18')](_0x16ae56[_0xc723('0x26')],'id');return _0x16ae56[_0xc723('0x4c')](_0x56ba2f)[_0xc723('0xb')](function(){for(var _0x3c0dfa=0x0;_0x3c0dfa<_0x56ba2f[_0xc723('0x1d')];_0x3c0dfa+=0x1){_0x545309[_0xc723('0x4d')](_0xc723('0x4e'),{'MailInteractionId':Number(_0x56ba2f[_0x3c0dfa]),'UserId':Number(_0x16ae56['id'])});}});}})['then'](function(){if(_0xf77cc5===_0xc723('0x49')){var _0x34a70b=_['map'](_0x16ae56[_0xc723('0x28')],'id');return _0x16ae56[_0xc723('0x4f')](_0x34a70b)[_0xc723('0xb')](function(){for(var _0x4aa9c2=0x0;_0x4aa9c2<_0x34a70b['length'];_0x4aa9c2+=0x1){_0x545309[_0xc723('0x4d')](_0xc723('0x50'),{'FaxInteractionId':Number(_0x34a70b[_0x4aa9c2]),'UserId':Number(_0x16ae56['id'])});}});}})['then'](function(){if(_0xf77cc5==='leave'){var _0x56abcf=_[_0xc723('0x18')](_0x16ae56['SmsInteractions'],'id');return _0x16ae56['removeSmsInteractions'](_0x56abcf)['then'](function(){for(var _0x1c03a9=0x0;_0x1c03a9<_0x56abcf[_0xc723('0x1d')];_0x1c03a9+=0x1){_0x545309[_0xc723('0x4d')](_0xc723('0x51'),{'SmsInteractionId':Number(_0x56abcf[_0x1c03a9]),'UserId':Number(_0x16ae56['id'])});}});}})['then'](function(){if(_0xf77cc5===_0xc723('0x49')){var _0x64beb=_['map'](_0x16ae56['OpenchannelInteractions'],'id');return _0x16ae56[_0xc723('0x52')](_0x64beb)[_0xc723('0xb')](function(){for(var _0x221d5a=0x0;_0x221d5a<_0x64beb[_0xc723('0x1d')];_0x221d5a+=0x1){_0x545309[_0xc723('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x64beb[_0x221d5a]),'UserId':Number(_0x16ae56['id'])});}});}})[_0xc723('0xb')](function(){if(_0xf77cc5==='leave'){var _0x3cfd3b=_[_0xc723('0x18')](_0x16ae56['WhatsappInteractions'],'id');return _0x16ae56['removeWhatsappInteractions'](_0x3cfd3b)[_0xc723('0xb')](function(){for(var _0x3ca291=0x0;_0x3ca291<_0x3cfd3b['length'];_0x3ca291+=0x1){_0x545309['emit'](_0xc723('0x53'),{'WhatsappInteractionId':Number(_0x3cfd3b[_0x3ca291]),'UserId':Number(_0x16ae56['id'])});}});}})['catch'](function(_0x29e786){_0x31d41e[_0xc723('0x54')](_0x29e786);});}}function onDisconnect(_0x40dc70,_0x2a1a1e){joinOrLeave(_0x40dc70,_0xc723('0x49'),_0x2a1a1e);}function onConnect(_0x42c410){joinOrLeave(_0x42c410,_0xc723('0x55'));}exports[_0xc723('0x56')]=function(_0x2fd100){_0x2fd100['on'](_0xc723('0x57'),function(_0xac63cb){_0xac63cb['setMaxListeners'](0x0);_0xac63cb[_0xc723('0x58')]=_0xac63cb['request']['connection'][_0xc723('0x59')]+':'+_0xac63cb[_0xc723('0x5a')]['connection']['remotePort'];_0xac63cb[_0xc723('0x5b')]=new Date();_0xac63cb[_0xc723('0x54')]=function(_0xca3854){console[_0xc723('0x54')]('SocketIO\x20'+_0xac63cb[_0xc723('0x5c')][_0xc723('0x5')]+'['+_0xac63cb[_0xc723('0x58')]+']',_0xca3854);};_0xac63cb['on'](_0xc723('0x5d'),function(){onDisconnect(_0xac63cb,_0x2fd100);_0xac63cb[_0xc723('0x54')](_0xc723('0x5e'));});onConnect(_0xac63cb);_0xac63cb[_0xc723('0x54')](_0xc723('0x5f'));});}; \ No newline at end of file +var _0x288a=['then','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','Agents','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','OpenchannelQueue','getVoiceQueues','getFaxQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','util','bluebird','../mysqldb','./environment','User','role','agent','name','type','ivr','UserProfileSection','findOne'];(function(_0x51ea24,_0x2a71cd){var _0x351016=function(_0x411b00){while(--_0x411b00){_0x51ea24['push'](_0x51ea24['shift']());}};_0x351016(++_0x2a71cd);}(_0x288a,0x188));var _0xa288=function(_0x417c41,_0x1edb29){_0x417c41=_0x417c41-0x0;var _0x560c30=_0x288a[_0x417c41];return _0x560c30;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var BPromise=require(_0xa288('0x1'));var db=require(_0xa288('0x2'))['db'];var config=require(_0xa288('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xa288('0x4')],'attributes':['id','name',_0xa288('0x5')],'raw':!![],'where':{'role':_0xa288('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa288('0x7')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xa288('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0xa288('0x7')],'where':{'role':_0xa288('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xa288('0x8')],'where':{'type':_0xa288('0x9')}};function getAssociatedResources(_0x341d34,_0x490cda,_0x1a0c06){return db[_0xa288('0xa')][_0xa288('0xb')]({'where':{'name':_0x341d34,'userProfileId':_0x490cda},'raw':!![]})[_0xa288('0xc')](function(_0x4eafe2){if(_0x4eafe2){if(_0x4eafe2['autoAssociation']){switch(_0x341d34){case'VoiceQueues':case _0xa288('0xd'):case _0xa288('0xe'):case'SmsQueues':case _0xa288('0xf'):case _0xa288('0x10'):case _0xa288('0x11'):return db[_0x1a0c06][_0xa288('0x12')](queryQueues);case _0xa288('0x13'):return db[_0x1a0c06][_0xa288('0x12')](queryTelephones);case _0xa288('0x14'):return db[_0x1a0c06][_0xa288('0x12')](queryTrunks);case _0xa288('0x15'):return db[_0x1a0c06][_0xa288('0x12')](queryCampaigns);}}else{return db[_0xa288('0x16')][_0xa288('0x12')]({'attributes':[_0xa288('0x17')],'where':{'sectionId':_0x4eafe2['id']},'raw':!![]})[_0xa288('0xc')](function(_0x21ec88){if(_0x21ec88){var _0x138b4e={'where':{'id':_['map'](_0x21ec88,_0xa288('0x17'))},'raw':!![]};switch(_0x1a0c06){case _0xa288('0x4'):_0x138b4e[_0xa288('0x18')][_0xa288('0x5')]=_0xa288('0x19');break;case _0xa288('0x1a'):_0x138b4e['where'][_0xa288('0x8')]=_0xa288('0x9');break;}return db[_0x1a0c06]['findAll'](_0x138b4e);}else{return[];}});}}else{return[];}})['then'](function(_0x3558f4){return _0x3558f4;});}function joinOrLeaveQueues(_0x301879,_0x46e988,_0x510f64,_0xd46fbb){_0x301879[_0x46e988](util[_0xa288('0x1b')](_0xa288('0x1c'),_0x510f64,_0xd46fbb['name']));if(_0xd46fbb[_0xa288('0x1d')]){for(var _0x283523=0x0;_0x283523<_0xd46fbb[_0xa288('0x1d')][_0xa288('0x1e')];_0x283523+=0x1){_0x301879[_0x46e988](util[_0xa288('0x1b')]('user:%s',_0xd46fbb['Agents'][_0x283523][_0xa288('0x7')]));}}}function joinOrLeave(_0x4425c8,_0x37ff1a,_0x2f9465){var _0x4895bb;if(_0x4425c8[_0xa288('0x1f')][_0xa288('0x20')]['id']){db[_0xa288('0x4')][_0xa288('0x21')]({'attributes':['id',_0xa288('0x7'),_0xa288('0x5'),_0xa288('0x22')],'where':{'id':_0x4425c8[_0xa288('0x1f')][_0xa288('0x20')]['id']},'include':[{'model':db[_0xa288('0x23')],'as':_0xa288('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa288('0x25')],'as':_0xa288('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa288('0x27')],'as':_0xa288('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa288('0x29')],'as':_0xa288('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xa288('0x2b')],'as':_0xa288('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xa288('0xc')](function(_0x3bbbc8){if(_0x3bbbc8){_0x4895bb=_0x3bbbc8;_0x4425c8[_0x37ff1a](util[_0xa288('0x1b')](_0xa288('0x2d'),_0x3bbbc8[_0xa288('0x7')]));var _0x104290=[];switch(_0x3bbbc8[_0xa288('0x5')]){case _0xa288('0x2e'):_0x4425c8[_0x37ff1a](_0xa288('0x2f'));_0x4425c8[_0x37ff1a](_0xa288('0x30'));if(queryQueues[_0xa288('0x31')](_0xa288('0x32'))){delete queryQueues[_0xa288('0x32')];}_0x104290['push'](db[_0xa288('0x33')]['findAll'](queryQueues));_0x104290[_0xa288('0x34')](db[_0xa288('0x35')][_0xa288('0x12')](queryQueues));_0x104290['push'](db[_0xa288('0x36')][_0xa288('0x12')](queryQueues));_0x104290[_0xa288('0x34')](db[_0xa288('0x37')][_0xa288('0x12')](queryQueues));_0x104290[_0xa288('0x34')](db[_0xa288('0x38')][_0xa288('0x12')](queryQueues));_0x104290[_0xa288('0x34')](db['OpenchannelQueue']['findAll'](queryQueues));_0x104290['push'](db[_0xa288('0x39')]['findAll'](queryQueues));_0x104290[_0xa288('0x34')](db[_0xa288('0x4')][_0xa288('0x12')](queryTelephones));_0x104290[_0xa288('0x34')](db[_0xa288('0x3a')][_0xa288('0x12')](queryTrunks));_0x104290['push'](db['Campaign']['findAll'](queryCampaigns));_0x104290[_0xa288('0x34')](db[_0xa288('0x4')]['findAll'](queryAgents));break;case _0xa288('0x3b'):_0x4425c8[_0x37ff1a](_0xa288('0x2f'));_0x4425c8[_0x37ff1a]('voice:outbound');_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0x3c'),_0x3bbbc8[_0xa288('0x22')],_0xa288('0x33')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0xd'),_0x3bbbc8['userProfileId'],_0xa288('0x35')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0xe'),_0x3bbbc8['userProfileId'],_0xa288('0x36')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0x3d'),_0x3bbbc8[_0xa288('0x22')],_0xa288('0x37')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0xf'),_0x3bbbc8['userProfileId'],_0xa288('0x38')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0x10'),_0x3bbbc8['userProfileId'],_0xa288('0x3e')));_0x104290[_0xa288('0x34')](getAssociatedResources('WhatsappQueues',_0x3bbbc8[_0xa288('0x22')],_0xa288('0x39')));_0x104290[_0xa288('0x34')](getAssociatedResources('Telephones',_0x3bbbc8[_0xa288('0x22')],_0xa288('0x4')));_0x104290['push'](getAssociatedResources(_0xa288('0x14'),_0x3bbbc8[_0xa288('0x22')],_0xa288('0x3a')));_0x104290[_0xa288('0x34')](getAssociatedResources(_0xa288('0x15'),_0x3bbbc8['userProfileId'],_0xa288('0x1a')));_0x104290[_0xa288('0x34')](db[_0xa288('0x4')][_0xa288('0x12')](queryAgents));break;case _0xa288('0x6'):_0x4425c8[_0x37ff1a](_0xa288('0x2f'));_0x4425c8[_0x37ff1a](_0xa288('0x30'));_0x104290[_0xa288('0x34')](_0x3bbbc8[_0xa288('0x3f')]({'attributes':['id',_0xa288('0x7')]}));_0x104290[_0xa288('0x34')](_0x3bbbc8['getChatQueues']({'attributes':['id','name']}));_0x104290[_0xa288('0x34')](_0x3bbbc8[_0xa288('0x40')]({'attributes':['id',_0xa288('0x7')]}));_0x104290['push'](_0x3bbbc8['getSmsQueues']({'attributes':['id',_0xa288('0x7')]}));_0x104290[_0xa288('0x34')](_0x3bbbc8['getMailQueues']({'attributes':['id',_0xa288('0x7')]}));_0x104290['push'](_0x3bbbc8['getOpenchannelQueues']({'attributes':['id',_0xa288('0x7')]}));_0x104290[_0xa288('0x34')](_0x3bbbc8[_0xa288('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0xa288('0x42')](_0x104290);}})[_0xa288('0xc')](function(_0x15d529){if(_0x15d529&&_0x15d529[_0xa288('0x1e')]){for(var _0x314333=0x0;_0x314333<_0x15d529[_0xa288('0x1e')];_0x314333+=0x1){for(var _0x5ef0fa=0x0;_0x5ef0fa<_0x15d529[_0x314333][_0xa288('0x1e')];_0x5ef0fa+=0x1){switch(_0x314333){case 0x0:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,'voice',_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x1:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x43'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x2:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x44'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x3:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x45'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x4:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x46'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x5:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x47'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x6:joinOrLeaveQueues(_0x4425c8,_0x37ff1a,_0xa288('0x48'),_0x15d529[_0x314333][_0x5ef0fa]);break;case 0x7:if(_0x4895bb[_0xa288('0x5')]!==_0xa288('0x6'))_0x4425c8[_0x37ff1a](util[_0xa288('0x1b')](_0xa288('0x49'),_0x15d529[_0x314333][_0x5ef0fa][_0xa288('0x7')]));break;case 0x8:if(_0x4895bb[_0xa288('0x5')]!=='agent')_0x4425c8[_0x37ff1a](util[_0xa288('0x1b')](_0xa288('0x4a'),_0x15d529[_0x314333][_0x5ef0fa]['name']));break;case 0x9:if(_0x4895bb['role']!==_0xa288('0x6'))_0x4425c8[_0x37ff1a](util[_0xa288('0x1b')](_0xa288('0x4b'),_0x15d529[_0x314333][_0x5ef0fa]['type'],_0x15d529[_0x314333][_0x5ef0fa]['name']));break;case 0xa:_0x4425c8[_0x37ff1a](util[_0xa288('0x1b')](_0xa288('0x2d'),_0x15d529[_0x314333][_0x5ef0fa][_0xa288('0x7')]));break;}}}}})['then'](function(){if(_0x37ff1a===_0xa288('0x4c')){var _0x456d7f=_[_0xa288('0x4d')](_0x4895bb[_0xa288('0x24')],'id');return _0x4895bb[_0xa288('0x4e')](_0x456d7f)['then'](function(){for(var _0x43bed5=0x0;_0x43bed5<_0x456d7f[_0xa288('0x1e')];_0x43bed5+=0x1){_0x2f9465['emit'](_0xa288('0x4f'),{'ChatInteractionId':Number(_0x456d7f[_0x43bed5]),'UserId':Number(_0x4895bb['id'])});}});}})['then'](function(){if(_0x37ff1a==='leave'){var _0x5a561d=_[_0xa288('0x4d')](_0x4895bb[_0xa288('0x26')],'id');return _0x4895bb[_0xa288('0x50')](_0x5a561d)[_0xa288('0xc')](function(){for(var _0x527740=0x0;_0x527740<_0x5a561d[_0xa288('0x1e')];_0x527740+=0x1){_0x2f9465[_0xa288('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5a561d[_0x527740]),'UserId':Number(_0x4895bb['id'])});}});}})[_0xa288('0xc')](function(){if(_0x37ff1a===_0xa288('0x4c')){var _0x3b8737=_[_0xa288('0x4d')](_0x4895bb[_0xa288('0x28')],'id');return _0x4895bb[_0xa288('0x52')](_0x3b8737)[_0xa288('0xc')](function(){for(var _0x4a8ee4=0x0;_0x4a8ee4<_0x3b8737[_0xa288('0x1e')];_0x4a8ee4+=0x1){_0x2f9465[_0xa288('0x51')](_0xa288('0x53'),{'FaxInteractionId':Number(_0x3b8737[_0x4a8ee4]),'UserId':Number(_0x4895bb['id'])});}});}})[_0xa288('0xc')](function(){if(_0x37ff1a===_0xa288('0x4c')){var _0x18289f=_[_0xa288('0x4d')](_0x4895bb[_0xa288('0x54')],'id');return _0x4895bb['removeSmsInteractions'](_0x18289f)[_0xa288('0xc')](function(){for(var _0x5205a2=0x0;_0x5205a2<_0x18289f[_0xa288('0x1e')];_0x5205a2+=0x1){_0x2f9465['emit'](_0xa288('0x55'),{'SmsInteractionId':Number(_0x18289f[_0x5205a2]),'UserId':Number(_0x4895bb['id'])});}});}})[_0xa288('0xc')](function(){if(_0x37ff1a===_0xa288('0x4c')){var _0x2049e2=_[_0xa288('0x4d')](_0x4895bb[_0xa288('0x2a')],'id');return _0x4895bb[_0xa288('0x56')](_0x2049e2)[_0xa288('0xc')](function(){for(var _0x47a2c8=0x0;_0x47a2c8<_0x2049e2[_0xa288('0x1e')];_0x47a2c8+=0x1){_0x2f9465[_0xa288('0x51')](_0xa288('0x57'),{'OpenchannelInteractionId':Number(_0x2049e2[_0x47a2c8]),'UserId':Number(_0x4895bb['id'])});}});}})[_0xa288('0xc')](function(){if(_0x37ff1a===_0xa288('0x4c')){var _0x1f5349=_['map'](_0x4895bb[_0xa288('0x2c')],'id');return _0x4895bb[_0xa288('0x58')](_0x1f5349)[_0xa288('0xc')](function(){for(var _0x5c474c=0x0;_0x5c474c<_0x1f5349[_0xa288('0x1e')];_0x5c474c+=0x1){_0x2f9465[_0xa288('0x51')](_0xa288('0x59'),{'WhatsappInteractionId':Number(_0x1f5349[_0x5c474c]),'UserId':Number(_0x4895bb['id'])});}});}})['catch'](function(_0x2fe348){_0x4425c8[_0xa288('0x5a')](_0x2fe348);});}}function onDisconnect(_0x4cff24,_0x10da90){joinOrLeave(_0x4cff24,'leave',_0x10da90);}function onConnect(_0x4a528e){joinOrLeave(_0x4a528e,_0xa288('0x5b'));}exports['default']=function(_0x3e7d71){_0x3e7d71['on'](_0xa288('0x5c'),function(_0x37522b){_0x37522b[_0xa288('0x5d')](0x0);_0x37522b['address']=_0x37522b[_0xa288('0x5e')][_0xa288('0x5c')][_0xa288('0x5f')]+':'+_0x37522b[_0xa288('0x5e')][_0xa288('0x5c')][_0xa288('0x60')];_0x37522b[_0xa288('0x61')]=new Date();_0x37522b[_0xa288('0x5a')]=function(_0x5f2d28){console[_0xa288('0x5a')](_0xa288('0x62')+_0x37522b[_0xa288('0x63')]['name']+'['+_0x37522b['address']+']',_0x5f2d28);};_0x37522b['on'](_0xa288('0x64'),function(){onDisconnect(_0x37522b,_0x3e7d71);_0x37522b[_0xa288('0x5a')]('DISCONNECTED');});onConnect(_0x37522b);_0x37522b['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 0f70843..f7f6bba 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 _0x93f6=['hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','Trigger,\x20%s','error','catch','get','channel','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','UserId','User','find','name','email','interface','agent','AfterCreateMessage','event','opened','QueryTypes','SELECT','contact','closed','changed','substatus','sequelize','fullname','internal','AfterUpdate','default','length'];(function(_0x51a106,_0x5324a7){var _0xc226eb=function(_0x2f9aa1){while(--_0x2f9aa1){_0x51a106['push'](_0x51a106['shift']());}};_0xc226eb(++_0x5324a7);}(_0x93f6,0xd4));var _0x693f=function(_0x50ec8b,_0x471fff){_0x50ec8b=_0x50ec8b-0x0;var _0x2e7f1e=_0x93f6[_0x50ec8b];return _0x2e7f1e;};'use strict';var util=require(_0x693f('0x0'));var db=require(_0x693f('0x1'))['db'];var jayson=require(_0x693f('0x2'));var logger=require(_0x693f('0x3'))(_0x693f('0x4'));var client=jayson['client'][_0x693f('0x5')]({'port':0x232a});var triggers=[{'channel':_0x693f('0x6'),'model':_0x693f('0x7'),'event':'afterCreate','condition':_0x693f('0x8'),'callback':afterCreate},{'channel':_0x693f('0x6'),'model':'ChatInteraction','event':_0x693f('0x9'),'condition':_0x693f('0xa'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x693f('0xb'),'condition':_0x693f('0xc'),'callback':afterCreateMessage},{'channel':_0x693f('0xd'),'model':_0x693f('0xe'),'event':_0x693f('0xb'),'condition':_0x693f('0x8'),'callback':afterCreate},{'channel':_0x693f('0xd'),'model':_0x693f('0xe'),'event':_0x693f('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x693f('0xd'),'model':_0x693f('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x693f('0x10'),'model':_0x693f('0x11'),'event':_0x693f('0xb'),'condition':_0x693f('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x693f('0x11'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x693f('0x10'),'model':_0x693f('0x12'),'event':_0x693f('0xb'),'condition':_0x693f('0xc'),'callback':afterCreateMessage},{'channel':_0x693f('0x13'),'model':_0x693f('0x14'),'event':_0x693f('0xb'),'condition':_0x693f('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x693f('0x14'),'event':_0x693f('0x9'),'condition':_0x693f('0xa'),'callback':afterUpdate},{'channel':_0x693f('0x13'),'model':'FaxMessage','event':_0x693f('0xb'),'condition':_0x693f('0xc'),'callback':afterCreateMessage},{'channel':_0x693f('0x15'),'model':_0x693f('0x16'),'event':'afterCreate','condition':_0x693f('0x8'),'callback':afterCreate},{'channel':'Mail','model':_0x693f('0x16'),'event':_0x693f('0x9'),'condition':_0x693f('0xa'),'callback':afterUpdate},{'channel':_0x693f('0x15'),'model':_0x693f('0x17'),'event':_0x693f('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':_0x693f('0x8'),'callback':afterCreate},{'channel':_0x693f('0x18'),'model':_0x693f('0x19'),'event':_0x693f('0x9'),'condition':_0x693f('0xa'),'callback':afterUpdate},{'channel':_0x693f('0x18'),'model':_0x693f('0x1a'),'event':_0x693f('0xb'),'condition':_0x693f('0xc'),'callback':afterCreateMessage}];function request(_0x4cf4e6){return client['request'](_0x693f('0x1b'),_0x4cf4e6)[_0x693f('0x1c')](function(_0x1da99e){logger['info'](_0x693f('0x1d'),_0x693f('0x1b'),_0x1da99e);if(_0x1da99e[_0x693f('0x1e')]){if(_0x1da99e[_0x693f('0x1e')]['code']===0x1f4){logger[_0x693f('0x1e')]('Trigger,\x20%s',_0x693f('0x1b'),_0x1da99e[_0x693f('0x1e')]);}}})[_0x693f('0x1f')](function(_0x5e9c60){logger[_0x693f('0x1e')](_0x693f('0x1d'),'EventManager',_0x5e9c60);});}function afterCreateMessage(_0xace7b9){return function(_0x5b747f){_0x5b747f=_0x5b747f[_0x693f('0x20')]({'plain':!![]});_0x5b747f[_0x693f('0x21')]=_0xace7b9;_0x5b747f[_0x693f('0x22')]=_0xace7b9;_0x5b747f['event']=_0x5b747f[_0x693f('0x23')];Promise[_0x693f('0x24')]()[_0x693f('0x1c')](function(){if(typeof _0x5b747f[_0x693f('0x25')]===_0x693f('0x26'))return null;var _0x42c981=_0x693f('0x27')+_0x5b747f[_0x693f('0x25')];return db['sequelize'][_0x693f('0x28')](_0x42c981,{'type':db[_0x693f('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x693f('0x1c')](function(_0x17c936){if(_0x17c936){_0x5b747f['contact']=_0x17c936[0x0];}if(_0x5b747f[_0x693f('0x2a')]){return db[_0x693f('0x2b')][_0x693f('0x2c')]({'where':{'id':_0x5b747f[_0x693f('0x2a')]},'attributes':['id',_0x693f('0x2d'),'fullname',_0x693f('0x2e'),'internal'],'raw':!![]})[_0x693f('0x1c')](function(_0x305c5b){_0x5b747f[_0x693f('0x2f')]=util['format']('SIP/%s',_0x305c5b[_0x693f('0x2d')]);_0x5b747f['channel']=_0xace7b9;_0x5b747f[_0x693f('0x30')]=_0x305c5b;return request({'event':'incomingmessage','message':_0x5b747f});})['catch'](function(_0x5b41e0){logger['error'](_0x693f('0x1d'),_0x693f('0x31'),_0x5b41e0);});}else{return request({'event':'outgoingmessage','message':_0x5b747f});}});};}function afterCreate(_0x329004,_0x2a3a56){return function(_0x174efb){_0x174efb=_0x174efb[_0x693f('0x20')]({'plain':!![]});_0x174efb['channel']=_0x329004;_0x174efb[_0x693f('0x22')]=_0x329004;_0x174efb[_0x693f('0x32')]=_0x693f('0x33');var _0x3ec968=_0x693f('0x27')+_0x174efb[_0x693f('0x25')];return db['sequelize'][_0x693f('0x28')](_0x3ec968,{'type':db[_0x693f('0x29')][_0x693f('0x34')][_0x693f('0x35')],'raw':!![]})[_0x693f('0x1c')](function(_0x292b79){return _0x292b79;})['then'](function(_0x4a7864){if(_0x4a7864){_0x174efb[_0x693f('0x36')]=_0x4a7864[0x0];}return request({'event':_0x2a3a56,'message':_0x174efb});});};}function afterUpdate(_0x2abcd2){return function(_0x756d26){var _0x580f8e=_0x756d26['changed'](_0x693f('0x37'))&&_0x756d26[_0x693f('0x37')];var _0x332166=_0x756d26[_0x693f('0x38')](_0x693f('0x39'));if(_0x580f8e||_0x332166){var _0x21ef9d=_0x580f8e?_0x693f('0xa'):_0x693f('0x39');var _0x49f60f=_0x756d26['get']({'plain':!![]});_0x49f60f[_0x693f('0x21')]=_0x2abcd2;_0x49f60f[_0x693f('0x22')]=_0x2abcd2;_0x49f60f['event']=_0x580f8e?'closed':_0x693f('0x39');var _0x42df29=_0x693f('0x27')+_0x49f60f['ContactId'];return db[_0x693f('0x3a')][_0x693f('0x28')](_0x42df29,{'type':db[_0x693f('0x29')][_0x693f('0x34')][_0x693f('0x35')],'raw':!![]})[_0x693f('0x1c')](function(_0x8b316a){if(_0x8b316a){_0x49f60f[_0x693f('0x36')]=_0x8b316a[0x0];}if(_0x49f60f[_0x693f('0x2a')]){return db[_0x693f('0x2b')][_0x693f('0x2c')]({'where':{'id':_0x49f60f[_0x693f('0x2a')]},'attributes':['id',_0x693f('0x2d'),_0x693f('0x3b'),'email',_0x693f('0x3c')],'raw':!![]})['then'](function(_0x41e2a0){_0x49f60f[_0x693f('0x2f')]=util['format']('SIP/%s',_0x41e2a0[_0x693f('0x2d')]);_0x49f60f['agent']=_0x41e2a0;return request({'event':_0x21ef9d,'message':_0x49f60f});})[_0x693f('0x1f')](function(_0x265075){logger[_0x693f('0x1e')](_0x693f('0x1d'),_0x693f('0x3d'),_0x265075);});}else{return request({'event':_0x21ef9d,'message':_0x49f60f});}});}};}exports[_0x693f('0x3e')]=function(){for(var _0x1ce521=0x0;_0x1ce521=_0xba79f1[_0xa43c('0x15')]){throw Error(_0xa43c('0x16'));}_0x57f840(_0x3c5297);})['catch'](function(_0x1b742b){_0x3509cb(_0x1b742b);});});}; \ No newline at end of file +var _0x6f39=['lodash','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','role','User','count','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0x6f39,0xaf));var _0x96f3=function(_0x1ca4cc,_0x402c23){_0x1ca4cc=_0x1ca4cc-0x0;var _0x108010=_0x6f39[_0x1ca4cc];return _0x108010;};'use strict';var _=require(_0x96f3('0x0'));var BPromise=require(_0x96f3('0x1'));var db=require(_0x96f3('0x2'))['db'];var util=require(_0x96f3('0x3'));var channels=['voice',_0x96f3('0x4'),_0x96f3('0x5'),_0x96f3('0x6'),_0x96f3('0x7'),_0x96f3('0x8'),_0x96f3('0x9')];exports[_0x96f3('0xa')]=function(){return channels;};exports[_0x96f3('0xb')]=function(_0x1e4a07){_0x1e4a07=_0x1e4a07[_0x96f3('0xc')]();return _[_0x96f3('0xd')](channels,_0x1e4a07);};exports[_0x96f3('0xe')]=function(_0x1e4909,_0x2d0214,_0x552ed2,_0xd0b1df){var _0x1a8c05={'loginAttempts':_0x2d0214,'blocked':_0x552ed2};if(!_['isUndefined'](_0xd0b1df)){_0x1a8c05[_0x96f3('0xf')]=_0xd0b1df;}return _0x1e4909[_0x96f3('0x10')](_0x1a8c05);};exports['getLicense']=function(_0x20462d){return new BPromise(function(_0x5d724c,_0x51710f){var _0x4eeac4=0x0;if(_0x20462d[_0x96f3('0x11')]!=='agent'){_0x5d724c(_0x20462d);}db[_0x96f3('0x12')][_0x96f3('0x13')]({'where':{'role':_0x96f3('0x14'),'online':!![],'id':{'$ne':_0x20462d['id']}}})[_0x96f3('0x15')](function(_0x19b9c2){_0x4eeac4=_0x19b9c2;return util[_0x96f3('0x16')]();})[_0x96f3('0x15')](function(_0x47de9e){if(_0x47de9e&&_0x47de9e[_0x96f3('0x17')]&&_0x4eeac4>=_0x47de9e[_0x96f3('0x17')]){throw Error(_0x96f3('0x18'));}_0x5d724c(_0x20462d);})['catch'](function(_0x428df6){_0x51710f(_0x428df6);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e64d00a..b7ace73 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76be=['exports','status','json','send'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x76be,0xa8));var _0xe76b=function(_0x2a43b9,_0x474b39){_0x2a43b9=_0x2a43b9-0x0;var _0x1b6d54=_0x76be[_0x2a43b9];return _0x1b6d54;};'use strict';module[_0xe76b('0x0')][0x194]=function pageNotFound(_0x58d183,_0x52e31f){var _0x2864b3='404';var _0x49e087=0x194;var _0x517b3e={'status':_0x49e087};_0x52e31f[_0xe76b('0x1')](_0x517b3e[_0xe76b('0x1')]);_0x52e31f['render'](_0x2864b3,{},function(_0x383910,_0x13a2d4){if(_0x383910){return _0x52e31f[_0xe76b('0x1')](_0x517b3e[_0xe76b('0x1')])[_0xe76b('0x2')](_0x517b3e);}_0x52e31f[_0xe76b('0x3')](_0x13a2d4);});}; \ No newline at end of file +var _0xcd4f=['send','exports','render'];(function(_0x194b5c,_0x3e4893){var _0x2badf6=function(_0x28433a){while(--_0x28433a){_0x194b5c['push'](_0x194b5c['shift']());}};_0x2badf6(++_0x3e4893);}(_0xcd4f,0x175));var _0xfcd4=function(_0x3d5934,_0x55a026){_0x3d5934=_0x3d5934-0x0;var _0x4969e9=_0xcd4f[_0x3d5934];return _0x4969e9;};'use strict';module[_0xfcd4('0x0')][0x194]=function pageNotFound(_0x796406,_0x4f0dc4){var _0x3fb6e8='404';var _0x3503e3=0x194;var _0x1d565a={'status':_0x3503e3};_0x4f0dc4['status'](_0x1d565a['status']);_0x4f0dc4[_0xfcd4('0x1')](_0x3fb6e8,{},function(_0x2c3e41,_0x4ac824){if(_0x2c3e41){return _0x4f0dc4['status'](_0x1d565a['status'])['json'](_0x1d565a);}_0x4f0dc4[_0xfcd4('0x2')](_0x4ac824);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 799b37e..a5c0f2e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','hasOne','cascade','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','Extensions','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','UserProfile','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','CmHopperBlack','belongsTo','TrunkBackup','TrunkBackupId','Interval','IntervalId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','List','ListId','Template','mandatoryDispositionPause','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','FaxApplication','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','FaxQueueReport','SmsAccountId','mandatoryDispositionPauseId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Action','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Mohs','whatsapp_interaction_has_tags','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','CustomReportId','DefaultReportId','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','DeskField','ZendeskField','FreshdeskConfiguration','VtigerConfiguration','ChatQueueReport','ChatInternalMessage','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkId','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','mysql','utf8mb4','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue'];(function(_0x22a4cc,_0x5731e4){var _0x27bb2f=function(_0x282372){while(--_0x282372){_0x22a4cc['push'](_0x22a4cc['shift']());}};_0x27bb2f(++_0x5731e4);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x9c00[_0x5d30b4];return _0x1acfb8;};'use strict';var config=require(_0x09c0('0x0'));var Sequelize=require(_0x09c0('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x09c0('0x2')]();config[_0x09c0('0x1')]=_['defaultsDeep'](config[_0x09c0('0x1')],{'database':_0x09c0('0x3'),'username':_0x09c0('0x4'),'password':_0x09c0('0x5'),'options':{'host':_0x09c0('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x09c0('0x7')](),'define':{'charset':_0x09c0('0x8'),'collate':_0x09c0('0x9')}}});config[_0x09c0('0xa')]=_[_0x09c0('0xb')](config['sequelizeHistory'],{'database':_0x09c0('0x3'),'username':_0x09c0('0x4'),'password':_0x09c0('0x5'),'options':{'host':_0x09c0('0x6'),'port':0xcea,'dialect':_0x09c0('0xc'),'dialectOptions':{'charset':_0x09c0('0xd')},'logging':![],'timezone':timezone[_0x09c0('0x7')](),'define':{'charset':_0x09c0('0x8'),'collate':_0x09c0('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x09c0('0x1')][_0x09c0('0xe')],config[_0x09c0('0x1')][_0x09c0('0xf')],config[_0x09c0('0x1')][_0x09c0('0x10')],config[_0x09c0('0x1')][_0x09c0('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x09c0('0xa')][_0x09c0('0xe')],config[_0x09c0('0xa')][_0x09c0('0xf')],config[_0x09c0('0xa')][_0x09c0('0x10')],config[_0x09c0('0xa')][_0x09c0('0x11')])};db[_0x09c0('0x12')]=db['sequelize']['import']('../api/user/user.model');db[_0x09c0('0x13')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x15'));db['VoiceContext']=db[_0x09c0('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0x09c0('0x16')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x17'));db[_0x09c0('0x18')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x19'));db[_0x09c0('0x1a')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x1b'));db[_0x09c0('0x1c')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x1d'));db[_0x09c0('0x1e')]=db[_0x09c0('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x09c0('0x1f')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x20'));db['VoiceMailMessage']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x09c0('0x21')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x22'));db[_0x09c0('0x23')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x24'));db[_0x09c0('0x25')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x09c0('0x26')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x27'));db['MemberReport']=db[_0x09c0('0x1')]['import'](_0x09c0('0x28'));db[_0x09c0('0x29')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x2a'));db['UserVoiceQueueRt']=db[_0x09c0('0x1')]['import'](_0x09c0('0x2b'));db[_0x09c0('0x2c')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x2d'));db[_0x09c0('0x2e')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x2f'));db[_0x09c0('0x30')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x31'));db[_0x09c0('0x32')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x33'));db['UserSmsQueue']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x34'));db[_0x09c0('0x35')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x36'));db[_0x09c0('0x37')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x38'));db[_0x09c0('0x39')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x3a'));db[_0x09c0('0x3b')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x3c'));db['MailAccount']=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x09c0('0x3d')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x3e'));db[_0x09c0('0x3f')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x40'));db['MailInteraction']=db[_0x09c0('0x1')]['import'](_0x09c0('0x41'));db['MailMessage']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/mailMessage/mailMessage.model');db[_0x09c0('0x42')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x43'));db[_0x09c0('0x44')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x45'));db[_0x09c0('0x46')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x47'));db[_0x09c0('0x48')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x49'));db[_0x09c0('0x4a')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x4b'));db['FaxApplication']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x4c'));db['FaxInteraction']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x09c0('0x4d')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x4e'));db[_0x09c0('0x4f')]=db['sequelize'][_0x09c0('0x14')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x50'));db[_0x09c0('0x51')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x52'));db[_0x09c0('0x53')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x54'));db[_0x09c0('0x55')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x56'));db[_0x09c0('0x57')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x58'));db[_0x09c0('0x59')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x5a'));db[_0x09c0('0x5b')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x5c'));db[_0x09c0('0x5d')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x5e'));db[_0x09c0('0x5f')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x60'));db['OpenchannelQueue']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x61'));db['ChatWebsite']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x62'));db[_0x09c0('0x63')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x64'));db['ChatApplication']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x65'));db[_0x09c0('0x66')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x67'));db['ChatMessage']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x68'));db[_0x09c0('0x69')]=db['sequelize'][_0x09c0('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x09c0('0x6a')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x6b'));db[_0x09c0('0x6c')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/chatGroup/chatGroup.model');db[_0x09c0('0x6d')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x6e'));db[_0x09c0('0x6f')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x70'));db[_0x09c0('0x71')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/cmContact/cmContact.model');db[_0x09c0('0x72')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x73'));db['CmHopperBlack']=db[_0x09c0('0x1')]['import'](_0x09c0('0x74'));db[_0x09c0('0x75')]=db[_0x09c0('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x09c0('0x76')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x77'));db['ReportAgentPreview']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x09c0('0x78')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x79'));db['Action']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x7a'));db[_0x09c0('0x7b')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x7c'));db[_0x09c0('0x7d')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x7e'));db[_0x09c0('0x7f')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x80'));db[_0x09c0('0x81')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x82'));db['Interval']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x83'));db[_0x09c0('0x84')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x85'));db['Cdr']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x86'));db[_0x09c0('0x87')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x88'));db[_0x09c0('0x89')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x8a'));db['Sound']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x8b'));db[_0x09c0('0x8c')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/tag/tag.model');db['Template']=db['sequelize']['import'](_0x09c0('0x8d'));db[_0x09c0('0x8e')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x8f'));db['Variable']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/variable/variable.model');db[_0x09c0('0x90')]=db['sequelize']['import'](_0x09c0('0x91'));db[_0x09c0('0x92')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x93'));db[_0x09c0('0x94')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x95'));db[_0x09c0('0x96')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x97'));db['AnalyticExtractedReport']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x98'));db[_0x09c0('0x99')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x9a'));db[_0x09c0('0x9b')]=db['sequelize'][_0x09c0('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x09c0('0x9c')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x9d'));db[_0x09c0('0x9e')]=db['sequelize'][_0x09c0('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x09c0('0x9f')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xa0'));db[_0x09c0('0xa1')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xa2'));db[_0x09c0('0xa3')]=db['sequelize']['import'](_0x09c0('0xa4'));db[_0x09c0('0xa5')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xa6'));db[_0x09c0('0xa7')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xa8'));db[_0x09c0('0xa9')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x09c0('0xaa')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x09c0('0x1')]['import'](_0x09c0('0xab'));db[_0x09c0('0xac')]=db['sequelize'][_0x09c0('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x09c0('0xad')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x09c0('0xae')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xaf'));db[_0x09c0('0xb0')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xb1'));db[_0x09c0('0xb2')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xb3'));db['ZendeskField']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xb4'));db[_0x09c0('0xb5')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xb6'));db['FreshdeskConfiguration']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xb7'));db[_0x09c0('0xb8')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xb9'));db[_0x09c0('0xba')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xbb'));db['VtigerConfiguration']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x09c0('0xbc')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xbd'));db[_0x09c0('0xbe')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xbf'));db[_0x09c0('0xc0')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xc1'));db[_0x09c0('0xc2')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xc3'));db[_0x09c0('0xc4')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xc5'));db[_0x09c0('0xc6')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xc7'));db[_0x09c0('0xc8')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xc9'));db[_0x09c0('0xca')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xcb'));db[_0x09c0('0xcc')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xcd'));db[_0x09c0('0xce')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xcf'));db[_0x09c0('0x90')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x91'));db[_0x09c0('0xd0')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/network/network.model');db['ChatQueueReport']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xd1'));db['ChatInternalMessage']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xd2'));db[_0x09c0('0xd3')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xd4'));db['JscriptyQuestionReport']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xd5'));db[_0x09c0('0xd6')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xd7'));db[_0x09c0('0xd8')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xd9'));db[_0x09c0('0xda')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xdb'));db['SquareDetailsReport']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xdc'));db[_0x09c0('0xdd')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xde'));db[_0x09c0('0xdf')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xe0'));db[_0x09c0('0xe1')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x09c0('0xe2')]=db['sequelize'][_0x09c0('0x14')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xe3'));db[_0x09c0('0xe4')]=db[_0x09c0('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x09c0('0xe5')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xe6'));db[_0x09c0('0xe7')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xe8'));db['Campaign']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xe9'));db[_0x09c0('0xea')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xeb'));db['Attachment']=db['sequelize']['import'](_0x09c0('0xec'));db[_0x09c0('0xed')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xee'));db['MailTransferReport']=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x09c0('0xef')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xf0'));db[_0x09c0('0xf1')]=db[_0x09c0('0x1')]['import'](_0x09c0('0xf2'));db[_0x09c0('0xf3')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xf4'));db['SmsTransferReport']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xf5'));db[_0x09c0('0xf6')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xf7'));db[_0x09c0('0xf8')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xf9'));db['UserProfile']=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xfa'));db[_0x09c0('0xfb')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0xfc'));db[_0x09c0('0xfd')]=db[_0x09c0('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x09c0('0xfe')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0xff'));db['WhatsappAccount']=db[_0x09c0('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x09c0('0x100')]=db[_0x09c0('0x1')]['import'](_0x09c0('0x101'));db[_0x09c0('0x102')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x103'));db[_0x09c0('0x104')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x09c0('0x105')]=db['sequelize'][_0x09c0('0x14')](_0x09c0('0x106'));db[_0x09c0('0x107')]=db['sequelize']['import'](_0x09c0('0x108'));db['WhatsappQueue']=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x109'));db[_0x09c0('0x10a')]=db[_0x09c0('0x1')][_0x09c0('0x14')](_0x09c0('0x10b'));db['TeamVoiceQueue']=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x09c0('0x1')]['import'](_0x09c0('0x10c'));db[_0x09c0('0x10d')]=db[_0x09c0('0x1')][_0x09c0('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x09c0('0x12')][_0x09c0('0x10e')](db[_0x09c0('0x1f')],{'as':'VoiceMail','onDelete':_0x09c0('0x10f'),'foreignKey':'UserId'});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x1c')],{'as':_0x09c0('0x111'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')]['hasMany'](db[_0x09c0('0x113')],{'as':_0x09c0('0x114'),'foreignKey':'UserId'});db[_0x09c0('0x12')]['hasMany'](db[_0x09c0('0x16')],{'as':_0x09c0('0x115'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x75')],{'as':'HopperFinals','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x76')],{'as':'HopperHistory','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x116')],{'as':'ReportAgentPreview','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')]['hasMany'](db[_0x09c0('0x5d')],{'as':_0x09c0('0x117'),'foreignKey':'UserId'});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x66')],{'as':_0x09c0('0x118'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')][_0x09c0('0x110')](db['SmsInteraction'],{'as':_0x09c0('0x119'),'foreignKey':'UserId'});db['User'][_0x09c0('0x110')](db[_0x09c0('0x11a')],{'as':'FaxInteractions','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')]['hasMany'](db[_0x09c0('0x11b')],{'as':'MailInteractions','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0x102')],{'as':_0x09c0('0x11c'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x12')][_0x09c0('0x110')](db[_0x09c0('0xfe')],{'as':_0x09c0('0x11d'),'foreignKey':_0x09c0('0x11e')});db[_0x09c0('0x12')]['belongsTo'](db[_0x09c0('0x11f')],{'as':_0x09c0('0x11f'),'foreignKey':_0x09c0('0x120')});db['User'][_0x09c0('0x121')](db['ChatGroup'],{'as':'Groups','through':_0x09c0('0x122')});db['User'][_0x09c0('0x121')](db[_0x09c0('0x71')],{'as':_0x09c0('0x123'),'through':_0x09c0('0x124')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0xf6')],{'as':'Lists','through':_0x09c0('0x125')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':_0x09c0('0x126')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x11b')],{'as':_0x09c0('0x127'),'through':_0x09c0('0x128')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x66')],{'as':_0x09c0('0x118'),'through':_0x09c0('0x129')});db[_0x09c0('0x12')][_0x09c0('0x121')](db['FaxInteraction'],{'as':_0x09c0('0x12a'),'through':_0x09c0('0x12b')});db[_0x09c0('0x12')]['belongsToMany'](db[_0x09c0('0x53')],{'as':_0x09c0('0x119'),'through':_0x09c0('0x12c')});db['User'][_0x09c0('0x121')](db[_0x09c0('0x5d')],{'as':_0x09c0('0x117'),'through':_0x09c0('0x12d')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x102')],{'as':_0x09c0('0x11c'),'through':_0x09c0('0x12e')});db[_0x09c0('0x12')]['belongsToMany'](db[_0x09c0('0x1a')],{'as':'VoiceQueues','through':_0x09c0('0x2c'),'required':![]});db[_0x09c0('0x12')]['belongsToMany'](db[_0x09c0('0xf8')],{'as':_0x09c0('0x12f'),'through':_0x09c0('0x10d'),'required':![]});db['User'][_0x09c0('0x121')](db[_0x09c0('0x3d')],{'as':_0x09c0('0x130'),'through':_0x09c0('0x30'),'required':![]});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x6a')],{'as':_0x09c0('0x131'),'through':_0x09c0('0x2e'),'required':![],'hooks':!![]});db[_0x09c0('0x12')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x09c0('0x32'),'required':![]});db[_0x09c0('0x12')]['belongsToMany'](db[_0x09c0('0x57')],{'as':_0x09c0('0x132'),'through':_0x09c0('0x133'),'required':![]});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x134')],{'as':_0x09c0('0x135'),'through':_0x09c0('0x35'),'required':![]});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x136')],{'as':_0x09c0('0x137'),'through':'UserWhatsappQueue','required':![]});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0xf6')],{'through':_0x09c0('0x125')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x138')],{'as':_0x09c0('0x139'),'through':_0x09c0('0x13a')});db[_0x09c0('0x12')][_0x09c0('0x121')](db['FaxAccount'],{'as':_0x09c0('0x13b'),'through':_0x09c0('0x13c')});db[_0x09c0('0x12')]['belongsToMany'](db[_0x09c0('0x13d')],{'as':_0x09c0('0x13e'),'through':_0x09c0('0x13f')});db[_0x09c0('0x12')][_0x09c0('0x121')](db['OpenchannelAccount'],{'as':_0x09c0('0x140'),'through':_0x09c0('0x141')});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0x51')],{'as':_0x09c0('0x142'),'through':_0x09c0('0x143')});db['User'][_0x09c0('0x121')](db[_0x09c0('0x144')],{'as':_0x09c0('0x145'),'through':'user_has_whatsapp_accounts'});db[_0x09c0('0x12')][_0x09c0('0x121')](db[_0x09c0('0xe2')],{'as':_0x09c0('0x146'),'through':_0x09c0('0x147')});db[_0x09c0('0x13')][_0x09c0('0x110')](db[_0x09c0('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x09c0('0x148')});db[_0x09c0('0x149')][_0x09c0('0x110')](db['VoiceExtension'],{'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x16')]['hasMany'](db[_0x09c0('0x16')],{'as':_0x09c0('0x14a'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x18')][_0x09c0('0x121')](db[_0x09c0('0x14b')],{'as':_0x09c0('0x14c'),'through':_0x09c0('0x14d')});db[_0x09c0('0x1a')]['hasMany'](db[_0x09c0('0x113')],{'as':_0x09c0('0x14e'),'foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')][_0x09c0('0x110')](db['CmHopper'],{'as':_0x09c0('0x150'),'foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')][_0x09c0('0x110')](db[_0x09c0('0x75')],{'as':_0x09c0('0x151'),'foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')][_0x09c0('0x110')](db[_0x09c0('0x76')],{'as':_0x09c0('0x152'),'foreignKey':_0x09c0('0x14f')});db['VoiceQueue']['hasMany'](db[_0x09c0('0x116')],{'as':_0x09c0('0x116'),'foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')]['hasMany'](db[_0x09c0('0x153')],{'as':'HopperBlacks','foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')][_0x09c0('0x110')](db[_0x09c0('0xd6')],{'as':'JscriptySessions','foreignKey':_0x09c0('0x14f')});db[_0x09c0('0x1a')][_0x09c0('0x154')](db[_0x09c0('0x29')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x09c0('0x1a')][_0x09c0('0x154')](db[_0x09c0('0x29')],{'as':_0x09c0('0x155'),'foreignKey':_0x09c0('0x156')});db[_0x09c0('0x1a')][_0x09c0('0x154')](db[_0x09c0('0x157')],{'as':_0x09c0('0x157'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x1a')][_0x09c0('0x154')](db[_0x09c0('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x09c0('0x159'),'through':_0x09c0('0x15a')});db[_0x09c0('0x1a')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x2c')});db[_0x09c0('0x1a')][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'as':_0x09c0('0x15c'),'through':_0x09c0('0x15d')});db['VoiceQueue']['belongsToMany'](db[_0x09c0('0xf6')],{'as':_0x09c0('0x15e'),'through':'voice_queues_has_cm_blacklists'});db[_0x09c0('0x1c')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':'User','foreignKey':_0x09c0('0x112')});db[_0x09c0('0x1e')]['belongsTo'](db['User'],{'as':_0x09c0('0x12'),'foreignKey':'UserId'});db['VoiceMail'][_0x09c0('0x110')](db[_0x09c0('0x15f')],{'as':_0x09c0('0x160'),'onDelete':'cascade','foreignKey':_0x09c0('0x161'),'sourceKey':_0x09c0('0x162')});db['VoiceMailMessage'][_0x09c0('0x154')](db[_0x09c0('0x1f')],{'foreignKey':_0x09c0('0x161'),'targetKey':_0x09c0('0x162')});db[_0x09c0('0x21')][_0x09c0('0x110')](db[_0x09c0('0x26')],{'as':_0x09c0('0x163'),'foreignKey':'uniqueid','constraints':![]});db[_0x09c0('0x21')]['hasMany'](db['VoiceAgentReport'],{'as':_0x09c0('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0x09c0('0x21')]['belongsTo'](db[_0x09c0('0x12')],{'as':_0x09c0('0x12'),'foreignKey':'UserId'});db[_0x09c0('0x21')]['belongsTo'](db['CmContact'],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x39')][_0x09c0('0x154')](db[_0x09c0('0x13d')],{'as':'MailAccount','foreignKey':_0x09c0('0x167')});db[_0x09c0('0x3b')][_0x09c0('0x154')](db['MailAccount'],{'as':_0x09c0('0x13d'),'foreignKey':_0x09c0('0x167')});db[_0x09c0('0x13d')][_0x09c0('0x10e')](db[_0x09c0('0x39')],{'as':_0x09c0('0x168'),'onDelete':'cascade'});db[_0x09c0('0x13d')]['hasOne'](db[_0x09c0('0x3b')],{'as':_0x09c0('0x169'),'onDelete':_0x09c0('0x10f')});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x167'),'onDelete':'cascade'});db[_0x09c0('0x13d')][_0x09c0('0x110')](db[_0x09c0('0x7d')],{'as':_0x09c0('0x16b'),'foreignKey':_0x09c0('0x167')});db[_0x09c0('0x13d')]['hasMany'](db[_0x09c0('0x16c')],{'as':'Messages','foreignKey':_0x09c0('0x167')});db[_0x09c0('0x13d')][_0x09c0('0x110')](db[_0x09c0('0x11b')],{'as':_0x09c0('0x16d')});db['MailAccount'][_0x09c0('0x110')](db[_0x09c0('0x42')],{'as':'Applications'});db[_0x09c0('0x13d')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x13d')][_0x09c0('0x154')](db[_0x09c0('0x170')],{'as':_0x09c0('0x170'),'foreignKey':'TemplateId'});db[_0x09c0('0x13d')][_0x09c0('0x154')](db[_0x09c0('0x84')],{'as':_0x09c0('0x171'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':'UserMailQueue'});db[_0x09c0('0x3d')][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':'team_has_mail_queues','as':_0x09c0('0x15c')});db['MailInteraction'][_0x09c0('0x110')](db[_0x09c0('0x16c')],{'as':'Messages','onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x172')});db[_0x09c0('0x11b')]['belongsTo'](db[_0x09c0('0x13d')],{'as':_0x09c0('0x173'),'foreignKey':'MailAccountId'});db[_0x09c0('0x11b')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':'ContactId'});db[_0x09c0('0x11b')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x11b')][_0x09c0('0x121')](db['Tag'],{'through':_0x09c0('0x175'),'as':_0x09c0('0x176')});db[_0x09c0('0x11b')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':_0x09c0('0x175'),'as':_0x09c0('0x177')});db[_0x09c0('0x11b')]['belongsToMany'](db[_0x09c0('0x12')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x09c0('0x172')});db[_0x09c0('0x16c')][_0x09c0('0x110')](db[_0x09c0('0x178')],{'as':_0x09c0('0x179'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x16c')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x12')});db[_0x09c0('0x16c')][_0x09c0('0x154')](db['CmContact'],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x165')});db[_0x09c0('0x16c')]['belongsTo'](db[_0x09c0('0x11b')],{'as':_0x09c0('0x17a'),'foreignKey':_0x09c0('0x172')});db[_0x09c0('0x16c')][_0x09c0('0x154')](db[_0x09c0('0x13d')],{'as':_0x09c0('0x173'),'foreignKey':'MailAccountId'});db[_0x09c0('0x16c')][_0x09c0('0x154')](db[_0x09c0('0x138')],{'as':'ChatWebsite','foreignKey':_0x09c0('0x17b')});db['MailMessage'][_0x09c0('0x154')](db[_0x09c0('0x69')],{'as':_0x09c0('0x69'),'foreignKey':_0x09c0('0x17c')});db['MailApplication'][_0x09c0('0x154')](db[_0x09c0('0x12')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x09c0('0x3d')],{'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x42')][_0x09c0('0x154')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x09c0('0x154')](db[_0x09c0('0x157')],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x42')][_0x09c0('0x154')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x09c0('0x17e')});db[_0x09c0('0x44')][_0x09c0('0x154')](db[_0x09c0('0x13d')],{});db['MailQueueReport']['belongsTo'](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x44')]['belongsTo'](db[_0x09c0('0x71')],{'as':'Contact','foreignKey':_0x09c0('0x166')});db[_0x09c0('0x44')][_0x09c0('0x154')](db[_0x09c0('0x11b')],{});db[_0x09c0('0x44')]['belongsTo'](db[_0x09c0('0x16c')],{});db[_0x09c0('0x44')][_0x09c0('0x154')](db[_0x09c0('0x12')],{});db[_0x09c0('0x44')][_0x09c0('0x154')](db[_0x09c0('0x3d')],{});db[_0x09c0('0x46')]['hasMany'](db[_0x09c0('0x48')],{'as':_0x09c0('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0x09c0('0x110')](db[_0x09c0('0x7f')],{'as':'Dispositions','foreignKey':_0x09c0('0x180'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x4a')][_0x09c0('0x110')](db[_0x09c0('0x7d')],{'as':_0x09c0('0x16b'),'foreignKey':_0x09c0('0x180')});db[_0x09c0('0x4a')][_0x09c0('0x110')](db[_0x09c0('0x11a')],{'as':_0x09c0('0x16d')});db[_0x09c0('0x4a')][_0x09c0('0x110')](db[_0x09c0('0x181')],{'as':'Applications'});db[_0x09c0('0x4a')][_0x09c0('0x110')](db[_0x09c0('0x16')],{'as':_0x09c0('0x182'),'onDelete':'cascade'});db[_0x09c0('0x4a')][_0x09c0('0x110')](db['FaxMessage'],{'as':_0x09c0('0x160')});db[_0x09c0('0x4a')][_0x09c0('0x154')](db[_0x09c0('0x29')],{'as':_0x09c0('0x29')});db[_0x09c0('0x4a')][_0x09c0('0x154')](db['CmList'],{'as':'List','foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x4a')]['belongsTo'](db[_0x09c0('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x09c0('0x4a')]['belongsToMany'](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x13c')});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x181')][_0x09c0('0x154')](db[_0x09c0('0x4f')],{'onDelete':_0x09c0('0x17d')});db['FaxApplication'][_0x09c0('0x154')](db[_0x09c0('0x4a')],{'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x181')][_0x09c0('0x154')](db['Tag'],{'onDelete':_0x09c0('0x17d'),'foreignKey':'TagId'});db[_0x09c0('0x11a')][_0x09c0('0x110')](db[_0x09c0('0x4d')],{'as':_0x09c0('0x160'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x183')});db[_0x09c0('0x11a')][_0x09c0('0x154')](db[_0x09c0('0x4a')],{'as':_0x09c0('0x173'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x11a')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db['FaxInteraction'][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':_0x09c0('0x184'),'as':_0x09c0('0x176')});db[_0x09c0('0x11a')]['belongsToMany'](db['Tag'],{'through':_0x09c0('0x184'),'as':'ThroughTags'});db[_0x09c0('0x11a')][_0x09c0('0x121')](db['User'],{'as':'Users','through':_0x09c0('0x12b'),'foreignKey':'FaxInteractionId'});db[_0x09c0('0x4d')][_0x09c0('0x154')](db['User'],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x12')});db[_0x09c0('0x4d')][_0x09c0('0x154')](db[_0x09c0('0x11a')],{'as':_0x09c0('0x17a'),'foreignKey':'FaxInteractionId'});db[_0x09c0('0x4d')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x165')});db['FaxMessage'][_0x09c0('0x154')](db[_0x09c0('0x178')],{'as':_0x09c0('0x178'),'foreignKey':_0x09c0('0x185')});db[_0x09c0('0x4d')]['belongsTo'](db[_0x09c0('0x4a')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x180')});db[_0x09c0('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x09c0('0xe5')],{'through':'team_has_fax_queues','as':_0x09c0('0x15c')});db[_0x09c0('0x186')][_0x09c0('0x154')](db[_0x09c0('0x4a')],{});db[_0x09c0('0x186')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x186')]['belongsTo'](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x186')][_0x09c0('0x154')](db[_0x09c0('0x11a')],{});db['FaxQueueReport'][_0x09c0('0x154')](db['FaxMessage'],{});db[_0x09c0('0x186')][_0x09c0('0x154')](db[_0x09c0('0x12')],{});db[_0x09c0('0x186')][_0x09c0('0x154')](db[_0x09c0('0x4f')],{});db[_0x09c0('0x51')][_0x09c0('0x110')](db[_0x09c0('0x7f')],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x187'),'onDelete':_0x09c0('0x10f')});db['SmsAccount'][_0x09c0('0x110')](db[_0x09c0('0x7d')],{'as':_0x09c0('0x16b'),'foreignKey':_0x09c0('0x187')});db['SmsAccount'][_0x09c0('0x110')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x09c0('0x187')});db[_0x09c0('0x51')][_0x09c0('0x110')](db[_0x09c0('0x53')],{'as':'Interactions'});db[_0x09c0('0x51')][_0x09c0('0x110')](db['SmsApplication'],{'as':_0x09c0('0x14a')});db[_0x09c0('0x51')][_0x09c0('0x154')](db['CmList'],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x51')][_0x09c0('0x154')](db['Pause'],{'as':_0x09c0('0x171'),'foreignKey':_0x09c0('0x188')});db['SmsAccount'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x143')});db[_0x09c0('0x189')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x189')][_0x09c0('0x154')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x09c0('0x189')]['belongsTo'](db[_0x09c0('0x51')],{'onDelete':'restrict'});db[_0x09c0('0x189')][_0x09c0('0x154')](db['Interval'],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x189')][_0x09c0('0x154')](db[_0x09c0('0x8c')],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x17e')});db[_0x09c0('0x53')][_0x09c0('0x110')](db['SmsMessage'],{'as':_0x09c0('0x160'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x18a')});db[_0x09c0('0x53')]['belongsTo'](db[_0x09c0('0x51')],{'as':_0x09c0('0x173'),'foreignKey':'SmsAccountId'});db[_0x09c0('0x53')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x53')][_0x09c0('0x154')](db['User'],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x53')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':_0x09c0('0x18b'),'as':_0x09c0('0x176')});db[_0x09c0('0x53')]['belongsToMany'](db[_0x09c0('0x8c')],{'through':_0x09c0('0x18b'),'as':_0x09c0('0x177')});db[_0x09c0('0x53')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x09c0('0x18a')});db[_0x09c0('0x55')]['belongsTo'](db[_0x09c0('0x12')],{'as':_0x09c0('0x12')});db[_0x09c0('0x55')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'onDelete':_0x09c0('0x10f'),'as':'Contact'});db[_0x09c0('0x55')][_0x09c0('0x154')](db[_0x09c0('0x53')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x17a'),'foreignKey':_0x09c0('0x18a')});db[_0x09c0('0x55')][_0x09c0('0x154')](db[_0x09c0('0x51')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x187')});db[_0x09c0('0x57')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':'Agents','through':_0x09c0('0x133'),'foreignKey':_0x09c0('0x18c')});db['SmsQueue'][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':_0x09c0('0x18d'),'as':_0x09c0('0x15c')});db['OpenchannelAccount']['hasMany'](db[_0x09c0('0x7f')],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x18e'),'onDelete':'cascade'});db[_0x09c0('0x59')][_0x09c0('0x110')](db[_0x09c0('0x7d')],{'as':_0x09c0('0x16b'),'foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x59')]['hasMany'](db[_0x09c0('0x5d')],{'as':'Interactions','foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x59')]['hasMany'](db['OpenchannelMessage'],{'as':_0x09c0('0x160'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x09c0('0x5b')],{'as':_0x09c0('0x14a'),'foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x59')]['belongsTo'](db[_0x09c0('0xf6')],{'as':'List','foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x59')][_0x09c0('0x154')](db[_0x09c0('0x84')],{'as':_0x09c0('0x171'),'foreignKey':_0x09c0('0x188')});db['OpenchannelAccount'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':'Agents','through':_0x09c0('0x141')});db[_0x09c0('0x5b')][_0x09c0('0x154')](db['User'],{'onDelete':_0x09c0('0x17d')});db['OpenchannelApplication'][_0x09c0('0x154')](db[_0x09c0('0x134')],{'onDelete':'restrict','foreignKey':_0x09c0('0x18f')});db[_0x09c0('0x5b')][_0x09c0('0x154')](db[_0x09c0('0x59')],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x5b')][_0x09c0('0x154')](db[_0x09c0('0x157')],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x5b')][_0x09c0('0x154')](db['Tag'],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x17e')});db['OpenchannelInteraction'][_0x09c0('0x110')](db[_0x09c0('0x5f')],{'as':_0x09c0('0x160'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x190')});db[_0x09c0('0x5d')]['belongsTo'](db[_0x09c0('0x59')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x5d')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x5d')][_0x09c0('0x154')](db['User'],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x5d')][_0x09c0('0x121')](db['Tag'],{'through':_0x09c0('0x191'),'as':_0x09c0('0x176')});db[_0x09c0('0x5d')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0x09c0('0x177')});db['OpenchannelInteraction'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'through':_0x09c0('0x12d'),'foreignKey':'OpenchannelInteractionId'});db[_0x09c0('0x5f')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x12')});db[_0x09c0('0x5f')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x165')});db[_0x09c0('0x5f')][_0x09c0('0x154')](db[_0x09c0('0x5d')],{'onDelete':'cascade','as':_0x09c0('0x17a'),'foreignKey':_0x09c0('0x190')});db[_0x09c0('0x5f')][_0x09c0('0x154')](db[_0x09c0('0x178')],{'as':_0x09c0('0x178'),'foreignKey':'AttachmentId'});db[_0x09c0('0x5f')][_0x09c0('0x154')](db[_0x09c0('0x59')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x18e')});db[_0x09c0('0x134')][_0x09c0('0x121')](db['User'],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x35'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':_0x09c0('0x193'),'as':'Teams'});db[_0x09c0('0x138')]['hasMany'](db[_0x09c0('0x7f')],{'as':'Dispositions','foreignKey':_0x09c0('0x17b'),'onDelete':_0x09c0('0x10f')});db['ChatWebsite'][_0x09c0('0x110')](db[_0x09c0('0x7d')],{'as':'Answers','foreignKey':_0x09c0('0x17b')});db['ChatWebsite'][_0x09c0('0x110')](db[_0x09c0('0x6d')],{'as':_0x09c0('0x194')});db[_0x09c0('0x138')][_0x09c0('0x110')](db[_0x09c0('0x66')],{'as':_0x09c0('0x16d')});db[_0x09c0('0x138')][_0x09c0('0x110')](db[_0x09c0('0x195')],{'as':_0x09c0('0x14a')});db[_0x09c0('0x138')][_0x09c0('0x110')](db['ChatMessage'],{'as':_0x09c0('0x160')});db[_0x09c0('0x138')]['belongsTo'](db[_0x09c0('0xf6')],{'as':'List','foreignKey':'ListId'});db[_0x09c0('0x138')][_0x09c0('0x154')](db[_0x09c0('0x157')],{'as':_0x09c0('0x157'),'foreignKey':'IntervalId'});db[_0x09c0('0x138')][_0x09c0('0x154')](db['MailAccount'],{'as':_0x09c0('0x13d'),'foreignKey':_0x09c0('0x167')});db[_0x09c0('0x138')][_0x09c0('0x154')](db[_0x09c0('0x84')],{'as':_0x09c0('0x171'),'foreignKey':_0x09c0('0x188')});db[_0x09c0('0x138')]['belongsToMany'](db[_0x09c0('0x12')],{'as':'Agents','through':_0x09c0('0x13a')});db[_0x09c0('0x63')][_0x09c0('0x154')](db[_0x09c0('0x59')],{});db[_0x09c0('0x63')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db['OpenchannelQueueReport'][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x63')][_0x09c0('0x154')](db[_0x09c0('0x5d')],{});db[_0x09c0('0x63')][_0x09c0('0x154')](db[_0x09c0('0x5f')],{});db[_0x09c0('0x63')][_0x09c0('0x154')](db[_0x09c0('0x12')],{});db[_0x09c0('0x63')]['belongsTo'](db[_0x09c0('0x134')],{});db[_0x09c0('0x195')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x196'),'foreignKey':_0x09c0('0x112'),'onDelete':'restrict'});db[_0x09c0('0x195')][_0x09c0('0x154')](db['ChatQueue'],{'as':_0x09c0('0x197'),'foreignKey':_0x09c0('0x198'),'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x195')][_0x09c0('0x154')](db['ChatWebsite'],{'as':_0x09c0('0x199'),'foreignKey':_0x09c0('0x17b'),'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x195')]['belongsTo'](db['Tag'],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x17e')});db[_0x09c0('0x66')][_0x09c0('0x110')](db[_0x09c0('0x19a')],{'as':_0x09c0('0x160'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x19b')});db[_0x09c0('0x66')][_0x09c0('0x154')](db[_0x09c0('0x138')],{'as':'Account','foreignKey':_0x09c0('0x17b')});db[_0x09c0('0x66')][_0x09c0('0x154')](db['CmContact'],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x66')]['belongsTo'](db['User'],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x66')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':'chat_interaction_has_tags','as':_0x09c0('0x176')});db[_0x09c0('0x66')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':_0x09c0('0x19c'),'as':_0x09c0('0x177')});db[_0x09c0('0x66')]['belongsToMany'](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'through':_0x09c0('0x129'),'foreignKey':_0x09c0('0x19b')});db[_0x09c0('0x19a')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'onDelete':'cascade','as':'User'});db[_0x09c0('0x19a')]['belongsTo'](db[_0x09c0('0x71')],{'onDelete':'cascade','as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x19a')][_0x09c0('0x154')](db[_0x09c0('0x66')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x17a'),'foreignKey':_0x09c0('0x19b')});db[_0x09c0('0x19a')][_0x09c0('0x154')](db['Attachment'],{'as':_0x09c0('0x178'),'foreignKey':'AttachmentId'});db[_0x09c0('0x19a')][_0x09c0('0x154')](db[_0x09c0('0x138')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x17b')});db[_0x09c0('0x69')][_0x09c0('0x110')](db[_0x09c0('0x178')],{'as':'Attachments','foreignKey':_0x09c0('0x17c'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x69')]['belongsTo'](db[_0x09c0('0x71')],{'onDelete':_0x09c0('0x10f'),'as':'Contact','foreignKey':_0x09c0('0x166')});db[_0x09c0('0x69')][_0x09c0('0x154')](db[_0x09c0('0x138')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x17b')});db[_0x09c0('0x6a')][_0x09c0('0x121')](db['User'],{'as':'Agents','through':_0x09c0('0x2e'),'hooks':!![]});db[_0x09c0('0x6a')][_0x09c0('0x121')](db['Team'],{'through':_0x09c0('0x19d'),'as':'Teams'});db[_0x09c0('0x6c')]['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x09c0('0x19e'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x6c')]['belongsToMany'](db[_0x09c0('0x12')],{'as':_0x09c0('0x14e'),'through':_0x09c0('0x122')});db[_0x09c0('0x6d')][_0x09c0('0x154')](db[_0x09c0('0x138')],{'as':_0x09c0('0x199'),'foreignKey':'ChatWebsiteId'});db[_0x09c0('0x6f')][_0x09c0('0x110')](db[_0x09c0('0x71')],{'as':_0x09c0('0x123'),'foreignKey':_0x09c0('0x19f')});db[_0x09c0('0x71')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x09c0('0x71')]['hasMany'](db[_0x09c0('0x75')],{'as':_0x09c0('0x151'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x71')][_0x09c0('0x110')](db['CmHopperHistory'],{'as':_0x09c0('0x152'),'foreignKey':'ContactId'});db[_0x09c0('0x71')]['hasMany'](db[_0x09c0('0x116')],{'as':'ReportAgentPreview','foreignKey':_0x09c0('0x166')});db['CmContact'][_0x09c0('0x110')](db[_0x09c0('0xd6')],{'as':'JscriptySessions','foreignKey':_0x09c0('0x166')});db[_0x09c0('0x71')][_0x09c0('0x110')](db[_0x09c0('0x5d')],{'as':_0x09c0('0x117'),'foreignKey':'ContactId','onDelete':_0x09c0('0x17d')});db[_0x09c0('0x71')][_0x09c0('0x110')](db[_0x09c0('0x66')],{'as':_0x09c0('0x118'),'foreignKey':'ContactId','onDelete':_0x09c0('0x17d')});db[_0x09c0('0x71')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x09c0('0x17d')});db['CmContact'][_0x09c0('0x110')](db[_0x09c0('0x11a')],{'as':_0x09c0('0x12a'),'foreignKey':_0x09c0('0x166'),'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x71')][_0x09c0('0x110')](db[_0x09c0('0x11b')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x09c0('0x71')][_0x09c0('0x154')](db[_0x09c0('0x6f')],{'as':_0x09c0('0x1a0'),'foreignKey':_0x09c0('0x19f')});db[_0x09c0('0x71')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x71')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'through':_0x09c0('0x124')});db[_0x09c0('0x71')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'as':'Tags','through':_0x09c0('0x1a1')});db[_0x09c0('0x71')][_0x09c0('0x121')](db['Tag'],{'through':_0x09c0('0x1a1'),'as':_0x09c0('0x177')});db[_0x09c0('0x72')]['belongsTo'](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x09c0('0x72')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x72')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x196'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x72')]['belongsTo'](db['VoiceQueue'],{'as':_0x09c0('0x197'),'foreignKey':_0x09c0('0x14f'),'onDelete':'cascade'});db[_0x09c0('0x72')][_0x09c0('0x154')](db[_0x09c0('0x1a2')],{'as':_0x09c0('0x1a2'),'foreignKey':_0x09c0('0x1a3'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x72')][_0x09c0('0x154')](db['User'],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x1a4')});db[_0x09c0('0x153')]['belongsTo'](db[_0x09c0('0x71')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x09c0('0x10f')});db['CmHopperBlack'][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f'),'onDelete':'cascade'});db[_0x09c0('0x153')][_0x09c0('0x154')](db['VoiceQueue'],{'as':_0x09c0('0x197'),'foreignKey':_0x09c0('0x14f'),'onDelete':_0x09c0('0x10f')});db['CmHopperBlack']['belongsTo'](db[_0x09c0('0x1a2')],{'as':'Campaign','foreignKey':_0x09c0('0x1a3'),'onDelete':_0x09c0('0x10f')});db['Automation'][_0x09c0('0x110')](db['Condition'],{'as':{'plural':_0x09c0('0x1a5'),'singular':_0x09c0('0x1a6')},'foreignKey':'AutomationAllId','onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x7b')][_0x09c0('0x110')](db[_0x09c0('0x81')],{'as':{'plural':_0x09c0('0x1a7'),'singular':_0x09c0('0x1a8')},'foreignKey':_0x09c0('0x1a9'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x7b')]['hasMany'](db[_0x09c0('0x1aa')],{'as':'Actions','foreignKey':_0x09c0('0x1ab'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x7f')]['hasMany'](db['Disposition'],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x1ac'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x157')][_0x09c0('0x110')](db[_0x09c0('0x157')],{'as':'Intervals','foreignKey':_0x09c0('0x158'),'onDelete':_0x09c0('0x10f'),'hooks':!![],'required':![]});db[_0x09c0('0x157')][_0x09c0('0x110')](db['VoiceExtension'],{'as':_0x09c0('0x115'),'foreignKey':_0x09c0('0x158'),'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x157')][_0x09c0('0x110')](db['MailApplication'],{'as':_0x09c0('0x1ad'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x157')][_0x09c0('0x110')](db[_0x09c0('0x195')],{'as':_0x09c0('0x1ae'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x157')][_0x09c0('0x110')](db[_0x09c0('0x181')],{'as':_0x09c0('0x1af'),'foreignKey':'IntervalId'});db['Interval'][_0x09c0('0x110')](db['SmsApplication'],{'as':_0x09c0('0x1b0'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x89')]['belongsTo'](db[_0x09c0('0x13d')],{});db[_0x09c0('0x89')][_0x09c0('0x154')](db[_0x09c0('0x96')],{'foreignKey':'DefaultReportId'});db[_0x09c0('0x89')][_0x09c0('0x154')](db[_0x09c0('0x94')],{'foreignKey':'CustomReportId'});db[_0x09c0('0x14b')]['belongsToMany'](db[_0x09c0('0x18')],{'as':_0x09c0('0x1b1'),'through':_0x09c0('0x14d'),'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x8c')][_0x09c0('0x121')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x09c0('0x8c')][_0x09c0('0x121')](db[_0x09c0('0x66')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x09c0('0x121')](db[_0x09c0('0x11b')],{'through':_0x09c0('0x175')});db[_0x09c0('0x8c')][_0x09c0('0x121')](db[_0x09c0('0x53')],{'through':'sms_interaction_has_tags'});db[_0x09c0('0x8c')][_0x09c0('0x121')](db[_0x09c0('0x11a')],{'through':'fax_interaction_has_tags'});db[_0x09c0('0x8c')][_0x09c0('0x121')](db[_0x09c0('0x5d')],{'through':_0x09c0('0x191')});db[_0x09c0('0x8c')]['belongsToMany'](db[_0x09c0('0x102')],{'through':_0x09c0('0x1b2')});db[_0x09c0('0x8e')][_0x09c0('0x110')](db['Condition'],{'as':{'plural':_0x09c0('0x1b3'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x09c0('0x10f'),'hooks':!![]});db['Trigger'][_0x09c0('0x110')](db['Condition'],{'as':{'plural':_0x09c0('0x1b4'),'singular':_0x09c0('0x1b5')},'foreignKey':_0x09c0('0x1b6'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x8e')][_0x09c0('0x110')](db[_0x09c0('0x1aa')],{'as':_0x09c0('0x1b7'),'foreignKey':_0x09c0('0x1b8'),'onDelete':_0x09c0('0x10f'),'hooks':!![]});db[_0x09c0('0x94')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1ba'),'hooks':!![]});db[_0x09c0('0x96')][_0x09c0('0x110')](db[_0x09c0('0x9b')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1bb')});db[_0x09c0('0x99')]['hasMany'](db[_0x09c0('0x9b')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1bc')});db['AnalyticFieldReport']['belongsTo'](db[_0x09c0('0x99')],{'foreignKey':'MetricId'});db[_0x09c0('0x9e')][_0x09c0('0x110')](db[_0x09c0('0x9f')],{'as':_0x09c0('0x1bd'),'onDelete':'cascade','foreignKey':_0x09c0('0x1be')});db[_0x09c0('0x9f')][_0x09c0('0x110')](db[_0x09c0('0xa1')],{'as':_0x09c0('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x09c0('0x9f')][_0x09c0('0x110')](db[_0x09c0('0xa1')],{'as':_0x09c0('0x1c0'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c1')});db['SalesforceConfiguration'][_0x09c0('0x110')](db[_0x09c0('0xa1')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c2')});db['SalesforceConfiguration'][_0x09c0('0x154')](db[_0x09c0('0x9e')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0xa1')]['hasMany'](db[_0x09c0('0xa1')],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xa1')][_0x09c0('0x110')](db['SalesforceField'],{'as':_0x09c0('0x1c5'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xa1')]['hasMany'](db[_0x09c0('0xa1')],{'as':_0x09c0('0x1c6'),'foreignKey':'FieldId'});db[_0x09c0('0xa1')][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':'Variable','foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xa3')][_0x09c0('0x110')](db[_0x09c0('0xa5')],{'as':_0x09c0('0x1bd'),'onDelete':_0x09c0('0x10f'),'foreignKey':'AccountId'});db[_0x09c0('0xa5')]['hasMany'](db[_0x09c0('0xa7')],{'as':_0x09c0('0x1bf'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xa5')][_0x09c0('0x110')](db[_0x09c0('0xa7')],{'as':_0x09c0('0x1c0'),'onDelete':_0x09c0('0x10f'),'foreignKey':'DescriptionId'});db[_0x09c0('0xa5')]['hasMany'](db[_0x09c0('0xa7')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xa5')][_0x09c0('0x154')](db[_0x09c0('0xa3')],{'as':_0x09c0('0x173'),'foreignKey':'AccountId'});db[_0x09c0('0xa7')][_0x09c0('0x110')](db['SugarcrmField'],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xa7')][_0x09c0('0x110')](db[_0x09c0('0xa7')],{'as':_0x09c0('0x1c5'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x09c0('0x110')](db[_0x09c0('0xa7')],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xa7')][_0x09c0('0x154')](db['Variable'],{'as':_0x09c0('0x1c7'),'foreignKey':_0x09c0('0x1c8')});db['DeskAccount']['hasMany'](db[_0x09c0('0xaa')],{'as':_0x09c0('0x1bd'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0xaa')][_0x09c0('0x110')](db[_0x09c0('0x1c9')],{'as':_0x09c0('0x1bf'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xaa')][_0x09c0('0x110')](db['DeskField'],{'as':_0x09c0('0x1c0'),'onDelete':_0x09c0('0x10f'),'foreignKey':'DescriptionId'});db[_0x09c0('0xaa')]['hasMany'](db[_0x09c0('0x1c9')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c2')});db['DeskConfiguration'][_0x09c0('0x154')](db[_0x09c0('0xa9')],{'as':_0x09c0('0x173'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':'int_desk_configuration_has_tags'});db[_0x09c0('0x1c9')][_0x09c0('0x110')](db['DeskField'],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0x1c9')][_0x09c0('0x110')](db[_0x09c0('0x1c9')],{'as':_0x09c0('0x1c5'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0x1c9')]['hasMany'](db[_0x09c0('0x1c9')],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db['DeskField'][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':'Variable','foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xac')][_0x09c0('0x110')](db[_0x09c0('0xad')],{'as':'Configurations','onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1be')});db['ZohoConfiguration']['hasMany'](db[_0x09c0('0xae')],{'as':_0x09c0('0x1bf'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xad')][_0x09c0('0x110')](db[_0x09c0('0xae')],{'as':_0x09c0('0x1c0'),'onDelete':'cascade','foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xad')][_0x09c0('0x110')](db[_0x09c0('0xae')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xad')][_0x09c0('0x154')](db[_0x09c0('0xac')],{'as':'Account','foreignKey':_0x09c0('0x1be')});db['ZohoField'][_0x09c0('0x110')](db['ZohoField'],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db['ZohoField'][_0x09c0('0x110')](db[_0x09c0('0xae')],{'as':_0x09c0('0x1c5'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xae')]['hasMany'](db[_0x09c0('0xae')],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db['ZohoField'][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':'Variable','foreignKey':_0x09c0('0x1c8')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x09c0('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x09c0('0x110')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xb2')][_0x09c0('0x110')](db[_0x09c0('0x1ca')],{'as':_0x09c0('0x1c0'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0x09c0('0x1b9'),'foreignKey':_0x09c0('0x1c2')});db['ZendeskConfiguration']['belongsTo'](db[_0x09c0('0xb0')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0xb2')][_0x09c0('0x121')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x09c0('0x110')](db[_0x09c0('0x1ca')],{'as':_0x09c0('0x1c3'),'foreignKey':'SubjectId'});db[_0x09c0('0x1ca')][_0x09c0('0x110')](db[_0x09c0('0x1ca')],{'as':_0x09c0('0x1c5'),'foreignKey':'DescriptionId'});db[_0x09c0('0x1ca')][_0x09c0('0x110')](db[_0x09c0('0x1ca')],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0x1ca')][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':_0x09c0('0x1c7'),'foreignKey':_0x09c0('0x1c8')});db['FreshdeskAccount'][_0x09c0('0x110')](db[_0x09c0('0x1cb')],{'as':_0x09c0('0x1bd'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0x1cb')][_0x09c0('0x110')](db[_0x09c0('0xb8')],{'as':_0x09c0('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x09c0('0x1cb')][_0x09c0('0x110')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0x1cb')]['hasMany'](db[_0x09c0('0xb8')],{'as':_0x09c0('0x1b9'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0x1cb')]['belongsTo'](db[_0x09c0('0xb5')],{'as':_0x09c0('0x173'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0x1cb')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x09c0('0xb8')][_0x09c0('0x110')](db[_0x09c0('0xb8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x09c0('0xb8')][_0x09c0('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x09c0('0xb8')][_0x09c0('0x110')](db['FreshdeskField'],{'as':_0x09c0('0x1c6'),'foreignKey':'FieldId'});db[_0x09c0('0xb8')][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':_0x09c0('0x1c7'),'foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xba')][_0x09c0('0x110')](db[_0x09c0('0x1cc')],{'as':'Configurations','onDelete':_0x09c0('0x10f'),'foreignKey':'AccountId'});db[_0x09c0('0x1cc')][_0x09c0('0x110')](db[_0x09c0('0xbc')],{'as':_0x09c0('0x1bf'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0x1cc')][_0x09c0('0x110')](db[_0x09c0('0xbc')],{'as':_0x09c0('0x1c0'),'foreignKey':'DescriptionId'});db[_0x09c0('0x1cc')][_0x09c0('0x110')](db[_0x09c0('0xbc')],{'as':_0x09c0('0x1b9'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0x1cc')]['belongsTo'](db[_0x09c0('0xba')],{'as':'Account','foreignKey':_0x09c0('0x1be')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xbc')][_0x09c0('0x110')](db['VtigerField'],{'as':_0x09c0('0x1c5'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xbc')][_0x09c0('0x110')](db['VtigerField'],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xbc')][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':_0x09c0('0x1c7'),'foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xbe')]['hasMany'](db[_0x09c0('0xc0')],{'as':_0x09c0('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x09c0('0xc0')][_0x09c0('0x110')](db[_0x09c0('0xc2')],{'as':_0x09c0('0x1bf'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x09c0('0x110')](db[_0x09c0('0xc2')],{'as':_0x09c0('0x1c0'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xc0')][_0x09c0('0x110')](db[_0x09c0('0xc2')],{'as':_0x09c0('0x1b9'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xc0')][_0x09c0('0x154')](db[_0x09c0('0xbe')],{'as':_0x09c0('0x173'),'foreignKey':'AccountId'});db[_0x09c0('0xc2')][_0x09c0('0x110')](db['ServicenowField'],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xc2')][_0x09c0('0x110')](db[_0x09c0('0xc2')],{'as':_0x09c0('0x1c5'),'foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xc2')][_0x09c0('0x110')](db[_0x09c0('0xc2')],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField'][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':'Variable','foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xc4')][_0x09c0('0x110')](db[_0x09c0('0xc6')],{'as':_0x09c0('0x1bd'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1be')});db[_0x09c0('0xc6')][_0x09c0('0x110')](db[_0x09c0('0xc8')],{'as':_0x09c0('0x1bf'),'onDelete':'cascade','foreignKey':_0x09c0('0x1c4')});db['Dynamics365Configuration'][_0x09c0('0x110')](db['Dynamics365Field'],{'as':_0x09c0('0x1c0'),'onDelete':'cascade','foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xc6')][_0x09c0('0x110')](db['Dynamics365Field'],{'as':_0x09c0('0x1b9'),'onDelete':'cascade','foreignKey':_0x09c0('0x1c2')});db['Dynamics365Configuration']['belongsTo'](db[_0x09c0('0xc4')],{'as':_0x09c0('0x173'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x09c0('0x110')](db[_0x09c0('0xc8')],{'as':_0x09c0('0x1c3'),'foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xc8')][_0x09c0('0x110')](db[_0x09c0('0xc8')],{'as':'Description','foreignKey':_0x09c0('0x1c1')});db[_0x09c0('0xc8')][_0x09c0('0x110')](db['Dynamics365Field'],{'as':_0x09c0('0x1c6'),'foreignKey':'FieldId'});db[_0x09c0('0xc8')]['belongsTo'](db[_0x09c0('0x1c7')],{'as':'Variable','foreignKey':_0x09c0('0x1c8')});db[_0x09c0('0xca')][_0x09c0('0x110')](db[_0x09c0('0xcc')],{'as':'Configurations','onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1be')});db['FreshsalesConfiguration'][_0x09c0('0x110')](db[_0x09c0('0xce')],{'as':'Subjects','foreignKey':_0x09c0('0x1c4')});db[_0x09c0('0xcc')][_0x09c0('0x110')](db[_0x09c0('0xce')],{'as':_0x09c0('0x1c0'),'foreignKey':'DescriptionId'});db[_0x09c0('0xcc')][_0x09c0('0x110')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xcc')][_0x09c0('0x154')](db[_0x09c0('0xca')],{'as':_0x09c0('0x173'),'foreignKey':'AccountId'});db[_0x09c0('0xce')][_0x09c0('0x110')](db[_0x09c0('0xce')],{'as':_0x09c0('0x1c3'),'foreignKey':'SubjectId'});db[_0x09c0('0xce')][_0x09c0('0x110')](db['FreshsalesField'],{'as':_0x09c0('0x1c5'),'foreignKey':'DescriptionId'});db[_0x09c0('0xce')][_0x09c0('0x110')](db[_0x09c0('0xce')],{'as':_0x09c0('0x1c6'),'foreignKey':_0x09c0('0x1c2')});db[_0x09c0('0xce')][_0x09c0('0x154')](db[_0x09c0('0x1c7')],{'as':_0x09c0('0x1c7'),'foreignKey':_0x09c0('0x1c8')});db['ChatQueueReport']['belongsTo'](db[_0x09c0('0x138')],{});db[_0x09c0('0x1cd')]['belongsTo'](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db['ChatQueueReport']['belongsTo'](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x1cd')][_0x09c0('0x154')](db['ChatInteraction'],{});db[_0x09c0('0x1cd')][_0x09c0('0x154')](db[_0x09c0('0x19a')],{});db[_0x09c0('0x1cd')][_0x09c0('0x154')](db[_0x09c0('0x12')],{});db[_0x09c0('0x1cd')]['belongsTo'](db[_0x09c0('0x6a')],{});db[_0x09c0('0x1ce')][_0x09c0('0x154')](db['User'],{'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1cf')});db[_0x09c0('0x1ce')]['belongsTo'](db['User'],{'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1d0')});db[_0x09c0('0xd6')][_0x09c0('0x110')](db[_0x09c0('0x1d1')],{'foreignKey':'SessionId','onDelete':_0x09c0('0x10f')});db[_0x09c0('0xd6')][_0x09c0('0x110')](db[_0x09c0('0xd3')],{'foreignKey':_0x09c0('0x1d2'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0x51')],{});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0x53')],{});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0x55')],{});db[_0x09c0('0xd8')][_0x09c0('0x154')](db['User'],{});db[_0x09c0('0xd8')][_0x09c0('0x154')](db[_0x09c0('0x57')],{});db[_0x09c0('0xdd')][_0x09c0('0x110')](db[_0x09c0('0xd6')],{'foreignKey':_0x09c0('0x1d3')});db[_0x09c0('0xdd')][_0x09c0('0x110')](db[_0x09c0('0x1d1')],{'foreignKey':_0x09c0('0x1d3')});db[_0x09c0('0xdd')][_0x09c0('0x110')](db[_0x09c0('0xd3')],{'foreignKey':_0x09c0('0x1d3')});db['SquareProject']['belongsToMany'](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'through':'user_has_square_projects'});db['Team'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x126')});db[_0x09c0('0xe5')]['belongsToMany'](db[_0x09c0('0x1a')],{'through':'TeamVoiceQueue','as':_0x09c0('0x1d4')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db[_0x09c0('0x3d')],{'through':_0x09c0('0x1d5'),'as':_0x09c0('0x130')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db['ChatQueue'],{'through':_0x09c0('0x19d'),'as':_0x09c0('0x131')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x09c0('0xe5')]['belongsToMany'](db[_0x09c0('0x57')],{'through':_0x09c0('0x18d'),'as':_0x09c0('0x132')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db[_0x09c0('0x134')],{'through':_0x09c0('0x193'),'as':_0x09c0('0x135')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db[_0x09c0('0x136')],{'through':_0x09c0('0x1d6'),'as':_0x09c0('0x137')});db[_0x09c0('0xe5')][_0x09c0('0x121')](db[_0x09c0('0xf8')],{'through':_0x09c0('0x1d7'),'as':'VoicePrefixes'});db[_0x09c0('0x1a2')][_0x09c0('0x110')](db[_0x09c0('0x72')],{'as':_0x09c0('0x150'),'foreignKey':'CampaignId'});db['Campaign'][_0x09c0('0x110')](db[_0x09c0('0x75')],{'as':_0x09c0('0x151'),'foreignKey':_0x09c0('0x1a3')});db[_0x09c0('0x1a2')][_0x09c0('0x110')](db[_0x09c0('0x76')],{'as':'HopperHistories','foreignKey':_0x09c0('0x1a3')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x09c0('0x1a3')});db[_0x09c0('0x1a2')][_0x09c0('0x154')](db['Trunk'],{'as':_0x09c0('0x29'),'foreignKey':_0x09c0('0x1d8')});db[_0x09c0('0x1a2')][_0x09c0('0x154')](db[_0x09c0('0x29')],{'as':'TrunkBackup','foreignKey':_0x09c0('0x156')});db['Campaign'][_0x09c0('0x154')](db[_0x09c0('0x157')],{'as':_0x09c0('0x157'),'foreignKey':_0x09c0('0x158')});db['Campaign'][_0x09c0('0x154')](db[_0x09c0('0xe2')],{'as':_0x09c0('0xe2'),'foreignKey':_0x09c0('0x1d9')});db[_0x09c0('0x1a2')][_0x09c0('0x121')](db[_0x09c0('0xf6')],{'as':'Lists','through':_0x09c0('0x1da')});db['Campaign'][_0x09c0('0x121')](db[_0x09c0('0xf6')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x09c0('0x178')][_0x09c0('0x154')](db[_0x09c0('0x69')],{'as':_0x09c0('0x69'),'foreignKey':_0x09c0('0x17c')});db[_0x09c0('0x1db')][_0x09c0('0x154')](db[_0x09c0('0x16c')],{});db[_0x09c0('0x1db')][_0x09c0('0x154')](db[_0x09c0('0x11b')],{});db[_0x09c0('0x1db')][_0x09c0('0x154')](db['MailAccount'],{'foreignKey':_0x09c0('0x1dc'),'as':_0x09c0('0x1dd')});db[_0x09c0('0x1db')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':'FromUserId','as':_0x09c0('0x1de')});db[_0x09c0('0x1db')][_0x09c0('0x154')](db['User'],{'foreignKey':_0x09c0('0x1df'),'as':_0x09c0('0x1e0')});db[_0x09c0('0x1db')][_0x09c0('0x154')](db[_0x09c0('0x3d')],{'foreignKey':_0x09c0('0x1e1'),'as':_0x09c0('0x1e2')});db[_0x09c0('0x1db')][_0x09c0('0x154')](db[_0x09c0('0x13d')],{'foreignKey':_0x09c0('0x1e3'),'as':_0x09c0('0x1e4')});db[_0x09c0('0xef')][_0x09c0('0x154')](db['ChatMessage'],{});db[_0x09c0('0xef')]['belongsTo'](db[_0x09c0('0x66')],{});db[_0x09c0('0xef')]['belongsTo'](db[_0x09c0('0x138')],{'foreignKey':'FromChatWebsiteId','as':_0x09c0('0x1dd')});db[_0x09c0('0xef')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1e5'),'as':_0x09c0('0x1de')});db[_0x09c0('0xef')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1df'),'as':_0x09c0('0x1e0')});db[_0x09c0('0xef')][_0x09c0('0x154')](db[_0x09c0('0x6a')],{'foreignKey':_0x09c0('0x1e6'),'as':_0x09c0('0x1e2')});db[_0x09c0('0xef')]['belongsTo'](db[_0x09c0('0x138')],{'foreignKey':_0x09c0('0x1e7'),'as':_0x09c0('0x1e4')});db[_0x09c0('0xf1')]['belongsTo'](db[_0x09c0('0x4d')],{});db['FaxTransferReport']['belongsTo'](db[_0x09c0('0x11a')],{});db[_0x09c0('0xf1')][_0x09c0('0x154')](db[_0x09c0('0x4a')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x09c0('0xf1')]['belongsTo'](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1e5'),'as':_0x09c0('0x1de')});db['FaxTransferReport'][_0x09c0('0x154')](db['User'],{'foreignKey':_0x09c0('0x1df'),'as':'ToAgent'});db[_0x09c0('0xf1')][_0x09c0('0x154')](db[_0x09c0('0x4f')],{'foreignKey':_0x09c0('0x1e8'),'as':_0x09c0('0x1e2')});db['FaxTransferReport']['belongsTo'](db[_0x09c0('0x4a')],{'foreignKey':_0x09c0('0x1e9'),'as':_0x09c0('0x1e4')});db['OpenchannelTransferReport']['belongsTo'](db[_0x09c0('0x5f')],{});db[_0x09c0('0xf3')][_0x09c0('0x154')](db['OpenchannelInteraction'],{});db[_0x09c0('0xf3')][_0x09c0('0x154')](db[_0x09c0('0x59')],{'foreignKey':_0x09c0('0x1ea'),'as':_0x09c0('0x1dd')});db[_0x09c0('0xf3')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1e5'),'as':_0x09c0('0x1de')});db[_0x09c0('0xf3')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1df'),'as':'ToAgent'});db[_0x09c0('0xf3')][_0x09c0('0x154')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x09c0('0x1e2')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x09c0('0x1e4')});db[_0x09c0('0x1eb')][_0x09c0('0x154')](db[_0x09c0('0x55')],{});db[_0x09c0('0x1eb')][_0x09c0('0x154')](db[_0x09c0('0x53')],{});db[_0x09c0('0x1eb')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x09c0('0x1ec'),'as':_0x09c0('0x1dd')});db['SmsTransferReport'][_0x09c0('0x154')](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1e5'),'as':_0x09c0('0x1de')});db[_0x09c0('0x1eb')][_0x09c0('0x154')](db['User'],{'foreignKey':_0x09c0('0x1df'),'as':_0x09c0('0x1e0')});db[_0x09c0('0x1eb')][_0x09c0('0x154')](db[_0x09c0('0x57')],{'foreignKey':_0x09c0('0x1ed'),'as':_0x09c0('0x1e2')});db['SmsTransferReport'][_0x09c0('0x154')](db[_0x09c0('0x51')],{'foreignKey':_0x09c0('0x1ee'),'as':'ToAccount'});db['CmList'][_0x09c0('0x110')](db[_0x09c0('0x7f')],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x16f'),'onDelete':_0x09c0('0x10f')});db['CmList'][_0x09c0('0x110')](db[_0x09c0('0x78')],{'as':_0x09c0('0x1ef'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xf6')][_0x09c0('0x110')](db[_0x09c0('0x71')],{'as':_0x09c0('0x123'),'onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xf6')]['hasMany'](db[_0x09c0('0x75')],{'as':_0x09c0('0x151'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xf6')][_0x09c0('0x110')](db[_0x09c0('0x76')],{'as':_0x09c0('0x1f0'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xf6')]['hasMany'](db[_0x09c0('0x116')],{'as':_0x09c0('0x116'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0xf6')][_0x09c0('0x121')](db[_0x09c0('0x1a')],{'as':_0x09c0('0x1f1'),'through':_0x09c0('0x15a')});db[_0x09c0('0xf6')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x125')});db[_0x09c0('0xf8')][_0x09c0('0x110')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x09c0('0x10f')});db[_0x09c0('0xf8')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x10d')});db['VoicePrefix'][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':'TeamVoicePrefix','as':_0x09c0('0x15c')});db[_0x09c0('0x11f')][_0x09c0('0x110')](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'foreignKey':'userProfileId'});db[_0x09c0('0x11f')][_0x09c0('0x110')](db[_0x09c0('0xfb')],{'as':_0x09c0('0x1f2'),'foreignKey':'userProfileId','onDelete':_0x09c0('0x10f')});db['UserProfileSection'][_0x09c0('0x110')](db[_0x09c0('0xfd')],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db[_0x09c0('0x144')][_0x09c0('0x110')](db[_0x09c0('0x7f')],{'as':_0x09c0('0x16a'),'foreignKey':_0x09c0('0x1f3'),'onDelete':_0x09c0('0x10f')});db[_0x09c0('0x144')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x09c0('0x1f3')});db[_0x09c0('0x144')][_0x09c0('0x110')](db[_0x09c0('0x104')],{'as':'Messages','foreignKey':_0x09c0('0x1f3')});db[_0x09c0('0x144')][_0x09c0('0x110')](db[_0x09c0('0x102')],{'as':_0x09c0('0x16d')});db['WhatsappAccount'][_0x09c0('0x110')](db[_0x09c0('0x100')],{'as':_0x09c0('0x14a')});db['WhatsappAccount'][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':_0x09c0('0x16f')});db[_0x09c0('0x144')][_0x09c0('0x154')](db['Pause'],{'as':_0x09c0('0x171'),'foreignKey':_0x09c0('0x188')});db['WhatsappAccount'][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':'user_has_whatsapp_accounts'});db[_0x09c0('0x100')][_0x09c0('0x154')](db[_0x09c0('0x12')],{'onDelete':'restrict'});db[_0x09c0('0x100')]['belongsTo'](db[_0x09c0('0x136')],{'onDelete':_0x09c0('0x17d')});db[_0x09c0('0x100')][_0x09c0('0x154')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x09c0('0x100')][_0x09c0('0x154')](db[_0x09c0('0x157')],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x158')});db[_0x09c0('0x100')][_0x09c0('0x154')](db['Tag'],{'onDelete':_0x09c0('0x17d'),'foreignKey':_0x09c0('0x17e')});db['WhatsappInteraction'][_0x09c0('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x09c0('0x10f'),'foreignKey':_0x09c0('0x1f4')});db['WhatsappInteraction']['belongsTo'](db[_0x09c0('0x144')],{'as':'Account','foreignKey':_0x09c0('0x1f3')});db[_0x09c0('0x102')]['belongsTo'](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db['WhatsappInteraction'][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x174'),'foreignKey':_0x09c0('0x112')});db[_0x09c0('0x102')]['belongsToMany'](db['Tag'],{'through':_0x09c0('0x1b2'),'as':'Tags'});db[_0x09c0('0x102')][_0x09c0('0x121')](db[_0x09c0('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x09c0('0x177')});db[_0x09c0('0x102')][_0x09c0('0x121')](db[_0x09c0('0x12')],{'as':_0x09c0('0x192'),'through':_0x09c0('0x12e'),'foreignKey':_0x09c0('0x1f4')});db['WhatsappMessage'][_0x09c0('0x154')](db[_0x09c0('0x12')],{'as':_0x09c0('0x12')});db['WhatsappMessage']['belongsTo'](db[_0x09c0('0x71')],{'onDelete':_0x09c0('0x10f'),'as':_0x09c0('0x165')});db['WhatsappMessage'][_0x09c0('0x154')](db[_0x09c0('0x102')],{'onDelete':'cascade','as':_0x09c0('0x17a'),'foreignKey':_0x09c0('0x1f4')});db['WhatsappMessage'][_0x09c0('0x154')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x09c0('0x1f3')});db['WhatsappQueueReport'][_0x09c0('0x154')](db[_0x09c0('0x144')],{});db[_0x09c0('0x105')][_0x09c0('0x154')](db[_0x09c0('0xf6')],{'as':_0x09c0('0x16e'),'foreignKey':'ListId'});db[_0x09c0('0x105')]['belongsTo'](db[_0x09c0('0x71')],{'as':_0x09c0('0x165'),'foreignKey':_0x09c0('0x166')});db[_0x09c0('0x105')][_0x09c0('0x154')](db['WhatsappInteraction'],{});db[_0x09c0('0x105')]['belongsTo'](db[_0x09c0('0x136')],{});db[_0x09c0('0x105')]['belongsTo'](db[_0x09c0('0x104')],{});db[_0x09c0('0x105')][_0x09c0('0x154')](db[_0x09c0('0x12')],{});db[_0x09c0('0x107')][_0x09c0('0x154')](db['WhatsappMessage'],{});db[_0x09c0('0x107')][_0x09c0('0x154')](db[_0x09c0('0x102')],{});db[_0x09c0('0x107')]['belongsTo'](db[_0x09c0('0x144')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x09c0('0x107')][_0x09c0('0x154')](db[_0x09c0('0x144')],{'foreignKey':_0x09c0('0x1f5'),'as':_0x09c0('0x1e4')});db[_0x09c0('0x107')][_0x09c0('0x154')](db[_0x09c0('0x136')],{'foreignKey':'ToQueueId','as':_0x09c0('0x1e2')});db['WhatsappTransferReport']['belongsTo'](db[_0x09c0('0x12')],{'foreignKey':_0x09c0('0x1e5'),'as':_0x09c0('0x1de')});db[_0x09c0('0x107')][_0x09c0('0x154')](db['User'],{'foreignKey':_0x09c0('0x1df'),'as':'ToAgent'});db[_0x09c0('0x136')]['belongsToMany'](db[_0x09c0('0x12')],{'as':_0x09c0('0x15b'),'through':_0x09c0('0x37'),'foreignKey':_0x09c0('0x1f6')});db['WhatsappQueue'][_0x09c0('0x121')](db[_0x09c0('0xe5')],{'through':_0x09c0('0x1d6'),'as':_0x09c0('0x15c')});module[_0x09c0('0x1f7')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6e6c=['OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','MailApplication','List','Template','TemplateId','MailInteractionId','Account','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','Owner','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','Answers','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','CmCompany','CompanyId','JscriptySessions','Company','cm_contact_has_tags','Campaign','OwnerId','CmHopperBlack','CampaignId','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','Extensions','FaxApplications','SmsApplications','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmConfiguration','Configurations','DeskField','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','Description','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','FreshsalesField','FromId','SessionId','JscriptyAnswerReport','ProjectId','TeamVoiceQueue','team_has_mail_queues','team_has_chat_queues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','Queues','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','xcall','127.0.0.1','mysql','name','utf8','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','utf8mb4','utf8_general_ci','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','import','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../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','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueue','SmsQueues'];(function(_0x183a44,_0x4fd341){var _0x45d226=function(_0x32c204){while(--_0x32c204){_0x183a44['push'](_0x183a44['shift']());}};_0x45d226(++_0x4fd341);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0xc6e6('0x0'));var Sequelize=require(_0xc6e6('0x1'));var _=require('lodash');var jstz=require(_0xc6e6('0x2'));var timezone=jstz[_0xc6e6('0x3')]();config['sequelize']=_['defaultsDeep'](config[_0xc6e6('0x1')],{'database':'motion2','username':_0xc6e6('0x4'),'password':'xC@LL1234','options':{'host':_0xc6e6('0x5'),'port':0xcea,'dialect':_0xc6e6('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc6e6('0x7')](),'define':{'charset':_0xc6e6('0x8'),'collate':'utf8_general_ci'}}});config[_0xc6e6('0x9')]=_[_0xc6e6('0xa')](config['sequelizeHistory'],{'database':_0xc6e6('0xb'),'username':'xcall','password':_0xc6e6('0xc'),'options':{'host':_0xc6e6('0x5'),'port':0xcea,'dialect':_0xc6e6('0x6'),'dialectOptions':{'charset':_0xc6e6('0xd')},'logging':![],'timezone':timezone[_0xc6e6('0x7')](),'define':{'charset':_0xc6e6('0x8'),'collate':_0xc6e6('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc6e6('0x1')][_0xc6e6('0xf')],config['sequelize'][_0xc6e6('0x10')],config['sequelize'][_0xc6e6('0x11')],config[_0xc6e6('0x1')][_0xc6e6('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc6e6('0x9')]['database'],config[_0xc6e6('0x9')][_0xc6e6('0x10')],config[_0xc6e6('0x9')][_0xc6e6('0x11')],config[_0xc6e6('0x9')]['options'])};db[_0xc6e6('0x13')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x14'));db[_0xc6e6('0x15')]=db[_0xc6e6('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x16'));db[_0xc6e6('0x17')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x19'));db[_0xc6e6('0x1a')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x1b'));db[_0xc6e6('0x1c')]=db['sequelize'][_0xc6e6('0x18')]('../api/voiceQueue/voiceQueue.model');db[_0xc6e6('0x1d')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x1e'));db['ScreenRecording']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x1f'));db[_0xc6e6('0x20')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x21'));db['VoiceMailMessage']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x22'));db[_0xc6e6('0x23')]=db['sequelize'][_0xc6e6('0x18')]('../api/voiceCallReport/voiceCallReport.model');db[_0xc6e6('0x24')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x25'));db[_0xc6e6('0x26')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xc6e6('0x27')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x28'));db['MemberReport']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x29'));db[_0xc6e6('0x2a')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x2b'));db[_0xc6e6('0x2c')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x2d'));db[_0xc6e6('0x2e')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x2f'));db[_0xc6e6('0x30')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x31'));db['UserChatQueue']=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x32'));db[_0xc6e6('0x33')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/userFaxQueue/userFaxQueue.model');db[_0xc6e6('0x34')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x35'));db[_0xc6e6('0x36')]=db['sequelize']['import'](_0xc6e6('0x37'));db['MailServerIn']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x38'));db[_0xc6e6('0x39')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x3a'));db[_0xc6e6('0x3b')]=db['sequelize']['import'](_0xc6e6('0x3c'));db[_0xc6e6('0x3d')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/mailSubstatus/mailSubstatus.model');db[_0xc6e6('0x3e')]=db[_0xc6e6('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xc6e6('0x3f')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x40'));db['MailApplication']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x41'));db['MailQueueReport']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x42'));db[_0xc6e6('0x43')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x44'));db[_0xc6e6('0x45')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x46'));db[_0xc6e6('0x47')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/faxAccount/faxAccount.model');db[_0xc6e6('0x48')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x49'));db['FaxInteraction']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x4a'));db[_0xc6e6('0x4b')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x4c'));db['FaxQueue']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x4d'));db[_0xc6e6('0x4e')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x4f'));db[_0xc6e6('0x50')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/smsAccount/smsAccount.model');db[_0xc6e6('0x51')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/smsApplication/smsApplication.model');db[_0xc6e6('0x52')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x53'));db[_0xc6e6('0x54')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x55'));db[_0xc6e6('0x56')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x57'));db[_0xc6e6('0x58')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x59'));db['OpenchannelApplication']=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize']['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc6e6('0x5a')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x5b'));db[_0xc6e6('0x5c')]=db['sequelize']['import'](_0xc6e6('0x5d'));db[_0xc6e6('0x5e')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/chatWebsite/chatWebsite.model');db[_0xc6e6('0x5f')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x60'));db[_0xc6e6('0x61')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x62'));db[_0xc6e6('0x63')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x64'));db[_0xc6e6('0x65')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/chatMessage/chatMessage.model');db[_0xc6e6('0x66')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x67'));db[_0xc6e6('0x68')]=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0xc6e6('0x69')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x6a'));db[_0xc6e6('0x6b')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x6c'));db['CmCompany']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x6d'));db['CmContact']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x6e'));db['CmHopper']=db['sequelize'][_0xc6e6('0x18')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x6f'));db[_0xc6e6('0x70')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x71'));db[_0xc6e6('0x72')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x73'));db[_0xc6e6('0x74')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x75'));db[_0xc6e6('0x76')]=db[_0xc6e6('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0xc6e6('0x77')]=db['sequelize']['import'](_0xc6e6('0x78'));db[_0xc6e6('0x79')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x7a'));db[_0xc6e6('0x7b')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x7c'));db[_0xc6e6('0x7d')]=db[_0xc6e6('0x1')]['import']('../api/disposition/disposition.model');db[_0xc6e6('0x7e')]=db['sequelize']['import'](_0xc6e6('0x7f'));db[_0xc6e6('0x80')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x81'));db[_0xc6e6('0x82')]=db['sequelize']['import'](_0xc6e6('0x83'));db[_0xc6e6('0x84')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x85'));db[_0xc6e6('0x86')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x87'));db[_0xc6e6('0x88')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/schedule/schedule.model');db[_0xc6e6('0x89')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x8a'));db[_0xc6e6('0x8b')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x8c'));db['Template']=db[_0xc6e6('0x1')]['import']('../api/template/template.model');db[_0xc6e6('0x8d')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x8e'));db[_0xc6e6('0x8f')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/variable/variable.model');db[_0xc6e6('0x90')]=db['sequelize']['import'](_0xc6e6('0x91'));db[_0xc6e6('0x92')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x93'));db['AnalyticCustomReport']=db['sequelize'][_0xc6e6('0x18')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xc6e6('0x94')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x95'));db['AnalyticExtractedReport']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x96'));db[_0xc6e6('0x97')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0x98'));db[_0xc6e6('0x99')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x9a'));db[_0xc6e6('0x9b')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x9c'));db[_0xc6e6('0x9d')]=db[_0xc6e6('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xc6e6('0x9e')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0x9f'));db[_0xc6e6('0xa0')]=db['sequelize']['import'](_0xc6e6('0xa1'));db['SugarcrmConfiguration']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xa2'));db[_0xc6e6('0xa3')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xa4'));db[_0xc6e6('0xa5')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xa6'));db[_0xc6e6('0xa7')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xa8'));db['DeskField']=db['sequelize']['import'](_0xc6e6('0xa9'));db[_0xc6e6('0xaa')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xab'));db[_0xc6e6('0xac')]=db['sequelize'][_0xc6e6('0x18')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xc6e6('0xad')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xae'));db[_0xc6e6('0xaf')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xb0'));db[_0xc6e6('0xb1')]=db['sequelize']['import'](_0xc6e6('0xb2'));db[_0xc6e6('0xb3')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xb4'));db['FreshdeskConfiguration']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xb5'));db['FreshdeskField']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xb6'));db[_0xc6e6('0xb7')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xb8'));db[_0xc6e6('0xb9')]=db[_0xc6e6('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xc6e6('0xba')]=db[_0xc6e6('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xc6e6('0xbb')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xc6e6('0xbc')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xbd'));db[_0xc6e6('0xbe')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xbf'));db[_0xc6e6('0xc0')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xc6e6('0xc1')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xc6e6('0xc2')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xc3'));db[_0xc6e6('0xc4')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xc5'));db[_0xc6e6('0xc6')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xc7'));db['FreshsalesField']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xc8'));db[_0xc6e6('0x90')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0x91'));db[_0xc6e6('0xc9')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/network/network.model');db[_0xc6e6('0xca')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xcb'));db[_0xc6e6('0xcc')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xc6e6('0xcd')]=db[_0xc6e6('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xc6e6('0xce')]=db[_0xc6e6('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xc6e6('0xcf')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc6e6('0xd0')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xd1'));db[_0xc6e6('0xd2')]=db[_0xc6e6('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xc6e6('0xd3')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xd4'));db[_0xc6e6('0xd5')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xd6'));db[_0xc6e6('0xd7')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xd8'));db['SquareRecording']=db['sequelize']['import'](_0xc6e6('0xd9'));db['SquareMessage']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xda'));db['Team']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xdb'));db[_0xc6e6('0xdc')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xdd'));db['Campaign']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xde'));db[_0xc6e6('0xdf')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/migration/migration.model');db['Attachment']=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/attachment/attachment.model');db['Plugin']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xe0'));db[_0xc6e6('0xe1')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xe2'));db['ChatTransferReport']=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xe3'));db[_0xc6e6('0xe4')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xe5'));db[_0xc6e6('0xe6')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xe7'));db[_0xc6e6('0xe8')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xe9'));db[_0xc6e6('0xea')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xeb'));db[_0xc6e6('0xec')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xed'));db[_0xc6e6('0xee')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xef'));db[_0xc6e6('0xf0')]=db[_0xc6e6('0x1')]['import'](_0xc6e6('0xf1'));db[_0xc6e6('0xf2')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xf3'));db[_0xc6e6('0xf4')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/userNotification/userNotification.model');db[_0xc6e6('0xf5')]=db[_0xc6e6('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xc6e6('0xf6')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')]('../api/whatsappApplication/whatsappApplication.model');db[_0xc6e6('0xf7')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xf8'));db[_0xc6e6('0xf9')]=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xfa'));db['WhatsappQueueReport']=db[_0xc6e6('0x1')][_0xc6e6('0x18')](_0xc6e6('0xfb'));db[_0xc6e6('0xfc')]=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xfd'));db['WhatsappQueue']=db['sequelize'][_0xc6e6('0x18')]('../api/whatsappQueue/whatsappQueue.model');db[_0xc6e6('0xfe')]=db['sequelize'][_0xc6e6('0x18')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize'][_0xc6e6('0x18')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize'][_0xc6e6('0x18')](_0xc6e6('0xff'));db[_0xc6e6('0x100')]=db['sequelize']['import'](_0xc6e6('0x101'));db[_0xc6e6('0x13')][_0xc6e6('0x102')](db[_0xc6e6('0x20')],{'as':_0xc6e6('0x20'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db['VoiceRecording'],{'as':_0xc6e6('0x106'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db[_0xc6e6('0x2e')],{'as':_0xc6e6('0x107'),'foreignKey':'UserId'});db['User'][_0xc6e6('0x105')](db[_0xc6e6('0x17')],{'as':'Extensions','onDelete':_0xc6e6('0x103'),'hooks':!![]});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db['CmHopperFinal'],{'as':_0xc6e6('0x108'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db[_0xc6e6('0x72')],{'as':_0xc6e6('0x109'),'foreignKey':'UserId'});db['User']['hasMany'](db['ReportAgentPreview'],{'as':_0xc6e6('0x74'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db[_0xc6e6('0x10a')],{'as':_0xc6e6('0x10b'),'foreignKey':_0xc6e6('0x104')});db['User'][_0xc6e6('0x105')](db[_0xc6e6('0x63')],{'as':_0xc6e6('0x10c'),'foreignKey':'UserId'});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db[_0xc6e6('0x52')],{'as':_0xc6e6('0x10d'),'foreignKey':'UserId'});db[_0xc6e6('0x13')]['hasMany'](db[_0xc6e6('0x10e')],{'as':_0xc6e6('0x10f'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')][_0xc6e6('0x105')](db['MailInteraction'],{'as':_0xc6e6('0x110'),'foreignKey':_0xc6e6('0x104')});db['User'][_0xc6e6('0x105')](db[_0xc6e6('0xf7')],{'as':'WhatsappInteractions','foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x13')]['hasMany'](db[_0xc6e6('0xf4')],{'as':_0xc6e6('0x111'),'foreignKey':_0xc6e6('0x112')});db[_0xc6e6('0x13')][_0xc6e6('0x113')](db[_0xc6e6('0xee')],{'as':_0xc6e6('0xee'),'foreignKey':_0xc6e6('0x114')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x69')],{'as':_0xc6e6('0x116'),'through':_0xc6e6('0x117')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x119'),'through':_0xc6e6('0x11a')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x11b'),'through':_0xc6e6('0x11c')});db['User'][_0xc6e6('0x115')](db[_0xc6e6('0x11d')],{'through':_0xc6e6('0x11e')});db[_0xc6e6('0x13')]['belongsToMany'](db['MailInteraction'],{'as':_0xc6e6('0x110'),'through':_0xc6e6('0x11f')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x63')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x10e')],{'as':_0xc6e6('0x10f'),'through':_0xc6e6('0x120')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db['SmsInteraction'],{'as':_0xc6e6('0x10d'),'through':_0xc6e6('0x121')});db[_0xc6e6('0x13')]['belongsToMany'](db[_0xc6e6('0x10a')],{'as':_0xc6e6('0x10b'),'through':_0xc6e6('0x122')});db[_0xc6e6('0x13')]['belongsToMany'](db[_0xc6e6('0xf7')],{'as':'WhatsappInteractions','through':_0xc6e6('0x123')});db[_0xc6e6('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0xc6e6('0x124'),'through':'UserVoiceQueue','required':![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0xec')],{'as':_0xc6e6('0x125'),'through':_0xc6e6('0x100'),'required':![]});db[_0xc6e6('0x13')]['belongsToMany'](db['MailQueue'],{'as':_0xc6e6('0x126'),'through':_0xc6e6('0x127'),'required':![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x68')],{'as':_0xc6e6('0x128'),'through':_0xc6e6('0x129'),'required':![],'hooks':!![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x12a')],{'as':'FaxQueues','through':_0xc6e6('0x33'),'required':![]});db['User'][_0xc6e6('0x115')](db[_0xc6e6('0x56')],{'as':_0xc6e6('0x12b'),'through':_0xc6e6('0x34'),'required':![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x5c')],{'as':_0xc6e6('0x12c'),'through':_0xc6e6('0x12d'),'required':![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x12e')],{'as':_0xc6e6('0x12f'),'through':_0xc6e6('0x36'),'required':![]});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0xea')],{'through':_0xc6e6('0x11c')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x5e')],{'as':_0xc6e6('0x130'),'through':_0xc6e6('0x131')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x47')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User'][_0xc6e6('0x115')](db[_0xc6e6('0x132')],{'as':_0xc6e6('0x133'),'through':_0xc6e6('0x134')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0x58')],{'as':_0xc6e6('0x135'),'through':_0xc6e6('0x136')});db[_0xc6e6('0x13')]['belongsToMany'](db['SmsAccount'],{'as':_0xc6e6('0x137'),'through':_0xc6e6('0x138')});db[_0xc6e6('0x13')][_0xc6e6('0x115')](db[_0xc6e6('0xf5')],{'as':'WhatsappAccounts','through':_0xc6e6('0x139')});db['User']['belongsToMany'](db['SquareProject'],{'as':_0xc6e6('0x13a'),'through':_0xc6e6('0x13b')});db[_0xc6e6('0x15')][_0xc6e6('0x105')](db[_0xc6e6('0x17')],{'as':_0xc6e6('0x13c'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x13d')});db[_0xc6e6('0x13e')]['hasMany'](db[_0xc6e6('0x17')],{'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x17')]['hasMany'](db[_0xc6e6('0x17')],{'as':_0xc6e6('0x13f'),'onDelete':'cascade'});db[_0xc6e6('0x1a')][_0xc6e6('0x115')](db[_0xc6e6('0x89')],{'as':_0xc6e6('0x140'),'through':'moh_has_sounds'});db['VoiceQueue'][_0xc6e6('0x105')](db[_0xc6e6('0x2e')],{'as':_0xc6e6('0x141'),'foreignKey':'VoiceQueueId'});db[_0xc6e6('0x1c')][_0xc6e6('0x105')](db[_0xc6e6('0x142')],{'as':_0xc6e6('0x143'),'foreignKey':_0xc6e6('0x144')});db['VoiceQueue'][_0xc6e6('0x105')](db[_0xc6e6('0x70')],{'as':_0xc6e6('0x108'),'foreignKey':_0xc6e6('0x144')});db[_0xc6e6('0x1c')][_0xc6e6('0x105')](db[_0xc6e6('0x72')],{'as':_0xc6e6('0x145'),'foreignKey':'VoiceQueueId'});db[_0xc6e6('0x1c')][_0xc6e6('0x105')](db['ReportAgentPreview'],{'as':_0xc6e6('0x74'),'foreignKey':'VoiceQueueId'});db[_0xc6e6('0x1c')][_0xc6e6('0x105')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xc6e6('0x144')});db['VoiceQueue']['hasMany'](db[_0xc6e6('0xce')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xc6e6('0x1c')][_0xc6e6('0x113')](db[_0xc6e6('0x2a')],{'as':'Trunk','foreignKey':_0xc6e6('0x146')});db[_0xc6e6('0x1c')]['belongsTo'](db[_0xc6e6('0x2a')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xc6e6('0x1c')][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'as':_0xc6e6('0x80'),'foreignKey':_0xc6e6('0x147')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0xc6e6('0x148'),'foreignKey':_0xc6e6('0x149')});db[_0xc6e6('0x1c')]['belongsToMany'](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x11b'),'through':_0xc6e6('0x14a')});db['VoiceQueue'][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x30')});db[_0xc6e6('0x1c')][_0xc6e6('0x115')](db['Team'],{'as':_0xc6e6('0x14c'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xc6e6('0x115')](db['CmList'],{'as':_0xc6e6('0x14d'),'through':_0xc6e6('0x14e')});db[_0xc6e6('0x1d')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x13'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x14f')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x13'),'foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x20')][_0xc6e6('0x105')](db[_0xc6e6('0x150')],{'as':_0xc6e6('0x151'),'onDelete':_0xc6e6('0x103'),'foreignKey':'mailboxuser','sourceKey':_0xc6e6('0x152')});db['VoiceMailMessage'][_0xc6e6('0x113')](db['VoiceMail'],{'foreignKey':_0xc6e6('0x153'),'targetKey':'mailbox'});db[_0xc6e6('0x23')][_0xc6e6('0x105')](db[_0xc6e6('0x27')],{'as':_0xc6e6('0x154'),'foreignKey':_0xc6e6('0x155'),'constraints':![]});db[_0xc6e6('0x23')][_0xc6e6('0x105')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xc6e6('0x23')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':'User','foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x23')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':'ContactId'});db[_0xc6e6('0x157')][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'as':_0xc6e6('0x132'),'foreignKey':_0xc6e6('0x158')});db['MailServerOut'][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'as':_0xc6e6('0x132'),'foreignKey':'MailAccountId'});db[_0xc6e6('0x132')][_0xc6e6('0x102')](db[_0xc6e6('0x157')],{'as':_0xc6e6('0x159'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x132')][_0xc6e6('0x102')](db['MailServerOut'],{'as':_0xc6e6('0x15a'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x132')][_0xc6e6('0x105')](db['Disposition'],{'as':_0xc6e6('0x15b'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount'][_0xc6e6('0x105')](db[_0xc6e6('0x7b')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xc6e6('0x132')][_0xc6e6('0x105')](db['MailMessage'],{'as':'Messages','foreignKey':_0xc6e6('0x158')});db[_0xc6e6('0x132')][_0xc6e6('0x105')](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0xc6e6('0x105')](db[_0xc6e6('0x15c')],{'as':'Applications'});db[_0xc6e6('0x132')]['belongsTo'](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':'ListId'});db[_0xc6e6('0x132')][_0xc6e6('0x113')](db[_0xc6e6('0x15e')],{'as':_0xc6e6('0x15e'),'foreignKey':_0xc6e6('0x15f')});db['MailAccount'][_0xc6e6('0x113')](db['Pause'],{'as':_0xc6e6('0x148'),'foreignKey':_0xc6e6('0x149')});db[_0xc6e6('0x132')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x134')});db[_0xc6e6('0x3b')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x127')});db[_0xc6e6('0x3b')]['belongsToMany'](db[_0xc6e6('0x11d')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xc6e6('0x3e')][_0xc6e6('0x105')](db[_0xc6e6('0x3f')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc6e6('0x160')});db[_0xc6e6('0x3e')][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'as':_0xc6e6('0x161'),'foreignKey':'MailAccountId'});db[_0xc6e6('0x3e')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x3e')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xc6e6('0x3e')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x163'),'as':_0xc6e6('0x164')});db[_0xc6e6('0x3e')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xc6e6('0x165')});db[_0xc6e6('0x3e')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x166'),'through':_0xc6e6('0x11f'),'foreignKey':_0xc6e6('0x160')});db[_0xc6e6('0x3f')][_0xc6e6('0x105')](db['Attachment'],{'as':_0xc6e6('0x167'),'onDelete':'cascade'});db[_0xc6e6('0x3f')]['belongsTo'](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x13')});db[_0xc6e6('0x3f')][_0xc6e6('0x113')](db['CmContact'],{'onDelete':'cascade','as':_0xc6e6('0x156')});db[_0xc6e6('0x3f')][_0xc6e6('0x113')](db['MailInteraction'],{'as':_0xc6e6('0x168'),'foreignKey':'MailInteractionId'});db[_0xc6e6('0x3f')]['belongsTo'](db[_0xc6e6('0x132')],{'as':'Account','foreignKey':_0xc6e6('0x158')});db['MailMessage'][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{'as':_0xc6e6('0x5e'),'foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x3f')]['belongsTo'](db[_0xc6e6('0x66')],{'as':_0xc6e6('0x66'),'foreignKey':_0xc6e6('0x16a')});db['MailApplication'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x16b')});db['MailApplication'][_0xc6e6('0x113')](db['MailQueue'],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x15c')]['belongsTo'](db[_0xc6e6('0x132')],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x15c')][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'onDelete':'restrict','foreignKey':_0xc6e6('0x147')});db[_0xc6e6('0x15c')][_0xc6e6('0x113')](db['Tag'],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x16c')});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db['MailAccount'],{});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db['CmContact'],{'as':_0xc6e6('0x156'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xc6e6('0x113')](db['MailInteraction'],{});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db['MailMessage'],{});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{});db[_0xc6e6('0x16d')][_0xc6e6('0x113')](db['MailQueue'],{});db[_0xc6e6('0x43')]['hasMany'](db[_0xc6e6('0x45')],{'as':_0xc6e6('0x16f'),'onDelete':_0xc6e6('0x103')});db['FaxAccount']['hasMany'](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':_0xc6e6('0x170'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x47')]['hasMany'](db[_0xc6e6('0x7b')],{'as':'Answers','foreignKey':_0xc6e6('0x170')});db[_0xc6e6('0x47')][_0xc6e6('0x105')](db['FaxInteraction'],{'as':_0xc6e6('0x171')});db[_0xc6e6('0x47')][_0xc6e6('0x105')](db[_0xc6e6('0x48')],{'as':_0xc6e6('0x13f')});db[_0xc6e6('0x47')][_0xc6e6('0x105')](db['VoiceExtension'],{'as':_0xc6e6('0x172'),'onDelete':'cascade'});db[_0xc6e6('0x47')][_0xc6e6('0x105')](db['FaxMessage'],{'as':_0xc6e6('0x151')});db[_0xc6e6('0x47')][_0xc6e6('0x113')](db[_0xc6e6('0x2a')],{'as':_0xc6e6('0x2a')});db[_0xc6e6('0x47')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0x47')]['belongsTo'](db[_0xc6e6('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0xc6e6('0x149')});db[_0xc6e6('0x47')][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x173')});db['FaxApplication'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x48')][_0xc6e6('0x113')](db[_0xc6e6('0x12a')],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x48')][_0xc6e6('0x113')](db['FaxAccount'],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x48')]['belongsTo'](db[_0xc6e6('0x8b')],{'onDelete':'restrict','foreignKey':_0xc6e6('0x16c')});db[_0xc6e6('0x10e')][_0xc6e6('0x105')](db[_0xc6e6('0x4b')],{'as':'Messages','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x174')});db[_0xc6e6('0x10e')][_0xc6e6('0x113')](db[_0xc6e6('0x47')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x170')});db['FaxInteraction'][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x10e')]['belongsTo'](db[_0xc6e6('0x13')],{'as':'Owner','foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x10e')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x175'),'as':_0xc6e6('0x164')});db[_0xc6e6('0x10e')][_0xc6e6('0x115')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xc6e6('0x165')});db[_0xc6e6('0x10e')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':'Users','through':_0xc6e6('0x120'),'foreignKey':_0xc6e6('0x174')});db[_0xc6e6('0x4b')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x103'),'as':'User'});db[_0xc6e6('0x4b')]['belongsTo'](db['FaxInteraction'],{'as':_0xc6e6('0x168'),'foreignKey':_0xc6e6('0x174')});db[_0xc6e6('0x4b')]['belongsTo'](db[_0xc6e6('0x118')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x156')});db[_0xc6e6('0x4b')][_0xc6e6('0x113')](db[_0xc6e6('0x176')],{'as':_0xc6e6('0x176'),'foreignKey':_0xc6e6('0x177')});db['FaxMessage'][_0xc6e6('0x113')](db[_0xc6e6('0x47')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xc6e6('0x12a')][_0xc6e6('0x115')](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0xc6e6('0x12a')][_0xc6e6('0x115')](db['Team'],{'through':_0xc6e6('0x178'),'as':'Teams'});db['FaxQueueReport'][_0xc6e6('0x113')](db['FaxAccount'],{});db[_0xc6e6('0x4e')][_0xc6e6('0x113')](db['CmList'],{'as':'List','foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0x4e')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x4e')][_0xc6e6('0x113')](db['FaxInteraction'],{});db[_0xc6e6('0x4e')][_0xc6e6('0x113')](db[_0xc6e6('0x4b')],{});db['FaxQueueReport'][_0xc6e6('0x113')](db['User'],{});db[_0xc6e6('0x4e')][_0xc6e6('0x113')](db[_0xc6e6('0x12a')],{});db[_0xc6e6('0x50')][_0xc6e6('0x105')](db['Disposition'],{'as':_0xc6e6('0x15b'),'foreignKey':'SmsAccountId','onDelete':_0xc6e6('0x103')});db['SmsAccount'][_0xc6e6('0x105')](db[_0xc6e6('0x7b')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xc6e6('0x50')][_0xc6e6('0x105')](db[_0xc6e6('0x54')],{'as':'Messages','foreignKey':_0xc6e6('0x179')});db[_0xc6e6('0x50')][_0xc6e6('0x105')](db[_0xc6e6('0x52')],{'as':'Interactions'});db['SmsAccount'][_0xc6e6('0x105')](db[_0xc6e6('0x51')],{'as':_0xc6e6('0x13f')});db[_0xc6e6('0x50')][_0xc6e6('0x113')](db['CmList'],{'as':_0xc6e6('0x15d'),'foreignKey':'ListId'});db[_0xc6e6('0x50')][_0xc6e6('0x113')](db[_0xc6e6('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc6e6('0x50')][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x138')});db[_0xc6e6('0x51')]['belongsTo'](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x51')][_0xc6e6('0x113')](db[_0xc6e6('0x56')],{'onDelete':'restrict'});db[_0xc6e6('0x51')][_0xc6e6('0x113')](db[_0xc6e6('0x50')],{'onDelete':'restrict'});db['SmsApplication'][_0xc6e6('0x113')](db['Interval'],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x147')});db[_0xc6e6('0x51')][_0xc6e6('0x113')](db[_0xc6e6('0x8b')],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x16c')});db[_0xc6e6('0x52')]['hasMany'](db[_0xc6e6('0x54')],{'as':_0xc6e6('0x151'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xc6e6('0x52')][_0xc6e6('0x113')](db[_0xc6e6('0x50')],{'as':_0xc6e6('0x161'),'foreignKey':'SmsAccountId'});db[_0xc6e6('0x52')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':'Contact','foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x52')]['belongsTo'](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x17a'),'foreignKey':'UserId'});db[_0xc6e6('0x52')][_0xc6e6('0x115')](db['Tag'],{'through':_0xc6e6('0x17b'),'as':_0xc6e6('0x164')});db[_0xc6e6('0x52')]['belongsToMany'](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x17b'),'as':_0xc6e6('0x165')});db[_0xc6e6('0x52')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':'Users','through':_0xc6e6('0x121'),'foreignKey':_0xc6e6('0x17c')});db[_0xc6e6('0x54')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x13')});db[_0xc6e6('0x54')][_0xc6e6('0x113')](db['CmContact'],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x156')});db['SmsMessage']['belongsTo'](db[_0xc6e6('0x52')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x168'),'foreignKey':'SmsInteractionId'});db[_0xc6e6('0x54')][_0xc6e6('0x113')](db['SmsAccount'],{'as':_0xc6e6('0x161'),'foreignKey':'SmsAccountId'});db[_0xc6e6('0x56')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x34'),'foreignKey':_0xc6e6('0x17d')});db['SmsQueue']['belongsToMany'](db[_0xc6e6('0x11d')],{'through':_0xc6e6('0x17e'),'as':'Teams'});db[_0xc6e6('0x58')][_0xc6e6('0x105')](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':_0xc6e6('0x17f'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x58')][_0xc6e6('0x105')](db[_0xc6e6('0x7b')],{'as':'Answers','foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x58')]['hasMany'](db[_0xc6e6('0x10a')],{'as':_0xc6e6('0x171'),'foreignKey':_0xc6e6('0x17f')});db['OpenchannelAccount']['hasMany'](db[_0xc6e6('0x5a')],{'as':_0xc6e6('0x151'),'foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x58')]['hasMany'](db[_0xc6e6('0x180')],{'as':'Applications','foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x58')]['belongsTo'](db['CmList'],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db['OpenchannelAccount'][_0xc6e6('0x113')](db['Pause'],{'as':_0xc6e6('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc6e6('0x58')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':'Agents','through':_0xc6e6('0x136')});db[_0xc6e6('0x180')][_0xc6e6('0x113')](db['User'],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x180')][_0xc6e6('0x113')](db[_0xc6e6('0x5c')],{'onDelete':_0xc6e6('0x16b'),'foreignKey':'OpenchannelQueueId'});db[_0xc6e6('0x180')][_0xc6e6('0x113')](db['OpenchannelAccount'],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x180')][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x147')});db[_0xc6e6('0x180')][_0xc6e6('0x113')](db['Tag'],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x16c')});db[_0xc6e6('0x10a')][_0xc6e6('0x105')](db[_0xc6e6('0x5a')],{'as':_0xc6e6('0x151'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x181')});db[_0xc6e6('0x10a')][_0xc6e6('0x113')](db[_0xc6e6('0x58')],{'as':'Account','foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x10a')][_0xc6e6('0x113')](db['CmContact'],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x10a')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':'Owner','foreignKey':_0xc6e6('0x104')});db[_0xc6e6('0x10a')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x182'),'as':_0xc6e6('0x164')});db[_0xc6e6('0x10a')]['belongsToMany'](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x182'),'as':'ThroughTags'});db[_0xc6e6('0x10a')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x166'),'through':_0xc6e6('0x122'),'foreignKey':_0xc6e6('0x181')});db[_0xc6e6('0x5a')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x13')});db['OpenchannelMessage']['belongsTo'](db[_0xc6e6('0x118')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x156')});db['OpenchannelMessage'][_0xc6e6('0x113')](db[_0xc6e6('0x10a')],{'onDelete':'cascade','as':_0xc6e6('0x168'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xc6e6('0x113')](db[_0xc6e6('0x176')],{'as':'Attachment','foreignKey':_0xc6e6('0x177')});db[_0xc6e6('0x5a')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x17f')});db[_0xc6e6('0x5c')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x12d'),'foreignKey':_0xc6e6('0x183')});db['OpenchannelQueue'][_0xc6e6('0x115')](db[_0xc6e6('0x11d')],{'through':'team_has_openchannel_queues','as':_0xc6e6('0x14c')});db[_0xc6e6('0x5e')][_0xc6e6('0x105')](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':_0xc6e6('0x169'),'onDelete':'cascade'});db[_0xc6e6('0x5e')][_0xc6e6('0x105')](db['CannedAnswer'],{'as':_0xc6e6('0x184'),'foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x5e')][_0xc6e6('0x105')](db[_0xc6e6('0x6b')],{'as':_0xc6e6('0x185')});db['ChatWebsite'][_0xc6e6('0x105')](db[_0xc6e6('0x63')],{'as':_0xc6e6('0x171')});db[_0xc6e6('0x5e')][_0xc6e6('0x105')](db[_0xc6e6('0x61')],{'as':_0xc6e6('0x13f')});db[_0xc6e6('0x5e')][_0xc6e6('0x105')](db[_0xc6e6('0x65')],{'as':_0xc6e6('0x151')});db['ChatWebsite'][_0xc6e6('0x113')](db['CmList'],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db['ChatWebsite'][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'as':_0xc6e6('0x80'),'foreignKey':_0xc6e6('0x147')});db[_0xc6e6('0x5e')][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'as':_0xc6e6('0x132'),'foreignKey':_0xc6e6('0x158')});db[_0xc6e6('0x5e')][_0xc6e6('0x113')](db['Pause'],{'as':_0xc6e6('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc6e6('0x5e')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x131')});db['OpenchannelQueueReport'][_0xc6e6('0x113')](db[_0xc6e6('0x58')],{});db[_0xc6e6('0x5f')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':'ListId'});db[_0xc6e6('0x5f')][_0xc6e6('0x113')](db['CmContact'],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db['OpenchannelQueueReport'][_0xc6e6('0x113')](db[_0xc6e6('0x10a')],{});db['OpenchannelQueueReport'][_0xc6e6('0x113')](db[_0xc6e6('0x5a')],{});db[_0xc6e6('0x5f')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{});db[_0xc6e6('0x5f')][_0xc6e6('0x113')](db[_0xc6e6('0x5c')],{});db['ChatApplication'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x186'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xc6e6('0x68')],{'as':_0xc6e6('0x187'),'foreignKey':_0xc6e6('0x188'),'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x61')][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{'as':'Website','foreignKey':_0xc6e6('0x169'),'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x61')][_0xc6e6('0x113')](db[_0xc6e6('0x8b')],{'onDelete':_0xc6e6('0x16b'),'foreignKey':_0xc6e6('0x16c')});db[_0xc6e6('0x63')][_0xc6e6('0x105')](db['ChatMessage'],{'as':'Messages','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x189')});db[_0xc6e6('0x63')][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x63')][_0xc6e6('0x113')](db['CmContact'],{'as':'Contact','foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x63')]['belongsTo'](db[_0xc6e6('0x13')],{'as':'Owner','foreignKey':_0xc6e6('0x104')});db['ChatInteraction'][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x18a'),'as':_0xc6e6('0x164')});db[_0xc6e6('0x63')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':'chat_interaction_has_tags','as':_0xc6e6('0x165')});db[_0xc6e6('0x63')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x166'),'through':_0xc6e6('0x18b'),'foreignKey':_0xc6e6('0x189')});db['ChatMessage'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x13')});db[_0xc6e6('0x65')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x65')]['belongsTo'](db[_0xc6e6('0x63')],{'onDelete':_0xc6e6('0x103'),'as':_0xc6e6('0x168'),'foreignKey':_0xc6e6('0x189')});db[_0xc6e6('0x65')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xc6e6('0x177')});db['ChatMessage']['belongsTo'](db[_0xc6e6('0x5e')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x66')][_0xc6e6('0x105')](db[_0xc6e6('0x176')],{'as':_0xc6e6('0x167'),'foreignKey':_0xc6e6('0x16a'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db[_0xc6e6('0x66')]['belongsTo'](db[_0xc6e6('0x118')],{'onDelete':_0xc6e6('0x103'),'as':'Contact','foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x66')][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{'as':'Account','foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x68')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':'Agents','through':_0xc6e6('0x129'),'hooks':!![]});db[_0xc6e6('0x68')]['belongsToMany'](db[_0xc6e6('0x11d')],{'through':'team_has_chat_queues','as':_0xc6e6('0x14c')});db['ChatGroup']['hasMany'](db[_0xc6e6('0xcc')],{'as':_0xc6e6('0x151'),'foreignKey':'ChatGroupId','onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x69')][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x141'),'through':_0xc6e6('0x117')});db[_0xc6e6('0x6b')]['belongsTo'](db[_0xc6e6('0x5e')],{'as':'Website','foreignKey':_0xc6e6('0x169')});db[_0xc6e6('0x18c')]['hasMany'](db[_0xc6e6('0x118')],{'as':'Contacts','foreignKey':_0xc6e6('0x18d')});db[_0xc6e6('0x118')]['hasMany'](db[_0xc6e6('0x142')],{'as':_0xc6e6('0x143'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x118')]['hasMany'](db[_0xc6e6('0x70')],{'as':_0xc6e6('0x108'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db[_0xc6e6('0x74')],{'as':_0xc6e6('0x74'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db['JscriptySessionReport'],{'as':_0xc6e6('0x18e'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db[_0xc6e6('0x10a')],{'as':_0xc6e6('0x10b'),'foreignKey':_0xc6e6('0x162'),'onDelete':_0xc6e6('0x16b')});db['CmContact'][_0xc6e6('0x105')](db[_0xc6e6('0x63')],{'as':_0xc6e6('0x10c'),'foreignKey':_0xc6e6('0x162'),'onDelete':'restrict'});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db['SmsInteraction'],{'as':_0xc6e6('0x10d'),'foreignKey':_0xc6e6('0x162'),'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x118')][_0xc6e6('0x105')](db[_0xc6e6('0x10e')],{'as':'FaxInteractions','foreignKey':_0xc6e6('0x162'),'onDelete':'restrict'});db[_0xc6e6('0x118')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xc6e6('0x162'),'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x118')][_0xc6e6('0x113')](db[_0xc6e6('0x18c')],{'as':_0xc6e6('0x18f'),'foreignKey':_0xc6e6('0x18d')});db[_0xc6e6('0x118')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':'List','foreignKey':'ListId','onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x118')]['belongsToMany'](db[_0xc6e6('0x13')],{'as':'Users','through':_0xc6e6('0x11a')});db[_0xc6e6('0x118')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xc6e6('0x118')]['belongsToMany'](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x190'),'as':_0xc6e6('0x165')});db[_0xc6e6('0x142')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xc6e6('0x142')][_0xc6e6('0x113')](db['CmList'],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e'),'onDelete':'cascade'});db[_0xc6e6('0x142')]['belongsTo'](db[_0xc6e6('0x13')],{'as':'Agent','foreignKey':_0xc6e6('0x104')});db['CmHopper'][_0xc6e6('0x113')](db[_0xc6e6('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc6e6('0x103')});db['CmHopper']['belongsTo'](db['Campaign'],{'as':_0xc6e6('0x191'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xc6e6('0x142')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x17a'),'foreignKey':_0xc6e6('0x192')});db[_0xc6e6('0x193')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x193')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x193')][_0xc6e6('0x113')](db[_0xc6e6('0x1c')],{'as':'Queue','foreignKey':_0xc6e6('0x144'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x193')][_0xc6e6('0x113')](db[_0xc6e6('0x191')],{'as':_0xc6e6('0x191'),'foreignKey':_0xc6e6('0x194'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x79')][_0xc6e6('0x105')](db[_0xc6e6('0x7e')],{'as':{'plural':'All','singular':_0xc6e6('0x195')},'foreignKey':'AutomationAllId','onDelete':_0xc6e6('0x103'),'hooks':!![]});db['Automation'][_0xc6e6('0x105')](db[_0xc6e6('0x7e')],{'as':{'plural':_0xc6e6('0x196'),'singular':_0xc6e6('0x197')},'foreignKey':_0xc6e6('0x198'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db[_0xc6e6('0x79')][_0xc6e6('0x105')](db['Action'],{'as':_0xc6e6('0x199'),'foreignKey':_0xc6e6('0x19a'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db['Disposition'][_0xc6e6('0x105')](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':'ParentId','onDelete':_0xc6e6('0x103')});db[_0xc6e6('0x80')][_0xc6e6('0x105')](db['Interval'],{'as':'Intervals','foreignKey':_0xc6e6('0x147'),'onDelete':_0xc6e6('0x103'),'hooks':!![],'required':![]});db[_0xc6e6('0x80')][_0xc6e6('0x105')](db[_0xc6e6('0x17')],{'as':_0xc6e6('0x19b'),'foreignKey':_0xc6e6('0x147'),'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0x80')][_0xc6e6('0x105')](db[_0xc6e6('0x15c')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xc6e6('0x80')][_0xc6e6('0x105')](db[_0xc6e6('0x61')],{'as':'ChatApplications','foreignKey':_0xc6e6('0x147')});db[_0xc6e6('0x80')][_0xc6e6('0x105')](db['FaxApplication'],{'as':_0xc6e6('0x19c'),'foreignKey':_0xc6e6('0x147')});db['Interval'][_0xc6e6('0x105')](db[_0xc6e6('0x51')],{'as':_0xc6e6('0x19d'),'foreignKey':_0xc6e6('0x147')});db['Schedule']['belongsTo'](db[_0xc6e6('0x132')],{});db[_0xc6e6('0x88')][_0xc6e6('0x113')](db[_0xc6e6('0x94')],{'foreignKey':'DefaultReportId'});db[_0xc6e6('0x88')][_0xc6e6('0x113')](db[_0xc6e6('0x19e')],{'foreignKey':_0xc6e6('0x19f')});db['Sound'][_0xc6e6('0x115')](db[_0xc6e6('0x1a')],{'as':_0xc6e6('0x1a0'),'through':_0xc6e6('0x1a1'),'onDelete':_0xc6e6('0x16b')});db['Tag']['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xc6e6('0x8b')][_0xc6e6('0x115')](db[_0xc6e6('0x63')],{'through':_0xc6e6('0x18a')});db[_0xc6e6('0x8b')][_0xc6e6('0x115')](db[_0xc6e6('0x3e')],{'through':_0xc6e6('0x163')});db[_0xc6e6('0x8b')]['belongsToMany'](db['SmsInteraction'],{'through':_0xc6e6('0x17b')});db[_0xc6e6('0x8b')]['belongsToMany'](db[_0xc6e6('0x10e')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xc6e6('0x115')](db[_0xc6e6('0x10a')],{'through':'openchannel_interaction_has_tags'});db[_0xc6e6('0x8b')]['belongsToMany'](db[_0xc6e6('0xf7')],{'through':_0xc6e6('0x1a2')});db['Trigger'][_0xc6e6('0x105')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xc6e6('0x1a3')},'foreignKey':_0xc6e6('0x1a4'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db[_0xc6e6('0x8d')]['hasMany'](db['Condition'],{'as':{'plural':_0xc6e6('0x1a5'),'singular':_0xc6e6('0x1a6')},'foreignKey':_0xc6e6('0x1a7'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db['Trigger'][_0xc6e6('0x105')](db[_0xc6e6('0x77')],{'as':_0xc6e6('0x199'),'foreignKey':_0xc6e6('0x1a8'),'onDelete':_0xc6e6('0x103'),'hooks':!![]});db[_0xc6e6('0x19e')][_0xc6e6('0x105')](db[_0xc6e6('0x99')],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x19f'),'hooks':!![]});db[_0xc6e6('0x94')][_0xc6e6('0x105')](db[_0xc6e6('0x99')],{'as':_0xc6e6('0x1a9'),'onDelete':'cascade','foreignKey':_0xc6e6('0x1aa')});db[_0xc6e6('0x97')][_0xc6e6('0x105')](db[_0xc6e6('0x99')],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ab')});db[_0xc6e6('0x99')][_0xc6e6('0x113')](db[_0xc6e6('0x97')],{'foreignKey':'MetricId'});db[_0xc6e6('0x9b')][_0xc6e6('0x105')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db['SalesforceConfiguration'][_0xc6e6('0x105')](db['SalesforceField'],{'as':_0xc6e6('0x1ad'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0xc6e6('0x1af'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x9d')][_0xc6e6('0x105')](db['SalesforceField'],{'as':'Fields','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0x9d')]['belongsTo'](db[_0xc6e6('0x9b')],{'as':'Account','foreignKey':'AccountId'});db[_0xc6e6('0x9e')][_0xc6e6('0x105')](db[_0xc6e6('0x9e')],{'as':_0xc6e6('0x1b2'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0x9e')][_0xc6e6('0x105')](db[_0xc6e6('0x9e')],{'as':'Description','foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x9e')][_0xc6e6('0x105')](db[_0xc6e6('0x9e')],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0x9e')]['belongsTo'](db[_0xc6e6('0x8f')],{'as':'Variable','foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0xa0')][_0xc6e6('0x105')](db[_0xc6e6('0x1b5')],{'as':_0xc6e6('0x1b6'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db['SugarcrmConfiguration'][_0xc6e6('0x105')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ae')});db['SugarcrmConfiguration']['hasMany'](db[_0xc6e6('0xa3')],{'as':'Descriptions','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x1b5')][_0xc6e6('0x105')](db['SugarcrmField'],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':'FieldId'});db[_0xc6e6('0x1b5')][_0xc6e6('0x113')](db[_0xc6e6('0xa0')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db['SugarcrmField']['hasMany'](db[_0xc6e6('0xa3')],{'as':_0xc6e6('0x1b2'),'foreignKey':_0xc6e6('0x1ae')});db['SugarcrmField'][_0xc6e6('0x105')](db['SugarcrmField'],{'as':'Description','foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xa3')][_0xc6e6('0x105')](db[_0xc6e6('0xa3')],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xa3')][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0xa5')]['hasMany'](db[_0xc6e6('0xa7')],{'as':_0xc6e6('0x1b6'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db['DeskConfiguration'][_0xc6e6('0x105')](db['DeskField'],{'as':'Subjects','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xa7')][_0xc6e6('0x105')](db[_0xc6e6('0x1b7')],{'as':_0xc6e6('0x1af'),'onDelete':_0xc6e6('0x103'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0x1b7')],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xa7')]['belongsTo'](db[_0xc6e6('0xa5')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xa7')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x1b8')});db[_0xc6e6('0x1b7')][_0xc6e6('0x105')](db[_0xc6e6('0x1b7')],{'as':'Subject','foreignKey':_0xc6e6('0x1ae')});db['DeskField']['hasMany'](db[_0xc6e6('0x1b7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc6e6('0x1b7')][_0xc6e6('0x105')](db[_0xc6e6('0x1b7')],{'as':_0xc6e6('0x1b3'),'foreignKey':'FieldId'});db[_0xc6e6('0x1b7')][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xc6e6('0x105')](db[_0xc6e6('0xac')],{'as':_0xc6e6('0x1b6'),'onDelete':'cascade','foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xac')][_0xc6e6('0x105')](db[_0xc6e6('0xad')],{'as':_0xc6e6('0x1ad'),'onDelete':_0xc6e6('0x103'),'foreignKey':'SubjectId'});db[_0xc6e6('0xac')][_0xc6e6('0x105')](db[_0xc6e6('0xad')],{'as':_0xc6e6('0x1af'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xac')][_0xc6e6('0x105')](db[_0xc6e6('0xad')],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':'FieldId'});db[_0xc6e6('0xac')][_0xc6e6('0x113')](db[_0xc6e6('0xaa')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xad')]['hasMany'](db[_0xc6e6('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db['ZohoField'][_0xc6e6('0x105')](db[_0xc6e6('0xad')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc6e6('0xad')][_0xc6e6('0x105')](db[_0xc6e6('0xad')],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xad')][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0x1b9')][_0xc6e6('0x105')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xaf')][_0xc6e6('0x105')](db[_0xc6e6('0xb1')],{'as':_0xc6e6('0x1ad'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xaf')][_0xc6e6('0x105')](db[_0xc6e6('0xb1')],{'as':'Descriptions','foreignKey':_0xc6e6('0x1b0')});db['ZendeskConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0xb1')],{'as':'Fields','foreignKey':'FieldId'});db[_0xc6e6('0xaf')]['belongsTo'](db[_0xc6e6('0x1b9')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xaf')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x1ba')});db[_0xc6e6('0xb1')][_0xc6e6('0x105')](db['ZendeskField'],{'as':'Subject','foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xb1')][_0xc6e6('0x105')](db[_0xc6e6('0xb1')],{'as':_0xc6e6('0x1bb'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xb1')]['hasMany'](db[_0xc6e6('0xb1')],{'as':'Field','foreignKey':_0xc6e6('0x1b1')});db['ZendeskField'][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':_0xc6e6('0x1b4')});db['FreshdeskAccount'][_0xc6e6('0x105')](db[_0xc6e6('0x1bc')],{'as':_0xc6e6('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc6e6('0x1bc')][_0xc6e6('0x105')](db[_0xc6e6('0x1bd')],{'as':_0xc6e6('0x1ad'),'onDelete':_0xc6e6('0x103'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0x1bd')],{'as':_0xc6e6('0x1af'),'onDelete':'cascade','foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x1bc')][_0xc6e6('0x105')](db[_0xc6e6('0x1bd')],{'as':_0xc6e6('0x1a9'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0x1bc')][_0xc6e6('0x113')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0x1bc')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x1be')});db[_0xc6e6('0x1bd')][_0xc6e6('0x105')](db[_0xc6e6('0x1bd')],{'as':_0xc6e6('0x1b2'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0x1bd')][_0xc6e6('0x105')](db['FreshdeskField'],{'as':_0xc6e6('0x1bb'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x1bd')][_0xc6e6('0x105')](db['FreshdeskField'],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0x1bd')][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0xb7')][_0xc6e6('0x105')](db[_0xc6e6('0xb9')],{'as':_0xc6e6('0x1b6'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db['VtigerConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':_0xc6e6('0x1ad'),'foreignKey':_0xc6e6('0x1ae')});db['VtigerConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':_0xc6e6('0x1af'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xb9')][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':'Fields','foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xb9')][_0xc6e6('0x113')](db[_0xc6e6('0xb7')],{'as':'Account','foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xba')][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':_0xc6e6('0x1b2'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xba')][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':'Description','foreignKey':_0xc6e6('0x1b0')});db['VtigerField'][_0xc6e6('0x105')](db[_0xc6e6('0xba')],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xba')]['belongsTo'](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':'VariableId'});db[_0xc6e6('0xbb')][_0xc6e6('0x105')](db[_0xc6e6('0xbc')],{'as':'Configurations','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xbc')][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':_0xc6e6('0x1ad'),'foreignKey':_0xc6e6('0x1ae')});db['ServicenowConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':'Fields','foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xbc')][_0xc6e6('0x113')](db[_0xc6e6('0xbb')],{'as':_0xc6e6('0x161'),'foreignKey':'AccountId'});db['ServicenowField'][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':'Subject','foreignKey':_0xc6e6('0x1ae')});db['ServicenowField'][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':_0xc6e6('0x1bb'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xbe')][_0xc6e6('0x105')](db[_0xc6e6('0xbe')],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db['ServicenowField'][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':'VariableId'});db[_0xc6e6('0xc0')][_0xc6e6('0x105')](db[_0xc6e6('0xc1')],{'as':_0xc6e6('0x1b6'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db['Dynamics365Configuration'][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':_0xc6e6('0x1ad'),'onDelete':'cascade','foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xc1')][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':_0xc6e6('0x1af'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xc1')][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':'Fields','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0xc1')]['belongsTo'](db['Dynamics365Account'],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xc2')][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':'Subject','foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xc2')][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':'Description','foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xc2')][_0xc6e6('0x105')](db[_0xc6e6('0xc2')],{'as':'Field','foreignKey':_0xc6e6('0x1b1')});db['Dynamics365Field'][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':_0xc6e6('0x8f'),'foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0xc4')][_0xc6e6('0x105')](db[_0xc6e6('0xc6')],{'as':'Configurations','onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0xc6')][_0xc6e6('0x105')](db[_0xc6e6('0x1bf')],{'as':_0xc6e6('0x1ad'),'foreignKey':_0xc6e6('0x1ae')});db[_0xc6e6('0xc6')]['hasMany'](db[_0xc6e6('0x1bf')],{'as':_0xc6e6('0x1af'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0xc6')][_0xc6e6('0x105')](db[_0xc6e6('0x1bf')],{'as':_0xc6e6('0x1a9'),'foreignKey':_0xc6e6('0x1b1')});db['FreshsalesConfiguration'][_0xc6e6('0x113')](db[_0xc6e6('0xc4')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1ac')});db[_0xc6e6('0x1bf')][_0xc6e6('0x105')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xc6e6('0x1ae')});db['FreshsalesField'][_0xc6e6('0x105')](db[_0xc6e6('0x1bf')],{'as':_0xc6e6('0x1bb'),'foreignKey':_0xc6e6('0x1b0')});db[_0xc6e6('0x1bf')][_0xc6e6('0x105')](db['FreshsalesField'],{'as':_0xc6e6('0x1b3'),'foreignKey':_0xc6e6('0x1b1')});db[_0xc6e6('0x1bf')][_0xc6e6('0x113')](db[_0xc6e6('0x8f')],{'as':'Variable','foreignKey':_0xc6e6('0x1b4')});db[_0xc6e6('0xca')][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{});db[_0xc6e6('0xca')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':'ListId'});db[_0xc6e6('0xca')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0xca')][_0xc6e6('0x113')](db['ChatInteraction'],{});db[_0xc6e6('0xca')][_0xc6e6('0x113')](db['ChatMessage'],{});db[_0xc6e6('0xca')]['belongsTo'](db['User'],{});db['ChatQueueReport']['belongsTo'](db[_0xc6e6('0x68')],{});db[_0xc6e6('0xcc')][_0xc6e6('0x113')](db['User'],{'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x1c0')});db[_0xc6e6('0xcc')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'onDelete':_0xc6e6('0x103'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xc6e6('0x105')](db[_0xc6e6('0xcd')],{'foreignKey':_0xc6e6('0x1c1'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0xce')][_0xc6e6('0x105')](db[_0xc6e6('0x1c2')],{'foreignKey':_0xc6e6('0x1c1'),'onDelete':_0xc6e6('0x103')});db['SmsQueueReport']['belongsTo'](db[_0xc6e6('0x50')],{});db[_0xc6e6('0xcf')][_0xc6e6('0x113')](db['CmList'],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xcf')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0xcf')][_0xc6e6('0x113')](db[_0xc6e6('0x52')],{});db[_0xc6e6('0xcf')][_0xc6e6('0x113')](db[_0xc6e6('0x54')],{});db['SmsQueueReport'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{});db[_0xc6e6('0xcf')][_0xc6e6('0x113')](db[_0xc6e6('0x56')],{});db[_0xc6e6('0xd3')][_0xc6e6('0x105')](db[_0xc6e6('0xce')],{'foreignKey':_0xc6e6('0x1c3')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db['User'],{'as':_0xc6e6('0x166'),'through':'user_has_square_projects'});db[_0xc6e6('0x11d')]['belongsToMany'](db[_0xc6e6('0x13')],{'as':'Agents','through':_0xc6e6('0x11e')});db[_0xc6e6('0x11d')]['belongsToMany'](db[_0xc6e6('0x1c')],{'through':_0xc6e6('0x1c4'),'as':_0xc6e6('0x124')});db[_0xc6e6('0x11d')][_0xc6e6('0x115')](db[_0xc6e6('0x3b')],{'through':_0xc6e6('0x1c5'),'as':_0xc6e6('0x126')});db[_0xc6e6('0x11d')]['belongsToMany'](db[_0xc6e6('0x68')],{'through':_0xc6e6('0x1c6'),'as':'ChatQueues'});db[_0xc6e6('0x11d')][_0xc6e6('0x115')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xc6e6('0x1c7')});db['Team'][_0xc6e6('0x115')](db['SmsQueue'],{'through':_0xc6e6('0x17e'),'as':_0xc6e6('0x12b')});db['Team']['belongsToMany'](db[_0xc6e6('0x5c')],{'through':_0xc6e6('0x1c8'),'as':_0xc6e6('0x12c')});db[_0xc6e6('0x11d')][_0xc6e6('0x115')](db[_0xc6e6('0x12e')],{'through':_0xc6e6('0x1c9'),'as':_0xc6e6('0x12f')});db[_0xc6e6('0x11d')][_0xc6e6('0x115')](db[_0xc6e6('0xec')],{'through':_0xc6e6('0x1ca'),'as':_0xc6e6('0x125')});db[_0xc6e6('0x191')][_0xc6e6('0x105')](db[_0xc6e6('0x142')],{'as':'Hoppers','foreignKey':_0xc6e6('0x194')});db[_0xc6e6('0x191')][_0xc6e6('0x105')](db[_0xc6e6('0x70')],{'as':_0xc6e6('0x108'),'foreignKey':_0xc6e6('0x194')});db[_0xc6e6('0x191')][_0xc6e6('0x105')](db['CmHopperHistory'],{'as':_0xc6e6('0x145'),'foreignKey':_0xc6e6('0x194')});db[_0xc6e6('0x191')]['hasMany'](db[_0xc6e6('0x193')],{'as':_0xc6e6('0x1cb'),'foreignKey':_0xc6e6('0x194')});db[_0xc6e6('0x191')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xc6e6('0x146')});db[_0xc6e6('0x191')]['belongsTo'](db['Trunk'],{'as':_0xc6e6('0x1cc'),'foreignKey':_0xc6e6('0x1cd')});db[_0xc6e6('0x191')][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'as':_0xc6e6('0x80'),'foreignKey':_0xc6e6('0x147')});db['Campaign'][_0xc6e6('0x113')](db[_0xc6e6('0xd7')],{'as':'SquareProject','foreignKey':_0xc6e6('0x1ce')});db[_0xc6e6('0x191')][_0xc6e6('0x115')](db['CmList'],{'as':'Lists','through':_0xc6e6('0x1cf')});db[_0xc6e6('0x191')]['belongsToMany'](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x14d'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0xc6e6('0x113')](db[_0xc6e6('0x66')],{'as':_0xc6e6('0x66'),'foreignKey':_0xc6e6('0x16a')});db['MailTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x3f')],{});db[_0xc6e6('0xe1')][_0xc6e6('0x113')](db[_0xc6e6('0x3e')],{});db['MailTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'foreignKey':_0xc6e6('0x1d0'),'as':_0xc6e6('0x1d1')});db[_0xc6e6('0xe1')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':'FromUserId','as':_0xc6e6('0x1d2')});db['MailTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1d3'),'as':_0xc6e6('0x1d4')});db[_0xc6e6('0xe1')][_0xc6e6('0x113')](db[_0xc6e6('0x3b')],{'foreignKey':_0xc6e6('0x1d5'),'as':_0xc6e6('0x1d6')});db['MailTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x132')],{'foreignKey':_0xc6e6('0x1d7'),'as':_0xc6e6('0x1d8')});db[_0xc6e6('0x1d9')][_0xc6e6('0x113')](db[_0xc6e6('0x65')],{});db[_0xc6e6('0x1d9')][_0xc6e6('0x113')](db[_0xc6e6('0x63')],{});db[_0xc6e6('0x1d9')][_0xc6e6('0x113')](db[_0xc6e6('0x5e')],{'foreignKey':_0xc6e6('0x1da'),'as':_0xc6e6('0x1d1')});db['ChatTransferReport']['belongsTo'](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1db'),'as':_0xc6e6('0x1d2')});db[_0xc6e6('0x1d9')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1d3'),'as':_0xc6e6('0x1d4')});db['ChatTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x68')],{'foreignKey':_0xc6e6('0x1dc'),'as':'ToQueue'});db[_0xc6e6('0x1d9')]['belongsTo'](db[_0xc6e6('0x5e')],{'foreignKey':_0xc6e6('0x1dd'),'as':_0xc6e6('0x1d8')});db[_0xc6e6('0xe4')][_0xc6e6('0x113')](db[_0xc6e6('0x4b')],{});db[_0xc6e6('0xe4')][_0xc6e6('0x113')](db[_0xc6e6('0x10e')],{});db['FaxTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x47')],{'foreignKey':_0xc6e6('0x1de'),'as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1db'),'as':_0xc6e6('0x1d2')});db[_0xc6e6('0xe4')]['belongsTo'](db['User'],{'foreignKey':_0xc6e6('0x1d3'),'as':_0xc6e6('0x1d4')});db[_0xc6e6('0xe4')][_0xc6e6('0x113')](db['FaxQueue'],{'foreignKey':_0xc6e6('0x1df'),'as':_0xc6e6('0x1d6')});db[_0xc6e6('0xe4')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xc6e6('0x1e0'),'as':_0xc6e6('0x1d8')});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db[_0xc6e6('0x5a')],{});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db[_0xc6e6('0x10a')],{});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db[_0xc6e6('0x58')],{'foreignKey':_0xc6e6('0x1e1'),'as':_0xc6e6('0x1d1')});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1db'),'as':_0xc6e6('0x1d2')});db[_0xc6e6('0xe6')]['belongsTo'](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1d3'),'as':_0xc6e6('0x1d4')});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db[_0xc6e6('0x5c')],{'foreignKey':_0xc6e6('0x1e2'),'as':_0xc6e6('0x1d6')});db[_0xc6e6('0xe6')][_0xc6e6('0x113')](db['OpenchannelAccount'],{'foreignKey':_0xc6e6('0x1e3'),'as':_0xc6e6('0x1d8')});db[_0xc6e6('0xe8')]['belongsTo'](db[_0xc6e6('0x54')],{});db['SmsTransferReport'][_0xc6e6('0x113')](db['SmsInteraction'],{});db[_0xc6e6('0xe8')][_0xc6e6('0x113')](db[_0xc6e6('0x50')],{'foreignKey':'FromSmsAccountId','as':_0xc6e6('0x1d1')});db['SmsTransferReport'][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1db'),'as':_0xc6e6('0x1d2')});db[_0xc6e6('0xe8')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1d3'),'as':'ToAgent'});db[_0xc6e6('0xe8')][_0xc6e6('0x113')](db[_0xc6e6('0x56')],{'foreignKey':_0xc6e6('0x1e4'),'as':_0xc6e6('0x1d6')});db['SmsTransferReport'][_0xc6e6('0x113')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xc6e6('0x1d8')});db[_0xc6e6('0xea')]['hasMany'](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xc6e6('0xea')]['hasMany'](db[_0xc6e6('0x76')],{'as':'CustomFields','foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xea')]['hasMany'](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x119'),'onDelete':_0xc6e6('0x103'),'foreignKey':_0xc6e6('0x16e')});db['CmList'][_0xc6e6('0x105')](db['CmHopperFinal'],{'as':_0xc6e6('0x108'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xea')][_0xc6e6('0x105')](db[_0xc6e6('0x72')],{'as':_0xc6e6('0x109'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xea')][_0xc6e6('0x105')](db['ReportAgentPreview'],{'as':_0xc6e6('0x74'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xea')][_0xc6e6('0x115')](db['VoiceQueue'],{'as':_0xc6e6('0x1e5'),'through':_0xc6e6('0x14a')});db[_0xc6e6('0xea')][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x11c')});db[_0xc6e6('0xec')][_0xc6e6('0x105')](db[_0xc6e6('0x17')],{'as':'Extensions','onDelete':_0xc6e6('0x103')});db['VoicePrefix'][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x14b'),'through':'UserVoicePrefix'});db[_0xc6e6('0xec')][_0xc6e6('0x115')](db[_0xc6e6('0x11d')],{'through':'TeamVoicePrefix','as':_0xc6e6('0x14c')});db[_0xc6e6('0xee')][_0xc6e6('0x105')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x166'),'foreignKey':_0xc6e6('0x114')});db[_0xc6e6('0xee')]['hasMany'](db[_0xc6e6('0xf0')],{'as':_0xc6e6('0x1e6'),'foreignKey':_0xc6e6('0x114'),'onDelete':_0xc6e6('0x103')});db[_0xc6e6('0xf0')]['hasMany'](db[_0xc6e6('0xf2')],{'as':'Resources','foreignKey':_0xc6e6('0x1e7'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0xc6e6('0x7d')],{'as':_0xc6e6('0x15b'),'foreignKey':'WhatsappAccountId','onDelete':_0xc6e6('0x103')});db[_0xc6e6('0xf5')][_0xc6e6('0x105')](db[_0xc6e6('0x7b')],{'as':_0xc6e6('0x184'),'foreignKey':'WhatsappAccountId'});db[_0xc6e6('0xf5')][_0xc6e6('0x105')](db['WhatsappMessage'],{'as':_0xc6e6('0x151'),'foreignKey':'WhatsappAccountId'});db[_0xc6e6('0xf5')][_0xc6e6('0x105')](db[_0xc6e6('0xf7')],{'as':_0xc6e6('0x171')});db['WhatsappAccount'][_0xc6e6('0x105')](db[_0xc6e6('0xf6')],{'as':_0xc6e6('0x13f')});db[_0xc6e6('0xf5')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0xf5')][_0xc6e6('0x113')](db['Pause'],{'as':_0xc6e6('0x148'),'foreignKey':_0xc6e6('0x149')});db[_0xc6e6('0xf5')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':'user_has_whatsapp_accounts'});db[_0xc6e6('0xf6')][_0xc6e6('0x113')](db['User'],{'onDelete':'restrict'});db[_0xc6e6('0xf6')][_0xc6e6('0x113')](db['WhatsappQueue'],{'onDelete':_0xc6e6('0x16b')});db[_0xc6e6('0xf6')][_0xc6e6('0x113')](db['WhatsappAccount'],{'onDelete':_0xc6e6('0x16b')});db['WhatsappApplication'][_0xc6e6('0x113')](db[_0xc6e6('0x80')],{'onDelete':_0xc6e6('0x16b'),'foreignKey':'IntervalId'});db[_0xc6e6('0xf6')][_0xc6e6('0x113')](db[_0xc6e6('0x8b')],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction']['hasMany'](db[_0xc6e6('0xf9')],{'as':_0xc6e6('0x151'),'onDelete':_0xc6e6('0x103'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0xc6e6('0xf5')],{'as':_0xc6e6('0x161'),'foreignKey':_0xc6e6('0x1e8')});db['WhatsappInteraction']['belongsTo'](db[_0xc6e6('0x118')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc6e6('0xf7')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x17a'),'foreignKey':'UserId'});db[_0xc6e6('0xf7')]['belongsToMany'](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x1a2'),'as':'Tags'});db[_0xc6e6('0xf7')][_0xc6e6('0x115')](db[_0xc6e6('0x8b')],{'through':_0xc6e6('0x1a2'),'as':_0xc6e6('0x165')});db[_0xc6e6('0xf7')][_0xc6e6('0x115')](db['User'],{'as':_0xc6e6('0x166'),'through':'user_has_whatsapp_interactions','foreignKey':_0xc6e6('0x1e9')});db[_0xc6e6('0xf9')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'as':'User'});db[_0xc6e6('0xf9')]['belongsTo'](db[_0xc6e6('0x118')],{'onDelete':'cascade','as':_0xc6e6('0x156')});db[_0xc6e6('0xf9')][_0xc6e6('0x113')](db[_0xc6e6('0xf7')],{'onDelete':'cascade','as':_0xc6e6('0x168'),'foreignKey':_0xc6e6('0x1e9')});db[_0xc6e6('0xf9')][_0xc6e6('0x113')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xc6e6('0x1e8')});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db[_0xc6e6('0xf5')],{});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db[_0xc6e6('0xea')],{'as':_0xc6e6('0x15d'),'foreignKey':_0xc6e6('0x16e')});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db[_0xc6e6('0x118')],{'as':_0xc6e6('0x156'),'foreignKey':_0xc6e6('0x162')});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db[_0xc6e6('0xf7')],{});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db['WhatsappQueue'],{});db[_0xc6e6('0x1ea')][_0xc6e6('0x113')](db[_0xc6e6('0xf9')],{});db[_0xc6e6('0x1ea')]['belongsTo'](db[_0xc6e6('0x13')],{});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0xf9')],{});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0xf7')],{});db[_0xc6e6('0xfc')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xc6e6('0x1eb'),'as':_0xc6e6('0x1d1')});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0xf5')],{'foreignKey':'ToWhatsappAccountId','as':_0xc6e6('0x1d8')});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0x12e')],{'foreignKey':_0xc6e6('0x1ec'),'as':'ToQueue'});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1db'),'as':_0xc6e6('0x1d2')});db[_0xc6e6('0xfc')][_0xc6e6('0x113')](db[_0xc6e6('0x13')],{'foreignKey':_0xc6e6('0x1d3'),'as':_0xc6e6('0x1d4')});db[_0xc6e6('0x12e')][_0xc6e6('0x115')](db[_0xc6e6('0x13')],{'as':_0xc6e6('0x14b'),'through':_0xc6e6('0x36'),'foreignKey':_0xc6e6('0x1ed')});db[_0xc6e6('0x12e')]['belongsToMany'](db['Team'],{'through':_0xc6e6('0x1c9'),'as':_0xc6e6('0x14c')});module[_0xc6e6('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2776474..245ed98 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x713d=['/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','get','appPath','/index.html','username','password','apiKey','lastName','phone','mobile','fax','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','}@@','includes','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','./safe-template','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','headers','x-forwarded-for','remoteAddress','url','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','connection','statusCode','name','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713d,0x16f));var _0xd713=function(_0x217d0e,_0x5caef1){_0x217d0e=_0x217d0e-0x0;var _0x27d44a=_0x713d[_0x217d0e];return _0x27d44a;};'use strict';var _=require('lodash');var path=require(_0xd713('0x0'));var express=require(_0xd713('0x1'));var ewinston=require(_0xd713('0x2'));var util=require(_0xd713('0x3'));var errors=require(_0xd713('0x4'));var config=require(_0xd713('0x5'));var logger=require(_0xd713('0x6'))(_0xd713('0x7'));var authLogger=require(_0xd713('0x6'))(_0xd713('0x8'));var safeTemplate=require(_0xd713('0x9'))['safeTemplate'];exports[_0xd713('0xa')]=function(_0x304b8f){_0x304b8f[_0xd713('0xb')](ewinston[_0xd713('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x383dda,_0x3ed51f){var _0x1f6c14=_0xd713('0xd');if(!_['isEmpty'](_0x383dda['body'])){_0x1f6c14+='\x20body=%s';var _0x5f4ebc=_0x383dda[_0xd713('0xe')];maskSensitiveData(_0x5f4ebc);}return safeTemplate(util[_0xd713('0xf')](_0x1f6c14,_0x383dda['method'],_0x383dda[_0xd713('0x10')][_0xd713('0x11')]?_0x383dda[_0xd713('0x10')]['x-forwarded-for']:_0x383dda['connection'][_0xd713('0x12')]||_0x383dda['ip'],_0x383dda[_0xd713('0x13')],_0x3ed51f['statusCode'],_0x3ed51f[_0xd713('0x14')],_0x383dda[_0xd713('0x15')]?_0x383dda['user']['id']:null,_0x383dda['user']?_0x383dda['user']['name']:null,_0x383dda['user']?_0x383dda[_0xd713('0x15')][_0xd713('0x16')]:null,_0x5f4ebc?util['inspect'](_0x5f4ebc,![],null):''));}}));_0x304b8f[_0xd713('0xb')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1e2605,_0x3dd240){var _0x229aaf=_0xd713('0x17');if(_0x1e2605['body']&&_0x1e2605[_0xd713('0xe')][_0xd713('0x18')]&&_0x1e2605[_0xd713('0xe')][_0xd713('0x19')]){_0x229aaf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xd713('0xf')](_0x229aaf,_0x1e2605[_0xd713('0x1a')],_0x1e2605[_0xd713('0x10')][_0xd713('0x11')]?_0x1e2605[_0xd713('0x10')][_0xd713('0x11')]:_0x1e2605[_0xd713('0x1b')]['remoteAddress']||_0x1e2605['ip'],_0x1e2605[_0xd713('0x13')],_0x3dd240[_0xd713('0x1c')],_0x3dd240[_0xd713('0x14')],_0x1e2605[_0xd713('0x15')]?_0x1e2605[_0xd713('0x15')]['id']:null,_0x1e2605[_0xd713('0x15')]?_0x1e2605[_0xd713('0x15')][_0xd713('0x1d')]:null,_0x1e2605[_0xd713('0x15')]?_0x1e2605[_0xd713('0x15')][_0xd713('0x16')]:null,_0x1e2605[_0xd713('0xe')]&&_0x1e2605['body'][_0xd713('0x18')]?_0x1e2605[_0xd713('0xe')][_0xd713('0x18')]:'other',_0x1e2605[_0xd713('0xe')]&&_0x1e2605[_0xd713('0xe')][_0xd713('0x19')]?_0x1e2605['body'][_0xd713('0x19')]:'',_0x1e2605[_0xd713('0xe')]&&_0x1e2605[_0xd713('0xe')][_0xd713('0x1e')]?_0x1e2605[_0xd713('0xe')][_0xd713('0x1e')]:'');},'ignoreRoute':function(_0x47c10d){var _0x178442=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x178442['test'](_0x47c10d[_0xd713('0x13')]);}}));_0x304b8f[_0xd713('0xb')](_0xd713('0x1f'),require(_0xd713('0x20')));_0x304b8f[_0xd713('0xb')](_0xd713('0x21'),require('./api/voiceChanSpy'));_0x304b8f[_0xd713('0xb')](_0xd713('0x22'),require(_0xd713('0x23')));_0x304b8f[_0xd713('0xb')]('/api/voice/extensions',require(_0xd713('0x24')));_0x304b8f['use'](_0xd713('0x25'),require('./api/voiceMusicOnHold'));_0x304b8f[_0xd713('0xb')](_0xd713('0x26'),require(_0xd713('0x27')));_0x304b8f[_0xd713('0xb')](_0xd713('0x28'),require('./api/voiceRecording'));_0x304b8f[_0xd713('0xb')](_0xd713('0x29'),require(_0xd713('0x2a')));_0x304b8f[_0xd713('0xb')](_0xd713('0x2b'),require('./api/voiceMail'));_0x304b8f[_0xd713('0xb')](_0xd713('0x2c'),require(_0xd713('0x2d')));_0x304b8f[_0xd713('0xb')](_0xd713('0x2e'),require(_0xd713('0x2f')));_0x304b8f[_0xd713('0xb')](_0xd713('0x30'),require(_0xd713('0x31')));_0x304b8f[_0xd713('0xb')]('/api/voice/agents/reports',require(_0xd713('0x32')));_0x304b8f[_0xd713('0xb')](_0xd713('0x33'),require('./api/voiceQueueReport'));_0x304b8f['use']('/api/members/reports',require('./api/memberReport'));_0x304b8f['use'](_0xd713('0x34'),require(_0xd713('0x35')));_0x304b8f[_0xd713('0xb')](_0xd713('0x36'),require('./api/voiceTransferReport'));_0x304b8f[_0xd713('0xb')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x304b8f[_0xd713('0xb')](_0xd713('0x37'),require(_0xd713('0x38')));_0x304b8f[_0xd713('0xb')](_0xd713('0x39'),require(_0xd713('0x3a')));_0x304b8f['use']('/api/mail/substatuses',require(_0xd713('0x3b')));_0x304b8f[_0xd713('0xb')](_0xd713('0x3c'),require(_0xd713('0x3d')));_0x304b8f[_0xd713('0xb')](_0xd713('0x3e'),require('./api/mailMessage'));_0x304b8f[_0xd713('0xb')](_0xd713('0x3f'),require(_0xd713('0x40')));_0x304b8f[_0xd713('0xb')]('/api/mail/reports/queue',require(_0xd713('0x41')));_0x304b8f['use'](_0xd713('0x42'),require(_0xd713('0x43')));_0x304b8f['use'](_0xd713('0x44'),require('./api/dashboardItem'));_0x304b8f['use'](_0xd713('0x45'),require(_0xd713('0x46')));_0x304b8f[_0xd713('0xb')](_0xd713('0x47'),require(_0xd713('0x48')));_0x304b8f[_0xd713('0xb')](_0xd713('0x49'),require(_0xd713('0x4a')));_0x304b8f[_0xd713('0xb')]('/api/fax/messages',require(_0xd713('0x4b')));_0x304b8f['use']('/api/fax/queues',require(_0xd713('0x4c')));_0x304b8f['use'](_0xd713('0x4d'),require('./api/faxQueueReport'));_0x304b8f['use'](_0xd713('0x4e'),require(_0xd713('0x4f')));_0x304b8f[_0xd713('0xb')](_0xd713('0x50'),require(_0xd713('0x51')));_0x304b8f[_0xd713('0xb')](_0xd713('0x52'),require(_0xd713('0x53')));_0x304b8f[_0xd713('0xb')](_0xd713('0x54'),require(_0xd713('0x55')));_0x304b8f[_0xd713('0xb')](_0xd713('0x56'),require(_0xd713('0x57')));_0x304b8f[_0xd713('0xb')](_0xd713('0x58'),require(_0xd713('0x59')));_0x304b8f[_0xd713('0xb')](_0xd713('0x5a'),require('./api/openchannelApplication'));_0x304b8f[_0xd713('0xb')]('/api/openchannel/interactions',require(_0xd713('0x5b')));_0x304b8f[_0xd713('0xb')](_0xd713('0x5c'),require('./api/openchannelMessage'));_0x304b8f[_0xd713('0xb')](_0xd713('0x5d'),require('./api/openchannelQueue'));_0x304b8f[_0xd713('0xb')]('/api/chat/websites',require('./api/chatWebsite'));_0x304b8f[_0xd713('0xb')]('/api/openchannel/reports/queue',require(_0xd713('0x5e')));_0x304b8f[_0xd713('0xb')](_0xd713('0x5f'),require(_0xd713('0x60')));_0x304b8f['use'](_0xd713('0x61'),require(_0xd713('0x62')));_0x304b8f[_0xd713('0xb')]('/api/chat/messages',require('./api/chatMessage'));_0x304b8f[_0xd713('0xb')](_0xd713('0x63'),require('./api/chatOfflineMessage'));_0x304b8f[_0xd713('0xb')]('/api/chat/queues',require('./api/chatQueue'));_0x304b8f[_0xd713('0xb')](_0xd713('0x64'),require(_0xd713('0x65')));_0x304b8f[_0xd713('0xb')]('/api/chat/proactive_actions',require(_0xd713('0x66')));_0x304b8f[_0xd713('0xb')]('/api/cm/companies',require('./api/cmCompany'));_0x304b8f[_0xd713('0xb')](_0xd713('0x67'),require(_0xd713('0x68')));_0x304b8f[_0xd713('0xb')](_0xd713('0x69'),require(_0xd713('0x6a')));_0x304b8f[_0xd713('0xb')]('/api/cm/hopper_black',require(_0xd713('0x6b')));_0x304b8f[_0xd713('0xb')]('/api/cm/hopper_final',require(_0xd713('0x6c')));_0x304b8f[_0xd713('0xb')](_0xd713('0x6d'),require('./api/cmHopperHistory'));_0x304b8f[_0xd713('0xb')](_0xd713('0x6e'),require(_0xd713('0x6f')));_0x304b8f['use'](_0xd713('0x70'),require(_0xd713('0x71')));_0x304b8f[_0xd713('0xb')](_0xd713('0x72'),require('./api/automation'));_0x304b8f[_0xd713('0xb')]('/api/canned_answers',require(_0xd713('0x73')));_0x304b8f[_0xd713('0xb')](_0xd713('0x74'),require('./api/disposition'));_0x304b8f[_0xd713('0xb')](_0xd713('0x75'),require('./api/condition'));_0x304b8f['use'](_0xd713('0x76'),require(_0xd713('0x77')));_0x304b8f[_0xd713('0xb')](_0xd713('0x78'),require(_0xd713('0x79')));_0x304b8f[_0xd713('0xb')](_0xd713('0x7a'),require(_0xd713('0x7b')));_0x304b8f[_0xd713('0xb')](_0xd713('0x7c'),require(_0xd713('0x7d')));_0x304b8f[_0xd713('0xb')](_0xd713('0x7e'),require('./api/schedule'));_0x304b8f[_0xd713('0xb')](_0xd713('0x7f'),require(_0xd713('0x80')));_0x304b8f[_0xd713('0xb')](_0xd713('0x81'),require(_0xd713('0x82')));_0x304b8f[_0xd713('0xb')](_0xd713('0x83'),require('./api/template'));_0x304b8f[_0xd713('0xb')](_0xd713('0x84'),require(_0xd713('0x85')));_0x304b8f['use'](_0xd713('0x86'),require(_0xd713('0x87')));_0x304b8f['use']('/api/integrations',require(_0xd713('0x88')));_0x304b8f[_0xd713('0xb')]('/api/integrations/reports',require(_0xd713('0x89')));_0x304b8f[_0xd713('0xb')](_0xd713('0x8a'),require(_0xd713('0x8b')));_0x304b8f[_0xd713('0xb')](_0xd713('0x8c'),require(_0xd713('0x8d')));_0x304b8f['use'](_0xd713('0x8e'),require(_0xd713('0x8f')));_0x304b8f[_0xd713('0xb')](_0xd713('0x90'),require('./api/analyticMetric'));_0x304b8f['use'](_0xd713('0x91'),require('./api/analyticFieldReport'));_0x304b8f['use'](_0xd713('0x92'),require(_0xd713('0x93')));_0x304b8f[_0xd713('0xb')]('/api/integrations/salesforce/accounts',require(_0xd713('0x94')));_0x304b8f['use'](_0xd713('0x95'),require(_0xd713('0x96')));_0x304b8f['use'](_0xd713('0x97'),require(_0xd713('0x98')));_0x304b8f['use']('/api/integrations/sugarcrm/accounts',require(_0xd713('0x99')));_0x304b8f[_0xd713('0xb')]('/api/integrations/sugarcrm/configurations',require(_0xd713('0x9a')));_0x304b8f[_0xd713('0xb')](_0xd713('0x9b'),require(_0xd713('0x9c')));_0x304b8f['use'](_0xd713('0x9d'),require(_0xd713('0x9e')));_0x304b8f[_0xd713('0xb')](_0xd713('0x9f'),require(_0xd713('0xa0')));_0x304b8f['use']('/api/integrations/desk/fields',require(_0xd713('0xa1')));_0x304b8f[_0xd713('0xb')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x304b8f[_0xd713('0xb')](_0xd713('0xa2'),require(_0xd713('0xa3')));_0x304b8f[_0xd713('0xb')]('/api/integrations/zoho/fields',require(_0xd713('0xa4')));_0x304b8f['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x304b8f['use']('/api/integrations/zendesk/configurations',require(_0xd713('0xa5')));_0x304b8f[_0xd713('0xb')](_0xd713('0xa6'),require(_0xd713('0xa7')));_0x304b8f[_0xd713('0xb')]('/api/integrations/freshdesk/accounts',require(_0xd713('0xa8')));_0x304b8f[_0xd713('0xb')](_0xd713('0xa9'),require(_0xd713('0xaa')));_0x304b8f[_0xd713('0xb')]('/api/integrations/freshdesk/fields',require(_0xd713('0xab')));_0x304b8f[_0xd713('0xb')](_0xd713('0xac'),require(_0xd713('0xad')));_0x304b8f[_0xd713('0xb')](_0xd713('0xae'),require(_0xd713('0xaf')));_0x304b8f['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x304b8f['use'](_0xd713('0xb0'),require(_0xd713('0xb1')));_0x304b8f['use'](_0xd713('0xb2'),require(_0xd713('0xb3')));_0x304b8f[_0xd713('0xb')](_0xd713('0xb4'),require(_0xd713('0xb5')));_0x304b8f[_0xd713('0xb')]('/api/integrations/dynamics365/accounts',require(_0xd713('0xb6')));_0x304b8f[_0xd713('0xb')](_0xd713('0xb7'),require('./api/intDynamics365Configuration'));_0x304b8f[_0xd713('0xb')](_0xd713('0xb8'),require(_0xd713('0xb9')));_0x304b8f['use']('/api/integrations/freshsales/accounts',require(_0xd713('0xba')));_0x304b8f['use'](_0xd713('0xbb'),require(_0xd713('0xbc')));_0x304b8f[_0xd713('0xb')](_0xd713('0xbd'),require('./api/intFreshsalesField'));_0x304b8f[_0xd713('0xb')]('/api/networks',require(_0xd713('0xbe')));_0x304b8f['use'](_0xd713('0xbf'),require('./api/chatQueueReport'));_0x304b8f['use'](_0xd713('0xc0'),require(_0xd713('0xc1')));_0x304b8f['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x304b8f[_0xd713('0xb')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x304b8f['use'](_0xd713('0xc2'),require(_0xd713('0xc3')));_0x304b8f['use'](_0xd713('0xc4'),require(_0xd713('0xc5')));_0x304b8f[_0xd713('0xb')](_0xd713('0xc6'),require(_0xd713('0xc7')));_0x304b8f[_0xd713('0xb')](_0xd713('0xc8'),require(_0xd713('0xc9')));_0x304b8f[_0xd713('0xb')]('/api/jscripty/projects',require(_0xd713('0xca')));_0x304b8f[_0xd713('0xb')](_0xd713('0xcb'),require('./api/setting'));_0x304b8f['use'](_0xd713('0xcc'),require(_0xd713('0xcd')));_0x304b8f[_0xd713('0xb')]('/api/square/projects',require('./api/squareProject'));_0x304b8f[_0xd713('0xb')](_0xd713('0xce'),require(_0xd713('0xcf')));_0x304b8f[_0xd713('0xb')]('/api/square/messages',require(_0xd713('0xd0')));_0x304b8f[_0xd713('0xb')](_0xd713('0xd1'),require(_0xd713('0xd2')));_0x304b8f[_0xd713('0xb')](_0xd713('0xd3'),require('./api/license'));_0x304b8f['use']('/api/campaigns',require(_0xd713('0xd4')));_0x304b8f[_0xd713('0xb')](_0xd713('0xd5'),require(_0xd713('0xd6')));_0x304b8f[_0xd713('0xb')](_0xd713('0xd7'),require(_0xd713('0xd8')));_0x304b8f[_0xd713('0xb')](_0xd713('0xd9'),require('./api/plugin'));_0x304b8f[_0xd713('0xb')](_0xd713('0xda'),require(_0xd713('0xdb')));_0x304b8f[_0xd713('0xb')]('/api/chat/reports/transfer',require(_0xd713('0xdc')));_0x304b8f['use'](_0xd713('0xdd'),require('./api/faxTransferReport'));_0x304b8f[_0xd713('0xb')](_0xd713('0xde'),require(_0xd713('0xdf')));_0x304b8f[_0xd713('0xb')]('/api/sms/reports/transfer',require(_0xd713('0xe0')));_0x304b8f[_0xd713('0xb')]('/api/cm/lists',require('./api/cmList'));_0x304b8f[_0xd713('0xb')](_0xd713('0xe1'),require('./api/voicePrefix'));_0x304b8f[_0xd713('0xb')](_0xd713('0xe2'),require(_0xd713('0xe3')));_0x304b8f[_0xd713('0xb')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x304b8f['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0x304b8f[_0xd713('0xb')](_0xd713('0xe4'),require(_0xd713('0xe5')));_0x304b8f[_0xd713('0xb')](_0xd713('0xe6'),require(_0xd713('0xe7')));_0x304b8f['use'](_0xd713('0xe8'),require(_0xd713('0xe9')));_0x304b8f[_0xd713('0xb')]('/api/whatsapp/interactions',require(_0xd713('0xea')));_0x304b8f[_0xd713('0xb')](_0xd713('0xeb'),require(_0xd713('0xec')));_0x304b8f[_0xd713('0xb')]('/api/whatsapp/reports/queue',require(_0xd713('0xed')));_0x304b8f[_0xd713('0xb')]('/api/whatsapp/reports/transfer',require(_0xd713('0xee')));_0x304b8f['use'](_0xd713('0xef'),require('./api/whatsappQueue'));_0x304b8f[_0xd713('0xb')]('/api/cloudProviders',require('./api/cloudProvider'));_0x304b8f['use']('/api/realtime',require(_0xd713('0xf0')));_0x304b8f[_0xd713('0xb')](_0xd713('0xf1'),require(_0xd713('0xf2')));_0x304b8f['use']('/api/auth/google',require(_0xd713('0xf3')));_0x304b8f['use'](_0xd713('0xf4'),require('./api/jira'));_0x304b8f[_0xd713('0xb')](_0xd713('0xf5'),require(_0xd713('0xf6')));_0x304b8f[_0xd713('0xb')](_0xd713('0xf7'),require(_0xd713('0xf8')));_0x304b8f[_0xd713('0xb')]('/api/system',require(_0xd713('0xf9')));_0x304b8f[_0xd713('0xb')](_0xd713('0xfa'),require(_0xd713('0xfb')));_0x304b8f[_0xd713('0xb')]('/api/webbar',require(_0xd713('0xfc')));_0x304b8f['use'](_0xd713('0xfd'),express[_0xd713('0xfe')](path[_0xd713('0xff')](config[_0xd713('0x100')],'/apidoc')));_0x304b8f[_0xd713('0xb')](_0xd713('0x101'),express[_0xd713('0xfe')](path['join'](config[_0xd713('0x100')],_0xd713('0x101'))));_0x304b8f[_0xd713('0xb')](_0xd713('0x102'),express[_0xd713('0xfe')](path['join'](config['root'],_0xd713('0x102'))));_0x304b8f[_0xd713('0xb')](_0xd713('0x103'),express[_0xd713('0xfe')](path[_0xd713('0xff')](config['root'],'snippet',_0xd713('0x104'))));_0x304b8f[_0xd713('0xb')](_0xd713('0x105'),express[_0xd713('0xfe')](path[_0xd713('0xff')](config[_0xd713('0x100')],_0xd713('0x106'))));_0x304b8f[_0xd713('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xd713('0x108')](errors[0x194]);_0x304b8f[_0xd713('0x107')]('/*')[_0xd713('0x108')](function(_0x3d3170,_0x1881b9){_0x1881b9['sendFile'](path['resolve'](_0x304b8f[_0xd713('0x108')](_0xd713('0x109'))+_0xd713('0x10a')));});};var sensitiveFields=[_0xd713('0x10b'),_0xd713('0x10c'),'newPassword',_0xd713('0x10d'),'firstName',_0xd713('0x10e'),'street',_0xd713('0x10f'),_0xd713('0x110'),_0xd713('0x111'),_0xd713('0x112'),_0xd713('0x113'),'clientSecret',_0xd713('0x114'),_0xd713('0x115'),_0xd713('0x116'),_0xd713('0x117'),_0xd713('0x118'),_0xd713('0x119'),_0xd713('0x11a'),_0xd713('0x11b'),_0xd713('0x11c'),_0xd713('0x11d'),_0xd713('0x11e'),_0xd713('0x11f'),_0xd713('0x120'),_0xd713('0x121'),_0xd713('0x122'),_0xd713('0x123'),_0xd713('0x124'),_0xd713('0x125'),_0xd713('0x126'),_0xd713('0x127'),_0xd713('0x128'),_0xd713('0x15'),'pass','accountSid','localstationid','dsn',_0xd713('0x129'),_0xd713('0x12a'),_0xd713('0x12b')];function maskSensitiveData(_0x4ce7f5){var _0x4a770a=/(?!^)[\s\S](?!$)/g;if(!_[_0xd713('0x12c')](_0x4ce7f5))return;for(var _0x1aa0a7 in _0x4ce7f5){if(_[_0xd713('0x12d')](_0x4ce7f5[_0x1aa0a7])){for(var _0x1b8b70=0x0;_0x1b8b70<_0x4ce7f5[_0x1aa0a7]['length'];_0x1b8b70++){maskSensitiveData(_0x4ce7f5[_0x1aa0a7][_0x1b8b70]);}}else if(_[_0xd713('0x12c')](_0x4ce7f5[_0x1aa0a7])){maskSensitiveData(_0x4ce7f5[_0x1aa0a7]);}else if(_[_0xd713('0x12e')](_0x4ce7f5[_0x1aa0a7])){_0x4ce7f5[_0x1aa0a7]=_0x4ce7f5[_0x1aa0a7][_0xd713('0x12f')](/{{{/g,'@@{')[_0xd713('0x12f')](/}}}/g,_0xd713('0x130'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xd713('0x131')](sensitiveFields,_0x1aa0a7)){_0x4ce7f5[_0x1aa0a7]=_0x4ce7f5[_0x1aa0a7][_0xd713('0x12f')](_0x4a770a,'*');}}}} \ No newline at end of file +var _0x4528=['./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','root','/www','static','join','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','newPassword','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','key','pass','accountSid','secret','registry','isPlainObject','length','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','api','./safe-template','safeTemplate','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','statusCode','other','agent_name','test','use','/api/users','./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/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4528,0x1a3));var _0x8452=function(_0x5905f6,_0x3bf88f){_0x5905f6=_0x5905f6-0x0;var _0x3ce641=_0x4528[_0x5905f6];return _0x3ce641;};'use strict';var _=require(_0x8452('0x0'));var path=require(_0x8452('0x1'));var express=require(_0x8452('0x2'));var ewinston=require('express-winston');var util=require(_0x8452('0x3'));var errors=require(_0x8452('0x4'));var config=require(_0x8452('0x5'));var logger=require(_0x8452('0x6'))(_0x8452('0x7'));var authLogger=require(_0x8452('0x6'))('auth');var safeTemplate=require(_0x8452('0x8'))[_0x8452('0x9')];exports[_0x8452('0xa')]=function(_0xc005f6){_0xc005f6['use'](ewinston[_0x8452('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x10b113,_0x16ac20){var _0x2f59a2=_0x8452('0xc');if(!_[_0x8452('0xd')](_0x10b113[_0x8452('0xe')])){_0x2f59a2+=_0x8452('0xf');var _0x283ca3=_0x10b113[_0x8452('0xe')];maskSensitiveData(_0x283ca3);}return safeTemplate(util['format'](_0x2f59a2,_0x10b113[_0x8452('0x10')],_0x10b113[_0x8452('0x11')][_0x8452('0x12')]?_0x10b113[_0x8452('0x11')][_0x8452('0x12')]:_0x10b113[_0x8452('0x13')][_0x8452('0x14')]||_0x10b113['ip'],_0x10b113[_0x8452('0x15')],_0x16ac20['statusCode'],_0x16ac20[_0x8452('0x16')],_0x10b113['user']?_0x10b113[_0x8452('0x17')]['id']:null,_0x10b113['user']?_0x10b113['user'][_0x8452('0x18')]:null,_0x10b113[_0x8452('0x17')]?_0x10b113[_0x8452('0x17')][_0x8452('0x19')]:null,_0x283ca3?util[_0x8452('0x1a')](_0x283ca3,![],null):''));}}));_0xc005f6['use'](ewinston[_0x8452('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2e0ac4,_0x40e094){var _0x140c07=_0x8452('0x1b');if(_0x2e0ac4[_0x8452('0xe')]&&_0x2e0ac4[_0x8452('0xe')][_0x8452('0x1c')]&&_0x2e0ac4[_0x8452('0xe')][_0x8452('0x1d')]){_0x140c07=_0x8452('0x1e');}return util[_0x8452('0x1f')](_0x140c07,_0x2e0ac4[_0x8452('0x10')],_0x2e0ac4[_0x8452('0x11')][_0x8452('0x12')]?_0x2e0ac4[_0x8452('0x11')][_0x8452('0x12')]:_0x2e0ac4[_0x8452('0x13')][_0x8452('0x14')]||_0x2e0ac4['ip'],_0x2e0ac4[_0x8452('0x15')],_0x40e094[_0x8452('0x20')],_0x40e094[_0x8452('0x16')],_0x2e0ac4[_0x8452('0x17')]?_0x2e0ac4[_0x8452('0x17')]['id']:null,_0x2e0ac4['user']?_0x2e0ac4['user'][_0x8452('0x18')]:null,_0x2e0ac4['user']?_0x2e0ac4['user']['role']:null,_0x2e0ac4[_0x8452('0xe')]&&_0x2e0ac4[_0x8452('0xe')][_0x8452('0x1c')]?_0x2e0ac4[_0x8452('0xe')][_0x8452('0x1c')]:_0x8452('0x21'),_0x2e0ac4[_0x8452('0xe')]&&_0x2e0ac4[_0x8452('0xe')][_0x8452('0x1d')]?_0x2e0ac4['body'][_0x8452('0x1d')]:'',_0x2e0ac4['body']&&_0x2e0ac4[_0x8452('0xe')][_0x8452('0x22')]?_0x2e0ac4[_0x8452('0xe')]['agent_name']:'');},'ignoreRoute':function(_0x116cda){var _0x3a2e9e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3a2e9e[_0x8452('0x23')](_0x116cda[_0x8452('0x15')]);}}));_0xc005f6[_0x8452('0x24')](_0x8452('0x25'),require(_0x8452('0x26')));_0xc005f6['use'](_0x8452('0x27'),require(_0x8452('0x28')));_0xc005f6[_0x8452('0x24')](_0x8452('0x29'),require(_0x8452('0x2a')));_0xc005f6[_0x8452('0x24')](_0x8452('0x2b'),require(_0x8452('0x2c')));_0xc005f6[_0x8452('0x24')](_0x8452('0x2d'),require('./api/voiceMusicOnHold'));_0xc005f6[_0x8452('0x24')](_0x8452('0x2e'),require(_0x8452('0x2f')));_0xc005f6[_0x8452('0x24')]('/api/voice/recordings',require('./api/voiceRecording'));_0xc005f6[_0x8452('0x24')](_0x8452('0x30'),require(_0x8452('0x31')));_0xc005f6[_0x8452('0x24')](_0x8452('0x32'),require(_0x8452('0x33')));_0xc005f6['use'](_0x8452('0x34'),require(_0x8452('0x35')));_0xc005f6[_0x8452('0x24')]('/api/voice/calls/reports',require(_0x8452('0x36')));_0xc005f6['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0xc005f6[_0x8452('0x24')](_0x8452('0x37'),require(_0x8452('0x38')));_0xc005f6[_0x8452('0x24')](_0x8452('0x39'),require(_0x8452('0x3a')));_0xc005f6[_0x8452('0x24')]('/api/members/reports',require(_0x8452('0x3b')));_0xc005f6[_0x8452('0x24')]('/api/trunks',require(_0x8452('0x3c')));_0xc005f6[_0x8452('0x24')]('/api/voice/transfers/reports',require(_0x8452('0x3d')));_0xc005f6['use'](_0x8452('0x3e'),require('./api/mailServerOut'));_0xc005f6[_0x8452('0x24')]('/api/mail/accounts',require(_0x8452('0x3f')));_0xc005f6[_0x8452('0x24')](_0x8452('0x40'),require(_0x8452('0x41')));_0xc005f6[_0x8452('0x24')](_0x8452('0x42'),require(_0x8452('0x43')));_0xc005f6['use'](_0x8452('0x44'),require(_0x8452('0x45')));_0xc005f6[_0x8452('0x24')](_0x8452('0x46'),require(_0x8452('0x47')));_0xc005f6[_0x8452('0x24')](_0x8452('0x48'),require(_0x8452('0x49')));_0xc005f6[_0x8452('0x24')]('/api/mail/reports/queue',require(_0x8452('0x4a')));_0xc005f6[_0x8452('0x24')]('/api/dashboards',require(_0x8452('0x4b')));_0xc005f6[_0x8452('0x24')](_0x8452('0x4c'),require(_0x8452('0x4d')));_0xc005f6[_0x8452('0x24')](_0x8452('0x4e'),require('./api/faxAccount'));_0xc005f6['use'](_0x8452('0x4f'),require(_0x8452('0x50')));_0xc005f6[_0x8452('0x24')]('/api/fax/interactions',require(_0x8452('0x51')));_0xc005f6['use']('/api/fax/messages',require('./api/faxMessage'));_0xc005f6[_0x8452('0x24')](_0x8452('0x52'),require(_0x8452('0x53')));_0xc005f6[_0x8452('0x24')](_0x8452('0x54'),require(_0x8452('0x55')));_0xc005f6[_0x8452('0x24')](_0x8452('0x56'),require(_0x8452('0x57')));_0xc005f6[_0x8452('0x24')](_0x8452('0x58'),require(_0x8452('0x59')));_0xc005f6[_0x8452('0x24')]('/api/sms/interactions',require(_0x8452('0x5a')));_0xc005f6['use'](_0x8452('0x5b'),require(_0x8452('0x5c')));_0xc005f6[_0x8452('0x24')]('/api/sms/queues',require(_0x8452('0x5d')));_0xc005f6['use'](_0x8452('0x5e'),require('./api/openchannelAccount'));_0xc005f6[_0x8452('0x24')](_0x8452('0x5f'),require(_0x8452('0x60')));_0xc005f6[_0x8452('0x24')](_0x8452('0x61'),require(_0x8452('0x62')));_0xc005f6['use']('/api/openchannel/messages',require(_0x8452('0x63')));_0xc005f6[_0x8452('0x24')](_0x8452('0x64'),require('./api/openchannelQueue'));_0xc005f6[_0x8452('0x24')](_0x8452('0x65'),require('./api/chatWebsite'));_0xc005f6[_0x8452('0x24')](_0x8452('0x66'),require(_0x8452('0x67')));_0xc005f6[_0x8452('0x24')](_0x8452('0x68'),require(_0x8452('0x69')));_0xc005f6[_0x8452('0x24')](_0x8452('0x6a'),require('./api/chatInteraction'));_0xc005f6[_0x8452('0x24')](_0x8452('0x6b'),require(_0x8452('0x6c')));_0xc005f6[_0x8452('0x24')](_0x8452('0x6d'),require('./api/chatOfflineMessage'));_0xc005f6[_0x8452('0x24')](_0x8452('0x6e'),require(_0x8452('0x6f')));_0xc005f6[_0x8452('0x24')](_0x8452('0x70'),require(_0x8452('0x71')));_0xc005f6[_0x8452('0x24')](_0x8452('0x72'),require('./api/chatProactiveAction'));_0xc005f6[_0x8452('0x24')](_0x8452('0x73'),require('./api/cmCompany'));_0xc005f6[_0x8452('0x24')](_0x8452('0x74'),require(_0x8452('0x75')));_0xc005f6[_0x8452('0x24')](_0x8452('0x76'),require(_0x8452('0x77')));_0xc005f6[_0x8452('0x24')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0xc005f6[_0x8452('0x24')](_0x8452('0x78'),require('./api/cmHopperFinal'));_0xc005f6[_0x8452('0x24')](_0x8452('0x79'),require(_0x8452('0x7a')));_0xc005f6[_0x8452('0x24')](_0x8452('0x7b'),require(_0x8452('0x7c')));_0xc005f6['use'](_0x8452('0x7d'),require(_0x8452('0x7e')));_0xc005f6[_0x8452('0x24')](_0x8452('0x7f'),require(_0x8452('0x80')));_0xc005f6[_0x8452('0x24')](_0x8452('0x81'),require('./api/cannedAnswer'));_0xc005f6[_0x8452('0x24')](_0x8452('0x82'),require(_0x8452('0x83')));_0xc005f6['use'](_0x8452('0x84'),require(_0x8452('0x85')));_0xc005f6[_0x8452('0x24')](_0x8452('0x86'),require('./api/interval'));_0xc005f6['use'](_0x8452('0x87'),require('./api/pause'));_0xc005f6[_0x8452('0x24')](_0x8452('0x88'),require(_0x8452('0x89')));_0xc005f6[_0x8452('0x24')](_0x8452('0x8a'),require(_0x8452('0x8b')));_0xc005f6['use']('/api/schedules',require('./api/schedule'));_0xc005f6[_0x8452('0x24')](_0x8452('0x8c'),require(_0x8452('0x8d')));_0xc005f6[_0x8452('0x24')](_0x8452('0x8e'),require('./api/tag'));_0xc005f6['use'](_0x8452('0x8f'),require(_0x8452('0x90')));_0xc005f6[_0x8452('0x24')](_0x8452('0x91'),require(_0x8452('0x92')));_0xc005f6[_0x8452('0x24')](_0x8452('0x93'),require(_0x8452('0x94')));_0xc005f6[_0x8452('0x24')]('/api/integrations',require(_0x8452('0x95')));_0xc005f6[_0x8452('0x24')](_0x8452('0x96'),require(_0x8452('0x97')));_0xc005f6[_0x8452('0x24')](_0x8452('0x98'),require(_0x8452('0x99')));_0xc005f6['use'](_0x8452('0x9a'),require('./api/analyticDefaultReport'));_0xc005f6[_0x8452('0x24')](_0x8452('0x9b'),require(_0x8452('0x9c')));_0xc005f6[_0x8452('0x24')](_0x8452('0x9d'),require('./api/analyticMetric'));_0xc005f6['use']('/api/analytics/field_reports',require(_0x8452('0x9e')));_0xc005f6[_0x8452('0x24')](_0x8452('0x9f'),require(_0x8452('0xa0')));_0xc005f6['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xc005f6['use']('/api/integrations/salesforce/configurations',require(_0x8452('0xa1')));_0xc005f6['use']('/api/integrations/salesforce/fields',require(_0x8452('0xa2')));_0xc005f6[_0x8452('0x24')]('/api/integrations/sugarcrm/accounts',require(_0x8452('0xa3')));_0xc005f6['use'](_0x8452('0xa4'),require(_0x8452('0xa5')));_0xc005f6[_0x8452('0x24')](_0x8452('0xa6'),require(_0x8452('0xa7')));_0xc005f6[_0x8452('0x24')]('/api/integrations/desk/accounts',require(_0x8452('0xa8')));_0xc005f6[_0x8452('0x24')](_0x8452('0xa9'),require(_0x8452('0xaa')));_0xc005f6[_0x8452('0x24')](_0x8452('0xab'),require(_0x8452('0xac')));_0xc005f6['use'](_0x8452('0xad'),require('./api/intZohoAccount'));_0xc005f6[_0x8452('0x24')](_0x8452('0xae'),require(_0x8452('0xaf')));_0xc005f6['use'](_0x8452('0xb0'),require(_0x8452('0xb1')));_0xc005f6[_0x8452('0x24')]('/api/integrations/zendesk/accounts',require(_0x8452('0xb2')));_0xc005f6[_0x8452('0x24')](_0x8452('0xb3'),require(_0x8452('0xb4')));_0xc005f6[_0x8452('0x24')]('/api/integrations/zendesk/fields',require(_0x8452('0xb5')));_0xc005f6[_0x8452('0x24')](_0x8452('0xb6'),require(_0x8452('0xb7')));_0xc005f6[_0x8452('0x24')](_0x8452('0xb8'),require(_0x8452('0xb9')));_0xc005f6['use']('/api/integrations/freshdesk/fields',require(_0x8452('0xba')));_0xc005f6['use'](_0x8452('0xbb'),require('./api/intVtigerAccount'));_0xc005f6[_0x8452('0x24')]('/api/integrations/vtiger/configurations',require(_0x8452('0xbc')));_0xc005f6[_0x8452('0x24')]('/api/integrations/vtiger/fields',require(_0x8452('0xbd')));_0xc005f6[_0x8452('0x24')](_0x8452('0xbe'),require(_0x8452('0xbf')));_0xc005f6['use']('/api/integrations/servicenow/configurations',require(_0x8452('0xc0')));_0xc005f6[_0x8452('0x24')](_0x8452('0xc1'),require(_0x8452('0xc2')));_0xc005f6['use'](_0x8452('0xc3'),require(_0x8452('0xc4')));_0xc005f6[_0x8452('0x24')](_0x8452('0xc5'),require(_0x8452('0xc6')));_0xc005f6['use']('/api/integrations/dynamics365/fields',require(_0x8452('0xc7')));_0xc005f6[_0x8452('0x24')](_0x8452('0xc8'),require('./api/intFreshsalesAccount'));_0xc005f6[_0x8452('0x24')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xc005f6['use'](_0x8452('0xc9'),require('./api/intFreshsalesField'));_0xc005f6[_0x8452('0x24')](_0x8452('0xca'),require(_0x8452('0xcb')));_0xc005f6[_0x8452('0x24')]('/api/chat/reports/queue',require(_0x8452('0xcc')));_0xc005f6[_0x8452('0x24')](_0x8452('0xcd'),require(_0x8452('0xce')));_0xc005f6[_0x8452('0x24')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xc005f6['use'](_0x8452('0xcf'),require(_0x8452('0xd0')));_0xc005f6['use'](_0x8452('0xd1'),require('./api/jscriptySessionReport'));_0xc005f6[_0x8452('0x24')](_0x8452('0xd2'),require('./api/smsQueueReport'));_0xc005f6[_0x8452('0x24')]('/api/square/reports',require(_0x8452('0xd3')));_0xc005f6[_0x8452('0x24')](_0x8452('0xd4'),require(_0x8452('0xd5')));_0xc005f6[_0x8452('0x24')](_0x8452('0xd6'),require(_0x8452('0xd7')));_0xc005f6[_0x8452('0x24')](_0x8452('0xd8'),require('./api/setting'));_0xc005f6[_0x8452('0x24')]('/api/square/odbc',require(_0x8452('0xd9')));_0xc005f6[_0x8452('0x24')](_0x8452('0xda'),require('./api/squareProject'));_0xc005f6[_0x8452('0x24')](_0x8452('0xdb'),require(_0x8452('0xdc')));_0xc005f6[_0x8452('0x24')](_0x8452('0xdd'),require('./api/squareMessage'));_0xc005f6[_0x8452('0x24')]('/api/teams',require(_0x8452('0xde')));_0xc005f6[_0x8452('0x24')](_0x8452('0xdf'),require(_0x8452('0xe0')));_0xc005f6[_0x8452('0x24')]('/api/campaigns',require(_0x8452('0xe1')));_0xc005f6[_0x8452('0x24')]('/api/migrations',require(_0x8452('0xe2')));_0xc005f6[_0x8452('0x24')](_0x8452('0xe3'),require(_0x8452('0xe4')));_0xc005f6[_0x8452('0x24')](_0x8452('0xe5'),require(_0x8452('0xe6')));_0xc005f6[_0x8452('0x24')]('/api/mail/reports/transfer',require(_0x8452('0xe7')));_0xc005f6['use'](_0x8452('0xe8'),require('./api/chatTransferReport'));_0xc005f6[_0x8452('0x24')](_0x8452('0xe9'),require(_0x8452('0xea')));_0xc005f6[_0x8452('0x24')]('/api/openchannel/reports/transfer',require(_0x8452('0xeb')));_0xc005f6[_0x8452('0x24')](_0x8452('0xec'),require(_0x8452('0xed')));_0xc005f6[_0x8452('0x24')]('/api/cm/lists',require('./api/cmList'));_0xc005f6[_0x8452('0x24')](_0x8452('0xee'),require(_0x8452('0xef')));_0xc005f6[_0x8452('0x24')](_0x8452('0xf0'),require(_0x8452('0xf1')));_0xc005f6[_0x8452('0x24')]('/api/userProfile/sections',require('./api/userProfileSection'));_0xc005f6[_0x8452('0x24')](_0x8452('0xf2'),require(_0x8452('0xf3')));_0xc005f6['use'](_0x8452('0xf4'),require(_0x8452('0xf5')));_0xc005f6[_0x8452('0x24')](_0x8452('0xf6'),require(_0x8452('0xf7')));_0xc005f6[_0x8452('0x24')](_0x8452('0xf8'),require(_0x8452('0xf9')));_0xc005f6[_0x8452('0x24')](_0x8452('0xfa'),require(_0x8452('0xfb')));_0xc005f6[_0x8452('0x24')]('/api/whatsapp/messages',require(_0x8452('0xfc')));_0xc005f6[_0x8452('0x24')](_0x8452('0xfd'),require(_0x8452('0xfe')));_0xc005f6[_0x8452('0x24')](_0x8452('0xff'),require('./api/whatsappTransferReport'));_0xc005f6[_0x8452('0x24')](_0x8452('0x100'),require(_0x8452('0x101')));_0xc005f6[_0x8452('0x24')](_0x8452('0x102'),require(_0x8452('0x103')));_0xc005f6[_0x8452('0x24')](_0x8452('0x104'),require(_0x8452('0x105')));_0xc005f6[_0x8452('0x24')](_0x8452('0x106'),require(_0x8452('0x107')));_0xc005f6['use'](_0x8452('0x108'),require('./api/authGoogle'));_0xc005f6[_0x8452('0x24')](_0x8452('0x109'),require('./api/jira'));_0xc005f6['use'](_0x8452('0x10a'),require(_0x8452('0x10b')));_0xc005f6['use'](_0x8452('0x10c'),require(_0x8452('0x10d')));_0xc005f6[_0x8452('0x24')](_0x8452('0x10e'),require(_0x8452('0x10f')));_0xc005f6['use'](_0x8452('0x110'),require(_0x8452('0x111')));_0xc005f6[_0x8452('0x24')](_0x8452('0x112'),require(_0x8452('0x113')));_0xc005f6[_0x8452('0x24')]('/apidoc',express['static'](path['join'](config[_0x8452('0x114')],'/apidoc')));_0xc005f6[_0x8452('0x24')](_0x8452('0x115'),express[_0x8452('0x116')](path[_0x8452('0x117')](config[_0x8452('0x114')],_0x8452('0x115'))));_0xc005f6[_0x8452('0x24')](_0x8452('0x118'),express[_0x8452('0x116')](path[_0x8452('0x117')](config[_0x8452('0x114')],_0x8452('0x118'))));_0xc005f6[_0x8452('0x24')](_0x8452('0x119'),express[_0x8452('0x116')](path['join'](config['root'],_0x8452('0x11a'),_0x8452('0x11b'))));_0xc005f6[_0x8452('0x24')]('/plugins',express[_0x8452('0x116')](path[_0x8452('0x117')](config[_0x8452('0x114')],_0x8452('0x11c'))));_0xc005f6[_0x8452('0x11d')](_0x8452('0x11e'))[_0x8452('0x11f')](errors[0x194]);_0xc005f6[_0x8452('0x11d')]('/*')[_0x8452('0x11f')](function(_0x549415,_0x267dc8){_0x267dc8[_0x8452('0x120')](path[_0x8452('0x121')](_0xc005f6[_0x8452('0x11f')](_0x8452('0x122'))+_0x8452('0x123')));});};var sensitiveFields=['username',_0x8452('0x124'),_0x8452('0x125'),'apiKey','firstName',_0x8452('0x126'),_0x8452('0x127'),_0x8452('0x128'),'mobile',_0x8452('0x129'),_0x8452('0x12a'),_0x8452('0x12b'),_0x8452('0x12c'),_0x8452('0x12d'),_0x8452('0x12e'),'accessKey',_0x8452('0x12f'),'token',_0x8452('0x130'),_0x8452('0x131'),_0x8452('0x132'),_0x8452('0x133'),_0x8452('0x134'),'consumerSecret',_0x8452('0x135'),_0x8452('0x136'),_0x8452('0x137'),_0x8452('0x138'),_0x8452('0x139'),'clientEmail',_0x8452('0x13a'),_0x8452('0x13b'),'secretaccesskey',_0x8452('0x13c'),_0x8452('0x17'),_0x8452('0x13d'),_0x8452('0x13e'),'localstationid','dsn',_0x8452('0x13f'),_0x8452('0x140'),'oldPassword'];function maskSensitiveData(_0x113fb5){var _0x3d6d24=/(?!^)[\s\S](?!$)/g;if(!_[_0x8452('0x141')](_0x113fb5))return;for(var _0x198881 in _0x113fb5){if(_['isArray'](_0x113fb5[_0x198881])){for(var _0x31d220=0x0;_0x31d220<_0x113fb5[_0x198881][_0x8452('0x142')];_0x31d220++){maskSensitiveData(_0x113fb5[_0x198881][_0x31d220]);}}else if(_[_0x8452('0x141')](_0x113fb5[_0x198881])){maskSensitiveData(_0x113fb5[_0x198881]);}else if(_[_0x8452('0x143')](_0x113fb5[_0x198881])){_0x113fb5[_0x198881]=_0x113fb5[_0x198881][_0x8452('0x144')](/{{{/g,_0x8452('0x145'))[_0x8452('0x144')](/}}}/g,_0x8452('0x146'))['replace'](/{{/g,'@{')[_0x8452('0x144')](/}}/g,'}@');if(_[_0x8452('0x147')](sensitiveFields,_0x198881)){_0x113fb5[_0x198881]=_0x113fb5[_0x198881][_0x8452('0x144')](_0x3d6d24,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0a8698c..0e7d69c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x346a=['../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','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc'];(function(_0x45f8de,_0x24e3f4){var _0x456689=function(_0x11f963){while(--_0x11f963){_0x45f8de['push'](_0x45f8de['shift']());}};_0x456689(++_0x24e3f4);}(_0x346a,0x1d7));var _0xa346=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x346a[_0x278e3c];return _0x3e2d9b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa346('0x0'));var _=require(_0xa346('0x1'));var config=require(_0xa346('0x2'));exports[_0xa346('0x3')]=function(){return new BPromise(function(_0x11715e,_0x1104b9){var _0x130c91={};_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x5')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x6')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x7')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x8')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x9')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0xa')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0xb')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/memberReport/memberReport.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0xc')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0xd')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0xe')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0xf')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x10')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/mailQueue/mailQueue.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x11')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x12')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x13')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x14')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/faxAccount/faxAccount.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x15')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x16')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x17')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x18')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x19')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x1a')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x1b')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x1c')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x1d')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x1e')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x1f')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x20')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x21')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x22')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x23')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x24')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x25')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x26')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x27')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x28')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x29')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x2a')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x2b')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/sound/sound.rpc'));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x2c')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x2d')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x2e')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x2f')));_0x130c91=_['merge'](_0x130c91,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x130c91=_['merge'](_0x130c91,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x30')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x31')));_0x130c91=_['merge'](_0x130c91,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x32')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x33')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x34')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x35')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x36')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x37')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x38')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x39')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x3a')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/squareProject/squareProject.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x3b')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/squareMessage/squareMessage.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x3c')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x3d')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x3e')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x3f')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x40')));_0x130c91=_['merge'](_0x130c91,require(_0xa346('0x41')));_0x130c91=_[_0xa346('0x4')](_0x130c91,require(_0xa346('0x42')));var _0x15b48c=jayson[_0xa346('0x43')](_0x130c91)['http']();var _0x2855c9=config[_0xa346('0x44')][_0xa346('0x45')]||config[_0xa346('0x45')]+0x1;var _0x12a162=config[_0xa346('0x44')]['ip']||_0xa346('0x46');_0x15b48c['on'](_0xa346('0x47'),function(_0x542b22){return _0x1104b9(_0x542b22);});_0x15b48c[_0xa346('0x3')](_0x2855c9,_0x12a162,function(){console[_0xa346('0x48')](_0xa346('0x49'),_0x12a162,_0x2855c9);require('../config/triggers')[_0xa346('0x4a')]();return _0x11715e(_0xa346('0x4b')+_0x12a162+':'+_0x2855c9);});});}; \ No newline at end of file +var _0xefca=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','RPC\x20listening\x20on\x20','bluebird','lodash','listen','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.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','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc'];(function(_0x74f73,_0x2acc98){var _0x3827c2=function(_0x22acbf){while(--_0x22acbf){_0x74f73['push'](_0x74f73['shift']());}};_0x3827c2(++_0x2acc98);}(_0xefca,0xea));var _0xaefc=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xefca[_0x5d9867];return _0x7d2118;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xaefc('0x0'));var _=require(_0xaefc('0x1'));var config=require('../config/environment');exports[_0xaefc('0x2')]=function(){return new BPromise(function(_0x220208,_0x4b3383){var _0x2db58a={};_0x2db58a=_['merge'](_0x2db58a,require('../api/user/user.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x3')));_0x2db58a=_['merge'](_0x2db58a,require('../api/voiceQueue/voiceQueue.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x5')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x6')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x7')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x8')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x9')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0xa')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/mailServerIn/mailServerIn.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0xb')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0xc')));_0x2db58a=_['merge'](_0x2db58a,require('../api/mailInteraction/mailInteraction.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0xd')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0xe')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0xf')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x10')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x11')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x12')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x13')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x14')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x15')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x16')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x17')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x18')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x19')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x1a')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x1b')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x1c')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x1d')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/chatInteraction/chatInteraction.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x1e')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/chatQueue/chatQueue.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x1f')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x20')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x21')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x22')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x23')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x24')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x25')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/pause/pause.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x26')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x27')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/trigger/trigger.rpc'));_0x2db58a=_['merge'](_0x2db58a,require('../api/variable/variable.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x28')));_0x2db58a=_['merge'](_0x2db58a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x29')));_0x2db58a=_['merge'](_0x2db58a,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x2a')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x2b')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x2c')));_0x2db58a=_['merge'](_0x2db58a,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x2d')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x2e')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x2f')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x30')));_0x2db58a=_['merge'](_0x2db58a,require('../api/squareReport/squareReport.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x31')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x32')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x33')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/squareProject/squareProject.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/squareRecording/squareRecording.rpc'));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x34')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x35')));_0x2db58a=_['merge'](_0x2db58a,require('../api/attachment/attachment.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x36')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x37')));_0x2db58a=_[_0xaefc('0x4')](_0x2db58a,require(_0xaefc('0x38')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x39')));_0x2db58a=_['merge'](_0x2db58a,require(_0xaefc('0x3a')));var _0x399ce1=jayson[_0xaefc('0x3b')](_0x2db58a)[_0xaefc('0x3c')]();var _0x35cf50=config[_0xaefc('0x3d')][_0xaefc('0x3e')]||config[_0xaefc('0x3e')]+0x1;var _0x5413c7=config[_0xaefc('0x3d')]['ip']||_0xaefc('0x3f');_0x399ce1['on'](_0xaefc('0x40'),function(_0x2be36b){return _0x4b3383(_0x2be36b);});_0x399ce1[_0xaefc('0x2')](_0x35cf50,_0x5413c7,function(){console[_0xaefc('0x41')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5413c7,_0x35cf50);require('../config/triggers')['default']();return _0x220208(_0xaefc('0x42')+_0x5413c7+':'+_0x35cf50);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index b8ee7b5..4387c97 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0598=['exports','safeTemplate','lodash','\x20}\x20}','string','replace','isPlainObject','keys'];(function(_0x150686,_0x1e3d9e){var _0x3db4c7=function(_0x11c3bd){while(--_0x11c3bd){_0x150686['push'](_0x150686['shift']());}};_0x3db4c7(++_0x1e3d9e);}(_0x0598,0x92));var _0x8059=function(_0x16ece9,_0x24126c){_0x16ece9=_0x16ece9-0x0;var _0x4d0be0=_0x0598[_0x16ece9];return _0x4d0be0;};var _=require(_0x8059('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x8f4b1){return _0x8f4b1==='{{'?'{\x20{\x20':_0x8059('0x1');}function safeTemplate(_0x52c9bf){var _0x4dad54=_0x52c9bf;if(typeof _0x52c9bf===_0x8059('0x2')){_0x4dad54=_0x52c9bf[_0x8059('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x52c9bf)){_0x4dad54=_0x52c9bf['map'](function(_0x555fb5){return safeTemplate(_0x555fb5);});}else if(_[_0x8059('0x4')](_0x52c9bf)){_0x4dad54=Object[_0x8059('0x5')](_0x52c9bf)['reduce'](function(_0x5996d7,_0x248273){_0x5996d7[_0x248273]=safeTemplate(_0x52c9bf[_0x248273]);return _0x5996d7;},{});}return _0x4dad54;}module[_0x8059('0x6')][_0x8059('0x7')]=safeTemplate; \ No newline at end of file +var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0x371a7a,_0x407ca5){var _0x588cf6=function(_0x5cddce){while(--_0x5cddce){_0x371a7a['push'](_0x371a7a['shift']());}};_0x588cf6(++_0x407ca5);}(_0xef0f,0x168));var _0xfef0=function(_0x1ffc38,_0x2b250e){_0x1ffc38=_0x1ffc38-0x0;var _0x2faff2=_0xef0f[_0x1ffc38];return _0x2faff2;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d685d86..435e32f 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 _0x74d3=['E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','answer','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','setEncoding','utf8','setTimeout','headers','ready','line','hangup','substring','520-Invalid','no\x20code','replace','substr','startsWith','split','length','error','emit','E_AGI_SOCKET_ERROR','code','close','timeout'];(function(_0x130a13,_0x230618){var _0x50c346=function(_0x392e33){while(--_0x392e33){_0x130a13['push'](_0x130a13['shift']());}};_0x50c346(++_0x230618);}(_0x74d3,0x159));var _0x374d=function(_0x5c89bd,_0x71181){_0x5c89bd=_0x5c89bd-0x0;var _0x280ac6=_0x74d3[_0x5c89bd];return _0x280ac6;};'use strict';var util=require(_0x374d('0x0'));var _=require(_0x374d('0x1'));var EventEmitter=require(_0x374d('0x2'))['EventEmitter'];var AGIReply=require(_0x374d('0x3'));var AGIError=require('./error');function AGIChannel(_0x356a4e){var _0x9f6268=this,_0x1a79ae=new AGIReply(),_0x5e7908=![],_0x2ef1fc={};EventEmitter['call'](_0x9f6268);_0x356a4e[_0x374d('0x4')](_0x374d('0x5'));_0x356a4e[_0x374d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1a79ae['setEncoding'](_0x374d('0x5'));_0x1a79ae['on'](_0x374d('0x7'),function(_0x3668d1){for(var _0x5f400f in _0x3668d1){_0x9f6268[_0x5f400f]=_0x3668d1[_0x5f400f];}_0x9f6268['emit'](_0x374d('0x8'));});_0x1a79ae['on'](_0x374d('0x9'),function(_0x44fb2f){if(_0x44fb2f['toLowerCase']()=='hangup'){_0x9f6268['emit'](_0x374d('0xa'));return;}if(_0x44fb2f[_0x374d('0xb')](0x0,0xb)==_0x374d('0xc')){_0x5e7908=!![];}if(_0x5e7908){_0x2ef1fc['rx']+=_0x44fb2f+'\x0a';if(_0x44fb2f['search']('520\x20End\x20of\x20proper')!=-0x1){_0x5e7908=![];}}else{_0x2ef1fc['rx']=_0x44fb2f;}if(_0x5e7908){return;}if(typeof _0x2ef1fc['cb']=='function'){var _0x18cb16=_0x2ef1fc['rx'][_0x374d('0xb')](0x0,0x3),_0x40b492=null,_0x412286=null;_0x18cb16=parseInt(_0x18cb16);if(isNaN(_0x18cb16)){_0x2ef1fc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x374d('0xd')});return;}if(_0x18cb16!=0xc8){_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':-0x1,'extra':'KO'});return;}_0x40b492=_0x2ef1fc['rx'][_0x374d('0xb')](0x4)[_0x374d('0xe')]('result=','');if(_0x40b492['indexOf']('\x20')!=-0x1){_0x40b492=_0x40b492[_0x374d('0xf')](0x0,_0x40b492['indexOf']('\x20'));}if(_[_0x374d('0x10')](_0x40b492,'-1')){_0x40b492=parseInt(_0x40b492);}_0x412286=_0x2ef1fc['rx'][_0x374d('0x11')]('\x20');if(_0x412286[_0x374d('0x12')]==0x3){_0x412286=_0x412286[0x2][_0x374d('0xb')](0x1,_0x412286[0x2][_0x374d('0x12')]-0x1);}else if(_0x412286['length']>0x3){var _0x27651f=/\((.+)\)/;var _0x18776c=_0x2ef1fc['rx']['match'](_0x27651f);if(_0x18776c){_0x412286=_0x18776c[0x1];}else{_0x412286=null;}}else{_0x412286=null;}_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':_0x40b492,'extra':_0x412286});}});_0x356a4e['on'](_0x374d('0x13'),function(_0x323c53){_0x9f6268[_0x374d('0x14')](_0x374d('0x13'),new AGIError(_0x374d('0x15'),_0x323c53[_0x374d('0x16')]));});_0x356a4e['on'](_0x374d('0x17'),function(){_0x9f6268['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x356a4e['on'](_0x374d('0x18'),function(){_0x9f6268[_0x374d('0x14')]('timeout',new AGIError(_0x374d('0x19')));_0x356a4e[_0x374d('0x1a')]();});_0x356a4e[_0x374d('0x1b')](_0x1a79ae);this[_0x374d('0x1c')]=function(_0x3ecfc0,_0x32b865){var _0x3ecfc0=_0x3ecfc0||'',_0x32b865=typeof _0x32b865==_0x374d('0x1d')?_0x32b865:new Function();_0x2ef1fc={'tx':_0x3ecfc0,'rx':'','cb':_0x32b865};_0x356a4e[_0x374d('0x1e')](_0x3ecfc0+'\x0a');},this[_0x374d('0x17')]=function(){_0x356a4e['destroy']();};}util[_0x374d('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x374d('0x20')][_0x374d('0x21')]=function(_0x58cbb1){return this[_0x374d('0x1c')][_0x374d('0x22')](this,_0x58cbb1);};AGIChannel[_0x374d('0x20')][_0x374d('0x23')]=function(){return this[_0x374d('0x21')]('ANSWER');};AGIChannel[_0x374d('0x20')]['getData']=function(_0x23c47a,_0x49a8ec,_0xd96ed9){_0x23c47a=_0x23c47a===undefined?'beep':_0x23c47a;_0x49a8ec=_0x49a8ec===undefined?'5':_0x49a8ec;_0xd96ed9=_0xd96ed9===undefined?'1':_0xd96ed9;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x25'),_0x23c47a,_0x49a8ec*0x3e8,_0xd96ed9));};AGIChannel[_0x374d('0x20')][_0x374d('0x26')]=function(_0x322ccf){_0x322ccf=_0x322ccf||_0x374d('0x27');return this[_0x374d('0x21')](util['format'](_0x374d('0x28'),_0x322ccf));};AGIChannel[_0x374d('0x20')][_0x374d('0x29')]=function(_0x2ed03,_0x5ee217){if(_[_0x374d('0x2a')](_0x5ee217)){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217[_0x374d('0x2c')](',')));}return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217));};AGIChannel[_0x374d('0x20')][_0x374d('0x2d')]=function(_0x367617){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2e'),_0x367617));};AGIChannel['prototype'][_0x374d('0x2f')]=function(_0x5df502){return this[_0x374d('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x5df502));};AGIChannel[_0x374d('0x20')][_0x374d('0x30')]=function(_0x272e89){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x31'),_0x272e89));};AGIChannel['prototype'][_0x374d('0xa')]=function(){return this[_0x374d('0x21')](_0x374d('0x32'));};AGIChannel[_0x374d('0x20')][_0x374d('0x33')]=function(_0x29e0e8,_0x39e0c3){var _0x1d3089=_[_0x374d('0x34')](_0x39e0c3)||_[_0x374d('0x35')](_0x39e0c3)?_0x39e0c3[_0x374d('0x36')]():_0x39e0c3;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x37'),_0x29e0e8,_0x1d3089?_0x1d3089[_0x374d('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x374d('0x20')][_0x374d('0x38')]=function(_0x2a2dc2,_0x189480){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x39'),_0x2a2dc2,_0x189480));};AGIChannel['prototype'][_0x374d('0x3a')]=function(_0x348998,_0x55dcb8){return this[_0x374d('0x21')](util['format'](_0x374d('0x3b'),_0x348998,_0x55dcb8));};AGIChannel[_0x374d('0x20')][_0x374d('0x3c')]=function(_0x5413c1,_0x58ffb2){return this[_0x374d('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x5413c1,_0x58ffb2));};AGIChannel[_0x374d('0x20')][_0x374d('0x3d')]=function(_0x4ef8fd,_0x5c658c,_0x3c324a){_0x5c658c=_0x5c658c||this[_0x374d('0x3e')];_0x3c324a=_0x3c324a||0x1;this[_0x374d('0x2d')](_0x4ef8fd);this['setExtension'](_0x5c658c);this[_0x374d('0x30')](_0x3c324a);return this['noop'](util[_0x374d('0x24')]('GOTO\x20%s\x20%s\x20%s',_0x4ef8fd,_0x5c658c,_0x3c324a));};AGIChannel['prototype']['getVariable']=function(_0x32d43b){return this[_0x374d('0x21')](util[_0x374d('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x32d43b));};AGIChannel[_0x374d('0x20')][_0x374d('0x3f')]=function(_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x51ec22,_0x277015){_0x43157e=_0x43157e||_0x374d('0x40');_0x324793=_0x324793||'';_0x16a985=_0x16a985===undefined?-0x1:_0x16a985==='-1'?-0x1:_0x16a985*0x3e8;_0x51ec22=_0x51ec22===undefined?'':'s='+_0x51ec22;_0x277015=_0x277015?_0x374d('0x41'):'';return this[_0x374d('0x21')](util['format'](_0x374d('0x42'),_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x277015,_0x51ec22));};AGIChannel['prototype'][_0x374d('0x43')]=function(_0x3ec703,_0x36355c){_0x36355c=_0x36355c||'';return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x44'),_0x3ec703,_0x36355c));};AGIChannel[_0x374d('0x20')][_0x374d('0x45')]=function(_0x319cba){return this[_0x374d('0x29')](_0x374d('0x46'),_0x319cba);};AGIChannel[_0x374d('0x20')]['wait']=function(_0x1b3633){return this[_0x374d('0x29')](_0x374d('0x47'),_0x1b3633);};AGIChannel[_0x374d('0x20')][_0x374d('0x13')]=function(_0x40d1f7,_0x336aef){this[_0x374d('0x26')](util['format'](_0x374d('0x48'),_0x40d1f7['id'],_0x40d1f7['label'],_0x336aef));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x374d('0x49')]=AGIChannel; \ No newline at end of file +var _0x2c6e=['SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','./error','call','utf8','setTimeout','setEncoding','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','write','destroy','inherits','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber'];(function(_0x51cf58,_0x75e514){var _0x40c439=function(_0x1aff7f){while(--_0x1aff7f){_0x51cf58['push'](_0x51cf58['shift']());}};_0x40c439(++_0x75e514);}(_0x2c6e,0x161));var _0xe2c6=function(_0x12b213,_0x13168a){_0x12b213=_0x12b213-0x0;var _0x163c01=_0x2c6e[_0x12b213];return _0x163c01;};'use strict';var util=require(_0xe2c6('0x0'));var _=require(_0xe2c6('0x1'));var EventEmitter=require(_0xe2c6('0x2'))[_0xe2c6('0x3')];var AGIReply=require(_0xe2c6('0x4'));var AGIError=require(_0xe2c6('0x5'));function AGIChannel(_0x4ee5bf){var _0x593301=this,_0x35c893=new AGIReply(),_0x444699=![],_0x11c49c={};EventEmitter[_0xe2c6('0x6')](_0x593301);_0x4ee5bf['setEncoding'](_0xe2c6('0x7'));_0x4ee5bf[_0xe2c6('0x8')](0x8*0x3c*0x3c*0x3e8);_0x35c893[_0xe2c6('0x9')](_0xe2c6('0x7'));_0x35c893['on'](_0xe2c6('0xa'),function(_0x50bb00){for(var _0x419163 in _0x50bb00){_0x593301[_0x419163]=_0x50bb00[_0x419163];}_0x593301[_0xe2c6('0xb')]('ready');});_0x35c893['on'](_0xe2c6('0xc'),function(_0x3eef40){if(_0x3eef40[_0xe2c6('0xd')]()=='hangup'){_0x593301[_0xe2c6('0xb')](_0xe2c6('0xe'));return;}if(_0x3eef40[_0xe2c6('0xf')](0x0,0xb)==_0xe2c6('0x10')){_0x444699=!![];}if(_0x444699){_0x11c49c['rx']+=_0x3eef40+'\x0a';if(_0x3eef40[_0xe2c6('0x11')](_0xe2c6('0x12'))!=-0x1){_0x444699=![];}}else{_0x11c49c['rx']=_0x3eef40;}if(_0x444699){return;}if(typeof _0x11c49c['cb']==_0xe2c6('0x13')){var _0x86fe30=_0x11c49c['rx'][_0xe2c6('0xf')](0x0,0x3),_0x18dc3f=null,_0x3afcb4=null;_0x86fe30=parseInt(_0x86fe30);if(isNaN(_0x86fe30)){_0x11c49c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe2c6('0x14')});return;}if(_0x86fe30!=0xc8){_0x11c49c['cb'](null,{'code':_0x86fe30,'result':-0x1,'extra':'KO'});return;}_0x18dc3f=_0x11c49c['rx'][_0xe2c6('0xf')](0x4)[_0xe2c6('0x15')](_0xe2c6('0x16'),'');if(_0x18dc3f[_0xe2c6('0x17')]('\x20')!=-0x1){_0x18dc3f=_0x18dc3f[_0xe2c6('0x18')](0x0,_0x18dc3f[_0xe2c6('0x17')]('\x20'));}if(_[_0xe2c6('0x19')](_0x18dc3f,'-1')){_0x18dc3f=parseInt(_0x18dc3f);}_0x3afcb4=_0x11c49c['rx'][_0xe2c6('0x1a')]('\x20');if(_0x3afcb4[_0xe2c6('0x1b')]==0x3){_0x3afcb4=_0x3afcb4[0x2]['substring'](0x1,_0x3afcb4[0x2][_0xe2c6('0x1b')]-0x1);}else if(_0x3afcb4['length']>0x3){var _0x38611c=/\((.+)\)/;var _0x456bff=_0x11c49c['rx']['match'](_0x38611c);if(_0x456bff){_0x3afcb4=_0x456bff[0x1];}else{_0x3afcb4=null;}}else{_0x3afcb4=null;}_0x11c49c['cb'](null,{'code':_0x86fe30,'result':_0x18dc3f,'extra':_0x3afcb4});}});_0x4ee5bf['on'](_0xe2c6('0x1c'),function(_0x2d60d6){_0x593301['emit'](_0xe2c6('0x1c'),new AGIError(_0xe2c6('0x1d'),_0x2d60d6[_0xe2c6('0x1e')]));});_0x4ee5bf['on'](_0xe2c6('0x1f'),function(){_0x593301[_0xe2c6('0xb')](_0xe2c6('0x1f'),new AGIError(_0xe2c6('0x20')));});_0x4ee5bf['on'](_0xe2c6('0x21'),function(){_0x593301['emit'](_0xe2c6('0x21'),new AGIError(_0xe2c6('0x22')));_0x4ee5bf['destroy']();});_0x4ee5bf['pipe'](_0x35c893);this[_0xe2c6('0x23')]=function(_0x38b9cc,_0x385de6){var _0x38b9cc=_0x38b9cc||'',_0x385de6=typeof _0x385de6=='function'?_0x385de6:new Function();_0x11c49c={'tx':_0x38b9cc,'rx':'','cb':_0x385de6};_0x4ee5bf[_0xe2c6('0x24')](_0x38b9cc+'\x0a');},this[_0xe2c6('0x1f')]=function(){_0x4ee5bf[_0xe2c6('0x25')]();};}util[_0xe2c6('0x26')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x407399){return this[_0xe2c6('0x23')][_0xe2c6('0x27')](this,_0x407399);};AGIChannel['prototype'][_0xe2c6('0x28')]=function(){return this[_0xe2c6('0x29')]('ANSWER');};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x2b')]=function(_0x1fce20,_0x534836,_0x11c687){_0x1fce20=_0x1fce20===undefined?_0xe2c6('0x2c'):_0x1fce20;_0x534836=_0x534836===undefined?'5':_0x534836;_0x11c687=_0x11c687===undefined?'1':_0x11c687;return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x2e'),_0x1fce20,_0x534836*0x3e8,_0x11c687));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x2f')]=function(_0x573141){_0x573141=_0x573141||'NO\x20MESSAGE';return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')]('VERBOSE\x20\x22%s\x22',_0x573141));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x30')]=function(_0x5d501b,_0x40dfb4){if(_[_0xe2c6('0x31')](_0x40dfb4)){return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x32'),_0x5d501b,_0x40dfb4[_0xe2c6('0x33')](',')));}return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x32'),_0x5d501b,_0x40dfb4));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x34')]=function(_0x2df209){return this[_0xe2c6('0x29')](util['format'](_0xe2c6('0x35'),_0x2df209));};AGIChannel[_0xe2c6('0x2a')]['setExtension']=function(_0x24c1e1){return this['sendRequest'](util['format'](_0xe2c6('0x36'),_0x24c1e1));};AGIChannel[_0xe2c6('0x2a')]['setPriority']=function(_0x128d0f){return this[_0xe2c6('0x29')](util['format'](_0xe2c6('0x37'),_0x128d0f));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0xe')]=function(){return this[_0xe2c6('0x29')](_0xe2c6('0x38'));};AGIChannel['prototype'][_0xe2c6('0x39')]=function(_0x14657e,_0x54375c){var _0x5ba49f=_['isBoolean'](_0x54375c)||_[_0xe2c6('0x3a')](_0x54375c)?_0x54375c['toString']():_0x54375c;return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x3b'),_0x14657e,_0x5ba49f?_0x5ba49f[_0xe2c6('0x3c')]()[_0xe2c6('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x3d')]=function(_0x1036ab,_0x149837){return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x3e'),_0x1036ab,_0x149837));};AGIChannel['prototype'][_0xe2c6('0x3f')]=function(_0x3739b8,_0x5077e2){return this['sendRequest'](util[_0xe2c6('0x2d')](_0xe2c6('0x40'),_0x3739b8,_0x5077e2));};AGIChannel['prototype'][_0xe2c6('0x41')]=function(_0x7336da,_0x3205ee){return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x42'),_0x7336da,_0x3205ee));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x43')]=function(_0x4c5985,_0x370c6e,_0x142880){_0x370c6e=_0x370c6e||this[_0xe2c6('0x44')];_0x142880=_0x142880||0x1;this['setContext'](_0x4c5985);this['setExtension'](_0x370c6e);this[_0xe2c6('0x45')](_0x142880);return this[_0xe2c6('0x2f')](util[_0xe2c6('0x2d')](_0xe2c6('0x46'),_0x4c5985,_0x370c6e,_0x142880));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x47')]=function(_0x26b75e){return this[_0xe2c6('0x29')](util[_0xe2c6('0x2d')](_0xe2c6('0x48'),_0x26b75e));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x49')]=function(_0x6d4c92,_0x3febc3,_0x4237a3,_0x56be25,_0x32aa09,_0x4f7506){_0x3febc3=_0x3febc3||'wav';_0x4237a3=_0x4237a3||'';_0x56be25=_0x56be25===undefined?-0x1:_0x56be25==='-1'?-0x1:_0x56be25*0x3e8;_0x32aa09=_0x32aa09===undefined?'':'s='+_0x32aa09;_0x4f7506=_0x4f7506?'BEEP':'';return this['sendRequest'](util[_0xe2c6('0x2d')](_0xe2c6('0x4a'),_0x6d4c92,_0x3febc3,_0x4237a3,_0x56be25,_0x4f7506,_0x32aa09));};AGIChannel['prototype'][_0xe2c6('0x4b')]=function(_0x12bbfc,_0x29bf06){_0x29bf06=_0x29bf06||'';return this['sendRequest'](util[_0xe2c6('0x2d')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x12bbfc,_0x29bf06));};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x4c')]=function(_0x349b74){return this[_0xe2c6('0x30')](_0xe2c6('0x4d'),_0x349b74);};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x4e')]=function(_0x339f01){return this[_0xe2c6('0x30')](_0xe2c6('0x4f'),_0x339f01);};AGIChannel[_0xe2c6('0x2a')][_0xe2c6('0x1c')]=function(_0x316d5f,_0xf86c19){this[_0xe2c6('0x2f')](util['format'](_0xe2c6('0x50'),_0x316d5f['id'],_0x316d5f[_0xe2c6('0x51')],_0xf86c19));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe2c6('0x52')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index af80ff1..c5c5117 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 _0x3b51=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','Undefined\x20error.'];(function(_0x4020cf,_0x45195a){var _0x4c78e8=function(_0x101862){while(--_0x101862){_0x4020cf['push'](_0x4020cf['shift']());}};_0x4c78e8(++_0x45195a);}(_0x3b51,0x12b));var _0x13b5=function(_0x5cc9ae,_0x116739){_0x5cc9ae=_0x5cc9ae-0x0;var _0xef9aa1=_0x3b51[_0x5cc9ae];return _0xef9aa1;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x13b5('0x0'),'E_AGI_ARGUMENT_PORT':_0x13b5('0x1'),'E_AGI_SERVER_ERROR':_0x13b5('0x2'),'E_AGI_SERVER_CLOSE':_0x13b5('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x13b5('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x13b5('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x13b5('0x6'),'E_AGI_COMMAND_EMPTY':_0x13b5('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x13b5('0x8'),'E_AGI_IVR_ENTRY':_0x13b5('0x9')};function AGIError(_0x531990){var _0x531990=_0x531990||null,_0x189de7=_0x189de7||[],_0x4e81fc=0x1,_0x18b911='';if(!error[_0x531990]){_0x531990=_0x13b5('0xa');}_0x189de7[_0x13b5('0xb')](error[_0x531990]);while(arguments[_0x4e81fc]){_0x189de7[_0x13b5('0xb')](arguments[_0x4e81fc]);_0x4e81fc++;}_0x18b911=util['format']['apply'](util,_0x189de7);this[_0x13b5('0xc')]=_0x18b911;this[_0x13b5('0xd')]=_0x531990;}module[_0x13b5('0xe')]=AGIError; \ No newline at end of file +var _0xe0ca=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xe0ca,0x177));var _0xae0c=function(_0x2c0cd0,_0x4d669e){_0x2c0cd0=_0x2c0cd0-0x0;var _0x30f63c=_0xe0ca[_0x2c0cd0];return _0x30f63c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xae0c('0x0'),'E_AGI_SERVER_ERROR':_0xae0c('0x1'),'E_AGI_SERVER_CLOSE':_0xae0c('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xae0c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xae0c('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xae0c('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xae0c('0x6'),'E_AGI_IVR_ENTRY':_0xae0c('0x7')};function AGIError(_0x2c8875){var _0x2c8875=_0x2c8875||null,_0x352cc3=_0x352cc3||[],_0x3af624=0x1,_0x45c4b8='';if(!error[_0x2c8875]){_0x2c8875=_0xae0c('0x8');}_0x352cc3['push'](error[_0x2c8875]);while(arguments[_0x3af624]){_0x352cc3[_0xae0c('0x9')](arguments[_0x3af624]);_0x3af624++;}_0x45c4b8=util[_0xae0c('0xa')][_0xae0c('0xb')](util,_0x352cc3);this['message']=_0x45c4b8;this[_0xae0c('0xc')]=_0x2c8875;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ae8df73..8bfe549 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 _0xb8b9=['edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices'];(function(_0x2d6e09,_0x2f41b6){var _0x4994ee=function(_0x1fab0e){while(--_0x1fab0e){_0x2d6e09['push'](_0x2d6e09['shift']());}};_0x4994ee(++_0x2f41b6);}(_0xb8b9,0x1bc));var _0x9b8b=function(_0x253afa,_0x3f2f00){_0x253afa=_0x253afa-0x0;var _0x50a7e3=_0xb8b9[_0x253afa];return _0x50a7e3;};'use strict';var _=require('lodash');var logger=require(_0x9b8b('0x0'))(_0x9b8b('0x1'));var verticesWithRetry=[_0x9b8b('0x2'),_0x9b8b('0x3'),_0x9b8b('0x4')];var Graph=function(){this[_0x9b8b('0x5')]={};this[_0x9b8b('0x6')]={};this[_0x9b8b('0x7')]=0x0;};Graph[_0x9b8b('0x8')]['addVertex']=function(_0x26f70a){this[_0x9b8b('0x5')][_0x26f70a['id']]=_0x26f70a;this[_0x9b8b('0x6')][_0x26f70a['id']]=[];};Graph[_0x9b8b('0x8')][_0x9b8b('0x9')]=function(_0x42e71d,_0x593ee5,_0x23e5e4){this['edges'][_0x42e71d][_0x9b8b('0xa')]({'target':_0x593ee5,'condition':_0x23e5e4});this[_0x9b8b('0x7')]+=0x1;};Graph[_0x9b8b('0x8')][_0x9b8b('0xb')]=function(){return _['size'](this[_0x9b8b('0x5')]);};Graph['prototype'][_0x9b8b('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x9b8b('0x8')][_0x9b8b('0xd')]=function(_0x374307){return this[_0x9b8b('0x5')][_0x374307];};Graph[_0x9b8b('0x8')][_0x9b8b('0xe')]=function(_0x395ccf,_0x828729){if(!this[_0x9b8b('0x5')][_0x395ccf]){return logger[_0x9b8b('0xf')](_0x9b8b('0x10'));}var _0x2e824f=_0x828729(this[_0x9b8b('0x5')][_0x395ccf]);if(!_0x2e824f){return logger['info'](_0x9b8b('0x11'));}if(this['edges'][_0x395ccf]['length']===0x0){return logger[_0x9b8b('0xf')](_0x9b8b('0x12'));}for(var _0x5c272c=0x0,_0x50cbf4=[],_0x3ad1ef=![];_0x5c272c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','./rpc','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','error','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','agicommand'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x257e,0x8e));var _0xe257=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x257e[_0x2eb5bc];return _0x51c7b1;};'use strict';var parser=require(_0xe257('0x0'));var _=require(_0xe257('0x1'));var syncho=require(_0xe257('0x2'));var util=require(_0xe257('0x3'));var moment=require(_0xe257('0x4'));var config=require(_0xe257('0x5'));var logger=require(_0xe257('0x6'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xe257('0x7'));var mailRpc=require(_0xe257('0x8'));var Graph=require(_0xe257('0x9'));var Vertices=require(_0xe257('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe257('0xb')]=_['defaults'](config[_0xe257('0xb')],{'ip':_0xe257('0xc'),'port':0x11dd});function connectionHandler(_0x51bc8c){process[_0xe257('0xd')](function(){syncho(function(){try{setChannelVariables(_0x51bc8c);agiHandler(_0x51bc8c);}catch(_0x5902d2){logger['error'](_0x5902d2[_0xe257('0xe')]);}});});}function listeningHandler(){console['log'](_0xe257('0xf'),config[_0xe257('0xb')][_0xe257('0x10')]);logger[_0xe257('0x11')](util[_0xe257('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe257('0xb')]['ip'],config[_0xe257('0xb')][_0xe257('0x10')]));}function errorHandler(_0x260ab4){if(_0x260ab4&&_0x260ab4[_0xe257('0x13')]&&_0x260ab4[_0xe257('0x14')]){logger[_0xe257('0x15')](util[_0xe257('0x12')](_0xe257('0x16'),_0x260ab4[_0xe257('0x13')],_0x260ab4[_0xe257('0x14')]));}else{logger[_0xe257('0x15')](util['format'](_0xe257('0x17'),_0x260ab4[_0xe257('0xe')]));}}function closeHandler(){logger[_0xe257('0x11')](util[_0xe257('0x12')](_0xe257('0x18'),this[_0xe257('0x19')],this[_0xe257('0x1a')],this[_0xe257('0x1b')],this[_0xe257('0x1c')],this[_0xe257('0x1d')]));try{createSquareReport(this);}catch(_0x94bfe){logger[_0xe257('0x15')](_0x94bfe[_0xe257('0xe')]);}}function timeoutHandler(){logger[_0xe257('0x11')](util[_0xe257('0x12')](_0xe257('0x1e'),this['arg_1'],this[_0xe257('0x1a')],this['callerid'],this[_0xe257('0x1c')],this[_0xe257('0x1d')]));}function hangupHandler(){logger[_0xe257('0x11')](util[_0xe257('0x12')](_0xe257('0x1f'),this[_0xe257('0x19')],this[_0xe257('0x1a')],this[_0xe257('0x1b')],this[_0xe257('0x1c')],this[_0xe257('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x492329){return parser[_0xe257('0x20')](_0x492329,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x54f232,_0x1e8e5e,_0x1f2512){_0x1e8e5e[_0xe257('0x21')]=_0x1f2512;if(_0x1e8e5e[_0xe257('0x22')](_0xe257('0x23'))){_0x1e8e5e['maxRetry']=parseInt(_0x1e8e5e['retry'],0xa);}_0x54f232[_0xe257('0x24')](_[_0xe257('0x25')](_0x1e8e5e,_0xe257('0x26')));}function initGraph(_0x133a43,_0x6fc1b5){var _0x4541c9=new Graph();for(var _0x34b0d6 in _0x133a43){if(_0x133a43[_0xe257('0x22')](_0x34b0d6)){if(_[_0xe257('0x27')](_0x133a43[_0x34b0d6])){for(var _0x38e0d7=0x0;_0x38e0d7<_0x133a43[_0x34b0d6][_0xe257('0x28')];_0x38e0d7+=0x1){addVertex(_0x4541c9,_0x133a43[_0x34b0d6][_0x38e0d7],_0x34b0d6);}}else{addVertex(_0x4541c9,_0x133a43[_0x34b0d6],_0x34b0d6);}}}for(var _0x4b251d=0x0;_0x4b251d<_0x6fc1b5[_0xe257('0x28')];_0x4b251d+=0x1){if(_0x6fc1b5[_0x4b251d][_0xe257('0x29')]&&_0x6fc1b5[_0x4b251d][_0xe257('0x2a')]){_0x4541c9[_0xe257('0x2b')](_0x6fc1b5[_0x4b251d][_0xe257('0x29')],_0x6fc1b5[_0x4b251d][_0xe257('0x2a')],_0x6fc1b5[_0x4b251d][_0xe257('0x2c')]);}}return _0x4541c9;}function getSquareProject(_0x1d28ee,_0x2641c4){rpc[_0xe257('0x2d')](_0x1d28ee)['then'](function(_0x52029a){_0x2641c4(null,_0x52029a);})[_0xe257('0x2e')](function(_0x564408){_0x2641c4(null,_0x564408);});}function createSquareReport(_0x295474,_0x28c8f5){rpc[_0xe257('0x2f')](_0x295474)[_0xe257('0x30')](function(_0x1470fc){if(_0x28c8f5){_0x28c8f5(null,_0x1470fc);}})['catch'](function(_0x516b05){if(_0x28c8f5){_0x28c8f5(null,_0x516b05);}});}function setChannelVariables(_0x3eabb2){for(var _0x548a38 in _0x3eabb2){if(_0x3eabb2[_0xe257('0x22')](_0x548a38)){if(_0x548a38[_0xe257('0x31')]('agi_')===0x0){_0x3eabb2[_0x548a38[_0xe257('0x32')](0x4)]=_0x3eabb2[_0x548a38];delete _0x3eabb2[_0x548a38];}}}}function getLogFromObject(_0x584b31){return util[_0xe257('0x33')](_0x584b31,{'showHidden':![],'depth':null});}function agiHandler(_0x5dc2a4){var _0x1fa254,_0x46e438,_0x37e16b,_0xc9bc9b,_0x288534;logger['debug']('variables',JSON[_0xe257('0x34')](_0x5dc2a4,null,0x2));logger['info'](util[_0xe257('0x12')](_0xe257('0x35'),_0x5dc2a4[_0xe257('0x19')],_0x5dc2a4[_0xe257('0x1a')],_0x5dc2a4['callerid'],_0x5dc2a4[_0xe257('0x1c')],_0x5dc2a4[_0xe257('0x1d')]));_0x5dc2a4['on'](_0xe257('0x15'),errorHandler);_0x5dc2a4['on'](_0xe257('0x36'),closeHandler);_0x5dc2a4['on']('timeout',timeoutHandler);_0x5dc2a4[_0xe257('0x37')]=![];_0x5dc2a4['on']('hangup',hangupHandler);var _0x189365=getSquareProject['sync'](null,_0x5dc2a4[_0xe257('0x19')]);if(_0x189365){if(_0x189365[_0xe257('0x38')]){_0x1fa254=getRoot(_0x189365[_0xe257('0x38')]);if(_0x1fa254&&_0x1fa254[_0xe257('0x39')]){logger[_0xe257('0x3a')](_0xe257('0x3b'),JSON[_0xe257('0x34')](_0x1fa254,null,0x2));_0x5dc2a4[_0xe257('0x3c')]=moment()[_0xe257('0x12')](_0xe257('0x3d'));_0x46e438=initGraph(_['omit'](_0x1fa254,'mxCell'),_0x1fa254[_0xe257('0x26')]);_0x37e16b=new Vertices(_0x5dc2a4,rpc,mailRpc);logger['info'](util[_0xe257('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dc2a4[_0xe257('0x19')],_0x5dc2a4['calleridname'],_0x5dc2a4[_0xe257('0x1b')],_0x5dc2a4[_0xe257('0x1c')],_0x5dc2a4[_0xe257('0x1d')]));_0x46e438[_0xe257('0x3e')](_0x1fa254['start']['id'],function(_0x2669c6){try{_0x2669c6=_0x37e16b['clear'](_0x2669c6);logger[_0xe257('0x3a')](_0xe257('0x3f'),JSON['stringify'](_0x2669c6,null,0x2));if(_0x2669c6[_0xe257('0x21')]===_0xe257('0x40')){logger['info'](_0xe257('0x41'));_0x5dc2a4[_0xe257('0x42')]=_0x2669c6['context']||_0x5dc2a4[_0xe257('0x42')];_0x5dc2a4[_0xe257('0x43')]=_0x2669c6['extension'];_0x5dc2a4[_0xe257('0x44')]=_0x2669c6[_0xe257('0x44')]?_0x2669c6[_0xe257('0x44')]-0x1:0x1;return null;}else if(_0x2669c6&&_0x37e16b[_0x2669c6[_0xe257('0x21')]]){_0x288534=_0x37e16b[_0x2669c6['agicommand']](_0x2669c6);logger[_0xe257('0x11')](_0xe257('0x45'),JSON[_0xe257('0x34')](_0x288534,null,0x2));if(_0x288534&&_0x288534[_0xe257('0x46')]===AGI_CODE_SUCCESS&&_0x288534[_0xe257('0x47')]!==AGI_RESULT_ERROR&&!_0x5dc2a4[_0xe257('0x37')]){logger['debug'](_0xe257('0x45'),getLogFromObject(_0x288534));return _['isUndefined'](_0x288534[_0xe257('0x47')])?null:_0x288534['result'][_0xe257('0x48')]();}else{logger['error'](_0xe257('0x45'),getLogFromObject(_0x288534));return null;}}else{logger['error'](_0xe257('0x49'));return null;}}catch(_0x2db878){logger[_0xe257('0x15')](_0x2db878['stack']);return null;}});if(_0x1fa254[_0xe257('0x4a')]){logger[_0xe257('0x11')](util[_0xe257('0x12')](_0xe257('0x4b'),_0x5dc2a4[_0xe257('0x19')],_0x5dc2a4['calleridname'],_0x5dc2a4[_0xe257('0x1b')],_0x5dc2a4['dnid'],_0x5dc2a4['uniqueid']));_0x46e438[_0xe257('0x3e')](_0x1fa254[_0xe257('0x4a')]['id'],function(_0x48ae3e){try{_0x48ae3e=_0x37e16b[_0xe257('0x4c')](_0x48ae3e);logger[_0xe257('0x3a')](_0xe257('0x3f'),JSON[_0xe257('0x34')](_0x48ae3e,null,0x2));if(_0x48ae3e&&_0x37e16b[_0x48ae3e[_0xe257('0x21')]]){_0x288534=_0x37e16b[_0x48ae3e['agicommand']](_0x48ae3e);if(_0x288534){logger[_0xe257('0x3a')](_0xe257('0x45'),getLogFromObject(_0x288534));return _['isUndefined'](_0x288534[_0xe257('0x47')])?null:_0x288534[_0xe257('0x47')]['toString']();}else{logger[_0xe257('0x15')](_0xe257('0x45'),getLogFromObject(_0x288534));return null;}}else{logger['error'](_0xe257('0x49'));return null;}}catch(_0x23c357){logger['error'](_0x23c357['stack']);return null;}});}logger[_0xe257('0x11')](util[_0xe257('0x12')](_0xe257('0x4d'),_0x5dc2a4['arg_1'],_0x5dc2a4[_0xe257('0x1a')],_0x5dc2a4[_0xe257('0x1b')],_0x5dc2a4[_0xe257('0x1c')],_0x5dc2a4['uniqueid']));logger[_0xe257('0x11')](util[_0xe257('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5dc2a4[_0xe257('0x42')],_0x5dc2a4['extension'],parseInt(_0x5dc2a4[_0xe257('0x44')],0xa)+0x1));_0x5dc2a4[_0xe257('0x4e')](_0x5dc2a4['context'],_0x5dc2a4[_0xe257('0x43')],parseInt(_0x5dc2a4[_0xe257('0x44')],0xa)+0x1);_0x5dc2a4[_0xe257('0x36')]();}}else{logger[_0xe257('0x15')](util[_0xe257('0x12')](_0xe257('0x4f'),_0x5dc2a4[_0xe257('0x19')]));_0x5dc2a4[_0xe257('0x4e')](_0x5dc2a4['context'],_0x5dc2a4[_0xe257('0x43')],parseInt(_0x5dc2a4[_0xe257('0x44')],0xa)+0x1);_0x5dc2a4[_0xe257('0x36')]();}}else{logger[_0xe257('0x15')](util[_0xe257('0x12')](_0xe257('0x50'),_0x5dc2a4[_0xe257('0x19')]));_0x5dc2a4[_0xe257('0x4e')](_0x5dc2a4['context'],_0x5dc2a4[_0xe257('0x43')],parseInt(_0x5dc2a4[_0xe257('0x44')],0xa)+0x1);_0x5dc2a4[_0xe257('0x36')]();}}function main(){var _0x23f26e;return utilLicense[_0xe257('0x51')]()[_0xe257('0x30')](function(_0x2652d1){if(_0x2652d1){if(_0x2652d1[_0xe257('0x52')]){if(_0x2652d1['callysquare']&&_0x2652d1[_0xe257('0x53')]>0x0){logger[_0xe257('0x11')](util['format'](_0xe257('0x54'),_0x2652d1[_0xe257('0x53')]));_0x23f26e=_0x2652d1[_0xe257('0x53')];}else{logger[_0xe257('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe257('0x11')](_0xe257('0x55'));_0x23f26e=-0x1;}}})['catch'](function(_0x294a4b){logger[_0xe257('0x15')]('[LICENSE]',_0x294a4b[_0xe257('0xe')]);})['finally'](function(){var _0x338abb=require('./server')(config[_0xe257('0xb')][_0xe257('0x10')],config[_0xe257('0xb')]['ip'],_0x23f26e);_0x338abb['on'](_0xe257('0x15'),errorHandler);_0x338abb['on'](_0xe257('0x56'),listeningHandler);_0x338abb['on'](_0xe257('0x57'),connectionHandler);_0x338abb['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xe14a=['context','extension','priority','response','code','isUndefined','toString','finally','result','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','agi','127.0.0.1','nextTick','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','timeout','hangup','sync','production','start','root','joinAt','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x5ac70f,_0x20e9e2){var _0x1a8d82=function(_0x5a2eb7){while(--_0x5a2eb7){_0x5ac70f['push'](_0x5ac70f['shift']());}};_0x1a8d82(++_0x20e9e2);}(_0xe14a,0x18c));var _0xae14=function(_0x433c58,_0x5246de){_0x433c58=_0x433c58-0x0;var _0x52de51=_0xe14a[_0x433c58];return _0x52de51;};'use strict';var parser=require(_0xae14('0x0'));var _=require('lodash');var syncho=require(_0xae14('0x1'));var util=require(_0xae14('0x2'));var moment=require(_0xae14('0x3'));var config=require(_0xae14('0x4'));var logger=require(_0xae14('0x5'))('agi');var utilLicense=require(_0xae14('0x6'));var rpc=require(_0xae14('0x7'));var mailRpc=require(_0xae14('0x8'));var Graph=require(_0xae14('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0xae14('0xa')],{'ip':_0xae14('0xb'),'port':0x11dd});function connectionHandler(_0x29ad09){process[_0xae14('0xc')](function(){syncho(function(){try{setChannelVariables(_0x29ad09);agiHandler(_0x29ad09);}catch(_0x47ab25){logger[_0xae14('0xd')](_0x47ab25['stack']);}});});}function listeningHandler(){console[_0xae14('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xae14('0xa')][_0xae14('0xf')]);logger[_0xae14('0x10')](util[_0xae14('0x11')](_0xae14('0x12'),config[_0xae14('0xa')]['ip'],config[_0xae14('0xa')][_0xae14('0xf')]));}function errorHandler(_0x34735f){if(_0x34735f&&_0x34735f[_0xae14('0x13')]&&_0x34735f[_0xae14('0x14')]){logger['error'](util[_0xae14('0x11')](_0xae14('0x15'),_0x34735f[_0xae14('0x13')],_0x34735f[_0xae14('0x14')]));}else{logger[_0xae14('0xd')](util['format'](_0xae14('0x16'),_0x34735f[_0xae14('0x17')]));}}function closeHandler(){logger['info'](util[_0xae14('0x11')](_0xae14('0x18'),this[_0xae14('0x19')],this[_0xae14('0x1a')],this[_0xae14('0x1b')],this[_0xae14('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0xc23858){logger[_0xae14('0xd')](_0xc23858[_0xae14('0x17')]);}}function timeoutHandler(){logger[_0xae14('0x10')](util[_0xae14('0x11')](_0xae14('0x1d'),this[_0xae14('0x19')],this[_0xae14('0x1a')],this[_0xae14('0x1b')],this[_0xae14('0x1c')],this[_0xae14('0x1e')]));}function hangupHandler(){logger[_0xae14('0x10')](util[_0xae14('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xae14('0x19')],this[_0xae14('0x1a')],this[_0xae14('0x1b')],this[_0xae14('0x1c')],this[_0xae14('0x1e')]));this[_0xae14('0x1f')]=!![];}function getRoot(_0x1377c1){return parser[_0xae14('0x20')](_0x1377c1,{'object':!![]})[_0xae14('0x21')]['root'];}function addVertex(_0x49f7db,_0x5b31a3,_0x33dc61){_0x5b31a3[_0xae14('0x22')]=_0x33dc61;if(_0x5b31a3[_0xae14('0x23')]('retry')){_0x5b31a3[_0xae14('0x24')]=parseInt(_0x5b31a3[_0xae14('0x25')],0xa);}_0x49f7db[_0xae14('0x26')](_[_0xae14('0x27')](_0x5b31a3,_0xae14('0x28')));}function initGraph(_0x372800,_0xcafe2){var _0x201a85=new Graph();for(var _0x4def55 in _0x372800){if(_0x372800[_0xae14('0x23')](_0x4def55)){if(_[_0xae14('0x29')](_0x372800[_0x4def55])){for(var _0x6a30be=0x0;_0x6a30be<_0x372800[_0x4def55]['length'];_0x6a30be+=0x1){addVertex(_0x201a85,_0x372800[_0x4def55][_0x6a30be],_0x4def55);}}else{addVertex(_0x201a85,_0x372800[_0x4def55],_0x4def55);}}}for(var _0x1cf9ac=0x0;_0x1cf9ac<_0xcafe2[_0xae14('0x2a')];_0x1cf9ac+=0x1){if(_0xcafe2[_0x1cf9ac]['source']&&_0xcafe2[_0x1cf9ac][_0xae14('0x2b')]){_0x201a85[_0xae14('0x2c')](_0xcafe2[_0x1cf9ac][_0xae14('0x2d')],_0xcafe2[_0x1cf9ac][_0xae14('0x2b')],_0xcafe2[_0x1cf9ac][_0xae14('0x2e')]);}}return _0x201a85;}function getSquareProject(_0x2b264e,_0x4e000e){rpc[_0xae14('0x2f')](_0x2b264e)[_0xae14('0x30')](function(_0x39a4c9){_0x4e000e(null,_0x39a4c9);})[_0xae14('0x31')](function(_0x3c19d2){_0x4e000e(null,_0x3c19d2);});}function createSquareReport(_0xcc55fa,_0x4e0093){rpc[_0xae14('0x32')](_0xcc55fa)[_0xae14('0x30')](function(_0x142ec7){if(_0x4e0093){_0x4e0093(null,_0x142ec7);}})[_0xae14('0x31')](function(_0x3f2a40){if(_0x4e0093){_0x4e0093(null,_0x3f2a40);}});}function setChannelVariables(_0x586b0c){for(var _0x19eadd in _0x586b0c){if(_0x586b0c[_0xae14('0x23')](_0x19eadd)){if(_0x19eadd['indexOf'](_0xae14('0x33'))===0x0){_0x586b0c[_0x19eadd[_0xae14('0x34')](0x4)]=_0x586b0c[_0x19eadd];delete _0x586b0c[_0x19eadd];}}}}function getLogFromObject(_0xd802b6){return util[_0xae14('0x35')](_0xd802b6,{'showHidden':![],'depth':null});}function agiHandler(_0x199a5e){var _0xe8f597,_0x500041,_0x18dc67,_0x536a81,_0x4886ba;logger[_0xae14('0x36')](_0xae14('0x37'),JSON[_0xae14('0x38')](_0x199a5e,null,0x2));logger[_0xae14('0x10')](util[_0xae14('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x199a5e[_0xae14('0x19')],_0x199a5e[_0xae14('0x1a')],_0x199a5e[_0xae14('0x1b')],_0x199a5e[_0xae14('0x1c')],_0x199a5e[_0xae14('0x1e')]));_0x199a5e['on'](_0xae14('0xd'),errorHandler);_0x199a5e['on']('close',closeHandler);_0x199a5e['on'](_0xae14('0x39'),timeoutHandler);_0x199a5e['evtHangup']=![];_0x199a5e['on'](_0xae14('0x3a'),hangupHandler);var _0x53ef8c=getSquareProject[_0xae14('0x3b')](null,_0x199a5e[_0xae14('0x19')]);if(_0x53ef8c){if(_0x53ef8c[_0xae14('0x3c')]){_0xe8f597=getRoot(_0x53ef8c[_0xae14('0x3c')]);if(_0xe8f597&&_0xe8f597[_0xae14('0x3d')]){logger['debug'](_0xae14('0x3e'),JSON[_0xae14('0x38')](_0xe8f597,null,0x2));_0x199a5e[_0xae14('0x3f')]=moment()[_0xae14('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x500041=initGraph(_[_0xae14('0x27')](_0xe8f597,'mxCell'),_0xe8f597[_0xae14('0x28')]);_0x18dc67=new Vertices(_0x199a5e,rpc,mailRpc);logger[_0xae14('0x10')](util[_0xae14('0x11')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x199a5e[_0xae14('0x19')],_0x199a5e['calleridname'],_0x199a5e['callerid'],_0x199a5e[_0xae14('0x1c')],_0x199a5e['uniqueid']));_0x500041[_0xae14('0x40')](_0xe8f597[_0xae14('0x3d')]['id'],function(_0x4d42cd){try{_0x4d42cd=_0x18dc67[_0xae14('0x41')](_0x4d42cd);logger['debug'](_0xae14('0x42'),JSON[_0xae14('0x38')](_0x4d42cd,null,0x2));if(_0x4d42cd[_0xae14('0x22')]===_0xae14('0x43')){logger['info'](_0xae14('0x44'));_0x199a5e[_0xae14('0x45')]=_0x4d42cd[_0xae14('0x45')]||_0x199a5e[_0xae14('0x45')];_0x199a5e[_0xae14('0x46')]=_0x4d42cd[_0xae14('0x46')];_0x199a5e[_0xae14('0x47')]=_0x4d42cd[_0xae14('0x47')]?_0x4d42cd[_0xae14('0x47')]-0x1:0x1;return null;}else if(_0x4d42cd&&_0x18dc67[_0x4d42cd[_0xae14('0x22')]]){_0x4886ba=_0x18dc67[_0x4d42cd[_0xae14('0x22')]](_0x4d42cd);logger[_0xae14('0x10')](_0xae14('0x48'),JSON[_0xae14('0x38')](_0x4886ba,null,0x2));if(_0x4886ba&&_0x4886ba[_0xae14('0x49')]===AGI_CODE_SUCCESS&&_0x4886ba['result']!==AGI_RESULT_ERROR&&!_0x199a5e[_0xae14('0x1f')]){logger[_0xae14('0x36')](_0xae14('0x48'),getLogFromObject(_0x4886ba));return _[_0xae14('0x4a')](_0x4886ba['result'])?null:_0x4886ba['result'][_0xae14('0x4b')]();}else{logger[_0xae14('0xd')](_0xae14('0x48'),getLogFromObject(_0x4886ba));return null;}}else{logger[_0xae14('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x2e13fe){logger['error'](_0x2e13fe[_0xae14('0x17')]);return null;}});if(_0xe8f597[_0xae14('0x4c')]){logger[_0xae14('0x10')](util[_0xae14('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x199a5e[_0xae14('0x19')],_0x199a5e['calleridname'],_0x199a5e[_0xae14('0x1b')],_0x199a5e[_0xae14('0x1c')],_0x199a5e['uniqueid']));_0x500041[_0xae14('0x40')](_0xe8f597[_0xae14('0x4c')]['id'],function(_0x534f64){try{_0x534f64=_0x18dc67[_0xae14('0x41')](_0x534f64);logger['debug'](_0xae14('0x42'),JSON[_0xae14('0x38')](_0x534f64,null,0x2));if(_0x534f64&&_0x18dc67[_0x534f64[_0xae14('0x22')]]){_0x4886ba=_0x18dc67[_0x534f64[_0xae14('0x22')]](_0x534f64);if(_0x4886ba){logger[_0xae14('0x36')](_0xae14('0x48'),getLogFromObject(_0x4886ba));return _[_0xae14('0x4a')](_0x4886ba[_0xae14('0x4d')])?null:_0x4886ba[_0xae14('0x4d')][_0xae14('0x4b')]();}else{logger[_0xae14('0xd')](_0xae14('0x48'),getLogFromObject(_0x4886ba));return null;}}else{logger['error'](_0xae14('0x4e'));return null;}}catch(_0x2a74cc){logger[_0xae14('0xd')](_0x2a74cc[_0xae14('0x17')]);return null;}});}logger['info'](util['format'](_0xae14('0x4f'),_0x199a5e[_0xae14('0x19')],_0x199a5e[_0xae14('0x1a')],_0x199a5e[_0xae14('0x1b')],_0x199a5e[_0xae14('0x1c')],_0x199a5e['uniqueid']));logger[_0xae14('0x10')](util[_0xae14('0x11')](_0xae14('0x50'),_0x199a5e[_0xae14('0x45')],_0x199a5e[_0xae14('0x46')],parseInt(_0x199a5e[_0xae14('0x47')],0xa)+0x1));_0x199a5e['continueAt'](_0x199a5e[_0xae14('0x45')],_0x199a5e[_0xae14('0x46')],parseInt(_0x199a5e[_0xae14('0x47')],0xa)+0x1);_0x199a5e[_0xae14('0x51')]();}}else{logger[_0xae14('0xd')](util[_0xae14('0x11')](_0xae14('0x52'),_0x199a5e[_0xae14('0x19')]));_0x199a5e[_0xae14('0x53')](_0x199a5e[_0xae14('0x45')],_0x199a5e[_0xae14('0x46')],parseInt(_0x199a5e['priority'],0xa)+0x1);_0x199a5e[_0xae14('0x51')]();}}else{logger[_0xae14('0xd')](util[_0xae14('0x11')](_0xae14('0x54'),_0x199a5e['arg_1']));_0x199a5e[_0xae14('0x53')](_0x199a5e[_0xae14('0x45')],_0x199a5e[_0xae14('0x46')],parseInt(_0x199a5e[_0xae14('0x47')],0xa)+0x1);_0x199a5e['close']();}}function main(){var _0x1fa2e7;return utilLicense[_0xae14('0x55')]()[_0xae14('0x30')](function(_0x61b5ae){if(_0x61b5ae){if(_0x61b5ae['voice']){if(_0x61b5ae['callysquare']&&_0x61b5ae[_0xae14('0x56')]>0x0){logger[_0xae14('0x10')](util[_0xae14('0x11')](_0xae14('0x57'),_0x61b5ae[_0xae14('0x56')]));_0x1fa2e7=_0x61b5ae[_0xae14('0x56')];}else{logger['info'](_0xae14('0x58'));}}else{logger['info'](_0xae14('0x59'));_0x1fa2e7=-0x1;}}})[_0xae14('0x31')](function(_0x190895){logger['error'](_0xae14('0x5a'),_0x190895[_0xae14('0x17')]);})[_0xae14('0x4c')](function(){var _0x1cf475=require(_0xae14('0x5b'))(config[_0xae14('0xa')][_0xae14('0xf')],config[_0xae14('0xa')]['ip'],_0x1fa2e7);_0x1cf475['on'](_0xae14('0xd'),errorHandler);_0x1cf475['on']('listening',listeningHandler);_0x1cf475['on'](_0xae14('0x5c'),connectionHandler);_0x1cf475['on'](_0xae14('0x51'),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 6552843..e66796b 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 _0x1011=['sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1011,0x161));var _0x1101=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x1011[_0x473ee7];return _0x30f0d4;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1101('0x0'));var client=jayson[_0x1101('0x1')][_0x1101('0x2')]({'port':0x232b});function request(_0x2d5918,_0x38925e){return new BPromise(function(_0x51d061,_0x1781bf){return client[_0x1101('0x3')](_0x2d5918,_0x38925e)[_0x1101('0x4')](function(_0x1249a4){if(_0x1249a4['error']){return _0x1781bf(_0x1249a4[_0x1101('0x5')][_0x1101('0x6')]);}else{return _0x51d061(_0x1249a4['result']);}})['catch'](function(_0x2019c9){return _0x1781bf(_0x2019c9);});});}exports[_0x1101('0x7')]=function(_0x17313f,_0x1f2e89){return request(_0x1101('0x8'),{'account':_0x17313f,'message':_0x1f2e89});}; \ No newline at end of file +var _0xe15c=['bluebird','client','http','request','error','result','catch','sendMailMessage','SendMail'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xe15c,0x14d));var _0xce15=function(_0x297c74,_0x28a5be){_0x297c74=_0x297c74-0x0;var _0x4d766d=_0xe15c[_0x297c74];return _0x4d766d;};'use strict';var BPromise=require(_0xce15('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xce15('0x1')][_0xce15('0x2')]({'port':0x232b});function request(_0x515e5f,_0x2e5654){return new BPromise(function(_0x49c2c4,_0x33c21e){return client[_0xce15('0x3')](_0x515e5f,_0x2e5654)['then'](function(_0x48efe0){if(_0x48efe0[_0xce15('0x4')]){return _0x33c21e(_0x48efe0[_0xce15('0x4')]['message']);}else{return _0x49c2c4(_0x48efe0[_0xce15('0x5')]);}})[_0xce15('0x6')](function(_0x13e483){return _0x33c21e(_0x13e483);});});}exports[_0xce15('0x7')]=function(_0x959b2c,_0x41714a){return request(_0xce15('0x8'),{'account':_0x959b2c,'message':_0x41714a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index bb747c2..389a17b 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 _0xd5fe=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','_inBody','line','exports','util','stream','_localBuffer','prototype','_transform'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x4fa4fd,_0x4c656b){_0x4fa4fd=_0x4fa4fd-0x0;var _0x3c50d0=_0xd5fe[_0x4fa4fd];return _0x3c50d0;};'use strict';var util=require(_0xed5f('0x0'));var Transform=require(_0xed5f('0x1'))['Transform'];function AGIReply(_0x4081be){Transform['call'](this,_0x4081be);this[_0xed5f('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xed5f('0x3')][_0xed5f('0x4')]=function(_0x480b23,_0x5dee27,_0x467a03){var _0x20a6b9='\x0a',_0x3a98a7=['\x0a\x0a',_0xed5f('0x5')],_0x281196=-0x1,_0x21f73a=-0x1,_0x2c1ae3='',_0x58cb03=0x0,_0xf9ac71='',_0x4f941d='';this['_localBuffer']+=_0x480b23[_0xed5f('0x6')]();_0xf9ac71=this[_0xed5f('0x2')];if(!this['_inBody']){_0x58cb03=0x0;while(_0x3a98a7[_0x58cb03]){while((_0x21f73a=_0xf9ac71[_0xed5f('0x7')](_0x3a98a7[_0x58cb03]))!=-0x1){_0x2c1ae3=_0x3a98a7[_0x58cb03];_0x4f941d=_0xf9ac71[_0xed5f('0x8')](0x0,_0x21f73a);_0xf9ac71=_0xf9ac71[_0xed5f('0x8')](_0x21f73a+_0x2c1ae3[_0xed5f('0x9')]);var _0x538a56=_0x4f941d[_0xed5f('0xa')](_0x20a6b9),_0x89a468=0x0,_0x185830={},_0xc738d7='',_0x51b774='',_0x5c138b=-0x1;while(_0x538a56[_0x89a468]){_0x5c138b=_0x538a56[_0x89a468][_0xed5f('0x7')](':');if(_0x5c138b!=-0x1){_0xc738d7=_0x538a56[_0x89a468][_0xed5f('0xb')](0x0,_0x5c138b)[_0xed5f('0xc')]();_0x51b774=_0x538a56[_0x89a468][_0xed5f('0xb')](_0x5c138b+0x1)[_0xed5f('0xc')]();if(_0xc738d7[_0xed5f('0x9')]>0x0){_0x185830[_0xc738d7]=_0x51b774;}}else{}_0x89a468++;}this[_0xed5f('0xd')](_0xed5f('0xe'),_0x185830);this[_0xed5f('0xf')]=!![];}_0x58cb03++;}this[_0xed5f('0x2')]=_0xf9ac71;}else{while((_0x281196=_0xf9ac71[_0xed5f('0x7')](_0x20a6b9))!=-0x1){_0x4f941d=_0xf9ac71[_0xed5f('0x8')](0x0,_0x281196);this['emit'](_0xed5f('0x10'),_0x4f941d);_0xf9ac71=_0xf9ac71[_0xed5f('0x8')](_0x281196+_0x20a6b9[_0xed5f('0x9')]);}this['_localBuffer']=_0xf9ac71;}_0x467a03();};module[_0xed5f('0x11')]=AGIReply; \ No newline at end of file +var _0x2b2d=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x58ad47,_0x548fec){var _0x3dd187=function(_0x14a1d5){while(--_0x14a1d5){_0x58ad47['push'](_0x58ad47['shift']());}};_0x3dd187(++_0x548fec);}(_0x2b2d,0x1ad));var _0xd2b2=function(_0x285d34,_0x42dd2d){_0x285d34=_0x285d34-0x0;var _0x59e21d=_0x2b2d[_0x285d34];return _0x59e21d;};'use strict';var util=require(_0xd2b2('0x0'));var Transform=require(_0xd2b2('0x1'))[_0xd2b2('0x2')];function AGIReply(_0x4dd940){Transform[_0xd2b2('0x3')](this,_0x4dd940);this[_0xd2b2('0x4')]='';this[_0xd2b2('0x5')]=![];}util[_0xd2b2('0x6')](AGIReply,Transform);AGIReply[_0xd2b2('0x7')][_0xd2b2('0x8')]=function(_0x40e522,_0x59fc4b,_0x1fd93e){var _0x5f58e0='\x0a',_0x3ff8ba=['\x0a\x0a',_0xd2b2('0x9')],_0x318976=-0x1,_0x4c00bd=-0x1,_0x3e4e8a='',_0x119378=0x0,_0x3eadbb='',_0x2012f0='';this[_0xd2b2('0x4')]+=_0x40e522[_0xd2b2('0xa')]();_0x3eadbb=this[_0xd2b2('0x4')];if(!this[_0xd2b2('0x5')]){_0x119378=0x0;while(_0x3ff8ba[_0x119378]){while((_0x4c00bd=_0x3eadbb[_0xd2b2('0xb')](_0x3ff8ba[_0x119378]))!=-0x1){_0x3e4e8a=_0x3ff8ba[_0x119378];_0x2012f0=_0x3eadbb['substring'](0x0,_0x4c00bd);_0x3eadbb=_0x3eadbb[_0xd2b2('0xc')](_0x4c00bd+_0x3e4e8a[_0xd2b2('0xd')]);var _0x3abb89=_0x2012f0[_0xd2b2('0xe')](_0x5f58e0),_0xfeb6ff=0x0,_0x2af6fd={},_0x1ddcc8='',_0x4f3bef='',_0x52e0e0=-0x1;while(_0x3abb89[_0xfeb6ff]){_0x52e0e0=_0x3abb89[_0xfeb6ff][_0xd2b2('0xb')](':');if(_0x52e0e0!=-0x1){_0x1ddcc8=_0x3abb89[_0xfeb6ff]['slice'](0x0,_0x52e0e0)['trim']();_0x4f3bef=_0x3abb89[_0xfeb6ff][_0xd2b2('0xf')](_0x52e0e0+0x1)[_0xd2b2('0x10')]();if(_0x1ddcc8[_0xd2b2('0xd')]>0x0){_0x2af6fd[_0x1ddcc8]=_0x4f3bef;}}else{}_0xfeb6ff++;}this['emit'](_0xd2b2('0x11'),_0x2af6fd);this[_0xd2b2('0x5')]=!![];}_0x119378++;}this[_0xd2b2('0x4')]=_0x3eadbb;}else{while((_0x318976=_0x3eadbb[_0xd2b2('0xb')](_0x5f58e0))!=-0x1){_0x2012f0=_0x3eadbb[_0xd2b2('0xc')](0x0,_0x318976);this['emit'](_0xd2b2('0x12'),_0x2012f0);_0x3eadbb=_0x3eadbb['substring'](_0x318976+_0x5f58e0[_0xd2b2('0xd')]);}this[_0xd2b2('0x4')]=_0x3eadbb;}_0x1fd93e();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 822fc04..40a68d3 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 _0x750d=['getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser'];(function(_0x487ae7,_0x243e03){var _0x237c4f=function(_0x33c95b){while(--_0x33c95b){_0x487ae7['push'](_0x487ae7['shift']());}};_0x237c4f(++_0x243e03);}(_0x750d,0xd3));var _0xd750=function(_0x5f3cd3,_0x102330){_0x5f3cd3=_0x5f3cd3-0x0;var _0x6144c3=_0x750d[_0x5f3cd3];return _0x6144c3;};'use strict';var BPromise=require(_0xd750('0x0'));var moment=require(_0xd750('0x1'));var _=require(_0xd750('0x2'));var util=require(_0xd750('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xd750('0x4')][_0xd750('0x5')]({'port':0x2329});function request(_0x281044,_0x4f5bb0){return new BPromise(function(_0x40a2bb,_0x23281a){return client[_0xd750('0x6')](_0x281044,_0x4f5bb0)['then'](function(_0x4ebb61){if(_0x4ebb61[_0xd750('0x7')]){return _0x23281a(_0x4ebb61[_0xd750('0x7')][_0xd750('0x8')]);}else{return _0x40a2bb(_0x4ebb61[_0xd750('0x9')]);}})[_0xd750('0xa')](function(_0x19dd8d){return _0x23281a(_0x19dd8d);});});}exports[_0xd750('0xb')]=function(_0x34d018){return request(_0xd750('0xc'),{'options':{'raw':![],'where':{'name':_0x34d018},'attributes':[_0xd750('0xd')]}});};exports['getMailAccountById']=function(_0x2acccb){return request(_0xd750('0xe'),{'options':{'raw':![],'where':{'id':_0x2acccb},'include':[{'model':_0xd750('0xf'),'as':'Smtp'}],'attributes':['id',_0xd750('0x10'),_0xd750('0x11')]}});};exports[_0xd750('0x12')]=function(_0xf94906){return request(_0xd750('0xc'),{'options':{'where':{'id':_0xf94906},'attributes':[_0xd750('0x10')]}});};exports[_0xd750('0x13')]=function(_0x112668){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x112668},'attributes':[_0xd750('0x10')]}});};exports['getVariableById']=function(_0x4a6c1d){return request(_0xd750('0x14'),{'options':{'where':{'id':_0x4a6c1d},'attributes':[_0xd750('0x10')]}});};exports['getSquareOdbcById']=function(_0x1754e2){return request(_0xd750('0x15'),{'options':{'where':{'id':_0x1754e2},'attributes':[_0xd750('0x16')]}});};exports[_0xd750('0x17')]=function(_0x3110af){return request(_0xd750('0x18'),{'options':{'where':{'id':_0x3110af},'attributes':['name']}});};exports[_0xd750('0x19')]=function(_0x49084e){return request(_0xd750('0x1a'),{'options':{'where':{'id':_0x49084e},'attributes':[_0xd750('0x10')]}});};exports[_0xd750('0x1b')]=function(_0x2cb945){return request(_0xd750('0x1c'),{'options':{'where':{'id':_0x2cb945},'attributes':[_0xd750('0x1d')]}});};exports[_0xd750('0x1e')]=function(_0xc795d5){return request(_0xd750('0x1f'),{'options':{'raw':![],'where':{'id':_0xc795d5},'include':[{'model':_0xd750('0x20'),'as':'Intervals'}]}});};exports[_0xd750('0x21')]=function(_0x1b1b6a){return request(_0xd750('0x22'),{'options':{'where':{'id':_0x1b1b6a},'attributes':['id','name']}});};exports[_0xd750('0x23')]=function(_0x54155a){return request(_0xd750('0x24'),{'body':_0x54155a});};exports[_0xd750('0x25')]=function(_0x484f84){return request(_0xd750('0x26'),{'body':_0x484f84});};exports['createSquareReport']=function(_0x2e6353){return request(_0xd750('0x27'),{'body':_['merge'](_0x2e6353,{'project_name':_0x2e6353[_0xd750('0x28')],'prev_project_name':_0x2e6353[_0xd750('0x29')]||'','is_subproject':_0x2e6353[_0xd750('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xd750('0x2a'))})});};exports[_0xd750('0x2b')]=function(_0x3e6ce9){return request(_0xd750('0x2c'),{'body':_0x3e6ce9});};exports[_0xd750('0x2d')]=function(_0x194e5c){return request(_0xd750('0x2e'),{'body':_0x194e5c});};exports[_0xd750('0x2f')]=function(_0x1d29a6){return request(_0xd750('0x30'),{'options':{'raw':![],'where':{'phone':_0x1d29a6[_0xd750('0x31')],'ListId':_0x1d29a6[_0xd750('0x32')]}}})[_0xd750('0x33')](function(_0x4df7a5){if(_0x4df7a5){return _0x4df7a5;}return request(_0xd750('0x34'),{'body':_0x1d29a6});});};exports[_0xd750('0x35')]=function(_0x18503f){return request(_0xd750('0x36'),{'options':{'where':{'id':_0x18503f},'attributes':[_0xd750('0x10')]}});};exports[_0xd750('0x37')]=function(_0x98e1b8,_0x21a1f3){return request('LoginUser',{'body':{'interface':_0x21a1f3},'options':{'where':_0x98e1b8}});};exports[_0xd750('0x38')]=function(_0x359e23,_0x1eb367,_0x26d7d1){return request('PauseUser',{'body':{'type':_0x1eb367,'uniqueid':_0x26d7d1},'options':{'where':_0x359e23}});};exports[_0xd750('0x39')]=function(_0x2e7b51){return request(_0xd750('0x3a'),{'body':{},'options':{'where':_0x2e7b51}});};exports['agentLogout']=function(_0x30114e){return request('LogoutUser',{'body':{},'options':{'where':_0x30114e}});}; \ No newline at end of file +var _0x94de=['agentLogin','LoginUser','UnpauseUser','agentLogout','LogoutUser','util','jayson/promise','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','getMailAccountById','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact'];(function(_0x3ae17b,_0x43fb59){var _0xcd2806=function(_0x452522){while(--_0x452522){_0x3ae17b['push'](_0x3ae17b['shift']());}};_0xcd2806(++_0x43fb59);}(_0x94de,0x98));var _0xe94d=function(_0x48a847,_0x12bfd0){_0x48a847=_0x48a847-0x0;var _0x272bc9=_0x94de[_0x48a847];return _0x272bc9;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0xe94d('0x0'));var jayson=require(_0xe94d('0x1'));var client=jayson[_0xe94d('0x2')][_0xe94d('0x3')]({'port':0x2329});function request(_0x4b73cf,_0x3797ff){return new BPromise(function(_0x49bd8f,_0x20faee){return client[_0xe94d('0x4')](_0x4b73cf,_0x3797ff)[_0xe94d('0x5')](function(_0x18d3c7){if(_0x18d3c7[_0xe94d('0x6')]){return _0x20faee(_0x18d3c7[_0xe94d('0x6')][_0xe94d('0x7')]);}else{return _0x49bd8f(_0x18d3c7[_0xe94d('0x8')]);}})['catch'](function(_0x32312d){return _0x20faee(_0x32312d);});});}exports[_0xe94d('0x9')]=function(_0x178f10){return request(_0xe94d('0xa'),{'options':{'raw':![],'where':{'name':_0x178f10},'attributes':['production']}});};exports[_0xe94d('0xb')]=function(_0x523866){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x523866},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xe94d('0xc'),_0xe94d('0xd')]}});};exports[_0xe94d('0xe')]=function(_0x3b9024){return request(_0xe94d('0xa'),{'options':{'where':{'id':_0x3b9024},'attributes':[_0xe94d('0xc')]}});};exports['getVoiceQueueById']=function(_0xd82951){return request(_0xe94d('0xf'),{'options':{'where':{'id':_0xd82951},'attributes':['name']}});};exports[_0xe94d('0x10')]=function(_0x180324){return request(_0xe94d('0x11'),{'options':{'where':{'id':_0x180324},'attributes':[_0xe94d('0xc')]}});};exports['getSquareOdbcById']=function(_0x1384a3){return request(_0xe94d('0x12'),{'options':{'where':{'id':_0x1384a3},'attributes':[_0xe94d('0x13')]}});};exports['getUserById']=function(_0x2e422d){return request(_0xe94d('0x14'),{'options':{'where':{'id':_0x2e422d},'attributes':[_0xe94d('0xc')]}});};exports['getTrunkById']=function(_0x2e44ba){return request(_0xe94d('0x15'),{'options':{'where':{'id':_0x2e44ba},'attributes':[_0xe94d('0xc')]}});};exports[_0xe94d('0x16')]=function(_0x1d3101){return request('ShowSound',{'options':{'where':{'id':_0x1d3101},'attributes':[_0xe94d('0x17')]}});};exports['getIntervalById']=function(_0x5a67dc){return request(_0xe94d('0x18'),{'options':{'raw':![],'where':{'id':_0x5a67dc},'include':[{'model':_0xe94d('0x19'),'as':_0xe94d('0x1a')}]}});};exports[_0xe94d('0x1b')]=function(_0x4e6689){return request(_0xe94d('0x1c'),{'options':{'where':{'id':_0x4e6689},'attributes':['id',_0xe94d('0xc')]}});};exports[_0xe94d('0x1d')]=function(_0x2ac310){return request(_0xe94d('0x1e'),{'body':_0x2ac310});};exports[_0xe94d('0x1f')]=function(_0x24cc7a){return request('CreateSquareDetailsReport',{'body':_0x24cc7a});};exports['createSquareReport']=function(_0x564fbd){return request(_0xe94d('0x20'),{'body':_[_0xe94d('0x21')](_0x564fbd,{'project_name':_0x564fbd[_0xe94d('0x22')],'prev_project_name':_0x564fbd[_0xe94d('0x23')]||'','is_subproject':_0x564fbd[_0xe94d('0x23')]?!![]:![],'leaveAt':moment()[_0xe94d('0x24')](_0xe94d('0x25'))})});};exports[_0xe94d('0x26')]=function(_0x110b79){return request('CreateSquareRecording',{'body':_0x110b79});};exports[_0xe94d('0x27')]=function(_0x694a){return request(_0xe94d('0x28'),{'body':_0x694a});};exports[_0xe94d('0x29')]=function(_0x3c2647){return request(_0xe94d('0x2a'),{'options':{'raw':![],'where':{'phone':_0x3c2647['phone'],'ListId':_0x3c2647['ListId']}}})[_0xe94d('0x5')](function(_0x4a9db7){if(_0x4a9db7){return _0x4a9db7;}return request(_0xe94d('0x2b'),{'body':_0x3c2647});});};exports['getPauseById']=function(_0x95d4ce){return request('ShowPause',{'options':{'where':{'id':_0x95d4ce},'attributes':[_0xe94d('0xc')]}});};exports[_0xe94d('0x2c')]=function(_0x3179bb,_0x5d0abb){return request(_0xe94d('0x2d'),{'body':{'interface':_0x5d0abb},'options':{'where':_0x3179bb}});};exports['agentPause']=function(_0x1c9c15,_0x2a3b79,_0x22af42){return request('PauseUser',{'body':{'type':_0x2a3b79,'uniqueid':_0x22af42},'options':{'where':_0x1c9c15}});};exports['agentUnpause']=function(_0x120e9e){return request(_0xe94d('0x2e'),{'body':{},'options':{'where':_0x120e9e}});};exports[_0xe94d('0x2f')]=function(_0x20a050){return request(_0xe94d('0x30'),{'body':{},'options':{'where':_0x20a050}});}; \ 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 8fdc300..b74dc11 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 _0x8375=['./polly','./lex','exports'];(function(_0x31cfe2,_0x5a862e){var _0x54777f=function(_0xb0ee12){while(--_0xb0ee12){_0x31cfe2['push'](_0x31cfe2['shift']());}};_0x54777f(++_0x5a862e);}(_0x8375,0xa8));var _0x5837=function(_0x3ffe1e,_0x2559eb){_0x3ffe1e=_0x3ffe1e-0x0;var _0x91877d=_0x8375[_0x3ffe1e];return _0x91877d;};var polly=require(_0x5837('0x0'));var lex=require(_0x5837('0x1'));module[_0x5837('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xab9f=['exports','./polly'];(function(_0x3544b1,_0x907842){var _0xcc3f18=function(_0x227460){while(--_0x227460){_0x3544b1['push'](_0x3544b1['shift']());}};_0xcc3f18(++_0x907842);}(_0xab9f,0x1bd));var _0xfab9=function(_0x15b042,_0x23fd98){_0x15b042=_0x15b042-0x0;var _0x440fb0=_0xab9f[_0x15b042];return _0x440fb0;};var polly=require(_0xfab9('0x0'));var lex=require('./lex');module[_0xfab9('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 b6641b9..d938575 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 _0xb43b=['./lib/api','exports'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xb43b,0x1b2));var _0xbb43=function(_0x168902,_0x54ee9b){_0x168902=_0x168902-0x0;var _0x49248c=_0xb43b[_0x168902];return _0x49248c;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ No newline at end of file +var _0x9bde=['exports'];(function(_0x59a125,_0x67bc0a){var _0x3cb680=function(_0x5f5348){while(--_0x5f5348){_0x59a125['push'](_0x59a125['shift']());}};_0x3cb680(++_0x67bc0a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3384ce,_0x5eefe4){_0x3384ce=_0x3384ce-0x0;var _0x58edf3=_0x9bde[_0x3384ce];return _0x58edf3;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ 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 b25a230..ee18714 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(_0x295caf,_0x4c19f9){var _0x494f3e=function(_0x4876de){while(--_0x4876de){_0x295caf['push'](_0x295caf['shift']());}};_0x494f3e(++_0x4c19f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x587c66,_0x4b4761){var _0x3a0ac9=function(_0x1fb1c7){while(--_0x1fb1c7){_0x587c66['push'](_0x587c66['shift']());}};_0x3a0ac9(++_0x4b4761);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 64adfd9..c5f7f7a 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 _0x8fd3=['exports','./lib/api'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0x8fd3,0x179));var _0x38fd=function(_0x587d3b,_0x280f8b){_0x587d3b=_0x587d3b-0x0;var _0x57806f=_0x8fd3[_0x587d3b];return _0x57806f;};'use strict';var polly=require(_0x38fd('0x0'));module[_0x38fd('0x1')]=function(_0x276b44,_0x34a0f6,_0x5e116f,_0x17ec61,_0xf4b3aa,_0x271fd7,_0x241ab0){return polly(_0x276b44,_0x34a0f6,_0x5e116f,_0x17ec61,_0xf4b3aa,_0x271fd7,_0x241ab0);}; \ No newline at end of file +var _0x996d=['exports','./lib/api'];(function(_0x25ce7d,_0x35a459){var _0x548c4a=function(_0x4e9398){while(--_0x4e9398){_0x25ce7d['push'](_0x25ce7d['shift']());}};_0x548c4a(++_0x35a459);}(_0x996d,0x17d));var _0xd996=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x996d[_0x38ced4];return _0x547c07;};'use strict';var polly=require(_0xd996('0x0'));module[_0xd996('0x1')]=function(_0x1dff81,_0x21db15,_0x56d219,_0x49e731,_0x36fd24,_0x5e80d4,_0x25aac5){return polly(_0x1dff81,_0x21db15,_0x56d219,_0x49e731,_0x36fd24,_0x5e80d4,_0x25aac5);}; \ 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 b3e1eb5..a8564ba 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 _0x6cbd=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x4b1575,_0x356e22){var _0x1747c7=function(_0x24e376){while(--_0x24e376){_0x4b1575['push'](_0x4b1575['shift']());}};_0x1747c7(++_0x356e22);}(_0x6cbd,0x7e));var _0xd6cb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6cbd[_0x550d12];return _0x12103d;};'use strict';var fs=require('fs');var path=require(_0xd6cb('0x0'));var BPromise=require(_0xd6cb('0x1'));var rs=require(_0xd6cb('0x2'));var AWS=require(_0xd6cb('0x3'));function pollyResult(_0x41a4b0,_0x85030a,_0xaa4de9){return new BPromise(function(_0x56f47f,_0x3624bc){_0x41a4b0['synthesizeSpeech'](_0x85030a,function(_0x1b38e2,_0x171593){if(_0x1b38e2){_0x3624bc(_0x1b38e2);}else if(_0x171593){if(_0x171593[_0xd6cb('0x4')]instanceof Buffer){fs[_0xd6cb('0x5')](_0xaa4de9,_0x171593[_0xd6cb('0x4')],function(_0x2ab9e2){if(_0x2ab9e2){_0x3624bc(_0x2ab9e2);}else{_0x56f47f();}});}else{_0x3624bc(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3624bc(new Error(_0xd6cb('0x6')));}});});}module[_0xd6cb('0x7')]=function(_0x17671e,_0x3fdbed,_0x362fda,_0x168596,_0x1d6ba9,_0x584610,_0x4fba16){var _0x89290d=new AWS['Polly']({'accessKeyId':_0x17671e,'secretAccessKey':_0x3fdbed,'region':_0x362fda});var _0x458ac8={'Text':_0x1d6ba9,'TextType':_0x584610||_0xd6cb('0x8'),'OutputFormat':_0xd6cb('0x9'),'VoiceId':_0x168596};return pollyResult(_0x89290d,_0x458ac8,_0x4fba16);}; \ No newline at end of file +var _0x4307=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4307,0xae));var _0x7430=function(_0x4f700b,_0x569519){_0x4f700b=_0x4f700b-0x0;var _0x21bcb2=_0x4307[_0x4f700b];return _0x21bcb2;};'use strict';var fs=require('fs');var path=require(_0x7430('0x0'));var BPromise=require(_0x7430('0x1'));var rs=require('randomstring');var AWS=require(_0x7430('0x2'));function pollyResult(_0x4928ef,_0x3ad7b5,_0x7722dd){return new BPromise(function(_0x4d59b4,_0x6b67b0){_0x4928ef[_0x7430('0x3')](_0x3ad7b5,function(_0x305905,_0x478d07){if(_0x305905){_0x6b67b0(_0x305905);}else if(_0x478d07){if(_0x478d07['AudioStream']instanceof Buffer){fs[_0x7430('0x4')](_0x7722dd,_0x478d07['AudioStream'],function(_0x2132b2){if(_0x2132b2){_0x6b67b0(_0x2132b2);}else{_0x4d59b4();}});}else{_0x6b67b0(new Error(_0x7430('0x5')));}}else{_0x6b67b0(new Error(_0x7430('0x6')));}});});}module['exports']=function(_0xa7fe17,_0x3dbd44,_0x41ee17,_0x5a23bc,_0x2010a5,_0x1b7e66,_0x598208){var _0x4fd9c3=new AWS[(_0x7430('0x7'))]({'accessKeyId':_0xa7fe17,'secretAccessKey':_0x3dbd44,'region':_0x41ee17});var _0x19ac7f={'Text':_0x2010a5,'TextType':_0x1b7e66||_0x7430('0x8'),'OutputFormat':'mp3','VoiceId':_0x5a23bc};return pollyResult(_0x4fd9c3,_0x19ac7f,_0x598208);}; \ 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 de8f352..4e5d078 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 _0x2d2c=['exports','./lib/api'];(function(_0x487801,_0x5d83a7){var _0x5df73f=function(_0x18d0ef){while(--_0x18d0ef){_0x487801['push'](_0x487801['shift']());}};_0x5df73f(++_0x5d83a7);}(_0x2d2c,0xef));var _0xc2d2=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x2d2c[_0x328ac9];return _0x2b3a0a;};'use strict';var asr=require(_0xc2d2('0x0'));module[_0xc2d2('0x1')]=function(_0x147ec8,_0x4a3204,_0x515fb8,_0x50fb2b){return asr(_0x147ec8,_0x4a3204,_0x515fb8);}; \ No newline at end of file +var _0x0c23=['exports'];(function(_0x45682b,_0x22ef44){var _0x28c3cd=function(_0x59047b){while(--_0x59047b){_0x45682b['push'](_0x45682b['shift']());}};_0x28c3cd(++_0x22ef44);}(_0x0c23,0x1c4));var _0x30c2=function(_0x162b59,_0x49fcde){_0x162b59=_0x162b59-0x0;var _0x2f2488=_0x0c23[_0x162b59];return _0x2f2488;};'use strict';var asr=require('./lib/api');module[_0x30c2('0x0')]=function(_0x24b32f,_0x57ba5f,_0x50dfd8,_0x11cd38){return asr(_0x24b32f,_0x57ba5f,_0x50dfd8);}; \ 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 5d3c601..9011bce 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 _0x4fef=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','bluebird'];(function(_0x204047,_0x2df7af){var _0x5956d2=function(_0x2d32a8){while(--_0x2d32a8){_0x204047['push'](_0x204047['shift']());}};_0x5956d2(++_0x2df7af);}(_0x4fef,0x10f));var _0xf4fe=function(_0x290f74,_0x1cfaa6){_0x290f74=_0x290f74-0x0;var _0x4de690=_0x4fef[_0x290f74];return _0x4de690;};'use strict';var url=require(_0xf4fe('0x0'));var BPromise=require(_0xf4fe('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf4fe('0x2')]=function(_0x5a2bd0,_0x40f4b2,_0x14bf18){return new BPromise(function(_0x3c78db,_0x1e5ec2){var _0x5c5dbb;if(typeof _0x5a2bd0!==_0xf4fe('0x3')||_0x5a2bd0[_0xf4fe('0x4')]===0x0){return _0x1e5ec2(_0xf4fe('0x5'));}if(typeof _0x40f4b2!=='string'||_0x40f4b2[_0xf4fe('0x4')]===0x0){return _0x1e5ec2(_0xf4fe('0x6'));}if(typeof _0x14bf18!=='undefined'&&(typeof _0x14bf18!==_0xf4fe('0x3')||_0x14bf18[_0xf4fe('0x4')]===0x0)){return _0x1e5ec2(_0xf4fe('0x7'));}try{_0x5c5dbb=fs[_0xf4fe('0x8')](_0x5a2bd0)[_0xf4fe('0x9')](_0xf4fe('0xa'));}catch(_0x42da04){return _0x1e5ec2(_0x42da04);}return _0x3c78db({'method':_0xf4fe('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x40f4b2,'body':{'config':{'encoding':_0xf4fe('0xc'),'sampleRateHertz':'8000','languageCode':_0x14bf18},'audio':{'content':_0x5c5dbb}},'json':!![]});});}; \ No newline at end of file +var _0x2e35=['length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','string'];(function(_0x40f279,_0x30bcd7){var _0x4a33e5=function(_0x5a8f09){while(--_0x5a8f09){_0x40f279['push'](_0x40f279['shift']());}};_0x4a33e5(++_0x30bcd7);}(_0x2e35,0x1d0));var _0x52e3=function(_0x5719a4,_0x2426f4){_0x5719a4=_0x5719a4-0x0;var _0x5e162f=_0x2e35[_0x5719a4];return _0x5e162f;};'use strict';var url=require(_0x52e3('0x0'));var BPromise=require(_0x52e3('0x1'));var fs=require('fs');var host=_0x52e3('0x2');module['exports']=function(_0x145ad0,_0xcbe6c5,_0x16d807){return new BPromise(function(_0x3dc244,_0x4ccab4){var _0x158226;if(typeof _0x145ad0!==_0x52e3('0x3')||_0x145ad0[_0x52e3('0x4')]===0x0){return _0x4ccab4(_0x52e3('0x5'));}if(typeof _0xcbe6c5!=='string'||_0xcbe6c5['length']===0x0){return _0x4ccab4('key\x20should\x20be\x20a\x20string');}if(typeof _0x16d807!==_0x52e3('0x6')&&(typeof _0x16d807!=='string'||_0x16d807['length']===0x0)){return _0x4ccab4(_0x52e3('0x7'));}try{_0x158226=fs[_0x52e3('0x8')](_0x145ad0)['toString'](_0x52e3('0x9'));}catch(_0x1153c4){return _0x4ccab4(_0x1153c4);}return _0x3dc244({'method':'POST','uri':host+_0x52e3('0xa')+_0xcbe6c5,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x52e3('0xb'),'languageCode':_0x16d807},'audio':{'content':_0x158226}},'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 805dcd7..ea6a3e9 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 _0x6662=['exports','./asr'];(function(_0x3a5fdd,_0x410065){var _0x46fcd6=function(_0x565738){while(--_0x565738){_0x3a5fdd['push'](_0x3a5fdd['shift']());}};_0x46fcd6(++_0x410065);}(_0x6662,0x17d));var _0x2666=function(_0x11a566,_0x4b82c5){_0x11a566=_0x11a566-0x0;var _0x2395ac=_0x6662[_0x11a566];return _0x2395ac;};var asr=require(_0x2666('0x0'));module[_0x2666('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6224=['./asr','exports'];(function(_0x54b5bd,_0x133fe1){var _0xcba844=function(_0x4023dc){while(--_0x4023dc){_0x54b5bd['push'](_0x54b5bd['shift']());}};_0xcba844(++_0x133fe1);}(_0x6224,0xa8));var _0x4622=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x6224[_0x4b174a];return _0x3cd7bf;};var asr=require(_0x4622('0x0'));module[_0x4622('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9f9318f..a4b0331 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 _0x55fe=['join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','ispeechASR','format','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','download\x20error','pipe','https:','get','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','POST','.mp3','from','writeFile','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','generic','then','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','uri','results','transcript','alternatives'];(function(_0x38d121,_0x1868f4){var _0x84f59c=function(_0x16abab){while(--_0x16abab){_0x38d121['push'](_0x38d121['shift']());}};_0x84f59c(++_0x1868f4);}(_0x55fe,0x1d5));var _0xe55f=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0x55fe[_0x5a91a5];return _0x8f99de;};'use strict';var apiai=require(_0xe55f('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xe55f('0x1'));var fs=require('fs');var http=require(_0xe55f('0x2'));var https=require(_0xe55f('0x3'));var md5=require(_0xe55f('0x4'));var path=require(_0xe55f('0x5'));var querystring=require(_0xe55f('0x6'));var rp=require(_0xe55f('0x7'));var rs=require(_0xe55f('0x8'));var sox=require(_0xe55f('0x9'));var tts=require(_0xe55f('0xa'));var urlParse=require(_0xe55f('0xb'))[_0xe55f('0xc')];var util=require(_0xe55f('0xd'));var aws=require('./aws');var google=require(_0xe55f('0xe'));var sestek=require(_0xe55f('0xf'));var tilde=require('./tilde');var logger=require(_0xe55f('0x10'))(_0xe55f('0x11'));var ISPEECH_API=_0xe55f('0x12');function downloadFile(_0x5914e5,_0x1b85a5){return new BPromise(function(_0x1a7827,_0x2a389d){var _0x1a5f30=urlParse(_0x5914e5);var _0x565830=_0x1a5f30[_0xe55f('0x13')]==='https:'?https:http;var _0x4c44aa={'host':_0x1a5f30[_0xe55f('0x14')],'path':_0x1a5f30['path'],'headers':{'user-agent':_0xe55f('0x15')}};_0x565830['get'](_0x4c44aa,function(_0x5eefbe){if(_0x5eefbe['statusCode']!==0xc8){logger[_0xe55f('0x16')]('request\x20to\x20'+_0x5914e5+_0xe55f('0x17')+_0x5eefbe[_0xe55f('0x18')]+'\x20('+_0x5eefbe['statusMessage']+')');_0x2a389d(new Error(_0xe55f('0x19')+_0x5914e5+_0xe55f('0x17')+_0x5eefbe[_0xe55f('0x18')]+'\x20('+_0x5eefbe[_0xe55f('0x1a')]+')'));return;}var _0x1bbe40=fs[_0xe55f('0x1b')](_0x1b85a5);_0x1bbe40['on'](_0xe55f('0x1c'),function(){logger['info'](_0xe55f('0x1d'));_0x1bbe40[_0xe55f('0x1e')](_0x1a7827);});_0x1bbe40['on']('error',function(_0xb72bea){fs['unlink'](_0x1b85a5);logger[_0xe55f('0x16')](_0xe55f('0x1f'),_0xb72bea);_0x2a389d(_0xb72bea);});_0x5eefbe[_0xe55f('0x20')](_0x1bbe40);})['on'](_0xe55f('0x16'),function(_0x4c7cb1){logger['error'](_0x4c7cb1);_0x2a389d(_0x4c7cb1);})['end']();});}function uploadFile(_0x2234ee){return new BPromise(function(_0x158d5f,_0x5dd56b){var _0x18fb30=urlParse(_0x2234ee);var _0x3ebbb8=_0x18fb30[_0xe55f('0x13')]===_0xe55f('0x21')?https:http;var _0x4b8c05={'host':_0x18fb30[_0xe55f('0x14')],'path':_0x18fb30['path'],'headers':{'user-agent':_0xe55f('0x15')}};_0x3ebbb8[_0xe55f('0x22')](_0x4b8c05,function(_0x29b2e0){if(_0x29b2e0['statusCode']!==0xc8){_0x5dd56b(new Error(_0xe55f('0x19')+_0x2234ee+_0xe55f('0x17')+_0x29b2e0['statusCode']+'\x20('+_0x29b2e0[_0xe55f('0x1a')]+')'));return;}var _0x32c9c0='';_0x29b2e0['on'](_0xe55f('0x23'),function(_0x3eb1c5){_0x32c9c0+=_0x3eb1c5;});_0x29b2e0['on'](_0xe55f('0x24'),function(){_0x158d5f(_0x32c9c0);});})['on']('error',function(_0x54b58a){_0x5dd56b(_0x54b58a);})[_0xe55f('0x24')]();});}function convertFile(_0x44342f,_0x8888ae){return new BPromise(function(_0x3645f3,_0x451574){var _0x2a40ef=sox[_0xe55f('0x25')](_0x44342f,_0x8888ae,{'sampleRate':0x1f40,'format':_0xe55f('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a40ef['on']('error',function(_0x3d0d55){logger['error'](_0xe55f('0x27'),_0x3d0d55);_0x451574(_0x3d0d55);});_0x2a40ef['on']('end',function(){logger[_0xe55f('0x28')](_0xe55f('0x29'));_0x3645f3();});_0x2a40ef[_0xe55f('0x2a')]();});}function base64Decode(_0x43afab,_0x2c0cfa){var _0x2e422d=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e'));fs[_0xe55f('0x2f')](_0x2e422d,_0x43afab,_0xe55f('0x30'));return convertFile(_0x2e422d,_0x2c0cfa)['then'](function(){try{fs['unlink'](_0x2e422d);fs[_0xe55f('0x31')](_0x2c0cfa,_0xe55f('0x32'));}catch(_0x2ab307){logger['error'](_0x2ab307);}return _0x2c0cfa[_0xe55f('0x33')]('.')[0x0];});}function base64Encode(_0x4ac105){var _0xcc5c98=fs[_0xe55f('0x34')](_0x4ac105);return new Buffer(_0xcc5c98)[_0xe55f('0x35')](_0xe55f('0x30'));}exports[_0xe55f('0x36')]=function(_0x4a9221,_0xff9542,_0x3582c9,_0x31fcd6,_0x193937,_0x3ccaaa){var _0x5b112b,_0x2eb5c6;var _0x2c8631='https://texttospeech.googleapis.com/v1/';var _0x257ca7=_0xe55f('0x37')+_0x4a9221;var _0x40f529={};if(_0xff9542===_0xe55f('0x38')){_0x40f529[_0xe55f('0x39')]={'ssml':_0x3582c9};}else{_0x40f529[_0xe55f('0x39')]={'text':_0x3582c9};};_0x40f529[_0xe55f('0x3a')]={'languageCode':_0x31fcd6,'ssmlGender':_0x193937};_0x40f529[_0xe55f('0x3b')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3f6a59={'url':_0x2c8631+'text:synthesize'+_0x257ca7,'method':_0xe55f('0x3c'),'json':!![],'body':_0x40f529};return rp(_0x3f6a59)['then'](function(_0x23eefc){return new BPromise(function(_0x253a58,_0x2c70c5){_0x5b112b=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs['generate'](0x4)+_0xe55f('0x3d'));var _0x23009c=Buffer[_0xe55f('0x3e')](_0x23eefc['audioContent'],_0xe55f('0x30'));return fs[_0xe55f('0x3f')](_0x5b112b,_0x23009c,function(_0x5e80c4){_0x2c70c5(_0x5e80c4);},function(_0xcd0c43){fs[_0xe55f('0x31')](_0x5b112b,_0xe55f('0x32'));_0x253a58(_0xcd0c43);});});})['then'](function(_0x36c6cf){_0x2eb5c6=path[_0xe55f('0x2b')](__dirname,'tmp',rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e'));return convertFile(_0x5b112b,_0x2eb5c6);})['then'](function(){try{fs[_0xe55f('0x40')](_0x5b112b);fs[_0xe55f('0x31')](_0x2eb5c6,'777');}catch(_0x212011){logger[_0xe55f('0x16')](_0x212011);}logger[_0xe55f('0x28')](_0xe55f('0x41'),_0x2eb5c6[_0xe55f('0x33')]('.')[0x0]);return _0x2eb5c6[_0xe55f('0x33')]('.')[0x0];});};exports[_0xe55f('0x42')]=function(_0x40368a,_0x304ff6){var _0x3780db=_0xe55f('0x43');var _0x403437,_0x4403ca;var _0x4b9433;var _0x2f6fed={'encoding':_0xe55f('0x44'),'method':_0xe55f('0x3c'),'timeout':0x2710,'url':_0x3780db,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xe55f('0x45')+encodeURIComponent(JSON[_0xe55f('0x46')]([[['jQ1olc',JSON[_0xe55f('0x46')]([_0x40368a,_0x304ff6||'en',![],'null']),null,_0xe55f('0x47')]]]))};return rp(_0x2f6fed)[_0xe55f('0x48')](function(_0x49893c){try{_0x4b9433=eval(_0x49893c[_0xe55f('0x49')](0x5))[0x0][0x2];}catch(_0x6dd05c){throw new Error(_0xe55f('0x4a')+_0x49893c['data']);}if(!_0x4b9433){if(_0x40368a[_0xe55f('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xe55f('0x4c')+_0x304ff6+'\x22\x20might\x20not\x20exist');}}try{_0x4b9433=eval(_0x4b9433)[0x0];}catch(_0x2e191c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe55f('0x23')]);}const _0x5e4f3a=_0x4b9433;_0x403437=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs['generate'](0x4)+_0xe55f('0x3d'));fs['writeFileSync'](_0x403437,_0x4b9433,{'encoding':'base64'});_0x4403ca=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e'));return convertFile(_0x403437,_0x4403ca);})['then'](function(){try{fs[_0xe55f('0x40')](_0x403437);fs['chmodSync'](_0x4403ca,_0xe55f('0x32'));}catch(_0xcc7d48){logger[_0xe55f('0x16')](_0xcc7d48);}logger[_0xe55f('0x28')](_0xe55f('0x4d'),_0x4403ca[_0xe55f('0x33')]('.')[0x0]);return _0x4403ca[_0xe55f('0x33')]('.')[0x0];});};exports[_0xe55f('0x4e')]=function(_0x249e36,_0x151626,_0x254e30){return google['asr'](_0x249e36,_0x151626,_0x254e30)[_0xe55f('0x48')](function(_0xfbadfa){logger['info'](_0xfbadfa[_0xe55f('0x4f')]);return rp(_0xfbadfa);})[_0xe55f('0x48')](function(_0x148276){var _0x4667df='';var _0x9025d=0x0;try{fs['unlink'](_0x249e36);}catch(_0x4e125e){logger[_0xe55f('0x16')](_0x4e125e);}if(_0x148276&&_0x148276[_0xe55f('0x50')]){_0x4667df=_0x148276[_0xe55f('0x50')]['map'](function(_0x563e76){return _0x563e76&&_0x563e76['alternatives'][0x0]&&_0x563e76['alternatives'][0x0][_0xe55f('0x51')]?_0x563e76[_0xe55f('0x52')][0x0][_0xe55f('0x51')]:'';})[_0xe55f('0x53')]('\x0a');_0x9025d=_0x148276[_0xe55f('0x50')][_0xe55f('0x54')](function(_0x4c05aa){return _0x4c05aa&&_0x4c05aa['alternatives'][0x0]&&_0x4c05aa[_0xe55f('0x52')][0x0][_0xe55f('0x55')]?_0x4c05aa[_0xe55f('0x52')][0x0][_0xe55f('0x55')]:0x0;})[_0xe55f('0x53')]('\x0a');}logger[_0xe55f('0x28')](_0xe55f('0x56'),_0x4667df);logger['info'](_0xe55f('0x57'),_0x9025d);return{'transcript':_0x4667df,'confidence':_0x9025d};})[_0xe55f('0x58')](function(_0x138467){logger['error'](_0xe55f('0x59'),_0x138467['statusCode'],_0x138467[_0xe55f('0x5a')],_0x138467['message']);});};exports[_0xe55f('0x5b')]=function(_0x2d209e,_0x524c85,_0x15d3fb,_0x3783f5){var _0x12d3d5=apiai(_0x524c85,{'language':_0x3783f5||'en'});return _0x12d3d5[_0xe55f('0x5c')](_0x15d3fb,{'sessionId':md5(_0x2d209e)})[_0xe55f('0x48')](function(_0x47abd6){logger[_0xe55f('0x28')](JSON[_0xe55f('0x46')](_0x47abd6));return{'source':_0x47abd6[_0xe55f('0x5d')][_0xe55f('0x5e')],'resolvedQuery':_0x47abd6[_0xe55f('0x5d')][_0xe55f('0x5f')],'action':_0x47abd6['result']['action'],'actionIncomplete':_0x47abd6[_0xe55f('0x5d')]['actionIncomplete'],'speech':_0x47abd6[_0xe55f('0x5d')]['fulfillment'][_0xe55f('0x60')],'score':_0x47abd6[_0xe55f('0x5d')][_0xe55f('0x61')],'statusCode':_0x47abd6[_0xe55f('0x62')][_0xe55f('0x63')],'endConversation':_0x47abd6[_0xe55f('0x5d')][_0xe55f('0x64')][_0xe55f('0x65')]||![],'isFallbackIntent':_0x47abd6['result'][_0xe55f('0x64')][_0xe55f('0x66')]};});};exports[_0xe55f('0x67')]=function(_0x550a92,_0x57628d,_0x2feb71,_0x8dace8,_0x192a96,_0x378fdd){var _0x3e7784=_0x8dace8[_0xe55f('0x68')](/\\n/g,'\x0a');var _0x4d5e71={'credentials':{'private_key':_0x3e7784,'client_email':_0x2feb71}};var _0x5968b9=new dialogflow[(_0xe55f('0x69'))](_0x4d5e71);var _0x549a15=_0x5968b9[_0xe55f('0x6a')](_0x57628d,md5(_0x550a92));var _0x1c8afb={'session':_0x549a15,'queryInput':{'text':{'text':_0x192a96,'languageCode':_0x378fdd}}};return _0x5968b9[_0xe55f('0x6b')](_0x1c8afb)[_0xe55f('0x48')](function(_0x4d3321){if(_0x4d3321&&_0x4d3321[_0xe55f('0x4b')]){logger[_0xe55f('0x28')](_0xe55f('0x6c'),JSON['stringify'](_0x4d3321));var _0x3866e9=_0x4d3321[0x0];if(_0x3866e9){var _0xaf9495={'action':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x6e')],'allRequiredParamsPresent':_0x3866e9[_0xe55f('0x6d')]['allRequiredParamsPresent'],'endConversation':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x6f')]&&_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x6f')][_0xe55f('0x70')]?_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x6f')][_0xe55f('0x70')]['end_conversation'][_0xe55f('0x71')]:![],'fulfillmentText':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x72')],'intentName':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x73')][_0xe55f('0x5a')],'intentDisplayName':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x73')][_0xe55f('0x74')],'isFallbackIntent':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x73')][_0xe55f('0x75')],'languageCode':_0x3866e9['queryResult']['languageCode'],'queryText':_0x3866e9[_0xe55f('0x6d')]['queryText'],'responseId':_0x3866e9[_0xe55f('0x76')],'score':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x77')],'speech':_0x3866e9[_0xe55f('0x6d')][_0xe55f('0x72')],'providerResponse':JSON[_0xe55f('0x46')](_0x4d3321)};return _0xaf9495;}}});};exports[_0xe55f('0x78')]=function(_0x4730d7,_0x421258,_0x5186c4,_0x397399){return tilde['asr'](_0x4730d7,_0x421258,_0x5186c4,_0x397399)['then'](function(_0x5ec95a){try{fs[_0xe55f('0x40')](_0x4730d7);}catch(_0x1e0704){logger[_0xe55f('0x16')](_0x1e0704);}logger[_0xe55f('0x28')](_0xe55f('0x79'),_0x5ec95a['transcript']);logger['info'](_0xe55f('0x7a'),_0x5ec95a[_0xe55f('0x55')]);return _0x5ec95a;});};exports[_0xe55f('0x7b')]=function(_0x32861a,_0x3e39fd,_0x417953,_0x5f4fa6,_0x428943,_0x14a9f5){var _0x57d69b=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x3d'));var _0x148932;return aws['polly'](_0x32861a,_0x3e39fd,_0x417953,_0x5f4fa6,_0x428943,_0x14a9f5,_0x57d69b)[_0xe55f('0x48')](function(){_0x148932=path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e'));return convertFile(_0x57d69b,_0x148932);})[_0xe55f('0x48')](function(){try{fs[_0xe55f('0x40')](_0x57d69b);fs[_0xe55f('0x31')](_0x148932,_0xe55f('0x32'));}catch(_0x3a57bb){logger[_0xe55f('0x16')](_0x3a57bb);}return _0x148932['split']('.')[0x0];});};exports['awsLex']=function(_0xb8bd97,_0x385a9e,_0x3c8780,_0x2f90c9,_0x312b5d,_0x3af033){return aws[_0xe55f('0x7c')](_0xb8bd97,_0x385a9e,_0x3c8780,_0x2f90c9,_0x312b5d,_0x3af033)[_0xe55f('0x48')](function(_0x3e1c1d){logger[_0xe55f('0x28')](JSON[_0xe55f('0x46')](_0x3e1c1d));return _0x3e1c1d;});};exports[_0xe55f('0x7d')]=function(_0x2e7de4,_0x5b8c24,_0x2ff45d,_0x2c0627){var _0x3aedcc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2e7de4,encodeURIComponent(_0x5b8c24),_0x2ff45d,_0x2c0627);var _0x4a94fe=path['resolve'](__dirname,_0xe55f('0x2c'),rs['generate'](0x4)+'.mp3');var _0x37d6fe;return downloadFile(_0x3aedcc,_0x4a94fe)[_0xe55f('0x48')](function(){_0x37d6fe=path['resolve'](__dirname,'tmp',rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e'));return convertFile(_0x4a94fe,_0x37d6fe);})['then'](function(){try{fs[_0xe55f('0x40')](_0x4a94fe);fs[_0xe55f('0x31')](_0x37d6fe,'777');}catch(_0x127485){logger[_0xe55f('0x16')](_0x127485);}return _0x37d6fe[_0xe55f('0x33')]('.')[0x0];});};exports[_0xe55f('0x7e')]=function(_0x1e9ed8,_0x5258c6,_0x5d0e3a,_0x1342e0){var _0x3c549a=util[_0xe55f('0x7f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5258c6,_0x5d0e3a,base64Encode(_0x1e9ed8),_0x1342e0?util['format'](_0xe55f('0x80'),encodeURIComponent(_0x1342e0)):_0xe55f('0x81'));return uploadFile(_0x3c549a)[_0xe55f('0x48')](function(_0x5196be){return querystring[_0xe55f('0xc')](_0x5196be);});};exports['sestekNDA']=function(_0x2bd123,_0x21c6aa){return sestek[_0xe55f('0x82')](_0x2bd123,_0x21c6aa)[_0xe55f('0x48')](function(_0x2558fe){logger[_0xe55f('0x28')](JSON[_0xe55f('0x46')](_0x2558fe));var _0x57bf73={'speech':_0x2558fe['text'],'action':_0x2558fe[_0xe55f('0x83')]?_0x2558fe[_0xe55f('0x83')][_0xe55f('0x84')]:undefined,'actiondata':_0x2558fe[_0xe55f('0x83')]?_0x2558fe['channelData'][_0xe55f('0x85')]:undefined};if(_0x2558fe['channelData']&&_0x2558fe[_0xe55f('0x83')][_0xe55f('0x86')]){return base64Decode(_0x2558fe[_0xe55f('0x83')]['AudioFromTts'][_0xe55f('0x87')],path[_0xe55f('0x2b')](__dirname,_0xe55f('0x2c'),rs[_0xe55f('0x2d')](0x4)+_0xe55f('0x2e')))[_0xe55f('0x48')](function(_0x156f6d){_0x57bf73[_0xe55f('0x88')]=_0x156f6d;return _0x57bf73;});}return _0x57bf73;});};exports[_0xe55f('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0xadda=['../../../config/logger','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','error','unlink','pipe','protocol','https:','data','end','transcode','error\x20convert','finish\x20to\x20convert','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','?key=','ssml','input','voice','audioConfig','MP3','POST','resolve','tmp','.mp3','audioContent','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','asr','awsPolly','polly','awsLex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','md5','path','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./tilde'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xadda,0x73));var _0xaadd=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xadda[_0x1ac595];return _0x455fff;};'use strict';var apiai=require(_0xaadd('0x0'));var BPromise=require(_0xaadd('0x1'));var dialogflow=require(_0xaadd('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xaadd('0x3'));var path=require(_0xaadd('0x4'));var querystring=require('querystring');var rp=require(_0xaadd('0x5'));var rs=require(_0xaadd('0x6'));var sox=require('sox');var tts=require(_0xaadd('0x7'));var urlParse=require('url')[_0xaadd('0x8')];var util=require(_0xaadd('0x9'));var aws=require(_0xaadd('0xa'));var google=require(_0xaadd('0xb'));var sestek=require('./sestek');var tilde=require(_0xaadd('0xc'));var logger=require(_0xaadd('0xd'))('agi');var ISPEECH_API=_0xaadd('0xe');function downloadFile(_0x5846fa,_0x4d2f5a){return new BPromise(function(_0x586879,_0x49fbc5){var _0x3df9a1=urlParse(_0x5846fa);var _0x1fc960=_0x3df9a1['protocol']==='https:'?https:http;var _0x255478={'host':_0x3df9a1[_0xaadd('0xf')],'path':_0x3df9a1[_0xaadd('0x4')],'headers':{'user-agent':_0xaadd('0x10')}};_0x1fc960[_0xaadd('0x11')](_0x255478,function(_0x157a6c){if(_0x157a6c[_0xaadd('0x12')]!==0xc8){logger['error'](_0xaadd('0x13')+_0x5846fa+_0xaadd('0x14')+_0x157a6c['statusCode']+'\x20('+_0x157a6c[_0xaadd('0x15')]+')');_0x49fbc5(new Error(_0xaadd('0x13')+_0x5846fa+_0xaadd('0x14')+_0x157a6c[_0xaadd('0x12')]+'\x20('+_0x157a6c[_0xaadd('0x15')]+')'));return;}var _0x3f88c6=fs[_0xaadd('0x16')](_0x4d2f5a);_0x3f88c6['on']('finish',function(){logger[_0xaadd('0x17')]('finish\x20download\x20file');_0x3f88c6[_0xaadd('0x18')](_0x586879);});_0x3f88c6['on'](_0xaadd('0x19'),function(_0x363a31){fs[_0xaadd('0x1a')](_0x4d2f5a);logger['error']('download\x20error',_0x363a31);_0x49fbc5(_0x363a31);});_0x157a6c[_0xaadd('0x1b')](_0x3f88c6);})['on']('error',function(_0x484fb7){logger[_0xaadd('0x19')](_0x484fb7);_0x49fbc5(_0x484fb7);})['end']();});}function uploadFile(_0x564b89){return new BPromise(function(_0x193d03,_0x2b45da){var _0x186b03=urlParse(_0x564b89);var _0x4b6ab0=_0x186b03[_0xaadd('0x1c')]===_0xaadd('0x1d')?https:http;var _0x474fde={'host':_0x186b03[_0xaadd('0xf')],'path':_0x186b03['path'],'headers':{'user-agent':_0xaadd('0x10')}};_0x4b6ab0[_0xaadd('0x11')](_0x474fde,function(_0x19697b){if(_0x19697b[_0xaadd('0x12')]!==0xc8){_0x2b45da(new Error(_0xaadd('0x13')+_0x564b89+_0xaadd('0x14')+_0x19697b[_0xaadd('0x12')]+'\x20('+_0x19697b[_0xaadd('0x15')]+')'));return;}var _0x1f6d65='';_0x19697b['on'](_0xaadd('0x1e'),function(_0x1dd3b4){_0x1f6d65+=_0x1dd3b4;});_0x19697b['on'](_0xaadd('0x1f'),function(){_0x193d03(_0x1f6d65);});})['on'](_0xaadd('0x19'),function(_0x5c0c9a){_0x2b45da(_0x5c0c9a);})['end']();});}function convertFile(_0x3ceb67,_0xd1772){return new BPromise(function(_0x5cb02f,_0x3e4f2a){var _0x37fede=sox[_0xaadd('0x20')](_0x3ceb67,_0xd1772,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x37fede['on'](_0xaadd('0x19'),function(_0x1b96b1){logger[_0xaadd('0x19')](_0xaadd('0x21'),_0x1b96b1);_0x3e4f2a(_0x1b96b1);});_0x37fede['on']('end',function(){logger['info'](_0xaadd('0x22'));_0x5cb02f();});_0x37fede['start']();});}function base64Decode(_0x36c33e,_0x1d63b0){var _0x303589=path['resolve'](__dirname,'tmp',rs[_0xaadd('0x23')](0x4)+_0xaadd('0x24'));fs[_0xaadd('0x25')](_0x303589,_0x36c33e,_0xaadd('0x26'));return convertFile(_0x303589,_0x1d63b0)[_0xaadd('0x27')](function(){try{fs['unlink'](_0x303589);fs[_0xaadd('0x28')](_0x1d63b0,'777');}catch(_0x5c7a71){logger[_0xaadd('0x19')](_0x5c7a71);}return _0x1d63b0[_0xaadd('0x29')]('.')[0x0];});}function base64Encode(_0x307628){var _0x4336f4=fs[_0xaadd('0x2a')](_0x307628);return new Buffer(_0x4336f4)[_0xaadd('0x2b')](_0xaadd('0x26'));}exports['googleCloudTTS']=function(_0x45589a,_0x722be4,_0x350090,_0x347a9f,_0x429d32,_0x101916){var _0x4372c2,_0x195909;var _0x2cacb8='https://texttospeech.googleapis.com/v1/';var _0x21b8d9=_0xaadd('0x2c')+_0x45589a;var _0x4df385={};if(_0x722be4===_0xaadd('0x2d')){_0x4df385[_0xaadd('0x2e')]={'ssml':_0x350090};}else{_0x4df385[_0xaadd('0x2e')]={'text':_0x350090};};_0x4df385[_0xaadd('0x2f')]={'languageCode':_0x347a9f,'ssmlGender':_0x429d32};_0x4df385[_0xaadd('0x30')]={'audioEncoding':_0xaadd('0x31'),'sampleRateHertz':0x1f40};var _0x5b0304={'url':_0x2cacb8+'text:synthesize'+_0x21b8d9,'method':_0xaadd('0x32'),'json':!![],'body':_0x4df385};return rp(_0x5b0304)[_0xaadd('0x27')](function(_0xd03520){return new BPromise(function(_0x36a0fd,_0x3b5d2c){_0x4372c2=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x35'));var _0x529d40=Buffer['from'](_0xd03520[_0xaadd('0x36')],'base64');return fs[_0xaadd('0x37')](_0x4372c2,_0x529d40,function(_0x139796){_0x3b5d2c(_0x139796);},function(_0x296fda){fs['chmodSync'](_0x4372c2,_0xaadd('0x38'));_0x36a0fd(_0x296fda);});});})[_0xaadd('0x27')](function(_0x3b5965){_0x195909=path[_0xaadd('0x33')](__dirname,'tmp',rs['generate'](0x4)+_0xaadd('0x24'));return convertFile(_0x4372c2,_0x195909);})[_0xaadd('0x27')](function(){try{fs[_0xaadd('0x1a')](_0x4372c2);fs[_0xaadd('0x28')](_0x195909,_0xaadd('0x38'));}catch(_0x235a69){logger[_0xaadd('0x19')](_0x235a69);}logger['info'](_0xaadd('0x39'),_0x195909[_0xaadd('0x29')]('.')[0x0]);return _0x195909[_0xaadd('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x3f34e6,_0x272ff6){var _0x3f0c41=_0xaadd('0x3a');var _0x13785b,_0x1b722a;var _0x9fabc0;var _0x4cbee7={'encoding':_0xaadd('0x3b'),'method':'POST','timeout':0x2710,'url':_0x3f0c41,'headers':{'Content-Type':_0xaadd('0x3c')},'body':_0xaadd('0x3d')+encodeURIComponent(JSON[_0xaadd('0x3e')]([[[_0xaadd('0x3f'),JSON['stringify']([_0x3f34e6,_0x272ff6||'en',![],_0xaadd('0x40')]),null,_0xaadd('0x41')]]]))};return rp(_0x4cbee7)[_0xaadd('0x27')](function(_0x247c10){try{_0x9fabc0=eval(_0x247c10[_0xaadd('0x42')](0x5))[0x0][0x2];}catch(_0x2da166){throw new Error('parse\x20response\x20failed:\x0a'+_0x247c10['data']);}if(!_0x9fabc0){if(_0x3f34e6[_0xaadd('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xaadd('0x44')+_0x272ff6+_0xaadd('0x45'));}}try{_0x9fabc0=eval(_0x9fabc0)[0x0];}catch(_0x7bf4b5){throw new Error(_0xaadd('0x46')+res[_0xaadd('0x1e')]);}const _0x37ea05=_0x9fabc0;_0x13785b=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x35'));fs[_0xaadd('0x25')](_0x13785b,_0x9fabc0,{'encoding':_0xaadd('0x26')});_0x1b722a=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x24'));return convertFile(_0x13785b,_0x1b722a);})[_0xaadd('0x27')](function(){try{fs[_0xaadd('0x1a')](_0x13785b);fs[_0xaadd('0x28')](_0x1b722a,'777');}catch(_0x2df712){logger[_0xaadd('0x19')](_0x2df712);}logger[_0xaadd('0x17')](_0xaadd('0x47'),_0x1b722a[_0xaadd('0x29')]('.')[0x0]);return _0x1b722a['split']('.')[0x0];});};exports['googleASR']=function(_0x296e06,_0x4395a5,_0x58ba4b){return google['asr'](_0x296e06,_0x4395a5,_0x58ba4b)[_0xaadd('0x27')](function(_0xe033a8){logger[_0xaadd('0x17')](_0xe033a8['uri']);return rp(_0xe033a8);})[_0xaadd('0x27')](function(_0x54502b){var _0x1c8df5='';var _0x800ef8=0x0;try{fs['unlink'](_0x296e06);}catch(_0x4d4f81){logger[_0xaadd('0x19')](_0x4d4f81);}if(_0x54502b&&_0x54502b[_0xaadd('0x48')]){_0x1c8df5=_0x54502b[_0xaadd('0x48')][_0xaadd('0x49')](function(_0x15d198){return _0x15d198&&_0x15d198[_0xaadd('0x4a')][0x0]&&_0x15d198[_0xaadd('0x4a')][0x0][_0xaadd('0x4b')]?_0x15d198['alternatives'][0x0][_0xaadd('0x4b')]:'';})['join']('\x0a');_0x800ef8=_0x54502b['results'][_0xaadd('0x49')](function(_0x309d50){return _0x309d50&&_0x309d50[_0xaadd('0x4a')][0x0]&&_0x309d50[_0xaadd('0x4a')][0x0][_0xaadd('0x4c')]?_0x309d50[_0xaadd('0x4a')][0x0][_0xaadd('0x4c')]:0x0;})[_0xaadd('0x4d')]('\x0a');}logger['info'](_0xaadd('0x4e'),_0x1c8df5);logger[_0xaadd('0x17')](_0xaadd('0x4f'),_0x800ef8);return{'transcript':_0x1c8df5,'confidence':_0x800ef8};})[_0xaadd('0x50')](function(_0x4106a9){logger['error'](_0xaadd('0x51'),_0x4106a9[_0xaadd('0x12')],_0x4106a9['name'],_0x4106a9[_0xaadd('0x52')]);});};exports[_0xaadd('0x53')]=function(_0x31ab42,_0x214e0b,_0x13decb,_0x49ec16){var _0x1dac0b=apiai(_0x214e0b,{'language':_0x49ec16||'en'});return _0x1dac0b[_0xaadd('0x54')](_0x13decb,{'sessionId':md5(_0x31ab42)})[_0xaadd('0x27')](function(_0x3e3406){logger['info'](JSON[_0xaadd('0x3e')](_0x3e3406));return{'source':_0x3e3406['result'][_0xaadd('0x55')],'resolvedQuery':_0x3e3406[_0xaadd('0x56')][_0xaadd('0x57')],'action':_0x3e3406['result'][_0xaadd('0x58')],'actionIncomplete':_0x3e3406[_0xaadd('0x56')]['actionIncomplete'],'speech':_0x3e3406[_0xaadd('0x56')][_0xaadd('0x59')]['speech'],'score':_0x3e3406[_0xaadd('0x56')][_0xaadd('0x5a')],'statusCode':_0x3e3406[_0xaadd('0x5b')][_0xaadd('0x5c')],'endConversation':_0x3e3406[_0xaadd('0x56')][_0xaadd('0x5d')][_0xaadd('0x5e')]||![],'isFallbackIntent':_0x3e3406[_0xaadd('0x56')][_0xaadd('0x5d')][_0xaadd('0x5f')]};});};exports[_0xaadd('0x60')]=function(_0x5b2013,_0xa473c8,_0x570ffb,_0x33dd98,_0x154170,_0x4e76b8){var _0x2990c5=_0x33dd98['replace'](/\\n/g,'\x0a');var _0x2878aa={'credentials':{'private_key':_0x2990c5,'client_email':_0x570ffb}};var _0x368f2a=new dialogflow[(_0xaadd('0x61'))](_0x2878aa);var _0x37bd98=_0x368f2a['sessionPath'](_0xa473c8,md5(_0x5b2013));var _0x28a0b7={'session':_0x37bd98,'queryInput':{'text':{'text':_0x154170,'languageCode':_0x4e76b8}}};return _0x368f2a['detectIntent'](_0x28a0b7)[_0xaadd('0x27')](function(_0x1edde6){if(_0x1edde6&&_0x1edde6[_0xaadd('0x43')]){logger[_0xaadd('0x17')](_0xaadd('0x62'),JSON[_0xaadd('0x3e')](_0x1edde6));var _0x286c45=_0x1edde6[0x0];if(_0x286c45){var _0x49c195={'action':_0x286c45[_0xaadd('0x63')][_0xaadd('0x58')],'allRequiredParamsPresent':_0x286c45['queryResult']['allRequiredParamsPresent'],'endConversation':_0x286c45['queryResult'][_0xaadd('0x64')]&&_0x286c45[_0xaadd('0x63')][_0xaadd('0x64')][_0xaadd('0x65')]?_0x286c45[_0xaadd('0x63')][_0xaadd('0x64')][_0xaadd('0x65')][_0xaadd('0x66')][_0xaadd('0x67')]:![],'fulfillmentText':_0x286c45[_0xaadd('0x63')]['fulfillmentText'],'intentName':_0x286c45[_0xaadd('0x63')][_0xaadd('0x68')]['name'],'intentDisplayName':_0x286c45['queryResult'][_0xaadd('0x68')][_0xaadd('0x69')],'isFallbackIntent':_0x286c45['queryResult'][_0xaadd('0x68')][_0xaadd('0x6a')],'languageCode':_0x286c45[_0xaadd('0x63')][_0xaadd('0x6b')],'queryText':_0x286c45[_0xaadd('0x63')][_0xaadd('0x6c')],'responseId':_0x286c45[_0xaadd('0x6d')],'score':_0x286c45[_0xaadd('0x63')][_0xaadd('0x6e')],'speech':_0x286c45[_0xaadd('0x63')][_0xaadd('0x6f')],'providerResponse':JSON[_0xaadd('0x3e')](_0x1edde6)};return _0x49c195;}}});};exports['tildeASR']=function(_0x3a7c68,_0x3c3a2e,_0x5dbd98,_0xb6a83f){return tilde[_0xaadd('0x70')](_0x3a7c68,_0x3c3a2e,_0x5dbd98,_0xb6a83f)[_0xaadd('0x27')](function(_0x24cece){try{fs[_0xaadd('0x1a')](_0x3a7c68);}catch(_0x58bafc){logger['error'](_0x58bafc);}logger['info']('Tilde\x20ASR\x20transcription',_0x24cece[_0xaadd('0x4b')]);logger[_0xaadd('0x17')]('Tilde\x20ASR\x20confidence',_0x24cece[_0xaadd('0x4c')]);return _0x24cece;});};exports[_0xaadd('0x71')]=function(_0x34f453,_0x40c176,_0x4124ae,_0x48f8d6,_0x44d239,_0x1cbdef){var _0x18f98a=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x35'));var _0x2a199e;return aws[_0xaadd('0x72')](_0x34f453,_0x40c176,_0x4124ae,_0x48f8d6,_0x44d239,_0x1cbdef,_0x18f98a)['then'](function(){_0x2a199e=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x24'));return convertFile(_0x18f98a,_0x2a199e);})[_0xaadd('0x27')](function(){try{fs[_0xaadd('0x1a')](_0x18f98a);fs[_0xaadd('0x28')](_0x2a199e,_0xaadd('0x38'));}catch(_0x452c29){logger['error'](_0x452c29);}return _0x2a199e[_0xaadd('0x29')]('.')[0x0];});};exports[_0xaadd('0x73')]=function(_0x4e5b9d,_0x3da8d5,_0x552003,_0x565d9e,_0x1f0fa5,_0x4fbaea){return aws['lex'](_0x4e5b9d,_0x3da8d5,_0x552003,_0x565d9e,_0x1f0fa5,_0x4fbaea)[_0xaadd('0x27')](function(_0x549767){logger[_0xaadd('0x17')](JSON['stringify'](_0x549767));return _0x549767;});};exports['ispeechTTS']=function(_0x2a9647,_0x39dfef,_0x3b6275,_0xb674d6){var _0x41d587=util[_0xaadd('0x74')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2a9647,encodeURIComponent(_0x39dfef),_0x3b6275,_0xb674d6);var _0x2d239f=path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs[_0xaadd('0x23')](0x4)+_0xaadd('0x35'));var _0x1a5bb0;return downloadFile(_0x41d587,_0x2d239f)[_0xaadd('0x27')](function(){_0x1a5bb0=path['resolve'](__dirname,_0xaadd('0x34'),rs[_0xaadd('0x23')](0x4)+_0xaadd('0x24'));return convertFile(_0x2d239f,_0x1a5bb0);})[_0xaadd('0x27')](function(){try{fs[_0xaadd('0x1a')](_0x2d239f);fs['chmodSync'](_0x1a5bb0,'777');}catch(_0xcbabe2){logger[_0xaadd('0x19')](_0xcbabe2);}return _0x1a5bb0[_0xaadd('0x29')]('.')[0x0];});};exports[_0xaadd('0x75')]=function(_0x59af54,_0x4f2978,_0x454dd4,_0x72ffb1){var _0x381641=util[_0xaadd('0x74')](_0xaadd('0x76'),ISPEECH_API,_0x4f2978,_0x454dd4,base64Encode(_0x59af54),_0x72ffb1?util[_0xaadd('0x74')](_0xaadd('0x77'),encodeURIComponent(_0x72ffb1)):'freeform=3');return uploadFile(_0x381641)[_0xaadd('0x27')](function(_0x2460a9){return querystring[_0xaadd('0x8')](_0x2460a9);});};exports[_0xaadd('0x78')]=function(_0x12fdac,_0x290ee6){return sestek['nda'](_0x12fdac,_0x290ee6)[_0xaadd('0x27')](function(_0x54c08c){logger[_0xaadd('0x17')](JSON[_0xaadd('0x3e')](_0x54c08c));var _0x1d23aa={'speech':_0x54c08c[_0xaadd('0x79')],'action':_0x54c08c[_0xaadd('0x7a')]?_0x54c08c[_0xaadd('0x7a')][_0xaadd('0x7b')]:undefined,'actiondata':_0x54c08c[_0xaadd('0x7a')]?_0x54c08c[_0xaadd('0x7a')][_0xaadd('0x7c')]:undefined};if(_0x54c08c[_0xaadd('0x7a')]&&_0x54c08c[_0xaadd('0x7a')][_0xaadd('0x7d')]){return base64Decode(_0x54c08c[_0xaadd('0x7a')][_0xaadd('0x7d')][_0xaadd('0x7e')],path[_0xaadd('0x33')](__dirname,_0xaadd('0x34'),rs['generate'](0x4)+_0xaadd('0x24')))[_0xaadd('0x27')](function(_0x2a3db5){_0x1d23aa['audiofile']=_0x2a3db5;return _0x1d23aa;});}return _0x1d23aa;});};exports[_0xaadd('0x7f')]=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 9a7cb90..87994a1 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 _0x3d68=['./nda','exports'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3d68,0x142));var _0x83d6=function(_0xfb0ef5,_0x7eaa8e){_0xfb0ef5=_0xfb0ef5-0x0;var _0x56e436=_0x3d68[_0xfb0ef5];return _0x56e436;};var nda=require(_0x83d6('0x0'));module[_0x83d6('0x1')]={'nda':nda}; \ No newline at end of file +var _0xec35=['exports'];(function(_0x44f8f0,_0x3cba8b){var _0x2a3925=function(_0x2f8fce){while(--_0x2f8fce){_0x44f8f0['push'](_0x44f8f0['shift']());}};_0x2a3925(++_0x3cba8b);}(_0xec35,0xd5));var _0x5ec3=function(_0x3ac6b3,_0x3e05a9){_0x3ac6b3=_0x3ac6b3-0x0;var _0xc49cbc=_0xec35[_0x3ac6b3];return _0xc49cbc;};var nda=require('./nda');module[_0x5ec3('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 119f3ef..b7236b0 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 _0x630e=['Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','text'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x630e,0x1af));var _0xe630=function(_0x2278f1,_0x4bb62c){_0x2278f1=_0x2278f1-0x0;var _0x7736a3=_0x630e[_0x2278f1];return _0x7736a3;};'use strict';var rp=require(_0xe630('0x0'));var url=require('url');var logger=require(_0xe630('0x1'))('agi');module['exports']=function(_0x36902e,_0x143cb6){var _0x12449c={'method':'POST','uri':url[_0xe630('0x2')](_0x143cb6[_0xe630('0x3')],_0xe630('0x4')),'form':{'grant_type':_0xe630('0x5'),'username':_0x143cb6[_0xe630('0x6')],'password':_0x143cb6['password']},'json':!![]};return rp(_0x12449c)[_0xe630('0x7')](function(_0x34bad4){var _0x5a73ad={'method':_0xe630('0x8'),'uri':url['resolve'](_0x143cb6[_0xe630('0x9')],_0xe630('0xa')),'body':{'type':_0x143cb6[_0xe630('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x36902e[_0xe630('0xc')]},'from':{'id':_0x36902e[_0xe630('0xd')],'name':_0x36902e[_0xe630('0xe')]},'recipient':{'id':_0x36902e[_0xe630('0xf')],'name':_0x36902e['extension']},'text':_0x143cb6[_0xe630('0x10')],'channelData':{}},'headers':{'Authorization':_0xe630('0x11')+_0x34bad4[_0xe630('0x12')]},'json':!![]};if(_0x143cb6[_0xe630('0x13')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x16')]=_0x143cb6[_0xe630('0x13')];}if(_0x143cb6[_0xe630('0x17')]=='1'){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe630('0x19')};}if(_0x143cb6['custom_action']){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1a')]=_0x143cb6[_0xe630('0x1b')];if(_0x143cb6[_0xe630('0x1c')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1d')]=_0x143cb6[_0xe630('0x1c')];}}logger[_0xe630('0x1e')](JSON[_0xe630('0x1f')](_0x5a73ad));return rp(_0x5a73ad);});}; \ No newline at end of file +var _0xa74f=['ndaactivity_type','message','uniqueid','callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','../../../../../config/logger','POST','ndauth_url','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x3123f4,_0x4ddfe3){var _0xbee8f2=function(_0x18f0f3){while(--_0x18f0f3){_0x3123f4['push'](_0x3123f4['shift']());}};_0xbee8f2(++_0x4ddfe3);}(_0xa74f,0x9a));var _0xfa74=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xa74f[_0x4c3ffe];return _0x28d3eb;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xfa74('0x0'))('agi');module['exports']=function(_0x29e4c8,_0x110824){var _0x394a1e={'method':_0xfa74('0x1'),'uri':url['resolve'](_0x110824[_0xfa74('0x2')],'/token'),'form':{'grant_type':'password','username':_0x110824[_0xfa74('0x3')],'password':_0x110824[_0xfa74('0x4')]},'json':!![]};return rp(_0x394a1e)[_0xfa74('0x5')](function(_0x2d9fa9){var _0x287921={'method':_0xfa74('0x1'),'uri':url['resolve'](_0x110824[_0xfa74('0x6')],_0xfa74('0x7')),'body':{'type':_0x110824[_0xfa74('0x8')]||_0xfa74('0x9'),'channelId':'Nda','conversation':{'id':_0x29e4c8[_0xfa74('0xa')]},'from':{'id':_0x29e4c8[_0xfa74('0xb')],'name':_0x29e4c8['calleridname']},'recipient':{'id':_0x29e4c8[_0xfa74('0xc')],'name':_0x29e4c8[_0xfa74('0xd')]},'text':_0x110824[_0xfa74('0xe')],'channelData':{}},'headers':{'Authorization':_0xfa74('0xf')+_0x2d9fa9['access_token']},'json':!![]};if(_0x110824[_0xfa74('0x10')]){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x13')]=_0x110824['project'];}if(_0x110824[_0xfa74('0x14')]=='1'){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfa74('0x16')};}if(_0x110824['custom_action']){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x17')]=_0x110824[_0xfa74('0x18')];if(_0x110824[_0xfa74('0x19')]){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')]['CustomActionData']=_0x110824[_0xfa74('0x19')];}}logger[_0xfa74('0x1a')](JSON['stringify'](_0x287921));return rp(_0x287921);});}; \ 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 308d9f4..5318c9a 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c7c=['./lib/api','exports'];(function(_0x357496,_0x285b1c){var _0xb210dd=function(_0x38ea64){while(--_0x38ea64){_0x357496['push'](_0x357496['shift']());}};_0xb210dd(++_0x285b1c);}(_0x5c7c,0x106));var _0xc5c7=function(_0x4aabc1,_0x15e9b0){_0x4aabc1=_0x4aabc1-0x0;var _0x302c36=_0x5c7c[_0x4aabc1];return _0x302c36;};'use strict';var asr=require(_0xc5c7('0x0'));module[_0xc5c7('0x1')]=function(_0x5ea4ca,_0x5eee00,_0x285a30,_0x31c2d9){return asr(_0x5ea4ca,_0x5eee00,_0x285a30,_0x31c2d9);}; \ No newline at end of file +var _0xc459=['exports'];(function(_0x29d0d3,_0x4fc88a){var _0x36c9bc=function(_0x14abeb){while(--_0x14abeb){_0x29d0d3['push'](_0x29d0d3['shift']());}};_0x36c9bc(++_0x4fc88a);}(_0xc459,0x6d));var _0x9c45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc459[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0x9c45('0x0')]=function(_0x2e2d8f,_0x6c7623,_0x2256a3,_0x153493){return asr(_0x2e2d8f,_0x6c7623,_0x2256a3,_0x153493);}; \ 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 2a8f0fc..5fa7281 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 _0x2fda=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','EOS','error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','close','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x5df837,_0x415272){var _0x4403bd=function(_0x1ad3da){while(--_0x1ad3da){_0x5df837['push'](_0x5df837['shift']());}};_0x4403bd(++_0x415272);}(_0x2fda,0xc0));var _0xa2fd=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2fda[_0x2f3848];return _0x102668;};'use strict';var BPromise=require(_0xa2fd('0x0'));var _=require(_0xa2fd('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xa2fd('0x2'));var logger=require(_0xa2fd('0x3'))('agi');module[_0xa2fd('0x4')]=function(_0x1b6e04,_0x6f2ccf,_0x4ab3bb,_0x542f6c){return new BPromise(function(_0x403342,_0x267cae){logger[_0xa2fd('0x5')](_0xa2fd('0x6'),_0x542f6c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x160ed0=new WebSocket(_0x542f6c||_0xa2fd('0x7'),{'perMessageDeflate':![]});var _0x5b27c9='';var _0xb4379e='0';var _0x5ae6f3='1';var _0x476456=_0xa2fd('0x8');function _0x2129b0(_0x3bfb2d){var _0x5a8470=crypto[_0xa2fd('0x9')](_0xa2fd('0xa'));_0x5a8470[_0xa2fd('0xb')](_0x3bfb2d);return _0x5a8470[_0xa2fd('0xc')](_0xa2fd('0xd'));}function _0x6bab48(){try{logger['info'](_0xa2fd('0xe'));var _0x5eaf7b=moment()[_0xa2fd('0xf')]();var _0x384f37=_0x2129b0(_0x5eaf7b+_0x6f2ccf+_0x4ab3bb);_0x160ed0['send'](JSON[_0xa2fd('0x10')]({'appID':_0x6f2ccf,'timestamp':_0x5eaf7b,'appKey':_0x384f37}));var _0x3e4359=fs[_0xa2fd('0x11')](_0x1b6e04);_0x3e4359['on'](_0xa2fd('0x12'),function(_0x3e4692){_0x160ed0[_0xa2fd('0x13')](_0x3e4692);});_0x3e4359['on']('close',function(){_0x160ed0[_0xa2fd('0x13')](_0xa2fd('0x14'));});}catch(_0x2934cf){logger[_0xa2fd('0x15')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x2934cf));_0x160ed0['terminate']();}}function _0x387f9e(_0x16047a){try{if(_0x16047a){var _0x42c552=JSON['parse'](_0x16047a);switch(_0x42c552[_0xa2fd('0x16')]){case 0x0:if(_0x42c552[_0xa2fd('0x17')]){if(_0x42c552['result'][_0xa2fd('0x18')]){logger[_0xa2fd('0x5')](_0xa2fd('0x19'),JSON[_0xa2fd('0x10')](_0x42c552[_0xa2fd('0x17')][_0xa2fd('0x1a')]));_0x5b27c9=_0x42c552[_0xa2fd('0x17')]['hypotheses'][0x0][_0xa2fd('0x1b')];_0xb4379e=_0x42c552[_0xa2fd('0x17')]['hypotheses'][0x0][_0xa2fd('0x1c')];_0x5ae6f3='0';_0x476456=_0xa2fd('0x1d');_0x160ed0[_0xa2fd('0x1e')]();}}break;case 0x1:logger[_0xa2fd('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x5ae6f3='1';_0x476456=_0xa2fd('0x8');break;case 0x2:logger[_0xa2fd('0x5')](_0xa2fd('0x1f'));_0x5ae6f3='2';_0x476456=_0xa2fd('0x1f');break;case 0x9:logger[_0xa2fd('0x5')](_0xa2fd('0x20'));_0x5ae6f3='9';_0x476456=_0xa2fd('0x20');break;case 0xa:logger[_0xa2fd('0x5')](_0xa2fd('0x21'));_0x5ae6f3='10';_0x476456=_0xa2fd('0x21');break;case 0xb:logger[_0xa2fd('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x5ae6f3='11';_0x476456=_0xa2fd('0x22');}}}catch(_0x52a39e){logger[_0xa2fd('0x15')](_0xa2fd('0x23'),JSON[_0xa2fd('0x10')](_0x52a39e));_0x160ed0[_0xa2fd('0x1e')]();}}function _0x221437(){logger[_0xa2fd('0x5')](_0xa2fd('0x24'));_0x403342({'transcript':_0x5b27c9,'confidence':_0xb4379e,'status':_0x5ae6f3,'status_message':_0x476456});}function _0x38d0b3(_0x5918d8){logger[_0xa2fd('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x5918d8)){logger[_0xa2fd('0x15')](_[_0xa2fd('0x25')](_0x5918d8)?JSON[_0xa2fd('0x10')](_0x5918d8):_0x5918d8);}}_0x160ed0['on'](_0xa2fd('0x26'),_0x6bab48);_0x160ed0['on']('message',_0x387f9e);_0x160ed0['on'](_0xa2fd('0x27'),_0x221437);_0x160ed0['on'](_0xa2fd('0x15'),_0x38d0b3);});}; \ No newline at end of file +var _0xda63=['info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda63,0x6c));var _0x3da6=function(_0x2503f2,_0x305c53){_0x2503f2=_0x2503f2-0x0;var _0x13ab2c=_0xda63[_0x2503f2];return _0x13ab2c;};'use strict';var BPromise=require(_0x3da6('0x0'));var _=require(_0x3da6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3da6('0x2'));var crypto=require(_0x3da6('0x3'));var logger=require('../../../../../../config/logger')(_0x3da6('0x4'));module[_0x3da6('0x5')]=function(_0x31bfc6,_0x5e49fb,_0x407841,_0x1d97d4){return new BPromise(function(_0x5262fc,_0x3dff5f){logger[_0x3da6('0x6')]('Tilde\x20URI',_0x1d97d4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xd7e97c=new WebSocket(_0x1d97d4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x7eceac='';var _0x247997='0';var _0x2ffcb7='1';var _0x272945=_0x3da6('0x7');function _0x5adcbe(_0x370472){var _0x2e7b72=crypto[_0x3da6('0x8')]('sha1');_0x2e7b72[_0x3da6('0x9')](_0x370472);return _0x2e7b72[_0x3da6('0xa')]('hex');}function _0x4d0392(){try{logger[_0x3da6('0x6')](_0x3da6('0xb'));var _0x143946=moment()[_0x3da6('0xc')]();var _0x17e6d9=_0x5adcbe(_0x143946+_0x5e49fb+_0x407841);_0xd7e97c[_0x3da6('0xd')](JSON[_0x3da6('0xe')]({'appID':_0x5e49fb,'timestamp':_0x143946,'appKey':_0x17e6d9}));var _0x54e3f7=fs['createReadStream'](_0x31bfc6);_0x54e3f7['on'](_0x3da6('0xf'),function(_0x5646ec){_0xd7e97c[_0x3da6('0xd')](_0x5646ec);});_0x54e3f7['on'](_0x3da6('0x10'),function(){_0xd7e97c['send'](_0x3da6('0x11'));});}catch(_0x58da2c){logger[_0x3da6('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x3da6('0xe')](_0x58da2c));_0xd7e97c[_0x3da6('0x13')]();}}function _0xe0cb58(_0x538203){try{if(_0x538203){var _0x452770=JSON[_0x3da6('0x14')](_0x538203);switch(_0x452770[_0x3da6('0x15')]){case 0x0:if(_0x452770[_0x3da6('0x16')]){if(_0x452770[_0x3da6('0x16')][_0x3da6('0x17')]){logger[_0x3da6('0x6')](_0x3da6('0x18'),JSON[_0x3da6('0xe')](_0x452770['result'][_0x3da6('0x19')]));_0x7eceac=_0x452770[_0x3da6('0x16')][_0x3da6('0x19')][0x0][_0x3da6('0x1a')];_0x247997=_0x452770[_0x3da6('0x16')][_0x3da6('0x19')][0x0][_0x3da6('0x1b')];_0x2ffcb7='0';_0x272945='Success.';_0xd7e97c['terminate']();}}break;case 0x1:logger[_0x3da6('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2ffcb7='1';_0x272945=_0x3da6('0x7');break;case 0x2:logger[_0x3da6('0x6')](_0x3da6('0x1c'));_0x2ffcb7='2';_0x272945='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x3da6('0x6')](_0x3da6('0x1d'));_0x2ffcb7='9';_0x272945=_0x3da6('0x1d');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2ffcb7='10';_0x272945=_0x3da6('0x1e');break;case 0xb:logger[_0x3da6('0x6')](_0x3da6('0x1f'));_0x2ffcb7='11';_0x272945=_0x3da6('0x1f');}}}catch(_0x316546){logger[_0x3da6('0x12')](_0x3da6('0x20'),JSON[_0x3da6('0xe')](_0x316546));_0xd7e97c[_0x3da6('0x13')]();}}function _0x173d17(){logger[_0x3da6('0x6')](_0x3da6('0x21'));_0x5262fc({'transcript':_0x7eceac,'confidence':_0x247997,'status':_0x2ffcb7,'status_message':_0x272945});}function _0x1e5d8b(_0x50955b){logger[_0x3da6('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3da6('0x22')](_0x50955b)){logger[_0x3da6('0x12')](_[_0x3da6('0x23')](_0x50955b)?JSON[_0x3da6('0xe')](_0x50955b):_0x50955b);}}_0xd7e97c['on'](_0x3da6('0x24'),_0x4d0392);_0xd7e97c['on'](_0x3da6('0x25'),_0xe0cb58);_0xd7e97c['on'](_0x3da6('0x10'),_0x173d17);_0xd7e97c['on']('error',_0x1e5d8b);});}; \ 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 381a203..295116a 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 _0xe89a=['./asr'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe89a,0x64));var _0xae89=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xe89a[_0x3511d3];return _0x5d6321;};var asr=require(_0xae89('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xb0d1=['./asr','exports'];(function(_0xe633be,_0x33e86d){var _0x4083c1=function(_0x4f6aa2){while(--_0x4f6aa2){_0xe633be['push'](_0xe633be['shift']());}};_0x4083c1(++_0x33e86d);}(_0xb0d1,0x1c0));var _0x1b0d=function(_0x57d629,_0x55926e){_0x57d629=_0x57d629-0x0;var _0x4f2b10=_0xb0d1[_0x57d629];return _0x4f2b10;};var asr=require(_0x1b0d('0x0'));module[_0x1b0d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ba0f468..ccbe411 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 _0x8f6d=['net','events','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','createServer','listening','emit','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8f6d,0xe0));var _0xd8f6=function(_0x1cabab,_0x3612dc){_0x1cabab=_0x1cabab-0x0;var _0x3f6e76=_0x8f6d[_0x1cabab];return _0x3f6e76;};'use strict';var util=require(_0xd8f6('0x0'));var net=require(_0xd8f6('0x1'));var EventEmitter=require(_0xd8f6('0x2'))[_0xd8f6('0x3')];var AGIError=require(_0xd8f6('0x4'));var AGIChannel=require(_0xd8f6('0x5'));var AGIServer=function(_0x2996ae,_0x28bb23,_0x2d2985){var _0x59b06a=this,_0x2996ae=_0x2996ae||0x11dd,_0x28bb23=_0x28bb23||_0xd8f6('0x6'),_0x5d4b7e=null,_0x2a465c=0x0;EventEmitter[_0xd8f6('0x7')](_0x59b06a);function _0x3ae3fd(){if(!_0x2996ae){_0x59b06a['emit']('error',new AGIError(_0xd8f6('0x8')));return![];}_0x5d4b7e=net[_0xd8f6('0x9')]();_0x5d4b7e['listen'](_0x2996ae,_0x28bb23);_0x5d4b7e['on'](_0xd8f6('0xa'),function(){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0xa'));});_0x5d4b7e['on']('connection',function(_0x395f02){_0x5d4b7e[_0xd8f6('0xc')](function(_0x2f2ba2,_0x98cdf3){if(_0x2f2ba2){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0xd'),new AGIError(_0xd8f6('0xe'),_0x2f2ba2));}else if(_0x2d2985&&_0x2d2985<0x0){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0xd'),new AGIError(_0xd8f6('0xf')));_0x395f02[_0xd8f6('0x10')]();}else if(_0x2d2985&&_0x2d2985>0x0&&_0x2d2985<_0x98cdf3){_0x2a465c+=0x1;_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0xd'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x2a465c));_0x395f02[_0xd8f6('0x10')]();}else{var _0xec35c1=new AGIChannel(_0x395f02);_0xec35c1['on'](_0xd8f6('0x11'),function(){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0x12'),_0xec35c1);});}});});_0x5d4b7e['on'](_0xd8f6('0xd'),function(_0x309dae){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0xd'),new AGIError(_0xd8f6('0xe'),_0x309dae[_0xd8f6('0x13')]));});_0x5d4b7e['on'](_0xd8f6('0x14'),function(){_0x59b06a[_0xd8f6('0xb')](_0xd8f6('0x14'),new AGIError(_0xd8f6('0x15')));});}process[_0xd8f6('0x16')](function(){_0x3ae3fd();});};util[_0xd8f6('0x17')](AGIServer,EventEmitter);module[_0xd8f6('0x18')]=function(_0x4614ab,_0x1a475c,_0x4d9af6){return new AGIServer(_0x4614ab,_0x1a475c,_0x4d9af6);}; \ No newline at end of file +var _0xfdb0=['listening','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','close','E_AGI_SERVER_CLOSE','nextTick','exports','events','EventEmitter','./error','./channel','127.0.0.1','emit'];(function(_0x4e891c,_0x56cab9){var _0x55610f=function(_0x14503f){while(--_0x14503f){_0x4e891c['push'](_0x4e891c['shift']());}};_0x55610f(++_0x56cab9);}(_0xfdb0,0x8a));var _0x0fdb=function(_0x29d20c,_0x5940b2){_0x29d20c=_0x29d20c-0x0;var _0x494215=_0xfdb0[_0x29d20c];return _0x494215;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x0fdb('0x0'))[_0x0fdb('0x1')];var AGIError=require(_0x0fdb('0x2'));var AGIChannel=require(_0x0fdb('0x3'));var AGIServer=function(_0x20c0f5,_0x2d2f2d,_0x150504){var _0x4b959a=this,_0x20c0f5=_0x20c0f5||0x11dd,_0x2d2f2d=_0x2d2f2d||_0x0fdb('0x4'),_0x5322ad=null,_0x349aaf=0x0;EventEmitter['call'](_0x4b959a);function _0x3c655c(){if(!_0x20c0f5){_0x4b959a['emit']('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x5322ad=net['createServer']();_0x5322ad['listen'](_0x20c0f5,_0x2d2f2d);_0x5322ad['on']('listening',function(){_0x4b959a[_0x0fdb('0x5')](_0x0fdb('0x6'));});_0x5322ad['on']('connection',function(_0x47d11e){_0x5322ad[_0x0fdb('0x7')](function(_0x53cb8f,_0x4721b0){if(_0x53cb8f){_0x4b959a[_0x0fdb('0x5')](_0x0fdb('0x8'),new AGIError(_0x0fdb('0x9'),_0x53cb8f));}else if(_0x150504&&_0x150504<0x0){_0x4b959a[_0x0fdb('0x5')](_0x0fdb('0x8'),new AGIError(_0x0fdb('0xa')));_0x47d11e[_0x0fdb('0xb')]();}else if(_0x150504&&_0x150504>0x0&&_0x150504<_0x4721b0){_0x349aaf+=0x1;_0x4b959a['emit'](_0x0fdb('0x8'),new AGIError(_0x0fdb('0xc'),_0x349aaf));_0x47d11e[_0x0fdb('0xb')]();}else{var _0xb93d5d=new AGIChannel(_0x47d11e);_0xb93d5d['on']('ready',function(){_0x4b959a[_0x0fdb('0x5')](_0x0fdb('0xd'),_0xb93d5d);});}});});_0x5322ad['on'](_0x0fdb('0x8'),function(_0x168470){_0x4b959a[_0x0fdb('0x5')]('error',new AGIError(_0x0fdb('0x9'),_0x168470['code']));});_0x5322ad['on'](_0x0fdb('0xe'),function(){_0x4b959a[_0x0fdb('0x5')](_0x0fdb('0xe'),new AGIError(_0x0fdb('0xf')));});}process[_0x0fdb('0x10')](function(){_0x3c655c();});};util['inherits'](AGIServer,EventEmitter);module[_0x0fdb('0x11')]=function(_0xf49e83,_0x21395d,_0x22a9c6){return new AGIServer(_0xf49e83,_0x21395d,_0x22a9c6);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3e47762..9540e07 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 _0xa7fa=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','createSquareMessage','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','beep','recordFile','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ispeechASR','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','statusCode','200','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','service','host','port','secure','authentication','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','menu','getsecretdigits','rpc','mailRpc','getVariable','name','catch','prototype','getVoiceQueue','then','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','getSoundPath','%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','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createCmContact','isEmpty','isNil','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','rawBody','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','headers','stringify','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','list_id','scheduledAt','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','sestekasr','MRCPRecog'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0xaa7f('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xaa7f('0x1'));var odbc=require(_0xaa7f('0x2'))();var rs=require(_0xaa7f('0x3'));var moment=require(_0xaa7f('0x4'));var Mustache=require('mustache');var rp=require(_0xaa7f('0x5'));var logger=require(_0xaa7f('0x6'))(_0xaa7f('0x7'));var config=require(_0xaa7f('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xaa7f('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xaa7f('0xa'),'getdigits',_0xaa7f('0xb')];var AGIVertices=function(_0xf237c7,_0x1d33fe,_0x2dbcb6){this['channel']=_0xf237c7;this[_0xaa7f('0xc')]=_0x1d33fe;this[_0xaa7f('0xd')]=_0x2dbcb6;};AGIVertices['prototype'][_0xaa7f('0xe')]=function(_0xe92992,_0x17aa96){this[_0xaa7f('0xc')]['getVariableById'](_0xe92992)['then'](function(_0x1f7a10){_0x17aa96(null,_0x1f7a10?_0x1f7a10[_0xaa7f('0xf')]:![]);})[_0xaa7f('0x10')](function(_0x8c42d8){_0x17aa96(_0x8c42d8);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x12')]=function(_0x39ba70,_0x347929){this[_0xaa7f('0xc')]['getVoiceQueueById'](_0x39ba70)[_0xaa7f('0x13')](function(_0x4c7809){_0x347929(null,_0x4c7809?_0x4c7809[_0xaa7f('0xf')]:![]);})[_0xaa7f('0x10')](function(_0x470c74){_0x347929(_0x470c74);});};AGIVertices['prototype'][_0xaa7f('0x14')]=function(_0x9a6745,_0x1bd3f9){this[_0xaa7f('0xc')][_0xaa7f('0x15')](_0x9a6745)[_0xaa7f('0x13')](function(_0x2c17c4){_0x1bd3f9(null,_0x2c17c4?_0x2c17c4['name']:![]);})[_0xaa7f('0x10')](function(_0x1e18a6){_0x1bd3f9(_0x1e18a6);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x16')]=function(_0x4d1119,_0x5d60b5){this[_0xaa7f('0xc')]['getSquareOdbcById'](_0x4d1119)[_0xaa7f('0x13')](function(_0x21e870){_0x5d60b5(null,_0x21e870?_0x21e870['dsn']:![]);})[_0xaa7f('0x10')](function(_0x489b56){_0x5d60b5(_0x489b56);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x17')]=function(_0x3e203b,_0x516d7e){this[_0xaa7f('0xc')][_0xaa7f('0x18')](_0x3e203b)[_0xaa7f('0x13')](function(_0x3900df){_0x516d7e(null,_0x3900df?_0x3900df['name']:![]);})['catch'](function(_0x28d627){_0x516d7e(_0x28d627);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x19')]=function(_0x246a18,_0x316b30){this[_0xaa7f('0xc')]['getTrunkById'](_0x246a18)['then'](function(_0x525df7){_0x316b30(null,_0x525df7?_0x525df7[_0xaa7f('0xf')]:![]);})['catch'](function(_0xbff8a0){_0x316b30(_0xbff8a0);});};AGIVertices[_0xaa7f('0x11')]['getSound']=function(_0x46c83e,_0x48e8e8){var _0x41b368=this;this[_0xaa7f('0xc')][_0xaa7f('0x1a')](_0x46c83e)[_0xaa7f('0x13')](function(_0x223321){_0x48e8e8(null,_0x223321?_0x41b368['getSoundPath'](_0x223321[_0xaa7f('0x1b')]):![]);})[_0xaa7f('0x10')](function(_0x35034b){_0x48e8e8(_0x35034b);});};AGIVertices['prototype'][_0xaa7f('0x1c')]=function(_0x1b17e2,_0x2b2ce2){this[_0xaa7f('0xc')][_0xaa7f('0x1d')](_0x1b17e2)[_0xaa7f('0x13')](function(_0x5cb064){_0x2b2ce2(null,_0x5cb064?_0x5cb064:![]);})[_0xaa7f('0x10')](function(_0x39480c){_0x2b2ce2(_0x39480c);});};AGIVertices['prototype'][_0xaa7f('0x1e')]=function(_0x1593cb,_0x403ead,_0xcf8a2b){this[_0xaa7f('0xd')][_0xaa7f('0x1e')](_0x1593cb,_0x403ead)[_0xaa7f('0x13')](function(){_0xcf8a2b(null);})[_0xaa7f('0x10')](function(_0x3f8299){_0xcf8a2b(_0x3f8299);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1f')]=function(_0x172bdf,_0x46510d){this[_0xaa7f('0xc')][_0xaa7f('0x20')](_0x172bdf)['then'](function(_0x13335a){if(_0x13335a){if(_0x13335a['IntervalId']){_0x46510d(null,[_0x13335a[_0xaa7f('0x21')]]);}else{_0x46510d(null,_[_0xaa7f('0x22')](_0x13335a['Intervals'],_0xaa7f('0x21')));}}else{_0x46510d(null,![]);}})[_0xaa7f('0x10')](function(_0x5a813b){_0x46510d(_0x5a813b);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x23')]=function(_0x56cd4b){return util['format'](_0xaa7f('0x24'),FILES_PATH,_0x56cd4b);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x25')]=function(_0xbe7187,_0x2df9e1,_0x4c9301){odbc['open'](_0xbe7187,function(_0x1f6d7a){if(_0x1f6d7a){logger[_0xaa7f('0x26')](_0xaa7f('0x27'),_0x1f6d7a);_0x4c9301(_0x1f6d7a);}else{logger[_0xaa7f('0x28')](_0xaa7f('0x29'));odbc[_0xaa7f('0x2a')](_0x2df9e1,function(_0xeaf4d8,_0x544b5e){if(_0xeaf4d8){logger[_0xaa7f('0x28')](_0xaa7f('0x2b'),_0x2df9e1);_0x4c9301(_0xeaf4d8);}else{logger[_0xaa7f('0x28')](_0xaa7f('0x2c'),_0x2df9e1);odbc[_0xaa7f('0x2d')](function(_0x198137){if(_0x198137){logger[_0xaa7f('0x26')](_0xaa7f('0x2e'),_0x198137);}_0x4c9301(null,_0x544b5e);});}});}});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x2f')]=function(_0x34e0b5,_0x31242a){this[_0xaa7f('0xc')][_0xaa7f('0x30')](_0x34e0b5)['then'](function(_0x23392a){_0x31242a(null,_0x23392a?_0x23392a:![]);})[_0xaa7f('0x10')](function(_0x406bd0){_0x31242a(_0x406bd0);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x31')]=function(_0x250c84,_0x2e4b7b){this[_0xaa7f('0xc')]['createSmsMessage'](_0x250c84)[_0xaa7f('0x13')](function(_0x1e95df){_0x2e4b7b(null,_0x1e95df);})[_0xaa7f('0x10')](function(_0x243d40){_0x2e4b7b(_0x243d40);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x132cee,_0x548500,_0x4bba4b){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xaa7f('0x32')][_0xaa7f('0x33')],'node':_0x132cee[_0xaa7f('0x34')],'application':_0x132cee[_0xaa7f('0x35')],'data':_0x548500||null,'project_name':this[_0xaa7f('0x32')][_0xaa7f('0x36')],'callerid':this[_0xaa7f('0x32')][_0xaa7f('0x37')]})['then'](function(_0x7393f8){if(_0x4bba4b){_0x4bba4b(null,_0x7393f8);}})['catch'](function(_0x4c461f){if(_0x4bba4b){_0x4bba4b(_0x4c461f);}});};AGIVertices['prototype'][_0xaa7f('0x38')]=function(_0x8e5a87,_0xadfdf7,_0x3c0813,_0x4155c0){this['rpc'][_0xaa7f('0x38')]({'uniqueid':this[_0xaa7f('0x32')][_0xaa7f('0x33')],'callerid':this['channel'][_0xaa7f('0x37')],'calleridname':this[_0xaa7f('0x32')][_0xaa7f('0x39')],'context':this['channel'][_0xaa7f('0x3a')],'extension':this[_0xaa7f('0x32')][_0xaa7f('0x3b')],'priority':this[_0xaa7f('0x32')][_0xaa7f('0x3c')],'accountcode':this['channel'][_0xaa7f('0x3d')],'dnid':this[_0xaa7f('0x32')]['dnid'],'projectName':this[_0xaa7f('0x32')][_0xaa7f('0x36')],'saveName':_0xadfdf7,'filename':_0x8e5a87[_0xaa7f('0x3e')]||_0xadfdf7,'savePath':_0x3c0813})[_0xaa7f('0x13')](function(_0x1dd222){_0x4155c0(null,_0x1dd222);})[_0xaa7f('0x10')](function(_0x45259a){_0x4155c0(_0x45259a);});};AGIVertices[_0xaa7f('0x11')]['createSquareMessage']=function(_0x54eaf5,_0x3e6644,_0xbd5e02,_0x4751c9,_0x3cfdba){this[_0xaa7f('0xc')]['createSquareMessage']({'uniqueid':this[_0xaa7f('0x32')]['uniqueid'],'body':_0x54eaf5,'direction':_0x3e6644,'providerName':_0xbd5e02,'providerResponse':_0x4751c9})[_0xaa7f('0x13')](function(_0x5e2c3c){if(_0x3cfdba){_0x3cfdba(null,_0x5e2c3c);}})['catch'](function(_0x32737b){if(_0x3cfdba){_0x3cfdba(_0x32737b);}});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x3f')]=function(_0x4ef547,_0x1f3c28){this[_0xaa7f('0xc')][_0xaa7f('0x3f')]({'firstName':_[_0xaa7f('0x40')](_0x4ef547[_0xaa7f('0xf')])||_[_0xaa7f('0x41')](_0x4ef547[_0xaa7f('0xf')])?'callback_'+Math[_0xaa7f('0x42')]():_0x4ef547[_0xaa7f('0xf')],'lastName':_[_0xaa7f('0x40')](_0x4ef547['lastName'])||_['isNil'](_0x4ef547[_0xaa7f('0x43')])?null:_0x4ef547[_0xaa7f('0x43')],'phone':_0x4ef547[_0xaa7f('0x44')],'ListId':_0x4ef547['list_id'],'scheduledat':_0x4ef547['scheduledAt'],'callbackUniqueid':this[_0xaa7f('0x32')][_0xaa7f('0x33')],'tags':_0xaa7f('0x45'),'description':_0xaa7f('0x46')+_0x4ef547['scheduledAt'][_0xaa7f('0x47')](),'priority':_0x4ef547['callback_priority']})[_0xaa7f('0x13')](function(_0x1b32be){_0x1f3c28(null,_0x1b32be);})[_0xaa7f('0x10')](function(_0x5e8f77){_0x1f3c28(_0x5e8f77);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x48')]=function(_0x403ed5,_0x19b3b5){this[_0xaa7f('0xc')][_0xaa7f('0x49')](_0x403ed5)[_0xaa7f('0x13')](function(_0x4234ed){_0x19b3b5(null,_0x4234ed?_0x4234ed[_0xaa7f('0xf')]:![]);})[_0xaa7f('0x10')](function(_0xd71f0){_0x19b3b5(_0xd71f0);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x4a')]=function(_0x598d6f,_0x2f881a,_0xe8cd69){var _0x37416d={'role':_0xaa7f('0x4b')};_0x37416d[_0x598d6f]=this[_0xaa7f('0x32')][_0xaa7f('0x37')];this['rpc'][_0xaa7f('0x4a')](_0x37416d,_0x2f881a,this[_0xaa7f('0x32')][_0xaa7f('0x33')])[_0xaa7f('0x13')](function(_0x706e0e){_0xe8cd69(null,_['isNil'](_0x706e0e)?![]:!![]);})[_0xaa7f('0x10')](function(_0x2f6db3){logger[_0xaa7f('0x26')](_0x2f6db3);_0xe8cd69(null,![]);});};AGIVertices['prototype'][_0xaa7f('0x4c')]=function(_0x58fc0f,_0x2b99b4){var _0x56ab94={'role':'agent'};_0x56ab94[_0x58fc0f]=this[_0xaa7f('0x32')][_0xaa7f('0x37')];this['rpc'][_0xaa7f('0x4c')](_0x56ab94)[_0xaa7f('0x13')](function(_0x1e647e){_0x2b99b4(null,_[_0xaa7f('0x41')](_0x1e647e)?![]:!![]);})[_0xaa7f('0x10')](function(_0x4c763b){logger[_0xaa7f('0x26')](_0x4c763b);_0x2b99b4(null,![]);});};AGIVertices['prototype'][_0xaa7f('0x4d')]=function(_0x37fef5,_0x461e64){var _0x4dbc4b={'role':'agent'};_0x4dbc4b[_0x37fef5]=this[_0xaa7f('0x32')][_0xaa7f('0x37')];this['rpc']['agentLogout'](_0x4dbc4b)[_0xaa7f('0x13')](function(_0x572f4c){_0x461e64(null,_[_0xaa7f('0x41')](_0x572f4c)?![]:!![]);})[_0xaa7f('0x10')](function(_0x469e8c){logger['error'](_0x469e8c);_0x461e64(null,![]);});};AGIVertices['prototype'][_0xaa7f('0x4e')]=function(_0x2a5d4f,_0x27851a){var _0x1255d3={'role':_0xaa7f('0x4b')};_0x1255d3[_0x2a5d4f]=this['channel'][_0xaa7f('0x37')];var _0x5f42cd=_0x2a5d4f!=_0xaa7f('0x4f')?util[_0xaa7f('0x50')]('%s/%s@from-sip/n',_0xaa7f('0x51'),this[_0xaa7f('0x32')][_0xaa7f('0x37')]):undefined;this[_0xaa7f('0xc')][_0xaa7f('0x4e')](_0x1255d3,_0x5f42cd)[_0xaa7f('0x13')](function(_0x76cfc9){_0x27851a(null,_[_0xaa7f('0x41')](_0x76cfc9)?![]:!![]);})[_0xaa7f('0x10')](function(_0x55b942){logger[_0xaa7f('0x26')](_0x55b942);_0x27851a(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x3cc8cd,_0x295fdc){sh[_0xaa7f('0x52')](_[_0xaa7f('0x53')](_0x3cc8cd),function(_0x92f90,_0x10b1e0){var _0x5550e8=_0x10b1e0['replace'](/(\r\n|\n|\r)/gm,'');_0x295fdc(null,_0x5550e8);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x54')]=function(_0x3d023e,_0x5acaa8){scripts[_0xaa7f('0x54')](_0x3d023e[_0xaa7f('0x55')],_0x3d023e[_0xaa7f('0x56')]||_0xaa7f('0x57'),_0x3d023e[_0xaa7f('0x57')],_0x3d023e[_0xaa7f('0x58')]||_0xaa7f('0x59'),_0x3d023e[_0xaa7f('0x5a')]||_0xaa7f('0x5b'),_0x3d023e[_0xaa7f('0x5c')]||_0xaa7f('0x5d'))[_0xaa7f('0x13')](function(_0x3c00cd){_0x5acaa8(null,_0x3c00cd);})[_0xaa7f('0x10')](function(_0x3cf6f0){_0x5acaa8(_0x3cf6f0);});};AGIVertices['prototype'][_0xaa7f('0x5e')]=function(_0x4876e2,_0x1de486){scripts['googleTTS'](_0x4876e2[_0xaa7f('0x57')],_0x4876e2[_0xaa7f('0x5f')]||'en',0x1)[_0xaa7f('0x13')](function(_0x537742){_0x1de486(null,_0x537742);})[_0xaa7f('0x10')](function(_0x1c82ef){_0x1de486(_0x1c82ef);});};AGIVertices[_0xaa7f('0x11')]['restAPI']=function(_0x54a36b,_0x5664cd){var _0x55f078={'uri':_0x54a36b[_0xaa7f('0x60')],'method':_0x54a36b[_0xaa7f('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x54a36b[_0xaa7f('0x62')])===_0xaa7f('0x63')&&parseInt(_0x54a36b[_0xaa7f('0x62')])>=0x1?parseInt(_0x54a36b[_0xaa7f('0x62')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xaa7f('0x64'),_0xaa7f('0x65')],_0x55f078['method'][_0xaa7f('0x66')]())){try{_0x55f078[_0xaa7f('0x67')]=_0x54a36b[_0xaa7f('0x68')]?JSON[_0xaa7f('0x69')](_0x54a36b[_0xaa7f('0x68')]):{};}catch(_0x455fdb){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x455fdb);}}try{_0x55f078['headers']=_0x54a36b[_0xaa7f('0x6a')]?JSON[_0xaa7f('0x69')](_0x54a36b[_0xaa7f('0x6a')]):{};}catch(_0x4c63ee){logger[_0xaa7f('0x26')](_0xaa7f('0x6b'),_0x4c63ee);}if(_0x54a36b[_0xaa7f('0x6c')]){try{var _0x2f9609=require(_0x54a36b['computedVariables'])[_0xaa7f('0x6d')](this,_0x55f078);_0x55f078['uri']=Mustache['render'](_0x54a36b['url'],_0x2f9609,{},['$$','$$']);if(_0x55f078[_0xaa7f('0x6e')]){_0x55f078['headers']=JSON[_0xaa7f('0x69')](Mustache['render'](JSON[_0xaa7f('0x6f')](_0x55f078[_0xaa7f('0x6e')]),_0x2f9609,{},['$$','$$']));}if(_0x55f078[_0xaa7f('0x67')]){_0x55f078['body']=JSON[_0xaa7f('0x69')](Mustache[_0xaa7f('0x70')](JSON[_0xaa7f('0x6f')](_0x55f078[_0xaa7f('0x67')]),_0x2f9609,{},['$$','$$']));}}catch(_0x5f1a2a){logger[_0xaa7f('0x26')](_0xaa7f('0x71'),_0x5f1a2a);}}rp(_0x55f078)[_0xaa7f('0x13')](function(_0x3da9e8){var _0x646676={'statusCode':_0x3da9e8['statusCode']||0xc8,'statusMessage':_0x3da9e8['statusMessage']||'OK','headers':_0x3da9e8[_0xaa7f('0x6e')]||{},'body':_0x3da9e8[_0xaa7f('0x67')]||{}};_0x5664cd(null,_0x646676);})[_0xaa7f('0x10')](function(_0x106031){var _0x1f515b={'statusCode':_0x106031['statusCode']||0x1f4,'statusMessage':_0x106031[_0xaa7f('0x72')]||_0xaa7f('0x73'),'headers':_0x106031[_0xaa7f('0x74')][_0xaa7f('0x6e')]||{},'body':_0x106031[_0xaa7f('0x74')][_0xaa7f('0x67')]||{}};_0x5664cd(null,_0x1f515b);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x75')]=function(_0x2e10f1,_0xf1b19d){scripts[_0xaa7f('0x75')](this['channel'][_0xaa7f('0x33')],_0x2e10f1[_0xaa7f('0x76')],_0x2e10f1[_0xaa7f('0x57')],_0x2e10f1[_0xaa7f('0x77')]||'en')[_0xaa7f('0x13')](function(_0xd3ed6){_0xf1b19d(null,_0xd3ed6);})[_0xaa7f('0x10')](function(_0x28377a){_0xf1b19d(_0x28377a);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x78')]=function(_0x4c7b49,_0x1ba1df){scripts[_0xaa7f('0x78')](this['channel'][_0xaa7f('0x33')],_0x4c7b49[_0xaa7f('0x79')],_0x4c7b49[_0xaa7f('0x7a')],_0x4c7b49[_0xaa7f('0x7b')],_0x4c7b49[_0xaa7f('0x57')],_0x4c7b49[_0xaa7f('0x7c')]||'en')[_0xaa7f('0x13')](function(_0x54484a){_0x1ba1df(null,_0x54484a);})['catch'](function(_0x133f68){_0x1ba1df(_0x133f68);});};AGIVertices[_0xaa7f('0x11')]['sestekNDA']=function(_0x59cfdf,_0x2f9500){scripts[_0xaa7f('0x7d')](this[_0xaa7f('0x32')],_0x59cfdf)[_0xaa7f('0x13')](function(_0x375bb7){_0x2f9500(null,_0x375bb7);})['catch'](function(_0x5b6487){_0x2f9500(_0x5b6487);});};AGIVertices[_0xaa7f('0x11')]['ispeechTTS']=function(_0x42593a,_0x3015b9){scripts[_0xaa7f('0x7e')](_0x42593a[_0xaa7f('0x76')],_0x42593a[_0xaa7f('0x57')],_0x42593a['ispeech_tts_language']||'en-US',_0x42593a[_0xaa7f('0x7f')])[_0xaa7f('0x13')](function(_0x11e3a5){_0x3015b9(null,_0x11e3a5);})[_0xaa7f('0x10')](function(_0x233e47){_0x3015b9(_0x233e47);});};AGIVertices[_0xaa7f('0x11')]['ispeechASR']=function(_0x1e5514,_0x567eba,_0xcc3e95){scripts['ispeechASR'](_0x567eba,_0x1e5514[_0xaa7f('0x76')],_0x1e5514['ispeech_asr_language']||_0xaa7f('0x59'),this[_0xaa7f('0x80')](_0x1e5514[_0xaa7f('0x81')])?_0x1e5514[_0xaa7f('0x81')]:undefined)[_0xaa7f('0x13')](function(_0xee72a){_0xcc3e95(null,_0xee72a);})['catch'](function(_0x4f6835){_0xcc3e95(_0x4f6835);});};AGIVertices['prototype'][_0xaa7f('0x82')]=function(_0x19e988,_0x1e7831){scripts[_0xaa7f('0x82')](_0x19e988[_0xaa7f('0x83')],_0x19e988['aws_secret_access_key'],_0x19e988['aws_polly_region'],_0x19e988[_0xaa7f('0x84')]||_0xaa7f('0x85'),_0x19e988['text'],_0x19e988['aws_text_type']||'text')[_0xaa7f('0x13')](function(_0x2f334d){_0x1e7831(null,_0x2f334d);})[_0xaa7f('0x10')](function(_0x4fb376){_0x1e7831(_0x4fb376);});};AGIVertices['prototype']['awsLex']=function(_0x4811a0,_0x3750c3){scripts[_0xaa7f('0x86')](this[_0xaa7f('0x32')][_0xaa7f('0x33')],_0x4811a0[_0xaa7f('0x83')],_0x4811a0['aws_secret_access_key'],_0x4811a0['aws_lex_region'],_0x4811a0[_0xaa7f('0x57')],_0x4811a0['aws_bot_name'])[_0xaa7f('0x13')](function(_0x2b12cd){_0x3750c3(null,_0x2b12cd);})[_0xaa7f('0x10')](function(_0x110603){_0x3750c3(_0x110603);});};AGIVertices[_0xaa7f('0x11')]['googleASR']=function(_0x4f616c,_0x3a4073,_0x4e0305){scripts[_0xaa7f('0x87')](_0x3a4073,_0x4f616c[_0xaa7f('0x76')],_0x4f616c[_0xaa7f('0x88')]||_0xaa7f('0x59'))['then'](function(_0xf9ed4a){_0x4e0305(null,_0xf9ed4a);})['catch'](function(_0x320a4f){_0x4e0305(_0x320a4f);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x89')]=function(_0x4f6d3a,_0x13b2a8,_0x2e5bf2){scripts['tildeASR'](_0x13b2a8,_0x4f6d3a['appid'],_0x4f6d3a[_0xaa7f('0x8a')],_0x4f6d3a[_0xaa7f('0x8b')])['then'](function(_0x3731e9){_0x2e5bf2(null,_0x3731e9);})[_0xaa7f('0x10')](function(_0xf736){_0x2e5bf2(_0xf736);});};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x8c')]=function(_0x3a0a96){var _0x41f34f=_[_0xaa7f('0x8d')](verticesWithRetry,_0x3a0a96[_0xaa7f('0x35')])?_0x3a0a96:_[_0xaa7f('0x8e')](_0x3a0a96);for(var _0x32021f in _0x41f34f){if(_0x41f34f[_0xaa7f('0x8f')](_0x32021f)){if(_0x41f34f[_0x32021f]&&_[_0xaa7f('0x90')](_0x41f34f[_0x32021f])){if(_[_0xaa7f('0x8d')](recursiveMapAttributes,_0x32021f)){_0x41f34f[_0x32021f]=this['replaceObjectAllVariables'](_0x41f34f[_0x32021f]);}else{_0x41f34f[_0x32021f]=this[_0xaa7f('0x91')](_0x41f34f[_0x32021f]);}}}}return _0x41f34f;};AGIVertices['prototype'][_0xaa7f('0x92')]=function(_0x1bd16c){for(var _0x2396f3 in _0x1bd16c){if(_0x1bd16c[_0xaa7f('0x8f')](_0x2396f3)){if(_[_0xaa7f('0x93')](_0x1bd16c[_0x2396f3])){this[_0xaa7f('0x92')](_0x1bd16c[_0x2396f3]);}else if(_[_0xaa7f('0x94')](_0x1bd16c[_0x2396f3])){for(var _0x464f77=0x0;_0x464f77<_0x1bd16c[_0x2396f3][_0xaa7f('0x95')];_0x464f77++){this[_0xaa7f('0x92')](_0x1bd16c[_0x2396f3][_0x464f77]);}}else if(_[_0xaa7f('0x90')](_0x1bd16c[_0x2396f3])){_0x1bd16c[_0x2396f3]=this[_0xaa7f('0x91')](_0x1bd16c[_0x2396f3]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x3e5f4e,_0x3a70f5){for(var _0x382e2a in _0x3e5f4e){if(_0x3e5f4e[_0xaa7f('0x8f')](_0x382e2a)){if(_['isPlainObject'](_0x3e5f4e[_0x382e2a])){if(!_[_0xaa7f('0x40')](_0x3e5f4e[_0x382e2a])){this[_0xaa7f('0x96')](_0x3e5f4e[_0x382e2a],util[_0xaa7f('0x50')](_0xaa7f('0x97'),_0x3a70f5,_0x382e2a));}}else if(_[_0xaa7f('0x94')](_0x3e5f4e[_0x382e2a])){for(var _0x105402=0x0;_0x105402<_0x3e5f4e[_0x382e2a][_0xaa7f('0x95')];_0x105402++){this[_0xaa7f('0x96')](_0x3e5f4e[_0x382e2a][_0x105402],util['format']('%s.%s',_0x3a70f5,_0x382e2a+'['+_0x105402+']'));}}else{if(!_['isNil'](_0x3e5f4e[_0x382e2a])){this[_0xaa7f('0x32')][_0xaa7f('0x98')](util[_0xaa7f('0x50')](_0xaa7f('0x97'),_0x3a70f5,_0x382e2a),_0x3e5f4e[_0x382e2a]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x264606){try{var _0x396499=JSON[_0xaa7f('0x69')](_0x264606);this['recursiveNodeIndex'](_0x396499);return JSON[_0xaa7f('0x6f')](_0x396499);}catch(_0x4a97ba){return this[_0xaa7f('0x91')](_0x264606);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x470cb8){var _0x2b8b1c=_0x470cb8[_0xaa7f('0x99')]('{');for(var _0x3dd5ce=0x1;_0x3dd5ce<_0x2b8b1c['length'];_0x3dd5ce+=0x1){var _0x17f44b=_0x2b8b1c[_0x3dd5ce][_0xaa7f('0x99')]('}');if(_0x17f44b[_0xaa7f('0x95')]>0x1){_0x470cb8=_0x470cb8[_0xaa7f('0x9a')]('{'+_0x17f44b[0x0]+'}',this[_0xaa7f('0x32')]['getVariable'](_0x17f44b[0x0])[_0xaa7f('0x9b')]||_0x17f44b[0x0]);}}if(_0x2b8b1c[_0xaa7f('0x95')]===0x1){return _0x470cb8[_0xaa7f('0x47')]();}return this[_0xaa7f('0x91')](_0x470cb8);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x9c')]=function(_0x381876,_0x49acc2){var _0x31be5b=this[_0xaa7f('0x32')][_0xaa7f('0xe')](_0x381876);if(_0x31be5b[_0xaa7f('0x9d')]===-0x1){return _0x31be5b;}logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x9e'),_0x49acc2,_0x31be5b[_0xaa7f('0x9b')]));return this[_0xaa7f('0x32')][_0xaa7f('0x98')](_0x49acc2,_0x31be5b[_0xaa7f('0x9b')]);};AGIVertices['prototype']['isConfigured']=function(_0x36d44a){return _0x36d44a&&_0x36d44a!=='0'&&_0x36d44a!=='-1'&&_0x36d44a!=='';};AGIVertices['prototype'][_0xaa7f('0x9f')]=function(_0x698479){this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x698479,'-');_0x698479[_0xaa7f('0xa1')]=_0x698479['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xa2')]=function(_0x2821b5){logger['info'](util['format'](_0xaa7f('0xa3'),_0x2821b5['label']));if(!this[_0xaa7f('0x80')](_0x2821b5[_0xaa7f('0x57')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xa5'));}var _0x59837='\x22'+_0x2821b5[_0xaa7f('0x57')]+'\x22';if(this[_0xaa7f('0x80')](_0x2821b5[_0xaa7f('0x74')])){_0x59837+=','+_0x2821b5[_0xaa7f('0x74')];}var _0x46968f=this['channel'][_0xaa7f('0x52')](_0xaa7f('0xa6'),_0x59837);if(_0x46968f[_0xaa7f('0x9d')]===-0x1){return _0x46968f;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Executed\x20command\x20MRCPSynth\x20%s',_0x59837));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xa7')]=function(_0x19ef91){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xa8'),_0x19ef91[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x19ef91[_0xaa7f('0xa9')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xaa'));}var _0x24a99f=_0x19ef91['grammar'];if(this[_0xaa7f('0x80')](_0x19ef91[_0xaa7f('0x74')])){_0x24a99f+=','+_0x19ef91['options'];}var _0x570f5e=this[_0xaa7f('0x32')]['exec']('MRCPRecog',_0x24a99f);if(_0x570f5e[_0xaa7f('0x9d')]===-0x1){return _0x570f5e;}var _0x38a078=this[_0xaa7f('0x9c')]('RECOG_CONFIDENCE()',_0xaa7f('0xab'));if(_0x38a078[_0xaa7f('0x9d')]===-0x1){return _0x38a078;}var _0xcf39e6=this[_0xaa7f('0x9c')]('RECOG_INPUT()',_0xaa7f('0xac'));if(_0xcf39e6['result']===-0x1){return _0xcf39e6;}var _0x5933f8=this[_0xaa7f('0x9c')](_0xaa7f('0xad'),_0xaa7f('0xae'));if(_0x5933f8[_0xaa7f('0x9d')]===-0x1){return _0x5933f8;}return this['channel']['noop'](util[_0xaa7f('0x50')](_0xaa7f('0xaf'),_0x24a99f));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x7')]=function(_0x4de1ce){logger[_0xaa7f('0x28')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4de1ce[_0xaa7f('0x34')]));return this[_0xaa7f('0x32')][_0xaa7f('0x7')]([_0x4de1ce['command'],_0x4de1ce[_0xaa7f('0xb0')]]);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xb1')]=function(_0x5de2e9){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0xb2'),_0x5de2e9['label']));if(this[_0xaa7f('0x80')](_0x5de2e9[_0xaa7f('0x62')])){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0xb3'),_0x5de2e9[_0xaa7f('0x62')]));var _0x5cfad1=this['channel'][_0xaa7f('0xb4')](_0x5de2e9[_0xaa7f('0x62')]);if(_0x5cfad1[_0xaa7f('0x9d')]===-0x1){return _0x5cfad1;}}return this[_0xaa7f('0x32')][_0xaa7f('0xb1')]();};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x45')]=function(_0x17670d){logger['info'](util[_0xaa7f('0x50')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x17670d[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x17670d[_0xaa7f('0xb5')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x17670d,'no\x20list\x20selected');}_0x17670d[_0xaa7f('0xb6')]=moment();if(this['isConfigured'](_0x17670d[_0xaa7f('0xb7')])){_0x17670d[_0xaa7f('0xb6')]=moment()[_0xaa7f('0xb8')](_0x17670d[_0xaa7f('0xb7')],'minutes');}if(!this[_0xaa7f('0x80')](_0x17670d[_0xaa7f('0xb9')])){_0x17670d[_0xaa7f('0xb9')]=0x2;}this[_0xaa7f('0x3f')]['sync'](this,_0x17670d);return this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xba'),_0x17670d['phone'],_0x17670d[_0xaa7f('0xb5')],_0x17670d[_0xaa7f('0xb6')]));};AGIVertices['prototype'][_0xaa7f('0xbb')]=function(_0x4504fc){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4504fc[_0xaa7f('0x34')]));var _0x40dfdc=this[_0xaa7f('0x32')][_0xaa7f('0x52')](_0x4504fc[_0xaa7f('0xbc')],_0x4504fc[_0xaa7f('0x74')]);if(_0x40dfdc['result']===-0x1){return _0x40dfdc;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0x4504fc[_0xaa7f('0xbc')],_0x4504fc[_0xaa7f('0x74')]));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xbd')]=function(_0xa2034a){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xbe'),_0xa2034a[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0xa2034a[_0xaa7f('0x57')])){return this[_0xaa7f('0x32')]['noop']('no\x20text\x20configured');}var _0x593c3b='\x22'+_0xa2034a[_0xaa7f('0x57')]+'\x22';if(this[_0xaa7f('0x80')](_0xa2034a['options'])){_0x593c3b+=','+_0xa2034a['options'];}var _0x58f093=this[_0xaa7f('0x32')]['exec'](_0xaa7f('0xa6'),_0x593c3b);if(_0x58f093['result']===-0x1){return _0x58f093;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format'](_0xaa7f('0xbf'),_0x593c3b));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xc0')]=function(_0x44398a){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xc1'),_0x44398a[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x44398a[_0xaa7f('0x57')])){return this[_0xaa7f('0x32')]['noop'](_0xaa7f('0xa5'));}var _0x336f22='\x22'+_0x44398a[_0xaa7f('0x57')]+'\x22';if(this['isConfigured'](_0x44398a[_0xaa7f('0x74')])){_0x336f22+=','+_0x44398a['options'];}var _0x490020=this[_0xaa7f('0x32')][_0xaa7f('0x52')]('MRCPSynth',_0x336f22);if(_0x490020[_0xaa7f('0x9d')]===-0x1){return _0x490020;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xbf'),_0x336f22));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xc2')]=function(_0x55aedd){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xc3'),_0x55aedd[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x55aedd[_0xaa7f('0xa9')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xaa'));}var _0x4bff0e=_0x55aedd['grammar'];if(this[_0xaa7f('0x80')](_0x55aedd[_0xaa7f('0x74')])){_0x4bff0e+=','+_0x55aedd['options'];}var _0x59838a=this[_0xaa7f('0x32')][_0xaa7f('0x52')]('MRCPRecog',_0x4bff0e);if(_0x59838a[_0xaa7f('0x9d')]===-0x1){return _0x59838a;}var _0x33186d=this['getAndSetVariable'](_0xaa7f('0xc4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x33186d[_0xaa7f('0x9d')]===-0x1){return _0x33186d;}var _0xe87f30=this[_0xaa7f('0x9c')](_0xaa7f('0xc5'),_0xaa7f('0xc6'));if(_0xe87f30['result']===-0x1){return _0xe87f30;}var _0x26f71a=this[_0xaa7f('0x9c')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x26f71a[_0xaa7f('0x9d')]===-0x1){return _0x26f71a;}return this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4bff0e));};AGIVertices['prototype'][_0xaa7f('0xc7')]=function(_0x215bc3){logger[_0xaa7f('0x28')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x215bc3[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x215bc3[_0xaa7f('0xa9')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20grammar\x20configured');}var _0x4dd98a=_0x215bc3[_0xaa7f('0xa9')];if(this['isConfigured'](_0x215bc3[_0xaa7f('0x74')])){_0x4dd98a+=','+_0x215bc3[_0xaa7f('0x74')];}var _0x451228=this[_0xaa7f('0x32')]['exec'](_0xaa7f('0xc8'),_0x4dd98a);if(_0x451228[_0xaa7f('0x9d')]===-0x1){return _0x451228;}var _0x124992=this[_0xaa7f('0x9c')](_0xaa7f('0xc4'),_0xaa7f('0xc9'));if(_0x124992[_0xaa7f('0x9d')]===-0x1){return _0x124992;}var _0x2d7d41=this[_0xaa7f('0x9c')](_0xaa7f('0xc5'),_0xaa7f('0xca'));if(_0x2d7d41['result']===-0x1){return _0x2d7d41;}var _0xa0101d=this['getAndSetVariable']('RECOG_INSTANCE()',_0xaa7f('0xcb'));if(_0xa0101d[_0xaa7f('0x9d')]===-0x1){return _0xa0101d;}return this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4dd98a));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xcc')]=function(_0x270343){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xcd'),_0x270343[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x270343[_0xaa7f('0xce')])){return this['channel'][_0xaa7f('0x26')](_0x270343,'no\x20database\x20selected');}var _0x3cf84d=this[_0xaa7f('0x16')]['sync'](this,_0x270343[_0xaa7f('0xce')]);if(!_0x3cf84d){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x270343,_0xaa7f('0xcf'));}if(!this[_0xaa7f('0x80')](_0x270343[_0xaa7f('0x2a')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x270343,_0xaa7f('0xd0'));}var _0x3d42fa=_0x270343['query'][_0xaa7f('0xd1')](/(\r\n|\n|\r)/gm,'\x20');this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')]('query:\x20%s',_0x3d42fa));var _0x4cd9d3=this[_0xaa7f('0x25')]['sync'](this,_0x3cf84d,_0x3d42fa);this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x270343,_0x3d42fa);if(!this[_0xaa7f('0x80')](_0x270343[_0xaa7f('0xd2')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x459689=this[_0xaa7f('0xe')][_0xaa7f('0x6d')](this,_0x270343[_0xaa7f('0xd2')]);if(!_0x459689){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x270343,_0xaa7f('0xd3'));}var _0x58cb65=this;_0x4cd9d3[_0xaa7f('0xd4')](function(_0x3cb3c6,_0x1c31f5){Object[_0xaa7f('0xd5')](_0x3cb3c6)['forEach'](function(_0x3340d9){_0x58cb65[_0xaa7f('0x32')]['setVariable'](util[_0xaa7f('0x50')](_0xaa7f('0xd6'),_0x459689,_0x1c31f5,_0x3340d9),_0x3cb3c6[_0x3340d9]);});});this['channel']['setVariable'](util[_0xaa7f('0x50')]('%s_ROWS_COUNT',_0x459689),_0x4cd9d3[_0xaa7f('0x95')]);return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xd7'),_0x459689));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xd8')]=function(_0x54f90e){logger[_0xaa7f('0xd9')](util['format'](_0xaa7f('0xda'),_0x54f90e[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x54f90e[_0xaa7f('0xdb')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x54f90e,'no\x20user\x20selected');}var _0x447753=this[_0xaa7f('0x17')]['sync'](this,_0x54f90e[_0xaa7f('0xdb')]);if(!_0x447753){return this['channel']['error'](_0x54f90e,'no\x20user\x20found');}var _0x5010a5=this[_0xaa7f('0x32')][_0xaa7f('0x52')](_0xaa7f('0xdc'),[util[_0xaa7f('0x50')](_0xaa7f('0xdd'),_0x447753),_0x54f90e['timeout'],_0x54f90e[_0xaa7f('0xde')],_0x54f90e[_0xaa7f('0x60')]]);if(_0x5010a5[_0xaa7f('0x9d')]===-0x1){return _0x5010a5;}return this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xdf'),_0xaa7f('0xdc')));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xe0')]=function(_0x2d1cc2){logger['info'](util[_0xaa7f('0x50')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2d1cc2[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x2d1cc2['key'])){return this[_0xaa7f('0x32')]['noop'](_0xaa7f('0xe1'));}if(!this[_0xaa7f('0x80')](_0x2d1cc2[_0xaa7f('0x57')])){return this['channel'][_0xaa7f('0xa4')]('no\x20text\x20configured');}this[_0xaa7f('0x32')][_0xaa7f('0xe2')]=!![];this[_0xaa7f('0xa0')](_0x2d1cc2);this['createSquareMessage'](_0x2d1cc2[_0xaa7f('0x57')],'in','','');this['channel']['noop'](util['format'](_0xaa7f('0xe3'),_0x2d1cc2[_0xaa7f('0x57')]));var _0x282959=this[_0xaa7f('0x75')][_0xaa7f('0x6d')](this,_0x2d1cc2);if(_0x282959){for(var _0x2dbdcb in _0x282959){if(_0x282959[_0xaa7f('0x8f')](_0x2dbdcb)){this[_0xaa7f('0x32')][_0xaa7f('0x98')](util[_0xaa7f('0x50')](_0xaa7f('0xe4'),_0x2dbdcb[_0xaa7f('0x66')]()),_0x282959[_0x2dbdcb]);}}this[_0xaa7f('0xe5')](_0x282959[_0xaa7f('0xe6')],'out','dialogflow','');return this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0xe7'),_0x282959['speech']));}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x2d1cc2,_0xaa7f('0xe8'));};AGIVertices[_0xaa7f('0x11')]['dialogflowV2']=function(_0x2608e8){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0xe9'),_0x2608e8[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x2608e8[_0xaa7f('0x79')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xea'));}if(!this[_0xaa7f('0x80')](_0x2608e8[_0xaa7f('0x7a')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0xaa7f('0x80')](_0x2608e8[_0xaa7f('0x7b')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xeb'));}if(!this['isConfigured'](_0x2608e8[_0xaa7f('0x7c')])){return this[_0xaa7f('0x32')]['noop'](_0xaa7f('0xec'));}if(!this[_0xaa7f('0x80')](_0x2608e8[_0xaa7f('0x57')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xaa7f('0xe2')]=!![];this['createSquareDetailsReport'](_0x2608e8);this[_0xaa7f('0xe5')](_0x2608e8[_0xaa7f('0x57')],'in','','');this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x2608e8['text']));var _0x391124=this[_0xaa7f('0x78')]['sync'](this,_0x2608e8);if(_0x391124){for(var _0x5da719 in _0x391124){if(_0x391124[_0xaa7f('0x8f')](_0x5da719)){if(_0x5da719!==_0xaa7f('0xed')){this[_0xaa7f('0x32')][_0xaa7f('0x98')](util[_0xaa7f('0x50')](_0xaa7f('0xe4'),_0x5da719['toUpperCase']()),_0x391124[_0x5da719]);}}}this[_0xaa7f('0xe5')](_0x391124[_0xaa7f('0xe6')],_0xaa7f('0xee'),_0xaa7f('0xef'),_0x391124[_0xaa7f('0xed')]);return this['channel'][_0xaa7f('0xa4')](util['format'](_0xaa7f('0xf0'),_0x391124[_0xaa7f('0xe6')]));}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x2608e8,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x4f4d50){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0xf1'),_0x4f4d50[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x4f4d50[_0xaa7f('0xf2')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xf3'));}if(!this['isConfigured'](_0x4f4d50['username'])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xf4'));}if(!this[_0xaa7f('0x80')](_0x4f4d50[_0xaa7f('0xf5')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20password\x20configured');}if(!this[_0xaa7f('0x80')](_0x4f4d50['ndassistant_url'])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xa5'));}this[_0xaa7f('0x32')][_0xaa7f('0xe2')]=!![];this['createSquareDetailsReport'](_0x4f4d50);this['createSquareMessage'](_0x4f4d50['text'],'in','','');this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xf6'),_0x4f4d50[_0xaa7f('0x57')]));var _0x368e62=this[_0xaa7f('0x7d')][_0xaa7f('0x6d')](this,_0x4f4d50);if(_0x368e62){for(var _0x372a2c in _0x368e62){if(_0x368e62[_0xaa7f('0x8f')](_0x372a2c)){this[_0xaa7f('0x32')][_0xaa7f('0x98')](util['format']('SESTEK_NDA_%s',_0x372a2c[_0xaa7f('0x66')]()),_0x368e62[_0x372a2c]);}}this[_0xaa7f('0xe5')](_0x368e62['speech'],_0xaa7f('0xee'),_0xaa7f('0xf7'),'');if(_0x368e62[_0xaa7f('0xf8')]){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x368e62[_0xaa7f('0xf8')]));var _0x54378b=this[_0xaa7f('0x32')][_0xaa7f('0xf9')](_0x368e62[_0xaa7f('0xf8')]);try{fs[_0xaa7f('0xfa')](_0x368e62[_0xaa7f('0xf8')]+_0xaa7f('0xfb'));}catch(_0x59b082){logger[_0xaa7f('0x26')](_0x59b082);}return _0x54378b;}else{return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0xfc'),_0x368e62[_0xaa7f('0xe6')]));}}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x4f4d50,_0xaa7f('0xfd'));};AGIVertices['prototype'][_0xaa7f('0xfe')]=function(_0x2b326d){logger[_0xaa7f('0x28')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x2b326d[_0xaa7f('0x34')]));return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('end');};AGIVertices[_0xaa7f('0x11')]['ext_dial']=function(_0x36e89e){logger[_0xaa7f('0x28')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x36e89e['label']));var _0x1bdf95='';if(_0x36e89e[_0xaa7f('0xff')]){if(!this['isConfigured'](_0x36e89e[_0xaa7f('0xff')])){return this[_0xaa7f('0x32')]['error'](_0x36e89e,'no\x20trunk\x20selected');}else{var _0x2ad4e2=parseInt(_0x36e89e['trunk_id'],0xa);if(isNaN(_0x2ad4e2)){_0x1bdf95=_0x36e89e[_0xaa7f('0xff')];}else{_0x1bdf95=this[_0xaa7f('0x19')][_0xaa7f('0x6d')](this,_0x36e89e['trunk_id']);if(!_0x1bdf95){return this[_0xaa7f('0x32')]['error'](_0x36e89e,'no\x20trunk\x20found');}}}}else if(_0x36e89e[_0xaa7f('0x100')]){_0x1bdf95=_0x36e89e[_0xaa7f('0x100')];}else{return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x36e89e,_0xaa7f('0x101'));}var _0x27b130=this[_0xaa7f('0x32')]['exec'](_0xaa7f('0xdc'),[util['format'](_0xaa7f('0x102'),_0x1bdf95,_0x36e89e[_0xaa7f('0x44')]),_0x36e89e[_0xaa7f('0x62')],_0x36e89e[_0xaa7f('0xde')],_0x36e89e[_0xaa7f('0x60')]]);if(_0x27b130[_0xaa7f('0x9d')]===-0x1){return _0x27b130;}return this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0xdf'),'DIAL'));};AGIVertices[_0xaa7f('0x11')]['finally']=function(_0x33176f){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x103'),_0x33176f[_0xaa7f('0x34')]));return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x104'));};AGIVertices['prototype'][_0xaa7f('0x105')]=function(_0x2a0832){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2a0832[_0xaa7f('0x34')]));if(_0x2a0832[_0xaa7f('0xa1')]===0x0){return this['maxRetry'](_0x2a0832);}_0x2a0832[_0xaa7f('0xa1')]-=0x1;if(!this['isConfigured'](_0x2a0832['file_id'])){return this['channel'][_0xaa7f('0x26')](_0x2a0832,_0xaa7f('0x106'));}var _0x51e5a8=this[_0xaa7f('0x107')][_0xaa7f('0x6d')](this,_0x2a0832[_0xaa7f('0x108')]);if(!_0x51e5a8){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x2a0832,_0xaa7f('0x109'));}if(!this['isConfigured'](_0x2a0832['variable_id'])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0xaa7f('0x10a'));}var _0x51776e=this[_0xaa7f('0x32')][_0xaa7f('0x10b')](_0x51e5a8,_0x2a0832[_0xaa7f('0x10c')],_0x2a0832[_0xaa7f('0x10d')]);var _0x482b6e=_0x51776e['result']?_0x51776e['result'][_0xaa7f('0x47')]():'';logger[_0xaa7f('0x28')]('test',JSON[_0xaa7f('0x6f')](_0x51776e));if(_0x51776e['result']===-0x1){this[_0xaa7f('0xa0')]['sync'](this,_0x2a0832,_0x482b6e);return _0x51776e;}else if(_0x51776e[_0xaa7f('0x9b')]==='timeout'){_0x51776e['result']=_0x482b6e[_0xaa7f('0x95')]>=parseInt(_0x2a0832['mindigit'])?'x':'i';}else{_0x51776e[_0xaa7f('0x9d')]=_0x482b6e['length']>=parseInt(_0x2a0832[_0xaa7f('0x10e')])&&_0x482b6e['length']<=parseInt(_0x2a0832['maxdigit'])?'x':'i';}var _0x2ed0db=this[_0xaa7f('0xe')][_0xaa7f('0x6d')](this,_0x2a0832[_0xaa7f('0xd2')]);if(!_0x2ed0db){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x2a0832,_0xaa7f('0xd3'));}this[_0xaa7f('0x32')]['setVariable'](_0x2ed0db,_0x482b6e);if(this['isConfigured'](_0x2a0832[_0xaa7f('0x10f')])){var _0x5f3cf6=parseInt(_0x2a0832[_0xaa7f('0x10f')],0xa);var _0x2aba1d=rs[_0xaa7f('0x110')]({'charset':'*','length':_0x5f3cf6});var _0x4a437c=_0x482b6e[_0xaa7f('0x95')];if(_0x4a437c>0x0){if(_0x4a437c>_0x5f3cf6){this['createSquareDetailsReport'][_0xaa7f('0x6d')](this,_0x2a0832,_0x2a0832[_0xaa7f('0x111')]===_0xaa7f('0x112')?_0x2aba1d+_0x482b6e['substr'](_0x5f3cf6):_0x482b6e[_0xaa7f('0x113')](0x0,_0x4a437c-_0x5f3cf6)+_0x2aba1d);}else{this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x2a0832,rs[_0xaa7f('0x110')]({'charset':'*','length':_0x4a437c}));}}else{this['createSquareDetailsReport'][_0xaa7f('0x6d')](this,_0x2a0832,'');}}else{this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x2a0832,_0x482b6e);}return _0x51776e;};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xb')]=function(_0x5c1fd8){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x114'),_0x5c1fd8['label']));return this[_0xaa7f('0x105')](_0x5c1fd8);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x115')]=function(_0x3e62b7){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x116'),_0x3e62b7[_0xaa7f('0x34')]));this[_0xaa7f('0xa0')]['sync'](this,_0x3e62b7,_0x3e62b7[_0xaa7f('0x117')]);return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x118'),_0x3e62b7[_0xaa7f('0x117')]));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x119')]=function(_0x26839c){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x11a'),_0x26839c[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x26839c['aws_access_key_id'])||!this['isConfigured'](_0x26839c[_0xaa7f('0x11b')])){return this[_0xaa7f('0x32')]['noop'](_0xaa7f('0x11c'));}if(!this[_0xaa7f('0x80')](_0x26839c[_0xaa7f('0x57')])){return this['channel'][_0xaa7f('0xa4')](_0xaa7f('0xa5'));}this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Trying\x20aws\x20Polly\x20%s',_0x26839c['text']));var _0x4985ba=this['awsPolly'][_0xaa7f('0x6d')](this,_0x26839c);if(_0x4985ba){this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x11d'),_0x4985ba));var _0x12a3f8=this[_0xaa7f('0x32')][_0xaa7f('0xf9')](_0x4985ba);try{fs['unlink'](_0x4985ba+'.wav');}catch(_0x167968){logger['error'](_0x167968);}return _0x12a3f8;}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x26839c,_0xaa7f('0x11e'));};AGIVertices[_0xaa7f('0x11')]['awslex']=function(_0x19e10f){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x11f'),_0x19e10f[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x19e10f[_0xaa7f('0x83')])||!this[_0xaa7f('0x80')](_0x19e10f[_0xaa7f('0x11b')])){return this['channel']['noop'](_0xaa7f('0x11c'));}if(!this['isConfigured'](_0x19e10f[_0xaa7f('0x120')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x19e10f[_0xaa7f('0x57')])){return this['channel'][_0xaa7f('0xa4')](_0xaa7f('0xa5'));}this[_0xaa7f('0x32')][_0xaa7f('0xe2')]=!![];this[_0xaa7f('0xa0')](_0x19e10f);this[_0xaa7f('0xe5')](_0x19e10f[_0xaa7f('0x57')],'in','','');this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x121'),_0x19e10f[_0xaa7f('0x57')]));var _0x2ad51c=this[_0xaa7f('0x86')][_0xaa7f('0x6d')](this,_0x19e10f);if(_0x2ad51c){for(var _0x3ac538 in _0x2ad51c){if(_0x2ad51c['hasOwnProperty'](_0x3ac538)&&_[_0xaa7f('0x90')](_0x2ad51c[_0x3ac538])){this[_0xaa7f('0x32')]['setVariable'](util[_0xaa7f('0x50')](_0xaa7f('0x122'),_0x3ac538[_0xaa7f('0x66')]()),_0x2ad51c[_0x3ac538]);}}if(_[_0xaa7f('0x41')](_0x2ad51c['message'])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x123'));}else{this[_0xaa7f('0xe5')](_0x2ad51c[_0xaa7f('0x72')],_0xaa7f('0xee'),_0xaa7f('0x124'),'');return this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x125'),_0x2ad51c['message']));}}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x19e10f,_0xaa7f('0x126'));};AGIVertices['prototype']['googleasr']=function(_0x3efdb7){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x127'),_0x3efdb7[_0xaa7f('0x34')],_0x3efdb7[_0xaa7f('0x62')]));if(!this[_0xaa7f('0x80')](_0x3efdb7[_0xaa7f('0x76')])){return this[_0xaa7f('0x32')]['noop']('no\x20key\x20configured');}var _0x3a3931=_0xaa7f('0x128');var _0x34cb26=util[_0xaa7f('0x50')](_0xaa7f('0x129'),FILES_PATH,rs[_0xaa7f('0x110')](0x4));var _0xb54ff0=util['format'](_0xaa7f('0x97'),_0x34cb26,_0x3a3931);var _0x444b7c=!![];if(_0x3efdb7['beep']===_0xaa7f('0x12a')){_0x444b7c=![];}var _0xcc2320=this[_0xaa7f('0x32')]['recordFile'](_0x34cb26,_0x3a3931,_0x3efdb7['intKey'],_0x3efdb7[_0xaa7f('0x62')],undefined,_0x444b7c);if(_0xcc2320[_0xaa7f('0x9d')]!==-0x1){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x12b'),_0xb54ff0));var _0x4ef2d3=this[_0xaa7f('0x87')]['sync'](this,_0x3efdb7,_0xb54ff0);if(_0x4ef2d3){for(var _0x1bc811 in _0x4ef2d3){if(_0x4ef2d3['hasOwnProperty'](_0x1bc811)){this[_0xaa7f('0x32')]['setVariable'](util[_0xaa7f('0x50')](_0xaa7f('0x12c'),_0x1bc811[_0xaa7f('0x66')]()),_0x4ef2d3[_0x1bc811]);}}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format'](_0xaa7f('0x12d'),JSON[_0xaa7f('0x6f')](_0x4ef2d3)));}}return _0xcc2320;};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x12e')]=function(_0x273a0e){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x12f'),_0x273a0e[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x273a0e[_0xaa7f('0x130')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x131'));}if(!this[_0xaa7f('0x80')](_0x273a0e[_0xaa7f('0x8a')])){return this[_0xaa7f('0x32')]['noop']('no\x20appsecret\x20configured');}var _0x372750=_0xaa7f('0x128');var _0x3c0672=util[_0xaa7f('0x50')](_0xaa7f('0x129'),FILES_PATH,rs['generate'](0x4));var _0x26a175=util[_0xaa7f('0x50')](_0xaa7f('0x97'),_0x3c0672,_0x372750);var _0x1601e6=!![];if(_0x273a0e[_0xaa7f('0x132')]===_0xaa7f('0x12a')){_0x1601e6=![];}var _0x3b99b5=this[_0xaa7f('0x32')][_0xaa7f('0x133')](_0x3c0672,_0x372750,_0x273a0e['intKey'],_0x273a0e[_0xaa7f('0x62')],undefined,_0x1601e6);if(_0x3b99b5[_0xaa7f('0x9d')]!==-0x1){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('tilde\x20%s\x20file\x20created',_0x26a175));var _0x2c0b37=this[_0xaa7f('0x89')][_0xaa7f('0x6d')](this,_0x273a0e,_0x26a175);if(_0x2c0b37){for(var _0x3e4b86 in _0x2c0b37){if(_0x2c0b37[_0xaa7f('0x8f')](_0x3e4b86)){this[_0xaa7f('0x32')]['setVariable'](util['format']('TILDE_ASR_%s',_0x3e4b86[_0xaa7f('0x66')]()),_0x2c0b37[_0x3e4b86]);}}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x134'),JSON[_0xaa7f('0x6f')](_0x2c0b37)));}}return _0x3b99b5;};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x135')]=function(_0x5b301f){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x136'),_0x5b301f[_0xaa7f('0x34')]));return this['channel'][_0xaa7f('0x137')](_0x5b301f['context'],_0x5b301f['extension'],_0x5b301f['priority']);};AGIVertices[_0xaa7f('0x11')]['gotoif']=function(_0x192370){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x138'),_0x192370[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x192370[_0xaa7f('0x139')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x192370,'no\x20condition\x20configured');}try{var _0x4d12d3=eval(_0x192370['condition'])?'true':_0xaa7f('0x13a');this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x13b'),_0x192370[_0xaa7f('0x139')],_0x4d12d3));return{'code':0xc8,'result':_0x4d12d3};}catch(_0x1f7298){return{'code':0xc8,'result':_0xaa7f('0x13a')};}};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x13c')]=function(_0x40994d){logger['info'](util['format'](_0xaa7f('0x13d'),_0x40994d[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x40994d[_0xaa7f('0x13e')])){return this['channel'][_0xaa7f('0x26')](_0x40994d,_0xaa7f('0x13f'));}var _0x2afddd=this[_0xaa7f('0x1f')]['sync'](this,_0x40994d[_0xaa7f('0x13e')]);if(!_0x2afddd){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x40994d,_0xaa7f('0x140'));}for(var _0x364f00=0x0;_0x364f00<_0x2afddd[_0xaa7f('0x95')];_0x364f00+=0x1){var _0x5a3a77=this[_0xaa7f('0x32')][_0xaa7f('0xe')](util[_0xaa7f('0x50')](_0xaa7f('0x141'),_0x2afddd[_0x364f00]));if(_0x5a3a77[_0xaa7f('0x9d')]===-0x1){return _0x5a3a77;}logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('IFTIME\x20%s\x20%s',_0x2afddd[_0x364f00],_0x5a3a77['extra']));if(_0x5a3a77[_0xaa7f('0x9b')]==='true'){logger[_0xaa7f('0x28')](util['format']('IFTIME\x20%s\x20%s',_0x2afddd[_0x364f00],_0xaa7f('0x142')));this['channel'][_0xaa7f('0xa4')](util['format'](_0xaa7f('0x143'),_0x2afddd[_0x364f00],_0xaa7f('0x142')));return{'code':0xc8,'result':_0xaa7f('0x142')};}else{logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x143'),_0x2afddd[_0x364f00],_0xaa7f('0x13a')));this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x143'),_0x2afddd[_0x364f00],'false'));}}return{'code':0xc8,'result':_0xaa7f('0x13a')};};AGIVertices[_0xaa7f('0x11')]['hangup']=function(_0x48ccd0){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x144'),_0x48ccd0[_0xaa7f('0x34')]));return this[_0xaa7f('0x32')][_0xaa7f('0x145')]();};AGIVertices['prototype'][_0xaa7f('0x146')]=function(_0x25454b){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x147'),_0x25454b[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x25454b[_0xaa7f('0x76')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xe1'));}var _0x37819e='wav';var _0x1797c7=util[_0xaa7f('0x50')](_0xaa7f('0x129'),FILES_PATH,rs[_0xaa7f('0x110')](0x4));var _0x1721c=util['format'](_0xaa7f('0x97'),_0x1797c7,_0x37819e);var _0x40bda3=!![];if(_0x25454b['beep']==='NOBEEP'){_0x40bda3=![];}var _0x10684b=this[_0xaa7f('0x32')][_0xaa7f('0x133')](_0x1797c7,_0x37819e,_0x25454b[_0xaa7f('0x148')],_0x25454b['timeout'],undefined,_0x40bda3);if(_0x10684b[_0xaa7f('0x9d')]!==-0x1){this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x149'),_0x1721c));var _0x35f415=this[_0xaa7f('0x14a')]['sync'](this,_0x25454b,_0x1721c);if(_0x35f415){for(var _0xdf6f55 in _0x35f415){if(_0x35f415[_0xaa7f('0x8f')](_0xdf6f55)){this[_0xaa7f('0x32')][_0xaa7f('0x98')](util['format']('ISPEECH_ASR_%s',_0xdf6f55[_0xaa7f('0x66')]()),_0x35f415[_0xdf6f55]);}}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('IspeechASR\x20Result\x20%s',JSON[_0xaa7f('0x6f')](_0x35f415)));}}return _0x10684b;};AGIVertices[_0xaa7f('0x11')]['ispeechtts']=function(_0xd0f018){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x14b'),_0xd0f018['label']));if(!this['isConfigured'](_0xd0f018[_0xaa7f('0x76')])){return this[_0xaa7f('0x32')]['noop']('no\x20key\x20configured');}if(!this[_0xaa7f('0x80')](_0xd0f018['text'])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0xa5'));}this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x14c'),_0xd0f018[_0xaa7f('0x57')]));var _0x39fa4f=this[_0xaa7f('0x7e')][_0xaa7f('0x6d')](this,_0xd0f018);if(_0x39fa4f){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x39fa4f));var _0x1bfebb=this[_0xaa7f('0x32')]['streamFile'](_0x39fa4f,_0xd0f018[_0xaa7f('0x148')]);try{fs[_0xaa7f('0xfa')](_0x39fa4f+_0xaa7f('0xfb'));}catch(_0x2b38c5){logger[_0xaa7f('0x26')](_0x2b38c5);}return _0x1bfebb;}return this['channel']['error'](_0xd0f018,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xaa7f('0x14d')]=function(_0x524056){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x14e'),_0x524056[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x524056[_0xaa7f('0x14f')])){return this[_0xaa7f('0x32')]['error'](_0x524056,_0xaa7f('0x150'));}logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x151'),this['channel']['callerid'],_0x524056[_0xaa7f('0x14f')]));var _0x161851=this['agentLogin'][_0xaa7f('0x6d')](this,_0x524056[_0xaa7f('0x14f')]);if(_0x161851){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')]['callerid'],_0x524056[_0xaa7f('0x14f')]));this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')]['callerid'],_0x524056['findBy']));return{'code':0xc8,'result':_0xaa7f('0x153')};}else{logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x524056[_0xaa7f('0x14f')]));this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x524056[_0xaa7f('0x14f')]));return{'code':0xc8,'result':_0xaa7f('0x155')};}};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x156')]=function(_0x1130f7){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x157'),_0x1130f7[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x1130f7[_0xaa7f('0x14f')])){return this['channel']['error'](_0x1130f7,_0xaa7f('0x150'));}logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x151'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x1130f7[_0xaa7f('0x14f')]));var _0x1974a7=this['agentLogout'][_0xaa7f('0x6d')](this,_0x1130f7[_0xaa7f('0x14f')]);if(_0x1974a7){logger['info'](util[_0xaa7f('0x50')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x1130f7[_0xaa7f('0x14f')]));this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x1130f7['findBy']));return{'code':0xc8,'result':_0xaa7f('0x153')};}else{logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this[_0xaa7f('0x32')]['callerid'],_0x1130f7['findBy']));this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x1130f7['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x158')]=function(_0x30eb4f){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x159'),_0x30eb4f[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x30eb4f[_0xaa7f('0x15a')])){return this[_0xaa7f('0x32')]['error'](_0x30eb4f,'no\x20operation\x20configured');}this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x15b'),_0x30eb4f[_0xaa7f('0x15a')]));var _0x9052=eval(_0x30eb4f[_0xaa7f('0x15a')]);if(!this['isConfigured'](_0x30eb4f[_0xaa7f('0xd2')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x467ed0=this[_0xaa7f('0xe')]['sync'](this,_0x30eb4f[_0xaa7f('0xd2')]);if(!_0x467ed0){return this['channel'][_0xaa7f('0x26')](_0x30eb4f,_0xaa7f('0xd3'));}if(_[_0xaa7f('0x94')](_0x9052)){var _0x3cfcdc=this;_0x9052[_0xaa7f('0xd4')](function(_0x46c384,_0x2b154c){_0x3cfcdc['channel'][_0xaa7f('0x98')](util[_0xaa7f('0x50')](_0xaa7f('0x15c'),_0x467ed0,_0x2b154c),_0x46c384);});return this[_0xaa7f('0x32')]['noop'](util['format'](_0xaa7f('0x15d'),_0x467ed0));}else{return this[_0xaa7f('0x32')]['setVariable'](_0x467ed0,_0x9052);}};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xa')]=function(_0x140e3a){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x15e'),_0x140e3a[_0xaa7f('0x34')]));if(_0x140e3a[_0xaa7f('0xa1')]===0x0){return this[_0xaa7f('0x9f')](_0x140e3a);}_0x140e3a[_0xaa7f('0xa1')]-=0x1;if(!this[_0xaa7f('0x80')](_0x140e3a[_0xaa7f('0x108')])){return this['channel']['error'](_0x140e3a,_0xaa7f('0x106'));}var _0x1291b1=this[_0xaa7f('0x107')][_0xaa7f('0x6d')](this,_0x140e3a['file_id']);if(!_0x1291b1){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x140e3a,'no\x20file\x20audio\x20found');}var _0x279ff5=this[_0xaa7f('0x32')][_0xaa7f('0x10b')](_0x1291b1,_0x140e3a[_0xaa7f('0x10c')],_0x140e3a[_0xaa7f('0x15f')]);var _0x382965=_0x279ff5[_0xaa7f('0x9d')];if(_0x279ff5[_0xaa7f('0x9d')]===-0x1){this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x140e3a,'-1');return _0x279ff5;}else if(_0x279ff5[_0xaa7f('0x9b')]==='timeout'){_0x279ff5[_0xaa7f('0x9d')]=_0x279ff5[_0xaa7f('0x9d')][_0xaa7f('0x95')]>0x0?_0x279ff5[_0xaa7f('0x9d')]:'t';}else if(_[_0xaa7f('0x40')](_0x279ff5[_0xaa7f('0x9d')])){_0x279ff5['result']='#';_0x382965='#';}if(!this[_0xaa7f('0x80')](_0x140e3a[_0xaa7f('0xd2')])){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x10a'));}else{var _0x433daa=this['getVariable'][_0xaa7f('0x6d')](this,_0x140e3a[_0xaa7f('0xd2')]);if(!_0x433daa){return this['channel'][_0xaa7f('0x26')](_0x140e3a,_0xaa7f('0xd3'));}this[_0xaa7f('0x32')]['setVariable'](_0x433daa,_0x382965);}this[_0xaa7f('0xa0')]['sync'](this,_0x140e3a,_0x382965);return _0x279ff5;};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0xa4')]=function(_0x473079){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x473079[_0xaa7f('0x34')]));return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0x473079[_0xaa7f('0x160')]||_0x473079[_0xaa7f('0x34')]);};AGIVertices['prototype'][_0xaa7f('0x161')]=function(_0x564790){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x162'),_0x564790[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x564790[_0xaa7f('0x14f')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x564790,_0xaa7f('0x150'));}logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x151'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x564790[_0xaa7f('0x14f')]));var _0x3c7b7a=this[_0xaa7f('0x48')][_0xaa7f('0x6d')](this,_0x564790[_0xaa7f('0x163')]);var _0x57bdcf=this[_0xaa7f('0x4a')][_0xaa7f('0x6d')](this,_0x564790[_0xaa7f('0x14f')],_0x3c7b7a);if(_0x57bdcf){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x152'),this['channel']['callerid'],_0x564790[_0xaa7f('0x14f')]));this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x564790[_0xaa7f('0x14f')]));return{'code':0xc8,'result':_0xaa7f('0x153')};}else{logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x564790[_0xaa7f('0x14f')]));this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x564790[_0xaa7f('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x164')]=function(_0x1dbc56){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x165'),_0x1dbc56[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x1dbc56[_0xaa7f('0x108')])){return this['channel']['error'](_0x1dbc56,'no\x20file\x20audio\x20selected');}var _0x22e291=this[_0xaa7f('0x107')][_0xaa7f('0x6d')](this,_0x1dbc56[_0xaa7f('0x108')]);if(!_0x22e291){return this['channel'][_0xaa7f('0x26')](_0x1dbc56,_0xaa7f('0x109'));}var _0x3ac3de=this[_0xaa7f('0x32')][_0xaa7f('0x52')](_0xaa7f('0x166'),[_0x22e291,_0x1dbc56['opts']]);if(_0x3ac3de['result']===-0x1){return _0x3ac3de;}return this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x167'),'PLAYBACK',_0x22e291));};AGIVertices[_0xaa7f('0x11')]['queue']=function(_0x43af30){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x168'),_0x43af30[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x43af30[_0xaa7f('0x169')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x43af30,_0xaa7f('0x16a'));}var _0x3eb575='';var _0x1367c5=parseInt(_0x43af30[_0xaa7f('0x169')],0xa);if(isNaN(_0x1367c5)){_0x3eb575=_0x43af30[_0xaa7f('0x169')];}else{_0x3eb575=this[_0xaa7f('0x12')][_0xaa7f('0x6d')](this,_0x43af30['queue_id']);if(!_0x3eb575){return this['channel'][_0xaa7f('0x26')](_0x43af30,_0xaa7f('0x16b'));}}var _0x2dbf26='';if(this[_0xaa7f('0x80')](_0x43af30[_0xaa7f('0x108')])){var _0x90fc9=this[_0xaa7f('0x107')][_0xaa7f('0x6d')](this,_0x43af30[_0xaa7f('0x108')]);if(_0x90fc9){_0x2dbf26=_0x90fc9;}}this[_0xaa7f('0xa0')]['sync'](this,_0x43af30,_0x3eb575);if(_0x43af30[_0xaa7f('0xde')][_0xaa7f('0x16c')]('x')<0x0){_0x43af30[_0xaa7f('0xde')]+='x';}if(_0x43af30[_0xaa7f('0xde')][_0xaa7f('0x16c')]('X')<0x0){_0x43af30['opts']+='X';}this[_0xaa7f('0x32')][_0xaa7f('0x98')](_0xaa7f('0x16d'),_0x3eb575?_0x3eb575[_0xaa7f('0x16e')]():'');var _0xba0765=this[_0xaa7f('0x32')]['exec'](_0xaa7f('0x16f'),[_0x3eb575,_0x43af30[_0xaa7f('0xde')],_0x43af30[_0xaa7f('0x60')],_0x2dbf26,_0x43af30['timeout'],_0x43af30[_0xaa7f('0x7')],_0x43af30['macro'],_0x43af30['gosub'],'',_0x43af30[_0xaa7f('0x170')]]);if(_0xba0765[_0xaa7f('0x9d')]===-0x1){return _0xba0765;}return this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x167'),_0xaa7f('0x16f'),_0x3eb575));};AGIVertices[_0xaa7f('0x11')]['record']=function(_0x494f9f){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x494f9f[_0xaa7f('0x34')]));var _0x233e59=_0x494f9f[_0xaa7f('0x171')]||_0xaa7f('0x128');var _0x21a63f=util[_0xaa7f('0x50')](_0xaa7f('0x172'),this[_0xaa7f('0x32')][_0xaa7f('0x33')],rs[_0xaa7f('0x110')](0x5));var _0x2d8375=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x21a63f,_0x233e59);var _0x52d196=util[_0xaa7f('0x50')](_0xaa7f('0x129'),FILES_PATH,_0x21a63f);this[_0xaa7f('0x38')][_0xaa7f('0x6d')](this,_0x494f9f,_0x21a63f,_0x2d8375);this[_0xaa7f('0x32')][_0xaa7f('0x98')](_0xaa7f('0x173'),_0x21a63f);logger[_0xaa7f('0x28')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x52d196,_0x233e59,_0x494f9f['escape_digits'],_0x494f9f[_0xaa7f('0x62')]);return this[_0xaa7f('0x32')]['recordFile'](_0x52d196,_0x233e59,_0x494f9f[_0xaa7f('0x174')],_0x494f9f[_0xaa7f('0x62')],undefined,!![]);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x175')]=function(_0x3406ee){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x176'),_0x3406ee[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x3406ee[_0xaa7f('0x60')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x177'));}var _0x59edd2=this[_0xaa7f('0x178')][_0xaa7f('0x6d')](this,_0x3406ee);logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x179'),util[_0xaa7f('0x17a')](_0x59edd2,{'showHidden':![],'depth':null})));if(!this[_0xaa7f('0x80')](_0x3406ee[_0xaa7f('0xd2')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x253814=this[_0xaa7f('0xe')][_0xaa7f('0x6d')](this,_0x3406ee[_0xaa7f('0xd2')]);if(!_0x253814){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x3406ee,_0xaa7f('0xd3'));}this[_0xaa7f('0x32')][_0xaa7f('0x98')](util[_0xaa7f('0x50')](_0xaa7f('0x17b'),_0x253814),_0x59edd2[_0xaa7f('0x17c')]?_0x59edd2[_0xaa7f('0x17c')]:_0xaa7f('0x17d'));this[_0xaa7f('0x32')][_0xaa7f('0x98')](util[_0xaa7f('0x50')]('%s_STATUS_MESSAGE',_0x253814),_0x59edd2[_0xaa7f('0x17e')]?_0x59edd2[_0xaa7f('0x17e')]:'OK');if(_0x59edd2[_0xaa7f('0x67')]){try{this['saveRestApiResult'](_0x59edd2[_0xaa7f('0x67')],_0x253814);}catch(_0x2dc418){logger[_0xaa7f('0x26')](util[_0xaa7f('0x50')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x253814));}}return this['channel'][_0xaa7f('0xa4')](util['format'](_0xaa7f('0xd7'),_0x253814));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x17f')]=function(_0x3bd297){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x180'),_0x3bd297[_0xaa7f('0x34')]));return this['channel'][_0xaa7f('0x181')](_0x3bd297[_0xaa7f('0x182')][_0xaa7f('0xd1')](/\s+/g,''),_0x3bd297[_0xaa7f('0x174')]);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x183')]=function(_0x356f66){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x184'),_0x356f66['label']));return this[_0xaa7f('0x32')][_0xaa7f('0x185')](_0x356f66[_0xaa7f('0x63')][_0xaa7f('0xd1')](/\s+/g,''),_0x356f66[_0xaa7f('0x174')]);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x186')]=function(_0x236949){logger[_0xaa7f('0x28')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x236949['label']));return this['channel']['sayPhonetic'](_0x236949['text'],_0x236949[_0xaa7f('0x174')]);};AGIVertices['prototype'][_0xaa7f('0x187')]=function(_0xe78fcb){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xe78fcb[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0xe78fcb[_0xaa7f('0x188')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x189'));}var _0x1beca0=this['getMailAccount'][_0xaa7f('0x6d')](this,_0xe78fcb[_0xaa7f('0x188')]);if(!_0x1beca0||!_0x1beca0['Smtp']){return this[_0xaa7f('0x32')]['error'](_0xe78fcb,_0xaa7f('0x18a'));}var _0x46a9a8={'from':util[_0xaa7f('0x50')](_0xaa7f('0x18b'),_0x1beca0[_0xaa7f('0xf')],_0x1beca0[_0xaa7f('0x18c')]||_0x1beca0[_0xaa7f('0x18d')][_0xaa7f('0x18e')]),'to':_0xe78fcb['to']||'','cc':_0xe78fcb['cc']||'','bcc':_0xe78fcb['bcc']||'','subject':_0xe78fcb[_0xaa7f('0x18f')],'html':_0xe78fcb[_0xaa7f('0x57')],'text':_0xe78fcb[_0xaa7f('0x57')]};var _0x9234b={'tls':{'rejectUnauthorized':![]}};if(_0x1beca0['Smtp'][_0xaa7f('0x190')]){_0x9234b['service']=_0x1beca0[_0xaa7f('0x18d')][_0xaa7f('0x190')];}else{_0x9234b[_0xaa7f('0x191')]=_0x1beca0[_0xaa7f('0x18d')]['host'];_0x9234b[_0xaa7f('0x192')]=_0x1beca0['Smtp'][_0xaa7f('0x192')];_0x9234b[_0xaa7f('0x193')]=_0x1beca0[_0xaa7f('0x18d')][_0xaa7f('0x193')];}if(_0x1beca0[_0xaa7f('0x18d')][_0xaa7f('0x194')]){_0x9234b['auth']={'user':_0x1beca0[_0xaa7f('0x18d')][_0xaa7f('0x18e')],'pass':_0x1beca0['Smtp']['pass']};}if(this[_0xaa7f('0x80')](_0xe78fcb[_0xaa7f('0x195')])){}logger[_0xaa7f('0xd9')](_0xaa7f('0x196'),JSON[_0xaa7f('0x6f')](_0x46a9a8));this[_0xaa7f('0xa0')]['sync'](this,_0xe78fcb,_0xe78fcb[_0xaa7f('0x188')]);this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format'](_0xaa7f('0x197'),_0x1beca0[_0xaa7f('0xf')]));this[_0xaa7f('0x1e')][_0xaa7f('0x6d')](this,_0x9234b,_0x46a9a8);return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x198')]=function(_0x18b1bc){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x199'),_0x18b1bc[_0xaa7f('0x34')]));return this['channel'][_0xaa7f('0xa4')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xaa7f('0x11')]['sendSMS']=function(_0xa1eba9){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x19a'),_0xa1eba9['label']));if(!this[_0xaa7f('0x80')](_0xa1eba9[_0xaa7f('0x19b')])){return this[_0xaa7f('0x32')]['noop'](_0xaa7f('0x19c'));}var _0x534836=this[_0xaa7f('0x2f')]['sync'](this,_0xa1eba9['sms_account_id']);if(!_0x534836){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0xa1eba9,_0xaa7f('0x19d'));}var _0x500dab={'body':_0xa1eba9[_0xaa7f('0x19e')],'phone':_0xa1eba9['to']||'','SmsAccountId':_0x534836['id']};logger[_0xaa7f('0xd9')](_0xaa7f('0x19f'),JSON[_0xaa7f('0x6f')](_0x500dab));this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0xa1eba9,_0xa1eba9[_0xaa7f('0x19b')]);this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x534836[_0xaa7f('0xf')]));this[_0xaa7f('0x31')]['sync'](this,_0x500dab);return this['channel'][_0xaa7f('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaa7f('0x11')]['set']=function(_0x46fcad){logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x1a0'),_0x46fcad[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x46fcad[_0xaa7f('0xd2')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x46fcad,_0xaa7f('0x1a1'));}var _0x30c5ed=this['getVariable'][_0xaa7f('0x6d')](this,_0x46fcad[_0xaa7f('0xd2')]);if(!_0x30c5ed){return this[_0xaa7f('0x32')]['error'](_0x46fcad,_0xaa7f('0xd3'));}return this['channel'][_0xaa7f('0x98')](_0x30c5ed,_0x46fcad[_0xaa7f('0x1a2')]);};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1a3')]=function(_0x483a70){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x1a4'),_0x483a70['label']));this['channel'][_0xaa7f('0xa4')](_0xaa7f('0x1a5'));if(_0x483a70[_0xaa7f('0xb1')]===_0xaa7f('0x1a6')){this[_0xaa7f('0x32')]['noop'](_0xaa7f('0x1a7'));return this[_0xaa7f('0x32')][_0xaa7f('0xb1')]();}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](_0xaa7f('0x1a8'));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1a9')]=function(_0x10514d){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x1aa'),_0x10514d['label']));if(!this[_0xaa7f('0x80')](_0x10514d['project_id'])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x10514d,_0xaa7f('0x1ab'));}var _0x858cd=this[_0xaa7f('0x14')][_0xaa7f('0x6d')](this,_0x10514d[_0xaa7f('0x1ac')]);if(!this[_0xaa7f('0x80')](_0x858cd)){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x10514d,util[_0xaa7f('0x50')](_0xaa7f('0x1ad'),_0x10514d[_0xaa7f('0x1ac')]));}if(_0x858cd===this[_0xaa7f('0x32')]['arg_1']){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x10514d,_0xaa7f('0x1ae'));}this[_0xaa7f('0xa0')]['sync'](this,_0x10514d,_0x858cd);var _0x568580=this[_0xaa7f('0x32')]['exec']('AGI',util['format'](_0xaa7f('0x1af'),config[_0xaa7f('0x7')]['host']||_0xaa7f('0x1b0'),_0x858cd,this[_0xaa7f('0x32')][_0xaa7f('0x36')]));if(_0x568580['result']===-0x1){return _0x568580;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')]('Executed\x20command\x20%s\x20%s','AGI',_0x858cd));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1b1')]=function(_0x8b8f64){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x1b2'),_0x8b8f64['label']));var _0x15c953=this['shellCommand'][_0xaa7f('0x6d')](this,_0x8b8f64[_0xaa7f('0x1b3')]);this[_0xaa7f('0xa0')][_0xaa7f('0x6d')](this,_0x8b8f64,_0x8b8f64[_0xaa7f('0x1b3')]);if(this[_0xaa7f('0x80')](_0x8b8f64[_0xaa7f('0xd2')])){var _0x2ef812=this[_0xaa7f('0xe')][_0xaa7f('0x6d')](this,_0x8b8f64['variable_id']);if(_0x2ef812){this[_0xaa7f('0x32')][_0xaa7f('0x98')](_0x2ef812,_0x15c953);return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1b4'),_0x8b8f64[_0xaa7f('0x1b3')],_0x2ef812));}}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1b5'),_0x8b8f64[_0xaa7f('0x1b3')]));};AGIVertices[_0xaa7f('0x11')]['google_cloud_tts']=function(_0x3c5afc){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3c5afc[_0xaa7f('0x34')]));_0x3c5afc[_0xaa7f('0x57')]=_0x3c5afc['text'][_0xaa7f('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3c5afc[_0xaa7f('0x55')])){return this['channel'][_0xaa7f('0xa4')](_0xaa7f('0x1b6'));}if(!this[_0xaa7f('0x80')](_0x3c5afc[_0xaa7f('0x57')])){return this[_0xaa7f('0x32')][_0xaa7f('0xa4')]('no\x20text\x20configured');}this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1b7'),_0x3c5afc[_0xaa7f('0x57')]));var _0xd03a8=this[_0xaa7f('0x54')][_0xaa7f('0x6d')](this,_0x3c5afc);if(_0xd03a8){this['channel'][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1b8'),_0xd03a8));var _0x383c89=this[_0xaa7f('0x32')][_0xaa7f('0xf9')](_0xd03a8);try{fs[_0xaa7f('0xfa')](_0xd03a8+_0xaa7f('0xfb'));}catch(_0x47897d){logger[_0xaa7f('0x26')](_0x47897d);}return _0x383c89;}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x3c5afc,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1b9')]=function(_0x368ec1){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x1ba'),_0x368ec1[_0xaa7f('0x34')]));_0x368ec1['text']=_0x368ec1[_0xaa7f('0x57')][_0xaa7f('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaa7f('0x80')](_0x368ec1['text'])){return this[_0xaa7f('0x32')]['noop']('no\x20text\x20configured');}this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1bb'),_0x368ec1[_0xaa7f('0x57')]));var _0x1ad059=this[_0xaa7f('0x5e')][_0xaa7f('0x6d')](this,_0x368ec1);if(_0x1ad059){this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util[_0xaa7f('0x50')](_0xaa7f('0x1bc'),_0x1ad059));var _0x31a375=this['channel'][_0xaa7f('0xf9')](_0x1ad059);try{fs[_0xaa7f('0xfa')](_0x1ad059+'.wav');}catch(_0x130ae8){logger[_0xaa7f('0x26')](_0x130ae8);}return _0x31a375;}return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x368ec1,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1bd')]=function(_0x3e3a51){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x1be'),_0x3e3a51[_0xaa7f('0x34')]));if(!this['isConfigured'](_0x3e3a51[_0xaa7f('0x14f')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x3e3a51,_0xaa7f('0x150'));}logger[_0xaa7f('0x28')](util['format'](_0xaa7f('0x151'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x3e3a51['findBy']));var _0x4e6483=this[_0xaa7f('0x4c')][_0xaa7f('0x6d')](this,_0x3e3a51[_0xaa7f('0x14f')]);if(_0x4e6483){logger['info'](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x3e3a51[_0xaa7f('0x14f')]));this[_0xaa7f('0x32')]['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x152'),this[_0xaa7f('0x32')][_0xaa7f('0x37')],_0x3e3a51['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this['channel']['callerid'],_0x3e3a51['findBy']));this['channel']['noop'](util[_0xaa7f('0x50')](_0xaa7f('0x154'),this['channel'][_0xaa7f('0x37')],_0x3e3a51['findBy']));return{'code':0xc8,'result':_0xaa7f('0x155')};}};AGIVertices['prototype']['voicemail']=function(_0x27d446){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x27d446[_0xaa7f('0x34')]));var _0x322928=this[_0xaa7f('0x32')]['exec'](_0xaa7f('0x1bf'),[_0x27d446[_0xaa7f('0x1c0')],_0x27d446['options']]);if(_0x322928[_0xaa7f('0x9d')]===-0x1){return _0x322928;}return this[_0xaa7f('0x32')][_0xaa7f('0xa4')](util['format'](_0xaa7f('0x167'),_0xaa7f('0x1bf'),_0x27d446[_0xaa7f('0x1c0')]));};AGIVertices[_0xaa7f('0x11')][_0xaa7f('0x1c1')]=function(_0x5d4c50){logger[_0xaa7f('0x28')](util[_0xaa7f('0x50')](_0xaa7f('0x1c2'),_0x5d4c50[_0xaa7f('0x34')]));if(!this[_0xaa7f('0x80')](_0x5d4c50[_0xaa7f('0xd2')])){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x5d4c50,'no\x20variable\x20selected');}var _0x1874c3=this['getVariable'][_0xaa7f('0x6d')](this,_0x5d4c50[_0xaa7f('0xd2')]);if(!_0x1874c3){return this[_0xaa7f('0x32')][_0xaa7f('0x26')](_0x5d4c50,_0xaa7f('0xd3'));}var _0x112a48=this[_0xaa7f('0x32')]['getVariable'](_0x1874c3);return{'code':0xc8,'result':_0x112a48['extra']?_0x112a48['extra']:'-'};};String[_0xaa7f('0x11')][_0xaa7f('0x9a')]=function(_0x48c9c7,_0x5df109){return this[_0xaa7f('0x99')](_0x48c9c7)[_0xaa7f('0x1c3')](_0x5df109);};module[_0xaa7f('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x1939=['file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','\x22%s\x22\x20<%s>','Smtp','user','bcc','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','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','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','streamFile','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','isPlainObject','format','%s.%s','length','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','sync','retry','label','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','audiofile','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\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block'];(function(_0x3c184d,_0x3015b0){var _0x3f5ff2=function(_0x544854){while(--_0x544854){_0x3c184d['push'](_0x3c184d['shift']());}};_0x3f5ff2(++_0x3015b0);}(_0x1939,0xbf));var _0x9193=function(_0x419bb9,_0x247ffa){_0x419bb9=_0x419bb9-0x0;var _0x594006=_0x1939[_0x419bb9];return _0x594006;};'use strict';var fs=require('fs');var path=require(_0x9193('0x0'));var util=require(_0x9193('0x1'));var _=require(_0x9193('0x2'));var sh=require('shelljs');var odbc=require(_0x9193('0x3'))();var rs=require('randomstring');var moment=require(_0x9193('0x4'));var Mustache=require(_0x9193('0x5'));var rp=require(_0x9193('0x6'));var logger=require(_0x9193('0x7'))(_0x9193('0x8'));var config=require(_0x9193('0x9'));var scripts=require(_0x9193('0xa'));var FILES_PATH=_0x9193('0xb');var recursiveMapAttributes=['rawHeaders',_0x9193('0xc')];var verticesWithRetry=[_0x9193('0xd'),_0x9193('0xe'),'getsecretdigits'];var AGIVertices=function(_0x2acf29,_0x2946d4,_0x426599){this[_0x9193('0xf')]=_0x2acf29;this[_0x9193('0x10')]=_0x2946d4;this['mailRpc']=_0x426599;};AGIVertices[_0x9193('0x11')][_0x9193('0x12')]=function(_0x396334,_0x438b39){this[_0x9193('0x10')][_0x9193('0x13')](_0x396334)['then'](function(_0x587234){_0x438b39(null,_0x587234?_0x587234[_0x9193('0x14')]:![]);})[_0x9193('0x15')](function(_0x22e821){_0x438b39(_0x22e821);});};AGIVertices[_0x9193('0x11')][_0x9193('0x16')]=function(_0x2d6466,_0x400579){this[_0x9193('0x10')][_0x9193('0x17')](_0x2d6466)[_0x9193('0x18')](function(_0x233cb4){_0x400579(null,_0x233cb4?_0x233cb4[_0x9193('0x14')]:![]);})[_0x9193('0x15')](function(_0x2b0ff3){_0x400579(_0x2b0ff3);});};AGIVertices[_0x9193('0x11')][_0x9193('0x19')]=function(_0x23894e,_0x36d911){this[_0x9193('0x10')][_0x9193('0x1a')](_0x23894e)[_0x9193('0x18')](function(_0x49eb4c){_0x36d911(null,_0x49eb4c?_0x49eb4c['name']:![]);})['catch'](function(_0x16d2ef){_0x36d911(_0x16d2ef);});};AGIVertices['prototype'][_0x9193('0x1b')]=function(_0x5389bb,_0x19eaca){this[_0x9193('0x10')]['getSquareOdbcById'](_0x5389bb)[_0x9193('0x18')](function(_0x50782e){_0x19eaca(null,_0x50782e?_0x50782e[_0x9193('0x1c')]:![]);})[_0x9193('0x15')](function(_0x1505c0){_0x19eaca(_0x1505c0);});};AGIVertices['prototype'][_0x9193('0x1d')]=function(_0x4f0942,_0x1ca240){this['rpc'][_0x9193('0x1e')](_0x4f0942)[_0x9193('0x18')](function(_0x21bacc){_0x1ca240(null,_0x21bacc?_0x21bacc[_0x9193('0x14')]:![]);})[_0x9193('0x15')](function(_0x4d0771){_0x1ca240(_0x4d0771);});};AGIVertices[_0x9193('0x11')][_0x9193('0x1f')]=function(_0x5a044b,_0x520752){this[_0x9193('0x10')]['getTrunkById'](_0x5a044b)['then'](function(_0x5d71a8){_0x520752(null,_0x5d71a8?_0x5d71a8[_0x9193('0x14')]:![]);})[_0x9193('0x15')](function(_0x6d2cb2){_0x520752(_0x6d2cb2);});};AGIVertices[_0x9193('0x11')][_0x9193('0x20')]=function(_0x4eb448,_0x45f288){var _0x309904=this;this[_0x9193('0x10')]['getSoundById'](_0x4eb448)[_0x9193('0x18')](function(_0x309441){_0x45f288(null,_0x309441?_0x309904[_0x9193('0x21')](_0x309441[_0x9193('0x22')]):![]);})[_0x9193('0x15')](function(_0x173ca5){_0x45f288(_0x173ca5);});};AGIVertices['prototype'][_0x9193('0x23')]=function(_0x230dce,_0x3c7538){this['rpc'][_0x9193('0x24')](_0x230dce)[_0x9193('0x18')](function(_0x3dfe69){_0x3c7538(null,_0x3dfe69?_0x3dfe69:![]);})[_0x9193('0x15')](function(_0x11ac6a){_0x3c7538(_0x11ac6a);});};AGIVertices[_0x9193('0x11')][_0x9193('0x25')]=function(_0x35546d,_0x147076,_0x54cd39){this[_0x9193('0x26')][_0x9193('0x25')](_0x35546d,_0x147076)[_0x9193('0x18')](function(){_0x54cd39(null);})[_0x9193('0x15')](function(_0x14aff9){_0x54cd39(_0x14aff9);});};AGIVertices[_0x9193('0x11')][_0x9193('0x27')]=function(_0x244a23,_0x19025a){this[_0x9193('0x10')][_0x9193('0x28')](_0x244a23)[_0x9193('0x18')](function(_0x1729c2){if(_0x1729c2){if(_0x1729c2['IntervalId']){_0x19025a(null,[_0x1729c2['interval']]);}else{_0x19025a(null,_[_0x9193('0x29')](_0x1729c2[_0x9193('0x2a')],'interval'));}}else{_0x19025a(null,![]);}})[_0x9193('0x15')](function(_0x4e35d3){_0x19025a(_0x4e35d3);});};AGIVertices[_0x9193('0x11')][_0x9193('0x21')]=function(_0x1ee13f){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x1ee13f);};AGIVertices[_0x9193('0x11')][_0x9193('0x2b')]=function(_0x107bf0,_0x26f2bc,_0x345c92){odbc[_0x9193('0x2c')](_0x107bf0,function(_0x40560e){if(_0x40560e){logger[_0x9193('0x2d')](_0x9193('0x2e'),_0x40560e);_0x345c92(_0x40560e);}else{logger[_0x9193('0x2f')](_0x9193('0x30'));odbc['query'](_0x26f2bc,function(_0x5d9b2f,_0x21ab9e){if(_0x5d9b2f){logger[_0x9193('0x2f')](_0x9193('0x31'),_0x26f2bc);_0x345c92(_0x5d9b2f);}else{logger[_0x9193('0x2f')](_0x9193('0x32'),_0x26f2bc);odbc['close'](function(_0x38ed91){if(_0x38ed91){logger['error'](_0x9193('0x33'),_0x38ed91);}_0x345c92(null,_0x21ab9e);});}});}});};AGIVertices['prototype'][_0x9193('0x34')]=function(_0x4e790f,_0x8a9641){this['rpc'][_0x9193('0x35')](_0x4e790f)[_0x9193('0x18')](function(_0x263ff8){_0x8a9641(null,_0x263ff8?_0x263ff8:![]);})[_0x9193('0x15')](function(_0x11b9ef){_0x8a9641(_0x11b9ef);});};AGIVertices[_0x9193('0x11')][_0x9193('0x36')]=function(_0x1e3723,_0x56713){this[_0x9193('0x10')][_0x9193('0x36')](_0x1e3723)[_0x9193('0x18')](function(_0x5b9be2){_0x56713(null,_0x5b9be2);})[_0x9193('0x15')](function(_0x44c1e0){_0x56713(_0x44c1e0);});};AGIVertices[_0x9193('0x11')][_0x9193('0x37')]=function(_0x29e812,_0x25c317,_0x4567ab){this[_0x9193('0x10')][_0x9193('0x37')]({'uniqueid':this[_0x9193('0xf')][_0x9193('0x38')],'node':_0x29e812['label'],'application':_0x29e812[_0x9193('0x39')],'data':_0x25c317||null,'project_name':this['channel'][_0x9193('0x3a')],'callerid':this[_0x9193('0xf')][_0x9193('0x3b')]})[_0x9193('0x18')](function(_0x3e3eb8){if(_0x4567ab){_0x4567ab(null,_0x3e3eb8);}})[_0x9193('0x15')](function(_0x2db0de){if(_0x4567ab){_0x4567ab(_0x2db0de);}});};AGIVertices[_0x9193('0x11')][_0x9193('0x3c')]=function(_0xb116e2,_0x4bc2e6,_0x47cdd3,_0x2b1e97){this[_0x9193('0x10')]['createSquareRecording']({'uniqueid':this[_0x9193('0xf')]['uniqueid'],'callerid':this[_0x9193('0xf')][_0x9193('0x3b')],'calleridname':this[_0x9193('0xf')]['calleridname'],'context':this[_0x9193('0xf')][_0x9193('0x3d')],'extension':this['channel'][_0x9193('0x3e')],'priority':this[_0x9193('0xf')]['priority'],'accountcode':this[_0x9193('0xf')]['accountcode'],'dnid':this[_0x9193('0xf')][_0x9193('0x3f')],'projectName':this[_0x9193('0xf')][_0x9193('0x3a')],'saveName':_0x4bc2e6,'filename':_0xb116e2[_0x9193('0x40')]||_0x4bc2e6,'savePath':_0x47cdd3})[_0x9193('0x18')](function(_0xc3ab77){_0x2b1e97(null,_0xc3ab77);})[_0x9193('0x15')](function(_0x13820b){_0x2b1e97(_0x13820b);});};AGIVertices['prototype'][_0x9193('0x41')]=function(_0x154706,_0x1d5082,_0x1e8f7f,_0x3f57ac,_0x1ee811){this[_0x9193('0x10')][_0x9193('0x41')]({'uniqueid':this[_0x9193('0xf')][_0x9193('0x38')],'body':_0x154706,'direction':_0x1d5082,'providerName':_0x1e8f7f,'providerResponse':_0x3f57ac})[_0x9193('0x18')](function(_0x4809af){if(_0x1ee811){_0x1ee811(null,_0x4809af);}})[_0x9193('0x15')](function(_0x438832){if(_0x1ee811){_0x1ee811(_0x438832);}});};AGIVertices[_0x9193('0x11')][_0x9193('0x42')]=function(_0x2be403,_0x1659ba){this[_0x9193('0x10')][_0x9193('0x42')]({'firstName':_[_0x9193('0x43')](_0x2be403['name'])||_[_0x9193('0x44')](_0x2be403[_0x9193('0x14')])?_0x9193('0x45')+Math[_0x9193('0x46')]():_0x2be403[_0x9193('0x14')],'lastName':_[_0x9193('0x43')](_0x2be403[_0x9193('0x47')])||_[_0x9193('0x44')](_0x2be403[_0x9193('0x47')])?null:_0x2be403[_0x9193('0x47')],'phone':_0x2be403['phone'],'ListId':_0x2be403[_0x9193('0x48')],'scheduledat':_0x2be403[_0x9193('0x49')],'callbackUniqueid':this[_0x9193('0xf')][_0x9193('0x38')],'tags':'callback','description':_0x9193('0x4a')+_0x2be403['scheduledAt'][_0x9193('0x4b')](),'priority':_0x2be403['callback_priority']})[_0x9193('0x18')](function(_0x5314f0){_0x1659ba(null,_0x5314f0);})[_0x9193('0x15')](function(_0x2b1544){_0x1659ba(_0x2b1544);});};AGIVertices[_0x9193('0x11')]['getPause']=function(_0xd356b0,_0x1840eb){this[_0x9193('0x10')][_0x9193('0x4c')](_0xd356b0)[_0x9193('0x18')](function(_0x337306){_0x1840eb(null,_0x337306?_0x337306[_0x9193('0x14')]:![]);})[_0x9193('0x15')](function(_0x504ac8){_0x1840eb(_0x504ac8);});};AGIVertices[_0x9193('0x11')]['agentPause']=function(_0x53f04e,_0xc67583,_0x76ad8b){var _0x414180={'role':_0x9193('0x4d')};_0x414180[_0x53f04e]=this[_0x9193('0xf')][_0x9193('0x3b')];this['rpc'][_0x9193('0x4e')](_0x414180,_0xc67583,this['channel'][_0x9193('0x38')])[_0x9193('0x18')](function(_0x5c0502){_0x76ad8b(null,_[_0x9193('0x44')](_0x5c0502)?![]:!![]);})[_0x9193('0x15')](function(_0x1d50de){logger[_0x9193('0x2d')](_0x1d50de);_0x76ad8b(null,![]);});};AGIVertices[_0x9193('0x11')][_0x9193('0x4f')]=function(_0x2e5e6a,_0x4d9e72){var _0x3d592a={'role':_0x9193('0x4d')};_0x3d592a[_0x2e5e6a]=this[_0x9193('0xf')]['callerid'];this[_0x9193('0x10')][_0x9193('0x4f')](_0x3d592a)[_0x9193('0x18')](function(_0x2ac8cc){_0x4d9e72(null,_['isNil'](_0x2ac8cc)?![]:!![]);})[_0x9193('0x15')](function(_0xb7fadf){logger[_0x9193('0x2d')](_0xb7fadf);_0x4d9e72(null,![]);});};AGIVertices[_0x9193('0x11')][_0x9193('0x50')]=function(_0x46d883,_0x5e898f){var _0x18c3f2={'role':_0x9193('0x4d')};_0x18c3f2[_0x46d883]=this[_0x9193('0xf')][_0x9193('0x3b')];this['rpc'][_0x9193('0x50')](_0x18c3f2)[_0x9193('0x18')](function(_0x575cd0){_0x5e898f(null,_[_0x9193('0x44')](_0x575cd0)?![]:!![]);})['catch'](function(_0x34cd66){logger[_0x9193('0x2d')](_0x34cd66);_0x5e898f(null,![]);});};AGIVertices[_0x9193('0x11')][_0x9193('0x51')]=function(_0x25f3e5,_0x5d402e){var _0x4e8914={'role':_0x9193('0x4d')};_0x4e8914[_0x25f3e5]=this['channel']['callerid'];var _0x12962b=_0x25f3e5!='internal'?util['format'](_0x9193('0x52'),'LOCAL',this[_0x9193('0xf')]['callerid']):undefined;this[_0x9193('0x10')]['agentLogin'](_0x4e8914,_0x12962b)[_0x9193('0x18')](function(_0x7cc825){_0x5d402e(null,_[_0x9193('0x44')](_0x7cc825)?![]:!![]);})['catch'](function(_0x3bd9e4){logger['error'](_0x3bd9e4);_0x5d402e(null,![]);});};AGIVertices[_0x9193('0x11')][_0x9193('0x53')]=function(_0x3deb00,_0x22423e){sh[_0x9193('0x54')](_[_0x9193('0x55')](_0x3deb00),function(_0x545304,_0x51b4b7){var _0x484dec=_0x51b4b7[_0x9193('0x56')](/(\r\n|\n|\r)/gm,'');_0x22423e(null,_0x484dec);});};AGIVertices[_0x9193('0x11')][_0x9193('0x57')]=function(_0x195748,_0x41d262){scripts[_0x9193('0x57')](_0x195748[_0x9193('0x58')],_0x195748[_0x9193('0x59')]||'text',_0x195748[_0x9193('0x5a')],_0x195748[_0x9193('0x5b')]||_0x9193('0x5c'),_0x195748[_0x9193('0x5d')]||_0x9193('0x5e'),_0x195748[_0x9193('0x5f')]||_0x9193('0x60'))[_0x9193('0x18')](function(_0x108bc4){_0x41d262(null,_0x108bc4);})['catch'](function(_0xffc95e){_0x41d262(_0xffc95e);});};AGIVertices[_0x9193('0x11')]['googleTTS']=function(_0x59575e,_0x5ab296){scripts[_0x9193('0x61')](_0x59575e['text'],_0x59575e['google_tts_language']||'en',0x1)[_0x9193('0x18')](function(_0x5b2615){_0x5ab296(null,_0x5b2615);})[_0x9193('0x15')](function(_0x5840e2){_0x5ab296(_0x5840e2);});};AGIVertices['prototype'][_0x9193('0x62')]=function(_0x413cc9,_0x589811){var _0x3729a6={'uri':_0x413cc9[_0x9193('0x63')],'method':_0x413cc9[_0x9193('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x413cc9[_0x9193('0x65')])===_0x9193('0x66')&&parseInt(_0x413cc9['timeout'])>=0x1?parseInt(_0x413cc9[_0x9193('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9193('0x67'),_0x9193('0x68')],_0x3729a6['method'][_0x9193('0x69')]())){try{_0x3729a6[_0x9193('0x6a')]=_0x413cc9['rawBody']?JSON[_0x9193('0x6b')](_0x413cc9[_0x9193('0xc')]):{};}catch(_0x4e07bd){logger['error'](_0x9193('0x6c'),_0x4e07bd);}}try{_0x3729a6[_0x9193('0x6d')]=_0x413cc9['rawHeaders']?JSON[_0x9193('0x6b')](_0x413cc9[_0x9193('0x6e')]):{};}catch(_0x45090d){logger[_0x9193('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x45090d);}if(_0x413cc9[_0x9193('0x6f')]){try{var _0x4f18e2=require(_0x413cc9[_0x9193('0x6f')])['sync'](this,_0x3729a6);_0x3729a6['uri']=Mustache['render'](_0x413cc9['url'],_0x4f18e2,{},['$$','$$']);if(_0x3729a6[_0x9193('0x6d')]){_0x3729a6[_0x9193('0x6d')]=JSON[_0x9193('0x6b')](Mustache[_0x9193('0x70')](JSON['stringify'](_0x3729a6[_0x9193('0x6d')]),_0x4f18e2,{},['$$','$$']));}if(_0x3729a6[_0x9193('0x6a')]){_0x3729a6['body']=JSON[_0x9193('0x6b')](Mustache[_0x9193('0x70')](JSON[_0x9193('0x71')](_0x3729a6[_0x9193('0x6a')]),_0x4f18e2,{},['$$','$$']));}}catch(_0x203e56){logger[_0x9193('0x2d')](_0x9193('0x72'),_0x203e56);}}rp(_0x3729a6)[_0x9193('0x18')](function(_0x2b8ea9){var _0x516de0={'statusCode':_0x2b8ea9[_0x9193('0x73')]||0xc8,'statusMessage':_0x2b8ea9[_0x9193('0x74')]||'OK','headers':_0x2b8ea9[_0x9193('0x6d')]||{},'body':_0x2b8ea9[_0x9193('0x6a')]||{}};_0x589811(null,_0x516de0);})[_0x9193('0x15')](function(_0xde678b){var _0x56a0d3={'statusCode':_0xde678b['statusCode']||0x1f4,'statusMessage':_0xde678b[_0x9193('0x75')]||_0x9193('0x76'),'headers':_0xde678b[_0x9193('0x77')][_0x9193('0x6d')]||{},'body':_0xde678b['options']['body']||{}};_0x589811(null,_0x56a0d3);});};AGIVertices[_0x9193('0x11')][_0x9193('0x78')]=function(_0x5b5e86,_0x43f645){scripts[_0x9193('0x78')](this['channel'][_0x9193('0x38')],_0x5b5e86[_0x9193('0x79')],_0x5b5e86['text'],_0x5b5e86[_0x9193('0x7a')]||'en')[_0x9193('0x18')](function(_0x368364){_0x43f645(null,_0x368364);})[_0x9193('0x15')](function(_0x41768b){_0x43f645(_0x41768b);});};AGIVertices['prototype'][_0x9193('0x7b')]=function(_0x304886,_0x20a48d){scripts[_0x9193('0x7b')](this[_0x9193('0xf')][_0x9193('0x38')],_0x304886[_0x9193('0x7c')],_0x304886['client_email'],_0x304886[_0x9193('0x7d')],_0x304886[_0x9193('0x5a')],_0x304886[_0x9193('0x7e')]||'en')[_0x9193('0x18')](function(_0x2f7656){_0x20a48d(null,_0x2f7656);})['catch'](function(_0x12fcc6){_0x20a48d(_0x12fcc6);});};AGIVertices[_0x9193('0x11')][_0x9193('0x7f')]=function(_0x403836,_0x470d1d){scripts[_0x9193('0x7f')](this[_0x9193('0xf')],_0x403836)[_0x9193('0x18')](function(_0x213deb){_0x470d1d(null,_0x213deb);})[_0x9193('0x15')](function(_0x255e25){_0x470d1d(_0x255e25);});};AGIVertices['prototype'][_0x9193('0x80')]=function(_0x4782ec,_0x449785){scripts['ispeechTTS'](_0x4782ec[_0x9193('0x79')],_0x4782ec['text'],_0x4782ec['ispeech_tts_language']||_0x9193('0x5c'),_0x4782ec[_0x9193('0x81')])[_0x9193('0x18')](function(_0x146211){_0x449785(null,_0x146211);})['catch'](function(_0x27992a){_0x449785(_0x27992a);});};AGIVertices[_0x9193('0x11')][_0x9193('0x82')]=function(_0x470bc9,_0x2b492d,_0x1ea9f6){scripts[_0x9193('0x82')](_0x2b492d,_0x470bc9[_0x9193('0x79')],_0x470bc9[_0x9193('0x83')]||_0x9193('0x5c'),this[_0x9193('0x84')](_0x470bc9['model'])?_0x470bc9[_0x9193('0x85')]:undefined)[_0x9193('0x18')](function(_0x318b30){_0x1ea9f6(null,_0x318b30);})['catch'](function(_0x4118c9){_0x1ea9f6(_0x4118c9);});};AGIVertices[_0x9193('0x11')][_0x9193('0x86')]=function(_0x2facc0,_0x4a2057){scripts['awsPolly'](_0x2facc0[_0x9193('0x87')],_0x2facc0[_0x9193('0x88')],_0x2facc0['aws_polly_region'],_0x2facc0[_0x9193('0x89')]||'Amy',_0x2facc0['text'],_0x2facc0[_0x9193('0x8a')]||'text')[_0x9193('0x18')](function(_0x560500){_0x4a2057(null,_0x560500);})[_0x9193('0x15')](function(_0x21094e){_0x4a2057(_0x21094e);});};AGIVertices['prototype'][_0x9193('0x8b')]=function(_0x2fcbe9,_0x4de3ff){scripts[_0x9193('0x8b')](this['channel'][_0x9193('0x38')],_0x2fcbe9[_0x9193('0x87')],_0x2fcbe9[_0x9193('0x88')],_0x2fcbe9[_0x9193('0x8c')],_0x2fcbe9[_0x9193('0x5a')],_0x2fcbe9['aws_bot_name'])[_0x9193('0x18')](function(_0x56693c){_0x4de3ff(null,_0x56693c);})[_0x9193('0x15')](function(_0x3ba7bd){_0x4de3ff(_0x3ba7bd);});};AGIVertices[_0x9193('0x11')]['googleASR']=function(_0x546afa,_0x5084d1,_0x1ce8a5){scripts[_0x9193('0x8d')](_0x5084d1,_0x546afa[_0x9193('0x79')],_0x546afa[_0x9193('0x8e')]||'en-US')[_0x9193('0x18')](function(_0x114e6b){_0x1ce8a5(null,_0x114e6b);})['catch'](function(_0x12b6ec){_0x1ce8a5(_0x12b6ec);});};AGIVertices['prototype'][_0x9193('0x8f')]=function(_0x47e1a2,_0x405aff,_0x50b984){scripts[_0x9193('0x8f')](_0x405aff,_0x47e1a2[_0x9193('0x90')],_0x47e1a2[_0x9193('0x91')],_0x47e1a2[_0x9193('0x92')])[_0x9193('0x18')](function(_0x108a02){_0x50b984(null,_0x108a02);})[_0x9193('0x15')](function(_0x46a5cb){_0x50b984(_0x46a5cb);});};AGIVertices[_0x9193('0x11')][_0x9193('0x93')]=function(_0x114700){var _0x4dec1a=_[_0x9193('0x94')](verticesWithRetry,_0x114700[_0x9193('0x39')])?_0x114700:_['clone'](_0x114700);for(var _0x319844 in _0x4dec1a){if(_0x4dec1a[_0x9193('0x95')](_0x319844)){if(_0x4dec1a[_0x319844]&&_[_0x9193('0x96')](_0x4dec1a[_0x319844])){if(_[_0x9193('0x94')](recursiveMapAttributes,_0x319844)){_0x4dec1a[_0x319844]=this[_0x9193('0x97')](_0x4dec1a[_0x319844]);}else{_0x4dec1a[_0x319844]=this[_0x9193('0x98')](_0x4dec1a[_0x319844]);}}}}return _0x4dec1a;};AGIVertices[_0x9193('0x11')][_0x9193('0x99')]=function(_0x839ed3){for(var _0x1f2210 in _0x839ed3){if(_0x839ed3[_0x9193('0x95')](_0x1f2210)){if(_['isPlainObject'](_0x839ed3[_0x1f2210])){this[_0x9193('0x99')](_0x839ed3[_0x1f2210]);}else if(_[_0x9193('0x9a')](_0x839ed3[_0x1f2210])){for(var _0x4df970=0x0;_0x4df970<_0x839ed3[_0x1f2210]['length'];_0x4df970++){this[_0x9193('0x99')](_0x839ed3[_0x1f2210][_0x4df970]);}}else if(_[_0x9193('0x96')](_0x839ed3[_0x1f2210])){_0x839ed3[_0x1f2210]=this['replaceAllVariables'](_0x839ed3[_0x1f2210]);}}}};AGIVertices[_0x9193('0x11')][_0x9193('0x9b')]=function(_0x5b4a19,_0x579856){for(var _0x215574 in _0x5b4a19){if(_0x5b4a19['hasOwnProperty'](_0x215574)){if(_[_0x9193('0x9c')](_0x5b4a19[_0x215574])){if(!_[_0x9193('0x43')](_0x5b4a19[_0x215574])){this['saveRestApiResult'](_0x5b4a19[_0x215574],util[_0x9193('0x9d')](_0x9193('0x9e'),_0x579856,_0x215574));}}else if(_[_0x9193('0x9a')](_0x5b4a19[_0x215574])){for(var _0x521777=0x0;_0x521777<_0x5b4a19[_0x215574][_0x9193('0x9f')];_0x521777++){this['saveRestApiResult'](_0x5b4a19[_0x215574][_0x521777],util['format'](_0x9193('0x9e'),_0x579856,_0x215574+'['+_0x521777+']'));}}else{if(!_['isNil'](_0x5b4a19[_0x215574])){this[_0x9193('0xf')][_0x9193('0xa0')](util['format'](_0x9193('0x9e'),_0x579856,_0x215574),_0x5b4a19[_0x215574]);}}}}};AGIVertices[_0x9193('0x11')][_0x9193('0x97')]=function(_0xa215ec){try{var _0x5d41f4=JSON[_0x9193('0x6b')](_0xa215ec);this[_0x9193('0x99')](_0x5d41f4);return JSON['stringify'](_0x5d41f4);}catch(_0x10958d){return this[_0x9193('0x98')](_0xa215ec);}};AGIVertices[_0x9193('0x11')][_0x9193('0x98')]=function(_0x3ab3c2){var _0x25b89b=_0x3ab3c2['split']('{');for(var _0x21eebc=0x1;_0x21eebc<_0x25b89b['length'];_0x21eebc+=0x1){var _0x37960c=_0x25b89b[_0x21eebc][_0x9193('0xa1')]('}');if(_0x37960c['length']>0x1){_0x3ab3c2=_0x3ab3c2[_0x9193('0xa2')]('{'+_0x37960c[0x0]+'}',this[_0x9193('0xf')][_0x9193('0x12')](_0x37960c[0x0])['extra']||_0x37960c[0x0]);}}if(_0x25b89b[_0x9193('0x9f')]===0x1){return _0x3ab3c2['toString']();}return this['replaceAllVariables'](_0x3ab3c2);};AGIVertices[_0x9193('0x11')][_0x9193('0xa3')]=function(_0x394cec,_0x1f130c){var _0xe67e2b=this[_0x9193('0xf')][_0x9193('0x12')](_0x394cec);if(_0xe67e2b[_0x9193('0xa4')]===-0x1){return _0xe67e2b;}logger[_0x9193('0x2f')](util['format'](_0x9193('0xa5'),_0x1f130c,_0xe67e2b[_0x9193('0xa6')]));return this[_0x9193('0xf')]['setVariable'](_0x1f130c,_0xe67e2b[_0x9193('0xa6')]);};AGIVertices['prototype'][_0x9193('0x84')]=function(_0x244c84){return _0x244c84&&_0x244c84!=='0'&&_0x244c84!=='-1'&&_0x244c84!=='';};AGIVertices[_0x9193('0x11')][_0x9193('0xa7')]=function(_0x294270){this['createSquareDetailsReport'][_0x9193('0xa8')](this,_0x294270,'-');_0x294270[_0x9193('0xa9')]=_0x294270[_0x9193('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9193('0x11')]['mrcpsynth']=function(_0x444e65){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x444e65[_0x9193('0xaa')]));if(!this['isConfigured'](_0x444e65['text'])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xac'));}var _0x1559c8='\x22'+_0x444e65[_0x9193('0x5a')]+'\x22';if(this['isConfigured'](_0x444e65[_0x9193('0x77')])){_0x1559c8+=','+_0x444e65[_0x9193('0x77')];}var _0x245d08=this['channel'][_0x9193('0x54')]('MRCPSynth',_0x1559c8);if(_0x245d08[_0x9193('0xa4')]===-0x1){return _0x245d08;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xad'),_0x1559c8));};AGIVertices['prototype'][_0x9193('0xae')]=function(_0x54cfdc){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0xaf'),_0x54cfdc[_0x9193('0xaa')]));if(!this['isConfigured'](_0x54cfdc[_0x9193('0xb0')])){return this['channel'][_0x9193('0xab')]('no\x20grammar\x20configured');}var _0x33ccfa=_0x54cfdc[_0x9193('0xb0')];if(this['isConfigured'](_0x54cfdc[_0x9193('0x77')])){_0x33ccfa+=','+_0x54cfdc[_0x9193('0x77')];}var _0x4ce6e3=this[_0x9193('0xf')][_0x9193('0x54')]('MRCPRecog',_0x33ccfa);if(_0x4ce6e3[_0x9193('0xa4')]===-0x1){return _0x4ce6e3;}var _0x1c7dbc=this[_0x9193('0xa3')](_0x9193('0xb1'),_0x9193('0xb2'));if(_0x1c7dbc[_0x9193('0xa4')]===-0x1){return _0x1c7dbc;}var _0x156296=this['getAndSetVariable'](_0x9193('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x156296[_0x9193('0xa4')]===-0x1){return _0x156296;}var _0x240bc0=this[_0x9193('0xa3')](_0x9193('0xb4'),_0x9193('0xb5'));if(_0x240bc0['result']===-0x1){return _0x240bc0;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xb6'),_0x33ccfa));};AGIVertices[_0x9193('0x11')]['agi']=function(_0x203cd7){logger[_0x9193('0x2f')](util['format'](_0x9193('0xb7'),_0x203cd7[_0x9193('0xaa')]));return this['channel'][_0x9193('0x8')]([_0x203cd7[_0x9193('0xb8')],_0x203cd7[_0x9193('0xb9')]]);};AGIVertices[_0x9193('0x11')][_0x9193('0xba')]=function(_0xcf8207){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0xbb'),_0xcf8207[_0x9193('0xaa')]));if(this[_0x9193('0x84')](_0xcf8207['timeout'])){logger['info'](util['format'](_0x9193('0xbc'),_0xcf8207[_0x9193('0x65')]));var _0x450270=this[_0x9193('0xf')][_0x9193('0xbd')](_0xcf8207[_0x9193('0x65')]);if(_0x450270[_0x9193('0xa4')]===-0x1){return _0x450270;}}return this[_0x9193('0xf')][_0x9193('0xba')]();};AGIVertices[_0x9193('0x11')][_0x9193('0xbe')]=function(_0x3f4d44){logger[_0x9193('0x2f')](util['format'](_0x9193('0xbf'),_0x3f4d44['label']));if(!this[_0x9193('0x84')](_0x3f4d44[_0x9193('0x48')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3f4d44,_0x9193('0xc0'));}_0x3f4d44[_0x9193('0x49')]=moment();if(this[_0x9193('0x84')](_0x3f4d44['delay'])){_0x3f4d44[_0x9193('0x49')]=moment()[_0x9193('0xc1')](_0x3f4d44[_0x9193('0xc2')],_0x9193('0xc3'));}if(!this[_0x9193('0x84')](_0x3f4d44[_0x9193('0xc4')])){_0x3f4d44[_0x9193('0xc4')]=0x2;}this[_0x9193('0x42')][_0x9193('0xa8')](this,_0x3f4d44);return this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0xc5'),_0x3f4d44[_0x9193('0xc6')],_0x3f4d44[_0x9193('0x48')],_0x3f4d44[_0x9193('0x49')]));};AGIVertices[_0x9193('0x11')][_0x9193('0xc7')]=function(_0x8dd568){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x8dd568[_0x9193('0xaa')]));var _0x2bce08=this[_0x9193('0xf')][_0x9193('0x54')](_0x8dd568[_0x9193('0xc8')],_0x8dd568[_0x9193('0x77')]);if(_0x2bce08[_0x9193('0xa4')]===-0x1){return _0x2bce08;}return this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0xc9'),_0x8dd568[_0x9193('0xc8')],_0x8dd568[_0x9193('0x77')]));};AGIVertices[_0x9193('0x11')][_0x9193('0xca')]=function(_0x3e3a11){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0xcb'),_0x3e3a11['label']));if(!this[_0x9193('0x84')](_0x3e3a11[_0x9193('0x5a')])){return this[_0x9193('0xf')]['noop'](_0x9193('0xac'));}var _0x218223='\x22'+_0x3e3a11['text']+'\x22';if(this[_0x9193('0x84')](_0x3e3a11[_0x9193('0x77')])){_0x218223+=','+_0x3e3a11[_0x9193('0x77')];}var _0xbd9b85=this[_0x9193('0xf')]['exec']('MRCPSynth',_0x218223);if(_0xbd9b85[_0x9193('0xa4')]===-0x1){return _0xbd9b85;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xad'),_0x218223));};AGIVertices[_0x9193('0x11')][_0x9193('0xcc')]=function(_0x788f9f){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0xcd'),_0x788f9f[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x788f9f[_0x9193('0x5a')])){return this[_0x9193('0xf')]['noop'](_0x9193('0xac'));}var _0x287559='\x22'+_0x788f9f['text']+'\x22';if(this['isConfigured'](_0x788f9f[_0x9193('0x77')])){_0x287559+=','+_0x788f9f[_0x9193('0x77')];}var _0xfab8a5=this[_0x9193('0xf')][_0x9193('0x54')](_0x9193('0xce'),_0x287559);if(_0xfab8a5['result']===-0x1){return _0xfab8a5;}return this[_0x9193('0xf')]['noop'](util[_0x9193('0x9d')](_0x9193('0xad'),_0x287559));};AGIVertices[_0x9193('0x11')][_0x9193('0xcf')]=function(_0x40d184){logger['info'](util[_0x9193('0x9d')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x40d184[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x40d184[_0x9193('0xb0')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xd0'));}var _0x542892=_0x40d184['grammar'];if(this[_0x9193('0x84')](_0x40d184[_0x9193('0x77')])){_0x542892+=','+_0x40d184[_0x9193('0x77')];}var _0x520830=this[_0x9193('0xf')][_0x9193('0x54')](_0x9193('0xd1'),_0x542892);if(_0x520830[_0x9193('0xa4')]===-0x1){return _0x520830;}var _0x2d777f=this[_0x9193('0xa3')](_0x9193('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2d777f[_0x9193('0xa4')]===-0x1){return _0x2d777f;}var _0x22e439=this[_0x9193('0xa3')]('RECOG_INPUT()',_0x9193('0xd2'));if(_0x22e439[_0x9193('0xa4')]===-0x1){return _0x22e439;}var _0x4e9fdc=this[_0x9193('0xa3')](_0x9193('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x4e9fdc[_0x9193('0xa4')]===-0x1){return _0x4e9fdc;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xb6'),_0x542892));};AGIVertices['prototype'][_0x9193('0xd3')]=function(_0x74b855){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0xd4'),_0x74b855[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x74b855['grammar'])){return this[_0x9193('0xf')]['noop'](_0x9193('0xd0'));}var _0x39b8c8=_0x74b855['grammar'];if(this['isConfigured'](_0x74b855[_0x9193('0x77')])){_0x39b8c8+=','+_0x74b855[_0x9193('0x77')];}var _0x3cf13b=this[_0x9193('0xf')]['exec'](_0x9193('0xd1'),_0x39b8c8);if(_0x3cf13b['result']===-0x1){return _0x3cf13b;}var _0x44a172=this[_0x9193('0xa3')](_0x9193('0xb1'),'SESTEK_ASR_CONFIDENCE');if(_0x44a172['result']===-0x1){return _0x44a172;}var _0x2c8007=this[_0x9193('0xa3')](_0x9193('0xb3'),_0x9193('0xd5'));if(_0x2c8007[_0x9193('0xa4')]===-0x1){return _0x2c8007;}var _0x32e7f3=this[_0x9193('0xa3')]('RECOG_INSTANCE()',_0x9193('0xd6'));if(_0x32e7f3[_0x9193('0xa4')]===-0x1){return _0x32e7f3;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xb6'),_0x39b8c8));};AGIVertices[_0x9193('0x11')][_0x9193('0xd7')]=function(_0x3f62eb){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3f62eb[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x3f62eb[_0x9193('0xd8')])){return this['channel'][_0x9193('0x2d')](_0x3f62eb,'no\x20database\x20selected');}var _0x56e3ae=this[_0x9193('0x1b')][_0x9193('0xa8')](this,_0x3f62eb[_0x9193('0xd8')]);if(!_0x56e3ae){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3f62eb,_0x9193('0xd9'));}if(!this[_0x9193('0x84')](_0x3f62eb['query'])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3f62eb,_0x9193('0xda'));}var _0x15c1e0=_0x3f62eb[_0x9193('0xdb')][_0x9193('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0xdc'),_0x15c1e0));var _0x3d47ba=this['getQueryOdbc'][_0x9193('0xa8')](this,_0x56e3ae,_0x15c1e0);this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x3f62eb,_0x15c1e0);if(!this[_0x9193('0x84')](_0x3f62eb['variable_id'])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1f9cf3=this[_0x9193('0x12')][_0x9193('0xa8')](this,_0x3f62eb[_0x9193('0xdd')]);if(!_0x1f9cf3){return this['channel'][_0x9193('0x2d')](_0x3f62eb,_0x9193('0xde'));}var _0x326c5a=this;_0x3d47ba[_0x9193('0xdf')](function(_0xbddaae,_0x5570e2){Object[_0x9193('0xe0')](_0xbddaae)[_0x9193('0xdf')](function(_0x52fe55){_0x326c5a[_0x9193('0xf')][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0xe1'),_0x1f9cf3,_0x5570e2,_0x52fe55),_0xbddaae[_0x52fe55]);});});this[_0x9193('0xf')]['setVariable'](util[_0x9193('0x9d')](_0x9193('0xe2'),_0x1f9cf3),_0x3d47ba['length']);return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('variable\x20%s\x20set',_0x1f9cf3));};AGIVertices['prototype'][_0x9193('0xe3')]=function(_0xee3029){logger[_0x9193('0xe4')](util[_0x9193('0x9d')](_0x9193('0xe5'),_0xee3029[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0xee3029[_0x9193('0xe6')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0xee3029,_0x9193('0xe7'));}var _0x266234=this['getUser'][_0x9193('0xa8')](this,_0xee3029['sip_id']);if(!_0x266234){return this[_0x9193('0xf')][_0x9193('0x2d')](_0xee3029,_0x9193('0xe8'));}var _0x55e459=this[_0x9193('0xf')][_0x9193('0x54')](_0x9193('0xe9'),[util[_0x9193('0x9d')]('SIP/%s',_0x266234),_0xee3029[_0x9193('0x65')],_0xee3029[_0x9193('0xea')],_0xee3029[_0x9193('0x63')]]);if(_0x55e459[_0x9193('0xa4')]===-0x1){return _0x55e459;}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xeb'),_0x9193('0xe9')));};AGIVertices['prototype']['dialogflow']=function(_0x1056c1){logger[_0x9193('0x2f')](util['format'](_0x9193('0xec'),_0x1056c1[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x1056c1[_0x9193('0x79')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xed'));}if(!this[_0x9193('0x84')](_0x1056c1[_0x9193('0x5a')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xac'));}this[_0x9193('0xf')][_0x9193('0xee')]=!![];this['createSquareDetailsReport'](_0x1056c1);this[_0x9193('0x41')](_0x1056c1['text'],'in','','');this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')]('Trying\x20Dialogflow:\x20%s',_0x1056c1[_0x9193('0x5a')]));var _0x3cf916=this[_0x9193('0x78')]['sync'](this,_0x1056c1);if(_0x3cf916){for(var _0x16abd8 in _0x3cf916){if(_0x3cf916[_0x9193('0x95')](_0x16abd8)){this[_0x9193('0xf')][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0xef'),_0x16abd8['toUpperCase']()),_0x3cf916[_0x16abd8]);}}this[_0x9193('0x41')](_0x3cf916[_0x9193('0xf0')],_0x9193('0xf1'),_0x9193('0xf2'),'');return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xf3'),_0x3cf916[_0x9193('0xf0')]));}return this['channel'][_0x9193('0x2d')](_0x1056c1,_0x9193('0xf4'));};AGIVertices['prototype'][_0x9193('0xf5')]=function(_0x532388){logger[_0x9193('0x2f')](util['format'](_0x9193('0xf6'),_0x532388[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x532388[_0x9193('0x7c')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xf7'));}if(!this['isConfigured'](_0x532388[_0x9193('0xf8')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xf9'));}if(!this[_0x9193('0x84')](_0x532388[_0x9193('0x7d')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xfa'));}if(!this[_0x9193('0x84')](_0x532388[_0x9193('0x7e')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xfb'));}if(!this[_0x9193('0x84')](_0x532388[_0x9193('0x5a')])){return this['channel']['noop'](_0x9193('0xac'));}this[_0x9193('0xf')][_0x9193('0xee')]=!![];this[_0x9193('0x37')](_0x532388);this[_0x9193('0x41')](_0x532388[_0x9193('0x5a')],'in','','');this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xfc'),_0x532388['text']));var _0x18e5a5=this[_0x9193('0x7b')]['sync'](this,_0x532388);if(_0x18e5a5){for(var _0x335c85 in _0x18e5a5){if(_0x18e5a5[_0x9193('0x95')](_0x335c85)){if(_0x335c85!==_0x9193('0xfd')){this['channel']['setVariable'](util['format'](_0x9193('0xef'),_0x335c85[_0x9193('0x69')]()),_0x18e5a5[_0x335c85]);}}}this[_0x9193('0x41')](_0x18e5a5[_0x9193('0xf0')],_0x9193('0xf1'),_0x9193('0xf5'),_0x18e5a5[_0x9193('0xfd')]);return this[_0x9193('0xf')]['noop'](util[_0x9193('0x9d')](_0x9193('0xfe'),_0x18e5a5['speech']));}return this[_0x9193('0xf')][_0x9193('0x2d')](_0x532388,_0x9193('0xff'));};AGIVertices[_0x9193('0x11')][_0x9193('0x100')]=function(_0x29d047){logger[_0x9193('0x2f')](util['format'](_0x9193('0x101'),_0x29d047['label']));if(!this[_0x9193('0x84')](_0x29d047[_0x9193('0x102')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x9193('0x84')](_0x29d047[_0x9193('0x103')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0x104'));}if(!this[_0x9193('0x84')](_0x29d047[_0x9193('0x105')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0x106'));}if(!this[_0x9193('0x84')](_0x29d047[_0x9193('0x107')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xac'));}this['channel'][_0x9193('0xee')]=!![];this[_0x9193('0x37')](_0x29d047);this['createSquareMessage'](_0x29d047[_0x9193('0x5a')],'in','','');this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('Trying\x20SestekNDA:\x20%s',_0x29d047[_0x9193('0x5a')]));var _0x267ef0=this[_0x9193('0x7f')][_0x9193('0xa8')](this,_0x29d047);if(_0x267ef0){for(var _0x145dcb in _0x267ef0){if(_0x267ef0[_0x9193('0x95')](_0x145dcb)){this['channel']['setVariable'](util['format']('SESTEK_NDA_%s',_0x145dcb[_0x9193('0x69')]()),_0x267ef0[_0x145dcb]);}}this[_0x9193('0x41')](_0x267ef0['speech'],'out',_0x9193('0x100'),'');if(_0x267ef0[_0x9193('0x108')]){this['channel'][_0x9193('0xab')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x267ef0[_0x9193('0x108')]));var _0x5421a6=this['channel']['streamFile'](_0x267ef0[_0x9193('0x108')]);try{fs[_0x9193('0x109')](_0x267ef0[_0x9193('0x108')]+_0x9193('0x10a'));}catch(_0x4d9587){logger[_0x9193('0x2d')](_0x4d9587);}return _0x5421a6;}else{return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x10b'),_0x267ef0[_0x9193('0xf0')]));}}return this[_0x9193('0xf')][_0x9193('0x2d')](_0x29d047,_0x9193('0x10c'));};AGIVertices[_0x9193('0x11')][_0x9193('0x10d')]=function(_0x3437c3){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x10e'),_0x3437c3['label']));return this[_0x9193('0xf')]['noop'](_0x9193('0x10d'));};AGIVertices['prototype']['ext_dial']=function(_0x2f895d){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x10f'),_0x2f895d[_0x9193('0xaa')]));var _0x2ec5d2='';if(_0x2f895d[_0x9193('0x110')]){if(!this[_0x9193('0x84')](_0x2f895d[_0x9193('0x110')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2f895d,'no\x20trunk\x20selected');}else{var _0x125cc3=parseInt(_0x2f895d[_0x9193('0x110')],0xa);if(isNaN(_0x125cc3)){_0x2ec5d2=_0x2f895d[_0x9193('0x110')];}else{_0x2ec5d2=this[_0x9193('0x1f')]['sync'](this,_0x2f895d[_0x9193('0x110')]);if(!_0x2ec5d2){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2f895d,_0x9193('0x111'));}}}}else if(_0x2f895d['trunk_name']){_0x2ec5d2=_0x2f895d[_0x9193('0x112')];}else{return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2f895d,_0x9193('0x113'));}var _0x24974a=this['channel'][_0x9193('0x54')](_0x9193('0xe9'),[util[_0x9193('0x9d')](_0x9193('0x114'),_0x2ec5d2,_0x2f895d['phone']),_0x2f895d[_0x9193('0x65')],_0x2f895d[_0x9193('0xea')],_0x2f895d['url']]);if(_0x24974a[_0x9193('0xa4')]===-0x1){return _0x24974a;}return this[_0x9193('0xf')]['noop'](util['format'](_0x9193('0xeb'),_0x9193('0xe9')));};AGIVertices[_0x9193('0x11')]['finally']=function(_0x19a10c){logger[_0x9193('0x2f')](util['format'](_0x9193('0x115'),_0x19a10c[_0x9193('0xaa')]));return this['channel'][_0x9193('0xab')](_0x9193('0x116'));};AGIVertices[_0x9193('0x11')][_0x9193('0xe')]=function(_0x539198){logger['info'](util['format'](_0x9193('0x117'),_0x539198['label']));if(_0x539198['retry']===0x0){return this['maxRetry'](_0x539198);}_0x539198[_0x9193('0xa9')]-=0x1;if(!this[_0x9193('0x84')](_0x539198[_0x9193('0x118')])){return this[_0x9193('0xf')]['error'](_0x539198,_0x9193('0x119'));}var _0x142bd2=this[_0x9193('0x20')][_0x9193('0xa8')](this,_0x539198[_0x9193('0x118')]);if(!_0x142bd2){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x539198,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x539198[_0x9193('0xdd')])){return this['channel']['error'](_0x9193('0x11a'));}var _0x532dfc=this['channel'][_0x9193('0x11b')](_0x142bd2,_0x539198[_0x9193('0x11c')],_0x539198[_0x9193('0x11d')]);var _0x3d00fd=_0x532dfc[_0x9193('0xa4')]?_0x532dfc['result'][_0x9193('0x4b')]():'';logger[_0x9193('0x2f')]('test',JSON[_0x9193('0x71')](_0x532dfc));if(_0x532dfc[_0x9193('0xa4')]===-0x1){this[_0x9193('0x37')]['sync'](this,_0x539198,_0x3d00fd);return _0x532dfc;}else if(_0x532dfc[_0x9193('0xa6')]==='timeout'){_0x532dfc[_0x9193('0xa4')]=_0x3d00fd[_0x9193('0x9f')]>=parseInt(_0x539198['mindigit'])?'x':'i';}else{_0x532dfc[_0x9193('0xa4')]=_0x3d00fd[_0x9193('0x9f')]>=parseInt(_0x539198[_0x9193('0x11e')])&&_0x3d00fd['length']<=parseInt(_0x539198['maxdigit'])?'x':'i';}var _0x3651ac=this[_0x9193('0x12')][_0x9193('0xa8')](this,_0x539198['variable_id']);if(!_0x3651ac){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x539198,_0x9193('0xde'));}this[_0x9193('0xf')][_0x9193('0xa0')](_0x3651ac,_0x3d00fd);if(this['isConfigured'](_0x539198[_0x9193('0x11f')])){var _0x312a0f=parseInt(_0x539198[_0x9193('0x11f')],0xa);var _0x488a9f=rs[_0x9193('0x120')]({'charset':'*','length':_0x312a0f});var _0x2f3299=_0x3d00fd['length'];if(_0x2f3299>0x0){if(_0x2f3299>_0x312a0f){this['createSquareDetailsReport']['sync'](this,_0x539198,_0x539198[_0x9193('0x121')]==='first'?_0x488a9f+_0x3d00fd[_0x9193('0x122')](_0x312a0f):_0x3d00fd[_0x9193('0x122')](0x0,_0x2f3299-_0x312a0f)+_0x488a9f);}else{this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x539198,rs['generate']({'charset':'*','length':_0x2f3299}));}}else{this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x539198,'');}}else{this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x539198,_0x3d00fd);}return _0x532dfc;};AGIVertices['prototype'][_0x9193('0x123')]=function(_0x2f6a7c){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x124'),_0x2f6a7c[_0x9193('0xaa')]));return this[_0x9193('0xe')](_0x2f6a7c);};AGIVertices[_0x9193('0x11')][_0x9193('0x125')]=function(_0x322808){logger[_0x9193('0x2f')](util['format'](_0x9193('0x126'),_0x322808[_0x9193('0xaa')]));this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x322808,_0x322808[_0x9193('0x127')]);return this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x128'),_0x322808[_0x9193('0x127')]));};AGIVertices[_0x9193('0x11')]['awspolly']=function(_0x1610ba){logger['info'](util['format'](_0x9193('0x129'),_0x1610ba['label']));if(!this[_0x9193('0x84')](_0x1610ba[_0x9193('0x87')])||!this[_0x9193('0x84')](_0x1610ba['aws_secret_access_key'])){return this[_0x9193('0xf')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x9193('0x84')](_0x1610ba[_0x9193('0x5a')])){return this[_0x9193('0xf')]['noop'](_0x9193('0xac'));}this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x12a'),_0x1610ba['text']));var _0x51de74=this[_0x9193('0x86')]['sync'](this,_0x1610ba);if(_0x51de74){this['channel']['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x51de74));var _0x1db94f=this[_0x9193('0xf')]['streamFile'](_0x51de74);try{fs['unlink'](_0x51de74+'.wav');}catch(_0x2ae2ab){logger[_0x9193('0x2d')](_0x2ae2ab);}return _0x1db94f;}return this[_0x9193('0xf')][_0x9193('0x2d')](_0x1610ba,_0x9193('0x12b'));};AGIVertices[_0x9193('0x11')][_0x9193('0x12c')]=function(_0x48f24c){logger[_0x9193('0x2f')](util['format'](_0x9193('0x12d'),_0x48f24c['label']));if(!this[_0x9193('0x84')](_0x48f24c[_0x9193('0x87')])||!this['isConfigured'](_0x48f24c[_0x9193('0x88')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9193('0x84')](_0x48f24c[_0x9193('0x12e')])){return this[_0x9193('0xf')]['noop'](_0x9193('0x12f'));}if(!this[_0x9193('0x84')](_0x48f24c[_0x9193('0x5a')])){return this['channel'][_0x9193('0xab')]('no\x20text\x20configured');}this[_0x9193('0xf')][_0x9193('0xee')]=!![];this[_0x9193('0x37')](_0x48f24c);this['createSquareMessage'](_0x48f24c[_0x9193('0x5a')],'in','','');this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x130'),_0x48f24c[_0x9193('0x5a')]));var _0x4b4318=this[_0x9193('0x8b')][_0x9193('0xa8')](this,_0x48f24c);if(_0x4b4318){for(var _0x36fd13 in _0x4b4318){if(_0x4b4318[_0x9193('0x95')](_0x36fd13)&&_[_0x9193('0x96')](_0x4b4318[_0x36fd13])){this['channel'][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0x131'),_0x36fd13[_0x9193('0x69')]()),_0x4b4318[_0x36fd13]);}}if(_[_0x9193('0x44')](_0x4b4318[_0x9193('0x75')])){return this[_0x9193('0xf')][_0x9193('0xab')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x9193('0x41')](_0x4b4318['message'],'out','amazonlex','');return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x132'),_0x4b4318[_0x9193('0x75')]));}}return this[_0x9193('0xf')][_0x9193('0x2d')](_0x48f24c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9193('0x11')][_0x9193('0x133')]=function(_0x2bdf52){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x134'),_0x2bdf52['label'],_0x2bdf52[_0x9193('0x65')]));if(!this[_0x9193('0x84')](_0x2bdf52[_0x9193('0x79')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0xed'));}var _0x139bfe=_0x9193('0x135');var _0x1b0965=util[_0x9193('0x9d')](_0x9193('0x136'),FILES_PATH,rs['generate'](0x4));var _0x4ee83a=util[_0x9193('0x9d')](_0x9193('0x9e'),_0x1b0965,_0x139bfe);var _0x2a85af=!![];if(_0x2bdf52[_0x9193('0x137')]===_0x9193('0x138')){_0x2a85af=![];}var _0x3b3a77=this[_0x9193('0xf')][_0x9193('0x139')](_0x1b0965,_0x139bfe,_0x2bdf52[_0x9193('0x13a')],_0x2bdf52[_0x9193('0x65')],undefined,_0x2a85af);if(_0x3b3a77[_0x9193('0xa4')]!==-0x1){this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x13b'),_0x4ee83a));var _0x14e0fa=this[_0x9193('0x8d')][_0x9193('0xa8')](this,_0x2bdf52,_0x4ee83a);if(_0x14e0fa){for(var _0x312311 in _0x14e0fa){if(_0x14e0fa['hasOwnProperty'](_0x312311)){this[_0x9193('0xf')][_0x9193('0xa0')](util['format'](_0x9193('0x13c'),_0x312311[_0x9193('0x69')]()),_0x14e0fa[_0x312311]);}}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x13d'),JSON[_0x9193('0x71')](_0x14e0fa)));}}return _0x3b3a77;};AGIVertices[_0x9193('0x11')][_0x9193('0x13e')]=function(_0x2235ec){logger[_0x9193('0x2f')](util['format'](_0x9193('0x13f'),_0x2235ec['label']));if(!this['isConfigured'](_0x2235ec[_0x9193('0x90')])){return this[_0x9193('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x9193('0x84')](_0x2235ec['appsecret'])){return this['channel'][_0x9193('0xab')](_0x9193('0x140'));}var _0x4a23e6=_0x9193('0x135');var _0x2aa772=util[_0x9193('0x9d')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1892d5=util[_0x9193('0x9d')]('%s.%s',_0x2aa772,_0x4a23e6);var _0x17ed97=!![];if(_0x2235ec[_0x9193('0x137')]===_0x9193('0x138')){_0x17ed97=![];}var _0x1487b5=this[_0x9193('0xf')][_0x9193('0x139')](_0x2aa772,_0x4a23e6,_0x2235ec['intKey'],_0x2235ec[_0x9193('0x65')],undefined,_0x17ed97);if(_0x1487b5[_0x9193('0xa4')]!==-0x1){this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x141'),_0x1892d5));var _0x5c1e7e=this[_0x9193('0x8f')][_0x9193('0xa8')](this,_0x2235ec,_0x1892d5);if(_0x5c1e7e){for(var _0x306146 in _0x5c1e7e){if(_0x5c1e7e['hasOwnProperty'](_0x306146)){this[_0x9193('0xf')][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0x142'),_0x306146['toUpperCase']()),_0x5c1e7e[_0x306146]);}}return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x143'),JSON[_0x9193('0x71')](_0x5c1e7e)));}}return _0x1487b5;};AGIVertices[_0x9193('0x11')][_0x9193('0x144')]=function(_0x5dd3a2){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x145'),_0x5dd3a2[_0x9193('0xaa')]));return this[_0x9193('0xf')]['continueAt'](_0x5dd3a2[_0x9193('0x3d')],_0x5dd3a2['extension'],_0x5dd3a2[_0x9193('0x146')]);};AGIVertices['prototype'][_0x9193('0x147')]=function(_0x536fca){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x536fca[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x536fca['condition'])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x536fca,_0x9193('0x148'));}try{var _0x357638=eval(_0x536fca['condition'])?_0x9193('0x149'):_0x9193('0x14a');this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x14b'),_0x536fca['condition'],_0x357638));return{'code':0xc8,'result':_0x357638};}catch(_0x12712d){return{'code':0xc8,'result':_0x9193('0x14a')};}};AGIVertices['prototype'][_0x9193('0x14c')]=function(_0x3df026){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3df026['label']));if(!this['isConfigured'](_0x3df026[_0x9193('0x14d')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3df026,_0x9193('0x14e'));}var _0x337662=this['getIntervals'][_0x9193('0xa8')](this,_0x3df026[_0x9193('0x14d')]);if(!_0x337662){return this[_0x9193('0xf')]['error'](_0x3df026,_0x9193('0x14f'));}for(var _0x1d5616=0x0;_0x1d5616<_0x337662[_0x9193('0x9f')];_0x1d5616+=0x1){var _0x595aae=this[_0x9193('0xf')][_0x9193('0x12')](util[_0x9193('0x9d')](_0x9193('0x150'),_0x337662[_0x1d5616]));if(_0x595aae[_0x9193('0xa4')]===-0x1){return _0x595aae;}logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('IFTIME\x20%s\x20%s',_0x337662[_0x1d5616],_0x595aae[_0x9193('0xa6')]));if(_0x595aae['extra']===_0x9193('0x149')){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x151'),_0x337662[_0x1d5616],_0x9193('0x149')));this['channel']['noop'](util[_0x9193('0x9d')](_0x9193('0x151'),_0x337662[_0x1d5616],'true'));return{'code':0xc8,'result':_0x9193('0x149')};}else{logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x151'),_0x337662[_0x1d5616],'false'));this['channel']['noop'](util[_0x9193('0x9d')](_0x9193('0x151'),_0x337662[_0x1d5616],'false'));}}return{'code':0xc8,'result':_0x9193('0x14a')};};AGIVertices[_0x9193('0x11')]['hangup']=function(_0x614252){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x152'),_0x614252[_0x9193('0xaa')]));return this[_0x9193('0xf')][_0x9193('0x153')]();};AGIVertices[_0x9193('0x11')][_0x9193('0x154')]=function(_0x123c85){logger[_0x9193('0x2f')](util['format'](_0x9193('0x155'),_0x123c85[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x123c85[_0x9193('0x79')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20key\x20configured');}var _0x3c8263='wav';var _0x2b9c5b=util[_0x9193('0x9d')](_0x9193('0x136'),FILES_PATH,rs[_0x9193('0x120')](0x4));var _0x54522f=util['format'](_0x9193('0x9e'),_0x2b9c5b,_0x3c8263);var _0x5ab12c=!![];if(_0x123c85['beep']===_0x9193('0x138')){_0x5ab12c=![];}var _0x5bca39=this[_0x9193('0xf')][_0x9193('0x139')](_0x2b9c5b,_0x3c8263,_0x123c85[_0x9193('0x13a')],_0x123c85[_0x9193('0x65')],undefined,_0x5ab12c);if(_0x5bca39[_0x9193('0xa4')]!==-0x1){this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x156'),_0x54522f));var _0xf6f0f3=this['ispeechASR'][_0x9193('0xa8')](this,_0x123c85,_0x54522f);if(_0xf6f0f3){for(var _0x1bd9d1 in _0xf6f0f3){if(_0xf6f0f3[_0x9193('0x95')](_0x1bd9d1)){this['channel']['setVariable'](util[_0x9193('0x9d')]('ISPEECH_ASR_%s',_0x1bd9d1[_0x9193('0x69')]()),_0xf6f0f3[_0x1bd9d1]);}}return this[_0x9193('0xf')]['noop'](util[_0x9193('0x9d')](_0x9193('0x157'),JSON[_0x9193('0x71')](_0xf6f0f3)));}}return _0x5bca39;};AGIVertices[_0x9193('0x11')][_0x9193('0x158')]=function(_0xbd61aa){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x159'),_0xbd61aa[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0xbd61aa[_0x9193('0x79')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20key\x20configured');}if(!this[_0x9193('0x84')](_0xbd61aa[_0x9193('0x5a')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20text\x20configured');}this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x15a'),_0xbd61aa['text']));var _0x16f4c0=this['ispeechTTS']['sync'](this,_0xbd61aa);if(_0x16f4c0){this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('ispeech\x20%s\x20file\x20created',_0x16f4c0));var _0x3afa25=this['channel']['streamFile'](_0x16f4c0,_0xbd61aa[_0x9193('0x13a')]);try{fs[_0x9193('0x109')](_0x16f4c0+_0x9193('0x10a'));}catch(_0xed319c){logger[_0x9193('0x2d')](_0xed319c);}return _0x3afa25;}return this[_0x9193('0xf')][_0x9193('0x2d')](_0xbd61aa,_0x9193('0x15b'));};AGIVertices[_0x9193('0x11')][_0x9193('0x15c')]=function(_0xd0c784){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xd0c784[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0xd0c784[_0x9193('0x15d')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0xd0c784,_0x9193('0x15e'));}logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9193('0x3b')],_0xd0c784[_0x9193('0x15d')]));var _0x134898=this[_0x9193('0x51')][_0x9193('0xa8')](this,_0xd0c784[_0x9193('0x15d')]);if(_0x134898){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9193('0xf')]['callerid'],_0xd0c784['findBy']));this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x15f'),this[_0x9193('0xf')][_0x9193('0x3b')],_0xd0c784[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x160')};}else{logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x161'),this['channel']['callerid'],_0xd0c784[_0x9193('0x15d')]));this['channel'][_0x9193('0xab')](util['format'](_0x9193('0x161'),this['channel'][_0x9193('0x3b')],_0xd0c784[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x162')};}};AGIVertices[_0x9193('0x11')][_0x9193('0x163')]=function(_0x1a1cd9){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x164'),_0x1a1cd9[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x1a1cd9[_0x9193('0x15d')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x1a1cd9,_0x9193('0x15e'));}logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x165'),this['channel'][_0x9193('0x3b')],_0x1a1cd9[_0x9193('0x15d')]));var _0x46072d=this['agentLogout'][_0x9193('0xa8')](this,_0x1a1cd9['findBy']);if(_0x46072d){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9193('0xf')][_0x9193('0x3b')],_0x1a1cd9[_0x9193('0x15d')]));this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9193('0xf')][_0x9193('0x3b')],_0x1a1cd9[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x160')};}else{logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x161'),this[_0x9193('0xf')]['callerid'],_0x1a1cd9['findBy']));this[_0x9193('0xf')]['noop'](util[_0x9193('0x9d')](_0x9193('0x161'),this[_0x9193('0xf')]['callerid'],_0x1a1cd9[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x162')};}};AGIVertices[_0x9193('0x11')]['math']=function(_0x2c5dc3){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x166'),_0x2c5dc3[_0x9193('0xaa')]));if(!this['isConfigured'](_0x2c5dc3[_0x9193('0x167')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2c5dc3,_0x9193('0x168'));}this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x169'),_0x2c5dc3['operation']));var _0x56650d=eval(_0x2c5dc3[_0x9193('0x167')]);if(!this['isConfigured'](_0x2c5dc3[_0x9193('0xdd')])){return this[_0x9193('0xf')]['noop'](_0x9193('0x11a'));}var _0x26c571=this[_0x9193('0x12')][_0x9193('0xa8')](this,_0x2c5dc3[_0x9193('0xdd')]);if(!_0x26c571){return this['channel']['error'](_0x2c5dc3,_0x9193('0xde'));}if(_[_0x9193('0x9a')](_0x56650d)){var _0xc1e53f=this;_0x56650d[_0x9193('0xdf')](function(_0x6a0f32,_0x77a205){_0xc1e53f[_0x9193('0xf')]['setVariable'](util[_0x9193('0x9d')](_0x9193('0x16a'),_0x26c571,_0x77a205),_0x6a0f32);});return this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x16b'),_0x26c571));}else{return this[_0x9193('0xf')][_0x9193('0xa0')](_0x26c571,_0x56650d);}};AGIVertices[_0x9193('0x11')][_0x9193('0xd')]=function(_0x552de4){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x16c'),_0x552de4[_0x9193('0xaa')]));if(_0x552de4[_0x9193('0xa9')]===0x0){return this[_0x9193('0xa7')](_0x552de4);}_0x552de4[_0x9193('0xa9')]-=0x1;if(!this[_0x9193('0x84')](_0x552de4[_0x9193('0x118')])){return this[_0x9193('0xf')]['error'](_0x552de4,_0x9193('0x119'));}var _0x3c9b99=this[_0x9193('0x20')][_0x9193('0xa8')](this,_0x552de4['file_id']);if(!_0x3c9b99){return this['channel'][_0x9193('0x2d')](_0x552de4,'no\x20file\x20audio\x20found');}var _0x893ca1=this['channel'][_0x9193('0x11b')](_0x3c9b99,_0x552de4[_0x9193('0x11c')],_0x552de4[_0x9193('0x16d')]);var _0x53b97e=_0x893ca1[_0x9193('0xa4')];if(_0x893ca1['result']===-0x1){this['createSquareDetailsReport'][_0x9193('0xa8')](this,_0x552de4,'-1');return _0x893ca1;}else if(_0x893ca1[_0x9193('0xa6')]===_0x9193('0x65')){_0x893ca1['result']=_0x893ca1[_0x9193('0xa4')][_0x9193('0x9f')]>0x0?_0x893ca1[_0x9193('0xa4')]:'t';}else if(_[_0x9193('0x43')](_0x893ca1['result'])){_0x893ca1['result']='#';_0x53b97e='#';}if(!this['isConfigured'](_0x552de4['variable_id'])){this[_0x9193('0xf')][_0x9193('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x43d03d=this['getVariable']['sync'](this,_0x552de4[_0x9193('0xdd')]);if(!_0x43d03d){return this['channel']['error'](_0x552de4,_0x9193('0xde'));}this[_0x9193('0xf')][_0x9193('0xa0')](_0x43d03d,_0x53b97e);}this['createSquareDetailsReport'][_0x9193('0xa8')](this,_0x552de4,_0x53b97e);return _0x893ca1;};AGIVertices[_0x9193('0x11')][_0x9193('0xab')]=function(_0x9c4f2c){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x16e'),_0x9c4f2c[_0x9193('0xaa')]));return this['channel']['noop'](_0x9c4f2c[_0x9193('0x16f')]||_0x9c4f2c[_0x9193('0xaa')]);};AGIVertices[_0x9193('0x11')][_0x9193('0x170')]=function(_0x561b1e){logger[_0x9193('0x2f')](util['format'](_0x9193('0x171'),_0x561b1e['label']));if(!this[_0x9193('0x84')](_0x561b1e[_0x9193('0x15d')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x561b1e,_0x9193('0x15e'));}logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x165'),this[_0x9193('0xf')]['callerid'],_0x561b1e[_0x9193('0x15d')]));var _0x515614=this[_0x9193('0x172')][_0x9193('0xa8')](this,_0x561b1e[_0x9193('0x173')]);var _0x423d29=this[_0x9193('0x4e')]['sync'](this,_0x561b1e[_0x9193('0x15d')],_0x515614);if(_0x423d29){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9193('0x3b')],_0x561b1e[_0x9193('0x15d')]));this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x561b1e[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x160')};}else{logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x161'),this[_0x9193('0xf')][_0x9193('0x3b')],_0x561b1e['findBy']));this[_0x9193('0xf')]['noop'](util[_0x9193('0x9d')](_0x9193('0x15f'),this[_0x9193('0xf')][_0x9193('0x3b')],_0x561b1e[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x162')};}};AGIVertices[_0x9193('0x11')]['playback']=function(_0x33980b){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x174'),_0x33980b[_0x9193('0xaa')]));if(!this['isConfigured'](_0x33980b[_0x9193('0x118')])){return this[_0x9193('0xf')]['error'](_0x33980b,_0x9193('0x119'));}var _0x469ad6=this['getSound'][_0x9193('0xa8')](this,_0x33980b['file_id']);if(!_0x469ad6){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x33980b,'no\x20file\x20audio\x20found');}var _0x3fd492=this[_0x9193('0xf')]['exec'](_0x9193('0x175'),[_0x469ad6,_0x33980b['opts']]);if(_0x3fd492[_0x9193('0xa4')]===-0x1){return _0x3fd492;}return this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')]('Executed\x20command\x20%s\x20%s',_0x9193('0x175'),_0x469ad6));};AGIVertices['prototype'][_0x9193('0x176')]=function(_0xcfc899){logger[_0x9193('0x2f')](util['format'](_0x9193('0x177'),_0xcfc899[_0x9193('0xaa')]));if(!this['isConfigured'](_0xcfc899['queue_id'])){return this['channel']['error'](_0xcfc899,_0x9193('0x178'));}var _0x5f4808='';var _0x37976a=parseInt(_0xcfc899[_0x9193('0x179')],0xa);if(isNaN(_0x37976a)){_0x5f4808=_0xcfc899[_0x9193('0x179')];}else{_0x5f4808=this[_0x9193('0x16')][_0x9193('0xa8')](this,_0xcfc899[_0x9193('0x179')]);if(!_0x5f4808){return this['channel']['error'](_0xcfc899,_0x9193('0x17a'));}}var _0x303da3='';if(this[_0x9193('0x84')](_0xcfc899[_0x9193('0x118')])){var _0x5b580d=this[_0x9193('0x20')][_0x9193('0xa8')](this,_0xcfc899[_0x9193('0x118')]);if(_0x5b580d){_0x303da3=_0x5b580d;}}this[_0x9193('0x37')][_0x9193('0xa8')](this,_0xcfc899,_0x5f4808);if(_0xcfc899[_0x9193('0xea')][_0x9193('0x17b')]('x')<0x0){_0xcfc899[_0x9193('0xea')]+='x';}if(_0xcfc899['opts'][_0x9193('0x17b')]('X')<0x0){_0xcfc899['opts']+='X';}this['channel'][_0x9193('0xa0')](_0x9193('0x17c'),_0x5f4808?_0x5f4808['toLowerCase']():'');var _0x3f89c3=this[_0x9193('0xf')]['exec']('QUEUE',[_0x5f4808,_0xcfc899['opts'],_0xcfc899[_0x9193('0x63')],_0x303da3,_0xcfc899[_0x9193('0x65')],_0xcfc899[_0x9193('0x8')],_0xcfc899['macro'],_0xcfc899[_0x9193('0x17d')],'',_0xcfc899[_0x9193('0x17e')]]);if(_0x3f89c3[_0x9193('0xa4')]===-0x1){return _0x3f89c3;}return this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0xc9'),_0x9193('0x17f'),_0x5f4808));};AGIVertices[_0x9193('0x11')]['record']=function(_0x288e78){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x180'),_0x288e78[_0x9193('0xaa')]));var _0x1d7c2e=_0x288e78[_0x9193('0x181')]||_0x9193('0x135');var _0x49941b=util[_0x9193('0x9d')](_0x9193('0x182'),this[_0x9193('0xf')]['uniqueid'],rs[_0x9193('0x120')](0x5));var _0x1707a3=util['format'](_0x9193('0x183'),FILES_PATH,_0x49941b,_0x1d7c2e);var _0x1beb03=util[_0x9193('0x9d')](_0x9193('0x136'),FILES_PATH,_0x49941b);this[_0x9193('0x3c')]['sync'](this,_0x288e78,_0x49941b,_0x1707a3);this[_0x9193('0xf')]['setVariable'](_0x9193('0x184'),_0x49941b);logger[_0x9193('0x2f')](_0x9193('0x185'),_0x1beb03,_0x1d7c2e,_0x288e78[_0x9193('0x186')],_0x288e78[_0x9193('0x65')]);return this[_0x9193('0xf')][_0x9193('0x139')](_0x1beb03,_0x1d7c2e,_0x288e78[_0x9193('0x186')],_0x288e78['timeout'],undefined,!![]);};AGIVertices[_0x9193('0x11')][_0x9193('0x187')]=function(_0x3f2366){logger['info'](util[_0x9193('0x9d')](_0x9193('0x188'),_0x3f2366[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x3f2366[_0x9193('0x63')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20url\x20configured');}var _0x53ba83=this[_0x9193('0x62')][_0x9193('0xa8')](this,_0x3f2366);logger['info'](util[_0x9193('0x9d')](_0x9193('0x189'),util[_0x9193('0x18a')](_0x53ba83,{'showHidden':![],'depth':null})));if(!this[_0x9193('0x84')](_0x3f2366[_0x9193('0xdd')])){return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0x18b'));}var _0x49d64c=this[_0x9193('0x12')]['sync'](this,_0x3f2366[_0x9193('0xdd')]);if(!_0x49d64c){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3f2366,_0x9193('0xde'));}this[_0x9193('0xf')][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0x18c'),_0x49d64c),_0x53ba83[_0x9193('0x73')]?_0x53ba83[_0x9193('0x73')]:'200');this[_0x9193('0xf')][_0x9193('0xa0')](util[_0x9193('0x9d')](_0x9193('0x18d'),_0x49d64c),_0x53ba83['statusMessage']?_0x53ba83[_0x9193('0x74')]:'OK');if(_0x53ba83[_0x9193('0x6a')]){try{this[_0x9193('0x9b')](_0x53ba83[_0x9193('0x6a')],_0x49d64c);}catch(_0x48d345){logger['error'](util[_0x9193('0x9d')](_0x9193('0x18e'),_0x49d64c));}}return this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x18f'),_0x49d64c));};AGIVertices['prototype'][_0x9193('0x190')]=function(_0x3473a2){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3473a2[_0x9193('0xaa')]));return this[_0x9193('0xf')][_0x9193('0x191')](_0x3473a2[_0x9193('0x192')]['replace'](/\s+/g,''),_0x3473a2[_0x9193('0x186')]);};AGIVertices['prototype'][_0x9193('0x193')]=function(_0x345c7b){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x194'),_0x345c7b[_0x9193('0xaa')]));return this[_0x9193('0xf')][_0x9193('0x195')](_0x345c7b[_0x9193('0x66')][_0x9193('0x56')](/\s+/g,''),_0x345c7b[_0x9193('0x186')]);};AGIVertices[_0x9193('0x11')][_0x9193('0x196')]=function(_0x2e95f3){logger['info'](util[_0x9193('0x9d')](_0x9193('0x197'),_0x2e95f3['label']));return this['channel'][_0x9193('0x198')](_0x2e95f3['text'],_0x2e95f3[_0x9193('0x186')]);};AGIVertices['prototype']['sendMail']=function(_0x3afd00){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x199'),_0x3afd00['label']));if(!this[_0x9193('0x84')](_0x3afd00[_0x9193('0x19a')])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20mail\x20account\x20configured');}var _0x1064ff=this[_0x9193('0x23')][_0x9193('0xa8')](this,_0x3afd00[_0x9193('0x19a')]);if(!_0x1064ff||!_0x1064ff['Smtp']){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x3afd00,'no\x20mail\x20account\x20found');}var _0x3577f3={'from':util['format'](_0x9193('0x19b'),_0x1064ff['name'],_0x1064ff['email']||_0x1064ff[_0x9193('0x19c')][_0x9193('0x19d')]),'to':_0x3afd00['to']||'','cc':_0x3afd00['cc']||'','bcc':_0x3afd00[_0x9193('0x19e')]||'','subject':_0x3afd00['subject'],'html':_0x3afd00[_0x9193('0x5a')],'text':_0x3afd00[_0x9193('0x5a')]};var _0x23abf7={'tls':{'rejectUnauthorized':![]}};if(_0x1064ff[_0x9193('0x19c')][_0x9193('0x19f')]){_0x23abf7['service']=_0x1064ff[_0x9193('0x19c')][_0x9193('0x19f')];}else{_0x23abf7['host']=_0x1064ff[_0x9193('0x19c')][_0x9193('0x1a0')];_0x23abf7[_0x9193('0x1a1')]=_0x1064ff[_0x9193('0x19c')]['port'];_0x23abf7[_0x9193('0x1a2')]=_0x1064ff[_0x9193('0x19c')][_0x9193('0x1a2')];}if(_0x1064ff[_0x9193('0x19c')][_0x9193('0x1a3')]){_0x23abf7[_0x9193('0x1a4')]={'user':_0x1064ff[_0x9193('0x19c')]['user'],'pass':_0x1064ff[_0x9193('0x19c')][_0x9193('0x1a5')]};}if(this['isConfigured'](_0x3afd00[_0x9193('0x1a6')])){}logger['debug'](_0x9193('0x1a7'),JSON[_0x9193('0x71')](_0x3577f3));this[_0x9193('0x37')]['sync'](this,_0x3afd00,_0x3afd00[_0x9193('0x19a')]);this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1064ff['name']));this['sendMailMessage']['sync'](this,_0x23abf7,_0x3577f3);return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0x1a8'));};AGIVertices[_0x9193('0x11')][_0x9193('0x1a9')]=function(_0x366a3b){logger[_0x9193('0x2f')](util['format'](_0x9193('0x1aa'),_0x366a3b[_0x9193('0xaa')]));return this['channel']['noop'](_0x9193('0x1ab'));};AGIVertices['prototype'][_0x9193('0x1ac')]=function(_0x53b0e6){logger['info'](util['format'](_0x9193('0x1ad'),_0x53b0e6[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x53b0e6['sms_account_id'])){return this[_0x9193('0xf')]['noop'](_0x9193('0x1ae'));}var _0x2a1c55=this[_0x9193('0x34')][_0x9193('0xa8')](this,_0x53b0e6[_0x9193('0x1af')]);if(!_0x2a1c55){return this['channel']['error'](_0x53b0e6,_0x9193('0x1b0'));}var _0x5d9c02={'body':_0x53b0e6['sms_text'],'phone':_0x53b0e6['to']||'','SmsAccountId':_0x2a1c55['id']};logger[_0x9193('0xe4')](_0x9193('0x1b1'),JSON[_0x9193('0x71')](_0x5d9c02));this['createSquareDetailsReport'][_0x9193('0xa8')](this,_0x53b0e6,_0x53b0e6[_0x9193('0x1af')]);this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x1b2'),_0x2a1c55[_0x9193('0x14')]));this['createSmsMessage'][_0x9193('0xa8')](this,_0x5d9c02);return this[_0x9193('0xf')]['noop'](_0x9193('0x1b3'));};AGIVertices[_0x9193('0x11')]['set']=function(_0x2b4258){logger[_0x9193('0x2f')](util[_0x9193('0x9d')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2b4258[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x2b4258[_0x9193('0xdd')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2b4258,_0x9193('0x1b4'));}var _0x25e49a=this[_0x9193('0x12')]['sync'](this,_0x2b4258[_0x9193('0xdd')]);if(!_0x25e49a){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x2b4258,_0x9193('0xde'));}return this['channel'][_0x9193('0xa0')](_0x25e49a,_0x2b4258[_0x9193('0x1b5')]);};AGIVertices[_0x9193('0x11')][_0x9193('0x1b6')]=function(_0x22654b){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x1b7'),_0x22654b[_0x9193('0xaa')]));this['channel'][_0x9193('0xab')](_0x9193('0x1b8'));if(_0x22654b[_0x9193('0xba')]===_0x9193('0x1b9')){this[_0x9193('0xf')]['noop'](_0x9193('0x1ba'));return this[_0x9193('0xf')][_0x9193('0xba')]();}return this[_0x9193('0xf')][_0x9193('0xab')](_0x9193('0x1bb'));};AGIVertices[_0x9193('0x11')][_0x9193('0x1bc')]=function(_0x32db05){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x1bd'),_0x32db05[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x32db05['project_id'])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x32db05,_0x9193('0x1be'));}var _0x1afd44=this[_0x9193('0x19')][_0x9193('0xa8')](this,_0x32db05[_0x9193('0x1bf')]);if(!this[_0x9193('0x84')](_0x1afd44)){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x32db05,util[_0x9193('0x9d')](_0x9193('0x1c0'),_0x32db05[_0x9193('0x1bf')]));}if(_0x1afd44===this[_0x9193('0xf')][_0x9193('0x3a')]){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x32db05,_0x9193('0x1c1'));}this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x32db05,_0x1afd44);var _0x21787a=this[_0x9193('0xf')]['exec']('AGI',util[_0x9193('0x9d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x9193('0x1a0')]||_0x9193('0x1c2'),_0x1afd44,this[_0x9193('0xf')][_0x9193('0x3a')]));if(_0x21787a[_0x9193('0xa4')]===-0x1){return _0x21787a;}return this['channel'][_0x9193('0xab')](util['format'](_0x9193('0xc9'),'AGI',_0x1afd44));};AGIVertices['prototype'][_0x9193('0x1c3')]=function(_0x1f8843){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x1c4'),_0x1f8843[_0x9193('0xaa')]));var _0x44180=this['shellCommand'][_0x9193('0xa8')](this,_0x1f8843['command']);this[_0x9193('0x37')][_0x9193('0xa8')](this,_0x1f8843,_0x1f8843[_0x9193('0xb8')]);if(this[_0x9193('0x84')](_0x1f8843[_0x9193('0xdd')])){var _0x88acd6=this[_0x9193('0x12')][_0x9193('0xa8')](this,_0x1f8843[_0x9193('0xdd')]);if(_0x88acd6){this[_0x9193('0xf')]['setVariable'](_0x88acd6,_0x44180);return this['channel'][_0x9193('0xab')](util['format'](_0x9193('0x1c5'),_0x1f8843[_0x9193('0xb8')],_0x88acd6));}}return this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x1c6'),_0x1f8843[_0x9193('0xb8')]));};AGIVertices[_0x9193('0x11')][_0x9193('0x1c7')]=function(_0x140b17){logger['info'](util['format'](_0x9193('0x1c8'),_0x140b17[_0x9193('0xaa')]));_0x140b17['text']=_0x140b17[_0x9193('0x5a')][_0x9193('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9193('0x84')](_0x140b17['apiKey'])){return this[_0x9193('0xf')][_0x9193('0xab')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x140b17[_0x9193('0x5a')])){return this['channel'][_0x9193('0xab')](_0x9193('0xac'));}this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x140b17['text']));var _0x1dd201=this[_0x9193('0x57')][_0x9193('0xa8')](this,_0x140b17);if(_0x1dd201){this[_0x9193('0xf')][_0x9193('0xab')](util['format'](_0x9193('0x1c9'),_0x1dd201));var _0x4df5d3=this['channel'][_0x9193('0x1ca')](_0x1dd201);try{fs[_0x9193('0x109')](_0x1dd201+_0x9193('0x10a'));}catch(_0x5f571b){logger['error'](_0x5f571b);}return _0x4df5d3;}return this[_0x9193('0xf')]['error'](_0x140b17,_0x9193('0x1cb'));};AGIVertices[_0x9193('0x11')]['tts']=function(_0x4cd076){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x1cc'),_0x4cd076['label']));_0x4cd076[_0x9193('0x5a')]=_0x4cd076[_0x9193('0x5a')][_0x9193('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9193('0x84')](_0x4cd076[_0x9193('0x5a')])){return this[_0x9193('0xf')]['noop'](_0x9193('0xac'));}this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x1cd'),_0x4cd076[_0x9193('0x5a')]));var _0x52679c=this[_0x9193('0x61')][_0x9193('0xa8')](this,_0x4cd076);if(_0x52679c){this[_0x9193('0xf')][_0x9193('0xab')](util[_0x9193('0x9d')]('Google\x20TTS\x20%s\x20file\x20created',_0x52679c));var _0x45ee40=this['channel'][_0x9193('0x1ca')](_0x52679c);try{fs[_0x9193('0x109')](_0x52679c+_0x9193('0x10a'));}catch(_0x190acc){logger[_0x9193('0x2d')](_0x190acc);}return _0x45ee40;}return this['channel'][_0x9193('0x2d')](_0x4cd076,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x9193('0x1ce')]=function(_0x215f0b){logger['info'](util[_0x9193('0x9d')](_0x9193('0x1cf'),_0x215f0b[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x215f0b[_0x9193('0x15d')])){return this['channel']['error'](_0x215f0b,_0x9193('0x15e'));}logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x165'),this[_0x9193('0xf')][_0x9193('0x3b')],_0x215f0b[_0x9193('0x15d')]));var _0x532778=this[_0x9193('0x4f')]['sync'](this,_0x215f0b[_0x9193('0x15d')]);if(_0x532778){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x15f'),this[_0x9193('0xf')]['callerid'],_0x215f0b['findBy']));this['channel'][_0x9193('0xab')](util['format'](_0x9193('0x15f'),this[_0x9193('0xf')]['callerid'],_0x215f0b['findBy']));return{'code':0xc8,'result':_0x9193('0x160')};}else{logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x161'),this[_0x9193('0xf')][_0x9193('0x3b')],_0x215f0b[_0x9193('0x15d')]));this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')](_0x9193('0x161'),this[_0x9193('0xf')][_0x9193('0x3b')],_0x215f0b[_0x9193('0x15d')]));return{'code':0xc8,'result':_0x9193('0x162')};}};AGIVertices[_0x9193('0x11')][_0x9193('0x1d0')]=function(_0x1992e2){logger[_0x9193('0x2f')](util['format'](_0x9193('0x1d1'),_0x1992e2[_0x9193('0xaa')]));var _0x10719b=this[_0x9193('0xf')][_0x9193('0x54')](_0x9193('0x1d2'),[_0x1992e2[_0x9193('0x1d3')],_0x1992e2[_0x9193('0x77')]]);if(_0x10719b['result']===-0x1){return _0x10719b;}return this['channel'][_0x9193('0xab')](util[_0x9193('0x9d')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x1992e2[_0x9193('0x1d3')]));};AGIVertices[_0x9193('0x11')][_0x9193('0x1d4')]=function(_0x29e7c9){logger[_0x9193('0x2f')](util[_0x9193('0x9d')](_0x9193('0x1d5'),_0x29e7c9[_0x9193('0xaa')]));if(!this[_0x9193('0x84')](_0x29e7c9[_0x9193('0xdd')])){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x29e7c9,_0x9193('0x1b4'));}var _0x2c59b1=this[_0x9193('0x12')][_0x9193('0xa8')](this,_0x29e7c9[_0x9193('0xdd')]);if(!_0x2c59b1){return this[_0x9193('0xf')][_0x9193('0x2d')](_0x29e7c9,_0x9193('0xde'));}var _0x2ecced=this['channel'][_0x9193('0x12')](_0x2c59b1);return{'code':0xc8,'result':_0x2ecced[_0x9193('0xa6')]?_0x2ecced[_0x9193('0xa6')]:'-'};};String[_0x9193('0x11')][_0x9193('0xa2')]=function(_0x559c49,_0x311826){return this[_0x9193('0xa1')](_0x559c49)['join'](_0x311826);};module[_0x9193('0x1d6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c18e931..f8da87d 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 _0x023b=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','uniqueid','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x023b,0x122));var _0xb023=function(_0x2177bb,_0x4dd1c1){_0x2177bb=_0x2177bb-0x0;var _0x50d7cb=_0x023b[_0x2177bb];return _0x50d7cb;};'use strict';var util=require(_0xb023('0x0'));var _=require(_0xb023('0x1'));var moment=require('moment');var ami=require(_0xb023('0x2'));var logger=require(_0xb023('0x3'))(_0xb023('0x4'));var RpcUser=require(_0xb023('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4d6fa8){this[_0xb023('0x6')]=_0x4d6fa8[_0xb023('0x6')];this[_0xb023('0x7')]=_0x4d6fa8['agents'];this[_0xb023('0x8')]=_0x4d6fa8[_0xb023('0x8')];this[_0xb023('0x9')]={};ami['on'](_0xb023('0xa'),this[_0xb023('0xb')][_0xb023('0xc')](this));ami['on'](_0xb023('0xd'),this['syncHangupRequest'][_0xb023('0xc')](this));ami['on'](_0xb023('0xe'),this['syncHangup'][_0xb023('0xc')](this));ami['on'](_0xb023('0xf'),this[_0xb023('0x10')]['bind'](this));ami['on'](_0xb023('0x11'),this[_0xb023('0x12')]['bind'](this));ami['on'](_0xb023('0x13'),this[_0xb023('0x14')][_0xb023('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xb023('0x15')][_0xb023('0xc')](this));}function getDiff(_0x4a52ef){var _0x14c165=moment()[_0xb023('0x16')](0x0);var _0x2dc5f2=moment(_0x4a52ef)[_0xb023('0x16')](0x0);return _0x14c165['diff'](_0x2dc5f2,_0xb023('0x17'));}Acw['prototype'][_0xb023('0x18')]=function(_0x101724){try{var _0xe0863f=this;var _0x8c0808=this[_0xb023('0x9')][_0x101724][_0xb023('0x19')];var _0x46d12c=this[_0xb023('0x9')][_0x101724][_0xb023('0x1a')];var _0x2d88ff=this[_0xb023('0x6')][_0x46d12c];var _0xfcd5e7=![];var _0xbd306c=_0xb023('0x1b');if(_0x2d88ff[_0xb023('0x1c')]){if(_0x2d88ff[_0xb023('0x1d')][_0xb023('0x1e')]){_0xfcd5e7=!![];_0xbd306c=_0x2d88ff[_0xb023('0x1d')][_0xb023('0x1e')];}}ami[_0xb023('0x1f')]({'action':'QueuePause','interface':_0x8c0808,'paused':!![],'reason':_0xbd306c})['then'](function(_0x211e95){if(_0xe0863f[_0xb023('0x7')][_0x8c0808]){return RpcUser[_0xb023('0x20')](_0xe0863f[_0xb023('0x7')][_0x8c0808]['id'])[_0xb023('0x21')](function(_0x205041){if(_0x205041&&!_0x205041[_0xb023('0x22')]){logger[_0xb023('0x23')](_0xb023('0x24'),_0x101724,_0x8c0808,_0x46d12c);var _0x2435bf=_0xe0863f[_0xb023('0x9')][_0x101724][_0xb023('0x25')]&&_0xe0863f[_0xb023('0x9')][_0x101724][_0xb023('0x26')]?_0xe0863f['channels'][_0x101724]['destlinkedid']:_0x101724;return RpcUser[_0xb023('0x27')](_0xe0863f[_0xb023('0x7')][_0x8c0808],_0xbd306c,_0x2435bf)['then'](function(_0x4f59c1){if(!_0xfcd5e7){_0xe0863f['timers'][_0x8c0808]={};logger[_0xb023('0x23')](_0xb023('0x28'),_0x101724,_0xe0863f[_0xb023('0x6')][_0x46d12c][_0xb023('0x29')],_0x8c0808,_0x46d12c);_0xe0863f[_0xb023('0x8')][_0x8c0808][_0xb023('0x2a')]=setTimeout(_0xe0863f[_0xb023('0x2b')]['bind'](_0xe0863f,_0x8c0808),_0xe0863f[_0xb023('0x6')][_0x46d12c][_0xb023('0x29')]*0x3e8);_0xe0863f['timers'][_0x8c0808]['lastPauseAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe0863f[_0xb023('0x8')][_0x8c0808][_0xb023('0x2c')]=_0x101724;_0xe0863f[_0xb023('0x8')][_0x8c0808][_0xb023('0x1a')]=_0x46d12c;_0xe0863f[_0xb023('0x8')][_0x8c0808]['updateAcw']=function(){var _0x30fb37=getDiff(_0xe0863f['timers'][_0x8c0808][_0xb023('0x2d')]);clearTimeout(_0xe0863f['timers'][_0x8c0808]['timer']);_0xe0863f[_0xb023('0x8')][_0x8c0808]['timer']=![];RpcVoiceAgentReport[_0xb023('0x2e')]({'acwtime':_0x30fb37},_0xe0863f[_0xb023('0x8')][_0x8c0808][_0xb023('0x2c')],_0x8c0808)[_0xb023('0x21')](function(_0x47793c){logger[_0xb023('0x23')](_0xb023('0x2f'),_0x101724,_0x30fb37,_0x47793c);})['catch'](function(_0x237408){logger[_0xb023('0x30')](_0xb023('0x31'),_0x101724,_0x237408);});delete _0xe0863f[_0xb023('0x8')][_0x8c0808];};}});}else{logger[_0xb023('0x23')](_0xb023('0x32'),_0x101724,_0x8c0808,_0x46d12c);}});}})[_0xb023('0x33')](function(_0x57b4b6){logger['error'](_0xb023('0x28'),_0x101724,_0xe0863f['voiceQueues'][_0x46d12c][_0xb023('0x29')],_0x8c0808,_0x46d12c);})[_0xb023('0x34')](function(){delete _0xe0863f[_0xb023('0x9')][_0x101724];});}catch(_0x5f0236){logger[_0xb023('0x30')](_0xb023('0x35'),_0x5f0236['message']);}};Acw[_0xb023('0x36')][_0xb023('0x2b')]=function(_0x1e94ba){try{var _0x1e752e=this;if(_0x1e752e[_0xb023('0x8')][_0x1e94ba]){_0x1e752e[_0xb023('0x8')][_0x1e94ba]['timer']=![];var _0x368818=_0x1e752e[_0xb023('0x8')][_0x1e94ba]['uniqueid'];var _0x5c879c=_0x1e752e[_0xb023('0x8')][_0x1e94ba][_0xb023('0x1a')];var _0x319ea9=_0x1e752e[_0xb023('0x6')][_0x5c879c][_0xb023('0x29')];logger[_0xb023('0x23')](_0xb023('0x37'),_0x368818,_0x1e94ba);RpcUser[_0xb023('0x38')](this['agents'][_0x1e94ba]);RpcVoiceAgentReport[_0xb023('0x2e')]({'acwtime':_0x319ea9,'agentacw':!![]},_0x368818,_0x1e94ba)['then'](function(_0x380164){logger['info'](_0xb023('0x2f'),_0x368818,_0x319ea9,_0x380164);})[_0xb023('0x33')](function(_0x1a2249){logger[_0xb023('0x30')](_0xb023('0x31'),_0x368818,_0x1a2249);});}else{logger[_0xb023('0x30')](_0xb023('0x39'),_0x1e94ba);if(_0x1e752e[_0xb023('0x8')]){logger['info'](_0xb023('0x3a'),JSON[_0xb023('0x3b')](_0x1e752e[_0xb023('0x8')]));}}}catch(_0x225997){logger[_0xb023('0x30')]('[ACW][STOP]\x20%s',_0x225997[_0xb023('0x3c')]);}};Acw[_0xb023('0x36')]['syncAgentConnect']=function(_0x15eecf){try{if(this[_0xb023('0x6')][_0x15eecf[_0xb023('0x1a')]]&&(this[_0xb023('0x6')][_0x15eecf[_0xb023('0x1a')]][_0xb023('0x4')]||this[_0xb023('0x6')][_0x15eecf[_0xb023('0x1a')]]['mandatoryDisposition'])){if(this[_0xb023('0x7')][_0x15eecf[_0xb023('0x19')]]){this[_0xb023('0x9')][_0x15eecf[_0xb023('0x2c')]]={'queue':_0x15eecf[_0xb023('0x1a')],'interface':_0x15eecf[_0xb023('0x19')],'destlinkedid':_0x15eecf[_0xb023('0x26')]};}}}catch(_0x3e1d0a){logger[_0xb023('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x3e1d0a[_0xb023('0x3c')]);}};Acw['prototype'][_0xb023('0x15')]=function(_0x2b1a21){try{if(this[_0xb023('0x6')][_0x2b1a21['queue']]&&(this[_0xb023('0x6')][_0x2b1a21[_0xb023('0x1a')]][_0xb023('0x4')]||this['voiceQueues'][_0x2b1a21['queue']][_0xb023('0x1c')])){if(this['agents'][_0x2b1a21['interface']]){this[_0xb023('0x9')][_0x2b1a21[_0xb023('0x2c')]]={'queue':_0x2b1a21[_0xb023('0x1a')],'interface':_0x2b1a21[_0xb023('0x19')]};}}}catch(_0x337fa6){logger[_0xb023('0x30')](_0xb023('0x3d'),_0x337fa6['message']);}};Acw[_0xb023('0x36')][_0xb023('0x3e')]=function(_0xbe4e88){try{if(this[_0xb023('0x9')][_0xbe4e88[_0xb023('0x2c')]]&&_['isUndefined'](this[_0xb023('0x9')][_0xbe4e88[_0xb023('0x2c')]][_0xb023('0x25')])){logger[_0xb023('0x23')](_0xb023('0x3f'),_0xbe4e88[_0xb023('0x2c')]);this[_0xb023('0x18')](_0xbe4e88[_0xb023('0x2c')]);}else if(this[_0xb023('0x9')][_0xbe4e88[_0xb023('0x40')]]&&_[_0xb023('0x41')](this[_0xb023('0x9')][_0xbe4e88[_0xb023('0x40')]][_0xb023('0x25')])){logger[_0xb023('0x23')]('[%s][HANGUP:LINKEDID]',_0xbe4e88[_0xb023('0x40')]);this[_0xb023('0x18')](_0xbe4e88[_0xb023('0x40')]);}}catch(_0x4f1dd6){logger[_0xb023('0x30')](_0xb023('0x42'),_0x4f1dd6[_0xb023('0x3c')]);}};Acw['prototype'][_0xb023('0x43')]=function(_0x249912){try{if(this[_0xb023('0x9')][_0x249912['uniqueid']]&&this['channels'][_0x249912[_0xb023('0x2c')]]['attended']){logger['info'](_0xb023('0x44'),_0x249912[_0xb023('0x2c')]);this[_0xb023('0x18')](_0x249912['uniqueid']);}else if(this['channels'][_0x249912[_0xb023('0x40')]]&&this['channels'][_0x249912['linkedid']]['attended']){logger[_0xb023('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x249912[_0xb023('0x40')]);this[_0xb023('0x18')](_0x249912[_0xb023('0x40')]);}}catch(_0x25cfdc){logger[_0xb023('0x30')](_0xb023('0x45'),_0x25cfdc['message']);}};Acw[_0xb023('0x36')]['syncAttendedTransfer']=function(_0x90cadd){try{if(!_[_0xb023('0x46')](this[_0xb023('0x9')][_0x90cadd['transfereeuniqueid']])){this['startAcw'](_0x90cadd[_0xb023('0x47')]);if(this['channels'][_0x90cadd['secondtransfereruniqueid']]){this[_0xb023('0x9')][_0x90cadd['secondtransfereruniqueid']][_0xb023('0x25')]=!![];this[_0xb023('0x9')][_0x90cadd[_0xb023('0x48')]]=this[_0xb023('0x9')][_0x90cadd['secondtransfereruniqueid']];delete this[_0xb023('0x9')][_0x90cadd[_0xb023('0x49')]];}}else if(!_['isNil'](this[_0xb023('0x9')][_0x90cadd[_0xb023('0x48')]])){this['startAcw'](_0x90cadd['transfertargetuniqueid']);if(this[_0xb023('0x9')][_0x90cadd[_0xb023('0x4a')]]){this[_0xb023('0x9')][_0x90cadd[_0xb023('0x4a')]][_0xb023('0x25')]=!![];this[_0xb023('0x9')][_0x90cadd[_0xb023('0x47')]]=this[_0xb023('0x9')][_0x90cadd[_0xb023('0x4a')]];delete this['channels'][_0x90cadd['origtransfereruniqueid']];}}}catch(_0x415b2e){logger['error'](_0xb023('0x4b'),_0x415b2e[_0xb023('0x3c')]);}};Acw[_0xb023('0x36')][_0xb023('0x14')]=function(_0x4d8e95){try{if(this[_0xb023('0x9')][_0x4d8e95['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x4d8e95[_0xb023('0x4c')]));this[_0xb023('0x18')](_0x4d8e95[_0xb023('0x4c')]);}else if(this[_0xb023('0x9')][_0x4d8e95[_0xb023('0x4d')]]){logger[_0xb023('0x23')](_0xb023('0x4e'),JSON[_0xb023('0x3b')](_0x4d8e95[_0xb023('0x4d')]));this[_0xb023('0x18')](_0x4d8e95[_0xb023('0x4d')]);}}catch(_0x35d71b){logger[_0xb023('0x30')](_0xb023('0x4f'),_0x35d71b[_0xb023('0x3c')]);}};Acw[_0xb023('0x36')]['syncAgentRingNoAnswer']=function(_0x19b1c0){try{if(this['voiceQueues'][_0x19b1c0[_0xb023('0x1a')]]&&this[_0xb023('0x6')][_0x19b1c0[_0xb023('0x1a')]][_0xb023('0x50')]===_0xb023('0x51')){if(this[_0xb023('0x7')][_0x19b1c0[_0xb023('0x19')]]){logger[_0xb023('0x23')](_0xb023('0x52'),_0x19b1c0[_0xb023('0x2c')],_0x19b1c0['interface'],_0x19b1c0[_0xb023('0x1a')]);return RpcUser[_0xb023('0x27')](this[_0xb023('0x7')][_0x19b1c0[_0xb023('0x19')]],'Auto-Pause',_0x19b1c0[_0xb023('0x2c')]);}}}catch(_0x2ab965){logger[_0xb023('0x30')](_0xb023('0x53'),_0x2ab965[_0xb023('0x3c')]);}};module[_0xb023('0x54')]=Acw; \ No newline at end of file +var _0x7439=['linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','seconds','prototype','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x7439,0x171));var _0x9743=function(_0x557ca0,_0x234eca){_0x557ca0=_0x557ca0-0x0;var _0x29ea82=_0x7439[_0x557ca0];return _0x29ea82;};'use strict';var util=require(_0x9743('0x0'));var _=require(_0x9743('0x1'));var moment=require(_0x9743('0x2'));var ami=require('../ami');var logger=require(_0x9743('0x3'))(_0x9743('0x4'));var RpcUser=require(_0x9743('0x5'));var RpcVoiceAgentReport=require(_0x9743('0x6'));function Acw(_0x3f4358){this[_0x9743('0x7')]=_0x3f4358[_0x9743('0x7')];this['agents']=_0x3f4358[_0x9743('0x8')];this[_0x9743('0x9')]=_0x3f4358[_0x9743('0x9')];this['channels']={};ami['on'](_0x9743('0xa'),this[_0x9743('0xb')][_0x9743('0xc')](this));ami['on'](_0x9743('0xd'),this[_0x9743('0xe')]['bind'](this));ami['on'](_0x9743('0xf'),this[_0x9743('0x10')][_0x9743('0xc')](this));ami['on']('agentringnoanswer',this[_0x9743('0x11')][_0x9743('0xc')](this));ami['on'](_0x9743('0x12'),this[_0x9743('0x13')]['bind'](this));ami['on'](_0x9743('0x14'),this[_0x9743('0x15')][_0x9743('0xc')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x9743('0xc')](this));}function getDiff(_0x31ad83){var _0x284d92=moment()[_0x9743('0x16')](0x0);var _0x39738c=moment(_0x31ad83)[_0x9743('0x16')](0x0);return _0x284d92['diff'](_0x39738c,_0x9743('0x17'));}Acw[_0x9743('0x18')][_0x9743('0x19')]=function(_0x18afef){try{var _0x597e5b=this;var _0xdd9229=this[_0x9743('0x1a')][_0x18afef][_0x9743('0x1b')];var _0x5a5836=this[_0x9743('0x1a')][_0x18afef][_0x9743('0x1c')];var _0x4edd68=this[_0x9743('0x7')][_0x5a5836];var _0x39ce10=![];var _0x5392fb='ACW';if(_0x4edd68[_0x9743('0x1d')]){if(_0x4edd68[_0x9743('0x1e')][_0x9743('0x1f')]){_0x39ce10=!![];_0x5392fb=_0x4edd68[_0x9743('0x1e')][_0x9743('0x1f')];}}ami['Action']({'action':_0x9743('0x20'),'interface':_0xdd9229,'paused':!![],'reason':_0x5392fb})[_0x9743('0x21')](function(_0x8c9c17){if(_0x597e5b[_0x9743('0x8')][_0xdd9229]){return RpcUser[_0x9743('0x22')](_0x597e5b['agents'][_0xdd9229]['id'])[_0x9743('0x21')](function(_0x3da78e){if(_0x3da78e&&!_0x3da78e[_0x9743('0x23')]){logger[_0x9743('0x24')](_0x9743('0x25'),_0x18afef,_0xdd9229,_0x5a5836);var _0x353c88=_0x597e5b[_0x9743('0x1a')][_0x18afef][_0x9743('0x26')]&&_0x597e5b[_0x9743('0x1a')][_0x18afef][_0x9743('0x27')]?_0x597e5b['channels'][_0x18afef][_0x9743('0x27')]:_0x18afef;return RpcUser[_0x9743('0x28')](_0x597e5b[_0x9743('0x8')][_0xdd9229],_0x5392fb,_0x353c88)[_0x9743('0x21')](function(_0x284343){if(!_0x39ce10){_0x597e5b[_0x9743('0x9')][_0xdd9229]={};logger[_0x9743('0x24')](_0x9743('0x29'),_0x18afef,_0x597e5b[_0x9743('0x7')][_0x5a5836][_0x9743('0x2a')],_0xdd9229,_0x5a5836);_0x597e5b['timers'][_0xdd9229][_0x9743('0x2b')]=setTimeout(_0x597e5b[_0x9743('0x2c')][_0x9743('0xc')](_0x597e5b,_0xdd9229),_0x597e5b[_0x9743('0x7')][_0x5a5836][_0x9743('0x2a')]*0x3e8);_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x2d')]=moment()[_0x9743('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x597e5b[_0x9743('0x9')][_0xdd9229]['uniqueid']=_0x18afef;_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x1c')]=_0x5a5836;_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x2f')]=function(){var _0x5c54a8=getDiff(_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x2d')]);clearTimeout(_0x597e5b['timers'][_0xdd9229]['timer']);_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x2b')]=![];RpcVoiceAgentReport[_0x9743('0x30')]({'acwtime':_0x5c54a8},_0x597e5b[_0x9743('0x9')][_0xdd9229][_0x9743('0x31')],_0xdd9229)[_0x9743('0x21')](function(_0x192878){logger[_0x9743('0x24')](_0x9743('0x32'),_0x18afef,_0x5c54a8,_0x192878);})[_0x9743('0x33')](function(_0xb52db7){logger[_0x9743('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x18afef,_0xb52db7);});delete _0x597e5b[_0x9743('0x9')][_0xdd9229];};}});}else{logger[_0x9743('0x24')](_0x9743('0x35'),_0x18afef,_0xdd9229,_0x5a5836);}});}})['catch'](function(_0x5a2e94){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x18afef,_0x597e5b[_0x9743('0x7')][_0x5a5836]['acwTimeout'],_0xdd9229,_0x5a5836);})[_0x9743('0x36')](function(){delete _0x597e5b[_0x9743('0x1a')][_0x18afef];});}catch(_0xaa4254){logger[_0x9743('0x34')]('[ACW][START]\x20%s',_0xaa4254[_0x9743('0x37')]);}};Acw[_0x9743('0x18')][_0x9743('0x2c')]=function(_0x34d162){try{var _0x426c53=this;if(_0x426c53['timers'][_0x34d162]){_0x426c53['timers'][_0x34d162][_0x9743('0x2b')]=![];var _0x213b6b=_0x426c53[_0x9743('0x9')][_0x34d162]['uniqueid'];var _0x5e9157=_0x426c53[_0x9743('0x9')][_0x34d162]['queue'];var _0x165d10=_0x426c53['voiceQueues'][_0x5e9157][_0x9743('0x2a')];logger[_0x9743('0x24')]('[%s][TIMER][STOP][AGENT:%s]',_0x213b6b,_0x34d162);RpcUser[_0x9743('0x38')](this[_0x9743('0x8')][_0x34d162]);RpcVoiceAgentReport[_0x9743('0x30')]({'acwtime':_0x165d10,'agentacw':!![]},_0x213b6b,_0x34d162)[_0x9743('0x21')](function(_0x2e91a6){logger[_0x9743('0x24')](_0x9743('0x32'),_0x213b6b,_0x165d10,_0x2e91a6);})[_0x9743('0x33')](function(_0x298bc1){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x213b6b,_0x298bc1);});}else{logger[_0x9743('0x34')](_0x9743('0x39'),_0x34d162);if(_0x426c53['timers']){logger[_0x9743('0x24')](_0x9743('0x3a'),JSON[_0x9743('0x3b')](_0x426c53['timers']));}}}catch(_0x4f0f70){logger[_0x9743('0x34')](_0x9743('0x3c'),_0x4f0f70[_0x9743('0x37')]);}};Acw['prototype'][_0x9743('0xb')]=function(_0x5276a3){try{if(this[_0x9743('0x7')][_0x5276a3[_0x9743('0x1c')]]&&(this[_0x9743('0x7')][_0x5276a3['queue']][_0x9743('0x4')]||this['voiceQueues'][_0x5276a3[_0x9743('0x1c')]][_0x9743('0x1d')])){if(this[_0x9743('0x8')][_0x5276a3['interface']]){this[_0x9743('0x1a')][_0x5276a3['uniqueid']]={'queue':_0x5276a3['queue'],'interface':_0x5276a3[_0x9743('0x1b')],'destlinkedid':_0x5276a3[_0x9743('0x27')]};}}}catch(_0x36431c){logger[_0x9743('0x34')](_0x9743('0x3d'),_0x36431c['message']);}};Acw['prototype'][_0x9743('0x3e')]=function(_0x431ad8){try{if(this['voiceQueues'][_0x431ad8['queue']]&&(this['voiceQueues'][_0x431ad8['queue']][_0x9743('0x4')]||this['voiceQueues'][_0x431ad8[_0x9743('0x1c')]]['mandatoryDisposition'])){if(this[_0x9743('0x8')][_0x431ad8[_0x9743('0x1b')]]){this[_0x9743('0x1a')][_0x431ad8['uniqueid']]={'queue':_0x431ad8[_0x9743('0x1c')],'interface':_0x431ad8[_0x9743('0x1b')]};}}}catch(_0x635e5a){logger[_0x9743('0x34')](_0x9743('0x3f'),_0x635e5a[_0x9743('0x37')]);}};Acw[_0x9743('0x18')][_0x9743('0xe')]=function(_0x338dc1){try{if(this[_0x9743('0x1a')][_0x338dc1[_0x9743('0x31')]]&&_[_0x9743('0x40')](this[_0x9743('0x1a')][_0x338dc1[_0x9743('0x31')]][_0x9743('0x26')])){logger[_0x9743('0x24')](_0x9743('0x41'),_0x338dc1['uniqueid']);this['startAcw'](_0x338dc1[_0x9743('0x31')]);}else if(this[_0x9743('0x1a')][_0x338dc1[_0x9743('0x42')]]&&_[_0x9743('0x40')](this['channels'][_0x338dc1['linkedid']][_0x9743('0x26')])){logger[_0x9743('0x24')](_0x9743('0x43'),_0x338dc1['linkedid']);this[_0x9743('0x19')](_0x338dc1[_0x9743('0x42')]);}}catch(_0x18a3f7){logger[_0x9743('0x34')](_0x9743('0x44'),_0x18a3f7[_0x9743('0x37')]);}};Acw[_0x9743('0x18')][_0x9743('0x10')]=function(_0x4f152f){try{if(this[_0x9743('0x1a')][_0x4f152f['uniqueid']]&&this['channels'][_0x4f152f[_0x9743('0x31')]][_0x9743('0x26')]){logger['info'](_0x9743('0x45'),_0x4f152f[_0x9743('0x31')]);this[_0x9743('0x19')](_0x4f152f[_0x9743('0x31')]);}else if(this[_0x9743('0x1a')][_0x4f152f[_0x9743('0x42')]]&&this[_0x9743('0x1a')][_0x4f152f[_0x9743('0x42')]][_0x9743('0x26')]){logger[_0x9743('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4f152f[_0x9743('0x42')]);this[_0x9743('0x19')](_0x4f152f[_0x9743('0x42')]);}}catch(_0x3a1c60){logger[_0x9743('0x34')]('[ACW][syncHangup]\x20%s',_0x3a1c60[_0x9743('0x37')]);}};Acw[_0x9743('0x18')][_0x9743('0x13')]=function(_0x5388fb){try{if(!_[_0x9743('0x46')](this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x47')]])){this[_0x9743('0x19')](_0x5388fb[_0x9743('0x47')]);if(this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x48')]]){this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x48')]]['attended']=!![];this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x49')]]=this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x48')]];delete this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x48')]];}}else if(!_[_0x9743('0x46')](this['channels'][_0x5388fb[_0x9743('0x49')]])){this[_0x9743('0x19')](_0x5388fb[_0x9743('0x49')]);if(this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x4a')]]){this[_0x9743('0x1a')][_0x5388fb['origtransfereruniqueid']][_0x9743('0x26')]=!![];this[_0x9743('0x1a')][_0x5388fb['transfereeuniqueid']]=this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x4a')]];delete this[_0x9743('0x1a')][_0x5388fb[_0x9743('0x4a')]];}}}catch(_0x392203){logger[_0x9743('0x34')](_0x9743('0x4b'),_0x392203['message']);}};Acw[_0x9743('0x18')][_0x9743('0x15')]=function(_0xe3e46e){try{if(this[_0x9743('0x1a')][_0xe3e46e[_0x9743('0x4c')]]){logger[_0x9743('0x24')](_0x9743('0x4d'),JSON[_0x9743('0x3b')](_0xe3e46e[_0x9743('0x4c')]));this[_0x9743('0x19')](_0xe3e46e['transfereruniqueid']);}else if(this[_0x9743('0x1a')][_0xe3e46e[_0x9743('0x4e')]]){logger['info'](_0x9743('0x4f'),JSON[_0x9743('0x3b')](_0xe3e46e[_0x9743('0x4e')]));this[_0x9743('0x19')](_0xe3e46e[_0x9743('0x4e')]);}}catch(_0x514159){logger[_0x9743('0x34')](_0x9743('0x50'),_0x514159['message']);}};Acw[_0x9743('0x18')][_0x9743('0x11')]=function(_0x5be7a4){try{if(this[_0x9743('0x7')][_0x5be7a4['queue']]&&this[_0x9743('0x7')][_0x5be7a4[_0x9743('0x1c')]][_0x9743('0x51')]===_0x9743('0x52')){if(this[_0x9743('0x8')][_0x5be7a4['interface']]){logger[_0x9743('0x24')](_0x9743('0x53'),_0x5be7a4[_0x9743('0x31')],_0x5be7a4['interface'],_0x5be7a4['queue']);return RpcUser[_0x9743('0x28')](this['agents'][_0x5be7a4[_0x9743('0x1b')]],_0x9743('0x54'),_0x5be7a4[_0x9743('0x31')]);}}}catch(_0x67293e){logger[_0x9743('0x34')](_0x9743('0x55'),_0x67293e[_0x9743('0x37')]);}};module[_0x9743('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 82a4c7b..29370a9 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 _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x300b66,_0x20a74f){var _0x55bc87=function(_0x13f917){while(--_0x13f917){_0x300b66['push'](_0x300b66['shift']());}};_0x55bc87(++_0x20a74f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb7e7[_0x1ae5ab];return _0x1ce001;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x4b50c1,_0x5433d9){var _0x209630=function(_0x5a3e1d){while(--_0x5a3e1d){_0x4b50c1['push'](_0x4b50c1['shift']());}};_0x209630(++_0x5433d9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x0b0e[_0x34c4e1];return _0x5a11ef;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),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 ccecfd7..36490e2 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x29da70,_0x171489){_0x29da70=_0x29da70-0x0;var _0x173a29=_0x70e0[_0x29da70];return _0x173a29;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x439710,_0xd22e69){var _0x58ca09=function(_0x11beed){while(--_0x11beed){_0x439710['push'](_0x439710['shift']());}};_0x58ca09(++_0xd22e69);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('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 f301dda..5ac8b9b 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 _0x9fb9=['number','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','queue','name','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring'];(function(_0x7f537c,_0x20bf3f){var _0x268f99=function(_0x475a36){while(--_0x475a36){_0x7f537c['push'](_0x7f537c['shift']());}};_0x268f99(++_0x20bf3f);}(_0x9fb9,0xcb));var _0x99fb=function(_0x213ce3,_0x7df1ee){_0x213ce3=_0x213ce3-0x0;var _0x2f00ee=_0x9fb9[_0x213ce3];return _0x2f00ee;};'use strict';var util=require('util');var _=require(_0x99fb('0x0'));var moment=require('moment');function checkNameSurname(_0x5af42b,_0x71ad0d,_0x159b69){var _0x406a1d='';if(!_[_0x99fb('0x1')](_0x71ad0d)&&'string'===typeof _0x71ad0d){_0x406a1d+=_0x71ad0d;}if(!_['isNil'](_0x159b69)&&_0x99fb('0x2')===typeof _0x159b69){_0x406a1d+='\x20'+_0x159b69;}if(_0x406a1d!==''){return _0x406a1d;}return _0x5af42b;}function Action(_0x5ac72c,_0x40c066,_0x28163e){this[_0x99fb('0x3')]=_0x5ac72c;this[_0x99fb('0x4')]=_0x28163e||undefined;this['name']=checkNameSurname(_0x40c066[_0x99fb('0x5')][_0x99fb('0x6')],_0x40c066[_0x99fb('0x5')][_0x99fb('0x7')],_0x40c066[_0x99fb('0x5')][_0x99fb('0x8')]);this['number']=_0x40c066[_0x99fb('0x5')][_0x99fb('0x6')];this[_0x99fb('0x9')]=_0x5ac72c[_0x99fb('0xa')];this['active']=_0x40c066['active']||![];this[_0x99fb('0xb')]=_0x5ac72c['type'];this[_0x99fb('0xc')]=_0x5ac72c[_0x99fb('0xc')]||0x3;this[_0x99fb('0xd')]=_0x40c066['scheduledat'];this['countbusyretry']=_0x40c066['countbusyretry'];this['countcongestionretry']=_0x40c066[_0x99fb('0xe')];this[_0x99fb('0xf')]=_0x40c066[_0x99fb('0xf')];this['countnosuchnumberretry']=_0x40c066['countnosuchnumberretry'];this['countdropretry']=_0x40c066['countdropretry'];this[_0x99fb('0x10')]=_0x40c066['countabandonedretry'];this[_0x99fb('0x11')]=_0x40c066[_0x99fb('0x11')];this[_0x99fb('0x12')]=_0x40c066['countagentrejectretry'];this['ContactId']=_0x40c066[_0x99fb('0x13')];this[_0x99fb('0x14')]=_0x40c066[_0x99fb('0x14')];this['UserId']=_0x40c066[_0x99fb('0x15')];this['VoiceQueueId']=_0x40c066['VoiceQueueId'];this['CampaignId']=_0x40c066[_0x99fb('0x16')];this['idHopper']=_0x40c066['id'];this[_0x99fb('0x17')]=_0x40c066[_0x99fb('0x5')][_0x99fb('0x7')]||'';this[_0x99fb('0x18')]=moment()[_0x99fb('0x19')](_0x99fb('0x1a'));this[_0x99fb('0x1b')]=_0x40c066[_0x99fb('0x1b')];this['callbackuniqueid']=_0x40c066[_0x99fb('0x1c')];this[_0x99fb('0x1d')]=_0x40c066['callbackat'];this[_0x99fb('0x1e')]=_0x40c066[_0x99fb('0x1e')];this[_0x99fb('0x1f')]='';this[_0x99fb('0x20')]='';}Action[_0x99fb('0x21')][_0x99fb('0x22')]=function(){return util[_0x99fb('0x19')]('\x22%s\x22\x20<%s>',this[_0x99fb('0xa')],this[_0x99fb('0x3')][_0x99fb('0x23')]>0x0?this['number'][_0x99fb('0x24')](this[_0x99fb('0x3')][_0x99fb('0x23')]):this[_0x99fb('0x25')]);};Action[_0x99fb('0x21')][_0x99fb('0x26')]=function(){return this[_0x99fb('0x9')];};module[_0x99fb('0x27')]=Action; \ No newline at end of file +var _0x4503=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callbackuniqueid','callbackat','recallme','prototype','voiceQueue','dialCutDigit','substring','getQueue','queue','exports','lodash','moment','isNil','uniqueid','name','Contact','phone','number','active'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4503,0x14d));var _0x3450=function(_0x25da8c,_0x3eaf5a){_0x25da8c=_0x25da8c-0x0;var _0x3c8c4f=_0x4503[_0x25da8c];return _0x3c8c4f;};'use strict';var util=require('util');var _=require(_0x3450('0x0'));var moment=require(_0x3450('0x1'));function checkNameSurname(_0x38b6fd,_0x2eb4b3,_0x11712b){var _0x53be5a='';if(!_[_0x3450('0x2')](_0x2eb4b3)&&'string'===typeof _0x2eb4b3){_0x53be5a+=_0x2eb4b3;}if(!_[_0x3450('0x2')](_0x11712b)&&'string'===typeof _0x11712b){_0x53be5a+='\x20'+_0x11712b;}if(_0x53be5a!==''){return _0x53be5a;}return _0x38b6fd;}function Action(_0x56fd4c,_0x18d748,_0x259fc4){this['voiceQueue']=_0x56fd4c;this[_0x3450('0x3')]=_0x259fc4||undefined;this[_0x3450('0x4')]=checkNameSurname(_0x18d748[_0x3450('0x5')][_0x3450('0x6')],_0x18d748[_0x3450('0x5')]['firstName'],_0x18d748[_0x3450('0x5')]['lastName']);this[_0x3450('0x7')]=_0x18d748[_0x3450('0x5')][_0x3450('0x6')];this['queue']=_0x56fd4c['name'];this[_0x3450('0x8')]=_0x18d748[_0x3450('0x8')]||![];this[_0x3450('0x9')]=_0x56fd4c[_0x3450('0x9')];this[_0x3450('0xa')]=_0x56fd4c[_0x3450('0xa')]||0x3;this[_0x3450('0xb')]=_0x18d748[_0x3450('0xb')];this[_0x3450('0xc')]=_0x18d748[_0x3450('0xc')];this[_0x3450('0xd')]=_0x18d748['countcongestionretry'];this[_0x3450('0xe')]=_0x18d748[_0x3450('0xe')];this['countnosuchnumberretry']=_0x18d748['countnosuchnumberretry'];this[_0x3450('0xf')]=_0x18d748['countdropretry'];this[_0x3450('0x10')]=_0x18d748['countabandonedretry'];this[_0x3450('0x11')]=_0x18d748[_0x3450('0x11')];this[_0x3450('0x12')]=_0x18d748[_0x3450('0x12')];this['ContactId']=_0x18d748['ContactId'];this[_0x3450('0x13')]=_0x18d748[_0x3450('0x13')];this[_0x3450('0x14')]=_0x18d748['UserId'];this['VoiceQueueId']=_0x18d748[_0x3450('0x15')];this[_0x3450('0x16')]=_0x18d748[_0x3450('0x16')];this[_0x3450('0x17')]=_0x18d748['id'];this[_0x3450('0x18')]=_0x18d748[_0x3450('0x5')][_0x3450('0x19')]||'';this[_0x3450('0x1a')]=moment()[_0x3450('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x18d748['callback'];this[_0x3450('0x1c')]=_0x18d748['callbackuniqueid'];this[_0x3450('0x1d')]=_0x18d748[_0x3450('0x1d')];this[_0x3450('0x1e')]=_0x18d748[_0x3450('0x1e')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x3450('0x1f')]['getCaller']=function(){return util[_0x3450('0x1b')]('\x22%s\x22\x20<%s>',this[_0x3450('0x4')],this[_0x3450('0x20')][_0x3450('0x21')]>0x0?this['number'][_0x3450('0x22')](this[_0x3450('0x20')][_0x3450('0x21')]):this['number']);};Action[_0x3450('0x1f')][_0x3450('0x23')]=function(){return this[_0x3450('0x24')];};module[_0x3450('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 0659be6..072ff6d 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 _0xd26e=['type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat'];(function(_0x1298e7,_0x91dbcf){var _0x5f1c64=function(_0x182ffd){while(--_0x182ffd){_0x1298e7['push'](_0x1298e7['shift']());}};_0x5f1c64(++_0x91dbcf);}(_0xd26e,0xe7));var _0xed26=function(_0x156c45,_0x108903){_0x156c45=_0x156c45-0x0;var _0x2bee10=_0xd26e[_0x156c45];return _0x2bee10;};'use strict';var util=require(_0xed26('0x0'));var _=require(_0xed26('0x1'));var moment=require(_0xed26('0x2'));function getSeconds(_0x35d4da,_0x560e2a){var _0x53dd84=moment(_0x35d4da)['milliseconds'](0x0);var _0x5e2846=moment(_0x560e2a)[_0xed26('0x3')](0x0);return _0x53dd84['diff'](_0x5e2846,_0xed26('0x4'));}function AgentComplete(_0x3fbec9,_0x2e19f2){this[_0xed26('0x5')]=0x4;this[_0xed26('0x6')]=_0xed26('0x7');this[_0xed26('0x8')]=_0x3fbec9['scheduledat'];this[_0xed26('0x9')]=_0x3fbec9[_0xed26('0x9')];this['campaigntype']=_0x3fbec9[_0xed26('0x9')]===_0xed26('0xa')?'queue':_0x3fbec9['type'];this[_0xed26('0xb')]=_0x3fbec9['countbusyretry'];this[_0xed26('0xc')]=_0x3fbec9[_0xed26('0xc')];this[_0xed26('0xd')]=_0x3fbec9[_0xed26('0xd')];this[_0xed26('0xe')]=_0x3fbec9[_0xed26('0xb')]+_0x3fbec9[_0xed26('0xc')]+_0x3fbec9['countnoanswerretry']+_0x3fbec9['countnosuchnumberretry']+_0x3fbec9[_0xed26('0xf')]+_0x3fbec9[_0xed26('0x10')]+_0x3fbec9[_0xed26('0x11')]+_0x3fbec9[_0xed26('0x12')];this['countnosuchnumberretry']=_0x3fbec9[_0xed26('0x13')];this[_0xed26('0xf')]=_0x3fbec9[_0xed26('0xf')];this[_0xed26('0x10')]=_0x3fbec9[_0xed26('0x10')];this[_0xed26('0x11')]=_0x3fbec9[_0xed26('0x11')];this[_0xed26('0x12')]=_0x3fbec9['countagentrejectretry'];this[_0xed26('0x14')]=_0x2e19f2[_0xed26('0x14')];this['calleridname']=_0x3fbec9[_0xed26('0x15')];this[_0xed26('0x16')]=_0x3fbec9[_0xed26('0x17')];this[_0xed26('0x18')]=_0x3fbec9['starttime'];this['responsetime']=_0x3fbec9[_0xed26('0x19')];this[_0xed26('0x1a')]=_0x3fbec9[_0xed26('0x1a')];this[_0xed26('0x1b')]=moment()[_0xed26('0x1c')](_0xed26('0x1d'));this[_0xed26('0x1e')]=getSeconds(_0x3fbec9['responsetime'],_0x3fbec9['starttime']);this[_0xed26('0x1f')]=getSeconds(_0x3fbec9[_0xed26('0x1a')],_0x3fbec9[_0xed26('0x19')]);this[_0xed26('0x20')]=getSeconds(this['endtime'],_0x3fbec9[_0xed26('0x1a')]);this[_0xed26('0x21')]=_0x2e19f2[_0xed26('0x21')];this['membername']=_0x2e19f2[_0xed26('0x22')];this[_0xed26('0x23')]=_0x2e19f2[_0xed26('0x23')];this[_0xed26('0x24')]=_0x3fbec9[_0xed26('0x24')];this[_0xed26('0x25')]=_0x3fbec9['callbackuniqueid'];this[_0xed26('0x26')]=_0x3fbec9[_0xed26('0x26')];this['recallme']=_0x3fbec9[_0xed26('0x27')];this[_0xed26('0x28')]=_0x3fbec9[_0xed26('0x28')];this[_0xed26('0x29')]=_0x3fbec9[_0xed26('0x29')];this[_0xed26('0x2a')]=_0x3fbec9[_0xed26('0x2a')];this[_0xed26('0x2b')]=_0x3fbec9[_0xed26('0x2b')];this[_0xed26('0x2c')]=_0x3fbec9[_0xed26('0x2c')];this[_0xed26('0x2d')]=_0x3fbec9[_0xed26('0x2d')]||'';this[_0xed26('0x2e')]=_0x3fbec9[_0xed26('0x2e')]||'';}module[_0xed26('0x2f')]=AgentComplete; \ No newline at end of file +var _0xed4e=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xed4e,0x1ab));var _0xeed4=function(_0x1a00b1,_0x1a92b1){_0x1a00b1=_0x1a00b1-0x0;var _0x1d5f50=_0xed4e[_0x1a00b1];return _0x1d5f50;};'use strict';var util=require(_0xeed4('0x0'));var _=require('lodash');var moment=require(_0xeed4('0x1'));function getSeconds(_0x3fd1b9,_0x434530){var _0x30aee9=moment(_0x3fd1b9)['milliseconds'](0x0);var _0x42d325=moment(_0x434530)['milliseconds'](0x0);return _0x30aee9['diff'](_0x42d325,'seconds');}function AgentComplete(_0x1361f8,_0x4e7384){this[_0xeed4('0x2')]=0x4;this[_0xeed4('0x3')]=_0xeed4('0x4');this[_0xeed4('0x5')]=_0x1361f8[_0xeed4('0x5')];this['type']=_0x1361f8[_0xeed4('0x6')];this[_0xeed4('0x7')]=_0x1361f8[_0xeed4('0x6')]==='outbound'?_0xeed4('0x8'):_0x1361f8[_0xeed4('0x6')];this[_0xeed4('0x9')]=_0x1361f8[_0xeed4('0x9')];this['countcongestionretry']=_0x1361f8['countcongestionretry'];this['countnoanswerretry']=_0x1361f8['countnoanswerretry'];this[_0xeed4('0xa')]=_0x1361f8[_0xeed4('0x9')]+_0x1361f8['countcongestionretry']+_0x1361f8['countnoanswerretry']+_0x1361f8[_0xeed4('0xb')]+_0x1361f8[_0xeed4('0xc')]+_0x1361f8[_0xeed4('0xd')]+_0x1361f8[_0xeed4('0xe')]+_0x1361f8[_0xeed4('0xf')];this[_0xeed4('0xb')]=_0x1361f8[_0xeed4('0xb')];this['countdropretry']=_0x1361f8[_0xeed4('0xc')];this[_0xeed4('0xd')]=_0x1361f8[_0xeed4('0xd')];this[_0xeed4('0xe')]=_0x1361f8[_0xeed4('0xe')];this['countagentrejectretry']=_0x1361f8[_0xeed4('0xf')];this[_0xeed4('0x10')]=_0x4e7384[_0xeed4('0x10')];this[_0xeed4('0x11')]=_0x1361f8[_0xeed4('0x12')];this[_0xeed4('0x13')]=_0x1361f8[_0xeed4('0x14')];this[_0xeed4('0x15')]=_0x1361f8[_0xeed4('0x15')];this['responsetime']=_0x1361f8[_0xeed4('0x16')];this[_0xeed4('0x17')]=_0x1361f8['answertime'];this[_0xeed4('0x18')]=moment()[_0xeed4('0x19')](_0xeed4('0x1a'));this[_0xeed4('0x1b')]=getSeconds(_0x1361f8[_0xeed4('0x16')],_0x1361f8['starttime']);this['holdtime']=getSeconds(_0x1361f8[_0xeed4('0x17')],_0x1361f8['responsetime']);this[_0xeed4('0x1c')]=getSeconds(this[_0xeed4('0x18')],_0x1361f8['answertime']);this[_0xeed4('0x8')]=_0x4e7384['queue'];this[_0xeed4('0x1d')]=_0x4e7384[_0xeed4('0x1d')];this['reason']=_0x4e7384[_0xeed4('0x1e')];this[_0xeed4('0x1f')]=_0x1361f8[_0xeed4('0x1f')];this[_0xeed4('0x20')]=_0x1361f8[_0xeed4('0x20')];this[_0xeed4('0x21')]=_0x1361f8[_0xeed4('0x21')];this[_0xeed4('0x22')]=_0x1361f8['recallme'];this[_0xeed4('0x23')]=_0x1361f8['ContactId'];this[_0xeed4('0x24')]=_0x1361f8['ListId'];this[_0xeed4('0x25')]=_0x1361f8[_0xeed4('0x25')];this[_0xeed4('0x26')]=_0x1361f8[_0xeed4('0x26')];this[_0xeed4('0x27')]=_0x1361f8['CampaignId'];this['originatecalleridnum']=_0x1361f8[_0xeed4('0x28')]||'';this[_0xeed4('0x29')]=_0x1361f8['originatecalleridname']||'';}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 08746a9..335a9f1 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 _0x43fd=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname'];(function(_0x1a31e8,_0x5387bc){var _0x3adc72=function(_0x1997a3){while(--_0x1997a3){_0x1a31e8['push'](_0x1a31e8['shift']());}};_0x3adc72(++_0x5387bc);}(_0x43fd,0x1ec));var _0xd43f=function(_0x77601,_0x4a2c03){_0x77601=_0x77601-0x0;var _0x4d50a3=_0x43fd[_0x77601];return _0x4d50a3;};'use strict';var util=require('util');var _=require(_0xd43f('0x0'));var moment=require('moment');function getSeconds(_0x4ec617,_0x316ee5){var _0x1ead65=moment(_0x4ec617)['milliseconds'](0x0);var _0x3df2bd=moment(_0x316ee5)['milliseconds'](0x0);return _0x1ead65[_0xd43f('0x1')](_0x3df2bd,_0xd43f('0x2'));}function Final(_0x1d36b7){this[_0xd43f('0x3')]=_0x1d36b7['uniqueid'];this[_0xd43f('0x4')]=_0x1d36b7[_0xd43f('0x4')];this[_0xd43f('0x5')]=_0x1d36b7[_0xd43f('0x5')];this['campaigntype']=_0x1d36b7[_0xd43f('0x5')]===_0xd43f('0x6')?'queue':_0x1d36b7[_0xd43f('0x5')];this[_0xd43f('0x7')]=_0x1d36b7[_0xd43f('0x7')];this[_0xd43f('0x8')]=_0x1d36b7[_0xd43f('0x8')];this['countnoanswerretry']=_0x1d36b7[_0xd43f('0x9')];this[_0xd43f('0xa')]=_0x1d36b7[_0xd43f('0x7')]+_0x1d36b7[_0xd43f('0x8')]+_0x1d36b7[_0xd43f('0x9')]+_0x1d36b7[_0xd43f('0xb')]+_0x1d36b7[_0xd43f('0xc')]+_0x1d36b7[_0xd43f('0xd')]+_0x1d36b7[_0xd43f('0xe')]+_0x1d36b7[_0xd43f('0xf')];this[_0xd43f('0xb')]=_0x1d36b7['countnosuchnumberretry'];this[_0xd43f('0xc')]=_0x1d36b7[_0xd43f('0xc')];this[_0xd43f('0xd')]=_0x1d36b7['countabandonedretry'];this['countmachineretry']=_0x1d36b7['countmachineretry'];this[_0xd43f('0xf')]=_0x1d36b7[_0xd43f('0xf')];this['queue']=_0x1d36b7[_0xd43f('0x10')];this[_0xd43f('0x11')]=_0x1d36b7['calleridname'];this['calleridnum']=_0x1d36b7['calleridnum'];this['starttime']=_0x1d36b7[_0xd43f('0x12')];this[_0xd43f('0x13')]=_0x1d36b7['responsetime'];this[_0xd43f('0x14')]=_0x1d36b7[_0xd43f('0x13')];this[_0xd43f('0x15')]=_0x1d36b7[_0xd43f('0x15')]||0x0;this['holdtime']=_0x1d36b7[_0xd43f('0x16')]||0x0;this[_0xd43f('0x17')]=_0x1d36b7[_0xd43f('0x17')]||0x0;this['callback']=_0x1d36b7['callback'];this['callbackuniqueid']=_0x1d36b7[_0xd43f('0x18')];this[_0xd43f('0x19')]=_0x1d36b7[_0xd43f('0x19')];this[_0xd43f('0x1a')]=_0x1d36b7[_0xd43f('0x1a')];this[_0xd43f('0x1b')]=_0x1d36b7[_0xd43f('0x1b')];this['ListId']=_0x1d36b7[_0xd43f('0x1c')];this['UserId']=_0x1d36b7[_0xd43f('0x1d')];this['VoiceQueueId']=_0x1d36b7['VoiceQueueId'];this[_0xd43f('0x1e')]=_0x1d36b7[_0xd43f('0x1e')];this[_0xd43f('0x1f')]=_0x1d36b7[_0xd43f('0x1f')]||'';this[_0xd43f('0x20')]=_0x1d36b7[_0xd43f('0x20')]||'';}module[_0xd43f('0x21')]=Final; \ No newline at end of file +var _0x31c2=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x468606,_0x237dce){var _0x391e44=function(_0x4bac7c){while(--_0x4bac7c){_0x468606['push'](_0x468606['shift']());}};_0x391e44(++_0x237dce);}(_0x31c2,0x1e1));var _0x231c=function(_0x32bf8a,_0x4f0f9f){_0x32bf8a=_0x32bf8a-0x0;var _0x1f4194=_0x31c2[_0x32bf8a];return _0x1f4194;};'use strict';var util=require(_0x231c('0x0'));var _=require(_0x231c('0x1'));var moment=require(_0x231c('0x2'));function getSeconds(_0x143120,_0x1c57c9){var _0x7e36a0=moment(_0x143120)[_0x231c('0x3')](0x0);var _0x5a8f6b=moment(_0x1c57c9)['milliseconds'](0x0);return _0x7e36a0['diff'](_0x5a8f6b,_0x231c('0x4'));}function Final(_0x1b9d64){this[_0x231c('0x5')]=_0x1b9d64[_0x231c('0x5')];this['scheduledat']=_0x1b9d64[_0x231c('0x6')];this['type']=_0x1b9d64[_0x231c('0x7')];this[_0x231c('0x8')]=_0x1b9d64[_0x231c('0x7')]==='outbound'?_0x231c('0x9'):_0x1b9d64[_0x231c('0x7')];this[_0x231c('0xa')]=_0x1b9d64[_0x231c('0xa')];this[_0x231c('0xb')]=_0x1b9d64[_0x231c('0xb')];this[_0x231c('0xc')]=_0x1b9d64['countnoanswerretry'];this[_0x231c('0xd')]=_0x1b9d64[_0x231c('0xa')]+_0x1b9d64['countcongestionretry']+_0x1b9d64[_0x231c('0xc')]+_0x1b9d64[_0x231c('0xe')]+_0x1b9d64[_0x231c('0xf')]+_0x1b9d64[_0x231c('0x10')]+_0x1b9d64[_0x231c('0x11')]+_0x1b9d64[_0x231c('0x12')];this[_0x231c('0xe')]=_0x1b9d64[_0x231c('0xe')];this[_0x231c('0xf')]=_0x1b9d64[_0x231c('0xf')];this[_0x231c('0x10')]=_0x1b9d64[_0x231c('0x10')];this[_0x231c('0x11')]=_0x1b9d64[_0x231c('0x11')];this[_0x231c('0x12')]=_0x1b9d64[_0x231c('0x12')];this[_0x231c('0x9')]=_0x1b9d64[_0x231c('0x9')];this[_0x231c('0x13')]=_0x1b9d64[_0x231c('0x13')];this['calleridnum']=_0x1b9d64[_0x231c('0x14')];this[_0x231c('0x15')]=_0x1b9d64[_0x231c('0x15')];this[_0x231c('0x16')]=_0x1b9d64[_0x231c('0x16')];this[_0x231c('0x17')]=_0x1b9d64[_0x231c('0x16')];this[_0x231c('0x18')]=_0x1b9d64[_0x231c('0x18')]||0x0;this[_0x231c('0x19')]=_0x1b9d64['holdtime']||0x0;this[_0x231c('0x1a')]=_0x1b9d64['talktime']||0x0;this[_0x231c('0x1b')]=_0x1b9d64['callback'];this[_0x231c('0x1c')]=_0x1b9d64[_0x231c('0x1c')];this[_0x231c('0x1d')]=_0x1b9d64[_0x231c('0x1d')];this[_0x231c('0x1e')]=_0x1b9d64[_0x231c('0x1e')];this[_0x231c('0x1f')]=_0x1b9d64[_0x231c('0x1f')];this['ListId']=_0x1b9d64[_0x231c('0x20')];this[_0x231c('0x21')]=_0x1b9d64['UserId'];this[_0x231c('0x22')]=_0x1b9d64[_0x231c('0x22')];this['CampaignId']=_0x1b9d64[_0x231c('0x23')];this['originatecalleridnum']=_0x1b9d64[_0x231c('0x24')]||'';this[_0x231c('0x25')]=_0x1b9d64[_0x231c('0x25')]||'';}module[_0x231c('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a706ac3..959a393 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 _0xf868=['talktime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime'];(function(_0x2ed176,_0x57ec76){var _0x3b38af=function(_0x5982d2){while(--_0x5982d2){_0x2ed176['push'](_0x2ed176['shift']());}};_0x3b38af(++_0x57ec76);}(_0xf868,0x1e6));var _0x8f86=function(_0x47e476,_0x22c480){_0x47e476=_0x47e476-0x0;var _0x51c0cc=_0xf868[_0x47e476];return _0x51c0cc;};'use strict';var util=require(_0x8f86('0x0'));var _=require(_0x8f86('0x1'));var moment=require(_0x8f86('0x2'));function getSeconds(_0x5ca01e,_0x318eca){var _0x650334=moment(_0x5ca01e)[_0x8f86('0x3')](0x0);var _0xf62a12=moment(_0x318eca)[_0x8f86('0x3')](0x0);return _0x650334[_0x8f86('0x4')](_0xf62a12,_0x8f86('0x5'));}function Hangup(_0xd6ed73,_0x3ddc29){this['state']=0x4;this[_0x8f86('0x6')]='Answer';this['scheduledat']=_0xd6ed73[_0x8f86('0x7')];this['type']=_0xd6ed73[_0x8f86('0x8')];this[_0x8f86('0x9')]=_0xd6ed73['type']===_0x8f86('0xa')?'queue':_0xd6ed73[_0x8f86('0x8')];this['countbusyretry']=_0xd6ed73[_0x8f86('0xb')];this[_0x8f86('0xc')]=_0xd6ed73[_0x8f86('0xc')];this[_0x8f86('0xd')]=_0xd6ed73[_0x8f86('0xd')];this[_0x8f86('0xe')]=_0xd6ed73['countbusyretry']+_0xd6ed73[_0x8f86('0xc')]+_0xd6ed73['countnoanswerretry']+_0xd6ed73[_0x8f86('0xf')]+_0xd6ed73[_0x8f86('0x10')]+_0xd6ed73[_0x8f86('0x11')]+_0xd6ed73[_0x8f86('0x12')]+_0xd6ed73[_0x8f86('0x13')];this[_0x8f86('0xf')]=_0xd6ed73[_0x8f86('0xf')];this[_0x8f86('0x10')]=_0xd6ed73['countdropretry'];this[_0x8f86('0x11')]=_0xd6ed73[_0x8f86('0x11')];this[_0x8f86('0x12')]=_0xd6ed73[_0x8f86('0x12')];this[_0x8f86('0x13')]=_0xd6ed73[_0x8f86('0x13')];this[_0x8f86('0x14')]=_0x3ddc29[_0x8f86('0x14')];this['calleridname']=_0xd6ed73[_0x8f86('0x15')];this[_0x8f86('0x16')]=_0xd6ed73[_0x8f86('0x17')];this[_0x8f86('0x18')]=_0xd6ed73[_0x8f86('0x18')];this[_0x8f86('0x19')]=_0xd6ed73[_0x8f86('0x19')];this[_0x8f86('0x1a')]=moment()[_0x8f86('0x1b')](_0x8f86('0x1c'));this['ringtime']=getSeconds(_0xd6ed73[_0x8f86('0x19')],_0xd6ed73[_0x8f86('0x18')]);this[_0x8f86('0x1d')]=0x0;this[_0x8f86('0x1e')]=getSeconds(this[_0x8f86('0x1a')],_0xd6ed73[_0x8f86('0x19')]);this[_0x8f86('0x1f')]=_0xd6ed73['queue'];this[_0x8f86('0x20')]='IVR';this[_0x8f86('0x21')]=_0x3ddc29[_0x8f86('0x22')];this[_0x8f86('0x23')]=_0xd6ed73[_0x8f86('0x23')];this['callbackuniqueid']=_0xd6ed73[_0x8f86('0x24')];this[_0x8f86('0x25')]=_0xd6ed73[_0x8f86('0x25')];this[_0x8f86('0x26')]=_0xd6ed73[_0x8f86('0x26')];this[_0x8f86('0x27')]=_0xd6ed73[_0x8f86('0x27')];this[_0x8f86('0x28')]=_0xd6ed73[_0x8f86('0x28')];this[_0x8f86('0x29')]=_0xd6ed73[_0x8f86('0x29')];this[_0x8f86('0x2a')]=_0xd6ed73[_0x8f86('0x2a')];this['CampaignId']=_0xd6ed73['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0xb284=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb284,0x15a));var _0x4b28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb284[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x4b28('0x0'));var _=require('lodash');var moment=require(_0x4b28('0x1'));function getSeconds(_0xdf5efc,_0x689bba){var _0xbaf5ae=moment(_0xdf5efc)[_0x4b28('0x2')](0x0);var _0x283e14=moment(_0x689bba)[_0x4b28('0x2')](0x0);return _0xbaf5ae[_0x4b28('0x3')](_0x283e14,_0x4b28('0x4'));}function Hangup(_0x5bc44c,_0x385ab6){this[_0x4b28('0x5')]=0x4;this[_0x4b28('0x6')]=_0x4b28('0x7');this[_0x4b28('0x8')]=_0x5bc44c[_0x4b28('0x8')];this[_0x4b28('0x9')]=_0x5bc44c[_0x4b28('0x9')];this[_0x4b28('0xa')]=_0x5bc44c[_0x4b28('0x9')]===_0x4b28('0xb')?_0x4b28('0xc'):_0x5bc44c['type'];this[_0x4b28('0xd')]=_0x5bc44c[_0x4b28('0xd')];this['countcongestionretry']=_0x5bc44c[_0x4b28('0xe')];this[_0x4b28('0xf')]=_0x5bc44c[_0x4b28('0xf')];this[_0x4b28('0x10')]=_0x5bc44c[_0x4b28('0xd')]+_0x5bc44c[_0x4b28('0xe')]+_0x5bc44c['countnoanswerretry']+_0x5bc44c[_0x4b28('0x11')]+_0x5bc44c[_0x4b28('0x12')]+_0x5bc44c[_0x4b28('0x13')]+_0x5bc44c['countmachineretry']+_0x5bc44c[_0x4b28('0x14')];this[_0x4b28('0x11')]=_0x5bc44c[_0x4b28('0x11')];this[_0x4b28('0x12')]=_0x5bc44c[_0x4b28('0x12')];this['countabandonedretry']=_0x5bc44c['countabandonedretry'];this[_0x4b28('0x15')]=_0x5bc44c['countmachineretry'];this[_0x4b28('0x14')]=_0x5bc44c['countagentrejectretry'];this['uniqueid']=_0x385ab6[_0x4b28('0x16')];this[_0x4b28('0x17')]=_0x5bc44c[_0x4b28('0x18')];this[_0x4b28('0x19')]=_0x5bc44c[_0x4b28('0x1a')];this[_0x4b28('0x1b')]=_0x5bc44c['starttime'];this[_0x4b28('0x1c')]=_0x5bc44c[_0x4b28('0x1c')];this[_0x4b28('0x1d')]=moment()[_0x4b28('0x1e')](_0x4b28('0x1f'));this[_0x4b28('0x20')]=getSeconds(_0x5bc44c[_0x4b28('0x1c')],_0x5bc44c[_0x4b28('0x1b')]);this[_0x4b28('0x21')]=0x0;this['talktime']=getSeconds(this[_0x4b28('0x1d')],_0x5bc44c[_0x4b28('0x1c')]);this[_0x4b28('0xc')]=_0x5bc44c[_0x4b28('0xc')];this[_0x4b28('0x22')]='IVR';this[_0x4b28('0x23')]=_0x385ab6[_0x4b28('0x24')];this[_0x4b28('0x25')]=_0x5bc44c[_0x4b28('0x25')];this[_0x4b28('0x26')]=_0x5bc44c[_0x4b28('0x26')];this[_0x4b28('0x27')]=_0x5bc44c[_0x4b28('0x27')];this['recallme']=_0x5bc44c['recallme'];this[_0x4b28('0x28')]=_0x5bc44c['ContactId'];this[_0x4b28('0x29')]=_0x5bc44c[_0x4b28('0x29')];this[_0x4b28('0x2a')]=_0x5bc44c['UserId'];this[_0x4b28('0x2b')]=_0x5bc44c['VoiceQueueId'];this['CampaignId']=_0x5bc44c['CampaignId'];}module[_0x4b28('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d020d96..8fc1e4b 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 _0xe007=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x47e4f7,_0x3493c3){var _0x5b66bb=function(_0x93841e){while(--_0x93841e){_0x47e4f7['push'](_0x47e4f7['shift']());}};_0x5b66bb(++_0x3493c3);}(_0xe007,0x1c0));var _0x7e00=function(_0x272492,_0x23cae6){_0x272492=_0x272492-0x0;var _0x1c09d7=_0xe007[_0x272492];return _0x1c09d7;};'use strict';var util=require(_0x7e00('0x0'));var _=require(_0x7e00('0x1'));var moment=require(_0x7e00('0x2'));function getSeconds(_0x33bf86,_0x291684){var _0x18b16f=moment(_0x33bf86)[_0x7e00('0x3')](0x0);var _0x3daf63=moment(_0x291684)[_0x7e00('0x3')](0x0);return _0x18b16f[_0x7e00('0x4')](_0x3daf63,_0x7e00('0x5'));}function History(_0x4d8f0e){this['uniqueid']=_0x4d8f0e[_0x7e00('0x6')];this[_0x7e00('0x7')]=_0x4d8f0e['scheduledat']||undefined;this['type']=_0x4d8f0e[_0x7e00('0x8')];this[_0x7e00('0x9')]=_0x4d8f0e[_0x7e00('0x8')]==='outbound'?_0x7e00('0xa'):_0x4d8f0e['type'];this[_0x7e00('0xb')]=_0x4d8f0e[_0x7e00('0xb')];this[_0x7e00('0xc')]=_0x4d8f0e[_0x7e00('0xc')];this[_0x7e00('0xd')]=_0x4d8f0e[_0x7e00('0xd')];this[_0x7e00('0xe')]=_0x4d8f0e[_0x7e00('0xb')]+_0x4d8f0e[_0x7e00('0xc')]+_0x4d8f0e[_0x7e00('0xd')]+_0x4d8f0e['countnosuchnumberretry']+_0x4d8f0e[_0x7e00('0xf')]+_0x4d8f0e[_0x7e00('0x10')]+_0x4d8f0e[_0x7e00('0x11')]+_0x4d8f0e[_0x7e00('0x12')];this[_0x7e00('0x13')]=_0x4d8f0e[_0x7e00('0x13')];this[_0x7e00('0xf')]=_0x4d8f0e[_0x7e00('0xf')];this['countabandonedretry']=_0x4d8f0e[_0x7e00('0x10')];this[_0x7e00('0x11')]=_0x4d8f0e[_0x7e00('0x11')];this[_0x7e00('0x12')]=_0x4d8f0e['countagentrejectretry'];this[_0x7e00('0xa')]=_0x4d8f0e['queue'];this['calleridname']=_0x4d8f0e[_0x7e00('0x14')];this[_0x7e00('0x15')]=_0x4d8f0e[_0x7e00('0x16')];this[_0x7e00('0x17')]=_0x4d8f0e[_0x7e00('0x17')];this[_0x7e00('0x18')]=_0x4d8f0e[_0x7e00('0x18')];this[_0x7e00('0x19')]=_0x4d8f0e['responsetime'];this[_0x7e00('0x1a')]=getSeconds(_0x4d8f0e['responsetime'],_0x4d8f0e['starttime']);this[_0x7e00('0x1b')]=0x0;this['talktime']=0x0;this[_0x7e00('0x1c')]=_0x4d8f0e['callback'];this[_0x7e00('0x1d')]=_0x4d8f0e[_0x7e00('0x1d')];this[_0x7e00('0x1e')]=_0x4d8f0e['callbackat'];this['recallme']=_0x4d8f0e[_0x7e00('0x1f')];this['ContactId']=_0x4d8f0e[_0x7e00('0x20')];this[_0x7e00('0x21')]=_0x4d8f0e['ListId'];this[_0x7e00('0x22')]=_0x4d8f0e[_0x7e00('0x22')];this[_0x7e00('0x23')]=_0x4d8f0e['VoiceQueueId'];this[_0x7e00('0x24')]=_0x4d8f0e[_0x7e00('0x24')];this[_0x7e00('0x25')]=_0x4d8f0e[_0x7e00('0x25')]||'';this[_0x7e00('0x26')]=_0x4d8f0e[_0x7e00('0x26')]||'';}module[_0x7e00('0x27')]=History; \ No newline at end of file +var _0x36eb=['exports','lodash','milliseconds','diff','seconds','uniqueid','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','name','calleridnum','number','endtime','responsetime','ringtime','starttime','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1e0aa3,_0x461c9a){var _0x45b898=function(_0x16e13a){while(--_0x16e13a){_0x1e0aa3['push'](_0x1e0aa3['shift']());}};_0x45b898(++_0x461c9a);}(_0x36eb,0x119));var _0xb36e=function(_0x2cfdbe,_0xce3adf){_0x2cfdbe=_0x2cfdbe-0x0;var _0x3def0e=_0x36eb[_0x2cfdbe];return _0x3def0e;};'use strict';var util=require('util');var _=require(_0xb36e('0x0'));var moment=require('moment');function getSeconds(_0x2b3f53,_0x53eaf0){var _0x40327f=moment(_0x2b3f53)[_0xb36e('0x1')](0x0);var _0x28945e=moment(_0x53eaf0)[_0xb36e('0x1')](0x0);return _0x40327f[_0xb36e('0x2')](_0x28945e,_0xb36e('0x3'));}function History(_0x2be804){this[_0xb36e('0x4')]=_0x2be804['uniqueid'];this['scheduledat']=_0x2be804['scheduledat']||undefined;this[_0xb36e('0x5')]=_0x2be804[_0xb36e('0x5')];this[_0xb36e('0x6')]=_0x2be804[_0xb36e('0x5')]==='outbound'?_0xb36e('0x7'):_0x2be804[_0xb36e('0x5')];this[_0xb36e('0x8')]=_0x2be804[_0xb36e('0x8')];this[_0xb36e('0x9')]=_0x2be804[_0xb36e('0x9')];this['countnoanswerretry']=_0x2be804[_0xb36e('0xa')];this['countglobal']=_0x2be804[_0xb36e('0x8')]+_0x2be804[_0xb36e('0x9')]+_0x2be804[_0xb36e('0xa')]+_0x2be804['countnosuchnumberretry']+_0x2be804['countdropretry']+_0x2be804[_0xb36e('0xb')]+_0x2be804[_0xb36e('0xc')]+_0x2be804[_0xb36e('0xd')];this[_0xb36e('0xe')]=_0x2be804[_0xb36e('0xe')];this['countdropretry']=_0x2be804[_0xb36e('0xf')];this[_0xb36e('0xb')]=_0x2be804[_0xb36e('0xb')];this[_0xb36e('0xc')]=_0x2be804[_0xb36e('0xc')];this['countagentrejectretry']=_0x2be804['countagentrejectretry'];this[_0xb36e('0x7')]=_0x2be804[_0xb36e('0x7')];this['calleridname']=_0x2be804[_0xb36e('0x10')];this[_0xb36e('0x11')]=_0x2be804[_0xb36e('0x12')];this['starttime']=_0x2be804['starttime'];this['responsetime']=_0x2be804['responsetime'];this[_0xb36e('0x13')]=_0x2be804[_0xb36e('0x14')];this[_0xb36e('0x15')]=getSeconds(_0x2be804[_0xb36e('0x14')],_0x2be804[_0xb36e('0x16')]);this[_0xb36e('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x2be804['callback'];this[_0xb36e('0x18')]=_0x2be804[_0xb36e('0x18')];this[_0xb36e('0x19')]=_0x2be804[_0xb36e('0x19')];this[_0xb36e('0x1a')]=_0x2be804[_0xb36e('0x1a')];this[_0xb36e('0x1b')]=_0x2be804[_0xb36e('0x1b')];this['ListId']=_0x2be804[_0xb36e('0x1c')];this['UserId']=_0x2be804[_0xb36e('0x1d')];this[_0xb36e('0x1e')]=_0x2be804[_0xb36e('0x1e')];this[_0xb36e('0x1f')]=_0x2be804[_0xb36e('0x1f')];this['originatecalleridnum']=_0x2be804[_0xb36e('0x20')]||'';this[_0xb36e('0x21')]=_0x2be804['originatecalleridname']||'';}module[_0xb36e('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 613fbbf..bef2234 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 _0x85b5=['dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','predictiveIntervalErlangCallsDroppedCalls','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','predictiveIntervalAnsweredCalls','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','emptyContact','[getContactDialer2]','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','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','[abandonmentRate]','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','md5','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','type','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','format','voice_queue:save','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','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','isUndefined','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','preview','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[actions]','undefined','sequence','isNil','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','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','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','amd','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','emit','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countbusyretry','countnoanswerretry','reason19\x20machine....','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','run','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry'];(function(_0x4509cf,_0x27b3e2){var _0x5e75e0=function(_0x35d086){while(--_0x35d086){_0x4509cf['push'](_0x4509cf['shift']());}};_0x5e75e0(++_0x27b3e2);}(_0x85b5,0x7f));var _0x585b=function(_0x4ec226,_0x262b75){_0x4ec226=_0x4ec226-0x0;var _0x5014e2=_0x85b5[_0x4ec226];return _0x5014e2;};'use strict';var util=require(_0x585b('0x0'));var _=require(_0x585b('0x1'));var BPromise=require('bluebird');var uuid=require(_0x585b('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x585b('0x3'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0x585b('0x4'));var logger=require('../../../config/logger')(_0x585b('0x5'));var loggerBooked=require(_0x585b('0x6'))(_0x585b('0x7'));var loggerPredictive=require('../../../config/logger')(_0x585b('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x585b('0x9'));var loggerSyncQueueSummary=require(_0x585b('0x6'))(_0x585b('0xa'));var ami=require(_0x585b('0xb'));config['redis']=_[_0x585b('0xc')](config[_0x585b('0xd')],{'host':_0x585b('0xe'),'port':0x18eb});var io=require(_0x585b('0xf'))(new Redis(config[_0x585b('0xd')]));var cmHopper=require(_0x585b('0x10'));var cmHopperHistory=require(_0x585b('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x585b('0x12'));var Action=require('./action');var History=require(_0x585b('0x13'));var Final=require('./final');var AgentComplete=require(_0x585b('0x14'));var QueueCallerAbandon=require(_0x585b('0x15'));var Hangup=require(_0x585b('0x16'));var ipAgi=process['env'][_0x585b('0x17')]||_0x585b('0x18');var strategy={'rrmemory':_0x585b('0x19'),'roundrobin':_0x585b('0x1a')};var Sequence=function(){};Sequence[_0x585b('0x1b')][_0x585b('0x1c')]=function(_0x394361){this['tail']=this[_0x585b('0x1d')]?this[_0x585b('0x1d')]['finally'](_0x394361):_0x394361();};function Dialer(_0x4e2a41,_0xd53614){this['sequence']=new Sequence();this['preview']=_0xd53614;this[_0x585b('0x1e')]=_0x4e2a41[_0x585b('0x1e')];this[_0x585b('0x1f')]=_0x4e2a41['campaigns'];this[_0x585b('0x20')]=_0x4e2a41[_0x585b('0x20')];this[_0x585b('0x21')]=_0x4e2a41[_0x585b('0x21')];this['maxNumberOriginate']=config[_0x585b('0x22')]||0x2;this[_0x585b('0x23')]={};this[_0x585b('0x24')]={};this['contactsId']={};this['uniqueId']={};this[_0x585b('0x25')]={};this['startPredictive']={};this['startProgressive']={};this[_0x585b('0x26')]={};this[_0x585b('0x27')]={};this['queueBookedRR']={};ami['on'](_0x585b('0x28'),this[_0x585b('0x29')]['bind'](this));ami['on'](_0x585b('0x2a'),this[_0x585b('0x2b')][_0x585b('0x2c')](this));ami['on']('originateresponse',this[_0x585b('0x2d')]['bind'](this));ami['on'](_0x585b('0x2e'),this[_0x585b('0x2f')][_0x585b('0x2c')](this));ami['on'](_0x585b('0x30'),this[_0x585b('0xa')][_0x585b('0x2c')](this));ami['on'](_0x585b('0x31'),this[_0x585b('0x32')][_0x585b('0x2c')](this));ami['on'](_0x585b('0x33'),this[_0x585b('0x34')][_0x585b('0x2c')](this));ami['on'](_0x585b('0x35'),this[_0x585b('0x36')][_0x585b('0x2c')](this));ami['on']('queuemember',this[_0x585b('0x37')][_0x585b('0x2c')](this));ami['on'](_0x585b('0x38'),this[_0x585b('0x39')]['bind'](this));this['loopCampaigns']();this[_0x585b('0x3a')]();}function isNotNull(_0x29b168){return _0x29b168!==null&&!_['isUndefined'](_0x29b168);}function checkIsLoggedIn(_0x2ce768,_0x112fb5){return function(){if(_0x112fb5<=0x0){_0x2ce768['message']=_0x585b('0x3b');throw _0x2ce768[_0x585b('0x3c')]+_0x585b('0x3d');}};}function isActive(_0x3d24fb){return _0x3d24fb;}function checkIsActive(_0xeec064,_0x3d1433){return function(){if(!isActive(_0x3d1433)){_0xeec064[_0x585b('0x3e')]=_0x585b('0x3f');throw _0xeec064[_0x585b('0x3c')]+_0x585b('0x40');}};}function checkInterval(_0x4d763c){return function(){if(!isNotNull(_0x4d763c[_0x585b('0x41')])){_0x4d763c[_0x585b('0x3e')]=_0x585b('0x42');throw _0x4d763c['name']+_0x585b('0x43');}if(!isNotNull(_0x4d763c[_0x585b('0x41')][_0x585b('0x44')])){_0x4d763c['message']=_0x585b('0x42');throw _0x4d763c[_0x585b('0x3c')]+_0x585b('0x43');}if(!isNotNull(_[_0x585b('0x45')](_0x4d763c['Interval']['Intervals']))){_0x4d763c[_0x585b('0x3e')]=_0x585b('0x42');throw _0x4d763c[_0x585b('0x3c')]+_0x585b('0x43');}};}function msgResponse(_0x179502,_0x5d396a,_0xfb6949){return{'action':_0x179502,'response':_0x5d396a,'message':_0xfb6949,'stack':_0xfb6949};}function myreject(_0x2fea8b){return function(_0x3aa213){return _0x2fea8b(msgResponse(_0x585b('0x46'),_0x585b('0x47'),JSON['stringify'](_0x3aa213)));};}function getSeconds(_0x53c7cb,_0x5ed345){var _0xb36d23=moment(_0x53c7cb)[_0x585b('0x48')](0x0);var _0x2c4b9f=moment(_0x5ed345)[_0x585b('0x48')](0x0);return _0xb36d23[_0x585b('0x49')](_0x2c4b9f,_0x585b('0x4a'));}function emit(_0x1ce2f5,_0x128a0a,_0x6cec28){io['to'](_0x1ce2f5)['emit'](_0x128a0a,_0x6cec28);}function emitVoiceQueueSummary(_0x434768){if(_0x434768[_0x585b('0x4b')]==='outbound'){var _0x368fb0={'id':_0x434768['id'],'name':_0x434768[_0x585b('0x3c')],'strategy':_0x434768[_0x585b('0x4c')],'answered':_0x434768[_0x585b('0x4d')],'available':_0x434768[_0x585b('0x4e')],'loggedIn':_0x434768[_0x585b('0x4f')],'pTalking':_0x434768['pTalking'],'sumBillable':_0x434768[_0x585b('0x50')],'sumDuration':_0x434768[_0x585b('0x51')],'sumHoldTime':_0x434768[_0x585b('0x52')]||0x0,'talking':_0x434768[_0x585b('0x53')],'total':_0x434768[_0x585b('0x54')],'type':_0x434768[_0x585b('0x4b')],'unmanaged':_0x434768[_0x585b('0x55')],'abandoned':_0x434768[_0x585b('0x56')],'waiting':_0x434768['waiting'],'loggedInDb':_0x434768[_0x585b('0x57')],'dialActive':_0x434768[_0x585b('0x58')],'dialMethod':_0x434768[_0x585b('0x59')],'dialOriginateCallerIdName':_0x434768['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x434768[_0x585b('0x5a')],'dialOriginateTimeout':_0x434768[_0x585b('0x5b')],'dialPrefix':_0x434768[_0x585b('0x5c')],'outboundAnswerAgiCallsDay':_0x434768['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x434768[_0x585b('0x5d')],'outboundBlacklistCallsDay':_0x434768[_0x585b('0x5e')],'outboundBusyCallsDay':_0x434768['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x434768['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x434768[_0x585b('0x5f')],'outboundDropCallsDayCallersExit':_0x434768['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x434768[_0x585b('0x60')],'outboundNoAnswerCallsDay':_0x434768['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x434768[_0x585b('0x61')],'outboundOriginateFailureCallsDay':_0x434768[_0x585b('0x62')],'outboundReCallsDay':_0x434768['outboundReCallsDay'],'outboundRejectCallsDay':_0x434768[_0x585b('0x63')],'outboundUnknownCallsDay':_0x434768['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x434768['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x434768['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x434768[_0x585b('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x434768['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x434768[_0x585b('0x65')],'predictiveIntervalErlangCalls':_0x434768[_0x585b('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x434768['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x434768[_0x585b('0x67')],'predictiveIntervalMultiplicativeFactor':_0x434768[_0x585b('0x68')],'predictiveIntervalPauses':_0x434768[_0x585b('0x69')],'predictiveIntervalAvailable':_0x434768['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x434768['predictiveIntervalTotalCalls'],'message':_0x434768['message'],'originated':_0x434768[_0x585b('0x6a')],'erlangCalls':_0x434768[_0x585b('0x6b')],'erlangCallToSecond':_0x434768[_0x585b('0x6c')],'erlangAbandonmentRate':_0x434768[_0x585b('0x6d')],'erlangBusyFactor':_0x434768['erlangBusyFactor'],'startPredictive':_0x434768[_0x585b('0x6e')],'startProgressive':_0x434768[_0x585b('0x6f')]};if(_0x434768[_0x585b('0x70')]){_0x368fb0[_0x585b('0x70')]={'id':_0x434768['Trunk']['id'],'name':_0x434768[_0x585b('0x70')][_0x585b('0x3c')],'active':_0x434768[_0x585b('0x70')][_0x585b('0x71')],'callerid':_0x434768[_0x585b('0x70')]['callerid']};}if(_0x434768['Interval']){_0x368fb0['Interval']={'id':_0x434768[_0x585b('0x41')]['id'],'name':_0x434768['Interval'][_0x585b('0x3c')]};}var _0x54ab6f=md5(JSON['stringify'](_0x368fb0));if(_0x434768['md5']!==_0x54ab6f){_0x434768[_0x585b('0x3')]=_0x54ab6f;emit(util[_0x585b('0x72')]('voice:queue:%s',_0x368fb0['name']),_0x585b('0x73'),_0x368fb0);}}}function emitCampaignSummary(_0x40dd9f){if(_0x40dd9f[_0x585b('0x4b')]==='ivr'){emit(util[_0x585b('0x72')]('campaign:ivr:%s',_0x40dd9f[_0x585b('0x3c')]),'campaign:save',_0x40dd9f);}}function checkGetDataPredictive(_0x30e92a){if(isNotNull(_0x30e92a)&&!_['isEmpty'](_0x30e92a)){loggerPredictive[_0x585b('0x74')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x585b('0x74')](_0x585b('0x75'),_0x30e92a[_0x585b('0x76')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x77'),_0x30e92a['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x585b('0x74')](_0x585b('0x78'),_0x30e92a[_0x585b('0x65')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x79'),_0x30e92a[_0x585b('0x7a')]);loggerPredictive['info'](_0x585b('0x7b'),_0x30e92a[_0x585b('0x7c')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x7d'),_0x30e92a['predictiveIntervalAvgTalktime']);loggerPredictive[_0x585b('0x74')](_0x585b('0x7e'));if(_0x30e92a[_0x585b('0x76')]>0x0){if(!_['isUndefined'](_0x30e92a['predictiveIntervalAvgTalktime'])&&_0x30e92a['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x30e92a[_0x585b('0x7c')])&&_0x30e92a[_0x585b('0x7c')]>0x0){return!![];}loggerPredictive[_0x585b('0x74')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x585b('0x74')](_0x585b('0x7f'));}}else{loggerPredictive[_0x585b('0x74')](_0x585b('0x80'));}return![];}function mergeDataErlangB(_0x53387b){return function(_0x3cb8d3){loggerPredictive[_0x585b('0x74')](_0x585b('0x81'));loggerPredictive[_0x585b('0x74')](_0x585b('0x82'),_0x3cb8d3[_0x585b('0x6b')]);loggerPredictive[_0x585b('0x74')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cb8d3[_0x585b('0x6c')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x83'),_0x3cb8d3[_0x585b('0x6d')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x84'),_0x3cb8d3[_0x585b('0x85')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x83'),_0x3cb8d3[_0x585b('0x6d')]);loggerPredictive[_0x585b('0x74')](_0x585b('0x7e'));_[_0x585b('0x86')](_0x53387b,_0x3cb8d3);};}function getDiff(_0x212d51){var _0x4ded11=moment()[_0x585b('0x48')](0x0);var _0x493505=moment(_0x212d51)[_0x585b('0x48')](0x0);return _0x4ded11[_0x585b('0x49')](_0x493505,'seconds');}function ifInterval(_0xf09309,_0x1520cd){if(_['isUndefined'](_0x1520cd)){return![];}return getDiff(_0x1520cd)<_0xf09309*0x3c;}function freeVariablesPredictive(_0x58d087){if(isNotNull(_0x58d087)){if(!_['isUndefined'](_0x58d087['startProgressive'])){_0x58d087['startProgressive']=undefined;loggerPredictive[_0x585b('0x74')](_0x58d087['name'],_0x585b('0x87'));}if(!_[_0x585b('0x88')](_0x58d087[_0x585b('0x6e')])){_0x58d087[_0x585b('0x6e')]=undefined;loggerPredictive[_0x585b('0x74')](_0x58d087[_0x585b('0x3c')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x58d087['handlePredictive'])){clearInterval(_0x58d087[_0x585b('0x89')]);_0x58d087[_0x585b('0x89')]=undefined;loggerPredictive[_0x585b('0x74')](_0x58d087[_0x585b('0x3c')],_0x585b('0x8a'));}}}function erlangb(_0x5222ce,_0x345ac1){if(_0x345ac1===0x0){return 0x0;}var _0x14f0bd=0x1;for(var _0x512a1b=0x1;_0x512a1b<=_0x345ac1;_0x512a1b+=0x1){_0x14f0bd=0x1+_0x14f0bd*_0x512a1b/_0x5222ce;}return 0x1/_0x14f0bd;}function isVoiceQueueOutbound(_0xe4ad74){return _0xe4ad74===_0x585b('0x8b');}function isNotPreview(_0x535d1f){return _0x535d1f!==_0x585b('0x8c');}function isCampaignIvr(_0x35ca81){return _0x35ca81===_0x585b('0x8d');}function getCallerId(_0x64ee6b,_0x1efdaa,_0x4c29d7){if(!_[_0x585b('0x88')](_0x4c29d7)&&typeof _0x4c29d7===_0x585b('0x8e')&&!_[_0x585b('0x45')](_0x4c29d7)){if(!_[_0x585b('0x88')](_0x1efdaa)&&typeof _0x1efdaa==='string'&&!_[_0x585b('0x45')](_0x1efdaa)){return util[_0x585b('0x72')](_0x585b('0x8f'),_0x1efdaa,_0x4c29d7);}return util[_0x585b('0x72')](_0x585b('0x8f'),_0x4c29d7,_0x4c29d7);}if(!_[_0x585b('0x88')](_0x64ee6b)&&typeof _0x64ee6b==='string'&&!_[_0x585b('0x45')](_0x64ee6b)){return _0x64ee6b;}return _0x585b('0x90');}function loggerCatchQueueSummary(_0x1d6ae5,_0x2061d0){return function(_0x3dd83f){freeVariablesPredictive(_0x2061d0);emitVoiceQueueSummary(_0x2061d0);emitCampaignSummary(_0x2061d0);loggerSyncQueueSummary['error'](_0x1d6ae5,util[_0x585b('0x91')](_0x3dd83f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x11bd7b,_0x424658){return function(_0x21ad2b){loggerPredictive[_0x585b('0x92')](_0x424658[_0x585b('0x3c')],_0x11bd7b);loggerPredictive[_0x585b('0x92')](_0x21ad2b['stack']);freeVariablesPredictive(_0x424658);};}function loggerCatch(_0x457deb){return function(_0x41fd91){logger[_0x585b('0x92')](_0x457deb,util[_0x585b('0x91')](_0x41fd91,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xbfd66f){return _0xbfd66f&&!_['isUndefined'](_0xbfd66f)&&_0xbfd66f[_0x585b('0x93')]>0x0;}function decremetOriginate(_0x16fda5){if(!_[_0x585b('0x88')](_0x16fda5)&&_0x16fda5!==null){if(typeof _0x16fda5[_0x585b('0x6a')]!=='undefined'){if(_0x16fda5[_0x585b('0x6a')]>0x0){_0x16fda5[_0x585b('0x6a')]-=0x1;}else{logger[_0x585b('0x92')](_0x585b('0x94'));}}}else{logger[_0x585b('0x92')](_0x585b('0x95'));}}function checkContactLowerLimitOriginate(_0x5150df,_0x55f297,_0x3c1c49){if(_0x55f297>_0x3c1c49){for(var _0x2112e=0x0;_0x2112e<_0x55f297-_0x3c1c49;_0x2112e+=0x1){decremetOriginate(_0x5150df);}}}function loggerGetContactDialer(_0x4a7dd5,_0x1dddf0,_0x3f35f0){return function(_0x388ff5){checkContactLowerLimitOriginate(_0x1dddf0,_0x3f35f0,0x0);logger[_0x585b('0x92')](_0x4a7dd5,util['inspect'](_0x388ff5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4c569a){return function(_0x16808b){if(isNotNull(_0x16808b)&&isNotNull(_0x16808b[0x0])){if(_0x16808b[0x0]['contactsRescheduled']>0x0){_0x4c569a[_0x585b('0x3e')]=_0x585b('0x96');logger['info']('[getContactDialer2][ReScheduled]'+_0x4c569a[_0x585b('0x3c')],_0x16808b[0x0][_0x585b('0x97')],_0x585b('0x98'));}else{_0x4c569a[_0x585b('0x3e')]=_0x585b('0x99');logger[_0x585b('0x74')](_0x585b('0x9a')+_0x4c569a[_0x585b('0x3c')]);}}};}function notSendMessagesQueue(_0x4c9b9b){if(_0x4c9b9b[_0x585b('0x9b')]){freeVariablesPredictive(_0x4c9b9b);if(_0x4c9b9b['originated']===0x0&&_0x4c9b9b['talking']===0x0&&_0x4c9b9b[_0x585b('0x9c')]===0x0&&(_0x4c9b9b[_0x585b('0x9d')]||0x0)===0x0){_0x4c9b9b['sendMessageOneNotActive']=![];_0x4c9b9b[_0x585b('0x4e')]=0x0;_0x4c9b9b[_0x585b('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x585b('0x92')](_0x585b('0x9e'),_0x4c9b9b['name'],_0x585b('0x9f'));}else{_0x4c9b9b[_0x585b('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x585b('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4c9b9b[_0x585b('0x3c')],_0x585b('0xa0'));}emitVoiceQueueSummary(_0x4c9b9b);}}function notSendMessagesCampaign(_0x22367f){if(_0x22367f[_0x585b('0x9b')]){if(_0x22367f[_0x585b('0x6a')]===0x0){_0x22367f[_0x585b('0x9b')]=![];_0x22367f[_0x585b('0x3e')]=_0x585b('0x3f');loggerSyncQueueSummary[_0x585b('0x92')](_0x585b('0xa1'),_0x22367f[_0x585b('0x3c')],_0x585b('0x9f'));}else{_0x22367f[_0x585b('0x3e')]=_0x585b('0xa2');loggerSyncQueueSummary['error'](_0x585b('0xa1'),_0x22367f[_0x585b('0x3c')],_0x585b('0xa0'));}emitCampaignSummary(_0x22367f);}}function createObjHistory(_0x47882a,_0x173060,_0xdbf123,_0xb15de7,_0x18a997){_0x47882a[_0x585b('0x3e')]=_0xdbf123;var _0x561400=new Action(_0x47882a,_0x173060);var _0x21edb1=new History(_0x561400);_0x21edb1[_0x585b('0xa3')]=_0xb15de7;_0x21edb1[_0x585b('0xa4')]=_0x18a997;_0x21edb1[_0x585b('0xa5')]=_0x561400[_0x585b('0xa6')];return _0x21edb1;}Dialer[_0x585b('0x1b')]['loopClearZombieChannels']=function(){var _0x4b96cd=this;setInterval(function(){_0x4b96cd[_0x585b('0xa7')](_0x4b96cd[_0x585b('0xa8')],'[uniqueid]');_0x4b96cd['clearZombieChannels'](_0x4b96cd[_0x585b('0x24')],_0x585b('0xa9'));},0x32c8);};Dialer[_0x585b('0x1b')][_0x585b('0xa7')]=function(_0x5a0f9f,_0x556e62){var _0x227aac=this;for(var _0x3586b0 in _0x5a0f9f){if(typeof _0x5a0f9f[_0x3586b0]!==_0x585b('0xaa')){this[_0x585b('0xab')][_0x585b('0x1c')](function(){if(!_[_0x585b('0xac')](_0x5a0f9f[_0x3586b0])){return ami['Action']({'action':_0x585b('0xad'),'channel':_0x5a0f9f[_0x3586b0]['channel']})[_0x585b('0xae')](function(_0x293a75){if(_0x293a75['message']===_0x585b('0xaf')){setTimeout(function(){if(_0x5a0f9f[_0x3586b0]&&_0x5a0f9f[_0x3586b0][_0x585b('0x4b')]!==_0x585b('0x8d')){_0x227aac[_0x585b('0xb0')](_0x227aac[_0x585b('0x1e')][_0x5a0f9f[_0x3586b0][_0x585b('0xb1')]]);logger[_0x585b('0x92')]('[Dialer][checkChannel]',_0x556e62,_0x3586b0,_0x5a0f9f[_0x3586b0]['queue']);delete _0x5a0f9f[_0x3586b0];}if(_0x5a0f9f[_0x3586b0]&&_0x5a0f9f[_0x3586b0][_0x585b('0x4b')]===_0x585b('0x8d')){_0x227aac[_0x585b('0xb0')](_0x227aac[_0x585b('0x1f')][_0x5a0f9f[_0x3586b0][_0x585b('0xb1')]]);logger['error'](_0x585b('0xb2'),_0x556e62,_0x3586b0,_0x5a0f9f[_0x3586b0]['queue']);delete _0x5a0f9f[_0x3586b0];}},0x2328);}});}});}}};Dialer[_0x585b('0x1b')][_0x585b('0xb3')]=function(_0x3f9e22){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopper['countReScheduled'](_0x3f9e22))[_0x585b('0xae')](loggerCatch(_0x585b('0xb6')));};Dialer[_0x585b('0x1b')][_0x585b('0xb7')]=function(_0x17b210){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopperBlack[_0x585b('0xb7')](_0x17b210))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x585b('0x1b')]['checkIsBlackListIvr']=function(_0x264cf4){return BPromise['resolve']()[_0x585b('0xb5')](cmHopperBlack[_0x585b('0xb8')](_0x264cf4))['catch'](loggerCatch(_0x585b('0xb9')));};Dialer['prototype'][_0x585b('0xba')]=function(_0x42a0b7){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopperHistory[_0x585b('0xbb')](_0x42a0b7))[_0x585b('0xae')](loggerCatch(_0x585b('0xbc')));};Dialer[_0x585b('0x1b')]['rescheduleContact']=function(_0xbe2baa){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopper[_0x585b('0xbd')](_0xbe2baa))[_0x585b('0xae')](loggerCatch(_0x585b('0xbe')));};Dialer['prototype']['unlockContact']=function(_0x40bddc,_0x6f7feb,_0x534f43){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopper[_0x585b('0xbf')](_0x40bddc,_0x6f7feb,_0x534f43))[_0x585b('0xae')](loggerCatch(_0x585b('0xc0')));};Dialer['prototype'][_0x585b('0xc1')]=function(_0x3af24b,_0x526370,_0x4f178f,_0x1b2f4a,_0x4d27cd){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopper[_0x585b('0xc1')](_0x3af24b,_0x526370,_0x4f178f,_0x1b2f4a))['catch'](function(_0x18fec8){_0x4d27cd['temp']-=_0x4f178f;_0x4d27cd[_0x585b('0xc2')]=_0x4d27cd[_0x585b('0xc2')]>0x0?_0x4d27cd['temp']:0x0;loggerCatch(_0x585b('0xc3'))(_0x18fec8);});};Dialer[_0x585b('0x1b')][_0x585b('0xc4')]=function(_0x498434,_0x3c60cc,_0x217183,_0x4282e3){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopper[_0x585b('0xc4')](_0x498434,_0x3c60cc,_0x217183))[_0x585b('0xae')](function(_0x239e4b){_0x4282e3['temp']-=_0x3c60cc;_0x4282e3[_0x585b('0xc2')]=_0x4282e3[_0x585b('0xc2')]>0x0?_0x4282e3['temp']:0x0;loggerCatch(_0x585b('0xc5'))(_0x239e4b);});};Dialer[_0x585b('0x1b')][_0x585b('0xc6')]=function(_0x204a89){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](voiceQueueRt[_0x585b('0xc6')](_0x204a89))[_0x585b('0xae')](loggerCatch(_0x585b('0xc7')));};Dialer[_0x585b('0x1b')]['moveContactManagedDialer']=function(_0x1f18bc){return BPromise[_0x585b('0xb4')]()['then'](cmHopper[_0x585b('0xc8')](_0x1f18bc))['catch'](loggerCatch(_0x585b('0xc9')));};Dialer[_0x585b('0x1b')][_0x585b('0xca')]=function(_0x3749f4){return BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](cmHopperHistory[_0x585b('0xca')](_0x3749f4))[_0x585b('0xae')](loggerCatch('[createHistory]\x20'));};Dialer[_0x585b('0x1b')][_0x585b('0xb0')]=function(_0x25c00c){if(!_[_0x585b('0x88')](_0x25c00c)&&_0x25c00c!==null){if(typeof _0x25c00c[_0x585b('0x6a')]!=='undefined'){if(_0x25c00c[_0x585b('0x6a')]>0x0){_0x25c00c[_0x585b('0x6a')]-=0x1;}else{logger[_0x585b('0x92')](_0x585b('0xcb'));}}}else{logger[_0x585b('0x92')](_0x585b('0xcc'));}};Dialer[_0x585b('0x1b')][_0x585b('0xcd')]=function(_0x27849c,_0x128fa7){var _0x41a69d=this;return function(_0xeb3df){_0x41a69d['updateOriginated'](_0x128fa7);logger[_0x585b('0x92')](_0x27849c,util[_0x585b('0x91')](_0xeb3df,{'showHidden':![],'depth':null}));};};Dialer[_0x585b('0x1b')]['emptyContact']=function(_0x47e605,_0x8a878e,_0x9878a8){var _0x33caf1={'state':0x19,'statedesc':_0x585b('0xce')};this[_0x585b('0xb0')](_0x8a878e);this['saveInDb'](_[_0x585b('0x86')](_0x33caf1,_[_0x585b('0xcf')](_0x9878a8,[_0x585b('0xd0'),_0x585b('0xd1'),_0x585b('0xd2'),_0x585b('0xd3'),_0x585b('0xd4')])),_0x585b('0xd5'),_0x585b('0xd6'));logger[_0x585b('0x92')](_0x47e605);};Dialer[_0x585b('0x1b')][_0x585b('0xd7')]=function(_0x24ba38){return _0x24ba38==='Success';};Dialer[_0x585b('0x1b')][_0x585b('0xd8')]=function(_0x22298b){return!_[_0x585b('0x88')](_0x22298b)&&_0x22298b&&!_[_0x585b('0x88')](_0x22298b[_0x585b('0x3c')])&&!_[_0x585b('0x88')](_0x22298b['active'])&&_0x22298b['active']&&(this[_0x585b('0x21')][util['format']('SIP/%s',_0x22298b[_0x585b('0x3c')])]['status']===_0x585b('0xd9')||this['trunks'][util[_0x585b('0x72')]('SIP/%s',_0x22298b[_0x585b('0x3c')])][_0x585b('0xad')]===_0x585b('0xda'));};Dialer[_0x585b('0x1b')][_0x585b('0xdb')]=function(_0x169cc2,_0x580c25,_0x55ffbe){this['createHistory'](_0x169cc2)['catch'](loggerCatch(_0x580c25));this[_0x585b('0xc8')](_0x169cc2)[_0x585b('0xae')](loggerCatch(_0x55ffbe));};Dialer[_0x585b('0x1b')][_0x585b('0x36')]=function(_0x20b15e){var _0x545482=this[_0x585b('0xa8')][_0x20b15e[_0x585b('0xdc')]];var _0x175817;if(!_[_0x585b('0xac')](_0x20b15e)&&!_[_0x585b('0xac')](_0x20b15e['variable'])&&!_[_0x585b('0xac')](_0x20b15e[_0x585b('0xdd')][_0x585b('0xde')])&&_0x20b15e['exten']===_0x585b('0xdf')&&_0x545482){if(_0x545482[_0x585b('0x4b')]!==_0x585b('0x8d')&&this[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]][_0x585b('0xe0')]&&_0x20b15e[_0x585b('0xe1')]===_0x585b('0xe2')){delete this['uniqueId'][_0x20b15e['uniqueid']];this['updateOriginated'](this[_0x585b('0x1e')][_0x545482['queue']]);this[_0x585b('0x1e')][_0x545482['queue']][_0x585b('0x5d')]+=0x1;this[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]][_0x585b('0xe3')]+=0x1;_0x175817=new Hangup(_0x545482,_0x20b15e);_0x175817['state']=0x12;_0x175817[_0x585b('0xa4')]=_0x585b('0xe4');_0x175817[_0x585b('0xe5')]='AMD';ami['emit']('custom:amd',ut['buildObj'](_0x175817,_0x585b('0xe6')));this[_0x585b('0xdb')](_0x175817,'[syncHangupInAMD][createHistory]',_0x585b('0xe7'));}if(_0x545482[_0x585b('0x4b')]!==_0x585b('0x8d')&&this[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]][_0x585b('0xe0')]&&_0x20b15e[_0x585b('0xe1')]===_0x585b('0xe8')){var _0x377570=this;return new BPromise(function(_0x1edf81,_0x2db02d){delete _0x377570[_0x585b('0xa8')][_0x20b15e[_0x585b('0xdc')]];_0x377570[_0x585b('0xb0')](_0x377570[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]]);_0x377570[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x377570['voiceQueues'][_0x545482[_0x585b('0xb1')]][_0x585b('0xe3')]+=0x1;var _0x4b4fd5=_0x377570[_0x585b('0x1e')][_0x545482[_0x585b('0xb1')]];var _0x2b28da=new Hangup(_0x545482,_0x20b15e);_0x2b28da[_0x585b('0xa3')]=0x13;_0x2b28da['statedesc']=_0x585b('0xe9');_0x2b28da[_0x585b('0xe5')]=_0x585b('0xea');_0x2b28da[_0x585b('0xeb')]+=0x1;_0x2b28da['countglobal']+=0x1;_0x2b28da[_0x585b('0xe6')]=!![];ami[_0x585b('0xec')](_0x585b('0xed'),ut[_0x585b('0xee')](_0x2b28da,_0x585b('0xe6')));_0x377570[_0x585b('0xca')](_0x2b28da)[_0x585b('0xae')](loggerCatch(_0x585b('0xef')));if(_0x2b28da['countbusyretry']+_0x2b28da[_0x585b('0xf0')]+_0x2b28da['countnoanswerretry']+_0x2b28da[_0x585b('0xf1')]+_0x2b28da[_0x585b('0xf2')]+_0x2b28da[_0x585b('0xf3')]+_0x2b28da[_0x585b('0xeb')]+_0x2b28da[_0x585b('0xf4')]>=_0x4b4fd5[_0x585b('0xf5')]){_0x377570['stateGlobal'](_0x2b28da,_0x1edf81,_0x2db02d,'reason19\x20machine....');}else{if(_0x2b28da[_0x585b('0xeb')]>=_0x4b4fd5['dialMachineMaxRetry']){_0x377570[_0x585b('0xf6')](_0x2b28da,_0x1edf81,_0x2db02d,_0x585b('0xf7'));}else{_0x377570['rescheduleContact']({'active':![],'countmachineretry':_0x2b28da[_0x585b('0xeb')],'scheduledat':moment()[_0x585b('0xf8')](_0x4b4fd5[_0x585b('0xf9')],_0x585b('0xfa'))[_0x585b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b28da[_0x585b('0xd0')],'ListId':_0x2b28da[_0x585b('0xd1')],'VoiceQueueId':_0x2b28da['VoiceQueueId']||undefined,'CampaignId':_0x2b28da[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0xfb')));_0x1edf81({'reschedule':0x1});}}});}if(_0x545482['type']==='ivr'&&this[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]][_0x585b('0xe0')]&&_0x20b15e[_0x585b('0xe1')]===_0x585b('0xe2')){delete this[_0x585b('0xa8')][_0x20b15e[_0x585b('0xdc')]];this['updateOriginated'](this[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]]);_0x175817=new Hangup(_0x545482,_0x20b15e);_0x175817[_0x585b('0xa3')]=0x12;_0x175817[_0x585b('0xa4')]='HangupInAMD';_0x175817['membername']=_0x585b('0xea');ami[_0x585b('0xec')](_0x585b('0xed'),ut[_0x585b('0xee')](_0x175817,_0x585b('0xe6')));this[_0x585b('0xdb')](_0x175817,_0x585b('0xfc'),_0x585b('0xfd'));}if(_0x545482[_0x585b('0x4b')]===_0x585b('0x8d')&&this[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]][_0x585b('0xe0')]&&_0x20b15e[_0x585b('0xe1')]===_0x585b('0xe8')){var _0x377570=this;return new BPromise(function(_0x5916a0,_0x135a15){delete _0x377570[_0x585b('0xa8')][_0x20b15e[_0x585b('0xdc')]];_0x377570['updateOriginated'](_0x377570[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]]);_0x377570[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]][_0x585b('0x5d')]+=0x1;_0x377570['campaigns'][_0x545482[_0x585b('0xb1')]][_0x585b('0xe3')]+=0x1;var _0x58ce18=_0x377570[_0x585b('0x1f')][_0x545482[_0x585b('0xb1')]];var _0x486c3d=new Hangup(_0x545482,_0x20b15e);_0x486c3d['state']=0x13;_0x486c3d['statedesc']='Machine';_0x486c3d[_0x585b('0xe5')]=_0x585b('0xea');_0x486c3d[_0x585b('0xeb')]+=0x1;_0x486c3d[_0x585b('0xfe')]+=0x1;_0x486c3d[_0x585b('0xe6')]=!![];ami[_0x585b('0xec')](_0x585b('0xed'),ut['buildObj'](_0x486c3d,_0x585b('0xe6')));_0x377570[_0x585b('0xca')](_0x486c3d)[_0x585b('0xae')](loggerCatch(_0x585b('0xef')));if(_0x486c3d[_0x585b('0xff')]+_0x486c3d[_0x585b('0xf0')]+_0x486c3d[_0x585b('0x100')]+_0x486c3d['countnosuchnumberretry']+_0x486c3d[_0x585b('0xf2')]+_0x486c3d[_0x585b('0xf3')]+_0x486c3d['countmachineretry']+_0x486c3d[_0x585b('0xf4')]>=_0x58ce18[_0x585b('0xf5')]){_0x377570['stateGlobal'](_0x486c3d,_0x5916a0,_0x135a15,_0x585b('0x101'));}else{if(_0x486c3d[_0x585b('0xeb')]>=_0x58ce18[_0x585b('0x102')]){_0x377570['createStateFinal'](_0x486c3d,_0x5916a0,_0x135a15,_0x585b('0xf7'));}else{_0x377570[_0x585b('0xbd')]({'active':![],'countmachineretry':_0x486c3d['countmachineretry'],'scheduledat':moment()[_0x585b('0xf8')](_0x58ce18[_0x585b('0xf9')],_0x585b('0xfa'))['format'](_0x585b('0x103')),'ContactId':_0x486c3d[_0x585b('0xd0')],'ListId':_0x486c3d['ListId'],'VoiceQueueId':_0x486c3d[_0x585b('0xd3')]||undefined,'CampaignId':_0x486c3d['CampaignId']||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0xfb')));_0x5916a0({'reschedule':0x1});}}});}}};Dialer[_0x585b('0x1b')]['syncHangup']=function(_0x10564c){var _0x5d40a8=this[_0x585b('0xa8')][_0x10564c[_0x585b('0xdc')]];var _0x9adf39=this;var _0x2e58af;if(_0x5d40a8&&_0x5d40a8[_0x585b('0x4b')]===_0x585b('0x8d')){delete this[_0x585b('0xa8')][_0x10564c[_0x585b('0xdc')]];this[_0x585b('0xb0')](this[_0x585b('0x1f')][_0x5d40a8[_0x585b('0xb1')]]);this['campaigns'][_0x5d40a8[_0x585b('0xb1')]]['ivrAnswerCallsDay']+=0x1;_0x2e58af=new Hangup(_0x5d40a8,_0x10564c);this['createHistory'](_0x2e58af)[_0x585b('0xae')](loggerCatch(_0x585b('0x104')));this[_0x585b('0xc8')](_0x2e58af)[_0x585b('0xae')](loggerCatch(_0x585b('0x105')));}if(_0x5d40a8&&_0x5d40a8[_0x585b('0x4b')]!==_0x585b('0x8d')&&isNotNull(this[_0x585b('0x1e')][_0x5d40a8[_0x585b('0xb1')]]['dialQueueProject'])){delete this[_0x585b('0xa8')][_0x10564c['uniqueid']];this[_0x585b('0xb0')](this['voiceQueues'][_0x5d40a8[_0x585b('0xb1')]]);this[_0x585b('0x1e')][_0x5d40a8[_0x585b('0xb1')]][_0x585b('0x5d')]+=0x1;this[_0x585b('0x1e')][_0x5d40a8['queue']][_0x585b('0xe3')]+=0x1;_0x2e58af=new Hangup(_0x5d40a8,_0x10564c);_0x2e58af[_0x585b('0xa3')]=0x10;_0x2e58af['statedesc']=_0x585b('0x106');_0x2e58af[_0x585b('0xe5')]='AGI';this['createHistory'](_0x2e58af)[_0x585b('0xae')](loggerCatch(_0x585b('0x104')));this['moveContactManagedDialer'](_0x2e58af)[_0x585b('0xae')](loggerCatch(_0x585b('0x105')));}if(_0x5d40a8&&_0x5d40a8['type']!==_0x585b('0x8d')&&!isNotNull(this[_0x585b('0x1e')][_0x5d40a8[_0x585b('0xb1')]][_0x585b('0x107')])){delete this[_0x585b('0xa8')][_0x10564c[_0x585b('0xdc')]];this['updateOriginated'](this[_0x585b('0x1e')][_0x5d40a8[_0x585b('0xb1')]]);this[_0x585b('0x1e')][_0x5d40a8[_0x585b('0xb1')]][_0x585b('0x108')]+=0x1;_0x2e58af=new Hangup(_0x5d40a8,_0x10564c);_0x2e58af[_0x585b('0xa3')]=0xc;_0x2e58af[_0x585b('0xa4')]=_0x10564c[_0x585b('0x109')];_0x2e58af[_0x585b('0xe5')]=_0x585b('0x10a');this[_0x585b('0xca')](_0x2e58af)['catch'](loggerCatch(_0x585b('0x104')));this[_0x585b('0xc8')](_0x2e58af)[_0x585b('0xae')](loggerCatch(_0x585b('0x105')));}};Dialer[_0x585b('0x1b')][_0x585b('0x2f')]=function(_0x1ef37f){var _0x5c8f5e=this[_0x585b('0xa8')][_0x1ef37f['uniqueid']];var _0x541714=this;if(this[_0x585b('0x1e')][_0x1ef37f['queue']]){if(_0x5c8f5e&&_0x5c8f5e[_0x585b('0x4b')]!==_0x585b('0x8d')){delete this[_0x585b('0xa8')][_0x1ef37f['uniqueid']];this[_0x585b('0x1e')][_0x1ef37f['queue']]['outboundAnswerCallsDay']+=0x1;var _0x1cb732=new AgentComplete(_0x5c8f5e,_0x1ef37f);if(_0x1ef37f['reason']==='agent'){_0x1cb732[_0x585b('0x10b')]=this[_0x585b('0x1e')][_0x1ef37f[_0x585b('0xb1')]]['dialQueueProject2']&&this[_0x585b('0x1e')][_0x1ef37f[_0x585b('0xb1')]][_0x585b('0x10c')]?moment()[_0x585b('0x72')](_0x585b('0x103')):undefined;}this[_0x585b('0xca')](_0x1cb732)[_0x585b('0xae')](loggerCatch(_0x585b('0x10d')));this['moveContactManagedDialer'](_0x1cb732)[_0x585b('0xae')](loggerCatch(_0x585b('0x10e')));}}};Dialer[_0x585b('0x1b')][_0x585b('0x29')]=function(_0x1a8eca){if(this[_0x585b('0x1e')][_0x1a8eca[_0x585b('0xb1')]]){if(this[_0x585b('0xa8')][_0x1a8eca[_0x585b('0xdc')]]&&this[_0x585b('0xa8')][_0x1a8eca[_0x585b('0xdc')]][_0x585b('0x4b')]!==_0x585b('0x8d')){this[_0x585b('0xb0')](this[_0x585b('0x1e')][_0x1a8eca[_0x585b('0xb1')]]);this[_0x585b('0xa8')][_0x1a8eca[_0x585b('0xdc')]][_0x585b('0x10f')]=moment()[_0x585b('0x72')](_0x585b('0x103'));}}};Dialer['prototype'][_0x585b('0x110')]=function(_0x2fbecc){this[_0x585b('0xca')](_0x2fbecc)[_0x585b('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x585b('0xc8')](_0x2fbecc)[_0x585b('0xae')](loggerCatch(_0x585b('0x111')));};Dialer[_0x585b('0x1b')]['syncQueueCallerAbandon']=function(_0x3761b4){var _0x679a30=this[_0x585b('0xa8')][_0x3761b4['uniqueid']];var _0xe38e72=this;if(this['voiceQueues'][_0x3761b4[_0x585b('0xb1')]]){if(_0x679a30&&_0x679a30[_0x585b('0x4b')]!=='ivr'){delete this[_0x585b('0xa8')][_0x3761b4['uniqueid']];this[_0x585b('0xb0')](this[_0x585b('0x1e')][_0x3761b4['queue']]);_0x679a30['droptime']=moment()[_0x585b('0x72')](_0x585b('0x103'));var _0x27954b=new QueueCallerAbandon(_0x679a30,_0x3761b4);if(getSeconds(_0x679a30['droptime'],_0x679a30[_0x585b('0x112')])>=_0x679a30[_0x585b('0x113')]){this['voiceQueues'][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x65')]+=0x1;this['voiceQueues'][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x60')]+=0x1;this[_0x585b('0x1e')][_0x3761b4[_0x585b('0xb1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x27954b[_0x585b('0xa3')]=0xa;_0x27954b[_0x585b('0xa4')]=_0x585b('0x114');_0x27954b['dropreason']=_0x585b('0x115');_0x27954b['agiafterat']=this[_0x585b('0x1e')][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x116')]?moment()[_0x585b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x27954b['countdropretry']+=0x1;_0x27954b[_0x585b('0xfe')]+=0x1;if(_0x27954b[_0x585b('0xf2')]>=this[_0x585b('0x1e')][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x117')]){this['queueCallerAbandonCreateState'](_0x27954b);}else{this[_0x585b('0xbd')]({'active':![],'countdropretry':_0x27954b[_0x585b('0xf2')],'scheduledat':moment()[_0x585b('0xf8')](this['voiceQueues'][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x118')],_0x585b('0xfa'))['format'](_0x585b('0x103')),'ContactId':_0x679a30[_0x585b('0xd0')],'ListId':_0x679a30[_0x585b('0xd1')],'VoiceQueueId':_0x679a30['VoiceQueueId']||undefined,'CampaignId':_0x679a30[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x119')));var _0x471513=new History(_0x27954b);_0x471513[_0x585b('0xa3')]=0xa;_0x471513[_0x585b('0xa4')]=_0x585b('0x114');_0x471513[_0x585b('0xa6')]=moment()[_0x585b('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x471513['endtime']=_0x471513['starttime'];_0x471513['calleridname']=_0x27954b['calleridname'];_0x471513['calleridnum']=_0x27954b[_0x585b('0x11a')];this[_0x585b('0xca')](_0x471513)[_0x585b('0xae')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x585b('0x1e')][_0x3761b4['queue']][_0x585b('0x7a')]+=0x1;this[_0x585b('0x1e')][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x11b')]+=0x1;_0x27954b['state']=0xb;_0x27954b[_0x585b('0xa4')]=_0x585b('0x11c');_0x27954b['dropreason']=_0x585b('0x11d');_0x27954b[_0x585b('0xf3')]+=0x1;_0x27954b[_0x585b('0xfe')]+=0x1;if(_0x27954b[_0x585b('0xf3')]>=this[_0x585b('0x1e')][_0x3761b4[_0x585b('0xb1')]][_0x585b('0x11e')]){this[_0x585b('0x110')](_0x27954b);}else{this[_0x585b('0xbd')]({'active':![],'countabandonedretry':_0x27954b[_0x585b('0xf3')],'scheduledat':moment()[_0x585b('0xf8')](this[_0x585b('0x1e')][_0x3761b4['queue']][_0x585b('0x11f')],'minutes')[_0x585b('0x72')](_0x585b('0x103')),'ContactId':_0x679a30[_0x585b('0xd0')],'ListId':_0x679a30['ListId'],'VoiceQueueId':_0x679a30[_0x585b('0xd3')]||undefined,'CampaignId':_0x679a30[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x120')));var _0x471513=new History(_0x27954b);_0x471513[_0x585b('0xa3')]=0xb;_0x471513[_0x585b('0xa4')]=_0x585b('0x11c');_0x471513[_0x585b('0xa6')]=moment()['format'](_0x585b('0x103'));_0x471513[_0x585b('0xa5')]=_0x471513[_0x585b('0xa6')];_0x471513['calleridname']=_0x27954b['calleridname'];_0x471513[_0x585b('0x11a')]=_0x27954b['calleridnum'];this['createHistory'](_0x471513)[_0x585b('0xae')](loggerCatch(_0x585b('0x121')));}}}}};Dialer[_0x585b('0x1b')][_0x585b('0x34')]=function(_0x39349d){if(this[_0x585b('0x24')][_0x39349d['uniqueid']]){this[_0x585b('0x24')][_0x39349d[_0x585b('0xdc')]][_0x585b('0x122')]=_0x39349d[_0x585b('0x122')];}if(this[_0x585b('0xa8')][_0x39349d[_0x585b('0xdc')]]){this[_0x585b('0xa8')][_0x39349d['uniqueid']][_0x585b('0x122')]=_0x39349d[_0x585b('0x122')];}};Dialer[_0x585b('0x1b')][_0x585b('0x37')]=function(_0x3359ac){if(strategy[this[_0x585b('0x1e')][this[_0x585b('0x24')][_0x3359ac['actionid']][_0x585b('0xb1')]][_0x585b('0x4c')]]==='roundrobin'){if(this[_0x585b('0x24')][_0x3359ac[_0x585b('0x123')]]&&_[_0x585b('0xac')](this[_0x585b('0x24')][_0x3359ac['actionid']][_0x585b('0x124')])&&_0x3359ac[_0x585b('0xad')]==='1'&&_0x3359ac[_0x585b('0x125')]==='0'){if(this[_0x585b('0x20')][_0x3359ac[_0x585b('0x126')]]){if(!this['agents'][_0x3359ac[_0x585b('0x126')]]['locked']){this[_0x585b('0x20')][_0x3359ac['stateinterface']]['locked']=!![];this[_0x585b('0x24')][_0x3359ac['actionid']][_0x585b('0x124')]=!![];this[_0x585b('0x24')][_0x3359ac['actionid']][_0x585b('0x126')]=_0x3359ac[_0x585b('0x126')];}}}}else if((strategy[this['voiceQueues'][this[_0x585b('0x24')][_0x3359ac['actionid']]['queue']][_0x585b('0x4c')]]||_0x585b('0x19'))===_0x585b('0x19')){if(this[_0x585b('0x24')][_0x3359ac[_0x585b('0x123')]]){if(this[_0x585b('0x20')][_0x3359ac['stateinterface']]){this['actions'][_0x3359ac[_0x585b('0x123')]]['stateinterface']=_0x3359ac['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0x585b('0x24')][_0x3359ac[_0x585b('0x123')]][_0x585b('0xb1')]])){this[_0x585b('0x27')][this[_0x585b('0x24')][_0x3359ac[_0x585b('0x123')]][_0x585b('0xb1')]]=[];}this[_0x585b('0x27')][this[_0x585b('0x24')][_0x3359ac[_0x585b('0x123')]][_0x585b('0xb1')]][_0x585b('0x127')](_['merge'](_[_0x585b('0xcf')](this['actions'][_0x3359ac[_0x585b('0x123')]],[_0x585b('0x128'),_0x585b('0x126')]),{'status':_0x3359ac['status'],'paused':_0x3359ac[_0x585b('0x125')]}));}}}};function unlockQueueStatus(_0x2c73df,_0x967209){setTimeout(function(){if(_[_0x585b('0x88')](_0x2c73df[_0x585b('0x129')])){loggerBooked[_0x585b('0x92')](_0x585b('0x12a'),_0x967209);}_0x2c73df[_0x585b('0x129')]=!![];loggerBooked['info'](_0x585b('0x12b'),_0x967209,JSON[_0x585b('0x12c')](_[_0x585b('0xcf')](_0x2c73df,[_0x585b('0x3c'),_0x585b('0x129')])));},0x1f3);}Dialer[_0x585b('0x1b')][_0x585b('0x39')]=function(_0x3f5925){var _0x5f3d48=this;var _0x2e999=_0x5f3d48[_0x585b('0x1e')][_0x5f3d48[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]];if(strategy[this[_0x585b('0x1e')][this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]]['queue']][_0x585b('0x4c')]]===_0x585b('0x1a')){if(this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]]&&this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0x126')]){this[_0x585b('0x8c')][_0x585b('0x12d')](this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]]['idHopper'],this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0x126')])[_0x585b('0xae')](function(_0x1d1764){logger[_0x585b('0x92')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x585b('0x91')](_0x1d1764,{'showHidden':![],'depth':null}));})[_0x585b('0x12e')](function(){_0x5f3d48[_0x585b('0xb0')](_0x5f3d48[_0x585b('0x1e')][_0x5f3d48[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]);_0x5f3d48[_0x585b('0x20')][_0x5f3d48['actions'][_0x3f5925[_0x585b('0x123')]]['stateinterface']]['locked']=![];delete _0x5f3d48[_0x585b('0x24')][_0x3f5925['actionid']];unlockQueueStatus(_0x2e999);});}else{this[_0x585b('0xb0')](this['voiceQueues'][this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]);this[_0x585b('0xbd')]({'active':![],'ContactId':this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xd0')],'ListId':this[_0x585b('0x24')][_0x3f5925['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xd3')]||undefined,'CampaignId':this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x12f')));delete this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]];unlockQueueStatus(_0x2e999);}}else if((strategy[this[_0x585b('0x1e')][this[_0x585b('0x24')][_0x3f5925['actionid']][_0x585b('0xb1')]][_0x585b('0x4c')]]||'rrmemory')===_0x585b('0x19')){var _0xa14196;if(this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]]&&!_[_0x585b('0x45')](this[_0x585b('0x27')][this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]])){if(this[_0x585b('0x130')][_0x5f3d48[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]){this['queueBookedRR'][_0x5f3d48[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]=this[_0x585b('0x130')][this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]?this[_0x585b('0x130')][this[_0x585b('0x24')][_0x3f5925[_0x585b('0x123')]]['queue']]:this[_0x585b('0x27')][this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]]?this['queueBooked'][this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]][_0x585b('0x131')]||0x0:0x0;}this[_0x585b('0x27')][this['actions'][_0x3f5925[_0x585b('0x123')]][_0x585b('0xb1')]][_0x585b('0x131')]=this[_0x585b('0x130')][this[_0x585b('0x24')][_0x3f5925['actionid']][_0x585b('0xb1')]];for(var _0x302b7e=0x0;_0x302b7e=0x0;})[_0x585b('0xae')](myreject(_0x3b5a9d)));}}else{_0x186dc9[_0x585b('0x127')](ami[_0x585b('0x14a')]({'action':_0x585b('0x150'),'command':util[_0x585b('0x72')](_0x585b('0x14b'),_0x483758,!_[_0x585b('0x88')](config['timezones'][_0x42c05d])?_0x42c05d:'')})[_0x585b('0xb5')](function(_0x4a609e){return _0x4a609e[_0x585b('0x14d')][_0x585b('0x14e')](_0x585b('0x14f'))>=0x0;})[_0x585b('0xae')](myreject(_0x3b5a9d)));}BPromise['all'](_0x186dc9)[_0x585b('0xb5')](function(_0x2e5e7a){var _0x56f4f2=_[_0x585b('0x151')](_0x2e5e7a);if(_0x56f4f2){return _0x4e06c6(_0x56f4f2);}else{_0x383207[_0x585b('0x3e')]=_0x405093?_0x585b('0x152'):_0x585b('0x153');return _0x3b5a9d(msgResponse(_0x585b('0x154'),_0x585b('0x143'),'Global:\x20'+_0x405093+'\x20'+_0x3a13f5+'\x20Interval\x20is\x20overtime:\x20'+util[_0x585b('0x91')](_0x483758,{'showHidden':![],'depth':null})+_0x585b('0x155')+_0x42c05d));}})['catch'](function(_0xd14d05){return _0x3b5a9d(msgResponse(_0x585b('0x141'),_0x585b('0x143'),JSON['stringify'](_0xd14d05)));});});};Dialer[_0x585b('0x1b')][_0x585b('0x156')]=function(_0xf9c2d1){var _0x555e5a=this;return function(){switch(_0xf9c2d1[_0x585b('0x59')]){case'progressive':freeVariablesPredictive(_0xf9c2d1);_0x555e5a[_0x585b('0x157')](_0xf9c2d1,0x1);break;case'power':freeVariablesPredictive(_0xf9c2d1);_0x555e5a[_0x585b('0x157')](_0xf9c2d1,_0xf9c2d1[_0x585b('0x158')]);break;case _0x585b('0x8'):_0x555e5a[_0x585b('0x8')](_0xf9c2d1);break;case _0x585b('0x7'):freeVariablesPredictive(_0xf9c2d1);_0x555e5a[_0x585b('0x157')](_0xf9c2d1,0x1);break;default:freeVariablesPredictive(_0xf9c2d1);logger[_0x585b('0x92')](_0x585b('0x159'),_0xf9c2d1[_0x585b('0x3c')],'method\x20not\x20recognized');}};};Dialer[_0x585b('0x1b')][_0x585b('0x15a')]=function(_0x3732f0){var _0x5b5b64=this;return function(){_0x5b5b64[_0x585b('0x15b')](_0x3732f0);};};Dialer[_0x585b('0x1b')][_0x585b('0xa')]=function(_0x1f7338){var _0x361b28=this;if(isNotPreview(_0x1f7338[_0x585b('0x59')])){if(isVoiceQueueOutbound(_0x1f7338[_0x585b('0x4b')])&&isActive(_0x1f7338[_0x585b('0x58')])){_0x1f7338[_0x585b('0x9b')]=!![];BPromise[_0x585b('0xb4')]()[_0x585b('0xb5')](checkIsLoggedIn(_0x1f7338,_0x1f7338[_0x585b('0x4f')]))[_0x585b('0xb5')](checkIsActive(_0x1f7338,_0x1f7338[_0x585b('0x58')]))['then'](checkInterval(_0x1f7338))[_0x585b('0xb5')](_0x361b28[_0x585b('0x13c')](_0x1f7338))[_0x585b('0xb5')](_0x361b28[_0x585b('0x140')](_0x1f7338[_0x585b('0x15c')],_0x1f7338[_0x585b('0x15d')],_0x1f7338[_0x585b('0x3c')],_0x1f7338))[_0x585b('0xb5')](_0x361b28[_0x585b('0x142')](_0x1f7338['Interval'],_0x1f7338['dialTimezone'],_0x1f7338[_0x585b('0x3c')],_0x1f7338))['then'](_0x361b28[_0x585b('0x156')](_0x1f7338))[_0x585b('0xae')](loggerCatchQueueSummary(_0x585b('0x15e'),_0x1f7338));}else{notSendMessagesQueue(_0x1f7338);}}else{freeVariablesPredictive(_0x1f7338);}};Dialer['prototype'][_0x585b('0x13b')]=function(){var _0x204f49=this;var _0x158634;for(var _0x531ff8 in this[_0x585b('0x1f')]){if(typeof this['campaigns'][_0x531ff8]!==_0x585b('0xaa')){_0x158634=this[_0x585b('0x1f')][_0x531ff8];if(isCampaignIvr(_0x158634[_0x585b('0x4b')])&&isActive(_0x158634[_0x585b('0x71')])){_0x158634[_0x585b('0x9b')]=!![];BPromise[_0x585b('0xb4')]()['then'](checkIsActive(_0x158634,_0x158634['active']))[_0x585b('0xb5')](checkInterval(_0x158634))[_0x585b('0xb5')](_0x204f49[_0x585b('0x13c')](_0x158634))[_0x585b('0xb5')](_0x204f49['checkIfTime'](_0x158634['dialGlobalInterval'],_0x158634[_0x585b('0x15d')],_0x158634[_0x585b('0x3c')],_0x158634))[_0x585b('0xb5')](_0x204f49[_0x585b('0x142')](_0x158634['Interval'],_0x158634[_0x585b('0x15d')],_0x158634[_0x585b('0x3c')],_0x158634))[_0x585b('0xb5')](_0x204f49['launchHandleIvr'](_0x158634))[_0x585b('0xae')](loggerCatchQueueSummary(_0x585b('0x15f'),_0x158634));}else{notSendMessagesCampaign(_0x158634);}}}};function getCallerIdRandom(_0x224ef8,_0x552970){var _0x28c140;var _0x9b27c4;var _0x42e3f3;if(_0x552970<=0x0){_0x552970=0x1;}_0x28c140=new RegExp(_0x585b('0x160')+_0x552970+'}$');_0x9b27c4=Math['pow'](0xa,_0x552970-0x1);_0x42e3f3=Math['pow'](0xa,_0x552970)-0x1;return util[_0x585b('0x72')]('%s',_['replace'](_0x224ef8,_0x28c140,_[_0x585b('0x161')](_0x9b27c4,_0x42e3f3)));}function extractCalleridName(_0x2402a6){var _0x4c4922=_0x2402a6[_0x585b('0x162')](/"(.*?)"/);return _0x4c4922?_0x4c4922[0x1]:_0x2402a6;}function extractCalleridNumber(_0x432aaf){var _0x363deb=_0x432aaf[_0x585b('0x162')](/<(.*?)>/);return _0x363deb?_0x363deb[0x1]:_0x432aaf;}Dialer[_0x585b('0x1b')][_0x585b('0x163')]=function(_0x1c7a2c,_0x191aca){var _0xead040=this;var _0x5a4732=uuid['v4']();this[_0x585b('0x24')][_0x5a4732]=new Action(_0x1c7a2c,_0x191aca,_0x5a4732);return new BPromise(function(_0x323f18,_0x1ec890){if(_[_0x585b('0x88')](_0x1c7a2c)&&typeof _0x1c7a2c!==_0x585b('0x164')){return _0x1ec890(msgResponse(_0x585b('0x165'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x585b('0x88')](_0x191aca[_0x585b('0x166')][_0x585b('0x167')])||_0x191aca[_0x585b('0x166')][_0x585b('0x167')]===null){return _0x1ec890(msgResponse('originate','Failure',_0x585b('0x168')));}var _0x55231c={'XMD-CALLERID':_0xead040['actions'][_0x5a4732][_0x585b('0x169')](),'XMD-AGI':_0x1c7a2c[_0x585b('0x107')]?util[_0x585b('0x72')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1c7a2c[_0x585b('0x107')]):_0x585b('0x16a'),'XMD-AGIAFTER':_0x1c7a2c['dialQueueProject2']?util['format'](_0x585b('0x16b'),ipAgi,_0x1c7a2c[_0x585b('0x116')]):_0x585b('0x16a'),'XMD-QUEUE':_0x1c7a2c['type']==='outbound'?util[_0x585b('0x72')]('\x22%s,%s%s,,,%s\x22',_0x1c7a2c[_0x585b('0x3c')],_0x1c7a2c[_0x585b('0x16c')]||'',_0x1c7a2c[_0x585b('0x10c')]?'c':'',_0x1c7a2c[_0x585b('0x113')]||0x3):_0x585b('0x16a'),'XMD-CONTACTID':_0x191aca['ContactId'],'XMD-CDRTYPE':_0x585b('0x5'),'CALLERID(all)':_0xead040[_0x585b('0x24')][_0x5a4732][_0x585b('0x169')](),'XMD-AMD':_0x1c7a2c['dialAMDActive']?'ACTIVE':_0x585b('0x16a'),'XMD-DESTINATION':_0x585b('0xdf')};if(_0x1c7a2c[_0x585b('0xe0')]){_0x55231c[_0x585b('0x16d')]=_0x1c7a2c[_0x585b('0x16e')]||0x9c4;_0x55231c[_0x585b('0x16f')]=_0x1c7a2c[_0x585b('0x170')]||0x5dc;_0x55231c[_0x585b('0x171')]=_0x1c7a2c[_0x585b('0x172')]||0x320;_0x55231c[_0x585b('0x173')]=_0x1c7a2c[_0x585b('0x174')]||0x1388;_0x55231c['XMD-AMDMINWORDLENGTH']=_0x1c7a2c[_0x585b('0x175')]||0x64;_0x55231c[_0x585b('0x176')]=_0x1c7a2c[_0x585b('0x177')]||0x32;_0x55231c[_0x585b('0x178')]=_0x1c7a2c[_0x585b('0x179')]||0x3;_0x55231c[_0x585b('0x17a')]=_0x1c7a2c[_0x585b('0x17b')]||0x100;_0x55231c['XMD-AMDMAXIMUMWORDLENGTH']=_0x1c7a2c['dialAMDMaximumWordLength']||0x1388;}if(_0x1c7a2c[_0x585b('0x4b')]===_0x585b('0x8b')){_0x55231c['XMD-VOICEQUEUEID']=_0x191aca['VoiceQueueId'];}else{_0x55231c[_0x585b('0x17c')]=_0x191aca['CampaignId'];}for(var _0x4c2f3c in _0x191aca[_0x585b('0x166')]){if(typeof _0x191aca[_0x585b('0x166')][_0x4c2f3c]!==_0x585b('0xaa')){if(isNotNull(_0x191aca[_0x585b('0x166')][_0x4c2f3c])&&_0x4c2f3c!=='id'&&_0x4c2f3c!==_0x585b('0x17d')&&_0x4c2f3c!=='createdAt'&&_0x4c2f3c!==_0x585b('0x17e')){_0x55231c[util['format'](_0x585b('0x17f'),_0x585b('0x180'),_[_0x585b('0x181')](_0x4c2f3c))]=_0x191aca['Contact'][_0x4c2f3c];}}}var _0x172cdf=_0xead040[_0x585b('0xd8')](_0x1c7a2c[_0x585b('0x70')])?getCallerId(_0x1c7a2c[_0x585b('0x70')][_0x585b('0x182')],_0x1c7a2c['dialOriginateCallerIdName'],_0x1c7a2c[_0x585b('0x183')]>0x0?getCallerIdRandom(_0x1c7a2c[_0x585b('0x5a')],_0x1c7a2c[_0x585b('0x183')]):_0x1c7a2c[_0x585b('0x5a')]):getCallerId(_[_0x585b('0xac')](_0x1c7a2c[_0x585b('0x13d')])?_0x1c7a2c['Trunk'][_0x585b('0x182')]:_0x1c7a2c['TrunkBackup'][_0x585b('0x182')],_0x1c7a2c[_0x585b('0x184')],_0x1c7a2c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1c7a2c[_0x585b('0x5a')],_0x1c7a2c[_0x585b('0x183')]):_0x1c7a2c[_0x585b('0x5a')]);if(_0x172cdf){_0x55231c['XMD-ORIGINATECALLERIDNAME']=_0xead040[_0x585b('0x24')][_0x5a4732][_0x585b('0x185')]=extractCalleridName(_0x172cdf);_0x55231c['XMD-ORIGINATECALLERIDNUM']=_0xead040[_0x585b('0x24')][_0x5a4732][_0x585b('0x186')]=extractCalleridNumber(_0x172cdf);}return ami[_0x585b('0x14a')]({'actionid':_0x5a4732,'action':_0x585b('0x165'),'channel':_0xead040['isTrunkReachable'](_0x1c7a2c[_0x585b('0x70')])?util[_0x585b('0x72')](_0x585b('0x187'),_0x1c7a2c[_0x585b('0x70')][_0x585b('0x3c')],isNotNull(_0x1c7a2c['dialPrefix'])?_0x1c7a2c[_0x585b('0x5c')][_0x585b('0x188')]()||'':'',_0x1c7a2c[_0x585b('0x189')]>0x0?_0x191aca['Contact'][_0x585b('0x167')][_0x585b('0x18a')](_0x1c7a2c[_0x585b('0x189')]):_0x191aca[_0x585b('0x166')][_0x585b('0x167')]):util[_0x585b('0x72')](_0x585b('0x187'),_[_0x585b('0xac')](_0x1c7a2c[_0x585b('0x13d')])?_0x1c7a2c[_0x585b('0x70')][_0x585b('0x3c')]:_0x1c7a2c[_0x585b('0x13d')][_0x585b('0x3c')],isNotNull(_0x1c7a2c[_0x585b('0x5c')])?_0x1c7a2c[_0x585b('0x5c')][_0x585b('0x188')]()||'':'',_0x1c7a2c['dialCutDigit']>0x0?_0x191aca['Contact'][_0x585b('0x167')][_0x585b('0x18a')](_0x1c7a2c[_0x585b('0x189')]):_0x191aca['Contact'][_0x585b('0x167')]),'callerid':_0x172cdf,'Exten':_0x585b('0xdf'),'Context':_0x585b('0x18b'),'Priority':'1','variable':_0x55231c,'timeout':(_0x1c7a2c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5a4732})['then'](function(_0x1e3ca2){return _0x323f18(_0x1e3ca2);})[_0x585b('0xae')](function(_0x421e6d){_0x1c7a2c[_0x585b('0x62')]+=0x1;var _0x303885=new History(_0xead040['actions'][_0x5a4732]);logger[_0x585b('0x92')](util[_0x585b('0x72')](_0x585b('0x18c'),JSON[_0x585b('0x12c')](_0x421e6d)));_0x303885[_0x585b('0xa3')]=0xe;_0x303885['statedesc']='OriginateError';_0x303885[_0x585b('0xa6')]=moment()[_0x585b('0x72')](_0x585b('0x103'));_0x303885[_0x585b('0xa5')]=_0x303885[_0x585b('0xa6')];_0xead040[_0x585b('0xca')](_0x303885)[_0x585b('0xae')](loggerCatch(_0x585b('0x18d')));_0xead040[_0x585b('0xc8')](_0x303885)[_0x585b('0xae')](loggerCatch('[originate][error]'))[_0x585b('0x12e')](function(){delete _0xead040[_0x585b('0x24')][_0x5a4732];return _0x1ec890(msgResponse(_0x585b('0x165'),_0x585b('0x47'),_0x585b('0x18e')));});});});};Dialer[_0x585b('0x1b')][_0x585b('0x2d')]=function(_0x41dbcf){var _0x14f89f=this[_0x585b('0x24')][_0x41dbcf[_0x585b('0x123')]];if(_0x14f89f){delete this[_0x585b('0x24')][_0x41dbcf[_0x585b('0x123')]];_0x14f89f[_0x585b('0x112')]=moment()['format'](_0x585b('0x103'));var _0xe5cfdf=_0x14f89f['type']===_0x585b('0x8d')?this[_0x585b('0x1f')][_0x14f89f[_0x585b('0xb1')]]:this[_0x585b('0x1e')][_0x14f89f[_0x585b('0x18f')]()];if(!this[_0x585b('0xd7')](_0x41dbcf['response'])){this['updateOriginated'](_0xe5cfdf);return this[_0x585b('0x190')](_0x14f89f,_0xe5cfdf,_0x41dbcf)[_0x585b('0xae')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x41dbcf[_0x585b('0xdc')]]=_0x14f89f;}};Dialer['prototype'][_0x585b('0x191')]=function(_0x4a511e,_0x3f10f3,_0x395fdb){var _0x4f27d4=new History(_0x3f10f3);if(_0x4f27d4[_0x585b('0xff')]+_0x4f27d4[_0x585b('0xf0')]+_0x4f27d4[_0x585b('0x100')]+_0x4f27d4[_0x585b('0xf1')]+_0x4f27d4['countdropretry']+_0x4f27d4[_0x585b('0xf3')]+_0x4f27d4[_0x585b('0xeb')]+_0x4f27d4[_0x585b('0xf4')]>=_0x395fdb[_0x585b('0xf5')]-0x1){return!![];}switch(_0x4a511e){case 0x3:if(_0x4f27d4[_0x585b('0x100')]>=_0x395fdb['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4f27d4[_0x585b('0x100')]+=0x1,'scheduledat':moment()['add'](_0x395fdb[_0x585b('0x192')],'minutes')[_0x585b('0x72')](_0x585b('0x103')),'ContactId':_0x4f27d4['ContactId'],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4['CampaignId']||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x193')));break;case 0x5:if(_0x4f27d4[_0x585b('0xff')]>=_0x395fdb[_0x585b('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4f27d4[_0x585b('0xff')]+=0x1,'scheduledat':moment()[_0x585b('0xf8')](_0x395fdb[_0x585b('0x195')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4['ListId'],'VoiceQueueId':_0x4f27d4['VoiceQueueId']||undefined,'CampaignId':_0x4f27d4[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x196')));break;case 0x8:if(_0x4f27d4[_0x585b('0xf0')]>=_0x395fdb[_0x585b('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4f27d4['countcongestionretry']+=0x1,'scheduledat':moment()[_0x585b('0xf8')](_0x395fdb['dialCongestionRetryFrequency'],_0x585b('0xfa'))[_0x585b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4[_0x585b('0xd4')]||undefined})['catch'](loggerCatch(_0x585b('0x198')));break;case 0x0:if(_0x4f27d4['countnosuchnumberretry']>=_0x395fdb[_0x585b('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4f27d4[_0x585b('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x395fdb[_0x585b('0x19a')],_0x585b('0xfa'))[_0x585b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4['CampaignId']||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x19b')));}break;case 0xa:if(_0x4f27d4[_0x585b('0xf2')]>=_0x395fdb[_0x585b('0x117')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4f27d4[_0x585b('0xf2')]+=0x1,'scheduledat':moment()[_0x585b('0xf8')](_0x395fdb[_0x585b('0x118')],_0x585b('0xfa'))['format'](_0x585b('0x103')),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4f27d4[_0x585b('0xf3')]>=_0x395fdb[_0x585b('0x11e')]-0x1){return!![];}this[_0x585b('0xbd')]({'active':![],'countabandonedretry':_0x4f27d4[_0x585b('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x395fdb[_0x585b('0x11f')],_0x585b('0xfa'))[_0x585b('0x72')](_0x585b('0x103')),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4['CampaignId']||undefined})['catch'](loggerCatch(_0x585b('0x120')));break;case 0x13:if(_0x4f27d4['countmachineretry']>=_0x395fdb[_0x585b('0x102')]-0x1){return!![];}this[_0x585b('0xbd')]({'active':![],'countmachineretry':_0x4f27d4[_0x585b('0xeb')]+=0x1,'scheduledat':moment()[_0x585b('0xf8')](_0x395fdb[_0x585b('0xf9')],'minutes')[_0x585b('0x72')](_0x585b('0x103')),'ContactId':_0x4f27d4[_0x585b('0xd0')],'ListId':_0x4f27d4[_0x585b('0xd1')],'VoiceQueueId':_0x4f27d4['VoiceQueueId']||undefined,'CampaignId':_0x4f27d4[_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4f27d4[_0x585b('0xf4')]>=_0x395fdb[_0x585b('0x19c')]-0x1){return!![];}this[_0x585b('0xbd')]({'active':![],'countagentrejectretry':_0x4f27d4[_0x585b('0xf4')]+=0x1,'scheduledat':moment()[_0x585b('0xf8')](_0x395fdb['dialAgentRejectRetryFrequency'],_0x585b('0xfa'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f27d4['ContactId'],'ListId':_0x4f27d4['ListId'],'VoiceQueueId':_0x4f27d4[_0x585b('0xd3')]||undefined,'CampaignId':_0x4f27d4['CampaignId']||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x19d')));break;default:return!![];}};Dialer['prototype'][_0x585b('0x190')]=function(_0x2706d3,_0x4c9760,_0x97ec7d){var _0x443539=this;var _0x3b41d0=new History(_0x2706d3);return new BPromise(function(_0x2f74f2,_0x5c24c3){if(_['isUndefined'](_0x4c9760)&&typeof _0x4c9760!==_0x585b('0x164')){return _0x5c24c3(msgResponse(_0x585b('0x19e'),_0x585b('0x143'),_0x585b('0x19f')));}if(_[_0x585b('0x88')](_0x97ec7d)&&typeof _0x97ec7d!==_0x585b('0x164')){return _0x5c24c3(msgResponse(_0x585b('0x19e'),'Failure',_0x585b('0x1a0')));}switch(_0x97ec7d['reason']){case'0':_0x4c9760[_0x585b('0x61')]+=0x1;_0x3b41d0['state']=0x0;_0x3b41d0['statedesc']=_0x585b('0x1a1');_0x3b41d0[_0x585b('0xf1')]+=0x1;_0x3b41d0[_0x585b('0xfe')]+=0x1;ami['emit'](_0x585b('0x1a2'),ut[_0x585b('0xee')](_0x2706d3,_0x585b('0x1a3')));_0x443539[_0x585b('0xca')](_0x3b41d0)['catch'](loggerCatch(_0x585b('0xef')));if(_0x443539['checkRetriveMax'](0x0,_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0xf1')]>=_0x4c9760[_0x585b('0x199')]){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,'reason\x200\x20no\x20such\x20number....');}else{_0x443539['stateGlobal'](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1a4'));}}break;case'3':_0x4c9760[_0x585b('0x1a5')]+=0x1;_0x3b41d0['state']=0x3;_0x3b41d0[_0x585b('0xa4')]=_0x585b('0x1a6');_0x3b41d0['countnoanswerretry']+=0x1;_0x3b41d0['countglobal']+=0x1;ami['emit'](_0x585b('0x1a7'),ut[_0x585b('0xee')](_0x2706d3,'noanswer'));_0x443539[_0x585b('0xca')](_0x3b41d0)[_0x585b('0xae')](loggerCatch(_0x585b('0x1a8')));if(_0x443539[_0x585b('0x191')](0x3,_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0x100')]>=_0x4c9760[_0x585b('0x1a9')]){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1aa'));}else{_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1aa'));}}break;case'5':_0x4c9760['outboundBusyCallsDay']+=0x1;_0x3b41d0[_0x585b('0xa3')]=0x5;_0x3b41d0[_0x585b('0xa4')]=_0x585b('0x1ac');_0x3b41d0['countbusyretry']+=0x1;_0x3b41d0[_0x585b('0xfe')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x585b('0xee')](_0x2706d3,_0x585b('0x1ad')));_0x443539[_0x585b('0xca')](_0x3b41d0)[_0x585b('0xae')](loggerCatch(_0x585b('0x1ae')));if(_0x443539[_0x585b('0x191')](0x5,_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0xff')]>=_0x4c9760[_0x585b('0x194')]){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,'reason\x205\x20busy');}else{_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1af'));}}break;case'8':_0x4c9760['outboundCongestionCallsDay']+=0x1;_0x3b41d0['state']=0x8;_0x3b41d0[_0x585b('0xa4')]=_0x585b('0x1b0');_0x3b41d0[_0x585b('0xf0')]+=0x1;_0x3b41d0['countglobal']+=0x1;ami['emit'](_0x585b('0x1b1'),ut['buildObj'](_0x2706d3,_0x585b('0x1b2')));_0x443539[_0x585b('0xca')](_0x3b41d0)[_0x585b('0xae')](loggerCatch(_0x585b('0x1b3')));if(_0x443539[_0x585b('0x191')](0x8,_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0xf0')]>=_0x4c9760[_0x585b('0x197')]){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1b4'));}else{_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1b4'));}}break;case'11':_0x4c9760['outboundAbandonedCallsDay']+=0x1;_0x3b41d0[_0x585b('0xa3')]=0xb;_0x3b41d0['statedesc']='Abandoned';_0x3b41d0[_0x585b('0xf3')]+=0x1;_0x3b41d0[_0x585b('0xfe')]+=0x1;_0x443539['createHistory'](_0x3b41d0)['catch'](loggerCatch(_0x585b('0x121')));if(_0x443539['checkRetriveMax'](0xb,_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0xf3')]>=_0x4c9760['dialAbandonedMaxRetry']){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1b5'));}else{_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,'reason\x2011\x20abandoned');}}break;case'20':_0x4c9760[_0x585b('0x63')]+=0x1;_0x3b41d0[_0x585b('0xa3')]=0x14;_0x3b41d0[_0x585b('0xa4')]='AgentReject';_0x3b41d0[_0x585b('0xf4')]+=0x1;_0x3b41d0[_0x585b('0xfe')]+=0x1;ami[_0x585b('0xec')](_0x585b('0x1b6'),ut[_0x585b('0xee')](_0x2706d3,_0x585b('0x1b7')));_0x443539['createHistory'](_0x3b41d0)[_0x585b('0xae')](loggerCatch(_0x585b('0x1b8')));if(_0x443539[_0x585b('0x191')](0x14,_0x2706d3,_0x4c9760)){if(_0x3b41d0['countagentrejectretry']>=_0x4c9760[_0x585b('0x19c')]){_0x443539[_0x585b('0xf6')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1b9'));}else{_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x585b('0x1b9'));}}break;default:_0x4c9760['outboundUnknownCallsDay']+=0x1;_0x3b41d0[_0x585b('0xa3')]=0xc;_0x3b41d0[_0x585b('0xa4')]=_0x97ec7d[_0x585b('0x1ba')];_0x443539[_0x585b('0xca')](_0x3b41d0)[_0x585b('0xae')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x443539['checkRetriveMax'](_0x97ec7d[_0x585b('0x1ba')],_0x2706d3,_0x4c9760)){if(_0x3b41d0[_0x585b('0xff')]+_0x3b41d0[_0x585b('0xf0')]+_0x3b41d0['countnoanswerretry']+_0x3b41d0[_0x585b('0xf1')]+_0x3b41d0['countdropretry']+_0x3b41d0['countabandonedretry']+_0x3b41d0[_0x585b('0xeb')]+_0x3b41d0['countagentrejectretry']>=_0x4c9760[_0x585b('0xf5')]){_0x443539[_0x585b('0x1ab')](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x97ec7d[_0x585b('0x1ba')]);}else{_0x443539['createStateFinal'](_0x3b41d0,_0x2f74f2,_0x5c24c3,_0x97ec7d[_0x585b('0x1ba')]);}}}});};Dialer[_0x585b('0x1b')]['stateGlobal']=function(_0x576ec6,_0x471f55,_0x4854d3,_0x201205){var _0x4d4c39=new Final(_0x576ec6);_0x4d4c39[_0x585b('0xa3')]=0xf;_0x4d4c39['statedesc']=_0x585b('0x1bb');this[_0x585b('0xf6')](_0x4d4c39,_0x471f55,_0x4854d3,_0x201205);};Dialer[_0x585b('0x1b')][_0x585b('0xf6')]=function(_0x2af263,_0x36b881,_0x49fa43,_0x3c5a0c){this['moveContactManagedDialer'](_0x2af263)['then'](function(){return _0x36b881(msgResponse(_0x585b('0x19e'),'Success',_0x3c5a0c));})[_0x585b('0xae')](function(){return _0x49fa43(msgResponse(_0x585b('0x1bc'),_0x585b('0x143'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x585b('0x8')]=function(_0x748e1){var _0x3ccf86=_0x748e1[_0x585b('0x1bd')]/0x64;var _0x3360d5=_0x748e1[_0x585b('0x60')]/(_0x748e1['outboundDropCallsDayTimeout']+_0x748e1['outboundAnswerCallsDay']);var _0x42dff8=Math['round'](_0x748e1[_0x585b('0x1be')]*(_0x748e1[_0x585b('0x1bf')]/0x64));var _0x2d9ff5=Math[_0x585b('0x1c0')](_0x748e1[_0x585b('0x1be')]*(_0x748e1['predictiveIntervalMinThreshold']/0x64));var _0x52706f=_0x748e1['available']+_0x748e1[_0x585b('0x53')];var _0x235baf=Math[_0x585b('0x1c1')](_0x748e1['erlangCalls']*_0x748e1[_0x585b('0x6d')]*_0x748e1[_0x585b('0x67')]*_0x748e1[_0x585b('0x68')]);if(_[_0x585b('0x88')](_0x748e1[_0x585b('0x6f')])){if(!_[_0x585b('0x88')](_0x748e1['startPredictive'])){_0x748e1[_0x585b('0x6e')]=undefined;loggerPredictive[_0x585b('0x92')](_0x585b('0x1c2'),_0x585b('0x1c3'));}if(!_[_0x585b('0x88')](_0x748e1['handlePredictive'])){loggerPredictive['error'](_0x585b('0x1c2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x748e1[_0x585b('0x89')]);_0x748e1[_0x585b('0x89')]=undefined;}_0x748e1[_0x585b('0x6f')]=moment()[_0x585b('0x72')](_0x585b('0x103'));loggerPredictive['info'](_0x748e1[_0x585b('0x3c')],_0x585b('0x1c4'),_0x748e1[_0x585b('0x6f')]);this[_0x585b('0x157')](_0x748e1,0x1);}else if(ifInterval(_0x748e1[_0x585b('0x1c5')],_0x748e1['startProgressive'])){this[_0x585b('0x157')](_0x748e1,0x1);loggerPredictiveCalls['info'](_0x585b('0x1c6'),_0x748e1['startProgressive'],_0x748e1[_0x585b('0x3c')]);_0x748e1[_0x585b('0x6b')]=0x0;_0x748e1['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3ccf86<_0x3360d5&&_0x748e1[_0x585b('0x1c7')]===_0x585b('0x1c8')){freeVariablesPredictive(_0x748e1);loggerPredictive[_0x585b('0x74')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x585b('0x1c9'),_0x3360d5,'startProgressive',_0x748e1[_0x585b('0x3c')]);}else if(_0x235baf<_0x748e1['predictiveIntervalErlangCallsDroppedCalls']&&_0x748e1['dialPredictiveOptimization']===_0x585b('0x1c8')){freeVariablesPredictive(_0x748e1);loggerPredictive[_0x585b('0x74')](_0x585b('0x1ca'),_0x585b('0x1cb'),_0x235baf,_0x585b('0x1cc'),_0x748e1['predictiveIntervalErlangCallsDroppedCalls'],_0x585b('0x6f'),_0x748e1[_0x585b('0x3c')]);}else if(!ifInterval(_0x748e1[_0x585b('0x1c5')],_0x748e1[_0x585b('0x6f')])&&_[_0x585b('0x88')](_0x748e1['startPredictive'])&&!_[_0x585b('0x88')](_0x748e1['startProgressive'])){_0x748e1[_0x585b('0x6e')]=moment()[_0x585b('0x72')](_0x585b('0x103'));loggerPredictive[_0x585b('0x74')](_0x748e1[_0x585b('0x3c')],_0x585b('0x1cd'),_0x748e1['startPredictive']);this['averageHandleTime'](_0x748e1[_0x585b('0x1c5')])['then'](this['getDataPredictive'](_0x748e1))['then'](mergeDataErlangB(_0x748e1))['then'](this[_0x585b('0x1ce')](_0x748e1))[_0x585b('0xae')](loggerCatchPredictive(_0x585b('0x1cf'),_0x748e1));}else if(!ifInterval(_0x748e1[_0x585b('0x1c5')],_0x748e1['startPredictive'])){_0x748e1[_0x585b('0x1d0')]=0x0;_0x748e1[_0x585b('0x6e')]=moment()['format'](_0x585b('0x103'));loggerPredictive[_0x585b('0x74')](_0x748e1[_0x585b('0x3c')],'recalculate\x20predictive\x20at',_0x748e1[_0x585b('0x6e')]);clearInterval(_0x748e1[_0x585b('0x89')]);_0x748e1['handlePredictive']=undefined;this[_0x585b('0xba')](_0x748e1[_0x585b('0x1c5')])[_0x585b('0xb5')](this[_0x585b('0x1d1')](_0x748e1))[_0x585b('0xb5')](mergeDataErlangB(_0x748e1))[_0x585b('0xb5')](this[_0x585b('0x1ce')](_0x748e1))[_0x585b('0xae')](loggerCatchPredictive(_0x585b('0x1d2'),_0x748e1));}else if(_0x748e1[_0x585b('0x1be')]&&_0x52706f<_0x748e1[_0x585b('0x1be')]-_0x2d9ff5){freeVariablesPredictive(_0x748e1);loggerPredictive['info'](_0x748e1['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x52706f,_0x585b('0x1d3'),_0x748e1[_0x585b('0x1be')],'-',_0x2d9ff5,'=',_0x748e1['predictiveIntervalAvailable']-_0x2d9ff5,')');}else if(_0x748e1['predictiveIntervalAvailable']&&_0x52706f>_0x748e1[_0x585b('0x1be')]+_0x42dff8){freeVariablesPredictive(_0x748e1);loggerPredictive['info'](_0x748e1['name'],_0x585b('0x1d4'),_0x52706f,_0x585b('0x1d5'),_0x748e1[_0x585b('0x1be')],'+',_0x42dff8,'=',_0x748e1[_0x585b('0x1be')]+_0x42dff8,')');}};Dialer[_0x585b('0x1b')]['getDataPredictive']=function(_0x4d30a2){var _0x3e8c14=this;return function(_0x309ef3){return new BPromise(function(_0x2d165d,_0x202e4c){_[_0x585b('0x86')](_0x4d30a2,_0x309ef3[0x0]);if(checkGetDataPredictive(_0x309ef3[0x0])){var _0x13a8bb=_0x4d30a2[_0x585b('0x1be')]=_0x4d30a2['talking']+_0x4d30a2[_0x585b('0x4e')];var _0x30c851=_0x4d30a2[_0x585b('0x1c5')]*0x3c;var _0x279527=_0x309ef3[0x0][_0x585b('0x64')]+_0x309ef3[0x0][_0x585b('0x7c')];var _0x4eaa1b=(_0x309ef3[0x0]['predictiveIntervalAnsweredCalls']+_0x309ef3[0x0][_0x585b('0x65')]+_0x309ef3[0x0][_0x585b('0x7a')])/_0x309ef3[0x0][_0x585b('0x76')];_0x4d30a2[_0x585b('0x67')]=_0x4eaa1b>0x0?_0x4eaa1b:0x1;switch(_0x4d30a2[_0x585b('0x1c7')]){case'dropRate':var _0x19377d=_0x4d30a2[_0x585b('0x1bd')]/0x64;return _0x3e8c14[_0x585b('0x1d6')](_0x13a8bb,_0x30c851,_0x279527,_0x4eaa1b,_0x19377d)[_0x585b('0xb5')](function(_0x21b293){return _0x2d165d(_0x21b293);});case _0x585b('0x1d7'):var _0x5bccdd=_0x4d30a2[_0x585b('0x1bd')]/0x64;return _0x3e8c14[_0x585b('0x1d8')](_0x13a8bb,_0x30c851,_0x279527,_0x4eaa1b,_0x5bccdd)[_0x585b('0xb5')](function(_0x1e650f){return _0x2d165d(_0x1e650f);});default:return _0x202e4c(msgResponse(_0x585b('0x1d9'),_0x585b('0x143'),_0x585b('0x1da')));}}else{return _0x202e4c(msgResponse(_0x585b('0x1d9'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x585b('0x1db')]=function(_0x18d6f1){var _0x17f06c=this;return function(_0x2602c5){return new BPromise(function(_0x18ca10,_0x5a03b6){_[_0x585b('0x86')](_0x18d6f1,_0x2602c5[0x0]);if(checkGetDataPredictive(_0x2602c5[0x0])){loggerPredictive[_0x585b('0x74')](JSON[_0x585b('0x12c')](_0x2602c5[0x0]));if(_0x18d6f1[_0x585b('0x1c7')]===_0x585b('0x1c8')){return _0x17f06c[_0x585b('0xc6')](_0x18d6f1['id'])[_0x585b('0xb5')](function(_0x585b40){var _0x372891=_0x18d6f1[_0x585b('0x4f')]-_0x585b40[0x0]['outboundQueuePauses'];var _0x5e4227=_0x18d6f1[_0x585b('0x1c5')]*0x3c;var _0x40ea51=_0x2602c5[0x0][_0x585b('0x64')]+_0x2602c5[0x0][_0x585b('0x7c')];var _0x36547e=(_0x2602c5[0x0][_0x585b('0x1dc')]+_0x2602c5[0x0][_0x585b('0x65')]+_0x2602c5[0x0][_0x585b('0x7a')])/_0x2602c5[0x0][_0x585b('0x76')];var _0x61f36c=_0x18d6f1['dialPredictiveOptimizationPercentage']/0x64;_0x18d6f1['predictiveIntervalPauses']=_0x585b40[0x0][_0x585b('0x1dd')]||0x0;_0x18d6f1[_0x585b('0x67')]=_0x36547e>0x0?_0x36547e:0x1;return _0x17f06c[_0x585b('0x1d6')](_0x372891,_0x5e4227,_0x40ea51,_0x36547e,_0x61f36c);})[_0x585b('0xb5')](function(_0x243f4f){return _0x18ca10(_0x243f4f);})[_0x585b('0xae')](function(_0x12d54){return _0x5a03b6(msgResponse(_0x585b('0x1de'),_0x585b('0x143'),JSON[_0x585b('0x12c')](_0x12d54)));});}if(_0x18d6f1[_0x585b('0x1c7')]===_0x585b('0x1d7')){return _0x17f06c[_0x585b('0xc6')](_0x18d6f1['id'])[_0x585b('0xb5')](function(_0x15e3f2){var _0x6232d1=_0x18d6f1[_0x585b('0x4f')]-_0x15e3f2[0x0][_0x585b('0x1dd')];var _0x432dcb=_0x18d6f1[_0x585b('0x1c5')]*0x3c;var _0x1a695c=_0x2602c5[0x0][_0x585b('0x64')]+_0x2602c5[0x0][_0x585b('0x7c')];var _0x2ecf93=(_0x2602c5[0x0][_0x585b('0x1dc')]+_0x2602c5[0x0][_0x585b('0x65')]+_0x2602c5[0x0][_0x585b('0x7a')])/_0x2602c5[0x0]['predictiveIntervalTotalCalls'];var _0x3d41a6=_0x18d6f1[_0x585b('0x1bd')]/0x64;_0x18d6f1[_0x585b('0x69')]=_0x15e3f2[0x0][_0x585b('0x1dd')]||0x0;_0x18d6f1[_0x585b('0x67')]=_0x2ecf93>0x0?_0x2ecf93:0x1;return _0x17f06c[_0x585b('0x1d8')](_0x6232d1,_0x432dcb,_0x1a695c,_0x2ecf93,_0x3d41a6);})[_0x585b('0xb5')](function(_0x2fa37d){return _0x18ca10(_0x2fa37d);})[_0x585b('0xae')](function(_0x2e7d9c){return _0x5a03b6(msgResponse(_0x585b('0x1de'),'Failure',JSON['stringify'](_0x2e7d9c)));});}}else{return _0x5a03b6(msgResponse(_0x585b('0x1d9'),_0x585b('0x143'),_0x585b('0x1df')));}});};};Dialer[_0x585b('0x1b')][_0x585b('0x1ce')]=function(_0xc16972){var _0x2d9d3c=this;return function(){var _0x50f035=0x0;var _0x4883d0=Math[_0x585b('0x1c1')](_0xc16972[_0x585b('0x6c')]*0x3e8);if(_0x4883d0>0x0){_0x4883d0=_0x4883d0<0x64?0x64:_0x4883d0;loggerPredictive[_0x585b('0x74')](_0xc16972[_0x585b('0x3c')],_0x585b('0x1e0'),_0x4883d0,'milliseconds');_0xc16972[_0x585b('0x89')]=setInterval(function(){_0x2d9d3c[_0x585b('0x89')](_0xc16972);loggerPredictiveCalls[_0x585b('0x74')](_0x585b('0x1e1'),_0x50f035+=0x1);},_0x4883d0);}else{loggerPredictive[_0x585b('0x74')](_0xc16972[_0x585b('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x585b('0x1e2')]=function(_0x3f8031,_0x5c18e0){var _0x250040=this;return function(_0x107732){if(_['isEmpty'](_0x107732)){if(_['isNil'](_0x5c18e0[_0x585b('0xd2')])||!_0x5c18e0[_0x585b('0x1e3')]){if(_0x3f8031[_0x585b('0x59')]===_0x585b('0x7')){_0x3f8031[_0x585b('0x129')]=_['isUndefined'](_0x3f8031[_0x585b('0x129')])?!![]:_0x3f8031[_0x585b('0x129')];var _0x53bf25=uuid['v4']();_0x250040[_0x585b('0x24')][_0x53bf25]=new Action(_0x3f8031,_0x5c18e0,_0x53bf25);loggerBooked['info'](_0x585b('0x1e4'),_0x53bf25,_0x585b('0x1e5'),JSON[_0x585b('0x12c')](_0x3f8031[_0x585b('0x129')]),_0x585b('0x1e6'),_0x3f8031[_0x585b('0x3c')]);if(_0x3f8031[_0x585b('0x129')]){_0x3f8031[_0x585b('0x129')]=![];_0x250040[_0x585b('0x27')][_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xb1')]]=[];ami[_0x585b('0x14a')]({'actionid':_0x53bf25,'action':_0x585b('0x1e7'),'queue':_0x3f8031[_0x585b('0x3c')]})[_0x585b('0xae')](function(){_0x250040[_0x585b('0xb0')](_0x3f8031);_0x250040[_0x585b('0xbd')]({'active':![],'ContactId':_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xd0')],'ListId':_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xd1')],'VoiceQueueId':_0x250040['actions'][_0x53bf25]['VoiceQueueId']||undefined,'CampaignId':_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xd4')]||undefined})['catch'](loggerCatch(_0x585b('0x1e8')));delete _0x250040['actions'][_0x53bf25];});}else{loggerBooked[_0x585b('0x74')](_0x585b('0x1e9'),JSON[_0x585b('0x12c')](_0x3f8031[_0x585b('0x129')]),_0x585b('0x1e6'),_0x3f8031['name']);_0x250040[_0x585b('0xb0')](_0x3f8031);_0x250040['rescheduleContact']({'active':![],'ContactId':_0x250040[_0x585b('0x24')][_0x53bf25]['ContactId'],'ListId':_0x250040['actions'][_0x53bf25]['ListId'],'VoiceQueueId':_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xd3')]||undefined,'CampaignId':_0x250040[_0x585b('0x24')][_0x53bf25][_0x585b('0xd4')]||undefined})[_0x585b('0xae')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x250040[_0x585b('0x24')][_0x53bf25];}}else{return _0x250040[_0x585b('0x163')](_0x3f8031,_0x5c18e0);}}else{if(getDiff(_0x5c18e0['scheduledat'])<_0x3f8031[_0x585b('0x1ea')]*0x3c){if(_0x5c18e0[_0x585b('0x1eb')]&&!_0x5c18e0[_0x585b('0x1eb')][_0x585b('0x1ec')]){_0x250040[_0x585b('0x8c')]['run'](_0x5c18e0['id'])[_0x585b('0x12e')](function(){_0x250040['updateOriginated'](_0x3f8031);});}else{_0x250040['unlockContact']({'active':![]},_0x5c18e0['id'],0x1)[_0x585b('0x12e')](function(){_0x250040[_0x585b('0xb0')](_0x3f8031);});}}else{_0x3f8031[_0x585b('0x1ed')]+=0x1;_0x250040[_0x585b('0xb0')](_0x3f8031);if(_0x3f8031[_0x585b('0x1ee')]){_0x250040[_0x585b('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c18e0[_0x585b('0xd0')],'ListId':_0x5c18e0[_0x585b('0xd1')],'VoiceQueueId':_0x5c18e0['VoiceQueueId']||undefined,'CampaignId':_0x5c18e0['CampaignId']||undefined})[_0x585b('0xae')](loggerCatch(_0x585b('0x1ef')));_0x250040['createHistory'](createObjHistory(_0x3f8031,_0x5c18e0,_0x585b('0x1f0'),0x17,'RecallInQueue'))[_0x585b('0xae')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x250040[_0x585b('0xdb')](createObjHistory(_0x3f8031,_0x5c18e0,'RECALLFAILEDTIMEOUT',0x16,_0x585b('0x1f1')),'[Originate][HistoryRecallClose][historyCatch]',_0x585b('0x1f2'));}}}}else{_0x3f8031['outboundBlacklistCallsDay']+=0x1;_0x250040[_0x585b('0xdb')](createObjHistory(_0x3f8031,_0x5c18e0,_0x585b('0x1f3'),0xd,_0x585b('0x1f4')),_0x585b('0x1f5'),'[Originate][MoveBlacklist]');throw _0x585b('0x1f6');}};};Dialer[_0x585b('0x1b')][_0x585b('0x15b')]=function(_0x56aa71){var _0x360f18=this;var _0x4ae091=_0x56aa71[_0x585b('0x1f7')]-_0x56aa71[_0x585b('0x6a')]-_0x56aa71[_0x585b('0xc2')];emitCampaignSummary(_0x56aa71);if(_0x4ae091>0x0){if(_0x4ae091>this[_0x585b('0x22')]){_0x4ae091=this[_0x585b('0x22')];}_0x56aa71[_0x585b('0xc2')]+=_0x4ae091;this[_0x585b('0xc4')](_0x56aa71['id'],_0x4ae091,_0x56aa71[_0x585b('0x1f8')],_0x56aa71)[_0x585b('0xb5')](function(_0x5cd36){_0x56aa71['temp']-=_0x4ae091;_0x56aa71[_0x585b('0xc2')]=_0x56aa71['temp']>0x0?_0x56aa71[_0x585b('0xc2')]:0x0;if(!checkContactEmpty(_0x5cd36)){_0x56aa71[_0x585b('0x3e')]=_0x585b('0x99');logger[_0x585b('0x74')]('[getContactCampaign2][Empty]'+_0x56aa71[_0x585b('0x3c')]);}else{_0x56aa71[_0x585b('0x6a')]+=_0x5cd36[_0x585b('0x93')];_0x56aa71[_0x585b('0x3e')]=_0x585b('0x1f9');for(var _0x4cbe15=0x0;_0x4cbe15<_0x5cd36[_0x585b('0x93')];_0x4cbe15+=0x1){_0x56aa71[_0x585b('0x1fa')]+=0x1;if(_['isNil'](_0x5cd36[_0x4cbe15])||_[_0x585b('0xac')](_0x5cd36[_0x4cbe15][_0x585b('0x166')])||_['isNil'](_0x5cd36[_0x4cbe15][_0x585b('0x166')][_0x585b('0x167')])){_0x360f18['emptyContact'](_0x585b('0x1fb'),_0x56aa71,_0x5cd36[_0x4cbe15]);}else{_0x360f18[_0x585b('0xb8')](_[_0x585b('0xcf')](_0x5cd36[_0x4cbe15],['CampaignId',_0x585b('0x1fc')]))['then'](_0x360f18['checkContactBlack'](_0x56aa71,_0x5cd36[_0x4cbe15]))['catch'](_0x360f18['loggerHandler'](_0x585b('0x1fd'),_0x56aa71));}}}})[_0x585b('0xae')](loggerGetContactDialer(_0x585b('0x1fe'),_0x56aa71,_0x4ae091));}};Dialer[_0x585b('0x1b')][_0x585b('0x157')]=function(_0x1273ab,_0x45c9dd){var _0x342aeb=this;var _0x34f889=[];var _0x452ced=_0x45c9dd>=0x1?_0x45c9dd:0x1;if(_0x1273ab[_0x585b('0x59')]===_0x585b('0x7')){_0x452ced=0x1;}var _0x5ae810=Math[_0x585b('0x1c1')](_0x1273ab[_0x585b('0x4e')]*_0x452ced)-_0x1273ab['originated']-_0x1273ab['temp'];emitVoiceQueueSummary(_0x1273ab);if(_0x1273ab[_0x585b('0x1ff')]>0x0){var _0x57c1b8=_0x1273ab[_0x585b('0x1ff')]-_0x1273ab['originated']-_0x1273ab[_0x585b('0x53')]-_0x1273ab[_0x585b('0xc2')]-_0x1273ab[_0x585b('0x9d')];if(_0x5ae810>_0x57c1b8){_0x5ae810=_0x57c1b8;}}if(_0x5ae810>0x0){if(_0x1273ab['dialMethod']==='booked'){_0x5ae810=0x1;}if(_0x5ae810>this[_0x585b('0x22')]){_0x5ae810=this[_0x585b('0x22')];}_0x1273ab[_0x585b('0xc2')]+=_0x5ae810;for(var _0x302ba6 in this['agents']){if(typeof this[_0x585b('0x20')][_0x302ba6]!==_0x585b('0xaa')){if(this[_0x585b('0x20')][_0x302ba6][_0x585b('0xa3')]===_0x585b('0x200')&&this[_0x585b('0x20')][_0x302ba6][_0x585b('0xad')]===_0x585b('0xd9')){_0x34f889[_0x585b('0x127')](this['agents'][_0x302ba6]['id']);}}}this[_0x585b('0xc1')](_0x1273ab['id'],_0x34f889,_0x5ae810,_0x1273ab[_0x585b('0x1f8')],_0x1273ab)[_0x585b('0xb5')](function(_0x4a5040){_0x1273ab['temp']-=_0x5ae810;_0x1273ab[_0x585b('0xc2')]=_0x1273ab[_0x585b('0xc2')]>0x0?_0x1273ab[_0x585b('0xc2')]:0x0;if(!checkContactEmpty(_0x4a5040)){_0x342aeb[_0x585b('0xb3')](_0x1273ab)[_0x585b('0xb5')](sendMessageReschedule(_0x1273ab))[_0x585b('0xae')](loggerCatch(_0x585b('0xb6')));}else{_0x1273ab['originated']+=_0x4a5040[_0x585b('0x93')];_0x1273ab[_0x585b('0x3e')]=_0x1273ab[_0x585b('0x59')]===_0x585b('0x7')?_0x585b('0x201'):_0x585b('0x1f9');for(var _0x560d7a=0x0;_0x560d7a<_0x4a5040[_0x585b('0x93')];_0x560d7a+=0x1){if(_['isNil'](_0x4a5040[_0x560d7a])||_[_0x585b('0xac')](_0x4a5040[_0x560d7a][_0x585b('0x166')])||_[_0x585b('0xac')](_0x4a5040[_0x560d7a][_0x585b('0x166')]['phone'])){_0x342aeb[_0x585b('0x202')]('[actionOriginate]\x20',_0x1273ab,_0x4a5040[_0x560d7a]);}else{_0x342aeb[_0x585b('0xb7')](_[_0x585b('0xcf')](_0x4a5040[_0x560d7a],[_0x585b('0xd3'),_0x585b('0x1fc')]))[_0x585b('0xb5')](_0x342aeb['checkContactBlack'](_0x1273ab,_0x4a5040[_0x560d7a]))[_0x585b('0xae')](_0x342aeb[_0x585b('0xcd')](_0x585b('0x1fb'),_0x1273ab));}}}})[_0x585b('0xae')](loggerGetContactDialer(_0x585b('0x203'),_0x1273ab,_0x5ae810));}};Dialer[_0x585b('0x1b')][_0x585b('0x89')]=function(_0x23b9bc){if(_0x23b9bc['dialLimitQueue']>0x0){var _0x19032a=_0x23b9bc['dialLimitQueue']-_0x23b9bc[_0x585b('0x6a')]-_0x23b9bc[_0x585b('0x53')];if(_0x19032a>0x0){this[_0x585b('0x204')](_0x23b9bc);}else{loggerPredictiveCalls[_0x585b('0x74')](_0x585b('0x205'));}}else{this[_0x585b('0x204')](_0x23b9bc);}};Dialer[_0x585b('0x1b')][_0x585b('0x204')]=function(_0x35175f){var _0x1a6318=this;var _0x3063f0=[];_0x35175f[_0x585b('0x6a')]+=0x1;for(var _0x1411e2 in this[_0x585b('0x20')]){if(typeof this[_0x585b('0x20')][_0x1411e2]!==_0x585b('0xaa')){if(this['agents'][_0x1411e2][_0x585b('0xa3')]==='not_inuse'&&this[_0x585b('0x20')][_0x1411e2][_0x585b('0xad')]===_0x585b('0xd9')){_0x3063f0[_0x585b('0x127')](this[_0x585b('0x20')][_0x1411e2]['id']);}}}this[_0x585b('0xc1')](_0x35175f['id'],_0x3063f0,0x1,_0x35175f[_0x585b('0x1f8')],_0x35175f)[_0x585b('0xb5')](function(_0x6ff842){if(!checkContactEmpty(_0x6ff842)){checkContactLowerLimitOriginate(_0x35175f,0x1,0x0);_0x1a6318[_0x585b('0xb3')](_0x35175f)['then'](sendMessageReschedule(_0x35175f))[_0x585b('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x35175f[_0x585b('0x3e')]=_0x585b('0x1f9');if(_[_0x585b('0xac')](_0x6ff842[0x0])||_[_0x585b('0xac')](_0x6ff842[0x0][_0x585b('0x166')])||_[_0x585b('0xac')](_0x6ff842[0x0][_0x585b('0x166')]['phone'])){_0x1a6318[_0x585b('0x202')]('[actionOriginate]\x20',_0x35175f,_0x6ff842[0x0]);}else{_0x1a6318['checkIsBlackList'](_[_0x585b('0xcf')](_0x6ff842[0x0],['VoiceQueueId',_0x585b('0x1fc')]))['then'](_0x1a6318[_0x585b('0x1e2')](_0x35175f,_0x6ff842[0x0]))[_0x585b('0xae')](_0x1a6318[_0x585b('0xcd')](_0x585b('0x206'),_0x35175f));}}})[_0x585b('0xae')](loggerGetContactDialer(_0x585b('0x207'),_0x35175f,0x1));emitVoiceQueueSummary(_0x35175f);};Dialer[_0x585b('0x1b')][_0x585b('0x1d6')]=function(_0x1814f8,_0x304c8d,_0x2d49d9,_0x5f45b9,_0x51a70f,_0x39dbac){loggerPredictive[_0x585b('0x74')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x585b('0x74')](_0x585b('0x208'),_0x1814f8);loggerPredictive[_0x585b('0x74')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x304c8d);loggerPredictive[_0x585b('0x74')]('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',_0x2d49d9);loggerPredictive[_0x585b('0x74')]('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',_0x5f45b9);loggerPredictive[_0x585b('0x74')](_0x585b('0x209'),_0x51a70f);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x275242,_0x4a185e){if(_0x1814f8<=0x0||isNaN(_0x1814f8)){return _0x4a185e(msgResponse('[abandonmentRate]',_0x585b('0x47'),_0x585b('0x20a')+_0x1814f8));}if(_0x2d49d9<=0x0||isNaN(_0x2d49d9)){return _0x4a185e(msgResponse('[abandonmentRate]','Error',_0x585b('0x20b')+_0x2d49d9));}if(_0x5f45b9<=0x0||isNaN(_0x5f45b9)){return _0x4a185e(msgResponse('[abandonmentRate]','Error',_0x585b('0x20c')+_0x5f45b9));}if(_0x304c8d<=0x0||isNaN(_0x304c8d)){return _0x4a185e(msgResponse('[abandonmentRate]','Error',_0x585b('0x20d')+_0x304c8d));}if(_0x51a70f<=0x0||isNaN(_0x51a70f)){return _0x4a185e(msgResponse(_0x585b('0x20e'),_0x585b('0x47'),'Amax\x20=\x20'+_0x51a70f));}_0x39dbac=_0x39dbac||0x0;var _0x2a0b43=0x1/_0x2d49d9;var _0x409449=0x0;var _0xc6989c=0x0;var _0x3a882d=0x0;var _0x79bcd=0x0;for(var _0x3b52ec=0x0;_0x3a882d<_0x51a70f;_0x3b52ec+=0x1){_0xc6989c=_0x3b52ec/_0x304c8d;_0x409449=(_0x5f45b9*_0xc6989c+_0x39dbac)/_0x2a0b43;_0x3a882d=erlangb(_0x409449,_0x1814f8);_0x79bcd=_0x409449/_0x1814f8*(0x1-erlangb(_0x409449,_0x1814f8));}return _0x275242({'erlangCalls':_0x3b52ec,'erlangCallToSecond':_0x304c8d/_0x3b52ec,'erlangAbandonmentRate':_0x3a882d,'erlangBusyFactor':_0x79bcd});});};Dialer[_0x585b('0x1b')][_0x585b('0x1d8')]=function(_0x9a8359,_0x1e33c8,_0x169e5f,_0x6889fb,_0x1afff3,_0x2455fa){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info']('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',_0x9a8359);loggerPredictive[_0x585b('0x74')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e33c8);loggerPredictive[_0x585b('0x74')](_0x585b('0x20f'),_0x169e5f);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6889fb);loggerPredictive[_0x585b('0x74')](_0x585b('0x210'),_0x1afff3);loggerPredictive[_0x585b('0x74')](_0x585b('0x7e'));return new BPromise(function(_0x341f07,_0x2fe118){if(_0x9a8359<=0x0||isNaN(_0x9a8359)){return _0x2fe118(msgResponse(_0x585b('0x211'),'Error',_0x585b('0x20a')+_0x9a8359));}if(_0x169e5f<=0x0||isNaN(_0x169e5f)){return _0x2fe118(msgResponse(_0x585b('0x211'),'Error',_0x585b('0x20b')+_0x169e5f));}if(_0x6889fb<=0x0||isNaN(_0x6889fb)){return _0x2fe118(msgResponse(_0x585b('0x211'),'Error',_0x585b('0x20c')+_0x6889fb));}if(_0x1e33c8<=0x0||isNaN(_0x1e33c8)){return _0x2fe118(msgResponse(_0x585b('0x211'),_0x585b('0x47'),_0x585b('0x20d')+_0x1e33c8));}if(_0x1afff3<=0x0||isNaN(_0x1afff3)){return _0x2fe118(msgResponse(_0x585b('0x211'),_0x585b('0x47'),_0x585b('0x212')+_0x1afff3));}_0x2455fa=_0x2455fa||0x0;var _0x407774=0x1/_0x169e5f;var _0x26ec1e=0x0;var _0x30f905=0x0;var _0x3a4a05=0x0;var _0x127d86=0x0;for(var _0x4f1d67=0x0;_0x127d86<_0x1afff3;_0x4f1d67+=0x1){_0x30f905=_0x4f1d67/_0x1e33c8;_0x26ec1e=(_0x6889fb*_0x30f905+_0x2455fa)/_0x407774;_0x3a4a05=erlangb(_0x26ec1e,_0x9a8359);_0x127d86=_0x26ec1e/_0x9a8359*(0x1-erlangb(_0x26ec1e,_0x9a8359));}return _0x341f07({'erlangCalls':_0x4f1d67,'erlangCallToSecond':_0x1e33c8/_0x4f1d67,'erlangAbandonmentRate':_0x3a4a05,'erlangBusyFactor':_0x127d86});});};module[_0x585b('0x213')]=Dialer; \ No newline at end of file +var _0x6f7a=['predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','format','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','enqueue','status','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','isNil','xcally-motion-dialer','dialAMDActive','value','uniqueid','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','add','minutes','ListId','[rescheduleContact][Machine]','HANGUP','countglobal','countnosuchnumberretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','paused','stateinterface','locked','queueBooked','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','command','timezones','content','indexOf','true','Action','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','\x5cw{0,','pow','replace','random','actionOriginate','object','Contact','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','phone','substring','dialCutDigit','trim','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','unlockContact','outboundReCallsDay','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','abandonmentRate','--------\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','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls'];(function(_0x179c0c,_0x20fe42){var _0x2ab663=function(_0x3b9c1f){while(--_0x3b9c1f){_0x179c0c['push'](_0x179c0c['shift']());}};_0x2ab663(++_0x20fe42);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1ce042,_0x52261b){_0x1ce042=_0x1ce042-0x0;var _0x2eba0e=_0x6f7a[_0x1ce042];return _0x2eba0e;};'use strict';var util=require(_0xa6f7('0x0'));var _=require(_0xa6f7('0x1'));var BPromise=require(_0xa6f7('0x2'));var uuid=require(_0xa6f7('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xa6f7('0x4'));var Redis=require(_0xa6f7('0x5'));var ut=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));var loggerBooked=require(_0xa6f7('0x8'))(_0xa6f7('0xa'));var loggerPredictive=require(_0xa6f7('0x8'))(_0xa6f7('0xb'));var loggerPredictiveCalls=require(_0xa6f7('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0xa6f7('0xc'));var ami=require(_0xa6f7('0xd'));config[_0xa6f7('0xe')]=_[_0xa6f7('0xf')](config[_0xa6f7('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6f7('0xe')]));var cmHopper=require(_0xa6f7('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa6f7('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xa6f7('0x12'));var History=require(_0xa6f7('0x13'));var Final=require(_0xa6f7('0x14'));var AgentComplete=require(_0xa6f7('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xa6f7('0x16'));var ipAgi=process['env'][_0xa6f7('0x17')]||_0xa6f7('0x18');var strategy={'rrmemory':_0xa6f7('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xa6f7('0x1a')]['enqueue']=function(_0x41bc4d){this['tail']=this[_0xa6f7('0x1b')]?this[_0xa6f7('0x1b')][_0xa6f7('0x1c')](_0x41bc4d):_0x41bc4d();};function Dialer(_0x47e664,_0xdb37e2){this[_0xa6f7('0x1d')]=new Sequence();this[_0xa6f7('0x1e')]=_0xdb37e2;this[_0xa6f7('0x1f')]=_0x47e664['voiceQueues'];this['campaigns']=_0x47e664[_0xa6f7('0x20')];this['agents']=_0x47e664[_0xa6f7('0x21')];this[_0xa6f7('0x22')]=_0x47e664['trunks'];this[_0xa6f7('0x23')]=config[_0xa6f7('0x23')]||0x2;this[_0xa6f7('0x24')]={};this[_0xa6f7('0x25')]={};this[_0xa6f7('0x26')]={};this[_0xa6f7('0x27')]={};this['optionPredictive']={};this[_0xa6f7('0x28')]={};this[_0xa6f7('0x29')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0xa6f7('0x2a'),this[_0xa6f7('0x2b')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x2d'),this[_0xa6f7('0x2e')]['bind'](this));ami['on']('agentcomplete',this[_0xa6f7('0x2f')]['bind'](this));ami['on']('custom:queuesummary',this[_0xa6f7('0xc')]['bind'](this));ami['on'](_0xa6f7('0x30'),this[_0xa6f7('0x31')][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x32'),this[_0xa6f7('0x33')]['bind'](this));ami['on']('varset',this[_0xa6f7('0x34')][_0xa6f7('0x2c')](this));ami['on']('queuemember',this[_0xa6f7('0x35')][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x36'),this[_0xa6f7('0x37')][_0xa6f7('0x2c')](this));this[_0xa6f7('0x38')]();this[_0xa6f7('0x39')]();}function isNotNull(_0x54f72c){return _0x54f72c!==null&&!_[_0xa6f7('0x3a')](_0x54f72c);}function checkIsLoggedIn(_0x3dee2e,_0x40b0f8){return function(){if(_0x40b0f8<=0x0){_0x3dee2e[_0xa6f7('0x3b')]='AGENTS_NOT_LOGGED';throw _0x3dee2e[_0xa6f7('0x3c')]+_0xa6f7('0x3d');}};}function isActive(_0x5bf8e3){return _0x5bf8e3;}function checkIsActive(_0xd6304f,_0x34d571){return function(){if(!isActive(_0x34d571)){_0xd6304f['message']='NOT_ACTIVE';throw _0xd6304f[_0xa6f7('0x3c')]+_0xa6f7('0x3e');}};}function checkInterval(_0x2b33d){return function(){if(!isNotNull(_0x2b33d[_0xa6f7('0x3f')])){_0x2b33d[_0xa6f7('0x3b')]='INTERVAL_IS_NULL';throw _0x2b33d['name']+_0xa6f7('0x40');}if(!isNotNull(_0x2b33d['Interval'][_0xa6f7('0x41')])){_0x2b33d[_0xa6f7('0x3b')]=_0xa6f7('0x42');throw _0x2b33d[_0xa6f7('0x3c')]+_0xa6f7('0x40');}if(!isNotNull(_[_0xa6f7('0x43')](_0x2b33d['Interval'][_0xa6f7('0x41')]))){_0x2b33d[_0xa6f7('0x3b')]=_0xa6f7('0x42');throw _0x2b33d['name']+_0xa6f7('0x40');}};}function msgResponse(_0x5ab03d,_0x1170c4,_0x2f5632){return{'action':_0x5ab03d,'response':_0x1170c4,'message':_0x2f5632,'stack':_0x2f5632};}function myreject(_0x45837c){return function(_0x4ccbd3){return _0x45837c(msgResponse(_0xa6f7('0x44'),_0xa6f7('0x45'),JSON[_0xa6f7('0x46')](_0x4ccbd3)));};}function getSeconds(_0x37b833,_0x14444c){var _0x28490e=moment(_0x37b833)['milliseconds'](0x0);var _0xc33ec8=moment(_0x14444c)[_0xa6f7('0x47')](0x0);return _0x28490e[_0xa6f7('0x48')](_0xc33ec8,_0xa6f7('0x49'));}function emit(_0x18d18c,_0x56a773,_0x45acdd){io['to'](_0x18d18c)[_0xa6f7('0x4a')](_0x56a773,_0x45acdd);}function emitVoiceQueueSummary(_0x4c2d2e){if(_0x4c2d2e[_0xa6f7('0x4b')]===_0xa6f7('0x4c')){var _0x353e54={'id':_0x4c2d2e['id'],'name':_0x4c2d2e['name'],'strategy':_0x4c2d2e[_0xa6f7('0x4d')],'answered':_0x4c2d2e[_0xa6f7('0x4e')],'available':_0x4c2d2e['available'],'loggedIn':_0x4c2d2e[_0xa6f7('0x4f')],'pTalking':_0x4c2d2e[_0xa6f7('0x50')],'sumBillable':_0x4c2d2e[_0xa6f7('0x51')],'sumDuration':_0x4c2d2e[_0xa6f7('0x52')],'sumHoldTime':_0x4c2d2e[_0xa6f7('0x53')]||0x0,'talking':_0x4c2d2e['talking'],'total':_0x4c2d2e[_0xa6f7('0x54')],'type':_0x4c2d2e[_0xa6f7('0x4b')],'unmanaged':_0x4c2d2e[_0xa6f7('0x55')],'abandoned':_0x4c2d2e[_0xa6f7('0x56')],'waiting':_0x4c2d2e[_0xa6f7('0x57')],'loggedInDb':_0x4c2d2e[_0xa6f7('0x58')],'dialActive':_0x4c2d2e[_0xa6f7('0x59')],'dialMethod':_0x4c2d2e[_0xa6f7('0x5a')],'dialOriginateCallerIdName':_0x4c2d2e['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4c2d2e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4c2d2e[_0xa6f7('0x5b')],'dialPrefix':_0x4c2d2e[_0xa6f7('0x5c')],'outboundAnswerAgiCallsDay':_0x4c2d2e[_0xa6f7('0x5d')],'outboundAnswerCallsDay':_0x4c2d2e[_0xa6f7('0x5e')],'outboundBlacklistCallsDay':_0x4c2d2e[_0xa6f7('0x5f')],'outboundBusyCallsDay':_0x4c2d2e[_0xa6f7('0x60')],'outboundCongestionCallsDay':_0x4c2d2e[_0xa6f7('0x61')],'outboundDropCallsDayACS':_0x4c2d2e[_0xa6f7('0x62')],'outboundDropCallsDayCallersExit':_0x4c2d2e[_0xa6f7('0x63')],'outboundDropCallsDayTimeout':_0x4c2d2e[_0xa6f7('0x64')],'outboundNoAnswerCallsDay':_0x4c2d2e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4c2d2e[_0xa6f7('0x65')],'outboundOriginateFailureCallsDay':_0x4c2d2e[_0xa6f7('0x66')],'outboundReCallsDay':_0x4c2d2e['outboundReCallsDay'],'outboundRejectCallsDay':_0x4c2d2e[_0xa6f7('0x67')],'outboundUnknownCallsDay':_0x4c2d2e[_0xa6f7('0x68')],'predictiveIntervalAnsweredCalls':_0x4c2d2e[_0xa6f7('0x69')],'predictiveIntervalAvgHoldtime':_0x4c2d2e[_0xa6f7('0x6a')],'predictiveIntervalAvgTalktime':_0x4c2d2e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c2d2e[_0xa6f7('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x4c2d2e['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4c2d2e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4c2d2e[_0xa6f7('0x6c')],'predictiveIntervalHitRate':_0x4c2d2e[_0xa6f7('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x4c2d2e[_0xa6f7('0x6e')],'predictiveIntervalPauses':_0x4c2d2e[_0xa6f7('0x6f')],'predictiveIntervalAvailable':_0x4c2d2e[_0xa6f7('0x70')],'predictiveIntervalTotalCalls':_0x4c2d2e[_0xa6f7('0x71')],'message':_0x4c2d2e[_0xa6f7('0x3b')],'originated':_0x4c2d2e['originated'],'erlangCalls':_0x4c2d2e[_0xa6f7('0x72')],'erlangCallToSecond':_0x4c2d2e[_0xa6f7('0x73')],'erlangAbandonmentRate':_0x4c2d2e['erlangAbandonmentRate'],'erlangBusyFactor':_0x4c2d2e[_0xa6f7('0x74')],'startPredictive':_0x4c2d2e[_0xa6f7('0x28')],'startProgressive':_0x4c2d2e[_0xa6f7('0x29')]};if(_0x4c2d2e['Trunk']){_0x353e54[_0xa6f7('0x75')]={'id':_0x4c2d2e['Trunk']['id'],'name':_0x4c2d2e[_0xa6f7('0x75')][_0xa6f7('0x3c')],'active':_0x4c2d2e[_0xa6f7('0x75')]['active'],'callerid':_0x4c2d2e['Trunk'][_0xa6f7('0x76')]};}if(_0x4c2d2e['Interval']){_0x353e54[_0xa6f7('0x3f')]={'id':_0x4c2d2e['Interval']['id'],'name':_0x4c2d2e['Interval'][_0xa6f7('0x3c')]};}var _0x2e3a04=md5(JSON[_0xa6f7('0x46')](_0x353e54));if(_0x4c2d2e[_0xa6f7('0x4')]!==_0x2e3a04){_0x4c2d2e[_0xa6f7('0x4')]=_0x2e3a04;emit(util[_0xa6f7('0x77')]('voice:queue:%s',_0x353e54[_0xa6f7('0x3c')]),_0xa6f7('0x78'),_0x353e54);}}}function emitCampaignSummary(_0x58080f){if(_0x58080f[_0xa6f7('0x4b')]==='ivr'){emit(util[_0xa6f7('0x77')]('campaign:ivr:%s',_0x58080f['name']),_0xa6f7('0x79'),_0x58080f);}}function checkGetDataPredictive(_0x158af5){if(isNotNull(_0x158af5)&&!_[_0xa6f7('0x43')](_0x158af5)){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x7b'));loggerPredictive['info'](_0xa6f7('0x7c'),_0x158af5[_0xa6f7('0x71')]);loggerPredictive['info'](_0xa6f7('0x7d'),_0x158af5['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x7e'),_0x158af5[_0xa6f7('0x7f')]);loggerPredictive['info'](_0xa6f7('0x80'),_0x158af5['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x81'),_0x158af5[_0xa6f7('0x6a')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x82'),_0x158af5['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xa6f7('0x83'));if(_0x158af5[_0xa6f7('0x71')]>0x0){if(!_[_0xa6f7('0x3a')](_0x158af5[_0xa6f7('0x84')])&&_0x158af5['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x85'));if(!_[_0xa6f7('0x3a')](_0x158af5[_0xa6f7('0x6a')])&&_0x158af5[_0xa6f7('0x6a')]>0x0){return!![];}loggerPredictive[_0xa6f7('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x86'));}}else{loggerPredictive[_0xa6f7('0x7a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xb049d7){return function(_0x16a2a4){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x87'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16a2a4[_0xa6f7('0x72')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x88'),_0x16a2a4[_0xa6f7('0x73')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x89'),_0x16a2a4[_0xa6f7('0x8a')]);loggerPredictive['info'](_0xa6f7('0x8b'),_0x16a2a4[_0xa6f7('0x74')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x89'),_0x16a2a4[_0xa6f7('0x8a')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));_[_0xa6f7('0x8c')](_0xb049d7,_0x16a2a4);};}function getDiff(_0x444177){var _0x186956=moment()[_0xa6f7('0x47')](0x0);var _0x5719fb=moment(_0x444177)[_0xa6f7('0x47')](0x0);return _0x186956['diff'](_0x5719fb,_0xa6f7('0x49'));}function ifInterval(_0x47a2b1,_0x3a5522){if(_[_0xa6f7('0x3a')](_0x3a5522)){return![];}return getDiff(_0x3a5522)<_0x47a2b1*0x3c;}function freeVariablesPredictive(_0x5a158f){if(isNotNull(_0x5a158f)){if(!_[_0xa6f7('0x3a')](_0x5a158f[_0xa6f7('0x29')])){_0x5a158f[_0xa6f7('0x29')]=undefined;loggerPredictive['info'](_0x5a158f[_0xa6f7('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xa6f7('0x3a')](_0x5a158f[_0xa6f7('0x28')])){_0x5a158f['startPredictive']=undefined;loggerPredictive[_0xa6f7('0x7a')](_0x5a158f['name'],_0xa6f7('0x8d'));}if(!_['isUndefined'](_0x5a158f[_0xa6f7('0x8e')])){clearInterval(_0x5a158f[_0xa6f7('0x8e')]);_0x5a158f[_0xa6f7('0x8e')]=undefined;loggerPredictive[_0xa6f7('0x7a')](_0x5a158f[_0xa6f7('0x3c')],_0xa6f7('0x8f'));}}}function erlangb(_0xfded94,_0x2ebb08){if(_0x2ebb08===0x0){return 0x0;}var _0x153635=0x1;for(var _0x16ef40=0x1;_0x16ef40<=_0x2ebb08;_0x16ef40+=0x1){_0x153635=0x1+_0x153635*_0x16ef40/_0xfded94;}return 0x1/_0x153635;}function isVoiceQueueOutbound(_0x110ea5){return _0x110ea5===_0xa6f7('0x4c');}function isNotPreview(_0x4b0434){return _0x4b0434!==_0xa6f7('0x1e');}function isCampaignIvr(_0x3c0c6e){return _0x3c0c6e===_0xa6f7('0x90');}function getCallerId(_0x466bb6,_0x154c78,_0x3a464e){if(!_[_0xa6f7('0x3a')](_0x3a464e)&&typeof _0x3a464e===_0xa6f7('0x91')&&!_['isEmpty'](_0x3a464e)){if(!_[_0xa6f7('0x3a')](_0x154c78)&&typeof _0x154c78===_0xa6f7('0x91')&&!_[_0xa6f7('0x43')](_0x154c78)){return util['format'](_0xa6f7('0x92'),_0x154c78,_0x3a464e);}return util[_0xa6f7('0x77')](_0xa6f7('0x92'),_0x3a464e,_0x3a464e);}if(!_[_0xa6f7('0x3a')](_0x466bb6)&&typeof _0x466bb6===_0xa6f7('0x91')&&!_[_0xa6f7('0x43')](_0x466bb6)){return _0x466bb6;}return _0xa6f7('0x93');}function loggerCatchQueueSummary(_0x1f69e4,_0x4c1af7){return function(_0x55d245){freeVariablesPredictive(_0x4c1af7);emitVoiceQueueSummary(_0x4c1af7);emitCampaignSummary(_0x4c1af7);loggerSyncQueueSummary[_0xa6f7('0x94')](_0x1f69e4,util[_0xa6f7('0x95')](_0x55d245,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5e6d94,_0x3aa759){return function(_0x18ff29){loggerPredictive[_0xa6f7('0x94')](_0x3aa759['name'],_0x5e6d94);loggerPredictive[_0xa6f7('0x94')](_0x18ff29['stack']);freeVariablesPredictive(_0x3aa759);};}function loggerCatch(_0x4f156e){return function(_0x59ed13){logger['error'](_0x4f156e,util['inspect'](_0x59ed13,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x39ba3d){return _0x39ba3d&&!_[_0xa6f7('0x3a')](_0x39ba3d)&&_0x39ba3d[_0xa6f7('0x96')]>0x0;}function decremetOriginate(_0x5f00a7){if(!_[_0xa6f7('0x3a')](_0x5f00a7)&&_0x5f00a7!==null){if(typeof _0x5f00a7[_0xa6f7('0x97')]!==_0xa6f7('0x98')){if(_0x5f00a7[_0xa6f7('0x97')]>0x0){_0x5f00a7[_0xa6f7('0x97')]-=0x1;}else{logger[_0xa6f7('0x94')](_0xa6f7('0x99'));}}}else{logger[_0xa6f7('0x94')](_0xa6f7('0x9a'));}}function checkContactLowerLimitOriginate(_0x2a73ae,_0x55ad6b,_0x1103ff){if(_0x55ad6b>_0x1103ff){for(var _0x2d23cf=0x0;_0x2d23cf<_0x55ad6b-_0x1103ff;_0x2d23cf+=0x1){decremetOriginate(_0x2a73ae);}}}function loggerGetContactDialer(_0x2ba30f,_0x380b79,_0x1637d3){return function(_0x39e8a8){checkContactLowerLimitOriginate(_0x380b79,_0x1637d3,0x0);logger[_0xa6f7('0x94')](_0x2ba30f,util[_0xa6f7('0x95')](_0x39e8a8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x14133e){return function(_0x26435d){if(isNotNull(_0x26435d)&&isNotNull(_0x26435d[0x0])){if(_0x26435d[0x0][_0xa6f7('0x9b')]>0x0){_0x14133e['message']='RESCHEDULED_CONTACTS';logger[_0xa6f7('0x7a')](_0xa6f7('0x9c')+_0x14133e[_0xa6f7('0x3c')],_0x26435d[0x0]['contactsRescheduled'],_0xa6f7('0x9d'));}else{_0x14133e[_0xa6f7('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xa6f7('0x7a')](_0xa6f7('0x9e')+_0x14133e['name']);}}};}function notSendMessagesQueue(_0x52dcd9){if(_0x52dcd9[_0xa6f7('0x9f')]){freeVariablesPredictive(_0x52dcd9);if(_0x52dcd9['originated']===0x0&&_0x52dcd9[_0xa6f7('0xa0')]===0x0&&_0x52dcd9[_0xa6f7('0x57')]===0x0&&(_0x52dcd9['pTalking']||0x0)===0x0){_0x52dcd9['sendMessageOneNotActive']=![];_0x52dcd9[_0xa6f7('0xa1')]=0x0;_0x52dcd9[_0xa6f7('0x3b')]=_0xa6f7('0xa2');loggerSyncQueueSummary['error'](_0xa6f7('0xa3'),_0x52dcd9[_0xa6f7('0x3c')],_0xa6f7('0xa4'));}else{_0x52dcd9[_0xa6f7('0x3b')]=_0xa6f7('0xa5');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa3'),_0x52dcd9[_0xa6f7('0x3c')],_0xa6f7('0xa6'));}emitVoiceQueueSummary(_0x52dcd9);}}function notSendMessagesCampaign(_0x1f4f19){if(_0x1f4f19[_0xa6f7('0x9f')]){if(_0x1f4f19['originated']===0x0){_0x1f4f19[_0xa6f7('0x9f')]=![];_0x1f4f19[_0xa6f7('0x3b')]=_0xa6f7('0xa2');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa7'),_0x1f4f19[_0xa6f7('0x3c')],'is\x20not\x20active');}else{_0x1f4f19[_0xa6f7('0x3b')]=_0xa6f7('0xa5');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa7'),_0x1f4f19[_0xa6f7('0x3c')],_0xa6f7('0xa6'));}emitCampaignSummary(_0x1f4f19);}}function createObjHistory(_0x54c4e6,_0x5d5894,_0x7ff027,_0x373ae3,_0x3ae028){_0x54c4e6[_0xa6f7('0x3b')]=_0x7ff027;var _0x12d120=new Action(_0x54c4e6,_0x5d5894);var _0x4b4009=new History(_0x12d120);_0x4b4009[_0xa6f7('0xa8')]=_0x373ae3;_0x4b4009['statedesc']=_0x3ae028;_0x4b4009[_0xa6f7('0xa9')]=_0x12d120[_0xa6f7('0xaa')];return _0x4b4009;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x24c1f7=this;setInterval(function(){_0x24c1f7['clearZombieChannels'](_0x24c1f7['uniqueId'],_0xa6f7('0xab'));_0x24c1f7[_0xa6f7('0xac')](_0x24c1f7[_0xa6f7('0x25')],_0xa6f7('0xad'));},0x32c8);};Dialer['prototype'][_0xa6f7('0xac')]=function(_0xd2a739,_0x74eb68){var _0x143a3a=this;for(var _0x21cc6b in _0xd2a739){if(typeof _0xd2a739[_0x21cc6b]!==_0xa6f7('0x98')){this['sequence'][_0xa6f7('0xae')](function(){if(!_['isNil'](_0xd2a739[_0x21cc6b])){return ami['Action']({'action':_0xa6f7('0xaf'),'channel':_0xd2a739[_0x21cc6b][_0xa6f7('0xb0')]})['catch'](function(_0x46a8bd){if(_0x46a8bd[_0xa6f7('0x3b')]===_0xa6f7('0xb1')){setTimeout(function(){if(_0xd2a739[_0x21cc6b]&&_0xd2a739[_0x21cc6b]['type']!==_0xa6f7('0x90')){_0x143a3a['updateOriginated'](_0x143a3a[_0xa6f7('0x1f')][_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]]);logger['error'](_0xa6f7('0xb3'),_0x74eb68,_0x21cc6b,_0xd2a739[_0x21cc6b]['queue']);delete _0xd2a739[_0x21cc6b];}if(_0xd2a739[_0x21cc6b]&&_0xd2a739[_0x21cc6b][_0xa6f7('0x4b')]===_0xa6f7('0x90')){_0x143a3a['updateOriginated'](_0x143a3a[_0xa6f7('0x20')][_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]]);logger[_0xa6f7('0x94')](_0xa6f7('0xb4'),_0x74eb68,_0x21cc6b,_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]);delete _0xd2a739[_0x21cc6b];}},0x2328);}});}});}}};Dialer['prototype'][_0xa6f7('0xb5')]=function(_0x37b898){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper['countReScheduled'](_0x37b898))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xb9')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xba')]=function(_0x4362d8){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopperBlack[_0xa6f7('0xba')](_0x4362d8))['catch'](loggerCatch(_0xa6f7('0xbb')));};Dialer[_0xa6f7('0x1a')]['checkIsBlackListIvr']=function(_0x23c56c){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopperBlack[_0xa6f7('0xbc')](_0x23c56c))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xbd')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xbe')]=function(_0x278ac6){return BPromise[_0xa6f7('0xb6')]()['then'](cmHopperHistory['avgHandleTime'](_0x278ac6))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xbf')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc0')]=function(_0x5c4e41){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper['rescheduleContact'](_0x5c4e41))['catch'](loggerCatch(_0xa6f7('0xc1')));};Dialer[_0xa6f7('0x1a')]['unlockContact']=function(_0x57e8f8,_0x461df5,_0x2309e0){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopper['unlockContact'](_0x57e8f8,_0x461df5,_0x2309e0))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xc2')));};Dialer['prototype'][_0xa6f7('0xc3')]=function(_0x262c5c,_0x4dfaea,_0x1fb9db,_0xf518ad,_0x380412){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopper[_0xa6f7('0xc3')](_0x262c5c,_0x4dfaea,_0x1fb9db,_0xf518ad))[_0xa6f7('0xb8')](function(_0x333a85){_0x380412['temp']-=_0x1fb9db;_0x380412[_0xa6f7('0xc4')]=_0x380412[_0xa6f7('0xc4')]>0x0?_0x380412[_0xa6f7('0xc4')]:0x0;loggerCatch(_0xa6f7('0xc5'))(_0x333a85);});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc6')]=function(_0x29b0be,_0x826172,_0x34ad42,_0x77b874){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper[_0xa6f7('0xc6')](_0x29b0be,_0x826172,_0x34ad42))[_0xa6f7('0xb8')](function(_0x40df2f){_0x77b874[_0xa6f7('0xc4')]-=_0x826172;_0x77b874[_0xa6f7('0xc4')]=_0x77b874[_0xa6f7('0xc4')]>0x0?_0x77b874[_0xa6f7('0xc4')]:0x0;loggerCatch(_0xa6f7('0xc7'))(_0x40df2f);});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc8')]=function(_0x51c125){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](voiceQueueRt[_0xa6f7('0xc8')](_0x51c125))['catch'](loggerCatch(_0xa6f7('0xc9')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xca')]=function(_0x41ec8d){return BPromise[_0xa6f7('0xb6')]()['then'](cmHopper[_0xa6f7('0xca')](_0x41ec8d))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xcb')));};Dialer[_0xa6f7('0x1a')]['createHistory']=function(_0x424f4f){return BPromise['resolve']()['then'](cmHopperHistory[_0xa6f7('0xcc')](_0x424f4f))[_0xa6f7('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xcd')]=function(_0x19f7f7){if(!_['isUndefined'](_0x19f7f7)&&_0x19f7f7!==null){if(typeof _0x19f7f7['originated']!==_0xa6f7('0x98')){if(_0x19f7f7['originated']>0x0){_0x19f7f7[_0xa6f7('0x97')]-=0x1;}else{logger[_0xa6f7('0x94')](_0xa6f7('0xce'));}}}else{logger[_0xa6f7('0x94')](_0xa6f7('0xcf'));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd0')]=function(_0x33047c,_0x2e89d9){var _0x3a40ff=this;return function(_0x5afef2){_0x3a40ff[_0xa6f7('0xcd')](_0x2e89d9);logger[_0xa6f7('0x94')](_0x33047c,util[_0xa6f7('0x95')](_0x5afef2,{'showHidden':![],'depth':null}));};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd1')]=function(_0x4d4d9e,_0x10f80b,_0x850df1){var _0xe5e3c2={'state':0x19,'statedesc':_0xa6f7('0xd2')};this['updateOriginated'](_0x10f80b);this[_0xa6f7('0xd3')](_[_0xa6f7('0x8c')](_0xe5e3c2,_[_0xa6f7('0xd4')](_0x850df1,[_0xa6f7('0xd5'),'ListId',_0xa6f7('0xd6'),_0xa6f7('0xd7'),_0xa6f7('0xd8')])),_0xa6f7('0xd9'),_0xa6f7('0xda'));logger[_0xa6f7('0x94')](_0x4d4d9e);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xdb')]=function(_0x672fce){return _0x672fce===_0xa6f7('0xdc');};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xdd')]=function(_0x36b646){return!_['isUndefined'](_0x36b646)&&_0x36b646&&!_[_0xa6f7('0x3a')](_0x36b646[_0xa6f7('0x3c')])&&!_[_0xa6f7('0x3a')](_0x36b646[_0xa6f7('0xde')])&&_0x36b646['active']&&(this[_0xa6f7('0x22')][util[_0xa6f7('0x77')](_0xa6f7('0xdf'),_0x36b646[_0xa6f7('0x3c')])]['status']===_0xa6f7('0xe0')||this[_0xa6f7('0x22')][util['format'](_0xa6f7('0xdf'),_0x36b646[_0xa6f7('0x3c')])][_0xa6f7('0xaf')]===_0xa6f7('0xe1'));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd3')]=function(_0x5506cb,_0x1cf014,_0x5a6e0a){this[_0xa6f7('0xcc')](_0x5506cb)[_0xa6f7('0xb8')](loggerCatch(_0x1cf014));this[_0xa6f7('0xca')](_0x5506cb)['catch'](loggerCatch(_0x5a6e0a));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x34')]=function(_0x4299f9){var _0x227c68=this['uniqueId'][_0x4299f9['uniqueid']];var _0x3f2aed;if(!_[_0xa6f7('0xe2')](_0x4299f9)&&!_[_0xa6f7('0xe2')](_0x4299f9['variable'])&&!_[_0xa6f7('0xe2')](_0x4299f9['variable']['amdstatus'])&&_0x4299f9['exten']===_0xa6f7('0xe3')&&_0x227c68){if(_0x227c68[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&this[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]==='HANGUP'){delete this[_0xa6f7('0x27')][_0x4299f9[_0xa6f7('0xe6')]];this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]]);this[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;this['voiceQueues'][_0x227c68['queue']][_0xa6f7('0x5d')]+=0x1;_0x3f2aed=new Hangup(_0x227c68,_0x4299f9);_0x3f2aed[_0xa6f7('0xa8')]=0x12;_0x3f2aed[_0xa6f7('0xe7')]=_0xa6f7('0xe8');_0x3f2aed[_0xa6f7('0xe9')]=_0xa6f7('0xea');ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x3f2aed,_0xa6f7('0xed')));this[_0xa6f7('0xd3')](_0x3f2aed,_0xa6f7('0xee'),_0xa6f7('0xef'));}if(_0x227c68[_0xa6f7('0x4b')]!=='ivr'&&this[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xf0')){var _0x32e44f=this;return new BPromise(function(_0x235b12,_0x2a4e42){delete _0x32e44f['uniqueId'][_0x4299f9[_0xa6f7('0xe6')]];_0x32e44f[_0xa6f7('0xcd')](_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']]);_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0x5e')]+=0x1;_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5cdf85=_0x32e44f[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]];var _0x48328d=new Hangup(_0x227c68,_0x4299f9);_0x48328d['state']=0x13;_0x48328d[_0xa6f7('0xe7')]=_0xa6f7('0xf1');_0x48328d['membername']=_0xa6f7('0xea');_0x48328d[_0xa6f7('0xf2')]+=0x1;_0x48328d['countglobal']+=0x1;_0x48328d[_0xa6f7('0xed')]=!![];ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x48328d,_0xa6f7('0xed')));_0x32e44f['createHistory'](_0x48328d)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x48328d[_0xa6f7('0xf3')]+_0x48328d[_0xa6f7('0xf4')]+_0x48328d[_0xa6f7('0xf5')]+_0x48328d['countnosuchnumberretry']+_0x48328d[_0xa6f7('0xf6')]+_0x48328d[_0xa6f7('0xf7')]+_0x48328d[_0xa6f7('0xf2')]+_0x48328d['countagentrejectretry']>=_0x5cdf85[_0xa6f7('0xf8')]){_0x32e44f[_0xa6f7('0xf9')](_0x48328d,_0x235b12,_0x2a4e42,_0xa6f7('0xfa'));}else{if(_0x48328d[_0xa6f7('0xf2')]>=_0x5cdf85['dialMachineMaxRetry']){_0x32e44f['createStateFinal'](_0x48328d,_0x235b12,_0x2a4e42,'reason\x2019\x20machine....');}else{_0x32e44f[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x48328d[_0xa6f7('0xf2')],'scheduledat':moment()[_0xa6f7('0xfb')](_0x5cdf85['dialMachineRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48328d['ContactId'],'ListId':_0x48328d[_0xa6f7('0xfd')],'VoiceQueueId':_0x48328d['VoiceQueueId']||undefined,'CampaignId':_0x48328d['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xfe')));_0x235b12({'reschedule':0x1});}}});}if(_0x227c68[_0xa6f7('0x4b')]===_0xa6f7('0x90')&&this['campaigns'][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xff')){delete this['uniqueId'][_0x4299f9['uniqueid']];this[_0xa6f7('0xcd')](this['campaigns'][_0x227c68[_0xa6f7('0xb2')]]);_0x3f2aed=new Hangup(_0x227c68,_0x4299f9);_0x3f2aed[_0xa6f7('0xa8')]=0x12;_0x3f2aed[_0xa6f7('0xe7')]='HangupInAMD';_0x3f2aed['membername']='AMD';ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut['buildObj'](_0x3f2aed,'amd'));this['saveInDb'](_0x3f2aed,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x227c68[_0xa6f7('0x4b')]===_0xa6f7('0x90')&&this[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xf0')){var _0x32e44f=this;return new BPromise(function(_0x5d80fb,_0x551d82){delete _0x32e44f[_0xa6f7('0x27')][_0x4299f9[_0xa6f7('0xe6')]];_0x32e44f[_0xa6f7('0xcd')](_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]]);_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5d')]+=0x1;var _0x111b46=_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]];var _0x4c685d=new Hangup(_0x227c68,_0x4299f9);_0x4c685d['state']=0x13;_0x4c685d[_0xa6f7('0xe7')]='Machine';_0x4c685d[_0xa6f7('0xe9')]=_0xa6f7('0xea');_0x4c685d[_0xa6f7('0xf2')]+=0x1;_0x4c685d[_0xa6f7('0x100')]+=0x1;_0x4c685d[_0xa6f7('0xed')]=!![];ami['emit'](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x4c685d,'amd'));_0x32e44f[_0xa6f7('0xcc')](_0x4c685d)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4c685d[_0xa6f7('0xf3')]+_0x4c685d[_0xa6f7('0xf4')]+_0x4c685d[_0xa6f7('0xf5')]+_0x4c685d[_0xa6f7('0x101')]+_0x4c685d['countdropretry']+_0x4c685d[_0xa6f7('0xf7')]+_0x4c685d[_0xa6f7('0xf2')]+_0x4c685d[_0xa6f7('0x102')]>=_0x111b46[_0xa6f7('0xf8')]){_0x32e44f['stateGlobal'](_0x4c685d,_0x5d80fb,_0x551d82,_0xa6f7('0xfa'));}else{if(_0x4c685d[_0xa6f7('0xf2')]>=_0x111b46[_0xa6f7('0x103')]){_0x32e44f[_0xa6f7('0x104')](_0x4c685d,_0x5d80fb,_0x551d82,_0xa6f7('0x105'));}else{_0x32e44f[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x4c685d['countmachineretry'],'scheduledat':moment()['add'](_0x111b46[_0xa6f7('0x106')],'minutes')['format'](_0xa6f7('0x107')),'ContactId':_0x4c685d['ContactId'],'ListId':_0x4c685d['ListId'],'VoiceQueueId':_0x4c685d[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x4c685d[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xfe')));_0x5d80fb({'reschedule':0x1});}}});}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x31')]=function(_0x2642e5){var _0x207261=this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];var _0x29f0fa=this;var _0x53201c;if(_0x207261&&_0x207261[_0xa6f7('0x4b')]===_0xa6f7('0x90')){delete this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];this['updateOriginated'](this[_0xa6f7('0x20')][_0x207261['queue']]);this['campaigns'][_0x207261['queue']][_0xa6f7('0x108')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);this['createHistory'](_0x53201c)[_0xa6f7('0xb8')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x53201c)['catch'](loggerCatch(_0xa6f7('0x109')));}if(_0x207261&&_0x207261[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&isNotNull(this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x10a')])){delete this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];this['updateOriginated'](this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]]);this[_0xa6f7('0x1f')][_0x207261['queue']][_0xa6f7('0x5e')]+=0x1;this[_0xa6f7('0x1f')][_0x207261['queue']][_0xa6f7('0x5d')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);_0x53201c['state']=0x10;_0x53201c[_0xa6f7('0xe7')]=_0xa6f7('0x10b');_0x53201c[_0xa6f7('0xe9')]='AGI';this[_0xa6f7('0xcc')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x10c')));this[_0xa6f7('0xca')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x109')));}if(_0x207261&&_0x207261[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&!isNotNull(this[_0xa6f7('0x1f')][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x10a')])){delete this['uniqueId'][_0x2642e5[_0xa6f7('0xe6')]];this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x207261['queue']]);this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x68')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);_0x53201c[_0xa6f7('0xa8')]=0xc;_0x53201c[_0xa6f7('0xe7')]=_0x2642e5[_0xa6f7('0x10d')];_0x53201c[_0xa6f7('0xe9')]=_0xa6f7('0x10e');this[_0xa6f7('0xcc')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa6f7('0xca')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x109')));}};Dialer[_0xa6f7('0x1a')]['syncAgentComplete']=function(_0x41817e){var _0x2ebe7a=this[_0xa6f7('0x27')][_0x41817e['uniqueid']];var _0x3a1d95=this;if(this['voiceQueues'][_0x41817e[_0xa6f7('0xb2')]]){if(_0x2ebe7a&&_0x2ebe7a[_0xa6f7('0x4b')]!=='ivr'){delete this['uniqueId'][_0x41817e[_0xa6f7('0xe6')]];this[_0xa6f7('0x1f')][_0x41817e[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;var _0x4f7015=new AgentComplete(_0x2ebe7a,_0x41817e);if(_0x41817e[_0xa6f7('0x10f')]===_0xa6f7('0x110')){_0x4f7015[_0xa6f7('0x111')]=this[_0xa6f7('0x1f')][_0x41817e['queue']]['dialQueueProject2']&&this[_0xa6f7('0x1f')][_0x41817e[_0xa6f7('0xb2')]]['dialAgiAfterHangupAgent']?moment()[_0xa6f7('0x77')](_0xa6f7('0x107')):undefined;}this[_0xa6f7('0xcc')](_0x4f7015)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x112')));this[_0xa6f7('0xca')](_0x4f7015)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x113')));}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x2b')]=function(_0x42b6b3){if(this['voiceQueues'][_0x42b6b3[_0xa6f7('0xb2')]]){if(this[_0xa6f7('0x27')][_0x42b6b3[_0xa6f7('0xe6')]]&&this[_0xa6f7('0x27')][_0x42b6b3[_0xa6f7('0xe6')]][_0xa6f7('0x4b')]!==_0xa6f7('0x90')){this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x42b6b3[_0xa6f7('0xb2')]]);this[_0xa6f7('0x27')][_0x42b6b3['uniqueid']][_0xa6f7('0x114')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x115')]=function(_0x531859){this['createHistory'](_0x531859)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x112')));this[_0xa6f7('0xca')](_0x531859)['catch'](loggerCatch(_0xa6f7('0x116')));};Dialer[_0xa6f7('0x1a')]['syncQueueCallerAbandon']=function(_0x307f12){var _0x709f73=this[_0xa6f7('0x27')][_0x307f12[_0xa6f7('0xe6')]];var _0x4ed272=this;if(this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]){if(_0x709f73&&_0x709f73['type']!=='ivr'){delete this[_0xa6f7('0x27')][_0x307f12[_0xa6f7('0xe6')]];this['updateOriginated'](this['voiceQueues'][_0x307f12[_0xa6f7('0xb2')]]);_0x709f73[_0xa6f7('0x117')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));var _0x21b1a9=new QueueCallerAbandon(_0x709f73,_0x307f12);if(getSeconds(_0x709f73[_0xa6f7('0x117')],_0x709f73[_0xa6f7('0x118')])>=_0x709f73[_0xa6f7('0x119')]){this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x7f')]+=0x1;this[_0xa6f7('0x1f')][_0x307f12['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xa6f7('0x1f')][_0x307f12['queue']][_0xa6f7('0x6c')]+=0x1;_0x21b1a9[_0xa6f7('0xa8')]=0xa;_0x21b1a9[_0xa6f7('0xe7')]=_0xa6f7('0x11a');_0x21b1a9[_0xa6f7('0x11b')]=_0xa6f7('0x11c');_0x21b1a9[_0xa6f7('0x111')]=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]['dialQueueProject2']?moment()[_0xa6f7('0x77')](_0xa6f7('0x107')):undefined;_0x21b1a9[_0xa6f7('0xf6')]+=0x1;_0x21b1a9[_0xa6f7('0x100')]+=0x1;if(_0x21b1a9[_0xa6f7('0xf6')]>=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x11d')]){this['queueCallerAbandonCreateState'](_0x21b1a9);}else{this[_0xa6f7('0xc0')]({'active':![],'countdropretry':_0x21b1a9[_0xa6f7('0xf6')],'scheduledat':moment()[_0xa6f7('0xfb')](this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]['dialDropRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x709f73[_0xa6f7('0xd5')],'ListId':_0x709f73[_0xa6f7('0xfd')],'VoiceQueueId':_0x709f73[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x709f73[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0x2248dd=new History(_0x21b1a9);_0x2248dd[_0xa6f7('0xa8')]=0xa;_0x2248dd[_0xa6f7('0xe7')]=_0xa6f7('0x11a');_0x2248dd[_0xa6f7('0xaa')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x2248dd[_0xa6f7('0xa9')]=_0x2248dd['starttime'];_0x2248dd['calleridname']=_0x21b1a9['calleridname'];_0x2248dd['calleridnum']=_0x21b1a9[_0xa6f7('0x11e')];this['createHistory'](_0x2248dd)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x6b')]+=0x1;this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x63')]+=0x1;_0x21b1a9[_0xa6f7('0xa8')]=0xb;_0x21b1a9['statedesc']=_0xa6f7('0x11f');_0x21b1a9[_0xa6f7('0x11b')]=_0xa6f7('0x120');_0x21b1a9[_0xa6f7('0xf7')]+=0x1;_0x21b1a9[_0xa6f7('0x100')]+=0x1;if(_0x21b1a9[_0xa6f7('0xf7')]>=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x121')]){this[_0xa6f7('0x115')](_0x21b1a9);}else{this[_0xa6f7('0xc0')]({'active':![],'countabandonedretry':_0x21b1a9[_0xa6f7('0xf7')],'scheduledat':moment()['add'](this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x122')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x709f73['ContactId'],'ListId':_0x709f73[_0xa6f7('0xfd')],'VoiceQueueId':_0x709f73[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x709f73[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x123')));var _0x2248dd=new History(_0x21b1a9);_0x2248dd[_0xa6f7('0xa8')]=0xb;_0x2248dd['statedesc']=_0xa6f7('0x11f');_0x2248dd[_0xa6f7('0xaa')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x2248dd[_0xa6f7('0xa9')]=_0x2248dd[_0xa6f7('0xaa')];_0x2248dd['calleridname']=_0x21b1a9['calleridname'];_0x2248dd[_0xa6f7('0x11e')]=_0x21b1a9[_0xa6f7('0x11e')];this['createHistory'](_0x2248dd)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x124')));}}}}};Dialer[_0xa6f7('0x1a')]['syncNewExten']=function(_0x594eec){if(this[_0xa6f7('0x25')][_0x594eec[_0xa6f7('0xe6')]]){this[_0xa6f7('0x25')][_0x594eec[_0xa6f7('0xe6')]][_0xa6f7('0xb0')]=_0x594eec['channel'];}if(this[_0xa6f7('0x27')][_0x594eec[_0xa6f7('0xe6')]]){this[_0xa6f7('0x27')][_0x594eec[_0xa6f7('0xe6')]][_0xa6f7('0xb0')]=_0x594eec[_0xa6f7('0xb0')];}};Dialer['prototype'][_0xa6f7('0x35')]=function(_0x50fcb7){if(strategy[this['voiceQueues'][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]]['queue']]['strategy']]===_0xa6f7('0x126')){if(this[_0xa6f7('0x25')][_0x50fcb7['actionid']]&&_[_0xa6f7('0xe2')](this[_0xa6f7('0x25')][_0x50fcb7['actionid']]['locked'])&&_0x50fcb7[_0xa6f7('0xaf')]==='1'&&_0x50fcb7[_0xa6f7('0x127')]==='0'){if(this['agents'][_0x50fcb7[_0xa6f7('0x128')]]){if(!this[_0xa6f7('0x21')][_0x50fcb7[_0xa6f7('0x128')]][_0xa6f7('0x129')]){this[_0xa6f7('0x21')][_0x50fcb7[_0xa6f7('0x128')]][_0xa6f7('0x129')]=!![];this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0x129')]=!![];this['actions'][_0x50fcb7['actionid']]['stateinterface']=_0x50fcb7[_0xa6f7('0x128')];}}}}else if((strategy[this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]||_0xa6f7('0x19'))===_0xa6f7('0x19')){if(this['actions'][_0x50fcb7[_0xa6f7('0x125')]]){if(this['agents'][_0x50fcb7['stateinterface']]){this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]]['stateinterface']=_0x50fcb7[_0xa6f7('0x128')];if(_[_0xa6f7('0xe2')](this['queueBooked'][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]])){this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]=[];}this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x50fcb7['actionid']]['queue']][_0xa6f7('0x12b')](_['merge'](_['pick'](this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]],['idHopper',_0xa6f7('0x128')]),{'status':_0x50fcb7['status'],'paused':_0x50fcb7[_0xa6f7('0x127')]}));}}}};function unlockQueueStatus(_0x1fe164,_0x5de2da){setTimeout(function(){if(_['isUndefined'](_0x1fe164['queueStatusComplete'])){loggerBooked[_0xa6f7('0x94')](_0xa6f7('0x12c'),_0x5de2da);}_0x1fe164[_0xa6f7('0x12d')]=!![];loggerBooked[_0xa6f7('0x7a')](_0xa6f7('0x12e'),_0x5de2da,JSON[_0xa6f7('0x46')](_[_0xa6f7('0xd4')](_0x1fe164,[_0xa6f7('0x3c'),_0xa6f7('0x12d')])));},0x1f3);}Dialer[_0xa6f7('0x1a')][_0xa6f7('0x37')]=function(_0x5e3a06){var _0x522323=this;var _0x160bfd=_0x522323[_0xa6f7('0x1f')][_0x522323[_0xa6f7('0x25')][_0x5e3a06['actionid']]['queue']];if(strategy[this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]===_0xa6f7('0x126')){if(this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]&&this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0x128')]){this[_0xa6f7('0x1e')][_0xa6f7('0x12f')](this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x130')],this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x128')])[_0xa6f7('0xb8')](function(_0x55bf91){logger[_0xa6f7('0x94')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xa6f7('0x95')](_0x55bf91,{'showHidden':![],'depth':null}));})['finally'](function(){_0x522323[_0xa6f7('0xcd')](_0x522323[_0xa6f7('0x1f')][_0x522323['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]);_0x522323[_0xa6f7('0x21')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x128')]]['locked']=![];delete _0x522323['actions'][_0x5e3a06[_0xa6f7('0x125')]];unlockQueueStatus(_0x160bfd);});}else{this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]);this[_0xa6f7('0xc0')]({'active':![],'ContactId':this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xd5')],'ListId':this['actions'][_0x5e3a06[_0xa6f7('0x125')]]['ListId'],'VoiceQueueId':this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xd7')]||undefined,'CampaignId':this['actions'][_0x5e3a06[_0xa6f7('0x125')]]['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x131')));delete this[_0xa6f7('0x25')][_0x5e3a06['actionid']];unlockQueueStatus(_0x160bfd);}}else if((strategy[this[_0xa6f7('0x1f')][this['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]||_0xa6f7('0x19'))==='rrmemory'){var _0x4b5ff7;if(this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]&&!_['isEmpty'](this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]])){if(this[_0xa6f7('0x132')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]){this[_0xa6f7('0x132')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]=this[_0xa6f7('0x132')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]?this['queueBookedRR'][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]:this[_0xa6f7('0x12a')][this['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]?this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]][_0xa6f7('0x133')]||0x0:0x0;}this['queueBooked'][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]][_0xa6f7('0x133')]=this[_0xa6f7('0x132')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]];for(var _0x4805d2=0x0;_0x4805d2=0x0;})['catch'](myreject(_0xc09f16)));}}else{_0x37057b[_0xa6f7('0x12b')](ami[_0xa6f7('0x14e')]({'action':_0xa6f7('0x149'),'command':util[_0xa6f7('0x77')](_0xa6f7('0x14f'),_0x65ad6a,!_[_0xa6f7('0x3a')](config[_0xa6f7('0x14a')][_0x75a4f4])?_0x75a4f4:'')})[_0xa6f7('0xb7')](function(_0x298b56){return _0x298b56[_0xa6f7('0x14b')]['indexOf'](_0xa6f7('0x14d'))>=0x0;})['catch'](myreject(_0xc09f16)));}BPromise[_0xa6f7('0x150')](_0x37057b)[_0xa6f7('0xb7')](function(_0x2f9531){var _0x3e546e=_[_0xa6f7('0x151')](_0x2f9531);if(_0x3e546e){return _0xb4915a(_0x3e546e);}else{_0x5ac4bb[_0xa6f7('0x3b')]=_0x499ded?_0xa6f7('0x152'):'INTERVAL_IS_OVERTIME';return _0xc09f16(msgResponse('[ifTime][promiseAll]',_0xa6f7('0x145'),_0xa6f7('0x153')+_0x499ded+'\x20'+_0x59c06b+_0xa6f7('0x154')+util[_0xa6f7('0x95')](_0x65ad6a,{'showHidden':![],'depth':null})+_0xa6f7('0x155')+_0x75a4f4));}})['catch'](function(_0x3ec007){return _0xc09f16(msgResponse(_0xa6f7('0x142'),_0xa6f7('0x145'),JSON[_0xa6f7('0x46')](_0x3ec007)));});});};Dialer[_0xa6f7('0x1a')]['checkDialMethod']=function(_0x58e6bc){var _0x168628=this;return function(){switch(_0x58e6bc[_0xa6f7('0x5a')]){case _0xa6f7('0x156'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,0x1);break;case _0xa6f7('0x158'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,_0x58e6bc[_0xa6f7('0x159')]);break;case'predictive':_0x168628[_0xa6f7('0xb')](_0x58e6bc);break;case _0xa6f7('0xa'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,0x1);break;default:freeVariablesPredictive(_0x58e6bc);logger[_0xa6f7('0x94')](_0xa6f7('0x15a'),_0x58e6bc[_0xa6f7('0x3c')],_0xa6f7('0x15b'));}};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x15c')]=function(_0x3027bb){var _0x3f003e=this;return function(){_0x3f003e['handleIvr'](_0x3027bb);};};Dialer[_0xa6f7('0x1a')]['syncQueueSummary']=function(_0x4a1504){var _0x483526=this;if(isNotPreview(_0x4a1504['dialMethod'])){if(isVoiceQueueOutbound(_0x4a1504[_0xa6f7('0x4b')])&&isActive(_0x4a1504['dialActive'])){_0x4a1504[_0xa6f7('0x9f')]=!![];BPromise['resolve']()[_0xa6f7('0xb7')](checkIsLoggedIn(_0x4a1504,_0x4a1504[_0xa6f7('0x4f')]))['then'](checkIsActive(_0x4a1504,_0x4a1504[_0xa6f7('0x59')]))[_0xa6f7('0xb7')](checkInterval(_0x4a1504))[_0xa6f7('0xb7')](_0x483526[_0xa6f7('0x13d')](_0x4a1504))['then'](_0x483526[_0xa6f7('0x140')](_0x4a1504[_0xa6f7('0x15d')],_0x4a1504[_0xa6f7('0x15e')],_0x4a1504['name'],_0x4a1504))[_0xa6f7('0xb7')](_0x483526[_0xa6f7('0x141')](_0x4a1504['Interval'],_0x4a1504[_0xa6f7('0x15e')],_0x4a1504[_0xa6f7('0x3c')],_0x4a1504))['then'](_0x483526[_0xa6f7('0x15f')](_0x4a1504))[_0xa6f7('0xb8')](loggerCatchQueueSummary(_0xa6f7('0x160'),_0x4a1504));}else{notSendMessagesQueue(_0x4a1504);}}else{freeVariablesPredictive(_0x4a1504);}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x13c')]=function(){var _0x35bc86=this;var _0x3b3ee1;for(var _0x459fb0 in this['campaigns']){if(typeof this[_0xa6f7('0x20')][_0x459fb0]!==_0xa6f7('0x98')){_0x3b3ee1=this[_0xa6f7('0x20')][_0x459fb0];if(isCampaignIvr(_0x3b3ee1[_0xa6f7('0x4b')])&&isActive(_0x3b3ee1[_0xa6f7('0xde')])){_0x3b3ee1[_0xa6f7('0x9f')]=!![];BPromise['resolve']()[_0xa6f7('0xb7')](checkIsActive(_0x3b3ee1,_0x3b3ee1[_0xa6f7('0xde')]))['then'](checkInterval(_0x3b3ee1))['then'](_0x35bc86[_0xa6f7('0x13d')](_0x3b3ee1))['then'](_0x35bc86['checkIfTime'](_0x3b3ee1[_0xa6f7('0x15d')],_0x3b3ee1['dialTimezone'],_0x3b3ee1[_0xa6f7('0x3c')],_0x3b3ee1))[_0xa6f7('0xb7')](_0x35bc86[_0xa6f7('0x141')](_0x3b3ee1['Interval'],_0x3b3ee1['dialTimezone'],_0x3b3ee1[_0xa6f7('0x3c')],_0x3b3ee1))[_0xa6f7('0xb7')](_0x35bc86[_0xa6f7('0x15c')](_0x3b3ee1))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x3b3ee1));}else{notSendMessagesCampaign(_0x3b3ee1);}}}};function getCallerIdRandom(_0x5df639,_0x24e2aa){var _0x36742a;var _0x338305;var _0x4458d1;if(_0x24e2aa<=0x0){_0x24e2aa=0x1;}_0x36742a=new RegExp(_0xa6f7('0x161')+_0x24e2aa+'}$');_0x338305=Math['pow'](0xa,_0x24e2aa-0x1);_0x4458d1=Math[_0xa6f7('0x162')](0xa,_0x24e2aa)-0x1;return util['format']('%s',_[_0xa6f7('0x163')](_0x5df639,_0x36742a,_[_0xa6f7('0x164')](_0x338305,_0x4458d1)));}function extractCalleridName(_0x37e7dc){var _0x4a304e=_0x37e7dc['match'](/"(.*?)"/);return _0x4a304e?_0x4a304e[0x1]:_0x37e7dc;}function extractCalleridNumber(_0x15e5dc){var _0x223fe3=_0x15e5dc['match'](/<(.*?)>/);return _0x223fe3?_0x223fe3[0x1]:_0x15e5dc;}Dialer['prototype'][_0xa6f7('0x165')]=function(_0x36bfcb,_0x48740d){var _0x118c80=this;var _0x3228c6=uuid['v4']();this[_0xa6f7('0x25')][_0x3228c6]=new Action(_0x36bfcb,_0x48740d,_0x3228c6);return new BPromise(function(_0x3f6e98,_0x22fb24){if(_[_0xa6f7('0x3a')](_0x36bfcb)&&typeof _0x36bfcb!==_0xa6f7('0x166')){return _0x22fb24(msgResponse('originate',_0xa6f7('0x145'),'voiceQueue\x20is\x20undefine'));}if(_[_0xa6f7('0x3a')](_0x48740d[_0xa6f7('0x167')]['phone'])||_0x48740d['Contact']['phone']===null){return _0x22fb24(msgResponse(_0xa6f7('0x168'),_0xa6f7('0x145'),'contact\x20is\x20undefine'));}var _0xda2ba9={'XMD-CALLERID':_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x169')](),'XMD-AGI':_0x36bfcb[_0xa6f7('0x10a')]?util[_0xa6f7('0x77')](_0xa6f7('0x16a'),ipAgi,_0x36bfcb[_0xa6f7('0x10a')]):_0xa6f7('0x16b'),'XMD-AGIAFTER':_0x36bfcb[_0xa6f7('0x16c')]?util[_0xa6f7('0x77')](_0xa6f7('0x16a'),ipAgi,_0x36bfcb[_0xa6f7('0x16c')]):_0xa6f7('0x16b'),'XMD-QUEUE':_0x36bfcb['type']==='outbound'?util[_0xa6f7('0x77')](_0xa6f7('0x16d'),_0x36bfcb['name'],_0x36bfcb[_0xa6f7('0x16e')]||'',_0x36bfcb[_0xa6f7('0x16f')]?'c':'',_0x36bfcb['dialQueueTimeout']||0x3):_0xa6f7('0x16b'),'XMD-CONTACTID':_0x48740d[_0xa6f7('0xd5')],'XMD-CDRTYPE':_0xa6f7('0x9'),'CALLERID(all)':_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x169')](),'XMD-AMD':_0x36bfcb[_0xa6f7('0xe4')]?_0xa6f7('0x170'):_0xa6f7('0x16b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x36bfcb[_0xa6f7('0xe4')]){_0xda2ba9['XMD-AMDINITIALSILENCE']=_0x36bfcb[_0xa6f7('0x171')]||0x9c4;_0xda2ba9['XMD-AMDGREETING']=_0x36bfcb['dialAMDGreeting']||0x5dc;_0xda2ba9[_0xa6f7('0x172')]=_0x36bfcb['dialAMDAfterGreetingSilence']||0x320;_0xda2ba9[_0xa6f7('0x173')]=_0x36bfcb['dialAMDTotalAnalysisTime']||0x1388;_0xda2ba9['XMD-AMDMINWORDLENGTH']=_0x36bfcb[_0xa6f7('0x174')]||0x64;_0xda2ba9[_0xa6f7('0x175')]=_0x36bfcb[_0xa6f7('0x176')]||0x32;_0xda2ba9['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x36bfcb[_0xa6f7('0x177')]||0x3;_0xda2ba9[_0xa6f7('0x178')]=_0x36bfcb[_0xa6f7('0x179')]||0x100;_0xda2ba9[_0xa6f7('0x17a')]=_0x36bfcb[_0xa6f7('0x17b')]||0x1388;}if(_0x36bfcb[_0xa6f7('0x4b')]==='outbound'){_0xda2ba9[_0xa6f7('0x17c')]=_0x48740d[_0xa6f7('0xd7')];}else{_0xda2ba9[_0xa6f7('0x17d')]=_0x48740d[_0xa6f7('0xd8')];}for(var _0x3505a5 in _0x48740d['Contact']){if(typeof _0x48740d[_0xa6f7('0x167')][_0x3505a5]!==_0xa6f7('0x98')){if(isNotNull(_0x48740d[_0xa6f7('0x167')][_0x3505a5])&&_0x3505a5!=='id'&&_0x3505a5!==_0xa6f7('0x17e')&&_0x3505a5!==_0xa6f7('0x17f')&&_0x3505a5!==_0xa6f7('0x180')){_0xda2ba9[util[_0xa6f7('0x77')](_0xa6f7('0x181'),_0xa6f7('0x182'),_[_0xa6f7('0x183')](_0x3505a5))]=_0x48740d['Contact'][_0x3505a5];}}}var _0x16881e=_0x118c80[_0xa6f7('0xdd')](_0x36bfcb['Trunk'])?getCallerId(_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x76')],_0x36bfcb[_0xa6f7('0x184')],_0x36bfcb[_0xa6f7('0x185')]>0x0?getCallerIdRandom(_0x36bfcb['dialOriginateCallerIdNumber'],_0x36bfcb[_0xa6f7('0x185')]):_0x36bfcb[_0xa6f7('0x186')]):getCallerId(_[_0xa6f7('0xe2')](_0x36bfcb[_0xa6f7('0x187')])?_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x76')]:_0x36bfcb[_0xa6f7('0x187')][_0xa6f7('0x76')],_0x36bfcb['dialOriginateCallerIdName'],_0x36bfcb[_0xa6f7('0x185')]>0x0?getCallerIdRandom(_0x36bfcb[_0xa6f7('0x186')],_0x36bfcb[_0xa6f7('0x185')]):_0x36bfcb[_0xa6f7('0x186')]);if(_0x16881e){_0xda2ba9[_0xa6f7('0x188')]=_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x189')]=extractCalleridName(_0x16881e);_0xda2ba9[_0xa6f7('0x18a')]=_0x118c80[_0xa6f7('0x25')][_0x3228c6]['originatecalleridnum']=extractCalleridNumber(_0x16881e);}return ami['Action']({'actionid':_0x3228c6,'action':_0xa6f7('0x168'),'channel':_0x118c80[_0xa6f7('0xdd')](_0x36bfcb[_0xa6f7('0x75')])?util[_0xa6f7('0x77')](_0xa6f7('0x18b'),_0x36bfcb[_0xa6f7('0x75')]['name'],isNotNull(_0x36bfcb[_0xa6f7('0x5c')])?_0x36bfcb[_0xa6f7('0x5c')]['trim']()||'':'',_0x36bfcb['dialCutDigit']>0x0?_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')][_0xa6f7('0x18d')](_0x36bfcb[_0xa6f7('0x18e')]):_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]):util['format'](_0xa6f7('0x18b'),_[_0xa6f7('0xe2')](_0x36bfcb[_0xa6f7('0x187')])?_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x3c')]:_0x36bfcb[_0xa6f7('0x187')][_0xa6f7('0x3c')],isNotNull(_0x36bfcb['dialPrefix'])?_0x36bfcb['dialPrefix'][_0xa6f7('0x18f')]()||'':'',_0x36bfcb[_0xa6f7('0x18e')]>0x0?_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]['substring'](_0x36bfcb[_0xa6f7('0x18e')]):_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]),'callerid':_0x16881e,'Exten':_0xa6f7('0xe3'),'Context':_0xa6f7('0x190'),'Priority':'1','variable':_0xda2ba9,'timeout':(_0x36bfcb['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3228c6})[_0xa6f7('0xb7')](function(_0x5877e7){return _0x3f6e98(_0x5877e7);})[_0xa6f7('0xb8')](function(_0x347e39){_0x36bfcb['outboundOriginateFailureCallsDay']+=0x1;var _0x1a6d9c=new History(_0x118c80[_0xa6f7('0x25')][_0x3228c6]);logger['error'](util[_0xa6f7('0x77')](_0xa6f7('0x191'),JSON[_0xa6f7('0x46')](_0x347e39)));_0x1a6d9c[_0xa6f7('0xa8')]=0xe;_0x1a6d9c[_0xa6f7('0xe7')]='OriginateError';_0x1a6d9c['starttime']=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x1a6d9c[_0xa6f7('0xa9')]=_0x1a6d9c[_0xa6f7('0xaa')];_0x118c80[_0xa6f7('0xcc')](_0x1a6d9c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x192')));_0x118c80['moveContactManagedDialer'](_0x1a6d9c)[_0xa6f7('0xb8')](loggerCatch('[originate][error]'))[_0xa6f7('0x1c')](function(){delete _0x118c80['actions'][_0x3228c6];return _0x22fb24(msgResponse('originate',_0xa6f7('0x45'),_0xa6f7('0x193')));});});});};Dialer[_0xa6f7('0x1a')]['syncOriginateResponse']=function(_0x551c24){var _0x2cee1a=this[_0xa6f7('0x25')][_0x551c24[_0xa6f7('0x125')]];if(_0x2cee1a){delete this[_0xa6f7('0x25')][_0x551c24[_0xa6f7('0x125')]];_0x2cee1a[_0xa6f7('0x118')]=moment()[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x165beb=_0x2cee1a['type']===_0xa6f7('0x90')?this[_0xa6f7('0x20')][_0x2cee1a['queue']]:this['voiceQueues'][_0x2cee1a[_0xa6f7('0x194')]()];if(!this[_0xa6f7('0xdb')](_0x551c24[_0xa6f7('0x195')])){this['updateOriginated'](_0x165beb);return this[_0xa6f7('0x196')](_0x2cee1a,_0x165beb,_0x551c24)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x197')));}this[_0xa6f7('0x27')][_0x551c24['uniqueid']]=_0x2cee1a;}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x198')]=function(_0x468140,_0x1b153d,_0x57171a){var _0x48a29f=new History(_0x1b153d);if(_0x48a29f[_0xa6f7('0xf3')]+_0x48a29f['countcongestionretry']+_0x48a29f[_0xa6f7('0xf5')]+_0x48a29f['countnosuchnumberretry']+_0x48a29f['countdropretry']+_0x48a29f[_0xa6f7('0xf7')]+_0x48a29f[_0xa6f7('0xf2')]+_0x48a29f[_0xa6f7('0x102')]>=_0x57171a[_0xa6f7('0xf8')]-0x1){return!![];}switch(_0x468140){case 0x3:if(_0x48a29f[_0xa6f7('0xf5')]>=_0x57171a[_0xa6f7('0x199')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countnoanswerretry':_0x48a29f[_0xa6f7('0xf5')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialNoAnswerRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f['ListId'],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x19a')));break;case 0x5:if(_0x48a29f['countbusyretry']>=_0x57171a[_0xa6f7('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x48a29f['countbusyretry']+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x19c')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f['ListId'],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x19d')));break;case 0x8:if(_0x48a29f['countcongestionretry']>=_0x57171a['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x48a29f[_0xa6f7('0xf4')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialCongestionRetryFrequency'],'minutes')[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch(_0xa6f7('0x19e')));break;case 0x0:if(_0x48a29f['countnosuchnumberretry']>=_0x57171a[_0xa6f7('0x19f')]-0x1){return!![];}else{this[_0xa6f7('0xc0')]({'active':![],'countnosuchnumberretry':_0x48a29f['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a0')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f['ContactId'],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1a1')));}break;case 0xa:if(_0x48a29f[_0xa6f7('0xf6')]>=_0x57171a[_0xa6f7('0x11d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x48a29f[_0xa6f7('0xf6')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a2')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch(_0xa6f7('0x1a3')));break;case 0xb:if(_0x48a29f[_0xa6f7('0xf7')]>=_0x57171a['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countabandonedretry':_0x48a29f[_0xa6f7('0xf7')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialAbandonedRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f['CampaignId']||undefined})['catch'](loggerCatch(_0xa6f7('0x123')));break;case 0x13:if(_0x48a29f[_0xa6f7('0xf2')]>=_0x57171a[_0xa6f7('0x103')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x48a29f[_0xa6f7('0xf2')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x106')],'minutes')[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x48a29f[_0xa6f7('0x102')]>=_0x57171a[_0xa6f7('0x1a4')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countagentrejectretry':_0x48a29f[_0xa6f7('0x102')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a5')],_0xa6f7('0xfc'))[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x196')]=function(_0xb8568f,_0x5b6bb7,_0x5adfba){var _0x37cd05=this;var _0x3c1b89=new History(_0xb8568f);return new BPromise(function(_0x45c91b,_0x5b5ac4){if(_[_0xa6f7('0x3a')](_0x5b6bb7)&&typeof _0x5b6bb7!==_0xa6f7('0x166')){return _0x5b5ac4(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0x145'),_0xa6f7('0x1a7')));}if(_[_0xa6f7('0x3a')](_0x5adfba)&&typeof _0x5adfba!==_0xa6f7('0x166')){return _0x5b5ac4(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0x145'),_0xa6f7('0x1a8')));}switch(_0x5adfba[_0xa6f7('0x10f')]){case'0':_0x5b6bb7[_0xa6f7('0x65')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x0;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1a9');_0x3c1b89[_0xa6f7('0x101')]+=0x1;_0x3c1b89['countglobal']+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1aa'),ut[_0xa6f7('0xec')](_0xb8568f,'nosuchnumber'));_0x37cd05['createHistory'](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1ab')));if(_0x37cd05['checkRetriveMax'](0x0,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0x101')]>=_0x5b6bb7[_0xa6f7('0x19f')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1ac'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1ac'));}}break;case'3':_0x5b6bb7[_0xa6f7('0x1ad')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x3;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1ae');_0x3c1b89[_0xa6f7('0xf5')]+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1af'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b0')));_0x37cd05['createHistory'](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1b1')));if(_0x37cd05['checkRetriveMax'](0x3,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf5')]>=_0x5b6bb7['dialNoAnswerMaxRetry']){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b2'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b2'));}}break;case'5':_0x5b6bb7[_0xa6f7('0x60')]+=0x1;_0x3c1b89['state']=0x5;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1b3');_0x3c1b89['countbusyretry']+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1b4'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b5')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x37cd05[_0xa6f7('0x198')](0x5,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89['countbusyretry']>=_0x5b6bb7[_0xa6f7('0x19b')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,'reason\x205\x20busy');}else{_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b6'));}}break;case'8':_0x5b6bb7[_0xa6f7('0x61')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x8;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1b7');_0x3c1b89['countcongestionretry']+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1b8'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b9')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1ba')));if(_0x37cd05[_0xa6f7('0x198')](0x8,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf4')]>=_0x5b6bb7['dialCongestionMaxRetry']){_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bb'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bb'));}}break;case'11':_0x5b6bb7[_0xa6f7('0x1bc')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0xb;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x11f');_0x3c1b89[_0xa6f7('0xf7')]+=0x1;_0x3c1b89['countglobal']+=0x1;_0x37cd05['createHistory'](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x124')));if(_0x37cd05['checkRetriveMax'](0xb,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf7')]>=_0x5b6bb7[_0xa6f7('0x121')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bd'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bd'));}}break;case'20':_0x5b6bb7[_0xa6f7('0x67')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x14;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1be');_0x3c1b89[_0xa6f7('0x102')]+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1bf'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1c0')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1c1')));if(_0x37cd05[_0xa6f7('0x198')](0x14,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0x102')]>=_0x5b6bb7[_0xa6f7('0x1a4')]){_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1c2'));}else{_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1c2'));}}break;default:_0x5b6bb7[_0xa6f7('0x68')]+=0x1;_0x3c1b89['state']=0xc;_0x3c1b89['statedesc']=_0x5adfba['reason'];_0x37cd05['createHistory'](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1c3')));if(_0x37cd05[_0xa6f7('0x198')](_0x5adfba[_0xa6f7('0x10f')],_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf3')]+_0x3c1b89['countcongestionretry']+_0x3c1b89['countnoanswerretry']+_0x3c1b89[_0xa6f7('0x101')]+_0x3c1b89['countdropretry']+_0x3c1b89['countabandonedretry']+_0x3c1b89['countmachineretry']+_0x3c1b89[_0xa6f7('0x102')]>=_0x5b6bb7[_0xa6f7('0xf8')]){_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0x5adfba[_0xa6f7('0x10f')]);}else{_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0x5adfba['reason']);}}}});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xf9')]=function(_0x292821,_0x5e6ebe,_0x29b949,_0x2f220e){var _0x174dee=new Final(_0x292821);_0x174dee[_0xa6f7('0xa8')]=0xf;_0x174dee[_0xa6f7('0xe7')]='Global';this[_0xa6f7('0x104')](_0x174dee,_0x5e6ebe,_0x29b949,_0x2f220e);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x104')]=function(_0x1f4eb3,_0x5a65fa,_0x4a8982,_0x5752e8){this[_0xa6f7('0xca')](_0x1f4eb3)[_0xa6f7('0xb7')](function(){return _0x5a65fa(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0xdc'),_0x5752e8));})['catch'](function(){return _0x4a8982(msgResponse(_0xa6f7('0x1c4'),_0xa6f7('0x145'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xa6f7('0xb')]=function(_0x197eca){var _0x4e8faf=_0x197eca[_0xa6f7('0x1c5')]/0x64;var _0x11b203=_0x197eca[_0xa6f7('0x64')]/(_0x197eca[_0xa6f7('0x64')]+_0x197eca['outboundAnswerCallsDay']);var _0x449a98=Math[_0xa6f7('0x1c6')](_0x197eca[_0xa6f7('0x70')]*(_0x197eca[_0xa6f7('0x1c7')]/0x64));var _0x44c7d7=Math[_0xa6f7('0x1c6')](_0x197eca['predictiveIntervalAvailable']*(_0x197eca['predictiveIntervalMinThreshold']/0x64));var _0x502ce4=_0x197eca[_0xa6f7('0xa1')]+_0x197eca['talking'];var _0x2f6cdc=Math['floor'](_0x197eca[_0xa6f7('0x72')]*_0x197eca[_0xa6f7('0x8a')]*_0x197eca[_0xa6f7('0x6d')]*_0x197eca['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x197eca[_0xa6f7('0x29')])){if(!_[_0xa6f7('0x3a')](_0x197eca[_0xa6f7('0x28')])){_0x197eca[_0xa6f7('0x28')]=undefined;loggerPredictive[_0xa6f7('0x94')](_0xa6f7('0x1c8'),_0xa6f7('0x1c9'));}if(!_['isUndefined'](_0x197eca['handlePredictive'])){loggerPredictive['error'](_0xa6f7('0x1c8'),_0xa6f7('0x1ca'));clearInterval(_0x197eca[_0xa6f7('0x8e')]);_0x197eca[_0xa6f7('0x8e')]=undefined;}_0x197eca['startProgressive']=moment()['format'](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x197eca[_0xa6f7('0x29')]);this[_0xa6f7('0x157')](_0x197eca,0x1);}else if(ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startProgressive'])){this[_0xa6f7('0x157')](_0x197eca,0x1);loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x1cc'),_0x197eca['startProgressive'],_0x197eca[_0xa6f7('0x3c')]);_0x197eca[_0xa6f7('0x72')]=0x0;_0x197eca['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4e8faf<_0x11b203&&_0x197eca[_0xa6f7('0x1cd')]===_0xa6f7('0x1ce')){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x1cf'),'Dropped\x20calls\x20day',_0x11b203,'startProgressive',_0x197eca['name']);}else if(_0x2f6cdc<_0x197eca[_0xa6f7('0x6c')]&&_0x197eca[_0xa6f7('0x1cd')]===_0xa6f7('0x1ce')){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xa6f7('0x1d0'),_0x2f6cdc,_0xa6f7('0x1d1'),_0x197eca[_0xa6f7('0x6c')],_0xa6f7('0x29'),_0x197eca['name']);}else if(!ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startProgressive'])&&_[_0xa6f7('0x3a')](_0x197eca['startPredictive'])&&!_['isUndefined'](_0x197eca[_0xa6f7('0x29')])){_0x197eca[_0xa6f7('0x28')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d2'),_0x197eca[_0xa6f7('0x28')]);this[_0xa6f7('0xbe')](_0x197eca[_0xa6f7('0x1cb')])[_0xa6f7('0xb7')](this[_0xa6f7('0x1d3')](_0x197eca))['then'](mergeDataErlangB(_0x197eca))[_0xa6f7('0xb7')](this[_0xa6f7('0x1d4')](_0x197eca))[_0xa6f7('0xb8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x197eca));}else if(!ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startPredictive'])){_0x197eca[_0xa6f7('0x6c')]=0x0;_0x197eca['startPredictive']=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d5'),_0x197eca[_0xa6f7('0x28')]);clearInterval(_0x197eca[_0xa6f7('0x8e')]);_0x197eca['handlePredictive']=undefined;this['averageHandleTime'](_0x197eca[_0xa6f7('0x1cb')])[_0xa6f7('0xb7')](this[_0xa6f7('0x1d3')](_0x197eca))[_0xa6f7('0xb7')](mergeDataErlangB(_0x197eca))[_0xa6f7('0xb7')](this[_0xa6f7('0x1d4')](_0x197eca))[_0xa6f7('0xb8')](loggerCatchPredictive(_0xa6f7('0x1d6'),_0x197eca));}else if(_0x197eca['predictiveIntervalAvailable']&&_0x502ce4<_0x197eca[_0xa6f7('0x70')]-_0x44c7d7){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d7'),_0x502ce4,')\x20are\x20less\x20than\x20threshold\x20(',_0x197eca[_0xa6f7('0x70')],'-',_0x44c7d7,'=',_0x197eca['predictiveIntervalAvailable']-_0x44c7d7,')');}else if(_0x197eca[_0xa6f7('0x70')]&&_0x502ce4>_0x197eca['predictiveIntervalAvailable']+_0x449a98){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0x197eca['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x502ce4,_0xa6f7('0x1d8'),_0x197eca[_0xa6f7('0x70')],'+',_0x449a98,'=',_0x197eca[_0xa6f7('0x70')]+_0x449a98,')');}};Dialer[_0xa6f7('0x1a')]['getDataPredictive']=function(_0x13f7dd){var _0x45e6c0=this;return function(_0x3e7eb7){return new BPromise(function(_0x474a9d,_0x278d22){_['merge'](_0x13f7dd,_0x3e7eb7[0x0]);if(checkGetDataPredictive(_0x3e7eb7[0x0])){var _0x48c001=_0x13f7dd['predictiveIntervalAvailable']=_0x13f7dd[_0xa6f7('0xa0')]+_0x13f7dd['available'];var _0x2a588e=_0x13f7dd['dialPredictiveInterval']*0x3c;var _0x41a8be=_0x3e7eb7[0x0]['predictiveIntervalAvgTalktime']+_0x3e7eb7[0x0][_0xa6f7('0x6a')];var _0x3cd900=(_0x3e7eb7[0x0][_0xa6f7('0x69')]+_0x3e7eb7[0x0][_0xa6f7('0x7f')]+_0x3e7eb7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3e7eb7[0x0][_0xa6f7('0x71')];_0x13f7dd[_0xa6f7('0x6d')]=_0x3cd900>0x0?_0x3cd900:0x1;switch(_0x13f7dd[_0xa6f7('0x1cd')]){case _0xa6f7('0x1ce'):var _0x5ab36a=_0x13f7dd[_0xa6f7('0x1c5')]/0x64;return _0x45e6c0['abandonmentRate'](_0x48c001,_0x2a588e,_0x41a8be,_0x3cd900,_0x5ab36a)[_0xa6f7('0xb7')](function(_0x11d25e){return _0x474a9d(_0x11d25e);});case _0xa6f7('0x1d9'):var _0x1e9732=_0x13f7dd[_0xa6f7('0x1c5')]/0x64;return _0x45e6c0[_0xa6f7('0x1da')](_0x48c001,_0x2a588e,_0x41a8be,_0x3cd900,_0x1e9732)['then'](function(_0x4045d4){return _0x474a9d(_0x4045d4);});default:return _0x278d22(msgResponse(_0xa6f7('0x1db'),_0xa6f7('0x145'),_0xa6f7('0x1dc')));}}else{return _0x278d22(msgResponse(_0xa6f7('0x1db'),'Failure',_0xa6f7('0x1dd')));}});};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1de')]=function(_0x26a24d){var _0x220f25=this;return function(_0x1423c4){return new BPromise(function(_0x182df6,_0x402b9f){_[_0xa6f7('0x8c')](_0x26a24d,_0x1423c4[0x0]);if(checkGetDataPredictive(_0x1423c4[0x0])){loggerPredictive[_0xa6f7('0x7a')](JSON['stringify'](_0x1423c4[0x0]));if(_0x26a24d['dialPredictiveOptimization']===_0xa6f7('0x1ce')){return _0x220f25[_0xa6f7('0xc8')](_0x26a24d['id'])['then'](function(_0x4837aa){var _0x315fd5=_0x26a24d['loggedIn']-_0x4837aa[0x0][_0xa6f7('0x1df')];var _0x3bcfe4=_0x26a24d[_0xa6f7('0x1cb')]*0x3c;var _0x14a5fc=_0x1423c4[0x0][_0xa6f7('0x84')]+_0x1423c4[0x0][_0xa6f7('0x6a')];var _0x4f38b7=(_0x1423c4[0x0][_0xa6f7('0x69')]+_0x1423c4[0x0][_0xa6f7('0x7f')]+_0x1423c4[0x0][_0xa6f7('0x6b')])/_0x1423c4[0x0][_0xa6f7('0x71')];var _0x17f815=_0x26a24d['dialPredictiveOptimizationPercentage']/0x64;_0x26a24d[_0xa6f7('0x6f')]=_0x4837aa[0x0][_0xa6f7('0x1df')]||0x0;_0x26a24d[_0xa6f7('0x6d')]=_0x4f38b7>0x0?_0x4f38b7:0x1;return _0x220f25['abandonmentRate'](_0x315fd5,_0x3bcfe4,_0x14a5fc,_0x4f38b7,_0x17f815);})['then'](function(_0x4cdc41){return _0x182df6(_0x4cdc41);})['catch'](function(_0x4664bc){return _0x402b9f(msgResponse('[CatchErlangB]','Failure',JSON[_0xa6f7('0x46')](_0x4664bc)));});}if(_0x26a24d[_0xa6f7('0x1cd')]===_0xa6f7('0x1d9')){return _0x220f25[_0xa6f7('0xc8')](_0x26a24d['id'])[_0xa6f7('0xb7')](function(_0x3e40f9){var _0x3ddefe=_0x26a24d['loggedIn']-_0x3e40f9[0x0]['outboundQueuePauses'];var _0x133eb3=_0x26a24d['dialPredictiveInterval']*0x3c;var _0x8e545e=_0x1423c4[0x0][_0xa6f7('0x84')]+_0x1423c4[0x0][_0xa6f7('0x6a')];var _0x422913=(_0x1423c4[0x0][_0xa6f7('0x69')]+_0x1423c4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1423c4[0x0][_0xa6f7('0x6b')])/_0x1423c4[0x0][_0xa6f7('0x71')];var _0x301eba=_0x26a24d[_0xa6f7('0x1c5')]/0x64;_0x26a24d['predictiveIntervalPauses']=_0x3e40f9[0x0][_0xa6f7('0x1df')]||0x0;_0x26a24d[_0xa6f7('0x6d')]=_0x422913>0x0?_0x422913:0x1;return _0x220f25['busyFactor'](_0x3ddefe,_0x133eb3,_0x8e545e,_0x422913,_0x301eba);})[_0xa6f7('0xb7')](function(_0x240e36){return _0x182df6(_0x240e36);})[_0xa6f7('0xb8')](function(_0xdaf0b){return _0x402b9f(msgResponse('[CatchErlangB]',_0xa6f7('0x145'),JSON['stringify'](_0xdaf0b)));});}}else{return _0x402b9f(msgResponse('[getDataPredictive]','Failure',_0xa6f7('0x1dd')));}});};};Dialer[_0xa6f7('0x1a')]['startMethodPredictive']=function(_0x3a6d7d){var _0x4b5bd8=this;return function(){var _0x53afa6=0x0;var _0x586593=Math[_0xa6f7('0x1e0')](_0x3a6d7d['erlangCallToSecond']*0x3e8);if(_0x586593>0x0){_0x586593=_0x586593<0x64?0x64:_0x586593;loggerPredictive['info'](_0x3a6d7d[_0xa6f7('0x3c')],_0xa6f7('0x1e1'),_0x586593,_0xa6f7('0x47'));_0x3a6d7d[_0xa6f7('0x8e')]=setInterval(function(){_0x4b5bd8['handlePredictive'](_0x3a6d7d);loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x1e2'),_0x53afa6+=0x1);},_0x586593);}else{loggerPredictive[_0xa6f7('0x7a')](_0x3a6d7d[_0xa6f7('0x3c')],_0xa6f7('0x1e3'));}};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1e4')]=function(_0x4ea419,_0x5e544f){var _0x3d72e1=this;return function(_0x396dc5){if(_[_0xa6f7('0x43')](_0x396dc5)){if(_[_0xa6f7('0xe2')](_0x5e544f['UserId'])||!_0x5e544f[_0xa6f7('0x1e5')]){if(_0x4ea419[_0xa6f7('0x5a')]===_0xa6f7('0xa')){_0x4ea419['queueStatusComplete']=_[_0xa6f7('0x3a')](_0x4ea419['queueStatusComplete'])?!![]:_0x4ea419['queueStatusComplete'];var _0x2163d0=uuid['v4']();_0x3d72e1['actions'][_0x2163d0]=new Action(_0x4ea419,_0x5e544f,_0x2163d0);loggerBooked[_0xa6f7('0x7a')]('[booked][checkContactBlack]',_0x2163d0,_0xa6f7('0x1e6'),JSON[_0xa6f7('0x46')](_0x4ea419[_0xa6f7('0x12d')]),_0xa6f7('0x1e7'),_0x4ea419['name']);if(_0x4ea419[_0xa6f7('0x12d')]){_0x4ea419['queueStatusComplete']=![];_0x3d72e1[_0xa6f7('0x12a')][_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xb2')]]=[];ami[_0xa6f7('0x14e')]({'actionid':_0x2163d0,'action':_0xa6f7('0x1e8'),'queue':_0x4ea419[_0xa6f7('0x3c')]})[_0xa6f7('0xb8')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);_0x3d72e1[_0xa6f7('0xc0')]({'active':![],'ContactId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ContactId'],'ListId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ListId'],'VoiceQueueId':_0x3d72e1['actions'][_0x2163d0][_0xa6f7('0xd7')]||undefined,'CampaignId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1e9')));delete _0x3d72e1[_0xa6f7('0x25')][_0x2163d0];});}else{loggerBooked[_0xa6f7('0x7a')](_0xa6f7('0x1ea'),JSON['stringify'](_0x4ea419[_0xa6f7('0x12d')]),'Queue:\x20',_0x4ea419[_0xa6f7('0x3c')]);_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);_0x3d72e1['rescheduleContact']({'active':![],'ContactId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ContactId'],'ListId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xfd')],'VoiceQueueId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd7')]||undefined,'CampaignId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1e9')));delete _0x3d72e1[_0xa6f7('0x25')][_0x2163d0];}}else{return _0x3d72e1[_0xa6f7('0x165')](_0x4ea419,_0x5e544f);}}else{if(getDiff(_0x5e544f[_0xa6f7('0x1eb')])<_0x4ea419[_0xa6f7('0x1ec')]*0x3c){if(_0x5e544f[_0xa6f7('0x1ed')]&&!_0x5e544f['Agent']['voicePause']){_0x3d72e1[_0xa6f7('0x1e')]['run'](_0x5e544f['id'])[_0xa6f7('0x1c')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);});}else{_0x3d72e1[_0xa6f7('0x1ee')]({'active':![]},_0x5e544f['id'],0x1)[_0xa6f7('0x1c')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);});}}else{_0x4ea419[_0xa6f7('0x1ef')]+=0x1;_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);if(_0x4ea419['dialRecallInQueue']){_0x3d72e1[_0xa6f7('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e544f[_0xa6f7('0xd5')],'ListId':_0x5e544f[_0xa6f7('0xfd')],'VoiceQueueId':_0x5e544f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x5e544f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3d72e1[_0xa6f7('0xcc')](createObjHistory(_0x4ea419,_0x5e544f,_0xa6f7('0x1f0'),0x17,_0xa6f7('0x1f1')))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1f2')));}else{_0x3d72e1[_0xa6f7('0xd3')](createObjHistory(_0x4ea419,_0x5e544f,_0xa6f7('0x1f3'),0x16,_0xa6f7('0x1f4')),_0xa6f7('0x1f5'),_0xa6f7('0x1f6'));}}}}else{_0x4ea419[_0xa6f7('0x5f')]+=0x1;_0x3d72e1[_0xa6f7('0xd3')](createObjHistory(_0x4ea419,_0x5e544f,'BLACKLIST',0xd,_0xa6f7('0x1f7')),_0xa6f7('0x1f8'),_0xa6f7('0x1f9'));throw'inBlackList';}};};Dialer['prototype'][_0xa6f7('0x1fa')]=function(_0x4654e6){var _0x5837a7=this;var _0x542f01=_0x4654e6['limitCalls']-_0x4654e6[_0xa6f7('0x97')]-_0x4654e6[_0xa6f7('0xc4')];emitCampaignSummary(_0x4654e6);if(_0x542f01>0x0){if(_0x542f01>this['maxNumberOriginate']){_0x542f01=this['maxNumberOriginate'];}_0x4654e6['temp']+=_0x542f01;this[_0xa6f7('0xc6')](_0x4654e6['id'],_0x542f01,_0x4654e6['dialOrderByScheduledAt'],_0x4654e6)[_0xa6f7('0xb7')](function(_0x595f6a){_0x4654e6[_0xa6f7('0xc4')]-=_0x542f01;_0x4654e6[_0xa6f7('0xc4')]=_0x4654e6[_0xa6f7('0xc4')]>0x0?_0x4654e6[_0xa6f7('0xc4')]:0x0;if(!checkContactEmpty(_0x595f6a)){_0x4654e6['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xa6f7('0x7a')](_0xa6f7('0x1fb')+_0x4654e6[_0xa6f7('0x3c')]);}else{_0x4654e6['originated']+=_0x595f6a[_0xa6f7('0x96')];_0x4654e6[_0xa6f7('0x3b')]=_0xa6f7('0x1fc');for(var _0x1b2920=0x0;_0x1b2920<_0x595f6a['length'];_0x1b2920+=0x1){_0x4654e6['ivrTotalCallsDays']+=0x1;if(_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920])||_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920][_0xa6f7('0x167')])||_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x5837a7[_0xa6f7('0xd1')](_0xa6f7('0x1fd'),_0x4654e6,_0x595f6a[_0x1b2920]);}else{_0x5837a7[_0xa6f7('0xbc')](_['pick'](_0x595f6a[_0x1b2920],[_0xa6f7('0xd8'),_0xa6f7('0x1fe')]))['then'](_0x5837a7[_0xa6f7('0x1e4')](_0x4654e6,_0x595f6a[_0x1b2920]))['catch'](_0x5837a7[_0xa6f7('0xd0')](_0xa6f7('0x1ff'),_0x4654e6));}}}})[_0xa6f7('0xb8')](loggerGetContactDialer(_0xa6f7('0x200'),_0x4654e6,_0x542f01));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x157')]=function(_0x4d4176,_0x3f41bf){var _0x287ed5=this;var _0x177dbb=[];var _0x2fbc72=_0x3f41bf>=0x1?_0x3f41bf:0x1;if(_0x4d4176[_0xa6f7('0x5a')]==='booked'){_0x2fbc72=0x1;}var _0x13034a=Math[_0xa6f7('0x1e0')](_0x4d4176[_0xa6f7('0xa1')]*_0x2fbc72)-_0x4d4176['originated']-_0x4d4176[_0xa6f7('0xc4')];emitVoiceQueueSummary(_0x4d4176);if(_0x4d4176[_0xa6f7('0x201')]>0x0){var _0x1ad53b=_0x4d4176[_0xa6f7('0x201')]-_0x4d4176[_0xa6f7('0x97')]-_0x4d4176[_0xa6f7('0xa0')]-_0x4d4176['temp']-_0x4d4176[_0xa6f7('0x50')];if(_0x13034a>_0x1ad53b){_0x13034a=_0x1ad53b;}}if(_0x13034a>0x0){if(_0x4d4176['dialMethod']==='booked'){_0x13034a=0x1;}if(_0x13034a>this[_0xa6f7('0x23')]){_0x13034a=this[_0xa6f7('0x23')];}_0x4d4176[_0xa6f7('0xc4')]+=_0x13034a;for(var _0x2b3d5a in this['agents']){if(typeof this['agents'][_0x2b3d5a]!=='undefined'){if(this['agents'][_0x2b3d5a][_0xa6f7('0xa8')]===_0xa6f7('0x202')&&this[_0xa6f7('0x21')][_0x2b3d5a][_0xa6f7('0xaf')]===_0xa6f7('0xe0')){_0x177dbb[_0xa6f7('0x12b')](this[_0xa6f7('0x21')][_0x2b3d5a]['id']);}}}this[_0xa6f7('0xc3')](_0x4d4176['id'],_0x177dbb,_0x13034a,_0x4d4176[_0xa6f7('0x203')],_0x4d4176)[_0xa6f7('0xb7')](function(_0x1520e9){_0x4d4176[_0xa6f7('0xc4')]-=_0x13034a;_0x4d4176[_0xa6f7('0xc4')]=_0x4d4176[_0xa6f7('0xc4')]>0x0?_0x4d4176[_0xa6f7('0xc4')]:0x0;if(!checkContactEmpty(_0x1520e9)){_0x287ed5[_0xa6f7('0xb5')](_0x4d4176)[_0xa6f7('0xb7')](sendMessageReschedule(_0x4d4176))['catch'](loggerCatch(_0xa6f7('0xb9')));}else{_0x4d4176['originated']+=_0x1520e9['length'];_0x4d4176[_0xa6f7('0x3b')]=_0x4d4176[_0xa6f7('0x5a')]==='booked'?_0xa6f7('0x170'):'RUNNING';for(var _0x45bd95=0x0;_0x45bd95<_0x1520e9[_0xa6f7('0x96')];_0x45bd95+=0x1){if(_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95])||_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95]['Contact'])||_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x287ed5['emptyContact'](_0xa6f7('0x1fd'),_0x4d4176,_0x1520e9[_0x45bd95]);}else{_0x287ed5[_0xa6f7('0xba')](_[_0xa6f7('0xd4')](_0x1520e9[_0x45bd95],['VoiceQueueId',_0xa6f7('0x1fe')]))[_0xa6f7('0xb7')](_0x287ed5[_0xa6f7('0x1e4')](_0x4d4176,_0x1520e9[_0x45bd95]))['catch'](_0x287ed5[_0xa6f7('0xd0')](_0xa6f7('0x1fd'),_0x4d4176));}}}})['catch'](loggerGetContactDialer(_0xa6f7('0x204'),_0x4d4176,_0x13034a));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x8e')]=function(_0xcf70fb){if(_0xcf70fb['dialLimitQueue']>0x0){var _0x58147c=_0xcf70fb[_0xa6f7('0x201')]-_0xcf70fb['originated']-_0xcf70fb[_0xa6f7('0xa0')];if(_0x58147c>0x0){this[_0xa6f7('0x205')](_0xcf70fb);}else{loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x206'));}}else{this[_0xa6f7('0x205')](_0xcf70fb);}};Dialer['prototype'][_0xa6f7('0x205')]=function(_0x51b945){var _0x19ae8e=this;var _0x5cb39f=[];_0x51b945[_0xa6f7('0x97')]+=0x1;for(var _0x5ad45d in this[_0xa6f7('0x21')]){if(typeof this['agents'][_0x5ad45d]!==_0xa6f7('0x98')){if(this[_0xa6f7('0x21')][_0x5ad45d][_0xa6f7('0xa8')]===_0xa6f7('0x202')&&this['agents'][_0x5ad45d][_0xa6f7('0xaf')]===_0xa6f7('0xe0')){_0x5cb39f[_0xa6f7('0x12b')](this[_0xa6f7('0x21')][_0x5ad45d]['id']);}}}this[_0xa6f7('0xc3')](_0x51b945['id'],_0x5cb39f,0x1,_0x51b945['dialOrderByScheduledAt'],_0x51b945)[_0xa6f7('0xb7')](function(_0x4d5563){if(!checkContactEmpty(_0x4d5563)){checkContactLowerLimitOriginate(_0x51b945,0x1,0x0);_0x19ae8e[_0xa6f7('0xb5')](_0x51b945)[_0xa6f7('0xb7')](sendMessageReschedule(_0x51b945))['catch'](loggerCatch(_0xa6f7('0xb9')));}else{_0x51b945[_0xa6f7('0x3b')]=_0xa6f7('0x1fc');if(_['isNil'](_0x4d5563[0x0])||_[_0xa6f7('0xe2')](_0x4d5563[0x0]['Contact'])||_[_0xa6f7('0xe2')](_0x4d5563[0x0][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x19ae8e[_0xa6f7('0xd1')](_0xa6f7('0x1fd'),_0x51b945,_0x4d5563[0x0]);}else{_0x19ae8e[_0xa6f7('0xba')](_[_0xa6f7('0xd4')](_0x4d5563[0x0],[_0xa6f7('0xd7'),_0xa6f7('0x1fe')]))['then'](_0x19ae8e['checkContactBlack'](_0x51b945,_0x4d5563[0x0]))[_0xa6f7('0xb8')](_0x19ae8e['loggerHandler']('[actionOriginatePredictive]\x20',_0x51b945));}}})['catch'](loggerGetContactDialer(_0xa6f7('0x207'),_0x51b945,0x1));emitVoiceQueueSummary(_0x51b945);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x208')]=function(_0x1551d7,_0x5ce3e6,_0x5b2bf1,_0x21512f,_0x32be08,_0x38481d){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x209'));loggerPredictive['info'](_0xa6f7('0x20a'),_0x1551d7);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20b'),_0x5ce3e6);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20c'),_0x5b2bf1);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20d'),_0x21512f);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20e'),_0x32be08);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));return new BPromise(function(_0xce5eaa,_0x44e7b7){if(_0x1551d7<=0x0||isNaN(_0x1551d7)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x210')+_0x1551d7));}if(_0x5b2bf1<=0x0||isNaN(_0x5b2bf1)){return _0x44e7b7(msgResponse('[abandonmentRate]',_0xa6f7('0x45'),'Ts\x20=\x20'+_0x5b2bf1));}if(_0x21512f<=0x0||isNaN(_0x21512f)){return _0x44e7b7(msgResponse('[abandonmentRate]',_0xa6f7('0x45'),_0xa6f7('0x211')+_0x21512f));}if(_0x5ce3e6<=0x0||isNaN(_0x5ce3e6)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x212')+_0x5ce3e6));}if(_0x32be08<=0x0||isNaN(_0x32be08)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x213')+_0x32be08));}_0x38481d=_0x38481d||0x0;var _0x1ce491=0x1/_0x5b2bf1;var _0x18b571=0x0;var _0x2f4f08=0x0;var _0x43a3d1=0x0;var _0x11fbf8=0x0;for(var _0xdc5e18=0x0;_0x43a3d1<_0x32be08;_0xdc5e18+=0x1){_0x2f4f08=_0xdc5e18/_0x5ce3e6;_0x18b571=(_0x21512f*_0x2f4f08+_0x38481d)/_0x1ce491;_0x43a3d1=erlangb(_0x18b571,_0x1551d7);_0x11fbf8=_0x18b571/_0x1551d7*(0x1-erlangb(_0x18b571,_0x1551d7));}return _0xce5eaa({'erlangCalls':_0xdc5e18,'erlangCallToSecond':_0x5ce3e6/_0xdc5e18,'erlangAbandonmentRate':_0x43a3d1,'erlangBusyFactor':_0x11fbf8});});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1da')]=function(_0x247597,_0x170c15,_0x36b15b,_0x57b256,_0x2b8da1,_0x408c29){loggerPredictive[_0xa6f7('0x7a')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20a'),_0x247597);loggerPredictive[_0xa6f7('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x170c15);loggerPredictive['info'](_0xa6f7('0x20c'),_0x36b15b);loggerPredictive['info'](_0xa6f7('0x20d'),_0x57b256);loggerPredictive[_0xa6f7('0x7a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b8da1);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));return new BPromise(function(_0x5539c6,_0x1584e7){if(_0x247597<=0x0||isNaN(_0x247597)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),'Error','m\x20=\x20'+_0x247597));}if(_0x36b15b<=0x0||isNaN(_0x36b15b)){return _0x1584e7(msgResponse('[busyFactor]',_0xa6f7('0x45'),_0xa6f7('0x215')+_0x36b15b));}if(_0x57b256<=0x0||isNaN(_0x57b256)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),_0xa6f7('0x45'),'p\x20=\x20'+_0x57b256));}if(_0x170c15<=0x0||isNaN(_0x170c15)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),_0xa6f7('0x45'),'interval\x20=\x20'+_0x170c15));}if(_0x2b8da1<=0x0||isNaN(_0x2b8da1)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),'Error',_0xa6f7('0x216')+_0x2b8da1));}_0x408c29=_0x408c29||0x0;var _0x4217ab=0x1/_0x36b15b;var _0x4f961a=0x0;var _0x174b65=0x0;var _0x3f8be7=0x0;var _0x5a53a0=0x0;for(var _0x42e234=0x0;_0x5a53a0<_0x2b8da1;_0x42e234+=0x1){_0x174b65=_0x42e234/_0x170c15;_0x4f961a=(_0x57b256*_0x174b65+_0x408c29)/_0x4217ab;_0x3f8be7=erlangb(_0x4f961a,_0x247597);_0x5a53a0=_0x4f961a/_0x247597*(0x1-erlangb(_0x4f961a,_0x247597));}return _0x5539c6({'erlangCalls':_0x42e234,'erlangCallToSecond':_0x170c15/_0x42e234,'erlangAbandonmentRate':_0x3f8be7,'erlangBusyFactor':_0x5a53a0});});};module[_0xa6f7('0x217')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 0a7a8bd..7eead6f 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 _0x884b=['name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x884b,0x154));var _0xb884=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0x884b[_0x4b4b0e];return _0x4c2d91;};'use strict';var util=require(_0xb884('0x0'));var _=require(_0xb884('0x1'));var moment=require(_0xb884('0x2'));function getSeconds(_0x479cb9,_0x18fb48){var _0x448376=moment(_0x479cb9)[_0xb884('0x3')](0x0);var _0xe34431=moment(_0x18fb48)[_0xb884('0x3')](0x0);return _0x448376[_0xb884('0x4')](_0xe34431,_0xb884('0x5'));}function QueueCallerAbandon(_0x5beecf,_0xb12b1){this[_0xb884('0x6')]=_0x5beecf['scheduledat'];this[_0xb884('0x7')]=_0x5beecf['type'];this[_0xb884('0x8')]=_0x5beecf[_0xb884('0x7')]==='outbound'?_0xb884('0x9'):_0x5beecf[_0xb884('0x7')];this[_0xb884('0xa')]=_0x5beecf[_0xb884('0xa')];this['countcongestionretry']=_0x5beecf['countcongestionretry'];this['countnoanswerretry']=_0x5beecf[_0xb884('0xb')];this['countglobal']=_0x5beecf['countbusyretry']+_0x5beecf[_0xb884('0xc')]+_0x5beecf[_0xb884('0xb')]+_0x5beecf[_0xb884('0xd')]+_0x5beecf[_0xb884('0xe')]+_0x5beecf[_0xb884('0xf')]+_0x5beecf[_0xb884('0x10')]+_0x5beecf['countagentrejectretry'];this[_0xb884('0xd')]=_0x5beecf['countnosuchnumberretry'];this[_0xb884('0xe')]=_0x5beecf[_0xb884('0xe')];this[_0xb884('0xf')]=_0x5beecf['countabandonedretry'];this[_0xb884('0x10')]=_0x5beecf[_0xb884('0x10')];this[_0xb884('0x11')]=_0x5beecf[_0xb884('0x11')];this[_0xb884('0x12')]=_0xb12b1['uniqueid'];this[_0xb884('0x13')]=_0x5beecf[_0xb884('0x14')];this[_0xb884('0x15')]=_0x5beecf[_0xb884('0x16')];this[_0xb884('0x17')]=_0x5beecf[_0xb884('0x17')];this[_0xb884('0x18')]=_0x5beecf[_0xb884('0x18')];this['droptime']=_0x5beecf[_0xb884('0x19')];this[_0xb884('0x1a')]=this[_0xb884('0x19')];this[_0xb884('0x1b')]=getSeconds(_0x5beecf[_0xb884('0x18')],_0x5beecf[_0xb884('0x17')]);this[_0xb884('0x1c')]=getSeconds(this[_0xb884('0x19')],_0x5beecf[_0xb884('0x18')]);this['talktime']=0x0;this[_0xb884('0x9')]=_0xb12b1[_0xb884('0x9')];this[_0xb884('0x1d')]=_0xb12b1['connectedlinename'];this[_0xb884('0x1e')]=_0xb12b1[_0xb884('0x1e')];this['callback']=_0x5beecf[_0xb884('0x1f')];this['callbackuniqueid']=_0x5beecf['callbackuniqueid'];this[_0xb884('0x20')]=_0x5beecf['callbackat'];this['recallme']=_0x5beecf[_0xb884('0x21')];this['ContactId']=_0x5beecf['ContactId'];this['ListId']=_0x5beecf[_0xb884('0x22')];this[_0xb884('0x23')]=_0x5beecf[_0xb884('0x23')];this['VoiceQueueId']=_0x5beecf[_0xb884('0x24')];this['CampaignId']=_0x5beecf['CampaignId'];this[_0xb884('0x25')]=_0x5beecf[_0xb884('0x25')]||'';this[_0xb884('0x26')]=_0x5beecf[_0xb884('0x26')]||'';}module[_0xb884('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xc31c=['talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc31c,0x1a5));var _0xcc31=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc31c[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0xcc31('0x0'));var _=require('lodash');var moment=require(_0xcc31('0x1'));function getSeconds(_0x4289ee,_0xc6e83){var _0x35ebac=moment(_0x4289ee)['milliseconds'](0x0);var _0x444262=moment(_0xc6e83)[_0xcc31('0x2')](0x0);return _0x35ebac[_0xcc31('0x3')](_0x444262,_0xcc31('0x4'));}function QueueCallerAbandon(_0x110dab,_0x2c5b6a){this['scheduledat']=_0x110dab[_0xcc31('0x5')];this['type']=_0x110dab[_0xcc31('0x6')];this[_0xcc31('0x7')]=_0x110dab[_0xcc31('0x6')]===_0xcc31('0x8')?'queue':_0x110dab['type'];this[_0xcc31('0x9')]=_0x110dab[_0xcc31('0x9')];this[_0xcc31('0xa')]=_0x110dab[_0xcc31('0xa')];this[_0xcc31('0xb')]=_0x110dab[_0xcc31('0xb')];this[_0xcc31('0xc')]=_0x110dab['countbusyretry']+_0x110dab['countcongestionretry']+_0x110dab[_0xcc31('0xb')]+_0x110dab['countnosuchnumberretry']+_0x110dab['countdropretry']+_0x110dab[_0xcc31('0xd')]+_0x110dab[_0xcc31('0xe')]+_0x110dab[_0xcc31('0xf')];this['countnosuchnumberretry']=_0x110dab[_0xcc31('0x10')];this[_0xcc31('0x11')]=_0x110dab['countdropretry'];this[_0xcc31('0xd')]=_0x110dab[_0xcc31('0xd')];this[_0xcc31('0xe')]=_0x110dab[_0xcc31('0xe')];this[_0xcc31('0xf')]=_0x110dab[_0xcc31('0xf')];this[_0xcc31('0x12')]=_0x2c5b6a['uniqueid'];this[_0xcc31('0x13')]=_0x110dab[_0xcc31('0x14')];this[_0xcc31('0x15')]=_0x110dab[_0xcc31('0x16')];this[_0xcc31('0x17')]=_0x110dab[_0xcc31('0x17')];this['responsetime']=_0x110dab[_0xcc31('0x18')];this[_0xcc31('0x19')]=_0x110dab[_0xcc31('0x19')];this[_0xcc31('0x1a')]=this[_0xcc31('0x19')];this[_0xcc31('0x1b')]=getSeconds(_0x110dab[_0xcc31('0x18')],_0x110dab['starttime']);this[_0xcc31('0x1c')]=getSeconds(this[_0xcc31('0x19')],_0x110dab[_0xcc31('0x18')]);this[_0xcc31('0x1d')]=0x0;this['queue']=_0x2c5b6a[_0xcc31('0x1e')];this[_0xcc31('0x1f')]=_0x2c5b6a['connectedlinename'];this[_0xcc31('0x20')]=_0x2c5b6a[_0xcc31('0x20')];this[_0xcc31('0x21')]=_0x110dab['callback'];this['callbackuniqueid']=_0x110dab[_0xcc31('0x22')];this[_0xcc31('0x23')]=_0x110dab[_0xcc31('0x23')];this[_0xcc31('0x24')]=_0x110dab[_0xcc31('0x24')];this['ContactId']=_0x110dab[_0xcc31('0x25')];this[_0xcc31('0x26')]=_0x110dab[_0xcc31('0x26')];this[_0xcc31('0x27')]=_0x110dab[_0xcc31('0x27')];this[_0xcc31('0x28')]=_0x110dab['VoiceQueueId'];this[_0xcc31('0x29')]=_0x110dab[_0xcc31('0x29')];this['originatecalleridnum']=_0x110dab[_0xcc31('0x2a')]||'';this[_0xcc31('0x2b')]=_0x110dab[_0xcc31('0x2b')]||'';}module[_0xcc31('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5c59cf4..5a69803 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(_0x312f17,_0x585661){var _0xbd0d40=function(_0x219a62){while(--_0x219a62){_0x312f17['push'](_0x312f17['shift']());}};_0xbd0d40(++_0x585661);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x36b5ec,_0x2ea5a3){var _0x3ac548=function(_0x2bff7b){while(--_0x2bff7b){_0x36b5ec['push'](_0x36b5ec['shift']());}};_0x3ac548(++_0x2ea5a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 c18422b..affc25a 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 _0x9c00=['remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20'];(function(_0x5f0283,_0x251d6d){var _0x1e25fd=function(_0x4e0bfe){while(--_0x4e0bfe){_0x5f0283['push'](_0x5f0283['shift']());}};_0x1e25fd(++_0x251d6d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x51b72e,_0x408f4f){_0x51b72e=_0x51b72e-0x0;var _0xa108e1=_0x9c00[_0x51b72e];return _0xa108e1;};'use strict';var util=require(_0x09c0('0x0'));var _=require(_0x09c0('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x09c0('0x2'));var path=require(_0x09c0('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var ami=require(_0x09c0('0x7'));var rpcDb=require(_0x09c0('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x09c0('0x9'));var faxAccount=require(_0x09c0('0xa'));var attachment=require(_0x09c0('0xb'));var faxMessage=require(_0x09c0('0xc'));function Fax(_0x17cd9d){this['channels']={};this[_0x09c0('0xd')]=_0x17cd9d[_0x09c0('0xd')];this[_0x09c0('0xe')]=_0x17cd9d[_0x09c0('0xe')];this[_0x09c0('0xf')]={};ami['on'](_0x09c0('0x10'),this[_0x09c0('0x11')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x13'),this[_0x09c0('0x14')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x15'),this[_0x09c0('0x16')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x17'),this[_0x09c0('0x18')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x19'),this[_0x09c0('0x1a')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x1b'),this[_0x09c0('0x1c')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x1d'),this[_0x09c0('0x1e')][_0x09c0('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax[_0x09c0('0x1f')][_0x09c0('0x11')]=function(_0x3991c6){if(_0x3991c6[_0x09c0('0x20')]==='from-voip-provider'){for(var _0x2c4440 in this['faxAccounts']){if(this['faxAccounts'][_0x09c0('0x21')](_0x2c4440)){if(_0x3991c6['exten']===this[_0x09c0('0xd')][_0x2c4440][_0x09c0('0x22')]){this[_0x09c0('0x23')][_0x3991c6['uniqueid']]={};this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]][_0x09c0('0x25')]=_0x3991c6[_0x09c0('0x25')];this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]]['id']=this[_0x09c0('0xd')][_0x2c4440]['id'];this['channels'][_0x3991c6[_0x09c0('0x24')]][_0x09c0('0x26')]=this[_0x09c0('0xd')][_0x2c4440][_0x09c0('0x26')];logger['info'](_0x3991c6['uniqueid'],_0x09c0('0x27'));}}}}if(this[_0x09c0('0xf')][_0x3991c6[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x3991c6['uniqueid']]={};this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]]['channel']=_0x3991c6[_0x09c0('0x25')];logger[_0x09c0('0x28')](_0x3991c6[_0x09c0('0x24')],_0x09c0('0x27'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x14')]=function(_0x45cc64){if(this[_0x09c0('0x23')][_0x45cc64[_0x09c0('0x24')]]){for(var _0x1aa80e in _0x45cc64[_0x09c0('0x29')]){if(_0x45cc64['variable'][_0x09c0('0x21')](_0x1aa80e)){this[_0x09c0('0x23')][_0x45cc64['uniqueid']][_0x1aa80e]=_0x45cc64[_0x09c0('0x2a')];}}}};Fax['prototype'][_0x09c0('0x16')]=function(_0x4d6bdc){if(this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]]['channelstate']=_0x4d6bdc['channelstate'];this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]][_0x09c0('0x2b')]=_0x4d6bdc['channelstatedesc'];}};Fax[_0x09c0('0x1f')]['syncNewExten']=function(_0x350cd3){if(this[_0x09c0('0x23')][_0x350cd3[_0x09c0('0x24')]]){for(var _0x500cf8 in _0x350cd3[_0x09c0('0x29')]){if(_0x350cd3[_0x09c0('0x29')][_0x09c0('0x21')](_0x500cf8)){this[_0x09c0('0x23')][_0x350cd3[_0x09c0('0x24')]][_0x500cf8]=_0x350cd3[_0x09c0('0x2a')];}}}};Fax[_0x09c0('0x1f')]['syncFaxStatus']=function(_0x26da22){if(this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]]['operation']=_0x26da22[_0x09c0('0x2c')];this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x2d')]=_0x26da22[_0x09c0('0x2d')];this['channels'][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x22')]=_0x26da22[_0x09c0('0x22')];this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x2e')]=_0x26da22[_0x09c0('0x2e')];logger['info'](_0x26da22[_0x09c0('0x24')],_0x09c0('0x2f'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x1c')]=function(_0x453c23){var _0x4e98f1=this;if(this['channels'][_0x453c23['uniqueid']]){var _0x4a14dc=this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]]['id'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x30')]=_0x453c23['remotestationid'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]]['pagestransferred']=_0x453c23[_0x09c0('0x31')];this['channels'][_0x453c23[_0x09c0('0x24')]]['localstationid']=_0x453c23[_0x09c0('0x22')];this[_0x09c0('0x23')][_0x453c23['uniqueid']][_0x09c0('0x32')]=_0x453c23[_0x09c0('0x32')];this['channels'][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x33')]=_0x453c23[_0x09c0('0x33')];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x2e')]=_0x453c23['filename'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x34')]=_0x453c23['calleridnum'];if(this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x31')]>0x0){tiff2pdf(_0x453c23['filename'],_0x09c0('0x35'),function(_0x59d188){logger['info'](_0x453c23['uniqueid'],_0x09c0('0x36'),_0x59d188[_0x09c0('0x37')]);attachment['create']({'name':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])['name'],'basename':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])[_0x09c0('0x26')]+_0x09c0('0x39'),'type':_0x09c0('0x3a')})['then'](function(_0x330fe7){faxAccount['notify'](_0x4a14dc,{'from':_0x453c23['calleridnum'],'mapKey':_0x09c0('0x6'),'body':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])[_0x09c0('0x26')]+_0x09c0('0x39'),'AttachmentId':_0x330fe7['id']})[_0x09c0('0x3b')](function(_0x52a4ff){logger['error'](_0x453c23['uniqueid'],_0x09c0('0x3c'),JSON[_0x09c0('0x3d')](_0x52a4ff));});})[_0x09c0('0x3b')](function(_0x56ec01){logger[_0x09c0('0x3e')](_0x453c23[_0x09c0('0x24')],_0x09c0('0x3f'),JSON[_0x09c0('0x3d')](_0x56ec01));});});}logger[_0x09c0('0x28')](_0x453c23[_0x09c0('0x24')],_0x09c0('0x3f'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x40')]=function(_0x38085c){if(this[_0x09c0('0xf')][_0x38085c[_0x09c0('0x24')]]){_[_0x09c0('0x41')](this[_0x09c0('0x23')][_0x38085c[_0x09c0('0x24')]],_[_0x09c0('0x42')](_0x38085c,[_0x09c0('0x43'),_0x09c0('0x44')]));}};function updateStatus(_0x3ae68f){if(_0x3ae68f[_0x09c0('0x45')]){faxMessage['update'](_0x3ae68f[_0x09c0('0x45')],{'failMessage':_0x09c0('0x46')})[_0x09c0('0x47')](function(_0x30206e){ut[_0x09c0('0x48')]('[Fax][Message][Error][Updated]',_0x30206e);})[_0x09c0('0x3b')](function(_0x866d31){ut[_0x09c0('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x866d31);});}else{ut[_0x09c0('0x48')](_0x09c0('0x49'));}}Fax[_0x09c0('0x1f')][_0x09c0('0x4a')]=function(_0x55b0f0,_0xebfd6d,_0x45ecd0){var _0x499905=this;var _0x1285f8={};if(_0xebfd6d){_0x1285f8={'read':_0xebfd6d};}else{_0x1285f8={'failMessage':_0x45ecd0};}if(this[_0x09c0('0xf')][_0x55b0f0][_0x09c0('0x45')]){faxMessage[_0x09c0('0x4b')](this[_0x09c0('0xf')][_0x55b0f0][_0x09c0('0x45')],_0x1285f8)[_0x09c0('0x47')](function(_0x4987cf){ut['logger'](_0x09c0('0x4c'),_0x4987cf);})[_0x09c0('0x3b')](function(_0x1ab662){ut['logger'](_0x09c0('0x4d'),_0x1ab662);})['finally'](function(){delete _0x499905[_0x09c0('0x23')][_0x55b0f0];delete _0x499905[_0x09c0('0xf')][_0x55b0f0];});}else{ut[_0x09c0('0x48')](_0x09c0('0x4e'));delete this[_0x09c0('0x23')][_0x55b0f0];delete this[_0x09c0('0xf')][_0x55b0f0];}};Fax[_0x09c0('0x1f')]['syncHangup']=function(_0xa201bf){var _0x2d6201=this;if(this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]]){if(this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]]['id']=this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]['id'];this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x26')]=this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x26')];}logger['info'](_0xa201bf[_0x09c0('0x24')],this['actions'][_0xa201bf[_0x09c0('0x24')]]?_0x09c0('0x4f'):_0x09c0('0x50'),JSON['stringify'](this['channels'][_0xa201bf[_0x09c0('0x24')]]));if(this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]){if(this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x51')]>0x0&&this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x19')]===_0x09c0('0x52')){this[_0x09c0('0x4a')](_0xa201bf[_0x09c0('0x24')],!![]);}else{this['updateStatus'](_0xa201bf[_0x09c0('0x24')],![],this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x53')]?_0x09c0('0x54')+this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x53')]:_0x09c0('0x55'));}}}};Fax[_0x09c0('0x1f')][_0x09c0('0x56')]=function(_0x2906cb){var _0x2d67e8=this;return new BPromise(function(_0x484df5,_0x13f3af){_0x2d67e8[_0x09c0('0x57')](_0x2906cb,_0x2d67e8[_0x09c0('0xd')][_0x2906cb[_0x09c0('0x58')]])[_0x09c0('0x47')](function(_0x54295a){ut[_0x09c0('0x48')](_0x09c0('0x59'),_0x54295a);_0x484df5(ut[_0x09c0('0x37')](_0x09c0('0x5a')));})['catch'](function(_0x1d395e){ut[_0x09c0('0x48')]('[Fax][execOriginate][failure]',_0x1d395e);updateStatus(_0x2906cb);_0x13f3af(ut[_0x09c0('0x37')](_0x09c0('0x5b')));});});};Fax[_0x09c0('0x1f')][_0x09c0('0x5c')]=function(_0x1e9dd5){var _0x5a9516=this;return new BPromise(function(_0x19503e,_0x302c81){var _0x3a3f24=_0x5a9516[_0x09c0('0x5d')](_0x5a9516[_0x09c0('0xd')][_0x1e9dd5['FaxAccountId']][_0x09c0('0x5e')],_0x1e9dd5);if(_0x3a3f24[_0x09c0('0x5f')]){_0x19503e(ut[_0x09c0('0x37')](_0x09c0('0x60')));}else{_0x302c81(ut[_0x09c0('0x37')](_0x3a3f24[_0x09c0('0x37')]));}});};function originate(_0x59c57a,_0x51fc84,_0x583c0d){return new BPromise(function(_0x52fe65,_0x7c1cb8){if(_0x583c0d){var _0x1dcd69=util[_0x09c0('0x61')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x09c0('0x38')](_0x59c57a['path'])[_0x09c0('0x26')],_0x59c57a[_0x09c0('0x3')]);gs['execute'](_0x1dcd69)[_0x09c0('0x47')](function(){_0x59c57a['path']=util['format'](_0x09c0('0x62'),path[_0x09c0('0x38')](_0x59c57a[_0x09c0('0x3')])[_0x09c0('0x63')],path[_0x09c0('0x38')](_0x59c57a[_0x09c0('0x3')])[_0x09c0('0x26')]);_0x51fc84[_0x09c0('0x64')]=_0x59c57a[_0x09c0('0x3')];ut[_0x09c0('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0x09c0('0x65')](ut[_0x09c0('0x66')](_0x59c57a,_0x51fc84))['then'](function(_0x4e1d42){_0x52fe65(_0x4e1d42);})[_0x09c0('0x3b')](function(_0x164bac){_0x7c1cb8(_0x164bac);});})[_0x09c0('0x3b')](function(_0x302e0d){_0x7c1cb8(_0x302e0d);});}else{ami[_0x09c0('0x65')](ut[_0x09c0('0x66')](_0x59c57a,_0x51fc84))[_0x09c0('0x47')](function(_0x53c5dd){_0x52fe65(_0x53c5dd);})[_0x09c0('0x3b')](function(_0x56b94b){_0x7c1cb8(_0x56b94b);});}});}Fax[_0x09c0('0x1f')][_0x09c0('0x57')]=function(_0x3ecf97,_0x1a81b1){var _0x2d97cb=this;return new BPromise(function(_0x4f35d1,_0x167303){var _0x4ce49a=uuid['v4']();var _0x28e4b7=ut['addVariables'](_0x3ecf97,_0x1a81b1);_0x2d97cb[_0x09c0('0xf')][_0x4ce49a]=new Action(_0x4ce49a,_0x1a81b1,_0x3ecf97);var _0x3e8b19=_0x2d97cb[_0x09c0('0xf')][_0x4ce49a];if(path[_0x09c0('0x38')](_0x3ecf97[_0x09c0('0x3')])[_0x09c0('0x67')]===_0x09c0('0x39')){originate(_0x3e8b19,_0x28e4b7,!![])['then'](function(_0x4ab50d){_0x4f35d1(_0x4ab50d);})[_0x09c0('0x3b')](function(_0x430a78){_0x167303(_0x430a78);});}else{originate(_0x3e8b19,_0x28e4b7,![])[_0x09c0('0x47')](function(_0x309d0a){_0x4f35d1(_0x309d0a);})[_0x09c0('0x3b')](function(_0x1041d9){_0x167303(_0x1041d9);});}});};Fax[_0x09c0('0x1f')][_0x09c0('0x68')]=function(_0x97cc44){return!_[_0x09c0('0x69')](_0x97cc44)&&!_['isNil'](_0x97cc44['name'])&&!_['isNil'](_0x97cc44[_0x09c0('0x6a')])&&_0x97cc44[_0x09c0('0x6a')]&&!_[_0x09c0('0x69')](this['trunks'][util['format'](_0x09c0('0x6b'),_0x97cc44['name'])])&&!_[_0x09c0('0x69')](this[_0x09c0('0xe')][util['format'](_0x09c0('0x6b'),_0x97cc44['name'])][_0x09c0('0x2d')])&&(this[_0x09c0('0xe')][util[_0x09c0('0x61')]('SIP/%s',_0x97cc44[_0x09c0('0x26')])][_0x09c0('0x2d')]===_0x09c0('0x6c')||this[_0x09c0('0xe')][util[_0x09c0('0x61')](_0x09c0('0x6b'),_0x97cc44[_0x09c0('0x26')])][_0x09c0('0x2d')]===_0x09c0('0x6d'));};Fax[_0x09c0('0x1f')][_0x09c0('0x5d')]=function(_0xf25624,_0x592151){if(!this[_0x09c0('0x68')](_0xf25624)){ut[_0x09c0('0x48')](_0x09c0('0x6e'),_[_0x09c0('0x69')](_0xf25624)?'':_0xf25624[_0x09c0('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x09c0('0x6f')};}if(_['isNil'](_0x592151['fax'])){ut[_0x09c0('0x48')](_0x09c0('0x70'),JSON[_0x09c0('0x3d')](_0x592151));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x09c0('0x69')](_0x592151[_0x09c0('0x3')])){ut[_0x09c0('0x48')](_0x09c0('0x71'),JSON[_0x09c0('0x3d')](_0x592151));return{'isValid':![],'message':_0x09c0('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x09c0('0x73')]=Fax; \ No newline at end of file +var _0xe820=['channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','prototype','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','Trunk','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','reachable','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage'];(function(_0x16da58,_0x4ffcd8){var _0x3e96c6=function(_0xab9a17){while(--_0xab9a17){_0x16da58['push'](_0x16da58['shift']());}};_0x3e96c6(++_0x4ffcd8);}(_0xe820,0xd2));var _0x0e82=function(_0x48bcff,_0x57984e){_0x48bcff=_0x48bcff-0x0;var _0xbe6ab0=_0xe820[_0x48bcff];return _0xbe6ab0;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var BPromise=require(_0x0e82('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x0e82('0x2'));var tiff2pdf=require(_0x0e82('0x3'));var gs=require(_0x0e82('0x4'));var logger=require('../../../config/logger')(_0x0e82('0x5'));var ami=require('../ami');var rpcDb=require(_0x0e82('0x6'));var Channel=require(_0x0e82('0x7'));var ut=require(_0x0e82('0x8'));var Action=require(_0x0e82('0x9'));var faxAccount=require(_0x0e82('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x0e82('0xb'));function Fax(_0x33c8a2){this[_0x0e82('0xc')]={};this[_0x0e82('0xd')]=_0x33c8a2[_0x0e82('0xd')];this['trunks']=_0x33c8a2[_0x0e82('0xe')];this[_0x0e82('0xf')]={};ami['on'](_0x0e82('0x10'),this[_0x0e82('0x11')][_0x0e82('0x12')](this));ami['on'](_0x0e82('0x13'),this[_0x0e82('0x14')]['bind'](this));ami['on'](_0x0e82('0x15'),this[_0x0e82('0x16')][_0x0e82('0x12')](this));ami['on'](_0x0e82('0x17'),this[_0x0e82('0x18')][_0x0e82('0x12')](this));ami['on']('faxstatus',this[_0x0e82('0x19')]['bind'](this));ami['on']('receivefax',this[_0x0e82('0x1a')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x0e82('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x0e82('0x12')](this));}Fax['prototype'][_0x0e82('0x11')]=function(_0x39cf23){if(_0x39cf23[_0x0e82('0x1b')]===_0x0e82('0x1c')){for(var _0x53622b in this[_0x0e82('0xd')]){if(this[_0x0e82('0xd')][_0x0e82('0x1d')](_0x53622b)){if(_0x39cf23[_0x0e82('0x1e')]===this[_0x0e82('0xd')][_0x53622b][_0x0e82('0x1f')]){this[_0x0e82('0xc')][_0x39cf23[_0x0e82('0x20')]]={};this[_0x0e82('0xc')][_0x39cf23[_0x0e82('0x20')]][_0x0e82('0x21')]=_0x39cf23['channel'];this['channels'][_0x39cf23[_0x0e82('0x20')]]['id']=this[_0x0e82('0xd')][_0x53622b]['id'];this[_0x0e82('0xc')][_0x39cf23[_0x0e82('0x20')]][_0x0e82('0x22')]=this[_0x0e82('0xd')][_0x53622b][_0x0e82('0x22')];logger[_0x0e82('0x23')](_0x39cf23['uniqueid'],_0x0e82('0x24'));}}}}if(this[_0x0e82('0xf')][_0x39cf23[_0x0e82('0x20')]]){this[_0x0e82('0xc')][_0x39cf23['uniqueid']]={};this[_0x0e82('0xc')][_0x39cf23[_0x0e82('0x20')]][_0x0e82('0x21')]=_0x39cf23[_0x0e82('0x21')];logger['info'](_0x39cf23[_0x0e82('0x20')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x0e82('0x14')]=function(_0x168dbe){if(this['channels'][_0x168dbe[_0x0e82('0x20')]]){for(var _0xe3c530 in _0x168dbe[_0x0e82('0x25')]){if(_0x168dbe['variable'][_0x0e82('0x1d')](_0xe3c530)){this[_0x0e82('0xc')][_0x168dbe['uniqueid']][_0xe3c530]=_0x168dbe[_0x0e82('0x26')];}}}};Fax['prototype'][_0x0e82('0x16')]=function(_0x3ec302){if(this['channels'][_0x3ec302[_0x0e82('0x20')]]){this[_0x0e82('0xc')][_0x3ec302[_0x0e82('0x20')]]['channelstate']=_0x3ec302['channelstate'];this[_0x0e82('0xc')][_0x3ec302['uniqueid']][_0x0e82('0x27')]=_0x3ec302['channelstatedesc'];}};Fax[_0x0e82('0x28')][_0x0e82('0x18')]=function(_0x44e177){if(this['channels'][_0x44e177[_0x0e82('0x20')]]){for(var _0x59d2f8 in _0x44e177[_0x0e82('0x25')]){if(_0x44e177[_0x0e82('0x25')][_0x0e82('0x1d')](_0x59d2f8)){this[_0x0e82('0xc')][_0x44e177[_0x0e82('0x20')]][_0x59d2f8]=_0x44e177[_0x0e82('0x26')];}}}};Fax['prototype'][_0x0e82('0x19')]=function(_0x132bc4){if(this[_0x0e82('0xc')][_0x132bc4[_0x0e82('0x20')]]){this[_0x0e82('0xc')][_0x132bc4[_0x0e82('0x20')]][_0x0e82('0x29')]=_0x132bc4[_0x0e82('0x29')];this[_0x0e82('0xc')][_0x132bc4[_0x0e82('0x20')]][_0x0e82('0x2a')]=_0x132bc4[_0x0e82('0x2a')];this[_0x0e82('0xc')][_0x132bc4[_0x0e82('0x20')]][_0x0e82('0x1f')]=_0x132bc4['localstationid'];this[_0x0e82('0xc')][_0x132bc4[_0x0e82('0x20')]][_0x0e82('0x2b')]=_0x132bc4[_0x0e82('0x2b')];logger['info'](_0x132bc4[_0x0e82('0x20')],_0x0e82('0x2c'));}};Fax['prototype'][_0x0e82('0x1a')]=function(_0x57e505){var _0x4a855f=this;if(this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]]){var _0xcf82d5=this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]]['id'];this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]]['remotestationid']=_0x57e505['remotestationid'];this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x2d')]=_0x57e505[_0x0e82('0x2d')];this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x1f')]=_0x57e505[_0x0e82('0x1f')];this['channels'][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x2e')]=_0x57e505[_0x0e82('0x2e')];this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x2f')]=_0x57e505[_0x0e82('0x2f')];this['channels'][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x2b')]=_0x57e505[_0x0e82('0x2b')];this[_0x0e82('0xc')][_0x57e505[_0x0e82('0x20')]][_0x0e82('0x30')]=_0x57e505[_0x0e82('0x30')];if(this['channels'][_0x57e505['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x57e505['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x4a1484){logger[_0x0e82('0x23')](_0x57e505[_0x0e82('0x20')],_0x0e82('0x31'),_0x4a1484[_0x0e82('0x32')]);attachment[_0x0e82('0x33')]({'name':path[_0x0e82('0x34')](_0x57e505[_0x0e82('0x2b')])[_0x0e82('0x22')],'basename':path['parse'](_0x57e505['filename'])[_0x0e82('0x22')]+_0x0e82('0x35'),'type':_0x0e82('0x36')})[_0x0e82('0x37')](function(_0x43a5f2){faxAccount[_0x0e82('0x38')](_0xcf82d5,{'from':_0x57e505[_0x0e82('0x30')],'mapKey':_0x0e82('0x5'),'body':path['parse'](_0x57e505[_0x0e82('0x2b')])['name']+_0x0e82('0x35'),'AttachmentId':_0x43a5f2['id']})['catch'](function(_0x411574){logger['error'](_0x57e505[_0x0e82('0x20')],_0x0e82('0x39'),JSON[_0x0e82('0x3a')](_0x411574));});})['catch'](function(_0x59ee6d){logger[_0x0e82('0x3b')](_0x57e505[_0x0e82('0x20')],_0x0e82('0x3c'),JSON['stringify'](_0x59ee6d));});});}logger[_0x0e82('0x23')](_0x57e505['uniqueid'],_0x0e82('0x3c'));}};Fax[_0x0e82('0x28')][_0x0e82('0x3d')]=function(_0x64406e){if(this[_0x0e82('0xf')][_0x64406e[_0x0e82('0x20')]]){_[_0x0e82('0x3e')](this[_0x0e82('0xc')][_0x64406e[_0x0e82('0x20')]],_[_0x0e82('0x3f')](_0x64406e,[_0x0e82('0x40'),_0x0e82('0x41')]));}};function updateStatus(_0x4e9030){if(_0x4e9030[_0x0e82('0x42')]){faxMessage[_0x0e82('0x43')](_0x4e9030['AttachmentId'],{'failMessage':_0x0e82('0x44')})['then'](function(_0x4a9a16){ut[_0x0e82('0x45')]('[Fax][Message][Error][Updated]',_0x4a9a16);})[_0x0e82('0x46')](function(_0x1006ce){ut[_0x0e82('0x45')](_0x0e82('0x47'),_0x1006ce);});}else{ut[_0x0e82('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x0e82('0x28')]['updateStatus']=function(_0x3e6a16,_0x2a77bd,_0x42c4a7){var _0xe0ee1e=this;var _0x464618={};if(_0x2a77bd){_0x464618={'read':_0x2a77bd};}else{_0x464618={'failMessage':_0x42c4a7};}if(this['actions'][_0x3e6a16][_0x0e82('0x42')]){faxMessage[_0x0e82('0x43')](this[_0x0e82('0xf')][_0x3e6a16][_0x0e82('0x42')],_0x464618)[_0x0e82('0x37')](function(_0x53aaa5){ut[_0x0e82('0x45')](_0x0e82('0x48'),_0x53aaa5);})[_0x0e82('0x46')](function(_0x1e6d69){ut[_0x0e82('0x45')](_0x0e82('0x49'),_0x1e6d69);})[_0x0e82('0x4a')](function(){delete _0xe0ee1e[_0x0e82('0xc')][_0x3e6a16];delete _0xe0ee1e[_0x0e82('0xf')][_0x3e6a16];});}else{ut[_0x0e82('0x45')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x3e6a16];delete this['actions'][_0x3e6a16];}};Fax[_0x0e82('0x28')]['syncHangup']=function(_0x23741c){var _0x3b80aa=this;if(this['channels'][_0x23741c['uniqueid']]){if(this[_0x0e82('0xf')][_0x23741c[_0x0e82('0x20')]]){this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]]['id']=this[_0x0e82('0xf')][_0x23741c[_0x0e82('0x20')]]['id'];this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]][_0x0e82('0x22')]=this[_0x0e82('0xf')][_0x23741c['uniqueid']][_0x0e82('0x22')];}logger[_0x0e82('0x23')](_0x23741c[_0x0e82('0x20')],this[_0x0e82('0xf')][_0x23741c[_0x0e82('0x20')]]?_0x0e82('0x4b'):_0x0e82('0x4c'),JSON[_0x0e82('0x3a')](this['channels'][_0x23741c[_0x0e82('0x20')]]));if(this[_0x0e82('0xf')][_0x23741c[_0x0e82('0x20')]]){if(this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]][_0x0e82('0x4d')]>0x0&&this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]][_0x0e82('0x4e')]==='SUCCESS'){this[_0x0e82('0x4f')](_0x23741c['uniqueid'],!![]);}else{this[_0x0e82('0x4f')](_0x23741c['uniqueid'],![],this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]]['faxstatusstring']?_0x0e82('0x50')+this[_0x0e82('0xc')][_0x23741c[_0x0e82('0x20')]][_0x0e82('0x51')]:_0x0e82('0x52'));}}}};Fax['prototype'][_0x0e82('0x53')]=function(_0x4d5c6e){var _0x5c173e=this;return new BPromise(function(_0x17c402,_0x2cf29f){_0x5c173e[_0x0e82('0x54')](_0x4d5c6e,_0x5c173e[_0x0e82('0xd')][_0x4d5c6e[_0x0e82('0x55')]])[_0x0e82('0x37')](function(_0xb1a061){ut[_0x0e82('0x45')](_0x0e82('0x56'),_0xb1a061);_0x17c402(ut[_0x0e82('0x32')]('Fax\x20received'));})['catch'](function(_0x248d27){ut['logger'](_0x0e82('0x57'),_0x248d27);updateStatus(_0x4d5c6e);_0x2cf29f(ut[_0x0e82('0x32')]('Fax\x20failed'));});});};Fax[_0x0e82('0x28')][_0x0e82('0x58')]=function(_0x4f3940){var _0x3e6445=this;return new BPromise(function(_0x15fdf3,_0x4c7d71){var _0x3cf127=_0x3e6445['checkTrunk'](_0x3e6445[_0x0e82('0xd')][_0x4f3940[_0x0e82('0x55')]][_0x0e82('0x59')],_0x4f3940);if(_0x3cf127[_0x0e82('0x5a')]){_0x15fdf3(ut[_0x0e82('0x32')](_0x0e82('0x5b')));}else{_0x4c7d71(ut[_0x0e82('0x32')](_0x3cf127[_0x0e82('0x32')]));}});};function originate(_0xa97d47,_0x2c632d,_0x4b256f){return new BPromise(function(_0x39911a,_0x4a696b){if(_0x4b256f){var _0x131698=util[_0x0e82('0x5c')](_0x0e82('0x5d'),path['parse'](_0xa97d47[_0x0e82('0x2')])[_0x0e82('0x22')],_0xa97d47[_0x0e82('0x2')]);gs[_0x0e82('0x5e')](_0x131698)[_0x0e82('0x37')](function(){_0xa97d47['path']=util[_0x0e82('0x5c')]('%s/%s.tif',path[_0x0e82('0x34')](_0xa97d47[_0x0e82('0x2')])['dir'],path['parse'](_0xa97d47[_0x0e82('0x2')])[_0x0e82('0x22')]);_0x2c632d[_0x0e82('0x5f')]=_0xa97d47[_0x0e82('0x2')];ut[_0x0e82('0x45')](_0x0e82('0x60'),'');ami[_0x0e82('0x61')](ut[_0x0e82('0x62')](_0xa97d47,_0x2c632d))[_0x0e82('0x37')](function(_0x4d5cc7){_0x39911a(_0x4d5cc7);})[_0x0e82('0x46')](function(_0x328d74){_0x4a696b(_0x328d74);});})['catch'](function(_0x4e34ba){_0x4a696b(_0x4e34ba);});}else{ami['Action'](ut[_0x0e82('0x62')](_0xa97d47,_0x2c632d))[_0x0e82('0x37')](function(_0x28ec5){_0x39911a(_0x28ec5);})['catch'](function(_0x3dd6ab){_0x4a696b(_0x3dd6ab);});}});}Fax['prototype'][_0x0e82('0x54')]=function(_0x354ef9,_0x23f57b){var _0xe1c5f6=this;return new BPromise(function(_0x3457bc,_0x48ac18){var _0x28097c=uuid['v4']();var _0x28eb04=ut['addVariables'](_0x354ef9,_0x23f57b);_0xe1c5f6[_0x0e82('0xf')][_0x28097c]=new Action(_0x28097c,_0x23f57b,_0x354ef9);var _0x193b05=_0xe1c5f6[_0x0e82('0xf')][_0x28097c];if(path['parse'](_0x354ef9[_0x0e82('0x2')])['ext']===_0x0e82('0x35')){originate(_0x193b05,_0x28eb04,!![])[_0x0e82('0x37')](function(_0x36d95a){_0x3457bc(_0x36d95a);})[_0x0e82('0x46')](function(_0xe258d4){_0x48ac18(_0xe258d4);});}else{originate(_0x193b05,_0x28eb04,![])[_0x0e82('0x37')](function(_0x203f3d){_0x3457bc(_0x203f3d);})[_0x0e82('0x46')](function(_0x4a1e4d){_0x48ac18(_0x4a1e4d);});}});};Fax[_0x0e82('0x28')][_0x0e82('0x63')]=function(_0x168bf1){return!_[_0x0e82('0x64')](_0x168bf1)&&!_[_0x0e82('0x64')](_0x168bf1['name'])&&!_[_0x0e82('0x64')](_0x168bf1['active'])&&_0x168bf1[_0x0e82('0x65')]&&!_['isNil'](this[_0x0e82('0xe')][util[_0x0e82('0x5c')]('SIP/%s',_0x168bf1[_0x0e82('0x22')])])&&!_[_0x0e82('0x64')](this[_0x0e82('0xe')][util['format']('SIP/%s',_0x168bf1['name'])][_0x0e82('0x2a')])&&(this[_0x0e82('0xe')][util[_0x0e82('0x5c')]('SIP/%s',_0x168bf1[_0x0e82('0x22')])][_0x0e82('0x2a')]===_0x0e82('0x66')||this[_0x0e82('0xe')][util[_0x0e82('0x5c')](_0x0e82('0x67'),_0x168bf1[_0x0e82('0x22')])][_0x0e82('0x2a')]==='unmonitored');};Fax[_0x0e82('0x28')][_0x0e82('0x68')]=function(_0x2ffc69,_0x1ee1dd){if(!this[_0x0e82('0x63')](_0x2ffc69)){ut[_0x0e82('0x45')](_0x0e82('0x69'),_[_0x0e82('0x64')](_0x2ffc69)?'':_0x2ffc69['name']+_0x0e82('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x1ee1dd['fax'])){ut[_0x0e82('0x45')](_0x0e82('0x6b'),JSON[_0x0e82('0x3a')](_0x1ee1dd));return{'isValid':![],'message':_0x0e82('0x6c')};}if(_['isNil'](_0x1ee1dd[_0x0e82('0x2')])){ut['logger'](_0x0e82('0x6d'),JSON[_0x0e82('0x3a')](_0x1ee1dd));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0e82('0x6e')};};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 10287ed..ae6fcc6 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 _0x0396=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','then','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0396,0xcd));var _0x6039=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x0396[_0x256b72];return _0x2183e3;};'use strict';var util=require(_0x6039('0x0'));var BPromise=require(_0x6039('0x1'));var logger=require(_0x6039('0x2'))(_0x6039('0x3'));var _=require(_0x6039('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x16e68f){return function(_0x258d5b){logger[_0x6039('0x5')](_0x16e68f,util[_0x6039('0x6')](_0x258d5b,{'showHidden':![],'depth':null}));};}exports[_0x6039('0x7')]=function(_0x29385a,_0x291c49){return BPromise[_0x6039('0x8')]()[_0x6039('0x9')](faxAccount[_0x6039('0x7')](_0x29385a,_0x291c49))[_0x6039('0xa')](loggerCatch(_0x6039('0xb')));}; \ No newline at end of file +var _0xbc33=['notify','resolve','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x488d54,_0x2169a1){var _0x3397e3=function(_0x4d3dcf){while(--_0x4d3dcf){_0x488d54['push'](_0x488d54['shift']());}};_0x3397e3(++_0x2169a1);}(_0xbc33,0x14d));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3bc3('0x0'));var BPromise=require(_0x3bc3('0x1'));var logger=require(_0x3bc3('0x2'))(_0x3bc3('0x3'));var _=require(_0x3bc3('0x4'));var faxAccount=require(_0x3bc3('0x5'));function loggerCatch(_0x34c7ac){return function(_0xfa51b6){logger[_0x3bc3('0x6')](_0x34c7ac,util[_0x3bc3('0x7')](_0xfa51b6,{'showHidden':![],'depth':null}));};}exports[_0x3bc3('0x8')]=function(_0x311954,_0x149e35){return BPromise[_0x3bc3('0x9')]()['then'](faxAccount[_0x3bc3('0x8')](_0x311954,_0x149e35))[_0x3bc3('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f985742..4ac3d98 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 _0xf995=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','bluebird','child_process'];(function(_0x2294dc,_0x4b3b79){var _0x1c03cd=function(_0x113c84){while(--_0x113c84){_0x2294dc['push'](_0x2294dc['shift']());}};_0x1c03cd(++_0x4b3b79);}(_0xf995,0xc5));var _0x5f99=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf995[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x5f99('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x5f99('0x1'));var exec=require(_0x5f99('0x2'))['exec'];exports[_0x5f99('0x3')]=function(_0x4dda6a){return new BPromise(function(_0x4df652,_0x907c4b){exec(_0x4dda6a,function(_0xf8eb27,_0x1b890a,_0x2f5591){logger[_0x5f99('0x4')](_0x5f99('0x5'),_0x1b890a);if(_0xf8eb27){logger[_0x5f99('0x4')](_0x5f99('0x5'),_0x5f99('0x6'),util[_0x5f99('0x7')](_0xf8eb27,{'showHidden':![],'depth':null}),_0x1b890a,_0x2f5591);_0x907c4b(_0xf8eb27);}_0x4df652(_0x1b890a);});});}; \ No newline at end of file +var _0x18c5=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x429b63,_0x3ff026){var _0x703972=function(_0x3bd776){while(--_0x3bd776){_0x429b63['push'](_0x429b63['shift']());}};_0x703972(++_0x3ff026);}(_0x18c5,0x197));var _0x518c=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x18c5[_0x57014b];return _0x2b258a;};'use strict';var util=require(_0x518c('0x0'));var logger=require(_0x518c('0x1'))(_0x518c('0x2'));var BPromise=require(_0x518c('0x3'));var exec=require(_0x518c('0x4'))[_0x518c('0x5')];exports[_0x518c('0x6')]=function(_0x268e91){return new BPromise(function(_0x1adcbb,_0x22a895){exec(_0x268e91,function(_0x147c6b,_0x263735,_0x26f52b){logger[_0x518c('0x7')](_0x518c('0x8'),_0x263735);if(_0x147c6b){logger[_0x518c('0x7')](_0x518c('0x8'),_0x518c('0x9'),util[_0x518c('0xa')](_0x147c6b,{'showHidden':![],'depth':null}),_0x263735,_0x26f52b);_0x22a895(_0x147c6b);}_0x1adcbb(_0x263735);});});}; \ 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 5f8e22e..3dcb5fa 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 _0x3bbe=['moment','fax','message','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x2deb8d,_0x2d3b1f){var _0x558251=function(_0x31145e){while(--_0x31145e){_0x2deb8d['push'](_0x2deb8d['shift']());}};_0x558251(++_0x2d3b1f);}(_0x3bbe,0xa6));var _0xe3bb=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x3bbe[_0x52e363];return _0x3fc2b5;};'use strict';var util=require(_0xe3bb('0x0'));var _=require(_0xe3bb('0x1'));var moment=require(_0xe3bb('0x2'));var logger=require('../../../../config/logger')(_0xe3bb('0x3'));exports[_0xe3bb('0x4')]=function(_0x5eed61){return{'message':_0x5eed61};};exports['logger']=function(_0x3ac291,_0x9c6cfa){logger[_0xe3bb('0x5')](_0x3ac291,util[_0xe3bb('0x6')](_0x9c6cfa,{'showHidden':![],'depth':null}));};exports[_0xe3bb('0x7')]=function(_0x24e943,_0x13456e){var _0x1fc47a={'XMF-ECM':_0x13456e[_0xe3bb('0x8')],'XMF-HEADERINFO':_0x13456e[_0xe3bb('0x9')],'XMF-MINRATE':_0x13456e['minrate'],'XMF-MAXRATE':_0x13456e[_0xe3bb('0xa')],'XMF-MODEM':util[_0xe3bb('0xb')](_0xe3bb('0xc'),_0x13456e[_0xe3bb('0xd')]),'XMF-GATEWAY':_0x13456e[_0xe3bb('0xe')],'XMF-FAXDETECT':_0x13456e[_0xe3bb('0xf')],'XMF-T38TIMEOUT':_0x13456e[_0xe3bb('0x10')],'XMF-LOCALSTATIONID':_0x13456e[_0xe3bb('0x11')],'XMF-PATH':_0x24e943[_0xe3bb('0x12')]};return _0x1fc47a;};exports[_0xe3bb('0x13')]=function(_0x46cd23,_0x200b69){return{'actionid':_0x46cd23['uniqueid'],'action':_0xe3bb('0x14'),'channel':_0x46cd23[_0xe3bb('0x15')],'Exten':_0xe3bb('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0xe3bb('0xb')](_0xe3bb('0x17'),_0x46cd23['headerinfo']?_0x46cd23[_0xe3bb('0x9')]:'',_0x46cd23[_0xe3bb('0x11')]),'variable':_0x200b69,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x46cd23['uniqueid']};}; \ No newline at end of file +var _0x78ed=['fax','logger','info','inspect','addVariables','ecm','headerinfo','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','from-sip','format','localstationid','util','lodash','moment','../../../../config/logger'];(function(_0xb98696,_0x14ba9e){var _0x23ae71=function(_0x6dcb9c){while(--_0x6dcb9c){_0xb98696['push'](_0xb98696['shift']());}};_0x23ae71(++_0x14ba9e);}(_0x78ed,0x104));var _0xd78e=function(_0x5bf04d,_0x16288d){_0x5bf04d=_0x5bf04d-0x0;var _0x582508=_0x78ed[_0x5bf04d];return _0x582508;};'use strict';var util=require(_0xd78e('0x0'));var _=require(_0xd78e('0x1'));var moment=require(_0xd78e('0x2'));var logger=require(_0xd78e('0x3'))(_0xd78e('0x4'));exports['message']=function(_0x1f48ee){return{'message':_0x1f48ee};};exports[_0xd78e('0x5')]=function(_0x240f23,_0x2a8e82){logger[_0xd78e('0x6')](_0x240f23,util[_0xd78e('0x7')](_0x2a8e82,{'showHidden':![],'depth':null}));};exports[_0xd78e('0x8')]=function(_0x3fe4ca,_0xd1ba80){var _0x2f3427={'XMF-ECM':_0xd1ba80[_0xd78e('0x9')],'XMF-HEADERINFO':_0xd1ba80[_0xd78e('0xa')],'XMF-MINRATE':_0xd1ba80['minrate'],'XMF-MAXRATE':_0xd1ba80['maxrate'],'XMF-MODEM':util['format'](_0xd78e('0xb'),_0xd1ba80[_0xd78e('0xc')]),'XMF-GATEWAY':_0xd1ba80[_0xd78e('0xd')],'XMF-FAXDETECT':_0xd1ba80[_0xd78e('0xe')],'XMF-T38TIMEOUT':_0xd1ba80[_0xd78e('0xf')],'XMF-LOCALSTATIONID':_0xd1ba80['localstationid'],'XMF-PATH':_0x3fe4ca[_0xd78e('0x10')]};return _0x2f3427;};exports[_0xd78e('0x11')]=function(_0x294bf9,_0x4c3d30){return{'actionid':_0x294bf9[_0xd78e('0x12')],'action':_0xd78e('0x13'),'channel':_0x294bf9[_0xd78e('0x14')],'Exten':'xcally-motion-fax','Context':_0xd78e('0x15'),'Priority':'1','callerid':util[_0xd78e('0x16')]('\x22%s\x22\x20<%s>',_0x294bf9[_0xd78e('0xa')]?_0x294bf9[_0xd78e('0xa')]:'',_0x294bf9[_0xd78e('0x17')]),'variable':_0x4c3d30,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x294bf9[_0xd78e('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4d6ab96..af17f0b 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 _0xba24=['getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x10d479,_0x84ea59){var _0x1fec1f=function(_0x3a5016){while(--_0x3a5016){_0x10d479['push'](_0x10d479['shift']());}};_0x1fec1f(++_0x84ea59);}(_0xba24,0x11d));var _0x4ba2=function(_0x56eda9,_0xc6842){_0x56eda9=_0x56eda9-0x0;var _0x2177ca=_0xba24[_0x56eda9];return _0x2177ca;};'use strict';var BPromise=require(_0x4ba2('0x0'));var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x4ba2('0x1'));var Acw=require(_0x4ba2('0x2'));var Trigger=require(_0x4ba2('0x3'));var Dialer=require('./dialer');var Preview=require(_0x4ba2('0x4'));var Fax=require(_0x4ba2('0x5'));var user=require(_0x4ba2('0x6'));var voiceQueue=require(_0x4ba2('0x7'));var voiceQueueReport=require(_0x4ba2('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x4ba2('0x9'));var trigger=require(_0x4ba2('0xa'));var template=require(_0x4ba2('0xb'));var cmHopperHistory=require(_0x4ba2('0xc'));var campaign=require(_0x4ba2('0xd'));var voiceExtension=require(_0x4ba2('0xe'));var faxAccount=require(_0x4ba2('0xf'));var zendesk=require(_0x4ba2('0x10'));var salesforce=require(_0x4ba2('0x11'));var sugarcrm=require(_0x4ba2('0x12'));var freshdesk=require(_0x4ba2('0x13'));var desk=require(_0x4ba2('0x14'));var zoho=require(_0x4ba2('0x15'));var vtiger=require(_0x4ba2('0x16'));var freshsales=require(_0x4ba2('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4ba2('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x4ba2('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4ba2('0x1a')](_0x4ba2('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4ba2('0x1c')]()[_0x4ba2('0x1d')](user[_0x4ba2('0x1e')]())['then'](realtime[_0x4ba2('0x1f')]())[_0x4ba2('0x1d')](user['getTelephones']())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x20')]())[_0x4ba2('0x1d')](trunk[_0x4ba2('0x21')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x22')]())[_0x4ba2('0x1d')](voiceQueue[_0x4ba2('0x23')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x24')]())[_0x4ba2('0x1d')](trigger['getTriggers']())[_0x4ba2('0x1d')](realtime['initTriggers']())[_0x4ba2('0x1d')](template['getTemplates']())['then'](realtime[_0x4ba2('0x25')]())['then'](zendesk[_0x4ba2('0x26')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x27')]())[_0x4ba2('0x1d')](salesforce[_0x4ba2('0x28')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x29')]())[_0x4ba2('0x1d')](sugarcrm[_0x4ba2('0x2a')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x2b')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x4ba2('0x1d')](realtime['initFreshdeskAccounts']())['then'](desk[_0x4ba2('0x2c')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x2d')]())[_0x4ba2('0x1d')](zoho[_0x4ba2('0x2e')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x2f')]())[_0x4ba2('0x1d')](vtiger['getVtigerAccounts']())[_0x4ba2('0x1d')](realtime['initVtigerAccounts']())[_0x4ba2('0x1d')](freshsales['getFreshsalesAccounts']())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x30')]())[_0x4ba2('0x1d')](servicenow[_0x4ba2('0x31')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x32')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())[_0x4ba2('0x1d')](campaign[_0x4ba2('0x33')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x34')]())[_0x4ba2('0x1d')](voiceExtension[_0x4ba2('0x35')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x36')]())['then'](faxAccount[_0x4ba2('0x37')]())['then'](realtime['initFaxAccounts']())[_0x4ba2('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x4ba2('0x1c')]()[_0x4ba2('0x1d')](voiceQueueReport[_0x4ba2('0x38')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x39')]())['then'](cmHopperHistory[_0x4ba2('0x3a')]())[_0x4ba2('0x1d')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x3b')]())[_0x4ba2('0x1d')](voiceCallReport[_0x4ba2('0x3c')]())[_0x4ba2('0x1d')](realtime[_0x4ba2('0x3d')]())[_0x4ba2('0x3e')](function(_0x8f5d9e){logger['error'](_0x4ba2('0x3f'),util[_0x4ba2('0x40')](_0x8f5d9e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4ba2('0x41')](realtime,preview,fax)['then'](function(_0x3354ad){return initRealtime();})[_0x4ba2('0x1d')](function(){return initParams();})['then'](function(){report[_0x4ba2('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x110676){logger['error'](_0x4ba2('0x43'),util[_0x4ba2('0x40')](_0x110676,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3856=['initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','then','getAgents','initAgents','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts'];(function(_0x4ee88f,_0x736119){var _0x9a3a51=function(_0x1d0de4){while(--_0x1d0de4){_0x4ee88f['push'](_0x4ee88f['shift']());}};_0x9a3a51(++_0x736119);}(_0x3856,0xfb));var _0x6385=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x3856[_0x22ffbf];return _0x360c17;};'use strict';var BPromise=require(_0x6385('0x0'));var util=require('util');var moment=require(_0x6385('0x1'));var server=require(_0x6385('0x2'));var Realtime=require(_0x6385('0x3'));var Report=require(_0x6385('0x4'));var Acw=require(_0x6385('0x5'));var Trigger=require(_0x6385('0x6'));var Dialer=require(_0x6385('0x7'));var Preview=require(_0x6385('0x8'));var Fax=require('./fax');var user=require(_0x6385('0x9'));var voiceQueue=require(_0x6385('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6385('0xb'));var trunk=require(_0x6385('0xc'));var trigger=require(_0x6385('0xd'));var template=require(_0x6385('0xe'));var cmHopperHistory=require(_0x6385('0xf'));var campaign=require(_0x6385('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6385('0x11'));var zendesk=require(_0x6385('0x12'));var salesforce=require(_0x6385('0x13'));var sugarcrm=require(_0x6385('0x14'));var freshdesk=require(_0x6385('0x15'));var desk=require(_0x6385('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6385('0x17'));var freshsales=require(_0x6385('0x18'));var servicenow=require(_0x6385('0x19'));var dynamics365=require(_0x6385('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6385('0x1b'))(_0x6385('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x6385('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6385('0x1e')](_0x6385('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x6385('0x1f')](user[_0x6385('0x20')]())['then'](realtime[_0x6385('0x21')]())['then'](user['getTelephones']())[_0x6385('0x1f')](realtime['initTelephones']())[_0x6385('0x1f')](trunk['getTrunks']())[_0x6385('0x1f')](realtime['initTrunks']())[_0x6385('0x1f')](voiceQueue[_0x6385('0x22')]())[_0x6385('0x1f')](realtime[_0x6385('0x23')]())[_0x6385('0x1f')](trigger[_0x6385('0x24')]())[_0x6385('0x1f')](realtime[_0x6385('0x25')]())[_0x6385('0x1f')](template[_0x6385('0x26')]())[_0x6385('0x1f')](realtime[_0x6385('0x27')]())['then'](zendesk[_0x6385('0x28')]())['then'](realtime[_0x6385('0x29')]())[_0x6385('0x1f')](salesforce[_0x6385('0x2a')]())[_0x6385('0x1f')](realtime[_0x6385('0x2b')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x6385('0x1f')](realtime[_0x6385('0x2c')]())['then'](freshdesk[_0x6385('0x2d')]())[_0x6385('0x1f')](realtime[_0x6385('0x2e')]())[_0x6385('0x1f')](desk['getDeskAccounts']())[_0x6385('0x1f')](realtime[_0x6385('0x2f')]())[_0x6385('0x1f')](zoho['getZohoAccounts']())[_0x6385('0x1f')](realtime[_0x6385('0x30')]())[_0x6385('0x1f')](vtiger[_0x6385('0x31')]())[_0x6385('0x1f')](realtime[_0x6385('0x32')]())[_0x6385('0x1f')](freshsales[_0x6385('0x33')]())[_0x6385('0x1f')](realtime[_0x6385('0x34')]())[_0x6385('0x1f')](servicenow[_0x6385('0x35')]())[_0x6385('0x1f')](realtime[_0x6385('0x36')]())[_0x6385('0x1f')](dynamics365[_0x6385('0x37')]())['then'](realtime[_0x6385('0x38')]())[_0x6385('0x1f')](campaign[_0x6385('0x39')]())[_0x6385('0x1f')](realtime[_0x6385('0x3a')]())[_0x6385('0x1f')](voiceExtension[_0x6385('0x3b')]())[_0x6385('0x1f')](realtime[_0x6385('0x3c')]())[_0x6385('0x1f')](faxAccount['getFaxAccounts']())['then'](realtime[_0x6385('0x3d')]())[_0x6385('0x1f')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x6385('0x1f')](voiceQueueReport[_0x6385('0x3e')]())[_0x6385('0x1f')](realtime['initVoiceQueueReports']())[_0x6385('0x1f')](cmHopperHistory[_0x6385('0x3f')]())['then'](realtime[_0x6385('0x40')]())[_0x6385('0x1f')](cmHopperHistory[_0x6385('0x41')]())[_0x6385('0x1f')](realtime[_0x6385('0x42')]())[_0x6385('0x1f')](voiceCallReport[_0x6385('0x43')]())[_0x6385('0x1f')](realtime['initVoiceCallReports']())[_0x6385('0x44')](function(_0x514945){logger[_0x6385('0x45')](_0x6385('0x46'),util['inspect'](_0x514945,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6385('0x47')](realtime,preview,fax)['then'](function(_0x454de5){return initRealtime();})[_0x6385('0x1f')](function(){return initParams();})['then'](function(){report[_0x6385('0x48')]();setInterval(initRealtime,0x1388);})[_0x6385('0x44')](function(_0x5f018c){logger[_0x6385('0x45')]('[index.js][main]',util['inspect'](_0x5f018c,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6bc3f35..d8f32de 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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x358ea5,_0x23a101){var _0x53208f=function(_0x320397){while(--_0x320397){_0x358ea5['push'](_0x358ea5['shift']());}};_0x53208f(++_0x23a101);}(_0x34e8,0x12c));var _0x834e=function(_0x3613c1,_0x5ac4d2){_0x3613c1=_0x3613c1-0x0;var _0x2b43ed=_0x34e8[_0x3613c1];return _0x2b43ed;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x50c500,_0x4557c4){var _0x3ac59e=function(_0x305b1e){while(--_0x305b1e){_0x50c500['push'](_0x50c500['shift']());}};_0x3ac59e(++_0x4557c4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cd9d14a..0e4c572 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 _0xf794=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','message','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf794,0x130));var _0x4f79=function(_0x2aa2d7,_0x1a1ba3){_0x2aa2d7=_0x2aa2d7-0x0;var _0x3ee462=_0xf794[_0x2aa2d7];return _0x3ee462;};'use strict';function Campaign(_0x2bfe0a){this['id']=_0x2bfe0a['id']||0x0;this[_0x4f79('0x0')]=_0x2bfe0a['name']||'';this[_0x4f79('0x1')]=_0x2bfe0a[_0x4f79('0x1')]||_0x4f79('0x2');this[_0x4f79('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x4f79('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x4f79('0x5')]=_0x2bfe0a[_0x4f79('0x5')];this['limitCalls']=_0x2bfe0a['limitCalls'];this['dialTimezone']=_0x2bfe0a[_0x4f79('0x6')]||null;this['dialGlobalInterval']=_0x2bfe0a[_0x4f79('0x7')]?_0x2bfe0a['dialGlobalInterval']:null;this[_0x4f79('0x8')]=_0x2bfe0a[_0x4f79('0x8')];this['dialOriginateCallerIdNumber']=_0x2bfe0a[_0x4f79('0x9')];this['dialOriginateTimeout']=_0x2bfe0a[_0x4f79('0xa')]||0x1e;this[_0x4f79('0xb')]=_0x2bfe0a[_0x4f79('0xb')];this[_0x4f79('0xc')]=_0x2bfe0a[_0x4f79('0xc')];this[_0x4f79('0xd')]=_0x2bfe0a[_0x4f79('0xd')];this[_0x4f79('0xe')]=_0x2bfe0a['dialBusyRetryFrequency'];this[_0x4f79('0xf')]=_0x2bfe0a['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x2bfe0a[_0x4f79('0x10')];this[_0x4f79('0x11')]=_0x2bfe0a['dialGlobalMaxRetry'];this[_0x4f79('0x12')]=_0x2bfe0a[_0x4f79('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2bfe0a[_0x4f79('0x13')]||0x96;this[_0x4f79('0x14')]=_0x2bfe0a[_0x4f79('0x14')]||0x3;this[_0x4f79('0x15')]=_0x2bfe0a['dialDropRetryFrequency']||0x96;this[_0x4f79('0x16')]=_0x2bfe0a[_0x4f79('0x16')]||0x3;this[_0x4f79('0x17')]=_0x2bfe0a[_0x4f79('0x17')]||0x96;this['dialMachineMaxRetry']=_0x2bfe0a[_0x4f79('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x2bfe0a[_0x4f79('0x19')]||0x96;this[_0x4f79('0x1a')]=_0x2bfe0a[_0x4f79('0x1a')]||0x3;this[_0x4f79('0x1b')]=_0x2bfe0a[_0x4f79('0x1b')]||0x96;this[_0x4f79('0x1c')]=_0x2bfe0a['dialOrderByScheduledAt']||_0x4f79('0x1d');this[_0x4f79('0x1e')]=_0x2bfe0a[_0x4f79('0x1e')]||undefined;this[_0x4f79('0x1f')]=_0x2bfe0a[_0x4f79('0x1f')]||undefined;this['dialCutDigit']=_0x2bfe0a[_0x4f79('0x20')]||undefined;this['TrunkBackup']=_0x2bfe0a[_0x4f79('0x21')]?_0x2bfe0a[_0x4f79('0x21')]:undefined;this[_0x4f79('0x22')]=_0x2bfe0a[_0x4f79('0x22')]?_0x2bfe0a[_0x4f79('0x22')]:undefined;this['Interval']=_0x2bfe0a[_0x4f79('0x23')]?_0x2bfe0a['Interval']:undefined;this[_0x4f79('0x24')]=_0x2bfe0a[_0x4f79('0x24')]?_0x2bfe0a['SquareProject']:undefined;this['dialQueueProject']=_0x2bfe0a[_0x4f79('0x24')]?_0x2bfe0a[_0x4f79('0x24')][_0x4f79('0x0')]:undefined;this[_0x4f79('0x25')]=_0x2bfe0a['dialAMDActive']||![];this[_0x4f79('0x26')]=_0x2bfe0a[_0x4f79('0x26')];this[_0x4f79('0x27')]=_0x2bfe0a[_0x4f79('0x27')];this[_0x4f79('0x28')]=_0x2bfe0a[_0x4f79('0x28')];this['dialAMDTotalAnalysisTime']=_0x2bfe0a[_0x4f79('0x29')];this['dialAMDMinWordLength']=_0x2bfe0a[_0x4f79('0x2a')];this['dialAMDBetweenWordsSilence']=_0x2bfe0a[_0x4f79('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x2bfe0a[_0x4f79('0x2c')];this[_0x4f79('0x2d')]=_0x2bfe0a['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2bfe0a[_0x4f79('0x2e')];}module[_0x4f79('0x2f')]=Campaign; \ No newline at end of file +var _0x041b=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x041b,0x83));var _0xb041=function(_0x3ea516,_0x345aae){_0x3ea516=_0x3ea516-0x0;var _0x2766bd=_0x041b[_0x3ea516];return _0x2766bd;};'use strict';function Campaign(_0x374cd1){this['id']=_0x374cd1['id']||0x0;this[_0xb041('0x0')]=_0x374cd1[_0xb041('0x0')]||'';this[_0xb041('0x1')]=_0x374cd1[_0xb041('0x1')]||_0xb041('0x2');this[_0xb041('0x3')]=0x0;this['temp']=0x0;this[_0xb041('0x4')]=0x0;this[_0xb041('0x5')]=0x0;this[_0xb041('0x6')]='';this[_0xb041('0x7')]=!![];this['active']=_0x374cd1[_0xb041('0x8')];this['limitCalls']=_0x374cd1['limitCalls'];this['dialTimezone']=_0x374cd1[_0xb041('0x9')]||null;this['dialGlobalInterval']=_0x374cd1['dialGlobalInterval']?_0x374cd1[_0xb041('0xa')]:null;this[_0xb041('0xb')]=_0x374cd1['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x374cd1['dialOriginateCallerIdNumber'];this[_0xb041('0xc')]=_0x374cd1['dialOriginateTimeout']||0x1e;this[_0xb041('0xd')]=_0x374cd1['dialCongestionMaxRetry'];this[_0xb041('0xe')]=_0x374cd1['dialCongestionRetryFrequency'];this[_0xb041('0xf')]=_0x374cd1[_0xb041('0xf')];this[_0xb041('0x10')]=_0x374cd1['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x374cd1[_0xb041('0x11')];this[_0xb041('0x12')]=_0x374cd1[_0xb041('0x12')];this['dialGlobalMaxRetry']=_0x374cd1[_0xb041('0x13')];this[_0xb041('0x14')]=_0x374cd1['dialNoSuchNumberMaxRetry']||0x3;this[_0xb041('0x15')]=_0x374cd1[_0xb041('0x15')]||0x96;this[_0xb041('0x16')]=_0x374cd1[_0xb041('0x16')]||0x3;this[_0xb041('0x17')]=_0x374cd1[_0xb041('0x17')]||0x96;this[_0xb041('0x18')]=_0x374cd1[_0xb041('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x374cd1[_0xb041('0x19')]||0x96;this['dialMachineMaxRetry']=_0x374cd1[_0xb041('0x1a')]||0x3;this[_0xb041('0x1b')]=_0x374cd1[_0xb041('0x1b')]||0x96;this[_0xb041('0x1c')]=_0x374cd1['dialAgentRejectMaxRetry']||0x3;this[_0xb041('0x1d')]=_0x374cd1['dialAgentRejectRetryFrequency']||0x96;this[_0xb041('0x1e')]=_0x374cd1[_0xb041('0x1e')]||_0xb041('0x1f');this[_0xb041('0x20')]=_0x374cd1['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x374cd1[_0xb041('0x21')]||undefined;this[_0xb041('0x22')]=_0x374cd1[_0xb041('0x22')]||undefined;this[_0xb041('0x23')]=_0x374cd1[_0xb041('0x23')]?_0x374cd1[_0xb041('0x23')]:undefined;this[_0xb041('0x24')]=_0x374cd1['Trunk']?_0x374cd1[_0xb041('0x24')]:undefined;this[_0xb041('0x25')]=_0x374cd1['Interval']?_0x374cd1['Interval']:undefined;this[_0xb041('0x26')]=_0x374cd1[_0xb041('0x26')]?_0x374cd1[_0xb041('0x26')]:undefined;this['dialQueueProject']=_0x374cd1[_0xb041('0x26')]?_0x374cd1[_0xb041('0x26')][_0xb041('0x0')]:undefined;this['dialAMDActive']=_0x374cd1[_0xb041('0x27')]||![];this[_0xb041('0x28')]=_0x374cd1['dialAMDInitialSilence'];this[_0xb041('0x29')]=_0x374cd1[_0xb041('0x29')];this[_0xb041('0x2a')]=_0x374cd1[_0xb041('0x2a')];this[_0xb041('0x2b')]=_0x374cd1[_0xb041('0x2b')];this[_0xb041('0x2c')]=_0x374cd1[_0xb041('0x2c')];this[_0xb041('0x2d')]=_0x374cd1[_0xb041('0x2d')];this[_0xb041('0x2e')]=_0x374cd1['dialAMDMaximumNumberOfWords'];this[_0xb041('0x2f')]=_0x374cd1[_0xb041('0x2f')];this['dialAMDMaximumWordLength']=_0x374cd1['dialAMDMaximumWordLength'];}module[_0xb041('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 51da1a7..4f3dd0a 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 _0xd1d3=['type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0xc6d5dd,_0x2eb327){var _0x210b72=function(_0x3871ba){while(--_0x3871ba){_0xc6d5dd['push'](_0xc6d5dd['shift']());}};_0x210b72(++_0x2eb327);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x47bced,_0x519f72){_0x47bced=_0x47bced-0x0;var _0xf80e30=_0xd1d3[_0x47bced];return _0xf80e30;};'use strict';function Channel(){this[_0x3d1d('0x0')]=null;this['channel']='';this[_0x3d1d('0x1')]='';this['calleridnum']=0x0;this[_0x3d1d('0x2')]='';this[_0x3d1d('0x3')]=undefined;this[_0x3d1d('0x4')]=undefined;this[_0x3d1d('0x5')]=0x0;this[_0x3d1d('0x6')]='';this['uniqueid']=0x0;this[_0x3d1d('0x7')]=0x0;this[_0x3d1d('0x8')]=0x0;this['answered']=![];this[_0x3d1d('0x9')]=null;this[_0x3d1d('0xa')]=null;this['unmanaged']=![];this[_0x3d1d('0xb')]=![];this[_0x3d1d('0xc')]='';this[_0x3d1d('0xd')]='';this[_0x3d1d('0xe')]=0x0;this[_0x3d1d('0xf')]=0x0;this[_0x3d1d('0x10')]=0x0;this[_0x3d1d('0x11')]=null;this[_0x3d1d('0x12')]=null;this[_0x3d1d('0x13')]=null;this[_0x3d1d('0x14')]=![];this[_0x3d1d('0x15')]=null;this[_0x3d1d('0x16')]=null;this[_0x3d1d('0x17')]=[];this[_0x3d1d('0x18')]=undefined;this[_0x3d1d('0x19')]=undefined;this[_0x3d1d('0x1a')]=undefined;this[_0x3d1d('0x1b')]=0x0;}module[_0x3d1d('0x1c')]=Channel; \ No newline at end of file +var _0x11c1=['starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports'];(function(_0x1384da,_0x1d7aaa){var _0x3ecfcc=function(_0x229d86){while(--_0x229d86){_0x1384da['push'](_0x1384da['shift']());}};_0x3ecfcc(++_0x1d7aaa);}(_0x11c1,0x1cb));var _0x111c=function(_0xbcbb7a,_0x5dc7ef){_0xbcbb7a=_0xbcbb7a-0x0;var _0x371aff=_0x11c1[_0xbcbb7a];return _0x371aff;};'use strict';function Channel(){this[_0x111c('0x0')]=null;this['channel']='';this[_0x111c('0x1')]='';this[_0x111c('0x2')]=0x0;this[_0x111c('0x3')]='';this[_0x111c('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x111c('0x5')]=0x0;this[_0x111c('0x6')]='';this[_0x111c('0x7')]=0x0;this[_0x111c('0x8')]=0x0;this[_0x111c('0x9')]=0x0;this[_0x111c('0xa')]=![];this['answertime']=null;this[_0x111c('0xb')]=null;this[_0x111c('0xc')]=![];this[_0x111c('0xd')]=![];this[_0x111c('0xe')]='';this[_0x111c('0xf')]='';this[_0x111c('0x10')]=0x0;this[_0x111c('0x11')]=0x0;this[_0x111c('0x12')]=0x0;this[_0x111c('0x13')]=null;this[_0x111c('0x14')]=null;this[_0x111c('0x15')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0x111c('0x16')]=undefined;this[_0x111c('0x17')]=undefined;this[_0x111c('0x18')]=undefined;this[_0x111c('0x19')]=0x0;}module[_0x111c('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index cd2bee7..210c545 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 _0x0805=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x51916e,_0x1c627e){var _0x450daf=function(_0x41e021){while(--_0x41e021){_0x51916e['push'](_0x51916e['shift']());}};_0x450daf(++_0x1c627e);}(_0x0805,0x125));var _0x5080=function(_0x23d8c3,_0x523ffc){_0x23d8c3=_0x23d8c3-0x0;var _0x2f6346=_0x0805[_0x23d8c3];return _0x2f6346;};'use strict';function DeskAccount(_0x43ea10){this['id']=_0x43ea10['id']||0x0;this[_0x5080('0x0')]=_0x43ea10['name']||'';this[_0x5080('0x1')]=_0x43ea10[_0x5080('0x1')]||'';this[_0x5080('0x2')]=_0x43ea10[_0x5080('0x2')]||'';this[_0x5080('0x3')]=_0x43ea10[_0x5080('0x3')]||'';this[_0x5080('0x4')]=_0x43ea10[_0x5080('0x4')]||'';this[_0x5080('0x5')]=_0x43ea10[_0x5080('0x5')]||'';this[_0x5080('0x6')]=_0x43ea10[_0x5080('0x6')]||'';this[_0x5080('0x7')]=_0x43ea10[_0x5080('0x7')]||'';this[_0x5080('0x8')]=_0x43ea10[_0x5080('0x8')]||'';this[_0x5080('0x9')]=_0x43ea10[_0x5080('0x9')]||'';this[_0x5080('0xa')]=_0x43ea10[_0x5080('0xa')]||'';this[_0x5080('0xb')]=_0x43ea10[_0x5080('0xb')]||{};}module[_0x5080('0xc')]=DeskAccount; \ No newline at end of file +var _0x6816=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x6816,0x81));var _0x6681=function(_0x59ef67,_0x8a9847){_0x59ef67=_0x59ef67-0x0;var _0x2ec2ce=_0x6816[_0x59ef67];return _0x2ec2ce;};'use strict';function DeskAccount(_0x677c2e){this['id']=_0x677c2e['id']||0x0;this['name']=_0x677c2e[_0x6681('0x0')]||'';this[_0x6681('0x1')]=_0x677c2e[_0x6681('0x1')]||'';this[_0x6681('0x2')]=_0x677c2e[_0x6681('0x2')]||'';this['authType']=_0x677c2e[_0x6681('0x3')]||'';this[_0x6681('0x4')]=_0x677c2e[_0x6681('0x4')]||'';this[_0x6681('0x5')]=_0x677c2e['consumerKey']||'';this[_0x6681('0x6')]=_0x677c2e[_0x6681('0x6')]||'';this[_0x6681('0x7')]=_0x677c2e[_0x6681('0x7')]||'';this['tokenSecret']=_0x677c2e[_0x6681('0x8')]||'';this[_0x6681('0x9')]=_0x677c2e['type']||'';this[_0x6681('0xa')]=_0x677c2e[_0x6681('0xa')]||'';this['Configurations']=_0x677c2e[_0x6681('0xb')]||{};}module[_0x6681('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d4c8cc5..9aa714b 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 _0xcb91=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x2eb77f,_0x24d486){var _0x31d4fd=function(_0x3057f2){while(--_0x3057f2){_0x2eb77f['push'](_0x2eb77f['shift']());}};_0x31d4fd(++_0x24d486);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xcb91[_0x15942a];return _0x36a9fb;};'use strict';function Dynamics365Account(_0x181cac){this['id']=_0x181cac['id']||0x0;this['name']=_0x181cac[_0x1cb9('0x0')]||'';this[_0x1cb9('0x1')]=_0x181cac[_0x1cb9('0x1')]||'';this[_0x1cb9('0x2')]=_0x181cac['password']||'';this[_0x1cb9('0x3')]=_0x181cac[_0x1cb9('0x3')]||'';this['tenantId']=_0x181cac[_0x1cb9('0x4')]||'';this[_0x1cb9('0x5')]=_0x181cac['clientId']||'';this[_0x1cb9('0x6')]=_0x181cac[_0x1cb9('0x6')]||{};this['serverUrl']=_0x181cac[_0x1cb9('0x7')]||'';this[_0x1cb9('0x8')]=_0x181cac['Configurations']||{};}module[_0x1cb9('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x5b02=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x11ff78,_0x2feab3){_0x11ff78=_0x11ff78-0x0;var _0x546dd5=_0x5b02[_0x11ff78];return _0x546dd5;};'use strict';function Dynamics365Account(_0x5d3c24){this['id']=_0x5d3c24['id']||0x0;this[_0x25b0('0x0')]=_0x5d3c24[_0x25b0('0x0')]||'';this[_0x25b0('0x1')]=_0x5d3c24['username']||'';this['password']=_0x5d3c24[_0x25b0('0x2')]||'';this['remoteUri']=_0x5d3c24[_0x25b0('0x3')]||'';this[_0x25b0('0x4')]=_0x5d3c24[_0x25b0('0x4')]||'';this[_0x25b0('0x5')]=_0x5d3c24[_0x25b0('0x5')]||'';this['clientSecret']=_0x5d3c24[_0x25b0('0x6')]||{};this[_0x25b0('0x7')]=_0x5d3c24['serverUrl']||'';this[_0x25b0('0x8')]=_0x5d3c24['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 59cfbe3..8f6b1f3 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 _0x5405=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x1a34b0,_0x1f8b34){var _0xa47a0a=function(_0x36c240){while(--_0x36c240){_0x1a34b0['push'](_0x1a34b0['shift']());}};_0xa47a0a(++_0x1f8b34);}(_0x5405,0xdb));var _0x5540=function(_0x46203d,_0x16f203){_0x46203d=_0x46203d-0x0;var _0x46998c=_0x5405[_0x46203d];return _0x46998c;};'use strict';function FaxAccount(_0x435566){this['id']=_0x435566['id']||0x0;this['name']=_0x435566[_0x5540('0x0')]||'';this['description']=_0x435566[_0x5540('0x1')];this[_0x5540('0x2')]=_0x435566[_0x5540('0x2')];this[_0x5540('0x3')]=_0x435566[_0x5540('0x3')];this[_0x5540('0x4')]=_0x435566[_0x5540('0x4')];this[_0x5540('0x5')]=_0x435566[_0x5540('0x5')]||0x960;this[_0x5540('0x6')]=_0x435566['maxrate']||0x3840;this[_0x5540('0x7')]=_0x435566[_0x5540('0x7')]||'v17,v27,v29';this[_0x5540('0x8')]=_0x435566[_0x5540('0x8')]||'no';this['faxdetect']=_0x435566[_0x5540('0x9')]||'no';this[_0x5540('0xa')]=_0x435566[_0x5540('0xa')]||0x1388;this[_0x5540('0xb')]=_0x435566[_0x5540('0xb')]||'SIP';this['Trunk']=_0x435566[_0x5540('0xc')]?_0x435566[_0x5540('0xc')]:undefined;this['ListId']=_0x435566[_0x5540('0xd')];this['key']=_0x435566[_0x5540('0xe')];}module[_0x5540('0xf')]=FaxAccount; \ No newline at end of file +var _0xfa9e=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','name','description','ecm','localstationid','minrate','maxrate'];(function(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0xfa9e,0x180));var _0xefa9=function(_0x27b50b,_0x5692b8){_0x27b50b=_0x27b50b-0x0;var _0x5a1909=_0xfa9e[_0x27b50b];return _0x5a1909;};'use strict';function FaxAccount(_0x31284b){this['id']=_0x31284b['id']||0x0;this[_0xefa9('0x0')]=_0x31284b['name']||'';this['description']=_0x31284b[_0xefa9('0x1')];this['ecm']=_0x31284b[_0xefa9('0x2')];this['headerinfo']=_0x31284b['headerinfo'];this[_0xefa9('0x3')]=_0x31284b[_0xefa9('0x3')];this['minrate']=_0x31284b[_0xefa9('0x4')]||0x960;this[_0xefa9('0x5')]=_0x31284b[_0xefa9('0x5')]||0x3840;this[_0xefa9('0x6')]=_0x31284b[_0xefa9('0x6')]||_0xefa9('0x7');this['gateway']=_0x31284b[_0xefa9('0x8')]||'no';this[_0xefa9('0x9')]=_0x31284b[_0xefa9('0x9')]||'no';this['t38timeout']=_0x31284b[_0xefa9('0xa')]||0x1388;this['tech']=_0x31284b['tech']||_0xefa9('0xb');this[_0xefa9('0xc')]=_0x31284b[_0xefa9('0xc')]?_0x31284b[_0xefa9('0xc')]:undefined;this[_0xefa9('0xd')]=_0x31284b[_0xefa9('0xd')];this[_0xefa9('0xe')]=_0x31284b['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 e01d539..a01ba74 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 _0x8c1d=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0x8c1d,0x133));var _0xd8c1=function(_0x300033,_0x2366ec){_0x300033=_0x300033-0x0;var _0x473513=_0x8c1d[_0x300033];return _0x473513;};'use strict';function FreshdeskAccount(_0x500bfb){this['id']=_0x500bfb['id']||0x0;this[_0xd8c1('0x0')]=_0x500bfb['name']||'';this[_0xd8c1('0x1')]=_0x500bfb[_0xd8c1('0x1')]||'';this['apiKey']=_0x500bfb[_0xd8c1('0x2')]||'';this[_0xd8c1('0x3')]=_0x500bfb[_0xd8c1('0x3')]||'';this[_0xd8c1('0x4')]=_0x500bfb[_0xd8c1('0x4')]||'';this[_0xd8c1('0x5')]=_0x500bfb[_0xd8c1('0x5')]||{};}module[_0xd8c1('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x055a=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xca4c0,_0x65722e){var _0x2737bd=function(_0x50d3ea){while(--_0x50d3ea){_0xca4c0['push'](_0xca4c0['shift']());}};_0x2737bd(++_0x65722e);}(_0x055a,0x13d));var _0xa055=function(_0x2d1ff6,_0x182530){_0x2d1ff6=_0x2d1ff6-0x0;var _0x2f1298=_0x055a[_0x2d1ff6];return _0x2f1298;};'use strict';function FreshdeskAccount(_0x4538e3){this['id']=_0x4538e3['id']||0x0;this['name']=_0x4538e3[_0xa055('0x0')]||'';this[_0xa055('0x1')]=_0x4538e3[_0xa055('0x1')]||'';this[_0xa055('0x2')]=_0x4538e3[_0xa055('0x3')]||'';this['remoteUri']=_0x4538e3[_0xa055('0x4')]||'';this[_0xa055('0x5')]=_0x4538e3[_0xa055('0x5')]||'';this[_0xa055('0x6')]=_0x4538e3[_0xa055('0x6')]||{};}module[_0xa055('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7819194..3b797ef 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 _0x004c=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x004c,0x85));var _0xc004=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x004c[_0x2db12b];return _0x20990b;};'use strict';function FreshsalesAccount(_0x283f67){this['id']=_0x283f67['id']||0x0;this[_0xc004('0x0')]=_0x283f67[_0xc004('0x0')]||'';this[_0xc004('0x1')]=_0x283f67['username']||'';this[_0xc004('0x2')]=_0x283f67[_0xc004('0x3')]||'';this[_0xc004('0x4')]=_0x283f67[_0xc004('0x4')]||'';this['serverUrl']=_0x283f67[_0xc004('0x5')]||'';this['Configurations']=_0x283f67[_0xc004('0x6')]||{};}module[_0xc004('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x10af=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0x10af,0xfc));var _0xf10a=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x10af[_0x38ced4];return _0x547c07;};'use strict';function FreshsalesAccount(_0x278c56){this['id']=_0x278c56['id']||0x0;this['name']=_0x278c56[_0xf10a('0x0')]||'';this[_0xf10a('0x1')]=_0x278c56[_0xf10a('0x1')]||'';this[_0xf10a('0x2')]=_0x278c56[_0xf10a('0x3')]||'';this[_0xf10a('0x4')]=_0x278c56[_0xf10a('0x4')]||'';this[_0xf10a('0x5')]=_0x278c56['serverUrl']||'';this[_0xf10a('0x6')]=_0x278c56[_0xf10a('0x6')]||{};}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 b1b4e01..5041544 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 _0xd240=['queuecallerabandon','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','type','inbound','calleridnum','queue','queuecallerleaveAt','count'];(function(_0x3ba1b7,_0x17fcf7){var _0x48d864=function(_0x10b61a){while(--_0x10b61a){_0x3ba1b7['push'](_0x3ba1b7['shift']());}};_0x48d864(++_0x17fcf7);}(_0xd240,0x112));var _0x0d24=function(_0x52b0e7,_0x5863bc){_0x52b0e7=_0x52b0e7-0x0;var _0x12db44=_0xd240[_0x52b0e7];return _0x12db44;};'use strict';function QueueReport(){this[_0x0d24('0x0')]=_0x0d24('0x1');this['uniqueid']='';this[_0x0d24('0x2')]='';this['calleridname']='';this[_0x0d24('0x3')]='';this['queuecallerjoinAt']=null;this[_0x0d24('0x4')]=null;this['position']=0x1;this[_0x0d24('0x5')]=0x1;this[_0x0d24('0x6')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x0d24('0x7')]=null;this[_0x0d24('0x8')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x0d24('0x9')]='';this[_0x0d24('0xa')]='';this['connectedlinename']='';this[_0x0d24('0xb')]='';this['context']='';this[_0x0d24('0xc')]='';this[_0x0d24('0xd')]='';this[_0x0d24('0xe')]=0x0;this[_0x0d24('0xf')]=![];this[_0x0d24('0x10')]='';this[_0x0d24('0x11')]=_0x0d24('0x12');this[_0x0d24('0x13')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xe10b=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt'];(function(_0xc6299d,_0x4e893e){var _0x278de4=function(_0xe71f61){while(--_0xe71f61){_0xc6299d['push'](_0xc6299d['shift']());}};_0x278de4(++_0x4e893e);}(_0xe10b,0xa2));var _0xbe10=function(_0x51c729,_0x245095){_0x51c729=_0x51c729-0x0;var _0x375d3a=_0xe10b[_0x51c729];return _0x375d3a;};'use strict';function QueueReport(){this[_0xbe10('0x0')]=_0xbe10('0x1');this[_0xbe10('0x2')]='';this[_0xbe10('0x3')]='';this['calleridname']='';this[_0xbe10('0x4')]='';this[_0xbe10('0x5')]=null;this[_0xbe10('0x6')]=null;this[_0xbe10('0x7')]=0x1;this[_0xbe10('0x8')]=0x1;this[_0xbe10('0x9')]=![];this[_0xbe10('0xa')]=null;this[_0xbe10('0xb')]=![];this[_0xbe10('0xc')]=null;this[_0xbe10('0xd')]=![];this[_0xbe10('0xe')]=null;this[_0xbe10('0xf')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xbe10('0x10')]='';this['accountcode']='';this['context']='';this['exten']='';this['priority']='';this['holdtime']=0x0;this[_0xbe10('0x11')]=![];this[_0xbe10('0x12')]='';this[_0xbe10('0x13')]=_0xbe10('0x14');this[_0xbe10('0x15')]=0x0;this[_0xbe10('0x16')]={};}module[_0xbe10('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 015a960..3e47fa0 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 _0xbd3a=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x55a777,_0x2c95f7){var _0x8ca6a1=function(_0x3cc973){while(--_0x3cc973){_0x55a777['push'](_0x55a777['shift']());}};_0x8ca6a1(++_0x2c95f7);}(_0xbd3a,0xb9));var _0xabd3=function(_0x357457,_0x29ddf5){_0x357457=_0x357457-0x0;var _0x7c124=_0xbd3a[_0x357457];return _0x7c124;};'use strict';function SalesforceAccount(_0x22f398){this['id']=_0x22f398['id']||0x0;this[_0xabd3('0x0')]=_0x22f398[_0xabd3('0x0')]||'';this[_0xabd3('0x1')]=_0x22f398['username']||'';this[_0xabd3('0x2')]=_0x22f398['remoteUri']||'';this[_0xabd3('0x3')]=_0x22f398['password']||'';this['clientId']=_0x22f398[_0xabd3('0x4')]||'';this['clientSecret']=_0x22f398[_0xabd3('0x5')]||'';this[_0xabd3('0x6')]=_0x22f398[_0xabd3('0x6')]||'';this[_0xabd3('0x7')]=_0x22f398[_0xabd3('0x7')]||_0xabd3('0x8');this[_0xabd3('0x9')]=_0x22f398[_0xabd3('0x9')]||'';this[_0xabd3('0xa')]=_0x22f398[_0xabd3('0xa')]||{};}module[_0xabd3('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xf333=['clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf333,0x1d4));var _0x3f33=function(_0x2b357f,_0x1c39c5){_0x2b357f=_0x2b357f-0x0;var _0x259eae=_0xf333[_0x2b357f];return _0x259eae;};'use strict';function SalesforceAccount(_0x18ca4d){this['id']=_0x18ca4d['id']||0x0;this[_0x3f33('0x0')]=_0x18ca4d[_0x3f33('0x0')]||'';this['username']=_0x18ca4d[_0x3f33('0x1')]||'';this['remoteUri']=_0x18ca4d[_0x3f33('0x2')]||'';this[_0x3f33('0x3')]=_0x18ca4d['password']||'';this[_0x3f33('0x4')]=_0x18ca4d[_0x3f33('0x4')]||'';this[_0x3f33('0x5')]=_0x18ca4d[_0x3f33('0x5')]||'';this[_0x3f33('0x6')]=_0x18ca4d['securityToken']||'';this[_0x3f33('0x7')]=_0x18ca4d[_0x3f33('0x7')]||'integrationTab';this[_0x3f33('0x8')]=_0x18ca4d['serverUrl']||'';this[_0x3f33('0x9')]=_0x18ca4d[_0x3f33('0x9')]||{};}module[_0x3f33('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 1dfbfb1..b5c1e44 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 _0x9a77=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x300cdb,_0x88b46){var _0x54e47f=function(_0x227c6e){while(--_0x227c6e){_0x300cdb['push'](_0x300cdb['shift']());}};_0x54e47f(++_0x88b46);}(_0x9a77,0x66));var _0x79a7=function(_0x231cfa,_0x3e6790){_0x231cfa=_0x231cfa-0x0;var _0x4ff6fb=_0x9a77[_0x231cfa];return _0x4ff6fb;};'use strict';function ServicenowAccount(_0x582276){this['id']=_0x582276['id']||0x0;this['name']=_0x582276[_0x79a7('0x0')]||'';this[_0x79a7('0x1')]=_0x582276['username']||'';this[_0x79a7('0x2')]=_0x582276['password']||'';this['remoteUri']=_0x582276[_0x79a7('0x3')]||'';this[_0x79a7('0x4')]=_0x582276['serverUrl']||'';this[_0x79a7('0x5')]=_0x582276[_0x79a7('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xa1e4=['name','username','password','remoteUri','Configurations','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa1e4,0x150));var _0x4a1e=function(_0x310dc2,_0x2299c4){_0x310dc2=_0x310dc2-0x0;var _0x24980f=_0xa1e4[_0x310dc2];return _0x24980f;};'use strict';function ServicenowAccount(_0x4b094d){this['id']=_0x4b094d['id']||0x0;this['name']=_0x4b094d[_0x4a1e('0x0')]||'';this['username']=_0x4b094d[_0x4a1e('0x1')]||'';this[_0x4a1e('0x2')]=_0x4b094d[_0x4a1e('0x2')]||'';this[_0x4a1e('0x3')]=_0x4b094d[_0x4a1e('0x3')]||'';this['serverUrl']=_0x4b094d['serverUrl']||'';this['Configurations']=_0x4b094d[_0x4a1e('0x4')]||{};}module[_0x4a1e('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index ba19520..ff86367 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 _0x6895=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x31de25,_0xe606c5){var _0x2b8196=function(_0x23e5c4){while(--_0x23e5c4){_0x31de25['push'](_0x31de25['shift']());}};_0x2b8196(++_0xe606c5);}(_0x6895,0xe8));var _0x5689=function(_0x50c819,_0x3b891c){_0x50c819=_0x50c819-0x0;var _0x2a8b80=_0x6895[_0x50c819];return _0x2a8b80;};'use strict';function SugarcrmAccount(_0x4adae0){this['id']=_0x4adae0['id']||0x0;this[_0x5689('0x0')]=_0x4adae0[_0x5689('0x0')]||'';this[_0x5689('0x1')]=_0x4adae0[_0x5689('0x1')]||'';this['password']=_0x4adae0[_0x5689('0x2')]||'';this[_0x5689('0x3')]=_0x4adae0[_0x5689('0x3')]||'';this['serverUrl']=_0x4adae0[_0x5689('0x4')]||'';this['Configurations']=_0x4adae0[_0x5689('0x5')]||{};}module[_0x5689('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8fe1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a94b2,_0x2ab9fd){var _0x1dc133=function(_0x463716){while(--_0x463716){_0x2a94b2['push'](_0x2a94b2['shift']());}};_0x1dc133(++_0x2ab9fd);}(_0x8fe1,0x195));var _0x18fe=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x8fe1[_0x4cbf20];return _0x582ae4;};'use strict';function SugarcrmAccount(_0x61b24f){this['id']=_0x61b24f['id']||0x0;this[_0x18fe('0x0')]=_0x61b24f[_0x18fe('0x0')]||'';this[_0x18fe('0x1')]=_0x61b24f[_0x18fe('0x1')]||'';this[_0x18fe('0x2')]=_0x61b24f[_0x18fe('0x2')]||'';this[_0x18fe('0x3')]=_0x61b24f[_0x18fe('0x3')]||'';this[_0x18fe('0x4')]=_0x61b24f[_0x18fe('0x4')]||'';this[_0x18fe('0x5')]=_0x61b24f[_0x18fe('0x5')]||{};}module[_0x18fe('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 4a56c49..c2b4c21 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 _0xa02f=['address','exports','name','accountcode','unknown','status'];(function(_0x18446a,_0x29338f){var _0x595402=function(_0x454f3b){while(--_0x454f3b){_0x18446a['push'](_0x18446a['shift']());}};_0x595402(++_0x29338f);}(_0xa02f,0xce));var _0xfa02=function(_0x50d90d,_0x1a10d2){_0x50d90d=_0x50d90d-0x0;var _0x11418e=_0xa02f[_0x50d90d];return _0x11418e;};'use strict';function Telephone(_0x1ea5ca){this['id']=_0x1ea5ca['id']||0x0;this[_0xfa02('0x0')]=_0x1ea5ca[_0xfa02('0x0')]||'';this[_0xfa02('0x1')]=_0x1ea5ca[_0xfa02('0x1')]||'';this['state']=_0xfa02('0x2');this['stateTime']=0x0;this[_0xfa02('0x3')]=_0xfa02('0x2');this[_0xfa02('0x4')]='';}module[_0xfa02('0x5')]=Telephone; \ No newline at end of file +var _0x6da1=['accountcode','state','stateTime','status','address','exports','name'];(function(_0x4174bf,_0x2dc30b){var _0x2d406d=function(_0x4997f7){while(--_0x4997f7){_0x4174bf['push'](_0x4174bf['shift']());}};_0x2d406d(++_0x2dc30b);}(_0x6da1,0x1b8));var _0x16da=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x6da1[_0x134192];return _0x3cd080;};'use strict';function Telephone(_0x244702){this['id']=_0x244702['id']||0x0;this[_0x16da('0x0')]=_0x244702['name']||'';this[_0x16da('0x1')]=_0x244702[_0x16da('0x1')]||'';this[_0x16da('0x2')]='unknown';this[_0x16da('0x3')]=0x0;this[_0x16da('0x4')]='unknown';this[_0x16da('0x5')]='';}module[_0x16da('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4ca7fcf..c007756 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(_0x50a762,_0x1690d7){var _0x36bcc3=function(_0x812f58){while(--_0x812f58){_0x50a762['push'](_0x50a762['shift']());}};_0x36bcc3(++_0x1690d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x4c06bd,_0x44af98){var _0x3ed724=function(_0x36caf0){while(--_0x36caf0){_0x4c06bd['push'](_0x4c06bd['shift']());}};_0x3ed724(++_0x44af98);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c27b6,_0x2192cb){_0x3c27b6=_0x3c27b6-0x0;var _0x2a5f55=_0xb10b[_0x3c27b6];return _0x2a5f55;};'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 d1876f4..169f845 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x2e8546,_0x3c2d91){var _0x5afa62=function(_0x537e92){while(--_0x537e92){_0x2e8546['push'](_0x2e8546['shift']());}};_0x5afa62(++_0x3c2d91);}(_0xb10b,0x12a));var _0xbb10=function(_0x114adc,_0x1b1c55){_0x114adc=_0x114adc-0x0;var _0x19199a=_0xb10b[_0x114adc];return _0x19199a;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x132107,_0x40d4fc){var _0x28ecdf=function(_0x50ebb6){while(--_0x50ebb6){_0x132107['push'](_0x132107['shift']());}};_0x28ecdf(++_0x40d4fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'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 9b4e022..42368f7 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 _0xc9b8=['name','state','stateTime','status','unknown','registry','split','host','port','refresh','stateRegistry','registrationtime','address','defaultuser','active'];(function(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0xc9b8,0x77));var _0x8c9b=function(_0x2fd703,_0x9b9a59){_0x2fd703=_0x2fd703-0x0;var _0x52e6f2=_0xc9b8[_0x2fd703];return _0x52e6f2;};'use strict';function Trunk(_0x3b26e4){this['id']=_0x3b26e4['id']||0x0;this[_0x8c9b('0x0')]=_0x3b26e4['active']||![];this[_0x8c9b('0x1')]=_0x3b26e4[_0x8c9b('0x1')]||'';this[_0x8c9b('0x2')]='unknown';this[_0x8c9b('0x3')]=0x0;this[_0x8c9b('0x4')]=_0x8c9b('0x5');this[_0x8c9b('0x6')]=_0x3b26e4[_0x8c9b('0x6')]&&_0x3b26e4['registry']['indexOf'](':')?_0x3b26e4['registry'][_0x8c9b('0x7')](':')[0x0]:'';this[_0x8c9b('0x8')]='';this[_0x8c9b('0x9')]='';this['domain']='';this['domainport']='';this[_0x8c9b('0xa')]='';this[_0x8c9b('0xb')]=_0x8c9b('0x5');this[_0x8c9b('0xc')]='';this[_0x8c9b('0xd')]='';this['defaultuser']=_0x3b26e4[_0x8c9b('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x6142=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','stateTime','unknown','registry','indexOf','split','host','port'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6142,0x14b));var _0x2614=function(_0x41dff7,_0x39b771){_0x41dff7=_0x41dff7-0x0;var _0x534734=_0x6142[_0x41dff7];return _0x534734;};'use strict';function Trunk(_0x3c6d31){this['id']=_0x3c6d31['id']||0x0;this[_0x2614('0x0')]=_0x3c6d31[_0x2614('0x0')]||![];this[_0x2614('0x1')]=_0x3c6d31[_0x2614('0x1')]||'';this['state']='unknown';this[_0x2614('0x2')]=0x0;this['status']=_0x2614('0x3');this[_0x2614('0x4')]=_0x3c6d31['registry']&&_0x3c6d31['registry'][_0x2614('0x5')](':')?_0x3c6d31[_0x2614('0x4')][_0x2614('0x6')](':')[0x0]:'';this[_0x2614('0x7')]='';this[_0x2614('0x8')]='';this[_0x2614('0x9')]='';this[_0x2614('0xa')]='';this[_0x2614('0xb')]='';this[_0x2614('0xc')]=_0x2614('0x3');this[_0x2614('0xd')]='';this[_0x2614('0xe')]='';this[_0x2614('0xf')]=_0x3c6d31[_0x2614('0xf')]||'';}module[_0x2614('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8619b47..bd7a409 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 _0xf7cf=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x20d290,_0x40fc11){var _0x2bfa8f=function(_0x2498e0){while(--_0x2498e0){_0x20d290['push'](_0x20d290['shift']());}};_0x2bfa8f(++_0x40fc11);}(_0xf7cf,0x1db));var _0xff7c=function(_0x58ab58,_0x486c25){_0x58ab58=_0x58ab58-0x0;var _0x5c41d9=_0xf7cf[_0x58ab58];return _0x5c41d9;};'use strict';function voiceExtension(_0x7ddeb1){this['id']=_0x7ddeb1['id']||0x0;this[_0xff7c('0x0')]=_0x7ddeb1[_0xff7c('0x0')]||'';this[_0xff7c('0x1')]=_0x7ddeb1[_0xff7c('0x1')]||_0xff7c('0x2');this['mandatoryDisposition']=_0x7ddeb1[_0xff7c('0x3')]||![];}module[_0xff7c('0x4')]=voiceExtension; \ No newline at end of file +var _0x000b=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x1627ec,_0x81809){var _0x5b4aa9=function(_0x4fd057){while(--_0x4fd057){_0x1627ec['push'](_0x1627ec['shift']());}};_0x5b4aa9(++_0x81809);}(_0x000b,0x1d7));var _0xb000=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x000b[_0x8e9386];return _0x4abf26;};'use strict';function voiceExtension(_0x1a6b82){this['id']=_0x1a6b82['id']||0x0;this[_0xb000('0x0')]=_0x1a6b82[_0xb000('0x0')]||'';this[_0xb000('0x1')]=_0x1a6b82['recordingFormat']||_0xb000('0x2');this['mandatoryDisposition']=_0x1a6b82[_0xb000('0x3')]||![];}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 2619334..c1ce62f 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 _0x6fa5=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp'];(function(_0x3c11c7,_0x457553){var _0x5be7dd=function(_0x2912af){while(--_0x2912af){_0x3c11c7['push'](_0x3c11c7['shift']());}};_0x5be7dd(++_0x457553);}(_0x6fa5,0x1d6));var _0x56fa=function(_0x36d508,_0x27cc01){_0x36d508=_0x36d508-0x0;var _0x5501f2=_0x6fa5[_0x36d508];return _0x5501f2;};'use strict';var statusDesc=[_0x56fa('0x0'),_0x56fa('0x1'),'inuse',_0x56fa('0x2'),_0x56fa('0x3'),'unavailable',_0x56fa('0x4'),_0x56fa('0x5'),_0x56fa('0x6')];var monitorFormat={'wav':_0x56fa('0x7'),'wav49':_0x56fa('0x8'),'gsm':_0x56fa('0x9')};var strategy={'rrmemory':_0x56fa('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4025e1){this['id']=_0x4025e1['id']||0x0;this[_0x56fa('0xb')]=_0x4025e1[_0x56fa('0xb')]||'';this[_0x56fa('0xc')]=_0x4025e1['monitor_format']||'';this[_0x56fa('0xd')]=_0x4025e1[_0x56fa('0xd')]||_0x56fa('0xe');this['waiting']=0x0;this['talking']=0x0;this[_0x56fa('0xf')]=0x0;this[_0x56fa('0x10')]=0x0;this[_0x56fa('0x11')]=0x0;this[_0x56fa('0x12')]=0x0;this[_0x56fa('0x13')]=0x0;this[_0x56fa('0x14')]=0x0;this[_0x56fa('0x15')]=0x0;this[_0x56fa('0x16')]=0x0;this['available']=0x0;this[_0x56fa('0x17')]=_0x4025e1['acw']||![];this['acwTimeout']=_0x4025e1[_0x56fa('0x18')]||0xa;this[_0x56fa('0x19')]=_0x4025e1[_0x56fa('0x19')]||'no';this[_0x56fa('0x1a')]=!![];this[_0x56fa('0x1b')]='';this[_0x56fa('0x1c')]=0x0;this[_0x56fa('0x1d')]=0x0;this['dialTimezone']=_0x4025e1[_0x56fa('0x1e')]||null;this['dialGlobalInterval']=_0x4025e1[_0x56fa('0x1f')]?_0x4025e1['dialGlobalInterval']:null;this['dialActive']=_0x4025e1[_0x56fa('0x20')];this[_0x56fa('0x21')]=_0x4025e1[_0x56fa('0x21')]||_0x56fa('0x22');this[_0x56fa('0x23')]=_0x4025e1[_0x56fa('0x23')]||0x0;this['dialLimitQueue']=_0x4025e1[_0x56fa('0x24')]||0x0;this[_0x56fa('0x25')]=_0x4025e1['dialPowerLevel']||0x1;this[_0x56fa('0x26')]=_0x4025e1['dialPredictiveOptimization']||_0x56fa('0x27');this[_0x56fa('0x28')]=_0x4025e1[_0x56fa('0x28')]||0.03;this[_0x56fa('0x29')]=_0x4025e1[_0x56fa('0x29')]||0x258;this[_0x56fa('0x2a')]=_0x4025e1['dialOriginateCallerIdName']||_0x56fa('0x2b');this[_0x56fa('0x2c')]=_0x4025e1['dialOriginateCallerIdNumber']||_0x56fa('0x2b');this['dialOriginateTimeout']=_0x4025e1[_0x56fa('0x2d')]||0x1e;this[_0x56fa('0x2e')]=_0x4025e1[_0x56fa('0x2e')]||'tTxX';this['dialQueueTimeout']=_0x4025e1[_0x56fa('0x2f')]||0x3;this[_0x56fa('0x30')]=_0x4025e1[_0x56fa('0x30')]||undefined;this[_0x56fa('0x31')]=_0x4025e1[_0x56fa('0x31')]||0x3;this[_0x56fa('0x32')]=_0x4025e1[_0x56fa('0x32')]||0x96;this[_0x56fa('0x33')]=_0x4025e1[_0x56fa('0x33')]||0x3;this[_0x56fa('0x34')]=_0x4025e1['dialBusyRetryFrequency']||0x96;this[_0x56fa('0x35')]=_0x4025e1[_0x56fa('0x35')]||0x3;this[_0x56fa('0x36')]=_0x4025e1[_0x56fa('0x36')]||0x96;this[_0x56fa('0x37')]=_0x4025e1['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4025e1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x56fa('0x38')]=_0x4025e1[_0x56fa('0x38')]||0x3;this['dialDropRetryFrequency']=_0x4025e1['dialDropRetryFrequency']||0x96;this[_0x56fa('0x39')]=_0x4025e1[_0x56fa('0x39')]||0x3;this[_0x56fa('0x3a')]=_0x4025e1[_0x56fa('0x3a')]||0x96;this[_0x56fa('0x3b')]=_0x4025e1[_0x56fa('0x3b')]||0x3;this[_0x56fa('0x3c')]=_0x4025e1['dialMachineRetryFrequency']||0x96;this[_0x56fa('0x3d')]=_0x4025e1[_0x56fa('0x3d')]||0x3;this[_0x56fa('0x3e')]=_0x4025e1[_0x56fa('0x3e')]||0x96;this[_0x56fa('0x3f')]=_0x4025e1[_0x56fa('0x3f')]||0x4;this['Trunk']=_0x4025e1[_0x56fa('0x40')]?_0x4025e1[_0x56fa('0x40')]:undefined;this[_0x56fa('0x41')]=_0x4025e1['TrunkBackup']?_0x4025e1[_0x56fa('0x41')]:undefined;this[_0x56fa('0x42')]=_0x4025e1[_0x56fa('0x42')]||undefined;this[_0x56fa('0x43')]=_0x4025e1['Interval']?_0x4025e1[_0x56fa('0x43')]:undefined;this[_0x56fa('0x44')]=_0x4025e1['dialOrderByScheduledAt']||_0x56fa('0x45');this[_0x56fa('0x46')]=_0x4025e1[_0x56fa('0x46')]||undefined;this[_0x56fa('0x47')]=_0x4025e1['dialCutDigit']||undefined;this['strategy']=strategy[_0x4025e1[_0x56fa('0x48')]]||_0x56fa('0xa');this[_0x56fa('0x49')]=!![];this[_0x56fa('0x4a')]=_0x4025e1[_0x56fa('0x4a')]||![];this[_0x56fa('0x4b')]=_0x4025e1['dialAMDInitialSilence'];this[_0x56fa('0x4c')]=_0x4025e1[_0x56fa('0x4c')];this[_0x56fa('0x4d')]=_0x4025e1[_0x56fa('0x4d')];this[_0x56fa('0x4e')]=_0x4025e1['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4025e1[_0x56fa('0x4f')];this['dialAMDBetweenWordsSilence']=_0x4025e1[_0x56fa('0x50')];this[_0x56fa('0x51')]=_0x4025e1['dialAMDMaximumNumberOfWords'];this[_0x56fa('0x52')]=_0x4025e1['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x4025e1[_0x56fa('0x53')];this[_0x56fa('0x54')]=0x0;this[_0x56fa('0x55')]=0x0;this[_0x56fa('0x56')]=_0x4025e1['timeout'];this[_0x56fa('0x57')]=0x0;this[_0x56fa('0x58')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x56fa('0x59')]=0x0;this[_0x56fa('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x56fa('0x5b')]=0x0;this[_0x56fa('0x5c')]=0x0;this[_0x56fa('0x5d')]=0x0;this[_0x56fa('0x5e')]=0x0;this[_0x56fa('0x5f')]=0x0;this[_0x56fa('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0x56fa('0x61')]=0x0;this[_0x56fa('0x62')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x56fa('0x63')]=1.05;this[_0x56fa('0x64')]=0x0;this[_0x56fa('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x56fa('0x66')]=0x0;this[_0x56fa('0x67')]=0x0;this[_0x56fa('0x68')]=0x0;this[_0x56fa('0x69')]=0x0;this[_0x56fa('0x6a')]=0x0;this[_0x56fa('0x6b')]=_0x4025e1[_0x56fa('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x4025e1[_0x56fa('0x6c')]||0xa;this[_0x56fa('0x6d')]=0x0;this[_0x56fa('0x6e')]=0x0;this[_0x56fa('0x6f')]=0x1;this[_0x56fa('0x70')]=0x0;this[_0x56fa('0x71')]=0x0;this[_0x56fa('0x72')]=0x0;this[_0x56fa('0x73')]=0x0;this[_0x56fa('0x74')]=_0x4025e1[_0x56fa('0x74')]||0x1e;this[_0x56fa('0x75')]=_0x4025e1[_0x56fa('0x75')]||![];this[_0x56fa('0x76')]=!!_0x4025e1[_0x56fa('0x76')]||![];this[_0x56fa('0x77')]=_0x4025e1[_0x56fa('0x77')]||undefined;this[_0x56fa('0x78')]=_0x4025e1[_0x56fa('0x78')]||![];this[_0x56fa('0x79')]=_0x4025e1[_0x56fa('0x79')]||![];this[_0x56fa('0xc')]=monitorFormat[_0x4025e1['monitor_format']]?monitorFormat[_0x4025e1[_0x56fa('0xc')]]:undefined;this[_0x56fa('0x7a')]=_0x4025e1[_0x56fa('0x7a')]||![];this[_0x56fa('0x7b')]=_0x4025e1[_0x56fa('0x7b')]?_0x4025e1['mandatoryDispositionPause']:undefined;}module[_0x56fa('0x7c')]=VoiceQueue; \ No newline at end of file +var _0x3ddd=['dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','loggedIn','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x188945,_0x2aafa5){var _0x4959c2=function(_0x534f43){while(--_0x534f43){_0x188945['push'](_0x188945['shift']());}};_0x4959c2(++_0x2aafa5);}(_0x3ddd,0x18b));var _0xd3dd=function(_0x40cd23,_0x792542){_0x40cd23=_0x40cd23-0x0;var _0x54d006=_0x3ddd[_0x40cd23];return _0x54d006;};'use strict';var statusDesc=[_0xd3dd('0x0'),_0xd3dd('0x1'),_0xd3dd('0x2'),_0xd3dd('0x3'),_0xd3dd('0x4'),_0xd3dd('0x5'),_0xd3dd('0x6'),_0xd3dd('0x7'),_0xd3dd('0x8')];var monitorFormat={'wav':_0xd3dd('0x9'),'wav49':'wav49','gsm':_0xd3dd('0xa')};var strategy={'rrmemory':_0xd3dd('0xb'),'roundrobin':_0xd3dd('0xc')};function VoiceQueue(_0x5827aa){this['id']=_0x5827aa['id']||0x0;this[_0xd3dd('0xd')]=_0x5827aa[_0xd3dd('0xd')]||'';this[_0xd3dd('0xe')]=_0x5827aa['monitor_format']||'';this[_0xd3dd('0xf')]=_0x5827aa[_0xd3dd('0xf')]||_0xd3dd('0x10');this[_0xd3dd('0x11')]=0x0;this[_0xd3dd('0x12')]=0x0;this['total']=0x0;this[_0xd3dd('0x13')]=0x0;this[_0xd3dd('0x14')]=0x0;this[_0xd3dd('0x15')]=0x0;this[_0xd3dd('0x16')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xd3dd('0x17')]=0x0;this[_0xd3dd('0x18')]=0x0;this[_0xd3dd('0x19')]=_0x5827aa[_0xd3dd('0x19')]||![];this[_0xd3dd('0x1a')]=_0x5827aa[_0xd3dd('0x1a')]||0xa;this['autopause']=_0x5827aa[_0xd3dd('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0xd3dd('0x1c')]='';this['originated']=0x0;this[_0xd3dd('0x1d')]=0x0;this[_0xd3dd('0x1e')]=_0x5827aa[_0xd3dd('0x1e')]||null;this[_0xd3dd('0x1f')]=_0x5827aa[_0xd3dd('0x1f')]?_0x5827aa[_0xd3dd('0x1f')]:null;this[_0xd3dd('0x20')]=_0x5827aa['dialActive'];this[_0xd3dd('0x21')]=_0x5827aa[_0xd3dd('0x21')]||_0xd3dd('0x22');this[_0xd3dd('0x23')]=_0x5827aa[_0xd3dd('0x23')]||0x0;this[_0xd3dd('0x24')]=_0x5827aa['dialLimitQueue']||0x0;this[_0xd3dd('0x25')]=_0x5827aa['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x5827aa[_0xd3dd('0x26')]||_0xd3dd('0x27');this[_0xd3dd('0x28')]=_0x5827aa[_0xd3dd('0x28')]||0.03;this['dialPredictiveInterval']=_0x5827aa[_0xd3dd('0x29')]||0x258;this[_0xd3dd('0x2a')]=_0x5827aa[_0xd3dd('0x2a')]||'anonymous';this[_0xd3dd('0x2b')]=_0x5827aa[_0xd3dd('0x2b')]||'anonymous';this['dialOriginateTimeout']=_0x5827aa[_0xd3dd('0x2c')]||0x1e;this[_0xd3dd('0x2d')]=_0x5827aa['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x5827aa[_0xd3dd('0x2e')]||0x3;this[_0xd3dd('0x2f')]=_0x5827aa[_0xd3dd('0x2f')]||undefined;this[_0xd3dd('0x30')]=_0x5827aa[_0xd3dd('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x5827aa[_0xd3dd('0x31')]||0x96;this[_0xd3dd('0x32')]=_0x5827aa[_0xd3dd('0x32')]||0x3;this[_0xd3dd('0x33')]=_0x5827aa[_0xd3dd('0x33')]||0x96;this[_0xd3dd('0x34')]=_0x5827aa['dialNoAnswerMaxRetry']||0x3;this[_0xd3dd('0x35')]=_0x5827aa[_0xd3dd('0x35')]||0x96;this[_0xd3dd('0x36')]=_0x5827aa[_0xd3dd('0x36')]||0x3;this[_0xd3dd('0x37')]=_0x5827aa['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x5827aa['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x5827aa[_0xd3dd('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x5827aa[_0xd3dd('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x5827aa[_0xd3dd('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x5827aa[_0xd3dd('0x3b')]||0x3;this[_0xd3dd('0x3c')]=_0x5827aa['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x5827aa[_0xd3dd('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5827aa[_0xd3dd('0x3e')]||0x96;this['dialGlobalMaxRetry']=_0x5827aa[_0xd3dd('0x3f')]||0x4;this[_0xd3dd('0x40')]=_0x5827aa[_0xd3dd('0x40')]?_0x5827aa[_0xd3dd('0x40')]:undefined;this[_0xd3dd('0x41')]=_0x5827aa[_0xd3dd('0x41')]?_0x5827aa[_0xd3dd('0x41')]:undefined;this[_0xd3dd('0x42')]=_0x5827aa['dialPrefix']||undefined;this[_0xd3dd('0x43')]=_0x5827aa[_0xd3dd('0x43')]?_0x5827aa[_0xd3dd('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x5827aa[_0xd3dd('0x44')]||_0xd3dd('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x5827aa[_0xd3dd('0x46')]||undefined;this[_0xd3dd('0x47')]=_0x5827aa[_0xd3dd('0x47')]||undefined;this[_0xd3dd('0x48')]=strategy[_0x5827aa['strategy']]||_0xd3dd('0xb');this[_0xd3dd('0x49')]=!![];this[_0xd3dd('0x4a')]=_0x5827aa[_0xd3dd('0x4a')]||![];this['dialAMDInitialSilence']=_0x5827aa['dialAMDInitialSilence'];this[_0xd3dd('0x4b')]=_0x5827aa[_0xd3dd('0x4b')];this['dialAMDAfterGreetingSilence']=_0x5827aa['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5827aa[_0xd3dd('0x4c')];this[_0xd3dd('0x4d')]=_0x5827aa[_0xd3dd('0x4d')];this['dialAMDBetweenWordsSilence']=_0x5827aa[_0xd3dd('0x4e')];this[_0xd3dd('0x4f')]=_0x5827aa['dialAMDMaximumNumberOfWords'];this[_0xd3dd('0x50')]=_0x5827aa[_0xd3dd('0x50')];this['dialAMDMaximumWordLength']=_0x5827aa[_0xd3dd('0x51')];this[_0xd3dd('0x52')]=0x0;this[_0xd3dd('0x53')]=0x0;this[_0xd3dd('0x54')]=_0x5827aa[_0xd3dd('0x54')];this[_0xd3dd('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xd3dd('0x56')]=0x0;this[_0xd3dd('0x57')]=0x0;this[_0xd3dd('0x58')]=0x0;this[_0xd3dd('0x59')]=0x0;this[_0xd3dd('0x5a')]=0x0;this[_0xd3dd('0x5b')]=0x0;this[_0xd3dd('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xd3dd('0x5d')]=0x0;this[_0xd3dd('0x5e')]=0x0;this[_0xd3dd('0x5f')]=0x0;this[_0xd3dd('0x60')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd3dd('0x61')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xd3dd('0x62')]=0x0;this[_0xd3dd('0x63')]=0x0;this[_0xd3dd('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xd3dd('0x65')]=0x0;this[_0xd3dd('0x66')]=0x0;this[_0xd3dd('0x67')]=_0x5827aa[_0xd3dd('0x68')]||0x14;this['predictiveIntervalMinThreshold']=_0x5827aa[_0xd3dd('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd3dd('0x69')]=0x0;this[_0xd3dd('0x6a')]=0x1;this['erlangCalls']=0x0;this[_0xd3dd('0x6b')]=0x0;this[_0xd3dd('0x6c')]=0x0;this[_0xd3dd('0x6d')]=0x0;this[_0xd3dd('0x6e')]=_0x5827aa[_0xd3dd('0x6e')]||0x1e;this[_0xd3dd('0x6f')]=_0x5827aa[_0xd3dd('0x6f')]||![];this[_0xd3dd('0x70')]=!!_0x5827aa[_0xd3dd('0x70')]||![];this[_0xd3dd('0x71')]=_0x5827aa[_0xd3dd('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x5827aa[_0xd3dd('0x72')]||![];this[_0xd3dd('0x73')]=_0x5827aa['dialAgiAfterHangupAgent']||![];this[_0xd3dd('0xe')]=monitorFormat[_0x5827aa[_0xd3dd('0xe')]]?monitorFormat[_0x5827aa[_0xd3dd('0xe')]]:undefined;this['mandatoryDisposition']=_0x5827aa[_0xd3dd('0x74')]||![];this[_0xd3dd('0x75')]=_0x5827aa[_0xd3dd('0x75')]?_0x5827aa[_0xd3dd('0x75')]:undefined;}module[_0xd3dd('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3203b73..2f3882e 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 _0x52db=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x52db,0x131));var _0xb52d=function(_0x484f98,_0x1f6f4a){_0x484f98=_0x484f98-0x0;var _0x4a87cf=_0x52db[_0x484f98];return _0x4a87cf;};'use strict';function VtigerAccount(_0x1241b3){this['id']=_0x1241b3['id']||0x0;this[_0xb52d('0x0')]=_0x1241b3[_0xb52d('0x0')]||'';this['username']=_0x1241b3[_0xb52d('0x1')]||'';this[_0xb52d('0x2')]=_0x1241b3['accessKey']||'';this[_0xb52d('0x3')]=_0x1241b3[_0xb52d('0x3')]||'';this[_0xb52d('0x4')]=_0x1241b3[_0xb52d('0x4')]||'';this['Configurations']=_0x1241b3[_0xb52d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x7a91=['name','username','accessKey','remoteUri','serverUrl','exports'];(function(_0x5a768d,_0xac271c){var _0x4612ce=function(_0x563fae){while(--_0x563fae){_0x5a768d['push'](_0x5a768d['shift']());}};_0x4612ce(++_0xac271c);}(_0x7a91,0x12c));var _0x17a9=function(_0x2a32e1,_0x2dd0ff){_0x2a32e1=_0x2a32e1-0x0;var _0x1691d2=_0x7a91[_0x2a32e1];return _0x1691d2;};'use strict';function VtigerAccount(_0x4335c2){this['id']=_0x4335c2['id']||0x0;this[_0x17a9('0x0')]=_0x4335c2[_0x17a9('0x0')]||'';this[_0x17a9('0x1')]=_0x4335c2[_0x17a9('0x1')]||'';this[_0x17a9('0x2')]=_0x4335c2['accessKey']||'';this[_0x17a9('0x3')]=_0x4335c2[_0x17a9('0x3')]||'';this[_0x17a9('0x4')]=_0x4335c2[_0x17a9('0x4')]||'';this['Configurations']=_0x4335c2['Configurations']||{};}module[_0x17a9('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 7663c87..ea21711 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 _0x2821=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x2821,0x197));var _0x1282=function(_0x43b6d1,_0x5ab462){_0x43b6d1=_0x43b6d1-0x0;var _0x2a4a76=_0x2821[_0x43b6d1];return _0x2a4a76;};'use strict';function ZendeskAccount(_0x294f03){this['id']=_0x294f03['id']||0x0;this[_0x1282('0x0')]=_0x294f03[_0x1282('0x0')]||'';this[_0x1282('0x1')]=_0x294f03['username']||'';this[_0x1282('0x2')]=_0x294f03['password']||'';this[_0x1282('0x3')]=_0x294f03[_0x1282('0x3')]||'';this[_0x1282('0x4')]=_0x294f03[_0x1282('0x4')]||'';this[_0x1282('0x5')]=_0x294f03[_0x1282('0x5')]||'';this['type']=_0x294f03[_0x1282('0x6')]||_0x1282('0x7');this[_0x1282('0x8')]=_0x294f03['serverUrl']||'';this[_0x1282('0x9')]=_0x294f03[_0x1282('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xb187=['remoteUri','authType','type','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x2a6ad6,_0x4a3114){var _0x4c20ef=function(_0x59ade1){while(--_0x59ade1){_0x2a6ad6['push'](_0x2a6ad6['shift']());}};_0x4c20ef(++_0x4a3114);}(_0xb187,0x1f0));var _0x7b18=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xb187[_0x1139d0];return _0xcc01a6;};'use strict';function ZendeskAccount(_0x2a8170){this['id']=_0x2a8170['id']||0x0;this[_0x7b18('0x0')]=_0x2a8170[_0x7b18('0x0')]||'';this[_0x7b18('0x1')]=_0x2a8170[_0x7b18('0x1')]||'';this['password']=_0x2a8170[_0x7b18('0x2')]||'';this['token']=_0x2a8170[_0x7b18('0x3')]||'';this[_0x7b18('0x4')]=_0x2a8170[_0x7b18('0x4')]||'';this[_0x7b18('0x5')]=_0x2a8170['authType']||'';this[_0x7b18('0x6')]=_0x2a8170[_0x7b18('0x6')]||'integrationTab';this['serverUrl']=_0x2a8170[_0x7b18('0x7')]||'';this[_0x7b18('0x8')]=_0x2a8170[_0x7b18('0x8')]||{};}module[_0x7b18('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f9ebca6..0b09928 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 _0x6669=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6669,0x1c8));var _0x9666=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6669[_0xfae23b];return _0x200640;};'use strict';function ZohoAccount(_0x62281b){this['id']=_0x62281b['id']||0x0;this[_0x9666('0x0')]=_0x62281b['name']||'';this[_0x9666('0x1')]=_0x62281b[_0x9666('0x1')]||'';this[_0x9666('0x2')]=_0x62281b[_0x9666('0x2')]||'';this[_0x9666('0x3')]=_0x62281b[_0x9666('0x3')]||'';this[_0x9666('0x4')]=_0x62281b['clientId']||'';this[_0x9666('0x5')]=_0x62281b[_0x9666('0x5')]||'';this[_0x9666('0x6')]=_0x62281b[_0x9666('0x6')]||'';this[_0x9666('0x7')]=_0x62281b[_0x9666('0x7')]||'';this[_0x9666('0x8')]=_0x62281b['refreshToken']||'';this['Configurations']=_0x62281b[_0x9666('0x9')]||{};}module[_0x9666('0xa')]=ZohoAccount; \ No newline at end of file +var _0x93de=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x93de,0xbc));var _0xe93d=function(_0x1ca997,_0x3cecd7){_0x1ca997=_0x1ca997-0x0;var _0x28d96f=_0x93de[_0x1ca997];return _0x28d96f;};'use strict';function ZohoAccount(_0x430949){this['id']=_0x430949['id']||0x0;this[_0xe93d('0x0')]=_0x430949['name']||'';this[_0xe93d('0x1')]=_0x430949[_0xe93d('0x1')]||'';this[_0xe93d('0x2')]=_0x430949[_0xe93d('0x2')]||'';this[_0xe93d('0x3')]=_0x430949['zone']||'';this[_0xe93d('0x4')]=_0x430949[_0xe93d('0x4')]||'';this[_0xe93d('0x5')]=_0x430949[_0xe93d('0x5')]||'';this[_0xe93d('0x6')]=_0x430949[_0xe93d('0x6')]||'';this[_0xe93d('0x7')]=_0x430949[_0xe93d('0x7')]||'';this['refreshToken']=_0x430949[_0xe93d('0x8')]||'';this['Configurations']=_0x430949[_0xe93d('0x9')]||{};}module[_0xe93d('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2b777ab..c979806 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 _0x703b=['membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','string','isNil','uniqueid','idContact','name','queue','dialAnswer'];(function(_0x27856d,_0x13b764){var _0x3a80b8=function(_0xe84430){while(--_0xe84430){_0x27856d['push'](_0x27856d['shift']());}};_0x3a80b8(++_0x13b764);}(_0x703b,0x15f));var _0xb703=function(_0x5433e4,_0x180a81){_0x5433e4=_0x5433e4-0x0;var _0x81dee9=_0x703b[_0x5433e4];return _0x81dee9;};'use strict';var util=require(_0xb703('0x0'));var _=require('lodash');var moment=require(_0xb703('0x1'));function checkNameSurname(_0x84379b,_0x23a1bd,_0x7b3030){var _0x5b055b='';if(!_['isNil'](_0x23a1bd)&&_0xb703('0x2')===typeof _0x23a1bd){_0x5b055b+=_0x23a1bd;}if(!_[_0xb703('0x3')](_0x7b3030)&&'string'===typeof _0x7b3030){_0x5b055b+='\x20'+_0x7b3030;}if(_0x5b055b!==''){return _0x5b055b;}return _0x84379b;}function Action(_0x2da66f,_0x4f1c31,_0x8050c5,_0x39281a,_0x13968e){this[_0xb703('0x4')]=_0x8050c5||undefined;this[_0xb703('0x5')]=_0x2da66f['id'];this['queue']=_0x4f1c31[_0xb703('0x6')];this['type']=_0x4f1c31['type'];this['campaigntype']=_0xb703('0x7');this[_0xb703('0x8')]=![];this[_0xb703('0x9')]=_[_0xb703('0x3')](_0x2da66f[_0xb703('0xa')])?undefined:_0x2da66f['Agent'][_0xb703('0x6')];this[_0xb703('0xb')]=this[_0xb703('0x9')]?util[_0xb703('0xc')]('SIP/%s',this[_0xb703('0x9')]):_0x39281a||undefined;this[_0xb703('0xd')]=checkNameSurname(_0x2da66f[_0xb703('0xe')][_0xb703('0xf')],_0x2da66f[_0xb703('0xe')][_0xb703('0x10')],_0x2da66f[_0xb703('0xe')][_0xb703('0x11')]);this['active']=_0x2da66f['active']||![];this[_0xb703('0x12')]=_0x2da66f[_0xb703('0xe')]['phone'];this[_0xb703('0x13')]=_0x2da66f[_0xb703('0x13')];this[_0xb703('0x14')]=_0x2da66f[_0xb703('0x14')]||0x0;this[_0xb703('0x15')]=_0x2da66f[_0xb703('0x15')]||0x0;this[_0xb703('0x16')]=_0x2da66f[_0xb703('0x16')]||0x0;this['countglobal']=(_0x2da66f['countbusyretry']||0x0)+(_0x2da66f[_0xb703('0x15')]||0x0)+(_0x2da66f[_0xb703('0x16')]||0x0)+(_0x2da66f[_0xb703('0x17')]||0x0)+(_0x2da66f['countdropretry']||0x0)+(_0x2da66f['countabandonedretry']||0x0)+(_0x2da66f['countmachineretry']||0x0)+(_0x2da66f[_0xb703('0x18')]||0x0);this[_0xb703('0x17')]=_0x2da66f[_0xb703('0x17')]||0x0;this[_0xb703('0x19')]=_0x2da66f[_0xb703('0x19')]||0x0;this[_0xb703('0x1a')]=_0x2da66f[_0xb703('0x1a')]||0x0;this[_0xb703('0x1b')]=_0x2da66f['countmachineretry']||0x0;this['countagentrejectretry']=_0x2da66f['countagentrejectretry']||0x0;this['callback']=_0x2da66f['callback'];this[_0xb703('0x1c')]=_0x2da66f[_0xb703('0x1c')];this['callbackat']=_0x2da66f[_0xb703('0x1d')];this[_0xb703('0x1e')]=_0x2da66f[_0xb703('0x1e')];this[_0xb703('0x1f')]=_0x2da66f[_0xb703('0x1f')];this[_0xb703('0x20')]=_0x2da66f[_0xb703('0x20')];this['UserId']=_[_0xb703('0x3')](_0x2da66f[_0xb703('0xa')])?_0x2da66f['UserId']:_0x2da66f[_0xb703('0xa')]['id'];this[_0xb703('0x21')]=_0x2da66f[_0xb703('0x21')];this[_0xb703('0x22')]='';this[_0xb703('0x23')]='';}Action[_0xb703('0x24')][_0xb703('0x25')]=function(){return util[_0xb703('0xc')](_0xb703('0x26'),this[_0xb703('0xd')],this['number']);};module[_0xb703('0x27')]=Action; \ No newline at end of file +var _0xd232=['string','queue','name','type','membername','Agent','channelAgent','format','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0xd232,0xed));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0x2d23('0x0'));var moment=require(_0x2d23('0x1'));function checkNameSurname(_0x1a4d25,_0x18f40c,_0x14bd6b){var _0x37910d='';if(!_[_0x2d23('0x2')](_0x18f40c)&&'string'===typeof _0x18f40c){_0x37910d+=_0x18f40c;}if(!_[_0x2d23('0x2')](_0x14bd6b)&&_0x2d23('0x3')===typeof _0x14bd6b){_0x37910d+='\x20'+_0x14bd6b;}if(_0x37910d!==''){return _0x37910d;}return _0x1a4d25;}function Action(_0x1da428,_0x1854b9,_0x495512,_0x3331ea,_0x1635ae){this['uniqueid']=_0x495512||undefined;this['idContact']=_0x1da428['id'];this[_0x2d23('0x4')]=_0x1854b9[_0x2d23('0x5')];this['type']=_0x1854b9[_0x2d23('0x6')];this['campaigntype']=_0x2d23('0x4');this['dialAnswer']=![];this[_0x2d23('0x7')]=_[_0x2d23('0x2')](_0x1da428[_0x2d23('0x8')])?undefined:_0x1da428[_0x2d23('0x8')][_0x2d23('0x5')];this[_0x2d23('0x9')]=this[_0x2d23('0x7')]?util[_0x2d23('0xa')]('SIP/%s',this[_0x2d23('0x7')]):_0x3331ea||undefined;this[_0x2d23('0xb')]=checkNameSurname(_0x1da428[_0x2d23('0xc')][_0x2d23('0xd')],_0x1da428[_0x2d23('0xc')]['firstName'],_0x1da428[_0x2d23('0xc')][_0x2d23('0xe')]);this['active']=_0x1da428[_0x2d23('0xf')]||![];this[_0x2d23('0x10')]=_0x1da428[_0x2d23('0xc')][_0x2d23('0xd')];this['scheduledat']=_0x1da428[_0x2d23('0x11')];this[_0x2d23('0x12')]=_0x1da428[_0x2d23('0x12')]||0x0;this['countcongestionretry']=_0x1da428[_0x2d23('0x13')]||0x0;this[_0x2d23('0x14')]=_0x1da428['countnoanswerretry']||0x0;this[_0x2d23('0x15')]=(_0x1da428['countbusyretry']||0x0)+(_0x1da428[_0x2d23('0x13')]||0x0)+(_0x1da428[_0x2d23('0x14')]||0x0)+(_0x1da428[_0x2d23('0x16')]||0x0)+(_0x1da428[_0x2d23('0x17')]||0x0)+(_0x1da428['countabandonedretry']||0x0)+(_0x1da428[_0x2d23('0x18')]||0x0)+(_0x1da428[_0x2d23('0x19')]||0x0);this[_0x2d23('0x16')]=_0x1da428[_0x2d23('0x16')]||0x0;this[_0x2d23('0x17')]=_0x1da428[_0x2d23('0x17')]||0x0;this[_0x2d23('0x1a')]=_0x1da428['countabandonedretry']||0x0;this[_0x2d23('0x18')]=_0x1da428[_0x2d23('0x18')]||0x0;this[_0x2d23('0x19')]=_0x1da428['countagentrejectretry']||0x0;this[_0x2d23('0x1b')]=_0x1da428[_0x2d23('0x1b')];this[_0x2d23('0x1c')]=_0x1da428[_0x2d23('0x1c')];this[_0x2d23('0x1d')]=_0x1da428['callbackat'];this[_0x2d23('0x1e')]=_0x1da428[_0x2d23('0x1e')];this[_0x2d23('0x1f')]=_0x1da428[_0x2d23('0x1f')];this['ListId']=_0x1da428['ListId'];this[_0x2d23('0x20')]=_[_0x2d23('0x2')](_0x1da428[_0x2d23('0x8')])?_0x1da428[_0x2d23('0x20')]:_0x1da428[_0x2d23('0x8')]['id'];this['VoiceQueueId']=_0x1da428[_0x2d23('0x21')];this[_0x2d23('0x22')]='';this[_0x2d23('0x23')]='';}Action[_0x2d23('0x24')]['getCaller']=function(){return util[_0x2d23('0xa')](_0x2d23('0x25'),this[_0x2d23('0xb')],this[_0x2d23('0x26')]);};module[_0x2d23('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d4a551d..a91ac93 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 _0x032e=['waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','Interval','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','originated','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','dialPreviewAutoRecallMe','clearZombieChannel','isNil','Queue','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','TrunkBackup','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','linkedid','BUSY','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','countbusyretry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','SIP/%s','reachable','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','Is\x20Valid','trim','dialCutDigit','phone','substring','Contact','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','inspect','transfererlinkedid','transfer','exports','util','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','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','talking','total','type','unmanaged','abandoned'];(function(_0xf1acfa,_0x3edea2){var _0x1545f5=function(_0xc10670){while(--_0xc10670){_0xf1acfa['push'](_0xf1acfa['shift']());}};_0x1545f5(++_0x3edea2);}(_0x032e,0x124));var _0xe032=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x032e[_0x5bd426];return _0x23a7eb;};'use strict';var util=require(_0xe032('0x0'));var _=require('lodash');var BPromise=require(_0xe032('0x1'));var uuid=require(_0xe032('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xe032('0x3'));var config=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var loggerAction=require(_0xe032('0x5'))(_0xe032('0x7'));var ami=require(_0xe032('0x8'));var rpcDb=require(_0xe032('0x9'));var Action=require(_0xe032('0xa'));var ut=require(_0xe032('0xb'));config[_0xe032('0xc')]=_[_0xe032('0xd')](config[_0xe032('0xc')],{'host':_0xe032('0xe'),'port':0x18eb});var io=require(_0xe032('0xf'))(new Redis(config[_0xe032('0xc')]));var Sequence=function(){};Sequence[_0xe032('0x10')][_0xe032('0x11')]=function(_0x4aec53){this[_0xe032('0x12')]=this[_0xe032('0x12')]?this[_0xe032('0x12')][_0xe032('0x13')](_0x4aec53):_0x4aec53();};function Preview(_0x244f93){this[_0xe032('0x14')]=new Sequence();this[_0xe032('0x15')]=_0x244f93['voiceQueues'];this[_0xe032('0x16')]=_0x244f93[_0xe032('0x16')];this[_0xe032('0x17')]={};this[_0xe032('0x18')]=_0x244f93['agents'];this[_0xe032('0x19')]=0x0;ami['on'](_0xe032('0x1a'),this[_0xe032('0x1b')][_0xe032('0x1c')](this));ami['on'](_0xe032('0x1d'),this[_0xe032('0x1e')][_0xe032('0x1c')](this));ami['on']('hanguprequest',this[_0xe032('0x1f')][_0xe032('0x1c')](this));ami['on'](_0xe032('0x20'),this[_0xe032('0x21')][_0xe032('0x1c')](this));ami['on'](_0xe032('0x22'),this['syncNewExten'][_0xe032('0x1c')](this));ami['on'](_0xe032('0x23'),this[_0xe032('0x24')][_0xe032('0x1c')](this));ami['on'](_0xe032('0x25'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xe032('0x26')]['bind'](this));this[_0xe032('0x27')](this[_0xe032('0x15')]);}function emit(_0x3f0257,_0x2aa342,_0x288d91){io['to'](_0x3f0257)[_0xe032('0x28')](_0x2aa342,_0x288d91);}function emitCampaignPreview(_0x136f5d){if(_0x136f5d['type']===_0xe032('0x29')){var _0x866c81={'id':_0x136f5d['id'],'name':_0x136f5d[_0xe032('0x2a')],'strategy':_0x136f5d[_0xe032('0x2b')],'answered':_0x136f5d[_0xe032('0x2c')],'available':_0x136f5d[_0xe032('0x2d')],'loggedIn':_0x136f5d[_0xe032('0x2e')],'pTalking':_0x136f5d[_0xe032('0x2f')],'sumBillable':_0x136f5d['sumBillable'],'sumDuration':_0x136f5d['sumDuration'],'sumHoldTime':_0x136f5d['sumHoldTime']||0x0,'talking':_0x136f5d[_0xe032('0x30')],'total':_0x136f5d[_0xe032('0x31')],'type':_0x136f5d[_0xe032('0x32')],'unmanaged':_0x136f5d[_0xe032('0x33')],'abandoned':_0x136f5d[_0xe032('0x34')],'waiting':_0x136f5d[_0xe032('0x35')],'loggedInDb':_0x136f5d[_0xe032('0x36')],'dialActive':_0x136f5d[_0xe032('0x37')],'dialMethod':_0x136f5d[_0xe032('0x38')],'dialOriginateCallerIdName':_0x136f5d[_0xe032('0x39')],'dialOriginateCallerIdNumber':_0x136f5d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x136f5d[_0xe032('0x3a')],'dialPrefix':_0x136f5d[_0xe032('0x3b')],'outboundAnswerAgiCallsDay':_0x136f5d[_0xe032('0x3c')],'outboundAnswerCallsDay':_0x136f5d[_0xe032('0x3d')],'outboundBlacklistCallsDay':_0x136f5d['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x136f5d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x136f5d[_0xe032('0x3e')],'outboundDropCallsDayACS':_0x136f5d[_0xe032('0x3f')],'outboundDropCallsDayCallersExit':_0x136f5d[_0xe032('0x40')],'outboundDropCallsDayTimeout':_0x136f5d[_0xe032('0x41')],'outboundNoAnswerCallsDay':_0x136f5d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x136f5d['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x136f5d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x136f5d[_0xe032('0x42')],'outboundRejectCallsDay':_0x136f5d[_0xe032('0x43')],'outboundUnknownCallsDay':_0x136f5d[_0xe032('0x44')],'outboundAbandonedCallsDay':_0x136f5d[_0xe032('0x45')],'predictiveIntervalAnsweredCalls':_0x136f5d['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x136f5d[_0xe032('0x46')],'predictiveIntervalAvgTalktime':_0x136f5d[_0xe032('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x136f5d[_0xe032('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x136f5d[_0xe032('0x49')],'predictiveIntervalErlangCalls':_0x136f5d[_0xe032('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x136f5d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x136f5d[_0xe032('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x136f5d[_0xe032('0x4c')],'predictiveIntervalPauses':_0x136f5d[_0xe032('0x4d')],'predictiveIntervalAvailable':_0x136f5d[_0xe032('0x4e')],'predictiveIntervalTotalCalls':_0x136f5d['predictiveIntervalTotalCalls'],'message':_0x136f5d[_0xe032('0x4f')],'originated':_0x136f5d['originated'],'erlangCalls':_0x136f5d[_0xe032('0x50')],'erlangCallToSecond':_0x136f5d['erlangCallToSecond'],'erlangAbandonmentRate':_0x136f5d[_0xe032('0x51')],'erlangBusyFactor':_0x136f5d['erlangBusyFactor'],'startPredictive':_0x136f5d[_0xe032('0x52')],'startProgressive':_0x136f5d['startProgressive']};if(_0x136f5d[_0xe032('0x53')]){_0x866c81[_0xe032('0x53')]={'id':_0x136f5d['Trunk']['id'],'name':_0x136f5d[_0xe032('0x53')][_0xe032('0x2a')],'active':_0x136f5d[_0xe032('0x53')][_0xe032('0x54')],'callerid':_0x136f5d['Trunk'][_0xe032('0x55')]};}if(_0x136f5d['Interval']){_0x866c81[_0xe032('0x56')]={'id':_0x136f5d[_0xe032('0x56')]['id'],'name':_0x136f5d['Interval'][_0xe032('0x2a')]};}var _0x23b790=md5(JSON['stringify'](_0x866c81));if(_0x136f5d[_0xe032('0x57')]!==_0x23b790){_0x136f5d[_0xe032('0x57')]=_0x23b790;emit(util[_0xe032('0x58')](_0xe032('0x59'),_0x866c81[_0xe032('0x2a')]),_0xe032('0x5a'),_0x866c81);}}}function emitVoiceQueueChannelRemove(_0x19ee0a){logger[_0xe032('0x5b')](_0xe032('0x5c'),JSON[_0xe032('0x5d')](_0x19ee0a));emit(util[_0xe032('0x58')](_0xe032('0x59'),_0x19ee0a[_0xe032('0x2a')]),_0xe032('0x5e'),_0x19ee0a);io[_0xe032('0x28')](_0xe032('0x5f'),_0x19ee0a);}function notSendMessagesQueue(_0x2d3d0b){if(_0x2d3d0b['sendMessageOneNotActive']){if(_0x2d3d0b[_0xe032('0x60')]===0x0&&_0x2d3d0b['pTalking']===0x0){_0x2d3d0b[_0xe032('0x61')]=![];_0x2d3d0b[_0xe032('0x2d')]=0x0;_0x2d3d0b[_0xe032('0x62')]=0x0;_0x2d3d0b[_0xe032('0x4f')]=_0xe032('0x63');ut['logger'](_0xe032('0x64'),_0x2d3d0b['name']+_0xe032('0x65'));}else{_0x2d3d0b['message']=_0xe032('0x66');ut[_0xe032('0x67')](_0xe032('0x64'),_0x2d3d0b[_0xe032('0x2a')]+'\x20is\x20disactive');}emitCampaignPreview(_0x2d3d0b);}}Preview[_0xe032('0x10')]['loopCampaigns']=function(){var _0x2b9664=this;setInterval(function(){_0x2b9664[_0xe032('0x68')]();},0x7cf);};Preview[_0xe032('0x10')][_0xe032('0x68')]=function(){var _0x4b58eb=this['campaignsPreview'];this[_0xe032('0x19')]+=0x1;for(var _0x203021 in _0x4b58eb){if(_0x4b58eb['hasOwnProperty'](_0x203021)&&(_0x4b58eb[_0x203021][_0xe032('0x38')]===_0xe032('0x6')||_0x4b58eb[_0x203021][_0xe032('0x38')]===_0xe032('0x69'))&&_0x4b58eb[_0x203021][_0xe032('0x32')]==='outbound'){if(this[_0xe032('0x19')]>0x7){this[_0xe032('0x19')]=0x0;this[_0xe032('0x6a')]();}}if(_0x4b58eb[_0xe032('0x6b')](_0x203021)&&_0x4b58eb[_0x203021][_0xe032('0x38')]===_0xe032('0x6')&&_0x4b58eb[_0x203021][_0xe032('0x32')]===_0xe032('0x29')){if(_0x4b58eb[_0x203021]['dialActive']){this['setMessage'](_0x4b58eb[_0x203021]);if(_0x4b58eb[_0x203021][_0xe032('0x6c')])this['recallMe'](_0x4b58eb[_0x203021]);}else{notSendMessagesQueue(_0x4b58eb[_0x203021]);}}}};Preview[_0xe032('0x10')][_0xe032('0x6d')]=function(_0x1873a6){var _0x13bc7e=this;this[_0xe032('0x14')][_0xe032('0x11')](function(){if(!_[_0xe032('0x6e')](_0x13bc7e[_0xe032('0x17')][_0x1873a6])){loggerAction[_0xe032('0x5b')]('[clearZombieChannels][talking]',_0x1873a6,_0xe032('0x6f'),_0x13bc7e['actions'][_0x1873a6]['queue'],_0xe032('0x70'),JSON[_0xe032('0x5d')](_0x13bc7e[_0xe032('0x15')][_0x13bc7e[_0xe032('0x17')][_0x1873a6]['queue']][_0xe032('0x60')]),_0xe032('0x71'),JSON[_0xe032('0x5d')](_0x13bc7e[_0xe032('0x15')][_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x72')]][_0xe032('0x2f')]),JSON['stringify'](_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x73')]),JSON['stringify'](_[_0xe032('0x74')](_0x13bc7e[_0xe032('0x17')][_0x1873a6],[_0xe032('0x75'),_0xe032('0x76'),_0xe032('0x77'),_0xe032('0x78')])));return ami[_0xe032('0x79')]({'action':_0xe032('0x7a'),'channel':_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x7b')]})[_0xe032('0x7c')](function(_0x2c1753){if(_0x2c1753[_0xe032('0x4f')]===_0xe032('0x7d')){setTimeout(function(){if(_0x13bc7e['actions'][_0x1873a6]){ut[_0xe032('0x7e')](_0x13bc7e['campaignsPreview'][_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x72')]],_0xe032('0x7f'));if(_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x73')]===!![]){ut[_0xe032('0x80')](_0x13bc7e[_0xe032('0x15')][_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x72')]],_0xe032('0x7f'));ut[_0xe032('0x81')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1873a6,_0x13bc7e[_0xe032('0x17')][_0x1873a6][_0xe032('0x72')]);}ut['loggerError'](_0xe032('0x82')+_0x1873a6,_0x13bc7e['actions'][_0x1873a6][_0xe032('0x72')]);delete _0x13bc7e[_0xe032('0x17')][_0x1873a6];}},0x2328);}});}});};Preview[_0xe032('0x10')][_0xe032('0x6a')]=function(){var _0x467d0c=this;loggerAction['info'](_0xe032('0x83'),_[_0xe032('0x84')](this[_0xe032('0x17')]));for(var _0x21a32f in this[_0xe032('0x17')]){if(_0x467d0c[_0xe032('0x17')][_0xe032('0x6b')](_0x21a32f)){_0x467d0c['clearZombieChannel'](_0x21a32f);}}};Preview[_0xe032('0x10')][_0xe032('0x85')]=function(_0x454b29){var _0x15325e=this;rpcDb[_0xe032('0x86')](_0x454b29['id'],ut[_0xe032('0x87')](this[_0xe032('0x18')]))[_0xe032('0x88')](function(_0x80d181){if(!_['isNil'](_0x80d181)){for(var _0x795a58=0x0;_0x795a58<_0x80d181[_0xe032('0x89')];_0x795a58+=0x1){if(ut[_0xe032('0x8a')](_0x80d181[_0x795a58]['scheduledat'])<_0x454b29[_0xe032('0x8b')]*0x3c){if(_0x80d181[_0x795a58][_0xe032('0x8c')]&&!_0x80d181[_0x795a58]['Agent'][_0xe032('0x8d')]){_0x15325e[_0xe032('0x8e')](_0x80d181[_0x795a58]['id'])[_0xe032('0x88')](ut[_0xe032('0x8f')](_0xe032('0x90')))[_0xe032('0x7c')](ut[_0xe032('0x8f')](_0xe032('0x90')));}else{rpcDb[_0xe032('0x91')](_0x80d181[_0x795a58]['id']);}}else{var _0x19ce2b=new Action(_0x80d181[_0x795a58],_0x454b29);_0x19ce2b[_0xe032('0x92')]=moment()['format'](_0xe032('0x93'));_0x454b29[_0xe032('0x42')]+=0x1;ut[_0xe032('0x94')](_0x19ce2b,0x17,_0xe032('0x95'));if(_0x454b29[_0xe032('0x96')]){rpcDb['rescheduleContactInQueue'](ut[_0xe032('0x97')](_0x80d181[_0x795a58]));rpcDb['createCustomerHistory'](_0x19ce2b,_0xe032('0x98'));}else{ut[_0xe032('0x94')](_0x19ce2b,0x16,_0xe032('0x99'));rpcDb[_0xe032('0x9a')](_0x19ce2b,_0xe032('0x9b'));rpcDb[_0xe032('0x9c')](_0x19ce2b,_0xe032('0x9b'));}}}}})[_0xe032('0x7c')](ut[_0xe032('0x8f')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x221473){_0x221473[_0xe032('0x61')]=!![];if(ut[_0xe032('0x9d')](_0x221473[_0xe032('0x2e')])){_0x221473[_0xe032('0x4f')]=_0xe032('0x9e');}else if(!ut['isActive'](_0x221473[_0xe032('0x37')])){_0x221473[_0xe032('0x4f')]=_0xe032('0x63');}else if(!this['isTrunkReachable'](_0x221473[_0xe032('0x53')])){if(!this['isTrunkReachable'](_0x221473[_0xe032('0x9f')])){_0x221473[_0xe032('0x4f')]='TRUNK_IS_NOT_REACHABLE';}else{_0x221473['message']='ACTIVE';}}else{_0x221473[_0xe032('0x4f')]='ACTIVE';}emitCampaignPreview(_0x221473);};Preview['prototype'][_0xe032('0xa0')]=function(_0x1bf18c,_0x473171,_0x4ed078){var _0x193a0f=this;var _0x4b5f92=this[_0xe032('0x17')][_0x473171];var _0x102314=this[_0xe032('0x15')][_0x4b5f92[_0xe032('0x72')]];var _0x1f24ec;if(_0x102314){switch(_0x4ed078){case'1':_0x102314[_0xe032('0xa1')]+=0x1;_0x4b5f92[_0xe032('0xa2')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut[_0xe032('0x94')](_0x4b5f92,0x0,_0xe032('0xa5'));ami['emit'](_0xe032('0xa6'),ut[_0xe032('0xa7')](_0x4b5f92,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x4b5f92,_0xe032('0xa8'));if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb[_0xe032('0x9c')](_0x1f24ec,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4b5f92[_0xe032('0xa2')]>=_0x102314[_0xe032('0xac')]){rpcDb['createCustomerFinal'](_0x4b5f92,_0xe032('0xad'));}else{rpcDb[_0xe032('0xae')](ut[_0xe032('0xaf')](_0x4b5f92,'countnosuchnumberretry',_0x102314[_0xe032('0xb0')]),_0x4b5f92[_0xe032('0xb1')],_0x4b5f92[_0xe032('0xb2')]);}}delete this['actions'][_0x1bf18c['linkedid']];break;case _0xe032('0xb3'):var _0x529c5f=moment()[_0xe032('0x58')](_0xe032('0x93'));_0x4b5f92[_0xe032('0xb4')]=_0x529c5f;_0x4b5f92[_0xe032('0xb5')]=_0x529c5f;_0x4b5f92[_0xe032('0x73')]=!![];_0x102314[_0xe032('0x2f')]+=0x1;logger['info'](_0xe032('0xb6'),_0x4b5f92[_0xe032('0xb7')],_0xe032('0xb8'),_0x102314['name'],_0xe032('0x71'),_0x102314['pTalking']);ami[_0xe032('0x28')]('custom:agentconnect',ut[_0xe032('0xa7')](_0x4b5f92,_0xe032('0xb9'),this[_0xe032('0x15')][_0x4b5f92['queue']]));if(_0x102314[_0xe032('0xba')]){ami[_0xe032('0x28')](_0xe032('0xbb'),ut[_0xe032('0xbc')](_0x4b5f92));}break;case'16':ami[_0xe032('0x28')](_0xe032('0xbd'),ut['buildObj'](_0x4b5f92,_0xe032('0xbe'),this[_0xe032('0x15')][_0x4b5f92['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4b5f92,_0xe032('0xbe')));_0x102314[_0xe032('0x3d')]+=0x1;_0x102314[_0xe032('0x31')]+=0x1;_0x102314[_0xe032('0x2c')]+=0x1;ut[_0xe032('0x80')](_0x102314,'[16]');_0x4b5f92[_0xe032('0xa3')]=ut['totalGlobal'](_0x4b5f92);ut[_0xe032('0x94')](_0x4b5f92,0x4,'Answer');rpcDb[_0xe032('0x9a')](_0x4b5f92,_0xe032('0xbf'));rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xc0'));rpcDb[_0xe032('0xc1')](_0x4b5f92);_0x102314[_0xe032('0xc2')]+=_0x4b5f92['talktime'];_0x102314[_0xe032('0xc3')]+=_0x4b5f92['talktime'];logger['info']('[syncHangup][talking][decrement]',_0x4b5f92[_0xe032('0xb7')],_0xe032('0xb8'),_0x102314['name'],_0xe032('0x71'),_0x102314['pTalking']);delete this['actions'][_0x1bf18c[_0xe032('0xc4')]];break;case _0xe032('0xc5'):_0x102314['outboundBusyCallsDay']+=0x1;_0x4b5f92['countbusyretry']+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut['logCustomer'](_0x4b5f92,0x5,_0xe032('0xc6'));ami[_0xe032('0x28')](_0xe032('0xc7'),ut[_0xe032('0xa7')](_0x4b5f92,'busy'));rpcDb[_0xe032('0x9a')](_0x4b5f92,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,'Global');rpcDb[_0xe032('0x9c')](_0x1f24ec,_0xe032('0xc8'));}else{if(_0x4b5f92['countbusyretry']>=_0x102314[_0xe032('0xc9')]){rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xca'));}else{rpcDb[_0xe032('0xae')](ut[_0xe032('0xaf')](_0x4b5f92,_0xe032('0xcb'),_0x102314['dialBusyRetryFrequency']),_0x4b5f92[_0xe032('0xb1')],_0x4b5f92[_0xe032('0xb2')]);}}break;case _0xe032('0xcc'):_0x102314[_0xe032('0xcd')]+=0x1;_0x4b5f92[_0xe032('0xce')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut[_0xe032('0x94')](_0x4b5f92,0x3,_0xe032('0xcf'));ami[_0xe032('0x28')](_0xe032('0xd0'),ut['buildObj'](_0x4b5f92,_0xe032('0xd1')));rpcDb['createCustomerHistory'](_0x4b5f92,_0xe032('0xd2'));if(ut['totalGlobal'](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,'Global');rpcDb[_0xe032('0x9c')](_0x1f24ec,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4b5f92['countnoanswerretry']>=_0x102314['dialNoAnswerMaxRetry']){rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xd2'));}else{rpcDb[_0xe032('0xae')](ut['scheduledAt'](_0x4b5f92,_0xe032('0xce'),_0x102314[_0xe032('0xd3')]),_0x4b5f92[_0xe032('0xb1')],_0x4b5f92['activeContact']);}}break;case _0xe032('0xd4'):_0x102314['outboundCongestionCallsDay']+=0x1;_0x4b5f92[_0xe032('0xd5')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut[_0xe032('0x94')](_0x4b5f92,0x8,_0xe032('0xd6'));ami[_0xe032('0x28')](_0xe032('0xd7'),ut[_0xe032('0xa7')](_0x4b5f92,_0xe032('0xd8')));rpcDb[_0xe032('0x9a')](_0x4b5f92,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb[_0xe032('0x9c')](_0x1f24ec,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4b5f92[_0xe032('0xd5')]>=_0x102314[_0xe032('0xd9')]){rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xda'));}else{rpcDb['rescheduleContact'](ut[_0xe032('0xaf')](_0x4b5f92,_0xe032('0xd5'),_0x102314[_0xe032('0xdb')]),_0x4b5f92[_0xe032('0xb1')],_0x4b5f92[_0xe032('0xb2')]);}}break;case _0xe032('0xdc'):_0x102314[_0xe032('0x43')]+=0x1;_0x4b5f92['countagentrejectretry']+=0x1;_0x4b5f92['countglobal']=ut['totalGlobal'](_0x4b5f92);ut['logCustomer'](_0x4b5f92,0x14,'AgentReject');ami[_0xe032('0x28')](_0xe032('0xdd'),ut[_0xe032('0xa7')](_0x4b5f92,_0xe032('0xde')));rpcDb[_0xe032('0x9a')](_0x4b5f92,'[syncHangupRequest][logAgentReject]');if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0x14,_0xe032('0xdf'));rpcDb[_0xe032('0x9c')](_0x1f24ec,_0xe032('0xe0'));}else{if(_0x4b5f92[_0xe032('0xe1')]>=_0x102314[_0xe032('0xe2')]){rpcDb[_0xe032('0x9c')](_0x4b5f92,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4b5f92,_0xe032('0xe1'),_0x102314['dialAgentRejectRetryFrequency']),_0x4b5f92[_0xe032('0xb1')],_0x4b5f92[_0xe032('0xb2')]);}}break;case _0xe032('0xe3'):_0x102314['outboundAbandonedCallsDay']+=0x1;_0x4b5f92[_0xe032('0xe4')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut['logCustomer'](_0x4b5f92,0xb,'Abandoned');rpcDb[_0xe032('0x9a')](_0x4b5f92,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb[_0xe032('0x9c')](_0x1f24ec,_0xe032('0xe5'));}else{if(_0x4b5f92[_0xe032('0xe6')]>=_0x102314[_0xe032('0xe7')]){rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xe5'));}else{rpcDb[_0xe032('0xae')](ut[_0xe032('0xaf')](_0x4b5f92,_0xe032('0xe4'),_0x102314[_0xe032('0xe8')]),_0x4b5f92['unlockAgent'],_0x4b5f92[_0xe032('0xb2')]);}}break;case'18':_0x102314['outboundUnknownCallsDay']+=0x1;_0x4b5f92[_0xe032('0xe9')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut['logCustomer'](_0x4b5f92,0x12,_0x1bf18c[_0xe032('0xea')]||_0x1bf18c['dialstatus']);ami['emit'](_0xe032('0xeb'),ut[_0xe032('0xa7')](_0x4b5f92,_0xe032('0xec')));rpcDb['createCustomerHistory'](_0x4b5f92,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314['dialGlobalMaxRetry']){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb[_0xe032('0x9c')](_0x1f24ec,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xed'));}delete this[_0xe032('0x17')][_0x1bf18c[_0xe032('0xc4')]];break;case'19':_0x102314[_0xe032('0x44')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut[_0xe032('0x94')](_0x4b5f92,0x13,_0x1bf18c[_0xe032('0xea')]||_0x1bf18c[_0xe032('0xee')]);ami[_0xe032('0x28')](_0xe032('0xeb'),ut['buildObj'](_0x4b5f92,_0xe032('0xec')));rpcDb[_0xe032('0x9a')](_0x4b5f92,_0xe032('0xef'));if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314['dialGlobalMaxRetry']){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb[_0xe032('0x9c')](_0x1f24ec,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xef'));}delete this[_0xe032('0x17')][_0x1bf18c[_0xe032('0xc4')]];break;default:if(_0x4b5f92[_0xe032('0x73')]){ut[_0xe032('0x80')](_0x102314,'[default]');ut['loggerError'](_0xe032('0xf0')+_0x102314[_0xe032('0x2a')],_0x1bf18c);}_0x102314[_0xe032('0x44')]+=0x1;_0x4b5f92[_0xe032('0xa3')]=ut[_0xe032('0xa4')](_0x4b5f92);ut['logCustomer'](_0x4b5f92,0xc,_0x1bf18c['cause-txt']||_0x1bf18c[_0xe032('0xee')]);rpcDb[_0xe032('0x9a')](_0x4b5f92,_0xe032('0xf1'));if(ut[_0xe032('0xa4')](_0x4b5f92)>=_0x102314[_0xe032('0xa9')]){_0x1f24ec=ut[_0xe032('0xaa')](_0x4b5f92,0xf,_0xe032('0xab'));rpcDb['createCustomerFinal'](_0x1f24ec,_0xe032('0xf2'));}else{rpcDb[_0xe032('0x9c')](_0x4b5f92,_0xe032('0xf2'));}delete this[_0xe032('0x17')][_0x1bf18c[_0xe032('0xc4')]];}if(!(_0x4b5f92[_0xe032('0x73')]&&_0x4ed078==='16')){ut[_0xe032('0x7e')](_0x102314,'[callProgressDetectingCustomer]');logger[_0xe032('0x5b')](_0xe032('0xf3'),_0x4b5f92['uniqueid'],_0xe032('0xb8'),_0x102314[_0xe032('0x2a')],_0xe032('0x70'),_0x102314[_0xe032('0x60')]);}if(_0x4ed078!=='ANSWER'){delete this[_0xe032('0x17')][_0x1bf18c[_0xe032('0xc4')]];delete this[_0xe032('0x17')][_0x1bf18c['destlinkedid']];}}};Preview[_0xe032('0x10')][_0xe032('0xf4')]=function(_0x285ca4,_0x44da43,_0x313aa1){if(_[_0xe032('0xf5')](_0x44da43)&&_0xe032('0xf6')!==typeof _0x44da43){return;}if(_[_0xe032('0xf5')](_0x313aa1)&&_0xe032('0xf6')!==typeof _0x313aa1){return;}switch(_0x313aa1['reason']){case'0':ut[_0xe032('0xf7')](_0x285ca4,0x0,_0xe032('0xa5'));rpcDb['createAgentHistory'](_0x285ca4,_0xe032('0xf8'));break;case'3':ut[_0xe032('0xf7')](_0x285ca4,0x3,_0xe032('0xcf'));rpcDb[_0xe032('0xf9')](_0x285ca4,_0xe032('0xfa'));break;case'5':ut['logAgent'](_0x285ca4,0x5,_0xe032('0xc6'));rpcDb['createAgentHistory'](_0x285ca4,_0xe032('0xfb'));break;case'8':ut[_0xe032('0xf7')](_0x285ca4,0x8,_0xe032('0xd6'));rpcDb['createAgentHistory'](_0x285ca4,_0xe032('0xfc'));break;case'22':ut[_0xe032('0xf7')](_0x285ca4,0x16,_0xe032('0xfd'));rpcDb[_0xe032('0xf9')](_0x285ca4,_0xe032('0xfe'));break;default:ut[_0xe032('0xf7')](_0x285ca4,0xc,_0x313aa1[_0xe032('0xff')]);rpcDb[_0xe032('0xf9')](_0x285ca4,_0xe032('0xfc'));}ut['updateOriginated'](_0x44da43,_0xe032('0x100'));logger[_0xe032('0x5b')](_0xe032('0x101'),_0x285ca4[_0xe032('0xb7')],_0xe032('0xb8'),_0x44da43[_0xe032('0x2a')],_0xe032('0x70'),_0x44da43[_0xe032('0x60')]);delete this[_0xe032('0x17')][_0x285ca4[_0xe032('0xb7')]];};Preview[_0xe032('0x10')][_0xe032('0x102')]=function(_0x11d208,_0x4ff6fa,_0x51cb5e,_0x544176,_0x1c2c6b){var _0x3a854b=this;return new BPromise(function(_0x421aa2,_0xf15fc3){if(_[_0xe032('0x6e')](_0x4ff6fa)||_[_0xe032('0x6e')](_0x4ff6fa['Contact'])||_[_0xe032('0x6e')](_0x4ff6fa['Contact']['phone'])||_[_0xe032('0x6e')](_0x4ff6fa[_0xe032('0x77')])){_0xf15fc3(ut[_0xe032('0x4f')](_0xe032('0x103'),_0x544176,_0x1c2c6b));return;}var _0x3ef62b=uuid['v4']();var _0x10c56e=_0x3a854b[_0xe032('0x15')][_0x4ff6fa[_0xe032('0x6f')]['name']];var _0x54c254=_0x51cb5e?_0x3a854b[_0xe032('0x18')][_0x51cb5e]['id']:undefined;_0x3a854b[_0xe032('0x17')][_0x3ef62b]=new Action(_0x4ff6fa,_0x10c56e,_0x3ef62b,_0x51cb5e,_0x54c254);var _0x27061b=_0x3a854b['actions'][_0x3ef62b];_0x27061b[_0xe032('0xb1')]=_0x544176;_0x27061b[_0xe032('0xb2')]=_0x1c2c6b;_0x27061b[_0xe032('0x104')]=_0x51cb5e;if(_[_0xe032('0x105')](_0x11d208)){_0x3a854b[_0xe032('0x106')](_0x27061b,_0x10c56e,_0x4ff6fa,_0x51cb5e)[_0xe032('0x88')](function(_0x29e737){logger[_0xe032('0x5b')](_0xe032('0x107'),_0xe032('0x108')+_0x27061b['queue']+_0xe032('0x109')+_0x27061b[_0xe032('0x10a')],JSON['stringify'](_0x29e737));ami[_0xe032('0x28')]('custom:agentcalled',ut['buildObj'](_0x27061b,_0xe032('0x10b'),_0x3a854b[_0xe032('0x15')][_0x27061b[_0xe032('0x72')]]));_0x421aa2(ut[_0xe032('0x4f')](_0xe032('0x10c')));})[_0xe032('0x7c')](function(_0x5bc695){ut['logger'](_0xe032('0x10d'),_0x5bc695);_0xf15fc3(ut[_0xe032('0x4f')](_0xe032('0x10e'),_0x544176,_0x1c2c6b));});}else{_0x10c56e[_0xe032('0x10f')]+=0x1;ut['logBlacklist'](_0x27061b);rpcDb[_0xe032('0x110')](_0x27061b,_0xe032('0x111'));delete _0x3a854b[_0xe032('0x17')][_0x3ef62b];_0xf15fc3(ut[_0xe032('0x4f')](_0xe032('0x112'),_0x544176,_0x1c2c6b));}});};Preview['prototype'][_0xe032('0x113')]=function(_0x5c6971){return!_[_0xe032('0x6e')](_0x5c6971)&&!_[_0xe032('0x6e')](_0x5c6971[_0xe032('0x2a')])&&!_[_0xe032('0x6e')](_0x5c6971[_0xe032('0x54')])&&_0x5c6971[_0xe032('0x54')]&&!_['isNil'](this['trunks'][util[_0xe032('0x58')](_0xe032('0x114'),_0x5c6971[_0xe032('0x2a')])])&&!_[_0xe032('0x6e')](this[_0xe032('0x16')][util[_0xe032('0x58')](_0xe032('0x114'),_0x5c6971['name'])]['status'])&&(this[_0xe032('0x16')][util[_0xe032('0x58')](_0xe032('0x114'),_0x5c6971[_0xe032('0x2a')])][_0xe032('0x7a')]===_0xe032('0x115')||this[_0xe032('0x16')][util[_0xe032('0x58')](_0xe032('0x114'),_0x5c6971[_0xe032('0x2a')])]['status']==='unmonitored');};Preview[_0xe032('0x10')][_0xe032('0x8e')]=function(_0x45a2cf,_0x153907){var _0x5d3b09=this;return new BPromise(function(_0x7a4203,_0x30bb27){_0x5d3b09[_0xe032('0x116')](_0x45a2cf,_0x153907)['then'](function(_0x929ee0){_0x7a4203(_['pick'](_0x929ee0,[_0xe032('0x4f')]));})[_0xe032('0x7c')](function(_0x331663){if(_0x331663[_0xe032('0x117')]){rpcDb[_0xe032('0x118')](_0x45a2cf);}if(_0x331663[_0xe032('0x54')]){rpcDb[_0xe032('0x91')](_0x45a2cf);}_0x30bb27(_[_0xe032('0x74')](_0x331663,[_0xe032('0x4f')]));});});};Preview[_0xe032('0x10')][_0xe032('0x116')]=function(_0x60fb33,_0x1765a0){var _0x2f80f7=this;return new BPromise(function(_0x5e3a6c,_0x48e5f0){var _0x2a7c3c,_0xb35e25;rpcDb['getContactPreview'](_0x60fb33)['then'](function(_0x2e08a){if(!_[_0xe032('0x6e')](_0x2e08a[0x0])){_0xb35e25=_0x2e08a[0x0]['recallme']?![]:!![];_0x2a7c3c=_0x2e08a[0x0][_0xe032('0x119')]?!![]:![];_0x2a7c3c=_0x1765a0?!![]:_0x2a7c3c;}var _0x1b9171=_0x2f80f7[_0xe032('0x11a')](_0x2e08a);if(_0x1b9171[_0xe032('0x11b')]){rpcDb[_0xe032('0x11c')](_[_0xe032('0x74')](_0x2e08a[0x0],[_0xe032('0x77'),_0xe032('0x11d')]))[_0xe032('0x88')](function(_0x2910cb){_0x2f80f7[_0xe032('0x102')](_0x2910cb,_0x2e08a[0x0],_0x1765a0,_0xb35e25,_0x2a7c3c)[_0xe032('0x88')](function(_0x3e23fc){_0x5e3a6c(_0x3e23fc);})['catch'](function(_0xbd80b5){_0x48e5f0(_0xbd80b5);});})['catch'](function(_0x505ac3){ut['logger'](_0xe032('0x11e'),_0x505ac3);_0x48e5f0(ut[_0xe032('0x4f')](_0xe032('0x11f'),_0xb35e25,_0x2a7c3c));});}else{_0x48e5f0(ut[_0xe032('0x4f')](_0x1b9171[_0xe032('0x4f')],_0xb35e25,_0x2a7c3c));}})[_0xe032('0x7c')](function(_0x1a0365){ut[_0xe032('0x67')](_0xe032('0x120'),_0x1a0365);_0x48e5f0(ut[_0xe032('0x4f')](_0xe032('0x11f'),![],!![]));});});};Preview[_0xe032('0x10')][_0xe032('0x11a')]=function(_0x25e71a){if(_[_0xe032('0x6e')](_0x25e71a)||_['isEmpty'](_0x25e71a)||!_[_0xe032('0x6e')](_0x25e71a[0x0]['Agent'])&&_[_0xe032('0x6e')](_0x25e71a[0x0][_0xe032('0x8c')][_0xe032('0x2a')])){ut[_0xe032('0x67')](_0xe032('0x121'),_0x25e71a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5d4e05=this[_0xe032('0x15')][_0x25e71a[0x0]['Queue'][_0xe032('0x2a')]];_0x5d4e05[_0xe032('0x4f')]=_0xe032('0x122');if(_[_0xe032('0x6e')](_0x5d4e05)){ut['logger'](_0xe032('0x123'),_0x5d4e05);return{'isValid':![],'message':_0xe032('0x124')};}if(!this[_0xe032('0x113')](_0x5d4e05['Trunk'])){ut[_0xe032('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xe032('0x125')+_0x5d4e05[_0xe032('0x2a')]+_0xe032('0x126'));if(!this[_0xe032('0x113')](_0x5d4e05[_0xe032('0x9f')])){ut[_0xe032('0x67')](_0xe032('0x127'),_0x5d4e05[_0xe032('0x2a')]+_0xe032('0x128'));return{'isValid':![],'message':_0xe032('0x129')};}}if(!ut['isActive'](_0x5d4e05[_0xe032('0x37')])){ut[_0xe032('0x67')]('[Preview][validateContact][Campaign\x20Active]',_0x5d4e05[_0xe032('0x2a')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe032('0x125')+_0x5d4e05[_0xe032('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xe032('0x12a')};};Preview[_0xe032('0x10')]['execCall']=function(_0x10c773,_0x2ea03e,_0x237f51,_0x3f2ba5){var _0x1e609c=this;return new BPromise(function(_0x56a1ba,_0x3e38ce){var _0x36bad3=_0x10c773[_0xe032('0xb7')];var _0xed7401=_0x1e609c[_0xe032('0x113')](_0x2ea03e[_0xe032('0x53')])?util[_0xe032('0x58')]('SIP/%s/%s%s',_0x2ea03e[_0xe032('0x53')][_0xe032('0x2a')],_[_0xe032('0x6e')](_0x2ea03e['dialPrefix'])?'':_0x2ea03e[_0xe032('0x3b')][_0xe032('0x12b')]()||'',_0x2ea03e[_0xe032('0x12c')]>0x0?_0x237f51['Contact'][_0xe032('0x12d')][_0xe032('0x12e')](_0x2ea03e[_0xe032('0x12c')]):_0x237f51[_0xe032('0x12f')]['phone']):util[_0xe032('0x58')](_0xe032('0x130'),_[_0xe032('0x6e')](_0x2ea03e[_0xe032('0x9f')])?_0x2ea03e[_0xe032('0x53')]['name']:_0x2ea03e[_0xe032('0x9f')]['name'],_[_0xe032('0x6e')](_0x2ea03e[_0xe032('0x3b')])?'':_0x2ea03e[_0xe032('0x3b')]['trim']()||'',_0x2ea03e[_0xe032('0x12c')]>0x0?_0x237f51[_0xe032('0x12f')][_0xe032('0x12d')][_0xe032('0x12e')](_0x2ea03e[_0xe032('0x12c')]):_0x237f51[_0xe032('0x12f')]['phone']);var _0x1b452d=_0x1e609c[_0xe032('0x113')](_0x2ea03e[_0xe032('0x53')])?ut[_0xe032('0x131')](_0x2ea03e[_0xe032('0x53')][_0xe032('0x55')],_0x2ea03e[_0xe032('0x39')],_0x2ea03e[_0xe032('0x132')]>0x0?ut[_0xe032('0x133')](_0x2ea03e[_0xe032('0x134')],_0x2ea03e[_0xe032('0x132')]):_0x2ea03e[_0xe032('0x134')]):ut[_0xe032('0x131')](_[_0xe032('0x6e')](_0x2ea03e[_0xe032('0x9f')])?_0x2ea03e[_0xe032('0x53')][_0xe032('0x55')]:_0x2ea03e[_0xe032('0x9f')]['callerid'],_0x2ea03e[_0xe032('0x39')],_0x2ea03e['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe032('0x133')](_0x2ea03e[_0xe032('0x134')],_0x2ea03e[_0xe032('0x132')]):_0x2ea03e[_0xe032('0x134')]);if(_0x1b452d){_0x10c773['originatecalleridname']=ut[_0xe032('0x135')](_0x1b452d);_0x10c773[_0xe032('0x136')]=ut[_0xe032('0x137')](_0x1b452d);}var _0x518512=ut[_0xe032('0x138')](_0x2ea03e,_0x237f51,_0xed7401,_0x1b452d,_0x36bad3,_0x10c773);_[_0xe032('0x139')](_0x10c773,ut['toLowerVariables'](_0x518512));_0x10c773[_0xe032('0x92')]=moment()[_0xe032('0x58')](_0xe032('0x93'));ami[_0xe032('0x79')](ut[_0xe032('0x13a')](_0x10c773,_0x2ea03e,_0x518512,_0x10c773[_0xe032('0xb2')],_0x3f2ba5))['then'](function(_0x5a941b){_0x2ea03e[_0xe032('0x60')]+=0x1;logger[_0xe032('0x5b')](_0xe032('0x13b'),_0x36bad3,_0xe032('0xb8'),_0x2ea03e[_0xe032('0x2a')],_0xe032('0x70'),_0x2ea03e[_0xe032('0x60')]);_0x56a1ba(_0x5a941b);})[_0xe032('0x7c')](function(_0x1d49ac){ut[_0xe032('0xf7')](_0x10c773,0xe,_0xe032('0x13c'));rpcDb[_0xe032('0xf9')](_0x10c773,_0xe032('0x13d'));_0x3e38ce(_0x1d49ac);});});};Preview[_0xe032('0x10')][_0xe032('0x13e')]=function(_0x2e7164){if(this[_0xe032('0x17')][_0x2e7164[_0xe032('0xc4')]]){this['actions'][_0x2e7164['linkedid']]['channel']=_0x2e7164[_0xe032('0x7b')];}};Preview[_0xe032('0x10')][_0xe032('0x1b')]=function(_0x2b2486){var _0x11a836=this;var _0xe8e235=this[_0xe032('0x17')][_0x2b2486[_0xe032('0x13f')]];if(_0xe8e235){if(_0xe8e235['lookAgent']&&this['agents'][_0xe8e235[_0xe032('0x104')]]){ut[_0xe032('0x140')](_0xe8e235,this[_0xe032('0x18')][_0xe8e235['lookAgent']][_0xe032('0x2a')],this[_0xe032('0x18')][_0xe8e235[_0xe032('0x104')]]['id']);}var _0x3d328d=_[_0xe032('0x141')](_0xe8e235);_0x3d328d['responsetime']=moment()['format'](_0xe032('0x93'));var _0x56b424=_0x11a836[_0xe032('0x15')][_0xe8e235[_0xe032('0x72')]];if(ut[_0xe032('0x142')](_0x2b2486[_0xe032('0x143')])){if(_0xe8e235[_0xe032('0xb1')]){rpcDb[_0xe032('0x118')](_0xe8e235[_0xe032('0x10a')]);}if(_0xe8e235[_0xe032('0xb2')]){rpcDb[_0xe032('0x91')](_0xe8e235[_0xe032('0x10a')]);}ami['emit']('custom:agentringnoanswer',ut[_0xe032('0xa7')](_0xe8e235,_0xe032('0x144'),this['campaignsPreview'][_0xe8e235['queue']]));this['callProgressDetectingAgent'](_0x3d328d,_0x56b424,_0x2b2486);}else{_0xe8e235[_0xe032('0x92')]=moment()[_0xe032('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x3d328d,0x4,'Answer');rpcDb['createAgentHistory'](_0x3d328d,_0xe032('0x145'));}}};Preview[_0xe032('0x10')][_0xe032('0x1e')]=function(_0x137f5e){var _0x4c3c03=this;var _0x9e7bc9=this[_0xe032('0x17')][_0x137f5e['linkedid']];var _0xec48f1;if(_0x9e7bc9){_0xec48f1=this[_0xe032('0x15')][_0x9e7bc9[_0xe032('0x72')]];logger[_0xe032('0x5b')](_0xe032('0x146'),_0x137f5e[_0xe032('0xc4')],_0xe032('0xb8'),_0xec48f1['name'],'pTalking:\x20',_0xec48f1[_0xe032('0x2f')]);}if(this['actions'][_0x137f5e['linkedid']]&&_0x137f5e['linkedid']!==_0x137f5e[_0xe032('0xb7')]){if(_0x137f5e[_0xe032('0x147')]==='16'&&this[_0xe032('0x17')][_0x137f5e[_0xe032('0xc4')]][_0xe032('0x73')]){this[_0xe032('0xa0')](_0x137f5e,_0x137f5e['linkedid'],_0x137f5e[_0xe032('0x147')]);}else if(this['actions'][_0x137f5e[_0xe032('0xc4')]][_0xe032('0x73')]){logger[_0xe032('0x5b')](_0xe032('0x148'),_0x137f5e['linkedid'],_0x137f5e[_0xe032('0x147')],'\x20Queue',_0xec48f1[_0xe032('0x2a')],'pTalking:\x20',_0xec48f1['pTalking']);this[_0xe032('0xa0')](_0x137f5e,_0x137f5e[_0xe032('0xc4')],_0x137f5e[_0xe032('0x147')]);}}else if(_0x9e7bc9&&_[_0xe032('0x6e')](_0x9e7bc9[_0xe032('0x149')])&&_0xec48f1[_0xe032('0x14a')]&&_0x137f5e[_0xe032('0xc4')]===_0x137f5e[_0xe032('0xb7')]&&_[_0xe032('0x6e')](_0x137f5e[_0xe032('0xff')])&&_0x137f5e[_0xe032('0x147')]==='16'&&_0x137f5e[_0xe032('0x14b')]==='6'&&_['isUndefined'](_0x9e7bc9['transfer'])){if(_0x9e7bc9[_0xe032('0xb1')]){rpcDb[_0xe032('0x118')](_0x9e7bc9[_0xe032('0x10a')]);}if(_0x9e7bc9[_0xe032('0xb2')]){rpcDb['disableContact'](_0x9e7bc9[_0xe032('0x10a')]);}_0x137f5e[_0xe032('0xff')]='22';this[_0xe032('0xf4')](_0x9e7bc9,_0xec48f1,_0x137f5e);}else if(_0x9e7bc9&&_0x9e7bc9['transfer']){if(_0x137f5e['cause']==='16'&&this[_0xe032('0x17')][_0x137f5e[_0xe032('0xc4')]]['dialAnswer']){logger[_0xe032('0x5b')](_0xe032('0x14c'),_0x137f5e[_0xe032('0xc4')],_0x137f5e[_0xe032('0x147')],_0xe032('0xb8'),_0xec48f1[_0xe032('0x2a')],_0xe032('0x71'),_0xec48f1[_0xe032('0x2f')]);this[_0xe032('0xa0')](_0x137f5e,_0x137f5e['linkedid'],_0x137f5e[_0xe032('0x147')]);}else if(this[_0xe032('0x17')][_0x137f5e['linkedid']][_0xe032('0x73')]){logger[_0xe032('0x5b')]('[syncHangup][talking][cause]',_0x137f5e[_0xe032('0xc4')],_0x137f5e['cause'],_0xe032('0xb8'),_0xec48f1[_0xe032('0x2a')],_0xe032('0x71'),_0xec48f1[_0xe032('0x2f')]);this[_0xe032('0xa0')](_0x137f5e,_0x137f5e[_0xe032('0xc4')],_0x137f5e['cause']);}}};Preview[_0xe032('0x10')][_0xe032('0x21')]=function(_0x43d5da){if(this[_0xe032('0x17')][_0x43d5da[_0xe032('0x14d')]]&&_0x43d5da[_0xe032('0x14d')]!==_0x43d5da[_0xe032('0x14e')]){this[_0xe032('0xa0')](_0x43d5da,_0x43d5da[_0xe032('0x14d')],_0x43d5da[_0xe032('0xee')]);}};Preview[_0xe032('0x10')]['syncHangupRequest']=function(_0x236570){if(this['actions'][_0x236570[_0xe032('0xc4')]]&&_0x236570['linkedid']!==_0x236570[_0xe032('0xb7')]&&!this[_0xe032('0x17')][_0x236570[_0xe032('0xc4')]]['dialAnswer']){if(_0x236570[_0xe032('0x147')]==='1'){this['callProgressDetectingCustomer'](_0x236570,_0x236570['linkedid'],_0x236570[_0xe032('0x147')]);}}};Preview[_0xe032('0x10')][_0xe032('0x14f')]=function(_0x2c8d1f,_0x463e72,_0xde79c2){if(this['actions'][_0x2c8d1f]){if(_[_0xe032('0x6e')](this[_0xe032('0x17')][_0x2c8d1f][_0xe032('0x150')])){this[_0xe032('0x17')][_0x2c8d1f][_0xe032('0x150')]={};}this[_0xe032('0x17')][_0x2c8d1f]['variables'][_0x463e72]=_0xde79c2;}};Preview[_0xe032('0x10')]['syncVarSet']=function(_0x45a3b7){try{if(!_[_0xe032('0x6e')](_0x45a3b7)){if(ut['filterKey'](_[_0xe032('0x151')](_0x45a3b7['variable'])[0x0])){this[_0xe032('0x14f')](_0x45a3b7[_0xe032('0xb7')],_[_0xe032('0x151')](_0x45a3b7[_0xe032('0x152')])[0x0],_0x45a3b7[_0xe032('0x153')]);}}}catch(_0x46f04f){logger['error'](_0xe032('0x154'),util[_0xe032('0x155')](_0x46f04f,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x430ebb){if(_0x430ebb){if(this[_0xe032('0x17')][_0x430ebb['transfertargetlinkedid']]){this['actions'][_0x430ebb['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe032('0x10')][_0xe032('0x26')]=function(_0x159be2){if(_0x159be2){if(this['actions'][_0x159be2[_0xe032('0x156')]]){this[_0xe032('0x17')][_0x159be2['transfererlinkedid']][_0xe032('0x157')]=!![];}}};module[_0xe032('0x158')]=Preview; \ No newline at end of file +var _0x9957=['[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','phone','substring','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','responsetime','response','idContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','syncCampaigns','preview','dialMethod','booked','clockClearZombieChannels','clearZombieChannels','hasOwnProperty','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','then','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','ANSWER','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer'];(function(_0x153696,_0x52a4f8){var _0x33268a=function(_0x339fed){while(--_0x339fed){_0x153696['push'](_0x153696['shift']());}};_0x33268a(++_0x52a4f8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var BPromise=require(_0x7995('0x2'));var uuid=require(_0x7995('0x3'));var moment=require('moment');var md5=require(_0x7995('0x4'));var Redis=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('preview');var loggerAction=require(_0x7995('0x7'))(_0x7995('0x8'));var ami=require(_0x7995('0x9'));var rpcDb=require(_0x7995('0xa'));var Action=require(_0x7995('0xb'));var ut=require(_0x7995('0xc'));config['redis']=_[_0x7995('0xd')](config[_0x7995('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x7995('0xf'))(new Redis(config[_0x7995('0xe')]));var Sequence=function(){};Sequence[_0x7995('0x10')][_0x7995('0x11')]=function(_0x3c1d19){this[_0x7995('0x12')]=this[_0x7995('0x12')]?this['tail'][_0x7995('0x13')](_0x3c1d19):_0x3c1d19();};function Preview(_0x41c652){this['sequence']=new Sequence();this[_0x7995('0x14')]=_0x41c652[_0x7995('0x15')];this[_0x7995('0x16')]=_0x41c652[_0x7995('0x16')];this[_0x7995('0x17')]={};this[_0x7995('0x18')]=_0x41c652[_0x7995('0x18')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x7995('0x19')][_0x7995('0x1a')](this));ami['on'](_0x7995('0x1b'),this[_0x7995('0x1c')][_0x7995('0x1a')](this));ami['on'](_0x7995('0x1d'),this[_0x7995('0x1e')][_0x7995('0x1a')](this));ami['on']('dialend',this[_0x7995('0x1f')]['bind'](this));ami['on'](_0x7995('0x20'),this[_0x7995('0x21')][_0x7995('0x1a')](this));ami['on'](_0x7995('0x22'),this[_0x7995('0x23')][_0x7995('0x1a')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x7995('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x7995('0x1a')](this));this[_0x7995('0x24')](this['campaignsPreview']);}function emit(_0x3a9b54,_0x51f276,_0x4b1a8e){io['to'](_0x3a9b54)[_0x7995('0x25')](_0x51f276,_0x4b1a8e);}function emitCampaignPreview(_0x327b1f){if(_0x327b1f[_0x7995('0x26')]===_0x7995('0x27')){var _0x460924={'id':_0x327b1f['id'],'name':_0x327b1f[_0x7995('0x28')],'strategy':_0x327b1f['strategy'],'answered':_0x327b1f[_0x7995('0x29')],'available':_0x327b1f[_0x7995('0x2a')],'loggedIn':_0x327b1f[_0x7995('0x2b')],'pTalking':_0x327b1f[_0x7995('0x2c')],'sumBillable':_0x327b1f[_0x7995('0x2d')],'sumDuration':_0x327b1f[_0x7995('0x2e')],'sumHoldTime':_0x327b1f[_0x7995('0x2f')]||0x0,'talking':_0x327b1f[_0x7995('0x30')],'total':_0x327b1f['total'],'type':_0x327b1f[_0x7995('0x26')],'unmanaged':_0x327b1f[_0x7995('0x31')],'abandoned':_0x327b1f[_0x7995('0x32')],'waiting':_0x327b1f[_0x7995('0x33')],'loggedInDb':_0x327b1f[_0x7995('0x34')],'dialActive':_0x327b1f[_0x7995('0x35')],'dialMethod':_0x327b1f['dialMethod'],'dialOriginateCallerIdName':_0x327b1f[_0x7995('0x36')],'dialOriginateCallerIdNumber':_0x327b1f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x327b1f[_0x7995('0x37')],'dialPrefix':_0x327b1f[_0x7995('0x38')],'outboundAnswerAgiCallsDay':_0x327b1f[_0x7995('0x39')],'outboundAnswerCallsDay':_0x327b1f[_0x7995('0x3a')],'outboundBlacklistCallsDay':_0x327b1f[_0x7995('0x3b')],'outboundBusyCallsDay':_0x327b1f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x327b1f[_0x7995('0x3c')],'outboundDropCallsDayACS':_0x327b1f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x327b1f[_0x7995('0x3d')],'outboundDropCallsDayTimeout':_0x327b1f[_0x7995('0x3e')],'outboundNoAnswerCallsDay':_0x327b1f[_0x7995('0x3f')],'outboundNoSuchCallsDay':_0x327b1f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x327b1f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x327b1f['outboundReCallsDay'],'outboundRejectCallsDay':_0x327b1f[_0x7995('0x40')],'outboundUnknownCallsDay':_0x327b1f[_0x7995('0x41')],'outboundAbandonedCallsDay':_0x327b1f[_0x7995('0x42')],'predictiveIntervalAnsweredCalls':_0x327b1f[_0x7995('0x43')],'predictiveIntervalAvgHoldtime':_0x327b1f[_0x7995('0x44')],'predictiveIntervalAvgTalktime':_0x327b1f[_0x7995('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x327b1f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x327b1f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x327b1f[_0x7995('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x327b1f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x327b1f[_0x7995('0x47')],'predictiveIntervalMultiplicativeFactor':_0x327b1f[_0x7995('0x48')],'predictiveIntervalPauses':_0x327b1f[_0x7995('0x49')],'predictiveIntervalAvailable':_0x327b1f[_0x7995('0x4a')],'predictiveIntervalTotalCalls':_0x327b1f[_0x7995('0x4b')],'message':_0x327b1f['message'],'originated':_0x327b1f[_0x7995('0x4c')],'erlangCalls':_0x327b1f[_0x7995('0x4d')],'erlangCallToSecond':_0x327b1f['erlangCallToSecond'],'erlangAbandonmentRate':_0x327b1f['erlangAbandonmentRate'],'erlangBusyFactor':_0x327b1f['erlangBusyFactor'],'startPredictive':_0x327b1f[_0x7995('0x4e')],'startProgressive':_0x327b1f[_0x7995('0x4f')]};if(_0x327b1f['Trunk']){_0x460924[_0x7995('0x50')]={'id':_0x327b1f['Trunk']['id'],'name':_0x327b1f[_0x7995('0x50')][_0x7995('0x28')],'active':_0x327b1f[_0x7995('0x50')]['active'],'callerid':_0x327b1f['Trunk'][_0x7995('0x51')]};}if(_0x327b1f['Interval']){_0x460924['Interval']={'id':_0x327b1f[_0x7995('0x52')]['id'],'name':_0x327b1f[_0x7995('0x52')]['name']};}var _0x1baa15=md5(JSON[_0x7995('0x53')](_0x460924));if(_0x327b1f[_0x7995('0x4')]!==_0x1baa15){_0x327b1f[_0x7995('0x4')]=_0x1baa15;emit(util[_0x7995('0x54')]('voice:queue:%s',_0x460924[_0x7995('0x28')]),_0x7995('0x55'),_0x460924);}}}function emitVoiceQueueChannelRemove(_0xf612e6){logger[_0x7995('0x56')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x7995('0x53')](_0xf612e6));emit(util[_0x7995('0x54')](_0x7995('0x57'),_0xf612e6[_0x7995('0x28')]),_0x7995('0x58'),_0xf612e6);io[_0x7995('0x25')]('voice_queue_presence:remove',_0xf612e6);}function notSendMessagesQueue(_0x183a68){if(_0x183a68[_0x7995('0x59')]){if(_0x183a68[_0x7995('0x4c')]===0x0&&_0x183a68[_0x7995('0x2c')]===0x0){_0x183a68[_0x7995('0x59')]=![];_0x183a68[_0x7995('0x2a')]=0x0;_0x183a68[_0x7995('0x5a')]=0x0;_0x183a68[_0x7995('0x5b')]=_0x7995('0x5c');ut[_0x7995('0x5d')](_0x7995('0x5e'),_0x183a68[_0x7995('0x28')]+_0x7995('0x5f'));}else{_0x183a68['message']='IS_DISACTIVED';ut[_0x7995('0x5d')](_0x7995('0x5e'),_0x183a68['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x183a68);}}Preview[_0x7995('0x10')]['loopCampaigns']=function(){var _0x504a33=this;setInterval(function(){_0x504a33[_0x7995('0x60')]();},0x7cf);};Preview[_0x7995('0x10')][_0x7995('0x60')]=function(){var _0x576b96=this[_0x7995('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x3993b5 in _0x576b96){if(_0x576b96['hasOwnProperty'](_0x3993b5)&&(_0x576b96[_0x3993b5]['dialMethod']===_0x7995('0x61')||_0x576b96[_0x3993b5][_0x7995('0x62')]===_0x7995('0x63'))&&_0x576b96[_0x3993b5][_0x7995('0x26')]==='outbound'){if(this[_0x7995('0x64')]>0x7){this[_0x7995('0x64')]=0x0;this[_0x7995('0x65')]();}}if(_0x576b96[_0x7995('0x66')](_0x3993b5)&&_0x576b96[_0x3993b5]['dialMethod']==='preview'&&_0x576b96[_0x3993b5][_0x7995('0x26')]==='outbound'){if(_0x576b96[_0x3993b5][_0x7995('0x35')]){this['setMessage'](_0x576b96[_0x3993b5]);if(_0x576b96[_0x3993b5][_0x7995('0x67')])this['recallMe'](_0x576b96[_0x3993b5]);}else{notSendMessagesQueue(_0x576b96[_0x3993b5]);}}}};Preview[_0x7995('0x10')][_0x7995('0x68')]=function(_0x4d9245){var _0x3e9e62=this;this[_0x7995('0x69')][_0x7995('0x11')](function(){if(!_[_0x7995('0x6a')](_0x3e9e62['actions'][_0x4d9245])){loggerAction[_0x7995('0x56')](_0x7995('0x6b'),_0x4d9245,_0x7995('0x6c'),_0x3e9e62['actions'][_0x4d9245][_0x7995('0x6d')],_0x7995('0x6e'),JSON[_0x7995('0x53')](_0x3e9e62[_0x7995('0x14')][_0x3e9e62[_0x7995('0x17')][_0x4d9245]['queue']][_0x7995('0x4c')]),_0x7995('0x6f'),JSON['stringify'](_0x3e9e62[_0x7995('0x14')][_0x3e9e62['actions'][_0x4d9245][_0x7995('0x6d')]][_0x7995('0x2c')]),JSON[_0x7995('0x53')](_0x3e9e62[_0x7995('0x17')][_0x4d9245][_0x7995('0x70')]),JSON[_0x7995('0x53')](_[_0x7995('0x71')](_0x3e9e62['actions'][_0x4d9245],[_0x7995('0x72'),_0x7995('0x73'),_0x7995('0x74'),'ListId'])));return ami[_0x7995('0x75')]({'action':_0x7995('0x76'),'channel':_0x3e9e62[_0x7995('0x17')][_0x4d9245]['channel']})['catch'](function(_0x5a592e){if(_0x5a592e[_0x7995('0x5b')]===_0x7995('0x77')){setTimeout(function(){if(_0x3e9e62['actions'][_0x4d9245]){ut[_0x7995('0x78')](_0x3e9e62[_0x7995('0x14')][_0x3e9e62[_0x7995('0x17')][_0x4d9245][_0x7995('0x6d')]],_0x7995('0x79'));if(_0x3e9e62['actions'][_0x4d9245][_0x7995('0x70')]===!![]){ut['decrementTalkink'](_0x3e9e62[_0x7995('0x14')][_0x3e9e62[_0x7995('0x17')][_0x4d9245][_0x7995('0x6d')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d9245,_0x3e9e62['actions'][_0x4d9245][_0x7995('0x6d')]);}ut[_0x7995('0x7a')](_0x7995('0x7b')+_0x4d9245,_0x3e9e62[_0x7995('0x17')][_0x4d9245][_0x7995('0x6d')]);delete _0x3e9e62[_0x7995('0x17')][_0x4d9245];}},0x2328);}});}});};Preview[_0x7995('0x10')][_0x7995('0x65')]=function(){var _0x328671=this;loggerAction[_0x7995('0x56')](_0x7995('0x7c'),_[_0x7995('0x7d')](this[_0x7995('0x17')]));for(var _0x35bea3 in this[_0x7995('0x17')]){if(_0x328671[_0x7995('0x17')][_0x7995('0x66')](_0x35bea3)){_0x328671[_0x7995('0x68')](_0x35bea3);}}};Preview[_0x7995('0x10')]['recallMe']=function(_0x56a374){var _0x630737=this;rpcDb[_0x7995('0x7e')](_0x56a374['id'],ut[_0x7995('0x7f')](this['agents']))['then'](function(_0x402fa0){if(!_[_0x7995('0x6a')](_0x402fa0)){for(var _0x5b9467=0x0;_0x5b9467<_0x402fa0[_0x7995('0x80')];_0x5b9467+=0x1){if(ut['getDiff'](_0x402fa0[_0x5b9467][_0x7995('0x81')])<_0x56a374[_0x7995('0x82')]*0x3c){if(_0x402fa0[_0x5b9467][_0x7995('0x83')]&&!_0x402fa0[_0x5b9467][_0x7995('0x83')]['voicePause']){_0x630737['run'](_0x402fa0[_0x5b9467]['id'])[_0x7995('0x84')](ut[_0x7995('0x85')](_0x7995('0x86')))[_0x7995('0x87')](ut[_0x7995('0x85')](_0x7995('0x86')));}else{rpcDb[_0x7995('0x88')](_0x402fa0[_0x5b9467]['id']);}}else{var _0x1e2206=new Action(_0x402fa0[_0x5b9467],_0x56a374);_0x1e2206[_0x7995('0x89')]=moment()['format'](_0x7995('0x8a'));_0x56a374[_0x7995('0x8b')]+=0x1;ut[_0x7995('0x8c')](_0x1e2206,0x17,_0x7995('0x8d'));if(_0x56a374['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x7995('0x8e')](_0x402fa0[_0x5b9467]));rpcDb[_0x7995('0x8f')](_0x1e2206,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x7995('0x8c')](_0x1e2206,0x16,_0x7995('0x90'));rpcDb[_0x7995('0x8f')](_0x1e2206,_0x7995('0x91'));rpcDb[_0x7995('0x92')](_0x1e2206,'[HistoryRecallClose]');}}}}})[_0x7995('0x87')](ut['logger2'](_0x7995('0x93')));};Preview[_0x7995('0x10')][_0x7995('0x94')]=function(_0x25b534){_0x25b534[_0x7995('0x59')]=!![];if(ut[_0x7995('0x95')](_0x25b534[_0x7995('0x2b')])){_0x25b534[_0x7995('0x5b')]=_0x7995('0x96');}else if(!ut[_0x7995('0x97')](_0x25b534[_0x7995('0x35')])){_0x25b534[_0x7995('0x5b')]='NOT_ACTIVE';}else if(!this[_0x7995('0x98')](_0x25b534[_0x7995('0x50')])){if(!this[_0x7995('0x98')](_0x25b534[_0x7995('0x99')])){_0x25b534[_0x7995('0x5b')]='TRUNK_IS_NOT_REACHABLE';}else{_0x25b534['message']=_0x7995('0x9a');}}else{_0x25b534[_0x7995('0x5b')]=_0x7995('0x9a');}emitCampaignPreview(_0x25b534);};Preview[_0x7995('0x10')]['callProgressDetectingCustomer']=function(_0x22d317,_0x50a12e,_0x5df621){var _0xca8238=this;var _0x36d27d=this[_0x7995('0x17')][_0x50a12e];var _0x44bf2b=this[_0x7995('0x14')][_0x36d27d[_0x7995('0x6d')]];var _0x32a52f;if(_0x44bf2b){switch(_0x5df621){case'1':_0x44bf2b[_0x7995('0x9b')]+=0x1;_0x36d27d[_0x7995('0x9c')]+=0x1;_0x36d27d[_0x7995('0x9d')]=ut['totalGlobal'](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x0,_0x7995('0x9e'));ami[_0x7995('0x25')]('custom:agentnosuchnumber',ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xa0')));rpcDb[_0x7995('0x8f')](_0x36d27d,_0x7995('0xa1'));if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut[_0x7995('0xa4')](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb[_0x7995('0x92')](_0x32a52f,_0x7995('0xa6'));}else{if(_0x36d27d[_0x7995('0x9c')]>=_0x44bf2b['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x36d27d,_0x7995('0xa6'));}else{rpcDb[_0x7995('0xa7')](ut[_0x7995('0xa8')](_0x36d27d,_0x7995('0x9c'),_0x44bf2b['dialNoSuchNumberRetryFrequency']),_0x36d27d[_0x7995('0xa9')],_0x36d27d[_0x7995('0xaa')]);}}delete this['actions'][_0x22d317['linkedid']];break;case _0x7995('0xab'):var _0x305b5a=moment()['format'](_0x7995('0x8a'));_0x36d27d['responsetime']=_0x305b5a;_0x36d27d[_0x7995('0xac')]=_0x305b5a;_0x36d27d[_0x7995('0x70')]=!![];_0x44bf2b['pTalking']+=0x1;logger['info'](_0x7995('0xad'),_0x36d27d['uniqueid'],_0x7995('0xae'),_0x44bf2b[_0x7995('0x28')],_0x7995('0x6f'),_0x44bf2b[_0x7995('0x2c')]);ami[_0x7995('0x25')](_0x7995('0xaf'),ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xb0'),this[_0x7995('0x14')][_0x36d27d[_0x7995('0x6d')]]));if(_0x44bf2b[_0x7995('0xb1')]){ami[_0x7995('0x25')](_0x7995('0xb2'),ut[_0x7995('0xb3')](_0x36d27d));}break;case'16':ami[_0x7995('0x25')](_0x7995('0xb4'),ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xb5'),this[_0x7995('0x14')][_0x36d27d[_0x7995('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xb5')));_0x44bf2b[_0x7995('0x3a')]+=0x1;_0x44bf2b[_0x7995('0xb6')]+=0x1;_0x44bf2b[_0x7995('0x29')]+=0x1;ut[_0x7995('0xb7')](_0x44bf2b,_0x7995('0xb8'));_0x36d27d[_0x7995('0x9d')]=ut['totalGlobal'](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x4,_0x7995('0xb9'));rpcDb['createCustomerHistory'](_0x36d27d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xba'));rpcDb[_0x7995('0xbb')](_0x36d27d);_0x44bf2b[_0x7995('0x2e')]+=_0x36d27d[_0x7995('0xbc')];_0x44bf2b[_0x7995('0x2d')]+=_0x36d27d['talktime'];logger[_0x7995('0x56')](_0x7995('0xbd'),_0x36d27d[_0x7995('0xbe')],_0x7995('0xae'),_0x44bf2b[_0x7995('0x28')],_0x7995('0x6f'),_0x44bf2b[_0x7995('0x2c')]);delete this[_0x7995('0x17')][_0x22d317['linkedid']];break;case _0x7995('0xbf'):_0x44bf2b[_0x7995('0xc0')]+=0x1;_0x36d27d['countbusyretry']+=0x1;_0x36d27d['countglobal']=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x5,_0x7995('0xc1'));ami[_0x7995('0x25')](_0x7995('0xc2'),ut['buildObj'](_0x36d27d,_0x7995('0xc3')));rpcDb[_0x7995('0x8f')](_0x36d27d,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut['cloneAction'](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb['createCustomerFinal'](_0x32a52f,_0x7995('0xc4'));}else{if(_0x36d27d[_0x7995('0xc5')]>=_0x44bf2b[_0x7995('0xc6')]){rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xc7'));}else{rpcDb['rescheduleContact'](ut[_0x7995('0xa8')](_0x36d27d,_0x7995('0xc5'),_0x44bf2b[_0x7995('0xc8')]),_0x36d27d['unlockAgent'],_0x36d27d[_0x7995('0xaa')]);}}break;case _0x7995('0xc9'):_0x44bf2b[_0x7995('0x3f')]+=0x1;_0x36d27d[_0x7995('0xca')]+=0x1;_0x36d27d['countglobal']=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x3,_0x7995('0xcb'));ami['emit']('custom:agentnoanswer',ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xcc')));rpcDb['createCustomerHistory'](_0x36d27d,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut[_0x7995('0xa4')](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb[_0x7995('0x92')](_0x32a52f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x36d27d['countnoanswerretry']>=_0x44bf2b[_0x7995('0xcd')]){rpcDb['createCustomerFinal'](_0x36d27d,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x7995('0xa7')](ut[_0x7995('0xa8')](_0x36d27d,_0x7995('0xca'),_0x44bf2b['dialNoAnswerRetryFrequency']),_0x36d27d[_0x7995('0xa9')],_0x36d27d[_0x7995('0xaa')]);}}break;case _0x7995('0xce'):_0x44bf2b[_0x7995('0x3c')]+=0x1;_0x36d27d[_0x7995('0xcf')]+=0x1;_0x36d27d['countglobal']=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x8,_0x7995('0xd0'));ami[_0x7995('0x25')]('custom:agentcongestion',ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xd1')));rpcDb['createCustomerHistory'](_0x36d27d,_0x7995('0xd2'));if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b['dialGlobalMaxRetry']){_0x32a52f=ut[_0x7995('0xa4')](_0x36d27d,0xf,'Global');rpcDb[_0x7995('0x92')](_0x32a52f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x36d27d[_0x7995('0xcf')]>=_0x44bf2b['dialCongestionMaxRetry']){rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xd2'));}else{rpcDb['rescheduleContact'](ut[_0x7995('0xa8')](_0x36d27d,'countcongestionretry',_0x44bf2b['dialBusyRetryFrequency']),_0x36d27d[_0x7995('0xa9')],_0x36d27d[_0x7995('0xaa')]);}}break;case _0x7995('0xd3'):_0x44bf2b[_0x7995('0x40')]+=0x1;_0x36d27d['countagentrejectretry']+=0x1;_0x36d27d[_0x7995('0x9d')]=ut[_0x7995('0xa2')](_0x36d27d);ut['logCustomer'](_0x36d27d,0x14,'AgentReject');ami[_0x7995('0x25')]('custom:agentreject',ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xd4')));rpcDb[_0x7995('0x8f')](_0x36d27d,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut['cloneAction'](_0x36d27d,0x14,_0x7995('0xd5'));rpcDb[_0x7995('0x92')](_0x32a52f,_0x7995('0xd6'));}else{if(_0x36d27d[_0x7995('0xd7')]>=_0x44bf2b['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x36d27d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x7995('0xa7')](ut[_0x7995('0xa8')](_0x36d27d,_0x7995('0xd7'),_0x44bf2b[_0x7995('0xd8')]),_0x36d27d[_0x7995('0xa9')],_0x36d27d[_0x7995('0xaa')]);}}break;case'ABANDONED':_0x44bf2b['outboundAbandonedCallsDay']+=0x1;_0x36d27d[_0x7995('0xd9')]+=0x1;_0x36d27d['countglobal']=ut['totalGlobal'](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x36d27d,_0x7995('0xda'));if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut['cloneAction'](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb[_0x7995('0x92')](_0x32a52f,_0x7995('0xda'));}else{if(_0x36d27d[_0x7995('0xdb')]>=_0x44bf2b[_0x7995('0xdc')]){rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xda'));}else{rpcDb[_0x7995('0xa7')](ut[_0x7995('0xa8')](_0x36d27d,'countabandonedretry',_0x44bf2b[_0x7995('0xdd')]),_0x36d27d[_0x7995('0xa9')],_0x36d27d[_0x7995('0xaa')]);}}break;case'18':_0x44bf2b[_0x7995('0x41')]+=0x1;_0x36d27d[_0x7995('0xde')]+=0x1;_0x36d27d['countglobal']=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x12,_0x22d317[_0x7995('0xdf')]||_0x22d317['dialstatus']);ami['emit']('custom:amd',ut[_0x7995('0x9f')](_0x36d27d,_0x7995('0xe0')));rpcDb[_0x7995('0x8f')](_0x36d27d,_0x7995('0xe1'));if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut['cloneAction'](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb['createCustomerFinal'](_0x32a52f,_0x7995('0xe1'));}else{rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xe1'));}delete this[_0x7995('0x17')][_0x22d317[_0x7995('0xe2')]];break;case'19':_0x44bf2b[_0x7995('0x41')]+=0x1;_0x36d27d[_0x7995('0x9d')]=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0x13,_0x22d317[_0x7995('0xdf')]||_0x22d317[_0x7995('0xe3')]);ami['emit'](_0x7995('0xe4'),ut['buildObj'](_0x36d27d,_0x7995('0xe0')));rpcDb[_0x7995('0x8f')](_0x36d27d,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x36d27d)>=_0x44bf2b[_0x7995('0xa3')]){_0x32a52f=ut[_0x7995('0xa4')](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb[_0x7995('0x92')](_0x32a52f,_0x7995('0xe5'));}else{rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xe5'));}delete this[_0x7995('0x17')][_0x22d317[_0x7995('0xe2')]];break;default:if(_0x36d27d[_0x7995('0x70')]){ut[_0x7995('0xb7')](_0x44bf2b,_0x7995('0xe6'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x44bf2b[_0x7995('0x28')],_0x22d317);}_0x44bf2b[_0x7995('0x41')]+=0x1;_0x36d27d[_0x7995('0x9d')]=ut[_0x7995('0xa2')](_0x36d27d);ut[_0x7995('0x8c')](_0x36d27d,0xc,_0x22d317['cause-txt']||_0x22d317[_0x7995('0xe3')]);rpcDb[_0x7995('0x8f')](_0x36d27d,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x7995('0xa2')](_0x36d27d)>=_0x44bf2b['dialGlobalMaxRetry']){_0x32a52f=ut[_0x7995('0xa4')](_0x36d27d,0xf,_0x7995('0xa5'));rpcDb[_0x7995('0x92')](_0x32a52f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x7995('0x92')](_0x36d27d,_0x7995('0xe7'));}delete this[_0x7995('0x17')][_0x22d317[_0x7995('0xe2')]];}if(!(_0x36d27d[_0x7995('0x70')]&&_0x5df621==='16')){ut[_0x7995('0x78')](_0x44bf2b,_0x7995('0xe8'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x36d27d['uniqueid'],_0x7995('0xae'),_0x44bf2b[_0x7995('0x28')],'originated:\x20',_0x44bf2b['originated']);}if(_0x5df621!==_0x7995('0xab')){delete this[_0x7995('0x17')][_0x22d317['linkedid']];delete this['actions'][_0x22d317['destlinkedid']];}}};Preview['prototype'][_0x7995('0xe9')]=function(_0x15ae93,_0x346484,_0x421e44){if(_['isUndefined'](_0x346484)&&_0x7995('0xea')!==typeof _0x346484){return;}if(_[_0x7995('0xeb')](_0x421e44)&&'object'!==typeof _0x421e44){return;}switch(_0x421e44[_0x7995('0xec')]){case'0':ut[_0x7995('0xed')](_0x15ae93,0x0,_0x7995('0x9e'));rpcDb['createAgentHistory'](_0x15ae93,_0x7995('0xee'));break;case'3':ut[_0x7995('0xed')](_0x15ae93,0x3,'NoAnswer');rpcDb[_0x7995('0xef')](_0x15ae93,_0x7995('0xf0'));break;case'5':ut[_0x7995('0xed')](_0x15ae93,0x5,_0x7995('0xc1'));rpcDb[_0x7995('0xef')](_0x15ae93,_0x7995('0xf1'));break;case'8':ut[_0x7995('0xed')](_0x15ae93,0x8,_0x7995('0xd0'));rpcDb[_0x7995('0xef')](_0x15ae93,_0x7995('0xf2'));break;case'22':ut[_0x7995('0xed')](_0x15ae93,0x16,_0x7995('0xf3'));rpcDb[_0x7995('0xef')](_0x15ae93,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x7995('0xed')](_0x15ae93,0xc,_0x421e44[_0x7995('0xec')]);rpcDb[_0x7995('0xef')](_0x15ae93,_0x7995('0xf2'));}ut['updateOriginated'](_0x346484,_0x7995('0xf4'));logger[_0x7995('0x56')](_0x7995('0xf5'),_0x15ae93['uniqueid'],_0x7995('0xae'),_0x346484[_0x7995('0x28')],_0x7995('0x6e'),_0x346484[_0x7995('0x4c')]);delete this[_0x7995('0x17')][_0x15ae93[_0x7995('0xbe')]];};Preview[_0x7995('0x10')]['checkInBlack']=function(_0x35dbd7,_0x4efc7f,_0x101bc6,_0x164c61,_0x2190d1){var _0x4cae1c=this;return new BPromise(function(_0xd012b9,_0x5a1892){if(_['isNil'](_0x4efc7f)||_['isNil'](_0x4efc7f['Contact'])||_[_0x7995('0x6a')](_0x4efc7f[_0x7995('0xf6')]['phone'])||_[_0x7995('0x6a')](_0x4efc7f[_0x7995('0x74')])){_0x5a1892(ut['message'](_0x7995('0xf7'),_0x164c61,_0x2190d1));return;}var _0xb80394=uuid['v4']();var _0x3e935f=_0x4cae1c[_0x7995('0x14')][_0x4efc7f[_0x7995('0x6c')]['name']];var _0x38ea3e=_0x101bc6?_0x4cae1c[_0x7995('0x18')][_0x101bc6]['id']:undefined;_0x4cae1c[_0x7995('0x17')][_0xb80394]=new Action(_0x4efc7f,_0x3e935f,_0xb80394,_0x101bc6,_0x38ea3e);var _0x186ebe=_0x4cae1c['actions'][_0xb80394];_0x186ebe[_0x7995('0xa9')]=_0x164c61;_0x186ebe[_0x7995('0xaa')]=_0x2190d1;_0x186ebe[_0x7995('0xf8')]=_0x101bc6;if(_[_0x7995('0xf9')](_0x35dbd7)){_0x4cae1c[_0x7995('0xfa')](_0x186ebe,_0x3e935f,_0x4efc7f,_0x101bc6)[_0x7995('0x84')](function(_0x30ad6e){logger[_0x7995('0x56')](_0x7995('0xfb'),_0x7995('0xfc')+_0x186ebe['queue']+_0x7995('0xfd')+_0x186ebe['idContact'],JSON[_0x7995('0x53')](_0x30ad6e));ami[_0x7995('0x25')](_0x7995('0xfe'),ut['buildObj'](_0x186ebe,'called',_0x4cae1c[_0x7995('0x14')][_0x186ebe[_0x7995('0x6d')]]));_0xd012b9(ut['message'](_0x7995('0xff')));})['catch'](function(_0x43de18){ut[_0x7995('0x5d')](_0x7995('0x100'),_0x43de18);_0x5a1892(ut[_0x7995('0x5b')]('Call\x20failed',_0x164c61,_0x2190d1));});}else{_0x3e935f['outboundBlacklistCallsDay']+=0x1;ut[_0x7995('0x101')](_0x186ebe);rpcDb[_0x7995('0x102')](_0x186ebe,_0x7995('0x103'));delete _0x4cae1c[_0x7995('0x17')][_0xb80394];_0x5a1892(ut['message'](_0x7995('0x104'),_0x164c61,_0x2190d1));}});};Preview[_0x7995('0x10')][_0x7995('0x98')]=function(_0x241427){return!_[_0x7995('0x6a')](_0x241427)&&!_['isNil'](_0x241427['name'])&&!_['isNil'](_0x241427[_0x7995('0x105')])&&_0x241427[_0x7995('0x105')]&&!_['isNil'](this[_0x7995('0x16')][util['format'](_0x7995('0x106'),_0x241427[_0x7995('0x28')])])&&!_[_0x7995('0x6a')](this[_0x7995('0x16')][util['format'](_0x7995('0x106'),_0x241427[_0x7995('0x28')])][_0x7995('0x76')])&&(this[_0x7995('0x16')][util[_0x7995('0x54')](_0x7995('0x106'),_0x241427[_0x7995('0x28')])][_0x7995('0x76')]===_0x7995('0x107')||this[_0x7995('0x16')][util[_0x7995('0x54')](_0x7995('0x106'),_0x241427[_0x7995('0x28')])][_0x7995('0x76')]==='unmonitored');};Preview[_0x7995('0x10')]['run']=function(_0x5dc3e5,_0xbd6c64){var _0x5cf7b2=this;return new BPromise(function(_0x433bb2,_0x55dc6c){_0x5cf7b2[_0x7995('0x108')](_0x5dc3e5,_0xbd6c64)[_0x7995('0x84')](function(_0x4ea477){_0x433bb2(_['pick'](_0x4ea477,['message']));})[_0x7995('0x87')](function(_0x198867){if(_0x198867[_0x7995('0x109')]){rpcDb[_0x7995('0x10a')](_0x5dc3e5);}if(_0x198867['active']){rpcDb[_0x7995('0x88')](_0x5dc3e5);}_0x55dc6c(_[_0x7995('0x71')](_0x198867,[_0x7995('0x5b')]));});});};Preview[_0x7995('0x10')][_0x7995('0x108')]=function(_0x3ab70c,_0x3e8479){var _0x2b874e=this;return new BPromise(function(_0x47f0d9,_0x2e93a9){var _0x5e12c4,_0x2cc43d;rpcDb[_0x7995('0x10b')](_0x3ab70c)['then'](function(_0x3e90a5){if(!_[_0x7995('0x6a')](_0x3e90a5[0x0])){_0x2cc43d=_0x3e90a5[0x0][_0x7995('0x10c')]?![]:!![];_0x5e12c4=_0x3e90a5[0x0][_0x7995('0x10c')]?!![]:![];_0x5e12c4=_0x3e8479?!![]:_0x5e12c4;}var _0x20949f=_0x2b874e[_0x7995('0x10d')](_0x3e90a5);if(_0x20949f['isValid']){rpcDb[_0x7995('0x10e')](_[_0x7995('0x71')](_0x3e90a5[0x0],[_0x7995('0x74'),_0x7995('0x10f')]))[_0x7995('0x84')](function(_0x3e3b05){_0x2b874e[_0x7995('0x110')](_0x3e3b05,_0x3e90a5[0x0],_0x3e8479,_0x2cc43d,_0x5e12c4)[_0x7995('0x84')](function(_0xf76f46){_0x47f0d9(_0xf76f46);})[_0x7995('0x87')](function(_0x370e25){_0x2e93a9(_0x370e25);});})[_0x7995('0x87')](function(_0x64a62d){ut[_0x7995('0x5d')](_0x7995('0x111'),_0x64a62d);_0x2e93a9(ut[_0x7995('0x5b')](_0x7995('0x112'),_0x2cc43d,_0x5e12c4));});}else{_0x2e93a9(ut[_0x7995('0x5b')](_0x20949f[_0x7995('0x5b')],_0x2cc43d,_0x5e12c4));}})[_0x7995('0x87')](function(_0x37e69d){ut['logger']('[Preview][getContactPreview]',_0x37e69d);_0x2e93a9(ut[_0x7995('0x5b')](_0x7995('0x112'),![],!![]));});});};Preview['prototype'][_0x7995('0x10d')]=function(_0x4c251c){if(_[_0x7995('0x6a')](_0x4c251c)||_['isEmpty'](_0x4c251c)||!_[_0x7995('0x6a')](_0x4c251c[0x0][_0x7995('0x83')])&&_[_0x7995('0x6a')](_0x4c251c[0x0][_0x7995('0x83')][_0x7995('0x28')])){ut[_0x7995('0x5d')](_0x7995('0x113'),_0x4c251c);return{'isValid':![],'message':_0x7995('0x114')};}var _0x10f635=this[_0x7995('0x14')][_0x4c251c[0x0]['Queue'][_0x7995('0x28')]];_0x10f635[_0x7995('0x5b')]=_0x7995('0x9a');if(_[_0x7995('0x6a')](_0x10f635)){ut['logger'](_0x7995('0x115'),_0x10f635);return{'isValid':![],'message':_0x7995('0x116')};}if(!this[_0x7995('0x98')](_0x10f635[_0x7995('0x50')])){ut['logger'](_0x7995('0x117'),_0x7995('0x118')+_0x10f635[_0x7995('0x28')]+_0x7995('0x119'));if(!this[_0x7995('0x98')](_0x10f635[_0x7995('0x99')])){ut[_0x7995('0x5d')](_0x7995('0x117'),_0x10f635[_0x7995('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x7995('0x11a')};}}if(!ut['isActive'](_0x10f635[_0x7995('0x35')])){ut[_0x7995('0x5d')](_0x7995('0x11b'),_0x10f635[_0x7995('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x7995('0x118')+_0x10f635[_0x7995('0x28')]+_0x7995('0x11c')};}return{'isValid':!![],'message':_0x7995('0x11d')};};Preview[_0x7995('0x10')][_0x7995('0xfa')]=function(_0x3661ab,_0x408692,_0x394a9f,_0xbfb30){var _0x45f389=this;return new BPromise(function(_0x44d6a8,_0x7d14e2){var _0x405711=_0x3661ab['uniqueid'];var _0x5cb30e=_0x45f389[_0x7995('0x98')](_0x408692[_0x7995('0x50')])?util[_0x7995('0x54')]('SIP/%s/%s%s',_0x408692[_0x7995('0x50')][_0x7995('0x28')],_[_0x7995('0x6a')](_0x408692['dialPrefix'])?'':_0x408692[_0x7995('0x38')][_0x7995('0x11e')]()||'',_0x408692[_0x7995('0x11f')]>0x0?_0x394a9f[_0x7995('0xf6')][_0x7995('0x120')][_0x7995('0x121')](_0x408692[_0x7995('0x11f')]):_0x394a9f[_0x7995('0xf6')][_0x7995('0x120')]):util[_0x7995('0x54')](_0x7995('0x122'),_['isNil'](_0x408692['TrunkBackup'])?_0x408692[_0x7995('0x50')]['name']:_0x408692[_0x7995('0x99')][_0x7995('0x28')],_[_0x7995('0x6a')](_0x408692[_0x7995('0x38')])?'':_0x408692[_0x7995('0x38')]['trim']()||'',_0x408692['dialCutDigit']>0x0?_0x394a9f[_0x7995('0xf6')][_0x7995('0x120')][_0x7995('0x121')](_0x408692[_0x7995('0x11f')]):_0x394a9f[_0x7995('0xf6')][_0x7995('0x120')]);var _0x278cb3=_0x45f389[_0x7995('0x98')](_0x408692[_0x7995('0x50')])?ut[_0x7995('0x123')](_0x408692['Trunk'][_0x7995('0x51')],_0x408692[_0x7995('0x36')],_0x408692[_0x7995('0x124')]>0x0?ut[_0x7995('0x125')](_0x408692['dialOriginateCallerIdNumber'],_0x408692['dialRandomLastDigitCallerIdNumber']):_0x408692['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x408692[_0x7995('0x99')])?_0x408692['Trunk']['callerid']:_0x408692[_0x7995('0x99')][_0x7995('0x51')],_0x408692[_0x7995('0x36')],_0x408692['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x7995('0x125')](_0x408692['dialOriginateCallerIdNumber'],_0x408692[_0x7995('0x124')]):_0x408692[_0x7995('0x126')]);if(_0x278cb3){_0x3661ab[_0x7995('0x127')]=ut['extractCalleridName'](_0x278cb3);_0x3661ab[_0x7995('0x128')]=ut[_0x7995('0x129')](_0x278cb3);}var _0x1b5b5b=ut['addVariables'](_0x408692,_0x394a9f,_0x5cb30e,_0x278cb3,_0x405711,_0x3661ab);_[_0x7995('0x12a')](_0x3661ab,ut[_0x7995('0x12b')](_0x1b5b5b));_0x3661ab[_0x7995('0x89')]=moment()[_0x7995('0x54')](_0x7995('0x8a'));ami['Action'](ut[_0x7995('0x12c')](_0x3661ab,_0x408692,_0x1b5b5b,_0x3661ab[_0x7995('0xaa')],_0xbfb30))[_0x7995('0x84')](function(_0x484b6c){_0x408692[_0x7995('0x4c')]+=0x1;logger[_0x7995('0x56')](_0x7995('0x12d'),_0x405711,_0x7995('0xae'),_0x408692[_0x7995('0x28')],'originated:\x20',_0x408692[_0x7995('0x4c')]);_0x44d6a8(_0x484b6c);})[_0x7995('0x87')](function(_0x134724){ut[_0x7995('0xed')](_0x3661ab,0xe,_0x7995('0x12e'));rpcDb[_0x7995('0xef')](_0x3661ab,_0x7995('0x12f'));_0x7d14e2(_0x134724);});});};Preview['prototype']['syncNewExten']=function(_0x37e0b8){if(this[_0x7995('0x17')][_0x37e0b8['linkedid']]){this['actions'][_0x37e0b8[_0x7995('0xe2')]][_0x7995('0x130')]=_0x37e0b8[_0x7995('0x130')];}};Preview[_0x7995('0x10')][_0x7995('0x19')]=function(_0x24a68c){var _0x39a023=this;var _0x4dca11=this[_0x7995('0x17')][_0x24a68c[_0x7995('0x131')]];if(_0x4dca11){if(_0x4dca11[_0x7995('0xf8')]&&this[_0x7995('0x18')][_0x4dca11[_0x7995('0xf8')]]){ut[_0x7995('0x132')](_0x4dca11,this['agents'][_0x4dca11[_0x7995('0xf8')]][_0x7995('0x28')],this[_0x7995('0x18')][_0x4dca11[_0x7995('0xf8')]]['id']);}var _0x13c918=_[_0x7995('0x133')](_0x4dca11);_0x13c918[_0x7995('0x134')]=moment()['format'](_0x7995('0x8a'));var _0x202102=_0x39a023[_0x7995('0x14')][_0x4dca11[_0x7995('0x6d')]];if(ut['isFailure'](_0x24a68c[_0x7995('0x135')])){if(_0x4dca11['unlockAgent']){rpcDb[_0x7995('0x10a')](_0x4dca11[_0x7995('0x136')]);}if(_0x4dca11['activeContact']){rpcDb['disableContact'](_0x4dca11['idContact']);}ami[_0x7995('0x25')](_0x7995('0x137'),ut[_0x7995('0x9f')](_0x4dca11,_0x7995('0x138'),this[_0x7995('0x14')][_0x4dca11[_0x7995('0x6d')]]));this[_0x7995('0xe9')](_0x13c918,_0x202102,_0x24a68c);}else{_0x4dca11[_0x7995('0x89')]=moment()[_0x7995('0x54')](_0x7995('0x8a'));ut[_0x7995('0xed')](_0x13c918,0x4,_0x7995('0xb9'));rpcDb['createAgentHistory'](_0x13c918,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x7995('0x10')]['syncHangup']=function(_0x58a2e8){var _0x1a786e=this;var _0x363250=this[_0x7995('0x17')][_0x58a2e8[_0x7995('0xe2')]];var _0x2b5475;if(_0x363250){_0x2b5475=this[_0x7995('0x14')][_0x363250[_0x7995('0x6d')]];logger[_0x7995('0x56')](_0x7995('0x139'),_0x58a2e8[_0x7995('0xe2')],_0x7995('0xae'),_0x2b5475[_0x7995('0x28')],'pTalking:\x20',_0x2b5475[_0x7995('0x2c')]);}if(this[_0x7995('0x17')][_0x58a2e8[_0x7995('0xe2')]]&&_0x58a2e8[_0x7995('0xe2')]!==_0x58a2e8[_0x7995('0xbe')]){if(_0x58a2e8[_0x7995('0x13a')]==='16'&&this[_0x7995('0x17')][_0x58a2e8['linkedid']][_0x7995('0x70')]){this[_0x7995('0x13b')](_0x58a2e8,_0x58a2e8[_0x7995('0xe2')],_0x58a2e8[_0x7995('0x13a')]);}else if(this[_0x7995('0x17')][_0x58a2e8['linkedid']][_0x7995('0x70')]){logger['info'](_0x7995('0x13c'),_0x58a2e8[_0x7995('0xe2')],_0x58a2e8[_0x7995('0x13a')],'\x20Queue',_0x2b5475[_0x7995('0x28')],_0x7995('0x6f'),_0x2b5475[_0x7995('0x2c')]);this[_0x7995('0x13b')](_0x58a2e8,_0x58a2e8[_0x7995('0xe2')],_0x58a2e8[_0x7995('0x13a')]);}}else if(_0x363250&&_[_0x7995('0x6a')](_0x363250['statedesc'])&&_0x2b5475['dialQueueProject']&&_0x58a2e8[_0x7995('0xe2')]===_0x58a2e8[_0x7995('0xbe')]&&_[_0x7995('0x6a')](_0x58a2e8[_0x7995('0xec')])&&_0x58a2e8[_0x7995('0x13a')]==='16'&&_0x58a2e8[_0x7995('0x13d')]==='6'&&_['isUndefined'](_0x363250[_0x7995('0x13e')])){if(_0x363250[_0x7995('0xa9')]){rpcDb[_0x7995('0x10a')](_0x363250[_0x7995('0x136')]);}if(_0x363250['activeContact']){rpcDb['disableContact'](_0x363250[_0x7995('0x136')]);}_0x58a2e8[_0x7995('0xec')]='22';this['callProgressDetectingAgent'](_0x363250,_0x2b5475,_0x58a2e8);}else if(_0x363250&&_0x363250[_0x7995('0x13e')]){if(_0x58a2e8[_0x7995('0x13a')]==='16'&&this['actions'][_0x58a2e8[_0x7995('0xe2')]][_0x7995('0x70')]){logger[_0x7995('0x56')](_0x7995('0x13f'),_0x58a2e8[_0x7995('0xe2')],_0x58a2e8['cause'],'\x20Queue',_0x2b5475[_0x7995('0x28')],_0x7995('0x6f'),_0x2b5475[_0x7995('0x2c')]);this[_0x7995('0x13b')](_0x58a2e8,_0x58a2e8[_0x7995('0xe2')],_0x58a2e8['cause']);}else if(this[_0x7995('0x17')][_0x58a2e8[_0x7995('0xe2')]][_0x7995('0x70')]){logger[_0x7995('0x56')](_0x7995('0x13c'),_0x58a2e8['linkedid'],_0x58a2e8['cause'],'\x20Queue',_0x2b5475['name'],_0x7995('0x6f'),_0x2b5475[_0x7995('0x2c')]);this['callProgressDetectingCustomer'](_0x58a2e8,_0x58a2e8[_0x7995('0xe2')],_0x58a2e8[_0x7995('0x13a')]);}}};Preview['prototype']['syncDialEnd']=function(_0x1f4b2f){if(this[_0x7995('0x17')][_0x1f4b2f[_0x7995('0x140')]]&&_0x1f4b2f[_0x7995('0x140')]!==_0x1f4b2f[_0x7995('0x141')]){this[_0x7995('0x13b')](_0x1f4b2f,_0x1f4b2f[_0x7995('0x140')],_0x1f4b2f['dialstatus']);}};Preview['prototype'][_0x7995('0x1e')]=function(_0xb00787){if(this[_0x7995('0x17')][_0xb00787['linkedid']]&&_0xb00787[_0x7995('0xe2')]!==_0xb00787[_0x7995('0xbe')]&&!this[_0x7995('0x17')][_0xb00787[_0x7995('0xe2')]][_0x7995('0x70')]){if(_0xb00787[_0x7995('0x13a')]==='1'){this[_0x7995('0x13b')](_0xb00787,_0xb00787[_0x7995('0xe2')],_0xb00787[_0x7995('0x13a')]);}}};Preview['prototype']['addVariable']=function(_0x1161f2,_0x4bd222,_0x2ac8ac){if(this['actions'][_0x1161f2]){if(_[_0x7995('0x6a')](this[_0x7995('0x17')][_0x1161f2][_0x7995('0x142')])){this['actions'][_0x1161f2]['variables']={};}this[_0x7995('0x17')][_0x1161f2][_0x7995('0x142')][_0x4bd222]=_0x2ac8ac;}};Preview[_0x7995('0x10')][_0x7995('0x23')]=function(_0xc6d48c){try{if(!_[_0x7995('0x6a')](_0xc6d48c)){if(ut[_0x7995('0x143')](_[_0x7995('0x144')](_0xc6d48c[_0x7995('0x145')])[0x0])){this[_0x7995('0x146')](_0xc6d48c[_0x7995('0xbe')],_['keys'](_0xc6d48c[_0x7995('0x145')])[0x0],_0xc6d48c[_0x7995('0x147')]);}}}catch(_0x1b7e44){logger[_0x7995('0x148')](_0x7995('0x149'),util['inspect'](_0x1b7e44,{'showHidden':![],'depth':null}));}};Preview[_0x7995('0x10')][_0x7995('0x14a')]=function(_0x3c3cae){if(_0x3c3cae){if(this[_0x7995('0x17')][_0x3c3cae[_0x7995('0x14b')]]){this[_0x7995('0x17')][_0x3c3cae[_0x7995('0x14b')]][_0x7995('0x13e')]=!![];}}};Preview[_0x7995('0x10')]['syncBlindTransfer']=function(_0x5405ca){if(_0x5405ca){if(this[_0x7995('0x17')][_0x5405ca[_0x7995('0x14c')]]){this[_0x7995('0x17')][_0x5405ca[_0x7995('0x14c')]][_0x7995('0x13e')]=!![];}}};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 c456624..043b2bb 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 _0xc8e5=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20'];(function(_0x1e3459,_0x30fe01){var _0x4aa125=function(_0x475f0c){while(--_0x475f0c){_0x1e3459['push'](_0x1e3459['shift']());}};_0x4aa125(++_0x30fe01);}(_0xc8e5,0xac));var _0x5c8e=function(_0xfdb319,_0x10a1b2){_0xfdb319=_0xfdb319-0x0;var _0xdb1c34=_0xc8e5[_0xfdb319];return _0xdb1c34;};'use strict';var util=require(_0x5c8e('0x0'));var BPromise=require(_0x5c8e('0x1'));var logger=require(_0x5c8e('0x2'))(_0x5c8e('0x3'));var _=require('lodash');var cmHopper=require(_0x5c8e('0x4'));var cmHopperFinal=require(_0x5c8e('0x5'));var cmHopperHistory=require(_0x5c8e('0x6'));var cmHopperBlack=require(_0x5c8e('0x7'));var voiceQueueRt=require(_0x5c8e('0x8'));var agentReportPreview=require(_0x5c8e('0x9'));var voiceQueueReport=require(_0x5c8e('0xa'));function loggerCatch(_0x370859){return function(_0x498a04){logger[_0x5c8e('0xb')](_0x370859,util[_0x5c8e('0xc')](_0x498a04,{'showHidden':![],'depth':null}));};}function create(_0x5282ac){return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](cmHopperHistory[_0x5c8e('0xf')](_0x5282ac))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x11')));}function createAgent(_0x28d5ed){return BPromise['resolve']()[_0x5c8e('0xe')](agentReportPreview[_0x5c8e('0xf')](_0x28d5ed))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x11')));}function moveContact(_0x5e06a1){return BPromise[_0x5c8e('0xd')]()['then'](cmHopper[_0x5c8e('0x12')](_0x5e06a1,!![]))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x13')));}exports[_0x5c8e('0x14')]=function(_0x10b0d7){return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](cmHopperBlack[_0x5c8e('0x14')](_0x10b0d7))['catch'](loggerCatch(_0x5c8e('0x15')));};exports['getContactPreview']=function(_0x26e042){return BPromise['resolve']()[_0x5c8e('0xe')](cmHopper[_0x5c8e('0x16')](_0x26e042))[_0x5c8e('0x10')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5a87f9,_0xaf7bfa){create(_0x5a87f9)[_0x5c8e('0x10')](loggerCatch(_0xaf7bfa));moveContact(_0x5a87f9)[_0x5c8e('0x10')](loggerCatch(_0xaf7bfa));};exports[_0x5c8e('0x17')]=function(_0x2538f4,_0x15ad3b){createAgent(_0x2538f4)[_0x5c8e('0x10')](loggerCatch(_0x15ad3b));};exports['createCustomerHistory']=function(_0xe4e41a,_0x5caa4){create(_0xe4e41a)[_0x5c8e('0x10')](loggerCatch(_0x5caa4));};exports[_0x5c8e('0x18')]=function(_0x1467b0,_0x337b75){moveContact(_0x1467b0)['catch'](loggerCatch(_0x337b75));};exports[_0x5c8e('0x19')]=function(_0x573fff,_0x59c6ba,_0x35e099){if(_0x59c6ba){_0x573fff[_0x5c8e('0x1a')]=null;}if(_0x35e099){_0x573fff[_0x5c8e('0x1b')]=![];}return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](cmHopper[_0x5c8e('0x19')](_0x573fff))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x1c')));};exports[_0x5c8e('0x1d')]=function(_0x423aed){return BPromise['resolve']()[_0x5c8e('0xe')](cmHopper[_0x5c8e('0x1d')](_0x423aed))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x1e')));};exports[_0x5c8e('0x1f')]=function(_0x215144){return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](cmHopper[_0x5c8e('0x1f')]({'UserId':null},_0x215144,0x1))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x20')));};exports['disableContact']=function(_0x2e6d77){return BPromise[_0x5c8e('0xd')]()['then'](cmHopper[_0x5c8e('0x1f')]({'active':![]},_0x2e6d77,0x1))[_0x5c8e('0x10')](loggerCatch('[activeContact]\x20'));};exports[_0x5c8e('0x21')]=function(_0x11c620){var _0x3c72bc={};_0x3c72bc['type']=_0x11c620[_0x5c8e('0x22')];_0x3c72bc[_0x5c8e('0x23')]=_0x11c620[_0x5c8e('0x23')];_0x3c72bc[_0x5c8e('0x24')]=_0x11c620['calleridnum'];_0x3c72bc[_0x5c8e('0x25')]=_0x11c620['calleridname'];_0x3c72bc['queue']=_0x11c620['queue'];_0x3c72bc[_0x5c8e('0x26')]=_0x11c620[_0x5c8e('0x27')];_0x3c72bc[_0x5c8e('0x28')]=_0x11c620[_0x5c8e('0x27')];_0x3c72bc['queuecallercomplete']=0x1;_0x3c72bc[_0x5c8e('0x29')]=_0x11c620['endtime'];_0x3c72bc['connectedlinename']=_0x11c620['membername'];_0x3c72bc[_0x5c8e('0x2a')]=_0x5c8e('0x2b');_0x3c72bc[_0x5c8e('0x2c')]=_0x5c8e('0x2d');_0x3c72bc[_0x5c8e('0x2e')]=0x0;_0x3c72bc[_0x5c8e('0x2f')]=0x1;_0x3c72bc[_0x5c8e('0x30')]=_0x11c620['membername'];_0x3c72bc[_0x5c8e('0x31')]='COMPLETED';return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](voiceQueueReport[_0x5c8e('0x32')](_0x3c72bc))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x33')));};exports[_0x5c8e('0x34')]=function(_0x5a4185,_0x9fd19c){return BPromise[_0x5c8e('0xd')]()[_0x5c8e('0xe')](cmHopper[_0x5c8e('0x34')](_0x5a4185,_0x9fd19c))[_0x5c8e('0x10')](loggerCatch(_0x5c8e('0x35')));};exports[_0x5c8e('0x36')]=function(_0x29dc85){return BPromise['resolve']()[_0x5c8e('0xe')](cmHopper['rescheduleContact'](_0x29dc85,!![],!![]))['catch'](loggerCatch(_0x5c8e('0x37')));}; \ No newline at end of file +var _0xfddc=['[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','exten','xcally-motion-preview','holdtime','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','catch'];(function(_0x137ad6,_0x48589b){var _0x52f0d4=function(_0x8bd426){while(--_0x8bd426){_0x137ad6['push'](_0x137ad6['shift']());}};_0x52f0d4(++_0x48589b);}(_0xfddc,0x97));var _0xcfdd=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xfddc[_0x8a969d];return _0x1d8dc7;};'use strict';var util=require(_0xcfdd('0x0'));var BPromise=require('bluebird');var logger=require(_0xcfdd('0x1'))(_0xcfdd('0x2'));var _=require('lodash');var cmHopper=require(_0xcfdd('0x3'));var cmHopperFinal=require(_0xcfdd('0x4'));var cmHopperHistory=require(_0xcfdd('0x5'));var cmHopperBlack=require(_0xcfdd('0x6'));var voiceQueueRt=require(_0xcfdd('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xcfdd('0x8'));function loggerCatch(_0x41e367){return function(_0x4ed7e3){logger[_0xcfdd('0x9')](_0x41e367,util[_0xcfdd('0xa')](_0x4ed7e3,{'showHidden':![],'depth':null}));};}function create(_0x94d11){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopperHistory['createHistory'](_0x94d11))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0xe')));}function createAgent(_0x3cfca6){return BPromise['resolve']()[_0xcfdd('0xc')](agentReportPreview['createHistory'](_0x3cfca6))['catch'](loggerCatch(_0xcfdd('0xe')));}function moveContact(_0x12bdc7){return BPromise['resolve']()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0xf')](_0x12bdc7,!![]))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x10')));}exports[_0xcfdd('0x11')]=function(_0x500d0e){return BPromise['resolve']()[_0xcfdd('0xc')](cmHopperBlack[_0xcfdd('0x11')](_0x500d0e))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x12')));};exports[_0xcfdd('0x13')]=function(_0x2b5b3d){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x13')](_0x2b5b3d))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x14')));};exports['createHistory']=function(_0x1fa0c1,_0x187eb4){create(_0x1fa0c1)['catch'](loggerCatch(_0x187eb4));moveContact(_0x1fa0c1)['catch'](loggerCatch(_0x187eb4));};exports[_0xcfdd('0x15')]=function(_0x2ce91a,_0x2d5bad){createAgent(_0x2ce91a)[_0xcfdd('0xd')](loggerCatch(_0x2d5bad));};exports[_0xcfdd('0x16')]=function(_0x1fab8c,_0x6ce009){create(_0x1fab8c)['catch'](loggerCatch(_0x6ce009));};exports[_0xcfdd('0x17')]=function(_0x5f028b,_0x22d19b){moveContact(_0x5f028b)[_0xcfdd('0xd')](loggerCatch(_0x22d19b));};exports[_0xcfdd('0x18')]=function(_0xd855c4,_0x3ce0da,_0x5b3588){if(_0x3ce0da){_0xd855c4[_0xcfdd('0x19')]=null;}if(_0x5b3588){_0xd855c4[_0xcfdd('0x1a')]=![];}return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x18')](_0xd855c4))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x1b')));};exports[_0xcfdd('0x1c')]=function(_0x14379a){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x1c')](_0x14379a))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xcfdd('0x1d')]=function(_0x25b788){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x1d')]({'UserId':null},_0x25b788,0x1))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x1e')));};exports['disableContact']=function(_0x36f51d){return BPromise[_0xcfdd('0xb')]()['then'](cmHopper[_0xcfdd('0x1d')]({'active':![]},_0x36f51d,0x1))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x1f')));};exports[_0xcfdd('0x20')]=function(_0x17ad84){var _0x118a5c={};_0x118a5c[_0xcfdd('0x21')]=_0x17ad84[_0xcfdd('0x21')];_0x118a5c[_0xcfdd('0x22')]=_0x17ad84[_0xcfdd('0x22')];_0x118a5c[_0xcfdd('0x23')]=_0x17ad84[_0xcfdd('0x23')];_0x118a5c[_0xcfdd('0x24')]=_0x17ad84['calleridname'];_0x118a5c[_0xcfdd('0x25')]=_0x17ad84[_0xcfdd('0x25')];_0x118a5c['queuecallerjoinAt']=_0x17ad84[_0xcfdd('0x26')];_0x118a5c[_0xcfdd('0x27')]=_0x17ad84['answertime'];_0x118a5c[_0xcfdd('0x28')]=0x1;_0x118a5c[_0xcfdd('0x29')]=_0x17ad84[_0xcfdd('0x2a')];_0x118a5c['connectedlinename']=_0x17ad84['membername'];_0x118a5c[_0xcfdd('0x2b')]='from-sip';_0x118a5c[_0xcfdd('0x2c')]=_0xcfdd('0x2d');_0x118a5c[_0xcfdd('0x2e')]=0x0;_0x118a5c['assigned']=0x1;_0x118a5c['lastAssignedTo']=_0x17ad84[_0xcfdd('0x2f')];_0x118a5c['queuecallerexitreason']=_0xcfdd('0x30');return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](voiceQueueReport[_0xcfdd('0x31')](_0x118a5c))['catch'](loggerCatch(_0xcfdd('0x32')));};exports[_0xcfdd('0x33')]=function(_0x275b50,_0x355ba6){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x33')](_0x275b50,_0x355ba6))[_0xcfdd('0xd')](loggerCatch(_0xcfdd('0x34')));};exports[_0xcfdd('0x35')]=function(_0x2b9be5){return BPromise[_0xcfdd('0xb')]()[_0xcfdd('0xc')](cmHopper[_0xcfdd('0x18')](_0x2b9be5,!![],!![]))['catch'](loggerCatch(_0xcfdd('0x36')));}; \ 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 778ca07..e075043 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 _0x824f=['Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','\x22%s\x22\x20<%s>','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','voice','mandatoryDisposition','queue','agentReadyId','status','reachable','push','getDiff','seconds','CampaignId','filterKey','idContact','campaigntype','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','isEmpty','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview'];(function(_0x4ba084,_0x227332){var _0x220def=function(_0xcfdc75){while(--_0xcfdc75){_0x4ba084['push'](_0x4ba084['shift']());}};_0x220def(++_0x227332);}(_0x824f,0x16b));var _0xf824=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0x824f[_0x509273];return _0x38ef40;};'use strict';var util=require(_0xf824('0x0'));var _=require(_0xf824('0x1'));var moment=require(_0xf824('0x2'));var logger=require(_0xf824('0x3'))(_0xf824('0x4'));var ipAgi=process[_0xf824('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x4f43a6,_0x4f4168){var _0x4c59e6=moment(_0x4f43a6)[_0xf824('0x6')](0x0);var _0x14428c=moment(_0x4f4168)[_0xf824('0x6')](0x0);return _0x4c59e6[_0xf824('0x7')](_0x14428c,'seconds');}exports[_0xf824('0x8')]=function(_0x587571){return function(_0x263bc2){logger[_0xf824('0x9')](_0x587571,util[_0xf824('0xa')](_0x263bc2,{'showHidden':![],'depth':null}));};};exports[_0xf824('0xb')]=function(_0x4c40d2,_0x5e7b71){logger[_0xf824('0xc')](_0x4c40d2,util['inspect'](_0x5e7b71,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1ddd4e,_0xbf74ad){logger['error'](_0x1ddd4e,util[_0xf824('0xa')](_0xbf74ad,{'showHidden':![],'depth':null}));};exports[_0xf824('0xd')]=function(_0xc3890f){return function(_0x24b4f7){logger[_0xf824('0xc')](_0xc3890f,util[_0xf824('0xa')](_0x24b4f7,{'showHidden':![],'depth':null}));};};exports[_0xf824('0xe')]=function(_0x51ad11,_0x56f69f,_0x461dc9){return{'message':_0x51ad11,'unlock':_0x56f69f,'active':_0x461dc9};};exports[_0xf824('0xf')]=function(_0x3a5c4b,_0x10842b,_0x1aff20){if(!_[_0xf824('0x10')](_0x1aff20)&&'string'===typeof _0x1aff20&&!_[_0xf824('0x11')](_0x1aff20)){if(!_[_0xf824('0x10')](_0x10842b)&&_0xf824('0x12')===typeof _0x10842b&&!_[_0xf824('0x11')](_0x10842b)){return util['format']('\x22%s\x22\x20<%s>',_0x10842b,_0x1aff20);}return util['format']('\x22%s\x22\x20<%s>',_0x1aff20,_0x1aff20);}if(!_['isUndefined'](_0x3a5c4b)&&_0xf824('0x12')===typeof _0x3a5c4b&&!_['isEmpty'](_0x3a5c4b)){return _0x3a5c4b;}return _0xf824('0x13');};exports[_0xf824('0x14')]=function(_0x2a8cc3){if(_[_0xf824('0x15')](_0x2a8cc3)){return![];}return _0x2a8cc3;};exports[_0xf824('0x16')]=function(_0x207ee9,_0x167d27,_0x4d08fc,_0x295163,_0x1e8c9c,_0x38ad04){var _0x13c353={'XMD-QUEUE':_0x167d27[_0xf824('0x17')]?_0x167d27[_0xf824('0x17')][_0xf824('0x18')]:'','XMD-CALLERID':_0x295163,'XMD-CALLERID-PREVIEW':_0x38ad04?util[_0xf824('0x19')]('\x22%s\x22\x20<%s>',_0x38ad04['calleridname'],_0x38ad04[_0xf824('0x1a')]):_0x295163,'XMD-DIALID':_0x1e8c9c,'XMD-CONTACTID':_0x167d27[_0xf824('0x1b')],'XMD-CDRTYPE':_0xf824('0x1c'),'CALLERID(all)':_0x295163,'XMD-VOICEQUEUEID':_0x167d27[_0xf824('0x1d')],'XMD-DIALCHANNEL':_0x4d08fc,'XMD-DIALTIMEOUT':_0x207ee9['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf824('0x19')](_0xf824('0x1e'),_0x207ee9[_0xf824('0x1f')]?'g':'',_[_0xf824('0x11')](_0x207ee9[_0xf824('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x207ee9[_0xf824('0x21')]||'','XMD-AGI':_0x207ee9[_0xf824('0x22')]?util['format'](_0xf824('0x23'),ipAgi,_0x207ee9[_0xf824('0x22')]):_0xf824('0x24'),'XMD-AGIAFTER':_0x207ee9[_0xf824('0x1f')]?util[_0xf824('0x19')](_0xf824('0x23'),ipAgi,_0x207ee9[_0xf824('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x38ad04?_0x38ad04['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x38ad04?_0x38ad04[_0xf824('0x25')]:'','XMD-DESTINATION':_0xf824('0x26'),'SIPADDHEADER':_0xf824('0x27')};if(!_[_0xf824('0x11')](_0x207ee9[_0xf824('0x20')])){_0x13c353[util[_0xf824('0x19')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x207ee9[_0xf824('0x20')];_0x13c353[util[_0xf824('0x19')]('%s',_0xf824('0x28'))]=_0x1e8c9c;}if(_0x167d27&&_0x167d27[_0xf824('0x29')]){for(var _0x380606 in _0x167d27[_0xf824('0x29')]){if(_0x167d27[_0xf824('0x29')][_0xf824('0x2a')](_0x380606)){if(!_[_0xf824('0x15')](_0x167d27[_0xf824('0x29')][_0x380606])&&_0x380606!=='id'&&_0x380606!==_0xf824('0x2b')&&_0x380606!==_0xf824('0x2c')&&_0x380606!==_0xf824('0x2d')){_0x13c353[util[_0xf824('0x19')](_0xf824('0x2e'),'XMD-',_[_0xf824('0x2f')](_0x380606))]=_0x167d27['Contact'][_0x380606];}}}}return _0x13c353;};exports['toLowerVariables']=function(_0x4777f1){var _0x7f9ca={};for(var _0x13281b in _0x4777f1){if(_0x4777f1[_0xf824('0x2a')](_0x13281b)){_0x7f9ca[util[_0xf824('0x19')]('%s',_[_0xf824('0x30')](_0x13281b))]=_0x4777f1[_0x13281b];}}return{'variables':_0x7f9ca};};exports[_0xf824('0x31')]=function(_0x3b9c66,_0x1c5247){if(!_[_0xf824('0x15')](_0x3b9c66)){if(_0x3b9c66[_0xf824('0x2a')](_0xf824('0x32'))){if(_0x3b9c66[_0xf824('0x32')]>0x0){_0x3b9c66[_0xf824('0x32')]-=0x1;}else{logger[_0xf824('0x9')](_0xf824('0x33'),_0x1c5247);}}}else{logger['error'](_0xf824('0x34'),_0x1c5247);}};exports[_0xf824('0x35')]=function(_0x1aa9dd){var _0x36678b=moment()[_0xf824('0x19')](_0xf824('0x36'));_0x1aa9dd[_0xf824('0x37')]=0xd;_0x1aa9dd[_0xf824('0x38')]='Blacklist';_0x1aa9dd[_0xf824('0x39')]=_0x36678b;_0x1aa9dd[_0xf824('0x3a')]=_0x36678b;_0x1aa9dd[_0xf824('0x3b')]=_0x36678b;};exports[_0xf824('0x3c')]=function(_0x2a3a23,_0x25a4c7,_0x5d2358){var _0x546012=moment()[_0xf824('0x19')](_0xf824('0x36'));_0x2a3a23[_0xf824('0x37')]=_0x25a4c7;_0x2a3a23['statedesc']=_0x5d2358;_0x2a3a23[_0xf824('0x3a')]=_0x546012;_0x2a3a23['ringtime']=getSeconds(_0x2a3a23[_0xf824('0x3a')],_0x2a3a23[_0xf824('0x39')]);};exports[_0xf824('0x3d')]=function(_0x28a95c,_0x207110,_0xa6c525){_0x28a95c[_0xf824('0x3e')]=_0x207110;_0x28a95c[_0xf824('0x3f')]=_0xa6c525;};exports['logCustomer']=function(_0x5cb8bf,_0x29556e,_0x4d68b7){var _0x3af745=moment()[_0xf824('0x19')](_0xf824('0x36'));_0x5cb8bf[_0xf824('0x37')]=_0x29556e;_0x5cb8bf[_0xf824('0x38')]=_0x4d68b7;_0x5cb8bf['responsetime']=_0x5cb8bf['responsetime']?_0x5cb8bf[_0xf824('0x3a')]:_0x3af745;_0x5cb8bf[_0xf824('0x3b')]=_0x5cb8bf[_0xf824('0x3b')]?_0x5cb8bf[_0xf824('0x3b')]:_0x3af745;_0x5cb8bf['ringtime']=getSeconds(_0x5cb8bf[_0xf824('0x3a')]||0x0,_0x5cb8bf[_0xf824('0x39')]||0x0);_0x5cb8bf[_0xf824('0x40')]=_0x5cb8bf[_0xf824('0x41')]?getSeconds(_0x5cb8bf['endtime'],_0x5cb8bf[_0xf824('0x41')]):0x0;};exports[_0xf824('0x42')]=function(_0xeb1782){return _0xeb1782===_0xf824('0x43');};exports[_0xf824('0x44')]=function(_0x43e977,_0x3d1508,_0x58c9b6,_0x49c2e6,_0x4b1780){var _0x2b2ffb=_0x49c2e6?'RECALL':_0x43e977[_0xf824('0x45')];_0x2b2ffb=_0x4b1780?_0xf824('0x46'):_0x2b2ffb;return{'actionid':_0x43e977[_0xf824('0x47')],'action':_0xf824('0x48'),'channel':_0x43e977[_0xf824('0x49')],'callerid':util[_0xf824('0x19')](_0xf824('0x4a'),_0x2b2ffb,_0x43e977[_0xf824('0x1a')]),'Exten':'xcally-motion-preview','Context':_0xf824('0x4b'),'Priority':'1','variable':_0x58c9b6,'timeout':(_0x3d1508[_0xf824('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43e977[_0xf824('0x47')]};};exports[_0xf824('0x4d')]=function(_0x386231){return _0x386231[_0xf824('0x4e')]+_0x386231[_0xf824('0x4f')]+_0x386231['countnoanswerretry']+_0x386231[_0xf824('0x50')]+_0x386231['countnosuchnumberretry'];};exports['cloneAction']=function(_0x21ab70){var _0x43945e=_['clone'](_0x21ab70);_0x43945e[_0xf824('0x37')]=0xf;_0x43945e[_0xf824('0x38')]=_0xf824('0x51');return _0x43945e;};exports[_0xf824('0x52')]=function(_0x482c3d,_0x49851a,_0x4c6e01){var _0x57f3e0={};_0x57f3e0[_0x49851a]=_0x482c3d[_0x49851a];_0x57f3e0[_0xf824('0x53')]=![];_0x57f3e0[_0xf824('0x54')]=moment()[_0xf824('0x55')](_0x4c6e01,_0xf824('0x56'))[_0xf824('0x19')](_0xf824('0x36'));_0x57f3e0['ContactId']=_0x482c3d[_0xf824('0x1b')];_0x57f3e0[_0xf824('0x57')]=_0x482c3d[_0xf824('0x57')];_0x57f3e0['VoiceQueueId']=_0x482c3d[_0xf824('0x1d')]||undefined;return _0x57f3e0;};exports['decrementTalkink']=function(_0x376346,_0x2ab112){if(!_[_0xf824('0x15')](_0x376346)){if(_0x376346[_0xf824('0x58')]>0x0){_0x376346[_0xf824('0x58')]-=0x1;}else{logger[_0xf824('0x9')](_0x2ab112,_0xf824('0x59'));}}else{logger[_0xf824('0x9')](_0x2ab112,_0xf824('0x5a'));}};exports['IsNotLoggedIn']=function(_0x54417f){if(_0x54417f<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1c5079,_0x1ec53f,_0xd4798e){_0x1c5079[_0xf824('0x5b')]=_0x1ec53f;_0x1c5079['name']=_0x1c5079['queue'];_0x1c5079['interface']=_0x1c5079[_0xf824('0x49')];_0x1c5079['motionChannel']=_0xf824('0x5c');if(_0xd4798e){_0x1c5079[_0xf824('0x5d')]=_0xd4798e['mandatoryDisposition'];}return _0x1c5079;};exports['buildAcw']=function(_0x27da74){var _0x1b165e={};_0x1b165e[_0xf824('0x5e')]=_0x27da74['queue'];_0x1b165e['interface']=_0x27da74[_0xf824('0x49')];_0x1b165e[_0xf824('0x47')]=_0x27da74[_0xf824('0x47')];return _0x1b165e;};exports[_0xf824('0x5f')]=function(_0x23edf8){var _0x539706=[];for(var _0x5d8422 in _0x23edf8){if(_0x23edf8[_0xf824('0x2a')](_0x5d8422)){if(!_[_0xf824('0x15')](_0x23edf8[_0x5d8422])&&_0x23edf8[_0x5d8422]['state']==='not_inuse'&&_0x23edf8[_0x5d8422][_0xf824('0x60')]===_0xf824('0x61')){_0x539706[_0xf824('0x62')](_0x23edf8[_0x5d8422]['id']);}}}return _0x539706;};exports[_0xf824('0x63')]=function(_0x4d8c43){var _0x4b9917=moment()[_0xf824('0x6')](0x0);var _0xe6b371=moment(_0x4d8c43)[_0xf824('0x6')](0x0);return _0x4b9917['diff'](_0xe6b371,_0xf824('0x64'));};exports['createBody']=function(_0x1fd83b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fd83b[_0xf824('0x1b')],'ListId':_0x1fd83b['ListId'],'VoiceQueueId':_0x1fd83b[_0xf824('0x1d')]||undefined,'CampaignId':_0x1fd83b[_0xf824('0x65')]||undefined};};exports[_0xf824('0x66')]=function(_0x1eb621){if(_0x1eb621===_0xf824('0x47')||_0x1eb621===_0xf824('0x67')||_0x1eb621===_0xf824('0x5e')||_0x1eb621==='type'||_0x1eb621===_0xf824('0x68')||_0x1eb621==='dialAnswer'||_0x1eb621==='membername'||_0x1eb621===_0xf824('0x49')||_0x1eb621===_0xf824('0x45')||_0x1eb621===_0xf824('0x53')||_0x1eb621===_0xf824('0x1a')||_0x1eb621===_0xf824('0x54')||_0x1eb621===_0xf824('0x4e')||_0x1eb621===_0xf824('0x4f')||_0x1eb621==='countnoanswerretry'||_0x1eb621==='countglobal'||_0x1eb621===_0xf824('0x69')||_0x1eb621===_0xf824('0x6a')||_0x1eb621===_0xf824('0x6b')||_0x1eb621==='recallme'||_0x1eb621===_0xf824('0x1b')||_0x1eb621===_0xf824('0x57')||_0x1eb621===_0xf824('0x3f')||_0x1eb621===_0xf824('0x1d')||_0x1eb621===_0xf824('0x6c')||_0x1eb621==='xmd-voicequeueid'||_0x1eb621===_0xf824('0x6d')||_0x1eb621==='xmd-phone'||_0x1eb621===_0xf824('0x6e')||_0x1eb621===_0xf824('0x6f')||_0x1eb621===_0xf824('0x70')||_0x1eb621===_0xf824('0x71')||_0x1eb621==='xmd-dialid'||_0x1eb621===_0xf824('0x72')||_0x1eb621===_0xf824('0x73')||_0x1eb621===_0xf824('0x74')||_0x1eb621===_0xf824('0x75')||_0x1eb621===_0xf824('0x76')||_0x1eb621==='xmd-agi'||_0x1eb621===_0xf824('0x77')||_0x1eb621==='rtpaudioqosbridged'||_0x1eb621===_0xf824('0x78')||_0x1eb621==='rtpaudioqosjitterbridged'||_0x1eb621==='rtpaudioqosloss'||_0x1eb621===_0xf824('0x79')||_0x1eb621===_0xf824('0x7a')||_0x1eb621===_0xf824('0x7b')||_0x1eb621===_0xf824('0x77')||_0x1eb621===_0xf824('0x7c')||_0x1eb621===_0xf824('0x78')||_0x1eb621===_0xf824('0x7d')||_0x1eb621===_0xf824('0x7e')||_0x1eb621===_0xf824('0x79')||_0x1eb621===_0xf824('0x7a')||_0x1eb621===_0xf824('0x7b')||_0x1eb621==='bridgepeer'||_0x1eb621==='bridgepvtcallid'||_0x1eb621===_0xf824('0x37')||_0x1eb621===_0xf824('0x38')){return![];}return!![];};exports[_0xf824('0x7f')]=function(_0xb469f0,_0x438946){var _0x5b12f6,_0x3d9fe1,_0x39ef3d;if(_0x438946<=0x0){_0x438946=0x1;}_0x5b12f6=new RegExp(_0xf824('0x80')+_0x438946+'}$');_0x3d9fe1=Math[_0xf824('0x81')](0xa,_0x438946-0x1);_0x39ef3d=Math[_0xf824('0x81')](0xa,_0x438946)-0x1;return util['format']('%s',_[_0xf824('0x82')](_0xb469f0,_0x5b12f6,_[_0xf824('0x83')](_0x3d9fe1,_0x39ef3d)));};exports[_0xf824('0x84')]=function(_0xb7b5be){var _0x3f8cf1=_0xb7b5be[_0xf824('0x85')](/"(.*?)"/);return _0x3f8cf1?_0x3f8cf1[0x1]:_0xb7b5be;};exports['extractCalleridNumber']=function(_0x189e05){var _0x389bbe=_0x189e05[_0xf824('0x85')](/<(.*?)>/);return _0x389bbe?_0x389bbe[0x1]:_0x189e05;}; \ No newline at end of file +var _0x8034=['tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','logAgent','state','statedesc','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','motionChannel','voice','mandatoryDisposition','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8034,0x188));var _0x4803=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8034[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require(_0x4803('0x0'));var _=require(_0x4803('0x1'));var moment=require('moment');var logger=require(_0x4803('0x2'))('preview');var ipAgi=process[_0x4803('0x3')][_0x4803('0x4')]||'127.0.0.1';function getSeconds(_0x3fe9f0,_0x2233db){var _0x155fb6=moment(_0x3fe9f0)['milliseconds'](0x0);var _0x186246=moment(_0x2233db)[_0x4803('0x5')](0x0);return _0x155fb6['diff'](_0x186246,_0x4803('0x6'));}exports[_0x4803('0x7')]=function(_0x156137){return function(_0x3cc29f){logger[_0x4803('0x8')](_0x156137,util[_0x4803('0x9')](_0x3cc29f,{'showHidden':![],'depth':null}));};};exports[_0x4803('0xa')]=function(_0x45b8c4,_0x13afde){logger[_0x4803('0xb')](_0x45b8c4,util[_0x4803('0x9')](_0x13afde,{'showHidden':![],'depth':null}));};exports[_0x4803('0xc')]=function(_0x3ae08f,_0x2d73e9){logger[_0x4803('0x8')](_0x3ae08f,util[_0x4803('0x9')](_0x2d73e9,{'showHidden':![],'depth':null}));};exports[_0x4803('0xd')]=function(_0x396703){return function(_0x30a32e){logger[_0x4803('0xb')](_0x396703,util[_0x4803('0x9')](_0x30a32e,{'showHidden':![],'depth':null}));};};exports[_0x4803('0xe')]=function(_0x4e6d84,_0x27b0bf,_0x918334){return{'message':_0x4e6d84,'unlock':_0x27b0bf,'active':_0x918334};};exports[_0x4803('0xf')]=function(_0x16e151,_0x237341,_0x58c4ea){if(!_['isUndefined'](_0x58c4ea)&&_0x4803('0x10')===typeof _0x58c4ea&&!_[_0x4803('0x11')](_0x58c4ea)){if(!_[_0x4803('0x12')](_0x237341)&&_0x4803('0x10')===typeof _0x237341&&!_[_0x4803('0x11')](_0x237341)){return util[_0x4803('0x13')](_0x4803('0x14'),_0x237341,_0x58c4ea);}return util[_0x4803('0x13')]('\x22%s\x22\x20<%s>',_0x58c4ea,_0x58c4ea);}if(!_[_0x4803('0x12')](_0x16e151)&&_0x4803('0x10')===typeof _0x16e151&&!_[_0x4803('0x11')](_0x16e151)){return _0x16e151;}return _0x4803('0x15');};exports[_0x4803('0x16')]=function(_0x29254d){if(_[_0x4803('0x17')](_0x29254d)){return![];}return _0x29254d;};exports['addVariables']=function(_0x41865c,_0x833596,_0x220ef5,_0x3f7399,_0x2f3b34,_0x392bb2){var _0x551c5c={'XMD-QUEUE':_0x833596[_0x4803('0x18')]?_0x833596[_0x4803('0x18')][_0x4803('0x19')]:'','XMD-CALLERID':_0x3f7399,'XMD-CALLERID-PREVIEW':_0x392bb2?util['format']('\x22%s\x22\x20<%s>',_0x392bb2['calleridname'],_0x392bb2[_0x4803('0x1a')]):_0x3f7399,'XMD-DIALID':_0x2f3b34,'XMD-CONTACTID':_0x833596[_0x4803('0x1b')],'XMD-CDRTYPE':_0x4803('0x1c'),'CALLERID(all)':_0x3f7399,'XMD-VOICEQUEUEID':_0x833596[_0x4803('0x1d')],'XMD-DIALCHANNEL':_0x220ef5,'XMD-DIALTIMEOUT':_0x41865c[_0x4803('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x4803('0x13')](_0x4803('0x1f'),_0x41865c[_0x4803('0x20')]?'g':'',_[_0x4803('0x11')](_0x41865c['monitor_format'])?'':_0x4803('0x21')),'XMD-DIALURL':_0x41865c[_0x4803('0x22')]||'','XMD-AGI':_0x41865c[_0x4803('0x23')]?util[_0x4803('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x41865c['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x41865c['dialQueueProject2']?util[_0x4803('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x41865c[_0x4803('0x20')]):_0x4803('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x392bb2?_0x392bb2['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x392bb2?_0x392bb2['originatecalleridname']:'','XMD-DESTINATION':_0x4803('0x25'),'SIPADDHEADER':_0x4803('0x26')};if(!_['isEmpty'](_0x41865c[_0x4803('0x27')])){_0x551c5c[util[_0x4803('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x41865c[_0x4803('0x27')];_0x551c5c[util['format']('%s',_0x4803('0x28'))]=_0x2f3b34;}if(_0x833596&&_0x833596[_0x4803('0x29')]){for(var _0x3f5107 in _0x833596[_0x4803('0x29')]){if(_0x833596[_0x4803('0x29')][_0x4803('0x2a')](_0x3f5107)){if(!_[_0x4803('0x17')](_0x833596['Contact'][_0x3f5107])&&_0x3f5107!=='id'&&_0x3f5107!==_0x4803('0x2b')&&_0x3f5107!==_0x4803('0x2c')&&_0x3f5107!==_0x4803('0x2d')){_0x551c5c[util['format'](_0x4803('0x2e'),_0x4803('0x2f'),_[_0x4803('0x30')](_0x3f5107))]=_0x833596[_0x4803('0x29')][_0x3f5107];}}}}return _0x551c5c;};exports[_0x4803('0x31')]=function(_0xc115a){var _0x50eeca={};for(var _0x3c77bb in _0xc115a){if(_0xc115a['hasOwnProperty'](_0x3c77bb)){_0x50eeca[util[_0x4803('0x13')]('%s',_[_0x4803('0x32')](_0x3c77bb))]=_0xc115a[_0x3c77bb];}}return{'variables':_0x50eeca};};exports[_0x4803('0x33')]=function(_0x11aea3,_0x4be0a7){if(!_[_0x4803('0x17')](_0x11aea3)){if(_0x11aea3['hasOwnProperty'](_0x4803('0x34'))){if(_0x11aea3[_0x4803('0x34')]>0x0){_0x11aea3[_0x4803('0x34')]-=0x1;}else{logger['error'](_0x4803('0x35'),_0x4be0a7);}}}else{logger[_0x4803('0x8')](_0x4803('0x36'),_0x4be0a7);}};exports[_0x4803('0x37')]=function(_0x81bf21){var _0x4ae0c9=moment()['format'](_0x4803('0x38'));_0x81bf21['state']=0xd;_0x81bf21['statedesc']='Blacklist';_0x81bf21[_0x4803('0x39')]=_0x4ae0c9;_0x81bf21[_0x4803('0x3a')]=_0x4ae0c9;_0x81bf21[_0x4803('0x3b')]=_0x4ae0c9;};exports[_0x4803('0x3c')]=function(_0x3ba6be,_0xf6c4a0,_0x13dd55){var _0x50d65c=moment()['format'](_0x4803('0x38'));_0x3ba6be[_0x4803('0x3d')]=_0xf6c4a0;_0x3ba6be[_0x4803('0x3e')]=_0x13dd55;_0x3ba6be['responsetime']=_0x50d65c;_0x3ba6be[_0x4803('0x3f')]=getSeconds(_0x3ba6be[_0x4803('0x3a')],_0x3ba6be['starttime']);};exports[_0x4803('0x40')]=function(_0x5ab85c,_0x36a13a,_0x21762c){_0x5ab85c['membername']=_0x36a13a;_0x5ab85c[_0x4803('0x41')]=_0x21762c;};exports[_0x4803('0x42')]=function(_0x3e8e99,_0x328fff,_0x56cd47){var _0x1c9dc1=moment()[_0x4803('0x13')](_0x4803('0x38'));_0x3e8e99['state']=_0x328fff;_0x3e8e99[_0x4803('0x3e')]=_0x56cd47;_0x3e8e99[_0x4803('0x3a')]=_0x3e8e99[_0x4803('0x3a')]?_0x3e8e99['responsetime']:_0x1c9dc1;_0x3e8e99[_0x4803('0x3b')]=_0x3e8e99[_0x4803('0x3b')]?_0x3e8e99[_0x4803('0x3b')]:_0x1c9dc1;_0x3e8e99[_0x4803('0x3f')]=getSeconds(_0x3e8e99[_0x4803('0x3a')]||0x0,_0x3e8e99[_0x4803('0x39')]||0x0);_0x3e8e99[_0x4803('0x43')]=_0x3e8e99['answertime']?getSeconds(_0x3e8e99[_0x4803('0x3b')],_0x3e8e99[_0x4803('0x44')]):0x0;};exports[_0x4803('0x45')]=function(_0x2cec45){return _0x2cec45==='Failure';};exports[_0x4803('0x46')]=function(_0x3f8715,_0x408cbd,_0x5467c3,_0x316e3f,_0x3cd822){var _0x327a92=_0x316e3f?_0x4803('0x47'):_0x3f8715[_0x4803('0x48')];_0x327a92=_0x3cd822?_0x4803('0x49'):_0x327a92;return{'actionid':_0x3f8715[_0x4803('0x4a')],'action':_0x4803('0x4b'),'channel':_0x3f8715[_0x4803('0x4c')],'callerid':util['format'](_0x4803('0x14'),_0x327a92,_0x3f8715['calleridnum']),'Exten':_0x4803('0x25'),'Context':_0x4803('0x4d'),'Priority':'1','variable':_0x5467c3,'timeout':(_0x408cbd[_0x4803('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f8715[_0x4803('0x4a')]};};exports[_0x4803('0x4f')]=function(_0x68373c){return _0x68373c[_0x4803('0x50')]+_0x68373c[_0x4803('0x51')]+_0x68373c[_0x4803('0x52')]+_0x68373c[_0x4803('0x53')]+_0x68373c[_0x4803('0x54')];};exports[_0x4803('0x55')]=function(_0x3d51ab){var _0x4ed6e7=_[_0x4803('0x56')](_0x3d51ab);_0x4ed6e7['state']=0xf;_0x4ed6e7['statedesc']=_0x4803('0x57');return _0x4ed6e7;};exports['scheduledAt']=function(_0x24cc11,_0x14bffd,_0x18ece0){var _0x31f37f={};_0x31f37f[_0x14bffd]=_0x24cc11[_0x14bffd];_0x31f37f[_0x4803('0x58')]=![];_0x31f37f['scheduledat']=moment()[_0x4803('0x59')](_0x18ece0,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x31f37f[_0x4803('0x1b')]=_0x24cc11[_0x4803('0x1b')];_0x31f37f[_0x4803('0x5a')]=_0x24cc11['ListId'];_0x31f37f['VoiceQueueId']=_0x24cc11['VoiceQueueId']||undefined;return _0x31f37f;};exports[_0x4803('0x5b')]=function(_0x5856ef,_0x350956){if(!_[_0x4803('0x17')](_0x5856ef)){if(_0x5856ef[_0x4803('0x5c')]>0x0){_0x5856ef[_0x4803('0x5c')]-=0x1;}else{logger[_0x4803('0x8')](_0x350956,_0x4803('0x5d'));}}else{logger[_0x4803('0x8')](_0x350956,_0x4803('0x5e'));}};exports[_0x4803('0x5f')]=function(_0x38b19f){if(_0x38b19f<=0x0){return!![];}return![];};exports[_0x4803('0x60')]=function(_0x310f2e,_0x3e49a7,_0x310854){_0x310f2e['lastevent']=_0x3e49a7;_0x310f2e['name']=_0x310f2e[_0x4803('0x61')];_0x310f2e['interface']=_0x310f2e['channelAgent'];_0x310f2e[_0x4803('0x62')]=_0x4803('0x63');if(_0x310854){_0x310f2e['mandatoryDisposition']=_0x310854[_0x4803('0x64')];}return _0x310f2e;};exports['buildAcw']=function(_0x236ebb){var _0x1ec1a8={};_0x1ec1a8[_0x4803('0x61')]=_0x236ebb[_0x4803('0x61')];_0x1ec1a8[_0x4803('0x65')]=_0x236ebb[_0x4803('0x4c')];_0x1ec1a8['uniqueid']=_0x236ebb[_0x4803('0x4a')];return _0x1ec1a8;};exports[_0x4803('0x66')]=function(_0x2382c9){var _0xbda536=[];for(var _0x1067d4 in _0x2382c9){if(_0x2382c9[_0x4803('0x2a')](_0x1067d4)){if(!_[_0x4803('0x17')](_0x2382c9[_0x1067d4])&&_0x2382c9[_0x1067d4][_0x4803('0x3d')]===_0x4803('0x67')&&_0x2382c9[_0x1067d4][_0x4803('0x68')]===_0x4803('0x69')){_0xbda536[_0x4803('0x6a')](_0x2382c9[_0x1067d4]['id']);}}}return _0xbda536;};exports[_0x4803('0x6b')]=function(_0x349617){var _0x4c7b52=moment()[_0x4803('0x5')](0x0);var _0x47d61c=moment(_0x349617)['milliseconds'](0x0);return _0x4c7b52[_0x4803('0x6c')](_0x47d61c,_0x4803('0x6'));};exports[_0x4803('0x6d')]=function(_0x86189c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x86189c[_0x4803('0x1b')],'ListId':_0x86189c[_0x4803('0x5a')],'VoiceQueueId':_0x86189c[_0x4803('0x1d')]||undefined,'CampaignId':_0x86189c[_0x4803('0x6e')]||undefined};};exports[_0x4803('0x6f')]=function(_0x274398){if(_0x274398==='uniqueid'||_0x274398===_0x4803('0x70')||_0x274398===_0x4803('0x61')||_0x274398===_0x4803('0x71')||_0x274398===_0x4803('0x72')||_0x274398===_0x4803('0x73')||_0x274398==='membername'||_0x274398===_0x4803('0x4c')||_0x274398===_0x4803('0x48')||_0x274398===_0x4803('0x58')||_0x274398===_0x4803('0x1a')||_0x274398===_0x4803('0x74')||_0x274398===_0x4803('0x50')||_0x274398===_0x4803('0x51')||_0x274398==='countnoanswerretry'||_0x274398===_0x4803('0x75')||_0x274398===_0x4803('0x76')||_0x274398===_0x4803('0x77')||_0x274398===_0x4803('0x78')||_0x274398==='recallme'||_0x274398===_0x4803('0x1b')||_0x274398===_0x4803('0x5a')||_0x274398===_0x4803('0x41')||_0x274398===_0x4803('0x1d')||_0x274398==='sipcallid'||_0x274398==='xmd-voicequeueid'||_0x274398==='xmd-queue'||_0x274398===_0x4803('0x79')||_0x274398==='xmd-listid'||_0x274398==='xmd-dialurl'||_0x274398===_0x4803('0x7a')||_0x274398===_0x4803('0x7b')||_0x274398===_0x4803('0x7c')||_0x274398==='xmd-dialchannel'||_0x274398===_0x4803('0x7d')||_0x274398==='xmd-cdrtype'||_0x274398===_0x4803('0x7e')||_0x274398===_0x4803('0x7f')||_0x274398===_0x4803('0x80')||_0x274398===_0x4803('0x81')||_0x274398===_0x4803('0x82')||_0x274398===_0x4803('0x83')||_0x274398===_0x4803('0x84')||_0x274398===_0x4803('0x85')||_0x274398===_0x4803('0x86')||_0x274398==='rtpaudioqosrtt'||_0x274398==='rtpaudioqosrttbridged'||_0x274398===_0x4803('0x81')||_0x274398===_0x4803('0x82')||_0x274398===_0x4803('0x83')||_0x274398==='rtpaudioqosjitterbridged'||_0x274398===_0x4803('0x85')||_0x274398===_0x4803('0x86')||_0x274398===_0x4803('0x87')||_0x274398===_0x4803('0x88')||_0x274398===_0x4803('0x89')||_0x274398==='bridgepvtcallid'||_0x274398===_0x4803('0x3d')||_0x274398===_0x4803('0x3e')){return![];}return!![];};exports[_0x4803('0x8a')]=function(_0x78e85e,_0x222c6c){var _0x2c6c5f,_0x35cd43,_0x4dbc86;if(_0x222c6c<=0x0){_0x222c6c=0x1;}_0x2c6c5f=new RegExp(_0x4803('0x8b')+_0x222c6c+'}$');_0x35cd43=Math[_0x4803('0x8c')](0xa,_0x222c6c-0x1);_0x4dbc86=Math['pow'](0xa,_0x222c6c)-0x1;return util[_0x4803('0x13')]('%s',_[_0x4803('0x8d')](_0x78e85e,_0x2c6c5f,_['random'](_0x35cd43,_0x4dbc86)));};exports[_0x4803('0x8e')]=function(_0x367dc8){var _0x2cf841=_0x367dc8[_0x4803('0x8f')](/"(.*?)"/);return _0x2cf841?_0x2cf841[0x1]:_0x367dc8;};exports[_0x4803('0x90')]=function(_0x1ea677){var _0x1daab5=_0x1ea677[_0x4803('0x8f')](/<(.*?)>/);return _0x1daab5?_0x1daab5[0x1]:_0x1ea677;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7b51521..c3c45ed 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 _0x11a5=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11a5,0x16f));var _0x511a=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x11a5[_0x12d812];return _0x3711ab;};'use strict';exports['queueadd']={'queue':{'type':_0x511a('0x0'),'required':!![]},'interface':{'type':_0x511a('0x0'),'required':!![]},'membername':{'type':_0x511a('0x0'),'required':!![]},'penalty':{'type':_0x511a('0x1'),'required':![]},'paused':{'type':_0x511a('0x2'),'required':![]}};exports[_0x511a('0x3')]={'queue':{'type':_0x511a('0x0'),'required':!![]},'interface':{'type':_0x511a('0x0'),'required':!![]}};exports[_0x511a('0x4')]={'interface':{'type':_0x511a('0x0'),'required':!![]},'paused':{'type':_0x511a('0x2')},'reason':{'type':_0x511a('0x0'),'required':![]}};exports[_0x511a('0x5')]={'module':{'type':_0x511a('0x0'),'required':![]}};exports[_0x511a('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x511a('0x7')]={'uniqueid':{'type':_0x511a('0x0'),'required':!![]},'filename':{'type':_0x511a('0x0')},'format':{'type':_0x511a('0x0')},'mixmonitorid':{'type':_0x511a('0x0')}};exports[_0x511a('0x8')]={'uniqueid':{'type':_0x511a('0x0'),'required':!![]}};exports[_0x511a('0x9')]={'uniqueid':{'type':_0x511a('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x07ba=['queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove'];(function(_0x48651a,_0x154d06){var _0x50a081=function(_0x30c8b5){while(--_0x30c8b5){_0x48651a['push'](_0x48651a['shift']());}};_0x50a081(++_0x154d06);}(_0x07ba,0x104));var _0xa07b=function(_0x438a94,_0x3c0c56){_0x438a94=_0x438a94-0x0;var _0x4baf66=_0x07ba[_0x438a94];return _0x4baf66;};'use strict';exports[_0xa07b('0x0')]={'queue':{'type':_0xa07b('0x1'),'required':!![]},'interface':{'type':_0xa07b('0x1'),'required':!![]},'membername':{'type':_0xa07b('0x1'),'required':!![]},'penalty':{'type':_0xa07b('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xa07b('0x3')]={'queue':{'type':_0xa07b('0x1'),'required':!![]},'interface':{'type':_0xa07b('0x1'),'required':!![]}};exports[_0xa07b('0x4')]={'interface':{'type':_0xa07b('0x1'),'required':!![]},'paused':{'type':_0xa07b('0x5')},'reason':{'type':'string','required':![]}};exports[_0xa07b('0x6')]={'module':{'type':_0xa07b('0x1'),'required':![]}};exports[_0xa07b('0x7')]={'uniqueid':{'type':_0xa07b('0x1'),'required':!![]}};exports[_0xa07b('0x8')]={'uniqueid':{'type':_0xa07b('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xa07b('0x1')}};exports[_0xa07b('0x9')]={'uniqueid':{'type':_0xa07b('0x1'),'required':!![]}};exports[_0xa07b('0xa')]={'uniqueid':{'type':_0xa07b('0x1'),'required':!![]},'exten':{'type':_0xa07b('0x1'),'required':!![]},'context':{'type':_0xa07b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8920921..8ba8197 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 _0x0b8e=['timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels'];(function(_0x6ac36d,_0x2a0947){var _0x5f00eb=function(_0x121a33){while(--_0x121a33){_0x6ac36d['push'](_0x6ac36d['shift']());}};_0x5f00eb(++_0x2a0947);}(_0x0b8e,0xc2));var _0xe0b8=function(_0x77ca77,_0x5d5b0f){_0x77ca77=_0x77ca77-0x0;var _0x55ed70=_0x0b8e[_0x77ca77];return _0x55ed70;};'use strict';var BPromise=require(_0xe0b8('0x0'));var util=require(_0xe0b8('0x1'));var _=require('lodash');var moment=require(_0xe0b8('0x2'));var Agent=require(_0xe0b8('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xe0b8('0x4'));var Trigger=require(_0xe0b8('0x5'));var Template=require(_0xe0b8('0x6'));var Campaign=require(_0xe0b8('0x7'));var VoiceExtension=require(_0xe0b8('0x8'));var ZendeskAccount=require(_0xe0b8('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xe0b8('0xa'));var SugarcrmAccount=require(_0xe0b8('0xb'));var ZohoAccount=require(_0xe0b8('0xc'));var DeskAccount=require(_0xe0b8('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xe0b8('0xe'));var Dynamics365Account=require(_0xe0b8('0xf'));var FreshsalesAccount=require(_0xe0b8('0x10'));var FaxAccount=require(_0xe0b8('0x11'));var Realtime=function(){this[_0xe0b8('0x12')]={};this[_0xe0b8('0x13')]={};this[_0xe0b8('0x14')]={};this[_0xe0b8('0x15')]={};this[_0xe0b8('0x16')]={};this['campaigns']={};this[_0xe0b8('0x17')]={};this[_0xe0b8('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b8('0x19')]={};this['channels']={};this[_0xe0b8('0x1a')]={};this[_0xe0b8('0x1b')]={};this[_0xe0b8('0x1c')]={};this['settings']={};this[_0xe0b8('0x1d')]={};this[_0xe0b8('0x1e')]={};this[_0xe0b8('0x1f')]={};this[_0xe0b8('0x20')]={};this[_0xe0b8('0x21')]={};this[_0xe0b8('0x22')]={};this[_0xe0b8('0x23')]={};this[_0xe0b8('0x24')]={};this[_0xe0b8('0x25')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x1010ec,_0x59af64,_0x350c6c){var _0x22d93e=_[_0xe0b8('0x26')](_0x1010ec,function(_0x132b20,_0x151d4f){return _0x132b20[_0x350c6c];});for(var _0x3dcbb8 in _0x59af64){if(_0x59af64[_0xe0b8('0x27')](_0x3dcbb8)){if(!_0x22d93e[_0x3dcbb8]){delete _0x59af64[_0x3dcbb8];}}}}function freeIsNotKeySip(_0x483d65,_0x2ef51e){var _0x7e6dac=_[_0xe0b8('0x26')](_0x483d65,function(_0x902791,_0x4632c3){return util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x902791['name']);});for(var _0x3610b9 in _0x2ef51e){if(_0x2ef51e['hasOwnProperty'](_0x3610b9)){if(!_0x7e6dac[_0x3610b9]){delete _0x2ef51e[_0x3610b9];}}}}function freeIsNotKeyAgent(_0x26d928,_0x1b5aeb){var _0x3c11bf=_[_0xe0b8('0x26')](_0x26d928,function(_0x383c88,_0xa63e06){var _0x2f9804=_['isNil'](_0x383c88[_0xe0b8('0x2a')])?util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x383c88[_0xe0b8('0x2b')]):_0x383c88[_0xe0b8('0x2a')];return _0x2f9804;});for(var _0x4cab0f in _0x1b5aeb){if(_0x1b5aeb[_0xe0b8('0x27')](_0x4cab0f)){if(!_0x3c11bf[_0x4cab0f]){delete _0x1b5aeb[_0x4cab0f];}}}}function clearVoiceCallReports(_0x56749a){_0x56749a[_0xe0b8('0x2c')]=0x0;_0x56749a[_0xe0b8('0x2d')]=0x0;_0x56749a[_0xe0b8('0x2e')]=0x0;_0x56749a[_0xe0b8('0x2f')]=0x0;_0x56749a[_0xe0b8('0x30')]=0x0;}function clearCampaigns(_0x1aa342){if(!_[_0xe0b8('0x31')](_0x1aa342)){for(var _0x3774e1 in _0x1aa342){if(_0x1aa342[_0xe0b8('0x27')](_0x3774e1)){_0x1aa342[_0x3774e1][_0xe0b8('0x32')]=0x0;_0x1aa342[_0x3774e1][_0xe0b8('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2bfefc){if(!_[_0xe0b8('0x31')](_0x2bfefc)){for(var _0xd1b071 in _0x2bfefc){if(_0x2bfefc[_0xe0b8('0x27')](_0xd1b071)){_0x2bfefc[_0xd1b071][_0xe0b8('0x2c')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x2d')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x34')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x35')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x2e')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x2f')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x30')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x36')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x37')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x38')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x39')]=0x0;_0x2bfefc[_0xd1b071]['outboundNoSuchCallsDay']=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3a')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3b')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3c')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3d')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3e')]=0x0;_0x2bfefc[_0xd1b071]['outboundRejectCallsDay']=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x3f')]=0x0;_0x2bfefc[_0xd1b071]['outboundAnswerAgiCallsDay']=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x40')]=0x0;_0x2bfefc[_0xd1b071][_0xe0b8('0x41')]=!![];}}}}Realtime['prototype'][_0xe0b8('0x42')]=function(_0x3ee346,_0x378042){for(var _0xe5b032 in _0x378042){if(_0x3ee346['hasOwnProperty'](_0xe5b032)){_0x3ee346[_0xe5b032]=_0x378042[_0xe5b032];}}};Realtime[_0xe0b8('0x43')][_0xe0b8('0x44')]=function(){var _0x4f73f1=this;return function(_0x294aaa){if(_0x294aaa){freeIsNotKeyAgent(_0x294aaa,_0x4f73f1[_0xe0b8('0x12')]);for(var _0xcef088=0x0,_0x3c4884={},_0xe688a0={};_0xcef088<_0x294aaa[_0xe0b8('0x45')];_0xcef088+=0x1){_0x3c4884=_0x294aaa[_0xcef088];var _0x516773=_[_0xe0b8('0x46')](_0x3c4884[_0xe0b8('0x2a')])?util['format'](_0xe0b8('0x29'),_0x3c4884[_0xe0b8('0x2b')]):_0x3c4884['interface'];if(_[_0xe0b8('0x47')](_0x4f73f1[_0xe0b8('0x12')][_0x516773])){_0x4f73f1[_0xe0b8('0x12')][_0x516773]=new Agent(_0x3c4884);}else{_0x4f73f1['mergeFromDatabase'](_0x4f73f1[_0xe0b8('0x12')][_0x516773],_0x3c4884);}}}return _0x4f73f1['agents'];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x48')]=function(){var _0x2bfa0a=this;return function(_0x165f59){if(_0x165f59){freeIsNotKeySip(_0x165f59,_0x2bfa0a['telephones']);for(var _0x3aea25=0x0,_0x125e86={},_0x31fba1={};_0x3aea25<_0x165f59[_0xe0b8('0x45')];_0x3aea25+=0x1){_0x125e86=_0x165f59[_0x3aea25];if(_[_0xe0b8('0x47')](_0x2bfa0a[_0xe0b8('0x13')][util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x125e86[_0xe0b8('0x2b')])])){_0x2bfa0a[_0xe0b8('0x13')][util['format'](_0xe0b8('0x29'),_0x125e86[_0xe0b8('0x2b')])]=new Telephone(_0x125e86);}else{_0x2bfa0a['mergeFromDatabase'](_0x2bfa0a[_0xe0b8('0x13')][util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x125e86[_0xe0b8('0x2b')])],_0x125e86);}}}return _0x2bfa0a[_0xe0b8('0x13')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x49')]=function(){var _0x581a65=this;return function(_0x564430){if(_0x564430){freeIsNotKeySip(_0x564430,_0x581a65[_0xe0b8('0x14')]);for(var _0x18d7db=0x0,_0x1b4006={},_0x2c0b77={};_0x18d7db<_0x564430[_0xe0b8('0x45')];_0x18d7db+=0x1){_0x1b4006=_0x564430[_0x18d7db];if(_[_0xe0b8('0x47')](_0x581a65[_0xe0b8('0x14')][util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x1b4006['name'])])){_0x581a65[_0xe0b8('0x14')][util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x1b4006[_0xe0b8('0x2b')])]=new Trunk(_0x1b4006);}else{_0x581a65[_0xe0b8('0x42')](_0x581a65[_0xe0b8('0x14')][util[_0xe0b8('0x28')](_0xe0b8('0x29'),_0x1b4006[_0xe0b8('0x2b')])],_0x1b4006);}}}return _0x581a65[_0xe0b8('0x14')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x4a')]=function(){var _0x87a396=this;return function(_0x23c2ed){if(_0x23c2ed){freeIsNotKey(_0x23c2ed,_0x87a396[_0xe0b8('0x15')],_0xe0b8('0x2b'));for(var _0x586bf8=0x0,_0x392377={},_0x2fe906={};_0x586bf8<_0x23c2ed['length'];_0x586bf8+=0x1){_0x392377=_0x23c2ed[_0x586bf8];if(_[_0xe0b8('0x47')](_0x87a396[_0xe0b8('0x15')][_0x392377['name']])){_0x87a396[_0xe0b8('0x15')][_0x392377[_0xe0b8('0x2b')]]=new VoiceQueue(_0x392377);}else{_0x87a396[_0xe0b8('0x42')](_0x87a396['voiceQueues'][_0x392377[_0xe0b8('0x2b')]],_0x392377);}}}return _0x87a396[_0xe0b8('0x15')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x4b')]=function(){var _0x55212f=this;return function(_0x417d12){if(_0x417d12){freeIsNotKey(_0x417d12,_0x55212f[_0xe0b8('0x16')],'id');for(var _0x1d72c7=0x0,_0x239a42={},_0x2d0e40={};_0x1d72c7<_0x417d12['length'];_0x1d72c7+=0x1){_0x239a42=_0x417d12[_0x1d72c7];if(_[_0xe0b8('0x47')](_0x55212f[_0xe0b8('0x16')][_0x239a42['id']])){_0x55212f[_0xe0b8('0x16')][_0x239a42['id']]=new Trigger(_0x239a42);}else{_0x55212f['mergeFromDatabase'](_0x55212f[_0xe0b8('0x16')][_0x239a42['id']],_0x239a42);}}}return _0x55212f[_0xe0b8('0x16')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x4c')]=function(){var _0x176025=this;return function(_0x138994){if(_0x138994){freeIsNotKey(_0x138994,_0x176025[_0xe0b8('0x17')],'id');for(var _0x4c00cd=0x0,_0x62a122={},_0x3538f4={};_0x4c00cd<_0x138994[_0xe0b8('0x45')];_0x4c00cd+=0x1){_0x62a122=_0x138994[_0x4c00cd];if(_[_0xe0b8('0x47')](_0x176025[_0xe0b8('0x17')][_0x62a122['id']])){_0x176025[_0xe0b8('0x17')][_0x62a122['id']]=new Template(_0x62a122);}else{_0x176025[_0xe0b8('0x42')](_0x176025['templates'][_0x62a122['id']],_0x62a122);}}}return _0x176025[_0xe0b8('0x17')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x4d')]=function(){var _0x421e58=this;return function(_0x3c4cf9){if(_0x3c4cf9){freeIsNotKey(_0x3c4cf9,_0x421e58['zendeskAccounts'],'id');for(var _0x2c0ff2=0x0,_0x359fe1={},_0xb501e9={};_0x2c0ff2<_0x3c4cf9[_0xe0b8('0x45')];_0x2c0ff2+=0x1){_0x359fe1=_0x3c4cf9[_0x2c0ff2];if(_[_0xe0b8('0x47')](_0x421e58['zendeskAccounts'][_0x359fe1['id']])){_0x421e58[_0xe0b8('0x1d')][_0x359fe1['id']]=new ZendeskAccount(_0x359fe1);}else{_0x421e58[_0xe0b8('0x42')](_0x421e58[_0xe0b8('0x1d')][_0x359fe1['id']],_0x359fe1);}}}return _0x421e58['zendeskAccounts'];};};Realtime['prototype'][_0xe0b8('0x4e')]=function(){var _0x3acdd5=this;return function(_0x4d8955){if(_0x4d8955){freeIsNotKey(_0x4d8955,_0x3acdd5[_0xe0b8('0x1e')],'id');for(var _0x26bf97=0x0,_0x23a9cd={},_0x2c73b8={};_0x26bf97<_0x4d8955[_0xe0b8('0x45')];_0x26bf97+=0x1){_0x23a9cd=_0x4d8955[_0x26bf97];if(_[_0xe0b8('0x47')](_0x3acdd5['salesforceAccounts'][_0x23a9cd['id']])){_0x3acdd5[_0xe0b8('0x1e')][_0x23a9cd['id']]=new SalesforceAccount(_0x23a9cd);}else{_0x3acdd5['mergeFromDatabase'](_0x3acdd5[_0xe0b8('0x1e')][_0x23a9cd['id']],_0x23a9cd);}}}return _0x3acdd5[_0xe0b8('0x1e')];};};Realtime[_0xe0b8('0x43')]['initFreshdeskAccounts']=function(){var _0x52506c=this;return function(_0x54d53d){if(_0x54d53d){freeIsNotKey(_0x54d53d,_0x52506c[_0xe0b8('0x20')],'id');for(var _0x584bfb=0x0,_0x1279d6={},_0x39b411={};_0x584bfb<_0x54d53d['length'];_0x584bfb+=0x1){_0x1279d6=_0x54d53d[_0x584bfb];if(_[_0xe0b8('0x47')](_0x52506c[_0xe0b8('0x20')][_0x1279d6['id']])){_0x52506c['freshdeskAccounts'][_0x1279d6['id']]=new FreshdeskAccount(_0x1279d6);}else{_0x52506c['mergeFromDatabase'](_0x52506c[_0xe0b8('0x20')][_0x1279d6['id']],_0x1279d6);}}}return _0x52506c[_0xe0b8('0x20')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x4f')]=function(){var _0xf5befb=this;return function(_0x32f86d){if(_0x32f86d){freeIsNotKey(_0x32f86d,_0xf5befb['zohoAccounts'],'id');for(var _0x122367=0x0,_0x1af334={},_0x197284={};_0x122367<_0x32f86d[_0xe0b8('0x45')];_0x122367+=0x1){_0x1af334=_0x32f86d[_0x122367];if(_[_0xe0b8('0x47')](_0xf5befb[_0xe0b8('0x21')][_0x1af334['id']])){_0xf5befb[_0xe0b8('0x21')][_0x1af334['id']]=new ZohoAccount(_0x1af334);}else{_0xf5befb[_0xe0b8('0x42')](_0xf5befb[_0xe0b8('0x21')][_0x1af334['id']],_0x1af334);}}}return _0xf5befb['zohoAccounts'];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x50')]=function(){var _0x1ed36e=this;return function(_0x36d7b9){if(_0x36d7b9){freeIsNotKey(_0x36d7b9,_0x1ed36e['deskAccounts'],'id');for(var _0x28ae49=0x0,_0x2d082f={},_0x34e302={};_0x28ae49<_0x36d7b9[_0xe0b8('0x45')];_0x28ae49+=0x1){_0x2d082f=_0x36d7b9[_0x28ae49];if(_[_0xe0b8('0x47')](_0x1ed36e[_0xe0b8('0x22')][_0x2d082f['id']])){_0x1ed36e[_0xe0b8('0x22')][_0x2d082f['id']]=new DeskAccount(_0x2d082f);}else{_0x1ed36e[_0xe0b8('0x42')](_0x1ed36e['deskAccounts'][_0x2d082f['id']],_0x2d082f);}}}return _0x1ed36e[_0xe0b8('0x22')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x51')]=function(){var _0x1db8e9=this;return function(_0x3b225b){if(_0x3b225b){freeIsNotKey(_0x3b225b,_0x1db8e9['sugarcrmAccounts'],'id');for(var _0x1177dd=0x0,_0x452690={},_0x4e549c={};_0x1177dd<_0x3b225b[_0xe0b8('0x45')];_0x1177dd+=0x1){_0x452690=_0x3b225b[_0x1177dd];if(_[_0xe0b8('0x47')](_0x1db8e9[_0xe0b8('0x1f')][_0x452690['id']])){_0x1db8e9[_0xe0b8('0x1f')][_0x452690['id']]=new SugarcrmAccount(_0x452690);}else{_0x1db8e9['mergeFromDatabase'](_0x1db8e9[_0xe0b8('0x1f')][_0x452690['id']],_0x452690);}}}return _0x1db8e9[_0xe0b8('0x1f')];};};Realtime[_0xe0b8('0x43')]['initVtigerAccounts']=function(){var _0x3b12ce=this;return function(_0x5704ef){if(_0x5704ef){freeIsNotKey(_0x5704ef,_0x3b12ce[_0xe0b8('0x23')],'id');for(var _0x124407=0x0,_0x55a5a6={},_0x1899cc={};_0x124407<_0x5704ef['length'];_0x124407+=0x1){_0x55a5a6=_0x5704ef[_0x124407];if(_['isUndefined'](_0x3b12ce[_0xe0b8('0x23')][_0x55a5a6['id']])){_0x3b12ce[_0xe0b8('0x23')][_0x55a5a6['id']]=new VtigerAccount(_0x55a5a6);}else{_0x3b12ce['mergeFromDatabase'](_0x3b12ce[_0xe0b8('0x23')][_0x55a5a6['id']],_0x55a5a6);}}}return _0x3b12ce[_0xe0b8('0x23')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x52')]=function(){var _0x524cd5=this;return function(_0x2d10d3){if(_0x2d10d3){freeIsNotKey(_0x2d10d3,_0x524cd5[_0xe0b8('0x24')],'id');for(var _0x4e324a=0x0,_0x46beed={},_0x1b3589={};_0x4e324a<_0x2d10d3[_0xe0b8('0x45')];_0x4e324a+=0x1){_0x46beed=_0x2d10d3[_0x4e324a];if(_['isUndefined'](_0x524cd5['servicenowAccounts'][_0x46beed['id']])){_0x524cd5[_0xe0b8('0x24')][_0x46beed['id']]=new ServicenowAccount(_0x46beed);}else{_0x524cd5[_0xe0b8('0x42')](_0x524cd5[_0xe0b8('0x24')][_0x46beed['id']],_0x46beed);}}}return _0x524cd5[_0xe0b8('0x24')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x53')]=function(){var _0x38835f=this;return function(_0x5234bf){if(_0x5234bf){freeIsNotKey(_0x5234bf,_0x38835f['dynamics365Accounts'],'id');for(var _0x4622b6=0x0,_0x3c73a4={},_0x1fc79c={};_0x4622b6<_0x5234bf[_0xe0b8('0x45')];_0x4622b6+=0x1){_0x3c73a4=_0x5234bf[_0x4622b6];if(_[_0xe0b8('0x47')](_0x38835f[_0xe0b8('0x25')][_0x3c73a4['id']])){_0x38835f[_0xe0b8('0x25')][_0x3c73a4['id']]=new Dynamics365Account(_0x3c73a4);}else{_0x38835f['mergeFromDatabase'](_0x38835f['dynamics365Accounts'][_0x3c73a4['id']],_0x3c73a4);}}}return _0x38835f[_0xe0b8('0x25')];};};Realtime[_0xe0b8('0x43')]['initFreshsalesAccounts']=function(){var _0xa92b3c=this;return function(_0x505d14){if(_0x505d14){freeIsNotKey(_0x505d14,_0xa92b3c[_0xe0b8('0x54')],'id');for(var _0x4b92a4=0x0,_0x20660a={},_0x1c1511={};_0x4b92a4<_0x505d14[_0xe0b8('0x45')];_0x4b92a4+=0x1){_0x20660a=_0x505d14[_0x4b92a4];if(_['isUndefined'](_0xa92b3c[_0xe0b8('0x54')][_0x20660a['id']])){_0xa92b3c[_0xe0b8('0x54')][_0x20660a['id']]=new FreshsalesAccount(_0x20660a);}else{_0xa92b3c[_0xe0b8('0x42')](_0xa92b3c[_0xe0b8('0x54')][_0x20660a['id']],_0x20660a);}}}return _0xa92b3c[_0xe0b8('0x54')];};};Realtime['prototype'][_0xe0b8('0x55')]=function(){var _0x22479f=this;return function(_0x5ea31a){for(var _0x191786=0x0;_0x191786<_0x5ea31a[_0xe0b8('0x45')];_0x191786+=0x1){_['merge'](_0x22479f[_0xe0b8('0x15')][_0x5ea31a[_0x191786][_0xe0b8('0x2b')]],_0x5ea31a[_0x191786]);}return _0x22479f[_0xe0b8('0x15')];};};Realtime['prototype'][_0xe0b8('0x56')]=function(){var _0x28e2e8=this;return function(_0x36f8e6){clearVoiceQueues(_0x28e2e8[_0xe0b8('0x15')]);if(_0x36f8e6){_0x36f8e6=_[_0xe0b8('0x57')](_0x36f8e6,_0xe0b8('0x58'));for(var _0x4ce5b8 in _0x36f8e6){if(_0x36f8e6['hasOwnProperty'](_0x4ce5b8)){var _0x1cd4a5={};for(var _0x546234=0x0;_0x546234<_0x36f8e6[_0x4ce5b8][_0xe0b8('0x45')];_0x546234+=0x1){var _0x29c487=_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x59')];if(_0x28e2e8[_0xe0b8('0x15')][_0x29c487]){if(_0x36f8e6[_0x4ce5b8][_0x546234]['queuecallerexit']){_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x34')]+=0x1;}if(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5a')]){_0x28e2e8['voiceQueues'][_0x29c487][_0xe0b8('0x35')]+=0x1;}_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2e')]+=moment(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5b')])['diff'](moment(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5c')]),_0xe0b8('0x5d'))||0x0;if(_0x546234===_0x36f8e6[_0x4ce5b8][_0xe0b8('0x45')]-0x1){_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2f')]+=moment(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5e')]||_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5f')]||_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x60')])[_0xe0b8('0x61')](moment(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x5c')]),_0xe0b8('0x5d'))||0x0;_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2c')]+=0x1;if(_0x36f8e6[_0x4ce5b8][_0x546234][_0xe0b8('0x62')]){_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2d')]+=0x1;_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x30')]+=moment(_0x36f8e6[_0x4ce5b8][_0x546234]['queuecallercompleteAt'])[_0xe0b8('0x61')](moment(_0x36f8e6[_0x4ce5b8][_0x546234]['queuecallerleaveAt']),_0xe0b8('0x5d'))||0x0;}}else{_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2f')]+=_0x28e2e8[_0xe0b8('0x15')][_0x29c487][_0xe0b8('0x2e')]||0x0;}}}}}}return _0x28e2e8['voiceQueues'];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x63')]=function(){var _0x45c95d=this;return function(_0x385437){clearVoiceCallReports(_0x45c95d['outbound']);if(_0x385437){for(var _0x166138=0x0;_0x166138<_0x385437[_0xe0b8('0x45')];_0x166138+=0x1){_0x45c95d[_0xe0b8('0x18')][_0xe0b8('0x2c')]+=0x1;_0x45c95d[_0xe0b8('0x18')]['sumDuration']+=_0x385437[_0x166138]['duration'];if(_0x385437[_0x166138]['disposition']===_0xe0b8('0x64')){_0x45c95d[_0xe0b8('0x18')][_0xe0b8('0x2d')]+=0x1;_0x45c95d[_0xe0b8('0x18')][_0xe0b8('0x2e')]+=_0x385437[_0x166138][_0xe0b8('0x65')]-_0x385437[_0x166138][_0xe0b8('0x66')]||0x0;_0x45c95d['outbound'][_0xe0b8('0x30')]+=_0x385437[_0x166138]['billableseconds'];}}}return _0x45c95d[_0xe0b8('0x18')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x67')]=function(){var _0x47bf66=this;return function(_0x16aeed){if(_0x16aeed){freeIsNotKey(_0x16aeed,_0x47bf66['campaigns'],_0xe0b8('0x2b'));for(var _0x58a608=0x0,_0x336134={};_0x58a608<_0x16aeed['length'];_0x58a608+=0x1){_0x336134=_0x16aeed[_0x58a608];if(_[_0xe0b8('0x47')](_0x47bf66[_0xe0b8('0x68')][_0x336134[_0xe0b8('0x2b')]])){_0x47bf66['campaigns'][_0x336134['name']]=new Campaign(_0x336134);}else{_0x47bf66[_0xe0b8('0x42')](_0x47bf66['campaigns'][_0x336134['name']],_0x336134);_0x47bf66[_0xe0b8('0x68')][_0x336134[_0xe0b8('0x2b')]][_0xe0b8('0x69')]=_0x336134[_0xe0b8('0x6a')]?_0x336134[_0xe0b8('0x6a')]['name']:undefined;}}}return _0x47bf66[_0xe0b8('0x68')];};};Realtime[_0xe0b8('0x43')]['initVoiceExtensions']=function(){var _0x300b32=this;return function(_0x202f17){if(_0x202f17){freeIsNotKey(_0x202f17,_0x300b32[_0xe0b8('0x19')],'id');for(var _0x59faa3=0x0,_0x18fdfa={};_0x59faa3<_0x202f17[_0xe0b8('0x45')];_0x59faa3+=0x1){_0x18fdfa=_0x202f17[_0x59faa3];if(_[_0xe0b8('0x47')](_0x300b32[_0xe0b8('0x19')][_0x18fdfa['id']])){_0x300b32[_0xe0b8('0x19')][_0x18fdfa['id']]=new VoiceExtension(_0x18fdfa);}else{_0x300b32[_0xe0b8('0x42')](_0x300b32[_0xe0b8('0x19')][_0x18fdfa['id']],_0x18fdfa);}}}return _0x300b32['voiceExtensions'];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x6b')]=function(){var _0x20914e=this;return function(_0x259a83){clearCampaigns(_0x20914e[_0xe0b8('0x68')]);for(var _0x609f45=0x0;_0x609f45<_0x259a83[_0xe0b8('0x45')];_0x609f45+=0x1){_['merge'](_0x20914e[_0xe0b8('0x68')][_0x259a83[_0x609f45][_0xe0b8('0x2b')]],_0x259a83[_0x609f45]);}return _0x20914e[_0xe0b8('0x68')];};};Realtime[_0xe0b8('0x43')][_0xe0b8('0x6c')]=function(){var _0x1f3d93=this;return function(_0x18b853){if(_0x18b853){freeIsNotKey(_0x18b853,_0x1f3d93[_0xe0b8('0x6d')],'id');for(var _0x19bef6=0x0,_0x16aa64={},_0x5cfe09={};_0x19bef6<_0x18b853['length'];_0x19bef6+=0x1){_0x16aa64=_0x18b853[_0x19bef6];if(_[_0xe0b8('0x47')](_0x1f3d93[_0xe0b8('0x6d')][_0x16aa64['id']])){_0x1f3d93[_0xe0b8('0x6d')][_0x16aa64['id']]=new FaxAccount(_0x16aa64);}else{_0x1f3d93[_0xe0b8('0x42')](_0x1f3d93['faxAccounts'][_0x16aa64['id']],_0x16aa64);}}}return _0x1f3d93[_0xe0b8('0x6d')];};};module[_0xe0b8('0x6e')]=Realtime; \ No newline at end of file +var _0x9cab=['dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumBillable','isEmpty','total','unmanaged','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','diff','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x4ff1fb,_0x4184d4){var _0x30e1fb=function(_0x2d6a70){while(--_0x2d6a70){_0x4ff1fb['push'](_0x4ff1fb['shift']());}};_0x30e1fb(++_0x4184d4);}(_0x9cab,0xab));var _0xb9ca=function(_0x53d719,_0x147238){_0x53d719=_0x53d719-0x0;var _0xea1220=_0x9cab[_0x53d719];return _0xea1220;};'use strict';var BPromise=require(_0xb9ca('0x0'));var util=require(_0xb9ca('0x1'));var _=require(_0xb9ca('0x2'));var moment=require(_0xb9ca('0x3'));var Agent=require('../model/agent');var Telephone=require(_0xb9ca('0x4'));var Trunk=require(_0xb9ca('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xb9ca('0x6'));var Campaign=require(_0xb9ca('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xb9ca('0x8'));var SalesforceAccount=require(_0xb9ca('0x9'));var FreshdeskAccount=require(_0xb9ca('0xa'));var SugarcrmAccount=require(_0xb9ca('0xb'));var ZohoAccount=require(_0xb9ca('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xb9ca('0xd'));var ServicenowAccount=require(_0xb9ca('0xe'));var Dynamics365Account=require(_0xb9ca('0xf'));var FreshsalesAccount=require(_0xb9ca('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xb9ca('0x11')]={};this[_0xb9ca('0x12')]={};this[_0xb9ca('0x13')]={};this[_0xb9ca('0x14')]={};this[_0xb9ca('0x15')]={};this[_0xb9ca('0x16')]={};this[_0xb9ca('0x17')]={};this[_0xb9ca('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xb9ca('0x19')]={};this[_0xb9ca('0x1a')]={};this[_0xb9ca('0x1b')]={};this[_0xb9ca('0x1c')]={};this[_0xb9ca('0x1d')]={};this['zendeskAccounts']={};this[_0xb9ca('0x1e')]={};this[_0xb9ca('0x1f')]={};this[_0xb9ca('0x20')]={};this[_0xb9ca('0x21')]={};this[_0xb9ca('0x22')]={};this[_0xb9ca('0x23')]={};this[_0xb9ca('0x24')]={};this[_0xb9ca('0x25')]={};this[_0xb9ca('0x26')]={};this[_0xb9ca('0x27')]={};};function freeIsNotKey(_0x27663a,_0x4431ea,_0x41cf89){var _0xb10126=_[_0xb9ca('0x28')](_0x27663a,function(_0x487253,_0x1c1257){return _0x487253[_0x41cf89];});for(var _0x1f941b in _0x4431ea){if(_0x4431ea[_0xb9ca('0x29')](_0x1f941b)){if(!_0xb10126[_0x1f941b]){delete _0x4431ea[_0x1f941b];}}}}function freeIsNotKeySip(_0x431e22,_0x5d1a24){var _0x21246f=_[_0xb9ca('0x28')](_0x431e22,function(_0x301723,_0xaa87a8){return util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x301723[_0xb9ca('0x2c')]);});for(var _0xa93ec in _0x5d1a24){if(_0x5d1a24[_0xb9ca('0x29')](_0xa93ec)){if(!_0x21246f[_0xa93ec]){delete _0x5d1a24[_0xa93ec];}}}}function freeIsNotKeyAgent(_0x4d080e,_0x518e96){var _0x46b7b3=_[_0xb9ca('0x28')](_0x4d080e,function(_0x1dcf08,_0x3a237a){var _0x4ba7bd=_[_0xb9ca('0x2d')](_0x1dcf08[_0xb9ca('0x2e')])?util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x1dcf08[_0xb9ca('0x2c')]):_0x1dcf08['interface'];return _0x4ba7bd;});for(var _0x1ba57d in _0x518e96){if(_0x518e96[_0xb9ca('0x29')](_0x1ba57d)){if(!_0x46b7b3[_0x1ba57d]){delete _0x518e96[_0x1ba57d];}}}}function clearVoiceCallReports(_0x2ec058){_0x2ec058['total']=0x0;_0x2ec058[_0xb9ca('0x2f')]=0x0;_0x2ec058[_0xb9ca('0x30')]=0x0;_0x2ec058['sumDuration']=0x0;_0x2ec058[_0xb9ca('0x31')]=0x0;}function clearCampaigns(_0x22df12){if(!_[_0xb9ca('0x32')](_0x22df12)){for(var _0x315cf9 in _0x22df12){if(_0x22df12[_0xb9ca('0x29')](_0x315cf9)){_0x22df12[_0x315cf9]['ivrTotalCallsDays']=0x0;_0x22df12[_0x315cf9]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x36e004){if(!_[_0xb9ca('0x32')](_0x36e004)){for(var _0x47a586 in _0x36e004){if(_0x36e004['hasOwnProperty'](_0x47a586)){_0x36e004[_0x47a586][_0xb9ca('0x33')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x2f')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x34')]=0x0;_0x36e004[_0x47a586]['abandoned']=0x0;_0x36e004[_0x47a586][_0xb9ca('0x30')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x35')]=0x0;_0x36e004[_0x47a586]['sumBillable']=0x0;_0x36e004[_0x47a586][_0xb9ca('0x36')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x37')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x38')]=0x0;_0x36e004[_0x47a586]['outboundCongestionCallsDay']=0x0;_0x36e004[_0x47a586]['outboundNoSuchCallsDay']=0x0;_0x36e004[_0x47a586][_0xb9ca('0x39')]=0x0;_0x36e004[_0x47a586]['outboundDropCallsDayTimeout']=0x0;_0x36e004[_0x47a586][_0xb9ca('0x3a')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x3b')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x3c')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x3d')]=0x0;_0x36e004[_0x47a586]['outboundReCallsDay']=0x0;_0x36e004[_0x47a586][_0xb9ca('0x36')]=0x0;_0x36e004[_0x47a586][_0xb9ca('0x3e')]=0x0;_0x36e004[_0x47a586]['queueStatusComplete']=!![];}}}}Realtime[_0xb9ca('0x3f')][_0xb9ca('0x40')]=function(_0x5d186b,_0x5e6300){for(var _0x48c965 in _0x5e6300){if(_0x5d186b[_0xb9ca('0x29')](_0x48c965)){_0x5d186b[_0x48c965]=_0x5e6300[_0x48c965];}}};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x41')]=function(){var _0x2c036c=this;return function(_0x2b7811){if(_0x2b7811){freeIsNotKeyAgent(_0x2b7811,_0x2c036c[_0xb9ca('0x11')]);for(var _0x157e58=0x0,_0x176ea6={},_0x4f3420={};_0x157e58<_0x2b7811[_0xb9ca('0x42')];_0x157e58+=0x1){_0x176ea6=_0x2b7811[_0x157e58];var _0x2d18e0=_[_0xb9ca('0x2d')](_0x176ea6[_0xb9ca('0x2e')])?util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x176ea6[_0xb9ca('0x2c')]):_0x176ea6[_0xb9ca('0x2e')];if(_[_0xb9ca('0x43')](_0x2c036c[_0xb9ca('0x11')][_0x2d18e0])){_0x2c036c[_0xb9ca('0x11')][_0x2d18e0]=new Agent(_0x176ea6);}else{_0x2c036c['mergeFromDatabase'](_0x2c036c[_0xb9ca('0x11')][_0x2d18e0],_0x176ea6);}}}return _0x2c036c[_0xb9ca('0x11')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x44')]=function(){var _0x24b673=this;return function(_0x19bf0b){if(_0x19bf0b){freeIsNotKeySip(_0x19bf0b,_0x24b673[_0xb9ca('0x12')]);for(var _0x271484=0x0,_0x38e476={},_0x5960b4={};_0x271484<_0x19bf0b[_0xb9ca('0x42')];_0x271484+=0x1){_0x38e476=_0x19bf0b[_0x271484];if(_[_0xb9ca('0x43')](_0x24b673[_0xb9ca('0x12')][util['format']('SIP/%s',_0x38e476[_0xb9ca('0x2c')])])){_0x24b673[_0xb9ca('0x12')][util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x38e476[_0xb9ca('0x2c')])]=new Telephone(_0x38e476);}else{_0x24b673[_0xb9ca('0x40')](_0x24b673[_0xb9ca('0x12')][util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x38e476[_0xb9ca('0x2c')])],_0x38e476);}}}return _0x24b673[_0xb9ca('0x12')];};};Realtime['prototype'][_0xb9ca('0x45')]=function(){var _0x47a4dd=this;return function(_0x37914a){if(_0x37914a){freeIsNotKeySip(_0x37914a,_0x47a4dd[_0xb9ca('0x13')]);for(var _0x13a4a9=0x0,_0x4c93fb={},_0x2fc2cf={};_0x13a4a9<_0x37914a[_0xb9ca('0x42')];_0x13a4a9+=0x1){_0x4c93fb=_0x37914a[_0x13a4a9];if(_[_0xb9ca('0x43')](_0x47a4dd[_0xb9ca('0x13')][util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x4c93fb[_0xb9ca('0x2c')])])){_0x47a4dd[_0xb9ca('0x13')][util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x4c93fb[_0xb9ca('0x2c')])]=new Trunk(_0x4c93fb);}else{_0x47a4dd[_0xb9ca('0x40')](_0x47a4dd[_0xb9ca('0x13')][util[_0xb9ca('0x2a')](_0xb9ca('0x2b'),_0x4c93fb[_0xb9ca('0x2c')])],_0x4c93fb);}}}return _0x47a4dd['trunks'];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x46')]=function(){var _0x28f1a3=this;return function(_0x4bf752){if(_0x4bf752){freeIsNotKey(_0x4bf752,_0x28f1a3[_0xb9ca('0x14')],'name');for(var _0x3147ad=0x0,_0x36f1d9={},_0x29750e={};_0x3147ad<_0x4bf752['length'];_0x3147ad+=0x1){_0x36f1d9=_0x4bf752[_0x3147ad];if(_[_0xb9ca('0x43')](_0x28f1a3[_0xb9ca('0x14')][_0x36f1d9['name']])){_0x28f1a3[_0xb9ca('0x14')][_0x36f1d9[_0xb9ca('0x2c')]]=new VoiceQueue(_0x36f1d9);}else{_0x28f1a3[_0xb9ca('0x40')](_0x28f1a3['voiceQueues'][_0x36f1d9[_0xb9ca('0x2c')]],_0x36f1d9);}}}return _0x28f1a3[_0xb9ca('0x14')];};};Realtime[_0xb9ca('0x3f')]['initTriggers']=function(){var _0x64c96c=this;return function(_0x2e2804){if(_0x2e2804){freeIsNotKey(_0x2e2804,_0x64c96c[_0xb9ca('0x15')],'id');for(var _0xbec893=0x0,_0x57b3ba={},_0x51f3f2={};_0xbec893<_0x2e2804['length'];_0xbec893+=0x1){_0x57b3ba=_0x2e2804[_0xbec893];if(_[_0xb9ca('0x43')](_0x64c96c[_0xb9ca('0x15')][_0x57b3ba['id']])){_0x64c96c['triggers'][_0x57b3ba['id']]=new Trigger(_0x57b3ba);}else{_0x64c96c[_0xb9ca('0x40')](_0x64c96c['triggers'][_0x57b3ba['id']],_0x57b3ba);}}}return _0x64c96c['triggers'];};};Realtime[_0xb9ca('0x3f')]['initTemplates']=function(){var _0x2c294a=this;return function(_0x4d9d82){if(_0x4d9d82){freeIsNotKey(_0x4d9d82,_0x2c294a['templates'],'id');for(var _0x177fde=0x0,_0x29e3dd={},_0x1784fe={};_0x177fde<_0x4d9d82[_0xb9ca('0x42')];_0x177fde+=0x1){_0x29e3dd=_0x4d9d82[_0x177fde];if(_[_0xb9ca('0x43')](_0x2c294a[_0xb9ca('0x17')][_0x29e3dd['id']])){_0x2c294a[_0xb9ca('0x17')][_0x29e3dd['id']]=new Template(_0x29e3dd);}else{_0x2c294a['mergeFromDatabase'](_0x2c294a[_0xb9ca('0x17')][_0x29e3dd['id']],_0x29e3dd);}}}return _0x2c294a['templates'];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x47')]=function(){var _0x53d6a8=this;return function(_0x20af38){if(_0x20af38){freeIsNotKey(_0x20af38,_0x53d6a8[_0xb9ca('0x48')],'id');for(var _0x771ea8=0x0,_0x52a59d={},_0x571d78={};_0x771ea8<_0x20af38[_0xb9ca('0x42')];_0x771ea8+=0x1){_0x52a59d=_0x20af38[_0x771ea8];if(_[_0xb9ca('0x43')](_0x53d6a8['zendeskAccounts'][_0x52a59d['id']])){_0x53d6a8['zendeskAccounts'][_0x52a59d['id']]=new ZendeskAccount(_0x52a59d);}else{_0x53d6a8['mergeFromDatabase'](_0x53d6a8[_0xb9ca('0x48')][_0x52a59d['id']],_0x52a59d);}}}return _0x53d6a8[_0xb9ca('0x48')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x49')]=function(){var _0x496bff=this;return function(_0x47b150){if(_0x47b150){freeIsNotKey(_0x47b150,_0x496bff[_0xb9ca('0x1e')],'id');for(var _0x58ddf1=0x0,_0x7050ab={},_0x422e1a={};_0x58ddf1<_0x47b150[_0xb9ca('0x42')];_0x58ddf1+=0x1){_0x7050ab=_0x47b150[_0x58ddf1];if(_['isUndefined'](_0x496bff[_0xb9ca('0x1e')][_0x7050ab['id']])){_0x496bff[_0xb9ca('0x1e')][_0x7050ab['id']]=new SalesforceAccount(_0x7050ab);}else{_0x496bff['mergeFromDatabase'](_0x496bff['salesforceAccounts'][_0x7050ab['id']],_0x7050ab);}}}return _0x496bff['salesforceAccounts'];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4a')]=function(){var _0x3a5e1a=this;return function(_0xa2de4c){if(_0xa2de4c){freeIsNotKey(_0xa2de4c,_0x3a5e1a[_0xb9ca('0x20')],'id');for(var _0x20b880=0x0,_0x5c71d4={},_0x45648e={};_0x20b880<_0xa2de4c[_0xb9ca('0x42')];_0x20b880+=0x1){_0x5c71d4=_0xa2de4c[_0x20b880];if(_[_0xb9ca('0x43')](_0x3a5e1a['freshdeskAccounts'][_0x5c71d4['id']])){_0x3a5e1a[_0xb9ca('0x20')][_0x5c71d4['id']]=new FreshdeskAccount(_0x5c71d4);}else{_0x3a5e1a['mergeFromDatabase'](_0x3a5e1a['freshdeskAccounts'][_0x5c71d4['id']],_0x5c71d4);}}}return _0x3a5e1a[_0xb9ca('0x20')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4b')]=function(){var _0x58ba92=this;return function(_0xf1fcab){if(_0xf1fcab){freeIsNotKey(_0xf1fcab,_0x58ba92[_0xb9ca('0x21')],'id');for(var _0x21074e=0x0,_0x53fec1={},_0x185d02={};_0x21074e<_0xf1fcab['length'];_0x21074e+=0x1){_0x53fec1=_0xf1fcab[_0x21074e];if(_['isUndefined'](_0x58ba92['zohoAccounts'][_0x53fec1['id']])){_0x58ba92[_0xb9ca('0x21')][_0x53fec1['id']]=new ZohoAccount(_0x53fec1);}else{_0x58ba92[_0xb9ca('0x40')](_0x58ba92[_0xb9ca('0x21')][_0x53fec1['id']],_0x53fec1);}}}return _0x58ba92[_0xb9ca('0x21')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4c')]=function(){var _0x3ce61e=this;return function(_0x538ead){if(_0x538ead){freeIsNotKey(_0x538ead,_0x3ce61e[_0xb9ca('0x22')],'id');for(var _0x470357=0x0,_0x441e09={},_0x1bbbf2={};_0x470357<_0x538ead[_0xb9ca('0x42')];_0x470357+=0x1){_0x441e09=_0x538ead[_0x470357];if(_[_0xb9ca('0x43')](_0x3ce61e['deskAccounts'][_0x441e09['id']])){_0x3ce61e['deskAccounts'][_0x441e09['id']]=new DeskAccount(_0x441e09);}else{_0x3ce61e[_0xb9ca('0x40')](_0x3ce61e[_0xb9ca('0x22')][_0x441e09['id']],_0x441e09);}}}return _0x3ce61e[_0xb9ca('0x22')];};};Realtime[_0xb9ca('0x3f')]['initSugarcrmAccounts']=function(){var _0x55b1ba=this;return function(_0x18b446){if(_0x18b446){freeIsNotKey(_0x18b446,_0x55b1ba['sugarcrmAccounts'],'id');for(var _0x3de1c0=0x0,_0x4e42bd={},_0x1c32e6={};_0x3de1c0<_0x18b446[_0xb9ca('0x42')];_0x3de1c0+=0x1){_0x4e42bd=_0x18b446[_0x3de1c0];if(_[_0xb9ca('0x43')](_0x55b1ba[_0xb9ca('0x1f')][_0x4e42bd['id']])){_0x55b1ba[_0xb9ca('0x1f')][_0x4e42bd['id']]=new SugarcrmAccount(_0x4e42bd);}else{_0x55b1ba[_0xb9ca('0x40')](_0x55b1ba[_0xb9ca('0x1f')][_0x4e42bd['id']],_0x4e42bd);}}}return _0x55b1ba[_0xb9ca('0x1f')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x4ab08a=this;return function(_0xee2c45){if(_0xee2c45){freeIsNotKey(_0xee2c45,_0x4ab08a[_0xb9ca('0x23')],'id');for(var _0x485e09=0x0,_0x35692e={},_0xdde05c={};_0x485e09<_0xee2c45[_0xb9ca('0x42')];_0x485e09+=0x1){_0x35692e=_0xee2c45[_0x485e09];if(_[_0xb9ca('0x43')](_0x4ab08a[_0xb9ca('0x23')][_0x35692e['id']])){_0x4ab08a[_0xb9ca('0x23')][_0x35692e['id']]=new VtigerAccount(_0x35692e);}else{_0x4ab08a[_0xb9ca('0x40')](_0x4ab08a['vtigerAccounts'][_0x35692e['id']],_0x35692e);}}}return _0x4ab08a['vtigerAccounts'];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4d')]=function(){var _0x1671f6=this;return function(_0x21bef9){if(_0x21bef9){freeIsNotKey(_0x21bef9,_0x1671f6[_0xb9ca('0x24')],'id');for(var _0x255675=0x0,_0x271d43={},_0x3f5c3d={};_0x255675<_0x21bef9['length'];_0x255675+=0x1){_0x271d43=_0x21bef9[_0x255675];if(_[_0xb9ca('0x43')](_0x1671f6[_0xb9ca('0x24')][_0x271d43['id']])){_0x1671f6[_0xb9ca('0x24')][_0x271d43['id']]=new ServicenowAccount(_0x271d43);}else{_0x1671f6[_0xb9ca('0x40')](_0x1671f6[_0xb9ca('0x24')][_0x271d43['id']],_0x271d43);}}}return _0x1671f6[_0xb9ca('0x24')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4e')]=function(){var _0x257f6b=this;return function(_0x518b27){if(_0x518b27){freeIsNotKey(_0x518b27,_0x257f6b[_0xb9ca('0x25')],'id');for(var _0x5d2658=0x0,_0x68bf8f={},_0x3fb93e={};_0x5d2658<_0x518b27['length'];_0x5d2658+=0x1){_0x68bf8f=_0x518b27[_0x5d2658];if(_[_0xb9ca('0x43')](_0x257f6b[_0xb9ca('0x25')][_0x68bf8f['id']])){_0x257f6b[_0xb9ca('0x25')][_0x68bf8f['id']]=new Dynamics365Account(_0x68bf8f);}else{_0x257f6b['mergeFromDatabase'](_0x257f6b[_0xb9ca('0x25')][_0x68bf8f['id']],_0x68bf8f);}}}return _0x257f6b[_0xb9ca('0x25')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x4f')]=function(){var _0x1fe8a6=this;return function(_0x3d40ce){if(_0x3d40ce){freeIsNotKey(_0x3d40ce,_0x1fe8a6[_0xb9ca('0x26')],'id');for(var _0x1579a0=0x0,_0x540db7={},_0x1b70e9={};_0x1579a0<_0x3d40ce[_0xb9ca('0x42')];_0x1579a0+=0x1){_0x540db7=_0x3d40ce[_0x1579a0];if(_[_0xb9ca('0x43')](_0x1fe8a6[_0xb9ca('0x26')][_0x540db7['id']])){_0x1fe8a6[_0xb9ca('0x26')][_0x540db7['id']]=new FreshsalesAccount(_0x540db7);}else{_0x1fe8a6[_0xb9ca('0x40')](_0x1fe8a6[_0xb9ca('0x26')][_0x540db7['id']],_0x540db7);}}}return _0x1fe8a6[_0xb9ca('0x26')];};};Realtime[_0xb9ca('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x3ab8cb=this;return function(_0x5b97bf){for(var _0x2edb7b=0x0;_0x2edb7b<_0x5b97bf[_0xb9ca('0x42')];_0x2edb7b+=0x1){_[_0xb9ca('0x50')](_0x3ab8cb[_0xb9ca('0x14')][_0x5b97bf[_0x2edb7b]['name']],_0x5b97bf[_0x2edb7b]);}return _0x3ab8cb[_0xb9ca('0x14')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x51')]=function(){var _0x43016c=this;return function(_0x4527b2){clearVoiceQueues(_0x43016c[_0xb9ca('0x14')]);if(_0x4527b2){_0x4527b2=_[_0xb9ca('0x52')](_0x4527b2,'uniqueid');for(var _0x251a59 in _0x4527b2){if(_0x4527b2[_0xb9ca('0x29')](_0x251a59)){var _0x2fbe69={};for(var _0xa6358b=0x0;_0xa6358b<_0x4527b2[_0x251a59][_0xb9ca('0x42')];_0xa6358b+=0x1){var _0x32e1f7=_0x4527b2[_0x251a59][_0xa6358b]['queue'];if(_0x43016c['voiceQueues'][_0x32e1f7]){if(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x53')]){_0x43016c[_0xb9ca('0x14')][_0x32e1f7]['unmanaged']+=0x1;}if(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x54')]){_0x43016c['voiceQueues'][_0x32e1f7]['abandoned']+=0x1;}_0x43016c[_0xb9ca('0x14')][_0x32e1f7][_0xb9ca('0x30')]+=moment(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x55')])['diff'](moment(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x56')]),_0xb9ca('0x57'))||0x0;if(_0xa6358b===_0x4527b2[_0x251a59][_0xb9ca('0x42')]-0x1){_0x43016c[_0xb9ca('0x14')][_0x32e1f7][_0xb9ca('0x35')]+=moment(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x58')]||_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x59')]||_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x5a')])['diff'](moment(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x56')]),_0xb9ca('0x57'))||0x0;_0x43016c[_0xb9ca('0x14')][_0x32e1f7]['total']+=0x1;if(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x5b')]){_0x43016c[_0xb9ca('0x14')][_0x32e1f7]['answered']+=0x1;_0x43016c[_0xb9ca('0x14')][_0x32e1f7]['sumBillable']+=moment(_0x4527b2[_0x251a59][_0xa6358b]['queuecallercompleteAt'])[_0xb9ca('0x5c')](moment(_0x4527b2[_0x251a59][_0xa6358b][_0xb9ca('0x55')]),_0xb9ca('0x57'))||0x0;}}else{_0x43016c[_0xb9ca('0x14')][_0x32e1f7][_0xb9ca('0x35')]+=_0x43016c[_0xb9ca('0x14')][_0x32e1f7][_0xb9ca('0x30')]||0x0;}}}}}}return _0x43016c['voiceQueues'];};};Realtime[_0xb9ca('0x3f')]['initVoiceCallReports']=function(){var _0x2d623a=this;return function(_0x26dfd9){clearVoiceCallReports(_0x2d623a[_0xb9ca('0x18')]);if(_0x26dfd9){for(var _0x44119b=0x0;_0x44119b<_0x26dfd9[_0xb9ca('0x42')];_0x44119b+=0x1){_0x2d623a[_0xb9ca('0x18')][_0xb9ca('0x33')]+=0x1;_0x2d623a[_0xb9ca('0x18')]['sumDuration']+=_0x26dfd9[_0x44119b][_0xb9ca('0x5d')];if(_0x26dfd9[_0x44119b][_0xb9ca('0x5e')]===_0xb9ca('0x5f')){_0x2d623a[_0xb9ca('0x18')][_0xb9ca('0x2f')]+=0x1;_0x2d623a[_0xb9ca('0x18')][_0xb9ca('0x30')]+=_0x26dfd9[_0x44119b][_0xb9ca('0x5d')]-_0x26dfd9[_0x44119b][_0xb9ca('0x60')]||0x0;_0x2d623a['outbound'][_0xb9ca('0x31')]+=_0x26dfd9[_0x44119b][_0xb9ca('0x60')];}}}return _0x2d623a[_0xb9ca('0x18')];};};Realtime[_0xb9ca('0x3f')]['initCampaigns']=function(){var _0xd3e9fd=this;return function(_0x4bffda){if(_0x4bffda){freeIsNotKey(_0x4bffda,_0xd3e9fd[_0xb9ca('0x16')],'name');for(var _0x3b21a2=0x0,_0x5d8634={};_0x3b21a2<_0x4bffda['length'];_0x3b21a2+=0x1){_0x5d8634=_0x4bffda[_0x3b21a2];if(_['isUndefined'](_0xd3e9fd[_0xb9ca('0x16')][_0x5d8634[_0xb9ca('0x2c')]])){_0xd3e9fd['campaigns'][_0x5d8634[_0xb9ca('0x2c')]]=new Campaign(_0x5d8634);}else{_0xd3e9fd[_0xb9ca('0x40')](_0xd3e9fd['campaigns'][_0x5d8634[_0xb9ca('0x2c')]],_0x5d8634);_0xd3e9fd[_0xb9ca('0x16')][_0x5d8634['name']][_0xb9ca('0x61')]=_0x5d8634[_0xb9ca('0x62')]?_0x5d8634[_0xb9ca('0x62')][_0xb9ca('0x2c')]:undefined;}}}return _0xd3e9fd[_0xb9ca('0x16')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x63')]=function(){var _0x62bf65=this;return function(_0x1cc5cf){if(_0x1cc5cf){freeIsNotKey(_0x1cc5cf,_0x62bf65['voiceExtensions'],'id');for(var _0xc494e0=0x0,_0x36cfe4={};_0xc494e0<_0x1cc5cf[_0xb9ca('0x42')];_0xc494e0+=0x1){_0x36cfe4=_0x1cc5cf[_0xc494e0];if(_['isUndefined'](_0x62bf65[_0xb9ca('0x64')][_0x36cfe4['id']])){_0x62bf65[_0xb9ca('0x64')][_0x36cfe4['id']]=new VoiceExtension(_0x36cfe4);}else{_0x62bf65[_0xb9ca('0x40')](_0x62bf65[_0xb9ca('0x64')][_0x36cfe4['id']],_0x36cfe4);}}}return _0x62bf65[_0xb9ca('0x64')];};};Realtime[_0xb9ca('0x3f')][_0xb9ca('0x65')]=function(){var _0x1734cf=this;return function(_0x5387c5){clearCampaigns(_0x1734cf[_0xb9ca('0x16')]);for(var _0x3d5f15=0x0;_0x3d5f15<_0x5387c5[_0xb9ca('0x42')];_0x3d5f15+=0x1){_['merge'](_0x1734cf[_0xb9ca('0x16')][_0x5387c5[_0x3d5f15][_0xb9ca('0x2c')]],_0x5387c5[_0x3d5f15]);}return _0x1734cf['campaigns'];};};Realtime['prototype'][_0xb9ca('0x66')]=function(){var _0x4d5a76=this;return function(_0x5870b8){if(_0x5870b8){freeIsNotKey(_0x5870b8,_0x4d5a76['faxAccounts'],'id');for(var _0x4284b8=0x0,_0x90b80e={},_0x87f664={};_0x4284b8<_0x5870b8[_0xb9ca('0x42')];_0x4284b8+=0x1){_0x90b80e=_0x5870b8[_0x4284b8];if(_[_0xb9ca('0x43')](_0x4d5a76[_0xb9ca('0x27')][_0x90b80e['id']])){_0x4d5a76[_0xb9ca('0x27')][_0x90b80e['id']]=new FaxAccount(_0x90b80e);}else{_0x4d5a76[_0xb9ca('0x40')](_0x4d5a76[_0xb9ca('0x27')][_0x90b80e['id']],_0x90b80e);}}}return _0x4d5a76[_0xb9ca('0x27')];};};module[_0xb9ca('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d3feb43..f540ec7 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 _0xb32a=['queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','exten','calleridname','connectedlinename','xcally-motion-dialer','create','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','attendedtransfer','findAgent','accountcode','name','find','interface','format','SIP/%s','length','lastAssignedTo','isNil'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xb32a,0x8a));var _0xab32=function(_0x14be89,_0x29dd86){_0x14be89=_0x14be89-0x0;var _0xcb9c38=_0xb32a[_0x14be89];return _0xcb9c38;};'use strict';var _=require(_0xab32('0x0'));var moment=require(_0xab32('0x1'));var util=require(_0xab32('0x2'));var config=require('../../../config/environment');var ami=require(_0xab32('0x3'));var RpcVoiceAgentReport=require(_0xab32('0x4'));var RpcVoiceCallReport=require(_0xab32('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xab32('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xab32('0x7'));var VoiceQueueReport=require(_0xab32('0x8'));var VoiceCallReport=require(_0xab32('0x9'));var VoiceAgentReport=require(_0xab32('0xa'));var VoiceDialReport=require(_0xab32('0xb'));var UserReport=require('./userReport');function Report(_0x1e3423){this['realtime']=_0x1e3423;this[_0xab32('0xc')]=_0x1e3423[_0xab32('0xc')];this[_0xab32('0xd')]=_0x1e3423[_0xab32('0xd')];}Report[_0xab32('0xe')][_0xab32('0xf')]=function(_0x5d86cd){var _0x2070d2=new VoiceQueueReport(this[_0xab32('0x10')]);var _0x53d24b=new VoiceAgentReport(this[_0xab32('0x10')]);var _0x446807=new VoiceDialReport(this[_0xab32('0x10')]);var _0x4d1b45=new VoiceCallReport(this[_0xab32('0x10')]);var _0x34c773=new UserReport(this['realtime']);if(config['xdr']&&config[_0xab32('0x11')]['disabled']){ami['on'](_0xab32('0x12'),this[_0xab32('0x13')][_0xab32('0x14')](this));ami['on'](_0xab32('0x15'),this[_0xab32('0x16')][_0xab32('0x14')](this));ami['on'](_0xab32('0x17'),this['voiceAgentReport'][_0xab32('0x14')](this));ami['on']('custom:voiceDialReport',this[_0xab32('0x18')][_0xab32('0x14')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xab32('0x14')](this));ami['on'](_0xab32('0x19'),this['attendedTransfer'][_0xab32('0x14')](this));}};Report['prototype'][_0xab32('0x1a')]=function(_0x627888){var _0x419120;_0x419120=_['find'](this['agents'],function(_0x5059d9){return _0x5059d9[_0xab32('0x1b')]==_0x627888||_0x5059d9[_0xab32('0x1c')]==_0x627888;});if(_['isNil'](_0x419120)){var _0x112350=_['find'](this['telephones'],function(_0x3a5d67){return _0x3a5d67[_0xab32('0x1b')]==_0x627888||_0x3a5d67['name']==_0x627888;});if(_0x112350){_0x419120=_[_0xab32('0x1d')](this[_0xab32('0xc')],function(_0x437185){return _0x437185[_0xab32('0x1e')]==util[_0xab32('0x1f')](_0xab32('0x20'),_0x112350[_0xab32('0x1c')]);});}}return _0x419120;};Report[_0xab32('0xe')][_0xab32('0x13')]=function(_0x1ddad0){for(var _0x3505e0=0x0;_0x3505e0<_0x1ddad0[_0xab32('0x21')];_0x3505e0+=0x1){var _0x1d5b2a=this[_0xab32('0x1a')](_0x1ddad0[_0x3505e0]['connectedlinenum']);if(_0x1d5b2a){_0x1ddad0[_0x3505e0][_0xab32('0x1b')]=_0x1d5b2a[_0xab32('0x1b')];_0x1ddad0[_0x3505e0]['assigned']=!![];_0x1ddad0[_0x3505e0][_0xab32('0x22')]=_0x1d5b2a['name'];_0x1ddad0[_0x3505e0]['interface']=_[_0xab32('0x23')](_0x1d5b2a['interface'])?util[_0xab32('0x1f')](_0xab32('0x20'),_0x1d5b2a[_0xab32('0x1c')]):_0x1d5b2a[_0xab32('0x1e')];if(_0x1ddad0[_0x3505e0][_0xab32('0x24')]){_0x1ddad0[_0x3505e0][_0xab32('0x25')]=moment()['format'](_0xab32('0x26'));}if(_0x1ddad0[_0x3505e0][_0xab32('0x27')]){_0x1ddad0[_0x3505e0][_0xab32('0x28')]=moment()['format'](_0xab32('0x26'));}RpcMemberReport[_0xab32('0x13')](_0x1ddad0[_0x3505e0]);}RpcVoiceQueueReport['create'](_0x1ddad0[_0x3505e0]);}};function extractCalleridNumber(_0x361bb5){var _0x1d0efd=_0x361bb5[_0xab32('0x29')](/<(.*?)>/);return _0x1d0efd?_0x1d0efd[0x1]:_0x361bb5;}Report['prototype'][_0xab32('0x16')]=function(_0x36ffb8){_0x36ffb8[_0xab32('0x2a')]=_0x36ffb8[_0xab32('0x2a')]||_0x36ffb8['exten'];if(_0x36ffb8[_0xab32('0x2b')]=='dialer'){_0x36ffb8[_0xab32('0x2c')]=_0xab32('0x2d');_0x36ffb8[_0xab32('0x2e')]=_0x36ffb8[_0xab32('0x2d')];if(_0x36ffb8[_0xab32('0x2f')]==_0xab32('0x30')){_0x36ffb8[_0xab32('0x1b')]='';_0x36ffb8['destination']=extractCalleridNumber(_0x36ffb8[_0xab32('0x31')]);}else if(_0x36ffb8[_0xab32('0x2f')]=='from-sip'){if(_0x36ffb8['destination']==_0xab32('0x32')){_0x36ffb8['destination']=extractCalleridNumber(_0x36ffb8[_0xab32('0x33')]);_0x36ffb8[_0xab32('0x34')]=_0x36ffb8[_0xab32('0x35')];_0x36ffb8['destinationchannel']=[_0x36ffb8[_0xab32('0x36')],_0x36ffb8[_0xab32('0x36')]=_0x36ffb8[_0xab32('0x37')]][0x0];_0x36ffb8[_0xab32('0x31')]=_0x36ffb8[_0xab32('0x33')];}else{_0x36ffb8['destination']=_0x36ffb8['calleridnum'];_0x36ffb8[_0xab32('0x34')]=_0x36ffb8['originatecalleridnum'];if(_0x36ffb8[_0xab32('0x38')]=='ANSWERED'){_0x36ffb8[_0xab32('0x1b')]=_0x36ffb8[_0xab32('0x39')];}else{_0x36ffb8[_0xab32('0x1b')]='';}}}}else{_0x36ffb8[_0xab32('0x31')]=util[_0xab32('0x1f')](_0xab32('0x3a'),_0x36ffb8['calleridname'],_0x36ffb8['calleridnum']);}if(RpcVoiceTransferReport[_0xab32('0x3b')][_0x36ffb8[_0xab32('0x3c')]]){var _0x564785=RpcVoiceTransferReport[_0xab32('0x3b')][_0x36ffb8[_0xab32('0x3c')]];_0x564785['transfereelinkedid']=_0x36ffb8[_0xab32('0x3d')];RpcVoiceTransferReport[_0xab32('0x3e')](_0x564785);delete RpcVoiceTransferReport[_0xab32('0x3b')][_0x36ffb8[_0xab32('0x3c')]];}RpcVoiceCallReport['create'](_0x36ffb8);if(_0x36ffb8[_0xab32('0x3f')]){for(var _0x476223=0x0;_0x476223<_0x36ffb8[_0xab32('0x40')]['length'];_0x476223+=0x1){_0x36ffb8[_0xab32('0x41')]=_0x36ffb8[_0xab32('0x40')][_0x476223][_0xab32('0x42')];_0x36ffb8[_0xab32('0x43')]=_0x36ffb8[_0xab32('0x40')][_0x476223][_0xab32('0x43')];if(_0x36ffb8[_0xab32('0x44')]==_0xab32('0x32')){_0x36ffb8[_0xab32('0x34')]=_0x36ffb8[_0xab32('0x39')];_0x36ffb8[_0xab32('0x45')]=_0x36ffb8[_0xab32('0x46')];_0x36ffb8[_0xab32('0x39')]=_0x36ffb8['accountcode'];_0x36ffb8['connectedlinename']=_0x36ffb8['membername'];_0x36ffb8['exten']=_0x36ffb8['originatecalleridnum'];}else if(_0x36ffb8[_0xab32('0x44')]==_0xab32('0x47')){_0x36ffb8[_0xab32('0x34')]=_0x36ffb8[_0xab32('0x2a')];_0x36ffb8[_0xab32('0x44')]=_0x36ffb8['originatecalleridnum'];}RpcVoiceRecording[_0xab32('0x48')](_0x36ffb8);}}};Report[_0xab32('0xe')][_0xab32('0x49')]=function(_0x72b7b8){if(_[_0xab32('0x4a')](_0x72b7b8)){_0x72b7b8[_0xab32('0x4b')](function(_0x5511bd){RpcVoiceAgentReport[_0xab32('0x48')](_0x5511bd);});}else{RpcVoiceAgentReport['create'](_0x72b7b8);}};Report[_0xab32('0xe')][_0xab32('0x18')]=function(_0x1da712){RpcVoiceDialReport[_0xab32('0x48')](_0x1da712);var _0x564a6c;var _0x4b4bfe;var _0x525456=_0x1da712[_0xab32('0x36')];if(_[_0xab32('0x4c')](_0x525456,_0xab32('0x4d'))){_0x4b4bfe=_0x525456[_0xab32('0x4e')](_0x525456[_0xab32('0x4f')]('/')+0x1,_0x525456[_0xab32('0x4f')]('@'));_0x564a6c=_['find'](this[_0xab32('0xc')],function(_0x45d4b4){return _0x45d4b4[_0xab32('0x50')]==_0x4b4bfe||_0x45d4b4[_0xab32('0x51')]==_0x4b4bfe||_0x45d4b4['accountcode']==_0x4b4bfe;});}else{_0x4b4bfe=_0x525456[_0xab32('0x4e')](_0x525456[_0xab32('0x4f')]('/')+0x1,_0x525456[_0xab32('0x52')]('-'));_0x564a6c=this[_0xab32('0x1a')](_0x4b4bfe);}if(_0x564a6c){_0x1da712[_0xab32('0x1e')]=_[_0xab32('0x23')](_0x564a6c[_0xab32('0x1e')])?util[_0xab32('0x1f')](_0xab32('0x20'),_0x564a6c['name']):_0x564a6c[_0xab32('0x1e')];_0x1da712[_0xab32('0x53')]=_0x564a6c['name'];_0x1da712[_0xab32('0x1b')]=_0x564a6c[_0xab32('0x1b')];RpcMemberReport[_0xab32('0x18')](_0x1da712);}};Report[_0xab32('0xe')]['blindTransfer']=function(_0x32a2b0){RpcVoiceTransferReport[_0xab32('0x3b')][_0x32a2b0[_0xab32('0x54')]]=_0x32a2b0;};Report['prototype'][_0xab32('0x55')]=function(_0x68d11a){RpcVoiceTransferReport['attendedTransfer'](_0x68d11a);};module[_0xab32('0x56')]=Report; \ No newline at end of file +var _0xc011=['xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','assigned','lastAssignedTo','format','queuecallercomplete','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','linkedid','transfers','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','phone','transfererlinkedid','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0xc011,0x9c));var _0x1c01=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc011[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x1c01('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x1c01('0x1'));var ami=require(_0x1c01('0x2'));var RpcVoiceAgentReport=require(_0x1c01('0x3'));var RpcVoiceCallReport=require(_0x1c01('0x4'));var RpcVoiceDialReport=require(_0x1c01('0x5'));var RpcMemberReport=require(_0x1c01('0x6'));var RpcVoiceQueueReport=require(_0x1c01('0x7'));var RpcVoiceRecording=require(_0x1c01('0x8'));var RpcVoiceTransferReport=require(_0x1c01('0x9'));var VoiceQueueReport=require(_0x1c01('0xa'));var VoiceCallReport=require(_0x1c01('0xb'));var VoiceAgentReport=require(_0x1c01('0xc'));var VoiceDialReport=require(_0x1c01('0xd'));var UserReport=require(_0x1c01('0xe'));function Report(_0x57967e){this[_0x1c01('0xf')]=_0x57967e;this['agents']=_0x57967e[_0x1c01('0x10')];this[_0x1c01('0x11')]=_0x57967e[_0x1c01('0x11')];}Report[_0x1c01('0x12')][_0x1c01('0x13')]=function(_0x1d5822){var _0x286fe9=new VoiceQueueReport(this['realtime']);var _0x54f91e=new VoiceAgentReport(this[_0x1c01('0xf')]);var _0x4db5c8=new VoiceDialReport(this[_0x1c01('0xf')]);var _0x5f27cc=new VoiceCallReport(this['realtime']);var _0x3336dd=new UserReport(this[_0x1c01('0xf')]);if(config['xdr']&&config[_0x1c01('0x14')][_0x1c01('0x15')]){ami['on'](_0x1c01('0x16'),this[_0x1c01('0x17')]['bind'](this));ami['on'](_0x1c01('0x18'),this[_0x1c01('0x19')]['bind'](this));ami['on'](_0x1c01('0x1a'),this[_0x1c01('0x1b')]['bind'](this));ami['on'](_0x1c01('0x1c'),this[_0x1c01('0x1d')]['bind'](this));ami['on']('blindtransfer',this[_0x1c01('0x1e')]['bind'](this));ami['on'](_0x1c01('0x1f'),this[_0x1c01('0x20')]['bind'](this));}};Report['prototype'][_0x1c01('0x21')]=function(_0x3d10fb){var _0x29e5ff;_0x29e5ff=_[_0x1c01('0x22')](this[_0x1c01('0x10')],function(_0x1862e9){return _0x1862e9[_0x1c01('0x23')]==_0x3d10fb||_0x1862e9[_0x1c01('0x24')]==_0x3d10fb;});if(_[_0x1c01('0x25')](_0x29e5ff)){var _0x272d5c=_['find'](this[_0x1c01('0x11')],function(_0x3cb481){return _0x3cb481[_0x1c01('0x23')]==_0x3d10fb||_0x3cb481[_0x1c01('0x24')]==_0x3d10fb;});if(_0x272d5c){_0x29e5ff=_['find'](this[_0x1c01('0x10')],function(_0x2d3936){return _0x2d3936[_0x1c01('0x26')]==util['format'](_0x1c01('0x27'),_0x272d5c[_0x1c01('0x24')]);});}}return _0x29e5ff;};Report[_0x1c01('0x12')]['voiceQueueReport']=function(_0x59c8ec){for(var _0x54d31b=0x0;_0x54d31b<_0x59c8ec[_0x1c01('0x28')];_0x54d31b+=0x1){var _0x15e1e2=this['findAgent'](_0x59c8ec[_0x54d31b]['connectedlinenum']);if(_0x15e1e2){_0x59c8ec[_0x54d31b][_0x1c01('0x23')]=_0x15e1e2['accountcode'];_0x59c8ec[_0x54d31b][_0x1c01('0x29')]=!![];_0x59c8ec[_0x54d31b][_0x1c01('0x2a')]=_0x15e1e2[_0x1c01('0x24')];_0x59c8ec[_0x54d31b][_0x1c01('0x26')]=_[_0x1c01('0x25')](_0x15e1e2['interface'])?util[_0x1c01('0x2b')](_0x1c01('0x27'),_0x15e1e2[_0x1c01('0x24')]):_0x15e1e2[_0x1c01('0x26')];if(_0x59c8ec[_0x54d31b][_0x1c01('0x2c')]){_0x59c8ec[_0x54d31b]['queuecallercompleteAt']=moment()[_0x1c01('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x59c8ec[_0x54d31b][_0x1c01('0x2d')]){_0x59c8ec[_0x54d31b][_0x1c01('0x2e')]=moment()[_0x1c01('0x2b')](_0x1c01('0x2f'));}RpcMemberReport[_0x1c01('0x17')](_0x59c8ec[_0x54d31b]);}RpcVoiceQueueReport[_0x1c01('0x30')](_0x59c8ec[_0x54d31b]);}};function extractCalleridNumber(_0x2ed579){var _0x4e4b39=_0x2ed579[_0x1c01('0x31')](/<(.*?)>/);return _0x4e4b39?_0x4e4b39[0x1]:_0x2ed579;}Report[_0x1c01('0x12')][_0x1c01('0x19')]=function(_0x50d716){_0x50d716['destination']=_0x50d716[_0x1c01('0x32')]||_0x50d716[_0x1c01('0x33')];if(_0x50d716[_0x1c01('0x34')]==_0x1c01('0x35')){_0x50d716[_0x1c01('0x36')]='queue';_0x50d716[_0x1c01('0x37')]=_0x50d716[_0x1c01('0x38')];if(_0x50d716[_0x1c01('0x39')]=='from-voip-provider'){_0x50d716[_0x1c01('0x23')]='';_0x50d716[_0x1c01('0x32')]=extractCalleridNumber(_0x50d716[_0x1c01('0x3a')]);}else if(_0x50d716[_0x1c01('0x39')]==_0x1c01('0x3b')){if(_0x50d716[_0x1c01('0x32')]==_0x1c01('0x3c')){_0x50d716[_0x1c01('0x32')]=extractCalleridNumber(_0x50d716[_0x1c01('0x3d')]);_0x50d716[_0x1c01('0x3e')]=_0x50d716[_0x1c01('0x3f')];_0x50d716['destinationchannel']=[_0x50d716[_0x1c01('0x40')],_0x50d716[_0x1c01('0x40')]=_0x50d716['destinationchannel']][0x0];_0x50d716['callerid']=_0x50d716[_0x1c01('0x3d')];}else{_0x50d716[_0x1c01('0x32')]=_0x50d716[_0x1c01('0x3e')];_0x50d716[_0x1c01('0x3e')]=_0x50d716[_0x1c01('0x3f')];if(_0x50d716[_0x1c01('0x41')]==_0x1c01('0x42')){_0x50d716[_0x1c01('0x23')]=_0x50d716[_0x1c01('0x43')];}else{_0x50d716['accountcode']='';}}}}else{_0x50d716[_0x1c01('0x3a')]=util[_0x1c01('0x2b')](_0x1c01('0x44'),_0x50d716['calleridname'],_0x50d716[_0x1c01('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x50d716[_0x1c01('0x45')]]){var _0x5d1779=RpcVoiceTransferReport[_0x1c01('0x46')][_0x50d716[_0x1c01('0x45')]];_0x5d1779['transfereelinkedid']=_0x50d716[_0x1c01('0x47')];RpcVoiceTransferReport[_0x1c01('0x1e')](_0x5d1779);delete RpcVoiceTransferReport[_0x1c01('0x46')][_0x50d716['linkedid']];}RpcVoiceCallReport[_0x1c01('0x30')](_0x50d716);if(_0x50d716[_0x1c01('0x48')]){for(var _0x4585c7=0x0;_0x4585c7<_0x50d716[_0x1c01('0x49')][_0x1c01('0x28')];_0x4585c7+=0x1){_0x50d716[_0x1c01('0x4a')]=_0x50d716[_0x1c01('0x49')][_0x4585c7][_0x1c01('0x4b')];_0x50d716[_0x1c01('0x4c')]=_0x50d716[_0x1c01('0x49')][_0x4585c7]['createdAt'];if(_0x50d716[_0x1c01('0x33')]==_0x1c01('0x3c')){_0x50d716[_0x1c01('0x3e')]=_0x50d716[_0x1c01('0x43')];_0x50d716[_0x1c01('0x4d')]=_0x50d716[_0x1c01('0x4e')];_0x50d716[_0x1c01('0x43')]=_0x50d716[_0x1c01('0x23')];_0x50d716[_0x1c01('0x4e')]=_0x50d716[_0x1c01('0x4f')];_0x50d716[_0x1c01('0x33')]=_0x50d716[_0x1c01('0x3f')];}else if(_0x50d716[_0x1c01('0x33')]=='xcally-motion-dialer'){_0x50d716[_0x1c01('0x3e')]=_0x50d716[_0x1c01('0x32')];_0x50d716[_0x1c01('0x33')]=_0x50d716['originatecalleridnum'];}RpcVoiceRecording[_0x1c01('0x30')](_0x50d716);}}};Report['prototype'][_0x1c01('0x1b')]=function(_0x2e0f1d){if(_[_0x1c01('0x50')](_0x2e0f1d)){_0x2e0f1d[_0x1c01('0x51')](function(_0x57981c){RpcVoiceAgentReport['create'](_0x57981c);});}else{RpcVoiceAgentReport[_0x1c01('0x30')](_0x2e0f1d);}};Report[_0x1c01('0x12')][_0x1c01('0x1d')]=function(_0x5e047d){RpcVoiceDialReport[_0x1c01('0x30')](_0x5e047d);var _0x5e8cec;var _0x1d27df;var _0x4bb868=_0x5e047d[_0x1c01('0x40')];if(_[_0x1c01('0x52')](_0x4bb868,_0x1c01('0x53'))){_0x1d27df=_0x4bb868[_0x1c01('0x54')](_0x4bb868['indexOf']('/')+0x1,_0x4bb868['indexOf']('@'));_0x5e8cec=_[_0x1c01('0x22')](this['agents'],function(_0xe11e1f){return _0xe11e1f['mobile']==_0x1d27df||_0xe11e1f[_0x1c01('0x55')]==_0x1d27df||_0xe11e1f[_0x1c01('0x23')]==_0x1d27df;});}else{_0x1d27df=_0x4bb868['substring'](_0x4bb868['indexOf']('/')+0x1,_0x4bb868['lastIndexOf']('-'));_0x5e8cec=this[_0x1c01('0x21')](_0x1d27df);}if(_0x5e8cec){_0x5e047d[_0x1c01('0x26')]=_[_0x1c01('0x25')](_0x5e8cec[_0x1c01('0x26')])?util[_0x1c01('0x2b')](_0x1c01('0x27'),_0x5e8cec[_0x1c01('0x24')]):_0x5e8cec[_0x1c01('0x26')];_0x5e047d[_0x1c01('0x4f')]=_0x5e8cec[_0x1c01('0x24')];_0x5e047d[_0x1c01('0x23')]=_0x5e8cec[_0x1c01('0x23')];RpcMemberReport[_0x1c01('0x1d')](_0x5e047d);}};Report['prototype'][_0x1c01('0x1e')]=function(_0x5b39ca){RpcVoiceTransferReport[_0x1c01('0x46')][_0x5b39ca[_0x1c01('0x56')]]=_0x5b39ca;};Report['prototype'][_0x1c01('0x20')]=function(_0x2a4376){RpcVoiceTransferReport[_0x1c01('0x20')](_0x2a4376);};module[_0x1c01('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index cf9e40b..6f9c69f 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 _0x466d=['merge','event','actionid','debug','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','inuse','toNumber','format','toLowerCase','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','trunks','trunk:%s','startsWith','Local','indexOf','phone','accountcode','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','error','actionDeviceStateList','catch','[userReport][devicestatelist]','inspect','actionSipPeerStatus','syncRealtimeShow','isUndefined','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','[userReport][registry]','find','username'];(function(_0x1302ff,_0x4564e1){var _0x335c92=function(_0x36079e){while(--_0x36079e){_0x1302ff['push'](_0x1302ff['shift']());}};_0x335c92(++_0x4564e1);}(_0x466d,0xb7));var _0xd466=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x466d[_0x569fef];return _0x11f20b;};'use strict';var _=require(_0xd466('0x0'));var moment=require(_0xd466('0x1'));var util=require(_0xd466('0x2'));var Redis=require('ioredis');var BPromise=require(_0xd466('0x3'));var config=require(_0xd466('0x4'));var logger=require(_0xd466('0x5'))(_0xd466('0x6'));var ami=require(_0xd466('0x7'));config[_0xd466('0x8')]=_[_0xd466('0x9')](config[_0xd466('0x8')],{'host':_0xd466('0xa'),'port':0x18eb});var io=require(_0xd466('0xb'))(new Redis(config['redis']));function UserReport(_0x234872){this['trunks']=_0x234872['trunks'];this[_0xd466('0xc')]=_0x234872[_0xd466('0xc')];this['telephones']=_0x234872[_0xd466('0xd')];ami['on'](_0xd466('0xe'),this[_0xd466('0xf')]['bind'](this));ami['on'](_0xd466('0x10'),this[_0xd466('0xf')][_0xd466('0x11')](this));ami['on'](_0xd466('0x12'),this[_0xd466('0x13')][_0xd466('0x11')](this));ami['on'](_0xd466('0x14'),this[_0xd466('0x15')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xd466('0x16')]()[_0xd466('0x17')](ami[_0xd466('0x18')]())['catch'](function(_0x1c2dd1){logger[_0xd466('0x19')]('[userReport][sipshowregistry]',util['inspect'](_0x1c2dd1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd466('0x16')]()[_0xd466('0x17')](ami[_0xd466('0x1a')]())[_0xd466('0x1b')](function(_0x4421d9){logger[_0xd466('0x19')](_0xd466('0x1c'),util[_0xd466('0x1d')](_0x4421d9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd466('0x16')]()[_0xd466('0x17')](ami[_0xd466('0x1e')]())[_0xd466('0x1b')](function(_0x4387f7){logger[_0xd466('0x19')]('[userReport][sippeerstatus]',util[_0xd466('0x1d')](_0x4387f7,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xd466('0x1f')]=function(){setInterval(function(){BPromise[_0xd466('0x16')]()[_0xd466('0x17')](showSipRegistrations())[_0xd466('0x17')](listDeviceStates())[_0xd466('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x368928){return _0x368928!==null&&!_[_0xd466('0x20')](_0x368928);};UserReport[_0xd466('0x21')][_0xd466('0x22')]=function(_0x2d05cd,_0xdcd22b,_0x23051e){io['to'](_0x2d05cd)[_0xd466('0x22')](_0xdcd22b,_0x23051e);};UserReport['prototype'][_0xd466('0xf')]=function(_0x2bdf10){try{if(this[_0xd466('0x23')](_0x2bdf10)){logger[_0xd466('0x24')](_0xd466('0x25'),_0x2bdf10['username'],_0x2bdf10[_0xd466('0x26')]);logger['debug'](_0xd466('0x27'),util[_0xd466('0x1d')](_0x2bdf10,{'showHidden':![],'depth':null}));var _0x91349a=_[_0xd466('0x28')](this['trunks'],{'defaultuser':_0x2bdf10[_0xd466('0x29')]});if(_0x91349a){_0x2bdf10['stateRegistry']=_0x2bdf10[_0xd466('0x26')];_[_0xd466('0x2a')](_0x91349a,_['omit'](_0x2bdf10,[_0xd466('0x2b'),_0xd466('0x2c'),_0xd466('0x29'),_0xd466('0x26')]));logger[_0xd466('0x2d')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xd466('0x1d')](_0x91349a,{'showHidden':![],'depth':null}));this[_0xd466('0x22')](util['format']('trunk:%s',_0x91349a['name']),_0xd466('0x2e'),_0x91349a);}}}catch(_0x100556){logger[_0xd466('0x19')](_0xd466('0x27'),util[_0xd466('0x1d')](_0x100556,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x537b4){try{if(this[_0xd466('0x23')](_0x537b4)){logger['info'](_0xd466('0x2f'),_0x537b4[_0xd466('0x30')],_0x537b4[_0xd466('0x26')]);logger[_0xd466('0x2d')](_0xd466('0x31'),util[_0xd466('0x1d')](_0x537b4,{'showHidden':![],'depth':null}));if(this[_0xd466('0xc')][_0x537b4[_0xd466('0x30')]]){if(!this[_0xd466('0xc')][_0x537b4[_0xd466('0x30')]][_0xd466('0x32')]||_0x537b4[_0xd466('0x26')]['toLowerCase']()==_0xd466('0x33')){this[_0xd466('0xc')][_0x537b4[_0xd466('0x30')]][_0xd466('0x32')]=![];if(this[_0xd466('0xc')][_0x537b4[_0xd466('0x30')]][_0xd466('0x26')]!==_0x537b4['state']['toLowerCase']()){this['agents'][_0x537b4['device']]['stateTime']=_[_0xd466('0x34')](moment()[_0xd466('0x35')]('x'));}this['agents'][_0x537b4[_0xd466('0x30')]]['state']=_0x537b4[_0xd466('0x26')][_0xd466('0x36')]();this['agents'][_0x537b4['device']][_0xd466('0x37')](_0x537b4);}}else if(this['telephones'][_0x537b4['device']]){if(this[_0xd466('0xd')][_0x537b4[_0xd466('0x30')]][_0xd466('0x26')]!==_0x537b4[_0xd466('0x26')][_0xd466('0x36')]()){this[_0xd466('0xd')][_0x537b4['device']][_0xd466('0x38')]=_[_0xd466('0x34')](moment()['format']('x'));}this[_0xd466('0xd')][_0x537b4[_0xd466('0x30')]][_0xd466('0x26')]=_0x537b4[_0xd466('0x26')][_0xd466('0x36')]();logger[_0xd466('0x2d')](_0xd466('0x39'),util[_0xd466('0x1d')](this[_0xd466('0xd')][_0x537b4[_0xd466('0x30')]],{'showHidden':![],'depth':null}));this[_0xd466('0x22')](util['format']('telephone:%s',this[_0xd466('0xd')][_0x537b4['device']][_0xd466('0x3a')]),'telephone:save',this[_0xd466('0xd')][_0x537b4[_0xd466('0x30')]]);}else if(this['trunks'][_0x537b4[_0xd466('0x30')]]){if(this[_0xd466('0x3b')][_0x537b4[_0xd466('0x30')]][_0xd466('0x26')]!==_0x537b4['state'][_0xd466('0x36')]()){this[_0xd466('0x3b')][_0x537b4[_0xd466('0x30')]][_0xd466('0x38')]=_['toNumber'](moment()[_0xd466('0x35')]('x'));}this['trunks'][_0x537b4[_0xd466('0x30')]][_0xd466('0x26')]=_0x537b4[_0xd466('0x26')][_0xd466('0x36')]();logger[_0xd466('0x2d')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xd466('0x3b')][_0x537b4[_0xd466('0x30')]],{'showHidden':![],'depth':null}));this[_0xd466('0x22')](util['format'](_0xd466('0x3c'),this[_0xd466('0x3b')][_0x537b4[_0xd466('0x30')]][_0xd466('0x3a')]),_0xd466('0x2e'),this[_0xd466('0x3b')][_0x537b4[_0xd466('0x30')]]);}else if(_[_0xd466('0x3d')](_0x537b4[_0xd466('0x30')],_0xd466('0x3e'))){var _0x4da7f9=_0x537b4[_0xd466('0x30')];var _0x2948c9=_0x4da7f9['substring'](_0x4da7f9[_0xd466('0x3f')]('/')+0x1,_0x4da7f9[_0xd466('0x3f')]('@'));var _0x29b074=_['find'](this[_0xd466('0xc')],function(_0x3582c2){return _0x3582c2['mobile']==_0x2948c9||_0x3582c2[_0xd466('0x40')]==_0x2948c9||_0x3582c2[_0xd466('0x41')]==_0x2948c9;});if(_0x29b074){if(_0x29b074[_0xd466('0x26')]!==_0x537b4[_0xd466('0x26')][_0xd466('0x36')]()){_0x29b074['stateTime']=_['toNumber'](moment()[_0xd466('0x35')]('x'));}_0x29b074[_0xd466('0x26')]=_0x537b4[_0xd466('0x26')][_0xd466('0x36')]();_0x29b074[_0xd466('0x32')]=!![];_0x29b074[_0xd466('0x37')](_0x537b4);}}}}catch(_0x1365ad){logger['error'](_0xd466('0x31'),util[_0xd466('0x1d')](_0x1365ad,{'showHidden':![],'depth':null}));}};UserReport[_0xd466('0x21')]['syncPeerStatus']=function(_0x583296){try{if(this['isNotNull'](_0x583296)&&this[_0xd466('0x23')](_0x583296['peerstatus'])){logger[_0xd466('0x24')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x583296['peer'],_0x583296[_0xd466('0x42')],_0x583296['peerstatus']);logger[_0xd466('0x2d')](_0xd466('0x43'),util['inspect'](_0x583296,{'showHidden':![],'depth':null}));if(this[_0xd466('0xc')][_0x583296[_0xd466('0x44')]]){if(!this[_0xd466('0xc')][_0x583296[_0xd466('0x44')]]['local']||_0x583296[_0xd466('0x14')]['toLowerCase']()==_0xd466('0x45')){this[_0xd466('0xc')][_0x583296[_0xd466('0x44')]][_0xd466('0x32')]=![];this[_0xd466('0xc')][_0x583296['peer']][_0xd466('0x46')]=_0x583296[_0xd466('0x14')]['toLowerCase']();this['agents'][_0x583296['peer']]['address']=_0x583296[_0xd466('0x42')];this['agents'][_0x583296['peer']][_0xd466('0x37')](_0x583296);}}else if(this[_0xd466('0xd')][_0x583296[_0xd466('0x44')]]){this[_0xd466('0xd')][_0x583296['peer']][_0xd466('0x46')]=_0x583296['peerstatus'][_0xd466('0x36')]();this[_0xd466('0xd')][_0x583296[_0xd466('0x44')]]['address']=_0x583296[_0xd466('0x42')];logger[_0xd466('0x2d')](_0xd466('0x47'),util['inspect'](this[_0xd466('0xd')][_0x583296[_0xd466('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd466('0x35')]('telephone:%s',this[_0xd466('0xd')][_0x583296['peer']]['name']),_0xd466('0x48'),this[_0xd466('0xd')][_0x583296[_0xd466('0x44')]]);}else if(this['trunks'][_0x583296[_0xd466('0x44')]]){this['trunks'][_0x583296['peer']][_0xd466('0x46')]=_0x583296[_0xd466('0x14')][_0xd466('0x36')]();this[_0xd466('0x3b')][_0x583296[_0xd466('0x44')]]['address']=_0x583296['address'];logger['debug'](_0xd466('0x49'),util[_0xd466('0x1d')](this[_0xd466('0x3b')][_0x583296[_0xd466('0x44')]],{'showHidden':![],'depth':null}));this[_0xd466('0x22')](util[_0xd466('0x35')](_0xd466('0x3c'),this[_0xd466('0x3b')][_0x583296[_0xd466('0x44')]][_0xd466('0x3a')]),_0xd466('0x2e'),this[_0xd466('0x3b')][_0x583296[_0xd466('0x44')]]);}}}catch(_0x1fbbff){logger['error'](_0xd466('0x43'),util[_0xd466('0x1d')](_0x1fbbff,{'showHidden':![],'depth':null}));}};module[_0xd466('0x4a')]=UserReport; \ No newline at end of file +var _0xf1f0=['toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','startsWith','substring','indexOf','mobile','phone','accountcode','local','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','[userReport][devicestatelist]','actionSipPeerStatus','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','omit','event','format','trunk:%s','trunk:save','[userReport][registry]','syncDeviceState','device','[userReport][devicestatechange]','toLowerCase','inuse','stateTime'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf1f0,0xe0));var _0x0f1f=function(_0x3dfdc2,_0x5e346a){_0x3dfdc2=_0x3dfdc2-0x0;var _0x36a670=_0xf1f0[_0x3dfdc2];return _0x36a670;};'use strict';var _=require(_0x0f1f('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x0f1f('0x1'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0x0f1f('0x2'))('ami');var ami=require(_0x0f1f('0x3'));config[_0x0f1f('0x4')]=_[_0x0f1f('0x5')](config[_0x0f1f('0x4')],{'host':_0x0f1f('0x6'),'port':0x18eb});var io=require(_0x0f1f('0x7'))(new Redis(config['redis']));function UserReport(_0x500fc2){this[_0x0f1f('0x8')]=_0x500fc2[_0x0f1f('0x8')];this[_0x0f1f('0x9')]=_0x500fc2[_0x0f1f('0x9')];this[_0x0f1f('0xa')]=_0x500fc2['telephones'];ami['on']('registryentry',this[_0x0f1f('0xb')]['bind'](this));ami['on']('registry',this[_0x0f1f('0xb')][_0x0f1f('0xc')](this));ami['on'](_0x0f1f('0xd'),this['syncDeviceState'][_0x0f1f('0xc')](this));ami['on'](_0x0f1f('0xe'),this[_0x0f1f('0xf')][_0x0f1f('0xc')](this));return this[_0x0f1f('0x10')]();}function showSipRegistrations(){Promise['resolve']()[_0x0f1f('0x11')](ami[_0x0f1f('0x12')]())[_0x0f1f('0x13')](function(_0x4689e0){logger[_0x0f1f('0x14')](_0x0f1f('0x15'),util[_0x0f1f('0x16')](_0x4689e0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x0f1f('0x17')]()[_0x0f1f('0x11')](ami['actionDeviceStateList']())['catch'](function(_0x178d3f){logger['error'](_0x0f1f('0x18'),util['inspect'](_0x178d3f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x0f1f('0x17')]()['then'](ami[_0x0f1f('0x19')]())['catch'](function(_0xa03259){logger[_0x0f1f('0x14')]('[userReport][sippeerstatus]',util[_0x0f1f('0x16')](_0xa03259,{'showHidden':![],'depth':null}));});}UserReport[_0x0f1f('0x1a')][_0x0f1f('0x10')]=function(){setInterval(function(){BPromise[_0x0f1f('0x17')]()[_0x0f1f('0x11')](showSipRegistrations())[_0x0f1f('0x11')](listDeviceStates())[_0x0f1f('0x11')](showPeersStatus());},0x32c8);};UserReport[_0x0f1f('0x1a')]['isNotNull']=function(_0x3f1151){return _0x3f1151!==null&&!_['isUndefined'](_0x3f1151);};UserReport[_0x0f1f('0x1a')][_0x0f1f('0x1b')]=function(_0x49a410,_0xa1731e,_0x4f0a12){io['to'](_0x49a410)['emit'](_0xa1731e,_0x4f0a12);};UserReport[_0x0f1f('0x1a')]['syncRegistry']=function(_0x8f3f23){try{if(this[_0x0f1f('0x1c')](_0x8f3f23)){logger[_0x0f1f('0x1d')](_0x0f1f('0x1e'),_0x8f3f23[_0x0f1f('0x1f')],_0x8f3f23[_0x0f1f('0x20')]);logger[_0x0f1f('0x21')]('[userReport][registry]',util[_0x0f1f('0x16')](_0x8f3f23,{'showHidden':![],'depth':null}));var _0x96b4ba=_[_0x0f1f('0x22')](this['trunks'],{'defaultuser':_0x8f3f23[_0x0f1f('0x1f')]});if(_0x96b4ba){_0x8f3f23[_0x0f1f('0x23')]=_0x8f3f23[_0x0f1f('0x20')];_['merge'](_0x96b4ba,_[_0x0f1f('0x24')](_0x8f3f23,[_0x0f1f('0x25'),'actionid',_0x0f1f('0x1f'),_0x0f1f('0x20')]));logger[_0x0f1f('0x21')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x0f1f('0x16')](_0x96b4ba,{'showHidden':![],'depth':null}));this[_0x0f1f('0x1b')](util[_0x0f1f('0x26')](_0x0f1f('0x27'),_0x96b4ba['name']),_0x0f1f('0x28'),_0x96b4ba);}}}catch(_0x5542b5){logger[_0x0f1f('0x14')](_0x0f1f('0x29'),util[_0x0f1f('0x16')](_0x5542b5,{'showHidden':![],'depth':null}));}};UserReport[_0x0f1f('0x1a')][_0x0f1f('0x2a')]=function(_0x217d59){try{if(this[_0x0f1f('0x1c')](_0x217d59)){logger[_0x0f1f('0x1d')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x217d59[_0x0f1f('0x2b')],_0x217d59['state']);logger[_0x0f1f('0x21')](_0x0f1f('0x2c'),util[_0x0f1f('0x16')](_0x217d59,{'showHidden':![],'depth':null}));if(this[_0x0f1f('0x9')][_0x217d59[_0x0f1f('0x2b')]]){if(!this[_0x0f1f('0x9')][_0x217d59['device']]['local']||_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]()==_0x0f1f('0x2e')){this[_0x0f1f('0x9')][_0x217d59[_0x0f1f('0x2b')]]['local']=![];if(this[_0x0f1f('0x9')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x20')]!==_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]()){this[_0x0f1f('0x9')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x2f')]=_[_0x0f1f('0x30')](moment()['format']('x'));}this[_0x0f1f('0x9')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x20')]=_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]();this[_0x0f1f('0x9')][_0x217d59['device']]['updateStatusRealtime'](_0x217d59);}}else if(this['telephones'][_0x217d59[_0x0f1f('0x2b')]]){if(this[_0x0f1f('0xa')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x20')]!==_0x217d59[_0x0f1f('0x20')]['toLowerCase']()){this[_0x0f1f('0xa')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x2f')]=_[_0x0f1f('0x30')](moment()['format']('x'));}this[_0x0f1f('0xa')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x20')]=_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x0f1f('0xa')][_0x217d59['device']],{'showHidden':![],'depth':null}));this[_0x0f1f('0x1b')](util[_0x0f1f('0x26')](_0x0f1f('0x31'),this['telephones'][_0x217d59[_0x0f1f('0x2b')]]['name']),_0x0f1f('0x32'),this[_0x0f1f('0xa')][_0x217d59[_0x0f1f('0x2b')]]);}else if(this[_0x0f1f('0x8')][_0x217d59[_0x0f1f('0x2b')]]){if(this[_0x0f1f('0x8')][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x20')]!==_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]()){this['trunks'][_0x217d59['device']][_0x0f1f('0x2f')]=_[_0x0f1f('0x30')](moment()[_0x0f1f('0x26')]('x'));}this[_0x0f1f('0x8')][_0x217d59['device']][_0x0f1f('0x20')]=_0x217d59[_0x0f1f('0x20')]['toLowerCase']();logger[_0x0f1f('0x21')](_0x0f1f('0x33'),util[_0x0f1f('0x16')](this['trunks'][_0x217d59[_0x0f1f('0x2b')]],{'showHidden':![],'depth':null}));this[_0x0f1f('0x1b')](util[_0x0f1f('0x26')](_0x0f1f('0x27'),this['trunks'][_0x217d59[_0x0f1f('0x2b')]][_0x0f1f('0x34')]),'trunk:save',this[_0x0f1f('0x8')][_0x217d59['device']]);}else if(_[_0x0f1f('0x35')](_0x217d59['device'],'Local')){var _0x49281d=_0x217d59[_0x0f1f('0x2b')];var _0x78e8e5=_0x49281d[_0x0f1f('0x36')](_0x49281d['indexOf']('/')+0x1,_0x49281d[_0x0f1f('0x37')]('@'));var _0xf6ff62=_[_0x0f1f('0x22')](this[_0x0f1f('0x9')],function(_0x4efab4){return _0x4efab4[_0x0f1f('0x38')]==_0x78e8e5||_0x4efab4[_0x0f1f('0x39')]==_0x78e8e5||_0x4efab4[_0x0f1f('0x3a')]==_0x78e8e5;});if(_0xf6ff62){if(_0xf6ff62[_0x0f1f('0x20')]!==_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]()){_0xf6ff62['stateTime']=_[_0x0f1f('0x30')](moment()[_0x0f1f('0x26')]('x'));}_0xf6ff62[_0x0f1f('0x20')]=_0x217d59[_0x0f1f('0x20')][_0x0f1f('0x2d')]();_0xf6ff62[_0x0f1f('0x3b')]=!![];_0xf6ff62[_0x0f1f('0x3c')](_0x217d59);}}}}catch(_0x472c71){logger['error'](_0x0f1f('0x2c'),util[_0x0f1f('0x16')](_0x472c71,{'showHidden':![],'depth':null}));}};UserReport[_0x0f1f('0x1a')][_0x0f1f('0xf')]=function(_0x32489b){try{if(this[_0x0f1f('0x1c')](_0x32489b)&&this[_0x0f1f('0x1c')](_0x32489b['peerstatus'])){logger['info'](_0x0f1f('0x3d'),_0x32489b[_0x0f1f('0x3e')],_0x32489b[_0x0f1f('0x3f')],_0x32489b[_0x0f1f('0xe')]);logger[_0x0f1f('0x21')]('[userReport][peerstatus]',util[_0x0f1f('0x16')](_0x32489b,{'showHidden':![],'depth':null}));if(this['agents'][_0x32489b[_0x0f1f('0x3e')]]){if(!this[_0x0f1f('0x9')][_0x32489b[_0x0f1f('0x3e')]]['local']||_0x32489b['peerstatus']['toLowerCase']()==_0x0f1f('0x40')){this[_0x0f1f('0x9')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x3b')]=![];this['agents'][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x41')]=_0x32489b['peerstatus'][_0x0f1f('0x2d')]();this[_0x0f1f('0x9')][_0x32489b['peer']][_0x0f1f('0x3f')]=_0x32489b['address'];this['agents'][_0x32489b['peer']][_0x0f1f('0x3c')](_0x32489b);}}else if(this[_0x0f1f('0xa')][_0x32489b['peer']]){this[_0x0f1f('0xa')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x41')]=_0x32489b[_0x0f1f('0xe')][_0x0f1f('0x2d')]();this[_0x0f1f('0xa')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x3f')]=_0x32489b[_0x0f1f('0x3f')];logger[_0x0f1f('0x21')](_0x0f1f('0x42'),util[_0x0f1f('0x16')](this[_0x0f1f('0xa')][_0x32489b[_0x0f1f('0x3e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0f1f('0x26')]('telephone:%s',this['telephones'][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x34')]),'telephone:save',this[_0x0f1f('0xa')][_0x32489b[_0x0f1f('0x3e')]]);}else if(this[_0x0f1f('0x8')][_0x32489b['peer']]){this[_0x0f1f('0x8')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x41')]=_0x32489b['peerstatus']['toLowerCase']();this[_0x0f1f('0x8')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x3f')]=_0x32489b[_0x0f1f('0x3f')];logger[_0x0f1f('0x21')](_0x0f1f('0x43'),util[_0x0f1f('0x16')](this[_0x0f1f('0x8')][_0x32489b[_0x0f1f('0x3e')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x0f1f('0x27'),this[_0x0f1f('0x8')][_0x32489b[_0x0f1f('0x3e')]][_0x0f1f('0x34')]),_0x0f1f('0x28'),this[_0x0f1f('0x8')][_0x32489b[_0x0f1f('0x3e')]]);}}}catch(_0x420b00){logger[_0x0f1f('0x14')]('[userReport][peerstatus]',util['inspect'](_0x420b00,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index be95ccd..d45e2c0 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=['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','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][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','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','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:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x194e17,_0x547543){var _0x2874f2=function(_0x491e43){while(--_0x491e43){_0x194e17['push'](_0x194e17['shift']());}};_0x2874f2(++_0x547543);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['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','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][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','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','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:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x117ce3,_0x1faa06){var _0x58c06b=function(_0x5283e8){while(--_0x5283e8){_0x117ce3['push'](_0x117ce3['shift']());}};_0x58c06b(++_0x1faa06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2e593f4..731b91c 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 _0x6348=['routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','isNil','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','type','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','extension','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','queue','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','channels','agents','coreshowchannel','bind','newexten','newchannel','newstate','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','linkedid','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','destconnectedlinenum','format','user:%s','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','set','startsWith','cdr(','match','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','diff','destinationchannel','UserId','membername','context'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x6348,0x1f3));var _0x8634=function(_0x46b579,_0x566d72){_0x46b579=_0x46b579-0x0;var _0x373a12=_0x6348[_0x46b579];return _0x373a12;};'use strict';var _=require('lodash');var moment=require(_0x8634('0x0'));var util=require(_0x8634('0x1'));var path=require(_0x8634('0x2'));var Redis=require('ioredis');var config=require(_0x8634('0x3'));var logger=require('../../../config/logger')(_0x8634('0x4'));var ami=require(_0x8634('0x5'));var Channel=require(_0x8634('0x6'));var RpcSetting=require(_0x8634('0x7'));var applications=['set',_0x8634('0x8'),'agi',_0x8634('0x9'),_0x8634('0xa'),'voicemail'];var dispositions=[_0x8634('0xb'),_0x8634('0xc'),_0x8634('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0x8634('0xb'),_0x8634('0xd'),'BUSY',_0x8634('0xc'),_0x8634('0xc'),_0x8634('0xc')];config['redis']=_[_0x8634('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8634('0xf')]));function VoiceCallReport(_0x3885d1){this[_0x8634('0x10')]=_0x3885d1[_0x8634('0x10')];this['agents']=_0x3885d1[_0x8634('0x11')];this['blindTransfers']={};ami['on'](_0x8634('0x12'),this['syncNewExten'][_0x8634('0x13')](this));ami['on'](_0x8634('0x14'),this['syncNewExten'][_0x8634('0x13')](this));ami['on'](_0x8634('0x15'),this['syncNewChannel'][_0x8634('0x13')](this));ami['on'](_0x8634('0x16'),this['syncNewState'][_0x8634('0x13')](this));ami['on'](_0x8634('0x17'),this[_0x8634('0x18')][_0x8634('0x13')](this));ami['on'](_0x8634('0x19'),this['syncHangup'][_0x8634('0x13')](this));ami['on'](_0x8634('0x1a'),this[_0x8634('0x1b')][_0x8634('0x13')](this));ami['on'](_0x8634('0x1c'),this[_0x8634('0x1d')][_0x8634('0x13')](this));ami['on']('blindtransfer',this[_0x8634('0x1e')]['bind'](this));ami['on'](_0x8634('0x1f'),this[_0x8634('0x20')][_0x8634('0x13')](this));ami['on']('musiconholdstop',this[_0x8634('0x21')][_0x8634('0x13')](this));try{logger[_0x8634('0x22')](_0x8634('0x23'));ami[_0x8634('0x24')]();}catch(_0xaf49c1){logger['error'](_0x8634('0x25'),util[_0x8634('0x26')](_0xaf49c1,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x8634('0x27')][_0x8634('0x28')]=function(_0x1b3597){return _0x1b3597!==null&&!_[_0x8634('0x29')](_0x1b3597);};VoiceCallReport['prototype']['emit']=function(_0x285f99,_0x4e501d,_0xac41a4){io['to'](_0x285f99)[_0x8634('0x2a')](_0x4e501d,_0xac41a4);};VoiceCallReport[_0x8634('0x27')][_0x8634('0x1b')]=function(_0x53ee67){try{if(this[_0x8634('0x28')](_0x53ee67)){logger[_0x8634('0x22')](_0x8634('0x2b'),_0x53ee67[_0x8634('0x2c')],_0x53ee67[_0x8634('0x2d')],_0x53ee67['calleridnum']);logger[_0x8634('0x2e')](_0x8634('0x2f'),_0x53ee67[_0x8634('0x2c')],util[_0x8634('0x26')](_0x53ee67,{'showHidden':![],'depth':null}));if(_0x53ee67[_0x8634('0x2c')]===_0x53ee67['linkedid']){if(!_[_0x8634('0x29')](this[_0x8634('0x10')][_0x53ee67['uniqueid']])){_[_0x8634('0x30')](this['channels'][_0x53ee67[_0x8634('0x2c')]],_[_0x8634('0x31')](_0x53ee67,_[_0x8634('0x32')](this[_0x8634('0x10')][_0x53ee67[_0x8634('0x2c')]])));}}if(_0x53ee67['context']===_0x8634('0x33')){if(this['agents'][_0x53ee67[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]){if(_0x53ee67[_0x8634('0x36')]==_0x8634('0x37')){this[_0x8634('0x11')][_0x53ee67['channel'][_0x8634('0x35')]('-')[0x0]]['destconnectedlinenum']=_0x53ee67[_0x8634('0x38')];this[_0x8634('0x2a')](util['format']('user:%s',this[_0x8634('0x11')][_0x53ee67[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]][_0x8634('0x39')]),_0x8634('0x3a'),{'destaccountcode':this[_0x8634('0x11')][_0x53ee67['channel']['split']('-')[0x0]][_0x8634('0x3b')],'destconnectedlinenum':_0x53ee67[_0x8634('0x38')]});}}}}}catch(_0x11f80d){logger[_0x8634('0x3c')](_0x8634('0x3d'),_0x53ee67[_0x8634('0x2c')],util[_0x8634('0x26')](_0x11f80d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8634('0x27')][_0x8634('0x3e')]=function(_0x9dbbe8){try{if(this[_0x8634('0x28')](_0x9dbbe8)){logger[_0x8634('0x2e')](_0x8634('0x3f'),_0x9dbbe8[_0x8634('0x2c')],util[_0x8634('0x26')](_0x9dbbe8,{'showHidden':![],'depth':null}));if(_0x9dbbe8['uniqueid']===_0x9dbbe8[_0x8634('0x40')]&&_0x9dbbe8[_0x8634('0x34')]!=_0x8634('0x41')){if(_[_0x8634('0x29')](this[_0x8634('0x10')][_0x9dbbe8[_0x8634('0x2c')]])){logger[_0x8634('0x22')](_0x8634('0x42'),_0x9dbbe8[_0x8634('0x2c')],_0x9dbbe8['context'],_0x9dbbe8[_0x8634('0x36')]);this[_0x8634('0x10')][_0x9dbbe8[_0x8634('0x2c')]]=new Channel();this['channels'][_0x9dbbe8['uniqueid']][_0x8634('0x43')]=moment()['format'](_0x8634('0x44'));this[_0x8634('0x10')][_0x9dbbe8[_0x8634('0x2c')]][_0x8634('0x45')]=dispositions[_[_0x8634('0x46')](_0x9dbbe8[_0x8634('0x47')])];_[_0x8634('0x30')](this[_0x8634('0x10')][_0x9dbbe8[_0x8634('0x2c')]],_[_0x8634('0x31')](_0x9dbbe8,_[_0x8634('0x32')](this['channels'][_0x9dbbe8[_0x8634('0x2c')]])));if(_0x9dbbe8['context']==='from-sip'){if(this['agents'][_0x9dbbe8[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]){if(_['isUndefined'](this[_0x8634('0x11')][_0x9dbbe8[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]][_0x8634('0x48')])){this[_0x8634('0x11')][_0x9dbbe8[_0x8634('0x34')]['split']('-')[0x0]][_0x8634('0x48')]=_0x9dbbe8[_0x8634('0x36')];logger[_0x8634('0x2e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x9dbbe8[_0x8634('0x2c')],util[_0x8634('0x26')]({'id':this['agents'][_0x9dbbe8['channel'][_0x8634('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x9dbbe8['channel'][_0x8634('0x35')]('-')[0x0]][_0x8634('0x3b')],'destconnectedlinenum':_0x9dbbe8['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x8634('0x49')](_0x8634('0x4a'),this[_0x8634('0x11')][_0x9dbbe8[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]['name']),'user:agentconnect',{'id':this[_0x8634('0x11')][_0x9dbbe8[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x8634('0x11')][_0x9dbbe8['channel'][_0x8634('0x35')]('-')[0x0]][_0x8634('0x3b')],'destconnectedlinenum':_0x9dbbe8['exten']});}}}}}}}catch(_0x90a098){logger[_0x8634('0x3c')](_0x8634('0x4b'),_0x9dbbe8['uniqueid'],util[_0x8634('0x26')](_0x90a098,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8634('0x27')]['syncNewExten']=function(_0x342bcc){try{if(this['isNotNull'](_0x342bcc)){logger[_0x8634('0x2e')]('[%s][voiceCallReport][newexten]\x20event:',_0x342bcc[_0x8634('0x2c')],util[_0x8634('0x26')](_0x342bcc,{'showHidden':![],'depth':null}));if(_0x342bcc[_0x8634('0x2c')]===_0x342bcc[_0x8634('0x40')]&&_0x342bcc['exten']!='h'&&_0x342bcc[_0x8634('0x34')]!=_0x8634('0x41')){_0x342bcc[_0x8634('0x4c')]=_0x342bcc[_0x8634('0x4c')][_0x8634('0x4d')]();_0x342bcc[_0x8634('0x4e')]=_0x342bcc['appdata']&&_0x342bcc[_0x8634('0x4f')]['startsWith'](_0x8634('0x50'))?_0x342bcc[_0x8634('0x4f')]:(_0x342bcc[_0x8634('0x4f')]||_0x342bcc[_0x8634('0x4e')])[_0x8634('0x4d')]();logger['info'](_0x8634('0x51'),_0x342bcc['uniqueid'],_0x342bcc[_0x8634('0x4c')],_0x342bcc['applicationdata']);if(_['isUndefined'](this['channels'][_0x342bcc[_0x8634('0x2c')]])){this[_0x8634('0x10')][_0x342bcc['uniqueid']]=new Channel();this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]]['starttime']=_0x342bcc[_0x8634('0x52')]?moment()[_0x8634('0x53')](moment[_0x8634('0x52')](_0x342bcc[_0x8634('0x52')])['seconds'](),_0x8634('0x54'))[_0x8634('0x49')](_0x8634('0x44')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]][_0x8634('0x45')]=_0x8634('0xb');}_[_0x8634('0x30')](this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]],_[_0x8634('0x31')](_0x342bcc,_['keys'](this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]])));if(_[_0x8634('0x55')](applications,_0x342bcc[_0x8634('0x4c')])){this[_0x8634('0x10')][_0x342bcc['uniqueid']][_0x8634('0x56')]=_0x342bcc['application'];this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]]['lastdata']=_0x342bcc[_0x8634('0x4e')];if(_0x342bcc['application']===_0x8634('0x57')&&_[_0x8634('0x58')](_0x342bcc[_0x8634('0x4e')][_0x8634('0x4d')](),_0x8634('0x59'))){var _0x46010c=_0x342bcc[_0x8634('0x4e')]['split']('=');var _0x3afb01=_0x46010c[0x0][_0x8634('0x4d')]()[_0x8634('0x5a')](/cdr\((.*)\)/);if(_0x3afb01){this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]][_0x3afb01[0x1]]=_0x46010c[0x1];}}else if(_0x342bcc['application']===_0x8634('0x8')){this[_0x8634('0x10')][_0x342bcc[_0x8634('0x2c')]][_0x8634('0x8')]=_0x342bcc[_0x8634('0x4e')][_0x8634('0x35')](',')[0x0];}}}}}catch(_0x1fe6de){logger[_0x8634('0x3c')]('[%s][voiceCallReport][newexten]',_0x342bcc['uniqueid'],util['inspect'](_0x1fe6de,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8634('0x5b')]=function(_0x5ed871){try{if(this[_0x8634('0x28')](_0x5ed871)){logger[_0x8634('0x22')](_0x8634('0x5c'),_0x5ed871['uniqueid'],_0x5ed871[_0x8634('0x40')],_0x5ed871[_0x8634('0x2d')],_0x5ed871[_0x8634('0x5d')]);logger[_0x8634('0x2e')](_0x8634('0x5e'),_0x5ed871[_0x8634('0x2c')],util[_0x8634('0x26')](_0x5ed871,{'showHidden':![],'depth':null}));if(_0x5ed871[_0x8634('0x2c')]!==_0x5ed871[_0x8634('0x40')]){if(this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]]){if(_0x5ed871[_0x8634('0x47')]==='6'){if(!this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x5f')]){var _0x1ca4f8=moment();this['channels'][_0x5ed871['linkedid']]['answered']=!![];this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]]['answertime']=_0x1ca4f8[_0x8634('0x49')](_0x8634('0x44'));if(this['channels'][_0x5ed871[_0x8634('0x40')]][_0x8634('0x43')]){this['channels'][_0x5ed871[_0x8634('0x40')]]['holdtime']=_0x1ca4f8[_0x8634('0x60')](this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x43')],'seconds');}}this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x40')]=_0x5ed871[_0x8634('0x2c')];if(_0x5ed871[_0x8634('0x5d')]!==_0x8634('0x37')){this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x38')]=_0x5ed871['calleridnum'];}this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]]['connectedlinename']=_0x5ed871[_0x8634('0x2d')];this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x61')]=_0x5ed871[_0x8634('0x34')];this['channels'][_0x5ed871[_0x8634('0x40')]][_0x8634('0x45')]=dispositions[_['toNumber'](_0x5ed871[_0x8634('0x47')])];if(this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')]['split']('-')[0x0]]){this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x62')]=this[_0x8634('0x11')][_0x5ed871['channel']['split']('-')[0x0]]['id'];this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x63')]=this['agents'][_0x5ed871[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]][_0x8634('0x39')];}}}}else{if(this[_0x8634('0x10')][_0x5ed871[_0x8634('0x2c')]]){if(_0x5ed871[_0x8634('0x47')]==='6'){if(this['agents'][_0x5ed871['channel'][_0x8634('0x35')]('-')[0x0]]){this[_0x8634('0x10')][_0x5ed871['uniqueid']][_0x8634('0x62')]=this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]['id'];this['channels'][_0x5ed871[_0x8634('0x2c')]]['membername']=this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')]['split']('-')[0x0]][_0x8634('0x39')];}}}}if(_0x5ed871[_0x8634('0x47')]==='6'&&_0x5ed871[_0x8634('0x64')]==='from-sip'){if(this[_0x8634('0x11')][_0x5ed871['channel'][_0x8634('0x35')]('-')[0x0]]){this['agents'][_0x5ed871['channel'][_0x8634('0x35')]('-')[0x0]][_0x8634('0x48')]=_0x5ed871[_0x8634('0x36')];var _0x4ced68,_0x32d2f3;if(this[_0x8634('0x10')][_0x5ed871['uniqueid']]){_0x4ced68=this[_0x8634('0x10')][_0x5ed871[_0x8634('0x2c')]][_0x8634('0x65')];_0x32d2f3=this[_0x8634('0x10')][_0x5ed871[_0x8634('0x2c')]][_0x8634('0x8')];}else if(this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]]){_0x4ced68=this[_0x8634('0x10')][_0x5ed871[_0x8634('0x40')]][_0x8634('0x65')];_0x32d2f3=this[_0x8634('0x10')][_0x5ed871['linkedid']][_0x8634('0x8')];}logger[_0x8634('0x2e')](_0x8634('0x66'),_0x5ed871[_0x8634('0x2c')],util[_0x8634('0x26')]({'id':this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5ed871[_0x8634('0x36')],'routealias':_0x4ced68,'queue':_0x32d2f3||undefined},{'showHidden':![],'depth':null}));this[_0x8634('0x2a')](util[_0x8634('0x49')]('user:%s',this[_0x8634('0x11')][_0x5ed871['channel'][_0x8634('0x35')]('-')[0x0]][_0x8634('0x39')]),_0x8634('0x3a'),{'id':this[_0x8634('0x11')][_0x5ed871[_0x8634('0x34')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x5ed871[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]][_0x8634('0x3b')],'destconnectedlinenum':_0x5ed871[_0x8634('0x36')],'routealias':_0x4ced68,'queue':_0x32d2f3||undefined});}}}}catch(_0x493577){logger['error'](_0x8634('0x67'),_0x5ed871[_0x8634('0x2c')],util[_0x8634('0x26')](_0x493577,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8634('0x68')]=function(_0x1b5656,_0x1af39d){try{if(this[_0x8634('0x10')][_0x1b5656]){logger[_0x8634('0x22')](_0x8634('0x69'),_0x1b5656,_0x1af39d);this[_0x8634('0x10')][_0x1b5656][_0x8634('0x6a')]=!![];if(_[_0x8634('0x6b')](_0x1af39d,'.wav49')){_0x1af39d=_0x1af39d[_0x8634('0x6c')](_0x8634('0x6d'),_0x8634('0x6e'));}this[_0x8634('0x10')][_0x1b5656][_0x8634('0x6f')]=_0x1af39d;var _0x2b2357=_[_0x8634('0x70')](this[_0x8634('0x10')][_0x1b5656]['monitors'],{'filename':_0x1af39d});if(_[_0x8634('0x71')](_0x2b2357)){this[_0x8634('0x10')][_0x1b5656][_0x8634('0x72')][_0x8634('0x73')]({'filename':_0x1af39d,'createdAt':moment()[_0x8634('0x49')](_0x8634('0x44')),'mixmonitorid':'','status':_0x8634('0x74')});}}}catch(_0xe89862){logger[_0x8634('0x3c')](_0x8634('0x75'),_0x1b5656,util['inspect'](_0xe89862,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8634('0x18')]=function(_0x3ba647){try{if(this[_0x8634('0x28')](_0x3ba647)){logger[_0x8634('0x2e')](_0x8634('0x76'),_0x3ba647['uniqueid'],util['inspect'](_0x3ba647,{'showHidden':![],'depth':null}));if(this[_0x8634('0x10')][_0x3ba647[_0x8634('0x2c')]]&&_0x3ba647['channel']!=_0x8634('0x41')){if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')])){if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')][_0x8634('0x78')])){logger[_0x8634('0x22')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3ba647[_0x8634('0x2c')],_0x3ba647['value']);this[_0x8634('0x68')](_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);}else if(this[_0x8634('0x28')](_0x3ba647['variable']['xmd-phone'])){logger[_0x8634('0x22')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this['channels'][_0x3ba647[_0x8634('0x2c')]][_0x8634('0x5d')]=_0x3ba647['value'];}else if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')][_0x8634('0x7a')])){logger[_0x8634('0x22')](_0x8634('0x7b'),_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this['channels'][_0x3ba647['uniqueid']][_0x8634('0x7c')]=_0x3ba647[_0x8634('0x79')];}else if(this['isNotNull'](_0x3ba647[_0x8634('0x77')][_0x8634('0x7d')])){logger['info'](_0x8634('0x7e'),_0x3ba647[_0x8634('0x2c')],_0x3ba647['value']);this[_0x8634('0x10')][_0x3ba647[_0x8634('0x2c')]]['type']=_0x3ba647[_0x8634('0x79')];}else if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')]['xmd-queue'])){logger[_0x8634('0x22')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')][_0x8634('0x35')](',')[0x0]);this[_0x8634('0x10')][_0x3ba647[_0x8634('0x2c')]][_0x8634('0x8')]=_0x3ba647[_0x8634('0x79')][_0x8634('0x35')](',')[0x0];}else if(this['isNotNull'](_0x3ba647[_0x8634('0x77')]['xmd-originatecalleridnum'])){logger[_0x8634('0x22')](_0x8634('0x7f'),_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this[_0x8634('0x10')][_0x3ba647[_0x8634('0x2c')]][_0x8634('0x80')]=_0x3ba647[_0x8634('0x79')];}else if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')][_0x8634('0x81')])){logger[_0x8634('0x22')](_0x8634('0x82'),_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this[_0x8634('0x10')][_0x3ba647['uniqueid']][_0x8634('0x83')]=_0x3ba647[_0x8634('0x79')];}else if(this['isNotNull'](_0x3ba647[_0x8634('0x77')][_0x8634('0x84')])){logger[_0x8634('0x22')](_0x8634('0x85'),_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this[_0x8634('0x10')][_0x3ba647[_0x8634('0x2c')]][_0x8634('0x86')]=_0x3ba647[_0x8634('0x79')];}else if(this['isNotNull'](_0x3ba647[_0x8634('0x77')][_0x8634('0x87')])){logger[_0x8634('0x22')](_0x8634('0x88'),_0x3ba647[_0x8634('0x2c')],_0x3ba647[_0x8634('0x79')]);this[_0x8634('0x10')][_0x3ba647['uniqueid']][_0x8634('0x8')]=_0x3ba647['value'];}else if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')][_0x8634('0x89')])){logger['info'](_0x8634('0x8a'),_0x3ba647['uniqueid'],_0x3ba647['value']);this[_0x8634('0x10')][_0x3ba647['uniqueid']]['sipcalluniqueid']=_0x3ba647[_0x8634('0x79')];}}}else if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')]['mixmonitor_filename'])){if(_0x3ba647[_0x8634('0x79')]){var _0x22d4b9=path[_0x8634('0x8b')](_0x3ba647[_0x8634('0x79')])[_0x8634('0x39')];logger[_0x8634('0x22')](_0x8634('0x8c'),_0x22d4b9,_0x3ba647[_0x8634('0x79')]);this[_0x8634('0x68')](_0x22d4b9,_0x3ba647[_0x8634('0x79')]);}}else if(this[_0x8634('0x10')][_0x3ba647[_0x8634('0x40')]]){if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')])){if(this[_0x8634('0x28')](_0x3ba647[_0x8634('0x77')][_0x8634('0x89')])){logger[_0x8634('0x22')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3ba647[_0x8634('0x40')],_0x3ba647[_0x8634('0x79')]);this['channels'][_0x3ba647[_0x8634('0x40')]]['sipcalllinkedid']=_0x3ba647[_0x8634('0x79')];}}}}}catch(_0x5c8c02){logger[_0x8634('0x3c')](_0x8634('0x8d'),_0x3ba647[_0x8634('0x2c')],util[_0x8634('0x26')](_0x5c8c02,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8634('0x8e')]=function(_0x24cf30){try{if(this[_0x8634('0x28')](_0x24cf30)){logger[_0x8634('0x2e')](_0x8634('0x8f'),_0x24cf30[_0x8634('0x2c')],util['inspect'](_0x24cf30,{'showHidden':![],'depth':null}));if(this['channels'][_0x24cf30[_0x8634('0x2c')]]){logger[_0x8634('0x22')](_0x8634('0x90'),_0x24cf30[_0x8634('0x2c')],_0x24cf30[_0x8634('0x91')]);var _0x2c22b7=moment();this['channels'][_0x24cf30['uniqueid']][_0x8634('0x92')]=_0x2c22b7[_0x8634('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8634('0x10')][_0x24cf30[_0x8634('0x2c')]]['duration']=_0x2c22b7[_0x8634('0x60')](this[_0x8634('0x10')][_0x24cf30['uniqueid']][_0x8634('0x43')],_0x8634('0x54'));if(this[_0x8634('0x10')][_0x24cf30[_0x8634('0x2c')]][_0x8634('0x5f')]){this[_0x8634('0x10')][_0x24cf30['uniqueid']][_0x8634('0x93')]=_0x2c22b7[_0x8634('0x60')](this[_0x8634('0x10')][_0x24cf30[_0x8634('0x2c')]][_0x8634('0x94')],_0x8634('0x54'));this[_0x8634('0x10')][_0x24cf30[_0x8634('0x2c')]][_0x8634('0x95')]=this[_0x8634('0x10')][_0x24cf30[_0x8634('0x2c')]]['duration']-this[_0x8634('0x10')][_0x24cf30['uniqueid']][_0x8634('0x93')];}if(_0x24cf30[_0x8634('0x64')]===_0x8634('0x33')){if(this[_0x8634('0x11')][_0x24cf30[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]){this['agents'][_0x24cf30[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]=_[_0x8634('0x96')](this['agents'][_0x24cf30['channel']['split']('-')[0x0]],[_0x8634('0x48')]);logger[_0x8634('0x2e')](_0x8634('0x97'),_0x24cf30[_0x8634('0x2c')],util['inspect']({'id':this['agents'][_0x24cf30[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x8634('0x11')][_0x24cf30[_0x8634('0x34')][_0x8634('0x35')]('-')[0x0]][_0x8634('0x3b')]},{'showHidden':![],'depth':null}));this[_0x8634('0x2a')](util[_0x8634('0x49')](_0x8634('0x4a'),this[_0x8634('0x11')][_0x24cf30[_0x8634('0x34')]['split']('-')[0x0]][_0x8634('0x39')]),_0x8634('0x98'),{'id':this['agents'][_0x24cf30['channel'][_0x8634('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x24cf30[_0x8634('0x34')]['split']('-')[0x0]][_0x8634('0x3b')]});for(var _0x18b330=0x0;_0x18b3300x0?_0x5b3ea6:0x0;this['voiceQueues'][_0x2daa77[_0x2f6a('0x69')]][_0x2f6a('0x2f')]=this['voiceQueues'][_0x2daa77[_0x2f6a('0x69')]][_0x2f6a('0x2f')]>_['toNumber'](_0x2daa77['loggedin'])?_[_0x2f6a('0x6d')](_0x2daa77[_0x2f6a('0x6e')]):this['voiceQueues'][_0x2daa77[_0x2f6a('0x69')]]['talking'];this[_0x2f6a('0x4d')](this[_0x2f6a('0x40')][_0x2daa77['queue']],'queuesummary');}logger[_0x2f6a('0x49')](_0x2f6a('0x6f'),util[_0x2f6a('0x3a')](this[_0x2f6a('0x40')][_0x2daa77[_0x2f6a('0x69')]],{'showHidden':![],'depth':null}));ami[_0x2f6a('0x44')](_0x2f6a('0x70'),this[_0x2f6a('0x40')][_0x2daa77[_0x2f6a('0x69')]]);}}}catch(_0x323f66){logger[_0x2f6a('0x3b')]('[voiceQueueReport][queuesummary]',util[_0x2f6a('0x3a')](_0x323f66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f6a('0x9')]['syncQueueSummaryComplete']=function(_0x137e95){logger[_0x2f6a('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x137e95,{'showHidden':![],'depth':null}));this[_0x2f6a('0x68')]=!![];};VoiceQueueReport[_0x2f6a('0x9')][_0x2f6a('0x18')]=function(_0x348e0d){try{if(this[_0x2f6a('0x63')](_0x348e0d)){logger[_0x2f6a('0x49')](_0x2f6a('0x71'),_0x348e0d[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x348e0d,{'showHidden':![],'depth':null}));if(_[_0x2f6a('0x64')](this[_0x2f6a('0xd')][_0x348e0d['uniqueid']]))this[_0x2f6a('0xd')][_0x348e0d[_0x2f6a('0x46')]]=[];if(_['isUndefined'](this[_0x2f6a('0xf')][_0x348e0d[_0x2f6a('0x46')]]))this[_0x2f6a('0xf')][_0x348e0d[_0x2f6a('0x46')]]={};var _0x59bc78=new QueueReport();_0x59bc78[_0x2f6a('0x47')]=_0x348e0d[_0x2f6a('0x69')];_0x59bc78[_0x2f6a('0x4e')]=this[_0x2f6a('0x40')][_0x59bc78[_0x2f6a('0x47')]]&&this['voiceQueues'][_0x59bc78[_0x2f6a('0x47')]][_0x2f6a('0x4e')]?this[_0x2f6a('0x40')][_0x59bc78['name']][_0x2f6a('0x4e')]||'inbound':_0x2f6a('0x4f');_0x59bc78[_0x2f6a('0x69')]=_0x348e0d[_0x2f6a('0x69')];_0x59bc78[_0x2f6a('0x72')]=moment()[_0x2f6a('0x4b')](_0x2f6a('0x73'));_0x59bc78[_0x2f6a('0x74')]=_0x348e0d[_0x2f6a('0x74')];_0x59bc78['count']=_0x348e0d[_0x2f6a('0x75')];_0x59bc78[_0x2f6a('0x46')]=_0x348e0d['uniqueid'];_0x59bc78['routealias']=this[_0x2f6a('0xf')][_0x348e0d[_0x2f6a('0x46')]][_0x2f6a('0x76')];logger[_0x2f6a('0x6a')](_0x2f6a('0x77'),_0x59bc78[_0x2f6a('0x47')],_0x59bc78[_0x2f6a('0x4e')]);_['merge'](_0x59bc78,_[_0x2f6a('0x78')](_0x348e0d,_[_0x2f6a('0x79')](_0x59bc78)));this['queueReports'][_0x348e0d[_0x2f6a('0x46')]][_0x2f6a('0x7a')](_0x59bc78);this['channels'][_0x348e0d[_0x2f6a('0x46')]]=_0x59bc78;this[_0x2f6a('0x45')](_0x59bc78,'queuecallerjoin');}}catch(_0x1bce14){logger['error'](_0x2f6a('0x71'),_0x348e0d[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x1bce14,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2f6a('0x19')]=function(_0x2ef4b1){try{if(this['isNotNull'](_0x2ef4b1)){logger[_0x2f6a('0x49')](_0x2f6a('0x7b'),_0x2ef4b1[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x2ef4b1,{'showHidden':![],'depth':null}));if(this[_0x2f6a('0xd')][_0x2ef4b1[_0x2f6a('0x46')]]){var _0x415e45=_[_0x2f6a('0x7c')](this[_0x2f6a('0xd')][_0x2ef4b1['uniqueid']]);_0x415e45[_0x2f6a('0x7d')]=![];_0x415e45[_0x2f6a('0x7e')]=null;_0x415e45[_0x2f6a('0x7f')]=_0x2ef4b1[_0x2f6a('0x7f')];_0x415e45['originalposition']=_0x2ef4b1[_0x2f6a('0x80')];_0x415e45[_0x2f6a('0x81')]=!![];_0x415e45['queuecallerabandonAt']=moment()[_0x2f6a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x415e45[_0x2f6a('0x82')]=_0x2f6a('0x83');_0x415e45['lastAssignedTo']=null;logger[_0x2f6a('0x6a')](_0x2f6a('0x84'),_0x415e45['name'],_0x415e45[_0x2f6a('0x4e')]);this[_0x2f6a('0xf')][_0x2ef4b1[_0x2f6a('0x46')]]=_0x415e45;this[_0x2f6a('0x42')](_0x415e45,_0x2f6a('0x81'));}}}catch(_0x38f849){logger['error'](_0x2f6a('0x7b'),_0x2ef4b1[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x38f849,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f6a('0x9')][_0x2f6a('0x1b')]=function(_0x20675b){try{if(this[_0x2f6a('0x63')](_0x20675b)){logger['debug'](_0x2f6a('0x85'),_0x20675b[_0x2f6a('0x46')],util['inspect'](_0x20675b,{'showHidden':![],'depth':null}));if(this[_0x2f6a('0xd')][_0x20675b[_0x2f6a('0x46')]]){var _0x3eef02=_[_0x2f6a('0x7c')](this[_0x2f6a('0xd')][_0x20675b[_0x2f6a('0x46')]]);_0x3eef02[_0x2f6a('0x86')]=moment()[_0x2f6a('0x4b')](_0x2f6a('0x73'));_0x3eef02[_0x2f6a('0x87')]=_0x20675b['connectedlinenum'];_0x3eef02[_0x2f6a('0x88')]=_0x20675b['connectedlinename'];logger[_0x2f6a('0x6a')](_0x2f6a('0x89'),_0x3eef02[_0x2f6a('0x47')],_0x3eef02[_0x2f6a('0x4e')],_0x20675b['connectedlinenum'],_0x20675b['connectedlinename']);this[_0x2f6a('0xf')][_0x20675b['uniqueid']]=_0x3eef02;this[_0x2f6a('0x45')](_0x3eef02,_0x2f6a('0x1a'));}}}catch(_0x337656){logger[_0x2f6a('0x3b')](_0x2f6a('0x85'),_0x20675b['uniqueid'],util[_0x2f6a('0x3a')](_0x337656,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2f6a('0x1e')]=function(_0x25d235){try{if(this[_0x2f6a('0x63')](_0x25d235)){logger[_0x2f6a('0x49')](_0x2f6a('0x8a'),_0x25d235[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x25d235,{'showHidden':![],'depth':null}));if(this[_0x2f6a('0xd')][_0x25d235[_0x2f6a('0x46')]]){var _0x40330c=_[_0x2f6a('0x7c')](this[_0x2f6a('0xd')][_0x25d235[_0x2f6a('0x46')]]);_0x40330c[_0x2f6a('0x7d')]=!![];_0x40330c['queuecallerexitreason']=_0x2f6a('0x8b');logger[_0x2f6a('0x6a')](_0x2f6a('0x8c'),_0x40330c[_0x2f6a('0x47')],_0x40330c[_0x2f6a('0x4e')]);}}}catch(_0xf3b7d7){logger['error'](_0x2f6a('0x8a'),_0x25d235[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0xf3b7d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f6a('0x9')][_0x2f6a('0x1c')]=function(_0x19adb1){try{if(this[_0x2f6a('0x63')](_0x19adb1)){logger[_0x2f6a('0x49')](_0x2f6a('0x8d'),_0x19adb1[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x19adb1,{'showHidden':![],'depth':null}));if(this[_0x2f6a('0xd')][_0x19adb1['uniqueid']]){var _0x155d0f=_['last'](this[_0x2f6a('0xd')][_0x19adb1[_0x2f6a('0x46')]]);_0x155d0f[_0x2f6a('0x81')]=![];_0x155d0f[_0x2f6a('0x8e')]=null;_0x155d0f['assigned']=!![];_0x155d0f[_0x2f6a('0x8f')]=_0x19adb1[_0x2f6a('0x90')];_0x155d0f[_0x2f6a('0x7f')]=_0x19adb1[_0x2f6a('0x7f')];_0x155d0f[_0x2f6a('0x7d')]=!![];_0x155d0f[_0x2f6a('0x91')]=![];_0x155d0f['queuecallerexitAt']=null;if(!_0x155d0f[_0x2f6a('0x92')]){if(_0x19adb1[_0x2f6a('0x93')]==_0x2f6a('0x92')){_0x155d0f[_0x2f6a('0x82')]=_0x2f6a('0x94');logger[_0x2f6a('0x6a')](_0x2f6a('0x95'),_0x155d0f['name'],_0x155d0f[_0x2f6a('0x4e')]);}else{if(_[_0x2f6a('0x96')](_0x19adb1[_0x2f6a('0x36')][_0x2f6a('0x97')](),_0x2f6a('0x98'))){if(this[_0x2f6a('0xd')][_0x19adb1['linkedid']]){var _0x55e7cf=_[_0x2f6a('0x7c')](this[_0x2f6a('0xd')][_0x19adb1['linkedid']]);_0x55e7cf['queuecallercomplete']=![];_0x55e7cf['queuecallerexit']=!![];_0x55e7cf[_0x2f6a('0x99')]=moment(_0x155d0f[_0x2f6a('0x72')])['add'](_0x19adb1['holdtime'],_0x2f6a('0x9a'))[_0x2f6a('0x4b')](_0x2f6a('0x73'));_0x55e7cf[_0x2f6a('0x82')]='FORWARDTRANSFER';_0x55e7cf['transfer']=!![];_0x55e7cf[_0x2f6a('0x9b')]=_0x2f6a('0x9c');_0x55e7cf[_0x2f6a('0x9d')]=_0x19adb1[_0x2f6a('0x9e')];_0x55e7cf['transferuniqueid']=_0x19adb1['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x55e7cf['name'],_0x55e7cf[_0x2f6a('0x4e')]);var _0x2aeff4=this[_0x2f6a('0xd')][_0x19adb1[_0x2f6a('0x9f')]];this[_0x2f6a('0xd')][_0x19adb1['linkedid']]=this[_0x2f6a('0xd')][_0x19adb1[_0x2f6a('0x46')]];this[_0x2f6a('0xd')][_0x19adb1[_0x2f6a('0x46')]]=_0x2aeff4;}}else{_0x155d0f['queuecallerexitreason']='COMPLETEDBY'+_0x19adb1['reason'][_0x2f6a('0xa0')]();logger[_0x2f6a('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x155d0f[_0x2f6a('0x47')],_0x155d0f[_0x2f6a('0x4e')],_0x155d0f['queuecallerexitreason']);}}}this[_0x2f6a('0xf')][_0x19adb1[_0x2f6a('0x46')]]=_0x155d0f;this[_0x2f6a('0x42')](_0x155d0f,'agentcomplete');}}}catch(_0x513634){logger[_0x2f6a('0x3b')](_0x2f6a('0x8d'),_0x19adb1['uniqueid'],util[_0x2f6a('0x3a')](_0x513634,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f6a('0x9')][_0x2f6a('0xa1')]=function(_0x968acc){try{if(this['isNotNull'](_0x968acc)){logger[_0x2f6a('0x49')](_0x2f6a('0xa2'),_0x968acc[_0x2f6a('0x46')],util['inspect'](_0x968acc,{'showHidden':![],'depth':null}));this[_0x2f6a('0xa3')](_0x968acc[_0x2f6a('0x46')],_[_0x2f6a('0x79')](_0x968acc[_0x2f6a('0xa4')])[0x0],_0x968acc[_0x2f6a('0xa5')]);if(this[_0x2f6a('0xd')][_0x968acc[_0x2f6a('0x46')]]){var _0x5b16ba=_[_0x2f6a('0x7c')](this[_0x2f6a('0xd')][_0x968acc[_0x2f6a('0x46')]]);if(_0x5b16ba){if(this[_0x2f6a('0x63')](_0x968acc[_0x2f6a('0xa4')])&&this['isNotNull'](_0x968acc[_0x2f6a('0xa4')][_0x2f6a('0xa6')])){switch(_0x968acc[_0x2f6a('0xa5')]){case _0x2f6a('0xa7'):_0x5b16ba[_0x2f6a('0x91')]=![];_0x5b16ba[_0x2f6a('0x99')]=null;break;case _0x2f6a('0xa8'):_0x5b16ba['lastevent']=_0x2f6a('0xa9');_0x5b16ba['queuecallerexit']=!![];_0x5b16ba[_0x2f6a('0x99')]=moment()[_0x2f6a('0x4b')](_0x2f6a('0x73'));_0x5b16ba[_0x2f6a('0x86')]=moment()['format'](_0x2f6a('0x73'));logger[_0x2f6a('0x49')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x968acc['uniqueid'],util['inspect'](_0x5b16ba,{'showHidden':![],'depth':null}));ami['emit'](_0x2f6a('0xaa'),_0x5b16ba);break;default:_0x5b16ba['queuecallerexit']=!![];_0x5b16ba[_0x2f6a('0x99')]=moment()[_0x2f6a('0x4b')](_0x2f6a('0x73'));_0x5b16ba['queuecallerleaveAt']=moment()[_0x2f6a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5b16ba[_0x2f6a('0x81')]=![];_0x5b16ba[_0x2f6a('0x8e')]=null;_0x5b16ba['queuecallerexitreason']=_0x968acc['value'];this[_0x2f6a('0xf')][_0x968acc[_0x2f6a('0x46')]]=_0x5b16ba;this[_0x2f6a('0x42')](_0x5b16ba,_0x2f6a('0x1f'));}else if(this[_0x2f6a('0x63')](_0x968acc[_0x2f6a('0xa4')])&&this[_0x2f6a('0x63')](_0x968acc[_0x2f6a('0xa4')][_0x2f6a('0xab')])){if(!_0x5b16ba[_0x2f6a('0x81')]){_0x5b16ba['queuecallerexit']=!![];_0x5b16ba['queuecallerexitAt']=moment()['format'](_0x2f6a('0x73'));_0x5b16ba['queuecallerexitreason']=_0x2f6a('0xac');_0x5b16ba['queuecallerleaveAt']=moment()[_0x2f6a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2f6a('0xf')][_0x968acc['uniqueid']]=_0x5b16ba;}}logger['info'](_0x2f6a('0xad'),_0x968acc[_0x2f6a('0x46')],_0x5b16ba[_0x2f6a('0x47')],_0x5b16ba[_0x2f6a('0x4e')],_[_0x2f6a('0x79')](_0x968acc[_0x2f6a('0xa4')])[0x0],_0x968acc['value']);_0x5b16ba['variables']=this['variables'][_0x968acc[_0x2f6a('0x46')]];}}}}catch(_0x253314){logger[_0x2f6a('0x3b')]('[%s][voiceQueueReport][varset]',_0x968acc[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x253314,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2f6a('0x9')][_0x2f6a('0xa3')]=function(_0x1bffb2,_0x3a7124,_0x5925f6){var _0x35a6d9=['rtpaudioqos',_0x2f6a('0xae'),_0x2f6a('0xaf'),'rtpaudioqosjitterbridged',_0x2f6a('0xb0'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x2f6a('0xb1'),_0x2f6a('0xb2'),_0x2f6a('0xb3'),_0x2f6a('0xb4'),_0x2f6a('0xb5'),_0x2f6a('0xb6'),_0x2f6a('0xb7'),_0x2f6a('0xb8'),'memberlastcall','membername',_0x2f6a('0xb9'),_0x2f6a('0xba')];if(!_['isNil'](_0x3a7124)&&!_[_0x2f6a('0xbb')](_0x35a6d9,_0x3a7124)){if(_[_0x2f6a('0x64')](this[_0x2f6a('0x11')][_0x1bffb2])){this['variables'][_0x1bffb2]={};}this[_0x2f6a('0x11')][_0x1bffb2][_0x3a7124]=_0x5925f6;}};VoiceQueueReport['prototype'][_0x2f6a('0x20')]=function(_0x5412c3){try{if(this['isNotNull'](_0x5412c3)){logger[_0x2f6a('0x49')](_0x2f6a('0xbc'),_0x5412c3[_0x2f6a('0x46')],util[_0x2f6a('0x3a')](_0x5412c3,{'showHidden':![],'depth':null}));if(this[_0x2f6a('0xd')][_0x5412c3[_0x2f6a('0x46')]]){for(var _0x5348b7=0x0,_0x5b0fb6={};_0x5348b70x0?_0x4a08dc:0x0;this[_0x7e72('0x11')][_0x4e2def[_0x7e72('0x69')]][_0x7e72('0x31')]=this[_0x7e72('0x11')][_0x4e2def[_0x7e72('0x69')]][_0x7e72('0x31')]>_[_0x7e72('0x6e')](_0x4e2def[_0x7e72('0x6f')])?_[_0x7e72('0x6e')](_0x4e2def['loggedin']):this[_0x7e72('0x11')][_0x4e2def[_0x7e72('0x69')]][_0x7e72('0x31')];this[_0x7e72('0x70')](this[_0x7e72('0x11')][_0x4e2def[_0x7e72('0x69')]],_0x7e72('0x15'));}logger['debug'](_0x7e72('0x71'),util[_0x7e72('0x3d')](this[_0x7e72('0x11')][_0x4e2def[_0x7e72('0x69')]],{'showHidden':![],'depth':null}));ami[_0x7e72('0x43')](_0x7e72('0x72'),this['voiceQueues'][_0x4e2def[_0x7e72('0x69')]]);}}}catch(_0x24a403){logger[_0x7e72('0x3b')]('[voiceQueueReport][queuesummary]',util[_0x7e72('0x3d')](_0x24a403,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')][_0x7e72('0x73')]=function(_0x53ee42){logger[_0x7e72('0x44')](_0x7e72('0x74'),util[_0x7e72('0x3d')](_0x53ee42,{'showHidden':![],'depth':null}));this[_0x7e72('0x12')]=!![];};VoiceQueueReport['prototype'][_0x7e72('0x19')]=function(_0x1c97ac){try{if(this['isNotNull'](_0x1c97ac)){logger[_0x7e72('0x44')](_0x7e72('0x75'),_0x1c97ac[_0x7e72('0x47')],util['inspect'](_0x1c97ac,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7e72('0xd')][_0x1c97ac[_0x7e72('0x47')]]))this[_0x7e72('0xd')][_0x1c97ac[_0x7e72('0x47')]]=[];if(_[_0x7e72('0x62')](this[_0x7e72('0xf')][_0x1c97ac['uniqueid']]))this[_0x7e72('0xf')][_0x1c97ac[_0x7e72('0x47')]]={};var _0x42fdc5=new QueueReport();_0x42fdc5[_0x7e72('0x48')]=_0x1c97ac[_0x7e72('0x69')];_0x42fdc5[_0x7e72('0x4f')]=this[_0x7e72('0x11')][_0x42fdc5[_0x7e72('0x48')]]&&this[_0x7e72('0x11')][_0x42fdc5[_0x7e72('0x48')]][_0x7e72('0x4f')]?this['voiceQueues'][_0x42fdc5[_0x7e72('0x48')]]['type']||_0x7e72('0x50'):_0x7e72('0x50');_0x42fdc5[_0x7e72('0x69')]=_0x1c97ac[_0x7e72('0x69')];_0x42fdc5[_0x7e72('0x76')]=moment()[_0x7e72('0x4b')](_0x7e72('0x77'));_0x42fdc5[_0x7e72('0x78')]=_0x1c97ac[_0x7e72('0x78')];_0x42fdc5['count']=_0x1c97ac[_0x7e72('0x79')];_0x42fdc5[_0x7e72('0x47')]=_0x1c97ac['uniqueid'];_0x42fdc5[_0x7e72('0x7a')]=this['channels'][_0x1c97ac[_0x7e72('0x47')]]['routealias'];logger['info'](_0x7e72('0x7b'),_0x42fdc5[_0x7e72('0x48')],_0x42fdc5[_0x7e72('0x4f')]);_[_0x7e72('0x7c')](_0x42fdc5,_[_0x7e72('0x7d')](_0x1c97ac,_[_0x7e72('0x7e')](_0x42fdc5)));this['queueReports'][_0x1c97ac[_0x7e72('0x47')]][_0x7e72('0x7f')](_0x42fdc5);this[_0x7e72('0xf')][_0x1c97ac[_0x7e72('0x47')]]=_0x42fdc5;this[_0x7e72('0x80')](_0x42fdc5,_0x7e72('0x18'));}}catch(_0x3bc8af){logger[_0x7e72('0x3b')](_0x7e72('0x75'),_0x1c97ac[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x3bc8af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')]['syncQueueCallerAbandon']=function(_0x55df81){try{if(this['isNotNull'](_0x55df81)){logger[_0x7e72('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x55df81[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x55df81,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x55df81[_0x7e72('0x47')]]){var _0x5a6432=_[_0x7e72('0x81')](this['queueReports'][_0x55df81[_0x7e72('0x47')]]);_0x5a6432[_0x7e72('0x82')]=![];_0x5a6432['queuecallercompleteAt']=null;_0x5a6432[_0x7e72('0x83')]=_0x55df81[_0x7e72('0x83')];_0x5a6432[_0x7e72('0x84')]=_0x55df81[_0x7e72('0x84')];_0x5a6432['queuecallerabandon']=!![];_0x5a6432['queuecallerabandonAt']=moment()[_0x7e72('0x4b')](_0x7e72('0x77'));_0x5a6432['queuecallerexitreason']=_0x7e72('0x85');_0x5a6432['lastAssignedTo']=null;logger[_0x7e72('0x6b')](_0x7e72('0x86'),_0x5a6432[_0x7e72('0x48')],_0x5a6432[_0x7e72('0x4f')]);this[_0x7e72('0xf')][_0x55df81['uniqueid']]=_0x5a6432;this[_0x7e72('0x41')](_0x5a6432,_0x7e72('0x87'));}}}catch(_0x347699){logger['error'](_0x7e72('0x88'),_0x55df81[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x347699,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')][_0x7e72('0x1b')]=function(_0x6d8ad0){try{if(this[_0x7e72('0x68')](_0x6d8ad0)){logger[_0x7e72('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x6d8ad0[_0x7e72('0x47')],util['inspect'](_0x6d8ad0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x6d8ad0[_0x7e72('0x47')]]){var _0x460aa3=_['last'](this[_0x7e72('0xd')][_0x6d8ad0[_0x7e72('0x47')]]);_0x460aa3[_0x7e72('0x89')]=moment()['format'](_0x7e72('0x77'));_0x460aa3['connectedlinenum']=_0x6d8ad0[_0x7e72('0x8a')];_0x460aa3[_0x7e72('0x8b')]=_0x6d8ad0['connectedlinename'];logger[_0x7e72('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x460aa3['name'],_0x460aa3[_0x7e72('0x4f')],_0x6d8ad0[_0x7e72('0x8a')],_0x6d8ad0[_0x7e72('0x8b')]);this[_0x7e72('0xf')][_0x6d8ad0[_0x7e72('0x47')]]=_0x460aa3;this[_0x7e72('0x80')](_0x460aa3,_0x7e72('0x8c'));}}}catch(_0x598599){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x6d8ad0[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x598599,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')][_0x7e72('0x1f')]=function(_0x47291d){try{if(this[_0x7e72('0x68')](_0x47291d)){logger[_0x7e72('0x44')](_0x7e72('0x8d'),_0x47291d[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x47291d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x47291d[_0x7e72('0x47')]]){var _0xc88823=_[_0x7e72('0x81')](this['queueReports'][_0x47291d[_0x7e72('0x47')]]);_0xc88823['queuecallercomplete']=!![];_0xc88823[_0x7e72('0x8e')]=_0x7e72('0x8f');logger[_0x7e72('0x6b')](_0x7e72('0x90'),_0xc88823[_0x7e72('0x48')],_0xc88823['type']);}}}catch(_0x2e1ac6){logger['error'](_0x7e72('0x8d'),_0x47291d[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x2e1ac6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')]['syncAgentComplete']=function(_0x33655d){try{if(this[_0x7e72('0x68')](_0x33655d)){logger[_0x7e72('0x44')](_0x7e72('0x91'),_0x33655d[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x33655d,{'showHidden':![],'depth':null}));if(this[_0x7e72('0xd')][_0x33655d[_0x7e72('0x47')]]){var _0x13e1de=_['last'](this[_0x7e72('0xd')][_0x33655d[_0x7e72('0x47')]]);_0x13e1de[_0x7e72('0x87')]=![];_0x13e1de[_0x7e72('0x92')]=null;_0x13e1de[_0x7e72('0x93')]=!![];_0x13e1de[_0x7e72('0x94')]=_0x33655d[_0x7e72('0x95')];_0x13e1de[_0x7e72('0x83')]=_0x33655d['holdtime'];_0x13e1de[_0x7e72('0x82')]=!![];_0x13e1de[_0x7e72('0x96')]=![];_0x13e1de[_0x7e72('0x97')]=null;if(!_0x13e1de[_0x7e72('0x98')]){if(_0x33655d['reason']==_0x7e72('0x98')){_0x13e1de[_0x7e72('0x8e')]=_0x7e72('0x99');logger[_0x7e72('0x6b')](_0x7e72('0x9a'),_0x13e1de['name'],_0x13e1de[_0x7e72('0x4f')]);}else{if(_['startsWith'](_0x33655d['channel'][_0x7e72('0x9b')](),_0x7e72('0x9c'))){if(this[_0x7e72('0xd')][_0x33655d[_0x7e72('0x9d')]]){var _0x4d8539=_[_0x7e72('0x81')](this[_0x7e72('0xd')][_0x33655d[_0x7e72('0x9d')]]);_0x4d8539['queuecallercomplete']=![];_0x4d8539[_0x7e72('0x96')]=!![];_0x4d8539[_0x7e72('0x97')]=moment(_0x13e1de[_0x7e72('0x76')])[_0x7e72('0x9e')](_0x33655d[_0x7e72('0x83')],'seconds')[_0x7e72('0x4b')](_0x7e72('0x77'));_0x4d8539['queuecallerexitreason']='FORWARDTRANSFER';_0x4d8539['transfer']=!![];_0x4d8539[_0x7e72('0x9f')]='FORWARD';_0x4d8539['transferexten']=_0x33655d['destexten'];_0x4d8539['transferuniqueid']=_0x33655d[_0x7e72('0x47')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4d8539[_0x7e72('0x48')],_0x4d8539['type']);var _0x344c79=this['queueReports'][_0x33655d[_0x7e72('0x9d')]];this['queueReports'][_0x33655d[_0x7e72('0x9d')]]=this[_0x7e72('0xd')][_0x33655d[_0x7e72('0x47')]];this[_0x7e72('0xd')][_0x33655d['uniqueid']]=_0x344c79;}}else{_0x13e1de[_0x7e72('0x8e')]=_0x7e72('0xa0')+_0x33655d[_0x7e72('0xa1')][_0x7e72('0xa2')]();logger[_0x7e72('0x6b')](_0x7e72('0xa3'),_0x13e1de[_0x7e72('0x48')],_0x13e1de['type'],_0x13e1de['queuecallerexitreason']);}}}this[_0x7e72('0xf')][_0x33655d['uniqueid']]=_0x13e1de;this[_0x7e72('0x41')](_0x13e1de,_0x7e72('0x1c'));}}}catch(_0x194f9b){logger[_0x7e72('0x3b')](_0x7e72('0x91'),_0x33655d['uniqueid'],util[_0x7e72('0x3d')](_0x194f9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7e72('0x21')]=function(_0x56fdad){try{if(this[_0x7e72('0x68')](_0x56fdad)){logger[_0x7e72('0x44')]('[%s][voiceQueueReport][varset]',_0x56fdad[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x56fdad,{'showHidden':![],'depth':null}));this[_0x7e72('0xa4')](_0x56fdad[_0x7e72('0x47')],_[_0x7e72('0x7e')](_0x56fdad[_0x7e72('0xa5')])[0x0],_0x56fdad[_0x7e72('0xa6')]);if(this[_0x7e72('0xd')][_0x56fdad[_0x7e72('0x47')]]){var _0x411c33=_[_0x7e72('0x81')](this['queueReports'][_0x56fdad[_0x7e72('0x47')]]);if(_0x411c33){if(this[_0x7e72('0x68')](_0x56fdad[_0x7e72('0xa5')])&&this[_0x7e72('0x68')](_0x56fdad['variable']['queuestatus'])){switch(_0x56fdad['value']){case _0x7e72('0xa7'):_0x411c33[_0x7e72('0x96')]=![];_0x411c33[_0x7e72('0x97')]=null;break;case'TIMEOUT':_0x411c33[_0x7e72('0xa8')]=_0x7e72('0xa9');_0x411c33[_0x7e72('0x96')]=!![];_0x411c33['queuecallerexitAt']=moment()[_0x7e72('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x411c33['queuecallerleaveAt']=moment()['format'](_0x7e72('0x77'));logger[_0x7e72('0x44')](_0x7e72('0xaa'),_0x56fdad[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x411c33,{'showHidden':![],'depth':null}));ami[_0x7e72('0x43')](_0x7e72('0xab'),_0x411c33);break;default:_0x411c33[_0x7e72('0x96')]=!![];_0x411c33['queuecallerexitAt']=moment()['format'](_0x7e72('0x77'));_0x411c33[_0x7e72('0x89')]=moment()[_0x7e72('0x4b')](_0x7e72('0x77'));}_0x411c33['queuecallerabandon']=![];_0x411c33[_0x7e72('0x92')]=null;_0x411c33[_0x7e72('0x8e')]=_0x56fdad[_0x7e72('0xa6')];this[_0x7e72('0xf')][_0x56fdad[_0x7e72('0x47')]]=_0x411c33;this[_0x7e72('0x41')](_0x411c33,_0x7e72('0x20'));}else if(this['isNotNull'](_0x56fdad[_0x7e72('0xa5')])&&this['isNotNull'](_0x56fdad['variable'][_0x7e72('0xac')])){if(!_0x411c33[_0x7e72('0x87')]){_0x411c33[_0x7e72('0x96')]=!![];_0x411c33['queuecallerexitAt']=moment()['format'](_0x7e72('0x77'));_0x411c33[_0x7e72('0x8e')]='EXITWITHKEY';_0x411c33['queuecallerleaveAt']=moment()[_0x7e72('0x4b')](_0x7e72('0x77'));this[_0x7e72('0xf')][_0x56fdad[_0x7e72('0x47')]]=_0x411c33;}}logger[_0x7e72('0x6b')](_0x7e72('0xad'),_0x56fdad[_0x7e72('0x47')],_0x411c33[_0x7e72('0x48')],_0x411c33[_0x7e72('0x4f')],_[_0x7e72('0x7e')](_0x56fdad[_0x7e72('0xa5')])[0x0],_0x56fdad[_0x7e72('0xa6')]);_0x411c33[_0x7e72('0x14')]=this[_0x7e72('0x14')][_0x56fdad[_0x7e72('0x47')]];}}}}catch(_0x384011){logger[_0x7e72('0x3b')]('[%s][voiceQueueReport][varset]',_0x56fdad[_0x7e72('0x47')],util[_0x7e72('0x3d')](_0x384011,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e72('0x9')]['addVariable']=function(_0x54fd04,_0x43f43e,_0x3a2114){var _0x4d3822=[_0x7e72('0xae'),_0x7e72('0xaf'),_0x7e72('0xb0'),_0x7e72('0xb1'),_0x7e72('0xb2'),_0x7e72('0xb3'),_0x7e72('0xb4'),_0x7e72('0xb5'),_0x7e72('0xb6'),_0x7e72('0xb7'),'bridgepeer',_0x7e72('0xb8'),'membercalls',_0x7e72('0xb9'),_0x7e72('0xba'),_0x7e72('0xbb'),_0x7e72('0x95'),_0x7e72('0xbc'),'memberrealtime'];if(!_[_0x7e72('0x36')](_0x43f43e)&&!_[_0x7e72('0xbd')](_0x4d3822,_0x43f43e)){if(_[_0x7e72('0x62')](this[_0x7e72('0x14')][_0x54fd04])){this[_0x7e72('0x14')][_0x54fd04]={};}this['variables'][_0x54fd04][_0x43f43e]=_0x3a2114;}};VoiceQueueReport[_0x7e72('0x9')][_0x7e72('0xbe')]=function(_0x158b05){try{if(this[_0x7e72('0x68')](_0x158b05)){logger[_0x7e72('0x44')](_0x7e72('0xbf'),_0x158b05['uniqueid'],util[_0x7e72('0x3d')](_0x158b05,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x158b05[_0x7e72('0x47')]]){for(var _0x2e73bc=0x0,_0x1a8b76={};_0x2e73bc=0x0?moment(_0x78a40d[_0xfda7('0x15')])[_0xfda7('0xc')](_0x78a40d[_0xfda7('0x14')],'seconds'):null,'data1':_0xfda7('0x16'),'data2':_0x78a40d[_0xfda7('0x11')],'data3':_0x78a40d['exten'],'data4':_0x78a40d[_0xfda7('0x17')]||null,'role':'agent','internal':_0x78a40d['accountcode']?_['toNumber'](_0x78a40d[_0xfda7('0x11')]):undefined,'uniqueid':_0x78a40d[_0xfda7('0x18')]},'log':_0xfda7('0x5')});}; \ No newline at end of file +var _0x1965=['Request','CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','membername','starttime','endtime','diff','outbound','dialstring','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt'];(function(_0x675b80,_0x5a4b91){var _0x3a8aff=function(_0x1f4e57){while(--_0x1f4e57){_0x675b80['push'](_0x675b80['shift']());}};_0x3a8aff(++_0x5a4b91);}(_0x1965,0x1d7));var _0x5196=function(_0x4b6beb,_0x211aed){_0x4b6beb=_0x4b6beb-0x0;var _0x35d772=_0x1965[_0x4b6beb];return _0x35d772;};'use strict';var moment=require('moment');var _=require(_0x5196('0x0'));var util=require('util');var client=require(_0x5196('0x1'));exports[_0x5196('0x2')]=function(_0x200ef7){var _0x520252=_0x200ef7[_0x5196('0x3')]||_0x200ef7[_0x5196('0x4')];return client[_0x5196('0x5')](_0x5196('0x6'),{'body':{'channel':'voice','membername':_0x200ef7[_0x5196('0x7')],'interface':_['isNil'](_0x200ef7[_0x5196('0x8')])?util[_0x5196('0x9')](_0x5196('0xa'),_0x200ef7[_0x5196('0x7')]):_0x200ef7['interface'],'type':_0x5196('0xb'),'enterAt':_0x200ef7[_0x5196('0xc')],'exitAt':_0x520252,'duration':moment(_0x520252)['diff'](_0x200ef7['queuecallerleaveAt'],_0x5196('0xd')),'data1':_0x5196('0xe'),'data2':_0x200ef7[_0x5196('0xf')],'data3':_0x200ef7[_0x5196('0x10')],'data4':null,'data5':_0x200ef7[_0x5196('0x11')],'role':_0x5196('0x12'),'internal':_0x200ef7[_0x5196('0x13')]?_[_0x5196('0x14')](_0x200ef7[_0x5196('0x13')]):undefined,'uniqueid':_0x200ef7[_0x5196('0x15')]},'log':_0x5196('0x6')});};exports['voiceDialReport']=function(_0x12e927){return client['Request'](_0x5196('0x6'),{'body':{'channel':'voice','membername':_0x12e927[_0x5196('0x16')],'interface':_0x12e927[_0x5196('0x8')],'type':_0x5196('0xb'),'enterAt':_0x12e927[_0x5196('0x17')],'exitAt':_0x12e927[_0x5196('0x18')],'duration':moment(_0x12e927[_0x5196('0x18')])[_0x5196('0x19')](_0x12e927[_0x5196('0x17')],'seconds')>=0x0?moment(_0x12e927[_0x5196('0x18')])[_0x5196('0x19')](_0x12e927[_0x5196('0x17')],_0x5196('0xd')):null,'data1':_0x5196('0x1a'),'data2':_0x12e927[_0x5196('0x13')],'data3':_0x12e927[_0x5196('0x10')],'data4':_0x12e927[_0x5196('0x1b')]||null,'role':'agent','internal':_0x12e927[_0x5196('0x13')]?_['toNumber'](_0x12e927[_0x5196('0x13')]):undefined,'uniqueid':_0x12e927[_0x5196('0x15')]},'log':_0x5196('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 327181c..95d5ae7 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 _0x2ec8=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x39279a,_0x12b8dc){var _0x489473=function(_0x2951b7){while(--_0x2951b7){_0x39279a['push'](_0x39279a['shift']());}};_0x489473(++_0x12b8dc);}(_0x2ec8,0x188));var _0x82ec=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ec8[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x82ec('0x0'));exports[_0x82ec('0x1')]=function(){return client[_0x82ec('0x2')](_0x82ec('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x82ec('0x4')});}; \ No newline at end of file +var _0xd9b4=['GetSettings','../client','getSettings'];(function(_0x15a099,_0x4eb0c1){var _0x8f248c=function(_0x4e4153){while(--_0x4e4153){_0x15a099['push'](_0x15a099['shift']());}};_0x8f248c(++_0x4eb0c1);}(_0xd9b4,0x1f0));var _0x4d9b=function(_0x56f918,_0xa2096f){_0x56f918=_0x56f918-0x0;var _0x165d3f=_0xd9b4[_0x56f918];return _0x165d3f;};'use strict';var client=require(_0x4d9b('0x0'));exports[_0x4d9b('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x4d9b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0149b83..136a330 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 _0x0ed1=['name','html','../client','Request','GetTemplate'];(function(_0x42f18f,_0x1098b1){var _0x163b43=function(_0x4ab7a4){while(--_0x4ab7a4){_0x42f18f['push'](_0x42f18f['shift']());}};_0x163b43(++_0x1098b1);}(_0x0ed1,0xb1));var _0x10ed=function(_0x39862a,_0x40869d){_0x39862a=_0x39862a-0x0;var _0x585ca9=_0x0ed1[_0x39862a];return _0x585ca9;};'use strict';var client=require(_0x10ed('0x0'));exports['getTemplates']=function(_0x12f5f9){return function(_0x4848b0){return client[_0x10ed('0x1')](_0x10ed('0x2'),{'options':{'raw':!![],'attributes':['id',_0x10ed('0x3'),_0x10ed('0x4')]},'log':_0x10ed('0x2')});};}; \ No newline at end of file +var _0x33a5=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x400ce4,_0x488faa){var _0x368332=function(_0x408bd6){while(--_0x408bd6){_0x400ce4['push'](_0x400ce4['shift']());}};_0x368332(++_0x488faa);}(_0x33a5,0x125));var _0x533a=function(_0x3ba1c6,_0x2c05b8){_0x3ba1c6=_0x3ba1c6-0x0;var _0x43e6b3=_0x33a5[_0x3ba1c6];return _0x43e6b3;};'use strict';var client=require(_0x533a('0x0'));exports[_0x533a('0x1')]=function(_0x8f8e1c){return function(_0x247378){return client[_0x533a('0x2')](_0x533a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x533a('0x4'),_0x533a('0x5')]},'log':_0x533a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d6dc523..96956a6 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 _0xad39=['AnyConditions','Action','Actions','data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value'];(function(_0x55e1b1,_0x3149b0){var _0x4d03e6=function(_0x19d111){while(--_0x19d111){_0x55e1b1['push'](_0x55e1b1['shift']());}};_0x4d03e6(++_0x3149b0);}(_0xad39,0x1ae));var _0x9ad3=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xad39[_0x4b12ae];return _0x16957b;};'use strict';var client=require('../client');exports[_0x9ad3('0x0')]=function(_0xbf3170){return function(_0xfcfd82){return client[_0x9ad3('0x1')](_0x9ad3('0x2'),{'options':{'raw':![],'attributes':['id',_0x9ad3('0x3'),_0x9ad3('0x4'),_0x9ad3('0x5')],'include':[{'model':_0x9ad3('0x6'),'as':_0x9ad3('0x7'),'attributes':['id',_0x9ad3('0x8'),_0x9ad3('0x9'),_0x9ad3('0xa')]},{'model':_0x9ad3('0x6'),'as':_0x9ad3('0xb'),'attributes':['id',_0x9ad3('0x8'),_0x9ad3('0x9'),_0x9ad3('0xa')]},{'model':_0x9ad3('0xc'),'as':_0x9ad3('0xd'),'attributes':['id','action',_0x9ad3('0xe'),_0x9ad3('0xf'),_0x9ad3('0x10'),_0x9ad3('0x11'),_0x9ad3('0x12'),_0x9ad3('0x13'),_0x9ad3('0x14')]}]},'log':_0x9ad3('0x2')});};}; \ No newline at end of file +var _0x498e=['data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','action','data1','data2','data4'];(function(_0x42764d,_0x332a27){var _0x2a643c=function(_0x54dfcf){while(--_0x54dfcf){_0x42764d['push'](_0x42764d['shift']());}};_0x2a643c(++_0x332a27);}(_0x498e,0xd3));var _0xe498=function(_0x2578b9,_0x411047){_0x2578b9=_0x2578b9-0x0;var _0x4a8529=_0x498e[_0x2578b9];return _0x4a8529;};'use strict';var client=require(_0xe498('0x0'));exports[_0xe498('0x1')]=function(_0x58f1d5){return function(_0x1bf1cb){return client[_0xe498('0x2')](_0xe498('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe498('0x4'),_0xe498('0x5')],'include':[{'model':_0xe498('0x6'),'as':_0xe498('0x7'),'attributes':['id','field',_0xe498('0x8'),_0xe498('0x9')]},{'model':_0xe498('0x6'),'as':_0xe498('0xa'),'attributes':['id',_0xe498('0xb'),'operator',_0xe498('0x9')]},{'model':_0xe498('0xc'),'as':'Actions','attributes':['id',_0xe498('0xd'),_0xe498('0xe'),_0xe498('0xf'),'data3',_0xe498('0x10'),'data5',_0xe498('0x11'),_0xe498('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 9cdbd1c..825d754 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 _0xacea=['name','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x5ca4d8,_0x4fc61f){var _0x586d97=function(_0x23c41c){while(--_0x23c41c){_0x5ca4d8['push'](_0x5ca4d8['shift']());}};_0x586d97(++_0x4fc61f);}(_0xacea,0x138));var _0xaace=function(_0x8d0a3b,_0x3b9586){_0x8d0a3b=_0x8d0a3b-0x0;var _0x16b983=_0xacea[_0x8d0a3b];return _0x16b983;};'use strict';var client=require(_0xaace('0x0'));exports[_0xaace('0x1')]=function(_0x285dc1){return function(_0x533be8){return client['Request'](_0xaace('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaace('0x3'),'registry',_0xaace('0x4')]},'log':_0xaace('0x2')});};}; \ No newline at end of file +var _0x338e=['getTrunks','GetTrunk','name','registry','defaultuser','../client'];(function(_0x3c2f12,_0x209cf4){var _0xdfc32a=function(_0x35b582){while(--_0x35b582){_0x3c2f12['push'](_0x3c2f12['shift']());}};_0xdfc32a(++_0x209cf4);}(_0x338e,0x137));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe338('0x0'));exports[_0xe338('0x1')]=function(_0x31b33e){return function(_0x3e805e){return client['Request'](_0xe338('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe338('0x3'),_0xe338('0x4'),_0xe338('0x5')]},'log':_0xe338('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7adf4e8..4c42324 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x1b3ec8,_0x45f624){var _0x568821=function(_0x4d5bb5){while(--_0x4d5bb5){_0x1b3ec8['push'](_0x1b3ec8['shift']());}};_0x568821(++_0x45f624);}(_0x34e8,0x12c));var _0x834e=function(_0x2d87ef,_0x1b907a){_0x2d87ef=_0x2d87ef-0x0;var _0x4ea65f=_0x34e8[_0x2d87ef];return _0x4ea65f;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3b7210,_0x11c01c){var _0x1b25a8=function(_0x25cb5f){while(--_0x25cb5f){_0x3b7210['push'](_0x3b7210['shift']());}};_0x1b25a8(++_0x11c01c);}(_0x70e0,0x17b));var _0x070e=function(_0x12f36d,_0x1e0130){_0x12f36d=_0x12f36d-0x0;var _0x35d6d6=_0x70e0[_0x12f36d];return _0x35d6d6;};'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 59d3c57..ef719de 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 _0x436c=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x41a408,_0x3672db){var _0x58add2=function(_0x3a0777){while(--_0x3a0777){_0x41a408['push'](_0x41a408['shift']());}};_0x58add2(++_0x3672db);}(_0x436c,0xc7));var _0xc436=function(_0xba13aa,_0x2c778e){_0xba13aa=_0xba13aa-0x0;var _0xeb5ba9=_0x436c[_0xba13aa];return _0xeb5ba9;};'use strict';var client=require(_0xc436('0x0'));exports['create']=function(_0x992aad){return client[_0xc436('0x1')](_0xc436('0x2'),{'body':_0x992aad,'log':_0xc436('0x2')});};exports['update']=function(_0x2e3837,_0x9ce996,_0x268978){return client['Request'](_0xc436('0x3'),{'body':_0x2e3837,'options':{'where':{'uniqueid':_0x9ce996,'interface':_0x268978,'agentcomplete':!![]}},'log':_0xc436('0x3')});}; \ No newline at end of file +var _0x542d=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x36d1d8,_0x5135f6){var _0x22a038=function(_0x297f8b){while(--_0x297f8b){_0x36d1d8['push'](_0x36d1d8['shift']());}};_0x22a038(++_0x5135f6);}(_0x542d,0x133));var _0xd542=function(_0x1b3b54,_0x346188){_0x1b3b54=_0x1b3b54-0x0;var _0x4822e4=_0x542d[_0x1b3b54];return _0x4822e4;};'use strict';var client=require(_0xd542('0x0'));exports[_0xd542('0x1')]=function(_0x57d331){return client['Request'](_0xd542('0x2'),{'body':_0x57d331,'log':'CreateVoiceAgentReport'});};exports[_0xd542('0x3')]=function(_0x246098,_0x4e18b0,_0x373197){return client[_0xd542('0x4')](_0xd542('0x5'),{'body':_0x246098,'options':{'where':{'uniqueid':_0x4e18b0,'interface':_0x373197,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8ba1b43..1b5910c 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 _0xe5c8=['duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xe5c8,0x157));var _0x8e5c=function(_0x49de54,_0x235da0){_0x49de54=_0x49de54-0x0;var _0x5513da=_0xe5c8[_0x49de54];return _0x5513da;};'use strict';var moment=require(_0x8e5c('0x0'));var util=require('util');var _=require(_0x8e5c('0x1'));var client=require('../client');exports[_0x8e5c('0x2')]=function(_0x2eb892){return client[_0x8e5c('0x3')](_0x8e5c('0x4'),{'body':_[_0x8e5c('0x5')](_0x2eb892,{'source':_0x2eb892['calleridnum'],'destinationcontext':_0x2eb892[_0x8e5c('0x6')],'callerid':_0x2eb892[_0x8e5c('0x7')],'amaflags':_0x8e5c('0x8')}),'log':_0x8e5c('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8e5c('0x3')](_0x8e5c('0x9'),{'options':{'where':{'type':[_0x8e5c('0xa')],'createdAt':{'$between':[moment()[_0x8e5c('0xb')]('day')[_0x8e5c('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8e5c('0xd')](_0x8e5c('0xe'))[_0x8e5c('0xc')](_0x8e5c('0xf'))]}},'attributes':[_0x8e5c('0x10'),'disposition',_0x8e5c('0x11'),_0x8e5c('0x12')]},'log':_0x8e5c('0x13')});};}; \ No newline at end of file +var _0x23b0=['Request','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','GetVoiceCallReports','util','lodash','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports'];(function(_0x445e44,_0x2b3142){var _0x2710dc=function(_0x2b5676){while(--_0x2b5676){_0x445e44['push'](_0x445e44['shift']());}};_0x2710dc(++_0x2b3142);}(_0x23b0,0x1ad));var _0x023b=function(_0x589478,_0x14303b){_0x589478=_0x589478-0x0;var _0x353564=_0x23b0[_0x589478];return _0x353564;};'use strict';var moment=require('moment');var util=require(_0x023b('0x0'));var _=require(_0x023b('0x1'));var client=require('../client');exports['create']=function(_0x122f2b){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0x122f2b,{'source':_0x122f2b[_0x023b('0x2')],'destinationcontext':_0x122f2b['context'],'callerid':_0x122f2b[_0x023b('0x3')],'amaflags':_0x023b('0x4')}),'log':'CreateVoiceCallReport'});};exports[_0x023b('0x5')]=function(){return function(){return client[_0x023b('0x6')](_0x023b('0x7'),{'options':{'where':{'type':[_0x023b('0x8')],'createdAt':{'$between':[moment()['startOf']('day')[_0x023b('0x9')](_0x023b('0xa')),moment()[_0x023b('0xb')]('day')[_0x023b('0x9')](_0x023b('0xa'))]}},'attributes':[_0x023b('0xc'),_0x023b('0xd'),'duration','billableseconds']},'log':_0x023b('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e863579..c194ed0 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 _0xf0b3=['../client','CreateVoiceDialReport'];(function(_0x5b2f2f,_0x5817ea){var _0x3ec95d=function(_0x2523be){while(--_0x2523be){_0x5b2f2f['push'](_0x5b2f2f['shift']());}};_0x3ec95d(++_0x5817ea);}(_0xf0b3,0x136));var _0x3f0b=function(_0x417234,_0x28ac37){_0x417234=_0x417234-0x0;var _0x33f3b8=_0xf0b3[_0x417234];return _0x33f3b8;};'use strict';var client=require(_0x3f0b('0x0'));exports['create']=function(_0x262296){return client['Request'](_0x3f0b('0x1'),{'body':_0x262296,'log':_0x3f0b('0x1')});}; \ No newline at end of file +var _0xc8c1=['Request','CreateVoiceDialReport','../client'];(function(_0x29431a,_0x3bef0b){var _0x4e3451=function(_0x4db323){while(--_0x4db323){_0x29431a['push'](_0x29431a['shift']());}};_0x4e3451(++_0x3bef0b);}(_0xc8c1,0x101));var _0x1c8c=function(_0x287e9a,_0x37b569){_0x287e9a=_0x287e9a-0x0;var _0xa03521=_0xc8c1[_0x287e9a];return _0xa03521;};'use strict';var client=require(_0x1c8c('0x0'));exports['create']=function(_0x42e518){return client[_0x1c8c('0x1')](_0x1c8c('0x2'),{'body':_0x42e518,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 80a9798..3bb5a7e 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 _0x7d5a=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x2852d8,_0x45d235){var _0x265770=function(_0x21746f){while(--_0x21746f){_0x2852d8['push'](_0x2852d8['shift']());}};_0x265770(++_0x45d235);}(_0x7d5a,0x17b));var _0xa7d5=function(_0xbf1694,_0x293e57){_0xbf1694=_0xbf1694-0x0;var _0x5c3de4=_0x7d5a[_0xbf1694];return _0x5c3de4;};'use strict';var client=require(_0xa7d5('0x0'));exports[_0xa7d5('0x1')]=function(){return function(){return client[_0xa7d5('0x2')](_0xa7d5('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa7d5('0x4'),_0xa7d5('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xa7d5('0x1')});};}; \ No newline at end of file +var _0x58e5=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x1a7cf5,_0x24c34a){var _0x39ca1f=function(_0x5217e3){while(--_0x5217e3){_0x1a7cf5['push'](_0x1a7cf5['shift']());}};_0x39ca1f(++_0x24c34a);}(_0x58e5,0xd1));var _0x558e=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x58e5[_0x51c819];return _0x15c5d2;};'use strict';var client=require(_0x558e('0x0'));exports[_0x558e('0x1')]=function(){return function(){return client[_0x558e('0x2')](_0x558e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x558e('0x4'),_0x558e('0x5')],'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 8995575..b96449a 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 _0x5e0c=['Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup'];(function(_0x26ffba,_0x28c3f3){var _0x21243b=function(_0x3ff2e6){while(--_0x3ff2e6){_0x26ffba['push'](_0x26ffba['shift']());}};_0x21243b(++_0x28c3f3);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x2215c2,_0xc39a17){_0x2215c2=_0x2215c2-0x0;var _0x40ba4f=_0x5e0c[_0x2215c2];return _0x40ba4f;};'use strict';var client=require('../client');exports[_0xc5e0('0x0')]=function(){return function(){return client[_0xc5e0('0x1')](_0xc5e0('0x2'),{'options':{'raw':![],'attributes':['id',_0xc5e0('0x3'),_0xc5e0('0x4'),_0xc5e0('0x5'),'autopause',_0xc5e0('0x6'),_0xc5e0('0x7'),_0xc5e0('0x8'),_0xc5e0('0x9'),_0xc5e0('0xa'),'dialLimitQueue','dialPowerLevel',_0xc5e0('0xb'),'dialPredictiveOptimizationPercentage',_0xc5e0('0xc'),_0xc5e0('0xd'),_0xc5e0('0xe'),_0xc5e0('0xf'),'dialQueueOptions',_0xc5e0('0x10'),'dialQueueProject',_0xc5e0('0x11'),_0xc5e0('0x12'),_0xc5e0('0x13'),_0xc5e0('0x14'),_0xc5e0('0x15'),_0xc5e0('0x16'),'dialGlobalMaxRetry',_0xc5e0('0x17'),_0xc5e0('0x18'),_0xc5e0('0x19'),_0xc5e0('0x1a'),_0xc5e0('0x1b'),'dialAMDInitialSilence',_0xc5e0('0x1c'),_0xc5e0('0x1d'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0xc5e0('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xc5e0('0x1f'),_0xc5e0('0x20'),_0xc5e0('0x21'),_0xc5e0('0x22'),_0xc5e0('0x23'),_0xc5e0('0x24'),_0xc5e0('0x25'),_0xc5e0('0x26'),_0xc5e0('0x6'),_0xc5e0('0x27'),_0xc5e0('0x28'),_0xc5e0('0x29'),_0xc5e0('0x2a'),_0xc5e0('0x2b'),'dialDropMaxRetry','dialDropRetryFrequency',_0xc5e0('0x2c'),_0xc5e0('0x2d'),_0xc5e0('0x2e'),_0xc5e0('0x2f'),_0xc5e0('0x30'),_0xc5e0('0x31'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xc5e0('0x32')],'include':[{'model':'Trunk','as':_0xc5e0('0x33'),'attributes':['id',_0xc5e0('0x3'),_0xc5e0('0x34'),_0xc5e0('0x35')]},{'model':_0xc5e0('0x36'),'as':_0xc5e0('0x37'),'attributes':['id',_0xc5e0('0x3')]},{'model':'Trunk','as':_0xc5e0('0x38'),'attributes':['id','name',_0xc5e0('0x34'),_0xc5e0('0x35')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0xc5e0('0x39'),'as':'Intervals','attributes':['id',_0xc5e0('0x3'),_0xc5e0('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xe928=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0xe928,0x145));var _0x8e92=function(_0x4e4c5a,_0x34f306){_0x4e4c5a=_0x4e4c5a-0x0;var _0x193b18=_0xe928[_0x4e4c5a];return _0x193b18;};'use strict';var client=require(_0x8e92('0x0'));exports[_0x8e92('0x1')]=function(){return function(){return client[_0x8e92('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8e92('0x3'),'acw',_0x8e92('0x4'),_0x8e92('0x5'),_0x8e92('0x6'),_0x8e92('0x7'),'dialActive',_0x8e92('0x8'),'dialLimitChannel',_0x8e92('0x9'),_0x8e92('0xa'),_0x8e92('0xb'),_0x8e92('0xc'),'dialPredictiveInterval',_0x8e92('0xd'),'dialOriginateCallerIdNumber',_0x8e92('0xe'),_0x8e92('0xf'),_0x8e92('0x10'),_0x8e92('0x11'),_0x8e92('0x12'),_0x8e92('0x13'),'dialBusyMaxRetry',_0x8e92('0x14'),_0x8e92('0x15'),_0x8e92('0x16'),'dialGlobalMaxRetry',_0x8e92('0x17'),_0x8e92('0x18'),_0x8e92('0x19'),_0x8e92('0x1a'),_0x8e92('0x1b'),_0x8e92('0x1c'),_0x8e92('0x1d'),'dialAMDAfterGreetingSilence',_0x8e92('0x1e'),'dialAMDMinWordLength',_0x8e92('0x1f'),_0x8e92('0x20'),'dialAMDSilenceThreshold',_0x8e92('0x21'),'timeout',_0x8e92('0x22'),_0x8e92('0x23'),_0x8e92('0x24'),_0x8e92('0x25'),_0x8e92('0x26'),_0x8e92('0x27'),_0x8e92('0x6'),_0x8e92('0x28'),'dialRandomLastDigitCallerIdNumber',_0x8e92('0x29'),_0x8e92('0x2a'),_0x8e92('0x2b'),_0x8e92('0x2c'),_0x8e92('0x2d'),'dialAbandonedMaxRetry',_0x8e92('0x2e'),_0x8e92('0x2f'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x8e92('0x30'),'dialPredictiveIntervalMaxThreshold',_0x8e92('0x31'),_0x8e92('0x32')],'include':[{'model':_0x8e92('0x33'),'as':_0x8e92('0x33'),'attributes':['id',_0x8e92('0x3'),_0x8e92('0x34'),'active']},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x8e92('0x33'),'as':_0x8e92('0x35'),'attributes':['id',_0x8e92('0x3'),_0x8e92('0x34'),_0x8e92('0x36')]},{'model':_0x8e92('0x37'),'as':'Interval','attributes':['id',_0x8e92('0x3')],'include':[{'model':_0x8e92('0x37'),'as':_0x8e92('0x38'),'attributes':['id',_0x8e92('0x3'),_0x8e92('0x39')]}]}]},'log':_0x8e92('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index cd41104..19192ea 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(_0x2eb41b,_0x2ec7c5){var _0x239018=function(_0x3482ed){while(--_0x3482ed){_0x2eb41b['push'](_0x2eb41b['shift']());}};_0x239018(++_0x2ec7c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x4ef443,_0x1e30e9){var _0x3bea94=function(_0x519757){while(--_0x519757){_0x4ef443['push'](_0x4ef443['shift']());}};_0x3bea94(++_0x1e30e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 b27c937..eb9fd26 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 _0xba59=['Request','GetVoiceQueueRtPauses','../client'];(function(_0x1511ad,_0x2fa78e){var _0x1b00c2=function(_0x3194f2){while(--_0x3194f2){_0x1511ad['push'](_0x1511ad['shift']());}};_0x1b00c2(++_0x2fa78e);}(_0xba59,0x1ac));var _0x9ba5=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xba59[_0x1147ab];return _0x55cb5a;};'use strict';var client=require(_0x9ba5('0x0'));exports['getVoiceQueueRtPauses']=function(_0x395082){return function(){return client[_0x9ba5('0x1')](_0x9ba5('0x2'),{'options':{'where':{'VoiceQueueId':_0x395082,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xe313=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe313,0x73));var _0x3e31=function(_0xd61bed,_0x3d5032){_0xd61bed=_0xd61bed-0x0;var _0x59ca05=_0xe313[_0xd61bed];return _0x59ca05;};'use strict';var client=require(_0x3e31('0x0'));exports[_0x3e31('0x1')]=function(_0x5e9a1a){return function(){return client[_0x3e31('0x2')](_0x3e31('0x3'),{'options':{'where':{'VoiceQueueId':_0x5e9a1a,'paused':!![]},'raw':!![]},'log':_0x3e31('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c66b8f5..c75ad3a 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(_0x435de5,_0x69380b){var _0x1e35a8=function(_0xe5950d){while(--_0xe5950d){_0x435de5['push'](_0x435de5['shift']());}};_0x1e35a8(++_0x69380b);}(_0x7a54,0x106));var _0x47a5=function(_0x1246a7,_0x5dcfee){_0x1246a7=_0x1246a7-0x0;var _0x3b3401=_0x7a54[_0x1246a7];return _0x3b3401;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1a09f3,_0x128f93){var _0x5d94fc=function(_0x2d0e9d){while(--_0x2d0e9d){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x5d94fc(++_0x128f93);}(_0x7a54,0x106));var _0x47a5=function(_0x39f7e7,_0x183d11){_0x39f7e7=_0x39f7e7-0x0;var _0x55053c=_0x7a54[_0x39f7e7];return _0x55053c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 2e8306d..7e2fc99 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 _0xf0de=['transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf0de,0x105));var _0xef0d=function(_0x53be5d,_0x39d50a){_0x53be5d=_0x53be5d-0x0;var _0x434533=_0xf0de[_0x53be5d];return _0x434533;};'use strict';var client=require(_0xef0d('0x0'));exports[_0xef0d('0x1')]={};exports[_0xef0d('0x2')]=function(_0x8ca84a){return client[_0xef0d('0x3')](_0xef0d('0x4'),{'body':{'result':_0x8ca84a[_0xef0d('0x5')],'transfererchannel':_0x8ca84a['transfererchannel'],'transferercalleridnum':_0x8ca84a[_0xef0d('0x6')],'transferercalleridname':_0x8ca84a[_0xef0d('0x7')],'transfererconnectedlinenum':_0x8ca84a[_0xef0d('0x8')],'transfererconnectedlinename':_0x8ca84a[_0xef0d('0x9')],'transfereraccountcode':_0x8ca84a['transfereraccountcode'],'transferercontext':_0x8ca84a[_0xef0d('0xa')],'transfererexten':_0x8ca84a[_0xef0d('0xb')],'transfererlinkedid':_0x8ca84a['transfererlinkedid'],'transfereechannel':_0x8ca84a[_0xef0d('0xc')],'transfereecalleridnum':_0x8ca84a['transfereecalleridnum'],'transfereecalleridname':_0x8ca84a['transfereecalleridname'],'transfereeconnectedlinenum':_0x8ca84a[_0xef0d('0xd')],'transfereeconnectedlinename':_0x8ca84a[_0xef0d('0xe')],'transfereeaccountcode':_0x8ca84a[_0xef0d('0xf')],'transfereecontext':_0x8ca84a[_0xef0d('0x10')],'transfereeexten':_0x8ca84a[_0xef0d('0x11')],'transfereelinkedid':_0x8ca84a[_0xef0d('0x12')],'isexternal':_0x8ca84a['isexternal'],'context':_0x8ca84a[_0xef0d('0x13')],'extension':_0x8ca84a[_0xef0d('0x14')],'type':'blind'},'log':_0xef0d('0x4')});};exports['attendedTransfer']=function(_0x32c316){return client[_0xef0d('0x3')](_0xef0d('0x4'),{'body':{'result':_0x32c316['result'],'transfererchannel':_0x32c316[_0xef0d('0x15')],'transferercalleridnum':_0x32c316[_0xef0d('0x16')],'transferercalleridname':_0x32c316[_0xef0d('0x17')],'transfererconnectedlinenum':_0x32c316[_0xef0d('0x18')],'transfererconnectedlinename':_0x32c316[_0xef0d('0x19')],'transfereraccountcode':_0x32c316['origtransfereraccountcode'],'transferercontext':_0x32c316['secondtransferercontext'],'transfererexten':_0x32c316[_0xef0d('0x1a')],'transfererlinkedid':_0x32c316[_0xef0d('0x1b')],'transfereechannel':_0x32c316[_0xef0d('0x1c')],'transfereecalleridnum':_0x32c316['transfertargetcalleridnum'],'transfereecalleridname':_0x32c316['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x32c316[_0xef0d('0x1d')],'transfereeconnectedlinename':_0x32c316[_0xef0d('0x1e')],'transfereeaccountcode':_0x32c316[_0xef0d('0x1f')],'transfereecontext':_0x32c316[_0xef0d('0x20')],'transfereeexten':_0x32c316[_0xef0d('0x21')],'transfereelinkedid':_0x32c316[_0xef0d('0x22')],'isexternal':_0x32c316[_0xef0d('0x23')],'context':_0x32c316[_0xef0d('0x24')],'extension':_0x32c316[_0xef0d('0x25')],'type':_0xef0d('0x26')},'log':_0xef0d('0x4')});}; \ No newline at end of file +var _0xf525=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x111b45,_0x127ed2){var _0x5b6413=function(_0x34ca69){while(--_0x34ca69){_0x111b45['push'](_0x111b45['shift']());}};_0x5b6413(++_0x127ed2);}(_0xf525,0x153));var _0x5f52=function(_0x4ec9ef,_0x3ed6e2){_0x4ec9ef=_0x4ec9ef-0x0;var _0x20711d=_0xf525[_0x4ec9ef];return _0x20711d;};'use strict';var client=require(_0x5f52('0x0'));exports[_0x5f52('0x1')]={};exports['blindTransfer']=function(_0xc80ebc){return client[_0x5f52('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0xc80ebc[_0x5f52('0x3')],'transfererchannel':_0xc80ebc[_0x5f52('0x4')],'transferercalleridnum':_0xc80ebc[_0x5f52('0x5')],'transferercalleridname':_0xc80ebc[_0x5f52('0x6')],'transfererconnectedlinenum':_0xc80ebc['transfererconnectedlinenum'],'transfererconnectedlinename':_0xc80ebc[_0x5f52('0x7')],'transfereraccountcode':_0xc80ebc[_0x5f52('0x8')],'transferercontext':_0xc80ebc['transferercontext'],'transfererexten':_0xc80ebc['transfererexten'],'transfererlinkedid':_0xc80ebc[_0x5f52('0x9')],'transfereechannel':_0xc80ebc[_0x5f52('0xa')],'transfereecalleridnum':_0xc80ebc['transfereecalleridnum'],'transfereecalleridname':_0xc80ebc[_0x5f52('0xb')],'transfereeconnectedlinenum':_0xc80ebc[_0x5f52('0xc')],'transfereeconnectedlinename':_0xc80ebc['transfereeconnectedlinename'],'transfereeaccountcode':_0xc80ebc[_0x5f52('0xd')],'transfereecontext':_0xc80ebc[_0x5f52('0xe')],'transfereeexten':_0xc80ebc[_0x5f52('0xf')],'transfereelinkedid':_0xc80ebc[_0x5f52('0x10')],'isexternal':_0xc80ebc['isexternal'],'context':_0xc80ebc[_0x5f52('0x11')],'extension':_0xc80ebc[_0x5f52('0x12')],'type':_0x5f52('0x13')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x2940f9){return client['Request'](_0x5f52('0x14'),{'body':{'result':_0x2940f9[_0x5f52('0x3')],'transfererchannel':_0x2940f9[_0x5f52('0x15')],'transferercalleridnum':_0x2940f9[_0x5f52('0x16')],'transferercalleridname':_0x2940f9[_0x5f52('0x17')],'transfererconnectedlinenum':_0x2940f9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2940f9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2940f9['origtransfereraccountcode'],'transferercontext':_0x2940f9[_0x5f52('0x18')],'transfererexten':_0x2940f9['secondtransfererexten'],'transfererlinkedid':_0x2940f9['origtransfererlinkedid'],'transfereechannel':_0x2940f9[_0x5f52('0x19')],'transfereecalleridnum':_0x2940f9[_0x5f52('0x1a')],'transfereecalleridname':_0x2940f9[_0x5f52('0x1b')],'transfereeconnectedlinenum':_0x2940f9[_0x5f52('0x1c')],'transfereeconnectedlinename':_0x2940f9[_0x5f52('0x1d')],'transfereeaccountcode':_0x2940f9[_0x5f52('0x1e')],'transfereecontext':_0x2940f9[_0x5f52('0x1f')],'transfereeexten':_0x2940f9[_0x5f52('0x20')],'transfereelinkedid':_0x2940f9[_0x5f52('0x21')],'isexternal':_0x2940f9[_0x5f52('0x22')],'context':_0x2940f9[_0x5f52('0x23')],'extension':_0x2940f9[_0x5f52('0x24')],'type':'attended'},'log':_0x5f52('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c70fcb5..b45ddd4 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 _0x741c=['http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../ami','%s/%s','timers','timer','updateAcw','agents','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','Reload','then','message','isConnected','action','Action','catch','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','undefined','values','channels','voicechannel','map','find','channel','format','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','voicequeuechannel','voicequeuechannelhangup','Hangup','queueChannels','Redirect','exten','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','send','checkAfterSend'];(function(_0x41a8e7,_0x5b65d5){var _0x241a47=function(_0x544f3){while(--_0x544f3){_0x41a8e7['push'](_0x41a8e7['shift']());}};_0x241a47(++_0x5b65d5);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var jayson=require(_0xc741('0x2'));var schema=require(_0xc741('0x3'));var BPromise=require(_0xc741('0x4'));var moment=require(_0xc741('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xc741('0x6'));exports['listen']=function(_0xc80e99,_0x1935b4,_0x3708ae){return new BPromise(function(_0x133bc4,_0x3f3d82){var _0x216e60={'QueuePause':function(_0x46b743){return new Promise(function(_0x598ead,_0x1ad6d9){var _0x1f53bf=util['format'](_0xc741('0x7'),'SIP',_0x46b743['name']);if(_0xc80e99[_0xc741('0x8')]&&_0xc80e99[_0xc741('0x8')][_0x1f53bf]&&_0xc80e99[_0xc741('0x8')][_0x1f53bf][_0xc741('0x9')]){_0xc80e99[_0xc741('0x8')][_0x1f53bf][_0xc741('0xa')]();}if(_0xc80e99[_0xc741('0xb')][_0x1f53bf]){_0xc80e99['agents'][_0x1f53bf]['updateStatusRealtime']({'statePause':_0x46b743['pause']?!![]:![]});}_0x598ead({'code':0xc8,'message':_0xc741('0xc')});});},'Reload':function(_0x48bee3){var _0x3bf1f7=this;return new Promise(function(_0x17e34d,_0x1b4442){if(ami['isConnected']()==![]){return _0x1b4442(_0x3bf1f7[_0xc741('0xd')](0x1f4,[config[_0xc741('0xe')]['ip'],config['asterisk'][_0xc741('0xf')],_0xc741('0x10')][_0xc741('0x11')]('\x20')));}_0x48bee3=_[_0xc741('0x12')](_0x48bee3,_[_0xc741('0x13')](properties['module']));_0x48bee3['action']=_0xc741('0x14');return ami['Action'](_0x48bee3)[_0xc741('0x15')](function(_0x3903c6){_0x17e34d({'code':0xc8,'message':_0x3903c6['message']});})['catch'](function(_0xebabc8){_0x1b4442(_0x3bf1f7[_0xc741('0xd')](0x1f5,_0xebabc8[_0xc741('0x16')]));});});},'Command':function(_0x498a5f){var _0x19d598=this;return new Promise(function(_0x7ff09a,_0x475348){if(ami[_0xc741('0x17')]()==![]){return _0x475348(_0x19d598[_0xc741('0xd')](0x1f4,[config[_0xc741('0xe')]['ip'],config[_0xc741('0xe')][_0xc741('0xf')],_0xc741('0x10')]['join']('\x20')));}_0x498a5f=_[_0xc741('0x12')](_0x498a5f,'command');_0x498a5f[_0xc741('0x18')]='Command';return ami[_0xc741('0x19')](_0x498a5f)[_0xc741('0x15')](function(_0x38e752){_0x7ff09a({'code':0xc8,'message':_0x38e752['content']});})[_0xc741('0x1a')](function(_0x5a89bd){_0x475348(_0x19d598[_0xc741('0xd')](0x1f5,_0x5a89bd[_0xc741('0x16')]));});});},'VoiceQueues':function(_0x3a2d64){return new Promise(function(_0x58af82,_0x53bdad){var _0x4ac9e3=[];for(var _0x178a57 in _0xc80e99[_0xc741('0x1b')]){if(_0xc80e99[_0xc741('0x1b')][_0xc741('0x1c')](_0x178a57)){var _0x1f8723=_0xc80e99['voiceQueues'][_0x178a57];var _0x4f63db={'id':_0x1f8723['id'],'name':_0x1f8723[_0xc741('0x1d')],'strategy':_0x1f8723[_0xc741('0x1e')],'answered':_0x1f8723[_0xc741('0x1f')],'available':_0x1f8723[_0xc741('0x20')],'loggedIn':_0x1f8723[_0xc741('0x21')],'pTalking':_0x1f8723[_0xc741('0x22')],'sumBillable':_0x1f8723['sumBillable'],'sumDuration':_0x1f8723[_0xc741('0x23')],'sumHoldTime':_0x1f8723[_0xc741('0x24')]||0x0,'talking':_0x1f8723['talking'],'total':_0x1f8723[_0xc741('0x25')],'type':_0x1f8723[_0xc741('0x26')],'unmanaged':_0x1f8723[_0xc741('0x27')],'abandoned':_0x1f8723[_0xc741('0x28')],'waiting':_0x1f8723[_0xc741('0x29')],'loggedInDb':_0x1f8723[_0xc741('0x2a')]};if(_0x1f8723[_0xc741('0x26')]===_0xc741('0x2b')){_0x4f63db[_0xc741('0x2c')]=_0x1f8723['dialActive'];_0x4f63db[_0xc741('0x2d')]=_0x1f8723['dialMethod'];_0x4f63db[_0xc741('0x2e')]=_0x1f8723['dialOriginateCallerIdName'];_0x4f63db['dialOriginateCallerIdNumber']=_0x1f8723[_0xc741('0x2f')];_0x4f63db[_0xc741('0x30')]=_0x1f8723[_0xc741('0x30')];_0x4f63db['dialPrefix']=_0x1f8723[_0xc741('0x31')];_0x4f63db[_0xc741('0x32')]=_0x1f8723[_0xc741('0x32')];_0x4f63db['outboundAnswerAgiCallsDay']=_0x1f8723[_0xc741('0x33')];_0x4f63db[_0xc741('0x34')]=_0x1f8723[_0xc741('0x34')];_0x4f63db[_0xc741('0x35')]=_0x1f8723[_0xc741('0x35')];_0x4f63db[_0xc741('0x36')]=_0x1f8723[_0xc741('0x36')];_0x4f63db['outboundCongestionCallsDay']=_0x1f8723['outboundCongestionCallsDay'];_0x4f63db[_0xc741('0x37')]=_0x1f8723[_0xc741('0x37')];_0x4f63db[_0xc741('0x38')]=_0x1f8723[_0xc741('0x38')];_0x4f63db[_0xc741('0x39')]=_0x1f8723[_0xc741('0x39')];_0x4f63db['outboundNoAnswerCallsDay']=_0x1f8723[_0xc741('0x3a')];_0x4f63db[_0xc741('0x3b')]=_0x1f8723['outboundNoSuchCallsDay'];_0x4f63db[_0xc741('0x3c')]=_0x1f8723[_0xc741('0x3c')];_0x4f63db[_0xc741('0x3d')]=_0x1f8723['outboundReCallsDay'];_0x4f63db[_0xc741('0x3e')]=_0x1f8723[_0xc741('0x3e')];_0x4f63db[_0xc741('0x3f')]=_0x1f8723[_0xc741('0x3f')];_0x4f63db[_0xc741('0x40')]=_0x1f8723[_0xc741('0x40')];_0x4f63db[_0xc741('0x41')]=_0x1f8723['predictiveIntervalAvgHoldtime'];_0x4f63db[_0xc741('0x42')]=_0x1f8723[_0xc741('0x42')];_0x4f63db[_0xc741('0x43')]=_0x1f8723[_0xc741('0x43')];_0x4f63db[_0xc741('0x44')]=_0x1f8723[_0xc741('0x44')];_0x4f63db[_0xc741('0x45')]=_0x1f8723[_0xc741('0x45')];_0x4f63db['predictiveIntervalErlangCallsDroppedCalls']=_0x1f8723[_0xc741('0x46')];_0x4f63db[_0xc741('0x47')]=_0x1f8723[_0xc741('0x47')];_0x4f63db[_0xc741('0x48')]=_0x1f8723['predictiveIntervalMultiplicativeFactor'];_0x4f63db[_0xc741('0x49')]=_0x1f8723['predictiveIntervalPauses'];_0x4f63db[_0xc741('0x4a')]=_0x1f8723[_0xc741('0x4a')];_0x4f63db[_0xc741('0x4b')]=_0x1f8723['predictiveIntervalTotalCalls'];_0x4f63db['message']=_0x1f8723[_0xc741('0x16')];_0x4f63db[_0xc741('0x4c')]=_0x1f8723[_0xc741('0x4c')];_0x4f63db[_0xc741('0x4d')]=_0x1f8723[_0xc741('0x4d')];_0x4f63db[_0xc741('0x4e')]=_0x1f8723[_0xc741('0x4e')];_0x4f63db[_0xc741('0x4f')]=_0x1f8723[_0xc741('0x4f')];_0x4f63db[_0xc741('0x50')]=_0x1f8723[_0xc741('0x50')];_0x4f63db[_0xc741('0x51')]=_0x1f8723[_0xc741('0x51')];_0x4f63db[_0xc741('0x52')]=_0x1f8723[_0xc741('0x52')];}if(_0x1f8723[_0xc741('0x53')]){_0x4f63db[_0xc741('0x53')]={'id':_0x1f8723['Trunk']['id'],'name':_0x1f8723[_0xc741('0x53')]['name'],'active':_0x1f8723[_0xc741('0x53')]['active'],'callerid':_0x1f8723[_0xc741('0x53')][_0xc741('0x54')]};}if(_0x1f8723['Interval']){_0x4f63db[_0xc741('0x55')]={'id':_0x1f8723[_0xc741('0x55')]['id'],'name':_0x1f8723['Interval'][_0xc741('0x1d')]};}_0x4ac9e3[_0xc741('0x56')](_0x4f63db);}}_0x58af82({'count':_0x4ac9e3[_0xc741('0x57')],'rows':_0x4ac9e3});});},'UpdateVoiceQueue':function(_0x249b8e){return new Promise(function(_0x44dcce,_0x2a5b6f){var _0x12ce1c=_['find'](_0xc80e99[_0xc741('0x1b')],{'id':parseInt(_0x249b8e['id'])});var _0x4ce649=_['omit'](_0x249b8e,['id']);if(_0x12ce1c){for(var _0x61bfc7 in _0x4ce649){if(typeof _0x4ce649[_0x61bfc7]!=='undefined'&&typeof _0x12ce1c[_0x61bfc7]!==_0xc741('0x58')){_0x12ce1c[_0x61bfc7]=_0x4ce649[_0x61bfc7];}}_0x44dcce(_0x12ce1c);}else{_0x2a5b6f();}});},'VoiceChannels':function(_0x1ed2e7){return new Promise(function(_0xc1179c,_0x35fd4e){var _0x4188a4=_[_0xc741('0x59')](_0xc80e99[_0xc741('0x5a')]);_0xc1179c({'count':_0x4188a4[_0xc741('0x57')],'rows':_0x4188a4});});},'VoiceChannelMixMonitor':function(_0x250260){var _0x47e168=this;return new Promise(function(_0x4fbf07,_0x12dde4){if(ami[_0xc741('0x17')]()==![]){return _0x12dde4(_0x47e168[_0xc741('0xd')](0x1f4,[config[_0xc741('0xe')]['ip'],config['asterisk'][_0xc741('0xf')],'ami\x20disconnected'][_0xc741('0x11')]('\x20')));}var _0x1643b8=schema(properties[_0xc741('0x5b')])[_0xc741('0x3')](_0x250260);if(_0x1643b8[_0xc741('0x57')]>0x0){return _0x12dde4(_0x47e168[_0xc741('0xd')](0x1f4,_[_0xc741('0x5c')](_0x1643b8,_0xc741('0x16'))[_0xc741('0x11')](',\x20')));}var _0x30849a=_[_0xc741('0x5d')](_0xc80e99[_0xc741('0x5a')],{'uniqueid':_0x250260['uniqueid']});if(_0x30849a&&_0x30849a[_0xc741('0x5e')]){var _0xd4a708=util[_0xc741('0x5f')]('%s.%s',_0x250260[_0xc741('0x60')]||_0x250260[_0xc741('0x61')],_0x250260[_0xc741('0x5f')]||_0xc741('0x62'));return ami['Action']({'action':_0xc741('0x63'),'channel':_0x30849a[_0xc741('0x5e')],'file':_0xd4a708,'options':_0xc741('0x64')})[_0xc741('0x15')](function(_0x570140){var _0x30816d=_['find'](_0x30849a[_0xc741('0x65')],{'filename':_0xc741('0x66')+_0xd4a708[_0xc741('0x67')]()});if(_[_0xc741('0x68')](_0x30816d)){_0x30849a[_0xc741('0x65')][_0xc741('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0xd4a708[_0xc741('0x67')](),'createdAt':moment()['format'](_0xc741('0x69')),'mixmonitorid':_0x570140[_0xc741('0x6a')],'status':_0xc741('0x6b')});}else{_0x30816d[_0xc741('0x6a')]=_0x570140[_0xc741('0x6a')];_0x30816d['status']='rec';}_0x4fbf07({'code':0xc8,'message':[_0x250260[_0xc741('0x61')],'MixMonitor\x20Success',_0x570140[_0xc741('0x6a')]][_0xc741('0x11')]('\x20'),'mixmonitorid':_0x570140[_0xc741('0x6a')]});})[_0xc741('0x1a')](function(_0x1fec29){_0x12dde4(_0x47e168[_0xc741('0xd')](0x1f5,[_0x250260[_0xc741('0x61')],_0x1fec29[_0xc741('0x16')][_0xc741('0x67')]()][_0xc741('0x11')]('\x20')));});}else{return _0x12dde4(_0x47e168[_0xc741('0xd')](0x1f5,_0xc741('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4f386b){var _0x4d3c10=this;return new Promise(function(_0x193a21,_0x39f700){if(ami[_0xc741('0x17')]()==![]){return _0x39f700(_0x4d3c10['error'](0x1f4,[config['asterisk']['ip'],config[_0xc741('0xe')]['username'],_0xc741('0x10')][_0xc741('0x11')]('\x20')));}var _0x407a73=schema(properties[_0xc741('0x5b')])[_0xc741('0x3')](_0x4f386b);if(_0x407a73['length']>0x0){return _0x39f700(_0x4d3c10['error'](0x1f4,_[_0xc741('0x5c')](_0x407a73,_0xc741('0x16'))['join'](',\x20')));}var _0xffe066=_[_0xc741('0x5d')](_0xc80e99[_0xc741('0x5a')],{'uniqueid':_0x4f386b[_0xc741('0x61')]});if(_0xffe066){return BPromise[_0xc741('0x6d')]()['then'](function(){if(_0xffe066['channel']){return ami[_0xc741('0x19')]({'action':'StopMixMonitor','channel':_0xffe066[_0xc741('0x5e')],'mixmonitorid':_0x4f386b[_0xc741('0x6a')]})['catch'](function(_0x461370){});}})[_0xc741('0x15')](function(){if(_0xffe066[_0xc741('0x6e')]){return ami[_0xc741('0x19')]({'action':_0xc741('0x6f'),'channel':_0xffe066[_0xc741('0x6e')],'mixmonitorid':_0x4f386b[_0xc741('0x6a')]})['catch'](function(_0x64e818){});}})[_0xc741('0x15')](function(_0x4dfd15){var _0x2368b2=_[_0xc741('0x5d')](_0xffe066[_0xc741('0x65')],{'mixmonitorid':_0x4f386b['mixmonitorid']});if(_0x2368b2){_0x2368b2[_0xc741('0x70')]=_0xc741('0x71');}})['then'](function(){var _0x74fb52=util[_0xc741('0x5f')](_0xc741('0x72'),_0x4f386b[_0xc741('0x60')]||_0x4f386b['uniqueid'],_0x4f386b['format']||_0xc741('0x62'));var _0x48a6b2=_[_0xc741('0x5d')](_0xffe066[_0xc741('0x65')],{'filename':_0xc741('0x66')+_0x74fb52[_0xc741('0x67')]()});if(_0x48a6b2){_0x48a6b2[_0xc741('0x70')]=_0xc741('0x71');}})['then'](function(){_0x193a21({'code':0xc8,'message':[_0x4f386b[_0xc741('0x61')],'StopMixMonitor\x20Success'][_0xc741('0x11')]('\x20')});})[_0xc741('0x1a')](function(_0x469970){_0x39f700(_0x4d3c10[_0xc741('0xd')](0x1f5,[_0x4f386b['uniqueid'],_0x469970[_0xc741('0x16')][_0xc741('0x67')]()][_0xc741('0x11')]('\x20')));});}else{return _0x39f700(_0x4d3c10[_0xc741('0xd')](0x1f5,_0xc741('0x6c')));}});},'VoiceQueuesChannels':function(_0x240865){return new Promise(function(_0x2e64a1,_0x2c1294){var _0x3ebe63=_['values'](_0xc80e99['queueChannels']);_0x2e64a1({'count':_0x3ebe63[_0xc741('0x57')],'rows':_0x3ebe63});});},'VoiceQueuesChannel':function(_0x257c73){var _0x133b9e=this;return new Promise(function(_0x3631f1,_0x4e4c44){var _0x5151ff=schema(properties[_0xc741('0x73')])[_0xc741('0x3')](_0x257c73);if(_0x5151ff[_0xc741('0x57')]>0x0){return _0x4e4c44(_0x133b9e[_0xc741('0xd')](0x1f4,_[_0xc741('0x5c')](_0x5151ff,_0xc741('0x16'))[_0xc741('0x11')](',\x20')));}var _0x5e8e36=_[_0xc741('0x5d')](_0xc80e99['queueChannels'],{'uniqueid':_0x257c73['uniqueid']});if(_0x5e8e36){_0x3631f1(_0x5e8e36);}else{return _0x4e4c44(_0x133b9e[_0xc741('0xd')](0x1f5,_0xc741('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x4f7ae8){var _0x485dad=this;return new Promise(function(_0x1291ce,_0x531c1c){if(ami['isConnected']()==![]){return _0x531c1c(_0x485dad[_0xc741('0xd')](0x1f4,[config[_0xc741('0xe')]['ip'],config['asterisk'][_0xc741('0xf')],_0xc741('0x10')][_0xc741('0x11')]('\x20')));}var _0x1d7a96=schema(properties[_0xc741('0x74')])[_0xc741('0x3')](_0x4f7ae8);if(_0x1d7a96[_0xc741('0x57')]>0x0){return _0x531c1c(_0x485dad[_0xc741('0xd')](0x1f4,_['map'](_0x1d7a96,_0xc741('0x16'))[_0xc741('0x11')](',\x20')));}var _0x1619a4=_[_0xc741('0x5d')](_0xc80e99['queueChannels'],{'uniqueid':_0x4f7ae8[_0xc741('0x61')]});if(_0x1619a4&&_0x1619a4[_0xc741('0x5e')]){return ami['Action']({'action':_0xc741('0x75'),'channel':_0x1619a4[_0xc741('0x5e')]})[_0xc741('0x15')](function(_0x15dced){_0x1291ce({'code':0xc8,'message':[_0x4f7ae8['uniqueid'],_0x15dced['message']['toLowerCase']()][_0xc741('0x11')]('\x20')});})[_0xc741('0x1a')](function(_0x1e2228){_0x531c1c(_0x485dad[_0xc741('0xd')](0x1f5,[_0x4f7ae8['uniqueid'],_0x1e2228[_0xc741('0x16')][_0xc741('0x67')]()]['join']('\x20')));});}else{return _0x531c1c(_0x485dad['error'](0x1f5,_0xc741('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x17f47c){var _0x2ce3c5=this;return new Promise(function(_0x5d831a,_0x3922e1){if(ami[_0xc741('0x17')]()==![]){return _0x3922e1(_0x2ce3c5[_0xc741('0xd')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xc741('0x10')][_0xc741('0x11')]('\x20')));}var _0x598499=schema(properties['voicequeuechannelredirect'])[_0xc741('0x3')](_0x17f47c);if(_0x598499[_0xc741('0x57')]>0x0){return _0x3922e1(_0x2ce3c5['error'](0x1f4,_[_0xc741('0x5c')](_0x598499,'message')['join'](',\x20')));}var _0x4b4095=_[_0xc741('0x5d')](_0xc80e99[_0xc741('0x76')],{'uniqueid':_0x17f47c[_0xc741('0x61')]});if(_0x4b4095&&_0x4b4095[_0xc741('0x5e')]){return ami['Action']({'action':_0xc741('0x77'),'channel':_0x4b4095['channel'],'exten':_0x17f47c[_0xc741('0x78')],'context':_0x17f47c['context']||_0x4b4095['context'],'priority':0x1})[_0xc741('0x15')](function(_0x4386d7){_0x5d831a({'code':0xc8,'message':[_0x17f47c['uniqueid'],_0x4386d7[_0xc741('0x16')][_0xc741('0x67')]()][_0xc741('0x11')]('\x20')});})[_0xc741('0x1a')](function(_0x3103bd){_0x3922e1(_0x2ce3c5[_0xc741('0xd')](0x1f5,[_0x17f47c['uniqueid'],_0x3103bd[_0xc741('0x16')][_0xc741('0x67')]()][_0xc741('0x11')]('\x20')));});}else{return _0x3922e1(_0x2ce3c5[_0xc741('0xd')](0x1f5,_0xc741('0x6c')));}});},'Agents':function(_0x397706){return new Promise(function(_0x3e254b,_0x41ca9a){var _0x362e17=_[_0xc741('0x59')](_0xc80e99[_0xc741('0xb')]);_0x3e254b({'count':_0x362e17[_0xc741('0x57')],'rows':_0x362e17});});},'Telephones':function(_0x52f3a4){return new Promise(function(_0x54cce7,_0x47e71d){var _0x4c78dc=_[_0xc741('0x59')](_0xc80e99[_0xc741('0x79')]);_0x54cce7({'count':_0x4c78dc[_0xc741('0x57')],'rows':_0x4c78dc});});},'Trunks':function(_0x2e1962){return new Promise(function(_0x135a11,_0x273c78){var _0x2b695e=_[_0xc741('0x59')](_0xc80e99[_0xc741('0x7a')]);_0x135a11({'count':_0x2b695e[_0xc741('0x57')],'rows':_0x2b695e});});},'OutboundChannels':function(_0x3433c6){return new Promise(function(_0x367576,_0x3a7f67){var _0x513b75=_[_0xc741('0x59')](_0xc80e99[_0xc741('0x7b')]);_0x367576({'count':_0x513b75[_0xc741('0x57')],'rows':_0x513b75});});},'Outbound':function(_0x6a23ca){return new Promise(function(_0x320b7e,_0x2458af){_0x320b7e(_0xc80e99[_0xc741('0x2b')]);});},'Campaigns':function(_0x2d568a){return new Promise(function(_0x20b722,_0x4228ec){var _0x1b095e=_[_0xc741('0x59')](_0xc80e99['campaigns']);_0x20b722({'count':_0x1b095e[_0xc741('0x57')],'rows':_0x1b095e});});},'VoiceQueuesPreview':function(_0x3e0747){var _0x209427=this;return new Promise(function(_0x5f30c9,_0x135b9c){_0x1935b4[_0xc741('0x7c')](_0x3e0747['id'])['then'](function(_0x3cd978){_0x5f30c9({'code':0xc8,'message':_0x3cd978['message']});})[_0xc741('0x1a')](function(_0xf66a9c){_0x135b9c(_0x209427[_0xc741('0xd')](0x1f4,_0xf66a9c['message']));});});},'EventManager':function(_0xbc6f18){var _0x4f5393=this;return new Promise(function(_0x5508a5,_0x5ef1a1){if(!_0xbc6f18[_0xc741('0x7d')]){return _0x5ef1a1(_0x4f5393[_0xc741('0xd')](0x1f4,_0xc741('0x7e')));}ami[_0xc741('0x7f')]('custom:'+_0xbc6f18[_0xc741('0x7d')],_0xbc6f18[_0xc741('0x16')]);_0x5508a5({'code':0xc8,'message':_0xbc6f18});});},'FaxAccounts':function(_0x14262a){return new Promise(function(_0x50e4b3,_0x2862c2){var _0x4045cc=_[_0xc741('0x59')](_0xc80e99['faxAccounts']);_0x50e4b3({'count':_0x4045cc[_0xc741('0x57')],'rows':_0x4045cc});});},'SendFax':function(_0x6cdf9c){var _0x466b7e=this;return new Promise(function(_0x62d071,_0x193414){_0x3708ae[_0xc741('0x80')](_0x6cdf9c)['then'](function(_0x435054){_0x62d071({'code':0xc8,'message':_0x435054[_0xc741('0x16')]});})['catch'](function(_0x4c1a69){_0x193414(_0x466b7e[_0xc741('0xd')](0x1f4,_0x4c1a69[_0xc741('0x16')]));});});},'CheckAfterSend':function(_0x4bd352){var _0x3af6fc=this;return new Promise(function(_0x1fee97,_0x337648){_0x3708ae[_0xc741('0x81')](_0x4bd352)[_0xc741('0x15')](function(_0x3328ef){_0x1fee97({'code':0xc8,'message':_0x3328ef[_0xc741('0x16')]});})[_0xc741('0x1a')](function(_0x896302){_0x337648(_0x3af6fc[_0xc741('0xd')](0x1f4,_0x896302[_0xc741('0x16')]));});});}};var _0x4b776f=jayson['server'](_0x216e60)[_0xc741('0x82')]();_0x4b776f['on'](_0xc741('0xd'),function(_0x1660dc){return _0x3f3d82(_0x1660dc);});_0x4b776f['listen'](0x232a,_0xc741('0x83'),function(){console['log'](_0xc741('0x84'),0x232a);return _0x133bc4(_0xc741('0x85')+0x232a);});});}; \ No newline at end of file +var _0x2542=['outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','undefined','values','channels','length','voicechannel','map','channel','uniqueid','ai(mixmonitorid)','toLowerCase','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','stop','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','module','Reload','Action','then','message','catch','error','action','Command','hasOwnProperty','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay'];(function(_0x863e9e,_0x5854b0){var _0x24fa60=function(_0x346970){while(--_0x346970){_0x863e9e['push'](_0x863e9e['shift']());}};_0x24fa60(++_0x5854b0);}(_0x2542,0x169));var _0x2254=function(_0x7da84c,_0x2230d1){_0x7da84c=_0x7da84c-0x0;var _0x43ad1e=_0x2542[_0x7da84c];return _0x43ad1e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var jayson=require(_0x2254('0x2'));var schema=require(_0x2254('0x3'));var BPromise=require('bluebird');var moment=require(_0x2254('0x4'));var config=require('../../../config/environment');var properties=require(_0x2254('0x5'));var ami=require(_0x2254('0x6'));exports[_0x2254('0x7')]=function(_0x456612,_0x76c902,_0x508183){return new BPromise(function(_0x19ad3c,_0xe8ca50){var _0x2ee7ee={'QueuePause':function(_0x3c45ec){return new Promise(function(_0x1637ad,_0x477b47){var _0x263459=util[_0x2254('0x8')](_0x2254('0x9'),_0x2254('0xa'),_0x3c45ec[_0x2254('0xb')]);if(_0x456612['timers']&&_0x456612[_0x2254('0xc')][_0x263459]&&_0x456612[_0x2254('0xc')][_0x263459][_0x2254('0xd')]){_0x456612[_0x2254('0xc')][_0x263459]['updateAcw']();}if(_0x456612['agents'][_0x263459]){_0x456612[_0x2254('0xe')][_0x263459][_0x2254('0xf')]({'statePause':_0x3c45ec[_0x2254('0x10')]?!![]:![]});}_0x1637ad({'code':0xc8,'message':_0x2254('0x11')});});},'Reload':function(_0x3c326b){var _0x381efe=this;return new Promise(function(_0x592a4f,_0x439238){if(ami[_0x2254('0x12')]()==![]){return _0x439238(_0x381efe['error'](0x1f4,[config[_0x2254('0x13')]['ip'],config[_0x2254('0x13')][_0x2254('0x14')],_0x2254('0x15')][_0x2254('0x16')]('\x20')));}_0x3c326b=_[_0x2254('0x17')](_0x3c326b,_['keys'](properties[_0x2254('0x18')]));_0x3c326b['action']=_0x2254('0x19');return ami[_0x2254('0x1a')](_0x3c326b)[_0x2254('0x1b')](function(_0x25f8b2){_0x592a4f({'code':0xc8,'message':_0x25f8b2[_0x2254('0x1c')]});})[_0x2254('0x1d')](function(_0x497724){_0x439238(_0x381efe['error'](0x1f5,_0x497724['message']));});});},'Command':function(_0xb05559){var _0x3a79f8=this;return new Promise(function(_0x3c3a98,_0x1f1163){if(ami[_0x2254('0x12')]()==![]){return _0x1f1163(_0x3a79f8[_0x2254('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x2254('0x13')][_0x2254('0x14')],_0x2254('0x15')]['join']('\x20')));}_0xb05559=_['pick'](_0xb05559,'command');_0xb05559[_0x2254('0x1f')]=_0x2254('0x20');return ami[_0x2254('0x1a')](_0xb05559)['then'](function(_0x5713e4){_0x3c3a98({'code':0xc8,'message':_0x5713e4['content']});})['catch'](function(_0x5e5edb){_0x1f1163(_0x3a79f8['error'](0x1f5,_0x5e5edb[_0x2254('0x1c')]));});});},'VoiceQueues':function(_0x9d6ccf){return new Promise(function(_0x2f3037,_0x265467){var _0x13522d=[];for(var _0x1349c9 in _0x456612['voiceQueues']){if(_0x456612['voiceQueues'][_0x2254('0x21')](_0x1349c9)){var _0x4f6877=_0x456612[_0x2254('0x22')][_0x1349c9];var _0x141dc5={'id':_0x4f6877['id'],'name':_0x4f6877[_0x2254('0xb')],'strategy':_0x4f6877[_0x2254('0x23')],'answered':_0x4f6877[_0x2254('0x24')],'available':_0x4f6877['available'],'loggedIn':_0x4f6877[_0x2254('0x25')],'pTalking':_0x4f6877[_0x2254('0x26')],'sumBillable':_0x4f6877[_0x2254('0x27')],'sumDuration':_0x4f6877[_0x2254('0x28')],'sumHoldTime':_0x4f6877[_0x2254('0x29')]||0x0,'talking':_0x4f6877[_0x2254('0x2a')],'total':_0x4f6877[_0x2254('0x2b')],'type':_0x4f6877[_0x2254('0x2c')],'unmanaged':_0x4f6877[_0x2254('0x2d')],'abandoned':_0x4f6877[_0x2254('0x2e')],'waiting':_0x4f6877[_0x2254('0x2f')],'loggedInDb':_0x4f6877[_0x2254('0x30')]};if(_0x4f6877[_0x2254('0x2c')]===_0x2254('0x31')){_0x141dc5[_0x2254('0x32')]=_0x4f6877[_0x2254('0x32')];_0x141dc5[_0x2254('0x33')]=_0x4f6877[_0x2254('0x33')];_0x141dc5[_0x2254('0x34')]=_0x4f6877['dialOriginateCallerIdName'];_0x141dc5[_0x2254('0x35')]=_0x4f6877[_0x2254('0x35')];_0x141dc5[_0x2254('0x36')]=_0x4f6877[_0x2254('0x36')];_0x141dc5[_0x2254('0x37')]=_0x4f6877[_0x2254('0x37')];_0x141dc5[_0x2254('0x38')]=_0x4f6877[_0x2254('0x38')];_0x141dc5[_0x2254('0x39')]=_0x4f6877['outboundAnswerAgiCallsDay'];_0x141dc5[_0x2254('0x3a')]=_0x4f6877[_0x2254('0x3a')];_0x141dc5['outboundBlacklistCallsDay']=_0x4f6877[_0x2254('0x3b')];_0x141dc5[_0x2254('0x3c')]=_0x4f6877[_0x2254('0x3c')];_0x141dc5[_0x2254('0x3d')]=_0x4f6877['outboundCongestionCallsDay'];_0x141dc5['outboundDropCallsDayACS']=_0x4f6877[_0x2254('0x3e')];_0x141dc5['outboundDropCallsDayCallersExit']=_0x4f6877[_0x2254('0x3f')];_0x141dc5[_0x2254('0x40')]=_0x4f6877[_0x2254('0x40')];_0x141dc5[_0x2254('0x41')]=_0x4f6877[_0x2254('0x41')];_0x141dc5[_0x2254('0x42')]=_0x4f6877[_0x2254('0x42')];_0x141dc5['outboundOriginateFailureCallsDay']=_0x4f6877[_0x2254('0x43')];_0x141dc5[_0x2254('0x44')]=_0x4f6877[_0x2254('0x44')];_0x141dc5[_0x2254('0x45')]=_0x4f6877[_0x2254('0x45')];_0x141dc5[_0x2254('0x46')]=_0x4f6877[_0x2254('0x46')];_0x141dc5[_0x2254('0x47')]=_0x4f6877[_0x2254('0x47')];_0x141dc5[_0x2254('0x48')]=_0x4f6877['predictiveIntervalAvgHoldtime'];_0x141dc5[_0x2254('0x49')]=_0x4f6877[_0x2254('0x49')];_0x141dc5[_0x2254('0x4a')]=_0x4f6877[_0x2254('0x4a')];_0x141dc5['predictiveIntervalDroppedCallsTimeout']=_0x4f6877[_0x2254('0x4b')];_0x141dc5[_0x2254('0x4c')]=_0x4f6877[_0x2254('0x4c')];_0x141dc5[_0x2254('0x4d')]=_0x4f6877[_0x2254('0x4d')];_0x141dc5[_0x2254('0x4e')]=_0x4f6877[_0x2254('0x4e')];_0x141dc5[_0x2254('0x4f')]=_0x4f6877['predictiveIntervalMultiplicativeFactor'];_0x141dc5[_0x2254('0x50')]=_0x4f6877['predictiveIntervalPauses'];_0x141dc5[_0x2254('0x51')]=_0x4f6877[_0x2254('0x51')];_0x141dc5[_0x2254('0x52')]=_0x4f6877[_0x2254('0x52')];_0x141dc5[_0x2254('0x1c')]=_0x4f6877[_0x2254('0x1c')];_0x141dc5[_0x2254('0x53')]=_0x4f6877['originated'];_0x141dc5[_0x2254('0x54')]=_0x4f6877[_0x2254('0x54')];_0x141dc5[_0x2254('0x55')]=_0x4f6877[_0x2254('0x55')];_0x141dc5[_0x2254('0x56')]=_0x4f6877['erlangAbandonmentRate'];_0x141dc5[_0x2254('0x57')]=_0x4f6877[_0x2254('0x57')];_0x141dc5[_0x2254('0x58')]=_0x4f6877[_0x2254('0x58')];_0x141dc5[_0x2254('0x59')]=_0x4f6877['startProgressive'];}if(_0x4f6877[_0x2254('0x5a')]){_0x141dc5['Trunk']={'id':_0x4f6877[_0x2254('0x5a')]['id'],'name':_0x4f6877[_0x2254('0x5a')][_0x2254('0xb')],'active':_0x4f6877[_0x2254('0x5a')][_0x2254('0x5b')],'callerid':_0x4f6877[_0x2254('0x5a')][_0x2254('0x5c')]};}if(_0x4f6877[_0x2254('0x5d')]){_0x141dc5[_0x2254('0x5d')]={'id':_0x4f6877[_0x2254('0x5d')]['id'],'name':_0x4f6877[_0x2254('0x5d')][_0x2254('0xb')]};}_0x13522d[_0x2254('0x5e')](_0x141dc5);}}_0x2f3037({'count':_0x13522d['length'],'rows':_0x13522d});});},'UpdateVoiceQueue':function(_0x41500c){return new Promise(function(_0x1ac370,_0x2c5609){var _0x5cc8fc=_[_0x2254('0x5f')](_0x456612[_0x2254('0x22')],{'id':parseInt(_0x41500c['id'])});var _0x400bb3=_[_0x2254('0x60')](_0x41500c,['id']);if(_0x5cc8fc){for(var _0x2e6603 in _0x400bb3){if(typeof _0x400bb3[_0x2e6603]!==_0x2254('0x61')&&typeof _0x5cc8fc[_0x2e6603]!==_0x2254('0x61')){_0x5cc8fc[_0x2e6603]=_0x400bb3[_0x2e6603];}}_0x1ac370(_0x5cc8fc);}else{_0x2c5609();}});},'VoiceChannels':function(_0x3c685e){return new Promise(function(_0x27eb3b,_0x4fc83c){var _0x239ba0=_[_0x2254('0x62')](_0x456612[_0x2254('0x63')]);_0x27eb3b({'count':_0x239ba0[_0x2254('0x64')],'rows':_0x239ba0});});},'VoiceChannelMixMonitor':function(_0xbbc059){var _0x1a203e=this;return new Promise(function(_0x3396c2,_0x438922){if(ami[_0x2254('0x12')]()==![]){return _0x438922(_0x1a203e[_0x2254('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x2254('0x13')][_0x2254('0x14')],'ami\x20disconnected'][_0x2254('0x16')]('\x20')));}var _0x143bd2=schema(properties[_0x2254('0x65')])[_0x2254('0x3')](_0xbbc059);if(_0x143bd2['length']>0x0){return _0x438922(_0x1a203e[_0x2254('0x1e')](0x1f4,_[_0x2254('0x66')](_0x143bd2,'message')[_0x2254('0x16')](',\x20')));}var _0x3f0670=_[_0x2254('0x5f')](_0x456612[_0x2254('0x63')],{'uniqueid':_0xbbc059['uniqueid']});if(_0x3f0670&&_0x3f0670[_0x2254('0x67')]){var _0x106282=util[_0x2254('0x8')]('%s.%s',_0xbbc059['filename']||_0xbbc059[_0x2254('0x68')],_0xbbc059[_0x2254('0x8')]||'wav');return ami[_0x2254('0x1a')]({'action':'MixMonitor','channel':_0x3f0670['channel'],'file':_0x106282,'options':_0x2254('0x69')})[_0x2254('0x1b')](function(_0x3be0f3){var _0x2bfec4=_[_0x2254('0x5f')](_0x3f0670['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x106282[_0x2254('0x6a')]()});if(_['isNil'](_0x2bfec4)){_0x3f0670[_0x2254('0x6b')][_0x2254('0x5e')]({'filename':_0x2254('0x6c')+_0x106282[_0x2254('0x6a')](),'createdAt':moment()['format'](_0x2254('0x6d')),'mixmonitorid':_0x3be0f3[_0x2254('0x6e')],'status':'rec'});}else{_0x2bfec4['mixmonitorid']=_0x3be0f3[_0x2254('0x6e')];_0x2bfec4['status']=_0x2254('0x6f');}_0x3396c2({'code':0xc8,'message':[_0xbbc059[_0x2254('0x68')],_0x2254('0x70'),_0x3be0f3[_0x2254('0x6e')]][_0x2254('0x16')]('\x20'),'mixmonitorid':_0x3be0f3['mixmonitorid']});})['catch'](function(_0x39b1b1){_0x438922(_0x1a203e['error'](0x1f5,[_0xbbc059[_0x2254('0x68')],_0x39b1b1['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x438922(_0x1a203e[_0x2254('0x1e')](0x1f5,_0x2254('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x1d4b90){var _0x3ea2d9=this;return new Promise(function(_0x13606e,_0x1cf757){if(ami[_0x2254('0x12')]()==![]){return _0x1cf757(_0x3ea2d9[_0x2254('0x1e')](0x1f4,[config[_0x2254('0x13')]['ip'],config[_0x2254('0x13')][_0x2254('0x14')],_0x2254('0x15')][_0x2254('0x16')]('\x20')));}var _0x24e57a=schema(properties[_0x2254('0x65')])[_0x2254('0x3')](_0x1d4b90);if(_0x24e57a[_0x2254('0x64')]>0x0){return _0x1cf757(_0x3ea2d9[_0x2254('0x1e')](0x1f4,_[_0x2254('0x66')](_0x24e57a,'message')[_0x2254('0x16')](',\x20')));}var _0xae171c=_[_0x2254('0x5f')](_0x456612[_0x2254('0x63')],{'uniqueid':_0x1d4b90['uniqueid']});if(_0xae171c){return BPromise['resolve']()[_0x2254('0x1b')](function(){if(_0xae171c[_0x2254('0x67')]){return ami[_0x2254('0x1a')]({'action':_0x2254('0x72'),'channel':_0xae171c[_0x2254('0x67')],'mixmonitorid':_0x1d4b90['mixmonitorid']})[_0x2254('0x1d')](function(_0x2d8a53){});}})[_0x2254('0x1b')](function(){if(_0xae171c['destinationchannel']){return ami['Action']({'action':_0x2254('0x72'),'channel':_0xae171c['destinationchannel'],'mixmonitorid':_0x1d4b90[_0x2254('0x6e')]})[_0x2254('0x1d')](function(_0x5b269d){});}})[_0x2254('0x1b')](function(_0x1b154f){var _0x4d30a5=_[_0x2254('0x5f')](_0xae171c[_0x2254('0x6b')],{'mixmonitorid':_0x1d4b90['mixmonitorid']});if(_0x4d30a5){_0x4d30a5['status']=_0x2254('0x73');}})[_0x2254('0x1b')](function(){var _0x486b82=util['format'](_0x2254('0x74'),_0x1d4b90['filename']||_0x1d4b90[_0x2254('0x68')],_0x1d4b90['format']||_0x2254('0x75'));var _0x7bdd46=_[_0x2254('0x5f')](_0xae171c[_0x2254('0x6b')],{'filename':'/var/spool/asterisk/monitor/'+_0x486b82[_0x2254('0x6a')]()});if(_0x7bdd46){_0x7bdd46['status']=_0x2254('0x73');}})[_0x2254('0x1b')](function(){_0x13606e({'code':0xc8,'message':[_0x1d4b90['uniqueid'],_0x2254('0x76')][_0x2254('0x16')]('\x20')});})['catch'](function(_0x32614f){_0x1cf757(_0x3ea2d9[_0x2254('0x1e')](0x1f5,[_0x1d4b90[_0x2254('0x68')],_0x32614f[_0x2254('0x1c')]['toLowerCase']()][_0x2254('0x16')]('\x20')));});}else{return _0x1cf757(_0x3ea2d9[_0x2254('0x1e')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1ac8ff){return new Promise(function(_0x4469c7,_0x49d611){var _0x242e15=_['values'](_0x456612[_0x2254('0x77')]);_0x4469c7({'count':_0x242e15['length'],'rows':_0x242e15});});},'VoiceQueuesChannel':function(_0x3cbd35){var _0x1f95b2=this;return new Promise(function(_0x5e86d3,_0x334d31){var _0x4c91ec=schema(properties[_0x2254('0x78')])[_0x2254('0x3')](_0x3cbd35);if(_0x4c91ec[_0x2254('0x64')]>0x0){return _0x334d31(_0x1f95b2['error'](0x1f4,_[_0x2254('0x66')](_0x4c91ec,'message')[_0x2254('0x16')](',\x20')));}var _0x33f29b=_['find'](_0x456612['queueChannels'],{'uniqueid':_0x3cbd35[_0x2254('0x68')]});if(_0x33f29b){_0x5e86d3(_0x33f29b);}else{return _0x334d31(_0x1f95b2[_0x2254('0x1e')](0x1f5,_0x2254('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x2861d0){var _0x4969b1=this;return new Promise(function(_0x2a4a5b,_0x6ff8d4){if(ami[_0x2254('0x12')]()==![]){return _0x6ff8d4(_0x4969b1[_0x2254('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x2254('0x13')][_0x2254('0x14')],'ami\x20disconnected'][_0x2254('0x16')]('\x20')));}var _0x5cbdb0=schema(properties[_0x2254('0x79')])['validate'](_0x2861d0);if(_0x5cbdb0['length']>0x0){return _0x6ff8d4(_0x4969b1['error'](0x1f4,_[_0x2254('0x66')](_0x5cbdb0,'message')[_0x2254('0x16')](',\x20')));}var _0x13dba2=_['find'](_0x456612[_0x2254('0x77')],{'uniqueid':_0x2861d0[_0x2254('0x68')]});if(_0x13dba2&&_0x13dba2[_0x2254('0x67')]){return ami[_0x2254('0x1a')]({'action':_0x2254('0x7a'),'channel':_0x13dba2[_0x2254('0x67')]})['then'](function(_0x553ac5){_0x2a4a5b({'code':0xc8,'message':[_0x2861d0[_0x2254('0x68')],_0x553ac5[_0x2254('0x1c')][_0x2254('0x6a')]()][_0x2254('0x16')]('\x20')});})[_0x2254('0x1d')](function(_0x47347f){_0x6ff8d4(_0x4969b1[_0x2254('0x1e')](0x1f5,[_0x2861d0[_0x2254('0x68')],_0x47347f[_0x2254('0x1c')][_0x2254('0x6a')]()]['join']('\x20')));});}else{return _0x6ff8d4(_0x4969b1[_0x2254('0x1e')](0x1f5,_0x2254('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x53cf03){var _0x447e4f=this;return new Promise(function(_0x57fb43,_0x3b9514){if(ami[_0x2254('0x12')]()==![]){return _0x3b9514(_0x447e4f['error'](0x1f4,[config[_0x2254('0x13')]['ip'],config['asterisk'][_0x2254('0x14')],_0x2254('0x15')][_0x2254('0x16')]('\x20')));}var _0x1f7a48=schema(properties['voicequeuechannelredirect'])[_0x2254('0x3')](_0x53cf03);if(_0x1f7a48[_0x2254('0x64')]>0x0){return _0x3b9514(_0x447e4f[_0x2254('0x1e')](0x1f4,_[_0x2254('0x66')](_0x1f7a48,'message')[_0x2254('0x16')](',\x20')));}var _0x480eeb=_['find'](_0x456612[_0x2254('0x77')],{'uniqueid':_0x53cf03[_0x2254('0x68')]});if(_0x480eeb&&_0x480eeb['channel']){return ami['Action']({'action':_0x2254('0x7b'),'channel':_0x480eeb[_0x2254('0x67')],'exten':_0x53cf03[_0x2254('0x7c')],'context':_0x53cf03[_0x2254('0x7d')]||_0x480eeb[_0x2254('0x7d')],'priority':0x1})[_0x2254('0x1b')](function(_0x1a2ec6){_0x57fb43({'code':0xc8,'message':[_0x53cf03[_0x2254('0x68')],_0x1a2ec6[_0x2254('0x1c')]['toLowerCase']()][_0x2254('0x16')]('\x20')});})['catch'](function(_0x181bc7){_0x3b9514(_0x447e4f['error'](0x1f5,[_0x53cf03[_0x2254('0x68')],_0x181bc7[_0x2254('0x1c')][_0x2254('0x6a')]()]['join']('\x20')));});}else{return _0x3b9514(_0x447e4f[_0x2254('0x1e')](0x1f5,_0x2254('0x71')));}});},'Agents':function(_0x13c6f1){return new Promise(function(_0x472758,_0x227e29){var _0x1433e8=_[_0x2254('0x62')](_0x456612[_0x2254('0xe')]);_0x472758({'count':_0x1433e8[_0x2254('0x64')],'rows':_0x1433e8});});},'Telephones':function(_0x146b52){return new Promise(function(_0x25a0aa,_0x46f6bc){var _0x70c30=_['values'](_0x456612[_0x2254('0x7e')]);_0x25a0aa({'count':_0x70c30['length'],'rows':_0x70c30});});},'Trunks':function(_0x64c4f5){return new Promise(function(_0xb98b40,_0x3b1d5c){var _0x2c907a=_[_0x2254('0x62')](_0x456612[_0x2254('0x7f')]);_0xb98b40({'count':_0x2c907a[_0x2254('0x64')],'rows':_0x2c907a});});},'OutboundChannels':function(_0x5b7f24){return new Promise(function(_0x46b528,_0x55a603){var _0x16aa33=_['values'](_0x456612[_0x2254('0x80')]);_0x46b528({'count':_0x16aa33[_0x2254('0x64')],'rows':_0x16aa33});});},'Outbound':function(_0x1d0c8f){return new Promise(function(_0x4a6c9e,_0x435bf7){_0x4a6c9e(_0x456612[_0x2254('0x31')]);});},'Campaigns':function(_0x2c949c){return new Promise(function(_0x14f121,_0x330ad2){var _0x28779b=_[_0x2254('0x62')](_0x456612[_0x2254('0x81')]);_0x14f121({'count':_0x28779b['length'],'rows':_0x28779b});});},'VoiceQueuesPreview':function(_0x56239e){var _0x437d5b=this;return new Promise(function(_0x4d47ae,_0x4470ee){_0x76c902[_0x2254('0x82')](_0x56239e['id'])[_0x2254('0x1b')](function(_0x438c95){_0x4d47ae({'code':0xc8,'message':_0x438c95[_0x2254('0x1c')]});})[_0x2254('0x1d')](function(_0x376b03){_0x4470ee(_0x437d5b['error'](0x1f4,_0x376b03[_0x2254('0x1c')]));});});},'EventManager':function(_0x34ac83){var _0x158e14=this;return new Promise(function(_0x4868fb,_0x3bbb35){if(!_0x34ac83[_0x2254('0x83')]){return _0x3bbb35(_0x158e14[_0x2254('0x1e')](0x1f4,_0x2254('0x84')));}ami[_0x2254('0x85')](_0x2254('0x86')+_0x34ac83[_0x2254('0x83')],_0x34ac83[_0x2254('0x1c')]);_0x4868fb({'code':0xc8,'message':_0x34ac83});});},'FaxAccounts':function(_0x3e4a0e){return new Promise(function(_0x532c14,_0x2cb797){var _0x1ca5bb=_['values'](_0x456612['faxAccounts']);_0x532c14({'count':_0x1ca5bb[_0x2254('0x64')],'rows':_0x1ca5bb});});},'SendFax':function(_0x54339e){var _0x226c19=this;return new Promise(function(_0x10645f,_0x124622){_0x508183[_0x2254('0x87')](_0x54339e)[_0x2254('0x1b')](function(_0x112aa6){_0x10645f({'code':0xc8,'message':_0x112aa6[_0x2254('0x1c')]});})[_0x2254('0x1d')](function(_0x5bf7cf){_0x124622(_0x226c19['error'](0x1f4,_0x5bf7cf[_0x2254('0x1c')]));});});},'CheckAfterSend':function(_0x1cfb9c){var _0x1e8617=this;return new Promise(function(_0x10a939,_0x201da7){_0x508183['checkAfterSend'](_0x1cfb9c)['then'](function(_0x2a1d14){_0x10a939({'code':0xc8,'message':_0x2a1d14['message']});})[_0x2254('0x1d')](function(_0x444f49){_0x201da7(_0x1e8617[_0x2254('0x1e')](0x1f4,_0x444f49[_0x2254('0x1c')]));});});}};var _0x366185=jayson[_0x2254('0x88')](_0x2ee7ee)[_0x2254('0x89')]();_0x366185['on']('error',function(_0x6b716b){return _0xe8ca50(_0x6b716b);});_0x366185[_0x2254('0x7')](0x232a,'127.0.0.1',function(){console[_0x2254('0x8a')](_0x2254('0x8b'),0x232a);return _0x19ad3c(_0x2254('0x8c')+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 ce2b09a..1fb29d7 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 _0xb4e6=['format','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','union','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','Unknown','','destcalleridname','createContact'];(function(_0x337c01,_0x69fa98){var _0x38b0b1=function(_0x5ca2ce){while(--_0x5ca2ce){_0x337c01['push'](_0x337c01['shift']());}};_0x38b0b1(++_0x69fa98);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xb4e6[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0x6b4e('0x0'));var BPromise=require('bluebird');var Redis=require(_0x6b4e('0x1'));var util=require(_0x6b4e('0x2'));var config=require(_0x6b4e('0x3'));var logger=require(_0x6b4e('0x4'))(_0x6b4e('0x5'));var cmContactRpc=require(_0x6b4e('0x6'));config[_0x6b4e('0x7')]=_['defaults'](config[_0x6b4e('0x7')],{'host':_0x6b4e('0x8'),'port':0x18eb});var io=require(_0x6b4e('0x9'))(new Redis(config['redis']));function emit(_0xd3138f,_0x570346,_0x4f00be,_0x2311d9,_0x48c870){logger['info'](_0x6b4e('0xa'),_0xd3138f,_0x570346['id'],_0x4f00be,_0x2311d9,JSON[_0x6b4e('0xb')](_0x48c870));io['to'](_0x4f00be)[_0x6b4e('0xc')](_0x2311d9,_0x48c870);}exports[_0x6b4e('0xd')]=function(_0x14cf84,_0x46cbe1,_0x323487,_0x49c734){var _0x39b4ec,_0x3bba86;var _0x58c67d={};var _0x2a4d0f=Number(_0x323487[_0x6b4e('0xe')]);var _0x432399=_0x323487[_0x6b4e('0xf')]?Boolean(Number(_0x323487[_0x6b4e('0xf')])):![];var _0xa3d358;var _0x1db513=![];if(!_['isNil'](_0x323487[_0x6b4e('0x10')])){if(_0x323487[_0x6b4e('0x10')]=='1')_0x1db513=!![];}if(!_0x1db513){if(_0x49c734['xmd-contactid']){_0x58c67d['id']=_0x49c734[_0x6b4e('0x11')];}}if(!_0x58c67d['id']){_0x58c67d['ListId']=_0x2a4d0f;_0xa3d358=_0x323487[_0x6b4e('0x12')]&&_0x323487[_0x6b4e('0x12')]!=='0'?_0x323487[_0x6b4e('0x12')][_0x6b4e('0x13')](','):[_0x6b4e('0x14')];_0x58c67d[_0x6b4e('0x15')]=_['map'](_0xa3d358,function(_0x5775f4){var _0x67496d={};_0x67496d[_0x5775f4]=_0x49c734[_0x6b4e('0x16')]?_0x49c734[_0x6b4e('0x17')]:_0x49c734[_0x6b4e('0x18')];return _0x67496d;});}var _0x101d0a=['id',_0x6b4e('0x19'),_0x6b4e('0x1a'),_0x6b4e('0x14'),_0x6b4e('0x1b'),_0x6b4e('0x1c'),_0x6b4e('0x1d'),'createdAt',_0x6b4e('0x1e'),_0x6b4e('0x1f')];var _0x31fb9d=_[_0x6b4e('0x20')](_0x101d0a,_0xa3d358);BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc['getContacts']({'attributes':_0x31fb9d,'where':_0x58c67d}))[_0x6b4e('0x21')](function(_0x163dea){_0x3bba86=_0x163dea;if(!_[_0x6b4e('0x22')](_0x3bba86)){if(_0x3bba86[_0x6b4e('0x23')]===0x1){_0x39b4ec=_0x3bba86[0x0];logger[_0x6b4e('0x24')](_0x6b4e('0x25'),_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}else{logger['info'](_0x6b4e('0x27'),_0x49c734['uniqueid'],_0x46cbe1['id'],_[_0x6b4e('0x28')](_0x3bba86,'id')[_0x6b4e('0x29')](','));}return;}else{logger[_0x6b4e('0x24')](_0x6b4e('0x2a'),_0x49c734['uniqueid'],_0x46cbe1['id']);var _0xec7d35={'ListId':_0x2a4d0f};var _0x3f72d7=_0x323487['data4']&&_0x323487[_0x6b4e('0x2b')]!=='0'?_0x323487[_0x6b4e('0x2b')]:_0x6b4e('0x14');if(_0x432399){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734['routeId'])?_0x49c734[_0x6b4e('0x18')]:_0x49c734[_0x6b4e('0x17')];if(_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])){_0xec7d35['firstName']=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==''?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734['destcalleridname']&&_0x49c734['destcalleridname']!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}return BPromise['resolve']()[_0x6b4e('0x21')](cmContactRpc[_0x6b4e('0x31')](_0xec7d35))[_0x6b4e('0x21')](function(_0x5c1444){_0x39b4ec=_0x5c1444;_0x3bba86['push'](_0x5c1444);if(_0x39b4ec){logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id'],_0x39b4ec['id']);}return;});}else{logger[_0x6b4e('0x24')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x49c734[_0x6b4e('0x26')],_0x46cbe1['id']);_0xec7d35[_0x3f72d7]=_[_0x6b4e('0x2c')](_0x49c734[_0x6b4e('0x16')])?_0x49c734[_0x6b4e('0x18')]:_0x49c734['destcalleridnum'];if(_['isNil'](_0x49c734[_0x6b4e('0x16')])){_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x2d')]&&_0x49c734[_0x6b4e('0x2d')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x2d')]:_0x6b4e('0x2e');}else{_0xec7d35[_0x6b4e('0x19')]=_0x49c734[_0x6b4e('0x30')]&&_0x49c734[_0x6b4e('0x30')]!==_0x6b4e('0x2f')?_0x49c734[_0x6b4e('0x30')]:_0x6b4e('0x2e');}_0x39b4ec=_0xec7d35;_0x3bba86['push'](_0xec7d35);return;}}})[_0x6b4e('0x21')](function(){if(_0x14cf84){emit(_0x49c734[_0x6b4e('0x26')],_0x46cbe1,util[_0x6b4e('0x32')]('user:%s',_0x14cf84[_0x6b4e('0x33')]),util['format'](_0x6b4e('0x34'),_0x323487[_0x6b4e('0x35')][_0x6b4e('0x36')]()),{'evt':_['merge'](_0x49c734,{'autoCreate':_0x432399}),'contact':_0x39b4ec===undefined?{}:_0x39b4ec,'contacts':_0x3bba86['length']===0x0?undefined:_0x3bba86});}});}; \ No newline at end of file +var _0xb821=['routeId','destcalleridnum','calleridname','Unknown','destcalleridname','','push','format','name','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','../../../../config/logger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','map','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xb821,0xa7));var _0x1b82=function(_0x21609e,_0x38c98b){_0x21609e=_0x21609e-0x0;var _0x5559b4=_0xb821[_0x21609e];return _0x5559b4;};'use strict';var _=require('lodash');var BPromise=require(_0x1b82('0x0'));var Redis=require(_0x1b82('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x1b82('0x2'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x1b82('0x3')]=_[_0x1b82('0x4')](config[_0x1b82('0x3')],{'host':_0x1b82('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1b82('0x3')]));function emit(_0x192434,_0x202a5f,_0x3632dd,_0x18f45f,_0x7b87e8){logger[_0x1b82('0x6')](_0x1b82('0x7'),_0x192434,_0x202a5f['id'],_0x3632dd,_0x18f45f,JSON[_0x1b82('0x8')](_0x7b87e8));io['to'](_0x3632dd)['emit'](_0x18f45f,_0x7b87e8);}exports[_0x1b82('0x9')]=function(_0x30c6ee,_0x44dfd4,_0x14c57a,_0xcffb87){var _0x17a96b,_0x739f99;var _0x1ce719={};var _0x5f521f=Number(_0x14c57a[_0x1b82('0xa')]);var _0x241d11=_0x14c57a[_0x1b82('0xb')]?Boolean(Number(_0x14c57a[_0x1b82('0xb')])):![];var _0x50aed7;var _0x1a6285=![];if(!_['isNil'](_0x14c57a['data5'])){if(_0x14c57a[_0x1b82('0xc')]=='1')_0x1a6285=!![];}if(!_0x1a6285){if(_0xcffb87['xmd-contactid']){_0x1ce719['id']=_0xcffb87[_0x1b82('0xd')];}}if(!_0x1ce719['id']){_0x1ce719[_0x1b82('0xe')]=_0x5f521f;_0x50aed7=_0x14c57a['data3']&&_0x14c57a[_0x1b82('0xf')]!=='0'?_0x14c57a['data3']['split'](','):[_0x1b82('0x10')];_0x1ce719['$or']=_[_0x1b82('0x11')](_0x50aed7,function(_0x25228b){var _0xf42818={};_0xf42818[_0x25228b]=_0xcffb87['routeId']?_0xcffb87['destcalleridnum']:_0xcffb87[_0x1b82('0x12')];return _0xf42818;});}var _0x5d66c3=['id',_0x1b82('0x13'),_0x1b82('0x14'),_0x1b82('0x10'),'mobile',_0x1b82('0x15'),_0x1b82('0xe'),_0x1b82('0x16'),_0x1b82('0x17'),_0x1b82('0x18')];var _0x47e99b=_[_0x1b82('0x19')](_0x5d66c3,_0x50aed7);BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc[_0x1b82('0x1c')]({'attributes':_0x47e99b,'where':_0x1ce719}))[_0x1b82('0x1b')](function(_0x31fd64){_0x739f99=_0x31fd64;if(!_[_0x1b82('0x1d')](_0x739f99)){if(_0x739f99['length']===0x1){_0x17a96b=_0x739f99[0x0];logger[_0x1b82('0x6')](_0x1b82('0x1e'),_0xcffb87['uniqueid'],_0x44dfd4['id'],_0x17a96b['id']);}else{logger[_0x1b82('0x6')](_0x1b82('0x1f'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_['map'](_0x739f99,'id')[_0x1b82('0x21')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0xcffb87['uniqueid'],_0x44dfd4['id']);var _0xf2e556={'ListId':_0x5f521f};var _0x149d0f=_0x14c57a[_0x1b82('0x22')]&&_0x14c57a[_0x1b82('0x22')]!=='0'?_0x14c57a['data4']:_0x1b82('0x10');if(_0x241d11){logger[_0x1b82('0x6')](_0x1b82('0x23'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87[_0x1b82('0x12')]:_0xcffb87[_0x1b82('0x26')];if(_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])){_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==''?_0xcffb87[_0x1b82('0x27')]:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==_0x1b82('0x2a')?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}return BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc['createContact'](_0xf2e556))[_0x1b82('0x1b')](function(_0x29a31e){_0x17a96b=_0x29a31e;_0x739f99[_0x1b82('0x2b')](_0x29a31e);if(_0x17a96b){logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_0x17a96b['id']);}return;});}else{logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87['calleridnum']:_0xcffb87['destcalleridnum'];if(_[_0x1b82('0x24')](_0xcffb87['routeId'])){_0xf2e556['firstName']=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==_0x1b82('0x2a')?_0xcffb87['calleridname']:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==''?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}_0x17a96b=_0xf2e556;_0x739f99[_0x1b82('0x2b')](_0xf2e556);return;}}})['then'](function(){if(_0x30c6ee){emit(_0xcffb87['uniqueid'],_0x44dfd4,util[_0x1b82('0x2c')]('user:%s',_0x30c6ee[_0x1b82('0x2d')]),util[_0x1b82('0x2c')](_0x1b82('0x2e'),_0x14c57a[_0x1b82('0x2f')][_0x1b82('0x30')]()),{'evt':_[_0x1b82('0x31')](_0xcffb87,{'autoCreate':_0x241d11}),'contact':_0x17a96b===undefined?{}:_0x17a96b,'contacts':_0x739f99[_0x1b82('0x32')]===0x0?undefined:_0x739f99});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 680347c..54aa43e 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 _0xabae=['format','user:%s','interface','name','trigger:%s:%s','jscripty','trigger:%s','exec','routeId','urlforward','script','parse','query','search','replace','checkTrigger','channel','length','every','AllConditions','checkConditions','AnyConditions','some','field','account','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','exports','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','socket.io-emitter','popup','winapp','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','undefined','motionChannel','voice','checkTriggers','triggers','hasOwnProperty','status','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','render','templates','html','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','data6','600','winApplication','winArguments'];(function(_0x276cc5,_0xcf0153){var _0x546b89=function(_0x132abc){while(--_0x132abc){_0x276cc5['push'](_0x276cc5['shift']());}};_0x546b89(++_0xcf0153);}(_0xabae,0x1a1));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0xeaba('0x0'));var Mustache=require(_0xeaba('0x1'));var Redis=require(_0xeaba('0x2'));var urlforward=require(_0xeaba('0x3'));var integration=require(_0xeaba('0x4'));var cmContact=require(_0xeaba('0x5'));var script=require(_0xeaba('0x6'));var config=require(_0xeaba('0x7'));var logger=require(_0xeaba('0x8'))(_0xeaba('0x9'));var ami=require(_0xeaba('0xa'));config[_0xeaba('0xb')]=_['defaults'](config[_0xeaba('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xeaba('0xc'))(new Redis(config[_0xeaba('0xb')]));var operators={'equals':function(_0x4dd1db,_0x259bef){return _0x4dd1db==_0x259bef;},'not_equals':function(_0x3053ba,_0x35d9f7){return _0x3053ba!=_0x35d9f7;}};var barAndWebActions=[_0xeaba('0xd'),_0xeaba('0x0'),_0xeaba('0xe')];function Trigger(_0xe71880){this['triggers']=_0xe71880['triggers'];this[_0xeaba('0xf')]=_0xe71880[_0xeaba('0xf')];this[_0xeaba('0x10')]=_0xe71880[_0xeaba('0x10')];this['templates']=_0xe71880['templates'];this[_0xeaba('0x11')]=_0xe71880[_0xeaba('0x11')];this[_0xeaba('0x12')]=_0xe71880[_0xeaba('0x12')];this[_0xeaba('0x13')]=_0xe71880[_0xeaba('0x13')];this['salesforceAccounts']=_0xe71880[_0xeaba('0x14')];this[_0xeaba('0x15')]=_0xe71880[_0xeaba('0x15')];this['zohoAccounts']=_0xe71880[_0xeaba('0x16')];this[_0xeaba('0x17')]=_0xe71880[_0xeaba('0x17')];this[_0xeaba('0x18')]=_0xe71880[_0xeaba('0x18')];this['servicenowAccounts']=_0xe71880[_0xeaba('0x19')];this[_0xeaba('0x1a')]=_0xe71880[_0xeaba('0x1a')];this[_0xeaba('0x1b')]=_0xe71880[_0xeaba('0x1b')];this[_0xeaba('0x1c')]={'zendesk':this[_0xeaba('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0xeaba('0x17')],'vtiger':this[_0xeaba('0x18')],'dynamics365':this[_0xeaba('0x1a')],'freshsales':this[_0xeaba('0x1b')],'servicenow':this[_0xeaba('0x19')]};ami['on'](_0xeaba('0x1d'),this['syncCustomEvent'][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x1f'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x21'),this[_0xeaba('0x20')]['bind'](this));ami['on'](_0xeaba('0x22'),this[_0xeaba('0x20')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x23'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on']('custom:agentbusy',this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x24'),this['syncCustomEvent'][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x25'),this[_0xeaba('0x20')]['bind'](this));ami['on']('custom:amd',this[_0xeaba('0x20')]['bind'](this));ami['on'](_0xeaba('0x26'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x27'),this[_0xeaba('0x20')]['bind'](this));ami['on'](_0xeaba('0x28'),this[_0xeaba('0x29')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x2a'),this['syncAgentDial'][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x2b'),this['syncAgentDial'][_0xeaba('0x1e')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0xeaba('0x1e')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x2c'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x2d'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));ami['on'](_0xeaba('0x2e'),this[_0xeaba('0x20')]['bind'](this));ami['on'](_0xeaba('0x2f'),this[_0xeaba('0x20')]['bind'](this));ami['on'](_0xeaba('0x30'),this[_0xeaba('0x20')][_0xeaba('0x1e')](this));}Trigger['prototype'][_0xeaba('0x31')]=function(_0x32610a,_0x4ad749,_0x3d00d1){logger[_0xeaba('0x32')](_0x32610a,_0x4ad749,JSON[_0xeaba('0x33')](_0x3d00d1));io['to'](_0x32610a)['emit'](_0x4ad749,_0x3d00d1);};Trigger[_0xeaba('0x34')][_0xeaba('0x20')]=function(_0x4578d9){var _0x1f16e5=_[_0xeaba('0x35')](_0x4578d9);if(typeof _0x1f16e5['motionChannel']===_0xeaba('0x36')){_0x1f16e5[_0xeaba('0x37')]=_0xeaba('0x38');}this[_0xeaba('0x39')](_0x1f16e5);};Trigger[_0xeaba('0x34')]['syncAgentDial']=function(_0x5c7666){if(this[_0xeaba('0xf')][_0x5c7666['interface']]){this[_0xeaba('0x20')](_0x5c7666);}};Trigger[_0xeaba('0x34')][_0xeaba('0x39')]=function(_0x52fafe){var _0x4cd647;for(var _0x40a557 in this['triggers']){if(this[_0xeaba('0x3a')][_0xeaba('0x3b')](_0x40a557)){if(this[_0xeaba('0x3a')][_0x40a557][_0xeaba('0x3c')]){_0x4cd647=this['checkTrigger'](this[_0xeaba('0x3a')][_0x40a557],_0x52fafe);if(_0x4cd647){_[_0xeaba('0x3d')](_0x52fafe,_0x52fafe[_0xeaba('0x3e')]);for(var _0x481f0c=0x0,_0x54b287,_0x1c6d51,_0xc759b;_0x481f0c0x0){_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 +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','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','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x76e91a,_0x4035cc){var _0x2d5ab7=function(_0x526573){while(--_0x526573){_0x76e91a['push'](_0x76e91a['shift']());}};_0x2d5ab7(++_0x4035cc);}(_0x814b,0x1a2));var _0xb814=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x814b[_0x1e081a];return _0x428209;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index a43c392..18f717e 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 _0x0ec0=['serverUrl','stripTrailingSlash','unmanaged','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20created!','type','nameField','customField','idField','substring','indexOf','content','ticketType','incidents','assign','getString','/contacts(','phonecall','phonecalls','Subjects','Descriptions','queue','callDirection','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url'];(function(_0x198290,_0x1ab307){var _0x582b38=function(_0x3ea2d7){while(--_0x3ea2d7){_0x198290['push'](_0x198290['shift']());}};_0x582b38(++_0x1ab307);}(_0x0ec0,0x197));var _0x00ec=function(_0x7fd20b,_0x440d27){_0x7fd20b=_0x7fd20b-0x0;var _0x1b94d8=_0x0ec0[_0x7fd20b];return _0x1b94d8;};'use strict';var _=require('lodash');var BPromise=require(_0x00ec('0x0'));var rp=require(_0x00ec('0x1'));var util=require('util');var intUtil=require(_0x00ec('0x2'));var md5=require(_0x00ec('0x3'));var Redis=require('ioredis');var logger=require(_0x00ec('0x4'))(_0x00ec('0x5'));var config=require(_0x00ec('0x6'));config[_0x00ec('0x7')]=_[_0x00ec('0x8')](config[_0x00ec('0x7')],{'host':_0x00ec('0x9'),'port':0x18eb});var io=require(_0x00ec('0xa'))(new Redis(config[_0x00ec('0x7')]));function getAuthToken(_0x51996c,_0x26dc52,_0x363ac5){var _0x455a71={'method':'POST','uri':_0x26dc52,'form':{'client_id':_0x51996c['clientId'],'resource':_0x51996c[_0x00ec('0xb')],'username':_0x51996c[_0x00ec('0xc')],'password':_0x51996c[_0x00ec('0xd')],'grant_type':_0x00ec('0xd'),'client_secret':_0x51996c[_0x00ec('0xe')]},'json':!![]};return rp(_0x455a71)['then'](function(_0x27aa0d){return _0x27aa0d[_0x00ec('0xf')];})[_0x00ec('0x10')](function(_0x9665e8){logger[_0x00ec('0x11')]('['+[_0x363ac5[_0x00ec('0x12')]()]+_0x00ec('0x13'));return _0x9665e8['message'];});}function getUser(_0x2d13ef,_0x35c37e,_0x2982e3,_0x3ffde4,_0x610fef,_0x5d0c5d){return new BPromise(function(_0x27ea46,_0x3d2021){return getAuthToken(_0x35c37e,_0x3ffde4,_0x5d0c5d)[_0x00ec('0x14')](function(_0x4ccf18){var _0x4368e8={'method':_0x00ec('0x15'),'uri':_0x610fef+_0x00ec('0x16'),'headers':{'Authorization':_0x00ec('0x17')+_0x4ccf18,'OData-Version':_0x00ec('0x18')},'json':!![]};return rp(_0x4368e8);})[_0x00ec('0x14')](function(_0x5de842){var _0x3a01df=_0x5de842[_0x00ec('0x19')];var _0x19ebe9=![];var _0x3d9326=null;if(!_[_0x00ec('0x1a')](_0x2982e3)){if(intUtil[_0x00ec('0x1b')](_0x2982e3[_0x00ec('0x1c')])){_0x2d13ef[_0x00ec('0x1d')]=_0x2982e3[_0x00ec('0x1c')];for(_0x3d9326=0x0;_0x3d9326<_0x3a01df[_0x00ec('0x1e')];_0x3d9326++){if(_0x3a01df[_0x3d9326]['internalemailaddress']===_0x2982e3[_0x00ec('0x1c')]&&!_0x3a01df[_0x3d9326]['isdisabled']){_0x19ebe9=!![];logger[_0x00ec('0x1f')]('['+[_0x5d0c5d['toUpperCase']()]+_0x00ec('0x20')+_0x3a01df[_0x3d9326][_0x00ec('0x21')]+'!');_0x2d13ef[_0x00ec('0x22')]=_0x3a01df[_0x3d9326][_0x00ec('0x21')];}}}}if(!_0x19ebe9){logger[_0x00ec('0x1f')]('['+[_0x5d0c5d['toUpperCase']()]+_0x00ec('0x23'));_0x2d13ef[_0x00ec('0x1d')]=_0x35c37e[_0x00ec('0xc')];for(_0x3d9326=0x0;_0x3d9326<_0x3a01df[_0x00ec('0x1e')];_0x3d9326++){if(_0x3a01df[_0x3d9326][_0x00ec('0x24')]===_0x35c37e['username']){_0x2d13ef[_0x00ec('0x22')]=_0x3a01df[_0x3d9326][_0x00ec('0x21')];}}}_0x27ea46(_0x2d13ef);})[_0x00ec('0x10')](function(_0x13bfb2){_0x3d2021(_0x13bfb2[_0x00ec('0x25')]);});});}function createEndUser(_0x59ae81,_0xaf7527,_0x24581c,_0x1e8f83,_0x2017b9,_0x45d9c1){return new BPromise(function(_0x14c74e,_0x5e8d43){return getAuthToken(_0xaf7527,_0x24581c,_0x45d9c1)[_0x00ec('0x14')](function(_0x68e5b4){var _0xe21c48=_0x45d9c1[_0x00ec('0x26')]()===_0x00ec('0x27')?_0x2017b9['destcalleridnum']:_0x2017b9[_0x00ec('0x28')];var _0x54b430={'method':_0x00ec('0x29'),'uri':_0x1e8f83+_0x00ec('0x2a'),'body':{'telephone1':_0xe21c48,'fullname':_0xe21c48,'firstname':_0xe21c48,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x00ec('0x2b')+_0x59ae81[_0x00ec('0x22')]+')'},'headers':{'Authorization':_0x00ec('0x17')+_0x68e5b4,'OData-Version':_0x00ec('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x54b430);})['then'](function(_0x25dc1e){var _0x5b87bc=_0x25dc1e[_0x00ec('0x2c')][_0x00ec('0x2d')];var _0x44f719=_0x5b87bc['substring'](_0x5b87bc[_0x00ec('0x2e')]('(')+0x1,_0x5b87bc['lastIndexOf'](')'));_0x59ae81[_0x00ec('0x2f')]=_0x44f719;_0x14c74e(_0x59ae81);})[_0x00ec('0x10')](function(_0x2ed332){_0x5e8d43(_0x2ed332[_0x00ec('0x25')]);});});}function getEndUser(_0x4b33be,_0x5f5a21,_0x4eb7b8,_0x4e60e6,_0x46b8e4,_0x1538c8){return new BPromise(function(_0xdf8205,_0x32a207){var _0x55451=_0x1538c8['toLowerCase']()===_0x00ec('0x27')?_0x46b8e4[_0x00ec('0x30')]:_0x46b8e4['calleridnum'];return getAuthToken(_0x5f5a21,_0x4eb7b8,_0x1538c8)[_0x00ec('0x14')](function(_0x2ad89e){var _0x3876be={'method':_0x00ec('0x15'),'uri':_0x4e60e6+_0x00ec('0x31')+_0x55451[_0x00ec('0x32')]('+',_0x00ec('0x33'))+'\x27','headers':{'Authorization':_0x00ec('0x17')+_0x2ad89e,'If-None-Match':null,'OData-Version':_0x00ec('0x18')},'json':!![]};return rp(_0x3876be);})[_0x00ec('0x14')](function(_0x542b3e){var _0x47d49f=null;if(_0x542b3e){var _0x1fde9c=_0x542b3e[_0x00ec('0x19')];var _0x1f84f6=![];for(_0x47d49f=0x0;_0x47d49f<_0x1fde9c[_0x00ec('0x1e')];_0x47d49f++){if(_0x1fde9c[_0x47d49f]['telephone1']===_0x55451){_0x1f84f6=!![];_0x4b33be[_0x00ec('0x2f')]=_0x1fde9c[_0x47d49f][_0x00ec('0x34')];}}if(_0x1f84f6){_0xdf8205(_0x4b33be);}else{return createEndUser(_0x4b33be,_0x5f5a21,_0x4eb7b8,_0x4e60e6,_0x46b8e4,_0x1538c8)[_0x00ec('0x14')](function(_0xae4d2d){logger[_0x00ec('0x1f')]('['+[_0x1538c8[_0x00ec('0x12')]()]+_0x00ec('0x35'),_0xae4d2d[_0x00ec('0x2f')]);_0xdf8205(_0xae4d2d);});}}else{return createEndUser(_0x4b33be,_0x5f5a21,_0x4eb7b8,_0x4e60e6,_0x46b8e4,_0x1538c8)[_0x00ec('0x14')](function(_0x2c62ff){logger['info']('['+[_0x1538c8['toUpperCase']()]+']\x20Enduser\x20Created!',_0x2c62ff[_0x00ec('0x2f')]);_0xdf8205(_0x2c62ff);});}});});}function getCustomFields(_0xfcf8e6,_0x4719dc,_0x367f46){var _0x47db33={};if(_0xfcf8e6[_0x00ec('0x1e')]>0x0){_['forEach'](_0xfcf8e6,function(_0x2e22e1){if(_['includes'](['string','picklist'],_0x2e22e1[_0x00ec('0x36')])&&_0x2e22e1[_0x00ec('0x37')]&&!_0x2e22e1[_0x00ec('0x38')]){var _0x20cbf1=_0x2e22e1[_0x00ec('0x39')][_0x00ec('0x26')]();var _0x1e8db4=_0x20cbf1[_0x00ec('0x3a')](0x0,_0x20cbf1[_0x00ec('0x3b')]('_'));var _0x459f7b=_0x20cbf1[_0x00ec('0x3a')](_0x20cbf1[_0x00ec('0x3b')]('_')+0x1);if(_0x1e8db4===_0x367f46){_0x47db33[_0x459f7b]=_0x2e22e1[_0x00ec('0x3c')];}}});}return _0x47db33;}function getTicket(_0x892992,_0x164f0c,_0x56767a,_0x4602f6,_0x2bdabf,_0x292360,_0x3711a2){return new BPromise(function(_0x2f388c,_0x271b63){var _0x41cf9d;return getAuthToken(_0x164f0c,_0x56767a,_0x3711a2)[_0x00ec('0x14')](function(_0x4b575a){if(_0x292360[_0x00ec('0x3d')]==='incident'){_0x41cf9d={'method':_0x00ec('0x29'),'uri':_0x4602f6+_0x00ec('0x3e'),'body':Object[_0x00ec('0x3f')]({},{'title':intUtil['getString'](_0x292360['Subjects'],_0x2bdabf,'\x20'),'description':intUtil[_0x00ec('0x40')](_0x292360['Descriptions'],_0x2bdabf,'\x0a'),'customerid_contact@odata.bind':_0x00ec('0x41')+_0x892992['enduserId']+')','ownerid@odata.bind':_0x00ec('0x2b')+_0x892992[_0x00ec('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x292360['Fields'],_0x2bdabf,_0x292360[_0x00ec('0x3d')])),'headers':{'Authorization':_0x00ec('0x17')+_0x4b575a,'OData-Version':_0x00ec('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x292360[_0x00ec('0x3d')]===_0x00ec('0x42')){_0x41cf9d={'method':_0x00ec('0x29'),'uri':_0x4602f6+_0x00ec('0x43'),'body':Object[_0x00ec('0x3f')]({},{'subject':intUtil[_0x00ec('0x40')](_0x292360[_0x00ec('0x44')],_0x2bdabf,'\x20'),'phonenumber':String(_0x2bdabf[_0x00ec('0x28')]),'description':intUtil['getString'](_0x292360[_0x00ec('0x45')],_0x2bdabf,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x892992[_0x00ec('0x2f')]+')','ownerid@odata.bind':_0x00ec('0x2b')+_0x892992[_0x00ec('0x22')]+')','directioncode':_0x892992['callDirection']===_0x00ec('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x00ec('0x2b')+_0x892992[_0x00ec('0x22')]+')','participationtypemask':_0x892992['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x892992[_0x00ec('0x2f')]+')','participationtypemask':_0x892992[_0x00ec('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x292360[_0x00ec('0x48')],_0x2bdabf,_0x292360[_0x00ec('0x3d')])),'headers':{'Authorization':_0x00ec('0x17')+_0x4b575a,'OData-Version':_0x00ec('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x41cf9d);})[_0x00ec('0x14')](function(_0x47a246){var _0xc848c3=_0x47a246[_0x00ec('0x2c')][_0x00ec('0x2d')];var _0x23add0=_0xc848c3[_0x00ec('0x3a')](_0xc848c3[_0x00ec('0x2e')]('(')+0x1,_0xc848c3[_0x00ec('0x2e')](')'));_0x892992[_0x00ec('0x49')]=_0x23add0;_0x2f388c(_0x892992);})[_0x00ec('0x10')](function(_0xdb609b){_0x271b63(_0xdb609b[_0x00ec('0x25')]);});});}function emit(_0x5dbfcd,_0x48c64f,_0x5d20f9,_0x596dbd){var _0x25d952={'uri':util['format'](_0x00ec('0x4a'),_0x5dbfcd,_0x5d20f9,_0x596dbd)};io['to'](util[_0x00ec('0x4b')](_0x00ec('0x4c'),_0x48c64f))['emit'](_0x00ec('0x4d'),_0x25d952);}exports['cs']=function(_0x4bb4ef,_0x16740d,_0x147190,_0x4462dd,_0x296bc5,_0x4b0fea,_0x443e84,_0x1510eb){var _0x51978f={};_0x4b0fea[_0x00ec('0xb')]=intUtil['stripTrailingSlash'](_0x4b0fea['remoteUri']);_0x4b0fea[_0x00ec('0x4e')]=intUtil[_0x00ec('0x4f')](_0x4b0fea[_0x00ec('0x4e')]);_0x51978f[_0x00ec('0x47')]=_0x1510eb==='queue'||_0x1510eb===_0x00ec('0x50')?_0x00ec('0x46'):_0x00ec('0x27');var _0x278d95=util['format']('%s/api/data/v9.0/',_0x4b0fea[_0x00ec('0xb')]);var _0xa2ae0a=util[_0x00ec('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4b0fea[_0x00ec('0x51')]);var _0x380fc8=util[_0x00ec('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b0fea[_0x00ec('0x4e')],_0x16740d['uniqueid'],md5(_0x16740d[_0x00ec('0x52')]));if(_0x296bc5&&_0x296bc5[_0x00ec('0x53')]){logger[_0x00ec('0x1f')](_0x00ec('0x54'),_0x00ec('0x55'));_0x16740d[_0x00ec('0x56')]=_0x380fc8;}else if(_0x443e84&&_0x443e84[_0x00ec('0x57')]&&_0x443e84[_0x00ec('0x57')]!==_0x00ec('0x58')){logger[_0x00ec('0x1f')](_0x00ec('0x59'),_0x00ec('0x55'));_0x16740d[_0x00ec('0x56')]=_0x380fc8;}else{_0x16740d[_0x00ec('0x56')]='';}return getUser(_0x51978f,_0x4b0fea,_0x4462dd,_0xa2ae0a,_0x278d95,_0x1510eb)[_0x00ec('0x14')](function(_0x44a845){logger[_0x00ec('0x1f')]('['+_0x1510eb[_0x00ec('0x12')]()+_0x00ec('0x5a'),_0x44a845['userId']);logger[_0x00ec('0x1f')]('['+_0x1510eb['toUpperCase']()+_0x00ec('0x5b'),_0x44a845['userEmail']);return getEndUser(_0x44a845,_0x4b0fea,_0xa2ae0a,_0x278d95,_0x16740d,_0x1510eb);})['then'](function(_0xc06d80){logger['info']('['+_0x1510eb[_0x00ec('0x12')]()+_0x00ec('0x5c'),_0xc06d80['enduserId']);logger[_0x00ec('0x1f')]('['+_0x1510eb[_0x00ec('0x12')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x16740d[_0x00ec('0x28')]);return getTicket(_0xc06d80,_0x4b0fea,_0xa2ae0a,_0x278d95,_0x16740d,_0x147190,_0x1510eb);})['then'](function(_0x5cbc90){logger[_0x00ec('0x1f')](util[_0x00ec('0x4b')]('['+_0x1510eb[_0x00ec('0x12')]()+_0x00ec('0x5d'),_0x147190[_0x00ec('0x3d')],_0x5cbc90[_0x00ec('0x49')]));logger['info'](util[_0x00ec('0x4b')]('['+_0x1510eb['toUpperCase']()+_0x00ec('0x5e'),_0x1510eb));if(_0x1510eb!==_0x00ec('0x50')){logger[_0x00ec('0x1f')]('['+_0x1510eb['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4b0fea['remoteUri'],_0x4462dd[_0x00ec('0x5f')],_0x147190[_0x00ec('0x3d')],_0x5cbc90[_0x00ec('0x49')]);}})[_0x00ec('0x10')](function(_0x579215){logger['error']('['+_0x1510eb[_0x00ec('0x12')]()+_0x00ec('0x60'),util['inspect'](_0x579215,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf1a0=['nameField','customField','idField','indexOf','content','incidents','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','queue','callDirection','ticketId','format','emit','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','replace','%2b','value','telephone1',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0xf1a0,0x1a2));var _0x0f1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1a0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x0f1a('0x0'));var util=require(_0x0f1a('0x1'));var intUtil=require('./util');var md5=require(_0x0f1a('0x2'));var Redis=require(_0x0f1a('0x3'));var logger=require(_0x0f1a('0x4'))(_0x0f1a('0x5'));var config=require(_0x0f1a('0x6'));config[_0x0f1a('0x7')]=_[_0x0f1a('0x8')](config['redis'],{'host':_0x0f1a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x9d6f12,_0x52ed6e,_0x5dd791){var _0x50904b={'method':_0x0f1a('0xa'),'uri':_0x52ed6e,'form':{'client_id':_0x9d6f12[_0x0f1a('0xb')],'resource':_0x9d6f12[_0x0f1a('0xc')],'username':_0x9d6f12[_0x0f1a('0xd')],'password':_0x9d6f12[_0x0f1a('0xe')],'grant_type':'password','client_secret':_0x9d6f12['clientSecret']},'json':!![]};return rp(_0x50904b)['then'](function(_0x2490c6){return _0x2490c6[_0x0f1a('0xf')];})[_0x0f1a('0x10')](function(_0x13b680){logger['error']('['+[_0x5dd791[_0x0f1a('0x11')]()]+_0x0f1a('0x12'));return _0x13b680[_0x0f1a('0x13')];});}function getUser(_0x142032,_0x3f0a52,_0x3d4a3c,_0x1d5ff1,_0x4a24f8,_0x5a822c){return new BPromise(function(_0x113873,_0x202194){return getAuthToken(_0x3f0a52,_0x1d5ff1,_0x5a822c)[_0x0f1a('0x14')](function(_0x4e3edc){var _0x24d1ab={'method':_0x0f1a('0x15'),'uri':_0x4a24f8+_0x0f1a('0x16'),'headers':{'Authorization':_0x0f1a('0x17')+_0x4e3edc,'OData-Version':_0x0f1a('0x18')},'json':!![]};return rp(_0x24d1ab);})[_0x0f1a('0x14')](function(_0x14f753){var _0x557ac5=_0x14f753['value'];var _0x531fa4=![];var _0x16f43d=null;if(!_[_0x0f1a('0x19')](_0x3d4a3c)){if(intUtil[_0x0f1a('0x1a')](_0x3d4a3c[_0x0f1a('0x1b')])){_0x142032[_0x0f1a('0x1c')]=_0x3d4a3c['email'];for(_0x16f43d=0x0;_0x16f43d<_0x557ac5['length'];_0x16f43d++){if(_0x557ac5[_0x16f43d][_0x0f1a('0x1d')]===_0x3d4a3c[_0x0f1a('0x1b')]&&!_0x557ac5[_0x16f43d]['isdisabled']){_0x531fa4=!![];logger[_0x0f1a('0x1e')]('['+[_0x5a822c[_0x0f1a('0x11')]()]+_0x0f1a('0x1f')+_0x557ac5[_0x16f43d][_0x0f1a('0x20')]+'!');_0x142032[_0x0f1a('0x21')]=_0x557ac5[_0x16f43d][_0x0f1a('0x20')];}}}}if(!_0x531fa4){logger['info']('['+[_0x5a822c[_0x0f1a('0x11')]()]+_0x0f1a('0x22'));_0x142032['userEmail']=_0x3f0a52[_0x0f1a('0xd')];for(_0x16f43d=0x0;_0x16f43d<_0x557ac5[_0x0f1a('0x23')];_0x16f43d++){if(_0x557ac5[_0x16f43d][_0x0f1a('0x1d')]===_0x3f0a52[_0x0f1a('0xd')]){_0x142032[_0x0f1a('0x21')]=_0x557ac5[_0x16f43d][_0x0f1a('0x20')];}}}_0x113873(_0x142032);})[_0x0f1a('0x10')](function(_0x239082){_0x202194(_0x239082[_0x0f1a('0x13')]);});});}function createEndUser(_0x4ea750,_0x25fd63,_0x138f87,_0x4615dd,_0x4eef02,_0x31dcea){return new BPromise(function(_0x901ade,_0x32a0c9){return getAuthToken(_0x25fd63,_0x138f87,_0x31dcea)[_0x0f1a('0x14')](function(_0x17e90f){var _0x3d9b39=_0x31dcea['toLowerCase']()===_0x0f1a('0x24')?_0x4eef02[_0x0f1a('0x25')]:_0x4eef02[_0x0f1a('0x26')];var _0x5dcaed={'method':_0x0f1a('0xa'),'uri':_0x4615dd+_0x0f1a('0x27'),'body':{'telephone1':_0x3d9b39,'fullname':_0x3d9b39,'firstname':_0x3d9b39,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0f1a('0x28')+_0x4ea750[_0x0f1a('0x21')]+')'},'headers':{'Authorization':_0x0f1a('0x17')+_0x17e90f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5dcaed);})[_0x0f1a('0x14')](function(_0x4b240e){var _0x4f812e=_0x4b240e[_0x0f1a('0x29')][_0x0f1a('0x2a')];var _0x37d083=_0x4f812e[_0x0f1a('0x2b')](_0x4f812e['lastIndexOf']('(')+0x1,_0x4f812e[_0x0f1a('0x2c')](')'));_0x4ea750[_0x0f1a('0x2d')]=_0x37d083;_0x901ade(_0x4ea750);})[_0x0f1a('0x10')](function(_0x5b1ec8){_0x32a0c9(_0x5b1ec8['message']);});});}function getEndUser(_0x4db7cb,_0x5f304c,_0x4f4b1c,_0x3dbacd,_0x502fd9,_0xc864d3){return new BPromise(function(_0x4d6316,_0x48c99b){var _0x32f0b0=_0xc864d3[_0x0f1a('0x2e')]()===_0x0f1a('0x24')?_0x502fd9[_0x0f1a('0x25')]:_0x502fd9[_0x0f1a('0x26')];return getAuthToken(_0x5f304c,_0x4f4b1c,_0xc864d3)['then'](function(_0x20db0d){var _0x18886f={'method':_0x0f1a('0x15'),'uri':_0x3dbacd+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x32f0b0[_0x0f1a('0x2f')]('+',_0x0f1a('0x30'))+'\x27','headers':{'Authorization':_0x0f1a('0x17')+_0x20db0d,'If-None-Match':null,'OData-Version':_0x0f1a('0x18')},'json':!![]};return rp(_0x18886f);})[_0x0f1a('0x14')](function(_0x1bd94b){var _0x4b9d0e=null;if(_0x1bd94b){var _0x333c3f=_0x1bd94b[_0x0f1a('0x31')];var _0x54db64=![];for(_0x4b9d0e=0x0;_0x4b9d0e<_0x333c3f['length'];_0x4b9d0e++){if(_0x333c3f[_0x4b9d0e][_0x0f1a('0x32')]===_0x32f0b0){_0x54db64=!![];_0x4db7cb[_0x0f1a('0x2d')]=_0x333c3f[_0x4b9d0e]['contactid'];}}if(_0x54db64){_0x4d6316(_0x4db7cb);}else{return createEndUser(_0x4db7cb,_0x5f304c,_0x4f4b1c,_0x3dbacd,_0x502fd9,_0xc864d3)[_0x0f1a('0x14')](function(_0x569d08){logger[_0x0f1a('0x1e')]('['+[_0xc864d3['toUpperCase']()]+']\x20Enduser\x20created!',_0x569d08[_0x0f1a('0x2d')]);_0x4d6316(_0x569d08);});}}else{return createEndUser(_0x4db7cb,_0x5f304c,_0x4f4b1c,_0x3dbacd,_0x502fd9,_0xc864d3)[_0x0f1a('0x14')](function(_0x1a7bcf){logger['info']('['+[_0xc864d3[_0x0f1a('0x11')]()]+_0x0f1a('0x33'),_0x1a7bcf[_0x0f1a('0x2d')]);_0x4d6316(_0x1a7bcf);});}});});}function getCustomFields(_0x459969,_0x3c7aa7,_0x550c3b){var _0x184826={};if(_0x459969[_0x0f1a('0x23')]>0x0){_[_0x0f1a('0x34')](_0x459969,function(_0x2dedde){if(_[_0x0f1a('0x35')]([_0x0f1a('0x36'),_0x0f1a('0x37')],_0x2dedde[_0x0f1a('0x38')])&&_0x2dedde[_0x0f1a('0x39')]&&!_0x2dedde[_0x0f1a('0x3a')]){var _0x23b809=_0x2dedde[_0x0f1a('0x3b')][_0x0f1a('0x2e')]();var _0x496006=_0x23b809['substring'](0x0,_0x23b809[_0x0f1a('0x3c')]('_'));var _0x4a2eec=_0x23b809['substring'](_0x23b809[_0x0f1a('0x3c')]('_')+0x1);if(_0x496006===_0x550c3b){_0x184826[_0x4a2eec]=_0x2dedde[_0x0f1a('0x3d')];}}});}return _0x184826;}function getTicket(_0x16f296,_0x58c216,_0x142e5d,_0x44f3c5,_0x1cce49,_0x339c40,_0x5342ae){return new BPromise(function(_0x4e0a5c,_0x2df6a9){var _0x37ef10;return getAuthToken(_0x58c216,_0x142e5d,_0x5342ae)['then'](function(_0x332bae){if(_0x339c40['ticketType']==='incident'){_0x37ef10={'method':_0x0f1a('0xa'),'uri':_0x44f3c5+_0x0f1a('0x3e'),'body':Object['assign']({},{'title':intUtil[_0x0f1a('0x3f')](_0x339c40[_0x0f1a('0x40')],_0x1cce49,'\x20'),'description':intUtil[_0x0f1a('0x3f')](_0x339c40[_0x0f1a('0x41')],_0x1cce49,'\x0a'),'customerid_contact@odata.bind':_0x0f1a('0x42')+_0x16f296['enduserId']+')','ownerid@odata.bind':_0x0f1a('0x28')+_0x16f296['userId']+')','caseorigincode':'1'},getCustomFields(_0x339c40[_0x0f1a('0x43')],_0x1cce49,_0x339c40[_0x0f1a('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x332bae,'OData-Version':_0x0f1a('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x339c40[_0x0f1a('0x44')]===_0x0f1a('0x45')){_0x37ef10={'method':_0x0f1a('0xa'),'uri':_0x44f3c5+_0x0f1a('0x46'),'body':Object['assign']({},{'subject':intUtil[_0x0f1a('0x3f')](_0x339c40[_0x0f1a('0x40')],_0x1cce49,'\x20'),'phonenumber':String(_0x1cce49[_0x0f1a('0x26')]),'description':intUtil[_0x0f1a('0x3f')](_0x339c40[_0x0f1a('0x41')],_0x1cce49,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0f1a('0x42')+_0x16f296[_0x0f1a('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x16f296['userId']+')','directioncode':_0x16f296['callDirection']===_0x0f1a('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x16f296[_0x0f1a('0x21')]+')','participationtypemask':_0x16f296[_0x0f1a('0x48')]===_0x0f1a('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x0f1a('0x42')+_0x16f296[_0x0f1a('0x2d')]+')','participationtypemask':_0x16f296[_0x0f1a('0x48')]===_0x0f1a('0x47')?0x1:0x2}]},getCustomFields(_0x339c40[_0x0f1a('0x43')],_0x1cce49,_0x339c40[_0x0f1a('0x44')])),'headers':{'Authorization':_0x0f1a('0x17')+_0x332bae,'OData-Version':_0x0f1a('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37ef10);})[_0x0f1a('0x14')](function(_0xed755d){var _0x420c57=_0xed755d['headers']['odata-entityid'];var _0x401d4a=_0x420c57[_0x0f1a('0x2b')](_0x420c57[_0x0f1a('0x2c')]('(')+0x1,_0x420c57[_0x0f1a('0x2c')](')'));_0x16f296[_0x0f1a('0x49')]=_0x401d4a;_0x4e0a5c(_0x16f296);})[_0x0f1a('0x10')](function(_0x2b2f75){_0x2df6a9(_0x2b2f75[_0x0f1a('0x13')]);});});}function emit(_0x593e35,_0x3663ca,_0x3ec12e,_0x121a69){var _0x1049ad={'uri':util[_0x0f1a('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x593e35,_0x3ec12e,_0x121a69)};io['to'](util[_0x0f1a('0x4a')]('user:%s',_0x3663ca))[_0x0f1a('0x4b')]('trigger:browser:url',_0x1049ad);}exports['cs']=function(_0x384469,_0x3f9519,_0x21109c,_0x3a3f25,_0xc37cfc,_0x100f1c,_0x142f33,_0x8ede21){var _0x37f06a={};_0x100f1c[_0x0f1a('0xc')]=intUtil['stripTrailingSlash'](_0x100f1c['remoteUri']);_0x100f1c[_0x0f1a('0x4c')]=intUtil[_0x0f1a('0x4d')](_0x100f1c[_0x0f1a('0x4c')]);_0x37f06a[_0x0f1a('0x48')]=_0x8ede21===_0x0f1a('0x47')||_0x8ede21===_0x0f1a('0x4e')?_0x0f1a('0x47'):_0x0f1a('0x24');var _0x406e43=util['format'](_0x0f1a('0x4f'),_0x100f1c[_0x0f1a('0xc')]);var _0x295de5=util[_0x0f1a('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x100f1c[_0x0f1a('0x50')]);var _0x36c2bb=util['format'](_0x0f1a('0x51'),_0x100f1c[_0x0f1a('0x4c')],_0x3f9519[_0x0f1a('0x52')],md5(_0x3f9519[_0x0f1a('0x52')]));if(_0xc37cfc&&_0xc37cfc['monitor_format']){logger[_0x0f1a('0x1e')](_0x0f1a('0x53'),'Recording\x20is\x20enabled!');_0x3f9519['recordingURL']=_0x36c2bb;}else if(_0x142f33&&_0x142f33[_0x0f1a('0x54')]&&_0x142f33[_0x0f1a('0x54')]!=='none'){logger['info'](_0x0f1a('0x55'),_0x0f1a('0x56'));_0x3f9519['recordingURL']=_0x36c2bb;}else{_0x3f9519[_0x0f1a('0x57')]='';}return getUser(_0x37f06a,_0x100f1c,_0x3a3f25,_0x295de5,_0x406e43,_0x8ede21)['then'](function(_0x429c36){logger['info']('['+_0x8ede21[_0x0f1a('0x11')]()+']\x20The\x20User\x20ID\x20is:',_0x429c36[_0x0f1a('0x21')]);logger[_0x0f1a('0x1e')]('['+_0x8ede21[_0x0f1a('0x11')]()+_0x0f1a('0x58'),_0x429c36[_0x0f1a('0x1c')]);return getEndUser(_0x429c36,_0x100f1c,_0x295de5,_0x406e43,_0x3f9519,_0x8ede21);})['then'](function(_0x26c514){logger['info']('['+_0x8ede21[_0x0f1a('0x11')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x26c514['enduserId']);logger[_0x0f1a('0x1e')]('['+_0x8ede21[_0x0f1a('0x11')]()+_0x0f1a('0x59'),_0x3f9519['calleridnum']);return getTicket(_0x26c514,_0x100f1c,_0x295de5,_0x406e43,_0x3f9519,_0x21109c,_0x8ede21);})['then'](function(_0x428f7a){logger[_0x0f1a('0x1e')](util['format']('['+_0x8ede21[_0x0f1a('0x11')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x21109c[_0x0f1a('0x44')],_0x428f7a['ticketId']));logger[_0x0f1a('0x1e')](util['format']('['+_0x8ede21[_0x0f1a('0x11')]()+_0x0f1a('0x5a'),_0x8ede21));if(_0x8ede21!=='unmanaged'){logger[_0x0f1a('0x1e')]('['+_0x8ede21[_0x0f1a('0x11')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x100f1c['remoteUri'],_0x3a3f25[_0x0f1a('0x5b')],_0x21109c['ticketType'],_0x428f7a[_0x0f1a('0x49')]);}})[_0x0f1a('0x10')](function(_0x2b2e16){logger[_0x0f1a('0x5c')]('['+_0x8ede21[_0x0f1a('0x11')]()+_0x0f1a('0x5d'),util[_0x0f1a('0x5e')](_0x2b2e16,{'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 fb22936..b6932de 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 _0x11f1=['getString','Subjects','Descriptions','Tags','name','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','error','unmanaged','monitor_format','calleridname','lastevent','lodash','request-promise','md5','util','defaults','localhost','socket.io-emitter','application/json','info','merge','format','Caller\x20-\x20%s','calleridnum'];(function(_0x4b6b39,_0x370e70){var _0x241292=function(_0x12d04b){while(--_0x12d04b){_0x4b6b39['push'](_0x4b6b39['shift']());}};_0x241292(++_0x370e70);}(_0x11f1,0x157));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x111f('0x0'));var rp=require(_0x111f('0x1'));var md5=require(_0x111f('0x2'));var util=require(_0x111f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x111f('0x4')](config['redis'],{'host':_0x111f('0x5'),'port':0x18eb});var io=require(_0x111f('0x6'))(new Redis(config['redis']));var headers={'Content-Type':_0x111f('0x7'),'Accept':_0x111f('0x7')};function emit(_0x4f57e2,_0x1068de,_0x1a0dde){io['to'](_0x4f57e2)['emit'](_0x1068de,_0x1a0dde);}function getTicket(_0x3d6b4f,_0x5bbb0e,_0x10494e,_0x45103b,_0x3df8d0){logger[_0x111f('0x8')]('Creating\x20new\x20ticket...');var _0x3a311a=_[_0x111f('0x9')]({'responder_id':_0x5bbb0e['id'],'requester_id':_0x10494e['id'],'name':util[_0x111f('0xa')](_0x111f('0xb'),_0x3df8d0['calleridname']),'phone':_0x3df8d0[_0x111f('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x111f('0xd')](_0x45103b[_0x111f('0xe')],_0x3df8d0,'\x20'),'description':intUtil['getString'](_0x45103b[_0x111f('0xf')],_0x3df8d0,'
'),'tags':getTags(_0x45103b[_0x111f('0x10')],_0x111f('0x11'))},getCustomFields(_0x45103b[_0x111f('0x12')],_0x3df8d0));_0x3a311a['custom_fields']=_['mapValues'](_[_0x111f('0x13')](_0x3a311a[_0x111f('0x14')],'id'),_0x111f('0x15'));return request({'uri':util['format'](_0x111f('0x16'),_0x3d6b4f[_0x111f('0x17')]),'method':_0x111f('0x18'),'body':_0x3a311a})[_0x111f('0x19')](function(_0xeb85ae){logger['info'](_0x111f('0x1a'));return _0xeb85ae;});}function getUser(_0xc9f9fe,_0x5d08df){if(intUtil[_0x111f('0x1b')](_0x5d08df)){return request({'uri':util[_0x111f('0xa')](_0x111f('0x1c'),_0xc9f9fe[_0x111f('0x17')]),'qs':{'email':_0x5d08df}})[_0x111f('0x19')](function(_0x178d64){if(_0x178d64['length']){logger[_0x111f('0x8')](_0x111f('0x1d'));return _[_0x111f('0x1e')](_0x178d64,function(_0x119324){return _0x119324[_0x111f('0x1f')][_0x111f('0x20')]===_0x5d08df;});}else{logger['info'](_0x111f('0x21'));return request({'uri':util[_0x111f('0xa')](_0x111f('0x22'),_0xc9f9fe[_0x111f('0x17')])})[_0x111f('0x19')](function(_0x3142b7){logger[_0x111f('0x8')]('Admin\x20account\x20selected.');return _0x3142b7;});}});}else{logger[_0x111f('0x8')](_0x111f('0x23'));return request({'uri':util[_0x111f('0xa')](_0x111f('0x22'),_0xc9f9fe[_0x111f('0x17')])})[_0x111f('0x19')](function(_0x2b30b9){logger[_0x111f('0x8')](_0x111f('0x24'));return _0x2b30b9;});}}function getEndUser(_0x4b722a,_0x203eb2,_0x36cb37){logger[_0x111f('0x8')](_0x111f('0x25'),_0x36cb37);return request({'uri':util[_0x111f('0xa')](_0x111f('0x26'),_0x4b722a[_0x111f('0x17')]),'qs':{'phone':_0x36cb37}})[_0x111f('0x19')](function(_0x25bd95){if(_0x25bd95[_0x111f('0x27')]){logger[_0x111f('0x8')](_0x111f('0x28'));return _['find'](_0x25bd95,{'phone':_0x36cb37});}else{logger[_0x111f('0x8')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x111f('0xa')]('%s/api/v2/contacts',_0x4b722a[_0x111f('0x17')]),'method':_0x111f('0x18'),'body':{'name':_0x203eb2,'phone':_0x36cb37}})[_0x111f('0x19')](function(_0x226c93){logger[_0x111f('0x8')](_0x111f('0x29'));return _0x226c93;});}});}function getAuth(_0x8a4d0c){return util['format'](_0x111f('0x2a'),new Buffer(_0x8a4d0c['apiKey']+':X')[_0x111f('0x2b')](_0x111f('0x2c')));}function request(_0x79e68b){logger[_0x111f('0x2d')](_0x111f('0x2e'),JSON[_0x111f('0x2f')](_0x79e68b));return rp(_['defaults'](_0x79e68b,{'method':_0x111f('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x629fc,_0x1e4209){var _0x5d700e=[];if(_0x629fc&&_0x629fc['length']>0x0){_0x5d700e=_['map'](_0x629fc,_0x1e4209);}return _0x5d700e;}function getCustomFields(_0x103ef0,_0x1b5bd8){var _0x1b1279=[];var _0x42fb00={'custom_fields':[]};if(_0x103ef0[_0x111f('0x27')]>0x0){_[_0x111f('0x31')](_0x103ef0,function(_0x4b1a0b){if(_[_0x111f('0x32')]([_0x111f('0x33'),_0x111f('0x34')],_0x4b1a0b[_0x111f('0x35')])&&_0x4b1a0b[_0x111f('0x36')]&&!_0x4b1a0b[_0x111f('0x37')]){_0x42fb00[_0x4b1a0b[_0x111f('0x36')][_0x111f('0x38')]()]=_0x4b1a0b[_0x111f('0x39')][_0x111f('0x2b')]();}else if(_['includes'](['string',_0x111f('0x34')],_0x4b1a0b['type'])&&_0x4b1a0b[_0x111f('0x3a')]&&_0x4b1a0b['customField']){_0x42fb00[_0x111f('0x14')][_0x111f('0x3b')]({'id':_0x4b1a0b[_0x111f('0x3a')],'value':_0x4b1a0b['content'][_0x111f('0x2b')]()});}else if(_0x4b1a0b['type']===_0x111f('0x3c')&&_0x4b1a0b['variableName']&&_0x4b1a0b['idField']&&_0x4b1a0b[_0x111f('0x37')]){_0x1b5bd8[_0x4b1a0b[_0x111f('0x3d')]]&&_0x42fb00[_0x111f('0x14')][_0x111f('0x3b')]({'id':_0x4b1a0b[_0x111f('0x3a')],'value':_0x1b5bd8[_0x4b1a0b[_0x111f('0x3d')]][_0x111f('0x2b')]()});}else if(_0x4b1a0b[_0x111f('0x35')]===_0x111f('0x3e')&&_0x4b1a0b[_0x111f('0x3f')]&&_0x4b1a0b[_0x111f('0x3f')]['name']&&_0x4b1a0b[_0x111f('0x3a')]&&_0x4b1a0b[_0x111f('0x37')]){_0x1b5bd8[_0x4b1a0b[_0x111f('0x3f')][_0x111f('0x11')][_0x111f('0x38')]()]&&_0x42fb00[_0x111f('0x14')][_0x111f('0x3b')]({'id':_0x4b1a0b[_0x111f('0x3a')],'value':_0x1b5bd8[_0x4b1a0b[_0x111f('0x3f')]['name']['toLowerCase']()]['toString']()});}});}return _0x42fb00;}exports['queue']=function(_0x482cf6,_0x5cd005,_0x481600,_0x37adc8,_0x2d3038,_0x40caaf){var _0x1af35e,_0x434bc0;_0x40caaf[_0x111f('0x17')]=intUtil[_0x111f('0x40')](_0x40caaf[_0x111f('0x17')]);_0x40caaf[_0x111f('0x41')]=intUtil['stripTrailingSlash'](_0x40caaf[_0x111f('0x41')]);if(_0x2d3038&&_0x2d3038['monitor_format']){logger['info']('[QUEUE]',_0x111f('0x42'));_0x5cd005[_0x111f('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40caaf[_0x111f('0x41')],_0x5cd005['uniqueid'],md5(_0x5cd005[_0x111f('0x44')]));}else{_0x5cd005[_0x111f('0x43')]='';}headers[_0x111f('0x45')]=getAuth(_0x40caaf);return getUser(_0x40caaf,_0x37adc8['email'])[_0x111f('0x19')](function(_0x23ca63){_0x1af35e=_0x23ca63;logger[_0x111f('0x8')](_0x111f('0x46'),_0x1af35e['id']);return getEndUser(_0x40caaf,_0x5cd005['calleridname'],_0x5cd005['calleridnum']);})['then'](function(_0x4c500d){_0x434bc0=_0x4c500d;logger[_0x111f('0x8')]('The\x20Enduser\x20ID\x20is:',_0x434bc0['id']);return getTicket(_0x40caaf,_0x1af35e,_0x434bc0,_0x481600,_0x5cd005);})['then'](function(_0x2dadc7){if(_0x2dadc7&&_0x2dadc7['id']){logger[_0x111f('0x8')](_0x111f('0x1a'));logger[_0x111f('0x8')]('The\x20Ticket\x20ID\x20is:',_0x2dadc7['id']);logger[_0x111f('0x8')](_0x111f('0x47'),_0x111f('0x48'));emit(util[_0x111f('0xa')](_0x111f('0x49'),_0x37adc8[_0x111f('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x111f('0x4a'),_0x40caaf[_0x111f('0x17')],_0x2dadc7['id'])});}})[_0x111f('0x4b')](function(_0x45960){logger['error'](_0x111f('0x47'),JSON['stringify'](_0x45960));});};exports[_0x111f('0x4c')]=function(_0x2cdb99,_0x3c6788,_0x35a501,_0x2588a3,_0x4f98a7,_0x57f1cc,_0x4e5785){var _0x22f9ad,_0x50ed12;_0x57f1cc['remoteUri']=intUtil[_0x111f('0x40')](_0x57f1cc[_0x111f('0x17')]);_0x57f1cc[_0x111f('0x41')]=intUtil[_0x111f('0x40')](_0x57f1cc[_0x111f('0x41')]);if(_0x4e5785&&_0x4e5785['recordingFormat']&&_0x4e5785[_0x111f('0x4d')]!=='none'){logger[_0x111f('0x8')](_0x111f('0x4e'),_0x111f('0x42'));_0x3c6788['recordingURL']=util['format'](_0x111f('0x4f'),_0x57f1cc[_0x111f('0x41')],_0x3c6788['uniqueid'],md5(_0x3c6788[_0x111f('0x44')]));}headers['Authorization']=getAuth(_0x57f1cc);return getUser(_0x57f1cc,_0x2588a3['email'])[_0x111f('0x19')](function(_0x5aeb4f){_0x22f9ad=_0x5aeb4f;logger[_0x111f('0x8')](_0x111f('0x46'),_0x22f9ad['id']);return getEndUser(_0x57f1cc,_0x3c6788[_0x111f('0x50')],_0x3c6788[_0x111f('0x51')]);})['then'](function(_0x546c50){_0x50ed12=_0x546c50;logger[_0x111f('0x8')]('The\x20Enduser\x20ID\x20is:',_0x50ed12['id']);return getTicket(_0x57f1cc,_0x22f9ad,_0x50ed12,_0x35a501,_0x3c6788);})[_0x111f('0x19')](function(_0x3fd1ce){if(_0x3fd1ce&&_0x3fd1ce['id']){logger[_0x111f('0x8')]('Ticket\x20created!');logger[_0x111f('0x8')](_0x111f('0x52'),_0x3fd1ce['id']);logger[_0x111f('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x111f('0xa')]('user:%s',_0x2588a3['name']),_0x111f('0x53'),{'uri':util[_0x111f('0xa')]('%s/helpdesk/tickets/%d',_0x57f1cc[_0x111f('0x17')],_0x3fd1ce['id'])});}})[_0x111f('0x4b')](function(_0x393398){logger[_0x111f('0x54')](_0x111f('0x4e'),JSON[_0x111f('0x2f')](_0x393398));});};exports[_0x111f('0x55')]=function(_0x215bfd,_0x4577dd,_0x53aff4,_0x174dce,_0x4598a5,_0x136675){var _0x4c8096,_0x422e49;_0x136675[_0x111f('0x17')]=intUtil[_0x111f('0x40')](_0x136675[_0x111f('0x17')]);_0x136675[_0x111f('0x41')]=intUtil['stripTrailingSlash'](_0x136675[_0x111f('0x41')]);if(_0x4598a5&&_0x4598a5[_0x111f('0x56')]){logger[_0x111f('0x8')]('['+_0x4577dd['lastevent']['toUpperCase']()+']',_0x111f('0x42'));_0x4577dd[_0x111f('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x136675['serverUrl'],_0x4577dd[_0x111f('0x44')],md5(_0x4577dd['uniqueid']));}else{_0x4577dd[_0x111f('0x43')]='';}headers[_0x111f('0x45')]=getAuth(_0x136675);return getUser(_0x136675,'')[_0x111f('0x19')](function(_0x4c1469){_0x4c8096=_0x4c1469;logger[_0x111f('0x8')]('The\x20User\x20ID\x20is:',_0x4c8096['id']);return getEndUser(_0x136675,_0x4577dd[_0x111f('0x57')],_0x4577dd['calleridnum']);})[_0x111f('0x19')](function(_0x20ed0c){_0x422e49=_0x20ed0c;logger[_0x111f('0x8')]('The\x20Enduser\x20ID\x20is:',_0x422e49['id']);return getTicket(_0x136675,_0x4c8096,_0x422e49,_0x53aff4,_0x4577dd);})[_0x111f('0x19')](function(_0x55fc7c){if(_0x55fc7c){logger[_0x111f('0x8')](_0x111f('0x1a'));logger[_0x111f('0x8')](_0x111f('0x52'),_0x55fc7c['id']);}})[_0x111f('0x4b')](function(_0x458d04){logger['error']('['+_0x4577dd[_0x111f('0x58')]['toUpperCase']()+']',JSON['stringify'](_0x458d04));});}; \ No newline at end of file +var _0xddcc=['base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','content','variable','variableName','push','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','toString'];(function(_0x11ec27,_0x1373bc){var _0x16882f=function(_0x5e3218){while(--_0x5e3218){_0x11ec27['push'](_0x11ec27['shift']());}};_0x16882f(++_0x1373bc);}(_0xddcc,0x148));var _0xcddc=function(_0x528fef,_0x4726a5){_0x528fef=_0x528fef-0x0;var _0x5e8b5e=_0xddcc[_0x528fef];return _0x5e8b5e;};'use strict';var _=require(_0xcddc('0x0'));var rp=require('request-promise');var md5=require(_0xcddc('0x1'));var util=require(_0xcddc('0x2'));var Redis=require(_0xcddc('0x3'));var intUtil=require(_0xcddc('0x4'));var config=require(_0xcddc('0x5'));var logger=require(_0xcddc('0x6'))(_0xcddc('0x7'));config[_0xcddc('0x8')]=_['defaults'](config[_0xcddc('0x8')],{'host':_0xcddc('0x9'),'port':0x18eb});var io=require(_0xcddc('0xa'))(new Redis(config[_0xcddc('0x8')]));var headers={'Content-Type':_0xcddc('0xb'),'Accept':'application/json'};function emit(_0x335aed,_0x24092d,_0x4dd7cd){io['to'](_0x335aed)[_0xcddc('0xc')](_0x24092d,_0x4dd7cd);}function getTicket(_0x30fc94,_0x11cc1,_0x24e6ce,_0x1476e8,_0x489076){logger['info'](_0xcddc('0xd'));var _0x4e983d=_[_0xcddc('0xe')]({'responder_id':_0x11cc1['id'],'requester_id':_0x24e6ce['id'],'name':util[_0xcddc('0xf')](_0xcddc('0x10'),_0x489076[_0xcddc('0x11')]),'phone':_0x489076[_0xcddc('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcddc('0x13')](_0x1476e8[_0xcddc('0x14')],_0x489076,'\x20'),'description':intUtil[_0xcddc('0x13')](_0x1476e8[_0xcddc('0x15')],_0x489076,_0xcddc('0x16')),'tags':getTags(_0x1476e8['Tags'],_0xcddc('0x17'))},getCustomFields(_0x1476e8[_0xcddc('0x18')],_0x489076));_0x4e983d['custom_fields']=_[_0xcddc('0x19')](_['keyBy'](_0x4e983d[_0xcddc('0x1a')],'id'),_0xcddc('0x1b'));return request({'uri':util['format'](_0xcddc('0x1c'),_0x30fc94[_0xcddc('0x1d')]),'method':_0xcddc('0x1e'),'body':_0x4e983d})[_0xcddc('0x1f')](function(_0x2b1085){logger[_0xcddc('0x20')](_0xcddc('0x21'));return _0x2b1085;});}function getUser(_0x95f578,_0x21673f){if(intUtil[_0xcddc('0x22')](_0x21673f)){return request({'uri':util[_0xcddc('0xf')](_0xcddc('0x23'),_0x95f578[_0xcddc('0x1d')]),'qs':{'email':_0x21673f}})[_0xcddc('0x1f')](function(_0x3f53b9){if(_0x3f53b9[_0xcddc('0x24')]){logger[_0xcddc('0x20')](_0xcddc('0x25'));return _[_0xcddc('0x26')](_0x3f53b9,function(_0x18b871){return _0x18b871[_0xcddc('0x27')][_0xcddc('0x28')]===_0x21673f;});}else{logger[_0xcddc('0x20')](_0xcddc('0x29'));return request({'uri':util['format'](_0xcddc('0x2a'),_0x95f578[_0xcddc('0x1d')])})['then'](function(_0x480cc0){logger[_0xcddc('0x20')](_0xcddc('0x2b'));return _0x480cc0;});}});}else{logger[_0xcddc('0x20')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcddc('0xf')](_0xcddc('0x2a'),_0x95f578[_0xcddc('0x1d')])})[_0xcddc('0x1f')](function(_0x271642){logger[_0xcddc('0x20')](_0xcddc('0x2b'));return _0x271642;});}}function getEndUser(_0x107b45,_0xb9b493,_0x4178b3){logger['info'](_0xcddc('0x2c'),_0x4178b3);return request({'uri':util[_0xcddc('0xf')](_0xcddc('0x2d'),_0x107b45['remoteUri']),'qs':{'phone':_0x4178b3}})['then'](function(_0x2479f7){if(_0x2479f7[_0xcddc('0x24')]){logger[_0xcddc('0x20')]('Enduser\x20found!');return _['find'](_0x2479f7,{'phone':_0x4178b3});}else{logger[_0xcddc('0x20')](_0xcddc('0x2e'));return request({'uri':util[_0xcddc('0xf')](_0xcddc('0x2d'),_0x107b45[_0xcddc('0x1d')]),'method':_0xcddc('0x1e'),'body':{'name':_0xb9b493,'phone':_0x4178b3}})[_0xcddc('0x1f')](function(_0x4e5662){logger[_0xcddc('0x20')]('Enduser\x20created.');return _0x4e5662;});}});}function getAuth(_0x49b762){return util[_0xcddc('0xf')]('Basic\x20%s',new Buffer(_0x49b762['apiKey']+':X')[_0xcddc('0x2f')](_0xcddc('0x30')));}function request(_0x5373f2){logger[_0xcddc('0x31')](_0xcddc('0x32'),JSON[_0xcddc('0x33')](_0x5373f2));return rp(_['defaults'](_0x5373f2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4cc12d,_0x382cee){var _0x3d38fb=[];if(_0x4cc12d&&_0x4cc12d[_0xcddc('0x24')]>0x0){_0x3d38fb=_[_0xcddc('0x34')](_0x4cc12d,_0x382cee);}return _0x3d38fb;}function getCustomFields(_0x206376,_0x3fcb06){var _0x4513ca=[];var _0x101224={'custom_fields':[]};if(_0x206376[_0xcddc('0x24')]>0x0){_[_0xcddc('0x35')](_0x206376,function(_0x3ab38c){if(_[_0xcddc('0x36')]([_0xcddc('0x37'),_0xcddc('0x38')],_0x3ab38c[_0xcddc('0x39')])&&_0x3ab38c[_0xcddc('0x3a')]&&!_0x3ab38c[_0xcddc('0x3b')]){_0x101224[_0x3ab38c[_0xcddc('0x3a')][_0xcddc('0x3c')]()]=_0x3ab38c['content'][_0xcddc('0x2f')]();}else if(_['includes']([_0xcddc('0x37'),'picklist'],_0x3ab38c[_0xcddc('0x39')])&&_0x3ab38c[_0xcddc('0x3d')]&&_0x3ab38c['customField']){_0x101224[_0xcddc('0x1a')]['push']({'id':_0x3ab38c['idField'],'value':_0x3ab38c[_0xcddc('0x3e')]['toString']()});}else if(_0x3ab38c['type']===_0xcddc('0x3f')&&_0x3ab38c[_0xcddc('0x40')]&&_0x3ab38c[_0xcddc('0x3d')]&&_0x3ab38c['customField']){_0x3fcb06[_0x3ab38c[_0xcddc('0x40')]]&&_0x101224['custom_fields'][_0xcddc('0x41')]({'id':_0x3ab38c[_0xcddc('0x3d')],'value':_0x3fcb06[_0x3ab38c[_0xcddc('0x40')]][_0xcddc('0x2f')]()});}else if(_0x3ab38c[_0xcddc('0x39')]===_0xcddc('0x42')&&_0x3ab38c['Variable']&&_0x3ab38c['Variable'][_0xcddc('0x17')]&&_0x3ab38c['idField']&&_0x3ab38c['customField']){_0x3fcb06[_0x3ab38c[_0xcddc('0x43')][_0xcddc('0x17')][_0xcddc('0x3c')]()]&&_0x101224[_0xcddc('0x1a')][_0xcddc('0x41')]({'id':_0x3ab38c['idField'],'value':_0x3fcb06[_0x3ab38c[_0xcddc('0x43')][_0xcddc('0x17')]['toLowerCase']()][_0xcddc('0x2f')]()});}});}return _0x101224;}exports[_0xcddc('0x44')]=function(_0x14f046,_0x20e7fc,_0x2074cb,_0x1a03c1,_0x344f77,_0x324b75){var _0x80bef,_0x5a0e6f;_0x324b75['remoteUri']=intUtil['stripTrailingSlash'](_0x324b75[_0xcddc('0x1d')]);_0x324b75[_0xcddc('0x45')]=intUtil[_0xcddc('0x46')](_0x324b75[_0xcddc('0x45')]);if(_0x344f77&&_0x344f77[_0xcddc('0x47')]){logger[_0xcddc('0x20')]('[QUEUE]',_0xcddc('0x48'));_0x20e7fc['recordingURL']=util['format'](_0xcddc('0x49'),_0x324b75[_0xcddc('0x45')],_0x20e7fc['uniqueid'],md5(_0x20e7fc['uniqueid']));}else{_0x20e7fc[_0xcddc('0x4a')]='';}headers[_0xcddc('0x4b')]=getAuth(_0x324b75);return getUser(_0x324b75,_0x1a03c1[_0xcddc('0x28')])[_0xcddc('0x1f')](function(_0x5021d0){_0x80bef=_0x5021d0;logger[_0xcddc('0x20')](_0xcddc('0x4c'),_0x80bef['id']);return getEndUser(_0x324b75,_0x20e7fc[_0xcddc('0x11')],_0x20e7fc[_0xcddc('0x12')]);})['then'](function(_0x1a2344){_0x5a0e6f=_0x1a2344;logger[_0xcddc('0x20')](_0xcddc('0x4d'),_0x5a0e6f['id']);return getTicket(_0x324b75,_0x80bef,_0x5a0e6f,_0x2074cb,_0x20e7fc);})[_0xcddc('0x1f')](function(_0x498af4){if(_0x498af4&&_0x498af4['id']){logger['info'](_0xcddc('0x21'));logger[_0xcddc('0x20')](_0xcddc('0x4e'),_0x498af4['id']);logger[_0xcddc('0x20')](_0xcddc('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcddc('0xf')](_0xcddc('0x50'),_0x1a03c1[_0xcddc('0x17')]),_0xcddc('0x51'),{'uri':util[_0xcddc('0xf')]('%s/helpdesk/tickets/%d',_0x324b75[_0xcddc('0x1d')],_0x498af4['id'])});}})[_0xcddc('0x52')](function(_0x465170){logger['error']('[QUEUE]',JSON[_0xcddc('0x33')](_0x465170));});};exports[_0xcddc('0x53')]=function(_0x571907,_0x4f019f,_0x42ed3c,_0xe4ebaa,_0x531e78,_0x3cd527,_0x1a9140){var _0x2cc01d,_0x58f41c;_0x3cd527[_0xcddc('0x1d')]=intUtil[_0xcddc('0x46')](_0x3cd527[_0xcddc('0x1d')]);_0x3cd527[_0xcddc('0x45')]=intUtil[_0xcddc('0x46')](_0x3cd527['serverUrl']);if(_0x1a9140&&_0x1a9140[_0xcddc('0x54')]&&_0x1a9140[_0xcddc('0x54')]!==_0xcddc('0x55')){logger[_0xcddc('0x20')](_0xcddc('0x56'),_0xcddc('0x48'));_0x4f019f[_0xcddc('0x4a')]=util[_0xcddc('0xf')](_0xcddc('0x49'),_0x3cd527[_0xcddc('0x45')],_0x4f019f[_0xcddc('0x57')],md5(_0x4f019f[_0xcddc('0x57')]));}headers['Authorization']=getAuth(_0x3cd527);return getUser(_0x3cd527,_0xe4ebaa[_0xcddc('0x28')])[_0xcddc('0x1f')](function(_0x2d95e8){_0x2cc01d=_0x2d95e8;logger[_0xcddc('0x20')]('The\x20User\x20ID\x20is:',_0x2cc01d['id']);return getEndUser(_0x3cd527,_0x4f019f[_0xcddc('0x58')],_0x4f019f[_0xcddc('0x59')]);})[_0xcddc('0x1f')](function(_0x7c9e80){_0x58f41c=_0x7c9e80;logger[_0xcddc('0x20')](_0xcddc('0x4d'),_0x58f41c['id']);return getTicket(_0x3cd527,_0x2cc01d,_0x58f41c,_0x42ed3c,_0x4f019f);})['then'](function(_0x492fbb){if(_0x492fbb&&_0x492fbb['id']){logger[_0xcddc('0x20')](_0xcddc('0x21'));logger['info'](_0xcddc('0x4e'),_0x492fbb['id']);logger[_0xcddc('0x20')]('[OUTBOUND]',_0xcddc('0x5a'));emit(util[_0xcddc('0xf')](_0xcddc('0x50'),_0xe4ebaa[_0xcddc('0x17')]),_0xcddc('0x51'),{'uri':util[_0xcddc('0xf')]('%s/helpdesk/tickets/%d',_0x3cd527['remoteUri'],_0x492fbb['id'])});}})['catch'](function(_0x4394c8){logger[_0xcddc('0x5b')](_0xcddc('0x56'),JSON[_0xcddc('0x33')](_0x4394c8));});};exports['unmanaged']=function(_0x32447a,_0x1dc0db,_0x425228,_0x40c0db,_0x1526f4,_0x5c666f){var _0x3f1dee,_0x41b044;_0x5c666f[_0xcddc('0x1d')]=intUtil[_0xcddc('0x46')](_0x5c666f['remoteUri']);_0x5c666f[_0xcddc('0x45')]=intUtil[_0xcddc('0x46')](_0x5c666f['serverUrl']);if(_0x1526f4&&_0x1526f4['monitor_format']){logger[_0xcddc('0x20')]('['+_0x1dc0db[_0xcddc('0x5c')][_0xcddc('0x5d')]()+']',_0xcddc('0x48'));_0x1dc0db[_0xcddc('0x4a')]=util[_0xcddc('0xf')](_0xcddc('0x49'),_0x5c666f[_0xcddc('0x45')],_0x1dc0db[_0xcddc('0x57')],md5(_0x1dc0db[_0xcddc('0x57')]));}else{_0x1dc0db[_0xcddc('0x4a')]='';}headers[_0xcddc('0x4b')]=getAuth(_0x5c666f);return getUser(_0x5c666f,'')[_0xcddc('0x1f')](function(_0x47e408){_0x3f1dee=_0x47e408;logger[_0xcddc('0x20')](_0xcddc('0x4c'),_0x3f1dee['id']);return getEndUser(_0x5c666f,_0x1dc0db['calleridname'],_0x1dc0db[_0xcddc('0x12')]);})[_0xcddc('0x1f')](function(_0x36ae19){_0x41b044=_0x36ae19;logger[_0xcddc('0x20')](_0xcddc('0x4d'),_0x41b044['id']);return getTicket(_0x5c666f,_0x3f1dee,_0x41b044,_0x425228,_0x1dc0db);})[_0xcddc('0x1f')](function(_0x407cb8){if(_0x407cb8){logger['info'](_0xcddc('0x21'));logger[_0xcddc('0x20')]('The\x20Ticket\x20ID\x20is:',_0x407cb8['id']);}})[_0xcddc('0x52')](function(_0x51739f){logger['error']('['+_0x1dc0db[_0xcddc('0x5c')][_0xcddc('0x5d')]()+']',JSON['stringify'](_0x51739f));});}; \ 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 ac96c2c..f4d9d2e 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 _0x74a1=['../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','/api/selector/owners','headers','info','then','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','outbound','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','./util'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x74a1,0x13e));var _0x174a=function(_0x2a972c,_0x2f8026){_0x2a972c=_0x2a972c-0x0;var _0xc3c903=_0x74a1[_0x2a972c];return _0xc3c903;};'use strict';var _=require(_0x174a('0x0'));var rp=require(_0x174a('0x1'));var md5=require(_0x174a('0x2'));var util=require(_0x174a('0x3'));var moment=require('moment');var Promise=require(_0x174a('0x4'));var Redis=require('ioredis');var intUtil=require(_0x174a('0x5'));var config=require(_0x174a('0x6'));var logger=require(_0x174a('0x7'))(_0x174a('0x8'));config[_0x174a('0x9')]=_['defaults'](config[_0x174a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x174a('0xa'))(new Redis(config[_0x174a('0x9')]));function getAdminId(_0x4c33ce,_0x11227d,_0x122be1,_0x4cd759){return new Promise(function(_0x31d303,_0x236a53){var _0x33af89=![];var _0x42c0d1={'method':'GET','uri':_0x4cd759+_0x174a('0xb'),'json':!![]};_0x42c0d1[_0x174a('0xc')]=_0x122be1;logger[_0x174a('0xd')]('Getting\x20admin\x20information');return rp(_0x42c0d1)[_0x174a('0xe')](function(_0x514281){if(_0x514281){var _0x82d203=_0x514281['users'];var _0x390184=null;for(_0x390184=0x0;_0x390184<_0x82d203[_0x174a('0xf')];_0x390184++){if(_0x82d203[_0x390184][_0x174a('0x10')]===_0x4c33ce[_0x174a('0x11')]){_0x4c33ce[_0x174a('0x12')]=_0x82d203[_0x390184]['id'];_0x33af89=!![];}}if(_0x33af89){logger[_0x174a('0xd')]('Admin\x20found:',_0x4c33ce[_0x174a('0x12')]);_0x31d303(_0x4c33ce);}else{_0x236a53({'statusCode':0x194,'message':_0x174a('0x13')});}}else{_0x236a53({'statusCode':0x194,'message':_0x174a('0x13')});}})[_0x174a('0x14')](function(_0x32f7){logger[_0x174a('0x15')]('['+[_0x11227d[_0x174a('0x16')]()]+']',_0x32f7['message']);_0x236a53(_0x32f7);});});}function getUser(_0x352378,_0x23bc3a,_0x2280ee){return function(_0x4b3f3f){return new Promise(function(_0x85da53,_0x44cffd){var _0x570910={'method':_0x174a('0x17'),'uri':_0x2280ee+_0x174a('0xb'),'json':!![]};_0x570910['headers']=_0x23bc3a;logger['info'](_0x174a('0x18'));return rp(_0x570910)[_0x174a('0xe')](function(_0x128bba){if(_0x128bba){var _0x4b8c90=_0x128bba[_0x174a('0x19')];var _0x29347d=![];var _0x3aadbc=null;if(_0x4b3f3f[_0x174a('0x1a')]!==null){logger[_0x174a('0xd')](_0x174a('0x1b'),_0x4b3f3f[_0x174a('0x1a')]);_0x4b3f3f[_0x174a('0x1c')]=_0x4b3f3f[_0x174a('0x1a')];for(_0x3aadbc=0x0;_0x3aadbc<_0x4b8c90[_0x174a('0xf')];_0x3aadbc++){if(_0x4b8c90[_0x3aadbc][_0x174a('0x10')]===_0x4b3f3f['agentEmail']){_0x29347d=!![];_0x4b3f3f[_0x174a('0x1d')]=_0x4b8c90[_0x3aadbc]['id'];logger[_0x174a('0xd')](_0x174a('0x1e'),_0x4b3f3f['userId']);}}}if(!_0x29347d){logger[_0x174a('0xd')](_0x174a('0x1f'));_0x4b3f3f['userEmail']=_0x4b3f3f['adminEmail'];_0x4b3f3f['userId']=_0x4b3f3f[_0x174a('0x12')];_0x29347d=!![];}if(_0x29347d){_0x85da53(_0x4b3f3f);}else{_0x44cffd({'statusCode':0x194,'message':_0x174a('0x13')});}}else{_0x44cffd({'statusCode':0x194,'message':_0x174a('0x13')});}})[_0x174a('0x14')](function(_0x671131){logger[_0x174a('0x15')]('['+[_0x352378[_0x174a('0x16')]()]+']',_0x671131[_0x174a('0x20')]);_0x44cffd(_0x671131);});});};}function searchContact(_0x407ed0,_0x1bef6a,_0x58a4a2,_0x2f4251){return new Promise(function(_0x477b08,_0x2af7f3){var _0x5ccaed={'method':_0x174a('0x17'),'headers':_0x1bef6a,'uri':_0x407ed0+'/api/lookup?q='+_0x2f4251+_0x174a('0x21')+_0x58a4a2+_0x174a('0x22'),'json':!![]};rp(_0x5ccaed)['then'](function(_0x166289){var _0xb5d40a=_[_0x174a('0x23')](_0x166289[_0x174a('0x24')]['contacts'],[_0x58a4a2,_0x2f4251]);_0x477b08(_0xb5d40a);})['catch'](function(_0x199e96){_0x2af7f3(_0x199e96);});});}function getEndUser(_0x41e41e,_0x2ef22b,_0x20b800){return function(_0x597314){return new Promise(function(_0x18320e,_0x4db11b){logger[_0x174a('0xd')](util[_0x174a('0x25')](_0x174a('0x26'),_0x597314[_0x174a('0x27')]));searchContact(_0x20b800,_0x2ef22b,_0x174a('0x28'),_0x597314[_0x174a('0x27')])[_0x174a('0xe')](function(_0x231220){if(_0x231220){_0x597314['endUserId']=_0x231220['id'];logger[_0x174a('0xd')](_0x174a('0x29'),_0x597314[_0x174a('0x2a')]);return _0x18320e(_0x597314);}searchContact(_0x20b800,_0x2ef22b,_0x174a('0x2b'),_0x597314[_0x174a('0x27')])[_0x174a('0xe')](function(_0x5b418a){if(_0x5b418a){_0x597314[_0x174a('0x2a')]=_0x5b418a['id'];logger[_0x174a('0xd')]('Contact\x20found\x20work_number:',_0x597314['endUserId']);return _0x18320e(_0x597314);}createEndUser(_0x597314,_0x41e41e,_0x2ef22b,_0x20b800)['then'](function(_0x214892){logger[_0x174a('0xd')](_0x174a('0x2c'),_0x214892[_0x174a('0x2a')]);return _0x18320e(_0x214892);});});})['catch'](function(_0x168f92){_0x4db11b(_0x168f92);});});};}function createEndUser(_0x51f770,_0x2d23e5,_0x53ae01,_0x1eab2e){return new Promise(function(_0x49a38d,_0x170d6d){var _0x5f1aee=moment();var _0xf1a9a4={'method':_0x174a('0x2d'),'uri':_0x1eab2e+_0x174a('0x2e'),'body':{'contact':{'last_name':_0x51f770[_0x174a('0x27')],'work_number':_0x51f770[_0x174a('0x27')],'mobile_number':_0x51f770[_0x174a('0x27')],'owner_id':_0x51f770['userId'],'created_at':_0x5f1aee[_0x174a('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xf1a9a4[_0x174a('0xc')]=_0x53ae01;logger[_0x174a('0xd')](_0x174a('0x2f'));return rp(_0xf1a9a4)['then'](function(_0x45ad08){_0x51f770['endUserId']=_0x45ad08['contact']['id'];_0x49a38d(_0x51f770);})[_0x174a('0x14')](function(_0x4a1013){logger[_0x174a('0x15')]('['+[_0x2d23e5[_0x174a('0x16')]()]+']',_0x4a1013[_0x174a('0x20')]);_0x170d6d(_0x4a1013['message']);});});}function getTicket(_0x300a78,_0x214527,_0x6ecaf2,_0x342f41,_0x9fabeb){return function(_0x514a06){logger['info'](_0x174a('0x30'));return new Promise(function(_0x5c2c33,_0x21bd63){var _0x374567=moment();var _0x347987={'method':_0x174a('0x2d'),'uri':_0x6ecaf2+_0x174a('0x31'),'body':{'title':intUtil[_0x174a('0x32')](_0x342f41[_0x174a('0x33')],_0x9fabeb,'\x20'),'description':intUtil['getString'](_0x342f41[_0x174a('0x34')],_0x9fabeb,'\x0a'),'owner_id':_0x514a06[_0x174a('0x1d')],'creater_id':_0x514a06[_0x174a('0x12')],'targetable_id':_0x514a06[_0x174a('0x2a')],'targetable_type':_0x174a('0x35'),'created_at':_0x374567[_0x174a('0x25')](_0x174a('0x36')),'due_date':_0x374567[_0x174a('0x37')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x347987[_0x174a('0xc')]=_0x214527;return rp(_0x347987)[_0x174a('0xe')](function(_0x585bfc){_0x514a06[_0x174a('0x38')]=_0x585bfc[_0x174a('0x39')]['id'];logger[_0x174a('0xd')]('Task\x20created:',_0x514a06['ticketId']);_0x5c2c33(_0x514a06);})[_0x174a('0x14')](function(_0x55a4db){logger[_0x174a('0x15')]('['+[_0x300a78['toUpperCase']()]+']',_0x55a4db[_0x174a('0x20')]);_0x21bd63(_0x55a4db[_0x174a('0x20')]);});});};}function emit(_0x1efbd1,_0x4da723,_0x13f1f5){var _0x70ebc6={'uri':_0x1efbd1+_0x174a('0x3a')+_0x13f1f5};io['to'](util[_0x174a('0x25')]('user:%s',_0x4da723))['emit'](_0x174a('0x3b'),_0x70ebc6);}exports['cs']=function(_0x8c5c1a,_0x512edf,_0xa694a4,_0x4e69f0,_0x423f51,_0x3abf0c,_0x5c2e4b,_0x4a66a4){var _0x45735a={};var _0x408b9b={'Authorization':_0x174a('0x3c')+_0x3abf0c[_0x174a('0x3d')]};_0x3abf0c['remoteUri']=intUtil['stripTrailingSlash'](_0x3abf0c[_0x174a('0x3e')]);_0x3abf0c[_0x174a('0x3f')]=intUtil[_0x174a('0x40')](_0x3abf0c[_0x174a('0x3f')]);var _0x34e404=_0x3abf0c['remoteUri'];_0x45735a[_0x174a('0x11')]=_0x3abf0c['username'];_0x45735a[_0x174a('0x27')]=_0x4a66a4['toLowerCase']()===_0x174a('0x41')?_0x512edf['destcalleridnum']:_0x512edf['calleridnum'];_0x45735a[_0x174a('0x42')]=_0x4a66a4==='queue'||_0x4a66a4===_0x174a('0x43')?_0x174a('0x44'):'outbound';if(_0x4e69f0){_0x45735a[_0x174a('0x1a')]=_0x4e69f0[_0x174a('0x10')];}var _0x46a6fd=util[_0x174a('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abf0c[_0x174a('0x3f')],_0x512edf['uniqueid'],md5(_0x512edf[_0x174a('0x45')]));if(_0x423f51&&_0x423f51[_0x174a('0x46')]){logger['info'](_0x174a('0x47'),'Recording\x20is\x20enabled!');_0x512edf[_0x174a('0x48')]=_0x46a6fd;}else if(_0x5c2e4b&&_0x5c2e4b['recordingFormat']&&_0x5c2e4b[_0x174a('0x49')]!==_0x174a('0x4a')){logger[_0x174a('0xd')](_0x174a('0x4b'),_0x174a('0x4c'));_0x512edf[_0x174a('0x48')]=_0x46a6fd;}else{_0x512edf['recordingURL']='';}return getAdminId(_0x45735a,_0x4a66a4,_0x408b9b,_0x34e404)['then'](getUser(_0x4a66a4,_0x408b9b,_0x34e404))[_0x174a('0xe')](getEndUser(_0x4a66a4,_0x408b9b,_0x34e404))['then'](getTicket(_0x4a66a4,_0x408b9b,_0x34e404,_0xa694a4,_0x512edf))['then'](function(_0x5859b6){logger[_0x174a('0xd')](util[_0x174a('0x25')](_0x174a('0x4d'),_0x5859b6['ticketId']));if(_0x4a66a4!==_0x174a('0x43')){logger[_0x174a('0xd')]('['+[_0x4a66a4[_0x174a('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x34e404,_0x4e69f0[_0x174a('0x4e')],_0x5859b6[_0x174a('0x2a')]);}})[_0x174a('0x14')](function(_0x294d09){logger[_0x174a('0x15')]('['+[_0x4a66a4[_0x174a('0x16')]()]+_0x174a('0x4f'),util[_0x174a('0x50')](_0x294d09,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9d4d=[']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','headers','info','users','email','adminEmail','adminId','Admin\x20found:','catch','error','message','GET','/api/selector/owners','then','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','&entities=contact','find','contacts','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','add','format','task','toUpperCase','/contacts/','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x5d247a,_0x9f6e90){var _0x28e96a=function(_0x46be9d){while(--_0x46be9d){_0x5d247a['push'](_0x5d247a['shift']());}};_0x28e96a(++_0x9f6e90);}(_0x9d4d,0x188));var _0xd9d4=function(_0x4c74be,_0x1e5764){_0x4c74be=_0x4c74be-0x0;var _0x2cbf14=_0x9d4d[_0x4c74be];return _0x2cbf14;};'use strict';var _=require('lodash');var rp=require(_0xd9d4('0x0'));var md5=require(_0xd9d4('0x1'));var util=require(_0xd9d4('0x2'));var moment=require('moment');var Promise=require(_0xd9d4('0x3'));var Redis=require(_0xd9d4('0x4'));var intUtil=require(_0xd9d4('0x5'));var config=require(_0xd9d4('0x6'));var logger=require(_0xd9d4('0x7'))('freshsales');config['redis']=_['defaults'](config[_0xd9d4('0x8')],{'host':_0xd9d4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd9d4('0x8')]));function getAdminId(_0x45c41b,_0x1df1cc,_0x3f05d3,_0x40014d){return new Promise(function(_0x3baaa2,_0x42084c){var _0x4f7d36=![];var _0x5bfdf3={'method':'GET','uri':_0x40014d+'/api/selector/owners','json':!![]};_0x5bfdf3[_0xd9d4('0xa')]=_0x3f05d3;logger[_0xd9d4('0xb')]('Getting\x20admin\x20information');return rp(_0x5bfdf3)['then'](function(_0x33e709){if(_0x33e709){var _0x4a24bc=_0x33e709[_0xd9d4('0xc')];var _0x2e1aea=null;for(_0x2e1aea=0x0;_0x2e1aea<_0x4a24bc['length'];_0x2e1aea++){if(_0x4a24bc[_0x2e1aea][_0xd9d4('0xd')]===_0x45c41b[_0xd9d4('0xe')]){_0x45c41b[_0xd9d4('0xf')]=_0x4a24bc[_0x2e1aea]['id'];_0x4f7d36=!![];}}if(_0x4f7d36){logger[_0xd9d4('0xb')](_0xd9d4('0x10'),_0x45c41b['adminId']);_0x3baaa2(_0x45c41b);}else{_0x42084c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x42084c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xd9d4('0x11')](function(_0x2cb649){logger[_0xd9d4('0x12')]('['+[_0x1df1cc['toUpperCase']()]+']',_0x2cb649[_0xd9d4('0x13')]);_0x42084c(_0x2cb649);});});}function getUser(_0x48b557,_0x5a89d5,_0x361980){return function(_0x4ed761){return new Promise(function(_0x1f84ad,_0x4e06ee){var _0x2b1594={'method':_0xd9d4('0x14'),'uri':_0x361980+_0xd9d4('0x15'),'json':!![]};_0x2b1594[_0xd9d4('0xa')]=_0x5a89d5;logger[_0xd9d4('0xb')]('Getting\x20user\x20list');return rp(_0x2b1594)[_0xd9d4('0x16')](function(_0x3bc5df){if(_0x3bc5df){var _0x4ad6aa=_0x3bc5df['users'];var _0x1e5afa=![];var _0x2e3c1b=null;if(_0x4ed761[_0xd9d4('0x17')]!==null){logger['info'](_0xd9d4('0x18'),_0x4ed761['agentEmail']);_0x4ed761['userEmail']=_0x4ed761[_0xd9d4('0x17')];for(_0x2e3c1b=0x0;_0x2e3c1b<_0x4ad6aa['length'];_0x2e3c1b++){if(_0x4ad6aa[_0x2e3c1b][_0xd9d4('0xd')]===_0x4ed761[_0xd9d4('0x17')]){_0x1e5afa=!![];_0x4ed761[_0xd9d4('0x19')]=_0x4ad6aa[_0x2e3c1b]['id'];logger[_0xd9d4('0xb')](_0xd9d4('0x1a'),_0x4ed761[_0xd9d4('0x19')]);}}}if(!_0x1e5afa){logger[_0xd9d4('0xb')](_0xd9d4('0x1b'));_0x4ed761['userEmail']=_0x4ed761[_0xd9d4('0xe')];_0x4ed761['userId']=_0x4ed761[_0xd9d4('0xf')];_0x1e5afa=!![];}if(_0x1e5afa){_0x1f84ad(_0x4ed761);}else{_0x4e06ee({'statusCode':0x194,'message':_0xd9d4('0x1c')});}}else{_0x4e06ee({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x18eff6){logger[_0xd9d4('0x12')]('['+[_0x48b557['toUpperCase']()]+']',_0x18eff6[_0xd9d4('0x13')]);_0x4e06ee(_0x18eff6);});});};}function searchContact(_0x5981a8,_0x156e80,_0x4a24e5,_0x3ec6be){return new Promise(function(_0x4074f6,_0x2fe411){var _0x118582={'method':_0xd9d4('0x14'),'headers':_0x156e80,'uri':_0x5981a8+_0xd9d4('0x1d')+_0x3ec6be+_0xd9d4('0x1e')+_0x4a24e5+_0xd9d4('0x1f'),'json':!![]};rp(_0x118582)[_0xd9d4('0x16')](function(_0x6e5f84){var _0x1d00bf=_[_0xd9d4('0x20')](_0x6e5f84['contacts'][_0xd9d4('0x21')],[_0x4a24e5,_0x3ec6be]);_0x4074f6(_0x1d00bf);})[_0xd9d4('0x11')](function(_0x2f8507){_0x2fe411(_0x2f8507);});});}function getEndUser(_0x4b97cf,_0x3eddf0,_0x541a28){return function(_0x5e86ef){return new Promise(function(_0x2f3913,_0xee0085){logger[_0xd9d4('0xb')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x5e86ef[_0xd9d4('0x22')]));searchContact(_0x541a28,_0x3eddf0,_0xd9d4('0x23'),_0x5e86ef[_0xd9d4('0x22')])[_0xd9d4('0x16')](function(_0x197370){if(_0x197370){_0x5e86ef[_0xd9d4('0x24')]=_0x197370['id'];logger['info'](_0xd9d4('0x25'),_0x5e86ef['endUserId']);return _0x2f3913(_0x5e86ef);}searchContact(_0x541a28,_0x3eddf0,_0xd9d4('0x26'),_0x5e86ef['contactNumber'])['then'](function(_0x3291d5){if(_0x3291d5){_0x5e86ef[_0xd9d4('0x24')]=_0x3291d5['id'];logger[_0xd9d4('0xb')]('Contact\x20found\x20work_number:',_0x5e86ef['endUserId']);return _0x2f3913(_0x5e86ef);}createEndUser(_0x5e86ef,_0x4b97cf,_0x3eddf0,_0x541a28)[_0xd9d4('0x16')](function(_0x23bb99){logger[_0xd9d4('0xb')](_0xd9d4('0x27'),_0x23bb99['endUserId']);return _0x2f3913(_0x23bb99);});});})[_0xd9d4('0x11')](function(_0x2d2f19){_0xee0085(_0x2d2f19);});});};}function createEndUser(_0x1ea566,_0x4bd8df,_0xb55a84,_0x1f0ac8){return new Promise(function(_0x3d4423,_0xbb6d75){var _0x54ba4a=moment();var _0x575f3c={'method':_0xd9d4('0x28'),'uri':_0x1f0ac8+_0xd9d4('0x29'),'body':{'contact':{'last_name':_0x1ea566[_0xd9d4('0x22')],'work_number':_0x1ea566[_0xd9d4('0x22')],'mobile_number':_0x1ea566[_0xd9d4('0x22')],'owner_id':_0x1ea566[_0xd9d4('0x19')],'created_at':_0x54ba4a['format'](_0xd9d4('0x2a'))}},'json':!![]};_0x575f3c[_0xd9d4('0xa')]=_0xb55a84;logger[_0xd9d4('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x575f3c)[_0xd9d4('0x16')](function(_0x19fbf7){_0x1ea566[_0xd9d4('0x24')]=_0x19fbf7['contact']['id'];_0x3d4423(_0x1ea566);})[_0xd9d4('0x11')](function(_0x45e214){logger[_0xd9d4('0x12')]('['+[_0x4bd8df['toUpperCase']()]+']',_0x45e214[_0xd9d4('0x13')]);_0xbb6d75(_0x45e214['message']);});});}function getTicket(_0x25204a,_0x1ba7d6,_0x390fba,_0x31e293,_0x2df88b){return function(_0x5934f4){logger[_0xd9d4('0xb')](_0xd9d4('0x2b'));return new Promise(function(_0x1adfc8,_0x2a47c3){var _0x15e62f=moment();var _0x2230bb={'method':_0xd9d4('0x28'),'uri':_0x390fba+_0xd9d4('0x2c'),'body':{'title':intUtil[_0xd9d4('0x2d')](_0x31e293['Subjects'],_0x2df88b,'\x20'),'description':intUtil[_0xd9d4('0x2d')](_0x31e293['Descriptions'],_0x2df88b,'\x0a'),'owner_id':_0x5934f4['userId'],'creater_id':_0x5934f4[_0xd9d4('0xf')],'targetable_id':_0x5934f4['endUserId'],'targetable_type':'Contact','created_at':_0x15e62f['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x15e62f[_0xd9d4('0x2e')](0x1e,'m')[_0xd9d4('0x2f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2230bb[_0xd9d4('0xa')]=_0x1ba7d6;return rp(_0x2230bb)[_0xd9d4('0x16')](function(_0x1a5917){_0x5934f4['ticketId']=_0x1a5917[_0xd9d4('0x30')]['id'];logger[_0xd9d4('0xb')]('Task\x20created:',_0x5934f4['ticketId']);_0x1adfc8(_0x5934f4);})[_0xd9d4('0x11')](function(_0x26d83a){logger['error']('['+[_0x25204a[_0xd9d4('0x31')]()]+']',_0x26d83a[_0xd9d4('0x13')]);_0x2a47c3(_0x26d83a['message']);});});};}function emit(_0xb66385,_0x389d3f,_0x4db7ff){var _0x265535={'uri':_0xb66385+_0xd9d4('0x32')+_0x4db7ff};io['to'](util[_0xd9d4('0x2f')]('user:%s',_0x389d3f))[_0xd9d4('0x33')](_0xd9d4('0x34'),_0x265535);}exports['cs']=function(_0x2e7b35,_0x26b0e1,_0x41e6fc,_0x5e875f,_0x360a49,_0x273b54,_0x4f5b9d,_0x5a1bb5){var _0x934804={};var _0x482f95={'Authorization':_0xd9d4('0x35')+_0x273b54['apiKey']};_0x273b54['remoteUri']=intUtil[_0xd9d4('0x36')](_0x273b54[_0xd9d4('0x37')]);_0x273b54[_0xd9d4('0x38')]=intUtil[_0xd9d4('0x36')](_0x273b54[_0xd9d4('0x38')]);var _0x2a6484=_0x273b54['remoteUri'];_0x934804['adminEmail']=_0x273b54[_0xd9d4('0x39')];_0x934804['contactNumber']=_0x5a1bb5[_0xd9d4('0x3a')]()===_0xd9d4('0x3b')?_0x26b0e1[_0xd9d4('0x3c')]:_0x26b0e1['calleridnum'];_0x934804[_0xd9d4('0x3d')]=_0x5a1bb5===_0xd9d4('0x3e')||_0x5a1bb5===_0xd9d4('0x3f')?_0xd9d4('0x3e'):_0xd9d4('0x3b');if(_0x5e875f){_0x934804[_0xd9d4('0x17')]=_0x5e875f[_0xd9d4('0xd')];}var _0x19c466=util['format'](_0xd9d4('0x40'),_0x273b54['serverUrl'],_0x26b0e1[_0xd9d4('0x41')],md5(_0x26b0e1[_0xd9d4('0x41')]));if(_0x360a49&&_0x360a49[_0xd9d4('0x42')]){logger[_0xd9d4('0xb')](_0xd9d4('0x43'),_0xd9d4('0x44'));_0x26b0e1[_0xd9d4('0x45')]=_0x19c466;}else if(_0x4f5b9d&&_0x4f5b9d[_0xd9d4('0x46')]&&_0x4f5b9d[_0xd9d4('0x46')]!==_0xd9d4('0x47')){logger['info']('[OUTBOUND]',_0xd9d4('0x44'));_0x26b0e1['recordingURL']=_0x19c466;}else{_0x26b0e1[_0xd9d4('0x45')]='';}return getAdminId(_0x934804,_0x5a1bb5,_0x482f95,_0x2a6484)[_0xd9d4('0x16')](getUser(_0x5a1bb5,_0x482f95,_0x2a6484))[_0xd9d4('0x16')](getEndUser(_0x5a1bb5,_0x482f95,_0x2a6484))[_0xd9d4('0x16')](getTicket(_0x5a1bb5,_0x482f95,_0x2a6484,_0x41e6fc,_0x26b0e1))['then'](function(_0x67dfb){logger['info'](util['format'](_0xd9d4('0x48'),_0x67dfb[_0xd9d4('0x49')]));if(_0x5a1bb5!=='unmanaged'){logger['info']('['+[_0x5a1bb5['toUpperCase']()]+']',_0xd9d4('0x4a'));emit(_0x2a6484,_0x5e875f[_0xd9d4('0x4b')],_0x67dfb[_0xd9d4('0x24')]);}})[_0xd9d4('0x11')](function(_0x481b01){logger[_0xd9d4('0x12')]('['+[_0x5a1bb5[_0xd9d4('0x31')]()]+_0xd9d4('0x4c'),util[_0xd9d4('0x4d')](_0x481b01,{'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 95bef96..987b4b3 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 _0x5184=['desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','queue','routeId','log','../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','zoho'];(function(_0x1cf227,_0xa04968){var _0x3c26f6=function(_0x1af4cc){while(--_0x1af4cc){_0x1cf227['push'](_0x1cf227['shift']());}};_0x3c26f6(++_0xa04968);}(_0x5184,0xeb));var _0x4518=function(_0x16b4c5,_0x544e67){_0x16b4c5=_0x16b4c5-0x0;var _0x2ad7bd=_0x5184[_0x16b4c5];return _0x2ad7bd;};'use strict';var _=require('lodash');var util=require(_0x4518('0x0'));var zendesk=require(_0x4518('0x1'));var salesforce=require(_0x4518('0x2'));var sugarcrm=require(_0x4518('0x3'));var freshdesk=require(_0x4518('0x4'));var zoho=require(_0x4518('0x5'));var desk=require(_0x4518('0x6'));var vtiger=require(_0x4518('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x4518('0x8'),_0x4518('0x9'),_0x4518('0xa'),_0x4518('0xb'),_0x4518('0xc'),_0x4518('0xd'),_0x4518('0xe'),_0x4518('0xf'),_0x4518('0x10'),_0x4518('0x11')];exports[_0x4518('0x12')]=function(_0x4b0629,_0x318629,_0x726332,_0x93ada1,_0x4024d9,_0x311e29){if(_0x726332){if(_[_0x4518('0x13')](integrations,_0x4b0629[_0x4518('0x14')]['toLowerCase']())){try{var _0x298254=null;var _0x4fd181='';var _0x3116b4=_0x726332[_0x4b0629[_0x4518('0x14')][_0x4518('0x15')]()];if(_0x3116b4){var _0x293361=_0x3116b4[_0x4b0629['data2']];if(_0x293361){var _0x14183e=_[_0x4518('0x16')](_0x293361['Configurations'],{'id':parseInt(_0x4b0629['data3'],0xa)});if(_0x14183e){if(_0x93ada1){if(_0x4024d9&&_0x318629[_0x4518('0x17')]){_0x4fd181=_0x4518('0x17');}else if(_0x318629[_0x4518('0x18')]){_0x4fd181='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x318629);}}else{_0x4fd181='unmanaged';}switch(_0x4b0629[_0x4518('0x14')][_0x4518('0x15')]()){case _0x4518('0x8'):zendesk[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case'salesforce':salesforce[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case'sugarcrm':sugarcrm[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case _0x4518('0xb'):freshdesk[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case _0x4518('0xc'):zoho[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case _0x4518('0xd'):desk[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case _0x4518('0xe'):vtiger[_0x4fd181](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29);break;case'freshsales':freshsales['cs'](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29,_0x4fd181);break;case _0x4518('0x11'):servicenow['cs'](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29,_0x4fd181);break;case'dynamics365':dynamics365['cs'](_0x4b0629,_0x318629,_0x14183e,_0x93ada1,_0x4024d9,_0x293361,_0x311e29,_0x4fd181);break;default:console[_0x4518('0x19')]('unknown\x20integration');}}else{_0x298254=require(_0x4518('0x1a'))(_0x4b0629['data1'][_0x4518('0x15')]());_0x298254['error'](_0x4518('0x1b'),util[_0x4518('0x1c')]('%s\x20configuration\x20#%s\x20not\x20found',_0x4b0629[_0x4518('0x14')][_0x4518('0x15')](),_0x4b0629['data3']));}}else{_0x298254=require(_0x4518('0x1a'))(_0x4b0629['data1'][_0x4518('0x15')]());_0x298254['error']('[EXEC]',util[_0x4518('0x1c')](_0x4518('0x1d'),_0x4b0629[_0x4518('0x14')]['toLowerCase'](),_0x4b0629[_0x4518('0x1e')]));}}else{}}catch(_0x2e4aec){console['error'](_0x2e4aec);}}}}; \ No newline at end of file +var _0x8142=['desk','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','freshdesk','zoho','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','error','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm'];(function(_0x47cbd3,_0x5e1aad){var _0x2277af=function(_0x5e0a38){while(--_0x5e0a38){_0x47cbd3['push'](_0x47cbd3['shift']());}};_0x2277af(++_0x5e1aad);}(_0x8142,0x1e1));var _0x2814=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x8142[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0x2814('0x0'));var util=require(_0x2814('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x2814('0x2'));var sugarcrm=require(_0x2814('0x3'));var freshdesk=require(_0x2814('0x4'));var zoho=require(_0x2814('0x5'));var desk=require(_0x2814('0x6'));var vtiger=require(_0x2814('0x7'));var servicenow=require(_0x2814('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2814('0x9'));var integrations=[_0x2814('0xa'),_0x2814('0xb'),_0x2814('0xc'),'freshdesk','zoho',_0x2814('0xd'),_0x2814('0xe'),_0x2814('0xf'),_0x2814('0x10'),'servicenow'];exports[_0x2814('0x11')]=function(_0x5b9560,_0x3402a2,_0x3e76d9,_0x2c6564,_0x2b73ba,_0x1f7692){if(_0x3e76d9){if(_['includes'](integrations,_0x5b9560[_0x2814('0x12')][_0x2814('0x13')]())){try{var _0x1d4cef=null;var _0x3be8da='';var _0x609713=_0x3e76d9[_0x5b9560[_0x2814('0x12')][_0x2814('0x13')]()];if(_0x609713){var _0x3e1b16=_0x609713[_0x5b9560['data2']];if(_0x3e1b16){var _0x5c8ba2=_[_0x2814('0x14')](_0x3e1b16[_0x2814('0x15')],{'id':parseInt(_0x5b9560['data3'],0xa)});if(_0x5c8ba2){if(_0x2c6564){if(_0x2b73ba&&_0x3402a2[_0x2814('0x16')]){_0x3be8da=_0x2814('0x16');}else if(_0x3402a2[_0x2814('0x17')]){_0x3be8da=_0x2814('0x18');}else{console[_0x2814('0x19')](_0x2814('0x1a'),_0x3402a2);}}else{_0x3be8da='unmanaged';}switch(_0x5b9560[_0x2814('0x12')]['toLowerCase']()){case _0x2814('0xa'):zendesk[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0xb'):salesforce[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case'sugarcrm':sugarcrm[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0x1b'):freshdesk[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0x1c'):zoho[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0xd'):desk[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0xe'):vtiger[_0x3be8da](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692);break;case _0x2814('0x10'):freshsales['cs'](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692,_0x3be8da);break;case _0x2814('0x1d'):servicenow['cs'](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692,_0x3be8da);break;case _0x2814('0xf'):dynamics365['cs'](_0x5b9560,_0x3402a2,_0x5c8ba2,_0x2c6564,_0x2b73ba,_0x3e1b16,_0x1f7692,_0x3be8da);break;default:console[_0x2814('0x19')](_0x2814('0x1e'));}}else{_0x1d4cef=require(_0x2814('0x1f'))(_0x5b9560[_0x2814('0x12')][_0x2814('0x13')]());_0x1d4cef['error'](_0x2814('0x20'),util[_0x2814('0x21')](_0x2814('0x22'),_0x5b9560[_0x2814('0x12')][_0x2814('0x13')](),_0x5b9560[_0x2814('0x23')]));}}else{_0x1d4cef=require(_0x2814('0x1f'))(_0x5b9560[_0x2814('0x12')]['toLowerCase']());_0x1d4cef['error'](_0x2814('0x20'),util[_0x2814('0x21')](_0x2814('0x24'),_0x5b9560[_0x2814('0x12')][_0x2814('0x13')](),_0x5b9560['data2']));}}else{}}catch(_0x24160f){console[_0x2814('0x25')](_0x24160f);}}}}; \ 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 7fc0b7a..2ebd012 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 _0x8e43=['IsReminderSet','endUserType','lead','account','Case','contact','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','then','length','find','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','account_contact_lead','Account','additionalSearchAccount','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','string','picklist','content','variable','variableName','idField','Variable','name','toString','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','Subjects','ticketType','ActivityDate','utc'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x8e43,0x6b));var _0x38e4=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x8e43[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0x38e4('0x0'));var rp=require(_0x38e4('0x1'));var moment=require('moment');var BPromise=require(_0x38e4('0x2'));var md5=require(_0x38e4('0x3'));var jsforce=require(_0x38e4('0x4'));var util=require(_0x38e4('0x5'));var Redis=require(_0x38e4('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x38e4('0x7'))(_0x38e4('0x8'));config[_0x38e4('0x9')]=_[_0x38e4('0xa')](config[_0x38e4('0x9')],{'host':_0x38e4('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x54e14c,_0x575fd4,_0x2681fd){io['to'](_0x54e14c)[_0x38e4('0xc')](_0x575fd4,_0x2681fd);}function getTicket(_0x2f05fb,_0x1a85b4,_0x4e4b83,_0x149dfd,_0x476d8d,_0x2f4025,_0x198aad,_0x5243f5){var _0x233f09=Object[_0x38e4('0xd')]({},{'OwnerId':_0x1a85b4['id'],'Subject':intUtil['getString'](_0x149dfd[_0x38e4('0xe')],_0x476d8d,'\x20'),'Description':intUtil['getString'](_0x149dfd['Descriptions'],_0x476d8d,'\x0a')},getCustomFields(_0x2f4025,_0x476d8d));if(_0x4e4b83){if(_0x149dfd[_0x38e4('0xf')]==='Task'){_0x233f09[_0x38e4('0x10')]=moment[_0x38e4('0x11')]();_0x233f09[_0x38e4('0x12')]=![];_0x233f09['IsRecurrence']=![];if(_0x4e4b83[_0x38e4('0x13')]==='contact'||_0x4e4b83[_0x38e4('0x13')]===_0x38e4('0x14')){_0x233f09['WhoId']=_0x4e4b83['id'];}else if(_0x4e4b83[_0x38e4('0x13')]===_0x38e4('0x15')){_0x233f09['WhatId']=_0x4e4b83['id'];}}else if(_0x149dfd[_0x38e4('0xf')]===_0x38e4('0x16')){if(_0x4e4b83[_0x38e4('0x13')]===_0x38e4('0x17')){_0x233f09[_0x38e4('0x18')]=_0x4e4b83['id'];}else if(_0x4e4b83[_0x38e4('0x13')]===_0x38e4('0x15')){_0x233f09['AccountId']=_0x4e4b83['id'];}else if(_0x4e4b83[_0x38e4('0x13')]===_0x38e4('0x14')&&_0x149dfd[_0x38e4('0x19')]){_0x233f09[_0x149dfd[_0x38e4('0x19')]]=_0x4e4b83['id'];}else{logger[_0x38e4('0x1a')](_0x38e4('0x1b'));}}}return _0x198aad[_0x38e4('0x1c')](_0x149dfd[_0x38e4('0xf')])[_0x38e4('0x1d')](_0x233f09);}function getUser(_0x8971af,_0x596d32,_0x2daf75){if(!_[_0x38e4('0x1e')](_0x596d32)&&intUtil[_0x38e4('0x1f')](_0x596d32)){var _0x496046={'Email':_0x596d32};var _0x401329={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2daf75[_0x38e4('0x1c')](_0x38e4('0x20'))['find'](_0x496046,_0x401329)['execute']()[_0x38e4('0x21')](function(_0x13d67a){if(_0x13d67a[_0x38e4('0x22')]){var _0x53e57a=_[_0x38e4('0x23')](_0x13d67a,function(_0x25475b){return _0x25475b['Email']===_0x596d32;});if(_0x53e57a){logger[_0x38e4('0x1a')]('Agent\x20%s\x20found.',_0x596d32);return BPromise[_0x38e4('0x24')]({'id':_0x53e57a['Id'],'name':_0x53e57a[_0x38e4('0x25')]});}}else{logger[_0x38e4('0x1a')](_0x38e4('0x26'),_0x596d32);return _0x2daf75[_0x38e4('0x27')]()[_0x38e4('0x21')](function(_0x35e379){return BPromise[_0x38e4('0x24')]({'id':_0x35e379[_0x38e4('0x28')],'name':_0x35e379[_0x38e4('0x29')]});});}});}else{logger[_0x38e4('0x1a')](_0x38e4('0x26'),_0x596d32);return _0x2daf75[_0x38e4('0x27')]()['then'](function(_0x544477){return BPromise['resolve']({'id':_0x544477[_0x38e4('0x28')],'name':_0x544477[_0x38e4('0x29')]});});}}function getEndUser(_0x2b0bb7,_0x491845,_0x34dcb3,_0x17a165,_0x5a09e7){var _0x2ef98c={'$or':{'Phone':_0x17a165}};var _0x5e3c35={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x38e4('0x21')](function(){logger['info'](_0x38e4('0x2a'),_0x17a165,_0x491845[_0x38e4('0x2b')]);switch(_0x491845['moduleSearch']){case'contact_lead':var _0x126531=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845[_0x38e4('0x2d')]){var _0x21da11={};_0x21da11[_0x491845[_0x38e4('0x2d')]]=_0x17a165;_['merge'](_0x126531[_0x38e4('0x2e')],_0x21da11);}return _0x5a09e7[_0x38e4('0x1c')](_0x38e4('0x2f'))[_0x38e4('0x23')](_0x126531,_0x5e3c35)[_0x38e4('0x30')]()[_0x38e4('0x21')](function(_0x49c7da){if(_0x49c7da&&_0x49c7da['length']){return _0x49c7da;}else{var _0x1b5c12=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845[_0x38e4('0x31')]){var _0x1ea771={};_0x1ea771[_0x491845[_0x38e4('0x31')]]=_0x17a165;_[_0x38e4('0x32')](_0x1b5c12[_0x38e4('0x2e')],_0x1ea771);}return _0x5a09e7['sobject'](_0x38e4('0x33'))[_0x38e4('0x23')](_0x1b5c12,_0x5e3c35);}});case _0x38e4('0x34'):var _0x3e363c=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845['additionalSearchAccount']){var _0x21da11={};_0x21da11[_0x491845['additionalSearchAccount']]=_0x17a165;_[_0x38e4('0x32')](_0x3e363c[_0x38e4('0x2e')],_0x21da11);}return _0x5a09e7[_0x38e4('0x1c')](_0x38e4('0x35'))[_0x38e4('0x23')](_0x3e363c,_0x5e3c35)['execute']()['then'](function(_0x1cf91d){if(_0x1cf91d&&_0x1cf91d[_0x38e4('0x22')]){return _0x1cf91d;}else{var _0x257909=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845[_0x38e4('0x2d')]){var _0x4c7cfa={};_0x4c7cfa[_0x491845[_0x38e4('0x2d')]]=_0x17a165;_['merge'](_0x257909['$or'],_0x4c7cfa);}return _0x5a09e7[_0x38e4('0x1c')](_0x38e4('0x2f'))[_0x38e4('0x23')](_0x257909,_0x5e3c35)[_0x38e4('0x21')](function(_0x42424c){if(_0x42424c&&_0x42424c[_0x38e4('0x22')]){return _0x42424c;}else{var _0x433fb7=_['cloneDeep'](_0x2ef98c);if(_0x491845['additionalSearchLead']){var _0x428ab8={};_0x428ab8[_0x491845[_0x38e4('0x31')]]=_0x17a165;_[_0x38e4('0x32')](_0x433fb7[_0x38e4('0x2e')],_0x428ab8);}return _0x5a09e7[_0x38e4('0x1c')](_0x38e4('0x33'))[_0x38e4('0x23')](_0x433fb7,_0x5e3c35);}});}});case'contact':var _0x126531=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845[_0x38e4('0x2d')]){var _0x21da11={};_0x21da11[_0x491845['additionalSearchContact']]=_0x17a165;_[_0x38e4('0x32')](_0x126531[_0x38e4('0x2e')],_0x21da11);}return _0x5a09e7[_0x38e4('0x1c')]('Contact')[_0x38e4('0x23')](_0x126531,_0x5e3c35)[_0x38e4('0x30')]();case'lead':var _0xc911d3=_['cloneDeep'](_0x2ef98c);if(_0x491845[_0x38e4('0x31')]){var _0x21da11={};_0x21da11[_0x491845[_0x38e4('0x31')]]=_0x17a165;_['merge'](_0xc911d3[_0x38e4('0x2e')],_0x21da11);}return _0x5a09e7['sobject'](_0x38e4('0x33'))['find'](_0xc911d3,_0x5e3c35);case _0x38e4('0x15'):var _0x3e363c=_[_0x38e4('0x2c')](_0x2ef98c);if(_0x491845[_0x38e4('0x36')]){var _0x21da11={};_0x21da11[_0x491845[_0x38e4('0x36')]]=_0x17a165;_['merge'](_0x3e363c[_0x38e4('0x2e')],_0x21da11);}return _0x5a09e7[_0x38e4('0x1c')](_0x38e4('0x35'))[_0x38e4('0x23')](_0x3e363c,_0x5e3c35);default:return null;}})[_0x38e4('0x21')](function(_0x398780){if(_0x398780&&_0x398780['length']){var _0x497b0b=_[_0x38e4('0x37')](_0x398780);if(_0x497b0b){return BPromise[_0x38e4('0x24')]({'id':_0x497b0b['Id'],'name':_0x497b0b[_0x38e4('0x25')],'phone':_0x497b0b['Phone'],'endUserType':_0x497b0b[_0x38e4('0x38')][_0x38e4('0x39')][_0x38e4('0x3a')]()});}}})[_0x38e4('0x21')](function(_0x356938){if(_0x356938){logger[_0x38e4('0x1a')](_0x38e4('0x3b'),_0x356938[_0x38e4('0x13')],_0x17a165);return BPromise[_0x38e4('0x24')](_0x356938);}else{logger[_0x38e4('0x1a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x17a165);var _0x3f4160={'Phone':_0x17a165};if(_0x491845[_0x38e4('0x3c')]){if(_0x491845[_0x38e4('0x3c')]==='contact'){logger[_0x38e4('0x1a')](_0x38e4('0x3d'),_0x17a165,_0x491845[_0x38e4('0x3c')]);_0x3f4160[_0x38e4('0x3e')]=_0x34dcb3!==''?_0x34dcb3:util[_0x38e4('0x3f')](_0x38e4('0x40'),_0x17a165);}else if(_0x491845[_0x38e4('0x3c')]==='lead'){logger[_0x38e4('0x1a')](_0x38e4('0x3d'),_0x17a165,_0x491845[_0x38e4('0x3c')]);_0x3f4160[_0x38e4('0x3e')]=_0x34dcb3!==''?_0x34dcb3:util['format'](_0x38e4('0x40'),_0x17a165);_0x3f4160[_0x38e4('0x41')]=_0x38e4('0x42');}else if(_0x491845[_0x38e4('0x3c')]===_0x38e4('0x15')){logger[_0x38e4('0x1a')](_0x38e4('0x3d'),_0x17a165,_0x491845['moduleCreate']);_0x3f4160[_0x38e4('0x25')]=_0x34dcb3!==''?_0x34dcb3:util[_0x38e4('0x3f')]('Caller\x20-\x20%s',_0x17a165);}else{return null;}}return _0x5a09e7[_0x38e4('0x1c')](_[_0x38e4('0x43')](_0x491845[_0x38e4('0x3c')]))[_0x38e4('0x1d')](_0x3f4160)[_0x38e4('0x21')](function(_0xe9128c){return BPromise[_0x38e4('0x24')]({'id':_0xe9128c['id'],'endUserType':_0x491845[_0x38e4('0x3c')]});});}});}function getCustomFields(_0x52fc13,_0x83d0f8){var _0x2be4e4={};if(_0x52fc13[_0x38e4('0x22')]>0x0){_['forEach'](_0x52fc13,function(_0x5cce22){if(_[_0x38e4('0x44')]([_0x38e4('0x45'),_0x38e4('0x46')],_0x5cce22[_0x38e4('0x39')])&&_0x5cce22['idField']){_0x2be4e4[_0x5cce22['idField']]=_0x5cce22[_0x38e4('0x47')]['toString']();}else if(_0x5cce22[_0x38e4('0x39')]===_0x38e4('0x48')&&_0x5cce22[_0x38e4('0x49')]&&_0x5cce22['idField']){_0x83d0f8[_0x5cce22[_0x38e4('0x49')]]&&(_0x2be4e4[_0x5cce22[_0x38e4('0x4a')]]=_0x83d0f8[_0x5cce22[_0x38e4('0x49')]]['toString']());}else if(_0x5cce22['type']==='customVariable'&&_0x5cce22[_0x38e4('0x4b')]&&_0x5cce22[_0x38e4('0x4b')][_0x38e4('0x4c')]&&_0x5cce22[_0x38e4('0x4a')]){_0x83d0f8[_0x5cce22[_0x38e4('0x4b')][_0x38e4('0x4c')][_0x38e4('0x3a')]()]&&(_0x2be4e4[_0x5cce22[_0x38e4('0x4a')]]=_0x83d0f8[_0x5cce22[_0x38e4('0x4b')]['name'][_0x38e4('0x3a')]()][_0x38e4('0x4d')]());}});}return _0x2be4e4;}function getConnection(_0x49708a){var _0x3d2c69=_0x49708a[_0x38e4('0x4e')][_0x38e4('0x4f')](_0x49708a['securityToken']);var _0x24e689=new jsforce[(_0x38e4('0x50'))]({'oauth2':{'loginUrl':_0x49708a[_0x38e4('0x51')]||_0x38e4('0x52'),'clientId':_0x49708a[_0x38e4('0x53')],'clientSecret':_0x49708a['clientSecret']}});return _0x24e689[_0x38e4('0x54')](_0x49708a[_0x38e4('0x55')],_0x3d2c69)[_0x38e4('0x21')](function(){logger[_0x38e4('0x1a')](_0x38e4('0x56'));return _0x24e689;});}exports[_0x38e4('0x57')]=function(_0x62f5e7,_0x248177,_0x4d5daf,_0x1b705e,_0x3a0aa0,_0xef0651){var _0x42f5cc,_0x2d9811,_0x219434,_0x2ff199;_0xef0651[_0x38e4('0x58')]=intUtil[_0x38e4('0x59')](_0xef0651['serverUrl']);_0xef0651[_0x38e4('0x51')]=intUtil['stripTrailingSlash'](_0xef0651[_0x38e4('0x51')]);if(_0x3a0aa0&&_0x3a0aa0['monitor_format']){logger['info'](_0x38e4('0x5a'),_0x38e4('0x5b'));_0x248177[_0x38e4('0x5c')]=util[_0x38e4('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xef0651[_0x38e4('0x58')],_0x248177[_0x38e4('0x5d')],md5(_0x248177[_0x38e4('0x5d')]));}else{_0x248177['recordingURL']='';}return getConnection(_0xef0651)['then'](function(_0x2efc9c){_0x2ff199=_0x2efc9c;return getUser(_0xef0651,_0x1b705e['email'],_0x2ff199);})[_0x38e4('0x21')](function(_0x234ff0){_0x42f5cc=_0x234ff0;return getEndUser(_0xef0651,_0x4d5daf,_0x248177[_0x38e4('0x5e')],_0x248177[_0x38e4('0x5f')],_0x2ff199);})[_0x38e4('0x21')](function(_0x3000dd){_0x2d9811=_0x3000dd;return getTicket(_0xef0651,_0x42f5cc,_0x2d9811,_0x4d5daf,_0x248177,_0x4d5daf['Fields'],_0x2ff199,'queue');})['then'](function(_0x29642d){_0x219434=_0x29642d;logger[_0x38e4('0x1a')](_0x38e4('0x60'),_0x219434['id']);logger[_0x38e4('0x1a')](_0x38e4('0x61'),_0x219434['id'],_0x1b705e[_0x38e4('0x4c')],_0xef0651['type']);switch(_0xef0651['type']){case'integrationTab':emit(util[_0x38e4('0x3f')]('user:%s',_0x1b705e[_0x38e4('0x4c')]),_0x38e4('0x62'),{'recordId':_0x219434['id']});break;case _0x38e4('0x63'):emit(util[_0x38e4('0x3f')]('user:%s',_0x1b705e[_0x38e4('0x4c')]),'trigger:browser:url',{'uri':util[_0x38e4('0x3f')]('%s/%s/e',_0x2ff199[_0x38e4('0x64')],_0x219434['id'])});break;default:logger[_0x38e4('0x65')](_0x38e4('0x66'));}})[_0x38e4('0x67')](function(_0x487cd6){logger['error']('[QUEUE]',_0x487cd6);});};exports['outbound']=function(_0x3f30df,_0x2a0872,_0x51e7e5,_0x585004,_0xb98448,_0x24390f,_0x428f33){var _0x430b8d,_0x490f1d,_0x12887a,_0x41cd72;_0x24390f[_0x38e4('0x58')]=intUtil['stripTrailingSlash'](_0x24390f[_0x38e4('0x58')]);_0x24390f['remoteUri']=intUtil['stripTrailingSlash'](_0x24390f[_0x38e4('0x51')]);if(_0x428f33&&_0x428f33[_0x38e4('0x68')]&&_0x428f33[_0x38e4('0x68')]!==_0x38e4('0x69')){logger[_0x38e4('0x1a')](_0x38e4('0x6a'),_0x38e4('0x5b'));_0x2a0872[_0x38e4('0x5c')]=util[_0x38e4('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24390f[_0x38e4('0x58')],_0x2a0872[_0x38e4('0x5d')],md5(_0x2a0872[_0x38e4('0x5d')]));}return getConnection(_0x24390f)[_0x38e4('0x21')](function(_0x1adef5){_0x41cd72=_0x1adef5;return getUser(_0x24390f,_0x585004[_0x38e4('0x6b')],_0x41cd72);})['then'](function(_0x378ac1){_0x430b8d=_0x378ac1;return getEndUser(_0x24390f,_0x51e7e5,_0x2a0872[_0x38e4('0x6c')],_0x2a0872[_0x38e4('0x6d')],_0x41cd72);})[_0x38e4('0x21')](function(_0x49fa8f){_0x490f1d=_0x49fa8f;return getTicket(_0x24390f,_0x430b8d,_0x490f1d,_0x51e7e5,_0x2a0872,_0x51e7e5[_0x38e4('0x6e')],_0x41cd72,_0x38e4('0x6f'));})['then'](function(_0x44d0ff){_0x12887a=_0x44d0ff;logger[_0x38e4('0x1a')](_0x38e4('0x70'),_0x12887a['id']);logger[_0x38e4('0x1a')](_0x38e4('0x71'),_0x12887a['id'],_0x585004[_0x38e4('0x4c')],_0x24390f[_0x38e4('0x39')]);switch(_0x24390f['type']){case _0x38e4('0x72'):emit(util[_0x38e4('0x3f')](_0x38e4('0x73'),_0x585004[_0x38e4('0x4c')]),'trigger:salesforce:display',{'recordId':_0x12887a['id']});break;case _0x38e4('0x63'):emit(util['format']('user:%s',_0x585004[_0x38e4('0x4c')]),_0x38e4('0x74'),{'uri':util[_0x38e4('0x3f')](_0x38e4('0x75'),_0x41cd72[_0x38e4('0x64')],_0x12887a['id'])});break;default:logger[_0x38e4('0x65')](_0x38e4('0x6a'),_0x38e4('0x76'));}})[_0x38e4('0x67')](function(_0x9a8ca4){logger[_0x38e4('0x65')](_0x38e4('0x6a'),_0x9a8ca4);});};exports[_0x38e4('0x77')]=function(_0x5a5dca,_0x42ff5b,_0x216cbf,_0x27cc03,_0x55c6a8,_0x35d88c){var _0xed02fa,_0x93d1d2,_0x4fb28b,_0x5deb90;_0x35d88c[_0x38e4('0x58')]=intUtil[_0x38e4('0x59')](_0x35d88c[_0x38e4('0x58')]);_0x35d88c[_0x38e4('0x51')]=intUtil['stripTrailingSlash'](_0x35d88c[_0x38e4('0x51')]);if(_0x55c6a8&&_0x55c6a8[_0x38e4('0x78')]){logger[_0x38e4('0x1a')]('['+_0x42ff5b['lastevent'][_0x38e4('0x79')]()+']','Recording\x20is\x20enabled!');_0x42ff5b['recordingURL']=util[_0x38e4('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d88c[_0x38e4('0x58')],_0x42ff5b[_0x38e4('0x5d')],md5(_0x42ff5b[_0x38e4('0x5d')]));}else{_0x42ff5b[_0x38e4('0x5c')]='';}return getConnection(_0x35d88c)[_0x38e4('0x21')](function(_0x1146ac){_0x5deb90=_0x1146ac;if(!_[_0x38e4('0x1e')](_0x27cc03)){return getUser(_0x35d88c,_0x27cc03[_0x38e4('0x4c')],_0x5deb90);}else{return getUser(_0x35d88c,null,_0x5deb90);}})['then'](function(_0x4065ba){_0xed02fa=_0x4065ba;return getEndUser(_0x35d88c,_0x216cbf,_0x42ff5b[_0x38e4('0x5e')],_0x42ff5b[_0x38e4('0x5f')],_0x5deb90);})[_0x38e4('0x21')](function(_0x49f016){_0x93d1d2=_0x49f016;return getTicket(_0x35d88c,_0xed02fa,_0x93d1d2,_0x216cbf,_0x42ff5b,_0x216cbf['Fields'],_0x5deb90);})[_0x38e4('0x21')](function(_0x4a3bb1){_0x4fb28b=_0x4a3bb1;logger[_0x38e4('0x1a')]('['+_0x42ff5b[_0x38e4('0x7a')]['toUpperCase']()+_0x38e4('0x7b'),_0x4fb28b['id']);logger[_0x38e4('0x1a')]('['+_0x42ff5b['lastevent']['toUpperCase']()+_0x38e4('0x7c'),_0x35d88c[_0x38e4('0x39')]);})[_0x38e4('0x67')](function(_0x52ff8b){logger[_0x38e4('0x65')]('['+_0x42ff5b[_0x38e4('0x7a')]['toUpperCase']()+']',_0x52ff8b);});}; \ No newline at end of file +var _0xf5b7=['trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase','lodash','moment','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','upperFirst','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab'];(function(_0x3cb992,_0x2d1311){var _0x4ccfa4=function(_0x222662){while(--_0x222662){_0x3cb992['push'](_0x3cb992['shift']());}};_0x4ccfa4(++_0x2d1311);}(_0xf5b7,0x19a));var _0x7f5b=function(_0x4332f9,_0x283d3a){_0x4332f9=_0x4332f9-0x0;var _0x1cb20c=_0xf5b7[_0x4332f9];return _0x1cb20c;};'use strict';var _=require(_0x7f5b('0x0'));var rp=require('request-promise');var moment=require(_0x7f5b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x7f5b('0x2'));var util=require(_0x7f5b('0x3'));var Redis=require(_0x7f5b('0x4'));var intUtil=require(_0x7f5b('0x5'));var config=require(_0x7f5b('0x6'));var logger=require(_0x7f5b('0x7'))(_0x7f5b('0x8'));config[_0x7f5b('0x9')]=_[_0x7f5b('0xa')](config['redis'],{'host':_0x7f5b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7f5b('0x9')]));function emit(_0x4471c9,_0x4c4cc2,_0x3016f1){io['to'](_0x4471c9)['emit'](_0x4c4cc2,_0x3016f1);}function getTicket(_0x2e59d4,_0x2af1b2,_0x332f0c,_0x47dea8,_0x1ba801,_0x1535b8,_0x3009fa,_0x56d26d){var _0x2cf2f1=Object[_0x7f5b('0xc')]({},{'OwnerId':_0x2af1b2['id'],'Subject':intUtil[_0x7f5b('0xd')](_0x47dea8[_0x7f5b('0xe')],_0x1ba801,'\x20'),'Description':intUtil[_0x7f5b('0xd')](_0x47dea8[_0x7f5b('0xf')],_0x1ba801,'\x0a')},getCustomFields(_0x1535b8,_0x1ba801));if(_0x332f0c){if(_0x47dea8[_0x7f5b('0x10')]==='Task'){_0x2cf2f1[_0x7f5b('0x11')]=moment[_0x7f5b('0x12')]();_0x2cf2f1[_0x7f5b('0x13')]=![];_0x2cf2f1[_0x7f5b('0x14')]=![];if(_0x332f0c[_0x7f5b('0x15')]===_0x7f5b('0x16')||_0x332f0c[_0x7f5b('0x15')]===_0x7f5b('0x17')){_0x2cf2f1[_0x7f5b('0x18')]=_0x332f0c['id'];}else if(_0x332f0c[_0x7f5b('0x15')]===_0x7f5b('0x19')){_0x2cf2f1['WhatId']=_0x332f0c['id'];}}else if(_0x47dea8[_0x7f5b('0x10')]===_0x7f5b('0x1a')){if(_0x332f0c['endUserType']==='contact'){_0x2cf2f1[_0x7f5b('0x1b')]=_0x332f0c['id'];}else if(_0x332f0c['endUserType']==='account'){_0x2cf2f1[_0x7f5b('0x1c')]=_0x332f0c['id'];}else if(_0x332f0c[_0x7f5b('0x15')]===_0x7f5b('0x17')&&_0x47dea8[_0x7f5b('0x1d')]){_0x2cf2f1[_0x47dea8[_0x7f5b('0x1d')]]=_0x332f0c['id'];}else{logger['info'](_0x7f5b('0x1e'));}}}return _0x3009fa[_0x7f5b('0x1f')](_0x47dea8[_0x7f5b('0x10')])[_0x7f5b('0x20')](_0x2cf2f1);}function getUser(_0x2c8457,_0x14d3eb,_0x3aa24b){if(!_[_0x7f5b('0x21')](_0x14d3eb)&&intUtil[_0x7f5b('0x22')](_0x14d3eb)){var _0x94966f={'Email':_0x14d3eb};var _0x1c918e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3aa24b[_0x7f5b('0x1f')]('User')[_0x7f5b('0x23')](_0x94966f,_0x1c918e)[_0x7f5b('0x24')]()[_0x7f5b('0x25')](function(_0xf10fb0){if(_0xf10fb0[_0x7f5b('0x26')]){var _0x377af7=_[_0x7f5b('0x23')](_0xf10fb0,function(_0x4b8090){return _0x4b8090[_0x7f5b('0x27')]===_0x14d3eb;});if(_0x377af7){logger[_0x7f5b('0x28')](_0x7f5b('0x29'),_0x14d3eb);return BPromise['resolve']({'id':_0x377af7['Id'],'name':_0x377af7[_0x7f5b('0x2a')]});}}else{logger[_0x7f5b('0x28')](_0x7f5b('0x2b'),_0x14d3eb);return _0x3aa24b[_0x7f5b('0x2c')]()['then'](function(_0x1eb871){return BPromise['resolve']({'id':_0x1eb871[_0x7f5b('0x2d')],'name':_0x1eb871[_0x7f5b('0x2e')]});});}});}else{logger[_0x7f5b('0x28')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x14d3eb);return _0x3aa24b[_0x7f5b('0x2c')]()[_0x7f5b('0x25')](function(_0x506c31){return BPromise['resolve']({'id':_0x506c31[_0x7f5b('0x2d')],'name':_0x506c31['display_name']});});}}function getEndUser(_0x14cfc2,_0x490e51,_0x5a269f,_0x181088,_0x59151f){var _0x14e211={'$or':{'Phone':_0x181088}};var _0x54aac7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7f5b('0x2f')]()[_0x7f5b('0x25')](function(){logger[_0x7f5b('0x28')](_0x7f5b('0x30'),_0x181088,_0x490e51[_0x7f5b('0x31')]);switch(_0x490e51['moduleSearch']){case _0x7f5b('0x32'):var _0x3a1636=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51[_0x7f5b('0x34')]){var _0x2ece8d={};_0x2ece8d[_0x490e51[_0x7f5b('0x34')]]=_0x181088;_[_0x7f5b('0x35')](_0x3a1636[_0x7f5b('0x36')],_0x2ece8d);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x37'))[_0x7f5b('0x23')](_0x3a1636,_0x54aac7)[_0x7f5b('0x24')]()[_0x7f5b('0x25')](function(_0x5d1cf8){if(_0x5d1cf8&&_0x5d1cf8[_0x7f5b('0x26')]){return _0x5d1cf8;}else{var _0x2f92bc=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51[_0x7f5b('0x38')]){var _0x365b9f={};_0x365b9f[_0x490e51[_0x7f5b('0x38')]]=_0x181088;_['merge'](_0x2f92bc[_0x7f5b('0x36')],_0x365b9f);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x39'))[_0x7f5b('0x23')](_0x2f92bc,_0x54aac7);}});case _0x7f5b('0x3a'):var _0x262820=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51['additionalSearchAccount']){var _0x2ece8d={};_0x2ece8d[_0x490e51[_0x7f5b('0x3b')]]=_0x181088;_[_0x7f5b('0x35')](_0x262820['$or'],_0x2ece8d);}return _0x59151f['sobject'](_0x7f5b('0x3c'))[_0x7f5b('0x23')](_0x262820,_0x54aac7)[_0x7f5b('0x24')]()[_0x7f5b('0x25')](function(_0x8aab66){if(_0x8aab66&&_0x8aab66[_0x7f5b('0x26')]){return _0x8aab66;}else{var _0x566bc4=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51[_0x7f5b('0x34')]){var _0x4063f4={};_0x4063f4[_0x490e51[_0x7f5b('0x34')]]=_0x181088;_[_0x7f5b('0x35')](_0x566bc4['$or'],_0x4063f4);}return _0x59151f['sobject'](_0x7f5b('0x37'))[_0x7f5b('0x23')](_0x566bc4,_0x54aac7)[_0x7f5b('0x25')](function(_0x3853d7){if(_0x3853d7&&_0x3853d7['length']){return _0x3853d7;}else{var _0x3be6ce=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51['additionalSearchLead']){var _0x327a93={};_0x327a93[_0x490e51[_0x7f5b('0x38')]]=_0x181088;_[_0x7f5b('0x35')](_0x3be6ce[_0x7f5b('0x36')],_0x327a93);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x39'))[_0x7f5b('0x23')](_0x3be6ce,_0x54aac7);}});}});case _0x7f5b('0x16'):var _0x3a1636=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51[_0x7f5b('0x34')]){var _0x2ece8d={};_0x2ece8d[_0x490e51[_0x7f5b('0x34')]]=_0x181088;_[_0x7f5b('0x35')](_0x3a1636['$or'],_0x2ece8d);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x37'))[_0x7f5b('0x23')](_0x3a1636,_0x54aac7)['execute']();case _0x7f5b('0x17'):var _0x4f566f=_['cloneDeep'](_0x14e211);if(_0x490e51['additionalSearchLead']){var _0x2ece8d={};_0x2ece8d[_0x490e51['additionalSearchLead']]=_0x181088;_[_0x7f5b('0x35')](_0x4f566f[_0x7f5b('0x36')],_0x2ece8d);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x39'))[_0x7f5b('0x23')](_0x4f566f,_0x54aac7);case _0x7f5b('0x19'):var _0x262820=_[_0x7f5b('0x33')](_0x14e211);if(_0x490e51[_0x7f5b('0x3b')]){var _0x2ece8d={};_0x2ece8d[_0x490e51[_0x7f5b('0x3b')]]=_0x181088;_['merge'](_0x262820['$or'],_0x2ece8d);}return _0x59151f[_0x7f5b('0x1f')](_0x7f5b('0x3c'))[_0x7f5b('0x23')](_0x262820,_0x54aac7);default:return null;}})[_0x7f5b('0x25')](function(_0x27bcc6){if(_0x27bcc6&&_0x27bcc6['length']){var _0x102c1d=_[_0x7f5b('0x3d')](_0x27bcc6);if(_0x102c1d){return BPromise[_0x7f5b('0x2f')]({'id':_0x102c1d['Id'],'name':_0x102c1d[_0x7f5b('0x2a')],'phone':_0x102c1d[_0x7f5b('0x3e')],'endUserType':_0x102c1d[_0x7f5b('0x3f')]['type'][_0x7f5b('0x40')]()});}}})[_0x7f5b('0x25')](function(_0xc65729){if(_0xc65729){logger[_0x7f5b('0x28')](_0x7f5b('0x41'),_0xc65729['endUserType'],_0x181088);return BPromise[_0x7f5b('0x2f')](_0xc65729);}else{logger['info'](_0x7f5b('0x42'),_0x181088);var _0x4df5ad={'Phone':_0x181088};if(_0x490e51[_0x7f5b('0x43')]){if(_0x490e51['moduleCreate']==='contact'){logger['info'](_0x7f5b('0x44'),_0x181088,_0x490e51[_0x7f5b('0x43')]);_0x4df5ad['LastName']=_0x5a269f!==''?_0x5a269f:util[_0x7f5b('0x45')](_0x7f5b('0x46'),_0x181088);}else if(_0x490e51['moduleCreate']===_0x7f5b('0x17')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x181088,_0x490e51['moduleCreate']);_0x4df5ad[_0x7f5b('0x47')]=_0x5a269f!==_0x7f5b('0x48')?_0x5a269f:util[_0x7f5b('0x45')](_0x7f5b('0x46'),_0x181088);_0x4df5ad[_0x7f5b('0x49')]=_0x7f5b('0x4a');}else if(_0x490e51[_0x7f5b('0x43')]===_0x7f5b('0x19')){logger[_0x7f5b('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x181088,_0x490e51[_0x7f5b('0x43')]);_0x4df5ad[_0x7f5b('0x2a')]=_0x5a269f!==_0x7f5b('0x48')?_0x5a269f:util[_0x7f5b('0x45')](_0x7f5b('0x46'),_0x181088);}else{return null;}}return _0x59151f[_0x7f5b('0x1f')](_[_0x7f5b('0x4b')](_0x490e51[_0x7f5b('0x43')]))[_0x7f5b('0x20')](_0x4df5ad)[_0x7f5b('0x25')](function(_0x59b067){return BPromise[_0x7f5b('0x2f')]({'id':_0x59b067['id'],'endUserType':_0x490e51['moduleCreate']});});}});}function getCustomFields(_0x1239a6,_0xe796fa){var _0x54214d={};if(_0x1239a6[_0x7f5b('0x26')]>0x0){_['forEach'](_0x1239a6,function(_0x5e76c5){if(_[_0x7f5b('0x4c')]([_0x7f5b('0x4d'),_0x7f5b('0x4e')],_0x5e76c5[_0x7f5b('0x4f')])&&_0x5e76c5[_0x7f5b('0x50')]){_0x54214d[_0x5e76c5[_0x7f5b('0x50')]]=_0x5e76c5[_0x7f5b('0x51')][_0x7f5b('0x52')]();}else if(_0x5e76c5['type']===_0x7f5b('0x53')&&_0x5e76c5[_0x7f5b('0x54')]&&_0x5e76c5['idField']){_0xe796fa[_0x5e76c5[_0x7f5b('0x54')]]&&(_0x54214d[_0x5e76c5[_0x7f5b('0x50')]]=_0xe796fa[_0x5e76c5[_0x7f5b('0x54')]][_0x7f5b('0x52')]());}else if(_0x5e76c5[_0x7f5b('0x4f')]===_0x7f5b('0x55')&&_0x5e76c5[_0x7f5b('0x56')]&&_0x5e76c5[_0x7f5b('0x56')][_0x7f5b('0x57')]&&_0x5e76c5['idField']){_0xe796fa[_0x5e76c5[_0x7f5b('0x56')][_0x7f5b('0x57')][_0x7f5b('0x40')]()]&&(_0x54214d[_0x5e76c5['idField']]=_0xe796fa[_0x5e76c5[_0x7f5b('0x56')][_0x7f5b('0x57')][_0x7f5b('0x40')]()][_0x7f5b('0x52')]());}});}return _0x54214d;}function getConnection(_0x4f70dd){var _0x3a3181=_0x4f70dd[_0x7f5b('0x58')][_0x7f5b('0x59')](_0x4f70dd[_0x7f5b('0x5a')]);var _0x23f7f4=new jsforce[(_0x7f5b('0x5b'))]({'oauth2':{'loginUrl':_0x4f70dd[_0x7f5b('0x5c')]||_0x7f5b('0x5d'),'clientId':_0x4f70dd[_0x7f5b('0x5e')],'clientSecret':_0x4f70dd[_0x7f5b('0x5f')]}});return _0x23f7f4['login'](_0x4f70dd[_0x7f5b('0x60')],_0x3a3181)['then'](function(){logger['info'](_0x7f5b('0x61'));return _0x23f7f4;});}exports[_0x7f5b('0x62')]=function(_0x255580,_0x36272c,_0x378f29,_0x2608c7,_0x2634b8,_0x3bebb1){var _0x6ca78e,_0x2c9e6f,_0x4fe7a0,_0x133f54;_0x3bebb1[_0x7f5b('0x63')]=intUtil[_0x7f5b('0x64')](_0x3bebb1[_0x7f5b('0x63')]);_0x3bebb1[_0x7f5b('0x5c')]=intUtil[_0x7f5b('0x64')](_0x3bebb1[_0x7f5b('0x5c')]);if(_0x2634b8&&_0x2634b8[_0x7f5b('0x65')]){logger[_0x7f5b('0x28')](_0x7f5b('0x66'),_0x7f5b('0x67'));_0x36272c[_0x7f5b('0x68')]=util['format'](_0x7f5b('0x69'),_0x3bebb1[_0x7f5b('0x63')],_0x36272c[_0x7f5b('0x6a')],md5(_0x36272c['uniqueid']));}else{_0x36272c['recordingURL']='';}return getConnection(_0x3bebb1)[_0x7f5b('0x25')](function(_0x2d4bea){_0x133f54=_0x2d4bea;return getUser(_0x3bebb1,_0x2608c7['email'],_0x133f54);})['then'](function(_0x487160){_0x6ca78e=_0x487160;return getEndUser(_0x3bebb1,_0x378f29,_0x36272c[_0x7f5b('0x6b')],_0x36272c['calleridnum'],_0x133f54);})[_0x7f5b('0x25')](function(_0x1033a2){_0x2c9e6f=_0x1033a2;return getTicket(_0x3bebb1,_0x6ca78e,_0x2c9e6f,_0x378f29,_0x36272c,_0x378f29['Fields'],_0x133f54,'queue');})[_0x7f5b('0x25')](function(_0x2695ee){_0x4fe7a0=_0x2695ee;logger[_0x7f5b('0x28')](_0x7f5b('0x6c'),_0x4fe7a0['id']);logger[_0x7f5b('0x28')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4fe7a0['id'],_0x2608c7[_0x7f5b('0x57')],_0x3bebb1['type']);switch(_0x3bebb1['type']){case _0x7f5b('0x6d'):emit(util[_0x7f5b('0x45')]('user:%s',_0x2608c7[_0x7f5b('0x57')]),_0x7f5b('0x6e'),{'recordId':_0x4fe7a0['id']});break;case'newTab':emit(util['format'](_0x7f5b('0x6f'),_0x2608c7[_0x7f5b('0x57')]),_0x7f5b('0x70'),{'uri':util[_0x7f5b('0x45')](_0x7f5b('0x71'),_0x133f54['instanceUrl'],_0x4fe7a0['id'])});break;default:logger[_0x7f5b('0x72')](_0x7f5b('0x73'));}})[_0x7f5b('0x74')](function(_0x1e9477){logger['error'](_0x7f5b('0x66'),_0x1e9477);});};exports[_0x7f5b('0x75')]=function(_0x621620,_0x29c255,_0x49ed24,_0x439ae5,_0x14c6a8,_0x22fb9f,_0x1c865d){var _0x2bdfdf,_0x1417e3,_0x305899,_0x65167b;_0x22fb9f[_0x7f5b('0x63')]=intUtil['stripTrailingSlash'](_0x22fb9f['serverUrl']);_0x22fb9f[_0x7f5b('0x5c')]=intUtil['stripTrailingSlash'](_0x22fb9f[_0x7f5b('0x5c')]);if(_0x1c865d&&_0x1c865d[_0x7f5b('0x76')]&&_0x1c865d[_0x7f5b('0x76')]!=='none'){logger['info'](_0x7f5b('0x77'),_0x7f5b('0x67'));_0x29c255[_0x7f5b('0x68')]=util[_0x7f5b('0x45')](_0x7f5b('0x69'),_0x22fb9f[_0x7f5b('0x63')],_0x29c255[_0x7f5b('0x6a')],md5(_0x29c255[_0x7f5b('0x6a')]));}return getConnection(_0x22fb9f)['then'](function(_0x11806c){_0x65167b=_0x11806c;return getUser(_0x22fb9f,_0x439ae5[_0x7f5b('0x78')],_0x65167b);})[_0x7f5b('0x25')](function(_0x57c530){_0x2bdfdf=_0x57c530;return getEndUser(_0x22fb9f,_0x49ed24,_0x29c255[_0x7f5b('0x79')],_0x29c255[_0x7f5b('0x7a')],_0x65167b);})['then'](function(_0x59a971){_0x1417e3=_0x59a971;return getTicket(_0x22fb9f,_0x2bdfdf,_0x1417e3,_0x49ed24,_0x29c255,_0x49ed24[_0x7f5b('0x7b')],_0x65167b,_0x7f5b('0x75'));})[_0x7f5b('0x25')](function(_0x40b20f){_0x305899=_0x40b20f;logger[_0x7f5b('0x28')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x305899['id']);logger[_0x7f5b('0x28')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x305899['id'],_0x439ae5[_0x7f5b('0x57')],_0x22fb9f[_0x7f5b('0x4f')]);switch(_0x22fb9f['type']){case'integrationTab':emit(util[_0x7f5b('0x45')](_0x7f5b('0x6f'),_0x439ae5[_0x7f5b('0x57')]),_0x7f5b('0x6e'),{'recordId':_0x305899['id']});break;case'newTab':emit(util['format']('user:%s',_0x439ae5[_0x7f5b('0x57')]),_0x7f5b('0x70'),{'uri':util['format'](_0x7f5b('0x71'),_0x65167b[_0x7f5b('0x7c')],_0x305899['id'])});break;default:logger['error'](_0x7f5b('0x77'),_0x7f5b('0x7d'));}})['catch'](function(_0x1818ea){logger[_0x7f5b('0x72')](_0x7f5b('0x77'),_0x1818ea);});};exports[_0x7f5b('0x7e')]=function(_0x1c5036,_0x41750a,_0x13bc5a,_0x30e9db,_0x19bfe4,_0x1c5f7f){var _0x5d53a6,_0x1959f7,_0x181e1f,_0x2fb9a2;_0x1c5f7f[_0x7f5b('0x63')]=intUtil[_0x7f5b('0x64')](_0x1c5f7f[_0x7f5b('0x63')]);_0x1c5f7f[_0x7f5b('0x5c')]=intUtil[_0x7f5b('0x64')](_0x1c5f7f['remoteUri']);if(_0x19bfe4&&_0x19bfe4[_0x7f5b('0x65')]){logger[_0x7f5b('0x28')]('['+_0x41750a[_0x7f5b('0x7f')]['toUpperCase']()+']',_0x7f5b('0x67'));_0x41750a[_0x7f5b('0x68')]=util[_0x7f5b('0x45')](_0x7f5b('0x69'),_0x1c5f7f[_0x7f5b('0x63')],_0x41750a['uniqueid'],md5(_0x41750a['uniqueid']));}else{_0x41750a[_0x7f5b('0x68')]='';}return getConnection(_0x1c5f7f)[_0x7f5b('0x25')](function(_0x2a42f8){_0x2fb9a2=_0x2a42f8;if(!_[_0x7f5b('0x21')](_0x30e9db)){return getUser(_0x1c5f7f,_0x30e9db[_0x7f5b('0x57')],_0x2fb9a2);}else{return getUser(_0x1c5f7f,null,_0x2fb9a2);}})['then'](function(_0x2b9ebc){_0x5d53a6=_0x2b9ebc;return getEndUser(_0x1c5f7f,_0x13bc5a,_0x41750a[_0x7f5b('0x6b')],_0x41750a[_0x7f5b('0x80')],_0x2fb9a2);})['then'](function(_0x4d0f4b){_0x1959f7=_0x4d0f4b;return getTicket(_0x1c5f7f,_0x5d53a6,_0x1959f7,_0x13bc5a,_0x41750a,_0x13bc5a[_0x7f5b('0x7b')],_0x2fb9a2);})[_0x7f5b('0x25')](function(_0x212e5c){_0x181e1f=_0x212e5c;logger[_0x7f5b('0x28')]('['+_0x41750a[_0x7f5b('0x7f')][_0x7f5b('0x81')]()+']\x20Ticket\x20%s\x20created.',_0x181e1f['id']);logger['info']('['+_0x41750a['lastevent'][_0x7f5b('0x81')]()+']\x20Integration\x20account\x20type\x20%s.',_0x1c5f7f[_0x7f5b('0x4f')]);})['catch'](function(_0x20e90d){logger[_0x7f5b('0x72')]('['+_0x41750a[_0x7f5b('0x7f')][_0x7f5b('0x81')]()+']',_0x20e90d);});}; \ 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 a92ebbb..385b438 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 _0x233a=['Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x233a,0x160));var _0xa233=function(_0x162eb6,_0x138f6f){_0x162eb6=_0x162eb6-0x0;var _0x511ae1=_0x233a[_0x162eb6];return _0x511ae1;};'use strict';var _=require('lodash');var Promise=require(_0xa233('0x0'));var rp=require(_0xa233('0x1'));var util=require(_0xa233('0x2'));var md5=require('md5');var Redis=require(_0xa233('0x3'));var intUtil=require(_0xa233('0x4'));var config=require('../../../../config/environment');var logger=require(_0xa233('0x5'))('servicenow');config[_0xa233('0x6')]=_['defaults'](config[_0xa233('0x6')],{'host':_0xa233('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa233('0x6')]));function getAdminUser(_0x4cd332,_0x28c35f,_0x566cfc,_0x3a221e,_0x58f2ff,_0x8f8780){return new Promise(function(_0x38559f,_0x8abbc7){var _0x522d62={'method':_0xa233('0x8'),'uri':_0x3a221e+_0xa233('0x9')+'&'+_0x58f2ff+'&'+_0x8f8780,'auth':_0x28c35f,'json':!![]};return rp(_0x522d62)[_0xa233('0xa')](function(_0xc4f8d9){if(_0xc4f8d9['result'][_0xa233('0xb')]>0x0){_0x566cfc[_0xa233('0xc')]=_0xc4f8d9[_0xa233('0xd')][0x0][_0xa233('0xe')];}logger[_0xa233('0xf')]('['+[_0x4cd332['toUpperCase']()]+_0xa233('0x10'),_0x566cfc);_0x38559f(_0x566cfc);})[_0xa233('0x11')](function(_0x1a922f){logger[_0xa233('0x12')]('['+[_0x4cd332[_0xa233('0x13')]()]+']',_0x1a922f['message']);_0x8abbc7(_0x1a922f[_0xa233('0x14')]);});});}function getUser(_0x1be498,_0x3f107f,_0x1935f4,_0x3b658e,_0x46f314){return function(_0x4f3807){logger['info']('['+[_0x1be498[_0xa233('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x4f3807);return new Promise(function(_0x18413d,_0x1c717a){if(intUtil[_0xa233('0x15')](_0x4f3807[_0xa233('0x16')])){var _0x401995={'method':'GET','uri':_0x1935f4+_0xa233('0x17')+_0x4f3807[_0xa233('0x16')]+'&'+_0x3b658e+'&'+_0x46f314,'auth':_0x3f107f,'json':!![]};logger[_0xa233('0xf')]('['+[_0x1be498[_0xa233('0x13')]()]+_0xa233('0x18'),_0x401995);return rp(_0x401995)['then'](function(_0x53ee55){logger[_0xa233('0xf')]('['+[_0x1be498['toUpperCase']()]+_0xa233('0x19'),_0x53ee55);if(_0x53ee55[_0xa233('0xd')][_0xa233('0xb')]>0x0&&String(_0x53ee55['result'][0x0][_0xa233('0x1a')])===_0xa233('0x1b')){_0x4f3807[_0xa233('0x1c')]=_0x53ee55[_0xa233('0xd')][0x0][_0xa233('0xe')];}else{_0x4f3807[_0xa233('0x1c')]=_0x4f3807[_0xa233('0xc')];_0x4f3807[_0xa233('0x16')]=_0x4f3807['adminEmail'];}logger['info']('['+[_0x1be498[_0xa233('0x13')]()]+'],\x20getUser\x20crm',_0x4f3807);_0x18413d(_0x4f3807);})['catch'](function(_0x387365){logger[_0xa233('0x12')]('['+[_0x1be498[_0xa233('0x13')]()]+']',_0x387365[_0xa233('0x14')]);_0x1c717a(_0x387365[_0xa233('0x14')]);});}else{logger[_0xa233('0xf')]('['+[_0x1be498[_0xa233('0x13')]()]+']\x20using\x20admin\x20profile');_0x4f3807[_0xa233('0x1c')]=_0x4f3807[_0xa233('0xc')];_0x4f3807[_0xa233('0x16')]=_0x4f3807[_0xa233('0x1d')];_0x18413d(_0x4f3807);}});};}function createEndUser(_0x241d16,_0x2467b0,_0x53d01d,_0x386a94,_0x208be4){logger['info']('['+[_0x241d16[_0xa233('0x13')]()]+_0xa233('0x1e'),_0x53d01d);return new Promise(function(_0x2671c5,_0x178b22){var _0x316423={'method':'POST','uri':_0x386a94+_0xa233('0x1f')+_0x208be4,'body':{'user_name':_0x53d01d[_0xa233('0x20')],'roles':_0xa233('0x21'),'first_name':_0x53d01d[_0xa233('0x20')],'active':_0xa233('0x1b'),'date_format':_0xa233('0x22'),'phone':_0x53d01d['endUserNumber']},'auth':_0x2467b0,'json':!![]};return rp(_0x316423)['then'](function(_0x575cc4){logger[_0xa233('0xf')]('['+[_0x241d16['toUpperCase']()]+_0xa233('0x23'),_0x575cc4[_0xa233('0xd')]);_0x53d01d[_0xa233('0x24')]=_0x575cc4[_0xa233('0xd')][_0xa233('0xe')];_0x2671c5(_0x53d01d);})[_0xa233('0x11')](function(_0x48eb20){logger['error']('['+[_0x241d16[_0xa233('0x13')]()]+']',_0x48eb20[_0xa233('0x14')]);_0x178b22(_0x48eb20[_0xa233('0x14')]);});});}function getEndUser(_0x53aed5,_0x4b2806,_0x48af5e,_0x25d0a7,_0x5cd07d){return function(_0x16fae8){logger[_0xa233('0xf')]('['+[_0x53aed5[_0xa233('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x16fae8);return new Promise(function(_0x113abd,_0x5de829){var _0x3772b8={'method':_0xa233('0x8'),'uri':_0x48af5e+'sys_user?sysparm_query=phone%3D'+_0x16fae8[_0xa233('0x20')]+'&'+_0x25d0a7+'&'+_0x5cd07d,'auth':_0x4b2806,'json':!![]};return rp(_0x3772b8)[_0xa233('0xa')](function(_0xe9fa80){if(_0xe9fa80[_0xa233('0xd')][_0xa233('0xb')]>0x0){_0x16fae8[_0xa233('0x24')]=_0xe9fa80['result'][0x0]['sys_id'];logger[_0xa233('0xf')]('['+[_0x53aed5[_0xa233('0x13')]()]+_0xa233('0x25'),_0x16fae8);_0x113abd(_0x16fae8);}else{return createEndUser(_0x53aed5,_0x4b2806,_0x16fae8,_0x48af5e,_0x25d0a7)[_0xa233('0xa')](function(_0x365031){logger[_0xa233('0xf')]('['+[_0x53aed5[_0xa233('0x13')]()]+_0xa233('0x26'),_0x365031);_0x113abd(_0x365031);});}})[_0xa233('0x11')](function(_0xd19135){logger['error']('['+[_0x53aed5[_0xa233('0x13')]()]+']',_0xd19135[_0xa233('0x14')]);_0x5de829(_0xd19135[_0xa233('0x14')]);});});};}function getCustomFields(_0xa3426b,_0x535d37){var _0x532ffd={};if(_0xa3426b[_0xa233('0xb')]>0x0){_['forEach'](_0xa3426b,function(_0x383ab3){if(_[_0xa233('0x27')]([_0xa233('0x28'),_0xa233('0x29')],_0x383ab3['type'])&&_0x383ab3[_0xa233('0x2a')]&&!_0x383ab3['customField']){_0x532ffd[_0x383ab3[_0xa233('0x2a')][_0xa233('0x2b')]()]=_0x383ab3[_0xa233('0x2c')][_0xa233('0x2d')]();}else if(_[_0xa233('0x27')](['string',_0xa233('0x29')],_0x383ab3[_0xa233('0x2e')])&&_0x383ab3[_0xa233('0x2f')]&&_0x383ab3[_0xa233('0x30')]){_0x532ffd[_0x383ab3[_0xa233('0x2f')][_0xa233('0x2b')]()]=_0x383ab3[_0xa233('0x2c')][_0xa233('0x2d')]();}else if(_0x383ab3['type']===_0xa233('0x31')&&_0x383ab3['variableName']&&_0x383ab3[_0xa233('0x2f')]&&_0x383ab3[_0xa233('0x30')]){_0x532ffd[_0x383ab3[_0xa233('0x2f')]['toLowerCase']()]=_0x535d37[_0x383ab3[_0xa233('0x32')]][_0xa233('0x2d')]();}else if(_0x383ab3[_0xa233('0x2e')]===_0xa233('0x33')&&_0x383ab3[_0xa233('0x34')]&&_0x383ab3['Variable'][_0xa233('0x35')]&&_0x383ab3[_0xa233('0x2f')]&&_0x383ab3['customField']){_0x532ffd[_0x383ab3[_0xa233('0x2f')][_0xa233('0x2b')]()]=_0x535d37[_0x383ab3[_0xa233('0x34')]['name'][_0xa233('0x2b')]()]['toString']();}});}return _0x532ffd;}function getTicket(_0x4bad82,_0x1ab7a5,_0x4bfff1,_0x18b15c,_0x3d0630,_0xb05148){return function(_0x4bc6c1){logger[_0xa233('0xf')]('['+[_0x4bad82[_0xa233('0x13')]()]+_0xa233('0x36'),_0x4bc6c1);return new Promise(function(_0x2c8586,_0x15e05a){var _0x3de54b=_0x4bad82[_0xa233('0x2b')]()==='outbound'?_0x4bc6c1[_0xa233('0x1c')]:_0x4bc6c1[_0xa233('0x24')];var _0x5d716d={'method':_0xa233('0x37'),'uri':_0x4bfff1+'incident'+'?'+_0xb05148,'body':Object['assign']({},{'active':_0xa233('0x1b'),'caller_id':_0x3de54b,'assigned_to':_0x4bc6c1[_0xa233('0x1c')],'short_description':intUtil['getString'](_0x18b15c[_0xa233('0x38')],_0x3d0630,'\x20'),'description':intUtil[_0xa233('0x39')](_0x18b15c[_0xa233('0x3a')],_0x3d0630,'\x0a')},getCustomFields(_0x18b15c['Fields'],_0x3d0630)),'auth':_0x1ab7a5,'json':!![]};return rp(_0x5d716d)[_0xa233('0xa')](function(_0x1c6ddf){logger[_0xa233('0xf')]('['+[_0x4bad82[_0xa233('0x13')]()]+_0xa233('0x3b'),_0x1c6ddf[_0xa233('0xd')]);_0x4bc6c1[_0xa233('0x3c')]=_0x1c6ddf[_0xa233('0xd')][_0xa233('0xe')];_0x4bc6c1[_0xa233('0x3d')]=_0x1c6ddf[_0xa233('0xd')]['number'];logger['info']('['+[_0x4bad82[_0xa233('0x13')]()]+']\x20getTicket\x20crm',_0x4bc6c1);_0x2c8586(_0x4bc6c1);})[_0xa233('0x11')](function(_0xd6cb07){logger[_0xa233('0x12')]('['+[_0x4bad82[_0xa233('0x13')]()]+']',_0xd6cb07['message']);_0x15e05a(_0xd6cb07[_0xa233('0x14')]);});});};}function createRemoteTag(_0x53207b,_0x230189,_0x2a55f1,_0xa566e8){return new Promise(function(_0x3cdf26,_0x44e86a){var _0x9ac014={'method':_0xa233('0x37'),'uri':_0x2a55f1+_0xa233('0x3e')+'?'+_0xa566e8,'body':{'short_description':_0x53207b,'global':!![],'active':!![],'name':_0x53207b},'auth':_0x230189,'json':!![]};return rp(_0x9ac014)[_0xa233('0xa')](function(_0xcc2d0b){var _0x5cad0e=_0xcc2d0b[_0xa233('0xd')][_0xa233('0xe')];_0x3cdf26(_0x5cad0e);});});}function getRemoteTag(_0x145aed,_0x120f22,_0xc15b05,_0xa48e84,_0x12b4e8){return new Promise(function(_0x17682b,_0xd09e4c){var _0x4565b3={'method':'GET','uri':_0xc15b05+_0xa233('0x3e')+_0xa233('0x3f')+_0x145aed+'&'+_0xa48e84,'auth':_0x120f22,'json':!![]};return rp(_0x4565b3)[_0xa233('0xa')](function(_0x5153be){if(_0x5153be['result'][_0xa233('0xb')]>0x0){var _0x2705b2=_0x5153be['result'][0x0][_0xa233('0xe')];_0x17682b(_0x2705b2);}else{return createRemoteTag(_0x145aed,_0x120f22,_0xc15b05,_0xa48e84)[_0xa233('0xa')](function(_0x498c64){_0x17682b(_0x498c64);});}});});}function assignTagToIncident(_0x42ba0b,_0x4a72bc,_0x91fe43,_0xff85db,_0x345513){return new Promise(function(_0x36f067,_0x3803a3){var _0xd878ca={'method':'POST','uri':_0x91fe43+_0xa233('0x40')+'?'+_0x345513,'body':{'label':_0x42ba0b,'table':'incident','id_type':'Incident','table_key':_0xff85db[_0xa233('0x3c')],'title':_0xa233('0x41')+_0xff85db['ticketNumber'],'id_display':_0xff85db[_0xa233('0x3d')]},'auth':_0x4a72bc,'json':!![]};return rp(_0xd878ca)[_0xa233('0xa')](function(_0x2682b2){_0x36f067();})['catch'](function(){_0x36f067();});});}function manageTags(_0x249aa1,_0x33479b,_0xefc3b6,_0x1bd5f4,_0x138697,_0xfba1f2,_0x23f4a6){return new Promise(function(_0x1ebb83,_0x19bc9b){var _0x22f4af=[];_0x33479b[_0xa233('0x42')](function(_0x30a696){_0x22f4af['push'](getRemoteTag(_0x30a696,_0xefc3b6,_0x1bd5f4,_0xfba1f2,_0x23f4a6));});return Promise[_0xa233('0x43')](_0x22f4af)[_0xa233('0xa')](function(_0x4e1e18){if(_0x4e1e18[_0xa233('0xb')]){logger[_0xa233('0xf')]('['+[_0x249aa1[_0xa233('0x13')]()]+_0xa233('0x44'),_0x4e1e18);var _0x3ae58e=[];_0x4e1e18[_0xa233('0x42')](function(_0x4516d8){_0x3ae58e[_0xa233('0x45')](assignTagToIncident(_0x4516d8,_0xefc3b6,_0x1bd5f4,_0x138697,_0xfba1f2));});return Promise[_0xa233('0x43')](_0x3ae58e)[_0xa233('0xa')](function(){_0x1ebb83();})['catch'](function(){_0x1ebb83();});}else{_0x1ebb83();}});});}function getTags(_0x4232b0,_0xff91e3,_0x59a8f9,_0x1c087e,_0x520dac,_0x209574){return function(_0x1b8828){return new Promise(function(_0xb9e438,_0x41b89f){var _0x1244b8=[];var _0x4aeba0=_0x1c087e[_0xa233('0x46')];if(_0x4aeba0&&_0x4aeba0[_0xa233('0xb')]>0x0){_0x1244b8=_[_0xa233('0x47')](_0x4aeba0,'name');}if(_0x1244b8[_0xa233('0xb')]>0x0){return manageTags(_0x4232b0,_0x1244b8,_0xff91e3,_0x59a8f9,_0x1b8828,_0x520dac,_0x209574)['then'](function(){_0xb9e438(_0x1b8828);});}else{_0xb9e438(_0x1b8828);}});};}function emit(_0x45d88d,_0xd33f94,_0x53dc39){var _0x2eb037='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xa233('0x48')+_0xa233('0x49');var _0x37542c={'uri':_0x45d88d+_0xa233('0x4a')+_0x53dc39+_0x2eb037};io['to'](util[_0xa233('0x4b')]('user:%s',_0xd33f94))[_0xa233('0x4c')]('trigger:browser:url',_0x37542c);}exports['cs']=function(_0x4e6e60,_0xdcdf01,_0x20ca4d,_0x509bc6,_0x324fba,_0x9cacdf,_0x4f5762,_0x50626e){var _0x553d71={};var _0x17a53e={'user':_0x9cacdf[_0xa233('0x4d')],'pass':_0x9cacdf[_0xa233('0x4e')]};var _0x34e41d=_0xa233('0x4f');var _0x101f32=_0xa233('0x50');_0x9cacdf[_0xa233('0x51')]=intUtil[_0xa233('0x52')](_0x9cacdf[_0xa233('0x51')]);_0x9cacdf[_0xa233('0x53')]=intUtil[_0xa233('0x52')](_0x9cacdf['serverUrl']);var _0x1e177d=util[_0xa233('0x4b')](_0xa233('0x54'),_0x9cacdf['remoteUri']);_0x553d71[_0xa233('0x16')]=!_['isNil'](_0x509bc6)?_0x509bc6[_0xa233('0x55')]:null;_0x553d71[_0xa233('0x1d')]=_0x9cacdf[_0xa233('0x55')];_0x553d71[_0xa233('0x20')]=_0x50626e[_0xa233('0x2b')]()==='outbound'?_0xdcdf01[_0xa233('0x56')]:_0xdcdf01[_0xa233('0x57')];_0x553d71[_0xa233('0x58')]=_0x50626e===_0xa233('0x59')||_0x50626e==='unmanaged'?_0xa233('0x59'):'outbound';var _0x26ada0=util['format'](_0xa233('0x5a'),_0x9cacdf[_0xa233('0x53')],_0xdcdf01['uniqueid'],md5(_0xdcdf01[_0xa233('0x5b')]));if(_0x324fba&&_0x324fba[_0xa233('0x5c')]){logger[_0xa233('0xf')](_0xa233('0x5d'),_0xa233('0x5e'));_0xdcdf01[_0xa233('0x5f')]=_0x26ada0;}else if(_0x4f5762&&_0x4f5762['recordingFormat']&&_0x4f5762['recordingFormat']!==_0xa233('0x60')){logger[_0xa233('0xf')]('[OUTBOUND]',_0xa233('0x5e'));_0xdcdf01['recordingURL']=_0x26ada0;}else{_0xdcdf01[_0xa233('0x5f')]='';}return getAdminUser(_0x50626e,_0x17a53e,_0x553d71,_0x1e177d,_0x101f32,_0x34e41d)[_0xa233('0xa')](getUser(_0x50626e,_0x17a53e,_0x1e177d,_0x101f32,_0x34e41d))[_0xa233('0xa')](getEndUser(_0x50626e,_0x17a53e,_0x1e177d,_0x101f32,_0x34e41d))[_0xa233('0xa')](getTicket(_0x50626e,_0x17a53e,_0x1e177d,_0x20ca4d,_0xdcdf01,_0x101f32))['then'](function(_0x4de56c){logger[_0xa233('0xf')](util[_0xa233('0x4b')](_0xa233('0x61'),_0x4de56c[_0xa233('0x3c')]));logger[_0xa233('0xf')](util['format'](_0xa233('0x62'),_0x50626e));if(_0x50626e!=='unmanaged'){logger[_0xa233('0xf')]('['+[_0x50626e[_0xa233('0x13')]()]+']',_0xa233('0x63'));emit(_0x9cacdf[_0xa233('0x51')],_0x509bc6['name'],_0x4de56c[_0xa233('0x3c')]);}})[_0xa233('0x11')](function(_0xb278ee){logger[_0xa233('0x12')]('['+[_0x50626e[_0xa233('0x13')]()]+_0xa233('0x64'),util[_0xa233('0x65')](_0xb278ee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8d8d=['string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','variable','variableName','idField','Variable','name','outbound','POST','incident','assign','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','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','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','adminEmail','error',']\x20using\x20admin\x20profile','userId','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach'];(function(_0x31ca8e,_0x1d2bcf){var _0x13a648=function(_0x4d9198){while(--_0x4d9198){_0x31ca8e['push'](_0x31ca8e['shift']());}};_0x13a648(++_0x1d2bcf);}(_0x8d8d,0x18c));var _0xd8d8=function(_0x48d517,_0x4046dc){_0x48d517=_0x48d517-0x0;var _0x1a79ea=_0x8d8d[_0x48d517];return _0x1a79ea;};'use strict';var _=require(_0xd8d8('0x0'));var Promise=require('bluebird');var rp=require(_0xd8d8('0x1'));var util=require('util');var md5=require(_0xd8d8('0x2'));var Redis=require(_0xd8d8('0x3'));var intUtil=require(_0xd8d8('0x4'));var config=require(_0xd8d8('0x5'));var logger=require(_0xd8d8('0x6'))(_0xd8d8('0x7'));config[_0xd8d8('0x8')]=_['defaults'](config['redis'],{'host':_0xd8d8('0x9'),'port':0x18eb});var io=require(_0xd8d8('0xa'))(new Redis(config[_0xd8d8('0x8')]));function getAdminUser(_0x1aa3d1,_0xc6f166,_0x573972,_0x2066af,_0x56f9c0,_0x3009c1){return new Promise(function(_0x1fd9dd,_0x1419a3){var _0x33f28f={'method':_0xd8d8('0xb'),'uri':_0x2066af+_0xd8d8('0xc')+'&'+_0x56f9c0+'&'+_0x3009c1,'auth':_0xc6f166,'json':!![]};return rp(_0x33f28f)[_0xd8d8('0xd')](function(_0x8247b4){if(_0x8247b4[_0xd8d8('0xe')][_0xd8d8('0xf')]>0x0){_0x573972[_0xd8d8('0x10')]=_0x8247b4[_0xd8d8('0xe')][0x0][_0xd8d8('0x11')];}logger[_0xd8d8('0x12')]('['+[_0x1aa3d1[_0xd8d8('0x13')]()]+_0xd8d8('0x14'),_0x573972);_0x1fd9dd(_0x573972);})[_0xd8d8('0x15')](function(_0x258479){logger['error']('['+[_0x1aa3d1[_0xd8d8('0x13')]()]+']',_0x258479[_0xd8d8('0x16')]);_0x1419a3(_0x258479['message']);});});}function getUser(_0x21419b,_0x2bbc2b,_0x29fd53,_0x1f7304,_0x51367f){return function(_0x2f4470){logger[_0xd8d8('0x12')]('['+[_0x21419b['toUpperCase']()]+_0xd8d8('0x17'),_0x2f4470);return new Promise(function(_0x56d955,_0x38017a){if(intUtil[_0xd8d8('0x18')](_0x2f4470[_0xd8d8('0x19')])){var _0x3bcefc={'method':_0xd8d8('0xb'),'uri':_0x29fd53+_0xd8d8('0x1a')+_0x2f4470[_0xd8d8('0x19')]+'&'+_0x1f7304+'&'+_0x51367f,'auth':_0x2bbc2b,'json':!![]};logger[_0xd8d8('0x12')]('['+[_0x21419b[_0xd8d8('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x3bcefc);return rp(_0x3bcefc)[_0xd8d8('0xd')](function(_0x40ebe4){logger[_0xd8d8('0x12')]('['+[_0x21419b[_0xd8d8('0x13')]()]+_0xd8d8('0x1b'),_0x40ebe4);if(_0x40ebe4[_0xd8d8('0xe')][_0xd8d8('0xf')]>0x0&&String(_0x40ebe4[_0xd8d8('0xe')][0x0][_0xd8d8('0x1c')])===_0xd8d8('0x1d')){_0x2f4470['userId']=_0x40ebe4[_0xd8d8('0xe')][0x0][_0xd8d8('0x11')];}else{_0x2f4470['userId']=_0x2f4470[_0xd8d8('0x10')];_0x2f4470[_0xd8d8('0x19')]=_0x2f4470[_0xd8d8('0x1e')];}logger['info']('['+[_0x21419b[_0xd8d8('0x13')]()]+'],\x20getUser\x20crm',_0x2f4470);_0x56d955(_0x2f4470);})[_0xd8d8('0x15')](function(_0x2c1383){logger[_0xd8d8('0x1f')]('['+[_0x21419b[_0xd8d8('0x13')]()]+']',_0x2c1383['message']);_0x38017a(_0x2c1383['message']);});}else{logger[_0xd8d8('0x12')]('['+[_0x21419b[_0xd8d8('0x13')]()]+_0xd8d8('0x20'));_0x2f4470[_0xd8d8('0x21')]=_0x2f4470[_0xd8d8('0x10')];_0x2f4470[_0xd8d8('0x19')]=_0x2f4470[_0xd8d8('0x1e')];_0x56d955(_0x2f4470);}});};}function createEndUser(_0x4ac32a,_0x465fed,_0x26619c,_0x460ac5,_0x3fd230){logger['info']('['+[_0x4ac32a[_0xd8d8('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x26619c);return new Promise(function(_0x485bcf,_0x4ea0cc){var _0x4de216={'method':'POST','uri':_0x460ac5+'sys_user?'+_0x3fd230,'body':{'user_name':_0x26619c[_0xd8d8('0x22')],'roles':_0xd8d8('0x23'),'first_name':_0x26619c[_0xd8d8('0x22')],'active':_0xd8d8('0x1d'),'date_format':_0xd8d8('0x24'),'phone':_0x26619c[_0xd8d8('0x22')]},'auth':_0x465fed,'json':!![]};return rp(_0x4de216)[_0xd8d8('0xd')](function(_0x464cd2){logger[_0xd8d8('0x12')]('['+[_0x4ac32a['toUpperCase']()]+_0xd8d8('0x25'),_0x464cd2[_0xd8d8('0xe')]);_0x26619c[_0xd8d8('0x26')]=_0x464cd2[_0xd8d8('0xe')]['sys_id'];_0x485bcf(_0x26619c);})['catch'](function(_0x4b59c3){logger[_0xd8d8('0x1f')]('['+[_0x4ac32a[_0xd8d8('0x13')]()]+']',_0x4b59c3[_0xd8d8('0x16')]);_0x4ea0cc(_0x4b59c3['message']);});});}function getEndUser(_0x345a64,_0x106722,_0x25f71e,_0x1e2e91,_0x55b3ea){return function(_0x3565ba){logger[_0xd8d8('0x12')]('['+[_0x345a64['toUpperCase']()]+_0xd8d8('0x27'),_0x3565ba);return new Promise(function(_0xca502e,_0x423f5e){var _0x1c8996={'method':_0xd8d8('0xb'),'uri':_0x25f71e+_0xd8d8('0x28')+_0x3565ba[_0xd8d8('0x22')]+'&'+_0x1e2e91+'&'+_0x55b3ea,'auth':_0x106722,'json':!![]};return rp(_0x1c8996)['then'](function(_0x1d09c7){if(_0x1d09c7[_0xd8d8('0xe')][_0xd8d8('0xf')]>0x0){_0x3565ba[_0xd8d8('0x26')]=_0x1d09c7[_0xd8d8('0xe')][0x0]['sys_id'];logger[_0xd8d8('0x12')]('['+[_0x345a64[_0xd8d8('0x13')]()]+_0xd8d8('0x29'),_0x3565ba);_0xca502e(_0x3565ba);}else{return createEndUser(_0x345a64,_0x106722,_0x3565ba,_0x25f71e,_0x1e2e91)['then'](function(_0x179a31){logger[_0xd8d8('0x12')]('['+[_0x345a64[_0xd8d8('0x13')]()]+_0xd8d8('0x2a'),_0x179a31);_0xca502e(_0x179a31);});}})[_0xd8d8('0x15')](function(_0x1ec596){logger[_0xd8d8('0x1f')]('['+[_0x345a64[_0xd8d8('0x13')]()]+']',_0x1ec596[_0xd8d8('0x16')]);_0x423f5e(_0x1ec596[_0xd8d8('0x16')]);});});};}function getCustomFields(_0x5cb672,_0x27ae89){var _0x3e393a={};if(_0x5cb672[_0xd8d8('0xf')]>0x0){_[_0xd8d8('0x2b')](_0x5cb672,function(_0x13a1e6){if(_['includes']([_0xd8d8('0x2c'),_0xd8d8('0x2d')],_0x13a1e6[_0xd8d8('0x2e')])&&_0x13a1e6[_0xd8d8('0x2f')]&&!_0x13a1e6[_0xd8d8('0x30')]){_0x3e393a[_0x13a1e6[_0xd8d8('0x2f')][_0xd8d8('0x31')]()]=_0x13a1e6[_0xd8d8('0x32')][_0xd8d8('0x33')]();}else if(_[_0xd8d8('0x34')](['string',_0xd8d8('0x2d')],_0x13a1e6[_0xd8d8('0x2e')])&&_0x13a1e6['idField']&&_0x13a1e6[_0xd8d8('0x30')]){_0x3e393a[_0x13a1e6['idField'][_0xd8d8('0x31')]()]=_0x13a1e6[_0xd8d8('0x32')]['toString']();}else if(_0x13a1e6[_0xd8d8('0x2e')]===_0xd8d8('0x35')&&_0x13a1e6[_0xd8d8('0x36')]&&_0x13a1e6['idField']&&_0x13a1e6[_0xd8d8('0x30')]){_0x3e393a[_0x13a1e6[_0xd8d8('0x37')][_0xd8d8('0x31')]()]=_0x27ae89[_0x13a1e6[_0xd8d8('0x36')]][_0xd8d8('0x33')]();}else if(_0x13a1e6[_0xd8d8('0x2e')]==='customVariable'&&_0x13a1e6[_0xd8d8('0x38')]&&_0x13a1e6['Variable']['name']&&_0x13a1e6[_0xd8d8('0x37')]&&_0x13a1e6[_0xd8d8('0x30')]){_0x3e393a[_0x13a1e6[_0xd8d8('0x37')][_0xd8d8('0x31')]()]=_0x27ae89[_0x13a1e6[_0xd8d8('0x38')][_0xd8d8('0x39')][_0xd8d8('0x31')]()][_0xd8d8('0x33')]();}});}return _0x3e393a;}function getTicket(_0x182afd,_0x4be79d,_0x5c17f0,_0x370422,_0x550ea2,_0x22c3a1){return function(_0x56b7cc){logger[_0xd8d8('0x12')]('['+[_0x182afd[_0xd8d8('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x56b7cc);return new Promise(function(_0x2d99f1,_0x210cdb){var _0x4f112d=_0x182afd[_0xd8d8('0x31')]()===_0xd8d8('0x3a')?_0x56b7cc[_0xd8d8('0x21')]:_0x56b7cc[_0xd8d8('0x26')];var _0xd2f978={'method':_0xd8d8('0x3b'),'uri':_0x5c17f0+_0xd8d8('0x3c')+'?'+_0x22c3a1,'body':Object[_0xd8d8('0x3d')]({},{'active':_0xd8d8('0x1d'),'caller_id':_0x4f112d,'assigned_to':_0x56b7cc[_0xd8d8('0x21')],'short_description':intUtil['getString'](_0x370422['Subjects'],_0x550ea2,'\x20'),'description':intUtil['getString'](_0x370422[_0xd8d8('0x3e')],_0x550ea2,'\x0a')},getCustomFields(_0x370422[_0xd8d8('0x3f')],_0x550ea2)),'auth':_0x4be79d,'json':!![]};return rp(_0xd2f978)[_0xd8d8('0xd')](function(_0xb251c0){logger[_0xd8d8('0x12')]('['+[_0x182afd[_0xd8d8('0x13')]()]+_0xd8d8('0x40'),_0xb251c0['result']);_0x56b7cc[_0xd8d8('0x41')]=_0xb251c0['result'][_0xd8d8('0x11')];_0x56b7cc[_0xd8d8('0x42')]=_0xb251c0[_0xd8d8('0xe')][_0xd8d8('0x43')];logger['info']('['+[_0x182afd[_0xd8d8('0x13')]()]+_0xd8d8('0x44'),_0x56b7cc);_0x2d99f1(_0x56b7cc);})[_0xd8d8('0x15')](function(_0x323ca2){logger[_0xd8d8('0x1f')]('['+[_0x182afd[_0xd8d8('0x13')]()]+']',_0x323ca2['message']);_0x210cdb(_0x323ca2['message']);});});};}function createRemoteTag(_0x329db1,_0x55bdd8,_0x2e7146,_0x5712d6){return new Promise(function(_0x1a48b3,_0x3c641e){var _0xeec1e={'method':_0xd8d8('0x3b'),'uri':_0x2e7146+_0xd8d8('0x45')+'?'+_0x5712d6,'body':{'short_description':_0x329db1,'global':!![],'active':!![],'name':_0x329db1},'auth':_0x55bdd8,'json':!![]};return rp(_0xeec1e)['then'](function(_0x5f2d3f){var _0x13cb0c=_0x5f2d3f[_0xd8d8('0xe')]['sys_id'];_0x1a48b3(_0x13cb0c);});});}function getRemoteTag(_0x30cdc0,_0x341c93,_0x49a4ef,_0x182e69,_0x566979){return new Promise(function(_0xca7720,_0x3211ce){var _0x24e2ad={'method':_0xd8d8('0xb'),'uri':_0x49a4ef+_0xd8d8('0x45')+_0xd8d8('0x46')+_0x30cdc0+'&'+_0x182e69,'auth':_0x341c93,'json':!![]};return rp(_0x24e2ad)[_0xd8d8('0xd')](function(_0x357471){if(_0x357471[_0xd8d8('0xe')][_0xd8d8('0xf')]>0x0){var _0x479914=_0x357471['result'][0x0][_0xd8d8('0x11')];_0xca7720(_0x479914);}else{return createRemoteTag(_0x30cdc0,_0x341c93,_0x49a4ef,_0x182e69)[_0xd8d8('0xd')](function(_0x2274cb){_0xca7720(_0x2274cb);});}});});}function assignTagToIncident(_0x30043b,_0x471577,_0x5d2307,_0x42d58a,_0x4dc6dc){return new Promise(function(_0x5ad34b,_0x6b1941){var _0x3968e3={'method':_0xd8d8('0x3b'),'uri':_0x5d2307+_0xd8d8('0x47')+'?'+_0x4dc6dc,'body':{'label':_0x30043b,'table':'incident','id_type':'Incident','table_key':_0x42d58a[_0xd8d8('0x41')],'title':'Incident\x20-\x20'+_0x42d58a[_0xd8d8('0x42')],'id_display':_0x42d58a['ticketNumber']},'auth':_0x471577,'json':!![]};return rp(_0x3968e3)[_0xd8d8('0xd')](function(_0x1a98bd){_0x5ad34b();})[_0xd8d8('0x15')](function(){_0x5ad34b();});});}function manageTags(_0x1430d1,_0x388a40,_0x3f1b26,_0x1f7450,_0x26bdc6,_0x353542,_0xbbdfa0){return new Promise(function(_0x56bb07,_0x3a03ed){var _0x2d435a=[];_0x388a40['forEach'](function(_0x17c369){_0x2d435a[_0xd8d8('0x48')](getRemoteTag(_0x17c369,_0x3f1b26,_0x1f7450,_0x353542,_0xbbdfa0));});return Promise[_0xd8d8('0x49')](_0x2d435a)[_0xd8d8('0xd')](function(_0x3f2fee){if(_0x3f2fee[_0xd8d8('0xf')]){logger['info']('['+[_0x1430d1[_0xd8d8('0x13')]()]+_0xd8d8('0x4a'),_0x3f2fee);var _0x209767=[];_0x3f2fee[_0xd8d8('0x2b')](function(_0x1136a0){_0x209767[_0xd8d8('0x48')](assignTagToIncident(_0x1136a0,_0x3f1b26,_0x1f7450,_0x26bdc6,_0x353542));});return Promise['all'](_0x209767)[_0xd8d8('0xd')](function(){_0x56bb07();})[_0xd8d8('0x15')](function(){_0x56bb07();});}else{_0x56bb07();}});});}function getTags(_0x4a24a9,_0x31114a,_0x1f4a3b,_0x195957,_0x5eab5e,_0x3af739){return function(_0x285d73){return new Promise(function(_0x438b6d,_0x449017){var _0x18e61f=[];var _0x162a0e=_0x195957[_0xd8d8('0x4b')];if(_0x162a0e&&_0x162a0e[_0xd8d8('0xf')]>0x0){_0x18e61f=_['map'](_0x162a0e,_0xd8d8('0x39'));}if(_0x18e61f['length']>0x0){return manageTags(_0x4a24a9,_0x18e61f,_0x31114a,_0x1f4a3b,_0x285d73,_0x5eab5e,_0x3af739)['then'](function(){_0x438b6d(_0x285d73);});}else{_0x438b6d(_0x285d73);}});};}function emit(_0x49b62f,_0x34d7d9,_0x2c30da){var _0x5dde32=_0xd8d8('0x4c')+_0xd8d8('0x4d')+_0xd8d8('0x4e')+_0xd8d8('0x4f');var _0x3538bd={'uri':_0x49b62f+_0xd8d8('0x50')+_0x2c30da+_0x5dde32};io['to'](util['format']('user:%s',_0x34d7d9))[_0xd8d8('0x51')](_0xd8d8('0x52'),_0x3538bd);}exports['cs']=function(_0x222ba1,_0x2eea0e,_0x221906,_0x297975,_0x22a881,_0x44bba2,_0x19f1ca,_0x22d912){var _0x56d590={};var _0x5a6d6e={'user':_0x44bba2[_0xd8d8('0x53')],'pass':_0x44bba2[_0xd8d8('0x54')]};var _0x2b4f5d=_0xd8d8('0x55');var _0x2d844e='sysparm_display_value=true';_0x44bba2[_0xd8d8('0x56')]=intUtil['stripTrailingSlash'](_0x44bba2[_0xd8d8('0x56')]);_0x44bba2[_0xd8d8('0x57')]=intUtil[_0xd8d8('0x58')](_0x44bba2[_0xd8d8('0x57')]);var _0x560f91=util[_0xd8d8('0x59')](_0xd8d8('0x5a'),_0x44bba2[_0xd8d8('0x56')]);_0x56d590[_0xd8d8('0x19')]=!_[_0xd8d8('0x5b')](_0x297975)?_0x297975[_0xd8d8('0x5c')]:null;_0x56d590['adminEmail']=_0x44bba2[_0xd8d8('0x5c')];_0x56d590[_0xd8d8('0x22')]=_0x22d912[_0xd8d8('0x31')]()==='outbound'?_0x2eea0e[_0xd8d8('0x5d')]:_0x2eea0e[_0xd8d8('0x5e')];_0x56d590['callDirection']=_0x22d912==='queue'||_0x22d912===_0xd8d8('0x5f')?'queue':_0xd8d8('0x3a');var _0x58be29=util[_0xd8d8('0x59')](_0xd8d8('0x60'),_0x44bba2[_0xd8d8('0x57')],_0x2eea0e['uniqueid'],md5(_0x2eea0e[_0xd8d8('0x61')]));if(_0x22a881&&_0x22a881[_0xd8d8('0x62')]){logger[_0xd8d8('0x12')](_0xd8d8('0x63'),_0xd8d8('0x64'));_0x2eea0e[_0xd8d8('0x65')]=_0x58be29;}else if(_0x19f1ca&&_0x19f1ca[_0xd8d8('0x66')]&&_0x19f1ca[_0xd8d8('0x66')]!==_0xd8d8('0x67')){logger['info'](_0xd8d8('0x68'),_0xd8d8('0x64'));_0x2eea0e[_0xd8d8('0x65')]=_0x58be29;}else{_0x2eea0e[_0xd8d8('0x65')]='';}return getAdminUser(_0x22d912,_0x5a6d6e,_0x56d590,_0x560f91,_0x2d844e,_0x2b4f5d)[_0xd8d8('0xd')](getUser(_0x22d912,_0x5a6d6e,_0x560f91,_0x2d844e,_0x2b4f5d))[_0xd8d8('0xd')](getEndUser(_0x22d912,_0x5a6d6e,_0x560f91,_0x2d844e,_0x2b4f5d))[_0xd8d8('0xd')](getTicket(_0x22d912,_0x5a6d6e,_0x560f91,_0x221906,_0x2eea0e,_0x2d844e))[_0xd8d8('0xd')](function(_0xef9cc4){logger[_0xd8d8('0x12')](util[_0xd8d8('0x59')](_0xd8d8('0x69'),_0xef9cc4[_0xd8d8('0x41')]));logger[_0xd8d8('0x12')](util[_0xd8d8('0x59')](_0xd8d8('0x6a'),_0x22d912));if(_0x22d912!==_0xd8d8('0x5f')){logger[_0xd8d8('0x12')]('['+[_0x22d912['toUpperCase']()]+']',_0xd8d8('0x6b'));emit(_0x44bba2[_0xd8d8('0x56')],_0x297975[_0xd8d8('0x39')],_0xef9cc4[_0xd8d8('0x41')]);}})['catch'](function(_0x32d21f){logger[_0xd8d8('0x1f')]('['+[_0x22d912[_0xd8d8('0x13')]()]+_0xd8d8('0x6c'),util[_0xd8d8('0x6d')](_0x32d21f,{'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 a5a6f4c..0291dc6 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 _0x7b24=['duration_hours','parent_type','parent_name','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Employees','user_name','length','find','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','toLowerCase','customField','custom_fields','content','variable','customVariable','Variable','login','username','password','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','uri','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace'];(function(_0xcff782,_0x16d4c9){var _0x27252f=function(_0xc97da6){while(--_0xc97da6){_0xcff782['push'](_0xcff782['shift']());}};_0x27252f(++_0x16d4c9);}(_0x7b24,0xd7));var _0x47b2=function(_0x55042c,_0x4b7096){_0x55042c=_0x55042c-0x0;var _0x1128b5=_0x7b24[_0x55042c];return _0x1128b5;};'use strict';var _=require('lodash');var rp=require(_0x47b2('0x0'));var BPromise=require(_0x47b2('0x1'));var md5=require(_0x47b2('0x2'));var util=require(_0x47b2('0x3'));var Redis=require(_0x47b2('0x4'));var intUtil=require('./util');var config=require(_0x47b2('0x5'));var logger=require(_0x47b2('0x6'))('sugarcrm');config['redis']=_['defaults'](config[_0x47b2('0x7')],{'host':_0x47b2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47b2('0x7')]));var def={'method':_0x47b2('0x9'),'json':!![]};function emit(_0x3d97b6,_0x1556b8,_0x1e0065){io['to'](_0x3d97b6)['emit'](_0x1556b8,_0x1e0065);}function getTicket(_0x1856f8,_0x5da402,_0x134994,_0xce61e4,_0x175cb8,_0x57d36b,_0x23fa53,_0x32dd4e){logger[_0x47b2('0xa')](_0x47b2('0xb'));var _0x4d1f8d=new Date();var _0x5c2362=[{'name':_0x47b2('0xc'),'value':intUtil[_0x47b2('0xd')](_0xce61e4[_0x47b2('0xe')],_0x175cb8,'\x20')},{'name':_0x47b2('0xf'),'value':_0x5da402['id']},{'name':_0x47b2('0x10'),'value':_0x5da402['id']},{'name':_0x47b2('0x11'),'value':intUtil[_0x47b2('0xd')](_0xce61e4[_0x47b2('0x12')],_0x175cb8,'\x0a')},{'name':_0x47b2('0x13'),'value':_0x4d1f8d[_0x47b2('0x14')]()[_0x47b2('0x15')](0x0,0x13)[_0x47b2('0x16')]('T','\x20')},{'name':_0x47b2('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x134994['id']},{'name':_0x47b2('0x18'),'value':'Contacts'},{'name':_0x47b2('0x19'),'value':_0x134994[_0x47b2('0xc')]},{'name':'direction','value':_0x32dd4e}];if(_0x57d36b['length']){_[_0x47b2('0x1a')](_0x57d36b,function(_0x3dcae3){if(_0x175cb8[_0x3dcae3[_0x47b2('0x1b')]]){_0x5c2362[_0x47b2('0x1c')]({'name':_0x3dcae3[_0x47b2('0x1d')],'value':_0x175cb8[_0x3dcae3[_0x47b2('0x1b')]]});}});}return request({'form':{'method':_0x47b2('0x1e'),'input_type':_0x47b2('0x1f'),'response_type':'JSON','rest_data':JSON[_0x47b2('0x20')]({'session':_0x23fa53['id'],'module_name':_0x47b2('0x21'),'name_value_list':_0x5c2362})}});}function getAuth(_0x1b0f82){return util[_0x47b2('0x22')]('Basic\x20%s',new Buffer(_0x1b0f82[_0x47b2('0x23')]+':X')[_0x47b2('0x24')](_0x47b2('0x25')));}function getServerInfo(_0x10be7a){return request({'form':{'method':_0x47b2('0x26'),'input_type':_0x47b2('0x1f'),'response_type':'JSON','rest_data':JSON[_0x47b2('0x20')]({'session':_0x10be7a['id']})}});}function getUser(_0x44fdd6,_0x3e76dd,_0x2b29fb){if(!_[_0x47b2('0x27')](_0x3e76dd)){logger[_0x47b2('0xa')]('Getting\x20agent\x20with\x20name',_0x3e76dd);return request({'form':{'method':'get_entry_list','input_type':_0x47b2('0x1f'),'response_type':_0x47b2('0x1f'),'rest_data':JSON[_0x47b2('0x20')]({'session':_0x2b29fb['id'],'module_name':_0x47b2('0x28'),'query':util[_0x47b2('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3e76dd),'order_by':'','offset':'0','select_fields':['id',_0x47b2('0xc'),_0x47b2('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3251fc){if(_0x3251fc['entry_list'][_0x47b2('0x2a')]){var _0x7ad81f=_[_0x47b2('0x2b')](_0x3251fc[_0x47b2('0x2c')],function(_0x1feeb7){return _0x1feeb7[_0x47b2('0x2d')][_0x47b2('0x29')]['value']===_0x3e76dd;});if(_0x7ad81f){logger[_0x47b2('0xa')](_0x47b2('0x2e'));return BPromise[_0x47b2('0x2f')]({'id':_0x7ad81f[_0x47b2('0x2d')]['id'][_0x47b2('0x30')],'name':_0x7ad81f['name_value_list']['name']['value']});}}logger[_0x47b2('0xa')](_0x47b2('0x31'));return BPromise[_0x47b2('0x2f')]({'id':_0x2b29fb['name_value_list'][_0x47b2('0x32')][_0x47b2('0x30')],'name':_0x2b29fb['name_value_list'][_0x47b2('0x29')][_0x47b2('0x30')]});});}else{logger['info'](_0x47b2('0x33'));return BPromise[_0x47b2('0x2f')]({'id':_0x2b29fb[_0x47b2('0x2d')]['user_id'][_0x47b2('0x30')],'name':_0x2b29fb[_0x47b2('0x2d')][_0x47b2('0x29')][_0x47b2('0x30')]});}}function getEndUser(_0x24d7d4,_0x39be2e,_0x2c7373,_0x1fd4c0){logger['info'](_0x47b2('0x34'),_0x2c7373);return request({'form':{'method':_0x47b2('0x35'),'input_type':'JSON','response_type':_0x47b2('0x1f'),'rest_data':JSON[_0x47b2('0x20')]({'session':_0x1fd4c0['id'],'module_name':'Contacts','query':util['format'](_0x47b2('0x36'),_0x2c7373),'order_by':'','offset':'0','select_fields':['id','name',_0x47b2('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x47b2('0x38')](function(_0x9c3b79){if(_0x9c3b79['entry_list']['length']){var _0x5e898e=_[_0x47b2('0x2b')](_0x9c3b79[_0x47b2('0x2c')],function(_0x39d974){return _0x39d974[_0x47b2('0x2d')][_0x47b2('0x37')][_0x47b2('0x30')]===_0x2c7373;});if(_0x5e898e){logger[_0x47b2('0xa')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x5e898e[_0x47b2('0x2d')]['id']['value'],'name':_0x5e898e['name_value_list']['name']['value'],'phone':_0x5e898e[_0x47b2('0x2d')]['phone_home'][_0x47b2('0x30')]});}}else{logger[_0x47b2('0xa')](_0x47b2('0x39'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x47b2('0x1f'),'rest_data':JSON['stringify']({'session':_0x1fd4c0['id'],'module_name':_0x47b2('0x3a'),'name_value_list':[{'name':_0x47b2('0x3b'),'value':_0x39be2e!==_0x47b2('0x3c')?_0x39be2e:util['format'](_0x47b2('0x3d'),_0x2c7373)},{'name':_0x47b2('0x37'),'value':_0x2c7373}]})}})[_0x47b2('0x38')](function(_0x1e1854){logger[_0x47b2('0xa')](_0x47b2('0x3e'));return BPromise['resolve']({'id':_0x1e1854['id'],'name':_0x1e1854[_0x47b2('0x2c')]['first_name'][_0x47b2('0x30')],'phone':_0x1e1854[_0x47b2('0x2c')][_0x47b2('0x37')][_0x47b2('0x30')]});});}});}function request(_0x17ecdd){logger[_0x47b2('0x3f')](_0x47b2('0x40'),JSON[_0x47b2('0x20')](_0x17ecdd));return rp(_['merge'](def,_0x17ecdd));}function getTags(_0x3a9e98,_0x36993e){var _0x573f2b=[];if(_0x3a9e98&&_0x3a9e98['length']>0x0){_0x573f2b=_[_0x47b2('0x41')](_0x3a9e98,_0x36993e);}return _0x573f2b;}function getCustomFields(_0x204b30,_0x2e918f){var _0x2daa22=[];var _0x404889={'custom_fields':[]};if(_0x204b30[_0x47b2('0x2a')]>0x0){_[_0x47b2('0x1a')](_0x204b30,function(_0x11b924){if(_0x11b924[_0x47b2('0x42')]===_0x47b2('0x43')&&_0x11b924[_0x47b2('0x44')]&&!_0x11b924['customField']){_0x404889[_0x11b924[_0x47b2('0x44')][_0x47b2('0x45')]()]=_0x11b924['content'][_0x47b2('0x24')]();}else if(_0x11b924[_0x47b2('0x42')]==='string'&&_0x11b924['idField']&&_0x11b924[_0x47b2('0x46')]){_0x404889[_0x47b2('0x47')][_0x47b2('0x1c')]({'id':_0x11b924[_0x47b2('0x1d')],'value':_0x11b924[_0x47b2('0x48')][_0x47b2('0x24')]()});}else if(_0x11b924[_0x47b2('0x42')]===_0x47b2('0x49')&&_0x11b924[_0x47b2('0x1b')]&&_0x11b924[_0x47b2('0x1d')]&&_0x11b924[_0x47b2('0x46')]){_0x2e918f[_0x11b924[_0x47b2('0x1b')]]&&_0x404889[_0x47b2('0x47')][_0x47b2('0x1c')]({'id':_0x11b924['idField'],'value':_0x2e918f[_0x11b924[_0x47b2('0x1b')]][_0x47b2('0x24')]()});}else if(_0x11b924[_0x47b2('0x42')]===_0x47b2('0x4a')&&_0x11b924[_0x47b2('0x4b')]&&_0x11b924[_0x47b2('0x4b')]['name']&&_0x11b924[_0x47b2('0x1d')]&&_0x11b924[_0x47b2('0x46')]){_0x2e918f[_0x11b924[_0x47b2('0x4b')]['name'][_0x47b2('0x45')]()]&&_0x404889[_0x47b2('0x47')]['push']({'id':_0x11b924[_0x47b2('0x1d')],'value':_0x2e918f[_0x11b924[_0x47b2('0x4b')][_0x47b2('0xc')]['toLowerCase']()][_0x47b2('0x24')]()});}});}return _0x404889;}function getConnection(_0x5bbe86){return request({'method':_0x47b2('0x9'),'form':{'method':_0x47b2('0x4c'),'input_type':_0x47b2('0x1f'),'response_type':'JSON','rest_data':JSON[_0x47b2('0x20')]({'user_auth':{'user_name':_0x5bbe86[_0x47b2('0x4d')],'password':_0x5bbe86[_0x47b2('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x47b2('0x38')](function(_0x50f68c){var _0x111f9a=_0x50f68c;if(_0x111f9a['id']){def['sessionID']=_0x111f9a['id'];return BPromise['resolve'](_0x111f9a);}else{throw new Error(util[_0x47b2('0x22')](_0x47b2('0x4f'),_0x5bbe86['id']));}});}function setRelationship(_0x4105d7,_0x42dfe7,_0x144dcd,_0x116296){return request({'form':{'method':_0x47b2('0x50'),'input_type':_0x47b2('0x1f'),'response_type':_0x47b2('0x1f'),'rest_data':JSON[_0x47b2('0x20')]({'session':_0x4105d7['id'],'module_name':_0x47b2('0x21'),'module_id':_0x144dcd['id'],'link_field_name':_0x116296,'related_ids':[_0x42dfe7['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x250dd1,_0x32234b,_0x746285,_0x25d8b5,_0x5a945a,_0x5465d2){var _0x38f39f,_0x9f3af1,_0x3aede8,_0xe6f522;_0x5465d2['remoteUri']=intUtil['stripTrailingSlash'](_0x5465d2[_0x47b2('0x51')]);_0x5465d2[_0x47b2('0x52')]=intUtil[_0x47b2('0x53')](_0x5465d2[_0x47b2('0x52')]);def['uri']=util['format'](_0x47b2('0x54'),_0x5465d2[_0x47b2('0x51')]);if(_0x5a945a&&_0x5a945a[_0x47b2('0x55')]){logger[_0x47b2('0xa')](_0x47b2('0x56'),'Recording\x20is\x20enabled!');_0x32234b[_0x47b2('0x57')]=util[_0x47b2('0x22')](_0x47b2('0x58'),_0x5465d2['serverUrl'],_0x32234b[_0x47b2('0x59')],md5(_0x32234b[_0x47b2('0x59')]));}else{_0x32234b[_0x47b2('0x57')]='';}return getConnection(_0x5465d2)[_0x47b2('0x38')](function(_0x3c2752){_0xe6f522=_0x3c2752;return getUser(_0x5465d2,_0x25d8b5[_0x47b2('0xc')],_0xe6f522);})[_0x47b2('0x38')](function(_0x33979b){_0x38f39f=_0x33979b;logger['info']('The\x20User\x20ID\x20is:',_0x38f39f['id']);return getEndUser(_0x5465d2,_0x32234b['calleridname'],_0x32234b['calleridnum'],_0xe6f522);})[_0x47b2('0x38')](function(_0x1b6b15){_0x9f3af1=_0x1b6b15;logger[_0x47b2('0xa')]('The\x20Enduser\x20ID\x20is:',_0x9f3af1['id']);return getTicket(_0x5465d2,_0x38f39f,_0x9f3af1,_0x746285,_0x32234b,_0x746285[_0x47b2('0x5a')],_0xe6f522,'Inbound');})[_0x47b2('0x38')](function(_0xd28ad7){_0x3aede8=_0xd28ad7;logger[_0x47b2('0xa')](_0x47b2('0x5b'));logger[_0x47b2('0xa')](_0x47b2('0x5c'),_0x3aede8['id']);return setRelationship(_0xe6f522,_0x38f39f,_0x3aede8,_0x47b2('0x5d'));})['then'](function(){return setRelationship(_0xe6f522,_0x9f3af1,_0x3aede8,'contacts');})[_0x47b2('0x38')](function(){return getServerInfo(_0xe6f522);})[_0x47b2('0x38')](function(_0x4d6579){var _0x2fcc9f=parseInt(_0x4d6579[_0x47b2('0x5e')][_0x47b2('0x5f')](0x0));var _0x243ce0=util[_0x47b2('0x22')](_0x47b2('0x60'),_0x5465d2['remoteUri'],_0x3aede8['id']);if(_0x2fcc9f>0x6){_0x243ce0=util[_0x47b2('0x22')](_0x47b2('0x61'),_0x5465d2[_0x47b2('0x51')],_0x3aede8['id']);}logger[_0x47b2('0xa')](_0x47b2('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x47b2('0x62'),_0x25d8b5[_0x47b2('0xc')]),_0x47b2('0x63'),{'uri':_0x243ce0});})[_0x47b2('0x64')](function(_0x2e971f){logger[_0x47b2('0x65')](_0x47b2('0x56'),JSON['stringify'](_0x2e971f));});};exports['outbound']=function(_0x1d392d,_0x369c00,_0x537958,_0x172ba8,_0x41dd96,_0x4a1929,_0x4ea734){var _0x1b21e2,_0x5554c0,_0x28d649,_0x2196c2;_0x4a1929[_0x47b2('0x51')]=intUtil[_0x47b2('0x53')](_0x4a1929[_0x47b2('0x51')]);_0x4a1929[_0x47b2('0x52')]=intUtil[_0x47b2('0x53')](_0x4a1929[_0x47b2('0x52')]);def[_0x47b2('0x66')]=util[_0x47b2('0x22')](_0x47b2('0x54'),_0x4a1929['remoteUri']);if(_0x4ea734&&_0x4ea734['recordingFormat']&&_0x4ea734[_0x47b2('0x67')]!==_0x47b2('0x68')){logger[_0x47b2('0xa')]('[OUTBOUND]',_0x47b2('0x69'));_0x369c00['recordingURL']=util['format'](_0x47b2('0x58'),_0x4a1929[_0x47b2('0x52')],_0x369c00[_0x47b2('0x59')],md5(_0x369c00[_0x47b2('0x59')]));}return getConnection(_0x4a1929)[_0x47b2('0x38')](function(_0x3a6b97){_0x2196c2=_0x3a6b97;return getUser(_0x4a1929,_0x172ba8['name'],_0x2196c2);})[_0x47b2('0x38')](function(_0x290b63){_0x1b21e2=_0x290b63;logger['info']('The\x20User\x20ID\x20is:',_0x1b21e2['id']);return getEndUser(_0x4a1929,_0x369c00[_0x47b2('0x6a')],_0x369c00[_0x47b2('0x6b')],_0x2196c2);})[_0x47b2('0x38')](function(_0x5e4a27){_0x5554c0=_0x5e4a27;logger[_0x47b2('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5554c0['id']);return getTicket(_0x4a1929,_0x1b21e2,_0x5554c0,_0x537958,_0x369c00,_0x537958['Fields'],_0x2196c2,_0x47b2('0x6c'));})[_0x47b2('0x38')](function(_0x371d33){_0x28d649=_0x371d33;logger[_0x47b2('0xa')]('Ticket\x20created!');logger['info'](_0x47b2('0x5c'),_0x28d649['id']);return setRelationship(_0x2196c2,_0x1b21e2,_0x28d649,'users');})[_0x47b2('0x38')](function(){return setRelationship(_0x2196c2,_0x5554c0,_0x28d649,'contacts');})[_0x47b2('0x38')](function(){return getServerInfo(_0x2196c2);})[_0x47b2('0x38')](function(_0x3f61f0){var _0x3bd1dc=parseInt(_0x3f61f0[_0x47b2('0x5e')]['charAt'](0x0));var _0x24433d=util[_0x47b2('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4a1929[_0x47b2('0x51')],_0x28d649['id']);if(_0x3bd1dc>0x6){_0x24433d=util[_0x47b2('0x22')](_0x47b2('0x61'),_0x4a1929[_0x47b2('0x51')],_0x28d649['id']);}logger['info'](_0x47b2('0x6d'),_0x47b2('0x6e'));emit(util[_0x47b2('0x22')](_0x47b2('0x62'),_0x172ba8[_0x47b2('0xc')]),_0x47b2('0x63'),{'uri':_0x24433d});})[_0x47b2('0x64')](function(_0x343e94){logger['error'](_0x47b2('0x6d'),JSON[_0x47b2('0x20')](_0x343e94));});};exports[_0x47b2('0x6f')]=function(_0x51c758,_0x322762,_0x4fd168,_0x1b96a6,_0x3533f2,_0x2479d1){var _0x19256b,_0x135786,_0x2a907d,_0x22de26;_0x2479d1['remoteUri']=intUtil[_0x47b2('0x53')](_0x2479d1[_0x47b2('0x51')]);_0x2479d1[_0x47b2('0x52')]=intUtil[_0x47b2('0x53')](_0x2479d1[_0x47b2('0x52')]);def[_0x47b2('0x66')]=util[_0x47b2('0x22')](_0x47b2('0x54'),_0x2479d1[_0x47b2('0x51')]);if(_0x3533f2&&_0x3533f2[_0x47b2('0x55')]){logger['info']('['+_0x322762[_0x47b2('0x70')][_0x47b2('0x71')]()+']',_0x47b2('0x69'));_0x322762[_0x47b2('0x57')]=util[_0x47b2('0x22')](_0x47b2('0x58'),_0x2479d1['serverUrl'],_0x322762[_0x47b2('0x59')],md5(_0x322762[_0x47b2('0x59')]));}else{_0x322762['recordingURL']='';}return getConnection(_0x2479d1)[_0x47b2('0x38')](function(_0x3db596){_0x22de26=_0x3db596;if(!_[_0x47b2('0x27')](_0x1b96a6)){return getUser(_0x2479d1,_0x1b96a6['name'],_0x22de26);}else{return getUser(_0x2479d1,null,_0x22de26);}})[_0x47b2('0x38')](function(_0x525e5e){_0x19256b=_0x525e5e;logger[_0x47b2('0xa')](_0x47b2('0x72'),_0x19256b['id']);return getEndUser(_0x2479d1,_0x322762[_0x47b2('0x73')],_0x322762[_0x47b2('0x74')],_0x22de26);})[_0x47b2('0x38')](function(_0x291081){_0x135786=_0x291081;logger['info'](_0x47b2('0x75'),_0x135786['id']);return getTicket(_0x2479d1,_0x19256b,_0x135786,_0x4fd168,_0x322762,_0x4fd168['Fields'],_0x22de26,_0x47b2('0x76'));})[_0x47b2('0x38')](function(_0x343fcb){_0x2a907d=_0x343fcb;logger[_0x47b2('0xa')](_0x47b2('0x5b'));logger[_0x47b2('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2a907d['id']);return setRelationship(_0x22de26,_0x19256b,_0x2a907d,_0x47b2('0x5d'));})['then'](function(){return setRelationship(_0x22de26,_0x135786,_0x2a907d,'contacts');})[_0x47b2('0x38')](function(){return getServerInfo(_0x22de26);})[_0x47b2('0x64')](function(_0x4b45c3){logger[_0x47b2('0x65')]('['+_0x322762[_0x47b2('0x70')][_0x47b2('0x71')]()+']',JSON[_0x47b2('0x20')](_0x4b45c3));});}; \ No newline at end of file +var _0xb81d=['isNil','Getting\x20agent\x20with\x20name','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','string','nameField','customField','toLowerCase','content','type','custom_fields','variable','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','%s/service/v4_1/rest.php','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','apiKey','toString','get_server_info'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xb81d,0x1a5));var _0xdb81=function(_0x24be3e,_0x2b8568){_0x24be3e=_0x24be3e-0x0;var _0x5909cc=_0xb81d[_0x24be3e];return _0x5909cc;};'use strict';var _=require('lodash');var rp=require(_0xdb81('0x0'));var BPromise=require(_0xdb81('0x1'));var md5=require(_0xdb81('0x2'));var util=require(_0xdb81('0x3'));var Redis=require(_0xdb81('0x4'));var intUtil=require(_0xdb81('0x5'));var config=require(_0xdb81('0x6'));var logger=require(_0xdb81('0x7'))('sugarcrm');config[_0xdb81('0x8')]=_[_0xdb81('0x9')](config[_0xdb81('0x8')],{'host':_0xdb81('0xa'),'port':0x18eb});var io=require(_0xdb81('0xb'))(new Redis(config[_0xdb81('0x8')]));var def={'method':_0xdb81('0xc'),'json':!![]};function emit(_0x136e5c,_0x39fbf6,_0x42370e){io['to'](_0x136e5c)[_0xdb81('0xd')](_0x39fbf6,_0x42370e);}function getTicket(_0x4a1ee5,_0x4f2afc,_0x9e6c9b,_0x6fd076,_0x32a9df,_0xbc2f64,_0x5c404a,_0x247122){logger[_0xdb81('0xe')](_0xdb81('0xf'));var _0x1c2b34=new Date();var _0x5ea27d=[{'name':_0xdb81('0x10'),'value':intUtil['getString'](_0x6fd076[_0xdb81('0x11')],_0x32a9df,'\x20')},{'name':_0xdb81('0x12'),'value':_0x4f2afc['id']},{'name':_0xdb81('0x13'),'value':_0x4f2afc['id']},{'name':_0xdb81('0x14'),'value':intUtil['getString'](_0x6fd076[_0xdb81('0x15')],_0x32a9df,'\x0a')},{'name':'date_start','value':_0x1c2b34[_0xdb81('0x16')]()[_0xdb81('0x17')](0x0,0x13)[_0xdb81('0x18')]('T','\x20')},{'name':_0xdb81('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xdb81('0x1a'),'value':_0x9e6c9b['id']},{'name':_0xdb81('0x1b'),'value':_0xdb81('0x1c')},{'name':_0xdb81('0x1d'),'value':_0x9e6c9b[_0xdb81('0x10')]},{'name':_0xdb81('0x1e'),'value':_0x247122}];if(_0xbc2f64[_0xdb81('0x1f')]){_[_0xdb81('0x20')](_0xbc2f64,function(_0x5e8353){if(_0x32a9df[_0x5e8353['variableName']]){_0x5ea27d[_0xdb81('0x21')]({'name':_0x5e8353[_0xdb81('0x22')],'value':_0x32a9df[_0x5e8353[_0xdb81('0x23')]]});}});}return request({'form':{'method':_0xdb81('0x24'),'input_type':_0xdb81('0x25'),'response_type':'JSON','rest_data':JSON[_0xdb81('0x26')]({'session':_0x5c404a['id'],'module_name':_0xdb81('0x27'),'name_value_list':_0x5ea27d})}});}function getAuth(_0x137d9a){return util['format']('Basic\x20%s',new Buffer(_0x137d9a[_0xdb81('0x28')]+':X')[_0xdb81('0x29')]('base64'));}function getServerInfo(_0x14a6b8){return request({'form':{'method':_0xdb81('0x2a'),'input_type':_0xdb81('0x25'),'response_type':_0xdb81('0x25'),'rest_data':JSON[_0xdb81('0x26')]({'session':_0x14a6b8['id']})}});}function getUser(_0x1e2ee8,_0x25170a,_0x14c52f){if(!_[_0xdb81('0x2b')](_0x25170a)){logger['info'](_0xdb81('0x2c'),_0x25170a);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xdb81('0x26')]({'session':_0x14c52f['id'],'module_name':'Employees','query':util[_0xdb81('0x2d')](_0xdb81('0x2e'),_0x25170a),'order_by':'','offset':'0','select_fields':['id',_0xdb81('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdb81('0x2f')](function(_0x33d201){if(_0x33d201[_0xdb81('0x30')][_0xdb81('0x1f')]){var _0x1bba7f=_[_0xdb81('0x31')](_0x33d201[_0xdb81('0x30')],function(_0xcb22bb){return _0xcb22bb[_0xdb81('0x32')]['user_name']['value']===_0x25170a;});if(_0x1bba7f){logger[_0xdb81('0xe')](_0xdb81('0x33'));return BPromise[_0xdb81('0x34')]({'id':_0x1bba7f[_0xdb81('0x32')]['id'][_0xdb81('0x35')],'name':_0x1bba7f[_0xdb81('0x32')][_0xdb81('0x10')][_0xdb81('0x35')]});}}logger['info'](_0xdb81('0x36'));return BPromise[_0xdb81('0x34')]({'id':_0x14c52f[_0xdb81('0x32')][_0xdb81('0x37')][_0xdb81('0x35')],'name':_0x14c52f[_0xdb81('0x32')]['user_name']['value']});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xdb81('0x34')]({'id':_0x14c52f['name_value_list'][_0xdb81('0x37')][_0xdb81('0x35')],'name':_0x14c52f[_0xdb81('0x32')]['user_name'][_0xdb81('0x35')]});}}function getEndUser(_0x2a7646,_0xd2c25e,_0x40d024,_0x22f029){logger[_0xdb81('0xe')](_0xdb81('0x38'),_0x40d024);return request({'form':{'method':_0xdb81('0x39'),'input_type':_0xdb81('0x25'),'response_type':'JSON','rest_data':JSON[_0xdb81('0x26')]({'session':_0x22f029['id'],'module_name':_0xdb81('0x1c'),'query':util[_0xdb81('0x2d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x40d024),'order_by':'','offset':'0','select_fields':['id','name',_0xdb81('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdb81('0x2f')](function(_0x3d8a82){if(_0x3d8a82['entry_list']['length']){var _0x4246e7=_[_0xdb81('0x31')](_0x3d8a82[_0xdb81('0x30')],function(_0x39adb2){return _0x39adb2[_0xdb81('0x32')][_0xdb81('0x3a')][_0xdb81('0x35')]===_0x40d024;});if(_0x4246e7){logger[_0xdb81('0xe')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x4246e7['name_value_list']['id'][_0xdb81('0x35')],'name':_0x4246e7[_0xdb81('0x32')][_0xdb81('0x10')][_0xdb81('0x35')],'phone':_0x4246e7['name_value_list']['phone_home'][_0xdb81('0x35')]});}}else{logger[_0xdb81('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xdb81('0x24'),'input_type':_0xdb81('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x22f029['id'],'module_name':_0xdb81('0x1c'),'name_value_list':[{'name':_0xdb81('0x3b'),'value':_0xd2c25e!==_0xdb81('0x3c')?_0xd2c25e:util['format'](_0xdb81('0x3d'),_0x40d024)},{'name':_0xdb81('0x3a'),'value':_0x40d024}]})}})[_0xdb81('0x2f')](function(_0x397c68){logger[_0xdb81('0xe')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x397c68['id'],'name':_0x397c68[_0xdb81('0x30')]['first_name'][_0xdb81('0x35')],'phone':_0x397c68['entry_list'][_0xdb81('0x3a')][_0xdb81('0x35')]});});}});}function request(_0x1b3d05){logger[_0xdb81('0x3e')](_0xdb81('0x3f'),JSON[_0xdb81('0x26')](_0x1b3d05));return rp(_['merge'](def,_0x1b3d05));}function getTags(_0x7364b2,_0x5ea28e){var _0x5bd875=[];if(_0x7364b2&&_0x7364b2[_0xdb81('0x1f')]>0x0){_0x5bd875=_[_0xdb81('0x40')](_0x7364b2,_0x5ea28e);}return _0x5bd875;}function getCustomFields(_0x1d072a,_0x1ad013){var _0x56da9c=[];var _0x888e62={'custom_fields':[]};if(_0x1d072a['length']>0x0){_[_0xdb81('0x20')](_0x1d072a,function(_0x353abd){if(_0x353abd['type']===_0xdb81('0x41')&&_0x353abd[_0xdb81('0x42')]&&!_0x353abd[_0xdb81('0x43')]){_0x888e62[_0x353abd[_0xdb81('0x42')][_0xdb81('0x44')]()]=_0x353abd[_0xdb81('0x45')][_0xdb81('0x29')]();}else if(_0x353abd[_0xdb81('0x46')]==='string'&&_0x353abd['idField']&&_0x353abd[_0xdb81('0x43')]){_0x888e62[_0xdb81('0x47')][_0xdb81('0x21')]({'id':_0x353abd['idField'],'value':_0x353abd['content']['toString']()});}else if(_0x353abd[_0xdb81('0x46')]===_0xdb81('0x48')&&_0x353abd['variableName']&&_0x353abd[_0xdb81('0x22')]&&_0x353abd['customField']){_0x1ad013[_0x353abd[_0xdb81('0x23')]]&&_0x888e62[_0xdb81('0x47')]['push']({'id':_0x353abd['idField'],'value':_0x1ad013[_0x353abd[_0xdb81('0x23')]][_0xdb81('0x29')]()});}else if(_0x353abd[_0xdb81('0x46')]===_0xdb81('0x49')&&_0x353abd[_0xdb81('0x4a')]&&_0x353abd['Variable'][_0xdb81('0x10')]&&_0x353abd['idField']&&_0x353abd[_0xdb81('0x43')]){_0x1ad013[_0x353abd['Variable'][_0xdb81('0x10')][_0xdb81('0x44')]()]&&_0x888e62[_0xdb81('0x47')]['push']({'id':_0x353abd[_0xdb81('0x22')],'value':_0x1ad013[_0x353abd[_0xdb81('0x4a')][_0xdb81('0x10')][_0xdb81('0x44')]()][_0xdb81('0x29')]()});}});}return _0x888e62;}function getConnection(_0x78128f){return request({'method':_0xdb81('0xc'),'form':{'method':_0xdb81('0x4b'),'input_type':_0xdb81('0x25'),'response_type':'JSON','rest_data':JSON[_0xdb81('0x26')]({'user_auth':{'user_name':_0x78128f[_0xdb81('0x4c')],'password':_0x78128f['password'],'encryption':'PLAIN'},'application':_0xdb81('0x4d')})}})[_0xdb81('0x2f')](function(_0x142ae9){var _0x4e71a4=_0x142ae9;if(_0x4e71a4['id']){def['sessionID']=_0x4e71a4['id'];return BPromise[_0xdb81('0x34')](_0x4e71a4);}else{throw new Error(util[_0xdb81('0x2d')](_0xdb81('0x4e'),_0x78128f['id']));}});}function setRelationship(_0x41c11e,_0x365a40,_0x247fcb,_0x9a48d6){return request({'form':{'method':_0xdb81('0x4f'),'input_type':_0xdb81('0x25'),'response_type':_0xdb81('0x25'),'rest_data':JSON[_0xdb81('0x26')]({'session':_0x41c11e['id'],'module_name':_0xdb81('0x27'),'module_id':_0x247fcb['id'],'link_field_name':_0x9a48d6,'related_ids':[_0x365a40['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xd7864,_0x131d7d,_0x34b173,_0x4fe531,_0x2343f,_0x2d2339){var _0xbacfc9,_0x39880b,_0x4c8736,_0x18f406;_0x2d2339[_0xdb81('0x50')]=intUtil[_0xdb81('0x51')](_0x2d2339[_0xdb81('0x50')]);_0x2d2339['serverUrl']=intUtil[_0xdb81('0x51')](_0x2d2339[_0xdb81('0x52')]);def[_0xdb81('0x53')]=util[_0xdb81('0x2d')]('%s/service/v4_1/rest.php',_0x2d2339[_0xdb81('0x50')]);if(_0x2343f&&_0x2343f[_0xdb81('0x54')]){logger[_0xdb81('0xe')](_0xdb81('0x55'),_0xdb81('0x56'));_0x131d7d[_0xdb81('0x57')]=util['format'](_0xdb81('0x58'),_0x2d2339[_0xdb81('0x52')],_0x131d7d[_0xdb81('0x59')],md5(_0x131d7d[_0xdb81('0x59')]));}else{_0x131d7d[_0xdb81('0x57')]='';}return getConnection(_0x2d2339)[_0xdb81('0x2f')](function(_0x2584d4){_0x18f406=_0x2584d4;return getUser(_0x2d2339,_0x4fe531[_0xdb81('0x10')],_0x18f406);})['then'](function(_0x21ab7f){_0xbacfc9=_0x21ab7f;logger[_0xdb81('0xe')]('The\x20User\x20ID\x20is:',_0xbacfc9['id']);return getEndUser(_0x2d2339,_0x131d7d[_0xdb81('0x5a')],_0x131d7d[_0xdb81('0x5b')],_0x18f406);})[_0xdb81('0x2f')](function(_0x5404ca){_0x39880b=_0x5404ca;logger['info'](_0xdb81('0x5c'),_0x39880b['id']);return getTicket(_0x2d2339,_0xbacfc9,_0x39880b,_0x34b173,_0x131d7d,_0x34b173[_0xdb81('0x5d')],_0x18f406,_0xdb81('0x5e'));})[_0xdb81('0x2f')](function(_0x2d8b86){_0x4c8736=_0x2d8b86;logger[_0xdb81('0xe')](_0xdb81('0x5f'));logger[_0xdb81('0xe')](_0xdb81('0x60'),_0x4c8736['id']);return setRelationship(_0x18f406,_0xbacfc9,_0x4c8736,_0xdb81('0x61'));})['then'](function(){return setRelationship(_0x18f406,_0x39880b,_0x4c8736,_0xdb81('0x62'));})[_0xdb81('0x2f')](function(){return getServerInfo(_0x18f406);})[_0xdb81('0x2f')](function(_0x4f68bc){var _0x3e4114=parseInt(_0x4f68bc[_0xdb81('0x63')]['charAt'](0x0));var _0x3af393=util[_0xdb81('0x2d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d2339[_0xdb81('0x50')],_0x4c8736['id']);if(_0x3e4114>0x6){_0x3af393=util[_0xdb81('0x2d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2d2339[_0xdb81('0x50')],_0x4c8736['id']);}logger[_0xdb81('0xe')](_0xdb81('0x55'),_0xdb81('0x64'));emit(util[_0xdb81('0x2d')](_0xdb81('0x65'),_0x4fe531['name']),_0xdb81('0x66'),{'uri':_0x3af393});})['catch'](function(_0x3e1206){logger['error'](_0xdb81('0x55'),JSON['stringify'](_0x3e1206));});};exports[_0xdb81('0x67')]=function(_0x351f4a,_0x5a3d59,_0x148e0e,_0x28d8b7,_0x6cde59,_0x316e10,_0x54868b){var _0x2c7ef9,_0x2ed51e,_0x1e8261,_0x1a73f6;_0x316e10['remoteUri']=intUtil[_0xdb81('0x51')](_0x316e10[_0xdb81('0x50')]);_0x316e10[_0xdb81('0x52')]=intUtil[_0xdb81('0x51')](_0x316e10[_0xdb81('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x316e10[_0xdb81('0x50')]);if(_0x54868b&&_0x54868b[_0xdb81('0x68')]&&_0x54868b[_0xdb81('0x68')]!==_0xdb81('0x69')){logger['info'](_0xdb81('0x6a'),'Recording\x20is\x20enabled!');_0x5a3d59[_0xdb81('0x57')]=util[_0xdb81('0x2d')](_0xdb81('0x58'),_0x316e10[_0xdb81('0x52')],_0x5a3d59['uniqueid'],md5(_0x5a3d59[_0xdb81('0x59')]));}return getConnection(_0x316e10)[_0xdb81('0x2f')](function(_0x40cc07){_0x1a73f6=_0x40cc07;return getUser(_0x316e10,_0x28d8b7[_0xdb81('0x10')],_0x1a73f6);})[_0xdb81('0x2f')](function(_0xf01b86){_0x2c7ef9=_0xf01b86;logger[_0xdb81('0xe')](_0xdb81('0x6b'),_0x2c7ef9['id']);return getEndUser(_0x316e10,_0x5a3d59[_0xdb81('0x6c')],_0x5a3d59['destcalleridnum'],_0x1a73f6);})[_0xdb81('0x2f')](function(_0x526b1c){_0x2ed51e=_0x526b1c;logger['info'](_0xdb81('0x5c'),_0x2ed51e['id']);return getTicket(_0x316e10,_0x2c7ef9,_0x2ed51e,_0x148e0e,_0x5a3d59,_0x148e0e[_0xdb81('0x5d')],_0x1a73f6,_0xdb81('0x6d'));})[_0xdb81('0x2f')](function(_0x2b66bc){_0x1e8261=_0x2b66bc;logger[_0xdb81('0xe')](_0xdb81('0x5f'));logger[_0xdb81('0xe')](_0xdb81('0x60'),_0x1e8261['id']);return setRelationship(_0x1a73f6,_0x2c7ef9,_0x1e8261,_0xdb81('0x61'));})[_0xdb81('0x2f')](function(){return setRelationship(_0x1a73f6,_0x2ed51e,_0x1e8261,_0xdb81('0x62'));})[_0xdb81('0x2f')](function(){return getServerInfo(_0x1a73f6);})['then'](function(_0x36077d){var _0x4a8e93=parseInt(_0x36077d[_0xdb81('0x63')][_0xdb81('0x6e')](0x0));var _0x2fcacf=util[_0xdb81('0x2d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x316e10[_0xdb81('0x50')],_0x1e8261['id']);if(_0x4a8e93>0x6){_0x2fcacf=util[_0xdb81('0x2d')](_0xdb81('0x6f'),_0x316e10['remoteUri'],_0x1e8261['id']);}logger[_0xdb81('0xe')](_0xdb81('0x6a'),_0xdb81('0x64'));emit(util['format']('user:%s',_0x28d8b7[_0xdb81('0x10')]),_0xdb81('0x66'),{'uri':_0x2fcacf});})[_0xdb81('0x70')](function(_0x33dba5){logger['error']('[OUTBOUND]',JSON['stringify'](_0x33dba5));});};exports['unmanaged']=function(_0x21bdde,_0x46608f,_0xf400e1,_0xdb8ac0,_0x1425bc,_0x33754c){var _0x4ec42e,_0x16ffc1,_0x232fdd,_0x1f5ba4;_0x33754c['remoteUri']=intUtil[_0xdb81('0x51')](_0x33754c[_0xdb81('0x50')]);_0x33754c[_0xdb81('0x52')]=intUtil[_0xdb81('0x51')](_0x33754c[_0xdb81('0x52')]);def[_0xdb81('0x53')]=util['format'](_0xdb81('0x71'),_0x33754c[_0xdb81('0x50')]);if(_0x1425bc&&_0x1425bc[_0xdb81('0x54')]){logger[_0xdb81('0xe')]('['+_0x46608f[_0xdb81('0x72')][_0xdb81('0x73')]()+']',_0xdb81('0x56'));_0x46608f['recordingURL']=util['format'](_0xdb81('0x58'),_0x33754c[_0xdb81('0x52')],_0x46608f[_0xdb81('0x59')],md5(_0x46608f['uniqueid']));}else{_0x46608f[_0xdb81('0x57')]='';}return getConnection(_0x33754c)[_0xdb81('0x2f')](function(_0x1df35f){_0x1f5ba4=_0x1df35f;if(!_['isNil'](_0xdb8ac0)){return getUser(_0x33754c,_0xdb8ac0[_0xdb81('0x10')],_0x1f5ba4);}else{return getUser(_0x33754c,null,_0x1f5ba4);}})[_0xdb81('0x2f')](function(_0x428e75){_0x4ec42e=_0x428e75;logger[_0xdb81('0xe')](_0xdb81('0x6b'),_0x4ec42e['id']);return getEndUser(_0x33754c,_0x46608f['calleridname'],_0x46608f[_0xdb81('0x5b')],_0x1f5ba4);})[_0xdb81('0x2f')](function(_0x55b24c){_0x16ffc1=_0x55b24c;logger['info'](_0xdb81('0x5c'),_0x16ffc1['id']);return getTicket(_0x33754c,_0x4ec42e,_0x16ffc1,_0xf400e1,_0x46608f,_0xf400e1[_0xdb81('0x5d')],_0x1f5ba4,'Inbound');})[_0xdb81('0x2f')](function(_0xb41ccd){_0x232fdd=_0xb41ccd;logger[_0xdb81('0xe')](_0xdb81('0x5f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x232fdd['id']);return setRelationship(_0x1f5ba4,_0x4ec42e,_0x232fdd,_0xdb81('0x61'));})['then'](function(){return setRelationship(_0x1f5ba4,_0x16ffc1,_0x232fdd,_0xdb81('0x62'));})[_0xdb81('0x2f')](function(){return getServerInfo(_0x1f5ba4);})['catch'](function(_0x3c81b2){logger['error']('['+_0x46608f[_0xdb81('0x72')]['toUpperCase']()+']',JSON['stringify'](_0x3c81b2));});}; \ 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 30609c7..8d570c1 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 _0xa3dc=['substring','lastIndexOf','validateEmail','test','lodash','sortBy','length','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','customVariable','%s:\x20%s','join','stripTrailingSlash'];(function(_0x1ed404,_0x12fc77){var _0x56c61e=function(_0x3a091d){while(--_0x3a091d){_0x1ed404['push'](_0x1ed404['shift']());}};_0x56c61e(++_0x12fc77);}(_0xa3dc,0x1f2));var _0xca3d=function(_0x4b7868,_0x1595b7){_0x4b7868=_0x4b7868-0x0;var _0x1b92f7=_0xa3dc[_0x4b7868];return _0x1b92f7;};'use strict';var _=require(_0xca3d('0x0'));var util=require('util');exports['getString']=function(_0x1ad55d,_0x5e544e,_0x10211a){var _0x28a633=[];if(_0x1ad55d['length']>0x0){var _0x43eb15=_[_0xca3d('0x1')](_0x1ad55d,['id']);for(var _0x43fb92=0x0;_0x43fb92<_0x43eb15[_0xca3d('0x2')];_0x43fb92++){var _0x1aca4f=_0x43eb15[_0x43fb92];if(_0x1aca4f[_0xca3d('0x3')]===_0xca3d('0x4')){_0x28a633[_0xca3d('0x5')](_0x1aca4f[_0xca3d('0x6')]);}else if(_0x1aca4f['type']===_0xca3d('0x7')&&_0x1aca4f[_0xca3d('0x8')]){_0x5e544e[_0x1aca4f[_0xca3d('0x8')]]&&_0x28a633['push'](_0x5e544e[_0x1aca4f[_0xca3d('0x8')]][_0xca3d('0x9')]());}else if(_0x1aca4f['type']==='customVariable'&&_0x1aca4f[_0xca3d('0xa')]&&_0x1aca4f['Variable'][_0xca3d('0xb')]){_0x5e544e[_0x1aca4f[_0xca3d('0xa')]['name'][_0xca3d('0xc')]()]&&_0x28a633['push'](_0x5e544e[_0x1aca4f[_0xca3d('0xa')]['name'][_0xca3d('0xc')]()][_0xca3d('0x9')]());}else if(_0x1aca4f[_0xca3d('0x3')]===_0xca3d('0xd')){if(_0x1aca4f[_0xca3d('0xe')]===_0xca3d('0x4')&&_0x1aca4f[_0xca3d('0xf')]){_0x28a633['push'](util[_0xca3d('0x10')]('%s:\x20%s',_0x1aca4f['key'],_0x1aca4f[_0xca3d('0x11')]));}else if(_0x1aca4f[_0xca3d('0xe')]===_0xca3d('0x7')&&_0x1aca4f[_0xca3d('0x8')]&&_0x1aca4f[_0xca3d('0xf')]){_0x5e544e[_0x1aca4f[_0xca3d('0x8')]]&&_0x28a633[_0xca3d('0x5')](util[_0xca3d('0x10')]('%s:\x20%s',_0x1aca4f[_0xca3d('0xf')],_0x5e544e[_0x1aca4f[_0xca3d('0x8')]]));}else if(_0x1aca4f[_0xca3d('0xe')]===_0xca3d('0x12')&&_0x1aca4f[_0xca3d('0xa')]&&_0x1aca4f[_0xca3d('0xa')]['name']&&_0x1aca4f['key']){_0x5e544e[_0x1aca4f[_0xca3d('0xa')][_0xca3d('0xb')][_0xca3d('0xc')]()]&&_0x28a633[_0xca3d('0x5')](util[_0xca3d('0x10')](_0xca3d('0x13'),_0x1aca4f[_0xca3d('0xf')],_0x5e544e[_0x1aca4f[_0xca3d('0xa')][_0xca3d('0xb')][_0xca3d('0xc')]()]));}}}}return _0x28a633[_0xca3d('0x14')](_0x10211a);};exports[_0xca3d('0x15')]=function(_0x12397c){var _0x426192=_0x12397c['slice'](-0x1);if(_0x426192==='/'){_0x12397c=_0x12397c[_0xca3d('0x16')](0x0,_0x12397c[_0xca3d('0x17')](_0x426192));}return _0x12397c;};exports[_0xca3d('0x18')]=function(_0x439b84){if(!_['isNil'](_0x439b84)&&_0x439b84!==''){var _0xadbf1f=/^(([^<>()\[\]\\.,;:\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 _0xadbf1f[_0xca3d('0x19')](String(_0x439b84)[_0xca3d('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xff28=['variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','lodash','util','getString','type','string','variable'];(function(_0x111965,_0x10234f){var _0x2b6d43=function(_0x58d79b){while(--_0x58d79b){_0x111965['push'](_0x111965['shift']());}};_0x2b6d43(++_0x10234f);}(_0xff28,0xc2));var _0x8ff2=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0xff28[_0x221b8c];return _0x3fab9f;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));exports[_0x8ff2('0x2')]=function(_0x36ac09,_0x19c21b,_0x552724){var _0x204244=[];if(_0x36ac09['length']>0x0){var _0x295e1a=_['sortBy'](_0x36ac09,['id']);for(var _0x2c1155=0x0;_0x2c1155<_0x295e1a['length'];_0x2c1155++){var _0x143a28=_0x295e1a[_0x2c1155];if(_0x143a28[_0x8ff2('0x3')]===_0x8ff2('0x4')){_0x204244['push'](_0x143a28['content']);}else if(_0x143a28[_0x8ff2('0x3')]===_0x8ff2('0x5')&&_0x143a28['variableName']){_0x19c21b[_0x143a28[_0x8ff2('0x6')]]&&_0x204244[_0x8ff2('0x7')](_0x19c21b[_0x143a28[_0x8ff2('0x6')]][_0x8ff2('0x8')]());}else if(_0x143a28[_0x8ff2('0x3')]===_0x8ff2('0x9')&&_0x143a28[_0x8ff2('0xa')]&&_0x143a28[_0x8ff2('0xa')]['name']){_0x19c21b[_0x143a28[_0x8ff2('0xa')][_0x8ff2('0xb')][_0x8ff2('0xc')]()]&&_0x204244['push'](_0x19c21b[_0x143a28[_0x8ff2('0xa')][_0x8ff2('0xb')]['toLowerCase']()][_0x8ff2('0x8')]());}else if(_0x143a28[_0x8ff2('0x3')]===_0x8ff2('0xd')){if(_0x143a28['keyType']===_0x8ff2('0x4')&&_0x143a28[_0x8ff2('0xe')]){_0x204244[_0x8ff2('0x7')](util[_0x8ff2('0xf')](_0x8ff2('0x10'),_0x143a28[_0x8ff2('0xe')],_0x143a28[_0x8ff2('0x11')]));}else if(_0x143a28[_0x8ff2('0x12')]===_0x8ff2('0x5')&&_0x143a28[_0x8ff2('0x6')]&&_0x143a28[_0x8ff2('0xe')]){_0x19c21b[_0x143a28['variableName']]&&_0x204244[_0x8ff2('0x7')](util['format'](_0x8ff2('0x10'),_0x143a28[_0x8ff2('0xe')],_0x19c21b[_0x143a28[_0x8ff2('0x6')]]));}else if(_0x143a28[_0x8ff2('0x12')]===_0x8ff2('0x9')&&_0x143a28[_0x8ff2('0xa')]&&_0x143a28[_0x8ff2('0xa')][_0x8ff2('0xb')]&&_0x143a28[_0x8ff2('0xe')]){_0x19c21b[_0x143a28['Variable']['name'][_0x8ff2('0xc')]()]&&_0x204244[_0x8ff2('0x7')](util[_0x8ff2('0xf')](_0x8ff2('0x10'),_0x143a28[_0x8ff2('0xe')],_0x19c21b[_0x143a28[_0x8ff2('0xa')]['name'][_0x8ff2('0xc')]()]));}}}}return _0x204244[_0x8ff2('0x13')](_0x552724);};exports[_0x8ff2('0x14')]=function(_0x1a5281){var _0x4b6dfb=_0x1a5281[_0x8ff2('0x15')](-0x1);if(_0x4b6dfb==='/'){_0x1a5281=_0x1a5281[_0x8ff2('0x16')](0x0,_0x1a5281[_0x8ff2('0x17')](_0x4b6dfb));}return _0x1a5281;};exports['validateEmail']=function(_0x54a762){if(!_[_0x8ff2('0x18')](_0x54a762)&&_0x54a762!==''){var _0x3dfea0=/^(([^<>()\[\]\\.,;:\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 _0x3dfea0['test'](String(_0x54a762)[_0x8ff2('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 9853f95..fcc6749 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x6f2dc2,_0x371521){var _0x3b1398=function(_0x4b8c91){while(--_0x4b8c91){_0x6f2dc2['push'](_0x6f2dc2['shift']());}};_0x3b1398(++_0x371521);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +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(_0x369db7,_0x533389){var _0x389d97=function(_0x368b1a){while(--_0x368b1a){_0x369db7['push'](_0x369db7['shift']());}};_0x389d97(++_0x533389);}(_0x34e8,0x12c));var _0x834e=function(_0x3235a0,_0x5ced88){_0x3235a0=_0x3235a0-0x0;var _0xffd58=_0x34e8[_0x3235a0];return _0xffd58;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 625031f..0179b16 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 _0xe031=['trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','The\x20Ticket\x20ID\x20is:','catch','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20created.','authType','password','username','token','%s/token:%s','toString','debug','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','newTab','[OUTBOUND]'];(function(_0x5b2ce3,_0x640988){var _0x559cf1=function(_0xd1a510){while(--_0xd1a510){_0x5b2ce3['push'](_0x5b2ce3['shift']());}};_0x559cf1(++_0x640988);}(_0xe031,0x76));var _0x1e03=function(_0x28ec14,_0x44b027){_0x28ec14=_0x28ec14-0x0;var _0x1f3a8b=_0xe031[_0x28ec14];return _0x1f3a8b;};'use strict';var _=require('lodash');var rp=require(_0x1e03('0x0'));var md5=require(_0x1e03('0x1'));var util=require(_0x1e03('0x2'));var Redis=require(_0x1e03('0x3'));var intUtil=require(_0x1e03('0x4'));var config=require(_0x1e03('0x5'));var logger=require('../../../../config/logger')(_0x1e03('0x6'));config[_0x1e03('0x7')]=_[_0x1e03('0x8')](config[_0x1e03('0x7')],{'host':_0x1e03('0x9'),'port':0x18eb});var io=require(_0x1e03('0xa'))(new Redis(config[_0x1e03('0x7')]));function emit(_0x448026,_0x35f50b,_0x367110){io['to'](_0x448026)[_0x1e03('0xb')](_0x35f50b,_0x367110);}var headers={'Content-Type':'application/json','Accept':_0x1e03('0xc')};function getTicket(_0x10e17e,_0x4710ae,_0x355e84,_0x199c22,_0x21337a){logger[_0x1e03('0xd')](_0x1e03('0xe'));return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x10'),_0x10e17e[_0x1e03('0x11')]),'method':_0x1e03('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x355e84['id'],'submitter_id':_0x4710ae?_0x4710ae['id']:undefined,'assignee_id':_0x4710ae?_0x4710ae['id']:undefined,'tags':getTags(_0x199c22[_0x1e03('0x13')],_0x1e03('0x14')),'subject':intUtil[_0x1e03('0x15')](_0x199c22[_0x1e03('0x16')],_0x21337a,'\x20'),'description':intUtil[_0x1e03('0x15')](_0x199c22[_0x1e03('0x17')],_0x21337a,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x199c22[_0x1e03('0x17')],_0x21337a,'\x0a')}},getCustomFields(_0x199c22[_0x1e03('0x18')],_0x21337a))}})[_0x1e03('0x19')](function(_0x589d36){logger[_0x1e03('0xd')]('Ticket\x20created!');return _0x589d36[_0x1e03('0x1a')];});}function getUser(_0x2613cb,_0x7b077f){if(intUtil[_0x1e03('0x1b')](_0x7b077f)){logger[_0x1e03('0xd')](_0x1e03('0x1c'),_0x7b077f);return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x1d'),_0x2613cb[_0x1e03('0x11')]),'qs':{'query':util[_0x1e03('0xf')](_0x1e03('0x1e'),_0x7b077f)}})[_0x1e03('0x19')](function(_0x436c66){if(_0x436c66[_0x1e03('0x1f')]){logger['info'](_0x1e03('0x20'));return _['find'](_0x436c66[_0x1e03('0x21')],{'email':_0x7b077f,'role':'agent'});}else{logger[_0x1e03('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x22'),_0x2613cb[_0x1e03('0x11')])})[_0x1e03('0x19')](function(_0x394ae7){logger[_0x1e03('0xd')](_0x1e03('0x23'));return _0x394ae7['user'];});}});}else{logger['info'](_0x1e03('0x24'));return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x22'),_0x2613cb[_0x1e03('0x11')])})[_0x1e03('0x19')](function(_0x15342d){logger[_0x1e03('0xd')](_0x1e03('0x23'));return _0x15342d['user'];});}}function getEndUser(_0x1a70c8,_0x7b2d02,_0x55914b){logger[_0x1e03('0xd')](_0x1e03('0x25'),_0x55914b);return request({'uri':util['format'](_0x1e03('0x1d'),_0x1a70c8[_0x1e03('0x11')]),'qs':{'query':util['format'](_0x1e03('0x26'),_0x55914b)}})[_0x1e03('0x19')](function(_0x187717){var _0x17af13;if(_0x187717[_0x1e03('0x21')][_0x1e03('0x27')]){_0x187717[_0x1e03('0x21')]=_[_0x1e03('0x28')](_0x187717['results'],{'suspended':![],'role':_0x1e03('0x29')});if(_0x187717[_0x1e03('0x21')]['length']){_0x17af13=_[_0x1e03('0x2a')](_0x187717['results']);}}if(_0x17af13){logger[_0x1e03('0xd')](_0x1e03('0x2b'));return _0x17af13;}else{logger[_0x1e03('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x1a70c8[_0x1e03('0x11')]),'method':_0x1e03('0x12'),'body':{'user':{'role':_0x1e03('0x29'),'name':util[_0x1e03('0xf')]('Caller\x20-\x20%s',_0x7b2d02||_0x55914b),'phone':_0x55914b}}})[_0x1e03('0x19')](function(_0x3547b3){logger[_0x1e03('0xd')](_0x1e03('0x2c'));return _0x3547b3['user'];});}});}function getAuth(_0x93e4a6){var _0x2b71bb;if(_0x93e4a6[_0x1e03('0x2d')]===_0x1e03('0x2e')){_0x2b71bb=util[_0x1e03('0xf')]('%s:%s',_0x93e4a6[_0x1e03('0x2f')],_0x93e4a6['password']);}else if(_0x93e4a6[_0x1e03('0x2d')]===_0x1e03('0x30')){_0x2b71bb=util[_0x1e03('0xf')](_0x1e03('0x31'),_0x93e4a6[_0x1e03('0x2f')],_0x93e4a6[_0x1e03('0x30')]);}return util['format']('Basic\x20%s',new Buffer(_0x2b71bb)[_0x1e03('0x32')]('base64'));}function request(_0x15c665){logger[_0x1e03('0x33')]('[HTTP]',JSON[_0x1e03('0x34')](_0x15c665));return rp(_[_0x1e03('0x8')](_0x15c665,{'method':_0x1e03('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x1d3425,_0x5f5d51){var _0x3f8f18=[];if(_0x1d3425&&_0x1d3425[_0x1e03('0x27')]>0x0){_0x3f8f18=_[_0x1e03('0x36')](_0x1d3425,_0x5f5d51);}return _0x3f8f18;}function getCustomFields(_0x16e430,_0x2d4e3e){var _0x3c2d4e=[];var _0x131efd={'custom_fields':[]};if(_0x16e430['length']>0x0){_[_0x1e03('0x37')](_0x16e430,function(_0x3f8be3){if(_[_0x1e03('0x38')](['string',_0x1e03('0x39')],_0x3f8be3[_0x1e03('0x3a')])&&_0x3f8be3[_0x1e03('0x3b')]&&!_0x3f8be3[_0x1e03('0x3c')]){_0x131efd[_0x3f8be3[_0x1e03('0x3b')][_0x1e03('0x3d')]()]=_0x3f8be3[_0x1e03('0x3e')]['toString']();}else if(_[_0x1e03('0x38')]([_0x1e03('0x3f'),_0x1e03('0x39')],_0x3f8be3['type'])&&_0x3f8be3[_0x1e03('0x40')]&&_0x3f8be3[_0x1e03('0x3c')]){_0x131efd[_0x1e03('0x41')][_0x1e03('0x42')]({'id':_0x3f8be3[_0x1e03('0x40')],'value':_0x3f8be3[_0x1e03('0x3e')][_0x1e03('0x32')]()});}else if(_0x3f8be3[_0x1e03('0x3a')]===_0x1e03('0x43')&&_0x3f8be3[_0x1e03('0x44')]&&_0x3f8be3[_0x1e03('0x40')]&&_0x3f8be3[_0x1e03('0x3c')]){_0x2d4e3e[_0x3f8be3[_0x1e03('0x44')]]&&_0x131efd['custom_fields'][_0x1e03('0x42')]({'id':_0x3f8be3[_0x1e03('0x40')],'value':_0x2d4e3e[_0x3f8be3[_0x1e03('0x44')]][_0x1e03('0x32')]()});}else if(_0x3f8be3['type']===_0x1e03('0x45')&&_0x3f8be3['Variable']&&_0x3f8be3['Variable']['name']&&_0x3f8be3[_0x1e03('0x40')]&&_0x3f8be3[_0x1e03('0x3c')]){_0x2d4e3e[_0x3f8be3[_0x1e03('0x46')]['name'][_0x1e03('0x3d')]()]&&_0x131efd[_0x1e03('0x41')][_0x1e03('0x42')]({'id':_0x3f8be3[_0x1e03('0x40')],'value':_0x2d4e3e[_0x3f8be3['Variable'][_0x1e03('0x14')]['toLowerCase']()][_0x1e03('0x32')]()});}});}return _0x131efd;}exports[_0x1e03('0x47')]=function(_0x557bff,_0x2df30a,_0x4ed895,_0x2aff19,_0x56abc4,_0x3acffc){var _0x1696db,_0x2d4540;_0x3acffc[_0x1e03('0x11')]=intUtil[_0x1e03('0x48')](_0x3acffc[_0x1e03('0x11')]);_0x3acffc[_0x1e03('0x49')]=intUtil[_0x1e03('0x48')](_0x3acffc[_0x1e03('0x49')]);if(_0x56abc4&&_0x56abc4[_0x1e03('0x4a')]){logger[_0x1e03('0xd')](_0x1e03('0x4b'),_0x1e03('0x4c'));_0x2df30a[_0x1e03('0x4d')]=util[_0x1e03('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3acffc['serverUrl'],_0x2df30a[_0x1e03('0x4e')],md5(_0x2df30a['uniqueid']));}else{_0x2df30a[_0x1e03('0x4d')]='';}headers[_0x1e03('0x4f')]=getAuth(_0x3acffc);return getUser(_0x3acffc,_0x2aff19[_0x1e03('0x50')])[_0x1e03('0x19')](function(_0x6af392){_0x1696db=_0x6af392;logger[_0x1e03('0xd')]('The\x20User\x20ID\x20is:',_0x1696db['id']);return getEndUser(_0x3acffc,_0x2df30a[_0x1e03('0x51')],_0x2df30a[_0x1e03('0x52')]);})[_0x1e03('0x19')](function(_0x293b81){_0x2d4540=_0x293b81;logger['info'](_0x1e03('0x53'),_0x2d4540['id']);return getTicket(_0x3acffc,_0x1696db,_0x2d4540,_0x4ed895,_0x2df30a);})[_0x1e03('0x19')](function(_0xda4f5c){if(_0xda4f5c){logger[_0x1e03('0xd')]('The\x20Ticket\x20ID\x20is:',_0xda4f5c['id']);switch(_0x3acffc[_0x1e03('0x3a')]){case _0x1e03('0x54'):logger[_0x1e03('0xd')](_0x1e03('0x4b'),_0x1e03('0x55'));return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x56'),_0x3acffc[_0x1e03('0x11')],_0x1696db['id'],_0xda4f5c['id']),'method':'POST'});case'newTab':logger[_0x1e03('0xd')](_0x1e03('0x4b'),_0x1e03('0x57'));emit(util[_0x1e03('0xf')](_0x1e03('0x58'),_0x2aff19['name']),'trigger:browser:url',{'uri':util['format'](_0x1e03('0x59'),_0x3acffc[_0x1e03('0x11')][_0x1e03('0x5a')](_0x1e03('0x5b'),''),_0xda4f5c['id'])});break;default:logger[_0x1e03('0x5c')](_0x1e03('0x4b'),_0x1e03('0x5d'));}}})['catch'](function(_0x1b4493){logger['error'](_0x1e03('0x5e'),util[_0x1e03('0x5f')](_0x1b4493,{'showHidden':!![],'depth':null}));});};exports[_0x1e03('0x60')]=function(_0x2d422e,_0x2f91a7,_0x11494e,_0x24687d,_0x4509d0,_0x1ba501,_0x3726c8){var _0x55d336,_0xcd6c80;_0x1ba501['remoteUri']=intUtil['stripTrailingSlash'](_0x1ba501[_0x1e03('0x11')]);_0x1ba501[_0x1e03('0x49')]=intUtil[_0x1e03('0x48')](_0x1ba501[_0x1e03('0x49')]);if(_0x3726c8&&_0x3726c8[_0x1e03('0x61')]&&_0x3726c8['recordingFormat']!==_0x1e03('0x62')){logger[_0x1e03('0xd')]('[OUTBOUND]',_0x1e03('0x4c'));_0x2f91a7['recordingURL']=util[_0x1e03('0xf')](_0x1e03('0x63'),_0x1ba501[_0x1e03('0x49')],_0x2f91a7[_0x1e03('0x4e')],md5(_0x2f91a7[_0x1e03('0x4e')]));}headers[_0x1e03('0x4f')]=getAuth(_0x1ba501);return getUser(_0x1ba501,_0x24687d[_0x1e03('0x50')])[_0x1e03('0x19')](function(_0x5970c7){_0x55d336=_0x5970c7;logger[_0x1e03('0xd')](_0x1e03('0x64'),_0x55d336['id']);return getEndUser(_0x1ba501,_0x2f91a7[_0x1e03('0x65')],_0x2f91a7['destcalleridnum']);})['then'](function(_0x441d54){_0xcd6c80=_0x441d54;logger['info'](_0x1e03('0x53'),_0xcd6c80['id']);return getTicket(_0x1ba501,_0x55d336,_0xcd6c80,_0x11494e,_0x2f91a7);})[_0x1e03('0x19')](function(_0x3864e1){if(_0x3864e1){logger[_0x1e03('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3864e1['id']);switch(_0x1ba501[_0x1e03('0x3a')]){case _0x1e03('0x54'):logger[_0x1e03('0xd')]('[OUTBOUND]',_0x1e03('0x55'));return request({'uri':util[_0x1e03('0xf')](_0x1e03('0x56'),_0x1ba501[_0x1e03('0x11')],_0x55d336['id'],_0x3864e1['id']),'method':_0x1e03('0x12')});case _0x1e03('0x66'):logger[_0x1e03('0xd')](_0x1e03('0x67'),_0x1e03('0x57'));emit(util[_0x1e03('0xf')](_0x1e03('0x58'),_0x24687d['name']),_0x1e03('0x68'),{'uri':util['format'](_0x1e03('0x59'),_0x1ba501[_0x1e03('0x11')][_0x1e03('0x5a')](_0x1e03('0x5b'),''),_0x3864e1['id'])});break;default:logger[_0x1e03('0x5c')]('[OUTBOUND]',_0x1e03('0x5d'));}}})['catch'](function(_0x251adf){logger[_0x1e03('0x5c')](_0x1e03('0x69'),util[_0x1e03('0x5f')](_0x251adf,{'showHidden':!![],'depth':null}));});};exports[_0x1e03('0x6a')]=function(_0x4ccca0,_0x4fc5a9,_0x31a897,_0x2630ed,_0xa2a948,_0x79c50c){var _0x5801a4,_0x20b96b;_0x79c50c['remoteUri']=intUtil[_0x1e03('0x48')](_0x79c50c[_0x1e03('0x11')]);_0x79c50c[_0x1e03('0x49')]=intUtil[_0x1e03('0x48')](_0x79c50c[_0x1e03('0x49')]);if(_0xa2a948&&_0xa2a948[_0x1e03('0x4a')]){logger[_0x1e03('0xd')]('['+_0x4fc5a9['lastevent']['toUpperCase']()+']',_0x1e03('0x4c'));_0x4fc5a9['recordingURL']=util[_0x1e03('0xf')](_0x1e03('0x63'),_0x79c50c['serverUrl'],_0x4fc5a9[_0x1e03('0x4e')],md5(_0x4fc5a9[_0x1e03('0x4e')]));}else{_0x4fc5a9[_0x1e03('0x4d')]='';}headers[_0x1e03('0x4f')]=getAuth(_0x79c50c);return getUser(_0x79c50c)['then'](function(_0x53d5a8){_0x5801a4=_0x53d5a8;logger[_0x1e03('0xd')](_0x1e03('0x64'),_0x5801a4['id']);return getEndUser(_0x79c50c,_0x4fc5a9[_0x1e03('0x51')],_0x4fc5a9['calleridnum']);})[_0x1e03('0x19')](function(_0x244c84){_0x20b96b=_0x244c84;logger['info'](_0x1e03('0x53'),_0x20b96b['id']);return getTicket(_0x79c50c,_0x5801a4,_0x20b96b,_0x31a897,_0x4fc5a9);})['then'](function(_0x4170d7){if(_0x4170d7){logger['info'](_0x1e03('0x6b'),_0x4170d7['id']);}})[_0x1e03('0x6c')](function(_0x5c3a3b){logger['error']('['+_0x4fc5a9[_0x1e03('0x6d')]['toUpperCase']()+']'+_0x1e03('0x6e'),util['inspect'](_0x5c3a3b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd35f=['emit','application/json','info','Creating\x20new\x20ticket...','format','POST','Tags','Descriptions','getString','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','remoteUri','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridnum','newTab','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter'];(function(_0x5b2626,_0xae0c77){var _0x54c381=function(_0xd57015){while(--_0xd57015){_0x5b2626['push'](_0x5b2626['shift']());}};_0x54c381(++_0xae0c77);}(_0xd35f,0x1a8));var _0xfd35=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0xd35f[_0x14b767];return _0x22267a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xfd35('0x0'));var util=require(_0xfd35('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfd35('0x2'));var logger=require(_0xfd35('0x3'))(_0xfd35('0x4'));config[_0xfd35('0x5')]=_['defaults'](config[_0xfd35('0x5')],{'host':_0xfd35('0x6'),'port':0x18eb});var io=require(_0xfd35('0x7'))(new Redis(config[_0xfd35('0x5')]));function emit(_0x4161d9,_0x9021a7,_0x35a253){io['to'](_0x4161d9)[_0xfd35('0x8')](_0x9021a7,_0x35a253);}var headers={'Content-Type':_0xfd35('0x9'),'Accept':_0xfd35('0x9')};function getTicket(_0x588d13,_0x59d994,_0x55b003,_0x4c5271,_0x1daf83){logger[_0xfd35('0xa')](_0xfd35('0xb'));return request({'uri':util[_0xfd35('0xc')]('%s/tickets.json',_0x588d13['remoteUri']),'method':_0xfd35('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x55b003['id'],'submitter_id':_0x59d994?_0x59d994['id']:undefined,'assignee_id':_0x59d994?_0x59d994['id']:undefined,'tags':getTags(_0x4c5271[_0xfd35('0xe')],'name'),'subject':intUtil['getString'](_0x4c5271['Subjects'],_0x1daf83,'\x20'),'description':intUtil['getString'](_0x4c5271[_0xfd35('0xf')],_0x1daf83,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfd35('0x10')](_0x4c5271[_0xfd35('0xf')],_0x1daf83,'\x0a')}},getCustomFields(_0x4c5271[_0xfd35('0x11')],_0x1daf83))}})['then'](function(_0x51337c){logger[_0xfd35('0xa')]('Ticket\x20created!');return _0x51337c[_0xfd35('0x12')];});}function getUser(_0x22c46d,_0x22a91c){if(intUtil[_0xfd35('0x13')](_0x22a91c)){logger[_0xfd35('0xa')](_0xfd35('0x14'),_0x22a91c);return request({'uri':util[_0xfd35('0xc')](_0xfd35('0x15'),_0x22c46d['remoteUri']),'qs':{'query':util[_0xfd35('0xc')](_0xfd35('0x16'),_0x22a91c)}})[_0xfd35('0x17')](function(_0x431657){if(_0x431657[_0xfd35('0x18')]){logger[_0xfd35('0xa')](_0xfd35('0x19'));return _['find'](_0x431657[_0xfd35('0x1a')],{'email':_0x22a91c,'role':'agent'});}else{logger[_0xfd35('0xa')](_0xfd35('0x1b'));return request({'uri':util['format']('%s/users/me.json',_0x22c46d['remoteUri'])})[_0xfd35('0x17')](function(_0xa681c3){logger[_0xfd35('0xa')]('Admin\x20account\x20selected.');return _0xa681c3[_0xfd35('0x1c')];});}});}else{logger[_0xfd35('0xa')](_0xfd35('0x1b'));return request({'uri':util[_0xfd35('0xc')](_0xfd35('0x1d'),_0x22c46d['remoteUri'])})['then'](function(_0x1408a7){logger[_0xfd35('0xa')](_0xfd35('0x1e'));return _0x1408a7[_0xfd35('0x1c')];});}}function getEndUser(_0xd15535,_0x835e19,_0x1f54ee){logger[_0xfd35('0xa')](_0xfd35('0x1f'),_0x1f54ee);return request({'uri':util[_0xfd35('0xc')](_0xfd35('0x15'),_0xd15535[_0xfd35('0x20')]),'qs':{'query':util[_0xfd35('0xc')](_0xfd35('0x21'),_0x1f54ee)}})[_0xfd35('0x17')](function(_0x2a14ef){var _0x1f7707;if(_0x2a14ef[_0xfd35('0x1a')][_0xfd35('0x22')]){_0x2a14ef[_0xfd35('0x1a')]=_['filter'](_0x2a14ef[_0xfd35('0x1a')],{'suspended':![],'role':_0xfd35('0x23')});if(_0x2a14ef[_0xfd35('0x1a')][_0xfd35('0x22')]){_0x1f7707=_[_0xfd35('0x24')](_0x2a14ef[_0xfd35('0x1a')]);}}if(_0x1f7707){logger['info'](_0xfd35('0x25'));return _0x1f7707;}else{logger[_0xfd35('0xa')](_0xfd35('0x26'));return request({'uri':util['format'](_0xfd35('0x27'),_0xd15535[_0xfd35('0x20')]),'method':_0xfd35('0xd'),'body':{'user':{'role':_0xfd35('0x23'),'name':util[_0xfd35('0xc')](_0xfd35('0x28'),_0x835e19||_0x1f54ee),'phone':_0x1f54ee}}})[_0xfd35('0x17')](function(_0x3764ee){logger[_0xfd35('0xa')]('Enduser\x20created.');return _0x3764ee['user'];});}});}function getAuth(_0x2729df){var _0x428a5a;if(_0x2729df[_0xfd35('0x29')]===_0xfd35('0x2a')){_0x428a5a=util[_0xfd35('0xc')](_0xfd35('0x2b'),_0x2729df['username'],_0x2729df[_0xfd35('0x2a')]);}else if(_0x2729df[_0xfd35('0x29')]===_0xfd35('0x2c')){_0x428a5a=util[_0xfd35('0xc')](_0xfd35('0x2d'),_0x2729df[_0xfd35('0x2e')],_0x2729df[_0xfd35('0x2c')]);}return util[_0xfd35('0xc')]('Basic\x20%s',new Buffer(_0x428a5a)[_0xfd35('0x2f')](_0xfd35('0x30')));}function request(_0x9dae4e){logger['debug']('[HTTP]',JSON[_0xfd35('0x31')](_0x9dae4e));return rp(_[_0xfd35('0x32')](_0x9dae4e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4cbc38,_0x15c971){var _0x3298ee=[];if(_0x4cbc38&&_0x4cbc38[_0xfd35('0x22')]>0x0){_0x3298ee=_[_0xfd35('0x33')](_0x4cbc38,_0x15c971);}return _0x3298ee;}function getCustomFields(_0x138a78,_0x24d866){var _0x3cfa58=[];var _0x3df9bd={'custom_fields':[]};if(_0x138a78[_0xfd35('0x22')]>0x0){_[_0xfd35('0x34')](_0x138a78,function(_0x368dd3){if(_[_0xfd35('0x35')]([_0xfd35('0x36'),_0xfd35('0x37')],_0x368dd3[_0xfd35('0x38')])&&_0x368dd3[_0xfd35('0x39')]&&!_0x368dd3['customField']){_0x3df9bd[_0x368dd3['nameField'][_0xfd35('0x3a')]()]=_0x368dd3[_0xfd35('0x3b')][_0xfd35('0x2f')]();}else if(_[_0xfd35('0x35')](['string',_0xfd35('0x37')],_0x368dd3[_0xfd35('0x38')])&&_0x368dd3[_0xfd35('0x3c')]&&_0x368dd3[_0xfd35('0x3d')]){_0x3df9bd[_0xfd35('0x3e')][_0xfd35('0x3f')]({'id':_0x368dd3['idField'],'value':_0x368dd3[_0xfd35('0x3b')][_0xfd35('0x2f')]()});}else if(_0x368dd3['type']===_0xfd35('0x40')&&_0x368dd3[_0xfd35('0x41')]&&_0x368dd3['idField']&&_0x368dd3[_0xfd35('0x3d')]){_0x24d866[_0x368dd3[_0xfd35('0x41')]]&&_0x3df9bd['custom_fields'][_0xfd35('0x3f')]({'id':_0x368dd3['idField'],'value':_0x24d866[_0x368dd3[_0xfd35('0x41')]][_0xfd35('0x2f')]()});}else if(_0x368dd3[_0xfd35('0x38')]===_0xfd35('0x42')&&_0x368dd3[_0xfd35('0x43')]&&_0x368dd3[_0xfd35('0x43')][_0xfd35('0x44')]&&_0x368dd3[_0xfd35('0x3c')]&&_0x368dd3[_0xfd35('0x3d')]){_0x24d866[_0x368dd3[_0xfd35('0x43')][_0xfd35('0x44')]['toLowerCase']()]&&_0x3df9bd[_0xfd35('0x3e')][_0xfd35('0x3f')]({'id':_0x368dd3[_0xfd35('0x3c')],'value':_0x24d866[_0x368dd3[_0xfd35('0x43')][_0xfd35('0x44')]['toLowerCase']()][_0xfd35('0x2f')]()});}});}return _0x3df9bd;}exports['queue']=function(_0x17ce5b,_0x2295c5,_0x15352d,_0xf68838,_0x2a0520,_0x284e5f){var _0x147b92,_0x296d6d;_0x284e5f[_0xfd35('0x20')]=intUtil[_0xfd35('0x45')](_0x284e5f[_0xfd35('0x20')]);_0x284e5f['serverUrl']=intUtil[_0xfd35('0x45')](_0x284e5f[_0xfd35('0x46')]);if(_0x2a0520&&_0x2a0520[_0xfd35('0x47')]){logger[_0xfd35('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2295c5[_0xfd35('0x48')]=util['format'](_0xfd35('0x49'),_0x284e5f['serverUrl'],_0x2295c5[_0xfd35('0x4a')],md5(_0x2295c5[_0xfd35('0x4a')]));}else{_0x2295c5[_0xfd35('0x48')]='';}headers[_0xfd35('0x4b')]=getAuth(_0x284e5f);return getUser(_0x284e5f,_0xf68838['email'])['then'](function(_0x496b86){_0x147b92=_0x496b86;logger[_0xfd35('0xa')]('The\x20User\x20ID\x20is:',_0x147b92['id']);return getEndUser(_0x284e5f,_0x2295c5[_0xfd35('0x4c')],_0x2295c5[_0xfd35('0x4d')]);})[_0xfd35('0x17')](function(_0x390c05){_0x296d6d=_0x390c05;logger[_0xfd35('0xa')](_0xfd35('0x4e'),_0x296d6d['id']);return getTicket(_0x284e5f,_0x147b92,_0x296d6d,_0x15352d,_0x2295c5);})['then'](function(_0x246083){if(_0x246083){logger['info'](_0xfd35('0x4f'),_0x246083['id']);switch(_0x284e5f[_0xfd35('0x38')]){case _0xfd35('0x50'):logger[_0xfd35('0xa')](_0xfd35('0x51'),_0xfd35('0x52'));return request({'uri':util[_0xfd35('0xc')](_0xfd35('0x53'),_0x284e5f['remoteUri'],_0x147b92['id'],_0x246083['id']),'method':'POST'});case'newTab':logger[_0xfd35('0xa')](_0xfd35('0x51'),_0xfd35('0x54'));emit(util[_0xfd35('0xc')](_0xfd35('0x55'),_0xf68838['name']),_0xfd35('0x56'),{'uri':util['format'](_0xfd35('0x57'),_0x284e5f[_0xfd35('0x20')]['replace'](_0xfd35('0x58'),''),_0x246083['id'])});break;default:logger[_0xfd35('0x59')](_0xfd35('0x51'),_0xfd35('0x5a'));}}})[_0xfd35('0x5b')](function(_0x41c5a6){logger['error'](_0xfd35('0x5c'),util['inspect'](_0x41c5a6,{'showHidden':!![],'depth':null}));});};exports[_0xfd35('0x5d')]=function(_0x1ff543,_0x188456,_0x11b32f,_0x212cab,_0x1af1f5,_0x1bb1cf,_0xcbf78d){var _0x31b149,_0x2e4119;_0x1bb1cf[_0xfd35('0x20')]=intUtil['stripTrailingSlash'](_0x1bb1cf['remoteUri']);_0x1bb1cf['serverUrl']=intUtil['stripTrailingSlash'](_0x1bb1cf[_0xfd35('0x46')]);if(_0xcbf78d&&_0xcbf78d[_0xfd35('0x5e')]&&_0xcbf78d[_0xfd35('0x5e')]!==_0xfd35('0x5f')){logger[_0xfd35('0xa')](_0xfd35('0x60'),'Recording\x20is\x20enabled!');_0x188456[_0xfd35('0x48')]=util[_0xfd35('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bb1cf[_0xfd35('0x46')],_0x188456[_0xfd35('0x4a')],md5(_0x188456[_0xfd35('0x4a')]));}headers[_0xfd35('0x4b')]=getAuth(_0x1bb1cf);return getUser(_0x1bb1cf,_0x212cab[_0xfd35('0x61')])['then'](function(_0x59af50){_0x31b149=_0x59af50;logger[_0xfd35('0xa')](_0xfd35('0x62'),_0x31b149['id']);return getEndUser(_0x1bb1cf,_0x188456['destcalleridname'],_0x188456[_0xfd35('0x63')]);})[_0xfd35('0x17')](function(_0x249149){_0x2e4119=_0x249149;logger['info'](_0xfd35('0x4e'),_0x2e4119['id']);return getTicket(_0x1bb1cf,_0x31b149,_0x2e4119,_0x11b32f,_0x188456);})['then'](function(_0x202776){if(_0x202776){logger[_0xfd35('0xa')](_0xfd35('0x4f'),_0x202776['id']);switch(_0x1bb1cf['type']){case _0xfd35('0x50'):logger[_0xfd35('0xa')](_0xfd35('0x60'),_0xfd35('0x52'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1bb1cf[_0xfd35('0x20')],_0x31b149['id'],_0x202776['id']),'method':_0xfd35('0xd')});case _0xfd35('0x64'):logger['info'](_0xfd35('0x60'),_0xfd35('0x54'));emit(util['format'](_0xfd35('0x55'),_0x212cab[_0xfd35('0x44')]),_0xfd35('0x56'),{'uri':util['format'](_0xfd35('0x57'),_0x1bb1cf[_0xfd35('0x20')][_0xfd35('0x65')]('/api/v2',''),_0x202776['id'])});break;default:logger[_0xfd35('0x59')](_0xfd35('0x60'),_0xfd35('0x5a'));}}})[_0xfd35('0x5b')](function(_0x1610ae){logger[_0xfd35('0x59')](_0xfd35('0x66'),util[_0xfd35('0x67')](_0x1610ae,{'showHidden':!![],'depth':null}));});};exports[_0xfd35('0x68')]=function(_0x4ac50e,_0x6fd649,_0x5cbd4c,_0x22e201,_0x2fe5d7,_0x2bbc2c){var _0x4de6eb,_0x41a64e;_0x2bbc2c['remoteUri']=intUtil[_0xfd35('0x45')](_0x2bbc2c[_0xfd35('0x20')]);_0x2bbc2c[_0xfd35('0x46')]=intUtil[_0xfd35('0x45')](_0x2bbc2c['serverUrl']);if(_0x2fe5d7&&_0x2fe5d7[_0xfd35('0x47')]){logger[_0xfd35('0xa')]('['+_0x6fd649[_0xfd35('0x69')][_0xfd35('0x6a')]()+']','Recording\x20is\x20enabled!');_0x6fd649[_0xfd35('0x48')]=util['format'](_0xfd35('0x49'),_0x2bbc2c[_0xfd35('0x46')],_0x6fd649[_0xfd35('0x4a')],md5(_0x6fd649['uniqueid']));}else{_0x6fd649[_0xfd35('0x48')]='';}headers[_0xfd35('0x4b')]=getAuth(_0x2bbc2c);return getUser(_0x2bbc2c)['then'](function(_0x5e0567){_0x4de6eb=_0x5e0567;logger[_0xfd35('0xa')](_0xfd35('0x62'),_0x4de6eb['id']);return getEndUser(_0x2bbc2c,_0x6fd649['calleridname'],_0x6fd649[_0xfd35('0x4d')]);})['then'](function(_0xcb7619){_0x41a64e=_0xcb7619;logger[_0xfd35('0xa')]('The\x20Enduser\x20ID\x20is:',_0x41a64e['id']);return getTicket(_0x2bbc2c,_0x4de6eb,_0x41a64e,_0x5cbd4c,_0x6fd649);})[_0xfd35('0x17')](function(_0x5da554){if(_0x5da554){logger[_0xfd35('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5da554['id']);}})['catch'](function(_0x42e51a){logger[_0xfd35('0x59')]('['+_0x6fd649['lastevent'][_0xfd35('0x6a')]()+']'+_0xfd35('0x6b'),util[_0xfd35('0x67')](_0x42e51a,{'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 a28664a..e7f3869 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 _0xecf0=['toString','variableName','type','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','clientId','clientSecret','refresh_token','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','info','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','The\x20failing\x20result\x20is','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Called','complete','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','data','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','com','The\x20User\x20ID\x20is:','destcalleridnum','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField'];(function(_0x28045a,_0x3a8301){var _0x4b6c9=function(_0xd7d59){while(--_0xd7d59){_0x28045a['push'](_0x28045a['shift']());}};_0x4b6c9(++_0x3a8301);}(_0xecf0,0x84));var _0x0ecf=function(_0x5f3a04,_0x35f051){_0x5f3a04=_0x5f3a04-0x0;var _0x4a2e67=_0xecf0[_0x5f3a04];return _0x4a2e67;};'use strict';var _=require(_0x0ecf('0x0'));var rp=require(_0x0ecf('0x1'));var md5=require(_0x0ecf('0x2'));var util=require(_0x0ecf('0x3'));var intUtil=require('./util');var moment=require(_0x0ecf('0x4'));var Redis=require(_0x0ecf('0x5'));var BPromise=require(_0x0ecf('0x6'));var config=require(_0x0ecf('0x7'));var logger=require(_0x0ecf('0x8'))(_0x0ecf('0x9'));config[_0x0ecf('0xa')]=_[_0x0ecf('0xb')](config['redis'],{'host':_0x0ecf('0xc'),'port':0x18eb});var io=require(_0x0ecf('0xd'))(new Redis(config['redis']));function emit(_0x591064,_0x3ee443,_0x31916f){io['to'](_0x591064)[_0x0ecf('0xe')](_0x3ee443,_0x31916f);}function request(_0x3dd280){logger[_0x0ecf('0xf')](_0x0ecf('0x10'),JSON[_0x0ecf('0x11')](_0x3dd280));return rp(_0x3dd280);}function getCustomFields(_0x98f9ca,_0x5d4d75){var _0x2947c6={};if(_0x98f9ca[_0x0ecf('0x12')]>0x0){_[_0x0ecf('0x13')](_0x98f9ca,function(_0x34d63c){if(_[_0x0ecf('0x14')]([_0x0ecf('0x15'),_0x0ecf('0x16')],_0x34d63c['type'])&&_0x34d63c[_0x0ecf('0x17')]){_0x2947c6[_0x34d63c[_0x0ecf('0x17')]]=_0x34d63c['content'][_0x0ecf('0x18')]();}else if(_0x34d63c['type']==='variable'&&_0x34d63c[_0x0ecf('0x19')]&&_0x34d63c[_0x0ecf('0x17')]&&_0x5d4d75[_0x34d63c[_0x0ecf('0x19')]]){_0x2947c6[_0x34d63c[_0x0ecf('0x17')]]=_0x5d4d75[_0x34d63c[_0x0ecf('0x19')]]['toString']();}else if(_0x34d63c[_0x0ecf('0x1a')]==='customVariable'&&_0x34d63c[_0x0ecf('0x1b')]&&_0x34d63c[_0x0ecf('0x1b')][_0x0ecf('0x1c')]&&_0x34d63c[_0x0ecf('0x17')]&&_0x5d4d75[_0x34d63c[_0x0ecf('0x1b')][_0x0ecf('0x1c')][_0x0ecf('0x1d')]()]){_0x2947c6[_0x34d63c['idField']]=_0x5d4d75[_0x34d63c[_0x0ecf('0x1b')]['name'][_0x0ecf('0x1d')]()][_0x0ecf('0x18')]();}});}return _0x2947c6;}function getName(_0x4dd7d6){if(_0x4dd7d6[_0x0ecf('0x1e')]('\x20')>0x0){var _0x54d4ed=_0x4dd7d6['split'](/ (.+)/);if(_0x54d4ed[0x1]){return _0x54d4ed;}}return[_0x4dd7d6,_0x4dd7d6];}var accountsTokens={};function getAccessToken(_0x5b079){return new Promise(function(_0x4982dd,_0x348e46){if(!_[_0x0ecf('0x1f')](accountsTokens[_0x5b079['id']])&&!_[_0x0ecf('0x1f')](accountsTokens[_0x5b079['id']][_0x0ecf('0x20')])){if(moment()[_0x0ecf('0x21')](accountsTokens[_0x5b079['id']]['expires_in'])){_0x4982dd(accountsTokens[_0x5b079['id']][_0x0ecf('0x20')]);}}var _0x828703;switch(_0x5b079[_0x0ecf('0x22')]){case'US':_0x828703=_0x0ecf('0x23');break;case'AU':_0x828703=_0x0ecf('0x24');break;case'EU':_0x828703=_0x0ecf('0x25');break;case'IN':_0x828703=_0x0ecf('0x26');break;case'CN':_0x828703='https://accounts.zoho.com.cn';break;default:_0x828703=_0x0ecf('0x25');break;}var _0x55e09c={'method':'POST','uri':_0x828703+_0x0ecf('0x27'),'qs':{'refresh_token':_0x5b079['refreshToken'],'client_id':_0x5b079[_0x0ecf('0x28')],'client_secret':_0x5b079[_0x0ecf('0x29')],'grant_type':_0x0ecf('0x2a')},'json':!![]};return rp(_0x55e09c)['then'](function(_0x440382){accountsTokens[_0x5b079['id']]={'access_token':_0x440382[_0x0ecf('0x20')],'expires_in':moment()['add'](_0x440382[_0x0ecf('0x2b')],'seconds')};_0x4982dd(_0x440382['access_token']);})[_0x0ecf('0x2c')](function(_0x1e9b20){logger[_0x0ecf('0x2d')](_0x0ecf('0x2e'),_0x1e9b20[_0x0ecf('0x2f')]);_0x348e46(_0x1e9b20);});});}function getUser(_0x5df966,_0x2e1d3b,_0x1e87dd,_0xfd6f63){logger['info'](_0x0ecf('0x30'));return request({'method':_0x0ecf('0x31'),'uri':util[_0x0ecf('0x32')](_0x0ecf('0x33'),_0x2e1d3b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x0ecf('0x34')+_0x5df966},'json':!![]})[_0x0ecf('0x35')](function(_0xbc96bc){if(_0xbc96bc[_0x0ecf('0x36')]){var _0x2bc371=-0x1;if(_[_0x0ecf('0x37')](_0xbc96bc[_0x0ecf('0x36')])){if(!_[_0x0ecf('0x1f')](_0xfd6f63)){_0x2bc371=_['findIndex'](_0xbc96bc[_0x0ecf('0x36')],function(_0x59b018){return _0x59b018[_0x0ecf('0x38')]===_0xfd6f63;});}if(_0x2bc371>=0x0){logger['info'](_0x0ecf('0x39'));}else{logger['info'](_0x0ecf('0x3a'));_0x2bc371=_[_0x0ecf('0x3b')](_0xbc96bc[_0x0ecf('0x36')],function(_0x2642a1){return _0x2642a1[_0x0ecf('0x3c')][_0x0ecf('0x1c')]===_0x0ecf('0x3d');});}return _0xbc96bc[_0x0ecf('0x36')][_0x2bc371];}else{if(_0xbc96bc[_0x0ecf('0x3e')][_0x0ecf('0x3c')][_0x0ecf('0x1c')]===_0x0ecf('0x3d')){logger[_0x0ecf('0x3f')](_0x0ecf('0x3a'));user=_0xbc96bc[_0x0ecf('0x3e')];return user;}else{logger[_0x0ecf('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0ecf('0x11')](_0xbc96bc));throw new Error(_0x0ecf('0x40')+JSON['stringify'](_0xbc96bc));}}}else{logger[_0x0ecf('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0ecf('0x11')](_0xbc96bc));throw new Error(_0x0ecf('0x40')+JSON[_0x0ecf('0x11')](_0xbc96bc));}})[_0x0ecf('0x2c')](function(_0x47de68){console[_0x0ecf('0x2d')](_0x47de68);});}function getZohoUser(_0x3a5d5d,_0x5c18d8){return new BPromise(function(_0x471473,_0x1d8e4b){request(_0x3a5d5d)['then'](function(_0x5c3b55){var _0x2a2442=null;if(_0x5c3b55){_0x2a2442=_0x5c3b55['data'][0x0];_0x2a2442[_0x0ecf('0x41')]=_0x5c18d8;}_0x471473(_0x2a2442);})[_0x0ecf('0x2c')](function(_0x12adc1){_0x1d8e4b(_0x12adc1);});});}function createEndUser(_0x105492,_0x159cc4,_0x4539b5,_0x79def6,_0x1427af,_0x51d723){var _0x4539b5=getName(_0x4539b5);return request({'method':_0x0ecf('0x42'),'uri':_0x0ecf('0x43')+_0x159cc4+'/crm/v2/'+_[_0x0ecf('0x44')](_0x51d723[_0x0ecf('0x45')])+'s','body':{'data':[{'Last_Name':_0x4539b5[0x1],'First_Name':_0x4539b5[0x0],'Phone':_0x79def6,'Owner':{'name':!_[_0x0ecf('0x1f')](_0x1427af['role'][_0x0ecf('0x1c')])?_0x1427af[_0x0ecf('0x46')]['name']:!_[_0x0ecf('0x1f')](_0x1427af['first_name'])?_0x1427af[_0x0ecf('0x47')]+'\x20'+_0x1427af[_0x0ecf('0x48')]:_0x1427af['last_name'],'id':_0x1427af['id']}}]},'headers':{'Authorization':_0x0ecf('0x34')+_0x105492},'json':!![]})[_0x0ecf('0x35')](function(_0x4ba6e6){if(_0x4ba6e6&&_0x4ba6e6['data'][0x0][_0x0ecf('0x49')]===_0x0ecf('0x4a')){var _0x24190e=_0x4ba6e6['data'][0x0][_0x0ecf('0x4b')];_0x24190e[_0x0ecf('0x41')]=_[_0x0ecf('0x44')](_0x51d723[_0x0ecf('0x45')])+'s';return _0x24190e;}logger[_0x0ecf('0x2d')](_0x0ecf('0x4c'),JSON[_0x0ecf('0x11')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x0ecf('0x2c')](function(_0x49c82f){console['log'](_0x0ecf('0x4d'),_0x49c82f);});}function getEndUser(_0x5395c2,_0xf74d36,_0x15407d,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c){var _0x2e4711={'method':'GET','uri':'','headers':{'Authorization':_0x0ecf('0x34')+_0x5395c2},'json':!![]};switch(_0x43946c['moduleSearch']){case _0x0ecf('0x4e'):_0x2e4711[_0x0ecf('0x4f')]='https://www.zohoapis.'+_0xf74d36+_0x0ecf('0x50')+_0x18768a+'))';return getZohoUser(_0x2e4711,_0x0ecf('0x51'))[_0x0ecf('0x35')](function(_0x29592a){if(_0x29592a)return _0x29592a;_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x18768a+'))';return getZohoUser(_0x2e4711,'Leads')[_0x0ecf('0x35')](function(_0x3914fc){if(_0x3914fc)return _0x3914fc;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});});break;case _0x0ecf('0x53'):_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+_0x0ecf('0x50')+_0x18768a+'))';return getZohoUser(_0x2e4711,_0x0ecf('0x51'))[_0x0ecf('0x35')](function(_0x44a893){if(_0x44a893)return _0x44a893;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});break;case'lead':_0x2e4711[_0x0ecf('0x4f')]=_0x0ecf('0x43')+_0xf74d36+_0x0ecf('0x54')+_0x18768a+'))';return getZohoUser(_0x2e4711,'Leads')[_0x0ecf('0x35')](function(_0x452072){if(_0x452072)return _0x452072;if(_0x43946c[_0x0ecf('0x45')]!=_0x0ecf('0x52')){return createEndUser(_0x5395c2,_0xf74d36,_0x49e2c1,_0x18768a,_0x26576b,_0x43946c);}else{return{};}});break;}}function getCall(_0x53210a,_0x2c7940,_0x41b947,_0x55341e,_0x2f27a1,_0x1b884c,_0x4bbb54,_0x184fb0){logger[_0x0ecf('0x3f')](_0x0ecf('0x55'));var _0x5b3d0f={};_0x5b3d0f[_0x0ecf('0x56')]={'name':!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x46')][_0x0ecf('0x1c')])&&!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x3c')]['name'])&&_0x55341e[_0x0ecf('0x3c')]['name']===_0x0ecf('0x57')?_0x55341e[_0x0ecf('0x46')][_0x0ecf('0x1c')]:!_[_0x0ecf('0x1f')](_0x55341e[_0x0ecf('0x47')])?_0x55341e[_0x0ecf('0x47')]+'\x20'+_0x55341e[_0x0ecf('0x48')]:_0x55341e[_0x0ecf('0x48')],'id':_0x55341e['id']};_0x5b3d0f[_0x0ecf('0x58')]=intUtil[_0x0ecf('0x59')](_0x1b884c[_0x0ecf('0x5a')],_0x4bbb54,'\x20');_0x5b3d0f[_0x0ecf('0x5b')]=intUtil[_0x0ecf('0x59')](_0x1b884c[_0x0ecf('0x5c')],_0x4bbb54,'\x0a');if(_0x2f27a1[_0x0ecf('0x41')]===_0x0ecf('0x51')){_0x5b3d0f['Who_Id']={'name':!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5d')])?_0x2f27a1['Full_Name']:!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5e')])?_0x2f27a1[_0x0ecf('0x5e')]+'\x20'+_0x2f27a1[_0x0ecf('0x5f')]:_0x2f27a1[_0x0ecf('0x5f')],'id':_0x2f27a1['id']};}if(_0x2f27a1['enduserType']===_0x0ecf('0x60')){_0x5b3d0f[_0x0ecf('0x61')]={'name':!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5d')])?_0x2f27a1['Full_Name']:!_[_0x0ecf('0x1f')](_0x2f27a1[_0x0ecf('0x5e')])?_0x2f27a1[_0x0ecf('0x5e')]+'\x20'+_0x2f27a1[_0x0ecf('0x5f')]:_0x2f27a1[_0x0ecf('0x5f')],'id':_0x2f27a1['id']};_0x5b3d0f[_0x0ecf('0x62')]=_[_0x0ecf('0x44')](_0x2f27a1['enduserType']);}if(_0x4bbb54[_0x0ecf('0x63')]){_0x5b3d0f[_0x0ecf('0x64')]=moment[_0x0ecf('0x65')](parseInt(_0x4bbb54[_0x0ecf('0x63')])*0x3e8)[_0x0ecf('0x32')](_0x0ecf('0x66'));}else if(_0x4bbb54[_0x0ecf('0x67')]&&_0x4bbb54[_0x0ecf('0x68')]){_0x5b3d0f[_0x0ecf('0x64')]=moment['utc'](moment(_0x4bbb54[_0x0ecf('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x0ecf('0x69')](moment(_0x4bbb54[_0x0ecf('0x6a')],_0x0ecf('0x6b'))))[_0x0ecf('0x32')](_0x0ecf('0x66'));}switch(_0x4bbb54[_0x0ecf('0x6c')]){case'called':_0x5b3d0f['Call_Result']=_0x0ecf('0x6d');break;case _0x0ecf('0x6e'):case'connect':_0x5b3d0f[_0x0ecf('0x6f')]='Answered';break;case _0x0ecf('0x70'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x71');break;case _0x0ecf('0x72'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x73');break;case _0x0ecf('0x74'):_0x5b3d0f[_0x0ecf('0x6f')]=_0x0ecf('0x75');default:}_0x5b3d0f[_0x0ecf('0x76')]=(_0x184fb0===_0x0ecf('0x77')?moment(_0x4bbb54['starttime'])[_0x0ecf('0x32')](_0x0ecf('0x6b')):moment(_0x4bbb54[_0x0ecf('0x78')])[_0x0ecf('0x32')](_0x0ecf('0x6b')))||moment()[_0x0ecf('0x32')](_0x0ecf('0x6b'));_0x5b3d0f[_0x0ecf('0x79')]=_0x184fb0||'Inbound';_0x5b3d0f=_[_0x0ecf('0x7a')](_0x5b3d0f,getCustomFields(_0x1b884c[_0x0ecf('0x7b')],_0x4bbb54));return request({'method':_0x0ecf('0x42'),'uri':_0x0ecf('0x43')+_0x2c7940+_0x0ecf('0x7c'),'headers':{'Authorization':_0x0ecf('0x34')+_0x53210a},'body':{'data':[_0x5b3d0f]},'json':!![]})[_0x0ecf('0x35')](function(_0x5685f5){if(_0x5685f5&&_0x5685f5['data'][0x0][_0x0ecf('0x49')]===_0x0ecf('0x4a')){logger[_0x0ecf('0x3f')](_0x0ecf('0x7d'));return{'id':_0x5685f5[_0x0ecf('0x7e')][0x0][_0x0ecf('0x4b')]['id']};}})[_0x0ecf('0x2c')](function(_0x279c34){logger[_0x0ecf('0x3f')](_0x0ecf('0x7f'),_0x279c34[_0x0ecf('0x2f')]);console['log']('err',_0x279c34);});}exports['queue']=function(_0x521c9d,_0x31b398,_0x2b08e3,_0x4e0f43,_0x31ebe8,_0x596d7a){var _0x4b2482,_0x371dfa,_0x2c120d;_0x596d7a[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x596d7a[_0x0ecf('0x80')]);_0x596d7a['serverUrl']=intUtil[_0x0ecf('0x81')](_0x596d7a[_0x0ecf('0x82')]);if(_0x31ebe8&&_0x31ebe8[_0x0ecf('0x83')]){logger[_0x0ecf('0x3f')]('[QUEUE]',_0x0ecf('0x84'));_0x31b398['recordingURL']=_0x596d7a[_0x0ecf('0x82')]+_0x0ecf('0x85')+_0x31b398['uniqueid']+_0x0ecf('0x86')+md5(_0x31b398[_0x0ecf('0x87')]);}else{_0x31b398['recordingURL']='';}var _0x544d2b=_0x596d7a['host']===_0x0ecf('0x88')?'eu':'com';return getAccessToken(_0x596d7a)[_0x0ecf('0x35')](function(_0xa44d2b){_0x2c120d=_0xa44d2b;return getUser(_0x2c120d,_0x544d2b,_0x596d7a,_0x4e0f43['email']);})[_0x0ecf('0x35')](function(_0x535d70){_0x4b2482=_0x535d70;logger[_0x0ecf('0x3f')]('The\x20User\x20ID\x20is:',_0x4b2482['id']);return getEndUser(_0x2c120d,_0x544d2b,_0x596d7a,_0x31b398[_0x0ecf('0x89')],_0x31b398[_0x0ecf('0x8a')],_0x4b2482,_0x2b08e3);})[_0x0ecf('0x35')](function(_0x1853c4){_0x371dfa=_0x1853c4;return getCall(_0x2c120d,_0x544d2b,_0x596d7a,_0x4b2482,_0x371dfa,_0x2b08e3,_0x31b398,_0x0ecf('0x8b'));})['then'](function(_0x4ea8b3){if(_0x4ea8b3){logger[_0x0ecf('0x3f')](_0x0ecf('0x8c'),_0x4ea8b3['id']);logger['info']('[QUEUE]',_0x0ecf('0x8d'));emit(util[_0x0ecf('0x32')]('user:%s',_0x4e0f43['name']),_0x0ecf('0x8e'),{'uri':_0x0ecf('0x8f')+_0x596d7a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4ea8b3['id']});}})['catch'](function(_0x278ba1){logger['error'](_0x0ecf('0x90'),JSON[_0x0ecf('0x11')](_0x278ba1));});};exports['outbound']=function(_0x206369,_0x551934,_0x3080c1,_0x152fa2,_0xd4396b,_0x5a45d1,_0x3cdcd7){var _0x2aea12,_0x2d069a,_0x2fec15;_0x5a45d1[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x5a45d1['host']);_0x5a45d1[_0x0ecf('0x82')]=intUtil[_0x0ecf('0x81')](_0x5a45d1[_0x0ecf('0x82')]);if(_0x3cdcd7&&_0x3cdcd7[_0x0ecf('0x91')]&&_0x3cdcd7['recordingFormat']!==_0x0ecf('0x92')){logger[_0x0ecf('0x3f')](_0x0ecf('0x93'),'Recording\x20is\x20enabled!');_0x551934[_0x0ecf('0x94')]=_0x5a45d1[_0x0ecf('0x82')]+_0x0ecf('0x85')+_0x551934[_0x0ecf('0x87')]+_0x0ecf('0x86')+md5(_0x551934['uniqueid']);}var _0x3bf601=_0x5a45d1[_0x0ecf('0x80')]===_0x0ecf('0x88')?'eu':_0x0ecf('0x95');return getAccessToken(_0x5a45d1)[_0x0ecf('0x35')](function(_0xd93032){_0x2fec15=_0xd93032;return getUser(_0x2fec15,_0x3bf601,_0x5a45d1,_0x152fa2[_0x0ecf('0x38')]);})[_0x0ecf('0x35')](function(_0x241149){_0x2aea12=_0x241149;logger[_0x0ecf('0x3f')](_0x0ecf('0x96'),_0x2aea12['id']);return getEndUser(_0x2fec15,_0x3bf601,_0x5a45d1,_0x551934['destcalleridname'],_0x551934[_0x0ecf('0x97')],_0x2aea12,_0x3080c1);})[_0x0ecf('0x35')](function(_0x158ef6){_0x2d069a=_0x158ef6;return getCall(_0x2fec15,_0x3bf601,_0x5a45d1,_0x2aea12,_0x2d069a,_0x3080c1,_0x551934,'Outbound');})[_0x0ecf('0x35')](function(_0x3ce7bd){if(_0x3ce7bd){logger['info'](_0x0ecf('0x8c'),_0x3ce7bd['id']);logger[_0x0ecf('0x3f')](_0x0ecf('0x93'),_0x0ecf('0x8d'));emit(util[_0x0ecf('0x32')](_0x0ecf('0x98'),_0x152fa2[_0x0ecf('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5a45d1[_0x0ecf('0x80')]+_0x0ecf('0x99')+_0x3ce7bd['id']});}})[_0x0ecf('0x2c')](function(_0x162f07){logger['error']('[OUTBOUND]',JSON[_0x0ecf('0x11')](_0x162f07));});};exports[_0x0ecf('0x9a')]=function(_0xe64d44,_0xb91a9,_0x4998f7,_0x1a628a,_0x4d0bf2,_0x254b22){var _0x1dc00a,_0x28e65a,_0x10e1bd;_0x254b22[_0x0ecf('0x80')]=intUtil[_0x0ecf('0x81')](_0x254b22[_0x0ecf('0x80')]);_0x254b22['serverUrl']=intUtil['stripTrailingSlash'](_0x254b22[_0x0ecf('0x82')]);if(_0x4d0bf2&&_0x4d0bf2[_0x0ecf('0x83')]){logger['info']('['+_0xb91a9[_0x0ecf('0x6c')][_0x0ecf('0x9b')]()+']',_0x0ecf('0x84'));_0xb91a9[_0x0ecf('0x94')]=_0x254b22['serverUrl']+_0x0ecf('0x85')+_0xb91a9[_0x0ecf('0x87')]+_0x0ecf('0x86')+md5(_0xb91a9[_0x0ecf('0x87')]);}else{_0xb91a9[_0x0ecf('0x94')]='';}var _0x303970=_0x254b22[_0x0ecf('0x80')]===_0x0ecf('0x88')?'eu':_0x0ecf('0x95');return getAccessToken(_0x254b22)[_0x0ecf('0x35')](function(_0x1d82da){_0x10e1bd=_0x1d82da;return getUser(_0x10e1bd,_0x303970,_0x254b22);})['then'](function(_0x20d9ad){_0x1dc00a=_0x20d9ad;logger[_0x0ecf('0x3f')](_0x0ecf('0x96'),_0x1dc00a['id']);return getEndUser(_0x10e1bd,_0x303970,_0x254b22,_0xb91a9[_0x0ecf('0x89')],_0xb91a9[_0x0ecf('0x8a')],_0x1dc00a,_0x4998f7);})[_0x0ecf('0x35')](function(_0x31f7dd){_0x28e65a=_0x31f7dd;return getCall(_0x10e1bd,_0x303970,_0x254b22,_0x1dc00a,_0x28e65a,_0x4998f7,_0xb91a9,_0x0ecf('0x8b'));})['then'](function(_0x2b3029){if(_0x2b3029){logger[_0x0ecf('0x3f')](_0x0ecf('0x8c'),_0x2b3029['id']);}})[_0x0ecf('0x2c')](function(_0x1828b5){logger[_0x0ecf('0x2d')]('['+_0xb91a9[_0x0ecf('0x6c')][_0x0ecf('0x9b')]()+']',JSON[_0x0ecf('0x11')](_0x1828b5));});}; \ No newline at end of file +var _0x2121=['Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','POST','refreshToken','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','startCase','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','details','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','monitor_format','toUpperCase','lodash','request-promise','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName'];(function(_0x2dcaab,_0x31eaa3){var _0x5455e0=function(_0x5b1a57){while(--_0x5b1a57){_0x2dcaab['push'](_0x2dcaab['shift']());}};_0x5455e0(++_0x31eaa3);}(_0x2121,0x1b4));var _0x1212=function(_0x3e9693,_0x336200){_0x3e9693=_0x3e9693-0x0;var _0x2d1c0e=_0x2121[_0x3e9693];return _0x2d1c0e;};'use strict';var _=require(_0x1212('0x0'));var rp=require(_0x1212('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x1212('0x2'));var moment=require(_0x1212('0x3'));var Redis=require(_0x1212('0x4'));var BPromise=require(_0x1212('0x5'));var config=require(_0x1212('0x6'));var logger=require('../../../../config/logger')(_0x1212('0x7'));config['redis']=_[_0x1212('0x8')](config[_0x1212('0x9')],{'host':_0x1212('0xa'),'port':0x18eb});var io=require(_0x1212('0xb'))(new Redis(config[_0x1212('0x9')]));function emit(_0x642ed5,_0x4a3d2a,_0x1df3e1){io['to'](_0x642ed5)[_0x1212('0xc')](_0x4a3d2a,_0x1df3e1);}function request(_0x434d23){logger[_0x1212('0xd')](_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));return rp(_0x434d23);}function getCustomFields(_0x5498b0,_0x491bab){var _0x5cd5d6={};if(_0x5498b0[_0x1212('0x10')]>0x0){_[_0x1212('0x11')](_0x5498b0,function(_0x2a9d7b){if(_['includes']([_0x1212('0x12'),_0x1212('0x13')],_0x2a9d7b[_0x1212('0x14')])&&_0x2a9d7b[_0x1212('0x15')]){_0x5cd5d6[_0x2a9d7b[_0x1212('0x15')]]=_0x2a9d7b[_0x1212('0x16')][_0x1212('0x17')]();}else if(_0x2a9d7b[_0x1212('0x14')]===_0x1212('0x18')&&_0x2a9d7b[_0x1212('0x19')]&&_0x2a9d7b[_0x1212('0x15')]&&_0x491bab[_0x2a9d7b[_0x1212('0x19')]]){_0x5cd5d6[_0x2a9d7b[_0x1212('0x15')]]=_0x491bab[_0x2a9d7b[_0x1212('0x19')]][_0x1212('0x17')]();}else if(_0x2a9d7b['type']==='customVariable'&&_0x2a9d7b['Variable']&&_0x2a9d7b[_0x1212('0x1a')][_0x1212('0x1b')]&&_0x2a9d7b[_0x1212('0x15')]&&_0x491bab[_0x2a9d7b[_0x1212('0x1a')][_0x1212('0x1b')][_0x1212('0x1c')]()]){_0x5cd5d6[_0x2a9d7b[_0x1212('0x15')]]=_0x491bab[_0x2a9d7b[_0x1212('0x1a')][_0x1212('0x1b')]['toLowerCase']()][_0x1212('0x17')]();}});}return _0x5cd5d6;}function getName(_0x1333ec){if(_0x1333ec[_0x1212('0x1d')]('\x20')>0x0){var _0x2eedc9=_0x1333ec[_0x1212('0x1e')](/ (.+)/);if(_0x2eedc9[0x1]){return _0x2eedc9;}}return[_0x1333ec,_0x1333ec];}var accountsTokens={};function getAccessToken(_0x2e656f){return new Promise(function(_0x7d0810,_0x8d4002){if(!_['isNil'](accountsTokens[_0x2e656f['id']])&&!_[_0x1212('0x1f')](accountsTokens[_0x2e656f['id']][_0x1212('0x20')])){if(moment()[_0x1212('0x21')](accountsTokens[_0x2e656f['id']][_0x1212('0x22')])){_0x7d0810(accountsTokens[_0x2e656f['id']][_0x1212('0x20')]);}}var _0x24c770;switch(_0x2e656f[_0x1212('0x23')]){case'US':_0x24c770=_0x1212('0x24');break;case'AU':_0x24c770='https://accounts.zoho.com.au';break;case'EU':_0x24c770='https://accounts.zoho.eu';break;case'IN':_0x24c770='https://accounts.zoho.in';break;case'CN':_0x24c770='https://accounts.zoho.com.cn';break;default:_0x24c770='https://accounts.zoho.eu';break;}var _0xec5b8d={'method':_0x1212('0x25'),'uri':_0x24c770+'/oauth/v2/token','qs':{'refresh_token':_0x2e656f[_0x1212('0x26')],'client_id':_0x2e656f[_0x1212('0x27')],'client_secret':_0x2e656f['clientSecret'],'grant_type':_0x1212('0x28')},'json':!![]};return rp(_0xec5b8d)[_0x1212('0x29')](function(_0x4630b4){accountsTokens[_0x2e656f['id']]={'access_token':_0x4630b4[_0x1212('0x20')],'expires_in':moment()[_0x1212('0x2a')](_0x4630b4[_0x1212('0x22')],_0x1212('0x2b'))};_0x7d0810(_0x4630b4[_0x1212('0x20')]);})['catch'](function(_0x156b50){logger[_0x1212('0x2c')](_0x1212('0x2d'),_0x156b50[_0x1212('0x2e')]);_0x8d4002(_0x156b50);});});}function getUser(_0x17d0f6,_0x26446d,_0x315f00,_0x40b8f6){logger[_0x1212('0x2f')](_0x1212('0x30'));return request({'method':'GET','uri':util['format'](_0x1212('0x31'),_0x26446d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x1212('0x32')+_0x17d0f6},'json':!![]})['then'](function(_0x229ea4){if(_0x229ea4['users']){var _0x2c9313=-0x1;if(_[_0x1212('0x33')](_0x229ea4[_0x1212('0x34')])){if(!_[_0x1212('0x1f')](_0x40b8f6)){_0x2c9313=_['findIndex'](_0x229ea4[_0x1212('0x34')],function(_0x226fd3){return _0x226fd3[_0x1212('0x35')]===_0x40b8f6;});}if(_0x2c9313>=0x0){logger[_0x1212('0x2f')](_0x1212('0x36'));}else{logger['info'](_0x1212('0x37'));_0x2c9313=_[_0x1212('0x38')](_0x229ea4[_0x1212('0x34')],function(_0x48a9ad){return _0x48a9ad[_0x1212('0x39')][_0x1212('0x1b')]===_0x1212('0x3a');});}return _0x229ea4[_0x1212('0x34')][_0x2c9313];}else{if(_0x229ea4['user'][_0x1212('0x39')][_0x1212('0x1b')]==='Administrator'){logger[_0x1212('0x2f')](_0x1212('0x37'));user=_0x229ea4[_0x1212('0x3b')];return user;}else{logger['error'](_0x1212('0x3c'),JSON[_0x1212('0xf')](_0x229ea4));throw new Error(_0x1212('0x3d')+JSON['stringify'](_0x229ea4));}}}else{logger[_0x1212('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x1212('0xf')](_0x229ea4));throw new Error(_0x1212('0x3d')+JSON['stringify'](_0x229ea4));}})['catch'](function(_0x2447c6){console['error'](_0x2447c6);});}function getZohoUser(_0x113a06,_0x20e964){return new BPromise(function(_0x31a69c,_0x23a577){request(_0x113a06)[_0x1212('0x29')](function(_0x1f3b66){var _0x42943a=null;if(_0x1f3b66){_0x42943a=_0x1f3b66[_0x1212('0x3e')][0x0];_0x42943a[_0x1212('0x3f')]=_0x20e964;}_0x31a69c(_0x42943a);})[_0x1212('0x40')](function(_0x43b21b){_0x23a577(_0x43b21b);});});}function createEndUser(_0x1bbb84,_0x4995e1,_0x3cbb43,_0x2e1c59,_0x42b95a,_0x2ab6ef){var _0x3cbb43=getName(_0x3cbb43);return request({'method':'POST','uri':_0x1212('0x41')+_0x4995e1+'/crm/v2/'+_['startCase'](_0x2ab6ef[_0x1212('0x42')])+'s','body':{'data':[{'Last_Name':_0x3cbb43[0x1],'First_Name':_0x3cbb43[0x0],'Phone':_0x2e1c59,'Owner':{'name':!_[_0x1212('0x1f')](_0x42b95a[_0x1212('0x43')][_0x1212('0x1b')])?_0x42b95a[_0x1212('0x43')]['name']:!_['isNil'](_0x42b95a[_0x1212('0x44')])?_0x42b95a[_0x1212('0x44')]+'\x20'+_0x42b95a[_0x1212('0x45')]:_0x42b95a[_0x1212('0x45')],'id':_0x42b95a['id']}}]},'headers':{'Authorization':_0x1212('0x32')+_0x1bbb84},'json':!![]})[_0x1212('0x29')](function(_0x473151){if(_0x473151&&_0x473151[_0x1212('0x3e')][0x0][_0x1212('0x46')]===_0x1212('0x47')){var _0x1af6ae=_0x473151[_0x1212('0x3e')][0x0]['details'];_0x1af6ae['enduserType']=_[_0x1212('0x48')](_0x2ab6ef[_0x1212('0x42')])+'s';return _0x1af6ae;}logger['error'](_0x1212('0x3c'),JSON['stringify'](data));throw new Error(_0x1212('0x49')+JSON[_0x1212('0xf')](data));})[_0x1212('0x40')](function(_0x1bdd6c){console[_0x1212('0x4a')]('CREATE\x20ERROR',_0x1bdd6c);});}function getEndUser(_0x15a0c3,_0xbc9304,_0x31c8ee,_0x52afc3,_0x3548a1,_0x298538,_0x4b1625){var _0x93cf49={'method':_0x1212('0x4b'),'uri':'','headers':{'Authorization':_0x1212('0x32')+_0x15a0c3},'json':!![]};switch(_0x4b1625[_0x1212('0x4c')]){case _0x1212('0x4d'):_0x93cf49[_0x1212('0x4e')]='https://www.zohoapis.'+_0xbc9304+_0x1212('0x4f')+_0x3548a1+'))';return getZohoUser(_0x93cf49,_0x1212('0x50'))[_0x1212('0x29')](function(_0x5e1aff){if(_0x5e1aff)return _0x5e1aff;_0x93cf49['uri']=_0x1212('0x41')+_0xbc9304+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3548a1+'))';return getZohoUser(_0x93cf49,_0x1212('0x51'))['then'](function(_0x50a8ef){if(_0x50a8ef)return _0x50a8ef;if(_0x4b1625[_0x1212('0x42')]!=_0x1212('0x52')){return createEndUser(_0x15a0c3,_0xbc9304,_0x52afc3,_0x3548a1,_0x298538,_0x4b1625);}else{return{};}});});break;case'contact':_0x93cf49[_0x1212('0x4e')]='https://www.zohoapis.'+_0xbc9304+_0x1212('0x4f')+_0x3548a1+'))';return getZohoUser(_0x93cf49,_0x1212('0x50'))['then'](function(_0x55b8df){if(_0x55b8df)return _0x55b8df;if(_0x4b1625[_0x1212('0x42')]!='nothing'){return createEndUser(_0x15a0c3,_0xbc9304,_0x52afc3,_0x3548a1,_0x298538,_0x4b1625);}else{return{};}});break;case _0x1212('0x53'):_0x93cf49['uri']=_0x1212('0x41')+_0xbc9304+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3548a1+'))';return getZohoUser(_0x93cf49,_0x1212('0x51'))[_0x1212('0x29')](function(_0x249066){if(_0x249066)return _0x249066;if(_0x4b1625[_0x1212('0x42')]!=_0x1212('0x52')){return createEndUser(_0x15a0c3,_0xbc9304,_0x52afc3,_0x3548a1,_0x298538,_0x4b1625);}else{return{};}});break;}}function getCall(_0xcc376d,_0x4c5f4b,_0x4b0b0f,_0x2a983e,_0x14e2ac,_0x3796ec,_0x140984,_0x9ded8b){logger[_0x1212('0x2f')]('Creating\x20new\x20call...');var _0x5e3644={};_0x5e3644['Owner']={'name':!_[_0x1212('0x1f')](_0x2a983e[_0x1212('0x43')][_0x1212('0x1b')])&&!_[_0x1212('0x1f')](_0x2a983e[_0x1212('0x39')]['name'])&&_0x2a983e[_0x1212('0x39')][_0x1212('0x1b')]===_0x1212('0x54')?_0x2a983e[_0x1212('0x43')][_0x1212('0x1b')]:!_[_0x1212('0x1f')](_0x2a983e['first_name'])?_0x2a983e[_0x1212('0x44')]+'\x20'+_0x2a983e[_0x1212('0x45')]:_0x2a983e[_0x1212('0x45')],'id':_0x2a983e['id']};_0x5e3644['Subject']=intUtil[_0x1212('0x55')](_0x3796ec[_0x1212('0x56')],_0x140984,'\x20');_0x5e3644[_0x1212('0x57')]=intUtil[_0x1212('0x55')](_0x3796ec['Descriptions'],_0x140984,'\x0a');if(_0x14e2ac[_0x1212('0x3f')]===_0x1212('0x50')){_0x5e3644[_0x1212('0x58')]={'name':!_[_0x1212('0x1f')](_0x14e2ac[_0x1212('0x59')])?_0x14e2ac[_0x1212('0x59')]:!_['isNil'](_0x14e2ac[_0x1212('0x5a')])?_0x14e2ac['First_Name']+'\x20'+_0x14e2ac['Last_Name']:_0x14e2ac[_0x1212('0x5b')],'id':_0x14e2ac['id']};}if(_0x14e2ac[_0x1212('0x3f')]==='Leads'){_0x5e3644[_0x1212('0x5c')]={'name':!_['isNil'](_0x14e2ac['Full_Name'])?_0x14e2ac['Full_Name']:!_['isNil'](_0x14e2ac['First_Name'])?_0x14e2ac[_0x1212('0x5a')]+'\x20'+_0x14e2ac[_0x1212('0x5b')]:_0x14e2ac[_0x1212('0x5b')],'id':_0x14e2ac['id']};_0x5e3644[_0x1212('0x5d')]=_[_0x1212('0x48')](_0x14e2ac[_0x1212('0x3f')]);}if(_0x140984[_0x1212('0x5e')]){_0x5e3644[_0x1212('0x5f')]=moment[_0x1212('0x60')](parseInt(_0x140984[_0x1212('0x5e')])*0x3e8)[_0x1212('0x61')](_0x1212('0x62'));}else if(_0x140984[_0x1212('0x63')]&&_0x140984['endtime']){_0x5e3644[_0x1212('0x5f')]=moment['utc'](moment(_0x140984[_0x1212('0x64')],_0x1212('0x65'))[_0x1212('0x66')](moment(_0x140984[_0x1212('0x67')],_0x1212('0x65'))))[_0x1212('0x61')](_0x1212('0x62'));}switch(_0x140984[_0x1212('0x68')]){case'called':_0x5e3644[_0x1212('0x69')]=_0x1212('0x6a');break;case _0x1212('0x6b'):case _0x1212('0x6c'):_0x5e3644['Call_Result']=_0x1212('0x6d');break;case _0x1212('0x6e'):_0x5e3644['Call_Result']=_0x1212('0x6f');break;case _0x1212('0x70'):_0x5e3644['Call_Result']=_0x1212('0x71');break;case _0x1212('0x72'):_0x5e3644[_0x1212('0x69')]=_0x1212('0x73');default:}_0x5e3644[_0x1212('0x74')]=(_0x9ded8b===_0x1212('0x75')?moment(_0x140984[_0x1212('0x67')])[_0x1212('0x61')](_0x1212('0x65')):moment(_0x140984[_0x1212('0x76')])[_0x1212('0x61')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x1212('0x61')]('YYYY-MM-DDTHH:mm:ss');_0x5e3644[_0x1212('0x77')]=_0x9ded8b||'Inbound';_0x5e3644=_[_0x1212('0x78')](_0x5e3644,getCustomFields(_0x3796ec[_0x1212('0x79')],_0x140984));return request({'method':_0x1212('0x25'),'uri':_0x1212('0x41')+_0x4c5f4b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xcc376d},'body':{'data':[_0x5e3644]},'json':!![]})[_0x1212('0x29')](function(_0x4a2c8c){if(_0x4a2c8c&&_0x4a2c8c[_0x1212('0x3e')][0x0][_0x1212('0x46')]==='SUCCESS'){logger[_0x1212('0x2f')](_0x1212('0x7a'));return{'id':_0x4a2c8c[_0x1212('0x3e')][0x0][_0x1212('0x7b')]['id']};}})[_0x1212('0x40')](function(_0x4c14d8){logger[_0x1212('0x2f')](_0x1212('0x7c'),_0x4c14d8[_0x1212('0x2e')]);console['log'](_0x1212('0x7c'),_0x4c14d8);});}exports[_0x1212('0x7d')]=function(_0x1b778d,_0x46c3f6,_0x191781,_0x3b2ed3,_0x5c36c0,_0x1bab44){var _0x38c0c5,_0x50a239,_0x17f782;_0x1bab44[_0x1212('0x7e')]=intUtil['stripTrailingSlash'](_0x1bab44[_0x1212('0x7e')]);_0x1bab44[_0x1212('0x7f')]=intUtil[_0x1212('0x80')](_0x1bab44[_0x1212('0x7f')]);if(_0x5c36c0&&_0x5c36c0['monitor_format']){logger[_0x1212('0x2f')](_0x1212('0x81'),_0x1212('0x82'));_0x46c3f6[_0x1212('0x83')]=_0x1bab44[_0x1212('0x7f')]+_0x1212('0x84')+_0x46c3f6[_0x1212('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x46c3f6['uniqueid']);}else{_0x46c3f6[_0x1212('0x83')]='';}var _0x4110ee=_0x1bab44[_0x1212('0x7e')]===_0x1212('0x86')?'eu':_0x1212('0x87');return getAccessToken(_0x1bab44)[_0x1212('0x29')](function(_0x22bb0e){_0x17f782=_0x22bb0e;return getUser(_0x17f782,_0x4110ee,_0x1bab44,_0x3b2ed3['email']);})[_0x1212('0x29')](function(_0x457e1b){_0x38c0c5=_0x457e1b;logger['info'](_0x1212('0x88'),_0x38c0c5['id']);return getEndUser(_0x17f782,_0x4110ee,_0x1bab44,_0x46c3f6[_0x1212('0x89')],_0x46c3f6[_0x1212('0x8a')],_0x38c0c5,_0x191781);})[_0x1212('0x29')](function(_0xc49a58){_0x50a239=_0xc49a58;return getCall(_0x17f782,_0x4110ee,_0x1bab44,_0x38c0c5,_0x50a239,_0x191781,_0x46c3f6,_0x1212('0x8b'));})[_0x1212('0x29')](function(_0x4f1dc4){if(_0x4f1dc4){logger[_0x1212('0x2f')](_0x1212('0x8c'),_0x4f1dc4['id']);logger[_0x1212('0x2f')](_0x1212('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1212('0x61')](_0x1212('0x8d'),_0x3b2ed3[_0x1212('0x1b')]),_0x1212('0x8e'),{'uri':_0x1212('0x8f')+_0x1bab44[_0x1212('0x7e')]+_0x1212('0x90')+_0x4f1dc4['id']});}})['catch'](function(_0x33f9d6){logger[_0x1212('0x2c')](_0x1212('0x81'),JSON['stringify'](_0x33f9d6));});};exports[_0x1212('0x75')]=function(_0x574c71,_0x347ee0,_0x369d44,_0x46ab53,_0x268915,_0x466f0f,_0x112a9c){var _0x24f8bf,_0x1dc961,_0x116c64;_0x466f0f[_0x1212('0x7e')]=intUtil['stripTrailingSlash'](_0x466f0f['host']);_0x466f0f['serverUrl']=intUtil[_0x1212('0x80')](_0x466f0f[_0x1212('0x7f')]);if(_0x112a9c&&_0x112a9c['recordingFormat']&&_0x112a9c[_0x1212('0x91')]!==_0x1212('0x92')){logger['info'](_0x1212('0x93'),_0x1212('0x82'));_0x347ee0[_0x1212('0x83')]=_0x466f0f[_0x1212('0x7f')]+_0x1212('0x84')+_0x347ee0[_0x1212('0x85')]+_0x1212('0x94')+md5(_0x347ee0[_0x1212('0x85')]);}var _0x39cd77=_0x466f0f['host']==='zoho.eu'?'eu':_0x1212('0x87');return getAccessToken(_0x466f0f)[_0x1212('0x29')](function(_0x597c33){_0x116c64=_0x597c33;return getUser(_0x116c64,_0x39cd77,_0x466f0f,_0x46ab53[_0x1212('0x35')]);})[_0x1212('0x29')](function(_0x3b9479){_0x24f8bf=_0x3b9479;logger[_0x1212('0x2f')]('The\x20User\x20ID\x20is:',_0x24f8bf['id']);return getEndUser(_0x116c64,_0x39cd77,_0x466f0f,_0x347ee0['destcalleridname'],_0x347ee0[_0x1212('0x95')],_0x24f8bf,_0x369d44);})[_0x1212('0x29')](function(_0x416aad){_0x1dc961=_0x416aad;return getCall(_0x116c64,_0x39cd77,_0x466f0f,_0x24f8bf,_0x1dc961,_0x369d44,_0x347ee0,_0x1212('0x96'));})[_0x1212('0x29')](function(_0x40407d){if(_0x40407d){logger[_0x1212('0x2f')](_0x1212('0x8c'),_0x40407d['id']);logger[_0x1212('0x2f')]('[OUTBOUND]',_0x1212('0x97'));emit(util['format'](_0x1212('0x8d'),_0x46ab53['name']),_0x1212('0x8e'),{'uri':'https://crm.'+_0x466f0f[_0x1212('0x7e')]+_0x1212('0x90')+_0x40407d['id']});}})[_0x1212('0x40')](function(_0x6e6cb8){logger['error'](_0x1212('0x93'),JSON[_0x1212('0xf')](_0x6e6cb8));});};exports['unmanaged']=function(_0x23539b,_0x5c4354,_0x2c9a89,_0x42139c,_0x39e0f4,_0x45c25c){var _0x548bf2,_0x35f40f,_0x4992b6;_0x45c25c[_0x1212('0x7e')]=intUtil['stripTrailingSlash'](_0x45c25c[_0x1212('0x7e')]);_0x45c25c[_0x1212('0x7f')]=intUtil[_0x1212('0x80')](_0x45c25c[_0x1212('0x7f')]);if(_0x39e0f4&&_0x39e0f4[_0x1212('0x98')]){logger['info']('['+_0x5c4354[_0x1212('0x68')][_0x1212('0x99')]()+']',_0x1212('0x82'));_0x5c4354[_0x1212('0x83')]=_0x45c25c[_0x1212('0x7f')]+_0x1212('0x84')+_0x5c4354[_0x1212('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x5c4354['uniqueid']);}else{_0x5c4354['recordingURL']='';}var _0x5f5584=_0x45c25c[_0x1212('0x7e')]===_0x1212('0x86')?'eu':'com';return getAccessToken(_0x45c25c)[_0x1212('0x29')](function(_0x8298b){_0x4992b6=_0x8298b;return getUser(_0x4992b6,_0x5f5584,_0x45c25c);})[_0x1212('0x29')](function(_0x15eacb){_0x548bf2=_0x15eacb;logger['info'](_0x1212('0x88'),_0x548bf2['id']);return getEndUser(_0x4992b6,_0x5f5584,_0x45c25c,_0x5c4354['calleridname'],_0x5c4354[_0x1212('0x8a')],_0x548bf2,_0x2c9a89);})[_0x1212('0x29')](function(_0x4bb98e){_0x35f40f=_0x4bb98e;return getCall(_0x4992b6,_0x5f5584,_0x45c25c,_0x548bf2,_0x35f40f,_0x2c9a89,_0x5c4354,_0x1212('0x8b'));})[_0x1212('0x29')](function(_0x5a79db){if(_0x5a79db){logger['info']('The\x20Call\x20ID\x20is:',_0x5a79db['id']);}})['catch'](function(_0x1ed196){logger['error']('['+_0x5c4354[_0x1212('0x68')][_0x1212('0x99')]()+']',JSON['stringify'](_0x1ed196));});}; \ 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 9af2544..fb223f9 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 _0xd86e=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x398d76,_0x525c04){var _0x521007=function(_0x6b0e2a){while(--_0x6b0e2a){_0x398d76['push'](_0x398d76['shift']());}};_0x521007(++_0x525c04);}(_0xd86e,0x1c2));var _0xed86=function(_0x156312,_0xa9fdb2){_0x156312=_0x156312-0x0;var _0x1c6af4=_0xd86e[_0x156312];return _0x1c6af4;};'use strict';var util=require('util');var sh=require(_0xed86('0x0'));var Mustache=require(_0xed86('0x1'));var logger=require(_0xed86('0x2'))(_0xed86('0x3'));exports[_0xed86('0x4')]=function(_0x5319f1,_0xf107e5){var _0x37669b=_0x5319f1['data2']?_0x5319f1[_0xed86('0x5')]:_0xed86('0x6');var _0x4d68dc=_0x5319f1[_0xed86('0x7')]?Mustache[_0xed86('0x8')](_0x5319f1['data3'],_0xf107e5):_0xf107e5;sh[_0xed86('0x4')](_0x4d68dc,function(_0x32fff5,_0x33620f,_0x4a3073){if(_0x32fff5!==0x0){logger[_0xed86('0x9')](util[_0xed86('0xa')](_0xed86('0xb'),_0x37669b,_0x4d68dc,_0x32fff5,_0x4a3073));}else{logger[_0xed86('0xc')](util[_0xed86('0xa')](_0xed86('0xd'),_0x37669b,_0x4d68dc,_0x33620f));}});}; \ No newline at end of file +var _0xb8cc=['util','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xb8cc,0x198));var _0xcb8c=function(_0x2ed42c,_0x129c0f){_0x2ed42c=_0x2ed42c-0x0;var _0x1f454e=_0xb8cc[_0x2ed42c];return _0x1f454e;};'use strict';var util=require(_0xcb8c('0x0'));var sh=require('shelljs');var Mustache=require(_0xcb8c('0x1'));var logger=require(_0xcb8c('0x2'))(_0xcb8c('0x3'));exports[_0xcb8c('0x4')]=function(_0x3fb0b3,_0x19be50){var _0x427f92=_0x3fb0b3[_0xcb8c('0x5')]?_0x3fb0b3[_0xcb8c('0x5')]:_0xcb8c('0x6');var _0x214559=_0x3fb0b3[_0xcb8c('0x7')]?Mustache[_0xcb8c('0x8')](_0x3fb0b3[_0xcb8c('0x7')],_0x19be50):_0x19be50;sh['exec'](_0x214559,function(_0x4ce1ad,_0x1c6ff4,_0x5ce49b){if(_0x4ce1ad!==0x0){logger['error'](util['format'](_0xcb8c('0x9'),_0x427f92,_0x214559,_0x4ce1ad,_0x5ce49b));}else{logger[_0xcb8c('0xa')](util['format'](_0xcb8c('0xb'),_0x427f92,_0x214559,_0x1c6ff4));}});}; \ 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 739f2d6..08a1852 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 _0x1b54=['render','data2','data5','number','data6','error','GET','POST','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase'];(function(_0xc48773,_0x5eb863){var _0x30b4f0=function(_0x18cb15){while(--_0x18cb15){_0xc48773['push'](_0xc48773['shift']());}};_0x30b4f0(++_0x5eb863);}(_0x1b54,0xca));var _0x41b5=function(_0x7f133e,_0x48505c){_0x7f133e=_0x7f133e-0x0;var _0x3d8df7=_0x1b54[_0x7f133e];return _0x3d8df7;};'use strict';var rp=require(_0x41b5('0x0'));var util=require(_0x41b5('0x1'));var _=require(_0x41b5('0x2'));var Mustache=require(_0x41b5('0x3'));var logger=require('../../../../config/logger')(_0x41b5('0x4'));exports[_0x41b5('0x5')]=function(_0x27c657,_0x2a0b14){var _0x4be75b,_0x3aaf60;var _0x7a77bb={'method':_0x27c657[_0x41b5('0x6')][_0x41b5('0x7')](),'uri':Mustache[_0x41b5('0x8')](_0x27c657[_0x41b5('0x9')],_0x2a0b14),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27c657[_0x41b5('0xa')])===_0x41b5('0xb')&&parseInt(_0x27c657[_0x41b5('0xa')])>=0x1&&parseInt(_0x27c657[_0x41b5('0xa')])<=0xa?parseInt(_0x27c657[_0x41b5('0xa')])*0x3e8:0x5*0x3e8};try{_0x7a77bb['headers']=_0x27c657[_0x41b5('0xc')]?JSON['parse'](Mustache['render'](_0x27c657[_0x41b5('0xc')],_0x2a0b14)):{};}catch(_0x3df52f){logger[_0x41b5('0xd')](_0x3df52f['stack']);}switch(_0x27c657[_0x41b5('0x6')][_0x41b5('0x7')]()){case _0x41b5('0xe'):case'DELETE':_0x4be75b=null;_0x7a77bb['qs']=_0x2a0b14;break;case _0x41b5('0xf'):case'PUT':if(_0x27c657[_0x41b5('0x10')]){try{_0x4be75b=JSON[_0x41b5('0x11')](Mustache[_0x41b5('0x8')](_0x27c657[_0x41b5('0x10')],_0x2a0b14));_0x7a77bb[_0x41b5('0x12')]=_0x4be75b;}catch(_0x1f27c5){logger['error'](_0x1f27c5[_0x41b5('0x13')]);logger[_0x41b5('0xd')](_0x41b5('0x14'));}}else{_0x4be75b=_0x2a0b14;_0x7a77bb[_0x41b5('0x12')]=_0x4be75b;}break;}logger['info'](util[_0x41b5('0x15')](_0x41b5('0x16'),_0x27c657[_0x41b5('0x6')],_0x27c657[_0x41b5('0x9')],JSON[_0x41b5('0x17')](_0x7a77bb)));rp(_0x7a77bb)['then'](function(_0x482b3e){_0x4be75b=!_[_0x41b5('0x18')](_0x4be75b)?',\x20request\x20body:\x20'+_0x4be75b:'';_0x3aaf60=typeof _0x482b3e['body']===_0x41b5('0x19')?JSON[_0x41b5('0x17')](_0x482b3e[_0x41b5('0x12')]):_0x482b3e['body'];logger[_0x41b5('0x1a')](util[_0x41b5('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x27c657['data1'],_0x27c657[_0x41b5('0x9')],_0x482b3e[_0x41b5('0x1b')],_0x3aaf60));})[_0x41b5('0x1c')](function(_0x57db6c){logger[_0x41b5('0xd')](util[_0x41b5('0x15')](_0x41b5('0x1d'),_0x27c657[_0x41b5('0x6')],_0x27c657[_0x41b5('0x9')],_0x57db6c[_0x41b5('0x1b')],_0x57db6c['name'],_0x57db6c['message']));});}; \ No newline at end of file +var _0x3db2=['DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack'];(function(_0x37b1f2,_0x23510b){var _0x2fbd7b=function(_0x216e5d){while(--_0x216e5d){_0x37b1f2['push'](_0x37b1f2['shift']());}};_0x2fbd7b(++_0x23510b);}(_0x3db2,0x1ef));var _0x23db=function(_0x2d9a23,_0x481dc4){_0x2d9a23=_0x2d9a23-0x0;var _0x5198ee=_0x3db2[_0x2d9a23];return _0x5198ee;};'use strict';var rp=require(_0x23db('0x0'));var util=require(_0x23db('0x1'));var _=require(_0x23db('0x2'));var Mustache=require(_0x23db('0x3'));var logger=require('../../../../config/logger')(_0x23db('0x4'));exports[_0x23db('0x5')]=function(_0x128cf3,_0x55dc2d){var _0x1a547f,_0x5975d0;var _0x4d4140={'method':_0x128cf3[_0x23db('0x6')][_0x23db('0x7')](),'uri':Mustache[_0x23db('0x8')](_0x128cf3[_0x23db('0x9')],_0x55dc2d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x128cf3[_0x23db('0xa')])===_0x23db('0xb')&&parseInt(_0x128cf3[_0x23db('0xa')])>=0x1&&parseInt(_0x128cf3['data5'])<=0xa?parseInt(_0x128cf3['data5'])*0x3e8:0x5*0x3e8};try{_0x4d4140[_0x23db('0xc')]=_0x128cf3[_0x23db('0xd')]?JSON[_0x23db('0xe')](Mustache['render'](_0x128cf3[_0x23db('0xd')],_0x55dc2d)):{};}catch(_0x3f8dbf){logger[_0x23db('0xf')](_0x3f8dbf[_0x23db('0x10')]);}switch(_0x128cf3[_0x23db('0x6')]['toUpperCase']()){case'GET':case _0x23db('0x11'):_0x1a547f=null;_0x4d4140['qs']=_0x55dc2d;break;case'POST':case _0x23db('0x12'):if(_0x128cf3[_0x23db('0x13')]){try{_0x1a547f=JSON[_0x23db('0xe')](Mustache[_0x23db('0x8')](_0x128cf3[_0x23db('0x13')],_0x55dc2d));_0x4d4140[_0x23db('0x14')]=_0x1a547f;}catch(_0x4941d4){logger['error'](_0x4941d4[_0x23db('0x10')]);logger[_0x23db('0xf')](_0x23db('0x15'));}}else{_0x1a547f=_0x55dc2d;_0x4d4140[_0x23db('0x14')]=_0x1a547f;}break;}logger[_0x23db('0x16')](util[_0x23db('0x17')](_0x23db('0x18'),_0x128cf3[_0x23db('0x6')],_0x128cf3[_0x23db('0x9')],JSON[_0x23db('0x19')](_0x4d4140)));rp(_0x4d4140)[_0x23db('0x1a')](function(_0x327966){_0x1a547f=!_[_0x23db('0x1b')](_0x1a547f)?_0x23db('0x1c')+_0x1a547f:'';_0x5975d0=typeof _0x327966['body']==='object'?JSON[_0x23db('0x19')](_0x327966[_0x23db('0x14')]):_0x327966[_0x23db('0x14')];logger[_0x23db('0x16')](util[_0x23db('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x128cf3[_0x23db('0x6')],_0x128cf3[_0x23db('0x9')],_0x327966[_0x23db('0x1d')],_0x5975d0));})['catch'](function(_0x1a1cf8){logger[_0x23db('0xf')](util[_0x23db('0x17')](_0x23db('0x1e'),_0x128cf3[_0x23db('0x6')],_0x128cf3['data2'],_0x1a1cf8['statusCode'],_0x1a1cf8[_0x23db('0x1f')],_0x1a1cf8['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index dd631df..0a9dbda 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 _0x6a0d=['routing','client','http','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a0d,0x106));var _0xd6a0=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6a0d[_0x297fd3];return _0x2af381;};'use strict';var jayson=require(_0xd6a0('0x0'));var BPromise=require(_0xd6a0('0x1'));var logger=require('../../config/logger')(_0xd6a0('0x2'));var client=jayson[_0xd6a0('0x3')][_0xd6a0('0x4')]({'port':0x2329});client['Request']=function(_0x2640a7,_0x2fd848){return new BPromise(function(_0x23f8fc,_0x25b8a9){return client['request'](_0x2640a7,_0x2fd848)[_0xd6a0('0x5')](function(_0x5b4d57){logger['debug'](_0xd6a0('0x6'),_0xd6a0('0x2'),_0x2640a7,_0x2fd848,_0x5b4d57);if(_0x5b4d57[_0xd6a0('0x7')]){logger[_0xd6a0('0x7')](_0xd6a0('0x6'),_0xd6a0('0x2'),_0x2640a7,_0x5b4d57[_0xd6a0('0x7')]['message'],_0x2fd848);return _0x25b8a9(_0x5b4d57[_0xd6a0('0x7')][_0xd6a0('0x8')]);}else{return _0x23f8fc(_0x5b4d57[_0xd6a0('0x9')]);}})[_0xd6a0('0xa')](function(_0x5824c4){logger[_0xd6a0('0x7')](_0xd6a0('0x6'),'routing',_0x2640a7,_0x5824c4,_0x2fd848);return _0x25b8a9(_0x5824c4);});});};module[_0xd6a0('0xb')]=client; \ No newline at end of file +var _0x7a47=['exports','jayson/promise','../../config/logger','routing','http','Request','then','debug','rpc','error','message','result','catch'];(function(_0x25e396,_0x44642b){var _0x229ff6=function(_0x100f4f){while(--_0x100f4f){_0x25e396['push'](_0x25e396['shift']());}};_0x229ff6(++_0x44642b);}(_0x7a47,0xc4));var _0x77a4=function(_0x272d13,_0x529a33){_0x272d13=_0x272d13-0x0;var _0x500791=_0x7a47[_0x272d13];return _0x500791;};'use strict';var jayson=require(_0x77a4('0x0'));var BPromise=require('bluebird');var logger=require(_0x77a4('0x1'))(_0x77a4('0x2'));var client=jayson['client'][_0x77a4('0x3')]({'port':0x2329});client[_0x77a4('0x4')]=function(_0x211021,_0x503e27){return new BPromise(function(_0xf4bb14,_0x171041){return client['request'](_0x211021,_0x503e27)[_0x77a4('0x5')](function(_0x39f5d4){logger[_0x77a4('0x6')](_0x77a4('0x7'),_0x77a4('0x2'),_0x211021,_0x503e27,_0x39f5d4);if(_0x39f5d4[_0x77a4('0x8')]){logger[_0x77a4('0x8')](_0x77a4('0x7'),_0x77a4('0x2'),_0x211021,_0x39f5d4['error']['message'],_0x503e27);return _0x171041(_0x39f5d4[_0x77a4('0x8')][_0x77a4('0x9')]);}else{return _0xf4bb14(_0x39f5d4[_0x77a4('0xa')]);}})[_0x77a4('0xb')](function(_0x1afa06){logger[_0x77a4('0x8')](_0x77a4('0x7'),'routing',_0x211021,_0x1afa06,_0x503e27);return _0x171041(_0x1afa06);});});};module[_0x77a4('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 99e9749..f7e4873 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 _0x4253=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','bluebird','./server','./lib/email','./rpc/setting'];(function(_0x5b405c,_0x11d9f0){var _0x57e819=function(_0x5b84ea){while(--_0x5b84ea){_0x5b405c['push'](_0x5b405c['shift']());}};_0x57e819(++_0x11d9f0);}(_0x4253,0x14c));var _0x3425=function(_0x2a0344,_0x4eb726){_0x2a0344=_0x2a0344-0x0;var _0x2fe837=_0x4253[_0x2a0344];return _0x2fe837;};'use strict';var BPromise=require(_0x3425('0x0'));var server=require(_0x3425('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x3425('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3425('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x3425('0x4')]()[_0x3425('0x5')](mailAccount[_0x3425('0x6')]())[_0x3425('0x5')](realtime[_0x3425('0x7')]())[_0x3425('0x5')](function(){email[_0x3425('0x8')](realtime[_0x3425('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x3425('0x5')](function(){return initRealtime();})[_0x3425('0x5')](function(){return setting[_0x3425('0xa')]();})['then'](function(_0x38f8c7){return setInterval(initRealtime,_0x38f8c7[_0x3425('0xb')]*0x3e8);})['catch'](function(_0x21c54d){console['log'](_0x21c54d);});}main(); \ No newline at end of file +var _0x742b=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','mailAccounts','loginMailFrequency','catch','log'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x742b,0xb4));var _0xb742=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x742b[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0xb742('0x0'));var server=require(_0xb742('0x1'));var Realtime=require(_0xb742('0x2'));var EmailChannel=require(_0xb742('0x3'));var mailAccount=require(_0xb742('0x4'));var setting=require(_0xb742('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xb742('0x6')]()['then'](mailAccount['getMailAccounts']())[_0xb742('0x7')](realtime['initMailAccounts']())[_0xb742('0x7')](function(){email['refresh'](realtime[_0xb742('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xb742('0x7')](function(){return initRealtime();})[_0xb742('0x7')](function(){return setting['getSettings']();})[_0xb742('0x7')](function(_0x1eb614){return setInterval(initRealtime,_0x1eb614[_0xb742('0x9')]*0x3e8);})[_0xb742('0xa')](function(_0x15b3bc){console[_0xb742('0xb')](_0x15b3bc);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4075b6b..068837b 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 _0x9369=['stringify','refresh','hasOwnProperty','active','box','bind','handleImapEmail','error','prototype','handleImapBox','messages','total','info','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','handleImapError','send','Smtp','lastSync','smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','status','Imap','messageStatus','isNil'];(function(_0x513452,_0x18b76c){var _0x366e0c=function(_0x1ada96){while(--_0x1ada96){_0x513452['push'](_0x513452['shift']());}};_0x366e0c(++_0x18b76c);}(_0x9369,0x127));var _0x9936=function(_0x5d16c8,_0x416237){_0x5d16c8=_0x5d16c8-0x0;var _0x5c3178=_0x9369[_0x5d16c8];return _0x5c3178;};'use strict';var _=require(_0x9936('0x0'));var moment=require(_0x9936('0x1'));var BPromise=require(_0x9936('0x2'));var md5=require(_0x9936('0x3'));var Redis=require(_0x9936('0x4'));var config=require(_0x9936('0x5'));var logger=require(_0x9936('0x6'))(_0x9936('0x7'));config[_0x9936('0x8')]=_[_0x9936('0x9')](config[_0x9936('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9936('0xa'))(new Redis(config[_0x9936('0x8')]));var EmailImap=require(_0x9936('0xb'));var EmailSmtp=require(_0x9936('0xc'));var mailAccount=require(_0x9936('0xd'));var md5Accounts={};function EmailChannel(_0x1f2f70){logger['info'](_0x9936('0xe'));this['mailAccounts']=_0x1f2f70[_0x9936('0xf')];this[_0x9936('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x9936('0x11')]=function(_0x4b3f1c){var _0x11245b=this[_0x9936('0xf')][_0x4b3f1c];var _0x25653a={'id':_0x11245b['id'],'name':_0x11245b[_0x9936('0x12')],'key':_0x11245b['key'],'active':_0x11245b['active'],'Imap':{'status':_0x11245b['Imap'][_0x9936('0x13')],'messageStatus':_0x11245b[_0x9936('0x14')][_0x9936('0x15')],'total':_0x11245b[_0x9936('0x14')]['total']}};if(_[_0x9936('0x16')](md5Accounts[_0x4b3f1c])){md5Accounts[_0x4b3f1c]={};}var _0x3a2a65=md5(JSON[_0x9936('0x17')](_0x25653a));if(md5Accounts[_0x4b3f1c][_0x9936('0x3')]!==_0x3a2a65){md5Accounts[_0x4b3f1c]['md5']=_0x3a2a65;io[_0x9936('0x11')]('mailAccount:update',_0x25653a);}};EmailChannel['prototype'][_0x9936('0x18')]=function(_0x292945){for(var _0x590bcb in _0x292945){if(_0x292945[_0x9936('0x19')](_0x590bcb)){if(_0x292945[_0x590bcb]['Imap']&&_0x292945[_0x590bcb][_0x9936('0x1a')]){var _0x10bcea=_0x292945[_0x590bcb][_0x9936('0x14')];if(!this[_0x9936('0x10')][_0x9936('0x19')](_0x10bcea['id'])){this['imapAccounts'][_0x10bcea['id']]=new EmailImap(_0x10bcea,_0x292945[_0x590bcb][_0x9936('0x7')]);this['imapAccounts'][_0x10bcea['id']]['on'](_0x9936('0x1b'),this['handleImapBox'][_0x9936('0x1c')](this,_0x590bcb));this[_0x9936('0x10')][_0x10bcea['id']]['on']('email',this[_0x9936('0x1d')]['bind'](this,_0x590bcb));this[_0x9936('0x10')][_0x10bcea['id']]['on']('end',this['handleImapEnd'][_0x9936('0x1c')](this,_0x590bcb));this[_0x9936('0x10')][_0x10bcea['id']]['on'](_0x9936('0x1e'),this['handleImapError'][_0x9936('0x1c')](this,_0x590bcb));}}else{if(_[_0x9936('0x16')](this['mailAccounts'][_0x590bcb][_0x9936('0x14')])){this['mailAccounts'][_0x590bcb]['Imap']={};}this[_0x9936('0xf')][_0x590bcb][_0x9936('0x14')][_0x9936('0x13')]='disabled';this[_0x9936('0xf')][_0x590bcb][_0x9936('0x14')][_0x9936('0x15')]='';this[_0x9936('0x11')](_0x590bcb);}}}};EmailChannel[_0x9936('0x1f')][_0x9936('0x20')]=function(_0x19e1b9,_0x4a3020){if(this[_0x9936('0xf')][_0x19e1b9]){this[_0x9936('0xf')][_0x19e1b9][_0x9936('0x14')][_0x9936('0x13')]='connected';this['mailAccounts'][_0x19e1b9]['Imap'][_0x9936('0x15')]=_0x4a3020[_0x9936('0x12')];if(_0x4a3020[_0x9936('0x21')]){this[_0x9936('0xf')][_0x19e1b9][_0x9936('0x14')][_0x9936('0x22')]=_0x4a3020[_0x9936('0x21')][_0x9936('0x22')];}return this['emit'](_0x19e1b9);}};EmailChannel[_0x9936('0x1f')][_0x9936('0x1d')]=function(_0x49bf8a,_0x1dd073){logger[_0x9936('0x23')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x1dd073[_0x9936('0x24')],_0x1dd073[_0x9936('0x25')],_0x1dd073[_0x9936('0x26')],_0x49bf8a);if(this['mailAccounts'][_0x49bf8a]){return mailAccount[_0x9936('0x27')](_0x49bf8a,_0x1dd073)[_0x9936('0x28')](function(_0x5650fb){if(_0x5650fb){logger[_0x9936('0x23')](_0x9936('0x29'));}})[_0x9936('0x2a')](function(_0x121ea9){logger[_0x9936('0x1e')](_0x9936('0x2b'),JSON[_0x9936('0x17')](_0x121ea9));});}};EmailChannel[_0x9936('0x1f')][_0x9936('0x2c')]=function(_0x2a3471){if(this[_0x9936('0xf')][_0x2a3471]&&this['mailAccounts'][_0x2a3471]['Imap']){if(this['imapAccounts'][this['mailAccounts'][_0x2a3471][_0x9936('0x14')]['id']]){delete this[_0x9936('0x10')][this[_0x9936('0xf')][_0x2a3471][_0x9936('0x14')]['id']];}this[_0x9936('0xf')][_0x2a3471]['Imap']['lastSync']=moment();this['emit'](_0x2a3471);}};EmailChannel[_0x9936('0x1f')][_0x9936('0x2d')]=function(_0x3e78bc,_0x431bd9){if(this[_0x9936('0xf')][_0x3e78bc]){this[_0x9936('0xf')][_0x3e78bc][_0x9936('0x14')][_0x9936('0x13')]=_0x9936('0x1e');this[_0x9936('0xf')][_0x3e78bc][_0x9936('0x14')]['messageStatus']=_0x431bd9;return this[_0x9936('0x11')](_0x3e78bc);}};EmailChannel[_0x9936('0x1f')]['sendMail']=function(_0x3e4636,_0x1a8092){return this['smtp'][_0x9936('0x2e')](_0x3e4636,_0x1a8092);};EmailChannel[_0x9936('0x1f')]['verifySmtp']=function(_0x564853){var _0x3c75c3=this;if(this[_0x9936('0xf')][_0x564853['id']]){if(_[_0x9936('0x16')](this[_0x9936('0xf')][_0x564853['id']]['Smtp'])){this[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')]={};}this[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')][_0x9936('0x30')]=moment();return new BPromise(function(_0x2432c4,_0x427db2){return _0x3c75c3[_0x9936('0x31')][_0x9936('0x32')](_0x564853)['then'](function(_0x592cbc){_0x3c75c3[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')]['status']=_0x9936('0x33');_0x3c75c3[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')]['messageStatus']='';_0x3c75c3['emit'](_0x564853['id']);_0x2432c4(_0x592cbc);})[_0x9936('0x2a')](function(_0x1a7739){_0x3c75c3[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')][_0x9936('0x13')]=_0x9936('0x1e');_0x3c75c3[_0x9936('0xf')][_0x564853['id']][_0x9936('0x2f')][_0x9936('0x15')]=_0x1a7739;_0x3c75c3[_0x9936('0x11')](_0x564853['id']);_0x427db2(_0x1a7739);});});}return this['smtp'][_0x9936('0x32')](_0x564853);};module[_0x9936('0x34')]=EmailChannel; \ No newline at end of file +var _0xf765=['moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','key','active','Imap','status','messageStatus','total','stringify','emit','mailAccount:update','prototype','hasOwnProperty','box','handleImapBox','email','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp','Smtp','verify','lodash'];(function(_0x11365c,_0x5edf7f){var _0x9f192d=function(_0x3bba8d){while(--_0x3bba8d){_0x11365c['push'](_0x11365c['shift']());}};_0x9f192d(++_0x5edf7f);}(_0xf765,0x67));var _0x5f76=function(_0x1aa934,_0x37cc9d){_0x1aa934=_0x1aa934-0x0;var _0x143ae3=_0xf765[_0x1aa934];return _0x143ae3;};'use strict';var _=require(_0x5f76('0x0'));var moment=require(_0x5f76('0x1'));var BPromise=require(_0x5f76('0x2'));var md5=require(_0x5f76('0x3'));var Redis=require(_0x5f76('0x4'));var config=require(_0x5f76('0x5'));var logger=require(_0x5f76('0x6'))('email');config[_0x5f76('0x7')]=_[_0x5f76('0x8')](config[_0x5f76('0x7')],{'host':_0x5f76('0x9'),'port':0x18eb});var io=require(_0x5f76('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x5f76('0xb'));var EmailSmtp=require(_0x5f76('0xc'));var mailAccount=require(_0x5f76('0xd'));var md5Accounts={};function EmailChannel(_0x2bf3a3){logger[_0x5f76('0xe')](_0x5f76('0xf'));this[_0x5f76('0x10')]=_0x2bf3a3[_0x5f76('0x10')];this[_0x5f76('0x11')]={};this[_0x5f76('0x12')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x34c332){var _0x3b006e=this[_0x5f76('0x10')][_0x34c332];var _0x27bfe8={'id':_0x3b006e['id'],'name':_0x3b006e['name'],'key':_0x3b006e[_0x5f76('0x13')],'active':_0x3b006e[_0x5f76('0x14')],'Imap':{'status':_0x3b006e[_0x5f76('0x15')][_0x5f76('0x16')],'messageStatus':_0x3b006e[_0x5f76('0x15')][_0x5f76('0x17')],'total':_0x3b006e[_0x5f76('0x15')][_0x5f76('0x18')]}};if(_['isNil'](md5Accounts[_0x34c332])){md5Accounts[_0x34c332]={};}var _0x4fd7f2=md5(JSON[_0x5f76('0x19')](_0x27bfe8));if(md5Accounts[_0x34c332][_0x5f76('0x3')]!==_0x4fd7f2){md5Accounts[_0x34c332][_0x5f76('0x3')]=_0x4fd7f2;io[_0x5f76('0x1a')](_0x5f76('0x1b'),_0x27bfe8);}};EmailChannel[_0x5f76('0x1c')]['refresh']=function(_0x15c70d){for(var _0x5d537e in _0x15c70d){if(_0x15c70d['hasOwnProperty'](_0x5d537e)){if(_0x15c70d[_0x5d537e]['Imap']&&_0x15c70d[_0x5d537e][_0x5f76('0x14')]){var _0x16978b=_0x15c70d[_0x5d537e][_0x5f76('0x15')];if(!this[_0x5f76('0x11')][_0x5f76('0x1d')](_0x16978b['id'])){this['imapAccounts'][_0x16978b['id']]=new EmailImap(_0x16978b,_0x15c70d[_0x5d537e]['email']);this[_0x5f76('0x11')][_0x16978b['id']]['on'](_0x5f76('0x1e'),this[_0x5f76('0x1f')]['bind'](this,_0x5d537e));this[_0x5f76('0x11')][_0x16978b['id']]['on'](_0x5f76('0x20'),this['handleImapEmail'][_0x5f76('0x21')](this,_0x5d537e));this[_0x5f76('0x11')][_0x16978b['id']]['on'](_0x5f76('0x22'),this[_0x5f76('0x23')][_0x5f76('0x21')](this,_0x5d537e));this[_0x5f76('0x11')][_0x16978b['id']]['on'](_0x5f76('0x24'),this[_0x5f76('0x25')][_0x5f76('0x21')](this,_0x5d537e));}}else{if(_[_0x5f76('0x26')](this[_0x5f76('0x10')][_0x5d537e][_0x5f76('0x15')])){this[_0x5f76('0x10')][_0x5d537e][_0x5f76('0x15')]={};}this[_0x5f76('0x10')][_0x5d537e][_0x5f76('0x15')][_0x5f76('0x16')]=_0x5f76('0x27');this[_0x5f76('0x10')][_0x5d537e][_0x5f76('0x15')]['messageStatus']='';this[_0x5f76('0x1a')](_0x5d537e);}}}};EmailChannel[_0x5f76('0x1c')][_0x5f76('0x1f')]=function(_0x58139f,_0x6d511e){if(this['mailAccounts'][_0x58139f]){this[_0x5f76('0x10')][_0x58139f][_0x5f76('0x15')][_0x5f76('0x16')]='connected';this[_0x5f76('0x10')][_0x58139f][_0x5f76('0x15')][_0x5f76('0x17')]=_0x6d511e['name'];if(_0x6d511e[_0x5f76('0x28')]){this['mailAccounts'][_0x58139f][_0x5f76('0x15')][_0x5f76('0x18')]=_0x6d511e[_0x5f76('0x28')][_0x5f76('0x18')];}return this[_0x5f76('0x1a')](_0x58139f);}};EmailChannel[_0x5f76('0x1c')]['handleImapEmail']=function(_0x1ec70b,_0x47346c){logger[_0x5f76('0xe')](_0x5f76('0x29'),_0x47346c[_0x5f76('0x2a')],_0x47346c['lastName'],_0x47346c['from'],_0x1ec70b);if(this[_0x5f76('0x10')][_0x1ec70b]){return mailAccount[_0x5f76('0x2b')](_0x1ec70b,_0x47346c)[_0x5f76('0x2c')](function(_0x17cdac){if(_0x17cdac){logger[_0x5f76('0xe')](_0x5f76('0x2d'));}})[_0x5f76('0x2e')](function(_0x2d2ec7){logger['error'](_0x5f76('0x2f'),JSON[_0x5f76('0x19')](_0x2d2ec7));});}};EmailChannel[_0x5f76('0x1c')][_0x5f76('0x23')]=function(_0x228c44){if(this[_0x5f76('0x10')][_0x228c44]&&this[_0x5f76('0x10')][_0x228c44]['Imap']){if(this[_0x5f76('0x11')][this[_0x5f76('0x10')][_0x228c44][_0x5f76('0x15')]['id']]){delete this[_0x5f76('0x11')][this['mailAccounts'][_0x228c44][_0x5f76('0x15')]['id']];}this[_0x5f76('0x10')][_0x228c44][_0x5f76('0x15')][_0x5f76('0x30')]=moment();this[_0x5f76('0x1a')](_0x228c44);}};EmailChannel['prototype'][_0x5f76('0x25')]=function(_0x5dc18d,_0x3fec37){if(this[_0x5f76('0x10')][_0x5dc18d]){this[_0x5f76('0x10')][_0x5dc18d][_0x5f76('0x15')]['status']='error';this[_0x5f76('0x10')][_0x5dc18d][_0x5f76('0x15')]['messageStatus']=_0x3fec37;return this[_0x5f76('0x1a')](_0x5dc18d);}};EmailChannel['prototype']['sendMail']=function(_0x1eabdd,_0x3f74b2){return this[_0x5f76('0x12')]['send'](_0x1eabdd,_0x3f74b2);};EmailChannel[_0x5f76('0x1c')][_0x5f76('0x31')]=function(_0x5790e5){var _0x25cec3=this;if(this[_0x5f76('0x10')][_0x5790e5['id']]){if(_[_0x5f76('0x26')](this[_0x5f76('0x10')][_0x5790e5['id']][_0x5f76('0x32')])){this[_0x5f76('0x10')][_0x5790e5['id']]['Smtp']={};}this[_0x5f76('0x10')][_0x5790e5['id']][_0x5f76('0x32')][_0x5f76('0x30')]=moment();return new BPromise(function(_0x2366b3,_0x20f313){return _0x25cec3[_0x5f76('0x12')]['verify'](_0x5790e5)[_0x5f76('0x2c')](function(_0x10a46b){_0x25cec3[_0x5f76('0x10')][_0x5790e5['id']]['Smtp'][_0x5f76('0x16')]='verified';_0x25cec3[_0x5f76('0x10')][_0x5790e5['id']]['Smtp'][_0x5f76('0x17')]='';_0x25cec3['emit'](_0x5790e5['id']);_0x2366b3(_0x10a46b);})[_0x5f76('0x2e')](function(_0xc20e93){_0x25cec3['mailAccounts'][_0x5790e5['id']][_0x5f76('0x32')][_0x5f76('0x16')]=_0x5f76('0x24');_0x25cec3[_0x5f76('0x10')][_0x5790e5['id']]['Smtp'][_0x5f76('0x17')]=_0xc20e93;_0x25cec3[_0x5f76('0x1a')](_0x5790e5['id']);_0x20f313(_0xc20e93);});});}return this['smtp'][_0x5f76('0x33')](_0x5790e5);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 8befb95..045de0b 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 _0xf03c=['closeBox','handleFetchMessage','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','stringify','textCode','upperFirst','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','email','anonymous@xcally.com','handleReady','openBox','prototype','handleOpenBox','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','message','handleFetchError'];(function(_0x21ad7d,_0x266474){var _0x189238=function(_0x201018){while(--_0x201018){_0x21ad7d['push'](_0x21ad7d['shift']());}};_0x189238(++_0x266474);}(_0xf03c,0xbe));var _0xcf03=function(_0xfbf147,_0xbce0d3){_0xfbf147=_0xfbf147-0x0;var _0xad5317=_0xf03c[_0xfbf147];return _0xad5317;};'use strict';var fs=require('fs');var path=require(_0xcf03('0x0'));var util=require(_0xcf03('0x1'));var Imap=require(_0xcf03('0x2'));var _=require('lodash');var rs=require(_0xcf03('0x3'));var simpleParser=require(_0xcf03('0x4'))[_0xcf03('0x5')];var Iconv=require(_0xcf03('0x6'))[_0xcf03('0x7')];var EventEmitter=require(_0xcf03('0x8'))['EventEmitter'];var utils=require(_0xcf03('0x9'));var logger=require(_0xcf03('0xa'))('email');function EmailImap(_0x107187,_0x2bac1b){this[_0xcf03('0xb')]='INBOX';this[_0xcf03('0xc')]=this[_0xcf03('0xd')](_0x107187,_0x2bac1b);this['imap']=new Imap(this['account']);this[_0xcf03('0x2')][_0xcf03('0xe')](_0xcf03('0xf'),this['handleReady'][_0xcf03('0x10')](this));this[_0xcf03('0x2')][_0xcf03('0xe')](_0xcf03('0x11'),this[_0xcf03('0x12')][_0xcf03('0x10')](this));this['imap']['on'](_0xcf03('0x13'),this[_0xcf03('0x14')]['bind'](this));this[_0xcf03('0x2')]['connect']();}util[_0xcf03('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0xcf03('0xd')]=function(_0x1976cb,_0xf433bf){var _0x4bfaa0={'connTimeout':_0x1976cb['connTimeout']?_0x1976cb[_0xcf03('0x16')]*0x3e8:0x2710,'authTimeout':_0x1976cb[_0xcf03('0x17')]?_0x1976cb[_0xcf03('0x17')]*0x3e8:0x1388};if(_[_0xcf03('0x18')](_0x1976cb[_0xcf03('0x19')])){if(_0x1976cb['authentication']){_0x4bfaa0[_0xcf03('0x1a')]=_0x1976cb['user'];_0x4bfaa0[_0xcf03('0x1b')]=_0x1976cb[_0xcf03('0x1b')];}_0x4bfaa0[_0xcf03('0x1c')]=_0x1976cb[_0xcf03('0x1c')];_0x4bfaa0[_0xcf03('0x1d')]=_0x1976cb[_0xcf03('0x1d')]||0x3e1;if(_0x1976cb[_0xcf03('0x1e')]){_0x4bfaa0[_0xcf03('0x1e')]=!![];}else{_0x4bfaa0[_0xcf03('0x1e')]=![];_0x4bfaa0[_0xcf03('0x1f')]='required';}}else{_0x4bfaa0[_0xcf03('0x1a')]=_0x1976cb[_0xcf03('0x1a')];_0x4bfaa0[_0xcf03('0x1b')]=_0x1976cb['password'];_0x4bfaa0[_0xcf03('0x1c')]=utils['getHost'](_0x1976cb[_0xcf03('0x19')]);_0x4bfaa0['port']=0x3e1;_0x4bfaa0['tls']=!![];}_0x4bfaa0[_0xcf03('0x20')]=_0xf433bf||_0x1976cb[_0xcf03('0x1a')]||_0xcf03('0x21');return _0x4bfaa0;};EmailImap['prototype'][_0xcf03('0x22')]=function(){this['imap'][_0xcf03('0x23')](this[_0xcf03('0xb')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xcf03('0x24')][_0xcf03('0x25')]=function(_0x58393c,_0x273c08){if(_0x58393c){this[_0xcf03('0x14')](_0x58393c,!![]);}else{this['emit'](_0xcf03('0x26'),_0x273c08);this[_0xcf03('0x27')]();}};EmailImap[_0xcf03('0x24')][_0xcf03('0x28')]=function(_0x34b2e6){if(_0x34b2e6){this['handleError'](_0x34b2e6,!![]);}else{this[_0xcf03('0x2')][_0xcf03('0x11')]();}};EmailImap['prototype'][_0xcf03('0x27')]=function(){this[_0xcf03('0x2')][_0xcf03('0x29')](['UNSEEN'],this[_0xcf03('0x2a')][_0xcf03('0x10')](this));};EmailImap[_0xcf03('0x24')][_0xcf03('0x2a')]=function(_0x12ba7f,_0x3aec3c){if(_0x12ba7f){this[_0xcf03('0x14')](_0x12ba7f,!![]);}else{if(_0x3aec3c[_0xcf03('0x2b')]){try{var _0x5eda86=this[_0xcf03('0x2')]['fetch'](_0x3aec3c,{'bodies':'','markSeen':!![]});_0x5eda86['on'](_0xcf03('0x2c'),this['handleFetchMessage'][_0xcf03('0x10')](this));_0x5eda86[_0xcf03('0xe')]('error',this[_0xcf03('0x2d')][_0xcf03('0x10')](this));_0x5eda86['once'](_0xcf03('0x11'),this['handleFetchEnd'][_0xcf03('0x10')](this));}catch(_0xddbeee){logger['error'](_0xddbeee);}}else{this[_0xcf03('0x2')][_0xcf03('0x2e')](!![],this['handleCloseBox'][_0xcf03('0x10')](this));}}};EmailImap[_0xcf03('0x24')][_0xcf03('0x2f')]=function(_0x51d825,_0x1f663c){_0x51d825['on']('body',this[_0xcf03('0x30')][_0xcf03('0x10')](this));_0x51d825['once']('attributes',this[_0xcf03('0x31')]['bind'](this));_0x51d825['once'](_0xcf03('0x11'),this[_0xcf03('0x32')][_0xcf03('0x10')](this));};EmailImap[_0xcf03('0x24')][_0xcf03('0x30')]=function(_0x176386,_0x319a2e){simpleParser(_0x176386,{'Iconv':Iconv},this[_0xcf03('0x33')][_0xcf03('0x10')](this));};EmailImap[_0xcf03('0x24')]['handleMessageAttributes']=function(_0x182394){};EmailImap[_0xcf03('0x24')][_0xcf03('0x32')]=function(){};EmailImap[_0xcf03('0x24')]['handleSimpleParser']=function(_0x5ccd25,_0x1ca400){if(_0x5ccd25){logger[_0xcf03('0x13')](_0x5ccd25);}else{var _0x36bec4=this;utils[_0xcf03('0x34')](this['account'],_0x1ca400,function(_0x47b103){_0x36bec4[_0xcf03('0x35')]('email',_0x47b103);});}};EmailImap[_0xcf03('0x24')][_0xcf03('0x36')]=function(){this[_0xcf03('0x2')][_0xcf03('0x2e')](!![],this['handleCloseBox'][_0xcf03('0x10')](this));};EmailImap[_0xcf03('0x24')]['handleFetchError']=function(_0x33b61c){this[_0xcf03('0x14')](_0x33b61c);this[_0xcf03('0x2')][_0xcf03('0x2e')](!![],this[_0xcf03('0x28')][_0xcf03('0x10')](this));};EmailImap[_0xcf03('0x24')][_0xcf03('0x12')]=function(){this[_0xcf03('0x35')](_0xcf03('0x11'));};EmailImap[_0xcf03('0x24')][_0xcf03('0x14')]=function(_0x5809a3,_0xd26821){logger[_0xcf03('0x13')](_0xcf03('0x14'),this[_0xcf03('0xc')]['email'],JSON[_0xcf03('0x37')](_0x5809a3));var _0x122da5='';if(_0x5809a3){if(_0x5809a3[_0xcf03('0x38')]){_0x122da5=_0x5809a3[_0xcf03('0x38')];}else{for(var _0x2745ce in _0x5809a3){if(_0x5809a3['hasOwnProperty'](_0x2745ce)){_0x122da5+=_[_0xcf03('0x39')](_0x2745ce)+':\x20'+_0x5809a3[_0x2745ce]+'\x0a';}}}}if(_0xd26821){this[_0xcf03('0x2')][_0xcf03('0x11')]();}else{this['emit']('error',_0x122da5);this[_0xcf03('0x35')](_0xcf03('0x11'));}};module[_0xcf03('0x3a')]=EmailImap; \ No newline at end of file +var _0xe008=['handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','account','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','ready','handleReady','bind','end','handleEnd','connect','prototype','connTimeout','service','user','password','host','port','tls','autotls','required','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN'];(function(_0x5828c6,_0x4bd80e){var _0x4a8512=function(_0x18b527){while(--_0x18b527){_0x5828c6['push'](_0x5828c6['shift']());}};_0x4a8512(++_0x4bd80e);}(_0xe008,0xcc));var _0x8e00=function(_0x5ee867,_0xaf19c0){_0x5ee867=_0x5ee867-0x0;var _0x555d02=_0xe008[_0x5ee867];return _0x555d02;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x8e00('0x0'));var _=require(_0x8e00('0x1'));var rs=require(_0x8e00('0x2'));var simpleParser=require(_0x8e00('0x3'))[_0x8e00('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x8e00('0x5'))[_0x8e00('0x6')];var utils=require(_0x8e00('0x7'));var logger=require(_0x8e00('0x8'))(_0x8e00('0x9'));function EmailImap(_0x1b9c06,_0x3d294a){this[_0x8e00('0xa')]=_0x8e00('0xb');this['account']=this[_0x8e00('0xc')](_0x1b9c06,_0x3d294a);this[_0x8e00('0x0')]=new Imap(this['account']);this['imap'][_0x8e00('0xd')](_0x8e00('0xe'),this[_0x8e00('0xf')][_0x8e00('0x10')](this));this['imap'][_0x8e00('0xd')](_0x8e00('0x11'),this[_0x8e00('0x12')][_0x8e00('0x10')](this));this[_0x8e00('0x0')]['on']('error',this['handleError']['bind'](this));this[_0x8e00('0x0')][_0x8e00('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x8e00('0x14')][_0x8e00('0xc')]=function(_0x10ec78,_0x252768){var _0x33ad3d={'connTimeout':_0x10ec78[_0x8e00('0x15')]?_0x10ec78[_0x8e00('0x15')]*0x3e8:0x2710,'authTimeout':_0x10ec78['authTimeout']?_0x10ec78['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x10ec78[_0x8e00('0x16')])){if(_0x10ec78['authentication']){_0x33ad3d[_0x8e00('0x17')]=_0x10ec78[_0x8e00('0x17')];_0x33ad3d[_0x8e00('0x18')]=_0x10ec78[_0x8e00('0x18')];}_0x33ad3d[_0x8e00('0x19')]=_0x10ec78[_0x8e00('0x19')];_0x33ad3d['port']=_0x10ec78[_0x8e00('0x1a')]||0x3e1;if(_0x10ec78[_0x8e00('0x1b')]){_0x33ad3d[_0x8e00('0x1b')]=!![];}else{_0x33ad3d[_0x8e00('0x1b')]=![];_0x33ad3d[_0x8e00('0x1c')]=_0x8e00('0x1d');}}else{_0x33ad3d[_0x8e00('0x17')]=_0x10ec78['user'];_0x33ad3d[_0x8e00('0x18')]=_0x10ec78[_0x8e00('0x18')];_0x33ad3d[_0x8e00('0x19')]=utils['getHost'](_0x10ec78[_0x8e00('0x16')]);_0x33ad3d[_0x8e00('0x1a')]=0x3e1;_0x33ad3d[_0x8e00('0x1b')]=!![];}_0x33ad3d[_0x8e00('0x9')]=_0x252768||_0x10ec78['user']||_0x8e00('0x1e');return _0x33ad3d;};EmailImap[_0x8e00('0x14')][_0x8e00('0xf')]=function(){this[_0x8e00('0x0')][_0x8e00('0x1f')](this[_0x8e00('0xa')],![],this['handleOpenBox'][_0x8e00('0x10')](this));};EmailImap[_0x8e00('0x14')][_0x8e00('0x20')]=function(_0x1ca291,_0x324207){if(_0x1ca291){this[_0x8e00('0x21')](_0x1ca291,!![]);}else{this[_0x8e00('0x22')](_0x8e00('0x23'),_0x324207);this[_0x8e00('0x24')]();}};EmailImap['prototype'][_0x8e00('0x25')]=function(_0x57a308){if(_0x57a308){this[_0x8e00('0x21')](_0x57a308,!![]);}else{this[_0x8e00('0x0')][_0x8e00('0x11')]();}};EmailImap[_0x8e00('0x14')]['readUnseen']=function(){this[_0x8e00('0x0')][_0x8e00('0x26')]([_0x8e00('0x27')],this[_0x8e00('0x28')][_0x8e00('0x10')](this));};EmailImap[_0x8e00('0x14')][_0x8e00('0x28')]=function(_0x4c5572,_0x18161a){if(_0x4c5572){this[_0x8e00('0x21')](_0x4c5572,!![]);}else{if(_0x18161a[_0x8e00('0x29')]){try{var _0x2b54b9=this[_0x8e00('0x0')][_0x8e00('0x2a')](_0x18161a,{'bodies':'','markSeen':!![]});_0x2b54b9['on'](_0x8e00('0x2b'),this[_0x8e00('0x2c')]['bind'](this));_0x2b54b9[_0x8e00('0xd')](_0x8e00('0x2d'),this[_0x8e00('0x2e')]['bind'](this));_0x2b54b9[_0x8e00('0xd')]('end',this[_0x8e00('0x2f')][_0x8e00('0x10')](this));}catch(_0x7e05d2){logger[_0x8e00('0x2d')](_0x7e05d2);}}else{this[_0x8e00('0x0')]['closeBox'](!![],this[_0x8e00('0x25')]['bind'](this));}}};EmailImap[_0x8e00('0x14')][_0x8e00('0x2c')]=function(_0x4a66dc,_0x3e96e3){_0x4a66dc['on']('body',this[_0x8e00('0x30')]['bind'](this));_0x4a66dc[_0x8e00('0xd')](_0x8e00('0x31'),this['handleMessageAttributes'][_0x8e00('0x10')](this));_0x4a66dc[_0x8e00('0xd')]('end',this[_0x8e00('0x32')][_0x8e00('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x5d4806,_0x38bdd3){simpleParser(_0x5d4806,{'Iconv':Iconv},this[_0x8e00('0x33')]['bind'](this));};EmailImap['prototype'][_0x8e00('0x34')]=function(_0x2dbcee){};EmailImap['prototype'][_0x8e00('0x32')]=function(){};EmailImap[_0x8e00('0x14')][_0x8e00('0x33')]=function(_0x3b994e,_0x4e0100){if(_0x3b994e){logger[_0x8e00('0x2d')](_0x3b994e);}else{var _0x40c012=this;utils[_0x8e00('0x35')](this[_0x8e00('0x36')],_0x4e0100,function(_0x50de9a){_0x40c012[_0x8e00('0x22')](_0x8e00('0x9'),_0x50de9a);});}};EmailImap[_0x8e00('0x14')][_0x8e00('0x2f')]=function(){this[_0x8e00('0x0')][_0x8e00('0x37')](!![],this[_0x8e00('0x25')][_0x8e00('0x10')](this));};EmailImap[_0x8e00('0x14')]['handleFetchError']=function(_0x43083a){this[_0x8e00('0x21')](_0x43083a);this[_0x8e00('0x0')]['closeBox'](!![],this['handleCloseBox'][_0x8e00('0x10')](this));};EmailImap[_0x8e00('0x14')][_0x8e00('0x12')]=function(){this[_0x8e00('0x22')](_0x8e00('0x11'));};EmailImap[_0x8e00('0x14')][_0x8e00('0x21')]=function(_0x23d813,_0x2decef){logger[_0x8e00('0x2d')](_0x8e00('0x21'),this[_0x8e00('0x36')][_0x8e00('0x9')],JSON[_0x8e00('0x38')](_0x23d813));var _0x2d7311='';if(_0x23d813){if(_0x23d813['textCode']){_0x2d7311=_0x23d813[_0x8e00('0x39')];}else{for(var _0x5b3798 in _0x23d813){if(_0x23d813[_0x8e00('0x3a')](_0x5b3798)){_0x2d7311+=_[_0x8e00('0x3b')](_0x5b3798)+':\x20'+_0x23d813[_0x5b3798]+'\x0a';}}}}if(_0x2decef){this['imap'][_0x8e00('0x11')]();}else{this['emit'](_0x8e00('0x2d'),_0x2d7311);this[_0x8e00('0x22')](_0x8e00('0x11'));}};module[_0x8e00('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c5d122a..b8fe7d5 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 _0x7854=['send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird','prototype'];(function(_0x42e5bb,_0x15ce08){var _0x2cb497=function(_0xa77af){while(--_0xa77af){_0x42e5bb['push'](_0x42e5bb['shift']());}};_0x2cb497(++_0x15ce08);}(_0x7854,0x189));var _0x4785=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x7854[_0x1a3e23];return _0x5ee0d8;};'use strict';var nodemailer=require(_0x4785('0x0'));var BPromise=require(_0x4785('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4785('0x2')][_0x4785('0x3')]=function(_0x15f2d4,_0x54198c){return new BPromise(function(_0x3c2030,_0x19f53b){var _0x43389e=nodemailer[_0x4785('0x4')](_0x15f2d4);_0x43389e[_0x4785('0x5')](_0x4785('0x6'),inlineBase64());_0x43389e[_0x4785('0x7')](_0x54198c,function(_0x2e8ec3,_0x19551a){if(_0x2e8ec3){_0x19f53b(_0x2e8ec3[_0x4785('0x8')]());}else{_0x3c2030(_0x19551a);}});});};EmailSmtp['prototype'][_0x4785('0x9')]=function(_0x510a36){return new BPromise(function(_0x52c07a,_0x579848){var _0x402c19=nodemailer[_0x4785('0x4')](_0x510a36);_0x402c19[_0x4785('0x9')](function(_0x17a0ff,_0x3d6c4c){if(_0x17a0ff){_0x579848(_0x17a0ff['toString']());}else{if(_0x3d6c4c){_0x52c07a(_0x3d6c4c);}else{_0x579848(_0x4785('0xa'));}}});});};module[_0x4785('0xb')]=EmailSmtp; \ No newline at end of file +var _0xa788=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','bluebird','prototype','send','createTransport'];(function(_0x2aab3c,_0x2ce66a){var _0xeaa22e=function(_0xccd79a){while(--_0xccd79a){_0x2aab3c['push'](_0x2aab3c['shift']());}};_0xeaa22e(++_0x2ce66a);}(_0xa788,0x10f));var _0x8a78=function(_0x1dd8a3,_0x1a7f75){_0x1dd8a3=_0x1dd8a3-0x0;var _0x133d7b=_0xa788[_0x1dd8a3];return _0x133d7b;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x8a78('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x8a78('0x1')][_0x8a78('0x2')]=function(_0x42d6fc,_0x5c598b){return new BPromise(function(_0x3e4359,_0x37f690){var _0x2fed56=nodemailer[_0x8a78('0x3')](_0x42d6fc);_0x2fed56[_0x8a78('0x4')](_0x8a78('0x5'),inlineBase64());_0x2fed56[_0x8a78('0x6')](_0x5c598b,function(_0x41721c,_0x3b1f7a){if(_0x41721c){_0x37f690(_0x41721c[_0x8a78('0x7')]());}else{_0x3e4359(_0x3b1f7a);}});});};EmailSmtp[_0x8a78('0x1')][_0x8a78('0x8')]=function(_0x351245){return new BPromise(function(_0x47c0f1,_0x837844){var _0x24759d=nodemailer[_0x8a78('0x3')](_0x351245);_0x24759d[_0x8a78('0x8')](function(_0x5663bf,_0x3abc6b){if(_0x5663bf){_0x837844(_0x5663bf[_0x8a78('0x7')]());}else{if(_0x3abc6b){_0x47c0f1(_0x3abc6b);}else{_0x837844(_0x8a78('0x9'));}}});});};module[_0x8a78('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 458f5b1..c125f35 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 _0xd943=['X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','line','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','generate','@xcally.com','head','name','address','substring','split','length','slice','Anonymous','pop','isEmpty','anonymous','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x1897de[_0x3d94('0x11')](0x0,-0x1)['join']('\x20'):_0x512766[_0x3d94('0xc')];}return _0x3d94('0x12');}function getLastName(_0x172d0f){var _0x4c167c=_[_0x3d94('0xb')](_0x172d0f[_0x3d94('0x8')]);if(_0x4c167c&&_0x4c167c[_0x3d94('0xc')]){var _0x5d9366=_0x4c167c[_0x3d94('0xc')][_0x3d94('0xf')](/\s+/);return _0x5d9366[_0x3d94('0x10')]>0x1?_0x5d9366[_0x3d94('0x13')]():'';}return'';}function getMails(_0xaf939a,_0xd8efaa){var _0x31c6e8='';for(var _0x9893cb=0x0;_0x9893cb<_0xd8efaa['value'][_0x3d94('0x10')];_0x9893cb+=0x1){if(_0xd8efaa[_0x3d94('0x8')][_0x9893cb][_0x3d94('0xd')]!==_0xaf939a){if(!_[_0x3d94('0x14')](_0x31c6e8)){_0x31c6e8+=',';}_0x31c6e8+=_0xd8efaa[_0x3d94('0x8')][_0x9893cb][_0x3d94('0xc')]||_0xd8efaa[_0x3d94('0x8')][_0x9893cb]['address']||'';_0x31c6e8+='\x20<';_0x31c6e8+=_0xd8efaa[_0x3d94('0x8')][_0x9893cb]['address']?_0xd8efaa[_0x3d94('0x8')][_0x9893cb][_0x3d94('0xd')]:_0x3d94('0x15')+random[_0x3d94('0x9')](0x6)+_0x3d94('0xa');_0x31c6e8+='>';}}return _0x31c6e8;}function parseEmail(_0x4f0beb,_0x578002,_0x1406e9){if(_0x578002[_0x3d94('0x16')]){var _0x9c2f2c=/)<[^<]*)*<\/script>/gi;while(_0x9c2f2c['test'](_0x578002[_0x3d94('0x16')])){_0x578002[_0x3d94('0x16')]=_0x578002[_0x3d94('0x16')][_0x3d94('0x17')](_0x9c2f2c,'');}if(_0x578002[_0x3d94('0x16')][_0x3d94('0x18')](_0x3d94('0x19'))){var _0x27f978=[];_0x578002[_0x3d94('0x1a')][_0x3d94('0x1b')](_0x30368c=>{_0x27f978[_0x3d94('0x1c')](_0x30368c[_0x3d94('0x1d')]);});var _0x3496c3=/]+>/g;var _0x2945d2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b3b31=_0x578002[_0x3d94('0x16')]['replace'](_0x2945d2,_0x3d94('0x1e'));var _0x1d0a7a=_0x5b3b31[_0x3d94('0x17')](_0x3496c3,_0x3d94('0x1f'));for(let _0x13254f=0x0;_0x13254f<_0x27f978[_0x3d94('0x10')];_0x13254f++){var _0x401857=_0x1d0a7a['replace']('_IMG',_0x3d94('0x20')+_0x27f978[_0x13254f]+'\x20]');_0x1d0a7a=_0x401857;}_0x578002['html']=_0x1d0a7a;}_0x1406e9[_0x3d94('0x21')]=_0x578002['html'];}else{_0x1406e9[_0x3d94('0x21')]=_0x578002[_0x3d94('0x22')];}if(_0x1406e9[_0x3d94('0x21')]){_0x1406e9['body']=_0x1406e9[_0x3d94('0x21')]['replace'](/0x0){var _0x3b3550=[_0x3d94('0x32'),_0x3d94('0x33'),_0x3d94('0x34')];for(var _0x1a2348=0x0;_0x1a2348<_0x578002[_0x3d94('0x35')][_0x3d94('0x10')];_0x1a2348++){var _0x5b6a17=_['indexOf'](_0x3b3550,_0x578002[_0x3d94('0x35')][_0x1a2348][_0x3d94('0x36')]);if(_0x5b6a17>=0x0){_0x1406e9['isAutoreply']=!![];}}}return _0x1406e9;}exports[_0x3d94('0x37')]=function(_0x4af4b6,_0x1361fb,_0x411b5b){var _0x3c9ebc={'from':getAddress(_0x1361fb[_0x3d94('0x38')]),'firstName':getFirstName(_0x1361fb[_0x3d94('0x38')]),'lastName':getLastName(_0x1361fb['from']),'mapKey':_0x3d94('0x6'),'message':{'from':getMails(_0x4af4b6[_0x3d94('0x6')],_0x1361fb[_0x3d94('0x38')]),'to':_0x4af4b6['email'],'cc':'','subject':_0x1361fb[_0x3d94('0x39')]||'','messageId':_0x1361fb['messageId'],'inReplyTo':_0x1361fb['inReplyTo'],'sentAt':moment(_0x1361fb[_0x3d94('0x3a')])[_0x3d94('0x2b')](_0x3d94('0x3b')),'attach':![],'attachments':[]}};if(!_0x1361fb[_0x3d94('0x16')]&&!_0x1361fb['textAsHtml']){var _0x323d58=_['filter'](_0x1361fb[_0x3d94('0x1a')],{'contentType':_0x3d94('0x3c')});if(_0x323d58[_0x3d94('0x10')]){logger[_0x3d94('0x3d')](util[_0x3d94('0x2b')](_0x3d94('0x3e'),_0x1361fb[_0x3d94('0x3f')]));tnef['parseBuffer'](_[_0x3d94('0x40')](_0x323d58)[_0x3d94('0x31')],function(_0x52c82b,_0x53e611){if(_0x53e611){_0x1361fb[_0x3d94('0x16')]=_0x53e611[_0x3d94('0x41')]||'

Empty\x20message

';if(_0x53e611[_0x3d94('0x42')]){for(var _0x13fda9=0x0;_0x13fda9<_0x53e611[_0x3d94('0x42')][_0x3d94('0x10')];_0x13fda9++){var _0x30ce31=_0x53e611[_0x3d94('0x42')][_0x13fda9];_0x3c9ebc[_0x3d94('0x25')][_0x3d94('0x1a')][_0x3d94('0x1c')]({'filename':_0x30ce31[_0x3d94('0x43')],'content':Buffer[_0x3d94('0x38')](_0x30ce31[_0x3d94('0x44')])});}}}_0x411b5b(parseEmail(_0x4af4b6,_0x1361fb,_0x3c9ebc));});}else{_0x1361fb[_0x3d94('0x16')]=_0x3d94('0x45');_0x411b5b(parseEmail(_0x4af4b6,_0x1361fb,_0x3c9ebc));}}else{_0x411b5b(parseEmail(_0x4af4b6,_0x1361fb,_0x3c9ebc));}};exports[_0x3d94('0x46')]=function(_0x49209b){switch(_0x49209b){case _0x3d94('0x47'):return _0x3d94('0x48');case _0x3d94('0x49'):return _0x3d94('0x4a');case _0x3d94('0x4b'):return _0x3d94('0x4c');case _0x3d94('0x4d'):return _0x3d94('0x4e');}return _0x3d94('0x4f');}; \ No newline at end of file +var _0x056b=['bcc','type','attachment','attachment-','format','%s-%s','join','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','parser','from','subject','messageId','date','filter','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','Anonymous','pop','html','test','replace','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x23513f['slice'](0x0,-0x1)['join']('\x20'):_0x539126[_0xb056('0xe')];}return _0xb056('0x13');}function getLastName(_0x51999c){var _0x81c9fc=_[_0xb056('0x8')](_0x51999c[_0xb056('0xd')]);if(_0x81c9fc&&_0x81c9fc[_0xb056('0xe')]){var _0x10dd19=_0x81c9fc[_0xb056('0xe')][_0xb056('0x11')](/\s+/);return _0x10dd19['length']>0x1?_0x10dd19[_0xb056('0x14')]():'';}return'';}function getMails(_0x43565e,_0x9e2eed){var _0x65d7ca='';for(var _0x5a4ef1=0x0;_0x5a4ef1<_0x9e2eed[_0xb056('0xd')]['length'];_0x5a4ef1+=0x1){if(_0x9e2eed[_0xb056('0xd')][_0x5a4ef1][_0xb056('0x9')]!==_0x43565e){if(!_['isEmpty'](_0x65d7ca)){_0x65d7ca+=',';}_0x65d7ca+=_0x9e2eed[_0xb056('0xd')][_0x5a4ef1]['name']||_0x9e2eed[_0xb056('0xd')][_0x5a4ef1][_0xb056('0x9')]||'';_0x65d7ca+='\x20<';_0x65d7ca+=_0x9e2eed['value'][_0x5a4ef1][_0xb056('0x9')]?_0x9e2eed['value'][_0x5a4ef1][_0xb056('0x9')]:_0xb056('0xa')+random[_0xb056('0xb')](0x6)+_0xb056('0xc');_0x65d7ca+='>';}}return _0x65d7ca;}function parseEmail(_0x4b254f,_0x1db585,_0x5b481c){if(_0x1db585[_0xb056('0x15')]){var _0x5dea90=/)<[^<]*)*<\/script>/gi;while(_0x5dea90[_0xb056('0x16')](_0x1db585[_0xb056('0x15')])){_0x1db585[_0xb056('0x15')]=_0x1db585[_0xb056('0x15')][_0xb056('0x17')](_0x5dea90,'');}if(_0x1db585[_0xb056('0x15')]['includes'](_0xb056('0x18'))){var _0x18a3f2=[];_0x1db585[_0xb056('0x19')][_0xb056('0x1a')](_0x5577a9=>{_0x18a3f2[_0xb056('0x1b')](_0x5577a9[_0xb056('0x1c')]);});var _0x5c39db=/]+>/g;var _0x6d0483=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x265782=_0x1db585[_0xb056('0x15')][_0xb056('0x17')](_0x6d0483,_0xb056('0x1d'));var _0x4024d7=_0x265782[_0xb056('0x17')](_0x5c39db,_0xb056('0x1e'));for(let _0x571e54=0x0;_0x571e54<_0x18a3f2[_0xb056('0x12')];_0x571e54++){var _0x51b06b=_0x4024d7[_0xb056('0x17')](_0xb056('0x1e'),_0xb056('0x1f')+_0x18a3f2[_0x571e54]+'\x20]');_0x4024d7=_0x51b06b;}_0x1db585[_0xb056('0x15')]=_0x4024d7;}_0x5b481c[_0xb056('0x20')]=_0x1db585['html'];}else{_0x5b481c[_0xb056('0x20')]=_0x1db585[_0xb056('0x21')];}if(_0x5b481c[_0xb056('0x20')]){_0x5b481c[_0xb056('0x20')]=_0x5b481c[_0xb056('0x20')]['replace'](/0x0){var _0x4c2b1e=[_0xb056('0x33'),'X-Auto-Response-Suppress:\x20All',_0xb056('0x34')];for(var _0x3c2249=0x0;_0x3c2249<_0x1db585[_0xb056('0x32')][_0xb056('0x12')];_0x3c2249++){var _0x1b4e99=_[_0xb056('0x10')](_0x4c2b1e,_0x1db585['headerLines'][_0x3c2249][_0xb056('0x35')]);if(_0x1b4e99>=0x0){_0x5b481c['isAutoreply']=!![];}}}return _0x5b481c;}exports[_0xb056('0x36')]=function(_0xc729f3,_0x21d98e,_0xad802f){var _0x119e8c={'from':getAddress(_0x21d98e[_0xb056('0x37')]),'firstName':getFirstName(_0x21d98e[_0xb056('0x37')]),'lastName':getLastName(_0x21d98e[_0xb056('0x37')]),'mapKey':_0xb056('0x6'),'message':{'from':getMails(_0xc729f3[_0xb056('0x6')],_0x21d98e['from']),'to':_0xc729f3[_0xb056('0x6')],'cc':'','subject':_0x21d98e[_0xb056('0x38')]||'','messageId':_0x21d98e[_0xb056('0x39')],'inReplyTo':_0x21d98e['inReplyTo'],'sentAt':moment(_0x21d98e[_0xb056('0x3a')])[_0xb056('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x21d98e['html']&&!_0x21d98e[_0xb056('0x21')]){var _0x1ef279=_[_0xb056('0x3b')](_0x21d98e[_0xb056('0x19')],{'contentType':'application/ms-tnef'});if(_0x1ef279['length']){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x21d98e['messageId']));tnef[_0xb056('0x3c')](_['first'](_0x1ef279)[_0xb056('0x31')],function(_0x53f231,_0x1676f5){if(_0x1676f5){_0x21d98e[_0xb056('0x15')]=_0x1676f5[_0xb056('0x3d')]||_0xb056('0x3e');if(_0x1676f5[_0xb056('0x3f')]){for(var _0x1d3f86=0x0;_0x1d3f86<_0x1676f5['Attachments'][_0xb056('0x12')];_0x1d3f86++){var _0x76d3a0=_0x1676f5['Attachments'][_0x1d3f86];_0x119e8c[_0xb056('0x23')][_0xb056('0x19')][_0xb056('0x1b')]({'filename':_0x76d3a0[_0xb056('0x40')],'content':Buffer[_0xb056('0x37')](_0x76d3a0[_0xb056('0x41')])});}}}_0xad802f(parseEmail(_0xc729f3,_0x21d98e,_0x119e8c));});}else{_0x21d98e['html']=_0xb056('0x3e');_0xad802f(parseEmail(_0xc729f3,_0x21d98e,_0x119e8c));}}else{_0xad802f(parseEmail(_0xc729f3,_0x21d98e,_0x119e8c));}};exports['getHost']=function(_0x132268){switch(_0x132268){case _0xb056('0x42'):return _0xb056('0x43');case _0xb056('0x44'):return _0xb056('0x45');case _0xb056('0x46'):return _0xb056('0x47');case _0xb056('0x48'):return'outlook.office365.com';}return _0xb056('0x49');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7bffb32..3ed5a8f 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 _0xaa20=['active','Imap','Smtp','name','Service','key','SERV'];(function(_0x12e6c8,_0xafdba7){var _0x30a2d4=function(_0x277bd5){while(--_0x277bd5){_0x12e6c8['push'](_0x12e6c8['shift']());}};_0x30a2d4(++_0xafdba7);}(_0xaa20,0x96));var _0x0aa2=function(_0x1124d3,_0x5827f1){_0x1124d3=_0x1124d3-0x0;var _0x5e44a7=_0xaa20[_0x1124d3];return _0x5e44a7;};'use strict';var _=require('lodash');function MailAccount(_0x18966c){this['id']=_0x18966c['id']||0x0;this[_0x0aa2('0x0')]=_0x18966c[_0x0aa2('0x0')]||_0x0aa2('0x1');this[_0x0aa2('0x2')]=_0x18966c['key']||_0x0aa2('0x3');this[_0x0aa2('0x4')]=_0x18966c[_0x0aa2('0x4')]||![];this['Imap']=_0x18966c[_0x0aa2('0x5')]||[];this[_0x0aa2('0x6')]=_0x18966c[_0x0aa2('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xf406=['key','SERV','active','Imap','Smtp','name'];(function(_0x286513,_0x180264){var _0xeef4e8=function(_0x3ec73a){while(--_0x3ec73a){_0x286513['push'](_0x286513['shift']());}};_0xeef4e8(++_0x180264);}(_0xf406,0x9b));var _0x6f40=function(_0x911aa,_0x5cb8b5){_0x911aa=_0x911aa-0x0;var _0x327202=_0xf406[_0x911aa];return _0x327202;};'use strict';var _=require('lodash');function MailAccount(_0x3bcfe0){this['id']=_0x3bcfe0['id']||0x0;this[_0x6f40('0x0')]=_0x3bcfe0[_0x6f40('0x0')]||'Service';this['key']=_0x3bcfe0[_0x6f40('0x1')]||_0x6f40('0x2');this[_0x6f40('0x3')]=_0x3bcfe0[_0x6f40('0x3')]||![];this[_0x6f40('0x4')]=_0x3bcfe0[_0x6f40('0x4')]||[];this[_0x6f40('0x5')]=_0x3bcfe0[_0x6f40('0x5')]||[];}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 5980f2d..b1b713c 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 _0x2fc0=['mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x5dfd8f,_0x27260c){var _0x1221e5=function(_0xcd03bd){while(--_0xcd03bd){_0x5dfd8f['push'](_0x5dfd8f['shift']());}};_0x1221e5(++_0x27260c);}(_0x2fc0,0x101));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x02fc('0x0'));var MailAccount=require(_0x02fc('0x1'));var Realtime=function(){this[_0x02fc('0x2')]={};};function freeIsNotKey(_0x1924b5,_0x10f664,_0x4feb68){var _0xbc90d=_[_0x02fc('0x3')](_0x1924b5,function(_0x1ae927,_0x46247b){return _0x1ae927[_0x4feb68];});for(var _0x5aaa11 in _0x10f664){if(_0x10f664['hasOwnProperty'](_0x5aaa11)){if(!_0xbc90d[_0x5aaa11]){delete _0x10f664[_0x5aaa11];}}}}Realtime[_0x02fc('0x4')][_0x02fc('0x5')]=function(_0x375523,_0xe30cfd){for(var _0x5368cf in _0xe30cfd){if(_0x375523[_0x02fc('0x6')](_0x5368cf)){_0x375523[_0x5368cf]=_0xe30cfd[_0x5368cf];}}};Realtime[_0x02fc('0x4')][_0x02fc('0x7')]=function(){var _0x232b47=this;return function(_0x45c3df){if(_0x45c3df){freeIsNotKey(_0x45c3df,_0x232b47[_0x02fc('0x2')],'id');for(var _0xae727f=0x0,_0x378c2e={},_0x2f2e37={};_0xae727f<_0x45c3df['length'];_0xae727f+=0x1){_0x378c2e=_0x45c3df[_0xae727f];if(_[_0x02fc('0x8')](_0x232b47[_0x02fc('0x2')][_0x378c2e['id']])){_0x232b47[_0x02fc('0x2')][_0x378c2e['id']]=new MailAccount(_0x378c2e);}else{_['merge'](_0x232b47[_0x02fc('0x2')][_0x378c2e['id']],_0x378c2e);}}}return _0x232b47[_0x02fc('0x2')];};};module[_0x02fc('0x9')]=Realtime; \ No newline at end of file +var _0x0613=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','exports','lodash','mailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0613,0x11e));var _0x3061=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x0613[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0x3061('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x3061('0x1')]={};};function freeIsNotKey(_0x130fdc,_0x1d75f8,_0xb1a926){var _0x14cc8d=_['mapKeys'](_0x130fdc,function(_0x315979,_0x2a3074){return _0x315979[_0xb1a926];});for(var _0xa6cf6b in _0x1d75f8){if(_0x1d75f8[_0x3061('0x2')](_0xa6cf6b)){if(!_0x14cc8d[_0xa6cf6b]){delete _0x1d75f8[_0xa6cf6b];}}}}Realtime[_0x3061('0x3')][_0x3061('0x4')]=function(_0x2d419a,_0x1e97e7){for(var _0x41823f in _0x1e97e7){if(_0x2d419a[_0x3061('0x2')](_0x41823f)){_0x2d419a[_0x41823f]=_0x1e97e7[_0x41823f];}}};Realtime[_0x3061('0x3')][_0x3061('0x5')]=function(){var _0x524576=this;return function(_0x2cc400){if(_0x2cc400){freeIsNotKey(_0x2cc400,_0x524576[_0x3061('0x1')],'id');for(var _0x1e910f=0x0,_0x12028b={},_0x50afe8={};_0x1e910f<_0x2cc400[_0x3061('0x6')];_0x1e910f+=0x1){_0x12028b=_0x2cc400[_0x1e910f];if(_['isUndefined'](_0x524576[_0x3061('0x1')][_0x12028b['id']])){_0x524576['mailAccounts'][_0x12028b['id']]=new MailAccount(_0x12028b);}else{_['merge'](_0x524576[_0x3061('0x1')][_0x12028b['id']],_0x12028b);}}}return _0x524576['mailAccounts'];};};module[_0x3061('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index df727bd..8767a3a 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 _0xd43e=['MailServerIn','MailServerOut','Smtp','NotifyMailAccount','../client','Request','GetMailAccount','name','service','key','ListId','TemplateId'];(function(_0x55fd5c,_0x7db0da){var _0x5b21e5=function(_0xf5b7df){while(--_0xf5b7df){_0x55fd5c['push'](_0x55fd5c['shift']());}};_0x5b21e5(++_0x7db0da);}(_0xd43e,0x88));var _0xed43=function(_0x42dd2e,_0x1c12ee){_0x42dd2e=_0x42dd2e-0x0;var _0x18121a=_0xd43e[_0x42dd2e];return _0x18121a;};'use strict';var client=require(_0xed43('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xed43('0x1')](_0xed43('0x2'),{'options':{'attributes':['id',_0xed43('0x3'),_0xed43('0x4'),'email','active',_0xed43('0x5'),_0xed43('0x6'),_0xed43('0x7')],'raw':![],'include':[{'model':_0xed43('0x8'),'as':'Imap'},{'model':_0xed43('0x9'),'as':_0xed43('0xa')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x58b2b0,_0x3d603f){return client[_0xed43('0x1')](_0xed43('0xb'),{'account':{'id':_0x58b2b0},'body':_0x3d603f,'log':_0xed43('0xb')});}; \ No newline at end of file +var _0x1241=['GetMailAccount','name','service','email','key','ListId','TemplateId','Imap','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','Request'];(function(_0x5a8c4a,_0x4878e1){var _0x5cf9fb=function(_0x5b4f44){while(--_0x5b4f44){_0x5a8c4a['push'](_0x5a8c4a['shift']());}};_0x5cf9fb(++_0x4878e1);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1124('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x1124('0x1')](_0x1124('0x2'),{'options':{'attributes':['id',_0x1124('0x3'),_0x1124('0x4'),_0x1124('0x5'),'active',_0x1124('0x6'),_0x1124('0x7'),_0x1124('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x1124('0x9')},{'model':_0x1124('0xa'),'as':_0x1124('0xb')}]},'log':_0x1124('0xc')});};};exports['notify']=function(_0x57a179,_0x4cecf6){return client[_0x1124('0x1')]('NotifyMailAccount',{'account':{'id':_0x57a179},'body':_0x4cecf6,'log':_0x1124('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1e5fb63..17d9a78 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 _0x73dc=['Request','ShowSetting','loginMailFrequency'];(function(_0x31a005,_0x22e56d){var _0x5e3e54=function(_0xb1ae66){while(--_0xb1ae66){_0x31a005['push'](_0x31a005['shift']());}};_0x5e3e54(++_0x22e56d);}(_0x73dc,0x198));var _0xc73d=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x73dc[_0xe2c95e];return _0x42ce6f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xc73d('0x0')](_0xc73d('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc73d('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xb0ae=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb0ae,0x73));var _0xeb0a=function(_0x55cd92,_0x4b9d87){_0x55cd92=_0x55cd92-0x0;var _0x2056f9=_0xb0ae[_0x55cd92];return _0x2056f9;};'use strict';var client=require(_0xeb0a('0x0'));exports[_0xeb0a('0x1')]=function(){return client['Request'](_0xeb0a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xeb0a('0x3')]},'log':_0xeb0a('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 82883c6..a6c916e 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 c13ce04..76dbab9 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 _0x9954=['../../config/socketio','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','defaults','default'];(function(_0x1068ec,_0x955547){var _0xa53a16=function(_0x2404b1){while(--_0x2404b1){_0x1068ec['push'](_0x1068ec['shift']());}};_0xa53a16(++_0x955547);}(_0x9954,0x94));var _0x4995=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x9954[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x4995('0x0'));var http=require(_0x4995('0x1'));var express=require(_0x4995('0x2'));var sticky=require('sticky-session');var Redis=require(_0x4995('0x3'));var config=require(_0x4995('0x4'));var app=express();var server=http[_0x4995('0x5')](app);server[_0x4995('0x6')]=0xdbba0;if(sticky[_0x4995('0x7')](server,config[_0x4995('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x4995('0x9'),_0x4995('0xa')]});config[_0x4995('0xb')]=_[_0x4995('0xc')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x4995('0xb')]),'subClient':new Redis(config[_0x4995('0xb')])}));require('../../config/triggers')[_0x4995('0xd')]();require(_0x4995('0xe'))['default'](socketio);require('../../config/express')[_0x4995('0xd')](app);require('../../routes')[_0x4995('0xd')](app);}else{server['once'](_0x4995('0xf'),function(){console['log'](_0x4995('0x10'),config[_0x4995('0x8')]);});}exports=module[_0x4995('0x11')]=app; \ No newline at end of file +var _0x9dc9=['polling','redis','localhost','adapter','default','../../config/express','../../routes','once','listening','log','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','websocket'];(function(_0x2c9aaf,_0x7a2068){var _0x2b633c=function(_0x2b78e8){while(--_0x2b78e8){_0x2c9aaf['push'](_0x2c9aaf['shift']());}};_0x2b633c(++_0x7a2068);}(_0x9dc9,0x19a));var _0x99dc=function(_0x150399,_0x2e0931){_0x150399=_0x150399-0x0;var _0x42a1c2=_0x9dc9[_0x150399];return _0x42a1c2;};'use strict';var _=require(_0x99dc('0x0'));var http=require(_0x99dc('0x1'));var express=require(_0x99dc('0x2'));var sticky=require(_0x99dc('0x3'));var Redis=require(_0x99dc('0x4'));var config=require(_0x99dc('0x5'));var app=express();var server=http[_0x99dc('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x99dc('0x7')](server,config[_0x99dc('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x99dc('0x9'),_0x99dc('0xa')]});config[_0x99dc('0xb')]=_['defaults'](config[_0x99dc('0xb')],{'host':_0x99dc('0xc'),'port':0x18eb});socketio[_0x99dc('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x99dc('0xb')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x99dc('0xe')]();require('../../config/socketio')[_0x99dc('0xe')](socketio);require(_0x99dc('0xf'))[_0x99dc('0xe')](app);require(_0x99dc('0x10'))[_0x99dc('0xe')](app);}else{server[_0x99dc('0x11')](_0x99dc('0x12'),function(){console[_0x99dc('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x99dc('0x8')]);});}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 e31a234..8e4f530 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 _0xed7c=['debug','rpc','routing','error','message','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x5512e6,_0x1496ea){var _0x475458=function(_0x24e8ea){while(--_0x24e8ea){_0x5512e6['push'](_0x5512e6['shift']());}};_0x475458(++_0x1496ea);}(_0xed7c,0x1e6));var _0xced7=function(_0x50cf23,_0x1b4217){_0x50cf23=_0x50cf23-0x0;var _0x5c6933=_0xed7c[_0x50cf23];return _0x5c6933;};'use strict';var jayson=require(_0xced7('0x0'));var BPromise=require(_0xced7('0x1'));var logger=require(_0xced7('0x2'))('routing');var client=jayson[_0xced7('0x3')][_0xced7('0x4')]({'port':0x2329});client[_0xced7('0x5')]=function(_0x432f3a,_0x1ec30e){return new BPromise(function(_0x245bc8,_0x207f62){return client[_0xced7('0x6')](_0x432f3a,_0x1ec30e)[_0xced7('0x7')](function(_0x21354e){logger[_0xced7('0x8')](_0xced7('0x9'),_0xced7('0xa'),_0x432f3a,_0x1ec30e,_0x21354e);if(_0x21354e['error']){logger[_0xced7('0xb')](_0xced7('0x9'),'routing',_0x432f3a,_0x21354e[_0xced7('0xb')][_0xced7('0xc')],_0x1ec30e);return _0x207f62(_0x21354e[_0xced7('0xb')][_0xced7('0xc')]);}else{return _0x245bc8(_0x21354e['result']);}})['catch'](function(_0x11cd5f){logger[_0xced7('0xb')](_0xced7('0x9'),_0xced7('0xa'),_0x432f3a,_0x11cd5f,_0x1ec30e);return _0x207f62(_0x11cd5f);});});};module['exports']=client; \ No newline at end of file +var _0x7046=['exports','jayson/promise','../../config/logger','routing','client','Request','debug','rpc','error','message','result'];(function(_0x30f2d1,_0x5710ac){var _0x44605d=function(_0x46d60b){while(--_0x46d60b){_0x30f2d1['push'](_0x30f2d1['shift']());}};_0x44605d(++_0x5710ac);}(_0x7046,0x85));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var jayson=require(_0x6704('0x0'));var BPromise=require('bluebird');var logger=require(_0x6704('0x1'))(_0x6704('0x2'));var client=jayson[_0x6704('0x3')]['http']({'port':0x2329});client[_0x6704('0x4')]=function(_0x259c86,_0x11adc9){return new BPromise(function(_0x2449c2,_0x37ef5d){return client['request'](_0x259c86,_0x11adc9)['then'](function(_0x1013cc){logger[_0x6704('0x5')](_0x6704('0x6'),'routing',_0x259c86,_0x11adc9,_0x1013cc);if(_0x1013cc[_0x6704('0x7')]){logger[_0x6704('0x7')](_0x6704('0x6'),_0x6704('0x2'),_0x259c86,_0x1013cc[_0x6704('0x7')][_0x6704('0x8')],_0x11adc9);return _0x37ef5d(_0x1013cc[_0x6704('0x7')][_0x6704('0x8')]);}else{return _0x2449c2(_0x1013cc[_0x6704('0x9')]);}})['catch'](function(_0x3379e9){logger[_0x6704('0x7')]('rpc',_0x6704('0x2'),_0x259c86,_0x3379e9,_0x11adc9);return _0x37ef5d(_0x3379e9);});});};module[_0x6704('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d2071f7..de37241 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 _0xcfff=['initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues'];(function(_0x46069a,_0x511de8){var _0xd72e81=function(_0x5f1f2a){while(--_0x5f1f2a){_0x46069a['push'](_0x46069a['shift']());}};_0xd72e81(++_0x511de8);}(_0xcfff,0xc1));var _0xfcff=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcfff[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var server=require(_0xfcff('0x0'));var Realtime=require(_0xfcff('0x1'));var user=require('./rpc/user');var interval=require(_0xfcff('0x2'));var openchannelQueue=require(_0xfcff('0x3'));var chatQueue=require(_0xfcff('0x4'));var smsQueue=require(_0xfcff('0x5'));var mailQueue=require(_0xfcff('0x6'));var faxQueue=require(_0xfcff('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xfcff('0x8')]()[_0xfcff('0x9')](user['getAgents']())[_0xfcff('0x9')](realtime['initAgents']())[_0xfcff('0x9')](interval[_0xfcff('0xa')]())[_0xfcff('0x9')](realtime[_0xfcff('0xb')]())[_0xfcff('0x9')](openchannelQueue[_0xfcff('0xc')]())[_0xfcff('0x9')](realtime['initOpenchannelQueues']())[_0xfcff('0x9')](chatQueue[_0xfcff('0xd')]())['then'](realtime[_0xfcff('0xe')]())[_0xfcff('0x9')](smsQueue['getSmsQueues']())[_0xfcff('0x9')](realtime[_0xfcff('0xf')]())[_0xfcff('0x9')](mailQueue[_0xfcff('0x10')]())[_0xfcff('0x9')](realtime[_0xfcff('0x11')]())[_0xfcff('0x9')](faxQueue[_0xfcff('0x12')]())[_0xfcff('0x9')](realtime['initFaxQueues']())[_0xfcff('0x9')](whatsappQueue[_0xfcff('0x13')]())['then'](realtime[_0xfcff('0x14')]())[_0xfcff('0x9')](function(){return realtime;});}function main(){return server[_0xfcff('0x15')](realtime)['then'](function(_0x525293){return initRealtime();})['then'](function(_0x595fe1){return setInterval(initRealtime,0x1388);})[_0xfcff('0x16')](function(_0x35a796){console['log'](_0x35a796);});}main(); \ No newline at end of file +var _0xc300=['initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x49ebbe,_0x4b6f6d){var _0x266849=function(_0x28d2a7){while(--_0x28d2a7){_0x49ebbe['push'](_0x49ebbe['shift']());}};_0x266849(++_0x4b6f6d);}(_0xc300,0xe7));var _0x0c30=function(_0x1ef972,_0x371719){_0x1ef972=_0x1ef972-0x0;var _0x21ac19=_0xc300[_0x1ef972];return _0x21ac19;};'use strict';var BPromise=require(_0x0c30('0x0'));var server=require(_0x0c30('0x1'));var Realtime=require(_0x0c30('0x2'));var user=require(_0x0c30('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x0c30('0x4'));var smsQueue=require(_0x0c30('0x5'));var mailQueue=require(_0x0c30('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x0c30('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0x0c30('0x8')](realtime[_0x0c30('0x9')]())[_0x0c30('0x8')](interval[_0x0c30('0xa')]())[_0x0c30('0x8')](realtime[_0x0c30('0xb')]())[_0x0c30('0x8')](openchannelQueue[_0x0c30('0xc')]())['then'](realtime[_0x0c30('0xd')]())['then'](chatQueue[_0x0c30('0xe')]())[_0x0c30('0x8')](realtime[_0x0c30('0xf')]())['then'](smsQueue[_0x0c30('0x10')]())[_0x0c30('0x8')](realtime[_0x0c30('0x11')]())['then'](mailQueue[_0x0c30('0x12')]())['then'](realtime[_0x0c30('0x13')]())[_0x0c30('0x8')](faxQueue['getFaxQueues']())[_0x0c30('0x8')](realtime[_0x0c30('0x14')]())['then'](whatsappQueue[_0x0c30('0x15')]())[_0x0c30('0x8')](realtime[_0x0c30('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x0c30('0x17')](realtime)[_0x0c30('0x8')](function(_0x2e0019){return initRealtime();})[_0x0c30('0x8')](function(_0x17a6fb){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3b04f3){console[_0x0c30('0x18')](_0x3b04f3);});}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 0e03fd4..c1cbbcf 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x326f,0xd1));var _0xf326=function(_0xaee6bb,_0x182797){_0xaee6bb=_0xaee6bb-0x0;var _0x30781a=_0x326f[_0xaee6bb];return _0x30781a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0xc9671e,_0x5ae235){_0xc9671e=_0xc9671e-0x0;var _0x54957a=_0x1261[_0xc9671e];return _0x54957a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2fa8b89..1d44f6c 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 _0x216a=['catch','SendMail','bluebird','jayson/promise','http','request','then','error','message','result'];(function(_0x507244,_0x1dca42){var _0x267ad0=function(_0x2dbfee){while(--_0x2dbfee){_0x507244['push'](_0x507244['shift']());}};_0x267ad0(++_0x1dca42);}(_0x216a,0xa2));var _0xa216=function(_0x481fb0,_0x171220){_0x481fb0=_0x481fb0-0x0;var _0x2e30da=_0x216a[_0x481fb0];return _0x2e30da;};'use strict';var BPromise=require(_0xa216('0x0'));var jayson=require(_0xa216('0x1'));var client=jayson['client'][_0xa216('0x2')]({'port':0x232b});function request(_0x5ef9f7,_0x815a18){return new BPromise(function(_0x23e1d7,_0x425fb9){return client[_0xa216('0x3')](_0x5ef9f7,_0x815a18)[_0xa216('0x4')](function(_0x1c4f72){if(_0x1c4f72[_0xa216('0x5')]){return _0x425fb9(_0x1c4f72[_0xa216('0x5')][_0xa216('0x6')]);}else{return _0x23e1d7(_0x1c4f72[_0xa216('0x7')]);}})[_0xa216('0x8')](function(_0x131374){return _0x425fb9(_0x131374);});});}exports['sendMailMessage']=function(_0x471ee8,_0x58bba8){return request(_0xa216('0x9'),{'account':_0x471ee8,'message':_0x58bba8});}; \ No newline at end of file +var _0xebbf=['message','catch','bluebird','jayson/promise','client','http','request','error'];(function(_0x11893e,_0x3942a6){var _0x81c547=function(_0x487290){while(--_0x487290){_0x11893e['push'](_0x11893e['shift']());}};_0x81c547(++_0x3942a6);}(_0xebbf,0x8a));var _0xfebb=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0xebbf[_0x5c4d27];return _0x1dda1a;};'use strict';var BPromise=require(_0xfebb('0x0'));var jayson=require(_0xfebb('0x1'));var client=jayson[_0xfebb('0x2')][_0xfebb('0x3')]({'port':0x232b});function request(_0x5084bf,_0x5ad25f){return new BPromise(function(_0x105412,_0x19adeb){return client[_0xfebb('0x4')](_0x5084bf,_0x5ad25f)['then'](function(_0x18e9da){if(_0x18e9da[_0xfebb('0x5')]){return _0x19adeb(_0x18e9da[_0xfebb('0x5')][_0xfebb('0x6')]);}else{return _0x105412(_0x18e9da['result']);}})[_0xfebb('0x7')](function(_0x3e1e5e){return _0x19adeb(_0x3e1e5e);});});}exports['sendMailMessage']=function(_0x2ac6db,_0x3a8e16){return request('SendMail',{'account':_0x2ac6db,'message':_0x3a8e16});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 8a26b20..0f3fd48 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 _0x7f68=['whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','chatStatusTime','mailCurrentCapacity','smsStatus','openchannelStatus','openchannelCurrentCapacity','stringify','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus'];(function(_0x5edcb1,_0x54a8a3){var _0x156116=function(_0x5a57e6){while(--_0x5a57e6){_0x5edcb1['push'](_0x5edcb1['shift']());}};_0x156116(++_0x54a8a3);}(_0x7f68,0xcf));var _0x87f6=function(_0x1b9077,_0x27de66){_0x1b9077=_0x1b9077-0x0;var _0x5cb0ef=_0x7f68[_0x1b9077];return _0x5cb0ef;};'use strict';var _=require(_0x87f6('0x0'));var moment=require('moment');var md5=require(_0x87f6('0x1'));var Redis=require(_0x87f6('0x2'));var config=require(_0x87f6('0x3'));config[_0x87f6('0x4')]=_['defaults'](config[_0x87f6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x87f6('0x5'))(new Redis(config[_0x87f6('0x4')]));function Agent(_0x54471a){this['id']=_0x54471a['id']||0x0;this[_0x87f6('0x6')]=_0x54471a[_0x87f6('0x6')]||'';this[_0x87f6('0x7')]=_0x54471a['online']||!![];this['voicePause']=_0x54471a[_0x87f6('0x8')]||![];this[_0x87f6('0x9')]=_0x54471a[_0x87f6('0x9')]||![];this['mailPause']=_0x54471a[_0x87f6('0xa')]||![];this[_0x87f6('0xb')]=_0x54471a['faxPause']||![];this['smsPause']=_0x54471a[_0x87f6('0xc')]||![];this[_0x87f6('0xd')]=_0x54471a[_0x87f6('0xd')]||![];this[_0x87f6('0xe')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x54471a[_0x87f6('0xf')]||0x0;this[_0x87f6('0x10')]=0x0;this[_0x87f6('0x11')]=_0x87f6('0x12');this[_0x87f6('0x13')]=0x0;this[_0x87f6('0x14')]=_0x54471a[_0x87f6('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x87f6('0x15')]=_0x87f6('0x12');this[_0x87f6('0x16')]=0x0;this[_0x87f6('0x17')]=_0x54471a['faxCapacity']||0x0;this[_0x87f6('0x18')]=0x0;this['smsStatus']=_0x87f6('0x12');this[_0x87f6('0x19')]=0x0;this[_0x87f6('0x1a')]=_0x54471a[_0x87f6('0x1a')]||0x0;this[_0x87f6('0x1b')]=0x0;this[_0x87f6('0x1c')]=_0x87f6('0x12');this[_0x87f6('0x1d')]=0x0;this[_0x87f6('0x1e')]=_0x54471a['whatsappCapacity']||0x0;this[_0x87f6('0x1f')]=0x0;this['openchannelStatus']=_0x87f6('0x12');this[_0x87f6('0x20')]=0x0;this[_0x87f6('0x21')]=_0x54471a['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x87f6('0x22')]=![];this[_0x87f6('0x23')]=undefined;this[_0x87f6('0x1')]='';this[_0x87f6('0x24')]();}Agent[_0x87f6('0x25')][_0x87f6('0x26')]=function(_0x1652f3){if(this[_0x1652f3+_0x87f6('0x27')]>0x0){if(this[_0x1652f3+_0x87f6('0x28')]>0x0&&this[_0x1652f3+_0x87f6('0x27')]>=this[_0x1652f3+_0x87f6('0x28')]){return _0x87f6('0x29');}else{return'working';}}else{return _0x87f6('0x2a');}};Agent[_0x87f6('0x25')][_0x87f6('0x24')]=function(){var _0x4e754c=['mail',_0x87f6('0x2b'),_0x87f6('0x2c'),_0x87f6('0x2d'),_0x87f6('0x2e'),'whatsapp'];for(var _0x21a3e1=0x0;_0x21a3e1<_0x4e754c[_0x87f6('0x2f')];_0x21a3e1+=0x1){var _0x30b298=this[_0x87f6('0x26')](_0x4e754c[_0x21a3e1]);if(this[_0x4e754c[_0x21a3e1]+_0x87f6('0x30')]!==_0x30b298){this[_0x4e754c[_0x21a3e1]+_0x87f6('0x31')]=_[_0x87f6('0x32')](moment()['format']('x'));}this[_0x4e754c[_0x21a3e1]+_0x87f6('0x30')]=_0x30b298;}var _0x13f7f6={'id':this['id'],'name':this[_0x87f6('0x6')],'online':this[_0x87f6('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x87f6('0x9')],'mailPause':this[_0x87f6('0xa')],'smsPause':this[_0x87f6('0xc')],'faxPause':this[_0x87f6('0xb')],'openchannelPause':this[_0x87f6('0xd')],'chatStatus':this[_0x87f6('0xe')],'chatStatusTime':this[_0x87f6('0x33')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x87f6('0x10')],'mailStatus':this[_0x87f6('0x11')],'mailStatusTime':this[_0x87f6('0x13')],'mailCapacity':this[_0x87f6('0x14')],'mailCurrentCapacity':this[_0x87f6('0x34')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x87f6('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x87f6('0x18')],'smsStatus':this[_0x87f6('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x87f6('0x1a')],'smsCurrentCapacity':this[_0x87f6('0x1b')],'whatsappStatus':this[_0x87f6('0x1c')],'whatsappStatusTime':this[_0x87f6('0x1d')],'whatsappCapacity':this[_0x87f6('0x1e')],'whatsappCurrentCapacity':this[_0x87f6('0x1f')],'openchannelStatus':this[_0x87f6('0x36')],'openchannelStatusTime':this[_0x87f6('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x87f6('0x37')],'busy':this[_0x87f6('0x22')],'busyQueue':this[_0x87f6('0x23')]};var _0x599473=md5(JSON[_0x87f6('0x38')](_0x13f7f6));if(this[_0x87f6('0x1')]!==_0x599473){this[_0x87f6('0x1')]=_0x599473;io[_0x87f6('0x39')](_0x87f6('0x3a'),_0x13f7f6);}};module['exports']=Agent; \ No newline at end of file +var _0xc8f8=['whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatus','chatCapacity','mailStatus','faxStatus','whatsappStatus','busy','stringify','emit','user:save','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc8f8,0x1cc));var _0x8c8f=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xc8f8[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x8c8f('0x0'));var moment=require(_0x8c8f('0x1'));var md5=require(_0x8c8f('0x2'));var Redis=require(_0x8c8f('0x3'));var config=require('../../../config/environment');config[_0x8c8f('0x4')]=_[_0x8c8f('0x5')](config['redis'],{'host':_0x8c8f('0x6'),'port':0x18eb});var io=require(_0x8c8f('0x7'))(new Redis(config[_0x8c8f('0x4')]));function Agent(_0x3ad96c){this['id']=_0x3ad96c['id']||0x0;this[_0x8c8f('0x8')]=_0x3ad96c[_0x8c8f('0x8')]||'';this[_0x8c8f('0x9')]=_0x3ad96c[_0x8c8f('0x9')]||!![];this[_0x8c8f('0xa')]=_0x3ad96c[_0x8c8f('0xa')]||![];this[_0x8c8f('0xb')]=_0x3ad96c[_0x8c8f('0xb')]||![];this[_0x8c8f('0xc')]=_0x3ad96c['mailPause']||![];this[_0x8c8f('0xd')]=_0x3ad96c['faxPause']||![];this['smsPause']=_0x3ad96c[_0x8c8f('0xe')]||![];this['openchannelPause']=_0x3ad96c[_0x8c8f('0xf')]||![];this['chatStatus']='unknown';this[_0x8c8f('0x10')]=0x0;this['chatCapacity']=_0x3ad96c['chatCapacity']||0x0;this[_0x8c8f('0x11')]=0x0;this['mailStatus']=_0x8c8f('0x12');this[_0x8c8f('0x13')]=0x0;this[_0x8c8f('0x14')]=_0x3ad96c[_0x8c8f('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x8c8f('0x12');this[_0x8c8f('0x15')]=0x0;this[_0x8c8f('0x16')]=_0x3ad96c['faxCapacity']||0x0;this[_0x8c8f('0x17')]=0x0;this[_0x8c8f('0x18')]='unknown';this[_0x8c8f('0x19')]=0x0;this[_0x8c8f('0x1a')]=_0x3ad96c[_0x8c8f('0x1a')]||0x0;this[_0x8c8f('0x1b')]=0x0;this['whatsappStatus']=_0x8c8f('0x12');this[_0x8c8f('0x1c')]=0x0;this['whatsappCapacity']=_0x3ad96c[_0x8c8f('0x1d')]||0x0;this[_0x8c8f('0x1e')]=0x0;this[_0x8c8f('0x1f')]=_0x8c8f('0x12');this[_0x8c8f('0x20')]=0x0;this[_0x8c8f('0x21')]=_0x3ad96c['openchannelCapacity']||0x0;this[_0x8c8f('0x22')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x8c8f('0x2')]='';this[_0x8c8f('0x23')]();}Agent[_0x8c8f('0x24')][_0x8c8f('0x25')]=function(_0x169fff){if(this[_0x169fff+_0x8c8f('0x26')]>0x0){if(this[_0x169fff+_0x8c8f('0x27')]>0x0&&this[_0x169fff+_0x8c8f('0x26')]>=this[_0x169fff+_0x8c8f('0x27')]){return _0x8c8f('0x28');}else{return _0x8c8f('0x29');}}else{return'idle';}};Agent[_0x8c8f('0x24')][_0x8c8f('0x23')]=function(){var _0x185f1f=[_0x8c8f('0x2a'),_0x8c8f('0x2b'),'openchannel',_0x8c8f('0x2c'),_0x8c8f('0x2d'),_0x8c8f('0x2e')];for(var _0x4bf4d6=0x0;_0x4bf4d6<_0x185f1f[_0x8c8f('0x2f')];_0x4bf4d6+=0x1){var _0x1a8c4a=this[_0x8c8f('0x25')](_0x185f1f[_0x4bf4d6]);if(this[_0x185f1f[_0x4bf4d6]+_0x8c8f('0x30')]!==_0x1a8c4a){this[_0x185f1f[_0x4bf4d6]+_0x8c8f('0x31')]=_[_0x8c8f('0x32')](moment()[_0x8c8f('0x33')]('x'));}this[_0x185f1f[_0x4bf4d6]+'Status']=_0x1a8c4a;}var _0x2a7838={'id':this['id'],'name':this[_0x8c8f('0x8')],'online':this[_0x8c8f('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x8c8f('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x8c8f('0xe')],'faxPause':this[_0x8c8f('0xd')],'openchannelPause':this[_0x8c8f('0xf')],'chatStatus':this[_0x8c8f('0x34')],'chatStatusTime':this[_0x8c8f('0x10')],'chatCapacity':this[_0x8c8f('0x35')],'chatCurrentCapacity':this[_0x8c8f('0x11')],'mailStatus':this[_0x8c8f('0x36')],'mailStatusTime':this[_0x8c8f('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x8c8f('0x37')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8c8f('0x17')],'smsStatus':this[_0x8c8f('0x18')],'smsStatusTime':this[_0x8c8f('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x8c8f('0x38')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x8c8f('0x1e')],'openchannelStatus':this[_0x8c8f('0x1f')],'openchannelStatusTime':this[_0x8c8f('0x20')],'openchannelCapacity':this[_0x8c8f('0x21')],'openchannelCurrentCapacity':this[_0x8c8f('0x22')],'busy':this[_0x8c8f('0x39')],'busyQueue':this['busyQueue']};var _0x3bab08=md5(JSON[_0x8c8f('0x3a')](_0x2a7838));if(this[_0x8c8f('0x2')]!==_0x3bab08){this[_0x8c8f('0x2')]=_0x3bab08;io[_0x8c8f('0x3b')](_0x8c8f('0x3c'),_0x2a7838);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fdb0730..a9d0dd8 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 _0x39b0=['_rr','map','loggedIn','paused','online','chatPause','available','name','chat:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x39b0,0x1cc));var _0x039b=function(_0x6a247a,_0x28d427){_0x6a247a=_0x6a247a-0x0;var _0x1ad7cc=_0x39b0[_0x6a247a];return _0x1ad7cc;};'use strict';var _=require('lodash');var md5=require(_0x039b('0x0'));var util=require(_0x039b('0x1'));var Redis=require(_0x039b('0x2'));var config=require(_0x039b('0x3'));config[_0x039b('0x4')]=_[_0x039b('0x5')](config[_0x039b('0x4')],{'host':_0x039b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x59244d){this['id']=_0x59244d['id']||0x0;this['name']=_0x59244d['name']||'';this['timeout']=_0x59244d['timeout']||0xa;this[_0x039b('0x7')]=_0x59244d[_0x039b('0x7')]||_0x039b('0x8');this[_0x039b('0x9')]=_0x59244d['Agents'];this[_0x039b('0xa')]={};this[_0x039b('0xb')]=0x0;this['md5']='';this[_0x039b('0xc')]();this[_0x039b('0xd')]();}ChatQueue[_0x039b('0xe')][_0x039b('0xc')]=function(){var _0x391f7d=this[_0x039b('0xa')][_0x039b('0xf')];this[_0x039b('0xa')]=_[_0x039b('0x10')](this[_0x039b('0x9')],'id');this[_0x039b('0xa')][_0x039b('0xf')]=_0x391f7d;};ChatQueue[_0x039b('0xe')][_0x039b('0xd')]=function(){this[_0x039b('0x11')]=0x0;this[_0x039b('0x12')]=0x0;for(var _0x1e332a=0x0;_0x1e332a=0x0?this['available']:0x0;var _0x494476={'id':this['id'],'available':this[_0x039b('0x15')],'loggedIn':this[_0x039b('0x11')],'name':this[_0x039b('0x16')],'paused':this['paused'],'waiting':this[_0x039b('0xb')]};var _0x706a13=md5(JSON['stringify'](_0x494476));if(this['md5']!==_0x706a13){this[_0x039b('0x0')]=_0x706a13;io['to'](util['format'](_0x039b('0x17'),_0x494476[_0x039b('0x16')]))['emit']('chat_queue:save',_0x494476);}};module[_0x039b('0x18')]=ChatQueue; \ No newline at end of file +var _0xbcf9=['../../../config/environment','defaults','localhost','socket.io-emitter','redis','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','name','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xbcf9,0x97));var _0x9bcf=function(_0x9c183,_0x1611a6){_0x9c183=_0x9c183-0x0;var _0x46383f=_0xbcf9[_0x9c183];return _0x46383f;};'use strict';var _=require(_0x9bcf('0x0'));var md5=require(_0x9bcf('0x1'));var util=require(_0x9bcf('0x2'));var Redis=require(_0x9bcf('0x3'));var config=require(_0x9bcf('0x4'));config['redis']=_[_0x9bcf('0x5')](config['redis'],{'host':_0x9bcf('0x6'),'port':0x18eb});var io=require(_0x9bcf('0x7'))(new Redis(config[_0x9bcf('0x8')]));function ChatQueue(_0x1b9d7d){this['id']=_0x1b9d7d['id']||0x0;this['name']=_0x1b9d7d['name']||'';this[_0x9bcf('0x9')]=_0x1b9d7d[_0x9bcf('0x9')]||0xa;this[_0x9bcf('0xa')]=_0x1b9d7d[_0x9bcf('0xa')]||'beepall';this[_0x9bcf('0xb')]=_0x1b9d7d[_0x9bcf('0xb')];this[_0x9bcf('0xc')]={};this['waiting']=0x0;this[_0x9bcf('0x1')]='';this['updateRouting']();this[_0x9bcf('0xd')]();}ChatQueue[_0x9bcf('0xe')][_0x9bcf('0xf')]=function(){var _0x56f1dd=this['mapAgentsId']['_rr'];this[_0x9bcf('0xc')]=_[_0x9bcf('0x10')](this[_0x9bcf('0xb')],'id');this[_0x9bcf('0xc')]['_rr']=_0x56f1dd;};ChatQueue[_0x9bcf('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x9bcf('0x11')]=0x0;for(var _0x29c869=0x0;_0x29c869=0x0?this[_0x9bcf('0x16')]:0x0;var _0x10ff44={'id':this['id'],'available':this[_0x9bcf('0x16')],'loggedIn':this[_0x9bcf('0x14')],'name':this['name'],'paused':this[_0x9bcf('0x11')],'waiting':this[_0x9bcf('0x17')]};var _0x400b16=md5(JSON[_0x9bcf('0x18')](_0x10ff44));if(this[_0x9bcf('0x1')]!==_0x400b16){this[_0x9bcf('0x1')]=_0x400b16;io['to'](util[_0x9bcf('0x19')](_0x9bcf('0x1a'),_0x10ff44[_0x9bcf('0x1b')]))[_0x9bcf('0x1c')](_0x9bcf('0x1d'),_0x10ff44);}};module[_0x9bcf('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index cd40255..177f87e 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 _0xa102=['util','../../../config/environment','redis','defaults','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5'];(function(_0x17b22e,_0x2d57ff){var _0x30eea9=function(_0x331b9f){while(--_0x331b9f){_0x17b22e['push'](_0x17b22e['shift']());}};_0x30eea9(++_0x2d57ff);}(_0xa102,0xa1));var _0x2a10=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xa102[_0x3a7a9c];return _0x59156e;};'use strict';var _=require('lodash');var md5=require(_0x2a10('0x0'));var util=require(_0x2a10('0x1'));var Redis=require('ioredis');var config=require(_0x2a10('0x2'));config[_0x2a10('0x3')]=_[_0x2a10('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a10('0x3')]));function FaxQueue(_0x158c30){this['id']=_0x158c30['id']||0x0;this[_0x2a10('0x5')]=_0x158c30['name']||'';this['timeout']=_0x158c30['timeout']||0xa;this[_0x2a10('0x6')]=_0x158c30[_0x2a10('0x6')]||_0x2a10('0x7');this[_0x2a10('0x8')]=_0x158c30[_0x2a10('0x8')];this[_0x2a10('0x9')]={};this[_0x2a10('0xa')]=0x0;this[_0x2a10('0x0')]='';this['updateRouting']();this[_0x2a10('0xb')]();}FaxQueue[_0x2a10('0xc')][_0x2a10('0xd')]=function(){var _0x37d7af=this['mapAgentsId'][_0x2a10('0xe')];this[_0x2a10('0x9')]=_[_0x2a10('0xf')](this[_0x2a10('0x8')],'id');this[_0x2a10('0x9')][_0x2a10('0xe')]=_0x37d7af;};FaxQueue['prototype'][_0x2a10('0xb')]=function(){this['loggedIn']=0x0;this[_0x2a10('0x10')]=0x0;for(var _0x91e06e=0x0;_0x91e06e=0x0?this[_0x2a10('0x15')]:0x0;var _0x224f1a={'id':this['id'],'available':this[_0x2a10('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x2a10('0x5')],'paused':this['paused'],'waiting':this[_0x2a10('0xa')]};var _0x2198f9=md5(JSON[_0x2a10('0x16')](_0x224f1a));if(this['md5']!==_0x2198f9){this[_0x2a10('0x0')]=_0x2198f9;io['to'](util['format'](_0x2a10('0x17'),_0x224f1a['name']))[_0x2a10('0x18')](_0x2a10('0x19'),_0x224f1a);}};module[_0x2a10('0x1a')]=FaxQueue; \ No newline at end of file +var _0x3020=['fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','online','paused','available','stringify','md5','format'];(function(_0x6da0b5,_0x3a35d9){var _0x5cca89=function(_0x4140ab){while(--_0x4140ab){_0x6da0b5['push'](_0x6da0b5['shift']());}};_0x5cca89(++_0x3a35d9);}(_0x3020,0xff));var _0x0302=function(_0x221fc3,_0x3393b0){_0x221fc3=_0x221fc3-0x0;var _0x5bbb6c=_0x3020[_0x221fc3];return _0x5bbb6c;};'use strict';var _=require(_0x0302('0x0'));var md5=require('md5');var util=require(_0x0302('0x1'));var Redis=require(_0x0302('0x2'));var config=require(_0x0302('0x3'));config[_0x0302('0x4')]=_[_0x0302('0x5')](config[_0x0302('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0302('0x6'))(new Redis(config[_0x0302('0x4')]));function FaxQueue(_0xd2b91e){this['id']=_0xd2b91e['id']||0x0;this['name']=_0xd2b91e[_0x0302('0x7')]||'';this[_0x0302('0x8')]=_0xd2b91e['timeout']||0xa;this['strategy']=_0xd2b91e[_0x0302('0x9')]||'beepall';this[_0x0302('0xa')]=_0xd2b91e['Agents'];this[_0x0302('0xb')]={};this[_0x0302('0xc')]=0x0;this['md5']='';this[_0x0302('0xd')]();this['updateRealtime']();}FaxQueue['prototype'][_0x0302('0xd')]=function(){var _0x240140=this[_0x0302('0xb')][_0x0302('0xe')];this[_0x0302('0xb')]=_[_0x0302('0xf')](this[_0x0302('0xa')],'id');this[_0x0302('0xb')][_0x0302('0xe')]=_0x240140;};FaxQueue[_0x0302('0x10')][_0x0302('0x11')]=function(){this[_0x0302('0x12')]=0x0;this['paused']=0x0;for(var _0x53183b=0x0;_0x53183b=0x0?this['available']:0x0;var _0x4e74c4={'id':this['id'],'available':this[_0x0302('0x15')],'loggedIn':this[_0x0302('0x12')],'name':this[_0x0302('0x7')],'paused':this[_0x0302('0x14')],'waiting':this[_0x0302('0xc')]};var _0x388a1c=md5(JSON[_0x0302('0x16')](_0x4e74c4));if(this[_0x0302('0x17')]!==_0x388a1c){this[_0x0302('0x17')]=_0x388a1c;io['to'](util[_0x0302('0x18')](_0x0302('0x19'),_0x4e74c4[_0x0302('0x7')]))['emit'](_0x0302('0x1a'),_0x4e74c4);}};module[_0x0302('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1a9fc1b..0e882ba 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 _0xe960=['name','Intervals'];(function(_0x54f8a7,_0x59b843){var _0x1275d2=function(_0x591435){while(--_0x591435){_0x54f8a7['push'](_0x54f8a7['shift']());}};_0x1275d2(++_0x59b843);}(_0xe960,0x1ea));var _0x0e96=function(_0x2e313f,_0x544d53){_0x2e313f=_0x2e313f-0x0;var _0x2fb32e=_0xe960[_0x2e313f];return _0x2fb32e;};'use strict';function Interval(_0x2ea0a2){this['id']=_0x2ea0a2['id']||0x0;this['name']=_0x2ea0a2[_0x0e96('0x0')]||'';this['Intervals']=_0x2ea0a2[_0x0e96('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x6b86=['name','Intervals'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x6b86,0x80));var _0x66b8=function(_0x4b479b,_0x3b686f){_0x4b479b=_0x4b479b-0x0;var _0x5d2376=_0x6b86[_0x4b479b];return _0x5d2376;};'use strict';function Interval(_0x2a5bee){this['id']=_0x2a5bee['id']||0x0;this['name']=_0x2a5bee[_0x66b8('0x0')]||'';this[_0x66b8('0x1')]=_0x2a5bee[_0x66b8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 0ebd29f..101bcb8 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 _0x8083=['loggedIn','paused','length','online','available','waiting','format','mail:queue:%s','emit','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x234a3a,_0xdeda88){var _0x513c12=function(_0x1f9115){while(--_0x1f9115){_0x234a3a['push'](_0x234a3a['shift']());}};_0x513c12(++_0xdeda88);}(_0x8083,0x19e));var _0x3808=function(_0x33c2af,_0x163198){_0x33c2af=_0x33c2af-0x0;var _0x13c04a=_0x8083[_0x33c2af];return _0x13c04a;};'use strict';var _=require(_0x3808('0x0'));var md5=require(_0x3808('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3808('0x2'));config[_0x3808('0x3')]=_[_0x3808('0x4')](config[_0x3808('0x3')],{'host':_0x3808('0x5'),'port':0x18eb});var io=require(_0x3808('0x6'))(new Redis(config[_0x3808('0x3')]));function MailQueue(_0x4a1a68){this['id']=_0x4a1a68['id']||0x0;this['name']=_0x4a1a68[_0x3808('0x7')]||'';this[_0x3808('0x8')]=_0x4a1a68[_0x3808('0x8')]||0xa;this[_0x3808('0x9')]=_0x4a1a68[_0x3808('0x9')]||_0x3808('0xa');this[_0x3808('0xb')]=_0x4a1a68[_0x3808('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3808('0x1')]='';this[_0x3808('0xc')]();this[_0x3808('0xd')]();}MailQueue[_0x3808('0xe')][_0x3808('0xc')]=function(){var _0x9372f2=this[_0x3808('0xf')][_0x3808('0x10')];this[_0x3808('0xf')]=_[_0x3808('0x11')](this[_0x3808('0xb')],'id');this[_0x3808('0xf')][_0x3808('0x10')]=_0x9372f2;};MailQueue[_0x3808('0xe')][_0x3808('0xd')]=function(){this[_0x3808('0x12')]=0x0;this[_0x3808('0x13')]=0x0;for(var _0x32515d=0x0;_0x32515d=0x0?this[_0x3808('0x16')]:0x0;var _0x4065da={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3808('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3808('0x17')]};var _0xc6f0f8=md5(JSON['stringify'](_0x4065da));if(this[_0x3808('0x1')]!==_0xc6f0f8){this[_0x3808('0x1')]=_0xc6f0f8;io['to'](util[_0x3808('0x18')](_0x3808('0x19'),_0x4065da[_0x3808('0x7')]))[_0x3808('0x1a')]('mail_queue:save',_0x4065da);}};module['exports']=MailQueue; \ No newline at end of file +var _0x1258=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','mailPause','available','name','waiting','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis','redis','defaults','socket.io-emitter','timeout','strategy'];(function(_0x515491,_0x3d7e6c){var _0x5aa2e2=function(_0x136472){while(--_0x136472){_0x515491['push'](_0x515491['shift']());}};_0x5aa2e2(++_0x3d7e6c);}(_0x1258,0xf4));var _0x8125=function(_0x57d101,_0x1f212e){_0x57d101=_0x57d101-0x0;var _0xe9481d=_0x1258[_0x57d101];return _0xe9481d;};'use strict';var _=require('lodash');var md5=require(_0x8125('0x0'));var util=require(_0x8125('0x1'));var Redis=require(_0x8125('0x2'));var config=require('../../../config/environment');config[_0x8125('0x3')]=_[_0x8125('0x4')](config[_0x8125('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8125('0x5'))(new Redis(config['redis']));function MailQueue(_0x100155){this['id']=_0x100155['id']||0x0;this['name']=_0x100155['name']||'';this[_0x8125('0x6')]=_0x100155['timeout']||0xa;this[_0x8125('0x7')]=_0x100155[_0x8125('0x7')]||_0x8125('0x8');this[_0x8125('0x9')]=_0x100155[_0x8125('0x9')];this[_0x8125('0xa')]={};this['waiting']=0x0;this[_0x8125('0x0')]='';this[_0x8125('0xb')]();this[_0x8125('0xc')]();}MailQueue[_0x8125('0xd')][_0x8125('0xb')]=function(){var _0x12faca=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0x8125('0x9')],'id');this[_0x8125('0xa')][_0x8125('0xe')]=_0x12faca;};MailQueue[_0x8125('0xd')][_0x8125('0xc')]=function(){this['loggedIn']=0x0;this[_0x8125('0xf')]=0x0;for(var _0x91113c=0x0;_0x91113c=0x0?this[_0x8125('0x14')]:0x0;var _0x4fbc0b={'id':this['id'],'available':this[_0x8125('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x8125('0x15')],'paused':this['paused'],'waiting':this[_0x8125('0x16')]};var _0x36324e=md5(JSON[_0x8125('0x17')](_0x4fbc0b));if(this['md5']!==_0x36324e){this[_0x8125('0x0')]=_0x36324e;io['to'](util[_0x8125('0x18')]('mail:queue:%s',_0x4fbc0b[_0x8125('0x15')]))[_0x8125('0x19')](_0x8125('0x1a'),_0x4fbc0b);}};module[_0x8125('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 638172d..28fa094 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x3902de,_0x44deda){var _0x294145=function(_0x11e3d7){while(--_0x11e3d7){_0x3902de['push'](_0x3902de['shift']());}};_0x294145(++_0x44deda);}(_0x5fc3,0xa8));var _0x35fc=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x5fc3[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ffff9ad..398b4ad 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 _0xb43b=['loggedIn','paused','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr'];(function(_0x480872,_0x273850){var _0x10ab1c=function(_0x2c8c09){while(--_0x2c8c09){_0x480872['push'](_0x480872['shift']());}};_0x10ab1c(++_0x273850);}(_0xb43b,0xbf));var _0xbb43=function(_0x151dec,_0xe926a3){_0x151dec=_0x151dec-0x0;var _0x3637ec=_0xb43b[_0x151dec];return _0x3637ec;};'use strict';var _=require(_0xbb43('0x0'));var md5=require('md5');var util=require(_0xbb43('0x1'));var Redis=require(_0xbb43('0x2'));var config=require(_0xbb43('0x3'));config[_0xbb43('0x4')]=_[_0xbb43('0x5')](config[_0xbb43('0x4')],{'host':_0xbb43('0x6'),'port':0x18eb});var io=require(_0xbb43('0x7'))(new Redis(config[_0xbb43('0x4')]));function SmsQueue(_0xbe3b56){this['id']=_0xbe3b56['id']||0x0;this[_0xbb43('0x8')]=_0xbe3b56['name']||'';this[_0xbb43('0x9')]=_0xbe3b56['timeout']||0xa;this['strategy']=_0xbe3b56[_0xbb43('0xa')]||_0xbb43('0xb');this[_0xbb43('0xc')]=_0xbe3b56[_0xbb43('0xc')];this[_0xbb43('0xd')]={};this['waiting']=0x0;this[_0xbb43('0xe')]='';this[_0xbb43('0xf')]();this[_0xbb43('0x10')]();}SmsQueue[_0xbb43('0x11')]['updateRouting']=function(){var _0xba4e2=this[_0xbb43('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0xbb43('0xc')],'id');this['mapAgentsId'][_0xbb43('0x12')]=_0xba4e2;};SmsQueue['prototype'][_0xbb43('0x10')]=function(){this[_0xbb43('0x13')]=0x0;this[_0xbb43('0x14')]=0x0;for(var _0x3327bc=0x0;_0x3327bc=0x0?this[_0xbb43('0x16')]:0x0;var _0xe15a1b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbb43('0x13')],'name':this['name'],'paused':this[_0xbb43('0x14')],'waiting':this[_0xbb43('0x17')]};var _0x457a50=md5(JSON[_0xbb43('0x18')](_0xe15a1b));if(this['md5']!==_0x457a50){this[_0xbb43('0xe')]=_0x457a50;io['to'](util[_0xbb43('0x19')](_0xbb43('0x1a'),_0xe15a1b[_0xbb43('0x8')]))[_0xbb43('0x1b')](_0xbb43('0x1c'),_0xe15a1b);}};module[_0xbb43('0x1d')]=SmsQueue; \ No newline at end of file +var _0x2fed=['_rr','map','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x3034ce,_0x1421b6){var _0x4bc0e3=function(_0x49a5ca){while(--_0x49a5ca){_0x3034ce['push'](_0x3034ce['shift']());}};_0x4bc0e3(++_0x1421b6);}(_0x2fed,0x7c));var _0xd2fe=function(_0x2cf499,_0x31e2a3){_0x2cf499=_0x2cf499-0x0;var _0x33c3cc=_0x2fed[_0x2cf499];return _0x33c3cc;};'use strict';var _=require(_0xd2fe('0x0'));var md5=require(_0xd2fe('0x1'));var util=require(_0xd2fe('0x2'));var Redis=require(_0xd2fe('0x3'));var config=require(_0xd2fe('0x4'));config['redis']=_[_0xd2fe('0x5')](config[_0xd2fe('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2fe('0x6')]));function SmsQueue(_0x24ba90){this['id']=_0x24ba90['id']||0x0;this[_0xd2fe('0x7')]=_0x24ba90['name']||'';this[_0xd2fe('0x8')]=_0x24ba90[_0xd2fe('0x8')]||0xa;this[_0xd2fe('0x9')]=_0x24ba90[_0xd2fe('0x9')]||'beepall';this[_0xd2fe('0xa')]=_0x24ba90[_0xd2fe('0xa')];this[_0xd2fe('0xb')]={};this[_0xd2fe('0xc')]=0x0;this[_0xd2fe('0x1')]='';this[_0xd2fe('0xd')]();this[_0xd2fe('0xe')]();}SmsQueue[_0xd2fe('0xf')][_0xd2fe('0xd')]=function(){var _0x13c68f=this[_0xd2fe('0xb')][_0xd2fe('0x10')];this[_0xd2fe('0xb')]=_[_0xd2fe('0x11')](this[_0xd2fe('0xa')],'id');this[_0xd2fe('0xb')][_0xd2fe('0x10')]=_0x13c68f;};SmsQueue[_0xd2fe('0xf')]['updateRealtime']=function(){this[_0xd2fe('0x12')]=0x0;this[_0xd2fe('0x13')]=0x0;for(var _0x2a9355=0x0;_0x2a9355=0x0?this[_0xd2fe('0x16')]:0x0;var _0x40162f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd2fe('0x12')],'name':this[_0xd2fe('0x7')],'paused':this[_0xd2fe('0x13')],'waiting':this[_0xd2fe('0xc')]};var _0x34c324=md5(JSON[_0xd2fe('0x17')](_0x40162f));if(this[_0xd2fe('0x1')]!==_0x34c324){this[_0xd2fe('0x1')]=_0x34c324;io['to'](util[_0xd2fe('0x18')](_0xd2fe('0x19'),_0x40162f['name']))[_0xd2fe('0x1a')]('sms_queue:save',_0x40162f);}};module[_0xd2fe('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ca4b188..e29fb72 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 _0xd38b=['length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','beepall','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused'];(function(_0x41352a,_0x246ea2){var _0x3e392f=function(_0x11a5a6){while(--_0x11a5a6){_0x41352a['push'](_0x41352a['shift']());}};_0x3e392f(++_0x246ea2);}(_0xd38b,0x168));var _0xbd38=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xd38b[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require('lodash');var md5=require(_0xbd38('0x0'));var util=require(_0xbd38('0x1'));var Redis=require(_0xbd38('0x2'));var config=require(_0xbd38('0x3'));config['redis']=_[_0xbd38('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd38('0x5')]));function WhatsappQueue(_0x118756){this['id']=_0x118756['id']||0x0;this[_0xbd38('0x6')]=_0x118756[_0xbd38('0x6')]||'';this['timeout']=_0x118756[_0xbd38('0x7')]||0xa;this['strategy']=_0x118756['strategy']||_0xbd38('0x8');this[_0xbd38('0x9')]=_0x118756[_0xbd38('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbd38('0x0')]='';this[_0xbd38('0xa')]();this[_0xbd38('0xb')]();}WhatsappQueue[_0xbd38('0xc')]['updateRouting']=function(){var _0x20b340=this['mapAgentsId'][_0xbd38('0xd')];this[_0xbd38('0xe')]=_[_0xbd38('0xf')](this[_0xbd38('0x9')],'id');this[_0xbd38('0xe')][_0xbd38('0xd')]=_0x20b340;};WhatsappQueue[_0xbd38('0xc')]['updateRealtime']=function(){this[_0xbd38('0x10')]=0x0;this[_0xbd38('0x11')]=0x0;for(var _0x200acd=0x0;_0x200acd=0x0?this['available']:0x0;var _0x4492e8={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbd38('0x10')],'name':this['name'],'paused':this[_0xbd38('0x11')],'waiting':this['waiting']};var _0x267c93=md5(JSON[_0xbd38('0x16')](_0x4492e8));if(this[_0xbd38('0x0')]!==_0x267c93){this[_0xbd38('0x0')]=_0x267c93;io['to'](util[_0xbd38('0x17')](_0xbd38('0x18'),_0x4492e8[_0xbd38('0x6')]))[_0xbd38('0x19')]('whatsapp_queue:save',_0x4492e8);}};module[_0xbd38('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x9244=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','Agents','length','online','whatsappPause','paused','available','md5','format','emit','whatsapp_queue:save','exports','lodash'];(function(_0xa99c34,_0x539cb9){var _0x147cdd=function(_0x3d0e78){while(--_0x3d0e78){_0xa99c34['push'](_0xa99c34['shift']());}};_0x147cdd(++_0x539cb9);}(_0x9244,0x8b));var _0x4924=function(_0x47864b,_0x5d32e6){_0x47864b=_0x47864b-0x0;var _0x3a1b97=_0x9244[_0x47864b];return _0x3a1b97;};'use strict';var _=require(_0x4924('0x0'));var md5=require('md5');var util=require(_0x4924('0x1'));var Redis=require(_0x4924('0x2'));var config=require(_0x4924('0x3'));config[_0x4924('0x4')]=_['defaults'](config['redis'],{'host':_0x4924('0x5'),'port':0x18eb});var io=require(_0x4924('0x6'))(new Redis(config[_0x4924('0x4')]));function WhatsappQueue(_0xfe166f){this['id']=_0xfe166f['id']||0x0;this['name']=_0xfe166f[_0x4924('0x7')]||'';this[_0x4924('0x8')]=_0xfe166f[_0x4924('0x8')]||0xa;this['strategy']=_0xfe166f['strategy']||'beepall';this['Agents']=_0xfe166f['Agents'];this['mapAgentsId']={};this[_0x4924('0x9')]=0x0;this['md5']='';this[_0x4924('0xa')]();this['updateRealtime']();}WhatsappQueue[_0x4924('0xb')][_0x4924('0xa')]=function(){var _0x488a78=this[_0x4924('0xc')]['_rr'];this[_0x4924('0xc')]=_[_0x4924('0xd')](this['Agents'],'id');this[_0x4924('0xc')][_0x4924('0xe')]=_0x488a78;};WhatsappQueue[_0x4924('0xb')][_0x4924('0xf')]=function(){this[_0x4924('0x10')]=0x0;this['paused']=0x0;for(var _0x15c61f=0x0;_0x15c61f=0x0?this['available']:0x0;var _0x138f60={'id':this['id'],'available':this[_0x4924('0x16')],'loggedIn':this[_0x4924('0x10')],'name':this[_0x4924('0x7')],'paused':this['paused'],'waiting':this[_0x4924('0x9')]};var _0x5e01fe=md5(JSON['stringify'](_0x138f60));if(this[_0x4924('0x17')]!==_0x5e01fe){this[_0x4924('0x17')]=_0x5e01fe;io['to'](util[_0x4924('0x18')]('whatsapp:queue:%s',_0x138f60[_0x4924('0x7')]))[_0x4924('0x19')](_0x4924('0x1a'),_0x138f60);}};module[_0x4924('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d6e76ae..8ccf3fb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 02c4515..12f9c08 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 _0xfa5e=['update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0xfe93a7,_0x1068a0){var _0x31fc60=function(_0x3269a5){while(--_0x3269a5){_0xfe93a7['push'](_0xfe93a7['shift']());}};_0x31fc60(++_0x1068a0);}(_0xfa5e,0xf4));var _0xefa5=function(_0x4a296b,_0x37bec4){_0x4a296b=_0x4a296b-0x0;var _0x2c558e=_0xfa5e[_0x4a296b];return _0x2c558e;};'use strict';var client=require(_0xefa5('0x0'));exports[_0xefa5('0x1')]=function(_0x4e48f3,_0x45e1dd){return client[_0xefa5('0x2')]('UpdateChatInteraction',{'body':_0x45e1dd,'options':{'where':{'id':_0x4e48f3}},'log':_0xefa5('0x3')});};exports[_0xefa5('0x4')]=function(_0x21c213,_0xfa8c5d){return client[_0xefa5('0x2')](_0xefa5('0x5'),{'body':_0xfa8c5d,'options':{'where':{'id':_0x21c213}},'log':_0xefa5('0x6')});}; \ No newline at end of file +var _0xfb71=['update','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x46879b,_0x2cc1b9){var _0x61b285=function(_0x591ad9){while(--_0x591ad9){_0x46879b['push'](_0x46879b['shift']());}};_0x61b285(++_0x2cc1b9);}(_0xfb71,0x15d));var _0x1fb7=function(_0x9db041,_0x25821e){_0x9db041=_0x9db041-0x0;var _0x28c133=_0xfb71[_0x9db041];return _0x28c133;};'use strict';var client=require(_0x1fb7('0x0'));exports[_0x1fb7('0x1')]=function(_0x55c782,_0x3d74e8){return client[_0x1fb7('0x2')]('UpdateChatInteraction',{'body':_0x3d74e8,'options':{'where':{'id':_0x55c782}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x5324f1,_0x3d5b98){return client[_0x1fb7('0x2')](_0x1fb7('0x3'),{'body':_0x3d5b98,'options':{'where':{'id':_0x5324f1}},'log':_0x1fb7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 53a5d3c..068dd25 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 _0x5cbb=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x53a09c,_0xab5f55){var _0x11cd31=function(_0x15bcc9){while(--_0x15bcc9){_0x53a09c['push'](_0x53a09c['shift']());}};_0x11cd31(++_0xab5f55);}(_0x5cbb,0xb1));var _0xb5cb=function(_0x487991,_0x3a4ac0){_0x487991=_0x487991-0x0;var _0x439fac=_0x5cbb[_0x487991];return _0x439fac;};'use strict';var client=require(_0xb5cb('0x0'));exports[_0xb5cb('0x1')]=function(_0x296814){return client[_0xb5cb('0x2')](_0xb5cb('0x3'),{'body':_0x296814,'log':_0xb5cb('0x4')});}; \ No newline at end of file +var _0x9dc9=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x9dc9,0x9c));var _0x99dc=function(_0x32858c,_0x2cb6c2){_0x32858c=_0x32858c-0x0;var _0x109883=_0x9dc9[_0x32858c];return _0x109883;};'use strict';var client=require(_0x99dc('0x0'));exports[_0x99dc('0x1')]=function(_0x249784){return client[_0x99dc('0x2')](_0x99dc('0x3'),{'body':_0x249784,'log':_0x99dc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 12311c0..47101ae 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 _0x8a28=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0x8a28,0xfd));var _0x88a2=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x8a28[_0xea8947];return _0x2455e9;};'use strict';var client=require(_0x88a2('0x0'));exports[_0x88a2('0x1')]=function(){return function(){return client[_0x88a2('0x2')](_0x88a2('0x3'),{'options':{'raw':![],'attributes':['id',_0x88a2('0x4'),_0x88a2('0x5'),_0x88a2('0x6')],'include':[{'model':_0x88a2('0x7'),'as':'Agents','attributes':['id',_0x88a2('0x4'),_0x88a2('0x8'),_0x88a2('0x9')]}]},'log':_0x88a2('0x1')});};}; \ No newline at end of file +var _0x80ce=['GetChatQueue','name','strategy','User','Agents','getChatQueues'];(function(_0x20508d,_0x29e57f){var _0x278bb8=function(_0x5955cd){while(--_0x5955cd){_0x20508d['push'](_0x20508d['shift']());}};_0x278bb8(++_0x29e57f);}(_0x80ce,0xae));var _0xe80c=function(_0x2114be,_0x4b26cd){_0x2114be=_0x2114be-0x0;var _0x22c0f6=_0x80ce[_0x2114be];return _0x22c0f6;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0xe80c('0x0'),{'options':{'raw':![],'attributes':['id',_0xe80c('0x1'),'timeout',_0xe80c('0x2')],'include':[{'model':_0xe80c('0x3'),'as':_0xe80c('0x4'),'attributes':['id','name','online','chatPause']}]},'log':_0xe80c('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ce6cb46..e732993 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 _0x35aa=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x96be88,_0x2c01a4){var _0x1c14c0=function(_0x20aeff){while(--_0x20aeff){_0x96be88['push'](_0x96be88['shift']());}};_0x1c14c0(++_0x2c01a4);}(_0x35aa,0xbe));var _0xa35a=function(_0x2edd87,_0x4b49e8){_0x2edd87=_0x2edd87-0x0;var _0x2ad924=_0x35aa[_0x2edd87];return _0x2ad924;};'use strict';var client=require('../client');exports[_0xa35a('0x0')]=function(_0x2d2970){return client[_0xa35a('0x1')](_0xa35a('0x2'),{'body':_0x2d2970,'log':'CreateChatQueueReport'});};exports[_0xa35a('0x3')]=function(_0x4303b4,_0x24cc2){return client[_0xa35a('0x1')](_0xa35a('0x4'),{'body':_0x24cc2,'options':{'where':{'uniqueid':_0x4303b4},'order':[['id',_0xa35a('0x5')]],'limit':0x1},'log':_0xa35a('0x4')});}; \ No newline at end of file +var _0x8696=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update','DESC'];(function(_0x20664d,_0x2e835e){var _0x26cff2=function(_0x52d185){while(--_0x52d185){_0x20664d['push'](_0x20664d['shift']());}};_0x26cff2(++_0x2e835e);}(_0x8696,0x143));var _0x6869=function(_0x13b97c,_0x1a8f4d){_0x13b97c=_0x13b97c-0x0;var _0x2f2201=_0x8696[_0x13b97c];return _0x2f2201;};'use strict';var client=require(_0x6869('0x0'));exports[_0x6869('0x1')]=function(_0x55d9c2){return client[_0x6869('0x2')]('CreateChatQueueReport',{'body':_0x55d9c2,'log':_0x6869('0x3')});};exports[_0x6869('0x4')]=function(_0x350474,_0x4dadb5){return client[_0x6869('0x2')]('UpdateChatQueueReport',{'body':_0x4dadb5,'options':{'where':{'uniqueid':_0x350474},'order':[['id',_0x6869('0x5')]],'limit':0x1},'log':_0x6869('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 493aa8b..481b14c 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x471f1a,_0x18415d){var _0x72566b=function(_0x110643){while(--_0x110643){_0x471f1a['push'](_0x471f1a['shift']());}};_0x72566b(++_0x18415d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2f7c40,_0xb36203){var _0x57a4a5=function(_0x47db35){while(--_0x47db35){_0x2f7c40['push'](_0x2f7c40['shift']());}};_0x57a4a5(++_0xb36203);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 54f226d..dce626f 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 _0x8f07=['Request','createFaxMessage','../client','create'];(function(_0x26b3be,_0x71dc78){var _0x12379e=function(_0x299236){while(--_0x299236){_0x26b3be['push'](_0x26b3be['shift']());}};_0x12379e(++_0x71dc78);}(_0x8f07,0x1d2));var _0x78f0=function(_0x22fffa,_0x2f852b){_0x22fffa=_0x22fffa-0x0;var _0x43dd64=_0x8f07[_0x22fffa];return _0x43dd64;};'use strict';var client=require(_0x78f0('0x0'));exports[_0x78f0('0x1')]=function(_0x1cf7ba){return client[_0x78f0('0x2')]('CreateFaxMessage',{'body':_0x1cf7ba,'log':_0x78f0('0x3')});}; \ No newline at end of file +var _0x3e2e=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e2e,0xb0));var _0xe3e2=function(_0x5c430e,_0x7b5ab1){_0x5c430e=_0x5c430e-0x0;var _0x46d8c5=_0x3e2e[_0x5c430e];return _0x46d8c5;};'use strict';var client=require(_0xe3e2('0x0'));exports[_0xe3e2('0x1')]=function(_0xfcd00f){return client[_0xe3e2('0x2')](_0xe3e2('0x3'),{'body':_0xfcd00f,'log':_0xe3e2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 32cecf2..4b448e7 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 _0x99e1=['Request','GetFaxQueue','name','strategy','User','getFaxQueues','../client'];(function(_0x273690,_0x244367){var _0x174e38=function(_0x2e8d79){while(--_0x2e8d79){_0x273690['push'](_0x273690['shift']());}};_0x174e38(++_0x244367);}(_0x99e1,0xb5));var _0x199e=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x99e1[_0x1e1965];return _0x1a2e96;};'use strict';var client=require(_0x199e('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x199e('0x1')](_0x199e('0x2'),{'options':{'raw':![],'attributes':['id',_0x199e('0x3'),'timeout',_0x199e('0x4')],'include':[{'model':_0x199e('0x5'),'as':'Agents','attributes':['id',_0x199e('0x3'),'online','faxPause']}]},'log':_0x199e('0x6')});};}; \ No newline at end of file +var _0xfb23=['Request','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues'];(function(_0xda2495,_0x2fc0a4){var _0x591128=function(_0x3d02f4){while(--_0x3d02f4){_0xda2495['push'](_0xda2495['shift']());}};_0x591128(++_0x2fc0a4);}(_0xfb23,0x186));var _0x3fb2=function(_0xce6b72,_0xa183e3){_0xce6b72=_0xce6b72-0x0;var _0x563dd6=_0xfb23[_0xce6b72];return _0x563dd6;};'use strict';var client=require(_0x3fb2('0x0'));exports[_0x3fb2('0x1')]=function(){return function(){return client[_0x3fb2('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x3fb2('0x3'),_0x3fb2('0x4')],'include':[{'model':'User','as':_0x3fb2('0x5'),'attributes':['id','name',_0x3fb2('0x6'),_0x3fb2('0x7')]}]},'log':_0x3fb2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b171ae8..f7ae7e1 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 _0xc7d3=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xc7d3,0x8f));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x3c7d('0x0'));exports['create']=function(_0x151ed5){return client[_0x3c7d('0x1')](_0x3c7d('0x2'),{'body':_0x151ed5,'log':_0x3c7d('0x2')});};exports[_0x3c7d('0x3')]=function(_0x702d,_0x474a41){return client['Request'](_0x3c7d('0x4'),{'body':_0x474a41,'options':{'where':{'uniqueid':_0x702d},'order':[['id',_0x3c7d('0x5')]],'limit':0x1},'log':_0x3c7d('0x4')});}; \ No newline at end of file +var _0xe0bc=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0xd7d11e,_0x2073f2){var _0x4ed223=function(_0x4ab797){while(--_0x4ab797){_0xd7d11e['push'](_0xd7d11e['shift']());}};_0x4ed223(++_0x2073f2);}(_0xe0bc,0x1a1));var _0xce0b=function(_0x44c015,_0xd629c){_0x44c015=_0x44c015-0x0;var _0x30d452=_0xe0bc[_0x44c015];return _0x30d452;};'use strict';var client=require(_0xce0b('0x0'));exports[_0xce0b('0x1')]=function(_0x4919d8){return client[_0xce0b('0x2')](_0xce0b('0x3'),{'body':_0x4919d8,'log':_0xce0b('0x3')});};exports[_0xce0b('0x4')]=function(_0x334ceb,_0x377c4e){return client[_0xce0b('0x2')](_0xce0b('0x5'),{'body':_0x377c4e,'options':{'where':{'uniqueid':_0x334ceb},'order':[['id',_0xce0b('0x6')]],'limit':0x1},'log':_0xce0b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 04f9f07..6060ba9 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 _0xa54f=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x8a771e,_0x3176fe){var _0x1e9325=function(_0x27ccd1){while(--_0x27ccd1){_0x8a771e['push'](_0x8a771e['shift']());}};_0x1e9325(++_0x3176fe);}(_0xa54f,0x198));var _0xfa54=function(_0x3ddb19,_0x45928b){_0x3ddb19=_0x3ddb19-0x0;var _0x4929f6=_0xa54f[_0x3ddb19];return _0x4929f6;};'use strict';var client=require('../client');exports[_0xfa54('0x0')]=function(){return function(){return client[_0xfa54('0x1')](_0xfa54('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfa54('0x3')],'include':[{'model':_0xfa54('0x4'),'as':_0xfa54('0x5'),'attributes':['id','name',_0xfa54('0x6')]}]},'log':_0xfa54('0x0')});};}; \ No newline at end of file +var _0xb737=['GetInterval','name','interval','../client','getIntervals','Request'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0xb737,0x12f));var _0x7b73=function(_0x7d3039,_0x63151b){_0x7d3039=_0x7d3039-0x0;var _0x24031e=_0xb737[_0x7d3039];return _0x24031e;};'use strict';var client=require(_0x7b73('0x0'));exports[_0x7b73('0x1')]=function(){return function(){return client[_0x7b73('0x2')](_0x7b73('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7b73('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x7b73('0x4'),_0x7b73('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b31eecf..9151dfa 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 _0x7096=['AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file +var _0x7708=['update','AddTagsToMailInteraction','../client'];(function(_0x2264d8,_0x510b2b){var _0x315069=function(_0x45033e){while(--_0x45033e){_0x2264d8['push'](_0x2264d8['shift']());}};_0x315069(++_0x510b2b);}(_0x7708,0x188));var _0x8770=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7708[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(_0x5ce108,_0x141ddf){return client['Request']('UpdateMailInteraction',{'body':_0x141ddf,'options':{'where':{'id':_0x5ce108}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x182d52,_0x1a796d){return client['Request'](_0x8770('0x2'),{'body':_0x1a796d,'options':{'where':{'id':_0x182d52}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fa44e27..5a4d0bd 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 _0xf883=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x5bf271,_0x475f64){var _0x584956=function(_0x283f28){while(--_0x283f28){_0x5bf271['push'](_0x5bf271['shift']());}};_0x584956(++_0x475f64);}(_0xf883,0xcd));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x3f88('0x0')]=function(_0x444460){return client[_0x3f88('0x1')](_0x3f88('0x2'),{'body':_0x444460,'log':_0x3f88('0x3')});}; \ No newline at end of file +var _0xb4d2=['Request','CreateMailMessage','../client','create'];(function(_0x410add,_0x625706){var _0xa7a4ec=function(_0x18a535){while(--_0x18a535){_0x410add['push'](_0x410add['shift']());}};_0xa7a4ec(++_0x625706);}(_0xb4d2,0x1e6));var _0x2b4d=function(_0x46063d,_0x3239ec){_0x46063d=_0x46063d-0x0;var _0x4fff0c=_0xb4d2[_0x46063d];return _0x4fff0c;};'use strict';var client=require(_0x2b4d('0x0'));exports[_0x2b4d('0x1')]=function(_0x49ee7f){return client[_0x2b4d('0x2')](_0x2b4d('0x3'),{'body':_0x49ee7f,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c7eb8a1..f24aab0 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 _0xf8aa=['User','Agents','name','online','../client','getMailQueues','Request','GetMailQueue','timeout','strategy'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf8aa,0x126));var _0xaf8a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf8aa[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0xaf8a('0x0'));exports[_0xaf8a('0x1')]=function(){return function(){return client[_0xaf8a('0x2')](_0xaf8a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xaf8a('0x4'),_0xaf8a('0x5')],'include':[{'model':_0xaf8a('0x6'),'as':_0xaf8a('0x7'),'attributes':['id',_0xaf8a('0x8'),_0xaf8a('0x9'),'mailPause']}]},'log':_0xaf8a('0x1')});};}; \ No newline at end of file +var _0x9fe4=['online','mailPause','getMailQueues','name','timeout','Agents'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x9fe4,0x164));var _0x49fe=function(_0xff7f46,_0x626af7){_0xff7f46=_0xff7f46-0x0;var _0x10edac=_0x9fe4[_0xff7f46];return _0x10edac;};'use strict';var client=require('../client');exports[_0x49fe('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x49fe('0x1'),_0x49fe('0x2'),'strategy'],'include':[{'model':'User','as':_0x49fe('0x3'),'attributes':['id','name',_0x49fe('0x4'),_0x49fe('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 89acd30..11cec4e 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 _0xc4c4=['update','UpdateMailQueueReport','../client','CreateMailQueueReport'];(function(_0x462300,_0x3100ea){var _0x1afdc8=function(_0x1b80fc){while(--_0x1b80fc){_0x462300['push'](_0x462300['shift']());}};_0x1afdc8(++_0x3100ea);}(_0xc4c4,0x15a));var _0x4c4c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc4c4[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x4c4c('0x0'));exports['create']=function(_0x410e40){return client['Request']('CreateMailQueueReport',{'body':_0x410e40,'log':_0x4c4c('0x1')});};exports[_0x4c4c('0x2')]=function(_0x11f2af,_0x36080a){return client['Request'](_0x4c4c('0x3'),{'body':_0x36080a,'options':{'where':{'uniqueid':_0x11f2af},'order':[['id','DESC']],'limit':0x1},'log':_0x4c4c('0x3')});}; \ No newline at end of file +var _0xcb92=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport'];(function(_0x3148b6,_0x3ead64){var _0x247af0=function(_0x12f528){while(--_0x12f528){_0x3148b6['push'](_0x3148b6['shift']());}};_0x247af0(++_0x3ead64);}(_0xcb92,0x1c2));var _0x2cb9=function(_0x2a8426,_0x2ea1ac){_0x2a8426=_0x2a8426-0x0;var _0x56496c=_0xcb92[_0x2a8426];return _0x56496c;};'use strict';var client=require('../client');exports['create']=function(_0x592935){return client[_0x2cb9('0x0')]('CreateMailQueueReport',{'body':_0x592935,'log':_0x2cb9('0x1')});};exports['update']=function(_0x35ea43,_0x1dada8){return client[_0x2cb9('0x0')](_0x2cb9('0x2'),{'body':_0x1dada8,'options':{'where':{'uniqueid':_0x35ea43},'order':[['id',_0x2cb9('0x3')]],'limit':0x1},'log':_0x2cb9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e9f59cb..09bc7a0 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 _0x5a69=['../client','update','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x5a69,0x1c0));var _0x95a6=function(_0x2a68e2,_0x487bd1){_0x2a68e2=_0x2a68e2-0x0;var _0x22201f=_0x5a69[_0x2a68e2];return _0x22201f;};'use strict';var client=require(_0x95a6('0x0'));exports[_0x95a6('0x1')]=function(_0x53bd89,_0x2ac29b){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x2ac29b,'options':{'where':{'id':_0x53bd89}},'log':_0x95a6('0x2')});};exports[_0x95a6('0x3')]=function(_0x518a7c,_0x4a4442){return client[_0x95a6('0x4')](_0x95a6('0x5'),{'body':_0x4a4442,'options':{'where':{'id':_0x518a7c}},'log':_0x95a6('0x6')});}; \ No newline at end of file +var _0x38d0=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x5f15a3,_0x504b4b){var _0x3afa59=function(_0x21d4ed){while(--_0x21d4ed){_0x5f15a3['push'](_0x5f15a3['shift']());}};_0x3afa59(++_0x504b4b);}(_0x38d0,0xc0));var _0x038d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x38d0[_0xaa1b3e];return _0x454d7d;};'use strict';var client=require(_0x038d('0x0'));exports[_0x038d('0x1')]=function(_0x122238,_0x3c2508){return client[_0x038d('0x2')](_0x038d('0x3'),{'body':_0x3c2508,'options':{'where':{'id':_0x122238}},'log':_0x038d('0x4')});};exports[_0x038d('0x5')]=function(_0x28dc4c,_0x52a803){return client[_0x038d('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x52a803,'options':{'where':{'id':_0x28dc4c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 320189c..3a1ac99 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 _0xf934=['create','Request','createOpenchannelMessage'];(function(_0x363f10,_0x35cbee){var _0x2cdf7b=function(_0x1e5648){while(--_0x1e5648){_0x363f10['push'](_0x363f10['shift']());}};_0x2cdf7b(++_0x35cbee);}(_0xf934,0xc0));var _0x4f93=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xf934[_0x3fba9f];return _0x192cf1;};'use strict';var client=require('../client');exports[_0x4f93('0x0')]=function(_0x476940){return client[_0x4f93('0x1')]('CreateOpenchannelMessage',{'body':_0x476940,'log':_0x4f93('0x2')});}; \ No newline at end of file +var _0xdfcc=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x11db48,_0x363415){var _0x2cc224=function(_0x3ea173){while(--_0x3ea173){_0x11db48['push'](_0x11db48['shift']());}};_0x2cc224(++_0x363415);}(_0xdfcc,0x130));var _0xcdfc=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0xdfcc[_0x412c8f];return _0x27c005;};'use strict';var client=require(_0xcdfc('0x0'));exports[_0xcdfc('0x1')]=function(_0x2faae9){return client[_0xcdfc('0x2')](_0xcdfc('0x3'),{'body':_0x2faae9,'log':_0xcdfc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2664ff4..549e1fe 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 _0xacae=['name','timeout','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x780e4e,_0x260bfa){var _0x5da6cd=function(_0x26ca0b){while(--_0x26ca0b){_0x780e4e['push'](_0x780e4e['shift']());}};_0x5da6cd(++_0x260bfa);}(_0xacae,0x67));var _0xeaca=function(_0x51fc87,_0x46b97b){_0x51fc87=_0x51fc87-0x0;var _0x18f359=_0xacae[_0x51fc87];return _0x18f359;};'use strict';var client=require(_0xeaca('0x0'));exports[_0xeaca('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xeaca('0x2'),_0xeaca('0x3'),'strategy'],'include':[{'model':_0xeaca('0x4'),'as':_0xeaca('0x5'),'attributes':['id','name','online',_0xeaca('0x6')]}]},'log':_0xeaca('0x1')});};}; \ No newline at end of file +var _0xc31f=['timeout','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x48cc05,_0x99c831){var _0x5aa91f=function(_0x64b452){while(--_0x64b452){_0x48cc05['push'](_0x48cc05['shift']());}};_0x5aa91f(++_0x99c831);}(_0xc31f,0x146));var _0xfc31=function(_0x3eb760,_0x5d2c18){_0x3eb760=_0x3eb760-0x0;var _0x1b0e0a=_0xc31f[_0x3eb760];return _0x1b0e0a;};'use strict';var client=require(_0xfc31('0x0'));exports[_0xfc31('0x1')]=function(){return function(){return client[_0xfc31('0x2')](_0xfc31('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfc31('0x4'),'strategy'],'include':[{'model':_0xfc31('0x5'),'as':_0xfc31('0x6'),'attributes':['id',_0xfc31('0x7'),_0xfc31('0x8'),_0xfc31('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7479cc7..62d0ee1 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 _0x52f1=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x52f1,0xb7));var _0x152f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52f1[_0x3947c9];return _0x2e7871;};'use strict';var client=require('../client');exports['create']=function(_0x55b3cc){return client[_0x152f('0x0')](_0x152f('0x1'),{'body':_0x55b3cc,'log':_0x152f('0x1')});};exports['update']=function(_0x47c051,_0x237cb3){return client['Request'](_0x152f('0x2'),{'body':_0x237cb3,'options':{'where':{'uniqueid':_0x47c051},'order':[['id',_0x152f('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xceab=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','Request'];(function(_0x45330c,_0xb37d05){var _0x26e823=function(_0xc1ac7e){while(--_0xc1ac7e){_0x45330c['push'](_0x45330c['shift']());}};_0x26e823(++_0xb37d05);}(_0xceab,0x106));var _0xbcea=function(_0x3c067e,_0x2270b1){_0x3c067e=_0x3c067e-0x0;var _0x57d340=_0xceab[_0x3c067e];return _0x57d340;};'use strict';var client=require(_0xbcea('0x0'));exports['create']=function(_0x7cd40){return client[_0xbcea('0x1')]('CreateOpenchannelQueueReport',{'body':_0x7cd40,'log':_0xbcea('0x2')});};exports[_0xbcea('0x3')]=function(_0x5cecf2,_0xd4daa4){return client[_0xbcea('0x1')]('UpdateOpenchannelQueueReport',{'body':_0xd4daa4,'options':{'where':{'uniqueid':_0x5cecf2},'order':[['id',_0xbcea('0x4')]],'limit':0x1},'log':_0xbcea('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ab33f41..9aec0a0 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 _0xdb94=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x3142b3,_0x147de6){var _0x340393=function(_0x457645){while(--_0x457645){_0x3142b3['push'](_0x3142b3['shift']());}};_0x340393(++_0x147de6);}(_0xdb94,0xe5));var _0x4db9=function(_0x8ca07a,_0x4519ee){_0x8ca07a=_0x8ca07a-0x0;var _0x2efabb=_0xdb94[_0x8ca07a];return _0x2efabb;};'use strict';var client=require('../client');exports[_0x4db9('0x0')]=function(_0x1aa3d0,_0x5edca0){return client[_0x4db9('0x1')](_0x4db9('0x2'),{'body':_0x5edca0,'options':{'where':{'id':_0x1aa3d0}},'log':_0x4db9('0x3')});};exports[_0x4db9('0x4')]=function(_0x1f05d4,_0x592097){return client[_0x4db9('0x1')]('AddTagsToSmsInteraction',{'body':_0x592097,'options':{'where':{'id':_0x1f05d4}},'log':_0x4db9('0x5')});}; \ No newline at end of file +var _0x4491=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x4d6e96,_0x25dc9d){var _0x4d17dd=function(_0x3cec1f){while(--_0x3cec1f){_0x4d6e96['push'](_0x4d6e96['shift']());}};_0x4d17dd(++_0x25dc9d);}(_0x4491,0x1bb));var _0x1449=function(_0x1f7bc7,_0x5a662d){_0x1f7bc7=_0x1f7bc7-0x0;var _0x165214=_0x4491[_0x1f7bc7];return _0x165214;};'use strict';var client=require(_0x1449('0x0'));exports['update']=function(_0x4257f6,_0x47cccd){return client[_0x1449('0x1')](_0x1449('0x2'),{'body':_0x47cccd,'options':{'where':{'id':_0x4257f6}},'log':_0x1449('0x3')});};exports[_0x1449('0x4')]=function(_0x1ff47f,_0x1b2870){return client['Request'](_0x1449('0x5'),{'body':_0x1b2870,'options':{'where':{'id':_0x1ff47f}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 527f3db..4b63c39 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 _0x18df=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0xc665da,_0x3dfb1e){var _0x1fccde=function(_0x36279a){while(--_0x36279a){_0xc665da['push'](_0xc665da['shift']());}};_0x1fccde(++_0x3dfb1e);}(_0x18df,0x108));var _0xf18d=function(_0x4c7bc7,_0x6e8304){_0x4c7bc7=_0x4c7bc7-0x0;var _0x41b761=_0x18df[_0x4c7bc7];return _0x41b761;};'use strict';var client=require('../client');exports[_0xf18d('0x0')]=function(_0x47574b){return client[_0xf18d('0x1')](_0xf18d('0x2'),{'body':_0x47574b,'log':_0xf18d('0x3')});}; \ No newline at end of file +var _0xa37d=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x47f910,_0x137198){var _0x5b8135=function(_0x5cb321){while(--_0x5cb321){_0x47f910['push'](_0x47f910['shift']());}};_0x5b8135(++_0x137198);}(_0xa37d,0x158));var _0xda37=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xa37d[_0x5275b8];return _0x568a9b;};'use strict';var client=require('../client');exports[_0xda37('0x0')]=function(_0x4f56a0){return client[_0xda37('0x1')](_0xda37('0x2'),{'body':_0x4f56a0,'log':_0xda37('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 161124c..52d0294 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x7f2c68,_0x43bb01){var _0x592624=function(_0x4ed246){while(--_0x4ed246){_0x7f2c68['push'](_0x7f2c68['shift']());}};_0x592624(++_0x43bb01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x500041,_0x544746){var _0x302a21=function(_0x2f15cd){while(--_0x2f15cd){_0x500041['push'](_0x500041['shift']());}};_0x302a21(++_0x544746);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xcb91[_0x2f3794];return _0x1c9fbe;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 09d7e7a..1fdd4aa 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xedd9,0xfc));var _0x9edd=function(_0x14e3cf,_0xe5e4cc){_0x14e3cf=_0x14e3cf-0x0;var _0x4840ab=_0xedd9[_0x14e3cf];return _0x4840ab;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x59ad9d,_0x2e7e78){var _0x569738=function(_0x244ffe){while(--_0x244ffe){_0x59ad9d['push'](_0x59ad9d['shift']());}};_0x569738(++_0x2e7e78);}(_0x34e8,0x12c));var _0x834e=function(_0x37bbc2,_0x554a79){_0x37bbc2=_0x37bbc2-0x0;var _0x95a7a3=_0x34e8[_0x37bbc2];return _0x95a7a3;};'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 fa57dd6..473ce1b 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(_0x510dba,_0x41f48c){var _0x5e5553=function(_0x4e4a68){while(--_0x4e4a68){_0x510dba['push'](_0x510dba['shift']());}};_0x5e5553(++_0x41f48c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x179dd4,_0x14bcf4){var _0x594de6=function(_0x28be12){while(--_0x28be12){_0x179dd4['push'](_0x179dd4['shift']());}};_0x594de6(++_0x14bcf4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 6166bae..7518164 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 _0x5f6f=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x51d907,_0x56b7ba){var _0x50c886=function(_0x10107f){while(--_0x10107f){_0x51d907['push'](_0x51d907['shift']());}};_0x50c886(++_0x56b7ba);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x2fb28c,_0x458fc5){_0x2fb28c=_0x2fb28c-0x0;var _0x22ee82=_0x5f6f[_0x2fb28c];return _0x22ee82;};'use strict';var client=require(_0xf5f6('0x0'));exports[_0xf5f6('0x1')]=function(_0x32a985,_0x475063){return client[_0xf5f6('0x2')]('UpdateWhatsappInteraction',{'body':_0x475063,'options':{'where':{'id':_0x32a985}},'log':_0xf5f6('0x3')});};exports[_0xf5f6('0x4')]=function(_0x2f2e00,_0x58028b){return client[_0xf5f6('0x2')](_0xf5f6('0x5'),{'body':_0x58028b,'options':{'where':{'id':_0x2f2e00}},'log':_0xf5f6('0x6')});}; \ No newline at end of file +var _0x1261=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','update'];(function(_0x1ea0da,_0x18596b){var _0x32bf80=function(_0x7e039f){while(--_0x7e039f){_0x1ea0da['push'](_0x1ea0da['shift']());}};_0x32bf80(++_0x18596b);}(_0x1261,0x144));var _0x1126=function(_0x1e9287,_0x37f584){_0x1e9287=_0x1e9287-0x0;var _0x44342e=_0x1261[_0x1e9287];return _0x44342e;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(_0x26c6a0,_0x3f6969){return client[_0x1126('0x1')](_0x1126('0x2'),{'body':_0x3f6969,'options':{'where':{'id':_0x26c6a0}},'log':_0x1126('0x3')});};exports[_0x1126('0x4')]=function(_0x4245ca,_0x21a480){return client[_0x1126('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x21a480,'options':{'where':{'id':_0x4245ca}},'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 db6e62f..94a0ac8 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 _0x6f1a=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x2e5e84,_0x40be3c){var _0x20d975=function(_0x382e0c){while(--_0x382e0c){_0x2e5e84['push'](_0x2e5e84['shift']());}};_0x20d975(++_0x40be3c);}(_0x6f1a,0x75));var _0xa6f1=function(_0x30438c,_0xbd6dc9){_0x30438c=_0x30438c-0x0;var _0x3de57a=_0x6f1a[_0x30438c];return _0x3de57a;};'use strict';var client=require('../client');exports[_0xa6f1('0x0')]=function(_0x3d928e){return client[_0xa6f1('0x1')](_0xa6f1('0x2'),{'body':_0x3d928e,'log':_0xa6f1('0x3')});}; \ No newline at end of file +var _0x61a8=['../client','create','Request','CreateWhatsappMessage'];(function(_0x28006d,_0x892ccd){var _0x25a2bc=function(_0x1e0de3){while(--_0x1e0de3){_0x28006d['push'](_0x28006d['shift']());}};_0x25a2bc(++_0x892ccd);}(_0x61a8,0x1e8));var _0x861a=function(_0x4a1327,_0x3642ab){_0x4a1327=_0x4a1327-0x0;var _0x2fcd03=_0x61a8[_0x4a1327];return _0x2fcd03;};'use strict';var client=require(_0x861a('0x0'));exports[_0x861a('0x1')]=function(_0x34c892){return client[_0x861a('0x2')](_0x861a('0x3'),{'body':_0x34c892,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1a48e9d..5c888a9 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 _0xbfa0=['../client','Request','strategy','User','Agents','getWhatsappQueues'];(function(_0x5d7e20,_0x4aab00){var _0x2d74ae=function(_0x17162b){while(--_0x17162b){_0x5d7e20['push'](_0x5d7e20['shift']());}};_0x2d74ae(++_0x4aab00);}(_0xbfa0,0xd8));var _0x0bfa=function(_0xd5c9f,_0x1d552a){_0xd5c9f=_0xd5c9f-0x0;var _0x3341e4=_0xbfa0[_0xd5c9f];return _0x3341e4;};'use strict';var client=require(_0x0bfa('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x0bfa('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x0bfa('0x2')],'include':[{'model':_0x0bfa('0x3'),'as':_0x0bfa('0x4'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x0bfa('0x5')});};}; \ No newline at end of file +var _0x161d=['online','getWhatsappQueues','name','timeout','strategy','User','Agents'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x161d,0x7f));var _0xd161=function(_0x3e31be,_0x51f3ae){_0x3e31be=_0x3e31be-0x0;var _0x130d15=_0x161d[_0x3e31be];return _0x130d15;};'use strict';var client=require('../client');exports[_0xd161('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd161('0x1'),_0xd161('0x2'),_0xd161('0x3')],'include':[{'model':_0xd161('0x4'),'as':_0xd161('0x5'),'attributes':['id',_0xd161('0x1'),_0xd161('0x6'),'whatsappPause']}]},'log':_0xd161('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d4fe082..24928cc 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 _0x5f21=['Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport'];(function(_0x4f02e0,_0x34e1f1){var _0x3f7fad=function(_0x40e6d8){while(--_0x40e6d8){_0x4f02e0['push'](_0x4f02e0['shift']());}};_0x3f7fad(++_0x34e1f1);}(_0x5f21,0x13e));var _0x15f2=function(_0x5de8bf,_0x24e115){_0x5de8bf=_0x5de8bf-0x0;var _0x2be3e3=_0x5f21[_0x5de8bf];return _0x2be3e3;};'use strict';var client=require(_0x15f2('0x0'));exports['create']=function(_0x33d2ac){return client['Request'](_0x15f2('0x1'),{'body':_0x33d2ac,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x11f238,_0x224d1a){return client[_0x15f2('0x2')](_0x15f2('0x3'),{'body':_0x224d1a,'options':{'where':{'uniqueid':_0x11f238},'order':[['id',_0x15f2('0x4')]],'limit':0x1},'log':_0x15f2('0x3')});}; \ No newline at end of file +var _0x1709=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x8a0dd1,_0x1e8102){var _0x4e464d=function(_0x34c5e2){while(--_0x34c5e2){_0x8a0dd1['push'](_0x8a0dd1['shift']());}};_0x4e464d(++_0x1e8102);}(_0x1709,0x199));var _0x9170=function(_0x83f529,_0x3d55d7){_0x83f529=_0x83f529-0x0;var _0x4383b8=_0x1709[_0x83f529];return _0x4383b8;};'use strict';var client=require(_0x9170('0x0'));exports[_0x9170('0x1')]=function(_0x3c2270){return client[_0x9170('0x2')](_0x9170('0x3'),{'body':_0x3c2270,'log':_0x9170('0x3')});};exports[_0x9170('0x4')]=function(_0x1a99d5,_0x3927b6){return client[_0x9170('0x2')](_0x9170('0x5'),{'body':_0x3927b6,'options':{'where':{'uniqueid':_0x1a99d5},'order':[['id',_0x9170('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e3df616..5d4309d 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 _0x7b9e=['find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','../../../../config/logger','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x51d0a2,_0x20068d){var _0x5b5503=function(_0x510bf6){while(--_0x510bf6){_0x51d0a2['push'](_0x51d0a2['shift']());}};_0x5b5503(++_0x20068d);}(_0x7b9e,0x122));var _0xe7b9=function(_0x584630,_0x5ba3e1){_0x584630=_0x584630-0x0;var _0x1abd97=_0x7b9e[_0x584630];return _0x1abd97;};'use strict';var schema=require(_0xe7b9('0x0'));var _=require(_0xe7b9('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xe7b9('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe7b9('0x3'),'message':_0xe7b9('0x4')}});function writeLog(_0x7d5ea6,_0x3f6f68,_0x26dee5){return logger['info'](util[_0xe7b9('0x5')](_0xe7b9('0x6'),_0x7d5ea6,_0x3f6f68['name'],_0x26dee5));}function handleFindAgent(_0x1915d4){return function(_0x4714a5){return _0x4714a5[_0xe7b9('0x7')][_0xe7b9('0x8')]()===_0x1915d4[_0xe7b9('0x8')]();};}exports[_0xe7b9('0x9')]=function(_0x1e2677,_0x1369c8,_0x1bff3a,_0x463e7c){return function(_0x3331bd){try{var _0x4a10d6={'name':_0x1369c8[0x0],'timeout':_0x1369c8[0x1]};var _0x3cdfa4=queue[_0xe7b9('0x0')](_0x4a10d6,{'typecast':!![]});if(_0x3cdfa4['length']){logger[_0xe7b9('0xa')](_0xe7b9('0xb'),_0x1e2677,_[_0xe7b9('0xc')](_0x3cdfa4,_0xe7b9('0xd'))[_0xe7b9('0xe')](',\x20'));_0x3331bd[_0xe7b9('0xf')]();}else{var _0x4d9c41=_[_0xe7b9('0x10')](_0x1bff3a[_0xe7b9('0x11')],handleFindAgent(_0x4a10d6[_0xe7b9('0x7')]));if(_0x4d9c41){var _0x1be22a=(_0x4a10d6[_0xe7b9('0x12')]||0xa)*0x3e8;var _0x5f056f,_0x129aea;var _0x614942=seqqueue['createQueue'](_0x1be22a);_0x614942['id']=_0x1e2677;_0x614942[_0xe7b9('0x13')]=_0x1be22a;_0x614942['channel']=_0x463e7c[_0xe7b9('0x14')];writeLog(_0x1e2677,_0x4d9c41,util['format'](_0xe7b9('0x15'),_0x1be22a));_0x1bff3a[_0xe7b9('0x16')][_0x1e2677]['on'](_0xe7b9('0x17'),function(){logger['info'](_0xe7b9('0x18'),_0x1e2677);clearTimeout(_0x129aea);_0x129aea=undefined;_0x614942[_0xe7b9('0x19')]();if(_0x1bff3a['rules'][_0x1e2677]){delete _0x1bff3a[_0xe7b9('0x16')][_0x1e2677];}_0x3331bd[_0xe7b9('0xf')]();});_0x1bff3a[_0xe7b9('0x16')][_0x1e2677]['on'](_0xe7b9('0x1a'),function(){if(_0x1bff3a[_0xe7b9('0x16')][_0x1e2677]){delete _0x1bff3a[_0xe7b9('0x16')][_0x1e2677];}});_0x129aea=setTimeout(function(){logger[_0xe7b9('0x1b')](_0xe7b9('0x1c'),_0x1e2677);clearTimeout(_0x129aea);_0x614942[_0xe7b9('0x19')]();_0x3331bd[_0xe7b9('0x1d')]();},_0x1be22a);strategy[_0xe7b9('0x1e')](_0x614942,_0x4d9c41,_0x1bff3a,_0x463e7c);}else{logger[_0xe7b9('0xa')](_0xe7b9('0x1f'),_0x1e2677,_0x4a10d6['name']);_0x3331bd[_0xe7b9('0xf')]();}}}catch(_0x68770){console[_0xe7b9('0x20')](_0x68770);logger[_0xe7b9('0xa')]('[%s][QUEUE]\x20%s',_0x1e2677,_0x68770[_0xe7b9('0x21')]);_0x3331bd[_0xe7b9('0xf')]();}};}; \ No newline at end of file +var _0xd1d3=['message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd1d3,0x7b));var _0x3d1d=function(_0x3bd9c2,_0x5c75f0){_0x3bd9c2=_0x3bd9c2-0x0;var _0x518b4c=_0xd1d3[_0x3bd9c2];return _0x518b4c;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x3d1d('0x0'))(_0x3d1d('0x1'));var strategy=require(_0x3d1d('0x2'));var queue=schema({'name':{'type':_0x3d1d('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x3d1d('0x4')}});function writeLog(_0x40b5b3,_0x574fc6,_0x496dcd){return logger[_0x3d1d('0x5')](util[_0x3d1d('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x40b5b3,_0x574fc6[_0x3d1d('0x7')],_0x496dcd));}function handleFindAgent(_0x1ba8a1){return function(_0x1a553e){return _0x1a553e[_0x3d1d('0x7')]['toLowerCase']()===_0x1ba8a1[_0x3d1d('0x8')]();};}exports[_0x3d1d('0x9')]=function(_0x38fd1,_0x3f8858,_0x2583e0,_0x45d5e1){return function(_0x34b9b4){try{var _0x4b9217={'name':_0x3f8858[0x0],'timeout':_0x3f8858[0x1]};var _0x173e84=queue[_0x3d1d('0xa')](_0x4b9217,{'typecast':!![]});if(_0x173e84[_0x3d1d('0xb')]){logger['error'](_0x3d1d('0xc'),_0x38fd1,_['map'](_0x173e84,_0x3d1d('0xd'))[_0x3d1d('0xe')](',\x20'));_0x34b9b4[_0x3d1d('0xf')]();}else{var _0xd24427=_[_0x3d1d('0x10')](_0x2583e0[_0x3d1d('0x11')],handleFindAgent(_0x4b9217[_0x3d1d('0x7')]));if(_0xd24427){var _0x31506b=(_0x4b9217[_0x3d1d('0x12')]||0xa)*0x3e8;var _0x3fb874,_0x24cfc5;var _0x251acb=seqqueue[_0x3d1d('0x13')](_0x31506b);_0x251acb['id']=_0x38fd1;_0x251acb[_0x3d1d('0x14')]=_0x31506b;_0x251acb[_0x3d1d('0x15')]=_0x45d5e1[_0x3d1d('0x15')];writeLog(_0x38fd1,_0xd24427,util[_0x3d1d('0x6')](_0x3d1d('0x16'),_0x31506b));_0x2583e0[_0x3d1d('0x17')][_0x38fd1]['on'](_0x3d1d('0x18'),function(){logger[_0x3d1d('0x5')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x38fd1);clearTimeout(_0x24cfc5);_0x24cfc5=undefined;_0x251acb['close']();if(_0x2583e0[_0x3d1d('0x17')][_0x38fd1]){delete _0x2583e0['rules'][_0x38fd1];}_0x34b9b4['stop']();});_0x2583e0[_0x3d1d('0x17')][_0x38fd1]['on'](_0x3d1d('0x19'),function(){if(_0x2583e0['rules'][_0x38fd1]){delete _0x2583e0[_0x3d1d('0x17')][_0x38fd1];}});_0x24cfc5=setTimeout(function(){logger[_0x3d1d('0x5')]('[%s][AGENT]\x20ROUTING\x20END',_0x38fd1);clearTimeout(_0x24cfc5);_0x251acb[_0x3d1d('0x1a')]();_0x34b9b4[_0x3d1d('0x1b')]();},_0x31506b);strategy[_0x3d1d('0x1c')](_0x251acb,_0xd24427,_0x2583e0,_0x45d5e1);}else{logger['error'](_0x3d1d('0x1d'),_0x38fd1,_0x4b9217[_0x3d1d('0x7')]);_0x34b9b4[_0x3d1d('0xf')]();}}}catch(_0x16cbd1){console[_0x3d1d('0x1e')](_0x16cbd1);logger[_0x3d1d('0x1f')](_0x3d1d('0x20'),_0x38fd1,_0x16cbd1[_0x3d1d('0x21')]);_0x34b9b4['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 7df5c86..55b8d44 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 _0xa1e7=['whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1e7,0xef));var _0x7a1e=function(_0x2f3f1b,_0x176a60){_0x2f3f1b=_0x2f3f1b-0x0;var _0x15b63c=_0xa1e7[_0x2f3f1b];return _0x15b63c;};'use strict';var _=require(_0x7a1e('0x0'));var moment=require(_0x7a1e('0x1'));var AWS=require('aws-sdk');var utils=require(_0x7a1e('0x2'));var logger=require(_0x7a1e('0x3'))(_0x7a1e('0x4'));var rpc={'chatMessage':require(_0x7a1e('0x5')),'openchannelMessage':require(_0x7a1e('0x6')),'mailMessage':require(_0x7a1e('0x7')),'smsMessage':require(_0x7a1e('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7a1e('0x9'))};exports[_0x7a1e('0xa')]=function(_0xd08126,_0x2acec5){return function(_0x5c3936){try{if(!_[_0x7a1e('0xb')](this['interaction'][_0x7a1e('0xc')])){logger[_0x7a1e('0xd')](_0x7a1e('0xe'),_0xd08126,_0x7a1e('0xf'));return _0x5c3936[_0x7a1e('0x10')]();}var _0x516b32={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x7a1e('0x11')),'direction':_0x7a1e('0x12')};if(this[_0x7a1e('0x13')]===_0x7a1e('0x14')||this[_0x7a1e('0x13')]===_0x7a1e('0x15')){_0x516b32[_0x7a1e('0x16')]=this[_0x7a1e('0x17')][_0x7a1e('0x16')];}var _0x93c5c=this[_0x7a1e('0x13')];if(_0x93c5c===_0x7a1e('0x18')){_0x516b32[_0x7a1e('0x19')]=this[_0x7a1e('0x1a')]['id'];}else{_0x516b32[_[_0x7a1e('0x1b')](_0x93c5c)+_0x7a1e('0x1c')]=this[_0x7a1e('0x1a')]['id'];}_0x516b32[_[_0x7a1e('0x1b')](_0x93c5c)+_0x7a1e('0x1d')]=this['interaction']['id'];if(this[_0x7a1e('0x17')][_0x7a1e('0x1e')]){var _0x1127d4=_0x2acec5[0x4];if(!_['isEmpty'](_0x1127d4)){_0x516b32[_0x7a1e('0x1f')]=utils[_0x7a1e('0x20')](_0x1127d4,this);return rpc[_0x93c5c+'Message'][_0x7a1e('0x21')](_0x516b32)['then'](function(_0x1c0e71){logger[_0x7a1e('0xd')](_0x7a1e('0xe'),_0xd08126,_0x516b32[_0x7a1e('0x1f')]);})[_0x7a1e('0x22')](function(_0x14991d){logger[_0x7a1e('0x23')](_0x7a1e('0xe'),_0xd08126,JSON[_0x7a1e('0x24')](_0x14991d));})[_0x7a1e('0x25')](function(){logger[_0x7a1e('0xd')](_0x7a1e('0x26'),_0xd08126);_0x5c3936[_0x7a1e('0x27')]();});}else{logger[_0x7a1e('0xd')](_0x7a1e('0x28'),_0xd08126);_0x5c3936[_0x7a1e('0x27')]();}}else{var _0x3df4a3=this;var _0x1f0b50=new AWS[(_0x7a1e('0x29'))]({'accessKeyId':_0x2acec5[0x0],'secretAccessKey':_0x2acec5[0x1],'region':_0x2acec5[0x2]});var _0x23e5b9={'botAlias':_0x7a1e('0x2a'),'botName':_0x2acec5[0x3],'inputText':this[_0x7a1e('0x2b')]['body'],'userId':this[_0x7a1e('0x13')]+':'+this[_0x7a1e('0x17')]['id'][_0x7a1e('0x2c')]()};_0x1f0b50[_0x7a1e('0x2d')](_0x23e5b9,function(_0x4de475,_0x3de7e2){if(_0x4de475){logger[_0x7a1e('0x23')](_0x7a1e('0xe'),_0xd08126,_0x4de475[_0x7a1e('0x2b')]);_0x5c3936[_0x7a1e('0x10')]();}else if(_0x3de7e2&&_0x3de7e2['message']){_0x3df4a3[_0x7a1e('0x1f')][_0x7a1e('0x2e')]=_0x3de7e2;_0x516b32[_0x7a1e('0x1f')]=_0x3de7e2[_0x7a1e('0x2b')];_0x516b32[_0x7a1e('0x2f')]='amazonlex';_0x516b32[_0x7a1e('0x30')]=JSON[_0x7a1e('0x24')](_0x3de7e2);return rpc[_0x93c5c+'Message'][_0x7a1e('0x21')](_0x516b32)[_0x7a1e('0x31')](function(_0x1e1137){logger[_0x7a1e('0xd')](_0x7a1e('0xe'),_0xd08126,_0x516b32[_0x7a1e('0x1f')]);if(_0x3de7e2[_0x7a1e('0x32')]==_0x7a1e('0x33')){_0x5c3936[_0x7a1e('0x10')]();}else{_0x5c3936[_0x7a1e('0x27')]();}})[_0x7a1e('0x22')](function(_0x3ab253){logger[_0x7a1e('0x23')](_0x7a1e('0xe'),_0xd08126,JSON[_0x7a1e('0x24')](_0x3ab253));_0x5c3936['next']();});}else{_0x5c3936[_0x7a1e('0x10')]();}});}}catch(_0x1afd5a){logger[_0x7a1e('0x23')](_0x7a1e('0xe'),_0xd08126,JSON[_0x7a1e('0x24')](_0x1afd5a));_0x5c3936[_0x7a1e('0x27')]();}};}; \ No newline at end of file +var _0xcfb9=['body','stringify','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','phone','interaction','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','getMustacheRender','create','then','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','error','message'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xcfb9,0x65));var _0x9cfb=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0xcfb9[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x9cfb('0x0'));var moment=require(_0x9cfb('0x1'));var AWS=require(_0x9cfb('0x2'));var utils=require(_0x9cfb('0x3'));var logger=require(_0x9cfb('0x4'))(_0x9cfb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9cfb('0x6')),'mailMessage':require(_0x9cfb('0x7')),'smsMessage':require(_0x9cfb('0x8')),'faxMessage':require(_0x9cfb('0x9')),'whatsappMessage':require(_0x9cfb('0xa'))};exports['consequence']=function(_0x4b126f,_0x4af799){return function(_0x585a34){try{if(!_[_0x9cfb('0xb')](this['interaction'][_0x9cfb('0xc')])){logger[_0x9cfb('0xd')](_0x9cfb('0xe'),_0x4b126f,_0x9cfb('0xf'));return _0x585a34[_0x9cfb('0x10')]();}var _0x3b341a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9cfb('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9cfb('0x12')};if(this[_0x9cfb('0x13')]===_0x9cfb('0x14')||this[_0x9cfb('0x13')]==='whatsapp'){_0x3b341a[_0x9cfb('0x15')]=this[_0x9cfb('0x16')][_0x9cfb('0x15')];}var _0x427835=this['channel'];if(_0x427835==='chat'){_0x3b341a[_0x9cfb('0x17')]=this['account']['id'];}else{_0x3b341a[_[_0x9cfb('0x18')](_0x427835)+_0x9cfb('0x19')]=this[_0x9cfb('0x1a')]['id'];}_0x3b341a[_['upperFirst'](_0x427835)+_0x9cfb('0x1b')]=this[_0x9cfb('0x16')]['id'];if(this[_0x9cfb('0x16')][_0x9cfb('0x1c')]){var _0x5176b0=_0x4af799[0x4];if(!_['isEmpty'](_0x5176b0)){_0x3b341a['body']=utils[_0x9cfb('0x1d')](_0x5176b0,this);return rpc[_0x427835+'Message'][_0x9cfb('0x1e')](_0x3b341a)[_0x9cfb('0x1f')](function(_0x1787ec){logger[_0x9cfb('0xd')]('[%s][AMAZONLEX]\x20%s',_0x4b126f,_0x3b341a['body']);})[_0x9cfb('0x20')](function(_0xe3d13){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4b126f,JSON['stringify'](_0xe3d13));})[_0x9cfb('0x21')](function(){logger[_0x9cfb('0xd')](_0x9cfb('0x22'),_0x4b126f);_0x585a34[_0x9cfb('0x23')]();});}else{logger[_0x9cfb('0xd')](_0x9cfb('0x24'),_0x4b126f);_0x585a34[_0x9cfb('0x23')]();}}else{var _0x3b8e11=this;var _0x3e3ca3=new AWS[(_0x9cfb('0x25'))]({'accessKeyId':_0x4af799[0x0],'secretAccessKey':_0x4af799[0x1],'region':_0x4af799[0x2]});var _0x65b5a={'botAlias':_0x9cfb('0x26'),'botName':_0x4af799[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0x9cfb('0x16')]['id'][_0x9cfb('0x27')]()};_0x3e3ca3[_0x9cfb('0x28')](_0x65b5a,function(_0x67fd6f,_0x58bc84){if(_0x67fd6f){logger[_0x9cfb('0x29')](_0x9cfb('0xe'),_0x4b126f,_0x67fd6f[_0x9cfb('0x2a')]);_0x585a34[_0x9cfb('0x10')]();}else if(_0x58bc84&&_0x58bc84[_0x9cfb('0x2a')]){_0x3b8e11[_0x9cfb('0x2b')]['amazonlex']=_0x58bc84;_0x3b341a[_0x9cfb('0x2b')]=_0x58bc84['message'];_0x3b341a['providerName']='amazonlex';_0x3b341a['providerResponse']=JSON[_0x9cfb('0x2c')](_0x58bc84);return rpc[_0x427835+_0x9cfb('0x2d')][_0x9cfb('0x1e')](_0x3b341a)[_0x9cfb('0x1f')](function(_0x553dce){logger[_0x9cfb('0xd')](_0x9cfb('0xe'),_0x4b126f,_0x3b341a[_0x9cfb('0x2b')]);if(_0x58bc84[_0x9cfb('0x2e')]==_0x9cfb('0x2f')){_0x585a34[_0x9cfb('0x10')]();}else{_0x585a34[_0x9cfb('0x23')]();}})[_0x9cfb('0x20')](function(_0x2cbe0a){logger[_0x9cfb('0x29')](_0x9cfb('0xe'),_0x4b126f,JSON[_0x9cfb('0x2c')](_0x2cbe0a));_0x585a34[_0x9cfb('0x10')]();});}else{_0x585a34[_0x9cfb('0x10')]();}});}}catch(_0x4ca7ff){logger[_0x9cfb('0x29')](_0x9cfb('0xe'),_0x4b126f,JSON['stringify'](_0x4ca7ff));_0x585a34[_0x9cfb('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 cec1c00..a3f21c9 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 _0x095f=['contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x095f,0x1ac));var _0xf095=function(_0x4e327c,_0x3642e5){_0x4e327c=_0x4e327c-0x0;var _0x402668=_0x095f[_0x4e327c];return _0x402668;};'use strict';var _=require(_0xf095('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xf095('0x1'))(_0xf095('0x2'));var rpc={'chatMessage':require(_0xf095('0x3')),'openchannelMessage':require(_0xf095('0x4')),'mailMessage':require(_0xf095('0x5')),'smsMessage':require(_0xf095('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf095('0x7')),'chatInteraction':require(_0xf095('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xf095('0x9')),'smsInteraction':require(_0xf095('0xa')),'faxInteraction':require(_0xf095('0xb')),'whatsappInteraction':require(_0xf095('0xc'))};var mailRpc=require(_0xf095('0xd'));exports[_0xf095('0xe')]=function(_0x45d07d,_0x517842,_0x345774,_0x2d2ad4){return function(_0x11ae28){try{var _0x3b56ea=this[_0xf095('0xf')];if(_0x3b56ea===_0xf095('0x10')&&_0x2d2ad4[_0xf095('0x11')][_0xf095('0x12')]){logger['info'](_0xf095('0x13'),_0x45d07d,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x11ae28[_0xf095('0x14')]();}if(_0x517842[0x0]==='1'&&(_[_0xf095('0x15')](this[_0xf095('0x16')][_0xf095('0x17')])||!this['interaction']['created'])){logger[_0xf095('0x18')]('[%s][AUTOREPLY]\x20%s',_0x45d07d,_0xf095('0x19'));return _0x11ae28[_0xf095('0x14')]();}if(_0x517842[0x0]==='2'&&this[_0xf095('0x16')][_0xf095('0x1a')]){logger[_0xf095('0x18')](_0xf095('0x1b'),_0x45d07d,'One\x20Time\x20already\x20sent');return _0x11ae28['next']();}var _0x30cb39={'ContactId':this[_0xf095('0x1c')]['id'],'sentAt':moment()[_0xf095('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf095('0x1e')};if(this[_0xf095('0xf')]===_0xf095('0x10')){_0x30cb39[_0xf095('0x11')]=utils['getMustacheRender'](_0x517842[0x2],this);}else{_0x30cb39[_0xf095('0x11')]=utils[_0xf095('0x1f')](_0x517842[0x1],this);}if(this['message']){_0x30cb39['to']=this[_0xf095('0x20')][_0xf095('0x21')]||'';if(this[_0xf095('0xf')]==='mail'&&_0x517842[0x1]==='1'){_0x30cb39['cc']=this['message']['cc']||'';}_0x30cb39[_0xf095('0x21')]=this['message']['to']||'';_0x30cb39[_0xf095('0x22')]=this[_0xf095('0x20')][_0xf095('0x22')]||'';_0x30cb39[_0xf095('0x23')]=!![];if(this[_0xf095('0x20')][_0xf095('0x24')]){_0x30cb39[_0xf095('0x24')]='';_0x30cb39[_0xf095('0x24')]+=_[_0xf095('0x25')](this[_0xf095('0x20')][_0xf095('0x24')],_0xf095('0x26'))?'':_0xf095('0x27');_0x30cb39[_0xf095('0x24')]+=this['message'][_0xf095('0x24')];}}if(this[_0xf095('0xf')]===_0xf095('0x28')){_0x30cb39[_0xf095('0x29')]=this[_0xf095('0x2a')]['id'];}else{_0x30cb39[_[_0xf095('0x2b')](this[_0xf095('0xf')])+_0xf095('0x2c')]=this['account']['id'];}_0x30cb39[_[_0xf095('0x2b')](this[_0xf095('0xf')])+_0xf095('0x2d')]=this[_0xf095('0x16')]['id'];var _0x114082=this[_0xf095('0x16')];if(rpc[this[_0xf095('0xf')]+_0xf095('0x2e')]){if(this[_0xf095('0xf')]===_0xf095('0x10')){var _0xa51e5f={'tls':{'rejectUnauthorized':![]}};if(this[_0xf095('0x2a')][_0xf095('0x2f')]['service']){_0xa51e5f['service']=this[_0xf095('0x2a')][_0xf095('0x2f')][_0xf095('0x30')];}else{_0xa51e5f[_0xf095('0x31')]=this[_0xf095('0x2a')]['Smtp']['host'];_0xa51e5f[_0xf095('0x32')]=this['account']['Smtp'][_0xf095('0x32')];_0xa51e5f[_0xf095('0x33')]=this[_0xf095('0x2a')][_0xf095('0x2f')][_0xf095('0x33')];}if(this[_0xf095('0x2a')][_0xf095('0x2f')][_0xf095('0x34')]){_0xa51e5f[_0xf095('0x35')]={'user':this[_0xf095('0x2a')][_0xf095('0x2f')]['user'],'pass':this[_0xf095('0x2a')][_0xf095('0x2f')]['pass']};}_0x30cb39[_0xf095('0x36')]=this[_0xf095('0x20')][_0xf095('0x37')];_0x30cb39[_0xf095('0x38')]=_0xf095('0x39')+_[_0xf095('0x3a')](_0x30cb39['body'],_0xf095('0x3b'),_0xf095('0x3c'))+_0xf095('0x3d');_0x30cb39['headers']={'Auto-Submitted':_0xf095('0x3e'),'X-Auto-Response-Suppress':'All','Precedence':_0xf095('0x3f')};return mailRpc['sendMailMessage'](_0xa51e5f,_0x30cb39)['then'](function(_0x1a5980){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x45d07d);_0x30cb39[_0xf095('0x37')]=_0x1a5980[_0xf095('0x20')][_0xf095('0x37')];return rpc[_0x3b56ea+_0xf095('0x2e')][_0xf095('0x40')](_0x30cb39);})[_0xf095('0x41')](function(_0x3b320e){logger[_0xf095('0x18')](_0xf095('0x13'),_0x45d07d,JSON['stringify'](_0x3b320e));})[_0xf095('0x42')](function(_0x2a2a47){logger[_0xf095('0x43')](_0xf095('0x44'),_0x45d07d,JSON[_0xf095('0x45')](_0x2a2a47));})[_0xf095('0x46')](function(){Promise[_0xf095('0x47')]()['then'](function(){if(_0x517842[0x0]!=='2'||_0x114082[_0xf095('0x1a')])return;return rpc[_0x3b56ea+_0xf095('0x48')][_0xf095('0x49')](_0x114082['id'],{'autoreplyExecuted':!![]})['then'](function(_0x101f16){logger[_0xf095('0x18')](_0xf095('0x1b'),_0x45d07d,JSON[_0xf095('0x45')](_0x101f16));})[_0xf095('0x42')](function(_0x135731){logger[_0xf095('0x43')](_0xf095('0x4a'),_0x45d07d,JSON[_0xf095('0x45')](_0x135731));});})[_0xf095('0x41')](function(){_0x11ae28[_0xf095('0x14')]();});});}else{return rpc[this['channel']+_0xf095('0x2e')][_0xf095('0x40')](_0x30cb39)[_0xf095('0x41')](function(_0x1e4a13){logger[_0xf095('0x18')](_0xf095('0x13'),_0x45d07d,_0x30cb39[_0xf095('0x11')]);})[_0xf095('0x42')](function(_0x449153){logger[_0xf095('0x43')](_0xf095('0x13'),_0x45d07d,JSON[_0xf095('0x45')](_0x449153));})[_0xf095('0x46')](function(){Promise[_0xf095('0x47')]()['then'](function(){if(_0x517842[0x0]!=='2'||_0x114082[_0xf095('0x1a')])return;return rpc[_0x3b56ea+'Interaction']['update'](_0x114082['id'],{'autoreplyExecuted':!![]})[_0xf095('0x41')](function(_0x2e708b){logger[_0xf095('0x18')](_0xf095('0x1b'),_0x45d07d,JSON[_0xf095('0x45')](_0x2e708b));})[_0xf095('0x42')](function(_0x2f2cac){logger[_0xf095('0x43')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x45d07d,JSON[_0xf095('0x45')](_0x2f2cac));});})[_0xf095('0x41')](function(){_0x11ae28[_0xf095('0x14')]();});});}}}catch(_0x9422c9){logger['error']('[%s][AUTOREPLY]\x20%s',_0x45d07d,JSON[_0xf095('0x45')](_0x9422c9));_0x11ae28[_0xf095('0x4b')]();}};}; \ No newline at end of file +var _0xa5c1=['auto-replied','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','Re:','Re:\x20','chat','upperFirst','account','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','messageId','html','','replace','','headers'];(function(_0x3adb8a,_0x4e8aac){var _0x156628=function(_0x55d394){while(--_0x55d394){_0x3adb8a['push'](_0x3adb8a['shift']());}};_0x156628(++_0x4e8aac);}(_0xa5c1,0x191));var _0x1a5c=function(_0x5c7432,_0x57bce4){_0x5c7432=_0x5c7432-0x0;var _0x12c060=_0xa5c1[_0x5c7432];return _0x12c060;};'use strict';var _=require(_0x1a5c('0x0'));var moment=require(_0x1a5c('0x1'));var utils=require(_0x1a5c('0x2'));var logger=require('../../../../config/logger')(_0x1a5c('0x3'));var rpc={'chatMessage':require(_0x1a5c('0x4')),'openchannelMessage':require(_0x1a5c('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1a5c('0x6')),'whatsappMessage':require(_0x1a5c('0x7')),'chatInteraction':require(_0x1a5c('0x8')),'openchannelInteraction':require(_0x1a5c('0x9')),'mailInteraction':require(_0x1a5c('0xa')),'smsInteraction':require(_0x1a5c('0xb')),'faxInteraction':require(_0x1a5c('0xc')),'whatsappInteraction':require(_0x1a5c('0xd'))};var mailRpc=require(_0x1a5c('0xe'));exports[_0x1a5c('0xf')]=function(_0x3b6756,_0x24fb1e,_0x58b449,_0x2e8701){return function(_0x570c64){try{var _0x354921=this[_0x1a5c('0x10')];if(_0x354921===_0x1a5c('0x11')&&_0x2e8701[_0x1a5c('0x12')][_0x1a5c('0x13')]){logger[_0x1a5c('0x14')](_0x1a5c('0x15'),_0x3b6756,_0x1a5c('0x16'));return _0x570c64[_0x1a5c('0x17')]();}if(_0x24fb1e[0x0]==='1'&&(_[_0x1a5c('0x18')](this[_0x1a5c('0x19')][_0x1a5c('0x1a')])||!this[_0x1a5c('0x19')][_0x1a5c('0x1a')])){logger[_0x1a5c('0x14')](_0x1a5c('0x15'),_0x3b6756,'Autoreply\x20already\x20sent');return _0x570c64['next']();}if(_0x24fb1e[0x0]==='2'&&this[_0x1a5c('0x19')][_0x1a5c('0x1b')]){logger[_0x1a5c('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b6756,_0x1a5c('0x1c'));return _0x570c64[_0x1a5c('0x17')]();}var _0x5ad48b={'ContactId':this[_0x1a5c('0x1d')]['id'],'sentAt':moment()['format'](_0x1a5c('0x1e')),'direction':_0x1a5c('0x1f')};if(this[_0x1a5c('0x10')]===_0x1a5c('0x11')){_0x5ad48b[_0x1a5c('0x12')]=utils[_0x1a5c('0x20')](_0x24fb1e[0x2],this);}else{_0x5ad48b[_0x1a5c('0x12')]=utils[_0x1a5c('0x20')](_0x24fb1e[0x1],this);}if(this[_0x1a5c('0x21')]){_0x5ad48b['to']=this['message'][_0x1a5c('0x22')]||'';if(this['channel']===_0x1a5c('0x11')&&_0x24fb1e[0x1]==='1'){_0x5ad48b['cc']=this[_0x1a5c('0x21')]['cc']||'';}_0x5ad48b[_0x1a5c('0x22')]=this[_0x1a5c('0x21')]['to']||'';_0x5ad48b[_0x1a5c('0x23')]=this[_0x1a5c('0x21')][_0x1a5c('0x23')]||'';_0x5ad48b['read']=!![];if(this[_0x1a5c('0x21')][_0x1a5c('0x24')]){_0x5ad48b[_0x1a5c('0x24')]='';_0x5ad48b[_0x1a5c('0x24')]+=_['startsWith'](this[_0x1a5c('0x21')][_0x1a5c('0x24')],_0x1a5c('0x25'))?'':_0x1a5c('0x26');_0x5ad48b[_0x1a5c('0x24')]+=this[_0x1a5c('0x21')][_0x1a5c('0x24')];}}if(this[_0x1a5c('0x10')]===_0x1a5c('0x27')){_0x5ad48b['ChatWebsiteId']=this['account']['id'];}else{_0x5ad48b[_[_0x1a5c('0x28')](this['channel'])+'AccountId']=this[_0x1a5c('0x29')]['id'];}_0x5ad48b[_[_0x1a5c('0x28')](this['channel'])+_0x1a5c('0x2a')]=this[_0x1a5c('0x19')]['id'];var _0x5ebb0f=this[_0x1a5c('0x19')];if(rpc[this['channel']+_0x1a5c('0x2b')]){if(this[_0x1a5c('0x10')]===_0x1a5c('0x11')){var _0x41be4b={'tls':{'rejectUnauthorized':![]}};if(this[_0x1a5c('0x29')][_0x1a5c('0x2c')]['service']){_0x41be4b[_0x1a5c('0x2d')]=this[_0x1a5c('0x29')][_0x1a5c('0x2c')][_0x1a5c('0x2d')];}else{_0x41be4b[_0x1a5c('0x2e')]=this['account'][_0x1a5c('0x2c')][_0x1a5c('0x2e')];_0x41be4b[_0x1a5c('0x2f')]=this['account'][_0x1a5c('0x2c')][_0x1a5c('0x2f')];_0x41be4b[_0x1a5c('0x30')]=this[_0x1a5c('0x29')]['Smtp'][_0x1a5c('0x30')];}if(this['account'][_0x1a5c('0x2c')][_0x1a5c('0x31')]){_0x41be4b[_0x1a5c('0x32')]={'user':this['account'][_0x1a5c('0x2c')][_0x1a5c('0x33')],'pass':this[_0x1a5c('0x29')]['Smtp'][_0x1a5c('0x34')]};}_0x5ad48b['inReplyTo']=this[_0x1a5c('0x21')][_0x1a5c('0x35')];_0x5ad48b[_0x1a5c('0x36')]=_0x1a5c('0x37')+_[_0x1a5c('0x38')](_0x5ad48b[_0x1a5c('0x12')],_0x1a5c('0x39'),_0x1a5c('0x3a'))+_0x1a5c('0x3b');_0x5ad48b[_0x1a5c('0x3c')]={'Auto-Submitted':_0x1a5c('0x3d'),'X-Auto-Response-Suppress':'All','Precedence':_0x1a5c('0x3e')};return mailRpc['sendMailMessage'](_0x41be4b,_0x5ad48b)[_0x1a5c('0x3f')](function(_0x5068a0){logger[_0x1a5c('0x14')](_0x1a5c('0x40'),_0x3b6756);_0x5ad48b[_0x1a5c('0x35')]=_0x5068a0[_0x1a5c('0x21')][_0x1a5c('0x35')];return rpc[_0x354921+_0x1a5c('0x2b')][_0x1a5c('0x41')](_0x5ad48b);})[_0x1a5c('0x3f')](function(_0x1a7cfc){logger[_0x1a5c('0x14')]('[%s][AUTOREPLY]\x20%s',_0x3b6756,JSON[_0x1a5c('0x42')](_0x1a7cfc));})[_0x1a5c('0x43')](function(_0x5b9afa){logger[_0x1a5c('0x44')](_0x1a5c('0x45'),_0x3b6756,JSON[_0x1a5c('0x42')](_0x5b9afa));})[_0x1a5c('0x46')](function(){Promise[_0x1a5c('0x47')]()[_0x1a5c('0x3f')](function(){if(_0x24fb1e[0x0]!=='2'||_0x5ebb0f[_0x1a5c('0x1b')])return;return rpc[_0x354921+_0x1a5c('0x48')][_0x1a5c('0x49')](_0x5ebb0f['id'],{'autoreplyExecuted':!![]})[_0x1a5c('0x3f')](function(_0x30caa3){logger['info'](_0x1a5c('0x4a'),_0x3b6756,JSON['stringify'](_0x30caa3));})[_0x1a5c('0x43')](function(_0x55e4af){logger['error'](_0x1a5c('0x4b'),_0x3b6756,JSON[_0x1a5c('0x42')](_0x55e4af));});})[_0x1a5c('0x3f')](function(){_0x570c64['next']();});});}else{return rpc[this['channel']+_0x1a5c('0x2b')][_0x1a5c('0x41')](_0x5ad48b)[_0x1a5c('0x3f')](function(_0x11172f){logger[_0x1a5c('0x14')](_0x1a5c('0x15'),_0x3b6756,_0x5ad48b[_0x1a5c('0x12')]);})[_0x1a5c('0x43')](function(_0x4d4914){logger[_0x1a5c('0x44')](_0x1a5c('0x15'),_0x3b6756,JSON[_0x1a5c('0x42')](_0x4d4914));})[_0x1a5c('0x46')](function(){Promise[_0x1a5c('0x47')]()[_0x1a5c('0x3f')](function(){if(_0x24fb1e[0x0]!=='2'||_0x5ebb0f[_0x1a5c('0x1b')])return;return rpc[_0x354921+'Interaction']['update'](_0x5ebb0f['id'],{'autoreplyExecuted':!![]})[_0x1a5c('0x3f')](function(_0x57b3d7){logger['info'](_0x1a5c('0x4a'),_0x3b6756,JSON['stringify'](_0x57b3d7));})[_0x1a5c('0x43')](function(_0x895b21){logger['error'](_0x1a5c('0x4b'),_0x3b6756,JSON[_0x1a5c('0x42')](_0x895b21));});})['then'](function(){_0x570c64['next']();});});}}}catch(_0x42cc33){logger[_0x1a5c('0x44')](_0x1a5c('0x15'),_0x3b6756,JSON[_0x1a5c('0x42')](_0x42cc33));_0x570c64[_0x1a5c('0x4c')]();}};}; \ 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 3786b92..80c7b8f 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 _0x3bc4=['Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x3bc4,0x7c));var _0x43bc=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0x3bc4[_0x375126];return _0x1f76bb;};'use strict';var moment=require(_0x43bc('0x0'));var logger=require(_0x43bc('0x1'))(_0x43bc('0x2'));var rpc={'chatInteraction':require(_0x43bc('0x3')),'openchannelInteraction':require(_0x43bc('0x4')),'smsInteraction':require(_0x43bc('0x5')),'mailInteraction':require(_0x43bc('0x6')),'faxInteraction':require(_0x43bc('0x7')),'whatsappInteraction':require(_0x43bc('0x8'))};exports['consequence']=function(_0x11060b,_0x45534e,_0x456e43,_0x105c4a){return function(_0x78ab5f){try{logger[_0x43bc('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x11060b,_0x45534e[0x0]);var _0x16df08={'closed':0x1,'closedAt':moment()[_0x43bc('0xa')](_0x43bc('0xb')),'closeReason':_0x43bc('0xc'),'disposition':_0x45534e[0x0]};if(rpc[_0x105c4a[_0x43bc('0xd')]+'Interaction']){rpc[_0x105c4a['channel']+_0x43bc('0xe')][_0x43bc('0xf')](_0x105c4a[_0x43bc('0x10')]['id'],_0x16df08)[_0x43bc('0x11')](function(_0x351f32){logger[_0x43bc('0x9')](_0x43bc('0x12'),_0x11060b,_0x105c4a[_0x43bc('0x10')]['id']);})['catch'](function(_0x151747){logger['error'](_0x43bc('0x13'),_0x11060b,JSON[_0x43bc('0x14')](_0x151747));})[_0x43bc('0x15')](function(){_0x78ab5f[_0x43bc('0x16')]();});}}catch(_0x14016a){logger['error']('[%s][CLOSE]\x20%s',_0x11060b,JSON[_0x43bc('0x14')](_0x14016a));_0x78ab5f['stop']();}};}; \ No newline at end of file +var _0xe42d=['channel','Interaction','update','interaction','error','[%s][CLOSE]\x20%s','stringify','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','system'];(function(_0x26489b,_0x6b6493){var _0x2d3235=function(_0x2f45db){while(--_0x2f45db){_0x26489b['push'](_0x26489b['shift']());}};_0x2d3235(++_0x6b6493);}(_0xe42d,0xe5));var _0xde42=function(_0xc5bdaa,_0x26eb39){_0xc5bdaa=_0xc5bdaa-0x0;var _0x49c1d2=_0xe42d[_0xc5bdaa];return _0x49c1d2;};'use strict';var moment=require(_0xde42('0x0'));var logger=require('../../../../config/logger')(_0xde42('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xde42('0x2')),'smsInteraction':require(_0xde42('0x3')),'mailInteraction':require(_0xde42('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xde42('0x5'))};exports[_0xde42('0x6')]=function(_0x3eebbc,_0x4aea23,_0xa7f7e9,_0x147202){return function(_0x362e79){try{logger['info'](_0xde42('0x7'),_0x3eebbc,_0x4aea23[0x0]);var _0x542f77={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xde42('0x8'),'disposition':_0x4aea23[0x0]};if(rpc[_0x147202[_0xde42('0x9')]+_0xde42('0xa')]){rpc[_0x147202[_0xde42('0x9')]+_0xde42('0xa')][_0xde42('0xb')](_0x147202[_0xde42('0xc')]['id'],_0x542f77)['then'](function(_0x27397d){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3eebbc,_0x147202[_0xde42('0xc')]['id']);})['catch'](function(_0x110d4f){logger[_0xde42('0xd')](_0xde42('0xe'),_0x3eebbc,JSON[_0xde42('0xf')](_0x110d4f));})['finally'](function(){_0x362e79[_0xde42('0x10')]();});}}catch(_0x920f76){logger[_0xde42('0xd')]('[%s][CLOSE]\x20%s',_0x3eebbc,JSON['stringify'](_0x920f76));_0x362e79['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 7da53b7..4c490bf 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 _0x6eed=['format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message','create','catch','error','stringify','info','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','body','dialogflow','result','providerName','then','metadata','next','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact'];(function(_0x410483,_0x6e4a4){var _0x3997df=function(_0x357323){while(--_0x357323){_0x410483['push'](_0x410483['shift']());}};_0x3997df(++_0x6e4a4);}(_0x6eed,0xff));var _0xd6ee=function(_0x169a7a,_0x14680f){_0x169a7a=_0x169a7a-0x0;var _0x3ae09f=_0x6eed[_0x169a7a];return _0x3ae09f;};'use strict';var _=require(_0xd6ee('0x0'));var moment=require(_0xd6ee('0x1'));var apiai=require(_0xd6ee('0x2'));var md5=require(_0xd6ee('0x3'));var utils=require(_0xd6ee('0x4'));var logger=require('../../../../config/logger')(_0xd6ee('0x5'));var rpc={'chatMessage':require(_0xd6ee('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd6ee('0x7')),'faxMessage':require(_0xd6ee('0x8')),'whatsappMessage':require(_0xd6ee('0x9'))};exports[_0xd6ee('0xa')]=function(_0x10c1d7,_0x48a812){return function(_0x514dc3){try{if(!_[_0xd6ee('0xb')](this['interaction']['UserId'])){logger['info'](_0xd6ee('0xc'),_0x10c1d7,_0xd6ee('0xd'));return _0x514dc3['next']();}var _0x24385c={'ContactId':this[_0xd6ee('0xe')]['id'],'sentAt':moment()[_0xd6ee('0xf')](_0xd6ee('0x10')),'direction':'out'};if(this[_0xd6ee('0x11')]===_0xd6ee('0x12')||this[_0xd6ee('0x11')]===_0xd6ee('0x13')){_0x24385c[_0xd6ee('0x14')]=this[_0xd6ee('0x15')]['phone'];}var _0x45d1cb=this[_0xd6ee('0x11')];if(_0x45d1cb==='chat'){_0x24385c[_0xd6ee('0x16')]=this[_0xd6ee('0x17')]['id'];}else{_0x24385c[_[_0xd6ee('0x18')](_0x45d1cb)+_0xd6ee('0x19')]=this[_0xd6ee('0x17')]['id'];}_0x24385c[_[_0xd6ee('0x18')](_0x45d1cb)+'InteractionId']=this[_0xd6ee('0x15')]['id'];if(this[_0xd6ee('0x15')][_0xd6ee('0x1a')]){var _0x4dfab2=_0x48a812[0x2];if(!_[_0xd6ee('0x1b')](_0x4dfab2)){_0x24385c['body']=utils[_0xd6ee('0x1c')](_0x4dfab2,this);return rpc[_0x45d1cb+_0xd6ee('0x1d')][_0xd6ee('0x1e')](_0x24385c)['then'](function(_0x8a2718){logger['info'](_0xd6ee('0xc'),_0x10c1d7,_0x24385c['body']);})[_0xd6ee('0x1f')](function(_0x28cf1c){logger[_0xd6ee('0x20')](_0xd6ee('0xc'),_0x10c1d7,JSON[_0xd6ee('0x21')](_0x28cf1c));})['finally'](function(){logger[_0xd6ee('0x22')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x10c1d7);_0x514dc3[_0xd6ee('0x23')]();});}else{logger[_0xd6ee('0x22')](_0xd6ee('0x24'),_0x10c1d7);_0x514dc3[_0xd6ee('0x23')]();}}else{var _0xec9287=this;var _0x48e6ad=apiai(_0x48a812[0x0],{'language':_0x48a812[0x1]||'en'});return _0x48e6ad['textRequest'](this[_0xd6ee('0x25')]['body'],{'sessionId':md5(this[_0xd6ee('0x15')]['id'])})['then'](function(_0x391844){_0xec9287[_0xd6ee('0x26')][_0xd6ee('0x27')]=_0x391844;_0x24385c[_0xd6ee('0x26')]=_0x391844[_0xd6ee('0x28')]['fulfillment']['speech'];_0x24385c[_0xd6ee('0x29')]=_0xd6ee('0x27');_0x24385c['providerResponse']=JSON[_0xd6ee('0x21')](_0x391844);return rpc[_0x45d1cb+_0xd6ee('0x1d')][_0xd6ee('0x1e')](_0x24385c)[_0xd6ee('0x2a')](function(_0x3766df){logger[_0xd6ee('0x22')](_0xd6ee('0xc'),_0x10c1d7,_0x24385c['body']);if(_0x391844[_0xd6ee('0x28')][_0xd6ee('0x2b')]['endConversation']){_0x514dc3['next']();}else{_0x514dc3[_0xd6ee('0x23')]();}})[_0xd6ee('0x1f')](function(_0xddca){logger[_0xd6ee('0x20')](_0xd6ee('0xc'),_0x10c1d7,JSON['stringify'](_0xddca));_0x514dc3[_0xd6ee('0x2c')]();});})[_0xd6ee('0x1f')](function(_0x21ce09){logger['error'](_0xd6ee('0xc'),_0x10c1d7,_0x21ce09[_0xd6ee('0x25')]);_0x514dc3[_0xd6ee('0x2c')]();});}}catch(_0x54d471){logger[_0xd6ee('0x20')](_0xd6ee('0xc'),_0x10c1d7,JSON[_0xd6ee('0x21')](_0x54d471));_0x514dc3[_0xd6ee('0x23')]();}};}; \ No newline at end of file +var _0x2d72=['Message','create','then','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','metadata','endConversation','next','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','getMustacheRender'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x2d72,0xa8));var _0x22d7=function(_0x4618a2,_0x5db19c){_0x4618a2=_0x4618a2-0x0;var _0x43a1ab=_0x2d72[_0x4618a2];return _0x43a1ab;};'use strict';var _=require(_0x22d7('0x0'));var moment=require(_0x22d7('0x1'));var apiai=require(_0x22d7('0x2'));var md5=require(_0x22d7('0x3'));var utils=require(_0x22d7('0x4'));var logger=require(_0x22d7('0x5'))(_0x22d7('0x6'));var rpc={'chatMessage':require(_0x22d7('0x7')),'openchannelMessage':require(_0x22d7('0x8')),'mailMessage':require(_0x22d7('0x9')),'smsMessage':require(_0x22d7('0xa')),'faxMessage':require(_0x22d7('0xb')),'whatsappMessage':require(_0x22d7('0xc'))};exports[_0x22d7('0xd')]=function(_0x52a3e3,_0x23a731){return function(_0x3791d6){try{if(!_['isNil'](this[_0x22d7('0xe')][_0x22d7('0xf')])){logger[_0x22d7('0x10')](_0x22d7('0x11'),_0x52a3e3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3791d6['next']();}var _0x1810b8={'ContactId':this[_0x22d7('0x12')]['id'],'sentAt':moment()[_0x22d7('0x13')](_0x22d7('0x14')),'direction':_0x22d7('0x15')};if(this['channel']==='sms'||this[_0x22d7('0x16')]==='whatsapp'){_0x1810b8[_0x22d7('0x17')]=this[_0x22d7('0xe')]['phone'];}var _0x9b5d86=this[_0x22d7('0x16')];if(_0x9b5d86===_0x22d7('0x18')){_0x1810b8[_0x22d7('0x19')]=this[_0x22d7('0x1a')]['id'];}else{_0x1810b8[_[_0x22d7('0x1b')](_0x9b5d86)+_0x22d7('0x1c')]=this[_0x22d7('0x1a')]['id'];}_0x1810b8[_['upperFirst'](_0x9b5d86)+_0x22d7('0x1d')]=this[_0x22d7('0xe')]['id'];if(this[_0x22d7('0xe')]['created']){var _0x4d2210=_0x23a731[0x2];if(!_['isEmpty'](_0x4d2210)){_0x1810b8[_0x22d7('0x1e')]=utils[_0x22d7('0x1f')](_0x4d2210,this);return rpc[_0x9b5d86+_0x22d7('0x20')][_0x22d7('0x21')](_0x1810b8)[_0x22d7('0x22')](function(_0x5b32c0){logger[_0x22d7('0x10')](_0x22d7('0x11'),_0x52a3e3,_0x1810b8[_0x22d7('0x1e')]);})['catch'](function(_0x135227){logger[_0x22d7('0x23')](_0x22d7('0x11'),_0x52a3e3,JSON[_0x22d7('0x24')](_0x135227));})[_0x22d7('0x25')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x52a3e3);_0x3791d6[_0x22d7('0x26')]();});}else{logger[_0x22d7('0x10')](_0x22d7('0x27'),_0x52a3e3);_0x3791d6[_0x22d7('0x26')]();}}else{var _0x4f9bc7=this;var _0x3f0148=apiai(_0x23a731[0x0],{'language':_0x23a731[0x1]||'en'});return _0x3f0148[_0x22d7('0x28')](this[_0x22d7('0x29')]['body'],{'sessionId':md5(this[_0x22d7('0xe')]['id'])})['then'](function(_0x219507){_0x4f9bc7[_0x22d7('0x1e')][_0x22d7('0x2a')]=_0x219507;_0x1810b8['body']=_0x219507[_0x22d7('0x2b')]['fulfillment']['speech'];_0x1810b8[_0x22d7('0x2c')]=_0x22d7('0x2a');_0x1810b8[_0x22d7('0x2d')]=JSON[_0x22d7('0x24')](_0x219507);return rpc[_0x9b5d86+_0x22d7('0x20')]['create'](_0x1810b8)[_0x22d7('0x22')](function(_0x603453){logger[_0x22d7('0x10')](_0x22d7('0x11'),_0x52a3e3,_0x1810b8[_0x22d7('0x1e')]);if(_0x219507['result'][_0x22d7('0x2e')][_0x22d7('0x2f')]){_0x3791d6[_0x22d7('0x30')]();}else{_0x3791d6[_0x22d7('0x26')]();}})['catch'](function(_0x1195bc){logger[_0x22d7('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x52a3e3,JSON['stringify'](_0x1195bc));_0x3791d6['next']();});})[_0x22d7('0x31')](function(_0x3e629e){logger[_0x22d7('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x52a3e3,_0x3e629e[_0x22d7('0x29')]);_0x3791d6['next']();});}}catch(_0x478129){logger[_0x22d7('0x23')](_0x22d7('0x11'),_0x52a3e3,JSON[_0x22d7('0x24')](_0x478129));_0x3791d6[_0x22d7('0x26')]();}};}; \ 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 8ddb1c0..5c2d810 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 _0x2dc2=['md5','moment','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','account','upperFirst','created','isEmpty','getMustacheRender','create','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','queryResult','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','push','fulfillmentText','lodash'];(function(_0x25ff3e,_0x37dcbc){var _0x7e23ef=function(_0xb2c5b4){while(--_0xb2c5b4){_0x25ff3e['push'](_0x25ff3e['shift']());}};_0x7e23ef(++_0x37dcbc);}(_0x2dc2,0xcb));var _0x22dc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x2dc2[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x22dc('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x22dc('0x1'));var moment=require(_0x22dc('0x2'));var Promise=require(_0x22dc('0x3'));var logger=require('../../../../config/logger')(_0x22dc('0x4'));var utils=require(_0x22dc('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x22dc('0x6')),'mailMessage':require(_0x22dc('0x7')),'smsMessage':require(_0x22dc('0x8')),'faxMessage':require(_0x22dc('0x9')),'whatsappMessage':require(_0x22dc('0xa'))};function createMessage(_0x381dbf,_0x2f72c2,_0x158bed,_0x405c43){return new Promise(function(_0x313b49,_0x5db00e){var _0x41f3cd=_[_0x22dc('0xb')](_0x158bed);_0x41f3cd[_0x22dc('0xc')]=_0x405c43;return rpc[_0x2f72c2+_0x22dc('0xd')]['create'](_0x41f3cd)[_0x22dc('0xe')](function(){logger[_0x22dc('0xf')](_0x22dc('0x10'),_0x381dbf,_0x41f3cd[_0x22dc('0xc')]);_0x313b49();})[_0x22dc('0x11')](function(_0xee3447){logger[_0x22dc('0x12')](_0x22dc('0x10'),_0x381dbf,JSON[_0x22dc('0x13')](_0xee3447));_0x5db00e(_0xee3447);});});}exports[_0x22dc('0x14')]=function(_0x1385a6,_0x3be5c1){return function(_0x25e345){try{if(!_['isNil'](this[_0x22dc('0x15')][_0x22dc('0x16')])){logger[_0x22dc('0xf')](_0x22dc('0x10'),_0x1385a6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x25e345[_0x22dc('0x17')]();}var _0x2d7b5e={'ContactId':this[_0x22dc('0x18')]['id'],'sentAt':moment()['format'](_0x22dc('0x19')),'direction':_0x22dc('0x1a')};if(this[_0x22dc('0x1b')]==='sms'||this[_0x22dc('0x1b')]===_0x22dc('0x1c')){_0x2d7b5e[_0x22dc('0x1d')]=this['interaction'][_0x22dc('0x1d')];}var _0x24871a=this[_0x22dc('0x1b')];if(_0x24871a==='chat'){_0x2d7b5e['ChatWebsiteId']=this[_0x22dc('0x1e')]['id'];}else{_0x2d7b5e[_[_0x22dc('0x1f')](_0x24871a)+'AccountId']=this[_0x22dc('0x1e')]['id'];}_0x2d7b5e[_[_0x22dc('0x1f')](_0x24871a)+'InteractionId']=this[_0x22dc('0x15')]['id'];if(this['interaction'][_0x22dc('0x20')]){var _0x34b7e3=_0x3be5c1[0x4];if(!_[_0x22dc('0x21')](_0x34b7e3)){_0x2d7b5e['body']=utils[_0x22dc('0x22')](_0x34b7e3,this);return rpc[_0x24871a+'Message'][_0x22dc('0x23')](_0x2d7b5e)[_0x22dc('0xe')](function(_0x45ebaf){logger['info'](_0x22dc('0x10'),_0x1385a6,_0x2d7b5e[_0x22dc('0xc')]);})[_0x22dc('0x11')](function(_0x13607a){logger[_0x22dc('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1385a6,JSON[_0x22dc('0x13')](_0x13607a));})[_0x22dc('0x24')](function(){logger[_0x22dc('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1385a6);_0x25e345[_0x22dc('0x25')]();});}else{logger['info'](_0x22dc('0x26'),_0x1385a6);_0x25e345[_0x22dc('0x25')]();}}else{var _0x1de4f0=this;var _0x32a901=_0x3be5c1[0x2][_0x22dc('0x27')](/\\n/g,'\x0a');var _0x1e5d48={'credentials':{'private_key':_0x32a901,'client_email':_0x3be5c1[0x1]}};var _0x16ce4b=new dialogflow[(_0x22dc('0x28'))](_0x1e5d48);var _0xa35f08=_0x16ce4b[_0x22dc('0x29')](_0x3be5c1[0x0],md5(_0x1de4f0['interaction']['id']));var _0x29c887={'session':_0xa35f08,'queryInput':{'text':{'text':_0x1de4f0[_0x22dc('0x2a')]['body'],'languageCode':_0x3be5c1[0x3]||'en'}}};return _0x16ce4b[_0x22dc('0x2b')](_0x29c887)[_0x22dc('0xe')](function(_0x428271){if(_0x428271&&_0x428271[_0x22dc('0x2c')]){_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x2d')]=_0x428271;var _0x4a02de=_0x428271[0x0];var _0x316a76=_0x4a02de['queryResult']['diagnosticInfo']&&_0x4a02de['queryResult'][_0x22dc('0x2e')][_0x22dc('0x2f')]?_0x4a02de['queryResult'][_0x22dc('0x2e')]['fields'][_0x22dc('0x30')][_0x22dc('0x31')]:![];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x32')]=_0x4a02de[_0x22dc('0x33')][_0x22dc('0x34')];_0x1de4f0['body'][_0x22dc('0x35')]=_0x4a02de[_0x22dc('0x33')]['allRequiredParamsPresent'];_0x1de4f0['body'][_0x22dc('0x36')]=_0x4a02de[_0x22dc('0x33')]['diagnosticInfo']&&_0x4a02de['queryResult']['diagnosticInfo'][_0x22dc('0x2f')]?_0x4a02de[_0x22dc('0x33')][_0x22dc('0x2e')]['fields'][_0x22dc('0x30')][_0x22dc('0x31')]:![];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x37')]=_0x4a02de[_0x22dc('0x33')]['intent']['name'];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x38')]=_0x4a02de[_0x22dc('0x33')][_0x22dc('0x39')]['displayName'];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x3a')]=_0x4a02de[_0x22dc('0x33')]['intent'][_0x22dc('0x3b')];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x3c')]=_0x4a02de[_0x22dc('0x33')][_0x22dc('0x3d')];_0x1de4f0[_0x22dc('0xc')][_0x22dc('0x3e')]=_0x4a02de['queryResult'][_0x22dc('0x3f')];_0x1de4f0['body'][_0x22dc('0x40')]=_0x4a02de['queryResult']['intentDetectionConfidence'];_0x2d7b5e[_0x22dc('0x41')]=_0x22dc('0x2d');_0x2d7b5e['providerResponse']=JSON[_0x22dc('0x13')](_0x428271);var _0x2c723a=[];for(var _0x25ad54=0x0;_0x25ad54<_0x428271['length'];_0x25ad54++){var _0x1baad3=_0x428271[_0x25ad54];if(_0x1baad3&&_0x1baad3['queryResult']&&_0x1baad3[_0x22dc('0x33')]['fulfillmentText']){_0x2c723a[_0x22dc('0x42')](createMessage(_0x1385a6,_0x24871a,_0x2d7b5e,_0x1baad3['queryResult'][_0x22dc('0x43')]));}}return Promise['all'](_0x2c723a)['then'](function(){if(_0x316a76){_0x25e345[_0x22dc('0x17')]();}else{_0x25e345[_0x22dc('0x25')]();}})[_0x22dc('0x11')](function(_0x1ed05c){logger[_0x22dc('0x12')](_0x22dc('0x10'),_0x1385a6,JSON[_0x22dc('0x13')](_0x1ed05c));_0x25e345[_0x22dc('0x17')]();});}})[_0x22dc('0x11')](function(_0x8b0195){logger['error'](_0x22dc('0x10'),_0x1385a6,_0x8b0195[_0x22dc('0x2a')]);_0x25e345[_0x22dc('0x17')]();});}}catch(_0x343d89){logger[_0x22dc('0x12')](_0x22dc('0x10'),_0x1385a6,JSON['stringify'](_0x343d89));_0x25e345['stop']();}};}; \ No newline at end of file +var _0x1ee8=['stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','queryResult','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','error','dialogflow','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','catch'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x1ee8,0x6d));var _0x81ee=function(_0x3423f1,_0x19a8a3){_0x3423f1=_0x3423f1-0x0;var _0x468c86=_0x1ee8[_0x3423f1];return _0x468c86;};'use strict';var _=require('lodash');var dialogflow=require(_0x81ee('0x0'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x81ee('0x1'));var logger=require(_0x81ee('0x2'))(_0x81ee('0x3'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x81ee('0x4')),'mailMessage':require(_0x81ee('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x81ee('0x6')),'whatsappMessage':require(_0x81ee('0x7'))};function createMessage(_0x309cb4,_0x535f9e,_0x2cdaf7,_0x5affaf){return new Promise(function(_0x3a69ac,_0x383e95){var _0x1dbb14=_[_0x81ee('0x8')](_0x2cdaf7);_0x1dbb14['body']=_0x5affaf;return rpc[_0x535f9e+_0x81ee('0x9')]['create'](_0x1dbb14)[_0x81ee('0xa')](function(){logger[_0x81ee('0xb')](_0x81ee('0xc'),_0x309cb4,_0x1dbb14['body']);_0x3a69ac();})['catch'](function(_0x5f6977){logger['error'](_0x81ee('0xc'),_0x309cb4,JSON['stringify'](_0x5f6977));_0x383e95(_0x5f6977);});});}exports[_0x81ee('0xd')]=function(_0x2d60fa,_0x4fd6a0){return function(_0x3bf614){try{if(!_[_0x81ee('0xe')](this[_0x81ee('0xf')][_0x81ee('0x10')])){logger[_0x81ee('0xb')](_0x81ee('0xc'),_0x2d60fa,_0x81ee('0x11'));return _0x3bf614[_0x81ee('0x12')]();}var _0xee6e3b={'ContactId':this[_0x81ee('0x13')]['id'],'sentAt':moment()[_0x81ee('0x14')](_0x81ee('0x15')),'direction':_0x81ee('0x16')};if(this['channel']==='sms'||this[_0x81ee('0x17')]==='whatsapp'){_0xee6e3b[_0x81ee('0x18')]=this[_0x81ee('0xf')][_0x81ee('0x18')];}var _0x5e1957=this[_0x81ee('0x17')];if(_0x5e1957==='chat'){_0xee6e3b[_0x81ee('0x19')]=this[_0x81ee('0x1a')]['id'];}else{_0xee6e3b[_[_0x81ee('0x1b')](_0x5e1957)+_0x81ee('0x1c')]=this['account']['id'];}_0xee6e3b[_['upperFirst'](_0x5e1957)+'InteractionId']=this[_0x81ee('0xf')]['id'];if(this['interaction'][_0x81ee('0x1d')]){var _0x4a70fb=_0x4fd6a0[0x4];if(!_[_0x81ee('0x1e')](_0x4a70fb)){_0xee6e3b[_0x81ee('0x1f')]=utils[_0x81ee('0x20')](_0x4a70fb,this);return rpc[_0x5e1957+_0x81ee('0x9')][_0x81ee('0x21')](_0xee6e3b)[_0x81ee('0xa')](function(_0x1fcdb5){logger[_0x81ee('0xb')](_0x81ee('0xc'),_0x2d60fa,_0xee6e3b[_0x81ee('0x1f')]);})[_0x81ee('0x22')](function(_0x588060){logger['error'](_0x81ee('0xc'),_0x2d60fa,JSON[_0x81ee('0x23')](_0x588060));})[_0x81ee('0x24')](function(){logger['info'](_0x81ee('0x25'),_0x2d60fa);_0x3bf614[_0x81ee('0x26')]();});}else{logger[_0x81ee('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2d60fa);_0x3bf614[_0x81ee('0x26')]();}}else{var _0x1ed3e9=this;var _0x4e3ca8=_0x4fd6a0[0x2][_0x81ee('0x27')](/\\n/g,'\x0a');var _0x591da4={'credentials':{'private_key':_0x4e3ca8,'client_email':_0x4fd6a0[0x1]}};var _0x5b581b=new dialogflow[(_0x81ee('0x28'))](_0x591da4);var _0x5681ca=_0x5b581b[_0x81ee('0x29')](_0x4fd6a0[0x0],md5(_0x1ed3e9[_0x81ee('0xf')]['id']));var _0x3f515d={'session':_0x5681ca,'queryInput':{'text':{'text':_0x1ed3e9[_0x81ee('0x2a')][_0x81ee('0x1f')],'languageCode':_0x4fd6a0[0x3]||'en'}}};return _0x5b581b[_0x81ee('0x2b')](_0x3f515d)[_0x81ee('0xa')](function(_0x53869a){if(_0x53869a&&_0x53869a[_0x81ee('0x2c')]){_0x1ed3e9['body'][_0x81ee('0x2d')]=_0x53869a;var _0x11d916=_0x53869a[0x0];var _0x23f34b=_0x11d916['queryResult'][_0x81ee('0x2e')]&&_0x11d916['queryResult'][_0x81ee('0x2e')][_0x81ee('0x2f')]?_0x11d916['queryResult'][_0x81ee('0x2e')][_0x81ee('0x2f')][_0x81ee('0x30')]['boolValue']:![];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x31')]=_0x11d916[_0x81ee('0x32')]['action'];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x33')]=_0x11d916[_0x81ee('0x32')][_0x81ee('0x34')];_0x1ed3e9['body'][_0x81ee('0x35')]=_0x11d916['queryResult'][_0x81ee('0x2e')]&&_0x11d916[_0x81ee('0x32')][_0x81ee('0x2e')][_0x81ee('0x2f')]?_0x11d916[_0x81ee('0x32')]['diagnosticInfo'][_0x81ee('0x2f')][_0x81ee('0x30')][_0x81ee('0x36')]:![];_0x1ed3e9['body']['DIALOGFLOWV2_INTENTNAME']=_0x11d916[_0x81ee('0x32')]['intent'][_0x81ee('0x37')];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x38')]=_0x11d916['queryResult'][_0x81ee('0x39')][_0x81ee('0x3a')];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x3b')]=_0x11d916[_0x81ee('0x32')][_0x81ee('0x39')][_0x81ee('0x3c')];_0x1ed3e9['body'][_0x81ee('0x3d')]=_0x11d916[_0x81ee('0x32')][_0x81ee('0x3e')];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x3f')]=_0x11d916['queryResult']['queryText'];_0x1ed3e9[_0x81ee('0x1f')][_0x81ee('0x40')]=_0x11d916[_0x81ee('0x32')][_0x81ee('0x41')];_0xee6e3b[_0x81ee('0x42')]='dialogflowV2';_0xee6e3b[_0x81ee('0x43')]=JSON[_0x81ee('0x23')](_0x53869a);var _0x229645=[];for(var _0x3f7090=0x0;_0x3f7090<_0x53869a[_0x81ee('0x2c')];_0x3f7090++){var _0x353372=_0x53869a[_0x3f7090];if(_0x353372&&_0x353372[_0x81ee('0x32')]&&_0x353372[_0x81ee('0x32')][_0x81ee('0x44')]){_0x229645[_0x81ee('0x45')](createMessage(_0x2d60fa,_0x5e1957,_0xee6e3b,_0x353372['queryResult'][_0x81ee('0x44')]));}}return Promise[_0x81ee('0x46')](_0x229645)[_0x81ee('0xa')](function(){if(_0x23f34b){_0x3bf614[_0x81ee('0x12')]();}else{_0x3bf614['stop']();}})['catch'](function(_0x26ea3e){logger[_0x81ee('0x47')](_0x81ee('0xc'),_0x2d60fa,JSON[_0x81ee('0x23')](_0x26ea3e));_0x3bf614[_0x81ee('0x12')]();});}})[_0x81ee('0x22')](function(_0x337b38){logger[_0x81ee('0x47')](_0x81ee('0xc'),_0x2d60fa,_0x337b38[_0x81ee('0x2a')]);_0x3bf614[_0x81ee('0x12')]();});}}catch(_0x5cc50a){logger[_0x81ee('0x47')]('[%s][DIALOGFLOWV2]\x20%s',_0x2d60fa,JSON[_0x81ee('0x23')](_0x5cc50a));_0x3bf614['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4da6988..207b6fd 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 _0x8f60=['../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils'];(function(_0x35adb0,_0xb824db){var _0x3cf558=function(_0x1fbd73){while(--_0x1fbd73){_0x35adb0['push'](_0x35adb0['shift']());}};_0x3cf558(++_0xb824db);}(_0x8f60,0x1ac));var _0x08f6=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x8f60[_0x4fa166];return _0x5dd974;};'use strict';var schema=require(_0x08f6('0x0'));var _=require(_0x08f6('0x1'));var htmlToText=require(_0x08f6('0x2'));var utils=require(_0x08f6('0x3'));var logger=require(_0x08f6('0x4'))(_0x08f6('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x08f6('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x08f6('0x7'),'message':_0x08f6('0x8')}});exports[_0x08f6('0x9')]=function(_0x4174dd,_0x27b618){return function(_0x24c068){try{var _0x1214d2={'condition':htmlToText[_0x08f6('0xa')](utils[_0x08f6('0xb')](_0x27b618[0x0],this),{'wordwrap':![]})[_0x08f6('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x27b618[0x1],'priorityFalse':_0x27b618[0x2]};var _0x1bb0cb=gotoif[_0x08f6('0x0')](_0x1214d2,{'typecast':!![]});if(_0x1bb0cb[_0x08f6('0xd')]){logger[_0x08f6('0xe')](_0x08f6('0xf'),_0x4174dd,_[_0x08f6('0x10')](_0x1bb0cb,'message')[_0x08f6('0x11')](',\x20'));_0x24c068['stop']();}else{try{var _0x249a5d=eval('('+_0x1214d2[_0x08f6('0x12')]+')');var _0x57294d=_0x249a5d?_0x1214d2['priorityTrue']:_0x1214d2[_0x08f6('0x13')];logger[_0x08f6('0x14')](_0x08f6('0x15'),_0x4174dd,_0x1214d2[_0x08f6('0x12')],_0x249a5d,_0x57294d||_0x08f6('0x16'));if(_0x57294d){var _0x303442=_['findIndex'](_0x24c068[_0x08f6('0x17')](),{'p':_0x57294d});if(_0x303442>=0x0){logger['info'](_0x08f6('0x18'),_0x4174dd,_0x57294d||_0x08f6('0x16'),_0x303442);_0x24c068['next'](_0x303442);}else{logger[_0x08f6('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4174dd,_0x57294d||_0x08f6('0x16'));_0x24c068[_0x08f6('0x19')]();}}else{_0x24c068[_0x08f6('0x16')]();}}catch(_0x20c879){logger['error'](_0x08f6('0x1a'),_0x4174dd,_0x20c879['message']);_0x24c068['stop']();}}}catch(_0x55ae9f){logger[_0x08f6('0xe')]('[%s][GOTOIF]\x20%s',_0x4174dd,JSON['stringify'](_0x55ae9f));_0x24c068['stop']();}};}; \ No newline at end of file +var _0x85a3=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x85a3,0x168));var _0x385a=function(_0x266670,_0x41fdc1){_0x266670=_0x266670-0x0;var _0x2e8104=_0x85a3[_0x266670];return _0x2e8104;};'use strict';var schema=require(_0x385a('0x0'));var _=require(_0x385a('0x1'));var htmlToText=require(_0x385a('0x2'));var utils=require(_0x385a('0x3'));var logger=require(_0x385a('0x4'))(_0x385a('0x5'));var gotoif=schema({'condition':{'type':_0x385a('0x6'),'required':!![],'message':_0x385a('0x7')},'priorityTrue':{'type':_0x385a('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x385a('0x8'),'message':_0x385a('0x9')}});exports[_0x385a('0xa')]=function(_0x59cdc7,_0x1f334d){return function(_0x14ac4a){try{var _0x5b2155={'condition':htmlToText[_0x385a('0xb')](utils['getMustacheRender'](_0x1f334d[0x0],this),{'wordwrap':![]})[_0x385a('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1f334d[0x1],'priorityFalse':_0x1f334d[0x2]};var _0x34c2a0=gotoif['validate'](_0x5b2155,{'typecast':!![]});if(_0x34c2a0[_0x385a('0xd')]){logger[_0x385a('0xe')](_0x385a('0xf'),_0x59cdc7,_[_0x385a('0x10')](_0x34c2a0,_0x385a('0x11'))[_0x385a('0x12')](',\x20'));_0x14ac4a[_0x385a('0x13')]();}else{try{var _0x40e73a=eval('('+_0x5b2155[_0x385a('0x14')]+')');var _0x555c1d=_0x40e73a?_0x5b2155[_0x385a('0x15')]:_0x5b2155[_0x385a('0x16')];logger[_0x385a('0x17')](_0x385a('0x18'),_0x59cdc7,_0x5b2155['condition'],_0x40e73a,_0x555c1d||_0x385a('0x19'));if(_0x555c1d){var _0x26ff83=_[_0x385a('0x1a')](_0x14ac4a[_0x385a('0x1b')](),{'p':_0x555c1d});if(_0x26ff83>=0x0){logger[_0x385a('0x17')](_0x385a('0x1c'),_0x59cdc7,_0x555c1d||_0x385a('0x19'),_0x26ff83);_0x14ac4a[_0x385a('0x19')](_0x26ff83);}else{logger[_0x385a('0x17')](_0x385a('0x1d'),_0x59cdc7,_0x555c1d||_0x385a('0x19'));_0x14ac4a[_0x385a('0x13')]();}}else{_0x14ac4a[_0x385a('0x19')]();}}catch(_0x66e10){logger[_0x385a('0xe')](_0x385a('0x1e'),_0x59cdc7,_0x66e10[_0x385a('0x11')]);_0x14ac4a[_0x385a('0x13')]();}}}catch(_0x3ba93b){logger[_0x385a('0xe')](_0x385a('0xf'),_0x59cdc7,JSON[_0x385a('0x1f')](_0x3ba93b));_0x14ac4a[_0x385a('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 6269b60..16de009 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 _0x853f=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x181cbc,_0x485b35){var _0x1a51ae=function(_0x220fbe){while(--_0x220fbe){_0x181cbc['push'](_0x181cbc['shift']());}};_0x1a51ae(++_0x485b35);}(_0x853f,0x95));var _0xf853=function(_0x220242,_0x3abd3e){_0x220242=_0x220242-0x0;var _0x3d0c16=_0x853f[_0x220242];return _0x3d0c16;};'use strict';var schema=require(_0xf853('0x0'));var _=require(_0xf853('0x1'));var logger=require(_0xf853('0x2'))(_0xf853('0x3'));var gotop=schema({'priority':{'type':_0xf853('0x4'),'required':!![],'message':_0xf853('0x5')}});exports['consequence']=function(_0x80b7c8,_0xa8021f){return function(_0x3741ff){try{var _0x522567={'priority':_0xa8021f[0x0]};var _0x282856=gotop[_0xf853('0x0')](_0x522567,{'typecast':!![]});if(_0x282856[_0xf853('0x6')]){logger[_0xf853('0x7')](_0xf853('0x8'),_0x80b7c8,_[_0xf853('0x9')](_0x282856,_0xf853('0xa'))['join'](',\x20'));_0x3741ff[_0xf853('0xb')]();}else{logger[_0xf853('0xc')](_0xf853('0xd'),_0x80b7c8,_0x522567[_0xf853('0xe')]);if(_0x522567['priority']){var _0x4de5c9=_[_0xf853('0xf')](_0x3741ff[_0xf853('0x10')](),{'p':_0x522567[_0xf853('0xe')]});if(_0x4de5c9>=0x0){logger[_0xf853('0xc')](_0xf853('0x11'),_0x80b7c8,_0x522567[_0xf853('0xe')]||_0xf853('0x12'),_0x4de5c9);_0x3741ff[_0xf853('0x12')](_0x4de5c9);}else{logger[_0xf853('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x80b7c8,_0x522567[_0xf853('0xe')]||_0xf853('0x12'));_0x3741ff[_0xf853('0xb')]();}}else{_0x3741ff[_0xf853('0x12')]();}}}catch(_0x4b65ab){logger[_0xf853('0x7')](_0xf853('0x8'),_0x80b7c8,JSON[_0xf853('0x13')](_0x4b65ab));_0x3741ff['stop']();}};}; \ No newline at end of file +var _0x0ee0=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2a570e,_0x1e042a){var _0x5a166c=function(_0x4df60c){while(--_0x4df60c){_0x2a570e['push'](_0x2a570e['shift']());}};_0x5a166c(++_0x1e042a);}(_0x0ee0,0xb7));var _0x00ee=function(_0x1e0bad,_0x51aa9d){_0x1e0bad=_0x1e0bad-0x0;var _0x4046a3=_0x0ee0[_0x1e0bad];return _0x4046a3;};'use strict';var schema=require('validate');var _=require(_0x00ee('0x0'));var logger=require(_0x00ee('0x1'))(_0x00ee('0x2'));var gotop=schema({'priority':{'type':_0x00ee('0x3'),'required':!![],'message':_0x00ee('0x4')}});exports['consequence']=function(_0x15de51,_0x165b4c){return function(_0x384da6){try{var _0x1e77f7={'priority':_0x165b4c[0x0]};var _0x467a19=gotop[_0x00ee('0x5')](_0x1e77f7,{'typecast':!![]});if(_0x467a19[_0x00ee('0x6')]){logger[_0x00ee('0x7')](_0x00ee('0x8'),_0x15de51,_[_0x00ee('0x9')](_0x467a19,_0x00ee('0xa'))[_0x00ee('0xb')](',\x20'));_0x384da6[_0x00ee('0xc')]();}else{logger[_0x00ee('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x15de51,_0x1e77f7[_0x00ee('0xe')]);if(_0x1e77f7[_0x00ee('0xe')]){var _0x1cd1fa=_[_0x00ee('0xf')](_0x384da6['rules'](),{'p':_0x1e77f7[_0x00ee('0xe')]});if(_0x1cd1fa>=0x0){logger[_0x00ee('0xd')](_0x00ee('0x10'),_0x15de51,_0x1e77f7[_0x00ee('0xe')]||_0x00ee('0x11'),_0x1cd1fa);_0x384da6[_0x00ee('0x11')](_0x1cd1fa);}else{logger[_0x00ee('0xd')](_0x00ee('0x12'),_0x15de51,_0x1e77f7[_0x00ee('0xe')]||'next');_0x384da6[_0x00ee('0xc')]();}}else{_0x384da6[_0x00ee('0x11')]();}}}catch(_0x1e25dc){logger['error']('[%s][GOTOP]\x20%s',_0x15de51,JSON[_0x00ee('0x13')](_0x1e25dc));_0x384da6[_0x00ee('0xc')]();}};}; \ 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 1c68b2e..43c1098 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 _0x01a2=['Message','create','info','[%s][MESSAGE]\x20%s','body','stop','error','stringify','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','ChatWebsiteId','account','AccountId','interaction'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x01a2,0x68));var _0x201a=function(_0x16a75d,_0x1798c2){_0x16a75d=_0x16a75d-0x0;var _0x518e1e=_0x01a2[_0x16a75d];return _0x518e1e;};'use strict';var _=require(_0x201a('0x0'));var utils=require(_0x201a('0x1'));var logger=require(_0x201a('0x2'))('routing');var rpc={'chatMessage':require(_0x201a('0x3')),'openchannelMessage':require(_0x201a('0x4')),'mailMessage':require(_0x201a('0x5')),'smsMessage':require(_0x201a('0x6')),'faxMessage':require(_0x201a('0x7')),'whatsappMessage':require(_0x201a('0x8'))};exports[_0x201a('0x9')]=function(_0x1056c2,_0x332402){return function(_0x1409b8){try{var _0x287a0a={'body':utils['getMustacheRender'](_0x332402[0x0],this),'ContactId':this['contact']['id']};if(this[_0x201a('0xa')]===_0x201a('0xb')){_0x287a0a[_0x201a('0xc')]=this[_0x201a('0xd')]['id'];}else{_0x287a0a[_['upperFirst'](this[_0x201a('0xa')])+_0x201a('0xe')]=this[_0x201a('0xd')]['id'];}_0x287a0a[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x201a('0xf')]['id'];if(rpc[this[_0x201a('0xa')]+_0x201a('0x10')]){return rpc[this[_0x201a('0xa')]+_0x201a('0x10')][_0x201a('0x11')](_0x287a0a)['then'](function(_0x119e81){logger[_0x201a('0x12')](_0x201a('0x13'),_0x1056c2,_0x287a0a[_0x201a('0x14')]);_0x1409b8['next']();})['catch'](function(_0x3f7831){logger['error'](_0x201a('0x13'),_0x1056c2,JSON['stringify'](_0x3f7831));_0x1409b8[_0x201a('0x15')]();});}}catch(_0x4f842f){logger[_0x201a('0x16')](_0x201a('0x13'),_0x1056c2,JSON[_0x201a('0x17')](_0x4f842f));_0x1409b8['stop']();}};}; \ No newline at end of file +var _0xa8ea=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','account','upperFirst','interaction','Message','create','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0x377424,_0x1856b2){var _0x5e3633=function(_0x110f62){while(--_0x110f62){_0x377424['push'](_0x377424['shift']());}};_0x5e3633(++_0x1856b2);}(_0xa8ea,0xfb));var _0xaa8e=function(_0xe6729b,_0x2f2954){_0xe6729b=_0xe6729b-0x0;var _0x1fa263=_0xa8ea[_0xe6729b];return _0x1fa263;};'use strict';var _=require(_0xaa8e('0x0'));var utils=require(_0xaa8e('0x1'));var logger=require(_0xaa8e('0x2'))(_0xaa8e('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa8e('0x4')),'mailMessage':require(_0xaa8e('0x5')),'smsMessage':require(_0xaa8e('0x6')),'faxMessage':require(_0xaa8e('0x7')),'whatsappMessage':require(_0xaa8e('0x8'))};exports[_0xaa8e('0x9')]=function(_0x1f2ac2,_0x2348d5){return function(_0x478702){try{var _0x1be20d={'body':utils['getMustacheRender'](_0x2348d5[0x0],this),'ContactId':this[_0xaa8e('0xa')]['id']};if(this[_0xaa8e('0xb')]==='chat'){_0x1be20d['ChatWebsiteId']=this['account']['id'];}else{_0x1be20d[_['upperFirst'](this[_0xaa8e('0xb')])+'AccountId']=this[_0xaa8e('0xc')]['id'];}_0x1be20d[_[_0xaa8e('0xd')](this['channel'])+'InteractionId']=this[_0xaa8e('0xe')]['id'];if(rpc[this[_0xaa8e('0xb')]+'Message']){return rpc[this[_0xaa8e('0xb')]+_0xaa8e('0xf')][_0xaa8e('0x10')](_0x1be20d)[_0xaa8e('0x11')](function(_0xc80d99){logger[_0xaa8e('0x12')]('[%s][MESSAGE]\x20%s',_0x1f2ac2,_0x1be20d['body']);_0x478702[_0xaa8e('0x13')]();})[_0xaa8e('0x14')](function(_0x4d6620){logger[_0xaa8e('0x15')](_0xaa8e('0x16'),_0x1f2ac2,JSON['stringify'](_0x4d6620));_0x478702['stop']();});}}catch(_0xbee306){logger[_0xaa8e('0x15')](_0xaa8e('0x16'),_0x1f2ac2,JSON[_0xaa8e('0x17')](_0xbee306));_0x478702[_0xaa8e('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 9249f36..1fd9b62 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 _0xa1bb=['stringify','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x1a9f06,_0x33a13e){var _0x4a7115=function(_0x49a285){while(--_0x49a285){_0x1a9f06['push'](_0x1a9f06['shift']());}};_0x4a7115(++_0x33a13e);}(_0xa1bb,0x157));var _0xba1b=function(_0x544a5b,_0x2cc233){_0x544a5b=_0x544a5b-0x0;var _0x1da12b=_0xa1bb[_0x544a5b];return _0x1da12b;};'use strict';var utils=require(_0xba1b('0x0'));var logger=require('../../../../config/logger')(_0xba1b('0x1'));exports[_0xba1b('0x2')]=function(_0x298926,_0x1c820b){return function(_0x2fc2c9){try{logger[_0xba1b('0x3')](_0xba1b('0x4'),_0x298926,utils[_0xba1b('0x5')](_0x1c820b[0x0],this));_0x2fc2c9[_0xba1b('0x6')]();}catch(_0x22b65d){logger[_0xba1b('0x7')](_0xba1b('0x4'),_0x298926,JSON[_0xba1b('0x8')](_0x22b65d));_0x2fc2c9['stop']();}};}; \ No newline at end of file +var _0x7197=['info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0xf48431,_0x485b88){var _0x3ab7a3=function(_0x3ce86b){while(--_0x3ce86b){_0xf48431['push'](_0xf48431['shift']());}};_0x3ab7a3(++_0x485b88);}(_0x7197,0xc4));var _0x7719=function(_0xf1d02b,_0x37d5db){_0xf1d02b=_0xf1d02b-0x0;var _0x46dcf3=_0x7197[_0xf1d02b];return _0x46dcf3;};'use strict';var utils=require(_0x7719('0x0'));var logger=require(_0x7719('0x1'))(_0x7719('0x2'));exports[_0x7719('0x3')]=function(_0x4c426e,_0x4f0e59){return function(_0xb2c3cf){try{logger[_0x7719('0x4')]('[%s][NOOP]\x20%s',_0x4c426e,utils[_0x7719('0x5')](_0x4f0e59[0x0],this));_0xb2c3cf['next']();}catch(_0x18d74f){logger[_0x7719('0x6')](_0x7719('0x7'),_0x4c426e,JSON[_0x7719('0x8')](_0x18d74f));_0xb2c3cf[_0x7719('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 93f3bff..d8b68d9 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 _0x8dd7=['InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','error','toLowerCase','consequence','validate','length','map','join','find','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','socket.io-emitter','redis','queue','from','joinAt','emit','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','QueueId','upperFirst'];(function(_0x2b8b73,_0x51250e){var _0xaa37b7=function(_0x3f2ba2){while(--_0x3f2ba2){_0x2b8b73['push'](_0x2b8b73['shift']());}};_0xaa37b7(++_0x51250e);}(_0x8dd7,0x154));var _0x78dd=function(_0x58581e,_0x3a3aef){_0x58581e=_0x58581e-0x0;var _0x1a0645=_0x8dd7[_0x58581e];return _0x1a0645;};'use strict';var schema=require('validate');var _=require(_0x78dd('0x0'));var util=require(_0x78dd('0x1'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x78dd('0x2'));var config=require(_0x78dd('0x3'));var logger=require(_0x78dd('0x4'))(_0x78dd('0x5'));var strategy=require(_0x78dd('0x6'));config['redis']=_[_0x78dd('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x78dd('0x8'))(new Redis(config[_0x78dd('0x9')]));var attributes=['id','queue_id','account',_0x78dd('0xa'),_0x78dd('0xb'),_0x78dd('0xc')];function emit(_0x18f333,_0x3fc9de,_0x209271){io['to'](_0x18f333)[_0x78dd('0xd')](_0x3fc9de,_0x209271);}function emitChannelQueueInteraction(_0x127c94,_0x54d3c7,_0x2ee846,_0x53c8fa,_0x275104,_0x28ec05,_0x398303,_0x29ced1){var _0x25989e=_['clone'](_0x2ee846);_0x25989e['queue_id']=_0x29ced1;_0x25989e['queue']=_0x54d3c7;_0x25989e[_0x78dd('0xe')]=_0x53c8fa;_0x25989e['id']=_0x275104;if(_0x28ec05){_0x398303[util[_0x78dd('0xf')](_0x78dd('0x10'),_0x127c94)][_0x275104]=_[_0x78dd('0x11')](_0x25989e,attributes);}else{delete _0x398303[util[_0x78dd('0xf')](_0x78dd('0x10'),_0x127c94)][_0x275104];}emit(util[_0x78dd('0xf')](_0x78dd('0x12'),_0x127c94,_0x54d3c7),util[_0x78dd('0xf')](_0x78dd('0x13'),_0x127c94,_0x28ec05?_0x78dd('0x14'):_0x78dd('0x15')),_['pick'](_0x25989e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x78dd('0x16')),'chatQueueReport':require(_0x78dd('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x78dd('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x78dd('0x19')},'timeout':{'type':_0x78dd('0x1a'),'message':_0x78dd('0x1b')}});function startRouting(_0x38a88c,_0x1ced61,_0xb9e6f2,_0x587786){if(_0x38a88c&&_0x1ced61&&_0xb9e6f2){_0x1ced61[_0x78dd('0x1c')]+=0x1;var _0x5e871e={'uniqueid':_0x38a88c,'from':_0xb9e6f2[_0x78dd('0x1d')]?_0xb9e6f2[_0x78dd('0x1d')][_0x78dd('0xb')]:'','joinAt':moment()[_0x78dd('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb9e6f2[_0x78dd('0x1e')]?_0xb9e6f2[_0x78dd('0x1e')]['id']:null,'ListId':_0xb9e6f2['list']?_0xb9e6f2[_0x78dd('0x1f')]['id']:null};_0x5e871e[_['upperFirst'](_0xb9e6f2[_0x78dd('0x20')])+_0x78dd('0x21')]=_0x1ced61['id']||null;_0x5e871e[_[_0x78dd('0x22')](_0xb9e6f2[_0x78dd('0x20')])+_0x78dd('0x23')]=_0xb9e6f2[_0x78dd('0x24')]?_0xb9e6f2[_0x78dd('0x24')]['id']:null;_0x5e871e[_[_0x78dd('0x22')](_0xb9e6f2[_0x78dd('0x20')])+_0x78dd('0x25')]=_0xb9e6f2['message']?_0xb9e6f2[_0x78dd('0x26')]['id']:null;_0x5e871e[_[_0x78dd('0x22')](_0xb9e6f2[_0x78dd('0x20')])+(_0xb9e6f2[_0x78dd('0x20')]!==_0x78dd('0x27')?_0x78dd('0x28'):_0x78dd('0x29'))]=_0xb9e6f2[_0x78dd('0xe')]?_0xb9e6f2['account']['id']:null;logger[_0x78dd('0x2a')](util[_0x78dd('0xf')]('[%s][START:QUEUE][NAME:%s]',_0x38a88c,_0x1ced61[_0x78dd('0x2b')]));emitChannelQueueInteraction(_0xb9e6f2[_0x78dd('0x20')],_0x1ced61[_0x78dd('0x2b')],_0x5e871e,_0xb9e6f2[_0x78dd('0xe')][_0x78dd('0x2b')],_0xb9e6f2[_0x78dd('0x26')]['id'],!![],_0x587786,_0x1ced61['id']);if(rpc[_0xb9e6f2[_0x78dd('0x20')]+_0x78dd('0x2c')]){return rpc[_0xb9e6f2[_0x78dd('0x20')]+'QueueReport'][_0x78dd('0x2d')](_0x5e871e)[_0x78dd('0x2e')](function(_0x258a1c){logger['error'](_0x78dd('0x2f'));});}}}function stopRouting(_0x374f96,_0x51ecdb,_0x3652d4,_0x135b21){if(_0x374f96&&_0x51ecdb){_0x51ecdb['waiting']-=0x1;var _0x36b06b={'leaveAt':moment()[_0x78dd('0xf')](_0x78dd('0x30')),'acceptAt':moment()[_0x78dd('0xf')](_0x78dd('0x30')),'reason':_0x78dd('0x31')};logger[_0x78dd('0x2a')](util['format'](_0x78dd('0x32'),_0x374f96,_0x51ecdb[_0x78dd('0x2b')]));emitChannelQueueInteraction(_0x3652d4[_0x78dd('0x20')],_0x51ecdb['name'],_0x3652d4[_0x78dd('0x1d')],_0x3652d4[_0x78dd('0xe')][_0x78dd('0x2b')],_0x3652d4[_0x78dd('0x26')]['id'],![],_0x135b21,_0x51ecdb['id']);if(rpc[_0x3652d4['channel']+'QueueReport']){return rpc[_0x3652d4[_0x78dd('0x20')]+_0x78dd('0x2c')]['update'](_0x374f96,_0x36b06b)[_0x78dd('0x2e')](function(_0x4f8473){logger['error'](_0x78dd('0x33'));});}}}function endRouting(_0x1f43ed,_0x4fc6e2,_0x4af716,_0x195995){if(_0x1f43ed&&_0x4fc6e2){_0x4fc6e2[_0x78dd('0x1c')]-=0x1;var _0x20f814={'leaveAt':moment()[_0x78dd('0xf')](_0x78dd('0x30')),'exitAt':moment()['format'](_0x78dd('0x30')),'reason':'timeout'};logger['info'](util['format'](_0x78dd('0x34'),_0x1f43ed,_0x4fc6e2[_0x78dd('0x2b')]));emitChannelQueueInteraction(_0x4af716[_0x78dd('0x20')],_0x4fc6e2['name'],_0x4af716[_0x78dd('0x1d')],_0x4af716[_0x78dd('0xe')][_0x78dd('0x2b')],_0x4af716['message']['id'],![],_0x195995);if(rpc[_0x4af716[_0x78dd('0x20')]+'QueueReport']){return rpc[_0x4af716[_0x78dd('0x20')]+_0x78dd('0x2c')][_0x78dd('0x35')](_0x1f43ed,_0x20f814)[_0x78dd('0x2e')](function(_0x18fabf){logger[_0x78dd('0x36')](_0x78dd('0x33'));});}}}function handleFindQueue(_0x3cea48){return function(_0x502c16){return _0x502c16[_0x78dd('0x2b')][_0x78dd('0x37')]()===_0x3cea48[_0x78dd('0x37')]();};}exports[_0x78dd('0x38')]=function(_0x57f8c5,_0xc9ae4d,_0xcbb9c,_0x28a839){return function(_0x30c52c){try{var _0x178abb={'name':_0xc9ae4d[0x0],'timeout':_0xc9ae4d[0x1]};var _0x51b1da=queue[_0x78dd('0x39')](_0x178abb,{'typecast':!![]});if(_0x51b1da[_0x78dd('0x3a')]){logger['error']('[%s][QUEUE]\x20%s',_0x57f8c5,_[_0x78dd('0x3b')](_0x51b1da,_0x78dd('0x26'))[_0x78dd('0x3c')](',\x20'));_0x30c52c['stop']();}else{var _0x47f6fd=_[_0x78dd('0x3d')](_0xcbb9c[_0x28a839['channel']+'Queues'],handleFindQueue(_0x178abb['name']));if(_0x47f6fd){startRouting(_0x57f8c5,_0x47f6fd,_0x28a839,_0xcbb9c);var _0x3de330=(_0x47f6fd[_0x78dd('0x3e')]||0xa)*0x3e8;var _0x4bd7de=(_0x178abb[_0x78dd('0x3e')]||0x14)*0x3e8;var _0x37269e,_0x347b60;if(_0x3de330>_0x4bd7de){_0x4bd7de=_0x3de330;}var _0xb261f2=seqqueue['createQueue'](_0x3de330);_0xb261f2['id']=_0x57f8c5;_0xb261f2['atimeout']=_0x3de330;_0xb261f2[_0x78dd('0x3f')]=_0x4bd7de;_0xb261f2[_0x78dd('0x20')]=_0x28a839['channel'];_0xcbb9c[_0x78dd('0x40')][_0x57f8c5]['on'](_0x78dd('0x41'),function(){logger[_0x78dd('0x2a')](_0x78dd('0x42'),_0x57f8c5);stopRouting(_0x57f8c5,_0x47f6fd,_0x28a839,_0xcbb9c);clearTimeout(_0x37269e);_0x37269e=undefined;_0xb261f2[_0x78dd('0x43')](!![]);if(_0xcbb9c[_0x78dd('0x40')][_0x57f8c5]){delete _0xcbb9c['rules'][_0x57f8c5];}_0x30c52c[_0x78dd('0x44')]();});_0xcbb9c[_0x78dd('0x40')][_0x57f8c5]['on'](_0x78dd('0x45'),function(){if(_0xcbb9c['rules'][_0x57f8c5]){delete _0xcbb9c[_0x78dd('0x40')][_0x57f8c5];}});_0x37269e=setTimeout(function(){logger['info'](_0x78dd('0x46'),_0x57f8c5);endRouting(_0x57f8c5,_0x47f6fd,_0x28a839,_0xcbb9c);clearTimeout(_0x37269e);_0xb261f2['close'](!![]);_0x30c52c['next']();},_0x4bd7de);switch(_0x47f6fd['strategy']){case _0x78dd('0x47'):strategy['rrmemory'](_0xb261f2,_0x47f6fd,_0xcbb9c,_0x28a839);break;default:strategy['beepall'](_0xb261f2,_0x47f6fd,_0xcbb9c,_0x28a839);}}else{logger['error'](_0x78dd('0x48'),_0x57f8c5,_0x178abb[_0x78dd('0x2b')]);_0x30c52c[_0x78dd('0x44')]();}}}catch(_0x4ca2d){console[_0x78dd('0x49')](_0x4ca2d);logger[_0x78dd('0x36')]('[%s][QUEUE]\x20%s',_0x57f8c5,_0x4ca2d[_0x78dd('0x4a')]);_0x30c52c['stop']();}};}; \ No newline at end of file +var _0x6bb0=['name','QueueReport','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x6bb0,0x10c));var _0x06bb=function(_0x3efb4a,_0x138612){_0x3efb4a=_0x3efb4a-0x0;var _0x1124b3=_0x6bb0[_0x3efb4a];return _0x1124b3;};'use strict';var schema=require(_0x06bb('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x06bb('0x1'));var moment=require(_0x06bb('0x2'));var Redis=require(_0x06bb('0x3'));var config=require(_0x06bb('0x4'));var logger=require(_0x06bb('0x5'))(_0x06bb('0x6'));var strategy=require(_0x06bb('0x7'));config['redis']=_['defaults'](config[_0x06bb('0x8')],{'host':_0x06bb('0x9'),'port':0x18eb});var io=require(_0x06bb('0xa'))(new Redis(config[_0x06bb('0x8')]));var attributes=['id',_0x06bb('0xb'),'account',_0x06bb('0xc'),'from',_0x06bb('0xd')];function emit(_0x3ba72f,_0x41d9e0,_0x5db15a){io['to'](_0x3ba72f)[_0x06bb('0xe')](_0x41d9e0,_0x5db15a);}function emitChannelQueueInteraction(_0x3e1967,_0x34bba1,_0x5420ae,_0x145066,_0x43643d,_0x202738,_0xdce993,_0x706e8f){var _0x72b971=_[_0x06bb('0xf')](_0x5420ae);_0x72b971['queue_id']=_0x706e8f;_0x72b971[_0x06bb('0xc')]=_0x34bba1;_0x72b971['account']=_0x145066;_0x72b971['id']=_0x43643d;if(_0x202738){_0xdce993[util[_0x06bb('0x10')]('%sQueuesWaitingInteractions',_0x3e1967)][_0x43643d]=_[_0x06bb('0x11')](_0x72b971,attributes);}else{delete _0xdce993[util[_0x06bb('0x10')](_0x06bb('0x12'),_0x3e1967)][_0x43643d];}emit(util[_0x06bb('0x10')](_0x06bb('0x13'),_0x3e1967,_0x34bba1),util[_0x06bb('0x10')](_0x06bb('0x14'),_0x3e1967,_0x202738?'save':'remove'),_[_0x06bb('0x11')](_0x72b971,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x06bb('0x15')),'chatQueueReport':require(_0x06bb('0x16')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x06bb('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x06bb('0x18'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x06bb('0x19'),'message':_0x06bb('0x1a')}});function startRouting(_0x1e9e22,_0xbf6954,_0x581168,_0x4c8fc0){if(_0x1e9e22&&_0xbf6954&&_0x581168){_0xbf6954[_0x06bb('0x1b')]+=0x1;var _0xfc0078={'uniqueid':_0x1e9e22,'from':_0x581168[_0x06bb('0x1c')]?_0x581168[_0x06bb('0x1c')][_0x06bb('0x1d')]:'','joinAt':moment()[_0x06bb('0x10')](_0x06bb('0x1e')),'ContactId':_0x581168[_0x06bb('0x1f')]?_0x581168[_0x06bb('0x1f')]['id']:null,'ListId':_0x581168[_0x06bb('0x20')]?_0x581168[_0x06bb('0x20')]['id']:null};_0xfc0078[_[_0x06bb('0x21')](_0x581168[_0x06bb('0x22')])+'QueueId']=_0xbf6954['id']||null;_0xfc0078[_[_0x06bb('0x21')](_0x581168[_0x06bb('0x22')])+_0x06bb('0x23')]=_0x581168[_0x06bb('0x24')]?_0x581168[_0x06bb('0x24')]['id']:null;_0xfc0078[_['upperFirst'](_0x581168[_0x06bb('0x22')])+_0x06bb('0x25')]=_0x581168[_0x06bb('0x26')]?_0x581168[_0x06bb('0x26')]['id']:null;_0xfc0078[_[_0x06bb('0x21')](_0x581168[_0x06bb('0x22')])+(_0x581168['channel']!==_0x06bb('0x27')?'AccountId':_0x06bb('0x28'))]=_0x581168[_0x06bb('0x29')]?_0x581168['account']['id']:null;logger[_0x06bb('0x2a')](util[_0x06bb('0x10')](_0x06bb('0x2b'),_0x1e9e22,_0xbf6954[_0x06bb('0x2c')]));emitChannelQueueInteraction(_0x581168[_0x06bb('0x22')],_0xbf6954[_0x06bb('0x2c')],_0xfc0078,_0x581168[_0x06bb('0x29')][_0x06bb('0x2c')],_0x581168['message']['id'],!![],_0x4c8fc0,_0xbf6954['id']);if(rpc[_0x581168[_0x06bb('0x22')]+'QueueReport']){return rpc[_0x581168[_0x06bb('0x22')]+_0x06bb('0x2d')]['create'](_0xfc0078)[_0x06bb('0x2e')](function(_0x497422){logger['error'](_0x06bb('0x2f'));});}}}function stopRouting(_0x2a2a8f,_0x5a665a,_0x5a624e,_0x44d00b){if(_0x2a2a8f&&_0x5a665a){_0x5a665a[_0x06bb('0x1b')]-=0x1;var _0x429dc6={'leaveAt':moment()[_0x06bb('0x10')](_0x06bb('0x1e')),'acceptAt':moment()['format'](_0x06bb('0x1e')),'reason':_0x06bb('0x30')};logger[_0x06bb('0x2a')](util[_0x06bb('0x10')](_0x06bb('0x31'),_0x2a2a8f,_0x5a665a[_0x06bb('0x2c')]));emitChannelQueueInteraction(_0x5a624e[_0x06bb('0x22')],_0x5a665a[_0x06bb('0x2c')],_0x5a624e[_0x06bb('0x1c')],_0x5a624e[_0x06bb('0x29')][_0x06bb('0x2c')],_0x5a624e[_0x06bb('0x26')]['id'],![],_0x44d00b,_0x5a665a['id']);if(rpc[_0x5a624e[_0x06bb('0x22')]+'QueueReport']){return rpc[_0x5a624e['channel']+_0x06bb('0x2d')][_0x06bb('0x32')](_0x2a2a8f,_0x429dc6)['catch'](function(_0x1227dc){logger[_0x06bb('0x33')](_0x06bb('0x34'));});}}}function endRouting(_0x41f32f,_0x1a816f,_0x2c928c,_0x205d29){if(_0x41f32f&&_0x1a816f){_0x1a816f[_0x06bb('0x1b')]-=0x1;var _0x3ebc34={'leaveAt':moment()['format'](_0x06bb('0x1e')),'exitAt':moment()[_0x06bb('0x10')](_0x06bb('0x1e')),'reason':'timeout'};logger['info'](util[_0x06bb('0x10')](_0x06bb('0x35'),_0x41f32f,_0x1a816f[_0x06bb('0x2c')]));emitChannelQueueInteraction(_0x2c928c['channel'],_0x1a816f[_0x06bb('0x2c')],_0x2c928c[_0x06bb('0x1c')],_0x2c928c[_0x06bb('0x29')][_0x06bb('0x2c')],_0x2c928c[_0x06bb('0x26')]['id'],![],_0x205d29);if(rpc[_0x2c928c[_0x06bb('0x22')]+'QueueReport']){return rpc[_0x2c928c[_0x06bb('0x22')]+_0x06bb('0x2d')]['update'](_0x41f32f,_0x3ebc34)[_0x06bb('0x2e')](function(_0x117d88){logger['error'](_0x06bb('0x34'));});}}}function handleFindQueue(_0x124de9){return function(_0x497f0a){return _0x497f0a['name']['toLowerCase']()===_0x124de9[_0x06bb('0x36')]();};}exports[_0x06bb('0x37')]=function(_0x184c1e,_0x126b02,_0xf9f1da,_0x202ce7){return function(_0xc4e682){try{var _0x423d9e={'name':_0x126b02[0x0],'timeout':_0x126b02[0x1]};var _0x57d737=queue[_0x06bb('0x0')](_0x423d9e,{'typecast':!![]});if(_0x57d737[_0x06bb('0x38')]){logger[_0x06bb('0x33')](_0x06bb('0x39'),_0x184c1e,_[_0x06bb('0x3a')](_0x57d737,_0x06bb('0x26'))[_0x06bb('0x3b')](',\x20'));_0xc4e682[_0x06bb('0x3c')]();}else{var _0x48f948=_[_0x06bb('0x3d')](_0xf9f1da[_0x202ce7[_0x06bb('0x22')]+'Queues'],handleFindQueue(_0x423d9e[_0x06bb('0x2c')]));if(_0x48f948){startRouting(_0x184c1e,_0x48f948,_0x202ce7,_0xf9f1da);var _0x4a7f2b=(_0x48f948[_0x06bb('0x3e')]||0xa)*0x3e8;var _0x574bc0=(_0x423d9e[_0x06bb('0x3e')]||0x14)*0x3e8;var _0x2c9b76,_0x768b3e;if(_0x4a7f2b>_0x574bc0){_0x574bc0=_0x4a7f2b;}var _0xea2e32=seqqueue[_0x06bb('0x3f')](_0x4a7f2b);_0xea2e32['id']=_0x184c1e;_0xea2e32['atimeout']=_0x4a7f2b;_0xea2e32[_0x06bb('0x40')]=_0x574bc0;_0xea2e32['channel']=_0x202ce7[_0x06bb('0x22')];_0xf9f1da[_0x06bb('0x41')][_0x184c1e]['on'](_0x06bb('0x42'),function(){logger[_0x06bb('0x2a')](_0x06bb('0x43'),_0x184c1e);stopRouting(_0x184c1e,_0x48f948,_0x202ce7,_0xf9f1da);clearTimeout(_0x2c9b76);_0x2c9b76=undefined;_0xea2e32[_0x06bb('0x44')](!![]);if(_0xf9f1da['rules'][_0x184c1e]){delete _0xf9f1da['rules'][_0x184c1e];}_0xc4e682[_0x06bb('0x3c')]();});_0xf9f1da['rules'][_0x184c1e]['on'](_0x06bb('0x45'),function(){if(_0xf9f1da[_0x06bb('0x41')][_0x184c1e]){delete _0xf9f1da[_0x06bb('0x41')][_0x184c1e];}});_0x2c9b76=setTimeout(function(){logger['info'](_0x06bb('0x46'),_0x184c1e);endRouting(_0x184c1e,_0x48f948,_0x202ce7,_0xf9f1da);clearTimeout(_0x2c9b76);_0xea2e32[_0x06bb('0x44')](!![]);_0xc4e682[_0x06bb('0x47')]();},_0x574bc0);switch(_0x48f948[_0x06bb('0x48')]){case'rrmemory':strategy[_0x06bb('0x49')](_0xea2e32,_0x48f948,_0xf9f1da,_0x202ce7);break;default:strategy[_0x06bb('0x4a')](_0xea2e32,_0x48f948,_0xf9f1da,_0x202ce7);}}else{logger[_0x06bb('0x33')](_0x06bb('0x4b'),_0x184c1e,_0x423d9e[_0x06bb('0x2c')]);_0xc4e682[_0x06bb('0x3c')]();}}}catch(_0x424f25){console[_0x06bb('0x4c')](_0x424f25);logger[_0x06bb('0x33')](_0x06bb('0x39'),_0x184c1e,_0x424f25[_0x06bb('0x4d')]);_0xc4e682[_0x06bb('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 94469cb..d058ea5 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 _0x4ce1=['handleDrained','prototype','info','agent','isNil','agents','isAgentAvailable','channel','busyQueue','showNotification','writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','push','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun','bind','timeout','handleTimeout'];(function(_0xe52f9c,_0x42d87a){var _0x5115a9=function(_0x14430b){while(--_0x14430b){_0xe52f9c['push'](_0xe52f9c['shift']());}};_0x5115a9(++_0x42d87a);}(_0x4ce1,0xd6));var _0x14ce=function(_0xe659c6,_0x5ac357){_0xe659c6=_0xe659c6-0x0;var _0x3cecd1=_0x4ce1[_0xe659c6];return _0x3cecd1;};'use strict';var _=require(_0x14ce('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x14ce('0x1'))(_0x14ce('0x2'));var Agent=function(_0x583823,_0x28fa43,_0x6b00c6,_0x1e2059){this[_0x14ce('0x3')]=uuid['v4']();this[_0x14ce('0x4')]=_0x583823;this['agent']=_0x28fa43;this[_0x14ce('0x5')]=_0x6b00c6;this[_0x14ce('0x2')]=_0x1e2059;this['squeue']['push'](this[_0x14ce('0x6')][_0x14ce('0x7')](this),this['handleTimeout']['bind'](this));this[_0x14ce('0x4')]['on'](_0x14ce('0x8'),this[_0x14ce('0x9')][_0x14ce('0x7')](this));this[_0x14ce('0x4')]['on']('drained',this[_0x14ce('0xa')][_0x14ce('0x7')](this));};Agent[_0x14ce('0xb')]['push']=function(){this[_0x14ce('0x4')]['push'](this['handleRun'][_0x14ce('0x7')](this),this[_0x14ce('0x9')][_0x14ce('0x7')](this));};Agent[_0x14ce('0xb')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x14ce('0xb')][_0x14ce('0x6')]=function(_0x3f1163){logger[_0x14ce('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x14ce('0x4')]['id'],this[_0x14ce('0xd')]['id']);if(_[_0x14ce('0xe')](this[_0x14ce('0x5')][_0x14ce('0xf')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x14ce('0xd')]['id']);setTimeout(this['push'][_0x14ce('0x7')](this),0x3e8);}else{if(this[_0x14ce('0x2')]['forcedOwnership']||util[_0x14ce('0x10')](this['squeue']['id'],this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']],this[_0x14ce('0x4')][_0x14ce('0x11')],![])){this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']]['busy']=!![];this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']][_0x14ce('0x12')]=undefined;util[_0x14ce('0x13')](this[_0x14ce('0x3')],this['squeue']['id'],this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']],null,this[_0x14ce('0x2')]);util[_0x14ce('0x14')](this['squeue']['id'],this[_0x14ce('0x5')]['agents'][this[_0x14ce('0xd')]['id']],'RINGING'+(this[_0x14ce('0x2')][_0x14ce('0x15')]?_0x14ce('0x16'):''));}else{logger[_0x14ce('0xc')](_0x14ce('0x17'),this[_0x14ce('0x4')]['id'],this[_0x14ce('0xd')]['id']);setTimeout(this['push'][_0x14ce('0x7')](this),0x3e8);}}};Agent[_0x14ce('0xb')][_0x14ce('0x9')]=function(_0x44d32c){if(_[_0x14ce('0xe')](this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']])){return logger['info'](_0x14ce('0x18'),this[_0x14ce('0x4')]['id'],this[_0x14ce('0xd')]['id']);}else{logger[_0x14ce('0xc')](_0x14ce('0x19'),this[_0x14ce('0x4')]['id'],this[_0x14ce('0xd')]['id']);util[_0x14ce('0x1a')](this[_0x14ce('0x3')],this[_0x14ce('0x4')]['id'],this[_0x14ce('0x5')][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']],null,this['routing']);this[_0x14ce('0x5')]['agents'][this[_0x14ce('0xd')]['id']][_0x14ce('0x1b')]=![];this['realtime'][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']][_0x14ce('0x12')]=undefined;util['writeLog'](this['squeue']['id'],this['realtime'][_0x14ce('0xf')][this[_0x14ce('0xd')]['id']],_0x44d32c?_0x14ce('0x1c'):_0x14ce('0x1d'));}if(!_0x44d32c){setTimeout(this[_0x14ce('0x1e')][_0x14ce('0x7')](this),0x3e8);}};function agent(_0x3d74ee,_0x42bf33,_0x5b818c,_0x4bcc8d){return new Agent(_0x3d74ee,_0x42bf33,_0x5b818c,_0x4bcc8d);}module[_0x14ce('0x1f')]=agent; \ No newline at end of file +var _0x09c5=['isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','notificationId','squeue','realtime','routing','push','bind','handleTimeout','timeout','drained','prototype','handleDrained','info','agent'];(function(_0x244554,_0x2ac9c5){var _0x5a372b=function(_0x177844){while(--_0x177844){_0x244554['push'](_0x244554['shift']());}};_0x5a372b(++_0x2ac9c5);}(_0x09c5,0xe2));var _0x509c=function(_0xb40c4f,_0x5231f2){_0xb40c4f=_0xb40c4f-0x0;var _0x1d5f81=_0x09c5[_0xb40c4f];return _0x1d5f81;};'use strict';var _=require(_0x509c('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x42d938,_0x5b7aed,_0x3d047b,_0x3dedc3){this[_0x509c('0x1')]=uuid['v4']();this[_0x509c('0x2')]=_0x42d938;this['agent']=_0x5b7aed;this[_0x509c('0x3')]=_0x3d047b;this[_0x509c('0x4')]=_0x3dedc3;this[_0x509c('0x2')][_0x509c('0x5')](this['handleRun'][_0x509c('0x6')](this),this[_0x509c('0x7')]['bind'](this));this[_0x509c('0x2')]['on'](_0x509c('0x8'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x509c('0x9'),this['handleDrained'][_0x509c('0x6')](this));};Agent[_0x509c('0xa')][_0x509c('0x5')]=function(){this[_0x509c('0x2')][_0x509c('0x5')](this['handleRun']['bind'](this),this[_0x509c('0x7')]['bind'](this));};Agent[_0x509c('0xa')][_0x509c('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x509c('0xa')]['handleRun']=function(_0x2f2f02){logger[_0x509c('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x509c('0x2')]['id'],this[_0x509c('0xd')]['id']);if(_[_0x509c('0xe')](this[_0x509c('0x3')]['agents'][this[_0x509c('0xd')]['id']])){logger['info'](_0x509c('0xf'),this[_0x509c('0x2')]['id'],this[_0x509c('0xd')]['id']);setTimeout(this[_0x509c('0x5')][_0x509c('0x6')](this),0x3e8);}else{if(this[_0x509c('0x4')][_0x509c('0x10')]||util['isAgentAvailable'](this[_0x509c('0x2')]['id'],this[_0x509c('0x3')][_0x509c('0x11')][this['agent']['id']],this[_0x509c('0x2')][_0x509c('0x12')],![])){this['realtime'][_0x509c('0x11')][this[_0x509c('0xd')]['id']][_0x509c('0x13')]=!![];this['realtime'][_0x509c('0x11')][this[_0x509c('0xd')]['id']][_0x509c('0x14')]=undefined;util['showNotification'](this['notificationId'],this[_0x509c('0x2')]['id'],this[_0x509c('0x3')][_0x509c('0x11')][this[_0x509c('0xd')]['id']],null,this['routing']);util[_0x509c('0x15')](this[_0x509c('0x2')]['id'],this['realtime']['agents'][this[_0x509c('0xd')]['id']],_0x509c('0x16')+(this[_0x509c('0x4')][_0x509c('0x10')]?_0x509c('0x17'):''));}else{logger[_0x509c('0xc')](_0x509c('0x18'),this[_0x509c('0x2')]['id'],this[_0x509c('0xd')]['id']);setTimeout(this[_0x509c('0x5')][_0x509c('0x6')](this),0x3e8);}}};Agent[_0x509c('0xa')][_0x509c('0x7')]=function(_0x3cf8dc){if(_[_0x509c('0xe')](this[_0x509c('0x3')][_0x509c('0x11')][this[_0x509c('0xd')]['id']])){return logger['info'](_0x509c('0xf'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x509c('0xc')](_0x509c('0x19'),this[_0x509c('0x2')]['id'],this[_0x509c('0xd')]['id']);util[_0x509c('0x1a')](this['notificationId'],this[_0x509c('0x2')]['id'],this[_0x509c('0x3')][_0x509c('0x11')][this[_0x509c('0xd')]['id']],null,this[_0x509c('0x4')]);this[_0x509c('0x3')]['agents'][this[_0x509c('0xd')]['id']][_0x509c('0x13')]=![];this[_0x509c('0x3')]['agents'][this['agent']['id']][_0x509c('0x14')]=undefined;util[_0x509c('0x15')](this[_0x509c('0x2')]['id'],this['realtime']['agents'][this[_0x509c('0xd')]['id']],_0x3cf8dc?_0x509c('0x1b'):_0x509c('0x1c'));}if(!_0x3cf8dc){setTimeout(this[_0x509c('0x5')][_0x509c('0x6')](this),0x3e8);}};function agent(_0x212e4f,_0x26cead,_0x406689,_0x4789c9){return new Agent(_0x212e4f,_0x26cead,_0x406689,_0x4789c9);}module[_0x509c('0x1d')]=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 7d12cde..b6eaf6e 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 _0x1c88=['notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing'];(function(_0x34d012,_0x4bb7bc){var _0x2aaaef=function(_0x199c78){while(--_0x199c78){_0x34d012['push'](_0x34d012['shift']());}};_0x2aaaef(++_0x4bb7bc);}(_0x1c88,0x1a9));var _0x81c8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1c88[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x81c8('0x0'));var uuid=require('uuid');var util=require(_0x81c8('0x1'));var logger=require(_0x81c8('0x2'))(_0x81c8('0x3'));var Beepall=function(_0x4da0d8,_0x51a2f7,_0x2bf7b0,_0x4049a1){this[_0x81c8('0x4')]=uuid['v4']();this[_0x81c8('0x5')]=_0x4da0d8;this[_0x81c8('0x6')]=_0x51a2f7;this[_0x81c8('0x7')]=_0x2bf7b0;this[_0x81c8('0x3')]=_0x4049a1;this[_0x81c8('0x5')][_0x81c8('0x8')](this[_0x81c8('0x9')][_0x81c8('0xa')](this),this[_0x81c8('0xb')][_0x81c8('0xa')](this));this['squeue']['on'](_0x81c8('0xc'),this[_0x81c8('0xb')][_0x81c8('0xa')](this));this['squeue']['on']('drained',this[_0x81c8('0xd')][_0x81c8('0xa')](this));};Beepall[_0x81c8('0xe')]['push']=function(){this[_0x81c8('0x5')][_0x81c8('0x8')](this['handleRun'][_0x81c8('0xa')](this),this[_0x81c8('0xb')][_0x81c8('0xa')](this));};Beepall[_0x81c8('0xe')]['handleDrained']=function(_0x1d51e7){this[_0x81c8('0xb')](!![]);};Beepall[_0x81c8('0xe')]['handleRun']=function(_0x1fe26b){var _0x3c2dac=!![];if(!_[_0x81c8('0xf')](this['queue'])&&!_[_0x81c8('0xf')](this[_0x81c8('0x6')][_0x81c8('0x10')])&&this[_0x81c8('0x6')][_0x81c8('0x10')]['length']>0x0){for(var _0x3f7bf3=0x0,_0x423dbe;_0x3f7bf30x0){for(var _0x5d52fc=0x0,_0x72a905;_0x5d52fc0x0&&_0x41c4c8[_0x3a081e+'CurrentCapacity']>=_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]){writeLog(_0x51be9a,_0x41c4c8,_0x3a081e[_0xcc6a('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc6a('0x2a')]=function(_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab){return sendNotification(!![],_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab);};exports[_0xcc6a('0x2b')]=function(_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3){return sendNotification(![],_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3);};exports[_0xcc6a('0x2c')]=writeLog; \ No newline at end of file +var _0x11e5=['\x20interaction','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','defaults','socket.io-emitter','redis','emit','format','user:%s','name'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x11e5,0x8b));var _0x511e=function(_0x246a25,_0x2c0c46){_0x246a25=_0x246a25-0x0;var _0x5996f4=_0x11e5[_0x246a25];return _0x5996f4;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var utils=require(_0x511e('0x1'));var Mustache=require(_0x511e('0x2'));var Redis=require('ioredis');var config=require(_0x511e('0x3'));var logger=require(_0x511e('0x4'))(_0x511e('0x5'));config['redis']=_[_0x511e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x511e('0x7'))(new Redis(config[_0x511e('0x8')]));function emit(_0x466dec,_0x57cac3,_0x47cf56){io['to'](_0x466dec)[_0x511e('0x9')](_0x57cac3,_0x47cf56);}function sendNotification(_0xf0ba86,_0x25deeb,_0x306694,_0x4449c4,_0x30269e,_0x1596b3){io['to'](util[_0x511e('0xa')](_0x511e('0xb'),_0x4449c4[_0x511e('0xc')]))[_0x511e('0x9')]('user:save',_0x4449c4);var _0x7e50db=_0x1596b3||{};var _0x5dd510=_0x306694['split']('.');var _0x3deecc={'uniqueid':_0x25deeb,'channel':_0x5dd510[0x0],'id':_0x5dd510[0x1],'title':_0x5dd510[0x0]+_0x511e('0xd'),'interactionId':_0x5dd510[0x2],'queue':_0x30269e?_0x30269e[_0x511e('0xc')]:null,'sound':_0x7e50db[_0x511e('0xe')][_0x511e('0xf')],'shake':_0x7e50db[_0x511e('0xe')]['notificationShake']};try{if(!_0x7e50db[_0x511e('0x10')]){_0x7e50db[_0x511e('0x10')]={};}if(_0x30269e){_0x7e50db['body'][_0x511e('0x11')]=_0x30269e;}else if(_0x7e50db[_0x511e('0x10')]['queue']){delete _0x7e50db[_0x511e('0x10')][_0x511e('0x11')];}_0x3deecc[_0x511e('0x12')]=utils[_0x511e('0x13')](_0x7e50db['account'][_0x511e('0x14')],_0x7e50db);}catch(_0x2dd346){_0x3deecc[_0x511e('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x511e('0x15')](util['format'](_0x511e('0x16'),_0x25deeb,_0x2dd346['message']));}io['to'](util['format'](_0x511e('0xb'),_0x4449c4['name']))[_0x511e('0x9')](util[_0x511e('0xa')](_0x511e('0x17'),_0xf0ba86?_0x511e('0x18'):_0x511e('0x19')),_0x3deecc);}function writeLog(_0x3d3f46,_0x3723ff,_0x452f20){return logger['info'](util[_0x511e('0xa')](_0x511e('0x1a'),_0x3d3f46,_0x3723ff[_0x511e('0xc')],_0x452f20));}exports[_0x511e('0x1b')]=function(_0xaea29d,_0x18807b,_0x886b6,_0x2f28fc){if(_0x18807b[_0x511e('0x1c')]){writeLog(_0xaea29d,_0x18807b,_0x511e('0x1d'));return![];}if(!_0x18807b['online']){writeLog(_0xaea29d,_0x18807b,'OFFLINE');return![];}if(_0x18807b[_0x886b6+_0x511e('0x1e')]){writeLog(_0xaea29d,_0x18807b,'PAUSE');return![];}if(_0x2f28fc&&_0x18807b[_0x511e('0x1f')](_0x886b6+'Capacity')&&_0x18807b[_0x511e('0x1f')](_0x886b6+_0x511e('0x20'))){if(_0x18807b[_0x886b6+_0x511e('0x21')]>0x0&&_0x18807b[_0x886b6+_0x511e('0x20')]>=_0x18807b[_0x886b6+_0x511e('0x21')]){writeLog(_0xaea29d,_0x18807b,_0x886b6[_0x511e('0x22')]()+_0x511e('0x23'));return![];}}return!![];};exports[_0x511e('0x24')]=function(_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d){return sendNotification(!![],_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d);};exports[_0x511e('0x25')]=function(_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f){return sendNotification(![],_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f);};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 afc34ed..71c944b 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 _0xa588=['[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x2b377e,_0x3712af){var _0x21e450=function(_0x1de10f){while(--_0x1de10f){_0x2b377e['push'](_0x2b377e['shift']());}};_0x21e450(++_0x3712af);}(_0xa588,0xe1));var _0x8a58=function(_0x4f6ea8,_0x191395){_0x4f6ea8=_0x4f6ea8-0x0;var _0x39f538=_0xa588[_0x4f6ea8];return _0x39f538;};'use strict';var schema=require('validate');var sh=require(_0x8a58('0x0'));var _=require(_0x8a58('0x1'));var utils=require(_0x8a58('0x2'));var logger=require(_0x8a58('0x3'))(_0x8a58('0x4'));var system=schema({'command':{'type':_0x8a58('0x5'),'required':!![],'message':_0x8a58('0x6')}});exports[_0x8a58('0x7')]=function(_0x40b4f0,_0x499c17){return function(_0x30f66b){try{var _0x408a4a={'command':_0x499c17[0x0]};var _0x448366=system[_0x8a58('0x8')](_0x408a4a,{'typecast':!![]});if(_0x448366[_0x8a58('0x9')]){logger[_0x8a58('0xa')](_0x8a58('0xb'),_0x40b4f0,_[_0x8a58('0xc')](_0x448366,'message')[_0x8a58('0xd')](',\x20'));logger[_0x8a58('0xe')](_0x8a58('0xf'),_0x40b4f0);_0x30f66b[_0x8a58('0x10')]();}else{var _0x1a43e3=this;var _0x4eab6a=utils[_0x8a58('0x11')](_0x499c17[0x0],this);logger[_0x8a58('0xe')](_0x8a58('0x12'),_0x40b4f0,_0x4eab6a);sh[_0x8a58('0x13')](_['trim'](_0x4eab6a),function(_0x48fb41,_0x256bbd){logger['info'](_0x8a58('0x14'),_0x40b4f0,_0x48fb41);if(_0x48fb41==0x0){var _0xc5d2fa=_0x256bbd['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8a58('0x15')](_0x499c17[0x1])||_[_0x8a58('0x16')](_0x499c17[0x1])){logger['info'](_0x8a58('0x17'),_0x40b4f0);_0x1a43e3[_0x8a58('0x18')][_0x499c17[0x1]]=_0xc5d2fa;}else{logger['info'](_0x8a58('0x19'),_0x40b4f0,_0x499c17[0x1],_0xc5d2fa);_0x1a43e3[_0x8a58('0x18')][_0x499c17[0x1]]=_0xc5d2fa;}}_0x30f66b[_0x8a58('0x10')]();});}}catch(_0x3ff39e){logger[_0x8a58('0xa')](_0x8a58('0xb'),_0x40b4f0,_[_0x8a58('0x1a')](_0x3ff39e)?JSON['stringify'](_0x3ff39e):_0x3ff39e);logger['info'](_0x8a58('0xf'),_0x40b4f0);_0x30f66b[_0x8a58('0x10')]();}};}; \ No newline at end of file +var _0x9cbf=['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','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x262269,_0xf179b4){var _0xbf60c9=function(_0x8554d6){while(--_0x8554d6){_0x262269['push'](_0x262269['shift']());}};_0xbf60c9(++_0xf179b4);}(_0x9cbf,0xad));var _0xf9cb=function(_0x535751,_0x4cc7bd){_0x535751=_0x535751-0x0;var _0x1a8933=_0x9cbf[_0x535751];return _0x1a8933;};'use strict';var schema=require(_0xf9cb('0x0'));var sh=require(_0xf9cb('0x1'));var _=require(_0xf9cb('0x2'));var utils=require(_0xf9cb('0x3'));var logger=require(_0xf9cb('0x4'))(_0xf9cb('0x5'));var system=schema({'command':{'type':_0xf9cb('0x6'),'required':!![],'message':_0xf9cb('0x7')}});exports[_0xf9cb('0x8')]=function(_0x11c3e0,_0x28667a){return function(_0x282d91){try{var _0x2e0647={'command':_0x28667a[0x0]};var _0x5072d8=system[_0xf9cb('0x0')](_0x2e0647,{'typecast':!![]});if(_0x5072d8[_0xf9cb('0x9')]){logger[_0xf9cb('0xa')](_0xf9cb('0xb'),_0x11c3e0,_[_0xf9cb('0xc')](_0x5072d8,_0xf9cb('0xd'))[_0xf9cb('0xe')](',\x20'));logger[_0xf9cb('0xf')](_0xf9cb('0x10'),_0x11c3e0);_0x282d91['next']();}else{var _0x218221=this;var _0x313b4d=utils[_0xf9cb('0x11')](_0x28667a[0x0],this);logger[_0xf9cb('0xf')](_0xf9cb('0x12'),_0x11c3e0,_0x313b4d);sh['exec'](_[_0xf9cb('0x13')](_0x313b4d),function(_0x116377,_0x371d20){logger[_0xf9cb('0xf')](_0xf9cb('0x14'),_0x11c3e0,_0x116377);if(_0x116377==0x0){var _0x41685d=_0x371d20[_0xf9cb('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0xf9cb('0x16')](_0x28667a[0x1])||_[_0xf9cb('0x17')](_0x28667a[0x1])){logger['info'](_0xf9cb('0x18'),_0x11c3e0);_0x218221[_0xf9cb('0x19')][_0x28667a[0x1]]=_0x41685d;}else{logger[_0xf9cb('0xf')](_0xf9cb('0x1a'),_0x11c3e0,_0x28667a[0x1],_0x41685d);_0x218221[_0xf9cb('0x19')][_0x28667a[0x1]]=_0x41685d;}}_0x282d91[_0xf9cb('0x1b')]();});}}catch(_0x2dc65a){logger['error'](_0xf9cb('0xb'),_0x11c3e0,_[_0xf9cb('0x1c')](_0x2dc65a)?JSON[_0xf9cb('0x1d')](_0x2dc65a):_0x2dc65a);logger[_0xf9cb('0xf')](_0xf9cb('0x10'),_0x11c3e0);_0x282d91[_0xf9cb('0x1b')]();}};}; \ 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 fb04341..8244da0 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 _0xcf10=['routing','number','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcf10,0xa7));var _0x0cf1=function(_0x58e582,_0x41b688){_0x58e582=_0x58e582-0x0;var _0x27f1cd=_0xcf10[_0x58e582];return _0x27f1cd;};'use strict';var schema=require(_0x0cf1('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x0cf1('0x1')),'openchannelInteraction':require(_0x0cf1('0x2')),'smsInteraction':require(_0x0cf1('0x3')),'mailInteraction':require(_0x0cf1('0x4')),'faxInteraction':require(_0x0cf1('0x5')),'whatsappInteraction':require(_0x0cf1('0x6'))};var logger=require(_0x0cf1('0x7'))(_0x0cf1('0x8'));var tag=schema({'tag':{'type':_0x0cf1('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x58f7ab,_0x1ed012,_0x1c2318,_0x1abf9f){return function(_0xfd383){try{var _0x16bd12={'tag':_0x1ed012[0x0]};var _0x155fba=tag['validate'](_0x16bd12,{'typecast':!![]});if(_0x155fba[_0x0cf1('0xa')]){logger[_0x0cf1('0xb')](_0x0cf1('0xc'),_0x58f7ab,_[_0x0cf1('0xd')](_0x155fba,_0x0cf1('0xe'))['join'](',\x20'));logger[_0x0cf1('0xf')](_0x0cf1('0x10'),_0x58f7ab);_0xfd383[_0x0cf1('0x11')]();}else{var _0x1dc1fd={'ids':[_0x1ed012[0x0]]};if(rpc[_0x1abf9f[_0x0cf1('0x12')]+'Interaction']){rpc[_0x1abf9f[_0x0cf1('0x12')]+'Interaction'][_0x0cf1('0x13')](_0x1abf9f['interaction']['id'],_0x1dc1fd)['then'](function(_0x27f049){logger[_0x0cf1('0xf')](_0x0cf1('0x14'),_0x58f7ab,_0x1ed012[0x1],_0x1abf9f[_0x0cf1('0x12')],_0x1abf9f['interaction']['id']);})[_0x0cf1('0x15')](function(_0x380e06){logger['error'](_0x0cf1('0xc'),_0x58f7ab,JSON['stringify'](_0x380e06));logger['info'](_0x0cf1('0x10'),_0x58f7ab);})[_0x0cf1('0x16')](function(){_0xfd383[_0x0cf1('0x11')]();});}}}catch(_0x2ca0e7){logger[_0x0cf1('0xb')](_0x0cf1('0xc'),_0x58f7ab,_[_0x0cf1('0x17')](_0x2ca0e7)?JSON[_0x0cf1('0x18')](_0x2ca0e7):_0x2ca0e7);logger['info'](_0x0cf1('0x10'),_0x58f7ab);_0xfd383[_0x0cf1('0x11')]();}};}; \ No newline at end of file +var _0x3b07=['../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3b07,0x1d6));var _0x73b0=function(_0x55d4a0,_0x5165fe){_0x55d4a0=_0x55d4a0-0x0;var _0x282894=_0x3b07[_0x55d4a0];return _0x282894;};'use strict';var schema=require(_0x73b0('0x0'));var _=require(_0x73b0('0x1'));var rpc={'chatInteraction':require(_0x73b0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x73b0('0x3')),'mailInteraction':require(_0x73b0('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x73b0('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x73b0('0x6'),'required':!![],'message':_0x73b0('0x7')}});exports[_0x73b0('0x8')]=function(_0x31d41e,_0x9ad534,_0x21a677,_0x53f564){return function(_0x44d152){try{var _0x38168d={'tag':_0x9ad534[0x0]};var _0x12b013=tag[_0x73b0('0x0')](_0x38168d,{'typecast':!![]});if(_0x12b013['length']){logger['error'](_0x73b0('0x9'),_0x31d41e,_[_0x73b0('0xa')](_0x12b013,_0x73b0('0xb'))[_0x73b0('0xc')](',\x20'));logger[_0x73b0('0xd')](_0x73b0('0xe'),_0x31d41e);_0x44d152[_0x73b0('0xf')]();}else{var _0x260405={'ids':[_0x9ad534[0x0]]};if(rpc[_0x53f564[_0x73b0('0x10')]+_0x73b0('0x11')]){rpc[_0x53f564[_0x73b0('0x10')]+_0x73b0('0x11')][_0x73b0('0x12')](_0x53f564[_0x73b0('0x13')]['id'],_0x260405)[_0x73b0('0x14')](function(_0x2b62bb){logger[_0x73b0('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x31d41e,_0x9ad534[0x1],_0x53f564['channel'],_0x53f564['interaction']['id']);})['catch'](function(_0x56a116){logger[_0x73b0('0x15')](_0x73b0('0x9'),_0x31d41e,JSON[_0x73b0('0x16')](_0x56a116));logger[_0x73b0('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31d41e);})[_0x73b0('0x17')](function(){_0x44d152[_0x73b0('0xf')]();});}}}catch(_0x174e98){logger[_0x73b0('0x15')](_0x73b0('0x9'),_0x31d41e,_[_0x73b0('0x18')](_0x174e98)?JSON[_0x73b0('0x16')](_0x174e98):_0x174e98);logger[_0x73b0('0xd')](_0x73b0('0xe'),_0x31d41e);_0x44d152[_0x73b0('0xf')]();}};}; \ 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 183a660..6825c8f 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0xd7f88b,_0x4e5c6c){var _0x2e0969=function(_0x4e3bfa){while(--_0x4e3bfa){_0xd7f88b['push'](_0xd7f88b['shift']());}};_0x2e0969(++_0x4e5c6c);}(_0xe706,0xa3));var _0x6e70=function(_0x345695,_0x2ba140){_0x345695=_0x345695-0x0;var _0x5002d3=_0xe706[_0x345695];return _0x5002d3;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4b1239,_0x5cbd3a){var _0x56ffd4=function(_0x45b4ba){while(--_0x45b4ba){_0x4b1239['push'](_0x4b1239['shift']());}};_0x56ffd4(++_0x5cbd3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 66c1a8a..f4e26f0 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 _0x29d9=['faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','Intervals','map','IntervalId','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push','slice','join','tag','format','./interval','intervals','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','name','paused','mailQueues','loggedIn','openchannelQueues','waiting','smsQueues','available','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x2f730a,_0x474b8b){var _0x2f1db2=function(_0x598a4c){while(--_0x598a4c){_0x2f730a['push'](_0x2f730a['shift']());}};_0x2f1db2(++_0x474b8b);}(_0x29d9,0x1c2));var _0x929d=function(_0x1c1419,_0x49fd48){_0x1c1419=_0x1c1419-0x0;var _0x245f0d=_0x29d9[_0x1c1419];return _0x245f0d;};'use strict';var _=require(_0x929d('0x0'));var util=require('util');var path=require(_0x929d('0x1'));var fs=require('fs');var jayson=require(_0x929d('0x2'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0x929d('0x3'));var logger=require('../../../config/logger')(_0x929d('0x4'));var rpc={'openchannelQueueReport':require(_0x929d('0x5')),'mailQueueReport':require(_0x929d('0x6')),'chatQueueReport':require(_0x929d('0x7')),'smsQueueReport':require(_0x929d('0x8')),'faxQueueReport':require(_0x929d('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x929d('0xa'));function getId(_0x2a2ffe,_0x2b9edb,_0x4dc265){return util['format'](_0x929d('0xb'),_0x2a2ffe,_0x2b9edb||0x0,_0x4dc265||0x0);}function getIntervals(_0x438126,_0x3dbf98){var _0x81af3d=[];if(!_[_0x929d('0xc')](_0x3dbf98['IntervalId'])&&!_[_0x929d('0xc')](_0x438126[_0x3dbf98['IntervalId']])&&!_[_0x929d('0xc')](_0x438126[_0x3dbf98['IntervalId']][_0x929d('0xd')])){_0x81af3d=_[_0x929d('0xe')](_0x438126[_0x3dbf98[_0x929d('0xf')]]['Intervals'],_0x929d('0x10'));}else if(!_[_0x929d('0xc')](_0x3dbf98['interval'])){_0x81af3d=[_0x3dbf98[_0x929d('0x10')]];}return _0x81af3d;}exports[_0x929d('0x11')]=function(_0x54ae6f){_0x54ae6f[_0x929d('0x12')]={};return new BPromise(function(_0x33d204,_0x535cab){var _0x4f22f4={'Start':function(_0x5879cf){var _0x1f6c1a=this;return new Promise(function(_0x59606e,_0x4b6602){if(_0x5879cf){try{var _0x59f4a2=[];var _0x50f7ba=getId(_0x5879cf[_0x929d('0x13')],_0x5879cf[_0x929d('0x14')]?_0x5879cf['message']['id']:0x0,_0x5879cf['interaction']?_0x5879cf[_0x929d('0x15')]['id']:0x0);if(_0x5879cf['applications']&&_[_0x929d('0x16')](_0x5879cf[_0x929d('0x17')])&&_0x5879cf[_0x929d('0x17')][_0x929d('0x18')]){for(var _0x335b07=0x0;_0x335b07<_0x5879cf[_0x929d('0x17')][_0x929d('0x18')];_0x335b07+=0x1){var _0x59ea49=_0x5879cf[_0x929d('0x17')][_0x335b07];if(fs[_0x929d('0x19')](path['join'](__dirname,_0x929d('0x17'),_0x59ea49[_0x929d('0x1a')]+_0x929d('0x1b')))){var _0x6b4270=[];switch(_0x59ea49[_0x929d('0x1a')][_0x929d('0x1c')]()){case _0x929d('0x1d'):var _0x43ac25=_0x59ea49[_0x929d('0x1e')][_0x929d('0x1f')](',');if(_0x5879cf[_0x929d('0x13')]==='mail'){_0x6b4270[_0x929d('0x20')](_0x43ac25[0x0]);_0x6b4270[_0x929d('0x20')](_0x43ac25[0x1]);_0x6b4270['push'](_0x43ac25[_0x929d('0x21')](0x2,_0x43ac25[_0x929d('0x18')])[_0x929d('0x22')](','));}else{_0x6b4270['push'](_0x43ac25[0x0]);_0x6b4270[_0x929d('0x20')](_0x43ac25['slice'](0x1,_0x43ac25[_0x929d('0x18')])['join'](','));}break;case'dialogflow':var _0x58ac2a=_0x59ea49[_0x929d('0x1e')][_0x929d('0x1f')](',');_0x6b4270[_0x929d('0x20')](_0x58ac2a[0x0]);_0x6b4270['push'](_0x58ac2a[0x1]);_0x6b4270['push'](_0x58ac2a[_0x929d('0x21')](0x2,_0x58ac2a[_0x929d('0x18')])[_0x929d('0x22')](','));break;case'dialogflowv2':var _0x185198=_0x59ea49[_0x929d('0x1e')][_0x929d('0x1f')](',');_0x6b4270[_0x929d('0x20')](_0x185198[0x0]);_0x6b4270[_0x929d('0x20')](_0x185198[0x1]);_0x6b4270[_0x929d('0x20')](_0x185198[0x2]);_0x6b4270[_0x929d('0x20')](_0x185198[0x3]);_0x6b4270[_0x929d('0x20')](_0x185198[_0x929d('0x21')](0x4,_0x185198[_0x929d('0x18')])[_0x929d('0x22')](','));break;case'amazonlex':var _0x3c1b96=_0x59ea49[_0x929d('0x1e')][_0x929d('0x1f')](',');_0x6b4270[_0x929d('0x20')](_0x3c1b96[0x0]);_0x6b4270['push'](_0x3c1b96[0x1]);_0x6b4270['push'](_0x3c1b96[0x2]);_0x6b4270['push'](_0x3c1b96[0x3]);_0x6b4270[_0x929d('0x20')](_0x3c1b96['slice'](0x4,_0x3c1b96[_0x929d('0x18')])[_0x929d('0x22')](','));break;case'message':_0x6b4270[_0x929d('0x20')](_0x59ea49[_0x929d('0x1e')]);break;case _0x929d('0x23'):_0x6b4270['push'](_0x59ea49['TagId']);_0x6b4270[_0x929d('0x20')](_0x59ea49[_0x929d('0x1e')]);break;default:_0x6b4270=_[_0x929d('0xc')](_0x59ea49[_0x929d('0x1e')])?[]:_0x59ea49['appdata'][_0x929d('0x1f')](',');}var _0x1f1f84={'id':util[_0x929d('0x24')]('%s:%s:%s',_0x50f7ba,_0x59ea49['id'],_0x59ea49[_0x929d('0x1a')]),'condition':require(_0x929d('0x25'))['condition'](_0x50f7ba,getIntervals(_0x54ae6f[_0x929d('0x26')],_0x59ea49),_0x54ae6f),'consequence':require('./applications/'+_0x59ea49[_0x929d('0x1a')])[_0x929d('0x27')](_0x50f7ba,_0x6b4270,_0x54ae6f,_0x5879cf),'p':_0x59ea49[_0x929d('0x28')]||0x0};logger[_0x929d('0x29')]('Push\x20new\x20rule',_0x1f1f84['id'],_0x929d('0x2a'),getIntervals(_0x54ae6f['intervals'],_0x59ea49)['join'](_0x929d('0x2b')));_0x59f4a2['push'](_0x1f1f84);}else{logger[_0x929d('0x2c')](_0x929d('0x2d'),path['join'](__dirname,'applications',_0x59ea49[_0x929d('0x1a')]+_0x929d('0x1b')));}}_0x54ae6f[_0x929d('0x12')][_0x50f7ba]=new RuleEngine(_0x59f4a2);_0x54ae6f[_0x929d('0x12')][_0x50f7ba][_0x929d('0x2e')](_0x5879cf,function(_0x27d3e9){logger[_0x929d('0x29')](_0x929d('0x2f'),JSON[_0x929d('0x30')](_0x27d3e9[_0x929d('0x31')]));if(_0x54ae6f[_0x929d('0x12')][_0x50f7ba]){_0x54ae6f[_0x929d('0x12')][_0x50f7ba][_0x929d('0x32')](_0x929d('0x33'));}});return _0x59606e({'code':0xc8,'message':_0x5879cf});}else{logger[_0x929d('0x29')](_0x929d('0x34'));return _0x59606e({'code':0xc8,'message':_0x5879cf});}}catch(_0x76dde8){logger[_0x929d('0x2c')](_0x76dde8[_0x929d('0x35')]);return _0x4b6602(_0x1f6c1a[_0x929d('0x2c')](0x1f4,_0x76dde8));}}return _0x4b6602('routing\x20is\x20empty');});},'AcceptMessage':function(_0x579ae0){var _0x129e7a=this;return new Promise(function(_0x8486f5,_0x55c664){if(_0x579ae0[_0x929d('0x36')]&&_0x579ae0['agent']['id']){if(_0x54ae6f[_0x929d('0x37')][_0x579ae0[_0x929d('0x36')]['id']]){_0x54ae6f['agents'][_0x579ae0['agent']['id']][_0x929d('0x38')]=![];_0x54ae6f[_0x929d('0x37')][_0x579ae0[_0x929d('0x36')]['id']]['busyQueue']=undefined;}}if(_0x579ae0['message']&&_0x579ae0[_0x929d('0x14')]['id']){try{var _0x3e9ced=getId(_0x579ae0[_0x929d('0x13')],_0x579ae0[_0x929d('0x14')]?_0x579ae0['message']['id']:0x0,_0x579ae0[_0x929d('0x15')]?_0x579ae0['interaction']['id']:0x0);if(_0x54ae6f[_0x929d('0x12')][_0x3e9ced]){_0x54ae6f[_0x929d('0x12')][_0x3e9ced][_0x929d('0x32')](_0x929d('0x39'));if(rpc[_0x579ae0['channel']+_0x929d('0x3a')]){rpc[_0x579ae0[_0x929d('0x13')]+_0x929d('0x3a')][_0x929d('0x3b')](_0x3e9ced,{'UserId':_0x579ae0[_0x929d('0x14')]['UserId']})['catch'](function(_0x2f2fb7){logger[_0x929d('0x2c')](_0x929d('0x3c'));});}}return _0x8486f5({'code':0xc8,'message':_0x579ae0});}catch(_0x2209e2){logger['error'](_0x2209e2[_0x929d('0x35')]);return _0x55c664(_0x129e7a['error'](0x1f4,_0x2209e2));}}logger['error'](_0x929d('0x3d'));return _0x55c664(_0x129e7a[_0x929d('0x2c')](0x1f4,_0x929d('0x3d')));});},'RejectMessage':function(_0x19b9ff){var _0x14cc9c=this;return new Promise(function(_0x3669cc,_0x1e8a1d){if(_0x19b9ff[_0x929d('0x36')]&&_0x19b9ff[_0x929d('0x36')]['id']){try{if(_0x54ae6f['agents'][_0x19b9ff[_0x929d('0x36')]['id']]){_0x54ae6f['agents'][_0x19b9ff[_0x929d('0x36')]['id']][_0x929d('0x38')]=![];_0x54ae6f[_0x929d('0x37')][_0x19b9ff[_0x929d('0x36')]['id']][_0x929d('0x3e')]=undefined;}return _0x3669cc({'code':0xc8,'message':_0x19b9ff});}catch(_0x4a453d){logger[_0x929d('0x2c')](_0x4a453d['stack']);return _0x1e8a1d(_0x14cc9c[_0x929d('0x2c')](0x1f4,_0x4a453d));}}logger[_0x929d('0x2c')]('message\x20is\x20empty');return _0x1e8a1d(_0x14cc9c[_0x929d('0x2c')](0x1f4,_0x929d('0x3d')));});},'AbandonInteraction':function(_0x56d321){var _0x215c20=this;return new Promise(function(_0x3bf4e6,_0x4c4dc3){if(_0x56d321[_0x929d('0x13')]&&_0x56d321[_0x929d('0x15')]&&_0x56d321['interaction']['id']){try{var _0x3bbb84=getId(_0x56d321[_0x929d('0x13')],_0x56d321['message']?_0x56d321['message']['id']:0x0,_0x56d321[_0x929d('0x15')]?_0x56d321[_0x929d('0x15')]['id']:0x0);if(_0x54ae6f['rules'][_0x3bbb84]){_0x54ae6f[_0x929d('0x12')][_0x3bbb84][_0x929d('0x32')](_0x929d('0x39'));}return _0x3bf4e6({'code':0xc8,'message':_0x56d321});}catch(_0x2864fb){logger[_0x929d('0x2c')](_0x2864fb['stack']);return _0x4c4dc3(_0x215c20['error'](0x1f4,_0x2864fb));}}logger['error'](_0x929d('0x3d'));return _0x4c4dc3(_0x215c20[_0x929d('0x2c')](0x1f4,_0x929d('0x3d')));});},'AgentCapacity':function(_0x47454e){var _0x4b882f=this;return new Promise(function(_0x4ac4b4,_0x556b09){if(_0x54ae6f[_0x929d('0x37')][_0x929d('0x3f')](_0x47454e['id'])){for(var _0x5ba4c9 in _0x47454e[_0x929d('0x40')]){if(_0x47454e['capacity'][_0x929d('0x3f')](_0x5ba4c9)){if(_0x54ae6f[_0x929d('0x37')][_0x47454e['id']][_0x929d('0x3f')](_0x5ba4c9+'CurrentCapacity')){_0x54ae6f[_0x929d('0x37')][_0x47454e['id']][_0x5ba4c9+_0x929d('0x41')]=parseInt(_0x47454e[_0x929d('0x40')][_0x5ba4c9],0xa);}}}_0x54ae6f[_0x929d('0x37')][_0x47454e['id']][_0x929d('0x42')]();return _0x4ac4b4({'code':0xc8,'message':_0x54ae6f['agents'][_0x47454e['id']]});}else{return _0x556b09(_0x4b882f[_0x929d('0x2c')](0x1f4,_0x929d('0x43')));}});},'Agents':function(_0x4091ce){return new Promise(function(_0x2e2ee0,_0x2227dd){var _0x5bd896=_[_0x929d('0x44')](_0x54ae6f[_0x929d('0x37')]);_0x2e2ee0({'count':_0x5bd896['length'],'rows':_0x5bd896});});},'ChatQueues':function(_0x20ab53){return new Promise(function(_0x52b48b,_0xb902b4){var _0x2a2acd=[];for(var _0x288d0b in _0x54ae6f[_0x929d('0x45')]){if(_0x54ae6f[_0x929d('0x45')]['hasOwnProperty'](_0x288d0b)){var _0x1d1554=_0x54ae6f['chatQueues'][_0x288d0b];var _0x21156f={'id':_0x1d1554['id'],'available':_0x1d1554['available'],'loggedIn':_0x1d1554['loggedIn'],'name':_0x1d1554[_0x929d('0x46')],'paused':_0x1d1554[_0x929d('0x47')],'waiting':_0x1d1554['waiting']};_0x2a2acd[_0x929d('0x20')](_0x21156f);}}_0x52b48b({'count':_0x2a2acd[_0x929d('0x18')],'rows':_0x2a2acd});});},'MailQueues':function(_0x1b7e6f){return new Promise(function(_0x2c595a,_0x27253b){var _0xc5f328=[];for(var _0x34c214 in _0x54ae6f[_0x929d('0x48')]){if(_0x54ae6f['mailQueues'][_0x929d('0x3f')](_0x34c214)){var _0x1ca753=_0x54ae6f[_0x929d('0x48')][_0x34c214];var _0x2b1fd9={'id':_0x1ca753['id'],'available':_0x1ca753['available'],'loggedIn':_0x1ca753[_0x929d('0x49')],'name':_0x1ca753['name'],'paused':_0x1ca753[_0x929d('0x47')],'waiting':_0x1ca753['waiting']};_0xc5f328[_0x929d('0x20')](_0x2b1fd9);}}_0x2c595a({'count':_0xc5f328['length'],'rows':_0xc5f328});});},'OpenchannelQueues':function(_0x4b6e71){return new Promise(function(_0x4b4347,_0x4fbcc1){var _0x14b64d=[];for(var _0x1598eb in _0x54ae6f['openchannelQueues']){if(_0x54ae6f[_0x929d('0x4a')][_0x929d('0x3f')](_0x1598eb)){var _0x5f5ae2=_0x54ae6f[_0x929d('0x4a')][_0x1598eb];var _0x366187={'id':_0x5f5ae2['id'],'available':_0x5f5ae2['available'],'loggedIn':_0x5f5ae2[_0x929d('0x49')],'name':_0x5f5ae2[_0x929d('0x46')],'paused':_0x5f5ae2[_0x929d('0x47')],'waiting':_0x5f5ae2[_0x929d('0x4b')]};_0x14b64d[_0x929d('0x20')](_0x366187);}}_0x4b4347({'count':_0x14b64d[_0x929d('0x18')],'rows':_0x14b64d});});},'SmsQueues':function(_0x511c37){return new Promise(function(_0x3446ef,_0xedf35d){var _0x558bbd=[];for(var _0x50b808 in _0x54ae6f[_0x929d('0x4c')]){if(_0x54ae6f[_0x929d('0x4c')]['hasOwnProperty'](_0x50b808)){var _0x1eb6d1=_0x54ae6f[_0x929d('0x4c')][_0x50b808];var _0x2c6f55={'id':_0x1eb6d1['id'],'available':_0x1eb6d1[_0x929d('0x4d')],'loggedIn':_0x1eb6d1[_0x929d('0x49')],'name':_0x1eb6d1[_0x929d('0x46')],'paused':_0x1eb6d1['paused'],'waiting':_0x1eb6d1['waiting']};_0x558bbd[_0x929d('0x20')](_0x2c6f55);}}_0x3446ef({'count':_0x558bbd[_0x929d('0x18')],'rows':_0x558bbd});});},'FaxQueues':function(_0x1011ea){return new Promise(function(_0x362d5f,_0x113f62){var _0x42ee22=[];for(var _0x2aa47b in _0x54ae6f[_0x929d('0x4e')]){if(_0x54ae6f[_0x929d('0x4e')]['hasOwnProperty'](_0x2aa47b)){var _0x269580=_0x54ae6f[_0x929d('0x4e')][_0x2aa47b];var _0x8f347e={'id':_0x269580['id'],'available':_0x269580['available'],'loggedIn':_0x269580[_0x929d('0x49')],'name':_0x269580[_0x929d('0x46')],'paused':_0x269580[_0x929d('0x47')],'waiting':_0x269580[_0x929d('0x4b')]};_0x42ee22['push'](_0x8f347e);}}_0x362d5f({'count':_0x42ee22['length'],'rows':_0x42ee22});});},'WhatsappQueues':function(_0x32b4b0){return new Promise(function(_0x236bf4,_0x26531c){var _0x1bf81a=[];for(var _0x5a281f in _0x54ae6f['whatsappQueues']){if(_0x54ae6f[_0x929d('0x4f')]['hasOwnProperty'](_0x5a281f)){var _0x47ff7d=_0x54ae6f['whatsappQueues'][_0x5a281f];var _0x44fc63={'id':_0x47ff7d['id'],'available':_0x47ff7d['available'],'loggedIn':_0x47ff7d[_0x929d('0x49')],'name':_0x47ff7d[_0x929d('0x46')],'paused':_0x47ff7d['paused'],'waiting':_0x47ff7d[_0x929d('0x4b')]};_0x1bf81a[_0x929d('0x20')](_0x44fc63);}}_0x236bf4({'count':_0x1bf81a[_0x929d('0x18')],'rows':_0x1bf81a});});},'ChatQueuesWaitingInteractions':function(_0x40c1df){return new Promise(function(_0x5b1566,_0x4d7322){var _0x4b4f37=_[_0x929d('0x44')](_0x54ae6f[_0x929d('0x50')]);_0x5b1566({'count':_0x4b4f37['length'],'rows':_0x4b4f37});});},'MailQueuesWaitingInteractions':function(_0x5a9b5f){return new Promise(function(_0x2142d1,_0x33b458){var _0x1dc5c0=_[_0x929d('0x44')](_0x54ae6f[_0x929d('0x51')]);_0x2142d1({'count':_0x1dc5c0['length'],'rows':_0x1dc5c0});});},'OpenchannelQueuesWaitingInteractions':function(_0x22100e){return new Promise(function(_0x4aa803,_0x4db17d){var _0x2d4500=_['values'](_0x54ae6f[_0x929d('0x52')]);_0x4aa803({'count':_0x2d4500[_0x929d('0x18')],'rows':_0x2d4500});});},'SmsQueuesWaitingInteractions':function(_0x15b522){return new Promise(function(_0x38993d,_0x56e73e){var _0x3591e3=_[_0x929d('0x44')](_0x54ae6f[_0x929d('0x53')]);_0x38993d({'count':_0x3591e3['length'],'rows':_0x3591e3});});},'FaxQueuesWaitingInteractions':function(_0x5ae250){return new Promise(function(_0x4053ff,_0x3c8738){var _0x187d53=_[_0x929d('0x44')](_0x54ae6f[_0x929d('0x54')]);_0x4053ff({'count':_0x187d53['length'],'rows':_0x187d53});});},'WhatsappQueuesWaitingInteractions':function(_0xc02fb6){return new Promise(function(_0x215076,_0x520263){var _0x12ba3d=_[_0x929d('0x44')](_0x54ae6f['whatsappQueuesWaitingInteractions']);_0x215076({'count':_0x12ba3d[_0x929d('0x18')],'rows':_0x12ba3d});});}};var _0x2e2b8d=jayson[_0x929d('0x55')](_0x4f22f4)[_0x929d('0x56')]();_0x2e2b8d['on'](_0x929d('0x2c'),function(_0x2ca827){logger['error'](JSON[_0x929d('0x30')](_0x2ca827));return _0x535cab(_0x2ca827);});_0x2e2b8d['listen'](0x232c,'127.0.0.1',function(){console[_0x929d('0x57')](_0x929d('0x58'),0x232c);return _0x33d204('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x31a9=['%s:%s:%s','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId'];(function(_0x41217c,_0x190555){var _0x1cce05=function(_0x41f2c7){while(--_0x41f2c7){_0x41217c['push'](_0x41217c['shift']());}};_0x1cce05(++_0x190555);}(_0x31a9,0xff));var _0x931a=function(_0x11db48,_0x363415){_0x11db48=_0x11db48-0x0;var _0x2cc224=_0x31a9[_0x11db48];return _0x2cc224;};'use strict';var _=require(_0x931a('0x0'));var util=require('util');var path=require(_0x931a('0x1'));var fs=require('fs');var jayson=require(_0x931a('0x2'));var BPromise=require(_0x931a('0x3'));var uuid=require(_0x931a('0x4'));var config=require(_0x931a('0x5'));var logger=require(_0x931a('0x6'))(_0x931a('0x7'));var rpc={'openchannelQueueReport':require(_0x931a('0x8')),'mailQueueReport':require(_0x931a('0x9')),'chatQueueReport':require(_0x931a('0xa')),'smsQueueReport':require(_0x931a('0xb')),'faxQueueReport':require(_0x931a('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x12f364,_0x283cda,_0x27c5fe){return util[_0x931a('0xd')](_0x931a('0xe'),_0x12f364,_0x283cda||0x0,_0x27c5fe||0x0);}function getIntervals(_0x40cbd7,_0x4207d7){var _0xaa1f2f=[];if(!_['isNil'](_0x4207d7[_0x931a('0xf')])&&!_[_0x931a('0x10')](_0x40cbd7[_0x4207d7[_0x931a('0xf')]])&&!_[_0x931a('0x10')](_0x40cbd7[_0x4207d7['IntervalId']][_0x931a('0x11')])){_0xaa1f2f=_['map'](_0x40cbd7[_0x4207d7[_0x931a('0xf')]]['Intervals'],_0x931a('0x12'));}else if(!_[_0x931a('0x10')](_0x4207d7['interval'])){_0xaa1f2f=[_0x4207d7[_0x931a('0x12')]];}return _0xaa1f2f;}exports[_0x931a('0x13')]=function(_0x330f91){_0x330f91[_0x931a('0x14')]={};return new BPromise(function(_0x20cf1b,_0x5f1bb0){var _0x135f45={'Start':function(_0x57df62){var _0x550c8a=this;return new Promise(function(_0x2907df,_0x15685d){if(_0x57df62){try{var _0x23a2c5=[];var _0x5f14ae=getId(_0x57df62[_0x931a('0x15')],_0x57df62[_0x931a('0x16')]?_0x57df62['message']['id']:0x0,_0x57df62[_0x931a('0x17')]?_0x57df62[_0x931a('0x17')]['id']:0x0);if(_0x57df62['applications']&&_[_0x931a('0x18')](_0x57df62[_0x931a('0x19')])&&_0x57df62['applications'][_0x931a('0x1a')]){for(var _0x1d6640=0x0;_0x1d6640<_0x57df62['applications'][_0x931a('0x1a')];_0x1d6640+=0x1){var _0x12a162=_0x57df62[_0x931a('0x19')][_0x1d6640];if(fs['existsSync'](path[_0x931a('0x1b')](__dirname,_0x931a('0x19'),_0x12a162[_0x931a('0x1c')]+_0x931a('0x1d')))){var _0x28ad59=[];switch(_0x12a162[_0x931a('0x1c')][_0x931a('0x1e')]()){case _0x931a('0x1f'):var _0x21b65a=_0x12a162['appdata'][_0x931a('0x20')](',');if(_0x57df62[_0x931a('0x15')]===_0x931a('0x21')){_0x28ad59[_0x931a('0x22')](_0x21b65a[0x0]);_0x28ad59[_0x931a('0x22')](_0x21b65a[0x1]);_0x28ad59[_0x931a('0x22')](_0x21b65a[_0x931a('0x23')](0x2,_0x21b65a['length'])[_0x931a('0x1b')](','));}else{_0x28ad59['push'](_0x21b65a[0x0]);_0x28ad59[_0x931a('0x22')](_0x21b65a['slice'](0x1,_0x21b65a[_0x931a('0x1a')])['join'](','));}break;case _0x931a('0x24'):var _0x5225cd=_0x12a162[_0x931a('0x25')]['split'](',');_0x28ad59[_0x931a('0x22')](_0x5225cd[0x0]);_0x28ad59['push'](_0x5225cd[0x1]);_0x28ad59['push'](_0x5225cd[_0x931a('0x23')](0x2,_0x5225cd[_0x931a('0x1a')])[_0x931a('0x1b')](','));break;case _0x931a('0x26'):var _0x4b9430=_0x12a162[_0x931a('0x25')][_0x931a('0x20')](',');_0x28ad59[_0x931a('0x22')](_0x4b9430[0x0]);_0x28ad59['push'](_0x4b9430[0x1]);_0x28ad59[_0x931a('0x22')](_0x4b9430[0x2]);_0x28ad59['push'](_0x4b9430[0x3]);_0x28ad59[_0x931a('0x22')](_0x4b9430['slice'](0x4,_0x4b9430[_0x931a('0x1a')])[_0x931a('0x1b')](','));break;case _0x931a('0x27'):var _0x3fc979=_0x12a162[_0x931a('0x25')][_0x931a('0x20')](',');_0x28ad59[_0x931a('0x22')](_0x3fc979[0x0]);_0x28ad59[_0x931a('0x22')](_0x3fc979[0x1]);_0x28ad59[_0x931a('0x22')](_0x3fc979[0x2]);_0x28ad59[_0x931a('0x22')](_0x3fc979[0x3]);_0x28ad59[_0x931a('0x22')](_0x3fc979['slice'](0x4,_0x3fc979[_0x931a('0x1a')])[_0x931a('0x1b')](','));break;case'message':_0x28ad59['push'](_0x12a162[_0x931a('0x25')]);break;case _0x931a('0x28'):_0x28ad59[_0x931a('0x22')](_0x12a162[_0x931a('0x29')]);_0x28ad59[_0x931a('0x22')](_0x12a162[_0x931a('0x25')]);break;default:_0x28ad59=_[_0x931a('0x10')](_0x12a162[_0x931a('0x25')])?[]:_0x12a162[_0x931a('0x25')]['split'](',');}var _0x272409={'id':util[_0x931a('0xd')](_0x931a('0x2a'),_0x5f14ae,_0x12a162['id'],_0x12a162[_0x931a('0x1c')]),'condition':require('./interval')[_0x931a('0x2b')](_0x5f14ae,getIntervals(_0x330f91['intervals'],_0x12a162),_0x330f91),'consequence':require(_0x931a('0x2c')+_0x12a162['app'])[_0x931a('0x2d')](_0x5f14ae,_0x28ad59,_0x330f91,_0x57df62),'p':_0x12a162[_0x931a('0x2e')]||0x0};logger[_0x931a('0x2f')](_0x931a('0x30'),_0x272409['id'],_0x931a('0x31'),getIntervals(_0x330f91[_0x931a('0x32')],_0x12a162)[_0x931a('0x1b')](_0x931a('0x33')));_0x23a2c5[_0x931a('0x22')](_0x272409);}else{logger[_0x931a('0x34')](_0x931a('0x35'),path[_0x931a('0x1b')](__dirname,_0x931a('0x19'),_0x12a162[_0x931a('0x1c')]+_0x931a('0x1d')));}}_0x330f91[_0x931a('0x14')][_0x5f14ae]=new RuleEngine(_0x23a2c5);_0x330f91[_0x931a('0x14')][_0x5f14ae][_0x931a('0x36')](_0x57df62,function(_0x15e3f7){logger['info'](_0x931a('0x37'),JSON[_0x931a('0x38')](_0x15e3f7[_0x931a('0x39')]));if(_0x330f91[_0x931a('0x14')][_0x5f14ae]){_0x330f91[_0x931a('0x14')][_0x5f14ae][_0x931a('0x3a')]('complete');}});return _0x2907df({'code':0xc8,'message':_0x57df62});}else{logger[_0x931a('0x2f')]('No\x20applications\x20to\x20execute');return _0x2907df({'code':0xc8,'message':_0x57df62});}}catch(_0x3f25e5){logger[_0x931a('0x34')](_0x3f25e5[_0x931a('0x3b')]);return _0x15685d(_0x550c8a['error'](0x1f4,_0x3f25e5));}}return _0x15685d(_0x931a('0x3c'));});},'AcceptMessage':function(_0x36f367){var _0x58fff9=this;return new Promise(function(_0x100a96,_0x96723e){if(_0x36f367[_0x931a('0x3d')]&&_0x36f367['agent']['id']){if(_0x330f91['agents'][_0x36f367['agent']['id']]){_0x330f91[_0x931a('0x3e')][_0x36f367[_0x931a('0x3d')]['id']][_0x931a('0x3f')]=![];_0x330f91[_0x931a('0x3e')][_0x36f367[_0x931a('0x3d')]['id']][_0x931a('0x40')]=undefined;}}if(_0x36f367[_0x931a('0x16')]&&_0x36f367[_0x931a('0x16')]['id']){try{var _0x479be4=getId(_0x36f367[_0x931a('0x15')],_0x36f367['message']?_0x36f367[_0x931a('0x16')]['id']:0x0,_0x36f367['interaction']?_0x36f367[_0x931a('0x17')]['id']:0x0);if(_0x330f91[_0x931a('0x14')][_0x479be4]){_0x330f91[_0x931a('0x14')][_0x479be4][_0x931a('0x3a')](_0x931a('0x41'));if(rpc[_0x36f367[_0x931a('0x15')]+_0x931a('0x42')]){rpc[_0x36f367[_0x931a('0x15')]+_0x931a('0x42')][_0x931a('0x43')](_0x479be4,{'UserId':_0x36f367[_0x931a('0x16')][_0x931a('0x44')]})[_0x931a('0x45')](function(_0x465de6){logger[_0x931a('0x34')](_0x931a('0x46'));});}}return _0x100a96({'code':0xc8,'message':_0x36f367});}catch(_0x241a1a){logger[_0x931a('0x34')](_0x241a1a[_0x931a('0x3b')]);return _0x96723e(_0x58fff9[_0x931a('0x34')](0x1f4,_0x241a1a));}}logger['error'](_0x931a('0x47'));return _0x96723e(_0x58fff9[_0x931a('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x568919){var _0x3f6c53=this;return new Promise(function(_0x18f640,_0x414bbe){if(_0x568919[_0x931a('0x3d')]&&_0x568919[_0x931a('0x3d')]['id']){try{if(_0x330f91[_0x931a('0x3e')][_0x568919['agent']['id']]){_0x330f91[_0x931a('0x3e')][_0x568919[_0x931a('0x3d')]['id']][_0x931a('0x3f')]=![];_0x330f91['agents'][_0x568919[_0x931a('0x3d')]['id']][_0x931a('0x40')]=undefined;}return _0x18f640({'code':0xc8,'message':_0x568919});}catch(_0x4fae69){logger[_0x931a('0x34')](_0x4fae69[_0x931a('0x3b')]);return _0x414bbe(_0x3f6c53[_0x931a('0x34')](0x1f4,_0x4fae69));}}logger[_0x931a('0x34')](_0x931a('0x47'));return _0x414bbe(_0x3f6c53[_0x931a('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1c3ec5){var _0x16e30b=this;return new Promise(function(_0xcf3761,_0x3ab356){if(_0x1c3ec5['channel']&&_0x1c3ec5[_0x931a('0x17')]&&_0x1c3ec5[_0x931a('0x17')]['id']){try{var _0xa60b2f=getId(_0x1c3ec5['channel'],_0x1c3ec5['message']?_0x1c3ec5[_0x931a('0x16')]['id']:0x0,_0x1c3ec5[_0x931a('0x17')]?_0x1c3ec5[_0x931a('0x17')]['id']:0x0);if(_0x330f91[_0x931a('0x14')][_0xa60b2f]){_0x330f91[_0x931a('0x14')][_0xa60b2f]['emit'](_0x931a('0x41'));}return _0xcf3761({'code':0xc8,'message':_0x1c3ec5});}catch(_0x13d933){logger[_0x931a('0x34')](_0x13d933[_0x931a('0x3b')]);return _0x3ab356(_0x16e30b[_0x931a('0x34')](0x1f4,_0x13d933));}}logger[_0x931a('0x34')](_0x931a('0x47'));return _0x3ab356(_0x16e30b['error'](0x1f4,_0x931a('0x47')));});},'AgentCapacity':function(_0x149ad1){var _0x3acc3e=this;return new Promise(function(_0x137a19,_0x2f8274){if(_0x330f91['agents'][_0x931a('0x48')](_0x149ad1['id'])){for(var _0x5abb85 in _0x149ad1[_0x931a('0x49')]){if(_0x149ad1[_0x931a('0x49')][_0x931a('0x48')](_0x5abb85)){if(_0x330f91['agents'][_0x149ad1['id']]['hasOwnProperty'](_0x5abb85+_0x931a('0x4a'))){_0x330f91[_0x931a('0x3e')][_0x149ad1['id']][_0x5abb85+'CurrentCapacity']=parseInt(_0x149ad1[_0x931a('0x49')][_0x5abb85],0xa);}}}_0x330f91['agents'][_0x149ad1['id']][_0x931a('0x4b')]();return _0x137a19({'code':0xc8,'message':_0x330f91['agents'][_0x149ad1['id']]});}else{return _0x2f8274(_0x3acc3e[_0x931a('0x34')](0x1f4,_0x931a('0x4c')));}});},'Agents':function(_0x23b537){return new Promise(function(_0x19bcc8,_0x3962f4){var _0x5e3179=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x3e')]);_0x19bcc8({'count':_0x5e3179[_0x931a('0x1a')],'rows':_0x5e3179});});},'ChatQueues':function(_0x43367b){return new Promise(function(_0x1a7986,_0x5d91ae){var _0x912400=[];for(var _0x21a531 in _0x330f91['chatQueues']){if(_0x330f91[_0x931a('0x4e')][_0x931a('0x48')](_0x21a531)){var _0x1dda5e=_0x330f91[_0x931a('0x4e')][_0x21a531];var _0x2800da={'id':_0x1dda5e['id'],'available':_0x1dda5e[_0x931a('0x4f')],'loggedIn':_0x1dda5e[_0x931a('0x50')],'name':_0x1dda5e[_0x931a('0x51')],'paused':_0x1dda5e['paused'],'waiting':_0x1dda5e[_0x931a('0x52')]};_0x912400['push'](_0x2800da);}}_0x1a7986({'count':_0x912400[_0x931a('0x1a')],'rows':_0x912400});});},'MailQueues':function(_0x4e7398){return new Promise(function(_0x31849a,_0x3207c4){var _0x22e027=[];for(var _0x1e34d0 in _0x330f91[_0x931a('0x53')]){if(_0x330f91[_0x931a('0x53')][_0x931a('0x48')](_0x1e34d0)){var _0x2077f9=_0x330f91[_0x931a('0x53')][_0x1e34d0];var _0x141172={'id':_0x2077f9['id'],'available':_0x2077f9[_0x931a('0x4f')],'loggedIn':_0x2077f9[_0x931a('0x50')],'name':_0x2077f9[_0x931a('0x51')],'paused':_0x2077f9[_0x931a('0x54')],'waiting':_0x2077f9[_0x931a('0x52')]};_0x22e027[_0x931a('0x22')](_0x141172);}}_0x31849a({'count':_0x22e027[_0x931a('0x1a')],'rows':_0x22e027});});},'OpenchannelQueues':function(_0x114fa4){return new Promise(function(_0x39eb2b,_0xa54e70){var _0x100a27=[];for(var _0x362e57 in _0x330f91[_0x931a('0x55')]){if(_0x330f91[_0x931a('0x55')][_0x931a('0x48')](_0x362e57)){var _0x5ee30b=_0x330f91[_0x931a('0x55')][_0x362e57];var _0x7b3145={'id':_0x5ee30b['id'],'available':_0x5ee30b[_0x931a('0x4f')],'loggedIn':_0x5ee30b[_0x931a('0x50')],'name':_0x5ee30b[_0x931a('0x51')],'paused':_0x5ee30b[_0x931a('0x54')],'waiting':_0x5ee30b[_0x931a('0x52')]};_0x100a27[_0x931a('0x22')](_0x7b3145);}}_0x39eb2b({'count':_0x100a27[_0x931a('0x1a')],'rows':_0x100a27});});},'SmsQueues':function(_0x3f50ff){return new Promise(function(_0x42a0ff,_0x199a6a){var _0x55a238=[];for(var _0x1b5b5d in _0x330f91['smsQueues']){if(_0x330f91[_0x931a('0x56')]['hasOwnProperty'](_0x1b5b5d)){var _0x489759=_0x330f91[_0x931a('0x56')][_0x1b5b5d];var _0x598ccd={'id':_0x489759['id'],'available':_0x489759['available'],'loggedIn':_0x489759[_0x931a('0x50')],'name':_0x489759[_0x931a('0x51')],'paused':_0x489759[_0x931a('0x54')],'waiting':_0x489759[_0x931a('0x52')]};_0x55a238['push'](_0x598ccd);}}_0x42a0ff({'count':_0x55a238[_0x931a('0x1a')],'rows':_0x55a238});});},'FaxQueues':function(_0x18662b){return new Promise(function(_0x341454,_0x88cb81){var _0x2274c3=[];for(var _0x2762c4 in _0x330f91['faxQueues']){if(_0x330f91[_0x931a('0x57')][_0x931a('0x48')](_0x2762c4)){var _0x2b56dc=_0x330f91[_0x931a('0x57')][_0x2762c4];var _0x1e1a10={'id':_0x2b56dc['id'],'available':_0x2b56dc[_0x931a('0x4f')],'loggedIn':_0x2b56dc[_0x931a('0x50')],'name':_0x2b56dc['name'],'paused':_0x2b56dc['paused'],'waiting':_0x2b56dc[_0x931a('0x52')]};_0x2274c3[_0x931a('0x22')](_0x1e1a10);}}_0x341454({'count':_0x2274c3[_0x931a('0x1a')],'rows':_0x2274c3});});},'WhatsappQueues':function(_0x1a9ee7){return new Promise(function(_0x13f313,_0xe9750){var _0x2afe84=[];for(var _0x524653 in _0x330f91[_0x931a('0x58')]){if(_0x330f91[_0x931a('0x58')][_0x931a('0x48')](_0x524653)){var _0x3d2f63=_0x330f91[_0x931a('0x58')][_0x524653];var _0x55599f={'id':_0x3d2f63['id'],'available':_0x3d2f63['available'],'loggedIn':_0x3d2f63[_0x931a('0x50')],'name':_0x3d2f63[_0x931a('0x51')],'paused':_0x3d2f63[_0x931a('0x54')],'waiting':_0x3d2f63[_0x931a('0x52')]};_0x2afe84['push'](_0x55599f);}}_0x13f313({'count':_0x2afe84[_0x931a('0x1a')],'rows':_0x2afe84});});},'ChatQueuesWaitingInteractions':function(_0x5d9208){return new Promise(function(_0x4a529d,_0x6b6897){var _0x564112=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x59')]);_0x4a529d({'count':_0x564112[_0x931a('0x1a')],'rows':_0x564112});});},'MailQueuesWaitingInteractions':function(_0x1262ea){return new Promise(function(_0x3cba13,_0x340ce7){var _0x22c6ff=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x5a')]);_0x3cba13({'count':_0x22c6ff[_0x931a('0x1a')],'rows':_0x22c6ff});});},'OpenchannelQueuesWaitingInteractions':function(_0x310531){return new Promise(function(_0x72178f,_0x4a4498){var _0x4e969e=_['values'](_0x330f91['openchannelQueuesWaitingInteractions']);_0x72178f({'count':_0x4e969e[_0x931a('0x1a')],'rows':_0x4e969e});});},'SmsQueuesWaitingInteractions':function(_0x405ba9){return new Promise(function(_0x177d44,_0x3ab258){var _0x3abdcc=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x5b')]);_0x177d44({'count':_0x3abdcc['length'],'rows':_0x3abdcc});});},'FaxQueuesWaitingInteractions':function(_0x5241fd){return new Promise(function(_0x2c3566,_0x1e0bba){var _0x4e189c=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x5c')]);_0x2c3566({'count':_0x4e189c['length'],'rows':_0x4e189c});});},'WhatsappQueuesWaitingInteractions':function(_0x26c149){return new Promise(function(_0x35734a,_0x33df67){var _0x4a09ca=_[_0x931a('0x4d')](_0x330f91[_0x931a('0x5d')]);_0x35734a({'count':_0x4a09ca['length'],'rows':_0x4a09ca});});}};var _0x1bdcba=jayson[_0x931a('0x5e')](_0x135f45)[_0x931a('0x5f')]();_0x1bdcba['on']('error',function(_0x552513){logger[_0x931a('0x34')](JSON['stringify'](_0x552513));return _0x5f1bb0(_0x552513);});_0x1bdcba[_0x931a('0x13')](0x232c,_0x931a('0x60'),function(){console['log'](_0x931a('0x61'),0x232c);return _0x20cf1b(_0x931a('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 37f7528..31a4710 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 _0x43a6=['jayson/promise','lodash','../../../config/logger','routing','client','http','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','then','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird'];(function(_0x4a5c8c,_0x2a39db){var _0x5599ac=function(_0x571304){while(--_0x571304){_0x4a5c8c['push'](_0x4a5c8c['shift']());}};_0x5599ac(++_0x2a39db);}(_0x43a6,0x154));var _0x643a=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x43a6[_0x431ff8];return _0x84ccd4;};'use strict';var util=require('util');var BPromise=require(_0x643a('0x0'));var jayson=require(_0x643a('0x1'));var _=require(_0x643a('0x2'));var logger=require(_0x643a('0x3'))(_0x643a('0x4'));var client=jayson[_0x643a('0x5')][_0x643a('0x6')]({'port':0x232a});function request(_0x58854c,_0x557aff){return new BPromise(function(_0x4cc415,_0x144f48){return client['request'](_0x58854c,_0x557aff)['then'](function(_0x3d41a5){if(_0x3d41a5[_0x643a('0x7')]){return _0x144f48(_0x3d41a5[_0x643a('0x7')][_0x643a('0x8')]);}else{return _0x4cc415(_0x3d41a5[_0x643a('0x9')]);}})[_0x643a('0xa')](function(_0x29b0e4){return _0x144f48(_0x29b0e4);});});}exports[_0x643a('0xb')]=function(_0x175c26,_0x4c279b,_0x1314b9){return function(_0x33a750){if(_0x1314b9[_0x643a('0xc')]&&!_0x1314b9[_0x643a('0xc')][_0x175c26]){logger[_0x643a('0xd')](_0x643a('0xe'),_0x175c26);return _0x33a750[_0x643a('0xf')]();}var _0x232e0c=[];for(var _0xf2998d=0x0;_0xf2998d<_0x4c279b[_0x643a('0x10')];_0xf2998d+=0x1){_0x232e0c[_0x643a('0x11')](request(_0x643a('0x12'),{'command':util[_0x643a('0x13')]('iftime\x20%s',_0x4c279b[_0xf2998d])})[_0x643a('0x14')](function(_0x5c1920){return _0x5c1920&&_0x5c1920[_0x643a('0x8')]&&_0x5c1920[_0x643a('0x8')][_0x643a('0x15')](_0x643a('0x16'))>=0x0?!![]:![];})[_0x643a('0xa')](function(_0xaa64e7){logger[_0x643a('0x7')](_0x643a('0x17'),_0x175c26,_0x4c279b[_0xf2998d]);}));}BPromise['all'](_0x232e0c)[_0x643a('0x14')](function(_0x45420e){var _0x29d405=_[_0x643a('0x18')](_0x45420e);logger[_0x643a('0xd')](_0x643a('0x19'),_0x175c26,_0x4c279b[_0x643a('0x1a')](_0x643a('0x1b')),_0x29d405);_0x33a750[_0x643a('0x1c')](_0x29d405);})[_0x643a('0xa')](function(_0x872d04){console[_0x643a('0x1d')](_0x872d04);logger[_0x643a('0x7')](_0x643a('0x19'),_0x175c26,_0x4c279b['join']('\x20|\x20'),_0x872d04[_0x643a('0x1e')]);_0x33a750[_0x643a('0xf')]();});};}; \ No newline at end of file +var _0x651e=['message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true','catch','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','request','error'];(function(_0x452144,_0x170931){var _0x37f223=function(_0x32d7b8){while(--_0x32d7b8){_0x452144['push'](_0x452144['shift']());}};_0x37f223(++_0x170931);}(_0x651e,0x93));var _0xe651=function(_0x1cd31e,_0x48b34d){_0x1cd31e=_0x1cd31e-0x0;var _0x3318d5=_0x651e[_0x1cd31e];return _0x3318d5;};'use strict';var util=require(_0xe651('0x0'));var BPromise=require('bluebird');var jayson=require(_0xe651('0x1'));var _=require(_0xe651('0x2'));var logger=require(_0xe651('0x3'))(_0xe651('0x4'));var client=jayson[_0xe651('0x5')]['http']({'port':0x232a});function request(_0x290457,_0xd46791){return new BPromise(function(_0x27deb2,_0x35c486){return client[_0xe651('0x6')](_0x290457,_0xd46791)['then'](function(_0xe2f3a5){if(_0xe2f3a5['error']){return _0x35c486(_0xe2f3a5[_0xe651('0x7')][_0xe651('0x8')]);}else{return _0x27deb2(_0xe2f3a5[_0xe651('0x9')]);}})['catch'](function(_0xf591ef){return _0x35c486(_0xf591ef);});});}exports[_0xe651('0xa')]=function(_0x5bb4bd,_0x1e4698,_0x51bbe7){return function(_0x43848c){if(_0x51bbe7['rules']&&!_0x51bbe7[_0xe651('0xb')][_0x5bb4bd]){logger[_0xe651('0xc')](_0xe651('0xd'),_0x5bb4bd);return _0x43848c[_0xe651('0xe')]();}var _0x4521c5=[];for(var _0x38d83d=0x0;_0x38d83d<_0x1e4698[_0xe651('0xf')];_0x38d83d+=0x1){_0x4521c5[_0xe651('0x10')](request(_0xe651('0x11'),{'command':util[_0xe651('0x12')](_0xe651('0x13'),_0x1e4698[_0x38d83d])})['then'](function(_0x55ad23){return _0x55ad23&&_0x55ad23[_0xe651('0x8')]&&_0x55ad23['message']['indexOf'](_0xe651('0x14'))>=0x0?!![]:![];})[_0xe651('0x15')](function(_0x7c617d){logger[_0xe651('0x7')]('[%s][INTERVAL]\x20%s',_0x5bb4bd,_0x1e4698[_0x38d83d]);}));}BPromise[_0xe651('0x16')](_0x4521c5)[_0xe651('0x17')](function(_0x47849d){var _0x3b2767=_[_0xe651('0x18')](_0x47849d);logger[_0xe651('0xc')](_0xe651('0x19'),_0x5bb4bd,_0x1e4698[_0xe651('0x1a')](_0xe651('0x1b')),_0x3b2767);_0x43848c[_0xe651('0x1c')](_0x3b2767);})[_0xe651('0x15')](function(_0x84dcc6){console[_0xe651('0x1d')](_0x84dcc6);logger[_0xe651('0x7')](_0xe651('0x19'),_0x5bb4bd,_0x1e4698['join'](_0xe651('0x1b')),_0x84dcc6[_0xe651('0x1e')]);_0x43848c[_0xe651('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8993f7e..d3ee8e2 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 _0x9ffd=['interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][attendedtransfer]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x30f00c,_0x3260a4){_0x30f00c=_0x30f00c-0x0;var _0x21424e=_0x9ffd[_0x30f00c];return _0x21424e;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var utils=require(_0xd9ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5802a6,_0x3480c0){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x5'),_0x5802a6['uniqueid'],_0x5802a6[_0xd9ff('0x6')],_0x5802a6[_0xd9ff('0x7')],_0x5802a6['membername'],_0x5802a6[_0xd9ff('0x8')],_0x5802a6[_0xd9ff('0x9')],_0x5802a6[_0xd9ff('0xa')],_0x5802a6[_0xd9ff('0xb')]));if(_0x5802a6[_0xd9ff('0x7')]){utils[_0xd9ff('0xc')](_0x5802a6[_0xd9ff('0x7')])[_0xd9ff('0xd')](function(_0x977487){if(_0x977487){_0x5802a6['type']=_0x977487['type'];_0x5802a6['agentacw']=_0x5802a6['agentcomplete']?_0x977487[_0xd9ff('0xe')]:![];_0x5802a6[_0xd9ff('0xf')]=_0x5802a6[_0xd9ff('0x10')]?_0x977487[_0xd9ff('0x11')]:0x0;}utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);});}else{utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);}if(_0x3480c0){delete transfers[_0x5802a6['uniqueid']];}else{delete agents[_0x5802a6['destuniqueid']];}}exports[_0xd9ff('0x14')]=function(_0x16a0d9){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9['uniqueid']),_0x16a0d9);agents[_0x16a0d9[_0xd9ff('0x17')]]=_0x16a0d9;agents[_0x16a0d9[_0xd9ff('0x17')]]['agentcalledAt']=utils[_0xd9ff('0x18')]();agents[_0x16a0d9['destuniqueid']]['lastevent']='called';agents[_0x16a0d9['destuniqueid']][_0xd9ff('0xa')]=null;agents[_0x16a0d9['destuniqueid']][_0xd9ff('0x19')]=null;utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x1a'),_0x16a0d9[_0xd9ff('0x1b')],agents[_0x16a0d9[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x16a0d9[_0xd9ff('0x17')]));}catch(_0x182775){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9[_0xd9ff('0x1b')]),_0x182775);}};exports['agentringnoanswer']=function(_0x4cf8ec){try{if(!_[_0xd9ff('0x1e')](agents[_0x4cf8ec[_0xd9ff('0x17')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x4cf8ec['uniqueid']),_0x4cf8ec);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x1f'),_0x4cf8ec[_0xd9ff('0x1b')],agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x4cf8ec[_0xd9ff('0x17')]));agents[_0x4cf8ec[_0xd9ff('0x17')]]['agentringnoanswer']=!![];agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x20')]=utils['now']();agents[_0x4cf8ec[_0xd9ff('0x17')]]['lastevent']=_0xd9ff('0x21');agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x21');agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x23')]=_0x4cf8ec['ringtime']?parseInt(_0x4cf8ec[_0xd9ff('0x24')])/0x3e8:0x0;agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x25')]=0x0;unanswered[_0xd9ff('0x26')](_0x4cf8ec['destuniqueid']);}}catch(_0x1d3684){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x27'),_0x4cf8ec[_0xd9ff('0x1b')]),_0x1d3684);}};exports[_0xd9ff('0x28')]=function(_0x420ffa){try{_[_0xd9ff('0x29')](agents,function(_0x3dc443,_0x5706cf){if(_0x3dc443[_0xd9ff('0x1b')]==_0x420ffa['uniqueid']&&!_[_0xd9ff('0x2a')](unanswered,_0x3dc443[_0xd9ff('0x17')])){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2b'),_0x420ffa[_0xd9ff('0x1b')]),_0x420ffa);utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x420ffa[_0xd9ff('0x1b')],_0x3dc443['membername'],_0x3dc443[_0xd9ff('0x17')]));_0x3dc443[_0xd9ff('0x2c')]=!![];_0x3dc443[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x3dc443[_0xd9ff('0xb')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x22')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x23')]=_0x420ffa[_0xd9ff('0x23')];_0x3dc443[_0xd9ff('0x25')]=0x0;writeDB(_0x3dc443);}});}catch(_0x34e9a9){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]',_0x420ffa[_0xd9ff('0x1b')]),_0x34e9a9);}};exports[_0xd9ff('0x2e')]=function(_0x2bde85){try{if(agents[_0x2bde85['destuniqueid']]){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2f'),_0x2bde85['uniqueid']),_0x2bde85);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x30'),_0x2bde85[_0xd9ff('0x1b')],agents[_0x2bde85[_0xd9ff('0x17')]]['membername'],_0x2bde85['destuniqueid']));agents[_0x2bde85['destuniqueid']][_0xd9ff('0x31')]=utils[_0xd9ff('0x18')]();agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xa')]=_0x2bde85[_0xd9ff('0xa')];agents[_0x2bde85[_0xd9ff('0x17')]]['connectedlinename']=_0x2bde85['connectedlinename'];agents[_0x2bde85['destuniqueid']][_0xd9ff('0x23')]=_0x2bde85[_0xd9ff('0x24')];agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xb')]='connect';_[_0xd9ff('0x29')](agents,function(_0x5b8e17,_0x3cff52){if(_0x5b8e17[_0xd9ff('0x17')]!=_0x2bde85[_0xd9ff('0x17')]&&_0x5b8e17[_0xd9ff('0x1b')]==_0x2bde85['uniqueid']){_0x5b8e17[_0xd9ff('0x25')]=0x0;_0x5b8e17[_0xd9ff('0x23')]=_0x2bde85['ringtime'];_0x5b8e17[_0xd9ff('0x2c')]=!![];_0x5b8e17[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x5b8e17[_0xd9ff('0xb')]=_0xd9ff('0x32');_0x5b8e17[_0xd9ff('0x22')]='answered_elsewhere';_0x5b8e17[_0xd9ff('0x33')]=_0x2bde85[_0xd9ff('0x17')];_0x5b8e17[_0xd9ff('0x34')]=_0x2bde85[_0xd9ff('0x1c')];writeDB(_0x5b8e17);}});}}catch(_0x472724){utils['error'](util[_0xd9ff('0x4')](_0xd9ff('0x2f'),_0x2bde85[_0xd9ff('0x1b')]),_0x472724);}};exports['agentcomplete']=function(_0x5d06dd){try{if(!_[_0xd9ff('0x1e')](agents[_0x5d06dd[_0xd9ff('0x17')]])){utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x35'),_0x5d06dd[_0xd9ff('0x1b')]),_0x5d06dd);utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x36'),_0x5d06dd['uniqueid'],agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x5d06dd[_0xd9ff('0x17')]));agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x37')]=!![];agents[_0x5d06dd['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x5d06dd[_0xd9ff('0x17')]]['talktime']=utils[_0xd9ff('0x38')](agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x39')],agents[_0x5d06dd['destuniqueid']][_0xd9ff('0x31')]);agents[_0x5d06dd[_0xd9ff('0x17')]]['reason']=_0x5d06dd[_0xd9ff('0x22')];agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');writeDB(agents[_0x5d06dd['destuniqueid']]);}}catch(_0x38b5b6){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][agentcomplete]',_0x5d06dd[_0xd9ff('0x1b')]),_0x38b5b6);}};exports[_0xd9ff('0x3b')]=function(_0x2bf37a){try{if(!_[_0xd9ff('0x1e')](agents[_0x2bf37a[_0xd9ff('0x3c')]])){utils['debug'](util[_0xd9ff('0x4')](_0xd9ff('0x3d'),_0x2bf37a[_0xd9ff('0x1b')]),_0x2bf37a);utils[_0xd9ff('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2bf37a['uniqueid'],agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1c')],agents[_0x2bf37a[_0xd9ff('0x3c')]]['uniqueid']));agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3e')]=!![];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3f')]=_0xd9ff('0x40');agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x41')]=_0x2bf37a[_0xd9ff('0x42')];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x43')]=agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1b')];}}catch(_0x2533d7){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][blindtransfer]',_0x2bf37a[_0xd9ff('0x1b')]),_0x2533d7);}};exports['attendedtransfer']=function(_0x2953d7){try{utils['debug'](util[_0xd9ff('0x4')]('[%s][agents][attendedtransfer]',_0x2953d7[_0xd9ff('0x44')]),_0x2953d7);if(_0x2953d7['origtransfereruniqueid']==_0x2953d7[_0xd9ff('0x45')]){if(!_['isNil'](agents[_0x2953d7[_0xd9ff('0x46')]])){utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7[_0xd9ff('0x44')],agents[_0x2953d7[_0xd9ff('0x46')]]['membername']));agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x46')]]['transfertype']=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x49')];agents[_0x2953d7[_0xd9ff('0x46')]]['transferuniqueid']=_0x2953d7[_0xd9ff('0x44')];}if(_0x2953d7[_0xd9ff('0x4a')]&&agents[_0x2953d7[_0xd9ff('0x4a')]]){agents[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x4b')]=0x1;transfers[_0x2953d7[_0xd9ff('0x4a')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfereeuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x9')]=agents[_0x2953d7['secondtransfereruniqueid']][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x4d')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentconnectAt']=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4a')]]['agententerreason']=0x2;}}else if(_0x2953d7['secondtransfereruniqueid']==_0x2953d7['secondtransfererlinkedid']){if(!_[_0xd9ff('0x1e')](agents[_0x2953d7[_0xd9ff('0x44')]])){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7['origtransfereruniqueid'],agents[_0x2953d7[_0xd9ff('0x44')]]['membername']));agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3f')]=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x4e')];agents[_0x2953d7['origtransfereruniqueid']][_0xd9ff('0x43')]=_0x2953d7[_0xd9ff('0x46')];}if(_0x2953d7['transfertargetuniqueid']&&agents[_0x2953d7['transfertargetuniqueid']]){agents[_0x2953d7[_0xd9ff('0x4f')]]['agententerreason']=0x1;transfers[_0x2953d7[_0xd9ff('0x4f')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfertargetuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x9')]=agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4f')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x44')]]['calleridname'];transfers[_0x2953d7['transfertargetuniqueid']][_0xd9ff('0x50')]=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x31')]=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x4b')]=0x2;}}}catch(_0x1bb042){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x51'),_0x2953d7['origtransfereruniqueid']),_0x1bb042);}};exports['hangup']=function(_0x5e04d3){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')]('[%s][agents][hangup]',_0x5e04d3[_0xd9ff('0x1b')]),_0x5e04d3);if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]===_0xd9ff('0x21')){if(_0x5e04d3[_0xd9ff('0x52')]==='21'){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]='rejected';agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x53');}utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3['uniqueid']][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);var _0x56a74c=unanswered[_0xd9ff('0x54')](_0x5e04d3[_0xd9ff('0x1b')]);if(_0x56a74c>-0x1){unanswered[_0xd9ff('0x55')](_0x56a74c,0x1);}}if(transfers[_0x5e04d3['uniqueid']]){transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt']=utils[_0xd9ff('0x18')]();transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x25')]=utils[_0xd9ff('0x38')](transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt'],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);transfers[_0x5e04d3['uniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x56');transfers[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(transfers[_0x5e04d3[_0xd9ff('0x1b')]],!![]);}if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]]['agentconnectAt']){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')]=utils[_0xd9ff('0x18')]();agents[_0x5e04d3[_0xd9ff('0x1b')]]['talktime']=utils['diffTime'](agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]=agents[_0x5e04d3['uniqueid']][_0xd9ff('0x3e')]?_0xd9ff('0x3e'):_0xd9ff('0x56');agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x57'),_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);}}catch(_0x4c2ad5){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x58'),_0x5e04d3[_0xd9ff('0x1b')]),_0x4c2ad5);}}; \ 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(_0x1a6c94,_0x445053){var _0x4a2d59=function(_0x3d8b63){while(--_0x3d8b63){_0x1a6c94['push'](_0x1a6c94['shift']());}};_0x4a2d59(++_0x445053);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4633d8,_0x9c9b09){_0x4633d8=_0x4633d8-0x0;var _0x163b16=_0x3f8c[_0x4633d8];return _0x163b16;};'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 bcf54af..430b52f 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 _0x3cd8=['accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%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','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','execif','gotoif','lodash','./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','queue','membername','interface','calleridnum','connectedlinenum','lastevent'];(function(_0x37c97d,_0x3205f0){var _0x3add5c=function(_0x15c15c){while(--_0x15c15c){_0x37c97d['push'](_0x37c97d['shift']());}};_0x3add5c(++_0x3205f0);}(_0x3cd8,0xbe));var _0x83cd=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x3cd8[_0x3932eb];return _0x5316e5;};'use strict';var _=require(_0x83cd('0x0'));var util=require('util');var utils=require(_0x83cd('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0x83cd('0x2'),_0x83cd('0x3'),'FAILED',_0x83cd('0x2'),_0x83cd('0x2'),'NO\x20ANSWER',_0x83cd('0x4'),_0x83cd('0x5'),_0x83cd('0x3'),_0x83cd('0x3'),_0x83cd('0x3')];var channels={};function writeDB(_0x32e8aa){var _0x35ecfe;if(transfers[_0x83cd('0x6')][_0x32e8aa[_0x83cd('0x7')]]){_0x35ecfe=_0x32e8aa[_0x83cd('0x7')];_0x32e8aa[_0x83cd('0x7')]=transfers[_0x83cd('0x6')][_0x32e8aa[_0x83cd('0x7')]][_0x83cd('0x8')];}utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0xb'),_0x32e8aa['uniqueid'],_0x32e8aa['channel'],_0x32e8aa[_0x83cd('0xc')],_0x32e8aa[_0x83cd('0xd')],_0x32e8aa[_0x83cd('0xe')],_0x32e8aa[_0x83cd('0xf')],_0x32e8aa[_0x83cd('0x10')],_0x32e8aa[_0x83cd('0x11')]));if(_0x32e8aa[_0x83cd('0x12')]){utils[_0x83cd('0x13')](_0x32e8aa[_0x83cd('0x12')])[_0x83cd('0x14')](function(_0x45005f){if(_0x45005f){_0x32e8aa[_0x83cd('0x15')]=_0x45005f['id'];}utils[_0x83cd('0x16')](_0x83cd('0x17'),_0x32e8aa);});}else{utils[_0x83cd('0x16')](_0x83cd('0x17'),_0x32e8aa);}if(channels[_0x32e8aa[_0x83cd('0x7')]]){delete channels[_0x32e8aa['uniqueid']];}else if(_0x35ecfe&&channels[_0x35ecfe]){delete transfers['blinds'][_0x35ecfe];delete channels[_0x35ecfe];}}exports[_0x83cd('0x18')]=function(_0x340993){try{utils[_0x83cd('0x19')](util[_0x83cd('0xa')](_0x83cd('0x1a'),_0x340993[_0x83cd('0x7')]),_0x340993);if(_0x340993[_0x83cd('0x7')]==_0x340993[_0x83cd('0x1b')]&&_0x340993[_0x83cd('0x1c')]!=_0x83cd('0x1d')){utils['info'](util['format'](_0x83cd('0x1e'),_0x340993[_0x83cd('0x7')],_0x340993['context'],_0x340993[_0x83cd('0x1f')]));channels[_0x340993[_0x83cd('0x7')]]={'uniqueid':_0x340993[_0x83cd('0x7')],'accountcode':_0x340993[_0x83cd('0x12')],'source':_0x340993[_0x83cd('0xf')],'destination':_0x340993[_0x83cd('0x1f')],'destinationcontext':_0x340993['context'],'channel':_0x340993[_0x83cd('0x1c')],'starttime':utils[_0x83cd('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x83cd('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x3fbec3){utils[_0x83cd('0x21')](util[_0x83cd('0xa')](_0x83cd('0x1a'),_0x340993[_0x83cd('0x7')]),_0x3fbec3);}};exports['newstate']=function(_0x4e8527){try{utils['debug'](util[_0x83cd('0xa')](_0x83cd('0x22'),_0x4e8527[_0x83cd('0x7')]),_0x4e8527);if(!_[_0x83cd('0x23')](channels[_0x4e8527['uniqueid']])&&_0x4e8527['channelstate']==0x6){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x24'),_0x4e8527[_0x83cd('0x7')],_0x4e8527[_0x83cd('0x25')],_0x4e8527['channel']));if(_['isNil'](channels[_0x4e8527[_0x83cd('0x7')]]['systemanswertime'])){channels[_0x4e8527[_0x83cd('0x7')]]['systemanswertime']=utils[_0x83cd('0x20')]();}}else if(!_['isNil'](channels[_0x4e8527['linkedid']])&&_0x4e8527[_0x83cd('0x26')]==0x6&&_0x4e8527[_0x83cd('0x25')]!=_0x83cd('0x27')){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x28'),_0x4e8527['uniqueid'],_0x4e8527[_0x83cd('0x1b')],_0x4e8527[_0x83cd('0x25')],_0x4e8527['channel']));channels[_0x4e8527[_0x83cd('0x1b')]][_0x83cd('0x12')]=_0x4e8527[_0x83cd('0x12')];channels[_0x4e8527[_0x83cd('0x1b')]][_0x83cd('0x29')]=_0x4e8527[_0x83cd('0x1c')];if(_[_0x83cd('0x23')](channels[_0x4e8527[_0x83cd('0x1b')]]['answertime'])){channels[_0x4e8527[_0x83cd('0x1b')]][_0x83cd('0x2a')]=utils[_0x83cd('0x20')]();}channels[_0x4e8527['linkedid']][_0x83cd('0x2b')]=dispositions[_['toNumber'](_0x4e8527[_0x83cd('0x26')])]||_0x83cd('0x4');}}catch(_0x58f191){utils[_0x83cd('0x21')](util['format'](_0x83cd('0x22'),_0x4e8527[_0x83cd('0x7')]),_0x58f191);}};exports[_0x83cd('0x2c')]=function(_0x51208d){try{if(!_['isNil'](channels[_0x51208d[_0x83cd('0x7')]])){utils[_0x83cd('0x19')](util[_0x83cd('0xa')]('[%s][calls][hangup]',_0x51208d['uniqueid']),_0x51208d);if(_[_0x83cd('0x23')](channels[_0x51208d[_0x83cd('0x7')]][_0x83cd('0x2d')])){channels[_0x51208d[_0x83cd('0x7')]][_0x83cd('0x2d')]=_0x51208d['calleridname']+'\x20<'+_0x51208d[_0x83cd('0xf')]+'>';}utils['info'](util[_0x83cd('0xa')](_0x83cd('0x2e'),_0x51208d[_0x83cd('0x7')],channels[_0x51208d[_0x83cd('0x7')]]['callerid'],_0x51208d['cause-txt']));channels[_0x51208d[_0x83cd('0x7')]][_0x83cd('0x2f')]=utils[_0x83cd('0x20')]();channels[_0x51208d['uniqueid']][_0x83cd('0x30')]=utils[_0x83cd('0x31')](channels[_0x51208d['uniqueid']][_0x83cd('0x2f')],channels[_0x51208d['uniqueid']][_0x83cd('0x32')]);channels[_0x51208d[_0x83cd('0x7')]]['billableseconds']=channels[_0x51208d[_0x83cd('0x7')]][_0x83cd('0x2a')]?utils['diffTime'](channels[_0x51208d[_0x83cd('0x7')]][_0x83cd('0x2f')],channels[_0x51208d[_0x83cd('0x7')]]['answertime']):0x0;writeDB(channels[_0x51208d[_0x83cd('0x7')]]);}}catch(_0x3ae962){utils[_0x83cd('0x21')](util[_0x83cd('0xa')](_0x83cd('0x33'),_0x51208d['uniqueid']),_0x3ae962);}};exports['attendedtransfer']=function(_0x225331){try{if(!_[_0x83cd('0x23')](channels[_0x225331[_0x83cd('0x34')]])){utils[_0x83cd('0x19')](util['format'](_0x83cd('0x35'),_0x225331[_0x83cd('0x36')]),_0x225331);if(channels[_0x225331['localtwolinkedid']]['channel']==_0x225331[_0x83cd('0x37')]){utils['info'](util[_0x83cd('0xa')](_0x83cd('0x38'),_0x225331[_0x83cd('0x36')],_0x225331[_0x83cd('0x34')],_0x225331[_0x83cd('0x39')]));channels[_0x225331[_0x83cd('0x34')]][_0x83cd('0x29')]=_0x225331[_0x83cd('0x39')];channels[_0x225331[_0x83cd('0x34')]][_0x83cd('0x3a')]='_attended';}else if(channels[_0x225331[_0x83cd('0x34')]][_0x83cd('0x1c')]=_0x225331['transfertargetchannel']){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x38'),_0x225331[_0x83cd('0x36')],_0x225331[_0x83cd('0x34')],_0x225331['origtransfererchannel']));channels[_0x225331[_0x83cd('0x34')]][_0x83cd('0x29')]=_0x225331[_0x83cd('0x3b')];channels[_0x225331[_0x83cd('0x34')]]['userfield']=_0x83cd('0x3c');}}}catch(_0x2ce880){utils[_0x83cd('0x21')](util['format'](_0x83cd('0x35'),_0x225331[_0x83cd('0x36')]),_0x2ce880);}};exports['musiconholdstart']=function(_0x43b544){try{if(!_['isNil'](channels[_0x43b544[_0x83cd('0x7')]])){utils[_0x83cd('0x19')](util[_0x83cd('0xa')]('[%s][calls][musiconholdstart]',_0x43b544['uniqueid']),_0x43b544);channels[_0x43b544['uniqueid']][_0x83cd('0x3d')]=utils[_0x83cd('0x20')]();utils['info'](util[_0x83cd('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x43b544[_0x83cd('0x7')],channels[_0x43b544[_0x83cd('0x7')]][_0x83cd('0x3d')]));}}catch(_0x2b2631){utils[_0x83cd('0x21')](util[_0x83cd('0xa')](_0x83cd('0x3e'),_0x43b544[_0x83cd('0x7')]),_0x2b2631);}};exports['musiconholdstop']=function(_0x8cd2dc){try{if(!_[_0x83cd('0x23')](channels[_0x8cd2dc[_0x83cd('0x7')]])){utils[_0x83cd('0x19')](util[_0x83cd('0xa')](_0x83cd('0x3f'),_0x8cd2dc[_0x83cd('0x7')]),_0x8cd2dc);if(!_[_0x83cd('0x23')](channels[_0x8cd2dc[_0x83cd('0x7')]][_0x83cd('0x3d')])){channels[_0x8cd2dc[_0x83cd('0x7')]][_0x83cd('0x40')]+=utils[_0x83cd('0x31')](utils[_0x83cd('0x20')](),channels[_0x8cd2dc[_0x83cd('0x7')]][_0x83cd('0x3d')]);utils[_0x83cd('0x9')](util['format'](_0x83cd('0x41'),_0x8cd2dc[_0x83cd('0x7')],channels[_0x8cd2dc['uniqueid']][_0x83cd('0x40')]));delete channels[_0x8cd2dc[_0x83cd('0x7')]][_0x83cd('0x3d')];}}}catch(_0x3a8dd8){utils['error'](util['format'](_0x83cd('0x3f'),_0x8cd2dc[_0x83cd('0x7')]),_0x3a8dd8);}};exports[_0x83cd('0x42')]=function(_0x5802f3){try{if(!_[_0x83cd('0x23')](channels[_0x5802f3[_0x83cd('0x7')]])){utils['debug'](util[_0x83cd('0xa')]('[%s][calls][varset]',_0x5802f3[_0x83cd('0x7')]),_0x5802f3);if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x44')])){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x45'),_0x5802f3[_0x83cd('0x7')],_0x5802f3[_0x83cd('0x46')]));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x47')]=_0x5802f3[_0x83cd('0x46')];}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x48')])){utils['info'](util[_0x83cd('0xa')](_0x83cd('0x49'),_0x5802f3['uniqueid'],_0x5802f3['value']));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x4a')]=_0x5802f3[_0x83cd('0x46')];channels[_0x5802f3['uniqueid']][_0x83cd('0x2d')]='\x22'+_0x5802f3[_0x83cd('0x46')]+'\x22\x20<'+_0x5802f3[_0x83cd('0x46')]+'>';}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x4b')])||!_[_0x83cd('0x23')](_0x5802f3['variable'][_0x83cd('0x4c')])){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x4d'),_0x5802f3[_0x83cd('0x7')],!_['isNil'](_0x5802f3[_0x83cd('0x43')]['xmd-callerid-preview'])?_0x83cd('0x4b'):_0x83cd('0x4c'),_0x5802f3['value']));channels[_0x5802f3[_0x83cd('0x7')]]['callerid']=_0x5802f3['value'];}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')]['xmd-queue'])||!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x4e')])){utils['info'](util[_0x83cd('0xa')](_0x83cd('0x4d'),_0x5802f3[_0x83cd('0x7')],!_['isNil'](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x4f')])?_0x83cd('0x4f'):_0x83cd('0x4e'),_0x5802f3[_0x83cd('0x46')]));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x50')]=_0x83cd('0x51');channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x52')]=_0x5802f3[_0x83cd('0x46')];channels[_0x5802f3['uniqueid']][_0x83cd('0xc')]=!![];}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')]['xmd-contactid'])){utils[_0x83cd('0x9')](util['format'](_0x83cd('0x53'),_0x5802f3[_0x83cd('0x7')],_0x5802f3[_0x83cd('0x46')]));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x54')]=_0x5802f3[_0x83cd('0x46')];}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')]['xmd-cdrtype'])){utils[_0x83cd('0x9')](util[_0x83cd('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5802f3[_0x83cd('0x7')],_0x5802f3['value']));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x55')]=_0x5802f3[_0x83cd('0x46')];}if(!_[_0x83cd('0x23')](_0x5802f3[_0x83cd('0x43')][_0x83cd('0x56')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5802f3[_0x83cd('0x7')],_0x5802f3['value']));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x57')]=_0x5802f3[_0x83cd('0x46')];}if(!_['isNil'](_0x5802f3[_0x83cd('0x43')]['sipcallid'])){utils[_0x83cd('0x9')](util[_0x83cd('0xa')](_0x83cd('0x58'),_0x5802f3['uniqueid'],_0x5802f3[_0x83cd('0x46')]));channels[_0x5802f3[_0x83cd('0x7')]][_0x83cd('0x59')]=_0x5802f3[_0x83cd('0x46')];}}}catch(_0x335704){utils[_0x83cd('0x21')](util[_0x83cd('0xa')](_0x83cd('0x5a'),_0x5802f3[_0x83cd('0x7')]),_0x335704);}};exports[_0x83cd('0x5b')]=function(_0x1f78e3){try{if(!_[_0x83cd('0x23')](channels[_0x1f78e3[_0x83cd('0x7')]])){utils['debug'](util[_0x83cd('0xa')](_0x83cd('0x5c'),_0x1f78e3['uniqueid']),_0x1f78e3);utils[_0x83cd('0x9')](util[_0x83cd('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1f78e3[_0x83cd('0x7')],_0x1f78e3[_0x83cd('0x5d')],_0x1f78e3[_0x83cd('0x5e')]));if(_0x1f78e3['application'][_0x83cd('0x5f')]()==_0x83cd('0x60')&&_[_0x83cd('0x61')](_0x1f78e3[_0x83cd('0x5e')][_0x83cd('0x5f')](),_0x83cd('0x62'))){var _0x3efa31=_0x1f78e3[_0x83cd('0x5e')][_0x83cd('0x63')]('=');var _0xed6caf=_0x3efa31[0x0][_0x83cd('0x64')](_0x3efa31[0x0][_0x83cd('0x65')]('(')+0x1,_0x3efa31[0x0][_0x83cd('0x65')](')'));var _0x5361dd=_0x3efa31[0x1];channels[_0x1f78e3[_0x83cd('0x7')]][_0xed6caf]=_0x5361dd;}if(!_['includes'](['hangup','noop',_0x83cd('0x66'),_0x83cd('0x60'),_0x83cd('0x67')],_0x1f78e3[_0x83cd('0x5d')][_0x83cd('0x5f')]())){channels[_0x1f78e3[_0x83cd('0x7')]][_0x83cd('0x50')]=_0x1f78e3['application'];channels[_0x1f78e3[_0x83cd('0x7')]]['lastdata']=_0x1f78e3[_0x83cd('0x5e')];}}}catch(_0x954ac3){utils[_0x83cd('0x21')](util['format'](_0x83cd('0x5c'),_0x1f78e3[_0x83cd('0x7')]),_0x954ac3);}}; \ No newline at end of file +var _0x5eeb=['CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','execif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5eeb,0x183));var _0xb5ee=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x5eeb[_0x28669c];return _0x4a3af6;};'use strict';var _=require(_0xb5ee('0x0'));var util=require(_0xb5ee('0x1'));var utils=require('./utils');var transfers=require(_0xb5ee('0x2'));var dispositions=[_0xb5ee('0x3'),_0xb5ee('0x4'),_0xb5ee('0x4'),_0xb5ee('0x3'),_0xb5ee('0x3'),_0xb5ee('0x3'),_0xb5ee('0x5'),'BUSY','FAILED','FAILED',_0xb5ee('0x4')];var channels={};function writeDB(_0x5983d1){var _0x35e741;if(transfers[_0xb5ee('0x6')][_0x5983d1['uniqueid']]){_0x35e741=_0x5983d1[_0xb5ee('0x7')];_0x5983d1[_0xb5ee('0x7')]=transfers[_0xb5ee('0x6')][_0x5983d1[_0xb5ee('0x7')]][_0xb5ee('0x8')];}utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5983d1[_0xb5ee('0x7')],_0x5983d1[_0xb5ee('0xb')],_0x5983d1[_0xb5ee('0xc')],_0x5983d1[_0xb5ee('0xd')],_0x5983d1['interface'],_0x5983d1[_0xb5ee('0xe')],_0x5983d1['connectedlinenum'],_0x5983d1[_0xb5ee('0xf')]));if(_0x5983d1[_0xb5ee('0x10')]){utils[_0xb5ee('0x11')](_0x5983d1[_0xb5ee('0x10')])[_0xb5ee('0x12')](function(_0xeb2f41){if(_0xeb2f41){_0x5983d1[_0xb5ee('0x13')]=_0xeb2f41['id'];}utils[_0xb5ee('0x14')]('CreateVoiceCallReport',_0x5983d1);});}else{utils[_0xb5ee('0x14')](_0xb5ee('0x15'),_0x5983d1);}if(channels[_0x5983d1[_0xb5ee('0x7')]]){delete channels[_0x5983d1[_0xb5ee('0x7')]];}else if(_0x35e741&&channels[_0x35e741]){delete transfers['blinds'][_0x35e741];delete channels[_0x35e741];}}exports[_0xb5ee('0x16')]=function(_0x36cc95){try{utils[_0xb5ee('0x17')](util[_0xb5ee('0xa')](_0xb5ee('0x18'),_0x36cc95[_0xb5ee('0x7')]),_0x36cc95);if(_0x36cc95[_0xb5ee('0x7')]==_0x36cc95[_0xb5ee('0x19')]&&_0x36cc95[_0xb5ee('0xb')]!='OutgoingSpoolFailed'){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x1a'),_0x36cc95['uniqueid'],_0x36cc95[_0xb5ee('0x1b')],_0x36cc95[_0xb5ee('0x1c')]));channels[_0x36cc95['uniqueid']]={'uniqueid':_0x36cc95['uniqueid'],'accountcode':_0x36cc95[_0xb5ee('0x10')],'source':_0x36cc95['calleridnum'],'destination':_0x36cc95[_0xb5ee('0x1c')],'destinationcontext':_0x36cc95[_0xb5ee('0x1b')],'channel':_0x36cc95[_0xb5ee('0xb')],'starttime':utils[_0xb5ee('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xb5ee('0x1e')};}}catch(_0x3255f3){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')](_0xb5ee('0x18'),_0x36cc95[_0xb5ee('0x7')]),_0x3255f3);}};exports['newstate']=function(_0x2f6d2b){try{utils[_0xb5ee('0x17')](util['format'](_0xb5ee('0x20'),_0x2f6d2b[_0xb5ee('0x7')]),_0x2f6d2b);if(!_[_0xb5ee('0x21')](channels[_0x2f6d2b['uniqueid']])&&_0x2f6d2b[_0xb5ee('0x22')]==0x6){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x23'),_0x2f6d2b[_0xb5ee('0x7')],_0x2f6d2b[_0xb5ee('0x1b')],_0x2f6d2b[_0xb5ee('0xb')]));if(_[_0xb5ee('0x21')](channels[_0x2f6d2b[_0xb5ee('0x7')]][_0xb5ee('0x24')])){channels[_0x2f6d2b[_0xb5ee('0x7')]][_0xb5ee('0x24')]=utils['now']();}}else if(!_[_0xb5ee('0x21')](channels[_0x2f6d2b[_0xb5ee('0x19')]])&&_0x2f6d2b[_0xb5ee('0x22')]==0x6&&_0x2f6d2b[_0xb5ee('0x1b')]!=_0xb5ee('0x25')){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2f6d2b[_0xb5ee('0x7')],_0x2f6d2b[_0xb5ee('0x19')],_0x2f6d2b[_0xb5ee('0x1b')],_0x2f6d2b['channel']));channels[_0x2f6d2b[_0xb5ee('0x19')]][_0xb5ee('0x10')]=_0x2f6d2b[_0xb5ee('0x10')];channels[_0x2f6d2b['linkedid']]['destinationchannel']=_0x2f6d2b[_0xb5ee('0xb')];if(_[_0xb5ee('0x21')](channels[_0x2f6d2b['linkedid']][_0xb5ee('0x26')])){channels[_0x2f6d2b['linkedid']][_0xb5ee('0x26')]=utils[_0xb5ee('0x1d')]();}channels[_0x2f6d2b['linkedid']]['disposition']=dispositions[_[_0xb5ee('0x27')](_0x2f6d2b[_0xb5ee('0x22')])]||_0xb5ee('0x5');}}catch(_0x465bff){utils['error'](util['format'](_0xb5ee('0x20'),_0x2f6d2b[_0xb5ee('0x7')]),_0x465bff);}};exports[_0xb5ee('0x28')]=function(_0x42cac6){try{if(!_[_0xb5ee('0x21')](channels[_0x42cac6[_0xb5ee('0x7')]])){utils[_0xb5ee('0x17')](util['format'](_0xb5ee('0x29'),_0x42cac6[_0xb5ee('0x7')]),_0x42cac6);if(_['isNil'](channels[_0x42cac6[_0xb5ee('0x7')]][_0xb5ee('0x2a')])){channels[_0x42cac6[_0xb5ee('0x7')]]['callerid']=_0x42cac6['calleridname']+'\x20<'+_0x42cac6['calleridnum']+'>';}utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x42cac6[_0xb5ee('0x7')],channels[_0x42cac6['uniqueid']]['callerid'],_0x42cac6[_0xb5ee('0x2b')]));channels[_0x42cac6['uniqueid']][_0xb5ee('0x2c')]=utils[_0xb5ee('0x1d')]();channels[_0x42cac6['uniqueid']][_0xb5ee('0x2d')]=utils[_0xb5ee('0x2e')](channels[_0x42cac6['uniqueid']][_0xb5ee('0x2c')],channels[_0x42cac6[_0xb5ee('0x7')]]['starttime']);channels[_0x42cac6[_0xb5ee('0x7')]][_0xb5ee('0x2f')]=channels[_0x42cac6[_0xb5ee('0x7')]]['answertime']?utils[_0xb5ee('0x2e')](channels[_0x42cac6[_0xb5ee('0x7')]][_0xb5ee('0x2c')],channels[_0x42cac6[_0xb5ee('0x7')]][_0xb5ee('0x26')]):0x0;writeDB(channels[_0x42cac6[_0xb5ee('0x7')]]);}}catch(_0x40321d){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')]('[%s][calls][hangup]',_0x42cac6[_0xb5ee('0x7')]),_0x40321d);}};exports[_0xb5ee('0x30')]=function(_0x7333fb){try{if(!_[_0xb5ee('0x21')](channels[_0x7333fb[_0xb5ee('0x31')]])){utils[_0xb5ee('0x17')](util[_0xb5ee('0xa')](_0xb5ee('0x32'),_0x7333fb[_0xb5ee('0x33')]),_0x7333fb);if(channels[_0x7333fb[_0xb5ee('0x31')]][_0xb5ee('0xb')]==_0x7333fb[_0xb5ee('0x34')]){utils[_0xb5ee('0x9')](util['format'](_0xb5ee('0x35'),_0x7333fb[_0xb5ee('0x33')],_0x7333fb[_0xb5ee('0x31')],_0x7333fb['secondtransfererchannel']));channels[_0x7333fb[_0xb5ee('0x31')]]['destinationchannel']=_0x7333fb['secondtransfererchannel'];channels[_0x7333fb[_0xb5ee('0x31')]][_0xb5ee('0x36')]=_0xb5ee('0x37');}else if(channels[_0x7333fb['localtwolinkedid']][_0xb5ee('0xb')]=_0x7333fb[_0xb5ee('0x38')]){utils[_0xb5ee('0x9')](util['format'](_0xb5ee('0x35'),_0x7333fb[_0xb5ee('0x33')],_0x7333fb[_0xb5ee('0x31')],_0x7333fb[_0xb5ee('0x39')]));channels[_0x7333fb[_0xb5ee('0x31')]][_0xb5ee('0x3a')]=_0x7333fb['origtransfererchannel'];channels[_0x7333fb[_0xb5ee('0x31')]][_0xb5ee('0x36')]='_attended';}}}catch(_0x42f1ea){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x7333fb[_0xb5ee('0x33')]),_0x42f1ea);}};exports['musiconholdstart']=function(_0x367ccc){try{if(!_[_0xb5ee('0x21')](channels[_0x367ccc[_0xb5ee('0x7')]])){utils['debug'](util[_0xb5ee('0xa')](_0xb5ee('0x3b'),_0x367ccc[_0xb5ee('0x7')]),_0x367ccc);channels[_0x367ccc[_0xb5ee('0x7')]]['musiconholdstartAt']=utils[_0xb5ee('0x1d')]();utils[_0xb5ee('0x9')](util['format'](_0xb5ee('0x3c'),_0x367ccc[_0xb5ee('0x7')],channels[_0x367ccc[_0xb5ee('0x7')]][_0xb5ee('0x3d')]));}}catch(_0x1aaa6b){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')]('[%s][calls][musiconholdstart]',_0x367ccc[_0xb5ee('0x7')]),_0x1aaa6b);}};exports[_0xb5ee('0x3e')]=function(_0x20eea2){try{if(!_[_0xb5ee('0x21')](channels[_0x20eea2[_0xb5ee('0x7')]])){utils['debug'](util[_0xb5ee('0xa')](_0xb5ee('0x3f'),_0x20eea2[_0xb5ee('0x7')]),_0x20eea2);if(!_[_0xb5ee('0x21')](channels[_0x20eea2[_0xb5ee('0x7')]][_0xb5ee('0x3d')])){channels[_0x20eea2[_0xb5ee('0x7')]][_0xb5ee('0x40')]+=utils[_0xb5ee('0x2e')](utils['now'](),channels[_0x20eea2['uniqueid']][_0xb5ee('0x3d')]);utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x41'),_0x20eea2['uniqueid'],channels[_0x20eea2[_0xb5ee('0x7')]][_0xb5ee('0x40')]));delete channels[_0x20eea2[_0xb5ee('0x7')]][_0xb5ee('0x3d')];}}}catch(_0x5bf509){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')](_0xb5ee('0x3f'),_0x20eea2[_0xb5ee('0x7')]),_0x5bf509);}};exports[_0xb5ee('0x42')]=function(_0x28925a){try{if(!_['isNil'](channels[_0x28925a[_0xb5ee('0x7')]])){utils[_0xb5ee('0x17')](util[_0xb5ee('0xa')](_0xb5ee('0x43'),_0x28925a[_0xb5ee('0x7')]),_0x28925a);if(!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x45')])){utils[_0xb5ee('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x28925a['uniqueid'],_0x28925a[_0xb5ee('0x46')]));channels[_0x28925a[_0xb5ee('0x7')]]['source']=_0x28925a[_0xb5ee('0x46')];}if(!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x47')])){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x48'),_0x28925a['uniqueid'],_0x28925a['value']));channels[_0x28925a[_0xb5ee('0x7')]][_0xb5ee('0x49')]=_0x28925a[_0xb5ee('0x46')];channels[_0x28925a['uniqueid']][_0xb5ee('0x2a')]='\x22'+_0x28925a['value']+_0xb5ee('0x4a')+_0x28925a['value']+'>';}if(!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x4b')])||!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')]['xmd-callerid'])){utils[_0xb5ee('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x28925a['uniqueid'],!_['isNil'](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x4b')])?_0xb5ee('0x4b'):_0xb5ee('0x4c'),_0x28925a['value']));channels[_0x28925a['uniqueid']][_0xb5ee('0x2a')]=_0x28925a['value'];}if(!_[_0xb5ee('0x21')](_0x28925a['variable'][_0xb5ee('0x4d')])||!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')]['xmcs-queue'])){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x4e'),_0x28925a[_0xb5ee('0x7')],!_[_0xb5ee('0x21')](_0x28925a['variable'][_0xb5ee('0x4d')])?_0xb5ee('0x4d'):'xmcs-queue',_0x28925a[_0xb5ee('0x46')]));channels[_0x28925a[_0xb5ee('0x7')]][_0xb5ee('0x4f')]=_0xb5ee('0x50');channels[_0x28925a[_0xb5ee('0x7')]][_0xb5ee('0x51')]=_0x28925a[_0xb5ee('0x46')];channels[_0x28925a['uniqueid']][_0xb5ee('0xc')]=!![];}if(!_['isNil'](_0x28925a[_0xb5ee('0x44')]['xmd-contactid'])){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x52'),_0x28925a[_0xb5ee('0x7')],_0x28925a['value']));channels[_0x28925a[_0xb5ee('0x7')]]['ContactId']=_0x28925a[_0xb5ee('0x46')];}if(!_['isNil'](_0x28925a['variable'][_0xb5ee('0x53')])){utils['info'](util[_0xb5ee('0xa')](_0xb5ee('0x54'),_0x28925a[_0xb5ee('0x7')],_0x28925a[_0xb5ee('0x46')]));channels[_0x28925a[_0xb5ee('0x7')]]['type']=_0x28925a[_0xb5ee('0x46')];}if(!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x55')])){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x28925a[_0xb5ee('0x7')],_0x28925a['value']));channels[_0x28925a['uniqueid']][_0xb5ee('0x56')]=_0x28925a['value'];}if(!_[_0xb5ee('0x21')](_0x28925a[_0xb5ee('0x44')][_0xb5ee('0x57')])){utils[_0xb5ee('0x9')](util[_0xb5ee('0xa')](_0xb5ee('0x58'),_0x28925a[_0xb5ee('0x7')],_0x28925a[_0xb5ee('0x46')]));channels[_0x28925a[_0xb5ee('0x7')]]['sipcallid']=_0x28925a[_0xb5ee('0x46')];}}}catch(_0xed0ff0){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')](_0xb5ee('0x43'),_0x28925a[_0xb5ee('0x7')]),_0xed0ff0);}};exports[_0xb5ee('0x59')]=function(_0x52ffc4){try{if(!_[_0xb5ee('0x21')](channels[_0x52ffc4[_0xb5ee('0x7')]])){utils['debug'](util[_0xb5ee('0xa')](_0xb5ee('0x5a'),_0x52ffc4['uniqueid']),_0x52ffc4);utils['info'](util['format'](_0xb5ee('0x5b'),_0x52ffc4['uniqueid'],_0x52ffc4[_0xb5ee('0x5c')],_0x52ffc4[_0xb5ee('0x5d')]));if(_0x52ffc4[_0xb5ee('0x5c')][_0xb5ee('0x5e')]()==_0xb5ee('0x5f')&&_[_0xb5ee('0x60')](_0x52ffc4[_0xb5ee('0x5d')][_0xb5ee('0x5e')](),'cdr')){var _0x3726fd=_0x52ffc4[_0xb5ee('0x5d')][_0xb5ee('0x61')]('=');var _0x4a03bd=_0x3726fd[0x0][_0xb5ee('0x62')](_0x3726fd[0x0][_0xb5ee('0x63')]('(')+0x1,_0x3726fd[0x0][_0xb5ee('0x63')](')'));var _0xfdf810=_0x3726fd[0x1];channels[_0x52ffc4['uniqueid']][_0x4a03bd]=_0xfdf810;}if(!_['includes']([_0xb5ee('0x28'),_0xb5ee('0x64'),_0xb5ee('0x65'),'set','gotoif'],_0x52ffc4[_0xb5ee('0x5c')][_0xb5ee('0x5e')]())){channels[_0x52ffc4[_0xb5ee('0x7')]][_0xb5ee('0x4f')]=_0x52ffc4[_0xb5ee('0x5c')];channels[_0x52ffc4['uniqueid']][_0xb5ee('0x51')]=_0x52ffc4[_0xb5ee('0x5d')];}}}catch(_0x5db69a){utils[_0xb5ee('0x1f')](util[_0xb5ee('0xa')]('[%s][calls][newexten]',_0x52ffc4['uniqueid']),_0x5db69a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6e8c672..e9e0740 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 _0x8de3=['info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x8de3,0x11c));var _0x38de=function(_0x3b1d1e,_0x10d8d9){_0x3b1d1e=_0x3b1d1e-0x0;var _0x5670b7=_0x8de3[_0x3b1d1e];return _0x5670b7;};'use strict';var utils=require(_0x38de('0x0'));exports[_0x38de('0x1')]=function(){utils[_0x38de('0x2')](_0x38de('0x3'));};exports['shutdown']=function(){utils[_0x38de('0x2')](_0x38de('0x4'));};exports[_0x38de('0x5')]=function(){utils[_0x38de('0x2')](_0x38de('0x6'));};exports['error']=function(_0x4cc59e){utils[_0x38de('0x7')](_0x38de('0x8'),_0x4cc59e);};exports[_0x38de('0x9')]=function(){utils[_0x38de('0x2')](_0x38de('0xa'));};exports['managerevent']=function(_0x293d20){}; \ No newline at end of file +var _0xbe64=['[core]\x20error','[core]\x20close','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x11dbba,_0x35d4eb){var _0x1bff76=function(_0x1dc29b){while(--_0x1dc29b){_0x11dbba['push'](_0x11dbba['shift']());}};_0x1bff76(++_0x35d4eb);}(_0xbe64,0x65));var _0x4be6=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xbe64[_0x28f1de];return _0x5b5dad;};'use strict';var utils=require('./utils');exports[_0x4be6('0x0')]=function(){utils[_0x4be6('0x1')](_0x4be6('0x2'));};exports[_0x4be6('0x3')]=function(){utils['info'](_0x4be6('0x4'));};exports[_0x4be6('0x5')]=function(){utils['info'](_0x4be6('0x6'));};exports['error']=function(_0x374c6e){utils['error'](_0x4be6('0x7'),_0x374c6e);};exports['close']=function(){utils[_0x4be6('0x1')](_0x4be6('0x8'));};exports['managerevent']=function(_0x51631e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3ec4810..814684f 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 _0xa543=['util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','holdtime','endtime','billableseconds','diffTime'];(function(_0x15518b,_0x5de440){var _0x316e7f=function(_0x159f99){while(--_0x159f99){_0x15518b['push'](_0x15518b['shift']());}};_0x316e7f(++_0x5de440);}(_0xa543,0x16c));var _0x3a54=function(_0x494874,_0x516bf4){_0x494874=_0x494874-0x0;var _0x2a4ab9=_0xa543[_0x494874];return _0x2a4ab9;};'use strict';var _=require('lodash');var util=require(_0x3a54('0x0'));var utils=require(_0x3a54('0x1'));var dials={};function writeDB(_0x4a8488){utils[_0x3a54('0x2')](util[_0x3a54('0x3')](_0x3a54('0x4'),_0x4a8488[_0x3a54('0x5')],_0x4a8488[_0x3a54('0x6')],_0x4a8488[_0x3a54('0x7')],_0x4a8488[_0x3a54('0x8')],_0x4a8488[_0x3a54('0x9')],_0x4a8488[_0x3a54('0xa')]));utils[_0x3a54('0xb')](_0x3a54('0xc'),_0x4a8488);delete dials[_0x4a8488['uniqueid']];}exports['newexten']=function(_0x2e76bf){try{utils[_0x3a54('0xd')](util['format'](_0x3a54('0xe'),_0x2e76bf[_0x3a54('0x5')]),_0x2e76bf);utils[_0x3a54('0x2')](util[_0x3a54('0x3')](_0x3a54('0xf'),_0x2e76bf[_0x3a54('0x5')],_0x2e76bf['application'],_0x2e76bf[_0x3a54('0x10')]));if(_0x2e76bf[_0x3a54('0x11')][_0x3a54('0x12')]()==_0x3a54('0x13')&&_[_0x3a54('0x14')](_0x2e76bf[_0x3a54('0x10')]['toLowerCase'](),_0x3a54('0x15'))){var _0x32df41=_0x2e76bf[_0x3a54('0x10')][_0x3a54('0x16')]('=');dials[_0x2e76bf[_0x3a54('0x5')]]={'routeId':_0x32df41[0x1]};}}catch(_0x5b8404){utils[_0x3a54('0x17')](util[_0x3a54('0x3')](_0x3a54('0xe'),_0x2e76bf['uniqueid']),_0x5b8404);}};exports[_0x3a54('0x18')]=function(_0x6c39bf){try{utils['debug'](util[_0x3a54('0x3')](_0x3a54('0x19'),_0x6c39bf['uniqueid']),_0x6c39bf);if(!_[_0x3a54('0x1a')](_0x6c39bf[_0x3a54('0x1b')][_0x3a54('0x1c')])){utils[_0x3a54('0x2')](util[_0x3a54('0x3')](_0x3a54('0x1d'),_0x6c39bf[_0x3a54('0x5')],_0x6c39bf[_0x3a54('0x1e')]));dials[_0x6c39bf[_0x3a54('0x5')]]={'routeId':_0x6c39bf[_0x3a54('0x1e')]};}}catch(_0x38cac6){utils[_0x3a54('0x17')](util[_0x3a54('0x3')](_0x3a54('0x19'),_0x6c39bf[_0x3a54('0x5')]),_0x38cac6);}};exports['dialbegin']=function(_0x5c3940){try{if(!_['isNil'](dials[_0x5c3940[_0x3a54('0x5')]])){utils['debug'](util['format'](_0x3a54('0x1f'),_0x5c3940[_0x3a54('0x5')]),_0x5c3940);dials[_0x5c3940[_0x3a54('0x5')]]=_[_0x3a54('0x20')](dials[_0x5c3940['uniqueid']],_0x5c3940);dials[_0x5c3940[_0x3a54('0x5')]][_0x3a54('0x21')]=utils[_0x3a54('0x22')]();dials[_0x5c3940[_0x3a54('0x5')]]['lastevent']=_0x3a54('0x23');utils[_0x3a54('0x2')](util[_0x3a54('0x3')](_0x3a54('0x24'),_0x5c3940[_0x3a54('0x5')],dials[_0x5c3940['uniqueid']]['starttime']));}}catch(_0x565366){utils[_0x3a54('0x17')](util[_0x3a54('0x3')]('[%s][dials][dialbegin]',_0x5c3940['uniqueid']),_0x565366);}};exports[_0x3a54('0x25')]=function(_0x7d7e91){try{if(!_[_0x3a54('0x1a')](dials[_0x7d7e91[_0x3a54('0x5')]])){utils['debug'](util[_0x3a54('0x3')]('[%s][dials][dialend]',_0x7d7e91[_0x3a54('0x5')]),_0x7d7e91);dials[_0x7d7e91['uniqueid']][_0x3a54('0xa')]=_0x7d7e91['dialstatus'];if(_0x7d7e91[_0x3a54('0xa')]==_0x3a54('0x26')){dials[_0x7d7e91[_0x3a54('0x5')]]=_[_0x3a54('0x20')](dials[_0x7d7e91[_0x3a54('0x5')]],_0x7d7e91);dials[_0x7d7e91['uniqueid']][_0x3a54('0x27')]=utils[_0x3a54('0x22')]();dials[_0x7d7e91[_0x3a54('0x5')]][_0x3a54('0x28')]=_0x3a54('0x29');utils[_0x3a54('0x2')](util[_0x3a54('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x7d7e91[_0x3a54('0x5')],_0x7d7e91[_0x3a54('0xa')],dials[_0x7d7e91[_0x3a54('0x5')]]['answertime']));}else{utils['info'](util[_0x3a54('0x3')](_0x3a54('0x2a'),_0x7d7e91[_0x3a54('0x5')],_0x7d7e91[_0x3a54('0xa')]));}}}catch(_0x14163e){utils[_0x3a54('0x17')](util['format'](_0x3a54('0x2b'),_0x7d7e91[_0x3a54('0x5')]),_0x14163e);}};exports[_0x3a54('0x2c')]=function(_0x2e68f7){try{if(!_[_0x3a54('0x1a')](dials[_0x2e68f7[_0x3a54('0x5')]])){utils[_0x3a54('0xd')](util[_0x3a54('0x3')](_0x3a54('0x2d'),_0x2e68f7[_0x3a54('0x5')]),_0x2e68f7);utils['info'](util[_0x3a54('0x3')](_0x3a54('0x2e'),_0x2e68f7[_0x3a54('0x5')],_0x2e68f7[_0x3a54('0x8')],_0x2e68f7['calleridname'],_0x2e68f7['cause-txt']));dials[_0x2e68f7[_0x3a54('0x5')]]=_[_0x3a54('0x20')](dials[_0x2e68f7['uniqueid']],{'endtime':utils[_0x3a54('0x22')](),'lastevent':_0x3a54('0x2f')});dials[_0x2e68f7[_0x3a54('0x5')]]['duration']=utils['diffTime'](dials[_0x2e68f7[_0x3a54('0x5')]]['endtime'],dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x21')]);dials[_0x2e68f7['uniqueid']][_0x3a54('0x30')]=utils['diffTime'](dials[_0x2e68f7['uniqueid']][_0x3a54('0x27')]||dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x31')],dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x21')]);dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x32')]=dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x27')]?utils[_0x3a54('0x33')](dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x31')],dials[_0x2e68f7[_0x3a54('0x5')]][_0x3a54('0x27')]):0x0;writeDB(dials[_0x2e68f7['uniqueid']]);}}catch(_0x362aca){utils[_0x3a54('0x17')](util[_0x3a54('0x3')](_0x3a54('0x2d'),_0x2e68f7[_0x3a54('0x5')]),_0x362aca);}}; \ No newline at end of file +var _0x44e3=['info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][newexten]','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','starttime','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils'];(function(_0x3bb650,_0x1ea09b){var _0x369794=function(_0x1c942f){while(--_0x1c942f){_0x3bb650['push'](_0x3bb650['shift']());}};_0x369794(++_0x1ea09b);}(_0x44e3,0x141));var _0x344e=function(_0x3aea29,_0x57a92b){_0x3aea29=_0x3aea29-0x0;var _0x884fd6=_0x44e3[_0x3aea29];return _0x884fd6;};'use strict';var _=require(_0x344e('0x0'));var util=require(_0x344e('0x1'));var utils=require(_0x344e('0x2'));var dials={};function writeDB(_0x5478dd){utils[_0x344e('0x3')](util[_0x344e('0x4')](_0x344e('0x5'),_0x5478dd[_0x344e('0x6')],_0x5478dd[_0x344e('0x7')],_0x5478dd[_0x344e('0x8')],_0x5478dd[_0x344e('0x9')],_0x5478dd[_0x344e('0xa')],_0x5478dd[_0x344e('0xb')]));utils[_0x344e('0xc')](_0x344e('0xd'),_0x5478dd);delete dials[_0x5478dd[_0x344e('0x6')]];}exports[_0x344e('0xe')]=function(_0x8950d9){try{utils[_0x344e('0xf')](util[_0x344e('0x4')]('[%s][dials][newexten]',_0x8950d9[_0x344e('0x6')]),_0x8950d9);utils['info'](util[_0x344e('0x4')](_0x344e('0x10'),_0x8950d9[_0x344e('0x6')],_0x8950d9['application'],_0x8950d9['appdata']));if(_0x8950d9[_0x344e('0x11')][_0x344e('0x12')]()==_0x344e('0x13')&&_[_0x344e('0x14')](_0x8950d9[_0x344e('0x15')]['toLowerCase'](),_0x344e('0x16'))){var _0x28c50e=_0x8950d9['appdata'][_0x344e('0x17')]('=');dials[_0x8950d9[_0x344e('0x6')]]={'routeId':_0x28c50e[0x1]};}}catch(_0x42f371){utils[_0x344e('0x18')](util['format'](_0x344e('0x19'),_0x8950d9[_0x344e('0x6')]),_0x42f371);}};exports['varset']=function(_0x3be3e9){try{utils[_0x344e('0xf')](util[_0x344e('0x4')](_0x344e('0x1a'),_0x3be3e9[_0x344e('0x6')]),_0x3be3e9);if(!_['isNil'](_0x3be3e9[_0x344e('0x1b')][_0x344e('0x1c')])){utils[_0x344e('0x3')](util[_0x344e('0x4')](_0x344e('0x1d'),_0x3be3e9[_0x344e('0x6')],_0x3be3e9[_0x344e('0x1e')]));dials[_0x3be3e9[_0x344e('0x6')]]={'routeId':_0x3be3e9[_0x344e('0x1e')]};}}catch(_0x4674bf){utils[_0x344e('0x18')](util[_0x344e('0x4')](_0x344e('0x1a'),_0x3be3e9[_0x344e('0x6')]),_0x4674bf);}};exports['dialbegin']=function(_0x3d8810){try{if(!_[_0x344e('0x1f')](dials[_0x3d8810[_0x344e('0x6')]])){utils[_0x344e('0xf')](util['format'](_0x344e('0x20'),_0x3d8810[_0x344e('0x6')]),_0x3d8810);dials[_0x3d8810[_0x344e('0x6')]]=_[_0x344e('0x21')](dials[_0x3d8810[_0x344e('0x6')]],_0x3d8810);dials[_0x3d8810[_0x344e('0x6')]]['starttime']=utils[_0x344e('0x22')]();dials[_0x3d8810['uniqueid']][_0x344e('0x23')]=_0x344e('0x24');utils[_0x344e('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3d8810[_0x344e('0x6')],dials[_0x3d8810['uniqueid']][_0x344e('0x25')]));}}catch(_0x52ddab){utils[_0x344e('0x18')](util['format'](_0x344e('0x20'),_0x3d8810[_0x344e('0x6')]),_0x52ddab);}};exports['dialend']=function(_0x23ff93){try{if(!_[_0x344e('0x1f')](dials[_0x23ff93['uniqueid']])){utils['debug'](util[_0x344e('0x4')](_0x344e('0x26'),_0x23ff93['uniqueid']),_0x23ff93);dials[_0x23ff93[_0x344e('0x6')]][_0x344e('0xb')]=_0x23ff93[_0x344e('0xb')];if(_0x23ff93[_0x344e('0xb')]=='ANSWER'){dials[_0x23ff93[_0x344e('0x6')]]=_['assign'](dials[_0x23ff93['uniqueid']],_0x23ff93);dials[_0x23ff93[_0x344e('0x6')]]['answertime']=utils[_0x344e('0x22')]();dials[_0x23ff93[_0x344e('0x6')]][_0x344e('0x23')]=_0x344e('0x27');utils[_0x344e('0x3')](util[_0x344e('0x4')](_0x344e('0x28'),_0x23ff93[_0x344e('0x6')],_0x23ff93[_0x344e('0xb')],dials[_0x23ff93[_0x344e('0x6')]][_0x344e('0x29')]));}else{utils[_0x344e('0x3')](util[_0x344e('0x4')](_0x344e('0x2a'),_0x23ff93[_0x344e('0x6')],_0x23ff93[_0x344e('0xb')]));}}}catch(_0x591369){utils['error'](util['format'](_0x344e('0x26'),_0x23ff93[_0x344e('0x6')]),_0x591369);}};exports[_0x344e('0x2b')]=function(_0x2c769a){try{if(!_['isNil'](dials[_0x2c769a[_0x344e('0x6')]])){utils[_0x344e('0xf')](util[_0x344e('0x4')](_0x344e('0x2c'),_0x2c769a[_0x344e('0x6')]),_0x2c769a);utils['info'](util[_0x344e('0x4')](_0x344e('0x2d'),_0x2c769a['uniqueid'],_0x2c769a[_0x344e('0x9')],_0x2c769a[_0x344e('0x2e')],_0x2c769a[_0x344e('0x2f')]));dials[_0x2c769a[_0x344e('0x6')]]=_['assign'](dials[_0x2c769a[_0x344e('0x6')]],{'endtime':utils[_0x344e('0x22')](),'lastevent':_0x344e('0x30')});dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x31')]=utils[_0x344e('0x32')](dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x33')],dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x25')]);dials[_0x2c769a['uniqueid']][_0x344e('0x34')]=utils[_0x344e('0x32')](dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x29')]||dials[_0x2c769a[_0x344e('0x6')]]['endtime'],dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x25')]);dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x35')]=dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x29')]?utils[_0x344e('0x32')](dials[_0x2c769a['uniqueid']][_0x344e('0x33')],dials[_0x2c769a[_0x344e('0x6')]][_0x344e('0x29')]):0x0;writeDB(dials[_0x2c769a[_0x344e('0x6')]]);}}catch(_0x421b30){utils[_0x344e('0x18')](util[_0x344e('0x4')](_0x344e('0x2c'),_0x2c769a[_0x344e('0x6')]),_0x421b30);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8847357..aa154bd 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 _0x2e14=['asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','debug','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','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','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]'];(function(_0x178869,_0x3689e7){var _0x500ec3=function(_0x4b0677){while(--_0x4b0677){_0x178869['push'](_0x178869['shift']());}};_0x500ec3(++_0x3689e7);}(_0x2e14,0x1dc));var _0x42e1=function(_0x7c8431,_0x3837d3){_0x7c8431=_0x7c8431-0x0;var _0x2e27eb=_0x2e14[_0x7c8431];return _0x2e27eb;};var AsteriskManager=require(_0x42e1('0x0'));var config=require(_0x42e1('0x1'));var utils=require(_0x42e1('0x2'));var util=require(_0x42e1('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x42e1('0x4')],config[_0x42e1('0x5')]['ip'],config[_0x42e1('0x5')][_0x42e1('0x6')],config[_0x42e1('0x5')][_0x42e1('0x7')],!![]);ami[_0x42e1('0x8')]();if(config[_0x42e1('0x9')]&&config[_0x42e1('0x9')][_0x42e1('0xa')]){utils[_0x42e1('0xb')](_0x42e1('0xc'));}else{var agents=require(_0x42e1('0xd'));var calls=require('./calls.controller');var queues=require(_0x42e1('0xe'));var recordings=require(_0x42e1('0xf'));var members=require(_0x42e1('0x10'));var dials=require(_0x42e1('0x11'));var transfers=require(_0x42e1('0x12'));var core=require('./core.controller');ami['on'](_0x42e1('0x13'),core[_0x42e1('0x13')]);ami['on']('shutdown',core[_0x42e1('0x14')]);ami['on'](_0x42e1('0x15'),core['fullybooted']);ami['on'](_0x42e1('0x16'),core[_0x42e1('0x16')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0x42e1('0x17')]);ami['on']('devicestatechange',function(_0x107ac8){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')]('[%s][index][devicestatechange]',_0x107ac8[_0x42e1('0x1a')]),_0x107ac8);members[_0x42e1('0x1b')](_0x107ac8);}catch(_0x565ffd){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x1c'),_0x107ac8['device']),_0x565ffd);}});ami['on'](_0x42e1('0x1d'),function(_0x58f465){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x1e'),_0x58f465[_0x42e1('0x1f')]),_0x58f465);agents[_0x42e1('0x1d')](_0x58f465);}catch(_0x8ddd0a){utils['error'](util[_0x42e1('0x19')]('[%s][index][agentcalled]',_0x58f465[_0x42e1('0x1f')]),_0x8ddd0a);}});ami['on']('agentringnoanswer',function(_0x34e125){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')]('[%s][index][agentringnoanswer]',_0x34e125[_0x42e1('0x1f')]),_0x34e125);agents[_0x42e1('0x20')](_0x34e125);}catch(_0x27b1de){utils[_0x42e1('0x16')](util[_0x42e1('0x19')]('[%s][index][agentringnoanswer]',_0x34e125[_0x42e1('0x1f')]),_0x27b1de);}});ami['on'](_0x42e1('0x21'),function(_0xd128a1){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')]('[%s][index][agentconnect]',_0xd128a1['uniqueid']),_0xd128a1);agents[_0x42e1('0x21')](_0xd128a1);queues[_0x42e1('0x21')](_0xd128a1);}catch(_0xd49384){utils[_0x42e1('0x16')](util['format']('[%s][index][agentconnect]',_0xd128a1['uniqueid']),_0xd49384);}});ami['on'](_0x42e1('0x22'),function(_0x1e3afe){try{utils[_0x42e1('0x18')](util['format'](_0x42e1('0x23'),_0x1e3afe[_0x42e1('0x1f')]),_0x1e3afe);agents['agentcomplete'](_0x1e3afe);queues[_0x42e1('0x22')](_0x1e3afe);members[_0x42e1('0x22')](_0x1e3afe);}catch(_0x5d387b){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x23'),_0x1e3afe[_0x42e1('0x1f')]),_0x5d387b);}});ami['on'](_0x42e1('0x24'),function(_0x43299f){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x25'),_0x43299f[_0x42e1('0x1f')]),_0x43299f);agents[_0x42e1('0x24')](_0x43299f);queues[_0x42e1('0x24')](_0x43299f);}catch(_0x442acd){utils['error'](util[_0x42e1('0x19')]('[%s][index][queuecallerabandon]',_0x43299f['uniqueid']),_0x442acd);}});ami['on'](_0x42e1('0x26'),function(_0x5b5165){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x27'),_0x5b5165[_0x42e1('0x1f')]),_0x5b5165);queues[_0x42e1('0x26')](_0x5b5165);recordings[_0x42e1('0x26')](_0x5b5165);}catch(_0x83256d){utils['error'](util[_0x42e1('0x19')](_0x42e1('0x27'),_0x5b5165[_0x42e1('0x1f')]),_0x83256d);}});ami['on'](_0x42e1('0x28'),function(_0x3ce0df){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x29'),_0x3ce0df['uniqueid']),_0x3ce0df);queues[_0x42e1('0x28')](_0x3ce0df);}catch(_0x16ec03){utils[_0x42e1('0x16')](util['format'](_0x42e1('0x29'),_0x3ce0df['uniqueid']),_0x16ec03);}});ami['on'](_0x42e1('0x2a'),function(_0x38b678){try{utils['debug'](util[_0x42e1('0x19')]('[%s][index][musiconholdstart]',_0x38b678[_0x42e1('0x1f')]),_0x38b678);queues[_0x42e1('0x2a')](_0x38b678);calls[_0x42e1('0x2a')](_0x38b678);}catch(_0x3b9118){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x2b'),_0x38b678[_0x42e1('0x1f')]),_0x3b9118);}});ami['on'](_0x42e1('0x2c'),function(_0x33a5a4){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x2d'),_0x33a5a4[_0x42e1('0x1f')]),_0x33a5a4);queues[_0x42e1('0x2c')](_0x33a5a4);calls['musiconholdstop'](_0x33a5a4);}catch(_0x5ac0da){utils[_0x42e1('0x16')](util[_0x42e1('0x19')]('[%s][index][musiconholdstop]',_0x33a5a4[_0x42e1('0x1f')]),_0x5ac0da);}});ami['on'](_0x42e1('0x2e'),function(_0x3aaae7){try{utils[_0x42e1('0x18')](util['format'](_0x42e1('0x2f'),_0x3aaae7[_0x42e1('0x1f')]),_0x3aaae7);calls[_0x42e1('0x2e')](_0x3aaae7);recordings[_0x42e1('0x2e')](_0x3aaae7);}catch(_0x44881c){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x2f'),_0x3aaae7[_0x42e1('0x1f')]),_0x44881c);}});ami['on'](_0x42e1('0x30'),function(_0x4fd235){try{utils['debug'](util['format']('[%s][index][hangup]',_0x4fd235['uniqueid']),_0x4fd235);calls[_0x42e1('0x30')](_0x4fd235);recordings[_0x42e1('0x30')](_0x4fd235);dials[_0x42e1('0x30')](_0x4fd235);agents[_0x42e1('0x30')](_0x4fd235);queues[_0x42e1('0x30')](_0x4fd235);}catch(_0x21c422){utils[_0x42e1('0x16')](util['format'](_0x42e1('0x31'),_0x4fd235['uniqueid']),_0x21c422);}});ami['on'](_0x42e1('0x32'),function(_0x28ed98){try{utils[_0x42e1('0x18')](util['format']('[%s][index][cdr]',_0x28ed98[_0x42e1('0x1f')]),_0x28ed98);members[_0x42e1('0x32')](_0x28ed98);}catch(_0x3fac84){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x33'),_0x28ed98[_0x42e1('0x1f')]),_0x3fac84);}});ami['on']('blindtransfer',function(_0x366bc1){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x34'),_0x366bc1['uniqueid']),_0x366bc1);queues[_0x42e1('0x35')](_0x366bc1);agents['blindtransfer'](_0x366bc1);transfers[_0x42e1('0x35')](_0x366bc1);}catch(_0x597e35){utils['error'](util[_0x42e1('0x19')](_0x42e1('0x34'),_0x366bc1['uniqueid']),_0x597e35);}});ami['on'](_0x42e1('0x36'),function(_0x4a4c99){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')](_0x42e1('0x37'),_0x4a4c99[_0x42e1('0x38')]),_0x4a4c99);queues[_0x42e1('0x36')](_0x4a4c99);transfers[_0x42e1('0x36')](_0x4a4c99);agents[_0x42e1('0x36')](_0x4a4c99);calls[_0x42e1('0x36')](_0x4a4c99);}catch(_0x20530c){utils[_0x42e1('0x16')](util[_0x42e1('0x19')]('[%s][index][attendedtransfer]',_0x4a4c99[_0x42e1('0x38')]),_0x20530c);}});ami['on']('varset',function(_0x425f12){try{utils[_0x42e1('0x18')](util[_0x42e1('0x19')]('[%s][index][varset]',_0x425f12[_0x42e1('0x1f')]),_0x425f12);queues[_0x42e1('0x39')](_0x425f12);recordings[_0x42e1('0x39')](_0x425f12);calls['varset'](_0x425f12);dials[_0x42e1('0x39')](_0x425f12);}catch(_0x5927b6){utils['error'](util[_0x42e1('0x19')](_0x42e1('0x3a'),_0x425f12[_0x42e1('0x1f')]),_0x5927b6);}});ami['on'](_0x42e1('0x3b'),function(_0x2f2d89){try{utils['debug'](util['format'](_0x42e1('0x3c'),_0x2f2d89[_0x42e1('0x1f')]),_0x2f2d89);calls[_0x42e1('0x3b')](_0x2f2d89);recordings[_0x42e1('0x3b')](_0x2f2d89);dials[_0x42e1('0x3b')](_0x2f2d89);}catch(_0x369e7c){utils['error'](util[_0x42e1('0x19')](_0x42e1('0x3c'),_0x2f2d89[_0x42e1('0x1f')]),_0x369e7c);}});ami['on'](_0x42e1('0x3d'),function(_0x58a70d){try{utils['debug'](util[_0x42e1('0x19')](_0x42e1('0x3e'),_0x58a70d['uniqueid']),_0x58a70d);calls[_0x42e1('0x3d')](_0x58a70d);recordings[_0x42e1('0x3d')](_0x58a70d);}catch(_0x24addd){utils[_0x42e1('0x16')](util[_0x42e1('0x19')]('[%s][index][newchannel]',_0x58a70d[_0x42e1('0x1f')]),_0x24addd);}});ami['on'](_0x42e1('0x3f'),function(_0x1f45dc){try{utils['debug'](util[_0x42e1('0x19')](_0x42e1('0x40'),_0x1f45dc[_0x42e1('0x1f')]),_0x1f45dc);dials['dialbegin'](_0x1f45dc);}catch(_0x315b2a){utils[_0x42e1('0x16')](util[_0x42e1('0x19')](_0x42e1('0x41'),_0x1f45dc[_0x42e1('0x1f')]),_0x315b2a);}});ami['on'](_0x42e1('0x42'),function(_0xab7d2b){try{utils['debug'](util['format'](_0x42e1('0x43'),_0xab7d2b['uniqueid']),_0xab7d2b);dials['dialend'](_0xab7d2b);}catch(_0x15cfaf){utils[_0x42e1('0x16')](util[_0x42e1('0x19')]('[%s][index][dialend]',_0xab7d2b['uniqueid']),_0x15cfaf);}});} \ No newline at end of file +var _0x9e6e=['[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./members.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x9e6e,0x154));var _0xe9e6=function(_0x1a0e46,_0x510f37){_0x1a0e46=_0x1a0e46-0x0;var _0x5dee50=_0x9e6e[_0x1a0e46];return _0x5dee50;};var AsteriskManager=require('asterisk-manager');var config=require(_0xe9e6('0x0'));var utils=require(_0xe9e6('0x1'));var util=require(_0xe9e6('0x2'));var ami=new AsteriskManager(config[_0xe9e6('0x3')][_0xe9e6('0x4')],config[_0xe9e6('0x3')]['ip'],config[_0xe9e6('0x3')][_0xe9e6('0x5')],config[_0xe9e6('0x3')][_0xe9e6('0x6')],!![]);ami['keepConnected']();if(config['xdr']&&config[_0xe9e6('0x7')][_0xe9e6('0x8')]){utils[_0xe9e6('0x9')](_0xe9e6('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0xe9e6('0xb'));var queues=require(_0xe9e6('0xc'));var recordings=require('./recordings.controller');var members=require(_0xe9e6('0xd'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xe9e6('0xe'),core[_0xe9e6('0xe')]);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xe9e6('0xf')]);ami['on']('error',core[_0xe9e6('0x10')]);ami['on']('close',core[_0xe9e6('0x11')]);ami['on'](_0xe9e6('0x12'),core[_0xe9e6('0x12')]);ami['on'](_0xe9e6('0x13'),function(_0x1f8b63){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')](_0xe9e6('0x16'),_0x1f8b63[_0xe9e6('0x17')]),_0x1f8b63);members[_0xe9e6('0x13')](_0x1f8b63);}catch(_0x8a1072){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x16'),_0x1f8b63[_0xe9e6('0x17')]),_0x8a1072);}});ami['on'](_0xe9e6('0x18'),function(_0x23bb81){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][agentcalled]',_0x23bb81['uniqueid']),_0x23bb81);agents['agentcalled'](_0x23bb81);}catch(_0x49c7d7){utils['error'](util[_0xe9e6('0x15')](_0xe9e6('0x19'),_0x23bb81[_0xe9e6('0x1a')]),_0x49c7d7);}});ami['on'](_0xe9e6('0x1b'),function(_0x108c52){try{utils[_0xe9e6('0x14')](util['format'](_0xe9e6('0x1c'),_0x108c52[_0xe9e6('0x1a')]),_0x108c52);agents[_0xe9e6('0x1b')](_0x108c52);}catch(_0x4cdc66){utils[_0xe9e6('0x10')](util['format'](_0xe9e6('0x1c'),_0x108c52[_0xe9e6('0x1a')]),_0x4cdc66);}});ami['on'](_0xe9e6('0x1d'),function(_0x4ce3ab){try{utils['debug'](util['format'](_0xe9e6('0x1e'),_0x4ce3ab[_0xe9e6('0x1a')]),_0x4ce3ab);agents[_0xe9e6('0x1d')](_0x4ce3ab);queues[_0xe9e6('0x1d')](_0x4ce3ab);}catch(_0x19a544){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x1e'),_0x4ce3ab[_0xe9e6('0x1a')]),_0x19a544);}});ami['on'](_0xe9e6('0x1f'),function(_0x29916a){try{utils[_0xe9e6('0x14')](util['format'](_0xe9e6('0x20'),_0x29916a[_0xe9e6('0x1a')]),_0x29916a);agents[_0xe9e6('0x1f')](_0x29916a);queues[_0xe9e6('0x1f')](_0x29916a);members['agentcomplete'](_0x29916a);}catch(_0x38b2a1){utils['error'](util[_0xe9e6('0x15')]('[%s][index][agentcomplete]',_0x29916a[_0xe9e6('0x1a')]),_0x38b2a1);}});ami['on']('queuecallerabandon',function(_0xa6f4b){try{utils['debug'](util[_0xe9e6('0x15')](_0xe9e6('0x21'),_0xa6f4b['uniqueid']),_0xa6f4b);agents['queuecallerabandon'](_0xa6f4b);queues[_0xe9e6('0x22')](_0xa6f4b);}catch(_0x58f80c){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x21'),_0xa6f4b['uniqueid']),_0x58f80c);}});ami['on'](_0xe9e6('0x23'),function(_0x4e4ca1){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')](_0xe9e6('0x24'),_0x4e4ca1[_0xe9e6('0x1a')]),_0x4e4ca1);queues['queuecallerjoin'](_0x4e4ca1);recordings['queuecallerjoin'](_0x4e4ca1);}catch(_0x133db1){utils['error'](util[_0xe9e6('0x15')](_0xe9e6('0x24'),_0x4e4ca1[_0xe9e6('0x1a')]),_0x133db1);}});ami['on'](_0xe9e6('0x25'),function(_0x499da1){try{utils[_0xe9e6('0x14')](util['format']('[%s][index][queuecallerleave]',_0x499da1[_0xe9e6('0x1a')]),_0x499da1);queues[_0xe9e6('0x25')](_0x499da1);}catch(_0x173613){utils[_0xe9e6('0x10')](util['format'](_0xe9e6('0x26'),_0x499da1['uniqueid']),_0x173613);}});ami['on'](_0xe9e6('0x27'),function(_0x24be4a){try{utils['debug'](util['format'](_0xe9e6('0x28'),_0x24be4a['uniqueid']),_0x24be4a);queues['musiconholdstart'](_0x24be4a);calls[_0xe9e6('0x27')](_0x24be4a);}catch(_0x26dd76){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x28'),_0x24be4a[_0xe9e6('0x1a')]),_0x26dd76);}});ami['on'](_0xe9e6('0x29'),function(_0x344455){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')](_0xe9e6('0x2a'),_0x344455[_0xe9e6('0x1a')]),_0x344455);queues['musiconholdstop'](_0x344455);calls[_0xe9e6('0x29')](_0x344455);}catch(_0x2c8e03){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x2a'),_0x344455[_0xe9e6('0x1a')]),_0x2c8e03);}});ami['on']('newstate',function(_0x41d67e){try{utils[_0xe9e6('0x14')](util['format']('[%s][index][newstate]',_0x41d67e[_0xe9e6('0x1a')]),_0x41d67e);calls[_0xe9e6('0x2b')](_0x41d67e);recordings[_0xe9e6('0x2b')](_0x41d67e);}catch(_0x547014){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x2c'),_0x41d67e[_0xe9e6('0x1a')]),_0x547014);}});ami['on'](_0xe9e6('0x2d'),function(_0xad5268){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')](_0xe9e6('0x2e'),_0xad5268[_0xe9e6('0x1a')]),_0xad5268);calls[_0xe9e6('0x2d')](_0xad5268);recordings[_0xe9e6('0x2d')](_0xad5268);dials[_0xe9e6('0x2d')](_0xad5268);agents[_0xe9e6('0x2d')](_0xad5268);queues[_0xe9e6('0x2d')](_0xad5268);}catch(_0x5acbbc){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')]('[%s][index][hangup]',_0xad5268[_0xe9e6('0x1a')]),_0x5acbbc);}});ami['on'](_0xe9e6('0x2f'),function(_0x5bd9b3){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][cdr]',_0x5bd9b3['uniqueid']),_0x5bd9b3);members['cdr'](_0x5bd9b3);}catch(_0x4701ad){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x30'),_0x5bd9b3[_0xe9e6('0x1a')]),_0x4701ad);}});ami['on']('blindtransfer',function(_0x214d54){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][blindtransfer]',_0x214d54[_0xe9e6('0x1a')]),_0x214d54);queues['blindtransfer'](_0x214d54);agents[_0xe9e6('0x31')](_0x214d54);transfers['blindtransfer'](_0x214d54);}catch(_0x4fbb90){utils[_0xe9e6('0x10')](util['format'](_0xe9e6('0x32'),_0x214d54[_0xe9e6('0x1a')]),_0x4fbb90);}});ami['on'](_0xe9e6('0x33'),function(_0x1e558b){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][attendedtransfer]',_0x1e558b['origtransfereruniqueid']),_0x1e558b);queues[_0xe9e6('0x33')](_0x1e558b);transfers['attendedtransfer'](_0x1e558b);agents[_0xe9e6('0x33')](_0x1e558b);calls[_0xe9e6('0x33')](_0x1e558b);}catch(_0x5a08c9){utils[_0xe9e6('0x10')](util['format']('[%s][index][attendedtransfer]',_0x1e558b[_0xe9e6('0x34')]),_0x5a08c9);}});ami['on']('varset',function(_0xa56c5a){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][varset]',_0xa56c5a[_0xe9e6('0x1a')]),_0xa56c5a);queues['varset'](_0xa56c5a);recordings[_0xe9e6('0x35')](_0xa56c5a);calls[_0xe9e6('0x35')](_0xa56c5a);dials[_0xe9e6('0x35')](_0xa56c5a);}catch(_0x35581f){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x36'),_0xa56c5a['uniqueid']),_0x35581f);}});ami['on'](_0xe9e6('0x37'),function(_0x30a643){try{utils[_0xe9e6('0x14')](util[_0xe9e6('0x15')]('[%s][index][newexten]',_0x30a643[_0xe9e6('0x1a')]),_0x30a643);calls[_0xe9e6('0x37')](_0x30a643);recordings[_0xe9e6('0x37')](_0x30a643);dials['newexten'](_0x30a643);}catch(_0x40ae40){utils[_0xe9e6('0x10')](util['format'](_0xe9e6('0x38'),_0x30a643[_0xe9e6('0x1a')]),_0x40ae40);}});ami['on'](_0xe9e6('0x39'),function(_0x404758){try{utils[_0xe9e6('0x14')](util['format'](_0xe9e6('0x3a'),_0x404758[_0xe9e6('0x1a')]),_0x404758);calls[_0xe9e6('0x39')](_0x404758);recordings['newchannel'](_0x404758);}catch(_0x232f1a){utils[_0xe9e6('0x10')](util['format'](_0xe9e6('0x3a'),_0x404758['uniqueid']),_0x232f1a);}});ami['on'](_0xe9e6('0x3b'),function(_0x44d94e){try{utils['debug'](util[_0xe9e6('0x15')](_0xe9e6('0x3c'),_0x44d94e[_0xe9e6('0x1a')]),_0x44d94e);dials['dialbegin'](_0x44d94e);}catch(_0x2ca42d){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')]('[%s]dialbegin',_0x44d94e['uniqueid']),_0x2ca42d);}});ami['on']('dialend',function(_0x1bba0e){try{utils['debug'](util[_0xe9e6('0x15')](_0xe9e6('0x3d'),_0x1bba0e[_0xe9e6('0x1a')]),_0x1bba0e);dials['dialend'](_0x1bba0e);}catch(_0x48ca4a){utils[_0xe9e6('0x10')](util[_0xe9e6('0x15')](_0xe9e6('0x3d'),_0x1bba0e[_0xe9e6('0x1a')]),_0x48ca4a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b2a332f..c747b68 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 _0x81d5=['CreateMemberReport','getUserByName','split','membername','name','catch','error','startsWith','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','duration','exitAt','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','data1','source','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','interface','channel','data2','type','getUserByInterface','then','internal','request'];(function(_0x33e851,_0x2262ba){var _0x41821a=function(_0xa050fc){while(--_0xa050fc){_0x33e851['push'](_0x33e851['shift']());}};_0x41821a(++_0x2262ba);}(_0x81d5,0x1ab));var _0x581d=function(_0x1e89b2,_0xa82745){_0x1e89b2=_0x1e89b2-0x0;var _0x3f1871=_0x81d5[_0x1e89b2];return _0x3f1871;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var utils=require('./utils');var members={};var exclude=[_0x581d('0x2'),_0x581d('0x3')];function writeDB(_0x2fe463){utils[_0x581d('0x4')](util[_0x581d('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2fe463['uniqueid'],_0x2fe463[_0x581d('0x6')],_0x2fe463[_0x581d('0x7')],_0x2fe463[_0x581d('0x8')],_0x2fe463['membername'],_0x2fe463[_0x581d('0x9')]));if(_0x2fe463[_0x581d('0x6')]){utils[_0x581d('0xa')](_0x2fe463['interface'])[_0x581d('0xb')](function(_0x5efb9b){if(_0x5efb9b){_0x2fe463['membername']=_0x5efb9b['name'];_0x2fe463[_0x581d('0xc')]=_0x5efb9b[_0x581d('0xc')];utils[_0x581d('0xd')](_0x581d('0xe'),_0x2fe463);}else{utils[_0x581d('0xf')](_0x2fe463['interface'][_0x581d('0x10')]('/')[0x1])[_0x581d('0xb')](function(_0x2b798d){if(_0x2b798d){_0x2fe463[_0x581d('0x11')]=_0x2b798d[_0x581d('0x12')];_0x2fe463[_0x581d('0xc')]=_0x2b798d[_0x581d('0xc')];utils[_0x581d('0xd')](_0x581d('0xe'),_0x2fe463);}});}})[_0x581d('0x13')](function(_0x4be1ab){utils[_0x581d('0x14')](util[_0x581d('0x5')]('[%s][members][writeDB]',_0x2fe463['uniqueid']),_0x4be1ab);});}delete members[_0x2fe463['interface']];}function startsWith(_0x4deffa,_0x110e13){return _['some'](_0x4deffa,function(_0x1d609f){return _[_0x581d('0x15')](_0x110e13,_0x1d609f);});}exports['devicestatechange']=function(_0x1890d0){try{utils['debug'](util[_0x581d('0x5')](_0x581d('0x16'),members[_0x1890d0[_0x581d('0x17')]]?members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x18')]:_0x1890d0[_0x581d('0x17')]),_0x1890d0);utils[_0x581d('0x4')](util['format'](_0x581d('0x19'),members[_0x1890d0[_0x581d('0x17')]]?members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x18')]:_0x1890d0[_0x581d('0x17')],_0x1890d0[_0x581d('0x1a')],_0x1890d0[_0x581d('0x17')]));switch(_0x1890d0[_0x581d('0x1a')]){case _0x581d('0x1b'):case _0x581d('0x1c'):if(!startsWith(exclude,_0x1890d0[_0x581d('0x17')])){members[_0x1890d0[_0x581d('0x17')]]={'channel':'voice','interface':_0x1890d0[_0x581d('0x17')],'type':_0x581d('0x1d'),'enterAt':utils[_0x581d('0x1e')](),'role':_0x581d('0x1f')};}break;case _0x581d('0x20'):if(!_['isNil'](members[_0x1890d0[_0x581d('0x17')]])){members[_0x1890d0[_0x581d('0x17')]]['exitAt']=utils[_0x581d('0x1e')]();members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x21')]=utils['diffTime'](members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x22')],members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x23')]);if(members[_0x1890d0[_0x581d('0x17')]][_0x581d('0x18')]){writeDB(members[_0x1890d0['device']]);}}break;default:break;}}catch(_0x12bcc1){utils[_0x581d('0x14')](util[_0x581d('0x5')]('[%s][members][devicestatechange]',members[_0x1890d0['device']]?members[_0x1890d0['device']]['uniqueid']:_0x1890d0[_0x581d('0x17')]),_0x12bcc1);}};exports[_0x581d('0x24')]=function(_0x337361){try{if(!_[_0x581d('0x25')](members[_0x337361[_0x581d('0x6')]])){utils[_0x581d('0x26')](util[_0x581d('0x5')](_0x581d('0x27'),_0x337361[_0x581d('0x18')]),_0x337361);utils[_0x581d('0x4')](util[_0x581d('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x337361[_0x581d('0x18')],_0x337361['interface'],_0x337361[_0x581d('0x28')]));members[_0x337361[_0x581d('0x6')]]=_[_0x581d('0x29')](members[_0x337361[_0x581d('0x6')]],{'data4':_0x337361[_0x581d('0x28')],'uniqueid':_0x337361[_0x581d('0x18')]});}}catch(_0x4ec02f){utils[_0x581d('0x14')](util[_0x581d('0x5')]('[%s][members][agentcomplete]',_0x337361['uniqueid']),_0x4ec02f);}};exports['cdr']=function(_0x160eb8){try{utils[_0x581d('0x26')](util[_0x581d('0x5')](_0x581d('0x2a'),_0x160eb8[_0x581d('0x18')]),_0x160eb8);if(_0x160eb8[_0x581d('0x7')]){var _0x2e3b3a=_0x160eb8['channel'][_0x581d('0x10')]('-')[0x0];if(!_[_0x581d('0x25')](members[_0x2e3b3a])){members[_0x2e3b3a]=_['assign'](members[_0x2e3b3a],{'data1':members[_0x2e3b3a][_0x581d('0x2b')]||_0x160eb8[_0x581d('0x9')],'data2':members[_0x2e3b3a][_0x581d('0x8')]||_0x160eb8[_0x581d('0x2c')],'data3':members[_0x2e3b3a][_0x581d('0x2d')]||_0x160eb8['destination'],'uniqueid':members[_0x2e3b3a][_0x581d('0x18')]||_0x160eb8['uniqueid']});utils[_0x581d('0x4')](util[_0x581d('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x160eb8['uniqueid'],members[_0x2e3b3a]['data1'],members[_0x2e3b3a]['data2'],members[_0x2e3b3a][_0x581d('0x2d')]));if(members[_0x2e3b3a]['exitAt']){writeDB(members[_0x2e3b3a]);}}}if(_0x160eb8[_0x581d('0x2e')]){var _0x5d029a=_0x160eb8[_0x581d('0x2e')][_0x581d('0x10')]('-')[0x0];if(!_[_0x581d('0x25')](members[_0x5d029a])){members[_0x5d029a]=_[_0x581d('0x29')](members[_0x5d029a],{'data1':members[_0x5d029a][_0x581d('0x2b')]||_0x160eb8[_0x581d('0x9')],'data2':members[_0x5d029a][_0x581d('0x8')]||_0x160eb8[_0x581d('0x2c')],'data3':members[_0x5d029a][_0x581d('0x2d')]||_0x160eb8[_0x581d('0x2f')],'uniqueid':members[_0x5d029a]['uniqueid']||_0x160eb8['uniqueid']});utils[_0x581d('0x4')](util[_0x581d('0x5')](_0x581d('0x30'),_0x160eb8['uniqueid'],members[_0x5d029a][_0x581d('0x2b')],members[_0x5d029a][_0x581d('0x8')],members[_0x5d029a][_0x581d('0x2d')]));if(members[_0x5d029a]['exitAt']){writeDB(members[_0x5d029a]);}}}}catch(_0x646ae7){utils[_0x581d('0x14')](util['format'](_0x581d('0x2a'),_0x160eb8[_0x581d('0x18')]),_0x646ae7);}}; \ No newline at end of file +var _0xec25=['membername','type','interface','then','internal','request','CreateMemberReport','getUserByName','split','name','[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','state','BUSY','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xec25,0x1b9));var _0x5ec2=function(_0x47072e,_0x5511a1){_0x47072e=_0x47072e-0x0;var _0x3af79c=_0xec25[_0x47072e];return _0x3af79c;};'use strict';var _=require('lodash');var util=require(_0x5ec2('0x0'));var utils=require('./utils');var members={};var exclude=[_0x5ec2('0x1'),_0x5ec2('0x2')];function writeDB(_0x56f8a4){utils[_0x5ec2('0x3')](util[_0x5ec2('0x4')](_0x5ec2('0x5'),_0x56f8a4[_0x5ec2('0x6')],_0x56f8a4['interface'],_0x56f8a4[_0x5ec2('0x7')],_0x56f8a4[_0x5ec2('0x8')],_0x56f8a4[_0x5ec2('0x9')],_0x56f8a4[_0x5ec2('0xa')]));if(_0x56f8a4[_0x5ec2('0xb')]){utils['getUserByInterface'](_0x56f8a4['interface'])[_0x5ec2('0xc')](function(_0x37bb06){if(_0x37bb06){_0x56f8a4['membername']=_0x37bb06['name'];_0x56f8a4['internal']=_0x37bb06[_0x5ec2('0xd')];utils[_0x5ec2('0xe')](_0x5ec2('0xf'),_0x56f8a4);}else{utils[_0x5ec2('0x10')](_0x56f8a4['interface'][_0x5ec2('0x11')]('/')[0x1])[_0x5ec2('0xc')](function(_0x1c4e4d){if(_0x1c4e4d){_0x56f8a4[_0x5ec2('0x9')]=_0x1c4e4d[_0x5ec2('0x12')];_0x56f8a4[_0x5ec2('0xd')]=_0x1c4e4d[_0x5ec2('0xd')];utils[_0x5ec2('0xe')]('CreateMemberReport',_0x56f8a4);}});}})['catch'](function(_0x66e89){utils['error'](util[_0x5ec2('0x4')](_0x5ec2('0x13'),_0x56f8a4[_0x5ec2('0x6')]),_0x66e89);});}delete members[_0x56f8a4['interface']];}function startsWith(_0x3ebb80,_0x2e98c3){return _['some'](_0x3ebb80,function(_0x34833a){return _[_0x5ec2('0x14')](_0x2e98c3,_0x34833a);});}exports[_0x5ec2('0x15')]=function(_0x24c496){try{utils['debug'](util[_0x5ec2('0x4')](_0x5ec2('0x16'),members[_0x24c496[_0x5ec2('0x17')]]?members[_0x24c496[_0x5ec2('0x17')]][_0x5ec2('0x6')]:_0x24c496[_0x5ec2('0x17')]),_0x24c496);utils[_0x5ec2('0x3')](util[_0x5ec2('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x24c496['device']]?members[_0x24c496['device']][_0x5ec2('0x6')]:_0x24c496[_0x5ec2('0x17')],_0x24c496[_0x5ec2('0x18')],_0x24c496[_0x5ec2('0x17')]));switch(_0x24c496['state']){case'INUSE':case _0x5ec2('0x19'):if(!startsWith(exclude,_0x24c496[_0x5ec2('0x17')])){members[_0x24c496[_0x5ec2('0x17')]]={'channel':'voice','interface':_0x24c496[_0x5ec2('0x17')],'type':_0x5ec2('0x1a'),'enterAt':utils['now'](),'role':_0x5ec2('0x1b')};}break;case _0x5ec2('0x1c'):if(!_[_0x5ec2('0x1d')](members[_0x24c496[_0x5ec2('0x17')]])){members[_0x24c496['device']][_0x5ec2('0x1e')]=utils[_0x5ec2('0x1f')]();members[_0x24c496[_0x5ec2('0x17')]][_0x5ec2('0x20')]=utils[_0x5ec2('0x21')](members[_0x24c496[_0x5ec2('0x17')]]['exitAt'],members[_0x24c496[_0x5ec2('0x17')]][_0x5ec2('0x22')]);if(members[_0x24c496[_0x5ec2('0x17')]][_0x5ec2('0x6')]){writeDB(members[_0x24c496[_0x5ec2('0x17')]]);}}break;default:break;}}catch(_0x5d8de3){utils['error'](util[_0x5ec2('0x4')]('[%s][members][devicestatechange]',members[_0x24c496['device']]?members[_0x24c496['device']]['uniqueid']:_0x24c496[_0x5ec2('0x17')]),_0x5d8de3);}};exports[_0x5ec2('0x23')]=function(_0x1abec6){try{if(!_['isNil'](members[_0x1abec6[_0x5ec2('0xb')]])){utils[_0x5ec2('0x24')](util[_0x5ec2('0x4')](_0x5ec2('0x25'),_0x1abec6[_0x5ec2('0x6')]),_0x1abec6);utils[_0x5ec2('0x3')](util[_0x5ec2('0x4')](_0x5ec2('0x26'),_0x1abec6[_0x5ec2('0x6')],_0x1abec6[_0x5ec2('0xb')],_0x1abec6[_0x5ec2('0x27')]));members[_0x1abec6[_0x5ec2('0xb')]]=_[_0x5ec2('0x28')](members[_0x1abec6[_0x5ec2('0xb')]],{'data4':_0x1abec6[_0x5ec2('0x27')],'uniqueid':_0x1abec6['uniqueid']});}}catch(_0x1c78d9){utils[_0x5ec2('0x29')](util['format'](_0x5ec2('0x25'),_0x1abec6[_0x5ec2('0x6')]),_0x1c78d9);}};exports[_0x5ec2('0x2a')]=function(_0x17030e){try{utils[_0x5ec2('0x24')](util[_0x5ec2('0x4')](_0x5ec2('0x2b'),_0x17030e['uniqueid']),_0x17030e);if(_0x17030e['channel']){var _0x4cc1c4=_0x17030e[_0x5ec2('0x7')][_0x5ec2('0x11')]('-')[0x0];if(!_[_0x5ec2('0x1d')](members[_0x4cc1c4])){members[_0x4cc1c4]=_[_0x5ec2('0x28')](members[_0x4cc1c4],{'data1':members[_0x4cc1c4][_0x5ec2('0x2c')]||_0x17030e[_0x5ec2('0xa')],'data2':members[_0x4cc1c4][_0x5ec2('0x8')]||_0x17030e[_0x5ec2('0x2d')],'data3':members[_0x4cc1c4]['data3']||_0x17030e[_0x5ec2('0x2e')],'uniqueid':members[_0x4cc1c4][_0x5ec2('0x6')]||_0x17030e[_0x5ec2('0x6')]});utils[_0x5ec2('0x3')](util['format'](_0x5ec2('0x2f'),_0x17030e['uniqueid'],members[_0x4cc1c4]['data1'],members[_0x4cc1c4][_0x5ec2('0x8')],members[_0x4cc1c4][_0x5ec2('0x30')]));if(members[_0x4cc1c4][_0x5ec2('0x1e')]){writeDB(members[_0x4cc1c4]);}}}if(_0x17030e['destinationchannel']){var _0x25af46=_0x17030e[_0x5ec2('0x31')][_0x5ec2('0x11')]('-')[0x0];if(!_[_0x5ec2('0x1d')](members[_0x25af46])){members[_0x25af46]=_['assign'](members[_0x25af46],{'data1':members[_0x25af46][_0x5ec2('0x2c')]||_0x17030e[_0x5ec2('0xa')],'data2':members[_0x25af46]['data2']||_0x17030e['source'],'data3':members[_0x25af46][_0x5ec2('0x30')]||_0x17030e[_0x5ec2('0x2e')],'uniqueid':members[_0x25af46][_0x5ec2('0x6')]||_0x17030e[_0x5ec2('0x6')]});utils[_0x5ec2('0x3')](util[_0x5ec2('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x17030e[_0x5ec2('0x6')],members[_0x25af46][_0x5ec2('0x2c')],members[_0x25af46][_0x5ec2('0x8')],members[_0x25af46][_0x5ec2('0x30')]));if(members[_0x25af46]['exitAt']){writeDB(members[_0x25af46]);}}}}catch(_0x4c0e08){utils[_0x5ec2('0x29')](util[_0x5ec2('0x4')]('[%s][members][cdr]',_0x17030e[_0x5ec2('0x6')]),_0x4c0e08);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index fd4e8b6..8c73278 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 _0x2da0=['origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','count','[%s][queues][queuecallerleave]','agentconnect','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0x2da0,0x7a));var _0x02da=function(_0x3d223f,_0x2e46a9){_0x3d223f=_0x3d223f-0x0;var _0x3ff80a=_0x2da0[_0x3d223f];return _0x3ff80a;};'use strict';var _=require('lodash');var util=require(_0x02da('0x0'));var utils=require(_0x02da('0x1'));var queues={};function writeDB(_0x238d3c){utils[_0x02da('0x2')](util['format'](_0x02da('0x3'),_0x238d3c[_0x02da('0x4')],_0x238d3c['channel'],_0x238d3c[_0x02da('0x5')],_0x238d3c[_0x02da('0x6')],_0x238d3c[_0x02da('0x7')],_0x238d3c[_0x02da('0x8')],_0x238d3c[_0x02da('0x9')]));if(_0x238d3c['queue']){utils[_0x02da('0xa')](_0x238d3c[_0x02da('0x5')])[_0x02da('0xb')](function(_0x5365ee){if(_0x5365ee){_0x238d3c[_0x02da('0xc')]=_0x5365ee['type'];}utils[_0x02da('0xd')](_0x02da('0xe'),_0x238d3c);});}else{utils[_0x02da('0xd')]('CreateVoiceQueueReport',_0x238d3c);}if(_0x238d3c['transfereduniqueid']){delete queues[_0x238d3c['transfereduniqueid']];}else{delete queues[_0x238d3c['uniqueid']];}}exports[_0x02da('0xf')]=function(_0x3fab47){try{utils[_0x02da('0x10')](util[_0x02da('0x11')]('[%s][queues][queuecallerjoin]',_0x3fab47[_0x02da('0x4')]),_0x3fab47);utils['info'](util[_0x02da('0x11')](_0x02da('0x12'),_0x3fab47[_0x02da('0x4')],_0x3fab47[_0x02da('0x5')],_0x3fab47[_0x02da('0x13')]));queues[_0x3fab47[_0x02da('0x4')]]=_[_0x02da('0x14')](_0x3fab47,{'originalposition':_0x3fab47['position'],'queuecallerjoinAt':utils[_0x02da('0x15')](),'mohtime':0x0});}catch(_0x4e68a3){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x17'),_0x3fab47['uniqueid']),_0x4e68a3);}};exports['hangup']=function(_0x154701){try{if(!_[_0x02da('0x18')](queues[_0x154701['uniqueid']])){utils[_0x02da('0x10')](util[_0x02da('0x11')](_0x02da('0x19'),_0x154701[_0x02da('0x4')]),_0x154701);if(queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1a')]){if(!queues[_0x154701[_0x02da('0x4')]]['queuecallerabandon']&&!queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1b')]){queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1c')]=!![];queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1d')]=utils[_0x02da('0x15')]();queues[_0x154701[_0x02da('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x154701[_0x02da('0x4')],queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1e')],queues[_0x154701['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x154701['uniqueid']]);}else if(queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1f')]){utils['info'](util[_0x02da('0x11')](_0x02da('0x20'),_0x154701[_0x02da('0x4')],queues[_0x154701[_0x02da('0x4')]]['name'],queues[_0x154701[_0x02da('0x4')]]['transfereduniqueid']));queues[queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1f')]]=queues[_0x154701[_0x02da('0x4')]];queues[queues[_0x154701[_0x02da('0x4')]][_0x02da('0x1f')]][_0x02da('0x21')]=0x2;delete queues[_0x154701[_0x02da('0x4')]];}}}catch(_0x380dc0){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x19'),_0x154701['uniqueid']),_0x380dc0);}};exports[_0x02da('0x22')]=function(_0x2de715){try{utils[_0x02da('0x10')](util[_0x02da('0x11')](_0x02da('0x23'),_0x2de715[_0x02da('0x4')]),_0x2de715);if(!_[_0x02da('0x18')](_0x2de715[_0x02da('0x24')][_0x02da('0x25')])&&_0x2de715['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x02da('0x18')](queues[_0x2de715[_0x02da('0x4')]])){queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x26')]=![];queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x27')]=null;queues[_0x2de715[_0x02da('0x4')]]['queuecallerexit']=!![];queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x28')]=utils[_0x02da('0x15')]();queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x9')]=_0x2de715[_0x02da('0x29')]['toUpperCase']();utils['info'](util[_0x02da('0x11')](_0x02da('0x2a'),_0x2de715['uniqueid'],queues[_0x2de715[_0x02da('0x4')]]['name'],_0x2de715[_0x02da('0x29')],queues[_0x2de715['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2de715[_0x02da('0x4')]]);}}else if(!_[_0x02da('0x18')](_0x2de715['variable']['queueposition'])){if(!_['isNil'](queues[_0x2de715[_0x02da('0x4')]])&&!queues[_0x2de715[_0x02da('0x4')]]['queuecallerabandon']){queues[_0x2de715[_0x02da('0x4')]]['queuecallerabandon']=![];queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x27')]=null;queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x1b')]=!![];queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x28')]=utils[_0x02da('0x15')]();queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x9')]=_0x02da('0x2b');utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2de715['uniqueid'],queues[_0x2de715['uniqueid']][_0x02da('0x1e')],_0x2de715[_0x02da('0x29')],queues[_0x2de715[_0x02da('0x4')]][_0x02da('0x9')]));}}}catch(_0x375b5f){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x23'),_0x2de715['uniqueid']),_0x375b5f);}};exports[_0x02da('0x26')]=function(_0x261438){try{if(!_[_0x02da('0x18')](queues[_0x261438['uniqueid']])){utils['debug'](util[_0x02da('0x11')](_0x02da('0x2c'),_0x261438['uniqueid']),_0x261438);queues[_0x261438[_0x02da('0x4')]]['queuecallerexit']=![];queues[_0x261438['uniqueid']][_0x02da('0x28')]=null;queues[_0x261438['uniqueid']][_0x02da('0x26')]=!![];queues[_0x261438[_0x02da('0x4')]][_0x02da('0x27')]=utils[_0x02da('0x15')]();queues[_0x261438[_0x02da('0x4')]][_0x02da('0x9')]=_0x02da('0x2d');utils[_0x02da('0x2')](util[_0x02da('0x11')](_0x02da('0x2e'),_0x261438['uniqueid'],queues[_0x261438[_0x02da('0x4')]][_0x02da('0x1e')],queues[_0x261438[_0x02da('0x4')]]['queuecallerexitreason']));}}catch(_0x1ec058){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x2c'),_0x261438[_0x02da('0x4')]),_0x1ec058);}};exports[_0x02da('0x2f')]=function(_0x19b6c9){try{if(!_[_0x02da('0x18')](queues[_0x19b6c9['uniqueid']])){utils[_0x02da('0x10')](util[_0x02da('0x11')]('[%s][queues][queuecallerleave]',_0x19b6c9['uniqueid']),_0x19b6c9);utils[_0x02da('0x2')](util['format'](_0x02da('0x30'),_0x19b6c9[_0x02da('0x4')],queues[_0x19b6c9[_0x02da('0x4')]]['name'],_0x19b6c9[_0x02da('0x31')],_0x19b6c9[_0x02da('0x32')]));queues[_0x19b6c9[_0x02da('0x4')]][_0x02da('0x2f')]=!![];queues[_0x19b6c9[_0x02da('0x4')]][_0x02da('0x1a')]=utils[_0x02da('0x15')]();queues[_0x19b6c9[_0x02da('0x4')]]['holdtime']=utils[_0x02da('0x33')](queues[_0x19b6c9[_0x02da('0x4')]][_0x02da('0x1a')],queues[_0x19b6c9[_0x02da('0x4')]]['queuecallerjoinAt']);queues[_0x19b6c9[_0x02da('0x4')]][_0x02da('0x13')]=_0x19b6c9[_0x02da('0x13')];queues[_0x19b6c9[_0x02da('0x4')]]['count']=_0x19b6c9[_0x02da('0x34')];queues[_0x19b6c9[_0x02da('0x4')]][_0x02da('0x31')]=_0x19b6c9[_0x02da('0x31')];queues[_0x19b6c9['uniqueid']][_0x02da('0x32')]=_0x19b6c9[_0x02da('0x32')];}}catch(_0x4dd63f){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x35'),_0x19b6c9[_0x02da('0x4')]),_0x4dd63f);}};exports[_0x02da('0x36')]=function(_0x4f0544){try{if(!_['isNil'](queues[_0x4f0544[_0x02da('0x4')]])){utils[_0x02da('0x10')](util[_0x02da('0x11')]('[%s][queues][agentconnect]',_0x4f0544[_0x02da('0x4')]),_0x4f0544);utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4f0544['uniqueid'],queues[_0x4f0544[_0x02da('0x4')]][_0x02da('0x1e')],_0x4f0544['membername'],_0x4f0544[_0x02da('0x37')]));queues[_0x4f0544[_0x02da('0x4')]][_0x02da('0x26')]=![];queues[_0x4f0544[_0x02da('0x4')]]['queuecallerabandon']=![];queues[_0x4f0544[_0x02da('0x4')]]['queuecallerabandonAt']=null;queues[_0x4f0544['uniqueid']][_0x02da('0x1b')]=![];queues[_0x4f0544['uniqueid']][_0x02da('0x9')]=null;queues[_0x4f0544[_0x02da('0x4')]][_0x02da('0x28')]=null;queues[_0x4f0544[_0x02da('0x4')]]['assigned']=!![];queues[_0x4f0544[_0x02da('0x4')]][_0x02da('0x8')]=_0x4f0544['destaccountcode'];queues[_0x4f0544[_0x02da('0x4')]][_0x02da('0x6')]=_0x4f0544[_0x02da('0x38')];}}catch(_0x22ca7a){utils[_0x02da('0x16')](util[_0x02da('0x11')]('[%s][queues][agentconnect]',_0x4f0544[_0x02da('0x4')]),_0x22ca7a);}};exports[_0x02da('0x39')]=function(_0xbb019){try{if(!_[_0x02da('0x18')](queues[_0xbb019[_0x02da('0x4')]])){if(queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x1a')]){utils['debug'](util[_0x02da('0x11')](_0x02da('0x3a'),_0xbb019[_0x02da('0x4')]),_0xbb019);queues[_0xbb019['uniqueid']][_0x02da('0x26')]=![];queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x26')]=![];queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x27')]=null;queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x1b')]=![];queues[_0xbb019['uniqueid']][_0x02da('0x28')]=null;queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x3b')]=!![];queues[_0xbb019['uniqueid']][_0x02da('0x6')]=_0xbb019[_0x02da('0x38')];queues[_0xbb019['uniqueid']][_0x02da('0x1c')]=!![];queues[_0xbb019[_0x02da('0x4')]]['queuecallercompleteAt']=utils['now']();if(_0xbb019[_0x02da('0x3c')]==_0x02da('0x3d')){if(!queues[_0xbb019['uniqueid']][_0x02da('0x3d')]){queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x9')]=_0x02da('0x3e');}}else{queues[_0xbb019['uniqueid']][_0x02da('0x9')]=_0x02da('0x3f')+_0xbb019[_0x02da('0x3c')][_0x02da('0x40')]();}utils['info'](util[_0x02da('0x11')](_0x02da('0x41'),_0xbb019['uniqueid'],queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x1e')],_0xbb019['membername'],queues[_0xbb019[_0x02da('0x4')]][_0x02da('0x9')]));writeDB(queues[_0xbb019['uniqueid']]);}}}catch(_0x23e1a2){utils[_0x02da('0x16')](util['format'](_0x02da('0x3a'),_0xbb019[_0x02da('0x4')]),_0x23e1a2);}};exports[_0x02da('0x42')]=function(_0x133ffa){try{if(!_[_0x02da('0x18')](queues[_0x133ffa[_0x02da('0x43')]])){utils[_0x02da('0x10')](util[_0x02da('0x11')](_0x02da('0x44'),_0x133ffa[_0x02da('0x4')]),_0x133ffa);queues[_0x133ffa['transfereeuniqueid']][_0x02da('0x3d')]=!![];queues[_0x133ffa[_0x02da('0x43')]][_0x02da('0x45')]=_0x02da('0x46');queues[_0x133ffa[_0x02da('0x43')]][_0x02da('0x47')]=_0x133ffa[_0x02da('0x48')];queues[_0x133ffa[_0x02da('0x43')]][_0x02da('0x49')]=_0x133ffa[_0x02da('0x43')];queues[_0x133ffa[_0x02da('0x43')]][_0x02da('0x9')]='BLINDTRANSFER';utils[_0x02da('0x2')](util[_0x02da('0x11')](_0x02da('0x4a'),_0x133ffa[_0x02da('0x4')],queues[_0x133ffa[_0x02da('0x43')]][_0x02da('0x1e')],_0x133ffa['transfereeuniqueid'],_0x133ffa[_0x02da('0x48')]));}}catch(_0x9f8e7d){utils[_0x02da('0x16')](util[_0x02da('0x11')]('[%s][queues][blindtransfer]',_0x133ffa[_0x02da('0x4')]),_0x9f8e7d);}};exports[_0x02da('0x4b')]=function(_0x583501){try{utils['debug'](util['format'](_0x02da('0x4c'),_0x583501[_0x02da('0x4d')]),_0x583501);if(_0x583501['origtransfereruniqueid']==_0x583501[_0x02da('0x4e')]){if(!_[_0x02da('0x18')](queues[_0x583501['secondtransfererlinkedid']])){utils['info'](util['format'](_0x02da('0x4f'),_0x583501['origtransfereruniqueid'],queues[_0x583501[_0x02da('0x50')]][_0x02da('0x1e')],_0x583501[_0x02da('0x51')]));queues[_0x583501[_0x02da('0x50')]]['transfer']=!![];queues[_0x583501[_0x02da('0x50')]]['transfertype']=_0x02da('0x52');queues[_0x583501[_0x02da('0x50')]]['transferexten']=_0x583501['origtransfererexten'];queues[_0x583501[_0x02da('0x50')]][_0x02da('0x49')]=_0x583501['origtransfereruniqueid'];queues[_0x583501[_0x02da('0x50')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x02da('0x18')](queues[_0x583501['origtransfererlinkedid']])){if(_0x583501[_0x02da('0x53')]&&queues[_0x583501[_0x02da('0x53')]]){queues[_0x583501['transfereelinkedid']][_0x02da('0x21')]=0x1;queues[_0x583501[_0x02da('0x43')]]=_['clone'](queues[_0x583501[_0x02da('0x53')]]);queues[_0x583501[_0x02da('0x43')]][_0x02da('0x1f')]=_0x583501[_0x02da('0x54')];queues[_0x583501['transfereeuniqueid']][_0x02da('0x21')]=0x2;queues[_0x583501['transfereeuniqueid']][_0x02da('0x7')]=queues[_0x583501[_0x02da('0x50')]][_0x02da('0x7')];queues[_0x583501['transfereeuniqueid']][_0x02da('0x55')]=queues[_0x583501[_0x02da('0x50')]][_0x02da('0x55')];queues[_0x583501['transfereeuniqueid']][_0x02da('0x56')]=utils['now']();queues[_0x583501[_0x02da('0x43')]]['queuecallerleaveAt']=utils[_0x02da('0x15')]();queues[_0x583501['transfereeuniqueid']][_0x02da('0x57')]=0x0;queues[_0x583501['transfereeuniqueid']][_0x02da('0x58')]=0x0;utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x583501[_0x02da('0x4d')],queues[_0x583501[_0x02da('0x43')]][_0x02da('0x1e')],queues[_0x583501['transfereeuniqueid']][_0x02da('0x7')],queues[_0x583501['transfereeuniqueid']]['calleridname']));}else{utils[_0x02da('0x2')](util['format'](_0x02da('0x59'),_0x583501[_0x02da('0x4d')],queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x1e')],_0x583501['secondtransfererlinkedid']));queues[_0x583501[_0x02da('0x4e')]]['transfereduniqueid']=_0x583501[_0x02da('0x50')];}}}else if(_0x583501[_0x02da('0x5a')]==_0x583501[_0x02da('0x50')]){if(!_['isNil'](queues[_0x583501[_0x02da('0x4e')]])){utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x583501[_0x02da('0x4d')],queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x1e')],_0x583501[_0x02da('0x5a')],_0x583501['secondtransfererexten']));queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x3d')]=!![];queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x45')]='ATTENDED';queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x47')]=_0x583501[_0x02da('0x5b')];queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x49')]=_0x583501['secondtransfereruniqueid'];queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x9')]=_0x02da('0x5c');}if(!_[_0x02da('0x18')](queues[_0x583501['secondtransfererlinkedid']])){if(_0x583501[_0x02da('0x5d')]&&queues[_0x583501['transfertargetlinkedid']]){queues[_0x583501[_0x02da('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x583501['transfertargetuniqueid']]=_[_0x02da('0x5e')](queues[_0x583501[_0x02da('0x5d')]]);queues[_0x583501[_0x02da('0x54')]][_0x02da('0x1f')]=_0x583501['transfertargetuniqueid'];queues[_0x583501[_0x02da('0x54')]][_0x02da('0x21')]=0x2;queues[_0x583501[_0x02da('0x54')]][_0x02da('0x7')]=queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x7')];queues[_0x583501['transfertargetuniqueid']][_0x02da('0x55')]=queues[_0x583501[_0x02da('0x4e')]][_0x02da('0x55')];queues[_0x583501[_0x02da('0x54')]][_0x02da('0x56')]=utils['now']();queues[_0x583501[_0x02da('0x54')]][_0x02da('0x1a')]=utils[_0x02da('0x15')]();queues[_0x583501[_0x02da('0x54')]]['holdtime']=0x0;queues[_0x583501[_0x02da('0x54')]][_0x02da('0x58')]=0x0;utils[_0x02da('0x2')](util[_0x02da('0x11')](_0x02da('0x5f'),_0x583501[_0x02da('0x4d')],queues[_0x583501[_0x02da('0x54')]][_0x02da('0x1e')],queues[_0x583501[_0x02da('0x54')]][_0x02da('0x1f')],queues[_0x583501[_0x02da('0x54')]][_0x02da('0x7')],queues[_0x583501[_0x02da('0x54')]]['calleridname']));}else{utils['info'](util[_0x02da('0x11')](_0x02da('0x59'),_0x583501[_0x02da('0x4d')],queues[_0x583501[_0x02da('0x50')]][_0x02da('0x1e')],_0x583501[_0x02da('0x4e')]));queues[_0x583501[_0x02da('0x50')]][_0x02da('0x1f')]=_0x583501[_0x02da('0x4e')];}}}}catch(_0x4a1a78){utils[_0x02da('0x16')](util[_0x02da('0x11')](_0x02da('0x4c'),_0x583501[_0x02da('0x4d')]),_0x4a1a78);}};exports[_0x02da('0x60')]=function(_0x3e19df){try{if(!_[_0x02da('0x18')](queues[_0x3e19df['uniqueid']])){utils[_0x02da('0x10')](util['format'](_0x02da('0x61'),_0x3e19df[_0x02da('0x4')]),_0x3e19df);queues[_0x3e19df[_0x02da('0x4')]][_0x02da('0x62')]=utils[_0x02da('0x15')]();utils[_0x02da('0x2')](util[_0x02da('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3e19df[_0x02da('0x4')],queues[_0x3e19df[_0x02da('0x4')]][_0x02da('0x1e')],queues[_0x3e19df[_0x02da('0x4')]][_0x02da('0x62')]));}}catch(_0x36e991){utils['error'](util[_0x02da('0x11')](_0x02da('0x61'),_0x3e19df[_0x02da('0x4')]),_0x36e991);}};exports['musiconholdstop']=function(_0x2f7fa2){try{if(!_['isNil'](queues[_0x2f7fa2[_0x02da('0x4')]])){if(!_[_0x02da('0x18')](queues[_0x2f7fa2[_0x02da('0x4')]][_0x02da('0x62')])){utils[_0x02da('0x10')](util[_0x02da('0x11')](_0x02da('0x63'),_0x2f7fa2[_0x02da('0x4')]),_0x2f7fa2);queues[_0x2f7fa2[_0x02da('0x4')]][_0x02da('0x58')]+=utils['diffTime'](utils[_0x02da('0x15')](),queues[_0x2f7fa2[_0x02da('0x4')]][_0x02da('0x62')]);utils[_0x02da('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2f7fa2['uniqueid'],queues[_0x2f7fa2['uniqueid']][_0x02da('0x1e')],queues[_0x2f7fa2[_0x02da('0x4')]][_0x02da('0x58')]));delete queues[_0x2f7fa2[_0x02da('0x4')]][_0x02da('0x62')];}}}catch(_0xa7ed6c){utils[_0x02da('0x16')](util[_0x02da('0x11')]('[%s][queues][musiconholdstop]',_0x2f7fa2[_0x02da('0x4')]),_0xa7ed6c);}}; \ No newline at end of file +var _0x5175=['clone','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid'];(function(_0x3c9fcf,_0x4f639f){var _0x26d6a5=function(_0x352d4c){while(--_0x352d4c){_0x3c9fcf['push'](_0x3c9fcf['shift']());}};_0x26d6a5(++_0x4f639f);}(_0x5175,0x71));var _0x5517=function(_0x3daee4,_0x1c7693){_0x3daee4=_0x3daee4-0x0;var _0x3a4fa7=_0x5175[_0x3daee4];return _0x3a4fa7;};'use strict';var _=require(_0x5517('0x0'));var util=require(_0x5517('0x1'));var utils=require(_0x5517('0x2'));var queues={};function writeDB(_0x1431af){utils[_0x5517('0x3')](util[_0x5517('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1431af[_0x5517('0x5')],_0x1431af['channel'],_0x1431af[_0x5517('0x6')],_0x1431af[_0x5517('0x7')],_0x1431af[_0x5517('0x8')],_0x1431af[_0x5517('0x9')],_0x1431af[_0x5517('0xa')]));if(_0x1431af[_0x5517('0x6')]){utils['getVoiceQueueByName'](_0x1431af[_0x5517('0x6')])[_0x5517('0xb')](function(_0x3b2b58){if(_0x3b2b58){_0x1431af['type']=_0x3b2b58[_0x5517('0xc')];}utils['request'](_0x5517('0xd'),_0x1431af);});}else{utils[_0x5517('0xe')](_0x5517('0xd'),_0x1431af);}if(_0x1431af[_0x5517('0xf')]){delete queues[_0x1431af[_0x5517('0xf')]];}else{delete queues[_0x1431af[_0x5517('0x5')]];}}exports[_0x5517('0x10')]=function(_0x81df85){try{utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x12'),_0x81df85[_0x5517('0x5')]),_0x81df85);utils[_0x5517('0x3')](util['format'](_0x5517('0x13'),_0x81df85['uniqueid'],_0x81df85['queue'],_0x81df85['position']));queues[_0x81df85['uniqueid']]=_[_0x5517('0x14')](_0x81df85,{'originalposition':_0x81df85[_0x5517('0x15')],'queuecallerjoinAt':utils[_0x5517('0x16')](),'mohtime':0x0});}catch(_0x5820fc){utils[_0x5517('0x17')](util[_0x5517('0x4')]('[%s][queues][queuecallerjoin]',_0x81df85[_0x5517('0x5')]),_0x5820fc);}};exports[_0x5517('0x18')]=function(_0x3637fc){try{if(!_['isNil'](queues[_0x3637fc[_0x5517('0x5')]])){utils[_0x5517('0x11')](util[_0x5517('0x4')]('[%s][queues][hangup]',_0x3637fc[_0x5517('0x5')]),_0x3637fc);if(queues[_0x3637fc['uniqueid']][_0x5517('0x19')]){if(!queues[_0x3637fc['uniqueid']][_0x5517('0x1a')]&&!queues[_0x3637fc[_0x5517('0x5')]][_0x5517('0x1b')]){queues[_0x3637fc['uniqueid']]['queuecallercomplete']=!![];queues[_0x3637fc[_0x5517('0x5')]][_0x5517('0x1c')]=utils[_0x5517('0x16')]();queues[_0x3637fc[_0x5517('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x5517('0x3')](util['format'](_0x5517('0x1d'),_0x3637fc[_0x5517('0x5')],queues[_0x3637fc['uniqueid']][_0x5517('0x1e')],queues[_0x3637fc['uniqueid']][_0x5517('0xa')]));writeDB(queues[_0x3637fc['uniqueid']]);}else if(queues[_0x3637fc[_0x5517('0x5')]]['transfereduniqueid']){utils[_0x5517('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3637fc['uniqueid'],queues[_0x3637fc[_0x5517('0x5')]]['name'],queues[_0x3637fc[_0x5517('0x5')]]['transfereduniqueid']));queues[queues[_0x3637fc['uniqueid']][_0x5517('0xf')]]=queues[_0x3637fc[_0x5517('0x5')]];queues[queues[_0x3637fc['uniqueid']][_0x5517('0xf')]][_0x5517('0x1f')]=0x2;delete queues[_0x3637fc[_0x5517('0x5')]];}}}catch(_0x5b01c3){utils[_0x5517('0x17')](util[_0x5517('0x4')]('[%s][queues][hangup]',_0x3637fc['uniqueid']),_0x5b01c3);}};exports['varset']=function(_0x3e46d6){try{utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x20'),_0x3e46d6[_0x5517('0x5')]),_0x3e46d6);if(!_['isNil'](_0x3e46d6[_0x5517('0x21')][_0x5517('0x22')])&&_0x3e46d6['value'][_0x5517('0x23')]()!==_0x5517('0x24')){if(!_[_0x5517('0x25')](queues[_0x3e46d6['uniqueid']])){queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1a')]=![];queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x26')]=null;queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1b')]=!![];queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x27')]=utils[_0x5517('0x16')]();queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0xa')]=_0x3e46d6[_0x5517('0x28')]['toUpperCase']();utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x29'),_0x3e46d6[_0x5517('0x5')],queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1e')],_0x3e46d6[_0x5517('0x28')],queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0xa')]));writeDB(queues[_0x3e46d6[_0x5517('0x5')]]);}}else if(!_['isNil'](_0x3e46d6[_0x5517('0x21')][_0x5517('0x2a')])){if(!_[_0x5517('0x25')](queues[_0x3e46d6[_0x5517('0x5')]])&&!queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1a')]){queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1a')]=![];queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x26')]=null;queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1b')]=!![];queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x27')]=utils[_0x5517('0x16')]();queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0xa')]='EXITWITHKEY';utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x2b'),_0x3e46d6[_0x5517('0x5')],queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0x1e')],_0x3e46d6[_0x5517('0x28')],queues[_0x3e46d6[_0x5517('0x5')]][_0x5517('0xa')]));}}}catch(_0xa12559){utils['error'](util[_0x5517('0x4')](_0x5517('0x20'),_0x3e46d6[_0x5517('0x5')]),_0xa12559);}};exports[_0x5517('0x1a')]=function(_0x11b0b7){try{if(!_[_0x5517('0x25')](queues[_0x11b0b7[_0x5517('0x5')]])){utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x2c'),_0x11b0b7['uniqueid']),_0x11b0b7);queues[_0x11b0b7[_0x5517('0x5')]][_0x5517('0x1b')]=![];queues[_0x11b0b7[_0x5517('0x5')]][_0x5517('0x27')]=null;queues[_0x11b0b7[_0x5517('0x5')]][_0x5517('0x1a')]=!![];queues[_0x11b0b7[_0x5517('0x5')]][_0x5517('0x26')]=utils[_0x5517('0x16')]();queues[_0x11b0b7['uniqueid']][_0x5517('0xa')]=_0x5517('0x2d');utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x2e'),_0x11b0b7[_0x5517('0x5')],queues[_0x11b0b7[_0x5517('0x5')]][_0x5517('0x1e')],queues[_0x11b0b7['uniqueid']]['queuecallerexitreason']));}}catch(_0x592168){utils[_0x5517('0x17')](util['format'](_0x5517('0x2c'),_0x11b0b7[_0x5517('0x5')]),_0x592168);}};exports[_0x5517('0x2f')]=function(_0x463636){try{if(!_['isNil'](queues[_0x463636['uniqueid']])){utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x30'),_0x463636[_0x5517('0x5')]),_0x463636);utils[_0x5517('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x463636[_0x5517('0x5')],queues[_0x463636['uniqueid']]['name'],_0x463636[_0x5517('0x31')],_0x463636[_0x5517('0x32')]));queues[_0x463636[_0x5517('0x5')]][_0x5517('0x2f')]=!![];queues[_0x463636[_0x5517('0x5')]][_0x5517('0x19')]=utils[_0x5517('0x16')]();queues[_0x463636['uniqueid']][_0x5517('0x33')]=utils['diffTime'](queues[_0x463636[_0x5517('0x5')]][_0x5517('0x19')],queues[_0x463636[_0x5517('0x5')]]['queuecallerjoinAt']);queues[_0x463636[_0x5517('0x5')]][_0x5517('0x15')]=_0x463636[_0x5517('0x15')];queues[_0x463636['uniqueid']][_0x5517('0x34')]=_0x463636[_0x5517('0x34')];queues[_0x463636['uniqueid']][_0x5517('0x31')]=_0x463636[_0x5517('0x31')];queues[_0x463636[_0x5517('0x5')]][_0x5517('0x32')]=_0x463636[_0x5517('0x32')];}}catch(_0x22c346){utils[_0x5517('0x17')](util[_0x5517('0x4')]('[%s][queues][queuecallerleave]',_0x463636[_0x5517('0x5')]),_0x22c346);}};exports[_0x5517('0x35')]=function(_0x19df7b){try{if(!_[_0x5517('0x25')](queues[_0x19df7b[_0x5517('0x5')]])){utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x36'),_0x19df7b[_0x5517('0x5')]),_0x19df7b);utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x37'),_0x19df7b[_0x5517('0x5')],queues[_0x19df7b[_0x5517('0x5')]][_0x5517('0x1e')],_0x19df7b[_0x5517('0x38')],_0x19df7b[_0x5517('0x39')]));queues[_0x19df7b[_0x5517('0x5')]][_0x5517('0x1a')]=![];queues[_0x19df7b[_0x5517('0x5')]][_0x5517('0x1a')]=![];queues[_0x19df7b['uniqueid']]['queuecallerabandonAt']=null;queues[_0x19df7b[_0x5517('0x5')]][_0x5517('0x1b')]=![];queues[_0x19df7b[_0x5517('0x5')]][_0x5517('0xa')]=null;queues[_0x19df7b['uniqueid']]['queuecallerexitAt']=null;queues[_0x19df7b[_0x5517('0x5')]]['assigned']=!![];queues[_0x19df7b['uniqueid']][_0x5517('0x9')]=_0x19df7b[_0x5517('0x39')];queues[_0x19df7b['uniqueid']][_0x5517('0x7')]=_0x19df7b[_0x5517('0x38')];}}catch(_0x36ebf7){utils[_0x5517('0x17')](util[_0x5517('0x4')](_0x5517('0x36'),_0x19df7b[_0x5517('0x5')]),_0x36ebf7);}};exports[_0x5517('0x3a')]=function(_0x5bf4c7){try{if(!_[_0x5517('0x25')](queues[_0x5bf4c7['uniqueid']])){if(queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x19')]){utils[_0x5517('0x11')](util['format'](_0x5517('0x3b'),_0x5bf4c7[_0x5517('0x5')]),_0x5bf4c7);queues[_0x5bf4c7['uniqueid']][_0x5517('0x1a')]=![];queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x1a')]=![];queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x26')]=null;queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x1b')]=![];queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x27')]=null;queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x3c')]=!![];queues[_0x5bf4c7[_0x5517('0x5')]]['lastAssignedTo']=_0x5bf4c7[_0x5517('0x38')];queues[_0x5bf4c7['uniqueid']]['queuecallercomplete']=!![];queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x1c')]=utils[_0x5517('0x16')]();if(_0x5bf4c7[_0x5517('0x3d')]=='transfer'){if(!queues[_0x5bf4c7['uniqueid']][_0x5517('0x3e')]){queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0xa')]='TRANSFER';}}else{queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0xa')]=_0x5517('0x3f')+_0x5bf4c7['reason'][_0x5517('0x23')]();}utils[_0x5517('0x3')](util['format'](_0x5517('0x40'),_0x5bf4c7[_0x5517('0x5')],queues[_0x5bf4c7[_0x5517('0x5')]][_0x5517('0x1e')],_0x5bf4c7[_0x5517('0x38')],queues[_0x5bf4c7[_0x5517('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5bf4c7[_0x5517('0x5')]]);}}}catch(_0x5b8309){utils[_0x5517('0x17')](util[_0x5517('0x4')](_0x5517('0x3b'),_0x5bf4c7[_0x5517('0x5')]),_0x5b8309);}};exports['blindtransfer']=function(_0x7e3c44){try{if(!_[_0x5517('0x25')](queues[_0x7e3c44[_0x5517('0x41')]])){utils['debug'](util['format'](_0x5517('0x42'),_0x7e3c44[_0x5517('0x5')]),_0x7e3c44);queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0x3e')]=!![];queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0x43')]=_0x5517('0x44');queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0x45')]=_0x7e3c44[_0x5517('0x46')];queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0x47')]=_0x7e3c44[_0x5517('0x41')];queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0xa')]=_0x5517('0x48');utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x49'),_0x7e3c44[_0x5517('0x5')],queues[_0x7e3c44[_0x5517('0x41')]][_0x5517('0x1e')],_0x7e3c44[_0x5517('0x41')],_0x7e3c44[_0x5517('0x46')]));}}catch(_0x1d5fde){utils['error'](util['format'](_0x5517('0x42'),_0x7e3c44[_0x5517('0x5')]),_0x1d5fde);}};exports['attendedtransfer']=function(_0x37e6d7){try{utils['debug'](util[_0x5517('0x4')]('[%s][queues][attendedtransfer]',_0x37e6d7[_0x5517('0x4a')]),_0x37e6d7);if(_0x37e6d7['origtransfereruniqueid']==_0x37e6d7[_0x5517('0x4b')]){if(!_[_0x5517('0x25')](queues[_0x37e6d7[_0x5517('0x4c')]])){utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x4d'),_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7[_0x5517('0x4c')]]['name'],_0x37e6d7[_0x5517('0x4e')]));queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0x3e')]=!![];queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0x43')]=_0x5517('0x4f');queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0x45')]=_0x37e6d7['origtransfererexten'];queues[_0x37e6d7['secondtransfererlinkedid']][_0x5517('0x47')]=_0x37e6d7[_0x5517('0x4a')];queues[_0x37e6d7['secondtransfererlinkedid']][_0x5517('0xa')]=_0x5517('0x50');}if(!_[_0x5517('0x25')](queues[_0x37e6d7['origtransfererlinkedid']])){if(_0x37e6d7[_0x5517('0x51')]&&queues[_0x37e6d7[_0x5517('0x51')]]){queues[_0x37e6d7[_0x5517('0x51')]][_0x5517('0x1f')]=0x1;queues[_0x37e6d7['transfereeuniqueid']]=_['clone'](queues[_0x37e6d7['transfereelinkedid']]);queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0xf')]=_0x37e6d7[_0x5517('0x52')];queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0x1f')]=0x2;queues[_0x37e6d7['transfereeuniqueid']][_0x5517('0x8')]=queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0x8')];queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0x53')]=queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0x53')];queues[_0x37e6d7[_0x5517('0x41')]]['queuecallerjoinAt']=utils['now']();queues[_0x37e6d7['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x5517('0x16')]();queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0x33')]=0x0;queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0x54')]=0x0;utils[_0x5517('0x3')](util[_0x5517('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7[_0x5517('0x41')]][_0x5517('0x1e')],queues[_0x37e6d7['transfereeuniqueid']][_0x5517('0x8')],queues[_0x37e6d7[_0x5517('0x41')]]['calleridname']));}else{utils[_0x5517('0x3')](util['format'](_0x5517('0x55'),_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7['origtransfererlinkedid']]['name'],_0x37e6d7[_0x5517('0x4c')]));queues[_0x37e6d7['origtransfererlinkedid']][_0x5517('0xf')]=_0x37e6d7['secondtransfererlinkedid'];}}}else if(_0x37e6d7[_0x5517('0x56')]==_0x37e6d7[_0x5517('0x4c')]){if(!_[_0x5517('0x25')](queues[_0x37e6d7[_0x5517('0x4b')]])){utils[_0x5517('0x3')](util[_0x5517('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7[_0x5517('0x4b')]][_0x5517('0x1e')],_0x37e6d7[_0x5517('0x56')],_0x37e6d7['secondtransfererexten']));queues[_0x37e6d7[_0x5517('0x4b')]]['transfer']=!![];queues[_0x37e6d7[_0x5517('0x4b')]][_0x5517('0x43')]='ATTENDED';queues[_0x37e6d7['origtransfererlinkedid']][_0x5517('0x45')]=_0x37e6d7[_0x5517('0x57')];queues[_0x37e6d7[_0x5517('0x4b')]][_0x5517('0x47')]=_0x37e6d7[_0x5517('0x56')];queues[_0x37e6d7[_0x5517('0x4b')]][_0x5517('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x5517('0x25')](queues[_0x37e6d7[_0x5517('0x4c')]])){if(_0x37e6d7[_0x5517('0x58')]&&queues[_0x37e6d7[_0x5517('0x58')]]){queues[_0x37e6d7[_0x5517('0x58')]]['queuecallerenterreason']=0x1;queues[_0x37e6d7[_0x5517('0x52')]]=_[_0x5517('0x59')](queues[_0x37e6d7[_0x5517('0x58')]]);queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0xf')]=_0x37e6d7[_0x5517('0x52')];queues[_0x37e6d7['transfertargetuniqueid']][_0x5517('0x1f')]=0x2;queues[_0x37e6d7['transfertargetuniqueid']]['calleridnum']=queues[_0x37e6d7[_0x5517('0x4b')]]['calleridnum'];queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0x53')]=queues[_0x37e6d7[_0x5517('0x4b')]][_0x5517('0x53')];queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0x5a')]=utils[_0x5517('0x16')]();queues[_0x37e6d7[_0x5517('0x52')]]['queuecallerleaveAt']=utils[_0x5517('0x16')]();queues[_0x37e6d7['transfertargetuniqueid']][_0x5517('0x33')]=0x0;queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0x54')]=0x0;utils['info'](util['format'](_0x5517('0x5b'),_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7[_0x5517('0x52')]]['name'],queues[_0x37e6d7['transfertargetuniqueid']][_0x5517('0xf')],queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0x8')],queues[_0x37e6d7[_0x5517('0x52')]][_0x5517('0x53')]));}else{utils['info'](util[_0x5517('0x4')](_0x5517('0x55'),_0x37e6d7[_0x5517('0x4a')],queues[_0x37e6d7[_0x5517('0x4c')]]['name'],_0x37e6d7[_0x5517('0x4b')]));queues[_0x37e6d7[_0x5517('0x4c')]][_0x5517('0xf')]=_0x37e6d7[_0x5517('0x4b')];}}}}catch(_0x5a1dca){utils['error'](util[_0x5517('0x4')](_0x5517('0x5c'),_0x37e6d7[_0x5517('0x4a')]),_0x5a1dca);}};exports[_0x5517('0x5d')]=function(_0x313e39){try{if(!_[_0x5517('0x25')](queues[_0x313e39[_0x5517('0x5')]])){utils[_0x5517('0x11')](util[_0x5517('0x4')](_0x5517('0x5e'),_0x313e39[_0x5517('0x5')]),_0x313e39);queues[_0x313e39[_0x5517('0x5')]][_0x5517('0x5f')]=utils[_0x5517('0x16')]();utils[_0x5517('0x3')](util['format'](_0x5517('0x60'),_0x313e39[_0x5517('0x5')],queues[_0x313e39[_0x5517('0x5')]][_0x5517('0x1e')],queues[_0x313e39[_0x5517('0x5')]][_0x5517('0x5f')]));}}catch(_0x393bac){utils['error'](util[_0x5517('0x4')](_0x5517('0x5e'),_0x313e39[_0x5517('0x5')]),_0x393bac);}};exports[_0x5517('0x61')]=function(_0x40f083){try{if(!_['isNil'](queues[_0x40f083[_0x5517('0x5')]])){if(!_['isNil'](queues[_0x40f083['uniqueid']][_0x5517('0x5f')])){utils[_0x5517('0x11')](util['format']('[%s][queues][musiconholdstop]',_0x40f083[_0x5517('0x5')]),_0x40f083);queues[_0x40f083['uniqueid']][_0x5517('0x54')]+=utils[_0x5517('0x62')](utils[_0x5517('0x16')](),queues[_0x40f083['uniqueid']][_0x5517('0x5f')]);utils[_0x5517('0x3')](util[_0x5517('0x4')](_0x5517('0x63'),_0x40f083['uniqueid'],queues[_0x40f083[_0x5517('0x5')]][_0x5517('0x1e')],queues[_0x40f083[_0x5517('0x5')]][_0x5517('0x54')]));delete queues[_0x40f083[_0x5517('0x5')]][_0x5517('0x5f')];}}}catch(_0x429b37){utils[_0x5517('0x17')](util[_0x5517('0x4')](_0x5517('0x64'),_0x40f083[_0x5517('0x5')]),_0x429b37);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 80187ad..1af5a80 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 _0xbed8=['queue','lodash','util','./utils','info','format','uniqueid','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','accountcode','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xbed8,0x1c1));var _0x8bed=function(_0xffa302,_0xfd695c){_0xffa302=_0xffa302-0x0;var _0x38ea4b=_0xbed8[_0xffa302];return _0x38ea4b;};'use strict';var _=require(_0x8bed('0x0'));var util=require(_0x8bed('0x1'));var utils=require(_0x8bed('0x2'));var recordings={};function writeDB(_0x1a11e7){utils[_0x8bed('0x3')](util[_0x8bed('0x4')]('[%s][recordings][writeDB]',_0x1a11e7[_0x8bed('0x5')]));if(_0x1a11e7['accountcode']){utils[_0x8bed('0x6')](_0x1a11e7['accountcode'])[_0x8bed('0x7')](function(_0x270275){if(_0x270275){_0x1a11e7[_0x8bed('0x8')]=_0x270275['name'];_0x1a11e7[_0x8bed('0x9')]=_0x270275['id'];}utils[_0x8bed('0xa')](_0x8bed('0xb'),_0x1a11e7);});}else{utils[_0x8bed('0xa')]('CreateVoiceRecording',_0x1a11e7);}}exports[_0x8bed('0xc')]=function(_0x136784){try{utils[_0x8bed('0xd')](util[_0x8bed('0x4')](_0x8bed('0xe'),_0x136784['uniqueid']),_0x136784);if(_0x136784[_0x8bed('0x5')]==_0x136784[_0x8bed('0xf')]){utils['info'](util[_0x8bed('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x136784[_0x8bed('0x5')],_0x136784[_0x8bed('0x10')],_0x136784[_0x8bed('0x11')]));recordings[_0x136784['uniqueid']]={'uniqueid':_0x136784[_0x8bed('0x5')],'accountcode':_0x136784['accountcode'],'exten':_0x136784[_0x8bed('0x11')],'context':_0x136784['context'],'channel':_0x136784[_0x8bed('0x12')],'monitors':[]};}}catch(_0x288f36){utils[_0x8bed('0x13')](util['format'](_0x8bed('0xe'),_0x136784['uniqueid']),_0x288f36);}};exports[_0x8bed('0x14')]=function(_0x4a37eb){try{utils[_0x8bed('0xd')](util[_0x8bed('0x4')](_0x8bed('0x15'),_0x4a37eb[_0x8bed('0x5')]),_0x4a37eb);if(!_[_0x8bed('0x16')](recordings[_0x4a37eb['uniqueid']])&&_0x4a37eb[_0x8bed('0x17')]==0x6){utils[_0x8bed('0x3')](util[_0x8bed('0x4')](_0x8bed('0x18'),_0x4a37eb[_0x8bed('0x5')],_0x4a37eb[_0x8bed('0x10')],_0x4a37eb[_0x8bed('0x12')]));}else if(!_['isNil'](recordings[_0x4a37eb[_0x8bed('0xf')]])&&_0x4a37eb[_0x8bed('0x17')]==0x6&&_0x4a37eb[_0x8bed('0x10')]!=_0x8bed('0x19')){utils[_0x8bed('0x3')](util[_0x8bed('0x4')](_0x8bed('0x1a'),_0x4a37eb['uniqueid'],_0x4a37eb[_0x8bed('0xf')],_0x4a37eb['context'],_0x4a37eb['channel']));recordings[_0x4a37eb['linkedid']][_0x8bed('0x1b')]=_0x4a37eb['accountcode'];}}catch(_0x588202){utils[_0x8bed('0x13')](util[_0x8bed('0x4')]('[%s][recordings][newstate]',_0x4a37eb[_0x8bed('0x5')]),_0x588202);}};exports[_0x8bed('0x1c')]=function(_0x1fe321){try{if(!_[_0x8bed('0x16')](_0x1fe321[_0x8bed('0x1d')])&&!_[_0x8bed('0x16')](_0x1fe321[_0x8bed('0x1d')]['mixmonitor_filename'])){utils[_0x8bed('0xd')](util[_0x8bed('0x4')](_0x8bed('0x1e'),_0x1fe321[_0x8bed('0x5')]),_0x1fe321);utils['info'](util[_0x8bed('0x4')](_0x8bed('0x1f'),_0x1fe321[_0x8bed('0x5')],_0x1fe321[_0x8bed('0x1d')],_0x1fe321[_0x8bed('0x20')]));if(_[_0x8bed('0x21')](_0x1fe321[_0x8bed('0x20')],_0x8bed('0x22'))){_0x1fe321[_0x8bed('0x20')]=_0x1fe321[_0x8bed('0x20')][_0x8bed('0x23')](_0x8bed('0x22'),_0x8bed('0x24'));}if(recordings[_0x1fe321[_0x8bed('0xf')]]){var _0x4a7aa2=_['find'](recordings[_0x1fe321[_0x8bed('0xf')]][_0x8bed('0x25')],{'value':_0x1fe321['value']});if(_[_0x8bed('0x16')](_0x4a7aa2)){recordings[_0x1fe321['linkedid']]['monitors'][_0x8bed('0x26')]({'value':_0x1fe321[_0x8bed('0x20')]});}}}}catch(_0x5ec817){utils[_0x8bed('0x13')](util['format'](_0x8bed('0x1e'),_0x1fe321[_0x8bed('0x5')]),_0x5ec817);}};exports[_0x8bed('0x27')]=function(_0x49ce13){try{if(!_[_0x8bed('0x16')](recordings[_0x49ce13[_0x8bed('0x5')]])){utils[_0x8bed('0xd')](util[_0x8bed('0x4')]('[%s][recordings][hangup]',_0x49ce13[_0x8bed('0x5')]),_0x49ce13);utils[_0x8bed('0x3')](util['format'](_0x8bed('0x28'),_0x49ce13[_0x8bed('0x5')],_0x49ce13[_0x8bed('0x29')],_0x49ce13['calleridname'],_0x49ce13[_0x8bed('0x2a')]));recordings[_0x49ce13[_0x8bed('0x5')]]['calleridnum']=_0x49ce13[_0x8bed('0x29')];recordings[_0x49ce13[_0x8bed('0x5')]][_0x8bed('0x2b')]=_0x49ce13['calleridname'];recordings[_0x49ce13['uniqueid']][_0x8bed('0x2c')]=_0x49ce13[_0x8bed('0x2c')];recordings[_0x49ce13[_0x8bed('0x5')]][_0x8bed('0x2d')]=_0x49ce13[_0x8bed('0x2d')];if(recordings[_0x49ce13[_0x8bed('0x5')]][_0x8bed('0x2e')]==_0x8bed('0x2f')&&recordings[_0x49ce13['uniqueid']][_0x8bed('0x1b')]){recordings[_0x49ce13[_0x8bed('0x5')]]['connectedlinenum']=recordings[_0x49ce13[_0x8bed('0x5')]]['accountcode'];recordings[_0x49ce13[_0x8bed('0x5')]][_0x8bed('0x2d')]='';}recordings[_0x49ce13[_0x8bed('0x5')]]['monitors'][_0x8bed('0x30')](function(_0x2de781){var _0x4750e9=_['clone'](recordings[_0x49ce13['uniqueid']]);_0x4750e9[_0x8bed('0x20')]=_0x2de781[_0x8bed('0x20')];writeDB(_0x4750e9);});delete recordings[_0x49ce13[_0x8bed('0x5')]];}}catch(_0x462489){utils['error'](util[_0x8bed('0x4')]('[%s][recordings][hangup]',_0x49ce13[_0x8bed('0x5')]),_0x462489);}};exports[_0x8bed('0x31')]=function(_0x4c98f9){try{if(!_[_0x8bed('0x16')](recordings[_0x4c98f9['uniqueid']])){utils[_0x8bed('0xd')](util[_0x8bed('0x4')](_0x8bed('0x32'),_0x4c98f9[_0x8bed('0x5')]),_0x4c98f9);utils[_0x8bed('0x3')](util[_0x8bed('0x4')](_0x8bed('0x33'),_0x4c98f9['uniqueid'],_0x4c98f9['application'],_0x4c98f9[_0x8bed('0x34')]));if(_0x4c98f9[_0x8bed('0x35')]['toLowerCase']()==_0x8bed('0x36')&&_[_0x8bed('0x37')](_0x4c98f9[_0x8bed('0x34')][_0x8bed('0x38')](),_0x8bed('0x39'))){var _0x43b3d8=_0x4c98f9['appdata'][_0x8bed('0x3a')]('=');var _0x4b419f=_0x43b3d8[0x0]['substring'](_0x43b3d8[0x0][_0x8bed('0x3b')]('(')+0x1,_0x43b3d8[0x0][_0x8bed('0x3b')](')'));var _0x3ceb73=_0x43b3d8[0x1];recordings[_0x4c98f9[_0x8bed('0x5')]][_0x4b419f]=_0x3ceb73;}}}catch(_0x5b8bc7){utils[_0x8bed('0x13')](util['format'](_0x8bed('0x32'),_0x4c98f9[_0x8bed('0x5')]),_0x5b8bc7);}};exports[_0x8bed('0x3c')]=function(_0x5a55e5){try{if(!_[_0x8bed('0x16')](recordings[_0x5a55e5[_0x8bed('0x5')]])){utils[_0x8bed('0xd')](util[_0x8bed('0x4')](_0x8bed('0x3d'),_0x5a55e5['uniqueid']),_0x5a55e5);utils[_0x8bed('0x3')](util[_0x8bed('0x4')](_0x8bed('0x3e'),_0x5a55e5[_0x8bed('0x5')],_0x5a55e5['queue']));recordings[_0x5a55e5[_0x8bed('0x5')]][_0x8bed('0x3f')]=_0x5a55e5[_0x8bed('0x3f')];}}catch(_0x1b5aba){utils[_0x8bed('0x13')](util[_0x8bed('0x4')](_0x8bed('0x3d'),_0x5a55e5['uniqueid']),_0x1b5aba);}}; \ No newline at end of file +var _0x143d=['value','.wav49','replace','find','monitors','push','hangup','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','context','accountcode','exten','channel','newstate','[%s][recordings][newstate]','channelstate','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith'];(function(_0x508fc5,_0x28cdc0){var _0x26fc7b=function(_0x226f6e){while(--_0x226f6e){_0x508fc5['push'](_0x508fc5['shift']());}};_0x26fc7b(++_0x28cdc0);}(_0x143d,0x112));var _0xd143=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0x143d[_0x1c2f29];return _0x258465;};'use strict';var _=require(_0xd143('0x0'));var util=require(_0xd143('0x1'));var utils=require(_0xd143('0x2'));var recordings={};function writeDB(_0x24ff49){utils[_0xd143('0x3')](util[_0xd143('0x4')]('[%s][recordings][writeDB]',_0x24ff49[_0xd143('0x5')]));if(_0x24ff49['accountcode']){utils[_0xd143('0x6')](_0x24ff49['accountcode'])[_0xd143('0x7')](function(_0x407efc){if(_0x407efc){_0x24ff49['membername']=_0x407efc[_0xd143('0x8')];_0x24ff49[_0xd143('0x9')]=_0x407efc['id'];}utils[_0xd143('0xa')](_0xd143('0xb'),_0x24ff49);});}else{utils[_0xd143('0xa')](_0xd143('0xb'),_0x24ff49);}}exports[_0xd143('0xc')]=function(_0x1492cf){try{utils[_0xd143('0xd')](util[_0xd143('0x4')](_0xd143('0xe'),_0x1492cf['uniqueid']),_0x1492cf);if(_0x1492cf['uniqueid']==_0x1492cf['linkedid']){utils[_0xd143('0x3')](util[_0xd143('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1492cf['uniqueid'],_0x1492cf[_0xd143('0xf')],_0x1492cf['exten']));recordings[_0x1492cf['uniqueid']]={'uniqueid':_0x1492cf[_0xd143('0x5')],'accountcode':_0x1492cf[_0xd143('0x10')],'exten':_0x1492cf[_0xd143('0x11')],'context':_0x1492cf[_0xd143('0xf')],'channel':_0x1492cf[_0xd143('0x12')],'monitors':[]};}}catch(_0x4a5591){utils['error'](util[_0xd143('0x4')]('[%s][recordings][newchannel]',_0x1492cf['uniqueid']),_0x4a5591);}};exports[_0xd143('0x13')]=function(_0x3e7ac9){try{utils[_0xd143('0xd')](util['format'](_0xd143('0x14'),_0x3e7ac9[_0xd143('0x5')]),_0x3e7ac9);if(!_['isNil'](recordings[_0x3e7ac9[_0xd143('0x5')]])&&_0x3e7ac9[_0xd143('0x15')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3e7ac9[_0xd143('0x5')],_0x3e7ac9[_0xd143('0xf')],_0x3e7ac9['channel']));}else if(!_[_0xd143('0x16')](recordings[_0x3e7ac9[_0xd143('0x17')]])&&_0x3e7ac9[_0xd143('0x15')]==0x6&&_0x3e7ac9[_0xd143('0xf')]!=_0xd143('0x18')){utils['info'](util[_0xd143('0x4')](_0xd143('0x19'),_0x3e7ac9[_0xd143('0x5')],_0x3e7ac9['linkedid'],_0x3e7ac9['context'],_0x3e7ac9[_0xd143('0x12')]));recordings[_0x3e7ac9[_0xd143('0x17')]][_0xd143('0x10')]=_0x3e7ac9['accountcode'];}}catch(_0x53e9d9){utils[_0xd143('0x1a')](util[_0xd143('0x4')](_0xd143('0x14'),_0x3e7ac9['uniqueid']),_0x53e9d9);}};exports[_0xd143('0x1b')]=function(_0x1d6da2){try{if(!_[_0xd143('0x16')](_0x1d6da2[_0xd143('0x1c')])&&!_[_0xd143('0x16')](_0x1d6da2[_0xd143('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0xd143('0x4')]('[%s][recordings][varset]',_0x1d6da2[_0xd143('0x5')]),_0x1d6da2);utils[_0xd143('0x3')](util[_0xd143('0x4')](_0xd143('0x1d'),_0x1d6da2[_0xd143('0x5')],_0x1d6da2[_0xd143('0x1c')],_0x1d6da2['value']));if(_[_0xd143('0x1e')](_0x1d6da2[_0xd143('0x1f')],_0xd143('0x20'))){_0x1d6da2['value']=_0x1d6da2['value'][_0xd143('0x21')](_0xd143('0x20'),'.WAV');}if(recordings[_0x1d6da2['linkedid']]){var _0x2a0bcf=_[_0xd143('0x22')](recordings[_0x1d6da2[_0xd143('0x17')]]['monitors'],{'value':_0x1d6da2['value']});if(_[_0xd143('0x16')](_0x2a0bcf)){recordings[_0x1d6da2[_0xd143('0x17')]][_0xd143('0x23')][_0xd143('0x24')]({'value':_0x1d6da2['value']});}}}}catch(_0x4bedad){utils[_0xd143('0x1a')](util[_0xd143('0x4')]('[%s][recordings][varset]',_0x1d6da2['uniqueid']),_0x4bedad);}};exports[_0xd143('0x25')]=function(_0x18e1f2){try{if(!_['isNil'](recordings[_0x18e1f2['uniqueid']])){utils[_0xd143('0xd')](util[_0xd143('0x4')]('[%s][recordings][hangup]',_0x18e1f2[_0xd143('0x5')]),_0x18e1f2);utils[_0xd143('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x18e1f2[_0xd143('0x5')],_0x18e1f2['calleridnum'],_0x18e1f2[_0xd143('0x26')],_0x18e1f2[_0xd143('0x27')]));recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x28')]=_0x18e1f2[_0xd143('0x28')];recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x26')]=_0x18e1f2[_0xd143('0x26')];recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x29')]=_0x18e1f2[_0xd143('0x29')];recordings[_0x18e1f2['uniqueid']][_0xd143('0x2a')]=_0x18e1f2['connectedlinename'];if(recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x2b')]=='outbound'&&recordings[_0x18e1f2['uniqueid']][_0xd143('0x10')]){recordings[_0x18e1f2['uniqueid']][_0xd143('0x29')]=recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x10')];recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x2a')]='';}recordings[_0x18e1f2[_0xd143('0x5')]][_0xd143('0x23')][_0xd143('0x2c')](function(_0x22b9d7){var _0x53aaf5=_[_0xd143('0x2d')](recordings[_0x18e1f2[_0xd143('0x5')]]);_0x53aaf5[_0xd143('0x1f')]=_0x22b9d7[_0xd143('0x1f')];writeDB(_0x53aaf5);});delete recordings[_0x18e1f2[_0xd143('0x5')]];}}catch(_0x1d9847){utils[_0xd143('0x1a')](util[_0xd143('0x4')](_0xd143('0x2e'),_0x18e1f2['uniqueid']),_0x1d9847);}};exports['newexten']=function(_0x4bd39c){try{if(!_[_0xd143('0x16')](recordings[_0x4bd39c['uniqueid']])){utils['debug'](util[_0xd143('0x4')]('[%s][recordings][newexten]',_0x4bd39c[_0xd143('0x5')]),_0x4bd39c);utils[_0xd143('0x3')](util[_0xd143('0x4')](_0xd143('0x2f'),_0x4bd39c['uniqueid'],_0x4bd39c[_0xd143('0x30')],_0x4bd39c[_0xd143('0x31')]));if(_0x4bd39c['application'][_0xd143('0x32')]()=='set'&&_[_0xd143('0x33')](_0x4bd39c[_0xd143('0x31')][_0xd143('0x32')](),_0xd143('0x34'))){var _0x28b0db=_0x4bd39c[_0xd143('0x31')][_0xd143('0x35')]('=');var _0x510e92=_0x28b0db[0x0][_0xd143('0x36')](_0x28b0db[0x0]['lastIndexOf']('(')+0x1,_0x28b0db[0x0][_0xd143('0x37')](')'));var _0x219433=_0x28b0db[0x1];recordings[_0x4bd39c[_0xd143('0x5')]][_0x510e92]=_0x219433;}}}catch(_0x36d643){utils['error'](util['format'](_0xd143('0x38'),_0x4bd39c[_0xd143('0x5')]),_0x36d643);}};exports[_0xd143('0x39')]=function(_0x24f183){try{if(!_[_0xd143('0x16')](recordings[_0x24f183[_0xd143('0x5')]])){utils[_0xd143('0xd')](util[_0xd143('0x4')](_0xd143('0x3a'),_0x24f183[_0xd143('0x5')]),_0x24f183);utils[_0xd143('0x3')](util[_0xd143('0x4')](_0xd143('0x3b'),_0x24f183['uniqueid'],_0x24f183['queue']));recordings[_0x24f183[_0xd143('0x5')]][_0xd143('0x3c')]=_0x24f183[_0xd143('0x3c')];}}catch(_0x5e2134){utils[_0xd143('0x1a')](util['format']('[%s][recordings][queuecallerjoin]',_0x24f183[_0xd143('0x5')]),_0x5e2134);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 398c5cc..e4592f7 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 _0xb2ac=['info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0xe25a57,_0x50ede4){var _0x17199d=function(_0x3faa67){while(--_0x3faa67){_0xe25a57['push'](_0xe25a57['shift']());}};_0x17199d(++_0x50ede4);}(_0xb2ac,0x1c8));var _0xcb2a=function(_0x4e4532,_0x49a081){_0x4e4532=_0x4e4532-0x0;var _0x1d1fb1=_0xb2ac[_0x4e4532];return _0x1d1fb1;};'use strict';var _=require('lodash');var util=require(_0xcb2a('0x0'));var utils=require(_0xcb2a('0x1'));function writeDB(_0x109a83){utils['info'](util['format'](_0xcb2a('0x2'),_0x109a83['type']==='attended'?_0x109a83[_0xcb2a('0x3')]:_0x109a83[_0xcb2a('0x4')],_0x109a83[_0xcb2a('0x5')]));utils['request'](_0xcb2a('0x6'),_0x109a83);}exports[_0xcb2a('0x7')]={};exports[_0xcb2a('0x8')]=function(_0x5b086f){try{utils[_0xcb2a('0x9')](util[_0xcb2a('0xa')](_0xcb2a('0xb'),_0x5b086f['uniqueid']),_0x5b086f);utils[_0xcb2a('0xc')](util['format'](_0xcb2a('0xd'),_0x5b086f[_0xcb2a('0x4')],_0x5b086f[_0xcb2a('0xe')],_0x5b086f['transferercalleridname'],_0x5b086f[_0xcb2a('0xf')],_0x5b086f['transfereecalleridname']));_0x5b086f[_0xcb2a('0x5')]=_0xcb2a('0x10');exports[_0xcb2a('0x7')][_0x5b086f['transfereruniqueid']]=_0x5b086f;writeDB(_0x5b086f);}catch(_0x348ad9){utils[_0xcb2a('0x11')](util['format'](_0xcb2a('0xb'),_0x5b086f['uniqueid']),_0x348ad9);}};exports[_0xcb2a('0x12')]=function(_0x4a5d1b){try{utils[_0xcb2a('0x9')](util[_0xcb2a('0xa')](_0xcb2a('0x13'),_0x4a5d1b['origtransfereruniqueid']),_0x4a5d1b);utils[_0xcb2a('0xc')](util[_0xcb2a('0xa')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4a5d1b[_0xcb2a('0x3')],_0x4a5d1b['origtransferercalleridnum'],_0x4a5d1b[_0xcb2a('0x14')],_0x4a5d1b[_0xcb2a('0x15')],_0x4a5d1b[_0xcb2a('0x16')]));_0x4a5d1b=_[_0xcb2a('0x17')](_0x4a5d1b,{'transfererchannel':_0x4a5d1b['origtransfererchannel'],'transferercalleridnum':_0x4a5d1b['origtransferercalleridnum'],'transferercalleridname':_0x4a5d1b[_0xcb2a('0x14')],'transfererconnectedlinenum':_0x4a5d1b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4a5d1b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4a5d1b[_0xcb2a('0x18')],'transferercontext':_0x4a5d1b[_0xcb2a('0x19')],'transfererexten':_0x4a5d1b[_0xcb2a('0x1a')],'transfererlinkedid':_0x4a5d1b[_0xcb2a('0x1b')],'context':_0x4a5d1b[_0xcb2a('0x1c')],'extension':_0x4a5d1b['origtransfererexten'],'type':_0xcb2a('0x1d')});if(_[_0xcb2a('0x1e')](_0x4a5d1b[_0xcb2a('0x1f')])){_0x4a5d1b=_['assign'](_0x4a5d1b,{'transfereechannel':_0x4a5d1b['transfertargetchannel'],'transfereecalleridnum':_0x4a5d1b[_0xcb2a('0x15')],'transfereecalleridname':_0x4a5d1b[_0xcb2a('0x16')],'transfereeconnectedlinenum':_0x4a5d1b['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4a5d1b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4a5d1b[_0xcb2a('0x20')],'transfereecontext':_0x4a5d1b[_0xcb2a('0x21')],'transfereeexten':_0x4a5d1b[_0xcb2a('0x22')],'transfereelinkedid':_0x4a5d1b[_0xcb2a('0x23')]});}writeDB(_0x4a5d1b);}catch(_0x3f6468){utils[_0xcb2a('0x11')](util[_0xcb2a('0xa')](_0xcb2a('0x13'),_0x4a5d1b['origtransfereruniqueid']),_0x3f6468);}}; \ No newline at end of file +var _0x9901=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','blinds','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x5ee336,_0x21bfbe){var _0x4ff51d=function(_0x495d23){while(--_0x495d23){_0x5ee336['push'](_0x5ee336['shift']());}};_0x4ff51d(++_0x21bfbe);}(_0x9901,0xd7));var _0x1990=function(_0x81697e,_0x552c16){_0x81697e=_0x81697e-0x0;var _0x1f6e36=_0x9901[_0x81697e];return _0x1f6e36;};'use strict';var _=require(_0x1990('0x0'));var util=require(_0x1990('0x1'));var utils=require('./utils');function writeDB(_0x40adef){utils[_0x1990('0x2')](util[_0x1990('0x3')](_0x1990('0x4'),_0x40adef['type']===_0x1990('0x5')?_0x40adef[_0x1990('0x6')]:_0x40adef[_0x1990('0x7')],_0x40adef['type']));utils[_0x1990('0x8')]('CreateVoiceTransferReport',_0x40adef);}exports['blinds']={};exports[_0x1990('0x9')]=function(_0x71e39){try{utils[_0x1990('0xa')](util[_0x1990('0x3')](_0x1990('0xb'),_0x71e39[_0x1990('0x7')]),_0x71e39);utils[_0x1990('0x2')](util[_0x1990('0x3')](_0x1990('0xc'),_0x71e39['uniqueid'],_0x71e39[_0x1990('0xd')],_0x71e39[_0x1990('0xe')],_0x71e39[_0x1990('0xf')],_0x71e39[_0x1990('0x10')]));_0x71e39[_0x1990('0x11')]=_0x1990('0x12');exports[_0x1990('0x13')][_0x71e39['transfereruniqueid']]=_0x71e39;writeDB(_0x71e39);}catch(_0x3b0081){utils[_0x1990('0x14')](util[_0x1990('0x3')](_0x1990('0xb'),_0x71e39[_0x1990('0x7')]),_0x3b0081);}};exports['attendedtransfer']=function(_0x524419){try{utils[_0x1990('0xa')](util[_0x1990('0x3')](_0x1990('0x15'),_0x524419[_0x1990('0x6')]),_0x524419);utils[_0x1990('0x2')](util[_0x1990('0x3')](_0x1990('0x16'),_0x524419['origtransfereruniqueid'],_0x524419[_0x1990('0x17')],_0x524419[_0x1990('0x18')],_0x524419[_0x1990('0x19')],_0x524419[_0x1990('0x1a')]));_0x524419=_['assign'](_0x524419,{'transfererchannel':_0x524419['origtransfererchannel'],'transferercalleridnum':_0x524419[_0x1990('0x17')],'transferercalleridname':_0x524419['origtransferercalleridname'],'transfererconnectedlinenum':_0x524419[_0x1990('0x1b')],'transfererconnectedlinename':_0x524419[_0x1990('0x1c')],'transfereraccountcode':_0x524419['origtransfereraccountcode'],'transferercontext':_0x524419['secondtransferercontext'],'transfererexten':_0x524419['secondtransfererexten'],'transfererlinkedid':_0x524419['origtransfererlinkedid'],'context':_0x524419[_0x1990('0x1d')],'extension':_0x524419[_0x1990('0x1e')],'type':'attended'});if(_[_0x1990('0x1f')](_0x524419[_0x1990('0x20')])){_0x524419=_[_0x1990('0x21')](_0x524419,{'transfereechannel':_0x524419['transfertargetchannel'],'transfereecalleridnum':_0x524419[_0x1990('0x19')],'transfereecalleridname':_0x524419[_0x1990('0x1a')],'transfereeconnectedlinenum':_0x524419['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x524419[_0x1990('0x22')],'transfereeaccountcode':_0x524419[_0x1990('0x23')],'transfereecontext':_0x524419['transfertargetcontext'],'transfereeexten':_0x524419[_0x1990('0x24')],'transfereelinkedid':_0x524419[_0x1990('0x25')]});}writeDB(_0x524419);}catch(_0x58734e){utils[_0x1990('0x14')](util['format'](_0x1990('0x15'),_0x524419[_0x1990('0x6')]),_0x58734e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 482f339..7bc68f2 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 _0x92f3=['internal','name','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser'];(function(_0x44ed25,_0x25b118){var _0x4abae6=function(_0x32ec43){while(--_0x32ec43){_0x44ed25['push'](_0x44ed25['shift']());}};_0x4abae6(++_0x25b118);}(_0x92f3,0xf0));var _0x392f=function(_0xe36b9a,_0x400e8e){_0xe36b9a=_0xe36b9a-0x0;var _0x85d06c=_0x92f3[_0xe36b9a];return _0x85d06c;};'use strict';var BPromise=require(_0x392f('0x0'));var jayson=require(_0x392f('0x1'));var moment=require(_0x392f('0x2'));var util=require(_0x392f('0x3'));var client=jayson[_0x392f('0x4')][_0x392f('0x5')]({'port':0x2329});var logger=require(_0x392f('0x6'))('xdr');exports[_0x392f('0x7')]=function(_0x9ccaa6,_0x123a70){logger[_0x392f('0x7')](_0x9ccaa6,_0x123a70?util[_0x392f('0x8')](_0x123a70,{'showHidden':![],'depth':null}):'');};exports[_0x392f('0x9')]=function(_0x3c4297,_0x1a7a10){logger[_0x392f('0x9')](_0x3c4297,_0x1a7a10?util[_0x392f('0x8')](_0x1a7a10,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3c7d85,_0x4b15c0){logger[_0x392f('0xa')](_0x3c7d85,_0x4b15c0?util['inspect'](_0x4b15c0,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2f726f,_0x28ffae){return client[_0x392f('0xb')](_0x2f726f,{'body':_0x28ffae})['then'](function(_0x58d362){logger[_0x392f('0x9')](_0x392f('0xc'),_0x2f726f,_0x58d362?util['inspect'](_0x58d362,{'showHidden':![],'depth':null}):'');})[_0x392f('0xd')](function(_0x155273){logger['error'](_0x392f('0xc'),_0x2f726f,_0x155273?util[_0x392f('0x8')](_0x155273,{'showHidden':![],'depth':null}):'');});};function getUser(_0x597a32){return client[_0x392f('0xb')](_0x392f('0xe'),{'options':{'raw':!![],'attributes':['id',_0x392f('0xf'),_0x392f('0x10'),'interface'],'where':_0x597a32,'limit':0x1}})[_0x392f('0x11')](function(_0x3f0f0e){logger[_0x392f('0x9')](_0x392f('0x12'),JSON[_0x392f('0x13')](_0x597a32),_0x3f0f0e?util[_0x392f('0x8')](_0x3f0f0e,{'showHidden':![],'depth':null}):'');return _0x3f0f0e['result'][_0x392f('0x14')]?_0x3f0f0e[_0x392f('0x15')][0x0]:null;});}exports[_0x392f('0x16')]=function(_0x44d877){return new BPromise(function(_0x6dd67b,_0x2cc955){if(_0x44d877){return getUser({'internal':_0x44d877})['then'](function(_0x110a40){logger[_0x392f('0x7')](_0x392f('0x17'),_0x44d877,_0x110a40?'found':'notfound');return _0x6dd67b(_0x110a40);})[_0x392f('0xd')](function(_0xc60426){logger[_0x392f('0xa')]('[utils][getUserByInternal]',_0xc60426?util[_0x392f('0x8')](_0xc60426,{'showHidden':![],'depth':null}):'');return _0x6dd67b(null);});}return _0x6dd67b(null);});};exports[_0x392f('0x18')]=function(_0x3d9b6c){return new BPromise(function(_0x1ac696,_0x5d155b){if(_0x3d9b6c){return getUser({'interface':_0x3d9b6c})[_0x392f('0x11')](function(_0x1df5a4){logger[_0x392f('0x7')](_0x392f('0x19'),_0x3d9b6c,_0x1df5a4?_0x392f('0x1a'):'notfound');return _0x1ac696(_0x1df5a4);})[_0x392f('0xd')](function(_0x238f76){logger[_0x392f('0xa')](_0x392f('0x1b'),_0x238f76?util[_0x392f('0x8')](_0x238f76,{'showHidden':![],'depth':null}):'');return _0x1ac696(null);});}return _0x1ac696(null);});};exports[_0x392f('0x1c')]=function(_0x2b5253){return new BPromise(function(_0x273f70,_0x5e8ad4){if(_0x2b5253){return getUser({'name':_0x2b5253})['then'](function(_0x1d6f8c){logger[_0x392f('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2b5253,_0x1d6f8c?_0x392f('0x1a'):_0x392f('0x1d'));return _0x273f70(_0x1d6f8c);})[_0x392f('0xd')](function(_0xed9f61){logger['error'](_0x392f('0x1e'),_0xed9f61?util[_0x392f('0x8')](_0xed9f61,{'showHidden':![],'depth':null}):'');return _0x273f70(null);});}return _0x273f70(null);});};exports[_0x392f('0x1f')]=function(_0x3d78bd){return new BPromise(function(_0xc15fee,_0x59c87f){if(_0x3d78bd){return client['request'](_0x392f('0x20'),{'options':{'raw':!![],'attributes':['id',_0x392f('0x10'),_0x392f('0x21'),_0x392f('0x22'),_0x392f('0x23')],'where':{'name':_0x3d78bd},'limit':0x1}})[_0x392f('0x11')](function(_0x5c54a7){logger[_0x392f('0x9')](_0x392f('0x24'),_0x3d78bd,_0x5c54a7?util[_0x392f('0x8')](_0x5c54a7,{'showHidden':![],'depth':null}):'');logger['info'](_0x392f('0x25'),_0x3d78bd,_0x5c54a7?_0x392f('0x1a'):_0x392f('0x1d'));return _0xc15fee(_0x5c54a7[_0x392f('0x15')][_0x392f('0x14')]?_0x5c54a7[_0x392f('0x15')][0x0]:null);})['catch'](function(_0x292d0f){logger[_0x392f('0xa')]('[utils][getVoiceQueueByName]',_0x292d0f?util[_0x392f('0x8')](_0x292d0f,{'showHidden':![],'depth':null}):'');return _0xc15fee(null);});}return _0xc15fee(null);});};exports[_0x392f('0x26')]=function(_0x553451,_0x588a35){return moment(_0x553451)[_0x392f('0x27')](_0x588a35,'seconds')[_0x392f('0x28')](_0x392f('0x29'));};exports[_0x392f('0x2a')]=function(_0x23aaad,_0x3558ce){return moment(_0x23aaad)[_0x392f('0x2b')](_0x3558ce,_0x392f('0x2c'))[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x2d')]=function(_0x5c70b4,_0x5bae68){return moment(_0x5c70b4)[_0x392f('0x2e')](moment(_0x5bae68),_0x392f('0x2c'));};exports[_0x392f('0x2f')]=function(_0x59ed43,_0x168896){return parseInt(_0x59ed43,0xa)+parseInt(_0x168896,0xa);};exports[_0x392f('0x30')]=function(){return moment()[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x31')]=function(_0x65c7f3,_0x5de4b9){if(_0x5de4b9){return moment(_0x65c7f3)[_0x392f('0x31')](_0x5de4b9);}return!![];};exports[_0x392f('0x32')]=function(_0x5839e4,_0x24c833){if(_0x24c833){return moment(_0x5839e4)[_0x392f('0x32')](_0x24c833);}else if(_0x5839e4){return!![];}return![];}; \ No newline at end of file +var _0x5a45=['isBefore','jayson/promise','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diff','sumTime','now','isAfter'];(function(_0x8ec947,_0x444fa2){var _0x115d2b=function(_0x4cbd1a){while(--_0x4cbd1a){_0x8ec947['push'](_0x8ec947['shift']());}};_0x115d2b(++_0x444fa2);}(_0x5a45,0x143));var _0x55a4=function(_0xb74bb5,_0x1a9d36){_0xb74bb5=_0xb74bb5-0x0;var _0xa52799=_0x5a45[_0xb74bb5];return _0xa52799;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x55a4('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0x55a4('0x1')][_0x55a4('0x2')]({'port':0x2329});var logger=require(_0x55a4('0x3'))('xdr');exports[_0x55a4('0x4')]=function(_0x3e5034,_0x3f8a8e){logger[_0x55a4('0x4')](_0x3e5034,_0x3f8a8e?util[_0x55a4('0x5')](_0x3f8a8e,{'showHidden':![],'depth':null}):'');};exports[_0x55a4('0x6')]=function(_0x5b8b66,_0x408d4a){logger[_0x55a4('0x6')](_0x5b8b66,_0x408d4a?util[_0x55a4('0x5')](_0x408d4a,{'showHidden':![],'depth':null}):'');};exports[_0x55a4('0x7')]=function(_0x3e4e2b,_0x44d1d0){logger[_0x55a4('0x7')](_0x3e4e2b,_0x44d1d0?util[_0x55a4('0x5')](_0x44d1d0,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2520a6,_0x3e4a5d){return client[_0x55a4('0x8')](_0x2520a6,{'body':_0x3e4a5d})[_0x55a4('0x9')](function(_0x41db60){logger[_0x55a4('0x6')](_0x55a4('0xa'),_0x2520a6,_0x41db60?util[_0x55a4('0x5')](_0x41db60,{'showHidden':![],'depth':null}):'');})[_0x55a4('0xb')](function(_0x469da4){logger[_0x55a4('0x7')]('[utils][request]\x20name:%s',_0x2520a6,_0x469da4?util[_0x55a4('0x5')](_0x469da4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3af56c){return client[_0x55a4('0x8')](_0x55a4('0xc'),{'options':{'raw':!![],'attributes':['id',_0x55a4('0xd'),'name',_0x55a4('0xe')],'where':_0x3af56c,'limit':0x1}})[_0x55a4('0x9')](function(_0x4a86f0){logger[_0x55a4('0x6')](_0x55a4('0xf'),JSON[_0x55a4('0x10')](_0x3af56c),_0x4a86f0?util[_0x55a4('0x5')](_0x4a86f0,{'showHidden':![],'depth':null}):'');return _0x4a86f0[_0x55a4('0x11')][_0x55a4('0x12')]?_0x4a86f0[_0x55a4('0x11')][0x0]:null;});}exports[_0x55a4('0x13')]=function(_0x197719){return new BPromise(function(_0x19d2db,_0x22a169){if(_0x197719){return getUser({'internal':_0x197719})[_0x55a4('0x9')](function(_0x35e70b){logger['info'](_0x55a4('0x14'),_0x197719,_0x35e70b?_0x55a4('0x15'):_0x55a4('0x16'));return _0x19d2db(_0x35e70b);})[_0x55a4('0xb')](function(_0x10a8b1){logger[_0x55a4('0x7')](_0x55a4('0x17'),_0x10a8b1?util[_0x55a4('0x5')](_0x10a8b1,{'showHidden':![],'depth':null}):'');return _0x19d2db(null);});}return _0x19d2db(null);});};exports[_0x55a4('0x18')]=function(_0x2814f3){return new BPromise(function(_0x547531,_0x57bb92){if(_0x2814f3){return getUser({'interface':_0x2814f3})[_0x55a4('0x9')](function(_0xbe7b40){logger[_0x55a4('0x4')](_0x55a4('0x19'),_0x2814f3,_0xbe7b40?'found':_0x55a4('0x16'));return _0x547531(_0xbe7b40);})[_0x55a4('0xb')](function(_0x17e25b){logger[_0x55a4('0x7')]('[utils][getUserByInterface]',_0x17e25b?util[_0x55a4('0x5')](_0x17e25b,{'showHidden':![],'depth':null}):'');return _0x547531(null);});}return _0x547531(null);});};exports[_0x55a4('0x1a')]=function(_0x7ca07){return new BPromise(function(_0x59a8f7,_0x9527bb){if(_0x7ca07){return getUser({'name':_0x7ca07})[_0x55a4('0x9')](function(_0xf63b5c){logger[_0x55a4('0x4')](_0x55a4('0x1b'),_0x7ca07,_0xf63b5c?_0x55a4('0x15'):_0x55a4('0x16'));return _0x59a8f7(_0xf63b5c);})[_0x55a4('0xb')](function(_0x4c0fd9){logger[_0x55a4('0x7')](_0x55a4('0x1c'),_0x4c0fd9?util[_0x55a4('0x5')](_0x4c0fd9,{'showHidden':![],'depth':null}):'');return _0x59a8f7(null);});}return _0x59a8f7(null);});};exports[_0x55a4('0x1d')]=function(_0x1d833a){return new BPromise(function(_0x3dca2f,_0x3e6fba){if(_0x1d833a){return client[_0x55a4('0x8')](_0x55a4('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x55a4('0x1f'),_0x55a4('0x20'),'acw','acwTimeout'],'where':{'name':_0x1d833a},'limit':0x1}})[_0x55a4('0x9')](function(_0x124d34){logger[_0x55a4('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1d833a,_0x124d34?util[_0x55a4('0x5')](_0x124d34,{'showHidden':![],'depth':null}):'');logger[_0x55a4('0x4')](_0x55a4('0x21'),_0x1d833a,_0x124d34?_0x55a4('0x15'):_0x55a4('0x16'));return _0x3dca2f(_0x124d34[_0x55a4('0x11')][_0x55a4('0x12')]?_0x124d34[_0x55a4('0x11')][0x0]:null);})[_0x55a4('0xb')](function(_0x3b4975){logger[_0x55a4('0x7')](_0x55a4('0x22'),_0x3b4975?util['inspect'](_0x3b4975,{'showHidden':![],'depth':null}):'');return _0x3dca2f(null);});}return _0x3dca2f(null);});};exports[_0x55a4('0x23')]=function(_0x298231,_0x46a70b){return moment(_0x298231)[_0x55a4('0x24')](_0x46a70b,'seconds')[_0x55a4('0x25')](_0x55a4('0x26'));};exports['subtractTime']=function(_0x29f4d0,_0x2b636a){return moment(_0x29f4d0)[_0x55a4('0x27')](_0x2b636a,_0x55a4('0x28'))[_0x55a4('0x25')](_0x55a4('0x26'));};exports['diffTime']=function(_0x2a8d9a,_0x381461){return moment(_0x2a8d9a)[_0x55a4('0x29')](moment(_0x381461),'seconds');};exports[_0x55a4('0x2a')]=function(_0x5a2bd2,_0x259381){return parseInt(_0x5a2bd2,0xa)+parseInt(_0x259381,0xa);};exports[_0x55a4('0x2b')]=function(){return moment()[_0x55a4('0x25')](_0x55a4('0x26'));};exports[_0x55a4('0x2c')]=function(_0x37f48f,_0x55e512){if(_0x55e512){return moment(_0x37f48f)['isAfter'](_0x55e512);}return!![];};exports[_0x55a4('0x2d')]=function(_0x1ccd34,_0x2f9dcf){if(_0x2f9dcf){return moment(_0x1ccd34)['isBefore'](_0x2f9dcf);}else if(_0x1ccd34){return!![];}return![];}; \ No newline at end of file -- 1.7.1